@inno_user/inno_clouds_lib 9.3.2 → 9.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@inno_user/inno_clouds_lib.css +1 -1
- package/dist/@inno_user/inno_clouds_lib.es.js +7016 -7036
- package/dist/@inno_user/inno_clouds_lib.umd.js +19 -19
- package/dist/components/cartPayment/CartPayment.vue.d.ts +0 -2
- package/dist/requests.d.ts +5 -2
- package/dist/semantics/paymentBoxes/PaymentBoxes.vue.d.ts +0 -4
- package/dist/store/cart.d.ts +4 -4
- package/dist/store/theme.d.ts +0 -9
- package/dist/types/iTheme.d.ts +0 -1
- package/dist/types/payment.d.ts +0 -1
- package/package.json +1 -1
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
(function(fe,Re){typeof exports=="object"&&typeof module<"u"?Re(exports,require("vue-router"),require("pinia"),require("vue"),require("@vueuse/core"),require("motion-v")):typeof define=="function"&&define.amd?define(["exports","vue-router","pinia","vue","@vueuse/core","motion-v"],Re):(fe=typeof globalThis<"u"?globalThis:fe||self,Re(fe.InnoCloudsLib={},fe.VueRouter,fe.Pinia,fe.Vue,fe.VueuseCore,fe.motionV))})(this,function(fe,Re,xe,l,Wt,At){"use strict";var Pg=Object.defineProperty;var el=fe=>{throw TypeError(fe)};var Lg=(fe,Re,xe)=>Re in fe?Pg(fe,Re,{enumerable:!0,configurable:!0,writable:!0,value:xe}):fe[Re]=xe;var We=(fe,Re,xe)=>Lg(fe,typeof Re!="symbol"?Re+"":Re,xe),tl=(fe,Re,xe)=>Re.has(fe)||el("Cannot "+xe);var pn=(fe,Re,xe)=>(tl(fe,Re,"read from private field"),xe?xe.call(fe):Re.get(fe)),vi=(fe,Re,xe)=>Re.has(fe)?el("Cannot add the same private member more than once"):Re instanceof WeakSet?Re.add(fe):Re.set(fe,xe),Dn=(fe,Re,xe,l)=>(tl(fe,Re,"write to private field"),l?l.call(fe,xe):Re.set(fe,xe),xe);var Ho=(fe,Re,xe,l)=>({set _(Wt){Dn(fe,Re,Wt,xe)},get _(){return pn(fe,Re,l)}});var Qt,Hn,nr;function rl(o,s){for(var i=0;i<s.length;i++){const u=s[i];if(typeof u!="string"&&!Array.isArray(u)){for(const f in u)if(f!=="default"&&!(f in o)){const h=Object.getOwnPropertyDescriptor(u,f);h&&Object.defineProperty(o,f,h.get?h:{enumerable:!0,get:()=>u[f]})}}}return Object.freeze(Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}))}function il(o){return o}const ol=[];function sl(){return Re.createRouter({history:Re.createWebHistory(),routes:ol})}const Di=(o,s)=>s.some(i=>o instanceof i);let Go,Wo;function al(){return Go||(Go=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function ll(){return Wo||(Wo=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Pi=new WeakMap,Li=new WeakMap,Qr=new WeakMap;function cl(o){const s=new Promise((i,u)=>{const f=()=>{o.removeEventListener("success",h),o.removeEventListener("error",m)},h=()=>{i(zn(o.result)),f()},m=()=>{u(o.error),f()};o.addEventListener("success",h),o.addEventListener("error",m)});return Qr.set(s,o),s}function ul(o){if(Pi.has(o))return;const s=new Promise((i,u)=>{const f=()=>{o.removeEventListener("complete",h),o.removeEventListener("error",m),o.removeEventListener("abort",m)},h=()=>{i(),f()},m=()=>{u(o.error||new DOMException("AbortError","AbortError")),f()};o.addEventListener("complete",h),o.addEventListener("error",m),o.addEventListener("abort",m)});Pi.set(o,s)}let Fi={get(o,s,i){if(o instanceof IDBTransaction){if(s==="done")return Pi.get(o);if(s==="store")return i.objectStoreNames[1]?void 0:i.objectStore(i.objectStoreNames[0])}return zn(o[s])},set(o,s,i){return o[s]=i,!0},has(o,s){return o instanceof IDBTransaction&&(s==="done"||s==="store")?!0:s in o}};function Xo(o){Fi=o(Fi)}function dl(o){return ll().includes(o)?function(...s){return o.apply(Vi(this),s),zn(this.request)}:function(...s){return zn(o.apply(Vi(this),s))}}function fl(o){return typeof o=="function"?dl(o):(o instanceof IDBTransaction&&ul(o),Di(o,al())?new Proxy(o,Fi):o)}function zn(o){if(o instanceof IDBRequest)return cl(o);if(Li.has(o))return Li.get(o);const s=fl(o);return s!==o&&(Li.set(o,s),Qr.set(s,o)),s}const Vi=o=>Qr.get(o);function hl(o,s,{blocked:i,upgrade:u,blocking:f,terminated:h}={}){const m=indexedDB.open(o,s),x=zn(m);return u&&m.addEventListener("upgradeneeded",_=>{u(zn(m.result),_.oldVersion,_.newVersion,zn(m.transaction),_)}),i&&m.addEventListener("blocked",_=>i(_.oldVersion,_.newVersion,_)),x.then(_=>{h&&_.addEventListener("close",()=>h()),f&&_.addEventListener("versionchange",p=>f(p.oldVersion,p.newVersion,p))}).catch(()=>{}),x}function gl(o,{blocked:s}={}){const i=indexedDB.deleteDatabase(o);return s&&i.addEventListener("blocked",u=>s(u.oldVersion,u)),zn(i).then(()=>{})}const ml=["get","getKey","getAll","getAllKeys","count"],pl=["put","add","delete","clear"],Ui=new Map;function jo(o,s){if(!(o instanceof IDBDatabase&&!(s in o)&&typeof s=="string"))return;if(Ui.get(s))return Ui.get(s);const i=s.replace(/FromIndex$/,""),u=s!==i,f=pl.includes(i);if(!(i in(u?IDBIndex:IDBObjectStore).prototype)||!(f||ml.includes(i)))return;const h=async function(m,...x){const _=this.transaction(m,f?"readwrite":"readonly");let p=_.store;return u&&(p=p.index(x.shift())),(await Promise.all([p[i](...x),f&&_.done]))[0]};return Ui.set(s,h),h}Xo(o=>({...o,get:(s,i,u)=>jo(s,i)||o.get(s,i,u),has:(s,i)=>!!jo(s,i)||o.has(s,i)}));const xl=["continue","continuePrimaryKey","advance"],qo={},zi=new WeakMap,Zo=new WeakMap,wl={get(o,s){if(!xl.includes(s))return o[s];let i=qo[s];return i||(i=qo[s]=function(...u){zi.set(this,Zo.get(this)[s](...u))}),i}};async function*_l(...o){let s=this;if(s instanceof IDBCursor||(s=await s.openCursor(...o)),!s)return;s=s;const i=new Proxy(s,wl);for(Zo.set(i,s),Qr.set(i,Vi(s));s;)yield i,s=await(zi.get(i)||s.continue()),zi.delete(i)}function Yo(o,s){return s===Symbol.asyncIterator&&Di(o,[IDBIndex,IDBObjectStore,IDBCursor])||s==="iterate"&&Di(o,[IDBIndex,IDBObjectStore])}Xo(o=>({...o,get(s,i,u){return Yo(s,i)?_l:o.get(s,i,u)},has(s,i){return Yo(s,i)||o.has(s,i)}}));let cr;async function $n(){return cr||(cr=hl("data",1,{upgrade(o){o.objectStoreNames.contains("groups")||o.createObjectStore("groups",{keyPath:"id"}),o.objectStoreNames.contains("media")||o.createObjectStore("media",{keyPath:"id"}),o.objectStoreNames.contains("products")||o.createObjectStore("products",{keyPath:"id"})}})),cr}async function Hi(o){return(await $n()).transaction("groups","readonly").objectStore("groups").get(o)}async function Rr(o,s){const u=(await $n()).transaction("groups","readwrite");await u.objectStore("groups").put({id:o,data:s,timestamp:Date.now()}),await u.done}async function Cl(o,s){const i=JSON.parse(JSON.stringify(l.toRaw(s.value)));await Rr(o,i)}async function Gi(o,s){const u=(await $n()).transaction("media","readwrite");await u.objectStore("media").put({id:o,blob:s,timestamp:Date.now()}),await u.done}async function ur(o){const f=await(await $n()).transaction("media","readonly").objectStore("media").get(o);return f==null?void 0:f.blob}async function El(o){const i=(await $n()).transaction("products","readwrite"),u=i.objectStore("products"),f=o.id;await u.put({id:f,product:o,timestamp:Date.now()}),await i.done}async function $o(o){const f=await(await $n()).transaction("products","readonly").objectStore("products").get(o);return f==null?void 0:f.product}async function yl(){if(cr){const o=await cr.catch(()=>null);o&&o.close(),cr=void 0}try{await gl("data",{blocked(){console.warn("Удаление заблокировано. открыты другие вкладки с сайтом.")}})}catch(o){console.error("Не удалось удалить базу: [lib, indexedDB]",o)}}function Jr(o){"@babel/helpers - typeof";return Jr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},Jr(o)}var bl=/^\s+/,Al=/\s+$/;function Ae(o,s){if(o=o||"",s=s||{},o instanceof Ae)return o;if(!(this instanceof Ae))return new Ae(o,s);var i=Il(o);this._originalInput=o,this._r=i.r,this._g=i.g,this._b=i.b,this._a=i.a,this._roundA=Math.round(100*this._a)/100,this._format=s.format||i.format,this._gradientType=s.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=i.ok}Ae.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var s=this.toRgb();return(s.r*299+s.g*587+s.b*114)/1e3},getLuminance:function(){var s=this.toRgb(),i,u,f,h,m,x;return i=s.r/255,u=s.g/255,f=s.b/255,i<=.03928?h=i/12.92:h=Math.pow((i+.055)/1.055,2.4),u<=.03928?m=u/12.92:m=Math.pow((u+.055)/1.055,2.4),f<=.03928?x=f/12.92:x=Math.pow((f+.055)/1.055,2.4),.2126*h+.7152*m+.0722*x},setAlpha:function(s){return this._a=ns(s),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var s=Qo(this._r,this._g,this._b);return{h:s.h*360,s:s.s,v:s.v,a:this._a}},toHsvString:function(){var s=Qo(this._r,this._g,this._b),i=Math.round(s.h*360),u=Math.round(s.s*100),f=Math.round(s.v*100);return this._a==1?"hsv("+i+", "+u+"%, "+f+"%)":"hsva("+i+", "+u+"%, "+f+"%, "+this._roundA+")"},toHsl:function(){var s=Ko(this._r,this._g,this._b);return{h:s.h*360,s:s.s,l:s.l,a:this._a}},toHslString:function(){var s=Ko(this._r,this._g,this._b),i=Math.round(s.h*360),u=Math.round(s.s*100),f=Math.round(s.l*100);return this._a==1?"hsl("+i+", "+u+"%, "+f+"%)":"hsla("+i+", "+u+"%, "+f+"%, "+this._roundA+")"},toHex:function(s){return Jo(this._r,this._g,this._b,s)},toHexString:function(s){return"#"+this.toHex(s)},toHex8:function(s){return kl(this._r,this._g,this._b,this._a,s)},toHex8String:function(s){return"#"+this.toHex8(s)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(gt(this._r,255)*100)+"%",g:Math.round(gt(this._g,255)*100)+"%",b:Math.round(gt(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(gt(this._r,255)*100)+"%, "+Math.round(gt(this._g,255)*100)+"%, "+Math.round(gt(this._b,255)*100)+"%)":"rgba("+Math.round(gt(this._r,255)*100)+"%, "+Math.round(gt(this._g,255)*100)+"%, "+Math.round(gt(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:zl[Jo(this._r,this._g,this._b,!0)]||!1},toFilter:function(s){var i="#"+es(this._r,this._g,this._b,this._a),u=i,f=this._gradientType?"GradientType = 1, ":"";if(s){var h=Ae(s);u="#"+es(h._r,h._g,h._b,h._a)}return"progid:DXImageTransform.Microsoft.gradient("+f+"startColorstr="+i+",endColorstr="+u+")"},toString:function(s){var i=!!s;s=s||this._format;var u=!1,f=this._a<1&&this._a>=0,h=!i&&f&&(s==="hex"||s==="hex6"||s==="hex3"||s==="hex4"||s==="hex8"||s==="name");return h?s==="name"&&this._a===0?this.toName():this.toRgbString():(s==="rgb"&&(u=this.toRgbString()),s==="prgb"&&(u=this.toPercentageRgbString()),(s==="hex"||s==="hex6")&&(u=this.toHexString()),s==="hex3"&&(u=this.toHexString(!0)),s==="hex4"&&(u=this.toHex8String(!0)),s==="hex8"&&(u=this.toHex8String()),s==="name"&&(u=this.toName()),s==="hsl"&&(u=this.toHslString()),s==="hsv"&&(u=this.toHsvString()),u||this.toHexString())},clone:function(){return Ae(this.toString())},_applyModification:function(s,i){var u=s.apply(null,[this].concat([].slice.call(i)));return this._r=u._r,this._g=u._g,this._b=u._b,this.setAlpha(u._a),this},lighten:function(){return this._applyModification(Ml,arguments)},brighten:function(){return this._applyModification(vl,arguments)},darken:function(){return this._applyModification(Dl,arguments)},desaturate:function(){return this._applyModification(Rl,arguments)},saturate:function(){return this._applyModification(Ol,arguments)},greyscale:function(){return this._applyModification(Bl,arguments)},spin:function(){return this._applyModification(Pl,arguments)},_applyCombination:function(s,i){return s.apply(null,[this].concat([].slice.call(i)))},analogous:function(){return this._applyCombination(Vl,arguments)},complement:function(){return this._applyCombination(Ll,arguments)},monochromatic:function(){return this._applyCombination(Ul,arguments)},splitcomplement:function(){return this._applyCombination(Fl,arguments)},triad:function(){return this._applyCombination(ts,[3])},tetrad:function(){return this._applyCombination(ts,[4])}},Ae.fromRatio=function(o,s){if(Jr(o)=="object"){var i={};for(var u in o)o.hasOwnProperty(u)&&(u==="a"?i[u]=o[u]:i[u]=Or(o[u]));o=i}return Ae(o,s)};function Il(o){var s={r:0,g:0,b:0},i=1,u=null,f=null,h=null,m=!1,x=!1;return typeof o=="string"&&(o=Xl(o)),Jr(o)=="object"&&(Pn(o.r)&&Pn(o.g)&&Pn(o.b)?(s=Sl(o.r,o.g,o.b),m=!0,x=String(o.r).substr(-1)==="%"?"prgb":"rgb"):Pn(o.h)&&Pn(o.s)&&Pn(o.v)?(u=Or(o.s),f=Or(o.v),s=Tl(o.h,u,f),m=!0,x="hsv"):Pn(o.h)&&Pn(o.s)&&Pn(o.l)&&(u=Or(o.s),h=Or(o.l),s=Nl(o.h,u,h),m=!0,x="hsl"),o.hasOwnProperty("a")&&(i=o.a)),i=ns(i),{ok:m,format:o.format||x,r:Math.min(255,Math.max(s.r,0)),g:Math.min(255,Math.max(s.g,0)),b:Math.min(255,Math.max(s.b,0)),a:i}}function Sl(o,s,i){return{r:gt(o,255)*255,g:gt(s,255)*255,b:gt(i,255)*255}}function Ko(o,s,i){o=gt(o,255),s=gt(s,255),i=gt(i,255);var u=Math.max(o,s,i),f=Math.min(o,s,i),h,m,x=(u+f)/2;if(u==f)h=m=0;else{var _=u-f;switch(m=x>.5?_/(2-u-f):_/(u+f),u){case o:h=(s-i)/_+(s<i?6:0);break;case s:h=(i-o)/_+2;break;case i:h=(o-s)/_+4;break}h/=6}return{h,s:m,l:x}}function Nl(o,s,i){var u,f,h;o=gt(o,360),s=gt(s,100),i=gt(i,100);function m(p,C,y){return y<0&&(y+=1),y>1&&(y-=1),y<1/6?p+(C-p)*6*y:y<1/2?C:y<2/3?p+(C-p)*(2/3-y)*6:p}if(s===0)u=f=h=i;else{var x=i<.5?i*(1+s):i+s-i*s,_=2*i-x;u=m(_,x,o+1/3),f=m(_,x,o),h=m(_,x,o-1/3)}return{r:u*255,g:f*255,b:h*255}}function Qo(o,s,i){o=gt(o,255),s=gt(s,255),i=gt(i,255);var u=Math.max(o,s,i),f=Math.min(o,s,i),h,m,x=u,_=u-f;if(m=u===0?0:_/u,u==f)h=0;else{switch(u){case o:h=(s-i)/_+(s<i?6:0);break;case s:h=(i-o)/_+2;break;case i:h=(o-s)/_+4;break}h/=6}return{h,s:m,v:x}}function Tl(o,s,i){o=gt(o,360)*6,s=gt(s,100),i=gt(i,100);var u=Math.floor(o),f=o-u,h=i*(1-s),m=i*(1-f*s),x=i*(1-(1-f)*s),_=u%6,p=[i,m,h,h,x,i][_],C=[x,i,i,m,h,h][_],y=[h,h,x,i,i,m][_];return{r:p*255,g:C*255,b:y*255}}function Jo(o,s,i,u){var f=[xn(Math.round(o).toString(16)),xn(Math.round(s).toString(16)),xn(Math.round(i).toString(16))];return u&&f[0].charAt(0)==f[0].charAt(1)&&f[1].charAt(0)==f[1].charAt(1)&&f[2].charAt(0)==f[2].charAt(1)?f[0].charAt(0)+f[1].charAt(0)+f[2].charAt(0):f.join("")}function kl(o,s,i,u,f){var h=[xn(Math.round(o).toString(16)),xn(Math.round(s).toString(16)),xn(Math.round(i).toString(16)),xn(rs(u))];return f&&h[0].charAt(0)==h[0].charAt(1)&&h[1].charAt(0)==h[1].charAt(1)&&h[2].charAt(0)==h[2].charAt(1)&&h[3].charAt(0)==h[3].charAt(1)?h[0].charAt(0)+h[1].charAt(0)+h[2].charAt(0)+h[3].charAt(0):h.join("")}function es(o,s,i,u){var f=[xn(rs(u)),xn(Math.round(o).toString(16)),xn(Math.round(s).toString(16)),xn(Math.round(i).toString(16))];return f.join("")}Ae.equals=function(o,s){return!o||!s?!1:Ae(o).toRgbString()==Ae(s).toRgbString()},Ae.random=function(){return Ae.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function Rl(o,s){s=s===0?0:s||10;var i=Ae(o).toHsl();return i.s-=s/100,i.s=ei(i.s),Ae(i)}function Ol(o,s){s=s===0?0:s||10;var i=Ae(o).toHsl();return i.s+=s/100,i.s=ei(i.s),Ae(i)}function Bl(o){return Ae(o).desaturate(100)}function Ml(o,s){s=s===0?0:s||10;var i=Ae(o).toHsl();return i.l+=s/100,i.l=ei(i.l),Ae(i)}function vl(o,s){s=s===0?0:s||10;var i=Ae(o).toRgb();return i.r=Math.max(0,Math.min(255,i.r-Math.round(255*-(s/100)))),i.g=Math.max(0,Math.min(255,i.g-Math.round(255*-(s/100)))),i.b=Math.max(0,Math.min(255,i.b-Math.round(255*-(s/100)))),Ae(i)}function Dl(o,s){s=s===0?0:s||10;var i=Ae(o).toHsl();return i.l-=s/100,i.l=ei(i.l),Ae(i)}function Pl(o,s){var i=Ae(o).toHsl(),u=(i.h+s)%360;return i.h=u<0?360+u:u,Ae(i)}function Ll(o){var s=Ae(o).toHsl();return s.h=(s.h+180)%360,Ae(s)}function ts(o,s){if(isNaN(s)||s<=0)throw new Error("Argument to polyad must be a positive number");for(var i=Ae(o).toHsl(),u=[Ae(o)],f=360/s,h=1;h<s;h++)u.push(Ae({h:(i.h+h*f)%360,s:i.s,l:i.l}));return u}function Fl(o){var s=Ae(o).toHsl(),i=s.h;return[Ae(o),Ae({h:(i+72)%360,s:s.s,l:s.l}),Ae({h:(i+216)%360,s:s.s,l:s.l})]}function Vl(o,s,i){s=s||6,i=i||30;var u=Ae(o).toHsl(),f=360/i,h=[Ae(o)];for(u.h=(u.h-(f*s>>1)+720)%360;--s;)u.h=(u.h+f)%360,h.push(Ae(u));return h}function Ul(o,s){s=s||6;for(var i=Ae(o).toHsv(),u=i.h,f=i.s,h=i.v,m=[],x=1/s;s--;)m.push(Ae({h:u,s:f,v:h})),h=(h+x)%1;return m}Ae.mix=function(o,s,i){i=i===0?0:i||50;var u=Ae(o).toRgb(),f=Ae(s).toRgb(),h=i/100,m={r:(f.r-u.r)*h+u.r,g:(f.g-u.g)*h+u.g,b:(f.b-u.b)*h+u.b,a:(f.a-u.a)*h+u.a};return Ae(m)},Ae.readability=function(o,s){var i=Ae(o),u=Ae(s);return(Math.max(i.getLuminance(),u.getLuminance())+.05)/(Math.min(i.getLuminance(),u.getLuminance())+.05)},Ae.isReadable=function(o,s,i){var u=Ae.readability(o,s),f,h;switch(h=!1,f=jl(i),f.level+f.size){case"AAsmall":case"AAAlarge":h=u>=4.5;break;case"AAlarge":h=u>=3;break;case"AAAsmall":h=u>=7;break}return h},Ae.mostReadable=function(o,s,i){var u=null,f=0,h,m,x,_;i=i||{},m=i.includeFallbackColors,x=i.level,_=i.size;for(var p=0;p<s.length;p++)h=Ae.readability(o,s[p]),h>f&&(f=h,u=Ae(s[p]));return Ae.isReadable(o,u,{level:x,size:_})||!m?u:(i.includeFallbackColors=!1,Ae.mostReadable(o,["#fff","#000"],i))};var Wi=Ae.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},zl=Ae.hexNames=Hl(Wi);function Hl(o){var s={};for(var i in o)o.hasOwnProperty(i)&&(s[o[i]]=i);return s}function ns(o){return o=parseFloat(o),(isNaN(o)||o<0||o>1)&&(o=1),o}function gt(o,s){Gl(o)&&(o="100%");var i=Wl(o);return o=Math.min(s,Math.max(0,parseFloat(o))),i&&(o=parseInt(o*s,10)/100),Math.abs(o-s)<1e-6?1:o%s/parseFloat(s)}function ei(o){return Math.min(1,Math.max(0,o))}function on(o){return parseInt(o,16)}function Gl(o){return typeof o=="string"&&o.indexOf(".")!=-1&&parseFloat(o)===1}function Wl(o){return typeof o=="string"&&o.indexOf("%")!=-1}function xn(o){return o.length==1?"0"+o:""+o}function Or(o){return o<=1&&(o=o*100+"%"),o}function rs(o){return Math.round(parseFloat(o)*255).toString(16)}function is(o){return on(o)/255}var wn=function(){var o="[-\\+]?\\d+%?",s="[-\\+]?\\d*\\.\\d+%?",i="(?:"+s+")|(?:"+o+")",u="[\\s|\\(]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")\\s*\\)?",f="[\\s|\\(]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")\\s*\\)?";return{CSS_UNIT:new RegExp(i),rgb:new RegExp("rgb"+u),rgba:new RegExp("rgba"+f),hsl:new RegExp("hsl"+u),hsla:new RegExp("hsla"+f),hsv:new RegExp("hsv"+u),hsva:new RegExp("hsva"+f),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function Pn(o){return!!wn.CSS_UNIT.exec(o)}function Xl(o){o=o.replace(bl,"").replace(Al,"").toLowerCase();var s=!1;if(Wi[o])o=Wi[o],s=!0;else if(o=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var i;return(i=wn.rgb.exec(o))?{r:i[1],g:i[2],b:i[3]}:(i=wn.rgba.exec(o))?{r:i[1],g:i[2],b:i[3],a:i[4]}:(i=wn.hsl.exec(o))?{h:i[1],s:i[2],l:i[3]}:(i=wn.hsla.exec(o))?{h:i[1],s:i[2],l:i[3],a:i[4]}:(i=wn.hsv.exec(o))?{h:i[1],s:i[2],v:i[3]}:(i=wn.hsva.exec(o))?{h:i[1],s:i[2],v:i[3],a:i[4]}:(i=wn.hex8.exec(o))?{r:on(i[1]),g:on(i[2]),b:on(i[3]),a:is(i[4]),format:s?"name":"hex8"}:(i=wn.hex6.exec(o))?{r:on(i[1]),g:on(i[2]),b:on(i[3]),format:s?"name":"hex"}:(i=wn.hex4.exec(o))?{r:on(i[1]+""+i[1]),g:on(i[2]+""+i[2]),b:on(i[3]+""+i[3]),a:is(i[4]+""+i[4]),format:s?"name":"hex8"}:(i=wn.hex3.exec(o))?{r:on(i[1]+""+i[1]),g:on(i[2]+""+i[2]),b:on(i[3]+""+i[3]),format:s?"name":"hex"}:!1}function jl(o){var s,i;return o=o||{level:"AA",size:"small"},s=(o.level||"AA").toUpperCase(),i=(o.size||"small").toLowerCase(),s!=="AA"&&s!=="AAA"&&(s="AA"),i!=="small"&&i!=="large"&&(i="small"),{level:s,size:i}}const ti=xe.defineStore("imageCache",()=>{const o=l.ref({});let s=!1;function i(_,p){const C=String(_);o.value[C]&&URL.revokeObjectURL(o.value[C]);const y=URL.createObjectURL(p);o.value[C]=y}async function u(_){if(!_){console.warn("initCacheSingle called with null/undefined id");return}const p=String(_);if(o.value[p])return;const C=await ur(p);C&&(await scheduler.yield(),i(p,C),window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:p,blob:C}})))}function f(_){const{id:p,blob:C}=_.detail;p&&C&&i(p,C)}function h(){typeof window>"u"||s||(window.addEventListener("image-cached",f),s=!0)}function m(){typeof window>"u"||!s||(window.removeEventListener("image-cached",f),s=!1)}function x(){Object.values(o.value).forEach(URL.revokeObjectURL),o.value={}}return typeof window<"u"&&h(),{cache:o,initCacheSingle:u,updateCacheFromBlob:i,cleanup:x,setupEventListener:h,removeEventListener:m}}),It=xe.defineStore("themeLib",()=>{const o=ti(),{initCacheSingle:s}=o,i=l.ref({id:"",created_at:null,logo:null,primary_color:null,accent_color:null,accent_light_color:null,accent_dark_color:null,bg_button_color:null,bonuses_button_name:void 0,qr_bypass_guest_auth:null,kiosk_bypass_guest_auth:null,kiosk_disable_lock_screen:null,inactive_button_color:null,cards_color:null,text_color:null,nonworking_bg_color:null,retail_mode:null,splash_image_url:null,splash_video:null,splash_duration:0,splash_type:null,fallback_image:null,adult_disclaimer_text:null,adult_disclaimer_image:null,kiosk_enable_wheel:null,kiosk_banner:null,kiosk_preloader:null,organization:"",kiosk_qr_payment_timeout:null,gradientStyle:null,kiosk_inactivity_timeout:null,kiosk_show_loyalty_card_button:null,kiosk_show_loyalty_phone_input_button:null,cart_loyalty_button:{cart_loyalty_button_sticker:null,cart_loyalty_button_text:null},comments:null,show_nutrition_in_cart:null,apply_custom_size_picker_fonts:null,size_picker_unselected_font_size:null,size_picker_selected_font_size:null,hide_discounts_calculate_button:!1,pdf_return_url:null,kiosk_hide_manual_input_loyalty_card:null,kiosk_camera_scan_loyalty_card:null,kiosk_hide_menu_update_notification:null}),u=async h=>{if(!h)return;i.value={...h};const m=await ur("banner"),x=await ur("preloader"),_=await ur("defaultImage");m||f(h.kiosk_banner,"banner"),x||f(h.kiosk_preloader,"preloader"),_||f(h.fallback_image,"defaultImage"),document.documentElement.style.setProperty("--primaryColor",h.primary_color),document.documentElement.style.setProperty("--accentColor",h.accent_color),document.documentElement.style.setProperty("--accentLightColor",h.accent_light_color),document.documentElement.style.setProperty("--accentDarkColor",h.accent_dark_color),document.documentElement.style.setProperty("--bgButtonColor",h.bg_button_color),document.documentElement.style.setProperty("--inactiveButtonColor",h.inactive_button_color),document.documentElement.style.setProperty("--cardsColor",h.cards_color),document.documentElement.style.setProperty("--textColor",h.text_color),document.documentElement.style.setProperty("--nonworkingBgColor",h.nonworking_bg_color),h.apply_custom_size_picker_fonts&&h.size_picker_unselected_font_size&&h.size_picker_unselected_font_size>0&&document.documentElement.style.setProperty("--sizePickerUnselectedFontSize",`${h.size_picker_unselected_font_size}rem`),h.apply_custom_size_picker_fonts&&h.size_picker_selected_font_size&&h.size_picker_selected_font_size>0&&document.documentElement.style.setProperty("--sizePickerSelectedFontSize",`${h.size_picker_selected_font_size}rem`);const p=i.value.primary_color||"#F2F7FF",C=Ae(p).setAlpha(.7).toRgbString(),y=`linear-gradient(to bottom, transparent 10%, ${C} 50%, ${p} 85%)`,S=`-webkit-linear-gradient(to bottom, transparent 10%, ${C} 50%, ${p} 85%)`;return i.value.gradientStyle={background:y,backgroundColor:S},i.value},f=async(h,m)=>{if(h){const x=await fetch(h);if(!x.ok)throw new Error("Network error");const _=await x.blob();Gi(m,_),s(m)}};return{itemThemes:i,updateColor:u}}),dr=o=>{if(!o)return 0;if((o.price===0||o.price===null)&&o.sizes&&o.sizes.length>0){const s=o.sizes.find(i=>i.is_default===!0);return s?s.price:o.sizes.length>1&&o.sizes[1].price||o.sizes[0].price}return o.price};class Br extends Error{}Br.prototype.name="InvalidTokenError";function ql(o){return decodeURIComponent(atob(o).replace(/(.)/g,(s,i)=>{let u=i.charCodeAt(0).toString(16).toUpperCase();return u.length<2&&(u="0"+u),"%"+u}))}function Zl(o){let s=o.replace(/-/g,"+").replace(/_/g,"/");switch(s.length%4){case 0:break;case 2:s+="==";break;case 3:s+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return ql(s)}catch{return atob(s)}}function os(o,s){if(typeof o!="string")throw new Br("Invalid token specified: must be a string");s||(s={});const i=s.header===!0?0:1,u=o.split(".")[i];if(typeof u!="string")throw new Br(`Invalid token specified: missing part #${i+1}`);let f;try{f=Zl(u)}catch(h){throw new Br(`Invalid token specified: invalid base64 for part #${i+1} (${h.message})`)}try{return JSON.parse(f)}catch(h){throw new Br(`Invalid token specified: invalid json for part #${i+1} (${h.message})`)}}const Yl=(o,s)=>{if(typeof window<"u"){const i=localStorage.getItem(o);return i?JSON.parse(i):s}return s},$l=(o,s)=>{if(typeof window<"u"){const i=localStorage.getItem(o);if(i)try{return os(JSON.parse(i))}catch(u){return console.error("Failed to decode JWT:",u),s}}return s},ss=(o,s,i="normal")=>{const u=l.ref(i==="jwt"?$l(o,s):Yl(o,s));return l.watchEffect(()=>{u.value===null||u.value===void 0?localStorage.removeItem(o):i!=="jwt"&&localStorage.setItem(o,JSON.stringify(u.value))}),u},fr=o=>{o.forEach(s=>{try{localStorage.removeItem(s)}catch(i){console.error(`Ошибка при удалении ключа "${s}":`,i)}})};class Kl{constructor(s,i={}){We(this,"url");We(this,"options");We(this,"ws");We(this,"reconnectInterval");We(this,"listeners");We(this,"isConnected");We(this,"heartbeat");We(this,"heartbeatTimeout");We(this,"pingTimeout");We(this,"pingResponseTimeout");We(this,"signal");We(this,"_shouldReconnect",!0);this.url=s,this.options=i,this.ws=null,this.reconnectInterval=5e3,this.pingResponseTimeout=5e3,this.listeners=new Map,this.isConnected=l.ref(!1),this.heartbeatTimeout=i.heartbeatTimeout||3e5}connect(){var i,u;if(this.ws&&this.ws.readyState===WebSocket.OPEN){console.warn("WebSocket already open");return}if(!this._shouldReconnect){console.warn("Reconnection disabled");return}const s=`${this.url}`;this.ws=new WebSocket(s),(i=this.options.signal)!=null&&i.aborted&&this.ws.close(),(u=this.options.signal)==null||u.addEventListener("abort",()=>this.close()),this.ws.onopen=()=>{console.warn("WebSocket connected"),this.isConnected.value=!0,this.emit("open"),this.heartbeat=setInterval(()=>this.sendPing(),this.heartbeatTimeout)},this.ws.onmessage=f=>{try{const h=JSON.parse(f.data);this.emit("message",h),h!=null&&h.type&&h.type!=="ping"&&clearTimeout(this.pingTimeout)}catch(h){console.error("Error parsing WebSocket message:",h)}},this.ws.onerror=f=>{console.error("WebSocket error:",f),this.emit("error",f),this.close(!0)},this.ws.onclose=()=>{this.isConnected.value=!1,console.warn("WebSocket closed"),this.emit("close"),clearInterval(this.heartbeat),clearTimeout(this.pingTimeout),this._shouldReconnect&&(console.log(`Reconnecting in ${this.reconnectInterval}ms...`),setTimeout(()=>this.connect(),this.reconnectInterval))}}sendPing(){var s;this.isConnected.value&&((s=this.ws)==null?void 0:s.readyState)===WebSocket.OPEN?(this.ws.send(JSON.stringify({type:"ping"})),this.pingTimeout=setTimeout(()=>{console.warn("No pong received, reconnecting..."),this.close(!0),this.connect()},this.pingResponseTimeout)):console.warn("WebSocket not connected, cannot send ping")}send(s){var i;this.isConnected.value&&((i=this.ws)==null?void 0:i.readyState)===WebSocket.OPEN?this.ws.send(JSON.stringify(s)):console.warn("WebSocket not connected")}close(s=!1){this.ws&&(this._shouldReconnect=!s,this.ws.close(),clearInterval(this.heartbeat),clearTimeout(this.pingTimeout),this.ws=null,this.listeners.clear())}on(s,i){this.listeners.has(s)||this.listeners.set(s,[]),this.listeners.get(s).push(i)}off(s,i){const u=this.listeners.get(s);u&&this.listeners.set(s,u.filter(f=>f!==i))}emit(s,i=null){const u=this.listeners.get(s);u&&u.forEach(f=>f(i))}getConnectionStatus(){return this.isConnected}}let ni=new Map;function ri(o,s={}){var u;if(ni.has(o)){const f=ni.get(o);if(f.isConnected.value&&((u=f.ws)==null?void 0:u.readyState)===WebSocket.OPEN)return f.listeners.clear(),f;f.close(!0),ni.delete(o)}const i=new Kl(o,s);return ni.set(o,i),i}const lt=xe.defineStore("mainLib",()=>{const o=l.ref(),s=l.ref(!1),i=l.ref(localStorage.getItem("kiosk_timeout")),u=l.ref(0),f=l.ref(!1),h=l.ref(sessionStorage.getItem("is_adult")==="true"),m=l.ref([]),x=l.ref([]),_=l.ref(!1),p=l.ref(),C=l.ref(""),y=l.ref(0),S=l.ref(!1),M=l.ref(!1),k=l.ref(!0),P=l.ref(!localStorage.getItem("apiKey")),v=l.ref(!1),U=l.ref({textNotification:""}),B=l.ref([]);let R=null;const D=q=>{const re=`wss://${p.value.area}/ws/device/${q}/`;R=ri(re);function ge(){console.log("WebSocket connection opened")}function we(_e){if(_e.error)v.value=!0,U.value.textNotification=_e.error,R==null||R.close(!0);else{if(!(_e!=null&&_e.params))return;typeof _e.params.components.shift.is_ok!==null?k.value=_e.params.components.shift.is_ok:k.value=!0}}function Ne(_e){console.error("WebSocket error:",_e),R.close(!0)}R.on("open",ge),R.on("message",we),R.on("error",Ne),R.connect()},K=q=>{u.value=q,localStorage.setItem("kiosk_timeout",q)},te=q=>{s.value=q},z=l.ref(null),ie=l.computed(()=>m.value.reduce((q,re)=>{let ge=0,we=0;return re.group_modifiers&&(ge=re.group_modifiers.reduce((Ne,_e)=>_e.modifiers?Ne+_e.modifiers.reduce((Me,he)=>Me+he.old_price*he.amount,0):0,0)*re.amount),re.modifiers&&(we=re.modifiers.reduce((Ne,_e)=>Ne+_e.old_price*_e.amount,0)*re.amount),q+re.old_price*re.amount+ge+we},0)),W=l.computed({get:()=>m.value.length===0?0:z.value&&z.value!==0?z.value:m.value.reduce((q,re)=>{const ge=dr(re)*re.amount;let we=0,Ne=0;return re.group_modifiers&&(we=re.group_modifiers.reduce((_e,Me)=>Me.modifiers?_e+Me.modifiers.reduce((he,dt)=>he+dt.price*dt.amount,0):0,0)*re.amount),re.modifiers&&(Ne=re.modifiers.reduce((_e,Me)=>_e+Me.price*Me.amount,0)*re.amount),q+ge+we+Ne},0),set(q){z.value=q}}),se=q=>{y.value=q,localStorage.removeItem("bonus"),ss("bonus",y.value)},j=q=>{fr(q)},G=q=>{q={...q,idSystem:crypto.randomUUID()};const re=X(q);m.value.push(re),V()},V=()=>{try{if(!m.value||m.value.length===0){localStorage.removeItem("cart");return}localStorage.setItem("cart",JSON.stringify(l.toRaw(m.value)))}catch(q){console.error("Failed to update cart in localStorage:",q)}},X=q=>l.reactive({...q,amount:q.amount??1,price:q.old_price,new_price:null,total_new_price:null,discounts:[],modifiers:(q.modifiers||[]).map(re=>l.reactive({...re,price:re.old_price,new_price:null,total_new_price:null})),group_modifiers:(q.group_modifiers||[]).map(re=>l.reactive({...re,modifiers:(re.modifiers||[]).map(ge=>l.reactive({...ge,price:ge.old_price,new_price:null,total_new_price:null}))}))}),N=q=>{const re=m.value.find(ge=>ge.idSystem===q);re&&(re.amount+=1),V()},$=q=>{const re=m.value.find(ge=>ge.idSystem===q);re&&(re.amount>=1&&(re.amount-=1),V())},H=()=>{try{const q=localStorage.getItem("cart");if(q){const re=JSON.parse(q);m.value.splice(0,m.value.length,...re.map(X)),z.value=null}}catch(q){console.error("Failed to load cart from localStorage:",q)}};return H(),{cartProducts_lib:m,activeScrolling_lib:x,config_lib:p,totalPrice_lib:W,initialCartPrice_lib:ie,is_notification_lib:v,notificationData_lib:U,xApiKey_lib:C,countBonus:y,toggleDrum:s,is_showApiKey:P,openApiKey:S,kiosk_timeout:i,kiosk_FirstTimeout:u,is_OpenLoyal:M,profile:o,is_18_above_content:f,is18Allowed:h,healthState:k,displayCards:B,isOrderTypeSubmited:_,removeFromLocalStorage:j,setKioskTimeout:K,setBonus:se,setStateDrum:te,addToCart:G,plusAmount:N,minusAmount:$,loadCart:H,deleteItemFromCart:q=>{if(q){const re=m.value.findIndex(ge=>ge.idSystem===q);if(re===-1)return;m.value.splice(re,1),V(),z.value=null}else m.value=[],V()},updateCartInLocalStorage:V,makeProductFullyReactive:X,checkHeartbeatApp:D}});function as(o,s){return function(){return o.apply(s,arguments)}}const{toString:Ql}=Object.prototype,{getPrototypeOf:Xi}=Object,{iterator:ii,toStringTag:ls}=Symbol,oi=(o=>s=>{const i=Ql.call(s);return o[i]||(o[i]=i.slice(8,-1).toLowerCase())})(Object.create(null)),_n=o=>(o=o.toLowerCase(),s=>oi(s)===o),si=o=>s=>typeof s===o,{isArray:hr}=Array,gr=si("undefined");function Mr(o){return o!==null&&!gr(o)&&o.constructor!==null&&!gr(o.constructor)&&Yt(o.constructor.isBuffer)&&o.constructor.isBuffer(o)}const cs=_n("ArrayBuffer");function Jl(o){let s;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?s=ArrayBuffer.isView(o):s=o&&o.buffer&&cs(o.buffer),s}const ec=si("string"),Yt=si("function"),us=si("number"),vr=o=>o!==null&&typeof o=="object",tc=o=>o===!0||o===!1,ai=o=>{if(oi(o)!=="object")return!1;const s=Xi(o);return(s===null||s===Object.prototype||Object.getPrototypeOf(s)===null)&&!(ls in o)&&!(ii in o)},nc=o=>{if(!vr(o)||Mr(o))return!1;try{return Object.keys(o).length===0&&Object.getPrototypeOf(o)===Object.prototype}catch{return!1}},rc=_n("Date"),ic=_n("File"),oc=_n("Blob"),sc=_n("FileList"),ac=o=>vr(o)&&Yt(o.pipe),lc=o=>{let s;return o&&(typeof FormData=="function"&&o instanceof FormData||Yt(o.append)&&((s=oi(o))==="formdata"||s==="object"&&Yt(o.toString)&&o.toString()==="[object FormData]"))},cc=_n("URLSearchParams"),[uc,dc,fc,hc]=["ReadableStream","Request","Response","Headers"].map(_n),gc=o=>o.trim?o.trim():o.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Dr(o,s,{allOwnKeys:i=!1}={}){if(o===null||typeof o>"u")return;let u,f;if(typeof o!="object"&&(o=[o]),hr(o))for(u=0,f=o.length;u<f;u++)s.call(null,o[u],u,o);else{if(Mr(o))return;const h=i?Object.getOwnPropertyNames(o):Object.keys(o),m=h.length;let x;for(u=0;u<m;u++)x=h[u],s.call(null,o[x],x,o)}}function ds(o,s){if(Mr(o))return null;s=s.toLowerCase();const i=Object.keys(o);let u=i.length,f;for(;u-- >0;)if(f=i[u],s===f.toLowerCase())return f;return null}const Kn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,fs=o=>!gr(o)&&o!==Kn;function ji(){const{caseless:o,skipUndefined:s}=fs(this)&&this||{},i={},u=(f,h)=>{const m=o&&ds(i,h)||h;ai(i[m])&&ai(f)?i[m]=ji(i[m],f):ai(f)?i[m]=ji({},f):hr(f)?i[m]=f.slice():(!s||!gr(f))&&(i[m]=f)};for(let f=0,h=arguments.length;f<h;f++)arguments[f]&&Dr(arguments[f],u);return i}const mc=(o,s,i,{allOwnKeys:u}={})=>(Dr(s,(f,h)=>{i&&Yt(f)?o[h]=as(f,i):o[h]=f},{allOwnKeys:u}),o),pc=o=>(o.charCodeAt(0)===65279&&(o=o.slice(1)),o),xc=(o,s,i,u)=>{o.prototype=Object.create(s.prototype,u),o.prototype.constructor=o,Object.defineProperty(o,"super",{value:s.prototype}),i&&Object.assign(o.prototype,i)},wc=(o,s,i,u)=>{let f,h,m;const x={};if(s=s||{},o==null)return s;do{for(f=Object.getOwnPropertyNames(o),h=f.length;h-- >0;)m=f[h],(!u||u(m,o,s))&&!x[m]&&(s[m]=o[m],x[m]=!0);o=i!==!1&&Xi(o)}while(o&&(!i||i(o,s))&&o!==Object.prototype);return s},_c=(o,s,i)=>{o=String(o),(i===void 0||i>o.length)&&(i=o.length),i-=s.length;const u=o.indexOf(s,i);return u!==-1&&u===i},Cc=o=>{if(!o)return null;if(hr(o))return o;let s=o.length;if(!us(s))return null;const i=new Array(s);for(;s-- >0;)i[s]=o[s];return i},Ec=(o=>s=>o&&s instanceof o)(typeof Uint8Array<"u"&&Xi(Uint8Array)),yc=(o,s)=>{const u=(o&&o[ii]).call(o);let f;for(;(f=u.next())&&!f.done;){const h=f.value;s.call(o,h[0],h[1])}},bc=(o,s)=>{let i;const u=[];for(;(i=o.exec(s))!==null;)u.push(i);return u},Ac=_n("HTMLFormElement"),Ic=o=>o.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(i,u,f){return u.toUpperCase()+f}),hs=(({hasOwnProperty:o})=>(s,i)=>o.call(s,i))(Object.prototype),Sc=_n("RegExp"),gs=(o,s)=>{const i=Object.getOwnPropertyDescriptors(o),u={};Dr(i,(f,h)=>{let m;(m=s(f,h,o))!==!1&&(u[h]=m||f)}),Object.defineProperties(o,u)},Nc=o=>{gs(o,(s,i)=>{if(Yt(o)&&["arguments","caller","callee"].indexOf(i)!==-1)return!1;const u=o[i];if(Yt(u)){if(s.enumerable=!1,"writable"in s){s.writable=!1;return}s.set||(s.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")})}})},Tc=(o,s)=>{const i={},u=f=>{f.forEach(h=>{i[h]=!0})};return hr(o)?u(o):u(String(o).split(s)),i},kc=()=>{},Rc=(o,s)=>o!=null&&Number.isFinite(o=+o)?o:s;function Oc(o){return!!(o&&Yt(o.append)&&o[ls]==="FormData"&&o[ii])}const Bc=o=>{const s=new Array(10),i=(u,f)=>{if(vr(u)){if(s.indexOf(u)>=0)return;if(Mr(u))return u;if(!("toJSON"in u)){s[f]=u;const h=hr(u)?[]:{};return Dr(u,(m,x)=>{const _=i(m,f+1);!gr(_)&&(h[x]=_)}),s[f]=void 0,h}}return u};return i(o,0)},Mc=_n("AsyncFunction"),vc=o=>o&&(vr(o)||Yt(o))&&Yt(o.then)&&Yt(o.catch),ms=((o,s)=>o?setImmediate:s?((i,u)=>(Kn.addEventListener("message",({source:f,data:h})=>{f===Kn&&h===i&&u.length&&u.shift()()},!1),f=>{u.push(f),Kn.postMessage(i,"*")}))(`axios@${Math.random()}`,[]):i=>setTimeout(i))(typeof setImmediate=="function",Yt(Kn.postMessage)),Dc=typeof queueMicrotask<"u"?queueMicrotask.bind(Kn):typeof process<"u"&&process.nextTick||ms,Q={isArray:hr,isArrayBuffer:cs,isBuffer:Mr,isFormData:lc,isArrayBufferView:Jl,isString:ec,isNumber:us,isBoolean:tc,isObject:vr,isPlainObject:ai,isEmptyObject:nc,isReadableStream:uc,isRequest:dc,isResponse:fc,isHeaders:hc,isUndefined:gr,isDate:rc,isFile:ic,isBlob:oc,isRegExp:Sc,isFunction:Yt,isStream:ac,isURLSearchParams:cc,isTypedArray:Ec,isFileList:sc,forEach:Dr,merge:ji,extend:mc,trim:gc,stripBOM:pc,inherits:xc,toFlatObject:wc,kindOf:oi,kindOfTest:_n,endsWith:_c,toArray:Cc,forEachEntry:yc,matchAll:bc,isHTMLForm:Ac,hasOwnProperty:hs,hasOwnProp:hs,reduceDescriptors:gs,freezeMethods:Nc,toObjectSet:Tc,toCamelCase:Ic,noop:kc,toFiniteNumber:Rc,findKey:ds,global:Kn,isContextDefined:fs,isSpecCompliantForm:Oc,toJSONObject:Bc,isAsyncFn:Mc,isThenable:vc,setImmediate:ms,asap:Dc,isIterable:o=>o!=null&&Yt(o[ii])};function Be(o,s,i,u,f){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=o,this.name="AxiosError",s&&(this.code=s),i&&(this.config=i),u&&(this.request=u),f&&(this.response=f,this.status=f.status?f.status:null)}Q.inherits(Be,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Q.toJSONObject(this.config),code:this.code,status:this.status}}});const ps=Be.prototype,xs={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(o=>{xs[o]={value:o}}),Object.defineProperties(Be,xs),Object.defineProperty(ps,"isAxiosError",{value:!0}),Be.from=(o,s,i,u,f,h)=>{const m=Object.create(ps);Q.toFlatObject(o,m,function(C){return C!==Error.prototype},p=>p!=="isAxiosError");const x=o&&o.message?o.message:"Error",_=s==null&&o?o.code:s;return Be.call(m,x,_,i,u,f),o&&m.cause==null&&Object.defineProperty(m,"cause",{value:o,configurable:!0}),m.name=o&&o.name||"Error",h&&Object.assign(m,h),m};const Pc=null;function qi(o){return Q.isPlainObject(o)||Q.isArray(o)}function ws(o){return Q.endsWith(o,"[]")?o.slice(0,-2):o}function _s(o,s,i){return o?o.concat(s).map(function(f,h){return f=ws(f),!i&&h?"["+f+"]":f}).join(i?".":""):s}function Lc(o){return Q.isArray(o)&&!o.some(qi)}const Fc=Q.toFlatObject(Q,{},null,function(s){return/^is[A-Z]/.test(s)});function li(o,s,i){if(!Q.isObject(o))throw new TypeError("target must be an object");s=s||new FormData,i=Q.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,function(P,v){return!Q.isUndefined(v[P])});const u=i.metaTokens,f=i.visitor||C,h=i.dots,m=i.indexes,_=(i.Blob||typeof Blob<"u"&&Blob)&&Q.isSpecCompliantForm(s);if(!Q.isFunction(f))throw new TypeError("visitor must be a function");function p(k){if(k===null)return"";if(Q.isDate(k))return k.toISOString();if(Q.isBoolean(k))return k.toString();if(!_&&Q.isBlob(k))throw new Be("Blob is not supported. Use a Buffer instead.");return Q.isArrayBuffer(k)||Q.isTypedArray(k)?_&&typeof Blob=="function"?new Blob([k]):Buffer.from(k):k}function C(k,P,v){let U=k;if(k&&!v&&typeof k=="object"){if(Q.endsWith(P,"{}"))P=u?P:P.slice(0,-2),k=JSON.stringify(k);else if(Q.isArray(k)&&Lc(k)||(Q.isFileList(k)||Q.endsWith(P,"[]"))&&(U=Q.toArray(k)))return P=ws(P),U.forEach(function(R,D){!(Q.isUndefined(R)||R===null)&&s.append(m===!0?_s([P],D,h):m===null?P:P+"[]",p(R))}),!1}return qi(k)?!0:(s.append(_s(v,P,h),p(k)),!1)}const y=[],S=Object.assign(Fc,{defaultVisitor:C,convertValue:p,isVisitable:qi});function M(k,P){if(!Q.isUndefined(k)){if(y.indexOf(k)!==-1)throw Error("Circular reference detected in "+P.join("."));y.push(k),Q.forEach(k,function(U,B){(!(Q.isUndefined(U)||U===null)&&f.call(s,U,Q.isString(B)?B.trim():B,P,S))===!0&&M(U,P?P.concat(B):[B])}),y.pop()}}if(!Q.isObject(o))throw new TypeError("data must be an object");return M(o),s}function Cs(o){const s={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(o).replace(/[!'()~]|%20|%00/g,function(u){return s[u]})}function Zi(o,s){this._pairs=[],o&&li(o,this,s)}const Es=Zi.prototype;Es.append=function(s,i){this._pairs.push([s,i])},Es.toString=function(s){const i=s?function(u){return s.call(this,u,Cs)}:Cs;return this._pairs.map(function(f){return i(f[0])+"="+i(f[1])},"").join("&")};function Vc(o){return encodeURIComponent(o).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ys(o,s,i){if(!s)return o;const u=i&&i.encode||Vc;Q.isFunction(i)&&(i={serialize:i});const f=i&&i.serialize;let h;if(f?h=f(s,i):h=Q.isURLSearchParams(s)?s.toString():new Zi(s,i).toString(u),h){const m=o.indexOf("#");m!==-1&&(o=o.slice(0,m)),o+=(o.indexOf("?")===-1?"?":"&")+h}return o}class bs{constructor(){this.handlers=[]}use(s,i,u){return this.handlers.push({fulfilled:s,rejected:i,synchronous:u?u.synchronous:!1,runWhen:u?u.runWhen:null}),this.handlers.length-1}eject(s){this.handlers[s]&&(this.handlers[s]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(s){Q.forEach(this.handlers,function(u){u!==null&&s(u)})}}const As={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Uc={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:Zi,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Yi=typeof window<"u"&&typeof document<"u",$i=typeof navigator=="object"&&navigator||void 0,zc=Yi&&(!$i||["ReactNative","NativeScript","NS"].indexOf($i.product)<0),Hc=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Gc=Yi&&window.location.href||"http://localhost",zt={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Yi,hasStandardBrowserEnv:zc,hasStandardBrowserWebWorkerEnv:Hc,navigator:$i,origin:Gc},Symbol.toStringTag,{value:"Module"})),...Uc};function Wc(o,s){return li(o,new zt.classes.URLSearchParams,{visitor:function(i,u,f,h){return zt.isNode&&Q.isBuffer(i)?(this.append(u,i.toString("base64")),!1):h.defaultVisitor.apply(this,arguments)},...s})}function Xc(o){return Q.matchAll(/\w+|\[(\w*)]/g,o).map(s=>s[0]==="[]"?"":s[1]||s[0])}function jc(o){const s={},i=Object.keys(o);let u;const f=i.length;let h;for(u=0;u<f;u++)h=i[u],s[h]=o[h];return s}function Is(o){function s(i,u,f,h){let m=i[h++];if(m==="__proto__")return!0;const x=Number.isFinite(+m),_=h>=i.length;return m=!m&&Q.isArray(f)?f.length:m,_?(Q.hasOwnProp(f,m)?f[m]=[f[m],u]:f[m]=u,!x):((!f[m]||!Q.isObject(f[m]))&&(f[m]=[]),s(i,u,f[m],h)&&Q.isArray(f[m])&&(f[m]=jc(f[m])),!x)}if(Q.isFormData(o)&&Q.isFunction(o.entries)){const i={};return Q.forEachEntry(o,(u,f)=>{s(Xc(u),f,i,0)}),i}return null}function qc(o,s,i){if(Q.isString(o))try{return(s||JSON.parse)(o),Q.trim(o)}catch(u){if(u.name!=="SyntaxError")throw u}return(i||JSON.stringify)(o)}const Pr={transitional:As,adapter:["xhr","http","fetch"],transformRequest:[function(s,i){const u=i.getContentType()||"",f=u.indexOf("application/json")>-1,h=Q.isObject(s);if(h&&Q.isHTMLForm(s)&&(s=new FormData(s)),Q.isFormData(s))return f?JSON.stringify(Is(s)):s;if(Q.isArrayBuffer(s)||Q.isBuffer(s)||Q.isStream(s)||Q.isFile(s)||Q.isBlob(s)||Q.isReadableStream(s))return s;if(Q.isArrayBufferView(s))return s.buffer;if(Q.isURLSearchParams(s))return i.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),s.toString();let x;if(h){if(u.indexOf("application/x-www-form-urlencoded")>-1)return Wc(s,this.formSerializer).toString();if((x=Q.isFileList(s))||u.indexOf("multipart/form-data")>-1){const _=this.env&&this.env.FormData;return li(x?{"files[]":s}:s,_&&new _,this.formSerializer)}}return h||f?(i.setContentType("application/json",!1),qc(s)):s}],transformResponse:[function(s){const i=this.transitional||Pr.transitional,u=i&&i.forcedJSONParsing,f=this.responseType==="json";if(Q.isResponse(s)||Q.isReadableStream(s))return s;if(s&&Q.isString(s)&&(u&&!this.responseType||f)){const m=!(i&&i.silentJSONParsing)&&f;try{return JSON.parse(s,this.parseReviver)}catch(x){if(m)throw x.name==="SyntaxError"?Be.from(x,Be.ERR_BAD_RESPONSE,this,null,this.response):x}}return s}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:zt.classes.FormData,Blob:zt.classes.Blob},validateStatus:function(s){return s>=200&&s<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Q.forEach(["delete","get","head","post","put","patch"],o=>{Pr.headers[o]={}});const Zc=Q.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Yc=o=>{const s={};let i,u,f;return o&&o.split(`
|
|
2
|
-
`).forEach(function(m){f=m.indexOf(":"),i=m.substring(0,f).trim().toLowerCase(),u=m.substring(f+1).trim(),!(!i||s[i]&&
|
|
3
|
-
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(s){return s instanceof this?s:new this(s)}static concat(s,...i){const u=new this(s);return i.forEach(f=>u.set(f)),u}static accessor(s){const u=(this[Ss]=this[Ss]={accessors:{}}).accessors,f=this.prototype;function h(m){const x=Lr(m);u[x]||(Jc(f,m),u[x]=!0)}return Q.isArray(s)?s.forEach(h):h(s),this}};$t.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Q.reduceDescriptors($t.prototype,({value:o},s)=>{let i=s[0].toUpperCase()+s.slice(1);return{get:()=>o,set(u){this[i]=u}}}),Q.freezeMethods($t);function Qi(o,s){const i=this||Pr,u=s||i,f=$t.from(u.headers);let h=u.data;return Q.forEach(o,function(x){h=x.call(i,h,f.normalize(),s?s.status:void 0)}),f.normalize(),h}function Ns(o){return!!(o&&o.__CANCEL__)}function mr(o,s,i){Be.call(this,o??"canceled",Be.ERR_CANCELED,s,i),this.name="CanceledError"}Q.inherits(mr,Be,{__CANCEL__:!0});function Ts(o,s,i){const u=i.config.validateStatus;!i.status||!u||u(i.status)?o(i):s(new Be("Request failed with status code "+i.status,[Be.ERR_BAD_REQUEST,Be.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i))}function eu(o){const s=/^([-+\w]{1,25})(:?\/\/|:)/.exec(o);return s&&s[1]||""}function tu(o,s){o=o||10;const i=new Array(o),u=new Array(o);let f=0,h=0,m;return s=s!==void 0?s:1e3,function(_){const p=Date.now(),C=u[h];m||(m=p),i[f]=_,u[f]=p;let y=h,S=0;for(;y!==f;)S+=i[y++],y=y%o;if(f=(f+1)%o,f===h&&(h=(h+1)%o),p-m<s)return;const M=C&&p-C;return M?Math.round(S*1e3/M):void 0}}function nu(o,s){let i=0,u=1e3/s,f,h;const m=(p,C=Date.now())=>{i=C,f=null,h&&(clearTimeout(h),h=null),o(...p)};return[(...p)=>{const C=Date.now(),y=C-i;y>=u?m(p,C):(f=p,h||(h=setTimeout(()=>{h=null,m(f)},u-y)))},()=>f&&m(f)]}const ui=(o,s,i=3)=>{let u=0;const f=tu(50,250);return nu(h=>{const m=h.loaded,x=h.lengthComputable?h.total:void 0,_=m-u,p=f(_),C=m<=x;u=m;const y={loaded:m,total:x,progress:x?m/x:void 0,bytes:_,rate:p||void 0,estimated:p&&x&&C?(x-m)/p:void 0,event:h,lengthComputable:x!=null,[s?"download":"upload"]:!0};o(y)},i)},ks=(o,s)=>{const i=o!=null;return[u=>s[0]({lengthComputable:i,total:o,loaded:u}),s[1]]},Rs=o=>(...s)=>Q.asap(()=>o(...s)),ru=zt.hasStandardBrowserEnv?((o,s)=>i=>(i=new URL(i,zt.origin),o.protocol===i.protocol&&o.host===i.host&&(s||o.port===i.port)))(new URL(zt.origin),zt.navigator&&/(msie|trident)/i.test(zt.navigator.userAgent)):()=>!0,iu=zt.hasStandardBrowserEnv?{write(o,s,i,u,f,h,m){if(typeof document>"u")return;const x=[`${o}=${encodeURIComponent(s)}`];Q.isNumber(i)&&x.push(`expires=${new Date(i).toUTCString()}`),Q.isString(u)&&x.push(`path=${u}`),Q.isString(f)&&x.push(`domain=${f}`),h===!0&&x.push("secure"),Q.isString(m)&&x.push(`SameSite=${m}`),document.cookie=x.join("; ")},read(o){if(typeof document>"u")return null;const s=document.cookie.match(new RegExp("(?:^|; )"+o+"=([^;]*)"));return s?decodeURIComponent(s[1]):null},remove(o){this.write(o,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function ou(o){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(o)}function su(o,s){return s?o.replace(/\/?\/$/,"")+"/"+s.replace(/^\/+/,""):o}function Os(o,s,i){let u=!ou(s);return o&&(u||i==!1)?su(o,s):s}const Bs=o=>o instanceof $t?{...o}:o;function Qn(o,s){s=s||{};const i={};function u(p,C,y,S){return Q.isPlainObject(p)&&Q.isPlainObject(C)?Q.merge.call({caseless:S},p,C):Q.isPlainObject(C)?Q.merge({},C):Q.isArray(C)?C.slice():C}function f(p,C,y,S){if(Q.isUndefined(C)){if(!Q.isUndefined(p))return u(void 0,p,y,S)}else return u(p,C,y,S)}function h(p,C){if(!Q.isUndefined(C))return u(void 0,C)}function m(p,C){if(Q.isUndefined(C)){if(!Q.isUndefined(p))return u(void 0,p)}else return u(void 0,C)}function x(p,C,y){if(y in s)return u(p,C);if(y in o)return u(void 0,p)}const _={url:h,method:h,data:h,baseURL:m,transformRequest:m,transformResponse:m,paramsSerializer:m,timeout:m,timeoutMessage:m,withCredentials:m,withXSRFToken:m,adapter:m,responseType:m,xsrfCookieName:m,xsrfHeaderName:m,onUploadProgress:m,onDownloadProgress:m,decompress:m,maxContentLength:m,maxBodyLength:m,beforeRedirect:m,transport:m,httpAgent:m,httpsAgent:m,cancelToken:m,socketPath:m,responseEncoding:m,validateStatus:x,headers:(p,C,y)=>f(Bs(p),Bs(C),y,!0)};return Q.forEach(Object.keys({...o,...s}),function(C){const y=_[C]||f,S=y(o[C],s[C],C);Q.isUndefined(S)&&y!==x||(i[C]=S)}),i}const Ms=o=>{const s=Qn({},o);let{data:i,withXSRFToken:u,xsrfHeaderName:f,xsrfCookieName:h,headers:m,auth:x}=s;if(s.headers=m=$t.from(m),s.url=ys(Os(s.baseURL,s.url,s.allowAbsoluteUrls),o.params,o.paramsSerializer),x&&m.set("Authorization","Basic "+btoa((x.username||"")+":"+(x.password?unescape(encodeURIComponent(x.password)):""))),Q.isFormData(i)){if(zt.hasStandardBrowserEnv||zt.hasStandardBrowserWebWorkerEnv)m.setContentType(void 0);else if(Q.isFunction(i.getHeaders)){const _=i.getHeaders(),p=["content-type","content-length"];Object.entries(_).forEach(([C,y])=>{p.includes(C.toLowerCase())&&m.set(C,y)})}}if(zt.hasStandardBrowserEnv&&(u&&Q.isFunction(u)&&(u=u(s)),u||u!==!1&&ru(s.url))){const _=f&&h&&iu.read(h);_&&m.set(f,_)}return s},au=typeof XMLHttpRequest<"u"&&function(o){return new Promise(function(i,u){const f=Ms(o);let h=f.data;const m=$t.from(f.headers).normalize();let{responseType:x,onUploadProgress:_,onDownloadProgress:p}=f,C,y,S,M,k;function P(){M&&M(),k&&k(),f.cancelToken&&f.cancelToken.unsubscribe(C),f.signal&&f.signal.removeEventListener("abort",C)}let v=new XMLHttpRequest;v.open(f.method.toUpperCase(),f.url,!0),v.timeout=f.timeout;function U(){if(!v)return;const R=$t.from("getAllResponseHeaders"in v&&v.getAllResponseHeaders()),K={data:!x||x==="text"||x==="json"?v.responseText:v.response,status:v.status,statusText:v.statusText,headers:R,config:o,request:v};Ts(function(z){i(z),P()},function(z){u(z),P()},K),v=null}"onloadend"in v?v.onloadend=U:v.onreadystatechange=function(){!v||v.readyState!==4||v.status===0&&!(v.responseURL&&v.responseURL.indexOf("file:")===0)||setTimeout(U)},v.onabort=function(){v&&(u(new Be("Request aborted",Be.ECONNABORTED,o,v)),v=null)},v.onerror=function(D){const K=D&&D.message?D.message:"Network Error",te=new Be(K,Be.ERR_NETWORK,o,v);te.event=D||null,u(te),v=null},v.ontimeout=function(){let D=f.timeout?"timeout of "+f.timeout+"ms exceeded":"timeout exceeded";const K=f.transitional||As;f.timeoutErrorMessage&&(D=f.timeoutErrorMessage),u(new Be(D,K.clarifyTimeoutError?Be.ETIMEDOUT:Be.ECONNABORTED,o,v)),v=null},h===void 0&&m.setContentType(null),"setRequestHeader"in v&&Q.forEach(m.toJSON(),function(D,K){v.setRequestHeader(K,D)}),Q.isUndefined(f.withCredentials)||(v.withCredentials=!!f.withCredentials),x&&x!=="json"&&(v.responseType=f.responseType),p&&([S,k]=ui(p,!0),v.addEventListener("progress",S)),_&&v.upload&&([y,M]=ui(_),v.upload.addEventListener("progress",y),v.upload.addEventListener("loadend",M)),(f.cancelToken||f.signal)&&(C=R=>{v&&(u(!R||R.type?new mr(null,o,v):R),v.abort(),v=null)},f.cancelToken&&f.cancelToken.subscribe(C),f.signal&&(f.signal.aborted?C():f.signal.addEventListener("abort",C)));const B=eu(f.url);if(B&&zt.protocols.indexOf(B)===-1){u(new Be("Unsupported protocol "+B+":",Be.ERR_BAD_REQUEST,o));return}v.send(h||null)})},lu=(o,s)=>{const{length:i}=o=o?o.filter(Boolean):[];if(s||i){let u=new AbortController,f;const h=function(p){if(!f){f=!0,x();const C=p instanceof Error?p:this.reason;u.abort(C instanceof Be?C:new mr(C instanceof Error?C.message:C))}};let m=s&&setTimeout(()=>{m=null,h(new Be(`timeout ${s} of ms exceeded`,Be.ETIMEDOUT))},s);const x=()=>{o&&(m&&clearTimeout(m),m=null,o.forEach(p=>{p.unsubscribe?p.unsubscribe(h):p.removeEventListener("abort",h)}),o=null)};o.forEach(p=>p.addEventListener("abort",h));const{signal:_}=u;return _.unsubscribe=()=>Q.asap(x),_}},cu=function*(o,s){let i=o.byteLength;if(i<s){yield o;return}let u=0,f;for(;u<i;)f=u+s,yield o.slice(u,f),u=f},uu=async function*(o,s){for await(const i of du(o))yield*cu(i,s)},du=async function*(o){if(o[Symbol.asyncIterator]){yield*o;return}const s=o.getReader();try{for(;;){const{done:i,value:u}=await s.read();if(i)break;yield u}}finally{await s.cancel()}},vs=(o,s,i,u)=>{const f=uu(o,s);let h=0,m,x=_=>{m||(m=!0,u&&u(_))};return new ReadableStream({async pull(_){try{const{done:p,value:C}=await f.next();if(p){x(),_.close();return}let y=C.byteLength;if(i){let S=h+=y;i(S)}_.enqueue(new Uint8Array(C))}catch(p){throw x(p),p}},cancel(_){return x(_),f.return()}},{highWaterMark:2})},Ds=64*1024,{isFunction:di}=Q,fu=(({Request:o,Response:s})=>({Request:o,Response:s}))(Q.global),{ReadableStream:Ps,TextEncoder:Ls}=Q.global,Fs=(o,...s)=>{try{return!!o(...s)}catch{return!1}},hu=o=>{o=Q.merge.call({skipUndefined:!0},fu,o);const{fetch:s,Request:i,Response:u}=o,f=s?di(s):typeof fetch=="function",h=di(i),m=di(u);if(!f)return!1;const x=f&&di(Ps),_=f&&(typeof Ls=="function"?(k=>P=>k.encode(P))(new Ls):async k=>new Uint8Array(await new i(k).arrayBuffer())),p=h&&x&&Fs(()=>{let k=!1;const P=new i(zt.origin,{body:new Ps,method:"POST",get duplex(){return k=!0,"half"}}).headers.has("Content-Type");return k&&!P}),C=m&&x&&Fs(()=>Q.isReadableStream(new u("").body)),y={stream:C&&(k=>k.body)};f&&["text","arrayBuffer","blob","formData","stream"].forEach(k=>{!y[k]&&(y[k]=(P,v)=>{let U=P&&P[k];if(U)return U.call(P);throw new Be(`Response type '${k}' is not supported`,Be.ERR_NOT_SUPPORT,v)})});const S=async k=>{if(k==null)return 0;if(Q.isBlob(k))return k.size;if(Q.isSpecCompliantForm(k))return(await new i(zt.origin,{method:"POST",body:k}).arrayBuffer()).byteLength;if(Q.isArrayBufferView(k)||Q.isArrayBuffer(k))return k.byteLength;if(Q.isURLSearchParams(k)&&(k=k+""),Q.isString(k))return(await _(k)).byteLength},M=async(k,P)=>{const v=Q.toFiniteNumber(k.getContentLength());return v??S(P)};return async k=>{let{url:P,method:v,data:U,signal:B,cancelToken:R,timeout:D,onDownloadProgress:K,onUploadProgress:te,responseType:z,headers:ie,withCredentials:W="same-origin",fetchOptions:se}=Ms(k),j=s||fetch;z=z?(z+"").toLowerCase():"text";let G=lu([B,R&&R.toAbortSignal()],D),V=null;const X=G&&G.unsubscribe&&(()=>{G.unsubscribe()});let N;try{if(te&&p&&v!=="get"&&v!=="head"&&(N=await M(ie,U))!==0){let ge=new i(P,{method:"POST",body:U,duplex:"half"}),we;if(Q.isFormData(U)&&(we=ge.headers.get("content-type"))&&ie.setContentType(we),ge.body){const[Ne,_e]=ks(N,ui(Rs(te)));U=vs(ge.body,Ds,Ne,_e)}}Q.isString(W)||(W=W?"include":"omit");const $=h&&"credentials"in i.prototype,H={...se,signal:G,method:v.toUpperCase(),headers:ie.normalize().toJSON(),body:U,duplex:"half",credentials:$?W:void 0};V=h&&new i(P,H);let J=await(h?j(V,se):j(P,H));const q=C&&(z==="stream"||z==="response");if(C&&(K||q&&X)){const ge={};["status","statusText","headers"].forEach(Me=>{ge[Me]=J[Me]});const we=Q.toFiniteNumber(J.headers.get("content-length")),[Ne,_e]=K&&ks(we,ui(Rs(K),!0))||[];J=new u(vs(J.body,Ds,Ne,()=>{_e&&_e(),X&&X()}),ge)}z=z||"text";let re=await y[Q.findKey(y,z)||"text"](J,k);return!q&&X&&X(),await new Promise((ge,we)=>{Ts(ge,we,{data:re,headers:$t.from(J.headers),status:J.status,statusText:J.statusText,config:k,request:V})})}catch($){throw X&&X(),$&&$.name==="TypeError"&&/Load failed|fetch/i.test($.message)?Object.assign(new Be("Network Error",Be.ERR_NETWORK,k,V),{cause:$.cause||$}):Be.from($,$&&$.code,k,V)}}},gu=new Map,Vs=o=>{let s=o&&o.env||{};const{fetch:i,Request:u,Response:f}=s,h=[u,f,i];let m=h.length,x=m,_,p,C=gu;for(;x--;)_=h[x],p=C.get(_),p===void 0&&C.set(_,p=x?new Map:hu(s)),C=p;return p};Vs();const Ji={http:Pc,xhr:au,fetch:{get:Vs}};Q.forEach(Ji,(o,s)=>{if(o){try{Object.defineProperty(o,"name",{value:s})}catch{}Object.defineProperty(o,"adapterName",{value:s})}});const Us=o=>`- ${o}`,mu=o=>Q.isFunction(o)||o===null||o===!1;function pu(o,s){o=Q.isArray(o)?o:[o];const{length:i}=o;let u,f;const h={};for(let m=0;m<i;m++){u=o[m];let x;if(f=u,!mu(u)&&(f=Ji[(x=String(u)).toLowerCase()],f===void 0))throw new Be(`Unknown adapter '${x}'`);if(f&&(Q.isFunction(f)||(f=f.get(s))))break;h[x||"#"+m]=f}if(!f){const m=Object.entries(h).map(([_,p])=>`adapter ${_} `+(p===!1?"is not supported by the environment":"is not available in the build"));let x=i?m.length>1?`since :
|
|
4
|
-
`+m.map(
|
|
5
|
-
`):" "+
|
|
6
|
-
`+h):u.stack=h}catch{}}throw u}}_request(s,i){typeof s=="string"?(i=i||{},i.url=s):i=s||{},i=Qn(this.defaults,i);const{transitional:u,paramsSerializer:f,headers:h}=i;u!==void 0&&hi.assertOptions(u,{silentJSONParsing:In.transitional(In.boolean),forcedJSONParsing:In.transitional(In.boolean),clarifyTimeoutError:In.transitional(In.boolean)},!1),f!=null&&(Q.isFunction(f)?i.paramsSerializer={serialize:f}:hi.assertOptions(f,{encode:In.function,serialize:In.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),hi.assertOptions(i,{baseUrl:In.spelling("baseURL"),withXsrfToken:In.spelling("withXSRFToken")},!0),i.method=(i.method||this.defaults.method||"get").toLowerCase();let m=h&&Q.merge(h.common,h[i.method]);h&&Q.forEach(["delete","get","head","post","put","patch","common"],k=>{delete h[k]}),i.headers=$t.concat(m,h);const x=[];let _=!0;this.interceptors.request.forEach(function(P){typeof P.runWhen=="function"&&P.runWhen(i)===!1||(_=_&&P.synchronous,x.unshift(P.fulfilled,P.rejected))});const p=[];this.interceptors.response.forEach(function(P){p.push(P.fulfilled,P.rejected)});let C,y=0,S;if(!_){const k=[Hs.bind(this),void 0];for(k.unshift(...x),k.push(...p),S=k.length,C=Promise.resolve(i);y<S;)C=C.then(k[y++],k[y++]);return C}S=x.length;let M=i;for(;y<S;){const k=x[y++],P=x[y++];try{M=k(M)}catch(v){P.call(this,v);break}}try{C=Hs.call(this,M)}catch(k){return Promise.reject(k)}for(y=0,S=p.length;y<S;)C=C.then(p[y++],p[y++]);return C}getUri(s){s=Qn(this.defaults,s);const i=Os(s.baseURL,s.url,s.allowAbsoluteUrls);return ys(i,s.params,s.paramsSerializer)}};Q.forEach(["delete","get","head","options"],function(s){Jn.prototype[s]=function(i,u){return this.request(Qn(u||{},{method:s,url:i,data:(u||{}).data}))}}),Q.forEach(["post","put","patch"],function(s){function i(u){return function(h,m,x){return this.request(Qn(x||{},{method:s,headers:u?{"Content-Type":"multipart/form-data"}:{},url:h,data:m}))}}Jn.prototype[s]=i(),Jn.prototype[s+"Form"]=i(!0)});let wu=class nl{constructor(s){if(typeof s!="function")throw new TypeError("executor must be a function.");let i;this.promise=new Promise(function(h){i=h});const u=this;this.promise.then(f=>{if(!u._listeners)return;let h=u._listeners.length;for(;h-- >0;)u._listeners[h](f);u._listeners=null}),this.promise.then=f=>{let h;const m=new Promise(x=>{u.subscribe(x),h=x}).then(f);return m.cancel=function(){u.unsubscribe(h)},m},s(function(h,m,x){u.reason||(u.reason=new mr(h,m,x),i(u.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(s){if(this.reason){s(this.reason);return}this._listeners?this._listeners.push(s):this._listeners=[s]}unsubscribe(s){if(!this._listeners)return;const i=this._listeners.indexOf(s);i!==-1&&this._listeners.splice(i,1)}toAbortSignal(){const s=new AbortController,i=u=>{s.abort(u)};return this.subscribe(i),s.signal.unsubscribe=()=>this.unsubscribe(i),s.signal}static source(){let s;return{token:new nl(function(f){s=f}),cancel:s}}};function _u(o){return function(i){return o.apply(null,i)}}function Cu(o){return Q.isObject(o)&&o.isAxiosError===!0}const to={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(to).forEach(([o,s])=>{to[s]=o});function Xs(o){const s=new Jn(o),i=as(Jn.prototype.request,s);return Q.extend(i,Jn.prototype,s,{allOwnKeys:!0}),Q.extend(i,s,null,{allOwnKeys:!0}),i.create=function(f){return Xs(Qn(o,f))},i}const et=Xs(Pr);et.Axios=Jn,et.CanceledError=mr,et.CancelToken=wu,et.isCancel=Ns,et.VERSION=Gs,et.toFormData=li,et.AxiosError=Be,et.Cancel=et.CanceledError,et.all=function(s){return Promise.all(s)},et.spread=_u,et.isAxiosError=Cu,et.mergeConfig=Qn,et.AxiosHeaders=$t,et.formToJSON=o=>Is(Q.isHTMLForm(o)?new FormData(o):o),et.getAdapter=zs.getAdapter,et.HttpStatusCode=to,et.default=et;const{Axios:Wg,AxiosError:Xg,CanceledError:jg,isCancel:qg,CancelToken:Zg,VERSION:Yg,all:$g,Cancel:Kg,isAxiosError:Qg,spread:Jg,toFormData:em,AxiosHeaders:tm,HttpStatusCode:nm,formToJSON:rm,getAdapter:im,mergeConfig:om}=et;let Sn=null,Ht=null;function Cn(o){o&&o.close(!0)}async function Fr(o,s){const i=St(),u=lt(),f=En.create();try{const h=await f.initPaymentLink(o,s);return i.paymentCostQR=u.totalPrice_lib-u.countBonus,i.linkQR=h.url,Ht==null||Ht.deleteCart(null,Ht==null?void 0:Ht.is_requestKiosk),h}catch(h){throw i.isButtonDisabled=!1,i.showNotification(h==null?void 0:h.response.data.user_friendly_message),h}}function Eu(o,s,i){if(o!=null&&o.params){if(o.error){s.showNotification(o.error),cn(s,null),ro(s);return}i(o,s)}}function no(o,s){const i=St(),u=lt();return s.has_rms_discount?(o.params.new_discounts&&(i.extraDiscount=Number(o.params.new_total_cost)-s.initialCartPrice,u.totalPrice_lib=Number(o.params.new_total_cost),s.showNotification("К заказу были добавлены скидки")),!0):!1}const cn=(o,s)=>{o.updateOrderStatus&&o.updateOrderStatus(s)},yu=o=>{o.loadCart&&o.loadCart()},gi=o=>{o.resetBonuses&&o.resetBonuses()},ro=o=>{o.closeWebSocket&&o.closeWebSocket()},js=(o,s)=>{o.is_tableservice&&(Cn(s),o.resetStores(),o.deleteCart(null,o.is_requestKiosk),o.cartCleanup?o.cartCleanup.cleanupAndNavigate("profile",o.is_requestKiosk):o.deleteCart("profile",o.is_requestKiosk))},qs=(o,s,i,u)=>{const f=s.ws||i;En.create().orderPay(o.params.order_id||"").then(m=>{s.setOrderNumber&&s.setOrderNumber(m.data.order_number)}).catch(m=>{(s.errorHandler||u).handleOrderPayError(m,{...s,closeWebSocket:()=>Cn(f)})})},io=(o,s,i)=>{const u=o.ws||s;(o.errorHandler||i).handleOrderError({...o,closeWebSocket:()=>Cn(u)})},bu=(o,s,i)=>{const u=St(),f=u.getCurrentPaymentMethodId();if(!f||!Ln.getConfig(f)||!Ln.isMethodAvailable(f,o))return null;const m=Ln.createHandler(f);if(!m)return null;const x=u.createPaymentHandler(o,s,i,f);return x?{handler:m,config:x.config}:null},Au=o=>{if(!Ht)return;const s=Ht.context,i=Ht.is_requestKiosk,u=Ht.is_tableservice,f=bu(s,i,u);if(!f){console.warn("handleWebSocketMessageWithDynamicHandler: не удалось получить handler");return}const{handler:h,config:m}=f,x={...m,...Ht};Eu(o,x,h.handleWebSocketStatus)};async function Iu(o,s,i,u){var C,y;const{is_requestKiosk:f,is_tableservice:h}=i,{comment:m,is_authorized:x,signal:_}=u;i.setButtonDisabled(!0);const p=En.create();try{const S=await p.createOrder(o,s,f,m,x,h,_);if((S==null?void 0:S.status)===201&&((C=S==null?void 0:S.data)!=null&&C.id)){const M=S.data.id,k={...i,signal:_};Ht=k;const v=`wss://${k.area||""}/ws/order/${M}/`;Sn=ri(v,{signal:_});const U=()=>{console.warn("WebSocket connection opened (centralized mode)")},B=D=>{var K;console.error("WebSocket error (centralized mode):",D),Cn(Sn),Sn=null,Ht=null,i.setButtonDisabled(!1),(K=i.errorHandler)==null||K.handlePaymentError(D,k)},R=D=>{Au(D)};Sn.on("open",U),Sn.on("message",R),Sn.on("error",B),Sn.connect(),Ht.ws=Sn,Ht.closeWebSocket=()=>{Cn(Sn),Sn=null,Ht=null}}return S}catch(S){throw et.isCancel(S)||((y=i.errorHandler)==null||y.handleCreateOrderError(S,i),i.setButtonDisabled(!1)),S}}const Zs=o=>{var s,i;return((i=(s=o==null?void 0:o.response)==null?void 0:s.data)==null?void 0:i.user_friendly_message)||null};function mi(){const o=St();return{handlePaymentError(s,i){var f,h,m,x,_,p;const u=Zs(s);cn(i,null),yu(i),u?(i.showNotification(u),ro(i),i.is_requestKiosk&&((h=i.orderErrors)!=null&&h.includes((f=s.response)==null?void 0:f.status))&&(i.cartCleanup?i.cartCleanup.cleanupAndNavigate("retryPage",i.is_requestKiosk):i.deleteCart("retryPage",i.is_requestKiosk)),i.is_tableservice?i.resetStores():(gi(i),i.context==="qr"&&i.navigation?i.navigation.redirectToError():i.context==="qr"&&i.redirect&&(o.isButtonDisabled=!1,i.redirect(`/${((x=(m=i.route)==null?void 0:m.params)==null?void 0:x.orgId)||""}/errorPayment`)))):i.context==="qr"&&(gi(i),i.navigation?i.navigation.redirectToError():i.redirect&&i.redirect(`/${((p=(_=i.route)==null?void 0:_.params)==null?void 0:p.orgId)||""}/errorPayment`)),o.isButtonDisabled=!1},handleOrderPayError(s,i){var f,h,m,x;const u=Zs(s);u&&(i.showNotification(u),ro(i),i.is_requestKiosk?((h=i.orderErrors)!=null&&h.includes((f=s.response)==null?void 0:f.status)&&(i.cartCleanup.cleanupAndNavigate("retryPage",i.is_requestKiosk),i.deleteCart("retryPage",i.is_requestKiosk)),cn(i,null)):(gi(i),i.navigation?i.navigation.redirectToError():i.redirect&&i.redirect(`/${((x=(m=i.route)==null?void 0:m.params)==null?void 0:x.orgId)||""}/errorPayment`),cn(i,null)))},handleOrderError(s){var i,u;s.is_requestKiosk?s.cartCleanup?s.cartCleanup.cleanupAndNavigate("retryPage",s.is_requestKiosk):s.deleteCart("retryPage",s.is_requestKiosk):s.is_tableservice?s.showNotification("Ошибка создания заказа. Пожалуйста, попробуйте еще раз"):(gi(s),s.navigation?s.navigation.redirectToError():s.redirect&&(o.isButtonDisabled=!1,s.redirect(`/${((u=(i=s.route)==null?void 0:i.params)==null?void 0:u.orgId)||""}/errorPayment`)))},handleCreateOrderError(s,i){var m,x,_,p,C,y;const{is_requestKiosk:u,is_tableservice:f}=i,h=i.route.params.orgId;u?(((m=s==null?void 0:s.response)==null?void 0:m.status)===403&&((x=i.on403Kiosk)==null||x.call(i),(_=i.redirect)==null||_.call(i,`/${h}/retryPage`)),i.deleteCart("retryPage",u)):f?i.showNotification(((C=(p=s==null?void 0:s.response)==null?void 0:p.data)==null?void 0:C.user_friendly_message)||"Ошибка создания заказа"):(y=i.redirect)==null||y.call(i,`/${h}/errorPayment`)}}}const Su=()=>{const o=St();let s=null;const i=mi(),u=(f,h)=>{var x,_;const m=(x=f.params)==null?void 0:x.status;if(m==="sent"){if(no(f,h)){o.isButtonDisabled=!1;return}Fr(f.params.order_id||"",h.method).catch(p=>{const C=h.errorHandler||i,y=h.ws||s;C.handlePaymentError(p,{...h,closeWebSocket:()=>Cn(y)})})}else if(m==="waiting_for_fiscalization")cn(h,1);else if(m==="payment_initiation_retry"||m==="fiscalized")qs(f,h,s,i);else if(m==="payment_initiation")cn(h,2);else if(m==="paid"){cn(h,3);const p=h.ws||s;Cn(p),localStorage.removeItem("cart")}else(_=h.orderErrors)!=null&&_.includes(m)&&io(h,s,i)};return{handleWebSocketStatus(f,h){u(f,h)}}};function Nu(){const o=St();let s=null;const i=mi(),u=(f,h)=>{var x,_,p,C;const m=(x=f.params)==null?void 0:x.status;if((_=f.params)!=null&&_.number&&(o.orderNumber=(p=f.params)==null?void 0:p.number),m==="sent"){if(no(f,h)){o.isButtonDisabled=!1;return}Fr(f.params.order_id||"",h.method).catch(y=>{const S=h.errorHandler||i,M=h.ws||s;S.handlePaymentError(y,{...h,closeWebSocket:()=>Cn(M)})})}else if(m==="sent_fiscalization")cn(h,1);else if(m==="waiting_payment")cn(h,4);else if(m==="paid"){cn(h,3);const y=h.ws||s;Cn(y),localStorage.removeItem("cart")}else(C=h.orderErrors)!=null&&C.includes(m)&&(o.isButtonDisabled=!1,io(h,s,i))};return{handleWebSocketStatus(f,h){u(f,h)}}}const Tu=()=>{const o=St();let s=null;const i=mi(),u=(f,h)=>{var x,_;const m=(x=f.params)==null?void 0:x.status;if(m==="sent"){if(no(f,h)){o.isButtonDisabled=!1;return}Fr(f.params.order_id||"",h.method).then(p=>{if(h.is_tableservice){const C=h.ws||s;js(h,C)}else p.url&&window.location.replace(p.url)}).catch(p=>{const C=h.errorHandler||i,y=h.ws||s;C.handlePaymentError(p,{...h,closeWebSocket:()=>Cn(y)})})}else if(m==="payment_initiation_retry"||m==="fiscalized")qs(f,h,s,i);else if(m==="payment_initiation")cn(h,2);else if(m==="paid"){cn(h,3);const p=h.ws||s;Cn(p),localStorage.removeItem("cart")}else(_=h.orderErrors)!=null&&_.includes(m)&&(o.isButtonDisabled=!1,io(h,s,i))};return{handleWebSocketStatus(f,h){u(f,h)}}};class Ln{static initialize(){this.register({id:"TERMINAL_BASE",method:"TERMINAL",handlerFactory:Su,availableContexts:["kiosk"]}),this.register({id:"YOOKASSA_BASE",method:"YOOKASSA",handlerFactory:Tu,availableContexts:["qr","tableservice"]}),this.register({id:"SBP",method:"YOOKASSA",handlerFactory:Nu,availableContexts:["kiosk"]})}static register(s){this.methods.set(s.id,s)}static getConfig(s){return this.methods.get(s)??null}static getAvailableMethods(s){return Array.from(this.methods.entries()).filter(([i,u])=>u.availableContexts.includes(s)).map(([i])=>i)}static isMethodAvailable(s,i){const u=this.getConfig(s);return u?u.availableContexts.includes(i):!1}static createHandler(s){const i=this.getConfig(s);return i?i.handlerFactory():(console.warn(`PaymentMethodRegistry: метод оплаты ${s} не зарегистрирован`),null)}}We(Ln,"methods",new Map),Ln.initialize();function ku(o){return{cleanupAndNavigate(s,i){o.deleteCart(s,i)},cleanup(s){o.deleteCart(null,s)},clearTokens(){o.deleteCart(null,!0)},resetStores(){o.resetStores()}}}function Ru(o){var i,u;const s=((u=(i=o.route)==null?void 0:i.params)==null?void 0:u.orgId)||"";return{redirectToError(){const f=`/${s}/errorPayment`;o.redirect?o.redirect(f):o.router&&o.router.push(f)},redirectToSuccess(f){const h=f?`/${s}/${f}`:`/${s}/profile`;o.redirect?o.redirect(h):o.router&&o.router.push(h)},redirect(f){o.redirect?o.redirect(f):o.router&&o.router.push(f)},getErrorPath(){return`/${s}/errorPayment`},getSuccessPath(){return`/${s}/profile`}}}const St=xe.defineStore("cartLib",()=>{const o=Re.useRouter(),s=Re.useRoute(),i=It(),u=lt(),{config_lib:f,countBonus:h,totalPrice_lib:m,initialCartPrice_lib:x,is18Allowed:_}=xe.storeToRefs(u),{itemThemes:p}=xe.storeToRefs(i),C=l.ref(!1),y=l.ref(""),S=l.ref(null),M=l.ref("wait"),k=l.ref(!1),P=l.ref(0),v=l.ref(""),U=l.ref([]),B=l.ref([]),R=l.ref(),D=l.ref(0),K=l.ref(!1),te=l.ref(),z=l.ref(null),ie=l.ref(["failed_payment","failed_after_paid","failed","failed_after_sent","failed_after_sent_fiscalization","payment_initiation_retry"]),W=l.ref("Оплатить"),se=l.ref(),j=l.computed({get:()=>U.value||[],set:Oe=>{(Oe==null?void 0:Oe.length)===1&&(se.value=Oe[0]),U.value=Oe}}),G=l.ref(!1),V=l.ref(null),X=l.ref(0),N=l.ref(!1),$=l.ref({textNotification:""}),H=Oe=>{N.value=!0,$.value.textNotification=Oe},J=()=>{var Oe,qe;return(Oe=R.value)!=null&&Oe.front_type?R.value.front_type:((qe=B.value[0])==null?void 0:qe.front_type)||null},q=(Oe,qe,me,Ze)=>{var jt;const Ee=Ze??((jt=B.value[0])==null?void 0:jt.front_type);if(!Ee)return console.warn("Не удалось определить метод оплаты"),null;const mt=Ln.getConfig(Ee);if(!mt||!Ln.isMethodAvailable(Ee,Oe))return console.warn(`Метод ${Ee} недоступен для контекста ${Oe}`),null;const nt=Ln.createHandler(Ee);return nt?(te.value=re(mt.method,Oe,qe,me),{handler:nt,config:te.value}):(console.warn(`Не удалось создать обработчик для метода ${Ee}`),null)},re=(Oe,qe,me,Ze)=>{const Ee={method:Oe,context:qe,is_requestKiosk:me,is_tableservice:Ze,router:o,route:s,orderErrors:ie.value,area:f.value.area,has_rms_discount:f.value.has_rms_discount,totalPrice:m,initialCartPrice:x,showNotification:H,deleteCart:Xe,resetStores:dt,redirect:ot=>o.push(ot),updateOrderStatus:ot=>{V.value=ot},setOrderNumber:ot=>{z.value=ot},loadCart:()=>u.loadCart(),resetBonuses:()=>{h.value=0}},mt=mi(),nt=ku(Ee),jt=Ru(Ee);return{...Ee,errorHandler:mt,cartCleanup:nt,navigation:jt}},ge=l.computed(()=>!!S.value),we=Oe=>{M.value=Oe},Ne=Oe=>{S.value=Oe},_e=()=>{p.value.kiosk_show_loyalty_card_button&&p.value.kiosk_show_loyalty_phone_input_button?C.value=!0:!p.value.kiosk_show_loyalty_card_button&&p.value.kiosk_show_loyalty_phone_input_button?u.is_OpenLoyal=!0:C.value=!0,M.value="wait",y.value=""},Me=()=>{C.value=!1,M.value="wait",y.value=""},he=()=>{S.value=null,y.value="",M.value="wait",Me()},dt=()=>{G.value=!1,V.value=null},Xe=(Oe=null,qe=!1)=>{u.cartProducts_lib=[],fr(["cart"]),qe&&(fr(["authTokensAccess","authTokensRefresh","user"]),u.profile=null,sessionStorage.removeItem("is_adult"),_.value=!1),Oe&&o.push(`/${s.params.orgId}/${Oe}`)};return{isButtonDisabled:G,orderCompleted_lib:V,extraDiscount:P,orderNumber:z,is_notification_lib:N,notificationData_lib:$,textPaymentBtn_lib:W,count:X,guestInfo:S,error:y,isDrawerOpen:C,currentState:M,isAuthorized:ge,discountBtn:k,linkQR:v,orderTypes:j,providerTypes:B,is_paymentCart:K,selectedOrderType:se,selectedProvider:R,configPayment:te,paymentCostQR:D,deleteCart:Xe,setGuestInfo:Ne,setState:we,openDrawer:_e,closeDrawer:Me,clearCard:he,showNotification:H,createPaymentHandler:q,getCurrentPaymentMethodId:J,getAvailablePaymentMethods:Oe=>Ln.getAvailableMethods(Oe)}}),Rt=xe.defineStore("cardLib",()=>{var se;const o=()=>({openCard:null,currentModifier:null,groupModifiers:[],groupModifiersSelected:[],groupCurrentOpen:null,isModifiedAmount:!1,selectedSize:{},productSizes:[],addedProducts:[],plusButtonsRefs:[],modalCount:1,isSectionModifier:!1,isAnimationFly:!0,textErrorRequaired:""}),s=It(),i=l.ref(o()),u=()=>i.value=o(),f=l.ref(!1),h=l.ref(!1),m=l.ref(!1),x=l.ref(),_=l.ref([]),p=l.ref({id:null,visible:!1}),C=l.ref(!((se=s.itemThemes)!=null&&se.kiosk_disable_lock_screen)),y=l.computed(()=>{const j=i.value.groupModifiersSelected.findIndex(G=>G.group===i.value.groupCurrentOpen.id);return S(j)}),S=j=>j===-1?0:(i.value.groupModifiersSelected[j].modifiers||[]).reduce((V,X)=>V+(X.amount||0),0),M=l.computed(()=>{var G;const j=(G=i.value.openCard)==null?void 0:G.group_modifiers.findIndex(V=>V.id===i.value.groupCurrentOpen.id);return j===-1||!i.value.openCard?0:i.value.openCard.modifiers.length>0&&j===0?i.value.openCard.modifiers.reduce((V,X)=>V+X.max_amount,0):i.value.groupModifiers[j].max_amount}),k=l.computed(()=>{var G;const j=(i.value.addedProducts??[]).reduce((V,X)=>V+X.price,0);if(i.value.openCard){const V=i.value.openCard,X=dr(V)||0,N=V.amount||1;return(i.value.groupModifiersSelected.reduce((H,J)=>(J.modifiers.forEach(q=>{var re,ge;q.sizes&&(q.price=((ge=(re=q.sizes)==null?void 0:re.find(we=>we.id===i.value.selectedSize.id))==null?void 0:ge.price)??q.price),H+=q.price*q.amount}),H),0)+X)*N+j}return(G=i.value.addedProducts)!=null&&G.length?j:0}),P=l.computed(()=>{const j=i.value.groupModifiers,G=i.value.groupModifiersSelected;for(let V=0;V<j.length;V++){const X=j[V],N=G[V];if(X.min_amount>0&&S(V)<X.min_amount)return i.value.textErrorRequaired=`В группе "${X.name}" должно содержаться не меньше ${X.min_amount} модификатора(ов)`,{haveRequaire:!0,group:X};for(const $ of X.group_modifiers)if($.min_amount>0){const H=N.modifiers.find(J=>J.id===$.id);if(!H||H.amount<$.min_amount)return i.value.textErrorRequaired=`В группе "${X.name}" выберите все обязательные модификаторы`,{haveRequaire:!0,group:X}}}return{haveRequaire:!1,group:j[0]}}),v=()=>{i.value.groupModifiers.forEach((j,G)=>{i.value.groupCurrentOpen={...j,index:G},j.group_modifiers.forEach(V=>{V.default_amount>0&&(V.amount=V.default_amount,ie(V,!0))})})},U=j=>{i.value.addedProducts.push(j)},B=j=>{i.value.openCard=j},R=j=>{_.value=[...j]},D=(j,G)=>{var X,N;const V=j.id!==((X=i.value.groupCurrentOpen)==null?void 0:X.id);i.value.groupCurrentOpen={...j,index:G},V?i.value.isSectionModifier=!0:i.value.isSectionModifier=!i.value.isSectionModifier,(N=i.value.plusButtonsRefs[G])==null||N.scrollIntoView({behavior:"smooth",block:"start"})},K=()=>{i.value.modalCount>i.value.currentModifier.min_amount&&i.value.modalCount>=2&&(i.value.modalCount-=1)},te=()=>{i.value.groupCurrentOpen&&i.value.modalCount+y.value<M.value&&(i.value.currentModifier.max_amount===0||i.value.currentModifier.max_amount>i.value.modalCount)&&(i.value.modalCount+=1)},z=(j,G)=>{var X;const V=(X=i.value.groupCurrentOpen)==null?void 0:X.id.toUpperCase();if(!j&&!i.value.isModifiedAmount&&G.max_amount!==1){if(V==="Добавки2000"&&G.max_amount>1)return!0;if(Math.abs(M.value-y.value)>1&&V!=="Добавки2000")return!0}return!1},ie=(j,G=!1)=>{i.value.modalCount=1,i.value.currentModifier=j;const V=i.value.groupModifiersSelected.findIndex(X=>X.group===i.value.groupCurrentOpen.id);W(V,j,G)},W=(j,G,V)=>{var N,$;let X=i.value.groupModifiersSelected;if(G.sizes.length>0&&G.sizes.find(H=>{var J;return H.id===((J=i.value.selectedSize)==null?void 0:J.id)}),j===-1)z(V,G)?i.value.isModifiedAmount=!0:X[i.value.groupCurrentOpen.index]={group:i.value.groupCurrentOpen.id,is_fake:((N=i.value.groupCurrentOpen)==null?void 0:N.is_fake)||!1,is_product_determining:(($=i.value.groupCurrentOpen)==null?void 0:$.is_product_determining)||!1,modifier_count:0,modifiers:[{...G,amount:(G==null?void 0:G.amount)??1}]};else{const H=i.value.groupModifiers[j].group_modifiers.findIndex(q=>q.id===G.id);if(X[j].modifiers.findIndex(q=>q.id===G.id)===-1){if(M.value===1)X[j].modifiers=[];else if(y.value>=M.value)return;z(V,G)?i.value.isModifiedAmount=!0:(X[j].modifiers.push({...G,amount:(G==null?void 0:G.amount)??1}),X[j].modifier_count=X[j].modifiers.reduce((q,re)=>q+=re.amount,0),i.value.isAnimationFly=!0)}else X[j].modifiers=X[j].modifiers.filter(q=>q.id!==G.id),X[j].modifier_count=X[j].modifiers.reduce((q,re)=>q+=re.amount,0),i.value.groupModifiers[j].group_modifiers[H].amount=1,i.value.groupModifiers[j].group_modifiers[H].default_amount=0,i.value.isAnimationFly=!1}i.value.groupModifiersSelected=X};return{stateCard:i,totalPrice_libCard:k,recountGroupTotalAmount:y,groupTotalAmount:M,isOpenWindow:f,isUpSale:h,checkedRequiredBtn:P,dataUpSale:x,productCards:_,isAddToCard:m,openProduct:p,is_startPage:C,setProduct:R,summModifierAmount:S,setAddedProducts:U,setCurrentCard:B,minusAmount:K,plusAmount:te,toggleNotRequire:D,modifierSelect:ie,defaultAmountModifiers:v,reset:u}});var pr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ys(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var $s={exports:{}};(function(o,s){(function(i,u){o.exports=u()})(pr,function(){var i=1e3,u=6e4,f=36e5,h="millisecond",m="second",x="minute",_="hour",p="day",C="week",y="month",S="quarter",M="year",k="date",P="Invalid Date",v=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,U=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,B={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(X){var N=["th","st","nd","rd"],$=X%100;return"["+X+(N[($-20)%10]||N[$]||N[0])+"]"}},R=function(X,N,$){var H=String(X);return!H||H.length>=N?X:""+Array(N+1-H.length).join($)+X},D={s:R,z:function(X){var N=-X.utcOffset(),$=Math.abs(N),H=Math.floor($/60),J=$%60;return(N<=0?"+":"-")+R(H,2,"0")+":"+R(J,2,"0")},m:function X(N,$){if(N.date()<$.date())return-X($,N);var H=12*($.year()-N.year())+($.month()-N.month()),J=N.clone().add(H,y),q=$-J<0,re=N.clone().add(H+(q?-1:1),y);return+(-(H+($-J)/(q?J-re:re-J))||0)},a:function(X){return X<0?Math.ceil(X)||0:Math.floor(X)},p:function(X){return{M:y,y:M,w:C,d:p,D:k,h:_,m:x,s:m,ms:h,Q:S}[X]||String(X||"").toLowerCase().replace(/s$/,"")},u:function(X){return X===void 0}},K="en",te={};te[K]=B;var z="$isDayjsObject",ie=function(X){return X instanceof G||!(!X||!X[z])},W=function X(N,$,H){var J;if(!N)return K;if(typeof N=="string"){var q=N.toLowerCase();te[q]&&(J=q),$&&(te[q]=$,J=q);var re=N.split("-");if(!J&&re.length>1)return X(re[0])}else{var ge=N.name;te[ge]=N,J=ge}return!H&&J&&(K=J),J||!H&&K},se=function(X,N){if(ie(X))return X.clone();var $=typeof N=="object"?N:{};return $.date=X,$.args=arguments,new G($)},j=D;j.l=W,j.i=ie,j.w=function(X,N){return se(X,{locale:N.$L,utc:N.$u,x:N.$x,$offset:N.$offset})};var G=function(){function X($){this.$L=W($.locale,null,!0),this.parse($),this.$x=this.$x||$.x||{},this[z]=!0}var N=X.prototype;return N.parse=function($){this.$d=function(H){var J=H.date,q=H.utc;if(J===null)return new Date(NaN);if(j.u(J))return new Date;if(J instanceof Date)return new Date(J);if(typeof J=="string"&&!/Z$/i.test(J)){var re=J.match(v);if(re){var ge=re[2]-1||0,we=(re[7]||"0").substring(0,3);return q?new Date(Date.UTC(re[1],ge,re[3]||1,re[4]||0,re[5]||0,re[6]||0,we)):new Date(re[1],ge,re[3]||1,re[4]||0,re[5]||0,re[6]||0,we)}}return new Date(J)}($),this.init()},N.init=function(){var $=this.$d;this.$y=$.getFullYear(),this.$M=$.getMonth(),this.$D=$.getDate(),this.$W=$.getDay(),this.$H=$.getHours(),this.$m=$.getMinutes(),this.$s=$.getSeconds(),this.$ms=$.getMilliseconds()},N.$utils=function(){return j},N.isValid=function(){return this.$d.toString()!==P},N.isSame=function($,H){var J=se($);return this.startOf(H)<=J&&J<=this.endOf(H)},N.isAfter=function($,H){return se($)<this.startOf(H)},N.isBefore=function($,H){return this.endOf(H)<se($)},N.$g=function($,H,J){return j.u($)?this[H]:this.set(J,$)},N.unix=function(){return Math.floor(this.valueOf()/1e3)},N.valueOf=function(){return this.$d.getTime()},N.startOf=function($,H){var J=this,q=!!j.u(H)||H,re=j.p($),ge=function(Oe,qe){var me=j.w(J.$u?Date.UTC(J.$y,qe,Oe):new Date(J.$y,qe,Oe),J);return q?me:me.endOf(p)},we=function(Oe,qe){return j.w(J.toDate()[Oe].apply(J.toDate("s"),(q?[0,0,0,0]:[23,59,59,999]).slice(qe)),J)},Ne=this.$W,_e=this.$M,Me=this.$D,he="set"+(this.$u?"UTC":"");switch(re){case M:return q?ge(1,0):ge(31,11);case y:return q?ge(1,_e):ge(0,_e+1);case C:var dt=this.$locale().weekStart||0,Xe=(Ne<dt?Ne+7:Ne)-dt;return ge(q?Me-Xe:Me+(6-Xe),_e);case p:case k:return we(he+"Hours",0);case _:return we(he+"Minutes",1);case x:return we(he+"Seconds",2);case m:return we(he+"Milliseconds",3);default:return this.clone()}},N.endOf=function($){return this.startOf($,!1)},N.$set=function($,H){var J,q=j.p($),re="set"+(this.$u?"UTC":""),ge=(J={},J[p]=re+"Date",J[k]=re+"Date",J[y]=re+"Month",J[M]=re+"FullYear",J[_]=re+"Hours",J[x]=re+"Minutes",J[m]=re+"Seconds",J[h]=re+"Milliseconds",J)[q],we=q===p?this.$D+(H-this.$W):H;if(q===y||q===M){var Ne=this.clone().set(k,1);Ne.$d[ge](we),Ne.init(),this.$d=Ne.set(k,Math.min(this.$D,Ne.daysInMonth())).$d}else ge&&this.$d[ge](we);return this.init(),this},N.set=function($,H){return this.clone().$set($,H)},N.get=function($){return this[j.p($)]()},N.add=function($,H){var J,q=this;$=Number($);var re=j.p(H),ge=function(_e){var Me=se(q);return j.w(Me.date(Me.date()+Math.round(_e*$)),q)};if(re===y)return this.set(y,this.$M+$);if(re===M)return this.set(M,this.$y+$);if(re===p)return ge(1);if(re===C)return ge(7);var we=(J={},J[x]=u,J[_]=f,J[m]=i,J)[re]||1,Ne=this.$d.getTime()+$*we;return j.w(Ne,this)},N.subtract=function($,H){return this.add(-1*$,H)},N.format=function($){var H=this,J=this.$locale();if(!this.isValid())return J.invalidDate||P;var q=$||"YYYY-MM-DDTHH:mm:ssZ",re=j.z(this),ge=this.$H,we=this.$m,Ne=this.$M,_e=J.weekdays,Me=J.months,he=J.meridiem,dt=function(qe,me,Ze,Ee){return qe&&(qe[me]||qe(H,q))||Ze[me].slice(0,Ee)},Xe=function(qe){return j.s(ge%12||12,qe,"0")},Oe=he||function(qe,me,Ze){var Ee=qe<12?"AM":"PM";return Ze?Ee.toLowerCase():Ee};return q.replace(U,function(qe,me){return me||function(Ze){switch(Ze){case"YY":return String(H.$y).slice(-2);case"YYYY":return j.s(H.$y,4,"0");case"M":return Ne+1;case"MM":return j.s(Ne+1,2,"0");case"MMM":return dt(J.monthsShort,Ne,Me,3);case"MMMM":return dt(Me,Ne);case"D":return H.$D;case"DD":return j.s(H.$D,2,"0");case"d":return String(H.$W);case"dd":return dt(J.weekdaysMin,H.$W,_e,2);case"ddd":return dt(J.weekdaysShort,H.$W,_e,3);case"dddd":return _e[H.$W];case"H":return String(ge);case"HH":return j.s(ge,2,"0");case"h":return Xe(1);case"hh":return Xe(2);case"a":return Oe(ge,we,!0);case"A":return Oe(ge,we,!1);case"m":return String(we);case"mm":return j.s(we,2,"0");case"s":return String(H.$s);case"ss":return j.s(H.$s,2,"0");case"SSS":return j.s(H.$ms,3,"0");case"Z":return re}return null}(qe)||re.replace(":","")})},N.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},N.diff=function($,H,J){var q,re=this,ge=j.p(H),we=se($),Ne=(we.utcOffset()-this.utcOffset())*u,_e=this-we,Me=function(){return j.m(re,we)};switch(ge){case M:q=Me()/12;break;case y:q=Me();break;case S:q=Me()/3;break;case C:q=(_e-Ne)/6048e5;break;case p:q=(_e-Ne)/864e5;break;case _:q=_e/f;break;case x:q=_e/u;break;case m:q=_e/i;break;default:q=_e}return J?q:j.a(q)},N.daysInMonth=function(){return this.endOf(y).$D},N.$locale=function(){return te[this.$L]},N.locale=function($,H){if(!$)return this.$L;var J=this.clone(),q=W($,H,!0);return q&&(J.$L=q),J},N.clone=function(){return j.w(this.$d,this)},N.toDate=function(){return new Date(this.valueOf())},N.toJSON=function(){return this.isValid()?this.toISOString():null},N.toISOString=function(){return this.$d.toISOString()},N.toString=function(){return this.$d.toUTCString()},X}(),V=G.prototype;return se.prototype=V,[["$ms",h],["$s",m],["$m",x],["$H",_],["$W",p],["$M",y],["$y",M],["$D",k]].forEach(function(X){V[X[1]]=function(N){return this.$g(N,X[0],X[1])}}),se.extend=function(X,N){return X.$i||(X(N,G,se),X.$i=!0),se},se.locale=W,se.isDayjs=ie,se.unix=function(X){return se(1e3*X)},se.en=te[K],se.Ls=te,se.p={},se})})($s);var Ou=$s.exports;const Ks=Ys(Ou),Bu=o=>{const s=Re.useRouter(),i=`${o.domain}/api/`,u=et.create({baseURL:i}),f=et.create({baseURL:i}),h=et.create({baseURL:i}),m=et.create({baseURL:i}),x=et.create({baseURL:i}),_=et.create({baseURL:i}),p=et.create({baseURL:i}),C=B=>{try{const R=JSON.parse(localStorage.getItem("authTokensAccess")||"");R.length>0&&(B.headers.Authorization=`Bearer ${R}`)}catch{console.warn("accessToken is undefined [useAxios]")}return B},y=B=>{const R=localStorage.getItem("apiKey");return B.headers={"Content-Type":"application/json","x-api-key":R},B},S=async B=>{if(!o.user)return B;const R=o.user.exp??0;if(!(Ks.unix(R).diff(Ks())<3e3))return B;const K=ss("authTokensRefresh",null,"string");try{const te=await et.post(`${i}user/token/refresh/`,{refresh:K.value});if(!te.data.access)return U(),B;localStorage.setItem("authTokensAccess",JSON.stringify(te.data.access)),P(te.data),v(os(te.data.access)),B.headers={...B.headers,Authorization:`Bearer ${te.data.access}`}}catch(te){console.error("Failed to refresh token:",te),U()}return B},M=B=>{B.interceptors.request.use(R=>S(C(R)),R=>Promise.reject(R))};M(h),M(x),M(p);const k=B=>{B.interceptors.request.use(R=>y(R))};k(_),k(f),k(p);const P=(B,R=!1)=>{localStorage.setItem("authTokensAccess",JSON.stringify(B.access)),R&&localStorage.setItem("authTokensRefresh",JSON.stringify(B.refresh))},v=B=>{o.user=B,localStorage.setItem("user",JSON.stringify(B))},U=()=>{o.user=null,fr(["authTokensAccess","authTokensRefresh","user","cart","bonus"]),sessionStorage.removeItem("is_adult"),s.replace({name:"home"}).then(()=>window.location.reload())};return{axiosInstanceAuthenticationGet:h,axiosInstanceAuthenticationPost:x,axiosInstanceAuthenticationPostApiKey:p,axiosInstancePost:m,axiosInstanceGet:u,axiosInstanceGetApiKey:f,axiosInstancePostApiKey:_}},Qs=(o="themeConfig")=>{try{const s=localStorage.getItem(o);return s?JSON.parse(s):null}catch{return null}},Le=class Le{constructor(){We(this,"axiosInstanceGet");We(this,"axiosInstancePost");We(this,"axiosInstanceAuthenticationGet");We(this,"axiosInstanceAuthenticationPost");We(this,"axiosInstanceGetApiKey");We(this,"axiosInstancePostApiKey");We(this,"axiosInstanceAuthenticationPostApiKey");We(this,"currentUpsaleController",null);We(this,"controller",new AbortController);this.axiosInstanceGet=Le._axiosGet,this.axiosInstancePost=Le._axiosPost,this.axiosInstanceGetApiKey=Le._axiosPostApiKey,this.axiosInstancePostApiKey=Le._axiosPostApiKey,this.axiosInstanceAuthenticationPostApiKey=Le._axiosAuthPostApiKey,this.axiosInstanceAuthenticationGet=Le._axiosAuthGet,this.axiosInstanceAuthenticationPost=Le._axiosAuthPost}static create(s){return s&&!Le._config&&Le._initialize(s),Le._config||console.warn("InitConnection не инициализирован"),new Le}static _initialize(s,i=null){const u=lt(),f=Rt(),{config_lib:h}=xe.storeToRefs(u),{stateCard:m,recountGroupTotalAmount:x}=xe.storeToRefs(f);Le._config=s,Le._cardStore=f,Le._stateCard=m,Le._recountGroupTotalAmount=x,h.value=s;const _=Bu(s);Le._axiosPostApiKey=_.axiosInstanceGetApiKey,Le._axiosPostApiKey=_.axiosInstancePostApiKey,Le._axiosAuthPostApiKey=_.axiosInstanceAuthenticationPostApiKey,Le._axiosGet=_.axiosInstanceGet,Le._axiosPost=_.axiosInstancePost,Le._axiosAuthGet=_.axiosInstanceAuthenticationGet,Le._axiosAuthPost=_.axiosInstanceAuthenticationPost}get config(){return Le._config}get cardStore(){return Le._cardStore}get stateCard(){return Le._stateCard}get recountGroupTotalAmount(){return Le._recountGroupTotalAmount}async updateTheme(){var h,m;const s=Qs(),i=It();if(s!==null){i.updateColor(s);return}const u=lt(),f=await((m=this.axiosInstanceGet)==null?void 0:m.get(`org/organizations/${(h=this.config)==null?void 0:h.orgId}/design/`));u.setStateDrum(f==null?void 0:f.data.hide_barban),u.setKioskTimeout(f==null?void 0:f.data.kiosk_timeout),localStorage.setItem("themeConfig",JSON.stringify(f.data)),i.updateColor(f.data)}async getGroupByID(s){var i,u;try{const f=await((u=this.axiosInstanceGet)==null?void 0:u.get(`${(i=this.config)==null?void 0:i.pointId}/group/${s}`));return f==null?void 0:f.data}catch(f){throw console.error("Ошибка в request.ts[getGroupByID]",f),f}}async loadGroupProducts(s){var i,u;try{const f=await((u=this.axiosInstanceGet)==null?void 0:u.get(`${(i=this.config)==null?void 0:i.pointId}/products/?group=${s}`)),h=(f==null?void 0:f.data)||[];for(const m of h)m&&await El(m);return await this.cacheImagesInBackground(h),h}catch(f){return console.error("Ошибка загрузки группы:",f),[]}}async getGroup(){var s,i;try{const u=await((i=this.axiosInstanceGet)==null?void 0:i.get(`${(s=this.config)==null?void 0:s.pointId}/groups/`));return u==null?void 0:u.data}catch(u){return console.error("Error fetching products:",u),[]}}async fetchAndCacheAllPages(){var s,i;try{const u=((s=this.config)==null?void 0:s.pointId)||"",f=await Hi(u);if(f)return f.data;const h=await((i=this.axiosInstanceGet)==null?void 0:i.get(`${u}/group/`)),m=(h==null?void 0:h.data)||[],x=[];for(const _ of m){_.products=_.products||[],await Rr(_.id,_),x.push(_);const p=await this.loadGroupProducts(_.id);_.products=p}return await this.cacheImagesInBackground(m),await Rr(u,m),x}catch(u){return console.error("fetchAndCacheAllPages error:",u),[]}}cacheImagesInBackground(s){s.forEach(i=>{var u;i.video_link&&this.loadAndCacheMedia(i.video_link,i.id+"_video"),i.image_link&&this.loadAndCacheMedia(i.image_link,i.id+"_image"),(u=i.products)==null||u.forEach(f=>{f.video_link&&this.loadAndCacheMedia(f.video_link,f.id+"_video"),f.image_link&&this.loadAndCacheMedia(f.image_link,f.id+"_image")})})}async loadAndCacheMedia(s,i){const u=await ur(i);if(u){this.dispatchImageCachedEvent(i,u);return}try{const f=await fetch(s);if(!f.ok)throw new Error("Network error");const h=await f.blob();if(h.size===0)throw new Error("Empty blob");await Gi(i,h),this.dispatchImageCachedEvent(i,h)}catch(f){console.warn(`[ImageCache] Failed for ${i}:`,f)}}dispatchImageCachedEvent(s,i){window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:s,blob:i}}))}async getProduct(s=null){var i,u;if(!s)return[];try{const f=await((u=this.axiosInstanceGet)==null?void 0:u.get(`${(i=this.config)==null?void 0:i.pointId}/products/${s}`));return f==null?void 0:f.data}catch(f){return console.error("Error fetching cardProducts:",f),[]}}async getSingleProduct(s){var f;const i=lt(),{config_lib:u}=xe.storeToRefs(i);try{let h=await $o(s);if(h)this._fullCardProduct(h);else{const m=await((f=this.axiosInstanceGet)==null?void 0:f.get(`${u.value.pointId}/products/${s}`));(m==null?void 0:m.status)===200&&this._fullCardProduct(m.data)}}catch(h){throw console.warn("store card[getFetchProducts]:",h),h}}_fullCardProduct(s){const i=Rt();i.stateCard.openCard={...s,amount:1},i.stateCard.groupModifiers=s.group_modifiers,s.modifiers.length>0&&i.stateCard.groupModifiers.unshift({default_amount:0,description:"",group_modifiers:s.modifiers,id:"Добавки2000",image_link:null,max_amount:1,min_amount:s.modifiers.reduce((u,f)=>u+=f.min_amount,0),name:"Добавки",required:!1}),i.stateCard.groupModifiersSelected=new Array(i.stateCard.groupModifiers.length).fill({group:"",modifiers:[],is_fake:!1,is_product_determining:!1,modifier_count:0}),i.stateCard.productSizes=s.sizes,i.defaultAmountModifiers(),s.show_recommendations&&this.productUpsale(s.id)}async getTheme(){try{this.updateTheme()}catch(s){return console.error("Error fetching products:",s),[]}}async authorizeByCard(s){var i,u;try{const f=await((u=this.axiosInstanceAuthenticationPostApiKey)==null?void 0:u.post(`${(i=this.config)==null?void 0:i.domain}/api/user/validate-card/`,{card_number:s}));return localStorage.setItem("authTokensAccess",JSON.stringify(f==null?void 0:f.data.access)),localStorage.setItem("authTokensRefresh",JSON.stringify(f==null?void 0:f.data.refresh)),f==null?void 0:f.data}catch(f){throw console.error("Ошибка авторизации:",f),f}}async getLoyalSmsCode(s){var i,u;try{const f=await((u=this.axiosInstancePostApiKey)==null?void 0:u.post(`${(i=this.config)==null?void 0:i.domain}/api/device/auth/request-otp/`,{phone:s}));return f==null?void 0:f.data}catch(f){throw console.error("Ошибка получения sms-code:",f),f}}async sendSmsCodeForAuth(s,i){var u,f;try{const h=await((f=this.axiosInstanceAuthenticationPostApiKey)==null?void 0:f.post(`${(u=this.config)==null?void 0:u.domain}/api/device/auth/`,{code:s,phone:i}));return h==null?void 0:h.data}catch(h){throw console.error("Ошибка отправки sms-code:",h),h}}async callStaff(s,i,u){var f,h,m,x;try{const _=await((m=this.axiosInstancePost)==null?void 0:m.post(`${(f=this.config)==null?void 0:f.domain}/api/org_unit/${(h=this.config)==null?void 0:h.pointId}/table/${s}/call-staff/`,{...i},u));return(x=_==null?void 0:_.data)==null?void 0:x.response_text}catch(_){throw console.error("Ошибка[callStaff]",_),_}}async createOrder(s,i,u=!0,f,h=!1,m=!1,x){var P,v,U,B,R;const _=St(),p=h?this.axiosInstanceAuthenticationPostApiKey:this.axiosInstancePostApiKey,C=u?p:this.axiosInstanceAuthenticationPost,y=u?"/device/order/create":"/order/create",S=u?(P=this.config)==null?void 0:P.pointId:(v=this.config)==null?void 0:v.pointId,M={items:s,table:i||null,comment:f};return u&&((U=_.selectedOrderType)!=null&&U.id)&&(M.order_type_id=(B=_.selectedOrderType)==null?void 0:B.id),await(C==null?void 0:C.post(`${(R=this.config)==null?void 0:R.domain}/api/org_unit/${S}${y}`,M,{signal:x}))}async initPaymentLink(s,i){const u=this.axiosInstanceAuthenticationPost,f=lt(),h=await(u==null?void 0:u.post("payment/init",{by_bonuses:f.countBonus,order:s,provider_type:i}));return h==null?void 0:h.data}async orderPay(s){var i;return(i=this.axiosInstanceAuthenticationPostApiKey)==null?void 0:i.post(`order/${s}/pay/`,{order_id:s})}async getProfile(){var i,u;const s=await((u=this.axiosInstanceAuthenticationGet)==null?void 0:u.get(`user/current?organization=${(i=this.config)==null?void 0:i.orgId}`));if((s==null?void 0:s.status)===200){const f=lt();return f.profile=s.data,f.is18Allowed=sessionStorage.getItem("is_adult")==="true",s.data}else return s}async joinLoyalty(){var i;const s=await((i=this.axiosInstanceAuthenticationGet)==null?void 0:i.post("user/join-loyalty/"));return{success:(s==null?void 0:s.status)===200}}async isPhoneExist(s,i={}){var u,f;try{const h=await((f=this.axiosInstanceGet)==null?void 0:f.get("user/check-phone",{...i,params:{organization:(u=this.config)==null?void 0:u.orgId,phone:s}}));return(h==null?void 0:h.status)===200}catch{return!1}}async sendOTP(s,i={}){var f,h;const u=await((h=this.axiosInstancePost)==null?void 0:h.post("user/check-phone",{organization:(f=this.config)==null?void 0:f.orgId,phone:s},i));return u==null?void 0:u.data}async auth(s,i={}){var f,h;return await((h=this.axiosInstancePost)==null?void 0:h.post("user/auth",{organization:(f=this.config)==null?void 0:f.orgId,...s},i))}async signup(s,i={}){var f,h;return await((h=this.axiosInstancePost)==null?void 0:h.post("user/register",{organization:(f=this.config)==null?void 0:f.orgId,...s},i))}async calculateDiscount(s,i=!0,u=!1,f){var p,C;const h=u?this.axiosInstanceAuthenticationPostApiKey:this.axiosInstancePostApiKey,m=i?h:this.axiosInstanceAuthenticationPost,x=i?(p=this.config)==null?void 0:p.pointId:(C=this.config)==null?void 0:C.pointId,_=await(m==null?void 0:m.post(`/org_unit/${x}/cart/calculate-discount/`,s,{signal:f}));return(_==null?void 0:_.status)===200?_.data:_}async maxPayByBonuses(s,i=!0,u=!1,f){const h=lt(),m=u?this.axiosInstanceAuthenticationPostApiKey:this.axiosInstancePostApiKey,x=i?m:this.axiosInstanceAuthenticationPost,_=await(x==null?void 0:x.post("/cart/max-pay-by-bonuses/",{total_cart_price:s},{signal:f})),p=_==null?void 0:_.data;return h.profile&&p&&"balance"in p&&(h.profile.balance=p.balance),p}async getDeviceInfo(){var u;const s=St(),i=await((u=this.axiosInstanceGetApiKey)==null?void 0:u.get("/device/current/"));return(i==null?void 0:i.status)===200?(s.orderTypes=i.data.order_types,s.providerTypes=i.data.payment_provider_type,i.data):i}async validateApiKey(s,i){var f,h;const u=await((h=this.axiosInstancePost)==null?void 0:h.post(`/device/org_unit/${(f=this.config)==null?void 0:f.pointId}/validate-api-key/`,{api_key:s},i));return(u==null?void 0:u.status)===200}async productUpsale(s){var h,m,x;const i=Rt(),{dataUpSale:u}=xe.storeToRefs(i);(h=this.currentUpsaleController)==null||h.abort();const f=new AbortController;this.currentUpsaleController=f;try{const _=await((x=this.axiosInstanceGet)==null?void 0:x.get(`/${(m=this.config)==null?void 0:m.pointId}/products/${s}/recommendation/`,{signal:f.signal}));f.signal.aborted||(u.value=_==null?void 0:_.data)}catch(_){if(_.name==="AbortError"||_.name==="CanceledError"){console.warn("Upsale отменён — пришёл новый запрос");return}throw console.error("Ошибка upsale:",_),_}finally{this.currentUpsaleController===f&&(this.currentUpsaleController=null)}}};We(Le,"_config",null),We(Le,"_axiosGet"),We(Le,"_axiosGetApiKey"),We(Le,"_axiosPostApiKey"),We(Le,"_axiosAuthPostApiKey"),We(Le,"_axiosPost"),We(Le,"_axiosAuthGet"),We(Le,"_axiosAuthPost"),We(Le,"_cardStore",null),We(Le,"_stateCard",null),We(Le,"_recountGroupTotalAmount",null);let En=Le;const Js=l.ref(!1),ea=l.ref(window.innerWidth),Nn=()=>{const o=l.computed({get:()=>Js.value,set:f=>{Js.value=f}}),s=l.computed(()=>o.value&&ea.value>1024),i=()=>ea.value=window.innerWidth;return l.onMounted(()=>{window.addEventListener("resize",i)}),l.onUnmounted(()=>{window.removeEventListener("resize",i)}),{isDesktop:o,shouldUseDragScroll:s,syncWithRoute:f=>{o.value=f.query.mode==="pdf"}}},Mu=l.defineComponent({__name:"UseScrollCenter",props:{axis:{},behavior:{},autoScroll:{type:Boolean},container:{},idActive:{},clearContainer:{type:Boolean}},setup(o,{expose:s}){const i=o,u=lt(),f=l.ref(null),{isDesktop:h}=Nn(),m=async _=>{if(!f.value||!_)return;let p=window;i.container&&(p=typeof i.container=="string"?document.querySelector(i.container)||window:i.container);const C={behavior:i.behavior};if(i.axis==="x"){const y=p===window?window.innerWidth:p.clientWidth,S=_.offsetWidth;let M=_.offsetLeft;if(p!==window){const k=p.getBoundingClientRect();M=_.getBoundingClientRect().left-k.left+p.scrollLeft}M-=(y-S)/2,C.left=Math.max(0,M)}else{const y=p===window?window.innerHeight:p.clientHeight,S=_.offsetHeight;let M=_.offsetTop;if(p!==window){const k=p.getBoundingClientRect();M=_.getBoundingClientRect().top-k.top+p.scrollTop}M-=(y-S)/2,C.top=Math.max(0,M)}try{p===window?window.scrollTo(C):p.scrollTo(C)}catch(y){console.error("Scroll error:",y)}};l.onMounted(async()=>{if(i.autoScroll){let _=null;if(await l.nextTick(),u.activeScrolling_lib){const p=u.activeScrolling_lib.findIndex(C=>C.id===i.idActive);i.idActive?(_=document.getElementById(`scrolling${i.idActive}`),_&&p!==-1&&(u.activeScrolling_lib[p]=_)):u.activeScrolling_lib[p]&&(_=u.activeScrolling_lib[p]),m(_)}}});const x=async _=>{i.clearContainer&&(u.activeScrolling_lib=[]);const p=_.currentTarget;await l.nextTick(),u.activeScrolling_lib.includes(p)||u.activeScrolling_lib.push(p),m(p)};return s({scrollToElement:m}),(_,p)=>(l.openBlock(),l.createElementBlock("div",{ref_key:"wrapperRef",ref:f,class:l.normalizeClass(["scroll-to-wrapper",{scroll_pdf:l.unref(h)}])},[l.renderSlot(_.$slots,"default",{handleTargetClick:x},void 0,!0)],2))}}),Ue=(o,s)=>{const i=o.__vccOpts||o;for(const[u,f]of s)i[u]=f;return i},oo=Ue(Mu,[["__scopeId","data-v-e47a167d"]]),Vr={mounted(o){let s=!1,i,u,f,h,m,x=0,_=0,p=0,C=0,y=0,S=!1;const M=5;o.style.cursor="grab";const k=U=>{U.button===0&&(m&&(cancelAnimationFrame(m),m=0),s=!0,S=!1,i=U.pageX-o.offsetLeft,u=U.pageY-o.offsetTop,f=o.scrollLeft,h=o.scrollTop,p=U.pageX,C=U.pageY,y=Date.now(),x=0,_=0)},P=U=>{if(!s)return;const B=U.pageX,R=U.pageY,D=Math.abs(B-p),K=Math.abs(R-C);if(!S&&(D>M||K>M)&&(S=!0,o.style.pointerEvents="none"),S){U.stopPropagation(),U.preventDefault();const te=Date.now(),z=te-y;z>0&&(x=(B-p)/z*16,_=(R-C)/z*16),p=B,C=R,y=te;const ie=B-o.offsetLeft,W=R-o.offsetTop,se=ie-i,j=W-u;o.scrollLeft=f-se,o.scrollTop=h-j}else p=B,C=R,y=Date.now()},v=U=>{if(s){if(S){if(U.stopPropagation(),U.preventDefault(),o.style.pointerEvents="",Math.abs(x)>.1||Math.abs(_)>.1){const B=()=>{o.scrollLeft-=x,o.scrollTop-=_,x*=.95,_*=.95,Math.abs(x)>.1||Math.abs(_)>.1?m=requestAnimationFrame(B):m=0};m=requestAnimationFrame(B)}}else o.style.pointerEvents="";s=!1,S=!1}};o.addEventListener("mousedown",k),window.addEventListener("mousemove",P),window.addEventListener("mouseup",v),o._dragScrollCleanup=()=>{m&&cancelAnimationFrame(m),o.removeEventListener("mousedown",k),window.removeEventListener("mousemove",P),window.removeEventListener("mouseup",v),o.style.pointerEvents=""}},unmounted(o){o._dragScrollCleanup&&o._dragScrollCleanup()}},vu={},Du={id:"custom_svg_lib",width:"26.000000",height:"26.000000",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"};function Pu(o,s){return l.openBlock(),l.createElementBlock("svg",Du,[...s[0]||(s[0]=[l.createElementVNode("defs",null,null,-1),l.createElementVNode("path",{id:"custom_svg_color",d:"M11.83 26L11.83 14.15L0 14.15L0 11.84L11.83 11.84L11.83 0L14.15 0L14.15 11.84L26 11.84L26 14.15L14.15 14.15L14.15 26L11.83 26Z",fill:"#FF6D2E","fill-opacity":"1.000000","fill-rule":"nonzero"},null,-1)])])}const so=Ue(vu,[["render",Pu]]),Lu=["id","onClick"],Fu={class:"modified_plus_btn"},Vu=["src"],Uu={key:2,class:"wrapper_modifier_item"},zu={key:0,class:"modifier_item_n_wrapper"},Hu=["src"],Gu={key:1,class:"modifier_plus_item"},Wu=["src"],Xu=["src"],ta=Ue(l.defineComponent({__name:"PlusModifier",props:{isSectionModifier:{type:Boolean},toggleNotRequire:{type:Function}},setup(o){const s=Rt(),i=It(),{stateCard:u}=xe.storeToRefs(s),{itemThemes:f}=xe.storeToRefs(i),{shouldUseDragScroll:h}=Nn(),m=l.ref([]),x=l.ref([]),_=l.ref(null),p=l.ref(null),C=S=>{S instanceof HTMLElement&&!m.value.includes(S)&&m.value.push(S)},y=S=>{p.value=S};return l.onMounted(async()=>{await l.nextTick(),u.value.plusButtonsRefs=m.value}),l.watchEffect(()=>{x.value=u.value.groupModifiersSelected,document.body.style.overflow=""}),l.onBeforeUnmount(()=>{m.value=[],u.value.plusButtonsRefs=[]}),(S,M)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass({card_modified_wrapper_many:l.unref(u).groupModifiers.length>=5})},[l.unref(u).groupModifiersSelected?l.withDirectives((l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass(["card_modified_wrapper",[l.unref(u).groupModifiers.length<=4?"card_modified_wrapper_center":""]]),ref_key:"scrollPlusContainer",ref:_},[l.createVNode(oo,{axis:"x",behavior:"smooth",container:_.value,autoScroll:!0,idActive:p.value,clearContainer:!0},{default:l.withCtx(({handleTargetClick:k})=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(u).groupModifiers,(P,v)=>{var U,B;return l.openBlock(),l.createElementBlock("div",{class:"button_modified",key:P.id,ref_for:!0,ref:C,id:"scrolling"+P.id,"data-clickable":"true",onClick:R=>{o.toggleNotRequire&&o.toggleNotRequire(P,v),y(P.id),k(R)}},[l.createElementVNode("div",Fu,[x.value[v].modifiers.length===0?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass([{modified_plus_btn_active:P.id===((U=l.unref(u).groupCurrentOpen)==null?void 0:U.id)&&o.isSectionModifier},"modified_plus_active"])},[l.createVNode(so,{"aria-label":`Открыть группу модификаторов ${P.name}`},null,8,["aria-label"])],2)):x.value[v].modifiers.length===1?(l.openBlock(),l.createElementBlock("div",{key:1,class:l.normalizeClass(["modified_plus_btn modified_plus_btn_solo",{modified_plus_btn_active:P.id===((B=l.unref(u).groupCurrentOpen)==null?void 0:B.id)&&o.isSectionModifier}])},[l.createElementVNode("img",{src:x.value[v].modifiers[0].image_link||l.unref(f).fallback_image||"",alt:"Модификатор"},null,8,Vu)],2)):(l.openBlock(),l.createElementBlock("div",Uu,[x.value[v].modifiers.length>2?(l.openBlock(),l.createElementBlock("div",zu,[x.value[v].modifiers.length===3?(l.openBlock(),l.createElementBlock("img",{key:0,class:"modifier_plus_item modifier_item_three",src:x.value[v].modifiers[2].image_link||l.unref(f).fallback_image||""},null,8,Hu)):(l.openBlock(),l.createElementBlock("p",Gu," + "+l.toDisplayString(x.value[v].modifiers.length-2),1))])):l.createCommentVNode("",!0),l.createElementVNode("div",null,[x.value[v].modifiers.length>0?(l.openBlock(),l.createElementBlock("img",{key:0,src:x.value[v].modifiers[0].image_link||l.unref(f).fallback_image||"",class:"modifier_plus_item modifier_item_first"},null,8,Wu)):l.createCommentVNode("",!0),x.value[v].modifiers.length>1?(l.openBlock(),l.createElementBlock("img",{key:1,src:x.value[v].modifiers[1].image_link||l.unref(f).fallback_image||"",class:"modifier_plus_item modifier_item_second"},null,8,Xu)):l.createCommentVNode("",!0)])]))]),l.createElementVNode("p",null,l.toDisplayString(P.name),1)],8,Lu)}),128))]),_:1},8,["container","idActive"])],2)),[[l.unref(Vr),l.unref(h)?{}:!1]]):l.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-c850b1ab"]]),ju={},qu={id:"custom_svg_lib",width:"21.847656",height:"21.846924",viewBox:"0 0 21.8477 21.8469",fill:"none",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"};function Zu(o,s){return l.openBlock(),l.createElementBlock("svg",qu,[...s[0]||(s[0]=[l.createElementVNode("desc",null," Created with Pixso. ",-1),l.createElementVNode("defs",null,null,-1),l.createElementVNode("circle",{id:"Ellipse 1",cx:"10.923828",cy:"10.923462",r:"10.923489",fill:"#FF6D2E","fill-opacity":"1.000000"},null,-1),l.createElementVNode("path",{id:"Vector",d:"M12.38 15.9L12.89 15.39C12.96 15.33 13 15.25 13 15.16C13 15.08 12.96 15 12.89 14.93L8.84 11L12.89 7.06C12.96 6.99 13 6.91 13 6.83C13 6.74 12.96 6.66 12.89 6.6L12.38 6.1C12.31 6.03 12.23 6 12.14 6C12.05 6 11.97 6.03 11.9 6.1L7.1 10.76C7.03 10.83 7 10.91 7 11C7 11.08 7.03 11.16 7.1 11.23L11.9 15.9C11.97 15.96 12.05 16 12.14 16C12.23 16 12.31 15.96 12.38 15.9Z",fill:"#F2F7FF","fill-opacity":"1.000000","fill-rule":"nonzero"},null,-1)])])}const Ur=Ue(ju,[["render",Zu]]),zr={mounted(o){o.muted=!0,o.setAttribute("muted","")}},Yu={class:"wrapper_modifiers"},$u={class:"wrapper_nutritional_value"},Ku={class:"nutritional_scheme"},Qu={key:0,class:"nutritional_parameters"},Ju={key:1,class:"nutritional_parameters"},ed={key:2,class:"nutritional_parameters"},td={key:3,class:"nutritional_parameters"},nd={ref:"modifierBody",class:"modifier_shadow"},rd={class:"wrapper_modifiers_title"},id={class:"wrapper_text_count_modifiers"},od=["id","aria-label","onClick","onKeydown"],sd={key:0,class:"counter_modifier"},ad={class:"hide_image_corners"},ld=["src","alt"],cd={key:1,loop:"",autoplay:"",muted:"",playsinline:"",class:"card__video"},ud=["src"],dd={class:"modifier_title"},fd=Ue(l.defineComponent({__name:"SectionModifiers",emits:["close"],setup(o,{emit:s}){const i=s,u=It(),f=Rt(),{itemThemes:h}=xe.storeToRefs(u),{stateCard:m,recountGroupTotalAmount:x,groupTotalAmount:_}=xe.storeToRefs(f),{isDesktop:p,shouldUseDragScroll:C}=Nn(),y=l.ref(null),S=Wt.useTemplateRefsList(),M=k=>{if(!k)return;const P=m.value.groupModifiers.findIndex(D=>D.id===m.value.groupCurrentOpen.id),v=m.value.plusButtonsRefs[P]||m.value.plusButtonsRefs[0];if(!v)return;const U=k.getBoundingClientRect(),B=v.getBoundingClientRect(),R=k.cloneNode(!0);R.classList.add("flyer"),Object.assign(R.style,{width:`${U.width}px`,height:`${U.height}px`,left:`${U.left}px`,top:`${U.top}px`,position:"fixed",zIndex:"1000"}),document.body.appendChild(R),y.value=R,requestAnimationFrame(()=>{const D=B.left+B.width/3-(U.left+U.width/2),K=B.top+B.height/4-(U.top+U.height/2),te=B.width/U.width*.2;R.style.transform=`translate(${D}px, ${K}px) scale(${te})`,R.style.opacity="0.4",R.style.transition="transform 0.5s ease, opacity 0.5s ease"}),R.addEventListener("transitionend",()=>{R.remove(),y.value=null,v.classList.add("bump"),setTimeout(()=>v.classList.remove("bump"),300)},{once:!0})};return l.watch(()=>m.value.isAnimationFly,k=>{k===!0&&m.value.currentModifier&&(M(S.value.find(P=>P.id===m.value.currentModifier.id)),m.value.isAnimationFly=!1)}),(k,P)=>{var v,U,B,R,D,K,te,z,ie,W,se,j,G;return l.openBlock(),l.createElementBlock("div",Yu,[l.createElementVNode("div",$u,[l.createElementVNode("div",{class:l.normalizeClass(["card_header_inner_back",[(v=l.unref(m).openCard)!=null&&v.proteins_amount?"card_header_inner_back_nutrients":""]]),"aria-label":"Закрыть выбор модификаторов",onClick:P[0]||(P[0]=V=>i("close"))},[l.createVNode(Ur,{class:"arrow_bottom"})],2),l.createElementVNode("div",Ku,[(U=l.unref(m).openCard)!=null&&U.energy_amount?(l.openBlock(),l.createElementBlock("div",Qu,[l.createElementVNode("b",null,l.toDisplayString((B=l.unref(m).openCard)==null?void 0:B.energy_amount),1),P[1]||(P[1]=l.createElementVNode("p",null,"Килокалории",-1))])):l.createCommentVNode("",!0),(R=l.unref(m).openCard)!=null&&R.proteins_amount?(l.openBlock(),l.createElementBlock("div",Ju,[l.createElementVNode("b",null,l.toDisplayString((D=l.unref(m).openCard)==null?void 0:D.proteins_amount),1),P[2]||(P[2]=l.createElementVNode("p",null,"Белки",-1))])):l.createCommentVNode("",!0),(K=l.unref(m).openCard)!=null&&K.fat_amount?(l.openBlock(),l.createElementBlock("div",ed,[l.createElementVNode("b",null,l.toDisplayString((te=l.unref(m).openCard)==null?void 0:te.fat_amount),1),P[3]||(P[3]=l.createElementVNode("p",null,"Жиры",-1))])):l.createCommentVNode("",!0),(z=l.unref(m).openCard)!=null&&z.carbohydrates_amount?(l.openBlock(),l.createElementBlock("div",td,[l.createElementVNode("b",null,l.toDisplayString((ie=l.unref(m).openCard)==null?void 0:ie.carbohydrates_amount),1),P[4]||(P[4]=l.createElementVNode("p",null,"Углеводы",-1))])):l.createCommentVNode("",!0)])]),l.createElementVNode("div",nd,[l.createElementVNode("p",rd,l.toDisplayString((W=l.unref(m).groupCurrentOpen)==null?void 0:W.name),1),l.createElementVNode("p",id,"Выбрано "+l.toDisplayString(l.unref(x))+" из "+l.toDisplayString(l.unref(_)),1),l.withDirectives((l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass((se=l.unref(m).groupModifiers.find(V=>{var X;return V.id===((X=l.unref(m).groupCurrentOpen)==null?void 0:X.id)}))!=null&&se.group_modifiers.length?"wrapper_modifiers_card":"wrapper_modifiers_card_column")},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(((j=l.unref(m).groupCurrentOpen)==null?void 0:j.group_modifiers)||[],V=>{var X,N,$;return l.openBlock(),l.createElementBlock("div",{key:V.id,ref_for:!0,ref:l.unref(S).set,id:V.id,style:l.normalizeStyle({pointerEvents:l.unref(p)?"none":"auto"}),class:l.normalizeClass(["modifier_card",{hidden_modifier_card:V.default_amount===0&&((X=l.unref(m).groupCurrentOpen)==null?void 0:X.id)==="Добавки2000"&&V.min_amount===0&&V.max_amount===0}]),tabindex:"0",role:"button","data-clickable":"true","aria-label":`Выбрать модификатор группы ${V.name}`,onClick:H=>l.unref(f).modifierSelect(V),onKeydown:l.withKeys(H=>l.unref(f).modifierSelect(V),["enter"])},[l.createElementVNode("div",{class:l.normalizeClass([{modifier_card_active:l.unref(m).groupModifiersSelected.some(H=>{var J;return H.group===((J=l.unref(m).groupCurrentOpen)==null?void 0:J.id)&&H.modifiers.some(q=>q.id===V.id)})},"wrapper_image_corners"])},[V.amount>1?(l.openBlock(),l.createElementBlock("div",sd,l.toDisplayString(V.amount),1)):l.createCommentVNode("",!0),l.createElementVNode("div",ad,[V.video_link?l.withDirectives((l.openBlock(),l.createElementBlock("video",cd,[l.createElementVNode("source",{src:V.video_link||"",type:"video/webm"},null,8,ud)])),[[l.unref(zr)]]):(l.openBlock(),l.createElementBlock("img",{key:0,class:"modifier_image",src:V.image_link||l.unref(h).fallback_image||"",alt:V.name},null,8,ld)),l.createElementVNode("div",{class:l.normalizeClass(["wrapper_modifier_title",{wrapper_modifier_title_required:V.min_amount>0||V.required}])},[l.createElementVNode("h3",dd,l.toDisplayString(V.name),1),l.createElementVNode("p",null,"+"+l.toDisplayString((($=(N=V.sizes)==null?void 0:N.find(H=>H.id===l.unref(m).selectedSize.id))==null?void 0:$.price)||V.price||0)+"₽",1)],2)])],2)],46,od)}),128))],2)),[[l.unref(Vr),(G=l.unref(m).groupModifiers.find(V=>{var X;return V.id===((X=l.unref(m).groupCurrentOpen)==null?void 0:X.id)}))!=null&&G.group_modifiers.length?{}:!1]])],512)])}}}),[["__scopeId","data-v-2ce24a7a"]]),hd={key:0,class:"card_size_place"},gd=["onClick","onKeydown","aria-label"],md={key:1,class:"card_size static"},pd=["onClick","onKeydown","aria-label"],ao=3,xd=Ue(l.defineComponent({__name:"SizeModifier",setup(o){const s=Rt(),{stateCard:i}=xe.storeToRefs(s),u=l.ref(null),{isDesktop:f}=Nn(),h=l.ref(50),m=l.ref(),x=l.ref(0),_=l.ref(0),p=l.ref(null),C=l.computed(()=>{var D;if(i.value.productSizes.length<=3)return i.value.productSizes[m.value.index]||i.value.productSizes[0];const B=x.value+1,R=((D=S.value[B])==null?void 0:D.originalIndex)??1;return i.value.productSizes[R]}),y=()=>{p.value&&i.value.productSizes.length>=3&&(_.value=p.value.offsetWidth/ao)},S=l.computed(()=>{if(i.value.productSizes.length<=3)return i.value.productSizes;const B=i.value.productSizes;return[...B.map((R,D)=>({...R,originalIndex:D})),...B.map((R,D)=>({...R,originalIndex:D})),...B.map((R,D)=>({...R,originalIndex:D}))]}),M=(B,R)=>{if(m.value={id:B.id,title:B.name,index:R,is_default:B.is_default},B.price!==null&&i.value.openCard&&(i.value.openCard={...i.value.openCard,price:B.price}),i.value.selectedSize=B,i.value.productSizes.length>3){y();const D=x.value+1;R<D?k():R>D&&P()}else{const D=i.value.productSizes.length,K=(R+.5)*(100/D);h.value=K}},k=()=>{var B;if(!(i.value.productSizes.length<=3)){if(x.value--,x.value<i.value.productSizes.length-ao+1){x.value+=i.value.productSizes.length;const R=(B=p.value)==null?void 0:B.querySelector(".card_size");R&&(R.style.transition="none",R.style.transform=`translateX(-${x.value*_.value}px)`,R.offsetHeight,R.style.transition="transform 0.2s ease-in-out")}v()}},P=()=>{var B;if(!(i.value.productSizes.length<=3)){if(x.value++,x.value>=i.value.productSizes.length*2){x.value-=i.value.productSizes.length;const R=(B=p.value)==null?void 0:B.querySelector(".card_size");R&&(R.style.transition="none",R.style.transform=`translateX(-${x.value*_.value}px)`,R.offsetHeight,R.style.transition="transform 0.2s ease-in-out")}v()}},v=()=>{var K;if(i.value.productSizes.length<=3)return;const B=x.value+1,R=((K=S.value[B])==null?void 0:K.originalIndex)??0,D=i.value.productSizes[R];m.value={id:D.id,title:D.name,index:R,is_default:D.is_default}};l.watch(()=>[i.value.productSizes,p.value],([B=[],R])=>{if(Array.isArray(B)&&B.length>0&&R!==null){let D=B.findIndex(K=>K.is_default===!0);B.length<3&&u.value&&parseInt(u.value.style.minWidth)<767&&(u.value.style.width="100px"),D>-1?(x.value=D,M(B[D],D),_.value=120/ao):B.length===2||B.length===1?(M(B[0],0),h.value=(0+.5)*(100/2)):(M(B[1],1),h.value=(1+.5)*(100/3))}}),l.watch(()=>{var B;return[(B=i.value.selectedSize)==null?void 0:B.id,i.value.groupModifiersSelected]},([B,R])=>{if(!B||!Array.isArray(R))return;const D=R.map(K=>({...K,modifiers:K.modifiers.map(te=>{if(!te.sizes||te.sizes.length===0)return te;const z=te.sizes.find(ie=>ie.id===B);return z?{...te,size:z,price:z.price??te.price}:te})}));JSON.stringify(D)!==JSON.stringify(i.value.groupModifiersSelected)&&(i.value.groupModifiersSelected=D)},{deep:!0});const U={mounted:y};return l.onBeforeUnmount(()=>{window.removeEventListener("resize",y)}),(B,R)=>l.withDirectives((l.openBlock(),l.createElementBlock("div",{class:"slider_container",ref_key:"slider_container",ref:u},[l.createElementVNode("div",{class:"card_size_place_wrapper",ref_key:"sliderWrapper",ref:p},[l.unref(i).productSizes.length>1&&m.value?(l.openBlock(),l.createElementBlock("div",hd,[l.unref(i).productSizes.length>3?(l.openBlock(),l.createElementBlock("ul",{key:0,class:"card_size",style:l.normalizeStyle({transform:`translateX(-${x.value*_.value}px)`})},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(S.value,(D,K)=>(l.openBlock(),l.createElementBlock("li",{key:`${D.id}-${K}`,onClick:te=>M(D,K),onKeydown:l.withKeys(te=>M(D,K),["enter"]),class:l.normalizeClass({active:m.value.id===D.id&&m.value.index===D.originalIndex}),tabindex:"0",role:"button","aria-label":`Выбрать размер ${D.name}`},l.toDisplayString(D.alt_name?D.alt_name:D.name),43,gd))),128))],4)):(l.openBlock(),l.createElementBlock("ul",md,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(i).productSizes,(D,K)=>(l.openBlock(),l.createElementBlock("li",{key:`${D.id}-${K}`,onClick:te=>M(D,K),onKeydown:l.withKeys(te=>M(D,K),["enter"]),class:l.normalizeClass({active:m.value.id===D.id&&m.value.index===K}),tabindex:"0",role:"button","aria-label":`Выбрать размер ${D.name}`},l.toDisplayString(D.alt_name?D.alt_name:D.name),43,pd))),128))])),C.value?l.withDirectives((l.openBlock(),l.createElementBlock("div",{key:2,class:"size_active",style:l.normalizeStyle(l.unref(i).productSizes.length<=3?{left:`${h.value}%`}:{})},[l.createElementVNode("p",null,l.toDisplayString(C.value.alt_name?C.value.alt_name:C.value.name),1)],4)),[[U]]):l.createCommentVNode("",!0)])):l.createCommentVNode("",!0)],512)],512)),[[l.vShow,l.unref(i).productSizes.length>1&&m.value]])}}),[["__scopeId","data-v-2fab37e4"]]),wd="data:image/svg+xml,%3csvg%20width='18'%20height='20'%20viewBox='0%200%2018%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M7.3063%2019.7525C8.12104%2019.7525%208.78152%2019.1097%208.78152%2018.3167C8.78152%2017.5236%208.12104%2016.8808%207.3063%2016.8808C6.49156%2016.8808%205.83108%2017.5236%205.83108%2018.3167C5.83108%2019.1097%206.49156%2019.7525%207.3063%2019.7525Z'%20fill='%23808080'/%3e%3cpath%20d='M7.3063%2019.2525C7.83733%2019.2525%208.26782%2018.8335%208.26782%2018.3167C8.26782%2017.7998%207.83733%2017.3808%207.3063%2017.3808C6.77526%2017.3808%206.34478%2017.7998%206.34478%2018.3167C6.34478%2018.8335%206.77526%2019.2525%207.3063%2019.2525Z'%20stroke='%23F2F7FF'%20stroke-width='0.999998'/%3e%3cpath%20d='M14.4716%2019.7525C15.2864%2019.7525%2015.9469%2019.1097%2015.9469%2018.3167C15.9469%2017.5236%2015.2864%2016.8808%2014.4716%2016.8808C13.6569%2016.8808%2012.9964%2017.5236%2012.9964%2018.3167C12.9964%2019.1097%2013.6569%2019.7525%2014.4716%2019.7525Z'%20fill='%23808080'/%3e%3cpath%20d='M14.4716%2019.2525C15.0027%2019.2525%2015.4332%2018.8335%2015.4332%2018.3167C15.4332%2017.7998%2015.0027%2017.3808%2014.4716%2017.3808C13.9406%2017.3808%2013.5101%2017.7998%2013.5101%2018.3167C13.5101%2018.8335%2013.9406%2019.2525%2014.4716%2019.2525Z'%20stroke='%23F2F7FF'%20stroke-width='0.999998'/%3e%3cpath%20d='M0.770536%203.75L4.56158%206.21L6.66771%2015.23H15.1025L17.2086%208.26'%20stroke='%23F2F7FF'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M9.19507%2011.95H12.2669H15.945'%20stroke='%23F2F7FF'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M11.1908%200.830648V7.34648L8.26615%204.49981C8.03242%204.27231%207.64886%204.27231%207.41513%204.49981C7.35957%204.55378%207.3155%204.61788%207.28542%204.68845C7.25535%204.75902%207.23987%204.83467%207.23987%204.91106C7.23987%204.98746%207.25535%205.06311%207.28542%205.13368C7.3155%205.20425%207.35957%205.26835%207.41513%205.32231L11.3646%209.16648C11.5983%209.39398%2011.9759%209.39398%2012.2096%209.16648L16.159%205.32231C16.2145%205.26831%2016.2585%205.20419%2016.2885%205.13363C16.3186%205.06307%2016.334%204.98744%2016.334%204.91106C16.334%204.83469%2016.3186%204.75906%2016.2885%204.6885C16.2585%204.61794%2016.2145%204.55382%2016.159%204.49981C16.1035%204.44581%2016.0377%204.40297%2015.9652%204.37374C15.8927%204.34451%2015.815%204.32947%2015.7365%204.32947C15.658%204.32947%2015.5803%204.34451%2015.5078%204.37374C15.4353%204.40297%2015.3695%204.44581%2015.314%204.49981L12.3894%207.34648V0.830648C12.3894%200.509814%2012.1197%200.247314%2011.7901%200.247314C11.4604%200.247314%2011.1908%200.509814%2011.1908%200.830648Z'%20fill='%23F2F7FF'/%3e%3c/svg%3e",_d={class:"counter_container"},Cd={class:"card_size_place_wrapper",ref:"sliderWrapper"},Ed={class:"cart_amount_counter"},yd={class:"button_circle_number"},bd=Ue(l.defineComponent({__name:"NumberModifier",props:{qr_menu:{type:Boolean}},setup(o){const s=Rt(),{stateCard:i}=xe.storeToRefs(s),u=Re.useRouter(),f=o,h=()=>{var x,_,p,C;(_=(x=u.options.history.state)==null?void 0:x.back)!=null&&_.includes("mode=pdf")&&f.qr_menu||(p=i.value.openCard)!=null&&p.amount&&((C=i.value.openCard)==null?void 0:C.amount)>1&&(i.value.openCard.amount-=1)},m=()=>{var x,_,p;(_=(x=u.options.history.state)==null?void 0:x.back)!=null&&_.includes("mode=pdf")&&f.qr_menu||(p=i.value.openCard)!=null&&p.amount&&(i.value.openCard.amount+=1)};return(x,_)=>{var p,C;return l.openBlock(),l.createElementBlock("div",_d,[l.createElementVNode("div",Cd,[l.createElementVNode("div",Ed,[l.createElementVNode("p",{class:l.normalizeClass(["cart_circle_minus",[((p=l.unref(i).openCard)==null?void 0:p.amount)===1?"card_circle_minus_alone":""]]),"aria-label":"Уменьшить количество продукта","data-clickable":"true",onClick:l.withModifiers(h,["stop","prevent"])},[..._[0]||(_[0]=[l.createElementVNode("span",null,null,-1)])],2),l.createElementVNode("p",yd,l.toDisplayString((C=l.unref(i).openCard)==null?void 0:C.amount),1),l.createElementVNode("p",{class:"cart_circle_plus","aria-label":"Увеличить количество продукта","data-clickable":"true",onClick:l.withModifiers(m,["stop","prevent"])},"+")])],512)])}}}),[["__scopeId","data-v-50b09b8c"]]);function na(o,s=800){const i=l.ref(o),u=l.ref(o);let f=null,h=null,m=o;const x=_=>{h||(h=_);const p=_-h,C=Math.min(p/s,1),y=C<.5?4*C*C*C:1-Math.pow(-2*C+2,3)/2;i.value=Math.round(m+(u.value-m)*y),C<1?f=requestAnimationFrame(x):(i.value=u.value,f=null)};return l.watch(u,()=>{f&&cancelAnimationFrame(f),m=i.value,h=null,f=requestAnimationFrame(x)},{immediate:!0}),l.onUnmounted(()=>{f&&cancelAnimationFrame(f)}),{displayNumber:i,targetNumber:u,update:_=>{u.value=_}}}const Xt=l.defineComponent({__name:"RecountNumber",props:{price:{type:Number,required:!0},duration:{type:Number},fixedFloat:{type:Number,require:!1}},setup(o){const s=o,{displayNumber:i,update:u}=na(s.price||0,s.duration||800);return l.watchEffect(()=>{u(s.price)}),(f,h)=>(l.openBlock(),l.createElementBlock("span",null,l.toDisplayString(l.unref(i).toFixed(o.fixedFloat)),1))}}),Ad=["disabled","id"],un=l.defineComponent({__name:"ButtonDefault",props:{textButtonDefault:{type:String,required:!0},disabled:{type:Boolean,default:!1},onClick:{type:Function,required:!0}},setup(o){const s=o,i=()=>{s.onClick()};return(u,f)=>(l.openBlock(),l.createElementBlock("button",{class:"buttonDefaultWrapper",disabled:o.disabled,onClick:i,id:o.disabled?"buttonDefaultDisabled":""},l.toDisplayString(o.textButtonDefault),9,Ad))}}),Id={class:"notification_info"},Sd={key:0,class:"notification_18plus"},Nd={class:"notification_18plus_image"},Td=["src"],kd={class:"notification_18plus_text"},Rd={class:"notification_18plus_accept"},Od={key:1,class:"notification_text"},Bd={key:0,class:"wrapper_button_accept"},lo=l.defineComponent({__name:"NotificationWindow",props:l.mergeModels({textNotificationDefault:{},backgroundColor:{},buttonAccept:{},type:{type:Boolean},is_qr:{type:Boolean}},{visible:{default:!1},visibleModifiers:{}}),emits:["update:visible"],setup(o){const s=o,i=It(),u=lt(),{is18Allowed:f,notificationData_lib:h}=xe.storeToRefs(u),{itemThemes:m}=xe.storeToRefs(i),x=l.computed(()=>s.backgroundColor||"rgba(50, 50, 50, 0.9)"),_=l.computed(()=>{var k;return!!((k=m.value)!=null&&k.kiosk_hide_menu_update_notification)});let p;const C=l.useModel(o,"visible"),y=()=>{h.value.fastAdd&&(u.addToCart(h.value.fastAdd),h.value.fastAdd=null),sessionStorage.setItem("is_adult","true"),f.value=!0,C.value=!1,h.value.callback&&(h.value.callback(),h.value.callback=null)},S=()=>{C.value=!1},M=()=>{C.value=!1,clearTimeout(p)};return l.watch([C,()=>s.textNotificationDefault,_],([k,P,v],[U,B])=>{p&&(!k||k!==U||P!==B)&&clearTimeout(p),v&&k&&(p=setTimeout(M,4e3))},{immediate:!0}),l.onUnmounted(()=>{p&&M()}),(k,P)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[!_.value&&C.value?(l.openBlock(),l.createBlock(l.Transition,{key:0,name:"notificationBlack",appear:""},{default:l.withCtx(()=>[l.createElementVNode("div",{class:"notification_background_black",onClick:S})]),_:1})):l.createCommentVNode("",!0),l.createVNode(l.Transition,{name:"notification"},{default:l.withCtx(()=>{var v;return[C.value?(l.openBlock(),l.createElementBlock("div",{key:0,class:"notification_overlay",onClick:S},[l.createElementVNode("div",{class:"notification_wrapper",style:l.normalizeStyle({"background-color":x.value,border:`2px solid ${x.value}`})},[l.createElementVNode("div",Id,[o.type?(l.openBlock(),l.createElementBlock("div",Sd,[l.createElementVNode("div",Nd,[l.createElementVNode("img",{src:l.unref(m).adult_disclaimer_image||l.unref(m).fallback_image,alt:"Дисклеймер"},null,8,Td)]),l.createElementVNode("div",kd,l.toDisplayString(l.unref(m).adult_disclaimer_text),1),l.createElementVNode("div",Rd,[P[0]||(P[0]=l.createElementVNode("label",{for:"plus18"},"Содержащиеся в настоящем разделе материалы предназначены для лиц старше 18 лет, носят информационный характер об ассортименте товаров и не являются рекламой. ",-1)),l.createVNode(un,{textButtonDefault:"Мне есть 18",onClick:y,style:{fontSize:"1rem",padding:"6px 24px",marginLeft:"10px"}})])])):(l.openBlock(),l.createElementBlock("div",Od,[l.createTextVNode(l.toDisplayString(o.textNotificationDefault)+" ",1),(v=o.buttonAccept)!=null&&v.state?(l.openBlock(),l.createElementBlock("div",Bd,[l.createVNode(un,{class:"button_accept",textButtonDefault:o.buttonAccept.text,onClick:o.buttonAccept.acceptBtn,disabled:o.buttonAccept.disabled},null,8,["textButtonDefault","onClick","disabled"])])):l.createCommentVNode("",!0)]))])],4)])):l.createCommentVNode("",!0)]}),_:1})],64))}}),Md={class:"button_price button_price_modifiers"},vd=["src"],Dd={class:"button_text_container"},Pd={class:"button_text_price"},Ld=Ue(l.defineComponent({__name:"ButtonPriceCount",props:{qr_menu:{type:Boolean,default:!1},closeProduct:{}},setup(o){const s=Re.useRouter(),i=Re.useRoute(),u=Rt(),f=lt(),h=It(),m=l.ref([]),x=l.ref([]),_=o,{stateCard:p,totalPrice_libCard:C,isOpenWindow:y,isAddToCard:S}=xe.storeToRefs(u),{isDesktop:M}=Nn(),{itemThemes:k}=xe.storeToRefs(h),P=l.ref(!0),v=l.ref(!1),U=l.computed(()=>M.value?!1:P.value),B=()=>{var D,K,te,z,ie;if((K=(D=s.options.history.state)==null?void 0:D.back)!=null&&K.includes("mode=pdf")&&_.qr_menu)return;if(P.value){u.setCurrentCard(p.value.openCard),v.value=!0;const W=p.value.groupModifiers.findIndex(se=>u.checkedRequiredBtn.group.id===se.id);u.checkedRequiredBtn.haveRequaire&&u.toggleNotRequire(u.checkedRequiredBtn.group,W);return}const R=p.value.groupModifiersSelected||[];if(m.value=[],x.value=[],Array.isArray(R)&&R.length>0&&R.forEach(W=>{const se=W.group,j=W.modifiers||[];se==="Добавки2000"?m.value=j.map(G=>{var V;return{...G,old_price:G.price,size:Array.isArray(G.size)?G.size.map(X=>X.id).filter(Boolean):(V=G.size)!=null&&V.id?G.size.id:void 0}}):j.length>0&&x.value.push({group:se,is_fake:W.is_fake||!1,is_product_determining:W.is_product_determining||!1,modifiers:j.map(G=>{var V;return{...G,old_price:G.price,size:Array.isArray(G.size)?G.size.map(X=>X.id).filter(Boolean):(V=G.size)!=null&&V.id?G.size.id:void 0}})})}),document.body.style.overflow="",p.value.openCard){const W={id:p.value.openCard.id,is_fake:p.value.openCard.is_fake||!1,is_od_united_product:p.value.openCard.is_od_united_product||!1,amount:p.value.openCard.amount,name:p.value.openCard.name,image_link:p.value.openCard.image_link,price:p.value.openCard.price,old_price:p.value.openCard.price,size:((te=p.value.selectedSize)==null?void 0:te.id)??((ie=(z=p.value.openCard.sizes)==null?void 0:z.find(se=>se.is_default))==null?void 0:ie.id),sizes:p.value.openCard.sizes||[],modifiers:m.value,groups:p.value.openCard.groups,group_modifiers:x.value,energy_amount:p.value.openCard.energy_amount??0,proteins_amount:p.value.openCard.proteins_amount??0,fat_amount:p.value.openCard.fat_amount??0,carbohydrates_amount:p.value.openCard.carbohydrates_amount??0};_.closeProduct&&_.closeProduct(),f.addToCart(W),S.value=!0}y.value=!1,_.qr_menu&&s.push(`/${i.params.orgId}/`)};return l.watch(()=>p.value.productSizes,R=>{!R||R.length===0||!p.value.selectedSize||(p.value.selectedSize={...p.value.selectedSize})},{immediate:!0}),l.watchEffect(()=>{u.checkedRequiredBtn.haveRequaire?P.value=!0:P.value=!1}),l.onMounted(()=>{S.value=!1}),(R,D)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[(l.openBlock(),l.createBlock(l.Teleport,{to:"body"},[l.createVNode(lo,{visible:v.value,textNotificationDefault:l.unref(p).textErrorRequaired,backgroundColor:l.unref(k).accent_color?l.unref(k).accent_color:"#FF6D2E",buttonAccept:null,"onUpdate:visible":D[0]||(D[0]=K=>v.value=K)},null,8,["visible","textNotificationDefault","backgroundColor"])])),l.createElementVNode("div",{class:"button_price_bg_product",onTouchstart:D[3]||(D[3]=l.withModifiers(()=>{},["stop"])),onPointerdown:D[4]||(D[4]=l.withModifiers(()=>{},["stop"]))},[l.createElementVNode("div",Md,[l.unref(M)?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(bd,{key:0,qr_menu:o.qr_menu},null,8,["qr_menu"])),l.createElementVNode("div",{class:l.normalizeClass(["card_product_button_buy",{buy_active:!U.value}]),"data-clickable":"true",onClick:B,onTouchstart:D[1]||(D[1]=l.withModifiers(()=>{},["stop"])),onPointerdown:D[2]||(D[2]=l.withModifiers(()=>{},["stop"]))},[l.unref(M)?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("img",{key:0,src:l.unref(wd),class:"card_product_button_icon"},null,8,vd)),l.createElementVNode("div",Dd,[l.createElementVNode("p",Pd,[l.createVNode(Xt,{price:+l.unref(C),fixedFloat:2},null,8,["price"]),D[5]||(D[5]=l.createTextVNode(" ₽ ",-1))])])],34)])],32)],64))}}),[["__scopeId","data-v-4ebdaed7"]]),Fd={class:"modified_amount"},Vd={class:"hide_image_corners"},Ud=["src"],zd={class:"wrapper_modifier_title"},Hd={class:"amount_title"},Gd={class:"wrapper_amount_counter"},Wd={class:"amount_count"},Xd={class:"amount_wrapper"},jd={class:"add_counter_amount"},qd=Ue(l.defineComponent({__name:"ModalAmount",setup(o){const s=Rt(),i=It(),{itemThemes:u}=xe.storeToRefs(i),{stateCard:f}=xe.storeToRefs(s),h=l.computed(()=>{var _,p,C;return((C=(p=(_=f.value.currentModifier)==null?void 0:_.sizes)==null?void 0:p.find(y=>y.id===f.value.selectedSize.id))==null?void 0:C.price)??dr(f.value.currentModifier)}),m=()=>{f.value.currentModifier&&(f.value.currentModifier.amount=f.value.modalCount),s.modifierSelect(f.value.currentModifier),f.value.isModifiedAmount=!1},x=()=>{f.value.modalCount=1,f.value.currentModifier.amount=1};return(_,p)=>{var C,y;return l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createElementVNode("div",Fd,[l.createElementVNode("div",Vd,[l.createElementVNode("img",{class:"modifier_image",src:((C=l.unref(f).currentModifier)==null?void 0:C.image_link)||l.unref(u).fallback_image||""},null,8,Ud),l.createElementVNode("div",zd,[l.createElementVNode("p",Hd,l.toDisplayString((y=l.unref(f).currentModifier)==null?void 0:y.name),1),l.createElementVNode("p",null,"+ "+l.toDisplayString(h.value)+"₽",1)])])]),l.createElementVNode("div",Gd,[l.createElementVNode("div",{class:"amount_mines",onClick:p[0]||(p[0]=l.withModifiers((...S)=>l.unref(s).minusAmount&&l.unref(s).minusAmount(...S),["stop"]))},[...p[1]||(p[1]=[l.createElementVNode("div",null,null,-1)])]),l.createElementVNode("p",Wd,l.toDisplayString(l.unref(f).modalCount),1),l.createElementVNode("div",Xd,[l.createVNode(so,{onClick:l.withModifiers(l.unref(s).plusAmount,["stop"])},null,8,["onClick"])])]),l.createElementVNode("p",{class:"clear_count",onClick:l.withModifiers(x,["stop"])},"Убрать все"),l.createElementVNode("div",jd,[l.createVNode(un,{textButtonDefault:"Добавить",onClick:m,class:"button_add_group_modifiers"})])],64)}}}),[["__scopeId","data-v-84debd5d"]]),Zd=(o,s,i)=>Math.max(s,Math.min(o,i)),Yd=(o,s)=>Math.pow(o,s*5),ra=(o,s,i)=>s===0||Math.abs(s)===1/0?Yd(o,i):o*s*i/(s+i*o),pi=(o,s)=>s*parseFloat(o)/100,co=(o,s,i,u=.15)=>u===0?Zd(o,s,i):o<s?-ra(s-o,i-s,u)+s:o>i?+ra(o-i,i-s,u)+i:o,sn=(o,{min:s,max:i})=>s!==void 0&&o<s?s:i!==void 0&&o>i?i:o;function $d(o,s,i){const u=l.ref(0),f=l.computed(()=>o.value.map(_=>typeof _=="string"?pi(_,i.value):_)),h=l.computed(()=>Math.min(...f.value)),m=l.computed(()=>Math.max(...f.value)),x=l.computed(()=>{const _=f.value.reduce((p,C)=>Math.abs(C-s.value)<Math.abs(p-s.value)?C:p);return f.value.indexOf(_)});return{currentSnapPointIndex:u,flattenedSnapPoints:f,minSnapPoint:h,maxSnapPoint:m,closestSnapPointIndex:x}}const uo=Ue(l.defineComponent({__name:"BottomSheet",props:{duration:{default:250},snapPoints:{},initialSnapPoint:{},blocking:{type:Boolean,default:!0},canSwipeClose:{type:Boolean,default:!0},swipeCloseThreshold:{},canBackdropClose:{type:Boolean,default:!0},expandOnContentDrag:{type:Boolean,default:!0},modelValue:{type:Boolean},teleportTo:{default:"body"},teleportDefer:{type:Boolean,default:!1},headerClass:{},contentClass:{},footerClass:{}},emits:["opened","opening-started","closed","closing-started","ready","dragging-up","dragging-down","snapped","instinctHeight","update:modelValue"],setup(o,{expose:s,emit:i}){const u=o,f=i,h=Wt.useVModel(u,"modelValue",f,{passive:!0});l.watch(h,me=>{me&&q()}),l.onMounted(()=>{h.value&&q()});const m=l.ref(),x=l.ref(null),_=l.ref(null),p=l.ref(null),C=l.ref(null),y=l.ref(u.expandOnContentDrag),{height:S}=Wt.useWindowSize(),{height:M}=Wt.useElementBounding(m),{height:k}=Wt.useElementBounding(x),{height:P}=Wt.useElementBounding(C),{height:v}=Wt.useElementBounding(_),U=l.computed({get(){return sn(Math.ceil(P.value+k.value+v.value),{max:S.value})},set(me){[k.value,P.value,v.value]=me}}),B=l.ref(0),R=l.ref(0),D=At.useMotionValue(0),K=At.useMotionValue(0),{snapPoints:te}=l.toRefs(u),z=l.computed(()=>te.value??[U.value]),{flattenedSnapPoints:ie,currentSnapPointIndex:W,closestSnapPointIndex:se,minSnapPoint:j,maxSnapPoint:G}=$d(z,B,S);let V;function X(me){y.value=!0,N(me)}function N(me){y.value&&me.preventDefault()}const $=me=>{me.key==="Escape"&&ge()},H=()=>{u.canBackdropClose&&ge()};let J=!1;const q=async()=>{if(J)return;h.value=!0,J=!0,f("opening-started"),await l.nextTick();const me=m.value.$el;M.value=me.getBoundingClientRect().height;const Ze=me.querySelector("[data-vsbs-content]"),Ee=me.querySelector("[data-vsbs-header]"),mt=me.querySelector("[data-vsbs-footer]");if(U.value=[Ee.getBoundingClientRect().height,Ze.getBoundingClientRect().height,mt.getBoundingClientRect().height],await l.nextTick(),W.value=ie.value.findIndex(nt=>nt===j.value),u.initialSnapPoint){const nt=u.initialSnapPoint;if(nt<0||nt>=z.value.length)return console.warn("Index out of bounds");B.value=typeof z.value[nt]=="number"?sn(z.value[nt],{max:S.value}):pi(z.value[nt],S.value)}else B.value=sn(j.value,{max:S.value});R.value=B.value,D.jump(B.value),K.jump(B.value),requestAnimationFrame(()=>{V=At.animate(D,B.value,{duration:u.duration/1e3,ease:"easeInOut"}),V=At.animate(K,0,{duration:u.duration/1e3,ease:"easeInOut",onComplete:()=>{u.blocking&&f("opened")}})}),window.addEventListener("keydown",$),J=!1};let re=!1;const ge=()=>{re||(h.value=!1,re=!0,f("closing-started"),window.removeEventListener("keydown",$),setTimeout(()=>{f("closed"),re=!1},u.duration))},we=me=>{if(z.value){if(me<0||me>=z.value.length){console.warn("Index out of bounds");return}W.value=me,B.value=typeof z.value[me]=="number"?sn(z.value[me],{max:S.value}):pi(z.value[me],S.value),V=At.animate(D,B.value,{duration:u.duration/1e3,ease:"easeInOut",onComplete:()=>f("snapped",z.value.indexOf(z.value[me]))})}};function Ne(me){me>0?f("dragging-down"):me<0&&f("dragging-up")}const _e=()=>{B.value=M.value,R.value=K.get(),D.jump(B.value),K.jump(R.value)},Me=async(me,Ze)=>{await l.nextTick(),m.value&&(R.value<=0&&(B.value-=Ze.delta.y),B.value<=j.value&&(B.value=j.value,R.value+=Ze.delta.y,K.set(u.canSwipeClose?sn(R.value,{min:0}):sn(co(R.value,-M.value,0,.5),{min:0}))),D.set(sn(co(B.value,0,G.value,.25),{min:0,max:S.value})),Ne(Ze.delta.y))},he=()=>{if(u.canSwipeClose){let me=B.value/2;u.swipeCloseThreshold&&typeof u.swipeCloseThreshold=="number"&&(me=u.swipeCloseThreshold),u.swipeCloseThreshold&&typeof u.swipeCloseThreshold=="string"&&u.swipeCloseThreshold.includes("%")&&(me=B.value*(Number(u.swipeCloseThreshold.replace("%",""))/100)),Math.abs(R.value)>me&&(R.value=B.value)}else R.value=0;V=At.animate(K,R.value,{duration:u.duration/1e3,ease:"easeInOut"}),R.value===B.value&&(R.value=0,ge()),W.value=se.value,B.value=typeof z.value[se.value]=="number"?sn(z.value[se.value],{max:S.value}):pi(z.value[se.value],S.value),V=At.animate(D,B.value,{duration:u.duration/1e3,ease:"easeInOut",onComplete:()=>f("snapped",z.value.indexOf(z.value[se.value]))}),V=At.animate(K,0,{duration:u.duration/1e3,ease:"easeInOut"})},dt=(me,Ze)=>{if(B.value=M.value,R.value=K.get(),V&&V.stop(),!p.value)return;const Ee=p.value.scrollTop===0,mt=Ze.delta.y>0,nt=ie.value.length===1,jt=.5>Math.abs(B.value-G.value);if(nt){if(!u.expandOnContentDrag)return y.value=!1;K.get()===0&&Ee&&mt&&(y.value=!0),K.get()===0&&Ee&&!mt&&(y.value=!1)}else{if(!u.expandOnContentDrag)return y.value=!1;y.value=!0,jt&&(mt&&Ee&&(y.value=!0),!mt&&Ee&&(y.value=!1),Ee||(y.value=!1))}},Xe=async(me,Ze)=>{if(await l.nextTick(),!u.expandOnContentDrag)return y.value=!1;if(!m.value)return;R.value===0&&y.value&&u.expandOnContentDrag&&(B.value-=Ze.delta.y),B.value<=j.value&&(B.value=j.value,y.value&&u.expandOnContentDrag&&(R.value+=Ze.delta.y),R.value=sn(R.value,{min:0,max:j.value}),K.set(u.canSwipeClose?sn(R.value,{min:0}):sn(co(R.value,-M.value,0,.5),{min:0}))),B.value>G.value&&(B.value=G.value),B.value=sn(B.value,{max:S.value}),!(ie.value.length===1)&&B.value===G.value&&(y.value=!1),D.set(B.value),Ne(Ze.delta.y)},Oe=()=>{if(!p.value)return;const me=p.value.scrollTop===0;y.value=me},qe=Wt.useDebounceFn(me=>we(me),u.duration);return l.watch(z,(me,Ze)=>{if(h.value===!1||!me||!Ze)return;const Ee=me[W.value],mt=Ze[W.value];typeof Ee!="string"&&typeof mt!="string"&&(B.value=sn(Ee,{max:S.value}),Ee!==mt&&(V=At.animate(D,B.value,{duration:u.duration/1e3,ease:"easeInOut"})))}),l.watch(S,()=>qe(W.value)),s({open:q,close:ge,snapToPoint:we}),(me,Ze)=>(l.openBlock(),l.createBlock(l.Teleport,{to:o.teleportTo,defer:o.teleportDefer},[l.createElementVNode("div",l.mergeProps(me.$attrs,{"data-vsbs-container":""}),[l.createVNode(l.unref(At.AnimatePresence),null,{default:l.withCtx(()=>[l.unref(h)&&o.blocking?(l.openBlock(),l.createBlock(l.unref(At.Motion),{key:0,ref:"backdrop","data-vsbs-backdrop":"",onClick:Ze[0]||(Ze[0]=Ee=>H()),transition:{ease:"easeInOut",duration:o.duration/1e3},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}},null,8,["transition"])):l.createCommentVNode("",!0)]),_:1}),l.createVNode(l.unref(At.AnimatePresence),null,{default:l.withCtx(()=>[l.unref(h)?(l.openBlock(),l.createBlock(l.unref(At.Motion),{key:0,ref_key:"sheet",ref:m,exit:{y:"100%",height:l.unref(M),opacity:0},initial:!1,style:l.normalizeStyle({y:l.unref(K),z:1,height:l.unref(D)}),"data-vsbs-shadow":!o.blocking,"data-vsbs-sheet-show":l.unref(h),"aria-modal":"true","data-vsbs-sheet":"",tabindex:"-1"},{default:l.withCtx(()=>[l.createVNode(l.unref(At.Motion),{ref_key:"sheetHeader",ref:x,"data-vsbs-header":"",onPanStart:_e,onPan:Me,onPanEnd:he,onTouchmove:X,class:l.normalizeClass(o.headerClass)},{default:l.withCtx(()=>[l.renderSlot(me.$slots,"header",{},void 0,!0)]),_:3},8,["class"]),l.createElementVNode("div",{ref_key:"sheetScroll",ref:p,"data-vsbs-scroll":"",onScrollend:Oe},[l.createVNode(l.unref(At.Motion),{ref:"sheetContentWrapper","data-vsbs-content-wrapper":"",onPanStart:dt,onPan:Xe,onPanEnd:he,onTouchmove:N},{default:l.withCtx(()=>[l.createElementVNode("div",{ref_key:"sheetContent",ref:C,"data-vsbs-content":"",class:l.normalizeClass(o.contentClass)},[l.renderSlot(me.$slots,"default",{},void 0,!0)],2)]),_:3},512)],544),l.createVNode(l.unref(At.Motion),{ref_key:"sheetFooter",ref:_,"data-vsbs-footer":"",onPanStart:_e,onPan:Me,onPanEnd:he,onTouchmove:X,class:l.normalizeClass(o.footerClass)},{default:l.withCtx(()=>[l.renderSlot(me.$slots,"footer",{},void 0,!0)]),_:3},8,["class"])]),_:3},8,["exit","style","data-vsbs-shadow","data-vsbs-sheet-show"])):l.createCommentVNode("",!0)]),_:3})],16)],8,["to","defer"]))}}),[["__scopeId","data-v-e35f48f7"]]);function Fn(o,s=null){const i=ti();i.initCacheSingle("defaultImage");const u=l.computed(()=>i.cache.defaultImage||null),f=l.shallowRef(!1),h=l.computed(()=>{var p;return((p=l.toValue(o))==null?void 0:p.toString())||null}),m=Wt.computedAsync(async()=>{const p=h.value;return p?(await i.initCacheSingle(p),i.cache[p]||null):null},null,{evaluating:f}),x=l.computed(()=>f.value&&h.value!==null);return{mediaUrl:l.computed(()=>m.value||l.toValue(s)||u.value||null),isLoading:x}}const Kd={class:"card_product_modifiers_sheet_body"},Qd={class:"card__pictures"},Jd=["src"],e0=["src"],t0={class:"card_header_wrapper"},n0={key:0,class:"card_fire_kkal_wrapper"},r0={class:"card_content"},i0={class:"wrapper_size"},o0={key:0,class:"description"},s0={key:1},a0=Ue(l.defineComponent({__name:"CardProductPage",props:{configPage:{}},setup(o){const s=It(),i=Rt(),{stateCard:u,isOpenWindow:f}=xe.storeToRefs(i),{itemThemes:h}=xe.storeToRefs(s),m=Re.useRouter(),x=Re.useRoute(),_=o,p=l.computed(()=>!!(x.query.mode==="pdf"&&_.configPage.qr_menu)),{mediaUrl:C}=Fn(()=>{var M,k;return(M=u.value.openCard)!=null&&M.video_link?`${u.value.openCard.id}_video`:(k=u.value.openCard)!=null&&k.image_link?`${u.value.openCard.id}_image`:null},()=>{var M,k;return((M=u.value.openCard)==null?void 0:M.video_link)||((k=u.value.openCard)==null?void 0:k.image_link)||null}),y=()=>{_.configPage.qr_menu?p.value?m.push(`/${x.params.orgId}?mode=pdf`):m.push(`/${x.params.orgId}`):_.configPage.closeProduct()},S=()=>{u.value.isModifiedAmount=!1};return l.watch(()=>_.configPage.data,i.setCurrentCard),l.watch(()=>u.value.isSectionModifier,M=>{p.value&&document.body.classList.toggle("pdf_hidden",M)},{immediate:!0}),l.watchEffect(()=>{f.value||(f.value=_.configPage.is_closeProduct)}),l.onBeforeUnmount(()=>i.reset()),(M,k)=>{var P,v,U,B,R,D;return l.openBlock(),l.createElementBlock("div",{class:"card_product_wrapper",style:l.normalizeStyle(p.value?"user-select: none;":"")},[l.createVNode(l.unref(uo),{modelValue:l.unref(u).isSectionModifier,"onUpdate:modelValue":k[1]||(k[1]=K=>l.unref(u).isSectionModifier=K),class:"card_product_modifiers_sheet",teleportTo:p.value?"#app":"body"},{default:l.withCtx(()=>[l.createElementVNode("div",Kd,[l.createVNode(fd,{onClose:k[0]||(k[0]=K=>l.unref(u).isSectionModifier=!1)}),l.createVNode(ta,{isSectionModifier:l.unref(u).isSectionModifier,toggleNotRequire:l.unref(i).toggleNotRequire},null,8,["isSectionModifier","toggleNotRequire"])])]),_:1},8,["modelValue","teleportTo"]),(l.openBlock(),l.createBlock(l.Teleport,{to:"body"},[l.unref(u).isModifiedAmount?(l.openBlock(),l.createElementBlock("div",{key:0,class:"wrapper_modified_amount",onClick:l.withModifiers(S,["stop"])},[l.createVNode(qd)])):l.createCommentVNode("",!0)])),l.createElementVNode("div",Qd,[(P=l.unref(u).openCard)!=null&&P.video_link&&l.unref(C)?l.withDirectives((l.openBlock(),l.createElementBlock("video",{key:l.unref(C),loop:"",autoplay:"",muted:"",playsinline:"",class:"card__video"},[l.createElementVNode("source",{src:l.unref(C)||"",type:"video/webm"},null,8,Jd)])),[[l.unref(zr)]]):(l.openBlock(),l.createElementBlock("img",{key:1,class:"card__pictures_images",src:l.unref(C)||"",alt:"Product image"},null,8,e0)),l.createElementVNode("div",t0,[l.createVNode(Ur,{class:"card_header_back",onClick:y,"aria-label":"Вернуться назад"}),(v=l.unref(u).openCard)!=null&&v.energy_amount?(l.openBlock(),l.createElementBlock("div",n0,[k[3]||(k[3]=l.createElementVNode("div",{class:"card_fire_kkal"},null,-1)),l.createElementVNode("p",null,[l.createElementVNode("b",null,l.toDisplayString((U=l.unref(u).openCard)==null?void 0:U.energy_amount),1),k[2]||(k[2]=l.createTextVNode(" Ккал ",-1))])])):l.createCommentVNode("",!0)]),l.createElementVNode("h4",null,l.toDisplayString((B=l.unref(u).openCard)==null?void 0:B.name),1),l.createElementVNode("div",{class:"card__pictures__gradient",style:l.normalizeStyle(l.unref(h).gradientStyle)},null,4)]),l.createElementVNode("div",r0,[l.createElementVNode("div",i0,[l.createVNode(xd)]),(R=l.unref(u).openCard)!=null&&R.description?(l.openBlock(),l.createElementBlock("p",o0,l.toDisplayString((D=l.unref(u).openCard)==null?void 0:D.description),1)):l.createCommentVNode("",!0),l.unref(u).groupModifiers.length?(l.openBlock(),l.createElementBlock("div",s0,[k[4]||(k[4]=l.createElementVNode("p",{class:"title_info_modifiers"},"Настрой, как ты любишь",-1)),l.createVNode(ta,{isSectionModifier:l.unref(u).isSectionModifier,toggleNotRequire:l.unref(i).toggleNotRequire},null,8,["isSectionModifier","toggleNotRequire"])])):l.createCommentVNode("",!0),l.createVNode(Ld,{qr_menu:o.configPage.qr_menu,closeProduct:o.configPage.closeProduct},null,8,["qr_menu","closeProduct"])])],4)}}}),[["__scopeId","data-v-a92cd973"]]),l0={key:0,class:"popupWindowDefault_overlay"},ia=Ue(l.defineComponent({__name:"PopupWindowDefault",props:{visible:{type:Boolean}},emits:["update:visible"],setup(o,{emit:s}){const i=o,u=s,f=()=>{u("update:visible",!1)};return l.watch(()=>i.visible,async h=>{h&&await l.nextTick(),i.isVisible=h}),(h,m)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createVNode(l.Transition,{name:"popupWindowDefaultBlack",appear:"",onAfterLeave:m[0]||(m[0]=()=>{u("update:visible",!1)})},{default:l.withCtx(()=>[i.visible?(l.openBlock(),l.createElementBlock("div",{key:0,class:"background_black",onClick:f})):l.createCommentVNode("",!0)]),_:1}),l.createVNode(l.Transition,{name:"popupWindowDefault",appear:"",onAfterLeave:m[1]||(m[1]=()=>{u("update:visible",!1)})},{default:l.withCtx(()=>[i.visible?(l.openBlock(),l.createElementBlock("div",l0,[l.renderSlot(h.$slots,"default",{},void 0,!0)])):l.createCommentVNode("",!0)]),_:3})],64))}}),[["__scopeId","data-v-08e0e008"]]),c0={},u0={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function d0(o,s){return l.openBlock(),l.createElementBlock("svg",u0,[...s[0]||(s[0]=[l.createElementVNode("path",{d:"M18 18L12 12M12 12L6 6M12 12L18 6M12 12L6 18",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const f0=Ue(c0,[["render",d0]]),fo=xe.defineStore("modals",()=>{const o=new Map,s=(f,h)=>{const m=u(f).value;m.visible=!0,m.context=h},i=f=>{const h=u(f).value;h.visible=!1},u=f=>(o.has(f)||o.set(f,l.ref({visible:!1})),o.get(f));return{state:u,open:s,close:i}}),h0=["src"],g0={class:"cart_box_content_wrapper"},m0={class:"cart_box_content_info"},p0={class:"cart_amount"},x0={class:"cart_amount_count"},w0={class:"cart_box_info_more"},_0={key:1,class:"cart_modifier_info"},C0={class:"cart_modifier_content"},E0={class:"wrapper_price_count_cart"},y0={class:"count_cart_box"},b0={class:"wrapper_modifiers_discount"},oa=Ue(l.defineComponent({__name:"CartBox",props:{index:Number,cardItem:Object},emits:["delete"],setup(o,{emit:s}){const i=o,u=lt(),f=It(),h=fo(),{itemThemes:m}=xe.storeToRefs(f),x=l.ref(0),_=l.ref(0),p=l.ref(!1),C=l.ref(!1),y=l.ref(!1),{displayNumber:S,update:M}=na(0,800),k=l.computed(()=>{var j,G;const W=((j=i.cardItem)==null?void 0:j.modifiers)??[],se=(((G=i.cardItem)==null?void 0:G.group_modifiers)??[]).flatMap(V=>V.modifiers??[]);return[...W,...se]}),{mediaUrl:P}=Fn(()=>{var W;return((W=i.cardItem)==null?void 0:W.id)+"_image"},()=>{var W;return(W=i.cardItem)==null?void 0:W.image_link}),v=l.computed(()=>{var W,se;return((W=i.cardItem)==null?void 0:W.total_new_price)||dr(i.cardItem)*((se=i.cardItem)==null?void 0:se.amount)}),U=()=>h.open("cart-delete-confirm",i.cardItem),B=()=>{y.value=!y.value},R=()=>{u.plusAmount(i.cardItem.idSystem)},D=()=>{i.cardItem.amount>1?u.minusAmount(i.cardItem.idSystem):U()},K=W=>{x.value=W.touches[0].clientX,p.value=!0},te=W=>{p.value&&(_.value=W.touches[0].clientX-x.value,_.value>0&&(_.value=0))},z=()=>{p.value=!1,_.value<-115&&U(),_.value=0};l.onMounted(()=>{i.index===0&&(C.value=!0,setTimeout(()=>{_.value=-90,setTimeout(()=>{_.value=0,C.value=!1},700)},0))});const ie=l.computed(()=>{const W=i.index===0&&C.value?1:`${1-Math.abs(_.value)/200}`;return{transform:`translateX(${_.value}px)`,opacity:W,transition:p.value?"none":"transform 0.7s, opacity 0.7s"}});return l.watch(v,M,{immediate:!0}),(W,se)=>{var j,G,V,X;return l.openBlock(),l.createElementBlock("div",{class:"cart_box_wrapper",onTouchstart:K,onTouchmove:te,onTouchend:z,style:l.normalizeStyle(ie.value)},[se[2]||(se[2]=l.createElementVNode("div",{class:"wrapper_cart_delete"},[l.createElementVNode("div",{class:"cart_delete"})],-1)),l.createElementVNode("img",{src:l.unref(P)||"",class:"cart_box_image"},null,8,h0),l.createElementVNode("div",g0,[l.createElementVNode("div",m0,[l.createElementVNode("p",null,l.toDisplayString((j=o.cardItem)==null?void 0:j.name),1),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(((G=i.cardItem)==null?void 0:G.discounts)||[],(N,$)=>(l.openBlock(),l.createElementBlock("div",{key:$,class:"discount_banner"},[l.createElementVNode("p",null,l.toDisplayString(N.name),1),l.createElementVNode("p",null,l.toDisplayString(N.discount)+"₽",1)]))),128)),l.createElementVNode("div",p0,[l.createElementVNode("button",{onClick:D},"-"),l.createElementVNode("p",x0,l.toDisplayString(i.cardItem.amount),1),l.createElementVNode("button",{onClick:R},"+")])]),l.createElementVNode("div",w0,[l.createElementVNode("div",{class:"cart_box_remove_item",onClick:U},[l.createVNode(f0)]),(V=i.cardItem)!=null&&V.new_price?(l.openBlock(),l.createElementBlock("p",{key:0,class:l.normalizeClass({discount_new_price:(X=i.cardItem)==null?void 0:X.new_price})},l.toDisplayString((i.cardItem.new_price*i.cardItem.amount).toFixed(2)+"₽"),3)):l.createCommentVNode("",!0),l.createElementVNode("p",null,l.toDisplayString(l.unref(S).toFixed(2)+"₽"),1)])]),!y.value&&k.value.length>0?(l.openBlock(),l.createElementBlock("div",{key:0,class:"cart_modifier_toggle",onTouchstart:l.withModifiers(B,["stop"])},[...se[0]||(se[0]=[l.createElementVNode("p",{class:"cart_info_more"},"Посмотреть модификаторы",-1),l.createElementVNode("p",{class:"cart_arrow"},null,-1)])],32)):l.createCommentVNode("",!0),y.value?(l.openBlock(),l.createElementBlock("div",_0,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(k.value,N=>{var $;return l.openBlock(),l.createElementBlock("div",{class:"cart_modifier_item",key:N.id},[l.createElementVNode("div",C0,[l.createVNode(so,{id:"plus_orange"}),l.createElementVNode("p",null,l.toDisplayString(N.name),1)]),l.createElementVNode("div",E0,[l.createElementVNode("p",y0,l.toDisplayString(`x${N.amount}`),1),l.createElementVNode("div",b0,[N!=null&&N.new_price?(l.openBlock(),l.createElementBlock("p",{key:0,class:l.normalizeClass({discount_new_price:($=N==null?void 0:N.new_price)==null?void 0:$.toFixed(2)})},l.toDisplayString((N.new_price*N.amount).toFixed(2)+"₽"),3)):l.createCommentVNode("",!0),l.createElementVNode("p",null,l.toDisplayString((N.total_new_price||N.price*N.amount).toFixed(2)+"₽"),1)])])])}),128)),l.createElementVNode("div",{class:"cart_modifier_arrow",onTouchstart:l.withModifiers(B,["stop"])},[...se[1]||(se[1]=[l.createElementVNode("p",{class:"cart_info_more"},"Скрыть",-1),l.createElementVNode("p",{class:"cart_arrow_top"},null,-1)])],32)])):l.createCommentVNode("",!0)],36)}}}),[["__scopeId","data-v-868411fd"]]),A0={},I0={class:"nfc_x",viewBox:"0 0 48 48"};function S0(o,s){return l.openBlock(),l.createElementBlock("svg",I0,[...s[0]||(s[0]=[l.createElementVNode("rect",{x:"8",y:"12",width:"32",height:"24",rx:"4",ry:"4",stroke:"#B00020","stroke-width":"2.4",fill:"none"},null,-1),l.createElementVNode("path",{d:"M14 16L34 30M34 16L14 30",stroke:"#B00020","stroke-width":"3","stroke-linecap":"round"},null,-1)])])}const N0=Ue(A0,[["render",S0]]),T0={},k0={style:{},"aria-hidden":"true",viewBox:"0 0 48 48",class:"nfc_ok"};function R0(o,s){return l.openBlock(),l.createElementBlock("svg",k0,[...s[0]||(s[0]=[l.createElementVNode("rect",{x:"8",y:"12",width:"32",height:"24",rx:"4",ry:"4",stroke:"#5D534B","stroke-width":"none",fill:"none"},null,-1),l.createElementVNode("path",{d:"M16 22h16m-10 6h6",stroke:"#5D534B","stroke-width":"2.4","stroke-linecap":"round"},null,-1),l.createElementVNode("path",{d:"M14 28l6 6l14-14",fill:"none",stroke:"#2ECC71","stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const O0=Ue(T0,[["render",R0]]),B0={key:0,class:"nfc_ok",viewBox:"0 0 48 48","aria-hidden":"true"},M0=l.defineComponent({__name:"CardReaderRetry",props:{styleRetry:{type:Boolean}},setup(o){return(s,i)=>o.styleRetry?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("svg",B0,[...i[0]||(i[0]=[l.createElementVNode("rect",{x:"8",y:"12",width:"32",height:"24",rx:"4",ry:"4"},null,-1),l.createElementVNode("path",{d:"M16 22h16m-10 6h6"},null,-1)])]))}}),v0={class:"sheet_header"},D0={class:"sheet_title",id:"sheetTitle"},P0={class:"sheet_body"},L0={class:"sheet_card"},F0={class:"nfc_title"},V0={class:"lead"},U0={class:"wrapper_input_accept"},z0={key:1},H0={key:0,class:"card_phone_auth_wrapper"},G0={class:"sr_only","aria-live":"polite"},sa=l.defineComponent({__name:"CardReader",setup(o){const s=lt(),i=It(),{is_OpenLoyal:u}=xe.storeToRefs(s),{itemThemes:f}=xe.storeToRefs(i),h=St(),m=l.ref(),x=l.ref(null),_=l.ref(""),p={wait:{text:"Лояльность",title:""},success:{text:"Стикер распознан",title:"Стикер распознан"},not_found:{text:"Стикер не распознан",title:"Стикер не распознали"}},C=l.computed({get:()=>_.value,set:H=>{_.value=H.replace(/\s/g,"")}}),y=l.computed(()=>h.currentState),S=l.computed(()=>h.isDrawerOpen),M=l.computed(()=>{var H;return((H=p[y.value])==null?void 0:H.text)||""}),k=l.computed(()=>{var H;(H=p[y.value])!=null&&H.title}),P=l.computed(()=>y.value==="success"?"Добро пожаловать!":f.value.kiosk_show_loyalty_phone_input_button?"Поднесите стикер к считывателю или войдите по номеру телефона":"Поднесите стикер к считывателю или введите номер карты вручную"),v=l.computed(()=>({ok:y.value==="success",warn:y.value==="not_found"})),U=l.computed(()=>{const H=[];return y.value==="wait"&&H.push("pulse","show-x"),y.value==="not_found"&&H.push("pulse","show-x"),y.value==="success"&&H.push("pulse","show-ok"),H}),B=l.computed(()=>y.value==="not_found"),R=l.computed(()=>y.value==="success"),D=l.computed(()=>y.value==="not_found"),K=l.computed(()=>["not_found"].includes(y.value)),te=l.computed(()=>({wait:"Стикер не распознан. Нажмите «Повторить».",success:"Стикер распознан. Нажмите «Продолжить».",not_found:"Стикер не распознан. Нажмите «Повторить»."})[y.value]||""),z=()=>{h.closeDrawer(),u.value=!0},ie=async H=>{var J,q;h.error="",x.value=null;try{const re=new En;await re.authorizeByCard(H.trim()),await re.getProfile(),s.loadCart(),h.setState("success"),h.isDrawerOpen=!1,h.showNotification("Вы успешно авторизовались в программе лояльности!")}catch(re){h.error=((q=(J=re.response)==null?void 0:J.data)==null?void 0:q.user_friendly_message)||"Ошибка",h.setState("not_found"),x.value=C.value,C.value=""}},W=l.computed(()=>{var J;const H=(J=f.value)==null?void 0:J.kiosk_hide_manual_input_loyalty_card;return H??!1}),se=()=>{h.setState("wait"),h.error="",C.value="",x.value=null},j=()=>{h.closeDrawer(),x.value=null,C.value=""},G=()=>{var H,J;h.setState("wait"),(J=(H=C.value)==null?void 0:H.trim())!=null&&J.length&&ie(C.value.trim())},V=H=>{H.stopPropagation(),document.activeElement!==m.value&&X()},X=()=>{l.nextTick(()=>{m.value&&(m.value.focus(),_.value&&m.value.select())})},N=H=>{const J=document.activeElement===m.value;if(!S.value||J)return;const q=H.key.toLowerCase();if(q==="backspace")return C.value=C.value.slice(0,-1);if(q==="escape")return j();if(q==="r"&&D.value)return se();if(q==="c"&&y.value==="success")return j();if(q==="enter")return G();C.value+=q},$={mounted(H){H==null||H.focus()}};return l.onMounted(()=>{document==null||document.addEventListener("keydown",N)}),l.onBeforeUnmount(()=>{document==null||document.removeEventListener("keydown",N)}),l.watchEffect(()=>{S.value&&(h.error="")}),(H,J)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[S.value?(l.openBlock(),l.createElementBlock("div",{key:0,class:"backdrop show",onClick:j,"aria-hidden":"true"})):l.createCommentVNode("",!0),S.value?(l.openBlock(),l.createElementBlock("section",{key:1,class:l.normalizeClass(["sheet show",{sheet_retry:D.value}]),"aria-modal":"true","aria-labelledby":"sheetTitle",onClick:V},[l.createElementVNode("header",v0,[l.createElementVNode("div",D0,l.toDisplayString(M.value),1),D.value?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass(["sheet_status",v.value])},l.toDisplayString(x.value),3)):l.createCommentVNode("",!0),l.createElementVNode("button",{class:"sheet_close",onClick:j,"aria-label":"Закрыть"}," Закрыть ")]),l.createElementVNode("div",P0,[l.createElementVNode("div",L0,[l.createElementVNode("div",{class:l.normalizeClass(["nfc",U.value])},[l.createVNode(M0,{styleRetry:K.value},null,8,["styleRetry"]),B.value?(l.openBlock(),l.createBlock(N0,{key:0})):l.createCommentVNode("",!0),l.createElementVNode("div",{class:"overlay check",style:l.normalizeStyle({display:R.value?"grid":"none"}),"aria-hidden":"true"},[l.createVNode(O0)],4)],2),l.createElementVNode("h2",F0,l.toDisplayString(k.value),1),l.createElementVNode("p",V0,l.toDisplayString(P.value),1),l.createElementVNode("div",U0,[l.withDirectives(l.createElementVNode("input",{style:l.normalizeStyle(W.value?{position:"absolute",left:"-9999px"}:{}),ref_key:"cardInputManualRef",ref:m,"onUpdate:modelValue":J[0]||(J[0]=q=>C.value=q),class:"nfc_title_read_input",type:"text",placeholder:"Введите трек карты","aria-live":"polite",onKeydown:l.withKeys(G,["enter"])},null,36),[[l.vModelText,C.value],[$]]),D.value?(l.openBlock(),l.createElementBlock("button",{key:0,class:"btn btn_ghost",onClick:se},"Повторить")):(l.openBlock(),l.createElementBlock("div",z0,[W.value?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("button",{key:0,class:"btn btn_ghost",onClick:J[1]||(J[1]=q=>D.value?j:G())},"Отправить"))]))]),y.value==="wait"&&l.unref(f).kiosk_show_loyalty_phone_input_button?(l.openBlock(),l.createElementBlock("div",H0,[l.createElementVNode("button",{class:"card_phone_auth_button",onClick:z},"Войти по номеру телефона")])):l.createCommentVNode("",!0)])]),l.createElementVNode("div",G0,l.toDisplayString(te.value),1)],2)):l.createCommentVNode("",!0)],64))}});function aa(){const o=Re.useRoute(),s=St(),i=lt(),{isButtonDisabled:u}=xe.storeToRefs(s),f=(m,x)=>{const _=m.is_tableservice?"tableservice":m.kiosk_menu?"kiosk":"qr",p=s.createPaymentHandler(_,m.kiosk_menu,m.is_tableservice,x);return p?{...p.config,route:{params:{orgId:String(o.params.orgId)}},handler:p.handler,setButtonDisabled:C=>{u.value=C},on403Kiosk:()=>{localStorage.removeItem("apiKey"),i.is_showApiKey=!0}}:null};return{getCreateOrderConfig:f,makeCreateOrderRequest:async(m,x)=>{const _=f(m,x.paymentMethodId);if(_)return Iu(x.items,x.tableDataId,_,{comment:x.comment,is_authorized:x.isAuthorized,signal:x.signal})}}}const W0="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgcm9sZT0iaW1nIiBhcmlhLWxhYmVsPSJJTk5PIGJhbmsgY2FyZCBpY29uIj4NCiAgPGRlZnM+DQogICAgPGxpbmVhckdyYWRpZW50IGlkPSJibGFja0dyYWQiIHgxPSIwIiB5MT0iMCIgeDI9IjEiIHkyPSIxIj4NCiAgICAgIDxzdG9wIG9mZnNldD0iMCUiIHN0b3AtY29sb3I9IiMxQTFBMUEiLz4NCiAgICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzAwMDAwMCIvPg0KICAgIDwvbGluZWFyR3JhZGllbnQ+DQoNCiAgICA8bGluZWFyR3JhZGllbnQgaWQ9InNoaW5lIiB4MT0iMCIgeTE9IjAiIHgyPSIxIiB5Mj0iMCI+DQogICAgICA8c3RvcCBvZmZzZXQ9IjAlIiBzdG9wLWNvbG9yPSIjRkZGRkZGIiBzdG9wLW9wYWNpdHk9IjAiLz4NCiAgICAgIDxzdG9wIG9mZnNldD0iNTAlIiBzdG9wLWNvbG9yPSIjRkZGRkZGIiBzdG9wLW9wYWNpdHk9IjAuMTgiLz4NCiAgICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI0ZGRkZGRiIgc3RvcC1vcGFjaXR5PSIwIi8+DQogICAgPC9saW5lYXJHcmFkaWVudD4NCg0KICAgIDxmaWx0ZXIgaWQ9InNoYWRvdyIgeD0iLTMwJSIgeT0iLTMwJSIgd2lkdGg9IjE2MCUiIGhlaWdodD0iMTYwJSI+DQogICAgICA8ZmVEcm9wU2hhZG93IGR4PSIwIiBkeT0iNiIgc3RkRGV2aWF0aW9uPSI2IiBmbG9vZC1jb2xvcj0iIzAwMCIgZmxvb2Qtb3BhY2l0eT0iMC4yNSIvPg0KICAgIDwvZmlsdGVyPg0KICA8L2RlZnM+DQoNCiAgPCEtLSBDZW50ZXJlZCBjYXJkIC0tPg0KICA8ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSg3LjUgMjMpIHJvdGF0ZSgtMTIpIiBmaWx0ZXI9InVybCgjc2hhZG93KSI+DQogICAgPCEtLSBjYXJkIGJvZHkgLS0+DQogICAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9Ijg1IiBoZWlnaHQ9IjU0IiByeD0iMTAiIGZpbGw9InVybCgjYmxhY2tHcmFkKSIvPg0KDQogICAgPCEtLSB0b3Agc3RyaXBlIC0tPg0KICAgIDxyZWN0IHg9IjAiIHk9IjgiIHdpZHRoPSI4NSIgaGVpZ2h0PSI4IiByeD0iNCIgZmlsbD0iI0ZGRkZGRiIgb3BhY2l0eT0iMC4wNSIvPg0KDQogICAgPCEtLSBjaGlwIC0tPg0KICAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEwIDI3KSI+DQogICAgICA8cmVjdCB3aWR0aD0iMTgiIGhlaWdodD0iMTUiIHJ4PSIzIiBmaWxsPSIjQ0ZBRTcwIi8+DQogICAgICA8cmVjdCB4PSIyLjUiIHk9IjMuNSIgd2lkdGg9IjEzIiBoZWlnaHQ9IjEuMiIgZmlsbD0iIzlFODM0RSIvPg0KICAgICAgPHJlY3QgeD0iMi41IiB5PSI2LjUiIHdpZHRoPSIxMyIgaGVpZ2h0PSIxLjIiIGZpbGw9IiM5RTgzNEUiLz4NCiAgICAgIDxyZWN0IHg9IjIuNSIgeT0iOS41IiB3aWR0aD0iMTMiIGhlaWdodD0iMS4yIiBmaWxsPSIjOUU4MzRFIi8+DQogICAgICA8cmVjdCB4PSI4LjUiIHk9IjAiIHdpZHRoPSIxLjUiIGhlaWdodD0iMTUiIGZpbGw9IiM5RTgzNEUiIG9wYWNpdHk9IjAuNiIvPg0KICAgIDwvZz4NCg0KICAgIDwhLS0gSU5OTyBsb2dvIC0tPg0KICAgIDx0ZXh0IHg9IjYxIiB5PSIzOSINCiAgICAgICAgICBmb250LWZhbWlseT0ic3lzdGVtLXVpLCAtYXBwbGUtc3lzdGVtLCBTZWdvZSBVSSwgUm9ib3RvLCBBcmlhbCwgc2Fucy1zZXJpZiINCiAgICAgICAgICBmb250LXNpemU9IjEzIg0KICAgICAgICAgIGZvbnQtd2VpZ2h0PSI4MDAiDQogICAgICAgICAgbGV0dGVyLXNwYWNpbmc9IjEuMiINCiAgICAgICAgICBmaWxsPSIjRkZGRkZGIg0KICAgICAgICAgIG9wYWNpdHk9IjAuOTUiDQogICAgICAgICAgdGV4dC1hbmNob3I9Im1pZGRsZSI+DQogICAgICBpbm5vDQogICAgPC90ZXh0Pg0KDQogICAgPCEtLSBzaGluZSAtLT4NCiAgICA8cGF0aCBkPSJNLTggNiBMMjUgLTMgTDk0IDQ3IEw2MCA2MiBMLTggMjUgWiIgZmlsbD0idXJsKCNzaGluZSkiLz4NCiAgPC9nPg0KPC9zdmc+",la="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20512%20512'%20width='100'%20height='100'%20fill='none'%3e%3c!--%20Big%20QR%20corners%20(outer%20shape%20with%20inner%20cutout)%20--%3e%3cpath%20fill='currentColor'%20fill-rule='evenodd'%20d='%20M72%200H163C202.765%200%20235%2032.235%20235%2072V163C235%20202.765%20202.765%20235%20163%20235H72C32.235%20235%200%20202.765%200%20163V72C0%2032.235%2032.235%200%2072%200Z%20M102%2086H133C141.837%2086%20149%2093.163%20149%20102V133C149%20141.837%20141.837%20149%20133%20149H102C93.163%20149%2086%20141.837%2086%20133V102C86%2093.163%2093.163%2086%20102%2086Z%20'/%3e%3cpath%20fill='currentColor'%20fill-rule='evenodd'%20d='%20M349%200H440C479.765%200%20512%2032.235%20512%2072V163C512%20202.765%20479.765%20235%20440%20235H349C309.235%20235%20277%20202.765%20277%20163V72C277%2032.235%20309.235%200%20349%200Z%20M379%2086H410C418.837%2086%20426%2093.163%20426%20102V133C426%20141.837%20418.837%20149%20410%20149H379C370.163%20149%20363%20141.837%20363%20133V102C363%2093.163%20370.163%2086%20379%2086Z%20'/%3e%3cpath%20fill='currentColor'%20fill-rule='evenodd'%20d='%20M72%20277H163C202.765%20277%20235%20309.235%20235%20349V440C235%20479.765%20202.765%20512%20163%20512H72C32.235%20512%200%20479.765%200%20440V349C0%20309.235%2032.235%20277%2072%20277Z%20M102%20363H133C141.837%20363%20149%20370.163%20149%20379V410C149%20418.837%20141.837%20426%20133%20426H102C93.163%20426%2086%20418.837%2086%20410V379C86%20370.163%2093.163%20363%20102%20363Z%20'/%3e%3c!--%20Small%20modules%20--%3e%3crect%20x='277'%20y='277'%20width='86'%20height='86'%20rx='26'%20fill='currentColor'/%3e%3crect%20x='426'%20y='277'%20width='86'%20height='86'%20rx='28'%20fill='currentColor'/%3e%3crect%20x='277'%20y='426'%20width='86'%20height='86'%20rx='26'%20fill='currentColor'/%3e%3c!--%20Center%20dot%20--%3e%3ccircle%20cx='394.17'%20cy='394.17'%20r='33'%20fill='currentColor'/%3e%3c/svg%3e",X0=["src"],j0={class:"header_description"},q0=Ue(l.defineComponent({__name:"PaymentBoxes",props:{configPage:{},comment:{},cartItems:{},isAuthorized:{type:Boolean},hasRmsDiscount:{type:Boolean,default:!1},hideDiscountsButton:{type:Boolean,default:!1},orderId:{default:null},signal:{},provider:{}},emits:["select"],setup(o,{emit:s}){const i=o,u=s,f=St(),h=Rt(),{selectedProvider:m,isButtonDisabled:x}=xe.storeToRefs(f),{isAddToCard:_}=xe.storeToRefs(h),{makeCreateOrderRequest:p}=aa(),C={default:W0,SBP:la},y=async()=>{m.value=i.provider;const M=i.provider.front_type;M&&(_.value=!1,x.value=!0,u("select",M),i.hasRmsDiscount&&!i.hideDiscountsButton&&i.orderId!=null?Fr(i.orderId,i.provider.type):await p(i.configPage,{paymentMethodId:M,items:i.cartItems,tableDataId:i.configPage.tableDataId,comment:i.comment,isAuthorized:i.isAuthorized,signal:i.signal}))},S=l.computed(()=>C[i.provider.front_type]||C.default);return(M,k)=>(l.openBlock(),l.createElementBlock("div",{class:"payment_boxes_wrapper",onClick:y},[l.createElementVNode("img",{class:"picture",src:S.value},null,8,X0),l.createElementVNode("div",j0,[l.createElementVNode("b",null,l.toDisplayString(o.provider.name),1),l.createElementVNode("p",null,l.toDisplayString(o.provider.description),1)]),l.createVNode(Ur)]))}}),[["__scopeId","data-v-7e25de77"]]),Z0={key:0,class:"wrapper_cart_payment"},Y0={class:"wrapper_paid"},$0={class:"to_be_paid"},K0=Ue(l.defineComponent({__name:"CartPayment",props:{configPage:{},comment:{},cartItems:{},isAuthorized:{type:Boolean},hasRmsDiscount:{type:Boolean},hideDiscountsButton:{type:Boolean},orderId:{},signal:{}},emits:["selectPayment"],setup(o,{emit:s}){const i=St(),u=lt(),f=o,{totalPrice_lib:h,countBonus:m}=xe.storeToRefs(u),x=s,_=C=>{x("selectPayment",C)},p=()=>{x("selectPayment","")};return(C,y)=>l.unref(i).providerTypes.length>1?(l.openBlock(),l.createElementBlock("div",Z0,[y[2]||(y[2]=l.createElementVNode("h2",null,"Выберите способ оплаты",-1)),y[3]||(y[3]=l.createElementVNode("p",{class:"description_payment"},"Можно изменить позже до оплаты",-1)),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(i).providerTypes,(S,M)=>(l.openBlock(),l.createElementBlock("div",{key:M},[l.createVNode(q0,{provider:S,"config-page":f.configPage,comment:f.comment,"cart-items":f.cartItems,"is-authorized":f.isAuthorized,"has-rms-discount":f.hasRmsDiscount,"hide-discounts-button":f.hideDiscountsButton,"order-id":f.orderId,signal:f.signal,onSelect:_},null,8,["provider","config-page","comment","cart-items","is-authorized","has-rms-discount","hide-discounts-button","order-id","signal"])]))),128)),l.createElementVNode("div",Y0,[l.createElementVNode("p",$0,[y[0]||(y[0]=l.createTextVNode("К оплате ",-1)),l.createVNode(Xt,{price:l.unref(h)-l.unref(m),fixedFloat:2},null,8,["price"]),y[1]||(y[1]=l.createTextVNode(" ₽",-1))]),l.createVNode(un,{textButtonDefault:"Назад",onClick:p,class:"btn_payment"})])])):l.createCommentVNode("",!0)}}),[["__scopeId","data-v-93970a62"]]),Q0={class:"start_page"},J0=["src"],e1={class:"wrap"},t1={class:"wrap_box"},n1={class:"title_fiscal_order"},r1={class:"wrapper_accept"},i1={ref:"barRef",class:"bar_complete","aria-hidden":"true"},o1=Ue(l.defineComponent({__name:"CartCompleteKioskSuccess",props:{mediaUrl:{},orderNumber:{}},setup(o){const s=lt(),i=St(),u=Rt(),f=It(),{cartProducts_lib:h}=xe.storeToRefs(s),{orderNumber:m,orderCompleted_lib:x,selectedOrderType:_}=xe.storeToRefs(i),{is_startPage:p}=xe.storeToRefs(u),{mediaUrl:C}=Fn(()=>f.itemThemes.kiosk_preloader?"preloader":null),y=Re.useRouter(),S=Re.useRoute();let M=null;l.onMounted(()=>{M=setTimeout(()=>{p.value=!f.itemThemes.kiosk_disable_lock_screen,_.value=null,s.isOrderTypeSubmited=!1,y.replace(`/${S.params.orgId}`)},1e4)});const k=()=>{fr(["cart","authTokensAccess","authTokensRefresh"]),h.value=[],x.value=null,_.value=null,s.isOrderTypeSubmited=!1,i.clearCard(),s.profile=null,y.replace(`/${S.params.orgId}`)};return l.onUnmounted(()=>{M&&clearInterval(M)}),(P,v)=>(l.openBlock(),l.createElementBlock("div",Q0,[l.withDirectives((l.openBlock(),l.createElementBlock("video",{loop:"",autoplay:"",muted:"",playsinline:"",key:l.unref(C)},[l.createElementVNode("source",{src:l.unref(C)||"",type:"video/webm"},null,8,J0)])),[[l.unref(zr)]]),v[4]||(v[4]=l.createElementVNode("div",{class:"start_img_black"},null,-1)),l.createElementVNode("div",e1,[l.createElementVNode("div",t1,[v[1]||(v[1]=l.createElementVNode("div",{class:"icon","aria-hidden":"true"},[l.createElementVNode("svg",{viewBox:"0 0 24 24"},[l.createElementVNode("path",{d:"M20 6L9 17l-5-5"})])],-1)),v[2]||(v[2]=l.createElementVNode("h1",null," Заказ успешно оплачен ",-1)),l.createElementVNode("p",n1,"№ "+l.toDisplayString(l.unref(m)),1),v[3]||(v[3]=l.createElementVNode("p",{class:"title_fiscal_completed"},"Спасибо! Заказ передан в работу.",-1)),l.createElementVNode("div",r1,[l.createElementVNode("button",{class:"btn","aria-label":"Новый заказ",onClick:k},[v[0]||(v[0]=l.createElementVNode("span",{class:"label"},"Новый заказ",-1)),l.createElementVNode("span",i1,null,512)])])])])]))}}),[["__scopeId","data-v-79c00acf"]]),s1={};function a1(o,s){return s[0]||(s[0]=l.createStaticVNode('<div class="topProgress" aria-hidden="true" data-v-3e03a6dc><i data-v-3e03a6dc></i></div><h1 class="title_fiscal" data-v-3e03a6dc>Сейчас будет распечатан фискальный чек</h1><p class="reminder" data-v-3e03a6dc>Не забудьте <b data-v-3e03a6dc>оплатить заказ</b> после печати.</p><div class="stage" aria-hidden="true" data-v-3e03a6dc><div class="printer" data-v-3e03a6dc><div class="led" data-v-3e03a6dc></div><div class="slot" data-v-3e03a6dc></div><div class="receipt" data-v-3e03a6dc><div class="tear" data-v-3e03a6dc></div><div class="line accent" data-v-3e03a6dc></div><div class="line" data-v-3e03a6dc></div><div class="line sm" data-v-3e03a6dc></div><div class="line" data-v-3e03a6dc></div><div class="line sm" data-v-3e03a6dc></div><div class="line" data-v-3e03a6dc></div><div class="line sm" data-v-3e03a6dc></div></div></div></div>',4))}const l1=Ue(s1,[["render",a1],["__scopeId","data-v-3e03a6dc"]]),c1={},u1={class:"center"};function d1(o,s){return l.openBlock(),l.createElementBlock("div",u1,[...s[0]||(s[0]=[l.createStaticVNode('<div class="stack" data-v-f0859fd1><h1 class="title_fiscal" data-v-f0859fd1>Приложите карту для оплаты</h1><p class="reminder" data-v-f0859fd1>Держите карту у терминала, пока операция не завершится.</p><div class="stageCard" aria-hidden="true" data-v-f0859fd1><div class="waves" data-v-f0859fd1><span data-v-f0859fd1></span><span data-v-f0859fd1></span><span data-v-f0859fd1></span></div><div class="nfc" data-v-f0859fd1><svg viewBox="0 0 24 24" data-v-f0859fd1><path d="M6 8c2.5 2.5 2.5 5.5 0 8" data-v-f0859fd1></path><path d="M10 6c4 4 4 8 0 12" data-v-f0859fd1></path><path d="M14 4c5.5 5.5 5.5 11 0 16" data-v-f0859fd1></path></svg></div><div class="card" data-v-f0859fd1><div class="logo" data-v-f0859fd1>inno.</div><div class="chip" data-v-f0859fd1></div><div class="digits" data-v-f0859fd1>4815 1623 4200 0900</div><div class="holder" data-v-f0859fd1>Гость</div></div></div></div>',1)])])}const f1=Ue(c1,[["render",d1],["__scopeId","data-v-f0859fd1"]]);/*!
|
|
1
|
+
(function(he,ke){typeof exports=="object"&&typeof module<"u"?ke(exports,require("vue-router"),require("pinia"),require("vue"),require("@vueuse/core"),require("motion-v")):typeof define=="function"&&define.amd?define(["exports","vue-router","pinia","vue","@vueuse/core","motion-v"],ke):(he=typeof globalThis<"u"?globalThis:he||self,ke(he.InnoCloudsLib={},he.VueRouter,he.Pinia,he.Vue,he.VueuseCore,he.motionV))})(this,function(he,ke,we,l,zt,yt){"use strict";var Pg=Object.defineProperty;var Qa=he=>{throw TypeError(he)};var Lg=(he,ke,we)=>ke in he?Pg(he,ke,{enumerable:!0,configurable:!0,writable:!0,value:we}):he[ke]=we;var We=(he,ke,we)=>Lg(he,typeof ke!="symbol"?ke+"":ke,we),Ja=(he,ke,we)=>ke.has(he)||Qa("Cannot "+we);var gn=(he,ke,we)=>(Ja(he,ke,"read from private field"),we?we.call(he):ke.get(he)),Bi=(he,ke,we)=>ke.has(he)?Qa("Cannot add the same private member more than once"):ke instanceof WeakSet?ke.add(he):ke.set(he,we),Bn=(he,ke,we,l)=>(Ja(he,ke,"write to private field"),l?l.call(he,we):ke.set(he,we),we);var zo=(he,ke,we,l)=>({set _(zt){Bn(he,ke,zt,we)},get _(){return gn(he,ke,l)}});var Zt,zn,tr;function tl(o,s){for(var i=0;i<s.length;i++){const u=s[i];if(typeof u!="string"&&!Array.isArray(u)){for(const f in u)if(f!=="default"&&!(f in o)){const h=Object.getOwnPropertyDescriptor(u,f);h&&Object.defineProperty(o,f,h.get?h:{enumerable:!0,get:()=>u[f]})}}}return Object.freeze(Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}))}function nl(o){return o}const rl=[];function il(){return ke.createRouter({history:ke.createWebHistory(),routes:rl})}const vi=(o,s)=>s.some(i=>o instanceof i);let Ho,Go;function ol(){return Ho||(Ho=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function sl(){return Go||(Go=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Di=new WeakMap,Pi=new WeakMap,Qr=new WeakMap;function al(o){const s=new Promise((i,u)=>{const f=()=>{o.removeEventListener("success",h),o.removeEventListener("error",m)},h=()=>{i(Vn(o.result)),f()},m=()=>{u(o.error),f()};o.addEventListener("success",h),o.addEventListener("error",m)});return Qr.set(s,o),s}function ll(o){if(Di.has(o))return;const s=new Promise((i,u)=>{const f=()=>{o.removeEventListener("complete",h),o.removeEventListener("error",m),o.removeEventListener("abort",m)},h=()=>{i(),f()},m=()=>{u(o.error||new DOMException("AbortError","AbortError")),f()};o.addEventListener("complete",h),o.addEventListener("error",m),o.addEventListener("abort",m)});Di.set(o,s)}let Li={get(o,s,i){if(o instanceof IDBTransaction){if(s==="done")return Di.get(o);if(s==="store")return i.objectStoreNames[1]?void 0:i.objectStore(i.objectStoreNames[0])}return Vn(o[s])},set(o,s,i){return o[s]=i,!0},has(o,s){return o instanceof IDBTransaction&&(s==="done"||s==="store")?!0:s in o}};function Wo(o){Li=o(Li)}function cl(o){return sl().includes(o)?function(...s){return o.apply(Fi(this),s),Vn(this.request)}:function(...s){return Vn(o.apply(Fi(this),s))}}function ul(o){return typeof o=="function"?cl(o):(o instanceof IDBTransaction&&ll(o),vi(o,ol())?new Proxy(o,Li):o)}function Vn(o){if(o instanceof IDBRequest)return al(o);if(Pi.has(o))return Pi.get(o);const s=ul(o);return s!==o&&(Pi.set(o,s),Qr.set(s,o)),s}const Fi=o=>Qr.get(o);function dl(o,s,{blocked:i,upgrade:u,blocking:f,terminated:h}={}){const m=indexedDB.open(o,s),x=Vn(m);return u&&m.addEventListener("upgradeneeded",_=>{u(Vn(m.result),_.oldVersion,_.newVersion,Vn(m.transaction),_)}),i&&m.addEventListener("blocked",_=>i(_.oldVersion,_.newVersion,_)),x.then(_=>{h&&_.addEventListener("close",()=>h()),f&&_.addEventListener("versionchange",p=>f(p.oldVersion,p.newVersion,p))}).catch(()=>{}),x}function fl(o,{blocked:s}={}){const i=indexedDB.deleteDatabase(o);return s&&i.addEventListener("blocked",u=>s(u.oldVersion,u)),Vn(i).then(()=>{})}const hl=["get","getKey","getAll","getAllKeys","count"],gl=["put","add","delete","clear"],Vi=new Map;function Xo(o,s){if(!(o instanceof IDBDatabase&&!(s in o)&&typeof s=="string"))return;if(Vi.get(s))return Vi.get(s);const i=s.replace(/FromIndex$/,""),u=s!==i,f=gl.includes(i);if(!(i in(u?IDBIndex:IDBObjectStore).prototype)||!(f||hl.includes(i)))return;const h=async function(m,...x){const _=this.transaction(m,f?"readwrite":"readonly");let p=_.store;return u&&(p=p.index(x.shift())),(await Promise.all([p[i](...x),f&&_.done]))[0]};return Vi.set(s,h),h}Wo(o=>({...o,get:(s,i,u)=>Xo(s,i)||o.get(s,i,u),has:(s,i)=>!!Xo(s,i)||o.has(s,i)}));const ml=["continue","continuePrimaryKey","advance"],jo={},Ui=new WeakMap,qo=new WeakMap,pl={get(o,s){if(!ml.includes(s))return o[s];let i=jo[s];return i||(i=jo[s]=function(...u){Ui.set(this,qo.get(this)[s](...u))}),i}};async function*xl(...o){let s=this;if(s instanceof IDBCursor||(s=await s.openCursor(...o)),!s)return;s=s;const i=new Proxy(s,pl);for(qo.set(i,s),Qr.set(i,Fi(s));s;)yield i,s=await(Ui.get(i)||s.continue()),Ui.delete(i)}function Zo(o,s){return s===Symbol.asyncIterator&&vi(o,[IDBIndex,IDBObjectStore,IDBCursor])||s==="iterate"&&vi(o,[IDBIndex,IDBObjectStore])}Wo(o=>({...o,get(s,i,u){return Zo(s,i)?xl:o.get(s,i,u)},has(s,i){return Zo(s,i)||o.has(s,i)}}));let lr;async function Yn(){return lr||(lr=dl("data",1,{upgrade(o){o.objectStoreNames.contains("groups")||o.createObjectStore("groups",{keyPath:"id"}),o.objectStoreNames.contains("media")||o.createObjectStore("media",{keyPath:"id"}),o.objectStoreNames.contains("products")||o.createObjectStore("products",{keyPath:"id"})}})),lr}async function zi(o){return(await Yn()).transaction("groups","readonly").objectStore("groups").get(o)}async function Rr(o,s){const u=(await Yn()).transaction("groups","readwrite");await u.objectStore("groups").put({id:o,data:s,timestamp:Date.now()}),await u.done}async function wl(o,s){const i=JSON.parse(JSON.stringify(l.toRaw(s.value)));await Rr(o,i)}async function Hi(o,s){const u=(await Yn()).transaction("media","readwrite");await u.objectStore("media").put({id:o,blob:s,timestamp:Date.now()}),await u.done}async function cr(o){const f=await(await Yn()).transaction("media","readonly").objectStore("media").get(o);return f==null?void 0:f.blob}async function _l(o){const i=(await Yn()).transaction("products","readwrite"),u=i.objectStore("products"),f=o.id;await u.put({id:f,product:o,timestamp:Date.now()}),await i.done}async function Yo(o){const f=await(await Yn()).transaction("products","readonly").objectStore("products").get(o);return f==null?void 0:f.product}async function Cl(){if(lr){const o=await lr.catch(()=>null);o&&o.close(),lr=void 0}try{await fl("data",{blocked(){console.warn("Удаление заблокировано. открыты другие вкладки с сайтом.")}})}catch(o){console.error("Не удалось удалить базу: [lib, indexedDB]",o)}}function Jr(o){"@babel/helpers - typeof";return Jr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},Jr(o)}var El=/^\s+/,yl=/\s+$/;function be(o,s){if(o=o||"",s=s||{},o instanceof be)return o;if(!(this instanceof be))return new be(o,s);var i=bl(o);this._originalInput=o,this._r=i.r,this._g=i.g,this._b=i.b,this._a=i.a,this._roundA=Math.round(100*this._a)/100,this._format=s.format||i.format,this._gradientType=s.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=i.ok}be.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var s=this.toRgb();return(s.r*299+s.g*587+s.b*114)/1e3},getLuminance:function(){var s=this.toRgb(),i,u,f,h,m,x;return i=s.r/255,u=s.g/255,f=s.b/255,i<=.03928?h=i/12.92:h=Math.pow((i+.055)/1.055,2.4),u<=.03928?m=u/12.92:m=Math.pow((u+.055)/1.055,2.4),f<=.03928?x=f/12.92:x=Math.pow((f+.055)/1.055,2.4),.2126*h+.7152*m+.0722*x},setAlpha:function(s){return this._a=ts(s),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var s=Ko(this._r,this._g,this._b);return{h:s.h*360,s:s.s,v:s.v,a:this._a}},toHsvString:function(){var s=Ko(this._r,this._g,this._b),i=Math.round(s.h*360),u=Math.round(s.s*100),f=Math.round(s.v*100);return this._a==1?"hsv("+i+", "+u+"%, "+f+"%)":"hsva("+i+", "+u+"%, "+f+"%, "+this._roundA+")"},toHsl:function(){var s=$o(this._r,this._g,this._b);return{h:s.h*360,s:s.s,l:s.l,a:this._a}},toHslString:function(){var s=$o(this._r,this._g,this._b),i=Math.round(s.h*360),u=Math.round(s.s*100),f=Math.round(s.l*100);return this._a==1?"hsl("+i+", "+u+"%, "+f+"%)":"hsla("+i+", "+u+"%, "+f+"%, "+this._roundA+")"},toHex:function(s){return Qo(this._r,this._g,this._b,s)},toHexString:function(s){return"#"+this.toHex(s)},toHex8:function(s){return Nl(this._r,this._g,this._b,this._a,s)},toHex8String:function(s){return"#"+this.toHex8(s)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(ft(this._r,255)*100)+"%",g:Math.round(ft(this._g,255)*100)+"%",b:Math.round(ft(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(ft(this._r,255)*100)+"%, "+Math.round(ft(this._g,255)*100)+"%, "+Math.round(ft(this._b,255)*100)+"%)":"rgba("+Math.round(ft(this._r,255)*100)+"%, "+Math.round(ft(this._g,255)*100)+"%, "+Math.round(ft(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:Vl[Qo(this._r,this._g,this._b,!0)]||!1},toFilter:function(s){var i="#"+Jo(this._r,this._g,this._b,this._a),u=i,f=this._gradientType?"GradientType = 1, ":"";if(s){var h=be(s);u="#"+Jo(h._r,h._g,h._b,h._a)}return"progid:DXImageTransform.Microsoft.gradient("+f+"startColorstr="+i+",endColorstr="+u+")"},toString:function(s){var i=!!s;s=s||this._format;var u=!1,f=this._a<1&&this._a>=0,h=!i&&f&&(s==="hex"||s==="hex6"||s==="hex3"||s==="hex4"||s==="hex8"||s==="name");return h?s==="name"&&this._a===0?this.toName():this.toRgbString():(s==="rgb"&&(u=this.toRgbString()),s==="prgb"&&(u=this.toPercentageRgbString()),(s==="hex"||s==="hex6")&&(u=this.toHexString()),s==="hex3"&&(u=this.toHexString(!0)),s==="hex4"&&(u=this.toHex8String(!0)),s==="hex8"&&(u=this.toHex8String()),s==="name"&&(u=this.toName()),s==="hsl"&&(u=this.toHslString()),s==="hsv"&&(u=this.toHsvString()),u||this.toHexString())},clone:function(){return be(this.toString())},_applyModification:function(s,i){var u=s.apply(null,[this].concat([].slice.call(i)));return this._r=u._r,this._g=u._g,this._b=u._b,this.setAlpha(u._a),this},lighten:function(){return this._applyModification(Ol,arguments)},brighten:function(){return this._applyModification(Ml,arguments)},darken:function(){return this._applyModification(Bl,arguments)},desaturate:function(){return this._applyModification(Tl,arguments)},saturate:function(){return this._applyModification(kl,arguments)},greyscale:function(){return this._applyModification(Rl,arguments)},spin:function(){return this._applyModification(vl,arguments)},_applyCombination:function(s,i){return s.apply(null,[this].concat([].slice.call(i)))},analogous:function(){return this._applyCombination(Ll,arguments)},complement:function(){return this._applyCombination(Dl,arguments)},monochromatic:function(){return this._applyCombination(Fl,arguments)},splitcomplement:function(){return this._applyCombination(Pl,arguments)},triad:function(){return this._applyCombination(es,[3])},tetrad:function(){return this._applyCombination(es,[4])}},be.fromRatio=function(o,s){if(Jr(o)=="object"){var i={};for(var u in o)o.hasOwnProperty(u)&&(u==="a"?i[u]=o[u]:i[u]=Or(o[u]));o=i}return be(o,s)};function bl(o){var s={r:0,g:0,b:0},i=1,u=null,f=null,h=null,m=!1,x=!1;return typeof o=="string"&&(o=Gl(o)),Jr(o)=="object"&&(vn(o.r)&&vn(o.g)&&vn(o.b)?(s=Al(o.r,o.g,o.b),m=!0,x=String(o.r).substr(-1)==="%"?"prgb":"rgb"):vn(o.h)&&vn(o.s)&&vn(o.v)?(u=Or(o.s),f=Or(o.v),s=Sl(o.h,u,f),m=!0,x="hsv"):vn(o.h)&&vn(o.s)&&vn(o.l)&&(u=Or(o.s),h=Or(o.l),s=Il(o.h,u,h),m=!0,x="hsl"),o.hasOwnProperty("a")&&(i=o.a)),i=ts(i),{ok:m,format:o.format||x,r:Math.min(255,Math.max(s.r,0)),g:Math.min(255,Math.max(s.g,0)),b:Math.min(255,Math.max(s.b,0)),a:i}}function Al(o,s,i){return{r:ft(o,255)*255,g:ft(s,255)*255,b:ft(i,255)*255}}function $o(o,s,i){o=ft(o,255),s=ft(s,255),i=ft(i,255);var u=Math.max(o,s,i),f=Math.min(o,s,i),h,m,x=(u+f)/2;if(u==f)h=m=0;else{var _=u-f;switch(m=x>.5?_/(2-u-f):_/(u+f),u){case o:h=(s-i)/_+(s<i?6:0);break;case s:h=(i-o)/_+2;break;case i:h=(o-s)/_+4;break}h/=6}return{h,s:m,l:x}}function Il(o,s,i){var u,f,h;o=ft(o,360),s=ft(s,100),i=ft(i,100);function m(p,C,y){return y<0&&(y+=1),y>1&&(y-=1),y<1/6?p+(C-p)*6*y:y<1/2?C:y<2/3?p+(C-p)*(2/3-y)*6:p}if(s===0)u=f=h=i;else{var x=i<.5?i*(1+s):i+s-i*s,_=2*i-x;u=m(_,x,o+1/3),f=m(_,x,o),h=m(_,x,o-1/3)}return{r:u*255,g:f*255,b:h*255}}function Ko(o,s,i){o=ft(o,255),s=ft(s,255),i=ft(i,255);var u=Math.max(o,s,i),f=Math.min(o,s,i),h,m,x=u,_=u-f;if(m=u===0?0:_/u,u==f)h=0;else{switch(u){case o:h=(s-i)/_+(s<i?6:0);break;case s:h=(i-o)/_+2;break;case i:h=(o-s)/_+4;break}h/=6}return{h,s:m,v:x}}function Sl(o,s,i){o=ft(o,360)*6,s=ft(s,100),i=ft(i,100);var u=Math.floor(o),f=o-u,h=i*(1-s),m=i*(1-f*s),x=i*(1-(1-f)*s),_=u%6,p=[i,m,h,h,x,i][_],C=[x,i,i,m,h,h][_],y=[h,h,x,i,i,m][_];return{r:p*255,g:C*255,b:y*255}}function Qo(o,s,i,u){var f=[mn(Math.round(o).toString(16)),mn(Math.round(s).toString(16)),mn(Math.round(i).toString(16))];return u&&f[0].charAt(0)==f[0].charAt(1)&&f[1].charAt(0)==f[1].charAt(1)&&f[2].charAt(0)==f[2].charAt(1)?f[0].charAt(0)+f[1].charAt(0)+f[2].charAt(0):f.join("")}function Nl(o,s,i,u,f){var h=[mn(Math.round(o).toString(16)),mn(Math.round(s).toString(16)),mn(Math.round(i).toString(16)),mn(ns(u))];return f&&h[0].charAt(0)==h[0].charAt(1)&&h[1].charAt(0)==h[1].charAt(1)&&h[2].charAt(0)==h[2].charAt(1)&&h[3].charAt(0)==h[3].charAt(1)?h[0].charAt(0)+h[1].charAt(0)+h[2].charAt(0)+h[3].charAt(0):h.join("")}function Jo(o,s,i,u){var f=[mn(ns(u)),mn(Math.round(o).toString(16)),mn(Math.round(s).toString(16)),mn(Math.round(i).toString(16))];return f.join("")}be.equals=function(o,s){return!o||!s?!1:be(o).toRgbString()==be(s).toRgbString()},be.random=function(){return be.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function Tl(o,s){s=s===0?0:s||10;var i=be(o).toHsl();return i.s-=s/100,i.s=ei(i.s),be(i)}function kl(o,s){s=s===0?0:s||10;var i=be(o).toHsl();return i.s+=s/100,i.s=ei(i.s),be(i)}function Rl(o){return be(o).desaturate(100)}function Ol(o,s){s=s===0?0:s||10;var i=be(o).toHsl();return i.l+=s/100,i.l=ei(i.l),be(i)}function Ml(o,s){s=s===0?0:s||10;var i=be(o).toRgb();return i.r=Math.max(0,Math.min(255,i.r-Math.round(255*-(s/100)))),i.g=Math.max(0,Math.min(255,i.g-Math.round(255*-(s/100)))),i.b=Math.max(0,Math.min(255,i.b-Math.round(255*-(s/100)))),be(i)}function Bl(o,s){s=s===0?0:s||10;var i=be(o).toHsl();return i.l-=s/100,i.l=ei(i.l),be(i)}function vl(o,s){var i=be(o).toHsl(),u=(i.h+s)%360;return i.h=u<0?360+u:u,be(i)}function Dl(o){var s=be(o).toHsl();return s.h=(s.h+180)%360,be(s)}function es(o,s){if(isNaN(s)||s<=0)throw new Error("Argument to polyad must be a positive number");for(var i=be(o).toHsl(),u=[be(o)],f=360/s,h=1;h<s;h++)u.push(be({h:(i.h+h*f)%360,s:i.s,l:i.l}));return u}function Pl(o){var s=be(o).toHsl(),i=s.h;return[be(o),be({h:(i+72)%360,s:s.s,l:s.l}),be({h:(i+216)%360,s:s.s,l:s.l})]}function Ll(o,s,i){s=s||6,i=i||30;var u=be(o).toHsl(),f=360/i,h=[be(o)];for(u.h=(u.h-(f*s>>1)+720)%360;--s;)u.h=(u.h+f)%360,h.push(be(u));return h}function Fl(o,s){s=s||6;for(var i=be(o).toHsv(),u=i.h,f=i.s,h=i.v,m=[],x=1/s;s--;)m.push(be({h:u,s:f,v:h})),h=(h+x)%1;return m}be.mix=function(o,s,i){i=i===0?0:i||50;var u=be(o).toRgb(),f=be(s).toRgb(),h=i/100,m={r:(f.r-u.r)*h+u.r,g:(f.g-u.g)*h+u.g,b:(f.b-u.b)*h+u.b,a:(f.a-u.a)*h+u.a};return be(m)},be.readability=function(o,s){var i=be(o),u=be(s);return(Math.max(i.getLuminance(),u.getLuminance())+.05)/(Math.min(i.getLuminance(),u.getLuminance())+.05)},be.isReadable=function(o,s,i){var u=be.readability(o,s),f,h;switch(h=!1,f=Wl(i),f.level+f.size){case"AAsmall":case"AAAlarge":h=u>=4.5;break;case"AAlarge":h=u>=3;break;case"AAAsmall":h=u>=7;break}return h},be.mostReadable=function(o,s,i){var u=null,f=0,h,m,x,_;i=i||{},m=i.includeFallbackColors,x=i.level,_=i.size;for(var p=0;p<s.length;p++)h=be.readability(o,s[p]),h>f&&(f=h,u=be(s[p]));return be.isReadable(o,u,{level:x,size:_})||!m?u:(i.includeFallbackColors=!1,be.mostReadable(o,["#fff","#000"],i))};var Gi=be.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Vl=be.hexNames=Ul(Gi);function Ul(o){var s={};for(var i in o)o.hasOwnProperty(i)&&(s[o[i]]=i);return s}function ts(o){return o=parseFloat(o),(isNaN(o)||o<0||o>1)&&(o=1),o}function ft(o,s){zl(o)&&(o="100%");var i=Hl(o);return o=Math.min(s,Math.max(0,parseFloat(o))),i&&(o=parseInt(o*s,10)/100),Math.abs(o-s)<1e-6?1:o%s/parseFloat(s)}function ei(o){return Math.min(1,Math.max(0,o))}function nn(o){return parseInt(o,16)}function zl(o){return typeof o=="string"&&o.indexOf(".")!=-1&&parseFloat(o)===1}function Hl(o){return typeof o=="string"&&o.indexOf("%")!=-1}function mn(o){return o.length==1?"0"+o:""+o}function Or(o){return o<=1&&(o=o*100+"%"),o}function ns(o){return Math.round(parseFloat(o)*255).toString(16)}function rs(o){return nn(o)/255}var pn=function(){var o="[-\\+]?\\d+%?",s="[-\\+]?\\d*\\.\\d+%?",i="(?:"+s+")|(?:"+o+")",u="[\\s|\\(]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")\\s*\\)?",f="[\\s|\\(]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")\\s*\\)?";return{CSS_UNIT:new RegExp(i),rgb:new RegExp("rgb"+u),rgba:new RegExp("rgba"+f),hsl:new RegExp("hsl"+u),hsla:new RegExp("hsla"+f),hsv:new RegExp("hsv"+u),hsva:new RegExp("hsva"+f),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function vn(o){return!!pn.CSS_UNIT.exec(o)}function Gl(o){o=o.replace(El,"").replace(yl,"").toLowerCase();var s=!1;if(Gi[o])o=Gi[o],s=!0;else if(o=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var i;return(i=pn.rgb.exec(o))?{r:i[1],g:i[2],b:i[3]}:(i=pn.rgba.exec(o))?{r:i[1],g:i[2],b:i[3],a:i[4]}:(i=pn.hsl.exec(o))?{h:i[1],s:i[2],l:i[3]}:(i=pn.hsla.exec(o))?{h:i[1],s:i[2],l:i[3],a:i[4]}:(i=pn.hsv.exec(o))?{h:i[1],s:i[2],v:i[3]}:(i=pn.hsva.exec(o))?{h:i[1],s:i[2],v:i[3],a:i[4]}:(i=pn.hex8.exec(o))?{r:nn(i[1]),g:nn(i[2]),b:nn(i[3]),a:rs(i[4]),format:s?"name":"hex8"}:(i=pn.hex6.exec(o))?{r:nn(i[1]),g:nn(i[2]),b:nn(i[3]),format:s?"name":"hex"}:(i=pn.hex4.exec(o))?{r:nn(i[1]+""+i[1]),g:nn(i[2]+""+i[2]),b:nn(i[3]+""+i[3]),a:rs(i[4]+""+i[4]),format:s?"name":"hex8"}:(i=pn.hex3.exec(o))?{r:nn(i[1]+""+i[1]),g:nn(i[2]+""+i[2]),b:nn(i[3]+""+i[3]),format:s?"name":"hex"}:!1}function Wl(o){var s,i;return o=o||{level:"AA",size:"small"},s=(o.level||"AA").toUpperCase(),i=(o.size||"small").toLowerCase(),s!=="AA"&&s!=="AAA"&&(s="AA"),i!=="small"&&i!=="large"&&(i="small"),{level:s,size:i}}const ti=we.defineStore("imageCache",()=>{const o=l.ref({});let s=!1;function i(_,p){const C=String(_);o.value[C]&&URL.revokeObjectURL(o.value[C]);const y=URL.createObjectURL(p);o.value[C]=y}async function u(_){if(!_){console.warn("initCacheSingle called with null/undefined id");return}const p=String(_);if(o.value[p])return;const C=await cr(p);C&&(await scheduler.yield(),i(p,C),window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:p,blob:C}})))}function f(_){const{id:p,blob:C}=_.detail;p&&C&&i(p,C)}function h(){typeof window>"u"||s||(window.addEventListener("image-cached",f),s=!0)}function m(){typeof window>"u"||!s||(window.removeEventListener("image-cached",f),s=!1)}function x(){Object.values(o.value).forEach(URL.revokeObjectURL),o.value={}}return typeof window<"u"&&h(),{cache:o,initCacheSingle:u,updateCacheFromBlob:i,cleanup:x,setupEventListener:h,removeEventListener:m}}),bt=we.defineStore("themeLib",()=>{const o=ti(),{initCacheSingle:s}=o,i=l.ref({id:"",created_at:null,logo:null,primary_color:null,accent_color:null,accent_light_color:null,accent_dark_color:null,bg_button_color:null,bonuses_button_name:void 0,qr_bypass_guest_auth:null,kiosk_bypass_guest_auth:null,kiosk_disable_lock_screen:null,inactive_button_color:null,cards_color:null,text_color:null,nonworking_bg_color:null,retail_mode:null,splash_image_url:null,splash_video:null,splash_duration:0,splash_type:null,fallback_image:null,adult_disclaimer_text:null,adult_disclaimer_image:null,kiosk_enable_wheel:null,kiosk_banner:null,kiosk_preloader:null,organization:"",kiosk_qr_payment_timeout:null,gradientStyle:null,kiosk_inactivity_timeout:null,kiosk_show_loyalty_card_button:null,kiosk_show_loyalty_phone_input_button:null,cart_loyalty_button:{cart_loyalty_button_sticker:null,cart_loyalty_button_text:null},comments:null,show_nutrition_in_cart:null,apply_custom_size_picker_fonts:null,size_picker_unselected_font_size:null,size_picker_selected_font_size:null,pdf_return_url:null,kiosk_hide_manual_input_loyalty_card:null,kiosk_camera_scan_loyalty_card:null,kiosk_hide_menu_update_notification:null}),u=async h=>{if(!h)return;i.value={...h};const m=await cr("banner"),x=await cr("preloader"),_=await cr("defaultImage");m||f(h.kiosk_banner,"banner"),x||f(h.kiosk_preloader,"preloader"),_||f(h.fallback_image,"defaultImage"),document.documentElement.style.setProperty("--primaryColor",h.primary_color),document.documentElement.style.setProperty("--accentColor",h.accent_color),document.documentElement.style.setProperty("--accentLightColor",h.accent_light_color),document.documentElement.style.setProperty("--accentDarkColor",h.accent_dark_color),document.documentElement.style.setProperty("--bgButtonColor",h.bg_button_color),document.documentElement.style.setProperty("--inactiveButtonColor",h.inactive_button_color),document.documentElement.style.setProperty("--cardsColor",h.cards_color),document.documentElement.style.setProperty("--textColor",h.text_color),document.documentElement.style.setProperty("--nonworkingBgColor",h.nonworking_bg_color),h.apply_custom_size_picker_fonts&&h.size_picker_unselected_font_size&&h.size_picker_unselected_font_size>0&&document.documentElement.style.setProperty("--sizePickerUnselectedFontSize",`${h.size_picker_unselected_font_size}rem`),h.apply_custom_size_picker_fonts&&h.size_picker_selected_font_size&&h.size_picker_selected_font_size>0&&document.documentElement.style.setProperty("--sizePickerSelectedFontSize",`${h.size_picker_selected_font_size}rem`);const p=i.value.primary_color||"#F2F7FF",C=be(p).setAlpha(.7).toRgbString(),y=`linear-gradient(to bottom, transparent 10%, ${C} 50%, ${p} 85%)`,S=`-webkit-linear-gradient(to bottom, transparent 10%, ${C} 50%, ${p} 85%)`;return i.value.gradientStyle={background:y,backgroundColor:S},i.value},f=async(h,m)=>{if(h){const x=await fetch(h);if(!x.ok)throw new Error("Network error");const _=await x.blob();Hi(m,_),s(m)}};return{itemThemes:i,updateColor:u}}),ur=o=>{if(!o)return 0;if((o.price===0||o.price===null)&&o.sizes&&o.sizes.length>0){const s=o.sizes.find(i=>i.is_default===!0);return s?s.price:o.sizes.length>1?o.sizes[1].price??o.sizes[0].price:o.sizes[0].price}return o.price};class Mr extends Error{}Mr.prototype.name="InvalidTokenError";function Xl(o){return decodeURIComponent(atob(o).replace(/(.)/g,(s,i)=>{let u=i.charCodeAt(0).toString(16).toUpperCase();return u.length<2&&(u="0"+u),"%"+u}))}function jl(o){let s=o.replace(/-/g,"+").replace(/_/g,"/");switch(s.length%4){case 0:break;case 2:s+="==";break;case 3:s+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return Xl(s)}catch{return atob(s)}}function is(o,s){if(typeof o!="string")throw new Mr("Invalid token specified: must be a string");s||(s={});const i=s.header===!0?0:1,u=o.split(".")[i];if(typeof u!="string")throw new Mr(`Invalid token specified: missing part #${i+1}`);let f;try{f=jl(u)}catch(h){throw new Mr(`Invalid token specified: invalid base64 for part #${i+1} (${h.message})`)}try{return JSON.parse(f)}catch(h){throw new Mr(`Invalid token specified: invalid json for part #${i+1} (${h.message})`)}}const ql=(o,s)=>{if(typeof window<"u"){const i=localStorage.getItem(o);return i?JSON.parse(i):s}return s},Zl=(o,s)=>{if(typeof window<"u"){const i=localStorage.getItem(o);if(i)try{return is(JSON.parse(i))}catch(u){return console.error("Failed to decode JWT:",u),s}}return s},os=(o,s,i="normal")=>{const u=l.ref(i==="jwt"?Zl(o,s):ql(o,s));return l.watchEffect(()=>{u.value===null||u.value===void 0?localStorage.removeItem(o):i!=="jwt"&&localStorage.setItem(o,JSON.stringify(u.value))}),u},dr=o=>{o.forEach(s=>{try{localStorage.removeItem(s)}catch(i){console.error(`Ошибка при удалении ключа "${s}":`,i)}})};class Yl{constructor(s,i={}){We(this,"url");We(this,"options");We(this,"ws");We(this,"reconnectInterval");We(this,"listeners");We(this,"isConnected");We(this,"heartbeat");We(this,"heartbeatTimeout");We(this,"pingTimeout");We(this,"pingResponseTimeout");We(this,"signal");We(this,"_shouldReconnect",!0);this.url=s,this.options=i,this.ws=null,this.reconnectInterval=5e3,this.pingResponseTimeout=5e3,this.listeners=new Map,this.isConnected=l.ref(!1),this.heartbeatTimeout=i.heartbeatTimeout||3e5}connect(){var i,u;if(this.ws&&this.ws.readyState===WebSocket.OPEN){console.warn("WebSocket already open");return}if(!this._shouldReconnect){console.warn("Reconnection disabled");return}const s=`${this.url}`;this.ws=new WebSocket(s),(i=this.options.signal)!=null&&i.aborted&&this.ws.close(),(u=this.options.signal)==null||u.addEventListener("abort",()=>this.close()),this.ws.onopen=()=>{console.warn("WebSocket connected"),this.isConnected.value=!0,this.emit("open"),this.heartbeat=setInterval(()=>this.sendPing(),this.heartbeatTimeout)},this.ws.onmessage=f=>{try{const h=JSON.parse(f.data);this.emit("message",h),h!=null&&h.type&&h.type!=="ping"&&clearTimeout(this.pingTimeout)}catch(h){console.error("Error parsing WebSocket message:",h)}},this.ws.onerror=f=>{console.error("WebSocket error:",f),this.emit("error",f),this.close(!0)},this.ws.onclose=()=>{this.isConnected.value=!1,console.warn("WebSocket closed"),this.emit("close"),clearInterval(this.heartbeat),clearTimeout(this.pingTimeout),this._shouldReconnect&&(console.log(`Reconnecting in ${this.reconnectInterval}ms...`),setTimeout(()=>this.connect(),this.reconnectInterval))}}sendPing(){var s;this.isConnected.value&&((s=this.ws)==null?void 0:s.readyState)===WebSocket.OPEN?(this.ws.send(JSON.stringify({type:"ping"})),this.pingTimeout=setTimeout(()=>{console.warn("No pong received, reconnecting..."),this.close(!0),this.connect()},this.pingResponseTimeout)):console.warn("WebSocket not connected, cannot send ping")}send(s){var i;this.isConnected.value&&((i=this.ws)==null?void 0:i.readyState)===WebSocket.OPEN?this.ws.send(JSON.stringify(s)):console.warn("WebSocket not connected")}close(s=!1){this.ws&&(this._shouldReconnect=!s,this.ws.close(),clearInterval(this.heartbeat),clearTimeout(this.pingTimeout),this.ws=null,this.listeners.clear())}on(s,i){this.listeners.has(s)||this.listeners.set(s,[]),this.listeners.get(s).push(i)}off(s,i){const u=this.listeners.get(s);u&&this.listeners.set(s,u.filter(f=>f!==i))}emit(s,i=null){const u=this.listeners.get(s);u&&u.forEach(f=>f(i))}getConnectionStatus(){return this.isConnected}}let ni=new Map;function ri(o,s={}){var u;if(ni.has(o)){const f=ni.get(o);if(f.isConnected.value&&((u=f.ws)==null?void 0:u.readyState)===WebSocket.OPEN)return f.listeners.clear(),f;f.close(!0),ni.delete(o)}const i=new Yl(o,s);return ni.set(o,i),i}const at=we.defineStore("mainLib",()=>{const o=l.ref(),s=l.ref(!1),i=l.ref(localStorage.getItem("kiosk_timeout")),u=l.ref(0),f=l.ref(!1),h=l.ref(sessionStorage.getItem("is_adult")==="true"),m=l.ref([]),x=l.ref([]),_=l.ref(!1),p=l.ref(),C=l.ref(""),y=l.ref(0),S=l.ref(!1),B=l.ref(!1),T=l.ref(!0),D=l.ref(!localStorage.getItem("apiKey")),v=l.ref(!1),U=l.ref({textNotification:""}),P=l.ref([]);let O=null;const M=Z=>{const re=`wss://${p.value.area}/ws/device/${Z}/`;O=ri(re);function ge(){console.log("WebSocket connection opened")}function me(_e){if(_e.error)v.value=!0,U.value.textNotification=_e.error,O==null||O.close(!0);else{if(!(_e!=null&&_e.params))return;typeof _e.params.components.shift.is_ok!==null?T.value=_e.params.components.shift.is_ok:T.value=!0}}function Ie(_e){console.error("WebSocket error:",_e),O.close(!0)}O.on("open",ge),O.on("message",me),O.on("error",Ie),O.connect()},K=Z=>{u.value=Z,localStorage.setItem("kiosk_timeout",Z)},Q=Z=>{s.value=Z},W=l.ref(null),oe=l.computed(()=>m.value.reduce((Z,re)=>{let ge=0,me=0;return re.group_modifiers&&(ge=re.group_modifiers.reduce((Ie,_e)=>_e.modifiers?Ie+_e.modifiers.reduce((Fe,xe)=>Fe+xe.old_price*xe.amount,0):0,0)*re.amount),re.modifiers&&(me=re.modifiers.reduce((Ie,_e)=>Ie+_e.old_price*_e.amount,0)*re.amount),Z+re.old_price*re.amount+ge+me},0)),V=l.computed({get:()=>m.value.length===0||W.value===0?0:W.value&&W.value!==0?W.value:m.value.reduce((Z,re)=>{const ge=ur(re)*re.amount;let me=0,Ie=0;return re.group_modifiers&&(me=re.group_modifiers.reduce((_e,Fe)=>Fe.modifiers?_e+Fe.modifiers.reduce((xe,lt)=>xe+lt.price*lt.amount,0):0,0)*re.amount),re.modifiers&&(Ie=re.modifiers.reduce((_e,Fe)=>_e+Fe.price*Fe.amount,0)*re.amount),Z+ge+me+Ie},0),set(Z){W.value=Z}}),ce=Z=>{y.value=Z,localStorage.removeItem("bonus"),os("bonus",y.value)},j=Z=>{dr(Z)},G=Z=>{Z={...Z,idSystem:crypto.randomUUID()};const re=X(Z);m.value.push(re),z()},z=()=>{try{if(!m.value||m.value.length===0){localStorage.removeItem("cart");return}localStorage.setItem("cart",JSON.stringify(l.toRaw(m.value)))}catch(Z){console.error("Failed to update cart in localStorage:",Z)}},X=Z=>l.reactive({...Z,amount:Z.amount??1,price:Z.old_price,new_price:null,total_new_price:null,discounts:[],modifiers:(Z.modifiers||[]).map(re=>l.reactive({...re,price:re.old_price,new_price:null,total_new_price:null})),group_modifiers:(Z.group_modifiers||[]).map(re=>l.reactive({...re,modifiers:(re.modifiers||[]).map(ge=>l.reactive({...ge,price:ge.old_price,new_price:null,total_new_price:null}))}))}),N=Z=>{const re=m.value.find(ge=>ge.idSystem===Z);re&&(re.amount+=1),z()},Y=Z=>{const re=m.value.find(ge=>ge.idSystem===Z);re&&(re.amount>=1&&(re.amount-=1),z())},H=()=>{try{const Z=localStorage.getItem("cart");if(Z){const re=JSON.parse(Z);m.value.splice(0,m.value.length,...re.map(X)),W.value=null}}catch(Z){console.error("Failed to load cart from localStorage:",Z)}};return H(),{cartProducts_lib:m,activeScrolling_lib:x,config_lib:p,totalPrice_lib:V,initialCartPrice_lib:oe,is_notification_lib:v,notificationData_lib:U,xApiKey_lib:C,countBonus:y,toggleDrum:s,is_showApiKey:D,openApiKey:S,kiosk_timeout:i,kiosk_FirstTimeout:u,is_OpenLoyal:B,profile:o,is_18_above_content:f,is18Allowed:h,healthState:T,displayCards:P,isOrderTypeSubmited:_,removeFromLocalStorage:j,setKioskTimeout:K,setBonus:ce,setStateDrum:Q,addToCart:G,plusAmount:N,minusAmount:Y,loadCart:H,deleteItemFromCart:Z=>{if(Z){const re=m.value.findIndex(ge=>ge.idSystem===Z);if(re===-1)return;m.value.splice(re,1),z(),W.value=null}else m.value=[],z()},updateCartInLocalStorage:z,makeProductFullyReactive:X,checkHeartbeatApp:M}});function ss(o,s){return function(){return o.apply(s,arguments)}}const{toString:$l}=Object.prototype,{getPrototypeOf:Wi}=Object,{iterator:ii,toStringTag:as}=Symbol,oi=(o=>s=>{const i=$l.call(s);return o[i]||(o[i]=i.slice(8,-1).toLowerCase())})(Object.create(null)),xn=o=>(o=o.toLowerCase(),s=>oi(s)===o),si=o=>s=>typeof s===o,{isArray:fr}=Array,hr=si("undefined");function Br(o){return o!==null&&!hr(o)&&o.constructor!==null&&!hr(o.constructor)&&Xt(o.constructor.isBuffer)&&o.constructor.isBuffer(o)}const ls=xn("ArrayBuffer");function Kl(o){let s;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?s=ArrayBuffer.isView(o):s=o&&o.buffer&&ls(o.buffer),s}const Ql=si("string"),Xt=si("function"),cs=si("number"),vr=o=>o!==null&&typeof o=="object",Jl=o=>o===!0||o===!1,ai=o=>{if(oi(o)!=="object")return!1;const s=Wi(o);return(s===null||s===Object.prototype||Object.getPrototypeOf(s)===null)&&!(as in o)&&!(ii in o)},ec=o=>{if(!vr(o)||Br(o))return!1;try{return Object.keys(o).length===0&&Object.getPrototypeOf(o)===Object.prototype}catch{return!1}},tc=xn("Date"),nc=xn("File"),rc=xn("Blob"),ic=xn("FileList"),oc=o=>vr(o)&&Xt(o.pipe),sc=o=>{let s;return o&&(typeof FormData=="function"&&o instanceof FormData||Xt(o.append)&&((s=oi(o))==="formdata"||s==="object"&&Xt(o.toString)&&o.toString()==="[object FormData]"))},ac=xn("URLSearchParams"),[lc,cc,uc,dc]=["ReadableStream","Request","Response","Headers"].map(xn),fc=o=>o.trim?o.trim():o.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Dr(o,s,{allOwnKeys:i=!1}={}){if(o===null||typeof o>"u")return;let u,f;if(typeof o!="object"&&(o=[o]),fr(o))for(u=0,f=o.length;u<f;u++)s.call(null,o[u],u,o);else{if(Br(o))return;const h=i?Object.getOwnPropertyNames(o):Object.keys(o),m=h.length;let x;for(u=0;u<m;u++)x=h[u],s.call(null,o[x],x,o)}}function us(o,s){if(Br(o))return null;s=s.toLowerCase();const i=Object.keys(o);let u=i.length,f;for(;u-- >0;)if(f=i[u],s===f.toLowerCase())return f;return null}const $n=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,ds=o=>!hr(o)&&o!==$n;function Xi(){const{caseless:o,skipUndefined:s}=ds(this)&&this||{},i={},u=(f,h)=>{const m=o&&us(i,h)||h;ai(i[m])&&ai(f)?i[m]=Xi(i[m],f):ai(f)?i[m]=Xi({},f):fr(f)?i[m]=f.slice():(!s||!hr(f))&&(i[m]=f)};for(let f=0,h=arguments.length;f<h;f++)arguments[f]&&Dr(arguments[f],u);return i}const hc=(o,s,i,{allOwnKeys:u}={})=>(Dr(s,(f,h)=>{i&&Xt(f)?o[h]=ss(f,i):o[h]=f},{allOwnKeys:u}),o),gc=o=>(o.charCodeAt(0)===65279&&(o=o.slice(1)),o),mc=(o,s,i,u)=>{o.prototype=Object.create(s.prototype,u),o.prototype.constructor=o,Object.defineProperty(o,"super",{value:s.prototype}),i&&Object.assign(o.prototype,i)},pc=(o,s,i,u)=>{let f,h,m;const x={};if(s=s||{},o==null)return s;do{for(f=Object.getOwnPropertyNames(o),h=f.length;h-- >0;)m=f[h],(!u||u(m,o,s))&&!x[m]&&(s[m]=o[m],x[m]=!0);o=i!==!1&&Wi(o)}while(o&&(!i||i(o,s))&&o!==Object.prototype);return s},xc=(o,s,i)=>{o=String(o),(i===void 0||i>o.length)&&(i=o.length),i-=s.length;const u=o.indexOf(s,i);return u!==-1&&u===i},wc=o=>{if(!o)return null;if(fr(o))return o;let s=o.length;if(!cs(s))return null;const i=new Array(s);for(;s-- >0;)i[s]=o[s];return i},_c=(o=>s=>o&&s instanceof o)(typeof Uint8Array<"u"&&Wi(Uint8Array)),Cc=(o,s)=>{const u=(o&&o[ii]).call(o);let f;for(;(f=u.next())&&!f.done;){const h=f.value;s.call(o,h[0],h[1])}},Ec=(o,s)=>{let i;const u=[];for(;(i=o.exec(s))!==null;)u.push(i);return u},yc=xn("HTMLFormElement"),bc=o=>o.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(i,u,f){return u.toUpperCase()+f}),fs=(({hasOwnProperty:o})=>(s,i)=>o.call(s,i))(Object.prototype),Ac=xn("RegExp"),hs=(o,s)=>{const i=Object.getOwnPropertyDescriptors(o),u={};Dr(i,(f,h)=>{let m;(m=s(f,h,o))!==!1&&(u[h]=m||f)}),Object.defineProperties(o,u)},Ic=o=>{hs(o,(s,i)=>{if(Xt(o)&&["arguments","caller","callee"].indexOf(i)!==-1)return!1;const u=o[i];if(Xt(u)){if(s.enumerable=!1,"writable"in s){s.writable=!1;return}s.set||(s.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")})}})},Sc=(o,s)=>{const i={},u=f=>{f.forEach(h=>{i[h]=!0})};return fr(o)?u(o):u(String(o).split(s)),i},Nc=()=>{},Tc=(o,s)=>o!=null&&Number.isFinite(o=+o)?o:s;function kc(o){return!!(o&&Xt(o.append)&&o[as]==="FormData"&&o[ii])}const Rc=o=>{const s=new Array(10),i=(u,f)=>{if(vr(u)){if(s.indexOf(u)>=0)return;if(Br(u))return u;if(!("toJSON"in u)){s[f]=u;const h=fr(u)?[]:{};return Dr(u,(m,x)=>{const _=i(m,f+1);!hr(_)&&(h[x]=_)}),s[f]=void 0,h}}return u};return i(o,0)},Oc=xn("AsyncFunction"),Mc=o=>o&&(vr(o)||Xt(o))&&Xt(o.then)&&Xt(o.catch),gs=((o,s)=>o?setImmediate:s?((i,u)=>($n.addEventListener("message",({source:f,data:h})=>{f===$n&&h===i&&u.length&&u.shift()()},!1),f=>{u.push(f),$n.postMessage(i,"*")}))(`axios@${Math.random()}`,[]):i=>setTimeout(i))(typeof setImmediate=="function",Xt($n.postMessage)),Bc=typeof queueMicrotask<"u"?queueMicrotask.bind($n):typeof process<"u"&&process.nextTick||gs,J={isArray:fr,isArrayBuffer:ls,isBuffer:Br,isFormData:sc,isArrayBufferView:Kl,isString:Ql,isNumber:cs,isBoolean:Jl,isObject:vr,isPlainObject:ai,isEmptyObject:ec,isReadableStream:lc,isRequest:cc,isResponse:uc,isHeaders:dc,isUndefined:hr,isDate:tc,isFile:nc,isBlob:rc,isRegExp:Ac,isFunction:Xt,isStream:oc,isURLSearchParams:ac,isTypedArray:_c,isFileList:ic,forEach:Dr,merge:Xi,extend:hc,trim:fc,stripBOM:gc,inherits:mc,toFlatObject:pc,kindOf:oi,kindOfTest:xn,endsWith:xc,toArray:wc,forEachEntry:Cc,matchAll:Ec,isHTMLForm:yc,hasOwnProperty:fs,hasOwnProp:fs,reduceDescriptors:hs,freezeMethods:Ic,toObjectSet:Sc,toCamelCase:bc,noop:Nc,toFiniteNumber:Tc,findKey:us,global:$n,isContextDefined:ds,isSpecCompliantForm:kc,toJSONObject:Rc,isAsyncFn:Oc,isThenable:Mc,setImmediate:gs,asap:Bc,isIterable:o=>o!=null&&Xt(o[ii])};function Be(o,s,i,u,f){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=o,this.name="AxiosError",s&&(this.code=s),i&&(this.config=i),u&&(this.request=u),f&&(this.response=f,this.status=f.status?f.status:null)}J.inherits(Be,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:J.toJSONObject(this.config),code:this.code,status:this.status}}});const ms=Be.prototype,ps={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(o=>{ps[o]={value:o}}),Object.defineProperties(Be,ps),Object.defineProperty(ms,"isAxiosError",{value:!0}),Be.from=(o,s,i,u,f,h)=>{const m=Object.create(ms);J.toFlatObject(o,m,function(C){return C!==Error.prototype},p=>p!=="isAxiosError");const x=o&&o.message?o.message:"Error",_=s==null&&o?o.code:s;return Be.call(m,x,_,i,u,f),o&&m.cause==null&&Object.defineProperty(m,"cause",{value:o,configurable:!0}),m.name=o&&o.name||"Error",h&&Object.assign(m,h),m};const vc=null;function ji(o){return J.isPlainObject(o)||J.isArray(o)}function xs(o){return J.endsWith(o,"[]")?o.slice(0,-2):o}function ws(o,s,i){return o?o.concat(s).map(function(f,h){return f=xs(f),!i&&h?"["+f+"]":f}).join(i?".":""):s}function Dc(o){return J.isArray(o)&&!o.some(ji)}const Pc=J.toFlatObject(J,{},null,function(s){return/^is[A-Z]/.test(s)});function li(o,s,i){if(!J.isObject(o))throw new TypeError("target must be an object");s=s||new FormData,i=J.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,function(D,v){return!J.isUndefined(v[D])});const u=i.metaTokens,f=i.visitor||C,h=i.dots,m=i.indexes,_=(i.Blob||typeof Blob<"u"&&Blob)&&J.isSpecCompliantForm(s);if(!J.isFunction(f))throw new TypeError("visitor must be a function");function p(T){if(T===null)return"";if(J.isDate(T))return T.toISOString();if(J.isBoolean(T))return T.toString();if(!_&&J.isBlob(T))throw new Be("Blob is not supported. Use a Buffer instead.");return J.isArrayBuffer(T)||J.isTypedArray(T)?_&&typeof Blob=="function"?new Blob([T]):Buffer.from(T):T}function C(T,D,v){let U=T;if(T&&!v&&typeof T=="object"){if(J.endsWith(D,"{}"))D=u?D:D.slice(0,-2),T=JSON.stringify(T);else if(J.isArray(T)&&Dc(T)||(J.isFileList(T)||J.endsWith(D,"[]"))&&(U=J.toArray(T)))return D=xs(D),U.forEach(function(O,M){!(J.isUndefined(O)||O===null)&&s.append(m===!0?ws([D],M,h):m===null?D:D+"[]",p(O))}),!1}return ji(T)?!0:(s.append(ws(v,D,h),p(T)),!1)}const y=[],S=Object.assign(Pc,{defaultVisitor:C,convertValue:p,isVisitable:ji});function B(T,D){if(!J.isUndefined(T)){if(y.indexOf(T)!==-1)throw Error("Circular reference detected in "+D.join("."));y.push(T),J.forEach(T,function(U,P){(!(J.isUndefined(U)||U===null)&&f.call(s,U,J.isString(P)?P.trim():P,D,S))===!0&&B(U,D?D.concat(P):[P])}),y.pop()}}if(!J.isObject(o))throw new TypeError("data must be an object");return B(o),s}function _s(o){const s={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(o).replace(/[!'()~]|%20|%00/g,function(u){return s[u]})}function qi(o,s){this._pairs=[],o&&li(o,this,s)}const Cs=qi.prototype;Cs.append=function(s,i){this._pairs.push([s,i])},Cs.toString=function(s){const i=s?function(u){return s.call(this,u,_s)}:_s;return this._pairs.map(function(f){return i(f[0])+"="+i(f[1])},"").join("&")};function Lc(o){return encodeURIComponent(o).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Es(o,s,i){if(!s)return o;const u=i&&i.encode||Lc;J.isFunction(i)&&(i={serialize:i});const f=i&&i.serialize;let h;if(f?h=f(s,i):h=J.isURLSearchParams(s)?s.toString():new qi(s,i).toString(u),h){const m=o.indexOf("#");m!==-1&&(o=o.slice(0,m)),o+=(o.indexOf("?")===-1?"?":"&")+h}return o}class ys{constructor(){this.handlers=[]}use(s,i,u){return this.handlers.push({fulfilled:s,rejected:i,synchronous:u?u.synchronous:!1,runWhen:u?u.runWhen:null}),this.handlers.length-1}eject(s){this.handlers[s]&&(this.handlers[s]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(s){J.forEach(this.handlers,function(u){u!==null&&s(u)})}}const bs={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Fc={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:qi,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Zi=typeof window<"u"&&typeof document<"u",Yi=typeof navigator=="object"&&navigator||void 0,Vc=Zi&&(!Yi||["ReactNative","NativeScript","NS"].indexOf(Yi.product)<0),Uc=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",zc=Zi&&window.location.href||"http://localhost",Ft={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Zi,hasStandardBrowserEnv:Vc,hasStandardBrowserWebWorkerEnv:Uc,navigator:Yi,origin:zc},Symbol.toStringTag,{value:"Module"})),...Fc};function Hc(o,s){return li(o,new Ft.classes.URLSearchParams,{visitor:function(i,u,f,h){return Ft.isNode&&J.isBuffer(i)?(this.append(u,i.toString("base64")),!1):h.defaultVisitor.apply(this,arguments)},...s})}function Gc(o){return J.matchAll(/\w+|\[(\w*)]/g,o).map(s=>s[0]==="[]"?"":s[1]||s[0])}function Wc(o){const s={},i=Object.keys(o);let u;const f=i.length;let h;for(u=0;u<f;u++)h=i[u],s[h]=o[h];return s}function As(o){function s(i,u,f,h){let m=i[h++];if(m==="__proto__")return!0;const x=Number.isFinite(+m),_=h>=i.length;return m=!m&&J.isArray(f)?f.length:m,_?(J.hasOwnProp(f,m)?f[m]=[f[m],u]:f[m]=u,!x):((!f[m]||!J.isObject(f[m]))&&(f[m]=[]),s(i,u,f[m],h)&&J.isArray(f[m])&&(f[m]=Wc(f[m])),!x)}if(J.isFormData(o)&&J.isFunction(o.entries)){const i={};return J.forEachEntry(o,(u,f)=>{s(Gc(u),f,i,0)}),i}return null}function Xc(o,s,i){if(J.isString(o))try{return(s||JSON.parse)(o),J.trim(o)}catch(u){if(u.name!=="SyntaxError")throw u}return(i||JSON.stringify)(o)}const Pr={transitional:bs,adapter:["xhr","http","fetch"],transformRequest:[function(s,i){const u=i.getContentType()||"",f=u.indexOf("application/json")>-1,h=J.isObject(s);if(h&&J.isHTMLForm(s)&&(s=new FormData(s)),J.isFormData(s))return f?JSON.stringify(As(s)):s;if(J.isArrayBuffer(s)||J.isBuffer(s)||J.isStream(s)||J.isFile(s)||J.isBlob(s)||J.isReadableStream(s))return s;if(J.isArrayBufferView(s))return s.buffer;if(J.isURLSearchParams(s))return i.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),s.toString();let x;if(h){if(u.indexOf("application/x-www-form-urlencoded")>-1)return Hc(s,this.formSerializer).toString();if((x=J.isFileList(s))||u.indexOf("multipart/form-data")>-1){const _=this.env&&this.env.FormData;return li(x?{"files[]":s}:s,_&&new _,this.formSerializer)}}return h||f?(i.setContentType("application/json",!1),Xc(s)):s}],transformResponse:[function(s){const i=this.transitional||Pr.transitional,u=i&&i.forcedJSONParsing,f=this.responseType==="json";if(J.isResponse(s)||J.isReadableStream(s))return s;if(s&&J.isString(s)&&(u&&!this.responseType||f)){const m=!(i&&i.silentJSONParsing)&&f;try{return JSON.parse(s,this.parseReviver)}catch(x){if(m)throw x.name==="SyntaxError"?Be.from(x,Be.ERR_BAD_RESPONSE,this,null,this.response):x}}return s}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ft.classes.FormData,Blob:Ft.classes.Blob},validateStatus:function(s){return s>=200&&s<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};J.forEach(["delete","get","head","post","put","patch"],o=>{Pr.headers[o]={}});const jc=J.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),qc=o=>{const s={};let i,u,f;return o&&o.split(`
|
|
2
|
+
`).forEach(function(m){f=m.indexOf(":"),i=m.substring(0,f).trim().toLowerCase(),u=m.substring(f+1).trim(),!(!i||s[i]&&jc[i])&&(i==="set-cookie"?s[i]?s[i].push(u):s[i]=[u]:s[i]=s[i]?s[i]+", "+u:u)}),s},Is=Symbol("internals");function Lr(o){return o&&String(o).trim().toLowerCase()}function ci(o){return o===!1||o==null?o:J.isArray(o)?o.map(ci):String(o)}function Zc(o){const s=Object.create(null),i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let u;for(;u=i.exec(o);)s[u[1]]=u[2];return s}const Yc=o=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(o.trim());function $i(o,s,i,u,f){if(J.isFunction(u))return u.call(this,s,i);if(f&&(s=i),!!J.isString(s)){if(J.isString(u))return s.indexOf(u)!==-1;if(J.isRegExp(u))return u.test(s)}}function $c(o){return o.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(s,i,u)=>i.toUpperCase()+u)}function Kc(o,s){const i=J.toCamelCase(" "+s);["get","set","has"].forEach(u=>{Object.defineProperty(o,u+i,{value:function(f,h,m){return this[u].call(this,s,f,h,m)},configurable:!0})})}let jt=class{constructor(s){s&&this.set(s)}set(s,i,u){const f=this;function h(x,_,p){const C=Lr(_);if(!C)throw new Error("header name must be a non-empty string");const y=J.findKey(f,C);(!y||f[y]===void 0||p===!0||p===void 0&&f[y]!==!1)&&(f[y||_]=ci(x))}const m=(x,_)=>J.forEach(x,(p,C)=>h(p,C,_));if(J.isPlainObject(s)||s instanceof this.constructor)m(s,i);else if(J.isString(s)&&(s=s.trim())&&!Yc(s))m(qc(s),i);else if(J.isObject(s)&&J.isIterable(s)){let x={},_,p;for(const C of s){if(!J.isArray(C))throw TypeError("Object iterator must return a key-value pair");x[p=C[0]]=(_=x[p])?J.isArray(_)?[..._,C[1]]:[_,C[1]]:C[1]}m(x,i)}else s!=null&&h(i,s,u);return this}get(s,i){if(s=Lr(s),s){const u=J.findKey(this,s);if(u){const f=this[u];if(!i)return f;if(i===!0)return Zc(f);if(J.isFunction(i))return i.call(this,f,u);if(J.isRegExp(i))return i.exec(f);throw new TypeError("parser must be boolean|regexp|function")}}}has(s,i){if(s=Lr(s),s){const u=J.findKey(this,s);return!!(u&&this[u]!==void 0&&(!i||$i(this,this[u],u,i)))}return!1}delete(s,i){const u=this;let f=!1;function h(m){if(m=Lr(m),m){const x=J.findKey(u,m);x&&(!i||$i(u,u[x],x,i))&&(delete u[x],f=!0)}}return J.isArray(s)?s.forEach(h):h(s),f}clear(s){const i=Object.keys(this);let u=i.length,f=!1;for(;u--;){const h=i[u];(!s||$i(this,this[h],h,s,!0))&&(delete this[h],f=!0)}return f}normalize(s){const i=this,u={};return J.forEach(this,(f,h)=>{const m=J.findKey(u,h);if(m){i[m]=ci(f),delete i[h];return}const x=s?$c(h):String(h).trim();x!==h&&delete i[h],i[x]=ci(f),u[x]=!0}),this}concat(...s){return this.constructor.concat(this,...s)}toJSON(s){const i=Object.create(null);return J.forEach(this,(u,f)=>{u!=null&&u!==!1&&(i[f]=s&&J.isArray(u)?u.join(", "):u)}),i}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([s,i])=>s+": "+i).join(`
|
|
3
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(s){return s instanceof this?s:new this(s)}static concat(s,...i){const u=new this(s);return i.forEach(f=>u.set(f)),u}static accessor(s){const u=(this[Is]=this[Is]={accessors:{}}).accessors,f=this.prototype;function h(m){const x=Lr(m);u[x]||(Kc(f,m),u[x]=!0)}return J.isArray(s)?s.forEach(h):h(s),this}};jt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),J.reduceDescriptors(jt.prototype,({value:o},s)=>{let i=s[0].toUpperCase()+s.slice(1);return{get:()=>o,set(u){this[i]=u}}}),J.freezeMethods(jt);function Ki(o,s){const i=this||Pr,u=s||i,f=jt.from(u.headers);let h=u.data;return J.forEach(o,function(x){h=x.call(i,h,f.normalize(),s?s.status:void 0)}),f.normalize(),h}function Ss(o){return!!(o&&o.__CANCEL__)}function gr(o,s,i){Be.call(this,o??"canceled",Be.ERR_CANCELED,s,i),this.name="CanceledError"}J.inherits(gr,Be,{__CANCEL__:!0});function Ns(o,s,i){const u=i.config.validateStatus;!i.status||!u||u(i.status)?o(i):s(new Be("Request failed with status code "+i.status,[Be.ERR_BAD_REQUEST,Be.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i))}function Qc(o){const s=/^([-+\w]{1,25})(:?\/\/|:)/.exec(o);return s&&s[1]||""}function Jc(o,s){o=o||10;const i=new Array(o),u=new Array(o);let f=0,h=0,m;return s=s!==void 0?s:1e3,function(_){const p=Date.now(),C=u[h];m||(m=p),i[f]=_,u[f]=p;let y=h,S=0;for(;y!==f;)S+=i[y++],y=y%o;if(f=(f+1)%o,f===h&&(h=(h+1)%o),p-m<s)return;const B=C&&p-C;return B?Math.round(S*1e3/B):void 0}}function eu(o,s){let i=0,u=1e3/s,f,h;const m=(p,C=Date.now())=>{i=C,f=null,h&&(clearTimeout(h),h=null),o(...p)};return[(...p)=>{const C=Date.now(),y=C-i;y>=u?m(p,C):(f=p,h||(h=setTimeout(()=>{h=null,m(f)},u-y)))},()=>f&&m(f)]}const ui=(o,s,i=3)=>{let u=0;const f=Jc(50,250);return eu(h=>{const m=h.loaded,x=h.lengthComputable?h.total:void 0,_=m-u,p=f(_),C=m<=x;u=m;const y={loaded:m,total:x,progress:x?m/x:void 0,bytes:_,rate:p||void 0,estimated:p&&x&&C?(x-m)/p:void 0,event:h,lengthComputable:x!=null,[s?"download":"upload"]:!0};o(y)},i)},Ts=(o,s)=>{const i=o!=null;return[u=>s[0]({lengthComputable:i,total:o,loaded:u}),s[1]]},ks=o=>(...s)=>J.asap(()=>o(...s)),tu=Ft.hasStandardBrowserEnv?((o,s)=>i=>(i=new URL(i,Ft.origin),o.protocol===i.protocol&&o.host===i.host&&(s||o.port===i.port)))(new URL(Ft.origin),Ft.navigator&&/(msie|trident)/i.test(Ft.navigator.userAgent)):()=>!0,nu=Ft.hasStandardBrowserEnv?{write(o,s,i,u,f,h,m){if(typeof document>"u")return;const x=[`${o}=${encodeURIComponent(s)}`];J.isNumber(i)&&x.push(`expires=${new Date(i).toUTCString()}`),J.isString(u)&&x.push(`path=${u}`),J.isString(f)&&x.push(`domain=${f}`),h===!0&&x.push("secure"),J.isString(m)&&x.push(`SameSite=${m}`),document.cookie=x.join("; ")},read(o){if(typeof document>"u")return null;const s=document.cookie.match(new RegExp("(?:^|; )"+o+"=([^;]*)"));return s?decodeURIComponent(s[1]):null},remove(o){this.write(o,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function ru(o){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(o)}function iu(o,s){return s?o.replace(/\/?\/$/,"")+"/"+s.replace(/^\/+/,""):o}function Rs(o,s,i){let u=!ru(s);return o&&(u||i==!1)?iu(o,s):s}const Os=o=>o instanceof jt?{...o}:o;function Kn(o,s){s=s||{};const i={};function u(p,C,y,S){return J.isPlainObject(p)&&J.isPlainObject(C)?J.merge.call({caseless:S},p,C):J.isPlainObject(C)?J.merge({},C):J.isArray(C)?C.slice():C}function f(p,C,y,S){if(J.isUndefined(C)){if(!J.isUndefined(p))return u(void 0,p,y,S)}else return u(p,C,y,S)}function h(p,C){if(!J.isUndefined(C))return u(void 0,C)}function m(p,C){if(J.isUndefined(C)){if(!J.isUndefined(p))return u(void 0,p)}else return u(void 0,C)}function x(p,C,y){if(y in s)return u(p,C);if(y in o)return u(void 0,p)}const _={url:h,method:h,data:h,baseURL:m,transformRequest:m,transformResponse:m,paramsSerializer:m,timeout:m,timeoutMessage:m,withCredentials:m,withXSRFToken:m,adapter:m,responseType:m,xsrfCookieName:m,xsrfHeaderName:m,onUploadProgress:m,onDownloadProgress:m,decompress:m,maxContentLength:m,maxBodyLength:m,beforeRedirect:m,transport:m,httpAgent:m,httpsAgent:m,cancelToken:m,socketPath:m,responseEncoding:m,validateStatus:x,headers:(p,C,y)=>f(Os(p),Os(C),y,!0)};return J.forEach(Object.keys({...o,...s}),function(C){const y=_[C]||f,S=y(o[C],s[C],C);J.isUndefined(S)&&y!==x||(i[C]=S)}),i}const Ms=o=>{const s=Kn({},o);let{data:i,withXSRFToken:u,xsrfHeaderName:f,xsrfCookieName:h,headers:m,auth:x}=s;if(s.headers=m=jt.from(m),s.url=Es(Rs(s.baseURL,s.url,s.allowAbsoluteUrls),o.params,o.paramsSerializer),x&&m.set("Authorization","Basic "+btoa((x.username||"")+":"+(x.password?unescape(encodeURIComponent(x.password)):""))),J.isFormData(i)){if(Ft.hasStandardBrowserEnv||Ft.hasStandardBrowserWebWorkerEnv)m.setContentType(void 0);else if(J.isFunction(i.getHeaders)){const _=i.getHeaders(),p=["content-type","content-length"];Object.entries(_).forEach(([C,y])=>{p.includes(C.toLowerCase())&&m.set(C,y)})}}if(Ft.hasStandardBrowserEnv&&(u&&J.isFunction(u)&&(u=u(s)),u||u!==!1&&tu(s.url))){const _=f&&h&&nu.read(h);_&&m.set(f,_)}return s},ou=typeof XMLHttpRequest<"u"&&function(o){return new Promise(function(i,u){const f=Ms(o);let h=f.data;const m=jt.from(f.headers).normalize();let{responseType:x,onUploadProgress:_,onDownloadProgress:p}=f,C,y,S,B,T;function D(){B&&B(),T&&T(),f.cancelToken&&f.cancelToken.unsubscribe(C),f.signal&&f.signal.removeEventListener("abort",C)}let v=new XMLHttpRequest;v.open(f.method.toUpperCase(),f.url,!0),v.timeout=f.timeout;function U(){if(!v)return;const O=jt.from("getAllResponseHeaders"in v&&v.getAllResponseHeaders()),K={data:!x||x==="text"||x==="json"?v.responseText:v.response,status:v.status,statusText:v.statusText,headers:O,config:o,request:v};Ns(function(W){i(W),D()},function(W){u(W),D()},K),v=null}"onloadend"in v?v.onloadend=U:v.onreadystatechange=function(){!v||v.readyState!==4||v.status===0&&!(v.responseURL&&v.responseURL.indexOf("file:")===0)||setTimeout(U)},v.onabort=function(){v&&(u(new Be("Request aborted",Be.ECONNABORTED,o,v)),v=null)},v.onerror=function(M){const K=M&&M.message?M.message:"Network Error",Q=new Be(K,Be.ERR_NETWORK,o,v);Q.event=M||null,u(Q),v=null},v.ontimeout=function(){let M=f.timeout?"timeout of "+f.timeout+"ms exceeded":"timeout exceeded";const K=f.transitional||bs;f.timeoutErrorMessage&&(M=f.timeoutErrorMessage),u(new Be(M,K.clarifyTimeoutError?Be.ETIMEDOUT:Be.ECONNABORTED,o,v)),v=null},h===void 0&&m.setContentType(null),"setRequestHeader"in v&&J.forEach(m.toJSON(),function(M,K){v.setRequestHeader(K,M)}),J.isUndefined(f.withCredentials)||(v.withCredentials=!!f.withCredentials),x&&x!=="json"&&(v.responseType=f.responseType),p&&([S,T]=ui(p,!0),v.addEventListener("progress",S)),_&&v.upload&&([y,B]=ui(_),v.upload.addEventListener("progress",y),v.upload.addEventListener("loadend",B)),(f.cancelToken||f.signal)&&(C=O=>{v&&(u(!O||O.type?new gr(null,o,v):O),v.abort(),v=null)},f.cancelToken&&f.cancelToken.subscribe(C),f.signal&&(f.signal.aborted?C():f.signal.addEventListener("abort",C)));const P=Qc(f.url);if(P&&Ft.protocols.indexOf(P)===-1){u(new Be("Unsupported protocol "+P+":",Be.ERR_BAD_REQUEST,o));return}v.send(h||null)})},su=(o,s)=>{const{length:i}=o=o?o.filter(Boolean):[];if(s||i){let u=new AbortController,f;const h=function(p){if(!f){f=!0,x();const C=p instanceof Error?p:this.reason;u.abort(C instanceof Be?C:new gr(C instanceof Error?C.message:C))}};let m=s&&setTimeout(()=>{m=null,h(new Be(`timeout ${s} of ms exceeded`,Be.ETIMEDOUT))},s);const x=()=>{o&&(m&&clearTimeout(m),m=null,o.forEach(p=>{p.unsubscribe?p.unsubscribe(h):p.removeEventListener("abort",h)}),o=null)};o.forEach(p=>p.addEventListener("abort",h));const{signal:_}=u;return _.unsubscribe=()=>J.asap(x),_}},au=function*(o,s){let i=o.byteLength;if(i<s){yield o;return}let u=0,f;for(;u<i;)f=u+s,yield o.slice(u,f),u=f},lu=async function*(o,s){for await(const i of cu(o))yield*au(i,s)},cu=async function*(o){if(o[Symbol.asyncIterator]){yield*o;return}const s=o.getReader();try{for(;;){const{done:i,value:u}=await s.read();if(i)break;yield u}}finally{await s.cancel()}},Bs=(o,s,i,u)=>{const f=lu(o,s);let h=0,m,x=_=>{m||(m=!0,u&&u(_))};return new ReadableStream({async pull(_){try{const{done:p,value:C}=await f.next();if(p){x(),_.close();return}let y=C.byteLength;if(i){let S=h+=y;i(S)}_.enqueue(new Uint8Array(C))}catch(p){throw x(p),p}},cancel(_){return x(_),f.return()}},{highWaterMark:2})},vs=64*1024,{isFunction:di}=J,uu=(({Request:o,Response:s})=>({Request:o,Response:s}))(J.global),{ReadableStream:Ds,TextEncoder:Ps}=J.global,Ls=(o,...s)=>{try{return!!o(...s)}catch{return!1}},du=o=>{o=J.merge.call({skipUndefined:!0},uu,o);const{fetch:s,Request:i,Response:u}=o,f=s?di(s):typeof fetch=="function",h=di(i),m=di(u);if(!f)return!1;const x=f&&di(Ds),_=f&&(typeof Ps=="function"?(T=>D=>T.encode(D))(new Ps):async T=>new Uint8Array(await new i(T).arrayBuffer())),p=h&&x&&Ls(()=>{let T=!1;const D=new i(Ft.origin,{body:new Ds,method:"POST",get duplex(){return T=!0,"half"}}).headers.has("Content-Type");return T&&!D}),C=m&&x&&Ls(()=>J.isReadableStream(new u("").body)),y={stream:C&&(T=>T.body)};f&&["text","arrayBuffer","blob","formData","stream"].forEach(T=>{!y[T]&&(y[T]=(D,v)=>{let U=D&&D[T];if(U)return U.call(D);throw new Be(`Response type '${T}' is not supported`,Be.ERR_NOT_SUPPORT,v)})});const S=async T=>{if(T==null)return 0;if(J.isBlob(T))return T.size;if(J.isSpecCompliantForm(T))return(await new i(Ft.origin,{method:"POST",body:T}).arrayBuffer()).byteLength;if(J.isArrayBufferView(T)||J.isArrayBuffer(T))return T.byteLength;if(J.isURLSearchParams(T)&&(T=T+""),J.isString(T))return(await _(T)).byteLength},B=async(T,D)=>{const v=J.toFiniteNumber(T.getContentLength());return v??S(D)};return async T=>{let{url:D,method:v,data:U,signal:P,cancelToken:O,timeout:M,onDownloadProgress:K,onUploadProgress:Q,responseType:W,headers:oe,withCredentials:V="same-origin",fetchOptions:ce}=Ms(T),j=s||fetch;W=W?(W+"").toLowerCase():"text";let G=su([P,O&&O.toAbortSignal()],M),z=null;const X=G&&G.unsubscribe&&(()=>{G.unsubscribe()});let N;try{if(Q&&p&&v!=="get"&&v!=="head"&&(N=await B(oe,U))!==0){let ge=new i(D,{method:"POST",body:U,duplex:"half"}),me;if(J.isFormData(U)&&(me=ge.headers.get("content-type"))&&oe.setContentType(me),ge.body){const[Ie,_e]=Ts(N,ui(ks(Q)));U=Bs(ge.body,vs,Ie,_e)}}J.isString(V)||(V=V?"include":"omit");const Y=h&&"credentials"in i.prototype,H={...ce,signal:G,method:v.toUpperCase(),headers:oe.normalize().toJSON(),body:U,duplex:"half",credentials:Y?V:void 0};z=h&&new i(D,H);let te=await(h?j(z,ce):j(D,H));const Z=C&&(W==="stream"||W==="response");if(C&&(K||Z&&X)){const ge={};["status","statusText","headers"].forEach(Fe=>{ge[Fe]=te[Fe]});const me=J.toFiniteNumber(te.headers.get("content-length")),[Ie,_e]=K&&Ts(me,ui(ks(K),!0))||[];te=new u(Bs(te.body,vs,Ie,()=>{_e&&_e(),X&&X()}),ge)}W=W||"text";let re=await y[J.findKey(y,W)||"text"](te,T);return!Z&&X&&X(),await new Promise((ge,me)=>{Ns(ge,me,{data:re,headers:jt.from(te.headers),status:te.status,statusText:te.statusText,config:T,request:z})})}catch(Y){throw X&&X(),Y&&Y.name==="TypeError"&&/Load failed|fetch/i.test(Y.message)?Object.assign(new Be("Network Error",Be.ERR_NETWORK,T,z),{cause:Y.cause||Y}):Be.from(Y,Y&&Y.code,T,z)}}},fu=new Map,Fs=o=>{let s=o&&o.env||{};const{fetch:i,Request:u,Response:f}=s,h=[u,f,i];let m=h.length,x=m,_,p,C=fu;for(;x--;)_=h[x],p=C.get(_),p===void 0&&C.set(_,p=x?new Map:du(s)),C=p;return p};Fs();const Qi={http:vc,xhr:ou,fetch:{get:Fs}};J.forEach(Qi,(o,s)=>{if(o){try{Object.defineProperty(o,"name",{value:s})}catch{}Object.defineProperty(o,"adapterName",{value:s})}});const Vs=o=>`- ${o}`,hu=o=>J.isFunction(o)||o===null||o===!1;function gu(o,s){o=J.isArray(o)?o:[o];const{length:i}=o;let u,f;const h={};for(let m=0;m<i;m++){u=o[m];let x;if(f=u,!hu(u)&&(f=Qi[(x=String(u)).toLowerCase()],f===void 0))throw new Be(`Unknown adapter '${x}'`);if(f&&(J.isFunction(f)||(f=f.get(s))))break;h[x||"#"+m]=f}if(!f){const m=Object.entries(h).map(([_,p])=>`adapter ${_} `+(p===!1?"is not supported by the environment":"is not available in the build"));let x=i?m.length>1?`since :
|
|
4
|
+
`+m.map(Vs).join(`
|
|
5
|
+
`):" "+Vs(m[0]):"as no adapter specified";throw new Be("There is no suitable adapter to dispatch the request "+x,"ERR_NOT_SUPPORT")}return f}const Us={getAdapter:gu,adapters:Qi};function Ji(o){if(o.cancelToken&&o.cancelToken.throwIfRequested(),o.signal&&o.signal.aborted)throw new gr(null,o)}function zs(o){return Ji(o),o.headers=jt.from(o.headers),o.data=Ki.call(o,o.transformRequest),["post","put","patch"].indexOf(o.method)!==-1&&o.headers.setContentType("application/x-www-form-urlencoded",!1),Us.getAdapter(o.adapter||Pr.adapter,o)(o).then(function(u){return Ji(o),u.data=Ki.call(o,o.transformResponse,u),u.headers=jt.from(u.headers),u},function(u){return Ss(u)||(Ji(o),u&&u.response&&(u.response.data=Ki.call(o,o.transformResponse,u.response),u.response.headers=jt.from(u.response.headers))),Promise.reject(u)})}const Hs="1.13.2",fi={};["object","boolean","number","function","string","symbol"].forEach((o,s)=>{fi[o]=function(u){return typeof u===o||"a"+(s<1?"n ":" ")+o}});const Gs={};fi.transitional=function(s,i,u){function f(h,m){return"[Axios v"+Hs+"] Transitional option '"+h+"'"+m+(u?". "+u:"")}return(h,m,x)=>{if(s===!1)throw new Be(f(m," has been removed"+(i?" in "+i:"")),Be.ERR_DEPRECATED);return i&&!Gs[m]&&(Gs[m]=!0,console.warn(f(m," has been deprecated since v"+i+" and will be removed in the near future"))),s?s(h,m,x):!0}},fi.spelling=function(s){return(i,u)=>(console.warn(`${u} is likely a misspelling of ${s}`),!0)};function mu(o,s,i){if(typeof o!="object")throw new Be("options must be an object",Be.ERR_BAD_OPTION_VALUE);const u=Object.keys(o);let f=u.length;for(;f-- >0;){const h=u[f],m=s[h];if(m){const x=o[h],_=x===void 0||m(x,h,o);if(_!==!0)throw new Be("option "+h+" must be "+_,Be.ERR_BAD_OPTION_VALUE);continue}if(i!==!0)throw new Be("Unknown option "+h,Be.ERR_BAD_OPTION)}}const hi={assertOptions:mu,validators:fi},yn=hi.validators;let Qn=class{constructor(s){this.defaults=s||{},this.interceptors={request:new ys,response:new ys}}async request(s,i){try{return await this._request(s,i)}catch(u){if(u instanceof Error){let f={};Error.captureStackTrace?Error.captureStackTrace(f):f=new Error;const h=f.stack?f.stack.replace(/^.+\n/,""):"";try{u.stack?h&&!String(u.stack).endsWith(h.replace(/^.+\n.+\n/,""))&&(u.stack+=`
|
|
6
|
+
`+h):u.stack=h}catch{}}throw u}}_request(s,i){typeof s=="string"?(i=i||{},i.url=s):i=s||{},i=Kn(this.defaults,i);const{transitional:u,paramsSerializer:f,headers:h}=i;u!==void 0&&hi.assertOptions(u,{silentJSONParsing:yn.transitional(yn.boolean),forcedJSONParsing:yn.transitional(yn.boolean),clarifyTimeoutError:yn.transitional(yn.boolean)},!1),f!=null&&(J.isFunction(f)?i.paramsSerializer={serialize:f}:hi.assertOptions(f,{encode:yn.function,serialize:yn.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),hi.assertOptions(i,{baseUrl:yn.spelling("baseURL"),withXsrfToken:yn.spelling("withXSRFToken")},!0),i.method=(i.method||this.defaults.method||"get").toLowerCase();let m=h&&J.merge(h.common,h[i.method]);h&&J.forEach(["delete","get","head","post","put","patch","common"],T=>{delete h[T]}),i.headers=jt.concat(m,h);const x=[];let _=!0;this.interceptors.request.forEach(function(D){typeof D.runWhen=="function"&&D.runWhen(i)===!1||(_=_&&D.synchronous,x.unshift(D.fulfilled,D.rejected))});const p=[];this.interceptors.response.forEach(function(D){p.push(D.fulfilled,D.rejected)});let C,y=0,S;if(!_){const T=[zs.bind(this),void 0];for(T.unshift(...x),T.push(...p),S=T.length,C=Promise.resolve(i);y<S;)C=C.then(T[y++],T[y++]);return C}S=x.length;let B=i;for(;y<S;){const T=x[y++],D=x[y++];try{B=T(B)}catch(v){D.call(this,v);break}}try{C=zs.call(this,B)}catch(T){return Promise.reject(T)}for(y=0,S=p.length;y<S;)C=C.then(p[y++],p[y++]);return C}getUri(s){s=Kn(this.defaults,s);const i=Rs(s.baseURL,s.url,s.allowAbsoluteUrls);return Es(i,s.params,s.paramsSerializer)}};J.forEach(["delete","get","head","options"],function(s){Qn.prototype[s]=function(i,u){return this.request(Kn(u||{},{method:s,url:i,data:(u||{}).data}))}}),J.forEach(["post","put","patch"],function(s){function i(u){return function(h,m,x){return this.request(Kn(x||{},{method:s,headers:u?{"Content-Type":"multipart/form-data"}:{},url:h,data:m}))}}Qn.prototype[s]=i(),Qn.prototype[s+"Form"]=i(!0)});let pu=class el{constructor(s){if(typeof s!="function")throw new TypeError("executor must be a function.");let i;this.promise=new Promise(function(h){i=h});const u=this;this.promise.then(f=>{if(!u._listeners)return;let h=u._listeners.length;for(;h-- >0;)u._listeners[h](f);u._listeners=null}),this.promise.then=f=>{let h;const m=new Promise(x=>{u.subscribe(x),h=x}).then(f);return m.cancel=function(){u.unsubscribe(h)},m},s(function(h,m,x){u.reason||(u.reason=new gr(h,m,x),i(u.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(s){if(this.reason){s(this.reason);return}this._listeners?this._listeners.push(s):this._listeners=[s]}unsubscribe(s){if(!this._listeners)return;const i=this._listeners.indexOf(s);i!==-1&&this._listeners.splice(i,1)}toAbortSignal(){const s=new AbortController,i=u=>{s.abort(u)};return this.subscribe(i),s.signal.unsubscribe=()=>this.unsubscribe(i),s.signal}static source(){let s;return{token:new el(function(f){s=f}),cancel:s}}};function xu(o){return function(i){return o.apply(null,i)}}function wu(o){return J.isObject(o)&&o.isAxiosError===!0}const eo={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(eo).forEach(([o,s])=>{eo[s]=o});function Ws(o){const s=new Qn(o),i=ss(Qn.prototype.request,s);return J.extend(i,Qn.prototype,s,{allOwnKeys:!0}),J.extend(i,s,null,{allOwnKeys:!0}),i.create=function(f){return Ws(Kn(o,f))},i}const et=Ws(Pr);et.Axios=Qn,et.CanceledError=gr,et.CancelToken=pu,et.isCancel=Ss,et.VERSION=Hs,et.toFormData=li,et.AxiosError=Be,et.Cancel=et.CanceledError,et.all=function(s){return Promise.all(s)},et.spread=xu,et.isAxiosError=wu,et.mergeConfig=Kn,et.AxiosHeaders=jt,et.formToJSON=o=>As(J.isHTMLForm(o)?new FormData(o):o),et.getAdapter=Us.getAdapter,et.HttpStatusCode=eo,et.default=et;const{Axios:Wg,AxiosError:Xg,CanceledError:jg,isCancel:qg,CancelToken:Zg,VERSION:Yg,all:$g,Cancel:Kg,isAxiosError:Qg,spread:Jg,toFormData:em,AxiosHeaders:tm,HttpStatusCode:nm,formToJSON:rm,getAdapter:im,mergeConfig:om}=et;let bn=null,Vt=null;function Un(o){o&&o.close(!0)}async function Xs(o,s){const i=At(),u=at(),f=An.create();try{const h=await f.initPaymentLink(o,s);return i.paymentCostQR=u.totalPrice_lib-u.countBonus,i.linkQR=h.url,Vt==null||Vt.deleteCart(null,Vt==null?void 0:Vt.is_requestKiosk),h}catch(h){throw i.isButtonDisabled=!1,i.showNotification(h==null?void 0:h.response.data.user_friendly_message),h}}function _u(o,s,i){if(o!=null&&o.params){if(o.error){s.showNotification(o.error),ln(s,null),no(s);return}i(o,s)}}function to(o,s){const i=At(),u=at();return o.params.new_discounts&&(i.extraDiscount=Number(o.params.new_total_cost)-s.initialCartPrice,u.totalPrice_lib=Number(o.params.new_total_cost),s.showNotification("К заказу были добавлены скидки")),!0}const ln=(o,s)=>{o.updateOrderStatus&&o.updateOrderStatus(s)},Cu=o=>{o.loadCart&&o.loadCart()},gi=o=>{o.resetBonuses&&o.resetBonuses()},no=o=>{o.closeWebSocket&&o.closeWebSocket()},Eu=(o,s)=>{o.is_tableservice&&(Un(s),o.resetStores(),o.deleteCart(null,o.is_requestKiosk),o.cartCleanup?o.cartCleanup.cleanupAndNavigate("profile",o.is_requestKiosk):o.deleteCart("profile",o.is_requestKiosk))},js=(o,s,i,u)=>{var m;if(((m=o.params)==null?void 0:m.need_pay)===!1)return;const f=s.ws||i;An.create().orderPay(o.params.order_id||"").then(x=>{s.setOrderNumber&&s.setOrderNumber(x.data.order_number)}).catch(x=>{(s.errorHandler||u).handleOrderPayError(x,{...s,closeWebSocket:()=>Un(f)})})},ro=(o,s,i)=>{const u=o.ws||s;(o.errorHandler||i).handleOrderError({...o,closeWebSocket:()=>Un(u)})},yu=(o,s,i)=>{const u=At(),f=u.getCurrentPaymentMethodId();if(!f||!Dn.getConfig(f)||!Dn.isMethodAvailable(f,o))return null;const m=Dn.createHandler(f);if(!m)return null;const x=u.createPaymentHandler(o,s,i,f);return x?{handler:m,config:x.config}:null},bu=o=>{if(!Vt)return;const s=Vt.context,i=Vt.is_requestKiosk,u=Vt.is_tableservice,f=yu(s,i,u);if(!f){console.warn("handleWebSocketMessageWithDynamicHandler: не удалось получить handler");return}const{handler:h,config:m}=f,x={...m,...Vt};_u(o,x,h.handleWebSocketStatus)};async function Au(o,s,i,u){var C,y;const{is_requestKiosk:f,is_tableservice:h}=i,{comment:m,is_authorized:x,signal:_}=u;i.setButtonDisabled(!0);const p=An.create();try{const S=await p.createOrder(o,s,f,m,x,h,_);if((S==null?void 0:S.status)===201&&((C=S==null?void 0:S.data)!=null&&C.id)){const B=S.data.id,T={...i,signal:_};Vt=T;const v=`wss://${T.area||""}/ws/order/${B}/`;bn=ri(v,{signal:_});const U=()=>{console.warn("WebSocket connection opened (centralized mode)")},P=M=>{var K;console.error("WebSocket error (centralized mode):",M),Un(bn),bn=null,Vt=null,i.setButtonDisabled(!1),(K=i.errorHandler)==null||K.handlePaymentError(M,T)},O=M=>{bu(M)};bn.on("open",U),bn.on("message",O),bn.on("error",P),bn.connect(),Vt.ws=bn,Vt.closeWebSocket=()=>{Un(bn),bn=null,Vt=null}}return S}catch(S){throw et.isCancel(S)||((y=i.errorHandler)==null||y.handleCreateOrderError(S,i),i.setButtonDisabled(!1)),S}}const qs=o=>{var s,i;return((i=(s=o==null?void 0:o.response)==null?void 0:s.data)==null?void 0:i.user_friendly_message)||null};function mi(){const o=At();return{handlePaymentError(s,i){var f,h,m,x,_,p;const u=qs(s);ln(i,null),Cu(i),u?(i.showNotification(u),no(i),i.is_requestKiosk&&((h=i.orderErrors)!=null&&h.includes((f=s.response)==null?void 0:f.status))&&(i.cartCleanup?i.cartCleanup.cleanupAndNavigate("retryPage",i.is_requestKiosk):i.deleteCart("retryPage",i.is_requestKiosk)),i.is_tableservice?i.resetStores():(gi(i),i.context==="qr"&&i.navigation?i.navigation.redirectToError():i.context==="qr"&&i.redirect&&(o.isButtonDisabled=!1,i.redirect(`/${((x=(m=i.route)==null?void 0:m.params)==null?void 0:x.orgId)||""}/errorPayment`)))):i.context==="qr"&&(gi(i),i.navigation?i.navigation.redirectToError():i.redirect&&i.redirect(`/${((p=(_=i.route)==null?void 0:_.params)==null?void 0:p.orgId)||""}/errorPayment`)),o.isButtonDisabled=!1},handleOrderPayError(s,i){var f,h,m,x;const u=qs(s);u&&(i.showNotification(u),no(i),i.is_requestKiosk?((h=i.orderErrors)!=null&&h.includes((f=s.response)==null?void 0:f.status)&&(i.cartCleanup.cleanupAndNavigate("retryPage",i.is_requestKiosk),i.deleteCart("retryPage",i.is_requestKiosk)),ln(i,null)):(gi(i),i.navigation?i.navigation.redirectToError():i.redirect&&i.redirect(`/${((x=(m=i.route)==null?void 0:m.params)==null?void 0:x.orgId)||""}/errorPayment`),ln(i,null)))},handleOrderError(s){var i,u;s.is_requestKiosk?s.cartCleanup?s.cartCleanup.cleanupAndNavigate("retryPage",s.is_requestKiosk):s.deleteCart("retryPage",s.is_requestKiosk):s.is_tableservice?s.showNotification("Ошибка создания заказа. Пожалуйста, попробуйте еще раз"):(gi(s),s.navigation?s.navigation.redirectToError():s.redirect&&(o.isButtonDisabled=!1,s.redirect(`/${((u=(i=s.route)==null?void 0:i.params)==null?void 0:u.orgId)||""}/errorPayment`)))},handleCreateOrderError(s,i){var m,x,_,p,C,y;const{is_requestKiosk:u,is_tableservice:f}=i,h=i.route.params.orgId;u?(((m=s==null?void 0:s.response)==null?void 0:m.status)===403&&((x=i.on403Kiosk)==null||x.call(i),(_=i.redirect)==null||_.call(i,`/${h}/retryPage`)),i.deleteCart("retryPage",u)):f?i.showNotification(((C=(p=s==null?void 0:s.response)==null?void 0:p.data)==null?void 0:C.user_friendly_message)||"Ошибка создания заказа"):(y=i.redirect)==null||y.call(i,`/${h}/errorPayment`)}}}const Iu=()=>{const o=At();let s=null;const i=mi(),u=(f,h)=>{var x,_,p,C;const m=(x=f.params)==null?void 0:x.status;if((_=f.params)!=null&&_.number&&(o.orderNumber=(p=f.params)==null?void 0:p.number),m==="sent")to(f,h),o.isButtonDisabled=!1;else if(m==="waiting_for_fiscalization")ln(h,1);else if(m==="payment_initiation_retry"||m==="fiscalized")js(f,h,s,i);else if(m==="payment_initiation")ln(h,2);else if(m==="paid"){ln(h,3);const y=h.ws||s;Un(y),localStorage.removeItem("cart")}else(C=h.orderErrors)!=null&&C.includes(m)&&ro(h,s,i)};return{handleWebSocketStatus(f,h){u(f,h)}}};function Su(){const o=At();let s=null;const i=mi(),u=(f,h)=>{var x,_,p,C;const m=(x=f.params)==null?void 0:x.status;if((_=f.params)!=null&&_.number&&(o.orderNumber=(p=f.params)==null?void 0:p.number),m==="sent")to(f,h),o.isButtonDisabled=!1;else if(m==="sent_fiscalization")ln(h,1);else if(m==="waiting_payment")ln(h,4);else if(m==="paid"){ln(h,3);const y=h.ws||s;Un(y),localStorage.removeItem("cart")}else(C=h.orderErrors)!=null&&C.includes(m)&&(o.isButtonDisabled=!1,ro(h,s,i))};return{handleWebSocketStatus(f,h){u(f,h)}}}const Nu=()=>{const o=At();let s=null;const i=mi(),u=(f,h)=>{var x,_;const m=(x=f.params)==null?void 0:x.status;if(m==="sent")to(f,h),o.isButtonDisabled=!1;else if(m==="payment_initiation_retry"||m==="fiscalized")js(f,h,s,i);else if(m==="payment_initiation")ln(h,2);else if(m==="paid"){ln(h,3);const p=h.ws||s;Un(p),localStorage.removeItem("cart")}else(_=h.orderErrors)!=null&&_.includes(m)&&(o.isButtonDisabled=!1,ro(h,s,i))};return{handleWebSocketStatus(f,h){u(f,h)}}};class Dn{static initialize(){this.register({id:"TERMINAL_BASE",method:"TERMINAL",handlerFactory:Iu,availableContexts:["kiosk"]}),this.register({id:"YOOKASSA_BASE",method:"YOOKASSA",handlerFactory:Nu,availableContexts:["qr","tableservice"]}),this.register({id:"SBP",method:"YOOKASSA",handlerFactory:Su,availableContexts:["kiosk"]})}static register(s){this.methods.set(s.id,s)}static getConfig(s){return this.methods.get(s)??null}static getAvailableMethods(s){return Array.from(this.methods.entries()).filter(([i,u])=>u.availableContexts.includes(s)).map(([i])=>i)}static isMethodAvailable(s,i){const u=this.getConfig(s);return u?u.availableContexts.includes(i):!1}static createHandler(s){const i=this.getConfig(s);return i?i.handlerFactory():(console.warn(`PaymentMethodRegistry: метод оплаты ${s} не зарегистрирован`),null)}}We(Dn,"methods",new Map),Dn.initialize();function Tu(o){return{cleanupAndNavigate(s,i){o.deleteCart(s,i)},cleanup(s){o.deleteCart(null,s)},clearTokens(){o.deleteCart(null,!0)},resetStores(){o.resetStores()}}}function ku(o){var i,u;const s=((u=(i=o.route)==null?void 0:i.params)==null?void 0:u.orgId)||"";return{redirectToError(){const f=`/${s}/errorPayment`;o.redirect?o.redirect(f):o.router&&o.router.push(f)},redirectToSuccess(f){const h=f?`/${s}/${f}`:`/${s}/profile`;o.redirect?o.redirect(h):o.router&&o.router.push(h)},redirect(f){o.redirect?o.redirect(f):o.router&&o.router.push(f)},getErrorPath(){return`/${s}/errorPayment`},getSuccessPath(){return`/${s}/profile`}}}const At=we.defineStore("cartLib",()=>{const o=ke.useRouter(),s=ke.useRoute(),i=bt(),u=at(),{config_lib:f,countBonus:h,totalPrice_lib:m,initialCartPrice_lib:x,is18Allowed:_}=we.storeToRefs(u),{itemThemes:p}=we.storeToRefs(i),C=l.ref(!1),y=l.ref(""),S=l.ref(null),B=l.ref("wait"),T=l.ref(!0),D=l.ref(0),v=l.ref(""),U=l.ref([]),P=l.ref([]),O=l.ref(),M=l.ref(0),K=l.ref(!1),Q=l.ref(),W=l.ref(null),oe=l.ref(["failed_payment","failed_after_paid","failed","failed_after_sent","failed_after_sent_fiscalization","payment_initiation_retry"]),V=l.ref("Оплатить"),ce=l.ref(),j=l.computed({get:()=>U.value||[],set:Re=>{(Re==null?void 0:Re.length)===1&&(ce.value=Re[0]),U.value=Re}}),G=l.ref(!1),z=l.ref(null),X=l.ref(0),N=l.ref(!1),Y=l.ref({textNotification:""}),H=Re=>{N.value=!0,Y.value.textNotification=Re},te=()=>{var Re,qe;return(Re=O.value)!=null&&Re.front_type?O.value.front_type:((qe=P.value[0])==null?void 0:qe.front_type)||null},Z=(Re,qe,$e,It)=>{var mt;const ue=It??((mt=P.value[0])==null?void 0:mt.front_type);if(!ue)return console.warn("Не удалось определить метод оплаты"),null;const Xe=Dn.getConfig(ue);if(!Xe||!Dn.isMethodAvailable(ue,Re))return console.warn(`Метод ${ue} недоступен для контекста ${Re}`),null;const Ke=Dn.createHandler(ue);return Ke?(Q.value=re(Xe.method,Re,qe,$e),{handler:Ke,config:Q.value}):(console.warn(`Не удалось создать обработчик для метода ${ue}`),null)},re=(Re,qe,$e,It)=>{const ue={method:Re,context:qe,is_requestKiosk:$e,is_tableservice:It,router:o,route:s,orderErrors:oe.value,area:f.value.area,totalPrice:m,initialCartPrice:x,showNotification:H,deleteCart:Oe,resetStores:lt,redirect:tt=>o.push(tt),updateOrderStatus:tt=>{z.value=tt},setOrderNumber:tt=>{W.value=tt},loadCart:()=>u.loadCart(),resetBonuses:()=>{h.value=0}},Xe=mi(),Ke=Tu(ue),mt=ku(ue);return{...ue,errorHandler:Xe,cartCleanup:Ke,navigation:mt}},ge=l.computed(()=>!!S.value),me=Re=>{B.value=Re},Ie=Re=>{S.value=Re},_e=()=>{p.value.kiosk_show_loyalty_card_button&&p.value.kiosk_show_loyalty_phone_input_button?C.value=!0:!p.value.kiosk_show_loyalty_card_button&&p.value.kiosk_show_loyalty_phone_input_button?u.is_OpenLoyal=!0:C.value=!0,B.value="wait",y.value=""},Fe=()=>{C.value=!1,B.value="wait",y.value=""},xe=()=>{S.value=null,y.value="",B.value="wait",Fe()},lt=()=>{G.value=!1,z.value=null},Oe=(Re=null,qe=!1)=>{u.cartProducts_lib=[],dr(["cart"]),qe&&(dr(["authTokensAccess","authTokensRefresh","user"]),u.profile=null,sessionStorage.removeItem("is_adult"),_.value=!1),Re&&o.push(`/${s.params.orgId}/${Re}`)};return{isButtonDisabled:G,orderCompleted_lib:z,extraDiscount:D,orderNumber:W,is_notification_lib:N,notificationData_lib:Y,textPaymentBtn_lib:V,count:X,guestInfo:S,error:y,isDrawerOpen:C,currentState:B,isAuthorized:ge,isCreateButtonVisible:T,linkQR:v,orderTypes:j,providerTypes:P,is_paymentCart:K,selectedOrderType:ce,selectedProvider:O,configPayment:Q,paymentCostQR:M,deleteCart:Oe,setGuestInfo:Ie,setState:me,openDrawer:_e,closeDrawer:Fe,clearCard:xe,showNotification:H,createPaymentHandler:Z,getCurrentPaymentMethodId:te,getAvailablePaymentMethods:Re=>Dn.getAvailableMethods(Re)}}),Tt=we.defineStore("cardLib",()=>{var ce;const o=()=>({openCard:null,currentModifier:null,groupModifiers:[],groupModifiersSelected:[],groupCurrentOpen:null,isModifiedAmount:!1,selectedSize:{},productSizes:[],addedProducts:[],plusButtonsRefs:[],modalCount:1,isSectionModifier:!1,isAnimationFly:!0,textErrorRequaired:""}),s=bt(),i=l.ref(o()),u=()=>i.value=o(),f=l.ref(!1),h=l.ref(!1),m=l.ref(!1),x=l.ref(),_=l.ref([]),p=l.ref({id:null,visible:!1}),C=l.ref(!((ce=s.itemThemes)!=null&&ce.kiosk_disable_lock_screen)),y=l.computed(()=>{const j=i.value.groupModifiersSelected.findIndex(G=>G.group===i.value.groupCurrentOpen.id);return S(j)}),S=j=>j===-1?0:(i.value.groupModifiersSelected[j].modifiers||[]).reduce((z,X)=>z+(X.amount||0),0),B=l.computed(()=>{var G;const j=(G=i.value.openCard)==null?void 0:G.group_modifiers.findIndex(z=>z.id===i.value.groupCurrentOpen.id);return j===-1||!i.value.openCard?0:i.value.openCard.modifiers.length>0&&j===0?i.value.openCard.modifiers.reduce((z,X)=>z+X.max_amount,0):i.value.groupModifiers[j].max_amount}),T=l.computed(()=>{var G;const j=(i.value.addedProducts??[]).reduce((z,X)=>z+X.price,0);if(i.value.openCard){const z=i.value.openCard,X=ur(z)||0,N=z.amount||1;return(i.value.groupModifiersSelected.reduce((H,te)=>(te.modifiers.forEach(Z=>{var re,ge;Z.sizes&&(Z.price=((ge=(re=Z.sizes)==null?void 0:re.find(me=>me.id===i.value.selectedSize.id))==null?void 0:ge.price)??Z.price),H+=Z.price*Z.amount}),H),0)+X)*N+j}return(G=i.value.addedProducts)!=null&&G.length?j:0}),D=l.computed(()=>{const j=i.value.groupModifiers,G=i.value.groupModifiersSelected;for(let z=0;z<j.length;z++){const X=j[z],N=G[z];if(X.min_amount>0&&S(z)<X.min_amount)return i.value.textErrorRequaired=`В группе "${X.name}" должно содержаться не меньше ${X.min_amount} модификатора(ов)`,{haveRequaire:!0,group:X};for(const Y of X.group_modifiers)if(Y.min_amount>0){const H=N.modifiers.find(te=>te.id===Y.id);if(!H||H.amount<Y.min_amount)return i.value.textErrorRequaired=`В группе "${X.name}" выберите все обязательные модификаторы`,{haveRequaire:!0,group:X}}}return{haveRequaire:!1,group:j[0]}}),v=()=>{i.value.groupModifiers.forEach((j,G)=>{i.value.groupCurrentOpen={...j,index:G},j.group_modifiers.forEach(z=>{z.default_amount>0&&(z.amount=z.default_amount,oe(z,!0))})})},U=j=>{i.value.addedProducts.push(j)},P=j=>{i.value.openCard=j},O=j=>{_.value=[...j]},M=(j,G)=>{var X,N;const z=j.id!==((X=i.value.groupCurrentOpen)==null?void 0:X.id);i.value.groupCurrentOpen={...j,index:G},z?i.value.isSectionModifier=!0:i.value.isSectionModifier=!i.value.isSectionModifier,(N=i.value.plusButtonsRefs[G])==null||N.scrollIntoView({behavior:"smooth",block:"start"})},K=()=>{i.value.modalCount>i.value.currentModifier.min_amount&&i.value.modalCount>=2&&(i.value.modalCount-=1)},Q=()=>{i.value.groupCurrentOpen&&i.value.modalCount+y.value<B.value&&(i.value.currentModifier.max_amount===0||i.value.currentModifier.max_amount>i.value.modalCount)&&(i.value.modalCount+=1)},W=(j,G)=>{var X;const z=(X=i.value.groupCurrentOpen)==null?void 0:X.id.toUpperCase();if(!j&&!i.value.isModifiedAmount&&G.max_amount!==1){if(z==="Добавки2000"&&G.max_amount>1)return!0;if(Math.abs(B.value-y.value)>1&&z!=="Добавки2000")return!0}return!1},oe=(j,G=!1)=>{i.value.modalCount=1,i.value.currentModifier=j;const z=i.value.groupModifiersSelected.findIndex(X=>X.group===i.value.groupCurrentOpen.id);V(z,j,G)},V=(j,G,z)=>{var N,Y;let X=i.value.groupModifiersSelected;if(G.sizes.length>0&&G.sizes.find(H=>{var te;return H.id===((te=i.value.selectedSize)==null?void 0:te.id)}),j===-1)W(z,G)?i.value.isModifiedAmount=!0:X[i.value.groupCurrentOpen.index]={group:i.value.groupCurrentOpen.id,is_fake:((N=i.value.groupCurrentOpen)==null?void 0:N.is_fake)||!1,is_product_determining:((Y=i.value.groupCurrentOpen)==null?void 0:Y.is_product_determining)||!1,modifier_count:0,modifiers:[{...G,amount:(G==null?void 0:G.amount)??1}]};else{const H=i.value.groupModifiers[j].group_modifiers.findIndex(Z=>Z.id===G.id);if(X[j].modifiers.findIndex(Z=>Z.id===G.id)===-1){if(B.value===1)X[j].modifiers=[];else if(y.value>=B.value)return;W(z,G)?i.value.isModifiedAmount=!0:(X[j].modifiers.push({...G,amount:(G==null?void 0:G.amount)??1}),X[j].modifier_count=X[j].modifiers.reduce((Z,re)=>Z+=re.amount,0),i.value.isAnimationFly=!0)}else X[j].modifiers=X[j].modifiers.filter(Z=>Z.id!==G.id),X[j].modifier_count=X[j].modifiers.reduce((Z,re)=>Z+=re.amount,0),i.value.groupModifiers[j].group_modifiers[H].amount=1,i.value.groupModifiers[j].group_modifiers[H].default_amount=0,i.value.isAnimationFly=!1}i.value.groupModifiersSelected=X};return{stateCard:i,totalPrice_libCard:T,recountGroupTotalAmount:y,groupTotalAmount:B,isOpenWindow:f,isUpSale:h,checkedRequiredBtn:D,dataUpSale:x,productCards:_,isAddToCard:m,openProduct:p,is_startPage:C,setProduct:O,summModifierAmount:S,setAddedProducts:U,setCurrentCard:P,minusAmount:K,plusAmount:Q,toggleNotRequire:M,modifierSelect:oe,defaultAmountModifiers:v,reset:u}});var mr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Zs(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var Ys={exports:{}};(function(o,s){(function(i,u){o.exports=u()})(mr,function(){var i=1e3,u=6e4,f=36e5,h="millisecond",m="second",x="minute",_="hour",p="day",C="week",y="month",S="quarter",B="year",T="date",D="Invalid Date",v=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,U=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,P={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(X){var N=["th","st","nd","rd"],Y=X%100;return"["+X+(N[(Y-20)%10]||N[Y]||N[0])+"]"}},O=function(X,N,Y){var H=String(X);return!H||H.length>=N?X:""+Array(N+1-H.length).join(Y)+X},M={s:O,z:function(X){var N=-X.utcOffset(),Y=Math.abs(N),H=Math.floor(Y/60),te=Y%60;return(N<=0?"+":"-")+O(H,2,"0")+":"+O(te,2,"0")},m:function X(N,Y){if(N.date()<Y.date())return-X(Y,N);var H=12*(Y.year()-N.year())+(Y.month()-N.month()),te=N.clone().add(H,y),Z=Y-te<0,re=N.clone().add(H+(Z?-1:1),y);return+(-(H+(Y-te)/(Z?te-re:re-te))||0)},a:function(X){return X<0?Math.ceil(X)||0:Math.floor(X)},p:function(X){return{M:y,y:B,w:C,d:p,D:T,h:_,m:x,s:m,ms:h,Q:S}[X]||String(X||"").toLowerCase().replace(/s$/,"")},u:function(X){return X===void 0}},K="en",Q={};Q[K]=P;var W="$isDayjsObject",oe=function(X){return X instanceof G||!(!X||!X[W])},V=function X(N,Y,H){var te;if(!N)return K;if(typeof N=="string"){var Z=N.toLowerCase();Q[Z]&&(te=Z),Y&&(Q[Z]=Y,te=Z);var re=N.split("-");if(!te&&re.length>1)return X(re[0])}else{var ge=N.name;Q[ge]=N,te=ge}return!H&&te&&(K=te),te||!H&&K},ce=function(X,N){if(oe(X))return X.clone();var Y=typeof N=="object"?N:{};return Y.date=X,Y.args=arguments,new G(Y)},j=M;j.l=V,j.i=oe,j.w=function(X,N){return ce(X,{locale:N.$L,utc:N.$u,x:N.$x,$offset:N.$offset})};var G=function(){function X(Y){this.$L=V(Y.locale,null,!0),this.parse(Y),this.$x=this.$x||Y.x||{},this[W]=!0}var N=X.prototype;return N.parse=function(Y){this.$d=function(H){var te=H.date,Z=H.utc;if(te===null)return new Date(NaN);if(j.u(te))return new Date;if(te instanceof Date)return new Date(te);if(typeof te=="string"&&!/Z$/i.test(te)){var re=te.match(v);if(re){var ge=re[2]-1||0,me=(re[7]||"0").substring(0,3);return Z?new Date(Date.UTC(re[1],ge,re[3]||1,re[4]||0,re[5]||0,re[6]||0,me)):new Date(re[1],ge,re[3]||1,re[4]||0,re[5]||0,re[6]||0,me)}}return new Date(te)}(Y),this.init()},N.init=function(){var Y=this.$d;this.$y=Y.getFullYear(),this.$M=Y.getMonth(),this.$D=Y.getDate(),this.$W=Y.getDay(),this.$H=Y.getHours(),this.$m=Y.getMinutes(),this.$s=Y.getSeconds(),this.$ms=Y.getMilliseconds()},N.$utils=function(){return j},N.isValid=function(){return this.$d.toString()!==D},N.isSame=function(Y,H){var te=ce(Y);return this.startOf(H)<=te&&te<=this.endOf(H)},N.isAfter=function(Y,H){return ce(Y)<this.startOf(H)},N.isBefore=function(Y,H){return this.endOf(H)<ce(Y)},N.$g=function(Y,H,te){return j.u(Y)?this[H]:this.set(te,Y)},N.unix=function(){return Math.floor(this.valueOf()/1e3)},N.valueOf=function(){return this.$d.getTime()},N.startOf=function(Y,H){var te=this,Z=!!j.u(H)||H,re=j.p(Y),ge=function(Re,qe){var $e=j.w(te.$u?Date.UTC(te.$y,qe,Re):new Date(te.$y,qe,Re),te);return Z?$e:$e.endOf(p)},me=function(Re,qe){return j.w(te.toDate()[Re].apply(te.toDate("s"),(Z?[0,0,0,0]:[23,59,59,999]).slice(qe)),te)},Ie=this.$W,_e=this.$M,Fe=this.$D,xe="set"+(this.$u?"UTC":"");switch(re){case B:return Z?ge(1,0):ge(31,11);case y:return Z?ge(1,_e):ge(0,_e+1);case C:var lt=this.$locale().weekStart||0,Oe=(Ie<lt?Ie+7:Ie)-lt;return ge(Z?Fe-Oe:Fe+(6-Oe),_e);case p:case T:return me(xe+"Hours",0);case _:return me(xe+"Minutes",1);case x:return me(xe+"Seconds",2);case m:return me(xe+"Milliseconds",3);default:return this.clone()}},N.endOf=function(Y){return this.startOf(Y,!1)},N.$set=function(Y,H){var te,Z=j.p(Y),re="set"+(this.$u?"UTC":""),ge=(te={},te[p]=re+"Date",te[T]=re+"Date",te[y]=re+"Month",te[B]=re+"FullYear",te[_]=re+"Hours",te[x]=re+"Minutes",te[m]=re+"Seconds",te[h]=re+"Milliseconds",te)[Z],me=Z===p?this.$D+(H-this.$W):H;if(Z===y||Z===B){var Ie=this.clone().set(T,1);Ie.$d[ge](me),Ie.init(),this.$d=Ie.set(T,Math.min(this.$D,Ie.daysInMonth())).$d}else ge&&this.$d[ge](me);return this.init(),this},N.set=function(Y,H){return this.clone().$set(Y,H)},N.get=function(Y){return this[j.p(Y)]()},N.add=function(Y,H){var te,Z=this;Y=Number(Y);var re=j.p(H),ge=function(_e){var Fe=ce(Z);return j.w(Fe.date(Fe.date()+Math.round(_e*Y)),Z)};if(re===y)return this.set(y,this.$M+Y);if(re===B)return this.set(B,this.$y+Y);if(re===p)return ge(1);if(re===C)return ge(7);var me=(te={},te[x]=u,te[_]=f,te[m]=i,te)[re]||1,Ie=this.$d.getTime()+Y*me;return j.w(Ie,this)},N.subtract=function(Y,H){return this.add(-1*Y,H)},N.format=function(Y){var H=this,te=this.$locale();if(!this.isValid())return te.invalidDate||D;var Z=Y||"YYYY-MM-DDTHH:mm:ssZ",re=j.z(this),ge=this.$H,me=this.$m,Ie=this.$M,_e=te.weekdays,Fe=te.months,xe=te.meridiem,lt=function(qe,$e,It,ue){return qe&&(qe[$e]||qe(H,Z))||It[$e].slice(0,ue)},Oe=function(qe){return j.s(ge%12||12,qe,"0")},Re=xe||function(qe,$e,It){var ue=qe<12?"AM":"PM";return It?ue.toLowerCase():ue};return Z.replace(U,function(qe,$e){return $e||function(It){switch(It){case"YY":return String(H.$y).slice(-2);case"YYYY":return j.s(H.$y,4,"0");case"M":return Ie+1;case"MM":return j.s(Ie+1,2,"0");case"MMM":return lt(te.monthsShort,Ie,Fe,3);case"MMMM":return lt(Fe,Ie);case"D":return H.$D;case"DD":return j.s(H.$D,2,"0");case"d":return String(H.$W);case"dd":return lt(te.weekdaysMin,H.$W,_e,2);case"ddd":return lt(te.weekdaysShort,H.$W,_e,3);case"dddd":return _e[H.$W];case"H":return String(ge);case"HH":return j.s(ge,2,"0");case"h":return Oe(1);case"hh":return Oe(2);case"a":return Re(ge,me,!0);case"A":return Re(ge,me,!1);case"m":return String(me);case"mm":return j.s(me,2,"0");case"s":return String(H.$s);case"ss":return j.s(H.$s,2,"0");case"SSS":return j.s(H.$ms,3,"0");case"Z":return re}return null}(qe)||re.replace(":","")})},N.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},N.diff=function(Y,H,te){var Z,re=this,ge=j.p(H),me=ce(Y),Ie=(me.utcOffset()-this.utcOffset())*u,_e=this-me,Fe=function(){return j.m(re,me)};switch(ge){case B:Z=Fe()/12;break;case y:Z=Fe();break;case S:Z=Fe()/3;break;case C:Z=(_e-Ie)/6048e5;break;case p:Z=(_e-Ie)/864e5;break;case _:Z=_e/f;break;case x:Z=_e/u;break;case m:Z=_e/i;break;default:Z=_e}return te?Z:j.a(Z)},N.daysInMonth=function(){return this.endOf(y).$D},N.$locale=function(){return Q[this.$L]},N.locale=function(Y,H){if(!Y)return this.$L;var te=this.clone(),Z=V(Y,H,!0);return Z&&(te.$L=Z),te},N.clone=function(){return j.w(this.$d,this)},N.toDate=function(){return new Date(this.valueOf())},N.toJSON=function(){return this.isValid()?this.toISOString():null},N.toISOString=function(){return this.$d.toISOString()},N.toString=function(){return this.$d.toUTCString()},X}(),z=G.prototype;return ce.prototype=z,[["$ms",h],["$s",m],["$m",x],["$H",_],["$W",p],["$M",y],["$y",B],["$D",T]].forEach(function(X){z[X[1]]=function(N){return this.$g(N,X[0],X[1])}}),ce.extend=function(X,N){return X.$i||(X(N,G,ce),X.$i=!0),ce},ce.locale=V,ce.isDayjs=oe,ce.unix=function(X){return ce(1e3*X)},ce.en=Q[K],ce.Ls=Q,ce.p={},ce})})(Ys);var Ru=Ys.exports;const $s=Zs(Ru),Ou=o=>{const s=ke.useRouter(),i=`${o.domain}/api/`,u=et.create({baseURL:i}),f=et.create({baseURL:i}),h=et.create({baseURL:i}),m=et.create({baseURL:i}),x=et.create({baseURL:i}),_=et.create({baseURL:i}),p=et.create({baseURL:i}),C=P=>{try{const O=JSON.parse(localStorage.getItem("authTokensAccess")||"");O.length>0&&(P.headers.Authorization=`Bearer ${O}`)}catch{console.warn("accessToken is undefined [useAxios]")}return P},y=P=>{const O=localStorage.getItem("apiKey");return P.headers={"Content-Type":"application/json","x-api-key":O},P},S=async P=>{if(!o.user)return P;const O=o.user.exp??0;if(!($s.unix(O).diff($s())<3e3))return P;const K=os("authTokensRefresh",null,"string");try{const Q=await et.post(`${i}user/token/refresh/`,{refresh:K.value});if(!Q.data.access)return U(),P;localStorage.setItem("authTokensAccess",JSON.stringify(Q.data.access)),D(Q.data),v(is(Q.data.access)),P.headers={...P.headers,Authorization:`Bearer ${Q.data.access}`}}catch(Q){console.error("Failed to refresh token:",Q),U()}return P},B=P=>{P.interceptors.request.use(O=>S(C(O)),O=>Promise.reject(O))};B(h),B(x),B(p);const T=P=>{P.interceptors.request.use(O=>y(O))};T(_),T(f),T(p);const D=(P,O=!1)=>{localStorage.setItem("authTokensAccess",JSON.stringify(P.access)),O&&localStorage.setItem("authTokensRefresh",JSON.stringify(P.refresh))},v=P=>{o.user=P,localStorage.setItem("user",JSON.stringify(P))},U=()=>{o.user=null,dr(["authTokensAccess","authTokensRefresh","user","cart","bonus"]),sessionStorage.removeItem("is_adult"),s.replace({name:"home"}).then(()=>window.location.reload())};return{axiosInstanceAuthenticationGet:h,axiosInstanceAuthenticationPost:x,axiosInstanceAuthenticationPostApiKey:p,axiosInstancePost:m,axiosInstanceGet:u,axiosInstanceGetApiKey:f,axiosInstancePostApiKey:_}},Ks=(o="themeConfig")=>{try{const s=localStorage.getItem(o);return s?JSON.parse(s):null}catch{return null}},Le=class Le{constructor(){We(this,"axiosInstanceGet");We(this,"axiosInstancePost");We(this,"axiosInstanceAuthenticationGet");We(this,"axiosInstanceAuthenticationPost");We(this,"axiosInstanceGetApiKey");We(this,"axiosInstancePostApiKey");We(this,"axiosInstanceAuthenticationPostApiKey");We(this,"currentUpsaleController",null);We(this,"controller",new AbortController);this.axiosInstanceGet=Le._axiosGet,this.axiosInstancePost=Le._axiosPost,this.axiosInstanceGetApiKey=Le._axiosPostApiKey,this.axiosInstancePostApiKey=Le._axiosPostApiKey,this.axiosInstanceAuthenticationPostApiKey=Le._axiosAuthPostApiKey,this.axiosInstanceAuthenticationGet=Le._axiosAuthGet,this.axiosInstanceAuthenticationPost=Le._axiosAuthPost}static create(s){return s&&!Le._config&&Le._initialize(s),Le._config||console.warn("InitConnection не инициализирован"),new Le}static _initialize(s,i=null){const u=at(),f=Tt(),{config_lib:h}=we.storeToRefs(u),{stateCard:m,recountGroupTotalAmount:x}=we.storeToRefs(f);Le._config=s,Le._cardStore=f,Le._stateCard=m,Le._recountGroupTotalAmount=x,h.value=s;const _=Ou(s);Le._axiosPostApiKey=_.axiosInstanceGetApiKey,Le._axiosPostApiKey=_.axiosInstancePostApiKey,Le._axiosAuthPostApiKey=_.axiosInstanceAuthenticationPostApiKey,Le._axiosGet=_.axiosInstanceGet,Le._axiosPost=_.axiosInstancePost,Le._axiosAuthGet=_.axiosInstanceAuthenticationGet,Le._axiosAuthPost=_.axiosInstanceAuthenticationPost}get config(){return Le._config}get cardStore(){return Le._cardStore}get stateCard(){return Le._stateCard}get recountGroupTotalAmount(){return Le._recountGroupTotalAmount}async updateTheme(){var h,m;const s=Ks(),i=bt();if(s!==null){i.updateColor(s);return}const u=at(),f=await((m=this.axiosInstanceGet)==null?void 0:m.get(`org/organizations/${(h=this.config)==null?void 0:h.orgId}/design/`));u.setStateDrum(f==null?void 0:f.data.hide_barban),u.setKioskTimeout(f==null?void 0:f.data.kiosk_timeout),localStorage.setItem("themeConfig",JSON.stringify(f.data)),i.updateColor(f.data)}async getGroupByID(s){var i,u;try{const f=await((u=this.axiosInstanceGet)==null?void 0:u.get(`${(i=this.config)==null?void 0:i.pointId}/group/${s}`));return f==null?void 0:f.data}catch(f){throw console.error("Ошибка в request.ts[getGroupByID]",f),f}}async loadGroupProducts(s){var i,u;try{const f=await((u=this.axiosInstanceGet)==null?void 0:u.get(`${(i=this.config)==null?void 0:i.pointId}/products/?group=${s}`)),h=(f==null?void 0:f.data)||[];for(const m of h)m&&await _l(m);return await this.cacheImagesInBackground(h),h}catch(f){return console.error("Ошибка загрузки группы:",f),[]}}async getGroup(){var s,i;try{const u=await((i=this.axiosInstanceGet)==null?void 0:i.get(`${(s=this.config)==null?void 0:s.pointId}/groups/`));return u==null?void 0:u.data}catch(u){return console.error("Error fetching products:",u),[]}}async fetchAndCacheAllPages(){var s,i;try{const u=((s=this.config)==null?void 0:s.pointId)||"",f=await zi(u);if(f)return f.data;const h=await((i=this.axiosInstanceGet)==null?void 0:i.get(`${u}/group/`)),m=(h==null?void 0:h.data)||[],x=[];for(const _ of m){_.products=_.products||[],await Rr(_.id,_),x.push(_);const p=await this.loadGroupProducts(_.id);_.products=p}return await this.cacheImagesInBackground(m),await Rr(u,m),x}catch(u){return console.error("fetchAndCacheAllPages error:",u),[]}}cacheImagesInBackground(s){s.forEach(i=>{var u;i.video_link&&this.loadAndCacheMedia(i.video_link,i.id+"_video"),i.image_link&&this.loadAndCacheMedia(i.image_link,i.id+"_image"),(u=i.products)==null||u.forEach(f=>{f.video_link&&this.loadAndCacheMedia(f.video_link,f.id+"_video"),f.image_link&&this.loadAndCacheMedia(f.image_link,f.id+"_image")})})}async loadAndCacheMedia(s,i){const u=await cr(i);if(u){this.dispatchImageCachedEvent(i,u);return}try{const f=await fetch(s);if(!f.ok)throw new Error("Network error");const h=await f.blob();if(h.size===0)throw new Error("Empty blob");await Hi(i,h),this.dispatchImageCachedEvent(i,h)}catch(f){console.warn(`[ImageCache] Failed for ${i}:`,f)}}dispatchImageCachedEvent(s,i){window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:s,blob:i}}))}async getProduct(s=null){var i,u;if(!s)return[];try{const f=await((u=this.axiosInstanceGet)==null?void 0:u.get(`${(i=this.config)==null?void 0:i.pointId}/products/${s}`));return f==null?void 0:f.data}catch(f){return console.error("Error fetching cardProducts:",f),[]}}async getSingleProduct(s){var f;const i=at(),{config_lib:u}=we.storeToRefs(i);try{let h=await Yo(s);if(h)this._fullCardProduct(h);else{const m=await((f=this.axiosInstanceGet)==null?void 0:f.get(`${u.value.pointId}/products/${s}`));(m==null?void 0:m.status)===200&&this._fullCardProduct(m.data)}}catch(h){throw console.warn("store card[getFetchProducts]:",h),h}}_fullCardProduct(s){const i=Tt();i.stateCard.openCard={...s,amount:1},i.stateCard.groupModifiers=s.group_modifiers,s.modifiers.length>0&&i.stateCard.groupModifiers.unshift({default_amount:0,description:"",group_modifiers:s.modifiers,id:"Добавки2000",image_link:null,max_amount:1,min_amount:s.modifiers.reduce((u,f)=>u+=f.min_amount,0),name:"Добавки",required:!1}),i.stateCard.groupModifiersSelected=new Array(i.stateCard.groupModifiers.length).fill({group:"",modifiers:[],is_fake:!1,is_product_determining:!1,modifier_count:0}),i.stateCard.productSizes=s.sizes,i.defaultAmountModifiers(),s.show_recommendations&&this.productUpsale(s.id)}async getTheme(){try{this.updateTheme()}catch(s){return console.error("Error fetching products:",s),[]}}async authorizeByCard(s){var i,u;try{const f=await((u=this.axiosInstanceAuthenticationPostApiKey)==null?void 0:u.post(`${(i=this.config)==null?void 0:i.domain}/api/user/validate-card/`,{card_number:s}));return localStorage.setItem("authTokensAccess",JSON.stringify(f==null?void 0:f.data.access)),localStorage.setItem("authTokensRefresh",JSON.stringify(f==null?void 0:f.data.refresh)),f==null?void 0:f.data}catch(f){throw console.error("Ошибка авторизации:",f),f}}async getLoyalSmsCode(s){var i,u;try{const f=await((u=this.axiosInstancePostApiKey)==null?void 0:u.post(`${(i=this.config)==null?void 0:i.domain}/api/device/auth/request-otp/`,{phone:s}));return f==null?void 0:f.data}catch(f){throw console.error("Ошибка получения sms-code:",f),f}}async sendSmsCodeForAuth(s,i){var u,f;try{const h=await((f=this.axiosInstanceAuthenticationPostApiKey)==null?void 0:f.post(`${(u=this.config)==null?void 0:u.domain}/api/device/auth/`,{code:s,phone:i}));return h==null?void 0:h.data}catch(h){throw console.error("Ошибка отправки sms-code:",h),h}}async callStaff(s,i,u){var f,h,m,x;try{const _=await((m=this.axiosInstancePost)==null?void 0:m.post(`${(f=this.config)==null?void 0:f.domain}/api/org_unit/${(h=this.config)==null?void 0:h.pointId}/table/${s}/call-staff/`,{...i},u));return(x=_==null?void 0:_.data)==null?void 0:x.response_text}catch(_){throw console.error("Ошибка[callStaff]",_),_}}async createOrder(s,i,u=!0,f,h=!1,m=!1,x){var D,v,U,P,O;const _=At(),p=h?this.axiosInstanceAuthenticationPostApiKey:this.axiosInstancePostApiKey,C=u?p:this.axiosInstanceAuthenticationPost,y=u?"/device/order/create":"/order/create",S=u?(D=this.config)==null?void 0:D.pointId:(v=this.config)==null?void 0:v.pointId,B={items:s,table:i||null,comment:f};return u&&((U=_.selectedOrderType)!=null&&U.id)&&(B.order_type_id=(P=_.selectedOrderType)==null?void 0:P.id),await(C==null?void 0:C.post(`${(O=this.config)==null?void 0:O.domain}/api/org_unit/${S}${y}`,B,{signal:x}))}async initPaymentLink(s,i){const u=this.axiosInstanceAuthenticationPost,f=at(),h={order:s,provider_type:i};f.countBonus>0&&(h.by_bonuses=f.countBonus);const m=await(u==null?void 0:u.post("payment/init",h));return m==null?void 0:m.data}async orderPay(s){var i;return(i=this.axiosInstanceAuthenticationPostApiKey)==null?void 0:i.post(`order/${s}/pay/`,{order_id:s})}async getProfile(){var i,u;const s=await((u=this.axiosInstanceAuthenticationGet)==null?void 0:u.get(`user/current?organization=${(i=this.config)==null?void 0:i.orgId}`));if((s==null?void 0:s.status)===200){const f=at();return f.profile=s.data,f.is18Allowed=sessionStorage.getItem("is_adult")==="true",s.data}else return s}async joinLoyalty(){var i;const s=await((i=this.axiosInstanceAuthenticationGet)==null?void 0:i.post("user/join-loyalty/"));return{success:(s==null?void 0:s.status)===200}}async isPhoneExist(s,i={}){var u,f;try{const h=await((f=this.axiosInstanceGet)==null?void 0:f.get("user/check-phone",{...i,params:{organization:(u=this.config)==null?void 0:u.orgId,phone:s}}));return(h==null?void 0:h.status)===200}catch{return!1}}async sendOTP(s,i={}){var f,h;const u=await((h=this.axiosInstancePost)==null?void 0:h.post("user/check-phone",{organization:(f=this.config)==null?void 0:f.orgId,phone:s},i));return u==null?void 0:u.data}async auth(s,i={}){var f,h;return await((h=this.axiosInstancePost)==null?void 0:h.post("user/auth",{organization:(f=this.config)==null?void 0:f.orgId,...s},i))}async signup(s,i={}){var f,h;return await((h=this.axiosInstancePost)==null?void 0:h.post("user/register",{organization:(f=this.config)==null?void 0:f.orgId,...s},i))}async calculateDiscount(s,i=!0,u=!1,f){var p,C;const h=u?this.axiosInstanceAuthenticationPostApiKey:this.axiosInstancePostApiKey,m=i?h:this.axiosInstanceAuthenticationPost,x=i?(p=this.config)==null?void 0:p.pointId:(C=this.config)==null?void 0:C.pointId,_=await(m==null?void 0:m.post(`/org_unit/${x}/cart/calculate-discount/`,s,{signal:f}));return(_==null?void 0:_.status)===200?_.data:_}async maxPayByBonuses(s,i=!0,u=!1,f){const h=at(),m=u?this.axiosInstanceAuthenticationPostApiKey:this.axiosInstancePostApiKey,x=i?m:this.axiosInstanceAuthenticationPost,_=await(x==null?void 0:x.post("/cart/max-pay-by-bonuses/",{order_id:s},{signal:f})),p=_==null?void 0:_.data;return h.profile&&p&&"balance"in p&&(h.profile.balance=p.balance),p}async getDeviceInfo(){var u;const s=At(),i=await((u=this.axiosInstanceGetApiKey)==null?void 0:u.get("/device/current/"));return(i==null?void 0:i.status)===200?(s.orderTypes=i.data.order_types,s.providerTypes=i.data.payment_provider_type,i.data):i}async validateApiKey(s,i){var f,h;const u=await((h=this.axiosInstancePost)==null?void 0:h.post(`/device/org_unit/${(f=this.config)==null?void 0:f.pointId}/validate-api-key/`,{api_key:s},i));return(u==null?void 0:u.status)===200}async productUpsale(s){var h,m,x;const i=Tt(),{dataUpSale:u}=we.storeToRefs(i);(h=this.currentUpsaleController)==null||h.abort();const f=new AbortController;this.currentUpsaleController=f;try{const _=await((x=this.axiosInstanceGet)==null?void 0:x.get(`/${(m=this.config)==null?void 0:m.pointId}/products/${s}/recommendation/`,{signal:f.signal}));f.signal.aborted||(u.value=_==null?void 0:_.data)}catch(_){if(_.name==="AbortError"||_.name==="CanceledError"){console.warn("Upsale отменён — пришёл новый запрос");return}throw console.error("Ошибка upsale:",_),_}finally{this.currentUpsaleController===f&&(this.currentUpsaleController=null)}}};We(Le,"_config",null),We(Le,"_axiosGet"),We(Le,"_axiosGetApiKey"),We(Le,"_axiosPostApiKey"),We(Le,"_axiosAuthPostApiKey"),We(Le,"_axiosPost"),We(Le,"_axiosAuthGet"),We(Le,"_axiosAuthPost"),We(Le,"_cardStore",null),We(Le,"_stateCard",null),We(Le,"_recountGroupTotalAmount",null);let An=Le;const Qs=l.ref(!1),Js=l.ref(window.innerWidth),In=()=>{const o=l.computed({get:()=>Qs.value,set:f=>{Qs.value=f}}),s=l.computed(()=>o.value&&Js.value>1024),i=()=>Js.value=window.innerWidth;return l.onMounted(()=>{window.addEventListener("resize",i)}),l.onUnmounted(()=>{window.removeEventListener("resize",i)}),{isDesktop:o,shouldUseDragScroll:s,syncWithRoute:f=>{o.value=f.query.mode==="pdf"}}},Mu=l.defineComponent({__name:"UseScrollCenter",props:{axis:{},behavior:{},autoScroll:{type:Boolean},container:{},idActive:{},clearContainer:{type:Boolean}},setup(o,{expose:s}){const i=o,u=at(),f=l.ref(null),{isDesktop:h}=In(),m=async _=>{if(!f.value||!_)return;let p=window;i.container&&(p=typeof i.container=="string"?document.querySelector(i.container)||window:i.container);const C={behavior:i.behavior};if(i.axis==="x"){const y=p===window?window.innerWidth:p.clientWidth,S=_.offsetWidth;let B=_.offsetLeft;if(p!==window){const T=p.getBoundingClientRect();B=_.getBoundingClientRect().left-T.left+p.scrollLeft}B-=(y-S)/2,C.left=Math.max(0,B)}else{const y=p===window?window.innerHeight:p.clientHeight,S=_.offsetHeight;let B=_.offsetTop;if(p!==window){const T=p.getBoundingClientRect();B=_.getBoundingClientRect().top-T.top+p.scrollTop}B-=(y-S)/2,C.top=Math.max(0,B)}try{p===window?window.scrollTo(C):p.scrollTo(C)}catch(y){console.error("Scroll error:",y)}};l.onMounted(async()=>{if(i.autoScroll){let _=null;if(await l.nextTick(),u.activeScrolling_lib){const p=u.activeScrolling_lib.findIndex(C=>C.id===i.idActive);i.idActive?(_=document.getElementById(`scrolling${i.idActive}`),_&&p!==-1&&(u.activeScrolling_lib[p]=_)):u.activeScrolling_lib[p]&&(_=u.activeScrolling_lib[p]),m(_)}}});const x=async _=>{i.clearContainer&&(u.activeScrolling_lib=[]);const p=_.currentTarget;await l.nextTick(),u.activeScrolling_lib.includes(p)||u.activeScrolling_lib.push(p),m(p)};return s({scrollToElement:m}),(_,p)=>(l.openBlock(),l.createElementBlock("div",{ref_key:"wrapperRef",ref:f,class:l.normalizeClass(["scroll-to-wrapper",{scroll_pdf:l.unref(h)}])},[l.renderSlot(_.$slots,"default",{handleTargetClick:x},void 0,!0)],2))}}),ze=(o,s)=>{const i=o.__vccOpts||o;for(const[u,f]of s)i[u]=f;return i},io=ze(Mu,[["__scopeId","data-v-e47a167d"]]),Fr={mounted(o){let s=!1,i,u,f,h,m,x=0,_=0,p=0,C=0,y=0,S=!1;const B=5;o.style.cursor="grab";const T=U=>{U.button===0&&(m&&(cancelAnimationFrame(m),m=0),s=!0,S=!1,i=U.pageX-o.offsetLeft,u=U.pageY-o.offsetTop,f=o.scrollLeft,h=o.scrollTop,p=U.pageX,C=U.pageY,y=Date.now(),x=0,_=0)},D=U=>{if(!s)return;const P=U.pageX,O=U.pageY,M=Math.abs(P-p),K=Math.abs(O-C);if(!S&&(M>B||K>B)&&(S=!0,o.style.pointerEvents="none"),S){U.stopPropagation(),U.preventDefault();const Q=Date.now(),W=Q-y;W>0&&(x=(P-p)/W*16,_=(O-C)/W*16),p=P,C=O,y=Q;const oe=P-o.offsetLeft,V=O-o.offsetTop,ce=oe-i,j=V-u;o.scrollLeft=f-ce,o.scrollTop=h-j}else p=P,C=O,y=Date.now()},v=U=>{if(s){if(S){if(U.stopPropagation(),U.preventDefault(),o.style.pointerEvents="",Math.abs(x)>.1||Math.abs(_)>.1){const P=()=>{o.scrollLeft-=x,o.scrollTop-=_,x*=.95,_*=.95,Math.abs(x)>.1||Math.abs(_)>.1?m=requestAnimationFrame(P):m=0};m=requestAnimationFrame(P)}}else o.style.pointerEvents="";s=!1,S=!1}};o.addEventListener("mousedown",T),window.addEventListener("mousemove",D),window.addEventListener("mouseup",v),o._dragScrollCleanup=()=>{m&&cancelAnimationFrame(m),o.removeEventListener("mousedown",T),window.removeEventListener("mousemove",D),window.removeEventListener("mouseup",v),o.style.pointerEvents=""}},unmounted(o){o._dragScrollCleanup&&o._dragScrollCleanup()}},Bu={},vu={id:"custom_svg_lib",width:"26.000000",height:"26.000000",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"};function Du(o,s){return l.openBlock(),l.createElementBlock("svg",vu,[...s[0]||(s[0]=[l.createElementVNode("defs",null,null,-1),l.createElementVNode("path",{id:"custom_svg_color",d:"M11.83 26L11.83 14.15L0 14.15L0 11.84L11.83 11.84L11.83 0L14.15 0L14.15 11.84L26 11.84L26 14.15L14.15 14.15L14.15 26L11.83 26Z",fill:"#FF6D2E","fill-opacity":"1.000000","fill-rule":"nonzero"},null,-1)])])}const oo=ze(Bu,[["render",Du]]),Pu=["id","onClick"],Lu={class:"modified_plus_btn"},Fu=["src"],Vu={key:2,class:"wrapper_modifier_item"},Uu={key:0,class:"modifier_item_n_wrapper"},zu=["src"],Hu={key:1,class:"modifier_plus_item"},Gu=["src"],Wu=["src"],ea=ze(l.defineComponent({__name:"PlusModifier",props:{isSectionModifier:{type:Boolean},toggleNotRequire:{type:Function}},setup(o){const s=Tt(),i=bt(),{stateCard:u}=we.storeToRefs(s),{itemThemes:f}=we.storeToRefs(i),{shouldUseDragScroll:h}=In(),m=l.ref([]),x=l.ref([]),_=l.ref(null),p=l.ref(null),C=S=>{S instanceof HTMLElement&&!m.value.includes(S)&&m.value.push(S)},y=S=>{p.value=S};return l.onMounted(async()=>{await l.nextTick(),u.value.plusButtonsRefs=m.value}),l.watchEffect(()=>{x.value=u.value.groupModifiersSelected,document.body.style.overflow=""}),l.onBeforeUnmount(()=>{m.value=[],u.value.plusButtonsRefs=[]}),(S,B)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass({card_modified_wrapper_many:l.unref(u).groupModifiers.length>=5})},[l.unref(u).groupModifiersSelected?l.withDirectives((l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass(["card_modified_wrapper",[l.unref(u).groupModifiers.length<=4?"card_modified_wrapper_center":""]]),ref_key:"scrollPlusContainer",ref:_},[l.createVNode(io,{axis:"x",behavior:"smooth",container:_.value,autoScroll:!0,idActive:p.value,clearContainer:!0},{default:l.withCtx(({handleTargetClick:T})=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(u).groupModifiers,(D,v)=>{var U,P;return l.openBlock(),l.createElementBlock("div",{class:"button_modified",key:D.id,ref_for:!0,ref:C,id:"scrolling"+D.id,"data-clickable":"true",onClick:O=>{o.toggleNotRequire&&o.toggleNotRequire(D,v),y(D.id),T(O)}},[l.createElementVNode("div",Lu,[x.value[v].modifiers.length===0?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass([{modified_plus_btn_active:D.id===((U=l.unref(u).groupCurrentOpen)==null?void 0:U.id)&&o.isSectionModifier},"modified_plus_active"])},[l.createVNode(oo,{"aria-label":`Открыть группу модификаторов ${D.name}`},null,8,["aria-label"])],2)):x.value[v].modifiers.length===1?(l.openBlock(),l.createElementBlock("div",{key:1,class:l.normalizeClass(["modified_plus_btn modified_plus_btn_solo",{modified_plus_btn_active:D.id===((P=l.unref(u).groupCurrentOpen)==null?void 0:P.id)&&o.isSectionModifier}])},[l.createElementVNode("img",{src:x.value[v].modifiers[0].image_link||l.unref(f).fallback_image||"",alt:"Модификатор"},null,8,Fu)],2)):(l.openBlock(),l.createElementBlock("div",Vu,[x.value[v].modifiers.length>2?(l.openBlock(),l.createElementBlock("div",Uu,[x.value[v].modifiers.length===3?(l.openBlock(),l.createElementBlock("img",{key:0,class:"modifier_plus_item modifier_item_three",src:x.value[v].modifiers[2].image_link||l.unref(f).fallback_image||""},null,8,zu)):(l.openBlock(),l.createElementBlock("p",Hu," + "+l.toDisplayString(x.value[v].modifiers.length-2),1))])):l.createCommentVNode("",!0),l.createElementVNode("div",null,[x.value[v].modifiers.length>0?(l.openBlock(),l.createElementBlock("img",{key:0,src:x.value[v].modifiers[0].image_link||l.unref(f).fallback_image||"",class:"modifier_plus_item modifier_item_first"},null,8,Gu)):l.createCommentVNode("",!0),x.value[v].modifiers.length>1?(l.openBlock(),l.createElementBlock("img",{key:1,src:x.value[v].modifiers[1].image_link||l.unref(f).fallback_image||"",class:"modifier_plus_item modifier_item_second"},null,8,Wu)):l.createCommentVNode("",!0)])]))]),l.createElementVNode("p",null,l.toDisplayString(D.name),1)],8,Pu)}),128))]),_:1},8,["container","idActive"])],2)),[[l.unref(Fr),l.unref(h)?{}:!1]]):l.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-c850b1ab"]]),Xu={},ju={id:"custom_svg_lib",width:"21.847656",height:"21.846924",viewBox:"0 0 21.8477 21.8469",fill:"none",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"};function qu(o,s){return l.openBlock(),l.createElementBlock("svg",ju,[...s[0]||(s[0]=[l.createElementVNode("desc",null," Created with Pixso. ",-1),l.createElementVNode("defs",null,null,-1),l.createElementVNode("circle",{id:"Ellipse 1",cx:"10.923828",cy:"10.923462",r:"10.923489",fill:"#FF6D2E","fill-opacity":"1.000000"},null,-1),l.createElementVNode("path",{id:"Vector",d:"M12.38 15.9L12.89 15.39C12.96 15.33 13 15.25 13 15.16C13 15.08 12.96 15 12.89 14.93L8.84 11L12.89 7.06C12.96 6.99 13 6.91 13 6.83C13 6.74 12.96 6.66 12.89 6.6L12.38 6.1C12.31 6.03 12.23 6 12.14 6C12.05 6 11.97 6.03 11.9 6.1L7.1 10.76C7.03 10.83 7 10.91 7 11C7 11.08 7.03 11.16 7.1 11.23L11.9 15.9C11.97 15.96 12.05 16 12.14 16C12.23 16 12.31 15.96 12.38 15.9Z",fill:"#F2F7FF","fill-opacity":"1.000000","fill-rule":"nonzero"},null,-1)])])}const Vr=ze(Xu,[["render",qu]]),Ur={mounted(o){o.muted=!0,o.setAttribute("muted","")}},Zu={class:"wrapper_modifiers"},Yu={class:"wrapper_nutritional_value"},$u={class:"nutritional_scheme"},Ku={key:0,class:"nutritional_parameters"},Qu={key:1,class:"nutritional_parameters"},Ju={key:2,class:"nutritional_parameters"},e0={key:3,class:"nutritional_parameters"},t0={ref:"modifierBody",class:"modifier_shadow"},n0={class:"wrapper_modifiers_title"},r0={class:"wrapper_text_count_modifiers"},i0=["id","aria-label","onClick","onKeydown"],o0={key:0,class:"counter_modifier"},s0={class:"hide_image_corners"},a0=["src","alt"],l0={key:1,loop:"",autoplay:"",muted:"",playsinline:"",class:"card__video"},c0=["src"],u0={class:"modifier_title"},d0=ze(l.defineComponent({__name:"SectionModifiers",emits:["close"],setup(o,{emit:s}){const i=s,u=bt(),f=Tt(),{itemThemes:h}=we.storeToRefs(u),{stateCard:m,recountGroupTotalAmount:x,groupTotalAmount:_}=we.storeToRefs(f),{isDesktop:p,shouldUseDragScroll:C}=In(),y=l.ref(null),S=zt.useTemplateRefsList(),B=T=>{if(!T)return;const D=m.value.groupModifiers.findIndex(M=>M.id===m.value.groupCurrentOpen.id),v=m.value.plusButtonsRefs[D]||m.value.plusButtonsRefs[0];if(!v)return;const U=T.getBoundingClientRect(),P=v.getBoundingClientRect(),O=T.cloneNode(!0);O.classList.add("flyer"),Object.assign(O.style,{width:`${U.width}px`,height:`${U.height}px`,left:`${U.left}px`,top:`${U.top}px`,position:"fixed",zIndex:"1000"}),document.body.appendChild(O),y.value=O,requestAnimationFrame(()=>{const M=P.left+P.width/3-(U.left+U.width/2),K=P.top+P.height/4-(U.top+U.height/2),Q=P.width/U.width*.2;O.style.transform=`translate(${M}px, ${K}px) scale(${Q})`,O.style.opacity="0.4",O.style.transition="transform 0.5s ease, opacity 0.5s ease"}),O.addEventListener("transitionend",()=>{O.remove(),y.value=null,v.classList.add("bump"),setTimeout(()=>v.classList.remove("bump"),300)},{once:!0})};return l.watch(()=>m.value.isAnimationFly,T=>{T===!0&&m.value.currentModifier&&(B(S.value.find(D=>D.id===m.value.currentModifier.id)),m.value.isAnimationFly=!1)}),(T,D)=>{var v,U,P,O,M,K,Q,W,oe,V,ce,j,G;return l.openBlock(),l.createElementBlock("div",Zu,[l.createElementVNode("div",Yu,[l.createElementVNode("div",{class:l.normalizeClass(["card_header_inner_back",[(v=l.unref(m).openCard)!=null&&v.proteins_amount?"card_header_inner_back_nutrients":""]]),"aria-label":"Закрыть выбор модификаторов",onClick:D[0]||(D[0]=z=>i("close"))},[l.createVNode(Vr,{class:"arrow_bottom"})],2),l.createElementVNode("div",$u,[(U=l.unref(m).openCard)!=null&&U.energy_amount?(l.openBlock(),l.createElementBlock("div",Ku,[l.createElementVNode("b",null,l.toDisplayString((P=l.unref(m).openCard)==null?void 0:P.energy_amount),1),D[1]||(D[1]=l.createElementVNode("p",null,"Килокалории",-1))])):l.createCommentVNode("",!0),(O=l.unref(m).openCard)!=null&&O.proteins_amount?(l.openBlock(),l.createElementBlock("div",Qu,[l.createElementVNode("b",null,l.toDisplayString((M=l.unref(m).openCard)==null?void 0:M.proteins_amount),1),D[2]||(D[2]=l.createElementVNode("p",null,"Белки",-1))])):l.createCommentVNode("",!0),(K=l.unref(m).openCard)!=null&&K.fat_amount?(l.openBlock(),l.createElementBlock("div",Ju,[l.createElementVNode("b",null,l.toDisplayString((Q=l.unref(m).openCard)==null?void 0:Q.fat_amount),1),D[3]||(D[3]=l.createElementVNode("p",null,"Жиры",-1))])):l.createCommentVNode("",!0),(W=l.unref(m).openCard)!=null&&W.carbohydrates_amount?(l.openBlock(),l.createElementBlock("div",e0,[l.createElementVNode("b",null,l.toDisplayString((oe=l.unref(m).openCard)==null?void 0:oe.carbohydrates_amount),1),D[4]||(D[4]=l.createElementVNode("p",null,"Углеводы",-1))])):l.createCommentVNode("",!0)])]),l.createElementVNode("div",t0,[l.createElementVNode("p",n0,l.toDisplayString((V=l.unref(m).groupCurrentOpen)==null?void 0:V.name),1),l.createElementVNode("p",r0,"Выбрано "+l.toDisplayString(l.unref(x))+" из "+l.toDisplayString(l.unref(_)),1),l.withDirectives((l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass((ce=l.unref(m).groupModifiers.find(z=>{var X;return z.id===((X=l.unref(m).groupCurrentOpen)==null?void 0:X.id)}))!=null&&ce.group_modifiers.length?"wrapper_modifiers_card":"wrapper_modifiers_card_column")},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(((j=l.unref(m).groupCurrentOpen)==null?void 0:j.group_modifiers)||[],z=>{var X,N,Y;return l.openBlock(),l.createElementBlock("div",{key:z.id,ref_for:!0,ref:l.unref(S).set,id:z.id,style:l.normalizeStyle({pointerEvents:l.unref(p)?"none":"auto"}),class:l.normalizeClass(["modifier_card",{hidden_modifier_card:z.default_amount===0&&((X=l.unref(m).groupCurrentOpen)==null?void 0:X.id)==="Добавки2000"&&z.min_amount===0&&z.max_amount===0}]),tabindex:"0",role:"button","data-clickable":"true","aria-label":`Выбрать модификатор группы ${z.name}`,onClick:H=>l.unref(f).modifierSelect(z),onKeydown:l.withKeys(H=>l.unref(f).modifierSelect(z),["enter"])},[l.createElementVNode("div",{class:l.normalizeClass([{modifier_card_active:l.unref(m).groupModifiersSelected.some(H=>{var te;return H.group===((te=l.unref(m).groupCurrentOpen)==null?void 0:te.id)&&H.modifiers.some(Z=>Z.id===z.id)})},"wrapper_image_corners"])},[z.amount>1?(l.openBlock(),l.createElementBlock("div",o0,l.toDisplayString(z.amount),1)):l.createCommentVNode("",!0),l.createElementVNode("div",s0,[z.video_link?l.withDirectives((l.openBlock(),l.createElementBlock("video",l0,[l.createElementVNode("source",{src:z.video_link||"",type:"video/webm"},null,8,c0)])),[[l.unref(Ur)]]):(l.openBlock(),l.createElementBlock("img",{key:0,class:"modifier_image",src:z.image_link||l.unref(h).fallback_image||"",alt:z.name},null,8,a0)),l.createElementVNode("div",{class:l.normalizeClass(["wrapper_modifier_title",{wrapper_modifier_title_required:z.min_amount>0||z.required}])},[l.createElementVNode("h3",u0,l.toDisplayString(z.name),1),l.createElementVNode("p",null,"+"+l.toDisplayString(((Y=(N=z.sizes)==null?void 0:N.find(H=>H.id===l.unref(m).selectedSize.id))==null?void 0:Y.price)||z.price||0)+"₽",1)],2)])],2)],46,i0)}),128))],2)),[[l.unref(Fr),(G=l.unref(m).groupModifiers.find(z=>{var X;return z.id===((X=l.unref(m).groupCurrentOpen)==null?void 0:X.id)}))!=null&&G.group_modifiers.length?{}:!1]])],512)])}}}),[["__scopeId","data-v-2ce24a7a"]]),f0={key:0,class:"card_size_place"},h0=["onClick","onKeydown","aria-label"],g0={key:1,class:"card_size static"},m0=["onClick","onKeydown","aria-label"],so=3,p0=ze(l.defineComponent({__name:"SizeModifier",setup(o){const s=Tt(),{stateCard:i}=we.storeToRefs(s),u=l.ref(null),{isDesktop:f}=In(),h=l.ref(50),m=l.ref(),x=l.ref(0),_=l.ref(0),p=l.ref(null),C=l.computed(()=>{var M;if(i.value.productSizes.length<=3)return i.value.productSizes[m.value.index]||i.value.productSizes[0];const P=x.value+1,O=((M=S.value[P])==null?void 0:M.originalIndex)??1;return i.value.productSizes[O]}),y=()=>{p.value&&i.value.productSizes.length>=3&&(_.value=p.value.offsetWidth/so)},S=l.computed(()=>{if(i.value.productSizes.length<=3)return i.value.productSizes;const P=i.value.productSizes;return[...P.map((O,M)=>({...O,originalIndex:M})),...P.map((O,M)=>({...O,originalIndex:M})),...P.map((O,M)=>({...O,originalIndex:M}))]}),B=(P,O)=>{if(m.value={id:P.id,title:P.name,index:O,is_default:P.is_default},P.price!==null&&i.value.openCard&&(i.value.openCard={...i.value.openCard,price:P.price}),i.value.selectedSize=P,i.value.productSizes.length>3){y();const M=x.value+1;O<M?T():O>M&&D()}else{const M=i.value.productSizes.length,K=(O+.5)*(100/M);h.value=K}},T=()=>{var P;if(!(i.value.productSizes.length<=3)){if(x.value--,x.value<i.value.productSizes.length-so+1){x.value+=i.value.productSizes.length;const O=(P=p.value)==null?void 0:P.querySelector(".card_size");O&&(O.style.transition="none",O.style.transform=`translateX(-${x.value*_.value}px)`,O.offsetHeight,O.style.transition="transform 0.2s ease-in-out")}v()}},D=()=>{var P;if(!(i.value.productSizes.length<=3)){if(x.value++,x.value>=i.value.productSizes.length*2){x.value-=i.value.productSizes.length;const O=(P=p.value)==null?void 0:P.querySelector(".card_size");O&&(O.style.transition="none",O.style.transform=`translateX(-${x.value*_.value}px)`,O.offsetHeight,O.style.transition="transform 0.2s ease-in-out")}v()}},v=()=>{var K;if(i.value.productSizes.length<=3)return;const P=x.value+1,O=((K=S.value[P])==null?void 0:K.originalIndex)??0,M=i.value.productSizes[O];m.value={id:M.id,title:M.name,index:O,is_default:M.is_default}};l.watch(()=>[i.value.productSizes,p.value],([P=[],O])=>{if(Array.isArray(P)&&P.length>0&&O!==null){let M=P.findIndex(K=>K.is_default===!0);P.length<3&&u.value&&parseInt(u.value.style.minWidth)<767&&(u.value.style.width="100px"),M>-1?(x.value=M,B(P[M],M),_.value=120/so):P.length===2||P.length===1?(B(P[0],0),h.value=(0+.5)*(100/2)):(B(P[1],1),h.value=(1+.5)*(100/3))}}),l.watch(()=>{var P;return[(P=i.value.selectedSize)==null?void 0:P.id,i.value.groupModifiersSelected]},([P,O])=>{if(!P||!Array.isArray(O))return;const M=O.map(K=>({...K,modifiers:K.modifiers.map(Q=>{if(!Q.sizes||Q.sizes.length===0)return Q;const W=Q.sizes.find(oe=>oe.id===P);return W?{...Q,size:W,price:W.price??Q.price}:Q})}));JSON.stringify(M)!==JSON.stringify(i.value.groupModifiersSelected)&&(i.value.groupModifiersSelected=M)},{deep:!0});const U={mounted:y};return l.onBeforeUnmount(()=>{window.removeEventListener("resize",y)}),(P,O)=>l.withDirectives((l.openBlock(),l.createElementBlock("div",{class:"slider_container",ref_key:"slider_container",ref:u},[l.createElementVNode("div",{class:"card_size_place_wrapper",ref_key:"sliderWrapper",ref:p},[l.unref(i).productSizes.length>1&&m.value?(l.openBlock(),l.createElementBlock("div",f0,[l.unref(i).productSizes.length>3?(l.openBlock(),l.createElementBlock("ul",{key:0,class:"card_size",style:l.normalizeStyle({transform:`translateX(-${x.value*_.value}px)`})},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(S.value,(M,K)=>(l.openBlock(),l.createElementBlock("li",{key:`${M.id}-${K}`,onClick:Q=>B(M,K),onKeydown:l.withKeys(Q=>B(M,K),["enter"]),class:l.normalizeClass({active:m.value.id===M.id&&m.value.index===M.originalIndex}),tabindex:"0",role:"button","aria-label":`Выбрать размер ${M.name}`},l.toDisplayString(M.alt_name?M.alt_name:M.name),43,h0))),128))],4)):(l.openBlock(),l.createElementBlock("ul",g0,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(i).productSizes,(M,K)=>(l.openBlock(),l.createElementBlock("li",{key:`${M.id}-${K}`,onClick:Q=>B(M,K),onKeydown:l.withKeys(Q=>B(M,K),["enter"]),class:l.normalizeClass({active:m.value.id===M.id&&m.value.index===K}),tabindex:"0",role:"button","aria-label":`Выбрать размер ${M.name}`},l.toDisplayString(M.alt_name?M.alt_name:M.name),43,m0))),128))])),C.value?l.withDirectives((l.openBlock(),l.createElementBlock("div",{key:2,class:"size_active",style:l.normalizeStyle(l.unref(i).productSizes.length<=3?{left:`${h.value}%`}:{})},[l.createElementVNode("p",null,l.toDisplayString(C.value.alt_name?C.value.alt_name:C.value.name),1)],4)),[[U]]):l.createCommentVNode("",!0)])):l.createCommentVNode("",!0)],512)],512)),[[l.vShow,l.unref(i).productSizes.length>1&&m.value]])}}),[["__scopeId","data-v-2fab37e4"]]),x0="data:image/svg+xml,%3csvg%20width='18'%20height='20'%20viewBox='0%200%2018%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M7.3063%2019.7525C8.12104%2019.7525%208.78152%2019.1097%208.78152%2018.3167C8.78152%2017.5236%208.12104%2016.8808%207.3063%2016.8808C6.49156%2016.8808%205.83108%2017.5236%205.83108%2018.3167C5.83108%2019.1097%206.49156%2019.7525%207.3063%2019.7525Z'%20fill='%23808080'/%3e%3cpath%20d='M7.3063%2019.2525C7.83733%2019.2525%208.26782%2018.8335%208.26782%2018.3167C8.26782%2017.7998%207.83733%2017.3808%207.3063%2017.3808C6.77526%2017.3808%206.34478%2017.7998%206.34478%2018.3167C6.34478%2018.8335%206.77526%2019.2525%207.3063%2019.2525Z'%20stroke='%23F2F7FF'%20stroke-width='0.999998'/%3e%3cpath%20d='M14.4716%2019.7525C15.2864%2019.7525%2015.9469%2019.1097%2015.9469%2018.3167C15.9469%2017.5236%2015.2864%2016.8808%2014.4716%2016.8808C13.6569%2016.8808%2012.9964%2017.5236%2012.9964%2018.3167C12.9964%2019.1097%2013.6569%2019.7525%2014.4716%2019.7525Z'%20fill='%23808080'/%3e%3cpath%20d='M14.4716%2019.2525C15.0027%2019.2525%2015.4332%2018.8335%2015.4332%2018.3167C15.4332%2017.7998%2015.0027%2017.3808%2014.4716%2017.3808C13.9406%2017.3808%2013.5101%2017.7998%2013.5101%2018.3167C13.5101%2018.8335%2013.9406%2019.2525%2014.4716%2019.2525Z'%20stroke='%23F2F7FF'%20stroke-width='0.999998'/%3e%3cpath%20d='M0.770536%203.75L4.56158%206.21L6.66771%2015.23H15.1025L17.2086%208.26'%20stroke='%23F2F7FF'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M9.19507%2011.95H12.2669H15.945'%20stroke='%23F2F7FF'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M11.1908%200.830648V7.34648L8.26615%204.49981C8.03242%204.27231%207.64886%204.27231%207.41513%204.49981C7.35957%204.55378%207.3155%204.61788%207.28542%204.68845C7.25535%204.75902%207.23987%204.83467%207.23987%204.91106C7.23987%204.98746%207.25535%205.06311%207.28542%205.13368C7.3155%205.20425%207.35957%205.26835%207.41513%205.32231L11.3646%209.16648C11.5983%209.39398%2011.9759%209.39398%2012.2096%209.16648L16.159%205.32231C16.2145%205.26831%2016.2585%205.20419%2016.2885%205.13363C16.3186%205.06307%2016.334%204.98744%2016.334%204.91106C16.334%204.83469%2016.3186%204.75906%2016.2885%204.6885C16.2585%204.61794%2016.2145%204.55382%2016.159%204.49981C16.1035%204.44581%2016.0377%204.40297%2015.9652%204.37374C15.8927%204.34451%2015.815%204.32947%2015.7365%204.32947C15.658%204.32947%2015.5803%204.34451%2015.5078%204.37374C15.4353%204.40297%2015.3695%204.44581%2015.314%204.49981L12.3894%207.34648V0.830648C12.3894%200.509814%2012.1197%200.247314%2011.7901%200.247314C11.4604%200.247314%2011.1908%200.509814%2011.1908%200.830648Z'%20fill='%23F2F7FF'/%3e%3c/svg%3e",w0={class:"counter_container"},_0={class:"card_size_place_wrapper",ref:"sliderWrapper"},C0={class:"cart_amount_counter"},E0={class:"button_circle_number"},y0=ze(l.defineComponent({__name:"NumberModifier",props:{qr_menu:{type:Boolean}},setup(o){const s=Tt(),{stateCard:i}=we.storeToRefs(s),u=ke.useRouter(),f=o,h=()=>{var x,_,p,C;(_=(x=u.options.history.state)==null?void 0:x.back)!=null&&_.includes("mode=pdf")&&f.qr_menu||(p=i.value.openCard)!=null&&p.amount&&((C=i.value.openCard)==null?void 0:C.amount)>1&&(i.value.openCard.amount-=1)},m=()=>{var x,_,p;(_=(x=u.options.history.state)==null?void 0:x.back)!=null&&_.includes("mode=pdf")&&f.qr_menu||(p=i.value.openCard)!=null&&p.amount&&(i.value.openCard.amount+=1)};return(x,_)=>{var p,C;return l.openBlock(),l.createElementBlock("div",w0,[l.createElementVNode("div",_0,[l.createElementVNode("div",C0,[l.createElementVNode("p",{class:l.normalizeClass(["cart_circle_minus",[((p=l.unref(i).openCard)==null?void 0:p.amount)===1?"card_circle_minus_alone":""]]),"aria-label":"Уменьшить количество продукта","data-clickable":"true",onClick:l.withModifiers(h,["stop","prevent"])},[..._[0]||(_[0]=[l.createElementVNode("span",null,null,-1)])],2),l.createElementVNode("p",E0,l.toDisplayString((C=l.unref(i).openCard)==null?void 0:C.amount),1),l.createElementVNode("p",{class:"cart_circle_plus","aria-label":"Увеличить количество продукта","data-clickable":"true",onClick:l.withModifiers(m,["stop","prevent"])},"+")])],512)])}}}),[["__scopeId","data-v-50b09b8c"]]);function ta(o,s=800){const i=l.ref(o),u=l.ref(o);let f=null,h=null,m=o;const x=_=>{h||(h=_);const p=_-h,C=Math.min(p/s,1),y=C<.5?4*C*C*C:1-Math.pow(-2*C+2,3)/2;i.value=Math.round(m+(u.value-m)*y),C<1?f=requestAnimationFrame(x):(i.value=u.value,f=null)};return l.watch(u,()=>{f&&cancelAnimationFrame(f),m=i.value,h=null,f=requestAnimationFrame(x)},{immediate:!0}),l.onUnmounted(()=>{f&&cancelAnimationFrame(f)}),{displayNumber:i,targetNumber:u,update:_=>{u.value=_}}}const Ht=l.defineComponent({__name:"RecountNumber",props:{price:{type:Number,required:!0},duration:{type:Number},fixedFloat:{type:Number,require:!1}},setup(o){const s=o,{displayNumber:i,update:u}=ta(s.price||0,s.duration||800);return l.watchEffect(()=>{u(s.price)}),(f,h)=>(l.openBlock(),l.createElementBlock("span",null,l.toDisplayString(l.unref(i).toFixed(o.fixedFloat)),1))}}),b0=["disabled","id"],cn=l.defineComponent({__name:"ButtonDefault",props:{textButtonDefault:{type:String,required:!0},disabled:{type:Boolean,default:!1},onClick:{type:Function,required:!0}},setup(o){const s=o,i=()=>{s.onClick()};return(u,f)=>(l.openBlock(),l.createElementBlock("button",{class:"buttonDefaultWrapper",disabled:o.disabled,onClick:i,id:o.disabled?"buttonDefaultDisabled":""},l.toDisplayString(o.textButtonDefault),9,b0))}}),A0={class:"notification_info"},I0={key:0,class:"notification_18plus"},S0={class:"notification_18plus_image"},N0=["src"],T0={class:"notification_18plus_text"},k0={class:"notification_18plus_accept"},R0={key:1,class:"notification_text"},O0={key:0,class:"wrapper_button_accept"},ao=l.defineComponent({__name:"NotificationWindow",props:l.mergeModels({textNotificationDefault:{},backgroundColor:{},buttonAccept:{},type:{type:Boolean},is_qr:{type:Boolean}},{visible:{default:!1},visibleModifiers:{}}),emits:["update:visible"],setup(o){const s=o,i=bt(),u=at(),{is18Allowed:f,notificationData_lib:h}=we.storeToRefs(u),{itemThemes:m}=we.storeToRefs(i),x=l.computed(()=>s.backgroundColor||"rgba(50, 50, 50, 0.9)"),_=l.computed(()=>{var T;return!!((T=m.value)!=null&&T.kiosk_hide_menu_update_notification)});let p;const C=l.useModel(o,"visible"),y=()=>{h.value.fastAdd&&(u.addToCart(h.value.fastAdd),h.value.fastAdd=null),sessionStorage.setItem("is_adult","true"),f.value=!0,C.value=!1,h.value.callback&&(h.value.callback(),h.value.callback=null)},S=()=>{C.value=!1},B=()=>{C.value=!1,clearTimeout(p)};return l.watch([C,()=>s.textNotificationDefault,_],([T,D,v],[U,P])=>{p&&(!T||T!==U||D!==P)&&clearTimeout(p),v&&T&&(p=setTimeout(B,4e3))},{immediate:!0}),l.onUnmounted(()=>{p&&B()}),(T,D)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[!_.value&&C.value?(l.openBlock(),l.createBlock(l.Transition,{key:0,name:"notificationBlack",appear:""},{default:l.withCtx(()=>[l.createElementVNode("div",{class:"notification_background_black",onClick:S})]),_:1})):l.createCommentVNode("",!0),l.createVNode(l.Transition,{name:"notification"},{default:l.withCtx(()=>{var v;return[C.value?(l.openBlock(),l.createElementBlock("div",{key:0,class:"notification_overlay",onClick:S},[l.createElementVNode("div",{class:"notification_wrapper",style:l.normalizeStyle({"background-color":x.value,border:`2px solid ${x.value}`})},[l.createElementVNode("div",A0,[o.type?(l.openBlock(),l.createElementBlock("div",I0,[l.createElementVNode("div",S0,[l.createElementVNode("img",{src:l.unref(m).adult_disclaimer_image||l.unref(m).fallback_image,alt:"Дисклеймер"},null,8,N0)]),l.createElementVNode("div",T0,l.toDisplayString(l.unref(m).adult_disclaimer_text),1),l.createElementVNode("div",k0,[D[0]||(D[0]=l.createElementVNode("label",{for:"plus18"},"Содержащиеся в настоящем разделе материалы предназначены для лиц старше 18 лет, носят информационный характер об ассортименте товаров и не являются рекламой. ",-1)),l.createVNode(cn,{textButtonDefault:"Мне есть 18",onClick:y,style:{fontSize:"1rem",padding:"6px 24px",marginLeft:"10px"}})])])):(l.openBlock(),l.createElementBlock("div",R0,[l.createTextVNode(l.toDisplayString(o.textNotificationDefault)+" ",1),(v=o.buttonAccept)!=null&&v.state?(l.openBlock(),l.createElementBlock("div",O0,[l.createVNode(cn,{class:"button_accept",textButtonDefault:o.buttonAccept.text,onClick:o.buttonAccept.acceptBtn,disabled:o.buttonAccept.disabled},null,8,["textButtonDefault","onClick","disabled"])])):l.createCommentVNode("",!0)]))])],4)])):l.createCommentVNode("",!0)]}),_:1})],64))}}),M0={class:"button_price button_price_modifiers"},B0=["src"],v0={class:"button_text_container"},D0={class:"button_text_price"},P0=ze(l.defineComponent({__name:"ButtonPriceCount",props:{qr_menu:{type:Boolean,default:!1},closeProduct:{}},setup(o){const s=ke.useRouter(),i=ke.useRoute(),u=Tt(),f=at(),h=bt(),m=l.ref([]),x=l.ref([]),_=o,{stateCard:p,totalPrice_libCard:C,isOpenWindow:y,isAddToCard:S}=we.storeToRefs(u),{isDesktop:B}=In(),{itemThemes:T}=we.storeToRefs(h),D=l.ref(!0),v=l.ref(!1),U=l.computed(()=>B.value?!1:D.value),P=()=>{var M,K,Q,W,oe;if((K=(M=s.options.history.state)==null?void 0:M.back)!=null&&K.includes("mode=pdf")&&_.qr_menu)return;if(D.value){u.setCurrentCard(p.value.openCard),v.value=!0;const V=p.value.groupModifiers.findIndex(ce=>u.checkedRequiredBtn.group.id===ce.id);u.checkedRequiredBtn.haveRequaire&&u.toggleNotRequire(u.checkedRequiredBtn.group,V);return}const O=p.value.groupModifiersSelected||[];if(m.value=[],x.value=[],Array.isArray(O)&&O.length>0&&O.forEach(V=>{const ce=V.group,j=V.modifiers||[];ce==="Добавки2000"?m.value=j.map(G=>{var z;return{...G,old_price:G.price,size:Array.isArray(G.size)?G.size.map(X=>X.id).filter(Boolean):(z=G.size)!=null&&z.id?G.size.id:void 0}}):j.length>0&&x.value.push({group:ce,is_fake:V.is_fake||!1,is_product_determining:V.is_product_determining||!1,modifiers:j.map(G=>{var z;return{...G,old_price:G.price,size:Array.isArray(G.size)?G.size.map(X=>X.id).filter(Boolean):(z=G.size)!=null&&z.id?G.size.id:void 0}})})}),document.body.style.overflow="",p.value.openCard){const V={id:p.value.openCard.id,is_fake:p.value.openCard.is_fake||!1,is_od_united_product:p.value.openCard.is_od_united_product||!1,amount:p.value.openCard.amount,name:p.value.openCard.name,image_link:p.value.openCard.image_link,price:p.value.openCard.price,old_price:p.value.openCard.price,size:((Q=p.value.selectedSize)==null?void 0:Q.id)??((oe=(W=p.value.openCard.sizes)==null?void 0:W.find(ce=>ce.is_default))==null?void 0:oe.id),sizes:p.value.openCard.sizes||[],modifiers:m.value,groups:p.value.openCard.groups,group_modifiers:x.value,energy_amount:p.value.openCard.energy_amount??0,proteins_amount:p.value.openCard.proteins_amount??0,fat_amount:p.value.openCard.fat_amount??0,carbohydrates_amount:p.value.openCard.carbohydrates_amount??0};_.closeProduct&&_.closeProduct(),f.addToCart(V),S.value=!0}y.value=!1,_.qr_menu&&s.push(`/${i.params.orgId}/`)};return l.watch(()=>p.value.productSizes,O=>{!O||O.length===0||!p.value.selectedSize||(p.value.selectedSize={...p.value.selectedSize})},{immediate:!0}),l.watchEffect(()=>{u.checkedRequiredBtn.haveRequaire?D.value=!0:D.value=!1}),l.onMounted(()=>{S.value=!1}),(O,M)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[(l.openBlock(),l.createBlock(l.Teleport,{to:"body"},[l.createVNode(ao,{visible:v.value,textNotificationDefault:l.unref(p).textErrorRequaired,backgroundColor:l.unref(T).accent_color?l.unref(T).accent_color:"#FF6D2E",buttonAccept:null,"onUpdate:visible":M[0]||(M[0]=K=>v.value=K)},null,8,["visible","textNotificationDefault","backgroundColor"])])),l.createElementVNode("div",{class:"button_price_bg_product",onTouchstart:M[3]||(M[3]=l.withModifiers(()=>{},["stop"])),onPointerdown:M[4]||(M[4]=l.withModifiers(()=>{},["stop"]))},[l.createElementVNode("div",M0,[l.unref(B)?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(y0,{key:0,qr_menu:o.qr_menu},null,8,["qr_menu"])),l.createElementVNode("div",{class:l.normalizeClass(["card_product_button_buy",{buy_active:!U.value}]),"data-clickable":"true",onClick:P,onTouchstart:M[1]||(M[1]=l.withModifiers(()=>{},["stop"])),onPointerdown:M[2]||(M[2]=l.withModifiers(()=>{},["stop"]))},[l.unref(B)?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("img",{key:0,src:l.unref(x0),class:"card_product_button_icon"},null,8,B0)),l.createElementVNode("div",v0,[l.createElementVNode("p",D0,[l.createVNode(Ht,{price:+l.unref(C),fixedFloat:2},null,8,["price"]),M[5]||(M[5]=l.createTextVNode(" ₽ ",-1))])])],34)])],32)],64))}}),[["__scopeId","data-v-4ebdaed7"]]),L0={class:"modified_amount"},F0={class:"hide_image_corners"},V0=["src"],U0={class:"wrapper_modifier_title"},z0={class:"amount_title"},H0={class:"wrapper_amount_counter"},G0={class:"amount_count"},W0={class:"amount_wrapper"},X0={class:"add_counter_amount"},j0=ze(l.defineComponent({__name:"ModalAmount",setup(o){const s=Tt(),i=bt(),{itemThemes:u}=we.storeToRefs(i),{stateCard:f}=we.storeToRefs(s),h=l.computed(()=>{var _,p,C;return((C=(p=(_=f.value.currentModifier)==null?void 0:_.sizes)==null?void 0:p.find(y=>y.id===f.value.selectedSize.id))==null?void 0:C.price)??ur(f.value.currentModifier)}),m=()=>{f.value.currentModifier&&(f.value.currentModifier.amount=f.value.modalCount),s.modifierSelect(f.value.currentModifier),f.value.isModifiedAmount=!1},x=()=>{f.value.modalCount=1,f.value.currentModifier.amount=1};return(_,p)=>{var C,y;return l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createElementVNode("div",L0,[l.createElementVNode("div",F0,[l.createElementVNode("img",{class:"modifier_image",src:((C=l.unref(f).currentModifier)==null?void 0:C.image_link)||l.unref(u).fallback_image||""},null,8,V0),l.createElementVNode("div",U0,[l.createElementVNode("p",z0,l.toDisplayString((y=l.unref(f).currentModifier)==null?void 0:y.name),1),l.createElementVNode("p",null,"+ "+l.toDisplayString(h.value)+"₽",1)])])]),l.createElementVNode("div",H0,[l.createElementVNode("div",{class:"amount_mines",onClick:p[0]||(p[0]=l.withModifiers((...S)=>l.unref(s).minusAmount&&l.unref(s).minusAmount(...S),["stop"]))},[...p[1]||(p[1]=[l.createElementVNode("div",null,null,-1)])]),l.createElementVNode("p",G0,l.toDisplayString(l.unref(f).modalCount),1),l.createElementVNode("div",W0,[l.createVNode(oo,{onClick:l.withModifiers(l.unref(s).plusAmount,["stop"])},null,8,["onClick"])])]),l.createElementVNode("p",{class:"clear_count",onClick:l.withModifiers(x,["stop"])},"Убрать все"),l.createElementVNode("div",X0,[l.createVNode(cn,{textButtonDefault:"Добавить",onClick:m,class:"button_add_group_modifiers"})])],64)}}}),[["__scopeId","data-v-84debd5d"]]),q0=(o,s,i)=>Math.max(s,Math.min(o,i)),Z0=(o,s)=>Math.pow(o,s*5),na=(o,s,i)=>s===0||Math.abs(s)===1/0?Z0(o,i):o*s*i/(s+i*o),pi=(o,s)=>s*parseFloat(o)/100,lo=(o,s,i,u=.15)=>u===0?q0(o,s,i):o<s?-na(s-o,i-s,u)+s:o>i?+na(o-i,i-s,u)+i:o,rn=(o,{min:s,max:i})=>s!==void 0&&o<s?s:i!==void 0&&o>i?i:o;function Y0(o,s,i){const u=l.ref(0),f=l.computed(()=>o.value.map(_=>typeof _=="string"?pi(_,i.value):_)),h=l.computed(()=>Math.min(...f.value)),m=l.computed(()=>Math.max(...f.value)),x=l.computed(()=>{const _=f.value.reduce((p,C)=>Math.abs(C-s.value)<Math.abs(p-s.value)?C:p);return f.value.indexOf(_)});return{currentSnapPointIndex:u,flattenedSnapPoints:f,minSnapPoint:h,maxSnapPoint:m,closestSnapPointIndex:x}}const co=ze(l.defineComponent({__name:"BottomSheet",props:{duration:{default:250},snapPoints:{},initialSnapPoint:{},blocking:{type:Boolean,default:!0},canSwipeClose:{type:Boolean,default:!0},swipeCloseThreshold:{},canBackdropClose:{type:Boolean,default:!0},expandOnContentDrag:{type:Boolean,default:!0},modelValue:{type:Boolean},teleportTo:{default:"body"},teleportDefer:{type:Boolean,default:!1},headerClass:{},contentClass:{},footerClass:{}},emits:["opened","opening-started","closed","closing-started","ready","dragging-up","dragging-down","snapped","instinctHeight","update:modelValue"],setup(o,{expose:s,emit:i}){const u=o,f=i;let h=null;const m=l.ref(0),x=zt.useVModel(u,"modelValue",f,{passive:!0});l.watch(x,ue=>{ue&&ge()}),l.onMounted(()=>{x.value&&ge()});const _=l.ref(),p=l.ref(null),C=l.ref(null),y=l.ref(null),S=l.ref(null),B=l.ref(u.expandOnContentDrag),{height:T}=zt.useWindowSize(),{height:D}=zt.useElementBounding(_),{height:v}=zt.useElementBounding(p),{height:U}=zt.useElementBounding(S),{height:P}=zt.useElementBounding(C),O=l.computed({get(){return rn(Math.ceil(U.value+v.value+P.value),{max:T.value})},set(ue){[v.value,U.value,P.value]=ue}}),M=l.ref(0),K=l.ref(0),Q=yt.useMotionValue(0),W=yt.useMotionValue(0),{snapPoints:oe}=l.toRefs(u),V=l.computed(()=>oe.value??[O.value]),{flattenedSnapPoints:ce,currentSnapPointIndex:j,closestSnapPointIndex:G,minSnapPoint:z,maxSnapPoint:X}=Y0(V,M,T);let N;function Y(ue){B.value=!0,H(ue)}function H(ue){B.value&&ue.preventDefault()}const te=ue=>{ue.key==="Escape"&&Ie()},Z=()=>{u.canBackdropClose&&Ie()};let re=!1;const ge=async()=>{var ue;if(!re){me&&(me=!1,h&&(clearTimeout(h),h=null)),m.value++,x.value=!0,re=!0,f("opening-started");try{await l.nextTick(),await l.nextTick();const Xe=(ue=_.value)==null?void 0:ue.$el;if(!Xe){console.warn("[BottomSheet] sheet not ready, aborting"),x.value=!1;return}D.value=Xe.getBoundingClientRect().height;const Ke=Xe.querySelector("[data-vsbs-content]"),mt=Xe.querySelector("[data-vsbs-header]"),tt=Xe.querySelector("[data-vsbs-footer]");if(O.value=[mt.getBoundingClientRect().height,Ke.getBoundingClientRect().height,tt.getBoundingClientRect().height],await l.nextTick(),j.value=ce.value.findIndex(Ue=>Ue===z.value),u.initialSnapPoint){const Ue=u.initialSnapPoint;if(Ue<0||Ue>=V.value.length)return console.warn("Index out of bounds");M.value=typeof V.value[Ue]=="number"?rn(V.value[Ue],{max:T.value}):pi(V.value[Ue],T.value)}else M.value=rn(z.value,{max:T.value});K.value=M.value,Q.jump(M.value),W.jump(M.value),requestAnimationFrame(()=>{N=yt.animate(Q,M.value,{duration:u.duration/1e3,ease:"easeInOut"}),N=yt.animate(W,0,{duration:u.duration/1e3,ease:"easeInOut",onComplete:()=>{u.blocking&&f("opened")}})}),window.addEventListener("keydown",te)}finally{re=!1}}};let me=!1;const Ie=()=>{me||(re&&(re=!1),N&&N.stop(),x.value=!1,me=!0,f("closing-started"),window.removeEventListener("keydown",te),h&&clearTimeout(h),h=setTimeout(()=>{f("closed"),me=!1,h=null},u.duration))},_e=ue=>{if(V.value){if(ue<0||ue>=V.value.length){console.warn("Index out of bounds");return}j.value=ue,M.value=typeof V.value[ue]=="number"?rn(V.value[ue],{max:T.value}):pi(V.value[ue],T.value),N=yt.animate(Q,M.value,{duration:u.duration/1e3,ease:"easeInOut",onComplete:()=>f("snapped",V.value.indexOf(V.value[ue]))})}};function Fe(ue){ue>0?f("dragging-down"):ue<0&&f("dragging-up")}const xe=()=>{M.value=D.value,K.value=W.get(),Q.jump(M.value),W.jump(K.value)},lt=async(ue,Xe)=>{await l.nextTick(),_.value&&(K.value<=0&&(M.value-=Xe.delta.y),M.value<=z.value&&(M.value=z.value,K.value+=Xe.delta.y,W.set(u.canSwipeClose?rn(K.value,{min:0}):rn(lo(K.value,-D.value,0,.5),{min:0}))),Q.set(rn(lo(M.value,0,X.value,.25),{min:0,max:T.value})),Fe(Xe.delta.y))},Oe=()=>{if(u.canSwipeClose){let ue=M.value/2;u.swipeCloseThreshold&&typeof u.swipeCloseThreshold=="number"&&(ue=u.swipeCloseThreshold),u.swipeCloseThreshold&&typeof u.swipeCloseThreshold=="string"&&u.swipeCloseThreshold.includes("%")&&(ue=M.value*(Number(u.swipeCloseThreshold.replace("%",""))/100)),Math.abs(K.value)>ue&&(K.value=M.value)}else K.value=0;if(N=yt.animate(W,K.value,{duration:u.duration/1e3,ease:"easeInOut"}),K.value===M.value){K.value=0,Ie();return}j.value=G.value,M.value=typeof V.value[G.value]=="number"?rn(V.value[G.value],{max:T.value}):pi(V.value[G.value],T.value),N=yt.animate(Q,M.value,{duration:u.duration/1e3,ease:"easeInOut",onComplete:()=>f("snapped",V.value.indexOf(V.value[G.value]))}),N=yt.animate(W,0,{duration:u.duration/1e3,ease:"easeInOut"})},Re=(ue,Xe)=>{if(M.value=D.value,K.value=W.get(),N&&N.stop(),!y.value)return;const Ke=y.value.scrollTop===0,mt=Xe.delta.y>0,tt=ce.value.length===1,Ue=.5>Math.abs(M.value-X.value);if(tt){if(!u.expandOnContentDrag)return B.value=!1;W.get()===0&&Ke&&mt&&(B.value=!0),W.get()===0&&Ke&&!mt&&(B.value=!1)}else{if(!u.expandOnContentDrag)return B.value=!1;B.value=!0,Ue&&(mt&&Ke&&(B.value=!0),!mt&&Ke&&(B.value=!1),Ke||(B.value=!1))}},qe=async(ue,Xe)=>{if(await l.nextTick(),!u.expandOnContentDrag)return B.value=!1;if(!_.value)return;K.value===0&&B.value&&u.expandOnContentDrag&&(M.value-=Xe.delta.y),M.value<=z.value&&(M.value=z.value,B.value&&u.expandOnContentDrag&&(K.value+=Xe.delta.y),K.value=rn(K.value,{min:0,max:z.value}),W.set(u.canSwipeClose?rn(K.value,{min:0}):rn(lo(K.value,-D.value,0,.5),{min:0}))),M.value>X.value&&(M.value=X.value),M.value=rn(M.value,{max:T.value}),!(ce.value.length===1)&&M.value===X.value&&(B.value=!1),Q.set(M.value),Fe(Xe.delta.y)},$e=()=>{if(!y.value)return;const ue=y.value.scrollTop===0;B.value=ue},It=zt.useDebounceFn(ue=>_e(ue),u.duration);return l.watch(V,(ue,Xe)=>{if(x.value===!1||!ue||!Xe)return;const Ke=ue[j.value],mt=Xe[j.value];typeof Ke!="string"&&typeof mt!="string"&&(M.value=rn(Ke,{max:T.value}),Ke!==mt&&(N=yt.animate(Q,M.value,{duration:u.duration/1e3,ease:"easeInOut"})))}),l.watch(T,()=>It(j.value)),s({open:ge,close:Ie,snapToPoint:_e}),l.onUnmounted(()=>{h&&clearTimeout(h)}),(ue,Xe)=>(l.openBlock(),l.createBlock(l.Teleport,{to:o.teleportTo,defer:o.teleportDefer},[l.createElementVNode("div",l.mergeProps(ue.$attrs,{"data-vsbs-container":""}),[l.createVNode(l.unref(yt.AnimatePresence),null,{default:l.withCtx(()=>[l.unref(x)&&o.blocking?(l.openBlock(),l.createBlock(l.unref(yt.Motion),{ref:"backdrop",key:"backdrop-"+m.value,"data-vsbs-backdrop":"",onClick:Xe[0]||(Xe[0]=Ke=>Z()),transition:{ease:"easeInOut",duration:o.duration/1e3},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}},null,8,["transition"])):l.createCommentVNode("",!0)]),_:1}),l.createVNode(l.unref(yt.AnimatePresence),null,{default:l.withCtx(()=>[l.unref(x)?(l.openBlock(),l.createBlock(l.unref(yt.Motion),{ref_key:"sheet",ref:_,exit:{y:"100%",height:l.unref(D),opacity:0},initial:!1,key:m.value,style:l.normalizeStyle({y:l.unref(W),z:1,height:l.unref(Q)}),"data-vsbs-shadow":!o.blocking,"data-vsbs-sheet-show":l.unref(x),"aria-modal":"true","data-vsbs-sheet":"",tabindex:"-1"},{default:l.withCtx(()=>[l.createVNode(l.unref(yt.Motion),{ref_key:"sheetHeader",ref:p,"data-vsbs-header":"",onPanStart:xe,onPan:lt,onPanEnd:Oe,onTouchmove:Y,class:l.normalizeClass(o.headerClass)},{default:l.withCtx(()=>[l.renderSlot(ue.$slots,"header",{},void 0,!0)]),_:3},8,["class"]),l.createElementVNode("div",{ref_key:"sheetScroll",ref:y,"data-vsbs-scroll":"",onScrollend:$e},[l.createVNode(l.unref(yt.Motion),{ref:"sheetContentWrapper","data-vsbs-content-wrapper":"",onPanStart:Re,onPan:qe,onPanEnd:Oe,onTouchmove:H},{default:l.withCtx(()=>[l.createElementVNode("div",{ref_key:"sheetContent",ref:S,"data-vsbs-content":"",class:l.normalizeClass(o.contentClass)},[l.renderSlot(ue.$slots,"default",{},void 0,!0)],2)]),_:3},512)],544),l.createVNode(l.unref(yt.Motion),{ref_key:"sheetFooter",ref:C,"data-vsbs-footer":"",onPanStart:xe,onPan:lt,onPanEnd:Oe,onTouchmove:Y,class:l.normalizeClass(o.footerClass)},{default:l.withCtx(()=>[l.renderSlot(ue.$slots,"footer",{},void 0,!0)]),_:3},8,["class"])]),_:3},8,["exit","style","data-vsbs-shadow","data-vsbs-sheet-show"])):l.createCommentVNode("",!0)]),_:3})],16)],8,["to","defer"]))}}),[["__scopeId","data-v-5acf0656"]]);function Pn(o,s=null){const i=ti();i.initCacheSingle("defaultImage");const u=l.computed(()=>i.cache.defaultImage||null),f=l.shallowRef(!1),h=l.computed(()=>{var p;return((p=l.toValue(o))==null?void 0:p.toString())||null}),m=zt.computedAsync(async()=>{const p=h.value;return p?(await i.initCacheSingle(p),i.cache[p]||null):null},null,{evaluating:f}),x=l.computed(()=>f.value&&h.value!==null);return{mediaUrl:l.computed(()=>m.value||l.toValue(s)||u.value||null),isLoading:x}}const $0={class:"card_product_modifiers_sheet_body"},K0={class:"card__pictures"},Q0=["src"],J0=["src"],e1={class:"card_header_wrapper"},t1={key:0,class:"card_fire_kkal_wrapper"},n1={class:"card_content"},r1={class:"wrapper_size"},i1={key:0,class:"description"},o1={key:1},s1=ze(l.defineComponent({__name:"CardProductPage",props:{configPage:{}},setup(o){const s=bt(),i=Tt(),{stateCard:u,isOpenWindow:f}=we.storeToRefs(i),{itemThemes:h}=we.storeToRefs(s),m=ke.useRouter(),x=ke.useRoute(),_=o,p=l.computed(()=>!!(x.query.mode==="pdf"&&_.configPage.qr_menu)),{mediaUrl:C}=Pn(()=>{var B,T;return(B=u.value.openCard)!=null&&B.video_link?`${u.value.openCard.id}_video`:(T=u.value.openCard)!=null&&T.image_link?`${u.value.openCard.id}_image`:null},()=>{var B,T;return((B=u.value.openCard)==null?void 0:B.video_link)||((T=u.value.openCard)==null?void 0:T.image_link)||null}),y=()=>{_.configPage.qr_menu?p.value?m.push(`/${x.params.orgId}?mode=pdf`):m.push(`/${x.params.orgId}`):_.configPage.closeProduct()},S=()=>{u.value.isModifiedAmount=!1};return l.watch(()=>_.configPage.data,i.setCurrentCard),l.watch(()=>u.value.isSectionModifier,B=>{p.value&&document.body.classList.toggle("pdf_hidden",B)},{immediate:!0}),l.watchEffect(()=>{f.value||(f.value=_.configPage.is_closeProduct)}),l.onBeforeUnmount(()=>i.reset()),(B,T)=>{var D,v,U,P,O,M;return l.openBlock(),l.createElementBlock("div",{class:"card_product_wrapper",style:l.normalizeStyle(p.value?"user-select: none;":"")},[l.createVNode(l.unref(co),{modelValue:l.unref(u).isSectionModifier,"onUpdate:modelValue":T[1]||(T[1]=K=>l.unref(u).isSectionModifier=K),class:"card_product_modifiers_sheet",teleportTo:p.value?"#app":"body"},{default:l.withCtx(()=>[l.createElementVNode("div",$0,[l.createVNode(d0,{onClose:T[0]||(T[0]=K=>l.unref(u).isSectionModifier=!1)}),l.createVNode(ea,{isSectionModifier:l.unref(u).isSectionModifier,toggleNotRequire:l.unref(i).toggleNotRequire},null,8,["isSectionModifier","toggleNotRequire"])])]),_:1},8,["modelValue","teleportTo"]),(l.openBlock(),l.createBlock(l.Teleport,{to:"body"},[l.unref(u).isModifiedAmount?(l.openBlock(),l.createElementBlock("div",{key:0,class:"wrapper_modified_amount",onClick:l.withModifiers(S,["stop"])},[l.createVNode(j0)])):l.createCommentVNode("",!0)])),l.createElementVNode("div",K0,[(D=l.unref(u).openCard)!=null&&D.video_link&&l.unref(C)?l.withDirectives((l.openBlock(),l.createElementBlock("video",{key:l.unref(C),loop:"",autoplay:"",muted:"",playsinline:"",class:"card__video"},[l.createElementVNode("source",{src:l.unref(C)||"",type:"video/webm"},null,8,Q0)])),[[l.unref(Ur)]]):(l.openBlock(),l.createElementBlock("img",{key:1,class:"card__pictures_images",src:l.unref(C)||"",alt:"Product image"},null,8,J0)),l.createElementVNode("div",e1,[l.createVNode(Vr,{class:"card_header_back",onClick:y,"aria-label":"Вернуться назад"}),(v=l.unref(u).openCard)!=null&&v.energy_amount?(l.openBlock(),l.createElementBlock("div",t1,[T[3]||(T[3]=l.createElementVNode("div",{class:"card_fire_kkal"},null,-1)),l.createElementVNode("p",null,[l.createElementVNode("b",null,l.toDisplayString((U=l.unref(u).openCard)==null?void 0:U.energy_amount),1),T[2]||(T[2]=l.createTextVNode(" Ккал ",-1))])])):l.createCommentVNode("",!0)]),l.createElementVNode("h4",null,l.toDisplayString((P=l.unref(u).openCard)==null?void 0:P.name),1),l.createElementVNode("div",{class:"card__pictures__gradient",style:l.normalizeStyle(l.unref(h).gradientStyle)},null,4)]),l.createElementVNode("div",n1,[l.createElementVNode("div",r1,[l.createVNode(p0)]),(O=l.unref(u).openCard)!=null&&O.description?(l.openBlock(),l.createElementBlock("p",i1,l.toDisplayString((M=l.unref(u).openCard)==null?void 0:M.description),1)):l.createCommentVNode("",!0),l.unref(u).groupModifiers.length?(l.openBlock(),l.createElementBlock("div",o1,[T[4]||(T[4]=l.createElementVNode("p",{class:"title_info_modifiers"},"Настрой, как ты любишь",-1)),l.createVNode(ea,{isSectionModifier:l.unref(u).isSectionModifier,toggleNotRequire:l.unref(i).toggleNotRequire},null,8,["isSectionModifier","toggleNotRequire"])])):l.createCommentVNode("",!0),l.createVNode(P0,{qr_menu:o.configPage.qr_menu,closeProduct:o.configPage.closeProduct},null,8,["qr_menu","closeProduct"])])],4)}}}),[["__scopeId","data-v-a92cd973"]]),a1={key:0,class:"popupWindowDefault_overlay"},ra=ze(l.defineComponent({__name:"PopupWindowDefault",props:{visible:{type:Boolean}},emits:["update:visible"],setup(o,{emit:s}){const i=o,u=s,f=()=>{u("update:visible",!1)};return l.watch(()=>i.visible,async h=>{h&&await l.nextTick(),i.isVisible=h}),(h,m)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createVNode(l.Transition,{name:"popupWindowDefaultBlack",appear:"",onAfterLeave:m[0]||(m[0]=()=>{u("update:visible",!1)})},{default:l.withCtx(()=>[i.visible?(l.openBlock(),l.createElementBlock("div",{key:0,class:"background_black",onClick:f})):l.createCommentVNode("",!0)]),_:1}),l.createVNode(l.Transition,{name:"popupWindowDefault",appear:"",onAfterLeave:m[1]||(m[1]=()=>{u("update:visible",!1)})},{default:l.withCtx(()=>[i.visible?(l.openBlock(),l.createElementBlock("div",a1,[l.renderSlot(h.$slots,"default",{},void 0,!0)])):l.createCommentVNode("",!0)]),_:3})],64))}}),[["__scopeId","data-v-08e0e008"]]),l1={},c1={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function u1(o,s){return l.openBlock(),l.createElementBlock("svg",c1,[...s[0]||(s[0]=[l.createElementVNode("path",{d:"M18 18L12 12M12 12L6 6M12 12L18 6M12 12L6 18",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const d1=ze(l1,[["render",u1]]),uo=we.defineStore("modals",()=>{const o=new Map,s=(f,h)=>{const m=u(f).value;m.visible=!0,m.context=h},i=f=>{const h=u(f).value;h.visible=!1},u=f=>(o.has(f)||o.set(f,l.ref({visible:!1})),o.get(f));return{state:u,open:s,close:i}}),f1=["src"],h1={class:"cart_box_content_wrapper"},g1={class:"cart_box_content_info"},m1={class:"cart_amount"},p1={class:"cart_amount_count"},x1={class:"cart_box_info_more"},w1={key:1,class:"cart_modifier_info"},_1={class:"cart_modifier_content"},C1={class:"wrapper_price_count_cart"},E1={class:"count_cart_box"},y1={class:"wrapper_modifiers_discount"},ia=ze(l.defineComponent({__name:"CartBox",props:{index:Number,cardItem:Object},emits:["delete"],setup(o,{emit:s}){const i=o,u=at(),f=bt(),h=uo(),{itemThemes:m}=we.storeToRefs(f),x=l.ref(0),_=l.ref(0),p=l.ref(!1),C=l.ref(!1),y=l.ref(!1),{displayNumber:S,update:B}=ta(0,800),T=l.computed(()=>{var j,G;const V=((j=i.cardItem)==null?void 0:j.modifiers)??[],ce=(((G=i.cardItem)==null?void 0:G.group_modifiers)??[]).flatMap(z=>z.modifiers??[]);return[...V,...ce]}),{mediaUrl:D}=Pn(()=>{var V;return((V=i.cardItem)==null?void 0:V.id)+"_image"},()=>{var V;return(V=i.cardItem)==null?void 0:V.image_link}),v=l.computed(()=>{var V,ce;return((V=i.cardItem)==null?void 0:V.total_new_price)??ur(i.cardItem)*((ce=i.cardItem)==null?void 0:ce.amount)}),U=()=>h.open("cart-delete-confirm",i.cardItem),P=()=>{y.value=!y.value},O=()=>{u.plusAmount(i.cardItem.idSystem)},M=()=>{i.cardItem.amount>1?u.minusAmount(i.cardItem.idSystem):U()},K=V=>{x.value=V.touches[0].clientX,p.value=!0},Q=V=>{p.value&&(_.value=V.touches[0].clientX-x.value,_.value>0&&(_.value=0))},W=()=>{p.value=!1,_.value<-115&&U(),_.value=0};l.onMounted(()=>{i.index===0&&(C.value=!0,setTimeout(()=>{_.value=-90,setTimeout(()=>{_.value=0,C.value=!1},700)},0))});const oe=l.computed(()=>{const V=i.index===0&&C.value?1:`${1-Math.abs(_.value)/200}`;return{transform:`translateX(${_.value}px)`,opacity:V,transition:p.value?"none":"transform 0.7s, opacity 0.7s"}});return l.watch(v,B,{immediate:!0}),(V,ce)=>{var j,G,z,X;return l.openBlock(),l.createElementBlock("div",{class:"cart_box_wrapper",onTouchstart:K,onTouchmove:Q,onTouchend:W,style:l.normalizeStyle(oe.value)},[ce[2]||(ce[2]=l.createElementVNode("div",{class:"wrapper_cart_delete"},[l.createElementVNode("div",{class:"cart_delete"})],-1)),l.createElementVNode("img",{src:l.unref(D)||"",class:"cart_box_image"},null,8,f1),l.createElementVNode("div",h1,[l.createElementVNode("div",g1,[l.createElementVNode("p",null,l.toDisplayString((j=o.cardItem)==null?void 0:j.name),1),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(((G=i.cardItem)==null?void 0:G.discounts)||[],(N,Y)=>(l.openBlock(),l.createElementBlock("div",{key:Y,class:"discount_banner"},[l.createElementVNode("p",null,l.toDisplayString(N.name),1),l.createElementVNode("p",null,l.toDisplayString(N.discount)+"₽",1)]))),128)),l.createElementVNode("div",m1,[l.createElementVNode("button",{onClick:M},"-"),l.createElementVNode("p",p1,l.toDisplayString(i.cardItem.amount),1),l.createElementVNode("button",{onClick:O},"+")])]),l.createElementVNode("div",x1,[l.createElementVNode("div",{class:"cart_box_remove_item",onClick:U},[l.createVNode(d1)]),(z=i.cardItem)!=null&&z.new_price?(l.openBlock(),l.createElementBlock("p",{key:0,class:l.normalizeClass({discount_new_price:(X=i.cardItem)==null?void 0:X.new_price})},l.toDisplayString((i.cardItem.new_price*i.cardItem.amount).toFixed(2)+"₽"),3)):l.createCommentVNode("",!0),l.createElementVNode("p",null,l.toDisplayString(l.unref(S).toFixed(2)+"₽"),1)])]),!y.value&&T.value.length>0?(l.openBlock(),l.createElementBlock("div",{key:0,class:"cart_modifier_toggle",onTouchstart:l.withModifiers(P,["stop"])},[...ce[0]||(ce[0]=[l.createElementVNode("p",{class:"cart_info_more"},"Посмотреть модификаторы",-1),l.createElementVNode("p",{class:"cart_arrow"},null,-1)])],32)):l.createCommentVNode("",!0),y.value?(l.openBlock(),l.createElementBlock("div",w1,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(T.value,N=>{var Y;return l.openBlock(),l.createElementBlock("div",{class:"cart_modifier_item",key:N.id},[l.createElementVNode("div",_1,[l.createVNode(oo,{id:"plus_orange"}),l.createElementVNode("p",null,l.toDisplayString(N.name),1)]),l.createElementVNode("div",C1,[l.createElementVNode("p",E1,l.toDisplayString(`x${N.amount}`),1),l.createElementVNode("div",y1,[N!=null&&N.new_price?(l.openBlock(),l.createElementBlock("p",{key:0,class:l.normalizeClass({discount_new_price:(Y=N==null?void 0:N.new_price)==null?void 0:Y.toFixed(2)})},l.toDisplayString((N.new_price*N.amount).toFixed(2)+"₽"),3)):l.createCommentVNode("",!0),l.createElementVNode("p",null,l.toDisplayString((N.total_new_price??N.price*N.amount).toFixed(2)+"₽"),1)])])])}),128)),l.createElementVNode("div",{class:"cart_modifier_arrow",onTouchstart:l.withModifiers(P,["stop"])},[...ce[1]||(ce[1]=[l.createElementVNode("p",{class:"cart_info_more"},"Скрыть",-1),l.createElementVNode("p",{class:"cart_arrow_top"},null,-1)])],32)])):l.createCommentVNode("",!0)],36)}}}),[["__scopeId","data-v-b69f6323"]]),b1={},A1={class:"nfc_x",viewBox:"0 0 48 48"};function I1(o,s){return l.openBlock(),l.createElementBlock("svg",A1,[...s[0]||(s[0]=[l.createElementVNode("rect",{x:"8",y:"12",width:"32",height:"24",rx:"4",ry:"4",stroke:"#B00020","stroke-width":"2.4",fill:"none"},null,-1),l.createElementVNode("path",{d:"M14 16L34 30M34 16L14 30",stroke:"#B00020","stroke-width":"3","stroke-linecap":"round"},null,-1)])])}const S1=ze(b1,[["render",I1]]),N1={},T1={style:{},"aria-hidden":"true",viewBox:"0 0 48 48",class:"nfc_ok"};function k1(o,s){return l.openBlock(),l.createElementBlock("svg",T1,[...s[0]||(s[0]=[l.createElementVNode("rect",{x:"8",y:"12",width:"32",height:"24",rx:"4",ry:"4",stroke:"#5D534B","stroke-width":"none",fill:"none"},null,-1),l.createElementVNode("path",{d:"M16 22h16m-10 6h6",stroke:"#5D534B","stroke-width":"2.4","stroke-linecap":"round"},null,-1),l.createElementVNode("path",{d:"M14 28l6 6l14-14",fill:"none",stroke:"#2ECC71","stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const R1=ze(N1,[["render",k1]]),O1={key:0,class:"nfc_ok",viewBox:"0 0 48 48","aria-hidden":"true"},M1=l.defineComponent({__name:"CardReaderRetry",props:{styleRetry:{type:Boolean}},setup(o){return(s,i)=>o.styleRetry?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("svg",O1,[...i[0]||(i[0]=[l.createElementVNode("rect",{x:"8",y:"12",width:"32",height:"24",rx:"4",ry:"4"},null,-1),l.createElementVNode("path",{d:"M16 22h16m-10 6h6"},null,-1)])]))}}),B1={class:"sheet_header"},v1={class:"sheet_title",id:"sheetTitle"},D1={class:"sheet_body"},P1={class:"sheet_card"},L1={class:"nfc_title"},F1={class:"lead"},V1={class:"wrapper_input_accept"},U1={key:1},z1={key:0,class:"card_phone_auth_wrapper"},H1={class:"sr_only","aria-live":"polite"},oa=l.defineComponent({__name:"CardReader",setup(o){const s=at(),i=bt(),{is_OpenLoyal:u}=we.storeToRefs(s),{itemThemes:f}=we.storeToRefs(i),h=At(),m=l.ref(),x=l.ref(null),_=l.ref(""),p={wait:{text:"Лояльность",title:""},success:{text:"Стикер распознан",title:"Стикер распознан"},not_found:{text:"Стикер не распознан",title:"Стикер не распознали"}},C=l.computed({get:()=>_.value,set:H=>{_.value=H.replace(/\s/g,"")}}),y=l.computed(()=>h.currentState),S=l.computed(()=>h.isDrawerOpen),B=l.computed(()=>{var H;return((H=p[y.value])==null?void 0:H.text)||""}),T=l.computed(()=>{var H;(H=p[y.value])!=null&&H.title}),D=l.computed(()=>y.value==="success"?"Добро пожаловать!":f.value.kiosk_show_loyalty_phone_input_button?"Поднесите стикер к считывателю или войдите по номеру телефона":"Поднесите стикер к считывателю или введите номер карты вручную"),v=l.computed(()=>({ok:y.value==="success",warn:y.value==="not_found"})),U=l.computed(()=>{const H=[];return y.value==="wait"&&H.push("pulse","show-x"),y.value==="not_found"&&H.push("pulse","show-x"),y.value==="success"&&H.push("pulse","show-ok"),H}),P=l.computed(()=>y.value==="not_found"),O=l.computed(()=>y.value==="success"),M=l.computed(()=>y.value==="not_found"),K=l.computed(()=>["not_found"].includes(y.value)),Q=l.computed(()=>({wait:"Стикер не распознан. Нажмите «Повторить».",success:"Стикер распознан. Нажмите «Продолжить».",not_found:"Стикер не распознан. Нажмите «Повторить»."})[y.value]||""),W=()=>{h.closeDrawer(),u.value=!0},oe=async H=>{var te,Z;h.error="",x.value=null;try{const re=new An;await re.authorizeByCard(H.trim()),await re.getProfile(),s.loadCart(),h.setState("success"),h.isDrawerOpen=!1,h.showNotification("Вы успешно авторизовались в программе лояльности!")}catch(re){h.error=((Z=(te=re.response)==null?void 0:te.data)==null?void 0:Z.user_friendly_message)||"Ошибка",h.setState("not_found"),x.value=C.value,C.value=""}},V=l.computed(()=>{var te;const H=(te=f.value)==null?void 0:te.kiosk_hide_manual_input_loyalty_card;return H??!1}),ce=()=>{h.setState("wait"),h.error="",C.value="",x.value=null},j=()=>{h.closeDrawer(),x.value=null,C.value=""},G=()=>{var H,te;h.setState("wait"),(te=(H=C.value)==null?void 0:H.trim())!=null&&te.length&&oe(C.value.trim())},z=H=>{H.stopPropagation(),document.activeElement!==m.value&&X()},X=()=>{l.nextTick(()=>{m.value&&(m.value.focus(),_.value&&m.value.select())})},N=H=>{const te=document.activeElement===m.value;if(!S.value||te)return;const Z=H.key.toLowerCase();if(Z==="backspace")return C.value=C.value.slice(0,-1);if(Z==="escape")return j();if(Z==="r"&&M.value)return ce();if(Z==="c"&&y.value==="success")return j();if(Z==="enter")return G();C.value+=Z},Y={mounted(H){H==null||H.focus()}};return l.onMounted(()=>{document==null||document.addEventListener("keydown",N)}),l.onBeforeUnmount(()=>{document==null||document.removeEventListener("keydown",N)}),l.watchEffect(()=>{S.value&&(h.error="")}),(H,te)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[S.value?(l.openBlock(),l.createElementBlock("div",{key:0,class:"backdrop show",onClick:j,"aria-hidden":"true"})):l.createCommentVNode("",!0),S.value?(l.openBlock(),l.createElementBlock("section",{key:1,class:l.normalizeClass(["sheet show",{sheet_retry:M.value}]),"aria-modal":"true","aria-labelledby":"sheetTitle",onClick:z},[l.createElementVNode("header",B1,[l.createElementVNode("div",v1,l.toDisplayString(B.value),1),M.value?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass(["sheet_status",v.value])},l.toDisplayString(x.value),3)):l.createCommentVNode("",!0),l.createElementVNode("button",{class:"sheet_close",onClick:j,"aria-label":"Закрыть"}," Закрыть ")]),l.createElementVNode("div",D1,[l.createElementVNode("div",P1,[l.createElementVNode("div",{class:l.normalizeClass(["nfc",U.value])},[l.createVNode(M1,{styleRetry:K.value},null,8,["styleRetry"]),P.value?(l.openBlock(),l.createBlock(S1,{key:0})):l.createCommentVNode("",!0),l.createElementVNode("div",{class:"overlay check",style:l.normalizeStyle({display:O.value?"grid":"none"}),"aria-hidden":"true"},[l.createVNode(R1)],4)],2),l.createElementVNode("h2",L1,l.toDisplayString(T.value),1),l.createElementVNode("p",F1,l.toDisplayString(D.value),1),l.createElementVNode("div",V1,[l.withDirectives(l.createElementVNode("input",{style:l.normalizeStyle(V.value?{position:"absolute",left:"-9999px"}:{}),ref_key:"cardInputManualRef",ref:m,"onUpdate:modelValue":te[0]||(te[0]=Z=>C.value=Z),class:"nfc_title_read_input",type:"text",placeholder:"Введите трек карты","aria-live":"polite",onKeydown:l.withKeys(G,["enter"])},null,36),[[l.vModelText,C.value],[Y]]),M.value?(l.openBlock(),l.createElementBlock("button",{key:0,class:"btn btn_ghost",onClick:ce},"Повторить")):(l.openBlock(),l.createElementBlock("div",U1,[V.value?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("button",{key:0,class:"btn btn_ghost",onClick:te[1]||(te[1]=Z=>M.value?j:G())},"Отправить"))]))]),y.value==="wait"&&l.unref(f).kiosk_show_loyalty_phone_input_button?(l.openBlock(),l.createElementBlock("div",z1,[l.createElementVNode("button",{class:"card_phone_auth_button",onClick:W},"Войти по номеру телефона")])):l.createCommentVNode("",!0)])]),l.createElementVNode("div",H1,l.toDisplayString(Q.value),1)],2)):l.createCommentVNode("",!0)],64))}}),G1="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgcm9sZT0iaW1nIiBhcmlhLWxhYmVsPSJJTk5PIGJhbmsgY2FyZCBpY29uIj4NCiAgPGRlZnM+DQogICAgPGxpbmVhckdyYWRpZW50IGlkPSJibGFja0dyYWQiIHgxPSIwIiB5MT0iMCIgeDI9IjEiIHkyPSIxIj4NCiAgICAgIDxzdG9wIG9mZnNldD0iMCUiIHN0b3AtY29sb3I9IiMxQTFBMUEiLz4NCiAgICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzAwMDAwMCIvPg0KICAgIDwvbGluZWFyR3JhZGllbnQ+DQoNCiAgICA8bGluZWFyR3JhZGllbnQgaWQ9InNoaW5lIiB4MT0iMCIgeTE9IjAiIHgyPSIxIiB5Mj0iMCI+DQogICAgICA8c3RvcCBvZmZzZXQ9IjAlIiBzdG9wLWNvbG9yPSIjRkZGRkZGIiBzdG9wLW9wYWNpdHk9IjAiLz4NCiAgICAgIDxzdG9wIG9mZnNldD0iNTAlIiBzdG9wLWNvbG9yPSIjRkZGRkZGIiBzdG9wLW9wYWNpdHk9IjAuMTgiLz4NCiAgICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI0ZGRkZGRiIgc3RvcC1vcGFjaXR5PSIwIi8+DQogICAgPC9saW5lYXJHcmFkaWVudD4NCg0KICAgIDxmaWx0ZXIgaWQ9InNoYWRvdyIgeD0iLTMwJSIgeT0iLTMwJSIgd2lkdGg9IjE2MCUiIGhlaWdodD0iMTYwJSI+DQogICAgICA8ZmVEcm9wU2hhZG93IGR4PSIwIiBkeT0iNiIgc3RkRGV2aWF0aW9uPSI2IiBmbG9vZC1jb2xvcj0iIzAwMCIgZmxvb2Qtb3BhY2l0eT0iMC4yNSIvPg0KICAgIDwvZmlsdGVyPg0KICA8L2RlZnM+DQoNCiAgPCEtLSBDZW50ZXJlZCBjYXJkIC0tPg0KICA8ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSg3LjUgMjMpIHJvdGF0ZSgtMTIpIiBmaWx0ZXI9InVybCgjc2hhZG93KSI+DQogICAgPCEtLSBjYXJkIGJvZHkgLS0+DQogICAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9Ijg1IiBoZWlnaHQ9IjU0IiByeD0iMTAiIGZpbGw9InVybCgjYmxhY2tHcmFkKSIvPg0KDQogICAgPCEtLSB0b3Agc3RyaXBlIC0tPg0KICAgIDxyZWN0IHg9IjAiIHk9IjgiIHdpZHRoPSI4NSIgaGVpZ2h0PSI4IiByeD0iNCIgZmlsbD0iI0ZGRkZGRiIgb3BhY2l0eT0iMC4wNSIvPg0KDQogICAgPCEtLSBjaGlwIC0tPg0KICAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEwIDI3KSI+DQogICAgICA8cmVjdCB3aWR0aD0iMTgiIGhlaWdodD0iMTUiIHJ4PSIzIiBmaWxsPSIjQ0ZBRTcwIi8+DQogICAgICA8cmVjdCB4PSIyLjUiIHk9IjMuNSIgd2lkdGg9IjEzIiBoZWlnaHQ9IjEuMiIgZmlsbD0iIzlFODM0RSIvPg0KICAgICAgPHJlY3QgeD0iMi41IiB5PSI2LjUiIHdpZHRoPSIxMyIgaGVpZ2h0PSIxLjIiIGZpbGw9IiM5RTgzNEUiLz4NCiAgICAgIDxyZWN0IHg9IjIuNSIgeT0iOS41IiB3aWR0aD0iMTMiIGhlaWdodD0iMS4yIiBmaWxsPSIjOUU4MzRFIi8+DQogICAgICA8cmVjdCB4PSI4LjUiIHk9IjAiIHdpZHRoPSIxLjUiIGhlaWdodD0iMTUiIGZpbGw9IiM5RTgzNEUiIG9wYWNpdHk9IjAuNiIvPg0KICAgIDwvZz4NCg0KICAgIDwhLS0gSU5OTyBsb2dvIC0tPg0KICAgIDx0ZXh0IHg9IjYxIiB5PSIzOSINCiAgICAgICAgICBmb250LWZhbWlseT0ic3lzdGVtLXVpLCAtYXBwbGUtc3lzdGVtLCBTZWdvZSBVSSwgUm9ib3RvLCBBcmlhbCwgc2Fucy1zZXJpZiINCiAgICAgICAgICBmb250LXNpemU9IjEzIg0KICAgICAgICAgIGZvbnQtd2VpZ2h0PSI4MDAiDQogICAgICAgICAgbGV0dGVyLXNwYWNpbmc9IjEuMiINCiAgICAgICAgICBmaWxsPSIjRkZGRkZGIg0KICAgICAgICAgIG9wYWNpdHk9IjAuOTUiDQogICAgICAgICAgdGV4dC1hbmNob3I9Im1pZGRsZSI+DQogICAgICBpbm5vDQogICAgPC90ZXh0Pg0KDQogICAgPCEtLSBzaGluZSAtLT4NCiAgICA8cGF0aCBkPSJNLTggNiBMMjUgLTMgTDk0IDQ3IEw2MCA2MiBMLTggMjUgWiIgZmlsbD0idXJsKCNzaGluZSkiLz4NCiAgPC9nPg0KPC9zdmc+",sa="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20512%20512'%20width='100'%20height='100'%20fill='none'%3e%3c!--%20Big%20QR%20corners%20(outer%20shape%20with%20inner%20cutout)%20--%3e%3cpath%20fill='currentColor'%20fill-rule='evenodd'%20d='%20M72%200H163C202.765%200%20235%2032.235%20235%2072V163C235%20202.765%20202.765%20235%20163%20235H72C32.235%20235%200%20202.765%200%20163V72C0%2032.235%2032.235%200%2072%200Z%20M102%2086H133C141.837%2086%20149%2093.163%20149%20102V133C149%20141.837%20141.837%20149%20133%20149H102C93.163%20149%2086%20141.837%2086%20133V102C86%2093.163%2093.163%2086%20102%2086Z%20'/%3e%3cpath%20fill='currentColor'%20fill-rule='evenodd'%20d='%20M349%200H440C479.765%200%20512%2032.235%20512%2072V163C512%20202.765%20479.765%20235%20440%20235H349C309.235%20235%20277%20202.765%20277%20163V72C277%2032.235%20309.235%200%20349%200Z%20M379%2086H410C418.837%2086%20426%2093.163%20426%20102V133C426%20141.837%20418.837%20149%20410%20149H379C370.163%20149%20363%20141.837%20363%20133V102C363%2093.163%20370.163%2086%20379%2086Z%20'/%3e%3cpath%20fill='currentColor'%20fill-rule='evenodd'%20d='%20M72%20277H163C202.765%20277%20235%20309.235%20235%20349V440C235%20479.765%20202.765%20512%20163%20512H72C32.235%20512%200%20479.765%200%20440V349C0%20309.235%2032.235%20277%2072%20277Z%20M102%20363H133C141.837%20363%20149%20370.163%20149%20379V410C149%20418.837%20141.837%20426%20133%20426H102C93.163%20426%2086%20418.837%2086%20410V379C86%20370.163%2093.163%20363%20102%20363Z%20'/%3e%3c!--%20Small%20modules%20--%3e%3crect%20x='277'%20y='277'%20width='86'%20height='86'%20rx='26'%20fill='currentColor'/%3e%3crect%20x='426'%20y='277'%20width='86'%20height='86'%20rx='28'%20fill='currentColor'/%3e%3crect%20x='277'%20y='426'%20width='86'%20height='86'%20rx='26'%20fill='currentColor'/%3e%3c!--%20Center%20dot%20--%3e%3ccircle%20cx='394.17'%20cy='394.17'%20r='33'%20fill='currentColor'/%3e%3c/svg%3e",W1=["src"],X1={class:"header_description"},j1=ze(l.defineComponent({__name:"PaymentBoxes",props:{configPage:{},comment:{},cartItems:{},isAuthorized:{type:Boolean},orderId:{default:null},signal:{},provider:{}},emits:["select"],setup(o,{emit:s}){const i=o,u=s,f=At(),h=Tt(),{selectedProvider:m,isButtonDisabled:x}=we.storeToRefs(f),{isAddToCard:_}=we.storeToRefs(h),p={default:G1,SBP:sa},C=async()=>{m.value=i.provider;const S=i.provider.front_type;S&&(_.value=!1,x.value=!0,u("select",S),Xs(i.orderId,i.provider.type))},y=l.computed(()=>p[i.provider.front_type]||p.default);return(S,B)=>(l.openBlock(),l.createElementBlock("div",{class:"payment_boxes_wrapper",onClick:C},[l.createElementVNode("img",{class:"picture",src:y.value},null,8,W1),l.createElementVNode("div",X1,[l.createElementVNode("b",null,l.toDisplayString(o.provider.name),1),l.createElementVNode("p",null,l.toDisplayString(o.provider.description),1)]),l.createVNode(Vr)]))}}),[["__scopeId","data-v-1bf54e54"]]),q1={key:0,class:"wrapper_cart_payment"},Z1={class:"wrapper_paid"},Y1={class:"to_be_paid"},$1=ze(l.defineComponent({__name:"CartPayment",props:{configPage:{},comment:{},cartItems:{},isAuthorized:{type:Boolean},orderId:{},signal:{}},emits:["selectPayment"],setup(o,{emit:s}){const i=At(),u=at(),f=o,{totalPrice_lib:h,countBonus:m}=we.storeToRefs(u),x=s,_=C=>{x("selectPayment",C)},p=()=>{x("selectPayment","")};return(C,y)=>l.unref(i).providerTypes.length>1?(l.openBlock(),l.createElementBlock("div",q1,[y[2]||(y[2]=l.createElementVNode("h2",null,"Выберите способ оплаты",-1)),y[3]||(y[3]=l.createElementVNode("p",{class:"description_payment"},"Можно изменить позже до оплаты",-1)),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(i).providerTypes,(S,B)=>(l.openBlock(),l.createElementBlock("div",{key:B},[l.createVNode(j1,{provider:S,"config-page":f.configPage,comment:f.comment,"cart-items":f.cartItems,"is-authorized":f.isAuthorized,"order-id":f.orderId,signal:f.signal,onSelect:_},null,8,["provider","config-page","comment","cart-items","is-authorized","order-id","signal"])]))),128)),l.createElementVNode("div",Z1,[l.createElementVNode("p",Y1,[y[0]||(y[0]=l.createTextVNode("К оплате ",-1)),l.createVNode(Ht,{price:l.unref(h)-l.unref(m),fixedFloat:2},null,8,["price"]),y[1]||(y[1]=l.createTextVNode(" ₽",-1))]),l.createVNode(cn,{textButtonDefault:"Назад",onClick:p,class:"btn_payment"})])])):l.createCommentVNode("",!0)}}),[["__scopeId","data-v-26ea47f1"]]),K1={class:"start_page"},Q1=["src"],J1={class:"wrap"},ed={class:"wrap_box"},td={class:"title_fiscal_order"},nd={class:"wrapper_accept"},rd={ref:"barRef",class:"bar_complete","aria-hidden":"true"},id=ze(l.defineComponent({__name:"CartCompleteKioskSuccess",props:{mediaUrl:{},orderNumber:{}},setup(o){const s=at(),i=At(),u=Tt(),f=bt(),{cartProducts_lib:h}=we.storeToRefs(s),{orderNumber:m,orderCompleted_lib:x,selectedOrderType:_}=we.storeToRefs(i),{is_startPage:p}=we.storeToRefs(u),{mediaUrl:C}=Pn(()=>f.itemThemes.kiosk_preloader?"preloader":null),y=ke.useRouter(),S=ke.useRoute();let B=null;l.onMounted(()=>{B=setTimeout(()=>{p.value=!f.itemThemes.kiosk_disable_lock_screen,_.value=null,s.isOrderTypeSubmited=!1,y.replace(`/${S.params.orgId}`)},1e4)});const T=()=>{dr(["cart","authTokensAccess","authTokensRefresh"]),h.value=[],x.value=null,_.value=null,s.isOrderTypeSubmited=!1,i.clearCard(),s.profile=null,y.replace(`/${S.params.orgId}`)};return l.onUnmounted(()=>{B&&clearInterval(B)}),(D,v)=>(l.openBlock(),l.createElementBlock("div",K1,[l.withDirectives((l.openBlock(),l.createElementBlock("video",{loop:"",autoplay:"",muted:"",playsinline:"",key:l.unref(C)},[l.createElementVNode("source",{src:l.unref(C)||"",type:"video/webm"},null,8,Q1)])),[[l.unref(Ur)]]),v[4]||(v[4]=l.createElementVNode("div",{class:"start_img_black"},null,-1)),l.createElementVNode("div",J1,[l.createElementVNode("div",ed,[v[1]||(v[1]=l.createElementVNode("div",{class:"icon","aria-hidden":"true"},[l.createElementVNode("svg",{viewBox:"0 0 24 24"},[l.createElementVNode("path",{d:"M20 6L9 17l-5-5"})])],-1)),v[2]||(v[2]=l.createElementVNode("h1",null," Заказ успешно оплачен ",-1)),l.createElementVNode("p",td,"№ "+l.toDisplayString(l.unref(m)),1),v[3]||(v[3]=l.createElementVNode("p",{class:"title_fiscal_completed"},"Спасибо! Заказ передан в работу.",-1)),l.createElementVNode("div",nd,[l.createElementVNode("button",{class:"btn","aria-label":"Новый заказ",onClick:T},[v[0]||(v[0]=l.createElementVNode("span",{class:"label"},"Новый заказ",-1)),l.createElementVNode("span",rd,null,512)])])])])]))}}),[["__scopeId","data-v-79c00acf"]]),od={};function sd(o,s){return s[0]||(s[0]=l.createStaticVNode('<div class="topProgress" aria-hidden="true" data-v-3e03a6dc><i data-v-3e03a6dc></i></div><h1 class="title_fiscal" data-v-3e03a6dc>Сейчас будет распечатан фискальный чек</h1><p class="reminder" data-v-3e03a6dc>Не забудьте <b data-v-3e03a6dc>оплатить заказ</b> после печати.</p><div class="stage" aria-hidden="true" data-v-3e03a6dc><div class="printer" data-v-3e03a6dc><div class="led" data-v-3e03a6dc></div><div class="slot" data-v-3e03a6dc></div><div class="receipt" data-v-3e03a6dc><div class="tear" data-v-3e03a6dc></div><div class="line accent" data-v-3e03a6dc></div><div class="line" data-v-3e03a6dc></div><div class="line sm" data-v-3e03a6dc></div><div class="line" data-v-3e03a6dc></div><div class="line sm" data-v-3e03a6dc></div><div class="line" data-v-3e03a6dc></div><div class="line sm" data-v-3e03a6dc></div></div></div></div>',4))}const ad=ze(od,[["render",sd],["__scopeId","data-v-3e03a6dc"]]),ld={},cd={class:"center"};function ud(o,s){return l.openBlock(),l.createElementBlock("div",cd,[...s[0]||(s[0]=[l.createStaticVNode('<div class="stack" data-v-f0859fd1><h1 class="title_fiscal" data-v-f0859fd1>Приложите карту для оплаты</h1><p class="reminder" data-v-f0859fd1>Держите карту у терминала, пока операция не завершится.</p><div class="stageCard" aria-hidden="true" data-v-f0859fd1><div class="waves" data-v-f0859fd1><span data-v-f0859fd1></span><span data-v-f0859fd1></span><span data-v-f0859fd1></span></div><div class="nfc" data-v-f0859fd1><svg viewBox="0 0 24 24" data-v-f0859fd1><path d="M6 8c2.5 2.5 2.5 5.5 0 8" data-v-f0859fd1></path><path d="M10 6c4 4 4 8 0 12" data-v-f0859fd1></path><path d="M14 4c5.5 5.5 5.5 11 0 16" data-v-f0859fd1></path></svg></div><div class="card" data-v-f0859fd1><div class="logo" data-v-f0859fd1>inno.</div><div class="chip" data-v-f0859fd1></div><div class="digits" data-v-f0859fd1>4815 1623 4200 0900</div><div class="holder" data-v-f0859fd1>Гость</div></div></div></div>',1)])])}const dd=ze(ld,[["render",ud],["__scopeId","data-v-f0859fd1"]]);/*!
|
|
7
7
|
* qrcode.vue v3.6.0
|
|
8
8
|
* A Vue.js component to generate QRCode. Both support Vue 2 and Vue 3
|
|
9
9
|
* © 2017-PRESENT @scopewu(https://github.com/scopewu)
|
|
10
10
|
* MIT License.
|
|
11
|
-
*/var Tn=function(){return Tn=Object.assign||function(s){for(var i,u=1,f=arguments.length;u<f;u++){i=arguments[u];for(var h in i)Object.prototype.hasOwnProperty.call(i,h)&&(s[h]=i[h])}return s},Tn.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;var er;(function(o){var s=function(){function m(x,_,p,C){if(this.version=x,this.errorCorrectionLevel=_,this.modules=[],this.isFunction=[],x<m.MIN_VERSION||x>m.MAX_VERSION)throw new RangeError("Version value out of range");if(C<-1||C>7)throw new RangeError("Mask value out of range");this.size=x*4+17;for(var y=[],S=0;S<this.size;S++)y.push(!1);for(var S=0;S<this.size;S++)this.modules.push(y.slice()),this.isFunction.push(y.slice());this.drawFunctionPatterns();var M=this.addEccAndInterleave(p);if(this.drawCodewords(M),C==-1)for(var k=1e9,S=0;S<8;S++){this.applyMask(S),this.drawFormatBits(S);var P=this.getPenaltyScore();P<k&&(C=S,k=P),this.applyMask(S)}f(0<=C&&C<=7),this.mask=C,this.applyMask(C),this.drawFormatBits(C),this.isFunction=[]}return m.encodeText=function(x,_){var p=o.QrSegment.makeSegments(x);return m.encodeSegments(p,_)},m.encodeBinary=function(x,_){var p=o.QrSegment.makeBytes(x);return m.encodeSegments([p],_)},m.encodeSegments=function(x,_,p,C,y,S){if(p===void 0&&(p=1),C===void 0&&(C=40),y===void 0&&(y=-1),S===void 0&&(S=!0),!(m.MIN_VERSION<=p&&p<=C&&C<=m.MAX_VERSION)||y<-1||y>7)throw new RangeError("Invalid value");var M,k;for(M=p;;M++){var P=m.getNumDataCodewords(M,_)*8,v=h.getTotalBits(x,M);if(v<=P){k=v;break}if(M>=C)throw new RangeError("Data too long")}for(var U=0,B=[m.Ecc.MEDIUM,m.Ecc.QUARTILE,m.Ecc.HIGH];U<B.length;U++){var R=B[U];S&&k<=m.getNumDataCodewords(M,R)*8&&(_=R)}for(var D=[],K=0,te=x;K<te.length;K++){var z=te[K];i(z.mode.modeBits,4,D),i(z.numChars,z.mode.numCharCountBits(M),D);for(var ie=0,W=z.getData();ie<W.length;ie++){var se=W[ie];D.push(se)}}f(D.length==k);var j=m.getNumDataCodewords(M,_)*8;f(D.length<=j),i(0,Math.min(4,j-D.length),D),i(0,(8-D.length%8)%8,D),f(D.length%8==0);for(var G=236;D.length<j;G^=253)i(G,8,D);for(var V=[];V.length*8<D.length;)V.push(0);return D.forEach(function(X,N){return V[N>>>3]|=X<<7-(N&7)}),new m(M,_,V,y)},m.prototype.getModule=function(x,_){return 0<=x&&x<this.size&&0<=_&&_<this.size&&this.modules[_][x]},m.prototype.getModules=function(){return this.modules},m.prototype.drawFunctionPatterns=function(){for(var x=0;x<this.size;x++)this.setFunctionModule(6,x,x%2==0),this.setFunctionModule(x,6,x%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);for(var _=this.getAlignmentPatternPositions(),p=_.length,x=0;x<p;x++)for(var C=0;C<p;C++)x==0&&C==0||x==0&&C==p-1||x==p-1&&C==0||this.drawAlignmentPattern(_[x],_[C]);this.drawFormatBits(0),this.drawVersion()},m.prototype.drawFormatBits=function(x){for(var _=this.errorCorrectionLevel.formatBits<<3|x,p=_,C=0;C<10;C++)p=p<<1^(p>>>9)*1335;var y=(_<<10|p)^21522;f(y>>>15==0);for(var C=0;C<=5;C++)this.setFunctionModule(8,C,u(y,C));this.setFunctionModule(8,7,u(y,6)),this.setFunctionModule(8,8,u(y,7)),this.setFunctionModule(7,8,u(y,8));for(var C=9;C<15;C++)this.setFunctionModule(14-C,8,u(y,C));for(var C=0;C<8;C++)this.setFunctionModule(this.size-1-C,8,u(y,C));for(var C=8;C<15;C++)this.setFunctionModule(8,this.size-15+C,u(y,C));this.setFunctionModule(8,this.size-8,!0)},m.prototype.drawVersion=function(){if(!(this.version<7)){for(var x=this.version,_=0;_<12;_++)x=x<<1^(x>>>11)*7973;var p=this.version<<12|x;f(p>>>18==0);for(var _=0;_<18;_++){var C=u(p,_),y=this.size-11+_%3,S=Math.floor(_/3);this.setFunctionModule(y,S,C),this.setFunctionModule(S,y,C)}}},m.prototype.drawFinderPattern=function(x,_){for(var p=-4;p<=4;p++)for(var C=-4;C<=4;C++){var y=Math.max(Math.abs(C),Math.abs(p)),S=x+C,M=_+p;0<=S&&S<this.size&&0<=M&&M<this.size&&this.setFunctionModule(S,M,y!=2&&y!=4)}},m.prototype.drawAlignmentPattern=function(x,_){for(var p=-2;p<=2;p++)for(var C=-2;C<=2;C++)this.setFunctionModule(x+C,_+p,Math.max(Math.abs(C),Math.abs(p))!=1)},m.prototype.setFunctionModule=function(x,_,p){this.modules[_][x]=p,this.isFunction[_][x]=!0},m.prototype.addEccAndInterleave=function(x){var _=this.version,p=this.errorCorrectionLevel;if(x.length!=m.getNumDataCodewords(_,p))throw new RangeError("Invalid argument");for(var C=m.NUM_ERROR_CORRECTION_BLOCKS[p.ordinal][_],y=m.ECC_CODEWORDS_PER_BLOCK[p.ordinal][_],S=Math.floor(m.getNumRawDataModules(_)/8),M=C-S%C,k=Math.floor(S/C),P=[],v=m.reedSolomonComputeDivisor(y),U=0,B=0;U<C;U++){var R=x.slice(B,B+k-y+(U<M?0:1));B+=R.length;var D=m.reedSolomonComputeRemainder(R,v);U<M&&R.push(0),P.push(R.concat(D))}for(var K=[],te=function(z){P.forEach(function(ie,W){(z!=k-y||W>=M)&&K.push(ie[z])})},U=0;U<P[0].length;U++)te(U);return f(K.length==S),K},m.prototype.drawCodewords=function(x){if(x.length!=Math.floor(m.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");for(var _=0,p=this.size-1;p>=1;p-=2){p==6&&(p=5);for(var C=0;C<this.size;C++)for(var y=0;y<2;y++){var S=p-y,M=(p+1&2)==0,k=M?this.size-1-C:C;!this.isFunction[k][S]&&_<x.length*8&&(this.modules[k][S]=u(x[_>>>3],7-(_&7)),_++)}}f(_==x.length*8)},m.prototype.applyMask=function(x){if(x<0||x>7)throw new RangeError("Mask value out of range");for(var _=0;_<this.size;_++)for(var p=0;p<this.size;p++){var C=void 0;switch(x){case 0:C=(p+_)%2==0;break;case 1:C=_%2==0;break;case 2:C=p%3==0;break;case 3:C=(p+_)%3==0;break;case 4:C=(Math.floor(p/3)+Math.floor(_/2))%2==0;break;case 5:C=p*_%2+p*_%3==0;break;case 6:C=(p*_%2+p*_%3)%2==0;break;case 7:C=((p+_)%2+p*_%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[_][p]&&C&&(this.modules[_][p]=!this.modules[_][p])}},m.prototype.getPenaltyScore=function(){for(var x=0,_=0;_<this.size;_++){for(var p=!1,C=0,y=[0,0,0,0,0,0,0],S=0;S<this.size;S++)this.modules[_][S]==p?(C++,C==5?x+=m.PENALTY_N1:C>5&&x++):(this.finderPenaltyAddHistory(C,y),p||(x+=this.finderPenaltyCountPatterns(y)*m.PENALTY_N3),p=this.modules[_][S],C=1);x+=this.finderPenaltyTerminateAndCount(p,C,y)*m.PENALTY_N3}for(var S=0;S<this.size;S++){for(var p=!1,M=0,y=[0,0,0,0,0,0,0],_=0;_<this.size;_++)this.modules[_][S]==p?(M++,M==5?x+=m.PENALTY_N1:M>5&&x++):(this.finderPenaltyAddHistory(M,y),p||(x+=this.finderPenaltyCountPatterns(y)*m.PENALTY_N3),p=this.modules[_][S],M=1);x+=this.finderPenaltyTerminateAndCount(p,M,y)*m.PENALTY_N3}for(var _=0;_<this.size-1;_++)for(var S=0;S<this.size-1;S++){var k=this.modules[_][S];k==this.modules[_][S+1]&&k==this.modules[_+1][S]&&k==this.modules[_+1][S+1]&&(x+=m.PENALTY_N2)}for(var P=0,v=0,U=this.modules;v<U.length;v++){var B=U[v];P=B.reduce(function(K,te){return K+(te?1:0)},P)}var R=this.size*this.size,D=Math.ceil(Math.abs(P*20-R*10)/R)-1;return f(0<=D&&D<=9),x+=D*m.PENALTY_N4,f(0<=x&&x<=2568888),x},m.prototype.getAlignmentPatternPositions=function(){if(this.version==1)return[];for(var x=Math.floor(this.version/7)+2,_=Math.floor((this.version*8+x*3+5)/(x*4-4))*2,p=[6],C=this.size-7;p.length<x;C-=_)p.splice(1,0,C);return p},m.getNumRawDataModules=function(x){if(x<m.MIN_VERSION||x>m.MAX_VERSION)throw new RangeError("Version number out of range");var _=(16*x+128)*x+64;if(x>=2){var p=Math.floor(x/7)+2;_-=(25*p-10)*p-55,x>=7&&(_-=36)}return f(208<=_&&_<=29648),_},m.getNumDataCodewords=function(x,_){return Math.floor(m.getNumRawDataModules(x)/8)-m.ECC_CODEWORDS_PER_BLOCK[_.ordinal][x]*m.NUM_ERROR_CORRECTION_BLOCKS[_.ordinal][x]},m.reedSolomonComputeDivisor=function(x){if(x<1||x>255)throw new RangeError("Degree out of range");for(var _=[],p=0;p<x-1;p++)_.push(0);_.push(1);for(var C=1,p=0;p<x;p++){for(var y=0;y<_.length;y++)_[y]=m.reedSolomonMultiply(_[y],C),y+1<_.length&&(_[y]^=_[y+1]);C=m.reedSolomonMultiply(C,2)}return _},m.reedSolomonComputeRemainder=function(x,_){for(var p=_.map(function(k){return 0}),C=function(k){var P=k^p.shift();p.push(0),_.forEach(function(v,U){return p[U]^=m.reedSolomonMultiply(v,P)})},y=0,S=x;y<S.length;y++){var M=S[y];C(M)}return p},m.reedSolomonMultiply=function(x,_){if(x>>>8||_>>>8)throw new RangeError("Byte out of range");for(var p=0,C=7;C>=0;C--)p=p<<1^(p>>>7)*285,p^=(_>>>C&1)*x;return f(p>>>8==0),p},m.prototype.finderPenaltyCountPatterns=function(x){var _=x[1];f(_<=this.size*3);var p=_>0&&x[2]==_&&x[3]==_*3&&x[4]==_&&x[5]==_;return(p&&x[0]>=_*4&&x[6]>=_?1:0)+(p&&x[6]>=_*4&&x[0]>=_?1:0)},m.prototype.finderPenaltyTerminateAndCount=function(x,_,p){return x&&(this.finderPenaltyAddHistory(_,p),_=0),_+=this.size,this.finderPenaltyAddHistory(_,p),this.finderPenaltyCountPatterns(p)},m.prototype.finderPenaltyAddHistory=function(x,_){_[0]==0&&(x+=this.size),_.pop(),_.unshift(x)},m.MIN_VERSION=1,m.MAX_VERSION=40,m.PENALTY_N1=3,m.PENALTY_N2=3,m.PENALTY_N3=40,m.PENALTY_N4=10,m.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],m.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],m}();o.QrCode=s;function i(m,x,_){if(x<0||x>31||m>>>x)throw new RangeError("Value out of range");for(var p=x-1;p>=0;p--)_.push(m>>>p&1)}function u(m,x){return(m>>>x&1)!=0}function f(m){if(!m)throw new Error("Assertion error")}var h=function(){function m(x,_,p){if(this.mode=x,this.numChars=_,this.bitData=p,_<0)throw new RangeError("Invalid argument");this.bitData=p.slice()}return m.makeBytes=function(x){for(var _=[],p=0,C=x;p<C.length;p++){var y=C[p];i(y,8,_)}return new m(m.Mode.BYTE,x.length,_)},m.makeNumeric=function(x){if(!m.isNumeric(x))throw new RangeError("String contains non-numeric characters");for(var _=[],p=0;p<x.length;){var C=Math.min(x.length-p,3);i(parseInt(x.substring(p,p+C),10),C*3+1,_),p+=C}return new m(m.Mode.NUMERIC,x.length,_)},m.makeAlphanumeric=function(x){if(!m.isAlphanumeric(x))throw new RangeError("String contains unencodable characters in alphanumeric mode");var _=[],p;for(p=0;p+2<=x.length;p+=2){var C=m.ALPHANUMERIC_CHARSET.indexOf(x.charAt(p))*45;C+=m.ALPHANUMERIC_CHARSET.indexOf(x.charAt(p+1)),i(C,11,_)}return p<x.length&&i(m.ALPHANUMERIC_CHARSET.indexOf(x.charAt(p)),6,_),new m(m.Mode.ALPHANUMERIC,x.length,_)},m.makeSegments=function(x){return x==""?[]:m.isNumeric(x)?[m.makeNumeric(x)]:m.isAlphanumeric(x)?[m.makeAlphanumeric(x)]:[m.makeBytes(m.toUtf8ByteArray(x))]},m.makeEci=function(x){var _=[];if(x<0)throw new RangeError("ECI assignment value out of range");if(x<128)i(x,8,_);else if(x<16384)i(2,2,_),i(x,14,_);else if(x<1e6)i(6,3,_),i(x,21,_);else throw new RangeError("ECI assignment value out of range");return new m(m.Mode.ECI,0,_)},m.isNumeric=function(x){return m.NUMERIC_REGEX.test(x)},m.isAlphanumeric=function(x){return m.ALPHANUMERIC_REGEX.test(x)},m.prototype.getData=function(){return this.bitData.slice()},m.getTotalBits=function(x,_){for(var p=0,C=0,y=x;C<y.length;C++){var S=y[C],M=S.mode.numCharCountBits(_);if(S.numChars>=1<<M)return 1/0;p+=4+M+S.bitData.length}return p},m.toUtf8ByteArray=function(x){x=encodeURI(x);for(var _=[],p=0;p<x.length;p++)x.charAt(p)!="%"?_.push(x.charCodeAt(p)):(_.push(parseInt(x.substring(p+1,p+3),16)),p+=2);return _},m.NUMERIC_REGEX=/^[0-9]*$/,m.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,m.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",m}();o.QrSegment=h})(er||(er={})),function(o){(function(s){var i=function(){function u(f,h){this.ordinal=f,this.formatBits=h}return u.LOW=new u(0,1),u.MEDIUM=new u(1,0),u.QUARTILE=new u(2,3),u.HIGH=new u(3,2),u}();s.Ecc=i})(o.QrCode||(o.QrCode={}))}(er||(er={})),function(o){(function(s){var i=function(){function u(f,h){this.modeBits=f,this.numBitsCharCount=h}return u.prototype.numCharCountBits=function(f){return this.numBitsCharCount[Math.floor((f+7)/17)]},u.NUMERIC=new u(1,[10,12,14]),u.ALPHANUMERIC=new u(2,[9,11,13]),u.BYTE=new u(4,[8,16,16]),u.KANJI=new u(8,[8,10,12]),u.ECI=new u(7,[0,0,0]),u}();s.Mode=i})(o.QrSegment||(o.QrSegment={}))}(er||(er={}));var xr=er,ho="L",go={L:xr.QrCode.Ecc.LOW,M:xr.QrCode.Ecc.MEDIUM,Q:xr.QrCode.Ecc.QUARTILE,H:xr.QrCode.Ecc.HIGH},h1=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}();function mo(o){return o in go}function ca(o,s){s===void 0&&(s=0);var i=[];return o.forEach(function(u,f){var h=null;u.forEach(function(m,x){if(!m&&h!==null){i.push("M".concat(h+s," ").concat(f+s,"h").concat(x-h,"v1H").concat(h+s,"z")),h=null;return}if(x===u.length-1){if(!m)return;h===null?i.push("M".concat(x+s,",").concat(f+s," h1v1H").concat(x+s,"z")):i.push("M".concat(h+s,",").concat(f+s," h").concat(x+1-h,"v1H").concat(h+s,"z"));return}m&&h===null&&(h=x)})}),i.join("")}function ua(o,s,i,u){var f=u.width,h=u.height,m=u.x,x=u.y,_=o.length+i*2,p=Math.floor(s*.1),C=_/s,y=(f||p)*C,S=(h||p)*C,M=m==null?o.length/2-y/2:m*C,k=x==null?o.length/2-S/2:x*C,P=null;if(u.excavate){var v=Math.floor(M),U=Math.floor(k),B=Math.ceil(y+M-v),R=Math.ceil(S+k-U);P={x:v,y:U,w:B,h:R}}return{x:M,y:k,h:S,w:y,excavation:P}}function da(o,s){return o.slice().map(function(i,u){return u<s.y||u>=s.y+s.h?i:i.map(function(f,h){return h<s.x||h>=s.x+s.w?f:!1})})}var po={value:{type:String,required:!0,default:""},size:{type:Number,default:100},level:{type:String,default:ho,validator:function(o){return mo(o)}},background:{type:String,default:"#fff"},foreground:{type:String,default:"#000"},margin:{type:Number,required:!1,default:0},imageSettings:{type:Object,required:!1,default:function(){return{}}},gradient:{type:Boolean,required:!1,default:!1},gradientType:{type:String,required:!1,default:"linear",validator:function(o){return["linear","radial"].indexOf(o)>-1}},gradientStartColor:{type:String,required:!1,default:"#000"},gradientEndColor:{type:String,required:!1,default:"#fff"}},g1=Tn(Tn({},po),{renderAs:{type:String,required:!1,default:"canvas",validator:function(o){return["canvas","svg"].indexOf(o)>-1}}}),m1=l.defineComponent({name:"QRCodeSvg",props:po,setup:function(o){var s=l.ref(0),i=l.ref(""),u,f=function(){var m=o.value,x=o.level,_=o.margin,p=_>>>0,C=mo(x)?x:ho,y=xr.QrCode.encodeText(m,go[C]).getModules();if(s.value=y.length+p*2,o.imageSettings.src){var S=ua(y,o.size,p,o.imageSettings);u={x:S.x+p,y:S.y+p,width:S.w,height:S.h},S.excavation&&(y=da(y,S.excavation))}i.value=ca(y,p)},h=function(){if(!o.gradient)return null;var m=o.gradientType==="linear"?{x1:"0%",y1:"0%",x2:"100%",y2:"100%"}:{cx:"50%",cy:"50%",r:"50%",fx:"50%",fy:"50%"};return l.h(o.gradientType==="linear"?"linearGradient":"radialGradient",Tn({id:"qr-gradient"},m),[l.h("stop",{offset:"0%",style:{stopColor:o.gradientStartColor}}),l.h("stop",{offset:"100%",style:{stopColor:o.gradientEndColor}})])};return f(),l.onUpdated(f),function(){return l.h("svg",{width:o.size,height:o.size,"shape-rendering":"crispEdges",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 ".concat(s.value," ").concat(s.value)},[l.h("defs",{},[h()]),l.h("rect",{width:"100%",height:"100%",fill:o.background}),l.h("path",{fill:o.gradient?"url(#qr-gradient)":o.foreground,d:i.value}),o.imageSettings.src&&l.h("image",Tn({href:o.imageSettings.src},u))])}}}),p1=l.defineComponent({name:"QRCodeCanvas",props:po,setup:function(o,s){var i=l.ref(null),u=l.ref(null),f=function(){var m=o.value,x=o.level,_=o.size,p=o.margin,C=o.background,y=o.foreground,S=o.gradient,M=o.gradientType,k=o.gradientStartColor,P=o.gradientEndColor,v=p>>>0,U=mo(x)?x:ho,B=i.value;if(B){var R=B.getContext("2d");if(R){var D=xr.QrCode.encodeText(m,go[U]).getModules(),K=D.length+v*2,te=u.value,z={x:0,y:0,width:0,height:0},ie=o.imageSettings.src&&te!=null&&te.naturalWidth!==0&&te.naturalHeight!==0;if(ie){var W=ua(D,o.size,v,o.imageSettings);z={x:W.x+v,y:W.y+v,width:W.w,height:W.h},W.excavation&&(D=da(D,W.excavation))}var se=window.devicePixelRatio||1,j=_/K*se;if(B.height=B.width=_*se,R.scale(j,j),R.fillStyle=C,R.fillRect(0,0,K,K),S){var G=void 0;M==="linear"?G=R.createLinearGradient(0,0,K,K):G=R.createRadialGradient(K/2,K/2,0,K/2,K/2,K/2),G.addColorStop(0,k),G.addColorStop(1,P),R.fillStyle=G}else R.fillStyle=y;h1?R.fill(new Path2D(ca(D,v))):D.forEach(function(V,X){V.forEach(function(N,$){N&&R.fillRect($+v,X+v,1,1)})}),ie&&R.drawImage(te,z.x,z.y,z.width,z.height)}}};l.onMounted(f),l.onUpdated(f);var h=s.attrs.style;return function(){return l.h(l.Fragment,[l.h("canvas",Tn(Tn({},s.attrs),{ref:i,style:Tn(Tn({},h),{width:"".concat(o.size,"px"),height:"".concat(o.size,"px")})})),o.imageSettings.src&&l.h("img",{ref:u,src:o.imageSettings.src,style:{display:"none"},onLoad:f})])}}}),x1=l.defineComponent({name:"Qrcode",render:function(){var o=this.$props,s=o.renderAs,i=o.value,u=o.size,f=o.margin,h=o.level,m=o.background,x=o.foreground,_=o.imageSettings,p=o.gradient,C=o.gradientType,y=o.gradientStartColor,S=o.gradientEndColor;return l.h(s==="svg"?m1:p1,{value:i,size:u,margin:f,level:h,background:m,foreground:x,imageSettings:_,gradient:p,gradientType:C,gradientStartColor:y,gradientEndColor:S})},props:g1});const w1={},_1={viewBox:"0 0 24 24","aria-hidden":"true"};function C1(o,s){return l.openBlock(),l.createElementBlock("svg",_1,[...s[0]||(s[0]=[l.createElementVNode("path",{d:"M7 4h10a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z"},null,-1),l.createElementVNode("path",{d:"M9 7h6"},null,-1),l.createElementVNode("path",{d:"M10 18h4"},null,-1)])])}const E1=Ue(w1,[["render",C1]]),y1={},b1={viewBox:"0 0 24 24","aria-hidden":"true"};function A1(o,s){return l.openBlock(),l.createElementBlock("svg",b1,[...s[0]||(s[0]=[l.createStaticVNode('<path d="M4 8V6a2 2 0 0 1 2-2h2"></path><path d="M20 8V6a2 2 0 0 0-2-2h-2"></path><path d="M4 16v2a2 2 0 0 0 2 2h2"></path><path d="M20 16v2a2 2 0 0 1-2 2h-2"></path><path d="M7 12h10"></path>',5)])])}const I1=Ue(y1,[["render",A1]]),S1="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%2019.6108%2014.0107'%20width='19.610840'%20height='14.010742'%20fill='none'%20customFrame='%23000000'%3e%3cpath%20id='Форма%20'%20d='M18.3054%201.30566L6.61792%2012.639L1.30542%207.48747'%20stroke='rgb(255,255,255)'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='2.5999999'/%3e%3c/svg%3e",N1={class:"wrapper_qr_page"},T1=["src"],k1={class:"modal_qr"},R1={class:"modal_qr_content"},O1={class:"wrapper_icon_qr"},B1=["src"],M1={class:"total_order_price"},v1={class:"ttl_wrapper"},D1={class:"ttl_head"},P1={class:"ttl_bar"},L1={class:"hint hint-anim","aria-label":"Инструкция по оплате"},F1={class:"steps","aria-hidden":"true"},V1={class:"step is-active","data-i":"0"},U1={class:"ico"},z1={class:"step","data-i":"1"},H1={class:"ico"},G1={class:"step","data-i":"2"},W1={class:"ico"},X1=["src"],j1={class:"qr_border"},q1=Ue(l.defineComponent({__name:"CompletedQRCode",setup(o){const s=It(),i=St(),u=lt(),f=Re.useRouter(),h={src:s.itemThemes.logo||"",width:60,height:60,excavate:!0},m=l.computed(()=>s.itemThemes.kiosk_qr_payment_timeout||60).value,x=l.ref(m);let _=0;const p=l.computed(()=>{const P=Math.floor(x.value/60),v=x.value%60;return`${P}:${v.toString().padStart(2,"0")}`}),C=l.computed(()=>x.value/m*100),y=l.computed(()=>i.paymentCostQR),S=()=>{x.value--,x.value<=0&&(clearInterval(_),M())},M=()=>{u.removeFromLocalStorage(["cart","authTokensAccess","authTokensRefresh","user"]),sessionStorage.removeItem("is_adult"),f.replace({name:"home"}).then(()=>f.go(0))};l.onMounted(()=>{_=setInterval(S,1e3)}),l.onBeforeUnmount(()=>{clearInterval(_)});const{mediaUrl:k}=Fn(()=>s.itemThemes.kiosk_preloader?"preloader":null);return(P,v)=>(l.openBlock(),l.createElementBlock("div",N1,[(l.openBlock(),l.createElementBlock("video",{loop:"",autoplay:"",muted:"",playsinline:"",key:l.unref(k)},[l.createElementVNode("source",{src:l.unref(k)||"",type:"video/webm"},null,8,T1)])),v[7]||(v[7]=l.createElementVNode("div",{class:"start_img_black"},null,-1)),l.createElementVNode("div",k1,[l.createElementVNode("div",R1,[l.createElementVNode("div",O1,[l.createElementVNode("img",{src:l.unref(la),width:"100",height:"100"},null,8,B1)]),v[6]||(v[6]=l.createElementVNode("h1",null,"Оплата по QR",-1)),l.createElementVNode("p",M1,[l.createVNode(Xt,{price:y.value,fixedFloat:2},null,8,["price"]),l.createTextVNode(" "+l.toDisplayString(l.unref(u).config_lib.currency_symbol),1)]),l.createElementVNode("div",v1,[l.createElementVNode("div",D1,[v[0]||(v[0]=l.createElementVNode("span",null,"Срок жизни QR-кода",-1)),l.createElementVNode("b",null,l.toDisplayString(p.value),1)]),l.createElementVNode("div",P1,[l.createElementVNode("div",{class:"ttl_fill",style:l.normalizeStyle({width:`${C.value}%`})},null,4)])]),l.createElementVNode("p",L1,[l.createElementVNode("div",F1,[l.createElementVNode("div",V1,[l.createElementVNode("div",U1,[l.createVNode(E1)]),v[1]||(v[1]=l.createElementVNode("div",{class:"txt"},"Возьмите телефон →",-1))]),v[4]||(v[4]=l.createElementVNode("div",{class:"sep"},null,-1)),l.createElementVNode("div",z1,[l.createElementVNode("div",H1,[l.createVNode(I1)]),v[2]||(v[2]=l.createElementVNode("span",{class:"txt"},"Отсканируйте QR-код",-1))]),v[5]||(v[5]=l.createElementVNode("span",{class:"sep"},"→",-1)),l.createElementVNode("div",G1,[l.createElementVNode("div",W1,[l.createElementVNode("img",{src:l.unref(S1),width:"30",height:"30"},null,8,X1)]),v[3]||(v[3]=l.createElementVNode("span",{class:"txt"},"Оплатите заказ",-1))])])]),l.createElementVNode("div",j1,[l.createVNode(x1,{value:l.unref(i).linkQR,size:200,level:"Q","render-as":"svg","image-settings":h},null,8,["value"])]),l.createVNode(un,{textButtonDefault:"Отменить заказ",onClick:M,class:"cancel_order_btn"})])])]))}}),[["__scopeId","data-v-bd3b4b16"]]),Z1={key:0,class:"wrapper_qr"},Y1={key:1,class:"wrapper_qr"},$1={key:2,class:"wrapper_qr"},K1={key:3,class:"wrapper_qr"},Q1=Ue(l.defineComponent({__name:"CartCompletedOrder",props:{orderNumber:{}},setup(o){const s=St(),i=It(),{orderNumber:u,orderCompleted_lib:f}=xe.storeToRefs(s),{mediaUrl:h}=Fn(()=>i.itemThemes.kiosk_preloader?"preloader":null);return(m,x)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[l.unref(f)&&l.unref(f)===1?(l.openBlock(),l.createElementBlock("section",Z1,[l.createVNode(l1)])):l.unref(f)&&l.unref(f)===2?(l.openBlock(),l.createElementBlock("section",Y1,[l.createVNode(f1)])):l.createCommentVNode("",!0),l.unref(f)&&l.unref(f)===3?(l.openBlock(),l.createElementBlock("section",$1,[l.createVNode(o1,{orderNumber:l.unref(u),mediaUrl:l.unref(h)},null,8,["orderNumber","mediaUrl"])])):l.createCommentVNode("",!0),l.unref(f)&&l.unref(f)===4?(l.openBlock(),l.createElementBlock("section",K1,[l.createVNode(q1)])):l.createCommentVNode("",!0)],64))}}),[["__scopeId","data-v-3779e8ee"]]),J1={},ef={class:"cart_loyal_qr",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"};function tf(o,s){return l.openBlock(),l.createElementBlock("svg",ef,[...s[0]||(s[0]=[l.createElementVNode("path",{d:"M19 20H20M16 20H14V17M17 17H20V14H19M14 14H16M4 16.9997C4 16.0679 4 15.6019 4.15224 15.2344C4.35523 14.7443 4.74432 14.3552 5.23438 14.1522C5.60192 14 6.06786 14 6.99974 14C7.93163 14 8.39808 14 8.76562 14.1522C9.25568 14.3552 9.64467 14.7443 9.84766 15.2344C9.9999 15.6019 9.9999 16.0681 9.9999 17C9.9999 17.9319 9.9999 18.3978 9.84766 18.7654C9.64467 19.2554 9.25568 19.6447 8.76562 19.8477C8.39808 19.9999 7.93162 19.9999 6.99974 19.9999C6.06786 19.9999 5.60192 19.9999 5.23438 19.8477C4.74432 19.6447 4.35523 19.2557 4.15224 18.7656C4 18.3981 4 17.9316 4 16.9997ZM14 6.99974C14 6.06786 14 5.60192 14.1522 5.23438C14.3552 4.74432 14.7443 4.35523 15.2344 4.15224C15.6019 4 16.0679 4 16.9997 4C17.9316 4 18.3981 4 18.7656 4.15224C19.2557 4.35523 19.6447 4.74432 19.8477 5.23438C19.9999 5.60192 19.9999 6.06812 19.9999 7C19.9999 7.93188 19.9999 8.39783 19.8477 8.76537C19.6447 9.25542 19.2557 9.64467 18.7656 9.84766C18.3981 9.9999 17.9316 9.9999 16.9997 9.9999C16.0679 9.9999 15.6019 9.9999 15.2344 9.84766C14.7443 9.64467 14.3552 9.25568 14.1522 8.76562C14 8.39808 14 7.93163 14 6.99974ZM4 6.99974C4 6.06786 4 5.60192 4.15224 5.23438C4.35523 4.74432 4.74432 4.35523 5.23438 4.15224C5.60192 4 6.06786 4 6.99974 4C7.93163 4 8.39808 4 8.76562 4.15224C9.25568 4.35523 9.64467 4.74432 9.84766 5.23438C9.9999 5.60192 9.9999 6.06812 9.9999 7C9.9999 7.93188 9.9999 8.39783 9.84766 8.76537C9.64467 9.25542 9.25568 9.64467 8.76562 9.84766C8.39808 9.9999 7.93162 9.9999 6.99974 9.9999C6.06786 9.9999 5.60192 9.9999 5.23438 9.84766C4.74432 9.64467 4.35523 9.25568 4.15224 8.76562C4 8.39808 4 7.93163 4 6.99974Z",stroke:"white","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const nf=Ue(J1,[["render",tf]]),fa=o=>{const s=fo(),i=x=>s.open(o,x),u=()=>s.close(o),f=s.state(o),h=l.computed({get:()=>f.value.visible,set:x=>x&&i()||u()}),m=l.computed(()=>f.value.context);return{visible:h,context:m,open:i,close:u}},rf={class:"cart_deletion_modal_content"},of={class:"cart_deletion_modal_title"},sf={class:"cart_deletion_modal_footer"},af=Ue(l.defineComponent({__name:"CartDeleteConfirm",emits:["confirm"],setup(o,{emit:s}){const i=s,{visible:u,context:f,close:h}=fa("cart-delete-confirm"),m=()=>{i("confirm",f.value.idSystem),h()};return(x,_)=>(l.openBlock(),l.createBlock(l.Transition,{name:"fade"},{default:l.withCtx(()=>[l.unref(u)?(l.openBlock(),l.createElementBlock("div",{key:0,class:"cart_deletion_modal_overlay",onClick:_[1]||(_[1]=l.withModifiers((...p)=>l.unref(h)&&l.unref(h)(...p),["self"]))},[l.createElementVNode("div",rf,[l.createElementVNode("div",of,"Удалить "+l.toDisplayString(l.unref(f).name)+"?",1),_[2]||(_[2]=l.createElementVNode("div",{class:"cart_deletion_modal_body"},"Эта позиция будет полностью удалена из заказа.",-1)),l.createElementVNode("div",sf,[l.createElementVNode("button",{class:"primary",onClick:m}," Удалить "),l.createElementVNode("button",{onClick:_[0]||(_[0]=(...p)=>l.unref(h)&&l.unref(h)(...p))},"Отмена")])])])):l.createCommentVNode("",!0)]),_:1}))}}),[["__scopeId","data-v-018f66f3"]]),lf={class:"cart_wrapper"},cf={class:"cart_header_content"},uf={key:0,class:"cart_header_subwrapper"},df={class:"cart_kso_button_wrapper"},ff={key:0},hf={key:0,class:"kso_btn_wrapper"},gf=["src"],mf={key:0,class:"cart_qr_button_wrapper"},pf={class:"cart_header_info"},xf={class:"cart_header_info"},wf={class:"cart_header_info"},_f={class:"cart_header_info"},Cf={key:1,class:"cart-tabs-wrapper"},Ef={class:"cart-tabs-container"},yf=["data-active","onClick"],bf={key:0,class:"wrapper_comment"},Af={class:"wrapper_limit_in_area"},If=["placeholder","aria-invalid"],Sf={class:"limit_comment"},Nf={key:1,class:"wrapper_comment"},Tf={class:"wrapper_limit_in_area"},kf=["placeholder","aria-invalid"],Rf={class:"limit_comment"},Of={key:2},Bf={class:"cart_cards"},Mf={class:"cart_footer_wrapper"},vf={key:0,class:"footer_title"},Df=["disabled","max"],Pf={key:1,class:"footer_sales"},Lf=["max"],Ff={class:"list_price"},Vf={key:0},Uf={key:1},zf={key:2},Hf={class:"accept_field"},Gf={class:"accept_field"},Wf={key:3},Xf={class:"accept_field"},jf={class:"accept_field"},qf={class:"accept_field"},Zf={key:3,class:"cart_min_order_notice"},Yf={class:"wrapper_footer_cart_btn"},$f=l.defineComponent({__name:"CartPage",props:{configPage:{},textPaymentBtn:{},config_qr:{type:Boolean}},setup(o){const s=En.create();let i;const u=lt(),f=St(),h=It(),m=o,{totalPrice_lib:x,countBonus:_,config_lib:p,cartProducts_lib:C,profile:y}=xe.storeToRefs(u),{itemThemes:S}=xe.storeToRefs(h),{textPaymentBtn_lib:M,isButtonDisabled:k,orderCompleted_lib:P,orderNumber:v,extraDiscount:U,is_notification_lib:B,discountBtn:R,is_paymentCart:D,providerTypes:K,notificationData_lib:te,selectedProvider:z,configPayment:ie}=xe.storeToRefs(f),W=Re.useRouter(),se=Re.useRoute(),j=l.useTemplateRef("stickerLoyality"),G=l.ref(!1),V=l.ref(!1),X=l.useTemplateRef("commentEl"),N=l.ref(""),$=l.ref(!1),H=l.ref(!1),J=l.ref(!1),q=l.ref(0),re=l.ref(0),ge=l.ref(),we=l.computed(()=>m.configPage.qr_menu?"YOOKASSA_BASE":K.value[0].front_type),Ne=l.computed(()=>m.configPage.qr_menu?"YOOKASSA":K.value[0].type),{width:_e}=Wt.useElementSize(j,{width:0,height:0},{box:"border-box"}),Me=l.computed(()=>{const be={energy_amount:0,proteins_amount:0,fat_amount:0,carbohydrates_amount:0};return C.value.reduce((le,Qe)=>(le.energy_amount+=(Qe.energy_amount||0)*(Qe.amount||0),le.proteins_amount+=(Qe.proteins_amount||0)*(Qe.amount||0),le.fat_amount+=(Qe.fat_amount||0)*(Qe.amount||0),le.carbohydrates_amount+=(Qe.carbohydrates_amount||0)*(Qe.amount||0),le),be)}),he=l.computed(()=>{var be;if((be=S.value)!=null&&be.comments){const le=S.value.comments;return{fieldName:m.configPage.kiosk_menu?le.kiosk_comment_field_name:le.qr_comment_field_name,placeholder:m.configPage.kiosk_menu?le.kiosk_comment_field_placeholder:le.qr_comment_field_placeholder,show:m.configPage.kiosk_menu?le.kiosk_show_order_comment:le.qr_show_order_comment}}}),dt=Wt.computedAsync(async be=>{var Ke;const le=new AbortController;if(be(()=>le.abort()),!G.value||!((Ke=y.value)!=null&&Ke.balance))return 0;const Qe=await s.maxPayByBonuses(x.value,m.configPage.kiosk_menu,!!m.configPage.userData||!!y.value,le.signal);return Qe!=null&&Qe.by_bonuses?y.value.balance>Qe.by_bonuses?Qe.by_bonuses:y.value.balance:0},0,{shallow:!0}),Xe=()=>W.push(`/${se.params.orgId}/`),Oe=be=>{["a","A","+","-",".",","].includes(be.key)&&be.preventDefault()},qe=be=>{u.deleteItemFromCart(be),C.value.length===0&&(H.value=!1,J.value=!1)},me=()=>{H.value=!H.value,N.value.length},Ze=l.computed(()=>{var le;return(((le=S.value.cart_loyalty_button)==null?void 0:le.cart_loyalty_button_text)||"Программа лояльности").replace(/\S+/g,Qe=>Qe.length>15?Qe.slice(0,15)+"...":Qe)}),Ee=()=>{J.value=!J.value,N.value.length},mt=()=>{let be=Math.floor(_.value)||0;be>dt.value&&(be=dt.value),be!==_.value&&u.setBonus(be)};l.watchEffect(()=>{mt(),u.setBonus(x.value===0?0:Math.floor(_.value))});const nt=()=>C.value.map(be=>({id:be.id,front_item_id:be.idSystem,is_fake:!!be.is_fake,is_od_united_product:!!be.is_od_united_product,removals:be.removals??null,amount:be.amount,size:be.size,modifiers:be.modifiers??[],group_modifiers:be.group_modifiers??[]})),{makeCreateOrderRequest:jt}=aa(),ot=l.computed(()=>nt()),ze=l.computed(()=>{var be,le,Qe,Ke;return m.configPage.qr_menu&&((le=(be=S.value)==null?void 0:be.comments)==null?void 0:le.qr_is_order_comment_required)||m.configPage.kiosk_menu&&((Ke=(Qe=S.value)==null?void 0:Qe.comments)==null?void 0:Ke.kiosk_is_order_comment_required)}),He=()=>{var be,le;return ze.value&&((le=(be=N.value)==null?void 0:be.trim())==null?void 0:le.length)<1&&X.value?(f.showNotification("Обязательно перед созданием заказа укажите комментарий к заказу"),X.value.focus(),$.value=!0,At.animate(X.value.parentElement,{x:[0,-10,0,10,0]},{duration:.1,repeat:2}),!0):!1},Cr=async()=>{if(!y.value&&m.configPage.qr_menu){W.push(`/${se.params.orgId}/register`);return}if(!(ze.value&&He())){if(m.configPage.qr_menu||K.value.length<=1){p.value.has_rms_discount&&!S.value.hide_discounts_calculate_button&&ge!=null?(k.value=!0,await Fr(ge.value,Ne.value).then(be=>{const le=ie.value;le&&(le.is_tableservice?js(le,null):be.url&&m.configPage.qr_menu&&window.location.replace(be.url))})):(z.value={front_type:we},await jt(m.configPage,{paymentMethodId:we.value,items:ot.value,tableDataId:m.configPage.tableDataId,comment:N.value,isAuthorized:!!m.configPage.userData||!!y,signal:i==null?void 0:i.signal}));return}return D.value=!D.value}},ye=()=>{D.value=!1},Er=async()=>{var Qe,Ke,de,ft,Ye,rt,Ve;if(p.value.has_rms_discount&&ze.value&&He())return;U.value=0,k.value=!0;const be={items:[...nt()],table:((Qe=m.configPage)==null?void 0:Qe.tableDataId)||null,combos:[]};(Ke=m.configPage)!=null&&Ke.kiosk_menu&&((de=f.selectedOrderType)!=null&&de.id)&&(be.order_type_id=(ft=f.selectedOrderType)==null?void 0:ft.id);const le=En.create();i=new AbortController;try{V.value=!0;const qt=await le.calculateDiscount(be,m.configPage.kiosk_menu,!!m.configPage.userData||!!y.value,i.signal);if(!C.value)return;if(C.value.forEach(Nt=>{const De=qt.items.find(yt=>yt.front_item_id===Nt.idSystem);if(De&&(Nt.group_modifiers.forEach(yt=>{const Pt=De.group_modifiers.find(Lt=>Lt.group===yt.group);Pt&&yt.modifiers.forEach(Lt=>{const xt=Pt.modifiers.find(Un=>Un.id===Lt.id);if(xt&&Number(Lt.price)!==Number(xt==null?void 0:xt.new_price)){const Un=(xt.discounts||[]).reduce((Bt,Gn)=>Bt+=+Gn.discount,0);q.value+=Un,Lt.new_price=Lt.price,Lt.price=Number(xt==null?void 0:xt.new_price),Lt.total_new_price=Number(xt.total_new_price)}})}),Nt.modifiers.forEach(yt=>{const Pt=De.modifiers.find(Lt=>Lt.id===yt.id);if(Pt&&Number(yt.price)!==Number(Pt==null?void 0:Pt.new_price)){const Lt=(Pt.discounts||[]).reduce((xt,Un)=>xt+=+Un.discount,0);q.value+=Lt,yt.new_price=yt.price,yt.price=Number(Pt==null?void 0:Pt.new_price),yt.total_new_price=Number(Pt.total_new_price)}}),Nt.price!==Number(De.new_price))){const yt=(De.discounts||[]).reduce((Pt,Lt)=>Pt+=+Lt.discount,0);q.value=q.value+yt,Nt.new_price=Nt.price,Nt.price=De.new_price,Nt.discounts=De.discounts,Nt.total_new_price=Number(De.total_new_price)}}),C.value=[...C.value],q.value!==0&&(x.value=qt.total_cart_price),p.value.has_rms_discount){z.value={front_type:we};const Nt=await jt(m.configPage,{paymentMethodId:we.value,items:ot.value,tableDataId:m.configPage.tableDataId,comment:N.value,isAuthorized:!!m.configPage.userData||!!y,signal:i==null?void 0:i.signal});ge.value=(Ye=Nt==null?void 0:Nt.data)==null?void 0:Ye.id}else k.value=!1;R.value=!1}catch(qt){et.isCancel(qt)||f.showNotification(((Ve=(rt=qt==null?void 0:qt.response)==null?void 0:rt.data)==null?void 0:Ve.user_friendly_message)||"Скидки временно недоступны"),R.value=!0,V.value=!1,k.value=!1}},bi=()=>{var be;(be=y.value)!=null&&be.balance?y.value.balance>=1&&(G.value=!G.value):f.showNotification("У Вас пока нет бонусов")},bn=()=>{var be,le;if(S.value.hide_discounts_calculate_button){R.value=!1;return}p.value.has_rms_discount&&(m.configPage.kiosk_menu||m.configPage.qr_menu&&y.value)?(ge.value=null,R.value=!0):((be=p.value)==null?void 0:be.loyalty)==="IIKO"&&(p.value.has_loyalty_default_user||y.value)&&m.configPage.kiosk_menu||((le=p.value)==null?void 0:le.loyalty)==="IIKO"&&m.configPage.qr_menu&&y.value?R.value=!0:R.value=!1};l.onMounted(async()=>{M.value=m.textPaymentBtn,u.loadCart(),P.value=null,x.value=null,U.value=0,C.value.splice(0,C.value.length,...C.value.map(u.makeProductFullyReactive))}),l.onUnmounted(()=>{ge.value=null,P.value=null,x.value=null,U.value=0,C.value.splice(0,C.value.length,...C.value.map(u.makeProductFullyReactive))});const rr=l.computed(()=>x.value-U.value-q.value),Dt=l.computed(()=>m.configPage.qr_menu?p.value.qr_order_minimum_price||0:m.configPage.kiosk_menu&&p.value.kiosk_order_minimum_price||0),Ai=l.computed(()=>Dt.value>rr.value||V.value||k.value?!0:["АВТОРИЗОВАТЬСЯ ДЛЯ ЗАКАЗА"].includes(M.value.toUpperCase())?!1:C.value.length===0||x.value===0?!0:(P.value=null,k.value)),dn=l.computed(()=>{var be;return((be=C.value)==null?void 0:be.reduce((le,Qe)=>le+Qe.amount,0))||0}),Ot=l.computed(()=>{var be;return(be=y.value)==null?void 0:be.phone});return l.watch(N,be=>{var le;return((le=be==null?void 0:be.trim())==null?void 0:le.length)&&($.value=!1)}),l.watch([dn,Ot],()=>{dn.value===0&&(i=null),i==null||i.abort(),k.value=!1}),l.watch([()=>u.cartProducts_lib,Ot,dn,()=>f.selectedOrderType],be=>{if(re.value>0){re.value--;return}be&&!V.value&&(bn(),C.value.splice(0,C.value.length,...C.value.map(u.makeProductFullyReactive)),q.value=0,x.value=null,U.value=0,re.value=1),V.value=!1},{deep:!0}),(be,le)=>{var Qe,Ke,de,ft,Ye,rt;return l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createElementVNode("div",lf,[l.createVNode(af,{onConfirm:qe}),l.createVNode(ia,{visible:l.unref(f).isDrawerOpen,"onUpdate:visible":le[0]||(le[0]=Ve=>l.unref(f).isDrawerOpen=Ve)},{default:l.withCtx(()=>[l.createVNode(sa)]),_:1},8,["visible"]),l.createElementVNode("header",cf,[m.configPage.kiosk_menu?(l.openBlock(),l.createElementBlock("div",uf,[l.createElementVNode("div",df,[l.createElementVNode("div",{class:l.normalizeClass(["arrow_wrapper",{arrow_wrapper_kso:m.configPage.kiosk_menu}]),onClick:Xe},[l.createVNode(Ur,{class:"cart_header_back_button"}),m.configPage.kiosk_menu?(l.openBlock(),l.createElementBlock("span",ff,"Назад")):l.createCommentVNode("",!0)],2)]),he.value&&he.value.show?(l.openBlock(),l.createElementBlock("div",hf,[ze.value?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(un,{key:0,style:l.normalizeStyle({visibility:!H.value&&l.unref(C).length>0?"visible":"hidden"}),class:l.normalizeClass({button_kso_comment:o.configPage.kiosk_menu}),textButtonDefault:N.value.length>0?"Редактировать":he.value&&he.value.fieldName||"",onClick:()=>H.value=!H.value,id:"button_kso_comment"},null,8,["style","class","textButtonDefault","onClick"]))])):l.createCommentVNode("",!0),l.createElementVNode("div",{class:l.normalizeClass({cart_header_wrapper:m.configPage.kiosk_menu})},[(l.unref(S).kiosk_show_loyalty_card_button||l.unref(S).kiosk_show_loyalty_phone_input_button)&&!m.config_qr?(l.openBlock(),l.createElementBlock("button",{key:0,class:"buttonDefaultWrapper button_payment_cart button_payment_cart_loyal",style:l.normalizeStyle({marginRight:(Qe=l.unref(S).cart_loyalty_button)!=null&&Qe.cart_loyalty_button_sticker?`${Math.ceil(l.unref(_e)/2+10)}px`:"",paddingRight:(Ke=l.unref(S).cart_loyalty_button)!=null&&Ke.cart_loyalty_button_sticker?0:""}),onClick:le[1]||(le[1]=(...Ve)=>l.unref(f).openDrawer&&l.unref(f).openDrawer(...Ve))},[l.createElementVNode("p",{class:"cart_loyal_program",style:l.normalizeStyle({marginRight:`${Math.ceil(l.unref(_e)/2)}px`})},l.toDisplayString(Ze.value),5),(de=l.unref(S).cart_loyalty_button)!=null&&de.cart_loyalty_button_sticker?(l.openBlock(),l.createElementBlock("div",{key:0,ref_key:"stickerLoyality",ref:j,class:"cart_loyal_program_icon",style:l.normalizeStyle({"--sticker-mask":`url(${l.unref(S).cart_loyalty_button.cart_loyalty_button_sticker})`})},[l.createElementVNode("img",{src:l.unref(S).cart_loyalty_button.cart_loyalty_button_sticker},null,8,gf)],4)):(l.openBlock(),l.createBlock(nf,{key:1,class:"cart_loyal_qr"}))],4)):l.createCommentVNode("",!0)],2)])):l.createCommentVNode("",!0),l.createElementVNode("div",{class:l.normalizeClass([o.config_qr?"cart_kbju_qr_wrapper":"cart_kbju_kso_wrapper"])},[o.config_qr?(l.openBlock(),l.createElementBlock("div",mf,[l.createElementVNode("div",{class:"arrow_wrapper",onClick:Xe},[l.createVNode(Ur,{class:"cart_header_back_button"})])])):l.createCommentVNode("",!0),l.unref(S).show_nutrition_in_cart?(l.openBlock(),l.createElementBlock("div",{key:1,class:"cart_header",style:l.normalizeStyle({paddingTop:m.config_qr?0:"10px",paddingRight:m.config_qr?"10px":0})},[l.createElementVNode("div",pf,[l.createElementVNode("p",null,[l.createVNode(Xt,{price:Me.value.energy_amount,duration:800},null,8,["price"]),le[8]||(le[8]=l.createTextVNode(" г",-1))]),le[9]||(le[9]=l.createElementVNode("p",{class:"cart_info_name"},"Килокалории",-1))]),l.createElementVNode("div",xf,[l.createElementVNode("p",null,[l.createVNode(Xt,{price:Me.value.proteins_amount,duration:900},null,8,["price"]),le[10]||(le[10]=l.createTextVNode(" г",-1))]),le[11]||(le[11]=l.createElementVNode("p",{class:"cart_info_name"},"Белки",-1))]),l.createElementVNode("div",wf,[l.createElementVNode("p",null,[l.createVNode(Xt,{price:Me.value.fat_amount,duration:1e3},null,8,["price"]),le[12]||(le[12]=l.createTextVNode(" г",-1))]),le[13]||(le[13]=l.createElementVNode("p",{class:"cart_info_name"},"Жиры",-1))]),l.createElementVNode("div",_f,[l.createElementVNode("p",null,[l.createVNode(Xt,{price:Me.value.carbohydrates_amount,duration:1100},null,8,["price"]),le[14]||(le[14]=l.createTextVNode(" г",-1))]),le[15]||(le[15]=l.createElementVNode("p",{class:"cart_info_name"},"Углеводы",-1))])],4)):l.createCommentVNode("",!0)],2),o.configPage.kiosk_menu&&l.unref(f).orderTypes.length>1?(l.openBlock(),l.createElementBlock("div",Cf,[l.createElementVNode("ul",Ef,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(f).orderTypes,Ve=>{var qt,Nt;return l.openBlock(),l.createElementBlock("li",{key:Ve.id,class:"cart-tab","data-active":Ve.id===((qt=l.unref(f).selectedOrderType)==null?void 0:qt.id),onClick:De=>l.unref(f).selectedOrderType=Ve},[Ve.id===((Nt=l.unref(f).selectedOrderType)==null?void 0:Nt.id)?(l.openBlock(),l.createBlock(l.unref(At.motion).div,{key:0,class:"cart-underline","layout-id":"cart-underline",id:"cart-underline"})):l.createCommentVNode("",!0),l.createElementVNode("span",null,l.toDisplayString(Ve.name),1)],8,yf)}),128))])])):l.createCommentVNode("",!0)]),(ze.value||H.value)&&o.configPage.kiosk_menu&&((ft=l.unref(C))!=null&&ft.length)?(l.openBlock(),l.createElementBlock("div",bf,[l.createElementVNode("div",Af,[l.withDirectives(l.createElementVNode("textarea",{ref_key:"commentEl",ref:X,class:"comment_order",placeholder:he.value&&he.value.placeholder||"Ваш комментарий к заказу...",name:"commentKso",maxlength:"50","aria-invalid":$.value,"onUpdate:modelValue":le[2]||(le[2]=Ve=>N.value=Ve)},null,8,If),[[l.vModelText,N.value]]),l.createElementVNode("p",Sf,l.toDisplayString(N.value.length+" / 50"),1)]),ze.value?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(un,{key:0,textButtonDefault:"Сохранить",onClick:me,class:"button_bonus_cart"}))])):l.createCommentVNode("",!0),(ze.value||J.value)&&o.config_qr&&((Ye=l.unref(C))!=null&&Ye.length)?(l.openBlock(),l.createElementBlock("div",Nf,[l.createElementVNode("div",Tf,[l.withDirectives(l.createElementVNode("textarea",{ref_key:"commentEl",ref:X,class:"comment_order",placeholder:he.value&&he.value.placeholder||"Ваш комментарий к заказу...",name:"commentQr",maxlength:"50","aria-invalid":$.value,"onUpdate:modelValue":le[3]||(le[3]=Ve=>N.value=Ve)},null,8,kf),[[l.vModelText,N.value]]),l.createElementVNode("p",Rf,l.toDisplayString(N.value.length+" / 50"),1)]),ze.value?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(un,{key:0,textButtonDefault:"Сохранить",onClick:Ee,class:"button_bonus_cart"}))])):l.createCommentVNode("",!0),o.config_qr&&he.value&&he.value.show?(l.openBlock(),l.createElementBlock("div",Of,[!ze.value&&!J.value&&l.unref(C).length>0?(l.openBlock(),l.createBlock(un,{key:0,textButtonDefault:N.value.length>0?"Редактировать":he.value.fieldName||"",onClick:()=>J.value=!J.value,id:"button_comments"},null,8,["textButtonDefault","onClick"])):l.createCommentVNode("",!0)])):l.createCommentVNode("",!0),l.createElementVNode("div",Bf,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(C),Ve=>(l.openBlock(),l.createBlock(oa,{key:Ve.idSystem,cardItem:Ve,onDelete:qt=>qe(Ve.idSystem)},null,8,["cardItem","onDelete"]))),128))]),l.createElementVNode("div",Mf,[G.value?(l.openBlock(),l.createElementBlock("p",vf,[le[16]||(le[16]=l.createTextVNode(" Списать ",-1)),l.withDirectives(l.createElementVNode("input",{type:"number",placeholder:"0",style:l.normalizeStyle({maxWidth:`${l.unref(_).toString().length||1}em`}),disabled:l.unref(y)===null||((rt=l.unref(y))==null?void 0:rt.balance)===0,"onUpdate:modelValue":le[4]||(le[4]=Ve=>l.isRef(_)?_.value=Ve:null),onInput:mt,min:"0",max:l.unref(dt),onKeypress:Oe},null,44,Df),[[l.vModelText,l.unref(_),void 0,{number:!0}]]),le[17]||(le[17]=l.createTextVNode(" бонусов ",-1))])):l.createCommentVNode("",!0),G.value?(l.openBlock(),l.createElementBlock("p",Pf,"У вас есть "+l.toDisplayString(l.unref(y)?l.unref(y).balance:0)+" B",1)):l.createCommentVNode("",!0),G.value?l.withDirectives((l.openBlock(),l.createElementBlock("input",{key:2,type:"range",class:"footer_range","onUpdate:modelValue":le[5]||(le[5]=Ve=>l.isRef(_)?_.value=Ve:null),min:0,max:l.unref(dt)},null,8,Lf)),[[l.vModelText,l.unref(_),void 0,{number:!0}]]):l.createCommentVNode("",!0),l.createElementVNode("ul",Ff,[G.value?(l.openBlock(),l.createElementBlock("li",Vf,[le[19]||(le[19]=l.createElementVNode("p",null,"Сумма заказа:",-1)),l.createElementVNode("p",null,[l.createVNode(Xt,{price:l.unref(x),fixedFloat:2},null,8,["price"]),le[18]||(le[18]=l.createTextVNode(" ₽",-1))])])):l.createCommentVNode("",!0),G.value?(l.openBlock(),l.createElementBlock("li",Uf,[le[21]||(le[21]=l.createElementVNode("p",null,"Будет оплачено бонусами:",-1)),l.createElementVNode("p",null,[l.createVNode(Xt,{price:l.unref(_),fixedFloat:2},null,8,["price"]),le[20]||(le[20]=l.createTextVNode(" Б",-1))])])):l.createCommentVNode("",!0),l.unref(U)!==0?(l.openBlock(),l.createElementBlock("li",zf,[l.createElementVNode("p",Hf,l.toDisplayString(l.unref(U)>0?"Надбавка":"Скидка")+": ",1),l.createElementVNode("p",Gf,[l.createVNode(Xt,{price:Math.abs(l.unref(U)),fixedFloat:2},null,8,["price"]),le[22]||(le[22]=l.createTextVNode(" ₽",-1))])])):q.value!==0?(l.openBlock(),l.createElementBlock("li",Wf,[l.createElementVNode("p",Xf,l.toDisplayString(q.value>0?"Надбавка":"Скидка")+": ",1),l.createElementVNode("p",jf,[l.createVNode(Xt,{price:Math.abs(q.value),fixedFloat:2},null,8,["price"]),le[23]||(le[23]=l.createTextVNode(" ₽",-1))])])):l.createCommentVNode("",!0),l.createElementVNode("li",null,[le[25]||(le[25]=l.createElementVNode("p",{class:"accept_field"},"Итого к оплате:",-1)),l.createElementVNode("p",qf,[l.createVNode(Xt,{price:l.unref(x)-l.unref(_),fixedFloat:2},null,8,["price"]),le[24]||(le[24]=l.createTextVNode(" ₽",-1))])])]),Dt.value&&rr.value<Dt.value?(l.openBlock(),l.createElementBlock("div",Zf,[le[26]||(le[26]=l.createTextVNode(" Минимальная сумма заказа ",-1)),l.createVNode(Xt,{price:Dt.value,fixedFloat:2},null,8,["price"]),l.createTextVNode(" "+l.toDisplayString(l.unref(p).currency_symbol)+". Для оформления заказа необходимо добавить товаров на сумму ",1),l.createVNode(Xt,{price:Dt.value-rr.value,fixedFloat:2},null,8,["price"]),l.createTextVNode(" "+l.toDisplayString(l.unref(p).currency_symbol),1)])):l.createCommentVNode("",!0),l.createElementVNode("div",Yf,[l.unref(y)?(l.openBlock(),l.createBlock(un,{key:0,textButtonDefault:l.unref(S).bonuses_button_name||"Бонусы",onClick:bi,class:"button_bonus_cart"},null,8,["textButtonDefault"])):l.createCommentVNode("",!0),l.createVNode(un,{textButtonDefault:l.unref(R)?"Рассчитать скидки":l.unref(M),onClick:l.unref(R)?Er:Cr,class:"button_payment_cart",disabled:Ai.value},null,8,["textButtonDefault","onClick","disabled"])])])]),l.createVNode(Q1,{orderNumber:l.unref(v),pageNumber:1},null,8,["orderNumber"]),l.createVNode(lo,{visible:l.unref(B),"onUpdate:visible":le[6]||(le[6]=Ve=>l.isRef(B)?B.value=Ve:null),textNotificationDefault:l.unref(te).textNotification,backgroundColor:l.unref(S).accent_color?l.unref(S).accent_color:"#FF6D2E",buttonAccept:null},null,8,["visible","textNotificationDefault","backgroundColor"]),l.createVNode(uo,{modelValue:l.unref(D),"onUpdate:modelValue":le[7]||(le[7]=Ve=>l.isRef(D)?D.value=Ve:null),class:"product_card_sheet","snap-points":["80%"]},{default:l.withCtx(()=>{var Ve;return[l.createVNode(K0,{"config-page":o.configPage,comment:N.value,"cart-items":ot.value,"is-authorized":!!m.configPage.userData||!!l.unref(y),"has-rms-discount":l.unref(p).has_rms_discount,"hide-discounts-button":l.unref(S).hide_discounts_calculate_button,"order-id":ge.value,signal:(Ve=l.unref(i))==null?void 0:Ve.signal,onSelectPayment:ye},null,8,["config-page","comment","cart-items","is-authorized","has-rms-discount","hide-discounts-button","order-id","signal"])]}),_:1},8,["modelValue"])],64)}}}),Kf={},Qf={viewBox:"0 0 24 24"};function Jf(o,s){return l.openBlock(),l.createElementBlock("svg",Qf,[...s[0]||(s[0]=[l.createElementVNode("path",{d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const eh=Ue(Kf,[["render",Jf]]),th={class:"retry_screen"},nh={class:"retry_all_in_screen"},rh={class:"retry_content"},ih={class:"retry_icon_wrap"},oh={class:"retry_icon_circle"},sh={class:"retry_error_x"},ah=l.defineComponent({__name:"RetryPage",setup(o){const s=St(),i=Re.useRouter(),u=Re.useRoute(),f=()=>{s.notificationData_lib.textNotification="",s.is_notification_lib=!1,i.replace(`/${u.params.orgId}/`)};return(h,m)=>(l.openBlock(),l.createElementBlock("section",th,[l.createElementVNode("div",nh,[l.createElementVNode("main",rh,[l.createElementVNode("div",ih,[l.createElementVNode("div",oh,[m[0]||(m[0]=l.createElementVNode("div",{class:"retry_loader_mini"},null,-1)),l.createElementVNode("div",sh,[l.createVNode(eh)])])]),m[1]||(m[1]=l.createElementVNode("div",{class:"retry_oops"},"OOPS",-1)),m[2]||(m[2]=l.createElementVNode("h1",{class:"retry_title"},"Что-то пошло не так",-1)),m[3]||(m[3]=l.createElementVNode("div",{class:"retry_hint"},[l.createElementVNode("p",null,"Похоже, произошёл технический сбой."),l.createElementVNode("p",null,"Мы уже знаем о проблеме и сейчас разбираемся."),l.createElementVNode("p",null,"Приносим извинения за доставленные неудобства."),l.createElementVNode("p",null,"Попробуйте начать новый заказ.")],-1))]),l.createElementVNode("div",{class:"retry_footer"},[l.createElementVNode("button",{onClick:f,class:"retry_new_order_btn"},"Новый заказ")]),m[4]||(m[4]=l.createElementVNode("p",{class:"retry_bottom_note"},"Если ошибка повторяется — обратитесь к сотруднику зала.",-1))])]))}}),lh={class:"wrapper_loader"},ch=l.defineComponent({__name:"Loader",props:{size:{type:String,default:"40px"}},setup(o){return(s,i)=>(l.openBlock(),l.createElementBlock("div",lh,[l.createElementVNode("div",{class:"loader",style:l.normalizeStyle({width:o.size})},null,4)]))}}),uh=Ue(l.defineComponent({__name:"AnimationLoader",props:{id:{}},setup(o){const s=l.ref(!0);return l.watch(()=>s.value,()=>{s.value=!1,setTimeout(()=>{s.value=!0},0)}),(i,u)=>(l.openBlock(),l.createElementBlock("div",{class:"opacity-animation",key:o.id},[l.renderSlot(i.$slots,"opacityLoader",{},void 0,!0)]))}}),[["__scopeId","data-v-c6b97942"]]),dh={key:0},fh={class:"card__main__wrapper"},hh={key:0,class:"folder_content_top"},gh={key:0,class:"loader_card_main"},mh=["src","alt"],ph={class:"card_title_price_wrapper"},xh={class:"title"},wh={key:0,class:"price"},_h={key:1},Ch={key:0,class:"card_button_add_wrapper"},ha=Ue(l.defineComponent({__name:"CardMain",props:{data:{},activeTags:{},is_group:{type:Boolean},parent:{},isLoading:{type:Boolean},selectGroupChild:{type:Function},takeCurrentCard:{type:Function}},setup(o){It();const s=lt(),i=Rt(),{is_18_above_content:u,is18Allowed:f,notificationData_lib:h}=xe.storeToRefs(s),{isDesktop:m}=Nn(),x=o,_=(S,M)=>{var v,U,B;const k={id:S.id,is_fake:S.is_fake||!1,is_od_united_product:S.is_od_united_product||!1,amount:S.amount||1,name:S.name,image_link:S.image_link,price:S.price,old_price:S.price,size:void 0,sizes:[],modifiers:[],groups:S.groups,group_modifiers:[],energy_amount:S.energy_amount??0,proteins_amount:S.proteins_amount??0,fat_amount:S.fat_amount??0,carbohydrates_amount:S.carbohydrates_amount??0},P=!((v=S.modifiers)!=null&&v.length)&&!((U=S.group_modifiers)!=null&&U.length)&&!((B=S.sizes)!=null&&B.length);if(i.isUpSale=!1,S.adult&&!f.value){u.value=!0,P&&(h.value.fastAdd=k);return}if(P){s.addToCart(k);return}if(S.amount||(S.amount=1),x.is_group&&x.selectGroupChild){x.selectGroupChild({...S,parent:x.parent,child:M.child_groups});return}x.takeCurrentCard&&x.takeCurrentCard(M.id)},p=S=>{if(x.is_group&&x.selectGroupChild){S={...S,parent:x.parent,child:S.child_groups},x.selectGroupChild(S);return}if(S.adult&&!f.value){u.value=!0;return}x.takeCurrentCard&&x.takeCurrentCard(S.id)},C=l.computed(()=>x.activeTags.every(S=>x.data.tags.includes(S))),{mediaUrl:y}=Fn(()=>x.data.id+"_image",()=>x.data.image_link);return(S,M)=>{var k;return((k=x.activeTags)==null?void 0:k.length)===0||C.value||x.is_group?(l.openBlock(),l.createElementBlock("div",dh,[l.createVNode(uh,{id:x.data.id},{opacityLoader:l.withCtx(()=>[l.createElementVNode("div",fh,[o.is_group?(l.openBlock(),l.createElementBlock("div",hh)):l.createCommentVNode("",!0),l.createElementVNode("div",{onClick:M[0]||(M[0]=P=>p(x.data)),class:l.normalizeClass(["card__main",{card__main_folder:o.is_group}])},[o.isLoading?(l.openBlock(),l.createElementBlock("div",gh,[l.createVNode(ch)])):(l.openBlock(),l.createElementBlock("div",{key:1,class:l.normalizeClass(["card__main_content",{card_main_desktop_qr:l.unref(m)}])},[l.createElementVNode("img",{src:l.unref(y)||"",class:l.normalizeClass(["img",{card_blur_image:x.data.adult&&!l.unref(f)}]),loading:"lazy",alt:o.data.name},null,10,mh),l.createElementVNode("div",ph,[l.createElementVNode("p",xh,l.toDisplayString(o.data.name),1),o.is_group?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("p",wh,l.toDisplayString(l.unref(dr)(o.data))+" ₽",1))])],2))],2),l.unref(m)?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("div",_h,[o.is_group?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("div",Ch,[l.createElementVNode("div",{onClick:M[1]||(M[1]=P=>_(o.data,x.data)),class:"add_button"},[...M[2]||(M[2]=[l.createElementVNode("div",{class:"image_add_button"},null,-1)])])]))]))])]),_:1},8,["id"])])):l.createCommentVNode("",!0)}}}),[["__scopeId","data-v-bfc53e47"]]),Eh=["id","onClick"],yh=Ue(l.defineComponent({__name:"GroupMain",props:{menuGroup:{},idActiveGroup:{},activeTakeGroup:{type:Function}},setup(o){const{shouldUseDragScroll:s}=Nn(),i=l.ref(null);return(u,f)=>o.menuGroup.length?l.withDirectives((l.openBlock(),l.createElementBlock("ul",{key:0,class:"main__menu",ref_key:"scrollGroup",ref:i},[l.createVNode(oo,{axis:"x",behavior:"smooth",container:i.value,autoScroll:!0,idActive:o.idActiveGroup,clearContainer:!0},{default:l.withCtx(({handleTargetClick:h})=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(o.menuGroup,(m,x)=>(l.openBlock(),l.createElementBlock("li",{key:m.id,id:"scrolling"+m.id,onClick:_=>{o.activeTakeGroup&&o.activeTakeGroup(m.id,x),h(_)},style:l.normalizeStyle(o.idActiveGroup==m.id?{fontFamily:"Bounded"}:{})},l.toDisplayString(m.name),13,Eh))),128))]),_:1},8,["container","idActive"])])),[[l.unref(Vr),l.unref(s)?{}:!1]]):l.createCommentVNode("",!0)}}),[["__scopeId","data-v-aa0ca388"]]),bh=["id","onClick"],Ah=Ue(l.defineComponent({__name:"TagsMain",props:{menuTags:{default:()=>[]},groupIndex:{default:null},isSolo:{type:Boolean,default:!1},currentActiveTag:{},activeTakeTags:{type:Function,default:void 0},activeTakeTagsSolo:{type:Function,default:void 0}},setup(o){const s=o,{shouldUseDragScroll:i}=Nn(),u=l.ref(null),f=l.computed(()=>{if(s.isSolo&&!s.groupIndex)return Array.isArray(s.currentActiveTag)?s.currentActiveTag:[];if(s.groupIndex!==null&&s.groupIndex!==void 0){const h=s.currentActiveTag[s.groupIndex];return Array.isArray(h)?h:[]}return[]});return(h,m)=>o.menuTags.length>0?l.withDirectives((l.openBlock(),l.createElementBlock("ul",{key:0,class:"main__filters",ref_key:"scrollTagContainer",ref:u},[l.createVNode(oo,{axis:"x",behavior:"smooth",container:u.value,autoScroll:!0,idActive:f.value?f.value[o.currentActiveTag.length-1]:null,clearContainer:!1},{default:l.withCtx(({handleTargetClick:x})=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(o.menuTags,(_,p)=>(l.openBlock(),l.createElementBlock("li",{key:p,id:`scrolling${_}`,onClick:C=>{o.activeTakeTags&&(o.groupIndex||o.groupIndex===0)?o.activeTakeTags(_,o.groupIndex):o.activeTakeTagsSolo&&o.activeTakeTagsSolo(_),x(C)},class:l.normalizeClass({main__filter_active:(f.value??[]).includes(_)})},l.toDisplayString(_),11,bh))),128))]),_:1},8,["container","idActive"])])),[[l.unref(Vr),l.unref(i)?{}:!1]]):l.createCommentVNode("",!0)}}),[["__scopeId","data-v-afba730a"]]),Ih=["data-id"],Sh=["src"],Nh=["src"],Th=Ue(l.defineComponent({__name:"DrumItem",props:{group:{},index:{},active:{type:Boolean}},setup(o){const s=o,{mediaUrl:i}=Fn(()=>{var u,f;return(u=s.group)!=null&&u.video_link?`${s.group.id}_video`:(f=s.group)!=null&&f.image_link?`${s.group.id}_image`:null});return(u,f)=>o.group?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass(["drum_item",{active:s.active}]),"data-id":o.group.id},[o.group.video_link?l.withDirectives((l.openBlock(),l.createElementBlock("video",{key:l.unref(i),loop:"",autoplay:"",muted:"",playsinline:"",class:"drum_img"},[l.createElementVNode("source",{src:l.unref(i)||"",type:"video/webm"},null,8,Sh)])),[[l.unref(zr)]]):(l.openBlock(),l.createElementBlock("img",{key:1,class:"drum_img",src:l.unref(i)||""},null,8,Nh)),l.createElementVNode("p",null,l.toDisplayString(o.group.name),1)],10,Ih)):l.createCommentVNode("",!0)}}),[["__scopeId","data-v-2b994529"]]),kh={},Rh={width:"9.998535",height:"10.000000",viewBox:"0 0 9.99854 10",fill:"none",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"};function Oh(o,s){return l.openBlock(),l.createElementBlock("svg",Rh,[...s[0]||(s[0]=[l.createElementVNode("desc",null," Created with Pixso. ",-1),l.createElementVNode("defs",null,null,-1),l.createElementVNode("path",{id:"Форма 5",d:"M4.23 10L5.76 10L5.76 5.74L9.99 5.74L9.99 4.25L5.76 4.25L5.76 0L4.23 0L4.23 4.25L0 4.25L0 5.74L4.23 5.74L4.23 10Z",fill:"#F2F7FF","fill-opacity":"1.000000","fill-rule":"nonzero"},null,-1)])])}const Bh=Ue(kh,[["render",Oh]]),Mh={class:"recommendation_wrapper"},vh={class:"recommendation_header"},Dh={class:"recommendation_info"},Ph=Ue(l.defineComponent({__name:"Recommendation",props:{closeCurrentCard:{},openCurrentCard:{}},setup(o){const s=Rt(),{isUpSale:i,dataUpSale:u}=xe.storeToRefs(s),f=()=>{i.value=!1};return l.onUnmounted(()=>{u.value=null}),(h,m)=>(l.openBlock(),l.createElementBlock("div",Mh,[l.createElementVNode("div",vh,[m[0]||(m[0]=l.createElementVNode("p",{class:"header_title"},"Часто берут вместе",-1)),l.createElementVNode("div",{class:"header_close",onClick:f},[l.createVNode(Bh,{class:"close_icon"})])]),l.createElementVNode("div",Dh,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(u),x=>(l.openBlock(),l.createBlock(ha,{data:x,key:x.id,parent:x.id,is_group:!1,is_product:!0,class:"card",activeTags:[],isLoading:!1,closeCurrentCard:o.closeCurrentCard,takeCurrentCard:()=>o.openCurrentCard(x.id,!0)},null,8,["data","parent","closeCurrentCard","takeCurrentCard"]))),128))])]))}}),[["__scopeId","data-v-d545ec45"]]),Lh=l.defineComponent({__name:"Blackout",props:{data:{type:Boolean}},setup(o){const s=o;return l.watch(()=>s.data,i=>{document.body.style.overflow=i?"hidden":""}),()=>{}}}),Fh={class:"wrapper_modal"},Vh={class:"card_modal"},Uh=Ue(l.defineComponent({__name:"ModalWindows",props:{visible:{type:Boolean}},setup(o){const s=o,i=Rt(),{isUpSale:u}=xe.storeToRefs(i),f=()=>{u.value=!1};return(h,m)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createVNode(Lh,{data:s.visible},null,8,["data"]),l.createElementVNode("div",{class:"black_modal",onClick:f}),l.createElementVNode("div",Fh,[l.createElementVNode("div",Vh,[l.renderSlot(h.$slots,"default",{},void 0,!0)])])],64))}}),[["__scopeId","data-v-ec2b2c4d"]]);var pe;(function(o){o[o.QR_CODE=0]="QR_CODE",o[o.AZTEC=1]="AZTEC",o[o.CODABAR=2]="CODABAR",o[o.CODE_39=3]="CODE_39",o[o.CODE_93=4]="CODE_93",o[o.CODE_128=5]="CODE_128",o[o.DATA_MATRIX=6]="DATA_MATRIX",o[o.MAXICODE=7]="MAXICODE",o[o.ITF=8]="ITF",o[o.EAN_13=9]="EAN_13",o[o.EAN_8=10]="EAN_8",o[o.PDF_417=11]="PDF_417",o[o.RSS_14=12]="RSS_14",o[o.RSS_EXPANDED=13]="RSS_EXPANDED",o[o.UPC_A=14]="UPC_A",o[o.UPC_E=15]="UPC_E",o[o.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(pe||(pe={}));var ga=new Map([[pe.QR_CODE,"QR_CODE"],[pe.AZTEC,"AZTEC"],[pe.CODABAR,"CODABAR"],[pe.CODE_39,"CODE_39"],[pe.CODE_93,"CODE_93"],[pe.CODE_128,"CODE_128"],[pe.DATA_MATRIX,"DATA_MATRIX"],[pe.MAXICODE,"MAXICODE"],[pe.ITF,"ITF"],[pe.EAN_13,"EAN_13"],[pe.EAN_8,"EAN_8"],[pe.PDF_417,"PDF_417"],[pe.RSS_14,"RSS_14"],[pe.RSS_EXPANDED,"RSS_EXPANDED"],[pe.UPC_A,"UPC_A"],[pe.UPC_E,"UPC_E"],[pe.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]),ma;(function(o){o[o.UNKNOWN=0]="UNKNOWN",o[o.URL=1]="URL"})(ma||(ma={}));function zh(o){return Object.values(pe).includes(o)}var xi;(function(o){o[o.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",o[o.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"})(xi||(xi={}));var Hh=function(){function o(){}return o.GITHUB_PROJECT_URL="https://github.com/mebjas/html5-qrcode",o.SCAN_DEFAULT_FPS=2,o.DEFAULT_DISABLE_FLIP=!1,o.DEFAULT_REMEMBER_LAST_CAMERA_USED=!0,o.DEFAULT_SUPPORTED_SCAN_TYPE=[xi.SCAN_TYPE_CAMERA,xi.SCAN_TYPE_FILE],o}(),pa=function(){function o(s,i){this.format=s,this.formatName=i}return o.prototype.toString=function(){return this.formatName},o.create=function(s){if(!ga.has(s))throw"".concat(s," not in html5QrcodeSupportedFormatsTextMap");return new o(s,ga.get(s))},o}(),xa=function(){function o(){}return o.createFromText=function(s){var i={text:s};return{decodedText:s,result:i}},o.createFromQrcodeResult=function(s){return{decodedText:s.text,result:s}},o}(),xo;(function(o){o[o.UNKWOWN_ERROR=0]="UNKWOWN_ERROR",o[o.IMPLEMENTATION_ERROR=1]="IMPLEMENTATION_ERROR",o[o.NO_CODE_FOUND_ERROR=2]="NO_CODE_FOUND_ERROR"})(xo||(xo={}));var Gh=function(){function o(){}return o.createFrom=function(s){return{errorMessage:s,type:xo.UNKWOWN_ERROR}},o}(),Wh=function(){function o(s){this.verbose=s}return o.prototype.log=function(s){this.verbose&&console.log(s)},o.prototype.warn=function(s){this.verbose&&console.warn(s)},o.prototype.logError=function(s,i){(this.verbose||i===!0)&&console.error(s)},o.prototype.logErrors=function(s){if(s.length===0)throw"Logger#logError called without arguments";this.verbose&&console.error(s)},o}();function Vn(o){return typeof o>"u"||o===null}var wr=function(){function o(){}return o.codeParseError=function(s){return"QR code parse error, error = ".concat(s)},o.errorGettingUserMedia=function(s){return"Error getting userMedia, error = ".concat(s)},o.onlyDeviceSupportedError=function(){return"The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."},o.cameraStreamingNotSupported=function(){return"Camera streaming not supported by the browser."},o.unableToQuerySupportedDevices=function(){return"Unable to query supported devices, unknown error."},o.insecureContextCameraQueryError=function(){return"Camera access is only supported in secure context like https or localhost."},o.scannerPaused=function(){return"Scanner paused"},o}(),wa=function(){function o(){}return o.isMediaStreamConstraintsValid=function(s,i){if(typeof s!="object"){var u=typeof s;return i.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(u,"."),!0),!1}for(var f=["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"],h=new Set(f),m=Object.keys(s),x=0,_=m;x<_.length;x++){var p=_[x];if(h.has(p))return i.logError("".concat(p," is not supported videoConstaints."),!0),!1}return!0},o}(),wo={exports:{}};(function(o,s){(function(i,u){u(s)})(pr,function(i){function u(b){return b==null}var f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(b,e){b.__proto__=e}||function(b,e){for(var t in e)e.hasOwnProperty(t)&&(b[t]=e[t])};function h(b,e){f(b,e);function t(){this.constructor=b}b.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function m(b,e){var t=Object.setPrototypeOf;t?t(b,e):b.__proto__=e}function x(b,e){e===void 0&&(e=b.constructor);var t=Error.captureStackTrace;t&&t(b,e)}var _=function(b){h(e,b);function e(t){var n=this.constructor,r=b.call(this,t)||this;return Object.defineProperty(r,"name",{value:n.name,enumerable:!1}),m(r,n.prototype),x(r),r}return e}(Error);class p extends _{constructor(e=void 0){super(e),this.message=e}getKind(){return this.constructor.kind}}p.kind="Exception";class C extends p{}C.kind="ArgumentException";class y extends p{}y.kind="IllegalArgumentException";class S{constructor(e){if(this.binarizer=e,e===null)throw new y("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 a=this.binarizer.getLuminanceSource().crop(e,t,n,r);return new S(this.binarizer.createBinarizer(a))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new S(this.binarizer.createBinarizer(e))}rotateCounterClockwise45(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new S(this.binarizer.createBinarizer(e))}toString(){try{return this.getBlackMatrix().toString()}catch{return""}}}class M extends p{static getChecksumInstance(){return new M}}M.kind="ChecksumException";class k{constructor(e){this.source=e}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class P{static arraycopy(e,t,n,r,a){for(;a--;)n[r++]=e[t++]}static currentTimeMillis(){return Date.now()}}class v extends p{}v.kind="IndexOutOfBoundsException";class U extends v{constructor(e=void 0,t=void 0){super(t),this.index=e,this.message=t}}U.kind="ArrayIndexOutOfBoundsException";class B{static fill(e,t){for(let n=0,r=e.length;n<r;n++)e[n]=t}static fillWithin(e,t,n,r){B.rangeCheck(e.length,t,n);for(let a=t;a<n;a++)e[a]=r}static rangeCheck(e,t,n){if(t>n)throw new y("fromIndex("+t+") > toIndex("+n+")");if(t<0)throw new U(t);if(n>e)throw new U(n)}static asList(...e){return e}static create(e,t,n){return Array.from({length:e}).map(a=>Array.from({length:t}).fill(n))}static createInt32Array(e,t,n){return Array.from({length:e}).map(a=>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,a=new Int32Array(r);return P.arraycopy(e,t,a,0,r),a}static binarySearch(e,t,n){n===void 0&&(n=B.numberComparator);let r=0,a=e.length-1;for(;r<=a;){const c=a+r>>1,d=n(t,e[c]);if(d>0)r=c+1;else if(d<0)a=c-1;else return c}return-r-1}static numberComparator(e,t){return e-t}}class R{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||(t+=16,e<<=16),e>>>24||(t+=8,e<<=8),e>>>28||(t+=4,e<<=4),e>>>30||(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)}}R.MIN_VALUE_32_BITS=-2147483648,R.MAX_VALUE=Number.MAX_SAFE_INTEGER;class D{constructor(e,t){e===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=e,t==null?this.bits=D.makeArray(e):this.bits=t)}getSize(){return this.size}getSizeInBytes(){return Math.floor((this.size+7)/8)}ensureCapacity(e){if(e>this.bits.length*32){const t=D.makeArray(e);P.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),a=n[r];a&=~((1<<(e&31))-1);const c=n.length;for(;a===0;){if(++r===c)return t;a=n[r]}const d=r*32+R.numberOfTrailingZeros(a);return d>t?t:d}getNextUnset(e){const t=this.size;if(e>=t)return t;const n=this.bits;let r=Math.floor(e/32),a=~n[r];a&=~((1<<(e&31))-1);const c=n.length;for(;a===0;){if(++r===c)return t;a=~n[r]}const d=r*32+R.numberOfTrailingZeros(a);return d>t?t:d}setBulk(e,t){this.bits[Math.floor(e/32)]=t}setRange(e,t){if(t<e||e<0||t>this.size)throw new y;if(t===e)return;t--;const n=Math.floor(e/32),r=Math.floor(t/32),a=this.bits;for(let c=n;c<=r;c++){const d=c>n?0:e&31,w=(2<<(c<r?31:t&31))-(1<<d);a[c]|=w}}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 y;if(t===e)return!0;t--;const r=Math.floor(e/32),a=Math.floor(t/32),c=this.bits;for(let d=r;d<=a;d++){const g=d>r?0:e&31,E=(2<<(d<a?31:t&31))-(1<<g)&4294967295;if((c[d]&E)!==(n?E: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 y("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 y("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 a=0;a<r;a++){let c=0;for(let d=0;d<8;d++)this.get(e)&&(c|=1<<7-d),e++;t[n+a]=c}}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 a=0;a<n;a++){let c=r[a];c=c>>1&1431655765|(c&1431655765)<<1,c=c>>2&858993459|(c&858993459)<<2,c=c>>4&252645135|(c&252645135)<<4,c=c>>8&16711935|(c&16711935)<<8,c=c>>16&65535|(c&65535)<<16,e[t-a]=c}if(this.size!==n*32){const a=n*32-this.size;let c=e[0]>>>a;for(let d=1;d<n;d++){const g=e[d];c|=g<<32-a,e[d-1]=c,c=g>>>a}e[n-1]=c}this.bits=e}static makeArray(e){return new Int32Array(Math.floor((e+31)/32))}equals(e){if(!(e instanceof D))return!1;const t=e;return this.size===t.size&&B.equals(this.bits,t.bits)}hashCode(){return 31*this.size+B.hashCode(this.bits)}toString(){let e="";for(let t=0,n=this.size;t<n;t++)t&7||(e+=" "),e+=this.get(t)?"X":".";return e}clone(){return new D(this.size,this.bits.slice())}}var K;(function(b){b[b.OTHER=0]="OTHER",b[b.PURE_BARCODE=1]="PURE_BARCODE",b[b.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",b[b.TRY_HARDER=3]="TRY_HARDER",b[b.CHARACTER_SET=4]="CHARACTER_SET",b[b.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",b[b.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",b[b.ASSUME_GS1=7]="ASSUME_GS1",b[b.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",b[b.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",b[b.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS"})(K||(K={}));var te=K;class z extends p{static getFormatInstance(){return new z}}z.kind="FormatException";var ie;(function(b){b[b.Cp437=0]="Cp437",b[b.ISO8859_1=1]="ISO8859_1",b[b.ISO8859_2=2]="ISO8859_2",b[b.ISO8859_3=3]="ISO8859_3",b[b.ISO8859_4=4]="ISO8859_4",b[b.ISO8859_5=5]="ISO8859_5",b[b.ISO8859_6=6]="ISO8859_6",b[b.ISO8859_7=7]="ISO8859_7",b[b.ISO8859_8=8]="ISO8859_8",b[b.ISO8859_9=9]="ISO8859_9",b[b.ISO8859_10=10]="ISO8859_10",b[b.ISO8859_11=11]="ISO8859_11",b[b.ISO8859_13=12]="ISO8859_13",b[b.ISO8859_14=13]="ISO8859_14",b[b.ISO8859_15=14]="ISO8859_15",b[b.ISO8859_16=15]="ISO8859_16",b[b.SJIS=16]="SJIS",b[b.Cp1250=17]="Cp1250",b[b.Cp1251=18]="Cp1251",b[b.Cp1252=19]="Cp1252",b[b.Cp1256=20]="Cp1256",b[b.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",b[b.UTF8=22]="UTF8",b[b.ASCII=23]="ASCII",b[b.Big5=24]="Big5",b[b.GB18030=25]="GB18030",b[b.EUC_KR=26]="EUC_KR"})(ie||(ie={}));class W{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,W.VALUE_IDENTIFIER_TO_ECI.set(e,this),W.NAME_TO_ECI.set(n,this);const a=this.values;for(let c=0,d=a.length;c!==d;c++){const g=a[c];W.VALUES_TO_ECI.set(g,this)}for(const c of r)W.NAME_TO_ECI.set(c,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(e){if(e<0||e>=900)throw new z("incorect value");const t=W.VALUES_TO_ECI.get(e);if(t===void 0)throw new z("incorect value");return t}static getCharacterSetECIByName(e){const t=W.NAME_TO_ECI.get(e);if(t===void 0)throw new z("incorect value");return t}equals(e){if(!(e instanceof W))return!1;const t=e;return this.getName()===t.getName()}}W.VALUE_IDENTIFIER_TO_ECI=new Map,W.VALUES_TO_ECI=new Map,W.NAME_TO_ECI=new Map,W.Cp437=new W(ie.Cp437,Int32Array.from([0,2]),"Cp437"),W.ISO8859_1=new W(ie.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),W.ISO8859_2=new W(ie.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),W.ISO8859_3=new W(ie.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),W.ISO8859_4=new W(ie.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),W.ISO8859_5=new W(ie.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),W.ISO8859_6=new W(ie.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),W.ISO8859_7=new W(ie.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),W.ISO8859_8=new W(ie.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),W.ISO8859_9=new W(ie.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),W.ISO8859_10=new W(ie.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),W.ISO8859_11=new W(ie.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),W.ISO8859_13=new W(ie.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),W.ISO8859_14=new W(ie.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),W.ISO8859_15=new W(ie.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),W.ISO8859_16=new W(ie.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),W.SJIS=new W(ie.SJIS,20,"SJIS","Shift_JIS"),W.Cp1250=new W(ie.Cp1250,21,"Cp1250","windows-1250"),W.Cp1251=new W(ie.Cp1251,22,"Cp1251","windows-1251"),W.Cp1252=new W(ie.Cp1252,23,"Cp1252","windows-1252"),W.Cp1256=new W(ie.Cp1256,24,"Cp1256","windows-1256"),W.UnicodeBigUnmarked=new W(ie.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),W.UTF8=new W(ie.UTF8,26,"UTF8","UTF-8"),W.ASCII=new W(ie.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),W.Big5=new W(ie.Big5,28,"Big5"),W.GB18030=new W(ie.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),W.EUC_KR=new W(ie.EUC_KR,30,"EUC_KR","EUC-KR");class se extends p{}se.kind="UnsupportedOperationException";class j{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!j.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 W?e:W.getCharacterSetECIByName(e)}static decodeFallback(e,t){const n=this.encodingCharacterSet(t);if(j.isDecodeFallbackSupported(n)){let r="";for(let a=0,c=e.length;a<c;a++){let d=e[a].toString(16);d.length<2&&(d="0"+d),r+="%"+d}return decodeURIComponent(r)}if(n.equals(W.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(e.buffer));throw new se(`Encoding ${this.encodingName(t)} not supported by fallback.`)}static isDecodeFallbackSupported(e){return e.equals(W.UTF8)||e.equals(W.ISO8859_1)||e.equals(W.ASCII)}static encodeFallback(e){const n=btoa(unescape(encodeURIComponent(e))).split(""),r=[];for(let a=0;a<n.length;a++)r.push(n[a].charCodeAt(0));return new Uint8Array(r)}}class G{static castAsNonUtf8Char(e,t=null){const n=t?t.getName():this.ISO88591;return j.decode(new Uint8Array([e]),n)}static guessEncoding(e,t){if(t!=null&&t.get(te.CHARACTER_SET)!==void 0)return t.get(te.CHARACTER_SET).toString();const n=e.length;let r=!0,a=!0,c=!0,d=0,g=0,w=0,E=0,A=0,I=0,O=0,L=0,F=0,Z=0,ne=0;const ce=e.length>3&&e[0]===239&&e[1]===187&&e[2]===191;for(let ue=0;ue<n&&(r||a||c);ue++){const ae=e[ue]&255;c&&(d>0?ae&128?d--:c=!1:ae&128&&(ae&64?(d++,ae&32?(d++,ae&16?(d++,ae&8?c=!1:E++):w++):g++):c=!1)),r&&(ae>127&&ae<160?r=!1:ae>159&&(ae<192||ae===215||ae===247)&&ne++),a&&(A>0?ae<64||ae===127||ae>252?a=!1:A--:ae===128||ae===160||ae>239?a=!1:ae>160&&ae<224?(I++,L=0,O++,O>F&&(F=O)):ae>127?(A++,O=0,L++,L>Z&&(Z=L)):(O=0,L=0))}return c&&d>0&&(c=!1),a&&A>0&&(a=!1),c&&(ce||g+w+E>0)?G.UTF8:a&&(G.ASSUME_SHIFT_JIS||F>=3||Z>=3)?G.SHIFT_JIS:r&&a?F===2&&I===2||ne*10>=n?G.SHIFT_JIS:G.ISO88591:r?G.ISO88591:a?G.SHIFT_JIS:c?G.UTF8:G.PLATFORM_DEFAULT_ENCODING}static format(e,...t){let n=-1;function r(c,d,g,w,E,A){if(c==="%%")return"%";if(t[++n]===void 0)return;c=w?parseInt(w.substr(1)):void 0;let I=E?parseInt(E.substr(1)):void 0,O;switch(A){case"s":O=t[n];break;case"c":O=t[n][0];break;case"f":O=parseFloat(t[n]).toFixed(c);break;case"p":O=parseFloat(t[n]).toPrecision(c);break;case"e":O=parseFloat(t[n]).toExponential(c);break;case"x":O=parseInt(t[n]).toString(I||16);break;case"d":O=parseFloat(parseInt(t[n],I||10).toPrecision(c)).toFixed(0);break}O=typeof O=="object"?JSON.stringify(O):(+O).toString(I);let L=parseInt(g),F=g&&g[0]+""=="0"?"0":" ";for(;O.length<L;)O=d!==void 0?O+F:F+O;return O}let a=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(a,r)}static getBytes(e,t){return j.encode(e,t)}static getCharCode(e,t=0){return e.charCodeAt(t)}static getCharAt(e){return String.fromCharCode(e)}}G.SHIFT_JIS=W.SJIS.getName(),G.GB2312="GB2312",G.ISO88591=W.ISO8859_1.getName(),G.EUC_JP="EUC_JP",G.UTF8=W.UTF8.getName(),G.PLATFORM_DEFAULT_ENCODING=G.UTF8,G.ASSUME_SHIFT_JIS=!1;class V{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+=G.castAsNonUtf8Char(e,this.encoding):this.value+=String.fromCharCode(e),this}appendChars(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 X{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 y("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 X(n,t);for(let a=0;a<t;a++){const c=e[a];for(let d=0;d<n;d++)c[d]&&r.set(d,a)}return r}static parseFromString(e,t,n){if(e===null)throw new y("stringRepresentation cannot be null");const r=new Array(e.length);let a=0,c=0,d=-1,g=0,w=0;for(;w<e.length;)if(e.charAt(w)===`
|
|
12
|
-
`||e.charAt(w)==="\r"){if(a>c){if(d===-1)d=a-c;else if(a-c!==d)throw new y("row lengths do not match");c=a,g++}w++}else if(e.substring(w,w+t.length)===t)w+=t.length,r[a]=!0,a++;else if(e.substring(w,w+n.length)===n)w+=n.length,r[a]=!1,a++;else throw new y("illegal character encountered: "+e.substring(w));if(a>c){if(d===-1)d=a-c;else if(a-c!==d)throw new y("row lengths do not match");g++}const E=new X(d,g);for(let A=0;A<a;A++)r[A]&&E.set(Math.floor(A%d),Math.floor(A/d));return E}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 y("input matrix dimensions do not match");const t=new
|
|
13
|
-
`){return this.buildToString(e,t,n)}buildToString(e,t,n){let r=new
|
|
14
|
-
`)}return t.toString()}}class q extends J{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 a=0;a<r;a++)n[a]=255-(n[a]&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 q(this.delegate.crop(e,t,n,r))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new q(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new q(this.delegate.rotateCounterClockwise45())}}class re extends J{constructor(e){super(e.width,e.height),this.canvas=e,this.tempCanvasElement=null,this.buffer=re.makeBufferFromCanvasImageData(e)}static makeBufferFromCanvasImageData(e){const t=e.getContext("2d").getImageData(0,0,e.width,e.height);return re.toGrayscaleBuffer(t.data,e.width,e.height)}static toGrayscaleBuffer(e,t,n){const r=new Uint8ClampedArray(t*n);for(let a=0,c=0,d=e.length;a<d;a+=4,c++){let g;if(e[a+3]===0)g=255;else{const E=e[a],A=e[a+1],I=e[a+2];g=306*E+601*A+117*I+512>>10}r[c]=g}return r}getRow(e,t){if(e<0||e>=this.getHeight())throw new y("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*re.DEGREE_TO_RADIANS,a=this.canvas.width,c=this.canvas.height,d=Math.ceil(Math.abs(Math.cos(r))*a+Math.abs(Math.sin(r))*c),g=Math.ceil(Math.abs(Math.sin(r))*a+Math.abs(Math.cos(r))*c);return t.width=d,t.height=g,n.translate(d/2,g/2),n.rotate(r),n.drawImage(this.canvas,a/-2,c/-2),this.buffer=re.makeBufferFromCanvasImageData(t),this}invert(){return new q(this)}}re.DEGREE_TO_RADIANS=Math.PI/180;class ge{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 we=(globalThis||pr||self||window||void 0)&&(globalThis||pr||self||window||void 0).__awaiter||function(b,e,t,n){function r(a){return a instanceof t?a:new t(function(c){c(a)})}return new(t||(t=Promise))(function(a,c){function d(E){try{w(n.next(E))}catch(A){c(A)}}function g(E){try{w(n.throw(E))}catch(A){c(A)}}function w(E){E.done?a(E.value):r(E.value).then(d,g)}w((n=n.apply(b,e||[])).next())})};class Ne{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 we(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 a=n.deviceId||n.id,c=n.label||`Video device ${t.length+1}`,d=n.groupId,g={deviceId:a,label:c,kind:r,groupId:d};t.push(g)}return t})}getVideoInputDevices(){return we(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(t=>new ge(t.deviceId,t.label))})}findDeviceById(e){return we(this,void 0,void 0,function*(){const t=yield this.listVideoInputDevices();return t?t.find(n=>n.deviceId===e):null})}decodeFromInputVideoDevice(e,t){return we(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(e,t)})}decodeOnceFromVideoDevice(e,t){return we(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 we(this,void 0,void 0,function*(){const n=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeOnceFromStream(n,t)})}decodeOnceFromStream(e,t){return we(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 we(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(e,t,n)})}decodeFromVideoDevice(e,t,n){return we(this,void 0,void 0,function*(){let r;e?r={deviceId:{exact:e}}:r={facingMode:"environment"};const a={video:r};return yield this.decodeFromConstraints(a,t,n)})}decodeFromConstraints(e,t,n){return we(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 we(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 we(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 we(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 C(`element with id '${e}' not found`);if(n.nodeName.toLowerCase()!==t.toLowerCase())throw new C(`element with id '${e}' must be an ${t} element`);return n}decodeFromImage(e,t){if(!e&&!t)throw new C("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 C("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 C("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 C("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 C("A video element must be provided.");this.reset();const t=this.prepareVideoElement(e);return this.videoElement=t,t}decodeFromImageUrl(e){if(!e)throw new C("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 C("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 C("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 we(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(e),yield this.decodeOnce(e)})}_decodeOnLoadVideoContinuously(e,t){return we(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=(a,c)=>{if(this._stopAsyncDecode){c(new N("Video stream has ended before any code could be detected.")),this._stopAsyncDecode=void 0;return}try{const d=this.decode(e);a(d)}catch(d){const g=t&&d instanceof N,E=(d instanceof M||d instanceof z)&&n;if(g||E)return setTimeout(r,this._timeBetweenDecodingAttempts,a,c);c(d)}};return new Promise((a,c)=>r(a,c))}decodeContinuously(e,t){this._stopContinuousDecode=!1;const n=()=>{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 a=r instanceof M||r instanceof z,c=r instanceof N;(a||c)&&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 re(t),r=new H(n);return new S(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 _e{constructor(e,t,n=t==null?0:8*t.length,r,a,c=P.currentTimeMillis()){this.text=e,this.rawBytes=t,this.numBits=n,this.resultPoints=r,this.format=a,this.timestamp=c,this.text=e,this.rawBytes=t,n==null?this.numBits=t==null?0:8*t.length:this.numBits=n,this.resultPoints=r,this.format=a,this.resultMetadata=null,c==null?this.timestamp=P.currentTimeMillis():this.timestamp=c}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);P.arraycopy(t,0,n,0,t.length),P.arraycopy(e,0,n,t.length,e.length),this.resultPoints=n}}getTimestamp(){return this.timestamp}toString(){return this.text}}var Me;(function(b){b[b.AZTEC=0]="AZTEC",b[b.CODABAR=1]="CODABAR",b[b.CODE_39=2]="CODE_39",b[b.CODE_93=3]="CODE_93",b[b.CODE_128=4]="CODE_128",b[b.DATA_MATRIX=5]="DATA_MATRIX",b[b.EAN_8=6]="EAN_8",b[b.EAN_13=7]="EAN_13",b[b.ITF=8]="ITF",b[b.MAXICODE=9]="MAXICODE",b[b.PDF_417=10]="PDF_417",b[b.QR_CODE=11]="QR_CODE",b[b.RSS_14=12]="RSS_14",b[b.RSS_EXPANDED=13]="RSS_EXPANDED",b[b.UPC_A=14]="UPC_A",b[b.UPC_E=15]="UPC_E",b[b.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(Me||(Me={}));var he=Me,dt;(function(b){b[b.OTHER=0]="OTHER",b[b.ORIENTATION=1]="ORIENTATION",b[b.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",b[b.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",b[b.ISSUE_NUMBER=4]="ISSUE_NUMBER",b[b.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",b[b.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",b[b.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",b[b.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",b[b.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",b[b.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY"})(dt||(dt={}));var Xe=dt;class Oe{constructor(e,t,n,r,a=-1,c=-1){this.rawBytes=e,this.text=t,this.byteSegments=n,this.ecLevel=r,this.structuredAppendSequenceNumber=a,this.structuredAppendParity=c,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 qe{exp(e){return this.expTable[e]}log(e){if(e===0)throw new y;return this.logTable[e]}static addOrSubtract(e,t){return e^t}}class me{constructor(e,t){if(t.length===0)throw new y;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),P.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 c=0,d=t.length;c!==d;c++){const g=t[c];n=qe.addOrSubtract(n,g)}return n}n=t[0];const r=t.length,a=this.field;for(let c=1;c<r;c++)n=qe.addOrSubtract(a.multiply(e,n),t[c]);return n}addOrSubtract(e){if(!this.field.equals(e.field))throw new y("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 c=t;t=n,n=c}let r=new Int32Array(n.length);const a=n.length-t.length;P.arraycopy(n,0,r,0,a);for(let c=a;c<n.length;c++)r[c]=qe.addOrSubtract(t[c-a],n[c]);return new me(this.field,r)}multiply(e){if(!this.field.equals(e.field))throw new y("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,a=r.length,c=new Int32Array(n+a-1),d=this.field;for(let g=0;g<n;g++){const w=t[g];for(let E=0;E<a;E++)c[g+E]=qe.addOrSubtract(c[g+E],d.multiply(w,r[E]))}return new me(d,c)}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),a=this.coefficients;for(let c=0;c<t;c++)r[c]=n.multiply(a[c],e);return new me(n,r)}multiplyByMonomial(e,t){if(e<0)throw new y;if(t===0)return this.field.getZero();const n=this.coefficients,r=n.length,a=new Int32Array(r+e),c=this.field;for(let d=0;d<r;d++)a[d]=c.multiply(n[d],t);return new me(c,a)}divide(e){if(!this.field.equals(e.field))throw new y("GenericGFPolys do not have same GenericGF field");if(e.isZero())throw new y("Divide by 0");const t=this.field;let n=t.getZero(),r=this;const a=e.getCoefficient(e.getDegree()),c=t.inverse(a);for(;r.getDegree()>=e.getDegree()&&!r.isZero();){const d=r.getDegree()-e.getDegree(),g=t.multiply(r.getCoefficient(r.getDegree()),c),w=e.multiplyByMonomial(d,g),E=t.buildMonomial(d,g);n=n.addOrSubtract(E),r=r.addOrSubtract(w)}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 Ze extends p{}Ze.kind="ArithmeticException";class Ee extends qe{constructor(e,t,n){super(),this.primitive=e,this.size=t,this.generatorBase=n;const r=new Int32Array(t);let a=1;for(let d=0;d<t;d++)r[d]=a,a*=2,a>=t&&(a^=e,a&=t-1);this.expTable=r;const c=new Int32Array(t);for(let d=0;d<t-1;d++)c[r[d]]=d;this.logTable=c,this.zero=new me(this,Int32Array.from([0])),this.one=new me(this,Int32Array.from([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new y;if(t===0)return this.zero;const n=new Int32Array(e+1);return n[0]=t,new me(this,n)}inverse(e){if(e===0)throw new Ze;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"+R.toHexString(this.primitive)+","+this.size+")"}equals(e){return e===this}}Ee.AZTEC_DATA_12=new Ee(4201,4096,1),Ee.AZTEC_DATA_10=new Ee(1033,1024,1),Ee.AZTEC_DATA_6=new Ee(67,64,1),Ee.AZTEC_PARAM=new Ee(19,16,1),Ee.QR_CODE_FIELD_256=new Ee(285,256,0),Ee.DATA_MATRIX_FIELD_256=new Ee(301,256,1),Ee.AZTEC_DATA_8=Ee.DATA_MATRIX_FIELD_256,Ee.MAXICODE_FIELD_64=Ee.AZTEC_DATA_6;class mt extends p{}mt.kind="ReedSolomonException";class nt extends p{}nt.kind="IllegalStateException";class jt{constructor(e){this.field=e}decode(e,t){const n=this.field,r=new me(n,e),a=new Int32Array(t);let c=!0;for(let O=0;O<t;O++){const L=r.evaluateAt(n.exp(O+n.getGeneratorBase()));a[a.length-1-O]=L,L!==0&&(c=!1)}if(c)return;const d=new me(n,a),g=this.runEuclideanAlgorithm(n.buildMonomial(t,1),d,t),w=g[0],E=g[1],A=this.findErrorLocations(w),I=this.findErrorMagnitudes(E,A);for(let O=0;O<A.length;O++){const L=e.length-1-n.log(A[O]);if(L<0)throw new mt("Bad error location");e[L]=Ee.addOrSubtract(e[L],I[O])}}runEuclideanAlgorithm(e,t,n){if(e.getDegree()<t.getDegree()){const O=e;e=t,t=O}const r=this.field;let a=e,c=t,d=r.getZero(),g=r.getOne();for(;c.getDegree()>=(n/2|0);){let O=a,L=d;if(a=c,d=g,a.isZero())throw new mt("r_{i-1} was zero");c=O;let F=r.getZero();const Z=a.getCoefficient(a.getDegree()),ne=r.inverse(Z);for(;c.getDegree()>=a.getDegree()&&!c.isZero();){const ce=c.getDegree()-a.getDegree(),ue=r.multiply(c.getCoefficient(c.getDegree()),ne);F=F.addOrSubtract(r.buildMonomial(ce,ue)),c=c.addOrSubtract(a.multiplyByMonomial(ce,ue))}if(g=F.multiply(d).addOrSubtract(L),c.getDegree()>=a.getDegree())throw new nt("Division algorithm failed to reduce polynomial?")}const w=g.getCoefficient(0);if(w===0)throw new mt("sigmaTilde(0) was zero");const E=r.inverse(w),A=g.multiplyScalar(E),I=c.multiplyScalar(E);return[A,I]}findErrorLocations(e){const t=e.getDegree();if(t===1)return Int32Array.from([e.getCoefficient(1)]);const n=new Int32Array(t);let r=0;const a=this.field;for(let c=1;c<a.getSize()&&r<t;c++)e.evaluateAt(c)===0&&(n[r]=a.inverse(c),r++);if(r!==t)throw new mt("Error locator degree does not match number of roots");return n}findErrorMagnitudes(e,t){const n=t.length,r=new Int32Array(n),a=this.field;for(let c=0;c<n;c++){const d=a.inverse(t[c]);let g=1;for(let w=0;w<n;w++)if(c!==w){const E=a.multiply(t[w],d),A=E&1?E&-2:E|1;g=a.multiply(g,A)}r[c]=a.multiply(e.evaluateAt(d),a.inverse(g)),a.getGeneratorBase()!==0&&(r[c]=a.multiply(r[c],d))}return r}}var ot;(function(b){b[b.UPPER=0]="UPPER",b[b.LOWER=1]="LOWER",b[b.MIXED=2]="MIXED",b[b.DIGIT=3]="DIGIT",b[b.PUNCT=4]="PUNCT",b[b.BINARY=5]="BINARY"})(ot||(ot={}));class ze{decode(e){this.ddata=e;let t=e.getBits(),n=this.extractBits(t),r=this.correctBits(n),a=ze.convertBoolArrayToByteArray(r),c=ze.getEncodedData(r),d=new Oe(a,c,null,null);return d.setNumBits(r.length),d}static highLevelDecode(e){return this.getEncodedData(e)}static getEncodedData(e){let t=e.length,n=ot.UPPER,r=ot.UPPER,a="",c=0;for(;c<t;)if(r===ot.BINARY){if(t-c<5)break;let d=ze.readCode(e,c,5);if(c+=5,d===0){if(t-c<11)break;d=ze.readCode(e,c,11)+31,c+=11}for(let g=0;g<d;g++){if(t-c<8){c=t;break}const w=ze.readCode(e,c,8);a+=G.castAsNonUtf8Char(w),c+=8}r=n}else{let d=r===ot.DIGIT?4:5;if(t-c<d)break;let g=ze.readCode(e,c,d);c+=d;let w=ze.getCharacter(r,g);w.startsWith("CTRL_")?(n=r,r=ze.getTable(w.charAt(5)),w.charAt(6)==="L"&&(n=r)):(a+=w,r=n)}return a}static getTable(e){switch(e){case"L":return ot.LOWER;case"P":return ot.PUNCT;case"M":return ot.MIXED;case"D":return ot.DIGIT;case"B":return ot.BINARY;case"U":default:return ot.UPPER}}static getCharacter(e,t){switch(e){case ot.UPPER:return ze.UPPER_TABLE[t];case ot.LOWER:return ze.LOWER_TABLE[t];case ot.MIXED:return ze.MIXED_TABLE[t];case ot.PUNCT:return ze.PUNCT_TABLE[t];case ot.DIGIT:return ze.DIGIT_TABLE[t];default:throw new nt("Bad table")}}correctBits(e){let t,n;this.ddata.getNbLayers()<=2?(n=6,t=Ee.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(n=8,t=Ee.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(n=10,t=Ee.AZTEC_DATA_10):(n=12,t=Ee.AZTEC_DATA_12);let r=this.ddata.getNbDatablocks(),a=e.length/n;if(a<r)throw new z;let c=e.length%n,d=new Int32Array(a);for(let I=0;I<a;I++,c+=n)d[I]=ze.readCode(e,c,n);try{new jt(t).decode(d,a-r)}catch(I){throw new z(I)}let g=(1<<n)-1,w=0;for(let I=0;I<r;I++){let O=d[I];if(O===0||O===g)throw new z;(O===1||O===g-1)&&w++}let E=new Array(r*n-w),A=0;for(let I=0;I<r;I++){let O=d[I];if(O===1||O===g-1)E.fill(O>1,A,A+n-1),A+=n-1;else for(let L=n-1;L>=0;--L)E[A++]=(O&1<<L)!==0}return E}extractBits(e){let t=this.ddata.isCompact(),n=this.ddata.getNbLayers(),r=(t?11:14)+n*4,a=new Int32Array(r),c=new Array(this.totalBitsInLayer(n,t));if(t)for(let d=0;d<a.length;d++)a[d]=d;else{let d=r+1+2*R.truncDivision(R.truncDivision(r,2)-1,15),g=r/2,w=R.truncDivision(d,2);for(let E=0;E<g;E++){let A=E+R.truncDivision(E,15);a[g-E-1]=w-A-1,a[g+E]=w+A+1}}for(let d=0,g=0;d<n;d++){let w=(n-d)*4+(t?9:12),E=d*2,A=r-1-E;for(let I=0;I<w;I++){let O=I*2;for(let L=0;L<2;L++)c[g+O+L]=e.get(a[E+L],a[E+I]),c[g+2*w+O+L]=e.get(a[E+I],a[A-L]),c[g+4*w+O+L]=e.get(a[A-L],a[A-I]),c[g+6*w+O+L]=e.get(a[A-I],a[E+L])}g+=w*8}return c}static readCode(e,t,n){let r=0;for(let a=t;a<t+n;a++)r<<=1,e[a]&&(r|=1);return r}static readByte(e,t){let n=e.length-t;return n>=8?ze.readCode(e,t,8):ze.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]=ze.readByte(e,8*n);return t}totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}ze.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"],ze.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"],ze.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b"," ",`
|
|
15
|
-
`,"\\13","\f","\r","\\33","\\34","\\35","\\36","\\37","@","\\","^","_","`","|","~","\\177","CTRL_LL","CTRL_UL","CTRL_PL","CTRL_BS"],
|
|
16
|
-
`,". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],ze.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class He{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 a=e-n,c=t-r;return Math.sqrt(a*a+c*c)}static sum(e){let t=0;for(let n=0,r=e.length;n!==r;n++){const a=e[n];t+=a}return t}}class Cr{static floatToIntBits(e){return e}}Cr.MAX_VALUE=Number.MAX_SAFE_INTEGER;class ye{constructor(e,t){this.x=e,this.y=t}getX(){return this.x}getY(){return this.y}equals(e){if(e instanceof ye){const t=e;return this.x===t.x&&this.y===t.y}return!1}hashCode(){return 31*Cr.floatToIntBits(this.x)+Cr.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 a,c,d;if(n>=t&&n>=r?(c=e[0],a=e[1],d=e[2]):r>=n&&r>=t?(c=e[1],a=e[0],d=e[2]):(c=e[2],a=e[0],d=e[1]),this.crossProductZ(a,c,d)<0){const g=a;a=d,d=g}e[0]=a,e[1]=c,e[2]=d}static distance(e,t){return He.distance(e.x,e.y,t.x,t.y)}static crossProductZ(e,t,n){const r=t.x,a=t.y;return(n.x-r)*(e.y-a)-(n.y-a)*(e.x-r)}}class Er{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class bi extends Er{constructor(e,t,n,r,a){super(e,t),this.compact=n,this.nbDatablocks=r,this.nbLayers=a}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class bn{constructor(e,t,n,r){this.image=e,this.height=e.getHeight(),this.width=e.getWidth(),t==null&&(t=bn.INIT_SIZE),n==null&&(n=e.getWidth()/2|0),r==null&&(r=e.getHeight()/2|0);const a=t/2|0;if(this.leftInit=n-a,this.rightInit=n+a,this.upInit=r-a,this.downInit=r+a,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new N}detect(){let e=this.leftInit,t=this.rightInit,n=this.upInit,r=this.downInit,a=!1,c=!0,d=!1,g=!1,w=!1,E=!1,A=!1;const I=this.width,O=this.height;for(;c;){c=!1;let L=!0;for(;(L||!g)&&t<I;)L=this.containsBlackPoint(n,r,t,!1),L?(t++,c=!0,g=!0):g||t++;if(t>=I){a=!0;break}let F=!0;for(;(F||!w)&&r<O;)F=this.containsBlackPoint(e,t,r,!0),F?(r++,c=!0,w=!0):w||r++;if(r>=O){a=!0;break}let Z=!0;for(;(Z||!E)&&e>=0;)Z=this.containsBlackPoint(n,r,e,!1),Z?(e--,c=!0,E=!0):E||e--;if(e<0){a=!0;break}let ne=!0;for(;(ne||!A)&&n>=0;)ne=this.containsBlackPoint(e,t,n,!0),ne?(n--,c=!0,A=!0):A||n--;if(n<0){a=!0;break}c&&(d=!0)}if(!a&&d){const L=t-e;let F=null;for(let ue=1;F===null&&ue<L;ue++)F=this.getBlackPointOnSegment(e,r-ue,e+ue,r);if(F==null)throw new N;let Z=null;for(let ue=1;Z===null&&ue<L;ue++)Z=this.getBlackPointOnSegment(e,n+ue,e+ue,n);if(Z==null)throw new N;let ne=null;for(let ue=1;ne===null&&ue<L;ue++)ne=this.getBlackPointOnSegment(t,n+ue,t-ue,n);if(ne==null)throw new N;let ce=null;for(let ue=1;ce===null&&ue<L;ue++)ce=this.getBlackPointOnSegment(t,r-ue,t-ue,r);if(ce==null)throw new N;return this.centerEdges(ce,F,ne,Z)}else throw new N}getBlackPointOnSegment(e,t,n,r){const a=He.round(He.distance(e,t,n,r)),c=(n-e)/a,d=(r-t)/a,g=this.image;for(let w=0;w<a;w++){const E=He.round(e+w*c),A=He.round(t+w*d);if(g.get(E,A))return new ye(E,A)}return null}centerEdges(e,t,n,r){const a=e.getX(),c=e.getY(),d=t.getX(),g=t.getY(),w=n.getX(),E=n.getY(),A=r.getX(),I=r.getY(),O=bn.CORR;return a<this.width/2?[new ye(A-O,I+O),new ye(d+O,g+O),new ye(w-O,E-O),new ye(a+O,c-O)]:[new ye(A+O,I+O),new ye(d+O,g-O),new ye(w-O,E+O),new ye(a-O,c-O)]}containsBlackPoint(e,t,n,r){const a=this.image;if(r){for(let c=e;c<=t;c++)if(a.get(c,n))return!0}else for(let c=e;c<=t;c++)if(a.get(n,c))return!0;return!1}}bn.INIT_SIZE=10,bn.CORR=1;class rr{static checkAndNudgePoints(e,t){const n=e.getWidth(),r=e.getHeight();let a=!0;for(let c=0;c<t.length&&a;c+=2){const d=Math.floor(t[c]),g=Math.floor(t[c+1]);if(d<-1||d>n||g<-1||g>r)throw new N;a=!1,d===-1?(t[c]=0,a=!0):d===n&&(t[c]=n-1,a=!0),g===-1?(t[c+1]=0,a=!0):g===r&&(t[c+1]=r-1,a=!0)}a=!0;for(let c=t.length-2;c>=0&&a;c-=2){const d=Math.floor(t[c]),g=Math.floor(t[c+1]);if(d<-1||d>n||g<-1||g>r)throw new N;a=!1,d===-1?(t[c]=0,a=!0):d===n&&(t[c]=n-1,a=!0),g===-1?(t[c+1]=0,a=!0):g===r&&(t[c+1]=r-1,a=!0)}}}class Dt{constructor(e,t,n,r,a,c,d,g,w){this.a11=e,this.a21=t,this.a31=n,this.a12=r,this.a22=a,this.a32=c,this.a13=d,this.a23=g,this.a33=w}static quadrilateralToQuadrilateral(e,t,n,r,a,c,d,g,w,E,A,I,O,L,F,Z){const ne=Dt.quadrilateralToSquare(e,t,n,r,a,c,d,g);return Dt.squareToQuadrilateral(w,E,A,I,O,L,F,Z).times(ne)}transformPoints(e){const t=e.length,n=this.a11,r=this.a12,a=this.a13,c=this.a21,d=this.a22,g=this.a23,w=this.a31,E=this.a32,A=this.a33;for(let I=0;I<t;I+=2){const O=e[I],L=e[I+1],F=a*O+g*L+A;e[I]=(n*O+c*L+w)/F,e[I+1]=(r*O+d*L+E)/F}}transformPointsWithValues(e,t){const n=this.a11,r=this.a12,a=this.a13,c=this.a21,d=this.a22,g=this.a23,w=this.a31,E=this.a32,A=this.a33,I=e.length;for(let O=0;O<I;O++){const L=e[O],F=t[O],Z=a*L+g*F+A;e[O]=(n*L+c*F+w)/Z,t[O]=(r*L+d*F+E)/Z}}static squareToQuadrilateral(e,t,n,r,a,c,d,g){const w=e-n+a-d,E=t-r+c-g;if(w===0&&E===0)return new Dt(n-e,a-n,e,r-t,c-r,t,0,0,1);{const A=n-a,I=d-a,O=r-c,L=g-c,F=A*L-I*O,Z=(w*L-I*E)/F,ne=(A*E-w*O)/F;return new Dt(n-e+Z*n,d-e+ne*d,e,r-t+Z*r,g-t+ne*g,t,Z,ne,1)}}static quadrilateralToSquare(e,t,n,r,a,c,d,g){return Dt.squareToQuadrilateral(e,t,n,r,a,c,d,g).buildAdjoint()}buildAdjoint(){return new Dt(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 Dt(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 Ai extends rr{sampleGrid(e,t,n,r,a,c,d,g,w,E,A,I,O,L,F,Z,ne,ce,ue){const ae=Dt.quadrilateralToQuadrilateral(r,a,c,d,g,w,E,A,I,O,L,F,Z,ne,ce,ue);return this.sampleGridWithTransform(e,t,n,ae)}sampleGridWithTransform(e,t,n,r){if(t<=0||n<=0)throw new N;const a=new X(t,n),c=new Float32Array(2*t);for(let d=0;d<n;d++){const g=c.length,w=d+.5;for(let E=0;E<g;E+=2)c[E]=E/2+.5,c[E+1]=w;r.transformPoints(c),rr.checkAndNudgePoints(e,c);try{for(let E=0;E<g;E+=2)e.get(Math.floor(c[E]),Math.floor(c[E+1]))&&a.set(E/2,d)}catch{throw new N}}return a}}class dn{static setGridSampler(e){dn.gridSampler=e}static getInstance(){return dn.gridSampler}}dn.gridSampler=new Ai;class Ot{constructor(e,t){this.x=e,this.y=t}toResultPoint(){return new ye(this.getX(),this.getY())}getX(){return this.x}getY(){return this.y}}class be{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 c=n[0];n[0]=n[2],n[2]=c}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]),a=this.getMatrixCornerPoints(n);return new bi(r,a,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 N;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 c=0;c<4;c++){let d=n[(this.shift+c)%4];this.compact?(r<<=7,r+=d>>1&127):(r<<=10,r+=(d>>2&992)+(d>>1&31))}let a=this.getCorrectedParameterData(r,this.compact);this.compact?(this.nbLayers=(a>>6)+1,this.nbDataBlocks=(a&63)+1):(this.nbLayers=(a>>11)+1,this.nbDataBlocks=(a&2047)+1)}getRotation(e,t){let n=0;e.forEach((r,a,c)=>{let d=(r>>t-2<<1)+(r&1);n=(n<<3)+d}),n=((n&1)<<11)+(n>>1);for(let r=0;r<4;r++)if(R.bitCount(n^this.EXPECTED_CORNER_BITS[r])<=2)return r;throw new N}getCorrectedParameterData(e,t){let n,r;t?(n=7,r=2):(n=10,r=4);let a=n-r,c=new Int32Array(n);for(let g=n-1;g>=0;--g)c[g]=e&15,e>>=4;try{new jt(Ee.AZTEC_PARAM).decode(c,a)}catch{throw new N}let d=0;for(let g=0;g<r;g++)d=(d<<4)+c[g];return d}getBullsEyeCorners(e){let t=e,n=e,r=e,a=e,c=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){let A=this.getFirstDifferent(t,c,1,-1),I=this.getFirstDifferent(n,c,1,1),O=this.getFirstDifferent(r,c,-1,1),L=this.getFirstDifferent(a,c,-1,-1);if(this.nbCenterLayers>2){let F=this.distancePoint(L,A)*this.nbCenterLayers/(this.distancePoint(a,t)*(this.nbCenterLayers+2));if(F<.75||F>1.25||!this.isWhiteOrBlackRectangle(A,I,O,L))break}t=A,n=I,r=O,a=L,c=!c}if(this.nbCenterLayers!==5&&this.nbCenterLayers!==7)throw new N;this.compact=this.nbCenterLayers===5;let d=new ye(t.getX()+.5,t.getY()-.5),g=new ye(n.getX()+.5,n.getY()+.5),w=new ye(r.getX()-.5,r.getY()+.5),E=new ye(a.getX()-.5,a.getY()-.5);return this.expandSquare([d,g,w,E],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let e,t,n,r;try{let d=new bn(this.image).detect();e=d[0],t=d[1],n=d[2],r=d[3]}catch{let g=this.image.getWidth()/2,w=this.image.getHeight()/2;e=this.getFirstDifferent(new Ot(g+7,w-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new Ot(g+7,w+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new Ot(g-7,w+7),!1,-1,1).toResultPoint(),r=this.getFirstDifferent(new Ot(g-7,w-7),!1,-1,-1).toResultPoint()}let a=He.round((e.getX()+r.getX()+t.getX()+n.getX())/4),c=He.round((e.getY()+r.getY()+t.getY()+n.getY())/4);try{let d=new bn(this.image,15,a,c).detect();e=d[0],t=d[1],n=d[2],r=d[3]}catch{e=this.getFirstDifferent(new Ot(a+7,c-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new Ot(a+7,c+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new Ot(a-7,c+7),!1,-1,1).toResultPoint(),r=this.getFirstDifferent(new Ot(a-7,c-7),!1,-1,-1).toResultPoint()}return a=He.round((e.getX()+r.getX()+t.getX()+n.getX())/4),c=He.round((e.getY()+r.getY()+t.getY()+n.getY())/4),new Ot(a,c)}getMatrixCornerPoints(e){return this.expandSquare(e,2*this.nbCenterLayers,this.getDimension())}sampleGrid(e,t,n,r,a){let c=dn.getInstance(),d=this.getDimension(),g=d/2-this.nbCenterLayers,w=d/2+this.nbCenterLayers;return c.sampleGrid(e,d,d,g,g,w,g,w,w,g,w,t.getX(),t.getY(),n.getX(),n.getY(),r.getX(),r.getY(),a.getX(),a.getY())}sampleLine(e,t,n){let r=0,a=this.distanceResultPoint(e,t),c=a/n,d=e.getX(),g=e.getY(),w=c*(t.getX()-e.getX())/a,E=c*(t.getY()-e.getY())/a;for(let A=0;A<n;A++)this.image.get(He.round(d+A*w),He.round(g+A*E))&&(r|=1<<n-A-1);return r}isWhiteOrBlackRectangle(e,t,n,r){let a=3;e=new Ot(e.getX()-a,e.getY()+a),t=new Ot(t.getX()-a,t.getY()-a),n=new Ot(n.getX()+a,n.getY()-a),r=new Ot(r.getX()+a,r.getY()+a);let c=this.getColor(r,e);if(c===0)return!1;let d=this.getColor(e,t);return d!==c||(d=this.getColor(t,n),d!==c)?!1:(d=this.getColor(n,r),d===c)}getColor(e,t){let n=this.distancePoint(e,t),r=(t.getX()-e.getX())/n,a=(t.getY()-e.getY())/n,c=0,d=e.getX(),g=e.getY(),w=this.image.get(e.getX(),e.getY()),E=Math.ceil(n);for(let I=0;I<E;I++)d+=r,g+=a,this.image.get(He.round(d),He.round(g))!==w&&c++;let A=c/n;return A>.1&&A<.9?0:A<=.1===w?1:-1}getFirstDifferent(e,t,n,r){let a=e.getX()+n,c=e.getY()+r;for(;this.isValid(a,c)&&this.image.get(a,c)===t;)a+=n,c+=r;for(a-=n,c-=r;this.isValid(a,c)&&this.image.get(a,c)===t;)a+=n;for(a-=n;this.isValid(a,c)&&this.image.get(a,c)===t;)c+=r;return c-=r,new Ot(a,c)}expandSquare(e,t,n){let r=n/(2*t),a=e[0].getX()-e[2].getX(),c=e[0].getY()-e[2].getY(),d=(e[0].getX()+e[2].getX())/2,g=(e[0].getY()+e[2].getY())/2,w=new ye(d+r*a,g+r*c),E=new ye(d-r*a,g-r*c);a=e[1].getX()-e[3].getX(),c=e[1].getY()-e[3].getY(),d=(e[1].getX()+e[3].getX())/2,g=(e[1].getY()+e[3].getY())/2;let A=new ye(d+r*a,g+r*c),I=new ye(d-r*a,g-r*c);return[w,A,E,I]}isValid(e,t){return e>=0&&e<this.image.getWidth()&&t>0&&t<this.image.getHeight()}isValidPoint(e){let t=He.round(e.getX()),n=He.round(e.getY());return this.isValid(t,n)}distancePoint(e,t){return He.distance(e.getX(),e.getY(),t.getX(),t.getY())}distanceResultPoint(e,t){return He.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*(R.truncDivision(this.nbLayers-4,8)+1)+15}}class le{decode(e,t=null){let n=null,r=new be(e.getBlackMatrix()),a=null,c=null;try{let E=r.detectMirror(!1);a=E.getPoints(),this.reportFoundResultPoints(t,a),c=new ze().decode(E)}catch(E){n=E}if(c==null)try{let E=r.detectMirror(!0);a=E.getPoints(),this.reportFoundResultPoints(t,a),c=new ze().decode(E)}catch(E){throw n??E}let d=new _e(c.getText(),c.getRawBytes(),c.getNumBits(),a,he.AZTEC,P.currentTimeMillis()),g=c.getByteSegments();g!=null&&d.putMetadata(Xe.BYTE_SEGMENTS,g);let w=c.getECLevel();return w!=null&&d.putMetadata(Xe.ERROR_CORRECTION_LEVEL,w),d}reportFoundResultPoints(e,t){if(e!=null){let n=e.get(te.NEED_RESULT_POINT_CALLBACK);n!=null&&t.forEach((r,a,c)=>{n.foundPossibleResultPoint(r)})}}reset(){}}class Qe extends Ne{constructor(e=500){super(new le,e)}}class Ke{decode(e,t){try{return this.doDecode(e,t)}catch{if(t&&t.get(te.TRY_HARDER)===!0&&e.isRotateSupported()){const a=e.rotateCounterClockwise(),c=this.doDecode(a,t),d=c.getResultMetadata();let g=270;d!==null&&d.get(Xe.ORIENTATION)===!0&&(g=g+d.get(Xe.ORIENTATION)%360),c.putMetadata(Xe.ORIENTATION,g);const w=c.getResultPoints();if(w!==null){const E=a.getHeight();for(let A=0;A<w.length;A++)w[A]=new ye(E-w[A].getY()-1,w[A].getX())}return c}else throw new N}}reset(){}doDecode(e,t){const n=e.getWidth(),r=e.getHeight();let a=new D(n);const c=t&&t.get(te.TRY_HARDER)===!0,d=Math.max(1,r>>(c?8:5));let g;c?g=r:g=15;const w=Math.trunc(r/2);for(let E=0;E<g;E++){const A=Math.trunc((E+1)/2),I=(E&1)===0,O=w+d*(I?A:-A);if(O<0||O>=r)break;try{a=e.getBlackRow(O,a)}catch{continue}for(let L=0;L<2;L++){if(L===1&&(a.reverse(),t&&t.get(te.NEED_RESULT_POINT_CALLBACK)===!0)){const F=new Map;t.forEach((Z,ne)=>F.set(ne,Z)),F.delete(te.NEED_RESULT_POINT_CALLBACK),t=F}try{const F=this.decodeRow(O,a,t);if(L===1){F.putMetadata(Xe.ORIENTATION,180);const Z=F.getResultPoints();Z!==null&&(Z[0]=new ye(n-Z[0].getX()-1,Z[0].getY()),Z[1]=new ye(n-Z[1].getX()-1,Z[1].getY()))}return F}catch{}}}throw new N}static recordPattern(e,t,n){const r=n.length;for(let w=0;w<r;w++)n[w]=0;const a=e.getSize();if(t>=a)throw new N;let c=!e.get(t),d=0,g=t;for(;g<a;){if(e.get(g)!==c)n[d]++;else{if(++d===r)break;n[d]=1,c=!c}g++}if(!(d===r||d===r-1&&g===a))throw new N}static recordPatternInReverse(e,t,n){let r=n.length,a=e.get(t);for(;t>0&&r>=0;)e.get(--t)!==a&&(r--,a=!a);if(r>=0)throw new N;Ke.recordPattern(e,t+1,n)}static patternMatchVariance(e,t,n){const r=e.length;let a=0,c=0;for(let w=0;w<r;w++)a+=e[w],c+=t[w];if(a<c)return Number.POSITIVE_INFINITY;const d=a/c;n*=d;let g=0;for(let w=0;w<r;w++){const E=e[w],A=t[w]*d,I=E>A?E-A:A-E;if(I>n)return Number.POSITIVE_INFINITY;g+=I}return g/a}}class de extends Ke{static findStartPattern(e){const t=e.getSize(),n=e.getNextSet(0);let r=0,a=Int32Array.from([0,0,0,0,0,0]),c=n,d=!1;const g=6;for(let w=n;w<t;w++)if(e.get(w)!==d)a[r]++;else{if(r===g-1){let E=de.MAX_AVG_VARIANCE,A=-1;for(let I=de.CODE_START_A;I<=de.CODE_START_C;I++){const O=Ke.patternMatchVariance(a,de.CODE_PATTERNS[I],de.MAX_INDIVIDUAL_VARIANCE);O<E&&(E=O,A=I)}if(A>=0&&e.isRange(Math.max(0,c-(w-c)/2),c,!1))return Int32Array.from([c,w,A]);c+=a[0]+a[1],a=a.slice(2,a.length-1),a[r-1]=0,a[r]=0,r--}else r++;a[r]=1,d=!d}throw new N}static decodeCode(e,t,n){Ke.recordPattern(e,n,t);let r=de.MAX_AVG_VARIANCE,a=-1;for(let c=0;c<de.CODE_PATTERNS.length;c++){const d=de.CODE_PATTERNS[c],g=this.patternMatchVariance(t,d,de.MAX_INDIVIDUAL_VARIANCE);g<r&&(r=g,a=c)}if(a>=0)return a;throw new N}decodeRow(e,t,n){const r=n&&n.get(te.ASSUME_GS1)===!0,a=de.findStartPattern(t),c=a[2];let d=0;const g=new Uint8Array(20);g[d++]=c;let w;switch(c){case de.CODE_START_A:w=de.CODE_CODE_A;break;case de.CODE_START_B:w=de.CODE_CODE_B;break;case de.CODE_START_C:w=de.CODE_CODE_C;break;default:throw new z}let E=!1,A=!1,I="",O=a[0],L=a[1];const F=Int32Array.from([0,0,0,0,0,0]);let Z=0,ne=0,ce=c,ue=0,ae=!0,Ge=!1,ve=!1;for(;!E;){const kr=A;switch(A=!1,Z=ne,ne=de.decodeCode(t,F,L),g[d++]=ne,ne!==de.CODE_STOP&&(ae=!0),ne!==de.CODE_STOP&&(ue++,ce+=ue*ne),O=L,L+=F.reduce((vg,Dg)=>vg+Dg,0),ne){case de.CODE_START_A:case de.CODE_START_B:case de.CODE_START_C:throw new z}switch(w){case de.CODE_CODE_A:if(ne<64)ve===Ge?I+=String.fromCharCode(32+ne):I+=String.fromCharCode(32+ne+128),ve=!1;else if(ne<96)ve===Ge?I+=String.fromCharCode(ne-64):I+=String.fromCharCode(ne+64),ve=!1;else switch(ne!==de.CODE_STOP&&(ae=!1),ne){case de.CODE_FNC_1:r&&(I.length===0?I+="]C1":I+="");break;case de.CODE_FNC_2:case de.CODE_FNC_3:break;case de.CODE_FNC_4_A:!Ge&&ve?(Ge=!0,ve=!1):Ge&&ve?(Ge=!1,ve=!1):ve=!0;break;case de.CODE_SHIFT:A=!0,w=de.CODE_CODE_B;break;case de.CODE_CODE_B:w=de.CODE_CODE_B;break;case de.CODE_CODE_C:w=de.CODE_CODE_C;break;case de.CODE_STOP:E=!0;break}break;case de.CODE_CODE_B:if(ne<96)ve===Ge?I+=String.fromCharCode(32+ne):I+=String.fromCharCode(32+ne+128),ve=!1;else switch(ne!==de.CODE_STOP&&(ae=!1),ne){case de.CODE_FNC_1:r&&(I.length===0?I+="]C1":I+="");break;case de.CODE_FNC_2:case de.CODE_FNC_3:break;case de.CODE_FNC_4_B:!Ge&&ve?(Ge=!0,ve=!1):Ge&&ve?(Ge=!1,ve=!1):ve=!0;break;case de.CODE_SHIFT:A=!0,w=de.CODE_CODE_A;break;case de.CODE_CODE_A:w=de.CODE_CODE_A;break;case de.CODE_CODE_C:w=de.CODE_CODE_C;break;case de.CODE_STOP:E=!0;break}break;case de.CODE_CODE_C:if(ne<100)ne<10&&(I+="0"),I+=ne;else switch(ne!==de.CODE_STOP&&(ae=!1),ne){case de.CODE_FNC_1:r&&(I.length===0?I+="]C1":I+="");break;case de.CODE_CODE_A:w=de.CODE_CODE_A;break;case de.CODE_CODE_B:w=de.CODE_CODE_B;break;case de.CODE_STOP:E=!0;break}break}kr&&(w=w===de.CODE_CODE_A?de.CODE_CODE_B:de.CODE_CODE_A)}const nn=L-O;if(L=t.getNextUnset(L),!t.isRange(L,Math.min(t.getSize(),L+(L-O)/2),!1))throw new N;if(ce-=ue*Z,ce%103!==Z)throw new M;const An=I.length;if(An===0)throw new N;An>0&&ae&&(w===de.CODE_CODE_C?I=I.substring(0,An-2):I=I.substring(0,An-1));const rn=(a[1]+a[0])/2,at=O+nn/2,Ut=g.length,ln=new Uint8Array(Ut);for(let kr=0;kr<Ut;kr++)ln[kr]=g[kr];const Tr=[new ye(rn,e),new ye(at,e)];return new _e(I,ln,0,Tr,he.CODE_128,new Date().getTime())}}de.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])],de.MAX_AVG_VARIANCE=.25,de.MAX_INDIVIDUAL_VARIANCE=.7,de.CODE_SHIFT=98,de.CODE_CODE_C=99,de.CODE_CODE_B=100,de.CODE_CODE_A=101,de.CODE_FNC_1=102,de.CODE_FNC_2=97,de.CODE_FNC_3=96,de.CODE_FNC_4_A=101,de.CODE_FNC_4_B=100,de.CODE_START_A=103,de.CODE_START_B=104,de.CODE_START_C=105,de.CODE_STOP=106;class ft extends Ke{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 a=ft.findAsteriskPattern(t,r),c=t.getNextSet(a[1]),d=t.getSize(),g,w;do{ft.recordPattern(t,c,r);let F=ft.toNarrowWidePattern(r);if(F<0)throw new N;g=ft.patternToChar(F),this.decodeRowResult+=g,w=c;for(let Z of r)c+=Z;c=t.getNextSet(c)}while(g!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let E=0;for(let F of r)E+=F;let A=c-w-E;if(c!==d&&A*2<E)throw new N;if(this.usingCheckDigit){let F=this.decodeRowResult.length-1,Z=0;for(let ne=0;ne<F;ne++)Z+=ft.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(ne));if(this.decodeRowResult.charAt(F)!==ft.ALPHABET_STRING.charAt(Z%43))throw new M;this.decodeRowResult=this.decodeRowResult.substring(0,F)}if(this.decodeRowResult.length===0)throw new N;let I;this.extendedMode?I=ft.decodeExtended(this.decodeRowResult):I=this.decodeRowResult;let O=(a[1]+a[0])/2,L=w+E/2;return new _e(I,null,0,[new ye(O,e),new ye(L,e)],he.CODE_39,new Date().getTime())}static findAsteriskPattern(e,t){let n=e.getSize(),r=e.getNextSet(0),a=0,c=r,d=!1,g=t.length;for(let w=r;w<n;w++)if(e.get(w)!==d)t[a]++;else{if(a===g-1){if(this.toNarrowWidePattern(t)===ft.ASTERISK_ENCODING&&e.isRange(Math.max(0,c-Math.floor((w-c)/2)),c,!1))return[c,w];c+=t[0]+t[1],t.copyWithin(0,2,2+a-1),t[a-1]=0,t[a]=0,a--}else a++;t[a]=1,d=!d}throw new N}static toNarrowWidePattern(e){let t=e.length,n=0,r;do{let a=2147483647;for(let g of e)g<a&&g>n&&(a=g);n=a,r=0;let c=0,d=0;for(let g=0;g<t;g++){let w=e[g];w>n&&(d|=1<<t-1-g,r++,c+=w)}if(r===3){for(let g=0;g<t&&r>0;g++){let w=e[g];if(w>n&&(r--,w*2>=c))return-1}return d}}while(r>3);return-1}static patternToChar(e){for(let t=0;t<ft.CHARACTER_ENCODINGS.length;t++)if(ft.CHARACTER_ENCODINGS[t]===e)return ft.ALPHABET_STRING.charAt(t);if(e===ft.ASTERISK_ENCODING)return"*";throw new N}static decodeExtended(e){let t=e.length,n="";for(let r=0;r<t;r++){let a=e.charAt(r);if(a==="+"||a==="$"||a==="%"||a==="/"){let c=e.charAt(r+1),d="\0";switch(a){case"+":if(c>="A"&&c<="Z")d=String.fromCharCode(c.charCodeAt(0)+32);else throw new z;break;case"$":if(c>="A"&&c<="Z")d=String.fromCharCode(c.charCodeAt(0)-64);else throw new z;break;case"%":if(c>="A"&&c<="E")d=String.fromCharCode(c.charCodeAt(0)-38);else if(c>="F"&&c<="J")d=String.fromCharCode(c.charCodeAt(0)-11);else if(c>="K"&&c<="O")d=String.fromCharCode(c.charCodeAt(0)+16);else if(c>="P"&&c<="T")d=String.fromCharCode(c.charCodeAt(0)+43);else if(c==="U")d="\0";else if(c==="V")d="@";else if(c==="W")d="`";else if(c==="X"||c==="Y"||c==="Z")d="";else throw new z;break;case"/":if(c>="A"&&c<="O")d=String.fromCharCode(c.charCodeAt(0)-32);else if(c==="Z")d=":";else throw new z;break}n+=d,r++}else n+=a}return n}}ft.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",ft.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],ft.ASTERISK_ENCODING=148;class Ye extends Ke{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(e,t,n){let r=this.decodeStart(t),a=this.decodeEnd(t),c=new V;Ye.decodeMiddle(t,r[1],a[0],c);let d=c.toString(),g=null;n!=null&&(g=n.get(te.ALLOWED_LENGTHS)),g==null&&(g=Ye.DEFAULT_ALLOWED_LENGTHS);let w=d.length,E=!1,A=0;for(let L of g){if(w===L){E=!0;break}L>A&&(A=L)}if(!E&&w>A&&(E=!0),!E)throw new z;const I=[new ye(r[1],e),new ye(a[0],e)];return new _e(d,null,0,I,he.ITF,new Date().getTime())}static decodeMiddle(e,t,n,r){let a=new Int32Array(10),c=new Int32Array(5),d=new Int32Array(5);for(a.fill(0),c.fill(0),d.fill(0);t<n;){Ke.recordPattern(e,t,a);for(let w=0;w<5;w++){let E=2*w;c[w]=a[E],d[w]=a[E+1]}let g=Ye.decodeDigit(c);r.append(g.toString()),g=this.decodeDigit(d),r.append(g.toString()),a.forEach(function(w){t+=w})}}decodeStart(e){let t=Ye.skipWhiteSpace(e),n=Ye.findGuardPattern(e,t,Ye.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 N}static skipWhiteSpace(e){const t=e.getSize(),n=e.getNextSet(0);if(n===t)throw new N;return n}decodeEnd(e){e.reverse();try{let t=Ye.skipWhiteSpace(e),n;try{n=Ye.findGuardPattern(e,t,Ye.END_PATTERN_REVERSED[0])}catch(a){a instanceof N&&(n=Ye.findGuardPattern(e,t,Ye.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,a=new Int32Array(r),c=e.getSize(),d=!1,g=0,w=t;a.fill(0);for(let E=t;E<c;E++)if(e.get(E)!==d)a[g]++;else{if(g===r-1){if(Ke.patternMatchVariance(a,n,Ye.MAX_INDIVIDUAL_VARIANCE)<Ye.MAX_AVG_VARIANCE)return[w,E];w+=a[0]+a[1],P.arraycopy(a,2,a,0,g-1),a[g-1]=0,a[g]=0,g--}else g++;a[g]=1,d=!d}throw new N}static decodeDigit(e){let t=Ye.MAX_AVG_VARIANCE,n=-1,r=Ye.PATTERNS.length;for(let a=0;a<r;a++){let c=Ye.PATTERNS[a],d=Ke.patternMatchVariance(e,c,Ye.MAX_INDIVIDUAL_VARIANCE);d<t?(t=d,n=a):d===t&&(n=-1)}if(n>=0)return n%10;throw new N}}Ye.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])],Ye.MAX_AVG_VARIANCE=.38,Ye.MAX_INDIVIDUAL_VARIANCE=.5,Ye.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],Ye.START_PATTERN=Int32Array.from([1,1,1,1]),Ye.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class rt extends Ke{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(e){let t=!1,n,r=0,a=Int32Array.from([0,0,0]);for(;!t;){a=Int32Array.from([0,0,0]),n=rt.findGuardPattern(e,r,!1,this.START_END_PATTERN,a);let c=n[0];r=n[1];let d=c-(r-c);d>=0&&(t=e.isRange(d,c,!1))}return n}static checkChecksum(e){return rt.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(t===0)return!1;let n=parseInt(e.charAt(t-1),10);return rt.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 a=e.charAt(r).charCodeAt(0)-48;if(a<0||a>9)throw new z;n+=a}n*=3;for(let r=t-2;r>=0;r-=2){let a=e.charAt(r).charCodeAt(0)-48;if(a<0||a>9)throw new z;n+=a}return(1e3-n)%10}static decodeEnd(e,t){return rt.findGuardPattern(e,t,!1,rt.START_END_PATTERN,new Int32Array(rt.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,a){let c=e.getSize();t=n?e.getNextUnset(t):e.getNextSet(t);let d=0,g=t,w=r.length,E=n;for(let A=t;A<c;A++)if(e.get(A)!==E)a[d]++;else{if(d===w-1){if(Ke.patternMatchVariance(a,r,rt.MAX_INDIVIDUAL_VARIANCE)<rt.MAX_AVG_VARIANCE)return Int32Array.from([g,A]);g+=a[0]+a[1];let I=a.slice(2,a.length-1);for(let O=0;O<d-1;O++)a[O]=I[O];a[d-1]=0,a[d]=0,d--}else d++;a[d]=1,E=!E}throw new N}static decodeDigit(e,t,n,r){this.recordPattern(e,n,t);let a=this.MAX_AVG_VARIANCE,c=-1,d=r.length;for(let g=0;g<d;g++){let w=r[g],E=Ke.patternMatchVariance(t,w,rt.MAX_INDIVIDUAL_VARIANCE);E<a&&(a=E,c=g)}if(c>=0)return c;throw new N}}rt.MAX_AVG_VARIANCE=.48,rt.MAX_INDIVIDUAL_VARIANCE=.7,rt.START_END_PATTERN=Int32Array.from([1,1,1]),rt.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),rt.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),rt.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 Ve{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,a=this.decodeMiddle(t,n,r),c=r.toString(),d=Ve.parseExtensionString(c),g=[new ye((n[0]+n[1])/2,e),new ye(a,e)],w=new _e(c,null,0,g,he.UPC_EAN_EXTENSION,new Date().getTime());return d!=null&&w.putAllMetadata(d),w}decodeMiddle(e,t,n){let r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let a=e.getSize(),c=t[1],d=0;for(let w=0;w<5&&c<a;w++){let E=rt.decodeDigit(e,r,c,rt.L_AND_G_PATTERNS);n+=String.fromCharCode(48+E%10);for(let A of r)c+=A;E>=10&&(d|=1<<4-w),w!==4&&(c=e.getNextSet(c),c=e.getNextUnset(c))}if(n.length!==5)throw new N;let g=this.determineCheckDigit(d);if(Ve.extensionChecksum(n.toString())!==g)throw new N;return c}static extensionChecksum(e){let t=e.length,n=0;for(let r=t-2;r>=0;r-=2)n+=e.charAt(r).charCodeAt(0)-48;n*=3;for(let r=t-1;r>=0;r-=2)n+=e.charAt(r).charCodeAt(0)-48;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 N}static parseExtensionString(e){if(e.length!==5)return null;let t=Ve.parseExtension5String(e);return t==null?null:new Map([[Xe.SUGGESTED_PRICE,t]])}static parseExtension5String(e){let t;switch(e.charAt(0)){case"0":t="£";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(),a=n%100,c=a<10?"0"+a:a.toString();return t+r+"."+c}}class qt{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(e,t,n){let r=this.decodeRowStringBuffer,a=this.decodeMiddle(t,n,r),c=r.toString(),d=qt.parseExtensionString(c),g=[new ye((n[0]+n[1])/2,e),new ye(a,e)],w=new _e(c,null,0,g,he.UPC_EAN_EXTENSION,new Date().getTime());return d!=null&&w.putAllMetadata(d),w}decodeMiddle(e,t,n){let r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let a=e.getSize(),c=t[1],d=0;for(let g=0;g<2&&c<a;g++){let w=rt.decodeDigit(e,r,c,rt.L_AND_G_PATTERNS);n+=String.fromCharCode(48+w%10);for(let E of r)c+=E;w>=10&&(d|=1<<1-g),g!==1&&(c=e.getNextSet(c),c=e.getNextUnset(c))}if(n.length!==2)throw new N;if(parseInt(n.toString())%4!==d)throw new N;return c}static parseExtensionString(e){return e.length!==2?null:new Map([[Xe.ISSUE_NUMBER,parseInt(e)]])}}class Nt{static decodeRow(e,t,n){let r=rt.findGuardPattern(t,n,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new Ve().decodeRow(e,t,r)}catch{return new qt().decodeRow(e,t,r)}}}Nt.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class De extends rt{constructor(){super(),this.decodeRowStringBuffer="",De.L_AND_G_PATTERNS=De.L_PATTERNS.map(e=>Int32Array.from(e));for(let e=10;e<20;e++){let t=De.L_PATTERNS[e-10],n=new Int32Array(t.length);for(let r=0;r<t.length;r++)n[r]=t[t.length-r-1];De.L_AND_G_PATTERNS[e]=n}}decodeRow(e,t,n){let r=De.findStartGuardPattern(t),a=n==null?null:n.get(te.NEED_RESULT_POINT_CALLBACK);if(a!=null){const ae=new ye((r[0]+r[1])/2,e);a.foundPossibleResultPoint(ae)}let c=this.decodeMiddle(t,r,this.decodeRowStringBuffer),d=c.rowOffset,g=c.resultString;if(a!=null){const ae=new ye(d,e);a.foundPossibleResultPoint(ae)}let w=this.decodeEnd(t,d);if(a!=null){const ae=new ye((w[0]+w[1])/2,e);a.foundPossibleResultPoint(ae)}let E=w[1],A=E+(E-w[0]);if(A>=t.getSize()||!t.isRange(E,A,!1))throw new N;let I=g.toString();if(I.length<8)throw new z;if(!De.checkChecksum(I))throw new M;let O=(r[1]+r[0])/2,L=(w[1]+w[0])/2,F=this.getBarcodeFormat(),Z=[new ye(O,e),new ye(L,e)],ne=new _e(I,null,0,Z,F,new Date().getTime()),ce=0;try{let ae=Nt.decodeRow(e,t,w[1]);ne.putMetadata(Xe.UPC_EAN_EXTENSION,ae.getText()),ne.putAllMetadata(ae.getResultMetadata()),ne.addResultPoints(ae.getResultPoints()),ce=ae.getText().length}catch{}let ue=n==null?null:n.get(te.ALLOWED_EAN_EXTENSIONS);if(ue!=null){let ae=!1;for(let Ge in ue)if(ce.toString()===Ge){ae=!0;break}if(!ae)throw new N}return ne}decodeEnd(e,t){return De.findGuardPattern(e,t,!1,De.START_END_PATTERN,new Int32Array(De.START_END_PATTERN.length).fill(0))}static checkChecksum(e){return De.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(t===0)return!1;let n=parseInt(e.charAt(t-1),10);return De.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 a=e.charAt(r).charCodeAt(0)-48;if(a<0||a>9)throw new z;n+=a}n*=3;for(let r=t-2;r>=0;r-=2){let a=e.charAt(r).charCodeAt(0)-48;if(a<0||a>9)throw new z;n+=a}return(1e3-n)%10}}class yt extends De{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 a=e.getSize(),c=t[1],d=0;for(let w=0;w<6&&c<a;w++){let E=De.decodeDigit(e,r,c,De.L_AND_G_PATTERNS);n+=String.fromCharCode(48+E%10);for(let A of r)c+=A;E>=10&&(d|=1<<5-w)}n=yt.determineFirstDigit(n,d),c=De.findGuardPattern(e,c,!0,De.MIDDLE_PATTERN,new Int32Array(De.MIDDLE_PATTERN.length).fill(0))[1];for(let w=0;w<6&&c<a;w++){let E=De.decodeDigit(e,r,c,De.L_PATTERNS);n+=String.fromCharCode(48+E);for(let A of r)c+=A}return{rowOffset:c,resultString:n}}getBarcodeFormat(){return he.EAN_13}static determineFirstDigit(e,t){for(let n=0;n<10;n++)if(t===this.FIRST_DIGIT_ENCODINGS[n])return e=String.fromCharCode(48+n)+e,e;throw new N}}yt.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class Pt extends De{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 a=e.getSize(),c=t[1];for(let g=0;g<4&&c<a;g++){let w=De.decodeDigit(e,r,c,De.L_PATTERNS);n+=String.fromCharCode(48+w);for(let E of r)c+=E}c=De.findGuardPattern(e,c,!0,De.MIDDLE_PATTERN,new Int32Array(De.MIDDLE_PATTERN.length).fill(0))[1];for(let g=0;g<4&&c<a;g++){let w=De.decodeDigit(e,r,c,De.L_PATTERNS);n+=String.fromCharCode(48+w);for(let E of r)c+=E}return{rowOffset:c,resultString:n}}getBarcodeFormat(){return he.EAN_8}}class Lt extends De{constructor(){super(...arguments),this.ean13Reader=new yt}getBarcodeFormat(){return he.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 _e(t.substring(1),null,null,e.getResultPoints(),he.UPC_A);return e.getResultMetadata()!=null&&n.putAllMetadata(e.getResultMetadata()),n}else throw new N}reset(){this.ean13Reader.reset()}}class xt extends De{constructor(){super(),this.decodeMiddleCounters=new Int32Array(4)}decodeMiddle(e,t,n){const r=this.decodeMiddleCounters.map(w=>w);r[0]=0,r[1]=0,r[2]=0,r[3]=0;const a=e.getSize();let c=t[1],d=0;for(let w=0;w<6&&c<a;w++){const E=xt.decodeDigit(e,r,c,xt.L_AND_G_PATTERNS);n+=String.fromCharCode(48+E%10);for(let A of r)c+=A;E>=10&&(d|=1<<5-w)}let g=xt.determineNumSysAndCheckDigit(n,d);return{rowOffset:c,resultString:g}}decodeEnd(e,t){return xt.findGuardPatternWithoutCounters(e,t,!0,xt.MIDDLE_END_PATTERN)}checkChecksum(e){return De.checkChecksum(xt.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 a=String.fromCharCode(48+n),c=String.fromCharCode(48+r);return a+e+c}throw N.getNotFoundInstance()}getBarcodeFormat(){return he.UPC_E}static convertUPCEtoUPCA(e){const t=e.slice(1,7).split("").map(a=>a.charCodeAt(0)),n=new V;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()}}xt.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),xt.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 Un extends Ke{constructor(e){super();let t=e==null?null:e.get(te.POSSIBLE_FORMATS),n=[];u(t)?(n.push(new yt),n.push(new Lt),n.push(new Pt),n.push(new xt)):(t.indexOf(he.EAN_13)>-1&&n.push(new yt),t.indexOf(he.UPC_A)>-1&&n.push(new Lt),t.indexOf(he.EAN_8)>-1&&n.push(new Pt),t.indexOf(he.UPC_E)>-1&&n.push(new xt)),this.readers=n}decodeRow(e,t,n){for(let r of this.readers)try{const a=r.decodeRow(e,t,n),c=a.getBarcodeFormat()===he.EAN_13&&a.getText().charAt(0)==="0",d=n==null?null:n.get(te.POSSIBLE_FORMATS),g=d==null||d.includes(he.UPC_A);if(c&&g){const w=a.getRawBytes(),E=new _e(a.getText().substring(1),w,w?w.length:null,a.getResultPoints(),he.UPC_A);return E.putAllMetadata(a.getResultMetadata()),E}return a}catch{}throw new N}reset(){for(let e of this.readers)e.reset()}}class Bt extends Ke{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(Ke.patternMatchVariance(e,t[n],Bt.MAX_INDIVIDUAL_VARIANCE)<Bt.MAX_AVG_VARIANCE)return n;throw new N}static count(e){return He.sum(new Int32Array(e))}static increment(e,t){let n=0,r=t[0];for(let a=1;a<e.length;a++)t[a]>r&&(r=t[a],n=a);e[n]++}static decrement(e,t){let n=0,r=t[0];for(let a=1;a<e.length;a++)t[a]<r&&(r=t[a],n=a);e[n]--}static isFinderPattern(e){let t=e[0]+e[1],n=t+e[2]+e[3],r=t/n;if(r>=Bt.MIN_FINDER_PATTERN_RATIO&&r<=Bt.MAX_FINDER_PATTERN_RATIO){let a=Number.MAX_SAFE_INTEGER,c=Number.MIN_SAFE_INTEGER;for(let d of e)d>c&&(c=d),d<a&&(a=d);return c<10*a}return!1}}Bt.MAX_AVG_VARIANCE=.2,Bt.MAX_INDIVIDUAL_VARIANCE=.45,Bt.MIN_FINDER_PATTERN_RATIO=9.5/12,Bt.MAX_FINDER_PATTERN_RATIO=12.5/14;class Gn{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 Gn))return!1;const t=e;return this.value===t.value&&this.checksumPortion===t.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class Ii{constructor(e,t,n,r,a){this.value=e,this.startEnd=t,this.value=e,this.startEnd=t,this.resultPoints=new Array,this.resultPoints.push(new ye(n,a)),this.resultPoints.push(new ye(r,a))}getValue(){return this.value}getStartEnd(){return this.startEnd}getResultPoints(){return this.resultPoints}equals(e){if(!(e instanceof Ii))return!1;const t=e;return this.value===t.value}hashCode(){return this.value}}class kn{constructor(){}static getRSSvalue(e,t,n){let r=0;for(let g of e)r+=g;let a=0,c=0,d=e.length;for(let g=0;g<d-1;g++){let w;for(w=1,c|=1<<g;w<e[g];w++,c&=~(1<<g)){let E=kn.combins(r-w-1,d-g-2);if(n&&c===0&&r-w-(d-g-1)>=d-g-1&&(E-=kn.combins(r-w-(d-g),d-g-2)),d-g-1>1){let A=0;for(let I=r-w-(d-g-2);I>t;I--)A+=kn.combins(r-w-I-1,d-g-3);E-=A*(d-1-g)}else r-w>t&&E--;a+=E}r-=w}return a}static combins(e,t){let n,r;e-t>t?(r=t,n=e-t):(r=e-t,n=t);let a=1,c=1;for(let d=e;d>n;d--)a*=d,c<=r&&(a/=c,c++);for(;c<=r;)a/=c,c++;return a}}class sg{static buildBitArray(e){let t=e.length*2-1;e[e.length-1].getRightChar()==null&&(t-=1);let n=12*t,r=new D(n),a=0,d=e[0].getRightChar().getValue();for(let g=11;g>=0;--g)d&1<<g&&r.set(a),a++;for(let g=1;g<e.length;++g){let w=e[g],E=w.getLeftChar().getValue();for(let A=11;A>=0;--A)E&1<<A&&r.set(a),a++;if(w.getRightChar()!=null){let A=w.getRightChar().getValue();for(let I=11;I>=0;--I)A&1<<I&&r.set(a),a++}}return r}}class ir{constructor(e,t){t?this.decodedInformation=null:(this.finished=e,this.decodedInformation=t)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class Io{constructor(e){this.newPosition=e}getNewPosition(){return this.newPosition}}class Jt extends Io{constructor(e,t){super(e),this.value=t}getValue(){return this.value}isFNC1(){return this.value===Jt.FNC1}}Jt.FNC1="$";class or extends Io{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 fn extends Io{constructor(e,t,n){if(super(e),t<0||t>10||n<0||n>10)throw new z;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===fn.FNC1}isSecondDigitFNC1(){return this.secondDigit===fn.FNC1}isAnyFNC1(){return this.firstDigit===fn.FNC1||this.secondDigit===fn.FNC1}}fn.FNC1=10;class Ce{constructor(){}static parseFieldsInGeneralPurpose(e){if(!e)return null;if(e.length<2)throw new N;let t=e.substring(0,2);for(let a of Ce.TWO_DIGIT_DATA_LENGTH)if(a[0]===t)return a[1]===Ce.VARIABLE_LENGTH?Ce.processVariableAI(2,a[2],e):Ce.processFixedAI(2,a[1],e);if(e.length<3)throw new N;let n=e.substring(0,3);for(let a of Ce.THREE_DIGIT_DATA_LENGTH)if(a[0]===n)return a[1]===Ce.VARIABLE_LENGTH?Ce.processVariableAI(3,a[2],e):Ce.processFixedAI(3,a[1],e);for(let a of Ce.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(a[0]===n)return a[1]===Ce.VARIABLE_LENGTH?Ce.processVariableAI(4,a[2],e):Ce.processFixedAI(4,a[1],e);if(e.length<4)throw new N;let r=e.substring(0,4);for(let a of Ce.FOUR_DIGIT_DATA_LENGTH)if(a[0]===r)return a[1]===Ce.VARIABLE_LENGTH?Ce.processVariableAI(4,a[2],e):Ce.processFixedAI(4,a[1],e);throw new N}static processFixedAI(e,t,n){if(n.length<e)throw new N;let r=n.substring(0,e);if(n.length<e+t)throw new N;let a=n.substring(e,e+t),c=n.substring(e+t),d="("+r+")"+a,g=Ce.parseFieldsInGeneralPurpose(c);return g==null?d:d+g}static processVariableAI(e,t,n){let r=n.substring(0,e),a;n.length<e+t?a=n.length:a=e+t;let c=n.substring(e,a),d=n.substring(a),g="("+r+")"+c,w=Ce.parseFieldsInGeneralPurpose(d);return w==null?g:g+w}}Ce.VARIABLE_LENGTH=[],Ce.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",Ce.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",Ce.VARIABLE_LENGTH,20],["22",Ce.VARIABLE_LENGTH,29],["30",Ce.VARIABLE_LENGTH,8],["37",Ce.VARIABLE_LENGTH,8],["90",Ce.VARIABLE_LENGTH,30],["91",Ce.VARIABLE_LENGTH,30],["92",Ce.VARIABLE_LENGTH,30],["93",Ce.VARIABLE_LENGTH,30],["94",Ce.VARIABLE_LENGTH,30],["95",Ce.VARIABLE_LENGTH,30],["96",Ce.VARIABLE_LENGTH,30],["97",Ce.VARIABLE_LENGTH,3],["98",Ce.VARIABLE_LENGTH,30],["99",Ce.VARIABLE_LENGTH,30]],Ce.THREE_DIGIT_DATA_LENGTH=[["240",Ce.VARIABLE_LENGTH,30],["241",Ce.VARIABLE_LENGTH,30],["242",Ce.VARIABLE_LENGTH,6],["250",Ce.VARIABLE_LENGTH,30],["251",Ce.VARIABLE_LENGTH,30],["253",Ce.VARIABLE_LENGTH,17],["254",Ce.VARIABLE_LENGTH,20],["400",Ce.VARIABLE_LENGTH,30],["401",Ce.VARIABLE_LENGTH,30],["402",17],["403",Ce.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",Ce.VARIABLE_LENGTH,20],["421",Ce.VARIABLE_LENGTH,15],["422",3],["423",Ce.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],Ce.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",Ce.VARIABLE_LENGTH,15],["391",Ce.VARIABLE_LENGTH,18],["392",Ce.VARIABLE_LENGTH,15],["393",Ce.VARIABLE_LENGTH,18],["703",Ce.VARIABLE_LENGTH,30]],Ce.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",Ce.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",Ce.VARIABLE_LENGTH,20],["8003",Ce.VARIABLE_LENGTH,30],["8004",Ce.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",Ce.VARIABLE_LENGTH,30],["8008",Ce.VARIABLE_LENGTH,12],["8018",18],["8020",Ce.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",Ce.VARIABLE_LENGTH,70],["8200",Ce.VARIABLE_LENGTH,70]];class yr{constructor(e){this.buffer=new V,this.information=e}decodeAllCodes(e,t){let n=t,r=null;do{let a=this.decodeGeneralPurposeField(n,r),c=Ce.parseFieldsInGeneralPurpose(a.getNewString());if(c!=null&&e.append(c),a.isRemaining()?r=""+a.getRemainingValue():r=null,n===a.getNewPosition())break;n=a.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 a=this.extractNumericValueFromBitArray(e,4);return a===0?new fn(this.information.getSize(),fn.FNC1,fn.FNC1):new fn(this.information.getSize(),a-1,fn.FNC1)}let t=this.extractNumericValueFromBitArray(e,7),n=(t-8)/11,r=(t-8)%11;return new fn(e+7,n,r)}extractNumericValueFromBitArray(e,t){return yr.extractNumericValueFromBitArray(this.information,e,t)}static extractNumericValueFromBitArray(e,t,n){let r=0;for(let a=0;a<n;++a)e.get(t+a)&&(r|=1<<n-a-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 or(this.current.getPosition(),this.buffer.toString(),n.getRemainingValue()):new or(this.current.getPosition(),this.buffer.toString())}parseBlocks(){let e,t;do{let n=this.current.getPosition();if(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 or(this.current.getPosition(),this.buffer.toString()):t=new or(this.current.getPosition(),this.buffer.toString(),e.getSecondDigit()),new ir(!0,t)}if(this.buffer.append(e.getFirstDigit()),e.isSecondDigitFNC1()){let t=new or(this.current.getPosition(),this.buffer.toString());return new ir(!0,t)}this.buffer.append(e.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new ir(!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 or(this.current.getPosition(),this.buffer.toString());return new ir(!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 ir(!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 or(this.current.getPosition(),this.buffer.toString());return new ir(!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 ir(!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 Jt(e+5,Jt.FNC1);if(t>=5&&t<15)return new Jt(e+5,"0"+(t-5));let n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<90)return new Jt(e+7,""+(n+1));if(n>=90&&n<116)return new Jt(e+7,""+(n+7));let r=this.extractNumericValueFromBitArray(e,8),a;switch(r){case 232:a="!";break;case 233:a='"';break;case 234:a="%";break;case 235:a="&";break;case 236:a="'";break;case 237:a="(";break;case 238:a=")";break;case 239:a="*";break;case 240:a="+";break;case 241:a=",";break;case 242:a="-";break;case 243:a=".";break;case 244:a="/";break;case 245:a=":";break;case 246:a=";";break;case 247:a="<";break;case 248:a="=";break;case 249:a=">";break;case 250:a="?";break;case 251:a="_";break;case 252:a=" ";break;default:throw new z}return new Jt(e+8,a)}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 Jt(e+5,Jt.FNC1);if(t>=5&&t<15)return new Jt(e+5,"0"+(t-5));let n=this.extractNumericValueFromBitArray(e,6);if(n>=32&&n<58)return new Jt(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 Jt(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 So{constructor(e){this.information=e,this.generalDecoder=new yr(e)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class en extends So{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 a=this.getGeneralDecoder().extractNumericValueFromBitArray(t+10*r,10);a/100===0&&e.append("0"),a/10===0&&e.append("0"),e.append(a)}en.appendCheckDigit(e,n)}static appendCheckDigit(e,t){let n=0;for(let r=0;r<13;r++){let a=e.charAt(r+t).charCodeAt(0)-48;n+=r&1?a:3*a}n=10-n%10,n===10&&(n=0),e.append(n)}}en.GTIN_SIZE=40;class br extends en{constructor(e){super(e)}parseInformation(){let e=new V;e.append("(01)");let t=e.length(),n=this.getGeneralDecoder().extractNumericValueFromBitArray(br.HEADER_SIZE,4);return e.append(n),this.encodeCompressedGtinWithoutAI(e,br.HEADER_SIZE+4,t),this.getGeneralDecoder().decodeAllCodes(e,br.HEADER_SIZE+44)}}br.HEADER_SIZE=4;class Si extends So{constructor(e){super(e)}parseInformation(){let e=new V;return this.getGeneralDecoder().decodeAllCodes(e,Si.HEADER_SIZE)}}Si.HEADER_SIZE=5;class Ni extends en{constructor(e){super(e)}encodeCompressedWeight(e,t,n){let r=this.getGeneralDecoder().extractNumericValueFromBitArray(t,n);this.addWeightCode(e,r);let a=this.checkWeight(r),c=1e5;for(let d=0;d<5;++d)a/c===0&&e.append("0"),c/=10;e.append(a)}}class Rn extends Ni{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()!=Rn.HEADER_SIZE+Ni.GTIN_SIZE+Rn.WEIGHT_SIZE)throw new N;let e=new V;return this.encodeCompressedGtin(e,Rn.HEADER_SIZE),this.encodeCompressedWeight(e,Rn.HEADER_SIZE+Ni.GTIN_SIZE,Rn.WEIGHT_SIZE),e.toString()}}Rn.HEADER_SIZE=5,Rn.WEIGHT_SIZE=15;class ag extends Rn{constructor(e){super(e)}addWeightCode(e,t){e.append("(3103)")}checkWeight(e){return e}}class lg extends Rn{constructor(e){super(e)}addWeightCode(e,t){t<1e4?e.append("(3202)"):e.append("(3203)")}checkWeight(e){return e<1e4?e:e-1e4}}class On extends en{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<On.HEADER_SIZE+en.GTIN_SIZE)throw new N;let e=new V;this.encodeCompressedGtin(e,On.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(On.HEADER_SIZE+en.GTIN_SIZE,On.LAST_DIGIT_SIZE);e.append("(392"),e.append(t),e.append(")");let n=this.getGeneralDecoder().decodeGeneralPurposeField(On.HEADER_SIZE+en.GTIN_SIZE+On.LAST_DIGIT_SIZE,null);return e.append(n.getNewString()),e.toString()}}On.HEADER_SIZE=8,On.LAST_DIGIT_SIZE=2;class Zt extends en{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<Zt.HEADER_SIZE+en.GTIN_SIZE)throw new N;let e=new V;this.encodeCompressedGtin(e,Zt.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(Zt.HEADER_SIZE+en.GTIN_SIZE,Zt.LAST_DIGIT_SIZE);e.append("(393"),e.append(t),e.append(")");let n=this.getGeneralDecoder().extractNumericValueFromBitArray(Zt.HEADER_SIZE+en.GTIN_SIZE+Zt.LAST_DIGIT_SIZE,Zt.FIRST_THREE_DIGITS_SIZE);n/100==0&&e.append("0"),n/10==0&&e.append("0"),e.append(n);let r=this.getGeneralDecoder().decodeGeneralPurposeField(Zt.HEADER_SIZE+en.GTIN_SIZE+Zt.LAST_DIGIT_SIZE+Zt.FIRST_THREE_DIGITS_SIZE,null);return e.append(r.getNewString()),e.toString()}}Zt.HEADER_SIZE=8,Zt.LAST_DIGIT_SIZE=2,Zt.FIRST_THREE_DIGITS_SIZE=10;class pt extends Ni{constructor(e,t,n){super(e),this.dateCode=n,this.firstAIdigits=t}parseInformation(){if(this.getInformation().getSize()!=pt.HEADER_SIZE+pt.GTIN_SIZE+pt.WEIGHT_SIZE+pt.DATE_SIZE)throw new N;let e=new V;return this.encodeCompressedGtin(e,pt.HEADER_SIZE),this.encodeCompressedWeight(e,pt.HEADER_SIZE+pt.GTIN_SIZE,pt.WEIGHT_SIZE),this.encodeCompressedDate(e,pt.HEADER_SIZE+pt.GTIN_SIZE+pt.WEIGHT_SIZE),e.toString()}encodeCompressedDate(e,t){let n=this.getGeneralDecoder().extractNumericValueFromBitArray(t,pt.DATE_SIZE);if(n==38400)return;e.append("("),e.append(this.dateCode),e.append(")");let r=n%32;n/=32;let a=n%12+1;n/=12;let c=n;c/10==0&&e.append("0"),e.append(c),a/10==0&&e.append("0"),e.append(a),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}}pt.HEADER_SIZE=8,pt.WEIGHT_SIZE=20,pt.DATE_SIZE=16;function Ua(b){try{if(b.get(1))return new br(b);if(!b.get(2))return new Si(b);switch(yr.extractNumericValueFromBitArray(b,1,4)){case 4:return new ag(b);case 5:return new lg(b)}switch(yr.extractNumericValueFromBitArray(b,1,5)){case 12:return new On(b);case 13:return new Zt(b)}switch(yr.extractNumericValueFromBitArray(b,1,7)){case 56:return new pt(b,"310","11");case 57:return new pt(b,"320","11");case 58:return new pt(b,"310","13");case 59:return new pt(b,"320","13");case 60:return new pt(b,"310","15");case 61:return new pt(b,"320","15");case 62:return new pt(b,"310","17");case 63:return new pt(b,"320","17")}}catch(e){throw console.log(e),new nt("unknown decoder: "+b)}}class Wn{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 Wn?Wn.equalsOrNull(e.leftchar,t.leftchar)&&Wn.equalsOrNull(e.rightchar,t.rightchar)&&Wn.equalsOrNull(e.finderpattern,t.finderpattern):!1}static equalsOrNull(e,t){return e===null?t===null:Wn.equals(e,t)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class No{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 No?this.checkEqualitity(e,t)&&e.wasReversed===t.wasReversed:!1}checkEqualitity(e,t){if(!e||!t)return;let n;return e.forEach((r,a)=>{t.forEach(c=>{r.getLeftChar().getValue()===c.getLeftChar().getValue()&&r.getRightChar().getValue()===c.getRightChar().getValue()&&r.getFinderPatter().getValue()===c.getFinderPatter().getValue()&&(n=!0)})}),n}}class oe extends Bt{constructor(e){super(...arguments),this.pairs=new Array(oe.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 oe.constructResult(this.decodeRow2pairs(e,t))}catch(r){this.verbose&&console.log(r)}return this.pairs.length=0,this.startFromEven=!0,oe.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(a){if(a instanceof N){if(!this.pairs.length)throw new N;n=!0}}if(this.checkChecksum())return this.pairs;let r;if(this.rows.length?r=!0:r=!1,this.storeRow(e,!1),r){let a=this.checkRowsBoolean(!1);if(a!=null||(a=this.checkRowsBoolean(!0),a!=null))return a}throw new N}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 c of e)this.pairs.push(c.getPairs());if(this.pairs.push(r.getPairs()),!oe.isValidSequence(this.pairs))continue;if(this.checkChecksum())return this.pairs;let a=new Array(e);a.push(r);try{return this.checkRows(a,n+1)}catch(c){this.verbose&&console.log(c)}}throw new N}static isValidSequence(e){for(let t of oe.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,a=!1;for(;n<this.rows.length;){let c=this.rows[n];if(c.getRowNumber()>e){a=c.isEquivalent(this.pairs);break}r=c.isEquivalent(this.pairs),n++}a||r||oe.isPartialRow(this.pairs,this.rows)||(this.rows.push(n,new No(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 a of e)if(Wn.equals(r,a))break}}static isPartialRow(e,t){for(let n of t){let r=!0;for(let a of e){let c=!1;for(let d of n.getPairs())if(a.equals(d)){c=!0;break}if(!c){r=!1;break}}if(r)return!0}return!1}getRows(){return this.rows}static constructResult(e){let t=sg.buildBitArray(e),r=Ua(t).parseInformation(),a=e[0].getFinderPattern().getResultPoints(),c=e[e.length-1].getFinderPattern().getResultPoints(),d=[a[0],a[1],c[0],c[1]];return new _e(r,null,null,d,he.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(),a=2;for(let d=1;d<this.pairs.size();++d){let g=this.pairs.get(d);r+=g.getLeftChar().getChecksumPortion(),a++;let w=g.getRightChar();w!=null&&(r+=w.getChecksumPortion(),a++)}return r%=211,211*(a-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 a,c=!0,d=-1;do this.findNextPair(e,t,d),a=this.parseFoundFinderPattern(e,n,r),a==null?d=oe.getNextSecondBar(e,this.startEnd[0]):c=!1;while(c);let g=this.decodeDataCharacter(e,a,r,!0);if(!this.isEmptyPair(t)&&t[t.length-1].mustBeLast())throw new N;let w;try{w=this.decodeDataCharacter(e,a,r,!1)}catch(E){w=null,this.verbose&&console.log(E)}return new Wn(g,w,a,!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 a=e.getSize(),c;n>=0?c=n:this.isEmptyPair(t)?c=0:c=t[t.length-1].getFinderPattern().getStartEnd()[1];let d=t.length%2!=0;this.startFromEven&&(d=!d);let g=!1;for(;c<a&&(g=!e.get(c),!!g);)c++;let w=0,E=c;for(let A=c;A<a;A++)if(e.get(A)!=g)r[w]++;else{if(w==3){if(d&&oe.reverseCounters(r),oe.isFinderPattern(r)){this.startEnd[0]=E,this.startEnd[1]=A;return}d&&oe.reverseCounters(r),E+=r[0]+r[1],r[0]=r[2],r[1]=r[3],r[2]=0,r[3]=0,w--}else w++;r[w]=1,g=!g}throw new N}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,a,c;if(n){let w=this.startEnd[0]-1;for(;w>=0&&!e.get(w);)w--;w++,r=this.startEnd[0]-w,a=w,c=this.startEnd[1]}else a=this.startEnd[0],c=e.getNextUnset(this.startEnd[1]+1),r=c-this.startEnd[1];let d=this.getDecodeFinderCounters();P.arraycopy(d,0,d,1,d.length-1),d[0]=r;let g;try{g=this.parseFinderValue(d,oe.FINDER_PATTERNS)}catch{return null}return new Ii(g,[a,c],a,c,t)}decodeDataCharacter(e,t,n,r){let a=this.getDataCharacterCounters();for(let at=0;at<a.length;at++)a[at]=0;if(r)oe.recordPatternInReverse(e,t.getStartEnd()[0],a);else{oe.recordPattern(e,t.getStartEnd()[1],a);for(let at=0,Ut=a.length-1;at<Ut;at++,Ut--){let ln=a[at];a[at]=a[Ut],a[Ut]=ln}}let c=17,d=He.sum(new Int32Array(a))/c,g=(t.getStartEnd()[1]-t.getStartEnd()[0])/15;if(Math.abs(d-g)/g>.3)throw new N;let w=this.getOddCounts(),E=this.getEvenCounts(),A=this.getOddRoundingErrors(),I=this.getEvenRoundingErrors();for(let at=0;at<a.length;at++){let Ut=1*a[at]/d,ln=Ut+.5;if(ln<1){if(Ut<.3)throw new N;ln=1}else if(ln>8){if(Ut>8.7)throw new N;ln=8}let Tr=at/2;at&1?(E[Tr]=ln,I[Tr]=Ut-ln):(w[Tr]=ln,A[Tr]=Ut-ln)}this.adjustOddEvenCounts(c);let O=4*t.getValue()+(n?0:2)+(r?0:1)-1,L=0,F=0;for(let at=w.length-1;at>=0;at--){if(oe.isNotA1left(t,n,r)){let Ut=oe.WEIGHTS[O][2*at];F+=w[at]*Ut}L+=w[at]}let Z=0;for(let at=E.length-1;at>=0;at--)if(oe.isNotA1left(t,n,r)){let Ut=oe.WEIGHTS[O][2*at+1];Z+=E[at]*Ut}let ne=F+Z;if(L&1||L>13||L<4)throw new N;let ce=(13-L)/2,ue=oe.SYMBOL_WIDEST[ce],ae=9-ue,Ge=kn.getRSSvalue(w,ue,!0),ve=kn.getRSSvalue(E,ae,!1),nn=oe.EVEN_TOTAL_SUBSET[ce],An=oe.GSUM[ce],rn=Ge*nn+ve+An;return new Gn(rn,ne)}static isNotA1left(e,t,n){return!(e.getValue()==0&&t&&n)}adjustOddEvenCounts(e){let t=He.sum(new Int32Array(this.getOddCounts())),n=He.sum(new Int32Array(this.getEvenCounts())),r=!1,a=!1;t>13?a=!0:t<4&&(r=!0);let c=!1,d=!1;n>13?d=!0:n<4&&(c=!0);let g=t+n-e,w=(t&1)==1,E=(n&1)==0;if(g==1)if(w){if(E)throw new N;a=!0}else{if(!E)throw new N;d=!0}else if(g==-1)if(w){if(E)throw new N;r=!0}else{if(!E)throw new N;c=!0}else if(g==0){if(w){if(!E)throw new N;t<n?(r=!0,d=!0):(a=!0,c=!0)}else if(E)throw new N}else throw new N;if(r){if(a)throw new N;oe.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(a&&oe.decrement(this.getOddCounts(),this.getOddRoundingErrors()),c){if(d)throw new N;oe.increment(this.getEvenCounts(),this.getOddRoundingErrors())}d&&oe.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}oe.SYMBOL_WIDEST=[7,5,4,3,1],oe.EVEN_TOTAL_SUBSET=[4,20,52,104,204],oe.GSUM=[0,348,1388,2948,3988],oe.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])],oe.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,91],[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]],oe.FINDER_PAT_A=0,oe.FINDER_PAT_B=1,oe.FINDER_PAT_C=2,oe.FINDER_PAT_D=3,oe.FINDER_PAT_E=4,oe.FINDER_PAT_F=5,oe.FINDER_PATTERN_SEQUENCES=[[oe.FINDER_PAT_A,oe.FINDER_PAT_A],[oe.FINDER_PAT_A,oe.FINDER_PAT_B,oe.FINDER_PAT_B],[oe.FINDER_PAT_A,oe.FINDER_PAT_C,oe.FINDER_PAT_B,oe.FINDER_PAT_D],[oe.FINDER_PAT_A,oe.FINDER_PAT_E,oe.FINDER_PAT_B,oe.FINDER_PAT_D,oe.FINDER_PAT_C],[oe.FINDER_PAT_A,oe.FINDER_PAT_E,oe.FINDER_PAT_B,oe.FINDER_PAT_D,oe.FINDER_PAT_D,oe.FINDER_PAT_F],[oe.FINDER_PAT_A,oe.FINDER_PAT_E,oe.FINDER_PAT_B,oe.FINDER_PAT_D,oe.FINDER_PAT_E,oe.FINDER_PAT_F,oe.FINDER_PAT_F],[oe.FINDER_PAT_A,oe.FINDER_PAT_A,oe.FINDER_PAT_B,oe.FINDER_PAT_B,oe.FINDER_PAT_C,oe.FINDER_PAT_C,oe.FINDER_PAT_D,oe.FINDER_PAT_D],[oe.FINDER_PAT_A,oe.FINDER_PAT_A,oe.FINDER_PAT_B,oe.FINDER_PAT_B,oe.FINDER_PAT_C,oe.FINDER_PAT_C,oe.FINDER_PAT_D,oe.FINDER_PAT_E,oe.FINDER_PAT_E],[oe.FINDER_PAT_A,oe.FINDER_PAT_A,oe.FINDER_PAT_B,oe.FINDER_PAT_B,oe.FINDER_PAT_C,oe.FINDER_PAT_C,oe.FINDER_PAT_D,oe.FINDER_PAT_E,oe.FINDER_PAT_F,oe.FINDER_PAT_F],[oe.FINDER_PAT_A,oe.FINDER_PAT_A,oe.FINDER_PAT_B,oe.FINDER_PAT_B,oe.FINDER_PAT_C,oe.FINDER_PAT_D,oe.FINDER_PAT_D,oe.FINDER_PAT_E,oe.FINDER_PAT_E,oe.FINDER_PAT_F,oe.FINDER_PAT_F]],oe.MAX_PAIRS=11;class cg extends Gn{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 Ct extends Bt{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(e,t,n){const r=this.decodePair(t,!1,e,n);Ct.addOrTally(this.possibleLeftPairs,r),t.reverse();let a=this.decodePair(t,!0,e,n);Ct.addOrTally(this.possibleRightPairs,a),t.reverse();for(let c of this.possibleLeftPairs)if(c.getCount()>1){for(let d of this.possibleRightPairs)if(d.getCount()>1&&Ct.checkChecksum(c,d))return Ct.constructResult(c,d)}throw new N}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(),a=new V;for(let w=13-r.length;w>0;w--)a.append("0");a.append(r);let c=0;for(let w=0;w<13;w++){let E=a.charAt(w).charCodeAt(0)-48;c+=w&1?E:3*E}c=10-c%10,c===10&&(c=0),a.append(c.toString());let d=e.getFinderPattern().getResultPoints(),g=t.getFinderPattern().getResultPoints();return new _e(a.toString(),null,0,[d[0],d[1],g[0],g[1]],he.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 a=this.findFinderPattern(e,t),c=this.parseFoundFinderPattern(e,n,t,a),d=r==null?null:r.get(te.NEED_RESULT_POINT_CALLBACK);if(d!=null){let E=(a[0]+a[1])/2;t&&(E=e.getSize()-1-E),d.foundPossibleResultPoint(new ye(E,n))}let g=this.decodeDataCharacter(e,c,!0),w=this.decodeDataCharacter(e,c,!1);return new cg(1597*g.getValue()+w.getValue(),g.getChecksumPortion()+4*w.getChecksumPortion(),c)}catch{return null}}decodeDataCharacter(e,t,n){let r=this.getDataCharacterCounters();for(let Z=0;Z<r.length;Z++)r[Z]=0;if(n)Ke.recordPatternInReverse(e,t.getStartEnd()[0],r);else{Ke.recordPattern(e,t.getStartEnd()[1]+1,r);for(let Z=0,ne=r.length-1;Z<ne;Z++,ne--){let ce=r[Z];r[Z]=r[ne],r[ne]=ce}}let a=n?16:15,c=He.sum(new Int32Array(r))/a,d=this.getOddCounts(),g=this.getEvenCounts(),w=this.getOddRoundingErrors(),E=this.getEvenRoundingErrors();for(let Z=0;Z<r.length;Z++){let ne=r[Z]/c,ce=Math.floor(ne+.5);ce<1?ce=1:ce>8&&(ce=8);let ue=Math.floor(Z/2);Z&1?(g[ue]=ce,E[ue]=ne-ce):(d[ue]=ce,w[ue]=ne-ce)}this.adjustOddEvenCounts(n,a);let A=0,I=0;for(let Z=d.length-1;Z>=0;Z--)I*=9,I+=d[Z],A+=d[Z];let O=0,L=0;for(let Z=g.length-1;Z>=0;Z--)O*=9,O+=g[Z],L+=g[Z];let F=I+3*O;if(n){if(A&1||A>12||A<4)throw new N;let Z=(12-A)/2,ne=Ct.OUTSIDE_ODD_WIDEST[Z],ce=9-ne,ue=kn.getRSSvalue(d,ne,!1),ae=kn.getRSSvalue(g,ce,!0),Ge=Ct.OUTSIDE_EVEN_TOTAL_SUBSET[Z],ve=Ct.OUTSIDE_GSUM[Z];return new Gn(ue*Ge+ae+ve,F)}else{if(L&1||L>10||L<4)throw new N;let Z=(10-L)/2,ne=Ct.INSIDE_ODD_WIDEST[Z],ce=9-ne,ue=kn.getRSSvalue(d,ne,!0),ae=kn.getRSSvalue(g,ce,!1),Ge=Ct.INSIDE_ODD_TOTAL_SUBSET[Z],ve=Ct.INSIDE_GSUM[Z];return new Gn(ae*Ge+ue+ve,F)}}findFinderPattern(e,t){let n=this.getDecodeFinderCounters();n[0]=0,n[1]=0,n[2]=0,n[3]=0;let r=e.getSize(),a=!1,c=0;for(;c<r&&(a=!e.get(c),t!==a);)c++;let d=0,g=c;for(let w=c;w<r;w++)if(e.get(w)!==a)n[d]++;else{if(d===3){if(Bt.isFinderPattern(n))return[g,w];g+=n[0]+n[1],n[0]=n[2],n[1]=n[3],n[2]=0,n[3]=0,d--}else d++;n[d]=1,a=!a}throw new N}parseFoundFinderPattern(e,t,n,r){let a=e.get(r[0]),c=r[0]-1;for(;c>=0&&a!==e.get(c);)c--;c++;const d=r[0]-c,g=this.getDecodeFinderCounters(),w=new Int32Array(g.length);P.arraycopy(g,0,w,1,g.length-1),w[0]=d;const E=this.parseFinderValue(w,Ct.FINDER_PATTERNS);let A=c,I=r[1];return n&&(A=e.getSize()-1-A,I=e.getSize()-1-I),new Ii(E,[c,r[1]],A,I,t)}adjustOddEvenCounts(e,t){let n=He.sum(new Int32Array(this.getOddCounts())),r=He.sum(new Int32Array(this.getEvenCounts())),a=!1,c=!1,d=!1,g=!1;e?(n>12?c=!0:n<4&&(a=!0),r>12?g=!0:r<4&&(d=!0)):(n>11?c=!0:n<5&&(a=!0),r>10?g=!0:r<4&&(d=!0));let w=n+r-t,E=(n&1)===(e?1:0),A=(r&1)===1;if(w===1)if(E){if(A)throw new N;c=!0}else{if(!A)throw new N;g=!0}else if(w===-1)if(E){if(A)throw new N;a=!0}else{if(!A)throw new N;d=!0}else if(w===0){if(E){if(!A)throw new N;n<r?(a=!0,g=!0):(c=!0,d=!0)}else if(A)throw new N}else throw new N;if(a){if(c)throw new N;Bt.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(c&&Bt.decrement(this.getOddCounts(),this.getOddRoundingErrors()),d){if(g)throw new N;Bt.increment(this.getEvenCounts(),this.getOddRoundingErrors())}g&&Bt.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}Ct.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],Ct.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],Ct.OUTSIDE_GSUM=[0,161,961,2015,2715],Ct.INSIDE_GSUM=[0,336,1036,1516],Ct.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],Ct.INSIDE_ODD_WIDEST=[2,4,6,8],Ct.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 Ar extends Ke{constructor(e,t){super(),this.readers=[],this.verbose=t===!0;const n=e?e.get(te.POSSIBLE_FORMATS):null,r=e&&e.get(te.ASSUME_CODE_39_CHECK_DIGIT)!==void 0;n?((n.includes(he.EAN_13)||n.includes(he.UPC_A)||n.includes(he.EAN_8)||n.includes(he.UPC_E))&&this.readers.push(new Un(e)),n.includes(he.CODE_39)&&this.readers.push(new ft(r)),n.includes(he.CODE_128)&&this.readers.push(new de),n.includes(he.ITF)&&this.readers.push(new Ye),n.includes(he.RSS_14)&&this.readers.push(new Ct),n.includes(he.RSS_EXPANDED)&&this.readers.push(new oe(this.verbose))):(this.readers.push(new Un(e)),this.readers.push(new ft),this.readers.push(new Un(e)),this.readers.push(new de),this.readers.push(new Ye),this.readers.push(new Ct),this.readers.push(new oe(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 N}reset(){this.readers.forEach(e=>e.reset())}}class ug extends Ne{constructor(e=500,t){super(new Ar(t),e,t)}}class tt{constructor(e,t,n){this.ecCodewords=e,this.ecBlocks=[t],n&&this.ecBlocks.push(n)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class Je{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class je{constructor(e,t,n,r,a,c){this.versionNumber=e,this.symbolSizeRows=t,this.symbolSizeColumns=n,this.dataRegionSizeRows=r,this.dataRegionSizeColumns=a,this.ecBlocks=c;let d=0;const g=c.getECCodewords(),w=c.getECBlocks();for(let E of w)d+=E.getCount()*(E.getDataCodewords()+g);this.totalCodewords=d}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}static getVersionForDimensions(e,t){if(e&1||t&1)throw new z;for(let n of je.VERSIONS)if(n.symbolSizeRows===e&&n.symbolSizeColumns===t)return n;throw new z}toString(){return""+this.versionNumber}static buildVersions(){return[new je(1,10,10,8,8,new tt(5,new Je(1,3))),new je(2,12,12,10,10,new tt(7,new Je(1,5))),new je(3,14,14,12,12,new tt(10,new Je(1,8))),new je(4,16,16,14,14,new tt(12,new Je(1,12))),new je(5,18,18,16,16,new tt(14,new Je(1,18))),new je(6,20,20,18,18,new tt(18,new Je(1,22))),new je(7,22,22,20,20,new tt(20,new Je(1,30))),new je(8,24,24,22,22,new tt(24,new Je(1,36))),new je(9,26,26,24,24,new tt(28,new Je(1,44))),new je(10,32,32,14,14,new tt(36,new Je(1,62))),new je(11,36,36,16,16,new tt(42,new Je(1,86))),new je(12,40,40,18,18,new tt(48,new Je(1,114))),new je(13,44,44,20,20,new tt(56,new Je(1,144))),new je(14,48,48,22,22,new tt(68,new Je(1,174))),new je(15,52,52,24,24,new tt(42,new Je(2,102))),new je(16,64,64,14,14,new tt(56,new Je(2,140))),new je(17,72,72,16,16,new tt(36,new Je(4,92))),new je(18,80,80,18,18,new tt(48,new Je(4,114))),new je(19,88,88,20,20,new tt(56,new Je(4,144))),new je(20,96,96,22,22,new tt(68,new Je(4,174))),new je(21,104,104,24,24,new tt(56,new Je(6,136))),new je(22,120,120,18,18,new tt(68,new Je(6,175))),new je(23,132,132,20,20,new tt(62,new Je(8,163))),new je(24,144,144,22,22,new tt(62,new Je(8,156),new Je(2,155))),new je(25,8,18,6,16,new tt(7,new Je(1,5))),new je(26,8,32,6,14,new tt(11,new Je(1,10))),new je(27,12,26,10,24,new tt(14,new Je(1,16))),new je(28,12,36,10,16,new tt(18,new Je(1,22))),new je(29,16,36,14,16,new tt(24,new Je(1,32))),new je(30,16,48,14,22,new tt(28,new Je(1,49)))]}}je.VERSIONS=je.buildVersions();class To{constructor(e){const t=e.getHeight();if(t<8||t>144||t&1)throw new z;this.version=To.readVersion(e),this.mappingBitMatrix=this.extractDataRegion(e),this.readMappingMatrix=new X(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(e){const t=e.getHeight(),n=e.getWidth();return je.getVersionForDimensions(t,n)}readCodewords(){const e=new Int8Array(this.version.getTotalCodewords());let t=0,n=4,r=0;const a=this.mappingBitMatrix.getHeight(),c=this.mappingBitMatrix.getWidth();let d=!1,g=!1,w=!1,E=!1;do if(n===a&&r===0&&!d)e[t++]=this.readCorner1(a,c)&255,n-=2,r+=2,d=!0;else if(n===a-2&&r===0&&c&3&&!g)e[t++]=this.readCorner2(a,c)&255,n-=2,r+=2,g=!0;else if(n===a+4&&r===2&&!(c&7)&&!w)e[t++]=this.readCorner3(a,c)&255,n-=2,r+=2,w=!0;else if(n===a-2&&r===0&&(c&7)===4&&!E)e[t++]=this.readCorner4(a,c)&255,n-=2,r+=2,E=!0;else{do n<a&&r>=0&&!this.readMappingMatrix.get(r,n)&&(e[t++]=this.readUtah(n,r,a,c)&255),n-=2,r+=2;while(n>=0&&r<c);n+=1,r+=3;do n>=0&&r<c&&!this.readMappingMatrix.get(r,n)&&(e[t++]=this.readUtah(n,r,a,c)&255),n+=2,r-=2;while(n<a&&r>=0);n+=3,r+=1}while(n<a||r<c);if(t!==this.version.getTotalCodewords())throw new z;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 a=0;return this.readModule(e-2,t-2,n,r)&&(a|=1),a<<=1,this.readModule(e-2,t-1,n,r)&&(a|=1),a<<=1,this.readModule(e-1,t-2,n,r)&&(a|=1),a<<=1,this.readModule(e-1,t-1,n,r)&&(a|=1),a<<=1,this.readModule(e-1,t,n,r)&&(a|=1),a<<=1,this.readModule(e,t-2,n,r)&&(a|=1),a<<=1,this.readModule(e,t-1,n,r)&&(a|=1),a<<=1,this.readModule(e,t,n,r)&&(a|=1),a}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 y("Dimension of bitMatrix must match the version size");const r=this.version.getDataRegionSizeRows(),a=this.version.getDataRegionSizeColumns(),c=t/r|0,d=n/a|0,g=c*r,w=d*a,E=new X(w,g);for(let A=0;A<c;++A){const I=A*r;for(let O=0;O<d;++O){const L=O*a;for(let F=0;F<r;++F){const Z=A*(r+2)+1+F,ne=I+F;for(let ce=0;ce<a;++ce){const ue=O*(a+2)+1+ce;if(e.get(ue,Z)){const ae=L+ce;E.set(ae,ne)}}}}}return E}}class ko{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t){const n=t.getECBlocks();let r=0;const a=n.getECBlocks();for(let F of a)r+=F.getCount();const c=new Array(r);let d=0;for(let F of a)for(let Z=0;Z<F.getCount();Z++){const ne=F.getDataCodewords(),ce=n.getECCodewords()+ne;c[d++]=new ko(ne,new Uint8Array(ce))}const w=c[0].codewords.length-n.getECCodewords(),E=w-1;let A=0;for(let F=0;F<E;F++)for(let Z=0;Z<d;Z++)c[Z].codewords[F]=e[A++];const I=t.getVersionNumber()===24,O=I?8:d;for(let F=0;F<O;F++)c[F].codewords[w-1]=e[A++];const L=c[0].codewords.length;for(let F=w;F<L;F++)for(let Z=0;Z<d;Z++){const ne=I?(Z+8)%d:Z,ce=I&&ne>7?F-1:F;c[ne].codewords[ce]=e[A++]}if(A!==e.length)throw new y;return c}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class Ro{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 y(""+e);let t=0,n=this.bitOffset,r=this.byteOffset;const a=this.bytes;if(n>0){const c=8-n,d=e<c?e:c,g=c-d,w=255>>8-d<<g;t=(a[r]&w)>>g,e-=d,n+=d,n===8&&(n=0,r++)}if(e>0){for(;e>=8;)t=t<<8|a[r]&255,r++,e-=8;if(e>0){const c=8-e,d=255>>c<<c;t=t<<e|(a[r]&d)>>c,n+=e}}return this.bitOffset=n,this.byteOffset=r,t}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var Tt;(function(b){b[b.PAD_ENCODE=0]="PAD_ENCODE",b[b.ASCII_ENCODE=1]="ASCII_ENCODE",b[b.C40_ENCODE=2]="C40_ENCODE",b[b.TEXT_ENCODE=3]="TEXT_ENCODE",b[b.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",b[b.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",b[b.BASE256_ENCODE=6]="BASE256_ENCODE"})(Tt||(Tt={}));class Xn{static decode(e){const t=new Ro(e),n=new V,r=new V,a=new Array;let c=Tt.ASCII_ENCODE;do if(c===Tt.ASCII_ENCODE)c=this.decodeAsciiSegment(t,n,r);else{switch(c){case Tt.C40_ENCODE:this.decodeC40Segment(t,n);break;case Tt.TEXT_ENCODE:this.decodeTextSegment(t,n);break;case Tt.ANSIX12_ENCODE:this.decodeAnsiX12Segment(t,n);break;case Tt.EDIFACT_ENCODE:this.decodeEdifactSegment(t,n);break;case Tt.BASE256_ENCODE:this.decodeBase256Segment(t,n,a);break;default:throw new z}c=Tt.ASCII_ENCODE}while(c!==Tt.PAD_ENCODE&&t.available()>0);return r.length()>0&&n.append(r.toString()),new Oe(e,n.toString(),a.length===0?null:a,null)}static decodeAsciiSegment(e,t,n){let r=!1;do{let a=e.readBits(8);if(a===0)throw new z;if(a<=128)return r&&(a+=128),t.append(String.fromCharCode(a-1)),Tt.ASCII_ENCODE;if(a===129)return Tt.PAD_ENCODE;if(a<=229){const c=a-130;c<10&&t.append("0"),t.append(""+c)}else switch(a){case 230:return Tt.C40_ENCODE;case 231:return Tt.BASE256_ENCODE;case 232:t.append("");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 Tt.ANSIX12_ENCODE;case 239:return Tt.TEXT_ENCODE;case 240:return Tt.EDIFACT_ENCODE;case 241:break;default:if(a!==254||e.available()!==0)throw new z;break}}while(e.available()>0);return Tt.ASCII_ENCODE}static decodeC40Segment(e,t){let n=!1;const r=[];let a=0;do{if(e.available()===8)return;const c=e.readBits(8);if(c===254)return;this.parseTwoBytes(c,e.readBits(8),r);for(let d=0;d<3;d++){const g=r[d];switch(a){case 0:if(g<3)a=g+1;else if(g<this.C40_BASIC_SET_CHARS.length){const w=this.C40_BASIC_SET_CHARS[g];n?(t.append(String.fromCharCode(w.charCodeAt(0)+128)),n=!1):t.append(w)}else throw new z;break;case 1:n?(t.append(String.fromCharCode(g+128)),n=!1):t.append(String.fromCharCode(g)),a=0;break;case 2:if(g<this.C40_SHIFT2_SET_CHARS.length){const w=this.C40_SHIFT2_SET_CHARS[g];n?(t.append(String.fromCharCode(w.charCodeAt(0)+128)),n=!1):t.append(w)}else switch(g){case 27:t.append("");break;case 30:n=!0;break;default:throw new z}a=0;break;case 3:n?(t.append(String.fromCharCode(g+224)),n=!1):t.append(String.fromCharCode(g+96)),a=0;break;default:throw new z}}}while(e.available()>0)}static decodeTextSegment(e,t){let n=!1,r=[],a=0;do{if(e.available()===8)return;const c=e.readBits(8);if(c===254)return;this.parseTwoBytes(c,e.readBits(8),r);for(let d=0;d<3;d++){const g=r[d];switch(a){case 0:if(g<3)a=g+1;else if(g<this.TEXT_BASIC_SET_CHARS.length){const w=this.TEXT_BASIC_SET_CHARS[g];n?(t.append(String.fromCharCode(w.charCodeAt(0)+128)),n=!1):t.append(w)}else throw new z;break;case 1:n?(t.append(String.fromCharCode(g+128)),n=!1):t.append(String.fromCharCode(g)),a=0;break;case 2:if(g<this.TEXT_SHIFT2_SET_CHARS.length){const w=this.TEXT_SHIFT2_SET_CHARS[g];n?(t.append(String.fromCharCode(w.charCodeAt(0)+128)),n=!1):t.append(w)}else switch(g){case 27:t.append("");break;case 30:n=!0;break;default:throw new z}a=0;break;case 3:if(g<this.TEXT_SHIFT3_SET_CHARS.length){const w=this.TEXT_SHIFT3_SET_CHARS[g];n?(t.append(String.fromCharCode(w.charCodeAt(0)+128)),n=!1):t.append(w),a=0}else throw new z;break;default:throw new z}}}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 a=0;a<3;a++){const c=n[a];switch(c){case 0:t.append("\r");break;case 1:t.append("*");break;case 2:t.append(">");break;case 3:t.append(" ");break;default:if(c<14)t.append(String.fromCharCode(c+44));else if(c<40)t.append(String.fromCharCode(c+51));else throw new z;break}}}while(e.available()>0)}static parseTwoBytes(e,t,n){let r=(e<<8)+t-1,a=Math.floor(r/1600);n[0]=a,r-=a*1600,a=Math.floor(r/40),n[1]=a,n[2]=r-a*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 a=8-e.getBitOffset();a!==8&&e.readBits(a);return}r&32||(r|=64),t.append(String.fromCharCode(r))}}while(e.available()>0)}static decodeBase256Segment(e,t,n){let r=1+e.getByteOffset();const a=this.unrandomize255State(e.readBits(8),r++);let c;if(a===0?c=e.available()/8|0:a<250?c=a:c=250*(a-249)+this.unrandomize255State(e.readBits(8),r++),c<0)throw new z;const d=new Uint8Array(c);for(let g=0;g<c;g++){if(e.available()<8)throw new z;d[g]=this.unrandomize255State(e.readBits(8),r++)}n.push(d);try{t.append(j.decode(d,G.ISO88591))}catch(g){throw new nt("Platform does not support required encoding: "+g.message)}}static unrandomize255State(e,t){const n=149*t%255+1,r=e-n;return r>=0?r:r+256}}Xn.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"],Xn.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],Xn.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"],Xn.TEXT_SHIFT2_SET_CHARS=Xn.C40_SHIFT2_SET_CHARS,Xn.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","{","|","}","~",""];class dg{constructor(){this.rsDecoder=new jt(Ee.DATA_MATRIX_FIELD_256)}decode(e){const t=new To(e),n=t.getVersion(),r=t.readCodewords(),a=ko.getDataBlocks(r,n);let c=0;for(let w of a)c+=w.getNumDataCodewords();const d=new Uint8Array(c),g=a.length;for(let w=0;w<g;w++){const E=a[w],A=E.getCodewords(),I=E.getNumDataCodewords();this.correctErrors(A,I);for(let O=0;O<I;O++)d[O*g+w]=A[O]}return Xn.decode(d)}correctErrors(e,t){const n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new M}for(let r=0;r<t;r++)e[r]=n[r]}}class bt{constructor(e){this.image=e,this.rectangleDetector=new bn(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 N;t=this.shiftToModuleCenter(t);const n=t[0],r=t[1],a=t[2],c=t[3];let d=this.transitionsBetween(n,c)+1,g=this.transitionsBetween(a,c)+1;(d&1)===1&&(d+=1),(g&1)===1&&(g+=1),4*d<7*g&&4*g<7*d&&(d=g=Math.max(d,g));let w=bt.sampleGrid(this.image,n,r,a,c,d,g);return new Er(w,[n,r,a,c])}static shiftPoint(e,t,n){let r=(t.getX()-e.getX())/(n+1),a=(t.getY()-e.getY())/(n+1);return new ye(e.getX()+r,e.getY()+a)}static moveAway(e,t,n){let r=e.getX(),a=e.getY();return r<t?r-=1:r+=1,a<n?a-=1:a+=1,new ye(r,a)}detectSolid1(e){let t=e[0],n=e[1],r=e[3],a=e[2],c=this.transitionsBetween(t,n),d=this.transitionsBetween(n,r),g=this.transitionsBetween(r,a),w=this.transitionsBetween(a,t),E=c,A=[a,t,n,r];return E>d&&(E=d,A[0]=t,A[1]=n,A[2]=r,A[3]=a),E>g&&(E=g,A[0]=n,A[1]=r,A[2]=a,A[3]=t),E>w&&(A[0]=r,A[1]=a,A[2]=t,A[3]=n),A}detectSolid2(e){let t=e[0],n=e[1],r=e[2],a=e[3],c=this.transitionsBetween(t,a),d=bt.shiftPoint(n,r,(c+1)*4),g=bt.shiftPoint(r,n,(c+1)*4),w=this.transitionsBetween(d,t),E=this.transitionsBetween(g,a);return w<E?(e[0]=t,e[1]=n,e[2]=r,e[3]=a):(e[0]=n,e[1]=r,e[2]=a,e[3]=t),e}correctTopRight(e){let t=e[0],n=e[1],r=e[2],a=e[3],c=this.transitionsBetween(t,a),d=this.transitionsBetween(n,a),g=bt.shiftPoint(t,n,(d+1)*4),w=bt.shiftPoint(r,n,(c+1)*4);c=this.transitionsBetween(g,a),d=this.transitionsBetween(w,a);let E=new ye(a.getX()+(r.getX()-n.getX())/(c+1),a.getY()+(r.getY()-n.getY())/(c+1)),A=new ye(a.getX()+(t.getX()-n.getX())/(d+1),a.getY()+(t.getY()-n.getY())/(d+1));if(!this.isValid(E))return this.isValid(A)?A:null;if(!this.isValid(A))return E;let I=this.transitionsBetween(g,E)+this.transitionsBetween(w,E),O=this.transitionsBetween(g,A)+this.transitionsBetween(w,A);return I>O?E:A}shiftToModuleCenter(e){let t=e[0],n=e[1],r=e[2],a=e[3],c=this.transitionsBetween(t,a)+1,d=this.transitionsBetween(r,a)+1,g=bt.shiftPoint(t,n,d*4),w=bt.shiftPoint(r,n,c*4);c=this.transitionsBetween(g,a)+1,d=this.transitionsBetween(w,a)+1,(c&1)===1&&(c+=1),(d&1)===1&&(d+=1);let E=(t.getX()+n.getX()+r.getX()+a.getX())/4,A=(t.getY()+n.getY()+r.getY()+a.getY())/4;t=bt.moveAway(t,E,A),n=bt.moveAway(n,E,A),r=bt.moveAway(r,E,A),a=bt.moveAway(a,E,A);let I,O;return g=bt.shiftPoint(t,n,d*4),g=bt.shiftPoint(g,a,c*4),I=bt.shiftPoint(n,t,d*4),I=bt.shiftPoint(I,r,c*4),w=bt.shiftPoint(r,a,d*4),w=bt.shiftPoint(w,n,c*4),O=bt.shiftPoint(a,r,d*4),O=bt.shiftPoint(O,t,c*4),[g,I,w,O]}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,a,c,d){return dn.getInstance().sampleGrid(e,c,d,.5,.5,c-.5,.5,c-.5,d-.5,.5,d-.5,t.getX(),t.getY(),a.getX(),a.getY(),r.getX(),r.getY(),n.getX(),n.getY())}transitionsBetween(e,t){let n=Math.trunc(e.getX()),r=Math.trunc(e.getY()),a=Math.trunc(t.getX()),c=Math.trunc(t.getY()),d=Math.abs(c-r)>Math.abs(a-n);if(d){let F=n;n=r,r=F,F=a,a=c,c=F}let g=Math.abs(a-n),w=Math.abs(c-r),E=-g/2,A=r<c?1:-1,I=n<a?1:-1,O=0,L=this.image.get(d?r:n,d?n:r);for(let F=n,Z=r;F!==a;F+=I){let ne=this.image.get(d?Z:F,d?F:Z);if(ne!==L&&(O++,L=ne),E+=w,E>0){if(Z===c)break;Z+=A,E-=g}}return O}}class jn{constructor(){this.decoder=new dg}decode(e,t=null){let n,r;if(t!=null&&t.has(te.PURE_BARCODE)){const w=jn.extractPureBits(e.getBlackMatrix());n=this.decoder.decode(w),r=jn.NO_POINTS}else{const w=new bt(e.getBlackMatrix()).detect();n=this.decoder.decode(w.getBits()),r=w.getPoints()}const a=n.getRawBytes(),c=new _e(n.getText(),a,8*a.length,r,he.DATA_MATRIX,P.currentTimeMillis()),d=n.getByteSegments();d!=null&&c.putMetadata(Xe.BYTE_SEGMENTS,d);const g=n.getECLevel();return g!=null&&c.putMetadata(Xe.ERROR_CORRECTION_LEVEL,g),c}reset(){}static extractPureBits(e){const t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t==null||n==null)throw new N;const r=this.moduleSize(t,e);let a=t[1];const c=n[1];let d=t[0];const w=(n[0]-d+1)/r,E=(c-a+1)/r;if(w<=0||E<=0)throw new N;const A=r/2;a+=A,d+=A;const I=new X(w,E);for(let O=0;O<E;O++){const L=a+O*r;for(let F=0;F<w;F++)e.get(d+F*r,L)&&I.set(F,O)}return I}static moduleSize(e,t){const n=t.getWidth();let r=e[0];const a=e[1];for(;r<n&&t.get(r,a);)r++;if(r===n)throw new N;const c=r-e[0];if(c===0)throw new N;return c}}jn.NO_POINTS=[];class fg extends Ne{constructor(e=500){super(new jn,e)}}var Ir;(function(b){b[b.L=0]="L",b[b.M=1]="M",b[b.Q=2]="Q",b[b.H=3]="H"})(Ir||(Ir={}));class ct{constructor(e,t,n){this.value=e,this.stringValue=t,this.bits=n,ct.FOR_BITS.set(n,this),ct.FOR_VALUE.set(e,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(e){switch(e){case"L":return ct.L;case"M":return ct.M;case"Q":return ct.Q;case"H":return ct.H;default:throw new C(e+"not available")}}toString(){return this.stringValue}equals(e){if(!(e instanceof ct))return!1;const t=e;return this.value===t.value}static forBits(e){if(e<0||e>=ct.FOR_BITS.size)throw new y;return ct.FOR_BITS.get(e)}}ct.FOR_BITS=new Map,ct.FOR_VALUE=new Map,ct.L=new ct(Ir.L,"L",1),ct.M=new ct(Ir.M,"M",0),ct.Q=new ct(Ir.Q,"Q",3),ct.H=new ct(Ir.H,"H",2);class Gt{constructor(e){this.errorCorrectionLevel=ct.forBits(e>>3&3),this.dataMask=e&7}static numBitsDiffering(e,t){return R.bitCount(e^t)}static decodeFormatInformation(e,t){const n=Gt.doDecodeFormatInformation(e,t);return n!==null?n:Gt.doDecodeFormatInformation(e^Gt.FORMAT_INFO_MASK_QR,t^Gt.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(e,t){let n=Number.MAX_SAFE_INTEGER,r=0;for(const a of Gt.FORMAT_INFO_DECODE_LOOKUP){const c=a[0];if(c===e||c===t)return new Gt(a[1]);let d=Gt.numBitsDiffering(e,c);d<n&&(r=a[1],n=d),e!==t&&(d=Gt.numBitsDiffering(t,c),d<n&&(r=a[1],n=d))}return n<=3?new Gt(r):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(e){if(!(e instanceof Gt))return!1;const t=e;return this.errorCorrectionLevel===t.errorCorrectionLevel&&this.dataMask===t.dataMask}}Gt.FORMAT_INFO_MASK_QR=21522,Gt.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 Y{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 T{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class Ie{constructor(e,t,...n){this.versionNumber=e,this.alignmentPatternCenters=t,this.ecBlocks=n;let r=0;const a=n[0].getECCodewordsPerBlock(),c=n[0].getECBlocks();for(const d of c)r+=d.getCount()*(d.getDataCodewords()+a);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 z;try{return this.getVersionForNumber((e-17)/4)}catch{throw new z}}static getVersionForNumber(e){if(e<1||e>40)throw new y;return Ie.VERSIONS[e-1]}static decodeVersionInformation(e){let t=Number.MAX_SAFE_INTEGER,n=0;for(let r=0;r<Ie.VERSION_DECODE_INFO.length;r++){const a=Ie.VERSION_DECODE_INFO[r];if(a===e)return Ie.getVersionForNumber(r+7);const c=Gt.numBitsDiffering(e,a);c<t&&(n=r+7,t=c)}return t<=3?Ie.getVersionForNumber(n):null}buildFunctionPattern(){const e=this.getDimensionForVersion(),t=new X(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 a=this.alignmentPatternCenters[r]-2;for(let c=0;c<n;c++)r===0&&(c===0||c===n-1)||r===n-1&&c===0||t.setRegion(this.alignmentPatternCenters[c]-2,a,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}}Ie.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]),Ie.VERSIONS=[new Ie(1,new Int32Array(0),new Y(7,new T(1,19)),new Y(10,new T(1,16)),new Y(13,new T(1,13)),new Y(17,new T(1,9))),new Ie(2,Int32Array.from([6,18]),new Y(10,new T(1,34)),new Y(16,new T(1,28)),new Y(22,new T(1,22)),new Y(28,new T(1,16))),new Ie(3,Int32Array.from([6,22]),new Y(15,new T(1,55)),new Y(26,new T(1,44)),new Y(18,new T(2,17)),new Y(22,new T(2,13))),new Ie(4,Int32Array.from([6,26]),new Y(20,new T(1,80)),new Y(18,new T(2,32)),new Y(26,new T(2,24)),new Y(16,new T(4,9))),new Ie(5,Int32Array.from([6,30]),new Y(26,new T(1,108)),new Y(24,new T(2,43)),new Y(18,new T(2,15),new T(2,16)),new Y(22,new T(2,11),new T(2,12))),new Ie(6,Int32Array.from([6,34]),new Y(18,new T(2,68)),new Y(16,new T(4,27)),new Y(24,new T(4,19)),new Y(28,new T(4,15))),new Ie(7,Int32Array.from([6,22,38]),new Y(20,new T(2,78)),new Y(18,new T(4,31)),new Y(18,new T(2,14),new T(4,15)),new Y(26,new T(4,13),new T(1,14))),new Ie(8,Int32Array.from([6,24,42]),new Y(24,new T(2,97)),new Y(22,new T(2,38),new T(2,39)),new Y(22,new T(4,18),new T(2,19)),new Y(26,new T(4,14),new T(2,15))),new Ie(9,Int32Array.from([6,26,46]),new Y(30,new T(2,116)),new Y(22,new T(3,36),new T(2,37)),new Y(20,new T(4,16),new T(4,17)),new Y(24,new T(4,12),new T(4,13))),new Ie(10,Int32Array.from([6,28,50]),new Y(18,new T(2,68),new T(2,69)),new Y(26,new T(4,43),new T(1,44)),new Y(24,new T(6,19),new T(2,20)),new Y(28,new T(6,15),new T(2,16))),new Ie(11,Int32Array.from([6,30,54]),new Y(20,new T(4,81)),new Y(30,new T(1,50),new T(4,51)),new Y(28,new T(4,22),new T(4,23)),new Y(24,new T(3,12),new T(8,13))),new Ie(12,Int32Array.from([6,32,58]),new Y(24,new T(2,92),new T(2,93)),new Y(22,new T(6,36),new T(2,37)),new Y(26,new T(4,20),new T(6,21)),new Y(28,new T(7,14),new T(4,15))),new Ie(13,Int32Array.from([6,34,62]),new Y(26,new T(4,107)),new Y(22,new T(8,37),new T(1,38)),new Y(24,new T(8,20),new T(4,21)),new Y(22,new T(12,11),new T(4,12))),new Ie(14,Int32Array.from([6,26,46,66]),new Y(30,new T(3,115),new T(1,116)),new Y(24,new T(4,40),new T(5,41)),new Y(20,new T(11,16),new T(5,17)),new Y(24,new T(11,12),new T(5,13))),new Ie(15,Int32Array.from([6,26,48,70]),new Y(22,new T(5,87),new T(1,88)),new Y(24,new T(5,41),new T(5,42)),new Y(30,new T(5,24),new T(7,25)),new Y(24,new T(11,12),new T(7,13))),new Ie(16,Int32Array.from([6,26,50,74]),new Y(24,new T(5,98),new T(1,99)),new Y(28,new T(7,45),new T(3,46)),new Y(24,new T(15,19),new T(2,20)),new Y(30,new T(3,15),new T(13,16))),new Ie(17,Int32Array.from([6,30,54,78]),new Y(28,new T(1,107),new T(5,108)),new Y(28,new T(10,46),new T(1,47)),new Y(28,new T(1,22),new T(15,23)),new Y(28,new T(2,14),new T(17,15))),new Ie(18,Int32Array.from([6,30,56,82]),new Y(30,new T(5,120),new T(1,121)),new Y(26,new T(9,43),new T(4,44)),new Y(28,new T(17,22),new T(1,23)),new Y(28,new T(2,14),new T(19,15))),new Ie(19,Int32Array.from([6,30,58,86]),new Y(28,new T(3,113),new T(4,114)),new Y(26,new T(3,44),new T(11,45)),new Y(26,new T(17,21),new T(4,22)),new Y(26,new T(9,13),new T(16,14))),new Ie(20,Int32Array.from([6,34,62,90]),new Y(28,new T(3,107),new T(5,108)),new Y(26,new T(3,41),new T(13,42)),new Y(30,new T(15,24),new T(5,25)),new Y(28,new T(15,15),new T(10,16))),new Ie(21,Int32Array.from([6,28,50,72,94]),new Y(28,new T(4,116),new T(4,117)),new Y(26,new T(17,42)),new Y(28,new T(17,22),new T(6,23)),new Y(30,new T(19,16),new T(6,17))),new Ie(22,Int32Array.from([6,26,50,74,98]),new Y(28,new T(2,111),new T(7,112)),new Y(28,new T(17,46)),new Y(30,new T(7,24),new T(16,25)),new Y(24,new T(34,13))),new Ie(23,Int32Array.from([6,30,54,78,102]),new Y(30,new T(4,121),new T(5,122)),new Y(28,new T(4,47),new T(14,48)),new Y(30,new T(11,24),new T(14,25)),new Y(30,new T(16,15),new T(14,16))),new Ie(24,Int32Array.from([6,28,54,80,106]),new Y(30,new T(6,117),new T(4,118)),new Y(28,new T(6,45),new T(14,46)),new Y(30,new T(11,24),new T(16,25)),new Y(30,new T(30,16),new T(2,17))),new Ie(25,Int32Array.from([6,32,58,84,110]),new Y(26,new T(8,106),new T(4,107)),new Y(28,new T(8,47),new T(13,48)),new Y(30,new T(7,24),new T(22,25)),new Y(30,new T(22,15),new T(13,16))),new Ie(26,Int32Array.from([6,30,58,86,114]),new Y(28,new T(10,114),new T(2,115)),new Y(28,new T(19,46),new T(4,47)),new Y(28,new T(28,22),new T(6,23)),new Y(30,new T(33,16),new T(4,17))),new Ie(27,Int32Array.from([6,34,62,90,118]),new Y(30,new T(8,122),new T(4,123)),new Y(28,new T(22,45),new T(3,46)),new Y(30,new T(8,23),new T(26,24)),new Y(30,new T(12,15),new T(28,16))),new Ie(28,Int32Array.from([6,26,50,74,98,122]),new Y(30,new T(3,117),new T(10,118)),new Y(28,new T(3,45),new T(23,46)),new Y(30,new T(4,24),new T(31,25)),new Y(30,new T(11,15),new T(31,16))),new Ie(29,Int32Array.from([6,30,54,78,102,126]),new Y(30,new T(7,116),new T(7,117)),new Y(28,new T(21,45),new T(7,46)),new Y(30,new T(1,23),new T(37,24)),new Y(30,new T(19,15),new T(26,16))),new Ie(30,Int32Array.from([6,26,52,78,104,130]),new Y(30,new T(5,115),new T(10,116)),new Y(28,new T(19,47),new T(10,48)),new Y(30,new T(15,24),new T(25,25)),new Y(30,new T(23,15),new T(25,16))),new Ie(31,Int32Array.from([6,30,56,82,108,134]),new Y(30,new T(13,115),new T(3,116)),new Y(28,new T(2,46),new T(29,47)),new Y(30,new T(42,24),new T(1,25)),new Y(30,new T(23,15),new T(28,16))),new Ie(32,Int32Array.from([6,34,60,86,112,138]),new Y(30,new T(17,115)),new Y(28,new T(10,46),new T(23,47)),new Y(30,new T(10,24),new T(35,25)),new Y(30,new T(19,15),new T(35,16))),new Ie(33,Int32Array.from([6,30,58,86,114,142]),new Y(30,new T(17,115),new T(1,116)),new Y(28,new T(14,46),new T(21,47)),new Y(30,new T(29,24),new T(19,25)),new Y(30,new T(11,15),new T(46,16))),new Ie(34,Int32Array.from([6,34,62,90,118,146]),new Y(30,new T(13,115),new T(6,116)),new Y(28,new T(14,46),new T(23,47)),new Y(30,new T(44,24),new T(7,25)),new Y(30,new T(59,16),new T(1,17))),new Ie(35,Int32Array.from([6,30,54,78,102,126,150]),new Y(30,new T(12,121),new T(7,122)),new Y(28,new T(12,47),new T(26,48)),new Y(30,new T(39,24),new T(14,25)),new Y(30,new T(22,15),new T(41,16))),new Ie(36,Int32Array.from([6,24,50,76,102,128,154]),new Y(30,new T(6,121),new T(14,122)),new Y(28,new T(6,47),new T(34,48)),new Y(30,new T(46,24),new T(10,25)),new Y(30,new T(2,15),new T(64,16))),new Ie(37,Int32Array.from([6,28,54,80,106,132,158]),new Y(30,new T(17,122),new T(4,123)),new Y(28,new T(29,46),new T(14,47)),new Y(30,new T(49,24),new T(10,25)),new Y(30,new T(24,15),new T(46,16))),new Ie(38,Int32Array.from([6,32,58,84,110,136,162]),new Y(30,new T(4,122),new T(18,123)),new Y(28,new T(13,46),new T(32,47)),new Y(30,new T(48,24),new T(14,25)),new Y(30,new T(42,15),new T(32,16))),new Ie(39,Int32Array.from([6,26,54,82,110,138,166]),new Y(30,new T(20,117),new T(4,118)),new Y(28,new T(40,47),new T(7,48)),new Y(30,new T(43,24),new T(22,25)),new Y(30,new T(10,15),new T(67,16))),new Ie(40,Int32Array.from([6,30,58,86,114,142,170]),new Y(30,new T(19,118),new T(6,119)),new Y(28,new T(18,47),new T(31,48)),new Y(30,new T(34,24),new T(34,25)),new Y(30,new T(20,15),new T(61,16)))];var Mt;(function(b){b[b.DATA_MASK_000=0]="DATA_MASK_000",b[b.DATA_MASK_001=1]="DATA_MASK_001",b[b.DATA_MASK_010=2]="DATA_MASK_010",b[b.DATA_MASK_011=3]="DATA_MASK_011",b[b.DATA_MASK_100=4]="DATA_MASK_100",b[b.DATA_MASK_101=5]="DATA_MASK_101",b[b.DATA_MASK_110=6]="DATA_MASK_110",b[b.DATA_MASK_111=7]="DATA_MASK_111"})(Mt||(Mt={}));class hn{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)}}hn.values=new Map([[Mt.DATA_MASK_000,new hn(Mt.DATA_MASK_000,(b,e)=>(b+e&1)===0)],[Mt.DATA_MASK_001,new hn(Mt.DATA_MASK_001,(b,e)=>(b&1)===0)],[Mt.DATA_MASK_010,new hn(Mt.DATA_MASK_010,(b,e)=>e%3===0)],[Mt.DATA_MASK_011,new hn(Mt.DATA_MASK_011,(b,e)=>(b+e)%3===0)],[Mt.DATA_MASK_100,new hn(Mt.DATA_MASK_100,(b,e)=>(Math.floor(b/2)+Math.floor(e/3)&1)===0)],[Mt.DATA_MASK_101,new hn(Mt.DATA_MASK_101,(b,e)=>b*e%6===0)],[Mt.DATA_MASK_110,new hn(Mt.DATA_MASK_110,(b,e)=>b*e%6<3)],[Mt.DATA_MASK_111,new hn(Mt.DATA_MASK_111,(b,e)=>(b+e+b*e%3&1)===0)]]);class hg{constructor(e){const t=e.getHeight();if(t<21||(t&3)!==1)throw new z;this.bitMatrix=e}readFormatInformation(){if(this.parsedFormatInfo!==null&&this.parsedFormatInfo!==void 0)return this.parsedFormatInfo;let e=0;for(let a=0;a<6;a++)e=this.copyBit(a,8,e);e=this.copyBit(7,8,e),e=this.copyBit(8,8,e),e=this.copyBit(8,7,e);for(let a=5;a>=0;a--)e=this.copyBit(8,a,e);const t=this.bitMatrix.getHeight();let n=0;const r=t-7;for(let a=t-1;a>=r;a--)n=this.copyBit(8,a,n);for(let a=t-8;a<t;a++)n=this.copyBit(a,8,n);if(this.parsedFormatInfo=Gt.decodeFormatInformation(e,n),this.parsedFormatInfo!==null)return this.parsedFormatInfo;throw new z}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 Ie.getVersionForNumber(t);let n=0;const r=e-11;for(let c=5;c>=0;c--)for(let d=e-9;d>=r;d--)n=this.copyBit(d,c,n);let a=Ie.decodeVersionInformation(n);if(a!==null&&a.getDimensionForVersion()===e)return this.parsedVersion=a,a;n=0;for(let c=5;c>=0;c--)for(let d=e-9;d>=r;d--)n=this.copyBit(c,d,n);if(a=Ie.decodeVersionInformation(n),a!==null&&a.getDimensionForVersion()===e)return this.parsedVersion=a,a;throw new z}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=hn.values.get(e.getDataMask()),r=this.bitMatrix.getHeight();n.unmaskBitMatrix(this.bitMatrix,r);const a=t.buildFunctionPattern();let c=!0;const d=new Uint8Array(t.getTotalCodewords());let g=0,w=0,E=0;for(let A=r-1;A>0;A-=2){A===6&&A--;for(let I=0;I<r;I++){const O=c?r-1-I:I;for(let L=0;L<2;L++)a.get(A-L,O)||(E++,w<<=1,this.bitMatrix.get(A-L,O)&&(w|=1),E===8&&(d[g++]=w,E=0,w=0))}c=!c}if(g!==t.getTotalCodewords())throw new z;return d}remask(){if(this.parsedFormatInfo===null)return;const e=hn.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,a=e.getHeight();r<a;r++)e.get(t,r)!==e.get(r,t)&&(e.flip(r,t),e.flip(t,r))}}class Oo{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t,n){if(e.length!==t.getTotalCodewords())throw new y;const r=t.getECBlocksForLevel(n);let a=0;const c=r.getECBlocks();for(const L of c)a+=L.getCount();const d=new Array(a);let g=0;for(const L of c)for(let F=0;F<L.getCount();F++){const Z=L.getDataCodewords(),ne=r.getECCodewordsPerBlock()+Z;d[g++]=new Oo(Z,new Uint8Array(ne))}const w=d[0].codewords.length;let E=d.length-1;for(;E>=0&&d[E].codewords.length!==w;)E--;E++;const A=w-r.getECCodewordsPerBlock();let I=0;for(let L=0;L<A;L++)for(let F=0;F<g;F++)d[F].codewords[L]=e[I++];for(let L=E;L<g;L++)d[L].codewords[A]=e[I++];const O=d[0].codewords.length;for(let L=A;L<O;L++)for(let F=0;F<g;F++){const Z=F<E?L:L+1;d[F].codewords[Z]=e[I++]}return d}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}var gn;(function(b){b[b.TERMINATOR=0]="TERMINATOR",b[b.NUMERIC=1]="NUMERIC",b[b.ALPHANUMERIC=2]="ALPHANUMERIC",b[b.STRUCTURED_APPEND=3]="STRUCTURED_APPEND",b[b.BYTE=4]="BYTE",b[b.ECI=5]="ECI",b[b.KANJI=6]="KANJI",b[b.FNC1_FIRST_POSITION=7]="FNC1_FIRST_POSITION",b[b.FNC1_SECOND_POSITION=8]="FNC1_SECOND_POSITION",b[b.HANZI=9]="HANZI"})(gn||(gn={}));class Se{constructor(e,t,n,r){this.value=e,this.stringValue=t,this.characterCountBitsForVersions=n,this.bits=r,Se.FOR_BITS.set(r,this),Se.FOR_VALUE.set(e,this)}static forBits(e){const t=Se.FOR_BITS.get(e);if(t===void 0)throw new y;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 Se))return!1;const t=e;return this.value===t.value}toString(){return this.stringValue}}Se.FOR_BITS=new Map,Se.FOR_VALUE=new Map,Se.TERMINATOR=new Se(gn.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),Se.NUMERIC=new Se(gn.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),Se.ALPHANUMERIC=new Se(gn.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),Se.STRUCTURED_APPEND=new Se(gn.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),Se.BYTE=new Se(gn.BYTE,"BYTE",Int32Array.from([8,16,16]),4),Se.ECI=new Se(gn.ECI,"ECI",Int32Array.from([0,0,0]),7),Se.KANJI=new Se(gn.KANJI,"KANJI",Int32Array.from([8,10,12]),8),Se.FNC1_FIRST_POSITION=new Se(gn.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),Se.FNC1_SECOND_POSITION=new Se(gn.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),Se.HANZI=new Se(gn.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class wt{static decode(e,t,n,r){const a=new Ro(e);let c=new V;const d=new Array;let g=-1,w=-1;try{let E=null,A=!1,I;do{if(a.available()<4)I=Se.TERMINATOR;else{const O=a.readBits(4);I=Se.forBits(O)}switch(I){case Se.TERMINATOR:break;case Se.FNC1_FIRST_POSITION:case Se.FNC1_SECOND_POSITION:A=!0;break;case Se.STRUCTURED_APPEND:if(a.available()<16)throw new z;g=a.readBits(8),w=a.readBits(8);break;case Se.ECI:const O=wt.parseECIValue(a);if(E=W.getCharacterSetECIByValue(O),E===null)throw new z;break;case Se.HANZI:const L=a.readBits(4),F=a.readBits(I.getCharacterCountBits(t));L===wt.GB2312_SUBSET&&wt.decodeHanziSegment(a,c,F);break;default:const Z=a.readBits(I.getCharacterCountBits(t));switch(I){case Se.NUMERIC:wt.decodeNumericSegment(a,c,Z);break;case Se.ALPHANUMERIC:wt.decodeAlphanumericSegment(a,c,Z,A);break;case Se.BYTE:wt.decodeByteSegment(a,c,Z,E,d,r);break;case Se.KANJI:wt.decodeKanjiSegment(a,c,Z);break;default:throw new z}break}}while(I!==Se.TERMINATOR)}catch{throw new z}return new Oe(e,c.toString(),d.length===0?null:d,n===null?null:n.toString(),g,w)}static decodeHanziSegment(e,t,n){if(n*13>e.available())throw new z;const r=new Uint8Array(2*n);let a=0;for(;n>0;){const c=e.readBits(13);let d=c/96<<8&4294967295|c%96;d<959?d+=41377:d+=42657,r[a]=d>>8&255,r[a+1]=d&255,a+=2,n--}try{t.append(j.decode(r,G.GB2312))}catch(c){throw new z(c)}}static decodeKanjiSegment(e,t,n){if(n*13>e.available())throw new z;const r=new Uint8Array(2*n);let a=0;for(;n>0;){const c=e.readBits(13);let d=c/192<<8&4294967295|c%192;d<7936?d+=33088:d+=49472,r[a]=d>>8,r[a+1]=d,a+=2,n--}try{t.append(j.decode(r,G.SHIFT_JIS))}catch(c){throw new z(c)}}static decodeByteSegment(e,t,n,r,a,c){if(8*n>e.available())throw new z;const d=new Uint8Array(n);for(let w=0;w<n;w++)d[w]=e.readBits(8);let g;r===null?g=G.guessEncoding(d,c):g=r.getName();try{t.append(j.decode(d,g))}catch(w){throw new z(w)}a.push(d)}static toAlphaNumericChar(e){if(e>=wt.ALPHANUMERIC_CHARS.length)throw new z;return wt.ALPHANUMERIC_CHARS[e]}static decodeAlphanumericSegment(e,t,n,r){const a=t.length();for(;n>1;){if(e.available()<11)throw new z;const c=e.readBits(11);t.append(wt.toAlphaNumericChar(Math.floor(c/45))),t.append(wt.toAlphaNumericChar(c%45)),n-=2}if(n===1){if(e.available()<6)throw new z;t.append(wt.toAlphaNumericChar(e.readBits(6)))}if(r)for(let c=a;c<t.length();c++)t.charAt(c)==="%"&&(c<t.length()-1&&t.charAt(c+1)==="%"?t.deleteCharAt(c+1):t.setCharAt(c,""))}static decodeNumericSegment(e,t,n){for(;n>=3;){if(e.available()<10)throw new z;const r=e.readBits(10);if(r>=1e3)throw new z;t.append(wt.toAlphaNumericChar(Math.floor(r/100))),t.append(wt.toAlphaNumericChar(Math.floor(r/10)%10)),t.append(wt.toAlphaNumericChar(r%10)),n-=3}if(n===2){if(e.available()<7)throw new z;const r=e.readBits(7);if(r>=100)throw new z;t.append(wt.toAlphaNumericChar(Math.floor(r/10))),t.append(wt.toAlphaNumericChar(r%10))}else if(n===1){if(e.available()<4)throw new z;const r=e.readBits(4);if(r>=10)throw new z;t.append(wt.toAlphaNumericChar(r))}}static parseECIValue(e){const t=e.readBits(8);if(!(t&128))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 z}}wt.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",wt.GB2312_SUBSET=1;class za{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 gg{constructor(){this.rsDecoder=new jt(Ee.QR_CODE_FIELD_256)}decodeBooleanArray(e,t){return this.decodeBitMatrix(X.parseFromBooleanArray(e),t)}decodeBitMatrix(e,t){const n=new hg(e);let r=null;try{return this.decodeBitMatrixParser(n,t)}catch(a){r=a}try{n.remask(),n.setMirror(!0),n.readVersion(),n.readFormatInformation(),n.mirror();const a=this.decodeBitMatrixParser(n,t);return a.setOther(new za(!0)),a}catch(a){throw r!==null?r:a}}decodeBitMatrixParser(e,t){const n=e.readVersion(),r=e.readFormatInformation().getErrorCorrectionLevel(),a=e.readCodewords(),c=Oo.getDataBlocks(a,n,r);let d=0;for(const E of c)d+=E.getNumDataCodewords();const g=new Uint8Array(d);let w=0;for(const E of c){const A=E.getCodewords(),I=E.getNumDataCodewords();this.correctErrors(A,I);for(let O=0;O<I;O++)g[w++]=A[O]}return wt.decode(g,n,r,t)}correctErrors(e,t){const n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new M}for(let r=0;r<t;r++)e[r]=n[r]}}class Bo extends ye{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,a=(this.getY()+e)/2,c=(this.estimatedModuleSize+n)/2;return new Bo(r,a,c)}}class Ti{constructor(e,t,n,r,a,c,d){this.image=e,this.startX=t,this.startY=n,this.width=r,this.height=a,this.moduleSize=c,this.resultPointCallback=d,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}find(){const e=this.startX,t=this.height,n=this.width,r=e+n,a=this.startY+t/2,c=new Int32Array(3),d=this.image;for(let g=0;g<t;g++){const w=a+(g&1?-Math.floor((g+1)/2):Math.floor((g+1)/2));c[0]=0,c[1]=0,c[2]=0;let E=e;for(;E<r&&!d.get(E,w);)E++;let A=0;for(;E<r;){if(d.get(E,w))if(A===1)c[1]++;else if(A===2){if(this.foundPatternCross(c)){const I=this.handlePossibleCenter(c,w,E);if(I!==null)return I}c[0]=c[2],c[1]=1,c[2]=0,A=1}else c[++A]++;else A===1&&A++,c[A]++;E++}if(this.foundPatternCross(c)){const I=this.handlePossibleCenter(c,w,r);if(I!==null)return I}}if(this.possibleCenters.length!==0)return this.possibleCenters[0];throw new N}static centerFromEnd(e,t){return t-e[2]-e[1]/2}foundPatternCross(e){const t=this.moduleSize,n=t/2;for(let r=0;r<3;r++)if(Math.abs(t-e[r])>=n)return!1;return!0}crossCheckVertical(e,t,n,r){const a=this.image,c=a.getHeight(),d=this.crossCheckStateCount;d[0]=0,d[1]=0,d[2]=0;let g=e;for(;g>=0&&a.get(t,g)&&d[1]<=n;)d[1]++,g--;if(g<0||d[1]>n)return NaN;for(;g>=0&&!a.get(t,g)&&d[0]<=n;)d[0]++,g--;if(d[0]>n)return NaN;for(g=e+1;g<c&&a.get(t,g)&&d[1]<=n;)d[1]++,g++;if(g===c||d[1]>n)return NaN;for(;g<c&&!a.get(t,g)&&d[2]<=n;)d[2]++,g++;if(d[2]>n)return NaN;const w=d[0]+d[1]+d[2];return 5*Math.abs(w-r)>=2*r?NaN:this.foundPatternCross(d)?Ti.centerFromEnd(d,g):NaN}handlePossibleCenter(e,t,n){const r=e[0]+e[1]+e[2],a=Ti.centerFromEnd(e,n),c=this.crossCheckVertical(t,a,2*e[1],r);if(!isNaN(c)){const d=(e[0]+e[1]+e[2])/3;for(const w of this.possibleCenters)if(w.aboutEquals(d,c,a))return w.combineEstimate(c,a,d);const g=new Bo(a,c,d);this.possibleCenters.push(g),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(g)}return null}}class Mo extends ye{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,a=(this.count*this.getX()+t)/r,c=(this.count*this.getY()+e)/r,d=(this.count*this.estimatedModuleSize+n)/r;return new Mo(a,c,d,r)}}class mg{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 vt{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(te.TRY_HARDER)!==void 0,n=e!=null&&e.get(te.PURE_BARCODE)!==void 0,r=this.image,a=r.getHeight(),c=r.getWidth();let d=Math.floor(3*a/(4*vt.MAX_MODULES));(d<vt.MIN_SKIP||t)&&(d=vt.MIN_SKIP);let g=!1;const w=new Int32Array(5);for(let A=d-1;A<a&&!g;A+=d){w[0]=0,w[1]=0,w[2]=0,w[3]=0,w[4]=0;let I=0;for(let O=0;O<c;O++)if(r.get(O,A))(I&1)===1&&I++,w[I]++;else if(I&1)w[I]++;else if(I===4)if(vt.foundPatternCross(w)){if(this.handlePossibleCenter(w,A,O,n)===!0)if(d=2,this.hasSkipped===!0)g=this.haveMultiplyConfirmedCenters();else{const F=this.findRowSkip();F>w[2]&&(A+=F-w[2]-d,O=c-1)}else{w[0]=w[2],w[1]=w[3],w[2]=w[4],w[3]=1,w[4]=0,I=3;continue}I=0,w[0]=0,w[1]=0,w[2]=0,w[3]=0,w[4]=0}else w[0]=w[2],w[1]=w[3],w[2]=w[4],w[3]=1,w[4]=0,I=3;else w[++I]++;vt.foundPatternCross(w)&&this.handlePossibleCenter(w,A,c,n)===!0&&(d=w[0],this.hasSkipped&&(g=this.haveMultiplyConfirmedCenters()))}const E=this.selectBestPatterns();return ye.orderBestPatterns(E),new mg(E)}static centerFromEnd(e,t){return t-e[4]-e[3]-e[2]/2}static foundPatternCross(e){let t=0;for(let a=0;a<5;a++){const c=e[a];if(c===0)return!1;t+=c}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 a=this.getCrossCheckStateCount();let c=0;const d=this.image;for(;e>=c&&t>=c&&d.get(t-c,e-c);)a[2]++,c++;if(e<c||t<c)return!1;for(;e>=c&&t>=c&&!d.get(t-c,e-c)&&a[1]<=n;)a[1]++,c++;if(e<c||t<c||a[1]>n)return!1;for(;e>=c&&t>=c&&d.get(t-c,e-c)&&a[0]<=n;)a[0]++,c++;if(a[0]>n)return!1;const g=d.getHeight(),w=d.getWidth();for(c=1;e+c<g&&t+c<w&&d.get(t+c,e+c);)a[2]++,c++;if(e+c>=g||t+c>=w)return!1;for(;e+c<g&&t+c<w&&!d.get(t+c,e+c)&&a[3]<n;)a[3]++,c++;if(e+c>=g||t+c>=w||a[3]>=n)return!1;for(;e+c<g&&t+c<w&&d.get(t+c,e+c)&&a[4]<n;)a[4]++,c++;if(a[4]>=n)return!1;const E=a[0]+a[1]+a[2]+a[3]+a[4];return Math.abs(E-r)<2*r&&vt.foundPatternCross(a)}crossCheckVertical(e,t,n,r){const a=this.image,c=a.getHeight(),d=this.getCrossCheckStateCount();let g=e;for(;g>=0&&a.get(t,g);)d[2]++,g--;if(g<0)return NaN;for(;g>=0&&!a.get(t,g)&&d[1]<=n;)d[1]++,g--;if(g<0||d[1]>n)return NaN;for(;g>=0&&a.get(t,g)&&d[0]<=n;)d[0]++,g--;if(d[0]>n)return NaN;for(g=e+1;g<c&&a.get(t,g);)d[2]++,g++;if(g===c)return NaN;for(;g<c&&!a.get(t,g)&&d[3]<n;)d[3]++,g++;if(g===c||d[3]>=n)return NaN;for(;g<c&&a.get(t,g)&&d[4]<n;)d[4]++,g++;if(d[4]>=n)return NaN;const w=d[0]+d[1]+d[2]+d[3]+d[4];return 5*Math.abs(w-r)>=2*r?NaN:vt.foundPatternCross(d)?vt.centerFromEnd(d,g):NaN}crossCheckHorizontal(e,t,n,r){const a=this.image,c=a.getWidth(),d=this.getCrossCheckStateCount();let g=e;for(;g>=0&&a.get(g,t);)d[2]++,g--;if(g<0)return NaN;for(;g>=0&&!a.get(g,t)&&d[1]<=n;)d[1]++,g--;if(g<0||d[1]>n)return NaN;for(;g>=0&&a.get(g,t)&&d[0]<=n;)d[0]++,g--;if(d[0]>n)return NaN;for(g=e+1;g<c&&a.get(g,t);)d[2]++,g++;if(g===c)return NaN;for(;g<c&&!a.get(g,t)&&d[3]<n;)d[3]++,g++;if(g===c||d[3]>=n)return NaN;for(;g<c&&a.get(g,t)&&d[4]<n;)d[4]++,g++;if(d[4]>=n)return NaN;const w=d[0]+d[1]+d[2]+d[3]+d[4];return 5*Math.abs(w-r)>=r?NaN:vt.foundPatternCross(d)?vt.centerFromEnd(d,g):NaN}handlePossibleCenter(e,t,n,r){const a=e[0]+e[1]+e[2]+e[3]+e[4];let c=vt.centerFromEnd(e,n),d=this.crossCheckVertical(t,Math.floor(c),e[2],a);if(!isNaN(d)&&(c=this.crossCheckHorizontal(Math.floor(c),Math.floor(d),e[2],a),!isNaN(c)&&(!r||this.crossCheckDiagonal(Math.floor(d),Math.floor(c),e[2],a)))){const g=a/7;let w=!1;const E=this.possibleCenters;for(let A=0,I=E.length;A<I;A++){const O=E[A];if(O.aboutEquals(g,d,c)){E[A]=O.combineEstimate(d,c,g),w=!0;break}}if(!w){const A=new Mo(c,d,g);E.push(A),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(A)}return!0}return!1}findRowSkip(){if(this.possibleCenters.length<=1)return 0;let t=null;for(const n of this.possibleCenters)if(n.getCount()>=vt.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 c of this.possibleCenters)c.getCount()>=vt.CENTER_QUORUM&&(e++,t+=c.getEstimatedModuleSize());if(e<3)return!1;const r=t/n;let a=0;for(const c of this.possibleCenters)a+=Math.abs(c.getEstimatedModuleSize()-r);return a<=.05*t}selectBestPatterns(){const e=this.possibleCenters.length;if(e<3)throw new N;const t=this.possibleCenters;let n;if(e>3){let r=0,a=0;for(const g of this.possibleCenters){const w=g.getEstimatedModuleSize();r+=w,a+=w*w}n=r/e;let c=Math.sqrt(a/e-n*n);t.sort((g,w)=>{const E=Math.abs(w.getEstimatedModuleSize()-n),A=Math.abs(g.getEstimatedModuleSize()-n);return E<A?-1:E>A?1:0});const d=Math.max(.2*n,c);for(let g=0;g<t.length&&t.length>3;g++){const w=t[g];Math.abs(w.getEstimatedModuleSize()-n)>d&&(t.splice(g,1),g--)}}if(t.length>3){let r=0;for(const a of t)r+=a.getEstimatedModuleSize();n=r/t.length,t.sort((a,c)=>{if(c.getCount()===a.getCount()){const d=Math.abs(c.getEstimatedModuleSize()-n),g=Math.abs(a.getEstimatedModuleSize()-n);return d<g?1:d>g?-1:0}else return c.getCount()-a.getCount()}),t.splice(3)}return[t[0],t[1],t[2]]}}vt.CENTER_QUORUM=2,vt.MIN_SKIP=3,vt.MAX_MODULES=57;class Wr{constructor(e){this.image=e}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(e){this.resultPointCallback=e==null?null:e.get(te.NEED_RESULT_POINT_CALLBACK);const n=new vt(this.image,this.resultPointCallback).find(e);return this.processFinderPatternInfo(n)}processFinderPatternInfo(e){const t=e.getTopLeft(),n=e.getTopRight(),r=e.getBottomLeft(),a=this.calculateModuleSize(t,n,r);if(a<1)throw new N("No pattern found in proccess finder.");const c=Wr.computeDimension(t,n,r,a),d=Ie.getProvisionalVersionForDimension(c),g=d.getDimensionForVersion()-7;let w=null;if(d.getAlignmentPatternCenters().length>0){const O=n.getX()-t.getX()+r.getX(),L=n.getY()-t.getY()+r.getY(),F=1-3/g,Z=Math.floor(t.getX()+F*(O-t.getX())),ne=Math.floor(t.getY()+F*(L-t.getY()));for(let ce=4;ce<=16;ce<<=1)try{w=this.findAlignmentInRegion(a,Z,ne,ce);break}catch(ue){if(!(ue instanceof N))throw ue}}const E=Wr.createTransform(t,n,r,w,c),A=Wr.sampleGrid(this.image,E,c);let I;return w===null?I=[r,t,n]:I=[r,t,n,w],new Er(A,I)}static createTransform(e,t,n,r,a){const c=a-3.5;let d,g,w,E;return r!==null?(d=r.getX(),g=r.getY(),w=c-3,E=w):(d=t.getX()-e.getX()+n.getX(),g=t.getY()-e.getY()+n.getY(),w=c,E=c),Dt.quadrilateralToQuadrilateral(3.5,3.5,c,3.5,w,E,3.5,c,e.getX(),e.getY(),t.getX(),t.getY(),d,g,n.getX(),n.getY())}static sampleGrid(e,t,n){return dn.getInstance().sampleGridWithTransform(e,n,n,t)}static computeDimension(e,t,n,r){const a=He.round(ye.distance(e,t)/r),c=He.round(ye.distance(e,n)/r);let d=Math.floor((a+c)/2)+7;switch(d&3){case 0:d++;break;case 2:d--;break;case 3:throw new N("Dimensions could be not found.")}return d}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 a=this.sizeOfBlackWhiteBlackRun(e,t,n,r),c=1,d=e-(n-e);d<0?(c=e/(e-d),d=0):d>=this.image.getWidth()&&(c=(this.image.getWidth()-1-e)/(d-e),d=this.image.getWidth()-1);let g=Math.floor(t-(r-t)*c);return c=1,g<0?(c=t/(t-g),g=0):g>=this.image.getHeight()&&(c=(this.image.getHeight()-1-t)/(g-t),g=this.image.getHeight()-1),d=Math.floor(e+(d-e)*c),a+=this.sizeOfBlackWhiteBlackRun(e,t,d,g),a-1}sizeOfBlackWhiteBlackRun(e,t,n,r){const a=Math.abs(r-t)>Math.abs(n-e);if(a){let O=e;e=t,t=O,O=n,n=r,r=O}const c=Math.abs(n-e),d=Math.abs(r-t);let g=-c/2;const w=e<n?1:-1,E=t<r?1:-1;let A=0;const I=n+w;for(let O=e,L=t;O!==I;O+=w){const F=a?L:O,Z=a?O:L;if(A===1===this.image.get(F,Z)){if(A===2)return He.distance(O,L,e,t);A++}if(g+=d,g>0){if(L===r)break;L+=E,g-=c}}return A===2?He.distance(n+w,r,e,t):NaN}findAlignmentInRegion(e,t,n,r){const a=Math.floor(r*e),c=Math.max(0,t-a),d=Math.min(this.image.getWidth()-1,t+a);if(d-c<e*3)throw new N("Alignment top exceeds estimated module size.");const g=Math.max(0,n-a),w=Math.min(this.image.getHeight()-1,n+a);if(w-g<e*3)throw new N("Alignment bottom exceeds estimated module size.");return new Ti(this.image,c,g,d-c,w-g,e,this.resultPointCallback).find()}}class qn{constructor(){this.decoder=new gg}getDecoder(){return this.decoder}decode(e,t){let n,r;if(t!=null&&t.get(te.PURE_BARCODE)!==void 0){const g=qn.extractPureBits(e.getBlackMatrix());n=this.decoder.decodeBitMatrix(g,t),r=qn.NO_POINTS}else{const g=new Wr(e.getBlackMatrix()).detect(t);n=this.decoder.decodeBitMatrix(g.getBits(),t),r=g.getPoints()}n.getOther()instanceof za&&n.getOther().applyMirroredCorrection(r);const a=new _e(n.getText(),n.getRawBytes(),void 0,r,he.QR_CODE,void 0),c=n.getByteSegments();c!==null&&a.putMetadata(Xe.BYTE_SEGMENTS,c);const d=n.getECLevel();return d!==null&&a.putMetadata(Xe.ERROR_CORRECTION_LEVEL,d),n.hasStructuredAppend()&&(a.putMetadata(Xe.STRUCTURED_APPEND_SEQUENCE,n.getStructuredAppendSequenceNumber()),a.putMetadata(Xe.STRUCTURED_APPEND_PARITY,n.getStructuredAppendParity())),a}reset(){}static extractPureBits(e){const t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t===null||n===null)throw new N;const r=this.moduleSize(t,e);let a=t[1],c=n[1],d=t[0],g=n[0];if(d>=g||a>=c)throw new N;if(c-a!==g-d&&(g=d+(c-a),g>=e.getWidth()))throw new N;const w=Math.round((g-d+1)/r),E=Math.round((c-a+1)/r);if(w<=0||E<=0)throw new N;if(E!==w)throw new N;const A=Math.floor(r/2);a+=A,d+=A;const I=d+Math.floor((w-1)*r)-g;if(I>0){if(I>A)throw new N;d-=I}const O=a+Math.floor((E-1)*r)-c;if(O>0){if(O>A)throw new N;a-=O}const L=new X(w,E);for(let F=0;F<E;F++){const Z=a+Math.floor(F*r);for(let ne=0;ne<w;ne++)e.get(d+Math.floor(ne*r),Z)&&L.set(ne,F)}return L}static moduleSize(e,t){const n=t.getHeight(),r=t.getWidth();let a=e[0],c=e[1],d=!0,g=0;for(;a<r&&c<n;){if(d!==t.get(a,c)){if(++g===5)break;d=!d}a++,c++}if(a===r||c===n)throw new N;return(a-e[0])/7}}qn.NO_POINTS=new Array;class ke{PDF417Common(){}static getBitCountSum(e){return He.sum(e)}static toIntArray(e){if(e==null||!e.length)return ke.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=B.binarySearch(ke.SYMBOL_TABLE,e&262143);return t<0?-1:(ke.CODEWORD_TABLE[t]-1)%ke.NUMBER_OF_CODEWORDS}}ke.NUMBER_OF_CODEWORDS=929,ke.MAX_CODEWORDS_IN_BARCODE=ke.NUMBER_OF_CODEWORDS-1,ke.MIN_ROWS_IN_BARCODE=3,ke.MAX_ROWS_IN_BARCODE=90,ke.MODULES_IN_CODEWORD=17,ke.MODULES_IN_STOP_PATTERN=18,ke.BARS_IN_MODULE=8,ke.EMPTY_INT_ARRAY=new Int32Array([]),ke.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]),ke.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 pg{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class Pe{static detectMultiple(e,t,n){let r=e.getBlackMatrix(),a=Pe.detect(n,r);return a.length||(r=r.clone(),r.rotate180(),a=Pe.detect(n,r)),new pg(r,a)}static detect(e,t){const n=new Array;let r=0,a=0,c=!1;for(;r<t.getHeight();){const d=Pe.findVertices(t,r,a);if(d[0]==null&&d[3]==null){if(!c)break;c=!1,a=0;for(const g of n)g[1]!=null&&(r=Math.trunc(Math.max(r,g[1].getY()))),g[3]!=null&&(r=Math.max(r,Math.trunc(g[3].getY())));r+=Pe.ROW_STEP;continue}if(c=!0,n.push(d),!e)break;d[2]!=null?(a=Math.trunc(d[2].getX()),r=Math.trunc(d[2].getY())):(a=Math.trunc(d[4].getX()),r=Math.trunc(d[4].getY()))}return n}static findVertices(e,t,n){const r=e.getHeight(),a=e.getWidth(),c=new Array(8);return Pe.copyToResult(c,Pe.findRowsWithPattern(e,r,a,t,n,Pe.START_PATTERN),Pe.INDEXES_START_PATTERN),c[4]!=null&&(n=Math.trunc(c[4].getX()),t=Math.trunc(c[4].getY())),Pe.copyToResult(c,Pe.findRowsWithPattern(e,r,a,t,n,Pe.STOP_PATTERN),Pe.INDEXES_STOP_PATTERN),c}static copyToResult(e,t,n){for(let r=0;r<n.length;r++)e[n[r]]=t[r]}static findRowsWithPattern(e,t,n,r,a,c){const d=new Array(4);let g=!1;const w=new Int32Array(c.length);for(;r<t;r+=Pe.ROW_STEP){let A=Pe.findGuardPattern(e,a,r,n,!1,c,w);if(A!=null){for(;r>0;){const I=Pe.findGuardPattern(e,a,--r,n,!1,c,w);if(I!=null)A=I;else{r++;break}}d[0]=new ye(A[0],r),d[1]=new ye(A[1],r),g=!0;break}}let E=r+1;if(g){let A=0,I=Int32Array.from([Math.trunc(d[0].getX()),Math.trunc(d[1].getX())]);for(;E<t;E++){const O=Pe.findGuardPattern(e,I[0],E,n,!1,c,w);if(O!=null&&Math.abs(I[0]-O[0])<Pe.MAX_PATTERN_DRIFT&&Math.abs(I[1]-O[1])<Pe.MAX_PATTERN_DRIFT)I=O,A=0;else{if(A>Pe.SKIPPED_ROW_COUNT_MAX)break;A++}}E-=A+1,d[2]=new ye(I[0],E),d[3]=new ye(I[1],E)}return E-r<Pe.BARCODE_MIN_HEIGHT&&B.fill(d,null),d}static findGuardPattern(e,t,n,r,a,c,d){B.fillWithin(d,0,d.length,0);let g=t,w=0;for(;e.get(g,n)&&g>0&&w++<Pe.MAX_PIXEL_DRIFT;)g--;let E=g,A=0,I=c.length;for(let O=a;E<r;E++)if(e.get(E,n)!==O)d[A]++;else{if(A===I-1){if(Pe.patternMatchVariance(d,c,Pe.MAX_INDIVIDUAL_VARIANCE)<Pe.MAX_AVG_VARIANCE)return new Int32Array([g,E]);g+=d[0]+d[1],P.arraycopy(d,2,d,0,A-1),d[A-1]=0,d[A]=0,A--}else A++;d[A]=1,O=!O}return A===I-1&&Pe.patternMatchVariance(d,c,Pe.MAX_INDIVIDUAL_VARIANCE)<Pe.MAX_AVG_VARIANCE?new Int32Array([g,E-1]):null}static patternMatchVariance(e,t,n){let r=e.length,a=0,c=0;for(let w=0;w<r;w++)a+=e[w],c+=t[w];if(a<c)return 1/0;let d=a/c;n*=d;let g=0;for(let w=0;w<r;w++){let E=e[w],A=t[w]*d,I=E>A?E-A:A-E;if(I>n)return 1/0;g+=I}return g/a}}Pe.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),Pe.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),Pe.MAX_AVG_VARIANCE=.42,Pe.MAX_INDIVIDUAL_VARIANCE=.8,Pe.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),Pe.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),Pe.MAX_PIXEL_DRIFT=3,Pe.MAX_PATTERN_DRIFT=5,Pe.SKIPPED_ROW_COUNT_MAX=25,Pe.ROW_STEP=5,Pe.BARCODE_MIN_HEIGHT=10;class Ft{constructor(e,t){if(t.length===0)throw new y;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),P.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 a of this.coefficients)r=this.field.add(r,a);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 y("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 c=t;t=n,n=c}let r=new Int32Array(n.length),a=n.length-t.length;P.arraycopy(n,0,r,0,a);for(let c=a;c<n.length;c++)r[c]=this.field.add(t[c-a],n[c]);return new Ft(this.field,r)}subtract(e){if(!this.field.equals(e.field))throw new y("ModulusPolys do not have same ModulusGF field");return e.isZero()?this:this.add(e.negative())}multiply(e){return e instanceof Ft?this.multiplyOther(e):this.multiplyScalar(e)}multiplyOther(e){if(!this.field.equals(e.field))throw new y("ModulusPolys do not have same ModulusGF field");if(this.isZero()||e.isZero())return new Ft(this.field,new Int32Array([0]));let t=this.coefficients,n=t.length,r=e.coefficients,a=r.length,c=new Int32Array(n+a-1);for(let d=0;d<n;d++){let g=t[d];for(let w=0;w<a;w++)c[d+w]=this.field.add(c[d+w],this.field.multiply(g,r[w]))}return new Ft(this.field,c)}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 Ft(this.field,t)}multiplyScalar(e){if(e===0)return new Ft(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 Ft(this.field,n)}multiplyByMonomial(e,t){if(e<0)throw new y;if(t===0)return new Ft(this.field,new Int32Array([0]));let n=this.coefficients.length,r=new Int32Array(n+e);for(let a=0;a<n;a++)r[a]=this.field.multiply(this.coefficients[a],t);return new Ft(this.field,r)}toString(){let e=new V;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 xg{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 y;return this.logTable[e]}inverse(e){if(e===0)throw new Ze;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 vo extends xg{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 Ft(this,new Int32Array([0])),this.one=new Ft(this,new Int32Array([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new y;if(t===0)return this.zero;let n=new Int32Array(e+1);return n[0]=t,new Ft(this,n)}}vo.PDF417_GF=new vo(ke.NUMBER_OF_CODEWORDS,3);class Ha{constructor(){this.field=vo.PDF417_GF}decode(e,t,n){let r=new Ft(this.field,e),a=new Int32Array(t),c=!1;for(let L=t;L>0;L--){let F=r.evaluateAt(this.field.exp(L));a[t-L]=F,F!==0&&(c=!0)}if(!c)return 0;let d=this.field.getOne();if(n!=null)for(const L of n){let F=this.field.exp(e.length-1-L),Z=new Ft(this.field,new Int32Array([this.field.subtract(0,F),1]));d=d.multiply(Z)}let g=new Ft(this.field,a),w=this.runEuclideanAlgorithm(this.field.buildMonomial(t,1),g,t),E=w[0],A=w[1],I=this.findErrorLocations(E),O=this.findErrorMagnitudes(A,E,I);for(let L=0;L<I.length;L++){let F=e.length-1-this.field.log(I[L]);if(F<0)throw M.getChecksumInstance();e[F]=this.field.subtract(e[F],O[L])}return I.length}runEuclideanAlgorithm(e,t,n){if(e.getDegree()<t.getDegree()){let I=e;e=t,t=I}let r=e,a=t,c=this.field.getZero(),d=this.field.getOne();for(;a.getDegree()>=Math.round(n/2);){let I=r,O=c;if(r=a,c=d,r.isZero())throw M.getChecksumInstance();a=I;let L=this.field.getZero(),F=r.getCoefficient(r.getDegree()),Z=this.field.inverse(F);for(;a.getDegree()>=r.getDegree()&&!a.isZero();){let ne=a.getDegree()-r.getDegree(),ce=this.field.multiply(a.getCoefficient(a.getDegree()),Z);L=L.add(this.field.buildMonomial(ne,ce)),a=a.subtract(r.multiplyByMonomial(ne,ce))}d=L.multiply(c).subtract(O).negative()}let g=d.getCoefficient(0);if(g===0)throw M.getChecksumInstance();let w=this.field.inverse(g),E=d.multiply(w),A=a.multiply(w);return[E,A]}findErrorLocations(e){let t=e.getDegree(),n=new Int32Array(t),r=0;for(let a=1;a<this.field.getSize()&&r<t;a++)e.evaluateAt(a)===0&&(n[r]=this.field.inverse(a),r++);if(r!==t)throw M.getChecksumInstance();return n}findErrorMagnitudes(e,t,n){let r=t.getDegree(),a=new Int32Array(r);for(let w=1;w<=r;w++)a[r-w]=this.field.multiply(w,t.getCoefficient(w));let c=new Ft(this.field,a),d=n.length,g=new Int32Array(d);for(let w=0;w<d;w++){let E=this.field.inverse(n[w]),A=this.field.subtract(0,e.evaluateAt(E)),I=this.field.inverse(c.evaluateAt(E));g[w]=this.field.multiply(A,I)}return g}}class sr{constructor(e,t,n,r,a){e instanceof sr?this.constructor_2(e):this.constructor_1(e,t,n,r,a)}constructor_1(e,t,n,r,a){const c=t==null||n==null,d=r==null||a==null;if(c&&d)throw new N;c?(t=new ye(0,r.getY()),n=new ye(0,a.getY())):d&&(r=new ye(e.getWidth()-1,t.getY()),a=new ye(e.getWidth()-1,n.getY())),this.image=e,this.topLeft=t,this.bottomLeft=n,this.topRight=r,this.bottomRight=a,this.minX=Math.trunc(Math.min(t.getX(),n.getX())),this.maxX=Math.trunc(Math.max(r.getX(),a.getX())),this.minY=Math.trunc(Math.min(t.getY(),r.getY())),this.maxY=Math.trunc(Math.max(n.getY(),a.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 sr(e.image,e.topLeft,e.bottomLeft,t.topRight,t.bottomRight)}addMissingRows(e,t,n){let r=this.topLeft,a=this.bottomLeft,c=this.topRight,d=this.bottomRight;if(e>0){let g=n?this.topLeft:this.topRight,w=Math.trunc(g.getY()-e);w<0&&(w=0);let E=new ye(g.getX(),w);n?r=E:c=E}if(t>0){let g=n?this.bottomLeft:this.bottomRight,w=Math.trunc(g.getY()+t);w>=this.image.getHeight()&&(w=this.image.getHeight()-1);let E=new ye(g.getX(),w);n?a=E:d=E}return new sr(this.image,r,a,c,d)}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 wg{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 Xr{constructor(){this.buffer=""}static form(e,t){let n=-1;function r(c,d,g,w,E,A){if(c==="%%")return"%";if(t[++n]===void 0)return;c=w?parseInt(w.substr(1)):void 0;let I=E?parseInt(E.substr(1)):void 0,O;switch(A){case"s":O=t[n];break;case"c":O=t[n][0];break;case"f":O=parseFloat(t[n]).toFixed(c);break;case"p":O=parseFloat(t[n]).toPrecision(c);break;case"e":O=parseFloat(t[n]).toExponential(c);break;case"x":O=parseInt(t[n]).toString(I||16);break;case"d":O=parseFloat(parseInt(t[n],I||10).toPrecision(c)).toFixed(0);break}O=typeof O=="object"?JSON.stringify(O):(+O).toString(I);let L=parseInt(g),F=g&&g[0]+""=="0"?"0":" ";for(;O.length<L;)O=d!==void 0?O+F:F+O;return O}let a=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(a,r)}format(e,...t){this.buffer+=Xr.form(e,t)}toString(){return this.buffer}}class jr{constructor(e){this.boundingBox=new sr(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<jr.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()}setCodeword(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 Xr;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()}}jr.MAX_NEARBY_DISTANCE=5;class qr{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 a={getKey:()=>n,getValue:()=>r};a.getValue()>e?(e=a.getValue(),t=[],t.push(a.getKey())):a.getValue()===e&&t.push(a.getKey())}return ke.toIntArray(t)}getConfidence(e){return this.values.get(e)}}class Ga extends jr{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(),a=this._isLeft?n.getBottomLeft():n.getBottomRight(),c=this.imageRowToCodewordIndex(Math.trunc(r.getY())),d=this.imageRowToCodewordIndex(Math.trunc(a.getY())),g=-1,w=1,E=0;for(let A=c;A<d;A++){if(t[A]==null)continue;let I=t[A],O=I.getRowNumber()-g;if(O===0)E++;else if(O===1)w=Math.max(w,E),E=1,g=I.getRowNumber();else if(O<0||I.getRowNumber()>=e.getRowCount()||O>A)t[A]=null;else{let L;w>2?L=(w-2)*O:L=O;let F=L>=A;for(let Z=1;Z<=L&&!F;Z++)F=t[A-Z]!=null;F?t[A]=null:(g=I.getRowNumber(),E=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(),a=this.imageRowToCodewordIndex(Math.trunc(n.getY())),c=this.imageRowToCodewordIndex(Math.trunc(r.getY())),d=this.getCodewords(),g=-1;for(let w=a;w<c;w++){if(d[w]==null)continue;let E=d[w];E.setRowNumberAsRowIndicatorColumn();let A=E.getRowNumber()-g;A===0||(A===1?g=E.getRowNumber():E.getRowNumber()>=e.getRowCount()?d[w]=null:g=E.getRowNumber())}}getBarcodeMetadata(){let e=this.getCodewords(),t=new qr,n=new qr,r=new qr,a=new qr;for(let d of e){if(d==null)continue;d.setRowNumberAsRowIndicatorColumn();let g=d.getValue()%30,w=d.getRowNumber();switch(this._isLeft||(w+=2),w%3){case 0:n.setValue(g*3+1);break;case 1:a.setValue(g/3),r.setValue(g%3);break;case 2:t.setValue(g+1);break}}if(t.getValue().length===0||n.getValue().length===0||r.getValue().length===0||a.getValue().length===0||t.getValue()[0]<1||n.getValue()[0]+r.getValue()[0]<ke.MIN_ROWS_IN_BARCODE||n.getValue()[0]+r.getValue()[0]>ke.MAX_ROWS_IN_BARCODE)return null;let c=new wg(t.getValue()[0],n.getValue()[0],r.getValue()[0],a.getValue()[0]);return this.removeIncorrectCodewords(e,c),c}removeIncorrectCodewords(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(e[n]==null)continue;let a=r.getValue()%30,c=r.getRowNumber();if(c>t.getRowCount()){e[n]=null;continue}switch(this._isLeft||(c+=2),c%3){case 0:a*3+1!==t.getRowCountUpperPart()&&(e[n]=null);break;case 1:(Math.trunc(a/3)!==t.getErrorCorrectionLevel()||a%3!==t.getRowCountLowerPart())&&(e[n]=null);break;case 2:a+1!==t.getColumnCount()&&(e[n]=null);break}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+`
|
|
17
|
-
`+super.toString()}}class Zr{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=ke.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()}adjustRowNumbersFromBothRI(){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 a=this.detectionResultColumns[r].getCodewords()[n];a!=null&&(a.setRowNumber(e[n].getRowNumber()),a.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(),a=0;for(let c=this.barcodeColumnCount+1;c>0&&a<this.ADJUST_ROW_NUMBER_SKIP;c--){let d=this.detectionResultColumns[c].getCodewords()[n];d!=null&&(a=Zr.adjustRowNumberIfValid(r,a,d),d.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(),a=0;for(let c=1;c<this.barcodeColumnCount+1&&a<this.ADJUST_ROW_NUMBER_SKIP;c++){let d=this.detectionResultColumns[c].getCodewords()[n];d!=null&&(a=Zr.adjustRowNumberIfValid(r,a,d),d.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],a=this.detectionResultColumns[e-1].getCodewords(),c=a;this.detectionResultColumns[e+1]!=null&&(c=this.detectionResultColumns[e+1].getCodewords());let d=new Array(14);d[2]=a[t],d[3]=c[t],t>0&&(d[0]=n[t-1],d[4]=a[t-1],d[5]=c[t-1]),t>1&&(d[8]=n[t-2],d[10]=a[t-2],d[11]=c[t-2]),t<n.length-1&&(d[1]=n[t+1],d[6]=a[t+1],d[7]=c[t+1]),t<n.length-2&&(d[9]=n[t+2],d[12]=a[t+2],d[13]=c[t+2]);for(let g of d)if(Zr.adjustRowNumber(r,g))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 Xr;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 a=this.detectionResultColumns[r].getCodewords()[n];if(a==null){t.format(" | ");continue}t.format(" %3d|%3d",a.getRowNumber(),a.getValue())}t.format("%n")}return t.toString()}}class Yr{constructor(e,t,n,r){this.rowNumber=Yr.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!==Yr.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}}Yr.BARCODE_ROW_UNKNOWN=-1;class tn{static initialize(){for(let e=0;e<ke.SYMBOL_TABLE.length;e++){let t=ke.SYMBOL_TABLE[e],n=t&1;for(let r=0;r<ke.BARS_IN_MODULE;r++){let a=0;for(;(t&1)===n;)a+=1,t>>=1;n=t&1,tn.RATIOS_TABLE[e]||(tn.RATIOS_TABLE[e]=new Array(ke.BARS_IN_MODULE)),tn.RATIOS_TABLE[e][ke.BARS_IN_MODULE-r-1]=Math.fround(a/ke.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(e){let t=tn.getDecodedCodewordValue(tn.sampleBitCounts(e));return t!==-1?t:tn.getClosestDecodedValue(e)}static sampleBitCounts(e){let t=He.sum(e),n=new Int32Array(ke.BARS_IN_MODULE),r=0,a=0;for(let c=0;c<ke.MODULES_IN_CODEWORD;c++){let d=t/(2*ke.MODULES_IN_CODEWORD)+c*t/ke.MODULES_IN_CODEWORD;a+e[r]<=d&&(a+=e[r],r++),n[r]++}return n}static getDecodedCodewordValue(e){let t=tn.getBitValue(e);return ke.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=He.sum(e),n=new Array(ke.BARS_IN_MODULE);if(t>1)for(let c=0;c<n.length;c++)n[c]=Math.fround(e[c]/t);let r=Cr.MAX_VALUE,a=-1;this.bSymbolTableReady||tn.initialize();for(let c=0;c<tn.RATIOS_TABLE.length;c++){let d=0,g=tn.RATIOS_TABLE[c];for(let w=0;w<ke.BARS_IN_MODULE;w++){let E=Math.fround(g[w]-n[w]);if(d+=Math.fround(E*E),d>=r)break}d<r&&(r=d,a=ke.SYMBOL_TABLE[c])}return a}}tn.bSymbolTableReady=!1,tn.RATIOS_TABLE=new Array(ke.SYMBOL_TABLE.length).map(b=>new Array(ke.BARS_IN_MODULE));class Wa{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 Xa{static parseLong(e,t=void 0){return parseInt(e,t)}}class ja extends p{}ja.kind="NullPointerException";class _g{writeBytes(e){this.writeBytesOffset(e,0,e.length)}writeBytesOffset(e,t,n){if(e==null)throw new ja;if(t<0||t>e.length||n<0||t+n>e.length||t+n<0)throw new v;if(n===0)return;for(let r=0;r<n;r++)this.write(e[t+r])}flush(){}close(){}}class Cg extends p{}class Eg extends _g{constructor(e=32){if(super(),this.count=0,e<0)throw new y("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 Cg;n=R.MAX_VALUE}this.buf=B.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 v;this.ensureCapacity(this.count+n),P.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 B.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 it;(function(b){b[b.ALPHA=0]="ALPHA",b[b.LOWER=1]="LOWER",b[b.MIXED=2]="MIXED",b[b.PUNCT=3]="PUNCT",b[b.ALPHA_SHIFT=4]="ALPHA_SHIFT",b[b.PUNCT_SHIFT=5]="PUNCT_SHIFT"})(it||(it={}));function qa(){if(typeof window<"u")return window.BigInt||null;if(typeof pr<"u")return pr.BigInt||null;if(typeof self<"u")return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}let ki;function Zn(b){if(typeof ki>"u"&&(ki=qa()),ki===null)throw new Error("BigInt is not supported!");return ki(b)}function yg(){let b=[];b[0]=Zn(1);let e=Zn(900);b[1]=e;for(let t=2;t<16;t++)b[t]=b[t-1]*e;return b}class ee{static decode(e,t){let n=new V(""),r=W.ISO8859_1;n.enableDecoding(r);let a=1,c=e[a++],d=new Wa;for(;a<e[0];){switch(c){case ee.TEXT_COMPACTION_MODE_LATCH:a=ee.textCompaction(e,a,n);break;case ee.BYTE_COMPACTION_MODE_LATCH:case ee.BYTE_COMPACTION_MODE_LATCH_6:a=ee.byteCompaction(c,e,r,a,n);break;case ee.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(e[a++]);break;case ee.NUMERIC_COMPACTION_MODE_LATCH:a=ee.numericCompaction(e,a,n);break;case ee.ECI_CHARSET:W.getCharacterSetECIByValue(e[a++]);break;case ee.ECI_GENERAL_PURPOSE:a+=2;break;case ee.ECI_USER_DEFINED:a++;break;case ee.BEGIN_MACRO_PDF417_CONTROL_BLOCK:a=ee.decodeMacroBlock(e,a,d);break;case ee.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case ee.MACRO_PDF417_TERMINATOR:throw new z;default:a--,a=ee.textCompaction(e,a,n);break}if(a<e.length)c=e[a++];else throw z.getFormatInstance()}if(n.length()===0)throw z.getFormatInstance();let g=new Oe(null,n.toString(),null,t);return g.setOther(d),g}static decodeMacroBlock(e,t,n){if(t+ee.NUMBER_OF_SEQUENCE_CODEWORDS>e[0])throw z.getFormatInstance();let r=new Int32Array(ee.NUMBER_OF_SEQUENCE_CODEWORDS);for(let d=0;d<ee.NUMBER_OF_SEQUENCE_CODEWORDS;d++,t++)r[d]=e[t];n.setSegmentIndex(R.parseInt(ee.decodeBase900toBase10(r,ee.NUMBER_OF_SEQUENCE_CODEWORDS)));let a=new V;t=ee.textCompaction(e,t,a),n.setFileId(a.toString());let c=-1;for(e[t]===ee.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(c=t+1);t<e[0];)switch(e[t]){case ee.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(t++,e[t]){case ee.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let d=new V;t=ee.textCompaction(e,t+1,d),n.setFileName(d.toString());break;case ee.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let g=new V;t=ee.textCompaction(e,t+1,g),n.setSender(g.toString());break;case ee.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let w=new V;t=ee.textCompaction(e,t+1,w),n.setAddressee(w.toString());break;case ee.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let E=new V;t=ee.numericCompaction(e,t+1,E),n.setSegmentCount(R.parseInt(E.toString()));break;case ee.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let A=new V;t=ee.numericCompaction(e,t+1,A),n.setTimestamp(Xa.parseLong(A.toString()));break;case ee.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let I=new V;t=ee.numericCompaction(e,t+1,I),n.setChecksum(R.parseInt(I.toString()));break;case ee.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let O=new V;t=ee.numericCompaction(e,t+1,O),n.setFileSize(Xa.parseLong(O.toString()));break;default:throw z.getFormatInstance()}break;case ee.MACRO_PDF417_TERMINATOR:t++,n.setLastSegment(!0);break;default:throw z.getFormatInstance()}if(c!==-1){let d=t-c;n.isLastSegment()&&d--,n.setOptionalData(B.copyOfRange(e,c,c+d))}return t}static textCompaction(e,t,n){let r=new Int32Array((e[0]-t)*2),a=new Int32Array((e[0]-t)*2),c=0,d=!1;for(;t<e[0]&&!d;){let g=e[t++];if(g<ee.TEXT_COMPACTION_MODE_LATCH)r[c]=g/30,r[c+1]=g%30,c+=2;else switch(g){case ee.TEXT_COMPACTION_MODE_LATCH:r[c++]=ee.TEXT_COMPACTION_MODE_LATCH;break;case ee.BYTE_COMPACTION_MODE_LATCH:case ee.BYTE_COMPACTION_MODE_LATCH_6:case ee.NUMERIC_COMPACTION_MODE_LATCH:case ee.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case ee.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case ee.MACRO_PDF417_TERMINATOR:t--,d=!0;break;case ee.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r[c]=ee.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,g=e[t++],a[c]=g,c++;break}}return ee.decodeTextCompaction(r,a,c,n),t}static decodeTextCompaction(e,t,n,r){let a=it.ALPHA,c=it.ALPHA,d=0;for(;d<n;){let g=e[d],w="";switch(a){case it.ALPHA:if(g<26)w=String.fromCharCode(65+g);else switch(g){case 26:w=" ";break;case ee.LL:a=it.LOWER;break;case ee.ML:a=it.MIXED;break;case ee.PS:c=a,a=it.PUNCT_SHIFT;break;case ee.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[d]);break;case ee.TEXT_COMPACTION_MODE_LATCH:a=it.ALPHA;break}break;case it.LOWER:if(g<26)w=String.fromCharCode(97+g);else switch(g){case 26:w=" ";break;case ee.AS:c=a,a=it.ALPHA_SHIFT;break;case ee.ML:a=it.MIXED;break;case ee.PS:c=a,a=it.PUNCT_SHIFT;break;case ee.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[d]);break;case ee.TEXT_COMPACTION_MODE_LATCH:a=it.ALPHA;break}break;case it.MIXED:if(g<ee.PL)w=ee.MIXED_CHARS[g];else switch(g){case ee.PL:a=it.PUNCT;break;case 26:w=" ";break;case ee.LL:a=it.LOWER;break;case ee.AL:a=it.ALPHA;break;case ee.PS:c=a,a=it.PUNCT_SHIFT;break;case ee.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[d]);break;case ee.TEXT_COMPACTION_MODE_LATCH:a=it.ALPHA;break}break;case it.PUNCT:if(g<ee.PAL)w=ee.PUNCT_CHARS[g];else switch(g){case ee.PAL:a=it.ALPHA;break;case ee.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[d]);break;case ee.TEXT_COMPACTION_MODE_LATCH:a=it.ALPHA;break}break;case it.ALPHA_SHIFT:if(a=c,g<26)w=String.fromCharCode(65+g);else switch(g){case 26:w=" ";break;case ee.TEXT_COMPACTION_MODE_LATCH:a=it.ALPHA;break}break;case it.PUNCT_SHIFT:if(a=c,g<ee.PAL)w=ee.PUNCT_CHARS[g];else switch(g){case ee.PAL:a=it.ALPHA;break;case ee.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[d]);break;case ee.TEXT_COMPACTION_MODE_LATCH:a=it.ALPHA;break}break}w!==""&&r.append(w),d++}}static byteCompaction(e,t,n,r,a){let c=new Eg,d=0,g=0,w=!1;switch(e){case ee.BYTE_COMPACTION_MODE_LATCH:let E=new Int32Array(6),A=t[r++];for(;r<t[0]&&!w;)switch(E[d++]=A,g=900*g+A,A=t[r++],A){case ee.TEXT_COMPACTION_MODE_LATCH:case ee.BYTE_COMPACTION_MODE_LATCH:case ee.NUMERIC_COMPACTION_MODE_LATCH:case ee.BYTE_COMPACTION_MODE_LATCH_6:case ee.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case ee.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case ee.MACRO_PDF417_TERMINATOR:r--,w=!0;break;default:if(d%5===0&&d>0){for(let I=0;I<6;++I)c.write(Number(Zn(g)>>Zn(8*(5-I))));g=0,d=0}break}r===t[0]&&A<ee.TEXT_COMPACTION_MODE_LATCH&&(E[d++]=A);for(let I=0;I<d;I++)c.write(E[I]);break;case ee.BYTE_COMPACTION_MODE_LATCH_6:for(;r<t[0]&&!w;){let I=t[r++];if(I<ee.TEXT_COMPACTION_MODE_LATCH)d++,g=900*g+I;else switch(I){case ee.TEXT_COMPACTION_MODE_LATCH:case ee.BYTE_COMPACTION_MODE_LATCH:case ee.NUMERIC_COMPACTION_MODE_LATCH:case ee.BYTE_COMPACTION_MODE_LATCH_6:case ee.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case ee.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case ee.MACRO_PDF417_TERMINATOR:r--,w=!0;break}if(d%5===0&&d>0){for(let O=0;O<6;++O)c.write(Number(Zn(g)>>Zn(8*(5-O))));g=0,d=0}}break}return a.append(j.decode(c.toByteArray(),n)),r}static numericCompaction(e,t,n){let r=0,a=!1,c=new Int32Array(ee.MAX_NUMERIC_CODEWORDS);for(;t<e[0]&&!a;){let d=e[t++];if(t===e[0]&&(a=!0),d<ee.TEXT_COMPACTION_MODE_LATCH)c[r]=d,r++;else switch(d){case ee.TEXT_COMPACTION_MODE_LATCH:case ee.BYTE_COMPACTION_MODE_LATCH:case ee.BYTE_COMPACTION_MODE_LATCH_6:case ee.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case ee.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case ee.MACRO_PDF417_TERMINATOR:t--,a=!0;break}(r%ee.MAX_NUMERIC_CODEWORDS===0||d===ee.NUMERIC_COMPACTION_MODE_LATCH||a)&&r>0&&(n.append(ee.decodeBase900toBase10(c,r)),r=0)}return t}static decodeBase900toBase10(e,t){let n=Zn(0);for(let a=0;a<t;a++)n+=ee.EXP900[t-a-1]*Zn(e[a]);let r=n.toString();if(r.charAt(0)!=="1")throw new z;return r.substring(1)}}ee.TEXT_COMPACTION_MODE_LATCH=900,ee.BYTE_COMPACTION_MODE_LATCH=901,ee.NUMERIC_COMPACTION_MODE_LATCH=902,ee.BYTE_COMPACTION_MODE_LATCH_6=924,ee.ECI_USER_DEFINED=925,ee.ECI_GENERAL_PURPOSE=926,ee.ECI_CHARSET=927,ee.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,ee.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,ee.MACRO_PDF417_TERMINATOR=922,ee.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,ee.MAX_NUMERIC_CODEWORDS=15,ee.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,ee.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,ee.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,ee.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,ee.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,ee.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,ee.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,ee.PL=25,ee.LL=27,ee.AS=27,ee.ML=28,ee.AL=28,ee.PS=29,ee.PAL=29,ee.PUNCT_CHARS=`;<>@[\\]_\`~!\r ,:
|
|
18
|
-
-.$/"|*()?{}'`,ee.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",ee.EXP900=qa()?yg():[],ee.NUMBER_OF_SEQUENCE_CODEWORDS=2;class Fe{constructor(){}static decode(e,t,n,r,a,c,d){let g=new sr(e,t,n,r,a),w=null,E=null,A;for(let L=!0;;L=!1){if(t!=null&&(w=Fe.getRowIndicatorColumn(e,g,t,!0,c,d)),r!=null&&(E=Fe.getRowIndicatorColumn(e,g,r,!1,c,d)),A=Fe.merge(w,E),A==null)throw N.getNotFoundInstance();let F=A.getBoundingBox();if(L&&F!=null&&(F.getMinY()<g.getMinY()||F.getMaxY()>g.getMaxY()))g=F;else break}A.setBoundingBox(g);let I=A.getBarcodeColumnCount()+1;A.setDetectionResultColumn(0,w),A.setDetectionResultColumn(I,E);let O=w!=null;for(let L=1;L<=I;L++){let F=O?L:I-L;if(A.getDetectionResultColumn(F)!==void 0)continue;let Z;F===0||F===I?Z=new Ga(g,F===0):Z=new jr(g),A.setDetectionResultColumn(F,Z);let ne=-1,ce=ne;for(let ue=g.getMinY();ue<=g.getMaxY();ue++){if(ne=Fe.getStartColumn(A,F,ue,O),ne<0||ne>g.getMaxX()){if(ce===-1)continue;ne=ce}let ae=Fe.detectCodeword(e,g.getMinX(),g.getMaxX(),O,ne,ue,c,d);ae!=null&&(Z.setCodeword(ue,ae),ce=ne,c=Math.min(c,ae.getWidth()),d=Math.max(d,ae.getWidth()))}}return Fe.createDecoderResult(A)}static merge(e,t){if(e==null&&t==null)return null;let n=Fe.getBarcodeMetadata(e,t);if(n==null)return null;let r=sr.merge(Fe.adjustBoundingBox(e),Fe.adjustBoundingBox(t));return new Zr(n,r)}static adjustBoundingBox(e){if(e==null)return null;let t=e.getRowHeights();if(t==null)return null;let n=Fe.getMax(t),r=0;for(let d of t)if(r+=n-d,d>0)break;let a=e.getCodewords();for(let d=0;r>0&&a[d]==null;d++)r--;let c=0;for(let d=t.length-1;d>=0&&(c+=n-t[d],!(t[d]>0));d--);for(let d=a.length-1;c>0&&a[d]==null;d--)c--;return e.getBoundingBox().addMissingRows(r,c,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,a,c){let d=new Ga(t,r);for(let g=0;g<2;g++){let w=g===0?1:-1,E=Math.trunc(Math.trunc(n.getX()));for(let A=Math.trunc(Math.trunc(n.getY()));A<=t.getMaxY()&&A>=t.getMinY();A+=w){let I=Fe.detectCodeword(e,0,e.getWidth(),r,E,A,a,c);I!=null&&(d.setCodeword(A,I),r?E=I.getStartX():E=I.getEndX())}}return d}static adjustCodewordCount(e,t){let n=t[0][1],r=n.getValue(),a=e.getBarcodeColumnCount()*e.getBarcodeRowCount()-Fe.getNumberOfECCodeWords(e.getBarcodeECLevel());if(r.length===0){if(a<1||a>ke.MAX_CODEWORDS_IN_BARCODE)throw N.getNotFoundInstance();n.setValue(a)}else r[0]!==a&&n.setValue(a)}static createDecoderResult(e){let t=Fe.createBarcodeMatrix(e);Fe.adjustCodewordCount(e,t);let n=new Array,r=new Int32Array(e.getBarcodeRowCount()*e.getBarcodeColumnCount()),a=[],c=new Array;for(let g=0;g<e.getBarcodeRowCount();g++)for(let w=0;w<e.getBarcodeColumnCount();w++){let E=t[g][w+1].getValue(),A=g*e.getBarcodeColumnCount()+w;E.length===0?n.push(A):E.length===1?r[A]=E[0]:(c.push(A),a.push(E))}let d=new Array(a.length);for(let g=0;g<d.length;g++)d[g]=a[g];return Fe.createDecoderResultFromAmbiguousValues(e.getBarcodeECLevel(),r,ke.toIntArray(n),ke.toIntArray(c),d)}static createDecoderResultFromAmbiguousValues(e,t,n,r,a){let c=new Int32Array(r.length),d=100;for(;d-- >0;){for(let g=0;g<c.length;g++)t[r[g]]=a[g][c[g]];try{return Fe.decodeCodewords(t,e,n)}catch(g){if(!(g instanceof M))throw g}if(c.length===0)throw M.getChecksumInstance();for(let g=0;g<c.length;g++)if(c[g]<a[g].length-1){c[g]++;break}else if(c[g]=0,g===c.length-1)throw M.getChecksumInstance()}throw M.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 a=0;a<t[r].length;a++)t[r][a]=new qr;let n=0;for(let r of e.getDetectionResultColumns()){if(r!=null){for(let a of r.getCodewords())if(a!=null){let c=a.getRowNumber();if(c>=0){if(c>=t.length)continue;t[c][n].setValue(a.getValue())}}}n++}return t}static isValidBarcodeColumn(e,t){return t>=0&&t<=e.getBarcodeColumnCount()+1}static getStartColumn(e,t,n,r){let a=r?1:-1,c=null;if(Fe.isValidBarcodeColumn(e,t-a)&&(c=e.getDetectionResultColumn(t-a).getCodeword(n)),c!=null)return r?c.getEndX():c.getStartX();if(c=e.getDetectionResultColumn(t).getCodewordNearby(n),c!=null)return r?c.getStartX():c.getEndX();if(Fe.isValidBarcodeColumn(e,t-a)&&(c=e.getDetectionResultColumn(t-a).getCodewordNearby(n)),c!=null)return r?c.getEndX():c.getStartX();let d=0;for(;Fe.isValidBarcodeColumn(e,t-a);){t-=a;for(let g of e.getDetectionResultColumn(t).getCodewords())if(g!=null)return(r?g.getEndX():g.getStartX())+a*d*(g.getEndX()-g.getStartX());d++}return r?e.getBoundingBox().getMinX():e.getBoundingBox().getMaxX()}static detectCodeword(e,t,n,r,a,c,d,g){a=Fe.adjustCodewordStartColumn(e,t,n,r,a,c);let w=Fe.getModuleBitCount(e,t,n,r,a,c);if(w==null)return null;let E,A=He.sum(w);if(r)E=a+A;else{for(let L=0;L<w.length/2;L++){let F=w[L];w[L]=w[w.length-1-L],w[w.length-1-L]=F}E=a,a=E-A}if(!Fe.checkCodewordSkew(A,d,g))return null;let I=tn.getDecodedValue(w),O=ke.getCodeword(I);return O===-1?null:new Yr(a,E,Fe.getCodewordBucketNumber(I),O)}static getModuleBitCount(e,t,n,r,a,c){let d=a,g=new Int32Array(8),w=0,E=r?1:-1,A=r;for(;(r?d<n:d>=t)&&w<g.length;)e.get(d,c)===A?(g[w]++,d+=E):(w++,A=!A);return w===g.length||d===(r?n:t)&&w===g.length-1?g:null}static getNumberOfECCodeWords(e){return 2<<e}static adjustCodewordStartColumn(e,t,n,r,a,c){let d=a,g=r?-1:1;for(let w=0;w<2;w++){for(;(r?d>=t:d<n)&&r===e.get(d,c);){if(Math.abs(a-d)>Fe.CODEWORD_SKEW_SIZE)return a;d+=g}g=-g,r=!r}return d}static checkCodewordSkew(e,t,n){return t-Fe.CODEWORD_SKEW_SIZE<=e&&e<=n+Fe.CODEWORD_SKEW_SIZE}static decodeCodewords(e,t,n){if(e.length===0)throw z.getFormatInstance();let r=1<<t+1,a=Fe.correctErrors(e,n,r);Fe.verifyCodewordCount(e,r);let c=ee.decode(e,""+t);return c.setErrorsCorrected(a),c.setErasures(n.length),c}static correctErrors(e,t,n){if(t!=null&&t.length>n/2+Fe.MAX_ERRORS||n<0||n>Fe.MAX_EC_CODEWORDS)throw M.getChecksumInstance();return Fe.errorCorrection.decode(e,n,t)}static verifyCodewordCount(e,t){if(e.length<4)throw z.getFormatInstance();let n=e[0];if(n>e.length)throw z.getFormatInstance();if(n===0)if(t<e.length)e[0]=e.length-t;else throw z.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 Fe.getCodewordBucketNumber(Fe.getBitCountForCodeword(e))}static getCodewordBucketNumber_Int32Array(e){return(e[0]-e[2]+e[4]-e[6]+9)%9}static toString(e){let t=new Xr;for(let n=0;n<e.length;n++){t.format("Row %2d: ",n);for(let r=0;r<e[n].length;r++){let a=e[n][r];a.getValue().length===0?t.format(" ",null):t.format("%4d(%2d)",a.getValue()[0],a.getConfidence(a.getValue()[0]))}t.format("%n")}return t.toString()}}Fe.CODEWORD_SKEW_SIZE=2,Fe.MAX_ERRORS=3,Fe.MAX_EC_CODEWORDS=512,Fe.errorCorrection=new Ha;class Vt{decode(e,t=null){let n=Vt.decode(e,t,!1);if(n==null||n.length===0||n[0]==null)throw N.getNotFoundInstance();return n[0]}decodeMultiple(e,t=null){try{return Vt.decode(e,t,!0)}catch(n){throw n instanceof z||n instanceof M?N.getNotFoundInstance():n}}static decode(e,t,n){const r=new Array,a=Pe.detectMultiple(e,t,n);for(const c of a.getPoints()){const d=Fe.decode(a.getBits(),c[4],c[5],c[6],c[7],Vt.getMinCodewordWidth(c),Vt.getMaxCodewordWidth(c)),g=new _e(d.getText(),d.getRawBytes(),void 0,c,he.PDF_417);g.putMetadata(Xe.ERROR_CORRECTION_LEVEL,d.getECLevel());const w=d.getOther();w!=null&&g.putMetadata(Xe.PDF417_EXTRA_METADATA,w),r.push(g)}return r.map(c=>c)}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?R.MAX_VALUE:Math.trunc(Math.abs(e.getX()-t.getX()))}static getMaxCodewordWidth(e){return Math.floor(Math.max(Math.max(Vt.getMaxWidth(e[0],e[4]),Vt.getMaxWidth(e[6],e[2])*ke.MODULES_IN_CODEWORD/ke.MODULES_IN_STOP_PATTERN),Math.max(Vt.getMaxWidth(e[1],e[5]),Vt.getMaxWidth(e[7],e[3])*ke.MODULES_IN_CODEWORD/ke.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(e){return Math.floor(Math.min(Math.min(Vt.getMinWidth(e[0],e[4]),Vt.getMinWidth(e[6],e[2])*ke.MODULES_IN_CODEWORD/ke.MODULES_IN_STOP_PATTERN),Math.min(Vt.getMinWidth(e[1],e[5]),Vt.getMinWidth(e[7],e[3])*ke.MODULES_IN_CODEWORD/ke.MODULES_IN_STOP_PATTERN)))}reset(){}}class Ri extends p{}Ri.kind="ReaderException";class Za{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=!u(e)&&e.get(te.TRY_HARDER)===!0,n=u(e)?null:e.get(te.POSSIBLE_FORMATS),r=new Array;if(!u(n)){const a=n.some(c=>c===he.UPC_A||c===he.UPC_E||c===he.EAN_13||c===he.EAN_8||c===he.CODABAR||c===he.CODE_39||c===he.CODE_93||c===he.CODE_128||c===he.ITF||c===he.RSS_14||c===he.RSS_EXPANDED);a&&!t&&r.push(new Ar(e,this.verbose)),n.includes(he.QR_CODE)&&r.push(new qn),n.includes(he.DATA_MATRIX)&&r.push(new jn),n.includes(he.AZTEC)&&r.push(new le),n.includes(he.PDF_417)&&r.push(new Vt),a&&t&&r.push(new Ar(e,this.verbose))}r.length===0&&(t||r.push(new Ar(e,this.verbose)),r.push(new qn),r.push(new jn),r.push(new le),r.push(new Vt),t&&r.push(new Ar(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 Ri("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 Ri)continue}throw new N("No MultiFormat Readers were able to detect the code.")}}class bg extends Ne{constructor(e=null,t=500){const n=new Za;n.setHints(e),super(n,t)}decodeBitmap(e){return this.reader.decodeWithState(e)}}class Ag extends Ne{constructor(e=500){super(new Vt,e)}}class Ig extends Ne{constructor(e=500){super(new qn,e)}}var Do;(function(b){b[b.ERROR_CORRECTION=0]="ERROR_CORRECTION",b[b.CHARACTER_SET=1]="CHARACTER_SET",b[b.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",b[b.MIN_SIZE=3]="MIN_SIZE",b[b.MAX_SIZE=4]="MAX_SIZE",b[b.MARGIN=5]="MARGIN",b[b.PDF417_COMPACT=6]="PDF417_COMPACT",b[b.PDF417_COMPACTION=7]="PDF417_COMPACTION",b[b.PDF417_DIMENSIONS=8]="PDF417_DIMENSIONS",b[b.AZTEC_LAYERS=9]="AZTEC_LAYERS",b[b.QR_VERSION=10]="QR_VERSION"})(Do||(Do={}));var kt=Do;class Po{constructor(e){this.field=e,this.cachedGenerators=[],this.cachedGenerators.push(new me(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 a=t.length;a<=e;a++){const c=n.multiply(new me(r,Int32Array.from([1,r.exp(a-1+r.getGeneratorBase())])));t.push(c),n=c}}return t[e]}encode(e,t){if(t===0)throw new y("No error correction bytes");const n=e.length-t;if(n<=0)throw new y("No data bytes provided");const r=this.buildGenerator(t),a=new Int32Array(n);P.arraycopy(e,0,a,0,n);let c=new me(this.field,a);c=c.multiplyByMonomial(t,1);const g=c.divide(r)[1].getCoefficients(),w=t-g.length;for(let E=0;E<w;E++)e[n+E]=0;P.arraycopy(g,0,e,n+w,g.length)}}class Et{constructor(){}static applyMaskPenaltyRule1(e){return Et.applyMaskPenaltyRule1Internal(e,!0)+Et.applyMaskPenaltyRule1Internal(e,!1)}static applyMaskPenaltyRule2(e){let t=0;const n=e.getArray(),r=e.getWidth(),a=e.getHeight();for(let c=0;c<a-1;c++){const d=n[c];for(let g=0;g<r-1;g++){const w=d[g];w===d[g+1]&&w===n[c+1][g]&&w===n[c+1][g+1]&&t++}}return Et.N2*t}static applyMaskPenaltyRule3(e){let t=0;const n=e.getArray(),r=e.getWidth(),a=e.getHeight();for(let c=0;c<a;c++)for(let d=0;d<r;d++){const g=n[c];d+6<r&&g[d]===1&&g[d+1]===0&&g[d+2]===1&&g[d+3]===1&&g[d+4]===1&&g[d+5]===0&&g[d+6]===1&&(Et.isWhiteHorizontal(g,d-4,d)||Et.isWhiteHorizontal(g,d+7,d+11))&&t++,c+6<a&&n[c][d]===1&&n[c+1][d]===0&&n[c+2][d]===1&&n[c+3][d]===1&&n[c+4][d]===1&&n[c+5][d]===0&&n[c+6][d]===1&&(Et.isWhiteVertical(n,d,c-4,c)||Et.isWhiteVertical(n,d,c+7,c+11))&&t++}return t*Et.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 a=n;a<r;a++)if(e[a][t]===1)return!1;return!0}static applyMaskPenaltyRule4(e){let t=0;const n=e.getArray(),r=e.getWidth(),a=e.getHeight();for(let g=0;g<a;g++){const w=n[g];for(let E=0;E<r;E++)w[E]===1&&t++}const c=e.getHeight()*e.getWidth();return Math.floor(Math.abs(t*2-c)*10/c)*Et.N4}static getDataMaskBit(e,t,n){let r,a;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:a=n*t,r=(a&1)+a%3;break;case 6:a=n*t,r=(a&1)+a%3&1;break;case 7:a=n*t,r=a%3+(n+t&1)&1;break;default:throw new y("Invalid mask pattern: "+e)}return r===0}static applyMaskPenaltyRule1Internal(e,t){let n=0;const r=t?e.getHeight():e.getWidth(),a=t?e.getWidth():e.getHeight(),c=e.getArray();for(let d=0;d<r;d++){let g=0,w=-1;for(let E=0;E<a;E++){const A=t?c[d][E]:c[E][d];A===w?g++:(g>=5&&(n+=Et.N1+(g-5)),g=1,w=A)}g>=5&&(n+=Et.N1+(g-5))}return n}}Et.N1=3,Et.N2=3,Et.N3=40,Et.N4=10;class Oi{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)B.fill(t,e)}equals(e){if(!(e instanceof Oi))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 a=this.bytes[n],c=t.bytes[n];for(let d=0,g=this.width;d<g;++d)if(a[d]!==c[d])return!1}return!0}toString(){const e=new V;for(let t=0,n=this.height;t<n;++t){const r=this.bytes[t];for(let a=0,c=this.width;a<c;++a)switch(r[a]){case 0:e.append(" 0");break;case 1:e.append(" 1");break;default:e.append(" ");break}e.append(`
|
|
19
|
-
`)}return e.toString()}}class
|
|
11
|
+
*/var Sn=function(){return Sn=Object.assign||function(s){for(var i,u=1,f=arguments.length;u<f;u++){i=arguments[u];for(var h in i)Object.prototype.hasOwnProperty.call(i,h)&&(s[h]=i[h])}return s},Sn.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;var Jn;(function(o){var s=function(){function m(x,_,p,C){if(this.version=x,this.errorCorrectionLevel=_,this.modules=[],this.isFunction=[],x<m.MIN_VERSION||x>m.MAX_VERSION)throw new RangeError("Version value out of range");if(C<-1||C>7)throw new RangeError("Mask value out of range");this.size=x*4+17;for(var y=[],S=0;S<this.size;S++)y.push(!1);for(var S=0;S<this.size;S++)this.modules.push(y.slice()),this.isFunction.push(y.slice());this.drawFunctionPatterns();var B=this.addEccAndInterleave(p);if(this.drawCodewords(B),C==-1)for(var T=1e9,S=0;S<8;S++){this.applyMask(S),this.drawFormatBits(S);var D=this.getPenaltyScore();D<T&&(C=S,T=D),this.applyMask(S)}f(0<=C&&C<=7),this.mask=C,this.applyMask(C),this.drawFormatBits(C),this.isFunction=[]}return m.encodeText=function(x,_){var p=o.QrSegment.makeSegments(x);return m.encodeSegments(p,_)},m.encodeBinary=function(x,_){var p=o.QrSegment.makeBytes(x);return m.encodeSegments([p],_)},m.encodeSegments=function(x,_,p,C,y,S){if(p===void 0&&(p=1),C===void 0&&(C=40),y===void 0&&(y=-1),S===void 0&&(S=!0),!(m.MIN_VERSION<=p&&p<=C&&C<=m.MAX_VERSION)||y<-1||y>7)throw new RangeError("Invalid value");var B,T;for(B=p;;B++){var D=m.getNumDataCodewords(B,_)*8,v=h.getTotalBits(x,B);if(v<=D){T=v;break}if(B>=C)throw new RangeError("Data too long")}for(var U=0,P=[m.Ecc.MEDIUM,m.Ecc.QUARTILE,m.Ecc.HIGH];U<P.length;U++){var O=P[U];S&&T<=m.getNumDataCodewords(B,O)*8&&(_=O)}for(var M=[],K=0,Q=x;K<Q.length;K++){var W=Q[K];i(W.mode.modeBits,4,M),i(W.numChars,W.mode.numCharCountBits(B),M);for(var oe=0,V=W.getData();oe<V.length;oe++){var ce=V[oe];M.push(ce)}}f(M.length==T);var j=m.getNumDataCodewords(B,_)*8;f(M.length<=j),i(0,Math.min(4,j-M.length),M),i(0,(8-M.length%8)%8,M),f(M.length%8==0);for(var G=236;M.length<j;G^=253)i(G,8,M);for(var z=[];z.length*8<M.length;)z.push(0);return M.forEach(function(X,N){return z[N>>>3]|=X<<7-(N&7)}),new m(B,_,z,y)},m.prototype.getModule=function(x,_){return 0<=x&&x<this.size&&0<=_&&_<this.size&&this.modules[_][x]},m.prototype.getModules=function(){return this.modules},m.prototype.drawFunctionPatterns=function(){for(var x=0;x<this.size;x++)this.setFunctionModule(6,x,x%2==0),this.setFunctionModule(x,6,x%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);for(var _=this.getAlignmentPatternPositions(),p=_.length,x=0;x<p;x++)for(var C=0;C<p;C++)x==0&&C==0||x==0&&C==p-1||x==p-1&&C==0||this.drawAlignmentPattern(_[x],_[C]);this.drawFormatBits(0),this.drawVersion()},m.prototype.drawFormatBits=function(x){for(var _=this.errorCorrectionLevel.formatBits<<3|x,p=_,C=0;C<10;C++)p=p<<1^(p>>>9)*1335;var y=(_<<10|p)^21522;f(y>>>15==0);for(var C=0;C<=5;C++)this.setFunctionModule(8,C,u(y,C));this.setFunctionModule(8,7,u(y,6)),this.setFunctionModule(8,8,u(y,7)),this.setFunctionModule(7,8,u(y,8));for(var C=9;C<15;C++)this.setFunctionModule(14-C,8,u(y,C));for(var C=0;C<8;C++)this.setFunctionModule(this.size-1-C,8,u(y,C));for(var C=8;C<15;C++)this.setFunctionModule(8,this.size-15+C,u(y,C));this.setFunctionModule(8,this.size-8,!0)},m.prototype.drawVersion=function(){if(!(this.version<7)){for(var x=this.version,_=0;_<12;_++)x=x<<1^(x>>>11)*7973;var p=this.version<<12|x;f(p>>>18==0);for(var _=0;_<18;_++){var C=u(p,_),y=this.size-11+_%3,S=Math.floor(_/3);this.setFunctionModule(y,S,C),this.setFunctionModule(S,y,C)}}},m.prototype.drawFinderPattern=function(x,_){for(var p=-4;p<=4;p++)for(var C=-4;C<=4;C++){var y=Math.max(Math.abs(C),Math.abs(p)),S=x+C,B=_+p;0<=S&&S<this.size&&0<=B&&B<this.size&&this.setFunctionModule(S,B,y!=2&&y!=4)}},m.prototype.drawAlignmentPattern=function(x,_){for(var p=-2;p<=2;p++)for(var C=-2;C<=2;C++)this.setFunctionModule(x+C,_+p,Math.max(Math.abs(C),Math.abs(p))!=1)},m.prototype.setFunctionModule=function(x,_,p){this.modules[_][x]=p,this.isFunction[_][x]=!0},m.prototype.addEccAndInterleave=function(x){var _=this.version,p=this.errorCorrectionLevel;if(x.length!=m.getNumDataCodewords(_,p))throw new RangeError("Invalid argument");for(var C=m.NUM_ERROR_CORRECTION_BLOCKS[p.ordinal][_],y=m.ECC_CODEWORDS_PER_BLOCK[p.ordinal][_],S=Math.floor(m.getNumRawDataModules(_)/8),B=C-S%C,T=Math.floor(S/C),D=[],v=m.reedSolomonComputeDivisor(y),U=0,P=0;U<C;U++){var O=x.slice(P,P+T-y+(U<B?0:1));P+=O.length;var M=m.reedSolomonComputeRemainder(O,v);U<B&&O.push(0),D.push(O.concat(M))}for(var K=[],Q=function(W){D.forEach(function(oe,V){(W!=T-y||V>=B)&&K.push(oe[W])})},U=0;U<D[0].length;U++)Q(U);return f(K.length==S),K},m.prototype.drawCodewords=function(x){if(x.length!=Math.floor(m.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");for(var _=0,p=this.size-1;p>=1;p-=2){p==6&&(p=5);for(var C=0;C<this.size;C++)for(var y=0;y<2;y++){var S=p-y,B=(p+1&2)==0,T=B?this.size-1-C:C;!this.isFunction[T][S]&&_<x.length*8&&(this.modules[T][S]=u(x[_>>>3],7-(_&7)),_++)}}f(_==x.length*8)},m.prototype.applyMask=function(x){if(x<0||x>7)throw new RangeError("Mask value out of range");for(var _=0;_<this.size;_++)for(var p=0;p<this.size;p++){var C=void 0;switch(x){case 0:C=(p+_)%2==0;break;case 1:C=_%2==0;break;case 2:C=p%3==0;break;case 3:C=(p+_)%3==0;break;case 4:C=(Math.floor(p/3)+Math.floor(_/2))%2==0;break;case 5:C=p*_%2+p*_%3==0;break;case 6:C=(p*_%2+p*_%3)%2==0;break;case 7:C=((p+_)%2+p*_%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[_][p]&&C&&(this.modules[_][p]=!this.modules[_][p])}},m.prototype.getPenaltyScore=function(){for(var x=0,_=0;_<this.size;_++){for(var p=!1,C=0,y=[0,0,0,0,0,0,0],S=0;S<this.size;S++)this.modules[_][S]==p?(C++,C==5?x+=m.PENALTY_N1:C>5&&x++):(this.finderPenaltyAddHistory(C,y),p||(x+=this.finderPenaltyCountPatterns(y)*m.PENALTY_N3),p=this.modules[_][S],C=1);x+=this.finderPenaltyTerminateAndCount(p,C,y)*m.PENALTY_N3}for(var S=0;S<this.size;S++){for(var p=!1,B=0,y=[0,0,0,0,0,0,0],_=0;_<this.size;_++)this.modules[_][S]==p?(B++,B==5?x+=m.PENALTY_N1:B>5&&x++):(this.finderPenaltyAddHistory(B,y),p||(x+=this.finderPenaltyCountPatterns(y)*m.PENALTY_N3),p=this.modules[_][S],B=1);x+=this.finderPenaltyTerminateAndCount(p,B,y)*m.PENALTY_N3}for(var _=0;_<this.size-1;_++)for(var S=0;S<this.size-1;S++){var T=this.modules[_][S];T==this.modules[_][S+1]&&T==this.modules[_+1][S]&&T==this.modules[_+1][S+1]&&(x+=m.PENALTY_N2)}for(var D=0,v=0,U=this.modules;v<U.length;v++){var P=U[v];D=P.reduce(function(K,Q){return K+(Q?1:0)},D)}var O=this.size*this.size,M=Math.ceil(Math.abs(D*20-O*10)/O)-1;return f(0<=M&&M<=9),x+=M*m.PENALTY_N4,f(0<=x&&x<=2568888),x},m.prototype.getAlignmentPatternPositions=function(){if(this.version==1)return[];for(var x=Math.floor(this.version/7)+2,_=Math.floor((this.version*8+x*3+5)/(x*4-4))*2,p=[6],C=this.size-7;p.length<x;C-=_)p.splice(1,0,C);return p},m.getNumRawDataModules=function(x){if(x<m.MIN_VERSION||x>m.MAX_VERSION)throw new RangeError("Version number out of range");var _=(16*x+128)*x+64;if(x>=2){var p=Math.floor(x/7)+2;_-=(25*p-10)*p-55,x>=7&&(_-=36)}return f(208<=_&&_<=29648),_},m.getNumDataCodewords=function(x,_){return Math.floor(m.getNumRawDataModules(x)/8)-m.ECC_CODEWORDS_PER_BLOCK[_.ordinal][x]*m.NUM_ERROR_CORRECTION_BLOCKS[_.ordinal][x]},m.reedSolomonComputeDivisor=function(x){if(x<1||x>255)throw new RangeError("Degree out of range");for(var _=[],p=0;p<x-1;p++)_.push(0);_.push(1);for(var C=1,p=0;p<x;p++){for(var y=0;y<_.length;y++)_[y]=m.reedSolomonMultiply(_[y],C),y+1<_.length&&(_[y]^=_[y+1]);C=m.reedSolomonMultiply(C,2)}return _},m.reedSolomonComputeRemainder=function(x,_){for(var p=_.map(function(T){return 0}),C=function(T){var D=T^p.shift();p.push(0),_.forEach(function(v,U){return p[U]^=m.reedSolomonMultiply(v,D)})},y=0,S=x;y<S.length;y++){var B=S[y];C(B)}return p},m.reedSolomonMultiply=function(x,_){if(x>>>8||_>>>8)throw new RangeError("Byte out of range");for(var p=0,C=7;C>=0;C--)p=p<<1^(p>>>7)*285,p^=(_>>>C&1)*x;return f(p>>>8==0),p},m.prototype.finderPenaltyCountPatterns=function(x){var _=x[1];f(_<=this.size*3);var p=_>0&&x[2]==_&&x[3]==_*3&&x[4]==_&&x[5]==_;return(p&&x[0]>=_*4&&x[6]>=_?1:0)+(p&&x[6]>=_*4&&x[0]>=_?1:0)},m.prototype.finderPenaltyTerminateAndCount=function(x,_,p){return x&&(this.finderPenaltyAddHistory(_,p),_=0),_+=this.size,this.finderPenaltyAddHistory(_,p),this.finderPenaltyCountPatterns(p)},m.prototype.finderPenaltyAddHistory=function(x,_){_[0]==0&&(x+=this.size),_.pop(),_.unshift(x)},m.MIN_VERSION=1,m.MAX_VERSION=40,m.PENALTY_N1=3,m.PENALTY_N2=3,m.PENALTY_N3=40,m.PENALTY_N4=10,m.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],m.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],m}();o.QrCode=s;function i(m,x,_){if(x<0||x>31||m>>>x)throw new RangeError("Value out of range");for(var p=x-1;p>=0;p--)_.push(m>>>p&1)}function u(m,x){return(m>>>x&1)!=0}function f(m){if(!m)throw new Error("Assertion error")}var h=function(){function m(x,_,p){if(this.mode=x,this.numChars=_,this.bitData=p,_<0)throw new RangeError("Invalid argument");this.bitData=p.slice()}return m.makeBytes=function(x){for(var _=[],p=0,C=x;p<C.length;p++){var y=C[p];i(y,8,_)}return new m(m.Mode.BYTE,x.length,_)},m.makeNumeric=function(x){if(!m.isNumeric(x))throw new RangeError("String contains non-numeric characters");for(var _=[],p=0;p<x.length;){var C=Math.min(x.length-p,3);i(parseInt(x.substring(p,p+C),10),C*3+1,_),p+=C}return new m(m.Mode.NUMERIC,x.length,_)},m.makeAlphanumeric=function(x){if(!m.isAlphanumeric(x))throw new RangeError("String contains unencodable characters in alphanumeric mode");var _=[],p;for(p=0;p+2<=x.length;p+=2){var C=m.ALPHANUMERIC_CHARSET.indexOf(x.charAt(p))*45;C+=m.ALPHANUMERIC_CHARSET.indexOf(x.charAt(p+1)),i(C,11,_)}return p<x.length&&i(m.ALPHANUMERIC_CHARSET.indexOf(x.charAt(p)),6,_),new m(m.Mode.ALPHANUMERIC,x.length,_)},m.makeSegments=function(x){return x==""?[]:m.isNumeric(x)?[m.makeNumeric(x)]:m.isAlphanumeric(x)?[m.makeAlphanumeric(x)]:[m.makeBytes(m.toUtf8ByteArray(x))]},m.makeEci=function(x){var _=[];if(x<0)throw new RangeError("ECI assignment value out of range");if(x<128)i(x,8,_);else if(x<16384)i(2,2,_),i(x,14,_);else if(x<1e6)i(6,3,_),i(x,21,_);else throw new RangeError("ECI assignment value out of range");return new m(m.Mode.ECI,0,_)},m.isNumeric=function(x){return m.NUMERIC_REGEX.test(x)},m.isAlphanumeric=function(x){return m.ALPHANUMERIC_REGEX.test(x)},m.prototype.getData=function(){return this.bitData.slice()},m.getTotalBits=function(x,_){for(var p=0,C=0,y=x;C<y.length;C++){var S=y[C],B=S.mode.numCharCountBits(_);if(S.numChars>=1<<B)return 1/0;p+=4+B+S.bitData.length}return p},m.toUtf8ByteArray=function(x){x=encodeURI(x);for(var _=[],p=0;p<x.length;p++)x.charAt(p)!="%"?_.push(x.charCodeAt(p)):(_.push(parseInt(x.substring(p+1,p+3),16)),p+=2);return _},m.NUMERIC_REGEX=/^[0-9]*$/,m.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,m.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",m}();o.QrSegment=h})(Jn||(Jn={})),function(o){(function(s){var i=function(){function u(f,h){this.ordinal=f,this.formatBits=h}return u.LOW=new u(0,1),u.MEDIUM=new u(1,0),u.QUARTILE=new u(2,3),u.HIGH=new u(3,2),u}();s.Ecc=i})(o.QrCode||(o.QrCode={}))}(Jn||(Jn={})),function(o){(function(s){var i=function(){function u(f,h){this.modeBits=f,this.numBitsCharCount=h}return u.prototype.numCharCountBits=function(f){return this.numBitsCharCount[Math.floor((f+7)/17)]},u.NUMERIC=new u(1,[10,12,14]),u.ALPHANUMERIC=new u(2,[9,11,13]),u.BYTE=new u(4,[8,16,16]),u.KANJI=new u(8,[8,10,12]),u.ECI=new u(7,[0,0,0]),u}();s.Mode=i})(o.QrSegment||(o.QrSegment={}))}(Jn||(Jn={}));var pr=Jn,fo="L",ho={L:pr.QrCode.Ecc.LOW,M:pr.QrCode.Ecc.MEDIUM,Q:pr.QrCode.Ecc.QUARTILE,H:pr.QrCode.Ecc.HIGH},fd=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}();function go(o){return o in ho}function aa(o,s){s===void 0&&(s=0);var i=[];return o.forEach(function(u,f){var h=null;u.forEach(function(m,x){if(!m&&h!==null){i.push("M".concat(h+s," ").concat(f+s,"h").concat(x-h,"v1H").concat(h+s,"z")),h=null;return}if(x===u.length-1){if(!m)return;h===null?i.push("M".concat(x+s,",").concat(f+s," h1v1H").concat(x+s,"z")):i.push("M".concat(h+s,",").concat(f+s," h").concat(x+1-h,"v1H").concat(h+s,"z"));return}m&&h===null&&(h=x)})}),i.join("")}function la(o,s,i,u){var f=u.width,h=u.height,m=u.x,x=u.y,_=o.length+i*2,p=Math.floor(s*.1),C=_/s,y=(f||p)*C,S=(h||p)*C,B=m==null?o.length/2-y/2:m*C,T=x==null?o.length/2-S/2:x*C,D=null;if(u.excavate){var v=Math.floor(B),U=Math.floor(T),P=Math.ceil(y+B-v),O=Math.ceil(S+T-U);D={x:v,y:U,w:P,h:O}}return{x:B,y:T,h:S,w:y,excavation:D}}function ca(o,s){return o.slice().map(function(i,u){return u<s.y||u>=s.y+s.h?i:i.map(function(f,h){return h<s.x||h>=s.x+s.w?f:!1})})}var mo={value:{type:String,required:!0,default:""},size:{type:Number,default:100},level:{type:String,default:fo,validator:function(o){return go(o)}},background:{type:String,default:"#fff"},foreground:{type:String,default:"#000"},margin:{type:Number,required:!1,default:0},imageSettings:{type:Object,required:!1,default:function(){return{}}},gradient:{type:Boolean,required:!1,default:!1},gradientType:{type:String,required:!1,default:"linear",validator:function(o){return["linear","radial"].indexOf(o)>-1}},gradientStartColor:{type:String,required:!1,default:"#000"},gradientEndColor:{type:String,required:!1,default:"#fff"}},hd=Sn(Sn({},mo),{renderAs:{type:String,required:!1,default:"canvas",validator:function(o){return["canvas","svg"].indexOf(o)>-1}}}),gd=l.defineComponent({name:"QRCodeSvg",props:mo,setup:function(o){var s=l.ref(0),i=l.ref(""),u,f=function(){var m=o.value,x=o.level,_=o.margin,p=_>>>0,C=go(x)?x:fo,y=pr.QrCode.encodeText(m,ho[C]).getModules();if(s.value=y.length+p*2,o.imageSettings.src){var S=la(y,o.size,p,o.imageSettings);u={x:S.x+p,y:S.y+p,width:S.w,height:S.h},S.excavation&&(y=ca(y,S.excavation))}i.value=aa(y,p)},h=function(){if(!o.gradient)return null;var m=o.gradientType==="linear"?{x1:"0%",y1:"0%",x2:"100%",y2:"100%"}:{cx:"50%",cy:"50%",r:"50%",fx:"50%",fy:"50%"};return l.h(o.gradientType==="linear"?"linearGradient":"radialGradient",Sn({id:"qr-gradient"},m),[l.h("stop",{offset:"0%",style:{stopColor:o.gradientStartColor}}),l.h("stop",{offset:"100%",style:{stopColor:o.gradientEndColor}})])};return f(),l.onUpdated(f),function(){return l.h("svg",{width:o.size,height:o.size,"shape-rendering":"crispEdges",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 ".concat(s.value," ").concat(s.value)},[l.h("defs",{},[h()]),l.h("rect",{width:"100%",height:"100%",fill:o.background}),l.h("path",{fill:o.gradient?"url(#qr-gradient)":o.foreground,d:i.value}),o.imageSettings.src&&l.h("image",Sn({href:o.imageSettings.src},u))])}}}),md=l.defineComponent({name:"QRCodeCanvas",props:mo,setup:function(o,s){var i=l.ref(null),u=l.ref(null),f=function(){var m=o.value,x=o.level,_=o.size,p=o.margin,C=o.background,y=o.foreground,S=o.gradient,B=o.gradientType,T=o.gradientStartColor,D=o.gradientEndColor,v=p>>>0,U=go(x)?x:fo,P=i.value;if(P){var O=P.getContext("2d");if(O){var M=pr.QrCode.encodeText(m,ho[U]).getModules(),K=M.length+v*2,Q=u.value,W={x:0,y:0,width:0,height:0},oe=o.imageSettings.src&&Q!=null&&Q.naturalWidth!==0&&Q.naturalHeight!==0;if(oe){var V=la(M,o.size,v,o.imageSettings);W={x:V.x+v,y:V.y+v,width:V.w,height:V.h},V.excavation&&(M=ca(M,V.excavation))}var ce=window.devicePixelRatio||1,j=_/K*ce;if(P.height=P.width=_*ce,O.scale(j,j),O.fillStyle=C,O.fillRect(0,0,K,K),S){var G=void 0;B==="linear"?G=O.createLinearGradient(0,0,K,K):G=O.createRadialGradient(K/2,K/2,0,K/2,K/2,K/2),G.addColorStop(0,T),G.addColorStop(1,D),O.fillStyle=G}else O.fillStyle=y;fd?O.fill(new Path2D(aa(M,v))):M.forEach(function(z,X){z.forEach(function(N,Y){N&&O.fillRect(Y+v,X+v,1,1)})}),oe&&O.drawImage(Q,W.x,W.y,W.width,W.height)}}};l.onMounted(f),l.onUpdated(f);var h=s.attrs.style;return function(){return l.h(l.Fragment,[l.h("canvas",Sn(Sn({},s.attrs),{ref:i,style:Sn(Sn({},h),{width:"".concat(o.size,"px"),height:"".concat(o.size,"px")})})),o.imageSettings.src&&l.h("img",{ref:u,src:o.imageSettings.src,style:{display:"none"},onLoad:f})])}}}),pd=l.defineComponent({name:"Qrcode",render:function(){var o=this.$props,s=o.renderAs,i=o.value,u=o.size,f=o.margin,h=o.level,m=o.background,x=o.foreground,_=o.imageSettings,p=o.gradient,C=o.gradientType,y=o.gradientStartColor,S=o.gradientEndColor;return l.h(s==="svg"?gd:md,{value:i,size:u,margin:f,level:h,background:m,foreground:x,imageSettings:_,gradient:p,gradientType:C,gradientStartColor:y,gradientEndColor:S})},props:hd});const xd={},wd={viewBox:"0 0 24 24","aria-hidden":"true"};function _d(o,s){return l.openBlock(),l.createElementBlock("svg",wd,[...s[0]||(s[0]=[l.createElementVNode("path",{d:"M7 4h10a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z"},null,-1),l.createElementVNode("path",{d:"M9 7h6"},null,-1),l.createElementVNode("path",{d:"M10 18h4"},null,-1)])])}const Cd=ze(xd,[["render",_d]]),Ed={},yd={viewBox:"0 0 24 24","aria-hidden":"true"};function bd(o,s){return l.openBlock(),l.createElementBlock("svg",yd,[...s[0]||(s[0]=[l.createStaticVNode('<path d="M4 8V6a2 2 0 0 1 2-2h2"></path><path d="M20 8V6a2 2 0 0 0-2-2h-2"></path><path d="M4 16v2a2 2 0 0 0 2 2h2"></path><path d="M20 16v2a2 2 0 0 1-2 2h-2"></path><path d="M7 12h10"></path>',5)])])}const Ad=ze(Ed,[["render",bd]]),Id="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%2019.6108%2014.0107'%20width='19.610840'%20height='14.010742'%20fill='none'%20customFrame='%23000000'%3e%3cpath%20id='Форма%20'%20d='M18.3054%201.30566L6.61792%2012.639L1.30542%207.48747'%20stroke='rgb(255,255,255)'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='2.5999999'/%3e%3c/svg%3e",Sd={class:"wrapper_qr_page"},Nd=["src"],Td={class:"modal_qr"},kd={class:"modal_qr_content"},Rd={class:"wrapper_icon_qr"},Od=["src"],Md={class:"total_order_price"},Bd={class:"ttl_wrapper"},vd={class:"ttl_head"},Dd={class:"ttl_bar"},Pd={class:"hint hint-anim","aria-label":"Инструкция по оплате"},Ld={class:"steps","aria-hidden":"true"},Fd={class:"step is-active","data-i":"0"},Vd={class:"ico"},Ud={class:"step","data-i":"1"},zd={class:"ico"},Hd={class:"step","data-i":"2"},Gd={class:"ico"},Wd=["src"],Xd={class:"qr_border"},jd=ze(l.defineComponent({__name:"CompletedQRCode",setup(o){const s=bt(),i=At(),u=at(),f=ke.useRouter(),h={src:s.itemThemes.logo||"",width:60,height:60,excavate:!0},m=l.computed(()=>s.itemThemes.kiosk_qr_payment_timeout||60).value,x=l.ref(m);let _=0;const p=l.computed(()=>{const D=Math.floor(x.value/60),v=x.value%60;return`${D}:${v.toString().padStart(2,"0")}`}),C=l.computed(()=>x.value/m*100),y=l.computed(()=>i.paymentCostQR),S=()=>{x.value--,x.value<=0&&(clearInterval(_),B())},B=()=>{u.removeFromLocalStorage(["cart","authTokensAccess","authTokensRefresh","user"]),sessionStorage.removeItem("is_adult"),f.replace({name:"home"}).then(()=>f.go(0))};l.onMounted(()=>{_=setInterval(S,1e3)}),l.onBeforeUnmount(()=>{clearInterval(_)});const{mediaUrl:T}=Pn(()=>s.itemThemes.kiosk_preloader?"preloader":null);return(D,v)=>(l.openBlock(),l.createElementBlock("div",Sd,[(l.openBlock(),l.createElementBlock("video",{loop:"",autoplay:"",muted:"",playsinline:"",key:l.unref(T)},[l.createElementVNode("source",{src:l.unref(T)||"",type:"video/webm"},null,8,Nd)])),v[7]||(v[7]=l.createElementVNode("div",{class:"start_img_black"},null,-1)),l.createElementVNode("div",Td,[l.createElementVNode("div",kd,[l.createElementVNode("div",Rd,[l.createElementVNode("img",{src:l.unref(sa),width:"100",height:"100"},null,8,Od)]),v[6]||(v[6]=l.createElementVNode("h1",null,"Оплата по QR",-1)),l.createElementVNode("p",Md,[l.createVNode(Ht,{price:y.value,fixedFloat:2},null,8,["price"]),l.createTextVNode(" "+l.toDisplayString(l.unref(u).config_lib.currency_symbol),1)]),l.createElementVNode("div",Bd,[l.createElementVNode("div",vd,[v[0]||(v[0]=l.createElementVNode("span",null,"Срок жизни QR-кода",-1)),l.createElementVNode("b",null,l.toDisplayString(p.value),1)]),l.createElementVNode("div",Dd,[l.createElementVNode("div",{class:"ttl_fill",style:l.normalizeStyle({width:`${C.value}%`})},null,4)])]),l.createElementVNode("p",Pd,[l.createElementVNode("div",Ld,[l.createElementVNode("div",Fd,[l.createElementVNode("div",Vd,[l.createVNode(Cd)]),v[1]||(v[1]=l.createElementVNode("div",{class:"txt"},"Возьмите телефон →",-1))]),v[4]||(v[4]=l.createElementVNode("div",{class:"sep"},null,-1)),l.createElementVNode("div",Ud,[l.createElementVNode("div",zd,[l.createVNode(Ad)]),v[2]||(v[2]=l.createElementVNode("span",{class:"txt"},"Отсканируйте QR-код",-1))]),v[5]||(v[5]=l.createElementVNode("span",{class:"sep"},"→",-1)),l.createElementVNode("div",Hd,[l.createElementVNode("div",Gd,[l.createElementVNode("img",{src:l.unref(Id),width:"30",height:"30"},null,8,Wd)]),v[3]||(v[3]=l.createElementVNode("span",{class:"txt"},"Оплатите заказ",-1))])])]),l.createElementVNode("div",Xd,[l.createVNode(pd,{value:l.unref(i).linkQR,size:200,level:"Q","render-as":"svg","image-settings":h},null,8,["value"])]),l.createVNode(cn,{textButtonDefault:"Отменить заказ",onClick:B,class:"cancel_order_btn"})])])]))}}),[["__scopeId","data-v-bd3b4b16"]]),qd={key:0,class:"wrapper_qr"},Zd={key:1,class:"wrapper_qr"},Yd={key:2,class:"wrapper_qr"},$d={key:3,class:"wrapper_qr"},Kd=ze(l.defineComponent({__name:"CartCompletedOrder",props:{orderNumber:{}},setup(o){const s=At(),i=bt(),{orderNumber:u,orderCompleted_lib:f}=we.storeToRefs(s),{mediaUrl:h}=Pn(()=>i.itemThemes.kiosk_preloader?"preloader":null);return(m,x)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[l.unref(f)&&l.unref(f)===1?(l.openBlock(),l.createElementBlock("section",qd,[l.createVNode(ad)])):l.unref(f)&&l.unref(f)===2?(l.openBlock(),l.createElementBlock("section",Zd,[l.createVNode(dd)])):l.createCommentVNode("",!0),l.unref(f)&&l.unref(f)===3?(l.openBlock(),l.createElementBlock("section",Yd,[l.createVNode(id,{orderNumber:l.unref(u),mediaUrl:l.unref(h)},null,8,["orderNumber","mediaUrl"])])):l.createCommentVNode("",!0),l.unref(f)&&l.unref(f)===4?(l.openBlock(),l.createElementBlock("section",$d,[l.createVNode(jd)])):l.createCommentVNode("",!0)],64))}}),[["__scopeId","data-v-3779e8ee"]]);function Qd(){const o=ke.useRoute(),s=At(),i=at(),{isButtonDisabled:u}=we.storeToRefs(s),f=(m,x)=>{const _=m.is_tableservice?"tableservice":m.kiosk_menu?"kiosk":"qr",p=s.createPaymentHandler(_,m.kiosk_menu,m.is_tableservice,x);return p?{...p.config,route:{params:{orgId:String(o.params.orgId)}},handler:p.handler,setButtonDisabled:C=>{u.value=C},on403Kiosk:()=>{localStorage.removeItem("apiKey"),i.is_showApiKey=!0}}:null};return{getCreateOrderConfig:f,makeCreateOrderRequest:async(m,x)=>{const _=f(m,x.paymentMethodId);if(_)return Au(x.items,x.tableDataId,_,{comment:x.comment,is_authorized:x.isAuthorized,signal:x.signal})}}}const Jd={},ef={class:"cart_loyal_qr",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"};function tf(o,s){return l.openBlock(),l.createElementBlock("svg",ef,[...s[0]||(s[0]=[l.createElementVNode("path",{d:"M19 20H20M16 20H14V17M17 17H20V14H19M14 14H16M4 16.9997C4 16.0679 4 15.6019 4.15224 15.2344C4.35523 14.7443 4.74432 14.3552 5.23438 14.1522C5.60192 14 6.06786 14 6.99974 14C7.93163 14 8.39808 14 8.76562 14.1522C9.25568 14.3552 9.64467 14.7443 9.84766 15.2344C9.9999 15.6019 9.9999 16.0681 9.9999 17C9.9999 17.9319 9.9999 18.3978 9.84766 18.7654C9.64467 19.2554 9.25568 19.6447 8.76562 19.8477C8.39808 19.9999 7.93162 19.9999 6.99974 19.9999C6.06786 19.9999 5.60192 19.9999 5.23438 19.8477C4.74432 19.6447 4.35523 19.2557 4.15224 18.7656C4 18.3981 4 17.9316 4 16.9997ZM14 6.99974C14 6.06786 14 5.60192 14.1522 5.23438C14.3552 4.74432 14.7443 4.35523 15.2344 4.15224C15.6019 4 16.0679 4 16.9997 4C17.9316 4 18.3981 4 18.7656 4.15224C19.2557 4.35523 19.6447 4.74432 19.8477 5.23438C19.9999 5.60192 19.9999 6.06812 19.9999 7C19.9999 7.93188 19.9999 8.39783 19.8477 8.76537C19.6447 9.25542 19.2557 9.64467 18.7656 9.84766C18.3981 9.9999 17.9316 9.9999 16.9997 9.9999C16.0679 9.9999 15.6019 9.9999 15.2344 9.84766C14.7443 9.64467 14.3552 9.25568 14.1522 8.76562C14 8.39808 14 7.93163 14 6.99974ZM4 6.99974C4 6.06786 4 5.60192 4.15224 5.23438C4.35523 4.74432 4.74432 4.35523 5.23438 4.15224C5.60192 4 6.06786 4 6.99974 4C7.93163 4 8.39808 4 8.76562 4.15224C9.25568 4.35523 9.64467 4.74432 9.84766 5.23438C9.9999 5.60192 9.9999 6.06812 9.9999 7C9.9999 7.93188 9.9999 8.39783 9.84766 8.76537C9.64467 9.25542 9.25568 9.64467 8.76562 9.84766C8.39808 9.9999 7.93162 9.9999 6.99974 9.9999C6.06786 9.9999 5.60192 9.9999 5.23438 9.84766C4.74432 9.64467 4.35523 9.25568 4.15224 8.76562C4 8.39808 4 7.93163 4 6.99974Z",stroke:"white","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const nf=ze(Jd,[["render",tf]]),ua=o=>{const s=uo(),i=x=>s.open(o,x),u=()=>s.close(o),f=s.state(o),h=l.computed({get:()=>f.value.visible,set:x=>x&&i()||u()}),m=l.computed(()=>f.value.context);return{visible:h,context:m,open:i,close:u}},rf={class:"cart_deletion_modal_content"},of={class:"cart_deletion_modal_title"},sf={class:"cart_deletion_modal_footer"},af=ze(l.defineComponent({__name:"CartDeleteConfirm",emits:["confirm"],setup(o,{emit:s}){const i=s,{visible:u,context:f,close:h}=ua("cart-delete-confirm"),m=()=>{i("confirm",f.value.idSystem),h()};return(x,_)=>(l.openBlock(),l.createBlock(l.Transition,{name:"fade"},{default:l.withCtx(()=>[l.unref(u)?(l.openBlock(),l.createElementBlock("div",{key:0,class:"cart_deletion_modal_overlay",onClick:_[1]||(_[1]=l.withModifiers((...p)=>l.unref(h)&&l.unref(h)(...p),["self"]))},[l.createElementVNode("div",rf,[l.createElementVNode("div",of,"Удалить "+l.toDisplayString(l.unref(f).name)+"?",1),_[2]||(_[2]=l.createElementVNode("div",{class:"cart_deletion_modal_body"},"Эта позиция будет полностью удалена из заказа.",-1)),l.createElementVNode("div",sf,[l.createElementVNode("button",{class:"primary",onClick:m}," Удалить "),l.createElementVNode("button",{onClick:_[0]||(_[0]=(...p)=>l.unref(h)&&l.unref(h)(...p))},"Отмена")])])])):l.createCommentVNode("",!0)]),_:1}))}}),[["__scopeId","data-v-018f66f3"]]),lf={class:"cart_wrapper"},cf={class:"cart_header_content"},uf={key:0,class:"cart_header_subwrapper"},df={class:"cart_kso_button_wrapper"},ff={key:0},hf={key:0,class:"kso_btn_wrapper"},gf=["src"],mf={key:0,class:"cart_qr_button_wrapper"},pf={class:"cart_header_info"},xf={class:"cart_header_info"},wf={class:"cart_header_info"},_f={class:"cart_header_info"},Cf={key:1,class:"cart-tabs-wrapper"},Ef={class:"cart-tabs-container"},yf=["data-active","onClick"],bf={key:0,class:"wrapper_comment"},Af={class:"wrapper_limit_in_area"},If=["placeholder","aria-invalid"],Sf={class:"limit_comment"},Nf={key:1,class:"wrapper_comment"},Tf={class:"wrapper_limit_in_area"},kf=["placeholder","aria-invalid"],Rf={class:"limit_comment"},Of={key:2},Mf={class:"cart_cards"},Bf={class:"cart_footer_wrapper"},vf={key:0,class:"footer_title"},Df=["disabled","max"],Pf={key:1,class:"footer_sales"},Lf=["step","max"],Ff={class:"list_price"},Vf={key:0},Uf={key:1},zf={key:2},Hf={class:"accept_field"},Gf={class:"accept_field"},Wf={key:3},Xf={class:"accept_field"},jf={class:"accept_field"},qf={class:"accept_field"},Zf={key:3,class:"cart_min_order_notice"},Yf={class:"wrapper_footer_cart_btn"},$f=l.defineComponent({__name:"CartPage",props:{configPage:{},textPaymentBtn:{},config_qr:{type:Boolean}},setup(o){const s=An.create();let i;const u=at(),f=At(),h=bt(),m=o,{totalPrice_lib:x,countBonus:_,config_lib:p,cartProducts_lib:C,profile:y}=we.storeToRefs(u),{itemThemes:S}=we.storeToRefs(h),{textPaymentBtn_lib:B,isButtonDisabled:T,orderCompleted_lib:D,orderNumber:v,extraDiscount:U,is_notification_lib:P,isCreateButtonVisible:O,is_paymentCart:M,providerTypes:K,notificationData_lib:Q,selectedProvider:W,configPayment:oe}=we.storeToRefs(f),V=ke.useRouter(),ce=ke.useRoute(),j=l.useTemplateRef("stickerLoyality"),G=l.ref(!1),z=l.ref(!1),X=l.ref(!1),N=l.useTemplateRef("commentEl"),Y=l.ref(""),H=l.ref(!1),te=l.ref(!1),Z=l.ref(!1),re=l.ref(0),ge=l.ref(0),me=l.ref(),Ie=l.computed(()=>m.configPage.qr_menu?"YOOKASSA_BASE":K.value[0].front_type),_e=l.computed(()=>m.configPage.qr_menu?"YOOKASSA":K.value[0].type),Fe=l.computed(()=>{var ye,ie;return m.configPage.kiosk_menu&&((ye=p.value)==null?void 0:ye.loyalty)==="IIKO"&&(p.value.has_loyalty_default_user||y.value)||m.configPage.qr_menu&&((ie=p.value)==null?void 0:ie.loyalty)==="IIKO"&&y.value}),{width:xe}=zt.useElementSize(j,{width:0,height:0},{box:"border-box"}),lt=l.computed(()=>{const ye={energy_amount:0,proteins_amount:0,fat_amount:0,carbohydrates_amount:0};return C.value.reduce((ie,se)=>(ie.energy_amount+=(se.energy_amount||0)*(se.amount||0),ie.proteins_amount+=(se.proteins_amount||0)*(se.amount||0),ie.fat_amount+=(se.fat_amount||0)*(se.amount||0),ie.carbohydrates_amount+=(se.carbohydrates_amount||0)*(se.amount||0),ie),ye)}),Oe=l.computed(()=>{var ye;if((ye=S.value)!=null&&ye.comments){const ie=S.value.comments;return{fieldName:m.configPage.kiosk_menu?ie.kiosk_comment_field_name:ie.qr_comment_field_name,placeholder:m.configPage.kiosk_menu?ie.kiosk_comment_field_placeholder:ie.qr_comment_field_placeholder,show:m.configPage.kiosk_menu?ie.kiosk_show_order_comment:ie.qr_show_order_comment}}}),Re=zt.computedAsync(async ye=>{var Qe;const ie=new AbortController;if(ye(()=>ie.abort()),!G.value||!((Qe=y.value)!=null&&Qe.balance))return 0;const se=await s.maxPayByBonuses(me.value,m.configPage.kiosk_menu,!!m.configPage.userData||!!y.value,ie.signal);return se!=null&&se.by_bonuses?(X.value=se.non_integers_allowed||!1,y.value.balance>se.by_bonuses?se.by_bonuses:y.value.balance):0},0,{shallow:!0}),qe=()=>V.push(`/${ce.params.orgId}/`),$e=ye=>{(X.value?["a","A","+","-","."]:["a","A","+","-",".",","]).includes(ye.key)&&ye.preventDefault()},It=ye=>{u.deleteItemFromCart(ye),C.value.length===0&&(te.value=!1,Z.value=!1)},ue=()=>{te.value=!te.value,Y.value.length},Xe=l.computed(()=>{var ie;return(((ie=S.value.cart_loyalty_button)==null?void 0:ie.cart_loyalty_button_text)||"Программа лояльности").replace(/\S+/g,se=>se.length>15?se.slice(0,15)+"...":se)}),Ke=()=>{Z.value=!Z.value,Y.value.length},mt=()=>{let ye=X.value?+_.value.toFixed(2):Math.floor(_.value)||0;ye>Re.value&&(ye=Re.value),ye!==_.value&&u.setBonus(ye)};l.watchEffect(()=>{mt(),u.setBonus(x.value===0?0:X.value?+_.value.toFixed(2):Math.floor(_.value))});const tt=()=>C.value.map(ye=>({id:ye.id,front_item_id:ye.idSystem,is_fake:!!ye.is_fake,is_od_united_product:!!ye.is_od_united_product,removals:ye.removals??null,amount:ye.amount,size:ye.size,modifiers:ye.modifiers??[],group_modifiers:ye.group_modifiers??[]})),{makeCreateOrderRequest:Ue}=Qd(),He=l.computed(()=>tt()),Yt=l.computed(()=>{var ye,ie,se,Qe;return m.configPage.qr_menu&&((ie=(ye=S.value)==null?void 0:ye.comments)==null?void 0:ie.qr_is_order_comment_required)||m.configPage.kiosk_menu&&((Qe=(se=S.value)==null?void 0:se.comments)==null?void 0:Qe.kiosk_is_order_comment_required)}),Ee=()=>{var ye,ie;return Yt.value&&((ie=(ye=Y.value)==null?void 0:ye.trim())==null?void 0:ie.length)<1&&N.value?(f.showNotification("Обязательно перед созданием заказа укажите комментарий к заказу"),N.value.focus(),H.value=!0,yt.animate(N.value.parentElement,{x:[0,-10,0,10,0]},{duration:.1,repeat:2}),!0):!1},_r=async()=>{if(!y.value&&m.configPage.qr_menu){V.push(`/${ce.params.orgId}/register`);return}if(!(Yt.value&&Ee())){if(m.configPage.qr_menu||K.value.length<=1){T.value=!0,await Xs(me.value,_e.value).then(ye=>{const ie=oe.value;ie&&(ie.is_tableservice?Eu(ie,null):ye.url&&m.configPage.qr_menu&&window.location.replace(ye.url))});return}return M.value=!M.value}},bi=()=>{M.value=!1},_n=async()=>{var ie,se,Qe,Ze,rt,Cn;U.value=0;const ye={items:[...tt()],table:((ie=m.configPage)==null?void 0:ie.tableDataId)||null,comment:Y.value,combos:[]};(se=m.configPage)!=null&&se.kiosk_menu&&((Qe=f.selectedOrderType)!=null&&Qe.id)&&(ye.order_type_id=(Ze=f.selectedOrderType)==null?void 0:Ze.id);try{z.value=!0;const Gt=await s.calculateDiscount(ye,m.configPage.kiosk_menu,!!m.configPage.userData||!!y.value,i.signal);if(!C.value)return;C.value.forEach(De=>{const Me=Gt.items.find(ht=>ht.front_item_id===De.idSystem);if(Me&&(De.group_modifiers.forEach(ht=>{const kt=Me.group_modifiers.find(vt=>vt.group===ht.group);kt&&ht.modifiers.forEach(vt=>{const pt=kt.modifiers.find(Fn=>Fn.id===vt.id);if(pt&&Number(vt.price)!==Number(pt==null?void 0:pt.new_price)){const Fn=(pt.discounts||[]).reduce((Rt,Hn)=>Rt+=+Hn.discount,0);re.value+=Fn,vt.new_price=vt.price,vt.price=Number(pt==null?void 0:pt.new_price),vt.total_new_price=Number(pt.total_new_price)}})}),De.modifiers.forEach(ht=>{const kt=Me.modifiers.find(vt=>vt.id===ht.id);if(kt&&Number(ht.price)!==Number(kt==null?void 0:kt.new_price)){const vt=(kt.discounts||[]).reduce((pt,Fn)=>pt+=+Fn.discount,0);re.value+=vt,ht.new_price=ht.price,ht.price=Number(kt==null?void 0:kt.new_price),ht.total_new_price=Number(kt.total_new_price)}}),De.price!==Number(Me.new_price))){const ht=(Me.discounts||[]).reduce((kt,vt)=>kt+=+vt.discount,0);re.value=re.value+ht,De.new_price=De.price,De.price=Me.new_price,De.discounts=Me.discounts,De.total_new_price=Number(Me.total_new_price)}}),C.value=[...C.value],re.value!==0&&(x.value=Gt.total_cart_price)}catch(Gt){if(z.value=!1,!et.isCancel(Gt))throw f.showNotification(((Cn=(rt=Gt==null?void 0:Gt.response)==null?void 0:rt.data)==null?void 0:Cn.user_friendly_message)||"Скидки временно недоступны"),Gt}},Gr=async()=>{var ye;if(!(Yt.value&&Ee())){me.value=null,i=new AbortController,T.value=!0;try{Fe.value&&await _n(),W.value={front_type:Ie};const ie={paymentMethodId:Ie.value,items:He.value,tableDataId:m.configPage.tableDataId,comment:Y.value,isAuthorized:!!m.configPage.userData||!!y,signal:i==null?void 0:i.signal},se=await Ue(m.configPage,ie);me.value=(ye=se==null?void 0:se.data)==null?void 0:ye.id,O.value=!1}catch{T.value=!1,O.value=!0}}},sn=()=>{var ye;(ye=y.value)!=null&&ye.balance?y.value.balance>=1&&(G.value=!G.value):f.showNotification("У Вас пока нет бонусов")};l.onMounted(async()=>{B.value=m.textPaymentBtn,u.loadCart(),D.value=null,x.value=null,U.value=0,O.value=!0,C.value.splice(0,C.value.length,...C.value.map(u.makeProductFullyReactive))}),l.onUnmounted(()=>{me.value=null,D.value=null,x.value=null,U.value=0,C.value.splice(0,C.value.length,...C.value.map(u.makeProductFullyReactive))});const Cr=l.computed(()=>x.value-U.value-re.value),$t=l.computed(()=>m.configPage.qr_menu?p.value.qr_order_minimum_price||0:m.configPage.kiosk_menu&&p.value.kiosk_order_minimum_price||0),Bt=l.computed(()=>$t.value>Cr.value||z.value||T.value?!0:["АВТОРИЗОВАТЬСЯ ДЛЯ ЗАКАЗА"].includes(B.value.toUpperCase())?!1:C.value.length===0?!0:(D.value=null,T.value)),Er=l.computed(()=>{var ye;return((ye=C.value)==null?void 0:ye.reduce((ie,se)=>ie+se.amount,0))||0}),nr=l.computed(()=>{var ye;return(ye=y.value)==null?void 0:ye.phone});return l.watch(Y,ye=>{var ie;return((ie=ye==null?void 0:ye.trim())==null?void 0:ie.length)&&(H.value=!1)}),l.watch([Er,nr],()=>{Er.value===0&&(i=null),i==null||i.abort(),T.value=!1}),l.watch([()=>u.cartProducts_lib,nr,Er,()=>f.selectedOrderType],ye=>{if(ge.value>0){ge.value--;return}ye&&!z.value&&(O.value=!0,C.value.splice(0,C.value.length,...C.value.map(u.makeProductFullyReactive)),re.value=0,x.value=null,U.value=0,ge.value=1),z.value=!1},{deep:!0}),(ye,ie)=>{var se,Qe,Ze,rt,Cn,Gt;return l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createElementVNode("div",lf,[l.createVNode(af,{onConfirm:It}),l.createVNode(ra,{visible:l.unref(f).isDrawerOpen,"onUpdate:visible":ie[0]||(ie[0]=De=>l.unref(f).isDrawerOpen=De)},{default:l.withCtx(()=>[l.createVNode(oa)]),_:1},8,["visible"]),l.createElementVNode("header",cf,[m.configPage.kiosk_menu?(l.openBlock(),l.createElementBlock("div",uf,[l.createElementVNode("div",df,[l.createElementVNode("div",{class:l.normalizeClass(["arrow_wrapper",{arrow_wrapper_kso:m.configPage.kiosk_menu}]),onClick:qe},[l.createVNode(Vr,{class:"cart_header_back_button"}),m.configPage.kiosk_menu?(l.openBlock(),l.createElementBlock("span",ff,"Назад")):l.createCommentVNode("",!0)],2)]),Oe.value&&Oe.value.show?(l.openBlock(),l.createElementBlock("div",hf,[Yt.value?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(cn,{key:0,style:l.normalizeStyle({visibility:!te.value&&l.unref(C).length>0?"visible":"hidden"}),class:l.normalizeClass({button_kso_comment:o.configPage.kiosk_menu}),textButtonDefault:Y.value.length>0?"Редактировать":Oe.value&&Oe.value.fieldName||"",onClick:()=>te.value=!te.value,id:"button_kso_comment"},null,8,["style","class","textButtonDefault","onClick"]))])):l.createCommentVNode("",!0),l.createElementVNode("div",{class:l.normalizeClass({cart_header_wrapper:m.configPage.kiosk_menu})},[(l.unref(S).kiosk_show_loyalty_card_button||l.unref(S).kiosk_show_loyalty_phone_input_button)&&!m.config_qr?(l.openBlock(),l.createElementBlock("button",{key:0,class:"buttonDefaultWrapper button_payment_cart button_payment_cart_loyal",style:l.normalizeStyle({marginRight:(se=l.unref(S).cart_loyalty_button)!=null&&se.cart_loyalty_button_sticker?`${Math.ceil(l.unref(xe)/2+10)}px`:"",paddingRight:(Qe=l.unref(S).cart_loyalty_button)!=null&&Qe.cart_loyalty_button_sticker?0:""}),onClick:ie[1]||(ie[1]=(...De)=>l.unref(f).openDrawer&&l.unref(f).openDrawer(...De))},[l.createElementVNode("p",{class:"cart_loyal_program",style:l.normalizeStyle({marginRight:`${Math.ceil(l.unref(xe)/2)}px`})},l.toDisplayString(Xe.value),5),(Ze=l.unref(S).cart_loyalty_button)!=null&&Ze.cart_loyalty_button_sticker?(l.openBlock(),l.createElementBlock("div",{key:0,ref_key:"stickerLoyality",ref:j,class:"cart_loyal_program_icon",style:l.normalizeStyle({"--sticker-mask":`url(${l.unref(S).cart_loyalty_button.cart_loyalty_button_sticker})`})},[l.createElementVNode("img",{src:l.unref(S).cart_loyalty_button.cart_loyalty_button_sticker},null,8,gf)],4)):(l.openBlock(),l.createBlock(nf,{key:1,class:"cart_loyal_qr"}))],4)):l.createCommentVNode("",!0)],2)])):l.createCommentVNode("",!0),l.createElementVNode("div",{class:l.normalizeClass([o.config_qr?"cart_kbju_qr_wrapper":"cart_kbju_kso_wrapper"])},[o.config_qr?(l.openBlock(),l.createElementBlock("div",mf,[l.createElementVNode("div",{class:"arrow_wrapper",onClick:qe},[l.createVNode(Vr,{class:"cart_header_back_button"})])])):l.createCommentVNode("",!0),l.unref(S).show_nutrition_in_cart?(l.openBlock(),l.createElementBlock("div",{key:1,class:"cart_header",style:l.normalizeStyle({paddingTop:m.config_qr?0:"10px",paddingRight:m.config_qr?"10px":0})},[l.createElementVNode("div",pf,[l.createElementVNode("p",null,[l.createVNode(Ht,{price:lt.value.energy_amount,duration:800},null,8,["price"]),ie[8]||(ie[8]=l.createTextVNode(" г",-1))]),ie[9]||(ie[9]=l.createElementVNode("p",{class:"cart_info_name"},"Килокалории",-1))]),l.createElementVNode("div",xf,[l.createElementVNode("p",null,[l.createVNode(Ht,{price:lt.value.proteins_amount,duration:900},null,8,["price"]),ie[10]||(ie[10]=l.createTextVNode(" г",-1))]),ie[11]||(ie[11]=l.createElementVNode("p",{class:"cart_info_name"},"Белки",-1))]),l.createElementVNode("div",wf,[l.createElementVNode("p",null,[l.createVNode(Ht,{price:lt.value.fat_amount,duration:1e3},null,8,["price"]),ie[12]||(ie[12]=l.createTextVNode(" г",-1))]),ie[13]||(ie[13]=l.createElementVNode("p",{class:"cart_info_name"},"Жиры",-1))]),l.createElementVNode("div",_f,[l.createElementVNode("p",null,[l.createVNode(Ht,{price:lt.value.carbohydrates_amount,duration:1100},null,8,["price"]),ie[14]||(ie[14]=l.createTextVNode(" г",-1))]),ie[15]||(ie[15]=l.createElementVNode("p",{class:"cart_info_name"},"Углеводы",-1))])],4)):l.createCommentVNode("",!0)],2),o.configPage.kiosk_menu&&l.unref(f).orderTypes.length>1?(l.openBlock(),l.createElementBlock("div",Cf,[l.createElementVNode("ul",Ef,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(f).orderTypes,De=>{var Me,ht;return l.openBlock(),l.createElementBlock("li",{key:De.id,class:"cart-tab","data-active":De.id===((Me=l.unref(f).selectedOrderType)==null?void 0:Me.id),onClick:kt=>l.unref(f).selectedOrderType=De},[De.id===((ht=l.unref(f).selectedOrderType)==null?void 0:ht.id)?(l.openBlock(),l.createBlock(l.unref(yt.motion).div,{key:0,class:"cart-underline","layout-id":"cart-underline",id:"cart-underline"})):l.createCommentVNode("",!0),l.createElementVNode("span",null,l.toDisplayString(De.name),1)],8,yf)}),128))])])):l.createCommentVNode("",!0)]),(Yt.value||te.value)&&o.configPage.kiosk_menu&&((rt=l.unref(C))!=null&&rt.length)?(l.openBlock(),l.createElementBlock("div",bf,[l.createElementVNode("div",Af,[l.withDirectives(l.createElementVNode("textarea",{ref_key:"commentEl",ref:N,class:"comment_order",placeholder:Oe.value&&Oe.value.placeholder||"Ваш комментарий к заказу...",name:"commentKso",maxlength:"50","aria-invalid":H.value,"onUpdate:modelValue":ie[2]||(ie[2]=De=>Y.value=De)},null,8,If),[[l.vModelText,Y.value]]),l.createElementVNode("p",Sf,l.toDisplayString(Y.value.length+" / 50"),1)]),Yt.value?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(cn,{key:0,textButtonDefault:"Сохранить",onClick:ue,class:"button_bonus_cart"}))])):l.createCommentVNode("",!0),(Yt.value||Z.value)&&o.config_qr&&((Cn=l.unref(C))!=null&&Cn.length)?(l.openBlock(),l.createElementBlock("div",Nf,[l.createElementVNode("div",Tf,[l.withDirectives(l.createElementVNode("textarea",{ref_key:"commentEl",ref:N,class:"comment_order",placeholder:Oe.value&&Oe.value.placeholder||"Ваш комментарий к заказу...",name:"commentQr",maxlength:"50","aria-invalid":H.value,"onUpdate:modelValue":ie[3]||(ie[3]=De=>Y.value=De)},null,8,kf),[[l.vModelText,Y.value]]),l.createElementVNode("p",Rf,l.toDisplayString(Y.value.length+" / 50"),1)]),Yt.value?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(cn,{key:0,textButtonDefault:"Сохранить",onClick:Ke,class:"button_bonus_cart"}))])):l.createCommentVNode("",!0),o.config_qr&&Oe.value&&Oe.value.show?(l.openBlock(),l.createElementBlock("div",Of,[!Yt.value&&!Z.value&&l.unref(C).length>0?(l.openBlock(),l.createBlock(cn,{key:0,textButtonDefault:Y.value.length>0?"Редактировать":Oe.value.fieldName||"",onClick:()=>Z.value=!Z.value,id:"button_comments"},null,8,["textButtonDefault","onClick"])):l.createCommentVNode("",!0)])):l.createCommentVNode("",!0),l.createElementVNode("div",Mf,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(C),De=>(l.openBlock(),l.createBlock(ia,{key:De.idSystem,cardItem:De,onDelete:Me=>It(De.idSystem)},null,8,["cardItem","onDelete"]))),128))]),l.createElementVNode("div",Bf,[G.value&&!l.unref(O)?(l.openBlock(),l.createElementBlock("p",vf,[ie[16]||(ie[16]=l.createTextVNode(" Списать ",-1)),l.withDirectives(l.createElementVNode("input",{type:"number",placeholder:"0",style:l.normalizeStyle({maxWidth:`${l.unref(_).toString().length||1}em`}),disabled:l.unref(y)===null||((Gt=l.unref(y))==null?void 0:Gt.balance)===0,"onUpdate:modelValue":ie[4]||(ie[4]=De=>l.isRef(_)?_.value=De:null),onInput:mt,min:"0",max:l.unref(Re),step:".01",onKeypress:$e},null,44,Df),[[l.vModelText,l.unref(_),void 0,{number:!0}]]),ie[17]||(ie[17]=l.createTextVNode(" бонусов ",-1))])):l.createCommentVNode("",!0),G.value&&!l.unref(O)?(l.openBlock(),l.createElementBlock("p",Pf,"У вас есть "+l.toDisplayString(l.unref(y)?l.unref(y).balance:0)+" B",1)):l.createCommentVNode("",!0),G.value&&!l.unref(O)?l.withDirectives((l.openBlock(),l.createElementBlock("input",{key:2,type:"range",class:"footer_range","onUpdate:modelValue":ie[5]||(ie[5]=De=>l.isRef(_)?_.value=De:null),step:X.value?".01":"1",min:0,max:l.unref(Re)},null,8,Lf)),[[l.vModelText,l.unref(_),void 0,{number:!0}]]):l.createCommentVNode("",!0),l.createElementVNode("ul",Ff,[G.value&&!l.unref(O)?(l.openBlock(),l.createElementBlock("li",Vf,[ie[19]||(ie[19]=l.createElementVNode("p",null,"Сумма заказа:",-1)),l.createElementVNode("p",null,[l.createVNode(Ht,{price:l.unref(x),fixedFloat:2},null,8,["price"]),ie[18]||(ie[18]=l.createTextVNode(" ₽",-1))])])):l.createCommentVNode("",!0),G.value&&!l.unref(O)?(l.openBlock(),l.createElementBlock("li",Uf,[ie[21]||(ie[21]=l.createElementVNode("p",null,"Будет оплачено бонусами:",-1)),l.createElementVNode("p",null,[l.createVNode(Ht,{price:l.unref(_),fixedFloat:2},null,8,["price"]),ie[20]||(ie[20]=l.createTextVNode(" Б",-1))])])):l.createCommentVNode("",!0),l.unref(U)!==0?(l.openBlock(),l.createElementBlock("li",zf,[l.createElementVNode("p",Hf,l.toDisplayString(l.unref(U)>0?"Надбавка":"Скидка")+": ",1),l.createElementVNode("p",Gf,[l.createVNode(Ht,{price:Math.abs(l.unref(U)),fixedFloat:2},null,8,["price"]),ie[22]||(ie[22]=l.createTextVNode(" ₽",-1))])])):re.value!==0?(l.openBlock(),l.createElementBlock("li",Wf,[l.createElementVNode("p",Xf,l.toDisplayString(re.value>0?"Надбавка":"Скидка")+": ",1),l.createElementVNode("p",jf,[l.createVNode(Ht,{price:Math.abs(re.value),fixedFloat:2},null,8,["price"]),ie[23]||(ie[23]=l.createTextVNode(" ₽",-1))])])):l.createCommentVNode("",!0),l.createElementVNode("li",null,[ie[25]||(ie[25]=l.createElementVNode("p",{class:"accept_field"},"Итого к оплате:",-1)),l.createElementVNode("p",qf,[l.createVNode(Ht,{price:l.unref(x)-l.unref(_),fixedFloat:2},null,8,["price"]),ie[24]||(ie[24]=l.createTextVNode(" ₽",-1))])])]),$t.value&&Cr.value<$t.value?(l.openBlock(),l.createElementBlock("div",Zf,[ie[26]||(ie[26]=l.createTextVNode(" Минимальная сумма заказа ",-1)),l.createVNode(Ht,{price:$t.value,fixedFloat:2},null,8,["price"]),l.createTextVNode(" "+l.toDisplayString(l.unref(p).currency_symbol)+". Для оформления заказа необходимо добавить товаров на сумму ",1),l.createVNode(Ht,{price:$t.value-Cr.value,fixedFloat:2},null,8,["price"]),l.createTextVNode(" "+l.toDisplayString(l.unref(p).currency_symbol),1)])):l.createCommentVNode("",!0),l.createElementVNode("div",Yf,[l.unref(y)&&!l.unref(O)?(l.openBlock(),l.createBlock(cn,{key:0,textButtonDefault:l.unref(S).bonuses_button_name||"Бонусы",onClick:sn,class:"button_bonus_cart"},null,8,["textButtonDefault"])):l.createCommentVNode("",!0),l.createVNode(cn,{textButtonDefault:l.unref(O)?"Создать заказ":l.unref(B),onClick:l.unref(O)?Gr:_r,class:"button_payment_cart",disabled:Bt.value},null,8,["textButtonDefault","onClick","disabled"])])])]),l.createVNode(Kd,{orderNumber:l.unref(v),pageNumber:1},null,8,["orderNumber"]),l.createVNode(ao,{visible:l.unref(P),"onUpdate:visible":ie[6]||(ie[6]=De=>l.isRef(P)?P.value=De:null),textNotificationDefault:l.unref(Q).textNotification,backgroundColor:l.unref(S).accent_color?l.unref(S).accent_color:"#FF6D2E",buttonAccept:null},null,8,["visible","textNotificationDefault","backgroundColor"]),l.createVNode(co,{modelValue:l.unref(M),"onUpdate:modelValue":ie[7]||(ie[7]=De=>l.isRef(M)?M.value=De:null),class:"product_card_sheet","snap-points":["80%"]},{default:l.withCtx(()=>{var De;return[l.createVNode($1,{"config-page":o.configPage,comment:Y.value,"cart-items":He.value,"is-authorized":!!m.configPage.userData||!!l.unref(y),"order-id":me.value,signal:(De=l.unref(i))==null?void 0:De.signal,onSelectPayment:bi},null,8,["config-page","comment","cart-items","is-authorized","order-id","signal"])]}),_:1},8,["modelValue"])],64)}}}),Kf={},Qf={viewBox:"0 0 24 24"};function Jf(o,s){return l.openBlock(),l.createElementBlock("svg",Qf,[...s[0]||(s[0]=[l.createElementVNode("path",{d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const eh=ze(Kf,[["render",Jf]]),th={class:"retry_screen"},nh={class:"retry_all_in_screen"},rh={class:"retry_content"},ih={class:"retry_icon_wrap"},oh={class:"retry_icon_circle"},sh={class:"retry_error_x"},ah=l.defineComponent({__name:"RetryPage",setup(o){const s=At(),i=ke.useRouter(),u=ke.useRoute(),f=()=>{s.notificationData_lib.textNotification="",s.is_notification_lib=!1,i.replace(`/${u.params.orgId}/`)};return(h,m)=>(l.openBlock(),l.createElementBlock("section",th,[l.createElementVNode("div",nh,[l.createElementVNode("main",rh,[l.createElementVNode("div",ih,[l.createElementVNode("div",oh,[m[0]||(m[0]=l.createElementVNode("div",{class:"retry_loader_mini"},null,-1)),l.createElementVNode("div",sh,[l.createVNode(eh)])])]),m[1]||(m[1]=l.createElementVNode("div",{class:"retry_oops"},"OOPS",-1)),m[2]||(m[2]=l.createElementVNode("h1",{class:"retry_title"},"Что-то пошло не так",-1)),m[3]||(m[3]=l.createElementVNode("div",{class:"retry_hint"},[l.createElementVNode("p",null,"Похоже, произошёл технический сбой."),l.createElementVNode("p",null,"Мы уже знаем о проблеме и сейчас разбираемся."),l.createElementVNode("p",null,"Приносим извинения за доставленные неудобства."),l.createElementVNode("p",null,"Попробуйте начать новый заказ.")],-1))]),l.createElementVNode("div",{class:"retry_footer"},[l.createElementVNode("button",{onClick:f,class:"retry_new_order_btn"},"Новый заказ")]),m[4]||(m[4]=l.createElementVNode("p",{class:"retry_bottom_note"},"Если ошибка повторяется — обратитесь к сотруднику зала.",-1))])]))}}),lh={class:"wrapper_loader"},ch=l.defineComponent({__name:"Loader",props:{size:{type:String,default:"40px"}},setup(o){return(s,i)=>(l.openBlock(),l.createElementBlock("div",lh,[l.createElementVNode("div",{class:"loader",style:l.normalizeStyle({width:o.size})},null,4)]))}}),uh=ze(l.defineComponent({__name:"AnimationLoader",props:{id:{}},setup(o){const s=l.ref(!0);return l.watch(()=>s.value,()=>{s.value=!1,setTimeout(()=>{s.value=!0},0)}),(i,u)=>(l.openBlock(),l.createElementBlock("div",{class:"opacity-animation",key:o.id},[l.renderSlot(i.$slots,"opacityLoader",{},void 0,!0)]))}}),[["__scopeId","data-v-c6b97942"]]),dh={key:0},fh={class:"card__main__wrapper"},hh={key:0,class:"folder_content_top"},gh={key:0,class:"loader_card_main"},mh=["src","alt"],ph={class:"card_title_price_wrapper"},xh={class:"title"},wh={key:0,class:"price"},_h={key:1},Ch={key:0,class:"card_button_add_wrapper"},da=ze(l.defineComponent({__name:"CardMain",props:{data:{},activeTags:{},is_group:{type:Boolean},parent:{},isLoading:{type:Boolean},selectGroupChild:{type:Function},takeCurrentCard:{type:Function}},setup(o){bt();const s=at(),i=Tt(),{is_18_above_content:u,is18Allowed:f,notificationData_lib:h}=we.storeToRefs(s),{isDesktop:m}=In(),x=o,_=(S,B)=>{var v,U,P;const T={id:S.id,is_fake:S.is_fake||!1,is_od_united_product:S.is_od_united_product||!1,amount:S.amount||1,name:S.name,image_link:S.image_link,price:S.price,old_price:S.price,size:void 0,sizes:[],modifiers:[],groups:S.groups,group_modifiers:[],energy_amount:S.energy_amount??0,proteins_amount:S.proteins_amount??0,fat_amount:S.fat_amount??0,carbohydrates_amount:S.carbohydrates_amount??0},D=!((v=S.modifiers)!=null&&v.length)&&!((U=S.group_modifiers)!=null&&U.length)&&!((P=S.sizes)!=null&&P.length);if(i.isUpSale=!1,S.adult&&!f.value){u.value=!0,D&&(h.value.fastAdd=T);return}if(D){s.addToCart(T);return}if(S.amount||(S.amount=1),x.is_group&&x.selectGroupChild){x.selectGroupChild({...S,parent:x.parent,child:B.child_groups});return}x.takeCurrentCard&&x.takeCurrentCard(B.id)},p=S=>{if(x.is_group&&x.selectGroupChild){S={...S,parent:x.parent,child:S.child_groups},x.selectGroupChild(S);return}if(S.adult&&!f.value){u.value=!0;return}x.takeCurrentCard&&x.takeCurrentCard(S.id)},C=l.computed(()=>x.activeTags.every(S=>x.data.tags.includes(S))),{mediaUrl:y}=Pn(()=>x.data.id+"_image",()=>x.data.image_link);return(S,B)=>{var T;return((T=x.activeTags)==null?void 0:T.length)===0||C.value||x.is_group?(l.openBlock(),l.createElementBlock("div",dh,[l.createVNode(uh,{id:x.data.id},{opacityLoader:l.withCtx(()=>[l.createElementVNode("div",fh,[o.is_group?(l.openBlock(),l.createElementBlock("div",hh)):l.createCommentVNode("",!0),l.createElementVNode("div",{onClick:B[0]||(B[0]=D=>p(x.data)),class:l.normalizeClass(["card__main",{card__main_folder:o.is_group}])},[o.isLoading?(l.openBlock(),l.createElementBlock("div",gh,[l.createVNode(ch)])):(l.openBlock(),l.createElementBlock("div",{key:1,class:l.normalizeClass(["card__main_content",{card_main_desktop_qr:l.unref(m)}])},[l.createElementVNode("img",{src:l.unref(y)||"",class:l.normalizeClass(["img",{card_blur_image:x.data.adult&&!l.unref(f)}]),loading:"lazy",alt:o.data.name},null,10,mh),l.createElementVNode("div",ph,[l.createElementVNode("p",xh,l.toDisplayString(o.data.name),1),o.is_group?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("p",wh,l.toDisplayString(l.unref(ur)(o.data))+" ₽",1))])],2))],2),l.unref(m)?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("div",_h,[o.is_group?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("div",Ch,[l.createElementVNode("div",{onClick:B[1]||(B[1]=D=>_(o.data,x.data)),class:"add_button"},[...B[2]||(B[2]=[l.createElementVNode("div",{class:"image_add_button"},null,-1)])])]))]))])]),_:1},8,["id"])])):l.createCommentVNode("",!0)}}}),[["__scopeId","data-v-bfc53e47"]]),Eh=["id","onClick"],yh=ze(l.defineComponent({__name:"GroupMain",props:{menuGroup:{},idActiveGroup:{},activeTakeGroup:{type:Function}},setup(o){const{shouldUseDragScroll:s}=In(),i=l.ref(null);return(u,f)=>o.menuGroup.length?l.withDirectives((l.openBlock(),l.createElementBlock("ul",{key:0,class:"main__menu",ref_key:"scrollGroup",ref:i},[l.createVNode(io,{axis:"x",behavior:"smooth",container:i.value,autoScroll:!0,idActive:o.idActiveGroup,clearContainer:!0},{default:l.withCtx(({handleTargetClick:h})=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(o.menuGroup,(m,x)=>(l.openBlock(),l.createElementBlock("li",{key:m.id,id:"scrolling"+m.id,onClick:_=>{o.activeTakeGroup&&o.activeTakeGroup(m.id,x),h(_)},style:l.normalizeStyle(o.idActiveGroup==m.id?{fontFamily:"Bounded"}:{})},l.toDisplayString(m.name),13,Eh))),128))]),_:1},8,["container","idActive"])])),[[l.unref(Fr),l.unref(s)?{}:!1]]):l.createCommentVNode("",!0)}}),[["__scopeId","data-v-aa0ca388"]]),bh=["id","onClick"],Ah=ze(l.defineComponent({__name:"TagsMain",props:{menuTags:{default:()=>[]},groupIndex:{default:null},isSolo:{type:Boolean,default:!1},currentActiveTag:{},activeTakeTags:{type:Function,default:void 0},activeTakeTagsSolo:{type:Function,default:void 0}},setup(o){const s=o,{shouldUseDragScroll:i}=In(),u=l.ref(null),f=l.computed(()=>{if(s.isSolo&&!s.groupIndex)return Array.isArray(s.currentActiveTag)?s.currentActiveTag:[];if(s.groupIndex!==null&&s.groupIndex!==void 0){const h=s.currentActiveTag[s.groupIndex];return Array.isArray(h)?h:[]}return[]});return(h,m)=>o.menuTags.length>0?l.withDirectives((l.openBlock(),l.createElementBlock("ul",{key:0,class:"main__filters",ref_key:"scrollTagContainer",ref:u},[l.createVNode(io,{axis:"x",behavior:"smooth",container:u.value,autoScroll:!0,idActive:f.value?f.value[o.currentActiveTag.length-1]:null,clearContainer:!1},{default:l.withCtx(({handleTargetClick:x})=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(o.menuTags,(_,p)=>(l.openBlock(),l.createElementBlock("li",{key:p,id:`scrolling${_}`,onClick:C=>{o.activeTakeTags&&(o.groupIndex||o.groupIndex===0)?o.activeTakeTags(_,o.groupIndex):o.activeTakeTagsSolo&&o.activeTakeTagsSolo(_),x(C)},class:l.normalizeClass({main__filter_active:(f.value??[]).includes(_)})},l.toDisplayString(_),11,bh))),128))]),_:1},8,["container","idActive"])])),[[l.unref(Fr),l.unref(i)?{}:!1]]):l.createCommentVNode("",!0)}}),[["__scopeId","data-v-afba730a"]]),Ih=["data-id"],Sh=["src"],Nh=["src"],Th=ze(l.defineComponent({__name:"DrumItem",props:{group:{},index:{},active:{type:Boolean}},setup(o){const s=o,{mediaUrl:i}=Pn(()=>{var u,f;return(u=s.group)!=null&&u.video_link?`${s.group.id}_video`:(f=s.group)!=null&&f.image_link?`${s.group.id}_image`:null});return(u,f)=>o.group?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass(["drum_item",{active:s.active}]),"data-id":o.group.id},[o.group.video_link?l.withDirectives((l.openBlock(),l.createElementBlock("video",{key:l.unref(i),loop:"",autoplay:"",muted:"",playsinline:"",class:"drum_img"},[l.createElementVNode("source",{src:l.unref(i)||"",type:"video/webm"},null,8,Sh)])),[[l.unref(Ur)]]):(l.openBlock(),l.createElementBlock("img",{key:1,class:"drum_img",src:l.unref(i)||""},null,8,Nh)),l.createElementVNode("p",null,l.toDisplayString(o.group.name),1)],10,Ih)):l.createCommentVNode("",!0)}}),[["__scopeId","data-v-2b994529"]]),kh={},Rh={width:"9.998535",height:"10.000000",viewBox:"0 0 9.99854 10",fill:"none",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"};function Oh(o,s){return l.openBlock(),l.createElementBlock("svg",Rh,[...s[0]||(s[0]=[l.createElementVNode("desc",null," Created with Pixso. ",-1),l.createElementVNode("defs",null,null,-1),l.createElementVNode("path",{id:"Форма 5",d:"M4.23 10L5.76 10L5.76 5.74L9.99 5.74L9.99 4.25L5.76 4.25L5.76 0L4.23 0L4.23 4.25L0 4.25L0 5.74L4.23 5.74L4.23 10Z",fill:"#F2F7FF","fill-opacity":"1.000000","fill-rule":"nonzero"},null,-1)])])}const Mh=ze(kh,[["render",Oh]]),Bh={class:"recommendation_wrapper"},vh={class:"recommendation_header"},Dh={class:"recommendation_info"},Ph=ze(l.defineComponent({__name:"Recommendation",props:{closeCurrentCard:{},openCurrentCard:{}},setup(o){const s=Tt(),{isUpSale:i,dataUpSale:u}=we.storeToRefs(s),f=()=>{i.value=!1};return l.onUnmounted(()=>{u.value=null}),(h,m)=>(l.openBlock(),l.createElementBlock("div",Bh,[l.createElementVNode("div",vh,[m[0]||(m[0]=l.createElementVNode("p",{class:"header_title"},"Часто берут вместе",-1)),l.createElementVNode("div",{class:"header_close",onClick:f},[l.createVNode(Mh,{class:"close_icon"})])]),l.createElementVNode("div",Dh,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(u),x=>(l.openBlock(),l.createBlock(da,{data:x,key:x.id,parent:x.id,is_group:!1,is_product:!0,class:"card",activeTags:[],isLoading:!1,closeCurrentCard:o.closeCurrentCard,takeCurrentCard:()=>o.openCurrentCard(x.id,!0)},null,8,["data","parent","closeCurrentCard","takeCurrentCard"]))),128))])]))}}),[["__scopeId","data-v-d545ec45"]]),Lh=l.defineComponent({__name:"Blackout",props:{data:{type:Boolean}},setup(o){const s=o;return l.watch(()=>s.data,i=>{document.body.style.overflow=i?"hidden":""}),()=>{}}}),Fh={class:"wrapper_modal"},Vh={class:"card_modal"},Uh=ze(l.defineComponent({__name:"ModalWindows",props:{visible:{type:Boolean}},setup(o){const s=o,i=Tt(),{isUpSale:u}=we.storeToRefs(i),f=()=>{u.value=!1};return(h,m)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createVNode(Lh,{data:s.visible},null,8,["data"]),l.createElementVNode("div",{class:"black_modal",onClick:f}),l.createElementVNode("div",Fh,[l.createElementVNode("div",Vh,[l.renderSlot(h.$slots,"default",{},void 0,!0)])])],64))}}),[["__scopeId","data-v-ec2b2c4d"]]);var pe;(function(o){o[o.QR_CODE=0]="QR_CODE",o[o.AZTEC=1]="AZTEC",o[o.CODABAR=2]="CODABAR",o[o.CODE_39=3]="CODE_39",o[o.CODE_93=4]="CODE_93",o[o.CODE_128=5]="CODE_128",o[o.DATA_MATRIX=6]="DATA_MATRIX",o[o.MAXICODE=7]="MAXICODE",o[o.ITF=8]="ITF",o[o.EAN_13=9]="EAN_13",o[o.EAN_8=10]="EAN_8",o[o.PDF_417=11]="PDF_417",o[o.RSS_14=12]="RSS_14",o[o.RSS_EXPANDED=13]="RSS_EXPANDED",o[o.UPC_A=14]="UPC_A",o[o.UPC_E=15]="UPC_E",o[o.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(pe||(pe={}));var fa=new Map([[pe.QR_CODE,"QR_CODE"],[pe.AZTEC,"AZTEC"],[pe.CODABAR,"CODABAR"],[pe.CODE_39,"CODE_39"],[pe.CODE_93,"CODE_93"],[pe.CODE_128,"CODE_128"],[pe.DATA_MATRIX,"DATA_MATRIX"],[pe.MAXICODE,"MAXICODE"],[pe.ITF,"ITF"],[pe.EAN_13,"EAN_13"],[pe.EAN_8,"EAN_8"],[pe.PDF_417,"PDF_417"],[pe.RSS_14,"RSS_14"],[pe.RSS_EXPANDED,"RSS_EXPANDED"],[pe.UPC_A,"UPC_A"],[pe.UPC_E,"UPC_E"],[pe.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]),ha;(function(o){o[o.UNKNOWN=0]="UNKNOWN",o[o.URL=1]="URL"})(ha||(ha={}));function zh(o){return Object.values(pe).includes(o)}var xi;(function(o){o[o.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",o[o.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"})(xi||(xi={}));var Hh=function(){function o(){}return o.GITHUB_PROJECT_URL="https://github.com/mebjas/html5-qrcode",o.SCAN_DEFAULT_FPS=2,o.DEFAULT_DISABLE_FLIP=!1,o.DEFAULT_REMEMBER_LAST_CAMERA_USED=!0,o.DEFAULT_SUPPORTED_SCAN_TYPE=[xi.SCAN_TYPE_CAMERA,xi.SCAN_TYPE_FILE],o}(),ga=function(){function o(s,i){this.format=s,this.formatName=i}return o.prototype.toString=function(){return this.formatName},o.create=function(s){if(!fa.has(s))throw"".concat(s," not in html5QrcodeSupportedFormatsTextMap");return new o(s,fa.get(s))},o}(),ma=function(){function o(){}return o.createFromText=function(s){var i={text:s};return{decodedText:s,result:i}},o.createFromQrcodeResult=function(s){return{decodedText:s.text,result:s}},o}(),po;(function(o){o[o.UNKWOWN_ERROR=0]="UNKWOWN_ERROR",o[o.IMPLEMENTATION_ERROR=1]="IMPLEMENTATION_ERROR",o[o.NO_CODE_FOUND_ERROR=2]="NO_CODE_FOUND_ERROR"})(po||(po={}));var Gh=function(){function o(){}return o.createFrom=function(s){return{errorMessage:s,type:po.UNKWOWN_ERROR}},o}(),Wh=function(){function o(s){this.verbose=s}return o.prototype.log=function(s){this.verbose&&console.log(s)},o.prototype.warn=function(s){this.verbose&&console.warn(s)},o.prototype.logError=function(s,i){(this.verbose||i===!0)&&console.error(s)},o.prototype.logErrors=function(s){if(s.length===0)throw"Logger#logError called without arguments";this.verbose&&console.error(s)},o}();function Ln(o){return typeof o>"u"||o===null}var xr=function(){function o(){}return o.codeParseError=function(s){return"QR code parse error, error = ".concat(s)},o.errorGettingUserMedia=function(s){return"Error getting userMedia, error = ".concat(s)},o.onlyDeviceSupportedError=function(){return"The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."},o.cameraStreamingNotSupported=function(){return"Camera streaming not supported by the browser."},o.unableToQuerySupportedDevices=function(){return"Unable to query supported devices, unknown error."},o.insecureContextCameraQueryError=function(){return"Camera access is only supported in secure context like https or localhost."},o.scannerPaused=function(){return"Scanner paused"},o}(),pa=function(){function o(){}return o.isMediaStreamConstraintsValid=function(s,i){if(typeof s!="object"){var u=typeof s;return i.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(u,"."),!0),!1}for(var f=["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"],h=new Set(f),m=Object.keys(s),x=0,_=m;x<_.length;x++){var p=_[x];if(h.has(p))return i.logError("".concat(p," is not supported videoConstaints."),!0),!1}return!0},o}(),xo={exports:{}};(function(o,s){(function(i,u){u(s)})(mr,function(i){function u(b){return b==null}var f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(b,e){b.__proto__=e}||function(b,e){for(var t in e)e.hasOwnProperty(t)&&(b[t]=e[t])};function h(b,e){f(b,e);function t(){this.constructor=b}b.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function m(b,e){var t=Object.setPrototypeOf;t?t(b,e):b.__proto__=e}function x(b,e){e===void 0&&(e=b.constructor);var t=Error.captureStackTrace;t&&t(b,e)}var _=function(b){h(e,b);function e(t){var n=this.constructor,r=b.call(this,t)||this;return Object.defineProperty(r,"name",{value:n.name,enumerable:!1}),m(r,n.prototype),x(r),r}return e}(Error);class p extends _{constructor(e=void 0){super(e),this.message=e}getKind(){return this.constructor.kind}}p.kind="Exception";class C extends p{}C.kind="ArgumentException";class y extends p{}y.kind="IllegalArgumentException";class S{constructor(e){if(this.binarizer=e,e===null)throw new y("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 a=this.binarizer.getLuminanceSource().crop(e,t,n,r);return new S(this.binarizer.createBinarizer(a))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new S(this.binarizer.createBinarizer(e))}rotateCounterClockwise45(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new S(this.binarizer.createBinarizer(e))}toString(){try{return this.getBlackMatrix().toString()}catch{return""}}}class B extends p{static getChecksumInstance(){return new B}}B.kind="ChecksumException";class T{constructor(e){this.source=e}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class D{static arraycopy(e,t,n,r,a){for(;a--;)n[r++]=e[t++]}static currentTimeMillis(){return Date.now()}}class v extends p{}v.kind="IndexOutOfBoundsException";class U extends v{constructor(e=void 0,t=void 0){super(t),this.index=e,this.message=t}}U.kind="ArrayIndexOutOfBoundsException";class P{static fill(e,t){for(let n=0,r=e.length;n<r;n++)e[n]=t}static fillWithin(e,t,n,r){P.rangeCheck(e.length,t,n);for(let a=t;a<n;a++)e[a]=r}static rangeCheck(e,t,n){if(t>n)throw new y("fromIndex("+t+") > toIndex("+n+")");if(t<0)throw new U(t);if(n>e)throw new U(n)}static asList(...e){return e}static create(e,t,n){return Array.from({length:e}).map(a=>Array.from({length:t}).fill(n))}static createInt32Array(e,t,n){return Array.from({length:e}).map(a=>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,a=new Int32Array(r);return D.arraycopy(e,t,a,0,r),a}static binarySearch(e,t,n){n===void 0&&(n=P.numberComparator);let r=0,a=e.length-1;for(;r<=a;){const c=a+r>>1,d=n(t,e[c]);if(d>0)r=c+1;else if(d<0)a=c-1;else return c}return-r-1}static numberComparator(e,t){return e-t}}class O{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||(t+=16,e<<=16),e>>>24||(t+=8,e<<=8),e>>>28||(t+=4,e<<=4),e>>>30||(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)}}O.MIN_VALUE_32_BITS=-2147483648,O.MAX_VALUE=Number.MAX_SAFE_INTEGER;class M{constructor(e,t){e===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=e,t==null?this.bits=M.makeArray(e):this.bits=t)}getSize(){return this.size}getSizeInBytes(){return Math.floor((this.size+7)/8)}ensureCapacity(e){if(e>this.bits.length*32){const t=M.makeArray(e);D.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),a=n[r];a&=~((1<<(e&31))-1);const c=n.length;for(;a===0;){if(++r===c)return t;a=n[r]}const d=r*32+O.numberOfTrailingZeros(a);return d>t?t:d}getNextUnset(e){const t=this.size;if(e>=t)return t;const n=this.bits;let r=Math.floor(e/32),a=~n[r];a&=~((1<<(e&31))-1);const c=n.length;for(;a===0;){if(++r===c)return t;a=~n[r]}const d=r*32+O.numberOfTrailingZeros(a);return d>t?t:d}setBulk(e,t){this.bits[Math.floor(e/32)]=t}setRange(e,t){if(t<e||e<0||t>this.size)throw new y;if(t===e)return;t--;const n=Math.floor(e/32),r=Math.floor(t/32),a=this.bits;for(let c=n;c<=r;c++){const d=c>n?0:e&31,w=(2<<(c<r?31:t&31))-(1<<d);a[c]|=w}}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 y;if(t===e)return!0;t--;const r=Math.floor(e/32),a=Math.floor(t/32),c=this.bits;for(let d=r;d<=a;d++){const g=d>r?0:e&31,E=(2<<(d<a?31:t&31))-(1<<g)&4294967295;if((c[d]&E)!==(n?E: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 y("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 y("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 a=0;a<r;a++){let c=0;for(let d=0;d<8;d++)this.get(e)&&(c|=1<<7-d),e++;t[n+a]=c}}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 a=0;a<n;a++){let c=r[a];c=c>>1&1431655765|(c&1431655765)<<1,c=c>>2&858993459|(c&858993459)<<2,c=c>>4&252645135|(c&252645135)<<4,c=c>>8&16711935|(c&16711935)<<8,c=c>>16&65535|(c&65535)<<16,e[t-a]=c}if(this.size!==n*32){const a=n*32-this.size;let c=e[0]>>>a;for(let d=1;d<n;d++){const g=e[d];c|=g<<32-a,e[d-1]=c,c=g>>>a}e[n-1]=c}this.bits=e}static makeArray(e){return new Int32Array(Math.floor((e+31)/32))}equals(e){if(!(e instanceof M))return!1;const t=e;return this.size===t.size&&P.equals(this.bits,t.bits)}hashCode(){return 31*this.size+P.hashCode(this.bits)}toString(){let e="";for(let t=0,n=this.size;t<n;t++)t&7||(e+=" "),e+=this.get(t)?"X":".";return e}clone(){return new M(this.size,this.bits.slice())}}var K;(function(b){b[b.OTHER=0]="OTHER",b[b.PURE_BARCODE=1]="PURE_BARCODE",b[b.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",b[b.TRY_HARDER=3]="TRY_HARDER",b[b.CHARACTER_SET=4]="CHARACTER_SET",b[b.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",b[b.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",b[b.ASSUME_GS1=7]="ASSUME_GS1",b[b.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",b[b.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",b[b.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS"})(K||(K={}));var Q=K;class W extends p{static getFormatInstance(){return new W}}W.kind="FormatException";var oe;(function(b){b[b.Cp437=0]="Cp437",b[b.ISO8859_1=1]="ISO8859_1",b[b.ISO8859_2=2]="ISO8859_2",b[b.ISO8859_3=3]="ISO8859_3",b[b.ISO8859_4=4]="ISO8859_4",b[b.ISO8859_5=5]="ISO8859_5",b[b.ISO8859_6=6]="ISO8859_6",b[b.ISO8859_7=7]="ISO8859_7",b[b.ISO8859_8=8]="ISO8859_8",b[b.ISO8859_9=9]="ISO8859_9",b[b.ISO8859_10=10]="ISO8859_10",b[b.ISO8859_11=11]="ISO8859_11",b[b.ISO8859_13=12]="ISO8859_13",b[b.ISO8859_14=13]="ISO8859_14",b[b.ISO8859_15=14]="ISO8859_15",b[b.ISO8859_16=15]="ISO8859_16",b[b.SJIS=16]="SJIS",b[b.Cp1250=17]="Cp1250",b[b.Cp1251=18]="Cp1251",b[b.Cp1252=19]="Cp1252",b[b.Cp1256=20]="Cp1256",b[b.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",b[b.UTF8=22]="UTF8",b[b.ASCII=23]="ASCII",b[b.Big5=24]="Big5",b[b.GB18030=25]="GB18030",b[b.EUC_KR=26]="EUC_KR"})(oe||(oe={}));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 a=this.values;for(let c=0,d=a.length;c!==d;c++){const g=a[c];V.VALUES_TO_ECI.set(g,this)}for(const c of r)V.NAME_TO_ECI.set(c,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(e){if(e<0||e>=900)throw new W("incorect value");const t=V.VALUES_TO_ECI.get(e);if(t===void 0)throw new W("incorect value");return t}static getCharacterSetECIByName(e){const t=V.NAME_TO_ECI.get(e);if(t===void 0)throw new W("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(oe.Cp437,Int32Array.from([0,2]),"Cp437"),V.ISO8859_1=new V(oe.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),V.ISO8859_2=new V(oe.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),V.ISO8859_3=new V(oe.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),V.ISO8859_4=new V(oe.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),V.ISO8859_5=new V(oe.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),V.ISO8859_6=new V(oe.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),V.ISO8859_7=new V(oe.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),V.ISO8859_8=new V(oe.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),V.ISO8859_9=new V(oe.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),V.ISO8859_10=new V(oe.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),V.ISO8859_11=new V(oe.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),V.ISO8859_13=new V(oe.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),V.ISO8859_14=new V(oe.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),V.ISO8859_15=new V(oe.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),V.ISO8859_16=new V(oe.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),V.SJIS=new V(oe.SJIS,20,"SJIS","Shift_JIS"),V.Cp1250=new V(oe.Cp1250,21,"Cp1250","windows-1250"),V.Cp1251=new V(oe.Cp1251,22,"Cp1251","windows-1251"),V.Cp1252=new V(oe.Cp1252,23,"Cp1252","windows-1252"),V.Cp1256=new V(oe.Cp1256,24,"Cp1256","windows-1256"),V.UnicodeBigUnmarked=new V(oe.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),V.UTF8=new V(oe.UTF8,26,"UTF8","UTF-8"),V.ASCII=new V(oe.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),V.Big5=new V(oe.Big5,28,"Big5"),V.GB18030=new V(oe.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),V.EUC_KR=new V(oe.EUC_KR,30,"EUC_KR","EUC-KR");class ce extends p{}ce.kind="UnsupportedOperationException";class j{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!j.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(j.isDecodeFallbackSupported(n)){let r="";for(let a=0,c=e.length;a<c;a++){let d=e[a].toString(16);d.length<2&&(d="0"+d),r+="%"+d}return decodeURIComponent(r)}if(n.equals(V.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(e.buffer));throw new ce(`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 a=0;a<n.length;a++)r.push(n[a].charCodeAt(0));return new Uint8Array(r)}}class G{static castAsNonUtf8Char(e,t=null){const n=t?t.getName():this.ISO88591;return j.decode(new Uint8Array([e]),n)}static guessEncoding(e,t){if(t!=null&&t.get(Q.CHARACTER_SET)!==void 0)return t.get(Q.CHARACTER_SET).toString();const n=e.length;let r=!0,a=!0,c=!0,d=0,g=0,w=0,E=0,A=0,I=0,R=0,L=0,F=0,q=0,ne=0;const de=e.length>3&&e[0]===239&&e[1]===187&&e[2]===191;for(let fe=0;fe<n&&(r||a||c);fe++){const le=e[fe]&255;c&&(d>0?le&128?d--:c=!1:le&128&&(le&64?(d++,le&32?(d++,le&16?(d++,le&8?c=!1:E++):w++):g++):c=!1)),r&&(le>127&&le<160?r=!1:le>159&&(le<192||le===215||le===247)&&ne++),a&&(A>0?le<64||le===127||le>252?a=!1:A--:le===128||le===160||le>239?a=!1:le>160&&le<224?(I++,L=0,R++,R>F&&(F=R)):le>127?(A++,R=0,L++,L>q&&(q=L)):(R=0,L=0))}return c&&d>0&&(c=!1),a&&A>0&&(a=!1),c&&(de||g+w+E>0)?G.UTF8:a&&(G.ASSUME_SHIFT_JIS||F>=3||q>=3)?G.SHIFT_JIS:r&&a?F===2&&I===2||ne*10>=n?G.SHIFT_JIS:G.ISO88591:r?G.ISO88591:a?G.SHIFT_JIS:c?G.UTF8:G.PLATFORM_DEFAULT_ENCODING}static format(e,...t){let n=-1;function r(c,d,g,w,E,A){if(c==="%%")return"%";if(t[++n]===void 0)return;c=w?parseInt(w.substr(1)):void 0;let I=E?parseInt(E.substr(1)):void 0,R;switch(A){case"s":R=t[n];break;case"c":R=t[n][0];break;case"f":R=parseFloat(t[n]).toFixed(c);break;case"p":R=parseFloat(t[n]).toPrecision(c);break;case"e":R=parseFloat(t[n]).toExponential(c);break;case"x":R=parseInt(t[n]).toString(I||16);break;case"d":R=parseFloat(parseInt(t[n],I||10).toPrecision(c)).toFixed(0);break}R=typeof R=="object"?JSON.stringify(R):(+R).toString(I);let L=parseInt(g),F=g&&g[0]+""=="0"?"0":" ";for(;R.length<L;)R=d!==void 0?R+F:F+R;return R}let a=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(a,r)}static getBytes(e,t){return j.encode(e,t)}static getCharCode(e,t=0){return e.charCodeAt(t)}static getCharAt(e){return String.fromCharCode(e)}}G.SHIFT_JIS=V.SJIS.getName(),G.GB2312="GB2312",G.ISO88591=V.ISO8859_1.getName(),G.EUC_JP="EUC_JP",G.UTF8=V.UTF8.getName(),G.PLATFORM_DEFAULT_ENCODING=G.UTF8,G.ASSUME_SHIFT_JIS=!1;class z{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+=G.castAsNonUtf8Char(e,this.encoding):this.value+=String.fromCharCode(e),this}appendChars(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 X{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 y("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 X(n,t);for(let a=0;a<t;a++){const c=e[a];for(let d=0;d<n;d++)c[d]&&r.set(d,a)}return r}static parseFromString(e,t,n){if(e===null)throw new y("stringRepresentation cannot be null");const r=new Array(e.length);let a=0,c=0,d=-1,g=0,w=0;for(;w<e.length;)if(e.charAt(w)===`
|
|
12
|
+
`||e.charAt(w)==="\r"){if(a>c){if(d===-1)d=a-c;else if(a-c!==d)throw new y("row lengths do not match");c=a,g++}w++}else if(e.substring(w,w+t.length)===t)w+=t.length,r[a]=!0,a++;else if(e.substring(w,w+n.length)===n)w+=n.length,r[a]=!1,a++;else throw new y("illegal character encountered: "+e.substring(w));if(a>c){if(d===-1)d=a-c;else if(a-c!==d)throw new y("row lengths do not match");g++}const E=new X(d,g);for(let A=0;A<a;A++)r[A]&&E.set(Math.floor(A%d),Math.floor(A/d));return E}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 y("input matrix dimensions do not match");const t=new M(Math.floor(this.width/32)+1),n=this.rowSize,r=this.bits;for(let a=0,c=this.height;a<c;a++){const d=a*n,g=e.getRow(a,t).getBitArray();for(let w=0;w<n;w++)r[d+w]^=g[w]}}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 y("Left and top must be nonnegative");if(r<1||n<1)throw new y("Height and width must be at least 1");const a=e+n,c=t+r;if(c>this.height||a>this.width)throw new y("The region must fit inside the matrix");const d=this.rowSize,g=this.bits;for(let w=t;w<c;w++){const E=w*d;for(let A=e;A<a;A++)g[E+Math.floor(A/32)]|=1<<(A&31)&4294967295}}getRow(e,t){t==null||t.getSize()<this.width?t=new M(this.width):t.clear();const n=this.rowSize,r=this.bits,a=e*n;for(let c=0;c<n;c++)t.setBulk(c*32,r[a+c]);return t}setRow(e,t){D.arraycopy(t.getBitArray(),0,this.bits,e*this.rowSize,this.rowSize)}rotate180(){const e=this.getWidth(),t=this.getHeight();let n=new M(e),r=new M(e);for(let a=0,c=Math.floor((t+1)/2);a<c;a++)n=this.getRow(a,n),r=this.getRow(t-1-a,r),n.reverse(),r.reverse(),this.setRow(a,r),this.setRow(t-1-a,n)}getEnclosingRectangle(){const e=this.width,t=this.height,n=this.rowSize,r=this.bits;let a=e,c=t,d=-1,g=-1;for(let w=0;w<t;w++)for(let E=0;E<n;E++){const A=r[w*n+E];if(A!==0){if(w<c&&(c=w),w>g&&(g=w),E*32<a){let I=0;for(;!(A<<31-I&4294967295);)I++;E*32+I<a&&(a=E*32+I)}if(E*32+31>d){let I=31;for(;!(A>>>I);)I--;E*32+I>d&&(d=E*32+I)}}}return d<a||g<c?null:Int32Array.from([a,c,d-a+1,g-c+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 a=n%e*32;const c=t[n];let d=0;for(;!(c<<31-d&4294967295);)d++;return a+=d,Int32Array.from([a,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 a=Math.floor(n%e)*32;const c=t[n];let d=31;for(;!(c>>>d);)d--;return a+=d,Int32Array.from([a,r])}getWidth(){return this.width}getHeight(){return this.height}getRowSize(){return this.rowSize}equals(e){if(!(e instanceof X))return!1;const t=e;return this.width===t.width&&this.height===t.height&&this.rowSize===t.rowSize&&P.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+P.hashCode(this.bits),e}toString(e="X ",t=" ",n=`
|
|
13
|
+
`){return this.buildToString(e,t,n)}buildToString(e,t,n){let r=new z;for(let a=0,c=this.height;a<c;a++){for(let d=0,g=this.width;d<g;d++)r.append(this.get(d,a)?e:t);r.append(n)}return r.toString()}clone(){return new X(this.width,this.height,this.rowSize,this.bits.slice())}}class N extends p{static getNotFoundInstance(){return new N}}N.kind="NotFoundException";class Y extends T{constructor(e){super(e),this.luminances=Y.EMPTY,this.buckets=new Int32Array(Y.LUMINANCE_BUCKETS)}getBlackRow(e,t){const n=this.getLuminanceSource(),r=n.getWidth();t==null||t.getSize()<r?t=new M(r):t.clear(),this.initArrays(r);const a=n.getRow(e,this.luminances),c=this.buckets;for(let g=0;g<r;g++)c[(a[g]&255)>>Y.LUMINANCE_SHIFT]++;const d=Y.estimateBlackPoint(c);if(r<3)for(let g=0;g<r;g++)(a[g]&255)<d&&t.set(g);else{let g=a[0]&255,w=a[1]&255;for(let E=1;E<r-1;E++){const A=a[E+1]&255;(w*4-g-A)/2<d&&t.set(E),g=w,w=A}}return t}getBlackMatrix(){const e=this.getLuminanceSource(),t=e.getWidth(),n=e.getHeight(),r=new X(t,n);this.initArrays(t);const a=this.buckets;for(let g=1;g<5;g++){const w=Math.floor(n*g/5),E=e.getRow(w,this.luminances),A=Math.floor(t*4/5);for(let I=Math.floor(t/5);I<A;I++){const R=E[I]&255;a[R>>Y.LUMINANCE_SHIFT]++}}const c=Y.estimateBlackPoint(a),d=e.getMatrix();for(let g=0;g<n;g++){const w=g*t;for(let E=0;E<t;E++)(d[w+E]&255)<c&&r.set(E,g)}return r}createBinarizer(e){return new Y(e)}initArrays(e){this.luminances.length<e&&(this.luminances=new Uint8ClampedArray(e));const t=this.buckets;for(let n=0;n<Y.LUMINANCE_BUCKETS;n++)t[n]=0}static estimateBlackPoint(e){const t=e.length;let n=0,r=0,a=0;for(let E=0;E<t;E++)e[E]>a&&(r=E,a=e[E]),e[E]>n&&(n=e[E]);let c=0,d=0;for(let E=0;E<t;E++){const A=E-r,I=e[E]*A*A;I>d&&(c=E,d=I)}if(r>c){const E=r;r=c,c=E}if(c-r<=t/16)throw new N;let g=c-1,w=-1;for(let E=c-1;E>r;E--){const A=E-r,I=A*A*(c-E)*(n-e[E]);I>w&&(g=E,w=I)}return g<<Y.LUMINANCE_SHIFT}}Y.LUMINANCE_BITS=5,Y.LUMINANCE_SHIFT=8-Y.LUMINANCE_BITS,Y.LUMINANCE_BUCKETS=1<<Y.LUMINANCE_BITS,Y.EMPTY=Uint8ClampedArray.from([0]);class H extends Y{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>=H.MINIMUM_DIMENSION&&n>=H.MINIMUM_DIMENSION){const r=e.getMatrix();let a=t>>H.BLOCK_SIZE_POWER;t&H.BLOCK_SIZE_MASK&&a++;let c=n>>H.BLOCK_SIZE_POWER;n&H.BLOCK_SIZE_MASK&&c++;const d=H.calculateBlackPoints(r,a,c,t,n),g=new X(t,n);H.calculateThresholdForBlock(r,a,c,t,n,d,g),this.matrix=g}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(e){return new H(e)}static calculateThresholdForBlock(e,t,n,r,a,c,d){const g=a-H.BLOCK_SIZE,w=r-H.BLOCK_SIZE;for(let E=0;E<n;E++){let A=E<<H.BLOCK_SIZE_POWER;A>g&&(A=g);const I=H.cap(E,2,n-3);for(let R=0;R<t;R++){let L=R<<H.BLOCK_SIZE_POWER;L>w&&(L=w);const F=H.cap(R,2,t-3);let q=0;for(let de=-2;de<=2;de++){const fe=c[I+de];q+=fe[F-2]+fe[F-1]+fe[F]+fe[F+1]+fe[F+2]}const ne=q/25;H.thresholdBlock(e,L,A,ne,r,d)}}}static cap(e,t,n){return e<t?t:e>n?n:e}static thresholdBlock(e,t,n,r,a,c){for(let d=0,g=n*a+t;d<H.BLOCK_SIZE;d++,g+=a)for(let w=0;w<H.BLOCK_SIZE;w++)(e[g+w]&255)<=r&&c.set(t+w,n+d)}static calculateBlackPoints(e,t,n,r,a){const c=a-H.BLOCK_SIZE,d=r-H.BLOCK_SIZE,g=new Array(n);for(let w=0;w<n;w++){g[w]=new Int32Array(t);let E=w<<H.BLOCK_SIZE_POWER;E>c&&(E=c);for(let A=0;A<t;A++){let I=A<<H.BLOCK_SIZE_POWER;I>d&&(I=d);let R=0,L=255,F=0;for(let ne=0,de=E*r+I;ne<H.BLOCK_SIZE;ne++,de+=r){for(let fe=0;fe<H.BLOCK_SIZE;fe++){const le=e[de+fe]&255;R+=le,le<L&&(L=le),le>F&&(F=le)}if(F-L>H.MIN_DYNAMIC_RANGE)for(ne++,de+=r;ne<H.BLOCK_SIZE;ne++,de+=r)for(let fe=0;fe<H.BLOCK_SIZE;fe++)R+=e[de+fe]&255}let q=R>>H.BLOCK_SIZE_POWER*2;if(F-L<=H.MIN_DYNAMIC_RANGE&&(q=L/2,w>0&&A>0)){const ne=(g[w-1][A]+2*g[w][A-1]+g[w-1][A-1])/4;L<ne&&(q=ne)}g[w][A]=q}}return g}}H.BLOCK_SIZE_POWER=3,H.BLOCK_SIZE=1<<H.BLOCK_SIZE_POWER,H.BLOCK_SIZE_MASK=H.BLOCK_SIZE-1,H.MINIMUM_DIMENSION=H.BLOCK_SIZE*5,H.MIN_DYNAMIC_RANGE=24;class te{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 ce("This luminance source does not support cropping.")}isRotateSupported(){return!1}rotateCounterClockwise(){throw new ce("This luminance source does not support rotation by 90 degrees.")}rotateCounterClockwise45(){throw new ce("This luminance source does not support rotation by 45 degrees.")}toString(){const e=new Uint8ClampedArray(this.width);let t=new z;for(let n=0;n<this.height;n++){const r=this.getRow(n,e);for(let a=0;a<this.width;a++){const c=r[a]&255;let d;c<64?d="#":c<128?d="+":c<192?d=".":d=" ",t.append(d)}t.append(`
|
|
14
|
+
`)}return t.toString()}}class Z extends te{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 a=0;a<r;a++)n[a]=255-(n[a]&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 Z(this.delegate.crop(e,t,n,r))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new Z(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new Z(this.delegate.rotateCounterClockwise45())}}class re extends te{constructor(e){super(e.width,e.height),this.canvas=e,this.tempCanvasElement=null,this.buffer=re.makeBufferFromCanvasImageData(e)}static makeBufferFromCanvasImageData(e){const t=e.getContext("2d").getImageData(0,0,e.width,e.height);return re.toGrayscaleBuffer(t.data,e.width,e.height)}static toGrayscaleBuffer(e,t,n){const r=new Uint8ClampedArray(t*n);for(let a=0,c=0,d=e.length;a<d;a+=4,c++){let g;if(e[a+3]===0)g=255;else{const E=e[a],A=e[a+1],I=e[a+2];g=306*E+601*A+117*I+512>>10}r[c]=g}return r}getRow(e,t){if(e<0||e>=this.getHeight())throw new y("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*re.DEGREE_TO_RADIANS,a=this.canvas.width,c=this.canvas.height,d=Math.ceil(Math.abs(Math.cos(r))*a+Math.abs(Math.sin(r))*c),g=Math.ceil(Math.abs(Math.sin(r))*a+Math.abs(Math.cos(r))*c);return t.width=d,t.height=g,n.translate(d/2,g/2),n.rotate(r),n.drawImage(this.canvas,a/-2,c/-2),this.buffer=re.makeBufferFromCanvasImageData(t),this}invert(){return new Z(this)}}re.DEGREE_TO_RADIANS=Math.PI/180;class ge{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 me=(globalThis||mr||self||window||void 0)&&(globalThis||mr||self||window||void 0).__awaiter||function(b,e,t,n){function r(a){return a instanceof t?a:new t(function(c){c(a)})}return new(t||(t=Promise))(function(a,c){function d(E){try{w(n.next(E))}catch(A){c(A)}}function g(E){try{w(n.throw(E))}catch(A){c(A)}}function w(E){E.done?a(E.value):r(E.value).then(d,g)}w((n=n.apply(b,e||[])).next())})};class Ie{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 me(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 a=n.deviceId||n.id,c=n.label||`Video device ${t.length+1}`,d=n.groupId,g={deviceId:a,label:c,kind:r,groupId:d};t.push(g)}return t})}getVideoInputDevices(){return me(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(t=>new ge(t.deviceId,t.label))})}findDeviceById(e){return me(this,void 0,void 0,function*(){const t=yield this.listVideoInputDevices();return t?t.find(n=>n.deviceId===e):null})}decodeFromInputVideoDevice(e,t){return me(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(e,t)})}decodeOnceFromVideoDevice(e,t){return me(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 me(this,void 0,void 0,function*(){const n=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeOnceFromStream(n,t)})}decodeOnceFromStream(e,t){return me(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 me(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(e,t,n)})}decodeFromVideoDevice(e,t,n){return me(this,void 0,void 0,function*(){let r;e?r={deviceId:{exact:e}}:r={facingMode:"environment"};const a={video:r};return yield this.decodeFromConstraints(a,t,n)})}decodeFromConstraints(e,t,n){return me(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 me(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 me(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 me(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 C(`element with id '${e}' not found`);if(n.nodeName.toLowerCase()!==t.toLowerCase())throw new C(`element with id '${e}' must be an ${t} element`);return n}decodeFromImage(e,t){if(!e&&!t)throw new C("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 C("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 C("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 C("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 C("A video element must be provided.");this.reset();const t=this.prepareVideoElement(e);return this.videoElement=t,t}decodeFromImageUrl(e){if(!e)throw new C("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 C("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 C("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 me(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(e),yield this.decodeOnce(e)})}_decodeOnLoadVideoContinuously(e,t){return me(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=(a,c)=>{if(this._stopAsyncDecode){c(new N("Video stream has ended before any code could be detected.")),this._stopAsyncDecode=void 0;return}try{const d=this.decode(e);a(d)}catch(d){const g=t&&d instanceof N,E=(d instanceof B||d instanceof W)&&n;if(g||E)return setTimeout(r,this._timeBetweenDecodingAttempts,a,c);c(d)}};return new Promise((a,c)=>r(a,c))}decodeContinuously(e,t){this._stopContinuousDecode=!1;const n=()=>{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 a=r instanceof B||r instanceof W,c=r instanceof N;(a||c)&&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 re(t),r=new H(n);return new S(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 _e{constructor(e,t,n=t==null?0:8*t.length,r,a,c=D.currentTimeMillis()){this.text=e,this.rawBytes=t,this.numBits=n,this.resultPoints=r,this.format=a,this.timestamp=c,this.text=e,this.rawBytes=t,n==null?this.numBits=t==null?0:8*t.length:this.numBits=n,this.resultPoints=r,this.format=a,this.resultMetadata=null,c==null?this.timestamp=D.currentTimeMillis():this.timestamp=c}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);D.arraycopy(t,0,n,0,t.length),D.arraycopy(e,0,n,t.length,e.length),this.resultPoints=n}}getTimestamp(){return this.timestamp}toString(){return this.text}}var Fe;(function(b){b[b.AZTEC=0]="AZTEC",b[b.CODABAR=1]="CODABAR",b[b.CODE_39=2]="CODE_39",b[b.CODE_93=3]="CODE_93",b[b.CODE_128=4]="CODE_128",b[b.DATA_MATRIX=5]="DATA_MATRIX",b[b.EAN_8=6]="EAN_8",b[b.EAN_13=7]="EAN_13",b[b.ITF=8]="ITF",b[b.MAXICODE=9]="MAXICODE",b[b.PDF_417=10]="PDF_417",b[b.QR_CODE=11]="QR_CODE",b[b.RSS_14=12]="RSS_14",b[b.RSS_EXPANDED=13]="RSS_EXPANDED",b[b.UPC_A=14]="UPC_A",b[b.UPC_E=15]="UPC_E",b[b.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(Fe||(Fe={}));var xe=Fe,lt;(function(b){b[b.OTHER=0]="OTHER",b[b.ORIENTATION=1]="ORIENTATION",b[b.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",b[b.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",b[b.ISSUE_NUMBER=4]="ISSUE_NUMBER",b[b.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",b[b.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",b[b.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",b[b.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",b[b.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",b[b.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY"})(lt||(lt={}));var Oe=lt;class Re{constructor(e,t,n,r,a=-1,c=-1){this.rawBytes=e,this.text=t,this.byteSegments=n,this.ecLevel=r,this.structuredAppendSequenceNumber=a,this.structuredAppendParity=c,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 qe{exp(e){return this.expTable[e]}log(e){if(e===0)throw new y;return this.logTable[e]}static addOrSubtract(e,t){return e^t}}class $e{constructor(e,t){if(t.length===0)throw new y;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),D.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 c=0,d=t.length;c!==d;c++){const g=t[c];n=qe.addOrSubtract(n,g)}return n}n=t[0];const r=t.length,a=this.field;for(let c=1;c<r;c++)n=qe.addOrSubtract(a.multiply(e,n),t[c]);return n}addOrSubtract(e){if(!this.field.equals(e.field))throw new y("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 c=t;t=n,n=c}let r=new Int32Array(n.length);const a=n.length-t.length;D.arraycopy(n,0,r,0,a);for(let c=a;c<n.length;c++)r[c]=qe.addOrSubtract(t[c-a],n[c]);return new $e(this.field,r)}multiply(e){if(!this.field.equals(e.field))throw new y("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,a=r.length,c=new Int32Array(n+a-1),d=this.field;for(let g=0;g<n;g++){const w=t[g];for(let E=0;E<a;E++)c[g+E]=qe.addOrSubtract(c[g+E],d.multiply(w,r[E]))}return new $e(d,c)}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),a=this.coefficients;for(let c=0;c<t;c++)r[c]=n.multiply(a[c],e);return new $e(n,r)}multiplyByMonomial(e,t){if(e<0)throw new y;if(t===0)return this.field.getZero();const n=this.coefficients,r=n.length,a=new Int32Array(r+e),c=this.field;for(let d=0;d<r;d++)a[d]=c.multiply(n[d],t);return new $e(c,a)}divide(e){if(!this.field.equals(e.field))throw new y("GenericGFPolys do not have same GenericGF field");if(e.isZero())throw new y("Divide by 0");const t=this.field;let n=t.getZero(),r=this;const a=e.getCoefficient(e.getDegree()),c=t.inverse(a);for(;r.getDegree()>=e.getDegree()&&!r.isZero();){const d=r.getDegree()-e.getDegree(),g=t.multiply(r.getCoefficient(r.getDegree()),c),w=e.multiplyByMonomial(d,g),E=t.buildMonomial(d,g);n=n.addOrSubtract(E),r=r.addOrSubtract(w)}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 It extends p{}It.kind="ArithmeticException";class ue extends qe{constructor(e,t,n){super(),this.primitive=e,this.size=t,this.generatorBase=n;const r=new Int32Array(t);let a=1;for(let d=0;d<t;d++)r[d]=a,a*=2,a>=t&&(a^=e,a&=t-1);this.expTable=r;const c=new Int32Array(t);for(let d=0;d<t-1;d++)c[r[d]]=d;this.logTable=c,this.zero=new $e(this,Int32Array.from([0])),this.one=new $e(this,Int32Array.from([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new y;if(t===0)return this.zero;const n=new Int32Array(e+1);return n[0]=t,new $e(this,n)}inverse(e){if(e===0)throw new It;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"+O.toHexString(this.primitive)+","+this.size+")"}equals(e){return e===this}}ue.AZTEC_DATA_12=new ue(4201,4096,1),ue.AZTEC_DATA_10=new ue(1033,1024,1),ue.AZTEC_DATA_6=new ue(67,64,1),ue.AZTEC_PARAM=new ue(19,16,1),ue.QR_CODE_FIELD_256=new ue(285,256,0),ue.DATA_MATRIX_FIELD_256=new ue(301,256,1),ue.AZTEC_DATA_8=ue.DATA_MATRIX_FIELD_256,ue.MAXICODE_FIELD_64=ue.AZTEC_DATA_6;class Xe extends p{}Xe.kind="ReedSolomonException";class Ke extends p{}Ke.kind="IllegalStateException";class mt{constructor(e){this.field=e}decode(e,t){const n=this.field,r=new $e(n,e),a=new Int32Array(t);let c=!0;for(let R=0;R<t;R++){const L=r.evaluateAt(n.exp(R+n.getGeneratorBase()));a[a.length-1-R]=L,L!==0&&(c=!1)}if(c)return;const d=new $e(n,a),g=this.runEuclideanAlgorithm(n.buildMonomial(t,1),d,t),w=g[0],E=g[1],A=this.findErrorLocations(w),I=this.findErrorMagnitudes(E,A);for(let R=0;R<A.length;R++){const L=e.length-1-n.log(A[R]);if(L<0)throw new Xe("Bad error location");e[L]=ue.addOrSubtract(e[L],I[R])}}runEuclideanAlgorithm(e,t,n){if(e.getDegree()<t.getDegree()){const R=e;e=t,t=R}const r=this.field;let a=e,c=t,d=r.getZero(),g=r.getOne();for(;c.getDegree()>=(n/2|0);){let R=a,L=d;if(a=c,d=g,a.isZero())throw new Xe("r_{i-1} was zero");c=R;let F=r.getZero();const q=a.getCoefficient(a.getDegree()),ne=r.inverse(q);for(;c.getDegree()>=a.getDegree()&&!c.isZero();){const de=c.getDegree()-a.getDegree(),fe=r.multiply(c.getCoefficient(c.getDegree()),ne);F=F.addOrSubtract(r.buildMonomial(de,fe)),c=c.addOrSubtract(a.multiplyByMonomial(de,fe))}if(g=F.multiply(d).addOrSubtract(L),c.getDegree()>=a.getDegree())throw new Ke("Division algorithm failed to reduce polynomial?")}const w=g.getCoefficient(0);if(w===0)throw new Xe("sigmaTilde(0) was zero");const E=r.inverse(w),A=g.multiplyScalar(E),I=c.multiplyScalar(E);return[A,I]}findErrorLocations(e){const t=e.getDegree();if(t===1)return Int32Array.from([e.getCoefficient(1)]);const n=new Int32Array(t);let r=0;const a=this.field;for(let c=1;c<a.getSize()&&r<t;c++)e.evaluateAt(c)===0&&(n[r]=a.inverse(c),r++);if(r!==t)throw new Xe("Error locator degree does not match number of roots");return n}findErrorMagnitudes(e,t){const n=t.length,r=new Int32Array(n),a=this.field;for(let c=0;c<n;c++){const d=a.inverse(t[c]);let g=1;for(let w=0;w<n;w++)if(c!==w){const E=a.multiply(t[w],d),A=E&1?E&-2:E|1;g=a.multiply(g,A)}r[c]=a.multiply(e.evaluateAt(d),a.inverse(g)),a.getGeneratorBase()!==0&&(r[c]=a.multiply(r[c],d))}return r}}var tt;(function(b){b[b.UPPER=0]="UPPER",b[b.LOWER=1]="LOWER",b[b.MIXED=2]="MIXED",b[b.DIGIT=3]="DIGIT",b[b.PUNCT=4]="PUNCT",b[b.BINARY=5]="BINARY"})(tt||(tt={}));class Ue{decode(e){this.ddata=e;let t=e.getBits(),n=this.extractBits(t),r=this.correctBits(n),a=Ue.convertBoolArrayToByteArray(r),c=Ue.getEncodedData(r),d=new Re(a,c,null,null);return d.setNumBits(r.length),d}static highLevelDecode(e){return this.getEncodedData(e)}static getEncodedData(e){let t=e.length,n=tt.UPPER,r=tt.UPPER,a="",c=0;for(;c<t;)if(r===tt.BINARY){if(t-c<5)break;let d=Ue.readCode(e,c,5);if(c+=5,d===0){if(t-c<11)break;d=Ue.readCode(e,c,11)+31,c+=11}for(let g=0;g<d;g++){if(t-c<8){c=t;break}const w=Ue.readCode(e,c,8);a+=G.castAsNonUtf8Char(w),c+=8}r=n}else{let d=r===tt.DIGIT?4:5;if(t-c<d)break;let g=Ue.readCode(e,c,d);c+=d;let w=Ue.getCharacter(r,g);w.startsWith("CTRL_")?(n=r,r=Ue.getTable(w.charAt(5)),w.charAt(6)==="L"&&(n=r)):(a+=w,r=n)}return a}static getTable(e){switch(e){case"L":return tt.LOWER;case"P":return tt.PUNCT;case"M":return tt.MIXED;case"D":return tt.DIGIT;case"B":return tt.BINARY;case"U":default:return tt.UPPER}}static getCharacter(e,t){switch(e){case tt.UPPER:return Ue.UPPER_TABLE[t];case tt.LOWER:return Ue.LOWER_TABLE[t];case tt.MIXED:return Ue.MIXED_TABLE[t];case tt.PUNCT:return Ue.PUNCT_TABLE[t];case tt.DIGIT:return Ue.DIGIT_TABLE[t];default:throw new Ke("Bad table")}}correctBits(e){let t,n;this.ddata.getNbLayers()<=2?(n=6,t=ue.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(n=8,t=ue.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(n=10,t=ue.AZTEC_DATA_10):(n=12,t=ue.AZTEC_DATA_12);let r=this.ddata.getNbDatablocks(),a=e.length/n;if(a<r)throw new W;let c=e.length%n,d=new Int32Array(a);for(let I=0;I<a;I++,c+=n)d[I]=Ue.readCode(e,c,n);try{new mt(t).decode(d,a-r)}catch(I){throw new W(I)}let g=(1<<n)-1,w=0;for(let I=0;I<r;I++){let R=d[I];if(R===0||R===g)throw new W;(R===1||R===g-1)&&w++}let E=new Array(r*n-w),A=0;for(let I=0;I<r;I++){let R=d[I];if(R===1||R===g-1)E.fill(R>1,A,A+n-1),A+=n-1;else for(let L=n-1;L>=0;--L)E[A++]=(R&1<<L)!==0}return E}extractBits(e){let t=this.ddata.isCompact(),n=this.ddata.getNbLayers(),r=(t?11:14)+n*4,a=new Int32Array(r),c=new Array(this.totalBitsInLayer(n,t));if(t)for(let d=0;d<a.length;d++)a[d]=d;else{let d=r+1+2*O.truncDivision(O.truncDivision(r,2)-1,15),g=r/2,w=O.truncDivision(d,2);for(let E=0;E<g;E++){let A=E+O.truncDivision(E,15);a[g-E-1]=w-A-1,a[g+E]=w+A+1}}for(let d=0,g=0;d<n;d++){let w=(n-d)*4+(t?9:12),E=d*2,A=r-1-E;for(let I=0;I<w;I++){let R=I*2;for(let L=0;L<2;L++)c[g+R+L]=e.get(a[E+L],a[E+I]),c[g+2*w+R+L]=e.get(a[E+I],a[A-L]),c[g+4*w+R+L]=e.get(a[A-L],a[A-I]),c[g+6*w+R+L]=e.get(a[A-I],a[E+L])}g+=w*8}return c}static readCode(e,t,n){let r=0;for(let a=t;a<t+n;a++)r<<=1,e[a]&&(r|=1);return r}static readByte(e,t){let n=e.length-t;return n>=8?Ue.readCode(e,t,8):Ue.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]=Ue.readByte(e,8*n);return t}totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}Ue.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"],Ue.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"],Ue.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b"," ",`
|
|
15
|
+
`,"\\13","\f","\r","\\33","\\34","\\35","\\36","\\37","@","\\","^","_","`","|","~","\\177","CTRL_LL","CTRL_UL","CTRL_PL","CTRL_BS"],Ue.PUNCT_TABLE=["","\r",`\r
|
|
16
|
+
`,". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],Ue.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class He{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 a=e-n,c=t-r;return Math.sqrt(a*a+c*c)}static sum(e){let t=0;for(let n=0,r=e.length;n!==r;n++){const a=e[n];t+=a}return t}}class Yt{static floatToIntBits(e){return e}}Yt.MAX_VALUE=Number.MAX_SAFE_INTEGER;class Ee{constructor(e,t){this.x=e,this.y=t}getX(){return this.x}getY(){return this.y}equals(e){if(e instanceof Ee){const t=e;return this.x===t.x&&this.y===t.y}return!1}hashCode(){return 31*Yt.floatToIntBits(this.x)+Yt.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 a,c,d;if(n>=t&&n>=r?(c=e[0],a=e[1],d=e[2]):r>=n&&r>=t?(c=e[1],a=e[0],d=e[2]):(c=e[2],a=e[0],d=e[1]),this.crossProductZ(a,c,d)<0){const g=a;a=d,d=g}e[0]=a,e[1]=c,e[2]=d}static distance(e,t){return He.distance(e.x,e.y,t.x,t.y)}static crossProductZ(e,t,n){const r=t.x,a=t.y;return(n.x-r)*(e.y-a)-(n.y-a)*(e.x-r)}}class _r{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class bi extends _r{constructor(e,t,n,r,a){super(e,t),this.compact=n,this.nbDatablocks=r,this.nbLayers=a}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class _n{constructor(e,t,n,r){this.image=e,this.height=e.getHeight(),this.width=e.getWidth(),t==null&&(t=_n.INIT_SIZE),n==null&&(n=e.getWidth()/2|0),r==null&&(r=e.getHeight()/2|0);const a=t/2|0;if(this.leftInit=n-a,this.rightInit=n+a,this.upInit=r-a,this.downInit=r+a,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new N}detect(){let e=this.leftInit,t=this.rightInit,n=this.upInit,r=this.downInit,a=!1,c=!0,d=!1,g=!1,w=!1,E=!1,A=!1;const I=this.width,R=this.height;for(;c;){c=!1;let L=!0;for(;(L||!g)&&t<I;)L=this.containsBlackPoint(n,r,t,!1),L?(t++,c=!0,g=!0):g||t++;if(t>=I){a=!0;break}let F=!0;for(;(F||!w)&&r<R;)F=this.containsBlackPoint(e,t,r,!0),F?(r++,c=!0,w=!0):w||r++;if(r>=R){a=!0;break}let q=!0;for(;(q||!E)&&e>=0;)q=this.containsBlackPoint(n,r,e,!1),q?(e--,c=!0,E=!0):E||e--;if(e<0){a=!0;break}let ne=!0;for(;(ne||!A)&&n>=0;)ne=this.containsBlackPoint(e,t,n,!0),ne?(n--,c=!0,A=!0):A||n--;if(n<0){a=!0;break}c&&(d=!0)}if(!a&&d){const L=t-e;let F=null;for(let fe=1;F===null&&fe<L;fe++)F=this.getBlackPointOnSegment(e,r-fe,e+fe,r);if(F==null)throw new N;let q=null;for(let fe=1;q===null&&fe<L;fe++)q=this.getBlackPointOnSegment(e,n+fe,e+fe,n);if(q==null)throw new N;let ne=null;for(let fe=1;ne===null&&fe<L;fe++)ne=this.getBlackPointOnSegment(t,n+fe,t-fe,n);if(ne==null)throw new N;let de=null;for(let fe=1;de===null&&fe<L;fe++)de=this.getBlackPointOnSegment(t,r-fe,t-fe,r);if(de==null)throw new N;return this.centerEdges(de,F,ne,q)}else throw new N}getBlackPointOnSegment(e,t,n,r){const a=He.round(He.distance(e,t,n,r)),c=(n-e)/a,d=(r-t)/a,g=this.image;for(let w=0;w<a;w++){const E=He.round(e+w*c),A=He.round(t+w*d);if(g.get(E,A))return new Ee(E,A)}return null}centerEdges(e,t,n,r){const a=e.getX(),c=e.getY(),d=t.getX(),g=t.getY(),w=n.getX(),E=n.getY(),A=r.getX(),I=r.getY(),R=_n.CORR;return a<this.width/2?[new Ee(A-R,I+R),new Ee(d+R,g+R),new Ee(w-R,E-R),new Ee(a+R,c-R)]:[new Ee(A+R,I+R),new Ee(d+R,g-R),new Ee(w-R,E+R),new Ee(a-R,c-R)]}containsBlackPoint(e,t,n,r){const a=this.image;if(r){for(let c=e;c<=t;c++)if(a.get(c,n))return!0}else for(let c=e;c<=t;c++)if(a.get(n,c))return!0;return!1}}_n.INIT_SIZE=10,_n.CORR=1;class Gr{static checkAndNudgePoints(e,t){const n=e.getWidth(),r=e.getHeight();let a=!0;for(let c=0;c<t.length&&a;c+=2){const d=Math.floor(t[c]),g=Math.floor(t[c+1]);if(d<-1||d>n||g<-1||g>r)throw new N;a=!1,d===-1?(t[c]=0,a=!0):d===n&&(t[c]=n-1,a=!0),g===-1?(t[c+1]=0,a=!0):g===r&&(t[c+1]=r-1,a=!0)}a=!0;for(let c=t.length-2;c>=0&&a;c-=2){const d=Math.floor(t[c]),g=Math.floor(t[c+1]);if(d<-1||d>n||g<-1||g>r)throw new N;a=!1,d===-1?(t[c]=0,a=!0):d===n&&(t[c]=n-1,a=!0),g===-1?(t[c+1]=0,a=!0):g===r&&(t[c+1]=r-1,a=!0)}}}class sn{constructor(e,t,n,r,a,c,d,g,w){this.a11=e,this.a21=t,this.a31=n,this.a12=r,this.a22=a,this.a32=c,this.a13=d,this.a23=g,this.a33=w}static quadrilateralToQuadrilateral(e,t,n,r,a,c,d,g,w,E,A,I,R,L,F,q){const ne=sn.quadrilateralToSquare(e,t,n,r,a,c,d,g);return sn.squareToQuadrilateral(w,E,A,I,R,L,F,q).times(ne)}transformPoints(e){const t=e.length,n=this.a11,r=this.a12,a=this.a13,c=this.a21,d=this.a22,g=this.a23,w=this.a31,E=this.a32,A=this.a33;for(let I=0;I<t;I+=2){const R=e[I],L=e[I+1],F=a*R+g*L+A;e[I]=(n*R+c*L+w)/F,e[I+1]=(r*R+d*L+E)/F}}transformPointsWithValues(e,t){const n=this.a11,r=this.a12,a=this.a13,c=this.a21,d=this.a22,g=this.a23,w=this.a31,E=this.a32,A=this.a33,I=e.length;for(let R=0;R<I;R++){const L=e[R],F=t[R],q=a*L+g*F+A;e[R]=(n*L+c*F+w)/q,t[R]=(r*L+d*F+E)/q}}static squareToQuadrilateral(e,t,n,r,a,c,d,g){const w=e-n+a-d,E=t-r+c-g;if(w===0&&E===0)return new sn(n-e,a-n,e,r-t,c-r,t,0,0,1);{const A=n-a,I=d-a,R=r-c,L=g-c,F=A*L-I*R,q=(w*L-I*E)/F,ne=(A*E-w*R)/F;return new sn(n-e+q*n,d-e+ne*d,e,r-t+q*r,g-t+ne*g,t,q,ne,1)}}static quadrilateralToSquare(e,t,n,r,a,c,d,g){return sn.squareToQuadrilateral(e,t,n,r,a,c,d,g).buildAdjoint()}buildAdjoint(){return new sn(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 sn(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 Cr extends Gr{sampleGrid(e,t,n,r,a,c,d,g,w,E,A,I,R,L,F,q,ne,de,fe){const le=sn.quadrilateralToQuadrilateral(r,a,c,d,g,w,E,A,I,R,L,F,q,ne,de,fe);return this.sampleGridWithTransform(e,t,n,le)}sampleGridWithTransform(e,t,n,r){if(t<=0||n<=0)throw new N;const a=new X(t,n),c=new Float32Array(2*t);for(let d=0;d<n;d++){const g=c.length,w=d+.5;for(let E=0;E<g;E+=2)c[E]=E/2+.5,c[E+1]=w;r.transformPoints(c),Gr.checkAndNudgePoints(e,c);try{for(let E=0;E<g;E+=2)e.get(Math.floor(c[E]),Math.floor(c[E+1]))&&a.set(E/2,d)}catch{throw new N}}return a}}class $t{static setGridSampler(e){$t.gridSampler=e}static getInstance(){return $t.gridSampler}}$t.gridSampler=new Cr;class Bt{constructor(e,t){this.x=e,this.y=t}toResultPoint(){return new Ee(this.getX(),this.getY())}getX(){return this.x}getY(){return this.y}}class Er{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 c=n[0];n[0]=n[2],n[2]=c}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]),a=this.getMatrixCornerPoints(n);return new bi(r,a,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 N;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 c=0;c<4;c++){let d=n[(this.shift+c)%4];this.compact?(r<<=7,r+=d>>1&127):(r<<=10,r+=(d>>2&992)+(d>>1&31))}let a=this.getCorrectedParameterData(r,this.compact);this.compact?(this.nbLayers=(a>>6)+1,this.nbDataBlocks=(a&63)+1):(this.nbLayers=(a>>11)+1,this.nbDataBlocks=(a&2047)+1)}getRotation(e,t){let n=0;e.forEach((r,a,c)=>{let d=(r>>t-2<<1)+(r&1);n=(n<<3)+d}),n=((n&1)<<11)+(n>>1);for(let r=0;r<4;r++)if(O.bitCount(n^this.EXPECTED_CORNER_BITS[r])<=2)return r;throw new N}getCorrectedParameterData(e,t){let n,r;t?(n=7,r=2):(n=10,r=4);let a=n-r,c=new Int32Array(n);for(let g=n-1;g>=0;--g)c[g]=e&15,e>>=4;try{new mt(ue.AZTEC_PARAM).decode(c,a)}catch{throw new N}let d=0;for(let g=0;g<r;g++)d=(d<<4)+c[g];return d}getBullsEyeCorners(e){let t=e,n=e,r=e,a=e,c=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){let A=this.getFirstDifferent(t,c,1,-1),I=this.getFirstDifferent(n,c,1,1),R=this.getFirstDifferent(r,c,-1,1),L=this.getFirstDifferent(a,c,-1,-1);if(this.nbCenterLayers>2){let F=this.distancePoint(L,A)*this.nbCenterLayers/(this.distancePoint(a,t)*(this.nbCenterLayers+2));if(F<.75||F>1.25||!this.isWhiteOrBlackRectangle(A,I,R,L))break}t=A,n=I,r=R,a=L,c=!c}if(this.nbCenterLayers!==5&&this.nbCenterLayers!==7)throw new N;this.compact=this.nbCenterLayers===5;let d=new Ee(t.getX()+.5,t.getY()-.5),g=new Ee(n.getX()+.5,n.getY()+.5),w=new Ee(r.getX()-.5,r.getY()+.5),E=new Ee(a.getX()-.5,a.getY()-.5);return this.expandSquare([d,g,w,E],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let e,t,n,r;try{let d=new _n(this.image).detect();e=d[0],t=d[1],n=d[2],r=d[3]}catch{let g=this.image.getWidth()/2,w=this.image.getHeight()/2;e=this.getFirstDifferent(new Bt(g+7,w-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new Bt(g+7,w+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new Bt(g-7,w+7),!1,-1,1).toResultPoint(),r=this.getFirstDifferent(new Bt(g-7,w-7),!1,-1,-1).toResultPoint()}let a=He.round((e.getX()+r.getX()+t.getX()+n.getX())/4),c=He.round((e.getY()+r.getY()+t.getY()+n.getY())/4);try{let d=new _n(this.image,15,a,c).detect();e=d[0],t=d[1],n=d[2],r=d[3]}catch{e=this.getFirstDifferent(new Bt(a+7,c-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new Bt(a+7,c+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new Bt(a-7,c+7),!1,-1,1).toResultPoint(),r=this.getFirstDifferent(new Bt(a-7,c-7),!1,-1,-1).toResultPoint()}return a=He.round((e.getX()+r.getX()+t.getX()+n.getX())/4),c=He.round((e.getY()+r.getY()+t.getY()+n.getY())/4),new Bt(a,c)}getMatrixCornerPoints(e){return this.expandSquare(e,2*this.nbCenterLayers,this.getDimension())}sampleGrid(e,t,n,r,a){let c=$t.getInstance(),d=this.getDimension(),g=d/2-this.nbCenterLayers,w=d/2+this.nbCenterLayers;return c.sampleGrid(e,d,d,g,g,w,g,w,w,g,w,t.getX(),t.getY(),n.getX(),n.getY(),r.getX(),r.getY(),a.getX(),a.getY())}sampleLine(e,t,n){let r=0,a=this.distanceResultPoint(e,t),c=a/n,d=e.getX(),g=e.getY(),w=c*(t.getX()-e.getX())/a,E=c*(t.getY()-e.getY())/a;for(let A=0;A<n;A++)this.image.get(He.round(d+A*w),He.round(g+A*E))&&(r|=1<<n-A-1);return r}isWhiteOrBlackRectangle(e,t,n,r){let a=3;e=new Bt(e.getX()-a,e.getY()+a),t=new Bt(t.getX()-a,t.getY()-a),n=new Bt(n.getX()+a,n.getY()-a),r=new Bt(r.getX()+a,r.getY()+a);let c=this.getColor(r,e);if(c===0)return!1;let d=this.getColor(e,t);return d!==c||(d=this.getColor(t,n),d!==c)?!1:(d=this.getColor(n,r),d===c)}getColor(e,t){let n=this.distancePoint(e,t),r=(t.getX()-e.getX())/n,a=(t.getY()-e.getY())/n,c=0,d=e.getX(),g=e.getY(),w=this.image.get(e.getX(),e.getY()),E=Math.ceil(n);for(let I=0;I<E;I++)d+=r,g+=a,this.image.get(He.round(d),He.round(g))!==w&&c++;let A=c/n;return A>.1&&A<.9?0:A<=.1===w?1:-1}getFirstDifferent(e,t,n,r){let a=e.getX()+n,c=e.getY()+r;for(;this.isValid(a,c)&&this.image.get(a,c)===t;)a+=n,c+=r;for(a-=n,c-=r;this.isValid(a,c)&&this.image.get(a,c)===t;)a+=n;for(a-=n;this.isValid(a,c)&&this.image.get(a,c)===t;)c+=r;return c-=r,new Bt(a,c)}expandSquare(e,t,n){let r=n/(2*t),a=e[0].getX()-e[2].getX(),c=e[0].getY()-e[2].getY(),d=(e[0].getX()+e[2].getX())/2,g=(e[0].getY()+e[2].getY())/2,w=new Ee(d+r*a,g+r*c),E=new Ee(d-r*a,g-r*c);a=e[1].getX()-e[3].getX(),c=e[1].getY()-e[3].getY(),d=(e[1].getX()+e[3].getX())/2,g=(e[1].getY()+e[3].getY())/2;let A=new Ee(d+r*a,g+r*c),I=new Ee(d-r*a,g-r*c);return[w,A,E,I]}isValid(e,t){return e>=0&&e<this.image.getWidth()&&t>0&&t<this.image.getHeight()}isValidPoint(e){let t=He.round(e.getX()),n=He.round(e.getY());return this.isValid(t,n)}distancePoint(e,t){return He.distance(e.getX(),e.getY(),t.getX(),t.getY())}distanceResultPoint(e,t){return He.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*(O.truncDivision(this.nbLayers-4,8)+1)+15}}class nr{decode(e,t=null){let n=null,r=new Er(e.getBlackMatrix()),a=null,c=null;try{let E=r.detectMirror(!1);a=E.getPoints(),this.reportFoundResultPoints(t,a),c=new Ue().decode(E)}catch(E){n=E}if(c==null)try{let E=r.detectMirror(!0);a=E.getPoints(),this.reportFoundResultPoints(t,a),c=new Ue().decode(E)}catch(E){throw n??E}let d=new _e(c.getText(),c.getRawBytes(),c.getNumBits(),a,xe.AZTEC,D.currentTimeMillis()),g=c.getByteSegments();g!=null&&d.putMetadata(Oe.BYTE_SEGMENTS,g);let w=c.getECLevel();return w!=null&&d.putMetadata(Oe.ERROR_CORRECTION_LEVEL,w),d}reportFoundResultPoints(e,t){if(e!=null){let n=e.get(Q.NEED_RESULT_POINT_CALLBACK);n!=null&&t.forEach((r,a,c)=>{n.foundPossibleResultPoint(r)})}}reset(){}}class ye extends Ie{constructor(e=500){super(new nr,e)}}class ie{decode(e,t){try{return this.doDecode(e,t)}catch{if(t&&t.get(Q.TRY_HARDER)===!0&&e.isRotateSupported()){const a=e.rotateCounterClockwise(),c=this.doDecode(a,t),d=c.getResultMetadata();let g=270;d!==null&&d.get(Oe.ORIENTATION)===!0&&(g=g+d.get(Oe.ORIENTATION)%360),c.putMetadata(Oe.ORIENTATION,g);const w=c.getResultPoints();if(w!==null){const E=a.getHeight();for(let A=0;A<w.length;A++)w[A]=new Ee(E-w[A].getY()-1,w[A].getX())}return c}else throw new N}}reset(){}doDecode(e,t){const n=e.getWidth(),r=e.getHeight();let a=new M(n);const c=t&&t.get(Q.TRY_HARDER)===!0,d=Math.max(1,r>>(c?8:5));let g;c?g=r:g=15;const w=Math.trunc(r/2);for(let E=0;E<g;E++){const A=Math.trunc((E+1)/2),I=(E&1)===0,R=w+d*(I?A:-A);if(R<0||R>=r)break;try{a=e.getBlackRow(R,a)}catch{continue}for(let L=0;L<2;L++){if(L===1&&(a.reverse(),t&&t.get(Q.NEED_RESULT_POINT_CALLBACK)===!0)){const F=new Map;t.forEach((q,ne)=>F.set(ne,q)),F.delete(Q.NEED_RESULT_POINT_CALLBACK),t=F}try{const F=this.decodeRow(R,a,t);if(L===1){F.putMetadata(Oe.ORIENTATION,180);const q=F.getResultPoints();q!==null&&(q[0]=new Ee(n-q[0].getX()-1,q[0].getY()),q[1]=new Ee(n-q[1].getX()-1,q[1].getY()))}return F}catch{}}}throw new N}static recordPattern(e,t,n){const r=n.length;for(let w=0;w<r;w++)n[w]=0;const a=e.getSize();if(t>=a)throw new N;let c=!e.get(t),d=0,g=t;for(;g<a;){if(e.get(g)!==c)n[d]++;else{if(++d===r)break;n[d]=1,c=!c}g++}if(!(d===r||d===r-1&&g===a))throw new N}static recordPatternInReverse(e,t,n){let r=n.length,a=e.get(t);for(;t>0&&r>=0;)e.get(--t)!==a&&(r--,a=!a);if(r>=0)throw new N;ie.recordPattern(e,t+1,n)}static patternMatchVariance(e,t,n){const r=e.length;let a=0,c=0;for(let w=0;w<r;w++)a+=e[w],c+=t[w];if(a<c)return Number.POSITIVE_INFINITY;const d=a/c;n*=d;let g=0;for(let w=0;w<r;w++){const E=e[w],A=t[w]*d,I=E>A?E-A:A-E;if(I>n)return Number.POSITIVE_INFINITY;g+=I}return g/a}}class se extends ie{static findStartPattern(e){const t=e.getSize(),n=e.getNextSet(0);let r=0,a=Int32Array.from([0,0,0,0,0,0]),c=n,d=!1;const g=6;for(let w=n;w<t;w++)if(e.get(w)!==d)a[r]++;else{if(r===g-1){let E=se.MAX_AVG_VARIANCE,A=-1;for(let I=se.CODE_START_A;I<=se.CODE_START_C;I++){const R=ie.patternMatchVariance(a,se.CODE_PATTERNS[I],se.MAX_INDIVIDUAL_VARIANCE);R<E&&(E=R,A=I)}if(A>=0&&e.isRange(Math.max(0,c-(w-c)/2),c,!1))return Int32Array.from([c,w,A]);c+=a[0]+a[1],a=a.slice(2,a.length-1),a[r-1]=0,a[r]=0,r--}else r++;a[r]=1,d=!d}throw new N}static decodeCode(e,t,n){ie.recordPattern(e,n,t);let r=se.MAX_AVG_VARIANCE,a=-1;for(let c=0;c<se.CODE_PATTERNS.length;c++){const d=se.CODE_PATTERNS[c],g=this.patternMatchVariance(t,d,se.MAX_INDIVIDUAL_VARIANCE);g<r&&(r=g,a=c)}if(a>=0)return a;throw new N}decodeRow(e,t,n){const r=n&&n.get(Q.ASSUME_GS1)===!0,a=se.findStartPattern(t),c=a[2];let d=0;const g=new Uint8Array(20);g[d++]=c;let w;switch(c){case se.CODE_START_A:w=se.CODE_CODE_A;break;case se.CODE_START_B:w=se.CODE_CODE_B;break;case se.CODE_START_C:w=se.CODE_CODE_C;break;default:throw new W}let E=!1,A=!1,I="",R=a[0],L=a[1];const F=Int32Array.from([0,0,0,0,0,0]);let q=0,ne=0,de=c,fe=0,le=!0,Ge=!1,ve=!1;for(;!E;){const kr=A;switch(A=!1,q=ne,ne=se.decodeCode(t,F,L),g[d++]=ne,ne!==se.CODE_STOP&&(le=!0),ne!==se.CODE_STOP&&(fe++,de+=fe*ne),R=L,L+=F.reduce((vg,Dg)=>vg+Dg,0),ne){case se.CODE_START_A:case se.CODE_START_B:case se.CODE_START_C:throw new W}switch(w){case se.CODE_CODE_A:if(ne<64)ve===Ge?I+=String.fromCharCode(32+ne):I+=String.fromCharCode(32+ne+128),ve=!1;else if(ne<96)ve===Ge?I+=String.fromCharCode(ne-64):I+=String.fromCharCode(ne+64),ve=!1;else switch(ne!==se.CODE_STOP&&(le=!1),ne){case se.CODE_FNC_1:r&&(I.length===0?I+="]C1":I+="");break;case se.CODE_FNC_2:case se.CODE_FNC_3:break;case se.CODE_FNC_4_A:!Ge&&ve?(Ge=!0,ve=!1):Ge&&ve?(Ge=!1,ve=!1):ve=!0;break;case se.CODE_SHIFT:A=!0,w=se.CODE_CODE_B;break;case se.CODE_CODE_B:w=se.CODE_CODE_B;break;case se.CODE_CODE_C:w=se.CODE_CODE_C;break;case se.CODE_STOP:E=!0;break}break;case se.CODE_CODE_B:if(ne<96)ve===Ge?I+=String.fromCharCode(32+ne):I+=String.fromCharCode(32+ne+128),ve=!1;else switch(ne!==se.CODE_STOP&&(le=!1),ne){case se.CODE_FNC_1:r&&(I.length===0?I+="]C1":I+="");break;case se.CODE_FNC_2:case se.CODE_FNC_3:break;case se.CODE_FNC_4_B:!Ge&&ve?(Ge=!0,ve=!1):Ge&&ve?(Ge=!1,ve=!1):ve=!0;break;case se.CODE_SHIFT:A=!0,w=se.CODE_CODE_A;break;case se.CODE_CODE_A:w=se.CODE_CODE_A;break;case se.CODE_CODE_C:w=se.CODE_CODE_C;break;case se.CODE_STOP:E=!0;break}break;case se.CODE_CODE_C:if(ne<100)ne<10&&(I+="0"),I+=ne;else switch(ne!==se.CODE_STOP&&(le=!1),ne){case se.CODE_FNC_1:r&&(I.length===0?I+="]C1":I+="");break;case se.CODE_CODE_A:w=se.CODE_CODE_A;break;case se.CODE_CODE_B:w=se.CODE_CODE_B;break;case se.CODE_STOP:E=!0;break}break}kr&&(w=w===se.CODE_CODE_A?se.CODE_CODE_B:se.CODE_CODE_A)}const en=L-R;if(L=t.getNextUnset(L),!t.isRange(L,Math.min(t.getSize(),L+(L-R)/2),!1))throw new N;if(de-=fe*q,de%103!==q)throw new B;const En=I.length;if(En===0)throw new N;En>0&&le&&(w===se.CODE_CODE_C?I=I.substring(0,En-2):I=I.substring(0,En-1));const tn=(a[1]+a[0])/2,st=R+en/2,Lt=g.length,an=new Uint8Array(Lt);for(let kr=0;kr<Lt;kr++)an[kr]=g[kr];const Tr=[new Ee(tn,e),new Ee(st,e)];return new _e(I,an,0,Tr,xe.CODE_128,new Date().getTime())}}se.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])],se.MAX_AVG_VARIANCE=.25,se.MAX_INDIVIDUAL_VARIANCE=.7,se.CODE_SHIFT=98,se.CODE_CODE_C=99,se.CODE_CODE_B=100,se.CODE_CODE_A=101,se.CODE_FNC_1=102,se.CODE_FNC_2=97,se.CODE_FNC_3=96,se.CODE_FNC_4_A=101,se.CODE_FNC_4_B=100,se.CODE_START_A=103,se.CODE_START_B=104,se.CODE_START_C=105,se.CODE_STOP=106;class Qe extends ie{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 a=Qe.findAsteriskPattern(t,r),c=t.getNextSet(a[1]),d=t.getSize(),g,w;do{Qe.recordPattern(t,c,r);let F=Qe.toNarrowWidePattern(r);if(F<0)throw new N;g=Qe.patternToChar(F),this.decodeRowResult+=g,w=c;for(let q of r)c+=q;c=t.getNextSet(c)}while(g!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let E=0;for(let F of r)E+=F;let A=c-w-E;if(c!==d&&A*2<E)throw new N;if(this.usingCheckDigit){let F=this.decodeRowResult.length-1,q=0;for(let ne=0;ne<F;ne++)q+=Qe.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(ne));if(this.decodeRowResult.charAt(F)!==Qe.ALPHABET_STRING.charAt(q%43))throw new B;this.decodeRowResult=this.decodeRowResult.substring(0,F)}if(this.decodeRowResult.length===0)throw new N;let I;this.extendedMode?I=Qe.decodeExtended(this.decodeRowResult):I=this.decodeRowResult;let R=(a[1]+a[0])/2,L=w+E/2;return new _e(I,null,0,[new Ee(R,e),new Ee(L,e)],xe.CODE_39,new Date().getTime())}static findAsteriskPattern(e,t){let n=e.getSize(),r=e.getNextSet(0),a=0,c=r,d=!1,g=t.length;for(let w=r;w<n;w++)if(e.get(w)!==d)t[a]++;else{if(a===g-1){if(this.toNarrowWidePattern(t)===Qe.ASTERISK_ENCODING&&e.isRange(Math.max(0,c-Math.floor((w-c)/2)),c,!1))return[c,w];c+=t[0]+t[1],t.copyWithin(0,2,2+a-1),t[a-1]=0,t[a]=0,a--}else a++;t[a]=1,d=!d}throw new N}static toNarrowWidePattern(e){let t=e.length,n=0,r;do{let a=2147483647;for(let g of e)g<a&&g>n&&(a=g);n=a,r=0;let c=0,d=0;for(let g=0;g<t;g++){let w=e[g];w>n&&(d|=1<<t-1-g,r++,c+=w)}if(r===3){for(let g=0;g<t&&r>0;g++){let w=e[g];if(w>n&&(r--,w*2>=c))return-1}return d}}while(r>3);return-1}static patternToChar(e){for(let t=0;t<Qe.CHARACTER_ENCODINGS.length;t++)if(Qe.CHARACTER_ENCODINGS[t]===e)return Qe.ALPHABET_STRING.charAt(t);if(e===Qe.ASTERISK_ENCODING)return"*";throw new N}static decodeExtended(e){let t=e.length,n="";for(let r=0;r<t;r++){let a=e.charAt(r);if(a==="+"||a==="$"||a==="%"||a==="/"){let c=e.charAt(r+1),d="\0";switch(a){case"+":if(c>="A"&&c<="Z")d=String.fromCharCode(c.charCodeAt(0)+32);else throw new W;break;case"$":if(c>="A"&&c<="Z")d=String.fromCharCode(c.charCodeAt(0)-64);else throw new W;break;case"%":if(c>="A"&&c<="E")d=String.fromCharCode(c.charCodeAt(0)-38);else if(c>="F"&&c<="J")d=String.fromCharCode(c.charCodeAt(0)-11);else if(c>="K"&&c<="O")d=String.fromCharCode(c.charCodeAt(0)+16);else if(c>="P"&&c<="T")d=String.fromCharCode(c.charCodeAt(0)+43);else if(c==="U")d="\0";else if(c==="V")d="@";else if(c==="W")d="`";else if(c==="X"||c==="Y"||c==="Z")d="";else throw new W;break;case"/":if(c>="A"&&c<="O")d=String.fromCharCode(c.charCodeAt(0)-32);else if(c==="Z")d=":";else throw new W;break}n+=d,r++}else n+=a}return n}}Qe.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",Qe.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],Qe.ASTERISK_ENCODING=148;class Ze extends ie{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(e,t,n){let r=this.decodeStart(t),a=this.decodeEnd(t),c=new z;Ze.decodeMiddle(t,r[1],a[0],c);let d=c.toString(),g=null;n!=null&&(g=n.get(Q.ALLOWED_LENGTHS)),g==null&&(g=Ze.DEFAULT_ALLOWED_LENGTHS);let w=d.length,E=!1,A=0;for(let L of g){if(w===L){E=!0;break}L>A&&(A=L)}if(!E&&w>A&&(E=!0),!E)throw new W;const I=[new Ee(r[1],e),new Ee(a[0],e)];return new _e(d,null,0,I,xe.ITF,new Date().getTime())}static decodeMiddle(e,t,n,r){let a=new Int32Array(10),c=new Int32Array(5),d=new Int32Array(5);for(a.fill(0),c.fill(0),d.fill(0);t<n;){ie.recordPattern(e,t,a);for(let w=0;w<5;w++){let E=2*w;c[w]=a[E],d[w]=a[E+1]}let g=Ze.decodeDigit(c);r.append(g.toString()),g=this.decodeDigit(d),r.append(g.toString()),a.forEach(function(w){t+=w})}}decodeStart(e){let t=Ze.skipWhiteSpace(e),n=Ze.findGuardPattern(e,t,Ze.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 N}static skipWhiteSpace(e){const t=e.getSize(),n=e.getNextSet(0);if(n===t)throw new N;return n}decodeEnd(e){e.reverse();try{let t=Ze.skipWhiteSpace(e),n;try{n=Ze.findGuardPattern(e,t,Ze.END_PATTERN_REVERSED[0])}catch(a){a instanceof N&&(n=Ze.findGuardPattern(e,t,Ze.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,a=new Int32Array(r),c=e.getSize(),d=!1,g=0,w=t;a.fill(0);for(let E=t;E<c;E++)if(e.get(E)!==d)a[g]++;else{if(g===r-1){if(ie.patternMatchVariance(a,n,Ze.MAX_INDIVIDUAL_VARIANCE)<Ze.MAX_AVG_VARIANCE)return[w,E];w+=a[0]+a[1],D.arraycopy(a,2,a,0,g-1),a[g-1]=0,a[g]=0,g--}else g++;a[g]=1,d=!d}throw new N}static decodeDigit(e){let t=Ze.MAX_AVG_VARIANCE,n=-1,r=Ze.PATTERNS.length;for(let a=0;a<r;a++){let c=Ze.PATTERNS[a],d=ie.patternMatchVariance(e,c,Ze.MAX_INDIVIDUAL_VARIANCE);d<t?(t=d,n=a):d===t&&(n=-1)}if(n>=0)return n%10;throw new N}}Ze.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])],Ze.MAX_AVG_VARIANCE=.38,Ze.MAX_INDIVIDUAL_VARIANCE=.5,Ze.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],Ze.START_PATTERN=Int32Array.from([1,1,1,1]),Ze.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class rt extends ie{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(e){let t=!1,n,r=0,a=Int32Array.from([0,0,0]);for(;!t;){a=Int32Array.from([0,0,0]),n=rt.findGuardPattern(e,r,!1,this.START_END_PATTERN,a);let c=n[0];r=n[1];let d=c-(r-c);d>=0&&(t=e.isRange(d,c,!1))}return n}static checkChecksum(e){return rt.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(t===0)return!1;let n=parseInt(e.charAt(t-1),10);return rt.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 a=e.charAt(r).charCodeAt(0)-48;if(a<0||a>9)throw new W;n+=a}n*=3;for(let r=t-2;r>=0;r-=2){let a=e.charAt(r).charCodeAt(0)-48;if(a<0||a>9)throw new W;n+=a}return(1e3-n)%10}static decodeEnd(e,t){return rt.findGuardPattern(e,t,!1,rt.START_END_PATTERN,new Int32Array(rt.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,a){let c=e.getSize();t=n?e.getNextUnset(t):e.getNextSet(t);let d=0,g=t,w=r.length,E=n;for(let A=t;A<c;A++)if(e.get(A)!==E)a[d]++;else{if(d===w-1){if(ie.patternMatchVariance(a,r,rt.MAX_INDIVIDUAL_VARIANCE)<rt.MAX_AVG_VARIANCE)return Int32Array.from([g,A]);g+=a[0]+a[1];let I=a.slice(2,a.length-1);for(let R=0;R<d-1;R++)a[R]=I[R];a[d-1]=0,a[d]=0,d--}else d++;a[d]=1,E=!E}throw new N}static decodeDigit(e,t,n,r){this.recordPattern(e,n,t);let a=this.MAX_AVG_VARIANCE,c=-1,d=r.length;for(let g=0;g<d;g++){let w=r[g],E=ie.patternMatchVariance(t,w,rt.MAX_INDIVIDUAL_VARIANCE);E<a&&(a=E,c=g)}if(c>=0)return c;throw new N}}rt.MAX_AVG_VARIANCE=.48,rt.MAX_INDIVIDUAL_VARIANCE=.7,rt.START_END_PATTERN=Int32Array.from([1,1,1]),rt.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),rt.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),rt.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 Cn{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,a=this.decodeMiddle(t,n,r),c=r.toString(),d=Cn.parseExtensionString(c),g=[new Ee((n[0]+n[1])/2,e),new Ee(a,e)],w=new _e(c,null,0,g,xe.UPC_EAN_EXTENSION,new Date().getTime());return d!=null&&w.putAllMetadata(d),w}decodeMiddle(e,t,n){let r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let a=e.getSize(),c=t[1],d=0;for(let w=0;w<5&&c<a;w++){let E=rt.decodeDigit(e,r,c,rt.L_AND_G_PATTERNS);n+=String.fromCharCode(48+E%10);for(let A of r)c+=A;E>=10&&(d|=1<<4-w),w!==4&&(c=e.getNextSet(c),c=e.getNextUnset(c))}if(n.length!==5)throw new N;let g=this.determineCheckDigit(d);if(Cn.extensionChecksum(n.toString())!==g)throw new N;return c}static extensionChecksum(e){let t=e.length,n=0;for(let r=t-2;r>=0;r-=2)n+=e.charAt(r).charCodeAt(0)-48;n*=3;for(let r=t-1;r>=0;r-=2)n+=e.charAt(r).charCodeAt(0)-48;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 N}static parseExtensionString(e){if(e.length!==5)return null;let t=Cn.parseExtension5String(e);return t==null?null:new Map([[Oe.SUGGESTED_PRICE,t]])}static parseExtension5String(e){let t;switch(e.charAt(0)){case"0":t="£";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(),a=n%100,c=a<10?"0"+a:a.toString();return t+r+"."+c}}class Gt{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(e,t,n){let r=this.decodeRowStringBuffer,a=this.decodeMiddle(t,n,r),c=r.toString(),d=Gt.parseExtensionString(c),g=[new Ee((n[0]+n[1])/2,e),new Ee(a,e)],w=new _e(c,null,0,g,xe.UPC_EAN_EXTENSION,new Date().getTime());return d!=null&&w.putAllMetadata(d),w}decodeMiddle(e,t,n){let r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let a=e.getSize(),c=t[1],d=0;for(let g=0;g<2&&c<a;g++){let w=rt.decodeDigit(e,r,c,rt.L_AND_G_PATTERNS);n+=String.fromCharCode(48+w%10);for(let E of r)c+=E;w>=10&&(d|=1<<1-g),g!==1&&(c=e.getNextSet(c),c=e.getNextUnset(c))}if(n.length!==2)throw new N;if(parseInt(n.toString())%4!==d)throw new N;return c}static parseExtensionString(e){return e.length!==2?null:new Map([[Oe.ISSUE_NUMBER,parseInt(e)]])}}class De{static decodeRow(e,t,n){let r=rt.findGuardPattern(t,n,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new Cn().decodeRow(e,t,r)}catch{return new Gt().decodeRow(e,t,r)}}}De.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class Me extends rt{constructor(){super(),this.decodeRowStringBuffer="",Me.L_AND_G_PATTERNS=Me.L_PATTERNS.map(e=>Int32Array.from(e));for(let e=10;e<20;e++){let t=Me.L_PATTERNS[e-10],n=new Int32Array(t.length);for(let r=0;r<t.length;r++)n[r]=t[t.length-r-1];Me.L_AND_G_PATTERNS[e]=n}}decodeRow(e,t,n){let r=Me.findStartGuardPattern(t),a=n==null?null:n.get(Q.NEED_RESULT_POINT_CALLBACK);if(a!=null){const le=new Ee((r[0]+r[1])/2,e);a.foundPossibleResultPoint(le)}let c=this.decodeMiddle(t,r,this.decodeRowStringBuffer),d=c.rowOffset,g=c.resultString;if(a!=null){const le=new Ee(d,e);a.foundPossibleResultPoint(le)}let w=this.decodeEnd(t,d);if(a!=null){const le=new Ee((w[0]+w[1])/2,e);a.foundPossibleResultPoint(le)}let E=w[1],A=E+(E-w[0]);if(A>=t.getSize()||!t.isRange(E,A,!1))throw new N;let I=g.toString();if(I.length<8)throw new W;if(!Me.checkChecksum(I))throw new B;let R=(r[1]+r[0])/2,L=(w[1]+w[0])/2,F=this.getBarcodeFormat(),q=[new Ee(R,e),new Ee(L,e)],ne=new _e(I,null,0,q,F,new Date().getTime()),de=0;try{let le=De.decodeRow(e,t,w[1]);ne.putMetadata(Oe.UPC_EAN_EXTENSION,le.getText()),ne.putAllMetadata(le.getResultMetadata()),ne.addResultPoints(le.getResultPoints()),de=le.getText().length}catch{}let fe=n==null?null:n.get(Q.ALLOWED_EAN_EXTENSIONS);if(fe!=null){let le=!1;for(let Ge in fe)if(de.toString()===Ge){le=!0;break}if(!le)throw new N}return ne}decodeEnd(e,t){return Me.findGuardPattern(e,t,!1,Me.START_END_PATTERN,new Int32Array(Me.START_END_PATTERN.length).fill(0))}static checkChecksum(e){return Me.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(t===0)return!1;let n=parseInt(e.charAt(t-1),10);return Me.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 a=e.charAt(r).charCodeAt(0)-48;if(a<0||a>9)throw new W;n+=a}n*=3;for(let r=t-2;r>=0;r-=2){let a=e.charAt(r).charCodeAt(0)-48;if(a<0||a>9)throw new W;n+=a}return(1e3-n)%10}}class ht extends Me{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 a=e.getSize(),c=t[1],d=0;for(let w=0;w<6&&c<a;w++){let E=Me.decodeDigit(e,r,c,Me.L_AND_G_PATTERNS);n+=String.fromCharCode(48+E%10);for(let A of r)c+=A;E>=10&&(d|=1<<5-w)}n=ht.determineFirstDigit(n,d),c=Me.findGuardPattern(e,c,!0,Me.MIDDLE_PATTERN,new Int32Array(Me.MIDDLE_PATTERN.length).fill(0))[1];for(let w=0;w<6&&c<a;w++){let E=Me.decodeDigit(e,r,c,Me.L_PATTERNS);n+=String.fromCharCode(48+E);for(let A of r)c+=A}return{rowOffset:c,resultString:n}}getBarcodeFormat(){return xe.EAN_13}static determineFirstDigit(e,t){for(let n=0;n<10;n++)if(t===this.FIRST_DIGIT_ENCODINGS[n])return e=String.fromCharCode(48+n)+e,e;throw new N}}ht.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class kt extends Me{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 a=e.getSize(),c=t[1];for(let g=0;g<4&&c<a;g++){let w=Me.decodeDigit(e,r,c,Me.L_PATTERNS);n+=String.fromCharCode(48+w);for(let E of r)c+=E}c=Me.findGuardPattern(e,c,!0,Me.MIDDLE_PATTERN,new Int32Array(Me.MIDDLE_PATTERN.length).fill(0))[1];for(let g=0;g<4&&c<a;g++){let w=Me.decodeDigit(e,r,c,Me.L_PATTERNS);n+=String.fromCharCode(48+w);for(let E of r)c+=E}return{rowOffset:c,resultString:n}}getBarcodeFormat(){return xe.EAN_8}}class vt extends Me{constructor(){super(...arguments),this.ean13Reader=new ht}getBarcodeFormat(){return xe.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 _e(t.substring(1),null,null,e.getResultPoints(),xe.UPC_A);return e.getResultMetadata()!=null&&n.putAllMetadata(e.getResultMetadata()),n}else throw new N}reset(){this.ean13Reader.reset()}}class pt extends Me{constructor(){super(),this.decodeMiddleCounters=new Int32Array(4)}decodeMiddle(e,t,n){const r=this.decodeMiddleCounters.map(w=>w);r[0]=0,r[1]=0,r[2]=0,r[3]=0;const a=e.getSize();let c=t[1],d=0;for(let w=0;w<6&&c<a;w++){const E=pt.decodeDigit(e,r,c,pt.L_AND_G_PATTERNS);n+=String.fromCharCode(48+E%10);for(let A of r)c+=A;E>=10&&(d|=1<<5-w)}let g=pt.determineNumSysAndCheckDigit(n,d);return{rowOffset:c,resultString:g}}decodeEnd(e,t){return pt.findGuardPatternWithoutCounters(e,t,!0,pt.MIDDLE_END_PATTERN)}checkChecksum(e){return Me.checkChecksum(pt.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 a=String.fromCharCode(48+n),c=String.fromCharCode(48+r);return a+e+c}throw N.getNotFoundInstance()}getBarcodeFormat(){return xe.UPC_E}static convertUPCEtoUPCA(e){const t=e.slice(1,7).split("").map(a=>a.charCodeAt(0)),n=new z;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()}}pt.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),pt.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 Fn extends ie{constructor(e){super();let t=e==null?null:e.get(Q.POSSIBLE_FORMATS),n=[];u(t)?(n.push(new ht),n.push(new vt),n.push(new kt),n.push(new pt)):(t.indexOf(xe.EAN_13)>-1&&n.push(new ht),t.indexOf(xe.UPC_A)>-1&&n.push(new vt),t.indexOf(xe.EAN_8)>-1&&n.push(new kt),t.indexOf(xe.UPC_E)>-1&&n.push(new pt)),this.readers=n}decodeRow(e,t,n){for(let r of this.readers)try{const a=r.decodeRow(e,t,n),c=a.getBarcodeFormat()===xe.EAN_13&&a.getText().charAt(0)==="0",d=n==null?null:n.get(Q.POSSIBLE_FORMATS),g=d==null||d.includes(xe.UPC_A);if(c&&g){const w=a.getRawBytes(),E=new _e(a.getText().substring(1),w,w?w.length:null,a.getResultPoints(),xe.UPC_A);return E.putAllMetadata(a.getResultMetadata()),E}return a}catch{}throw new N}reset(){for(let e of this.readers)e.reset()}}class Rt extends ie{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(ie.patternMatchVariance(e,t[n],Rt.MAX_INDIVIDUAL_VARIANCE)<Rt.MAX_AVG_VARIANCE)return n;throw new N}static count(e){return He.sum(new Int32Array(e))}static increment(e,t){let n=0,r=t[0];for(let a=1;a<e.length;a++)t[a]>r&&(r=t[a],n=a);e[n]++}static decrement(e,t){let n=0,r=t[0];for(let a=1;a<e.length;a++)t[a]<r&&(r=t[a],n=a);e[n]--}static isFinderPattern(e){let t=e[0]+e[1],n=t+e[2]+e[3],r=t/n;if(r>=Rt.MIN_FINDER_PATTERN_RATIO&&r<=Rt.MAX_FINDER_PATTERN_RATIO){let a=Number.MAX_SAFE_INTEGER,c=Number.MIN_SAFE_INTEGER;for(let d of e)d>c&&(c=d),d<a&&(a=d);return c<10*a}return!1}}Rt.MAX_AVG_VARIANCE=.2,Rt.MAX_INDIVIDUAL_VARIANCE=.45,Rt.MIN_FINDER_PATTERN_RATIO=9.5/12,Rt.MAX_FINDER_PATTERN_RATIO=12.5/14;class Hn{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 Hn))return!1;const t=e;return this.value===t.value&&this.checksumPortion===t.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class Ai{constructor(e,t,n,r,a){this.value=e,this.startEnd=t,this.value=e,this.startEnd=t,this.resultPoints=new Array,this.resultPoints.push(new Ee(n,a)),this.resultPoints.push(new Ee(r,a))}getValue(){return this.value}getStartEnd(){return this.startEnd}getResultPoints(){return this.resultPoints}equals(e){if(!(e instanceof Ai))return!1;const t=e;return this.value===t.value}hashCode(){return this.value}}class Nn{constructor(){}static getRSSvalue(e,t,n){let r=0;for(let g of e)r+=g;let a=0,c=0,d=e.length;for(let g=0;g<d-1;g++){let w;for(w=1,c|=1<<g;w<e[g];w++,c&=~(1<<g)){let E=Nn.combins(r-w-1,d-g-2);if(n&&c===0&&r-w-(d-g-1)>=d-g-1&&(E-=Nn.combins(r-w-(d-g),d-g-2)),d-g-1>1){let A=0;for(let I=r-w-(d-g-2);I>t;I--)A+=Nn.combins(r-w-I-1,d-g-3);E-=A*(d-1-g)}else r-w>t&&E--;a+=E}r-=w}return a}static combins(e,t){let n,r;e-t>t?(r=t,n=e-t):(r=e-t,n=t);let a=1,c=1;for(let d=e;d>n;d--)a*=d,c<=r&&(a/=c,c++);for(;c<=r;)a/=c,c++;return a}}class sg{static buildBitArray(e){let t=e.length*2-1;e[e.length-1].getRightChar()==null&&(t-=1);let n=12*t,r=new M(n),a=0,d=e[0].getRightChar().getValue();for(let g=11;g>=0;--g)d&1<<g&&r.set(a),a++;for(let g=1;g<e.length;++g){let w=e[g],E=w.getLeftChar().getValue();for(let A=11;A>=0;--A)E&1<<A&&r.set(a),a++;if(w.getRightChar()!=null){let A=w.getRightChar().getValue();for(let I=11;I>=0;--I)A&1<<I&&r.set(a),a++}}return r}}class rr{constructor(e,t){t?this.decodedInformation=null:(this.finished=e,this.decodedInformation=t)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class Ao{constructor(e){this.newPosition=e}getNewPosition(){return this.newPosition}}class Kt extends Ao{constructor(e,t){super(e),this.value=t}getValue(){return this.value}isFNC1(){return this.value===Kt.FNC1}}Kt.FNC1="$";class ir extends Ao{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 un extends Ao{constructor(e,t,n){if(super(e),t<0||t>10||n<0||n>10)throw new W;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===un.FNC1}isSecondDigitFNC1(){return this.secondDigit===un.FNC1}isAnyFNC1(){return this.firstDigit===un.FNC1||this.secondDigit===un.FNC1}}un.FNC1=10;class Ce{constructor(){}static parseFieldsInGeneralPurpose(e){if(!e)return null;if(e.length<2)throw new N;let t=e.substring(0,2);for(let a of Ce.TWO_DIGIT_DATA_LENGTH)if(a[0]===t)return a[1]===Ce.VARIABLE_LENGTH?Ce.processVariableAI(2,a[2],e):Ce.processFixedAI(2,a[1],e);if(e.length<3)throw new N;let n=e.substring(0,3);for(let a of Ce.THREE_DIGIT_DATA_LENGTH)if(a[0]===n)return a[1]===Ce.VARIABLE_LENGTH?Ce.processVariableAI(3,a[2],e):Ce.processFixedAI(3,a[1],e);for(let a of Ce.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(a[0]===n)return a[1]===Ce.VARIABLE_LENGTH?Ce.processVariableAI(4,a[2],e):Ce.processFixedAI(4,a[1],e);if(e.length<4)throw new N;let r=e.substring(0,4);for(let a of Ce.FOUR_DIGIT_DATA_LENGTH)if(a[0]===r)return a[1]===Ce.VARIABLE_LENGTH?Ce.processVariableAI(4,a[2],e):Ce.processFixedAI(4,a[1],e);throw new N}static processFixedAI(e,t,n){if(n.length<e)throw new N;let r=n.substring(0,e);if(n.length<e+t)throw new N;let a=n.substring(e,e+t),c=n.substring(e+t),d="("+r+")"+a,g=Ce.parseFieldsInGeneralPurpose(c);return g==null?d:d+g}static processVariableAI(e,t,n){let r=n.substring(0,e),a;n.length<e+t?a=n.length:a=e+t;let c=n.substring(e,a),d=n.substring(a),g="("+r+")"+c,w=Ce.parseFieldsInGeneralPurpose(d);return w==null?g:g+w}}Ce.VARIABLE_LENGTH=[],Ce.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",Ce.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",Ce.VARIABLE_LENGTH,20],["22",Ce.VARIABLE_LENGTH,29],["30",Ce.VARIABLE_LENGTH,8],["37",Ce.VARIABLE_LENGTH,8],["90",Ce.VARIABLE_LENGTH,30],["91",Ce.VARIABLE_LENGTH,30],["92",Ce.VARIABLE_LENGTH,30],["93",Ce.VARIABLE_LENGTH,30],["94",Ce.VARIABLE_LENGTH,30],["95",Ce.VARIABLE_LENGTH,30],["96",Ce.VARIABLE_LENGTH,30],["97",Ce.VARIABLE_LENGTH,3],["98",Ce.VARIABLE_LENGTH,30],["99",Ce.VARIABLE_LENGTH,30]],Ce.THREE_DIGIT_DATA_LENGTH=[["240",Ce.VARIABLE_LENGTH,30],["241",Ce.VARIABLE_LENGTH,30],["242",Ce.VARIABLE_LENGTH,6],["250",Ce.VARIABLE_LENGTH,30],["251",Ce.VARIABLE_LENGTH,30],["253",Ce.VARIABLE_LENGTH,17],["254",Ce.VARIABLE_LENGTH,20],["400",Ce.VARIABLE_LENGTH,30],["401",Ce.VARIABLE_LENGTH,30],["402",17],["403",Ce.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",Ce.VARIABLE_LENGTH,20],["421",Ce.VARIABLE_LENGTH,15],["422",3],["423",Ce.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],Ce.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",Ce.VARIABLE_LENGTH,15],["391",Ce.VARIABLE_LENGTH,18],["392",Ce.VARIABLE_LENGTH,15],["393",Ce.VARIABLE_LENGTH,18],["703",Ce.VARIABLE_LENGTH,30]],Ce.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",Ce.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",Ce.VARIABLE_LENGTH,20],["8003",Ce.VARIABLE_LENGTH,30],["8004",Ce.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",Ce.VARIABLE_LENGTH,30],["8008",Ce.VARIABLE_LENGTH,12],["8018",18],["8020",Ce.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",Ce.VARIABLE_LENGTH,70],["8200",Ce.VARIABLE_LENGTH,70]];class yr{constructor(e){this.buffer=new z,this.information=e}decodeAllCodes(e,t){let n=t,r=null;do{let a=this.decodeGeneralPurposeField(n,r),c=Ce.parseFieldsInGeneralPurpose(a.getNewString());if(c!=null&&e.append(c),a.isRemaining()?r=""+a.getRemainingValue():r=null,n===a.getNewPosition())break;n=a.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 a=this.extractNumericValueFromBitArray(e,4);return a===0?new un(this.information.getSize(),un.FNC1,un.FNC1):new un(this.information.getSize(),a-1,un.FNC1)}let t=this.extractNumericValueFromBitArray(e,7),n=(t-8)/11,r=(t-8)%11;return new un(e+7,n,r)}extractNumericValueFromBitArray(e,t){return yr.extractNumericValueFromBitArray(this.information,e,t)}static extractNumericValueFromBitArray(e,t,n){let r=0;for(let a=0;a<n;++a)e.get(t+a)&&(r|=1<<n-a-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 ir(this.current.getPosition(),this.buffer.toString(),n.getRemainingValue()):new ir(this.current.getPosition(),this.buffer.toString())}parseBlocks(){let e,t;do{let n=this.current.getPosition();if(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 ir(this.current.getPosition(),this.buffer.toString()):t=new ir(this.current.getPosition(),this.buffer.toString(),e.getSecondDigit()),new rr(!0,t)}if(this.buffer.append(e.getFirstDigit()),e.isSecondDigitFNC1()){let t=new ir(this.current.getPosition(),this.buffer.toString());return new rr(!0,t)}this.buffer.append(e.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new rr(!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 ir(this.current.getPosition(),this.buffer.toString());return new rr(!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 rr(!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 ir(this.current.getPosition(),this.buffer.toString());return new rr(!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 rr(!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 Kt(e+5,Kt.FNC1);if(t>=5&&t<15)return new Kt(e+5,"0"+(t-5));let n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<90)return new Kt(e+7,""+(n+1));if(n>=90&&n<116)return new Kt(e+7,""+(n+7));let r=this.extractNumericValueFromBitArray(e,8),a;switch(r){case 232:a="!";break;case 233:a='"';break;case 234:a="%";break;case 235:a="&";break;case 236:a="'";break;case 237:a="(";break;case 238:a=")";break;case 239:a="*";break;case 240:a="+";break;case 241:a=",";break;case 242:a="-";break;case 243:a=".";break;case 244:a="/";break;case 245:a=":";break;case 246:a=";";break;case 247:a="<";break;case 248:a="=";break;case 249:a=">";break;case 250:a="?";break;case 251:a="_";break;case 252:a=" ";break;default:throw new W}return new Kt(e+8,a)}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 Kt(e+5,Kt.FNC1);if(t>=5&&t<15)return new Kt(e+5,"0"+(t-5));let n=this.extractNumericValueFromBitArray(e,6);if(n>=32&&n<58)return new Kt(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 Ke("Decoding invalid alphanumeric value: "+n)}return new Kt(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 Io{constructor(e){this.information=e,this.generalDecoder=new yr(e)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class Qt extends Io{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 a=this.getGeneralDecoder().extractNumericValueFromBitArray(t+10*r,10);a/100===0&&e.append("0"),a/10===0&&e.append("0"),e.append(a)}Qt.appendCheckDigit(e,n)}static appendCheckDigit(e,t){let n=0;for(let r=0;r<13;r++){let a=e.charAt(r+t).charCodeAt(0)-48;n+=r&1?a:3*a}n=10-n%10,n===10&&(n=0),e.append(n)}}Qt.GTIN_SIZE=40;class br extends Qt{constructor(e){super(e)}parseInformation(){let e=new z;e.append("(01)");let t=e.length(),n=this.getGeneralDecoder().extractNumericValueFromBitArray(br.HEADER_SIZE,4);return e.append(n),this.encodeCompressedGtinWithoutAI(e,br.HEADER_SIZE+4,t),this.getGeneralDecoder().decodeAllCodes(e,br.HEADER_SIZE+44)}}br.HEADER_SIZE=4;class Ii extends Io{constructor(e){super(e)}parseInformation(){let e=new z;return this.getGeneralDecoder().decodeAllCodes(e,Ii.HEADER_SIZE)}}Ii.HEADER_SIZE=5;class Si extends Qt{constructor(e){super(e)}encodeCompressedWeight(e,t,n){let r=this.getGeneralDecoder().extractNumericValueFromBitArray(t,n);this.addWeightCode(e,r);let a=this.checkWeight(r),c=1e5;for(let d=0;d<5;++d)a/c===0&&e.append("0"),c/=10;e.append(a)}}class Tn extends Si{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()!=Tn.HEADER_SIZE+Si.GTIN_SIZE+Tn.WEIGHT_SIZE)throw new N;let e=new z;return this.encodeCompressedGtin(e,Tn.HEADER_SIZE),this.encodeCompressedWeight(e,Tn.HEADER_SIZE+Si.GTIN_SIZE,Tn.WEIGHT_SIZE),e.toString()}}Tn.HEADER_SIZE=5,Tn.WEIGHT_SIZE=15;class ag extends Tn{constructor(e){super(e)}addWeightCode(e,t){e.append("(3103)")}checkWeight(e){return e}}class lg extends Tn{constructor(e){super(e)}addWeightCode(e,t){t<1e4?e.append("(3202)"):e.append("(3203)")}checkWeight(e){return e<1e4?e:e-1e4}}class kn extends Qt{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<kn.HEADER_SIZE+Qt.GTIN_SIZE)throw new N;let e=new z;this.encodeCompressedGtin(e,kn.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(kn.HEADER_SIZE+Qt.GTIN_SIZE,kn.LAST_DIGIT_SIZE);e.append("(392"),e.append(t),e.append(")");let n=this.getGeneralDecoder().decodeGeneralPurposeField(kn.HEADER_SIZE+Qt.GTIN_SIZE+kn.LAST_DIGIT_SIZE,null);return e.append(n.getNewString()),e.toString()}}kn.HEADER_SIZE=8,kn.LAST_DIGIT_SIZE=2;class Wt extends Qt{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<Wt.HEADER_SIZE+Qt.GTIN_SIZE)throw new N;let e=new z;this.encodeCompressedGtin(e,Wt.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(Wt.HEADER_SIZE+Qt.GTIN_SIZE,Wt.LAST_DIGIT_SIZE);e.append("(393"),e.append(t),e.append(")");let n=this.getGeneralDecoder().extractNumericValueFromBitArray(Wt.HEADER_SIZE+Qt.GTIN_SIZE+Wt.LAST_DIGIT_SIZE,Wt.FIRST_THREE_DIGITS_SIZE);n/100==0&&e.append("0"),n/10==0&&e.append("0"),e.append(n);let r=this.getGeneralDecoder().decodeGeneralPurposeField(Wt.HEADER_SIZE+Qt.GTIN_SIZE+Wt.LAST_DIGIT_SIZE+Wt.FIRST_THREE_DIGITS_SIZE,null);return e.append(r.getNewString()),e.toString()}}Wt.HEADER_SIZE=8,Wt.LAST_DIGIT_SIZE=2,Wt.FIRST_THREE_DIGITS_SIZE=10;class gt extends Si{constructor(e,t,n){super(e),this.dateCode=n,this.firstAIdigits=t}parseInformation(){if(this.getInformation().getSize()!=gt.HEADER_SIZE+gt.GTIN_SIZE+gt.WEIGHT_SIZE+gt.DATE_SIZE)throw new N;let e=new z;return this.encodeCompressedGtin(e,gt.HEADER_SIZE),this.encodeCompressedWeight(e,gt.HEADER_SIZE+gt.GTIN_SIZE,gt.WEIGHT_SIZE),this.encodeCompressedDate(e,gt.HEADER_SIZE+gt.GTIN_SIZE+gt.WEIGHT_SIZE),e.toString()}encodeCompressedDate(e,t){let n=this.getGeneralDecoder().extractNumericValueFromBitArray(t,gt.DATE_SIZE);if(n==38400)return;e.append("("),e.append(this.dateCode),e.append(")");let r=n%32;n/=32;let a=n%12+1;n/=12;let c=n;c/10==0&&e.append("0"),e.append(c),a/10==0&&e.append("0"),e.append(a),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}}gt.HEADER_SIZE=8,gt.WEIGHT_SIZE=20,gt.DATE_SIZE=16;function Fa(b){try{if(b.get(1))return new br(b);if(!b.get(2))return new Ii(b);switch(yr.extractNumericValueFromBitArray(b,1,4)){case 4:return new ag(b);case 5:return new lg(b)}switch(yr.extractNumericValueFromBitArray(b,1,5)){case 12:return new kn(b);case 13:return new Wt(b)}switch(yr.extractNumericValueFromBitArray(b,1,7)){case 56:return new gt(b,"310","11");case 57:return new gt(b,"320","11");case 58:return new gt(b,"310","13");case 59:return new gt(b,"320","13");case 60:return new gt(b,"310","15");case 61:return new gt(b,"320","15");case 62:return new gt(b,"310","17");case 63:return new gt(b,"320","17")}}catch(e){throw console.log(e),new Ke("unknown decoder: "+b)}}class Gn{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 Gn?Gn.equalsOrNull(e.leftchar,t.leftchar)&&Gn.equalsOrNull(e.rightchar,t.rightchar)&&Gn.equalsOrNull(e.finderpattern,t.finderpattern):!1}static equalsOrNull(e,t){return e===null?t===null:Gn.equals(e,t)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class So{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 So?this.checkEqualitity(e,t)&&e.wasReversed===t.wasReversed:!1}checkEqualitity(e,t){if(!e||!t)return;let n;return e.forEach((r,a)=>{t.forEach(c=>{r.getLeftChar().getValue()===c.getLeftChar().getValue()&&r.getRightChar().getValue()===c.getRightChar().getValue()&&r.getFinderPatter().getValue()===c.getFinderPatter().getValue()&&(n=!0)})}),n}}class ae extends Rt{constructor(e){super(...arguments),this.pairs=new Array(ae.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 ae.constructResult(this.decodeRow2pairs(e,t))}catch(r){this.verbose&&console.log(r)}return this.pairs.length=0,this.startFromEven=!0,ae.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(a){if(a instanceof N){if(!this.pairs.length)throw new N;n=!0}}if(this.checkChecksum())return this.pairs;let r;if(this.rows.length?r=!0:r=!1,this.storeRow(e,!1),r){let a=this.checkRowsBoolean(!1);if(a!=null||(a=this.checkRowsBoolean(!0),a!=null))return a}throw new N}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 c of e)this.pairs.push(c.getPairs());if(this.pairs.push(r.getPairs()),!ae.isValidSequence(this.pairs))continue;if(this.checkChecksum())return this.pairs;let a=new Array(e);a.push(r);try{return this.checkRows(a,n+1)}catch(c){this.verbose&&console.log(c)}}throw new N}static isValidSequence(e){for(let t of ae.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,a=!1;for(;n<this.rows.length;){let c=this.rows[n];if(c.getRowNumber()>e){a=c.isEquivalent(this.pairs);break}r=c.isEquivalent(this.pairs),n++}a||r||ae.isPartialRow(this.pairs,this.rows)||(this.rows.push(n,new So(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 a of e)if(Gn.equals(r,a))break}}static isPartialRow(e,t){for(let n of t){let r=!0;for(let a of e){let c=!1;for(let d of n.getPairs())if(a.equals(d)){c=!0;break}if(!c){r=!1;break}}if(r)return!0}return!1}getRows(){return this.rows}static constructResult(e){let t=sg.buildBitArray(e),r=Fa(t).parseInformation(),a=e[0].getFinderPattern().getResultPoints(),c=e[e.length-1].getFinderPattern().getResultPoints(),d=[a[0],a[1],c[0],c[1]];return new _e(r,null,null,d,xe.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(),a=2;for(let d=1;d<this.pairs.size();++d){let g=this.pairs.get(d);r+=g.getLeftChar().getChecksumPortion(),a++;let w=g.getRightChar();w!=null&&(r+=w.getChecksumPortion(),a++)}return r%=211,211*(a-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 a,c=!0,d=-1;do this.findNextPair(e,t,d),a=this.parseFoundFinderPattern(e,n,r),a==null?d=ae.getNextSecondBar(e,this.startEnd[0]):c=!1;while(c);let g=this.decodeDataCharacter(e,a,r,!0);if(!this.isEmptyPair(t)&&t[t.length-1].mustBeLast())throw new N;let w;try{w=this.decodeDataCharacter(e,a,r,!1)}catch(E){w=null,this.verbose&&console.log(E)}return new Gn(g,w,a,!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 a=e.getSize(),c;n>=0?c=n:this.isEmptyPair(t)?c=0:c=t[t.length-1].getFinderPattern().getStartEnd()[1];let d=t.length%2!=0;this.startFromEven&&(d=!d);let g=!1;for(;c<a&&(g=!e.get(c),!!g);)c++;let w=0,E=c;for(let A=c;A<a;A++)if(e.get(A)!=g)r[w]++;else{if(w==3){if(d&&ae.reverseCounters(r),ae.isFinderPattern(r)){this.startEnd[0]=E,this.startEnd[1]=A;return}d&&ae.reverseCounters(r),E+=r[0]+r[1],r[0]=r[2],r[1]=r[3],r[2]=0,r[3]=0,w--}else w++;r[w]=1,g=!g}throw new N}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,a,c;if(n){let w=this.startEnd[0]-1;for(;w>=0&&!e.get(w);)w--;w++,r=this.startEnd[0]-w,a=w,c=this.startEnd[1]}else a=this.startEnd[0],c=e.getNextUnset(this.startEnd[1]+1),r=c-this.startEnd[1];let d=this.getDecodeFinderCounters();D.arraycopy(d,0,d,1,d.length-1),d[0]=r;let g;try{g=this.parseFinderValue(d,ae.FINDER_PATTERNS)}catch{return null}return new Ai(g,[a,c],a,c,t)}decodeDataCharacter(e,t,n,r){let a=this.getDataCharacterCounters();for(let st=0;st<a.length;st++)a[st]=0;if(r)ae.recordPatternInReverse(e,t.getStartEnd()[0],a);else{ae.recordPattern(e,t.getStartEnd()[1],a);for(let st=0,Lt=a.length-1;st<Lt;st++,Lt--){let an=a[st];a[st]=a[Lt],a[Lt]=an}}let c=17,d=He.sum(new Int32Array(a))/c,g=(t.getStartEnd()[1]-t.getStartEnd()[0])/15;if(Math.abs(d-g)/g>.3)throw new N;let w=this.getOddCounts(),E=this.getEvenCounts(),A=this.getOddRoundingErrors(),I=this.getEvenRoundingErrors();for(let st=0;st<a.length;st++){let Lt=1*a[st]/d,an=Lt+.5;if(an<1){if(Lt<.3)throw new N;an=1}else if(an>8){if(Lt>8.7)throw new N;an=8}let Tr=st/2;st&1?(E[Tr]=an,I[Tr]=Lt-an):(w[Tr]=an,A[Tr]=Lt-an)}this.adjustOddEvenCounts(c);let R=4*t.getValue()+(n?0:2)+(r?0:1)-1,L=0,F=0;for(let st=w.length-1;st>=0;st--){if(ae.isNotA1left(t,n,r)){let Lt=ae.WEIGHTS[R][2*st];F+=w[st]*Lt}L+=w[st]}let q=0;for(let st=E.length-1;st>=0;st--)if(ae.isNotA1left(t,n,r)){let Lt=ae.WEIGHTS[R][2*st+1];q+=E[st]*Lt}let ne=F+q;if(L&1||L>13||L<4)throw new N;let de=(13-L)/2,fe=ae.SYMBOL_WIDEST[de],le=9-fe,Ge=Nn.getRSSvalue(w,fe,!0),ve=Nn.getRSSvalue(E,le,!1),en=ae.EVEN_TOTAL_SUBSET[de],En=ae.GSUM[de],tn=Ge*en+ve+En;return new Hn(tn,ne)}static isNotA1left(e,t,n){return!(e.getValue()==0&&t&&n)}adjustOddEvenCounts(e){let t=He.sum(new Int32Array(this.getOddCounts())),n=He.sum(new Int32Array(this.getEvenCounts())),r=!1,a=!1;t>13?a=!0:t<4&&(r=!0);let c=!1,d=!1;n>13?d=!0:n<4&&(c=!0);let g=t+n-e,w=(t&1)==1,E=(n&1)==0;if(g==1)if(w){if(E)throw new N;a=!0}else{if(!E)throw new N;d=!0}else if(g==-1)if(w){if(E)throw new N;r=!0}else{if(!E)throw new N;c=!0}else if(g==0){if(w){if(!E)throw new N;t<n?(r=!0,d=!0):(a=!0,c=!0)}else if(E)throw new N}else throw new N;if(r){if(a)throw new N;ae.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(a&&ae.decrement(this.getOddCounts(),this.getOddRoundingErrors()),c){if(d)throw new N;ae.increment(this.getEvenCounts(),this.getOddRoundingErrors())}d&&ae.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}ae.SYMBOL_WIDEST=[7,5,4,3,1],ae.EVEN_TOTAL_SUBSET=[4,20,52,104,204],ae.GSUM=[0,348,1388,2948,3988],ae.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])],ae.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,91],[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]],ae.FINDER_PAT_A=0,ae.FINDER_PAT_B=1,ae.FINDER_PAT_C=2,ae.FINDER_PAT_D=3,ae.FINDER_PAT_E=4,ae.FINDER_PAT_F=5,ae.FINDER_PATTERN_SEQUENCES=[[ae.FINDER_PAT_A,ae.FINDER_PAT_A],[ae.FINDER_PAT_A,ae.FINDER_PAT_B,ae.FINDER_PAT_B],[ae.FINDER_PAT_A,ae.FINDER_PAT_C,ae.FINDER_PAT_B,ae.FINDER_PAT_D],[ae.FINDER_PAT_A,ae.FINDER_PAT_E,ae.FINDER_PAT_B,ae.FINDER_PAT_D,ae.FINDER_PAT_C],[ae.FINDER_PAT_A,ae.FINDER_PAT_E,ae.FINDER_PAT_B,ae.FINDER_PAT_D,ae.FINDER_PAT_D,ae.FINDER_PAT_F],[ae.FINDER_PAT_A,ae.FINDER_PAT_E,ae.FINDER_PAT_B,ae.FINDER_PAT_D,ae.FINDER_PAT_E,ae.FINDER_PAT_F,ae.FINDER_PAT_F],[ae.FINDER_PAT_A,ae.FINDER_PAT_A,ae.FINDER_PAT_B,ae.FINDER_PAT_B,ae.FINDER_PAT_C,ae.FINDER_PAT_C,ae.FINDER_PAT_D,ae.FINDER_PAT_D],[ae.FINDER_PAT_A,ae.FINDER_PAT_A,ae.FINDER_PAT_B,ae.FINDER_PAT_B,ae.FINDER_PAT_C,ae.FINDER_PAT_C,ae.FINDER_PAT_D,ae.FINDER_PAT_E,ae.FINDER_PAT_E],[ae.FINDER_PAT_A,ae.FINDER_PAT_A,ae.FINDER_PAT_B,ae.FINDER_PAT_B,ae.FINDER_PAT_C,ae.FINDER_PAT_C,ae.FINDER_PAT_D,ae.FINDER_PAT_E,ae.FINDER_PAT_F,ae.FINDER_PAT_F],[ae.FINDER_PAT_A,ae.FINDER_PAT_A,ae.FINDER_PAT_B,ae.FINDER_PAT_B,ae.FINDER_PAT_C,ae.FINDER_PAT_D,ae.FINDER_PAT_D,ae.FINDER_PAT_E,ae.FINDER_PAT_E,ae.FINDER_PAT_F,ae.FINDER_PAT_F]],ae.MAX_PAIRS=11;class cg extends Hn{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 _t extends Rt{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(e,t,n){const r=this.decodePair(t,!1,e,n);_t.addOrTally(this.possibleLeftPairs,r),t.reverse();let a=this.decodePair(t,!0,e,n);_t.addOrTally(this.possibleRightPairs,a),t.reverse();for(let c of this.possibleLeftPairs)if(c.getCount()>1){for(let d of this.possibleRightPairs)if(d.getCount()>1&&_t.checkChecksum(c,d))return _t.constructResult(c,d)}throw new N}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(),a=new z;for(let w=13-r.length;w>0;w--)a.append("0");a.append(r);let c=0;for(let w=0;w<13;w++){let E=a.charAt(w).charCodeAt(0)-48;c+=w&1?E:3*E}c=10-c%10,c===10&&(c=0),a.append(c.toString());let d=e.getFinderPattern().getResultPoints(),g=t.getFinderPattern().getResultPoints();return new _e(a.toString(),null,0,[d[0],d[1],g[0],g[1]],xe.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 a=this.findFinderPattern(e,t),c=this.parseFoundFinderPattern(e,n,t,a),d=r==null?null:r.get(Q.NEED_RESULT_POINT_CALLBACK);if(d!=null){let E=(a[0]+a[1])/2;t&&(E=e.getSize()-1-E),d.foundPossibleResultPoint(new Ee(E,n))}let g=this.decodeDataCharacter(e,c,!0),w=this.decodeDataCharacter(e,c,!1);return new cg(1597*g.getValue()+w.getValue(),g.getChecksumPortion()+4*w.getChecksumPortion(),c)}catch{return null}}decodeDataCharacter(e,t,n){let r=this.getDataCharacterCounters();for(let q=0;q<r.length;q++)r[q]=0;if(n)ie.recordPatternInReverse(e,t.getStartEnd()[0],r);else{ie.recordPattern(e,t.getStartEnd()[1]+1,r);for(let q=0,ne=r.length-1;q<ne;q++,ne--){let de=r[q];r[q]=r[ne],r[ne]=de}}let a=n?16:15,c=He.sum(new Int32Array(r))/a,d=this.getOddCounts(),g=this.getEvenCounts(),w=this.getOddRoundingErrors(),E=this.getEvenRoundingErrors();for(let q=0;q<r.length;q++){let ne=r[q]/c,de=Math.floor(ne+.5);de<1?de=1:de>8&&(de=8);let fe=Math.floor(q/2);q&1?(g[fe]=de,E[fe]=ne-de):(d[fe]=de,w[fe]=ne-de)}this.adjustOddEvenCounts(n,a);let A=0,I=0;for(let q=d.length-1;q>=0;q--)I*=9,I+=d[q],A+=d[q];let R=0,L=0;for(let q=g.length-1;q>=0;q--)R*=9,R+=g[q],L+=g[q];let F=I+3*R;if(n){if(A&1||A>12||A<4)throw new N;let q=(12-A)/2,ne=_t.OUTSIDE_ODD_WIDEST[q],de=9-ne,fe=Nn.getRSSvalue(d,ne,!1),le=Nn.getRSSvalue(g,de,!0),Ge=_t.OUTSIDE_EVEN_TOTAL_SUBSET[q],ve=_t.OUTSIDE_GSUM[q];return new Hn(fe*Ge+le+ve,F)}else{if(L&1||L>10||L<4)throw new N;let q=(10-L)/2,ne=_t.INSIDE_ODD_WIDEST[q],de=9-ne,fe=Nn.getRSSvalue(d,ne,!0),le=Nn.getRSSvalue(g,de,!1),Ge=_t.INSIDE_ODD_TOTAL_SUBSET[q],ve=_t.INSIDE_GSUM[q];return new Hn(le*Ge+fe+ve,F)}}findFinderPattern(e,t){let n=this.getDecodeFinderCounters();n[0]=0,n[1]=0,n[2]=0,n[3]=0;let r=e.getSize(),a=!1,c=0;for(;c<r&&(a=!e.get(c),t!==a);)c++;let d=0,g=c;for(let w=c;w<r;w++)if(e.get(w)!==a)n[d]++;else{if(d===3){if(Rt.isFinderPattern(n))return[g,w];g+=n[0]+n[1],n[0]=n[2],n[1]=n[3],n[2]=0,n[3]=0,d--}else d++;n[d]=1,a=!a}throw new N}parseFoundFinderPattern(e,t,n,r){let a=e.get(r[0]),c=r[0]-1;for(;c>=0&&a!==e.get(c);)c--;c++;const d=r[0]-c,g=this.getDecodeFinderCounters(),w=new Int32Array(g.length);D.arraycopy(g,0,w,1,g.length-1),w[0]=d;const E=this.parseFinderValue(w,_t.FINDER_PATTERNS);let A=c,I=r[1];return n&&(A=e.getSize()-1-A,I=e.getSize()-1-I),new Ai(E,[c,r[1]],A,I,t)}adjustOddEvenCounts(e,t){let n=He.sum(new Int32Array(this.getOddCounts())),r=He.sum(new Int32Array(this.getEvenCounts())),a=!1,c=!1,d=!1,g=!1;e?(n>12?c=!0:n<4&&(a=!0),r>12?g=!0:r<4&&(d=!0)):(n>11?c=!0:n<5&&(a=!0),r>10?g=!0:r<4&&(d=!0));let w=n+r-t,E=(n&1)===(e?1:0),A=(r&1)===1;if(w===1)if(E){if(A)throw new N;c=!0}else{if(!A)throw new N;g=!0}else if(w===-1)if(E){if(A)throw new N;a=!0}else{if(!A)throw new N;d=!0}else if(w===0){if(E){if(!A)throw new N;n<r?(a=!0,g=!0):(c=!0,d=!0)}else if(A)throw new N}else throw new N;if(a){if(c)throw new N;Rt.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(c&&Rt.decrement(this.getOddCounts(),this.getOddRoundingErrors()),d){if(g)throw new N;Rt.increment(this.getEvenCounts(),this.getOddRoundingErrors())}g&&Rt.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}_t.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],_t.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],_t.OUTSIDE_GSUM=[0,161,961,2015,2715],_t.INSIDE_GSUM=[0,336,1036,1516],_t.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],_t.INSIDE_ODD_WIDEST=[2,4,6,8],_t.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 Ar extends ie{constructor(e,t){super(),this.readers=[],this.verbose=t===!0;const n=e?e.get(Q.POSSIBLE_FORMATS):null,r=e&&e.get(Q.ASSUME_CODE_39_CHECK_DIGIT)!==void 0;n?((n.includes(xe.EAN_13)||n.includes(xe.UPC_A)||n.includes(xe.EAN_8)||n.includes(xe.UPC_E))&&this.readers.push(new Fn(e)),n.includes(xe.CODE_39)&&this.readers.push(new Qe(r)),n.includes(xe.CODE_128)&&this.readers.push(new se),n.includes(xe.ITF)&&this.readers.push(new Ze),n.includes(xe.RSS_14)&&this.readers.push(new _t),n.includes(xe.RSS_EXPANDED)&&this.readers.push(new ae(this.verbose))):(this.readers.push(new Fn(e)),this.readers.push(new Qe),this.readers.push(new Fn(e)),this.readers.push(new se),this.readers.push(new Ze),this.readers.push(new _t),this.readers.push(new ae(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 N}reset(){this.readers.forEach(e=>e.reset())}}class ug extends Ie{constructor(e=500,t){super(new Ar(t),e,t)}}class nt{constructor(e,t,n){this.ecCodewords=e,this.ecBlocks=[t],n&&this.ecBlocks.push(n)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class Je{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class je{constructor(e,t,n,r,a,c){this.versionNumber=e,this.symbolSizeRows=t,this.symbolSizeColumns=n,this.dataRegionSizeRows=r,this.dataRegionSizeColumns=a,this.ecBlocks=c;let d=0;const g=c.getECCodewords(),w=c.getECBlocks();for(let E of w)d+=E.getCount()*(E.getDataCodewords()+g);this.totalCodewords=d}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}static getVersionForDimensions(e,t){if(e&1||t&1)throw new W;for(let n of je.VERSIONS)if(n.symbolSizeRows===e&&n.symbolSizeColumns===t)return n;throw new W}toString(){return""+this.versionNumber}static buildVersions(){return[new je(1,10,10,8,8,new nt(5,new Je(1,3))),new je(2,12,12,10,10,new nt(7,new Je(1,5))),new je(3,14,14,12,12,new nt(10,new Je(1,8))),new je(4,16,16,14,14,new nt(12,new Je(1,12))),new je(5,18,18,16,16,new nt(14,new Je(1,18))),new je(6,20,20,18,18,new nt(18,new Je(1,22))),new je(7,22,22,20,20,new nt(20,new Je(1,30))),new je(8,24,24,22,22,new nt(24,new Je(1,36))),new je(9,26,26,24,24,new nt(28,new Je(1,44))),new je(10,32,32,14,14,new nt(36,new Je(1,62))),new je(11,36,36,16,16,new nt(42,new Je(1,86))),new je(12,40,40,18,18,new nt(48,new Je(1,114))),new je(13,44,44,20,20,new nt(56,new Je(1,144))),new je(14,48,48,22,22,new nt(68,new Je(1,174))),new je(15,52,52,24,24,new nt(42,new Je(2,102))),new je(16,64,64,14,14,new nt(56,new Je(2,140))),new je(17,72,72,16,16,new nt(36,new Je(4,92))),new je(18,80,80,18,18,new nt(48,new Je(4,114))),new je(19,88,88,20,20,new nt(56,new Je(4,144))),new je(20,96,96,22,22,new nt(68,new Je(4,174))),new je(21,104,104,24,24,new nt(56,new Je(6,136))),new je(22,120,120,18,18,new nt(68,new Je(6,175))),new je(23,132,132,20,20,new nt(62,new Je(8,163))),new je(24,144,144,22,22,new nt(62,new Je(8,156),new Je(2,155))),new je(25,8,18,6,16,new nt(7,new Je(1,5))),new je(26,8,32,6,14,new nt(11,new Je(1,10))),new je(27,12,26,10,24,new nt(14,new Je(1,16))),new je(28,12,36,10,16,new nt(18,new Je(1,22))),new je(29,16,36,14,16,new nt(24,new Je(1,32))),new je(30,16,48,14,22,new nt(28,new Je(1,49)))]}}je.VERSIONS=je.buildVersions();class No{constructor(e){const t=e.getHeight();if(t<8||t>144||t&1)throw new W;this.version=No.readVersion(e),this.mappingBitMatrix=this.extractDataRegion(e),this.readMappingMatrix=new X(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(e){const t=e.getHeight(),n=e.getWidth();return je.getVersionForDimensions(t,n)}readCodewords(){const e=new Int8Array(this.version.getTotalCodewords());let t=0,n=4,r=0;const a=this.mappingBitMatrix.getHeight(),c=this.mappingBitMatrix.getWidth();let d=!1,g=!1,w=!1,E=!1;do if(n===a&&r===0&&!d)e[t++]=this.readCorner1(a,c)&255,n-=2,r+=2,d=!0;else if(n===a-2&&r===0&&c&3&&!g)e[t++]=this.readCorner2(a,c)&255,n-=2,r+=2,g=!0;else if(n===a+4&&r===2&&!(c&7)&&!w)e[t++]=this.readCorner3(a,c)&255,n-=2,r+=2,w=!0;else if(n===a-2&&r===0&&(c&7)===4&&!E)e[t++]=this.readCorner4(a,c)&255,n-=2,r+=2,E=!0;else{do n<a&&r>=0&&!this.readMappingMatrix.get(r,n)&&(e[t++]=this.readUtah(n,r,a,c)&255),n-=2,r+=2;while(n>=0&&r<c);n+=1,r+=3;do n>=0&&r<c&&!this.readMappingMatrix.get(r,n)&&(e[t++]=this.readUtah(n,r,a,c)&255),n+=2,r-=2;while(n<a&&r>=0);n+=3,r+=1}while(n<a||r<c);if(t!==this.version.getTotalCodewords())throw new W;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 a=0;return this.readModule(e-2,t-2,n,r)&&(a|=1),a<<=1,this.readModule(e-2,t-1,n,r)&&(a|=1),a<<=1,this.readModule(e-1,t-2,n,r)&&(a|=1),a<<=1,this.readModule(e-1,t-1,n,r)&&(a|=1),a<<=1,this.readModule(e-1,t,n,r)&&(a|=1),a<<=1,this.readModule(e,t-2,n,r)&&(a|=1),a<<=1,this.readModule(e,t-1,n,r)&&(a|=1),a<<=1,this.readModule(e,t,n,r)&&(a|=1),a}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 y("Dimension of bitMatrix must match the version size");const r=this.version.getDataRegionSizeRows(),a=this.version.getDataRegionSizeColumns(),c=t/r|0,d=n/a|0,g=c*r,w=d*a,E=new X(w,g);for(let A=0;A<c;++A){const I=A*r;for(let R=0;R<d;++R){const L=R*a;for(let F=0;F<r;++F){const q=A*(r+2)+1+F,ne=I+F;for(let de=0;de<a;++de){const fe=R*(a+2)+1+de;if(e.get(fe,q)){const le=L+de;E.set(le,ne)}}}}}return E}}class To{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t){const n=t.getECBlocks();let r=0;const a=n.getECBlocks();for(let F of a)r+=F.getCount();const c=new Array(r);let d=0;for(let F of a)for(let q=0;q<F.getCount();q++){const ne=F.getDataCodewords(),de=n.getECCodewords()+ne;c[d++]=new To(ne,new Uint8Array(de))}const w=c[0].codewords.length-n.getECCodewords(),E=w-1;let A=0;for(let F=0;F<E;F++)for(let q=0;q<d;q++)c[q].codewords[F]=e[A++];const I=t.getVersionNumber()===24,R=I?8:d;for(let F=0;F<R;F++)c[F].codewords[w-1]=e[A++];const L=c[0].codewords.length;for(let F=w;F<L;F++)for(let q=0;q<d;q++){const ne=I?(q+8)%d:q,de=I&&ne>7?F-1:F;c[ne].codewords[de]=e[A++]}if(A!==e.length)throw new y;return c}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class ko{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 y(""+e);let t=0,n=this.bitOffset,r=this.byteOffset;const a=this.bytes;if(n>0){const c=8-n,d=e<c?e:c,g=c-d,w=255>>8-d<<g;t=(a[r]&w)>>g,e-=d,n+=d,n===8&&(n=0,r++)}if(e>0){for(;e>=8;)t=t<<8|a[r]&255,r++,e-=8;if(e>0){const c=8-e,d=255>>c<<c;t=t<<e|(a[r]&d)>>c,n+=e}}return this.bitOffset=n,this.byteOffset=r,t}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var St;(function(b){b[b.PAD_ENCODE=0]="PAD_ENCODE",b[b.ASCII_ENCODE=1]="ASCII_ENCODE",b[b.C40_ENCODE=2]="C40_ENCODE",b[b.TEXT_ENCODE=3]="TEXT_ENCODE",b[b.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",b[b.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",b[b.BASE256_ENCODE=6]="BASE256_ENCODE"})(St||(St={}));class Wn{static decode(e){const t=new ko(e),n=new z,r=new z,a=new Array;let c=St.ASCII_ENCODE;do if(c===St.ASCII_ENCODE)c=this.decodeAsciiSegment(t,n,r);else{switch(c){case St.C40_ENCODE:this.decodeC40Segment(t,n);break;case St.TEXT_ENCODE:this.decodeTextSegment(t,n);break;case St.ANSIX12_ENCODE:this.decodeAnsiX12Segment(t,n);break;case St.EDIFACT_ENCODE:this.decodeEdifactSegment(t,n);break;case St.BASE256_ENCODE:this.decodeBase256Segment(t,n,a);break;default:throw new W}c=St.ASCII_ENCODE}while(c!==St.PAD_ENCODE&&t.available()>0);return r.length()>0&&n.append(r.toString()),new Re(e,n.toString(),a.length===0?null:a,null)}static decodeAsciiSegment(e,t,n){let r=!1;do{let a=e.readBits(8);if(a===0)throw new W;if(a<=128)return r&&(a+=128),t.append(String.fromCharCode(a-1)),St.ASCII_ENCODE;if(a===129)return St.PAD_ENCODE;if(a<=229){const c=a-130;c<10&&t.append("0"),t.append(""+c)}else switch(a){case 230:return St.C40_ENCODE;case 231:return St.BASE256_ENCODE;case 232:t.append("");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 St.ANSIX12_ENCODE;case 239:return St.TEXT_ENCODE;case 240:return St.EDIFACT_ENCODE;case 241:break;default:if(a!==254||e.available()!==0)throw new W;break}}while(e.available()>0);return St.ASCII_ENCODE}static decodeC40Segment(e,t){let n=!1;const r=[];let a=0;do{if(e.available()===8)return;const c=e.readBits(8);if(c===254)return;this.parseTwoBytes(c,e.readBits(8),r);for(let d=0;d<3;d++){const g=r[d];switch(a){case 0:if(g<3)a=g+1;else if(g<this.C40_BASIC_SET_CHARS.length){const w=this.C40_BASIC_SET_CHARS[g];n?(t.append(String.fromCharCode(w.charCodeAt(0)+128)),n=!1):t.append(w)}else throw new W;break;case 1:n?(t.append(String.fromCharCode(g+128)),n=!1):t.append(String.fromCharCode(g)),a=0;break;case 2:if(g<this.C40_SHIFT2_SET_CHARS.length){const w=this.C40_SHIFT2_SET_CHARS[g];n?(t.append(String.fromCharCode(w.charCodeAt(0)+128)),n=!1):t.append(w)}else switch(g){case 27:t.append("");break;case 30:n=!0;break;default:throw new W}a=0;break;case 3:n?(t.append(String.fromCharCode(g+224)),n=!1):t.append(String.fromCharCode(g+96)),a=0;break;default:throw new W}}}while(e.available()>0)}static decodeTextSegment(e,t){let n=!1,r=[],a=0;do{if(e.available()===8)return;const c=e.readBits(8);if(c===254)return;this.parseTwoBytes(c,e.readBits(8),r);for(let d=0;d<3;d++){const g=r[d];switch(a){case 0:if(g<3)a=g+1;else if(g<this.TEXT_BASIC_SET_CHARS.length){const w=this.TEXT_BASIC_SET_CHARS[g];n?(t.append(String.fromCharCode(w.charCodeAt(0)+128)),n=!1):t.append(w)}else throw new W;break;case 1:n?(t.append(String.fromCharCode(g+128)),n=!1):t.append(String.fromCharCode(g)),a=0;break;case 2:if(g<this.TEXT_SHIFT2_SET_CHARS.length){const w=this.TEXT_SHIFT2_SET_CHARS[g];n?(t.append(String.fromCharCode(w.charCodeAt(0)+128)),n=!1):t.append(w)}else switch(g){case 27:t.append("");break;case 30:n=!0;break;default:throw new W}a=0;break;case 3:if(g<this.TEXT_SHIFT3_SET_CHARS.length){const w=this.TEXT_SHIFT3_SET_CHARS[g];n?(t.append(String.fromCharCode(w.charCodeAt(0)+128)),n=!1):t.append(w),a=0}else throw new W;break;default:throw new W}}}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 a=0;a<3;a++){const c=n[a];switch(c){case 0:t.append("\r");break;case 1:t.append("*");break;case 2:t.append(">");break;case 3:t.append(" ");break;default:if(c<14)t.append(String.fromCharCode(c+44));else if(c<40)t.append(String.fromCharCode(c+51));else throw new W;break}}}while(e.available()>0)}static parseTwoBytes(e,t,n){let r=(e<<8)+t-1,a=Math.floor(r/1600);n[0]=a,r-=a*1600,a=Math.floor(r/40),n[1]=a,n[2]=r-a*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 a=8-e.getBitOffset();a!==8&&e.readBits(a);return}r&32||(r|=64),t.append(String.fromCharCode(r))}}while(e.available()>0)}static decodeBase256Segment(e,t,n){let r=1+e.getByteOffset();const a=this.unrandomize255State(e.readBits(8),r++);let c;if(a===0?c=e.available()/8|0:a<250?c=a:c=250*(a-249)+this.unrandomize255State(e.readBits(8),r++),c<0)throw new W;const d=new Uint8Array(c);for(let g=0;g<c;g++){if(e.available()<8)throw new W;d[g]=this.unrandomize255State(e.readBits(8),r++)}n.push(d);try{t.append(j.decode(d,G.ISO88591))}catch(g){throw new Ke("Platform does not support required encoding: "+g.message)}}static unrandomize255State(e,t){const n=149*t%255+1,r=e-n;return r>=0?r:r+256}}Wn.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"],Wn.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],Wn.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"],Wn.TEXT_SHIFT2_SET_CHARS=Wn.C40_SHIFT2_SET_CHARS,Wn.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","{","|","}","~",""];class dg{constructor(){this.rsDecoder=new mt(ue.DATA_MATRIX_FIELD_256)}decode(e){const t=new No(e),n=t.getVersion(),r=t.readCodewords(),a=To.getDataBlocks(r,n);let c=0;for(let w of a)c+=w.getNumDataCodewords();const d=new Uint8Array(c),g=a.length;for(let w=0;w<g;w++){const E=a[w],A=E.getCodewords(),I=E.getNumDataCodewords();this.correctErrors(A,I);for(let R=0;R<I;R++)d[R*g+w]=A[R]}return Wn.decode(d)}correctErrors(e,t){const n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new B}for(let r=0;r<t;r++)e[r]=n[r]}}class Et{constructor(e){this.image=e,this.rectangleDetector=new _n(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 N;t=this.shiftToModuleCenter(t);const n=t[0],r=t[1],a=t[2],c=t[3];let d=this.transitionsBetween(n,c)+1,g=this.transitionsBetween(a,c)+1;(d&1)===1&&(d+=1),(g&1)===1&&(g+=1),4*d<7*g&&4*g<7*d&&(d=g=Math.max(d,g));let w=Et.sampleGrid(this.image,n,r,a,c,d,g);return new _r(w,[n,r,a,c])}static shiftPoint(e,t,n){let r=(t.getX()-e.getX())/(n+1),a=(t.getY()-e.getY())/(n+1);return new Ee(e.getX()+r,e.getY()+a)}static moveAway(e,t,n){let r=e.getX(),a=e.getY();return r<t?r-=1:r+=1,a<n?a-=1:a+=1,new Ee(r,a)}detectSolid1(e){let t=e[0],n=e[1],r=e[3],a=e[2],c=this.transitionsBetween(t,n),d=this.transitionsBetween(n,r),g=this.transitionsBetween(r,a),w=this.transitionsBetween(a,t),E=c,A=[a,t,n,r];return E>d&&(E=d,A[0]=t,A[1]=n,A[2]=r,A[3]=a),E>g&&(E=g,A[0]=n,A[1]=r,A[2]=a,A[3]=t),E>w&&(A[0]=r,A[1]=a,A[2]=t,A[3]=n),A}detectSolid2(e){let t=e[0],n=e[1],r=e[2],a=e[3],c=this.transitionsBetween(t,a),d=Et.shiftPoint(n,r,(c+1)*4),g=Et.shiftPoint(r,n,(c+1)*4),w=this.transitionsBetween(d,t),E=this.transitionsBetween(g,a);return w<E?(e[0]=t,e[1]=n,e[2]=r,e[3]=a):(e[0]=n,e[1]=r,e[2]=a,e[3]=t),e}correctTopRight(e){let t=e[0],n=e[1],r=e[2],a=e[3],c=this.transitionsBetween(t,a),d=this.transitionsBetween(n,a),g=Et.shiftPoint(t,n,(d+1)*4),w=Et.shiftPoint(r,n,(c+1)*4);c=this.transitionsBetween(g,a),d=this.transitionsBetween(w,a);let E=new Ee(a.getX()+(r.getX()-n.getX())/(c+1),a.getY()+(r.getY()-n.getY())/(c+1)),A=new Ee(a.getX()+(t.getX()-n.getX())/(d+1),a.getY()+(t.getY()-n.getY())/(d+1));if(!this.isValid(E))return this.isValid(A)?A:null;if(!this.isValid(A))return E;let I=this.transitionsBetween(g,E)+this.transitionsBetween(w,E),R=this.transitionsBetween(g,A)+this.transitionsBetween(w,A);return I>R?E:A}shiftToModuleCenter(e){let t=e[0],n=e[1],r=e[2],a=e[3],c=this.transitionsBetween(t,a)+1,d=this.transitionsBetween(r,a)+1,g=Et.shiftPoint(t,n,d*4),w=Et.shiftPoint(r,n,c*4);c=this.transitionsBetween(g,a)+1,d=this.transitionsBetween(w,a)+1,(c&1)===1&&(c+=1),(d&1)===1&&(d+=1);let E=(t.getX()+n.getX()+r.getX()+a.getX())/4,A=(t.getY()+n.getY()+r.getY()+a.getY())/4;t=Et.moveAway(t,E,A),n=Et.moveAway(n,E,A),r=Et.moveAway(r,E,A),a=Et.moveAway(a,E,A);let I,R;return g=Et.shiftPoint(t,n,d*4),g=Et.shiftPoint(g,a,c*4),I=Et.shiftPoint(n,t,d*4),I=Et.shiftPoint(I,r,c*4),w=Et.shiftPoint(r,a,d*4),w=Et.shiftPoint(w,n,c*4),R=Et.shiftPoint(a,r,d*4),R=Et.shiftPoint(R,t,c*4),[g,I,w,R]}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,a,c,d){return $t.getInstance().sampleGrid(e,c,d,.5,.5,c-.5,.5,c-.5,d-.5,.5,d-.5,t.getX(),t.getY(),a.getX(),a.getY(),r.getX(),r.getY(),n.getX(),n.getY())}transitionsBetween(e,t){let n=Math.trunc(e.getX()),r=Math.trunc(e.getY()),a=Math.trunc(t.getX()),c=Math.trunc(t.getY()),d=Math.abs(c-r)>Math.abs(a-n);if(d){let F=n;n=r,r=F,F=a,a=c,c=F}let g=Math.abs(a-n),w=Math.abs(c-r),E=-g/2,A=r<c?1:-1,I=n<a?1:-1,R=0,L=this.image.get(d?r:n,d?n:r);for(let F=n,q=r;F!==a;F+=I){let ne=this.image.get(d?q:F,d?F:q);if(ne!==L&&(R++,L=ne),E+=w,E>0){if(q===c)break;q+=A,E-=g}}return R}}class Xn{constructor(){this.decoder=new dg}decode(e,t=null){let n,r;if(t!=null&&t.has(Q.PURE_BARCODE)){const w=Xn.extractPureBits(e.getBlackMatrix());n=this.decoder.decode(w),r=Xn.NO_POINTS}else{const w=new Et(e.getBlackMatrix()).detect();n=this.decoder.decode(w.getBits()),r=w.getPoints()}const a=n.getRawBytes(),c=new _e(n.getText(),a,8*a.length,r,xe.DATA_MATRIX,D.currentTimeMillis()),d=n.getByteSegments();d!=null&&c.putMetadata(Oe.BYTE_SEGMENTS,d);const g=n.getECLevel();return g!=null&&c.putMetadata(Oe.ERROR_CORRECTION_LEVEL,g),c}reset(){}static extractPureBits(e){const t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t==null||n==null)throw new N;const r=this.moduleSize(t,e);let a=t[1];const c=n[1];let d=t[0];const w=(n[0]-d+1)/r,E=(c-a+1)/r;if(w<=0||E<=0)throw new N;const A=r/2;a+=A,d+=A;const I=new X(w,E);for(let R=0;R<E;R++){const L=a+R*r;for(let F=0;F<w;F++)e.get(d+F*r,L)&&I.set(F,R)}return I}static moduleSize(e,t){const n=t.getWidth();let r=e[0];const a=e[1];for(;r<n&&t.get(r,a);)r++;if(r===n)throw new N;const c=r-e[0];if(c===0)throw new N;return c}}Xn.NO_POINTS=[];class fg extends Ie{constructor(e=500){super(new Xn,e)}}var Ir;(function(b){b[b.L=0]="L",b[b.M=1]="M",b[b.Q=2]="Q",b[b.H=3]="H"})(Ir||(Ir={}));class ct{constructor(e,t,n){this.value=e,this.stringValue=t,this.bits=n,ct.FOR_BITS.set(n,this),ct.FOR_VALUE.set(e,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(e){switch(e){case"L":return ct.L;case"M":return ct.M;case"Q":return ct.Q;case"H":return ct.H;default:throw new C(e+"not available")}}toString(){return this.stringValue}equals(e){if(!(e instanceof ct))return!1;const t=e;return this.value===t.value}static forBits(e){if(e<0||e>=ct.FOR_BITS.size)throw new y;return ct.FOR_BITS.get(e)}}ct.FOR_BITS=new Map,ct.FOR_VALUE=new Map,ct.L=new ct(Ir.L,"L",1),ct.M=new ct(Ir.M,"M",0),ct.Q=new ct(Ir.Q,"Q",3),ct.H=new ct(Ir.H,"H",2);class Ut{constructor(e){this.errorCorrectionLevel=ct.forBits(e>>3&3),this.dataMask=e&7}static numBitsDiffering(e,t){return O.bitCount(e^t)}static decodeFormatInformation(e,t){const n=Ut.doDecodeFormatInformation(e,t);return n!==null?n:Ut.doDecodeFormatInformation(e^Ut.FORMAT_INFO_MASK_QR,t^Ut.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(e,t){let n=Number.MAX_SAFE_INTEGER,r=0;for(const a of Ut.FORMAT_INFO_DECODE_LOOKUP){const c=a[0];if(c===e||c===t)return new Ut(a[1]);let d=Ut.numBitsDiffering(e,c);d<n&&(r=a[1],n=d),e!==t&&(d=Ut.numBitsDiffering(t,c),d<n&&(r=a[1],n=d))}return n<=3?new Ut(r):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(e){if(!(e instanceof Ut))return!1;const t=e;return this.errorCorrectionLevel===t.errorCorrectionLevel&&this.dataMask===t.dataMask}}Ut.FORMAT_INFO_MASK_QR=21522,Ut.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 ${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 k{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class Ae{constructor(e,t,...n){this.versionNumber=e,this.alignmentPatternCenters=t,this.ecBlocks=n;let r=0;const a=n[0].getECCodewordsPerBlock(),c=n[0].getECBlocks();for(const d of c)r+=d.getCount()*(d.getDataCodewords()+a);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 W;try{return this.getVersionForNumber((e-17)/4)}catch{throw new W}}static getVersionForNumber(e){if(e<1||e>40)throw new y;return Ae.VERSIONS[e-1]}static decodeVersionInformation(e){let t=Number.MAX_SAFE_INTEGER,n=0;for(let r=0;r<Ae.VERSION_DECODE_INFO.length;r++){const a=Ae.VERSION_DECODE_INFO[r];if(a===e)return Ae.getVersionForNumber(r+7);const c=Ut.numBitsDiffering(e,a);c<t&&(n=r+7,t=c)}return t<=3?Ae.getVersionForNumber(n):null}buildFunctionPattern(){const e=this.getDimensionForVersion(),t=new X(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 a=this.alignmentPatternCenters[r]-2;for(let c=0;c<n;c++)r===0&&(c===0||c===n-1)||r===n-1&&c===0||t.setRegion(this.alignmentPatternCenters[c]-2,a,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}}Ae.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]),Ae.VERSIONS=[new Ae(1,new Int32Array(0),new $(7,new k(1,19)),new $(10,new k(1,16)),new $(13,new k(1,13)),new $(17,new k(1,9))),new Ae(2,Int32Array.from([6,18]),new $(10,new k(1,34)),new $(16,new k(1,28)),new $(22,new k(1,22)),new $(28,new k(1,16))),new Ae(3,Int32Array.from([6,22]),new $(15,new k(1,55)),new $(26,new k(1,44)),new $(18,new k(2,17)),new $(22,new k(2,13))),new Ae(4,Int32Array.from([6,26]),new $(20,new k(1,80)),new $(18,new k(2,32)),new $(26,new k(2,24)),new $(16,new k(4,9))),new Ae(5,Int32Array.from([6,30]),new $(26,new k(1,108)),new $(24,new k(2,43)),new $(18,new k(2,15),new k(2,16)),new $(22,new k(2,11),new k(2,12))),new Ae(6,Int32Array.from([6,34]),new $(18,new k(2,68)),new $(16,new k(4,27)),new $(24,new k(4,19)),new $(28,new k(4,15))),new Ae(7,Int32Array.from([6,22,38]),new $(20,new k(2,78)),new $(18,new k(4,31)),new $(18,new k(2,14),new k(4,15)),new $(26,new k(4,13),new k(1,14))),new Ae(8,Int32Array.from([6,24,42]),new $(24,new k(2,97)),new $(22,new k(2,38),new k(2,39)),new $(22,new k(4,18),new k(2,19)),new $(26,new k(4,14),new k(2,15))),new Ae(9,Int32Array.from([6,26,46]),new $(30,new k(2,116)),new $(22,new k(3,36),new k(2,37)),new $(20,new k(4,16),new k(4,17)),new $(24,new k(4,12),new k(4,13))),new Ae(10,Int32Array.from([6,28,50]),new $(18,new k(2,68),new k(2,69)),new $(26,new k(4,43),new k(1,44)),new $(24,new k(6,19),new k(2,20)),new $(28,new k(6,15),new k(2,16))),new Ae(11,Int32Array.from([6,30,54]),new $(20,new k(4,81)),new $(30,new k(1,50),new k(4,51)),new $(28,new k(4,22),new k(4,23)),new $(24,new k(3,12),new k(8,13))),new Ae(12,Int32Array.from([6,32,58]),new $(24,new k(2,92),new k(2,93)),new $(22,new k(6,36),new k(2,37)),new $(26,new k(4,20),new k(6,21)),new $(28,new k(7,14),new k(4,15))),new Ae(13,Int32Array.from([6,34,62]),new $(26,new k(4,107)),new $(22,new k(8,37),new k(1,38)),new $(24,new k(8,20),new k(4,21)),new $(22,new k(12,11),new k(4,12))),new Ae(14,Int32Array.from([6,26,46,66]),new $(30,new k(3,115),new k(1,116)),new $(24,new k(4,40),new k(5,41)),new $(20,new k(11,16),new k(5,17)),new $(24,new k(11,12),new k(5,13))),new Ae(15,Int32Array.from([6,26,48,70]),new $(22,new k(5,87),new k(1,88)),new $(24,new k(5,41),new k(5,42)),new $(30,new k(5,24),new k(7,25)),new $(24,new k(11,12),new k(7,13))),new Ae(16,Int32Array.from([6,26,50,74]),new $(24,new k(5,98),new k(1,99)),new $(28,new k(7,45),new k(3,46)),new $(24,new k(15,19),new k(2,20)),new $(30,new k(3,15),new k(13,16))),new Ae(17,Int32Array.from([6,30,54,78]),new $(28,new k(1,107),new k(5,108)),new $(28,new k(10,46),new k(1,47)),new $(28,new k(1,22),new k(15,23)),new $(28,new k(2,14),new k(17,15))),new Ae(18,Int32Array.from([6,30,56,82]),new $(30,new k(5,120),new k(1,121)),new $(26,new k(9,43),new k(4,44)),new $(28,new k(17,22),new k(1,23)),new $(28,new k(2,14),new k(19,15))),new Ae(19,Int32Array.from([6,30,58,86]),new $(28,new k(3,113),new k(4,114)),new $(26,new k(3,44),new k(11,45)),new $(26,new k(17,21),new k(4,22)),new $(26,new k(9,13),new k(16,14))),new Ae(20,Int32Array.from([6,34,62,90]),new $(28,new k(3,107),new k(5,108)),new $(26,new k(3,41),new k(13,42)),new $(30,new k(15,24),new k(5,25)),new $(28,new k(15,15),new k(10,16))),new Ae(21,Int32Array.from([6,28,50,72,94]),new $(28,new k(4,116),new k(4,117)),new $(26,new k(17,42)),new $(28,new k(17,22),new k(6,23)),new $(30,new k(19,16),new k(6,17))),new Ae(22,Int32Array.from([6,26,50,74,98]),new $(28,new k(2,111),new k(7,112)),new $(28,new k(17,46)),new $(30,new k(7,24),new k(16,25)),new $(24,new k(34,13))),new Ae(23,Int32Array.from([6,30,54,78,102]),new $(30,new k(4,121),new k(5,122)),new $(28,new k(4,47),new k(14,48)),new $(30,new k(11,24),new k(14,25)),new $(30,new k(16,15),new k(14,16))),new Ae(24,Int32Array.from([6,28,54,80,106]),new $(30,new k(6,117),new k(4,118)),new $(28,new k(6,45),new k(14,46)),new $(30,new k(11,24),new k(16,25)),new $(30,new k(30,16),new k(2,17))),new Ae(25,Int32Array.from([6,32,58,84,110]),new $(26,new k(8,106),new k(4,107)),new $(28,new k(8,47),new k(13,48)),new $(30,new k(7,24),new k(22,25)),new $(30,new k(22,15),new k(13,16))),new Ae(26,Int32Array.from([6,30,58,86,114]),new $(28,new k(10,114),new k(2,115)),new $(28,new k(19,46),new k(4,47)),new $(28,new k(28,22),new k(6,23)),new $(30,new k(33,16),new k(4,17))),new Ae(27,Int32Array.from([6,34,62,90,118]),new $(30,new k(8,122),new k(4,123)),new $(28,new k(22,45),new k(3,46)),new $(30,new k(8,23),new k(26,24)),new $(30,new k(12,15),new k(28,16))),new Ae(28,Int32Array.from([6,26,50,74,98,122]),new $(30,new k(3,117),new k(10,118)),new $(28,new k(3,45),new k(23,46)),new $(30,new k(4,24),new k(31,25)),new $(30,new k(11,15),new k(31,16))),new Ae(29,Int32Array.from([6,30,54,78,102,126]),new $(30,new k(7,116),new k(7,117)),new $(28,new k(21,45),new k(7,46)),new $(30,new k(1,23),new k(37,24)),new $(30,new k(19,15),new k(26,16))),new Ae(30,Int32Array.from([6,26,52,78,104,130]),new $(30,new k(5,115),new k(10,116)),new $(28,new k(19,47),new k(10,48)),new $(30,new k(15,24),new k(25,25)),new $(30,new k(23,15),new k(25,16))),new Ae(31,Int32Array.from([6,30,56,82,108,134]),new $(30,new k(13,115),new k(3,116)),new $(28,new k(2,46),new k(29,47)),new $(30,new k(42,24),new k(1,25)),new $(30,new k(23,15),new k(28,16))),new Ae(32,Int32Array.from([6,34,60,86,112,138]),new $(30,new k(17,115)),new $(28,new k(10,46),new k(23,47)),new $(30,new k(10,24),new k(35,25)),new $(30,new k(19,15),new k(35,16))),new Ae(33,Int32Array.from([6,30,58,86,114,142]),new $(30,new k(17,115),new k(1,116)),new $(28,new k(14,46),new k(21,47)),new $(30,new k(29,24),new k(19,25)),new $(30,new k(11,15),new k(46,16))),new Ae(34,Int32Array.from([6,34,62,90,118,146]),new $(30,new k(13,115),new k(6,116)),new $(28,new k(14,46),new k(23,47)),new $(30,new k(44,24),new k(7,25)),new $(30,new k(59,16),new k(1,17))),new Ae(35,Int32Array.from([6,30,54,78,102,126,150]),new $(30,new k(12,121),new k(7,122)),new $(28,new k(12,47),new k(26,48)),new $(30,new k(39,24),new k(14,25)),new $(30,new k(22,15),new k(41,16))),new Ae(36,Int32Array.from([6,24,50,76,102,128,154]),new $(30,new k(6,121),new k(14,122)),new $(28,new k(6,47),new k(34,48)),new $(30,new k(46,24),new k(10,25)),new $(30,new k(2,15),new k(64,16))),new Ae(37,Int32Array.from([6,28,54,80,106,132,158]),new $(30,new k(17,122),new k(4,123)),new $(28,new k(29,46),new k(14,47)),new $(30,new k(49,24),new k(10,25)),new $(30,new k(24,15),new k(46,16))),new Ae(38,Int32Array.from([6,32,58,84,110,136,162]),new $(30,new k(4,122),new k(18,123)),new $(28,new k(13,46),new k(32,47)),new $(30,new k(48,24),new k(14,25)),new $(30,new k(42,15),new k(32,16))),new Ae(39,Int32Array.from([6,26,54,82,110,138,166]),new $(30,new k(20,117),new k(4,118)),new $(28,new k(40,47),new k(7,48)),new $(30,new k(43,24),new k(22,25)),new $(30,new k(10,15),new k(67,16))),new Ae(40,Int32Array.from([6,30,58,86,114,142,170]),new $(30,new k(19,118),new k(6,119)),new $(28,new k(18,47),new k(31,48)),new $(30,new k(34,24),new k(34,25)),new $(30,new k(20,15),new k(61,16)))];var Ot;(function(b){b[b.DATA_MASK_000=0]="DATA_MASK_000",b[b.DATA_MASK_001=1]="DATA_MASK_001",b[b.DATA_MASK_010=2]="DATA_MASK_010",b[b.DATA_MASK_011=3]="DATA_MASK_011",b[b.DATA_MASK_100=4]="DATA_MASK_100",b[b.DATA_MASK_101=5]="DATA_MASK_101",b[b.DATA_MASK_110=6]="DATA_MASK_110",b[b.DATA_MASK_111=7]="DATA_MASK_111"})(Ot||(Ot={}));class dn{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)}}dn.values=new Map([[Ot.DATA_MASK_000,new dn(Ot.DATA_MASK_000,(b,e)=>(b+e&1)===0)],[Ot.DATA_MASK_001,new dn(Ot.DATA_MASK_001,(b,e)=>(b&1)===0)],[Ot.DATA_MASK_010,new dn(Ot.DATA_MASK_010,(b,e)=>e%3===0)],[Ot.DATA_MASK_011,new dn(Ot.DATA_MASK_011,(b,e)=>(b+e)%3===0)],[Ot.DATA_MASK_100,new dn(Ot.DATA_MASK_100,(b,e)=>(Math.floor(b/2)+Math.floor(e/3)&1)===0)],[Ot.DATA_MASK_101,new dn(Ot.DATA_MASK_101,(b,e)=>b*e%6===0)],[Ot.DATA_MASK_110,new dn(Ot.DATA_MASK_110,(b,e)=>b*e%6<3)],[Ot.DATA_MASK_111,new dn(Ot.DATA_MASK_111,(b,e)=>(b+e+b*e%3&1)===0)]]);class hg{constructor(e){const t=e.getHeight();if(t<21||(t&3)!==1)throw new W;this.bitMatrix=e}readFormatInformation(){if(this.parsedFormatInfo!==null&&this.parsedFormatInfo!==void 0)return this.parsedFormatInfo;let e=0;for(let a=0;a<6;a++)e=this.copyBit(a,8,e);e=this.copyBit(7,8,e),e=this.copyBit(8,8,e),e=this.copyBit(8,7,e);for(let a=5;a>=0;a--)e=this.copyBit(8,a,e);const t=this.bitMatrix.getHeight();let n=0;const r=t-7;for(let a=t-1;a>=r;a--)n=this.copyBit(8,a,n);for(let a=t-8;a<t;a++)n=this.copyBit(a,8,n);if(this.parsedFormatInfo=Ut.decodeFormatInformation(e,n),this.parsedFormatInfo!==null)return this.parsedFormatInfo;throw new W}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 Ae.getVersionForNumber(t);let n=0;const r=e-11;for(let c=5;c>=0;c--)for(let d=e-9;d>=r;d--)n=this.copyBit(d,c,n);let a=Ae.decodeVersionInformation(n);if(a!==null&&a.getDimensionForVersion()===e)return this.parsedVersion=a,a;n=0;for(let c=5;c>=0;c--)for(let d=e-9;d>=r;d--)n=this.copyBit(c,d,n);if(a=Ae.decodeVersionInformation(n),a!==null&&a.getDimensionForVersion()===e)return this.parsedVersion=a,a;throw new W}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=dn.values.get(e.getDataMask()),r=this.bitMatrix.getHeight();n.unmaskBitMatrix(this.bitMatrix,r);const a=t.buildFunctionPattern();let c=!0;const d=new Uint8Array(t.getTotalCodewords());let g=0,w=0,E=0;for(let A=r-1;A>0;A-=2){A===6&&A--;for(let I=0;I<r;I++){const R=c?r-1-I:I;for(let L=0;L<2;L++)a.get(A-L,R)||(E++,w<<=1,this.bitMatrix.get(A-L,R)&&(w|=1),E===8&&(d[g++]=w,E=0,w=0))}c=!c}if(g!==t.getTotalCodewords())throw new W;return d}remask(){if(this.parsedFormatInfo===null)return;const e=dn.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,a=e.getHeight();r<a;r++)e.get(t,r)!==e.get(r,t)&&(e.flip(r,t),e.flip(t,r))}}class Ro{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t,n){if(e.length!==t.getTotalCodewords())throw new y;const r=t.getECBlocksForLevel(n);let a=0;const c=r.getECBlocks();for(const L of c)a+=L.getCount();const d=new Array(a);let g=0;for(const L of c)for(let F=0;F<L.getCount();F++){const q=L.getDataCodewords(),ne=r.getECCodewordsPerBlock()+q;d[g++]=new Ro(q,new Uint8Array(ne))}const w=d[0].codewords.length;let E=d.length-1;for(;E>=0&&d[E].codewords.length!==w;)E--;E++;const A=w-r.getECCodewordsPerBlock();let I=0;for(let L=0;L<A;L++)for(let F=0;F<g;F++)d[F].codewords[L]=e[I++];for(let L=E;L<g;L++)d[L].codewords[A]=e[I++];const R=d[0].codewords.length;for(let L=A;L<R;L++)for(let F=0;F<g;F++){const q=F<E?L:L+1;d[F].codewords[q]=e[I++]}return d}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}var fn;(function(b){b[b.TERMINATOR=0]="TERMINATOR",b[b.NUMERIC=1]="NUMERIC",b[b.ALPHANUMERIC=2]="ALPHANUMERIC",b[b.STRUCTURED_APPEND=3]="STRUCTURED_APPEND",b[b.BYTE=4]="BYTE",b[b.ECI=5]="ECI",b[b.KANJI=6]="KANJI",b[b.FNC1_FIRST_POSITION=7]="FNC1_FIRST_POSITION",b[b.FNC1_SECOND_POSITION=8]="FNC1_SECOND_POSITION",b[b.HANZI=9]="HANZI"})(fn||(fn={}));class Se{constructor(e,t,n,r){this.value=e,this.stringValue=t,this.characterCountBitsForVersions=n,this.bits=r,Se.FOR_BITS.set(r,this),Se.FOR_VALUE.set(e,this)}static forBits(e){const t=Se.FOR_BITS.get(e);if(t===void 0)throw new y;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 Se))return!1;const t=e;return this.value===t.value}toString(){return this.stringValue}}Se.FOR_BITS=new Map,Se.FOR_VALUE=new Map,Se.TERMINATOR=new Se(fn.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),Se.NUMERIC=new Se(fn.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),Se.ALPHANUMERIC=new Se(fn.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),Se.STRUCTURED_APPEND=new Se(fn.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),Se.BYTE=new Se(fn.BYTE,"BYTE",Int32Array.from([8,16,16]),4),Se.ECI=new Se(fn.ECI,"ECI",Int32Array.from([0,0,0]),7),Se.KANJI=new Se(fn.KANJI,"KANJI",Int32Array.from([8,10,12]),8),Se.FNC1_FIRST_POSITION=new Se(fn.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),Se.FNC1_SECOND_POSITION=new Se(fn.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),Se.HANZI=new Se(fn.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class xt{static decode(e,t,n,r){const a=new ko(e);let c=new z;const d=new Array;let g=-1,w=-1;try{let E=null,A=!1,I;do{if(a.available()<4)I=Se.TERMINATOR;else{const R=a.readBits(4);I=Se.forBits(R)}switch(I){case Se.TERMINATOR:break;case Se.FNC1_FIRST_POSITION:case Se.FNC1_SECOND_POSITION:A=!0;break;case Se.STRUCTURED_APPEND:if(a.available()<16)throw new W;g=a.readBits(8),w=a.readBits(8);break;case Se.ECI:const R=xt.parseECIValue(a);if(E=V.getCharacterSetECIByValue(R),E===null)throw new W;break;case Se.HANZI:const L=a.readBits(4),F=a.readBits(I.getCharacterCountBits(t));L===xt.GB2312_SUBSET&&xt.decodeHanziSegment(a,c,F);break;default:const q=a.readBits(I.getCharacterCountBits(t));switch(I){case Se.NUMERIC:xt.decodeNumericSegment(a,c,q);break;case Se.ALPHANUMERIC:xt.decodeAlphanumericSegment(a,c,q,A);break;case Se.BYTE:xt.decodeByteSegment(a,c,q,E,d,r);break;case Se.KANJI:xt.decodeKanjiSegment(a,c,q);break;default:throw new W}break}}while(I!==Se.TERMINATOR)}catch{throw new W}return new Re(e,c.toString(),d.length===0?null:d,n===null?null:n.toString(),g,w)}static decodeHanziSegment(e,t,n){if(n*13>e.available())throw new W;const r=new Uint8Array(2*n);let a=0;for(;n>0;){const c=e.readBits(13);let d=c/96<<8&4294967295|c%96;d<959?d+=41377:d+=42657,r[a]=d>>8&255,r[a+1]=d&255,a+=2,n--}try{t.append(j.decode(r,G.GB2312))}catch(c){throw new W(c)}}static decodeKanjiSegment(e,t,n){if(n*13>e.available())throw new W;const r=new Uint8Array(2*n);let a=0;for(;n>0;){const c=e.readBits(13);let d=c/192<<8&4294967295|c%192;d<7936?d+=33088:d+=49472,r[a]=d>>8,r[a+1]=d,a+=2,n--}try{t.append(j.decode(r,G.SHIFT_JIS))}catch(c){throw new W(c)}}static decodeByteSegment(e,t,n,r,a,c){if(8*n>e.available())throw new W;const d=new Uint8Array(n);for(let w=0;w<n;w++)d[w]=e.readBits(8);let g;r===null?g=G.guessEncoding(d,c):g=r.getName();try{t.append(j.decode(d,g))}catch(w){throw new W(w)}a.push(d)}static toAlphaNumericChar(e){if(e>=xt.ALPHANUMERIC_CHARS.length)throw new W;return xt.ALPHANUMERIC_CHARS[e]}static decodeAlphanumericSegment(e,t,n,r){const a=t.length();for(;n>1;){if(e.available()<11)throw new W;const c=e.readBits(11);t.append(xt.toAlphaNumericChar(Math.floor(c/45))),t.append(xt.toAlphaNumericChar(c%45)),n-=2}if(n===1){if(e.available()<6)throw new W;t.append(xt.toAlphaNumericChar(e.readBits(6)))}if(r)for(let c=a;c<t.length();c++)t.charAt(c)==="%"&&(c<t.length()-1&&t.charAt(c+1)==="%"?t.deleteCharAt(c+1):t.setCharAt(c,""))}static decodeNumericSegment(e,t,n){for(;n>=3;){if(e.available()<10)throw new W;const r=e.readBits(10);if(r>=1e3)throw new W;t.append(xt.toAlphaNumericChar(Math.floor(r/100))),t.append(xt.toAlphaNumericChar(Math.floor(r/10)%10)),t.append(xt.toAlphaNumericChar(r%10)),n-=3}if(n===2){if(e.available()<7)throw new W;const r=e.readBits(7);if(r>=100)throw new W;t.append(xt.toAlphaNumericChar(Math.floor(r/10))),t.append(xt.toAlphaNumericChar(r%10))}else if(n===1){if(e.available()<4)throw new W;const r=e.readBits(4);if(r>=10)throw new W;t.append(xt.toAlphaNumericChar(r))}}static parseECIValue(e){const t=e.readBits(8);if(!(t&128))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 W}}xt.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",xt.GB2312_SUBSET=1;class Va{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 gg{constructor(){this.rsDecoder=new mt(ue.QR_CODE_FIELD_256)}decodeBooleanArray(e,t){return this.decodeBitMatrix(X.parseFromBooleanArray(e),t)}decodeBitMatrix(e,t){const n=new hg(e);let r=null;try{return this.decodeBitMatrixParser(n,t)}catch(a){r=a}try{n.remask(),n.setMirror(!0),n.readVersion(),n.readFormatInformation(),n.mirror();const a=this.decodeBitMatrixParser(n,t);return a.setOther(new Va(!0)),a}catch(a){throw r!==null?r:a}}decodeBitMatrixParser(e,t){const n=e.readVersion(),r=e.readFormatInformation().getErrorCorrectionLevel(),a=e.readCodewords(),c=Ro.getDataBlocks(a,n,r);let d=0;for(const E of c)d+=E.getNumDataCodewords();const g=new Uint8Array(d);let w=0;for(const E of c){const A=E.getCodewords(),I=E.getNumDataCodewords();this.correctErrors(A,I);for(let R=0;R<I;R++)g[w++]=A[R]}return xt.decode(g,n,r,t)}correctErrors(e,t){const n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new B}for(let r=0;r<t;r++)e[r]=n[r]}}class Oo extends Ee{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,a=(this.getY()+e)/2,c=(this.estimatedModuleSize+n)/2;return new Oo(r,a,c)}}class Ni{constructor(e,t,n,r,a,c,d){this.image=e,this.startX=t,this.startY=n,this.width=r,this.height=a,this.moduleSize=c,this.resultPointCallback=d,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}find(){const e=this.startX,t=this.height,n=this.width,r=e+n,a=this.startY+t/2,c=new Int32Array(3),d=this.image;for(let g=0;g<t;g++){const w=a+(g&1?-Math.floor((g+1)/2):Math.floor((g+1)/2));c[0]=0,c[1]=0,c[2]=0;let E=e;for(;E<r&&!d.get(E,w);)E++;let A=0;for(;E<r;){if(d.get(E,w))if(A===1)c[1]++;else if(A===2){if(this.foundPatternCross(c)){const I=this.handlePossibleCenter(c,w,E);if(I!==null)return I}c[0]=c[2],c[1]=1,c[2]=0,A=1}else c[++A]++;else A===1&&A++,c[A]++;E++}if(this.foundPatternCross(c)){const I=this.handlePossibleCenter(c,w,r);if(I!==null)return I}}if(this.possibleCenters.length!==0)return this.possibleCenters[0];throw new N}static centerFromEnd(e,t){return t-e[2]-e[1]/2}foundPatternCross(e){const t=this.moduleSize,n=t/2;for(let r=0;r<3;r++)if(Math.abs(t-e[r])>=n)return!1;return!0}crossCheckVertical(e,t,n,r){const a=this.image,c=a.getHeight(),d=this.crossCheckStateCount;d[0]=0,d[1]=0,d[2]=0;let g=e;for(;g>=0&&a.get(t,g)&&d[1]<=n;)d[1]++,g--;if(g<0||d[1]>n)return NaN;for(;g>=0&&!a.get(t,g)&&d[0]<=n;)d[0]++,g--;if(d[0]>n)return NaN;for(g=e+1;g<c&&a.get(t,g)&&d[1]<=n;)d[1]++,g++;if(g===c||d[1]>n)return NaN;for(;g<c&&!a.get(t,g)&&d[2]<=n;)d[2]++,g++;if(d[2]>n)return NaN;const w=d[0]+d[1]+d[2];return 5*Math.abs(w-r)>=2*r?NaN:this.foundPatternCross(d)?Ni.centerFromEnd(d,g):NaN}handlePossibleCenter(e,t,n){const r=e[0]+e[1]+e[2],a=Ni.centerFromEnd(e,n),c=this.crossCheckVertical(t,a,2*e[1],r);if(!isNaN(c)){const d=(e[0]+e[1]+e[2])/3;for(const w of this.possibleCenters)if(w.aboutEquals(d,c,a))return w.combineEstimate(c,a,d);const g=new Oo(a,c,d);this.possibleCenters.push(g),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(g)}return null}}class Mo extends Ee{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,a=(this.count*this.getX()+t)/r,c=(this.count*this.getY()+e)/r,d=(this.count*this.estimatedModuleSize+n)/r;return new Mo(a,c,d,r)}}class mg{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 Mt{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(Q.TRY_HARDER)!==void 0,n=e!=null&&e.get(Q.PURE_BARCODE)!==void 0,r=this.image,a=r.getHeight(),c=r.getWidth();let d=Math.floor(3*a/(4*Mt.MAX_MODULES));(d<Mt.MIN_SKIP||t)&&(d=Mt.MIN_SKIP);let g=!1;const w=new Int32Array(5);for(let A=d-1;A<a&&!g;A+=d){w[0]=0,w[1]=0,w[2]=0,w[3]=0,w[4]=0;let I=0;for(let R=0;R<c;R++)if(r.get(R,A))(I&1)===1&&I++,w[I]++;else if(I&1)w[I]++;else if(I===4)if(Mt.foundPatternCross(w)){if(this.handlePossibleCenter(w,A,R,n)===!0)if(d=2,this.hasSkipped===!0)g=this.haveMultiplyConfirmedCenters();else{const F=this.findRowSkip();F>w[2]&&(A+=F-w[2]-d,R=c-1)}else{w[0]=w[2],w[1]=w[3],w[2]=w[4],w[3]=1,w[4]=0,I=3;continue}I=0,w[0]=0,w[1]=0,w[2]=0,w[3]=0,w[4]=0}else w[0]=w[2],w[1]=w[3],w[2]=w[4],w[3]=1,w[4]=0,I=3;else w[++I]++;Mt.foundPatternCross(w)&&this.handlePossibleCenter(w,A,c,n)===!0&&(d=w[0],this.hasSkipped&&(g=this.haveMultiplyConfirmedCenters()))}const E=this.selectBestPatterns();return Ee.orderBestPatterns(E),new mg(E)}static centerFromEnd(e,t){return t-e[4]-e[3]-e[2]/2}static foundPatternCross(e){let t=0;for(let a=0;a<5;a++){const c=e[a];if(c===0)return!1;t+=c}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 a=this.getCrossCheckStateCount();let c=0;const d=this.image;for(;e>=c&&t>=c&&d.get(t-c,e-c);)a[2]++,c++;if(e<c||t<c)return!1;for(;e>=c&&t>=c&&!d.get(t-c,e-c)&&a[1]<=n;)a[1]++,c++;if(e<c||t<c||a[1]>n)return!1;for(;e>=c&&t>=c&&d.get(t-c,e-c)&&a[0]<=n;)a[0]++,c++;if(a[0]>n)return!1;const g=d.getHeight(),w=d.getWidth();for(c=1;e+c<g&&t+c<w&&d.get(t+c,e+c);)a[2]++,c++;if(e+c>=g||t+c>=w)return!1;for(;e+c<g&&t+c<w&&!d.get(t+c,e+c)&&a[3]<n;)a[3]++,c++;if(e+c>=g||t+c>=w||a[3]>=n)return!1;for(;e+c<g&&t+c<w&&d.get(t+c,e+c)&&a[4]<n;)a[4]++,c++;if(a[4]>=n)return!1;const E=a[0]+a[1]+a[2]+a[3]+a[4];return Math.abs(E-r)<2*r&&Mt.foundPatternCross(a)}crossCheckVertical(e,t,n,r){const a=this.image,c=a.getHeight(),d=this.getCrossCheckStateCount();let g=e;for(;g>=0&&a.get(t,g);)d[2]++,g--;if(g<0)return NaN;for(;g>=0&&!a.get(t,g)&&d[1]<=n;)d[1]++,g--;if(g<0||d[1]>n)return NaN;for(;g>=0&&a.get(t,g)&&d[0]<=n;)d[0]++,g--;if(d[0]>n)return NaN;for(g=e+1;g<c&&a.get(t,g);)d[2]++,g++;if(g===c)return NaN;for(;g<c&&!a.get(t,g)&&d[3]<n;)d[3]++,g++;if(g===c||d[3]>=n)return NaN;for(;g<c&&a.get(t,g)&&d[4]<n;)d[4]++,g++;if(d[4]>=n)return NaN;const w=d[0]+d[1]+d[2]+d[3]+d[4];return 5*Math.abs(w-r)>=2*r?NaN:Mt.foundPatternCross(d)?Mt.centerFromEnd(d,g):NaN}crossCheckHorizontal(e,t,n,r){const a=this.image,c=a.getWidth(),d=this.getCrossCheckStateCount();let g=e;for(;g>=0&&a.get(g,t);)d[2]++,g--;if(g<0)return NaN;for(;g>=0&&!a.get(g,t)&&d[1]<=n;)d[1]++,g--;if(g<0||d[1]>n)return NaN;for(;g>=0&&a.get(g,t)&&d[0]<=n;)d[0]++,g--;if(d[0]>n)return NaN;for(g=e+1;g<c&&a.get(g,t);)d[2]++,g++;if(g===c)return NaN;for(;g<c&&!a.get(g,t)&&d[3]<n;)d[3]++,g++;if(g===c||d[3]>=n)return NaN;for(;g<c&&a.get(g,t)&&d[4]<n;)d[4]++,g++;if(d[4]>=n)return NaN;const w=d[0]+d[1]+d[2]+d[3]+d[4];return 5*Math.abs(w-r)>=r?NaN:Mt.foundPatternCross(d)?Mt.centerFromEnd(d,g):NaN}handlePossibleCenter(e,t,n,r){const a=e[0]+e[1]+e[2]+e[3]+e[4];let c=Mt.centerFromEnd(e,n),d=this.crossCheckVertical(t,Math.floor(c),e[2],a);if(!isNaN(d)&&(c=this.crossCheckHorizontal(Math.floor(c),Math.floor(d),e[2],a),!isNaN(c)&&(!r||this.crossCheckDiagonal(Math.floor(d),Math.floor(c),e[2],a)))){const g=a/7;let w=!1;const E=this.possibleCenters;for(let A=0,I=E.length;A<I;A++){const R=E[A];if(R.aboutEquals(g,d,c)){E[A]=R.combineEstimate(d,c,g),w=!0;break}}if(!w){const A=new Mo(c,d,g);E.push(A),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(A)}return!0}return!1}findRowSkip(){if(this.possibleCenters.length<=1)return 0;let t=null;for(const n of this.possibleCenters)if(n.getCount()>=Mt.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 c of this.possibleCenters)c.getCount()>=Mt.CENTER_QUORUM&&(e++,t+=c.getEstimatedModuleSize());if(e<3)return!1;const r=t/n;let a=0;for(const c of this.possibleCenters)a+=Math.abs(c.getEstimatedModuleSize()-r);return a<=.05*t}selectBestPatterns(){const e=this.possibleCenters.length;if(e<3)throw new N;const t=this.possibleCenters;let n;if(e>3){let r=0,a=0;for(const g of this.possibleCenters){const w=g.getEstimatedModuleSize();r+=w,a+=w*w}n=r/e;let c=Math.sqrt(a/e-n*n);t.sort((g,w)=>{const E=Math.abs(w.getEstimatedModuleSize()-n),A=Math.abs(g.getEstimatedModuleSize()-n);return E<A?-1:E>A?1:0});const d=Math.max(.2*n,c);for(let g=0;g<t.length&&t.length>3;g++){const w=t[g];Math.abs(w.getEstimatedModuleSize()-n)>d&&(t.splice(g,1),g--)}}if(t.length>3){let r=0;for(const a of t)r+=a.getEstimatedModuleSize();n=r/t.length,t.sort((a,c)=>{if(c.getCount()===a.getCount()){const d=Math.abs(c.getEstimatedModuleSize()-n),g=Math.abs(a.getEstimatedModuleSize()-n);return d<g?1:d>g?-1:0}else return c.getCount()-a.getCount()}),t.splice(3)}return[t[0],t[1],t[2]]}}Mt.CENTER_QUORUM=2,Mt.MIN_SKIP=3,Mt.MAX_MODULES=57;class Wr{constructor(e){this.image=e}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(e){this.resultPointCallback=e==null?null:e.get(Q.NEED_RESULT_POINT_CALLBACK);const n=new Mt(this.image,this.resultPointCallback).find(e);return this.processFinderPatternInfo(n)}processFinderPatternInfo(e){const t=e.getTopLeft(),n=e.getTopRight(),r=e.getBottomLeft(),a=this.calculateModuleSize(t,n,r);if(a<1)throw new N("No pattern found in proccess finder.");const c=Wr.computeDimension(t,n,r,a),d=Ae.getProvisionalVersionForDimension(c),g=d.getDimensionForVersion()-7;let w=null;if(d.getAlignmentPatternCenters().length>0){const R=n.getX()-t.getX()+r.getX(),L=n.getY()-t.getY()+r.getY(),F=1-3/g,q=Math.floor(t.getX()+F*(R-t.getX())),ne=Math.floor(t.getY()+F*(L-t.getY()));for(let de=4;de<=16;de<<=1)try{w=this.findAlignmentInRegion(a,q,ne,de);break}catch(fe){if(!(fe instanceof N))throw fe}}const E=Wr.createTransform(t,n,r,w,c),A=Wr.sampleGrid(this.image,E,c);let I;return w===null?I=[r,t,n]:I=[r,t,n,w],new _r(A,I)}static createTransform(e,t,n,r,a){const c=a-3.5;let d,g,w,E;return r!==null?(d=r.getX(),g=r.getY(),w=c-3,E=w):(d=t.getX()-e.getX()+n.getX(),g=t.getY()-e.getY()+n.getY(),w=c,E=c),sn.quadrilateralToQuadrilateral(3.5,3.5,c,3.5,w,E,3.5,c,e.getX(),e.getY(),t.getX(),t.getY(),d,g,n.getX(),n.getY())}static sampleGrid(e,t,n){return $t.getInstance().sampleGridWithTransform(e,n,n,t)}static computeDimension(e,t,n,r){const a=He.round(Ee.distance(e,t)/r),c=He.round(Ee.distance(e,n)/r);let d=Math.floor((a+c)/2)+7;switch(d&3){case 0:d++;break;case 2:d--;break;case 3:throw new N("Dimensions could be not found.")}return d}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 a=this.sizeOfBlackWhiteBlackRun(e,t,n,r),c=1,d=e-(n-e);d<0?(c=e/(e-d),d=0):d>=this.image.getWidth()&&(c=(this.image.getWidth()-1-e)/(d-e),d=this.image.getWidth()-1);let g=Math.floor(t-(r-t)*c);return c=1,g<0?(c=t/(t-g),g=0):g>=this.image.getHeight()&&(c=(this.image.getHeight()-1-t)/(g-t),g=this.image.getHeight()-1),d=Math.floor(e+(d-e)*c),a+=this.sizeOfBlackWhiteBlackRun(e,t,d,g),a-1}sizeOfBlackWhiteBlackRun(e,t,n,r){const a=Math.abs(r-t)>Math.abs(n-e);if(a){let R=e;e=t,t=R,R=n,n=r,r=R}const c=Math.abs(n-e),d=Math.abs(r-t);let g=-c/2;const w=e<n?1:-1,E=t<r?1:-1;let A=0;const I=n+w;for(let R=e,L=t;R!==I;R+=w){const F=a?L:R,q=a?R:L;if(A===1===this.image.get(F,q)){if(A===2)return He.distance(R,L,e,t);A++}if(g+=d,g>0){if(L===r)break;L+=E,g-=c}}return A===2?He.distance(n+w,r,e,t):NaN}findAlignmentInRegion(e,t,n,r){const a=Math.floor(r*e),c=Math.max(0,t-a),d=Math.min(this.image.getWidth()-1,t+a);if(d-c<e*3)throw new N("Alignment top exceeds estimated module size.");const g=Math.max(0,n-a),w=Math.min(this.image.getHeight()-1,n+a);if(w-g<e*3)throw new N("Alignment bottom exceeds estimated module size.");return new Ni(this.image,c,g,d-c,w-g,e,this.resultPointCallback).find()}}class jn{constructor(){this.decoder=new gg}getDecoder(){return this.decoder}decode(e,t){let n,r;if(t!=null&&t.get(Q.PURE_BARCODE)!==void 0){const g=jn.extractPureBits(e.getBlackMatrix());n=this.decoder.decodeBitMatrix(g,t),r=jn.NO_POINTS}else{const g=new Wr(e.getBlackMatrix()).detect(t);n=this.decoder.decodeBitMatrix(g.getBits(),t),r=g.getPoints()}n.getOther()instanceof Va&&n.getOther().applyMirroredCorrection(r);const a=new _e(n.getText(),n.getRawBytes(),void 0,r,xe.QR_CODE,void 0),c=n.getByteSegments();c!==null&&a.putMetadata(Oe.BYTE_SEGMENTS,c);const d=n.getECLevel();return d!==null&&a.putMetadata(Oe.ERROR_CORRECTION_LEVEL,d),n.hasStructuredAppend()&&(a.putMetadata(Oe.STRUCTURED_APPEND_SEQUENCE,n.getStructuredAppendSequenceNumber()),a.putMetadata(Oe.STRUCTURED_APPEND_PARITY,n.getStructuredAppendParity())),a}reset(){}static extractPureBits(e){const t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t===null||n===null)throw new N;const r=this.moduleSize(t,e);let a=t[1],c=n[1],d=t[0],g=n[0];if(d>=g||a>=c)throw new N;if(c-a!==g-d&&(g=d+(c-a),g>=e.getWidth()))throw new N;const w=Math.round((g-d+1)/r),E=Math.round((c-a+1)/r);if(w<=0||E<=0)throw new N;if(E!==w)throw new N;const A=Math.floor(r/2);a+=A,d+=A;const I=d+Math.floor((w-1)*r)-g;if(I>0){if(I>A)throw new N;d-=I}const R=a+Math.floor((E-1)*r)-c;if(R>0){if(R>A)throw new N;a-=R}const L=new X(w,E);for(let F=0;F<E;F++){const q=a+Math.floor(F*r);for(let ne=0;ne<w;ne++)e.get(d+Math.floor(ne*r),q)&&L.set(ne,F)}return L}static moduleSize(e,t){const n=t.getHeight(),r=t.getWidth();let a=e[0],c=e[1],d=!0,g=0;for(;a<r&&c<n;){if(d!==t.get(a,c)){if(++g===5)break;d=!d}a++,c++}if(a===r||c===n)throw new N;return(a-e[0])/7}}jn.NO_POINTS=new Array;class Te{PDF417Common(){}static getBitCountSum(e){return He.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=P.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([]),Te.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]),Te.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 pg{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class Pe{static detectMultiple(e,t,n){let r=e.getBlackMatrix(),a=Pe.detect(n,r);return a.length||(r=r.clone(),r.rotate180(),a=Pe.detect(n,r)),new pg(r,a)}static detect(e,t){const n=new Array;let r=0,a=0,c=!1;for(;r<t.getHeight();){const d=Pe.findVertices(t,r,a);if(d[0]==null&&d[3]==null){if(!c)break;c=!1,a=0;for(const g of n)g[1]!=null&&(r=Math.trunc(Math.max(r,g[1].getY()))),g[3]!=null&&(r=Math.max(r,Math.trunc(g[3].getY())));r+=Pe.ROW_STEP;continue}if(c=!0,n.push(d),!e)break;d[2]!=null?(a=Math.trunc(d[2].getX()),r=Math.trunc(d[2].getY())):(a=Math.trunc(d[4].getX()),r=Math.trunc(d[4].getY()))}return n}static findVertices(e,t,n){const r=e.getHeight(),a=e.getWidth(),c=new Array(8);return Pe.copyToResult(c,Pe.findRowsWithPattern(e,r,a,t,n,Pe.START_PATTERN),Pe.INDEXES_START_PATTERN),c[4]!=null&&(n=Math.trunc(c[4].getX()),t=Math.trunc(c[4].getY())),Pe.copyToResult(c,Pe.findRowsWithPattern(e,r,a,t,n,Pe.STOP_PATTERN),Pe.INDEXES_STOP_PATTERN),c}static copyToResult(e,t,n){for(let r=0;r<n.length;r++)e[n[r]]=t[r]}static findRowsWithPattern(e,t,n,r,a,c){const d=new Array(4);let g=!1;const w=new Int32Array(c.length);for(;r<t;r+=Pe.ROW_STEP){let A=Pe.findGuardPattern(e,a,r,n,!1,c,w);if(A!=null){for(;r>0;){const I=Pe.findGuardPattern(e,a,--r,n,!1,c,w);if(I!=null)A=I;else{r++;break}}d[0]=new Ee(A[0],r),d[1]=new Ee(A[1],r),g=!0;break}}let E=r+1;if(g){let A=0,I=Int32Array.from([Math.trunc(d[0].getX()),Math.trunc(d[1].getX())]);for(;E<t;E++){const R=Pe.findGuardPattern(e,I[0],E,n,!1,c,w);if(R!=null&&Math.abs(I[0]-R[0])<Pe.MAX_PATTERN_DRIFT&&Math.abs(I[1]-R[1])<Pe.MAX_PATTERN_DRIFT)I=R,A=0;else{if(A>Pe.SKIPPED_ROW_COUNT_MAX)break;A++}}E-=A+1,d[2]=new Ee(I[0],E),d[3]=new Ee(I[1],E)}return E-r<Pe.BARCODE_MIN_HEIGHT&&P.fill(d,null),d}static findGuardPattern(e,t,n,r,a,c,d){P.fillWithin(d,0,d.length,0);let g=t,w=0;for(;e.get(g,n)&&g>0&&w++<Pe.MAX_PIXEL_DRIFT;)g--;let E=g,A=0,I=c.length;for(let R=a;E<r;E++)if(e.get(E,n)!==R)d[A]++;else{if(A===I-1){if(Pe.patternMatchVariance(d,c,Pe.MAX_INDIVIDUAL_VARIANCE)<Pe.MAX_AVG_VARIANCE)return new Int32Array([g,E]);g+=d[0]+d[1],D.arraycopy(d,2,d,0,A-1),d[A-1]=0,d[A]=0,A--}else A++;d[A]=1,R=!R}return A===I-1&&Pe.patternMatchVariance(d,c,Pe.MAX_INDIVIDUAL_VARIANCE)<Pe.MAX_AVG_VARIANCE?new Int32Array([g,E-1]):null}static patternMatchVariance(e,t,n){let r=e.length,a=0,c=0;for(let w=0;w<r;w++)a+=e[w],c+=t[w];if(a<c)return 1/0;let d=a/c;n*=d;let g=0;for(let w=0;w<r;w++){let E=e[w],A=t[w]*d,I=E>A?E-A:A-E;if(I>n)return 1/0;g+=I}return g/a}}Pe.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),Pe.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),Pe.MAX_AVG_VARIANCE=.42,Pe.MAX_INDIVIDUAL_VARIANCE=.8,Pe.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),Pe.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),Pe.MAX_PIXEL_DRIFT=3,Pe.MAX_PATTERN_DRIFT=5,Pe.SKIPPED_ROW_COUNT_MAX=25,Pe.ROW_STEP=5,Pe.BARCODE_MIN_HEIGHT=10;class Dt{constructor(e,t){if(t.length===0)throw new y;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),D.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 a of this.coefficients)r=this.field.add(r,a);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 y("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 c=t;t=n,n=c}let r=new Int32Array(n.length),a=n.length-t.length;D.arraycopy(n,0,r,0,a);for(let c=a;c<n.length;c++)r[c]=this.field.add(t[c-a],n[c]);return new Dt(this.field,r)}subtract(e){if(!this.field.equals(e.field))throw new y("ModulusPolys do not have same ModulusGF field");return e.isZero()?this:this.add(e.negative())}multiply(e){return e instanceof Dt?this.multiplyOther(e):this.multiplyScalar(e)}multiplyOther(e){if(!this.field.equals(e.field))throw new y("ModulusPolys do not have same ModulusGF field");if(this.isZero()||e.isZero())return new Dt(this.field,new Int32Array([0]));let t=this.coefficients,n=t.length,r=e.coefficients,a=r.length,c=new Int32Array(n+a-1);for(let d=0;d<n;d++){let g=t[d];for(let w=0;w<a;w++)c[d+w]=this.field.add(c[d+w],this.field.multiply(g,r[w]))}return new Dt(this.field,c)}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 Dt(this.field,t)}multiplyScalar(e){if(e===0)return new Dt(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 Dt(this.field,n)}multiplyByMonomial(e,t){if(e<0)throw new y;if(t===0)return new Dt(this.field,new Int32Array([0]));let n=this.coefficients.length,r=new Int32Array(n+e);for(let a=0;a<n;a++)r[a]=this.field.multiply(this.coefficients[a],t);return new Dt(this.field,r)}toString(){let e=new z;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 xg{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 y;return this.logTable[e]}inverse(e){if(e===0)throw new It;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 Bo extends xg{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 Dt(this,new Int32Array([0])),this.one=new Dt(this,new Int32Array([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new y;if(t===0)return this.zero;let n=new Int32Array(e+1);return n[0]=t,new Dt(this,n)}}Bo.PDF417_GF=new Bo(Te.NUMBER_OF_CODEWORDS,3);class Ua{constructor(){this.field=Bo.PDF417_GF}decode(e,t,n){let r=new Dt(this.field,e),a=new Int32Array(t),c=!1;for(let L=t;L>0;L--){let F=r.evaluateAt(this.field.exp(L));a[t-L]=F,F!==0&&(c=!0)}if(!c)return 0;let d=this.field.getOne();if(n!=null)for(const L of n){let F=this.field.exp(e.length-1-L),q=new Dt(this.field,new Int32Array([this.field.subtract(0,F),1]));d=d.multiply(q)}let g=new Dt(this.field,a),w=this.runEuclideanAlgorithm(this.field.buildMonomial(t,1),g,t),E=w[0],A=w[1],I=this.findErrorLocations(E),R=this.findErrorMagnitudes(A,E,I);for(let L=0;L<I.length;L++){let F=e.length-1-this.field.log(I[L]);if(F<0)throw B.getChecksumInstance();e[F]=this.field.subtract(e[F],R[L])}return I.length}runEuclideanAlgorithm(e,t,n){if(e.getDegree()<t.getDegree()){let I=e;e=t,t=I}let r=e,a=t,c=this.field.getZero(),d=this.field.getOne();for(;a.getDegree()>=Math.round(n/2);){let I=r,R=c;if(r=a,c=d,r.isZero())throw B.getChecksumInstance();a=I;let L=this.field.getZero(),F=r.getCoefficient(r.getDegree()),q=this.field.inverse(F);for(;a.getDegree()>=r.getDegree()&&!a.isZero();){let ne=a.getDegree()-r.getDegree(),de=this.field.multiply(a.getCoefficient(a.getDegree()),q);L=L.add(this.field.buildMonomial(ne,de)),a=a.subtract(r.multiplyByMonomial(ne,de))}d=L.multiply(c).subtract(R).negative()}let g=d.getCoefficient(0);if(g===0)throw B.getChecksumInstance();let w=this.field.inverse(g),E=d.multiply(w),A=a.multiply(w);return[E,A]}findErrorLocations(e){let t=e.getDegree(),n=new Int32Array(t),r=0;for(let a=1;a<this.field.getSize()&&r<t;a++)e.evaluateAt(a)===0&&(n[r]=this.field.inverse(a),r++);if(r!==t)throw B.getChecksumInstance();return n}findErrorMagnitudes(e,t,n){let r=t.getDegree(),a=new Int32Array(r);for(let w=1;w<=r;w++)a[r-w]=this.field.multiply(w,t.getCoefficient(w));let c=new Dt(this.field,a),d=n.length,g=new Int32Array(d);for(let w=0;w<d;w++){let E=this.field.inverse(n[w]),A=this.field.subtract(0,e.evaluateAt(E)),I=this.field.inverse(c.evaluateAt(E));g[w]=this.field.multiply(A,I)}return g}}class or{constructor(e,t,n,r,a){e instanceof or?this.constructor_2(e):this.constructor_1(e,t,n,r,a)}constructor_1(e,t,n,r,a){const c=t==null||n==null,d=r==null||a==null;if(c&&d)throw new N;c?(t=new Ee(0,r.getY()),n=new Ee(0,a.getY())):d&&(r=new Ee(e.getWidth()-1,t.getY()),a=new Ee(e.getWidth()-1,n.getY())),this.image=e,this.topLeft=t,this.bottomLeft=n,this.topRight=r,this.bottomRight=a,this.minX=Math.trunc(Math.min(t.getX(),n.getX())),this.maxX=Math.trunc(Math.max(r.getX(),a.getX())),this.minY=Math.trunc(Math.min(t.getY(),r.getY())),this.maxY=Math.trunc(Math.max(n.getY(),a.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 or(e.image,e.topLeft,e.bottomLeft,t.topRight,t.bottomRight)}addMissingRows(e,t,n){let r=this.topLeft,a=this.bottomLeft,c=this.topRight,d=this.bottomRight;if(e>0){let g=n?this.topLeft:this.topRight,w=Math.trunc(g.getY()-e);w<0&&(w=0);let E=new Ee(g.getX(),w);n?r=E:c=E}if(t>0){let g=n?this.bottomLeft:this.bottomRight,w=Math.trunc(g.getY()+t);w>=this.image.getHeight()&&(w=this.image.getHeight()-1);let E=new Ee(g.getX(),w);n?a=E:d=E}return new or(this.image,r,a,c,d)}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 wg{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 Xr{constructor(){this.buffer=""}static form(e,t){let n=-1;function r(c,d,g,w,E,A){if(c==="%%")return"%";if(t[++n]===void 0)return;c=w?parseInt(w.substr(1)):void 0;let I=E?parseInt(E.substr(1)):void 0,R;switch(A){case"s":R=t[n];break;case"c":R=t[n][0];break;case"f":R=parseFloat(t[n]).toFixed(c);break;case"p":R=parseFloat(t[n]).toPrecision(c);break;case"e":R=parseFloat(t[n]).toExponential(c);break;case"x":R=parseInt(t[n]).toString(I||16);break;case"d":R=parseFloat(parseInt(t[n],I||10).toPrecision(c)).toFixed(0);break}R=typeof R=="object"?JSON.stringify(R):(+R).toString(I);let L=parseInt(g),F=g&&g[0]+""=="0"?"0":" ";for(;R.length<L;)R=d!==void 0?R+F:F+R;return R}let a=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(a,r)}format(e,...t){this.buffer+=Xr.form(e,t)}toString(){return this.buffer}}class jr{constructor(e){this.boundingBox=new or(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<jr.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()}setCodeword(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 Xr;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()}}jr.MAX_NEARBY_DISTANCE=5;class qr{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 a={getKey:()=>n,getValue:()=>r};a.getValue()>e?(e=a.getValue(),t=[],t.push(a.getKey())):a.getValue()===e&&t.push(a.getKey())}return Te.toIntArray(t)}getConfidence(e){return this.values.get(e)}}class za extends jr{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(),a=this._isLeft?n.getBottomLeft():n.getBottomRight(),c=this.imageRowToCodewordIndex(Math.trunc(r.getY())),d=this.imageRowToCodewordIndex(Math.trunc(a.getY())),g=-1,w=1,E=0;for(let A=c;A<d;A++){if(t[A]==null)continue;let I=t[A],R=I.getRowNumber()-g;if(R===0)E++;else if(R===1)w=Math.max(w,E),E=1,g=I.getRowNumber();else if(R<0||I.getRowNumber()>=e.getRowCount()||R>A)t[A]=null;else{let L;w>2?L=(w-2)*R:L=R;let F=L>=A;for(let q=1;q<=L&&!F;q++)F=t[A-q]!=null;F?t[A]=null:(g=I.getRowNumber(),E=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(),a=this.imageRowToCodewordIndex(Math.trunc(n.getY())),c=this.imageRowToCodewordIndex(Math.trunc(r.getY())),d=this.getCodewords(),g=-1;for(let w=a;w<c;w++){if(d[w]==null)continue;let E=d[w];E.setRowNumberAsRowIndicatorColumn();let A=E.getRowNumber()-g;A===0||(A===1?g=E.getRowNumber():E.getRowNumber()>=e.getRowCount()?d[w]=null:g=E.getRowNumber())}}getBarcodeMetadata(){let e=this.getCodewords(),t=new qr,n=new qr,r=new qr,a=new qr;for(let d of e){if(d==null)continue;d.setRowNumberAsRowIndicatorColumn();let g=d.getValue()%30,w=d.getRowNumber();switch(this._isLeft||(w+=2),w%3){case 0:n.setValue(g*3+1);break;case 1:a.setValue(g/3),r.setValue(g%3);break;case 2:t.setValue(g+1);break}}if(t.getValue().length===0||n.getValue().length===0||r.getValue().length===0||a.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 c=new wg(t.getValue()[0],n.getValue()[0],r.getValue()[0],a.getValue()[0]);return this.removeIncorrectCodewords(e,c),c}removeIncorrectCodewords(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(e[n]==null)continue;let a=r.getValue()%30,c=r.getRowNumber();if(c>t.getRowCount()){e[n]=null;continue}switch(this._isLeft||(c+=2),c%3){case 0:a*3+1!==t.getRowCountUpperPart()&&(e[n]=null);break;case 1:(Math.trunc(a/3)!==t.getErrorCorrectionLevel()||a%3!==t.getRowCountLowerPart())&&(e[n]=null);break;case 2:a+1!==t.getColumnCount()&&(e[n]=null);break}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+`
|
|
17
|
+
`+super.toString()}}class Zr{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()}adjustRowNumbersFromBothRI(){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 a=this.detectionResultColumns[r].getCodewords()[n];a!=null&&(a.setRowNumber(e[n].getRowNumber()),a.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(),a=0;for(let c=this.barcodeColumnCount+1;c>0&&a<this.ADJUST_ROW_NUMBER_SKIP;c--){let d=this.detectionResultColumns[c].getCodewords()[n];d!=null&&(a=Zr.adjustRowNumberIfValid(r,a,d),d.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(),a=0;for(let c=1;c<this.barcodeColumnCount+1&&a<this.ADJUST_ROW_NUMBER_SKIP;c++){let d=this.detectionResultColumns[c].getCodewords()[n];d!=null&&(a=Zr.adjustRowNumberIfValid(r,a,d),d.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],a=this.detectionResultColumns[e-1].getCodewords(),c=a;this.detectionResultColumns[e+1]!=null&&(c=this.detectionResultColumns[e+1].getCodewords());let d=new Array(14);d[2]=a[t],d[3]=c[t],t>0&&(d[0]=n[t-1],d[4]=a[t-1],d[5]=c[t-1]),t>1&&(d[8]=n[t-2],d[10]=a[t-2],d[11]=c[t-2]),t<n.length-1&&(d[1]=n[t+1],d[6]=a[t+1],d[7]=c[t+1]),t<n.length-2&&(d[9]=n[t+2],d[12]=a[t+2],d[13]=c[t+2]);for(let g of d)if(Zr.adjustRowNumber(r,g))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 Xr;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 a=this.detectionResultColumns[r].getCodewords()[n];if(a==null){t.format(" | ");continue}t.format(" %3d|%3d",a.getRowNumber(),a.getValue())}t.format("%n")}return t.toString()}}class Yr{constructor(e,t,n,r){this.rowNumber=Yr.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!==Yr.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}}Yr.BARCODE_ROW_UNKNOWN=-1;class Jt{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 a=0;for(;(t&1)===n;)a+=1,t>>=1;n=t&1,Jt.RATIOS_TABLE[e]||(Jt.RATIOS_TABLE[e]=new Array(Te.BARS_IN_MODULE)),Jt.RATIOS_TABLE[e][Te.BARS_IN_MODULE-r-1]=Math.fround(a/Te.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(e){let t=Jt.getDecodedCodewordValue(Jt.sampleBitCounts(e));return t!==-1?t:Jt.getClosestDecodedValue(e)}static sampleBitCounts(e){let t=He.sum(e),n=new Int32Array(Te.BARS_IN_MODULE),r=0,a=0;for(let c=0;c<Te.MODULES_IN_CODEWORD;c++){let d=t/(2*Te.MODULES_IN_CODEWORD)+c*t/Te.MODULES_IN_CODEWORD;a+e[r]<=d&&(a+=e[r],r++),n[r]++}return n}static getDecodedCodewordValue(e){let t=Jt.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=He.sum(e),n=new Array(Te.BARS_IN_MODULE);if(t>1)for(let c=0;c<n.length;c++)n[c]=Math.fround(e[c]/t);let r=Yt.MAX_VALUE,a=-1;this.bSymbolTableReady||Jt.initialize();for(let c=0;c<Jt.RATIOS_TABLE.length;c++){let d=0,g=Jt.RATIOS_TABLE[c];for(let w=0;w<Te.BARS_IN_MODULE;w++){let E=Math.fround(g[w]-n[w]);if(d+=Math.fround(E*E),d>=r)break}d<r&&(r=d,a=Te.SYMBOL_TABLE[c])}return a}}Jt.bSymbolTableReady=!1,Jt.RATIOS_TABLE=new Array(Te.SYMBOL_TABLE.length).map(b=>new Array(Te.BARS_IN_MODULE));class Ha{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 Ga{static parseLong(e,t=void 0){return parseInt(e,t)}}class Wa extends p{}Wa.kind="NullPointerException";class _g{writeBytes(e){this.writeBytesOffset(e,0,e.length)}writeBytesOffset(e,t,n){if(e==null)throw new Wa;if(t<0||t>e.length||n<0||t+n>e.length||t+n<0)throw new v;if(n===0)return;for(let r=0;r<n;r++)this.write(e[t+r])}flush(){}close(){}}class Cg extends p{}class Eg extends _g{constructor(e=32){if(super(),this.count=0,e<0)throw new y("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 Cg;n=O.MAX_VALUE}this.buf=P.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 v;this.ensureCapacity(this.count+n),D.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 P.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 it;(function(b){b[b.ALPHA=0]="ALPHA",b[b.LOWER=1]="LOWER",b[b.MIXED=2]="MIXED",b[b.PUNCT=3]="PUNCT",b[b.ALPHA_SHIFT=4]="ALPHA_SHIFT",b[b.PUNCT_SHIFT=5]="PUNCT_SHIFT"})(it||(it={}));function Xa(){if(typeof window<"u")return window.BigInt||null;if(typeof mr<"u")return mr.BigInt||null;if(typeof self<"u")return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}let Ti;function qn(b){if(typeof Ti>"u"&&(Ti=Xa()),Ti===null)throw new Error("BigInt is not supported!");return Ti(b)}function yg(){let b=[];b[0]=qn(1);let e=qn(900);b[1]=e;for(let t=2;t<16;t++)b[t]=b[t-1]*e;return b}class ee{static decode(e,t){let n=new z(""),r=V.ISO8859_1;n.enableDecoding(r);let a=1,c=e[a++],d=new Ha;for(;a<e[0];){switch(c){case ee.TEXT_COMPACTION_MODE_LATCH:a=ee.textCompaction(e,a,n);break;case ee.BYTE_COMPACTION_MODE_LATCH:case ee.BYTE_COMPACTION_MODE_LATCH_6:a=ee.byteCompaction(c,e,r,a,n);break;case ee.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(e[a++]);break;case ee.NUMERIC_COMPACTION_MODE_LATCH:a=ee.numericCompaction(e,a,n);break;case ee.ECI_CHARSET:V.getCharacterSetECIByValue(e[a++]);break;case ee.ECI_GENERAL_PURPOSE:a+=2;break;case ee.ECI_USER_DEFINED:a++;break;case ee.BEGIN_MACRO_PDF417_CONTROL_BLOCK:a=ee.decodeMacroBlock(e,a,d);break;case ee.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case ee.MACRO_PDF417_TERMINATOR:throw new W;default:a--,a=ee.textCompaction(e,a,n);break}if(a<e.length)c=e[a++];else throw W.getFormatInstance()}if(n.length()===0)throw W.getFormatInstance();let g=new Re(null,n.toString(),null,t);return g.setOther(d),g}static decodeMacroBlock(e,t,n){if(t+ee.NUMBER_OF_SEQUENCE_CODEWORDS>e[0])throw W.getFormatInstance();let r=new Int32Array(ee.NUMBER_OF_SEQUENCE_CODEWORDS);for(let d=0;d<ee.NUMBER_OF_SEQUENCE_CODEWORDS;d++,t++)r[d]=e[t];n.setSegmentIndex(O.parseInt(ee.decodeBase900toBase10(r,ee.NUMBER_OF_SEQUENCE_CODEWORDS)));let a=new z;t=ee.textCompaction(e,t,a),n.setFileId(a.toString());let c=-1;for(e[t]===ee.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(c=t+1);t<e[0];)switch(e[t]){case ee.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(t++,e[t]){case ee.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let d=new z;t=ee.textCompaction(e,t+1,d),n.setFileName(d.toString());break;case ee.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let g=new z;t=ee.textCompaction(e,t+1,g),n.setSender(g.toString());break;case ee.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let w=new z;t=ee.textCompaction(e,t+1,w),n.setAddressee(w.toString());break;case ee.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let E=new z;t=ee.numericCompaction(e,t+1,E),n.setSegmentCount(O.parseInt(E.toString()));break;case ee.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let A=new z;t=ee.numericCompaction(e,t+1,A),n.setTimestamp(Ga.parseLong(A.toString()));break;case ee.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let I=new z;t=ee.numericCompaction(e,t+1,I),n.setChecksum(O.parseInt(I.toString()));break;case ee.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let R=new z;t=ee.numericCompaction(e,t+1,R),n.setFileSize(Ga.parseLong(R.toString()));break;default:throw W.getFormatInstance()}break;case ee.MACRO_PDF417_TERMINATOR:t++,n.setLastSegment(!0);break;default:throw W.getFormatInstance()}if(c!==-1){let d=t-c;n.isLastSegment()&&d--,n.setOptionalData(P.copyOfRange(e,c,c+d))}return t}static textCompaction(e,t,n){let r=new Int32Array((e[0]-t)*2),a=new Int32Array((e[0]-t)*2),c=0,d=!1;for(;t<e[0]&&!d;){let g=e[t++];if(g<ee.TEXT_COMPACTION_MODE_LATCH)r[c]=g/30,r[c+1]=g%30,c+=2;else switch(g){case ee.TEXT_COMPACTION_MODE_LATCH:r[c++]=ee.TEXT_COMPACTION_MODE_LATCH;break;case ee.BYTE_COMPACTION_MODE_LATCH:case ee.BYTE_COMPACTION_MODE_LATCH_6:case ee.NUMERIC_COMPACTION_MODE_LATCH:case ee.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case ee.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case ee.MACRO_PDF417_TERMINATOR:t--,d=!0;break;case ee.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r[c]=ee.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,g=e[t++],a[c]=g,c++;break}}return ee.decodeTextCompaction(r,a,c,n),t}static decodeTextCompaction(e,t,n,r){let a=it.ALPHA,c=it.ALPHA,d=0;for(;d<n;){let g=e[d],w="";switch(a){case it.ALPHA:if(g<26)w=String.fromCharCode(65+g);else switch(g){case 26:w=" ";break;case ee.LL:a=it.LOWER;break;case ee.ML:a=it.MIXED;break;case ee.PS:c=a,a=it.PUNCT_SHIFT;break;case ee.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[d]);break;case ee.TEXT_COMPACTION_MODE_LATCH:a=it.ALPHA;break}break;case it.LOWER:if(g<26)w=String.fromCharCode(97+g);else switch(g){case 26:w=" ";break;case ee.AS:c=a,a=it.ALPHA_SHIFT;break;case ee.ML:a=it.MIXED;break;case ee.PS:c=a,a=it.PUNCT_SHIFT;break;case ee.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[d]);break;case ee.TEXT_COMPACTION_MODE_LATCH:a=it.ALPHA;break}break;case it.MIXED:if(g<ee.PL)w=ee.MIXED_CHARS[g];else switch(g){case ee.PL:a=it.PUNCT;break;case 26:w=" ";break;case ee.LL:a=it.LOWER;break;case ee.AL:a=it.ALPHA;break;case ee.PS:c=a,a=it.PUNCT_SHIFT;break;case ee.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[d]);break;case ee.TEXT_COMPACTION_MODE_LATCH:a=it.ALPHA;break}break;case it.PUNCT:if(g<ee.PAL)w=ee.PUNCT_CHARS[g];else switch(g){case ee.PAL:a=it.ALPHA;break;case ee.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[d]);break;case ee.TEXT_COMPACTION_MODE_LATCH:a=it.ALPHA;break}break;case it.ALPHA_SHIFT:if(a=c,g<26)w=String.fromCharCode(65+g);else switch(g){case 26:w=" ";break;case ee.TEXT_COMPACTION_MODE_LATCH:a=it.ALPHA;break}break;case it.PUNCT_SHIFT:if(a=c,g<ee.PAL)w=ee.PUNCT_CHARS[g];else switch(g){case ee.PAL:a=it.ALPHA;break;case ee.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[d]);break;case ee.TEXT_COMPACTION_MODE_LATCH:a=it.ALPHA;break}break}w!==""&&r.append(w),d++}}static byteCompaction(e,t,n,r,a){let c=new Eg,d=0,g=0,w=!1;switch(e){case ee.BYTE_COMPACTION_MODE_LATCH:let E=new Int32Array(6),A=t[r++];for(;r<t[0]&&!w;)switch(E[d++]=A,g=900*g+A,A=t[r++],A){case ee.TEXT_COMPACTION_MODE_LATCH:case ee.BYTE_COMPACTION_MODE_LATCH:case ee.NUMERIC_COMPACTION_MODE_LATCH:case ee.BYTE_COMPACTION_MODE_LATCH_6:case ee.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case ee.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case ee.MACRO_PDF417_TERMINATOR:r--,w=!0;break;default:if(d%5===0&&d>0){for(let I=0;I<6;++I)c.write(Number(qn(g)>>qn(8*(5-I))));g=0,d=0}break}r===t[0]&&A<ee.TEXT_COMPACTION_MODE_LATCH&&(E[d++]=A);for(let I=0;I<d;I++)c.write(E[I]);break;case ee.BYTE_COMPACTION_MODE_LATCH_6:for(;r<t[0]&&!w;){let I=t[r++];if(I<ee.TEXT_COMPACTION_MODE_LATCH)d++,g=900*g+I;else switch(I){case ee.TEXT_COMPACTION_MODE_LATCH:case ee.BYTE_COMPACTION_MODE_LATCH:case ee.NUMERIC_COMPACTION_MODE_LATCH:case ee.BYTE_COMPACTION_MODE_LATCH_6:case ee.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case ee.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case ee.MACRO_PDF417_TERMINATOR:r--,w=!0;break}if(d%5===0&&d>0){for(let R=0;R<6;++R)c.write(Number(qn(g)>>qn(8*(5-R))));g=0,d=0}}break}return a.append(j.decode(c.toByteArray(),n)),r}static numericCompaction(e,t,n){let r=0,a=!1,c=new Int32Array(ee.MAX_NUMERIC_CODEWORDS);for(;t<e[0]&&!a;){let d=e[t++];if(t===e[0]&&(a=!0),d<ee.TEXT_COMPACTION_MODE_LATCH)c[r]=d,r++;else switch(d){case ee.TEXT_COMPACTION_MODE_LATCH:case ee.BYTE_COMPACTION_MODE_LATCH:case ee.BYTE_COMPACTION_MODE_LATCH_6:case ee.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case ee.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case ee.MACRO_PDF417_TERMINATOR:t--,a=!0;break}(r%ee.MAX_NUMERIC_CODEWORDS===0||d===ee.NUMERIC_COMPACTION_MODE_LATCH||a)&&r>0&&(n.append(ee.decodeBase900toBase10(c,r)),r=0)}return t}static decodeBase900toBase10(e,t){let n=qn(0);for(let a=0;a<t;a++)n+=ee.EXP900[t-a-1]*qn(e[a]);let r=n.toString();if(r.charAt(0)!=="1")throw new W;return r.substring(1)}}ee.TEXT_COMPACTION_MODE_LATCH=900,ee.BYTE_COMPACTION_MODE_LATCH=901,ee.NUMERIC_COMPACTION_MODE_LATCH=902,ee.BYTE_COMPACTION_MODE_LATCH_6=924,ee.ECI_USER_DEFINED=925,ee.ECI_GENERAL_PURPOSE=926,ee.ECI_CHARSET=927,ee.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,ee.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,ee.MACRO_PDF417_TERMINATOR=922,ee.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,ee.MAX_NUMERIC_CODEWORDS=15,ee.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,ee.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,ee.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,ee.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,ee.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,ee.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,ee.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,ee.PL=25,ee.LL=27,ee.AS=27,ee.ML=28,ee.AL=28,ee.PS=29,ee.PAL=29,ee.PUNCT_CHARS=`;<>@[\\]_\`~!\r ,:
|
|
18
|
+
-.$/"|*()?{}'`,ee.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",ee.EXP900=Xa()?yg():[],ee.NUMBER_OF_SEQUENCE_CODEWORDS=2;class Ve{constructor(){}static decode(e,t,n,r,a,c,d){let g=new or(e,t,n,r,a),w=null,E=null,A;for(let L=!0;;L=!1){if(t!=null&&(w=Ve.getRowIndicatorColumn(e,g,t,!0,c,d)),r!=null&&(E=Ve.getRowIndicatorColumn(e,g,r,!1,c,d)),A=Ve.merge(w,E),A==null)throw N.getNotFoundInstance();let F=A.getBoundingBox();if(L&&F!=null&&(F.getMinY()<g.getMinY()||F.getMaxY()>g.getMaxY()))g=F;else break}A.setBoundingBox(g);let I=A.getBarcodeColumnCount()+1;A.setDetectionResultColumn(0,w),A.setDetectionResultColumn(I,E);let R=w!=null;for(let L=1;L<=I;L++){let F=R?L:I-L;if(A.getDetectionResultColumn(F)!==void 0)continue;let q;F===0||F===I?q=new za(g,F===0):q=new jr(g),A.setDetectionResultColumn(F,q);let ne=-1,de=ne;for(let fe=g.getMinY();fe<=g.getMaxY();fe++){if(ne=Ve.getStartColumn(A,F,fe,R),ne<0||ne>g.getMaxX()){if(de===-1)continue;ne=de}let le=Ve.detectCodeword(e,g.getMinX(),g.getMaxX(),R,ne,fe,c,d);le!=null&&(q.setCodeword(fe,le),de=ne,c=Math.min(c,le.getWidth()),d=Math.max(d,le.getWidth()))}}return Ve.createDecoderResult(A)}static merge(e,t){if(e==null&&t==null)return null;let n=Ve.getBarcodeMetadata(e,t);if(n==null)return null;let r=or.merge(Ve.adjustBoundingBox(e),Ve.adjustBoundingBox(t));return new Zr(n,r)}static adjustBoundingBox(e){if(e==null)return null;let t=e.getRowHeights();if(t==null)return null;let n=Ve.getMax(t),r=0;for(let d of t)if(r+=n-d,d>0)break;let a=e.getCodewords();for(let d=0;r>0&&a[d]==null;d++)r--;let c=0;for(let d=t.length-1;d>=0&&(c+=n-t[d],!(t[d]>0));d--);for(let d=a.length-1;c>0&&a[d]==null;d--)c--;return e.getBoundingBox().addMissingRows(r,c,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,a,c){let d=new za(t,r);for(let g=0;g<2;g++){let w=g===0?1:-1,E=Math.trunc(Math.trunc(n.getX()));for(let A=Math.trunc(Math.trunc(n.getY()));A<=t.getMaxY()&&A>=t.getMinY();A+=w){let I=Ve.detectCodeword(e,0,e.getWidth(),r,E,A,a,c);I!=null&&(d.setCodeword(A,I),r?E=I.getStartX():E=I.getEndX())}}return d}static adjustCodewordCount(e,t){let n=t[0][1],r=n.getValue(),a=e.getBarcodeColumnCount()*e.getBarcodeRowCount()-Ve.getNumberOfECCodeWords(e.getBarcodeECLevel());if(r.length===0){if(a<1||a>Te.MAX_CODEWORDS_IN_BARCODE)throw N.getNotFoundInstance();n.setValue(a)}else r[0]!==a&&n.setValue(a)}static createDecoderResult(e){let t=Ve.createBarcodeMatrix(e);Ve.adjustCodewordCount(e,t);let n=new Array,r=new Int32Array(e.getBarcodeRowCount()*e.getBarcodeColumnCount()),a=[],c=new Array;for(let g=0;g<e.getBarcodeRowCount();g++)for(let w=0;w<e.getBarcodeColumnCount();w++){let E=t[g][w+1].getValue(),A=g*e.getBarcodeColumnCount()+w;E.length===0?n.push(A):E.length===1?r[A]=E[0]:(c.push(A),a.push(E))}let d=new Array(a.length);for(let g=0;g<d.length;g++)d[g]=a[g];return Ve.createDecoderResultFromAmbiguousValues(e.getBarcodeECLevel(),r,Te.toIntArray(n),Te.toIntArray(c),d)}static createDecoderResultFromAmbiguousValues(e,t,n,r,a){let c=new Int32Array(r.length),d=100;for(;d-- >0;){for(let g=0;g<c.length;g++)t[r[g]]=a[g][c[g]];try{return Ve.decodeCodewords(t,e,n)}catch(g){if(!(g instanceof B))throw g}if(c.length===0)throw B.getChecksumInstance();for(let g=0;g<c.length;g++)if(c[g]<a[g].length-1){c[g]++;break}else if(c[g]=0,g===c.length-1)throw B.getChecksumInstance()}throw B.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 a=0;a<t[r].length;a++)t[r][a]=new qr;let n=0;for(let r of e.getDetectionResultColumns()){if(r!=null){for(let a of r.getCodewords())if(a!=null){let c=a.getRowNumber();if(c>=0){if(c>=t.length)continue;t[c][n].setValue(a.getValue())}}}n++}return t}static isValidBarcodeColumn(e,t){return t>=0&&t<=e.getBarcodeColumnCount()+1}static getStartColumn(e,t,n,r){let a=r?1:-1,c=null;if(Ve.isValidBarcodeColumn(e,t-a)&&(c=e.getDetectionResultColumn(t-a).getCodeword(n)),c!=null)return r?c.getEndX():c.getStartX();if(c=e.getDetectionResultColumn(t).getCodewordNearby(n),c!=null)return r?c.getStartX():c.getEndX();if(Ve.isValidBarcodeColumn(e,t-a)&&(c=e.getDetectionResultColumn(t-a).getCodewordNearby(n)),c!=null)return r?c.getEndX():c.getStartX();let d=0;for(;Ve.isValidBarcodeColumn(e,t-a);){t-=a;for(let g of e.getDetectionResultColumn(t).getCodewords())if(g!=null)return(r?g.getEndX():g.getStartX())+a*d*(g.getEndX()-g.getStartX());d++}return r?e.getBoundingBox().getMinX():e.getBoundingBox().getMaxX()}static detectCodeword(e,t,n,r,a,c,d,g){a=Ve.adjustCodewordStartColumn(e,t,n,r,a,c);let w=Ve.getModuleBitCount(e,t,n,r,a,c);if(w==null)return null;let E,A=He.sum(w);if(r)E=a+A;else{for(let L=0;L<w.length/2;L++){let F=w[L];w[L]=w[w.length-1-L],w[w.length-1-L]=F}E=a,a=E-A}if(!Ve.checkCodewordSkew(A,d,g))return null;let I=Jt.getDecodedValue(w),R=Te.getCodeword(I);return R===-1?null:new Yr(a,E,Ve.getCodewordBucketNumber(I),R)}static getModuleBitCount(e,t,n,r,a,c){let d=a,g=new Int32Array(8),w=0,E=r?1:-1,A=r;for(;(r?d<n:d>=t)&&w<g.length;)e.get(d,c)===A?(g[w]++,d+=E):(w++,A=!A);return w===g.length||d===(r?n:t)&&w===g.length-1?g:null}static getNumberOfECCodeWords(e){return 2<<e}static adjustCodewordStartColumn(e,t,n,r,a,c){let d=a,g=r?-1:1;for(let w=0;w<2;w++){for(;(r?d>=t:d<n)&&r===e.get(d,c);){if(Math.abs(a-d)>Ve.CODEWORD_SKEW_SIZE)return a;d+=g}g=-g,r=!r}return d}static checkCodewordSkew(e,t,n){return t-Ve.CODEWORD_SKEW_SIZE<=e&&e<=n+Ve.CODEWORD_SKEW_SIZE}static decodeCodewords(e,t,n){if(e.length===0)throw W.getFormatInstance();let r=1<<t+1,a=Ve.correctErrors(e,n,r);Ve.verifyCodewordCount(e,r);let c=ee.decode(e,""+t);return c.setErrorsCorrected(a),c.setErasures(n.length),c}static correctErrors(e,t,n){if(t!=null&&t.length>n/2+Ve.MAX_ERRORS||n<0||n>Ve.MAX_EC_CODEWORDS)throw B.getChecksumInstance();return Ve.errorCorrection.decode(e,n,t)}static verifyCodewordCount(e,t){if(e.length<4)throw W.getFormatInstance();let n=e[0];if(n>e.length)throw W.getFormatInstance();if(n===0)if(t<e.length)e[0]=e.length-t;else throw W.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 Ve.getCodewordBucketNumber(Ve.getBitCountForCodeword(e))}static getCodewordBucketNumber_Int32Array(e){return(e[0]-e[2]+e[4]-e[6]+9)%9}static toString(e){let t=new Xr;for(let n=0;n<e.length;n++){t.format("Row %2d: ",n);for(let r=0;r<e[n].length;r++){let a=e[n][r];a.getValue().length===0?t.format(" ",null):t.format("%4d(%2d)",a.getValue()[0],a.getConfidence(a.getValue()[0]))}t.format("%n")}return t.toString()}}Ve.CODEWORD_SKEW_SIZE=2,Ve.MAX_ERRORS=3,Ve.MAX_EC_CODEWORDS=512,Ve.errorCorrection=new Ua;class Pt{decode(e,t=null){let n=Pt.decode(e,t,!1);if(n==null||n.length===0||n[0]==null)throw N.getNotFoundInstance();return n[0]}decodeMultiple(e,t=null){try{return Pt.decode(e,t,!0)}catch(n){throw n instanceof W||n instanceof B?N.getNotFoundInstance():n}}static decode(e,t,n){const r=new Array,a=Pe.detectMultiple(e,t,n);for(const c of a.getPoints()){const d=Ve.decode(a.getBits(),c[4],c[5],c[6],c[7],Pt.getMinCodewordWidth(c),Pt.getMaxCodewordWidth(c)),g=new _e(d.getText(),d.getRawBytes(),void 0,c,xe.PDF_417);g.putMetadata(Oe.ERROR_CORRECTION_LEVEL,d.getECLevel());const w=d.getOther();w!=null&&g.putMetadata(Oe.PDF417_EXTRA_METADATA,w),r.push(g)}return r.map(c=>c)}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?O.MAX_VALUE:Math.trunc(Math.abs(e.getX()-t.getX()))}static getMaxCodewordWidth(e){return Math.floor(Math.max(Math.max(Pt.getMaxWidth(e[0],e[4]),Pt.getMaxWidth(e[6],e[2])*Te.MODULES_IN_CODEWORD/Te.MODULES_IN_STOP_PATTERN),Math.max(Pt.getMaxWidth(e[1],e[5]),Pt.getMaxWidth(e[7],e[3])*Te.MODULES_IN_CODEWORD/Te.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(e){return Math.floor(Math.min(Math.min(Pt.getMinWidth(e[0],e[4]),Pt.getMinWidth(e[6],e[2])*Te.MODULES_IN_CODEWORD/Te.MODULES_IN_STOP_PATTERN),Math.min(Pt.getMinWidth(e[1],e[5]),Pt.getMinWidth(e[7],e[3])*Te.MODULES_IN_CODEWORD/Te.MODULES_IN_STOP_PATTERN)))}reset(){}}class ki extends p{}ki.kind="ReaderException";class ja{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=!u(e)&&e.get(Q.TRY_HARDER)===!0,n=u(e)?null:e.get(Q.POSSIBLE_FORMATS),r=new Array;if(!u(n)){const a=n.some(c=>c===xe.UPC_A||c===xe.UPC_E||c===xe.EAN_13||c===xe.EAN_8||c===xe.CODABAR||c===xe.CODE_39||c===xe.CODE_93||c===xe.CODE_128||c===xe.ITF||c===xe.RSS_14||c===xe.RSS_EXPANDED);a&&!t&&r.push(new Ar(e,this.verbose)),n.includes(xe.QR_CODE)&&r.push(new jn),n.includes(xe.DATA_MATRIX)&&r.push(new Xn),n.includes(xe.AZTEC)&&r.push(new nr),n.includes(xe.PDF_417)&&r.push(new Pt),a&&t&&r.push(new Ar(e,this.verbose))}r.length===0&&(t||r.push(new Ar(e,this.verbose)),r.push(new jn),r.push(new Xn),r.push(new nr),r.push(new Pt),t&&r.push(new Ar(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 ki("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 ki)continue}throw new N("No MultiFormat Readers were able to detect the code.")}}class bg extends Ie{constructor(e=null,t=500){const n=new ja;n.setHints(e),super(n,t)}decodeBitmap(e){return this.reader.decodeWithState(e)}}class Ag extends Ie{constructor(e=500){super(new Pt,e)}}class Ig extends Ie{constructor(e=500){super(new jn,e)}}var vo;(function(b){b[b.ERROR_CORRECTION=0]="ERROR_CORRECTION",b[b.CHARACTER_SET=1]="CHARACTER_SET",b[b.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",b[b.MIN_SIZE=3]="MIN_SIZE",b[b.MAX_SIZE=4]="MAX_SIZE",b[b.MARGIN=5]="MARGIN",b[b.PDF417_COMPACT=6]="PDF417_COMPACT",b[b.PDF417_COMPACTION=7]="PDF417_COMPACTION",b[b.PDF417_DIMENSIONS=8]="PDF417_DIMENSIONS",b[b.AZTEC_LAYERS=9]="AZTEC_LAYERS",b[b.QR_VERSION=10]="QR_VERSION"})(vo||(vo={}));var Nt=vo;class Do{constructor(e){this.field=e,this.cachedGenerators=[],this.cachedGenerators.push(new $e(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 a=t.length;a<=e;a++){const c=n.multiply(new $e(r,Int32Array.from([1,r.exp(a-1+r.getGeneratorBase())])));t.push(c),n=c}}return t[e]}encode(e,t){if(t===0)throw new y("No error correction bytes");const n=e.length-t;if(n<=0)throw new y("No data bytes provided");const r=this.buildGenerator(t),a=new Int32Array(n);D.arraycopy(e,0,a,0,n);let c=new $e(this.field,a);c=c.multiplyByMonomial(t,1);const g=c.divide(r)[1].getCoefficients(),w=t-g.length;for(let E=0;E<w;E++)e[n+E]=0;D.arraycopy(g,0,e,n+w,g.length)}}class Ct{constructor(){}static applyMaskPenaltyRule1(e){return Ct.applyMaskPenaltyRule1Internal(e,!0)+Ct.applyMaskPenaltyRule1Internal(e,!1)}static applyMaskPenaltyRule2(e){let t=0;const n=e.getArray(),r=e.getWidth(),a=e.getHeight();for(let c=0;c<a-1;c++){const d=n[c];for(let g=0;g<r-1;g++){const w=d[g];w===d[g+1]&&w===n[c+1][g]&&w===n[c+1][g+1]&&t++}}return Ct.N2*t}static applyMaskPenaltyRule3(e){let t=0;const n=e.getArray(),r=e.getWidth(),a=e.getHeight();for(let c=0;c<a;c++)for(let d=0;d<r;d++){const g=n[c];d+6<r&&g[d]===1&&g[d+1]===0&&g[d+2]===1&&g[d+3]===1&&g[d+4]===1&&g[d+5]===0&&g[d+6]===1&&(Ct.isWhiteHorizontal(g,d-4,d)||Ct.isWhiteHorizontal(g,d+7,d+11))&&t++,c+6<a&&n[c][d]===1&&n[c+1][d]===0&&n[c+2][d]===1&&n[c+3][d]===1&&n[c+4][d]===1&&n[c+5][d]===0&&n[c+6][d]===1&&(Ct.isWhiteVertical(n,d,c-4,c)||Ct.isWhiteVertical(n,d,c+7,c+11))&&t++}return t*Ct.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 a=n;a<r;a++)if(e[a][t]===1)return!1;return!0}static applyMaskPenaltyRule4(e){let t=0;const n=e.getArray(),r=e.getWidth(),a=e.getHeight();for(let g=0;g<a;g++){const w=n[g];for(let E=0;E<r;E++)w[E]===1&&t++}const c=e.getHeight()*e.getWidth();return Math.floor(Math.abs(t*2-c)*10/c)*Ct.N4}static getDataMaskBit(e,t,n){let r,a;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:a=n*t,r=(a&1)+a%3;break;case 6:a=n*t,r=(a&1)+a%3&1;break;case 7:a=n*t,r=a%3+(n+t&1)&1;break;default:throw new y("Invalid mask pattern: "+e)}return r===0}static applyMaskPenaltyRule1Internal(e,t){let n=0;const r=t?e.getHeight():e.getWidth(),a=t?e.getWidth():e.getHeight(),c=e.getArray();for(let d=0;d<r;d++){let g=0,w=-1;for(let E=0;E<a;E++){const A=t?c[d][E]:c[E][d];A===w?g++:(g>=5&&(n+=Ct.N1+(g-5)),g=1,w=A)}g>=5&&(n+=Ct.N1+(g-5))}return n}}Ct.N1=3,Ct.N2=3,Ct.N3=40,Ct.N4=10;class Ri{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)P.fill(t,e)}equals(e){if(!(e instanceof Ri))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 a=this.bytes[n],c=t.bytes[n];for(let d=0,g=this.width;d<g;++d)if(a[d]!==c[d])return!1}return!0}toString(){const e=new z;for(let t=0,n=this.height;t<n;++t){const r=this.bytes[t];for(let a=0,c=this.width;a<c;++a)switch(r[a]){case 0:e.append(" 0");break;case 1:e.append(" 1");break;default:e.append(" ");break}e.append(`
|
|
19
|
+
`)}return e.toString()}}class sr{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 z;return e.append(`<<
|
|
20
20
|
`),e.append(" mode: "),e.append(this.mode?this.mode.toString():"null"),e.append(`
|
|
21
21
|
ecLevel: `),e.append(this.ecLevel?this.ecLevel.toString():"null"),e.append(`
|
|
22
22
|
version: `),e.append(this.version?this.version.toString():"null"),e.append(`
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
`),e.append(this.matrix.toString())):e.append(`
|
|
26
26
|
matrix: null
|
|
27
27
|
`),e.append(`>>
|
|
28
|
-
`),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<ar.NUM_MASK_PATTERNS}}ar.NUM_MASK_PATTERNS=8;class st extends p{}st.kind="WriterException";class Te{constructor(){}static clearMatrix(e){e.clear(255)}static buildMatrix(e,t,n,r,a){Te.clearMatrix(a),Te.embedBasicPatterns(n,a),Te.embedTypeInfo(t,r,a),Te.maybeEmbedVersionInfo(n,a),Te.embedDataBits(e,r,a)}static embedBasicPatterns(e,t){Te.embedPositionDetectionPatternsAndSeparators(t),Te.embedDarkDotAtLeftBottomCorner(t),Te.maybeEmbedPositionAdjustmentPatterns(e,t),Te.embedTimingPatterns(t)}static embedTypeInfo(e,t,n){const r=new D;Te.makeTypeInfoBits(e,t,r);for(let a=0,c=r.getSize();a<c;++a){const d=r.get(r.getSize()-1-a),g=Te.TYPE_INFO_COORDINATES[a],w=g[0],E=g[1];if(n.setBoolean(w,E,d),a<8){const A=n.getWidth()-a-1;n.setBoolean(A,8,d)}else{const I=n.getHeight()-7+(a-8);n.setBoolean(8,I,d)}}}static maybeEmbedVersionInfo(e,t){if(e.getVersionNumber()<7)return;const n=new D;Te.makeVersionInfoBits(e,n);let r=6*3-1;for(let a=0;a<6;++a)for(let c=0;c<3;++c){const d=n.get(r);r--,t.setBoolean(a,t.getHeight()-11+c,d),t.setBoolean(t.getHeight()-11+c,a,d)}}static embedDataBits(e,t,n){let r=0,a=-1,c=n.getWidth()-1,d=n.getHeight()-1;for(;c>0;){for(c===6&&(c-=1);d>=0&&d<n.getHeight();){for(let g=0;g<2;++g){const w=c-g;if(!Te.isEmpty(n.get(w,d)))continue;let E;r<e.getSize()?(E=e.get(r),++r):E=!1,t!==255&&Et.getDataMaskBit(t,w,d)&&(E=!E),n.setBoolean(w,d,E)}d+=a}a=-a,d+=a,c-=2}if(r!==e.getSize())throw new st("Not all bits consumed: "+r+"/"+e.getSize())}static findMSBSet(e){return 32-R.numberOfLeadingZeros(e)}static calculateBCHCode(e,t){if(t===0)throw new y("0 polynomial");const n=Te.findMSBSet(t);for(e<<=n-1;Te.findMSBSet(e)>=n;)e^=t<<Te.findMSBSet(e)-n;return e}static makeTypeInfoBits(e,t,n){if(!ar.isValidMaskPattern(t))throw new st("Invalid mask pattern");const r=e.getBits()<<3|t;n.appendBits(r,5);const a=Te.calculateBCHCode(r,Te.TYPE_INFO_POLY);n.appendBits(a,10);const c=new D;if(c.appendBits(Te.TYPE_INFO_MASK_PATTERN,15),n.xor(c),n.getSize()!==15)throw new st("should not happen but we got: "+n.getSize())}static makeVersionInfoBits(e,t){t.appendBits(e.getVersionNumber(),6);const n=Te.calculateBCHCode(e.getVersionNumber(),Te.VERSION_INFO_POLY);if(t.appendBits(n,12),t.getSize()!==18)throw new st("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;Te.isEmpty(e.get(t,6))&&e.setNumber(t,6,n),Te.isEmpty(e.get(6,t))&&e.setNumber(6,t,n)}}static embedDarkDotAtLeftBottomCorner(e){if(e.get(8,e.getHeight()-8)===0)throw new st;e.setNumber(8,e.getHeight()-8,1)}static embedHorizontalSeparationPattern(e,t,n){for(let r=0;r<8;++r){if(!Te.isEmpty(n.get(e+r,t)))throw new st;n.setNumber(e+r,t,0)}}static embedVerticalSeparationPattern(e,t,n){for(let r=0;r<7;++r){if(!Te.isEmpty(n.get(e,t+r)))throw new st;n.setNumber(e,t+r,0)}}static embedPositionAdjustmentPattern(e,t,n){for(let r=0;r<5;++r){const a=Te.POSITION_ADJUSTMENT_PATTERN[r];for(let c=0;c<5;++c)n.setNumber(e+c,t+r,a[c])}}static embedPositionDetectionPattern(e,t,n){for(let r=0;r<7;++r){const a=Te.POSITION_DETECTION_PATTERN[r];for(let c=0;c<7;++c)n.setNumber(e+c,t+r,a[c])}}static embedPositionDetectionPatternsAndSeparators(e){const t=Te.POSITION_DETECTION_PATTERN[0].length;Te.embedPositionDetectionPattern(0,0,e),Te.embedPositionDetectionPattern(e.getWidth()-t,0,e),Te.embedPositionDetectionPattern(0,e.getWidth()-t,e);const n=8;Te.embedHorizontalSeparationPattern(0,n-1,e),Te.embedHorizontalSeparationPattern(e.getWidth()-n,n-1,e),Te.embedHorizontalSeparationPattern(0,e.getWidth()-n,e);const r=7;Te.embedVerticalSeparationPattern(r,0,e),Te.embedVerticalSeparationPattern(e.getHeight()-r-1,0,e),Te.embedVerticalSeparationPattern(r,e.getHeight()-r,e)}static maybeEmbedPositionAdjustmentPatterns(e,t){if(e.getVersionNumber()<2)return;const n=e.getVersionNumber()-1,r=Te.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[n];for(let a=0,c=r.length;a!==c;a++){const d=r[a];if(d>=0)for(let g=0;g!==c;g++){const w=r[g];w>=0&&Te.isEmpty(t.get(w,d))&&Te.embedPositionAdjustmentPattern(w-2,d-2,t)}}}}Te.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])]),Te.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])]),Te.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])]),Te.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])]),Te.VERSION_INFO_POLY=7973,Te.TYPE_INFO_POLY=1335,Te.TYPE_INFO_MASK_PATTERN=21522;class Sg{constructor(e,t){this.dataBytes=e,this.errorCorrectionBytes=t}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class ht{constructor(){}static calculateMaskPenalty(e){return Et.applyMaskPenaltyRule1(e)+Et.applyMaskPenaltyRule2(e)+Et.applyMaskPenaltyRule3(e)+Et.applyMaskPenaltyRule4(e)}static encode(e,t,n=null){let r=ht.DEFAULT_BYTE_MODE_ENCODING;const a=n!==null&&n.get(kt.CHARACTER_SET)!==void 0;a&&(r=n.get(kt.CHARACTER_SET).toString());const c=this.chooseMode(e,r),d=new D;if(c===Se.BYTE&&(a||ht.DEFAULT_BYTE_MODE_ENCODING!==r)){const ue=W.getCharacterSetECIByName(r);ue!==void 0&&this.appendECI(ue,d)}this.appendModeInfo(c,d);const g=new D;this.appendBytes(e,c,g,r);let w;if(n!==null&&n.get(kt.QR_VERSION)!==void 0){const ue=Number.parseInt(n.get(kt.QR_VERSION).toString(),10);w=Ie.getVersionForNumber(ue);const ae=this.calculateBitsNeeded(c,d,g,w);if(!this.willFit(ae,w,t))throw new st("Data too big for requested version")}else w=this.recommendVersion(t,c,d,g);const E=new D;E.appendBitArray(d);const A=c===Se.BYTE?g.getSizeInBytes():e.length;this.appendLengthInfo(A,w,c,E),E.appendBitArray(g);const I=w.getECBlocksForLevel(t),O=w.getTotalCodewords()-I.getTotalECCodewords();this.terminateBits(O,E);const L=this.interleaveWithECBytes(E,w.getTotalCodewords(),O,I.getNumBlocks()),F=new ar;F.setECLevel(t),F.setMode(c),F.setVersion(w);const Z=w.getDimensionForVersion(),ne=new Oi(Z,Z),ce=this.chooseMaskPattern(L,t,w,ne);return F.setMaskPattern(ce),Te.buildMatrix(L,t,w,ce,ne),F.setMatrix(ne),F}static recommendVersion(e,t,n,r){const a=this.calculateBitsNeeded(t,n,r,Ie.getVersionForNumber(1)),c=this.chooseVersion(a,e),d=this.calculateBitsNeeded(t,n,r,c);return this.chooseVersion(d,e)}static calculateBitsNeeded(e,t,n,r){return t.getSize()+e.getCharacterCountBits(r)+n.getSize()}static getAlphanumericCode(e){return e<ht.ALPHANUMERIC_TABLE.length?ht.ALPHANUMERIC_TABLE[e]:-1}static chooseMode(e,t=null){if(W.SJIS.getName()===t&&this.isOnlyDoubleByteKanji(e))return Se.KANJI;let n=!1,r=!1;for(let a=0,c=e.length;a<c;++a){const d=e.charAt(a);if(ht.isDigit(d))n=!0;else if(this.getAlphanumericCode(d.charCodeAt(0))!==-1)r=!0;else return Se.BYTE}return r?Se.ALPHANUMERIC:n?Se.NUMERIC:Se.BYTE}static isOnlyDoubleByteKanji(e){let t;try{t=j.encode(e,W.SJIS)}catch{return!1}const n=t.length;if(n%2!==0)return!1;for(let r=0;r<n;r+=2){const a=t[r]&255;if((a<129||a>159)&&(a<224||a>235))return!1}return!0}static chooseMaskPattern(e,t,n,r){let a=Number.MAX_SAFE_INTEGER,c=-1;for(let d=0;d<ar.NUM_MASK_PATTERNS;d++){Te.buildMatrix(e,t,n,d,r);let g=this.calculateMaskPenalty(r);g<a&&(a=g,c=d)}return c}static chooseVersion(e,t){for(let n=1;n<=40;n++){const r=Ie.getVersionForNumber(n);if(ht.willFit(e,r,t))return r}throw new st("Data too big")}static willFit(e,t,n){const r=t.getTotalCodewords(),c=t.getECBlocksForLevel(n).getTotalECCodewords(),d=r-c,g=(e+7)/8;return d>=g}static terminateBits(e,t){const n=e*8;if(t.getSize()>n)throw new st("data bits cannot fit in the QR Code"+t.getSize()+" > "+n);for(let c=0;c<4&&t.getSize()<n;++c)t.appendBit(!1);const r=t.getSize()&7;if(r>0)for(let c=r;c<8;c++)t.appendBit(!1);const a=e-t.getSizeInBytes();for(let c=0;c<a;++c)t.appendBits(c&1?17:236,8);if(t.getSize()!==n)throw new st("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(e,t,n,r,a,c){if(r>=n)throw new st("Block ID too large");const d=e%n,g=n-d,w=Math.floor(e/n),E=w+1,A=Math.floor(t/n),I=A+1,O=w-A,L=E-I;if(O!==L)throw new st("EC bytes mismatch");if(n!==g+d)throw new st("RS blocks mismatch");if(e!==(A+O)*g+(I+L)*d)throw new st("Total bytes mismatch");r<g?(a[0]=A,c[0]=O):(a[0]=I,c[0]=L)}static interleaveWithECBytes(e,t,n,r){if(e.getSizeInBytes()!==n)throw new st("Number of bits and data bytes does not match");let a=0,c=0,d=0;const g=new Array;for(let E=0;E<r;++E){const A=new Int32Array(1),I=new Int32Array(1);ht.getNumDataBytesAndNumECBytesForBlockID(t,n,r,E,A,I);const O=A[0],L=new Uint8Array(O);e.toBytes(8*a,L,0,O);const F=ht.generateECBytes(L,I[0]);g.push(new Sg(L,F)),c=Math.max(c,O),d=Math.max(d,F.length),a+=A[0]}if(n!==a)throw new st("Data bytes does not match offset");const w=new D;for(let E=0;E<c;++E)for(const A of g){const I=A.getDataBytes();E<I.length&&w.appendBits(I[E],8)}for(let E=0;E<d;++E)for(const A of g){const I=A.getErrorCorrectionBytes();E<I.length&&w.appendBits(I[E],8)}if(t!==w.getSizeInBytes())throw new st("Interleaving error: "+t+" and "+w.getSizeInBytes()+" differ.");return w}static generateECBytes(e,t){const n=e.length,r=new Int32Array(n+t);for(let c=0;c<n;c++)r[c]=e[c]&255;new Po(Ee.QR_CODE_FIELD_256).encode(r,t);const a=new Uint8Array(t);for(let c=0;c<t;c++)a[c]=r[n+c];return a}static appendModeInfo(e,t){t.appendBits(e.getBits(),4)}static appendLengthInfo(e,t,n,r){const a=n.getCharacterCountBits(t);if(e>=1<<a)throw new st(e+" is bigger than "+((1<<a)-1));r.appendBits(e,a)}static appendBytes(e,t,n,r){switch(t){case Se.NUMERIC:ht.appendNumericBytes(e,n);break;case Se.ALPHANUMERIC:ht.appendAlphanumericBytes(e,n);break;case Se.BYTE:ht.append8BitBytes(e,n,r);break;case Se.KANJI:ht.appendKanjiBytes(e,n);break;default:throw new st("Invalid mode: "+t)}}static getDigit(e){return e.charCodeAt(0)-48}static isDigit(e){const t=ht.getDigit(e);return t>=0&&t<=9}static appendNumericBytes(e,t){const n=e.length;let r=0;for(;r<n;){const a=ht.getDigit(e.charAt(r));if(r+2<n){const c=ht.getDigit(e.charAt(r+1)),d=ht.getDigit(e.charAt(r+2));t.appendBits(a*100+c*10+d,10),r+=3}else if(r+1<n){const c=ht.getDigit(e.charAt(r+1));t.appendBits(a*10+c,7),r+=2}else t.appendBits(a,4),r++}}static appendAlphanumericBytes(e,t){const n=e.length;let r=0;for(;r<n;){const a=ht.getAlphanumericCode(e.charCodeAt(r));if(a===-1)throw new st;if(r+1<n){const c=ht.getAlphanumericCode(e.charCodeAt(r+1));if(c===-1)throw new st;t.appendBits(a*45+c,11),r+=2}else t.appendBits(a,6),r++}}static append8BitBytes(e,t,n){let r;try{r=j.encode(e,n)}catch(a){throw new st(a)}for(let a=0,c=r.length;a!==c;a++){const d=r[a];t.appendBits(d,8)}}static appendKanjiBytes(e,t){let n;try{n=j.encode(e,W.SJIS)}catch(a){throw new st(a)}const r=n.length;for(let a=0;a<r;a+=2){const c=n[a]&255,d=n[a+1]&255,g=c<<8&4294967295|d;let w=-1;if(g>=33088&&g<=40956?w=g-33088:g>=57408&&g<=60351&&(w=g-49472),w===-1)throw new st("Invalid byte sequence");const E=(w>>8)*192+(w&255);t.appendBits(E,13)}}static appendECI(e,t){t.appendBits(Se.ECI.getBits(),4),t.appendBits(e.getValue(),8)}}ht.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]),ht.DEFAULT_BYTE_MODE_ENCODING=W.UTF8.getName();class lr{write(e,t,n,r=null){if(e.length===0)throw new y("Found empty contents");if(t<0||n<0)throw new y("Requested dimensions are too small: "+t+"x"+n);let a=ct.L,c=lr.QUIET_ZONE_SIZE;r!==null&&(r.get(kt.ERROR_CORRECTION)!==void 0&&(a=ct.fromString(r.get(kt.ERROR_CORRECTION).toString())),r.get(kt.MARGIN)!==void 0&&(c=Number.parseInt(r.get(kt.MARGIN).toString(),10)));const d=ht.encode(e,a,r);return this.renderResult(d,t,n,c)}writeToDom(e,t,n,r,a=null){typeof e=="string"&&(e=document.querySelector(e));const c=this.write(t,n,r,a);e&&e.appendChild(c)}renderResult(e,t,n,r){const a=e.getMatrix();if(a===null)throw new nt;const c=a.getWidth(),d=a.getHeight(),g=c+r*2,w=d+r*2,E=Math.max(t,g),A=Math.max(n,w),I=Math.min(Math.floor(E/g),Math.floor(A/w)),O=Math.floor((E-c*I)/2),L=Math.floor((A-d*I)/2),F=this.createSVGElement(E,A);for(let Z=0,ne=L;Z<d;Z++,ne+=I)for(let ce=0,ue=O;ce<c;ce++,ue+=I)if(a.get(ce,Z)===1){const ae=this.createSvgRectElement(ue,ne,I,I);F.appendChild(ae)}return F}createSVGElement(e,t){const n=document.createElementNS(lr.SVG_NS,"svg");return n.setAttributeNS(null,"height",e.toString()),n.setAttributeNS(null,"width",t.toString()),n}createSvgRectElement(e,t,n,r){const a=document.createElementNS(lr.SVG_NS,"rect");return a.setAttributeNS(null,"x",e.toString()),a.setAttributeNS(null,"y",t.toString()),a.setAttributeNS(null,"height",n.toString()),a.setAttributeNS(null,"width",r.toString()),a.setAttributeNS(null,"fill","#000000"),a}}lr.QUIET_ZONE_SIZE=4,lr.SVG_NS="http://www.w3.org/2000/svg";class Sr{encode(e,t,n,r,a){if(e.length===0)throw new y("Found empty contents");if(t!==he.QR_CODE)throw new y("Can only encode QR_CODE, but got "+t);if(n<0||r<0)throw new y(`Requested dimensions are too small: ${n}x${r}`);let c=ct.L,d=Sr.QUIET_ZONE_SIZE;a!==null&&(a.get(kt.ERROR_CORRECTION)!==void 0&&(c=ct.fromString(a.get(kt.ERROR_CORRECTION).toString())),a.get(kt.MARGIN)!==void 0&&(d=Number.parseInt(a.get(kt.MARGIN).toString(),10)));const g=ht.encode(e,c,a);return Sr.renderResult(g,n,r,d)}static renderResult(e,t,n,r){const a=e.getMatrix();if(a===null)throw new nt;const c=a.getWidth(),d=a.getHeight(),g=c+r*2,w=d+r*2,E=Math.max(t,g),A=Math.max(n,w),I=Math.min(Math.floor(E/g),Math.floor(A/w)),O=Math.floor((E-c*I)/2),L=Math.floor((A-d*I)/2),F=new X(E,A);for(let Z=0,ne=L;Z<d;Z++,ne+=I)for(let ce=0,ue=O;ce<c;ce++,ue+=I)a.get(ce,Z)===1&&F.setRegion(ue,ne,I,I);return F}}Sr.QUIET_ZONE_SIZE=4;class Ng{encode(e,t,n,r,a){let c;switch(t){case he.QR_CODE:c=new Sr;break;default:throw new y("No encoder available for format "+t)}return c.encode(e,t,n,r,a)}}class Bn extends J{constructor(e,t,n,r,a,c,d,g){if(super(c,d),this.yuvData=e,this.dataWidth=t,this.dataHeight=n,this.left=r,this.top=a,r+c>t||a+d>n)throw new y("Crop rectangle does not fit within image data.");g&&this.reverseHorizontal(c,d)}getRow(e,t){if(e<0||e>=this.getHeight())throw new y("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 P.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 a=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return P.arraycopy(this.yuvData,a,r,0,n),r;for(let c=0;c<t;c++){const d=c*e;P.arraycopy(this.yuvData,a,r,d,e),a+=this.dataWidth}return r}isCropSupported(){return!0}crop(e,t,n,r){return new Bn(this.yuvData,this.dataWidth,this.dataHeight,this.left+e,this.top+t,n,r,!1)}renderThumbnail(){const e=this.getWidth()/Bn.THUMBNAIL_SCALE_FACTOR,t=this.getHeight()/Bn.THUMBNAIL_SCALE_FACTOR,n=new Int32Array(e*t),r=this.yuvData;let a=this.top*this.dataWidth+this.left;for(let c=0;c<t;c++){const d=c*e;for(let g=0;g<e;g++){const w=r[a+g*Bn.THUMBNAIL_SCALE_FACTOR]&255;n[d+g]=4278190080|w*65793}a+=this.dataWidth*Bn.THUMBNAIL_SCALE_FACTOR}return n}getThumbnailWidth(){return this.getWidth()/Bn.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/Bn.THUMBNAIL_SCALE_FACTOR}reverseHorizontal(e,t){const n=this.yuvData;for(let r=0,a=this.top*this.dataWidth+this.left;r<t;r++,a+=this.dataWidth){const c=a+e/2;for(let d=a,g=a+e-1;d<c;d++,g--){const w=n[d];n[d]=n[g],n[g]=w}}}invert(){return new q(this)}}Bn.THUMBNAIL_SCALE_FACTOR=2;class Lo extends J{constructor(e,t,n,r,a,c,d){if(super(t,n),this.dataWidth=r,this.dataHeight=a,this.left=c,this.top=d,e.BYTES_PER_ELEMENT===4){const g=t*n,w=new Uint8ClampedArray(g);for(let E=0;E<g;E++){const A=e[E],I=A>>16&255,O=A>>7&510,L=A&255;w[E]=(I+O+L)/4&255}this.luminances=w}else this.luminances=e;if(r===void 0&&(this.dataWidth=t),a===void 0&&(this.dataHeight=n),c===void 0&&(this.left=0),d===void 0&&(this.top=0),this.left+t>this.dataWidth||this.top+n>this.dataHeight)throw new y("Crop rectangle does not fit within image data.")}getRow(e,t){if(e<0||e>=this.getHeight())throw new y("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 P.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 a=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return P.arraycopy(this.luminances,a,r,0,n),r;for(let c=0;c<t;c++){const d=c*e;P.arraycopy(this.luminances,a,r,d,e),a+=this.dataWidth}return r}isCropSupported(){return!0}crop(e,t,n,r){return new Lo(this.luminances,n,r,this.dataWidth,this.dataHeight,this.left+e,this.top+t)}invert(){return new q(this)}}class Ya extends W{static forName(e){return this.getCharacterSetECIByName(e)}}class Fo{}Fo.ISO_8859_1=W.ISO8859_1;class $a{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}getCodeWords(){return this.codeWords}setCodeWords(e){this.codeWords=e}getMatrix(){return this.matrix}setMatrix(e){this.matrix=e}}class Ka{static singletonList(e){return[e]}static min(e,t){return e.sort(t)[0]}}class Tg{constructor(e){this.previous=e}getPrevious(){return this.previous}}class Nr extends Tg{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 Nr(this,e,t)}addBinaryShift(e,t){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new Nr(this,e,t)}toString(){let e=this.value&(1<<this.bitCount)-1;return e|=1<<this.bitCount,"<"+R.toBinaryString(e|1<<this.bitCount).substring(1)+">"}}class Vo extends Nr{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 Vo(this,e,t)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function kg(b,e,t){return new Vo(b,e,t)}function $r(b,e,t){return new Nr(b,e,t)}const Rg=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],Yn=0,Bi=1,mn=2,Qa=3,Mn=4,Og=new Nr(null,0,0),Uo=[Int32Array.from([0,(5<<16)+28,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(9<<16)+480+14,0,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(4<<16)+14,(9<<16)+448+28,0,(9<<16)+448+29,932798]),Int32Array.from([(5<<16)+29,(5<<16)+28,656318,0,(5<<16)+30]),Int32Array.from([(5<<16)+31,656380,656382,656381,0])];function Bg(b){for(let e of b)B.fill(e,-1);return b[Yn][Mn]=0,b[Bi][Mn]=0,b[Bi][Yn]=28,b[Qa][Mn]=0,b[mn][Mn]=0,b[mn][Yn]=15,b}const Ja=Bg(B.createInt32Array(6,6));class vn{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 c=Uo[this.mode][e];r=$r(r,c&65535,c>>16),n+=c>>16}let a=e===mn?4:5;return r=$r(r,t,a),new vn(r,e,0,n+a)}shiftAndAppend(e,t){let n=this.token,r=this.mode===mn?4:5;return n=$r(n,Ja[this.mode][e],r),n=$r(n,t,5),new vn(n,this.mode,0,this.bitCount+r+5)}addBinaryShiftChar(e){let t=this.token,n=this.mode,r=this.bitCount;if(this.mode===Mn||this.mode===mn){let d=Uo[n][Yn];t=$r(t,d&65535,d>>16),r+=d>>16,n=Yn}let a=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,c=new vn(t,n,this.binaryShiftByteCount+1,r+a);return c.binaryShiftByteCount===2078&&(c=c.endBinaryShift(e+1)),c}endBinaryShift(e){if(this.binaryShiftByteCount===0)return this;let t=this.token;return t=kg(t,e-this.binaryShiftByteCount,this.binaryShiftByteCount),new vn(t,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(e){let t=this.bitCount+(Uo[this.mode][e.mode]>>16);return this.binaryShiftByteCount<e.binaryShiftByteCount?t+=vn.calculateBinaryShiftCost(e)-vn.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 D;for(const r of t)r.appendTo(n,e);return n}toString(){return G.format("%s bits=%d bytes=%d",Rg[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(e){return e.binaryShiftByteCount>62?21:e.binaryShiftByteCount>31?20:e.binaryShiftByteCount>0?10:0}}vn.INITIAL_STATE=new vn(Og,Yn,0,0);function Mg(b){const e=G.getCharCode(" "),t=G.getCharCode("."),n=G.getCharCode(",");b[Yn][e]=1;const r=G.getCharCode("Z"),a=G.getCharCode("A");for(let I=a;I<=r;I++)b[Yn][I]=I-a+2;b[Bi][e]=1;const c=G.getCharCode("z"),d=G.getCharCode("a");for(let I=d;I<=c;I++)b[Bi][I]=I-d+2;b[mn][e]=1;const g=G.getCharCode("9"),w=G.getCharCode("0");for(let I=w;I<=g;I++)b[mn][I]=I-w+2;b[mn][n]=12,b[mn][t]=13;const E=["\0"," ","","","","","","","\x07","\b"," ",`
|
|
29
|
-
`,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""];for(let I=0;I<E.length;I++)b[
|
|
30
|
-
`);let n=Ka.singletonList(vn.INITIAL_STATE);for(let a=0;a<this.text.length;a++){let c,d=a+1<this.text.length?this.text[a+1]:0;switch(this.text[a]){case G.getCharCode("\r"):c=d===t?2:0;break;case G.getCharCode("."):c=d===e?3:0;break;case G.getCharCode(","):c=d===e?4:0;break;case G.getCharCode(":"):c=d===e?5:0;break;default:c=0}c>0?(n=Kr.updateStateListForPair(n,a,c),a++):n=this.updateStateListForChar(n,a)}return Ka.min(n,(a,c)=>a.getBitCount()-c.getBitCount()).toBitArray(this.text)}updateStateListForChar(e,t){const n=[];for(let r of e)this.updateStateForChar(r,t,n);return Kr.simplifyStates(n)}updateStateForChar(e,t,n){let r=this.text[t]&255,a=zo[e.getMode()][r]>0,c=null;for(let d=0;d<=Mn;d++){let g=zo[d][r];if(g>0){if(c==null&&(c=e.endBinaryShift(t)),!a||d===e.getMode()||d===mn){const w=c.latchAndAppend(d,g);n.push(w)}if(!a&&Ja[e.getMode()][d]>=0){const w=c.shiftAndAppend(d,g);n.push(w)}}}if(e.getBinaryShiftByteCount()>0||zo[e.getMode()][r]===0){let d=e.addBinaryShiftChar(t);n.push(d)}}static updateStateListForPair(e,t,n){const r=[];for(let a of e)this.updateStateForPair(a,t,n,r);return this.simplifyStates(r)}static updateStateForPair(e,t,n,r){let a=e.endBinaryShift(t);if(r.push(a.latchAndAppend(Mn,n)),e.getMode()!==Mn&&r.push(a.shiftAndAppend(Mn,n)),n===3||n===4){let c=a.latchAndAppend(mn,16-n).latchAndAppend(mn,1);r.push(c)}if(e.getBinaryShiftByteCount()>0){let c=e.addBinaryShiftChar(t).addBinaryShiftChar(t+1);r.push(c)}}static simplifyStates(e){let t=[];for(const n of e){let r=!0;for(const a of t){if(a.isBetterThanOrEqualTo(n)){r=!1;break}n.isBetterThanOrEqualTo(a)&&(t=t.filter(c=>c!==a))}r&&t.push(n)}return t}}class $e{constructor(){}static encodeBytes(e){return $e.encode(e,$e.DEFAULT_EC_PERCENT,$e.DEFAULT_AZTEC_LAYERS)}static encode(e,t,n){let r=new Kr(e).encode(),a=R.truncDivision(r.getSize()*t,100)+11,c=r.getSize()+a,d,g,w,E,A;if(n!==$e.DEFAULT_AZTEC_LAYERS){if(d=n<0,g=Math.abs(n),g>(d?$e.MAX_NB_BITS_COMPACT:$e.MAX_NB_BITS))throw new y(G.format("Illegal value %s for layers",n));w=$e.totalBitsInLayer(g,d),E=$e.WORD_SIZE[g];let ae=w-w%E;if(A=$e.stuffBits(r,E),A.getSize()+a>ae)throw new y("Data to large for user specified layer");if(d&&A.getSize()>E*64)throw new y("Data to large for user specified layer")}else{E=0,A=null;for(let ae=0;;ae++){if(ae>$e.MAX_NB_BITS)throw new y("Data too large for an Aztec code");if(d=ae<=3,g=d?ae+1:ae,w=$e.totalBitsInLayer(g,d),c>w)continue;(A==null||E!==$e.WORD_SIZE[g])&&(E=$e.WORD_SIZE[g],A=$e.stuffBits(r,E));let Ge=w-w%E;if(!(d&&A.getSize()>E*64)&&A.getSize()+a<=Ge)break}}let I=$e.generateCheckWords(A,w,E),O=A.getSize()/E,L=$e.generateModeMessage(d,g,O),F=(d?11:14)+g*4,Z=new Int32Array(F),ne;if(d){ne=F;for(let ae=0;ae<Z.length;ae++)Z[ae]=ae}else{ne=F+1+2*R.truncDivision(R.truncDivision(F,2)-1,15);let ae=R.truncDivision(F,2),Ge=R.truncDivision(ne,2);for(let ve=0;ve<ae;ve++){let nn=ve+R.truncDivision(ve,15);Z[ae-ve-1]=Ge-nn-1,Z[ae+ve]=Ge+nn+1}}let ce=new X(ne);for(let ae=0,Ge=0;ae<g;ae++){let ve=(g-ae)*4+(d?9:12);for(let nn=0;nn<ve;nn++){let An=nn*2;for(let rn=0;rn<2;rn++)I.get(Ge+An+rn)&&ce.set(Z[ae*2+rn],Z[ae*2+nn]),I.get(Ge+ve*2+An+rn)&&ce.set(Z[ae*2+nn],Z[F-1-ae*2-rn]),I.get(Ge+ve*4+An+rn)&&ce.set(Z[F-1-ae*2-rn],Z[F-1-ae*2-nn]),I.get(Ge+ve*6+An+rn)&&ce.set(Z[F-1-ae*2-nn],Z[ae*2+rn])}Ge+=ve*8}if($e.drawModeMessage(ce,d,ne,L),d)$e.drawBullsEye(ce,R.truncDivision(ne,2),5);else{$e.drawBullsEye(ce,R.truncDivision(ne,2),7);for(let ae=0,Ge=0;ae<R.truncDivision(F,2)-1;ae+=15,Ge+=16)for(let ve=R.truncDivision(ne,2)&1;ve<ne;ve+=2)ce.set(R.truncDivision(ne,2)-Ge,ve),ce.set(R.truncDivision(ne,2)+Ge,ve),ce.set(ve,R.truncDivision(ne,2)-Ge),ce.set(ve,R.truncDivision(ne,2)+Ge)}let ue=new $a;return ue.setCompact(d),ue.setSize(ne),ue.setLayers(g),ue.setCodeWords(O),ue.setMatrix(ce),ue}static drawBullsEye(e,t,n){for(let r=0;r<n;r+=2)for(let a=t-r;a<=t+r;a++)e.set(a,t-r),e.set(a,t+r),e.set(t-r,a),e.set(t+r,a);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 D;return e?(r.appendBits(t-1,2),r.appendBits(n-1,6),r=$e.generateCheckWords(r,28,4)):(r.appendBits(t-1,5),r.appendBits(n-1,11),r=$e.generateCheckWords(r,40,4)),r}static drawModeMessage(e,t,n,r){let a=R.truncDivision(n,2);if(t)for(let c=0;c<7;c++){let d=a-3+c;r.get(c)&&e.set(d,a-5),r.get(c+7)&&e.set(a+5,d),r.get(20-c)&&e.set(d,a+5),r.get(27-c)&&e.set(a-5,d)}else for(let c=0;c<10;c++){let d=a-5+c+R.truncDivision(c,5);r.get(c)&&e.set(d,a-7),r.get(c+10)&&e.set(a+7,d),r.get(29-c)&&e.set(d,a+7),r.get(39-c)&&e.set(a-7,d)}}static generateCheckWords(e,t,n){let r=e.getSize()/n,a=new Po($e.getGF(n)),c=R.truncDivision(t,n),d=$e.bitsToWords(e,n,c);a.encode(d,c-r);let g=t%n,w=new D;w.appendBits(0,g);for(const E of Array.from(d))w.appendBits(E,n);return w}static bitsToWords(e,t,n){let r=new Int32Array(n),a,c;for(a=0,c=e.getSize()/t;a<c;a++){let d=0;for(let g=0;g<t;g++)d|=e.get(a*t+g)?1<<t-g-1:0;r[a]=d}return r}static getGF(e){switch(e){case 4:return Ee.AZTEC_PARAM;case 6:return Ee.AZTEC_DATA_6;case 8:return Ee.AZTEC_DATA_8;case 10:return Ee.AZTEC_DATA_10;case 12:return Ee.AZTEC_DATA_12;default:throw new y("Unsupported word size "+e)}}static stuffBits(e,t){let n=new D,r=e.getSize(),a=(1<<t)-2;for(let c=0;c<r;c+=t){let d=0;for(let g=0;g<t;g++)(c+g>=r||e.get(c+g))&&(d|=1<<t-1-g);(d&a)===a?(n.appendBits(d&a,t),c--):d&a?n.appendBits(d,t):(n.appendBits(d|1,t),c--)}return n}static totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}$e.DEFAULT_EC_PERCENT=33,$e.DEFAULT_AZTEC_LAYERS=0,$e.MAX_NB_BITS=32,$e.MAX_NB_BITS_COMPACT=4,$e.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 Mi{encode(e,t,n,r){return this.encodeWithHints(e,t,n,r,null)}encodeWithHints(e,t,n,r,a){let c=Fo.ISO_8859_1,d=$e.DEFAULT_EC_PERCENT,g=$e.DEFAULT_AZTEC_LAYERS;return a!=null&&(a.has(kt.CHARACTER_SET)&&(c=Ya.forName(a.get(kt.CHARACTER_SET).toString())),a.has(kt.ERROR_CORRECTION)&&(d=R.parseInt(a.get(kt.ERROR_CORRECTION).toString())),a.has(kt.AZTEC_LAYERS)&&(g=R.parseInt(a.get(kt.AZTEC_LAYERS).toString()))),Mi.encodeLayers(e,t,n,r,c,d,g)}static encodeLayers(e,t,n,r,a,c,d){if(t!==he.AZTEC)throw new y("Can only encode AZTEC, but got "+t);let g=$e.encode(G.getBytes(e,a),c,d);return Mi.renderResult(g,n,r)}static renderResult(e,t,n){let r=e.getMatrix();if(r==null)throw new nt;let a=r.getWidth(),c=r.getHeight(),d=Math.max(t,a),g=Math.max(n,c),w=Math.min(d/a,g/c),E=(d-a*w)/2,A=(g-c*w)/2,I=new X(d,g);for(let O=0,L=A;O<c;O++,L+=w)for(let F=0,Z=E;F<a;F++,Z+=w)r.get(F,O)&&I.setRegion(Z,L,w,w);return I}}i.AbstractExpandedDecoder=So,i.ArgumentException=C,i.ArithmeticException=Ze,i.AztecCode=$a,i.AztecCodeReader=le,i.AztecCodeWriter=Mi,i.AztecDecoder=ze,i.AztecDetector=be,i.AztecDetectorResult=bi,i.AztecEncoder=$e,i.AztecHighLevelEncoder=Kr,i.AztecPoint=Ot,i.BarcodeFormat=he,i.Binarizer=k,i.BinaryBitmap=S,i.BitArray=D,i.BitMatrix=X,i.BitSource=Ro,i.BrowserAztecCodeReader=Qe,i.BrowserBarcodeReader=ug,i.BrowserCodeReader=Ne,i.BrowserDatamatrixCodeReader=fg,i.BrowserMultiFormatReader=bg,i.BrowserPDF417Reader=Ag,i.BrowserQRCodeReader=Ig,i.BrowserQRCodeSvgWriter=lr,i.CharacterSetECI=W,i.ChecksumException=M,i.Code128Reader=de,i.Code39Reader=ft,i.DataMatrixDecodedBitStreamParser=Xn,i.DataMatrixReader=jn,i.DecodeHintType=te,i.DecoderResult=Oe,i.DefaultGridSampler=Ai,i.DetectorResult=Er,i.EAN13Reader=yt,i.EncodeHintType=kt,i.Exception=p,i.FormatException=z,i.GenericGF=Ee,i.GenericGFPoly=me,i.GlobalHistogramBinarizer=$,i.GridSampler=rr,i.GridSamplerInstance=dn,i.HTMLCanvasElementLuminanceSource=re,i.HybridBinarizer=H,i.ITFReader=Ye,i.IllegalArgumentException=y,i.IllegalStateException=nt,i.InvertedLuminanceSource=q,i.LuminanceSource=J,i.MathUtils=He,i.MultiFormatOneDReader=Ar,i.MultiFormatReader=Za,i.MultiFormatWriter=Ng,i.NotFoundException=N,i.OneDReader=Ke,i.PDF417DecodedBitStreamParser=ee,i.PDF417DecoderErrorCorrection=Ha,i.PDF417Reader=Vt,i.PDF417ResultMetadata=Wa,i.PerspectiveTransform=Dt,i.PlanarYUVLuminanceSource=Bn,i.QRCodeByteMatrix=Oi,i.QRCodeDataMask=hn,i.QRCodeDecodedBitStreamParser=wt,i.QRCodeDecoderErrorCorrectionLevel=ct,i.QRCodeDecoderFormatInformation=Gt,i.QRCodeEncoder=ht,i.QRCodeEncoderQRCode=ar,i.QRCodeMaskUtil=Et,i.QRCodeMatrixUtil=Te,i.QRCodeMode=Se,i.QRCodeReader=qn,i.QRCodeVersion=Ie,i.QRCodeWriter=Sr,i.RGBLuminanceSource=Lo,i.RSS14Reader=Ct,i.RSSExpandedReader=oe,i.ReaderException=Ri,i.ReedSolomonDecoder=jt,i.ReedSolomonEncoder=Po,i.ReedSolomonException=mt,i.Result=_e,i.ResultMetadataType=Xe,i.ResultPoint=ye,i.StringUtils=G,i.UnsupportedOperationException=se,i.VideoInputDevice=ge,i.WhiteRectangleDetector=bn,i.WriterException=st,i.ZXingArrays=B,i.ZXingCharset=Ya,i.ZXingInteger=R,i.ZXingStandardCharsets=Fo,i.ZXingStringBuilder=V,i.ZXingStringEncoding=j,i.ZXingSystem=P,i.createAbstractExpandedDecoder=Ua,Object.defineProperty(i,"__esModule",{value:!0})})})(wo,wo.exports);var ut=wo.exports;const Xh=rl({__proto__:null,default:Ys(ut)},[ut]);var _a=function(){function o(s,i,u){if(this.formatMap=new Map([[pe.QR_CODE,ut.BarcodeFormat.QR_CODE],[pe.AZTEC,ut.BarcodeFormat.AZTEC],[pe.CODABAR,ut.BarcodeFormat.CODABAR],[pe.CODE_39,ut.BarcodeFormat.CODE_39],[pe.CODE_93,ut.BarcodeFormat.CODE_93],[pe.CODE_128,ut.BarcodeFormat.CODE_128],[pe.DATA_MATRIX,ut.BarcodeFormat.DATA_MATRIX],[pe.MAXICODE,ut.BarcodeFormat.MAXICODE],[pe.ITF,ut.BarcodeFormat.ITF],[pe.EAN_13,ut.BarcodeFormat.EAN_13],[pe.EAN_8,ut.BarcodeFormat.EAN_8],[pe.PDF_417,ut.BarcodeFormat.PDF_417],[pe.RSS_14,ut.BarcodeFormat.RSS_14],[pe.RSS_EXPANDED,ut.BarcodeFormat.RSS_EXPANDED],[pe.UPC_A,ut.BarcodeFormat.UPC_A],[pe.UPC_E,ut.BarcodeFormat.UPC_E],[pe.UPC_EAN_EXTENSION,ut.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!Xh)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=i,this.logger=u;var f=this.createZXingFormats(s),h=new Map;h.set(ut.DecodeHintType.POSSIBLE_FORMATS,f),h.set(ut.DecodeHintType.TRY_HARDER,!1),this.hints=h}return o.prototype.decodeAsync=function(s){var i=this;return new Promise(function(u,f){try{u(i.decode(s))}catch(h){f(h)}})},o.prototype.decode=function(s){var i=new ut.MultiFormatReader(this.verbose,this.hints),u=new ut.HTMLCanvasElementLuminanceSource(s),f=new ut.BinaryBitmap(new ut.HybridBinarizer(u)),h=i.decode(f);return{text:h.text,format:pa.create(this.toHtml5QrcodeSupportedFormats(h.format)),debugData:this.createDebugData()}},o.prototype.createReverseFormatMap=function(){var s=new Map;return this.formatMap.forEach(function(i,u,f){s.set(i,u)}),s},o.prototype.toHtml5QrcodeSupportedFormats=function(s){if(!this.reverseFormatMap.has(s))throw"reverseFormatMap doesn't have ".concat(s);return this.reverseFormatMap.get(s)},o.prototype.createZXingFormats=function(s){for(var i=[],u=0,f=s;u<f.length;u++){var h=f[u];this.formatMap.has(h)?i.push(this.formatMap.get(h)):this.logger.logError("".concat(h," is not supported by")+"ZXingHtml5QrcodeShim")}return i},o.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},o}(),jh=function(o,s,i,u){function f(h){return h instanceof i?h:new i(function(m){m(h)})}return new(i||(i=Promise))(function(h,m){function x(C){try{p(u.next(C))}catch(y){m(y)}}function _(C){try{p(u.throw(C))}catch(y){m(y)}}function p(C){C.done?h(C.value):f(C.value).then(x,_)}p((u=u.apply(o,s||[])).next())})},qh=function(o,s){var i={label:0,sent:function(){if(h[0]&1)throw h[1];return h[1]},trys:[],ops:[]},u,f,h,m;return m={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function x(p){return function(C){return _([p,C])}}function _(p){if(u)throw new TypeError("Generator is already executing.");for(;m&&(m=0,p[0]&&(i=0)),i;)try{if(u=1,f&&(h=p[0]&2?f.return:p[0]?f.throw||((h=f.return)&&h.call(f),0):f.next)&&!(h=h.call(f,p[1])).done)return h;switch(f=0,h&&(p=[p[0]&2,h.value]),p[0]){case 0:case 1:h=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,f=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(h=i.trys,!(h=h.length>0&&h[h.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!h||p[1]>h[0]&&p[1]<h[3])){i.label=p[1];break}if(p[0]===6&&i.label<h[1]){i.label=h[1],h=p;break}if(h&&i.label<h[2]){i.label=h[2],i.ops.push(p);break}h[2]&&i.ops.pop(),i.trys.pop();continue}p=s.call(o,i)}catch(C){p=[6,C],f=0}finally{u=h=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},Ca=function(){function o(s,i,u){if(this.formatMap=new Map([[pe.QR_CODE,"qr_code"],[pe.AZTEC,"aztec"],[pe.CODABAR,"codabar"],[pe.CODE_39,"code_39"],[pe.CODE_93,"code_93"],[pe.CODE_128,"code_128"],[pe.DATA_MATRIX,"data_matrix"],[pe.ITF,"itf"],[pe.EAN_13,"ean_13"],[pe.EAN_8,"ean_8"],[pe.PDF_417,"pdf417"],[pe.UPC_A,"upc_a"],[pe.UPC_E,"upc_e"]]),this.reverseFormatMap=this.createReverseFormatMap(),!o.isSupported())throw"Use html5qrcode.min.js without edit, Use BarcodeDetectorDelegate only if it isSupported();";this.verbose=i,this.logger=u;var f=this.createBarcodeDetectorFormats(s);if(this.detector=new BarcodeDetector(f),!this.detector)throw"BarcodeDetector detector not supported"}return o.isSupported=function(){if(!("BarcodeDetector"in window))return!1;var s=new BarcodeDetector({formats:["qr_code"]});return typeof s<"u"},o.prototype.decodeAsync=function(s){return jh(this,void 0,void 0,function(){var i,u;return qh(this,function(f){switch(f.label){case 0:return[4,this.detector.detect(s)];case 1:if(i=f.sent(),!i||i.length===0)throw"No barcode or QR code detected.";return u=this.selectLargestBarcode(i),[2,{text:u.rawValue,format:pa.create(this.toHtml5QrcodeSupportedFormats(u.format)),debugData:this.createDebugData()}]}})})},o.prototype.selectLargestBarcode=function(s){for(var i=null,u=0,f=0,h=s;f<h.length;f++){var m=h[f],x=m.boundingBox.width*m.boundingBox.height;x>u&&(u=x,i=m)}if(!i)throw"No largest barcode found";return i},o.prototype.createBarcodeDetectorFormats=function(s){for(var i=[],u=0,f=s;u<f.length;u++){var h=f[u];this.formatMap.has(h)?i.push(this.formatMap.get(h)):this.logger.warn("".concat(h," is not supported by")+"BarcodeDetectorDelegate")}return{formats:i}},o.prototype.toHtml5QrcodeSupportedFormats=function(s){if(!this.reverseFormatMap.has(s))throw"reverseFormatMap doesn't have ".concat(s);return this.reverseFormatMap.get(s)},o.prototype.createReverseFormatMap=function(){var s=new Map;return this.formatMap.forEach(function(i,u,f){s.set(i,u)}),s},o.prototype.createDebugData=function(){return{decoderName:"BarcodeDetector"}},o}(),Ea=function(o,s,i,u){function f(h){return h instanceof i?h:new i(function(m){m(h)})}return new(i||(i=Promise))(function(h,m){function x(C){try{p(u.next(C))}catch(y){m(y)}}function _(C){try{p(u.throw(C))}catch(y){m(y)}}function p(C){C.done?h(C.value):f(C.value).then(x,_)}p((u=u.apply(o,s||[])).next())})},ya=function(o,s){var i={label:0,sent:function(){if(h[0]&1)throw h[1];return h[1]},trys:[],ops:[]},u,f,h,m;return m={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function x(p){return function(C){return _([p,C])}}function _(p){if(u)throw new TypeError("Generator is already executing.");for(;m&&(m=0,p[0]&&(i=0)),i;)try{if(u=1,f&&(h=p[0]&2?f.return:p[0]?f.throw||((h=f.return)&&h.call(f),0):f.next)&&!(h=h.call(f,p[1])).done)return h;switch(f=0,h&&(p=[p[0]&2,h.value]),p[0]){case 0:case 1:h=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,f=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(h=i.trys,!(h=h.length>0&&h[h.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!h||p[1]>h[0]&&p[1]<h[3])){i.label=p[1];break}if(p[0]===6&&i.label<h[1]){i.label=h[1],h=p;break}if(h&&i.label<h[2]){i.label=h[2],i.ops.push(p);break}h[2]&&i.ops.pop(),i.trys.pop();continue}p=s.call(o,i)}catch(C){p=[6,C],f=0}finally{u=h=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},Zh=function(){function o(s,i,u,f){this.EXECUTIONS_TO_REPORT_PERFORMANCE=100,this.executions=0,this.executionResults=[],this.wasPrimaryDecoderUsedInLastDecode=!1,this.verbose=u,i&&Ca.isSupported()?(this.primaryDecoder=new Ca(s,u,f),this.secondaryDecoder=new _a(s,u,f)):this.primaryDecoder=new _a(s,u,f)}return o.prototype.decodeAsync=function(s){return Ea(this,void 0,void 0,function(){var i;return ya(this,function(u){switch(u.label){case 0:i=performance.now(),u.label=1;case 1:return u.trys.push([1,,3,4]),[4,this.getDecoder().decodeAsync(s)];case 2:return[2,u.sent()];case 3:return this.possiblyLogPerformance(i),[7];case 4:return[2]}})})},o.prototype.decodeRobustlyAsync=function(s){return Ea(this,void 0,void 0,function(){var i,u;return ya(this,function(f){switch(f.label){case 0:i=performance.now(),f.label=1;case 1:return f.trys.push([1,3,4,5]),[4,this.primaryDecoder.decodeAsync(s)];case 2:return[2,f.sent()];case 3:if(u=f.sent(),this.secondaryDecoder)return[2,this.secondaryDecoder.decodeAsync(s)];throw u;case 4:return this.possiblyLogPerformance(i),[7];case 5:return[2]}})})},o.prototype.getDecoder=function(){return this.secondaryDecoder?this.wasPrimaryDecoderUsedInLastDecode===!1?(this.wasPrimaryDecoderUsedInLastDecode=!0,this.primaryDecoder):(this.wasPrimaryDecoderUsedInLastDecode=!1,this.secondaryDecoder):this.primaryDecoder},o.prototype.possiblyLogPerformance=function(s){if(this.verbose){var i=performance.now()-s;this.executionResults.push(i),this.executions++,this.possiblyFlushPerformanceReport()}},o.prototype.possiblyFlushPerformanceReport=function(){if(!(this.executions<this.EXECUTIONS_TO_REPORT_PERFORMANCE)){for(var s=0,i=0,u=this.executionResults;i<u.length;i++){var f=u[i];s+=f}var h=s/this.executionResults.length;console.log("".concat(h," ms for ").concat(this.executionResults.length," last runs.")),this.executions=0,this.executionResults=[]}},o}(),_o=function(){var o=function(s,i){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,f){u.__proto__=f}||function(u,f){for(var h in f)Object.prototype.hasOwnProperty.call(f,h)&&(u[h]=f[h])},o(s,i)};return function(s,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");o(s,i);function u(){this.constructor=s}s.prototype=i===null?Object.create(i):(u.prototype=i.prototype,new u)}}(),wi=function(o,s,i,u){function f(h){return h instanceof i?h:new i(function(m){m(h)})}return new(i||(i=Promise))(function(h,m){function x(C){try{p(u.next(C))}catch(y){m(y)}}function _(C){try{p(u.throw(C))}catch(y){m(y)}}function p(C){C.done?h(C.value):f(C.value).then(x,_)}p((u=u.apply(o,s||[])).next())})},_i=function(o,s){var i={label:0,sent:function(){if(h[0]&1)throw h[1];return h[1]},trys:[],ops:[]},u,f,h,m;return m={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function x(p){return function(C){return _([p,C])}}function _(p){if(u)throw new TypeError("Generator is already executing.");for(;m&&(m=0,p[0]&&(i=0)),i;)try{if(u=1,f&&(h=p[0]&2?f.return:p[0]?f.throw||((h=f.return)&&h.call(f),0):f.next)&&!(h=h.call(f,p[1])).done)return h;switch(f=0,h&&(p=[p[0]&2,h.value]),p[0]){case 0:case 1:h=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,f=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(h=i.trys,!(h=h.length>0&&h[h.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!h||p[1]>h[0]&&p[1]<h[3])){i.label=p[1];break}if(p[0]===6&&i.label<h[1]){i.label=h[1],h=p;break}if(h&&i.label<h[2]){i.label=h[2],i.ops.push(p);break}h[2]&&i.ops.pop(),i.trys.pop();continue}p=s.call(o,i)}catch(C){p=[6,C],f=0}finally{u=h=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},ba=function(){function o(s,i){this.name=s,this.track=i}return o.prototype.isSupported=function(){return this.track.getCapabilities?this.name in this.track.getCapabilities():!1},o.prototype.apply=function(s){var i={};i[this.name]=s;var u={advanced:[i]};return this.track.applyConstraints(u)},o.prototype.value=function(){var s=this.track.getSettings();if(this.name in s){var i=s[this.name];return i}return null},o}(),Yh=function(o){_o(s,o);function s(i,u){return o.call(this,i,u)||this}return s.prototype.min=function(){return this.getCapabilities().min},s.prototype.max=function(){return this.getCapabilities().max},s.prototype.step=function(){return this.getCapabilities().step},s.prototype.apply=function(i){var u={};u[this.name]=i;var f={advanced:[u]};return this.track.applyConstraints(f)},s.prototype.getCapabilities=function(){this.failIfNotSupported();var i=this.track.getCapabilities(),u=i[this.name];return{min:u.min,max:u.max,step:u.step}},s.prototype.failIfNotSupported=function(){if(!this.isSupported())throw new Error("".concat(this.name," capability not supported"))},s}(ba),$h=function(o){_o(s,o);function s(i){return o.call(this,"zoom",i)||this}return s}(Yh),Kh=function(o){_o(s,o);function s(i){return o.call(this,"torch",i)||this}return s}(ba),Qh=function(){function o(s){this.track=s}return o.prototype.zoomFeature=function(){return new $h(this.track)},o.prototype.torchFeature=function(){return new Kh(this.track)},o}(),Jh=function(){function o(s,i,u){this.isClosed=!1,this.parentElement=s,this.mediaStream=i,this.callbacks=u,this.surface=this.createVideoElement(this.parentElement.clientWidth),s.append(this.surface)}return o.prototype.createVideoElement=function(s){var i=document.createElement("video");return i.style.width="".concat(s,"px"),i.style.display="block",i.muted=!0,i.setAttribute("muted","true"),i.playsInline=!0,i},o.prototype.setupSurface=function(){var s=this;this.surface.onabort=function(){throw"RenderedCameraImpl video surface onabort() called"},this.surface.onerror=function(){throw"RenderedCameraImpl video surface onerror() called"};var i=function(){var u=s.surface.clientWidth,f=s.surface.clientHeight;s.callbacks.onRenderSurfaceReady(u,f),s.surface.removeEventListener("playing",i)};this.surface.addEventListener("playing",i),this.surface.srcObject=this.mediaStream,this.surface.play()},o.create=function(s,i,u,f){return wi(this,void 0,void 0,function(){var h,m;return _i(this,function(x){switch(x.label){case 0:return h=new o(s,i,f),u.aspectRatio?(m={aspectRatio:u.aspectRatio},[4,h.getFirstTrackOrFail().applyConstraints(m)]):[3,2];case 1:x.sent(),x.label=2;case 2:return h.setupSurface(),[2,h]}})})},o.prototype.failIfClosed=function(){if(this.isClosed)throw"The RenderedCamera has already been closed."},o.prototype.getFirstTrackOrFail=function(){if(this.failIfClosed(),this.mediaStream.getVideoTracks().length===0)throw"No video tracks found";return this.mediaStream.getVideoTracks()[0]},o.prototype.pause=function(){this.failIfClosed(),this.surface.pause()},o.prototype.resume=function(s){this.failIfClosed();var i=this,u=function(){setTimeout(s,200),i.surface.removeEventListener("playing",u)};this.surface.addEventListener("playing",u),this.surface.play()},o.prototype.isPaused=function(){return this.failIfClosed(),this.surface.paused},o.prototype.getSurface=function(){return this.failIfClosed(),this.surface},o.prototype.getRunningTrackCapabilities=function(){return this.getFirstTrackOrFail().getCapabilities()},o.prototype.getRunningTrackSettings=function(){return this.getFirstTrackOrFail().getSettings()},o.prototype.applyVideoConstraints=function(s){return wi(this,void 0,void 0,function(){return _i(this,function(i){if("aspectRatio"in s)throw"Changing 'aspectRatio' in run-time is not yet supported.";return[2,this.getFirstTrackOrFail().applyConstraints(s)]})})},o.prototype.close=function(){if(this.isClosed)return Promise.resolve();var s=this;return new Promise(function(i,u){var f=s.mediaStream.getVideoTracks(),h=f.length,m=0;s.mediaStream.getVideoTracks().forEach(function(x){s.mediaStream.removeTrack(x),x.stop(),++m,m>=h&&(s.isClosed=!0,s.parentElement.removeChild(s.surface),i())})})},o.prototype.getCapabilities=function(){return new Qh(this.getFirstTrackOrFail())},o}(),e2=function(){function o(s){this.mediaStream=s}return o.prototype.render=function(s,i,u){return wi(this,void 0,void 0,function(){return _i(this,function(f){return[2,Jh.create(s,this.mediaStream,i,u)]})})},o.create=function(s){return wi(this,void 0,void 0,function(){var i,u;return _i(this,function(f){switch(f.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return i={audio:!1,video:s},[4,navigator.mediaDevices.getUserMedia(i)];case 1:return u=f.sent(),[2,new o(u)]}})})},o}(),Aa=function(o,s,i,u){function f(h){return h instanceof i?h:new i(function(m){m(h)})}return new(i||(i=Promise))(function(h,m){function x(C){try{p(u.next(C))}catch(y){m(y)}}function _(C){try{p(u.throw(C))}catch(y){m(y)}}function p(C){C.done?h(C.value):f(C.value).then(x,_)}p((u=u.apply(o,s||[])).next())})},Ia=function(o,s){var i={label:0,sent:function(){if(h[0]&1)throw h[1];return h[1]},trys:[],ops:[]},u,f,h,m;return m={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function x(p){return function(C){return _([p,C])}}function _(p){if(u)throw new TypeError("Generator is already executing.");for(;m&&(m=0,p[0]&&(i=0)),i;)try{if(u=1,f&&(h=p[0]&2?f.return:p[0]?f.throw||((h=f.return)&&h.call(f),0):f.next)&&!(h=h.call(f,p[1])).done)return h;switch(f=0,h&&(p=[p[0]&2,h.value]),p[0]){case 0:case 1:h=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,f=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(h=i.trys,!(h=h.length>0&&h[h.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!h||p[1]>h[0]&&p[1]<h[3])){i.label=p[1];break}if(p[0]===6&&i.label<h[1]){i.label=h[1],h=p;break}if(h&&i.label<h[2]){i.label=h[2],i.ops.push(p);break}h[2]&&i.ops.pop(),i.trys.pop();continue}p=s.call(o,i)}catch(C){p=[6,C],f=0}finally{u=h=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},t2=function(){function o(){}return o.failIfNotSupported=function(){return Aa(this,void 0,void 0,function(){return Ia(this,function(s){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new o]})})},o.prototype.create=function(s){return Aa(this,void 0,void 0,function(){return Ia(this,function(i){return[2,e2.create(s)]})})},o}(),n2=function(o,s,i,u){function f(h){return h instanceof i?h:new i(function(m){m(h)})}return new(i||(i=Promise))(function(h,m){function x(C){try{p(u.next(C))}catch(y){m(y)}}function _(C){try{p(u.throw(C))}catch(y){m(y)}}function p(C){C.done?h(C.value):f(C.value).then(x,_)}p((u=u.apply(o,s||[])).next())})},r2=function(o,s){var i={label:0,sent:function(){if(h[0]&1)throw h[1];return h[1]},trys:[],ops:[]},u,f,h,m;return m={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function x(p){return function(C){return _([p,C])}}function _(p){if(u)throw new TypeError("Generator is already executing.");for(;m&&(m=0,p[0]&&(i=0)),i;)try{if(u=1,f&&(h=p[0]&2?f.return:p[0]?f.throw||((h=f.return)&&h.call(f),0):f.next)&&!(h=h.call(f,p[1])).done)return h;switch(f=0,h&&(p=[p[0]&2,h.value]),p[0]){case 0:case 1:h=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,f=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(h=i.trys,!(h=h.length>0&&h[h.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!h||p[1]>h[0]&&p[1]<h[3])){i.label=p[1];break}if(p[0]===6&&i.label<h[1]){i.label=h[1],h=p;break}if(h&&i.label<h[2]){i.label=h[2],i.ops.push(p);break}h[2]&&i.ops.pop(),i.trys.pop();continue}p=s.call(o,i)}catch(C){p=[6,C],f=0}finally{u=h=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},i2=function(){function o(){}return o.retrieve=function(){if(navigator.mediaDevices)return o.getCamerasFromMediaDevices();var s=MediaStreamTrack;return MediaStreamTrack&&s.getSources?o.getCamerasFromMediaStreamTrack():o.rejectWithError()},o.rejectWithError=function(){var s=wr.unableToQuerySupportedDevices();return o.isHttpsOrLocalhost()||(s=wr.insecureContextCameraQueryError()),Promise.reject(s)},o.isHttpsOrLocalhost=function(){if(location.protocol==="https:")return!0;var s=location.host.split(":")[0];return s==="127.0.0.1"||s==="localhost"},o.getCamerasFromMediaDevices=function(){return n2(this,void 0,void 0,function(){var s,i,u,f,h,m,x;return r2(this,function(_){switch(_.label){case 0:return s=function(p){for(var C=p.getVideoTracks(),y=0,S=C;y<S.length;y++){var M=S[y];M.enabled=!1,M.stop(),p.removeTrack(M)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return i=_.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(u=_.sent(),f=[],h=0,m=u;h<m.length;h++)x=m[h],x.kind==="videoinput"&&f.push({id:x.deviceId,label:x.label});return s(i),[2,f]}})})},o.getCamerasFromMediaStreamTrack=function(){return new Promise(function(s,i){var u=function(h){for(var m=[],x=0,_=h;x<_.length;x++){var p=_[x];p.kind==="video"&&m.push({id:p.id,label:p.label})}s(m)},f=MediaStreamTrack;f.getSources(u)})},o}(),_t;(function(o){o[o.UNKNOWN=0]="UNKNOWN",o[o.NOT_STARTED=1]="NOT_STARTED",o[o.SCANNING=2]="SCANNING",o[o.PAUSED=3]="PAUSED"})(_t||(_t={}));var o2=function(){function o(){this.state=_t.NOT_STARTED,this.onGoingTransactionNewState=_t.UNKNOWN}return o.prototype.directTransition=function(s){this.failIfTransitionOngoing(),this.validateTransition(s),this.state=s},o.prototype.startTransition=function(s){return this.failIfTransitionOngoing(),this.validateTransition(s),this.onGoingTransactionNewState=s,this},o.prototype.execute=function(){if(this.onGoingTransactionNewState===_t.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var s=this.onGoingTransactionNewState;this.onGoingTransactionNewState=_t.UNKNOWN,this.directTransition(s)},o.prototype.cancel=function(){if(this.onGoingTransactionNewState===_t.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=_t.UNKNOWN},o.prototype.getState=function(){return this.state},o.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==_t.UNKNOWN)throw"Cannot transition to a new state, already under transition"},o.prototype.validateTransition=function(s){switch(this.state){case _t.UNKNOWN:throw"Transition from unknown is not allowed";case _t.NOT_STARTED:this.failIfNewStateIs(s,[_t.PAUSED]);break;case _t.SCANNING:break;case _t.PAUSED:break}},o.prototype.failIfNewStateIs=function(s,i){for(var u=0,f=i;u<f.length;u++){var h=f[u];if(s===h)throw"Cannot transition from ".concat(this.state," to ").concat(s)}},o}(),s2=function(){function o(s){this.stateManager=s}return o.prototype.startTransition=function(s){return this.stateManager.startTransition(s)},o.prototype.directTransition=function(s){this.stateManager.directTransition(s)},o.prototype.getState=function(){return this.stateManager.getState()},o.prototype.canScanFile=function(){return this.stateManager.getState()===_t.NOT_STARTED},o.prototype.isScanning=function(){return this.stateManager.getState()!==_t.NOT_STARTED},o.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===_t.SCANNING},o.prototype.isPaused=function(){return this.stateManager.getState()===_t.PAUSED},o}(),a2=function(){function o(){}return o.create=function(){return new s2(new o2)},o}(),l2=function(){var o=function(s,i){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,f){u.__proto__=f}||function(u,f){for(var h in f)Object.prototype.hasOwnProperty.call(f,h)&&(u[h]=f[h])},o(s,i)};return function(s,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");o(s,i);function u(){this.constructor=s}s.prototype=i===null?Object.create(i):(u.prototype=i.prototype,new u)}}(),an=function(o){l2(s,o);function s(){return o!==null&&o.apply(this,arguments)||this}return s.DEFAULT_WIDTH=300,s.DEFAULT_WIDTH_OFFSET=2,s.FILE_SCAN_MIN_HEIGHT=300,s.FILE_SCAN_HIDDEN_CANVAS_PADDING=100,s.MIN_QR_BOX_SIZE=50,s.SHADED_LEFT=1,s.SHADED_RIGHT=2,s.SHADED_TOP=3,s.SHADED_BOTTOM=4,s.SHADED_REGION_ELEMENT_ID="qr-shaded-region",s.VERBOSE=!1,s.BORDER_SHADER_DEFAULT_COLOR="#ffffff",s.BORDER_SHADER_MATCH_COLOR="rgb(90, 193, 56)",s}(Hh),c2=function(){function o(s,i){this.logger=i,this.fps=an.SCAN_DEFAULT_FPS,s?(s.fps&&(this.fps=s.fps),this.disableFlip=s.disableFlip===!0,this.qrbox=s.qrbox,this.aspectRatio=s.aspectRatio,this.videoConstraints=s.videoConstraints):this.disableFlip=an.DEFAULT_DISABLE_FLIP}return o.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?wa.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},o.prototype.isShadedBoxEnabled=function(){return!Vn(this.qrbox)},o.create=function(s,i){return new o(s,i)},o}(),Sa=function(){function o(s,i){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(s))throw"HTML Element with id=".concat(s," not found");this.elementId=s,this.verbose=!1;var u;typeof i=="boolean"?this.verbose=i===!0:i&&(u=i,this.verbose=u.verbose===!0,u.experimentalFeatures),this.logger=new Wh(this.verbose),this.qrcode=new Zh(this.getSupportedFormats(i),this.getUseBarCodeDetectorIfSupported(u),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=a2.create()}return o.prototype.start=function(s,i,u,f){var h=this;if(!s)throw"cameraIdOrConfig is required";if(!u||typeof u!="function")throw"qrCodeSuccessCallback is required and should be a function.";var m;f?m=f:m=this.verbose?this.logger.log:function(){};var x=c2.create(i,this.logger);this.clearElement();var _=!1;x.videoConstraints&&(x.isMediaStreamConstraintsValid()?_=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var p=_,C=document.getElementById(this.elementId);C.clientWidth?C.clientWidth:an.DEFAULT_WIDTH,C.style.position="relative",this.shouldScan=!0,this.element=C;var y=this,S=this.stateManagerProxy.startTransition(_t.SCANNING);return new Promise(function(M,k){var P=p?x.videoConstraints:y.createVideoConstraints(s);if(!P){S.cancel(),k("videoConstraints should be defined");return}var v={};(!p||x.aspectRatio)&&(v.aspectRatio=x.aspectRatio);var U={onRenderSurfaceReady:function(B,R){y.setupUi(B,R,x),y.isScanning=!0,y.foreverScan(x,u,m)}};t2.failIfNotSupported().then(function(B){B.create(P).then(function(R){return R.render(h.element,v,U).then(function(D){y.renderedCamera=D,S.execute(),M(null)}).catch(function(D){S.cancel(),k(D)})}).catch(function(R){S.cancel(),k(wr.errorGettingUserMedia(R))})}).catch(function(B){S.cancel(),k(wr.cameraStreamingNotSupported())})})},o.prototype.pause=function(s){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(_t.PAUSED),this.showPausedState(),(Vn(s)||s!==!0)&&(s=!1),s&&this.renderedCamera&&this.renderedCamera.pause()},o.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 s=this,i=function(){s.stateManagerProxy.directTransition(_t.SCANNING),s.hidePausedState()};if(!this.renderedCamera.isPaused()){i();return}this.renderedCamera.resume(function(){i()})},o.prototype.getState=function(){return this.stateManagerProxy.getState()},o.prototype.stop=function(){var s=this;if(!this.stateManagerProxy.isScanning())throw"Cannot stop, scanner is not running or paused.";var i=this.stateManagerProxy.startTransition(_t.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var u=function(){if(s.element){var h=document.getElementById(an.SHADED_REGION_ELEMENT_ID);h&&s.element.removeChild(h)}},f=this;return this.renderedCamera.close().then(function(){return f.renderedCamera=null,f.element&&(f.element.removeChild(f.canvasElement),f.canvasElement=null),u(),f.qrRegion&&(f.qrRegion=null),f.context&&(f.context=null),i.execute(),f.hidePausedState(),f.isScanning=!1,Promise.resolve()})},o.prototype.scanFile=function(s,i){return this.scanFileV2(s,i).then(function(u){return u.decodedText})},o.prototype.scanFileV2=function(s,i){var u=this;if(!s||!(s instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(Vn(i)&&(i=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(f,h){u.possiblyCloseLastScanImageFile(),u.clearElement(),u.lastScanImageFile=URL.createObjectURL(s);var m=new Image;m.onload=function(){var x=m.width,_=m.height,p=document.getElementById(u.elementId),C=p.clientWidth?p.clientWidth:an.DEFAULT_WIDTH,y=Math.max(p.clientHeight?p.clientHeight:_,an.FILE_SCAN_MIN_HEIGHT),S=u.computeCanvasDrawConfig(x,_,C,y);if(i){var M=u.createCanvasElement(C,y,"qr-canvas-visible");M.style.display="inline-block",p.appendChild(M);var k=M.getContext("2d");if(!k)throw"Unable to get 2d context from canvas";k.canvas.width=C,k.canvas.height=y,k.drawImage(m,0,0,x,_,S.x,S.y,S.width,S.height)}var P=an.FILE_SCAN_HIDDEN_CANVAS_PADDING,v=Math.max(m.width,S.width),U=Math.max(m.height,S.height),B=v+2*P,R=U+2*P,D=u.createCanvasElement(B,R);p.appendChild(D);var K=D.getContext("2d");if(!K)throw"Unable to get 2d context from canvas";K.canvas.width=B,K.canvas.height=R,K.drawImage(m,0,0,x,_,P,P,v,U);try{u.qrcode.decodeRobustlyAsync(D).then(function(te){f(xa.createFromQrcodeResult(te))}).catch(h)}catch(te){h("QR code parse error, error = ".concat(te))}},m.onerror=h,m.onabort=h,m.onstalled=h,m.onsuspend=h,m.src=URL.createObjectURL(s)})},o.prototype.clear=function(){this.clearElement()},o.getCameras=function(){return i2.retrieve()},o.prototype.getRunningTrackCapabilities=function(){return this.getRenderedCameraOrFail().getRunningTrackCapabilities()},o.prototype.getRunningTrackSettings=function(){return this.getRenderedCameraOrFail().getRunningTrackSettings()},o.prototype.getRunningTrackCameraCapabilities=function(){return this.getRenderedCameraOrFail().getCapabilities()},o.prototype.applyVideoConstraints=function(s){if(s){if(!wa.isMediaStreamConstraintsValid(s,this.logger))throw"invalid videoConstaints passed, check logs for more details"}else throw"videoConstaints is required argument.";return this.getRenderedCameraOrFail().applyVideoConstraints(s)},o.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},o.prototype.getSupportedFormats=function(s){var i=[pe.QR_CODE,pe.AZTEC,pe.CODABAR,pe.CODE_39,pe.CODE_93,pe.CODE_128,pe.DATA_MATRIX,pe.MAXICODE,pe.ITF,pe.EAN_13,pe.EAN_8,pe.PDF_417,pe.RSS_14,pe.RSS_EXPANDED,pe.UPC_A,pe.UPC_E,pe.UPC_EAN_EXTENSION];if(!s||typeof s=="boolean"||!s.formatsToSupport)return i;if(!Array.isArray(s.formatsToSupport))throw"configOrVerbosityFlag.formatsToSupport should be undefined or an array.";if(s.formatsToSupport.length===0)throw"Atleast 1 formatsToSupport is needed.";for(var u=[],f=0,h=s.formatsToSupport;f<h.length;f++){var m=h[f];zh(m)?u.push(m):this.logger.warn("Invalid format: ".concat(m," passed in config, ignoring."))}if(u.length===0)throw"None of formatsToSupport match supported values.";return u},o.prototype.getUseBarCodeDetectorIfSupported=function(s){if(Vn(s))return!0;if(!Vn(s.useBarCodeDetectorIfSupported))return s.useBarCodeDetectorIfSupported!==!1;if(Vn(s.experimentalFeatures))return!0;var i=s.experimentalFeatures;return Vn(i.useBarCodeDetectorIfSupported)?!0:i.useBarCodeDetectorIfSupported!==!1},o.prototype.validateQrboxSize=function(s,i,u){var f=this,h=u.qrbox;this.validateQrboxConfig(h);var m=this.toQrdimensions(s,i,h),x=function(p){if(p<an.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(an.MIN_QR_BOX_SIZE,"px.")},_=function(p){return p>s&&(f.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."),p=s),p};x(m.width),x(m.height),m.width=_(m.width)},o.prototype.validateQrboxConfig=function(s){if(typeof s!="number"&&typeof s!="function"&&(s.width===void 0||s.height===void 0))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},o.prototype.toQrdimensions=function(s,i,u){if(typeof u=="number")return{width:u,height:u};if(typeof u=="function")try{return u(s,i)}catch(f){throw new Error("qrbox config was passed as a function but it failed with unknown error"+f)}return u},o.prototype.setupUi=function(s,i,u){u.isShadedBoxEnabled()&&this.validateQrboxSize(s,i,u);var f=Vn(u.qrbox)?{width:s,height:i}:u.qrbox;this.validateQrboxConfig(f);var h=this.toQrdimensions(s,i,f);h.height>i&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var m=u.isShadedBoxEnabled()&&h.height<=i,x={x:0,y:0,width:s,height:i},_=m?this.getShadedRegionBounds(s,i,h):x,p=this.createCanvasElement(_.width,_.height),C={willReadFrequently:!0},y=p.getContext("2d",C);y.canvas.width=_.width,y.canvas.height=_.height,this.element.append(p),m&&this.possiblyInsertShadingElement(this.element,s,i,h),this.createScannerPausedUiElement(this.element),this.qrRegion=_,this.context=y,this.canvasElement=p},o.prototype.createScannerPausedUiElement=function(s){var i=document.createElement("div");i.innerText=wr.scannerPaused(),i.style.display="none",i.style.position="absolute",i.style.top="0px",i.style.zIndex="1",i.style.background="rgba(9, 9, 9, 0.46)",i.style.color="#FFECEC",i.style.textAlign="center",i.style.width="100%",s.appendChild(i),this.scannerPausedUiElement=i},o.prototype.scanContext=function(s,i){var u=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(f){return s(f.text,xa.createFromQrcodeResult(f)),u.possiblyUpdateShaders(!0),!0}).catch(function(f){u.possiblyUpdateShaders(!1);var h=wr.codeParseError(f);return i(h,Gh.createFrom(h)),!1})},o.prototype.foreverScan=function(s,i,u){var f=this;if(this.shouldScan&&this.renderedCamera){var h=this.renderedCamera.getSurface(),m=h.videoWidth/h.clientWidth,x=h.videoHeight/h.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var _=this.qrRegion.width*m,p=this.qrRegion.height*x,C=this.qrRegion.x*m,y=this.qrRegion.y*x;this.context.drawImage(h,C,y,_,p,0,0,this.qrRegion.width,this.qrRegion.height);var S=function(){f.foreverScanTimeout=setTimeout(function(){f.foreverScan(s,i,u)},f.getTimeoutFps(s.fps))};this.scanContext(i,u).then(function(M){!M&&s.disableFlip!==!0?(f.context.translate(f.context.canvas.width,0),f.context.scale(-1,1),f.scanContext(i,u).finally(function(){S()})):S()}).catch(function(M){f.logger.logError("Error happend while scanning context",M),S()})}},o.prototype.createVideoConstraints=function(s){if(typeof s=="string")return{deviceId:{exact:s}};if(typeof s=="object"){var i="facingMode",u="deviceId",f={user:!0,environment:!0},h="exact",m=function(k){if(k in f)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(k,"'")},x=Object.keys(s);if(x.length!==1)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(x.length," keys");var _=Object.keys(s)[0];if(_!==i&&_!==u)throw"Only '".concat(i,"' and '").concat(u,"' ")+" are supported for 'cameraIdOrConfig'";if(_===i){var p=s.facingMode;if(typeof p=="string"){if(m(p))return{facingMode:p}}else if(typeof p=="object")if(h in p){if(m(p["".concat(h)]))return{facingMode:{exact:p["".concat(h)]}}}else throw"'facingMode' should be string or object with"+" ".concat(h," as key.");else{var C=typeof p;throw"Invalid type of 'facingMode' = ".concat(C)}}else{var y=s.deviceId;if(typeof y=="string")return{deviceId:y};if(typeof y=="object"){if(h in y)return{deviceId:{exact:y["".concat(h)]}};throw"'deviceId' should be string or object with"+" ".concat(h," as key.")}else{var S=typeof y;throw"Invalid type of 'deviceId' = ".concat(S)}}}var M=typeof s;throw"Invalid type of 'cameraIdOrConfig' = ".concat(M)},o.prototype.computeCanvasDrawConfig=function(s,i,u,f){if(s<=u&&i<=f){var h=(u-s)/2,m=(f-i)/2;return{x:h,y:m,width:s,height:i}}else{var x=s,_=i;return s>u&&(i=u/s*i,s=u),i>f&&(s=f/i*s,i=f),this.logger.log("Image downsampled from "+"".concat(x,"X").concat(_)+" to ".concat(s,"X").concat(i,".")),this.computeCanvasDrawConfig(s,i,u,f)}},o.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var s=document.getElementById(this.elementId);s&&(s.innerHTML="")},o.prototype.possiblyUpdateShaders=function(s){this.qrMatch!==s&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(i){i.style.backgroundColor=s?an.BORDER_SHADER_MATCH_COLOR:an.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=s)},o.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},o.prototype.createCanvasElement=function(s,i,u){var f=s,h=i,m=document.createElement("canvas");return m.style.width="".concat(f,"px"),m.style.height="".concat(h,"px"),m.style.display="none",m.id=Vn(u)?"qr-canvas":u,m},o.prototype.getShadedRegionBounds=function(s,i,u){if(u.width>s||u.height>i)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(s-u.width)/2,y:(i-u.height)/2,width:u.width,height:u.height}},o.prototype.possiblyInsertShadingElement=function(s,i,u,f){if(!(i-f.width<1||u-f.height<1)){var h=document.createElement("div");h.style.position="absolute";var m=(i-f.width)/2,x=(u-f.height)/2;if(h.style.borderLeft="".concat(m,"px solid rgba(0, 0, 0, 0.48)"),h.style.borderRight="".concat(m,"px solid rgba(0, 0, 0, 0.48)"),h.style.borderTop="".concat(x,"px solid rgba(0, 0, 0, 0.48)"),h.style.borderBottom="".concat(x,"px solid rgba(0, 0, 0, 0.48)"),h.style.boxSizing="border-box",h.style.top="0px",h.style.bottom="0px",h.style.left="0px",h.style.right="0px",h.id="".concat(an.SHADED_REGION_ELEMENT_ID),i-f.width<11||u-f.height<11)this.hasBorderShaders=!1;else{var _=5,p=40;this.insertShaderBorders(h,p,_,-_,null,0,!0),this.insertShaderBorders(h,p,_,-_,null,0,!1),this.insertShaderBorders(h,p,_,null,-_,0,!0),this.insertShaderBorders(h,p,_,null,-_,0,!1),this.insertShaderBorders(h,_,p+_,-_,null,-_,!0),this.insertShaderBorders(h,_,p+_,null,-_,-_,!0),this.insertShaderBorders(h,_,p+_,-_,null,-_,!1),this.insertShaderBorders(h,_,p+_,null,-_,-_,!1),this.hasBorderShaders=!0}s.append(h)}},o.prototype.insertShaderBorders=function(s,i,u,f,h,m,x){var _=document.createElement("div");_.style.position="absolute",_.style.backgroundColor=an.BORDER_SHADER_DEFAULT_COLOR,_.style.width="".concat(i,"px"),_.style.height="".concat(u,"px"),f!==null&&(_.style.top="".concat(f,"px")),h!==null&&(_.style.bottom="".concat(h,"px")),x?_.style.left="".concat(m,"px"):_.style.right="".concat(m,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(_),s.appendChild(_)},o.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},o.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},o.prototype.getTimeoutFps=function(s){return 1e3/s},o}(),Na;(function(o){o[o.STATUS_DEFAULT=0]="STATUS_DEFAULT",o[o.STATUS_SUCCESS=1]="STATUS_SUCCESS",o[o.STATUS_WARNING=2]="STATUS_WARNING",o[o.STATUS_REQUESTING_PERMISSION=3]="STATUS_REQUESTING_PERMISSION"})(Na||(Na={}));const u2={width:"38",height:"38",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"none"},d2=["stroke"],f2=["stroke"],h2=["stroke"],g2=["stroke"],m2=["stroke"],p2=l.defineComponent({__name:"QR",props:{color:{type:String,required:!1,default:"#FFFFFF"}},setup(o){return(s,i)=>(l.openBlock(),l.createElementBlock("svg",u2,[l.createElementVNode("path",{d:"M11 11H7V7h4ZM17 7h-2v2h2ZM13 17h4v-4h-4ZM7 17h2v-2H7Z",stroke:o.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,d2),l.createElementVNode("path",{d:"M8 3H4a1 1 0 0 0-1 1V8",stroke:o.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,f2),l.createElementVNode("path",{d:"M21 8V4a1 1 0 0 0-1-1H16",stroke:o.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,h2),l.createElementVNode("path",{d:"M3 16v4a1 1 0 0 0 1 1H8",stroke:o.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,g2),l.createElementVNode("path",{d:"M16 21h4a1 1 0 0 0 1-1V16",stroke:o.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,m2)]))}}),Co={back:["Задняя","Задней","Зад","e pasme","rear","back","atzekoa","задні","отзад","pozadi","cefn","hátulsó","traseira","achterkant","όπισθεν","bag","דערציען","cúil","aftan","trasero","posteriore","posterior","aizmugure","galinis","задниот дел","wara","hinteren","bak","tył","tyl","traseira","spate","задњи","zadný","zadaj","задній","takaosa","arrière","straga","zadní","bak","tagumine","environment","arxa","թիկունք","পিছনে","နောက်ဘက်","ở phía sau","უკანა","પાછળ","артқы","ಹಿಂದಿನ","後部","后部","뒤쪽","ខាងក្រោយ","ຫລັງ","പുറകിലുള്ള","मागील","арын","पछाडि","පසුපස","пушти","หลัง","பின்புறம்","వెనుక","arka","orqa","پیچھے","पिछला","qab","後方","مؤخرة","חלק אחורי","عقب","agter","ngemuva","azụ","leyin","kamorao","gadaale","nyuma","baya","kumbuyo","belakang","aoriana","belakang","muri","luyo","likuran","mburi","dèyè","tergo","malantaŭo"],front:["FaceTime","Передняя","përpara","front","aurrean","пярэдні","отпред","front","blaen","elülső","diante","voorkant","εμπρός","foran","פראָנט","tosaigh","framan","frente","davanti","davant","priekšā","priekyje","напред","quddiem","Vorderseite","front","przód","frente","față","фронт","vpredu","spredaj","перед","edessä","devant","ispred","přední","främre","ees","ön","ճակատ","সামনে","ရှေ့","đằng trước","წინა","આગળ","алдыңғы","ಮುಂಭಾಗ","正面","正面","앞쪽","ខាងមុខ","ດ້ານໜ້າ","മുന്നിൽ","समोर","урд","अगाडि","ඉදිරිපස","пеш","ด้านหน้า","முன்","ముందు","ön","old","سامنے","सामने","pem hauv ntej","フロント","أمام","חֲזִית","جلو","voor","ngaphambili","n'ihu","iwaju","ka pele","hore","mbele","gaba","kutsogolo","depan","anoloana","hadapan","mua","atubangan","harap","ngarep","devan","front","fronto"]},x2={key:0,class:"qr_text"},w2=l.defineComponent({__name:"QrCameraScanner",props:{axiosInstanceGet:{type:[Function,Object]},is_toggleAffiliation:{type:Boolean},is_notification:{type:Boolean},notificationData:{},tableData:{},isQr:{type:[Boolean,null]},takeDataTable:{type:Function}},emits:["update:tableData","update:notificationData","update:is_notification","update:is_toggleAffiliation"],setup(o,{emit:s}){const i=o;let u=null;const f=l.ref(!1),h=l.ref(!1),m=l.ref(!1),x=l.ref(!1);let _=null;const p=It(),{itemThemes:C}=xe.storeToRefs(p),y=s,S=U=>U.replace(/^[\s\S]*?((?:tel|sms|smsto|mailto|callto|facetime|viber|whatsapp):)?[\s\S]*?(%2B)?[\s\S]*?/i,(B,R,D)=>D?"+":""),M=async(U,B)=>{var te,z,ie;if(console.log(U,B),x.value)return;i.isQr||(x.value=!0),v();const R=/[?&]table_id=([a-zA-Z0-9-]+)/,D=U.match(R),K=U.match(/\/([a-f0-9\-]{36})\?/);if(i.isQr){if(D&&K)return(te=i.takeDataTable)==null?void 0:te.call(i,K[1],D[1],"qr");{const W=localStorage.getItem("orgID");if(W){const se=await i.axiosInstanceGet.get(`org_unit/${W}/table`,{params:{external_link:U}}).then(j=>{var G,V;return((G=j.data)==null?void 0:G.length)>0?(V=j.data[0])==null?void 0:V.id:null}).catch(()=>null);if(se)return(z=i.takeDataTable)==null?void 0:z.call(i,W,se)}}y("update:is_notification",!0),y("update:notificationData",{textNotification:"Стол не найден"}),y("update:tableData",null),y("update:is_toggleAffiliation",!0)}else{const W=new En,se=U||B.text,j=S(se);try{await W.authorizeByCard(j);const G=await W.getProfile();y("update:is_notification",!0),y("update:notificationData",{textNotification:`Здравствуйте, ${G.first_name}
|
|
31
|
-
Баланс: ${G.balance}`})}catch(G){y("update:is_notification",!0),y("update:notificationData",{textNotification:((ie=G.response)==null?void 0:ie.user_friendly_message)||"Карта не найдена"})}finally{m.value=!0,_&&clearTimeout(_),_=setTimeout(()=>{m.value=!1},2e3),x.value=!1}}};window.debugScan=M;const k=()=>{},P=async()=>{if(!(f.value||u!=null&&u.isScanning||m.value))try{f.value=!0;try{(await navigator.mediaDevices.getUserMedia({video:!0})).getTracks().forEach(te=>te.stop())}catch{y("update:is_notification",!0),y("update:notificationData",{textNotification:"Разрешите доступ к камере"}),f.value=!1,y("update:is_toggleAffiliation",!0);return}u=new Sa("reader");const U=await Sa.getCameras();if(!U||U.length===0){console.error("Камеры не найдены"),f.value=!1;return}let B;if(i.isQr)B=U.find(K=>Co.back.some(te=>new RegExp(te,"i").test(K.label))),B||(B=U.find(K=>Co.front.some(te=>new RegExp(te,"i").test(K.label))));else if(B=U.find(K=>Co.front.some(te=>new RegExp(te,"i").test(K.label))),B||(B=U.find(K=>new RegExp("amera","i").test(K.label))),!B){y("update:is_notification",!0),y("update:notificationData",{textNotification:"Не найдена фронтальная камера. Для сканирования карт нужна фронтальная камера."}),f.value=!1,y("update:is_toggleAffiliation",!0);return}const R=i.isQr?[pe.QR_CODE]:[pe.QR_CODE,pe.PDF_417,pe.EAN_13,pe.EAN_8,pe.CODE_128],D={fps:60,qrbox:{width:320,height:500}};await u.start(B.id,D,M,k,void 0,R),h.value=!0}catch(U){y("update:is_notification",!0),y("update:notificationData",{textNotification:"Разрешите доступ к камере для сканирования"}),console.error("Ошибка доступа к камере:",U),f.value=!1,h.value=!1,y("update:is_toggleAffiliation",!0)}},v=async()=>{if(u&&u.isScanning)try{await u.stop(),f.value=!1,u=null}catch(U){console.error("Ошибка остановки камеры:",U)}else f.value=!1,u=null,y("update:is_toggleAffiliation",!0);h.value=!1};return l.onUnmounted(()=>{f.value&&v(),_&&(clearTimeout(_),_=null),x.value=!1,m.value=!1,h.value=!1}),(U,B)=>(l.openBlock(),l.createElementBlock("div",null,[(l.openBlock(),l.createBlock(l.Teleport,{to:"body"},[l.withDirectives(l.createElementVNode("div",{class:"blackWindow",onClick:v},[B[0]||(B[0]=l.createElementVNode("div",{id:"reader"},null,-1)),h.value&&!o.isQr?(l.openBlock(),l.createElementBlock("p",x2,"Наведите QR на камеру")):l.createCommentVNode("",!0)],512),[[l.vShow,f.value]])])),l.createVNode(p2,{color:o.isQr?void 0:"#FFFFFF",onClick:P},null,8,["color"])]))}}),Eo=xe.defineStore("modulesLib",()=>{const o=l.ref(!1),s=l.ref({textNotification:""});return{is_notification_lib:o,notificationData_lib:s,showNotification:u=>{o.value=!0,s.value.textNotification=u}}}),Ci=Symbol("clickOutside"),_2={mounted(o,s){o[Ci]=i=>{o.contains(i.target)||s.value(i)},document.addEventListener("click",o[Ci])},unmounted(o){o[Ci]&&document.removeEventListener("click",o[Ci])}};class C2{constructor(s){We(this,"value");We(this,"next");this.value=s}}class E2{constructor(){vi(this,Qt);vi(this,Hn);vi(this,nr);this.clear()}enqueue(s){const i=new C2(s);pn(this,Qt)?(pn(this,Hn).next=i,Dn(this,Hn,i)):(Dn(this,Qt,i),Dn(this,Hn,i)),Ho(this,nr)._++}dequeue(){const s=pn(this,Qt);if(s)return Dn(this,Qt,pn(this,Qt).next),Ho(this,nr)._--,pn(this,Qt)||Dn(this,Hn,void 0),s.value}peek(){if(pn(this,Qt))return pn(this,Qt).value}clear(){Dn(this,Qt,void 0),Dn(this,Hn,void 0),Dn(this,nr,0)}get size(){return pn(this,nr)}*[Symbol.iterator](){let s=pn(this,Qt);for(;s;)yield s.value,s=s.next}*drain(){for(;pn(this,Qt);)yield this.dequeue()}}Qt=new WeakMap,Hn=new WeakMap,nr=new WeakMap;function y2(o){Ta(o);const s=new E2;let i=0;const u=()=>{i<o&&s.size>0&&(i++,s.dequeue()())},f=()=>{i--,u()},h=async(_,p,C)=>{const y=(async()=>_(...C))();p(y);try{await y}catch{}f()},m=(_,p,C)=>{new Promise(y=>{s.enqueue(y)}).then(h.bind(void 0,_,p,C)),i<o&&u()},x=(_,...p)=>new Promise(C=>{m(_,C,p)});return Object.defineProperties(x,{activeCount:{get:()=>i},pendingCount:{get:()=>s.size},clearQueue:{value(){s.clear()}},concurrency:{get:()=>o,set(_){Ta(_),o=_,queueMicrotask(()=>{for(;i<o&&s.size>0;)u()})}},map:{async value(_,p){const C=Array.from(_,(y,S)=>this(p,y,S));return Promise.all(C)}}}),x}function Ta(o){if(!((Number.isInteger(o)||o===Number.POSITIVE_INFINITY)&&o>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up")}let Kt=null;const ka=y2(5),b2=async(o,s)=>{Kt&&N2();const i=lt(),u=It(),f=Eo(),h=Rt(),{itemThemes:m}=xe.storeToRefs(u),{displayCards:x}=xe.storeToRefs(i),{is_notification_lib:_,notificationData_lib:p}=xe.storeToRefs(f),{stateCard:C,openProduct:y}=xe.storeToRefs(h),S=En.create();await A2(o),Kt=ri(`wss://${s}/ws/org-unit/${o}/`,{heartbeatTimeout:3e4}),Kt.on("open",()=>console.warn("Realtime WebSocket подключён (pointId:",o,")")),Kt.on("error",M=>console.warn("WebSocket ошибка:",M)),Kt.on("close",()=>console.warn("Realtime WebSocket закрыт")),Kt.on("message",async M=>{if(M.type)return;m.value.kiosk_hide_menu_update_notification||(p.value.textNotification="Мы обновили меню");const k=M.params||M,P=k.active_groups||[],v=k.updated_groups||[],U=k.updated_product_groups||[],B=await $n(),R=new Set(P.map(j=>j)),D=new Map(x.value.map(j=>[j.id,j])),K=[],te=B.transaction("groups","readwrite");let ie=await te.objectStore("groups").openCursor();for(;ie;){const j=ie.key;!R.has(j)&&j!==o&&(K.push(j),await ie.delete(),D.delete(j)),ie=await ie.continue()}await te.done,x.value=Array.from(D.values()),K.length>0&&await I2(R);const W=[...v.map(j=>ka(async()=>{const[G,V]=await Promise.all([S.getGroupByID(j),S.loadGroupProducts(j)]);G.products=V,D.set(j,G),await Rr(j,G),await Oa(G,V,!0)})),...U.map(j=>ka(async()=>{const[G,V]=await Promise.all([S.getGroupByID(j),S.loadGroupProducts(j)]);G.products=V,D.set(j,G),await Rr(j,G),await Oa(G,V,!0),await S2(V,j)}))];await Promise.all(W),x.value=Array.from(D.values()),await Cl(o,x),p.value.textNotification.length>1&&(_.value=!0);const se=C.value.openCard;if(se!=null&&se.id){const j=new Set(se.groups??[]),G=new Set;let V=!1;for(const N of D.values()){const $=N==null?void 0:N.products;if(!Array.isArray($))continue;const H=$.find(J=>(J==null?void 0:J.id)===se.id);if((H==null?void 0:H.adult)===!0){y.value={id:null,visible:!1},h.reset();return}H&&(N==null?void 0:N.id)!=null&&(G.add(N.id),(v.includes(N.id)||U.includes(N.id))&&(V=!0))}if(G.size===0){y.value={id:null,visible:!1},h.reset();return}(!(j.size===G.size&&[...j].every(N=>G.has(N)))||V)&&await S.getSingleProduct(se==null?void 0:se.id)}}),Kt.connect()},A2=async o=>{try{const s=lt(),i=await Hi(o);i!=null&&i.data&&(s.displayCards=i.data)}catch(s){console.error("Ошибка загрузки кэша групп:",s)}},Ra=async o=>{const s=lt(),i=Eo(),u=Rt(),{stateCard:f,openProduct:h}=xe.storeToRefs(u),{cartProducts_lib:m}=xe.storeToRefs(s),x=m.value,_=[],p=[],C=f.value.openCard;for(const y of x)o(y)?(_.push(y),(y.id===(C==null?void 0:C.id)||C!=null&&C.adult)&&(h.value={id:null,visible:!1})):p.push(y);if(_.length>0){const y=_.map(S=>S.name).slice(0,3).join(", ");i.notificationData_lib.textNotification=`Некоторые позиции стали недоступны и были убраны из заказа: ${y}${_.length>3?` и ещё ${_.length-3}`:""}`,m.value=p,s.updateCartInLocalStorage()}},I2=async o=>{await Ra(s=>{var i;return(i=s.groups)!=null&&i.length?!s.groups.some(u=>o.has(u)):!0})},S2=async(o,s)=>{const i=lt(),u=new Set(o.filter(f=>!f.adult||i.is18Allowed).map(f=>f.id));await Ra(f=>{var h;return(h=f.groups)!=null&&h.includes(s)?!u.has(f.id):!1})},Oa=async(o,s,i=!0)=>{if(o.video_link&&Ei(o.video_link,`${o.id}_video`,i),o.image_link&&Ei(o.image_link,`${o.id}_image`,i),s!=null&&s.length)for(const u of s)u.video_link&&Ei(u.video_link,`${u.id}_video`,i),u.image_link&&Ei(u.image_link,`${u.id}_image`,i)},Ei=async(o,s,i=!1)=>{try{const u=ti();if(!i){const m=await ur(s);if(m){u.updateCacheFromBlob(s,m),window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:s,blob:m}}));return}}const f=await fetch(o);if(!f.ok)throw new Error("Network error");const h=await f.blob();if(h.size===0)throw new Error("Empty blob");await Gi(s,h),u.updateCacheFromBlob(s,h),window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:s,blob:h}}))}catch(u){console.warn(`[MediaCache] Failed for ${s}:`,u)}},N2=()=>{Kt&&(Kt.off("open"),Kt.off("message"),Kt.off("error"),Kt.off("close"),Kt.close(!0),Kt=null)},T2={key:0,class:"valentine-hearts"},k2=l.defineComponent({__name:"FallingHearts",props:{symbols:{default:()=>["❤","♥","💕"]},max:{default:15},interval:{default:1500}},setup(o){const s=o,i=Wt.useDocumentVisibility(),u=Wt.useMediaQuery("(prefers-reduced-motion: reduce)"),f=l.ref([]);let h=null;const m=(C,y)=>Math.random()*(y-C)+C,x=()=>{if(u.value||f.value.length>=s.max)return;const C=s.symbols[Math.floor(Math.random()*s.symbols.length)],y=m(18,26),S=m(5,95),M=m(10,18),k=m(0,.3),P=m(.6,.9),v=Math.floor(m(1,6)),B={id:crypto.randomUUID(),icon:C,style:{left:`${S}%`,fontSize:`${y}px`,color:`rgba(255, 105, 180, ${P})`,animationName:`heartFall${v}`,animationDuration:`${M}s`,animationDelay:`${k}s`}};f.value.push(B);const D=setTimeout(()=>{f.value=f.value.filter(K=>K.id!==B.id),clearTimeout(D)},(k+M+1)*1e3)},_=()=>{if(!u.value){for(let C=0;C<3;C++){const y=setTimeout(()=>{x(),clearTimeout(y)},C*200)}h=setInterval(x,s.interval)}},p=()=>{h&&(clearInterval(h),h=null),f.value=[]};return l.onMounted(()=>{u.value||_()}),l.onUnmounted(()=>{p()}),l.watch(i,(C,y)=>{C==="visible"&&y==="hidden"&&_(),C==="hidden"&&y==="visible"&&p()}),(C,y)=>l.unref(u)?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("div",T2,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(f.value,S=>(l.openBlock(),l.createElementBlock("span",{key:S.id,class:"heart",style:l.normalizeStyle(S.style)},l.toDisplayString(S.icon),5))),128))]))}}),R2=["src"],O2=l.defineComponent({__name:"BasketImage",props:{id:{},fallback:{}},setup(o){const s=o,{mediaUrl:i}=Fn(()=>s.id,()=>s.fallback);return(u,f)=>(l.openBlock(),l.createElementBlock("img",{src:l.unref(i)||""},null,8,R2))}}),B2={class:"button_price_bg"},M2={class:"wrapper_container_price_bg"},v2={class:"button_price"},D2={key:0,class:"image_product_container"},P2=l.defineComponent({__name:"BasketButton",emits:["goToCart"],setup(o){const s=lt(),{isDesktop:i}=Nn(),{totalPrice_lib:u,cartProducts_lib:f}=xe.storeToRefs(s),h=l.computed(()=>{var m;return(m=f.value)!=null&&m.length,f.value.slice(0,3).map(x=>({id:`${x.id}_image`,fallback:x.image_link}))});return(m,x)=>(l.openBlock(),l.createElementBlock("div",B2,[l.createElementVNode("div",M2,[l.createElementVNode("div",v2,[l.unref(u)>0&&h.value.length>0?(l.openBlock(),l.createElementBlock("div",D2,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(h.value,_=>(l.openBlock(),l.createElementBlock("div",{key:_.id,class:"filter_image_product"},[l.createVNode(O2,{id:_.id,fallback:_.fallback,class:"img_product"},null,8,["id","fallback"])]))),128))])):l.createCommentVNode("",!0),l.createVNode(l.unref(At.motion).div,{class:"button_default_main",whilePress:l.unref(i)?{}:{scale:.92},onClick:x[0]||(x[0]=_=>m.$emit("goToCart"))},{default:l.withCtx(()=>[x[2]||(x[2]=l.createElementVNode("div",{class:"icont_cart"},null,-1)),l.createElementVNode("p",null,[l.createVNode(Xt,{price:l.unref(u),fixedFloat:2},null,8,["price"]),x[1]||(x[1]=l.createTextVNode(" ₽",-1))])]),_:1},8,["whilePress"])])])]))}}),Hr=null,{min:tr,max:yn,abs:Ba,floor:L2}=Math,Ma=(o,s,i)=>tr(i,yn(s,o)),va=o=>[...o].sort((s,i)=>s-i),F2=typeof queueMicrotask=="function"?queueMicrotask:o=>{Promise.resolve().then(o)},yo=()=>{let o;return[new Promise(s=>{o=s}),o]},Da=o=>{let s;return()=>(o&&(s=o(),o=void 0),s)},Gr=(o,s,i)=>{const u=i?"unshift":"push";for(let f=0;f<s;f++)o[u](-1);return o},Pa=(o,s)=>{const i=o.t[s];return i===-1?o.o:i},V2=(o,s,i)=>{const u=o.t[s]===-1;return o.t[s]=i,o.i=tr(s,o.i),u},yi=(o,s)=>{if(!o.l)return 0;if(o.i>=s)return o.u[s];o.i<0&&(o.u[0]=0,o.i=0);let i=o.i,u=o.u[i];for(;i<s;)u+=Pa(o,i),o.u[++i]=u;return o.i=s,u},_r=(o,s,i=0,u=o.l-1)=>{let f=i;for(;i<=u;){const h=L2((i+u)/2);yi(o,h)<=s?(f=h,i=h+1):u=h-1}return Ma(f,0,o.l-1)},La=(o,s,i)=>{const u=s-o.l;return o.i=i?-1:tr(s-1,o.i),o.l=s,u>0?(Gr(o.u,u),Gr(o.t,u,i),o.o*u):(o.u.splice(u),(i?o.t.splice(0,-u):o.t.splice(u)).reduce((f,h)=>f-(h===-1?o.o:h),0))},U2=o=>o.documentElement,z2=o=>o.ownerDocument,H2=o=>o.defaultView,Fa=Da(()=>!!/iP(hone|od|ad)/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>0),G2=Da(()=>"scrollBehavior"in U2(document).style),W2=(o,s=40,i=0,u,f=!1)=>{let h=!!i,m=1,x=0,_=0,p=0,C=0,y=0,S=0,M=0,k=0,P=Hr,v=[0,h?yn(i-1,0):-1],U=0,B=!1;const R=((V,X,N)=>({o:X,t:N?Gr(N.slice(0,tr(V,N.length)),yn(0,V-N.length)):Gr([],V),l:V,i:-1,u:Gr([],V+1)}))(o,u?u[1]:s,u&&u[0]),D=new Set,K=()=>p-_,te=()=>K()+y+C,z=(V,X)=>((N,$,H,J)=>{if(J=tr(J,N.l-1),yi(N,J)<=$){const q=_r(N,H,J);return[_r(N,$,J,q),q]}{const q=_r(N,$,void 0,J);return[q,_r(N,H,q)]}})(R,V,X,v[0]),ie=()=>yi(R,R.l),W=(V,X)=>{const N=yi(R,V)-y;return X?ie()-N-se(V):N},se=V=>Pa(R,V),j=(V,X=-1)=>R.t[V]===X,G=V=>{V&&(Fa()&&M!==0||P&&k===1?y+=V:C+=V)};return{p:()=>{D.clear()},h:()=>m,m:()=>(V=>[V.t.slice(),V.o])(R),v:(V=200)=>{if(!B||h)return v;let X,N;if(S)[X,N]=v;else{let $=yn(0,te()),H=$+x;f||(V=yn(0,V),M!==1&&($-=V),M!==2&&(H+=V)),[X,N]=v=z(yn(0,$),yn(0,H)),P&&(X=tr(X,P[0]),N=yn(N,P[1]))}return[yn(X,0),tr(N,R.l-1)]},S:V=>_r(R,V-_),I:j,O:W,k:se,j:()=>R.l,N:()=>p,B:()=>M!==0,T:()=>x,q:()=>_,M:ie,P:()=>(S=C,C=0,[S,k===2]),R:(V,X)=>{const N=[V,X];return D.add(N),()=>{D.delete(N)}},A:(V,X)=>{let N,$,H=0;switch(V){case 1:{if(X===p&&k===0)break;const J=S;S=0;const q=X-p,re=Ba(q);J&&re<Ba(J)+1||k!==0||(M=q<0?2:1),h&&(h=!1),p=X,H=4;const ge=K();ge>=-x&&ge<=ie()&&(H+=1,$=re>x);break}case 2:H=8,M!==0&&(N=!0,H+=1),M=0,k=0,P=Hr;break;case 3:{const J=X.filter(([q,re])=>!j(q,re));if(!J.length)break;G(J.reduce((q,[re,ge])=>((k===2||(P&&k===1?re<P[0]:W(re+(M===0&&k===0?1:0))<K()))&&(q+=ge-se(re)),q),0));for(const[q,re]of J){const ge=se(q),we=V2(R,q,re);f&&(U+=we?re:re-ge)}f&&x&&U>x&&(G(((q,re)=>{let ge=0;const we=[];q.t.forEach((Xe,Oe)=>{Xe!==-1&&(we.push(Xe),Oe<re&&ge++)}),q.i=-1;const Ne=va(we),_e=Ne.length,Me=_e/2|0,he=_e%2==0?(Ne[Me-1]+Ne[Me])/2:Ne[Me],dt=q.o;return((q.o=he)-dt)*yn(re-ge,0)})(R,_r(R,te()))),f=!1),H=3,$=!0;break}case 4:x!==X&&(x||(B=$=!0),x=X,H=3);break;case 5:X[1]?(G(La(R,X[0],!0)),k=2,H=1):(La(R,X[0]),H=1);break;case 6:_=X;break;case 7:k=1;break;case 8:P=z(X,X+x),H=1}H&&(m=1+(2147483647&m),N&&y&&(C+=y,y=0),D.forEach(([J,q])=>{H&J&&q($)}))}}},bo=setTimeout,Ao=(o,s)=>s?-o:o,X2=(o,s,i,u,f,h)=>{const m=Date.now;let x=0,_=!1,p=!1,C=!1,y=!1;const S=(()=>{let U;const B=()=>{U!=Hr&&clearTimeout(U)},R=()=>{B(),U=bo(()=>{U=Hr,(()=>{if(_||p)return _=!1,void S();C=!1,o.A(2)})()},150)};return R.C=B,R})(),M=()=>{x=m(),C&&(y=!0),o.A(1,u()),S()},k=U=>{if(_||!o.B()||U.ctrlKey)return;const B=m()-x;150>B&&50<B&&(i?U.deltaX:U.deltaY)&&(_=!0)},P=()=>{p=!0,C=y=!1},v=()=>{p=!1,Fa()&&(C=!0)};return s.addEventListener("scroll",M),s.addEventListener("wheel",k,{passive:!0}),s.addEventListener("touchstart",P,{passive:!0}),s.addEventListener("touchend",v,{passive:!0}),{H:()=>{s.removeEventListener("scroll",M),s.removeEventListener("wheel",k),s.removeEventListener("touchstart",P),s.removeEventListener("touchend",v),S.C()},V:()=>{const[U,B]=o.P();U&&(f(U,B,y),y=!1,B&&o.T()>o.M()&&o.A(1,u()))}}},j2=(o,s,i)=>{let u;return[async(f,h)=>{if(!await s())return;u&&u();const m=()=>{const[x,_]=yo();return u=()=>{_(!1)},o.T()&&bo(u,150),[x,o.R(2,()=>{_(!0)})]};if(h&&G2())o.A(8,f()),F2(async()=>{for(;;){let x=!0;for(let[C,y]=o.v();C<=y;C++)if(o.I(C)){x=!1;break}if(x)break;const[_,p]=m();try{if(!await _)return}finally{p()}}o.A(7),i(f(),h)});else for(;;){const[x,_]=m();try{if(o.A(7),i(f()),!await x)return}finally{_()}}},()=>{u&&u()}]},q2=o=>{let s;return{F(i){(s||(s=new(H2(z2(i))).ResizeObserver(o))).observe(i)},J(i){s.unobserve(i)},H(){s&&s.disconnect()}}},Z2=l.defineComponent({props:{L:{type:Object,required:!0},W:{type:Object,required:!0},X:{type:Object,required:!0},Y:{type:Function,required:!0},D:{type:Number,required:!0},U:{type:Boolean},G:{type:Boolean},K:{type:Boolean},Z:{type:String,required:!0},ee:Object},setup(o){const s=l.ref(),i=l.computed(()=>o.L.value&&o.W.O(o.D,o.K)),u=l.computed(()=>o.L.value&&o.W.I(o.D));return l.watch(()=>s.value&&o.D,(f,h,m)=>{m(o.Y(s.value,o.D))},{flush:"post"}),()=>{var f;const{X:h,U:m,G:x,Z:_}=o,p=u.value,{style:C,...y}=(f=o.ee)!==null&&f!==void 0?f:{},S={contain:"layout style",position:p&&x?void 0:"absolute",[m?"height":"width"]:"100%",[m?"top":"left"]:"0px",[m?"left":"top"]:i.value+"px",visibility:!p||x?void 0:"hidden",...C};return m&&(S.display="inline-flex"),l.createVNode(_,l.mergeProps({ref:s,style:S},y),typeof(M=h)=="function"||Object.prototype.toString.call(M)==="[object Object]"&&!l.isVNode(M)?h:{default:()=>[h],_:2},16,["style"]);var M}}}),Y2=(o,s)=>{const i=o.key;return i??"_"+s},$2=(o,s)=>o[0]===s[0]&&o[1]===s[1],Va=l.defineComponent({props:{data:{type:Array,required:!0},bufferSize:Number,itemSize:Number,shift:Boolean,horizontal:Boolean,startMargin:{type:Number,default:0},ssrCount:Number,scrollRef:Object,as:{type:String,default:"div"},item:{type:String,default:"div"},itemProps:Function,keepMounted:Array,cache:Object},emits:["scroll","scrollEnd"],setup(o,{emit:s,expose:i,slots:u}){let f=!!o.ssrCount;const h=o.horizontal,m=l.ref(),x=W2(o.data.length,o.itemSize,o.ssrCount,o.cache,!o.itemSize),_=((k,P)=>{let v;const U=P?"width":"height",B=new WeakMap,R=q2(D=>{const K=[];for(const{target:te,contentRect:z}of D)if(te.offsetParent)if(te===v)k.A(4,z[U]);else{const ie=B.get(te);ie!=Hr&&K.push([ie,z[U]])}K.length&&k.A(3,K)});return{te(D){R.F(v=D)},re:(D,K)=>(B.set(D,K),R.F(D),()=>{B.delete(D),R.J(D)}),p:R.H}})(x,h),p=((k,P)=>{let v,U,B=yo(),R=!1;const D=P?"scrollLeft":"scrollTop",K=P?"overflowX":"overflowY",[te,z]=j2(k,()=>B[0],(ie,W)=>{ie=Ao(ie,R),W?v.scrollTo({[P?"left":"top"]:ie,behavior:"smooth"}):v[D]=ie});return{oe(ie){v=ie,P&&(R=getComputedStyle(ie).direction==="rtl"),U=X2(k,ie,P,()=>Ao(ie[D],R),(W,se,j)=>{if(j){const G=ie.style,V=G[K];G[K]="hidden",bo(()=>{G[K]=V})}ie[D]=Ao(k.N()+W,R),se&&z()}),B[1](!0)},p(){U&&U.H(),B[1](!1),B=yo()},ne:()=>R,se(ie){te(()=>ie)},ie(ie){ie+=k.N(),te(()=>ie)},le(ie,{align:W,smooth:se,offset:j=0}={}){if(ie=Ma(ie,0,k.j()-1),W==="nearest"){const G=k.O(ie),V=k.N();if(G<V)W="start";else{if(!(G+k.k(ie)>V+k.T()))return;W="end"}}te(()=>j+k.q()+k.O(ie)+(W==="end"?k.k(ie)-k.T():W==="center"?(k.k(ie)-k.T())/2:0),se)},ce:()=>{U&&U.V()}}})(x,h),C=l.ref(x.h());x.R(1,()=>{C.value=x.h()}),x.R(4,()=>{s("scroll",x.N())}),x.R(8,()=>{s("scrollEnd")});const y=l.computed(k=>{C.value;const P=x.v(o.bufferSize);return k&&$2(k,P)?k:P}),S=l.computed(()=>C.value&&x.B()),M=l.computed(()=>C.value&&x.M());return l.onMounted(()=>{f=!1;const k=requestAnimationFrame(()=>{const P=v=>{_.te(v),p.oe(v)};o.scrollRef?P(o.scrollRef):P(m.value.parentElement)});l.onUnmounted(()=>{cancelAnimationFrame(k)})}),l.onUnmounted(()=>{x.p(),_.p(),p.p()}),l.watch(()=>o.data.length,k=>{x.A(5,[k,o.shift])}),l.watch(()=>o.startMargin,k=>{x.A(6,k)},{immediate:!0}),l.watch([C],()=>{p.ce()},{flush:"post"}),i({get cache(){return x.m()},get scrollOffset(){return x.N()},get scrollSize(){return(k=>yn(k.M(),k.T()))(x)},get viewportSize(){return x.T()},findItemIndex:x.S,getItemOffset:x.O,getItemSize:x.k,scrollToIndex:p.le,scrollTo:p.se,scrollBy:p.ie}),()=>{const k=o.as,P=o.item,v=M.value,U=p.ne(),B=!h&&U?"unshift":"push",R=[],D=te=>{var z;const ie=u.default({item:o.data[te],index:te})[0];return l.createVNode(Z2,{key:Y2(ie,te),L:C,W:x,Y:_.re,D:te,X:ie,U:h,K:U,G:f,Z:P,ee:(z=o.itemProps)===null||z===void 0?void 0:z.call(o,{item:o.data[te],index:te})},null,8,["L","W","Y","D","X","U","K","G","Z","ee"])};if(o.keepMounted){const te=new Set(o.keepMounted);for(let[z,ie]=y.value;z<=ie;z++)te.add(z);va([...te]).forEach(z=>{R[B](D(z))})}else for(let[te,z]=y.value;te<=z;te++)R[B](D(te));return l.createVNode(k,{ref:m,style:{contain:"size style",overflowAnchor:"none",flex:"none",position:"relative",width:h?v+"px":"100%",height:h?"100%":v+"px",pointerEvents:S.value?"none":void 0}},typeof(K=R)=="function"||Object.prototype.toString.call(K)==="[object Object]"&&!l.isVNode(K)?R:{default:()=>[R],_:2},8,["style"]);var K}}}),K2=l.defineComponent({props:{data:{type:Array,required:!0},bufferSize:Number,itemSize:Number,shift:Boolean,horizontal:Boolean,ssrCount:Number,itemProps:Function,keepMounted:Array,cache:Object},emits:["scroll","scrollEnd"],setup(o,{emit:s,expose:i,slots:u}){const f=o.horizontal,h=_=>{s("scroll",_)},m=()=>{s("scrollEnd")},x=l.ref();return i({get cache(){return x.value.cache},get scrollOffset(){return x.value.scrollOffset},get scrollSize(){return x.value.scrollSize},get viewportSize(){return x.value.viewportSize},findItemIndex:(..._)=>x.value.findItemIndex(..._),getItemOffset:(..._)=>x.value.getItemOffset(..._),getItemSize:(..._)=>x.value.getItemSize(..._),scrollToIndex:(..._)=>x.value.scrollToIndex(..._),scrollTo:(..._)=>x.value.scrollTo(..._),scrollBy:(..._)=>x.value.scrollBy(..._)}),()=>{return l.createVNode("div",{style:{display:f?"inline-block":"block",[f?"overflowX":"overflowY"]:"auto",contain:"strict",width:"100%",height:"100%"}},[l.createVNode(Va,{ref:x,data:o.data,bufferSize:o.bufferSize,itemSize:o.itemSize,itemProps:o.itemProps,shift:o.shift,ssrCount:o.ssrCount,horizontal:f,keepMounted:o.keepMounted,cache:o.cache,onScroll:h,onScrollEnd:m},(_=u,typeof _=="function"||Object.prototype.toString.call(_)==="[object Object]"&&!l.isVNode(_)?u:{default:()=>[u],_:2}),8,["data","bufferSize","itemSize","itemProps","shift","ssrCount","horizontal","keepMounted","cache","onScroll","onScrollEnd"])],4);var _}}}),Q2=(o,s=10)=>new Promise(i=>{let u=0,f=0,h=0;const m=()=>{const x=o.scrollSize;x===h&&x>0?u++:(u=0)&&(h=x),f++,u>=2||f>=s?i():requestAnimationFrame(m)};requestAnimationFrame(m)});function J2(o,s){const i=(s==null?void 0:s.align)??"start";let u=!1;const f=l.ref(null),h=l.ref(!1),m=l.ref("measure"),x=l.computed(()=>l.toValue(o).length),_=l.computed(()=>m.value==="measure"||m.value==="virtual"?1:5),p=l.computed(()=>Array.from({length:x.value*_.value},(v,U)=>U)),C=async()=>{if(f.value&&(m.value="measure",u=!1,h.value=!1,await l.nextTick(),m.value==="measure")){if(await Q2(f.value),h.value=f.value.scrollSize>f.value.viewportSize,!h.value){u=!1;return}u=!0,m.value=(s==null?void 0:s.mode)||"loop",await l.nextTick(),f.value.scrollToIndex(x.value*3,{align:i})}},y=v=>m.value==="measure"?v:x.value===0?0:v%x.value,S=(v,U)=>{f.value&&f.value.scrollToIndex(v,U)},M=(v,U)=>!u||m.value!=="loop"?U:U+Math.round((v-U)/x.value)*x.value,k=v=>{if(!u||m.value!=="loop"||!f.value)return;const U=x.value-1,B=x.value*4;if(v<U)return S(x.value*3-1,{align:"start"});if(v>=B)return S(x.value*3,{align:"start"})},P=()=>{if(!f.value||!u)return;const v=f.value.findItemIndex(f.value.scrollOffset);k(v)};return l.onMounted(C),l.onUnmounted(()=>f.value=null),l.watch(x,()=>l.nextTick(C)),{listRef:f,items:p,hasScroll:h,realIndex:y,findNearestIndex:M,scrollToIndex:S,init:C,onScroll:P}}const eg=Object.prototype.toString,tg=o=>eg.call(o)==="[object Error]",ng=new Set(["network error","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]),rg=o=>{if(!(o&&tg(o)&&o.name==="TypeError"&&typeof o.message=="string"))return!1;const{message:i,stack:u}=o;return i==="Load failed"?u===void 0||"__sentry_captured__"in o:i.startsWith("error sending request for url")||i==="Failed to fetch"||i.startsWith("Failed to fetch (")&&i.endsWith(")")?!0:ng.has(i)},ig={pinch:!0,doubleTap:!0,wheel:!0,buttons:["+","-","=","0"]},og=o=>{var i;const s=Object.assign({},ig,o);if(s.pinch&&(document.addEventListener("touchstart",u=>u.touches.length>1&&u.preventDefault(),{passive:!1}),document.addEventListener("gesturestart",u=>u.preventDefault(),{passive:!1})),s.doubleTap){let u=0;document.addEventListener("touchend",f=>{const h=Date.now();h-u<=250&&f.preventDefault(),u=h},{passive:!1})}s.wheel&&document.addEventListener("wheel",u=>(u.ctrlKey||u.metaKey)&&u.preventDefault(),{passive:!1}),(i=s.buttons)!=null&&i.length&&document.addEventListener("keydown",u=>(u.ctrlKey||u.metaKey)&&s.buttons.includes(u.key)&&u.preventDefault())};Object.defineProperty(fe,"useRoute",{enumerable:!0,get:()=>Re.useRoute}),Object.defineProperty(fe,"useRouter",{enumerable:!0,get:()=>Re.useRouter}),fe.BasketButton=P2,fe.BottomSheet=uo,fe.ButtonDefault=un,fe.CardMain=ha,fe.CardProductPage=a0,fe.CardReader=sa,fe.CartBox=oa,fe.CartPage=$f,fe.DrumItem=Th,fe.FallingHearts=k2,fe.GroupMain=yh,fe.InitConnection=En,fe.ModalWindows=Uh,fe.NotificationWindow=lo,fe.PopupWindowDefault=ia,fe.PricePrerender=dr,fe.QrCameraScanner=w2,fe.Recommendation=Ph,fe.RetryPage=ah,fe.TagsMain=Ah,fe.VList=K2,fe.Virtualizer=Va,fe.clearAllProductDB=yl,fe.clearLocalStorage=fr,fe.getCachedGroup=Hi,fe.getCachedProduct=$o,fe.getWebSocketInstance=ri,fe.initPinia=il,fe.initRouter=sl,fe.isNetworkError=rg,fe.parseTheme=Qs,fe.preventZoom=og,fe.updateIndexedDB=b2,fe.useCachedMedia=Fn,fe.useCardLibStore=Rt,fe.useCartLibStore=St,fe.useImageCacheStore=ti,fe.useMainLibStore=lt,fe.useModal=fa,fe.useModalStore=fo,fe.useModulesLibStore=Eo,fe.usePdf=Nn,fe.useThemeStore=It,fe.useVirtuaLoop=J2,fe.vClickOutside=_2,fe.vDragScroll=Vr,fe.vMuted=zr,Object.defineProperty(fe,Symbol.toStringTag,{value:"Module"})});
|
|
28
|
+
`),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<sr.NUM_MASK_PATTERNS}}sr.NUM_MASK_PATTERNS=8;class ot extends p{}ot.kind="WriterException";class Ne{constructor(){}static clearMatrix(e){e.clear(255)}static buildMatrix(e,t,n,r,a){Ne.clearMatrix(a),Ne.embedBasicPatterns(n,a),Ne.embedTypeInfo(t,r,a),Ne.maybeEmbedVersionInfo(n,a),Ne.embedDataBits(e,r,a)}static embedBasicPatterns(e,t){Ne.embedPositionDetectionPatternsAndSeparators(t),Ne.embedDarkDotAtLeftBottomCorner(t),Ne.maybeEmbedPositionAdjustmentPatterns(e,t),Ne.embedTimingPatterns(t)}static embedTypeInfo(e,t,n){const r=new M;Ne.makeTypeInfoBits(e,t,r);for(let a=0,c=r.getSize();a<c;++a){const d=r.get(r.getSize()-1-a),g=Ne.TYPE_INFO_COORDINATES[a],w=g[0],E=g[1];if(n.setBoolean(w,E,d),a<8){const A=n.getWidth()-a-1;n.setBoolean(A,8,d)}else{const I=n.getHeight()-7+(a-8);n.setBoolean(8,I,d)}}}static maybeEmbedVersionInfo(e,t){if(e.getVersionNumber()<7)return;const n=new M;Ne.makeVersionInfoBits(e,n);let r=6*3-1;for(let a=0;a<6;++a)for(let c=0;c<3;++c){const d=n.get(r);r--,t.setBoolean(a,t.getHeight()-11+c,d),t.setBoolean(t.getHeight()-11+c,a,d)}}static embedDataBits(e,t,n){let r=0,a=-1,c=n.getWidth()-1,d=n.getHeight()-1;for(;c>0;){for(c===6&&(c-=1);d>=0&&d<n.getHeight();){for(let g=0;g<2;++g){const w=c-g;if(!Ne.isEmpty(n.get(w,d)))continue;let E;r<e.getSize()?(E=e.get(r),++r):E=!1,t!==255&&Ct.getDataMaskBit(t,w,d)&&(E=!E),n.setBoolean(w,d,E)}d+=a}a=-a,d+=a,c-=2}if(r!==e.getSize())throw new ot("Not all bits consumed: "+r+"/"+e.getSize())}static findMSBSet(e){return 32-O.numberOfLeadingZeros(e)}static calculateBCHCode(e,t){if(t===0)throw new y("0 polynomial");const n=Ne.findMSBSet(t);for(e<<=n-1;Ne.findMSBSet(e)>=n;)e^=t<<Ne.findMSBSet(e)-n;return e}static makeTypeInfoBits(e,t,n){if(!sr.isValidMaskPattern(t))throw new ot("Invalid mask pattern");const r=e.getBits()<<3|t;n.appendBits(r,5);const a=Ne.calculateBCHCode(r,Ne.TYPE_INFO_POLY);n.appendBits(a,10);const c=new M;if(c.appendBits(Ne.TYPE_INFO_MASK_PATTERN,15),n.xor(c),n.getSize()!==15)throw new ot("should not happen but we got: "+n.getSize())}static makeVersionInfoBits(e,t){t.appendBits(e.getVersionNumber(),6);const n=Ne.calculateBCHCode(e.getVersionNumber(),Ne.VERSION_INFO_POLY);if(t.appendBits(n,12),t.getSize()!==18)throw new ot("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;Ne.isEmpty(e.get(t,6))&&e.setNumber(t,6,n),Ne.isEmpty(e.get(6,t))&&e.setNumber(6,t,n)}}static embedDarkDotAtLeftBottomCorner(e){if(e.get(8,e.getHeight()-8)===0)throw new ot;e.setNumber(8,e.getHeight()-8,1)}static embedHorizontalSeparationPattern(e,t,n){for(let r=0;r<8;++r){if(!Ne.isEmpty(n.get(e+r,t)))throw new ot;n.setNumber(e+r,t,0)}}static embedVerticalSeparationPattern(e,t,n){for(let r=0;r<7;++r){if(!Ne.isEmpty(n.get(e,t+r)))throw new ot;n.setNumber(e,t+r,0)}}static embedPositionAdjustmentPattern(e,t,n){for(let r=0;r<5;++r){const a=Ne.POSITION_ADJUSTMENT_PATTERN[r];for(let c=0;c<5;++c)n.setNumber(e+c,t+r,a[c])}}static embedPositionDetectionPattern(e,t,n){for(let r=0;r<7;++r){const a=Ne.POSITION_DETECTION_PATTERN[r];for(let c=0;c<7;++c)n.setNumber(e+c,t+r,a[c])}}static embedPositionDetectionPatternsAndSeparators(e){const t=Ne.POSITION_DETECTION_PATTERN[0].length;Ne.embedPositionDetectionPattern(0,0,e),Ne.embedPositionDetectionPattern(e.getWidth()-t,0,e),Ne.embedPositionDetectionPattern(0,e.getWidth()-t,e);const n=8;Ne.embedHorizontalSeparationPattern(0,n-1,e),Ne.embedHorizontalSeparationPattern(e.getWidth()-n,n-1,e),Ne.embedHorizontalSeparationPattern(0,e.getWidth()-n,e);const r=7;Ne.embedVerticalSeparationPattern(r,0,e),Ne.embedVerticalSeparationPattern(e.getHeight()-r-1,0,e),Ne.embedVerticalSeparationPattern(r,e.getHeight()-r,e)}static maybeEmbedPositionAdjustmentPatterns(e,t){if(e.getVersionNumber()<2)return;const n=e.getVersionNumber()-1,r=Ne.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[n];for(let a=0,c=r.length;a!==c;a++){const d=r[a];if(d>=0)for(let g=0;g!==c;g++){const w=r[g];w>=0&&Ne.isEmpty(t.get(w,d))&&Ne.embedPositionAdjustmentPattern(w-2,d-2,t)}}}}Ne.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])]),Ne.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])]),Ne.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])]),Ne.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])]),Ne.VERSION_INFO_POLY=7973,Ne.TYPE_INFO_POLY=1335,Ne.TYPE_INFO_MASK_PATTERN=21522;class Sg{constructor(e,t){this.dataBytes=e,this.errorCorrectionBytes=t}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class dt{constructor(){}static calculateMaskPenalty(e){return Ct.applyMaskPenaltyRule1(e)+Ct.applyMaskPenaltyRule2(e)+Ct.applyMaskPenaltyRule3(e)+Ct.applyMaskPenaltyRule4(e)}static encode(e,t,n=null){let r=dt.DEFAULT_BYTE_MODE_ENCODING;const a=n!==null&&n.get(Nt.CHARACTER_SET)!==void 0;a&&(r=n.get(Nt.CHARACTER_SET).toString());const c=this.chooseMode(e,r),d=new M;if(c===Se.BYTE&&(a||dt.DEFAULT_BYTE_MODE_ENCODING!==r)){const fe=V.getCharacterSetECIByName(r);fe!==void 0&&this.appendECI(fe,d)}this.appendModeInfo(c,d);const g=new M;this.appendBytes(e,c,g,r);let w;if(n!==null&&n.get(Nt.QR_VERSION)!==void 0){const fe=Number.parseInt(n.get(Nt.QR_VERSION).toString(),10);w=Ae.getVersionForNumber(fe);const le=this.calculateBitsNeeded(c,d,g,w);if(!this.willFit(le,w,t))throw new ot("Data too big for requested version")}else w=this.recommendVersion(t,c,d,g);const E=new M;E.appendBitArray(d);const A=c===Se.BYTE?g.getSizeInBytes():e.length;this.appendLengthInfo(A,w,c,E),E.appendBitArray(g);const I=w.getECBlocksForLevel(t),R=w.getTotalCodewords()-I.getTotalECCodewords();this.terminateBits(R,E);const L=this.interleaveWithECBytes(E,w.getTotalCodewords(),R,I.getNumBlocks()),F=new sr;F.setECLevel(t),F.setMode(c),F.setVersion(w);const q=w.getDimensionForVersion(),ne=new Ri(q,q),de=this.chooseMaskPattern(L,t,w,ne);return F.setMaskPattern(de),Ne.buildMatrix(L,t,w,de,ne),F.setMatrix(ne),F}static recommendVersion(e,t,n,r){const a=this.calculateBitsNeeded(t,n,r,Ae.getVersionForNumber(1)),c=this.chooseVersion(a,e),d=this.calculateBitsNeeded(t,n,r,c);return this.chooseVersion(d,e)}static calculateBitsNeeded(e,t,n,r){return t.getSize()+e.getCharacterCountBits(r)+n.getSize()}static getAlphanumericCode(e){return e<dt.ALPHANUMERIC_TABLE.length?dt.ALPHANUMERIC_TABLE[e]:-1}static chooseMode(e,t=null){if(V.SJIS.getName()===t&&this.isOnlyDoubleByteKanji(e))return Se.KANJI;let n=!1,r=!1;for(let a=0,c=e.length;a<c;++a){const d=e.charAt(a);if(dt.isDigit(d))n=!0;else if(this.getAlphanumericCode(d.charCodeAt(0))!==-1)r=!0;else return Se.BYTE}return r?Se.ALPHANUMERIC:n?Se.NUMERIC:Se.BYTE}static isOnlyDoubleByteKanji(e){let t;try{t=j.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 a=t[r]&255;if((a<129||a>159)&&(a<224||a>235))return!1}return!0}static chooseMaskPattern(e,t,n,r){let a=Number.MAX_SAFE_INTEGER,c=-1;for(let d=0;d<sr.NUM_MASK_PATTERNS;d++){Ne.buildMatrix(e,t,n,d,r);let g=this.calculateMaskPenalty(r);g<a&&(a=g,c=d)}return c}static chooseVersion(e,t){for(let n=1;n<=40;n++){const r=Ae.getVersionForNumber(n);if(dt.willFit(e,r,t))return r}throw new ot("Data too big")}static willFit(e,t,n){const r=t.getTotalCodewords(),c=t.getECBlocksForLevel(n).getTotalECCodewords(),d=r-c,g=(e+7)/8;return d>=g}static terminateBits(e,t){const n=e*8;if(t.getSize()>n)throw new ot("data bits cannot fit in the QR Code"+t.getSize()+" > "+n);for(let c=0;c<4&&t.getSize()<n;++c)t.appendBit(!1);const r=t.getSize()&7;if(r>0)for(let c=r;c<8;c++)t.appendBit(!1);const a=e-t.getSizeInBytes();for(let c=0;c<a;++c)t.appendBits(c&1?17:236,8);if(t.getSize()!==n)throw new ot("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(e,t,n,r,a,c){if(r>=n)throw new ot("Block ID too large");const d=e%n,g=n-d,w=Math.floor(e/n),E=w+1,A=Math.floor(t/n),I=A+1,R=w-A,L=E-I;if(R!==L)throw new ot("EC bytes mismatch");if(n!==g+d)throw new ot("RS blocks mismatch");if(e!==(A+R)*g+(I+L)*d)throw new ot("Total bytes mismatch");r<g?(a[0]=A,c[0]=R):(a[0]=I,c[0]=L)}static interleaveWithECBytes(e,t,n,r){if(e.getSizeInBytes()!==n)throw new ot("Number of bits and data bytes does not match");let a=0,c=0,d=0;const g=new Array;for(let E=0;E<r;++E){const A=new Int32Array(1),I=new Int32Array(1);dt.getNumDataBytesAndNumECBytesForBlockID(t,n,r,E,A,I);const R=A[0],L=new Uint8Array(R);e.toBytes(8*a,L,0,R);const F=dt.generateECBytes(L,I[0]);g.push(new Sg(L,F)),c=Math.max(c,R),d=Math.max(d,F.length),a+=A[0]}if(n!==a)throw new ot("Data bytes does not match offset");const w=new M;for(let E=0;E<c;++E)for(const A of g){const I=A.getDataBytes();E<I.length&&w.appendBits(I[E],8)}for(let E=0;E<d;++E)for(const A of g){const I=A.getErrorCorrectionBytes();E<I.length&&w.appendBits(I[E],8)}if(t!==w.getSizeInBytes())throw new ot("Interleaving error: "+t+" and "+w.getSizeInBytes()+" differ.");return w}static generateECBytes(e,t){const n=e.length,r=new Int32Array(n+t);for(let c=0;c<n;c++)r[c]=e[c]&255;new Do(ue.QR_CODE_FIELD_256).encode(r,t);const a=new Uint8Array(t);for(let c=0;c<t;c++)a[c]=r[n+c];return a}static appendModeInfo(e,t){t.appendBits(e.getBits(),4)}static appendLengthInfo(e,t,n,r){const a=n.getCharacterCountBits(t);if(e>=1<<a)throw new ot(e+" is bigger than "+((1<<a)-1));r.appendBits(e,a)}static appendBytes(e,t,n,r){switch(t){case Se.NUMERIC:dt.appendNumericBytes(e,n);break;case Se.ALPHANUMERIC:dt.appendAlphanumericBytes(e,n);break;case Se.BYTE:dt.append8BitBytes(e,n,r);break;case Se.KANJI:dt.appendKanjiBytes(e,n);break;default:throw new ot("Invalid mode: "+t)}}static getDigit(e){return e.charCodeAt(0)-48}static isDigit(e){const t=dt.getDigit(e);return t>=0&&t<=9}static appendNumericBytes(e,t){const n=e.length;let r=0;for(;r<n;){const a=dt.getDigit(e.charAt(r));if(r+2<n){const c=dt.getDigit(e.charAt(r+1)),d=dt.getDigit(e.charAt(r+2));t.appendBits(a*100+c*10+d,10),r+=3}else if(r+1<n){const c=dt.getDigit(e.charAt(r+1));t.appendBits(a*10+c,7),r+=2}else t.appendBits(a,4),r++}}static appendAlphanumericBytes(e,t){const n=e.length;let r=0;for(;r<n;){const a=dt.getAlphanumericCode(e.charCodeAt(r));if(a===-1)throw new ot;if(r+1<n){const c=dt.getAlphanumericCode(e.charCodeAt(r+1));if(c===-1)throw new ot;t.appendBits(a*45+c,11),r+=2}else t.appendBits(a,6),r++}}static append8BitBytes(e,t,n){let r;try{r=j.encode(e,n)}catch(a){throw new ot(a)}for(let a=0,c=r.length;a!==c;a++){const d=r[a];t.appendBits(d,8)}}static appendKanjiBytes(e,t){let n;try{n=j.encode(e,V.SJIS)}catch(a){throw new ot(a)}const r=n.length;for(let a=0;a<r;a+=2){const c=n[a]&255,d=n[a+1]&255,g=c<<8&4294967295|d;let w=-1;if(g>=33088&&g<=40956?w=g-33088:g>=57408&&g<=60351&&(w=g-49472),w===-1)throw new ot("Invalid byte sequence");const E=(w>>8)*192+(w&255);t.appendBits(E,13)}}static appendECI(e,t){t.appendBits(Se.ECI.getBits(),4),t.appendBits(e.getValue(),8)}}dt.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]),dt.DEFAULT_BYTE_MODE_ENCODING=V.UTF8.getName();class ar{write(e,t,n,r=null){if(e.length===0)throw new y("Found empty contents");if(t<0||n<0)throw new y("Requested dimensions are too small: "+t+"x"+n);let a=ct.L,c=ar.QUIET_ZONE_SIZE;r!==null&&(r.get(Nt.ERROR_CORRECTION)!==void 0&&(a=ct.fromString(r.get(Nt.ERROR_CORRECTION).toString())),r.get(Nt.MARGIN)!==void 0&&(c=Number.parseInt(r.get(Nt.MARGIN).toString(),10)));const d=dt.encode(e,a,r);return this.renderResult(d,t,n,c)}writeToDom(e,t,n,r,a=null){typeof e=="string"&&(e=document.querySelector(e));const c=this.write(t,n,r,a);e&&e.appendChild(c)}renderResult(e,t,n,r){const a=e.getMatrix();if(a===null)throw new Ke;const c=a.getWidth(),d=a.getHeight(),g=c+r*2,w=d+r*2,E=Math.max(t,g),A=Math.max(n,w),I=Math.min(Math.floor(E/g),Math.floor(A/w)),R=Math.floor((E-c*I)/2),L=Math.floor((A-d*I)/2),F=this.createSVGElement(E,A);for(let q=0,ne=L;q<d;q++,ne+=I)for(let de=0,fe=R;de<c;de++,fe+=I)if(a.get(de,q)===1){const le=this.createSvgRectElement(fe,ne,I,I);F.appendChild(le)}return F}createSVGElement(e,t){const n=document.createElementNS(ar.SVG_NS,"svg");return n.setAttributeNS(null,"height",e.toString()),n.setAttributeNS(null,"width",t.toString()),n}createSvgRectElement(e,t,n,r){const a=document.createElementNS(ar.SVG_NS,"rect");return a.setAttributeNS(null,"x",e.toString()),a.setAttributeNS(null,"y",t.toString()),a.setAttributeNS(null,"height",n.toString()),a.setAttributeNS(null,"width",r.toString()),a.setAttributeNS(null,"fill","#000000"),a}}ar.QUIET_ZONE_SIZE=4,ar.SVG_NS="http://www.w3.org/2000/svg";class Sr{encode(e,t,n,r,a){if(e.length===0)throw new y("Found empty contents");if(t!==xe.QR_CODE)throw new y("Can only encode QR_CODE, but got "+t);if(n<0||r<0)throw new y(`Requested dimensions are too small: ${n}x${r}`);let c=ct.L,d=Sr.QUIET_ZONE_SIZE;a!==null&&(a.get(Nt.ERROR_CORRECTION)!==void 0&&(c=ct.fromString(a.get(Nt.ERROR_CORRECTION).toString())),a.get(Nt.MARGIN)!==void 0&&(d=Number.parseInt(a.get(Nt.MARGIN).toString(),10)));const g=dt.encode(e,c,a);return Sr.renderResult(g,n,r,d)}static renderResult(e,t,n,r){const a=e.getMatrix();if(a===null)throw new Ke;const c=a.getWidth(),d=a.getHeight(),g=c+r*2,w=d+r*2,E=Math.max(t,g),A=Math.max(n,w),I=Math.min(Math.floor(E/g),Math.floor(A/w)),R=Math.floor((E-c*I)/2),L=Math.floor((A-d*I)/2),F=new X(E,A);for(let q=0,ne=L;q<d;q++,ne+=I)for(let de=0,fe=R;de<c;de++,fe+=I)a.get(de,q)===1&&F.setRegion(fe,ne,I,I);return F}}Sr.QUIET_ZONE_SIZE=4;class Ng{encode(e,t,n,r,a){let c;switch(t){case xe.QR_CODE:c=new Sr;break;default:throw new y("No encoder available for format "+t)}return c.encode(e,t,n,r,a)}}class Rn extends te{constructor(e,t,n,r,a,c,d,g){if(super(c,d),this.yuvData=e,this.dataWidth=t,this.dataHeight=n,this.left=r,this.top=a,r+c>t||a+d>n)throw new y("Crop rectangle does not fit within image data.");g&&this.reverseHorizontal(c,d)}getRow(e,t){if(e<0||e>=this.getHeight())throw new y("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 D.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 a=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return D.arraycopy(this.yuvData,a,r,0,n),r;for(let c=0;c<t;c++){const d=c*e;D.arraycopy(this.yuvData,a,r,d,e),a+=this.dataWidth}return r}isCropSupported(){return!0}crop(e,t,n,r){return new Rn(this.yuvData,this.dataWidth,this.dataHeight,this.left+e,this.top+t,n,r,!1)}renderThumbnail(){const e=this.getWidth()/Rn.THUMBNAIL_SCALE_FACTOR,t=this.getHeight()/Rn.THUMBNAIL_SCALE_FACTOR,n=new Int32Array(e*t),r=this.yuvData;let a=this.top*this.dataWidth+this.left;for(let c=0;c<t;c++){const d=c*e;for(let g=0;g<e;g++){const w=r[a+g*Rn.THUMBNAIL_SCALE_FACTOR]&255;n[d+g]=4278190080|w*65793}a+=this.dataWidth*Rn.THUMBNAIL_SCALE_FACTOR}return n}getThumbnailWidth(){return this.getWidth()/Rn.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/Rn.THUMBNAIL_SCALE_FACTOR}reverseHorizontal(e,t){const n=this.yuvData;for(let r=0,a=this.top*this.dataWidth+this.left;r<t;r++,a+=this.dataWidth){const c=a+e/2;for(let d=a,g=a+e-1;d<c;d++,g--){const w=n[d];n[d]=n[g],n[g]=w}}}invert(){return new Z(this)}}Rn.THUMBNAIL_SCALE_FACTOR=2;class Po extends te{constructor(e,t,n,r,a,c,d){if(super(t,n),this.dataWidth=r,this.dataHeight=a,this.left=c,this.top=d,e.BYTES_PER_ELEMENT===4){const g=t*n,w=new Uint8ClampedArray(g);for(let E=0;E<g;E++){const A=e[E],I=A>>16&255,R=A>>7&510,L=A&255;w[E]=(I+R+L)/4&255}this.luminances=w}else this.luminances=e;if(r===void 0&&(this.dataWidth=t),a===void 0&&(this.dataHeight=n),c===void 0&&(this.left=0),d===void 0&&(this.top=0),this.left+t>this.dataWidth||this.top+n>this.dataHeight)throw new y("Crop rectangle does not fit within image data.")}getRow(e,t){if(e<0||e>=this.getHeight())throw new y("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 D.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 a=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return D.arraycopy(this.luminances,a,r,0,n),r;for(let c=0;c<t;c++){const d=c*e;D.arraycopy(this.luminances,a,r,d,e),a+=this.dataWidth}return r}isCropSupported(){return!0}crop(e,t,n,r){return new Po(this.luminances,n,r,this.dataWidth,this.dataHeight,this.left+e,this.top+t)}invert(){return new Z(this)}}class qa extends V{static forName(e){return this.getCharacterSetECIByName(e)}}class Lo{}Lo.ISO_8859_1=V.ISO8859_1;class Za{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}getCodeWords(){return this.codeWords}setCodeWords(e){this.codeWords=e}getMatrix(){return this.matrix}setMatrix(e){this.matrix=e}}class Ya{static singletonList(e){return[e]}static min(e,t){return e.sort(t)[0]}}class Tg{constructor(e){this.previous=e}getPrevious(){return this.previous}}class Nr extends Tg{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 Nr(this,e,t)}addBinaryShift(e,t){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new Nr(this,e,t)}toString(){let e=this.value&(1<<this.bitCount)-1;return e|=1<<this.bitCount,"<"+O.toBinaryString(e|1<<this.bitCount).substring(1)+">"}}class Fo extends Nr{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 Fo(this,e,t)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function kg(b,e,t){return new Fo(b,e,t)}function $r(b,e,t){return new Nr(b,e,t)}const Rg=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],Zn=0,Oi=1,hn=2,$a=3,On=4,Og=new Nr(null,0,0),Vo=[Int32Array.from([0,(5<<16)+28,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(9<<16)+480+14,0,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(4<<16)+14,(9<<16)+448+28,0,(9<<16)+448+29,932798]),Int32Array.from([(5<<16)+29,(5<<16)+28,656318,0,(5<<16)+30]),Int32Array.from([(5<<16)+31,656380,656382,656381,0])];function Mg(b){for(let e of b)P.fill(e,-1);return b[Zn][On]=0,b[Oi][On]=0,b[Oi][Zn]=28,b[$a][On]=0,b[hn][On]=0,b[hn][Zn]=15,b}const Ka=Mg(P.createInt32Array(6,6));class Mn{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 c=Vo[this.mode][e];r=$r(r,c&65535,c>>16),n+=c>>16}let a=e===hn?4:5;return r=$r(r,t,a),new Mn(r,e,0,n+a)}shiftAndAppend(e,t){let n=this.token,r=this.mode===hn?4:5;return n=$r(n,Ka[this.mode][e],r),n=$r(n,t,5),new Mn(n,this.mode,0,this.bitCount+r+5)}addBinaryShiftChar(e){let t=this.token,n=this.mode,r=this.bitCount;if(this.mode===On||this.mode===hn){let d=Vo[n][Zn];t=$r(t,d&65535,d>>16),r+=d>>16,n=Zn}let a=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,c=new Mn(t,n,this.binaryShiftByteCount+1,r+a);return c.binaryShiftByteCount===2078&&(c=c.endBinaryShift(e+1)),c}endBinaryShift(e){if(this.binaryShiftByteCount===0)return this;let t=this.token;return t=kg(t,e-this.binaryShiftByteCount,this.binaryShiftByteCount),new Mn(t,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(e){let t=this.bitCount+(Vo[this.mode][e.mode]>>16);return this.binaryShiftByteCount<e.binaryShiftByteCount?t+=Mn.calculateBinaryShiftCost(e)-Mn.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 M;for(const r of t)r.appendTo(n,e);return n}toString(){return G.format("%s bits=%d bytes=%d",Rg[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(e){return e.binaryShiftByteCount>62?21:e.binaryShiftByteCount>31?20:e.binaryShiftByteCount>0?10:0}}Mn.INITIAL_STATE=new Mn(Og,Zn,0,0);function Bg(b){const e=G.getCharCode(" "),t=G.getCharCode("."),n=G.getCharCode(",");b[Zn][e]=1;const r=G.getCharCode("Z"),a=G.getCharCode("A");for(let I=a;I<=r;I++)b[Zn][I]=I-a+2;b[Oi][e]=1;const c=G.getCharCode("z"),d=G.getCharCode("a");for(let I=d;I<=c;I++)b[Oi][I]=I-d+2;b[hn][e]=1;const g=G.getCharCode("9"),w=G.getCharCode("0");for(let I=w;I<=g;I++)b[hn][I]=I-w+2;b[hn][n]=12,b[hn][t]=13;const E=["\0"," ","","","","","","","\x07","\b"," ",`
|
|
29
|
+
`,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""];for(let I=0;I<E.length;I++)b[$a][G.getCharCode(E[I])]=I;const A=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let I=0;I<A.length;I++)G.getCharCode(A[I])>0&&(b[On][G.getCharCode(A[I])]=I);return b}const Uo=Bg(P.createInt32Array(5,256));class Kr{constructor(e){this.text=e}encode(){const e=G.getCharCode(" "),t=G.getCharCode(`
|
|
30
|
+
`);let n=Ya.singletonList(Mn.INITIAL_STATE);for(let a=0;a<this.text.length;a++){let c,d=a+1<this.text.length?this.text[a+1]:0;switch(this.text[a]){case G.getCharCode("\r"):c=d===t?2:0;break;case G.getCharCode("."):c=d===e?3:0;break;case G.getCharCode(","):c=d===e?4:0;break;case G.getCharCode(":"):c=d===e?5:0;break;default:c=0}c>0?(n=Kr.updateStateListForPair(n,a,c),a++):n=this.updateStateListForChar(n,a)}return Ya.min(n,(a,c)=>a.getBitCount()-c.getBitCount()).toBitArray(this.text)}updateStateListForChar(e,t){const n=[];for(let r of e)this.updateStateForChar(r,t,n);return Kr.simplifyStates(n)}updateStateForChar(e,t,n){let r=this.text[t]&255,a=Uo[e.getMode()][r]>0,c=null;for(let d=0;d<=On;d++){let g=Uo[d][r];if(g>0){if(c==null&&(c=e.endBinaryShift(t)),!a||d===e.getMode()||d===hn){const w=c.latchAndAppend(d,g);n.push(w)}if(!a&&Ka[e.getMode()][d]>=0){const w=c.shiftAndAppend(d,g);n.push(w)}}}if(e.getBinaryShiftByteCount()>0||Uo[e.getMode()][r]===0){let d=e.addBinaryShiftChar(t);n.push(d)}}static updateStateListForPair(e,t,n){const r=[];for(let a of e)this.updateStateForPair(a,t,n,r);return this.simplifyStates(r)}static updateStateForPair(e,t,n,r){let a=e.endBinaryShift(t);if(r.push(a.latchAndAppend(On,n)),e.getMode()!==On&&r.push(a.shiftAndAppend(On,n)),n===3||n===4){let c=a.latchAndAppend(hn,16-n).latchAndAppend(hn,1);r.push(c)}if(e.getBinaryShiftByteCount()>0){let c=e.addBinaryShiftChar(t).addBinaryShiftChar(t+1);r.push(c)}}static simplifyStates(e){let t=[];for(const n of e){let r=!0;for(const a of t){if(a.isBetterThanOrEqualTo(n)){r=!1;break}n.isBetterThanOrEqualTo(a)&&(t=t.filter(c=>c!==a))}r&&t.push(n)}return t}}class Ye{constructor(){}static encodeBytes(e){return Ye.encode(e,Ye.DEFAULT_EC_PERCENT,Ye.DEFAULT_AZTEC_LAYERS)}static encode(e,t,n){let r=new Kr(e).encode(),a=O.truncDivision(r.getSize()*t,100)+11,c=r.getSize()+a,d,g,w,E,A;if(n!==Ye.DEFAULT_AZTEC_LAYERS){if(d=n<0,g=Math.abs(n),g>(d?Ye.MAX_NB_BITS_COMPACT:Ye.MAX_NB_BITS))throw new y(G.format("Illegal value %s for layers",n));w=Ye.totalBitsInLayer(g,d),E=Ye.WORD_SIZE[g];let le=w-w%E;if(A=Ye.stuffBits(r,E),A.getSize()+a>le)throw new y("Data to large for user specified layer");if(d&&A.getSize()>E*64)throw new y("Data to large for user specified layer")}else{E=0,A=null;for(let le=0;;le++){if(le>Ye.MAX_NB_BITS)throw new y("Data too large for an Aztec code");if(d=le<=3,g=d?le+1:le,w=Ye.totalBitsInLayer(g,d),c>w)continue;(A==null||E!==Ye.WORD_SIZE[g])&&(E=Ye.WORD_SIZE[g],A=Ye.stuffBits(r,E));let Ge=w-w%E;if(!(d&&A.getSize()>E*64)&&A.getSize()+a<=Ge)break}}let I=Ye.generateCheckWords(A,w,E),R=A.getSize()/E,L=Ye.generateModeMessage(d,g,R),F=(d?11:14)+g*4,q=new Int32Array(F),ne;if(d){ne=F;for(let le=0;le<q.length;le++)q[le]=le}else{ne=F+1+2*O.truncDivision(O.truncDivision(F,2)-1,15);let le=O.truncDivision(F,2),Ge=O.truncDivision(ne,2);for(let ve=0;ve<le;ve++){let en=ve+O.truncDivision(ve,15);q[le-ve-1]=Ge-en-1,q[le+ve]=Ge+en+1}}let de=new X(ne);for(let le=0,Ge=0;le<g;le++){let ve=(g-le)*4+(d?9:12);for(let en=0;en<ve;en++){let En=en*2;for(let tn=0;tn<2;tn++)I.get(Ge+En+tn)&&de.set(q[le*2+tn],q[le*2+en]),I.get(Ge+ve*2+En+tn)&&de.set(q[le*2+en],q[F-1-le*2-tn]),I.get(Ge+ve*4+En+tn)&&de.set(q[F-1-le*2-tn],q[F-1-le*2-en]),I.get(Ge+ve*6+En+tn)&&de.set(q[F-1-le*2-en],q[le*2+tn])}Ge+=ve*8}if(Ye.drawModeMessage(de,d,ne,L),d)Ye.drawBullsEye(de,O.truncDivision(ne,2),5);else{Ye.drawBullsEye(de,O.truncDivision(ne,2),7);for(let le=0,Ge=0;le<O.truncDivision(F,2)-1;le+=15,Ge+=16)for(let ve=O.truncDivision(ne,2)&1;ve<ne;ve+=2)de.set(O.truncDivision(ne,2)-Ge,ve),de.set(O.truncDivision(ne,2)+Ge,ve),de.set(ve,O.truncDivision(ne,2)-Ge),de.set(ve,O.truncDivision(ne,2)+Ge)}let fe=new Za;return fe.setCompact(d),fe.setSize(ne),fe.setLayers(g),fe.setCodeWords(R),fe.setMatrix(de),fe}static drawBullsEye(e,t,n){for(let r=0;r<n;r+=2)for(let a=t-r;a<=t+r;a++)e.set(a,t-r),e.set(a,t+r),e.set(t-r,a),e.set(t+r,a);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 M;return e?(r.appendBits(t-1,2),r.appendBits(n-1,6),r=Ye.generateCheckWords(r,28,4)):(r.appendBits(t-1,5),r.appendBits(n-1,11),r=Ye.generateCheckWords(r,40,4)),r}static drawModeMessage(e,t,n,r){let a=O.truncDivision(n,2);if(t)for(let c=0;c<7;c++){let d=a-3+c;r.get(c)&&e.set(d,a-5),r.get(c+7)&&e.set(a+5,d),r.get(20-c)&&e.set(d,a+5),r.get(27-c)&&e.set(a-5,d)}else for(let c=0;c<10;c++){let d=a-5+c+O.truncDivision(c,5);r.get(c)&&e.set(d,a-7),r.get(c+10)&&e.set(a+7,d),r.get(29-c)&&e.set(d,a+7),r.get(39-c)&&e.set(a-7,d)}}static generateCheckWords(e,t,n){let r=e.getSize()/n,a=new Do(Ye.getGF(n)),c=O.truncDivision(t,n),d=Ye.bitsToWords(e,n,c);a.encode(d,c-r);let g=t%n,w=new M;w.appendBits(0,g);for(const E of Array.from(d))w.appendBits(E,n);return w}static bitsToWords(e,t,n){let r=new Int32Array(n),a,c;for(a=0,c=e.getSize()/t;a<c;a++){let d=0;for(let g=0;g<t;g++)d|=e.get(a*t+g)?1<<t-g-1:0;r[a]=d}return r}static getGF(e){switch(e){case 4:return ue.AZTEC_PARAM;case 6:return ue.AZTEC_DATA_6;case 8:return ue.AZTEC_DATA_8;case 10:return ue.AZTEC_DATA_10;case 12:return ue.AZTEC_DATA_12;default:throw new y("Unsupported word size "+e)}}static stuffBits(e,t){let n=new M,r=e.getSize(),a=(1<<t)-2;for(let c=0;c<r;c+=t){let d=0;for(let g=0;g<t;g++)(c+g>=r||e.get(c+g))&&(d|=1<<t-1-g);(d&a)===a?(n.appendBits(d&a,t),c--):d&a?n.appendBits(d,t):(n.appendBits(d|1,t),c--)}return n}static totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}Ye.DEFAULT_EC_PERCENT=33,Ye.DEFAULT_AZTEC_LAYERS=0,Ye.MAX_NB_BITS=32,Ye.MAX_NB_BITS_COMPACT=4,Ye.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 Mi{encode(e,t,n,r){return this.encodeWithHints(e,t,n,r,null)}encodeWithHints(e,t,n,r,a){let c=Lo.ISO_8859_1,d=Ye.DEFAULT_EC_PERCENT,g=Ye.DEFAULT_AZTEC_LAYERS;return a!=null&&(a.has(Nt.CHARACTER_SET)&&(c=qa.forName(a.get(Nt.CHARACTER_SET).toString())),a.has(Nt.ERROR_CORRECTION)&&(d=O.parseInt(a.get(Nt.ERROR_CORRECTION).toString())),a.has(Nt.AZTEC_LAYERS)&&(g=O.parseInt(a.get(Nt.AZTEC_LAYERS).toString()))),Mi.encodeLayers(e,t,n,r,c,d,g)}static encodeLayers(e,t,n,r,a,c,d){if(t!==xe.AZTEC)throw new y("Can only encode AZTEC, but got "+t);let g=Ye.encode(G.getBytes(e,a),c,d);return Mi.renderResult(g,n,r)}static renderResult(e,t,n){let r=e.getMatrix();if(r==null)throw new Ke;let a=r.getWidth(),c=r.getHeight(),d=Math.max(t,a),g=Math.max(n,c),w=Math.min(d/a,g/c),E=(d-a*w)/2,A=(g-c*w)/2,I=new X(d,g);for(let R=0,L=A;R<c;R++,L+=w)for(let F=0,q=E;F<a;F++,q+=w)r.get(F,R)&&I.setRegion(q,L,w,w);return I}}i.AbstractExpandedDecoder=Io,i.ArgumentException=C,i.ArithmeticException=It,i.AztecCode=Za,i.AztecCodeReader=nr,i.AztecCodeWriter=Mi,i.AztecDecoder=Ue,i.AztecDetector=Er,i.AztecDetectorResult=bi,i.AztecEncoder=Ye,i.AztecHighLevelEncoder=Kr,i.AztecPoint=Bt,i.BarcodeFormat=xe,i.Binarizer=T,i.BinaryBitmap=S,i.BitArray=M,i.BitMatrix=X,i.BitSource=ko,i.BrowserAztecCodeReader=ye,i.BrowserBarcodeReader=ug,i.BrowserCodeReader=Ie,i.BrowserDatamatrixCodeReader=fg,i.BrowserMultiFormatReader=bg,i.BrowserPDF417Reader=Ag,i.BrowserQRCodeReader=Ig,i.BrowserQRCodeSvgWriter=ar,i.CharacterSetECI=V,i.ChecksumException=B,i.Code128Reader=se,i.Code39Reader=Qe,i.DataMatrixDecodedBitStreamParser=Wn,i.DataMatrixReader=Xn,i.DecodeHintType=Q,i.DecoderResult=Re,i.DefaultGridSampler=Cr,i.DetectorResult=_r,i.EAN13Reader=ht,i.EncodeHintType=Nt,i.Exception=p,i.FormatException=W,i.GenericGF=ue,i.GenericGFPoly=$e,i.GlobalHistogramBinarizer=Y,i.GridSampler=Gr,i.GridSamplerInstance=$t,i.HTMLCanvasElementLuminanceSource=re,i.HybridBinarizer=H,i.ITFReader=Ze,i.IllegalArgumentException=y,i.IllegalStateException=Ke,i.InvertedLuminanceSource=Z,i.LuminanceSource=te,i.MathUtils=He,i.MultiFormatOneDReader=Ar,i.MultiFormatReader=ja,i.MultiFormatWriter=Ng,i.NotFoundException=N,i.OneDReader=ie,i.PDF417DecodedBitStreamParser=ee,i.PDF417DecoderErrorCorrection=Ua,i.PDF417Reader=Pt,i.PDF417ResultMetadata=Ha,i.PerspectiveTransform=sn,i.PlanarYUVLuminanceSource=Rn,i.QRCodeByteMatrix=Ri,i.QRCodeDataMask=dn,i.QRCodeDecodedBitStreamParser=xt,i.QRCodeDecoderErrorCorrectionLevel=ct,i.QRCodeDecoderFormatInformation=Ut,i.QRCodeEncoder=dt,i.QRCodeEncoderQRCode=sr,i.QRCodeMaskUtil=Ct,i.QRCodeMatrixUtil=Ne,i.QRCodeMode=Se,i.QRCodeReader=jn,i.QRCodeVersion=Ae,i.QRCodeWriter=Sr,i.RGBLuminanceSource=Po,i.RSS14Reader=_t,i.RSSExpandedReader=ae,i.ReaderException=ki,i.ReedSolomonDecoder=mt,i.ReedSolomonEncoder=Do,i.ReedSolomonException=Xe,i.Result=_e,i.ResultMetadataType=Oe,i.ResultPoint=Ee,i.StringUtils=G,i.UnsupportedOperationException=ce,i.VideoInputDevice=ge,i.WhiteRectangleDetector=_n,i.WriterException=ot,i.ZXingArrays=P,i.ZXingCharset=qa,i.ZXingInteger=O,i.ZXingStandardCharsets=Lo,i.ZXingStringBuilder=z,i.ZXingStringEncoding=j,i.ZXingSystem=D,i.createAbstractExpandedDecoder=Fa,Object.defineProperty(i,"__esModule",{value:!0})})})(xo,xo.exports);var ut=xo.exports;const Xh=tl({__proto__:null,default:Zs(ut)},[ut]);var xa=function(){function o(s,i,u){if(this.formatMap=new Map([[pe.QR_CODE,ut.BarcodeFormat.QR_CODE],[pe.AZTEC,ut.BarcodeFormat.AZTEC],[pe.CODABAR,ut.BarcodeFormat.CODABAR],[pe.CODE_39,ut.BarcodeFormat.CODE_39],[pe.CODE_93,ut.BarcodeFormat.CODE_93],[pe.CODE_128,ut.BarcodeFormat.CODE_128],[pe.DATA_MATRIX,ut.BarcodeFormat.DATA_MATRIX],[pe.MAXICODE,ut.BarcodeFormat.MAXICODE],[pe.ITF,ut.BarcodeFormat.ITF],[pe.EAN_13,ut.BarcodeFormat.EAN_13],[pe.EAN_8,ut.BarcodeFormat.EAN_8],[pe.PDF_417,ut.BarcodeFormat.PDF_417],[pe.RSS_14,ut.BarcodeFormat.RSS_14],[pe.RSS_EXPANDED,ut.BarcodeFormat.RSS_EXPANDED],[pe.UPC_A,ut.BarcodeFormat.UPC_A],[pe.UPC_E,ut.BarcodeFormat.UPC_E],[pe.UPC_EAN_EXTENSION,ut.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!Xh)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=i,this.logger=u;var f=this.createZXingFormats(s),h=new Map;h.set(ut.DecodeHintType.POSSIBLE_FORMATS,f),h.set(ut.DecodeHintType.TRY_HARDER,!1),this.hints=h}return o.prototype.decodeAsync=function(s){var i=this;return new Promise(function(u,f){try{u(i.decode(s))}catch(h){f(h)}})},o.prototype.decode=function(s){var i=new ut.MultiFormatReader(this.verbose,this.hints),u=new ut.HTMLCanvasElementLuminanceSource(s),f=new ut.BinaryBitmap(new ut.HybridBinarizer(u)),h=i.decode(f);return{text:h.text,format:ga.create(this.toHtml5QrcodeSupportedFormats(h.format)),debugData:this.createDebugData()}},o.prototype.createReverseFormatMap=function(){var s=new Map;return this.formatMap.forEach(function(i,u,f){s.set(i,u)}),s},o.prototype.toHtml5QrcodeSupportedFormats=function(s){if(!this.reverseFormatMap.has(s))throw"reverseFormatMap doesn't have ".concat(s);return this.reverseFormatMap.get(s)},o.prototype.createZXingFormats=function(s){for(var i=[],u=0,f=s;u<f.length;u++){var h=f[u];this.formatMap.has(h)?i.push(this.formatMap.get(h)):this.logger.logError("".concat(h," is not supported by")+"ZXingHtml5QrcodeShim")}return i},o.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},o}(),jh=function(o,s,i,u){function f(h){return h instanceof i?h:new i(function(m){m(h)})}return new(i||(i=Promise))(function(h,m){function x(C){try{p(u.next(C))}catch(y){m(y)}}function _(C){try{p(u.throw(C))}catch(y){m(y)}}function p(C){C.done?h(C.value):f(C.value).then(x,_)}p((u=u.apply(o,s||[])).next())})},qh=function(o,s){var i={label:0,sent:function(){if(h[0]&1)throw h[1];return h[1]},trys:[],ops:[]},u,f,h,m;return m={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function x(p){return function(C){return _([p,C])}}function _(p){if(u)throw new TypeError("Generator is already executing.");for(;m&&(m=0,p[0]&&(i=0)),i;)try{if(u=1,f&&(h=p[0]&2?f.return:p[0]?f.throw||((h=f.return)&&h.call(f),0):f.next)&&!(h=h.call(f,p[1])).done)return h;switch(f=0,h&&(p=[p[0]&2,h.value]),p[0]){case 0:case 1:h=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,f=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(h=i.trys,!(h=h.length>0&&h[h.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!h||p[1]>h[0]&&p[1]<h[3])){i.label=p[1];break}if(p[0]===6&&i.label<h[1]){i.label=h[1],h=p;break}if(h&&i.label<h[2]){i.label=h[2],i.ops.push(p);break}h[2]&&i.ops.pop(),i.trys.pop();continue}p=s.call(o,i)}catch(C){p=[6,C],f=0}finally{u=h=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},wa=function(){function o(s,i,u){if(this.formatMap=new Map([[pe.QR_CODE,"qr_code"],[pe.AZTEC,"aztec"],[pe.CODABAR,"codabar"],[pe.CODE_39,"code_39"],[pe.CODE_93,"code_93"],[pe.CODE_128,"code_128"],[pe.DATA_MATRIX,"data_matrix"],[pe.ITF,"itf"],[pe.EAN_13,"ean_13"],[pe.EAN_8,"ean_8"],[pe.PDF_417,"pdf417"],[pe.UPC_A,"upc_a"],[pe.UPC_E,"upc_e"]]),this.reverseFormatMap=this.createReverseFormatMap(),!o.isSupported())throw"Use html5qrcode.min.js without edit, Use BarcodeDetectorDelegate only if it isSupported();";this.verbose=i,this.logger=u;var f=this.createBarcodeDetectorFormats(s);if(this.detector=new BarcodeDetector(f),!this.detector)throw"BarcodeDetector detector not supported"}return o.isSupported=function(){if(!("BarcodeDetector"in window))return!1;var s=new BarcodeDetector({formats:["qr_code"]});return typeof s<"u"},o.prototype.decodeAsync=function(s){return jh(this,void 0,void 0,function(){var i,u;return qh(this,function(f){switch(f.label){case 0:return[4,this.detector.detect(s)];case 1:if(i=f.sent(),!i||i.length===0)throw"No barcode or QR code detected.";return u=this.selectLargestBarcode(i),[2,{text:u.rawValue,format:ga.create(this.toHtml5QrcodeSupportedFormats(u.format)),debugData:this.createDebugData()}]}})})},o.prototype.selectLargestBarcode=function(s){for(var i=null,u=0,f=0,h=s;f<h.length;f++){var m=h[f],x=m.boundingBox.width*m.boundingBox.height;x>u&&(u=x,i=m)}if(!i)throw"No largest barcode found";return i},o.prototype.createBarcodeDetectorFormats=function(s){for(var i=[],u=0,f=s;u<f.length;u++){var h=f[u];this.formatMap.has(h)?i.push(this.formatMap.get(h)):this.logger.warn("".concat(h," is not supported by")+"BarcodeDetectorDelegate")}return{formats:i}},o.prototype.toHtml5QrcodeSupportedFormats=function(s){if(!this.reverseFormatMap.has(s))throw"reverseFormatMap doesn't have ".concat(s);return this.reverseFormatMap.get(s)},o.prototype.createReverseFormatMap=function(){var s=new Map;return this.formatMap.forEach(function(i,u,f){s.set(i,u)}),s},o.prototype.createDebugData=function(){return{decoderName:"BarcodeDetector"}},o}(),_a=function(o,s,i,u){function f(h){return h instanceof i?h:new i(function(m){m(h)})}return new(i||(i=Promise))(function(h,m){function x(C){try{p(u.next(C))}catch(y){m(y)}}function _(C){try{p(u.throw(C))}catch(y){m(y)}}function p(C){C.done?h(C.value):f(C.value).then(x,_)}p((u=u.apply(o,s||[])).next())})},Ca=function(o,s){var i={label:0,sent:function(){if(h[0]&1)throw h[1];return h[1]},trys:[],ops:[]},u,f,h,m;return m={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function x(p){return function(C){return _([p,C])}}function _(p){if(u)throw new TypeError("Generator is already executing.");for(;m&&(m=0,p[0]&&(i=0)),i;)try{if(u=1,f&&(h=p[0]&2?f.return:p[0]?f.throw||((h=f.return)&&h.call(f),0):f.next)&&!(h=h.call(f,p[1])).done)return h;switch(f=0,h&&(p=[p[0]&2,h.value]),p[0]){case 0:case 1:h=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,f=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(h=i.trys,!(h=h.length>0&&h[h.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!h||p[1]>h[0]&&p[1]<h[3])){i.label=p[1];break}if(p[0]===6&&i.label<h[1]){i.label=h[1],h=p;break}if(h&&i.label<h[2]){i.label=h[2],i.ops.push(p);break}h[2]&&i.ops.pop(),i.trys.pop();continue}p=s.call(o,i)}catch(C){p=[6,C],f=0}finally{u=h=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},Zh=function(){function o(s,i,u,f){this.EXECUTIONS_TO_REPORT_PERFORMANCE=100,this.executions=0,this.executionResults=[],this.wasPrimaryDecoderUsedInLastDecode=!1,this.verbose=u,i&&wa.isSupported()?(this.primaryDecoder=new wa(s,u,f),this.secondaryDecoder=new xa(s,u,f)):this.primaryDecoder=new xa(s,u,f)}return o.prototype.decodeAsync=function(s){return _a(this,void 0,void 0,function(){var i;return Ca(this,function(u){switch(u.label){case 0:i=performance.now(),u.label=1;case 1:return u.trys.push([1,,3,4]),[4,this.getDecoder().decodeAsync(s)];case 2:return[2,u.sent()];case 3:return this.possiblyLogPerformance(i),[7];case 4:return[2]}})})},o.prototype.decodeRobustlyAsync=function(s){return _a(this,void 0,void 0,function(){var i,u;return Ca(this,function(f){switch(f.label){case 0:i=performance.now(),f.label=1;case 1:return f.trys.push([1,3,4,5]),[4,this.primaryDecoder.decodeAsync(s)];case 2:return[2,f.sent()];case 3:if(u=f.sent(),this.secondaryDecoder)return[2,this.secondaryDecoder.decodeAsync(s)];throw u;case 4:return this.possiblyLogPerformance(i),[7];case 5:return[2]}})})},o.prototype.getDecoder=function(){return this.secondaryDecoder?this.wasPrimaryDecoderUsedInLastDecode===!1?(this.wasPrimaryDecoderUsedInLastDecode=!0,this.primaryDecoder):(this.wasPrimaryDecoderUsedInLastDecode=!1,this.secondaryDecoder):this.primaryDecoder},o.prototype.possiblyLogPerformance=function(s){if(this.verbose){var i=performance.now()-s;this.executionResults.push(i),this.executions++,this.possiblyFlushPerformanceReport()}},o.prototype.possiblyFlushPerformanceReport=function(){if(!(this.executions<this.EXECUTIONS_TO_REPORT_PERFORMANCE)){for(var s=0,i=0,u=this.executionResults;i<u.length;i++){var f=u[i];s+=f}var h=s/this.executionResults.length;console.log("".concat(h," ms for ").concat(this.executionResults.length," last runs.")),this.executions=0,this.executionResults=[]}},o}(),wo=function(){var o=function(s,i){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,f){u.__proto__=f}||function(u,f){for(var h in f)Object.prototype.hasOwnProperty.call(f,h)&&(u[h]=f[h])},o(s,i)};return function(s,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");o(s,i);function u(){this.constructor=s}s.prototype=i===null?Object.create(i):(u.prototype=i.prototype,new u)}}(),wi=function(o,s,i,u){function f(h){return h instanceof i?h:new i(function(m){m(h)})}return new(i||(i=Promise))(function(h,m){function x(C){try{p(u.next(C))}catch(y){m(y)}}function _(C){try{p(u.throw(C))}catch(y){m(y)}}function p(C){C.done?h(C.value):f(C.value).then(x,_)}p((u=u.apply(o,s||[])).next())})},_i=function(o,s){var i={label:0,sent:function(){if(h[0]&1)throw h[1];return h[1]},trys:[],ops:[]},u,f,h,m;return m={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function x(p){return function(C){return _([p,C])}}function _(p){if(u)throw new TypeError("Generator is already executing.");for(;m&&(m=0,p[0]&&(i=0)),i;)try{if(u=1,f&&(h=p[0]&2?f.return:p[0]?f.throw||((h=f.return)&&h.call(f),0):f.next)&&!(h=h.call(f,p[1])).done)return h;switch(f=0,h&&(p=[p[0]&2,h.value]),p[0]){case 0:case 1:h=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,f=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(h=i.trys,!(h=h.length>0&&h[h.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!h||p[1]>h[0]&&p[1]<h[3])){i.label=p[1];break}if(p[0]===6&&i.label<h[1]){i.label=h[1],h=p;break}if(h&&i.label<h[2]){i.label=h[2],i.ops.push(p);break}h[2]&&i.ops.pop(),i.trys.pop();continue}p=s.call(o,i)}catch(C){p=[6,C],f=0}finally{u=h=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},Ea=function(){function o(s,i){this.name=s,this.track=i}return o.prototype.isSupported=function(){return this.track.getCapabilities?this.name in this.track.getCapabilities():!1},o.prototype.apply=function(s){var i={};i[this.name]=s;var u={advanced:[i]};return this.track.applyConstraints(u)},o.prototype.value=function(){var s=this.track.getSettings();if(this.name in s){var i=s[this.name];return i}return null},o}(),Yh=function(o){wo(s,o);function s(i,u){return o.call(this,i,u)||this}return s.prototype.min=function(){return this.getCapabilities().min},s.prototype.max=function(){return this.getCapabilities().max},s.prototype.step=function(){return this.getCapabilities().step},s.prototype.apply=function(i){var u={};u[this.name]=i;var f={advanced:[u]};return this.track.applyConstraints(f)},s.prototype.getCapabilities=function(){this.failIfNotSupported();var i=this.track.getCapabilities(),u=i[this.name];return{min:u.min,max:u.max,step:u.step}},s.prototype.failIfNotSupported=function(){if(!this.isSupported())throw new Error("".concat(this.name," capability not supported"))},s}(Ea),$h=function(o){wo(s,o);function s(i){return o.call(this,"zoom",i)||this}return s}(Yh),Kh=function(o){wo(s,o);function s(i){return o.call(this,"torch",i)||this}return s}(Ea),Qh=function(){function o(s){this.track=s}return o.prototype.zoomFeature=function(){return new $h(this.track)},o.prototype.torchFeature=function(){return new Kh(this.track)},o}(),Jh=function(){function o(s,i,u){this.isClosed=!1,this.parentElement=s,this.mediaStream=i,this.callbacks=u,this.surface=this.createVideoElement(this.parentElement.clientWidth),s.append(this.surface)}return o.prototype.createVideoElement=function(s){var i=document.createElement("video");return i.style.width="".concat(s,"px"),i.style.display="block",i.muted=!0,i.setAttribute("muted","true"),i.playsInline=!0,i},o.prototype.setupSurface=function(){var s=this;this.surface.onabort=function(){throw"RenderedCameraImpl video surface onabort() called"},this.surface.onerror=function(){throw"RenderedCameraImpl video surface onerror() called"};var i=function(){var u=s.surface.clientWidth,f=s.surface.clientHeight;s.callbacks.onRenderSurfaceReady(u,f),s.surface.removeEventListener("playing",i)};this.surface.addEventListener("playing",i),this.surface.srcObject=this.mediaStream,this.surface.play()},o.create=function(s,i,u,f){return wi(this,void 0,void 0,function(){var h,m;return _i(this,function(x){switch(x.label){case 0:return h=new o(s,i,f),u.aspectRatio?(m={aspectRatio:u.aspectRatio},[4,h.getFirstTrackOrFail().applyConstraints(m)]):[3,2];case 1:x.sent(),x.label=2;case 2:return h.setupSurface(),[2,h]}})})},o.prototype.failIfClosed=function(){if(this.isClosed)throw"The RenderedCamera has already been closed."},o.prototype.getFirstTrackOrFail=function(){if(this.failIfClosed(),this.mediaStream.getVideoTracks().length===0)throw"No video tracks found";return this.mediaStream.getVideoTracks()[0]},o.prototype.pause=function(){this.failIfClosed(),this.surface.pause()},o.prototype.resume=function(s){this.failIfClosed();var i=this,u=function(){setTimeout(s,200),i.surface.removeEventListener("playing",u)};this.surface.addEventListener("playing",u),this.surface.play()},o.prototype.isPaused=function(){return this.failIfClosed(),this.surface.paused},o.prototype.getSurface=function(){return this.failIfClosed(),this.surface},o.prototype.getRunningTrackCapabilities=function(){return this.getFirstTrackOrFail().getCapabilities()},o.prototype.getRunningTrackSettings=function(){return this.getFirstTrackOrFail().getSettings()},o.prototype.applyVideoConstraints=function(s){return wi(this,void 0,void 0,function(){return _i(this,function(i){if("aspectRatio"in s)throw"Changing 'aspectRatio' in run-time is not yet supported.";return[2,this.getFirstTrackOrFail().applyConstraints(s)]})})},o.prototype.close=function(){if(this.isClosed)return Promise.resolve();var s=this;return new Promise(function(i,u){var f=s.mediaStream.getVideoTracks(),h=f.length,m=0;s.mediaStream.getVideoTracks().forEach(function(x){s.mediaStream.removeTrack(x),x.stop(),++m,m>=h&&(s.isClosed=!0,s.parentElement.removeChild(s.surface),i())})})},o.prototype.getCapabilities=function(){return new Qh(this.getFirstTrackOrFail())},o}(),e2=function(){function o(s){this.mediaStream=s}return o.prototype.render=function(s,i,u){return wi(this,void 0,void 0,function(){return _i(this,function(f){return[2,Jh.create(s,this.mediaStream,i,u)]})})},o.create=function(s){return wi(this,void 0,void 0,function(){var i,u;return _i(this,function(f){switch(f.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return i={audio:!1,video:s},[4,navigator.mediaDevices.getUserMedia(i)];case 1:return u=f.sent(),[2,new o(u)]}})})},o}(),ya=function(o,s,i,u){function f(h){return h instanceof i?h:new i(function(m){m(h)})}return new(i||(i=Promise))(function(h,m){function x(C){try{p(u.next(C))}catch(y){m(y)}}function _(C){try{p(u.throw(C))}catch(y){m(y)}}function p(C){C.done?h(C.value):f(C.value).then(x,_)}p((u=u.apply(o,s||[])).next())})},ba=function(o,s){var i={label:0,sent:function(){if(h[0]&1)throw h[1];return h[1]},trys:[],ops:[]},u,f,h,m;return m={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function x(p){return function(C){return _([p,C])}}function _(p){if(u)throw new TypeError("Generator is already executing.");for(;m&&(m=0,p[0]&&(i=0)),i;)try{if(u=1,f&&(h=p[0]&2?f.return:p[0]?f.throw||((h=f.return)&&h.call(f),0):f.next)&&!(h=h.call(f,p[1])).done)return h;switch(f=0,h&&(p=[p[0]&2,h.value]),p[0]){case 0:case 1:h=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,f=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(h=i.trys,!(h=h.length>0&&h[h.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!h||p[1]>h[0]&&p[1]<h[3])){i.label=p[1];break}if(p[0]===6&&i.label<h[1]){i.label=h[1],h=p;break}if(h&&i.label<h[2]){i.label=h[2],i.ops.push(p);break}h[2]&&i.ops.pop(),i.trys.pop();continue}p=s.call(o,i)}catch(C){p=[6,C],f=0}finally{u=h=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},t2=function(){function o(){}return o.failIfNotSupported=function(){return ya(this,void 0,void 0,function(){return ba(this,function(s){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new o]})})},o.prototype.create=function(s){return ya(this,void 0,void 0,function(){return ba(this,function(i){return[2,e2.create(s)]})})},o}(),n2=function(o,s,i,u){function f(h){return h instanceof i?h:new i(function(m){m(h)})}return new(i||(i=Promise))(function(h,m){function x(C){try{p(u.next(C))}catch(y){m(y)}}function _(C){try{p(u.throw(C))}catch(y){m(y)}}function p(C){C.done?h(C.value):f(C.value).then(x,_)}p((u=u.apply(o,s||[])).next())})},r2=function(o,s){var i={label:0,sent:function(){if(h[0]&1)throw h[1];return h[1]},trys:[],ops:[]},u,f,h,m;return m={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function x(p){return function(C){return _([p,C])}}function _(p){if(u)throw new TypeError("Generator is already executing.");for(;m&&(m=0,p[0]&&(i=0)),i;)try{if(u=1,f&&(h=p[0]&2?f.return:p[0]?f.throw||((h=f.return)&&h.call(f),0):f.next)&&!(h=h.call(f,p[1])).done)return h;switch(f=0,h&&(p=[p[0]&2,h.value]),p[0]){case 0:case 1:h=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,f=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(h=i.trys,!(h=h.length>0&&h[h.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!h||p[1]>h[0]&&p[1]<h[3])){i.label=p[1];break}if(p[0]===6&&i.label<h[1]){i.label=h[1],h=p;break}if(h&&i.label<h[2]){i.label=h[2],i.ops.push(p);break}h[2]&&i.ops.pop(),i.trys.pop();continue}p=s.call(o,i)}catch(C){p=[6,C],f=0}finally{u=h=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},i2=function(){function o(){}return o.retrieve=function(){if(navigator.mediaDevices)return o.getCamerasFromMediaDevices();var s=MediaStreamTrack;return MediaStreamTrack&&s.getSources?o.getCamerasFromMediaStreamTrack():o.rejectWithError()},o.rejectWithError=function(){var s=xr.unableToQuerySupportedDevices();return o.isHttpsOrLocalhost()||(s=xr.insecureContextCameraQueryError()),Promise.reject(s)},o.isHttpsOrLocalhost=function(){if(location.protocol==="https:")return!0;var s=location.host.split(":")[0];return s==="127.0.0.1"||s==="localhost"},o.getCamerasFromMediaDevices=function(){return n2(this,void 0,void 0,function(){var s,i,u,f,h,m,x;return r2(this,function(_){switch(_.label){case 0:return s=function(p){for(var C=p.getVideoTracks(),y=0,S=C;y<S.length;y++){var B=S[y];B.enabled=!1,B.stop(),p.removeTrack(B)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return i=_.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(u=_.sent(),f=[],h=0,m=u;h<m.length;h++)x=m[h],x.kind==="videoinput"&&f.push({id:x.deviceId,label:x.label});return s(i),[2,f]}})})},o.getCamerasFromMediaStreamTrack=function(){return new Promise(function(s,i){var u=function(h){for(var m=[],x=0,_=h;x<_.length;x++){var p=_[x];p.kind==="video"&&m.push({id:p.id,label:p.label})}s(m)},f=MediaStreamTrack;f.getSources(u)})},o}(),wt;(function(o){o[o.UNKNOWN=0]="UNKNOWN",o[o.NOT_STARTED=1]="NOT_STARTED",o[o.SCANNING=2]="SCANNING",o[o.PAUSED=3]="PAUSED"})(wt||(wt={}));var o2=function(){function o(){this.state=wt.NOT_STARTED,this.onGoingTransactionNewState=wt.UNKNOWN}return o.prototype.directTransition=function(s){this.failIfTransitionOngoing(),this.validateTransition(s),this.state=s},o.prototype.startTransition=function(s){return this.failIfTransitionOngoing(),this.validateTransition(s),this.onGoingTransactionNewState=s,this},o.prototype.execute=function(){if(this.onGoingTransactionNewState===wt.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var s=this.onGoingTransactionNewState;this.onGoingTransactionNewState=wt.UNKNOWN,this.directTransition(s)},o.prototype.cancel=function(){if(this.onGoingTransactionNewState===wt.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=wt.UNKNOWN},o.prototype.getState=function(){return this.state},o.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==wt.UNKNOWN)throw"Cannot transition to a new state, already under transition"},o.prototype.validateTransition=function(s){switch(this.state){case wt.UNKNOWN:throw"Transition from unknown is not allowed";case wt.NOT_STARTED:this.failIfNewStateIs(s,[wt.PAUSED]);break;case wt.SCANNING:break;case wt.PAUSED:break}},o.prototype.failIfNewStateIs=function(s,i){for(var u=0,f=i;u<f.length;u++){var h=f[u];if(s===h)throw"Cannot transition from ".concat(this.state," to ").concat(s)}},o}(),s2=function(){function o(s){this.stateManager=s}return o.prototype.startTransition=function(s){return this.stateManager.startTransition(s)},o.prototype.directTransition=function(s){this.stateManager.directTransition(s)},o.prototype.getState=function(){return this.stateManager.getState()},o.prototype.canScanFile=function(){return this.stateManager.getState()===wt.NOT_STARTED},o.prototype.isScanning=function(){return this.stateManager.getState()!==wt.NOT_STARTED},o.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===wt.SCANNING},o.prototype.isPaused=function(){return this.stateManager.getState()===wt.PAUSED},o}(),a2=function(){function o(){}return o.create=function(){return new s2(new o2)},o}(),l2=function(){var o=function(s,i){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,f){u.__proto__=f}||function(u,f){for(var h in f)Object.prototype.hasOwnProperty.call(f,h)&&(u[h]=f[h])},o(s,i)};return function(s,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");o(s,i);function u(){this.constructor=s}s.prototype=i===null?Object.create(i):(u.prototype=i.prototype,new u)}}(),on=function(o){l2(s,o);function s(){return o!==null&&o.apply(this,arguments)||this}return s.DEFAULT_WIDTH=300,s.DEFAULT_WIDTH_OFFSET=2,s.FILE_SCAN_MIN_HEIGHT=300,s.FILE_SCAN_HIDDEN_CANVAS_PADDING=100,s.MIN_QR_BOX_SIZE=50,s.SHADED_LEFT=1,s.SHADED_RIGHT=2,s.SHADED_TOP=3,s.SHADED_BOTTOM=4,s.SHADED_REGION_ELEMENT_ID="qr-shaded-region",s.VERBOSE=!1,s.BORDER_SHADER_DEFAULT_COLOR="#ffffff",s.BORDER_SHADER_MATCH_COLOR="rgb(90, 193, 56)",s}(Hh),c2=function(){function o(s,i){this.logger=i,this.fps=on.SCAN_DEFAULT_FPS,s?(s.fps&&(this.fps=s.fps),this.disableFlip=s.disableFlip===!0,this.qrbox=s.qrbox,this.aspectRatio=s.aspectRatio,this.videoConstraints=s.videoConstraints):this.disableFlip=on.DEFAULT_DISABLE_FLIP}return o.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?pa.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},o.prototype.isShadedBoxEnabled=function(){return!Ln(this.qrbox)},o.create=function(s,i){return new o(s,i)},o}(),Aa=function(){function o(s,i){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(s))throw"HTML Element with id=".concat(s," not found");this.elementId=s,this.verbose=!1;var u;typeof i=="boolean"?this.verbose=i===!0:i&&(u=i,this.verbose=u.verbose===!0,u.experimentalFeatures),this.logger=new Wh(this.verbose),this.qrcode=new Zh(this.getSupportedFormats(i),this.getUseBarCodeDetectorIfSupported(u),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=a2.create()}return o.prototype.start=function(s,i,u,f){var h=this;if(!s)throw"cameraIdOrConfig is required";if(!u||typeof u!="function")throw"qrCodeSuccessCallback is required and should be a function.";var m;f?m=f:m=this.verbose?this.logger.log:function(){};var x=c2.create(i,this.logger);this.clearElement();var _=!1;x.videoConstraints&&(x.isMediaStreamConstraintsValid()?_=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var p=_,C=document.getElementById(this.elementId);C.clientWidth?C.clientWidth:on.DEFAULT_WIDTH,C.style.position="relative",this.shouldScan=!0,this.element=C;var y=this,S=this.stateManagerProxy.startTransition(wt.SCANNING);return new Promise(function(B,T){var D=p?x.videoConstraints:y.createVideoConstraints(s);if(!D){S.cancel(),T("videoConstraints should be defined");return}var v={};(!p||x.aspectRatio)&&(v.aspectRatio=x.aspectRatio);var U={onRenderSurfaceReady:function(P,O){y.setupUi(P,O,x),y.isScanning=!0,y.foreverScan(x,u,m)}};t2.failIfNotSupported().then(function(P){P.create(D).then(function(O){return O.render(h.element,v,U).then(function(M){y.renderedCamera=M,S.execute(),B(null)}).catch(function(M){S.cancel(),T(M)})}).catch(function(O){S.cancel(),T(xr.errorGettingUserMedia(O))})}).catch(function(P){S.cancel(),T(xr.cameraStreamingNotSupported())})})},o.prototype.pause=function(s){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(wt.PAUSED),this.showPausedState(),(Ln(s)||s!==!0)&&(s=!1),s&&this.renderedCamera&&this.renderedCamera.pause()},o.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 s=this,i=function(){s.stateManagerProxy.directTransition(wt.SCANNING),s.hidePausedState()};if(!this.renderedCamera.isPaused()){i();return}this.renderedCamera.resume(function(){i()})},o.prototype.getState=function(){return this.stateManagerProxy.getState()},o.prototype.stop=function(){var s=this;if(!this.stateManagerProxy.isScanning())throw"Cannot stop, scanner is not running or paused.";var i=this.stateManagerProxy.startTransition(wt.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var u=function(){if(s.element){var h=document.getElementById(on.SHADED_REGION_ELEMENT_ID);h&&s.element.removeChild(h)}},f=this;return this.renderedCamera.close().then(function(){return f.renderedCamera=null,f.element&&(f.element.removeChild(f.canvasElement),f.canvasElement=null),u(),f.qrRegion&&(f.qrRegion=null),f.context&&(f.context=null),i.execute(),f.hidePausedState(),f.isScanning=!1,Promise.resolve()})},o.prototype.scanFile=function(s,i){return this.scanFileV2(s,i).then(function(u){return u.decodedText})},o.prototype.scanFileV2=function(s,i){var u=this;if(!s||!(s instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(Ln(i)&&(i=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(f,h){u.possiblyCloseLastScanImageFile(),u.clearElement(),u.lastScanImageFile=URL.createObjectURL(s);var m=new Image;m.onload=function(){var x=m.width,_=m.height,p=document.getElementById(u.elementId),C=p.clientWidth?p.clientWidth:on.DEFAULT_WIDTH,y=Math.max(p.clientHeight?p.clientHeight:_,on.FILE_SCAN_MIN_HEIGHT),S=u.computeCanvasDrawConfig(x,_,C,y);if(i){var B=u.createCanvasElement(C,y,"qr-canvas-visible");B.style.display="inline-block",p.appendChild(B);var T=B.getContext("2d");if(!T)throw"Unable to get 2d context from canvas";T.canvas.width=C,T.canvas.height=y,T.drawImage(m,0,0,x,_,S.x,S.y,S.width,S.height)}var D=on.FILE_SCAN_HIDDEN_CANVAS_PADDING,v=Math.max(m.width,S.width),U=Math.max(m.height,S.height),P=v+2*D,O=U+2*D,M=u.createCanvasElement(P,O);p.appendChild(M);var K=M.getContext("2d");if(!K)throw"Unable to get 2d context from canvas";K.canvas.width=P,K.canvas.height=O,K.drawImage(m,0,0,x,_,D,D,v,U);try{u.qrcode.decodeRobustlyAsync(M).then(function(Q){f(ma.createFromQrcodeResult(Q))}).catch(h)}catch(Q){h("QR code parse error, error = ".concat(Q))}},m.onerror=h,m.onabort=h,m.onstalled=h,m.onsuspend=h,m.src=URL.createObjectURL(s)})},o.prototype.clear=function(){this.clearElement()},o.getCameras=function(){return i2.retrieve()},o.prototype.getRunningTrackCapabilities=function(){return this.getRenderedCameraOrFail().getRunningTrackCapabilities()},o.prototype.getRunningTrackSettings=function(){return this.getRenderedCameraOrFail().getRunningTrackSettings()},o.prototype.getRunningTrackCameraCapabilities=function(){return this.getRenderedCameraOrFail().getCapabilities()},o.prototype.applyVideoConstraints=function(s){if(s){if(!pa.isMediaStreamConstraintsValid(s,this.logger))throw"invalid videoConstaints passed, check logs for more details"}else throw"videoConstaints is required argument.";return this.getRenderedCameraOrFail().applyVideoConstraints(s)},o.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},o.prototype.getSupportedFormats=function(s){var i=[pe.QR_CODE,pe.AZTEC,pe.CODABAR,pe.CODE_39,pe.CODE_93,pe.CODE_128,pe.DATA_MATRIX,pe.MAXICODE,pe.ITF,pe.EAN_13,pe.EAN_8,pe.PDF_417,pe.RSS_14,pe.RSS_EXPANDED,pe.UPC_A,pe.UPC_E,pe.UPC_EAN_EXTENSION];if(!s||typeof s=="boolean"||!s.formatsToSupport)return i;if(!Array.isArray(s.formatsToSupport))throw"configOrVerbosityFlag.formatsToSupport should be undefined or an array.";if(s.formatsToSupport.length===0)throw"Atleast 1 formatsToSupport is needed.";for(var u=[],f=0,h=s.formatsToSupport;f<h.length;f++){var m=h[f];zh(m)?u.push(m):this.logger.warn("Invalid format: ".concat(m," passed in config, ignoring."))}if(u.length===0)throw"None of formatsToSupport match supported values.";return u},o.prototype.getUseBarCodeDetectorIfSupported=function(s){if(Ln(s))return!0;if(!Ln(s.useBarCodeDetectorIfSupported))return s.useBarCodeDetectorIfSupported!==!1;if(Ln(s.experimentalFeatures))return!0;var i=s.experimentalFeatures;return Ln(i.useBarCodeDetectorIfSupported)?!0:i.useBarCodeDetectorIfSupported!==!1},o.prototype.validateQrboxSize=function(s,i,u){var f=this,h=u.qrbox;this.validateQrboxConfig(h);var m=this.toQrdimensions(s,i,h),x=function(p){if(p<on.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(on.MIN_QR_BOX_SIZE,"px.")},_=function(p){return p>s&&(f.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."),p=s),p};x(m.width),x(m.height),m.width=_(m.width)},o.prototype.validateQrboxConfig=function(s){if(typeof s!="number"&&typeof s!="function"&&(s.width===void 0||s.height===void 0))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},o.prototype.toQrdimensions=function(s,i,u){if(typeof u=="number")return{width:u,height:u};if(typeof u=="function")try{return u(s,i)}catch(f){throw new Error("qrbox config was passed as a function but it failed with unknown error"+f)}return u},o.prototype.setupUi=function(s,i,u){u.isShadedBoxEnabled()&&this.validateQrboxSize(s,i,u);var f=Ln(u.qrbox)?{width:s,height:i}:u.qrbox;this.validateQrboxConfig(f);var h=this.toQrdimensions(s,i,f);h.height>i&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var m=u.isShadedBoxEnabled()&&h.height<=i,x={x:0,y:0,width:s,height:i},_=m?this.getShadedRegionBounds(s,i,h):x,p=this.createCanvasElement(_.width,_.height),C={willReadFrequently:!0},y=p.getContext("2d",C);y.canvas.width=_.width,y.canvas.height=_.height,this.element.append(p),m&&this.possiblyInsertShadingElement(this.element,s,i,h),this.createScannerPausedUiElement(this.element),this.qrRegion=_,this.context=y,this.canvasElement=p},o.prototype.createScannerPausedUiElement=function(s){var i=document.createElement("div");i.innerText=xr.scannerPaused(),i.style.display="none",i.style.position="absolute",i.style.top="0px",i.style.zIndex="1",i.style.background="rgba(9, 9, 9, 0.46)",i.style.color="#FFECEC",i.style.textAlign="center",i.style.width="100%",s.appendChild(i),this.scannerPausedUiElement=i},o.prototype.scanContext=function(s,i){var u=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(f){return s(f.text,ma.createFromQrcodeResult(f)),u.possiblyUpdateShaders(!0),!0}).catch(function(f){u.possiblyUpdateShaders(!1);var h=xr.codeParseError(f);return i(h,Gh.createFrom(h)),!1})},o.prototype.foreverScan=function(s,i,u){var f=this;if(this.shouldScan&&this.renderedCamera){var h=this.renderedCamera.getSurface(),m=h.videoWidth/h.clientWidth,x=h.videoHeight/h.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var _=this.qrRegion.width*m,p=this.qrRegion.height*x,C=this.qrRegion.x*m,y=this.qrRegion.y*x;this.context.drawImage(h,C,y,_,p,0,0,this.qrRegion.width,this.qrRegion.height);var S=function(){f.foreverScanTimeout=setTimeout(function(){f.foreverScan(s,i,u)},f.getTimeoutFps(s.fps))};this.scanContext(i,u).then(function(B){!B&&s.disableFlip!==!0?(f.context.translate(f.context.canvas.width,0),f.context.scale(-1,1),f.scanContext(i,u).finally(function(){S()})):S()}).catch(function(B){f.logger.logError("Error happend while scanning context",B),S()})}},o.prototype.createVideoConstraints=function(s){if(typeof s=="string")return{deviceId:{exact:s}};if(typeof s=="object"){var i="facingMode",u="deviceId",f={user:!0,environment:!0},h="exact",m=function(T){if(T in f)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(T,"'")},x=Object.keys(s);if(x.length!==1)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(x.length," keys");var _=Object.keys(s)[0];if(_!==i&&_!==u)throw"Only '".concat(i,"' and '").concat(u,"' ")+" are supported for 'cameraIdOrConfig'";if(_===i){var p=s.facingMode;if(typeof p=="string"){if(m(p))return{facingMode:p}}else if(typeof p=="object")if(h in p){if(m(p["".concat(h)]))return{facingMode:{exact:p["".concat(h)]}}}else throw"'facingMode' should be string or object with"+" ".concat(h," as key.");else{var C=typeof p;throw"Invalid type of 'facingMode' = ".concat(C)}}else{var y=s.deviceId;if(typeof y=="string")return{deviceId:y};if(typeof y=="object"){if(h in y)return{deviceId:{exact:y["".concat(h)]}};throw"'deviceId' should be string or object with"+" ".concat(h," as key.")}else{var S=typeof y;throw"Invalid type of 'deviceId' = ".concat(S)}}}var B=typeof s;throw"Invalid type of 'cameraIdOrConfig' = ".concat(B)},o.prototype.computeCanvasDrawConfig=function(s,i,u,f){if(s<=u&&i<=f){var h=(u-s)/2,m=(f-i)/2;return{x:h,y:m,width:s,height:i}}else{var x=s,_=i;return s>u&&(i=u/s*i,s=u),i>f&&(s=f/i*s,i=f),this.logger.log("Image downsampled from "+"".concat(x,"X").concat(_)+" to ".concat(s,"X").concat(i,".")),this.computeCanvasDrawConfig(s,i,u,f)}},o.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var s=document.getElementById(this.elementId);s&&(s.innerHTML="")},o.prototype.possiblyUpdateShaders=function(s){this.qrMatch!==s&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(i){i.style.backgroundColor=s?on.BORDER_SHADER_MATCH_COLOR:on.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=s)},o.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},o.prototype.createCanvasElement=function(s,i,u){var f=s,h=i,m=document.createElement("canvas");return m.style.width="".concat(f,"px"),m.style.height="".concat(h,"px"),m.style.display="none",m.id=Ln(u)?"qr-canvas":u,m},o.prototype.getShadedRegionBounds=function(s,i,u){if(u.width>s||u.height>i)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(s-u.width)/2,y:(i-u.height)/2,width:u.width,height:u.height}},o.prototype.possiblyInsertShadingElement=function(s,i,u,f){if(!(i-f.width<1||u-f.height<1)){var h=document.createElement("div");h.style.position="absolute";var m=(i-f.width)/2,x=(u-f.height)/2;if(h.style.borderLeft="".concat(m,"px solid rgba(0, 0, 0, 0.48)"),h.style.borderRight="".concat(m,"px solid rgba(0, 0, 0, 0.48)"),h.style.borderTop="".concat(x,"px solid rgba(0, 0, 0, 0.48)"),h.style.borderBottom="".concat(x,"px solid rgba(0, 0, 0, 0.48)"),h.style.boxSizing="border-box",h.style.top="0px",h.style.bottom="0px",h.style.left="0px",h.style.right="0px",h.id="".concat(on.SHADED_REGION_ELEMENT_ID),i-f.width<11||u-f.height<11)this.hasBorderShaders=!1;else{var _=5,p=40;this.insertShaderBorders(h,p,_,-_,null,0,!0),this.insertShaderBorders(h,p,_,-_,null,0,!1),this.insertShaderBorders(h,p,_,null,-_,0,!0),this.insertShaderBorders(h,p,_,null,-_,0,!1),this.insertShaderBorders(h,_,p+_,-_,null,-_,!0),this.insertShaderBorders(h,_,p+_,null,-_,-_,!0),this.insertShaderBorders(h,_,p+_,-_,null,-_,!1),this.insertShaderBorders(h,_,p+_,null,-_,-_,!1),this.hasBorderShaders=!0}s.append(h)}},o.prototype.insertShaderBorders=function(s,i,u,f,h,m,x){var _=document.createElement("div");_.style.position="absolute",_.style.backgroundColor=on.BORDER_SHADER_DEFAULT_COLOR,_.style.width="".concat(i,"px"),_.style.height="".concat(u,"px"),f!==null&&(_.style.top="".concat(f,"px")),h!==null&&(_.style.bottom="".concat(h,"px")),x?_.style.left="".concat(m,"px"):_.style.right="".concat(m,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(_),s.appendChild(_)},o.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},o.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},o.prototype.getTimeoutFps=function(s){return 1e3/s},o}(),Ia;(function(o){o[o.STATUS_DEFAULT=0]="STATUS_DEFAULT",o[o.STATUS_SUCCESS=1]="STATUS_SUCCESS",o[o.STATUS_WARNING=2]="STATUS_WARNING",o[o.STATUS_REQUESTING_PERMISSION=3]="STATUS_REQUESTING_PERMISSION"})(Ia||(Ia={}));const u2={width:"38",height:"38",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"none"},d2=["stroke"],f2=["stroke"],h2=["stroke"],g2=["stroke"],m2=["stroke"],p2=l.defineComponent({__name:"QR",props:{color:{type:String,required:!1,default:"#FFFFFF"}},setup(o){return(s,i)=>(l.openBlock(),l.createElementBlock("svg",u2,[l.createElementVNode("path",{d:"M11 11H7V7h4ZM17 7h-2v2h2ZM13 17h4v-4h-4ZM7 17h2v-2H7Z",stroke:o.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,d2),l.createElementVNode("path",{d:"M8 3H4a1 1 0 0 0-1 1V8",stroke:o.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,f2),l.createElementVNode("path",{d:"M21 8V4a1 1 0 0 0-1-1H16",stroke:o.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,h2),l.createElementVNode("path",{d:"M3 16v4a1 1 0 0 0 1 1H8",stroke:o.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,g2),l.createElementVNode("path",{d:"M16 21h4a1 1 0 0 0 1-1V16",stroke:o.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,m2)]))}}),_o={back:["Задняя","Задней","Зад","e pasme","rear","back","atzekoa","задні","отзад","pozadi","cefn","hátulsó","traseira","achterkant","όπισθεν","bag","דערציען","cúil","aftan","trasero","posteriore","posterior","aizmugure","galinis","задниот дел","wara","hinteren","bak","tył","tyl","traseira","spate","задњи","zadný","zadaj","задній","takaosa","arrière","straga","zadní","bak","tagumine","environment","arxa","թիկունք","পিছনে","နောက်ဘက်","ở phía sau","უკანა","પાછળ","артқы","ಹಿಂದಿನ","後部","后部","뒤쪽","ខាងក្រោយ","ຫລັງ","പുറകിലുള്ള","मागील","арын","पछाडि","පසුපස","пушти","หลัง","பின்புறம்","వెనుక","arka","orqa","پیچھے","पिछला","qab","後方","مؤخرة","חלק אחורי","عقب","agter","ngemuva","azụ","leyin","kamorao","gadaale","nyuma","baya","kumbuyo","belakang","aoriana","belakang","muri","luyo","likuran","mburi","dèyè","tergo","malantaŭo"],front:["FaceTime","Передняя","përpara","front","aurrean","пярэдні","отпред","front","blaen","elülső","diante","voorkant","εμπρός","foran","פראָנט","tosaigh","framan","frente","davanti","davant","priekšā","priekyje","напред","quddiem","Vorderseite","front","przód","frente","față","фронт","vpredu","spredaj","перед","edessä","devant","ispred","přední","främre","ees","ön","ճակատ","সামনে","ရှေ့","đằng trước","წინა","આગળ","алдыңғы","ಮುಂಭಾಗ","正面","正面","앞쪽","ខាងមុខ","ດ້ານໜ້າ","മുന്നിൽ","समोर","урд","अगाडि","ඉදිරිපස","пеш","ด้านหน้า","முன்","ముందు","ön","old","سامنے","सामने","pem hauv ntej","フロント","أمام","חֲזִית","جلو","voor","ngaphambili","n'ihu","iwaju","ka pele","hore","mbele","gaba","kutsogolo","depan","anoloana","hadapan","mua","atubangan","harap","ngarep","devan","front","fronto"]},x2={key:0,class:"qr_text"},w2=l.defineComponent({__name:"QrCameraScanner",props:{axiosInstanceGet:{type:[Function,Object]},is_toggleAffiliation:{type:Boolean},is_notification:{type:Boolean},notificationData:{},tableData:{},isQr:{type:[Boolean,null]},takeDataTable:{type:Function}},emits:["update:tableData","update:notificationData","update:is_notification","update:is_toggleAffiliation"],setup(o,{emit:s}){const i=o;let u=null;const f=l.ref(!1),h=l.ref(!1),m=l.ref(!1),x=l.ref(!1);let _=null;const p=bt(),{itemThemes:C}=we.storeToRefs(p),y=s,S=U=>U.replace(/^[\s\S]*?((?:tel|sms|smsto|mailto|callto|facetime|viber|whatsapp):)?[\s\S]*?(%2B)?[\s\S]*?/i,(P,O,M)=>M?"+":""),B=async(U,P)=>{var Q,W,oe;if(console.log(U,P),x.value)return;i.isQr||(x.value=!0),v();const O=/[?&]table_id=([a-zA-Z0-9-]+)/,M=U.match(O),K=U.match(/\/([a-f0-9\-]{36})\?/);if(i.isQr){if(M&&K)return(Q=i.takeDataTable)==null?void 0:Q.call(i,K[1],M[1],"qr");{const V=localStorage.getItem("orgID");if(V){const ce=await i.axiosInstanceGet.get(`org_unit/${V}/table`,{params:{external_link:U}}).then(j=>{var G,z;return((G=j.data)==null?void 0:G.length)>0?(z=j.data[0])==null?void 0:z.id:null}).catch(()=>null);if(ce)return(W=i.takeDataTable)==null?void 0:W.call(i,V,ce)}}y("update:is_notification",!0),y("update:notificationData",{textNotification:"Стол не найден"}),y("update:tableData",null),y("update:is_toggleAffiliation",!0)}else{const V=new An,ce=U||P.text,j=S(ce);try{await V.authorizeByCard(j);const G=await V.getProfile();y("update:is_notification",!0),y("update:notificationData",{textNotification:`Здравствуйте, ${G.first_name}
|
|
31
|
+
Баланс: ${G.balance}`})}catch(G){y("update:is_notification",!0),y("update:notificationData",{textNotification:((oe=G.response)==null?void 0:oe.user_friendly_message)||"Карта не найдена"})}finally{m.value=!0,_&&clearTimeout(_),_=setTimeout(()=>{m.value=!1},2e3),x.value=!1}}};window.debugScan=B;const T=()=>{},D=async()=>{if(!(f.value||u!=null&&u.isScanning||m.value))try{f.value=!0;try{(await navigator.mediaDevices.getUserMedia({video:!0})).getTracks().forEach(Q=>Q.stop())}catch{y("update:is_notification",!0),y("update:notificationData",{textNotification:"Разрешите доступ к камере"}),f.value=!1,y("update:is_toggleAffiliation",!0);return}u=new Aa("reader");const U=await Aa.getCameras();if(!U||U.length===0){console.error("Камеры не найдены"),f.value=!1;return}let P;if(i.isQr)P=U.find(K=>_o.back.some(Q=>new RegExp(Q,"i").test(K.label))),P||(P=U.find(K=>_o.front.some(Q=>new RegExp(Q,"i").test(K.label))));else if(P=U.find(K=>_o.front.some(Q=>new RegExp(Q,"i").test(K.label))),P||(P=U.find(K=>new RegExp("amera","i").test(K.label))),!P){y("update:is_notification",!0),y("update:notificationData",{textNotification:"Не найдена фронтальная камера. Для сканирования карт нужна фронтальная камера."}),f.value=!1,y("update:is_toggleAffiliation",!0);return}const O=i.isQr?[pe.QR_CODE]:[pe.QR_CODE,pe.PDF_417,pe.EAN_13,pe.EAN_8,pe.CODE_128],M={fps:60,qrbox:{width:320,height:500}};await u.start(P.id,M,B,T,void 0,O),h.value=!0}catch(U){y("update:is_notification",!0),y("update:notificationData",{textNotification:"Разрешите доступ к камере для сканирования"}),console.error("Ошибка доступа к камере:",U),f.value=!1,h.value=!1,y("update:is_toggleAffiliation",!0)}},v=async()=>{if(u&&u.isScanning)try{await u.stop(),f.value=!1,u=null}catch(U){console.error("Ошибка остановки камеры:",U)}else f.value=!1,u=null,y("update:is_toggleAffiliation",!0);h.value=!1};return l.onUnmounted(()=>{f.value&&v(),_&&(clearTimeout(_),_=null),x.value=!1,m.value=!1,h.value=!1}),(U,P)=>(l.openBlock(),l.createElementBlock("div",null,[(l.openBlock(),l.createBlock(l.Teleport,{to:"body"},[l.withDirectives(l.createElementVNode("div",{class:"blackWindow",onClick:v},[P[0]||(P[0]=l.createElementVNode("div",{id:"reader"},null,-1)),h.value&&!o.isQr?(l.openBlock(),l.createElementBlock("p",x2,"Наведите QR на камеру")):l.createCommentVNode("",!0)],512),[[l.vShow,f.value]])])),l.createVNode(p2,{color:o.isQr?void 0:"#FFFFFF",onClick:D},null,8,["color"])]))}}),Co=we.defineStore("modulesLib",()=>{const o=l.ref(!1),s=l.ref({textNotification:""});return{is_notification_lib:o,notificationData_lib:s,showNotification:u=>{o.value=!0,s.value.textNotification=u}}}),Ci=Symbol("clickOutside"),_2={mounted(o,s){o[Ci]=i=>{o.contains(i.target)||s.value(i)},document.addEventListener("click",o[Ci])},unmounted(o){o[Ci]&&document.removeEventListener("click",o[Ci])}};class C2{constructor(s){We(this,"value");We(this,"next");this.value=s}}class E2{constructor(){Bi(this,Zt);Bi(this,zn);Bi(this,tr);this.clear()}enqueue(s){const i=new C2(s);gn(this,Zt)?(gn(this,zn).next=i,Bn(this,zn,i)):(Bn(this,Zt,i),Bn(this,zn,i)),zo(this,tr)._++}dequeue(){const s=gn(this,Zt);if(s)return Bn(this,Zt,gn(this,Zt).next),zo(this,tr)._--,gn(this,Zt)||Bn(this,zn,void 0),s.value}peek(){if(gn(this,Zt))return gn(this,Zt).value}clear(){Bn(this,Zt,void 0),Bn(this,zn,void 0),Bn(this,tr,0)}get size(){return gn(this,tr)}*[Symbol.iterator](){let s=gn(this,Zt);for(;s;)yield s.value,s=s.next}*drain(){for(;gn(this,Zt);)yield this.dequeue()}}Zt=new WeakMap,zn=new WeakMap,tr=new WeakMap;function y2(o){Sa(o);const s=new E2;let i=0;const u=()=>{i<o&&s.size>0&&(i++,s.dequeue()())},f=()=>{i--,u()},h=async(_,p,C)=>{const y=(async()=>_(...C))();p(y);try{await y}catch{}f()},m=(_,p,C)=>{new Promise(y=>{s.enqueue(y)}).then(h.bind(void 0,_,p,C)),i<o&&u()},x=(_,...p)=>new Promise(C=>{m(_,C,p)});return Object.defineProperties(x,{activeCount:{get:()=>i},pendingCount:{get:()=>s.size},clearQueue:{value(){s.clear()}},concurrency:{get:()=>o,set(_){Sa(_),o=_,queueMicrotask(()=>{for(;i<o&&s.size>0;)u()})}},map:{async value(_,p){const C=Array.from(_,(y,S)=>this(p,y,S));return Promise.all(C)}}}),x}function Sa(o){if(!((Number.isInteger(o)||o===Number.POSITIVE_INFINITY)&&o>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up")}let qt=null;const Na=y2(5),b2=async(o,s)=>{qt&&N2();const i=at(),u=bt(),f=Co(),h=Tt(),{itemThemes:m}=we.storeToRefs(u),{displayCards:x}=we.storeToRefs(i),{is_notification_lib:_,notificationData_lib:p}=we.storeToRefs(f),{stateCard:C,openProduct:y}=we.storeToRefs(h),S=An.create();await A2(o),qt=ri(`wss://${s}/ws/org-unit/${o}/`,{heartbeatTimeout:3e4}),qt.on("open",()=>console.warn("Realtime WebSocket подключён (pointId:",o,")")),qt.on("error",B=>console.warn("WebSocket ошибка:",B)),qt.on("close",()=>console.warn("Realtime WebSocket закрыт")),qt.on("message",async B=>{if(B.type)return;m.value.kiosk_hide_menu_update_notification||(p.value.textNotification="Мы обновили меню");const T=B.params||B,D=T.active_groups||[],v=T.updated_groups||[],U=T.updated_product_groups||[],P=await Yn(),O=new Set(D.map(j=>j)),M=new Map(x.value.map(j=>[j.id,j])),K=[],Q=P.transaction("groups","readwrite");let oe=await Q.objectStore("groups").openCursor();for(;oe;){const j=oe.key;!O.has(j)&&j!==o&&(K.push(j),await oe.delete(),M.delete(j)),oe=await oe.continue()}await Q.done,x.value=Array.from(M.values()),K.length>0&&await I2(O);const V=[...v.map(j=>Na(async()=>{const[G,z]=await Promise.all([S.getGroupByID(j),S.loadGroupProducts(j)]);G.products=z,M.set(j,G),await Rr(j,G),await ka(G,z,!0)})),...U.map(j=>Na(async()=>{const[G,z]=await Promise.all([S.getGroupByID(j),S.loadGroupProducts(j)]);G.products=z,M.set(j,G),await Rr(j,G),await ka(G,z,!0),await S2(z,j)}))];await Promise.all(V),x.value=Array.from(M.values()),await wl(o,x),p.value.textNotification.length>1&&(_.value=!0);const ce=C.value.openCard;if(ce!=null&&ce.id){const j=new Set(ce.groups??[]),G=new Set;let z=!1;for(const N of M.values()){const Y=N==null?void 0:N.products;if(!Array.isArray(Y))continue;const H=Y.find(te=>(te==null?void 0:te.id)===ce.id);if((H==null?void 0:H.adult)===!0){y.value={id:null,visible:!1},h.reset();return}H&&(N==null?void 0:N.id)!=null&&(G.add(N.id),(v.includes(N.id)||U.includes(N.id))&&(z=!0))}if(G.size===0){y.value={id:null,visible:!1},h.reset();return}(!(j.size===G.size&&[...j].every(N=>G.has(N)))||z)&&await S.getSingleProduct(ce==null?void 0:ce.id)}}),qt.connect()},A2=async o=>{try{const s=at(),i=await zi(o);i!=null&&i.data&&(s.displayCards=i.data)}catch(s){console.error("Ошибка загрузки кэша групп:",s)}},Ta=async o=>{const s=at(),i=Co(),u=Tt(),{stateCard:f,openProduct:h}=we.storeToRefs(u),{cartProducts_lib:m}=we.storeToRefs(s),x=m.value,_=[],p=[],C=f.value.openCard;for(const y of x)o(y)?(_.push(y),(y.id===(C==null?void 0:C.id)||C!=null&&C.adult)&&(h.value={id:null,visible:!1})):p.push(y);if(_.length>0){const y=_.map(S=>S.name).slice(0,3).join(", ");i.notificationData_lib.textNotification=`Некоторые позиции стали недоступны и были убраны из заказа: ${y}${_.length>3?` и ещё ${_.length-3}`:""}`,m.value=p,s.updateCartInLocalStorage()}},I2=async o=>{await Ta(s=>{var i;return(i=s.groups)!=null&&i.length?!s.groups.some(u=>o.has(u)):!0})},S2=async(o,s)=>{const i=at(),u=new Set(o.filter(f=>!f.adult||i.is18Allowed).map(f=>f.id));await Ta(f=>{var h;return(h=f.groups)!=null&&h.includes(s)?!u.has(f.id):!1})},ka=async(o,s,i=!0)=>{if(o.video_link&&Ei(o.video_link,`${o.id}_video`,i),o.image_link&&Ei(o.image_link,`${o.id}_image`,i),s!=null&&s.length)for(const u of s)u.video_link&&Ei(u.video_link,`${u.id}_video`,i),u.image_link&&Ei(u.image_link,`${u.id}_image`,i)},Ei=async(o,s,i=!1)=>{try{const u=ti();if(!i){const m=await cr(s);if(m){u.updateCacheFromBlob(s,m),window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:s,blob:m}}));return}}const f=await fetch(o);if(!f.ok)throw new Error("Network error");const h=await f.blob();if(h.size===0)throw new Error("Empty blob");await Hi(s,h),u.updateCacheFromBlob(s,h),window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:s,blob:h}}))}catch(u){console.warn(`[MediaCache] Failed for ${s}:`,u)}},N2=()=>{qt&&(qt.off("open"),qt.off("message"),qt.off("error"),qt.off("close"),qt.close(!0),qt=null)},T2={key:0,class:"valentine-hearts"},k2=l.defineComponent({__name:"FallingHearts",props:{symbols:{default:()=>["❤","♥","💕"]},max:{default:15},interval:{default:1500}},setup(o){const s=o,i=zt.useDocumentVisibility(),u=zt.useMediaQuery("(prefers-reduced-motion: reduce)"),f=l.ref([]);let h=null;const m=(C,y)=>Math.random()*(y-C)+C,x=()=>{if(u.value||f.value.length>=s.max)return;const C=s.symbols[Math.floor(Math.random()*s.symbols.length)],y=m(18,26),S=m(5,95),B=m(10,18),T=m(0,.3),D=m(.6,.9),v=Math.floor(m(1,6)),P={id:crypto.randomUUID(),icon:C,style:{left:`${S}%`,fontSize:`${y}px`,color:`rgba(255, 105, 180, ${D})`,animationName:`heartFall${v}`,animationDuration:`${B}s`,animationDelay:`${T}s`}};f.value.push(P);const M=setTimeout(()=>{f.value=f.value.filter(K=>K.id!==P.id),clearTimeout(M)},(T+B+1)*1e3)},_=()=>{if(!u.value){for(let C=0;C<3;C++){const y=setTimeout(()=>{x(),clearTimeout(y)},C*200)}h=setInterval(x,s.interval)}},p=()=>{h&&(clearInterval(h),h=null),f.value=[]};return l.onMounted(()=>{u.value||_()}),l.onUnmounted(()=>{p()}),l.watch(i,(C,y)=>{C==="visible"&&y==="hidden"&&_(),C==="hidden"&&y==="visible"&&p()}),(C,y)=>l.unref(u)?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("div",T2,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(f.value,S=>(l.openBlock(),l.createElementBlock("span",{key:S.id,class:"heart",style:l.normalizeStyle(S.style)},l.toDisplayString(S.icon),5))),128))]))}}),R2=["src"],O2=l.defineComponent({__name:"BasketImage",props:{id:{},fallback:{}},setup(o){const s=o,{mediaUrl:i}=Pn(()=>s.id,()=>s.fallback);return(u,f)=>(l.openBlock(),l.createElementBlock("img",{src:l.unref(i)||""},null,8,R2))}}),M2={class:"button_price_bg"},B2={class:"wrapper_container_price_bg"},v2={class:"button_price"},D2={key:0,class:"image_product_container"},P2=l.defineComponent({__name:"BasketButton",emits:["goToCart"],setup(o){const s=at(),{isDesktop:i}=In(),{totalPrice_lib:u,cartProducts_lib:f}=we.storeToRefs(s),h=l.computed(()=>{var m;return(m=f.value)!=null&&m.length,f.value.slice(0,3).map(x=>({id:`${x.id}_image`,fallback:x.image_link}))});return(m,x)=>(l.openBlock(),l.createElementBlock("div",M2,[l.createElementVNode("div",B2,[l.createElementVNode("div",v2,[l.unref(u)>0&&h.value.length>0?(l.openBlock(),l.createElementBlock("div",D2,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(h.value,_=>(l.openBlock(),l.createElementBlock("div",{key:_.id,class:"filter_image_product"},[l.createVNode(O2,{id:_.id,fallback:_.fallback,class:"img_product"},null,8,["id","fallback"])]))),128))])):l.createCommentVNode("",!0),l.createVNode(l.unref(yt.motion).div,{class:"button_default_main",whilePress:l.unref(i)?{}:{scale:.92},onClick:x[0]||(x[0]=_=>m.$emit("goToCart"))},{default:l.withCtx(()=>[x[2]||(x[2]=l.createElementVNode("div",{class:"icont_cart"},null,-1)),l.createElementVNode("p",null,[l.createVNode(Ht,{price:l.unref(u),fixedFloat:2},null,8,["price"]),x[1]||(x[1]=l.createTextVNode(" ₽",-1))])]),_:1},8,["whilePress"])])])]))}}),zr=null,{min:er,max:wn,abs:Ra,floor:L2}=Math,Oa=(o,s,i)=>er(i,wn(s,o)),Ma=o=>[...o].sort((s,i)=>s-i),F2=typeof queueMicrotask=="function"?queueMicrotask:o=>{Promise.resolve().then(o)},Eo=()=>{let o;return[new Promise(s=>{o=s}),o]},Ba=o=>{let s;return()=>(o&&(s=o(),o=void 0),s)},Hr=(o,s,i)=>{const u=i?"unshift":"push";for(let f=0;f<s;f++)o[u](-1);return o},va=(o,s)=>{const i=o.t[s];return i===-1?o.o:i},V2=(o,s,i)=>{const u=o.t[s]===-1;return o.t[s]=i,o.i=er(s,o.i),u},yi=(o,s)=>{if(!o.l)return 0;if(o.i>=s)return o.u[s];o.i<0&&(o.u[0]=0,o.i=0);let i=o.i,u=o.u[i];for(;i<s;)u+=va(o,i),o.u[++i]=u;return o.i=s,u},wr=(o,s,i=0,u=o.l-1)=>{let f=i;for(;i<=u;){const h=L2((i+u)/2);yi(o,h)<=s?(f=h,i=h+1):u=h-1}return Oa(f,0,o.l-1)},Da=(o,s,i)=>{const u=s-o.l;return o.i=i?-1:er(s-1,o.i),o.l=s,u>0?(Hr(o.u,u),Hr(o.t,u,i),o.o*u):(o.u.splice(u),(i?o.t.splice(0,-u):o.t.splice(u)).reduce((f,h)=>f-(h===-1?o.o:h),0))},U2=o=>o.documentElement,z2=o=>o.ownerDocument,H2=o=>o.defaultView,Pa=Ba(()=>!!/iP(hone|od|ad)/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>0),G2=Ba(()=>"scrollBehavior"in U2(document).style),W2=(o,s=40,i=0,u,f=!1)=>{let h=!!i,m=1,x=0,_=0,p=0,C=0,y=0,S=0,B=0,T=0,D=zr,v=[0,h?wn(i-1,0):-1],U=0,P=!1;const O=((z,X,N)=>({o:X,t:N?Hr(N.slice(0,er(z,N.length)),wn(0,z-N.length)):Hr([],z),l:z,i:-1,u:Hr([],z+1)}))(o,u?u[1]:s,u&&u[0]),M=new Set,K=()=>p-_,Q=()=>K()+y+C,W=(z,X)=>((N,Y,H,te)=>{if(te=er(te,N.l-1),yi(N,te)<=Y){const Z=wr(N,H,te);return[wr(N,Y,te,Z),Z]}{const Z=wr(N,Y,void 0,te);return[Z,wr(N,H,Z)]}})(O,z,X,v[0]),oe=()=>yi(O,O.l),V=(z,X)=>{const N=yi(O,z)-y;return X?oe()-N-ce(z):N},ce=z=>va(O,z),j=(z,X=-1)=>O.t[z]===X,G=z=>{z&&(Pa()&&B!==0||D&&T===1?y+=z:C+=z)};return{p:()=>{M.clear()},h:()=>m,m:()=>(z=>[z.t.slice(),z.o])(O),v:(z=200)=>{if(!P||h)return v;let X,N;if(S)[X,N]=v;else{let Y=wn(0,Q()),H=Y+x;f||(z=wn(0,z),B!==1&&(Y-=z),B!==2&&(H+=z)),[X,N]=v=W(wn(0,Y),wn(0,H)),D&&(X=er(X,D[0]),N=wn(N,D[1]))}return[wn(X,0),er(N,O.l-1)]},S:z=>wr(O,z-_),I:j,O:V,k:ce,j:()=>O.l,N:()=>p,B:()=>B!==0,T:()=>x,q:()=>_,M:oe,P:()=>(S=C,C=0,[S,T===2]),R:(z,X)=>{const N=[z,X];return M.add(N),()=>{M.delete(N)}},A:(z,X)=>{let N,Y,H=0;switch(z){case 1:{if(X===p&&T===0)break;const te=S;S=0;const Z=X-p,re=Ra(Z);te&&re<Ra(te)+1||T!==0||(B=Z<0?2:1),h&&(h=!1),p=X,H=4;const ge=K();ge>=-x&&ge<=oe()&&(H+=1,Y=re>x);break}case 2:H=8,B!==0&&(N=!0,H+=1),B=0,T=0,D=zr;break;case 3:{const te=X.filter(([Z,re])=>!j(Z,re));if(!te.length)break;G(te.reduce((Z,[re,ge])=>((T===2||(D&&T===1?re<D[0]:V(re+(B===0&&T===0?1:0))<K()))&&(Z+=ge-ce(re)),Z),0));for(const[Z,re]of te){const ge=ce(Z),me=V2(O,Z,re);f&&(U+=me?re:re-ge)}f&&x&&U>x&&(G(((Z,re)=>{let ge=0;const me=[];Z.t.forEach((Oe,Re)=>{Oe!==-1&&(me.push(Oe),Re<re&&ge++)}),Z.i=-1;const Ie=Ma(me),_e=Ie.length,Fe=_e/2|0,xe=_e%2==0?(Ie[Fe-1]+Ie[Fe])/2:Ie[Fe],lt=Z.o;return((Z.o=xe)-lt)*wn(re-ge,0)})(O,wr(O,Q()))),f=!1),H=3,Y=!0;break}case 4:x!==X&&(x||(P=Y=!0),x=X,H=3);break;case 5:X[1]?(G(Da(O,X[0],!0)),T=2,H=1):(Da(O,X[0]),H=1);break;case 6:_=X;break;case 7:T=1;break;case 8:D=W(X,X+x),H=1}H&&(m=1+(2147483647&m),N&&y&&(C+=y,y=0),M.forEach(([te,Z])=>{H&te&&Z(Y)}))}}},yo=setTimeout,bo=(o,s)=>s?-o:o,X2=(o,s,i,u,f,h)=>{const m=Date.now;let x=0,_=!1,p=!1,C=!1,y=!1;const S=(()=>{let U;const P=()=>{U!=zr&&clearTimeout(U)},O=()=>{P(),U=yo(()=>{U=zr,(()=>{if(_||p)return _=!1,void S();C=!1,o.A(2)})()},150)};return O.C=P,O})(),B=()=>{x=m(),C&&(y=!0),o.A(1,u()),S()},T=U=>{if(_||!o.B()||U.ctrlKey)return;const P=m()-x;150>P&&50<P&&(i?U.deltaX:U.deltaY)&&(_=!0)},D=()=>{p=!0,C=y=!1},v=()=>{p=!1,Pa()&&(C=!0)};return s.addEventListener("scroll",B),s.addEventListener("wheel",T,{passive:!0}),s.addEventListener("touchstart",D,{passive:!0}),s.addEventListener("touchend",v,{passive:!0}),{H:()=>{s.removeEventListener("scroll",B),s.removeEventListener("wheel",T),s.removeEventListener("touchstart",D),s.removeEventListener("touchend",v),S.C()},V:()=>{const[U,P]=o.P();U&&(f(U,P,y),y=!1,P&&o.T()>o.M()&&o.A(1,u()))}}},j2=(o,s,i)=>{let u;return[async(f,h)=>{if(!await s())return;u&&u();const m=()=>{const[x,_]=Eo();return u=()=>{_(!1)},o.T()&&yo(u,150),[x,o.R(2,()=>{_(!0)})]};if(h&&G2())o.A(8,f()),F2(async()=>{for(;;){let x=!0;for(let[C,y]=o.v();C<=y;C++)if(o.I(C)){x=!1;break}if(x)break;const[_,p]=m();try{if(!await _)return}finally{p()}}o.A(7),i(f(),h)});else for(;;){const[x,_]=m();try{if(o.A(7),i(f()),!await x)return}finally{_()}}},()=>{u&&u()}]},q2=o=>{let s;return{F(i){(s||(s=new(H2(z2(i))).ResizeObserver(o))).observe(i)},J(i){s.unobserve(i)},H(){s&&s.disconnect()}}},Z2=l.defineComponent({props:{L:{type:Object,required:!0},W:{type:Object,required:!0},X:{type:Object,required:!0},Y:{type:Function,required:!0},D:{type:Number,required:!0},U:{type:Boolean},G:{type:Boolean},K:{type:Boolean},Z:{type:String,required:!0},ee:Object},setup(o){const s=l.ref(),i=l.computed(()=>o.L.value&&o.W.O(o.D,o.K)),u=l.computed(()=>o.L.value&&o.W.I(o.D));return l.watch(()=>s.value&&o.D,(f,h,m)=>{m(o.Y(s.value,o.D))},{flush:"post"}),()=>{var f;const{X:h,U:m,G:x,Z:_}=o,p=u.value,{style:C,...y}=(f=o.ee)!==null&&f!==void 0?f:{},S={contain:"layout style",position:p&&x?void 0:"absolute",[m?"height":"width"]:"100%",[m?"top":"left"]:"0px",[m?"left":"top"]:i.value+"px",visibility:!p||x?void 0:"hidden",...C};return m&&(S.display="inline-flex"),l.createVNode(_,l.mergeProps({ref:s,style:S},y),typeof(B=h)=="function"||Object.prototype.toString.call(B)==="[object Object]"&&!l.isVNode(B)?h:{default:()=>[h],_:2},16,["style"]);var B}}}),Y2=(o,s)=>{const i=o.key;return i??"_"+s},$2=(o,s)=>o[0]===s[0]&&o[1]===s[1],La=l.defineComponent({props:{data:{type:Array,required:!0},bufferSize:Number,itemSize:Number,shift:Boolean,horizontal:Boolean,startMargin:{type:Number,default:0},ssrCount:Number,scrollRef:Object,as:{type:String,default:"div"},item:{type:String,default:"div"},itemProps:Function,keepMounted:Array,cache:Object},emits:["scroll","scrollEnd"],setup(o,{emit:s,expose:i,slots:u}){let f=!!o.ssrCount;const h=o.horizontal,m=l.ref(),x=W2(o.data.length,o.itemSize,o.ssrCount,o.cache,!o.itemSize),_=((T,D)=>{let v;const U=D?"width":"height",P=new WeakMap,O=q2(M=>{const K=[];for(const{target:Q,contentRect:W}of M)if(Q.offsetParent)if(Q===v)T.A(4,W[U]);else{const oe=P.get(Q);oe!=zr&&K.push([oe,W[U]])}K.length&&T.A(3,K)});return{te(M){O.F(v=M)},re:(M,K)=>(P.set(M,K),O.F(M),()=>{P.delete(M),O.J(M)}),p:O.H}})(x,h),p=((T,D)=>{let v,U,P=Eo(),O=!1;const M=D?"scrollLeft":"scrollTop",K=D?"overflowX":"overflowY",[Q,W]=j2(T,()=>P[0],(oe,V)=>{oe=bo(oe,O),V?v.scrollTo({[D?"left":"top"]:oe,behavior:"smooth"}):v[M]=oe});return{oe(oe){v=oe,D&&(O=getComputedStyle(oe).direction==="rtl"),U=X2(T,oe,D,()=>bo(oe[M],O),(V,ce,j)=>{if(j){const G=oe.style,z=G[K];G[K]="hidden",yo(()=>{G[K]=z})}oe[M]=bo(T.N()+V,O),ce&&W()}),P[1](!0)},p(){U&&U.H(),P[1](!1),P=Eo()},ne:()=>O,se(oe){Q(()=>oe)},ie(oe){oe+=T.N(),Q(()=>oe)},le(oe,{align:V,smooth:ce,offset:j=0}={}){if(oe=Oa(oe,0,T.j()-1),V==="nearest"){const G=T.O(oe),z=T.N();if(G<z)V="start";else{if(!(G+T.k(oe)>z+T.T()))return;V="end"}}Q(()=>j+T.q()+T.O(oe)+(V==="end"?T.k(oe)-T.T():V==="center"?(T.k(oe)-T.T())/2:0),ce)},ce:()=>{U&&U.V()}}})(x,h),C=l.ref(x.h());x.R(1,()=>{C.value=x.h()}),x.R(4,()=>{s("scroll",x.N())}),x.R(8,()=>{s("scrollEnd")});const y=l.computed(T=>{C.value;const D=x.v(o.bufferSize);return T&&$2(T,D)?T:D}),S=l.computed(()=>C.value&&x.B()),B=l.computed(()=>C.value&&x.M());return l.onMounted(()=>{f=!1;const T=requestAnimationFrame(()=>{const D=v=>{_.te(v),p.oe(v)};o.scrollRef?D(o.scrollRef):D(m.value.parentElement)});l.onUnmounted(()=>{cancelAnimationFrame(T)})}),l.onUnmounted(()=>{x.p(),_.p(),p.p()}),l.watch(()=>o.data.length,T=>{x.A(5,[T,o.shift])}),l.watch(()=>o.startMargin,T=>{x.A(6,T)},{immediate:!0}),l.watch([C],()=>{p.ce()},{flush:"post"}),i({get cache(){return x.m()},get scrollOffset(){return x.N()},get scrollSize(){return(T=>wn(T.M(),T.T()))(x)},get viewportSize(){return x.T()},findItemIndex:x.S,getItemOffset:x.O,getItemSize:x.k,scrollToIndex:p.le,scrollTo:p.se,scrollBy:p.ie}),()=>{const T=o.as,D=o.item,v=B.value,U=p.ne(),P=!h&&U?"unshift":"push",O=[],M=Q=>{var W;const oe=u.default({item:o.data[Q],index:Q})[0];return l.createVNode(Z2,{key:Y2(oe,Q),L:C,W:x,Y:_.re,D:Q,X:oe,U:h,K:U,G:f,Z:D,ee:(W=o.itemProps)===null||W===void 0?void 0:W.call(o,{item:o.data[Q],index:Q})},null,8,["L","W","Y","D","X","U","K","G","Z","ee"])};if(o.keepMounted){const Q=new Set(o.keepMounted);for(let[W,oe]=y.value;W<=oe;W++)Q.add(W);Ma([...Q]).forEach(W=>{O[P](M(W))})}else for(let[Q,W]=y.value;Q<=W;Q++)O[P](M(Q));return l.createVNode(T,{ref:m,style:{contain:"size style",overflowAnchor:"none",flex:"none",position:"relative",width:h?v+"px":"100%",height:h?"100%":v+"px",pointerEvents:S.value?"none":void 0}},typeof(K=O)=="function"||Object.prototype.toString.call(K)==="[object Object]"&&!l.isVNode(K)?O:{default:()=>[O],_:2},8,["style"]);var K}}}),K2=l.defineComponent({props:{data:{type:Array,required:!0},bufferSize:Number,itemSize:Number,shift:Boolean,horizontal:Boolean,ssrCount:Number,itemProps:Function,keepMounted:Array,cache:Object},emits:["scroll","scrollEnd"],setup(o,{emit:s,expose:i,slots:u}){const f=o.horizontal,h=_=>{s("scroll",_)},m=()=>{s("scrollEnd")},x=l.ref();return i({get cache(){return x.value.cache},get scrollOffset(){return x.value.scrollOffset},get scrollSize(){return x.value.scrollSize},get viewportSize(){return x.value.viewportSize},findItemIndex:(..._)=>x.value.findItemIndex(..._),getItemOffset:(..._)=>x.value.getItemOffset(..._),getItemSize:(..._)=>x.value.getItemSize(..._),scrollToIndex:(..._)=>x.value.scrollToIndex(..._),scrollTo:(..._)=>x.value.scrollTo(..._),scrollBy:(..._)=>x.value.scrollBy(..._)}),()=>{return l.createVNode("div",{style:{display:f?"inline-block":"block",[f?"overflowX":"overflowY"]:"auto",contain:"strict",width:"100%",height:"100%"}},[l.createVNode(La,{ref:x,data:o.data,bufferSize:o.bufferSize,itemSize:o.itemSize,itemProps:o.itemProps,shift:o.shift,ssrCount:o.ssrCount,horizontal:f,keepMounted:o.keepMounted,cache:o.cache,onScroll:h,onScrollEnd:m},(_=u,typeof _=="function"||Object.prototype.toString.call(_)==="[object Object]"&&!l.isVNode(_)?u:{default:()=>[u],_:2}),8,["data","bufferSize","itemSize","itemProps","shift","ssrCount","horizontal","keepMounted","cache","onScroll","onScrollEnd"])],4);var _}}}),Q2=(o,s=10)=>new Promise(i=>{let u=0,f=0,h=0;const m=()=>{const x=o.scrollSize;x===h&&x>0?u++:(u=0)&&(h=x),f++,u>=2||f>=s?i():requestAnimationFrame(m)};requestAnimationFrame(m)});function J2(o,s){const i=(s==null?void 0:s.align)??"start";let u=!1;const f=l.ref(null),h=l.ref(!1),m=l.ref("measure"),x=l.computed(()=>l.toValue(o).length),_=l.computed(()=>m.value==="measure"||m.value==="virtual"?1:5),p=l.computed(()=>Array.from({length:x.value*_.value},(v,U)=>U)),C=async()=>{if(f.value&&(m.value="measure",u=!1,h.value=!1,await l.nextTick(),m.value==="measure")){if(await Q2(f.value),h.value=f.value.scrollSize>f.value.viewportSize,!h.value){u=!1;return}u=!0,m.value=(s==null?void 0:s.mode)||"loop",await l.nextTick(),f.value.scrollToIndex(x.value*3,{align:i})}},y=v=>m.value==="measure"?v:x.value===0?0:v%x.value,S=(v,U)=>{f.value&&f.value.scrollToIndex(v,U)},B=(v,U)=>!u||m.value!=="loop"?U:U+Math.round((v-U)/x.value)*x.value,T=v=>{if(!u||m.value!=="loop"||!f.value)return;const U=x.value-1,P=x.value*4;if(v<U)return S(x.value*3-1,{align:"start"});if(v>=P)return S(x.value*3,{align:"start"})},D=()=>{if(!f.value||!u)return;const v=f.value.findItemIndex(f.value.scrollOffset);T(v)};return l.onMounted(C),l.onUnmounted(()=>f.value=null),l.watch(x,()=>l.nextTick(C)),{listRef:f,items:p,hasScroll:h,realIndex:y,findNearestIndex:B,scrollToIndex:S,init:C,onScroll:D}}const eg=Object.prototype.toString,tg=o=>eg.call(o)==="[object Error]",ng=new Set(["network error","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]),rg=o=>{if(!(o&&tg(o)&&o.name==="TypeError"&&typeof o.message=="string"))return!1;const{message:i,stack:u}=o;return i==="Load failed"?u===void 0||"__sentry_captured__"in o:i.startsWith("error sending request for url")||i==="Failed to fetch"||i.startsWith("Failed to fetch (")&&i.endsWith(")")?!0:ng.has(i)},ig={pinch:!0,doubleTap:!0,wheel:!0,buttons:["+","-","=","0"]},og=o=>{var i;const s=Object.assign({},ig,o);if(s.pinch&&(document.addEventListener("touchstart",u=>u.touches.length>1&&u.preventDefault(),{passive:!1}),document.addEventListener("gesturestart",u=>u.preventDefault(),{passive:!1})),s.doubleTap){let u=0;document.addEventListener("touchend",f=>{const h=Date.now();h-u<=250&&f.preventDefault(),u=h},{passive:!1})}s.wheel&&document.addEventListener("wheel",u=>(u.ctrlKey||u.metaKey)&&u.preventDefault(),{passive:!1}),(i=s.buttons)!=null&&i.length&&document.addEventListener("keydown",u=>(u.ctrlKey||u.metaKey)&&s.buttons.includes(u.key)&&u.preventDefault())};Object.defineProperty(he,"useRoute",{enumerable:!0,get:()=>ke.useRoute}),Object.defineProperty(he,"useRouter",{enumerable:!0,get:()=>ke.useRouter}),he.BasketButton=P2,he.BottomSheet=co,he.ButtonDefault=cn,he.CardMain=da,he.CardProductPage=s1,he.CardReader=oa,he.CartBox=ia,he.CartPage=$f,he.DrumItem=Th,he.FallingHearts=k2,he.GroupMain=yh,he.InitConnection=An,he.ModalWindows=Uh,he.NotificationWindow=ao,he.PopupWindowDefault=ra,he.PricePrerender=ur,he.QrCameraScanner=w2,he.Recommendation=Ph,he.RetryPage=ah,he.TagsMain=Ah,he.VList=K2,he.Virtualizer=La,he.clearAllProductDB=Cl,he.clearLocalStorage=dr,he.getCachedGroup=zi,he.getCachedProduct=Yo,he.getWebSocketInstance=ri,he.initPinia=nl,he.initRouter=il,he.isNetworkError=rg,he.parseTheme=Ks,he.preventZoom=og,he.updateIndexedDB=b2,he.useCachedMedia=Pn,he.useCardLibStore=Tt,he.useCartLibStore=At,he.useImageCacheStore=ti,he.useMainLibStore=at,he.useModal=ua,he.useModalStore=uo,he.useModulesLibStore=Co,he.usePdf=In,he.useThemeStore=bt,he.useVirtuaLoop=J2,he.vClickOutside=_2,he.vDragScroll=Fr,he.vMuted=Ur,Object.defineProperty(he,Symbol.toStringTag,{value:"Module"})});
|