@inno_user/inno_clouds_lib 9.4.5 → 9.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,22 +1,22 @@
1
- (function(ge,Oe){typeof exports=="object"&&typeof module<"u"?Oe(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"],Oe):(ge=typeof globalThis<"u"?globalThis:ge||self,Oe(ge.InnoCloudsLib={},ge.VueRouter,ge.Pinia,ge.Vue,ge.VueuseCore,ge.motionV))})(this,function(ge,Oe,_e,l,Vt,Et){"use strict";var Lg=Object.defineProperty;var Ja=ge=>{throw TypeError(ge)};var Fg=(ge,Oe,_e)=>Oe in ge?Lg(ge,Oe,{enumerable:!0,configurable:!0,writable:!0,value:_e}):ge[Oe]=_e;var je=(ge,Oe,_e)=>Fg(ge,typeof Oe!="symbol"?Oe+"":Oe,_e),el=(ge,Oe,_e)=>Oe.has(ge)||Ja("Cannot "+_e);var fn=(ge,Oe,_e)=>(el(ge,Oe,"read from private field"),_e?_e.call(ge):Oe.get(ge)),vi=(ge,Oe,_e)=>Oe.has(ge)?Ja("Cannot add the same private member more than once"):Oe instanceof WeakSet?Oe.add(ge):Oe.set(ge,_e),On=(ge,Oe,_e,l)=>(el(ge,Oe,"write to private field"),l?l.call(ge,_e):Oe.set(ge,_e),_e);var zo=(ge,Oe,_e,l)=>({set _(Vt){On(ge,Oe,Vt,_e)},get _(){return fn(ge,Oe,l)}});var jt,Vn,tr;function nl(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 rl(o){return o}const il=[];function ol(){return Oe.createRouter({history:Oe.createWebHistory(),routes:il})}const Di=(o,s)=>s.some(i=>o instanceof i);let Ho,Go;function sl(){return Ho||(Ho=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function al(){return Go||(Go=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Pi=new WeakMap,Li=new WeakMap,Qr=new WeakMap;function ll(o){const s=new Promise((i,u)=>{const f=()=>{o.removeEventListener("success",h),o.removeEventListener("error",m)},h=()=>{i(Ln(o.result)),f()},m=()=>{u(o.error),f()};o.addEventListener("success",h),o.addEventListener("error",m)});return Qr.set(s,o),s}function cl(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 Ln(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){Fi=o(Fi)}function ul(o){return al().includes(o)?function(...s){return o.apply(Vi(this),s),Ln(this.request)}:function(...s){return Ln(o.apply(Vi(this),s))}}function dl(o){return typeof o=="function"?ul(o):(o instanceof IDBTransaction&&cl(o),Di(o,sl())?new Proxy(o,Fi):o)}function Ln(o){if(o instanceof IDBRequest)return ll(o);if(Li.has(o))return Li.get(o);const s=dl(o);return s!==o&&(Li.set(o,s),Qr.set(s,o)),s}const Vi=o=>Qr.get(o);function fl(o,s,{blocked:i,upgrade:u,blocking:f,terminated:h}={}){const m=indexedDB.open(o,s),x=Ln(m);return u&&m.addEventListener("upgradeneeded",_=>{u(Ln(m.result),_.oldVersion,_.newVersion,Ln(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 hl(o,{blocked:s}={}){const i=indexedDB.deleteDatabase(o);return s&&i.addEventListener("blocked",u=>s(u.oldVersion,u)),Ln(i).then(()=>{})}const gl=["get","getKey","getAll","getAllKeys","count"],ml=["put","add","delete","clear"],Ui=new Map;function Xo(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=ml.includes(i);if(!(i in(u?IDBIndex:IDBObjectStore).prototype)||!(f||gl.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}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 pl=["continue","continuePrimaryKey","advance"],jo={},zi=new WeakMap,qo=new WeakMap,xl={get(o,s){if(!pl.includes(s))return o[s];let i=jo[s];return i||(i=jo[s]=function(...u){zi.set(this,qo.get(this)[s](...u))}),i}};async function*wl(...o){let s=this;if(s instanceof IDBCursor||(s=await s.openCursor(...o)),!s)return;s=s;const i=new Proxy(s,xl);for(qo.set(i,s),Qr.set(i,Vi(s));s;)yield i,s=await(zi.get(i)||s.continue()),zi.delete(i)}function Zo(o,s){return s===Symbol.asyncIterator&&Di(o,[IDBIndex,IDBObjectStore,IDBCursor])||s==="iterate"&&Di(o,[IDBIndex,IDBObjectStore])}Wo(o=>({...o,get(s,i,u){return Zo(s,i)?wl:o.get(s,i,u)},has(s,i){return Zo(s,i)||o.has(s,i)}}));let Zn;function _l(){return fl("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"})}})}async function Yn(){if(Zn)try{const o=await Zn;return o.transaction("groups","readonly").commit(),o}catch{Zn=void 0}return Zn=_l(),Zn}async function Hi(o){return(await Yn()).transaction("groups","readonly").objectStore("groups").get(o)}async function kr(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 Cl(o,s){const i=JSON.parse(JSON.stringify(l.toRaw(s.value)));await kr(o,i)}async function Gi(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 El(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 yl(){const o=Zn;if(Zn=void 0,o){const s=await o.catch(()=>null);s&&s.close()}try{await hl("data",{blocked(){console.warn("Удаление заблокировано. открыты другие вкладки с сайтом.")}})}catch(s){console.error("Не удалось удалить базу: [lib, indexedDB]",s)}}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 be(o,s){if(o=o||"",s=s||{},o instanceof be)return o;if(!(this instanceof be))return new be(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}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 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(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:zl[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(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(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]=Rr(o[u]));o=i}return be(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"&&(Bn(o.r)&&Bn(o.g)&&Bn(o.b)?(s=Sl(o.r,o.g,o.b),m=!0,x=String(o.r).substr(-1)==="%"?"prgb":"rgb"):Bn(o.h)&&Bn(o.s)&&Bn(o.v)?(u=Rr(o.s),f=Rr(o.v),s=Tl(o.h,u,f),m=!0,x="hsv"):Bn(o.h)&&Bn(o.s)&&Bn(o.l)&&(u=Rr(o.s),h=Rr(o.l),s=Nl(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 Sl(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 Nl(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 Tl(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=[hn(Math.round(o).toString(16)),hn(Math.round(s).toString(16)),hn(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=[hn(Math.round(o).toString(16)),hn(Math.round(s).toString(16)),hn(Math.round(i).toString(16)),hn(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=[hn(ns(u)),hn(Math.round(o).toString(16)),hn(Math.round(s).toString(16)),hn(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 Rl(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 Ol(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 Bl(o){return be(o).desaturate(100)}function Ml(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){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 Dl(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 Pl(o,s){var i=be(o).toHsl(),u=(i.h+s)%360;return i.h=u<0?360+u:u,be(i)}function Ll(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 Fl(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 Vl(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 Ul(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=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},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 Wi=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"},zl=be.hexNames=Hl(Wi);function Hl(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){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 Qt(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 hn(o){return o.length==1?"0"+o:""+o}function Rr(o){return o<=1&&(o=o*100+"%"),o}function ns(o){return Math.round(parseFloat(o)*255).toString(16)}function rs(o){return Qt(o)/255}var gn=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 Bn(o){return!!gn.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=gn.rgb.exec(o))?{r:i[1],g:i[2],b:i[3]}:(i=gn.rgba.exec(o))?{r:i[1],g:i[2],b:i[3],a:i[4]}:(i=gn.hsl.exec(o))?{h:i[1],s:i[2],l:i[3]}:(i=gn.hsla.exec(o))?{h:i[1],s:i[2],l:i[3],a:i[4]}:(i=gn.hsv.exec(o))?{h:i[1],s:i[2],v:i[3]}:(i=gn.hsva.exec(o))?{h:i[1],s:i[2],v:i[3],a:i[4]}:(i=gn.hex8.exec(o))?{r:Qt(i[1]),g:Qt(i[2]),b:Qt(i[3]),a:rs(i[4]),format:s?"name":"hex8"}:(i=gn.hex6.exec(o))?{r:Qt(i[1]),g:Qt(i[2]),b:Qt(i[3]),format:s?"name":"hex"}:(i=gn.hex4.exec(o))?{r:Qt(i[1]+""+i[1]),g:Qt(i[2]+""+i[2]),b:Qt(i[3]+""+i[3]),a:rs(i[4]+""+i[4]),format:s?"name":"hex8"}:(i=gn.hex3.exec(o))?{r:Qt(i[1]+""+i[1]),g:Qt(i[2]+""+i[2]),b:Qt(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=_e.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}}),yt=_e.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_auth_required:!0,qr_bypass_guest_auth:null,kiosk_bypass_guest_auth:null,kiosk_disable_lock_screen:null,kiosk_hide_banner: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,enable_sequential_modifiers:!1,pdf_return_url:null,kiosk_hide_manual_input_loyalty_card:null,kiosk_camera_scan_loyalty_card:null,kiosk_hide_menu_update_notification:null,kiosk_proceed_to_payment_text: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%)`,N=`-webkit-linear-gradient(to bottom, transparent 10%, ${C} 50%, ${p} 85%)`;return i.value.gradientStyle={background:y,backgroundColor:N},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}}),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 Or extends Error{}Or.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 is(o,s){if(typeof o!="string")throw new Or("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 Or(`Invalid token specified: missing part #${i+1}`);let f;try{f=Zl(u)}catch(h){throw new Or(`Invalid token specified: invalid base64 for part #${i+1} (${h.message})`)}try{return JSON.parse(f)}catch(h){throw new Or(`Invalid token specified: invalid json for part #${i+1} (${h.message})`)}}const Yl=(o,s)=>{if(typeof window<"u"){const i=localStorage.getItem(o);if(i)try{return JSON.parse(i)}catch{return s}return s}return s},$l=(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"?$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},dr=o=>{o.forEach(s=>{try{localStorage.removeItem(s)}catch(i){console.error(`Ошибка при удалении ключа "${s}":`,i)}})};class Kl{constructor(s,i={}){je(this,"url");je(this,"options");je(this,"ws");je(this,"reconnectInterval");je(this,"listeners");je(this,"isConnected");je(this,"heartbeat");je(this,"heartbeatTimeout");je(this,"pingTimeout");je(this,"pingResponseTimeout");je(this,"signal");je(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.close(!0),(u=this.options.signal)==null||u.addEventListener("abort",()=>this.close(!0)),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 at=_e.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),N=l.ref(!1),M=l.ref(!1),k=l.ref(!0),L=l.ref(!localStorage.getItem("apiKey")),v=l.ref(!1),V=l.ref({textNotification:""}),B=l.ref([]);let O=null;const P=$=>{const re=`wss://${p.value.area}/ws/device/${$}/`;O=ri(re);function he(){console.log("WebSocket connection opened")}function fe(me){if(me.error)v.value=!0,V.value.textNotification=me.error,O==null||O.close(!0);else{if(!(me!=null&&me.params))return;typeof me.params.components.shift.is_ok!==null?k.value=me.params.components.shift.is_ok:k.value=!0}}function Ee(me){console.error("WebSocket error:",me),O.close(!0)}O.on("open",he),O.on("message",fe),O.on("error",Ee),O.connect()},G=$=>{u.value=$,localStorage.setItem("kiosk_timeout",$)},Z=$=>{s.value=$},H=l.ref(null),ie=l.computed(()=>m.value.reduce(($,re)=>{let he=0,fe=0;return re.group_modifiers&&(he=re.group_modifiers.reduce((Ee,me)=>me.modifiers?Ee+me.modifiers.reduce((Ve,xe)=>Ve+xe.old_price*xe.amount,0):0,0)*re.amount),re.modifiers&&(fe=re.modifiers.reduce((Ee,me)=>Ee+me.old_price*me.amount,0)*re.amount),$+re.old_price*re.amount+he+fe},0)),j=l.computed({get:()=>m.value.length===0||H.value===0?0:H.value&&H.value!==0?H.value:m.value.reduce(($,re)=>{const he=ur(re)*re.amount;let fe=0,Ee=0;return re.group_modifiers&&(fe=re.group_modifiers.reduce((me,Ve)=>Ve.modifiers?me+Ve.modifiers.reduce((xe,ht)=>xe+ht.price*ht.amount,0):0,0)*re.amount),re.modifiers&&(Ee=re.modifiers.reduce((me,Ve)=>me+Ve.price*Ve.amount,0)*re.amount),$+he+fe+Ee},0),set($){H.value=$}}),se=$=>{y.value=$,localStorage.removeItem("bonus"),os("bonus",y.value)},oe=$=>{dr($)},ne=$=>{$={...$,idSystem:crypto.randomUUID()};const re=W($);m.value.push(re),U()},U=()=>{try{if(!m.value||m.value.length===0){localStorage.removeItem("cart");return}localStorage.setItem("cart",JSON.stringify(l.toRaw(m.value)))}catch($){console.error("Failed to update cart in localStorage:",$)}},W=$=>l.reactive({...$,amount:$.amount??1,price:$.old_price,new_price:null,total_new_price:null,discounts:[],modifiers:($.modifiers||[]).map(re=>l.reactive({...re,price:re.old_price,new_price:null,total_new_price:null})),group_modifiers:($.group_modifiers||[]).map(re=>l.reactive({...re,modifiers:(re.modifiers||[]).map(he=>l.reactive({...he,price:he.old_price,new_price:null,total_new_price:null}))}))}),S=$=>{const re=m.value.find(he=>he.idSystem===$);re&&(re.amount+=1),U()},z=$=>{const re=m.value.find(he=>he.idSystem===$);re&&(re.amount>=1&&(re.amount-=1),U())},X=()=>{try{const $=localStorage.getItem("cart");if($){const re=JSON.parse($);m.value.splice(0,m.value.length,...re.map(W)),H.value=null}}catch($){console.error("Failed to load cart from localStorage:",$)}};return X(),{cartProducts_lib:m,activeScrolling_lib:x,config_lib:p,totalPrice_lib:j,initialCartPrice_lib:ie,is_notification_lib:v,notificationData_lib:V,xApiKey_lib:C,countBonus:y,toggleDrum:s,is_showApiKey:L,openApiKey:N,kiosk_timeout:i,kiosk_FirstTimeout:u,is_OpenLoyal:M,profile:o,is_18_above_content:f,is18Allowed:h,healthState:k,displayCards:B,isOrderTypeSubmited:_,removeFromLocalStorage:oe,setKioskTimeout:G,setBonus:se,setStateDrum:Z,addToCart:ne,plusAmount:S,minusAmount:z,loadCart:X,deleteItemFromCart:$=>{if($){const re=m.value.findIndex(he=>he.idSystem===$);if(re===-1)return;m.value.splice(re,1),U(),H.value=null}else m.value=[],U()},updateCartInLocalStorage:U,makeProductFullyReactive:W,checkHeartbeatApp:P}});function ss(o,s){return function(){return o.apply(s,arguments)}}const{toString:Ql}=Object.prototype,{getPrototypeOf:Xi}=Object,{iterator:ii,toStringTag:as}=Symbol,oi=(o=>s=>{const i=Ql.call(s);return o[i]||(o[i]=i.slice(8,-1).toLowerCase())})(Object.create(null)),mn=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)&&Gt(o.constructor.isBuffer)&&o.constructor.isBuffer(o)}const ls=mn("ArrayBuffer");function Jl(o){let s;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?s=ArrayBuffer.isView(o):s=o&&o.buffer&&ls(o.buffer),s}const ec=si("string"),Gt=si("function"),cs=si("number"),Mr=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)&&!(as in o)&&!(ii in o)},nc=o=>{if(!Mr(o)||Br(o))return!1;try{return Object.keys(o).length===0&&Object.getPrototypeOf(o)===Object.prototype}catch{return!1}},rc=mn("Date"),ic=mn("File"),oc=mn("Blob"),sc=mn("FileList"),ac=o=>Mr(o)&&Gt(o.pipe),lc=o=>{let s;return o&&(typeof FormData=="function"&&o instanceof FormData||Gt(o.append)&&((s=oi(o))==="formdata"||s==="object"&&Gt(o.toString)&&o.toString()==="[object FormData]"))},cc=mn("URLSearchParams"),[uc,dc,fc,hc]=["ReadableStream","Request","Response","Headers"].map(mn),gc=o=>o.trim?o.trim():o.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function vr(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 ji(){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]=ji(i[m],f):ai(f)?i[m]=ji({},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]&&vr(arguments[f],u);return i}const mc=(o,s,i,{allOwnKeys:u}={})=>(vr(s,(f,h)=>{i&&Gt(f)?o[h]=ss(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(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},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=mn("HTMLFormElement"),Ic=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),Sc=mn("RegExp"),hs=(o,s)=>{const i=Object.getOwnPropertyDescriptors(o),u={};vr(i,(f,h)=>{let m;(m=s(f,h,o))!==!1&&(u[h]=m||f)}),Object.defineProperties(o,u)},Nc=o=>{hs(o,(s,i)=>{if(Gt(o)&&["arguments","caller","callee"].indexOf(i)!==-1)return!1;const u=o[i];if(Gt(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 fr(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&&Gt(o.append)&&o[as]==="FormData"&&o[ii])}const Bc=o=>{const s=new Array(10),i=(u,f)=>{if(Mr(u)){if(s.indexOf(u)>=0)return;if(Br(u))return u;if(!("toJSON"in u)){s[f]=u;const h=fr(u)?[]:{};return vr(u,(m,x)=>{const _=i(m,f+1);!hr(_)&&(h[x]=_)}),s[f]=void 0,h}}return u};return i(o,0)},Mc=mn("AsyncFunction"),vc=o=>o&&(Mr(o)||Gt(o))&&Gt(o.then)&&Gt(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",Gt($n.postMessage)),Dc=typeof queueMicrotask<"u"?queueMicrotask.bind($n):typeof process<"u"&&process.nextTick||gs,Q={isArray:fr,isArrayBuffer:ls,isBuffer:Br,isFormData:lc,isArrayBufferView:Jl,isString:ec,isNumber:cs,isBoolean:tc,isObject:Mr,isPlainObject:ai,isEmptyObject:nc,isReadableStream:uc,isRequest:dc,isResponse:fc,isHeaders:hc,isUndefined:hr,isDate:rc,isFile:ic,isBlob:oc,isRegExp:Sc,isFunction:Gt,isStream:ac,isURLSearchParams:cc,isTypedArray:Ec,isFileList:sc,forEach:vr,merge:ji,extend:mc,trim:gc,stripBOM:pc,inherits:xc,toFlatObject:wc,kindOf:oi,kindOfTest:mn,endsWith:_c,toArray:Cc,forEachEntry:yc,matchAll:bc,isHTMLForm:Ac,hasOwnProperty:fs,hasOwnProp:fs,reduceDescriptors:hs,freezeMethods:Nc,toObjectSet:Tc,toCamelCase:Ic,noop:kc,toFiniteNumber:Rc,findKey:us,global:$n,isContextDefined:ds,isSpecCompliantForm:Oc,toJSONObject:Bc,isAsyncFn:Mc,isThenable:vc,setImmediate:gs,asap:Dc,isIterable:o=>o!=null&&Gt(o[ii])};function De(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(De,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 ms=De.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(De,ps),Object.defineProperty(ms,"isAxiosError",{value:!0}),De.from=(o,s,i,u,f,h)=>{const m=Object.create(ms);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 De.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 xs(o){return Q.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 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(L,v){return!Q.isUndefined(v[L])});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 De("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,L,v){let V=k;if(k&&!v&&typeof k=="object"){if(Q.endsWith(L,"{}"))L=u?L:L.slice(0,-2),k=JSON.stringify(k);else if(Q.isArray(k)&&Lc(k)||(Q.isFileList(k)||Q.endsWith(L,"[]"))&&(V=Q.toArray(k)))return L=xs(L),V.forEach(function(O,P){!(Q.isUndefined(O)||O===null)&&s.append(m===!0?ws([L],P,h):m===null?L:L+"[]",p(O))}),!1}return qi(k)?!0:(s.append(ws(v,L,h),p(k)),!1)}const y=[],N=Object.assign(Fc,{defaultVisitor:C,convertValue:p,isVisitable:qi});function M(k,L){if(!Q.isUndefined(k)){if(y.indexOf(k)!==-1)throw Error("Circular reference detected in "+L.join("."));y.push(k),Q.forEach(k,function(V,B){(!(Q.isUndefined(V)||V===null)&&f.call(s,V,Q.isString(B)?B.trim():B,L,N))===!0&&M(V,L?L.concat(B):[B])}),y.pop()}}if(!Q.isObject(o))throw new TypeError("data must be an object");return M(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 Zi(o,s){this._pairs=[],o&&li(o,this,s)}const Cs=Zi.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 Vc(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||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 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){Q.forEach(this.handlers,function(u){u!==null&&s(u)})}}const bs={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",Pt={...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 Pt.classes.URLSearchParams,{visitor:function(i,u,f,h){return Pt.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 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&&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 Dr={transitional:bs,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(As(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||Dr.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"?De.from(x,De.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:Pt.classes.FormData,Blob:Pt.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=>{Dr.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]&&Zc[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 Pr(o){return o&&String(o).trim().toLowerCase()}function ci(o){return o===!1||o==null?o:Q.isArray(o)?o.map(ci):String(o)}function $c(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 Kc=o=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(o.trim());function Ki(o,s,i,u,f){if(Q.isFunction(u))return u.call(this,s,i);if(f&&(s=i),!!Q.isString(s)){if(Q.isString(u))return s.indexOf(u)!==-1;if(Q.isRegExp(u))return u.test(s)}}function Qc(o){return o.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(s,i,u)=>i.toUpperCase()+u)}function Jc(o,s){const i=Q.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 Wt=class{constructor(s){s&&this.set(s)}set(s,i,u){const f=this;function h(x,_,p){const C=Pr(_);if(!C)throw new Error("header name must be a non-empty string");const y=Q.findKey(f,C);(!y||f[y]===void 0||p===!0||p===void 0&&f[y]!==!1)&&(f[y||_]=ci(x))}const m=(x,_)=>Q.forEach(x,(p,C)=>h(p,C,_));if(Q.isPlainObject(s)||s instanceof this.constructor)m(s,i);else if(Q.isString(s)&&(s=s.trim())&&!Kc(s))m(Yc(s),i);else if(Q.isObject(s)&&Q.isIterable(s)){let x={},_,p;for(const C of s){if(!Q.isArray(C))throw TypeError("Object iterator must return a key-value pair");x[p=C[0]]=(_=x[p])?Q.isArray(_)?[..._,C[1]]:[_,C[1]]:C[1]}m(x,i)}else s!=null&&h(i,s,u);return this}get(s,i){if(s=Pr(s),s){const u=Q.findKey(this,s);if(u){const f=this[u];if(!i)return f;if(i===!0)return $c(f);if(Q.isFunction(i))return i.call(this,f,u);if(Q.isRegExp(i))return i.exec(f);throw new TypeError("parser must be boolean|regexp|function")}}}has(s,i){if(s=Pr(s),s){const u=Q.findKey(this,s);return!!(u&&this[u]!==void 0&&(!i||Ki(this,this[u],u,i)))}return!1}delete(s,i){const u=this;let f=!1;function h(m){if(m=Pr(m),m){const x=Q.findKey(u,m);x&&(!i||Ki(u,u[x],x,i))&&(delete u[x],f=!0)}}return Q.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||Ki(this,this[h],h,s,!0))&&(delete this[h],f=!0)}return f}normalize(s){const i=this,u={};return Q.forEach(this,(f,h)=>{const m=Q.findKey(u,h);if(m){i[m]=ci(f),delete i[h];return}const x=s?Qc(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 Q.forEach(this,(u,f)=>{u!=null&&u!==!1&&(i[f]=s&&Q.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=Pr(m);u[x]||(Jc(f,m),u[x]=!0)}return Q.isArray(s)?s.forEach(h):h(s),this}};Wt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Q.reduceDescriptors(Wt.prototype,({value:o},s)=>{let i=s[0].toUpperCase()+s.slice(1);return{get:()=>o,set(u){this[i]=u}}}),Q.freezeMethods(Wt);function Qi(o,s){const i=this||Dr,u=s||i,f=Wt.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 Ss(o){return!!(o&&o.__CANCEL__)}function gr(o,s,i){De.call(this,o??"canceled",De.ERR_CANCELED,s,i),this.name="CanceledError"}Q.inherits(gr,De,{__CANCEL__:!0});function Ns(o,s,i){const u=i.config.validateStatus;!i.status||!u||u(i.status)?o(i):s(new De("Request failed with status code "+i.status,[De.ERR_BAD_REQUEST,De.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,N=0;for(;y!==f;)N+=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(N*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)},Ts=(o,s)=>{const i=o!=null;return[u=>s[0]({lengthComputable:i,total:o,loaded:u}),s[1]]},ks=o=>(...s)=>Q.asap(()=>o(...s)),ru=Pt.hasStandardBrowserEnv?((o,s)=>i=>(i=new URL(i,Pt.origin),o.protocol===i.protocol&&o.host===i.host&&(s||o.port===i.port)))(new URL(Pt.origin),Pt.navigator&&/(msie|trident)/i.test(Pt.navigator.userAgent)):()=>!0,iu=Pt.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 Rs(o,s,i){let u=!ou(s);return o&&(u||i==!1)?su(o,s):s}const Os=o=>o instanceof Wt?{...o}:o;function Kn(o,s){s=s||{};const i={};function u(p,C,y,N){return Q.isPlainObject(p)&&Q.isPlainObject(C)?Q.merge.call({caseless:N},p,C):Q.isPlainObject(C)?Q.merge({},C):Q.isArray(C)?C.slice():C}function f(p,C,y,N){if(Q.isUndefined(C)){if(!Q.isUndefined(p))return u(void 0,p,y,N)}else return u(p,C,y,N)}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(Os(p),Os(C),y,!0)};return Q.forEach(Object.keys({...o,...s}),function(C){const y=_[C]||f,N=y(o[C],s[C],C);Q.isUndefined(N)&&y!==x||(i[C]=N)}),i}const Bs=o=>{const s=Kn({},o);let{data:i,withXSRFToken:u,xsrfHeaderName:f,xsrfCookieName:h,headers:m,auth:x}=s;if(s.headers=m=Wt.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)):""))),Q.isFormData(i)){if(Pt.hasStandardBrowserEnv||Pt.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(Pt.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=Bs(o);let h=f.data;const m=Wt.from(f.headers).normalize();let{responseType:x,onUploadProgress:_,onDownloadProgress:p}=f,C,y,N,M,k;function L(){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 V(){if(!v)return;const O=Wt.from("getAllResponseHeaders"in v&&v.getAllResponseHeaders()),G={data:!x||x==="text"||x==="json"?v.responseText:v.response,status:v.status,statusText:v.statusText,headers:O,config:o,request:v};Ns(function(H){i(H),L()},function(H){u(H),L()},G),v=null}"onloadend"in v?v.onloadend=V:v.onreadystatechange=function(){!v||v.readyState!==4||v.status===0&&!(v.responseURL&&v.responseURL.indexOf("file:")===0)||setTimeout(V)},v.onabort=function(){v&&(u(new De("Request aborted",De.ECONNABORTED,o,v)),v=null)},v.onerror=function(P){const G=P&&P.message?P.message:"Network Error",Z=new De(G,De.ERR_NETWORK,o,v);Z.event=P||null,u(Z),v=null},v.ontimeout=function(){let P=f.timeout?"timeout of "+f.timeout+"ms exceeded":"timeout exceeded";const G=f.transitional||bs;f.timeoutErrorMessage&&(P=f.timeoutErrorMessage),u(new De(P,G.clarifyTimeoutError?De.ETIMEDOUT:De.ECONNABORTED,o,v)),v=null},h===void 0&&m.setContentType(null),"setRequestHeader"in v&&Q.forEach(m.toJSON(),function(P,G){v.setRequestHeader(G,P)}),Q.isUndefined(f.withCredentials)||(v.withCredentials=!!f.withCredentials),x&&x!=="json"&&(v.responseType=f.responseType),p&&([N,k]=ui(p,!0),v.addEventListener("progress",N)),_&&v.upload&&([y,M]=ui(_),v.upload.addEventListener("progress",y),v.upload.addEventListener("loadend",M)),(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 B=eu(f.url);if(B&&Pt.protocols.indexOf(B)===-1){u(new De("Unsupported protocol "+B+":",De.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 De?C:new gr(C instanceof Error?C.message:C))}};let m=s&&setTimeout(()=>{m=null,h(new De(`timeout ${s} of ms exceeded`,De.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()}},Ms=(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 N=h+=y;i(N)}_.enqueue(new Uint8Array(C))}catch(p){throw x(p),p}},cancel(_){return x(_),f.return()}},{highWaterMark:2})},vs=64*1024,{isFunction:di}=Q,fu=(({Request:o,Response:s})=>({Request:o,Response:s}))(Q.global),{ReadableStream:Ds,TextEncoder:Ps}=Q.global,Ls=(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(Ds),_=f&&(typeof Ps=="function"?(k=>L=>k.encode(L))(new Ps):async k=>new Uint8Array(await new i(k).arrayBuffer())),p=h&&x&&Ls(()=>{let k=!1;const L=new i(Pt.origin,{body:new Ds,method:"POST",get duplex(){return k=!0,"half"}}).headers.has("Content-Type");return k&&!L}),C=m&&x&&Ls(()=>Q.isReadableStream(new u("").body)),y={stream:C&&(k=>k.body)};f&&["text","arrayBuffer","blob","formData","stream"].forEach(k=>{!y[k]&&(y[k]=(L,v)=>{let V=L&&L[k];if(V)return V.call(L);throw new De(`Response type '${k}' is not supported`,De.ERR_NOT_SUPPORT,v)})});const N=async k=>{if(k==null)return 0;if(Q.isBlob(k))return k.size;if(Q.isSpecCompliantForm(k))return(await new i(Pt.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,L)=>{const v=Q.toFiniteNumber(k.getContentLength());return v??N(L)};return async k=>{let{url:L,method:v,data:V,signal:B,cancelToken:O,timeout:P,onDownloadProgress:G,onUploadProgress:Z,responseType:H,headers:ie,withCredentials:j="same-origin",fetchOptions:se}=Bs(k),oe=s||fetch;H=H?(H+"").toLowerCase():"text";let ne=lu([B,O&&O.toAbortSignal()],P),U=null;const W=ne&&ne.unsubscribe&&(()=>{ne.unsubscribe()});let S;try{if(Z&&p&&v!=="get"&&v!=="head"&&(S=await M(ie,V))!==0){let he=new i(L,{method:"POST",body:V,duplex:"half"}),fe;if(Q.isFormData(V)&&(fe=he.headers.get("content-type"))&&ie.setContentType(fe),he.body){const[Ee,me]=Ts(S,ui(ks(Z)));V=Ms(he.body,vs,Ee,me)}}Q.isString(j)||(j=j?"include":"omit");const z=h&&"credentials"in i.prototype,X={...se,signal:ne,method:v.toUpperCase(),headers:ie.normalize().toJSON(),body:V,duplex:"half",credentials:z?j:void 0};U=h&&new i(L,X);let q=await(h?oe(U,se):oe(L,X));const $=C&&(H==="stream"||H==="response");if(C&&(G||$&&W)){const he={};["status","statusText","headers"].forEach(Ve=>{he[Ve]=q[Ve]});const fe=Q.toFiniteNumber(q.headers.get("content-length")),[Ee,me]=G&&Ts(fe,ui(ks(G),!0))||[];q=new u(Ms(q.body,vs,Ee,()=>{me&&me(),W&&W()}),he)}H=H||"text";let re=await y[Q.findKey(y,H)||"text"](q,k);return!$&&W&&W(),await new Promise((he,fe)=>{Ns(he,fe,{data:re,headers:Wt.from(q.headers),status:q.status,statusText:q.statusText,config:k,request:U})})}catch(z){throw W&&W(),z&&z.name==="TypeError"&&/Load failed|fetch/i.test(z.message)?Object.assign(new De("Network Error",De.ERR_NETWORK,k,U),{cause:z.cause||z}):De.from(z,z&&z.code,k,U)}}},gu=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=gu;for(;x--;)_=h[x],p=C.get(_),p===void 0&&C.set(_,p=x?new Map:hu(s)),C=p;return p};Fs();const Ji={http:Pc,xhr:au,fetch:{get:Fs}};Q.forEach(Ji,(o,s)=>{if(o){try{Object.defineProperty(o,"name",{value:s})}catch{}Object.defineProperty(o,"adapterName",{value:s})}});const Vs=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 De(`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(Vs).join(`
5
- `):" "+Vs(m[0]):"as no adapter specified";throw new De("There is no suitable adapter to dispatch the request "+x,"ERR_NOT_SUPPORT")}return f}const Us={getAdapter:pu,adapters:Ji};function eo(o){if(o.cancelToken&&o.cancelToken.throwIfRequested(),o.signal&&o.signal.aborted)throw new gr(null,o)}function zs(o){return eo(o),o.headers=Wt.from(o.headers),o.data=Qi.call(o,o.transformRequest),["post","put","patch"].indexOf(o.method)!==-1&&o.headers.setContentType("application/x-www-form-urlencoded",!1),Us.getAdapter(o.adapter||Dr.adapter,o)(o).then(function(u){return eo(o),u.data=Qi.call(o,o.transformResponse,u),u.headers=Wt.from(u.headers),u},function(u){return Ss(u)||(eo(o),u&&u.response&&(u.response.data=Qi.call(o,o.transformResponse,u.response),u.response.headers=Wt.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 De(f(m," has been removed"+(i?" in "+i:"")),De.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 xu(o,s,i){if(typeof o!="object")throw new De("options must be an object",De.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 De("option "+h+" must be "+_,De.ERR_BAD_OPTION_VALUE);continue}if(i!==!0)throw new De("Unknown option "+h,De.ERR_BAD_OPTION)}}const hi={assertOptions:xu,validators:fi},Cn=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:Cn.transitional(Cn.boolean),forcedJSONParsing:Cn.transitional(Cn.boolean),clarifyTimeoutError:Cn.transitional(Cn.boolean)},!1),f!=null&&(Q.isFunction(f)?i.paramsSerializer={serialize:f}:hi.assertOptions(f,{encode:Cn.function,serialize:Cn.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),hi.assertOptions(i,{baseUrl:Cn.spelling("baseURL"),withXsrfToken:Cn.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=Wt.concat(m,h);const x=[];let _=!0;this.interceptors.request.forEach(function(L){typeof L.runWhen=="function"&&L.runWhen(i)===!1||(_=_&&L.synchronous,x.unshift(L.fulfilled,L.rejected))});const p=[];this.interceptors.response.forEach(function(L){p.push(L.fulfilled,L.rejected)});let C,y=0,N;if(!_){const k=[zs.bind(this),void 0];for(k.unshift(...x),k.push(...p),N=k.length,C=Promise.resolve(i);y<N;)C=C.then(k[y++],k[y++]);return C}N=x.length;let M=i;for(;y<N;){const k=x[y++],L=x[y++];try{M=k(M)}catch(v){L.call(this,v);break}}try{C=zs.call(this,M)}catch(k){return Promise.reject(k)}for(y=0,N=p.length;y<N;)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)}};Q.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}))}}),Q.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 wu=class tl{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 tl(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 Ws(o){const s=new Qn(o),i=ss(Qn.prototype.request,s);return Q.extend(i,Qn.prototype,s,{allOwnKeys:!0}),Q.extend(i,s,null,{allOwnKeys:!0}),i.create=function(f){return Ws(Kn(o,f))},i}const et=Ws(Dr);et.Axios=Qn,et.CanceledError=gr,et.CancelToken=wu,et.isCancel=Ss,et.VERSION=Hs,et.toFormData=li,et.AxiosError=De,et.Cancel=et.CanceledError,et.all=function(s){return Promise.all(s)},et.spread=_u,et.isAxiosError=Cu,et.mergeConfig=Kn,et.AxiosHeaders=Wt,et.formToJSON=o=>As(Q.isHTMLForm(o)?new FormData(o):o),et.getAdapter=Us.getAdapter,et.HttpStatusCode=to,et.default=et;const{Axios:Xg,AxiosError:jg,CanceledError:qg,isCancel:Zg,CancelToken:Yg,VERSION:$g,all:Kg,Cancel:Qg,isAxiosError:Jg,spread:em,toFormData:tm,AxiosHeaders:nm,HttpStatusCode:rm,formToJSON:im,getAdapter:om,mergeConfig:sm}=et;let En=null,Lt=null;function Fn(o){o&&o.close(!0)}async function Xs(o,s){const i=bt(),u=at(),f=yn.create();try{const h=await f.initPaymentLink(o,s);return i.paymentCostQR=u.totalPrice_lib-u.countBonus,i.linkQR=h.url,Lt==null||Lt.deleteCart(null,Lt==null?void 0:Lt.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){const u=yt();if(o!=null&&o.params){if(o.params.status==="sent"&&u.itemThemes.kiosk_proceed_to_payment_text&&s.showNotification(u.itemThemes.kiosk_proceed_to_payment_text),o.error){s.showNotification(o.error),rn(s,null),ro(s);return}i(o,s)}}function no(o,s){const i=bt(),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 rn=(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()},bu=(o,s)=>{o.is_tableservice&&(Fn(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;yn.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:()=>Fn(f)})})},io=(o,s,i)=>{const u=o.ws||s;(o.errorHandler||i).handleOrderError({...o,closeWebSocket:()=>Fn(u)})},Au=(o,s,i)=>{const u=bt(),f=u.getCurrentPaymentMethodId();if(!f||!Mn.getConfig(f)||!Mn.isMethodAvailable(f,o))return null;const m=Mn.createHandler(f);if(!m)return null;const x=u.createPaymentHandler(o,s,i,f);return x?{handler:m,config:x.config}:null},Iu=o=>{if(!Lt)return;const s=Lt.context,i=Lt.is_requestKiosk,u=Lt.is_tableservice,f=Au(s,i,u);if(!f){console.warn("handleWebSocketMessageWithDynamicHandler: не удалось получить handler");return}const{handler:h,config:m}=f,x={...m,...Lt};Eu(o,x,h.handleWebSocketStatus)};async function Su(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=yn.create();try{const N=await p.createOrder(o,s,f,m,x,h,_);if((N==null?void 0:N.status)===201&&((C=N==null?void 0:N.data)!=null&&C.id)){const M=N.data.id,k={...i,signal:_};Lt=k;const v=`wss://${k.area||""}/ws/order/${M}/`;En=ri(v,{signal:_});const V=()=>{console.warn("WebSocket connection opened (centralized mode)")},B=P=>{var G;console.error("WebSocket error (centralized mode):",P),Fn(En),En=null,Lt=null,i.setButtonDisabled(!1),(G=i.errorHandler)==null||G.handlePaymentError(P,k)},O=P=>{Iu(P)};En.on("open",V),En.on("message",O),En.on("error",B),En.connect(),Lt.ws=En,Lt.closeWebSocket=()=>{Fn(En),En=null,Lt=null}}return N}catch(N){throw et.isCancel(N)||((y=i.errorHandler)==null||y.handleCreateOrderError(N,i),i.setButtonDisabled(!1)),N}}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=bt();return{handlePaymentError(s,i){var f,h,m,x,_,p;const u=qs(s);rn(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.ws.close(!0)),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),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)),rn(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`),rn(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.ws.close(!0)):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 Nu=()=>{const o=bt();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")no(f,h),o.isButtonDisabled=!1;else if(m==="waiting_for_fiscalization")rn(h,1);else if(m==="payment_initiation_retry"||m==="fiscalized")js(f,h,s,i);else if(m==="payment_initiation")rn(h,2);else if(m==="paid"){rn(h,3);const y=h.ws||s;Fn(y),localStorage.removeItem("cart")}else(C=h.orderErrors)!=null&&C.includes(m)&&io(h,s,i)};return{handleWebSocketStatus(f,h){u(f,h)}}};function Tu(){const o=bt();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")no(f,h),o.isButtonDisabled=!1;else if(m==="sent_fiscalization")rn(h,1);else if(m==="waiting_payment")rn(h,4);else if(m==="paid"){rn(h,3);const y=h.ws||s;Fn(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 ku=()=>{const o=bt();let s=null;const i=mi(),u=(f,h)=>{var x,_;const m=(x=f.params)==null?void 0:x.status;if(m==="sent")no(f,h),o.isButtonDisabled=!1;else if(m==="payment_initiation_retry"||m==="fiscalized")js(f,h,s,i);else if(m==="payment_initiation")rn(h,2);else if(m==="paid"){rn(h,3);const p=h.ws||s;Fn(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 Mn{static initialize(){this.register({id:"TERMINAL_BASE",method:"TERMINAL",handlerFactory:Nu,availableContexts:["kiosk"]}),this.register({id:"YOOKASSA_BASE",method:"YOOKASSA",handlerFactory:ku,availableContexts:["qr","tableservice"]}),this.register({id:"SBP",method:"YOOKASSA",handlerFactory:Tu,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)}}je(Mn,"methods",new Map),Mn.initialize();function Ru(o){return{cleanupAndNavigate(s,i){o.deleteCart(s,i)},cleanup(s){o.deleteCart(null,s)},clearTokens(){o.deleteCart(null,!0)},resetStores(){o.resetStores()}}}function Ou(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 bt=_e.defineStore("cartLib",()=>{const o=Oe.useRouter(),s=Oe.useRoute(),i=yt(),u=at(),{config_lib:f,countBonus:h,totalPrice_lib:m,initialCartPrice_lib:x,is18Allowed:_}=_e.storeToRefs(u),{itemThemes:p}=_e.storeToRefs(i),C=l.ref(!1),y=l.ref(""),N=l.ref(null),M=l.ref("wait"),k=l.ref(!0),L=l.ref(0),v=l.ref(""),V=l.ref([]),B=l.ref([]),O=l.ref(),P=l.ref(0),G=l.ref(!1),Z=l.ref(),H=l.ref(null),ie=l.ref(["failed_payment","failed_after_paid","failed","failed_after_sent","failed_after_sent_fiscalization","payment_initiation_retry","cancelled","failed_after_payment_initiation"]),j=l.ref("Оплатить"),se=l.ref(),oe=l.computed({get:()=>V.value||[],set:Ae=>{(Ae==null?void 0:Ae.length)===1&&(se.value=Ae[0]),V.value=Ae}}),ne=l.ref(!1),U=l.ref(null),W=l.ref(0),S=l.ref(!1),z=l.ref({textNotification:""}),X=Ae=>{S.value=!0,z.value.textNotification=Ae},q=()=>{var Ae,Ge;return(Ae=O.value)!=null&&Ae.front_type?O.value.front_type:((Ge=B.value[0])==null?void 0:Ge.front_type)||null},$=(Ae,Ge,Qe,kt)=>{var lt;const Te=kt??((lt=B.value[0])==null?void 0:lt.front_type);if(!Te)return console.warn("Не удалось определить метод оплаты"),null;const Ie=Mn.getConfig(Te);if(!Ie||!Mn.isMethodAvailable(Te,Ae))return console.warn(`Метод ${Te} недоступен для контекста ${Ae}`),null;const Ue=Mn.createHandler(Te);return Ue?(Z.value=re(Ie.method,Ae,Ge,Qe),{handler:Ue,config:Z.value}):(console.warn(`Не удалось создать обработчик для метода ${Te}`),null)},re=(Ae,Ge,Qe,kt)=>{const Te={method:Ae,context:Ge,is_requestKiosk:Qe,is_tableservice:kt,router:o,route:s,orderErrors:ie.value,area:f.value.area,totalPrice:m,initialCartPrice:x,showNotification:X,deleteCart:He,resetStores:ht,redirect:We=>o.push(We),updateOrderStatus:We=>{U.value=We},setOrderNumber:We=>{H.value=We},loadCart:()=>u.loadCart(),resetBonuses:()=>{h.value=0}},Ie=mi(),Ue=Ru(Te),lt=Ou(Te);return{...Te,errorHandler:Ie,cartCleanup:Ue,navigation:lt}},he=l.computed(()=>!!N.value),fe=Ae=>{M.value=Ae},Ee=Ae=>{N.value=Ae},me=()=>{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=""},Ve=()=>{C.value=!1,M.value="wait",y.value=""},xe=()=>{N.value=null,y.value="",M.value="wait",Ve()},ht=()=>{ne.value=!1,U.value=null},He=(Ae=null,Ge=!1)=>{u.cartProducts_lib=[],u.is_OpenLoyal=!1,dr(["cart"]),Ge&&(dr(["authTokensAccess","authTokensRefresh","user"]),u.profile=null,sessionStorage.removeItem("is_adult"),_.value=!1),Ae&&o.push(`/${s.params.orgId}/${Ae}`)};return{isButtonDisabled:ne,orderCompleted_lib:U,extraDiscount:L,orderNumber:H,is_notification_lib:S,notificationData_lib:z,textPaymentBtn_lib:j,count:W,guestInfo:N,error:y,isDrawerOpen:C,currentState:M,isAuthorized:he,isCreateButtonVisible:k,linkQR:v,orderTypes:oe,providerTypes:B,is_paymentCart:G,selectedOrderType:se,selectedProvider:O,configPayment:Z,paymentCostQR:P,deleteCart:He,setGuestInfo:Ee,setState:fe,openDrawer:me,closeDrawer:Ve,clearCard:xe,showNotification:X,createPaymentHandler:$,getCurrentPaymentMethodId:q,getAvailablePaymentMethods:Ae=>Mn.getAvailableMethods(Ae)}}),Tt=_e.defineStore("cardLib",()=>{var ne;const o=()=>({openCard:null,currentModifier:null,groupModifiers:[],groupModifiersSelected:[],groupCurrentOpen:null,isModifiedAmount:!1,selectedSize:{},productSizes:[],addedProducts:[],plusButtonsRefs:[],modalCount:1,isSectionModifier:!1,isAnimationFly:!0,textErrorRequaired:"",prevLast:{}}),s=yt(),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(!((ne=s.itemThemes)!=null&&ne.kiosk_disable_lock_screen)),y=l.computed(()=>{const U=i.value.groupModifiersSelected.findIndex(W=>W.group===i.value.groupCurrentOpen.id);return N(U)}),N=U=>U===-1?0:(i.value.groupModifiersSelected[U].modifiers||[]).reduce((S,z)=>S+(z.amount||0),0),M=l.computed(()=>{var W;const U=(W=i.value.openCard)==null?void 0:W.group_modifiers.findIndex(S=>S.id===i.value.groupCurrentOpen.id);return U===-1||!i.value.openCard?0:i.value.openCard.modifiers.length>0&&U===0?i.value.openCard.modifiers.reduce((S,z)=>S+z.max_amount,0):i.value.groupModifiers[U].max_amount}),k=l.computed(()=>{var W;const U=(i.value.addedProducts??[]).reduce((S,z)=>S+z.price,0);if(i.value.openCard){const S=i.value.openCard,z=ur(S)||0,X=S.amount||1;return(i.value.groupModifiersSelected.reduce(($,re)=>(re.modifiers.forEach(he=>{var fe,Ee;he.sizes&&(he.price=((Ee=(fe=he.sizes)==null?void 0:fe.find(me=>me.id===i.value.selectedSize.id))==null?void 0:Ee.price)??he.price),$+=he.price*he.amount}),$),0)+z)*X+U}return(W=i.value.addedProducts)!=null&&W.length?U:0}),L=l.computed(()=>{const U=i.value.groupCurrentOpen;if(!U)return!1;const W=i.value.groupModifiers,S=W.findIndex(z=>z.id===U.id);return S===-1?!1:S===W.length-1}),v=U=>{const W=i.value.groupModifiers[U],S=i.value.groupModifiersSelected[U];if(!W)return{valid:!1};if(W.min_amount>0&&N(U)<W.min_amount)return{valid:!1,errorText:`В группе "${W.name}" должно содержаться не меньше ${W.min_amount} модификатора(ов)`};if(S){for(const z of W.group_modifiers)if(z.min_amount>0){const X=S.modifiers.find(q=>q.id===z.id);if(!X||X.amount<z.min_amount)return{valid:!1,errorText:`В группе "${W.name}" выберите все обязательные модификаторы`}}}return{valid:!0}},V=l.computed(()=>{const U=i.value.groupModifiers;for(let W=0;W<U.length;W++){const S=v(W);if(!S.valid)return i.value.textErrorRequaired=S.errorText,{haveRequaire:!0,group:U[W]}}return{haveRequaire:!1,group:U[0]}}),B=()=>{i.value.groupModifiers.forEach((U,W)=>{i.value.groupCurrentOpen={...U,index:W},U.group_modifiers.forEach(S=>{S.default_amount>0&&(S.amount=S.default_amount,se(S,!0))})})},O=U=>{i.value.addedProducts.push(U)},P=U=>{i.value.openCard=U},G=U=>{_.value=[...U]},Z=(U,W,S)=>{var X;const z=i.value.groupModifiers.findIndex(q=>q.id===U.id);if(z!==-1)if(S){const q=i.value.groupModifiers,$=z+1;if($<q.length){const re=q[$];i.value.groupCurrentOpen={...re,index:$},i.value.isSectionModifier=!0}}else{const q=U.id!==((X=i.value.groupCurrentOpen)==null?void 0:X.id);i.value.groupCurrentOpen={...U,index:z},i.value.isSectionModifier=q?!0:!i.value.isSectionModifier}},H=()=>{i.value.modalCount>i.value.currentModifier.min_amount&&i.value.modalCount>=2&&(i.value.modalCount-=1)},ie=()=>{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)},j=(U,W)=>{var z;const S=(z=i.value.groupCurrentOpen)==null?void 0:z.id.toUpperCase();if(!U&&!i.value.isModifiedAmount&&W.max_amount!==1){if(S==="Добавки2000"&&W.max_amount>1)return!0;if(Math.abs(M.value-y.value)>1&&S!=="Добавки2000")return!0}return!1},se=(U,W=!1)=>{i.value.modalCount=1,i.value.currentModifier=U;const S=i.value.groupModifiersSelected.findIndex(z=>z.group===i.value.groupCurrentOpen.id);oe(S,U,W)},oe=(U,W,S)=>{var X,q,$;let z=i.value.groupModifiersSelected;if(U===-1)j(S,W)?i.value.isModifiedAmount=!0:z[i.value.groupCurrentOpen.index]={group:i.value.groupCurrentOpen.id,is_fake:((X=i.value.groupCurrentOpen)==null?void 0:X.is_fake)||!1,is_product_determining:((q=i.value.groupCurrentOpen)==null?void 0:q.is_product_determining)||!1,modifier_count:(($=i.value.currentModifier)==null?void 0:$.amount)||0,modifiers:[{...W,amount:(W==null?void 0:W.amount)??1}]};else{const re=i.value.groupModifiers[U].group_modifiers.findIndex(fe=>fe.id===W.id);if(z[U].modifiers.findIndex(fe=>fe.id===W.id)===-1){if(M.value===1)z[U].modifiers=[];else if(y.value>=M.value)return;j(S,W)?i.value.isModifiedAmount=!0:(z[U].modifiers.push({...W,amount:(W==null?void 0:W.amount)??1}),z[U].modifier_count=z[U].modifiers.reduce((fe,Ee)=>fe+=Ee.amount,0),i.value.isAnimationFly=!0)}else z[U].modifiers=z[U].modifiers.filter(fe=>fe.id!==W.id),z[U].modifier_count=z[U].modifiers.reduce((fe,Ee)=>fe+=Ee.amount,0),i.value.groupModifiers[U].group_modifiers[re].amount=1,i.value.groupModifiers[U].group_modifiers[re].default_amount=0,i.value.isAnimationFly=!1}i.value.groupModifiersSelected=z};return{stateCard:i,totalPrice_libCard:k,recountGroupTotalAmount:y,groupTotalAmount:M,isOpenWindow:f,isUpSale:h,checkedRequiredBtn:V,dataUpSale:x,productCards:_,isAddToCard:m,openProduct:p,is_startPage:C,isLastGroup:L,setProduct:G,summModifierAmount:N,setAddedProducts:O,setCurrentCard:P,minusAmount:H,plusAmount:ie,toggleNotRequire:Z,modifierSelect:se,defaultAmountModifiers:B,validateGroup: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",N="quarter",M="year",k="date",L="Invalid Date",v=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,V=/\[([^\]]+)]|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(W){var S=["th","st","nd","rd"],z=W%100;return"["+W+(S[(z-20)%10]||S[z]||S[0])+"]"}},O=function(W,S,z){var X=String(W);return!X||X.length>=S?W:""+Array(S+1-X.length).join(z)+W},P={s:O,z:function(W){var S=-W.utcOffset(),z=Math.abs(S),X=Math.floor(z/60),q=z%60;return(S<=0?"+":"-")+O(X,2,"0")+":"+O(q,2,"0")},m:function W(S,z){if(S.date()<z.date())return-W(z,S);var X=12*(z.year()-S.year())+(z.month()-S.month()),q=S.clone().add(X,y),$=z-q<0,re=S.clone().add(X+($?-1:1),y);return+(-(X+(z-q)/($?q-re:re-q))||0)},a:function(W){return W<0?Math.ceil(W)||0:Math.floor(W)},p:function(W){return{M:y,y:M,w:C,d:p,D:k,h:_,m:x,s:m,ms:h,Q:N}[W]||String(W||"").toLowerCase().replace(/s$/,"")},u:function(W){return W===void 0}},G="en",Z={};Z[G]=B;var H="$isDayjsObject",ie=function(W){return W instanceof ne||!(!W||!W[H])},j=function W(S,z,X){var q;if(!S)return G;if(typeof S=="string"){var $=S.toLowerCase();Z[$]&&(q=$),z&&(Z[$]=z,q=$);var re=S.split("-");if(!q&&re.length>1)return W(re[0])}else{var he=S.name;Z[he]=S,q=he}return!X&&q&&(G=q),q||!X&&G},se=function(W,S){if(ie(W))return W.clone();var z=typeof S=="object"?S:{};return z.date=W,z.args=arguments,new ne(z)},oe=P;oe.l=j,oe.i=ie,oe.w=function(W,S){return se(W,{locale:S.$L,utc:S.$u,x:S.$x,$offset:S.$offset})};var ne=function(){function W(z){this.$L=j(z.locale,null,!0),this.parse(z),this.$x=this.$x||z.x||{},this[H]=!0}var S=W.prototype;return S.parse=function(z){this.$d=function(X){var q=X.date,$=X.utc;if(q===null)return new Date(NaN);if(oe.u(q))return new Date;if(q instanceof Date)return new Date(q);if(typeof q=="string"&&!/Z$/i.test(q)){var re=q.match(v);if(re){var he=re[2]-1||0,fe=(re[7]||"0").substring(0,3);return $?new Date(Date.UTC(re[1],he,re[3]||1,re[4]||0,re[5]||0,re[6]||0,fe)):new Date(re[1],he,re[3]||1,re[4]||0,re[5]||0,re[6]||0,fe)}}return new Date(q)}(z),this.init()},S.init=function(){var z=this.$d;this.$y=z.getFullYear(),this.$M=z.getMonth(),this.$D=z.getDate(),this.$W=z.getDay(),this.$H=z.getHours(),this.$m=z.getMinutes(),this.$s=z.getSeconds(),this.$ms=z.getMilliseconds()},S.$utils=function(){return oe},S.isValid=function(){return this.$d.toString()!==L},S.isSame=function(z,X){var q=se(z);return this.startOf(X)<=q&&q<=this.endOf(X)},S.isAfter=function(z,X){return se(z)<this.startOf(X)},S.isBefore=function(z,X){return this.endOf(X)<se(z)},S.$g=function(z,X,q){return oe.u(z)?this[X]:this.set(q,z)},S.unix=function(){return Math.floor(this.valueOf()/1e3)},S.valueOf=function(){return this.$d.getTime()},S.startOf=function(z,X){var q=this,$=!!oe.u(X)||X,re=oe.p(z),he=function(Ae,Ge){var Qe=oe.w(q.$u?Date.UTC(q.$y,Ge,Ae):new Date(q.$y,Ge,Ae),q);return $?Qe:Qe.endOf(p)},fe=function(Ae,Ge){return oe.w(q.toDate()[Ae].apply(q.toDate("s"),($?[0,0,0,0]:[23,59,59,999]).slice(Ge)),q)},Ee=this.$W,me=this.$M,Ve=this.$D,xe="set"+(this.$u?"UTC":"");switch(re){case M:return $?he(1,0):he(31,11);case y:return $?he(1,me):he(0,me+1);case C:var ht=this.$locale().weekStart||0,He=(Ee<ht?Ee+7:Ee)-ht;return he($?Ve-He:Ve+(6-He),me);case p:case k:return fe(xe+"Hours",0);case _:return fe(xe+"Minutes",1);case x:return fe(xe+"Seconds",2);case m:return fe(xe+"Milliseconds",3);default:return this.clone()}},S.endOf=function(z){return this.startOf(z,!1)},S.$set=function(z,X){var q,$=oe.p(z),re="set"+(this.$u?"UTC":""),he=(q={},q[p]=re+"Date",q[k]=re+"Date",q[y]=re+"Month",q[M]=re+"FullYear",q[_]=re+"Hours",q[x]=re+"Minutes",q[m]=re+"Seconds",q[h]=re+"Milliseconds",q)[$],fe=$===p?this.$D+(X-this.$W):X;if($===y||$===M){var Ee=this.clone().set(k,1);Ee.$d[he](fe),Ee.init(),this.$d=Ee.set(k,Math.min(this.$D,Ee.daysInMonth())).$d}else he&&this.$d[he](fe);return this.init(),this},S.set=function(z,X){return this.clone().$set(z,X)},S.get=function(z){return this[oe.p(z)]()},S.add=function(z,X){var q,$=this;z=Number(z);var re=oe.p(X),he=function(me){var Ve=se($);return oe.w(Ve.date(Ve.date()+Math.round(me*z)),$)};if(re===y)return this.set(y,this.$M+z);if(re===M)return this.set(M,this.$y+z);if(re===p)return he(1);if(re===C)return he(7);var fe=(q={},q[x]=u,q[_]=f,q[m]=i,q)[re]||1,Ee=this.$d.getTime()+z*fe;return oe.w(Ee,this)},S.subtract=function(z,X){return this.add(-1*z,X)},S.format=function(z){var X=this,q=this.$locale();if(!this.isValid())return q.invalidDate||L;var $=z||"YYYY-MM-DDTHH:mm:ssZ",re=oe.z(this),he=this.$H,fe=this.$m,Ee=this.$M,me=q.weekdays,Ve=q.months,xe=q.meridiem,ht=function(Ge,Qe,kt,Te){return Ge&&(Ge[Qe]||Ge(X,$))||kt[Qe].slice(0,Te)},He=function(Ge){return oe.s(he%12||12,Ge,"0")},Ae=xe||function(Ge,Qe,kt){var Te=Ge<12?"AM":"PM";return kt?Te.toLowerCase():Te};return $.replace(V,function(Ge,Qe){return Qe||function(kt){switch(kt){case"YY":return String(X.$y).slice(-2);case"YYYY":return oe.s(X.$y,4,"0");case"M":return Ee+1;case"MM":return oe.s(Ee+1,2,"0");case"MMM":return ht(q.monthsShort,Ee,Ve,3);case"MMMM":return ht(Ve,Ee);case"D":return X.$D;case"DD":return oe.s(X.$D,2,"0");case"d":return String(X.$W);case"dd":return ht(q.weekdaysMin,X.$W,me,2);case"ddd":return ht(q.weekdaysShort,X.$W,me,3);case"dddd":return me[X.$W];case"H":return String(he);case"HH":return oe.s(he,2,"0");case"h":return He(1);case"hh":return He(2);case"a":return Ae(he,fe,!0);case"A":return Ae(he,fe,!1);case"m":return String(fe);case"mm":return oe.s(fe,2,"0");case"s":return String(X.$s);case"ss":return oe.s(X.$s,2,"0");case"SSS":return oe.s(X.$ms,3,"0");case"Z":return re}return null}(Ge)||re.replace(":","")})},S.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},S.diff=function(z,X,q){var $,re=this,he=oe.p(X),fe=se(z),Ee=(fe.utcOffset()-this.utcOffset())*u,me=this-fe,Ve=function(){return oe.m(re,fe)};switch(he){case M:$=Ve()/12;break;case y:$=Ve();break;case N:$=Ve()/3;break;case C:$=(me-Ee)/6048e5;break;case p:$=(me-Ee)/864e5;break;case _:$=me/f;break;case x:$=me/u;break;case m:$=me/i;break;default:$=me}return q?$:oe.a($)},S.daysInMonth=function(){return this.endOf(y).$D},S.$locale=function(){return Z[this.$L]},S.locale=function(z,X){if(!z)return this.$L;var q=this.clone(),$=j(z,X,!0);return $&&(q.$L=$),q},S.clone=function(){return oe.w(this.$d,this)},S.toDate=function(){return new Date(this.valueOf())},S.toJSON=function(){return this.isValid()?this.toISOString():null},S.toISOString=function(){return this.$d.toISOString()},S.toString=function(){return this.$d.toUTCString()},W}(),U=ne.prototype;return se.prototype=U,[["$ms",h],["$s",m],["$m",x],["$H",_],["$W",p],["$M",y],["$y",M],["$D",k]].forEach(function(W){U[W[1]]=function(S){return this.$g(S,W[0],W[1])}}),se.extend=function(W,S){return W.$i||(W(S,ne,se),W.$i=!0),se},se.locale=j,se.isDayjs=ie,se.unix=function(W){return se(1e3*W)},se.en=Z[G],se.Ls=Z,se.p={},se})})(Ys);var Bu=Ys.exports;const $s=Zs(Bu),Mu=o=>{const s=Oe.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 O=JSON.parse(localStorage.getItem("authTokensAccess")||"");O.length>0&&(B.headers.Authorization=`Bearer ${O}`)}catch{console.warn("accessToken is undefined [useAxios]")}return B},y=B=>{const O=localStorage.getItem("apiKey");return B.headers={"Content-Type":"application/json","x-api-key":O},B},N=async B=>{if(!o.user)return B;const O=o.user.exp??0;if(!($s.unix(O).diff($s())<3e3))return B;const G=os("authTokensRefresh",null,"string");try{const Z=await et.post(`${i}user/token/refresh/`,{refresh:G.value});if(!Z.data.access)return V(),B;localStorage.setItem("authTokensAccess",JSON.stringify(Z.data.access)),L(Z.data),v(is(Z.data.access)),B.headers={...B.headers,Authorization:`Bearer ${Z.data.access}`}}catch(Z){console.error("Failed to refresh token:",Z),V()}return B},M=B=>{B.interceptors.request.use(O=>N(C(O)),O=>Promise.reject(O))};M(h),M(x),M(p);const k=B=>{B.interceptors.request.use(O=>y(O))};k(_),k(f),k(p);const L=(B,O=!1)=>{localStorage.setItem("authTokensAccess",JSON.stringify(B.access)),O&&localStorage.setItem("authTokensRefresh",JSON.stringify(B.refresh))},v=B=>{o.user=B,localStorage.setItem("user",JSON.stringify(B))},V=()=>{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}},Fe=class Fe{constructor(){je(this,"axiosInstanceGet");je(this,"axiosInstancePost");je(this,"axiosInstanceAuthenticationGet");je(this,"axiosInstanceAuthenticationPost");je(this,"axiosInstanceGetApiKey");je(this,"axiosInstancePostApiKey");je(this,"axiosInstanceAuthenticationPostApiKey");je(this,"currentUpsaleController",null);je(this,"controller",new AbortController);this.axiosInstanceGet=Fe._axiosGet,this.axiosInstancePost=Fe._axiosPost,this.axiosInstanceGetApiKey=Fe._axiosPostApiKey,this.axiosInstancePostApiKey=Fe._axiosPostApiKey,this.axiosInstanceAuthenticationPostApiKey=Fe._axiosAuthPostApiKey,this.axiosInstanceAuthenticationGet=Fe._axiosAuthGet,this.axiosInstanceAuthenticationPost=Fe._axiosAuthPost}static create(s){return s&&!Fe._config&&Fe._initialize(s),Fe._config||console.warn("InitConnection не инициализирован"),new Fe}static _initialize(s,i=null){const u=at(),f=Tt(),{config_lib:h}=_e.storeToRefs(u),{stateCard:m,recountGroupTotalAmount:x}=_e.storeToRefs(f);Fe._config=s,Fe._cardStore=f,Fe._stateCard=m,Fe._recountGroupTotalAmount=x,h.value=s;const _=Mu(s);Fe._axiosPostApiKey=_.axiosInstanceGetApiKey,Fe._axiosPostApiKey=_.axiosInstancePostApiKey,Fe._axiosAuthPostApiKey=_.axiosInstanceAuthenticationPostApiKey,Fe._axiosGet=_.axiosInstanceGet,Fe._axiosPost=_.axiosInstancePost,Fe._axiosAuthGet=_.axiosInstanceAuthenticationGet,Fe._axiosAuthPost=_.axiosInstanceAuthenticationPost}get config(){return Fe._config}get cardStore(){return Fe._cardStore}get stateCard(){return Fe._stateCard}get recountGroupTotalAmount(){return Fe._recountGroupTotalAmount}async updateTheme(){var h,m;const s=Ks(),i=yt();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 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 kr(_.id,_),x.push(_);const p=await this.loadGroupProducts(_.id);_.products=p}return await this.cacheImagesInBackground(m),await kr(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 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=at(),{config_lib:u}=_e.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 L,v,V,B,O;const _=bt(),p=h?this.axiosInstanceAuthenticationPostApiKey:this.axiosInstancePostApiKey,C=u?p:this.axiosInstanceAuthenticationPost,y=u?"/device/order/create":"/order/create",N=u?(L=this.config)==null?void 0:L.pointId:(v=this.config)==null?void 0:v.pointId,M={items:s,table:i||null,comment:f};return u&&((V=_.selectedOrderType)!=null&&V.id)&&(M.order_type_id=(B=_.selectedOrderType)==null?void 0:B.id),await(C==null?void 0:C.post(`${(O=this.config)==null?void 0:O.domain}/api/org_unit/${N}${y}`,M,{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 C,y;const h=u?this.axiosInstanceAuthenticationPostApiKey:this.axiosInstancePostApiKey,m=u?this.axiosInstanceAuthenticationPost:this.axiosInstancePost,x=i?h:m,_=i?(C=this.config)==null?void 0:C.pointId:(y=this.config)==null?void 0:y.pointId,p=await(x==null?void 0:x.post(`/org_unit/${_}/cart/calculate-discount/`,s,{signal:f}));return(p==null?void 0:p.status)===200?p.data:p}async maxPayByBonuses(s,i=!0,u=!1,f){const h=at(),m=u?this.axiosInstanceAuthenticationPostApiKey:this.axiosInstancePostApiKey,x=u?this.axiosInstanceAuthenticationPost:this.axiosInstancePost,_=i?m:x,p=await(_==null?void 0:_.post("/cart/max-pay-by-bonuses/",{order_id:s},{signal:f})),C=p==null?void 0:p.data;return h.profile&&C&&"balance"in C&&(h.profile.balance=C.balance),C}async getDeviceInfo(){var u;const s=bt(),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}=_e.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)}}};je(Fe,"_config",null),je(Fe,"_axiosGet"),je(Fe,"_axiosGetApiKey"),je(Fe,"_axiosPostApiKey"),je(Fe,"_axiosAuthPostApiKey"),je(Fe,"_axiosPost"),je(Fe,"_axiosAuthGet"),je(Fe,"_axiosAuthPost"),je(Fe,"_cardStore",null),je(Fe,"_stateCard",null),je(Fe,"_recountGroupTotalAmount",null);let yn=Fe;const Qs=l.ref(!1),Js=l.ref(window.innerWidth),bn=()=>{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"}}},vu=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}=bn(),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,N=_.offsetWidth;let M=_.offsetLeft;if(p!==window){const k=p.getBoundingClientRect();M=_.getBoundingClientRect().left-k.left+p.scrollLeft}M-=(y-N)/2,C.left=Math.max(0,M)}else{const y=p===window?window.innerHeight:p.clientHeight,N=_.offsetHeight;let M=_.offsetTop;if(p!==window){const k=p.getBoundingClientRect();M=_.getBoundingClientRect().top-k.top+p.scrollTop}M-=(y-N)/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))}}),qe=(o,s)=>{const i=o.__vccOpts||o;for(const[u,f]of s)i[u]=f;return i},oo=qe(vu,[["__scopeId","data-v-e47a167d"]]),Lr={mounted(o){let s=!1,i,u,f,h,m,x=0,_=0,p=0,C=0,y=0,N=!1;const M=5;o.style.cursor="grab";const k=V=>{V.button===0&&(m&&(cancelAnimationFrame(m),m=0),s=!0,N=!1,i=V.pageX-o.offsetLeft,u=V.pageY-o.offsetTop,f=o.scrollLeft,h=o.scrollTop,p=V.pageX,C=V.pageY,y=Date.now(),x=0,_=0)},L=V=>{if(!s)return;const B=V.pageX,O=V.pageY,P=Math.abs(B-p),G=Math.abs(O-C);if(!N&&(P>M||G>M)&&(N=!0,o.style.pointerEvents="none"),N){V.stopPropagation(),V.preventDefault();const Z=Date.now(),H=Z-y;H>0&&(x=(B-p)/H*16,_=(O-C)/H*16),p=B,C=O,y=Z;const ie=B-o.offsetLeft,j=O-o.offsetTop,se=ie-i,oe=j-u;o.scrollLeft=f-se,o.scrollTop=h-oe}else p=B,C=O,y=Date.now()},v=V=>{if(s){if(N){if(V.stopPropagation(),V.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,N=!1}};o.addEventListener("mousedown",k),window.addEventListener("mousemove",L),window.addEventListener("mouseup",v),o._dragScrollCleanup=()=>{m&&cancelAnimationFrame(m),o.removeEventListener("mousedown",k),window.removeEventListener("mousemove",L),window.removeEventListener("mouseup",v),o.style.pointerEvents=""}},unmounted(o){o._dragScrollCleanup&&o._dragScrollCleanup()}},Du={},Pu={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 Lu(o,s){return l.openBlock(),l.createElementBlock("svg",Pu,[...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=qe(Du,[["render",Lu]]),Fu=["id","onClick"],Vu={class:"modified_plus_btn"},Uu=["src"],zu={key:2,class:"wrapper_modifier_item"},Hu={key:0,class:"modifier_item_n_wrapper"},Gu=["src"],Wu={key:1,class:"modifier_plus_item"},Xu=["src"],ju=["src"],ea=qe(l.defineComponent({__name:"PlusModifier",props:{isSectionModifier:{type:Boolean},toggleNotRequire:{type:Function}},setup(o){const s=Tt(),i=yt(),{stateCard:u}=_e.storeToRefs(s),{itemThemes:f}=_e.storeToRefs(i),{shouldUseDragScroll:h}=bn(),m=l.ref([]),x=l.ref([]),_=l.ref(null),p=l.ref(null),C=l.ref(null),y=M=>{M instanceof HTMLElement&&!m.value.includes(M)&&m.value.push(M)},N=M=>{C.value=M};return l.onMounted(async()=>{await l.nextTick(),u.value.plusButtonsRefs=m.value}),l.watchEffect(()=>{x.value=u.value.groupModifiersSelected,document.body.style.overflow=""}),l.watch(()=>{var M;return(M=u.value.groupCurrentOpen)==null?void 0:M.id},async M=>{var L;if(!M)return;await l.nextTick();const k=m.value.find(v=>v.id==="scrolling"+M);k&&((L=p.value)==null||L.scrollToElement(k))}),l.onBeforeUnmount(()=>{m.value=[],u.value.plusButtonsRefs=[]}),(M,k)=>(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,{ref_key:"scrollCenterRef",ref:p,axis:"x",behavior:"smooth",container:_.value,autoScroll:!0,idActive:C.value,clearContainer:!0},{default:l.withCtx(({handleTargetClick:L})=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(u).groupModifiers,(v,V)=>{var B,O;return l.openBlock(),l.createElementBlock("div",{class:"button_modified",key:v.id,ref_for:!0,ref:y,id:"scrolling"+v.id,"data-clickable":"true",onClick:P=>{o.toggleNotRequire&&o.toggleNotRequire(v,V),N(v.id),L(P)}},[l.createElementVNode("div",Vu,[x.value[V].modifiers.length===0?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass([{modified_plus_btn_active:v.id===((B=l.unref(u).groupCurrentOpen)==null?void 0:B.id)&&o.isSectionModifier},"modified_plus_active"])},[l.createVNode(so,{"aria-label":`Открыть группу модификаторов ${v.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:v.id===((O=l.unref(u).groupCurrentOpen)==null?void 0:O.id)&&o.isSectionModifier}])},[l.createElementVNode("img",{src:x.value[V].modifiers[0].image_link||l.unref(f).fallback_image||"",alt:"Модификатор"},null,8,Uu)],2)):(l.openBlock(),l.createElementBlock("div",zu,[x.value[V].modifiers.length>2?(l.openBlock(),l.createElementBlock("div",Hu,[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,Gu)):(l.openBlock(),l.createElementBlock("p",Wu," + "+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,Xu)):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,ju)):l.createCommentVNode("",!0)])]))]),l.createElementVNode("p",null,l.toDisplayString(v.name),1)],8,Fu)}),128))]),_:1},8,["container","idActive"])],2)),[[l.unref(Lr),l.unref(h)?{}:!1]]):l.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-7f238435"]]),qu={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Zu=["stroke"],ta=l.defineComponent({__name:"Close",props:{color:{type:String,required:!1,default:"currentColor"}},setup(o){const s=o;return(i,u)=>(l.openBlock(),l.createElementBlock("svg",qu,[l.createElementVNode("path",{d:"M18 18L12 12M12 12L6 6M12 12L18 6M12 12L6 18",stroke:s.color,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,8,Zu)]))}}),Yu={},$u={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 Ku(o,s){return l.openBlock(),l.createElementBlock("svg",$u,[...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 Fr=qe(Yu,[["render",Ku]]),Vr={mounted(o){o.muted=!0,o.setAttribute("muted","")}},Qu=["disabled","id"],on=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,Qu))}}),Ju={class:"notification_info"},ed={key:0,class:"notification_18plus"},td={class:"notification_18plus_image"},nd=["src"],rd={class:"notification_18plus_text"},id={class:"notification_18plus_accept"},od={key:1,class:"notification_text"},sd={key:0,class:"wrapper_button_accept"},pi=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=yt(),u=at(),{is18Allowed:f,notificationData_lib:h}=_e.storeToRefs(u),{itemThemes:m}=_e.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)},N=()=>{C.value=!1},M=()=>{C.value=!1,clearTimeout(p)};return l.watch([C,()=>s.textNotificationDefault,_],([k,L,v],[V,B])=>{p&&(!k||k!==V||L!==B)&&clearTimeout(p),v&&k&&(p=setTimeout(M,4e3))},{immediate:!0}),l.onUnmounted(()=>{p&&M()}),(k,L)=>(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:N})]),_: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:N},[l.createElementVNode("div",{class:"notification_wrapper",style:l.normalizeStyle({"background-color":x.value,border:`2px solid ${x.value}`})},[l.createElementVNode("div",Ju,[o.type?(l.openBlock(),l.createElementBlock("div",ed,[l.createElementVNode("div",td,[l.createElementVNode("img",{src:l.unref(m).adult_disclaimer_image||l.unref(m).fallback_image,alt:"Дисклеймер"},null,8,nd)]),l.createElementVNode("div",rd,l.toDisplayString(l.unref(m).adult_disclaimer_text),1),l.createElementVNode("div",id,[L[0]||(L[0]=l.createElementVNode("label",{for:"plus18"},"Содержащиеся в настоящем разделе материалы предназначены для лиц старше 18 лет, носят информационный характер об ассортименте товаров и не являются рекламой. ",-1)),l.createVNode(on,{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",sd,[l.createVNode(on,{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))}}),ad={class:"wrapper_modifiers"},ld={class:"wrapper_nutritional_value"},cd={class:"nutritional_scheme"},ud={key:0,class:"nutritional_parameters"},dd={key:1,class:"nutritional_parameters"},fd={key:2,class:"nutritional_parameters"},hd={key:3,class:"nutritional_parameters"},gd={ref:"modifierBody",class:"modifier_shadow"},md={class:"wrapper_modifiers_title"},pd={class:"wrapper_text_count_modifiers"},xd=["id","aria-label","onClick"],wd={key:0,class:"counter_modifier"},_d={class:"hide_image_corners"},Cd=["src","alt"],Ed={key:1,loop:"",autoplay:"",muted:"",playsinline:"",class:"card__video"},yd=["src"],bd={class:"modifier_title"},Ad={key:0,class:"modifier_continue_or_add_wrapper"},Id=qe(l.defineComponent({__name:"SectionModifiers",emits:["close","add-to-cart"],setup(o,{emit:s}){const i=s,u=yt(),f=Tt(),{itemThemes:h}=_e.storeToRefs(u),{stateCard:m,recountGroupTotalAmount:x,groupTotalAmount:_,isLastGroup:p}=_e.storeToRefs(f),{isDesktop:C,shouldUseDragScroll:y}=bn(),N=l.ref(null),M=Vt.useTemplateRefsList(),k=l.ref(!1),L=B=>{if(!B)return;const O=m.value.groupModifiers.findIndex(ie=>ie.id===m.value.groupCurrentOpen.id),P=m.value.plusButtonsRefs[O]||m.value.plusButtonsRefs[0];if(!P)return;const G=B.getBoundingClientRect(),Z=P.getBoundingClientRect(),H=B.cloneNode(!0);H.classList.add("flyer"),Object.assign(H.style,{width:`${G.width}px`,height:`${G.height}px`,left:`${G.left}px`,top:`${G.top}px`,position:"fixed",zIndex:"1000"}),document.body.appendChild(H),N.value=H,requestAnimationFrame(()=>{const ie=Z.left+Z.width/3-(G.left+G.width/2),j=Z.top+Z.height/4-(G.top+G.height/2),se=Z.width/G.width*.2;H.style.transform=`translate(${ie}px, ${j}px) scale(${se})`,H.style.opacity="0.4",H.style.transition="transform 0.5s ease, opacity 0.5s ease"}),H.addEventListener("transitionend",()=>{H.remove(),N.value=null,P.classList.add("bump"),setTimeout(()=>P.classList.remove("bump"),300)},{once:!0})},v=()=>{m.value.isSectionModifier=!0;const B=m.value.groupCurrentOpen;if(!B)return;const O=m.value.groupModifiers.findIndex(G=>G.id===B.id),P=f.validateGroup(O);if(!P.valid){m.value.textErrorRequaired=P.errorText,k.value=!0;return}p.value?i("add-to-cart"):f.toggleNotRequire(B,void 0,!0)};l.watch(()=>m.value.isAnimationFly,B=>{B===!0&&m.value.currentModifier&&(L(M.value.find(O=>O.id===m.value.currentModifier.id)),m.value.isAnimationFly=!1)});const V=l.computed(()=>h.value.enable_sequential_modifiers?h.value.enable_sequential_modifiers:!0);return(B,O)=>{var P,G,Z,H,ie,j,se,oe,ne,U,W,S,z,X;return l.openBlock(),l.createElementBlock(l.Fragment,null,[(l.openBlock(),l.createBlock(l.Teleport,{to:"body"},[l.createVNode(pi,{visible:k.value,textNotificationDefault:l.unref(m).textErrorRequaired,backgroundColor:l.unref(h).accent_color?l.unref(h).accent_color:"#FF6D2E","onUpdate:visible":O[0]||(O[0]=q=>k.value=q)},null,8,["visible","textNotificationDefault","backgroundColor"])])),l.createElementVNode("div",ad,[l.createElementVNode("div",ld,[l.createElementVNode("div",{class:l.normalizeClass(["card_header_inner_back",[(P=l.unref(m).openCard)!=null&&P.proteins_amount?"card_header_inner_back_nutrients":""]]),"aria-label":"Закрыть выбор модификаторов",onClick:O[1]||(O[1]=q=>i("close"))},[l.createVNode(Fr,{class:"arrow_bottom"})],2),l.createElementVNode("div",cd,[(G=l.unref(m).openCard)!=null&&G.energy_amount?(l.openBlock(),l.createElementBlock("div",ud,[l.createElementVNode("b",null,l.toDisplayString((Z=l.unref(m).openCard)==null?void 0:Z.energy_amount),1),O[4]||(O[4]=l.createElementVNode("p",null,"Килокалории",-1))])):l.createCommentVNode("",!0),(H=l.unref(m).openCard)!=null&&H.proteins_amount?(l.openBlock(),l.createElementBlock("div",dd,[l.createElementVNode("b",null,l.toDisplayString((ie=l.unref(m).openCard)==null?void 0:ie.proteins_amount),1),O[5]||(O[5]=l.createElementVNode("p",null,"Белки",-1))])):l.createCommentVNode("",!0),(j=l.unref(m).openCard)!=null&&j.fat_amount?(l.openBlock(),l.createElementBlock("div",fd,[l.createElementVNode("b",null,l.toDisplayString((se=l.unref(m).openCard)==null?void 0:se.fat_amount),1),O[6]||(O[6]=l.createElementVNode("p",null,"Жиры",-1))])):l.createCommentVNode("",!0),(oe=l.unref(m).openCard)!=null&&oe.carbohydrates_amount?(l.openBlock(),l.createElementBlock("div",hd,[l.createElementVNode("b",null,l.toDisplayString((ne=l.unref(m).openCard)==null?void 0:ne.carbohydrates_amount),1),O[7]||(O[7]=l.createElementVNode("p",null,"Углеводы",-1))])):l.createCommentVNode("",!0)]),l.createElementVNode("div",{class:l.normalizeClass(["card_header_inner_back card_header_inner_close_back",[(U=l.unref(m).openCard)!=null&&U.proteins_amount?"card_header_inner_back_nutrients":""]]),style:{marginRight:"10px"},"aria-label":"Закрыть выбор модификаторов",onClick:O[2]||(O[2]=q=>i("close"))},[l.createVNode(ta,{class:"cross_bottom",color:"#FFFFFF"})],2)]),l.createElementVNode("div",gd,[l.createElementVNode("p",md,l.toDisplayString((W=l.unref(m).groupCurrentOpen)==null?void 0:W.name),1),l.createElementVNode("p",pd,"Выбрано "+l.toDisplayString(l.unref(x))+" из "+l.toDisplayString(l.unref(_)),1),l.withDirectives((l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass((S=l.unref(m).groupModifiers.find(q=>{var $;return q.id===(($=l.unref(m).groupCurrentOpen)==null?void 0:$.id)}))!=null&&S.group_modifiers.length?"wrapper_modifiers_card":"wrapper_modifiers_card_column")},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(((z=l.unref(m).groupCurrentOpen)==null?void 0:z.group_modifiers)||[],q=>{var $,re,he;return l.openBlock(),l.createElementBlock("div",{key:q.id,ref_for:!0,ref:l.unref(M).set,id:q.id,style:l.normalizeStyle({pointerEvents:l.unref(C)?"none":"auto"}),class:l.normalizeClass(["modifier_card",{hidden_modifier_card:q.default_amount===0&&(($=l.unref(m).groupCurrentOpen)==null?void 0:$.id)==="Добавки2000"&&q.min_amount===0&&q.max_amount===0}]),tabindex:"0",role:"button","data-clickable":"true","aria-label":`Выбрать модификатор группы ${q.name}`,onClick:fe=>l.unref(f).modifierSelect(q)},[l.createElementVNode("div",{class:l.normalizeClass([{modifier_card_active:l.unref(m).groupModifiersSelected.some(fe=>{var Ee;return fe.group===((Ee=l.unref(m).groupCurrentOpen)==null?void 0:Ee.id)&&fe.modifiers.some(me=>me.id===q.id)})},"wrapper_image_corners"])},[q.amount>1?(l.openBlock(),l.createElementBlock("div",wd,l.toDisplayString(q.amount),1)):l.createCommentVNode("",!0),l.createElementVNode("div",_d,[q.video_link?l.withDirectives((l.openBlock(),l.createElementBlock("video",Ed,[l.createElementVNode("source",{src:q.video_link||"",type:"video/webm"},null,8,yd)])),[[l.unref(Vr)]]):(l.openBlock(),l.createElementBlock("img",{key:0,class:"modifier_image",src:q.image_link||l.unref(h).fallback_image||"",alt:q.name},null,8,Cd)),l.createElementVNode("div",{class:l.normalizeClass(["wrapper_modifier_title",{wrapper_modifier_title_required:q.min_amount>0||q.required}])},[l.createElementVNode("h3",bd,l.toDisplayString(q.name),1),l.createElementVNode("p",null,"+"+l.toDisplayString(((he=(re=q.sizes)==null?void 0:re.find(fe=>fe.id===l.unref(m).selectedSize.id))==null?void 0:he.price)||q.price||0)+"₽",1)],2)])],2)],14,xd)}),128))],2)),[[l.unref(Lr),(X=l.unref(m).groupModifiers.find(q=>{var $;return q.id===(($=l.unref(m).groupCurrentOpen)==null?void 0:$.id)}))!=null&&X.group_modifiers.length?{}:!1]]),V.value?(l.openBlock(),l.createElementBlock("div",Ad,[l.createElementVNode("button",{onClick:O[3]||(O[3]=q=>v()),class:"modifier_continue_or_add"},l.toDisplayString(l.unref(p)?"Добавить":"Продолжить"),1)])):l.createCommentVNode("",!0)],512)])],64)}}}),[["__scopeId","data-v-9c8507e6"]]),Sd={key:0,class:"card_size_place"},Nd=["onClick","aria-label"],Td={key:1,class:"card_size static"},kd=["onClick","aria-label"],ao=3,Rd=qe(l.defineComponent({__name:"SizeModifier",setup(o){const s=Tt(),{stateCard:i}=_e.storeToRefs(s),u=l.ref(null),{isDesktop:f}=bn(),h=l.ref(50),m=l.ref(),x=l.ref(0),_=l.ref(0),p=l.ref(null),C=l.computed(()=>{var P;if(i.value.productSizes.length<=3)return i.value.productSizes[m.value.index]||i.value.productSizes[0];const B=x.value+1,O=((P=N.value[B])==null?void 0:P.originalIndex)??1;return i.value.productSizes[O]}),y=()=>{p.value&&i.value.productSizes.length>=3&&(_.value=p.value.offsetWidth/ao)},N=l.computed(()=>{if(i.value.productSizes.length<=3)return i.value.productSizes;const B=i.value.productSizes;return[...B.map((O,P)=>({...O,originalIndex:P})),...B.map((O,P)=>({...O,originalIndex:P})),...B.map((O,P)=>({...O,originalIndex:P}))]}),M=(B,O)=>{if(m.value={id:B.id,title:B.name,index:O,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 P=x.value+1;O<P?k():O>P&&L()}else{const P=i.value.productSizes.length,G=(O+.5)*(100/P);h.value=G}},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 O=(B=p.value)==null?void 0:B.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()}},L=()=>{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 O=(B=p.value)==null?void 0:B.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 G;if(i.value.productSizes.length<=3)return;const B=x.value+1,O=((G=N.value[B])==null?void 0:G.originalIndex)??0,P=i.value.productSizes[O];m.value={id:P.id,title:P.name,index:O,is_default:P.is_default}};l.watch(()=>[i.value.productSizes,p.value],([B=[],O])=>{if(Array.isArray(B)&&B.length>0&&O!==null){let P=B.findIndex(G=>G.is_default===!0);B.length<3&&u.value&&parseInt(u.value.style.minWidth)<767&&(u.value.style.width="100px"),P>-1?(x.value=P,M(B[P],P),_.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,O])=>{if(!B||!Array.isArray(O))return;const P=O.map(G=>({...G,modifiers:G.modifiers.map(Z=>{if(!Z.sizes||Z.sizes.length===0)return Z;const H=Z.sizes.find(ie=>ie.id===B);return H?{...Z,size:H,price:H.price??Z.price}:Z})}));JSON.stringify(P)!==JSON.stringify(i.value.groupModifiersSelected)&&(i.value.groupModifiersSelected=P)},{deep:!0});const V={mounted:y};return l.onBeforeUnmount(()=>{window.removeEventListener("resize",y)}),(B,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",Sd,[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(N.value,(P,G)=>(l.openBlock(),l.createElementBlock("li",{key:`${P.id}-${G}`,onClick:Z=>M(P,G),class:l.normalizeClass({active:m.value.id===P.id&&m.value.index===P.originalIndex}),tabindex:"0",role:"button","aria-label":`Выбрать размер ${P.name}`},l.toDisplayString(P.alt_name?P.alt_name:P.name),11,Nd))),128))],4)):(l.openBlock(),l.createElementBlock("ul",Td,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(i).productSizes,(P,G)=>(l.openBlock(),l.createElementBlock("li",{key:`${P.id}-${G}`,onClick:Z=>M(P,G),class:l.normalizeClass({active:m.value.id===P.id&&m.value.index===G}),tabindex:"0",role:"button","aria-label":`Выбрать размер ${P.name}`},l.toDisplayString(P.alt_name?P.alt_name:P.name),11,kd))),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)),[[V]]):l.createCommentVNode("",!0)])):l.createCommentVNode("",!0)],512)],512)),[[l.vShow,l.unref(i).productSizes.length>1&&m.value]])}}),[["__scopeId","data-v-ec659ddc"]]),Od="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",Bd={class:"counter_container"},Md={class:"card_size_place_wrapper",ref:"sliderWrapper"},vd={class:"cart_amount_counter"},Dd={class:"button_circle_number"},Pd=qe(l.defineComponent({__name:"NumberModifier",props:{qr_menu:{type:Boolean}},setup(o){const s=Tt(),{stateCard:i}=_e.storeToRefs(s),u=Oe.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",Bd,[l.createElementVNode("div",Md,[l.createElementVNode("div",vd,[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",Dd,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 Ut=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))}}),Ld={class:"button_price button_price_modifiers"},Fd=["src"],Vd={class:"button_text_container"},Ud={class:"button_text_price"},zd=qe(l.defineComponent({__name:"ButtonPriceCount",props:{qr_menu:{type:Boolean,default:!1},closeProduct:{}},setup(o,{expose:s}){const i=Oe.useRouter(),u=Oe.useRoute(),f=Tt(),h=at(),m=yt(),x=o,{stateCard:_,totalPrice_libCard:p,isOpenWindow:C,isAddToCard:y}=_e.storeToRefs(f),{isDesktop:N}=bn(),{itemThemes:M}=_e.storeToRefs(m),k=l.ref(!0),L=l.ref(!1),v=l.computed(()=>N.value?!1:k.value),V=l.ref([]),B=l.ref([]),O=()=>{var G,Z,H,ie,j;if((Z=(G=i.options.history.state)==null?void 0:G.back)!=null&&Z.includes("mode=pdf")&&x.qr_menu)return;if(k.value){f.setCurrentCard(_.value.openCard),L.value=!0;const se=_.value.groupModifiers.findIndex(oe=>f.checkedRequiredBtn.group.id===oe.id);f.checkedRequiredBtn.haveRequaire&&f.toggleNotRequire(f.checkedRequiredBtn.group,se);return}const P=_.value.groupModifiersSelected||[];if(V.value=[],B.value=[],Array.isArray(P)&&P.length>0&&P.forEach(se=>{const oe=se.group,ne=se.modifiers||[];oe==="Добавки2000"?V.value=ne.map(U=>{var W;return{...U,old_price:U.price,size:Array.isArray(U.size)?U.size.map(S=>S.id).filter(Boolean):(W=U.size)!=null&&W.id?U.size.id:void 0}}):ne.length>0&&B.value.push({group:oe,is_fake:se.is_fake||!1,is_product_determining:se.is_product_determining||!1,modifiers:ne.map(U=>{var W;return{...U,old_price:U.price,size:Array.isArray(U.size)?U.size.map(S=>S.id).filter(Boolean):(W=U.size)!=null&&W.id?U.size.id:void 0}})})}),document.body.style.overflow="",_.value.openCard){const se={id:_.value.openCard.id,is_fake:_.value.openCard.is_fake||!1,is_od_united_product:_.value.openCard.is_od_united_product||!1,amount:_.value.openCard.amount,name:_.value.openCard.name,image_link:_.value.openCard.image_link,price:_.value.openCard.price,old_price:_.value.openCard.price,size:((H=_.value.selectedSize)==null?void 0:H.id)??((j=(ie=_.value.openCard.sizes)==null?void 0:ie.find(oe=>oe.is_default))==null?void 0:j.id),sizes:_.value.openCard.sizes||[],modifiers:V.value,groups:_.value.openCard.groups,group_modifiers:B.value,energy_amount:_.value.openCard.energy_amount??0,proteins_amount:_.value.openCard.proteins_amount??0,fat_amount:_.value.openCard.fat_amount??0,carbohydrates_amount:_.value.openCard.carbohydrates_amount??0};x.closeProduct&&x.closeProduct(),h.addToCart(se),y.value=!0}C.value=!1,x.qr_menu&&i.push(`/${u.params.orgId}/`)};return l.watch(()=>_.value.productSizes,P=>{!P||P.length===0||!_.value.selectedSize||(_.value.selectedSize={..._.value.selectedSize})},{immediate:!0}),l.watchEffect(()=>{f.checkedRequiredBtn.haveRequaire?k.value=!0:k.value=!1}),l.onMounted(()=>{y.value=!1}),s({addProductToCart:O}),(P,G)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[(l.openBlock(),l.createBlock(l.Teleport,{to:"body"},[l.createVNode(pi,{visible:L.value,textNotificationDefault:l.unref(_).textErrorRequaired,backgroundColor:l.unref(M).accent_color?l.unref(M).accent_color:"#FF6D2E",buttonAccept:null,"onUpdate:visible":G[0]||(G[0]=Z=>L.value=Z)},null,8,["visible","textNotificationDefault","backgroundColor"])])),l.createElementVNode("div",{class:"button_price_bg_product",onTouchstart:G[3]||(G[3]=l.withModifiers(()=>{},["stop"])),onPointerdown:G[4]||(G[4]=l.withModifiers(()=>{},["stop"]))},[l.createElementVNode("div",Ld,[l.unref(N)?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(Pd,{key:0,qr_menu:o.qr_menu},null,8,["qr_menu"])),l.createElementVNode("div",{class:l.normalizeClass(["card_product_button_buy",{buy_active:!v.value}]),"data-clickable":"true",onClick:O,onTouchstart:G[1]||(G[1]=l.withModifiers(()=>{},["stop"])),onPointerdown:G[2]||(G[2]=l.withModifiers(()=>{},["stop"]))},[l.unref(N)?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("img",{key:0,src:l.unref(Od),class:"card_product_button_icon"},null,8,Fd)),l.createElementVNode("div",Vd,[l.createElementVNode("p",Ud,[l.createVNode(Ut,{price:+l.unref(p),fixedFloat:2},null,8,["price"]),G[5]||(G[5]=l.createTextVNode(" ₽ ",-1))])])],34)])],32)],64))}}),[["__scopeId","data-v-15db613c"]]),Hd={class:"modified_amount"},Gd={class:"hide_image_corners"},Wd=["src"],Xd={class:"wrapper_modifier_title"},jd={class:"amount_title"},qd={class:"wrapper_amount_counter"},Zd={class:"amount_count"},Yd={class:"amount_wrapper"},$d={class:"add_counter_amount"},Kd=qe(l.defineComponent({__name:"ModalAmount",setup(o){const s=Tt(),i=yt(),{itemThemes:u}=_e.storeToRefs(i),{stateCard:f}=_e.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",Hd,[l.createElementVNode("div",Gd,[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,Wd),l.createElementVNode("div",Xd,[l.createElementVNode("p",jd,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",qd,[l.createElementVNode("div",{class:"amount_mines",onClick:p[0]||(p[0]=l.withModifiers((...N)=>l.unref(s).minusAmount&&l.unref(s).minusAmount(...N),["stop"]))},[...p[1]||(p[1]=[l.createElementVNode("div",null,null,-1)])]),l.createElementVNode("p",Zd,l.toDisplayString(l.unref(f).modalCount),1),l.createElementVNode("div",Yd,[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",$d,[l.createVNode(on,{textButtonDefault:"Добавить",onClick:m,class:"button_add_group_modifiers"})])],64)}}}),[["__scopeId","data-v-84debd5d"]]),Qd=(o,s,i)=>Math.max(s,Math.min(o,i)),Jd=(o,s)=>Math.pow(o,s*5),ra=(o,s,i)=>s===0||Math.abs(s)===1/0?Jd(o,i):o*s*i/(s+i*o),xi=(o,s)=>s*parseFloat(o)/100,lo=(o,s,i,u=.15)=>u===0?Qd(o,s,i):o<s?-ra(s-o,i-s,u)+s:o>i?+ra(o-i,i-s,u)+i:o,Jt=(o,{min:s,max:i})=>s!==void 0&&o<s?s:i!==void 0&&o>i?i:o;function e0(o,s,i){const u=l.ref(0),f=l.computed(()=>o.value.map(_=>typeof _=="string"?xi(_,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=qe(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=l.ref(!1),_=Vt.useVModel(u,"modelValue",f,{passive:!0});l.watch(_,Ie=>{Ie?fe():Ee||me()}),l.onMounted(()=>{_.value&&fe()});const p=l.ref(),C=l.ref(null),y=l.ref(null),N=l.ref(null),M=l.ref(null),k=l.ref(u.expandOnContentDrag),{height:L}=Vt.useWindowSize(),{height:v}=Vt.useElementBounding(p),{height:V}=Vt.useElementBounding(C),{height:B}=Vt.useElementBounding(M),{height:O}=Vt.useElementBounding(y),P=l.computed({get(){return Jt(Math.ceil(B.value+V.value+O.value),{max:L.value})},set(Ie){[V.value,B.value,O.value]=Ie}}),G=l.ref(0),Z=l.ref(0),H=Et.useMotionValue(0),ie=Et.useMotionValue(0),{snapPoints:j}=l.toRefs(u),se=l.computed(()=>j.value??[P.value]),{flattenedSnapPoints:oe,currentSnapPointIndex:ne,closestSnapPointIndex:U,minSnapPoint:W,maxSnapPoint:S}=e0(se,G,L);let z;function X(Ie){k.value=!0,q(Ie)}function q(Ie){k.value&&Ie.preventDefault()}const $=Ie=>{Ie.key==="Escape"&&me()},re=()=>{u.canBackdropClose&&me()};let he=!1;const fe=async()=>{var Ie;if(!he){Ee&&(Ee=!1,h&&(clearTimeout(h),h=null)),m.value++,_.value=!0,he=!0,f("opening-started");try{await l.nextTick(),await l.nextTick();const Ue=(Ie=p.value)==null?void 0:Ie.$el;if(!Ue){console.warn("[BottomSheet] sheet not ready, aborting"),_.value=!1;return}v.value=Ue.getBoundingClientRect().height;const lt=Ue.querySelector("[data-vsbs-content]"),We=Ue.querySelector("[data-vsbs-header]"),$e=Ue.querySelector("[data-vsbs-footer]");if(P.value=[We.getBoundingClientRect().height,lt.getBoundingClientRect().height,$e.getBoundingClientRect().height],await l.nextTick(),ne.value=oe.value.findIndex(Me=>Me===W.value),u.initialSnapPoint){const Me=u.initialSnapPoint;if(Me<0||Me>=se.value.length)return console.warn("Index out of bounds");G.value=typeof se.value[Me]=="number"?Jt(se.value[Me],{max:L.value}):xi(se.value[Me],L.value)}else G.value=Jt(W.value,{max:L.value});Z.value=G.value,H.jump(G.value),ie.jump(G.value),requestAnimationFrame(()=>{z=Et.animate(H,G.value,{duration:u.duration/1e3,ease:"easeInOut"}),z=Et.animate(ie,0,{duration:u.duration/1e3,ease:"easeInOut",onComplete:()=>{u.blocking&&f("opened")}})}),window.addEventListener("keydown",$)}finally{he=!1}}};let Ee=!1;const me=()=>{Ee||(he&&(he=!1),z&&z.stop(),ie.stop(),H.stop(),Et.animate(ie,G.value||500,{duration:u.duration/1e3,ease:"easeInOut"}),x.value=!1,_.value=!1,Ee=!0,f("closing-started"),window.removeEventListener("keydown",$),h&&clearTimeout(h),h=setTimeout(()=>{f("closed"),Ee=!1,h=null},u.duration))},Ve=Ie=>{if(se.value){if(Ie<0||Ie>=se.value.length){console.warn("Index out of bounds");return}ne.value=Ie,G.value=typeof se.value[Ie]=="number"?Jt(se.value[Ie],{max:L.value}):xi(se.value[Ie],L.value),z=Et.animate(H,G.value,{duration:u.duration/1e3,ease:"easeInOut",onComplete:()=>f("snapped",se.value.indexOf(se.value[Ie]))})}};function xe(Ie){Ie>0?f("dragging-down"):Ie<0&&f("dragging-up")}const ht=()=>{x.value=!0,G.value=v.value,Z.value=ie.get(),H.jump(G.value),ie.jump(Z.value)},He=async(Ie,Ue)=>{await l.nextTick(),p.value&&(Z.value<=0&&(G.value-=Ue.delta.y),G.value<=W.value&&(G.value=W.value,Z.value+=Ue.delta.y,x.value=!0,ie.set(u.canSwipeClose?Jt(Z.value,{min:0}):Jt(lo(Z.value,-v.value,0,.5),{min:0}))),H.set(Jt(lo(G.value,0,S.value,.25),{min:0,max:L.value})),xe(Ue.delta.y))},Ae=()=>{if(u.canSwipeClose){let Ie=G.value/2;u.swipeCloseThreshold&&typeof u.swipeCloseThreshold=="number"&&(Ie=u.swipeCloseThreshold),u.swipeCloseThreshold&&typeof u.swipeCloseThreshold=="string"&&u.swipeCloseThreshold.includes("%")&&(Ie=G.value*(Number(u.swipeCloseThreshold.replace("%",""))/100)),Math.abs(Z.value)>Ie&&(Z.value=G.value)}else Z.value=0;if(z=Et.animate(ie,Z.value,{duration:u.duration/1e3,ease:"easeInOut"}),Z.value===G.value){Z.value=0,me();return}ne.value=U.value,G.value=typeof se.value[U.value]=="number"?Jt(se.value[U.value],{max:L.value}):xi(se.value[U.value],L.value),z=Et.animate(H,G.value,{duration:u.duration/1e3,ease:"easeInOut",onComplete:()=>f("snapped",se.value.indexOf(se.value[U.value]))}),z=Et.animate(ie,0,{duration:u.duration/1e3,ease:"easeInOut"})},Ge=(Ie,Ue)=>{if(G.value=v.value,Z.value=ie.get(),z&&z.stop(),!N.value)return;const lt=N.value.scrollTop===0,We=Ue.delta.y>0,$e=oe.value.length===1,Me=.5>Math.abs(G.value-S.value);if($e){if(!u.expandOnContentDrag)return k.value=!1;ie.get()===0&&lt&&We&&(k.value=!0),ie.get()===0&&lt&&!We&&(k.value=!1)}else{if(!u.expandOnContentDrag)return k.value=!1;x.value=!0,k.value=!0,Me&&(We&&lt&&(k.value=!0),!We&&lt&&(k.value=!1),lt||(k.value=!1))}},Qe=async(Ie,Ue)=>{if(await l.nextTick(),!u.expandOnContentDrag)return k.value=!1;if(!p.value)return;Z.value===0&&k.value&&u.expandOnContentDrag&&(G.value-=Ue.delta.y),G.value<=W.value&&(G.value=W.value,k.value&&u.expandOnContentDrag&&(Z.value+=Ue.delta.y),Z.value=Jt(Z.value,{min:0,max:W.value}),ie.set(u.canSwipeClose?Jt(Z.value,{min:0}):Jt(lo(Z.value,-v.value,0,.5),{min:0}))),G.value>S.value&&(G.value=S.value),G.value=Jt(G.value,{max:L.value}),!(oe.value.length===1)&&G.value===S.value&&(k.value=!1),H.set(G.value),xe(Ue.delta.y)},kt=()=>{if(!N.value)return;const Ie=N.value.scrollTop===0;k.value=Ie},Te=Vt.useDebounceFn(Ie=>Ve(Ie),u.duration);return l.watch(se,(Ie,Ue)=>{if(_.value===!1||!Ie||!Ue)return;const lt=Ie[ne.value],We=Ue[ne.value];typeof lt!="string"&&typeof We!="string"&&(G.value=Jt(lt,{max:L.value}),lt!==We&&(z=Et.animate(H,G.value,{duration:u.duration/1e3,ease:"easeInOut"})))}),l.watch(L,()=>Te(ne.value)),s({open:fe,close:me,snapToPoint:Ve}),l.onUnmounted(()=>{h&&clearTimeout(h)}),(Ie,Ue)=>(l.openBlock(),l.createBlock(l.Teleport,{to:o.teleportTo,defer:o.teleportDefer},[l.createElementVNode("div",l.mergeProps(Ie.$attrs,{"data-vsbs-container":""}),[l.createVNode(l.unref(Et.AnimatePresence),null,{default:l.withCtx(()=>[l.unref(_)&&o.blocking?(l.openBlock(),l.createBlock(l.unref(Et.Motion),{ref:"backdrop",key:"backdrop-"+m.value,"data-vsbs-backdrop":"",onClick:Ue[0]||(Ue[0]=lt=>re()),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(Et.AnimatePresence),null,{default:l.withCtx(()=>[l.unref(_)?(l.openBlock(),l.createBlock(l.unref(Et.Motion),{ref_key:"sheet",ref:p,exit:{opacity:0},initial:!1,key:m.value,style:l.normalizeStyle({y:l.unref(ie),z:1,height:l.unref(H)}),"data-vsbs-shadow":!o.blocking,"data-vsbs-sheet-show":l.unref(_),"data-vsbs-dragging":x.value,"aria-modal":"true","data-vsbs-sheet":"",tabindex:"-1"},{default:l.withCtx(()=>[l.createVNode(l.unref(Et.Motion),{ref_key:"sheetHeader",ref:C,"data-vsbs-header":"",onPanStart:ht,onPan:He,onPanEnd:Ae,onTouchmove:X,class:l.normalizeClass(o.headerClass)},{default:l.withCtx(()=>[l.renderSlot(Ie.$slots,"header",{},void 0,!0)]),_:3},8,["class"]),l.createElementVNode("div",{ref_key:"sheetScroll",ref:N,"data-vsbs-scroll":"",onScrollend:kt},[l.createVNode(l.unref(Et.Motion),{ref:"sheetContentWrapper","data-vsbs-content-wrapper":"",onPanStart:Ge,onPan:Qe,onPanEnd:Ae,onTouchmove:q},{default:l.withCtx(()=>[l.createElementVNode("div",{ref_key:"sheetContent",ref:M,"data-vsbs-content":"",class:l.normalizeClass(o.contentClass)},[l.renderSlot(Ie.$slots,"default",{},void 0,!0)],2)]),_:3},512)],544),l.createVNode(l.unref(Et.Motion),{ref_key:"sheetFooter",ref:y,"data-vsbs-footer":"",onPanStart:ht,onPan:He,onPanEnd:Ae,onTouchmove:X,class:l.normalizeClass(o.footerClass)},{default:l.withCtx(()=>[l.renderSlot(Ie.$slots,"footer",{},void 0,!0)]),_:3},8,["class"])]),_:3},8,["style","data-vsbs-shadow","data-vsbs-sheet-show","data-vsbs-dragging"])):l.createCommentVNode("",!0)]),_:3})],16)],8,["to","defer"]))}}),[["__scopeId","data-v-a8913d51"]]);function vn(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=Vt.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 t0={class:"card_product_modifiers_sheet_body"},n0={class:"card__pictures"},r0=["src"],i0=["src"],o0={class:"card_header_wrapper"},s0={key:0,class:"card_fire_kkal_wrapper"},a0={class:"card_content"},l0={class:"wrapper_size"},c0={key:0,class:"description"},u0={key:1},d0=qe(l.defineComponent({__name:"CardProductPage",props:{configPage:{}},setup(o){const s=yt(),i=Tt(),{stateCard:u,isOpenWindow:f,isAddToCard:h}=_e.storeToRefs(i),{itemThemes:m}=_e.storeToRefs(s),x=Oe.useRouter(),_=Oe.useRoute(),p=o,C=l.computed(()=>!!(_.query.mode==="pdf"&&p.configPage.qr_menu)),{mediaUrl:y}=vn(()=>{var V,B;return(V=u.value.openCard)!=null&&V.video_link?`${u.value.openCard.id}_video`:(B=u.value.openCard)!=null&&B.image_link?`${u.value.openCard.id}_image`:null},()=>{var V,B;return((V=u.value.openCard)==null?void 0:V.video_link)||((B=u.value.openCard)==null?void 0:B.image_link)||null}),N=()=>{p.configPage.qr_menu?C.value?x.push(`/${_.params.orgId}?mode=pdf`):x.push(`/${_.params.orgId}`):p.configPage.closeProduct()},M=()=>{h.value=!1,u.value.isSectionModifier=!1},k=()=>{u.value.isModifiedAmount=!1},L=l.ref(null),v=()=>{var V;(V=L.value)==null||V.addProductToCart()};return l.watch(()=>p.configPage.data,i.setCurrentCard),l.watch(()=>u.value.isSectionModifier,V=>{C.value&&document.body.classList.toggle("pdf_hidden",V)},{immediate:!0}),l.watchEffect(()=>{f.value||(f.value=p.configPage.is_closeProduct)}),l.onBeforeUnmount(()=>i.reset()),(V,B)=>{var O,P,G,Z,H,ie;return l.openBlock(),l.createElementBlock("div",{class:"card_product_wrapper",style:l.normalizeStyle(C.value?"user-select: none;":"")},[l.createVNode(l.unref(co),{modelValue:l.unref(u).isSectionModifier,"onUpdate:modelValue":B[0]||(B[0]=j=>l.unref(u).isSectionModifier=j),class:"card_product_modifiers_sheet",teleportTo:C.value?"#app":"body"},{default:l.withCtx(()=>[l.createElementVNode("div",t0,[l.createVNode(Id,{onClose:M,onAddToCart:v}),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(k,["stop"])},[l.createVNode(Kd)])):l.createCommentVNode("",!0)])),l.createElementVNode("div",n0,[(O=l.unref(u).openCard)!=null&&O.video_link&&l.unref(y)?l.withDirectives((l.openBlock(),l.createElementBlock("video",{key:l.unref(y),loop:"",autoplay:"",muted:"",playsinline:"",class:"card__video"},[l.createElementVNode("source",{src:l.unref(y)||"",type:"video/webm"},null,8,r0)])),[[l.unref(Vr)]]):(l.openBlock(),l.createElementBlock("img",{key:1,class:"card__pictures_images",src:l.unref(y)||"",alt:"Product image"},null,8,i0)),l.createElementVNode("div",o0,[l.createVNode(Fr,{class:"card_header_back",onClick:N,"aria-label":"Вернуться назад"}),(P=l.unref(u).openCard)!=null&&P.energy_amount?(l.openBlock(),l.createElementBlock("div",s0,[B[2]||(B[2]=l.createElementVNode("div",{class:"card_fire_kkal"},null,-1)),l.createElementVNode("p",null,[l.createElementVNode("b",null,l.toDisplayString((G=l.unref(u).openCard)==null?void 0:G.energy_amount),1),B[1]||(B[1]=l.createTextVNode(" Ккал ",-1))])])):l.createCommentVNode("",!0)]),l.createElementVNode("h4",null,l.toDisplayString((Z=l.unref(u).openCard)==null?void 0:Z.name),1),l.createElementVNode("div",{class:"card__pictures__gradient",style:l.normalizeStyle(l.unref(m).gradientStyle)},null,4)]),l.createElementVNode("div",a0,[l.createElementVNode("div",l0,[l.createVNode(Rd)]),(H=l.unref(u).openCard)!=null&&H.description?(l.openBlock(),l.createElementBlock("p",c0,l.toDisplayString((ie=l.unref(u).openCard)==null?void 0:ie.description),1)):l.createCommentVNode("",!0),l.unref(u).groupModifiers.length?(l.openBlock(),l.createElementBlock("div",u0,[B[3]||(B[3]=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(zd,{ref_key:"buttonPriceRef",ref:L,qr_menu:o.configPage.qr_menu,closeProduct:o.configPage.closeProduct},null,8,["qr_menu","closeProduct"])])],4)}}}),[["__scopeId","data-v-ee9ec125"]]),f0={key:0,class:"popupWindowDefault_overlay"},ia=qe(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",f0,[l.renderSlot(h.$slots,"default",{},void 0,!0)])):l.createCommentVNode("",!0)]),_:3})],64))}}),[["__scopeId","data-v-08e0e008"]]),uo=_e.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=qe(l.defineComponent({__name:"CartBox",props:{index:Number,cardItem:Object},emits:["delete"],setup(o,{emit:s}){const i=o,u=at(),f=yt(),h=uo(),{itemThemes:m}=_e.storeToRefs(f),x=l.ref(0),_=l.ref(0),p=l.ref(!1),C=l.ref(!1),y=l.ref(!1),{displayNumber:N,update:M}=na(0,800),k=l.computed(()=>{var oe,ne;const j=((oe=i.cardItem)==null?void 0:oe.modifiers)??[],se=(((ne=i.cardItem)==null?void 0:ne.group_modifiers)??[]).flatMap(U=>U.modifiers??[]);return[...j,...se]}),{mediaUrl:L}=vn(()=>{var j;return((j=i.cardItem)==null?void 0:j.id)+"_image"},()=>{var j;return(j=i.cardItem)==null?void 0:j.image_link}),v=l.computed(()=>{var j,se;return((j=i.cardItem)==null?void 0:j.total_new_price)??ur(i.cardItem)*((se=i.cardItem)==null?void 0:se.amount)}),V=()=>h.open("cart-delete-confirm",i.cardItem),B=()=>{y.value=!y.value},O=()=>{u.plusAmount(i.cardItem.idSystem)},P=()=>{i.cardItem.amount>1?u.minusAmount(i.cardItem.idSystem):V()},G=j=>{x.value=j.touches[0].clientX,p.value=!0},Z=j=>{p.value&&(_.value=j.touches[0].clientX-x.value,_.value>0&&(_.value=0))},H=()=>{p.value=!1,_.value<-115&&V(),_.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 j=i.index===0&&C.value?1:`${1-Math.abs(_.value)/200}`;return{transform:`translateX(${_.value}px)`,opacity:j,transition:p.value?"none":"transform 0.7s, opacity 0.7s"}});return l.watch(v,M,{immediate:!0}),(j,se)=>{var oe,ne,U,W;return l.openBlock(),l.createElementBlock("div",{class:"cart_box_wrapper",onTouchstart:G,onTouchmove:Z,onTouchend:H,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(L)||"",class:"cart_box_image"},null,8,h0),l.createElementVNode("div",g0,[l.createElementVNode("div",m0,[l.createElementVNode("p",null,l.toDisplayString((oe=o.cardItem)==null?void 0:oe.name),1),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(((ne=i.cardItem)==null?void 0:ne.discounts)||[],(S,z)=>(l.openBlock(),l.createElementBlock("div",{key:z,class:"discount_banner"},[l.createElementVNode("p",null,l.toDisplayString(S.name),1),l.createElementVNode("p",null,l.toDisplayString(S.discount)+"₽",1)]))),128)),l.createElementVNode("div",p0,[l.createElementVNode("button",{onClick:P},"-"),l.createElementVNode("p",x0,l.toDisplayString(i.cardItem.amount),1),l.createElementVNode("button",{onClick:O},"+")])]),l.createElementVNode("div",w0,[l.createElementVNode("div",{class:"cart_box_remove_item",onClick:V},[l.createVNode(ta)]),(U=i.cardItem)!=null&&U.new_price?(l.openBlock(),l.createElementBlock("p",{key:0,class:l.normalizeClass({discount_new_price:(W=i.cardItem)==null?void 0:W.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(N).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,S=>{var z;return l.openBlock(),l.createElementBlock("div",{class:"cart_modifier_item",key:S.id},[l.createElementVNode("div",C0,[l.createVNode(so,{id:"plus_orange"}),l.createElementVNode("p",null,l.toDisplayString(S.name),1)]),l.createElementVNode("div",E0,[l.createElementVNode("p",y0,l.toDisplayString(`x${S.amount}`),1),l.createElementVNode("div",b0,[S!=null&&S.new_price?(l.openBlock(),l.createElementBlock("p",{key:0,class:l.normalizeClass({discount_new_price:(z=S==null?void 0:S.new_price)==null?void 0:z.toFixed(2)})},l.toDisplayString((S.new_price*S.amount).toFixed(2)+"₽"),3)):l.createCommentVNode("",!0),l.createElementVNode("p",null,l.toDisplayString((S.total_new_price??S.price*S.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-b69f6323"]]),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=qe(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=qe(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=at(),i=yt(),{is_OpenLoyal:u}=_e.storeToRefs(s),{itemThemes:f}=_e.storeToRefs(i),h=bt(),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:X=>{_.value=X.replace(/\s/g,"")}}),y=l.computed(()=>h.currentState),N=l.computed(()=>h.isDrawerOpen),M=l.computed(()=>{var X;return((X=p[y.value])==null?void 0:X.text)||""}),k=l.computed(()=>{var X;(X=p[y.value])!=null&&X.title}),L=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"})),V=l.computed(()=>{const X=[];return y.value==="wait"&&X.push("pulse","show-x"),y.value==="not_found"&&X.push("pulse","show-x"),y.value==="success"&&X.push("pulse","show-ok"),X}),B=l.computed(()=>y.value==="not_found"),O=l.computed(()=>y.value==="success"),P=l.computed(()=>y.value==="not_found"),G=l.computed(()=>["not_found"].includes(y.value)),Z=l.computed(()=>({wait:"Стикер не распознан. Нажмите «Повторить».",success:"Стикер распознан. Нажмите «Продолжить».",not_found:"Стикер не распознан. Нажмите «Повторить»."})[y.value]||""),H=()=>{h.closeDrawer(),u.value=!0},ie=async X=>{var q,$;h.error="",x.value=null;try{const re=new yn;await re.authorizeByCard(X.trim()),await re.getProfile(),s.loadCart(),h.setState("success"),h.isDrawerOpen=!1,h.showNotification("Вы успешно авторизовались в программе лояльности!")}catch(re){h.error=(($=(q=re.response)==null?void 0:q.data)==null?void 0:$.user_friendly_message)||"Ошибка",h.setState("not_found"),x.value=C.value,C.value=""}},j=l.computed(()=>{var q;const X=(q=f.value)==null?void 0:q.kiosk_hide_manual_input_loyalty_card;return X??!1}),se=()=>{h.setState("wait"),h.error="",C.value="",x.value=null},oe=()=>{h.closeDrawer(),x.value=null,C.value=""},ne=()=>{var X,q;h.setState("wait"),(q=(X=C.value)==null?void 0:X.trim())!=null&&q.length&&ie(C.value.trim())},U=X=>{X.stopPropagation(),document.activeElement!==m.value&&W()},W=()=>{l.nextTick(()=>{m.value&&(m.value.focus(),_.value&&m.value.select())})},S=X=>{const q=document.activeElement===m.value;if(!N.value||q)return;const $=X.key.toLowerCase();if($==="backspace")return C.value=C.value.slice(0,-1);if($==="escape")return oe();if($==="r"&&P.value)return se();if($==="c"&&y.value==="success")return oe();if($==="enter")return ne();C.value+=$},z={mounted(X){X==null||X.focus()}};return l.onMounted(()=>{document==null||document.addEventListener("keydown",S)}),l.onBeforeUnmount(()=>{document==null||document.removeEventListener("keydown",S)}),l.watchEffect(()=>{N.value&&(h.error="")}),(X,q)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[N.value?(l.openBlock(),l.createElementBlock("div",{key:0,class:"backdrop show",onClick:oe,"aria-hidden":"true"})):l.createCommentVNode("",!0),N.value?(l.openBlock(),l.createElementBlock("section",{key:1,class:l.normalizeClass(["sheet show",{sheet_retry:P.value}]),"aria-modal":"true","aria-labelledby":"sheetTitle",onClick:U},[l.createElementVNode("header",v0,[l.createElementVNode("div",D0,l.toDisplayString(M.value),1),P.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:oe,"aria-label":"Закрыть"}," Закрыть ")]),l.createElementVNode("div",P0,[l.createElementVNode("div",L0,[l.createElementVNode("div",{class:l.normalizeClass(["nfc",V.value])},[l.createVNode(M0,{styleRetry:G.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:O.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(L.value),1),l.createElementVNode("div",U0,[l.withDirectives(l.createElementVNode("input",{style:l.normalizeStyle(j.value?{position:"absolute",left:"-9999px"}:{}),ref_key:"cardInputManualRef",ref:m,"onUpdate:modelValue":q[0]||(q[0]=$=>C.value=$),class:"nfc_title_read_input",type:"text",placeholder:"Введите трек карты","aria-live":"polite",onKeydown:l.withKeys(ne,["enter"])},null,36),[[l.vModelText,C.value],[z]]),P.value?(l.openBlock(),l.createElementBlock("button",{key:0,class:"btn btn_ghost",onClick:se},"Повторить")):(l.openBlock(),l.createElementBlock("div",z0,[j.value?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("button",{key:0,class:"btn btn_ghost",onClick:q[1]||(q[1]=$=>P.value?oe:ne())},"Отправить"))]))]),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:H},"Войти по номеру телефона")])):l.createCommentVNode("",!0)])]),l.createElementVNode("div",G0,l.toDisplayString(Z.value),1)],2)):l.createCommentVNode("",!0)],64))}}),W0="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgcm9sZT0iaW1nIiBhcmlhLWxhYmVsPSJJTk5PIGJhbmsgY2FyZCBpY29uIj4NCiAgPGRlZnM+DQogICAgPGxpbmVhckdyYWRpZW50IGlkPSJibGFja0dyYWQiIHgxPSIwIiB5MT0iMCIgeDI9IjEiIHkyPSIxIj4NCiAgICAgIDxzdG9wIG9mZnNldD0iMCUiIHN0b3AtY29sb3I9IiMxQTFBMUEiLz4NCiAgICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzAwMDAwMCIvPg0KICAgIDwvbGluZWFyR3JhZGllbnQ+DQoNCiAgICA8bGluZWFyR3JhZGllbnQgaWQ9InNoaW5lIiB4MT0iMCIgeTE9IjAiIHgyPSIxIiB5Mj0iMCI+DQogICAgICA8c3RvcCBvZmZzZXQ9IjAlIiBzdG9wLWNvbG9yPSIjRkZGRkZGIiBzdG9wLW9wYWNpdHk9IjAiLz4NCiAgICAgIDxzdG9wIG9mZnNldD0iNTAlIiBzdG9wLWNvbG9yPSIjRkZGRkZGIiBzdG9wLW9wYWNpdHk9IjAuMTgiLz4NCiAgICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI0ZGRkZGRiIgc3RvcC1vcGFjaXR5PSIwIi8+DQogICAgPC9saW5lYXJHcmFkaWVudD4NCg0KICAgIDxmaWx0ZXIgaWQ9InNoYWRvdyIgeD0iLTMwJSIgeT0iLTMwJSIgd2lkdGg9IjE2MCUiIGhlaWdodD0iMTYwJSI+DQogICAgICA8ZmVEcm9wU2hhZG93IGR4PSIwIiBkeT0iNiIgc3RkRGV2aWF0aW9uPSI2IiBmbG9vZC1jb2xvcj0iIzAwMCIgZmxvb2Qtb3BhY2l0eT0iMC4yNSIvPg0KICAgIDwvZmlsdGVyPg0KICA8L2RlZnM+DQoNCiAgPCEtLSBDZW50ZXJlZCBjYXJkIC0tPg0KICA8ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSg3LjUgMjMpIHJvdGF0ZSgtMTIpIiBmaWx0ZXI9InVybCgjc2hhZG93KSI+DQogICAgPCEtLSBjYXJkIGJvZHkgLS0+DQogICAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9Ijg1IiBoZWlnaHQ9IjU0IiByeD0iMTAiIGZpbGw9InVybCgjYmxhY2tHcmFkKSIvPg0KDQogICAgPCEtLSB0b3Agc3RyaXBlIC0tPg0KICAgIDxyZWN0IHg9IjAiIHk9IjgiIHdpZHRoPSI4NSIgaGVpZ2h0PSI4IiByeD0iNCIgZmlsbD0iI0ZGRkZGRiIgb3BhY2l0eT0iMC4wNSIvPg0KDQogICAgPCEtLSBjaGlwIC0tPg0KICAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEwIDI3KSI+DQogICAgICA8cmVjdCB3aWR0aD0iMTgiIGhlaWdodD0iMTUiIHJ4PSIzIiBmaWxsPSIjQ0ZBRTcwIi8+DQogICAgICA8cmVjdCB4PSIyLjUiIHk9IjMuNSIgd2lkdGg9IjEzIiBoZWlnaHQ9IjEuMiIgZmlsbD0iIzlFODM0RSIvPg0KICAgICAgPHJlY3QgeD0iMi41IiB5PSI2LjUiIHdpZHRoPSIxMyIgaGVpZ2h0PSIxLjIiIGZpbGw9IiM5RTgzNEUiLz4NCiAgICAgIDxyZWN0IHg9IjIuNSIgeT0iOS41IiB3aWR0aD0iMTMiIGhlaWdodD0iMS4yIiBmaWxsPSIjOUU4MzRFIi8+DQogICAgICA8cmVjdCB4PSI4LjUiIHk9IjAiIHdpZHRoPSIxLjUiIGhlaWdodD0iMTUiIGZpbGw9IiM5RTgzNEUiIG9wYWNpdHk9IjAuNiIvPg0KICAgIDwvZz4NCg0KICAgIDwhLS0gSU5OTyBsb2dvIC0tPg0KICAgIDx0ZXh0IHg9IjYxIiB5PSIzOSINCiAgICAgICAgICBmb250LWZhbWlseT0ic3lzdGVtLXVpLCAtYXBwbGUtc3lzdGVtLCBTZWdvZSBVSSwgUm9ib3RvLCBBcmlhbCwgc2Fucy1zZXJpZiINCiAgICAgICAgICBmb250LXNpemU9IjEzIg0KICAgICAgICAgIGZvbnQtd2VpZ2h0PSI4MDAiDQogICAgICAgICAgbGV0dGVyLXNwYWNpbmc9IjEuMiINCiAgICAgICAgICBmaWxsPSIjRkZGRkZGIg0KICAgICAgICAgIG9wYWNpdHk9IjAuOTUiDQogICAgICAgICAgdGV4dC1hbmNob3I9Im1pZGRsZSI+DQogICAgICBpbm5vDQogICAgPC90ZXh0Pg0KDQogICAgPCEtLSBzaGluZSAtLT4NCiAgICA8cGF0aCBkPSJNLTggNiBMMjUgLTMgTDk0IDQ3IEw2MCA2MiBMLTggMjUgWiIgZmlsbD0idXJsKCNzaGluZSkiLz4NCiAgPC9nPg0KPC9zdmc+",aa="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=qe(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=bt(),h=Tt(),{selectedProvider:m,isButtonDisabled:x}=_e.storeToRefs(f),{isAddToCard:_}=_e.storeToRefs(h),p={default:W0,SBP:aa},C=async()=>{m.value=i.provider;const N=i.provider.front_type;N&&(_.value=!1,x.value=!0,u("select",N),Xs(i.orderId,i.provider.type))},y=l.computed(()=>p[i.provider.front_type]||p.default);return(N,M)=>(l.openBlock(),l.createElementBlock("div",{class:"payment_boxes_wrapper",onClick:C},[l.createElementVNode("img",{class:"picture",src:y.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(Fr)]))}}),[["__scopeId","data-v-1bf54e54"]]),Z0={key:0,class:"wrapper_cart_payment"},Y0={class:"wrapper_paid"},$0={class:"to_be_paid"},K0=qe(l.defineComponent({__name:"CartPayment",props:{configPage:{},comment:{},cartItems:{},isAuthorized:{type:Boolean},orderId:{},signal:{}},emits:["selectPayment"],setup(o,{emit:s}){const i=bt(),u=at(),f=o,{totalPrice_lib:h,countBonus:m}=_e.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,(N,M)=>(l.openBlock(),l.createElementBlock("div",{key:M},[l.createVNode(q0,{provider:N,"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",Y0,[l.createElementVNode("p",$0,[y[0]||(y[0]=l.createTextVNode("К оплате ",-1)),l.createVNode(Ut,{price:l.unref(h)-l.unref(m),fixedFloat:2},null,8,["price"]),y[1]||(y[1]=l.createTextVNode(" ₽",-1))]),l.createVNode(on,{textButtonDefault:"Назад",onClick:p,class:"btn_payment"})])])):l.createCommentVNode("",!0)}}),[["__scopeId","data-v-26ea47f1"]]),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=qe(l.defineComponent({__name:"CartCompleteKioskSuccess",props:{mediaUrl:{},orderNumber:{}},setup(o){const s=at(),i=bt(),u=Tt(),f=yt(),{cartProducts_lib:h}=_e.storeToRefs(s),{orderNumber:m,orderCompleted_lib:x,selectedOrderType:_}=_e.storeToRefs(i),{is_startPage:p}=_e.storeToRefs(u),{mediaUrl:C}=vn(()=>f.itemThemes.kiosk_preloader?"preloader":null),y=Oe.useRouter(),N=Oe.useRoute();let M=null;l.onMounted(()=>{M=setTimeout(()=>{p.value=!f.itemThemes.kiosk_disable_lock_screen,_.value=null,s.isOrderTypeSubmited=!1,y.replace(`/${N.params.orgId}`)},1e4)});const k=()=>{dr(["cart","authTokensAccess","authTokensRefresh"]),h.value=[],x.value=null,_.value=null,s.isOrderTypeSubmited=!1,i.clearCard(),s.profile=null,y.replace(`/${N.params.orgId}`)};return l.onUnmounted(()=>{M&&clearInterval(M)}),(L,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(Vr)]]),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=qe(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=qe(c1,[["render",d1],["__scopeId","data-v-f0859fd1"]]);/*!
1
+ (function(he,Te){typeof exports=="object"&&typeof module<"u"?Te(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"],Te):(he=typeof globalThis<"u"?globalThis:he||self,Te(he.InnoCloudsLib={},he.VueRouter,he.Pinia,he.Vue,he.VueuseCore,he.motionV))})(this,function(he,Te,we,r,yt,Ot){"use strict";var Hg=Object.defineProperty;var sl=he=>{throw TypeError(he)};var Gg=(he,Te,we)=>Te in he?Hg(he,Te,{enumerable:!0,configurable:!0,writable:!0,value:we}):he[Te]=we;var Re=(he,Te,we)=>Gg(he,typeof Te!="symbol"?Te+"":Te,we),al=(he,Te,we)=>Te.has(he)||sl("Cannot "+we);var wn=(he,Te,we)=>(al(he,Te,"read from private field"),we?we.call(he):Te.get(he)),Ui=(he,Te,we)=>Te.has(he)?sl("Cannot add the same private member more than once"):Te instanceof WeakSet?Te.add(he):Te.set(he,we),Pn=(he,Te,we,r)=>(al(he,Te,"write to private field"),r?r.call(he,we):Te.set(he,we),we);var Zo=(he,Te,we,r)=>({set _(yt){Pn(he,Te,yt,we)},get _(){return wn(he,Te,r)}});var en,Gn,sr;function cl(a,l){for(var o=0;o<l.length;o++){const i=l[o];if(typeof i!="string"&&!Array.isArray(i)){for(const u in i)if(u!=="default"&&!(u in a)){const f=Object.getOwnPropertyDescriptor(i,u);f&&Object.defineProperty(a,u,f.get?f:{enumerable:!0,get:()=>i[u]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}function dl(a){return a}const ul=[];function fl(){return Te.createRouter({history:Te.createWebHistory(),routes:ul})}const zi=(a,l)=>l.some(o=>a instanceof o);let Yo,Ko;function hl(){return Yo||(Yo=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function ml(){return Ko||(Ko=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Hi=new WeakMap,Gi=new WeakMap,ri=new WeakMap;function gl(a){const l=new Promise((o,i)=>{const u=()=>{a.removeEventListener("success",f),a.removeEventListener("error",m)},f=()=>{o(Hn(a.result)),u()},m=()=>{i(a.error),u()};a.addEventListener("success",f),a.addEventListener("error",m)});return ri.set(l,a),l}function pl(a){if(Hi.has(a))return;const l=new Promise((o,i)=>{const u=()=>{a.removeEventListener("complete",f),a.removeEventListener("error",m),a.removeEventListener("abort",m)},f=()=>{o(),u()},m=()=>{i(a.error||new DOMException("AbortError","AbortError")),u()};a.addEventListener("complete",f),a.addEventListener("error",m),a.addEventListener("abort",m)});Hi.set(a,l)}let Wi={get(a,l,o){if(a instanceof IDBTransaction){if(l==="done")return Hi.get(a);if(l==="store")return o.objectStoreNames[1]?void 0:o.objectStore(o.objectStoreNames[0])}return Hn(a[l])},set(a,l,o){return a[l]=o,!0},has(a,l){return a instanceof IDBTransaction&&(l==="done"||l==="store")?!0:l in a}};function Qo(a){Wi=a(Wi)}function xl(a){return ml().includes(a)?function(...l){return a.apply(Xi(this),l),Hn(this.request)}:function(...l){return Hn(a.apply(Xi(this),l))}}function wl(a){return typeof a=="function"?xl(a):(a instanceof IDBTransaction&&pl(a),zi(a,hl())?new Proxy(a,Wi):a)}function Hn(a){if(a instanceof IDBRequest)return gl(a);if(Gi.has(a))return Gi.get(a);const l=wl(a);return l!==a&&(Gi.set(a,l),ri.set(l,a)),l}const Xi=a=>ri.get(a);function _l(a,l,{blocked:o,upgrade:i,blocking:u,terminated:f}={}){const m=indexedDB.open(a,l),p=Hn(m);return i&&m.addEventListener("upgradeneeded",w=>{i(Hn(m.result),w.oldVersion,w.newVersion,Hn(m.transaction),w)}),o&&m.addEventListener("blocked",w=>o(w.oldVersion,w.newVersion,w)),p.then(w=>{f&&w.addEventListener("close",()=>f()),u&&w.addEventListener("versionchange",x=>u(x.oldVersion,x.newVersion,x))}).catch(()=>{}),p}function Cl(a,{blocked:l}={}){const o=indexedDB.deleteDatabase(a);return l&&o.addEventListener("blocked",i=>l(i.oldVersion,i)),Hn(o).then(()=>{})}const El=["get","getKey","getAll","getAllKeys","count"],yl=["put","add","delete","clear"],$i=new Map;function Jo(a,l){if(!(a instanceof IDBDatabase&&!(l in a)&&typeof l=="string"))return;if($i.get(l))return $i.get(l);const o=l.replace(/FromIndex$/,""),i=l!==o,u=yl.includes(o);if(!(o in(i?IDBIndex:IDBObjectStore).prototype)||!(u||El.includes(o)))return;const f=async function(m,...p){const w=this.transaction(m,u?"readwrite":"readonly");let x=w.store;return i&&(x=x.index(p.shift())),(await Promise.all([x[o](...p),u&&w.done]))[0]};return $i.set(l,f),f}Qo(a=>({...a,get:(l,o,i)=>Jo(l,o)||a.get(l,o,i),has:(l,o)=>!!Jo(l,o)||a.has(l,o)}));const bl=["continue","continuePrimaryKey","advance"],es={},ji=new WeakMap,ts=new WeakMap,Al={get(a,l){if(!bl.includes(l))return a[l];let o=es[l];return o||(o=es[l]=function(...i){ji.set(this,ts.get(this)[l](...i))}),o}};async function*Sl(...a){let l=this;if(l instanceof IDBCursor||(l=await l.openCursor(...a)),!l)return;l=l;const o=new Proxy(l,Al);for(ts.set(o,l),ri.set(o,Xi(l));l;)yield o,l=await(ji.get(o)||l.continue()),ji.delete(o)}function ns(a,l){return l===Symbol.asyncIterator&&zi(a,[IDBIndex,IDBObjectStore,IDBCursor])||l==="iterate"&&zi(a,[IDBIndex,IDBObjectStore])}Qo(a=>({...a,get(l,o,i){return ns(l,o)?Sl:a.get(l,o,i)},has(l,o){return ns(l,o)||a.has(l,o)}}));let Kn;function Il(){return _l("data",1,{upgrade(a){a.objectStoreNames.contains("groups")||a.createObjectStore("groups",{keyPath:"id"}),a.objectStoreNames.contains("media")||a.createObjectStore("media",{keyPath:"id"}),a.objectStoreNames.contains("products")||a.createObjectStore("products",{keyPath:"id"})}})}async function Qn(){if(Kn)try{const a=await Kn;return a.transaction("groups","readonly").commit(),a}catch{Kn=void 0}return Kn=Il(),Kn}async function qi(a){return(await Qn()).transaction("groups","readonly").objectStore("groups").get(a)}async function Dr(a,l){const i=(await Qn()).transaction("groups","readwrite");await i.objectStore("groups").put({id:a,data:l,timestamp:Date.now()}),await i.done}async function Nl(a,l){const o=JSON.parse(JSON.stringify(r.toRaw(l.value)));await Dr(a,o)}async function Zi(a,l){const i=(await Qn()).transaction("media","readwrite");await i.objectStore("media").put({id:a,blob:l,timestamp:Date.now()}),await i.done}async function fr(a){const u=await(await Qn()).transaction("media","readonly").objectStore("media").get(a);return u==null?void 0:u.blob}async function Tl(a){const o=(await Qn()).transaction("products","readwrite"),i=o.objectStore("products"),u=a.id;await i.put({id:u,product:a,timestamp:Date.now()}),await o.done}async function rs(a){const u=await(await Qn()).transaction("products","readonly").objectStore("products").get(a);return u==null?void 0:u.product}async function kl(){const a=Kn;if(Kn=void 0,a){const l=await a.catch(()=>null);l&&l.close()}try{await Cl("data",{blocked(){console.warn("Удаление заблокировано. открыты другие вкладки с сайтом.")}})}catch(l){console.error("Не удалось удалить базу: [lib, indexedDB]",l)}}function ii(a){"@babel/helpers - typeof";return ii=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},ii(a)}var Rl=/^\s+/,Bl=/\s+$/;function Se(a,l){if(a=a||"",l=l||{},a instanceof Se)return a;if(!(this instanceof Se))return new Se(a,l);var o=Ol(a);this._originalInput=a,this._r=o.r,this._g=o.g,this._b=o.b,this._a=o.a,this._roundA=Math.round(100*this._a)/100,this._format=l.format||o.format,this._gradientType=l.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=o.ok}Se.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 l=this.toRgb();return(l.r*299+l.g*587+l.b*114)/1e3},getLuminance:function(){var l=this.toRgb(),o,i,u,f,m,p;return o=l.r/255,i=l.g/255,u=l.b/255,o<=.03928?f=o/12.92:f=Math.pow((o+.055)/1.055,2.4),i<=.03928?m=i/12.92:m=Math.pow((i+.055)/1.055,2.4),u<=.03928?p=u/12.92:p=Math.pow((u+.055)/1.055,2.4),.2126*f+.7152*m+.0722*p},setAlpha:function(l){return this._a=cs(l),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var l=os(this._r,this._g,this._b);return{h:l.h*360,s:l.s,v:l.v,a:this._a}},toHsvString:function(){var l=os(this._r,this._g,this._b),o=Math.round(l.h*360),i=Math.round(l.s*100),u=Math.round(l.v*100);return this._a==1?"hsv("+o+", "+i+"%, "+u+"%)":"hsva("+o+", "+i+"%, "+u+"%, "+this._roundA+")"},toHsl:function(){var l=is(this._r,this._g,this._b);return{h:l.h*360,s:l.s,l:l.l,a:this._a}},toHslString:function(){var l=is(this._r,this._g,this._b),o=Math.round(l.h*360),i=Math.round(l.s*100),u=Math.round(l.l*100);return this._a==1?"hsl("+o+", "+i+"%, "+u+"%)":"hsla("+o+", "+i+"%, "+u+"%, "+this._roundA+")"},toHex:function(l){return ss(this._r,this._g,this._b,l)},toHexString:function(l){return"#"+this.toHex(l)},toHex8:function(l){return Pl(this._r,this._g,this._b,this._a,l)},toHex8String:function(l){return"#"+this.toHex8(l)},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(wt(this._r,255)*100)+"%",g:Math.round(wt(this._g,255)*100)+"%",b:Math.round(wt(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(wt(this._r,255)*100)+"%, "+Math.round(wt(this._g,255)*100)+"%, "+Math.round(wt(this._b,255)*100)+"%)":"rgba("+Math.round(wt(this._r,255)*100)+"%, "+Math.round(wt(this._g,255)*100)+"%, "+Math.round(wt(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:ql[ss(this._r,this._g,this._b,!0)]||!1},toFilter:function(l){var o="#"+as(this._r,this._g,this._b,this._a),i=o,u=this._gradientType?"GradientType = 1, ":"";if(l){var f=Se(l);i="#"+as(f._r,f._g,f._b,f._a)}return"progid:DXImageTransform.Microsoft.gradient("+u+"startColorstr="+o+",endColorstr="+i+")"},toString:function(l){var o=!!l;l=l||this._format;var i=!1,u=this._a<1&&this._a>=0,f=!o&&u&&(l==="hex"||l==="hex6"||l==="hex3"||l==="hex4"||l==="hex8"||l==="name");return f?l==="name"&&this._a===0?this.toName():this.toRgbString():(l==="rgb"&&(i=this.toRgbString()),l==="prgb"&&(i=this.toPercentageRgbString()),(l==="hex"||l==="hex6")&&(i=this.toHexString()),l==="hex3"&&(i=this.toHexString(!0)),l==="hex4"&&(i=this.toHex8String(!0)),l==="hex8"&&(i=this.toHex8String()),l==="name"&&(i=this.toName()),l==="hsl"&&(i=this.toHslString()),l==="hsv"&&(i=this.toHsvString()),i||this.toHexString())},clone:function(){return Se(this.toString())},_applyModification:function(l,o){var i=l.apply(null,[this].concat([].slice.call(o)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},lighten:function(){return this._applyModification(Ul,arguments)},brighten:function(){return this._applyModification(zl,arguments)},darken:function(){return this._applyModification(Hl,arguments)},desaturate:function(){return this._applyModification(Ll,arguments)},saturate:function(){return this._applyModification(Fl,arguments)},greyscale:function(){return this._applyModification(Vl,arguments)},spin:function(){return this._applyModification(Gl,arguments)},_applyCombination:function(l,o){return l.apply(null,[this].concat([].slice.call(o)))},analogous:function(){return this._applyCombination($l,arguments)},complement:function(){return this._applyCombination(Wl,arguments)},monochromatic:function(){return this._applyCombination(jl,arguments)},splitcomplement:function(){return this._applyCombination(Xl,arguments)},triad:function(){return this._applyCombination(ls,[3])},tetrad:function(){return this._applyCombination(ls,[4])}},Se.fromRatio=function(a,l){if(ii(a)=="object"){var o={};for(var i in a)a.hasOwnProperty(i)&&(i==="a"?o[i]=a[i]:o[i]=vr(a[i]));a=o}return Se(a,l)};function Ol(a){var l={r:0,g:0,b:0},o=1,i=null,u=null,f=null,m=!1,p=!1;return typeof a=="string"&&(a=Ql(a)),ii(a)=="object"&&(Ln(a.r)&&Ln(a.g)&&Ln(a.b)?(l=Ml(a.r,a.g,a.b),m=!0,p=String(a.r).substr(-1)==="%"?"prgb":"rgb"):Ln(a.h)&&Ln(a.s)&&Ln(a.v)?(i=vr(a.s),u=vr(a.v),l=vl(a.h,i,u),m=!0,p="hsv"):Ln(a.h)&&Ln(a.s)&&Ln(a.l)&&(i=vr(a.s),f=vr(a.l),l=Dl(a.h,i,f),m=!0,p="hsl"),a.hasOwnProperty("a")&&(o=a.a)),o=cs(o),{ok:m,format:a.format||p,r:Math.min(255,Math.max(l.r,0)),g:Math.min(255,Math.max(l.g,0)),b:Math.min(255,Math.max(l.b,0)),a:o}}function Ml(a,l,o){return{r:wt(a,255)*255,g:wt(l,255)*255,b:wt(o,255)*255}}function is(a,l,o){a=wt(a,255),l=wt(l,255),o=wt(o,255);var i=Math.max(a,l,o),u=Math.min(a,l,o),f,m,p=(i+u)/2;if(i==u)f=m=0;else{var w=i-u;switch(m=p>.5?w/(2-i-u):w/(i+u),i){case a:f=(l-o)/w+(l<o?6:0);break;case l:f=(o-a)/w+2;break;case o:f=(a-l)/w+4;break}f/=6}return{h:f,s:m,l:p}}function Dl(a,l,o){var i,u,f;a=wt(a,360),l=wt(l,100),o=wt(o,100);function m(x,C,y){return y<0&&(y+=1),y>1&&(y-=1),y<1/6?x+(C-x)*6*y:y<1/2?C:y<2/3?x+(C-x)*(2/3-y)*6:x}if(l===0)i=u=f=o;else{var p=o<.5?o*(1+l):o+l-o*l,w=2*o-p;i=m(w,p,a+1/3),u=m(w,p,a),f=m(w,p,a-1/3)}return{r:i*255,g:u*255,b:f*255}}function os(a,l,o){a=wt(a,255),l=wt(l,255),o=wt(o,255);var i=Math.max(a,l,o),u=Math.min(a,l,o),f,m,p=i,w=i-u;if(m=i===0?0:w/i,i==u)f=0;else{switch(i){case a:f=(l-o)/w+(l<o?6:0);break;case l:f=(o-a)/w+2;break;case o:f=(a-l)/w+4;break}f/=6}return{h:f,s:m,v:p}}function vl(a,l,o){a=wt(a,360)*6,l=wt(l,100),o=wt(o,100);var i=Math.floor(a),u=a-i,f=o*(1-l),m=o*(1-u*l),p=o*(1-(1-u)*l),w=i%6,x=[o,m,f,f,p,o][w],C=[p,o,o,m,f,f][w],y=[f,f,p,o,o,m][w];return{r:x*255,g:C*255,b:y*255}}function ss(a,l,o,i){var u=[_n(Math.round(a).toString(16)),_n(Math.round(l).toString(16)),_n(Math.round(o).toString(16))];return i&&u[0].charAt(0)==u[0].charAt(1)&&u[1].charAt(0)==u[1].charAt(1)&&u[2].charAt(0)==u[2].charAt(1)?u[0].charAt(0)+u[1].charAt(0)+u[2].charAt(0):u.join("")}function Pl(a,l,o,i,u){var f=[_n(Math.round(a).toString(16)),_n(Math.round(l).toString(16)),_n(Math.round(o).toString(16)),_n(ds(i))];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[3].charAt(0)==f[3].charAt(1)?f[0].charAt(0)+f[1].charAt(0)+f[2].charAt(0)+f[3].charAt(0):f.join("")}function as(a,l,o,i){var u=[_n(ds(i)),_n(Math.round(a).toString(16)),_n(Math.round(l).toString(16)),_n(Math.round(o).toString(16))];return u.join("")}Se.equals=function(a,l){return!a||!l?!1:Se(a).toRgbString()==Se(l).toRgbString()},Se.random=function(){return Se.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function Ll(a,l){l=l===0?0:l||10;var o=Se(a).toHsl();return o.s-=l/100,o.s=oi(o.s),Se(o)}function Fl(a,l){l=l===0?0:l||10;var o=Se(a).toHsl();return o.s+=l/100,o.s=oi(o.s),Se(o)}function Vl(a){return Se(a).desaturate(100)}function Ul(a,l){l=l===0?0:l||10;var o=Se(a).toHsl();return o.l+=l/100,o.l=oi(o.l),Se(o)}function zl(a,l){l=l===0?0:l||10;var o=Se(a).toRgb();return o.r=Math.max(0,Math.min(255,o.r-Math.round(255*-(l/100)))),o.g=Math.max(0,Math.min(255,o.g-Math.round(255*-(l/100)))),o.b=Math.max(0,Math.min(255,o.b-Math.round(255*-(l/100)))),Se(o)}function Hl(a,l){l=l===0?0:l||10;var o=Se(a).toHsl();return o.l-=l/100,o.l=oi(o.l),Se(o)}function Gl(a,l){var o=Se(a).toHsl(),i=(o.h+l)%360;return o.h=i<0?360+i:i,Se(o)}function Wl(a){var l=Se(a).toHsl();return l.h=(l.h+180)%360,Se(l)}function ls(a,l){if(isNaN(l)||l<=0)throw new Error("Argument to polyad must be a positive number");for(var o=Se(a).toHsl(),i=[Se(a)],u=360/l,f=1;f<l;f++)i.push(Se({h:(o.h+f*u)%360,s:o.s,l:o.l}));return i}function Xl(a){var l=Se(a).toHsl(),o=l.h;return[Se(a),Se({h:(o+72)%360,s:l.s,l:l.l}),Se({h:(o+216)%360,s:l.s,l:l.l})]}function $l(a,l,o){l=l||6,o=o||30;var i=Se(a).toHsl(),u=360/o,f=[Se(a)];for(i.h=(i.h-(u*l>>1)+720)%360;--l;)i.h=(i.h+u)%360,f.push(Se(i));return f}function jl(a,l){l=l||6;for(var o=Se(a).toHsv(),i=o.h,u=o.s,f=o.v,m=[],p=1/l;l--;)m.push(Se({h:i,s:u,v:f})),f=(f+p)%1;return m}Se.mix=function(a,l,o){o=o===0?0:o||50;var i=Se(a).toRgb(),u=Se(l).toRgb(),f=o/100,m={r:(u.r-i.r)*f+i.r,g:(u.g-i.g)*f+i.g,b:(u.b-i.b)*f+i.b,a:(u.a-i.a)*f+i.a};return Se(m)},Se.readability=function(a,l){var o=Se(a),i=Se(l);return(Math.max(o.getLuminance(),i.getLuminance())+.05)/(Math.min(o.getLuminance(),i.getLuminance())+.05)},Se.isReadable=function(a,l,o){var i=Se.readability(a,l),u,f;switch(f=!1,u=Jl(o),u.level+u.size){case"AAsmall":case"AAAlarge":f=i>=4.5;break;case"AAlarge":f=i>=3;break;case"AAAsmall":f=i>=7;break}return f},Se.mostReadable=function(a,l,o){var i=null,u=0,f,m,p,w;o=o||{},m=o.includeFallbackColors,p=o.level,w=o.size;for(var x=0;x<l.length;x++)f=Se.readability(a,l[x]),f>u&&(u=f,i=Se(l[x]));return Se.isReadable(a,i,{level:p,size:w})||!m?i:(o.includeFallbackColors=!1,Se.mostReadable(a,["#fff","#000"],o))};var Yi=Se.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"},ql=Se.hexNames=Zl(Yi);function Zl(a){var l={};for(var o in a)a.hasOwnProperty(o)&&(l[a[o]]=o);return l}function cs(a){return a=parseFloat(a),(isNaN(a)||a<0||a>1)&&(a=1),a}function wt(a,l){Yl(a)&&(a="100%");var o=Kl(a);return a=Math.min(l,Math.max(0,parseFloat(a))),o&&(a=parseInt(a*l,10)/100),Math.abs(a-l)<1e-6?1:a%l/parseFloat(l)}function oi(a){return Math.min(1,Math.max(0,a))}function sn(a){return parseInt(a,16)}function Yl(a){return typeof a=="string"&&a.indexOf(".")!=-1&&parseFloat(a)===1}function Kl(a){return typeof a=="string"&&a.indexOf("%")!=-1}function _n(a){return a.length==1?"0"+a:""+a}function vr(a){return a<=1&&(a=a*100+"%"),a}function ds(a){return Math.round(parseFloat(a)*255).toString(16)}function us(a){return sn(a)/255}var Cn=function(){var a="[-\\+]?\\d+%?",l="[-\\+]?\\d*\\.\\d+%?",o="(?:"+l+")|(?:"+a+")",i="[\\s|\\(]+("+o+")[,|\\s]+("+o+")[,|\\s]+("+o+")\\s*\\)?",u="[\\s|\\(]+("+o+")[,|\\s]+("+o+")[,|\\s]+("+o+")[,|\\s]+("+o+")\\s*\\)?";return{CSS_UNIT:new RegExp(o),rgb:new RegExp("rgb"+i),rgba:new RegExp("rgba"+u),hsl:new RegExp("hsl"+i),hsla:new RegExp("hsla"+u),hsv:new RegExp("hsv"+i),hsva:new RegExp("hsva"+u),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 Ln(a){return!!Cn.CSS_UNIT.exec(a)}function Ql(a){a=a.replace(Rl,"").replace(Bl,"").toLowerCase();var l=!1;if(Yi[a])a=Yi[a],l=!0;else if(a=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var o;return(o=Cn.rgb.exec(a))?{r:o[1],g:o[2],b:o[3]}:(o=Cn.rgba.exec(a))?{r:o[1],g:o[2],b:o[3],a:o[4]}:(o=Cn.hsl.exec(a))?{h:o[1],s:o[2],l:o[3]}:(o=Cn.hsla.exec(a))?{h:o[1],s:o[2],l:o[3],a:o[4]}:(o=Cn.hsv.exec(a))?{h:o[1],s:o[2],v:o[3]}:(o=Cn.hsva.exec(a))?{h:o[1],s:o[2],v:o[3],a:o[4]}:(o=Cn.hex8.exec(a))?{r:sn(o[1]),g:sn(o[2]),b:sn(o[3]),a:us(o[4]),format:l?"name":"hex8"}:(o=Cn.hex6.exec(a))?{r:sn(o[1]),g:sn(o[2]),b:sn(o[3]),format:l?"name":"hex"}:(o=Cn.hex4.exec(a))?{r:sn(o[1]+""+o[1]),g:sn(o[2]+""+o[2]),b:sn(o[3]+""+o[3]),a:us(o[4]+""+o[4]),format:l?"name":"hex8"}:(o=Cn.hex3.exec(a))?{r:sn(o[1]+""+o[1]),g:sn(o[2]+""+o[2]),b:sn(o[3]+""+o[3]),format:l?"name":"hex"}:!1}function Jl(a){var l,o;return a=a||{level:"AA",size:"small"},l=(a.level||"AA").toUpperCase(),o=(a.size||"small").toLowerCase(),l!=="AA"&&l!=="AAA"&&(l="AA"),o!=="small"&&o!=="large"&&(o="small"),{level:l,size:o}}const si=we.defineStore("imageCache",()=>{const a=r.ref({});let l=!1;function o(w,x){const C=String(w);a.value[C]&&URL.revokeObjectURL(a.value[C]);const y=URL.createObjectURL(x);a.value[C]=y}async function i(w){if(!w){console.warn("initCacheSingle called with null/undefined id");return}const x=String(w);if(a.value[x])return;const C=await fr(x);C&&(await scheduler.yield(),o(x,C),window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:x,blob:C}})))}function u(w){const{id:x,blob:C}=w.detail;x&&C&&o(x,C)}function f(){typeof window>"u"||l||(window.addEventListener("image-cached",u),l=!0)}function m(){typeof window>"u"||!l||(window.removeEventListener("image-cached",u),l=!1)}function p(){Object.values(a.value).forEach(URL.revokeObjectURL),a.value={}}return typeof window<"u"&&f(),{cache:a,initCacheSingle:i,updateCacheFromBlob:o,cleanup:p,setupEventListener:f,removeEventListener:m}}),Rt=we.defineStore("themeLib",()=>{const a=si(),{initCacheSingle:l}=a,o=r.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_auth_required:!0,qr_bypass_guest_auth:null,qr_show_pay_button_ts:null,kiosk_bypass_guest_auth:null,kiosk_disable_lock_screen:null,kiosk_hide_banner: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,enable_sequential_modifiers:!1,pdf_return_url:null,kiosk_hide_manual_input_loyalty_card:null,kiosk_camera_scan_loyalty_card:null,kiosk_hide_menu_update_notification:null,kiosk_proceed_to_payment_text:null}),i=async f=>{if(!f)return;o.value={...f};const m=await fr("banner"),p=await fr("preloader"),w=await fr("defaultImage");m||u(f.kiosk_banner,"banner"),p||u(f.kiosk_preloader,"preloader"),w||u(f.fallback_image,"defaultImage"),document.documentElement.style.setProperty("--primaryColor",f.primary_color),document.documentElement.style.setProperty("--accentColor",f.accent_color),document.documentElement.style.setProperty("--accentLightColor",f.accent_light_color),document.documentElement.style.setProperty("--accentDarkColor",f.accent_dark_color),document.documentElement.style.setProperty("--bgButtonColor",f.bg_button_color),document.documentElement.style.setProperty("--inactiveButtonColor",f.inactive_button_color),document.documentElement.style.setProperty("--cardsColor",f.cards_color),document.documentElement.style.setProperty("--textColor",f.text_color),document.documentElement.style.setProperty("--nonworkingBgColor",f.nonworking_bg_color),f.apply_custom_size_picker_fonts&&f.size_picker_unselected_font_size&&f.size_picker_unselected_font_size>0&&document.documentElement.style.setProperty("--sizePickerUnselectedFontSize",`${f.size_picker_unselected_font_size}rem`),f.apply_custom_size_picker_fonts&&f.size_picker_selected_font_size&&f.size_picker_selected_font_size>0&&document.documentElement.style.setProperty("--sizePickerSelectedFontSize",`${f.size_picker_selected_font_size}rem`);const x=o.value.primary_color||"#F2F7FF",C=Se(x).setAlpha(.7).toRgbString(),y=`linear-gradient(to bottom, transparent 10%, ${C} 50%, ${x} 85%)`,N=`-webkit-linear-gradient(to bottom, transparent 10%, ${C} 50%, ${x} 85%)`;return o.value.gradientStyle={background:y,backgroundColor:N},o.value},u=async(f,m)=>{if(f){const p=await fetch(f);if(!p.ok)throw new Error("Network error");const w=await p.blob();Zi(m,w),l(m)}};return{itemThemes:o,updateColor:i}}),hr=a=>{if(!a)return 0;if((a.price===0||a.price===null)&&a.sizes&&a.sizes.length>0){const l=a.sizes.find(o=>o.is_default===!0);return l?l.price:a.sizes.length>1?a.sizes[1].price??a.sizes[0].price:a.sizes[0].price}return a.price};class Pr extends Error{}Pr.prototype.name="InvalidTokenError";function ec(a){return decodeURIComponent(atob(a).replace(/(.)/g,(l,o)=>{let i=o.charCodeAt(0).toString(16).toUpperCase();return i.length<2&&(i="0"+i),"%"+i}))}function tc(a){let l=a.replace(/-/g,"+").replace(/_/g,"/");switch(l.length%4){case 0:break;case 2:l+="==";break;case 3:l+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return ec(l)}catch{return atob(l)}}function fs(a,l){if(typeof a!="string")throw new Pr("Invalid token specified: must be a string");l||(l={});const o=l.header===!0?0:1,i=a.split(".")[o];if(typeof i!="string")throw new Pr(`Invalid token specified: missing part #${o+1}`);let u;try{u=tc(i)}catch(f){throw new Pr(`Invalid token specified: invalid base64 for part #${o+1} (${f.message})`)}try{return JSON.parse(u)}catch(f){throw new Pr(`Invalid token specified: invalid json for part #${o+1} (${f.message})`)}}const nc=(a,l)=>{if(typeof window<"u"){const o=localStorage.getItem(a);if(o)try{return JSON.parse(o)}catch{return l}return l}return l},rc=(a,l)=>{if(typeof window<"u"){const o=localStorage.getItem(a);if(o)try{return fs(JSON.parse(o))}catch(i){return console.error("Failed to decode JWT:",i),l}}return l},hs=(a,l,o="normal")=>{const i=r.ref(o==="jwt"?rc(a,l):nc(a,l));return r.watchEffect(()=>{i.value===null||i.value===void 0?localStorage.removeItem(a):o!=="jwt"&&localStorage.setItem(a,JSON.stringify(i.value))}),i},mr=a=>{a.forEach(l=>{try{localStorage.removeItem(l)}catch(o){console.error(`Ошибка при удалении ключа "${l}":`,o)}})};class ic{constructor(l,o={}){Re(this,"url");Re(this,"options");Re(this,"ws");Re(this,"reconnectInterval");Re(this,"listeners");Re(this,"isConnected");Re(this,"heartbeat");Re(this,"heartbeatTimeout");Re(this,"pingTimeout");Re(this,"pingResponseTimeout");Re(this,"signal");Re(this,"_shouldReconnect",!0);this.url=l,this.options=o,this.ws=null,this.reconnectInterval=5e3,this.pingResponseTimeout=5e3,this.listeners=new Map,this.isConnected=r.ref(!1),this.heartbeatTimeout=o.heartbeatTimeout||3e5}connect(){var o,i;if(this.ws&&this.ws.readyState===WebSocket.OPEN){console.warn("WebSocket already open");return}if(!this._shouldReconnect){console.warn("Reconnection disabled");return}const l=`${this.url}`;this.ws=new WebSocket(l),(o=this.options.signal)!=null&&o.aborted&&this.close(!0),(i=this.options.signal)==null||i.addEventListener("abort",()=>this.close(!0)),this.ws.onopen=()=>{console.warn("WebSocket connected"),this.isConnected.value=!0,this.emit("open"),this.heartbeat=setInterval(()=>this.sendPing(),this.heartbeatTimeout)},this.ws.onmessage=u=>{try{const f=JSON.parse(u.data);this.emit("message",f),f!=null&&f.type&&f.type!=="ping"&&clearTimeout(this.pingTimeout)}catch(f){console.error("Error parsing WebSocket message:",f)}},this.ws.onerror=u=>{console.error("WebSocket error:",u),this.emit("error",u),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 l;this.isConnected.value&&((l=this.ws)==null?void 0:l.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(l){var o;this.isConnected.value&&((o=this.ws)==null?void 0:o.readyState)===WebSocket.OPEN?this.ws.send(JSON.stringify(l)):console.warn("WebSocket not connected")}close(l=!1){this.ws&&(this._shouldReconnect=!l,this.ws.close(),clearInterval(this.heartbeat),clearTimeout(this.pingTimeout),this.ws=null,this.listeners.clear())}on(l,o){this.listeners.has(l)||this.listeners.set(l,[]),this.listeners.get(l).push(o)}off(l,o){const i=this.listeners.get(l);i&&this.listeners.set(l,i.filter(u=>u!==o))}emit(l,o=null){const i=this.listeners.get(l);i&&i.forEach(u=>u(o))}getConnectionStatus(){return this.isConnected}}let ai=new Map;function Lr(a,l={}){var i;if(ai.has(a)){const u=ai.get(a);if(u.isConnected.value&&((i=u.ws)==null?void 0:i.readyState)===WebSocket.OPEN)return u.listeners.clear(),u;u.close(!0),ai.delete(a)}const o=new ic(a,l);return ai.set(a,o),o}const st=we.defineStore("mainLib",()=>{const a=r.ref(),l=r.ref(!1),o=r.ref(localStorage.getItem("kiosk_timeout")),i=r.ref(0),u=r.ref(!1),f=r.ref(sessionStorage.getItem("is_adult")==="true"),m=r.ref([]),p=r.ref([]),w=r.ref(!1),x=r.ref(),C=r.ref(""),y=r.ref(0),N=r.ref(!1),O=r.ref(!1),T=r.ref(!0),v=r.ref(!localStorage.getItem("apiKey")),D=r.ref(!1),U=r.ref({textNotification:""}),M=r.ref([]);let R=null;const F=K=>{const oe=`wss://${x.value.area}/ws/device/${K}/`;R=Lr(oe);function de(){console.log("WebSocket connection opened")}function ce(ge){if(ge.error)D.value=!0,U.value.textNotification=ge.error,R==null||R.close(!0);else{if(!(ge!=null&&ge.params))return;typeof ge.params.components.shift.is_ok!==null?T.value=ge.params.components.shift.is_ok:T.value=!0}}function Ce(ge){console.error("WebSocket error:",ge),R.close(!0)}R.on("open",de),R.on("message",ce),R.on("error",Ce),R.connect()},H=K=>{i.value=K,localStorage.setItem("kiosk_timeout",K)},Z=K=>{l.value=K},V=r.ref(null),P=r.computed(()=>m.value.reduce((K,oe)=>{let de=0,ce=0;return oe.group_modifiers&&(de=oe.group_modifiers.reduce((Ce,ge)=>ge.modifiers?Ce+ge.modifiers.reduce((De,xe)=>De+xe.old_price*xe.amount,0):0,0)*oe.amount),oe.modifiers&&(ce=oe.modifiers.reduce((Ce,ge)=>Ce+ge.old_price*ge.amount,0)*oe.amount),K+oe.old_price*oe.amount+de+ce},0)),L=r.computed({get:()=>m.value.length===0||V.value===0?0:V.value&&V.value!==0?V.value:m.value.reduce((K,oe)=>{const de=hr(oe)*oe.amount;let ce=0,Ce=0;return oe.group_modifiers&&(ce=oe.group_modifiers.reduce((ge,De)=>De.modifiers?ge+De.modifiers.reduce((xe,_t)=>xe+_t.price*_t.amount,0):0,0)*oe.amount),oe.modifiers&&(Ce=oe.modifiers.reduce((ge,De)=>ge+De.price*De.amount,0)*oe.amount),K+de+ce+Ce},0),set(K){V.value=K}}),re=K=>{y.value=K,localStorage.removeItem("bonus"),hs("bonus",y.value)},Q=K=>{mr(K)},ee=K=>{K={...K,idSystem:crypto.randomUUID()};const oe=X(K);m.value.push(oe),W()},W=()=>{try{if(!m.value||m.value.length===0){localStorage.removeItem("cart");return}localStorage.setItem("cart",JSON.stringify(r.toRaw(m.value)))}catch(K){console.error("Failed to update cart in localStorage:",K)}},X=K=>r.reactive({...K,amount:K.amount??1,price:K.old_price,new_price:null,total_new_price:null,discounts:[],modifiers:(K.modifiers||[]).map(oe=>r.reactive({...oe,price:oe.old_price,new_price:null,total_new_price:null})),group_modifiers:(K.group_modifiers||[]).map(oe=>r.reactive({...oe,modifiers:(oe.modifiers||[]).map(de=>r.reactive({...de,price:de.old_price,new_price:null,total_new_price:null}))}))}),I=K=>{const oe=m.value.find(de=>de.idSystem===K);oe&&(oe.amount+=1),W()},$=K=>{const oe=m.value.find(de=>de.idSystem===K);oe&&(oe.amount>=1&&(oe.amount-=1),W())},j=()=>{try{const K=localStorage.getItem("cart");if(K){const oe=JSON.parse(K);m.value.splice(0,m.value.length,...oe.map(X)),V.value=null}}catch(K){console.error("Failed to load cart from localStorage:",K)}};return j(),{cartProducts_lib:m,activeScrolling_lib:p,config_lib:x,totalPrice_lib:L,initialCartPrice_lib:P,is_notification_lib:D,notificationData_lib:U,xApiKey_lib:C,countBonus:y,toggleDrum:l,is_showApiKey:v,openApiKey:N,kiosk_timeout:o,kiosk_FirstTimeout:i,is_OpenLoyal:O,profile:a,is_18_above_content:u,is18Allowed:f,healthState:T,displayCards:M,isOrderTypeSubmited:w,removeFromLocalStorage:Q,setKioskTimeout:H,setBonus:re,setStateDrum:Z,addToCart:ee,plusAmount:I,minusAmount:$,loadCart:j,deleteItemFromCart:K=>{if(K){const oe=m.value.findIndex(de=>de.idSystem===K);if(oe===-1)return;m.value.splice(oe,1),W(),V.value=null}else m.value=[],W()},updateCartInLocalStorage:W,makeProductFullyReactive:X,checkHeartbeatApp:F}});function ms(a,l){return function(){return a.apply(l,arguments)}}const{toString:oc}=Object.prototype,{getPrototypeOf:Ki}=Object,{iterator:li,toStringTag:gs}=Symbol,ci=(a=>l=>{const o=oc.call(l);return a[o]||(a[o]=o.slice(8,-1).toLowerCase())})(Object.create(null)),En=a=>(a=a.toLowerCase(),l=>ci(l)===a),di=a=>l=>typeof l===a,{isArray:gr}=Array,pr=di("undefined");function Fr(a){return a!==null&&!pr(a)&&a.constructor!==null&&!pr(a.constructor)&&Kt(a.constructor.isBuffer)&&a.constructor.isBuffer(a)}const ps=En("ArrayBuffer");function sc(a){let l;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?l=ArrayBuffer.isView(a):l=a&&a.buffer&&ps(a.buffer),l}const ac=di("string"),Kt=di("function"),xs=di("number"),Vr=a=>a!==null&&typeof a=="object",lc=a=>a===!0||a===!1,ui=a=>{if(ci(a)!=="object")return!1;const l=Ki(a);return(l===null||l===Object.prototype||Object.getPrototypeOf(l)===null)&&!(gs in a)&&!(li in a)},cc=a=>{if(!Vr(a)||Fr(a))return!1;try{return Object.keys(a).length===0&&Object.getPrototypeOf(a)===Object.prototype}catch{return!1}},dc=En("Date"),uc=En("File"),fc=En("Blob"),hc=En("FileList"),mc=a=>Vr(a)&&Kt(a.pipe),gc=a=>{let l;return a&&(typeof FormData=="function"&&a instanceof FormData||Kt(a.append)&&((l=ci(a))==="formdata"||l==="object"&&Kt(a.toString)&&a.toString()==="[object FormData]"))},pc=En("URLSearchParams"),[xc,wc,_c,Cc]=["ReadableStream","Request","Response","Headers"].map(En),Ec=a=>a.trim?a.trim():a.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ur(a,l,{allOwnKeys:o=!1}={}){if(a===null||typeof a>"u")return;let i,u;if(typeof a!="object"&&(a=[a]),gr(a))for(i=0,u=a.length;i<u;i++)l.call(null,a[i],i,a);else{if(Fr(a))return;const f=o?Object.getOwnPropertyNames(a):Object.keys(a),m=f.length;let p;for(i=0;i<m;i++)p=f[i],l.call(null,a[p],p,a)}}function ws(a,l){if(Fr(a))return null;l=l.toLowerCase();const o=Object.keys(a);let i=o.length,u;for(;i-- >0;)if(u=o[i],l===u.toLowerCase())return u;return null}const Jn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,_s=a=>!pr(a)&&a!==Jn;function Qi(){const{caseless:a,skipUndefined:l}=_s(this)&&this||{},o={},i=(u,f)=>{const m=a&&ws(o,f)||f;ui(o[m])&&ui(u)?o[m]=Qi(o[m],u):ui(u)?o[m]=Qi({},u):gr(u)?o[m]=u.slice():(!l||!pr(u))&&(o[m]=u)};for(let u=0,f=arguments.length;u<f;u++)arguments[u]&&Ur(arguments[u],i);return o}const yc=(a,l,o,{allOwnKeys:i}={})=>(Ur(l,(u,f)=>{o&&Kt(u)?a[f]=ms(u,o):a[f]=u},{allOwnKeys:i}),a),bc=a=>(a.charCodeAt(0)===65279&&(a=a.slice(1)),a),Ac=(a,l,o,i)=>{a.prototype=Object.create(l.prototype,i),a.prototype.constructor=a,Object.defineProperty(a,"super",{value:l.prototype}),o&&Object.assign(a.prototype,o)},Sc=(a,l,o,i)=>{let u,f,m;const p={};if(l=l||{},a==null)return l;do{for(u=Object.getOwnPropertyNames(a),f=u.length;f-- >0;)m=u[f],(!i||i(m,a,l))&&!p[m]&&(l[m]=a[m],p[m]=!0);a=o!==!1&&Ki(a)}while(a&&(!o||o(a,l))&&a!==Object.prototype);return l},Ic=(a,l,o)=>{a=String(a),(o===void 0||o>a.length)&&(o=a.length),o-=l.length;const i=a.indexOf(l,o);return i!==-1&&i===o},Nc=a=>{if(!a)return null;if(gr(a))return a;let l=a.length;if(!xs(l))return null;const o=new Array(l);for(;l-- >0;)o[l]=a[l];return o},Tc=(a=>l=>a&&l instanceof a)(typeof Uint8Array<"u"&&Ki(Uint8Array)),kc=(a,l)=>{const i=(a&&a[li]).call(a);let u;for(;(u=i.next())&&!u.done;){const f=u.value;l.call(a,f[0],f[1])}},Rc=(a,l)=>{let o;const i=[];for(;(o=a.exec(l))!==null;)i.push(o);return i},Bc=En("HTMLFormElement"),Oc=a=>a.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(o,i,u){return i.toUpperCase()+u}),Cs=(({hasOwnProperty:a})=>(l,o)=>a.call(l,o))(Object.prototype),Mc=En("RegExp"),Es=(a,l)=>{const o=Object.getOwnPropertyDescriptors(a),i={};Ur(o,(u,f)=>{let m;(m=l(u,f,a))!==!1&&(i[f]=m||u)}),Object.defineProperties(a,i)},Dc=a=>{Es(a,(l,o)=>{if(Kt(a)&&["arguments","caller","callee"].indexOf(o)!==-1)return!1;const i=a[o];if(Kt(i)){if(l.enumerable=!1,"writable"in l){l.writable=!1;return}l.set||(l.set=()=>{throw Error("Can not rewrite read-only method '"+o+"'")})}})},vc=(a,l)=>{const o={},i=u=>{u.forEach(f=>{o[f]=!0})};return gr(a)?i(a):i(String(a).split(l)),o},Pc=()=>{},Lc=(a,l)=>a!=null&&Number.isFinite(a=+a)?a:l;function Fc(a){return!!(a&&Kt(a.append)&&a[gs]==="FormData"&&a[li])}const Vc=a=>{const l=new Array(10),o=(i,u)=>{if(Vr(i)){if(l.indexOf(i)>=0)return;if(Fr(i))return i;if(!("toJSON"in i)){l[u]=i;const f=gr(i)?[]:{};return Ur(i,(m,p)=>{const w=o(m,u+1);!pr(w)&&(f[p]=w)}),l[u]=void 0,f}}return i};return o(a,0)},Uc=En("AsyncFunction"),zc=a=>a&&(Vr(a)||Kt(a))&&Kt(a.then)&&Kt(a.catch),ys=((a,l)=>a?setImmediate:l?((o,i)=>(Jn.addEventListener("message",({source:u,data:f})=>{u===Jn&&f===o&&i.length&&i.shift()()},!1),u=>{i.push(u),Jn.postMessage(o,"*")}))(`axios@${Math.random()}`,[]):o=>setTimeout(o))(typeof setImmediate=="function",Kt(Jn.postMessage)),Hc=typeof queueMicrotask<"u"?queueMicrotask.bind(Jn):typeof process<"u"&&process.nextTick||ys,te={isArray:gr,isArrayBuffer:ps,isBuffer:Fr,isFormData:gc,isArrayBufferView:sc,isString:ac,isNumber:xs,isBoolean:lc,isObject:Vr,isPlainObject:ui,isEmptyObject:cc,isReadableStream:xc,isRequest:wc,isResponse:_c,isHeaders:Cc,isUndefined:pr,isDate:dc,isFile:uc,isBlob:fc,isRegExp:Mc,isFunction:Kt,isStream:mc,isURLSearchParams:pc,isTypedArray:Tc,isFileList:hc,forEach:Ur,merge:Qi,extend:yc,trim:Ec,stripBOM:bc,inherits:Ac,toFlatObject:Sc,kindOf:ci,kindOfTest:En,endsWith:Ic,toArray:Nc,forEachEntry:kc,matchAll:Rc,isHTMLForm:Bc,hasOwnProperty:Cs,hasOwnProp:Cs,reduceDescriptors:Es,freezeMethods:Dc,toObjectSet:vc,toCamelCase:Oc,noop:Pc,toFiniteNumber:Lc,findKey:ws,global:Jn,isContextDefined:_s,isSpecCompliantForm:Fc,toJSONObject:Vc,isAsyncFn:Uc,isThenable:zc,setImmediate:ys,asap:Hc,isIterable:a=>a!=null&&Kt(a[li])};function Le(a,l,o,i,u){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=a,this.name="AxiosError",l&&(this.code=l),o&&(this.config=o),i&&(this.request=i),u&&(this.response=u,this.status=u.status?u.status:null)}te.inherits(Le,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:te.toJSONObject(this.config),code:this.code,status:this.status}}});const bs=Le.prototype,As={};["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(a=>{As[a]={value:a}}),Object.defineProperties(Le,As),Object.defineProperty(bs,"isAxiosError",{value:!0}),Le.from=(a,l,o,i,u,f)=>{const m=Object.create(bs);te.toFlatObject(a,m,function(C){return C!==Error.prototype},x=>x!=="isAxiosError");const p=a&&a.message?a.message:"Error",w=l==null&&a?a.code:l;return Le.call(m,p,w,o,i,u),a&&m.cause==null&&Object.defineProperty(m,"cause",{value:a,configurable:!0}),m.name=a&&a.name||"Error",f&&Object.assign(m,f),m};const Gc=null;function Ji(a){return te.isPlainObject(a)||te.isArray(a)}function Ss(a){return te.endsWith(a,"[]")?a.slice(0,-2):a}function Is(a,l,o){return a?a.concat(l).map(function(u,f){return u=Ss(u),!o&&f?"["+u+"]":u}).join(o?".":""):l}function Wc(a){return te.isArray(a)&&!a.some(Ji)}const Xc=te.toFlatObject(te,{},null,function(l){return/^is[A-Z]/.test(l)});function fi(a,l,o){if(!te.isObject(a))throw new TypeError("target must be an object");l=l||new FormData,o=te.toFlatObject(o,{metaTokens:!0,dots:!1,indexes:!1},!1,function(v,D){return!te.isUndefined(D[v])});const i=o.metaTokens,u=o.visitor||C,f=o.dots,m=o.indexes,w=(o.Blob||typeof Blob<"u"&&Blob)&&te.isSpecCompliantForm(l);if(!te.isFunction(u))throw new TypeError("visitor must be a function");function x(T){if(T===null)return"";if(te.isDate(T))return T.toISOString();if(te.isBoolean(T))return T.toString();if(!w&&te.isBlob(T))throw new Le("Blob is not supported. Use a Buffer instead.");return te.isArrayBuffer(T)||te.isTypedArray(T)?w&&typeof Blob=="function"?new Blob([T]):Buffer.from(T):T}function C(T,v,D){let U=T;if(T&&!D&&typeof T=="object"){if(te.endsWith(v,"{}"))v=i?v:v.slice(0,-2),T=JSON.stringify(T);else if(te.isArray(T)&&Wc(T)||(te.isFileList(T)||te.endsWith(v,"[]"))&&(U=te.toArray(T)))return v=Ss(v),U.forEach(function(R,F){!(te.isUndefined(R)||R===null)&&l.append(m===!0?Is([v],F,f):m===null?v:v+"[]",x(R))}),!1}return Ji(T)?!0:(l.append(Is(D,v,f),x(T)),!1)}const y=[],N=Object.assign(Xc,{defaultVisitor:C,convertValue:x,isVisitable:Ji});function O(T,v){if(!te.isUndefined(T)){if(y.indexOf(T)!==-1)throw Error("Circular reference detected in "+v.join("."));y.push(T),te.forEach(T,function(U,M){(!(te.isUndefined(U)||U===null)&&u.call(l,U,te.isString(M)?M.trim():M,v,N))===!0&&O(U,v?v.concat(M):[M])}),y.pop()}}if(!te.isObject(a))throw new TypeError("data must be an object");return O(a),l}function Ns(a){const l={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(a).replace(/[!'()~]|%20|%00/g,function(i){return l[i]})}function eo(a,l){this._pairs=[],a&&fi(a,this,l)}const Ts=eo.prototype;Ts.append=function(l,o){this._pairs.push([l,o])},Ts.toString=function(l){const o=l?function(i){return l.call(this,i,Ns)}:Ns;return this._pairs.map(function(u){return o(u[0])+"="+o(u[1])},"").join("&")};function $c(a){return encodeURIComponent(a).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ks(a,l,o){if(!l)return a;const i=o&&o.encode||$c;te.isFunction(o)&&(o={serialize:o});const u=o&&o.serialize;let f;if(u?f=u(l,o):f=te.isURLSearchParams(l)?l.toString():new eo(l,o).toString(i),f){const m=a.indexOf("#");m!==-1&&(a=a.slice(0,m)),a+=(a.indexOf("?")===-1?"?":"&")+f}return a}class Rs{constructor(){this.handlers=[]}use(l,o,i){return this.handlers.push({fulfilled:l,rejected:o,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(l){this.handlers[l]&&(this.handlers[l]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(l){te.forEach(this.handlers,function(i){i!==null&&l(i)})}}const Bs={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},jc={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:eo,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},to=typeof window<"u"&&typeof document<"u",no=typeof navigator=="object"&&navigator||void 0,qc=to&&(!no||["ReactNative","NativeScript","NS"].indexOf(no.product)<0),Zc=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Yc=to&&window.location.href||"http://localhost",Xt={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:to,hasStandardBrowserEnv:qc,hasStandardBrowserWebWorkerEnv:Zc,navigator:no,origin:Yc},Symbol.toStringTag,{value:"Module"})),...jc};function Kc(a,l){return fi(a,new Xt.classes.URLSearchParams,{visitor:function(o,i,u,f){return Xt.isNode&&te.isBuffer(o)?(this.append(i,o.toString("base64")),!1):f.defaultVisitor.apply(this,arguments)},...l})}function Qc(a){return te.matchAll(/\w+|\[(\w*)]/g,a).map(l=>l[0]==="[]"?"":l[1]||l[0])}function Jc(a){const l={},o=Object.keys(a);let i;const u=o.length;let f;for(i=0;i<u;i++)f=o[i],l[f]=a[f];return l}function Os(a){function l(o,i,u,f){let m=o[f++];if(m==="__proto__")return!0;const p=Number.isFinite(+m),w=f>=o.length;return m=!m&&te.isArray(u)?u.length:m,w?(te.hasOwnProp(u,m)?u[m]=[u[m],i]:u[m]=i,!p):((!u[m]||!te.isObject(u[m]))&&(u[m]=[]),l(o,i,u[m],f)&&te.isArray(u[m])&&(u[m]=Jc(u[m])),!p)}if(te.isFormData(a)&&te.isFunction(a.entries)){const o={};return te.forEachEntry(a,(i,u)=>{l(Qc(i),u,o,0)}),o}return null}function ed(a,l,o){if(te.isString(a))try{return(l||JSON.parse)(a),te.trim(a)}catch(i){if(i.name!=="SyntaxError")throw i}return(o||JSON.stringify)(a)}const zr={transitional:Bs,adapter:["xhr","http","fetch"],transformRequest:[function(l,o){const i=o.getContentType()||"",u=i.indexOf("application/json")>-1,f=te.isObject(l);if(f&&te.isHTMLForm(l)&&(l=new FormData(l)),te.isFormData(l))return u?JSON.stringify(Os(l)):l;if(te.isArrayBuffer(l)||te.isBuffer(l)||te.isStream(l)||te.isFile(l)||te.isBlob(l)||te.isReadableStream(l))return l;if(te.isArrayBufferView(l))return l.buffer;if(te.isURLSearchParams(l))return o.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),l.toString();let p;if(f){if(i.indexOf("application/x-www-form-urlencoded")>-1)return Kc(l,this.formSerializer).toString();if((p=te.isFileList(l))||i.indexOf("multipart/form-data")>-1){const w=this.env&&this.env.FormData;return fi(p?{"files[]":l}:l,w&&new w,this.formSerializer)}}return f||u?(o.setContentType("application/json",!1),ed(l)):l}],transformResponse:[function(l){const o=this.transitional||zr.transitional,i=o&&o.forcedJSONParsing,u=this.responseType==="json";if(te.isResponse(l)||te.isReadableStream(l))return l;if(l&&te.isString(l)&&(i&&!this.responseType||u)){const m=!(o&&o.silentJSONParsing)&&u;try{return JSON.parse(l,this.parseReviver)}catch(p){if(m)throw p.name==="SyntaxError"?Le.from(p,Le.ERR_BAD_RESPONSE,this,null,this.response):p}}return l}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Xt.classes.FormData,Blob:Xt.classes.Blob},validateStatus:function(l){return l>=200&&l<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};te.forEach(["delete","get","head","post","put","patch"],a=>{zr.headers[a]={}});const td=te.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"]),nd=a=>{const l={};let o,i,u;return a&&a.split(`
2
+ `).forEach(function(m){u=m.indexOf(":"),o=m.substring(0,u).trim().toLowerCase(),i=m.substring(u+1).trim(),!(!o||l[o]&&td[o])&&(o==="set-cookie"?l[o]?l[o].push(i):l[o]=[i]:l[o]=l[o]?l[o]+", "+i:i)}),l},Ms=Symbol("internals");function Hr(a){return a&&String(a).trim().toLowerCase()}function hi(a){return a===!1||a==null?a:te.isArray(a)?a.map(hi):String(a)}function rd(a){const l=Object.create(null),o=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=o.exec(a);)l[i[1]]=i[2];return l}const id=a=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(a.trim());function ro(a,l,o,i,u){if(te.isFunction(i))return i.call(this,l,o);if(u&&(l=o),!!te.isString(l)){if(te.isString(i))return l.indexOf(i)!==-1;if(te.isRegExp(i))return i.test(l)}}function od(a){return a.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(l,o,i)=>o.toUpperCase()+i)}function sd(a,l){const o=te.toCamelCase(" "+l);["get","set","has"].forEach(i=>{Object.defineProperty(a,i+o,{value:function(u,f,m){return this[i].call(this,l,u,f,m)},configurable:!0})})}let Qt=class{constructor(l){l&&this.set(l)}set(l,o,i){const u=this;function f(p,w,x){const C=Hr(w);if(!C)throw new Error("header name must be a non-empty string");const y=te.findKey(u,C);(!y||u[y]===void 0||x===!0||x===void 0&&u[y]!==!1)&&(u[y||w]=hi(p))}const m=(p,w)=>te.forEach(p,(x,C)=>f(x,C,w));if(te.isPlainObject(l)||l instanceof this.constructor)m(l,o);else if(te.isString(l)&&(l=l.trim())&&!id(l))m(nd(l),o);else if(te.isObject(l)&&te.isIterable(l)){let p={},w,x;for(const C of l){if(!te.isArray(C))throw TypeError("Object iterator must return a key-value pair");p[x=C[0]]=(w=p[x])?te.isArray(w)?[...w,C[1]]:[w,C[1]]:C[1]}m(p,o)}else l!=null&&f(o,l,i);return this}get(l,o){if(l=Hr(l),l){const i=te.findKey(this,l);if(i){const u=this[i];if(!o)return u;if(o===!0)return rd(u);if(te.isFunction(o))return o.call(this,u,i);if(te.isRegExp(o))return o.exec(u);throw new TypeError("parser must be boolean|regexp|function")}}}has(l,o){if(l=Hr(l),l){const i=te.findKey(this,l);return!!(i&&this[i]!==void 0&&(!o||ro(this,this[i],i,o)))}return!1}delete(l,o){const i=this;let u=!1;function f(m){if(m=Hr(m),m){const p=te.findKey(i,m);p&&(!o||ro(i,i[p],p,o))&&(delete i[p],u=!0)}}return te.isArray(l)?l.forEach(f):f(l),u}clear(l){const o=Object.keys(this);let i=o.length,u=!1;for(;i--;){const f=o[i];(!l||ro(this,this[f],f,l,!0))&&(delete this[f],u=!0)}return u}normalize(l){const o=this,i={};return te.forEach(this,(u,f)=>{const m=te.findKey(i,f);if(m){o[m]=hi(u),delete o[f];return}const p=l?od(f):String(f).trim();p!==f&&delete o[f],o[p]=hi(u),i[p]=!0}),this}concat(...l){return this.constructor.concat(this,...l)}toJSON(l){const o=Object.create(null);return te.forEach(this,(i,u)=>{i!=null&&i!==!1&&(o[u]=l&&te.isArray(i)?i.join(", "):i)}),o}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([l,o])=>l+": "+o).join(`
3
+ `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(l){return l instanceof this?l:new this(l)}static concat(l,...o){const i=new this(l);return o.forEach(u=>i.set(u)),i}static accessor(l){const i=(this[Ms]=this[Ms]={accessors:{}}).accessors,u=this.prototype;function f(m){const p=Hr(m);i[p]||(sd(u,m),i[p]=!0)}return te.isArray(l)?l.forEach(f):f(l),this}};Qt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),te.reduceDescriptors(Qt.prototype,({value:a},l)=>{let o=l[0].toUpperCase()+l.slice(1);return{get:()=>a,set(i){this[o]=i}}}),te.freezeMethods(Qt);function io(a,l){const o=this||zr,i=l||o,u=Qt.from(i.headers);let f=i.data;return te.forEach(a,function(p){f=p.call(o,f,u.normalize(),l?l.status:void 0)}),u.normalize(),f}function Ds(a){return!!(a&&a.__CANCEL__)}function xr(a,l,o){Le.call(this,a??"canceled",Le.ERR_CANCELED,l,o),this.name="CanceledError"}te.inherits(xr,Le,{__CANCEL__:!0});function vs(a,l,o){const i=o.config.validateStatus;!o.status||!i||i(o.status)?a(o):l(new Le("Request failed with status code "+o.status,[Le.ERR_BAD_REQUEST,Le.ERR_BAD_RESPONSE][Math.floor(o.status/100)-4],o.config,o.request,o))}function ad(a){const l=/^([-+\w]{1,25})(:?\/\/|:)/.exec(a);return l&&l[1]||""}function ld(a,l){a=a||10;const o=new Array(a),i=new Array(a);let u=0,f=0,m;return l=l!==void 0?l:1e3,function(w){const x=Date.now(),C=i[f];m||(m=x),o[u]=w,i[u]=x;let y=f,N=0;for(;y!==u;)N+=o[y++],y=y%a;if(u=(u+1)%a,u===f&&(f=(f+1)%a),x-m<l)return;const O=C&&x-C;return O?Math.round(N*1e3/O):void 0}}function cd(a,l){let o=0,i=1e3/l,u,f;const m=(x,C=Date.now())=>{o=C,u=null,f&&(clearTimeout(f),f=null),a(...x)};return[(...x)=>{const C=Date.now(),y=C-o;y>=i?m(x,C):(u=x,f||(f=setTimeout(()=>{f=null,m(u)},i-y)))},()=>u&&m(u)]}const mi=(a,l,o=3)=>{let i=0;const u=ld(50,250);return cd(f=>{const m=f.loaded,p=f.lengthComputable?f.total:void 0,w=m-i,x=u(w),C=m<=p;i=m;const y={loaded:m,total:p,progress:p?m/p:void 0,bytes:w,rate:x||void 0,estimated:x&&p&&C?(p-m)/x:void 0,event:f,lengthComputable:p!=null,[l?"download":"upload"]:!0};a(y)},o)},Ps=(a,l)=>{const o=a!=null;return[i=>l[0]({lengthComputable:o,total:a,loaded:i}),l[1]]},Ls=a=>(...l)=>te.asap(()=>a(...l)),dd=Xt.hasStandardBrowserEnv?((a,l)=>o=>(o=new URL(o,Xt.origin),a.protocol===o.protocol&&a.host===o.host&&(l||a.port===o.port)))(new URL(Xt.origin),Xt.navigator&&/(msie|trident)/i.test(Xt.navigator.userAgent)):()=>!0,ud=Xt.hasStandardBrowserEnv?{write(a,l,o,i,u,f,m){if(typeof document>"u")return;const p=[`${a}=${encodeURIComponent(l)}`];te.isNumber(o)&&p.push(`expires=${new Date(o).toUTCString()}`),te.isString(i)&&p.push(`path=${i}`),te.isString(u)&&p.push(`domain=${u}`),f===!0&&p.push("secure"),te.isString(m)&&p.push(`SameSite=${m}`),document.cookie=p.join("; ")},read(a){if(typeof document>"u")return null;const l=document.cookie.match(new RegExp("(?:^|; )"+a+"=([^;]*)"));return l?decodeURIComponent(l[1]):null},remove(a){this.write(a,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function fd(a){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(a)}function hd(a,l){return l?a.replace(/\/?\/$/,"")+"/"+l.replace(/^\/+/,""):a}function Fs(a,l,o){let i=!fd(l);return a&&(i||o==!1)?hd(a,l):l}const Vs=a=>a instanceof Qt?{...a}:a;function er(a,l){l=l||{};const o={};function i(x,C,y,N){return te.isPlainObject(x)&&te.isPlainObject(C)?te.merge.call({caseless:N},x,C):te.isPlainObject(C)?te.merge({},C):te.isArray(C)?C.slice():C}function u(x,C,y,N){if(te.isUndefined(C)){if(!te.isUndefined(x))return i(void 0,x,y,N)}else return i(x,C,y,N)}function f(x,C){if(!te.isUndefined(C))return i(void 0,C)}function m(x,C){if(te.isUndefined(C)){if(!te.isUndefined(x))return i(void 0,x)}else return i(void 0,C)}function p(x,C,y){if(y in l)return i(x,C);if(y in a)return i(void 0,x)}const w={url:f,method:f,data:f,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:p,headers:(x,C,y)=>u(Vs(x),Vs(C),y,!0)};return te.forEach(Object.keys({...a,...l}),function(C){const y=w[C]||u,N=y(a[C],l[C],C);te.isUndefined(N)&&y!==p||(o[C]=N)}),o}const Us=a=>{const l=er({},a);let{data:o,withXSRFToken:i,xsrfHeaderName:u,xsrfCookieName:f,headers:m,auth:p}=l;if(l.headers=m=Qt.from(m),l.url=ks(Fs(l.baseURL,l.url,l.allowAbsoluteUrls),a.params,a.paramsSerializer),p&&m.set("Authorization","Basic "+btoa((p.username||"")+":"+(p.password?unescape(encodeURIComponent(p.password)):""))),te.isFormData(o)){if(Xt.hasStandardBrowserEnv||Xt.hasStandardBrowserWebWorkerEnv)m.setContentType(void 0);else if(te.isFunction(o.getHeaders)){const w=o.getHeaders(),x=["content-type","content-length"];Object.entries(w).forEach(([C,y])=>{x.includes(C.toLowerCase())&&m.set(C,y)})}}if(Xt.hasStandardBrowserEnv&&(i&&te.isFunction(i)&&(i=i(l)),i||i!==!1&&dd(l.url))){const w=u&&f&&ud.read(f);w&&m.set(u,w)}return l},md=typeof XMLHttpRequest<"u"&&function(a){return new Promise(function(o,i){const u=Us(a);let f=u.data;const m=Qt.from(u.headers).normalize();let{responseType:p,onUploadProgress:w,onDownloadProgress:x}=u,C,y,N,O,T;function v(){O&&O(),T&&T(),u.cancelToken&&u.cancelToken.unsubscribe(C),u.signal&&u.signal.removeEventListener("abort",C)}let D=new XMLHttpRequest;D.open(u.method.toUpperCase(),u.url,!0),D.timeout=u.timeout;function U(){if(!D)return;const R=Qt.from("getAllResponseHeaders"in D&&D.getAllResponseHeaders()),H={data:!p||p==="text"||p==="json"?D.responseText:D.response,status:D.status,statusText:D.statusText,headers:R,config:a,request:D};vs(function(V){o(V),v()},function(V){i(V),v()},H),D=null}"onloadend"in D?D.onloadend=U:D.onreadystatechange=function(){!D||D.readyState!==4||D.status===0&&!(D.responseURL&&D.responseURL.indexOf("file:")===0)||setTimeout(U)},D.onabort=function(){D&&(i(new Le("Request aborted",Le.ECONNABORTED,a,D)),D=null)},D.onerror=function(F){const H=F&&F.message?F.message:"Network Error",Z=new Le(H,Le.ERR_NETWORK,a,D);Z.event=F||null,i(Z),D=null},D.ontimeout=function(){let F=u.timeout?"timeout of "+u.timeout+"ms exceeded":"timeout exceeded";const H=u.transitional||Bs;u.timeoutErrorMessage&&(F=u.timeoutErrorMessage),i(new Le(F,H.clarifyTimeoutError?Le.ETIMEDOUT:Le.ECONNABORTED,a,D)),D=null},f===void 0&&m.setContentType(null),"setRequestHeader"in D&&te.forEach(m.toJSON(),function(F,H){D.setRequestHeader(H,F)}),te.isUndefined(u.withCredentials)||(D.withCredentials=!!u.withCredentials),p&&p!=="json"&&(D.responseType=u.responseType),x&&([N,T]=mi(x,!0),D.addEventListener("progress",N)),w&&D.upload&&([y,O]=mi(w),D.upload.addEventListener("progress",y),D.upload.addEventListener("loadend",O)),(u.cancelToken||u.signal)&&(C=R=>{D&&(i(!R||R.type?new xr(null,a,D):R),D.abort(),D=null)},u.cancelToken&&u.cancelToken.subscribe(C),u.signal&&(u.signal.aborted?C():u.signal.addEventListener("abort",C)));const M=ad(u.url);if(M&&Xt.protocols.indexOf(M)===-1){i(new Le("Unsupported protocol "+M+":",Le.ERR_BAD_REQUEST,a));return}D.send(f||null)})},gd=(a,l)=>{const{length:o}=a=a?a.filter(Boolean):[];if(l||o){let i=new AbortController,u;const f=function(x){if(!u){u=!0,p();const C=x instanceof Error?x:this.reason;i.abort(C instanceof Le?C:new xr(C instanceof Error?C.message:C))}};let m=l&&setTimeout(()=>{m=null,f(new Le(`timeout ${l} of ms exceeded`,Le.ETIMEDOUT))},l);const p=()=>{a&&(m&&clearTimeout(m),m=null,a.forEach(x=>{x.unsubscribe?x.unsubscribe(f):x.removeEventListener("abort",f)}),a=null)};a.forEach(x=>x.addEventListener("abort",f));const{signal:w}=i;return w.unsubscribe=()=>te.asap(p),w}},pd=function*(a,l){let o=a.byteLength;if(o<l){yield a;return}let i=0,u;for(;i<o;)u=i+l,yield a.slice(i,u),i=u},xd=async function*(a,l){for await(const o of wd(a))yield*pd(o,l)},wd=async function*(a){if(a[Symbol.asyncIterator]){yield*a;return}const l=a.getReader();try{for(;;){const{done:o,value:i}=await l.read();if(o)break;yield i}}finally{await l.cancel()}},zs=(a,l,o,i)=>{const u=xd(a,l);let f=0,m,p=w=>{m||(m=!0,i&&i(w))};return new ReadableStream({async pull(w){try{const{done:x,value:C}=await u.next();if(x){p(),w.close();return}let y=C.byteLength;if(o){let N=f+=y;o(N)}w.enqueue(new Uint8Array(C))}catch(x){throw p(x),x}},cancel(w){return p(w),u.return()}},{highWaterMark:2})},Hs=64*1024,{isFunction:gi}=te,_d=(({Request:a,Response:l})=>({Request:a,Response:l}))(te.global),{ReadableStream:Gs,TextEncoder:Ws}=te.global,Xs=(a,...l)=>{try{return!!a(...l)}catch{return!1}},Cd=a=>{a=te.merge.call({skipUndefined:!0},_d,a);const{fetch:l,Request:o,Response:i}=a,u=l?gi(l):typeof fetch=="function",f=gi(o),m=gi(i);if(!u)return!1;const p=u&&gi(Gs),w=u&&(typeof Ws=="function"?(T=>v=>T.encode(v))(new Ws):async T=>new Uint8Array(await new o(T).arrayBuffer())),x=f&&p&&Xs(()=>{let T=!1;const v=new o(Xt.origin,{body:new Gs,method:"POST",get duplex(){return T=!0,"half"}}).headers.has("Content-Type");return T&&!v}),C=m&&p&&Xs(()=>te.isReadableStream(new i("").body)),y={stream:C&&(T=>T.body)};u&&["text","arrayBuffer","blob","formData","stream"].forEach(T=>{!y[T]&&(y[T]=(v,D)=>{let U=v&&v[T];if(U)return U.call(v);throw new Le(`Response type '${T}' is not supported`,Le.ERR_NOT_SUPPORT,D)})});const N=async T=>{if(T==null)return 0;if(te.isBlob(T))return T.size;if(te.isSpecCompliantForm(T))return(await new o(Xt.origin,{method:"POST",body:T}).arrayBuffer()).byteLength;if(te.isArrayBufferView(T)||te.isArrayBuffer(T))return T.byteLength;if(te.isURLSearchParams(T)&&(T=T+""),te.isString(T))return(await w(T)).byteLength},O=async(T,v)=>{const D=te.toFiniteNumber(T.getContentLength());return D??N(v)};return async T=>{let{url:v,method:D,data:U,signal:M,cancelToken:R,timeout:F,onDownloadProgress:H,onUploadProgress:Z,responseType:V,headers:P,withCredentials:L="same-origin",fetchOptions:re}=Us(T),Q=l||fetch;V=V?(V+"").toLowerCase():"text";let ee=gd([M,R&&R.toAbortSignal()],F),W=null;const X=ee&&ee.unsubscribe&&(()=>{ee.unsubscribe()});let I;try{if(Z&&x&&D!=="get"&&D!=="head"&&(I=await O(P,U))!==0){let de=new o(v,{method:"POST",body:U,duplex:"half"}),ce;if(te.isFormData(U)&&(ce=de.headers.get("content-type"))&&P.setContentType(ce),de.body){const[Ce,ge]=Ps(I,mi(Ls(Z)));U=zs(de.body,Hs,Ce,ge)}}te.isString(L)||(L=L?"include":"omit");const $=f&&"credentials"in o.prototype,j={...re,signal:ee,method:D.toUpperCase(),headers:P.normalize().toJSON(),body:U,duplex:"half",credentials:$?L:void 0};W=f&&new o(v,j);let q=await(f?Q(W,re):Q(v,j));const K=C&&(V==="stream"||V==="response");if(C&&(H||K&&X)){const de={};["status","statusText","headers"].forEach(De=>{de[De]=q[De]});const ce=te.toFiniteNumber(q.headers.get("content-length")),[Ce,ge]=H&&Ps(ce,mi(Ls(H),!0))||[];q=new i(zs(q.body,Hs,Ce,()=>{ge&&ge(),X&&X()}),de)}V=V||"text";let oe=await y[te.findKey(y,V)||"text"](q,T);return!K&&X&&X(),await new Promise((de,ce)=>{vs(de,ce,{data:oe,headers:Qt.from(q.headers),status:q.status,statusText:q.statusText,config:T,request:W})})}catch($){throw X&&X(),$&&$.name==="TypeError"&&/Load failed|fetch/i.test($.message)?Object.assign(new Le("Network Error",Le.ERR_NETWORK,T,W),{cause:$.cause||$}):Le.from($,$&&$.code,T,W)}}},Ed=new Map,$s=a=>{let l=a&&a.env||{};const{fetch:o,Request:i,Response:u}=l,f=[i,u,o];let m=f.length,p=m,w,x,C=Ed;for(;p--;)w=f[p],x=C.get(w),x===void 0&&C.set(w,x=p?new Map:Cd(l)),C=x;return x};$s();const oo={http:Gc,xhr:md,fetch:{get:$s}};te.forEach(oo,(a,l)=>{if(a){try{Object.defineProperty(a,"name",{value:l})}catch{}Object.defineProperty(a,"adapterName",{value:l})}});const js=a=>`- ${a}`,yd=a=>te.isFunction(a)||a===null||a===!1;function bd(a,l){a=te.isArray(a)?a:[a];const{length:o}=a;let i,u;const f={};for(let m=0;m<o;m++){i=a[m];let p;if(u=i,!yd(i)&&(u=oo[(p=String(i)).toLowerCase()],u===void 0))throw new Le(`Unknown adapter '${p}'`);if(u&&(te.isFunction(u)||(u=u.get(l))))break;f[p||"#"+m]=u}if(!u){const m=Object.entries(f).map(([w,x])=>`adapter ${w} `+(x===!1?"is not supported by the environment":"is not available in the build"));let p=o?m.length>1?`since :
4
+ `+m.map(js).join(`
5
+ `):" "+js(m[0]):"as no adapter specified";throw new Le("There is no suitable adapter to dispatch the request "+p,"ERR_NOT_SUPPORT")}return u}const qs={getAdapter:bd,adapters:oo};function so(a){if(a.cancelToken&&a.cancelToken.throwIfRequested(),a.signal&&a.signal.aborted)throw new xr(null,a)}function Zs(a){return so(a),a.headers=Qt.from(a.headers),a.data=io.call(a,a.transformRequest),["post","put","patch"].indexOf(a.method)!==-1&&a.headers.setContentType("application/x-www-form-urlencoded",!1),qs.getAdapter(a.adapter||zr.adapter,a)(a).then(function(i){return so(a),i.data=io.call(a,a.transformResponse,i),i.headers=Qt.from(i.headers),i},function(i){return Ds(i)||(so(a),i&&i.response&&(i.response.data=io.call(a,a.transformResponse,i.response),i.response.headers=Qt.from(i.response.headers))),Promise.reject(i)})}const Ys="1.13.2",pi={};["object","boolean","number","function","string","symbol"].forEach((a,l)=>{pi[a]=function(i){return typeof i===a||"a"+(l<1?"n ":" ")+a}});const Ks={};pi.transitional=function(l,o,i){function u(f,m){return"[Axios v"+Ys+"] Transitional option '"+f+"'"+m+(i?". "+i:"")}return(f,m,p)=>{if(l===!1)throw new Le(u(m," has been removed"+(o?" in "+o:"")),Le.ERR_DEPRECATED);return o&&!Ks[m]&&(Ks[m]=!0,console.warn(u(m," has been deprecated since v"+o+" and will be removed in the near future"))),l?l(f,m,p):!0}},pi.spelling=function(l){return(o,i)=>(console.warn(`${i} is likely a misspelling of ${l}`),!0)};function Ad(a,l,o){if(typeof a!="object")throw new Le("options must be an object",Le.ERR_BAD_OPTION_VALUE);const i=Object.keys(a);let u=i.length;for(;u-- >0;){const f=i[u],m=l[f];if(m){const p=a[f],w=p===void 0||m(p,f,a);if(w!==!0)throw new Le("option "+f+" must be "+w,Le.ERR_BAD_OPTION_VALUE);continue}if(o!==!0)throw new Le("Unknown option "+f,Le.ERR_BAD_OPTION)}}const xi={assertOptions:Ad,validators:pi},In=xi.validators;let tr=class{constructor(l){this.defaults=l||{},this.interceptors={request:new Rs,response:new Rs}}async request(l,o){try{return await this._request(l,o)}catch(i){if(i instanceof Error){let u={};Error.captureStackTrace?Error.captureStackTrace(u):u=new Error;const f=u.stack?u.stack.replace(/^.+\n/,""):"";try{i.stack?f&&!String(i.stack).endsWith(f.replace(/^.+\n.+\n/,""))&&(i.stack+=`
6
+ `+f):i.stack=f}catch{}}throw i}}_request(l,o){typeof l=="string"?(o=o||{},o.url=l):o=l||{},o=er(this.defaults,o);const{transitional:i,paramsSerializer:u,headers:f}=o;i!==void 0&&xi.assertOptions(i,{silentJSONParsing:In.transitional(In.boolean),forcedJSONParsing:In.transitional(In.boolean),clarifyTimeoutError:In.transitional(In.boolean)},!1),u!=null&&(te.isFunction(u)?o.paramsSerializer={serialize:u}:xi.assertOptions(u,{encode:In.function,serialize:In.function},!0)),o.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?o.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:o.allowAbsoluteUrls=!0),xi.assertOptions(o,{baseUrl:In.spelling("baseURL"),withXsrfToken:In.spelling("withXSRFToken")},!0),o.method=(o.method||this.defaults.method||"get").toLowerCase();let m=f&&te.merge(f.common,f[o.method]);f&&te.forEach(["delete","get","head","post","put","patch","common"],T=>{delete f[T]}),o.headers=Qt.concat(m,f);const p=[];let w=!0;this.interceptors.request.forEach(function(v){typeof v.runWhen=="function"&&v.runWhen(o)===!1||(w=w&&v.synchronous,p.unshift(v.fulfilled,v.rejected))});const x=[];this.interceptors.response.forEach(function(v){x.push(v.fulfilled,v.rejected)});let C,y=0,N;if(!w){const T=[Zs.bind(this),void 0];for(T.unshift(...p),T.push(...x),N=T.length,C=Promise.resolve(o);y<N;)C=C.then(T[y++],T[y++]);return C}N=p.length;let O=o;for(;y<N;){const T=p[y++],v=p[y++];try{O=T(O)}catch(D){v.call(this,D);break}}try{C=Zs.call(this,O)}catch(T){return Promise.reject(T)}for(y=0,N=x.length;y<N;)C=C.then(x[y++],x[y++]);return C}getUri(l){l=er(this.defaults,l);const o=Fs(l.baseURL,l.url,l.allowAbsoluteUrls);return ks(o,l.params,l.paramsSerializer)}};te.forEach(["delete","get","head","options"],function(l){tr.prototype[l]=function(o,i){return this.request(er(i||{},{method:l,url:o,data:(i||{}).data}))}}),te.forEach(["post","put","patch"],function(l){function o(i){return function(f,m,p){return this.request(er(p||{},{method:l,headers:i?{"Content-Type":"multipart/form-data"}:{},url:f,data:m}))}}tr.prototype[l]=o(),tr.prototype[l+"Form"]=o(!0)});let Sd=class ll{constructor(l){if(typeof l!="function")throw new TypeError("executor must be a function.");let o;this.promise=new Promise(function(f){o=f});const i=this;this.promise.then(u=>{if(!i._listeners)return;let f=i._listeners.length;for(;f-- >0;)i._listeners[f](u);i._listeners=null}),this.promise.then=u=>{let f;const m=new Promise(p=>{i.subscribe(p),f=p}).then(u);return m.cancel=function(){i.unsubscribe(f)},m},l(function(f,m,p){i.reason||(i.reason=new xr(f,m,p),o(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(l){if(this.reason){l(this.reason);return}this._listeners?this._listeners.push(l):this._listeners=[l]}unsubscribe(l){if(!this._listeners)return;const o=this._listeners.indexOf(l);o!==-1&&this._listeners.splice(o,1)}toAbortSignal(){const l=new AbortController,o=i=>{l.abort(i)};return this.subscribe(o),l.signal.unsubscribe=()=>this.unsubscribe(o),l.signal}static source(){let l;return{token:new ll(function(u){l=u}),cancel:l}}};function Id(a){return function(o){return a.apply(null,o)}}function Nd(a){return te.isObject(a)&&a.isAxiosError===!0}const ao={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(ao).forEach(([a,l])=>{ao[l]=a});function Qs(a){const l=new tr(a),o=ms(tr.prototype.request,l);return te.extend(o,tr.prototype,l,{allOwnKeys:!0}),te.extend(o,l,null,{allOwnKeys:!0}),o.create=function(u){return Qs(er(a,u))},o}const Ze=Qs(zr);Ze.Axios=tr,Ze.CanceledError=xr,Ze.CancelToken=Sd,Ze.isCancel=Ds,Ze.VERSION=Ys,Ze.toFormData=fi,Ze.AxiosError=Le,Ze.Cancel=Ze.CanceledError,Ze.all=function(l){return Promise.all(l)},Ze.spread=Id,Ze.isAxiosError=Nd,Ze.mergeConfig=er,Ze.AxiosHeaders=Qt,Ze.formToJSON=a=>Os(te.isHTMLForm(a)?new FormData(a):a),Ze.getAdapter=qs.getAdapter,Ze.HttpStatusCode=ao,Ze.default=Ze;const{Axios:Yg,AxiosError:Kg,CanceledError:Qg,isCancel:Jg,CancelToken:ep,VERSION:tp,all:np,Cancel:rp,isAxiosError:ip,spread:op,toFormData:sp,AxiosHeaders:ap,HttpStatusCode:lp,formToJSON:cp,getAdapter:dp,mergeConfig:up}=Ze,Gr=we.defineStore("modulesLib",()=>{const a=r.ref(!1),l=r.ref({textNotification:""});return{is_notification_lib:a,notificationData_lib:l,showNotification:i=>{a.value=!0,l.value.textNotification=i}}}),Td=["ping","pong"],kd=["confirmed","waiting_payment","partial_paid"],Rd=["cancelled"],Fn=we.defineStore("table-data",()=>{const a=Te.useRoute(),l=Te.useRouter(),o=st(),i=Gr(),u=r.ref(1),f=r.ref(1),m=yt.useLocalStorage("appMode",null,{shallow:!0}),p=yt.useLocalStorage("tableData",null,{shallow:!0,serializer:yt.StorageSerializers.object}),w=yt.useLocalStorage("tableId",null),x=yt.useLocalStorage("orgID",null),C=r.computed({get:()=>{var P;return(P=D.value)==null?void 0:P.id},set:P=>{w.value=P}}),y=r.computed(()=>{var P;return(P=a.query.table_id)==null?void 0:P.toString()}),N=r.computed(()=>{var P;return x.value||((P=a.params.orgId)==null?void 0:P.toString())}),O=r.computed(()=>{var P;return((P=D.value)==null?void 0:P.branch.work_mode)==="table-service"}),T=r.computed(()=>{var P;return O.value&&!!((P=D.value)!=null&&P.order)});let v=null;const D=yt.computedAsync(async P=>{var Q;u.value;const L=new AbortController;if(P(()=>L.abort()),!N.value)return null;const re=y.value||w.value;if(!re)return null;try{return{...(await Ze.get(`/org_unit/${N.value}/table/${re}/`,{baseURL:`https://${o.config_lib.area}/api/`,signal:L.signal})).data,__v:u.value}}catch(ee){return m.value==="table-tent"?p.value:re===(v==null?void 0:v.id)?v:(v=null,i.showNotification(((Q=ee==null?void 0:ee.response.data)==null?void 0:Q.user_friendly_message)||"Ошибка при загрузке данных стола"),null)}},null),U=yt.computedAsync(async P=>{var re;f.value;const L=new AbortController;if(P(()=>L.abort()),!O.value||!((re=D.value)!=null&&re.order))return null;try{const Q=await Ze.get(`/order/${D.value.order}/`,{baseURL:`https://${o.config_lib.area}/api/`,signal:L.signal});return Q.data.items=Q.data.items.map(ee=>({...ee,idSystem:crypto.randomUUID()})),{...Q.data,__v:f.value}}catch{return null}},null);let M=null;const R=P=>{M&&(M==null||M.close(),M=null),P&&(M=Lr(`wss://${o.config_lib.area}/ws/order/${P.id}/`),M.on("message",L=>{Td.includes(L==null?void 0:L.type)||((L==null?void 0:L.method)==="update_order_status"&&Rd.includes(L.params.status)&&i.showNotification("Ваш заказ был отменён"),H())}),M.connect())},F=()=>{u.value++},H=()=>{f.value++},Z=P=>{P&&(v=P,m.value==="table-tent"&&(p.value=P),w.value!==P.id&&(w.value=P.id))},V=(P,L)=>{var re,Q;if((P==null?void 0:P.id)!==(L==null?void 0:L.id)&&R(P),P&&!kd.includes(P.status)&&F(),!P&&L&&((re=L.table)==null?void 0:re.id)===((Q=D.value)==null?void 0:Q.id))return l.replace({name:"order-ts-status",params:{id:L.id}})};return r.watch(U,V,{immediate:!0}),r.watch(D,Z,{immediate:!0}),{id:C,isTableService:O,hasOrder:T,data:D,order:U,refresh:F,refreshOrder:H}});let Nn=null,jt=null;function nr(a){a&&a.close(!0)}async function lo(a,l){const o=Mt(),i=st(),u=yn.create();try{const f=await u.initPaymentLink(a,l);return o.paymentCostQR=i.totalPrice_lib-i.countBonus,o.linkQR=f.url,jt==null||jt.deleteCart(null,jt==null?void 0:jt.is_requestKiosk),f}catch(f){throw o.isButtonDisabled=!1,o.showNotification(f==null?void 0:f.response.data.user_friendly_message),f}}function Bd(a,l,o){const i=Rt();if(a!=null&&a.params){if(a.params.status==="sent"&&i.itemThemes.kiosk_proceed_to_payment_text&&l.showNotification(i.itemThemes.kiosk_proceed_to_payment_text),a.error){l.showNotification(a.error),hn(l,null),uo(l);return}o(a,l)}}function co(a,l){const o=Mt(),i=st();return a.params.new_discounts&&(o.extraDiscount=Number(a.params.new_total_cost)-l.initialCartPrice,i.totalPrice_lib=Number(a.params.new_total_cost),l.showNotification("К заказу были добавлены скидки")),!0}const hn=(a,l)=>{a.updateOrderStatus&&a.updateOrderStatus(l)},Od=a=>{a.loadCart&&a.loadCart()},wi=a=>{a.resetBonuses&&a.resetBonuses()},Md=a=>{a.resetDiscounts&&a.resetDiscounts()},uo=a=>{a.closeWebSocket&&a.closeWebSocket()},Js=(a,l,o,i)=>{var m;if(((m=a.params)==null?void 0:m.need_pay)===!1)return;const u=l.ws||o;yn.create().orderPay(a.params.order_id||"").then(p=>{l.setOrderNumber&&l.setOrderNumber(p.data.order_number)}).catch(p=>{(l.errorHandler||i).handleOrderPayError(p,{...l,closeWebSocket:()=>nr(u)})})},fo=(a,l,o)=>{const i=a.ws||l;(a.errorHandler||o).handleOrderError({...a,closeWebSocket:()=>nr(i)})},Dd=(a,l)=>{const o=Mt(),i=o.getCurrentPaymentMethodId();if(!i||!Vn.getConfig(i)||!Vn.isMethodAvailable(i,a))return null;const f=Vn.createHandler(i);if(!f)return null;const m=o.createPaymentHandler(a,l,i);return m?{handler:f,config:m.config}:null},vd=a=>{if(!jt)return;const l=jt.context,o=jt.is_requestKiosk,i=Dd(l,o);if(!i){console.warn("handleWebSocketMessageWithDynamicHandler: не удалось получить handler");return}const{handler:u,config:f}=i,m={...f,...jt};Bd(a,m,u.handleWebSocketStatus)};async function Pd(a,l,o){var x,C;const i=Fn(),{is_requestKiosk:u}=l,{comment:f,is_authorized:m,signal:p}=o;l.setButtonDisabled(!0);const w=yn.create();try{const y=await w.createOrder(a,i.id,u,f,m,p);if((y==null?void 0:y.status)===201&&((x=y==null?void 0:y.data)!=null&&x.id)){const N=y.data.id,O={...l,signal:p};jt=O;const v=`wss://${O.area||""}/ws/order/${N}/`;Nn=Lr(v,{signal:p});const D=()=>{console.warn("WebSocket connection opened (centralized mode)")},U=R=>{var F;console.error("WebSocket error (centralized mode):",R),nr(Nn),Nn=null,jt=null,l.setButtonDisabled(!1),(F=l.errorHandler)==null||F.handlePaymentError(R,O)},M=R=>{vd(R)};Nn.on("open",D),Nn.on("message",M),Nn.on("error",U),Nn.connect(),jt.ws=Nn,jt.closeWebSocket=()=>{nr(Nn),Nn=null,jt=null}}return y}catch(y){throw Ze.isCancel(y)||((C=l.errorHandler)==null||C.handleCreateOrderError(y,l),l.setButtonDisabled(!1)),y}}const ea=a=>{var l,o;return((o=(l=a==null?void 0:a.response)==null?void 0:l.data)==null?void 0:o.user_friendly_message)||null};function _i(){const a=Mt(),l=Fn();return{handlePaymentError(o,i){var f,m,p,w,x,C;const u=ea(o);hn(i,null),Od(i),u?(i.showNotification(u),uo(i),i.is_requestKiosk&&((m=i.orderErrors)!=null&&m.includes((f=o.response)==null?void 0:f.status))&&(i.cartCleanup?i.cartCleanup.cleanupAndNavigate("retryPage",i.is_requestKiosk):i.deleteCart("retryPage",i.is_requestKiosk),i.ws.close(!0)),l.isTableService?i.resetStores():(wi(i),i.context==="qr"&&i.navigation?i.navigation.redirectToError():i.context==="qr"&&i.redirect&&(a.isButtonDisabled=!1,i.redirect(`/${((w=(p=i.route)==null?void 0:p.params)==null?void 0:w.orgId)||""}/errorPayment`)))):i.context==="qr"&&(wi(i),i.navigation?i.navigation.redirectToError():i.redirect&&i.redirect(`/${((C=(x=i.route)==null?void 0:x.params)==null?void 0:C.orgId)||""}/errorPayment`)),a.isButtonDisabled=!1},handleOrderPayError(o,i){var f,m,p,w;const u=ea(o);u&&(i.showNotification(u),uo(i),i.is_requestKiosk?((m=i.orderErrors)!=null&&m.includes((f=o.response)==null?void 0:f.status)&&(i.cartCleanup.cleanupAndNavigate("retryPage",i.is_requestKiosk),i.deleteCart("retryPage",i.is_requestKiosk)),hn(i,null)):(wi(i),i.navigation?i.navigation.redirectToError():i.redirect&&i.redirect(`/${((w=(p=i.route)==null?void 0:p.params)==null?void 0:w.orgId)||""}/errorPayment`),hn(i,null)))},handleOrderError(o){var i,u;o.is_requestKiosk?(o.cartCleanup?o.cartCleanup.cleanupAndNavigate("retryPage",o.is_requestKiosk):o.deleteCart("retryPage",o.is_requestKiosk),o.ws.close(!0)):l.isTableService?(a.isCreateButtonVisible=!0,o.showNotification("Ошибка создания заказа. Пожалуйста, попробуйте еще раз"),Md(o)):(wi(o),o.navigation?o.navigation.redirectToError():o.redirect&&(a.isButtonDisabled=!1,o.redirect(`/${((u=(i=o.route)==null?void 0:i.params)==null?void 0:u.orgId)||""}/errorPayment`)))},handleCreateOrderError(o,i){var m,p,w,x,C,y;const{is_requestKiosk:u}=i,f=i.route.params.orgId;u?(((m=o==null?void 0:o.response)==null?void 0:m.status)===403&&((p=i.on403Kiosk)==null||p.call(i),(w=i.redirect)==null||w.call(i,`/${f}/retryPage`)),i.deleteCart("retryPage",u)):l.isTableService?i.showNotification(((C=(x=o==null?void 0:o.response)==null?void 0:x.data)==null?void 0:C.user_friendly_message)||"Ошибка создания заказа"):(y=i.redirect)==null||y.call(i,`/${f}/errorPayment`)}}}const Ld=()=>{const a=Mt();let l=null;const o=_i(),i=(u,f)=>{var p,w,x,C;const m=(p=u.params)==null?void 0:p.status;if((w=u.params)!=null&&w.number&&(a.orderNumber=(x=u.params)==null?void 0:x.number),m==="sent")co(u,f),a.isButtonDisabled=!1;else if(m==="waiting_for_fiscalization")hn(f,1);else if(m==="payment_initiation_retry"||m==="fiscalized")Js(u,f,l,o);else if(m==="payment_initiation")hn(f,2);else if(m==="paid"){hn(f,3);const y=f.ws||l;nr(y),localStorage.removeItem("cart")}else(C=f.orderErrors)!=null&&C.includes(m)&&fo(f,l,o)};return{handleWebSocketStatus(u,f){i(u,f)}}};function Fd(){const a=Mt();let l=null;const o=_i(),i=(u,f)=>{var p,w,x,C;const m=(p=u.params)==null?void 0:p.status;if((w=u.params)!=null&&w.number&&(a.orderNumber=(x=u.params)==null?void 0:x.number),m==="sent")co(u,f),a.isButtonDisabled=!1;else if(m==="sent_fiscalization")hn(f,1);else if(m==="waiting_payment")hn(f,4);else if(m==="paid"){hn(f,3);const y=f.ws||l;nr(y),localStorage.removeItem("cart")}else(C=f.orderErrors)!=null&&C.includes(m)&&(a.isButtonDisabled=!1,fo(f,l,o))};return{handleWebSocketStatus(u,f){i(u,f)}}}const Vd=()=>{const a=Mt();let l=null;const o=_i(),i=(u,f)=>{var p,w;const m=(p=u.params)==null?void 0:p.status;if(m==="sent")co(u,f),a.isButtonDisabled=!1;else if(m==="payment_initiation_retry"||m==="fiscalized")Js(u,f,l,o);else if(m==="payment_initiation")hn(f,2);else if(m==="paid"){hn(f,3);const x=f.ws||l;nr(x),localStorage.removeItem("cart")}else(w=f.orderErrors)!=null&&w.includes(m)&&(a.isButtonDisabled=!1,fo(f,l,o))};return{handleWebSocketStatus(u,f){i(u,f)}}};class Vn{static initialize(){this.register({id:"TERMINAL_BASE",method:"TERMINAL",handlerFactory:Ld,availableContexts:["kiosk"]}),this.register({id:"YOOKASSA_BASE",method:"YOOKASSA",handlerFactory:Vd,availableContexts:["qr","tableservice"]}),this.register({id:"SBP",method:"YOOKASSA",handlerFactory:Fd,availableContexts:["kiosk"]})}static register(l){this.methods.set(l.id,l)}static getConfig(l){return this.methods.get(l)??null}static getAvailableMethods(l){return Array.from(this.methods.entries()).filter(([o,i])=>i.availableContexts.includes(l)).map(([o])=>o)}static isMethodAvailable(l,o){const i=this.getConfig(l);return i?i.availableContexts.includes(o):!1}static createHandler(l){const o=this.getConfig(l);return o?o.handlerFactory():(console.warn(`PaymentMethodRegistry: метод оплаты ${l} не зарегистрирован`),null)}}Re(Vn,"methods",new Map),Vn.initialize();function Ud(a){return{cleanupAndNavigate(l,o){a.deleteCart(l,o)},cleanup(l){a.deleteCart(null,l)},clearTokens(){a.deleteCart(null,!0)},resetStores(){a.resetStores()}}}function zd(a){var o,i;const l=((i=(o=a.route)==null?void 0:o.params)==null?void 0:i.orgId)||"";return{redirectToError(){const u=`/${l}/errorPayment`;a.redirect?a.redirect(u):a.router&&a.router.push(u)},redirectToSuccess(u){const f=u?`/${l}/${u}`:`/${l}/profile`;a.redirect?a.redirect(f):a.router&&a.router.push(f)},redirect(u){a.redirect?a.redirect(u):a.router&&a.router.push(u)},getErrorPath(){return`/${l}/errorPayment`},getSuccessPath(){return`/${l}/profile`}}}const Mt=we.defineStore("cartLib",()=>{const a=Te.useRouter(),l=Te.useRoute(),o=Rt(),i=st(),{config_lib:u,countBonus:f,totalPrice_lib:m,initialCartPrice_lib:p,is18Allowed:w}=we.storeToRefs(i),{itemThemes:x}=we.storeToRefs(o),C=r.ref(!1),y=r.ref(""),N=r.ref(null),O=r.ref("wait"),T=r.ref(!0),v=r.ref(0),D=r.ref(""),U=r.ref([]),M=r.ref([]),R=r.ref(),F=r.ref(0),H=r.ref(!1),Z=r.ref(),V=r.ref(null),P=r.ref(["failed_payment","failed_after_paid","failed","failed_after_sent","failed_after_sent_fiscalization","payment_initiation_retry","cancelled","failed_after_payment_initiation"]),L=r.ref(),re=r.computed({get:()=>U.value||[],set:be=>{(be==null?void 0:be.length)===1&&(L.value=be[0]),U.value=be}}),Q=r.ref(!1),ee=r.ref(null),W=r.ref(0),X=r.ref(!1),I=r.ref({textNotification:""}),$=be=>{X.value=!0,I.value.textNotification=be},j=()=>{var be,et;return(be=R.value)!=null&&be.front_type?R.value.front_type:((et=M.value[0])==null?void 0:et.front_type)||null},q=(be,et,rt)=>{var Ie;const Ve=rt??((Ie=M.value[0])==null?void 0:Ie.front_type);if(!Ve)return console.warn("Не удалось определить метод оплаты"),null;const it=Vn.getConfig(Ve);if(!it||!Vn.isMethodAvailable(Ve,be))return console.warn(`Метод ${Ve} недоступен для контекста ${be}`),null;const Me=Vn.createHandler(Ve);return Me?(Z.value=K(it.method,be,et),{handler:Me,config:Z.value}):(console.warn(`Не удалось создать обработчик для метода ${Ve}`),null)},K=(be,et,rt)=>{const Ve={method:be,context:et,is_requestKiosk:rt,router:a,route:l,orderErrors:P.value,area:u.value.area,totalPrice:m,initialCartPrice:p,showNotification:$,deleteCart:_t,resetStores:xe,redirect:Ue=>a.push(Ue),updateOrderStatus:Ue=>{ee.value=Ue},setOrderNumber:Ue=>{V.value=Ue},loadCart:()=>i.loadCart(),resetBonuses:()=>{f.value=0}},it=_i(),Me=Ud(Ve),Ie=zd(Ve);return{...Ve,errorHandler:it,cartCleanup:Me,navigation:Ie}},oe=r.computed(()=>!!N.value),de=be=>{O.value=be},ce=be=>{N.value=be},Ce=()=>{x.value.kiosk_show_loyalty_card_button&&x.value.kiosk_show_loyalty_phone_input_button?C.value=!0:!x.value.kiosk_show_loyalty_card_button&&x.value.kiosk_show_loyalty_phone_input_button?i.is_OpenLoyal=!0:C.value=!0,O.value="wait",y.value=""},ge=()=>{C.value=!1,O.value="wait",y.value=""},De=()=>{N.value=null,y.value="",O.value="wait",ge()},xe=()=>{Q.value=!1,ee.value=null},_t=(be=null,et=!1)=>{i.cartProducts_lib=[],i.is_OpenLoyal=!1,mr(["cart"]),et&&(mr(["authTokensAccess","authTokensRefresh","user"]),i.profile=null,sessionStorage.removeItem("is_adult"),w.value=!1),be&&a.push(`/${l.params.orgId}/${be}`)};return{isButtonDisabled:Q,orderCompleted_lib:ee,extraDiscount:v,orderNumber:V,is_notification_lib:X,notificationData_lib:I,count:W,guestInfo:N,error:y,isDrawerOpen:C,currentState:O,isAuthorized:oe,isCreateButtonVisible:T,linkQR:D,orderTypes:re,providerTypes:M,is_paymentCart:H,selectedOrderType:L,selectedProvider:R,configPayment:Z,paymentCostQR:F,deleteCart:_t,setGuestInfo:ce,setState:de,openDrawer:Ce,closeDrawer:ge,clearCard:De,showNotification:$,createPaymentHandler:q,getCurrentPaymentMethodId:j,getAvailablePaymentMethods:be=>Vn.getAvailableMethods(be)}}),Lt=we.defineStore("cardLib",()=>{var ee;const a=()=>({openCard:null,currentModifier:null,groupModifiers:[],groupModifiersSelected:[],groupCurrentOpen:null,isModifiedAmount:!1,selectedSize:{},productSizes:[],addedProducts:[],plusButtonsRefs:[],modalCount:1,isSectionModifier:!1,isAnimationFly:!0,textErrorRequaired:"",prevLast:{}}),l=Rt(),o=r.ref(a()),i=()=>o.value=a(),u=r.ref(!1),f=r.ref(!1),m=r.ref(!1),p=r.ref(),w=r.ref([]),x=r.ref({id:null,visible:!1}),C=r.ref(!((ee=l.itemThemes)!=null&&ee.kiosk_disable_lock_screen)),y=r.computed(()=>{const W=o.value.groupModifiersSelected.findIndex(X=>X.group===o.value.groupCurrentOpen.id);return N(W)}),N=W=>W===-1?0:(o.value.groupModifiersSelected[W].modifiers||[]).reduce((I,$)=>I+($.amount||0),0),O=r.computed(()=>{var X;const W=(X=o.value.openCard)==null?void 0:X.group_modifiers.findIndex(I=>I.id===o.value.groupCurrentOpen.id);return W===-1||!o.value.openCard?0:o.value.openCard.modifiers.length>0&&W===0?o.value.openCard.modifiers.reduce((I,$)=>I+$.max_amount,0):o.value.groupModifiers[W].max_amount}),T=r.computed(()=>{var X;const W=(o.value.addedProducts??[]).reduce((I,$)=>I+$.price,0);if(o.value.openCard){const I=o.value.openCard,$=hr(I)||0,j=I.amount||1;return(o.value.groupModifiersSelected.reduce((K,oe)=>(oe.modifiers.forEach(de=>{var ce,Ce;de.sizes&&(de.price=((Ce=(ce=de.sizes)==null?void 0:ce.find(ge=>ge.id===o.value.selectedSize.id))==null?void 0:Ce.price)??de.price),K+=de.price*de.amount}),K),0)+$)*j+W}return(X=o.value.addedProducts)!=null&&X.length?W:0}),v=r.computed(()=>{const W=o.value.groupCurrentOpen;if(!W)return!1;const X=o.value.groupModifiers,I=X.findIndex($=>$.id===W.id);return I===-1?!1:I===X.length-1}),D=W=>{const X=o.value.groupModifiers[W],I=o.value.groupModifiersSelected[W];if(!X)return{valid:!1};if(X.min_amount>0&&N(W)<X.min_amount)return{valid:!1,errorText:`В группе "${X.name}" должно содержаться не меньше ${X.min_amount} модификатора(ов)`};if(I){for(const $ of X.group_modifiers)if($.min_amount>0){const j=I.modifiers.find(q=>q.id===$.id);if(!j||j.amount<$.min_amount)return{valid:!1,errorText:`В группе "${X.name}" выберите все обязательные модификаторы`}}}return{valid:!0}},U=r.computed(()=>{const W=o.value.groupModifiers;for(let X=0;X<W.length;X++){const I=D(X);if(!I.valid)return o.value.textErrorRequaired=I.errorText,{haveRequaire:!0,group:W[X]}}return{haveRequaire:!1,group:W[0]}}),M=()=>{o.value.groupModifiers.forEach((W,X)=>{o.value.groupCurrentOpen={...W,index:X},W.group_modifiers.forEach(I=>{I.default_amount>0&&(I.amount=I.default_amount,re(I,!0))})})},R=W=>{o.value.addedProducts.push(W)},F=W=>{o.value.openCard=W},H=W=>{w.value=[...W]},Z=(W,X,I)=>{var j;const $=o.value.groupModifiers.findIndex(q=>q.id===W.id);if($!==-1)if(I){const q=o.value.groupModifiers,K=$+1;if(K<q.length){const oe=q[K];o.value.groupCurrentOpen={...oe,index:K},o.value.isSectionModifier=!0}}else{const q=W.id!==((j=o.value.groupCurrentOpen)==null?void 0:j.id);o.value.groupCurrentOpen={...W,index:$},o.value.isSectionModifier=q?!0:!o.value.isSectionModifier}},V=()=>{o.value.modalCount>o.value.currentModifier.min_amount&&o.value.modalCount>=2&&(o.value.modalCount-=1)},P=()=>{o.value.groupCurrentOpen&&o.value.modalCount+y.value<O.value&&(o.value.currentModifier.max_amount===0||o.value.currentModifier.max_amount>o.value.modalCount)&&(o.value.modalCount+=1)},L=(W,X)=>{var $;const I=($=o.value.groupCurrentOpen)==null?void 0:$.id.toUpperCase();if(!W&&!o.value.isModifiedAmount&&X.max_amount!==1){if(I==="Добавки2000"&&X.max_amount>1)return!0;if(Math.abs(O.value-y.value)>1&&I!=="Добавки2000")return!0}return!1},re=(W,X=!1)=>{o.value.modalCount=1,o.value.currentModifier=W;const I=o.value.groupModifiersSelected.findIndex($=>$.group===o.value.groupCurrentOpen.id);Q(I,W,X)},Q=(W,X,I)=>{var j,q,K;let $=o.value.groupModifiersSelected;if(W===-1)L(I,X)?o.value.isModifiedAmount=!0:$[o.value.groupCurrentOpen.index]={group:o.value.groupCurrentOpen.id,is_fake:((j=o.value.groupCurrentOpen)==null?void 0:j.is_fake)||!1,is_product_determining:((q=o.value.groupCurrentOpen)==null?void 0:q.is_product_determining)||!1,modifier_count:((K=o.value.currentModifier)==null?void 0:K.amount)||0,modifiers:[{...X,amount:(X==null?void 0:X.amount)??1}]};else{const oe=o.value.groupModifiers[W].group_modifiers.findIndex(ce=>ce.id===X.id);if($[W].modifiers.findIndex(ce=>ce.id===X.id)===-1){if(O.value===1)$[W].modifiers=[];else if(y.value>=O.value)return;L(I,X)?o.value.isModifiedAmount=!0:($[W].modifiers.push({...X,amount:(X==null?void 0:X.amount)??1}),$[W].modifier_count=$[W].modifiers.reduce((ce,Ce)=>ce+=Ce.amount,0),o.value.isAnimationFly=!0)}else $[W].modifiers=$[W].modifiers.filter(ce=>ce.id!==X.id),$[W].modifier_count=$[W].modifiers.reduce((ce,Ce)=>ce+=Ce.amount,0),o.value.groupModifiers[W].group_modifiers[oe].amount=1,o.value.groupModifiers[W].group_modifiers[oe].default_amount=0,o.value.isAnimationFly=!1}o.value.groupModifiersSelected=$};return{stateCard:o,totalPrice_libCard:T,recountGroupTotalAmount:y,groupTotalAmount:O,isOpenWindow:u,isUpSale:f,checkedRequiredBtn:U,dataUpSale:p,productCards:w,isAddToCard:m,openProduct:x,is_startPage:C,isLastGroup:v,setProduct:H,summModifierAmount:N,setAddedProducts:R,setCurrentCard:F,minusAmount:V,plusAmount:P,toggleNotRequire:Z,modifierSelect:re,defaultAmountModifiers:M,validateGroup:D,reset:i}});var wr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ta(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var na={exports:{}};(function(a,l){(function(o,i){a.exports=i()})(wr,function(){var o=1e3,i=6e4,u=36e5,f="millisecond",m="second",p="minute",w="hour",x="day",C="week",y="month",N="quarter",O="year",T="date",v="Invalid Date",D=/^(\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,M={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 I=["th","st","nd","rd"],$=X%100;return"["+X+(I[($-20)%10]||I[$]||I[0])+"]"}},R=function(X,I,$){var j=String(X);return!j||j.length>=I?X:""+Array(I+1-j.length).join($)+X},F={s:R,z:function(X){var I=-X.utcOffset(),$=Math.abs(I),j=Math.floor($/60),q=$%60;return(I<=0?"+":"-")+R(j,2,"0")+":"+R(q,2,"0")},m:function X(I,$){if(I.date()<$.date())return-X($,I);var j=12*($.year()-I.year())+($.month()-I.month()),q=I.clone().add(j,y),K=$-q<0,oe=I.clone().add(j+(K?-1:1),y);return+(-(j+($-q)/(K?q-oe:oe-q))||0)},a:function(X){return X<0?Math.ceil(X)||0:Math.floor(X)},p:function(X){return{M:y,y:O,w:C,d:x,D:T,h:w,m:p,s:m,ms:f,Q:N}[X]||String(X||"").toLowerCase().replace(/s$/,"")},u:function(X){return X===void 0}},H="en",Z={};Z[H]=M;var V="$isDayjsObject",P=function(X){return X instanceof ee||!(!X||!X[V])},L=function X(I,$,j){var q;if(!I)return H;if(typeof I=="string"){var K=I.toLowerCase();Z[K]&&(q=K),$&&(Z[K]=$,q=K);var oe=I.split("-");if(!q&&oe.length>1)return X(oe[0])}else{var de=I.name;Z[de]=I,q=de}return!j&&q&&(H=q),q||!j&&H},re=function(X,I){if(P(X))return X.clone();var $=typeof I=="object"?I:{};return $.date=X,$.args=arguments,new ee($)},Q=F;Q.l=L,Q.i=P,Q.w=function(X,I){return re(X,{locale:I.$L,utc:I.$u,x:I.$x,$offset:I.$offset})};var ee=function(){function X($){this.$L=L($.locale,null,!0),this.parse($),this.$x=this.$x||$.x||{},this[V]=!0}var I=X.prototype;return I.parse=function($){this.$d=function(j){var q=j.date,K=j.utc;if(q===null)return new Date(NaN);if(Q.u(q))return new Date;if(q instanceof Date)return new Date(q);if(typeof q=="string"&&!/Z$/i.test(q)){var oe=q.match(D);if(oe){var de=oe[2]-1||0,ce=(oe[7]||"0").substring(0,3);return K?new Date(Date.UTC(oe[1],de,oe[3]||1,oe[4]||0,oe[5]||0,oe[6]||0,ce)):new Date(oe[1],de,oe[3]||1,oe[4]||0,oe[5]||0,oe[6]||0,ce)}}return new Date(q)}($),this.init()},I.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()},I.$utils=function(){return Q},I.isValid=function(){return this.$d.toString()!==v},I.isSame=function($,j){var q=re($);return this.startOf(j)<=q&&q<=this.endOf(j)},I.isAfter=function($,j){return re($)<this.startOf(j)},I.isBefore=function($,j){return this.endOf(j)<re($)},I.$g=function($,j,q){return Q.u($)?this[j]:this.set(q,$)},I.unix=function(){return Math.floor(this.valueOf()/1e3)},I.valueOf=function(){return this.$d.getTime()},I.startOf=function($,j){var q=this,K=!!Q.u(j)||j,oe=Q.p($),de=function(et,rt){var Ve=Q.w(q.$u?Date.UTC(q.$y,rt,et):new Date(q.$y,rt,et),q);return K?Ve:Ve.endOf(x)},ce=function(et,rt){return Q.w(q.toDate()[et].apply(q.toDate("s"),(K?[0,0,0,0]:[23,59,59,999]).slice(rt)),q)},Ce=this.$W,ge=this.$M,De=this.$D,xe="set"+(this.$u?"UTC":"");switch(oe){case O:return K?de(1,0):de(31,11);case y:return K?de(1,ge):de(0,ge+1);case C:var _t=this.$locale().weekStart||0,be=(Ce<_t?Ce+7:Ce)-_t;return de(K?De-be:De+(6-be),ge);case x:case T:return ce(xe+"Hours",0);case w:return ce(xe+"Minutes",1);case p:return ce(xe+"Seconds",2);case m:return ce(xe+"Milliseconds",3);default:return this.clone()}},I.endOf=function($){return this.startOf($,!1)},I.$set=function($,j){var q,K=Q.p($),oe="set"+(this.$u?"UTC":""),de=(q={},q[x]=oe+"Date",q[T]=oe+"Date",q[y]=oe+"Month",q[O]=oe+"FullYear",q[w]=oe+"Hours",q[p]=oe+"Minutes",q[m]=oe+"Seconds",q[f]=oe+"Milliseconds",q)[K],ce=K===x?this.$D+(j-this.$W):j;if(K===y||K===O){var Ce=this.clone().set(T,1);Ce.$d[de](ce),Ce.init(),this.$d=Ce.set(T,Math.min(this.$D,Ce.daysInMonth())).$d}else de&&this.$d[de](ce);return this.init(),this},I.set=function($,j){return this.clone().$set($,j)},I.get=function($){return this[Q.p($)]()},I.add=function($,j){var q,K=this;$=Number($);var oe=Q.p(j),de=function(ge){var De=re(K);return Q.w(De.date(De.date()+Math.round(ge*$)),K)};if(oe===y)return this.set(y,this.$M+$);if(oe===O)return this.set(O,this.$y+$);if(oe===x)return de(1);if(oe===C)return de(7);var ce=(q={},q[p]=i,q[w]=u,q[m]=o,q)[oe]||1,Ce=this.$d.getTime()+$*ce;return Q.w(Ce,this)},I.subtract=function($,j){return this.add(-1*$,j)},I.format=function($){var j=this,q=this.$locale();if(!this.isValid())return q.invalidDate||v;var K=$||"YYYY-MM-DDTHH:mm:ssZ",oe=Q.z(this),de=this.$H,ce=this.$m,Ce=this.$M,ge=q.weekdays,De=q.months,xe=q.meridiem,_t=function(rt,Ve,it,Me){return rt&&(rt[Ve]||rt(j,K))||it[Ve].slice(0,Me)},be=function(rt){return Q.s(de%12||12,rt,"0")},et=xe||function(rt,Ve,it){var Me=rt<12?"AM":"PM";return it?Me.toLowerCase():Me};return K.replace(U,function(rt,Ve){return Ve||function(it){switch(it){case"YY":return String(j.$y).slice(-2);case"YYYY":return Q.s(j.$y,4,"0");case"M":return Ce+1;case"MM":return Q.s(Ce+1,2,"0");case"MMM":return _t(q.monthsShort,Ce,De,3);case"MMMM":return _t(De,Ce);case"D":return j.$D;case"DD":return Q.s(j.$D,2,"0");case"d":return String(j.$W);case"dd":return _t(q.weekdaysMin,j.$W,ge,2);case"ddd":return _t(q.weekdaysShort,j.$W,ge,3);case"dddd":return ge[j.$W];case"H":return String(de);case"HH":return Q.s(de,2,"0");case"h":return be(1);case"hh":return be(2);case"a":return et(de,ce,!0);case"A":return et(de,ce,!1);case"m":return String(ce);case"mm":return Q.s(ce,2,"0");case"s":return String(j.$s);case"ss":return Q.s(j.$s,2,"0");case"SSS":return Q.s(j.$ms,3,"0");case"Z":return oe}return null}(rt)||oe.replace(":","")})},I.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},I.diff=function($,j,q){var K,oe=this,de=Q.p(j),ce=re($),Ce=(ce.utcOffset()-this.utcOffset())*i,ge=this-ce,De=function(){return Q.m(oe,ce)};switch(de){case O:K=De()/12;break;case y:K=De();break;case N:K=De()/3;break;case C:K=(ge-Ce)/6048e5;break;case x:K=(ge-Ce)/864e5;break;case w:K=ge/u;break;case p:K=ge/i;break;case m:K=ge/o;break;default:K=ge}return q?K:Q.a(K)},I.daysInMonth=function(){return this.endOf(y).$D},I.$locale=function(){return Z[this.$L]},I.locale=function($,j){if(!$)return this.$L;var q=this.clone(),K=L($,j,!0);return K&&(q.$L=K),q},I.clone=function(){return Q.w(this.$d,this)},I.toDate=function(){return new Date(this.valueOf())},I.toJSON=function(){return this.isValid()?this.toISOString():null},I.toISOString=function(){return this.$d.toISOString()},I.toString=function(){return this.$d.toUTCString()},X}(),W=ee.prototype;return re.prototype=W,[["$ms",f],["$s",m],["$m",p],["$H",w],["$W",x],["$M",y],["$y",O],["$D",T]].forEach(function(X){W[X[1]]=function(I){return this.$g(I,X[0],X[1])}}),re.extend=function(X,I){return X.$i||(X(I,ee,re),X.$i=!0),re},re.locale=L,re.isDayjs=P,re.unix=function(X){return re(1e3*X)},re.en=Z[H],re.Ls=Z,re.p={},re})})(na);var Hd=na.exports;const ra=ta(Hd),Gd=a=>{const l=Te.useRouter(),o=`${a.domain}/api/`,i=Ze.create({baseURL:o}),u=Ze.create({baseURL:o}),f=Ze.create({baseURL:o}),m=Ze.create({baseURL:o}),p=Ze.create({baseURL:o}),w=Ze.create({baseURL:o}),x=Ze.create({baseURL:o}),C=M=>{try{const R=JSON.parse(localStorage.getItem("authTokensAccess")||"");R.length>0&&(M.headers.Authorization=`Bearer ${R}`)}catch{console.warn("accessToken is undefined [useAxios]")}return M},y=M=>{const R=localStorage.getItem("apiKey");return M.headers={"Content-Type":"application/json","x-api-key":R},M},N=async M=>{if(!a.user)return M;const R=a.user.exp??0;if(!(ra.unix(R).diff(ra())<3e3))return M;const H=hs("authTokensRefresh",null,"string");try{const Z=await Ze.post(`${o}user/token/refresh/`,{refresh:H.value});if(!Z.data.access)return U(),M;localStorage.setItem("authTokensAccess",JSON.stringify(Z.data.access)),v(Z.data),D(fs(Z.data.access)),M.headers={...M.headers,Authorization:`Bearer ${Z.data.access}`}}catch(Z){console.error("Failed to refresh token:",Z),U()}return M},O=M=>{M.interceptors.request.use(R=>N(C(R)),R=>Promise.reject(R))};O(f),O(p),O(x);const T=M=>{M.interceptors.request.use(R=>y(R))};T(w),T(u),T(x);const v=(M,R=!1)=>{localStorage.setItem("authTokensAccess",JSON.stringify(M.access)),R&&localStorage.setItem("authTokensRefresh",JSON.stringify(M.refresh))},D=M=>{a.user=M,localStorage.setItem("user",JSON.stringify(M))},U=()=>{a.user=null,mr(["authTokensAccess","authTokensRefresh","user","cart","bonus"]),sessionStorage.removeItem("is_adult"),l.replace({name:"home"}).then(()=>window.location.reload())};return{axiosInstanceAuthenticationGet:f,axiosInstanceAuthenticationPost:p,axiosInstanceAuthenticationPostApiKey:x,axiosInstancePost:m,axiosInstanceGet:i,axiosInstanceGetApiKey:u,axiosInstancePostApiKey:w}},ia=(a="themeConfig")=>{try{const l=localStorage.getItem(a);return l?JSON.parse(l):null}catch{return null}},Ge=class Ge{constructor(){Re(this,"axiosInstanceGet");Re(this,"axiosInstancePost");Re(this,"axiosInstanceAuthenticationGet");Re(this,"axiosInstanceAuthenticationPost");Re(this,"axiosInstanceGetApiKey");Re(this,"axiosInstancePostApiKey");Re(this,"axiosInstanceAuthenticationPostApiKey");Re(this,"currentUpsaleController",null);Re(this,"controller",new AbortController);this.axiosInstanceGet=Ge._axiosGet,this.axiosInstancePost=Ge._axiosPost,this.axiosInstanceGetApiKey=Ge._axiosPostApiKey,this.axiosInstancePostApiKey=Ge._axiosPostApiKey,this.axiosInstanceAuthenticationPostApiKey=Ge._axiosAuthPostApiKey,this.axiosInstanceAuthenticationGet=Ge._axiosAuthGet,this.axiosInstanceAuthenticationPost=Ge._axiosAuthPost}static create(l){return l&&!Ge._config&&Ge._initialize(l),Ge._config||console.warn("InitConnection не инициализирован"),new Ge}static _initialize(l,o=null){const i=st(),u=Lt(),{config_lib:f}=we.storeToRefs(i),{stateCard:m,recountGroupTotalAmount:p}=we.storeToRefs(u);Ge._config=l,Ge._cardStore=u,Ge._stateCard=m,Ge._recountGroupTotalAmount=p,f.value=l;const w=Gd(l);Ge._axiosPostApiKey=w.axiosInstanceGetApiKey,Ge._axiosPostApiKey=w.axiosInstancePostApiKey,Ge._axiosAuthPostApiKey=w.axiosInstanceAuthenticationPostApiKey,Ge._axiosGet=w.axiosInstanceGet,Ge._axiosPost=w.axiosInstancePost,Ge._axiosAuthGet=w.axiosInstanceAuthenticationGet,Ge._axiosAuthPost=w.axiosInstanceAuthenticationPost}get config(){return Ge._config}get cardStore(){return Ge._cardStore}get stateCard(){return Ge._stateCard}get recountGroupTotalAmount(){return Ge._recountGroupTotalAmount}async updateTheme(){var f,m;const l=ia(),o=Rt();if(l!==null){o.updateColor(l);return}const i=st(),u=await((m=this.axiosInstanceGet)==null?void 0:m.get(`org/organizations/${(f=this.config)==null?void 0:f.orgId}/design/`));i.setStateDrum(u==null?void 0:u.data.hide_barban),i.setKioskTimeout(u==null?void 0:u.data.kiosk_timeout),localStorage.setItem("themeConfig",JSON.stringify(u.data)),o.updateColor(u.data)}async getGroupByID(l){var o,i;try{const u=await((i=this.axiosInstanceGet)==null?void 0:i.get(`${(o=this.config)==null?void 0:o.pointId}/group/${l}`));return u==null?void 0:u.data}catch(u){throw console.error("Ошибка в request.ts[getGroupByID]",u),u}}async loadGroupProducts(l){var o,i;try{const u=await((i=this.axiosInstanceGet)==null?void 0:i.get(`${(o=this.config)==null?void 0:o.pointId}/products/?group=${l}`)),f=(u==null?void 0:u.data)||[];for(const m of f)m&&await Tl(m);return await this.cacheImagesInBackground(f),f}catch(u){return console.error("Ошибка загрузки группы:",u),[]}}async getGroup(){var l,o;try{const i=await((o=this.axiosInstanceGet)==null?void 0:o.get(`${(l=this.config)==null?void 0:l.pointId}/groups/`));return i==null?void 0:i.data}catch(i){return console.error("Error fetching products:",i),[]}}async fetchAndCacheAllPages(){var l,o;try{const i=((l=this.config)==null?void 0:l.pointId)||"",u=await qi(i);if(u)return u.data;const f=await((o=this.axiosInstanceGet)==null?void 0:o.get(`${i}/group/`)),m=(f==null?void 0:f.data)||[],p=[];for(const w of m){w.products=w.products||[],await Dr(w.id,w),p.push(w);const x=await this.loadGroupProducts(w.id);w.products=x}return await this.cacheImagesInBackground(m),await Dr(i,m),p}catch(i){return console.error("fetchAndCacheAllPages error:",i),[]}}cacheImagesInBackground(l){l.forEach(o=>{var i;o.video_link&&this.loadAndCacheMedia(o.video_link,o.id+"_video"),o.image_link&&this.loadAndCacheMedia(o.image_link,o.id+"_image"),(i=o.products)==null||i.forEach(u=>{u.video_link&&this.loadAndCacheMedia(u.video_link,u.id+"_video"),u.image_link&&this.loadAndCacheMedia(u.image_link,u.id+"_image")})})}async loadAndCacheMedia(l,o){const i=await fr(o);if(i){this.dispatchImageCachedEvent(o,i);return}try{const u=await fetch(l);if(!u.ok)throw new Error("Network error");const f=await u.blob();if(f.size===0)throw new Error("Empty blob");await Zi(o,f),this.dispatchImageCachedEvent(o,f)}catch(u){console.warn(`[ImageCache] Failed for ${o}:`,u)}}dispatchImageCachedEvent(l,o){window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:l,blob:o}}))}async getProduct(l=null){var o,i;if(!l)return[];try{const u=await((i=this.axiosInstanceGet)==null?void 0:i.get(`${(o=this.config)==null?void 0:o.pointId}/products/${l}`));return u==null?void 0:u.data}catch(u){return console.error("Error fetching cardProducts:",u),[]}}async getSingleProduct(l){var u;const o=st(),{config_lib:i}=we.storeToRefs(o);try{let f=await rs(l);if(f)this._fullCardProduct(f);else{const m=await((u=this.axiosInstanceGet)==null?void 0:u.get(`${i.value.pointId}/products/${l}`));(m==null?void 0:m.status)===200&&this._fullCardProduct(m.data)}}catch(f){throw console.warn("store card[getFetchProducts]:",f),f}}_fullCardProduct(l){const o=Lt();o.stateCard.openCard={...l,amount:1},o.stateCard.groupModifiers=l.group_modifiers,l.modifiers.length>0&&o.stateCard.groupModifiers.unshift({default_amount:0,description:"",group_modifiers:l.modifiers,id:"Добавки2000",image_link:null,max_amount:1,min_amount:l.modifiers.reduce((i,u)=>i+=u.min_amount,0),name:"Добавки",required:!1}),o.stateCard.groupModifiersSelected=new Array(o.stateCard.groupModifiers.length).fill({group:"",modifiers:[],is_fake:!1,is_product_determining:!1,modifier_count:0}),o.stateCard.productSizes=l.sizes,o.defaultAmountModifiers(),l.show_recommendations&&this.productUpsale(l.id)}async getTheme(){try{this.updateTheme()}catch(l){return console.error("Error fetching products:",l),[]}}async authorizeByCard(l){var o,i;try{const u=await((i=this.axiosInstanceAuthenticationPostApiKey)==null?void 0:i.post(`${(o=this.config)==null?void 0:o.domain}/api/user/validate-card/`,{card_number:l}));return localStorage.setItem("authTokensAccess",JSON.stringify(u==null?void 0:u.data.access)),localStorage.setItem("authTokensRefresh",JSON.stringify(u==null?void 0:u.data.refresh)),u==null?void 0:u.data}catch(u){throw console.error("Ошибка авторизации:",u),u}}async getLoyalSmsCode(l){var o,i;try{const u=await((i=this.axiosInstancePostApiKey)==null?void 0:i.post(`${(o=this.config)==null?void 0:o.domain}/api/device/auth/request-otp/`,{phone:l}));return u==null?void 0:u.data}catch(u){throw console.error("Ошибка получения sms-code:",u),u}}async sendSmsCodeForAuth(l,o){var i,u;try{const f=await((u=this.axiosInstanceAuthenticationPostApiKey)==null?void 0:u.post(`${(i=this.config)==null?void 0:i.domain}/api/device/auth/`,{code:l,phone:o}));return f==null?void 0:f.data}catch(f){throw console.error("Ошибка отправки sms-code:",f),f}}async callStaff(l,o,i){var u,f,m,p;try{const w=await((m=this.axiosInstancePost)==null?void 0:m.post(`${(u=this.config)==null?void 0:u.domain}/api/org_unit/${(f=this.config)==null?void 0:f.pointId}/table/${l}/call-staff/`,{...o},i));return(p=w==null?void 0:w.data)==null?void 0:p.response_text}catch(w){throw console.error("Ошибка[callStaff]",w),w}}async confirmOrder(l){var i,u;const o=await((u=this.axiosInstancePost)==null?void 0:u.post(`/org_unit/${(i=this.config)==null?void 0:i.pointId}/confirm-order/`,{order:l}));return(o==null?void 0:o.status)===200}async createOrder(l,o,i=!0,u,f=!1,m){var T,v,D,U,M;const p=Mt(),w=f?this.axiosInstanceAuthenticationPostApiKey:this.axiosInstancePostApiKey,x=i?w:this.axiosInstanceAuthenticationPost,C=i?"/device/order/create":"/order/create",y=i?(T=this.config)==null?void 0:T.pointId:(v=this.config)==null?void 0:v.pointId,N={items:l,comment:u};return o&&(N.table=o),i&&((D=p.selectedOrderType)!=null&&D.id)&&(N.order_type_id=(U=p.selectedOrderType)==null?void 0:U.id),await(x==null?void 0:x.post(`${(M=this.config)==null?void 0:M.domain}/api/org_unit/${y}${C}`,N,{signal:m}))}async extendOrder(l){var m,p;const o=Fn();if(!o.id)throw Error("Неверный стол");if(!((m=o.data)!=null&&m.order))throw Error("Заказ не найден");const i=this.axiosInstanceAuthenticationPost,u={items:l,table:o.id},f=await(i==null?void 0:i.post(`/org_unit/${(p=this.config)==null?void 0:p.pointId}/order/${o.data.order}/extend`,u));return f==null?void 0:f.data}async initPaymentLink(l,o){var w,x,C;const i=this.axiosInstanceAuthenticationPost,u=st(),f=Fn(),m={order:l,provider_type:o};u.countBonus>0&&(m.by_bonuses=u.countBonus),f.isTableService&&((w=f.order)==null?void 0:w.remaining_amount)!==((x=f.order)==null?void 0:x.total_cost)&&(m.amount=(C=f.order)==null?void 0:C.remaining_amount),m.by_bonuses&&m.amount&&(m.amount=+(+m.amount-+m.by_bonuses).toFixed(2));const p=await(i==null?void 0:i.post("payment/init",m));return p==null?void 0:p.data}async orderPay(l){var o;return(o=this.axiosInstanceAuthenticationPostApiKey)==null?void 0:o.post(`order/${l}/pay/`,{order_id:l})}async getProfile(){var o,i;const l=await((i=this.axiosInstanceAuthenticationGet)==null?void 0:i.get(`user/current?organization=${(o=this.config)==null?void 0:o.orgId}`));if((l==null?void 0:l.status)===200){const u=st();return u.profile=l.data,u.is18Allowed=sessionStorage.getItem("is_adult")==="true",l.data}else return l}async joinLoyalty(){var o;const l=await((o=this.axiosInstanceAuthenticationGet)==null?void 0:o.post("user/join-loyalty/"));return{success:(l==null?void 0:l.status)===200}}async isPhoneExist(l,o={}){var i,u;try{const f=await((u=this.axiosInstanceGet)==null?void 0:u.get("user/check-phone",{...o,params:{organization:(i=this.config)==null?void 0:i.orgId,phone:l}}));return(f==null?void 0:f.status)===200}catch{return!1}}async sendOTP(l,o={}){var u,f;const i=await((f=this.axiosInstancePost)==null?void 0:f.post("user/check-phone",{organization:(u=this.config)==null?void 0:u.orgId,phone:l},o));return i==null?void 0:i.data}async auth(l,o={}){var u,f;return await((f=this.axiosInstancePost)==null?void 0:f.post("user/auth",{organization:(u=this.config)==null?void 0:u.orgId,...l},o))}async signup(l,o={}){var u,f;return await((f=this.axiosInstancePost)==null?void 0:f.post("user/register",{organization:(u=this.config)==null?void 0:u.orgId,...l},o))}async calculateDiscount(l,o=!0,i=!1,u){var C,y;const f=i?this.axiosInstanceAuthenticationPostApiKey:this.axiosInstancePostApiKey,m=i?this.axiosInstanceAuthenticationPost:this.axiosInstancePost,p=o?f:m,w=o?(C=this.config)==null?void 0:C.pointId:(y=this.config)==null?void 0:y.pointId,x=await(p==null?void 0:p.post(`/org_unit/${w}/cart/calculate-discount/`,l,{signal:u}));return(x==null?void 0:x.status)===200?x.data:x}async maxPayByBonuses(l,o=!0,i=!1,u){const f=st(),m=i?this.axiosInstanceAuthenticationPostApiKey:this.axiosInstancePostApiKey,p=i?this.axiosInstanceAuthenticationPost:this.axiosInstancePost,w=o?m:p,x=await(w==null?void 0:w.post("/cart/max-pay-by-bonuses/",{order_id:l},{signal:u})),C=x==null?void 0:x.data;return f.profile&&C&&"balance"in C&&(f.profile.balance=C.balance),C}async getDeviceInfo(){var i;const l=Mt(),o=await((i=this.axiosInstanceGetApiKey)==null?void 0:i.get("/device/current/"));return(o==null?void 0:o.status)===200?(l.orderTypes=o.data.order_types,l.providerTypes=o.data.payment_provider_type,o.data):o}async validateApiKey(l,o){var u,f;const i=await((f=this.axiosInstancePost)==null?void 0:f.post(`/device/org_unit/${(u=this.config)==null?void 0:u.pointId}/validate-api-key/`,{api_key:l},o));return(i==null?void 0:i.status)===200}async productUpsale(l){var f,m,p;const o=Lt(),{dataUpSale:i}=we.storeToRefs(o);(f=this.currentUpsaleController)==null||f.abort();const u=new AbortController;this.currentUpsaleController=u;try{const w=await((p=this.axiosInstanceGet)==null?void 0:p.get(`/${(m=this.config)==null?void 0:m.pointId}/products/${l}/recommendation/`,{signal:u.signal}));u.signal.aborted||(i.value=w==null?void 0:w.data)}catch(w){if(w.name==="AbortError"||w.name==="CanceledError"){console.warn("Upsale отменён — пришёл новый запрос");return}throw console.error("Ошибка upsale:",w),w}finally{this.currentUpsaleController===u&&(this.currentUpsaleController=null)}}};Re(Ge,"_config",null),Re(Ge,"_axiosGet"),Re(Ge,"_axiosGetApiKey"),Re(Ge,"_axiosPostApiKey"),Re(Ge,"_axiosAuthPostApiKey"),Re(Ge,"_axiosPost"),Re(Ge,"_axiosAuthGet"),Re(Ge,"_axiosAuthPost"),Re(Ge,"_cardStore",null),Re(Ge,"_stateCard",null),Re(Ge,"_recountGroupTotalAmount",null);let yn=Ge;const oa=r.ref(!1),sa=r.ref(window.innerWidth),Un=()=>{const a=r.computed({get:()=>oa.value,set:u=>{oa.value=u}}),l=r.computed(()=>a.value&&sa.value>1024),o=()=>sa.value=window.innerWidth;return r.onMounted(()=>{window.addEventListener("resize",o)}),r.onUnmounted(()=>{window.removeEventListener("resize",o)}),{isDesktop:a,shouldUseDragScroll:l,syncWithRoute:u=>{a.value=u.query.mode==="pdf"}}},Wd=r.defineComponent({__name:"UseScrollCenter",props:{axis:{},behavior:{},autoScroll:{type:Boolean},container:{},idActive:{},clearContainer:{type:Boolean}},setup(a,{expose:l}){const o=a,i=st(),u=r.ref(null),{isDesktop:f}=Un(),m=async w=>{if(!u.value||!w)return;let x=window;o.container&&(x=typeof o.container=="string"?document.querySelector(o.container)||window:o.container);const C={behavior:o.behavior};if(o.axis==="x"){const y=x===window?window.innerWidth:x.clientWidth,N=w.offsetWidth;let O=w.offsetLeft;if(x!==window){const T=x.getBoundingClientRect();O=w.getBoundingClientRect().left-T.left+x.scrollLeft}O-=(y-N)/2,C.left=Math.max(0,O)}else{const y=x===window?window.innerHeight:x.clientHeight,N=w.offsetHeight;let O=w.offsetTop;if(x!==window){const T=x.getBoundingClientRect();O=w.getBoundingClientRect().top-T.top+x.scrollTop}O-=(y-N)/2,C.top=Math.max(0,O)}try{x===window?window.scrollTo(C):x.scrollTo(C)}catch(y){console.error("Scroll error:",y)}};r.onMounted(async()=>{if(o.autoScroll){let w=null;if(await r.nextTick(),i.activeScrolling_lib){const x=i.activeScrolling_lib.findIndex(C=>C.id===o.idActive);o.idActive?(w=document.getElementById(`scrolling${o.idActive}`),w&&x!==-1&&(i.activeScrolling_lib[x]=w)):i.activeScrolling_lib[x]&&(w=i.activeScrolling_lib[x]),m(w)}}});const p=async w=>{o.clearContainer&&(i.activeScrolling_lib=[]);const x=w.currentTarget;await r.nextTick(),i.activeScrolling_lib.includes(x)||i.activeScrolling_lib.push(x),m(x)};return l({scrollToElement:m}),(w,x)=>(r.openBlock(),r.createElementBlock("div",{ref_key:"wrapperRef",ref:u,class:r.normalizeClass(["scroll-to-wrapper",{scroll_pdf:r.unref(f)}])},[r.renderSlot(w.$slots,"default",{handleTargetClick:p},void 0,!0)],2))}}),Xe=(a,l)=>{const o=a.__vccOpts||a;for(const[i,u]of l)o[i]=u;return o},ho=Xe(Wd,[["__scopeId","data-v-e47a167d"]]),Wr={mounted(a){let l=!1,o,i,u,f,m,p=0,w=0,x=0,C=0,y=0,N=!1;const O=5;a.style.cursor="grab";const T=U=>{U.button===0&&(m&&(cancelAnimationFrame(m),m=0),l=!0,N=!1,o=U.pageX-a.offsetLeft,i=U.pageY-a.offsetTop,u=a.scrollLeft,f=a.scrollTop,x=U.pageX,C=U.pageY,y=Date.now(),p=0,w=0)},v=U=>{if(!l)return;const M=U.pageX,R=U.pageY,F=Math.abs(M-x),H=Math.abs(R-C);if(!N&&(F>O||H>O)&&(N=!0,a.style.pointerEvents="none"),N){U.stopPropagation(),U.preventDefault();const Z=Date.now(),V=Z-y;V>0&&(p=(M-x)/V*16,w=(R-C)/V*16),x=M,C=R,y=Z;const P=M-a.offsetLeft,L=R-a.offsetTop,re=P-o,Q=L-i;a.scrollLeft=u-re,a.scrollTop=f-Q}else x=M,C=R,y=Date.now()},D=U=>{if(l){if(N){if(U.stopPropagation(),U.preventDefault(),a.style.pointerEvents="",Math.abs(p)>.1||Math.abs(w)>.1){const M=()=>{a.scrollLeft-=p,a.scrollTop-=w,p*=.95,w*=.95,Math.abs(p)>.1||Math.abs(w)>.1?m=requestAnimationFrame(M):m=0};m=requestAnimationFrame(M)}}else a.style.pointerEvents="";l=!1,N=!1}};a.addEventListener("mousedown",T),window.addEventListener("mousemove",v),window.addEventListener("mouseup",D),a._dragScrollCleanup=()=>{m&&cancelAnimationFrame(m),a.removeEventListener("mousedown",T),window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",D),a.style.pointerEvents=""}},unmounted(a){a._dragScrollCleanup&&a._dragScrollCleanup()}},Xd={},$d={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 jd(a,l){return r.openBlock(),r.createElementBlock("svg",$d,[...l[0]||(l[0]=[r.createElementVNode("defs",null,null,-1),r.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 Ci=Xe(Xd,[["render",jd]]),qd=["id","onClick"],Zd={class:"modified_plus_btn"},Yd=["src"],Kd={key:2,class:"wrapper_modifier_item"},Qd={key:0,class:"modifier_item_n_wrapper"},Jd=["src"],eu={key:1,class:"modifier_plus_item"},tu=["src"],nu=["src"],aa=Xe(r.defineComponent({__name:"PlusModifier",props:{isSectionModifier:{type:Boolean},toggleNotRequire:{type:Function}},setup(a){const l=Lt(),o=Rt(),{stateCard:i}=we.storeToRefs(l),{itemThemes:u}=we.storeToRefs(o),{shouldUseDragScroll:f}=Un(),m=r.ref([]),p=r.ref([]),w=r.ref(null),x=r.ref(null),C=r.ref(null),y=O=>{O instanceof HTMLElement&&!m.value.includes(O)&&m.value.push(O)},N=O=>{C.value=O};return r.onMounted(async()=>{await r.nextTick(),i.value.plusButtonsRefs=m.value}),r.watchEffect(()=>{p.value=i.value.groupModifiersSelected,document.body.style.overflow=""}),r.watch(()=>{var O;return(O=i.value.groupCurrentOpen)==null?void 0:O.id},async O=>{var v;if(!O)return;await r.nextTick();const T=m.value.find(D=>D.id==="scrolling"+O);T&&((v=x.value)==null||v.scrollToElement(T))}),r.onBeforeUnmount(()=>{m.value=[],i.value.plusButtonsRefs=[]}),(O,T)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass({card_modified_wrapper_many:r.unref(i).groupModifiers.length>=5})},[r.unref(i).groupModifiersSelected?r.withDirectives((r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(["card_modified_wrapper",[r.unref(i).groupModifiers.length<=4?"card_modified_wrapper_center":""]]),ref_key:"scrollPlusContainer",ref:w},[r.createVNode(ho,{ref_key:"scrollCenterRef",ref:x,axis:"x",behavior:"smooth",container:w.value,autoScroll:!0,idActive:C.value,clearContainer:!0},{default:r.withCtx(({handleTargetClick:v})=>[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(i).groupModifiers,(D,U)=>{var M,R;return r.openBlock(),r.createElementBlock("div",{class:"button_modified",key:D.id,ref_for:!0,ref:y,id:"scrolling"+D.id,"data-clickable":"true",onClick:F=>{a.toggleNotRequire&&a.toggleNotRequire(D,U),N(D.id),v(F)}},[r.createElementVNode("div",Zd,[p.value[U].modifiers.length===0?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass([{modified_plus_btn_active:D.id===((M=r.unref(i).groupCurrentOpen)==null?void 0:M.id)&&a.isSectionModifier},"modified_plus_active"])},[r.createVNode(Ci,{"aria-label":`Открыть группу модификаторов ${D.name}`},null,8,["aria-label"])],2)):p.value[U].modifiers.length===1?(r.openBlock(),r.createElementBlock("div",{key:1,class:r.normalizeClass(["modified_plus_btn modified_plus_btn_solo",{modified_plus_btn_active:D.id===((R=r.unref(i).groupCurrentOpen)==null?void 0:R.id)&&a.isSectionModifier}])},[r.createElementVNode("img",{src:p.value[U].modifiers[0].image_link||r.unref(u).fallback_image||"",alt:"Модификатор"},null,8,Yd)],2)):(r.openBlock(),r.createElementBlock("div",Kd,[p.value[U].modifiers.length>2?(r.openBlock(),r.createElementBlock("div",Qd,[p.value[U].modifiers.length===3?(r.openBlock(),r.createElementBlock("img",{key:0,class:"modifier_plus_item modifier_item_three",src:p.value[U].modifiers[2].image_link||r.unref(u).fallback_image||""},null,8,Jd)):(r.openBlock(),r.createElementBlock("p",eu," + "+r.toDisplayString(p.value[U].modifiers.length-2),1))])):r.createCommentVNode("",!0),r.createElementVNode("div",null,[p.value[U].modifiers.length>0?(r.openBlock(),r.createElementBlock("img",{key:0,src:p.value[U].modifiers[0].image_link||r.unref(u).fallback_image||"",class:"modifier_plus_item modifier_item_first"},null,8,tu)):r.createCommentVNode("",!0),p.value[U].modifiers.length>1?(r.openBlock(),r.createElementBlock("img",{key:1,src:p.value[U].modifiers[1].image_link||r.unref(u).fallback_image||"",class:"modifier_plus_item modifier_item_second"},null,8,nu)):r.createCommentVNode("",!0)])]))]),r.createElementVNode("p",null,r.toDisplayString(D.name),1)],8,qd)}),128))]),_:1},8,["container","idActive"])],2)),[[r.unref(Wr),r.unref(f)?{}:!1]]):r.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-7f238435"]]),ru={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},iu=["stroke"],la=r.defineComponent({__name:"Close",props:{color:{type:String,required:!1,default:"currentColor"}},setup(a){const l=a;return(o,i)=>(r.openBlock(),r.createElementBlock("svg",ru,[r.createElementVNode("path",{d:"M18 18L12 12M12 12L6 6M12 12L18 6M12 12L6 18",stroke:l.color,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,8,iu)]))}}),ou={},su={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 au(a,l){return r.openBlock(),r.createElementBlock("svg",su,[...l[0]||(l[0]=[r.createElementVNode("desc",null," Created with Pixso. ",-1),r.createElementVNode("defs",null,null,-1),r.createElementVNode("circle",{id:"Ellipse 1",cx:"10.923828",cy:"10.923462",r:"10.923489",fill:"#FF6D2E","fill-opacity":"1.000000"},null,-1),r.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 _r=Xe(ou,[["render",au]]),Xr={mounted(a){a.muted=!0,a.setAttribute("muted","")}},lu=["disabled","id"],an=r.defineComponent({__name:"ButtonDefault",props:{textButtonDefault:{type:String,required:!0},disabled:{type:Boolean,default:!1},onClick:{type:Function,required:!0}},setup(a){const l=a,o=()=>{l.onClick()};return(i,u)=>(r.openBlock(),r.createElementBlock("button",{class:"buttonDefaultWrapper",disabled:a.disabled,onClick:o,id:a.disabled?"buttonDefaultDisabled":""},r.toDisplayString(a.textButtonDefault),9,lu))}}),cu={class:"notification_info"},du={key:0,class:"notification_18plus"},uu={class:"notification_18plus_image"},fu=["src"],hu={class:"notification_18plus_text"},mu={class:"notification_18plus_accept"},gu={key:1,class:"notification_text"},pu={key:0,class:"wrapper_button_accept"},Ei=r.defineComponent({__name:"NotificationWindow",props:r.mergeModels({textNotificationDefault:{},backgroundColor:{},buttonAccept:{},type:{type:Boolean},is_qr:{type:Boolean}},{visible:{default:!1},visibleModifiers:{}}),emits:["update:visible"],setup(a){const l=a,o=Rt(),i=st(),{is18Allowed:u,notificationData_lib:f}=we.storeToRefs(i),{itemThemes:m}=we.storeToRefs(o),p=r.computed(()=>l.backgroundColor||"rgba(50, 50, 50, 0.9)"),w=r.computed(()=>{var T;return!!((T=m.value)!=null&&T.kiosk_hide_menu_update_notification)});let x;const C=r.useModel(a,"visible"),y=()=>{f.value.fastAdd&&(i.addToCart(f.value.fastAdd),f.value.fastAdd=null),sessionStorage.setItem("is_adult","true"),u.value=!0,C.value=!1,f.value.callback&&(f.value.callback(),f.value.callback=null)},N=()=>{C.value=!1},O=()=>{C.value=!1,clearTimeout(x)};return r.watch([C,()=>l.textNotificationDefault,w],([T,v,D],[U,M])=>{x&&(!T||T!==U||v!==M)&&clearTimeout(x),D&&T&&(x=setTimeout(O,4e3))},{immediate:!0}),r.onUnmounted(()=>{x&&O()}),(T,v)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[!w.value&&C.value?(r.openBlock(),r.createBlock(r.Transition,{key:0,name:"notificationBlack",appear:""},{default:r.withCtx(()=>[r.createElementVNode("div",{class:"notification_background_black",onClick:N})]),_:1})):r.createCommentVNode("",!0),r.createVNode(r.Transition,{name:"notification"},{default:r.withCtx(()=>{var D;return[C.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:"notification_overlay",onClick:N},[r.createElementVNode("div",{class:"notification_wrapper",style:r.normalizeStyle({"background-color":p.value,border:`2px solid ${p.value}`})},[r.createElementVNode("div",cu,[a.type?(r.openBlock(),r.createElementBlock("div",du,[r.createElementVNode("div",uu,[r.createElementVNode("img",{src:r.unref(m).adult_disclaimer_image||r.unref(m).fallback_image,alt:"Дисклеймер"},null,8,fu)]),r.createElementVNode("div",hu,r.toDisplayString(r.unref(m).adult_disclaimer_text),1),r.createElementVNode("div",mu,[v[0]||(v[0]=r.createElementVNode("label",{for:"plus18"},"Содержащиеся в настоящем разделе материалы предназначены для лиц старше 18 лет, носят информационный характер об ассортименте товаров и не являются рекламой. ",-1)),r.createVNode(an,{textButtonDefault:"Мне есть 18",onClick:y,style:{fontSize:"1rem",padding:"6px 24px",marginLeft:"10px"}})])])):(r.openBlock(),r.createElementBlock("div",gu,[r.createTextVNode(r.toDisplayString(a.textNotificationDefault)+" ",1),(D=a.buttonAccept)!=null&&D.state?(r.openBlock(),r.createElementBlock("div",pu,[r.createVNode(an,{class:"button_accept",textButtonDefault:a.buttonAccept.text,onClick:a.buttonAccept.acceptBtn,disabled:a.buttonAccept.disabled},null,8,["textButtonDefault","onClick","disabled"])])):r.createCommentVNode("",!0)]))])],4)])):r.createCommentVNode("",!0)]}),_:1})],64))}}),xu={class:"wrapper_modifiers"},wu={class:"wrapper_nutritional_value"},_u={class:"nutritional_scheme"},Cu={key:0,class:"nutritional_parameters"},Eu={key:1,class:"nutritional_parameters"},yu={key:2,class:"nutritional_parameters"},bu={key:3,class:"nutritional_parameters"},Au={ref:"modifierBody",class:"modifier_shadow"},Su={class:"wrapper_modifiers_title"},Iu={class:"wrapper_text_count_modifiers"},Nu=["id","aria-label","onClick"],Tu={key:0,class:"counter_modifier"},ku={class:"hide_image_corners"},Ru=["src","alt"],Bu={key:1,loop:"",autoplay:"",muted:"",playsinline:"",class:"card__video"},Ou=["src"],Mu={class:"modifier_title"},Du={key:0,class:"modifier_continue_or_add_wrapper"},vu=Xe(r.defineComponent({__name:"SectionModifiers",emits:["close","add-to-cart"],setup(a,{emit:l}){const o=l,i=Rt(),u=Lt(),{itemThemes:f}=we.storeToRefs(i),{stateCard:m,recountGroupTotalAmount:p,groupTotalAmount:w,isLastGroup:x}=we.storeToRefs(u),{isDesktop:C,shouldUseDragScroll:y}=Un(),N=r.ref(null),O=yt.useTemplateRefsList(),T=r.ref(!1),v=M=>{if(!M)return;const R=m.value.groupModifiers.findIndex(P=>P.id===m.value.groupCurrentOpen.id),F=m.value.plusButtonsRefs[R]||m.value.plusButtonsRefs[0];if(!F)return;const H=M.getBoundingClientRect(),Z=F.getBoundingClientRect(),V=M.cloneNode(!0);V.classList.add("flyer"),Object.assign(V.style,{width:`${H.width}px`,height:`${H.height}px`,left:`${H.left}px`,top:`${H.top}px`,position:"fixed",zIndex:"1000"}),document.body.appendChild(V),N.value=V,requestAnimationFrame(()=>{const P=Z.left+Z.width/3-(H.left+H.width/2),L=Z.top+Z.height/4-(H.top+H.height/2),re=Z.width/H.width*.2;V.style.transform=`translate(${P}px, ${L}px) scale(${re})`,V.style.opacity="0.4",V.style.transition="transform 0.5s ease, opacity 0.5s ease"}),V.addEventListener("transitionend",()=>{V.remove(),N.value=null,F.classList.add("bump"),setTimeout(()=>F.classList.remove("bump"),300)},{once:!0})},D=()=>{m.value.isSectionModifier=!0;const M=m.value.groupCurrentOpen;if(!M)return;const R=m.value.groupModifiers.findIndex(H=>H.id===M.id),F=u.validateGroup(R);if(!F.valid){m.value.textErrorRequaired=F.errorText,T.value=!0;return}x.value?o("add-to-cart"):u.toggleNotRequire(M,void 0,!0)};r.watch(()=>m.value.isAnimationFly,M=>{M===!0&&m.value.currentModifier&&(v(O.value.find(R=>R.id===m.value.currentModifier.id)),m.value.isAnimationFly=!1)});const U=r.computed(()=>f.value.enable_sequential_modifiers?f.value.enable_sequential_modifiers:!0);return(M,R)=>{var F,H,Z,V,P,L,re,Q,ee,W,X,I,$,j;return r.openBlock(),r.createElementBlock(r.Fragment,null,[(r.openBlock(),r.createBlock(r.Teleport,{to:"body"},[r.createVNode(Ei,{visible:T.value,textNotificationDefault:r.unref(m).textErrorRequaired,backgroundColor:r.unref(f).accent_color?r.unref(f).accent_color:"#FF6D2E","onUpdate:visible":R[0]||(R[0]=q=>T.value=q)},null,8,["visible","textNotificationDefault","backgroundColor"])])),r.createElementVNode("div",xu,[r.createElementVNode("div",wu,[r.createElementVNode("div",{class:r.normalizeClass(["card_header_inner_back",[(F=r.unref(m).openCard)!=null&&F.proteins_amount?"card_header_inner_back_nutrients":""]]),"aria-label":"Закрыть выбор модификаторов",onClick:R[1]||(R[1]=q=>o("close"))},[r.createVNode(_r,{class:"arrow_bottom"})],2),r.createElementVNode("div",_u,[(H=r.unref(m).openCard)!=null&&H.energy_amount?(r.openBlock(),r.createElementBlock("div",Cu,[r.createElementVNode("b",null,r.toDisplayString((Z=r.unref(m).openCard)==null?void 0:Z.energy_amount),1),R[4]||(R[4]=r.createElementVNode("p",null,"Килокалории",-1))])):r.createCommentVNode("",!0),(V=r.unref(m).openCard)!=null&&V.proteins_amount?(r.openBlock(),r.createElementBlock("div",Eu,[r.createElementVNode("b",null,r.toDisplayString((P=r.unref(m).openCard)==null?void 0:P.proteins_amount),1),R[5]||(R[5]=r.createElementVNode("p",null,"Белки",-1))])):r.createCommentVNode("",!0),(L=r.unref(m).openCard)!=null&&L.fat_amount?(r.openBlock(),r.createElementBlock("div",yu,[r.createElementVNode("b",null,r.toDisplayString((re=r.unref(m).openCard)==null?void 0:re.fat_amount),1),R[6]||(R[6]=r.createElementVNode("p",null,"Жиры",-1))])):r.createCommentVNode("",!0),(Q=r.unref(m).openCard)!=null&&Q.carbohydrates_amount?(r.openBlock(),r.createElementBlock("div",bu,[r.createElementVNode("b",null,r.toDisplayString((ee=r.unref(m).openCard)==null?void 0:ee.carbohydrates_amount),1),R[7]||(R[7]=r.createElementVNode("p",null,"Углеводы",-1))])):r.createCommentVNode("",!0)]),r.createElementVNode("div",{class:r.normalizeClass(["card_header_inner_back card_header_inner_close_back",[(W=r.unref(m).openCard)!=null&&W.proteins_amount?"card_header_inner_back_nutrients":""]]),style:{marginRight:"10px"},"aria-label":"Закрыть выбор модификаторов",onClick:R[2]||(R[2]=q=>o("close"))},[r.createVNode(la,{class:"cross_bottom",color:"#FFFFFF"})],2)]),r.createElementVNode("div",Au,[r.createElementVNode("p",Su,r.toDisplayString((X=r.unref(m).groupCurrentOpen)==null?void 0:X.name),1),r.createElementVNode("p",Iu,"Выбрано "+r.toDisplayString(r.unref(p))+" из "+r.toDisplayString(r.unref(w)),1),r.withDirectives((r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass((I=r.unref(m).groupModifiers.find(q=>{var K;return q.id===((K=r.unref(m).groupCurrentOpen)==null?void 0:K.id)}))!=null&&I.group_modifiers.length?"wrapper_modifiers_card":"wrapper_modifiers_card_column")},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList((($=r.unref(m).groupCurrentOpen)==null?void 0:$.group_modifiers)||[],q=>{var K,oe,de;return r.openBlock(),r.createElementBlock("div",{key:q.id,ref_for:!0,ref:r.unref(O).set,id:q.id,style:r.normalizeStyle({pointerEvents:r.unref(C)?"none":"auto"}),class:r.normalizeClass(["modifier_card",{hidden_modifier_card:q.default_amount===0&&((K=r.unref(m).groupCurrentOpen)==null?void 0:K.id)==="Добавки2000"&&q.min_amount===0&&q.max_amount===0}]),tabindex:"0",role:"button","data-clickable":"true","aria-label":`Выбрать модификатор группы ${q.name}`,onClick:ce=>r.unref(u).modifierSelect(q)},[r.createElementVNode("div",{class:r.normalizeClass([{modifier_card_active:r.unref(m).groupModifiersSelected.some(ce=>{var Ce;return ce.group===((Ce=r.unref(m).groupCurrentOpen)==null?void 0:Ce.id)&&ce.modifiers.some(ge=>ge.id===q.id)})},"wrapper_image_corners"])},[q.amount>1?(r.openBlock(),r.createElementBlock("div",Tu,r.toDisplayString(q.amount),1)):r.createCommentVNode("",!0),r.createElementVNode("div",ku,[q.video_link?r.withDirectives((r.openBlock(),r.createElementBlock("video",Bu,[r.createElementVNode("source",{src:q.video_link||"",type:"video/webm"},null,8,Ou)])),[[r.unref(Xr)]]):(r.openBlock(),r.createElementBlock("img",{key:0,class:"modifier_image",src:q.image_link||r.unref(f).fallback_image||"",alt:q.name},null,8,Ru)),r.createElementVNode("div",{class:r.normalizeClass(["wrapper_modifier_title",{wrapper_modifier_title_required:q.min_amount>0||q.required}])},[r.createElementVNode("h3",Mu,r.toDisplayString(q.name),1),r.createElementVNode("p",null,"+"+r.toDisplayString(((de=(oe=q.sizes)==null?void 0:oe.find(ce=>ce.id===r.unref(m).selectedSize.id))==null?void 0:de.price)||q.price||0)+"₽",1)],2)])],2)],14,Nu)}),128))],2)),[[r.unref(Wr),(j=r.unref(m).groupModifiers.find(q=>{var K;return q.id===((K=r.unref(m).groupCurrentOpen)==null?void 0:K.id)}))!=null&&j.group_modifiers.length?{}:!1]]),U.value?(r.openBlock(),r.createElementBlock("div",Du,[r.createElementVNode("button",{onClick:R[3]||(R[3]=q=>D()),class:"modifier_continue_or_add"},r.toDisplayString(r.unref(x)?"Добавить":"Продолжить"),1)])):r.createCommentVNode("",!0)],512)])],64)}}}),[["__scopeId","data-v-9c8507e6"]]),Pu={key:0,class:"card_size_place"},Lu=["onClick","aria-label"],Fu={key:1,class:"card_size static"},Vu=["onClick","aria-label"],mo=3,Uu=Xe(r.defineComponent({__name:"SizeModifier",setup(a){const l=Lt(),{stateCard:o}=we.storeToRefs(l),i=r.ref(null),{isDesktop:u}=Un(),f=r.ref(50),m=r.ref(),p=r.ref(0),w=r.ref(0),x=r.ref(null),C=r.computed(()=>{var F;if(o.value.productSizes.length<=3)return o.value.productSizes[m.value.index]||o.value.productSizes[0];const M=p.value+1,R=((F=N.value[M])==null?void 0:F.originalIndex)??1;return o.value.productSizes[R]}),y=()=>{x.value&&o.value.productSizes.length>=3&&(w.value=x.value.offsetWidth/mo)},N=r.computed(()=>{if(o.value.productSizes.length<=3)return o.value.productSizes;const M=o.value.productSizes;return[...M.map((R,F)=>({...R,originalIndex:F})),...M.map((R,F)=>({...R,originalIndex:F})),...M.map((R,F)=>({...R,originalIndex:F}))]}),O=(M,R)=>{if(m.value={id:M.id,title:M.name,index:R,is_default:M.is_default},M.price!==null&&o.value.openCard&&(o.value.openCard={...o.value.openCard,price:M.price}),o.value.selectedSize=M,o.value.productSizes.length>3){y();const F=p.value+1;R<F?T():R>F&&v()}else{const F=o.value.productSizes.length,H=(R+.5)*(100/F);f.value=H}},T=()=>{var M;if(!(o.value.productSizes.length<=3)){if(p.value--,p.value<o.value.productSizes.length-mo+1){p.value+=o.value.productSizes.length;const R=(M=x.value)==null?void 0:M.querySelector(".card_size");R&&(R.style.transition="none",R.style.transform=`translateX(-${p.value*w.value}px)`,R.offsetHeight,R.style.transition="transform 0.2s ease-in-out")}D()}},v=()=>{var M;if(!(o.value.productSizes.length<=3)){if(p.value++,p.value>=o.value.productSizes.length*2){p.value-=o.value.productSizes.length;const R=(M=x.value)==null?void 0:M.querySelector(".card_size");R&&(R.style.transition="none",R.style.transform=`translateX(-${p.value*w.value}px)`,R.offsetHeight,R.style.transition="transform 0.2s ease-in-out")}D()}},D=()=>{var H;if(o.value.productSizes.length<=3)return;const M=p.value+1,R=((H=N.value[M])==null?void 0:H.originalIndex)??0,F=o.value.productSizes[R];m.value={id:F.id,title:F.name,index:R,is_default:F.is_default}};r.watch(()=>[o.value.productSizes,x.value],([M=[],R])=>{if(Array.isArray(M)&&M.length>0&&R!==null){let F=M.findIndex(H=>H.is_default===!0);M.length<3&&i.value&&parseInt(i.value.style.minWidth)<767&&(i.value.style.width="100px"),F>-1?(p.value=F,O(M[F],F),w.value=120/mo):M.length===2||M.length===1?(O(M[0],0),f.value=(0+.5)*(100/2)):(O(M[1],1),f.value=(1+.5)*(100/3))}}),r.watch(()=>{var M;return[(M=o.value.selectedSize)==null?void 0:M.id,o.value.groupModifiersSelected]},([M,R])=>{if(!M||!Array.isArray(R))return;const F=R.map(H=>({...H,modifiers:H.modifiers.map(Z=>{if(!Z.sizes||Z.sizes.length===0)return Z;const V=Z.sizes.find(P=>P.id===M);return V?{...Z,size:V,price:V.price??Z.price}:Z})}));JSON.stringify(F)!==JSON.stringify(o.value.groupModifiersSelected)&&(o.value.groupModifiersSelected=F)},{deep:!0});const U={mounted:y};return r.onBeforeUnmount(()=>{window.removeEventListener("resize",y)}),(M,R)=>r.withDirectives((r.openBlock(),r.createElementBlock("div",{class:"slider_container",ref_key:"slider_container",ref:i},[r.createElementVNode("div",{class:"card_size_place_wrapper",ref_key:"sliderWrapper",ref:x},[r.unref(o).productSizes.length>1&&m.value?(r.openBlock(),r.createElementBlock("div",Pu,[r.unref(o).productSizes.length>3?(r.openBlock(),r.createElementBlock("ul",{key:0,class:"card_size",style:r.normalizeStyle({transform:`translateX(-${p.value*w.value}px)`})},[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(N.value,(F,H)=>(r.openBlock(),r.createElementBlock("li",{key:`${F.id}-${H}`,onClick:Z=>O(F,H),class:r.normalizeClass({active:m.value.id===F.id&&m.value.index===F.originalIndex}),tabindex:"0",role:"button","aria-label":`Выбрать размер ${F.name}`},r.toDisplayString(F.alt_name?F.alt_name:F.name),11,Lu))),128))],4)):(r.openBlock(),r.createElementBlock("ul",Fu,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(o).productSizes,(F,H)=>(r.openBlock(),r.createElementBlock("li",{key:`${F.id}-${H}`,onClick:Z=>O(F,H),class:r.normalizeClass({active:m.value.id===F.id&&m.value.index===H}),tabindex:"0",role:"button","aria-label":`Выбрать размер ${F.name}`},r.toDisplayString(F.alt_name?F.alt_name:F.name),11,Vu))),128))])),C.value?r.withDirectives((r.openBlock(),r.createElementBlock("div",{key:2,class:"size_active",style:r.normalizeStyle(r.unref(o).productSizes.length<=3?{left:`${f.value}%`}:{})},[r.createElementVNode("p",null,r.toDisplayString(C.value.alt_name?C.value.alt_name:C.value.name),1)],4)),[[U]]):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0)],512)],512)),[[r.vShow,r.unref(o).productSizes.length>1&&m.value]])}}),[["__scopeId","data-v-ec659ddc"]]),zu="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",Hu={class:"counter_container"},Gu={class:"card_size_place_wrapper",ref:"sliderWrapper"},Wu={class:"cart_amount_counter"},Xu={class:"button_circle_number"},$u=Xe(r.defineComponent({__name:"NumberModifier",props:{qr_menu:{type:Boolean}},setup(a){const l=Lt(),{stateCard:o}=we.storeToRefs(l),i=Te.useRouter(),u=a,f=()=>{var p,w,x,C;(w=(p=i.options.history.state)==null?void 0:p.back)!=null&&w.includes("mode=pdf")&&u.qr_menu||(x=o.value.openCard)!=null&&x.amount&&((C=o.value.openCard)==null?void 0:C.amount)>1&&(o.value.openCard.amount-=1)},m=()=>{var p,w,x;(w=(p=i.options.history.state)==null?void 0:p.back)!=null&&w.includes("mode=pdf")&&u.qr_menu||(x=o.value.openCard)!=null&&x.amount&&(o.value.openCard.amount+=1)};return(p,w)=>{var x,C;return r.openBlock(),r.createElementBlock("div",Hu,[r.createElementVNode("div",Gu,[r.createElementVNode("div",Wu,[r.createElementVNode("p",{class:r.normalizeClass(["cart_circle_minus",[((x=r.unref(o).openCard)==null?void 0:x.amount)===1?"card_circle_minus_alone":""]]),"aria-label":"Уменьшить количество продукта","data-clickable":"true",onClick:r.withModifiers(f,["stop","prevent"])},[...w[0]||(w[0]=[r.createElementVNode("span",null,null,-1)])],2),r.createElementVNode("p",Xu,r.toDisplayString((C=r.unref(o).openCard)==null?void 0:C.amount),1),r.createElementVNode("p",{class:"cart_circle_plus","aria-label":"Увеличить количество продукта","data-clickable":"true",onClick:r.withModifiers(m,["stop","prevent"])},"+")])],512)])}}}),[["__scopeId","data-v-50b09b8c"]]);function go(a,l=800){const o=r.ref(a),i=r.ref(a);let u=null,f=null,m=a;const p=w=>{f||(f=w);const x=w-f,C=Math.min(x/l,1),y=C<.5?4*C*C*C:1-Math.pow(-2*C+2,3)/2;o.value=Math.round(m+(i.value-m)*y),C<1?u=requestAnimationFrame(p):(o.value=i.value,u=null)};return r.watch(i,()=>{u&&cancelAnimationFrame(u),m=o.value,f=null,u=requestAnimationFrame(p)},{immediate:!0}),r.onUnmounted(()=>{u&&cancelAnimationFrame(u)}),{displayNumber:o,targetNumber:i,update:w=>{i.value=w}}}const ft=r.defineComponent({__name:"RecountNumber",props:{price:{type:Number,required:!0},duration:{type:Number},fixedFloat:{type:Number,require:!1}},setup(a){const l=a,{displayNumber:o,update:i}=go(l.price||0,l.duration||800);return r.watchEffect(()=>{i(l.price)}),(u,f)=>(r.openBlock(),r.createElementBlock("span",null,r.toDisplayString(r.unref(o).toFixed(a.fixedFloat)),1))}}),ju={class:"button_price button_price_modifiers"},qu=["src"],Zu={class:"button_text_container"},Yu={class:"button_text_price"},Ku=Xe(r.defineComponent({__name:"ButtonPriceCount",props:{qr_menu:{type:Boolean,default:!1},closeProduct:{}},setup(a,{expose:l}){const o=Te.useRouter(),i=Te.useRoute(),u=Lt(),f=st(),m=Rt(),p=a,{stateCard:w,totalPrice_libCard:x,isOpenWindow:C,isAddToCard:y}=we.storeToRefs(u),{isDesktop:N}=Un(),{itemThemes:O}=we.storeToRefs(m),T=r.ref(!0),v=r.ref(!1),D=r.computed(()=>N.value?!1:T.value),U=r.ref([]),M=r.ref([]),R=()=>{var H,Z,V,P,L;if((Z=(H=o.options.history.state)==null?void 0:H.back)!=null&&Z.includes("mode=pdf")&&p.qr_menu)return;if(T.value){u.setCurrentCard(w.value.openCard),v.value=!0;const re=w.value.groupModifiers.findIndex(Q=>u.checkedRequiredBtn.group.id===Q.id);u.checkedRequiredBtn.haveRequaire&&u.toggleNotRequire(u.checkedRequiredBtn.group,re);return}const F=w.value.groupModifiersSelected||[];if(U.value=[],M.value=[],Array.isArray(F)&&F.length>0&&F.forEach(re=>{const Q=re.group,ee=re.modifiers||[];Q==="Добавки2000"?U.value=ee.map(W=>{var X;return{...W,old_price:W.price,size:Array.isArray(W.size)?W.size.map(I=>I.id).filter(Boolean):(X=W.size)!=null&&X.id?W.size.id:void 0}}):ee.length>0&&M.value.push({group:Q,is_fake:re.is_fake||!1,is_product_determining:re.is_product_determining||!1,modifiers:ee.map(W=>{var X;return{...W,old_price:W.price,size:Array.isArray(W.size)?W.size.map(I=>I.id).filter(Boolean):(X=W.size)!=null&&X.id?W.size.id:void 0}})})}),document.body.style.overflow="",w.value.openCard){const re={id:w.value.openCard.id,is_fake:w.value.openCard.is_fake||!1,is_od_united_product:w.value.openCard.is_od_united_product||!1,amount:w.value.openCard.amount,name:w.value.openCard.name,image_link:w.value.openCard.image_link,price:w.value.openCard.price,old_price:w.value.openCard.price,size:((V=w.value.selectedSize)==null?void 0:V.id)??((L=(P=w.value.openCard.sizes)==null?void 0:P.find(Q=>Q.is_default))==null?void 0:L.id),sizes:w.value.openCard.sizes||[],modifiers:U.value,groups:w.value.openCard.groups,group_modifiers:M.value,energy_amount:w.value.openCard.energy_amount??0,proteins_amount:w.value.openCard.proteins_amount??0,fat_amount:w.value.openCard.fat_amount??0,carbohydrates_amount:w.value.openCard.carbohydrates_amount??0};p.closeProduct&&p.closeProduct(),f.addToCart(re),y.value=!0}C.value=!1,p.qr_menu&&o.push(`/${i.params.orgId}/`)};return r.watch(()=>w.value.productSizes,F=>{!F||F.length===0||!w.value.selectedSize||(w.value.selectedSize={...w.value.selectedSize})},{immediate:!0}),r.watchEffect(()=>{u.checkedRequiredBtn.haveRequaire?T.value=!0:T.value=!1}),r.onMounted(()=>{y.value=!1}),l({addProductToCart:R}),(F,H)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[(r.openBlock(),r.createBlock(r.Teleport,{to:"body"},[r.createVNode(Ei,{visible:v.value,textNotificationDefault:r.unref(w).textErrorRequaired,backgroundColor:r.unref(O).accent_color?r.unref(O).accent_color:"#FF6D2E",buttonAccept:null,"onUpdate:visible":H[0]||(H[0]=Z=>v.value=Z)},null,8,["visible","textNotificationDefault","backgroundColor"])])),r.createElementVNode("div",{class:"button_price_bg_product",onTouchstart:H[3]||(H[3]=r.withModifiers(()=>{},["stop"])),onPointerdown:H[4]||(H[4]=r.withModifiers(()=>{},["stop"]))},[r.createElementVNode("div",ju,[r.unref(N)?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock($u,{key:0,qr_menu:a.qr_menu},null,8,["qr_menu"])),r.createElementVNode("div",{class:r.normalizeClass(["card_product_button_buy",{buy_active:!D.value}]),"data-clickable":"true",onClick:R,onTouchstart:H[1]||(H[1]=r.withModifiers(()=>{},["stop"])),onPointerdown:H[2]||(H[2]=r.withModifiers(()=>{},["stop"]))},[r.unref(N)?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("img",{key:0,src:r.unref(zu),class:"card_product_button_icon"},null,8,qu)),r.createElementVNode("div",Zu,[r.createElementVNode("p",Yu,[r.createVNode(ft,{price:+r.unref(x),fixedFloat:2},null,8,["price"]),H[5]||(H[5]=r.createTextVNode(" ₽ ",-1))])])],34)])],32)],64))}}),[["__scopeId","data-v-15db613c"]]),Qu={class:"modified_amount"},Ju={class:"hide_image_corners"},e0=["src"],t0={class:"wrapper_modifier_title"},n0={class:"amount_title"},r0={class:"wrapper_amount_counter"},i0={class:"amount_count"},o0={class:"amount_wrapper"},s0={class:"add_counter_amount"},a0=Xe(r.defineComponent({__name:"ModalAmount",setup(a){const l=Lt(),o=Rt(),{itemThemes:i}=we.storeToRefs(o),{stateCard:u}=we.storeToRefs(l),f=r.computed(()=>{var w,x,C;return((C=(x=(w=u.value.currentModifier)==null?void 0:w.sizes)==null?void 0:x.find(y=>y.id===u.value.selectedSize.id))==null?void 0:C.price)??hr(u.value.currentModifier)}),m=()=>{u.value.currentModifier&&(u.value.currentModifier.amount=u.value.modalCount),l.modifierSelect(u.value.currentModifier),u.value.isModifiedAmount=!1},p=()=>{u.value.modalCount=1,u.value.currentModifier.amount=1};return(w,x)=>{var C,y;return r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createElementVNode("div",Qu,[r.createElementVNode("div",Ju,[r.createElementVNode("img",{class:"modifier_image",src:((C=r.unref(u).currentModifier)==null?void 0:C.image_link)||r.unref(i).fallback_image||""},null,8,e0),r.createElementVNode("div",t0,[r.createElementVNode("p",n0,r.toDisplayString((y=r.unref(u).currentModifier)==null?void 0:y.name),1),r.createElementVNode("p",null,"+ "+r.toDisplayString(f.value)+"₽",1)])])]),r.createElementVNode("div",r0,[r.createElementVNode("div",{class:"amount_mines",onClick:x[0]||(x[0]=r.withModifiers((...N)=>r.unref(l).minusAmount&&r.unref(l).minusAmount(...N),["stop"]))},[...x[1]||(x[1]=[r.createElementVNode("div",null,null,-1)])]),r.createElementVNode("p",i0,r.toDisplayString(r.unref(u).modalCount),1),r.createElementVNode("div",o0,[r.createVNode(Ci,{onClick:r.withModifiers(r.unref(l).plusAmount,["stop"])},null,8,["onClick"])])]),r.createElementVNode("p",{class:"clear_count",onClick:r.withModifiers(p,["stop"])},"Убрать все"),r.createElementVNode("div",s0,[r.createVNode(an,{textButtonDefault:"Добавить",onClick:m,class:"button_add_group_modifiers"})])],64)}}}),[["__scopeId","data-v-84debd5d"]]),l0=(a,l,o)=>Math.max(l,Math.min(a,o)),c0=(a,l)=>Math.pow(a,l*5),ca=(a,l,o)=>l===0||Math.abs(l)===1/0?c0(a,o):a*l*o/(l+o*a),yi=(a,l)=>l*parseFloat(a)/100,po=(a,l,o,i=.15)=>i===0?l0(a,l,o):a<l?-ca(l-a,o-l,i)+l:a>o?+ca(a-o,o-l,i)+o:a,ln=(a,{min:l,max:o})=>l!==void 0&&a<l?l:o!==void 0&&a>o?o:a;function d0(a,l,o){const i=r.ref(0),u=r.computed(()=>a.value.map(w=>typeof w=="string"?yi(w,o.value):w)),f=r.computed(()=>Math.min(...u.value)),m=r.computed(()=>Math.max(...u.value)),p=r.computed(()=>{const w=u.value.reduce((x,C)=>Math.abs(C-l.value)<Math.abs(x-l.value)?C:x);return u.value.indexOf(w)});return{currentSnapPointIndex:i,flattenedSnapPoints:u,minSnapPoint:f,maxSnapPoint:m,closestSnapPointIndex:p}}const xo=Xe(r.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(a,{expose:l,emit:o}){const i=a,u=o;let f=null;const m=r.ref(0),p=r.ref(!1),w=yt.useVModel(i,"modelValue",u,{passive:!0});r.watch(w,Ie=>{Ie?ce():Ce||ge()}),r.onMounted(()=>{w.value&&ce()});const x=r.ref(),C=r.ref(null),y=r.ref(null),N=r.ref(null),O=r.ref(null),T=r.ref(i.expandOnContentDrag),{height:v}=yt.useWindowSize(),{height:D}=yt.useElementBounding(x),{height:U}=yt.useElementBounding(C),{height:M}=yt.useElementBounding(O),{height:R}=yt.useElementBounding(y),F=r.computed({get(){return ln(Math.ceil(M.value+U.value+R.value),{max:v.value})},set(Ie){[U.value,M.value,R.value]=Ie}}),H=r.ref(0),Z=r.ref(0),V=Ot.useMotionValue(0),P=Ot.useMotionValue(0),{snapPoints:L}=r.toRefs(i),re=r.computed(()=>L.value??[F.value]),{flattenedSnapPoints:Q,currentSnapPointIndex:ee,closestSnapPointIndex:W,minSnapPoint:X,maxSnapPoint:I}=d0(re,H,v);let $;function j(Ie){T.value=!0,q(Ie)}function q(Ie){T.value&&Ie.preventDefault()}const K=Ie=>{Ie.key==="Escape"&&ge()},oe=()=>{i.canBackdropClose&&ge()};let de=!1;const ce=async()=>{var Ie;if(!de){Ce&&(Ce=!1,f&&(clearTimeout(f),f=null)),m.value++,w.value=!0,de=!0,u("opening-started");try{await r.nextTick(),await r.nextTick();const Ue=(Ie=x.value)==null?void 0:Ie.$el;if(!Ue){console.warn("[BottomSheet] sheet not ready, aborting"),w.value=!1;return}D.value=Ue.getBoundingClientRect().height;const It=Ue.querySelector("[data-vsbs-content]"),ot=Ue.querySelector("[data-vsbs-header]"),Qe=Ue.querySelector("[data-vsbs-footer]");if(F.value=[ot.getBoundingClientRect().height,It.getBoundingClientRect().height,Qe.getBoundingClientRect().height],await r.nextTick(),ee.value=Q.value.findIndex(ve=>ve===X.value),i.initialSnapPoint){const ve=i.initialSnapPoint;if(ve<0||ve>=re.value.length)return console.warn("Index out of bounds");H.value=typeof re.value[ve]=="number"?ln(re.value[ve],{max:v.value}):yi(re.value[ve],v.value)}else H.value=ln(X.value,{max:v.value});Z.value=H.value,V.jump(H.value),P.jump(H.value),requestAnimationFrame(()=>{$=Ot.animate(V,H.value,{duration:i.duration/1e3,ease:"easeInOut"}),$=Ot.animate(P,0,{duration:i.duration/1e3,ease:"easeInOut",onComplete:()=>{i.blocking&&u("opened")}})}),window.addEventListener("keydown",K)}finally{de=!1}}};let Ce=!1;const ge=()=>{Ce||(de&&(de=!1),$&&$.stop(),P.stop(),V.stop(),Ot.animate(P,H.value||500,{duration:i.duration/1e3,ease:"easeInOut"}),p.value=!1,w.value=!1,Ce=!0,u("closing-started"),window.removeEventListener("keydown",K),f&&clearTimeout(f),f=setTimeout(()=>{u("closed"),Ce=!1,f=null},i.duration))},De=Ie=>{if(re.value){if(Ie<0||Ie>=re.value.length){console.warn("Index out of bounds");return}ee.value=Ie,H.value=typeof re.value[Ie]=="number"?ln(re.value[Ie],{max:v.value}):yi(re.value[Ie],v.value),$=Ot.animate(V,H.value,{duration:i.duration/1e3,ease:"easeInOut",onComplete:()=>u("snapped",re.value.indexOf(re.value[Ie]))})}};function xe(Ie){Ie>0?u("dragging-down"):Ie<0&&u("dragging-up")}const _t=()=>{p.value=!0,H.value=D.value,Z.value=P.get(),V.jump(H.value),P.jump(Z.value)},be=async(Ie,Ue)=>{await r.nextTick(),x.value&&(Z.value<=0&&(H.value-=Ue.delta.y),H.value<=X.value&&(H.value=X.value,Z.value+=Ue.delta.y,p.value=!0,P.set(i.canSwipeClose?ln(Z.value,{min:0}):ln(po(Z.value,-D.value,0,.5),{min:0}))),V.set(ln(po(H.value,0,I.value,.25),{min:0,max:v.value})),xe(Ue.delta.y))},et=()=>{if(i.canSwipeClose){let Ie=H.value/2;i.swipeCloseThreshold&&typeof i.swipeCloseThreshold=="number"&&(Ie=i.swipeCloseThreshold),i.swipeCloseThreshold&&typeof i.swipeCloseThreshold=="string"&&i.swipeCloseThreshold.includes("%")&&(Ie=H.value*(Number(i.swipeCloseThreshold.replace("%",""))/100)),Math.abs(Z.value)>Ie&&(Z.value=H.value)}else Z.value=0;if($=Ot.animate(P,Z.value,{duration:i.duration/1e3,ease:"easeInOut"}),Z.value===H.value){Z.value=0,ge();return}ee.value=W.value,H.value=typeof re.value[W.value]=="number"?ln(re.value[W.value],{max:v.value}):yi(re.value[W.value],v.value),$=Ot.animate(V,H.value,{duration:i.duration/1e3,ease:"easeInOut",onComplete:()=>u("snapped",re.value.indexOf(re.value[W.value]))}),$=Ot.animate(P,0,{duration:i.duration/1e3,ease:"easeInOut"})},rt=(Ie,Ue)=>{if(H.value=D.value,Z.value=P.get(),$&&$.stop(),!N.value)return;const It=N.value.scrollTop===0,ot=Ue.delta.y>0,Qe=Q.value.length===1,ve=.5>Math.abs(H.value-I.value);if(Qe){if(!i.expandOnContentDrag)return T.value=!1;P.get()===0&&It&&ot&&(T.value=!0),P.get()===0&&It&&!ot&&(T.value=!1)}else{if(!i.expandOnContentDrag)return T.value=!1;p.value=!0,T.value=!0,ve&&(ot&&It&&(T.value=!0),!ot&&It&&(T.value=!1),It||(T.value=!1))}},Ve=async(Ie,Ue)=>{if(await r.nextTick(),!i.expandOnContentDrag)return T.value=!1;if(!x.value)return;Z.value===0&&T.value&&i.expandOnContentDrag&&(H.value-=Ue.delta.y),H.value<=X.value&&(H.value=X.value,T.value&&i.expandOnContentDrag&&(Z.value+=Ue.delta.y),Z.value=ln(Z.value,{min:0,max:X.value}),P.set(i.canSwipeClose?ln(Z.value,{min:0}):ln(po(Z.value,-D.value,0,.5),{min:0}))),H.value>I.value&&(H.value=I.value),H.value=ln(H.value,{max:v.value}),!(Q.value.length===1)&&H.value===I.value&&(T.value=!1),V.set(H.value),xe(Ue.delta.y)},it=()=>{if(!N.value)return;const Ie=N.value.scrollTop===0;T.value=Ie},Me=yt.useDebounceFn(Ie=>De(Ie),i.duration);return r.watch(re,(Ie,Ue)=>{if(w.value===!1||!Ie||!Ue)return;const It=Ie[ee.value],ot=Ue[ee.value];typeof It!="string"&&typeof ot!="string"&&(H.value=ln(It,{max:v.value}),It!==ot&&($=Ot.animate(V,H.value,{duration:i.duration/1e3,ease:"easeInOut"})))}),r.watch(v,()=>Me(ee.value)),l({open:ce,close:ge,snapToPoint:De}),r.onUnmounted(()=>{f&&clearTimeout(f)}),(Ie,Ue)=>(r.openBlock(),r.createBlock(r.Teleport,{to:a.teleportTo,defer:a.teleportDefer},[r.createElementVNode("div",r.mergeProps(Ie.$attrs,{"data-vsbs-container":""}),[r.createVNode(r.unref(Ot.AnimatePresence),null,{default:r.withCtx(()=>[r.unref(w)&&a.blocking?(r.openBlock(),r.createBlock(r.unref(Ot.Motion),{ref:"backdrop",key:"backdrop-"+m.value,"data-vsbs-backdrop":"",onClick:Ue[0]||(Ue[0]=It=>oe()),transition:{ease:"easeInOut",duration:a.duration/1e3},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}},null,8,["transition"])):r.createCommentVNode("",!0)]),_:1}),r.createVNode(r.unref(Ot.AnimatePresence),null,{default:r.withCtx(()=>[r.unref(w)?(r.openBlock(),r.createBlock(r.unref(Ot.Motion),{ref_key:"sheet",ref:x,exit:{opacity:0},initial:!1,key:m.value,style:r.normalizeStyle({y:r.unref(P),z:1,height:r.unref(V)}),"data-vsbs-shadow":!a.blocking,"data-vsbs-sheet-show":r.unref(w),"data-vsbs-dragging":p.value,"aria-modal":"true","data-vsbs-sheet":"",tabindex:"-1"},{default:r.withCtx(()=>[r.createVNode(r.unref(Ot.Motion),{ref_key:"sheetHeader",ref:C,"data-vsbs-header":"",onPanStart:_t,onPan:be,onPanEnd:et,onTouchmove:j,class:r.normalizeClass(a.headerClass)},{default:r.withCtx(()=>[r.renderSlot(Ie.$slots,"header",{},void 0,!0)]),_:3},8,["class"]),r.createElementVNode("div",{ref_key:"sheetScroll",ref:N,"data-vsbs-scroll":"",onScrollend:it},[r.createVNode(r.unref(Ot.Motion),{ref:"sheetContentWrapper","data-vsbs-content-wrapper":"",onPanStart:rt,onPan:Ve,onPanEnd:et,onTouchmove:q},{default:r.withCtx(()=>[r.createElementVNode("div",{ref_key:"sheetContent",ref:O,"data-vsbs-content":"",class:r.normalizeClass(a.contentClass)},[r.renderSlot(Ie.$slots,"default",{},void 0,!0)],2)]),_:3},512)],544),r.createVNode(r.unref(Ot.Motion),{ref_key:"sheetFooter",ref:y,"data-vsbs-footer":"",onPanStart:_t,onPan:be,onPanEnd:et,onTouchmove:j,class:r.normalizeClass(a.footerClass)},{default:r.withCtx(()=>[r.renderSlot(Ie.$slots,"footer",{},void 0,!0)]),_:3},8,["class"])]),_:3},8,["style","data-vsbs-shadow","data-vsbs-sheet-show","data-vsbs-dragging"])):r.createCommentVNode("",!0)]),_:3})],16)],8,["to","defer"]))}}),[["__scopeId","data-v-a8913d51"]]);function Tn(a,l=null){const o=si();o.initCacheSingle("defaultImage");const i=r.computed(()=>o.cache.defaultImage||null),u=r.shallowRef(!1),f=r.computed(()=>{var x;return((x=r.toValue(a))==null?void 0:x.toString())||null}),m=yt.computedAsync(async()=>{const x=f.value;return x?(await o.initCacheSingle(x),o.cache[x]||null):null},null,{evaluating:u}),p=r.computed(()=>u.value&&f.value!==null);return{mediaUrl:r.computed(()=>m.value||r.toValue(l)||i.value||null),isLoading:p}}const u0={class:"card_product_modifiers_sheet_body"},f0={class:"card__pictures"},h0=["src"],m0=["src"],g0={class:"card_header_wrapper"},p0={key:0,class:"card_fire_kkal_wrapper"},x0={class:"card_content"},w0={class:"wrapper_size"},_0={key:0,class:"description"},C0={key:1},E0=Xe(r.defineComponent({__name:"CardProductPage",props:{configPage:{}},setup(a){const l=Rt(),o=Lt(),{stateCard:i,isOpenWindow:u,isAddToCard:f}=we.storeToRefs(o),{itemThemes:m}=we.storeToRefs(l),p=Te.useRouter(),w=Te.useRoute(),x=a,C=r.computed(()=>!!(w.query.mode==="pdf"&&x.configPage.qr_menu)),{mediaUrl:y}=Tn(()=>{var U,M;return(U=i.value.openCard)!=null&&U.video_link?`${i.value.openCard.id}_video`:(M=i.value.openCard)!=null&&M.image_link?`${i.value.openCard.id}_image`:null},()=>{var U,M;return((U=i.value.openCard)==null?void 0:U.video_link)||((M=i.value.openCard)==null?void 0:M.image_link)||null}),N=()=>{x.configPage.qr_menu?C.value?p.push(`/${w.params.orgId}?mode=pdf`):p.push(`/${w.params.orgId}`):x.configPage.closeProduct()},O=()=>{f.value=!1,i.value.isSectionModifier=!1},T=()=>{i.value.isModifiedAmount=!1},v=r.ref(null),D=()=>{var U;(U=v.value)==null||U.addProductToCart()};return r.watch(()=>x.configPage.data,o.setCurrentCard),r.watch(()=>i.value.isSectionModifier,U=>{C.value&&document.body.classList.toggle("pdf_hidden",U)},{immediate:!0}),r.watchEffect(()=>{u.value||(u.value=x.configPage.is_closeProduct)}),r.onBeforeUnmount(()=>o.reset()),(U,M)=>{var R,F,H,Z,V,P;return r.openBlock(),r.createElementBlock("div",{class:"card_product_wrapper",style:r.normalizeStyle(C.value?"user-select: none;":"")},[r.createVNode(r.unref(xo),{modelValue:r.unref(i).isSectionModifier,"onUpdate:modelValue":M[0]||(M[0]=L=>r.unref(i).isSectionModifier=L),class:"card_product_modifiers_sheet",teleportTo:C.value?"#app":"body"},{default:r.withCtx(()=>[r.createElementVNode("div",u0,[r.createVNode(vu,{onClose:O,onAddToCart:D}),r.createVNode(aa,{isSectionModifier:r.unref(i).isSectionModifier,toggleNotRequire:r.unref(o).toggleNotRequire},null,8,["isSectionModifier","toggleNotRequire"])])]),_:1},8,["modelValue","teleportTo"]),(r.openBlock(),r.createBlock(r.Teleport,{to:"body"},[r.unref(i).isModifiedAmount?(r.openBlock(),r.createElementBlock("div",{key:0,class:"wrapper_modified_amount",onClick:r.withModifiers(T,["stop"])},[r.createVNode(a0)])):r.createCommentVNode("",!0)])),r.createElementVNode("div",f0,[(R=r.unref(i).openCard)!=null&&R.video_link&&r.unref(y)?r.withDirectives((r.openBlock(),r.createElementBlock("video",{key:r.unref(y),loop:"",autoplay:"",muted:"",playsinline:"",class:"card__video"},[r.createElementVNode("source",{src:r.unref(y)||"",type:"video/webm"},null,8,h0)])),[[r.unref(Xr)]]):(r.openBlock(),r.createElementBlock("img",{key:1,class:"card__pictures_images",src:r.unref(y)||"",alt:"Product image"},null,8,m0)),r.createElementVNode("div",g0,[r.createVNode(_r,{class:"card_header_back",onClick:N,"aria-label":"Вернуться назад"}),(F=r.unref(i).openCard)!=null&&F.energy_amount?(r.openBlock(),r.createElementBlock("div",p0,[M[2]||(M[2]=r.createElementVNode("div",{class:"card_fire_kkal"},null,-1)),r.createElementVNode("p",null,[r.createElementVNode("b",null,r.toDisplayString((H=r.unref(i).openCard)==null?void 0:H.energy_amount),1),M[1]||(M[1]=r.createTextVNode(" Ккал ",-1))])])):r.createCommentVNode("",!0)]),r.createElementVNode("h4",null,r.toDisplayString((Z=r.unref(i).openCard)==null?void 0:Z.name),1),r.createElementVNode("div",{class:"card__pictures__gradient",style:r.normalizeStyle(r.unref(m).gradientStyle)},null,4)]),r.createElementVNode("div",x0,[r.createElementVNode("div",w0,[r.createVNode(Uu)]),(V=r.unref(i).openCard)!=null&&V.description?(r.openBlock(),r.createElementBlock("p",_0,r.toDisplayString((P=r.unref(i).openCard)==null?void 0:P.description),1)):r.createCommentVNode("",!0),r.unref(i).groupModifiers.length?(r.openBlock(),r.createElementBlock("div",C0,[M[3]||(M[3]=r.createElementVNode("p",{class:"title_info_modifiers"},"Настрой, как ты любишь",-1)),r.createVNode(aa,{isSectionModifier:r.unref(i).isSectionModifier,toggleNotRequire:r.unref(o).toggleNotRequire},null,8,["isSectionModifier","toggleNotRequire"])])):r.createCommentVNode("",!0),r.createVNode(Ku,{ref_key:"buttonPriceRef",ref:v,qr_menu:a.configPage.qr_menu,closeProduct:a.configPage.closeProduct},null,8,["qr_menu","closeProduct"])])],4)}}}),[["__scopeId","data-v-ee9ec125"]]),bi=we.defineStore("modals",()=>{const a=new Map,l=(u,f)=>{const m=i(u).value;m.visible=!0,m.context=f},o=u=>{const f=i(u).value;f.visible=!1},i=u=>(a.has(u)||a.set(u,r.ref({visible:!1})),a.get(u));return{state:i,open:l,close:o}}),y0={key:0,class:"popupWindowDefault_overlay"},da=Xe(r.defineComponent({__name:"PopupWindowDefault",props:{visible:{type:Boolean}},emits:["update:visible"],setup(a,{emit:l}){const o=a,i=l,u=()=>{i("update:visible",!1)};return r.watch(()=>o.visible,async f=>{f&&await r.nextTick(),o.isVisible=f}),(f,m)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createVNode(r.Transition,{name:"popupWindowDefaultBlack",appear:"",onAfterLeave:m[0]||(m[0]=()=>{i("update:visible",!1)})},{default:r.withCtx(()=>[o.visible?(r.openBlock(),r.createElementBlock("div",{key:0,class:"background_black",onClick:u})):r.createCommentVNode("",!0)]),_:1}),r.createVNode(r.Transition,{name:"popupWindowDefault",appear:"",onAfterLeave:m[1]||(m[1]=()=>{i("update:visible",!1)})},{default:r.withCtx(()=>[o.visible?(r.openBlock(),r.createElementBlock("div",y0,[r.renderSlot(f.$slots,"default",{},void 0,!0)])):r.createCommentVNode("",!0)]),_:3})],64))}}),[["__scopeId","data-v-08e0e008"]]),b0=["src"],A0={class:"cart_box_content_wrapper"},S0={class:"cart_box_content_info"},I0={class:"cart_amount"},N0={class:"cart_amount_count"},T0={class:"cart_box_info_more"},k0={key:1,class:"cart_modifier_info"},R0={class:"cart_modifier_content"},B0={class:"wrapper_price_count_cart"},O0={class:"count_cart_box"},M0={class:"wrapper_modifiers_discount"},ua=Xe(r.defineComponent({__name:"CartBox",props:{index:Number,cardItem:Object},emits:["delete"],setup(a,{emit:l}){const o=a,i=st(),u=Rt(),f=bi(),{itemThemes:m}=we.storeToRefs(u),p=r.ref(0),w=r.ref(0),x=r.ref(!1),C=r.ref(!1),y=r.ref(!1),{displayNumber:N,update:O}=go(0,800),T=r.computed(()=>{var Q,ee;const L=((Q=o.cardItem)==null?void 0:Q.modifiers)??[],re=(((ee=o.cardItem)==null?void 0:ee.group_modifiers)??[]).flatMap(W=>W.modifiers??[]);return[...L,...re]}),{mediaUrl:v}=Tn(()=>{var L;return((L=o.cardItem)==null?void 0:L.id)+"_image"},()=>{var L;return(L=o.cardItem)==null?void 0:L.image_link}),D=r.computed(()=>{var L,re;return((L=o.cardItem)==null?void 0:L.total_new_price)??hr(o.cardItem)*((re=o.cardItem)==null?void 0:re.amount)}),U=()=>f.open("cart-delete-confirm",o.cardItem),M=()=>{y.value=!y.value},R=()=>{i.plusAmount(o.cardItem.idSystem)},F=()=>{o.cardItem.amount>1?i.minusAmount(o.cardItem.idSystem):U()},H=L=>{p.value=L.touches[0].clientX,x.value=!0},Z=L=>{x.value&&(w.value=L.touches[0].clientX-p.value,w.value>0&&(w.value=0))},V=()=>{x.value=!1,w.value<-115&&U(),w.value=0};r.onMounted(()=>{o.index===0&&(C.value=!0,setTimeout(()=>{w.value=-90,setTimeout(()=>{w.value=0,C.value=!1},700)},0))});const P=r.computed(()=>{const L=o.index===0&&C.value?1:`${1-Math.abs(w.value)/200}`;return{transform:`translateX(${w.value}px)`,opacity:L,transition:x.value?"none":"transform 0.7s, opacity 0.7s"}});return r.watch(D,O,{immediate:!0}),(L,re)=>{var Q,ee,W,X;return r.openBlock(),r.createElementBlock("div",{class:"cart_box_wrapper",onTouchstart:H,onTouchmove:Z,onTouchend:V,style:r.normalizeStyle(P.value)},[re[2]||(re[2]=r.createElementVNode("div",{class:"wrapper_cart_delete"},[r.createElementVNode("div",{class:"cart_delete"})],-1)),r.createElementVNode("img",{src:r.unref(v)||"",class:"cart_box_image"},null,8,b0),r.createElementVNode("div",A0,[r.createElementVNode("div",S0,[r.createElementVNode("p",null,r.toDisplayString((Q=a.cardItem)==null?void 0:Q.name),1),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(((ee=o.cardItem)==null?void 0:ee.discounts)||[],(I,$)=>(r.openBlock(),r.createElementBlock("div",{key:$,class:"discount_banner"},[r.createElementVNode("p",null,r.toDisplayString(I.name),1),r.createElementVNode("p",null,r.toDisplayString(I.discount)+"₽",1)]))),128)),r.createElementVNode("div",I0,[r.createElementVNode("button",{onClick:F},"-"),r.createElementVNode("p",N0,r.toDisplayString(o.cardItem.amount),1),r.createElementVNode("button",{onClick:R},"+")])]),r.createElementVNode("div",T0,[r.createElementVNode("div",{class:"cart_box_remove_item",onClick:U},[r.createVNode(la)]),(W=o.cardItem)!=null&&W.new_price?(r.openBlock(),r.createElementBlock("p",{key:0,class:r.normalizeClass({discount_new_price:(X=o.cardItem)==null?void 0:X.new_price})},r.toDisplayString((o.cardItem.new_price*o.cardItem.amount).toFixed(2)+"₽"),3)):r.createCommentVNode("",!0),r.createElementVNode("p",null,r.toDisplayString(r.unref(N).toFixed(2)+"₽"),1)])]),!y.value&&T.value.length>0?(r.openBlock(),r.createElementBlock("div",{key:0,class:"cart_modifier_toggle",onTouchstart:r.withModifiers(M,["stop"])},[...re[0]||(re[0]=[r.createElementVNode("p",{class:"cart_info_more"},"Посмотреть модификаторы",-1),r.createElementVNode("p",{class:"cart_arrow"},null,-1)])],32)):r.createCommentVNode("",!0),y.value?(r.openBlock(),r.createElementBlock("div",k0,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(T.value,I=>{var $;return r.openBlock(),r.createElementBlock("div",{class:"cart_modifier_item",key:I.id},[r.createElementVNode("div",R0,[r.createVNode(Ci,{id:"plus_orange"}),r.createElementVNode("p",null,r.toDisplayString(I.name),1)]),r.createElementVNode("div",B0,[r.createElementVNode("p",O0,r.toDisplayString(`x${I.amount}`),1),r.createElementVNode("div",M0,[I!=null&&I.new_price?(r.openBlock(),r.createElementBlock("p",{key:0,class:r.normalizeClass({discount_new_price:($=I==null?void 0:I.new_price)==null?void 0:$.toFixed(2)})},r.toDisplayString((I.new_price*I.amount).toFixed(2)+"₽"),3)):r.createCommentVNode("",!0),r.createElementVNode("p",null,r.toDisplayString((I.total_new_price??I.price*I.amount).toFixed(2)+"₽"),1)])])])}),128)),r.createElementVNode("div",{class:"cart_modifier_arrow",onTouchstart:r.withModifiers(M,["stop"])},[...re[1]||(re[1]=[r.createElementVNode("p",{class:"cart_info_more"},"Скрыть",-1),r.createElementVNode("p",{class:"cart_arrow_top"},null,-1)])],32)])):r.createCommentVNode("",!0)],36)}}}),[["__scopeId","data-v-b69f6323"]]),D0={},v0={class:"nfc_x",viewBox:"0 0 48 48"};function P0(a,l){return r.openBlock(),r.createElementBlock("svg",v0,[...l[0]||(l[0]=[r.createElementVNode("rect",{x:"8",y:"12",width:"32",height:"24",rx:"4",ry:"4",stroke:"#B00020","stroke-width":"2.4",fill:"none"},null,-1),r.createElementVNode("path",{d:"M14 16L34 30M34 16L14 30",stroke:"#B00020","stroke-width":"3","stroke-linecap":"round"},null,-1)])])}const L0=Xe(D0,[["render",P0]]),F0={},V0={style:{},"aria-hidden":"true",viewBox:"0 0 48 48",class:"nfc_ok"};function U0(a,l){return r.openBlock(),r.createElementBlock("svg",V0,[...l[0]||(l[0]=[r.createElementVNode("rect",{x:"8",y:"12",width:"32",height:"24",rx:"4",ry:"4",stroke:"#5D534B","stroke-width":"none",fill:"none"},null,-1),r.createElementVNode("path",{d:"M16 22h16m-10 6h6",stroke:"#5D534B","stroke-width":"2.4","stroke-linecap":"round"},null,-1),r.createElementVNode("path",{d:"M14 28l6 6l14-14",fill:"none",stroke:"#2ECC71","stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const z0=Xe(F0,[["render",U0]]),H0={key:0,class:"nfc_ok",viewBox:"0 0 48 48","aria-hidden":"true"},G0=r.defineComponent({__name:"CardReaderRetry",props:{styleRetry:{type:Boolean}},setup(a){return(l,o)=>a.styleRetry?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("svg",H0,[...o[0]||(o[0]=[r.createElementVNode("rect",{x:"8",y:"12",width:"32",height:"24",rx:"4",ry:"4"},null,-1),r.createElementVNode("path",{d:"M16 22h16m-10 6h6"},null,-1)])]))}}),W0={class:"sheet_header"},X0={class:"sheet_title",id:"sheetTitle"},$0={class:"sheet_body"},j0={class:"sheet_card"},q0={class:"nfc_title"},Z0={class:"lead"},Y0={class:"wrapper_input_accept"},K0={key:1},Q0={key:0,class:"card_phone_auth_wrapper"},J0={class:"sr_only","aria-live":"polite"},fa=r.defineComponent({__name:"CardReader",setup(a){const l=st(),o=Rt(),{is_OpenLoyal:i}=we.storeToRefs(l),{itemThemes:u}=we.storeToRefs(o),f=Mt(),m=r.ref(),p=r.ref(null),w=r.ref(""),x={wait:{text:"Лояльность",title:""},success:{text:"Стикер распознан",title:"Стикер распознан"},not_found:{text:"Стикер не распознан",title:"Стикер не распознали"}},C=r.computed({get:()=>w.value,set:j=>{w.value=j.replace(/\s/g,"")}}),y=r.computed(()=>f.currentState),N=r.computed(()=>f.isDrawerOpen),O=r.computed(()=>{var j;return((j=x[y.value])==null?void 0:j.text)||""}),T=r.computed(()=>{var j;(j=x[y.value])!=null&&j.title}),v=r.computed(()=>y.value==="success"?"Добро пожаловать!":u.value.kiosk_show_loyalty_phone_input_button?"Поднесите стикер к считывателю или войдите по номеру телефона":"Поднесите стикер к считывателю или введите номер карты вручную"),D=r.computed(()=>({ok:y.value==="success",warn:y.value==="not_found"})),U=r.computed(()=>{const j=[];return y.value==="wait"&&j.push("pulse","show-x"),y.value==="not_found"&&j.push("pulse","show-x"),y.value==="success"&&j.push("pulse","show-ok"),j}),M=r.computed(()=>y.value==="not_found"),R=r.computed(()=>y.value==="success"),F=r.computed(()=>y.value==="not_found"),H=r.computed(()=>["not_found"].includes(y.value)),Z=r.computed(()=>({wait:"Стикер не распознан. Нажмите «Повторить».",success:"Стикер распознан. Нажмите «Продолжить».",not_found:"Стикер не распознан. Нажмите «Повторить»."})[y.value]||""),V=()=>{f.closeDrawer(),i.value=!0},P=async j=>{var q,K;f.error="",p.value=null;try{const oe=new yn;await oe.authorizeByCard(j.trim()),await oe.getProfile(),l.loadCart(),f.setState("success"),f.isDrawerOpen=!1,f.showNotification("Вы успешно авторизовались в программе лояльности!")}catch(oe){f.error=((K=(q=oe.response)==null?void 0:q.data)==null?void 0:K.user_friendly_message)||"Ошибка",f.setState("not_found"),p.value=C.value,C.value=""}},L=r.computed(()=>{var q;const j=(q=u.value)==null?void 0:q.kiosk_hide_manual_input_loyalty_card;return j??!1}),re=()=>{f.setState("wait"),f.error="",C.value="",p.value=null},Q=()=>{f.closeDrawer(),p.value=null,C.value=""},ee=()=>{var j,q;f.setState("wait"),(q=(j=C.value)==null?void 0:j.trim())!=null&&q.length&&P(C.value.trim())},W=j=>{j.stopPropagation(),document.activeElement!==m.value&&X()},X=()=>{r.nextTick(()=>{m.value&&(m.value.focus(),w.value&&m.value.select())})},I=j=>{const q=document.activeElement===m.value;if(!N.value||q)return;const K=j.key.toLowerCase();if(K==="backspace")return C.value=C.value.slice(0,-1);if(K==="escape")return Q();if(K==="r"&&F.value)return re();if(K==="c"&&y.value==="success")return Q();if(K==="enter")return ee();C.value+=K},$={mounted(j){j==null||j.focus()}};return r.onMounted(()=>{document==null||document.addEventListener("keydown",I)}),r.onBeforeUnmount(()=>{document==null||document.removeEventListener("keydown",I)}),r.watchEffect(()=>{N.value&&(f.error="")}),(j,q)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[N.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:"backdrop show",onClick:Q,"aria-hidden":"true"})):r.createCommentVNode("",!0),N.value?(r.openBlock(),r.createElementBlock("section",{key:1,class:r.normalizeClass(["sheet show",{sheet_retry:F.value}]),"aria-modal":"true","aria-labelledby":"sheetTitle",onClick:W},[r.createElementVNode("header",W0,[r.createElementVNode("div",X0,r.toDisplayString(O.value),1),F.value?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(["sheet_status",D.value])},r.toDisplayString(p.value),3)):r.createCommentVNode("",!0),r.createElementVNode("button",{class:"sheet_close",onClick:Q,"aria-label":"Закрыть"}," Закрыть ")]),r.createElementVNode("div",$0,[r.createElementVNode("div",j0,[r.createElementVNode("div",{class:r.normalizeClass(["nfc",U.value])},[r.createVNode(G0,{styleRetry:H.value},null,8,["styleRetry"]),M.value?(r.openBlock(),r.createBlock(L0,{key:0})):r.createCommentVNode("",!0),r.createElementVNode("div",{class:"overlay check",style:r.normalizeStyle({display:R.value?"grid":"none"}),"aria-hidden":"true"},[r.createVNode(z0)],4)],2),r.createElementVNode("h2",q0,r.toDisplayString(T.value),1),r.createElementVNode("p",Z0,r.toDisplayString(v.value),1),r.createElementVNode("div",Y0,[r.withDirectives(r.createElementVNode("input",{style:r.normalizeStyle(L.value?{position:"absolute",left:"-9999px"}:{}),ref_key:"cardInputManualRef",ref:m,"onUpdate:modelValue":q[0]||(q[0]=K=>C.value=K),class:"nfc_title_read_input",type:"text",placeholder:"Введите трек карты","aria-live":"polite",onKeydown:r.withKeys(ee,["enter"])},null,36),[[r.vModelText,C.value],[$]]),F.value?(r.openBlock(),r.createElementBlock("button",{key:0,class:"btn btn_ghost",onClick:re},"Повторить")):(r.openBlock(),r.createElementBlock("div",K0,[L.value?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("button",{key:0,class:"btn btn_ghost",onClick:q[1]||(q[1]=K=>F.value?Q:ee())},"Отправить"))]))]),y.value==="wait"&&r.unref(u).kiosk_show_loyalty_phone_input_button?(r.openBlock(),r.createElementBlock("div",Q0,[r.createElementVNode("button",{class:"card_phone_auth_button",onClick:V},"Войти по номеру телефона")])):r.createCommentVNode("",!0)])]),r.createElementVNode("div",J0,r.toDisplayString(Z.value),1)],2)):r.createCommentVNode("",!0)],64))}}),e1="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgcm9sZT0iaW1nIiBhcmlhLWxhYmVsPSJJTk5PIGJhbmsgY2FyZCBpY29uIj4NCiAgPGRlZnM+DQogICAgPGxpbmVhckdyYWRpZW50IGlkPSJibGFja0dyYWQiIHgxPSIwIiB5MT0iMCIgeDI9IjEiIHkyPSIxIj4NCiAgICAgIDxzdG9wIG9mZnNldD0iMCUiIHN0b3AtY29sb3I9IiMxQTFBMUEiLz4NCiAgICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzAwMDAwMCIvPg0KICAgIDwvbGluZWFyR3JhZGllbnQ+DQoNCiAgICA8bGluZWFyR3JhZGllbnQgaWQ9InNoaW5lIiB4MT0iMCIgeTE9IjAiIHgyPSIxIiB5Mj0iMCI+DQogICAgICA8c3RvcCBvZmZzZXQ9IjAlIiBzdG9wLWNvbG9yPSIjRkZGRkZGIiBzdG9wLW9wYWNpdHk9IjAiLz4NCiAgICAgIDxzdG9wIG9mZnNldD0iNTAlIiBzdG9wLWNvbG9yPSIjRkZGRkZGIiBzdG9wLW9wYWNpdHk9IjAuMTgiLz4NCiAgICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI0ZGRkZGRiIgc3RvcC1vcGFjaXR5PSIwIi8+DQogICAgPC9saW5lYXJHcmFkaWVudD4NCg0KICAgIDxmaWx0ZXIgaWQ9InNoYWRvdyIgeD0iLTMwJSIgeT0iLTMwJSIgd2lkdGg9IjE2MCUiIGhlaWdodD0iMTYwJSI+DQogICAgICA8ZmVEcm9wU2hhZG93IGR4PSIwIiBkeT0iNiIgc3RkRGV2aWF0aW9uPSI2IiBmbG9vZC1jb2xvcj0iIzAwMCIgZmxvb2Qtb3BhY2l0eT0iMC4yNSIvPg0KICAgIDwvZmlsdGVyPg0KICA8L2RlZnM+DQoNCiAgPCEtLSBDZW50ZXJlZCBjYXJkIC0tPg0KICA8ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSg3LjUgMjMpIHJvdGF0ZSgtMTIpIiBmaWx0ZXI9InVybCgjc2hhZG93KSI+DQogICAgPCEtLSBjYXJkIGJvZHkgLS0+DQogICAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9Ijg1IiBoZWlnaHQ9IjU0IiByeD0iMTAiIGZpbGw9InVybCgjYmxhY2tHcmFkKSIvPg0KDQogICAgPCEtLSB0b3Agc3RyaXBlIC0tPg0KICAgIDxyZWN0IHg9IjAiIHk9IjgiIHdpZHRoPSI4NSIgaGVpZ2h0PSI4IiByeD0iNCIgZmlsbD0iI0ZGRkZGRiIgb3BhY2l0eT0iMC4wNSIvPg0KDQogICAgPCEtLSBjaGlwIC0tPg0KICAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEwIDI3KSI+DQogICAgICA8cmVjdCB3aWR0aD0iMTgiIGhlaWdodD0iMTUiIHJ4PSIzIiBmaWxsPSIjQ0ZBRTcwIi8+DQogICAgICA8cmVjdCB4PSIyLjUiIHk9IjMuNSIgd2lkdGg9IjEzIiBoZWlnaHQ9IjEuMiIgZmlsbD0iIzlFODM0RSIvPg0KICAgICAgPHJlY3QgeD0iMi41IiB5PSI2LjUiIHdpZHRoPSIxMyIgaGVpZ2h0PSIxLjIiIGZpbGw9IiM5RTgzNEUiLz4NCiAgICAgIDxyZWN0IHg9IjIuNSIgeT0iOS41IiB3aWR0aD0iMTMiIGhlaWdodD0iMS4yIiBmaWxsPSIjOUU4MzRFIi8+DQogICAgICA8cmVjdCB4PSI4LjUiIHk9IjAiIHdpZHRoPSIxLjUiIGhlaWdodD0iMTUiIGZpbGw9IiM5RTgzNEUiIG9wYWNpdHk9IjAuNiIvPg0KICAgIDwvZz4NCg0KICAgIDwhLS0gSU5OTyBsb2dvIC0tPg0KICAgIDx0ZXh0IHg9IjYxIiB5PSIzOSINCiAgICAgICAgICBmb250LWZhbWlseT0ic3lzdGVtLXVpLCAtYXBwbGUtc3lzdGVtLCBTZWdvZSBVSSwgUm9ib3RvLCBBcmlhbCwgc2Fucy1zZXJpZiINCiAgICAgICAgICBmb250LXNpemU9IjEzIg0KICAgICAgICAgIGZvbnQtd2VpZ2h0PSI4MDAiDQogICAgICAgICAgbGV0dGVyLXNwYWNpbmc9IjEuMiINCiAgICAgICAgICBmaWxsPSIjRkZGRkZGIg0KICAgICAgICAgIG9wYWNpdHk9IjAuOTUiDQogICAgICAgICAgdGV4dC1hbmNob3I9Im1pZGRsZSI+DQogICAgICBpbm5vDQogICAgPC90ZXh0Pg0KDQogICAgPCEtLSBzaGluZSAtLT4NCiAgICA8cGF0aCBkPSJNLTggNiBMMjUgLTMgTDk0IDQ3IEw2MCA2MiBMLTggMjUgWiIgZmlsbD0idXJsKCNzaGluZSkiLz4NCiAgPC9nPg0KPC9zdmc+",ha="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",t1=["src"],n1={class:"header_description"},r1=Xe(r.defineComponent({__name:"PaymentBoxes",props:{configPage:{},comment:{},cartItems:{},isAuthorized:{type:Boolean},orderId:{default:null},signal:{},provider:{}},emits:["select"],setup(a,{emit:l}){const o=a,i=l,u=Mt(),f=Lt(),{selectedProvider:m,isButtonDisabled:p}=we.storeToRefs(u),{isAddToCard:w}=we.storeToRefs(f),x={default:e1,SBP:ha},C=async()=>{m.value=o.provider;const N=o.provider.front_type;N&&(w.value=!1,p.value=!0,i("select",N),lo(o.orderId,o.provider.type))},y=r.computed(()=>x[o.provider.front_type]||x.default);return(N,O)=>(r.openBlock(),r.createElementBlock("div",{class:"payment_boxes_wrapper",onClick:C},[r.createElementVNode("img",{class:"picture",src:y.value},null,8,t1),r.createElementVNode("div",n1,[r.createElementVNode("b",null,r.toDisplayString(a.provider.name),1),r.createElementVNode("p",null,r.toDisplayString(a.provider.description),1)]),r.createVNode(_r)]))}}),[["__scopeId","data-v-c4a0ed62"]]),i1={key:0,class:"wrapper_cart_payment"},o1={class:"wrapper_paid"},s1={class:"to_be_paid"},a1=Xe(r.defineComponent({__name:"CartPayment",props:{configPage:{},comment:{},cartItems:{},isAuthorized:{type:Boolean},orderId:{},signal:{}},emits:["selectPayment"],setup(a,{emit:l}){const o=Mt(),i=st(),u=a,{totalPrice_lib:f,countBonus:m}=we.storeToRefs(i),p=l,w=C=>{p("selectPayment",C)},x=()=>{p("selectPayment","")};return(C,y)=>r.unref(o).providerTypes.length>1?(r.openBlock(),r.createElementBlock("div",i1,[y[2]||(y[2]=r.createElementVNode("h2",null,"Выберите способ оплаты",-1)),y[3]||(y[3]=r.createElementVNode("p",{class:"description_payment"},"Можно изменить позже до оплаты",-1)),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(o).providerTypes,(N,O)=>(r.openBlock(),r.createElementBlock("div",{key:O},[r.createVNode(r1,{provider:N,"config-page":u.configPage,comment:u.comment,"cart-items":u.cartItems,"is-authorized":u.isAuthorized,"order-id":u.orderId,signal:u.signal,onSelect:w},null,8,["provider","config-page","comment","cart-items","is-authorized","order-id","signal"])]))),128)),r.createElementVNode("div",o1,[r.createElementVNode("p",s1,[y[0]||(y[0]=r.createTextVNode("К оплате ",-1)),r.createVNode(ft,{price:r.unref(f)-r.unref(m),fixedFloat:2},null,8,["price"]),y[1]||(y[1]=r.createTextVNode(" ₽",-1))]),r.createVNode(an,{textButtonDefault:"Назад",onClick:x,class:"btn_payment"})])])):r.createCommentVNode("",!0)}}),[["__scopeId","data-v-f7657882"]]),l1={class:"start_page"},c1=["src"],d1={class:"wrap"},u1={class:"wrap_box"},f1={class:"title_fiscal_order"},h1={class:"wrapper_accept"},m1={ref:"barRef",class:"bar_complete","aria-hidden":"true"},g1=Xe(r.defineComponent({__name:"CartCompleteKioskSuccess",props:{mediaUrl:{},orderNumber:{}},setup(a){const l=st(),o=Mt(),i=Lt(),u=Rt(),{cartProducts_lib:f}=we.storeToRefs(l),{orderNumber:m,orderCompleted_lib:p,selectedOrderType:w}=we.storeToRefs(o),{is_startPage:x}=we.storeToRefs(i),{mediaUrl:C}=Tn(()=>u.itemThemes.kiosk_preloader?"preloader":null),y=Te.useRouter(),N=Te.useRoute();let O=null;r.onMounted(()=>{O=setTimeout(()=>{x.value=!u.itemThemes.kiosk_disable_lock_screen,w.value=null,l.isOrderTypeSubmited=!1,y.replace(`/${N.params.orgId}`)},1e4)});const T=()=>{mr(["cart","authTokensAccess","authTokensRefresh"]),f.value=[],p.value=null,w.value=null,l.isOrderTypeSubmited=!1,o.clearCard(),l.profile=null,y.replace(`/${N.params.orgId}`)};return r.onUnmounted(()=>{O&&clearInterval(O)}),(v,D)=>(r.openBlock(),r.createElementBlock("div",l1,[r.withDirectives((r.openBlock(),r.createElementBlock("video",{loop:"",autoplay:"",muted:"",playsinline:"",key:r.unref(C)},[r.createElementVNode("source",{src:r.unref(C)||"",type:"video/webm"},null,8,c1)])),[[r.unref(Xr)]]),D[4]||(D[4]=r.createElementVNode("div",{class:"start_img_black"},null,-1)),r.createElementVNode("div",d1,[r.createElementVNode("div",u1,[D[1]||(D[1]=r.createElementVNode("div",{class:"icon","aria-hidden":"true"},[r.createElementVNode("svg",{viewBox:"0 0 24 24"},[r.createElementVNode("path",{d:"M20 6L9 17l-5-5"})])],-1)),D[2]||(D[2]=r.createElementVNode("h1",null," Заказ успешно оплачен ",-1)),r.createElementVNode("p",f1,"№ "+r.toDisplayString(r.unref(m)),1),D[3]||(D[3]=r.createElementVNode("p",{class:"title_fiscal_completed"},"Спасибо! Заказ передан в работу.",-1)),r.createElementVNode("div",h1,[r.createElementVNode("button",{class:"btn","aria-label":"Новый заказ",onClick:T},[D[0]||(D[0]=r.createElementVNode("span",{class:"label"},"Новый заказ",-1)),r.createElementVNode("span",m1,null,512)])])])])]))}}),[["__scopeId","data-v-79c00acf"]]),p1={};function x1(a,l){return l[0]||(l[0]=r.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 w1=Xe(p1,[["render",x1],["__scopeId","data-v-3e03a6dc"]]),_1={},C1={class:"center"};function E1(a,l){return r.openBlock(),r.createElementBlock("div",C1,[...l[0]||(l[0]=[r.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 y1=Xe(_1,[["render",E1],["__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 An=function(){return An=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},An.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=[],N=0;N<this.size;N++)y.push(!1);for(var N=0;N<this.size;N++)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,N=0;N<8;N++){this.applyMask(N),this.drawFormatBits(N);var L=this.getPenaltyScore();L<k&&(C=N,k=L),this.applyMask(N)}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,N){if(p===void 0&&(p=1),C===void 0&&(C=40),y===void 0&&(y=-1),N===void 0&&(N=!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 L=m.getNumDataCodewords(M,_)*8,v=h.getTotalBits(x,M);if(v<=L){k=v;break}if(M>=C)throw new RangeError("Data too long")}for(var V=0,B=[m.Ecc.MEDIUM,m.Ecc.QUARTILE,m.Ecc.HIGH];V<B.length;V++){var O=B[V];N&&k<=m.getNumDataCodewords(M,O)*8&&(_=O)}for(var P=[],G=0,Z=x;G<Z.length;G++){var H=Z[G];i(H.mode.modeBits,4,P),i(H.numChars,H.mode.numCharCountBits(M),P);for(var ie=0,j=H.getData();ie<j.length;ie++){var se=j[ie];P.push(se)}}f(P.length==k);var oe=m.getNumDataCodewords(M,_)*8;f(P.length<=oe),i(0,Math.min(4,oe-P.length),P),i(0,(8-P.length%8)%8,P),f(P.length%8==0);for(var ne=236;P.length<oe;ne^=253)i(ne,8,P);for(var U=[];U.length*8<P.length;)U.push(0);return P.forEach(function(W,S){return U[S>>>3]|=W<<7-(S&7)}),new m(M,_,U,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,N=Math.floor(_/3);this.setFunctionModule(y,N,C),this.setFunctionModule(N,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)),N=x+C,M=_+p;0<=N&&N<this.size&&0<=M&&M<this.size&&this.setFunctionModule(N,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][_],N=Math.floor(m.getNumRawDataModules(_)/8),M=C-N%C,k=Math.floor(N/C),L=[],v=m.reedSolomonComputeDivisor(y),V=0,B=0;V<C;V++){var O=x.slice(B,B+k-y+(V<M?0:1));B+=O.length;var P=m.reedSolomonComputeRemainder(O,v);V<M&&O.push(0),L.push(O.concat(P))}for(var G=[],Z=function(H){L.forEach(function(ie,j){(H!=k-y||j>=M)&&G.push(ie[H])})},V=0;V<L[0].length;V++)Z(V);return f(G.length==N),G},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 N=p-y,M=(p+1&2)==0,k=M?this.size-1-C:C;!this.isFunction[k][N]&&_<x.length*8&&(this.modules[k][N]=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],N=0;N<this.size;N++)this.modules[_][N]==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[_][N],C=1);x+=this.finderPenaltyTerminateAndCount(p,C,y)*m.PENALTY_N3}for(var N=0;N<this.size;N++){for(var p=!1,M=0,y=[0,0,0,0,0,0,0],_=0;_<this.size;_++)this.modules[_][N]==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[_][N],M=1);x+=this.finderPenaltyTerminateAndCount(p,M,y)*m.PENALTY_N3}for(var _=0;_<this.size-1;_++)for(var N=0;N<this.size-1;N++){var k=this.modules[_][N];k==this.modules[_][N+1]&&k==this.modules[_+1][N]&&k==this.modules[_+1][N+1]&&(x+=m.PENALTY_N2)}for(var L=0,v=0,V=this.modules;v<V.length;v++){var B=V[v];L=B.reduce(function(G,Z){return G+(Z?1:0)},L)}var O=this.size*this.size,P=Math.ceil(Math.abs(L*20-O*10)/O)-1;return f(0<=P&&P<=9),x+=P*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 L=k^p.shift();p.push(0),_.forEach(function(v,V){return p[V]^=m.reedSolomonMultiply(v,L)})},y=0,N=x;y<N.length;y++){var M=N[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 N=y[C],M=N.mode.numCharCountBits(_);if(N.numChars>=1<<M)return 1/0;p+=4+M+N.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},h1=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}();function go(o){return o in ho}function la(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 ca(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,N=(h||p)*C,M=m==null?o.length/2-y/2:m*C,k=x==null?o.length/2-N/2:x*C,L=null;if(u.excavate){var v=Math.floor(M),V=Math.floor(k),B=Math.ceil(y+M-v),O=Math.ceil(N+k-V);L={x:v,y:V,w:B,h:O}}return{x:M,y:k,h:N,w:y,excavation:L}}function ua(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"}},g1=An(An({},mo),{renderAs:{type:String,required:!1,default:"canvas",validator:function(o){return["canvas","svg"].indexOf(o)>-1}}}),m1=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 N=ca(y,o.size,p,o.imageSettings);u={x:N.x+p,y:N.y+p,width:N.w,height:N.h},N.excavation&&(y=ua(y,N.excavation))}i.value=la(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",An({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",An({href:o.imageSettings.src},u))])}}}),p1=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,N=o.gradient,M=o.gradientType,k=o.gradientStartColor,L=o.gradientEndColor,v=p>>>0,V=go(x)?x:fo,B=i.value;if(B){var O=B.getContext("2d");if(O){var P=pr.QrCode.encodeText(m,ho[V]).getModules(),G=P.length+v*2,Z=u.value,H={x:0,y:0,width:0,height:0},ie=o.imageSettings.src&&Z!=null&&Z.naturalWidth!==0&&Z.naturalHeight!==0;if(ie){var j=ca(P,o.size,v,o.imageSettings);H={x:j.x+v,y:j.y+v,width:j.w,height:j.h},j.excavation&&(P=ua(P,j.excavation))}var se=window.devicePixelRatio||1,oe=_/G*se;if(B.height=B.width=_*se,O.scale(oe,oe),O.fillStyle=C,O.fillRect(0,0,G,G),N){var ne=void 0;M==="linear"?ne=O.createLinearGradient(0,0,G,G):ne=O.createRadialGradient(G/2,G/2,0,G/2,G/2,G/2),ne.addColorStop(0,k),ne.addColorStop(1,L),O.fillStyle=ne}else O.fillStyle=y;h1?O.fill(new Path2D(la(P,v))):P.forEach(function(U,W){U.forEach(function(S,z){S&&O.fillRect(z+v,W+v,1,1)})}),ie&&O.drawImage(Z,H.x,H.y,H.width,H.height)}}};l.onMounted(f),l.onUpdated(f);var h=s.attrs.style;return function(){return l.h(l.Fragment,[l.h("canvas",An(An({},s.attrs),{ref:i,style:An(An({},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,N=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:N})},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=qe(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=qe(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=qe(l.defineComponent({__name:"CompletedQRCode",setup(o){const s=yt(),i=bt(),u=at(),f=Oe.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 L=Math.floor(x.value/60),v=x.value%60;return`${L}:${v.toString().padStart(2,"0")}`}),C=l.computed(()=>x.value/m*100),y=l.computed(()=>i.paymentCostQR),N=()=>{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(N,1e3)}),l.onBeforeUnmount(()=>{clearInterval(_)});const{mediaUrl:k}=vn(()=>s.itemThemes.kiosk_preloader?"preloader":null);return(L,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(aa),width:"100",height:"100"},null,8,B1)]),v[6]||(v[6]=l.createElementVNode("h1",null,"Оплата по QR",-1)),l.createElementVNode("p",M1,[l.createVNode(Ut,{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(on,{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=qe(l.defineComponent({__name:"CartCompletedOrder",props:{orderNumber:{}},setup(o){const s=bt(),i=yt(),{orderNumber:u,orderCompleted_lib:f}=_e.storeToRefs(s),{mediaUrl:h}=vn(()=>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"]]);function J1(){const o=Oe.useRoute(),s=bt(),i=at(),{isButtonDisabled:u}=_e.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 Su(x.items,x.tableDataId,_,{comment:x.comment,is_authorized:x.isAuthorized,signal:x.signal})}}}const ef={},tf={class:"cart_loyal_qr",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"};function nf(o,s){return l.openBlock(),l.createElementBlock("svg",tf,[...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 rf=qe(ef,[["render",nf]]),da=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}},of={class:"cart_deletion_modal_content"},sf={class:"cart_deletion_modal_title"},af={class:"cart_deletion_modal_footer"},lf=qe(l.defineComponent({__name:"CartDeleteConfirm",emits:["confirm"],setup(o,{emit:s}){const i=s,{visible:u,context:f,close:h}=da("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",of,[l.createElementVNode("div",sf,"Удалить "+l.toDisplayString(l.unref(f).name)+"?",1),_[2]||(_[2]=l.createElementVNode("div",{class:"cart_deletion_modal_body"},"Эта позиция будет полностью удалена из заказа.",-1)),l.createElementVNode("div",af,[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"]]),cf={class:"cart_wrapper"},uf={class:"cart_header_content"},df={key:0,class:"cart_header_subwrapper"},ff={class:"cart_kso_button_wrapper"},hf={key:0},gf={key:0,class:"kso_btn_wrapper"},mf=["src"],pf={key:0,class:"cart_qr_button_wrapper"},xf={class:"cart_header_info"},wf={class:"cart_header_info"},_f={class:"cart_header_info"},Cf={class:"cart_header_info"},Ef={key:1,class:"cart-tabs-wrapper"},yf={class:"cart-tabs-container"},bf=["data-active","onClick"],Af={key:0,class:"wrapper_comment"},If={class:"wrapper_limit_in_area"},Sf=["placeholder","aria-invalid"],Nf={class:"limit_comment"},Tf={key:1,class:"wrapper_comment"},kf={class:"wrapper_limit_in_area"},Rf=["placeholder","aria-invalid"],Of={class:"limit_comment"},Bf={key:2},Mf={class:"cart_cards"},vf={class:"cart_footer_wrapper"},Df={key:0,class:"footer_title"},Pf=["disabled","max"],Lf={key:1,class:"footer_sales"},Ff=["step","max"],Vf={class:"list_price"},Uf={key:0},zf={key:1},Hf={key:2},Gf={class:"accept_field"},Wf={class:"accept_field"},Xf={key:3},jf={class:"accept_field"},qf={class:"accept_field"},Zf={class:"accept_field"},Yf={key:3,class:"cart_min_order_notice"},$f={class:"wrapper_footer_cart_btn"},Kf=l.defineComponent({__name:"CartPage",props:{configPage:{},textPaymentBtn:{},config_qr:{type:Boolean}},setup(o){const s=yn.create();let i;const u=at(),f=bt(),h=yt(),m=o,{totalPrice_lib:x,countBonus:_,config_lib:p,cartProducts_lib:C,profile:y}=_e.storeToRefs(u),{itemThemes:N}=_e.storeToRefs(h),{textPaymentBtn_lib:M,isButtonDisabled:k,orderCompleted_lib:L,orderNumber:v,extraDiscount:V,is_notification_lib:B,isCreateButtonVisible:O,is_paymentCart:P,providerTypes:G,notificationData_lib:Z,selectedProvider:H,configPayment:ie}=_e.storeToRefs(f),j=Oe.useRouter(),se=Oe.useRoute(),oe=l.useTemplateRef("stickerLoyality"),ne=l.ref(!1),U=l.ref(!1),W=l.ref(!1),S=l.useTemplateRef("commentEl"),z=l.ref(""),X=l.ref(!1),q=l.ref(!1),$=l.ref(!1),re=l.ref(0),he=l.ref(0),fe=l.ref(),Ee=l.computed(()=>m.configPage.qr_menu?"YOOKASSA_BASE":G.value[0].front_type),me=l.computed(()=>m.configPage.qr_menu?"YOOKASSA":G.value[0].type),Ve=l.computed(()=>{var ee,ae;return m.configPage.kiosk_menu&&((ee=p.value)==null?void 0:ee.loyalty)==="IIKO"&&(p.value.has_loyalty_default_user||y.value)||m.configPage.qr_menu&&((ae=p.value)==null?void 0:ae.loyalty)==="IIKO"&&(y.value||N.value.qr_auth_required===!1)}),xe=l.computed(()=>["АВТОРИЗОВАТЬСЯ ДЛЯ ЗАКАЗА"].includes(M.value.toUpperCase())?M.value:O.value?"Создать заказ":M.value),{width:ht}=Vt.useElementSize(oe,{width:0,height:0},{box:"border-box"}),He=l.computed(()=>{const ee={energy_amount:0,proteins_amount:0,fat_amount:0,carbohydrates_amount:0};return C.value.reduce((ae,ye)=>(ae.energy_amount+=(ye.energy_amount||0)*(ye.amount||0),ae.proteins_amount+=(ye.proteins_amount||0)*(ye.amount||0),ae.fat_amount+=(ye.fat_amount||0)*(ye.amount||0),ae.carbohydrates_amount+=(ye.carbohydrates_amount||0)*(ye.amount||0),ae),ee)}),Ae=l.computed(()=>{var ee;if((ee=N.value)!=null&&ee.comments){const ae=N.value.comments;return{fieldName:m.configPage.kiosk_menu?ae.kiosk_comment_field_name:ae.qr_comment_field_name,placeholder:m.configPage.kiosk_menu?ae.kiosk_comment_field_placeholder:ae.qr_comment_field_placeholder,show:m.configPage.kiosk_menu?ae.kiosk_show_order_comment:ae.qr_show_order_comment}}}),Ge=Vt.computedAsync(async ee=>{var Ye;const ae=new AbortController;if(ee(()=>ae.abort()),!ne.value||!((Ye=y.value)!=null&&Ye.balance)||!x.value)return 0;const ye=await s.maxPayByBonuses(fe.value,m.configPage.kiosk_menu,!!m.configPage.userData||!!y.value,ae.signal);return ye!=null&&ye.by_bonuses?(W.value=ye.non_integers_allowed||!1,Math.min(ye.by_bonuses,y.value.balance,x.value)):0},0,{shallow:!0}),Qe=()=>j.push(`/${se.params.orgId}/`),kt=ee=>{(W.value?["a","A","+","-","."]:["a","A","+","-",".",","]).includes(ee.key)&&ee.preventDefault()},Te=ee=>{u.deleteItemFromCart(ee),C.value.length===0&&(q.value=!1,$.value=!1)},Ie=()=>{q.value=!q.value,z.value.length},Ue=l.computed(()=>{var ae;return(((ae=N.value.cart_loyalty_button)==null?void 0:ae.cart_loyalty_button_text)||"Программа лояльности").replace(/\S+/g,ye=>ye.length>15?ye.slice(0,15)+"...":ye)}),lt=()=>{$.value=!$.value,z.value.length},We=()=>{let ee=W.value?+_.value.toFixed(2):Math.floor(_.value)||0;ee>Ge.value&&(ee=Ge.value),ee!==_.value&&u.setBonus(ee)};l.watchEffect(()=>{We(),u.setBonus(x.value===0?0:W.value?+_.value.toFixed(2):Math.floor(_.value))});const $e=()=>C.value.map(ee=>({id:ee.id,front_item_id:ee.idSystem,is_fake:!!ee.is_fake,is_od_united_product:!!ee.is_od_united_product,removals:ee.removals??null,amount:ee.amount,size:ee.size,modifiers:ee.modifiers??[],group_modifiers:ee.group_modifiers??[]})),{makeCreateOrderRequest:Me}=J1(),nr=l.computed(()=>$e()),we=l.computed(()=>{var ee,ae,ye,Ye;return m.configPage.qr_menu&&((ae=(ee=N.value)==null?void 0:ee.comments)==null?void 0:ae.qr_is_order_comment_required)||m.configPage.kiosk_menu&&((Ye=(ye=N.value)==null?void 0:ye.comments)==null?void 0:Ye.kiosk_is_order_comment_required)}),rr=()=>{var ee,ae;return we.value&&((ae=(ee=z.value)==null?void 0:ee.trim())==null?void 0:ae.length)<1&&S.value?(f.showNotification("Обязательно перед созданием заказа укажите комментарий к заказу"),S.value.focus(),X.value=!0,Et.animate(S.value.parentElement,{x:[0,-10,0,10,0]},{duration:.1,repeat:2}),!0):!1},Ai=async()=>{if(m.configPage.qr_menu&&!y.value&&N.value.qr_auth_required!==!1){j.push(`/${se.params.orgId}/register`);return}if(!(we.value&&rr())){if(m.configPage.qr_menu||G.value.length<=1){k.value=!0,await Xs(fe.value,me.value).then(ee=>{const ae=ie.value;ae&&(ae.is_tableservice?bu(ae,null):ee.url&&m.configPage.qr_menu&&window.location.replace(ee.url))});return}return P.value=!P.value}},xn=()=>{P.value=!1},Hr=async()=>{var ae,ye,Ye,wn,Pn,zn;V.value=0;const ee={items:[...$e()],table:((ae=m.configPage)==null?void 0:ae.tableDataId)||null,comment:z.value,combos:[]};(ye=m.configPage)!=null&&ye.kiosk_menu&&((Ye=f.selectedOrderType)!=null&&Ye.id)&&(ee.order_type_id=(wn=f.selectedOrderType)==null?void 0:wn.id);try{U.value=!0;const ve=await s.calculateDiscount(ee,m.configPage.kiosk_menu,!!m.configPage.userData||!!y.value,i.signal);if(!C.value)return;C.value.forEach(Be=>{const zt=ve.items.find(It=>It.front_item_id===Be.idSystem);if(zt&&(Be.group_modifiers.forEach(It=>{const it=zt.group_modifiers.find(Rt=>Rt.group===It.group);it&&It.modifiers.forEach(Rt=>{const nt=it.modifiers.find(sn=>sn.id===Rt.id);if(nt&&Number(Rt.price)!==Number(nt==null?void 0:nt.new_price)){const sn=(nt.discounts||[]).reduce((Cr,an)=>Cr+=+an.discount,0);re.value+=sn,Rt.new_price=Rt.price,Rt.price=Number(nt==null?void 0:nt.new_price),Rt.total_new_price=Number(nt.total_new_price)}})}),Be.modifiers.forEach(It=>{const it=zt.modifiers.find(Rt=>Rt.id===It.id);if(it&&Number(It.price)!==Number(it==null?void 0:it.new_price)){const Rt=(it.discounts||[]).reduce((nt,sn)=>nt+=+sn.discount,0);re.value+=Rt,It.new_price=It.price,It.price=Number(it==null?void 0:it.new_price),It.total_new_price=Number(it.total_new_price)}}),Be.price!==Number(zt.new_price))){const It=(zt.discounts||[]).reduce((it,Rt)=>it+=+Rt.discount,0);re.value=re.value+It,Be.new_price=Be.price,Be.price=zt.new_price,Be.discounts=zt.discounts,Be.total_new_price=Number(zt.total_new_price)}}),C.value=[...C.value],re.value!==0&&(x.value=ve.total_cart_price)}catch(ve){if(U.value=!1,!et.isCancel(ve))throw f.showNotification(((zn=(Pn=ve==null?void 0:ve.response)==null?void 0:Pn.data)==null?void 0:zn.user_friendly_message)||"Скидки временно недоступны"),ve}},tn=async()=>{var ee;if(!(we.value&&rr())){fe.value=null,i=new AbortController,k.value=!0;try{Ve.value&&await Hr(),H.value={front_type:Ee};const ae={paymentMethodId:Ee.value,items:nr.value,tableDataId:m.configPage.tableDataId,comment:z.value,isAuthorized:!!m.configPage.userData||!!y,signal:i==null?void 0:i.signal},ye=await Me(m.configPage,ae);fe.value=(ee=ye==null?void 0:ye.data)==null?void 0:ee.id,O.value=!1}catch{k.value=!1,O.value=!0,u.setBonus(0)}}},Ii=()=>m.configPage.qr_menu&&["АВТОРИЗОВАТЬСЯ ДЛЯ ЗАКАЗА"].includes(M.value.toUpperCase())&&!y.value&&N.value.qr_auth_required!==!1?j.push(`/${se.params.orgId}/register`):O.value?tn():Ai(),In=()=>{var ee;(ee=y.value)!=null&&ee.balance?y.value.balance>=1&&(ne.value=!ne.value):f.showNotification("У Вас пока нет бонусов")};l.onMounted(async()=>{M.value=m.textPaymentBtn,u.loadCart(),L.value=null,x.value=null,V.value=0,O.value=!0,u.setBonus(0),C.value.splice(0,C.value.length,...C.value.map(u.makeProductFullyReactive))}),l.onUnmounted(()=>{i&&(i==null||i.abort(),i=null),k.value=!1,fe.value=null,L.value=null,x.value=null,V.value=0,C.value.splice(0,C.value.length,...C.value.map(u.makeProductFullyReactive))});const At=l.computed(()=>x.value-V.value-re.value),Un=l.computed(()=>m.configPage.qr_menu?p.value.qr_order_minimum_price||0:m.configPage.kiosk_menu&&p.value.kiosk_order_minimum_price||0),_r=l.computed(()=>Un.value>At.value||U.value||k.value?!0:["АВТОРИЗОВАТЬСЯ ДЛЯ ЗАКАЗА"].includes(M.value.toUpperCase())?!1:C.value.length===0?!0:(L.value=null,k.value)),Gr=l.computed(()=>{var ee;return((ee=C.value)==null?void 0:ee.reduce((ae,ye)=>ae+ye.amount,0))||0}),mt=l.computed(()=>{var ee;return(ee=y.value)==null?void 0:ee.phone});return l.watch(z,ee=>{var ae;return((ae=ee==null?void 0:ee.trim())==null?void 0:ae.length)&&(X.value=!1)}),l.watch([Gr,mt,()=>f.selectedOrderType],()=>{Gr.value===0&&(i=null),i==null||i.abort(),k.value=!1}),l.watch([()=>u.cartProducts_lib,mt,Gr,()=>f.selectedOrderType],ee=>{if(he.value>0){he.value--;return}ee&&!U.value&&(O.value=!0,ne.value=!1,u.setBonus(0),C.value.splice(0,C.value.length,...C.value.map(u.makeProductFullyReactive)),re.value=0,x.value=null,V.value=0,he.value=1),U.value=!1},{deep:!0}),(ee,ae)=>{var ye,Ye,wn,Pn,zn,ve;return l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createElementVNode("div",cf,[l.createVNode(lf,{onConfirm:Te}),l.createVNode(ia,{visible:l.unref(f).isDrawerOpen,"onUpdate:visible":ae[0]||(ae[0]=Be=>l.unref(f).isDrawerOpen=Be)},{default:l.withCtx(()=>[l.createVNode(sa)]),_:1},8,["visible"]),l.createElementVNode("header",uf,[m.configPage.kiosk_menu?(l.openBlock(),l.createElementBlock("div",df,[l.createElementVNode("div",ff,[l.createElementVNode("div",{class:l.normalizeClass(["arrow_wrapper",{arrow_wrapper_kso:m.configPage.kiosk_menu}]),onClick:Qe},[l.createVNode(Fr,{class:"cart_header_back_button"}),m.configPage.kiosk_menu?(l.openBlock(),l.createElementBlock("span",hf,"Назад")):l.createCommentVNode("",!0)],2)]),Ae.value&&Ae.value.show?(l.openBlock(),l.createElementBlock("div",gf,[we.value?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(on,{key:0,style:l.normalizeStyle({visibility:!q.value&&l.unref(C).length>0?"visible":"hidden"}),class:l.normalizeClass({button_kso_comment:o.configPage.kiosk_menu}),textButtonDefault:z.value.length>0?"Редактировать":Ae.value&&Ae.value.fieldName||"",onClick:()=>q.value=!q.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(N).kiosk_show_loyalty_card_button||l.unref(N).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:(ye=l.unref(N).cart_loyalty_button)!=null&&ye.cart_loyalty_button_sticker?`${Math.ceil(l.unref(ht)/2+10)}px`:"",paddingRight:(Ye=l.unref(N).cart_loyalty_button)!=null&&Ye.cart_loyalty_button_sticker?0:""}),onClick:ae[1]||(ae[1]=(...Be)=>l.unref(f).openDrawer&&l.unref(f).openDrawer(...Be))},[l.createElementVNode("p",{class:"cart_loyal_program",style:l.normalizeStyle({marginRight:`${Math.ceil(l.unref(ht)/2)}px`})},l.toDisplayString(Ue.value),5),(wn=l.unref(N).cart_loyalty_button)!=null&&wn.cart_loyalty_button_sticker?(l.openBlock(),l.createElementBlock("div",{key:0,ref_key:"stickerLoyality",ref:oe,class:"cart_loyal_program_icon",style:l.normalizeStyle({"--sticker-mask":`url(${l.unref(N).cart_loyalty_button.cart_loyalty_button_sticker})`})},[l.createElementVNode("img",{src:l.unref(N).cart_loyalty_button.cart_loyalty_button_sticker},null,8,mf)],4)):(l.openBlock(),l.createBlock(rf,{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",pf,[l.createElementVNode("div",{class:"arrow_wrapper",onClick:Qe},[l.createVNode(Fr,{class:"cart_header_back_button"})])])):l.createCommentVNode("",!0),l.unref(N).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",xf,[l.createElementVNode("p",null,[l.createVNode(Ut,{price:He.value.energy_amount,duration:800},null,8,["price"]),ae[8]||(ae[8]=l.createTextVNode(" г",-1))]),ae[9]||(ae[9]=l.createElementVNode("p",{class:"cart_info_name"},"Килокалории",-1))]),l.createElementVNode("div",wf,[l.createElementVNode("p",null,[l.createVNode(Ut,{price:He.value.proteins_amount,duration:900},null,8,["price"]),ae[10]||(ae[10]=l.createTextVNode(" г",-1))]),ae[11]||(ae[11]=l.createElementVNode("p",{class:"cart_info_name"},"Белки",-1))]),l.createElementVNode("div",_f,[l.createElementVNode("p",null,[l.createVNode(Ut,{price:He.value.fat_amount,duration:1e3},null,8,["price"]),ae[12]||(ae[12]=l.createTextVNode(" г",-1))]),ae[13]||(ae[13]=l.createElementVNode("p",{class:"cart_info_name"},"Жиры",-1))]),l.createElementVNode("div",Cf,[l.createElementVNode("p",null,[l.createVNode(Ut,{price:He.value.carbohydrates_amount,duration:1100},null,8,["price"]),ae[14]||(ae[14]=l.createTextVNode(" г",-1))]),ae[15]||(ae[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",Ef,[l.createElementVNode("ul",yf,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(f).orderTypes,Be=>{var zt,It;return l.openBlock(),l.createElementBlock("li",{key:Be.id,class:"cart-tab","data-active":Be.id===((zt=l.unref(f).selectedOrderType)==null?void 0:zt.id),onClick:it=>l.unref(f).selectedOrderType=Be},[Be.id===((It=l.unref(f).selectedOrderType)==null?void 0:It.id)?(l.openBlock(),l.createBlock(l.unref(Et.motion).div,{key:0,class:"cart-underline","layout-id":"cart-underline",id:"cart-underline"})):l.createCommentVNode("",!0),l.createElementVNode("span",null,l.toDisplayString(Be.name),1)],8,bf)}),128))])])):l.createCommentVNode("",!0)]),(we.value||q.value)&&o.configPage.kiosk_menu&&((Pn=l.unref(C))!=null&&Pn.length)?(l.openBlock(),l.createElementBlock("div",Af,[l.createElementVNode("div",If,[l.withDirectives(l.createElementVNode("textarea",{ref_key:"commentEl",ref:S,class:"comment_order",placeholder:Ae.value&&Ae.value.placeholder||"Ваш комментарий к заказу...",name:"commentKso",maxlength:"50","aria-invalid":X.value,"onUpdate:modelValue":ae[2]||(ae[2]=Be=>z.value=Be)},null,8,Sf),[[l.vModelText,z.value]]),l.createElementVNode("p",Nf,l.toDisplayString(z.value.length+" / 50"),1)]),we.value?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(on,{key:0,textButtonDefault:"Сохранить",onClick:Ie,class:"button_bonus_cart"}))])):l.createCommentVNode("",!0),(we.value||$.value)&&o.config_qr&&((zn=l.unref(C))!=null&&zn.length)?(l.openBlock(),l.createElementBlock("div",Tf,[l.createElementVNode("div",kf,[l.withDirectives(l.createElementVNode("textarea",{ref_key:"commentEl",ref:S,class:"comment_order",placeholder:Ae.value&&Ae.value.placeholder||"Ваш комментарий к заказу...",name:"commentQr",maxlength:"50","aria-invalid":X.value,"onUpdate:modelValue":ae[3]||(ae[3]=Be=>z.value=Be)},null,8,Rf),[[l.vModelText,z.value]]),l.createElementVNode("p",Of,l.toDisplayString(z.value.length+" / 50"),1)]),we.value?l.createCommentVNode("",!0):(l.openBlock(),l.createBlock(on,{key:0,textButtonDefault:"Сохранить",onClick:lt,class:"button_bonus_cart"}))])):l.createCommentVNode("",!0),o.config_qr&&Ae.value&&Ae.value.show?(l.openBlock(),l.createElementBlock("div",Bf,[!we.value&&!$.value&&l.unref(C).length>0?(l.openBlock(),l.createBlock(on,{key:0,textButtonDefault:z.value.length>0?"Редактировать":Ae.value.fieldName||"",onClick:()=>$.value=!$.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),Be=>(l.openBlock(),l.createBlock(oa,{key:Be.idSystem,cardItem:Be,onDelete:zt=>Te(Be.idSystem)},null,8,["cardItem","onDelete"]))),128))]),l.createElementVNode("div",vf,[ne.value&&!l.unref(O)?(l.openBlock(),l.createElementBlock("p",Df,[ae[16]||(ae[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||((ve=l.unref(y))==null?void 0:ve.balance)===0,"onUpdate:modelValue":ae[4]||(ae[4]=Be=>l.isRef(_)?_.value=Be:null),onInput:We,min:"0",max:l.unref(Ge),step:".01",onKeypress:kt},null,44,Pf),[[l.vModelText,l.unref(_),void 0,{number:!0}]]),ae[17]||(ae[17]=l.createTextVNode(" бонусов ",-1))])):l.createCommentVNode("",!0),ne.value&&!l.unref(O)?(l.openBlock(),l.createElementBlock("p",Lf,"У вас есть "+l.toDisplayString(l.unref(y)?l.unref(y).balance:0)+" B",1)):l.createCommentVNode("",!0),ne.value&&!l.unref(O)?l.withDirectives((l.openBlock(),l.createElementBlock("input",{key:2,type:"range",class:"footer_range","onUpdate:modelValue":ae[5]||(ae[5]=Be=>l.isRef(_)?_.value=Be:null),step:W.value?".01":"1",min:0,max:l.unref(Ge)},null,8,Ff)),[[l.vModelText,l.unref(_),void 0,{number:!0}]]):l.createCommentVNode("",!0),l.createElementVNode("ul",Vf,[ne.value&&!l.unref(O)?(l.openBlock(),l.createElementBlock("li",Uf,[ae[19]||(ae[19]=l.createElementVNode("p",null,"Сумма заказа:",-1)),l.createElementVNode("p",null,[l.createVNode(Ut,{price:l.unref(x),fixedFloat:2},null,8,["price"]),ae[18]||(ae[18]=l.createTextVNode(" ₽",-1))])])):l.createCommentVNode("",!0),ne.value&&!l.unref(O)?(l.openBlock(),l.createElementBlock("li",zf,[ae[21]||(ae[21]=l.createElementVNode("p",null,"Будет оплачено бонусами:",-1)),l.createElementVNode("p",null,[l.createVNode(Ut,{price:l.unref(_),fixedFloat:2},null,8,["price"]),ae[20]||(ae[20]=l.createTextVNode(" Б",-1))])])):l.createCommentVNode("",!0),l.unref(V)!==0?(l.openBlock(),l.createElementBlock("li",Hf,[l.createElementVNode("p",Gf,l.toDisplayString(l.unref(V)>0?"Надбавка":"Скидка")+": ",1),l.createElementVNode("p",Wf,[l.createVNode(Ut,{price:Math.abs(l.unref(V)),fixedFloat:2},null,8,["price"]),ae[22]||(ae[22]=l.createTextVNode(" ₽",-1))])])):re.value!==0?(l.openBlock(),l.createElementBlock("li",Xf,[l.createElementVNode("p",jf,l.toDisplayString(re.value>0?"Надбавка":"Скидка")+": ",1),l.createElementVNode("p",qf,[l.createVNode(Ut,{price:Math.abs(re.value),fixedFloat:2},null,8,["price"]),ae[23]||(ae[23]=l.createTextVNode(" ₽",-1))])])):l.createCommentVNode("",!0),l.createElementVNode("li",null,[ae[25]||(ae[25]=l.createElementVNode("p",{class:"accept_field"},"Итого к оплате:",-1)),l.createElementVNode("p",Zf,[l.createVNode(Ut,{price:l.unref(x)-l.unref(_),fixedFloat:2},null,8,["price"]),ae[24]||(ae[24]=l.createTextVNode(" ₽",-1))])])]),Un.value&&At.value<Un.value?(l.openBlock(),l.createElementBlock("div",Yf,[ae[26]||(ae[26]=l.createTextVNode(" Минимальная сумма заказа ",-1)),l.createVNode(Ut,{price:Un.value,fixedFloat:2},null,8,["price"]),l.createTextVNode(" "+l.toDisplayString(l.unref(p).currency_symbol)+". Для оформления заказа необходимо добавить товаров на сумму ",1),l.createVNode(Ut,{price:Un.value-At.value,fixedFloat:2},null,8,["price"]),l.createTextVNode(" "+l.toDisplayString(l.unref(p).currency_symbol),1)])):l.createCommentVNode("",!0),l.createElementVNode("div",$f,[l.unref(y)&&!l.unref(O)?(l.openBlock(),l.createBlock(on,{key:0,textButtonDefault:l.unref(N).bonuses_button_name||"Бонусы",onClick:In,class:"button_bonus_cart"},null,8,["textButtonDefault"])):l.createCommentVNode("",!0),l.createVNode(on,{textButtonDefault:xe.value,onClick:Ii,class:"button_payment_cart",disabled:_r.value},null,8,["textButtonDefault","disabled"])])])]),l.createVNode(Q1,{orderNumber:l.unref(v),pageNumber:1},null,8,["orderNumber"]),l.createVNode(pi,{visible:l.unref(B),"onUpdate:visible":ae[6]||(ae[6]=Be=>l.isRef(B)?B.value=Be:null),textNotificationDefault:l.unref(Z).textNotification,backgroundColor:l.unref(N).accent_color?l.unref(N).accent_color:"#FF6D2E",buttonAccept:null},null,8,["visible","textNotificationDefault","backgroundColor"]),l.createVNode(co,{modelValue:l.unref(P),"onUpdate:modelValue":ae[7]||(ae[7]=Be=>l.isRef(P)?P.value=Be:null),class:"product_card_sheet","snap-points":["80%"]},{default:l.withCtx(()=>{var Be;return[l.createVNode(K0,{"config-page":o.configPage,comment:z.value,"cart-items":nr.value,"is-authorized":!!m.configPage.userData||!!l.unref(y),"order-id":fe.value,signal:(Be=l.unref(i))==null?void 0:Be.signal,onSelectPayment:xn},null,8,["config-page","comment","cart-items","is-authorized","order-id","signal"])]}),_:1},8,["modelValue"])],64)}}}),Qf={},Jf={viewBox:"0 0 24 24"};function eh(o,s){return l.openBlock(),l.createElementBlock("svg",Jf,[...s[0]||(s[0]=[l.createElementVNode("path",{d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const th=qe(Qf,[["render",eh]]),nh={class:"retry_screen"},rh={class:"retry_all_in_screen"},ih={class:"retry_content"},oh={class:"retry_icon_wrap"},sh={class:"retry_icon_circle"},ah={class:"retry_error_x"},lh=l.defineComponent({__name:"RetryPage",setup(o){const s=bt(),i=Oe.useRouter(),u=Oe.useRoute(),f=()=>{s.notificationData_lib.textNotification="",s.is_notification_lib=!1,i.replace(`/${u.params.orgId}/`)};return(h,m)=>(l.openBlock(),l.createElementBlock("section",nh,[l.createElementVNode("div",rh,[l.createElementVNode("main",ih,[l.createElementVNode("div",oh,[l.createElementVNode("div",sh,[m[0]||(m[0]=l.createElementVNode("div",{class:"retry_loader_mini"},null,-1)),l.createElementVNode("div",ah,[l.createVNode(th)])])]),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))])]))}}),ch={class:"wrapper_loader"},uh=l.defineComponent({__name:"Loader",props:{size:{type:String,default:"40px"}},setup(o){return(s,i)=>(l.openBlock(),l.createElementBlock("div",ch,[l.createElementVNode("div",{class:"loader",style:l.normalizeStyle({width:o.size})},null,4)]))}}),dh=qe(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"]]),fh={key:0},hh={class:"card__main__wrapper"},gh={key:0,class:"folder_content_top"},mh={key:0,class:"loader_card_main"},ph=["src","alt"],xh={class:"card_title_price_wrapper"},wh={class:"title"},_h={key:0,class:"price"},Ch={key:1},Eh={key:0,class:"card_button_add_wrapper"},fa=qe(l.defineComponent({__name:"CardMain",props:{data:{},activeTags:{},is_group:{type:Boolean},parent:{},isLoading:{type:Boolean},selectGroupChild:{type:Function},takeCurrentCard:{type:Function}},setup(o){yt();const s=at(),i=Tt(),{is_18_above_content:u,is18Allowed:f,notificationData_lib:h}=_e.storeToRefs(s),{isDesktop:m}=bn(),x=o,_=(N,M)=>{var v,V,B;const k={id:N.id,is_fake:N.is_fake||!1,is_od_united_product:N.is_od_united_product||!1,amount:N.amount||1,name:N.name,image_link:N.image_link,price:N.price,old_price:N.price,size:void 0,sizes:[],modifiers:[],groups:N.groups,group_modifiers:[],energy_amount:N.energy_amount??0,proteins_amount:N.proteins_amount??0,fat_amount:N.fat_amount??0,carbohydrates_amount:N.carbohydrates_amount??0},L=!((v=N.modifiers)!=null&&v.length)&&!((V=N.group_modifiers)!=null&&V.length)&&!((B=N.sizes)!=null&&B.length);if(i.isUpSale=!1,N.adult&&!f.value){u.value=!0,L&&(h.value.fastAdd=k);return}if(L){s.addToCart(k);return}if(N.amount||(N.amount=1),x.is_group&&x.selectGroupChild){x.selectGroupChild({...N,parent:x.parent,child:M.child_groups});return}x.takeCurrentCard&&x.takeCurrentCard(M.id)},p=N=>{if(x.is_group&&x.selectGroupChild){N={...N,parent:x.parent,child:N.child_groups},x.selectGroupChild(N);return}if(N.adult&&!f.value){u.value=!0;return}x.takeCurrentCard&&x.takeCurrentCard(N.id)},C=l.computed(()=>x.activeTags.every(N=>x.data.tags.includes(N))),{mediaUrl:y}=vn(()=>x.data.id+"_image",()=>x.data.image_link);return(N,M)=>{var k;return((k=x.activeTags)==null?void 0:k.length)===0||C.value||x.is_group?(l.openBlock(),l.createElementBlock("div",fh,[l.createVNode(dh,{id:x.data.id},{opacityLoader:l.withCtx(()=>[l.createElementVNode("div",hh,[o.is_group?(l.openBlock(),l.createElementBlock("div",gh)):l.createCommentVNode("",!0),l.createElementVNode("div",{onClick:M[0]||(M[0]=L=>p(x.data)),class:l.normalizeClass(["card__main",{card__main_folder:o.is_group}])},[o.isLoading?(l.openBlock(),l.createElementBlock("div",mh,[l.createVNode(uh)])):(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,ph),l.createElementVNode("div",xh,[l.createElementVNode("p",wh,l.toDisplayString(o.data.name),1),o.is_group?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("p",_h,l.toDisplayString(l.unref(ur)(o.data))+" ₽",1))])],2))],2),l.unref(m)?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("div",Ch,[o.is_group?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("div",Eh,[l.createElementVNode("div",{onClick:M[1]||(M[1]=L=>_(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"]]),yh=["id","onClick"],bh=qe(l.defineComponent({__name:"GroupMain",props:{menuGroup:{},idActiveGroup:{},activeTakeGroup:{type:Function}},setup(o){const{shouldUseDragScroll:s}=bn(),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,yh))),128))]),_:1},8,["container","idActive"])])),[[l.unref(Lr),l.unref(s)?{}:!1]]):l.createCommentVNode("",!0)}}),[["__scopeId","data-v-aa0ca388"]]),Ah=["id","onClick"],Ih=qe(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}=bn(),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,Ah))),128))]),_:1},8,["container","idActive"])])),[[l.unref(Lr),l.unref(i)?{}:!1]]):l.createCommentVNode("",!0)}}),[["__scopeId","data-v-afba730a"]]),Sh=["data-id"],Nh=["src"],Th=["src"],kh=qe(l.defineComponent({__name:"DrumItem",props:{group:{},index:{},active:{type:Boolean}},setup(o){const s=o,{mediaUrl:i}=vn(()=>{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,Nh)])),[[l.unref(Vr)]]):(l.openBlock(),l.createElementBlock("img",{key:1,class:"drum_img",src:l.unref(i)||""},null,8,Th)),l.createElementVNode("p",null,l.toDisplayString(o.group.name),1)],10,Sh)):l.createCommentVNode("",!0)}}),[["__scopeId","data-v-2b994529"]]),Rh={},Oh={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 Bh(o,s){return l.openBlock(),l.createElementBlock("svg",Oh,[...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=qe(Rh,[["render",Bh]]),vh={class:"recommendation_wrapper"},Dh={class:"recommendation_header"},Ph={class:"recommendation_info"},Lh=qe(l.defineComponent({__name:"Recommendation",props:{closeCurrentCard:{},openCurrentCard:{}},setup(o){const s=Tt(),{isUpSale:i,dataUpSale:u}=_e.storeToRefs(s),f=()=>{i.value=!1};return l.onUnmounted(()=>{u.value=null}),(h,m)=>(l.openBlock(),l.createElementBlock("div",vh,[l.createElementVNode("div",Dh,[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",Ph,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(u),x=>(l.openBlock(),l.createBlock(fa,{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"]]),Fh=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":""}),()=>{}}}),Vh={class:"wrapper_modal"},Uh={class:"card_modal"},zh=qe(l.defineComponent({__name:"ModalWindows",props:{visible:{type:Boolean}},setup(o){const s=o,i=Tt(),{isUpSale:u}=_e.storeToRefs(i),f=()=>{u.value=!1};return(h,m)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createVNode(Fh,{data:s.visible},null,8,["data"]),l.createElementVNode("div",{class:"black_modal",onClick:f}),l.createElementVNode("div",Vh,[l.createElementVNode("div",Uh,[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 ha=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"]]),ga;(function(o){o[o.UNKNOWN=0]="UNKNOWN",o[o.URL=1]="URL"})(ga||(ga={}));function Hh(o){return Object.values(pe).includes(o)}var wi;(function(o){o[o.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",o[o.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"})(wi||(wi={}));var Gh=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=[wi.SCAN_TYPE_CAMERA,wi.SCAN_TYPE_FILE],o}(),ma=function(){function o(s,i){this.format=s,this.formatName=i}return o.prototype.toString=function(){return this.formatName},o.create=function(s){if(!ha.has(s))throw"".concat(s," not in html5QrcodeSupportedFormatsTextMap");return new o(s,ha.get(s))},o}(),pa=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 Wh=function(){function o(){}return o.createFrom=function(s){return{errorMessage:s,type:po.UNKWOWN_ERROR}},o}(),Xh=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 Dn(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}(),xa=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 N{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 N(this.binarizer.createBinarizer(a))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new N(this.binarizer.createBinarizer(e))}rotateCounterClockwise45(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new N(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 L{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 V extends v{constructor(e=void 0,t=void 0){super(t),this.index=e,this.message=t}}V.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 V(t);if(n>e)throw new V(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 L.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 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 P{constructor(e,t){e===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=e,t==null?this.bits=P.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=P.makeArray(e);L.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 P))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 P(this.size,this.bits.slice())}}var G;(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"})(G||(G={}));var Z=G;class H extends p{static getFormatInstance(){return new H}}H.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 j{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,j.VALUE_IDENTIFIER_TO_ECI.set(e,this),j.NAME_TO_ECI.set(n,this);const a=this.values;for(let c=0,d=a.length;c!==d;c++){const g=a[c];j.VALUES_TO_ECI.set(g,this)}for(const c of r)j.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 H("incorect value");const t=j.VALUES_TO_ECI.get(e);if(t===void 0)throw new H("incorect value");return t}static getCharacterSetECIByName(e){const t=j.NAME_TO_ECI.get(e);if(t===void 0)throw new H("incorect value");return t}equals(e){if(!(e instanceof j))return!1;const t=e;return this.getName()===t.getName()}}j.VALUE_IDENTIFIER_TO_ECI=new Map,j.VALUES_TO_ECI=new Map,j.NAME_TO_ECI=new Map,j.Cp437=new j(ie.Cp437,Int32Array.from([0,2]),"Cp437"),j.ISO8859_1=new j(ie.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),j.ISO8859_2=new j(ie.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),j.ISO8859_3=new j(ie.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),j.ISO8859_4=new j(ie.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),j.ISO8859_5=new j(ie.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),j.ISO8859_6=new j(ie.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),j.ISO8859_7=new j(ie.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),j.ISO8859_8=new j(ie.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),j.ISO8859_9=new j(ie.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),j.ISO8859_10=new j(ie.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),j.ISO8859_11=new j(ie.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),j.ISO8859_13=new j(ie.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),j.ISO8859_14=new j(ie.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),j.ISO8859_15=new j(ie.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),j.ISO8859_16=new j(ie.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),j.SJIS=new j(ie.SJIS,20,"SJIS","Shift_JIS"),j.Cp1250=new j(ie.Cp1250,21,"Cp1250","windows-1250"),j.Cp1251=new j(ie.Cp1251,22,"Cp1251","windows-1251"),j.Cp1252=new j(ie.Cp1252,23,"Cp1252","windows-1252"),j.Cp1256=new j(ie.Cp1256,24,"Cp1256","windows-1256"),j.UnicodeBigUnmarked=new j(ie.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),j.UTF8=new j(ie.UTF8,26,"UTF8","UTF-8"),j.ASCII=new j(ie.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),j.Big5=new j(ie.Big5,28,"Big5"),j.GB18030=new j(ie.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),j.EUC_KR=new j(ie.EUC_KR,30,"EUC_KR","EUC-KR");class se extends p{}se.kind="UnsupportedOperationException";class oe{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!oe.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 j?e:j.getCharacterSetECIByName(e)}static decodeFallback(e,t){const n=this.encodingCharacterSet(t);if(oe.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(j.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(j.UTF8)||e.equals(j.ISO8859_1)||e.equals(j.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 ne{static castAsNonUtf8Char(e,t=null){const n=t?t.getName():this.ISO88591;return oe.decode(new Uint8Array([e]),n)}static guessEncoding(e,t){if(t!=null&&t.get(Z.CHARACTER_SET)!==void 0)return t.get(Z.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,D=0,F=0,Y=0,te=0;const ue=e.length>3&&e[0]===239&&e[1]===187&&e[2]===191;for(let de=0;de<n&&(r||a||c);de++){const ce=e[de]&255;c&&(d>0?ce&128?d--:c=!1:ce&128&&(ce&64?(d++,ce&32?(d++,ce&16?(d++,ce&8?c=!1:E++):w++):g++):c=!1)),r&&(ce>127&&ce<160?r=!1:ce>159&&(ce<192||ce===215||ce===247)&&te++),a&&(A>0?ce<64||ce===127||ce>252?a=!1:A--:ce===128||ce===160||ce>239?a=!1:ce>160&&ce<224?(I++,D=0,R++,R>F&&(F=R)):ce>127?(A++,R=0,D++,D>Y&&(Y=D)):(R=0,D=0))}return c&&d>0&&(c=!1),a&&A>0&&(a=!1),c&&(ue||g+w+E>0)?ne.UTF8:a&&(ne.ASSUME_SHIFT_JIS||F>=3||Y>=3)?ne.SHIFT_JIS:r&&a?F===2&&I===2||te*10>=n?ne.SHIFT_JIS:ne.ISO88591:r?ne.ISO88591:a?ne.SHIFT_JIS:c?ne.UTF8:ne.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 D=parseInt(g),F=g&&g[0]+""=="0"?"0":" ";for(;R.length<D;)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 oe.encode(e,t)}static getCharCode(e,t=0){return e.charCodeAt(t)}static getCharAt(e){return String.fromCharCode(e)}}ne.SHIFT_JIS=j.SJIS.getName(),ne.GB2312="GB2312",ne.ISO88591=j.ISO8859_1.getName(),ne.EUC_JP="EUC_JP",ne.UTF8=j.UTF8.getName(),ne.PLATFORM_DEFAULT_ENCODING=ne.UTF8,ne.ASSUME_SHIFT_JIS=!1;class U{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+=ne.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 W{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 W(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 W(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 P(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 P(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){L.arraycopy(t.getBitArray(),0,this.bits,e*this.rowSize,this.rowSize)}rotate180(){const e=this.getWidth(),t=this.getHeight();let n=new P(e),r=new P(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 W))return!1;const t=e;return this.width===t.width&&this.height===t.height&&this.rowSize===t.rowSize&&B.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+B.hashCode(this.bits),e}toString(e="X ",t=" ",n=`
13
- `){return this.buildToString(e,t,n)}buildToString(e,t,n){let r=new U;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 W(this.width,this.height,this.rowSize,this.bits.slice())}}class S extends p{static getNotFoundInstance(){return new S}}S.kind="NotFoundException";class z extends k{constructor(e){super(e),this.luminances=z.EMPTY,this.buckets=new Int32Array(z.LUMINANCE_BUCKETS)}getBlackRow(e,t){const n=this.getLuminanceSource(),r=n.getWidth();t==null||t.getSize()<r?t=new P(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)>>z.LUMINANCE_SHIFT]++;const d=z.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 W(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>>z.LUMINANCE_SHIFT]++}}const c=z.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 z(e)}initArrays(e){this.luminances.length<e&&(this.luminances=new Uint8ClampedArray(e));const t=this.buckets;for(let n=0;n<z.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 S;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<<z.LUMINANCE_SHIFT}}z.LUMINANCE_BITS=5,z.LUMINANCE_SHIFT=8-z.LUMINANCE_BITS,z.LUMINANCE_BUCKETS=1<<z.LUMINANCE_BITS,z.EMPTY=Uint8ClampedArray.from([0]);class X extends z{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>=X.MINIMUM_DIMENSION&&n>=X.MINIMUM_DIMENSION){const r=e.getMatrix();let a=t>>X.BLOCK_SIZE_POWER;t&X.BLOCK_SIZE_MASK&&a++;let c=n>>X.BLOCK_SIZE_POWER;n&X.BLOCK_SIZE_MASK&&c++;const d=X.calculateBlackPoints(r,a,c,t,n),g=new W(t,n);X.calculateThresholdForBlock(r,a,c,t,n,d,g),this.matrix=g}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(e){return new X(e)}static calculateThresholdForBlock(e,t,n,r,a,c,d){const g=a-X.BLOCK_SIZE,w=r-X.BLOCK_SIZE;for(let E=0;E<n;E++){let A=E<<X.BLOCK_SIZE_POWER;A>g&&(A=g);const I=X.cap(E,2,n-3);for(let R=0;R<t;R++){let D=R<<X.BLOCK_SIZE_POWER;D>w&&(D=w);const F=X.cap(R,2,t-3);let Y=0;for(let ue=-2;ue<=2;ue++){const de=c[I+ue];Y+=de[F-2]+de[F-1]+de[F]+de[F+1]+de[F+2]}const te=Y/25;X.thresholdBlock(e,D,A,te,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<X.BLOCK_SIZE;d++,g+=a)for(let w=0;w<X.BLOCK_SIZE;w++)(e[g+w]&255)<=r&&c.set(t+w,n+d)}static calculateBlackPoints(e,t,n,r,a){const c=a-X.BLOCK_SIZE,d=r-X.BLOCK_SIZE,g=new Array(n);for(let w=0;w<n;w++){g[w]=new Int32Array(t);let E=w<<X.BLOCK_SIZE_POWER;E>c&&(E=c);for(let A=0;A<t;A++){let I=A<<X.BLOCK_SIZE_POWER;I>d&&(I=d);let R=0,D=255,F=0;for(let te=0,ue=E*r+I;te<X.BLOCK_SIZE;te++,ue+=r){for(let de=0;de<X.BLOCK_SIZE;de++){const ce=e[ue+de]&255;R+=ce,ce<D&&(D=ce),ce>F&&(F=ce)}if(F-D>X.MIN_DYNAMIC_RANGE)for(te++,ue+=r;te<X.BLOCK_SIZE;te++,ue+=r)for(let de=0;de<X.BLOCK_SIZE;de++)R+=e[ue+de]&255}let Y=R>>X.BLOCK_SIZE_POWER*2;if(F-D<=X.MIN_DYNAMIC_RANGE&&(Y=D/2,w>0&&A>0)){const te=(g[w-1][A]+2*g[w][A-1]+g[w-1][A-1])/4;D<te&&(Y=te)}g[w][A]=Y}}return g}}X.BLOCK_SIZE_POWER=3,X.BLOCK_SIZE=1<<X.BLOCK_SIZE_POWER,X.BLOCK_SIZE_MASK=X.BLOCK_SIZE-1,X.MINIMUM_DIMENSION=X.BLOCK_SIZE*5,X.MIN_DYNAMIC_RANGE=24;class q{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 se("This luminance source does not support cropping.")}isRotateSupported(){return!1}rotateCounterClockwise(){throw new se("This luminance source does not support rotation by 90 degrees.")}rotateCounterClockwise45(){throw new se("This luminance source does not support rotation by 45 degrees.")}toString(){const e=new Uint8ClampedArray(this.width);let t=new U;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 $ extends q{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 $(this.delegate.crop(e,t,n,r))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new $(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new $(this.delegate.rotateCounterClockwise45())}}class re extends q{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 $(this)}}re.DEGREE_TO_RADIANS=Math.PI/180;class he{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 fe=(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 Ee{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 fe(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 fe(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(t=>new he(t.deviceId,t.label))})}findDeviceById(e){return fe(this,void 0,void 0,function*(){const t=yield this.listVideoInputDevices();return t?t.find(n=>n.deviceId===e):null})}decodeFromInputVideoDevice(e,t){return fe(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(e,t)})}decodeOnceFromVideoDevice(e,t){return fe(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 fe(this,void 0,void 0,function*(){const n=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeOnceFromStream(n,t)})}decodeOnceFromStream(e,t){return fe(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 fe(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(e,t,n)})}decodeFromVideoDevice(e,t,n){return fe(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 fe(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 fe(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 fe(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 fe(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 fe(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(e),yield this.decodeOnce(e)})}_decodeOnLoadVideoContinuously(e,t){return fe(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 S("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 S,E=(d instanceof M||d instanceof H)&&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 H,c=r instanceof S;(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 X(n);return new N(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 me{constructor(e,t,n=t==null?0:8*t.length,r,a,c=L.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=L.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);L.arraycopy(t,0,n,0,t.length),L.arraycopy(e,0,n,t.length,e.length),this.resultPoints=n}}getTimestamp(){return this.timestamp}toString(){return this.text}}var Ve;(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"})(Ve||(Ve={}));var xe=Ve,ht;(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"})(ht||(ht={}));var He=ht;class Ae{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 Ge{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 Qe{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),L.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=Ge.addOrSubtract(n,g)}return n}n=t[0];const r=t.length,a=this.field;for(let c=1;c<r;c++)n=Ge.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;L.arraycopy(n,0,r,0,a);for(let c=a;c<n.length;c++)r[c]=Ge.addOrSubtract(t[c-a],n[c]);return new Qe(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]=Ge.addOrSubtract(c[g+E],d.multiply(w,r[E]))}return new Qe(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 Qe(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 Qe(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 kt extends p{}kt.kind="ArithmeticException";class Te extends Ge{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 Qe(this,Int32Array.from([0])),this.one=new Qe(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 Qe(this,n)}inverse(e){if(e===0)throw new kt;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}}Te.AZTEC_DATA_12=new Te(4201,4096,1),Te.AZTEC_DATA_10=new Te(1033,1024,1),Te.AZTEC_DATA_6=new Te(67,64,1),Te.AZTEC_PARAM=new Te(19,16,1),Te.QR_CODE_FIELD_256=new Te(285,256,0),Te.DATA_MATRIX_FIELD_256=new Te(301,256,1),Te.AZTEC_DATA_8=Te.DATA_MATRIX_FIELD_256,Te.MAXICODE_FIELD_64=Te.AZTEC_DATA_6;class Ie extends p{}Ie.kind="ReedSolomonException";class Ue extends p{}Ue.kind="IllegalStateException";class lt{constructor(e){this.field=e}decode(e,t){const n=this.field,r=new Qe(n,e),a=new Int32Array(t);let c=!0;for(let R=0;R<t;R++){const D=r.evaluateAt(n.exp(R+n.getGeneratorBase()));a[a.length-1-R]=D,D!==0&&(c=!1)}if(c)return;const d=new Qe(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 D=e.length-1-n.log(A[R]);if(D<0)throw new Ie("Bad error location");e[D]=Te.addOrSubtract(e[D],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,D=d;if(a=c,d=g,a.isZero())throw new Ie("r_{i-1} was zero");c=R;let F=r.getZero();const Y=a.getCoefficient(a.getDegree()),te=r.inverse(Y);for(;c.getDegree()>=a.getDegree()&&!c.isZero();){const ue=c.getDegree()-a.getDegree(),de=r.multiply(c.getCoefficient(c.getDegree()),te);F=F.addOrSubtract(r.buildMonomial(ue,de)),c=c.addOrSubtract(a.multiplyByMonomial(ue,de))}if(g=F.multiply(d).addOrSubtract(D),c.getDegree()>=a.getDegree())throw new Ue("Division algorithm failed to reduce polynomial?")}const w=g.getCoefficient(0);if(w===0)throw new Ie("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 Ie("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 We;(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"})(We||(We={}));class $e{decode(e){this.ddata=e;let t=e.getBits(),n=this.extractBits(t),r=this.correctBits(n),a=$e.convertBoolArrayToByteArray(r),c=$e.getEncodedData(r),d=new Ae(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=We.UPPER,r=We.UPPER,a="",c=0;for(;c<t;)if(r===We.BINARY){if(t-c<5)break;let d=$e.readCode(e,c,5);if(c+=5,d===0){if(t-c<11)break;d=$e.readCode(e,c,11)+31,c+=11}for(let g=0;g<d;g++){if(t-c<8){c=t;break}const w=$e.readCode(e,c,8);a+=ne.castAsNonUtf8Char(w),c+=8}r=n}else{let d=r===We.DIGIT?4:5;if(t-c<d)break;let g=$e.readCode(e,c,d);c+=d;let w=$e.getCharacter(r,g);w.startsWith("CTRL_")?(n=r,r=$e.getTable(w.charAt(5)),w.charAt(6)==="L"&&(n=r)):(a+=w,r=n)}return a}static getTable(e){switch(e){case"L":return We.LOWER;case"P":return We.PUNCT;case"M":return We.MIXED;case"D":return We.DIGIT;case"B":return We.BINARY;case"U":default:return We.UPPER}}static getCharacter(e,t){switch(e){case We.UPPER:return $e.UPPER_TABLE[t];case We.LOWER:return $e.LOWER_TABLE[t];case We.MIXED:return $e.MIXED_TABLE[t];case We.PUNCT:return $e.PUNCT_TABLE[t];case We.DIGIT:return $e.DIGIT_TABLE[t];default:throw new Ue("Bad table")}}correctBits(e){let t,n;this.ddata.getNbLayers()<=2?(n=6,t=Te.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(n=8,t=Te.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(n=10,t=Te.AZTEC_DATA_10):(n=12,t=Te.AZTEC_DATA_12);let r=this.ddata.getNbDatablocks(),a=e.length/n;if(a<r)throw new H;let c=e.length%n,d=new Int32Array(a);for(let I=0;I<a;I++,c+=n)d[I]=$e.readCode(e,c,n);try{new lt(t).decode(d,a-r)}catch(I){throw new H(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 H;(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 D=n-1;D>=0;--D)E[A++]=(R&1<<D)!==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 D=0;D<2;D++)c[g+R+D]=e.get(a[E+D],a[E+I]),c[g+2*w+R+D]=e.get(a[E+I],a[A-D]),c[g+4*w+R+D]=e.get(a[A-D],a[A-I]),c[g+6*w+R+D]=e.get(a[A-I],a[E+D])}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?$e.readCode(e,t,8):$e.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]=$e.readByte(e,8*n);return t}totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}$e.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"],$e.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"],$e.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"],$e.PUNCT_TABLE=["","\r",`\r
16
- `,". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],$e.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class Me{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 nr{static floatToIntBits(e){return e}}nr.MAX_VALUE=Number.MAX_SAFE_INTEGER;class we{constructor(e,t){this.x=e,this.y=t}getX(){return this.x}getY(){return this.y}equals(e){if(e instanceof we){const t=e;return this.x===t.x&&this.y===t.y}return!1}hashCode(){return 31*nr.floatToIntBits(this.x)+nr.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 Me.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 rr{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class Ai extends rr{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 xn{constructor(e,t,n,r){this.image=e,this.height=e.getHeight(),this.width=e.getWidth(),t==null&&(t=xn.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 S}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 D=!0;for(;(D||!g)&&t<I;)D=this.containsBlackPoint(n,r,t,!1),D?(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 Y=!0;for(;(Y||!E)&&e>=0;)Y=this.containsBlackPoint(n,r,e,!1),Y?(e--,c=!0,E=!0):E||e--;if(e<0){a=!0;break}let te=!0;for(;(te||!A)&&n>=0;)te=this.containsBlackPoint(e,t,n,!0),te?(n--,c=!0,A=!0):A||n--;if(n<0){a=!0;break}c&&(d=!0)}if(!a&&d){const D=t-e;let F=null;for(let de=1;F===null&&de<D;de++)F=this.getBlackPointOnSegment(e,r-de,e+de,r);if(F==null)throw new S;let Y=null;for(let de=1;Y===null&&de<D;de++)Y=this.getBlackPointOnSegment(e,n+de,e+de,n);if(Y==null)throw new S;let te=null;for(let de=1;te===null&&de<D;de++)te=this.getBlackPointOnSegment(t,n+de,t-de,n);if(te==null)throw new S;let ue=null;for(let de=1;ue===null&&de<D;de++)ue=this.getBlackPointOnSegment(t,r-de,t-de,r);if(ue==null)throw new S;return this.centerEdges(ue,F,te,Y)}else throw new S}getBlackPointOnSegment(e,t,n,r){const a=Me.round(Me.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=Me.round(e+w*c),A=Me.round(t+w*d);if(g.get(E,A))return new we(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=xn.CORR;return a<this.width/2?[new we(A-R,I+R),new we(d+R,g+R),new we(w-R,E-R),new we(a+R,c-R)]:[new we(A+R,I+R),new we(d+R,g-R),new we(w-R,E+R),new we(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}}xn.INIT_SIZE=10,xn.CORR=1;class Hr{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 S;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 S;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 tn{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,D,F,Y){const te=tn.quadrilateralToSquare(e,t,n,r,a,c,d,g);return tn.squareToQuadrilateral(w,E,A,I,R,D,F,Y).times(te)}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],D=e[I+1],F=a*R+g*D+A;e[I]=(n*R+c*D+w)/F,e[I+1]=(r*R+d*D+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 D=e[R],F=t[R],Y=a*D+g*F+A;e[R]=(n*D+c*F+w)/Y,t[R]=(r*D+d*F+E)/Y}}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 tn(n-e,a-n,e,r-t,c-r,t,0,0,1);{const A=n-a,I=d-a,R=r-c,D=g-c,F=A*D-I*R,Y=(w*D-I*E)/F,te=(A*E-w*R)/F;return new tn(n-e+Y*n,d-e+te*d,e,r-t+Y*r,g-t+te*g,t,Y,te,1)}}static quadrilateralToSquare(e,t,n,r,a,c,d,g){return tn.squareToQuadrilateral(e,t,n,r,a,c,d,g).buildAdjoint()}buildAdjoint(){return new tn(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 tn(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 Ii extends Hr{sampleGrid(e,t,n,r,a,c,d,g,w,E,A,I,R,D,F,Y,te,ue,de){const ce=tn.quadrilateralToQuadrilateral(r,a,c,d,g,w,E,A,I,R,D,F,Y,te,ue,de);return this.sampleGridWithTransform(e,t,n,ce)}sampleGridWithTransform(e,t,n,r){if(t<=0||n<=0)throw new S;const a=new W(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),Hr.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 S}}return a}}class In{static setGridSampler(e){In.gridSampler=e}static getInstance(){return In.gridSampler}}In.gridSampler=new Ii;class At{constructor(e,t){this.x=e,this.y=t}toResultPoint(){return new we(this.getX(),this.getY())}getX(){return this.x}getY(){return this.y}}class Un{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 Ai(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 S;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 S}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 lt(Te.AZTEC_PARAM).decode(c,a)}catch{throw new S}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),D=this.getFirstDifferent(a,c,-1,-1);if(this.nbCenterLayers>2){let F=this.distancePoint(D,A)*this.nbCenterLayers/(this.distancePoint(a,t)*(this.nbCenterLayers+2));if(F<.75||F>1.25||!this.isWhiteOrBlackRectangle(A,I,R,D))break}t=A,n=I,r=R,a=D,c=!c}if(this.nbCenterLayers!==5&&this.nbCenterLayers!==7)throw new S;this.compact=this.nbCenterLayers===5;let d=new we(t.getX()+.5,t.getY()-.5),g=new we(n.getX()+.5,n.getY()+.5),w=new we(r.getX()-.5,r.getY()+.5),E=new we(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 xn(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 At(g+7,w-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new At(g+7,w+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new At(g-7,w+7),!1,-1,1).toResultPoint(),r=this.getFirstDifferent(new At(g-7,w-7),!1,-1,-1).toResultPoint()}let a=Me.round((e.getX()+r.getX()+t.getX()+n.getX())/4),c=Me.round((e.getY()+r.getY()+t.getY()+n.getY())/4);try{let d=new xn(this.image,15,a,c).detect();e=d[0],t=d[1],n=d[2],r=d[3]}catch{e=this.getFirstDifferent(new At(a+7,c-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new At(a+7,c+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new At(a-7,c+7),!1,-1,1).toResultPoint(),r=this.getFirstDifferent(new At(a-7,c-7),!1,-1,-1).toResultPoint()}return a=Me.round((e.getX()+r.getX()+t.getX()+n.getX())/4),c=Me.round((e.getY()+r.getY()+t.getY()+n.getY())/4),new At(a,c)}getMatrixCornerPoints(e){return this.expandSquare(e,2*this.nbCenterLayers,this.getDimension())}sampleGrid(e,t,n,r,a){let c=In.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(Me.round(d+A*w),Me.round(g+A*E))&&(r|=1<<n-A-1);return r}isWhiteOrBlackRectangle(e,t,n,r){let a=3;e=new At(e.getX()-a,e.getY()+a),t=new At(t.getX()-a,t.getY()-a),n=new At(n.getX()+a,n.getY()-a),r=new At(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(Me.round(d),Me.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 At(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 we(d+r*a,g+r*c),E=new we(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 we(d+r*a,g+r*c),I=new we(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=Me.round(e.getX()),n=Me.round(e.getY());return this.isValid(t,n)}distancePoint(e,t){return Me.distance(e.getX(),e.getY(),t.getX(),t.getY())}distanceResultPoint(e,t){return Me.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 _r{decode(e,t=null){let n=null,r=new Un(e.getBlackMatrix()),a=null,c=null;try{let E=r.detectMirror(!1);a=E.getPoints(),this.reportFoundResultPoints(t,a),c=new $e().decode(E)}catch(E){n=E}if(c==null)try{let E=r.detectMirror(!0);a=E.getPoints(),this.reportFoundResultPoints(t,a),c=new $e().decode(E)}catch(E){throw n??E}let d=new me(c.getText(),c.getRawBytes(),c.getNumBits(),a,xe.AZTEC,L.currentTimeMillis()),g=c.getByteSegments();g!=null&&d.putMetadata(He.BYTE_SEGMENTS,g);let w=c.getECLevel();return w!=null&&d.putMetadata(He.ERROR_CORRECTION_LEVEL,w),d}reportFoundResultPoints(e,t){if(e!=null){let n=e.get(Z.NEED_RESULT_POINT_CALLBACK);n!=null&&t.forEach((r,a,c)=>{n.foundPossibleResultPoint(r)})}}reset(){}}class Gr extends Ee{constructor(e=500){super(new _r,e)}}class mt{decode(e,t){try{return this.doDecode(e,t)}catch{if(t&&t.get(Z.TRY_HARDER)===!0&&e.isRotateSupported()){const a=e.rotateCounterClockwise(),c=this.doDecode(a,t),d=c.getResultMetadata();let g=270;d!==null&&d.get(He.ORIENTATION)===!0&&(g=g+d.get(He.ORIENTATION)%360),c.putMetadata(He.ORIENTATION,g);const w=c.getResultPoints();if(w!==null){const E=a.getHeight();for(let A=0;A<w.length;A++)w[A]=new we(E-w[A].getY()-1,w[A].getX())}return c}else throw new S}}reset(){}doDecode(e,t){const n=e.getWidth(),r=e.getHeight();let a=new P(n);const c=t&&t.get(Z.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 D=0;D<2;D++){if(D===1&&(a.reverse(),t&&t.get(Z.NEED_RESULT_POINT_CALLBACK)===!0)){const F=new Map;t.forEach((Y,te)=>F.set(te,Y)),F.delete(Z.NEED_RESULT_POINT_CALLBACK),t=F}try{const F=this.decodeRow(R,a,t);if(D===1){F.putMetadata(He.ORIENTATION,180);const Y=F.getResultPoints();Y!==null&&(Y[0]=new we(n-Y[0].getX()-1,Y[0].getY()),Y[1]=new we(n-Y[1].getX()-1,Y[1].getY()))}return F}catch{}}}throw new S}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 S;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 S}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 S;mt.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 ee extends mt{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=ee.MAX_AVG_VARIANCE,A=-1;for(let I=ee.CODE_START_A;I<=ee.CODE_START_C;I++){const R=mt.patternMatchVariance(a,ee.CODE_PATTERNS[I],ee.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 S}static decodeCode(e,t,n){mt.recordPattern(e,n,t);let r=ee.MAX_AVG_VARIANCE,a=-1;for(let c=0;c<ee.CODE_PATTERNS.length;c++){const d=ee.CODE_PATTERNS[c],g=this.patternMatchVariance(t,d,ee.MAX_INDIVIDUAL_VARIANCE);g<r&&(r=g,a=c)}if(a>=0)return a;throw new S}decodeRow(e,t,n){const r=n&&n.get(Z.ASSUME_GS1)===!0,a=ee.findStartPattern(t),c=a[2];let d=0;const g=new Uint8Array(20);g[d++]=c;let w;switch(c){case ee.CODE_START_A:w=ee.CODE_CODE_A;break;case ee.CODE_START_B:w=ee.CODE_CODE_B;break;case ee.CODE_START_C:w=ee.CODE_CODE_C;break;default:throw new H}let E=!1,A=!1,I="",R=a[0],D=a[1];const F=Int32Array.from([0,0,0,0,0,0]);let Y=0,te=0,ue=c,de=0,ce=!0,Xe=!1,Pe=!1;for(;!E;){const Tr=A;switch(A=!1,Y=te,te=ee.decodeCode(t,F,D),g[d++]=te,te!==ee.CODE_STOP&&(ce=!0),te!==ee.CODE_STOP&&(de++,ue+=de*te),R=D,D+=F.reduce((Dg,Pg)=>Dg+Pg,0),te){case ee.CODE_START_A:case ee.CODE_START_B:case ee.CODE_START_C:throw new H}switch(w){case ee.CODE_CODE_A:if(te<64)Pe===Xe?I+=String.fromCharCode(32+te):I+=String.fromCharCode(32+te+128),Pe=!1;else if(te<96)Pe===Xe?I+=String.fromCharCode(te-64):I+=String.fromCharCode(te+64),Pe=!1;else switch(te!==ee.CODE_STOP&&(ce=!1),te){case ee.CODE_FNC_1:r&&(I.length===0?I+="]C1":I+="");break;case ee.CODE_FNC_2:case ee.CODE_FNC_3:break;case ee.CODE_FNC_4_A:!Xe&&Pe?(Xe=!0,Pe=!1):Xe&&Pe?(Xe=!1,Pe=!1):Pe=!0;break;case ee.CODE_SHIFT:A=!0,w=ee.CODE_CODE_B;break;case ee.CODE_CODE_B:w=ee.CODE_CODE_B;break;case ee.CODE_CODE_C:w=ee.CODE_CODE_C;break;case ee.CODE_STOP:E=!0;break}break;case ee.CODE_CODE_B:if(te<96)Pe===Xe?I+=String.fromCharCode(32+te):I+=String.fromCharCode(32+te+128),Pe=!1;else switch(te!==ee.CODE_STOP&&(ce=!1),te){case ee.CODE_FNC_1:r&&(I.length===0?I+="]C1":I+="");break;case ee.CODE_FNC_2:case ee.CODE_FNC_3:break;case ee.CODE_FNC_4_B:!Xe&&Pe?(Xe=!0,Pe=!1):Xe&&Pe?(Xe=!1,Pe=!1):Pe=!0;break;case ee.CODE_SHIFT:A=!0,w=ee.CODE_CODE_A;break;case ee.CODE_CODE_A:w=ee.CODE_CODE_A;break;case ee.CODE_CODE_C:w=ee.CODE_CODE_C;break;case ee.CODE_STOP:E=!0;break}break;case ee.CODE_CODE_C:if(te<100)te<10&&(I+="0"),I+=te;else switch(te!==ee.CODE_STOP&&(ce=!1),te){case ee.CODE_FNC_1:r&&(I.length===0?I+="]C1":I+="");break;case ee.CODE_CODE_A:w=ee.CODE_CODE_A;break;case ee.CODE_CODE_B:w=ee.CODE_CODE_B;break;case ee.CODE_STOP:E=!0;break}break}Tr&&(w=w===ee.CODE_CODE_A?ee.CODE_CODE_B:ee.CODE_CODE_A)}const $t=D-R;if(D=t.getNextUnset(D),!t.isRange(D,Math.min(t.getSize(),D+(D-R)/2),!1))throw new S;if(ue-=de*Y,ue%103!==Y)throw new M;const _n=I.length;if(_n===0)throw new S;_n>0&&ce&&(w===ee.CODE_CODE_C?I=I.substring(0,_n-2):I=I.substring(0,_n-1));const Kt=(a[1]+a[0])/2,st=R+$t/2,Dt=g.length,nn=new Uint8Array(Dt);for(let Tr=0;Tr<Dt;Tr++)nn[Tr]=g[Tr];const Nr=[new we(Kt,e),new we(st,e)];return new me(I,nn,0,Nr,xe.CODE_128,new Date().getTime())}}ee.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])],ee.MAX_AVG_VARIANCE=.25,ee.MAX_INDIVIDUAL_VARIANCE=.7,ee.CODE_SHIFT=98,ee.CODE_CODE_C=99,ee.CODE_CODE_B=100,ee.CODE_CODE_A=101,ee.CODE_FNC_1=102,ee.CODE_FNC_2=97,ee.CODE_FNC_3=96,ee.CODE_FNC_4_A=101,ee.CODE_FNC_4_B=100,ee.CODE_START_A=103,ee.CODE_START_B=104,ee.CODE_START_C=105,ee.CODE_STOP=106;class ae extends mt{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=ae.findAsteriskPattern(t,r),c=t.getNextSet(a[1]),d=t.getSize(),g,w;do{ae.recordPattern(t,c,r);let F=ae.toNarrowWidePattern(r);if(F<0)throw new S;g=ae.patternToChar(F),this.decodeRowResult+=g,w=c;for(let Y of r)c+=Y;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 S;if(this.usingCheckDigit){let F=this.decodeRowResult.length-1,Y=0;for(let te=0;te<F;te++)Y+=ae.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(te));if(this.decodeRowResult.charAt(F)!==ae.ALPHABET_STRING.charAt(Y%43))throw new M;this.decodeRowResult=this.decodeRowResult.substring(0,F)}if(this.decodeRowResult.length===0)throw new S;let I;this.extendedMode?I=ae.decodeExtended(this.decodeRowResult):I=this.decodeRowResult;let R=(a[1]+a[0])/2,D=w+E/2;return new me(I,null,0,[new we(R,e),new we(D,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)===ae.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 S}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<ae.CHARACTER_ENCODINGS.length;t++)if(ae.CHARACTER_ENCODINGS[t]===e)return ae.ALPHABET_STRING.charAt(t);if(e===ae.ASTERISK_ENCODING)return"*";throw new S}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 H;break;case"$":if(c>="A"&&c<="Z")d=String.fromCharCode(c.charCodeAt(0)-64);else throw new H;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 H;break;case"/":if(c>="A"&&c<="O")d=String.fromCharCode(c.charCodeAt(0)-32);else if(c==="Z")d=":";else throw new H;break}n+=d,r++}else n+=a}return n}}ae.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",ae.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],ae.ASTERISK_ENCODING=148;class ye extends mt{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(e,t,n){let r=this.decodeStart(t),a=this.decodeEnd(t),c=new U;ye.decodeMiddle(t,r[1],a[0],c);let d=c.toString(),g=null;n!=null&&(g=n.get(Z.ALLOWED_LENGTHS)),g==null&&(g=ye.DEFAULT_ALLOWED_LENGTHS);let w=d.length,E=!1,A=0;for(let D of g){if(w===D){E=!0;break}D>A&&(A=D)}if(!E&&w>A&&(E=!0),!E)throw new H;const I=[new we(r[1],e),new we(a[0],e)];return new me(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;){mt.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 S}static skipWhiteSpace(e){const t=e.getSize(),n=e.getNextSet(0);if(n===t)throw new S;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 S&&(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(mt.patternMatchVariance(a,n,ye.MAX_INDIVIDUAL_VARIANCE)<ye.MAX_AVG_VARIANCE)return[w,E];w+=a[0]+a[1],L.arraycopy(a,2,a,0,g-1),a[g-1]=0,a[g]=0,g--}else g++;a[g]=1,d=!d}throw new S}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=mt.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 S}}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 Ye extends mt{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=Ye.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 Ye.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(t===0)return!1;let n=parseInt(e.charAt(t-1),10);return Ye.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 H;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 H;n+=a}return(1e3-n)%10}static decodeEnd(e,t){return Ye.findGuardPattern(e,t,!1,Ye.START_END_PATTERN,new Int32Array(Ye.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(mt.patternMatchVariance(a,r,Ye.MAX_INDIVIDUAL_VARIANCE)<Ye.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 S}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=mt.patternMatchVariance(t,w,Ye.MAX_INDIVIDUAL_VARIANCE);E<a&&(a=E,c=g)}if(c>=0)return c;throw new S}}Ye.MAX_AVG_VARIANCE=.48,Ye.MAX_INDIVIDUAL_VARIANCE=.7,Ye.START_END_PATTERN=Int32Array.from([1,1,1]),Ye.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),Ye.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),Ye.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 wn{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=wn.parseExtensionString(c),g=[new we((n[0]+n[1])/2,e),new we(a,e)],w=new me(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=Ye.decodeDigit(e,r,c,Ye.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 S;let g=this.determineCheckDigit(d);if(wn.extensionChecksum(n.toString())!==g)throw new S;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 S}static parseExtensionString(e){if(e.length!==5)return null;let t=wn.parseExtension5String(e);return t==null?null:new Map([[He.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 Pn{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=Pn.parseExtensionString(c),g=[new we((n[0]+n[1])/2,e),new we(a,e)],w=new me(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=Ye.decodeDigit(e,r,c,Ye.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 S;if(parseInt(n.toString())%4!==d)throw new S;return c}static parseExtensionString(e){return e.length!==2?null:new Map([[He.ISSUE_NUMBER,parseInt(e)]])}}class zn{static decodeRow(e,t,n){let r=Ye.findGuardPattern(t,n,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new wn().decodeRow(e,t,r)}catch{return new Pn().decodeRow(e,t,r)}}}zn.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class ve extends Ye{constructor(){super(),this.decodeRowStringBuffer="",ve.L_AND_G_PATTERNS=ve.L_PATTERNS.map(e=>Int32Array.from(e));for(let e=10;e<20;e++){let t=ve.L_PATTERNS[e-10],n=new Int32Array(t.length);for(let r=0;r<t.length;r++)n[r]=t[t.length-r-1];ve.L_AND_G_PATTERNS[e]=n}}decodeRow(e,t,n){let r=ve.findStartGuardPattern(t),a=n==null?null:n.get(Z.NEED_RESULT_POINT_CALLBACK);if(a!=null){const ce=new we((r[0]+r[1])/2,e);a.foundPossibleResultPoint(ce)}let c=this.decodeMiddle(t,r,this.decodeRowStringBuffer),d=c.rowOffset,g=c.resultString;if(a!=null){const ce=new we(d,e);a.foundPossibleResultPoint(ce)}let w=this.decodeEnd(t,d);if(a!=null){const ce=new we((w[0]+w[1])/2,e);a.foundPossibleResultPoint(ce)}let E=w[1],A=E+(E-w[0]);if(A>=t.getSize()||!t.isRange(E,A,!1))throw new S;let I=g.toString();if(I.length<8)throw new H;if(!ve.checkChecksum(I))throw new M;let R=(r[1]+r[0])/2,D=(w[1]+w[0])/2,F=this.getBarcodeFormat(),Y=[new we(R,e),new we(D,e)],te=new me(I,null,0,Y,F,new Date().getTime()),ue=0;try{let ce=zn.decodeRow(e,t,w[1]);te.putMetadata(He.UPC_EAN_EXTENSION,ce.getText()),te.putAllMetadata(ce.getResultMetadata()),te.addResultPoints(ce.getResultPoints()),ue=ce.getText().length}catch{}let de=n==null?null:n.get(Z.ALLOWED_EAN_EXTENSIONS);if(de!=null){let ce=!1;for(let Xe in de)if(ue.toString()===Xe){ce=!0;break}if(!ce)throw new S}return te}decodeEnd(e,t){return ve.findGuardPattern(e,t,!1,ve.START_END_PATTERN,new Int32Array(ve.START_END_PATTERN.length).fill(0))}static checkChecksum(e){return ve.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(t===0)return!1;let n=parseInt(e.charAt(t-1),10);return ve.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 H;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 H;n+=a}return(1e3-n)%10}}class Be extends ve{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=ve.decodeDigit(e,r,c,ve.L_AND_G_PATTERNS);n+=String.fromCharCode(48+E%10);for(let A of r)c+=A;E>=10&&(d|=1<<5-w)}n=Be.determineFirstDigit(n,d),c=ve.findGuardPattern(e,c,!0,ve.MIDDLE_PATTERN,new Int32Array(ve.MIDDLE_PATTERN.length).fill(0))[1];for(let w=0;w<6&&c<a;w++){let E=ve.decodeDigit(e,r,c,ve.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 S}}Be.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class zt extends ve{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=ve.decodeDigit(e,r,c,ve.L_PATTERNS);n+=String.fromCharCode(48+w);for(let E of r)c+=E}c=ve.findGuardPattern(e,c,!0,ve.MIDDLE_PATTERN,new Int32Array(ve.MIDDLE_PATTERN.length).fill(0))[1];for(let g=0;g<4&&c<a;g++){let w=ve.decodeDigit(e,r,c,ve.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 It extends ve{constructor(){super(...arguments),this.ean13Reader=new Be}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 me(t.substring(1),null,null,e.getResultPoints(),xe.UPC_A);return e.getResultMetadata()!=null&&n.putAllMetadata(e.getResultMetadata()),n}else throw new S}reset(){this.ean13Reader.reset()}}class it extends ve{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=it.decodeDigit(e,r,c,it.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=it.determineNumSysAndCheckDigit(n,d);return{rowOffset:c,resultString:g}}decodeEnd(e,t){return it.findGuardPatternWithoutCounters(e,t,!0,it.MIDDLE_END_PATTERN)}checkChecksum(e){return ve.checkChecksum(it.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 S.getNotFoundInstance()}getBarcodeFormat(){return xe.UPC_E}static convertUPCEtoUPCA(e){const t=e.slice(1,7).split("").map(a=>a.charCodeAt(0)),n=new U;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()}}it.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),it.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 Rt extends mt{constructor(e){super();let t=e==null?null:e.get(Z.POSSIBLE_FORMATS),n=[];u(t)?(n.push(new Be),n.push(new It),n.push(new zt),n.push(new it)):(t.indexOf(xe.EAN_13)>-1&&n.push(new Be),t.indexOf(xe.UPC_A)>-1&&n.push(new It),t.indexOf(xe.EAN_8)>-1&&n.push(new zt),t.indexOf(xe.UPC_E)>-1&&n.push(new it)),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(Z.POSSIBLE_FORMATS),g=d==null||d.includes(xe.UPC_A);if(c&&g){const w=a.getRawBytes(),E=new me(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 S}reset(){for(let e of this.readers)e.reset()}}class nt extends mt{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(mt.patternMatchVariance(e,t[n],nt.MAX_INDIVIDUAL_VARIANCE)<nt.MAX_AVG_VARIANCE)return n;throw new S}static count(e){return Me.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>=nt.MIN_FINDER_PATTERN_RATIO&&r<=nt.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}}nt.MAX_AVG_VARIANCE=.2,nt.MAX_INDIVIDUAL_VARIANCE=.45,nt.MIN_FINDER_PATTERN_RATIO=9.5/12,nt.MAX_FINDER_PATTERN_RATIO=12.5/14;class sn{constructor(e,t){this.value=e,this.checksumPortion=t}getValue(){return this.value}getChecksumPortion(){return this.checksumPortion}toString(){return this.value+"("+this.checksumPortion+")"}equals(e){if(!(e instanceof sn))return!1;const t=e;return this.value===t.value&&this.checksumPortion===t.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class Cr{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 we(n,a)),this.resultPoints.push(new we(r,a))}getValue(){return this.value}getStartEnd(){return this.startEnd}getResultPoints(){return this.resultPoints}equals(e){if(!(e instanceof Cr))return!1;const t=e;return this.value===t.value}hashCode(){return this.value}}class an{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=an.combins(r-w-1,d-g-2);if(n&&c===0&&r-w-(d-g-1)>=d-g-1&&(E-=an.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+=an.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 ag{static buildBitArray(e){let t=e.length*2-1;e[e.length-1].getRightChar()==null&&(t-=1);let n=12*t,r=new P(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 Ao{constructor(e){this.newPosition=e}getNewPosition(){return this.newPosition}}class qt extends Ao{constructor(e,t){super(e),this.value=t}getValue(){return this.value}isFNC1(){return this.value===qt.FNC1}}qt.FNC1="$";class or 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 ln extends Ao{constructor(e,t,n){if(super(e),t<0||t>10||n<0||n>10)throw new H;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===ln.FNC1}isSecondDigitFNC1(){return this.secondDigit===ln.FNC1}isAnyFNC1(){return this.firstDigit===ln.FNC1||this.secondDigit===ln.FNC1}}ln.FNC1=10;class Ce{constructor(){}static parseFieldsInGeneralPurpose(e){if(!e)return null;if(e.length<2)throw new S;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 S;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 S;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 S}static processFixedAI(e,t,n){if(n.length<e)throw new S;let r=n.substring(0,e);if(n.length<e+t)throw new S;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 Er{constructor(e){this.buffer=new U,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 ln(this.information.getSize(),ln.FNC1,ln.FNC1):new ln(this.information.getSize(),a-1,ln.FNC1)}let t=this.extractNumericValueFromBitArray(e,7),n=(t-8)/11,r=(t-8)%11;return new ln(e+7,n,r)}extractNumericValueFromBitArray(e,t){return Er.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 qt(e+5,qt.FNC1);if(t>=5&&t<15)return new qt(e+5,"0"+(t-5));let n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<90)return new qt(e+7,""+(n+1));if(n>=90&&n<116)return new qt(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 H}return new qt(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 qt(e+5,qt.FNC1);if(t>=5&&t<15)return new qt(e+5,"0"+(t-5));let n=this.extractNumericValueFromBitArray(e,6);if(n>=32&&n<58)return new qt(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 Ue("Decoding invalid alphanumeric value: "+n)}return new qt(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 Er(e)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class Zt 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)}Zt.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)}}Zt.GTIN_SIZE=40;class yr extends Zt{constructor(e){super(e)}parseInformation(){let e=new U;e.append("(01)");let t=e.length(),n=this.getGeneralDecoder().extractNumericValueFromBitArray(yr.HEADER_SIZE,4);return e.append(n),this.encodeCompressedGtinWithoutAI(e,yr.HEADER_SIZE+4,t),this.getGeneralDecoder().decodeAllCodes(e,yr.HEADER_SIZE+44)}}yr.HEADER_SIZE=4;class Si extends Io{constructor(e){super(e)}parseInformation(){let e=new U;return this.getGeneralDecoder().decodeAllCodes(e,Si.HEADER_SIZE)}}Si.HEADER_SIZE=5;class Ni extends Zt{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 Sn extends Ni{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()!=Sn.HEADER_SIZE+Ni.GTIN_SIZE+Sn.WEIGHT_SIZE)throw new S;let e=new U;return this.encodeCompressedGtin(e,Sn.HEADER_SIZE),this.encodeCompressedWeight(e,Sn.HEADER_SIZE+Ni.GTIN_SIZE,Sn.WEIGHT_SIZE),e.toString()}}Sn.HEADER_SIZE=5,Sn.WEIGHT_SIZE=15;class lg extends Sn{constructor(e){super(e)}addWeightCode(e,t){e.append("(3103)")}checkWeight(e){return e}}class cg extends Sn{constructor(e){super(e)}addWeightCode(e,t){t<1e4?e.append("(3202)"):e.append("(3203)")}checkWeight(e){return e<1e4?e:e-1e4}}class Nn extends Zt{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<Nn.HEADER_SIZE+Zt.GTIN_SIZE)throw new S;let e=new U;this.encodeCompressedGtin(e,Nn.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(Nn.HEADER_SIZE+Zt.GTIN_SIZE,Nn.LAST_DIGIT_SIZE);e.append("(392"),e.append(t),e.append(")");let n=this.getGeneralDecoder().decodeGeneralPurposeField(Nn.HEADER_SIZE+Zt.GTIN_SIZE+Nn.LAST_DIGIT_SIZE,null);return e.append(n.getNewString()),e.toString()}}Nn.HEADER_SIZE=8,Nn.LAST_DIGIT_SIZE=2;class Ht extends Zt{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<Ht.HEADER_SIZE+Zt.GTIN_SIZE)throw new S;let e=new U;this.encodeCompressedGtin(e,Ht.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(Ht.HEADER_SIZE+Zt.GTIN_SIZE,Ht.LAST_DIGIT_SIZE);e.append("(393"),e.append(t),e.append(")");let n=this.getGeneralDecoder().extractNumericValueFromBitArray(Ht.HEADER_SIZE+Zt.GTIN_SIZE+Ht.LAST_DIGIT_SIZE,Ht.FIRST_THREE_DIGITS_SIZE);n/100==0&&e.append("0"),n/10==0&&e.append("0"),e.append(n);let r=this.getGeneralDecoder().decodeGeneralPurposeField(Ht.HEADER_SIZE+Zt.GTIN_SIZE+Ht.LAST_DIGIT_SIZE+Ht.FIRST_THREE_DIGITS_SIZE,null);return e.append(r.getNewString()),e.toString()}}Ht.HEADER_SIZE=8,Ht.LAST_DIGIT_SIZE=2,Ht.FIRST_THREE_DIGITS_SIZE=10;class gt extends Ni{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 S;let e=new U;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 Va(b){try{if(b.get(1))return new yr(b);if(!b.get(2))return new Si(b);switch(Er.extractNumericValueFromBitArray(b,1,4)){case 4:return new lg(b);case 5:return new cg(b)}switch(Er.extractNumericValueFromBitArray(b,1,5)){case 12:return new Nn(b);case 13:return new Ht(b)}switch(Er.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 Ue("unknown decoder: "+b)}}class Hn{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 Hn?Hn.equalsOrNull(e.leftchar,t.leftchar)&&Hn.equalsOrNull(e.rightchar,t.rightchar)&&Hn.equalsOrNull(e.finderpattern,t.finderpattern):!1}static equalsOrNull(e,t){return e===null?t===null:Hn.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 le extends nt{constructor(e){super(...arguments),this.pairs=new Array(le.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 le.constructResult(this.decodeRow2pairs(e,t))}catch(r){this.verbose&&console.log(r)}return this.pairs.length=0,this.startFromEven=!0,le.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 S){if(!this.pairs.length)throw new S;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 S}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()),!le.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 S}static isValidSequence(e){for(let t of le.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||le.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(Hn.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=ag.buildBitArray(e),r=Va(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 me(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=le.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 S;let w;try{w=this.decodeDataCharacter(e,a,r,!1)}catch(E){w=null,this.verbose&&console.log(E)}return new Hn(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&&le.reverseCounters(r),le.isFinderPattern(r)){this.startEnd[0]=E,this.startEnd[1]=A;return}d&&le.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 S}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();L.arraycopy(d,0,d,1,d.length-1),d[0]=r;let g;try{g=this.parseFinderValue(d,le.FINDER_PATTERNS)}catch{return null}return new Cr(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)le.recordPatternInReverse(e,t.getStartEnd()[0],a);else{le.recordPattern(e,t.getStartEnd()[1],a);for(let st=0,Dt=a.length-1;st<Dt;st++,Dt--){let nn=a[st];a[st]=a[Dt],a[Dt]=nn}}let c=17,d=Me.sum(new Int32Array(a))/c,g=(t.getStartEnd()[1]-t.getStartEnd()[0])/15;if(Math.abs(d-g)/g>.3)throw new S;let w=this.getOddCounts(),E=this.getEvenCounts(),A=this.getOddRoundingErrors(),I=this.getEvenRoundingErrors();for(let st=0;st<a.length;st++){let Dt=1*a[st]/d,nn=Dt+.5;if(nn<1){if(Dt<.3)throw new S;nn=1}else if(nn>8){if(Dt>8.7)throw new S;nn=8}let Nr=st/2;st&1?(E[Nr]=nn,I[Nr]=Dt-nn):(w[Nr]=nn,A[Nr]=Dt-nn)}this.adjustOddEvenCounts(c);let R=4*t.getValue()+(n?0:2)+(r?0:1)-1,D=0,F=0;for(let st=w.length-1;st>=0;st--){if(le.isNotA1left(t,n,r)){let Dt=le.WEIGHTS[R][2*st];F+=w[st]*Dt}D+=w[st]}let Y=0;for(let st=E.length-1;st>=0;st--)if(le.isNotA1left(t,n,r)){let Dt=le.WEIGHTS[R][2*st+1];Y+=E[st]*Dt}let te=F+Y;if(D&1||D>13||D<4)throw new S;let ue=(13-D)/2,de=le.SYMBOL_WIDEST[ue],ce=9-de,Xe=an.getRSSvalue(w,de,!0),Pe=an.getRSSvalue(E,ce,!1),$t=le.EVEN_TOTAL_SUBSET[ue],_n=le.GSUM[ue],Kt=Xe*$t+Pe+_n;return new sn(Kt,te)}static isNotA1left(e,t,n){return!(e.getValue()==0&&t&&n)}adjustOddEvenCounts(e){let t=Me.sum(new Int32Array(this.getOddCounts())),n=Me.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 S;a=!0}else{if(!E)throw new S;d=!0}else if(g==-1)if(w){if(E)throw new S;r=!0}else{if(!E)throw new S;c=!0}else if(g==0){if(w){if(!E)throw new S;t<n?(r=!0,d=!0):(a=!0,c=!0)}else if(E)throw new S}else throw new S;if(r){if(a)throw new S;le.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(a&&le.decrement(this.getOddCounts(),this.getOddRoundingErrors()),c){if(d)throw new S;le.increment(this.getEvenCounts(),this.getOddRoundingErrors())}d&&le.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}le.SYMBOL_WIDEST=[7,5,4,3,1],le.EVEN_TOTAL_SUBSET=[4,20,52,104,204],le.GSUM=[0,348,1388,2948,3988],le.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])],le.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]],le.FINDER_PAT_A=0,le.FINDER_PAT_B=1,le.FINDER_PAT_C=2,le.FINDER_PAT_D=3,le.FINDER_PAT_E=4,le.FINDER_PAT_F=5,le.FINDER_PATTERN_SEQUENCES=[[le.FINDER_PAT_A,le.FINDER_PAT_A],[le.FINDER_PAT_A,le.FINDER_PAT_B,le.FINDER_PAT_B],[le.FINDER_PAT_A,le.FINDER_PAT_C,le.FINDER_PAT_B,le.FINDER_PAT_D],[le.FINDER_PAT_A,le.FINDER_PAT_E,le.FINDER_PAT_B,le.FINDER_PAT_D,le.FINDER_PAT_C],[le.FINDER_PAT_A,le.FINDER_PAT_E,le.FINDER_PAT_B,le.FINDER_PAT_D,le.FINDER_PAT_D,le.FINDER_PAT_F],[le.FINDER_PAT_A,le.FINDER_PAT_E,le.FINDER_PAT_B,le.FINDER_PAT_D,le.FINDER_PAT_E,le.FINDER_PAT_F,le.FINDER_PAT_F],[le.FINDER_PAT_A,le.FINDER_PAT_A,le.FINDER_PAT_B,le.FINDER_PAT_B,le.FINDER_PAT_C,le.FINDER_PAT_C,le.FINDER_PAT_D,le.FINDER_PAT_D],[le.FINDER_PAT_A,le.FINDER_PAT_A,le.FINDER_PAT_B,le.FINDER_PAT_B,le.FINDER_PAT_C,le.FINDER_PAT_C,le.FINDER_PAT_D,le.FINDER_PAT_E,le.FINDER_PAT_E],[le.FINDER_PAT_A,le.FINDER_PAT_A,le.FINDER_PAT_B,le.FINDER_PAT_B,le.FINDER_PAT_C,le.FINDER_PAT_C,le.FINDER_PAT_D,le.FINDER_PAT_E,le.FINDER_PAT_F,le.FINDER_PAT_F],[le.FINDER_PAT_A,le.FINDER_PAT_A,le.FINDER_PAT_B,le.FINDER_PAT_B,le.FINDER_PAT_C,le.FINDER_PAT_D,le.FINDER_PAT_D,le.FINDER_PAT_E,le.FINDER_PAT_E,le.FINDER_PAT_F,le.FINDER_PAT_F]],le.MAX_PAIRS=11;class ug extends sn{constructor(e,t,n){super(e,t),this.count=0,this.finderPattern=n}getFinderPattern(){return this.finderPattern}getCount(){return this.count}incrementCount(){this.count++}}class wt extends nt{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(e,t,n){const r=this.decodePair(t,!1,e,n);wt.addOrTally(this.possibleLeftPairs,r),t.reverse();let a=this.decodePair(t,!0,e,n);wt.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&&wt.checkChecksum(c,d))return wt.constructResult(c,d)}throw new S}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 U;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 me(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(Z.NEED_RESULT_POINT_CALLBACK);if(d!=null){let E=(a[0]+a[1])/2;t&&(E=e.getSize()-1-E),d.foundPossibleResultPoint(new we(E,n))}let g=this.decodeDataCharacter(e,c,!0),w=this.decodeDataCharacter(e,c,!1);return new ug(1597*g.getValue()+w.getValue(),g.getChecksumPortion()+4*w.getChecksumPortion(),c)}catch{return null}}decodeDataCharacter(e,t,n){let r=this.getDataCharacterCounters();for(let Y=0;Y<r.length;Y++)r[Y]=0;if(n)mt.recordPatternInReverse(e,t.getStartEnd()[0],r);else{mt.recordPattern(e,t.getStartEnd()[1]+1,r);for(let Y=0,te=r.length-1;Y<te;Y++,te--){let ue=r[Y];r[Y]=r[te],r[te]=ue}}let a=n?16:15,c=Me.sum(new Int32Array(r))/a,d=this.getOddCounts(),g=this.getEvenCounts(),w=this.getOddRoundingErrors(),E=this.getEvenRoundingErrors();for(let Y=0;Y<r.length;Y++){let te=r[Y]/c,ue=Math.floor(te+.5);ue<1?ue=1:ue>8&&(ue=8);let de=Math.floor(Y/2);Y&1?(g[de]=ue,E[de]=te-ue):(d[de]=ue,w[de]=te-ue)}this.adjustOddEvenCounts(n,a);let A=0,I=0;for(let Y=d.length-1;Y>=0;Y--)I*=9,I+=d[Y],A+=d[Y];let R=0,D=0;for(let Y=g.length-1;Y>=0;Y--)R*=9,R+=g[Y],D+=g[Y];let F=I+3*R;if(n){if(A&1||A>12||A<4)throw new S;let Y=(12-A)/2,te=wt.OUTSIDE_ODD_WIDEST[Y],ue=9-te,de=an.getRSSvalue(d,te,!1),ce=an.getRSSvalue(g,ue,!0),Xe=wt.OUTSIDE_EVEN_TOTAL_SUBSET[Y],Pe=wt.OUTSIDE_GSUM[Y];return new sn(de*Xe+ce+Pe,F)}else{if(D&1||D>10||D<4)throw new S;let Y=(10-D)/2,te=wt.INSIDE_ODD_WIDEST[Y],ue=9-te,de=an.getRSSvalue(d,te,!0),ce=an.getRSSvalue(g,ue,!1),Xe=wt.INSIDE_ODD_TOTAL_SUBSET[Y],Pe=wt.INSIDE_GSUM[Y];return new sn(ce*Xe+de+Pe,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(nt.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 S}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);L.arraycopy(g,0,w,1,g.length-1),w[0]=d;const E=this.parseFinderValue(w,wt.FINDER_PATTERNS);let A=c,I=r[1];return n&&(A=e.getSize()-1-A,I=e.getSize()-1-I),new Cr(E,[c,r[1]],A,I,t)}adjustOddEvenCounts(e,t){let n=Me.sum(new Int32Array(this.getOddCounts())),r=Me.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 S;c=!0}else{if(!A)throw new S;g=!0}else if(w===-1)if(E){if(A)throw new S;a=!0}else{if(!A)throw new S;d=!0}else if(w===0){if(E){if(!A)throw new S;n<r?(a=!0,g=!0):(c=!0,d=!0)}else if(A)throw new S}else throw new S;if(a){if(c)throw new S;nt.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(c&&nt.decrement(this.getOddCounts(),this.getOddRoundingErrors()),d){if(g)throw new S;nt.increment(this.getEvenCounts(),this.getOddRoundingErrors())}g&&nt.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}wt.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],wt.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],wt.OUTSIDE_GSUM=[0,161,961,2015,2715],wt.INSIDE_GSUM=[0,336,1036,1516],wt.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],wt.INSIDE_ODD_WIDEST=[2,4,6,8],wt.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 br extends mt{constructor(e,t){super(),this.readers=[],this.verbose=t===!0;const n=e?e.get(Z.POSSIBLE_FORMATS):null,r=e&&e.get(Z.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 Rt(e)),n.includes(xe.CODE_39)&&this.readers.push(new ae(r)),n.includes(xe.CODE_128)&&this.readers.push(new ee),n.includes(xe.ITF)&&this.readers.push(new ye),n.includes(xe.RSS_14)&&this.readers.push(new wt),n.includes(xe.RSS_EXPANDED)&&this.readers.push(new le(this.verbose))):(this.readers.push(new Rt(e)),this.readers.push(new ae),this.readers.push(new Rt(e)),this.readers.push(new ee),this.readers.push(new ye),this.readers.push(new wt),this.readers.push(new le(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 S}reset(){this.readers.forEach(e=>e.reset())}}class dg extends Ee{constructor(e=500,t){super(new br(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 Ze{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 H;for(let n of Ze.VERSIONS)if(n.symbolSizeRows===e&&n.symbolSizeColumns===t)return n;throw new H}toString(){return""+this.versionNumber}static buildVersions(){return[new Ze(1,10,10,8,8,new tt(5,new Je(1,3))),new Ze(2,12,12,10,10,new tt(7,new Je(1,5))),new Ze(3,14,14,12,12,new tt(10,new Je(1,8))),new Ze(4,16,16,14,14,new tt(12,new Je(1,12))),new Ze(5,18,18,16,16,new tt(14,new Je(1,18))),new Ze(6,20,20,18,18,new tt(18,new Je(1,22))),new Ze(7,22,22,20,20,new tt(20,new Je(1,30))),new Ze(8,24,24,22,22,new tt(24,new Je(1,36))),new Ze(9,26,26,24,24,new tt(28,new Je(1,44))),new Ze(10,32,32,14,14,new tt(36,new Je(1,62))),new Ze(11,36,36,16,16,new tt(42,new Je(1,86))),new Ze(12,40,40,18,18,new tt(48,new Je(1,114))),new Ze(13,44,44,20,20,new tt(56,new Je(1,144))),new Ze(14,48,48,22,22,new tt(68,new Je(1,174))),new Ze(15,52,52,24,24,new tt(42,new Je(2,102))),new Ze(16,64,64,14,14,new tt(56,new Je(2,140))),new Ze(17,72,72,16,16,new tt(36,new Je(4,92))),new Ze(18,80,80,18,18,new tt(48,new Je(4,114))),new Ze(19,88,88,20,20,new tt(56,new Je(4,144))),new Ze(20,96,96,22,22,new tt(68,new Je(4,174))),new Ze(21,104,104,24,24,new tt(56,new Je(6,136))),new Ze(22,120,120,18,18,new tt(68,new Je(6,175))),new Ze(23,132,132,20,20,new tt(62,new Je(8,163))),new Ze(24,144,144,22,22,new tt(62,new Je(8,156),new Je(2,155))),new Ze(25,8,18,6,16,new tt(7,new Je(1,5))),new Ze(26,8,32,6,14,new tt(11,new Je(1,10))),new Ze(27,12,26,10,24,new tt(14,new Je(1,16))),new Ze(28,12,36,10,16,new tt(18,new Je(1,22))),new Ze(29,16,36,14,16,new tt(24,new Je(1,32))),new Ze(30,16,48,14,22,new tt(28,new Je(1,49)))]}}Ze.VERSIONS=Ze.buildVersions();class No{constructor(e){const t=e.getHeight();if(t<8||t>144||t&1)throw new H;this.version=No.readVersion(e),this.mappingBitMatrix=this.extractDataRegion(e),this.readMappingMatrix=new W(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(e){const t=e.getHeight(),n=e.getWidth();return Ze.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 H;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 W(w,g);for(let A=0;A<c;++A){const I=A*r;for(let R=0;R<d;++R){const D=R*a;for(let F=0;F<r;++F){const Y=A*(r+2)+1+F,te=I+F;for(let ue=0;ue<a;++ue){const de=R*(a+2)+1+ue;if(e.get(de,Y)){const ce=D+ue;E.set(ce,te)}}}}}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 Y=0;Y<F.getCount();Y++){const te=F.getDataCodewords(),ue=n.getECCodewords()+te;c[d++]=new To(te,new Uint8Array(ue))}const w=c[0].codewords.length-n.getECCodewords(),E=w-1;let A=0;for(let F=0;F<E;F++)for(let Y=0;Y<d;Y++)c[Y].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 D=c[0].codewords.length;for(let F=w;F<D;F++)for(let Y=0;Y<d;Y++){const te=I?(Y+8)%d:Y,ue=I&&te>7?F-1:F;c[te].codewords[ue]=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 Gn{static decode(e){const t=new ko(e),n=new U,r=new U,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 H}c=St.ASCII_ENCODE}while(c!==St.PAD_ENCODE&&t.available()>0);return r.length()>0&&n.append(r.toString()),new Ae(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 H;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 H;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 H;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 H}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 H}}}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 H;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 H}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 H;break;default:throw new H}}}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 H;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 H;const d=new Uint8Array(c);for(let g=0;g<c;g++){if(e.available()<8)throw new H;d[g]=this.unrandomize255State(e.readBits(8),r++)}n.push(d);try{t.append(oe.decode(d,ne.ISO88591))}catch(g){throw new Ue("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}}Gn.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"],Gn.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],Gn.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"],Gn.TEXT_SHIFT2_SET_CHARS=Gn.C40_SHIFT2_SET_CHARS,Gn.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 fg{constructor(){this.rsDecoder=new lt(Te.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 Gn.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 Ct{constructor(e){this.image=e,this.rectangleDetector=new xn(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 S;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=Ct.sampleGrid(this.image,n,r,a,c,d,g);return new rr(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 we(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 we(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=Ct.shiftPoint(n,r,(c+1)*4),g=Ct.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=Ct.shiftPoint(t,n,(d+1)*4),w=Ct.shiftPoint(r,n,(c+1)*4);c=this.transitionsBetween(g,a),d=this.transitionsBetween(w,a);let E=new we(a.getX()+(r.getX()-n.getX())/(c+1),a.getY()+(r.getY()-n.getY())/(c+1)),A=new we(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=Ct.shiftPoint(t,n,d*4),w=Ct.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=Ct.moveAway(t,E,A),n=Ct.moveAway(n,E,A),r=Ct.moveAway(r,E,A),a=Ct.moveAway(a,E,A);let I,R;return g=Ct.shiftPoint(t,n,d*4),g=Ct.shiftPoint(g,a,c*4),I=Ct.shiftPoint(n,t,d*4),I=Ct.shiftPoint(I,r,c*4),w=Ct.shiftPoint(r,a,d*4),w=Ct.shiftPoint(w,n,c*4),R=Ct.shiftPoint(a,r,d*4),R=Ct.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 In.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,D=this.image.get(d?r:n,d?n:r);for(let F=n,Y=r;F!==a;F+=I){let te=this.image.get(d?Y:F,d?F:Y);if(te!==D&&(R++,D=te),E+=w,E>0){if(Y===c)break;Y+=A,E-=g}}return R}}class Wn{constructor(){this.decoder=new fg}decode(e,t=null){let n,r;if(t!=null&&t.has(Z.PURE_BARCODE)){const w=Wn.extractPureBits(e.getBlackMatrix());n=this.decoder.decode(w),r=Wn.NO_POINTS}else{const w=new Ct(e.getBlackMatrix()).detect();n=this.decoder.decode(w.getBits()),r=w.getPoints()}const a=n.getRawBytes(),c=new me(n.getText(),a,8*a.length,r,xe.DATA_MATRIX,L.currentTimeMillis()),d=n.getByteSegments();d!=null&&c.putMetadata(He.BYTE_SEGMENTS,d);const g=n.getECLevel();return g!=null&&c.putMetadata(He.ERROR_CORRECTION_LEVEL,g),c}reset(){}static extractPureBits(e){const t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t==null||n==null)throw new S;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 S;const A=r/2;a+=A,d+=A;const I=new W(w,E);for(let R=0;R<E;R++){const D=a+R*r;for(let F=0;F<w;F++)e.get(d+F*r,D)&&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 S;const c=r-e[0];if(c===0)throw new S;return c}}Wn.NO_POINTS=[];class hg extends Ee{constructor(e=500){super(new Wn,e)}}var Ar;(function(b){b[b.L=0]="L",b[b.M=1]="M",b[b.Q=2]="Q",b[b.H=3]="H"})(Ar||(Ar={}));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(Ar.L,"L",1),ct.M=new ct(Ar.M,"M",0),ct.Q=new ct(Ar.Q,"Q",3),ct.H=new ct(Ar.H,"H",2);class Ft{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=Ft.doDecodeFormatInformation(e,t);return n!==null?n:Ft.doDecodeFormatInformation(e^Ft.FORMAT_INFO_MASK_QR,t^Ft.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(e,t){let n=Number.MAX_SAFE_INTEGER,r=0;for(const a of Ft.FORMAT_INFO_DECODE_LOOKUP){const c=a[0];if(c===e||c===t)return new Ft(a[1]);let d=Ft.numBitsDiffering(e,c);d<n&&(r=a[1],n=d),e!==t&&(d=Ft.numBitsDiffering(t,c),d<n&&(r=a[1],n=d))}return n<=3?new Ft(r):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(e){if(!(e instanceof Ft))return!1;const t=e;return this.errorCorrectionLevel===t.errorCorrectionLevel&&this.dataMask===t.dataMask}}Ft.FORMAT_INFO_MASK_QR=21522,Ft.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 K{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 Se{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 H;try{return this.getVersionForNumber((e-17)/4)}catch{throw new H}}static getVersionForNumber(e){if(e<1||e>40)throw new y;return Se.VERSIONS[e-1]}static decodeVersionInformation(e){let t=Number.MAX_SAFE_INTEGER,n=0;for(let r=0;r<Se.VERSION_DECODE_INFO.length;r++){const a=Se.VERSION_DECODE_INFO[r];if(a===e)return Se.getVersionForNumber(r+7);const c=Ft.numBitsDiffering(e,a);c<t&&(n=r+7,t=c)}return t<=3?Se.getVersionForNumber(n):null}buildFunctionPattern(){const e=this.getDimensionForVersion(),t=new W(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}}Se.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]),Se.VERSIONS=[new Se(1,new Int32Array(0),new K(7,new T(1,19)),new K(10,new T(1,16)),new K(13,new T(1,13)),new K(17,new T(1,9))),new Se(2,Int32Array.from([6,18]),new K(10,new T(1,34)),new K(16,new T(1,28)),new K(22,new T(1,22)),new K(28,new T(1,16))),new Se(3,Int32Array.from([6,22]),new K(15,new T(1,55)),new K(26,new T(1,44)),new K(18,new T(2,17)),new K(22,new T(2,13))),new Se(4,Int32Array.from([6,26]),new K(20,new T(1,80)),new K(18,new T(2,32)),new K(26,new T(2,24)),new K(16,new T(4,9))),new Se(5,Int32Array.from([6,30]),new K(26,new T(1,108)),new K(24,new T(2,43)),new K(18,new T(2,15),new T(2,16)),new K(22,new T(2,11),new T(2,12))),new Se(6,Int32Array.from([6,34]),new K(18,new T(2,68)),new K(16,new T(4,27)),new K(24,new T(4,19)),new K(28,new T(4,15))),new Se(7,Int32Array.from([6,22,38]),new K(20,new T(2,78)),new K(18,new T(4,31)),new K(18,new T(2,14),new T(4,15)),new K(26,new T(4,13),new T(1,14))),new Se(8,Int32Array.from([6,24,42]),new K(24,new T(2,97)),new K(22,new T(2,38),new T(2,39)),new K(22,new T(4,18),new T(2,19)),new K(26,new T(4,14),new T(2,15))),new Se(9,Int32Array.from([6,26,46]),new K(30,new T(2,116)),new K(22,new T(3,36),new T(2,37)),new K(20,new T(4,16),new T(4,17)),new K(24,new T(4,12),new T(4,13))),new Se(10,Int32Array.from([6,28,50]),new K(18,new T(2,68),new T(2,69)),new K(26,new T(4,43),new T(1,44)),new K(24,new T(6,19),new T(2,20)),new K(28,new T(6,15),new T(2,16))),new Se(11,Int32Array.from([6,30,54]),new K(20,new T(4,81)),new K(30,new T(1,50),new T(4,51)),new K(28,new T(4,22),new T(4,23)),new K(24,new T(3,12),new T(8,13))),new Se(12,Int32Array.from([6,32,58]),new K(24,new T(2,92),new T(2,93)),new K(22,new T(6,36),new T(2,37)),new K(26,new T(4,20),new T(6,21)),new K(28,new T(7,14),new T(4,15))),new Se(13,Int32Array.from([6,34,62]),new K(26,new T(4,107)),new K(22,new T(8,37),new T(1,38)),new K(24,new T(8,20),new T(4,21)),new K(22,new T(12,11),new T(4,12))),new Se(14,Int32Array.from([6,26,46,66]),new K(30,new T(3,115),new T(1,116)),new K(24,new T(4,40),new T(5,41)),new K(20,new T(11,16),new T(5,17)),new K(24,new T(11,12),new T(5,13))),new Se(15,Int32Array.from([6,26,48,70]),new K(22,new T(5,87),new T(1,88)),new K(24,new T(5,41),new T(5,42)),new K(30,new T(5,24),new T(7,25)),new K(24,new T(11,12),new T(7,13))),new Se(16,Int32Array.from([6,26,50,74]),new K(24,new T(5,98),new T(1,99)),new K(28,new T(7,45),new T(3,46)),new K(24,new T(15,19),new T(2,20)),new K(30,new T(3,15),new T(13,16))),new Se(17,Int32Array.from([6,30,54,78]),new K(28,new T(1,107),new T(5,108)),new K(28,new T(10,46),new T(1,47)),new K(28,new T(1,22),new T(15,23)),new K(28,new T(2,14),new T(17,15))),new Se(18,Int32Array.from([6,30,56,82]),new K(30,new T(5,120),new T(1,121)),new K(26,new T(9,43),new T(4,44)),new K(28,new T(17,22),new T(1,23)),new K(28,new T(2,14),new T(19,15))),new Se(19,Int32Array.from([6,30,58,86]),new K(28,new T(3,113),new T(4,114)),new K(26,new T(3,44),new T(11,45)),new K(26,new T(17,21),new T(4,22)),new K(26,new T(9,13),new T(16,14))),new Se(20,Int32Array.from([6,34,62,90]),new K(28,new T(3,107),new T(5,108)),new K(26,new T(3,41),new T(13,42)),new K(30,new T(15,24),new T(5,25)),new K(28,new T(15,15),new T(10,16))),new Se(21,Int32Array.from([6,28,50,72,94]),new K(28,new T(4,116),new T(4,117)),new K(26,new T(17,42)),new K(28,new T(17,22),new T(6,23)),new K(30,new T(19,16),new T(6,17))),new Se(22,Int32Array.from([6,26,50,74,98]),new K(28,new T(2,111),new T(7,112)),new K(28,new T(17,46)),new K(30,new T(7,24),new T(16,25)),new K(24,new T(34,13))),new Se(23,Int32Array.from([6,30,54,78,102]),new K(30,new T(4,121),new T(5,122)),new K(28,new T(4,47),new T(14,48)),new K(30,new T(11,24),new T(14,25)),new K(30,new T(16,15),new T(14,16))),new Se(24,Int32Array.from([6,28,54,80,106]),new K(30,new T(6,117),new T(4,118)),new K(28,new T(6,45),new T(14,46)),new K(30,new T(11,24),new T(16,25)),new K(30,new T(30,16),new T(2,17))),new Se(25,Int32Array.from([6,32,58,84,110]),new K(26,new T(8,106),new T(4,107)),new K(28,new T(8,47),new T(13,48)),new K(30,new T(7,24),new T(22,25)),new K(30,new T(22,15),new T(13,16))),new Se(26,Int32Array.from([6,30,58,86,114]),new K(28,new T(10,114),new T(2,115)),new K(28,new T(19,46),new T(4,47)),new K(28,new T(28,22),new T(6,23)),new K(30,new T(33,16),new T(4,17))),new Se(27,Int32Array.from([6,34,62,90,118]),new K(30,new T(8,122),new T(4,123)),new K(28,new T(22,45),new T(3,46)),new K(30,new T(8,23),new T(26,24)),new K(30,new T(12,15),new T(28,16))),new Se(28,Int32Array.from([6,26,50,74,98,122]),new K(30,new T(3,117),new T(10,118)),new K(28,new T(3,45),new T(23,46)),new K(30,new T(4,24),new T(31,25)),new K(30,new T(11,15),new T(31,16))),new Se(29,Int32Array.from([6,30,54,78,102,126]),new K(30,new T(7,116),new T(7,117)),new K(28,new T(21,45),new T(7,46)),new K(30,new T(1,23),new T(37,24)),new K(30,new T(19,15),new T(26,16))),new Se(30,Int32Array.from([6,26,52,78,104,130]),new K(30,new T(5,115),new T(10,116)),new K(28,new T(19,47),new T(10,48)),new K(30,new T(15,24),new T(25,25)),new K(30,new T(23,15),new T(25,16))),new Se(31,Int32Array.from([6,30,56,82,108,134]),new K(30,new T(13,115),new T(3,116)),new K(28,new T(2,46),new T(29,47)),new K(30,new T(42,24),new T(1,25)),new K(30,new T(23,15),new T(28,16))),new Se(32,Int32Array.from([6,34,60,86,112,138]),new K(30,new T(17,115)),new K(28,new T(10,46),new T(23,47)),new K(30,new T(10,24),new T(35,25)),new K(30,new T(19,15),new T(35,16))),new Se(33,Int32Array.from([6,30,58,86,114,142]),new K(30,new T(17,115),new T(1,116)),new K(28,new T(14,46),new T(21,47)),new K(30,new T(29,24),new T(19,25)),new K(30,new T(11,15),new T(46,16))),new Se(34,Int32Array.from([6,34,62,90,118,146]),new K(30,new T(13,115),new T(6,116)),new K(28,new T(14,46),new T(23,47)),new K(30,new T(44,24),new T(7,25)),new K(30,new T(59,16),new T(1,17))),new Se(35,Int32Array.from([6,30,54,78,102,126,150]),new K(30,new T(12,121),new T(7,122)),new K(28,new T(12,47),new T(26,48)),new K(30,new T(39,24),new T(14,25)),new K(30,new T(22,15),new T(41,16))),new Se(36,Int32Array.from([6,24,50,76,102,128,154]),new K(30,new T(6,121),new T(14,122)),new K(28,new T(6,47),new T(34,48)),new K(30,new T(46,24),new T(10,25)),new K(30,new T(2,15),new T(64,16))),new Se(37,Int32Array.from([6,28,54,80,106,132,158]),new K(30,new T(17,122),new T(4,123)),new K(28,new T(29,46),new T(14,47)),new K(30,new T(49,24),new T(10,25)),new K(30,new T(24,15),new T(46,16))),new Se(38,Int32Array.from([6,32,58,84,110,136,162]),new K(30,new T(4,122),new T(18,123)),new K(28,new T(13,46),new T(32,47)),new K(30,new T(48,24),new T(14,25)),new K(30,new T(42,15),new T(32,16))),new Se(39,Int32Array.from([6,26,54,82,110,138,166]),new K(30,new T(20,117),new T(4,118)),new K(28,new T(40,47),new T(7,48)),new K(30,new T(43,24),new T(22,25)),new K(30,new T(10,15),new T(67,16))),new Se(40,Int32Array.from([6,30,58,86,114,142,170]),new K(30,new T(19,118),new T(6,119)),new K(28,new T(18,47),new T(31,48)),new K(30,new T(34,24),new T(34,25)),new K(30,new T(20,15),new T(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 cn{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)}}cn.values=new Map([[Ot.DATA_MASK_000,new cn(Ot.DATA_MASK_000,(b,e)=>(b+e&1)===0)],[Ot.DATA_MASK_001,new cn(Ot.DATA_MASK_001,(b,e)=>(b&1)===0)],[Ot.DATA_MASK_010,new cn(Ot.DATA_MASK_010,(b,e)=>e%3===0)],[Ot.DATA_MASK_011,new cn(Ot.DATA_MASK_011,(b,e)=>(b+e)%3===0)],[Ot.DATA_MASK_100,new cn(Ot.DATA_MASK_100,(b,e)=>(Math.floor(b/2)+Math.floor(e/3)&1)===0)],[Ot.DATA_MASK_101,new cn(Ot.DATA_MASK_101,(b,e)=>b*e%6===0)],[Ot.DATA_MASK_110,new cn(Ot.DATA_MASK_110,(b,e)=>b*e%6<3)],[Ot.DATA_MASK_111,new cn(Ot.DATA_MASK_111,(b,e)=>(b+e+b*e%3&1)===0)]]);class gg{constructor(e){const t=e.getHeight();if(t<21||(t&3)!==1)throw new H;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=Ft.decodeFormatInformation(e,n),this.parsedFormatInfo!==null)return this.parsedFormatInfo;throw new H}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 Se.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=Se.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=Se.decodeVersionInformation(n),a!==null&&a.getDimensionForVersion()===e)return this.parsedVersion=a,a;throw new H}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=cn.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 D=0;D<2;D++)a.get(A-D,R)||(E++,w<<=1,this.bitMatrix.get(A-D,R)&&(w|=1),E===8&&(d[g++]=w,E=0,w=0))}c=!c}if(g!==t.getTotalCodewords())throw new H;return d}remask(){if(this.parsedFormatInfo===null)return;const e=cn.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 D of c)a+=D.getCount();const d=new Array(a);let g=0;for(const D of c)for(let F=0;F<D.getCount();F++){const Y=D.getDataCodewords(),te=r.getECCodewordsPerBlock()+Y;d[g++]=new Ro(Y,new Uint8Array(te))}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 D=0;D<A;D++)for(let F=0;F<g;F++)d[F].codewords[D]=e[I++];for(let D=E;D<g;D++)d[D].codewords[A]=e[I++];const R=d[0].codewords.length;for(let D=A;D<R;D++)for(let F=0;F<g;F++){const Y=F<E?D:D+1;d[F].codewords[Y]=e[I++]}return d}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}var un;(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"})(un||(un={}));class Ne{constructor(e,t,n,r){this.value=e,this.stringValue=t,this.characterCountBitsForVersions=n,this.bits=r,Ne.FOR_BITS.set(r,this),Ne.FOR_VALUE.set(e,this)}static forBits(e){const t=Ne.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 Ne))return!1;const t=e;return this.value===t.value}toString(){return this.stringValue}}Ne.FOR_BITS=new Map,Ne.FOR_VALUE=new Map,Ne.TERMINATOR=new Ne(un.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),Ne.NUMERIC=new Ne(un.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),Ne.ALPHANUMERIC=new Ne(un.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),Ne.STRUCTURED_APPEND=new Ne(un.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),Ne.BYTE=new Ne(un.BYTE,"BYTE",Int32Array.from([8,16,16]),4),Ne.ECI=new Ne(un.ECI,"ECI",Int32Array.from([0,0,0]),7),Ne.KANJI=new Ne(un.KANJI,"KANJI",Int32Array.from([8,10,12]),8),Ne.FNC1_FIRST_POSITION=new Ne(un.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),Ne.FNC1_SECOND_POSITION=new Ne(un.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),Ne.HANZI=new Ne(un.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class pt{static decode(e,t,n,r){const a=new ko(e);let c=new U;const d=new Array;let g=-1,w=-1;try{let E=null,A=!1,I;do{if(a.available()<4)I=Ne.TERMINATOR;else{const R=a.readBits(4);I=Ne.forBits(R)}switch(I){case Ne.TERMINATOR:break;case Ne.FNC1_FIRST_POSITION:case Ne.FNC1_SECOND_POSITION:A=!0;break;case Ne.STRUCTURED_APPEND:if(a.available()<16)throw new H;g=a.readBits(8),w=a.readBits(8);break;case Ne.ECI:const R=pt.parseECIValue(a);if(E=j.getCharacterSetECIByValue(R),E===null)throw new H;break;case Ne.HANZI:const D=a.readBits(4),F=a.readBits(I.getCharacterCountBits(t));D===pt.GB2312_SUBSET&&pt.decodeHanziSegment(a,c,F);break;default:const Y=a.readBits(I.getCharacterCountBits(t));switch(I){case Ne.NUMERIC:pt.decodeNumericSegment(a,c,Y);break;case Ne.ALPHANUMERIC:pt.decodeAlphanumericSegment(a,c,Y,A);break;case Ne.BYTE:pt.decodeByteSegment(a,c,Y,E,d,r);break;case Ne.KANJI:pt.decodeKanjiSegment(a,c,Y);break;default:throw new H}break}}while(I!==Ne.TERMINATOR)}catch{throw new H}return new Ae(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 H;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(oe.decode(r,ne.GB2312))}catch(c){throw new H(c)}}static decodeKanjiSegment(e,t,n){if(n*13>e.available())throw new H;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(oe.decode(r,ne.SHIFT_JIS))}catch(c){throw new H(c)}}static decodeByteSegment(e,t,n,r,a,c){if(8*n>e.available())throw new H;const d=new Uint8Array(n);for(let w=0;w<n;w++)d[w]=e.readBits(8);let g;r===null?g=ne.guessEncoding(d,c):g=r.getName();try{t.append(oe.decode(d,g))}catch(w){throw new H(w)}a.push(d)}static toAlphaNumericChar(e){if(e>=pt.ALPHANUMERIC_CHARS.length)throw new H;return pt.ALPHANUMERIC_CHARS[e]}static decodeAlphanumericSegment(e,t,n,r){const a=t.length();for(;n>1;){if(e.available()<11)throw new H;const c=e.readBits(11);t.append(pt.toAlphaNumericChar(Math.floor(c/45))),t.append(pt.toAlphaNumericChar(c%45)),n-=2}if(n===1){if(e.available()<6)throw new H;t.append(pt.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 H;const r=e.readBits(10);if(r>=1e3)throw new H;t.append(pt.toAlphaNumericChar(Math.floor(r/100))),t.append(pt.toAlphaNumericChar(Math.floor(r/10)%10)),t.append(pt.toAlphaNumericChar(r%10)),n-=3}if(n===2){if(e.available()<7)throw new H;const r=e.readBits(7);if(r>=100)throw new H;t.append(pt.toAlphaNumericChar(Math.floor(r/10))),t.append(pt.toAlphaNumericChar(r%10))}else if(n===1){if(e.available()<4)throw new H;const r=e.readBits(4);if(r>=10)throw new H;t.append(pt.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 H}}pt.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",pt.GB2312_SUBSET=1;class Ua{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 mg{constructor(){this.rsDecoder=new lt(Te.QR_CODE_FIELD_256)}decodeBooleanArray(e,t){return this.decodeBitMatrix(W.parseFromBooleanArray(e),t)}decodeBitMatrix(e,t){const n=new gg(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 Ua(!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 pt.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 Oo extends we{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 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 S}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 Oo(a,c,d);this.possibleCenters.push(g),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(g)}return null}}class Bo extends we{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 Bo(a,c,d,r)}}class pg{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 Bt{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(Z.TRY_HARDER)!==void 0,n=e!=null&&e.get(Z.PURE_BARCODE)!==void 0,r=this.image,a=r.getHeight(),c=r.getWidth();let d=Math.floor(3*a/(4*Bt.MAX_MODULES));(d<Bt.MIN_SKIP||t)&&(d=Bt.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(Bt.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]++;Bt.foundPatternCross(w)&&this.handlePossibleCenter(w,A,c,n)===!0&&(d=w[0],this.hasSkipped&&(g=this.haveMultiplyConfirmedCenters()))}const E=this.selectBestPatterns();return we.orderBestPatterns(E),new pg(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&&Bt.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:Bt.foundPatternCross(d)?Bt.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:Bt.foundPatternCross(d)?Bt.centerFromEnd(d,g):NaN}handlePossibleCenter(e,t,n,r){const a=e[0]+e[1]+e[2]+e[3]+e[4];let c=Bt.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 Bo(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()>=Bt.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()>=Bt.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 S;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]]}}Bt.CENTER_QUORUM=2,Bt.MIN_SKIP=3,Bt.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(Z.NEED_RESULT_POINT_CALLBACK);const n=new Bt(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 S("No pattern found in proccess finder.");const c=Wr.computeDimension(t,n,r,a),d=Se.getProvisionalVersionForDimension(c),g=d.getDimensionForVersion()-7;let w=null;if(d.getAlignmentPatternCenters().length>0){const R=n.getX()-t.getX()+r.getX(),D=n.getY()-t.getY()+r.getY(),F=1-3/g,Y=Math.floor(t.getX()+F*(R-t.getX())),te=Math.floor(t.getY()+F*(D-t.getY()));for(let ue=4;ue<=16;ue<<=1)try{w=this.findAlignmentInRegion(a,Y,te,ue);break}catch(de){if(!(de instanceof S))throw de}}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 rr(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),tn.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 In.getInstance().sampleGridWithTransform(e,n,n,t)}static computeDimension(e,t,n,r){const a=Me.round(we.distance(e,t)/r),c=Me.round(we.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 S("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,D=t;R!==I;R+=w){const F=a?D:R,Y=a?R:D;if(A===1===this.image.get(F,Y)){if(A===2)return Me.distance(R,D,e,t);A++}if(g+=d,g>0){if(D===r)break;D+=E,g-=c}}return A===2?Me.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 S("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 S("Alignment bottom exceeds estimated module size.");return new Ti(this.image,c,g,d-c,w-g,e,this.resultPointCallback).find()}}class Xn{constructor(){this.decoder=new mg}getDecoder(){return this.decoder}decode(e,t){let n,r;if(t!=null&&t.get(Z.PURE_BARCODE)!==void 0){const g=Xn.extractPureBits(e.getBlackMatrix());n=this.decoder.decodeBitMatrix(g,t),r=Xn.NO_POINTS}else{const g=new Wr(e.getBlackMatrix()).detect(t);n=this.decoder.decodeBitMatrix(g.getBits(),t),r=g.getPoints()}n.getOther()instanceof Ua&&n.getOther().applyMirroredCorrection(r);const a=new me(n.getText(),n.getRawBytes(),void 0,r,xe.QR_CODE,void 0),c=n.getByteSegments();c!==null&&a.putMetadata(He.BYTE_SEGMENTS,c);const d=n.getECLevel();return d!==null&&a.putMetadata(He.ERROR_CORRECTION_LEVEL,d),n.hasStructuredAppend()&&(a.putMetadata(He.STRUCTURED_APPEND_SEQUENCE,n.getStructuredAppendSequenceNumber()),a.putMetadata(He.STRUCTURED_APPEND_PARITY,n.getStructuredAppendParity())),a}reset(){}static extractPureBits(e){const t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t===null||n===null)throw new S;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 S;if(c-a!==g-d&&(g=d+(c-a),g>=e.getWidth()))throw new S;const w=Math.round((g-d+1)/r),E=Math.round((c-a+1)/r);if(w<=0||E<=0)throw new S;if(E!==w)throw new S;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 S;d-=I}const R=a+Math.floor((E-1)*r)-c;if(R>0){if(R>A)throw new S;a-=R}const D=new W(w,E);for(let F=0;F<E;F++){const Y=a+Math.floor(F*r);for(let te=0;te<w;te++)e.get(d+Math.floor(te*r),Y)&&D.set(te,F)}return D}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 S;return(a-e[0])/7}}Xn.NO_POINTS=new Array;class Re{PDF417Common(){}static getBitCountSum(e){return Me.sum(e)}static toIntArray(e){if(e==null||!e.length)return Re.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(Re.SYMBOL_TABLE,e&262143);return t<0?-1:(Re.CODEWORD_TABLE[t]-1)%Re.NUMBER_OF_CODEWORDS}}Re.NUMBER_OF_CODEWORDS=929,Re.MAX_CODEWORDS_IN_BARCODE=Re.NUMBER_OF_CODEWORDS-1,Re.MIN_ROWS_IN_BARCODE=3,Re.MAX_ROWS_IN_BARCODE=90,Re.MODULES_IN_CODEWORD=17,Re.MODULES_IN_STOP_PATTERN=18,Re.BARS_IN_MODULE=8,Re.EMPTY_INT_ARRAY=new Int32Array([]),Re.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]),Re.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 xg{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class Le{static detectMultiple(e,t,n){let r=e.getBlackMatrix(),a=Le.detect(n,r);return a.length||(r=r.clone(),r.rotate180(),a=Le.detect(n,r)),new xg(r,a)}static detect(e,t){const n=new Array;let r=0,a=0,c=!1;for(;r<t.getHeight();){const d=Le.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+=Le.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 Le.copyToResult(c,Le.findRowsWithPattern(e,r,a,t,n,Le.START_PATTERN),Le.INDEXES_START_PATTERN),c[4]!=null&&(n=Math.trunc(c[4].getX()),t=Math.trunc(c[4].getY())),Le.copyToResult(c,Le.findRowsWithPattern(e,r,a,t,n,Le.STOP_PATTERN),Le.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+=Le.ROW_STEP){let A=Le.findGuardPattern(e,a,r,n,!1,c,w);if(A!=null){for(;r>0;){const I=Le.findGuardPattern(e,a,--r,n,!1,c,w);if(I!=null)A=I;else{r++;break}}d[0]=new we(A[0],r),d[1]=new we(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=Le.findGuardPattern(e,I[0],E,n,!1,c,w);if(R!=null&&Math.abs(I[0]-R[0])<Le.MAX_PATTERN_DRIFT&&Math.abs(I[1]-R[1])<Le.MAX_PATTERN_DRIFT)I=R,A=0;else{if(A>Le.SKIPPED_ROW_COUNT_MAX)break;A++}}E-=A+1,d[2]=new we(I[0],E),d[3]=new we(I[1],E)}return E-r<Le.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++<Le.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(Le.patternMatchVariance(d,c,Le.MAX_INDIVIDUAL_VARIANCE)<Le.MAX_AVG_VARIANCE)return new Int32Array([g,E]);g+=d[0]+d[1],L.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&&Le.patternMatchVariance(d,c,Le.MAX_INDIVIDUAL_VARIANCE)<Le.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}}Le.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),Le.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),Le.MAX_AVG_VARIANCE=.42,Le.MAX_INDIVIDUAL_VARIANCE=.8,Le.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),Le.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),Le.MAX_PIXEL_DRIFT=3,Le.MAX_PATTERN_DRIFT=5,Le.SKIPPED_ROW_COUNT_MAX=25,Le.ROW_STEP=5,Le.BARCODE_MIN_HEIGHT=10;class Mt{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),L.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;L.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 Mt(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 Mt?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 Mt(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 Mt(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 Mt(this.field,t)}multiplyScalar(e){if(e===0)return new Mt(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 Mt(this.field,n)}multiplyByMonomial(e,t){if(e<0)throw new y;if(t===0)return new Mt(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 Mt(this.field,r)}toString(){let e=new U;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 wg{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 kt;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 Mo extends wg{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 Mt(this,new Int32Array([0])),this.one=new Mt(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 Mt(this,n)}}Mo.PDF417_GF=new Mo(Re.NUMBER_OF_CODEWORDS,3);class za{constructor(){this.field=Mo.PDF417_GF}decode(e,t,n){let r=new Mt(this.field,e),a=new Int32Array(t),c=!1;for(let D=t;D>0;D--){let F=r.evaluateAt(this.field.exp(D));a[t-D]=F,F!==0&&(c=!0)}if(!c)return 0;let d=this.field.getOne();if(n!=null)for(const D of n){let F=this.field.exp(e.length-1-D),Y=new Mt(this.field,new Int32Array([this.field.subtract(0,F),1]));d=d.multiply(Y)}let g=new Mt(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 D=0;D<I.length;D++){let F=e.length-1-this.field.log(I[D]);if(F<0)throw M.getChecksumInstance();e[F]=this.field.subtract(e[F],R[D])}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 M.getChecksumInstance();a=I;let D=this.field.getZero(),F=r.getCoefficient(r.getDegree()),Y=this.field.inverse(F);for(;a.getDegree()>=r.getDegree()&&!a.isZero();){let te=a.getDegree()-r.getDegree(),ue=this.field.multiply(a.getCoefficient(a.getDegree()),Y);D=D.add(this.field.buildMonomial(te,ue)),a=a.subtract(r.multiplyByMonomial(te,ue))}d=D.multiply(c).subtract(R).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 Mt(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 S;c?(t=new we(0,r.getY()),n=new we(0,a.getY())):d&&(r=new we(e.getWidth()-1,t.getY()),a=new we(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 we(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 we(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 _g{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 D=parseInt(g),F=g&&g[0]+""=="0"?"0":" ";for(;R.length<D;)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 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 Re.toIntArray(t)}getConfidence(e){return this.values.get(e)}}class Ha 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 D;w>2?D=(w-2)*R:D=R;let F=D>=A;for(let Y=1;Y<=D&&!F;Y++)F=t[A-Y]!=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]<Re.MIN_ROWS_IN_BARCODE||n.getValue()[0]+r.getValue()[0]>Re.MAX_ROWS_IN_BARCODE)return null;let c=new _g(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=Re.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 Yt{static initialize(){for(let e=0;e<Re.SYMBOL_TABLE.length;e++){let t=Re.SYMBOL_TABLE[e],n=t&1;for(let r=0;r<Re.BARS_IN_MODULE;r++){let a=0;for(;(t&1)===n;)a+=1,t>>=1;n=t&1,Yt.RATIOS_TABLE[e]||(Yt.RATIOS_TABLE[e]=new Array(Re.BARS_IN_MODULE)),Yt.RATIOS_TABLE[e][Re.BARS_IN_MODULE-r-1]=Math.fround(a/Re.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(e){let t=Yt.getDecodedCodewordValue(Yt.sampleBitCounts(e));return t!==-1?t:Yt.getClosestDecodedValue(e)}static sampleBitCounts(e){let t=Me.sum(e),n=new Int32Array(Re.BARS_IN_MODULE),r=0,a=0;for(let c=0;c<Re.MODULES_IN_CODEWORD;c++){let d=t/(2*Re.MODULES_IN_CODEWORD)+c*t/Re.MODULES_IN_CODEWORD;a+e[r]<=d&&(a+=e[r],r++),n[r]++}return n}static getDecodedCodewordValue(e){let t=Yt.getBitValue(e);return Re.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=Me.sum(e),n=new Array(Re.BARS_IN_MODULE);if(t>1)for(let c=0;c<n.length;c++)n[c]=Math.fround(e[c]/t);let r=nr.MAX_VALUE,a=-1;this.bSymbolTableReady||Yt.initialize();for(let c=0;c<Yt.RATIOS_TABLE.length;c++){let d=0,g=Yt.RATIOS_TABLE[c];for(let w=0;w<Re.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=Re.SYMBOL_TABLE[c])}return a}}Yt.bSymbolTableReady=!1,Yt.RATIOS_TABLE=new Array(Re.SYMBOL_TABLE.length).map(b=>new Array(Re.BARS_IN_MODULE));class Ga{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 Wa{static parseLong(e,t=void 0){return parseInt(e,t)}}class Xa extends p{}Xa.kind="NullPointerException";class Cg{writeBytes(e){this.writeBytesOffset(e,0,e.length)}writeBytesOffset(e,t,n){if(e==null)throw new Xa;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 Eg extends p{}class yg extends Cg{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 Eg;n=O.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),L.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 rt;(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"})(rt||(rt={}));function ja(){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 ki;function jn(b){if(typeof ki>"u"&&(ki=ja()),ki===null)throw new Error("BigInt is not supported!");return ki(b)}function bg(){let b=[];b[0]=jn(1);let e=jn(900);b[1]=e;for(let t=2;t<16;t++)b[t]=b[t-1]*e;return b}class J{static decode(e,t){let n=new U(""),r=j.ISO8859_1;n.enableDecoding(r);let a=1,c=e[a++],d=new Ga;for(;a<e[0];){switch(c){case J.TEXT_COMPACTION_MODE_LATCH:a=J.textCompaction(e,a,n);break;case J.BYTE_COMPACTION_MODE_LATCH:case J.BYTE_COMPACTION_MODE_LATCH_6:a=J.byteCompaction(c,e,r,a,n);break;case J.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(e[a++]);break;case J.NUMERIC_COMPACTION_MODE_LATCH:a=J.numericCompaction(e,a,n);break;case J.ECI_CHARSET:j.getCharacterSetECIByValue(e[a++]);break;case J.ECI_GENERAL_PURPOSE:a+=2;break;case J.ECI_USER_DEFINED:a++;break;case J.BEGIN_MACRO_PDF417_CONTROL_BLOCK:a=J.decodeMacroBlock(e,a,d);break;case J.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case J.MACRO_PDF417_TERMINATOR:throw new H;default:a--,a=J.textCompaction(e,a,n);break}if(a<e.length)c=e[a++];else throw H.getFormatInstance()}if(n.length()===0)throw H.getFormatInstance();let g=new Ae(null,n.toString(),null,t);return g.setOther(d),g}static decodeMacroBlock(e,t,n){if(t+J.NUMBER_OF_SEQUENCE_CODEWORDS>e[0])throw H.getFormatInstance();let r=new Int32Array(J.NUMBER_OF_SEQUENCE_CODEWORDS);for(let d=0;d<J.NUMBER_OF_SEQUENCE_CODEWORDS;d++,t++)r[d]=e[t];n.setSegmentIndex(O.parseInt(J.decodeBase900toBase10(r,J.NUMBER_OF_SEQUENCE_CODEWORDS)));let a=new U;t=J.textCompaction(e,t,a),n.setFileId(a.toString());let c=-1;for(e[t]===J.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(c=t+1);t<e[0];)switch(e[t]){case J.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(t++,e[t]){case J.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let d=new U;t=J.textCompaction(e,t+1,d),n.setFileName(d.toString());break;case J.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let g=new U;t=J.textCompaction(e,t+1,g),n.setSender(g.toString());break;case J.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let w=new U;t=J.textCompaction(e,t+1,w),n.setAddressee(w.toString());break;case J.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let E=new U;t=J.numericCompaction(e,t+1,E),n.setSegmentCount(O.parseInt(E.toString()));break;case J.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let A=new U;t=J.numericCompaction(e,t+1,A),n.setTimestamp(Wa.parseLong(A.toString()));break;case J.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let I=new U;t=J.numericCompaction(e,t+1,I),n.setChecksum(O.parseInt(I.toString()));break;case J.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let R=new U;t=J.numericCompaction(e,t+1,R),n.setFileSize(Wa.parseLong(R.toString()));break;default:throw H.getFormatInstance()}break;case J.MACRO_PDF417_TERMINATOR:t++,n.setLastSegment(!0);break;default:throw H.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<J.TEXT_COMPACTION_MODE_LATCH)r[c]=g/30,r[c+1]=g%30,c+=2;else switch(g){case J.TEXT_COMPACTION_MODE_LATCH:r[c++]=J.TEXT_COMPACTION_MODE_LATCH;break;case J.BYTE_COMPACTION_MODE_LATCH:case J.BYTE_COMPACTION_MODE_LATCH_6:case J.NUMERIC_COMPACTION_MODE_LATCH:case J.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case J.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case J.MACRO_PDF417_TERMINATOR:t--,d=!0;break;case J.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r[c]=J.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,g=e[t++],a[c]=g,c++;break}}return J.decodeTextCompaction(r,a,c,n),t}static decodeTextCompaction(e,t,n,r){let a=rt.ALPHA,c=rt.ALPHA,d=0;for(;d<n;){let g=e[d],w="";switch(a){case rt.ALPHA:if(g<26)w=String.fromCharCode(65+g);else switch(g){case 26:w=" ";break;case J.LL:a=rt.LOWER;break;case J.ML:a=rt.MIXED;break;case J.PS:c=a,a=rt.PUNCT_SHIFT;break;case J.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[d]);break;case J.TEXT_COMPACTION_MODE_LATCH:a=rt.ALPHA;break}break;case rt.LOWER:if(g<26)w=String.fromCharCode(97+g);else switch(g){case 26:w=" ";break;case J.AS:c=a,a=rt.ALPHA_SHIFT;break;case J.ML:a=rt.MIXED;break;case J.PS:c=a,a=rt.PUNCT_SHIFT;break;case J.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[d]);break;case J.TEXT_COMPACTION_MODE_LATCH:a=rt.ALPHA;break}break;case rt.MIXED:if(g<J.PL)w=J.MIXED_CHARS[g];else switch(g){case J.PL:a=rt.PUNCT;break;case 26:w=" ";break;case J.LL:a=rt.LOWER;break;case J.AL:a=rt.ALPHA;break;case J.PS:c=a,a=rt.PUNCT_SHIFT;break;case J.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[d]);break;case J.TEXT_COMPACTION_MODE_LATCH:a=rt.ALPHA;break}break;case rt.PUNCT:if(g<J.PAL)w=J.PUNCT_CHARS[g];else switch(g){case J.PAL:a=rt.ALPHA;break;case J.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[d]);break;case J.TEXT_COMPACTION_MODE_LATCH:a=rt.ALPHA;break}break;case rt.ALPHA_SHIFT:if(a=c,g<26)w=String.fromCharCode(65+g);else switch(g){case 26:w=" ";break;case J.TEXT_COMPACTION_MODE_LATCH:a=rt.ALPHA;break}break;case rt.PUNCT_SHIFT:if(a=c,g<J.PAL)w=J.PUNCT_CHARS[g];else switch(g){case J.PAL:a=rt.ALPHA;break;case J.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[d]);break;case J.TEXT_COMPACTION_MODE_LATCH:a=rt.ALPHA;break}break}w!==""&&r.append(w),d++}}static byteCompaction(e,t,n,r,a){let c=new yg,d=0,g=0,w=!1;switch(e){case J.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 J.TEXT_COMPACTION_MODE_LATCH:case J.BYTE_COMPACTION_MODE_LATCH:case J.NUMERIC_COMPACTION_MODE_LATCH:case J.BYTE_COMPACTION_MODE_LATCH_6:case J.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case J.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case J.MACRO_PDF417_TERMINATOR:r--,w=!0;break;default:if(d%5===0&&d>0){for(let I=0;I<6;++I)c.write(Number(jn(g)>>jn(8*(5-I))));g=0,d=0}break}r===t[0]&&A<J.TEXT_COMPACTION_MODE_LATCH&&(E[d++]=A);for(let I=0;I<d;I++)c.write(E[I]);break;case J.BYTE_COMPACTION_MODE_LATCH_6:for(;r<t[0]&&!w;){let I=t[r++];if(I<J.TEXT_COMPACTION_MODE_LATCH)d++,g=900*g+I;else switch(I){case J.TEXT_COMPACTION_MODE_LATCH:case J.BYTE_COMPACTION_MODE_LATCH:case J.NUMERIC_COMPACTION_MODE_LATCH:case J.BYTE_COMPACTION_MODE_LATCH_6:case J.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case J.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case J.MACRO_PDF417_TERMINATOR:r--,w=!0;break}if(d%5===0&&d>0){for(let R=0;R<6;++R)c.write(Number(jn(g)>>jn(8*(5-R))));g=0,d=0}}break}return a.append(oe.decode(c.toByteArray(),n)),r}static numericCompaction(e,t,n){let r=0,a=!1,c=new Int32Array(J.MAX_NUMERIC_CODEWORDS);for(;t<e[0]&&!a;){let d=e[t++];if(t===e[0]&&(a=!0),d<J.TEXT_COMPACTION_MODE_LATCH)c[r]=d,r++;else switch(d){case J.TEXT_COMPACTION_MODE_LATCH:case J.BYTE_COMPACTION_MODE_LATCH:case J.BYTE_COMPACTION_MODE_LATCH_6:case J.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case J.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case J.MACRO_PDF417_TERMINATOR:t--,a=!0;break}(r%J.MAX_NUMERIC_CODEWORDS===0||d===J.NUMERIC_COMPACTION_MODE_LATCH||a)&&r>0&&(n.append(J.decodeBase900toBase10(c,r)),r=0)}return t}static decodeBase900toBase10(e,t){let n=jn(0);for(let a=0;a<t;a++)n+=J.EXP900[t-a-1]*jn(e[a]);let r=n.toString();if(r.charAt(0)!=="1")throw new H;return r.substring(1)}}J.TEXT_COMPACTION_MODE_LATCH=900,J.BYTE_COMPACTION_MODE_LATCH=901,J.NUMERIC_COMPACTION_MODE_LATCH=902,J.BYTE_COMPACTION_MODE_LATCH_6=924,J.ECI_USER_DEFINED=925,J.ECI_GENERAL_PURPOSE=926,J.ECI_CHARSET=927,J.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,J.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,J.MACRO_PDF417_TERMINATOR=922,J.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,J.MAX_NUMERIC_CODEWORDS=15,J.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,J.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,J.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,J.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,J.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,J.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,J.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,J.PL=25,J.LL=27,J.AS=27,J.ML=28,J.AL=28,J.PS=29,J.PAL=29,J.PUNCT_CHARS=`;<>@[\\]_\`~!\r ,:
18
- -.$/"|*()?{}'`,J.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",J.EXP900=ja()?bg():[],J.NUMBER_OF_SEQUENCE_CODEWORDS=2;class ze{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 D=!0;;D=!1){if(t!=null&&(w=ze.getRowIndicatorColumn(e,g,t,!0,c,d)),r!=null&&(E=ze.getRowIndicatorColumn(e,g,r,!1,c,d)),A=ze.merge(w,E),A==null)throw S.getNotFoundInstance();let F=A.getBoundingBox();if(D&&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 D=1;D<=I;D++){let F=R?D:I-D;if(A.getDetectionResultColumn(F)!==void 0)continue;let Y;F===0||F===I?Y=new Ha(g,F===0):Y=new jr(g),A.setDetectionResultColumn(F,Y);let te=-1,ue=te;for(let de=g.getMinY();de<=g.getMaxY();de++){if(te=ze.getStartColumn(A,F,de,R),te<0||te>g.getMaxX()){if(ue===-1)continue;te=ue}let ce=ze.detectCodeword(e,g.getMinX(),g.getMaxX(),R,te,de,c,d);ce!=null&&(Y.setCodeword(de,ce),ue=te,c=Math.min(c,ce.getWidth()),d=Math.max(d,ce.getWidth()))}}return ze.createDecoderResult(A)}static merge(e,t){if(e==null&&t==null)return null;let n=ze.getBarcodeMetadata(e,t);if(n==null)return null;let r=sr.merge(ze.adjustBoundingBox(e),ze.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=ze.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 Ha(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=ze.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()-ze.getNumberOfECCodeWords(e.getBarcodeECLevel());if(r.length===0){if(a<1||a>Re.MAX_CODEWORDS_IN_BARCODE)throw S.getNotFoundInstance();n.setValue(a)}else r[0]!==a&&n.setValue(a)}static createDecoderResult(e){let t=ze.createBarcodeMatrix(e);ze.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 ze.createDecoderResultFromAmbiguousValues(e.getBarcodeECLevel(),r,Re.toIntArray(n),Re.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 ze.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(ze.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(ze.isValidBarcodeColumn(e,t-a)&&(c=e.getDetectionResultColumn(t-a).getCodewordNearby(n)),c!=null)return r?c.getEndX():c.getStartX();let d=0;for(;ze.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=ze.adjustCodewordStartColumn(e,t,n,r,a,c);let w=ze.getModuleBitCount(e,t,n,r,a,c);if(w==null)return null;let E,A=Me.sum(w);if(r)E=a+A;else{for(let D=0;D<w.length/2;D++){let F=w[D];w[D]=w[w.length-1-D],w[w.length-1-D]=F}E=a,a=E-A}if(!ze.checkCodewordSkew(A,d,g))return null;let I=Yt.getDecodedValue(w),R=Re.getCodeword(I);return R===-1?null:new Yr(a,E,ze.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)>ze.CODEWORD_SKEW_SIZE)return a;d+=g}g=-g,r=!r}return d}static checkCodewordSkew(e,t,n){return t-ze.CODEWORD_SKEW_SIZE<=e&&e<=n+ze.CODEWORD_SKEW_SIZE}static decodeCodewords(e,t,n){if(e.length===0)throw H.getFormatInstance();let r=1<<t+1,a=ze.correctErrors(e,n,r);ze.verifyCodewordCount(e,r);let c=J.decode(e,""+t);return c.setErrorsCorrected(a),c.setErasures(n.length),c}static correctErrors(e,t,n){if(t!=null&&t.length>n/2+ze.MAX_ERRORS||n<0||n>ze.MAX_EC_CODEWORDS)throw M.getChecksumInstance();return ze.errorCorrection.decode(e,n,t)}static verifyCodewordCount(e,t){if(e.length<4)throw H.getFormatInstance();let n=e[0];if(n>e.length)throw H.getFormatInstance();if(n===0)if(t<e.length)e[0]=e.length-t;else throw H.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 ze.getCodewordBucketNumber(ze.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()}}ze.CODEWORD_SKEW_SIZE=2,ze.MAX_ERRORS=3,ze.MAX_EC_CODEWORDS=512,ze.errorCorrection=new za;class vt{decode(e,t=null){let n=vt.decode(e,t,!1);if(n==null||n.length===0||n[0]==null)throw S.getNotFoundInstance();return n[0]}decodeMultiple(e,t=null){try{return vt.decode(e,t,!0)}catch(n){throw n instanceof H||n instanceof M?S.getNotFoundInstance():n}}static decode(e,t,n){const r=new Array,a=Le.detectMultiple(e,t,n);for(const c of a.getPoints()){const d=ze.decode(a.getBits(),c[4],c[5],c[6],c[7],vt.getMinCodewordWidth(c),vt.getMaxCodewordWidth(c)),g=new me(d.getText(),d.getRawBytes(),void 0,c,xe.PDF_417);g.putMetadata(He.ERROR_CORRECTION_LEVEL,d.getECLevel());const w=d.getOther();w!=null&&g.putMetadata(He.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(vt.getMaxWidth(e[0],e[4]),vt.getMaxWidth(e[6],e[2])*Re.MODULES_IN_CODEWORD/Re.MODULES_IN_STOP_PATTERN),Math.max(vt.getMaxWidth(e[1],e[5]),vt.getMaxWidth(e[7],e[3])*Re.MODULES_IN_CODEWORD/Re.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])*Re.MODULES_IN_CODEWORD/Re.MODULES_IN_STOP_PATTERN),Math.min(vt.getMinWidth(e[1],e[5]),vt.getMinWidth(e[7],e[3])*Re.MODULES_IN_CODEWORD/Re.MODULES_IN_STOP_PATTERN)))}reset(){}}class Ri extends p{}Ri.kind="ReaderException";class qa{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(Z.TRY_HARDER)===!0,n=u(e)?null:e.get(Z.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 br(e,this.verbose)),n.includes(xe.QR_CODE)&&r.push(new Xn),n.includes(xe.DATA_MATRIX)&&r.push(new Wn),n.includes(xe.AZTEC)&&r.push(new _r),n.includes(xe.PDF_417)&&r.push(new vt),a&&t&&r.push(new br(e,this.verbose))}r.length===0&&(t||r.push(new br(e,this.verbose)),r.push(new Xn),r.push(new Wn),r.push(new _r),r.push(new vt),t&&r.push(new br(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 S("No MultiFormat Readers were able to detect the code.")}}class Ag extends Ee{constructor(e=null,t=500){const n=new qa;n.setHints(e),super(n,t)}decodeBitmap(e){return this.reader.decodeWithState(e)}}class Ig extends Ee{constructor(e=500){super(new vt,e)}}class Sg extends Ee{constructor(e=500){super(new Xn,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 Qe(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 Qe(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);L.arraycopy(e,0,a,0,n);let c=new Qe(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;L.arraycopy(g,0,e,n+w,g.length)}}class _t{constructor(){}static applyMaskPenaltyRule1(e){return _t.applyMaskPenaltyRule1Internal(e,!0)+_t.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 _t.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&&(_t.isWhiteHorizontal(g,d-4,d)||_t.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&&(_t.isWhiteVertical(n,d,c-4,c)||_t.isWhiteVertical(n,d,c+7,c+11))&&t++}return t*_t.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)*_t.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+=_t.N1+(g-5)),g=1,w=A)}g>=5&&(n+=_t.N1+(g-5))}return n}}_t.N1=3,_t.N2=3,_t.N3=40,_t.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 U;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 ar{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 U;return e.append(`<<
11
+ */var kn=function(){return kn=Object.assign||function(l){for(var o,i=1,u=arguments.length;i<u;i++){o=arguments[i];for(var f in o)Object.prototype.hasOwnProperty.call(o,f)&&(l[f]=o[f])}return l},kn.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;var rr;(function(a){var l=function(){function m(p,w,x,C){if(this.version=p,this.errorCorrectionLevel=w,this.modules=[],this.isFunction=[],p<m.MIN_VERSION||p>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=p*4+17;for(var y=[],N=0;N<this.size;N++)y.push(!1);for(var N=0;N<this.size;N++)this.modules.push(y.slice()),this.isFunction.push(y.slice());this.drawFunctionPatterns();var O=this.addEccAndInterleave(x);if(this.drawCodewords(O),C==-1)for(var T=1e9,N=0;N<8;N++){this.applyMask(N),this.drawFormatBits(N);var v=this.getPenaltyScore();v<T&&(C=N,T=v),this.applyMask(N)}u(0<=C&&C<=7),this.mask=C,this.applyMask(C),this.drawFormatBits(C),this.isFunction=[]}return m.encodeText=function(p,w){var x=a.QrSegment.makeSegments(p);return m.encodeSegments(x,w)},m.encodeBinary=function(p,w){var x=a.QrSegment.makeBytes(p);return m.encodeSegments([x],w)},m.encodeSegments=function(p,w,x,C,y,N){if(x===void 0&&(x=1),C===void 0&&(C=40),y===void 0&&(y=-1),N===void 0&&(N=!0),!(m.MIN_VERSION<=x&&x<=C&&C<=m.MAX_VERSION)||y<-1||y>7)throw new RangeError("Invalid value");var O,T;for(O=x;;O++){var v=m.getNumDataCodewords(O,w)*8,D=f.getTotalBits(p,O);if(D<=v){T=D;break}if(O>=C)throw new RangeError("Data too long")}for(var U=0,M=[m.Ecc.MEDIUM,m.Ecc.QUARTILE,m.Ecc.HIGH];U<M.length;U++){var R=M[U];N&&T<=m.getNumDataCodewords(O,R)*8&&(w=R)}for(var F=[],H=0,Z=p;H<Z.length;H++){var V=Z[H];o(V.mode.modeBits,4,F),o(V.numChars,V.mode.numCharCountBits(O),F);for(var P=0,L=V.getData();P<L.length;P++){var re=L[P];F.push(re)}}u(F.length==T);var Q=m.getNumDataCodewords(O,w)*8;u(F.length<=Q),o(0,Math.min(4,Q-F.length),F),o(0,(8-F.length%8)%8,F),u(F.length%8==0);for(var ee=236;F.length<Q;ee^=253)o(ee,8,F);for(var W=[];W.length*8<F.length;)W.push(0);return F.forEach(function(X,I){return W[I>>>3]|=X<<7-(I&7)}),new m(O,w,W,y)},m.prototype.getModule=function(p,w){return 0<=p&&p<this.size&&0<=w&&w<this.size&&this.modules[w][p]},m.prototype.getModules=function(){return this.modules},m.prototype.drawFunctionPatterns=function(){for(var p=0;p<this.size;p++)this.setFunctionModule(6,p,p%2==0),this.setFunctionModule(p,6,p%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);for(var w=this.getAlignmentPatternPositions(),x=w.length,p=0;p<x;p++)for(var C=0;C<x;C++)p==0&&C==0||p==0&&C==x-1||p==x-1&&C==0||this.drawAlignmentPattern(w[p],w[C]);this.drawFormatBits(0),this.drawVersion()},m.prototype.drawFormatBits=function(p){for(var w=this.errorCorrectionLevel.formatBits<<3|p,x=w,C=0;C<10;C++)x=x<<1^(x>>>9)*1335;var y=(w<<10|x)^21522;u(y>>>15==0);for(var C=0;C<=5;C++)this.setFunctionModule(8,C,i(y,C));this.setFunctionModule(8,7,i(y,6)),this.setFunctionModule(8,8,i(y,7)),this.setFunctionModule(7,8,i(y,8));for(var C=9;C<15;C++)this.setFunctionModule(14-C,8,i(y,C));for(var C=0;C<8;C++)this.setFunctionModule(this.size-1-C,8,i(y,C));for(var C=8;C<15;C++)this.setFunctionModule(8,this.size-15+C,i(y,C));this.setFunctionModule(8,this.size-8,!0)},m.prototype.drawVersion=function(){if(!(this.version<7)){for(var p=this.version,w=0;w<12;w++)p=p<<1^(p>>>11)*7973;var x=this.version<<12|p;u(x>>>18==0);for(var w=0;w<18;w++){var C=i(x,w),y=this.size-11+w%3,N=Math.floor(w/3);this.setFunctionModule(y,N,C),this.setFunctionModule(N,y,C)}}},m.prototype.drawFinderPattern=function(p,w){for(var x=-4;x<=4;x++)for(var C=-4;C<=4;C++){var y=Math.max(Math.abs(C),Math.abs(x)),N=p+C,O=w+x;0<=N&&N<this.size&&0<=O&&O<this.size&&this.setFunctionModule(N,O,y!=2&&y!=4)}},m.prototype.drawAlignmentPattern=function(p,w){for(var x=-2;x<=2;x++)for(var C=-2;C<=2;C++)this.setFunctionModule(p+C,w+x,Math.max(Math.abs(C),Math.abs(x))!=1)},m.prototype.setFunctionModule=function(p,w,x){this.modules[w][p]=x,this.isFunction[w][p]=!0},m.prototype.addEccAndInterleave=function(p){var w=this.version,x=this.errorCorrectionLevel;if(p.length!=m.getNumDataCodewords(w,x))throw new RangeError("Invalid argument");for(var C=m.NUM_ERROR_CORRECTION_BLOCKS[x.ordinal][w],y=m.ECC_CODEWORDS_PER_BLOCK[x.ordinal][w],N=Math.floor(m.getNumRawDataModules(w)/8),O=C-N%C,T=Math.floor(N/C),v=[],D=m.reedSolomonComputeDivisor(y),U=0,M=0;U<C;U++){var R=p.slice(M,M+T-y+(U<O?0:1));M+=R.length;var F=m.reedSolomonComputeRemainder(R,D);U<O&&R.push(0),v.push(R.concat(F))}for(var H=[],Z=function(V){v.forEach(function(P,L){(V!=T-y||L>=O)&&H.push(P[V])})},U=0;U<v[0].length;U++)Z(U);return u(H.length==N),H},m.prototype.drawCodewords=function(p){if(p.length!=Math.floor(m.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");for(var w=0,x=this.size-1;x>=1;x-=2){x==6&&(x=5);for(var C=0;C<this.size;C++)for(var y=0;y<2;y++){var N=x-y,O=(x+1&2)==0,T=O?this.size-1-C:C;!this.isFunction[T][N]&&w<p.length*8&&(this.modules[T][N]=i(p[w>>>3],7-(w&7)),w++)}}u(w==p.length*8)},m.prototype.applyMask=function(p){if(p<0||p>7)throw new RangeError("Mask value out of range");for(var w=0;w<this.size;w++)for(var x=0;x<this.size;x++){var C=void 0;switch(p){case 0:C=(x+w)%2==0;break;case 1:C=w%2==0;break;case 2:C=x%3==0;break;case 3:C=(x+w)%3==0;break;case 4:C=(Math.floor(x/3)+Math.floor(w/2))%2==0;break;case 5:C=x*w%2+x*w%3==0;break;case 6:C=(x*w%2+x*w%3)%2==0;break;case 7:C=((x+w)%2+x*w%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[w][x]&&C&&(this.modules[w][x]=!this.modules[w][x])}},m.prototype.getPenaltyScore=function(){for(var p=0,w=0;w<this.size;w++){for(var x=!1,C=0,y=[0,0,0,0,0,0,0],N=0;N<this.size;N++)this.modules[w][N]==x?(C++,C==5?p+=m.PENALTY_N1:C>5&&p++):(this.finderPenaltyAddHistory(C,y),x||(p+=this.finderPenaltyCountPatterns(y)*m.PENALTY_N3),x=this.modules[w][N],C=1);p+=this.finderPenaltyTerminateAndCount(x,C,y)*m.PENALTY_N3}for(var N=0;N<this.size;N++){for(var x=!1,O=0,y=[0,0,0,0,0,0,0],w=0;w<this.size;w++)this.modules[w][N]==x?(O++,O==5?p+=m.PENALTY_N1:O>5&&p++):(this.finderPenaltyAddHistory(O,y),x||(p+=this.finderPenaltyCountPatterns(y)*m.PENALTY_N3),x=this.modules[w][N],O=1);p+=this.finderPenaltyTerminateAndCount(x,O,y)*m.PENALTY_N3}for(var w=0;w<this.size-1;w++)for(var N=0;N<this.size-1;N++){var T=this.modules[w][N];T==this.modules[w][N+1]&&T==this.modules[w+1][N]&&T==this.modules[w+1][N+1]&&(p+=m.PENALTY_N2)}for(var v=0,D=0,U=this.modules;D<U.length;D++){var M=U[D];v=M.reduce(function(H,Z){return H+(Z?1:0)},v)}var R=this.size*this.size,F=Math.ceil(Math.abs(v*20-R*10)/R)-1;return u(0<=F&&F<=9),p+=F*m.PENALTY_N4,u(0<=p&&p<=2568888),p},m.prototype.getAlignmentPatternPositions=function(){if(this.version==1)return[];for(var p=Math.floor(this.version/7)+2,w=Math.floor((this.version*8+p*3+5)/(p*4-4))*2,x=[6],C=this.size-7;x.length<p;C-=w)x.splice(1,0,C);return x},m.getNumRawDataModules=function(p){if(p<m.MIN_VERSION||p>m.MAX_VERSION)throw new RangeError("Version number out of range");var w=(16*p+128)*p+64;if(p>=2){var x=Math.floor(p/7)+2;w-=(25*x-10)*x-55,p>=7&&(w-=36)}return u(208<=w&&w<=29648),w},m.getNumDataCodewords=function(p,w){return Math.floor(m.getNumRawDataModules(p)/8)-m.ECC_CODEWORDS_PER_BLOCK[w.ordinal][p]*m.NUM_ERROR_CORRECTION_BLOCKS[w.ordinal][p]},m.reedSolomonComputeDivisor=function(p){if(p<1||p>255)throw new RangeError("Degree out of range");for(var w=[],x=0;x<p-1;x++)w.push(0);w.push(1);for(var C=1,x=0;x<p;x++){for(var y=0;y<w.length;y++)w[y]=m.reedSolomonMultiply(w[y],C),y+1<w.length&&(w[y]^=w[y+1]);C=m.reedSolomonMultiply(C,2)}return w},m.reedSolomonComputeRemainder=function(p,w){for(var x=w.map(function(T){return 0}),C=function(T){var v=T^x.shift();x.push(0),w.forEach(function(D,U){return x[U]^=m.reedSolomonMultiply(D,v)})},y=0,N=p;y<N.length;y++){var O=N[y];C(O)}return x},m.reedSolomonMultiply=function(p,w){if(p>>>8||w>>>8)throw new RangeError("Byte out of range");for(var x=0,C=7;C>=0;C--)x=x<<1^(x>>>7)*285,x^=(w>>>C&1)*p;return u(x>>>8==0),x},m.prototype.finderPenaltyCountPatterns=function(p){var w=p[1];u(w<=this.size*3);var x=w>0&&p[2]==w&&p[3]==w*3&&p[4]==w&&p[5]==w;return(x&&p[0]>=w*4&&p[6]>=w?1:0)+(x&&p[6]>=w*4&&p[0]>=w?1:0)},m.prototype.finderPenaltyTerminateAndCount=function(p,w,x){return p&&(this.finderPenaltyAddHistory(w,x),w=0),w+=this.size,this.finderPenaltyAddHistory(w,x),this.finderPenaltyCountPatterns(x)},m.prototype.finderPenaltyAddHistory=function(p,w){w[0]==0&&(p+=this.size),w.pop(),w.unshift(p)},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}();a.QrCode=l;function o(m,p,w){if(p<0||p>31||m>>>p)throw new RangeError("Value out of range");for(var x=p-1;x>=0;x--)w.push(m>>>x&1)}function i(m,p){return(m>>>p&1)!=0}function u(m){if(!m)throw new Error("Assertion error")}var f=function(){function m(p,w,x){if(this.mode=p,this.numChars=w,this.bitData=x,w<0)throw new RangeError("Invalid argument");this.bitData=x.slice()}return m.makeBytes=function(p){for(var w=[],x=0,C=p;x<C.length;x++){var y=C[x];o(y,8,w)}return new m(m.Mode.BYTE,p.length,w)},m.makeNumeric=function(p){if(!m.isNumeric(p))throw new RangeError("String contains non-numeric characters");for(var w=[],x=0;x<p.length;){var C=Math.min(p.length-x,3);o(parseInt(p.substring(x,x+C),10),C*3+1,w),x+=C}return new m(m.Mode.NUMERIC,p.length,w)},m.makeAlphanumeric=function(p){if(!m.isAlphanumeric(p))throw new RangeError("String contains unencodable characters in alphanumeric mode");var w=[],x;for(x=0;x+2<=p.length;x+=2){var C=m.ALPHANUMERIC_CHARSET.indexOf(p.charAt(x))*45;C+=m.ALPHANUMERIC_CHARSET.indexOf(p.charAt(x+1)),o(C,11,w)}return x<p.length&&o(m.ALPHANUMERIC_CHARSET.indexOf(p.charAt(x)),6,w),new m(m.Mode.ALPHANUMERIC,p.length,w)},m.makeSegments=function(p){return p==""?[]:m.isNumeric(p)?[m.makeNumeric(p)]:m.isAlphanumeric(p)?[m.makeAlphanumeric(p)]:[m.makeBytes(m.toUtf8ByteArray(p))]},m.makeEci=function(p){var w=[];if(p<0)throw new RangeError("ECI assignment value out of range");if(p<128)o(p,8,w);else if(p<16384)o(2,2,w),o(p,14,w);else if(p<1e6)o(6,3,w),o(p,21,w);else throw new RangeError("ECI assignment value out of range");return new m(m.Mode.ECI,0,w)},m.isNumeric=function(p){return m.NUMERIC_REGEX.test(p)},m.isAlphanumeric=function(p){return m.ALPHANUMERIC_REGEX.test(p)},m.prototype.getData=function(){return this.bitData.slice()},m.getTotalBits=function(p,w){for(var x=0,C=0,y=p;C<y.length;C++){var N=y[C],O=N.mode.numCharCountBits(w);if(N.numChars>=1<<O)return 1/0;x+=4+O+N.bitData.length}return x},m.toUtf8ByteArray=function(p){p=encodeURI(p);for(var w=[],x=0;x<p.length;x++)p.charAt(x)!="%"?w.push(p.charCodeAt(x)):(w.push(parseInt(p.substring(x+1,x+3),16)),x+=2);return w},m.NUMERIC_REGEX=/^[0-9]*$/,m.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,m.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",m}();a.QrSegment=f})(rr||(rr={})),function(a){(function(l){var o=function(){function i(u,f){this.ordinal=u,this.formatBits=f}return i.LOW=new i(0,1),i.MEDIUM=new i(1,0),i.QUARTILE=new i(2,3),i.HIGH=new i(3,2),i}();l.Ecc=o})(a.QrCode||(a.QrCode={}))}(rr||(rr={})),function(a){(function(l){var o=function(){function i(u,f){this.modeBits=u,this.numBitsCharCount=f}return i.prototype.numCharCountBits=function(u){return this.numBitsCharCount[Math.floor((u+7)/17)]},i.NUMERIC=new i(1,[10,12,14]),i.ALPHANUMERIC=new i(2,[9,11,13]),i.BYTE=new i(4,[8,16,16]),i.KANJI=new i(8,[8,10,12]),i.ECI=new i(7,[0,0,0]),i}();l.Mode=o})(a.QrSegment||(a.QrSegment={}))}(rr||(rr={}));var Cr=rr,wo="L",_o={L:Cr.QrCode.Ecc.LOW,M:Cr.QrCode.Ecc.MEDIUM,Q:Cr.QrCode.Ecc.QUARTILE,H:Cr.QrCode.Ecc.HIGH},b1=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}();function Co(a){return a in _o}function ma(a,l){l===void 0&&(l=0);var o=[];return a.forEach(function(i,u){var f=null;i.forEach(function(m,p){if(!m&&f!==null){o.push("M".concat(f+l," ").concat(u+l,"h").concat(p-f,"v1H").concat(f+l,"z")),f=null;return}if(p===i.length-1){if(!m)return;f===null?o.push("M".concat(p+l,",").concat(u+l," h1v1H").concat(p+l,"z")):o.push("M".concat(f+l,",").concat(u+l," h").concat(p+1-f,"v1H").concat(f+l,"z"));return}m&&f===null&&(f=p)})}),o.join("")}function ga(a,l,o,i){var u=i.width,f=i.height,m=i.x,p=i.y,w=a.length+o*2,x=Math.floor(l*.1),C=w/l,y=(u||x)*C,N=(f||x)*C,O=m==null?a.length/2-y/2:m*C,T=p==null?a.length/2-N/2:p*C,v=null;if(i.excavate){var D=Math.floor(O),U=Math.floor(T),M=Math.ceil(y+O-D),R=Math.ceil(N+T-U);v={x:D,y:U,w:M,h:R}}return{x:O,y:T,h:N,w:y,excavation:v}}function pa(a,l){return a.slice().map(function(o,i){return i<l.y||i>=l.y+l.h?o:o.map(function(u,f){return f<l.x||f>=l.x+l.w?u:!1})})}var Eo={value:{type:String,required:!0,default:""},size:{type:Number,default:100},level:{type:String,default:wo,validator:function(a){return Co(a)}},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(a){return["linear","radial"].indexOf(a)>-1}},gradientStartColor:{type:String,required:!1,default:"#000"},gradientEndColor:{type:String,required:!1,default:"#fff"}},A1=kn(kn({},Eo),{renderAs:{type:String,required:!1,default:"canvas",validator:function(a){return["canvas","svg"].indexOf(a)>-1}}}),S1=r.defineComponent({name:"QRCodeSvg",props:Eo,setup:function(a){var l=r.ref(0),o=r.ref(""),i,u=function(){var m=a.value,p=a.level,w=a.margin,x=w>>>0,C=Co(p)?p:wo,y=Cr.QrCode.encodeText(m,_o[C]).getModules();if(l.value=y.length+x*2,a.imageSettings.src){var N=ga(y,a.size,x,a.imageSettings);i={x:N.x+x,y:N.y+x,width:N.w,height:N.h},N.excavation&&(y=pa(y,N.excavation))}o.value=ma(y,x)},f=function(){if(!a.gradient)return null;var m=a.gradientType==="linear"?{x1:"0%",y1:"0%",x2:"100%",y2:"100%"}:{cx:"50%",cy:"50%",r:"50%",fx:"50%",fy:"50%"};return r.h(a.gradientType==="linear"?"linearGradient":"radialGradient",kn({id:"qr-gradient"},m),[r.h("stop",{offset:"0%",style:{stopColor:a.gradientStartColor}}),r.h("stop",{offset:"100%",style:{stopColor:a.gradientEndColor}})])};return u(),r.onUpdated(u),function(){return r.h("svg",{width:a.size,height:a.size,"shape-rendering":"crispEdges",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 ".concat(l.value," ").concat(l.value)},[r.h("defs",{},[f()]),r.h("rect",{width:"100%",height:"100%",fill:a.background}),r.h("path",{fill:a.gradient?"url(#qr-gradient)":a.foreground,d:o.value}),a.imageSettings.src&&r.h("image",kn({href:a.imageSettings.src},i))])}}}),I1=r.defineComponent({name:"QRCodeCanvas",props:Eo,setup:function(a,l){var o=r.ref(null),i=r.ref(null),u=function(){var m=a.value,p=a.level,w=a.size,x=a.margin,C=a.background,y=a.foreground,N=a.gradient,O=a.gradientType,T=a.gradientStartColor,v=a.gradientEndColor,D=x>>>0,U=Co(p)?p:wo,M=o.value;if(M){var R=M.getContext("2d");if(R){var F=Cr.QrCode.encodeText(m,_o[U]).getModules(),H=F.length+D*2,Z=i.value,V={x:0,y:0,width:0,height:0},P=a.imageSettings.src&&Z!=null&&Z.naturalWidth!==0&&Z.naturalHeight!==0;if(P){var L=ga(F,a.size,D,a.imageSettings);V={x:L.x+D,y:L.y+D,width:L.w,height:L.h},L.excavation&&(F=pa(F,L.excavation))}var re=window.devicePixelRatio||1,Q=w/H*re;if(M.height=M.width=w*re,R.scale(Q,Q),R.fillStyle=C,R.fillRect(0,0,H,H),N){var ee=void 0;O==="linear"?ee=R.createLinearGradient(0,0,H,H):ee=R.createRadialGradient(H/2,H/2,0,H/2,H/2,H/2),ee.addColorStop(0,T),ee.addColorStop(1,v),R.fillStyle=ee}else R.fillStyle=y;b1?R.fill(new Path2D(ma(F,D))):F.forEach(function(W,X){W.forEach(function(I,$){I&&R.fillRect($+D,X+D,1,1)})}),P&&R.drawImage(Z,V.x,V.y,V.width,V.height)}}};r.onMounted(u),r.onUpdated(u);var f=l.attrs.style;return function(){return r.h(r.Fragment,[r.h("canvas",kn(kn({},l.attrs),{ref:o,style:kn(kn({},f),{width:"".concat(a.size,"px"),height:"".concat(a.size,"px")})})),a.imageSettings.src&&r.h("img",{ref:i,src:a.imageSettings.src,style:{display:"none"},onLoad:u})])}}}),N1=r.defineComponent({name:"Qrcode",render:function(){var a=this.$props,l=a.renderAs,o=a.value,i=a.size,u=a.margin,f=a.level,m=a.background,p=a.foreground,w=a.imageSettings,x=a.gradient,C=a.gradientType,y=a.gradientStartColor,N=a.gradientEndColor;return r.h(l==="svg"?S1:I1,{value:o,size:i,margin:u,level:f,background:m,foreground:p,imageSettings:w,gradient:x,gradientType:C,gradientStartColor:y,gradientEndColor:N})},props:A1});const T1={},k1={viewBox:"0 0 24 24","aria-hidden":"true"};function R1(a,l){return r.openBlock(),r.createElementBlock("svg",k1,[...l[0]||(l[0]=[r.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),r.createElementVNode("path",{d:"M9 7h6"},null,-1),r.createElementVNode("path",{d:"M10 18h4"},null,-1)])])}const B1=Xe(T1,[["render",R1]]),O1={},M1={viewBox:"0 0 24 24","aria-hidden":"true"};function D1(a,l){return r.openBlock(),r.createElementBlock("svg",M1,[...l[0]||(l[0]=[r.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 v1=Xe(O1,[["render",D1]]),P1="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",L1={class:"wrapper_qr_page"},F1=["src"],V1={class:"modal_qr"},U1={class:"modal_qr_content"},z1={class:"wrapper_icon_qr"},H1=["src"],G1={class:"total_order_price"},W1={class:"ttl_wrapper"},X1={class:"ttl_head"},$1={class:"ttl_bar"},j1={class:"hint hint-anim","aria-label":"Инструкция по оплате"},q1={class:"steps","aria-hidden":"true"},Z1={class:"step is-active","data-i":"0"},Y1={class:"ico"},K1={class:"step","data-i":"1"},Q1={class:"ico"},J1={class:"step","data-i":"2"},ef={class:"ico"},tf=["src"],nf={class:"qr_border"},rf=Xe(r.defineComponent({__name:"CompletedQRCode",setup(a){const l=Rt(),o=Mt(),i=st(),u=Te.useRouter(),f={src:l.itemThemes.logo||"",width:60,height:60,excavate:!0},m=r.computed(()=>l.itemThemes.kiosk_qr_payment_timeout||60).value,p=r.ref(m);let w=0;const x=r.computed(()=>{const v=Math.floor(p.value/60),D=p.value%60;return`${v}:${D.toString().padStart(2,"0")}`}),C=r.computed(()=>p.value/m*100),y=r.computed(()=>o.paymentCostQR),N=()=>{p.value--,p.value<=0&&(clearInterval(w),O())},O=()=>{i.removeFromLocalStorage(["cart","authTokensAccess","authTokensRefresh","user"]),sessionStorage.removeItem("is_adult"),u.replace({name:"home"}).then(()=>u.go(0))};r.onMounted(()=>{w=setInterval(N,1e3)}),r.onBeforeUnmount(()=>{clearInterval(w)});const{mediaUrl:T}=Tn(()=>l.itemThemes.kiosk_preloader?"preloader":null);return(v,D)=>(r.openBlock(),r.createElementBlock("div",L1,[(r.openBlock(),r.createElementBlock("video",{loop:"",autoplay:"",muted:"",playsinline:"",key:r.unref(T)},[r.createElementVNode("source",{src:r.unref(T)||"",type:"video/webm"},null,8,F1)])),D[7]||(D[7]=r.createElementVNode("div",{class:"start_img_black"},null,-1)),r.createElementVNode("div",V1,[r.createElementVNode("div",U1,[r.createElementVNode("div",z1,[r.createElementVNode("img",{src:r.unref(ha),width:"100",height:"100"},null,8,H1)]),D[6]||(D[6]=r.createElementVNode("h1",null,"Оплата по QR",-1)),r.createElementVNode("p",G1,[r.createVNode(ft,{price:y.value,fixedFloat:2},null,8,["price"]),r.createTextVNode(" "+r.toDisplayString(r.unref(i).config_lib.currency_symbol),1)]),r.createElementVNode("div",W1,[r.createElementVNode("div",X1,[D[0]||(D[0]=r.createElementVNode("span",null,"Срок жизни QR-кода",-1)),r.createElementVNode("b",null,r.toDisplayString(x.value),1)]),r.createElementVNode("div",$1,[r.createElementVNode("div",{class:"ttl_fill",style:r.normalizeStyle({width:`${C.value}%`})},null,4)])]),r.createElementVNode("p",j1,[r.createElementVNode("div",q1,[r.createElementVNode("div",Z1,[r.createElementVNode("div",Y1,[r.createVNode(B1)]),D[1]||(D[1]=r.createElementVNode("div",{class:"txt"},"Возьмите телефон →",-1))]),D[4]||(D[4]=r.createElementVNode("div",{class:"sep"},null,-1)),r.createElementVNode("div",K1,[r.createElementVNode("div",Q1,[r.createVNode(v1)]),D[2]||(D[2]=r.createElementVNode("span",{class:"txt"},"Отсканируйте QR-код",-1))]),D[5]||(D[5]=r.createElementVNode("span",{class:"sep"},"→",-1)),r.createElementVNode("div",J1,[r.createElementVNode("div",ef,[r.createElementVNode("img",{src:r.unref(P1),width:"30",height:"30"},null,8,tf)]),D[3]||(D[3]=r.createElementVNode("span",{class:"txt"},"Оплатите заказ",-1))])])]),r.createElementVNode("div",nf,[r.createVNode(N1,{value:r.unref(o).linkQR,size:200,level:"Q","render-as":"svg","image-settings":f},null,8,["value"])]),r.createVNode(an,{textButtonDefault:"Отменить заказ",onClick:O,class:"cancel_order_btn"})])])]))}}),[["__scopeId","data-v-bd3b4b16"]]),of={key:0,class:"wrapper_qr"},sf={key:1,class:"wrapper_qr"},af={key:2,class:"wrapper_qr"},lf={key:3,class:"wrapper_qr"},cf=Xe(r.defineComponent({__name:"CartCompletedOrder",props:{orderNumber:{}},setup(a){const l=Mt(),o=Rt(),{orderNumber:i,orderCompleted_lib:u}=we.storeToRefs(l),{mediaUrl:f}=Tn(()=>o.itemThemes.kiosk_preloader?"preloader":null);return(m,p)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[r.unref(u)&&r.unref(u)===1?(r.openBlock(),r.createElementBlock("section",of,[r.createVNode(w1)])):r.unref(u)&&r.unref(u)===2?(r.openBlock(),r.createElementBlock("section",sf,[r.createVNode(y1)])):r.createCommentVNode("",!0),r.unref(u)&&r.unref(u)===3?(r.openBlock(),r.createElementBlock("section",af,[r.createVNode(g1,{orderNumber:r.unref(i),mediaUrl:r.unref(f)},null,8,["orderNumber","mediaUrl"])])):r.createCommentVNode("",!0),r.unref(u)&&r.unref(u)===4?(r.openBlock(),r.createElementBlock("section",lf,[r.createVNode(rf)])):r.createCommentVNode("",!0)],64))}}),[["__scopeId","data-v-3779e8ee"]]);function df(){const a=Te.useRoute(),l=Mt(),o=st(),i=Fn(),{isButtonDisabled:u}=we.storeToRefs(l),f=(p,w)=>{const x=i.isTableService?"tableservice":p.kiosk_menu?"kiosk":"qr",C=l.createPaymentHandler(x,p.kiosk_menu,w);return C?{...C.config,route:{params:{orgId:String(a.params.orgId)}},handler:C.handler,resetDiscounts:p.resetDiscounts,setButtonDisabled:y=>{u.value=y},on403Kiosk:()=>{localStorage.removeItem("apiKey"),o.is_showApiKey=!0}}:null};return{getCreateOrderConfig:f,makeCreateOrderRequest:async(p,w)=>{const x=f(p,w.paymentMethodId);if(x)return Pd(w.items,x,{comment:w.comment,is_authorized:w.isAuthorized,signal:w.signal})}}}const uf={},ff={class:"cart_loyal_qr",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"};function hf(a,l){return r.openBlock(),r.createElementBlock("svg",ff,[...l[0]||(l[0]=[r.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 mf=Xe(uf,[["render",hf]]),yo=a=>{const l=bi(),o=p=>l.open(a,p),i=()=>l.close(a),u=l.state(a),f=r.computed({get:()=>u.value.visible,set:p=>p&&o()||i()}),m=r.computed(()=>u.value.context);return{visible:f,context:m,open:o,close:i}},gf={class:"cart_deletion_modal_content"},pf={class:"cart_deletion_modal_title"},xf={class:"cart_deletion_modal_footer"},wf=Xe(r.defineComponent({__name:"CartDeleteConfirm",emits:["confirm"],setup(a,{emit:l}){const o=l,{visible:i,context:u,close:f}=yo("cart-delete-confirm"),m=()=>{o("confirm",u.value.idSystem),f()};return(p,w)=>(r.openBlock(),r.createBlock(r.Transition,{name:"fade"},{default:r.withCtx(()=>[r.unref(i)?(r.openBlock(),r.createElementBlock("div",{key:0,class:"cart_deletion_modal_overlay",onClick:w[1]||(w[1]=r.withModifiers((...x)=>r.unref(f)&&r.unref(f)(...x),["self"]))},[r.createElementVNode("div",gf,[r.createElementVNode("div",pf,"Удалить "+r.toDisplayString(r.unref(u).name)+"?",1),w[2]||(w[2]=r.createElementVNode("div",{class:"cart_deletion_modal_body"},"Эта позиция будет полностью удалена из заказа.",-1)),r.createElementVNode("div",xf,[r.createElementVNode("button",{class:"primary",onClick:m}," Удалить "),r.createElementVNode("button",{onClick:w[0]||(w[0]=(...x)=>r.unref(f)&&r.unref(f)(...x))},"Отмена")])])])):r.createCommentVNode("",!0)]),_:1}))}}),[["__scopeId","data-v-018f66f3"]]),_f={class:"cart_extend_modal_content"},Cf={class:"cart_extend_modal_footer"},Ef=Xe(r.defineComponent({__name:"CartExtendConfirm",emits:["confirm"],setup(a,{emit:l}){const o=l,{visible:i,context:u,close:f}=yo("cart-extend-confirm"),m=()=>{o("confirm"),f()};return(p,w)=>(r.openBlock(),r.createBlock(r.Transition,{name:"fade"},{default:r.withCtx(()=>[r.unref(i)?(r.openBlock(),r.createElementBlock("div",{key:0,class:"cart_extend_modal_overlay",onClick:w[1]||(w[1]=r.withModifiers((...x)=>r.unref(f)&&r.unref(f)(...x),["self"]))},[r.createElementVNode("div",_f,[w[2]||(w[2]=r.createElementVNode("div",{class:"cart_extend_modal_title"},"Дополнить заказ?",-1)),w[3]||(w[3]=r.createElementVNode("div",{class:"cart_extend_modal_body"},"В заказ добавлены новые позиции. Подтвердить дополнение заказа? После подтверждения позиции нельзя отменить.",-1)),r.createElementVNode("div",Cf,[r.createElementVNode("button",{onClick:w[0]||(w[0]=(...x)=>r.unref(f)&&r.unref(f)(...x))},"Отмена"),r.createElementVNode("button",{class:"primary",onClick:m}," Продолжить ")])])])):r.createCommentVNode("",!0)]),_:1}))}}),[["__scopeId","data-v-15f3f7bf"]]),yf={class:"order_box_wrapper"},bf=["src"],Af={class:"order_box_content_wrapper"},Sf={class:"order_box_content_info"},If={class:"order_box_amount"},Nf={class:"order_box_amount_count"},Tf={key:0,class:"order_box_status"},kf=["data-state"],Rf={class:"order_box_info_more"},Bf={key:1,class:"cart_modifier_info"},Of={class:"cart_modifier_content"},Mf={class:"wrapper_price_count_cart"},Df={class:"count_order_box"},vf={class:"wrapper_modifiers_discount"},bo=Xe(r.defineComponent({__name:"OrderBox",props:{index:Number,cardItem:Object},emits:["delete"],setup(a,{emit:l}){const o=a,i=r.ref(!1),{displayNumber:u,update:f}=go(0,800),m=r.computed(()=>{var O,T;const y=((O=o.cardItem)==null?void 0:O.modifiers)??[],N=(((T=o.cardItem)==null?void 0:T.group_modifiers)??[]).flatMap(v=>v.modifiers??[]);return[...y,...N]}),{mediaUrl:p}=Tn(()=>{var y;return((y=o.cardItem)==null?void 0:y.id)+"_image"},()=>{var y;return(y=o.cardItem)==null?void 0:y.image_link}),w=r.computed(()=>{var y;return(y=o.cardItem)==null?void 0:y.total_cost}),x=()=>{i.value=!i.value},C=r.computed(()=>{var N,O;if((N=o.cardItem)!=null&&N.correlation_id)return"Ожидает добавления 🕓";const y=(O=o.cardItem)==null?void 0:O.cooking_state;return!y&&y!==0?null:y===0?"Создан":y===1?"Готовится":y===2?"Приготовлен":y===3?"Выдан":null});return r.watch(w,f,{immediate:!0}),(y,N)=>{var O,T,v,D,U;return r.openBlock(),r.createElementBlock("div",yf,[r.createElementVNode("img",{src:r.unref(p)||"",class:"order_box_image"},null,8,bf),r.createElementVNode("div",Af,[r.createElementVNode("div",Sf,[r.createElementVNode("p",null,r.toDisplayString((O=a.cardItem)==null?void 0:O.name),1),r.createElementVNode("div",If,[N[0]||(N[0]=r.createElementVNode("button",{disabled:""},"-",-1)),r.createElementVNode("p",Nf,r.toDisplayString((T=o.cardItem)==null?void 0:T.amount),1),N[1]||(N[1]=r.createElementVNode("button",{disabled:""},"+",-1))]),C.value?(r.openBlock(),r.createElementBlock("div",Tf,[r.createElementVNode("span",{"data-state":(v=a.cardItem)==null?void 0:v.cooking_state},r.toDisplayString(C.value),9,kf)])):r.createCommentVNode("",!0)]),r.createElementVNode("div",Rf,[(D=o.cardItem)!=null&&D.new_price?(r.openBlock(),r.createElementBlock("p",{key:0,class:r.normalizeClass({discount_new_price:(U=o.cardItem)==null?void 0:U.new_price})},r.toDisplayString((o.cardItem.new_price*o.cardItem.amount).toFixed(2)+"₽"),3)):r.createCommentVNode("",!0),r.createElementVNode("p",null,r.toDisplayString(r.unref(u).toFixed(2)+"₽"),1)])]),!i.value&&m.value.length>0?(r.openBlock(),r.createElementBlock("div",{key:0,class:"cart_modifier_toggle",onClick:r.withModifiers(x,["stop"])},[...N[2]||(N[2]=[r.createElementVNode("p",{class:"cart_info_more"},"Посмотреть модификаторы",-1),r.createElementVNode("p",{class:"cart_arrow"},null,-1)])])):r.createCommentVNode("",!0),i.value?(r.openBlock(),r.createElementBlock("div",Bf,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(m.value,M=>{var R;return r.openBlock(),r.createElementBlock("div",{class:"cart_modifier_item",key:M.id},[r.createElementVNode("div",Of,[r.createVNode(Ci,{id:"plus_orange"}),r.createElementVNode("p",null,r.toDisplayString(M.name),1)]),r.createElementVNode("div",Mf,[r.createElementVNode("p",Df,r.toDisplayString(`x${M.amount}`),1),r.createElementVNode("div",vf,[M!=null&&M.new_price?(r.openBlock(),r.createElementBlock("p",{key:0,class:r.normalizeClass({discount_new_price:(R=M==null?void 0:M.new_price)==null?void 0:R.toFixed(2)})},r.toDisplayString((M.new_price*M.amount).toFixed(2)+"₽"),3)):r.createCommentVNode("",!0),r.createElementVNode("p",null,r.toDisplayString((M.total_new_price||M.price*M.amount).toFixed(2)+"₽"),1)])])])}),128)),r.createElementVNode("div",{class:"cart_modifier_arrow",onClick:r.withModifiers(x,["stop"])},[...N[3]||(N[3]=[r.createElementVNode("p",{class:"cart_info_more"},"Скрыть",-1),r.createElementVNode("p",{class:"cart_arrow_top"},null,-1)])])])):r.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-453214a0"]]),Pf={class:"cart_wrapper"},Lf={class:"cart_header_content"},Ff={key:0,class:"cart_header_subwrapper"},Vf={class:"cart_kso_button_wrapper"},Uf={key:0},zf={key:0,class:"kso_btn_wrapper"},Hf=["src"],Gf={key:0,class:"cart_qr_button_wrapper"},Wf={class:"cart_header_info"},Xf={class:"cart_header_info"},$f={class:"cart_header_info"},jf={class:"cart_header_info"},qf={key:1,class:"cart-tabs-wrapper"},Zf={class:"cart-tabs-container"},Yf=["data-active","onClick"],Kf={key:0,class:"wrapper_comment"},Qf={class:"wrapper_limit_in_area"},Jf=["placeholder","aria-invalid"],eh={class:"limit_comment"},th={key:1,class:"wrapper_comment"},nh={class:"wrapper_limit_in_area"},rh=["placeholder","aria-invalid"],ih={class:"limit_comment"},oh={key:2},sh={class:"table_order_desk_number"},ah={key:0,class:"table_order_indent_number"},lh={class:"cart_cards"},ch={class:"cart_footer_wrapper"},dh={key:0,class:"footer_title"},uh=["disabled","max"],fh={key:1,class:"footer_sales"},hh=["step","max"],mh={class:"list_price"},gh={key:0},ph={key:1},xh={key:2},wh={class:"accept_field"},_h={class:"accept_field"},Ch={key:3},Eh={class:"accept_field"},yh={class:"accept_field"},bh={key:4},Ah={key:5},Sh={key:0,class:"accept_field"},Ih={key:1,class:"accept_field"},Nh={key:3,class:"cart_min_order_notice"},Th={class:"wrapper_footer_cart_btn"},kh=r.defineComponent({__name:"CartPage",props:{configPage:{},textPaymentBtn:{},config_qr:{type:Boolean}},setup(a){const l=yn.create();let o;const i=st(),u=Mt(),f=Rt(),m=Fn(),p=bi(),w=a,{initialCartPrice_lib:x,totalPrice_lib:C,countBonus:y,config_lib:N,cartProducts_lib:O,profile:T}=we.storeToRefs(i),{itemThemes:v}=we.storeToRefs(f),{isButtonDisabled:D,orderCompleted_lib:U,orderNumber:M,extraDiscount:R,is_notification_lib:F,isCreateButtonVisible:H,is_paymentCart:Z,providerTypes:V,notificationData_lib:P,selectedProvider:L,configPayment:re}=we.storeToRefs(u),Q=Te.useRouter(),ee=Te.useRoute(),W=r.useTemplateRef("stickerLoyality"),X=r.ref(!1),I=r.ref(!1),$=r.ref(!1),j=r.useTemplateRef("commentEl"),q=r.ref(""),K=r.ref(!1),oe=r.ref(!1),de=r.ref(!1),ce=r.ref(0),Ce=r.ref(0),ge=r.ref(!0),De=r.ref(),xe=r.computed(()=>w.configPage.qr_menu?"YOOKASSA_BASE":V.value[0].front_type),_t=r.computed(()=>w.configPage.qr_menu?"YOOKASSA":V.value[0].type),be=r.computed(()=>{var pe,se;return w.configPage.kiosk_menu&&((pe=N.value)==null?void 0:pe.loyalty)==="IIKO"&&(N.value.has_loyalty_default_user||T.value)||w.configPage.qr_menu&&((se=N.value)==null?void 0:se.loyalty)==="IIKO"&&(T.value||v.value.qr_auth_required===!1)}),et=r.computed(()=>["АВТОРИЗОВАТЬСЯ ДЛЯ ЗАКАЗА"].includes(w.textPaymentBtn.toUpperCase())?w.textPaymentBtn:m.isTableService&&m.hasOrder?"Дополнить заказ":H.value?"Создать заказ":w.textPaymentBtn),{width:rt}=yt.useElementSize(W,{width:0,height:0},{box:"border-box"}),Ve=r.computed(()=>{var $e,Ae,zt,An;const pe={energy_amount:0,proteins_amount:0,fat_amount:0,carbohydrates_amount:0};let se=pe;return m.isTableService&&((Ae=($e=m.order)==null?void 0:$e.items)!=null&&Ae.length)&&(se=((An=(zt=m.order)==null?void 0:zt.items)==null?void 0:An.reduce((ct,Pe)=>(Pe!=null&&Pe.nutrition&&(ct.energy_amount+=(Pe.nutrition.energy_amount||0)*(Pe.amount||0),ct.proteins_amount+=(Pe.nutrition.proteins_amount||0)*(Pe.amount||0),ct.fat_amount+=(Pe.nutrition.fat_amount||0)*(Pe.amount||0),ct.carbohydrates_amount+=(Pe.nutrition.carbohydrates_amount||0)*(Pe.amount||0)),ct),pe))||pe),O.value.reduce((ct,Pe)=>(ct.energy_amount+=(Pe.energy_amount||0)*(Pe.amount||0),ct.proteins_amount+=(Pe.proteins_amount||0)*(Pe.amount||0),ct.fat_amount+=(Pe.fat_amount||0)*(Pe.amount||0),ct.carbohydrates_amount+=(Pe.carbohydrates_amount||0)*(Pe.amount||0),ct),se)}),it=r.computed(()=>{var pe;if((pe=v.value)!=null&&pe.comments){const se=v.value.comments;return{fieldName:w.configPage.kiosk_menu?se.kiosk_comment_field_name:se.qr_comment_field_name,placeholder:w.configPage.kiosk_menu?se.kiosk_comment_field_placeholder:se.qr_comment_field_placeholder,show:w.configPage.kiosk_menu?se.kiosk_show_order_comment:se.qr_show_order_comment}}}),Me=yt.computedAsync(async pe=>{var Ae;const se=new AbortController;if(pe(()=>se.abort()),!X.value||!((Ae=T.value)!=null&&Ae.balance)||!C.value)return 0;const $e=await l.maxPayByBonuses(De.value,w.configPage.kiosk_menu,!!w.configPage.userData||!!T.value,se.signal);return $e!=null&&$e.by_bonuses?($.value=$e.non_integers_allowed||!1,Math.min($e.by_bonuses,T.value.balance,C.value)):0},0,{shallow:!0}),Ie=()=>Q.push(`/${ee.params.orgId}/`),Ue=pe=>{($.value?["a","A","+","-","."]:["a","A","+","-",".",","]).includes(pe.key)&&pe.preventDefault()},It=pe=>{i.deleteItemFromCart(pe),O.value.length===0&&(oe.value=!1,de.value=!1,m.hasOrder&&Q.replace({name:"order-ts"}))},ot=()=>{oe.value=!oe.value,q.value.length},Qe=r.computed(()=>{var se;return(((se=v.value.cart_loyalty_button)==null?void 0:se.cart_loyalty_button_text)||"Программа лояльности").replace(/\S+/g,$e=>$e.length>15?$e.slice(0,15)+"...":$e)}),ve=()=>{de.value=!de.value,q.value.length},ar=()=>{let pe=$.value?+y.value.toFixed(2):Math.floor(y.value)||0;pe>Me.value&&(pe=Me.value),pe!==y.value&&i.setBonus(pe)};r.watchEffect(()=>{ar(),i.setBonus(C.value===0?0:$.value?+y.value.toFixed(2):Math.floor(y.value))});const ye=()=>O.value.map(pe=>({id:pe.id,front_item_id:pe.idSystem,is_fake:!!pe.is_fake,is_od_united_product:!!pe.is_od_united_product,removals:pe.removals??null,amount:pe.amount,size:pe.size,modifiers:pe.modifiers??[],group_modifiers:pe.group_modifiers??[]})),{makeCreateOrderRequest:br}=df(),qr=r.computed(()=>ye()),Dt=r.computed(()=>{var pe,se,$e,Ae;return w.configPage.qr_menu&&((se=(pe=v.value)==null?void 0:pe.comments)==null?void 0:se.qr_is_order_comment_required)||w.configPage.kiosk_menu&&((Ae=($e=v.value)==null?void 0:$e.comments)==null?void 0:Ae.kiosk_is_order_comment_required)}),Ar=()=>{var pe,se;return!(Dt.value&&((se=(pe=q.value)==null?void 0:pe.trim())==null?void 0:se.length)<1&&j.value)||m.isTableService&&m.hasOrder?!1:(u.showNotification("Обязательно перед созданием заказа укажите комментарий к заказу"),j.value.focus(),K.value=!0,Ot.animate(j.value.parentElement,{x:[0,-10,0,10,0]},{duration:.1,repeat:2}),!0)},dn=async()=>{var pe,se,$e;if(w.configPage.qr_menu&&!T.value&&v.value.qr_auth_required!==!1){Q.push(`/${ee.params.orgId}/register`);return}if(!(Dt.value&&Ar())){if(m.isTableService){if((pe=m.data)!=null&&pe.available_extend||m.hasOrder){u.showNotification("Для данного стола уже был создан заказ."),m.refresh();return}if(m.hasOrder)p.open("cart-extend-confirm");else try{await l.confirmOrder(De.value),u.deleteCart(),m.refresh(),Q.push({name:"order-ts"})}catch(Ae){u.showNotification((($e=(se=Ae==null?void 0:Ae.response)==null?void 0:se.data)==null?void 0:$e.user_friendly_message)||"Ошибка при создании заказа"),m.refresh(),D.value=!1,at()}return}if(w.configPage.qr_menu||V.value.length<=1){D.value=!0,await lo(De.value,_t.value).then(Ae=>{re.value&&Ae.url&&w.configPage.qr_menu&&window.location.replace(Ae.url)});return}return Z.value=!Z.value}},Ri=()=>{Z.value=!1},Rn=async()=>{var se,$e,Ae,zt,An;R.value=0;const pe={items:[...ye()],comment:q.value,combos:[]};m.id&&(pe.table=m.id),(se=w.configPage)!=null&&se.kiosk_menu&&(($e=u.selectedOrderType)!=null&&$e.id)&&(pe.order_type_id=(Ae=u.selectedOrderType)==null?void 0:Ae.id);try{I.value=!0;const ct=await l.calculateDiscount(pe,w.configPage.kiosk_menu,!!w.configPage.userData||!!T.value,o.signal);if(!O.value)return;O.value.forEach(Pe=>{const qt=ct.items.find(Ye=>Ye.front_item_id===Pe.idSystem);if(qt&&(Pe.group_modifiers.forEach(Ye=>{const Ct=qt.group_modifiers.find(Nt=>Nt.group===Ye.group);Ct&&Ye.modifiers.forEach(Nt=>{const pt=Ct.modifiers.find(ze=>ze.id===Nt.id);if(pt&&Number(Nt.price)!==Number(pt==null?void 0:pt.new_price)){const ze=(pt.discounts||[]).reduce((un,Wn)=>un+=+Wn.discount,0);ce.value+=ze,Nt.new_price=Nt.price,Nt.price=Number(pt==null?void 0:pt.new_price),Nt.total_new_price=Number(pt.total_new_price)}})}),Pe.modifiers.forEach(Ye=>{const Ct=qt.modifiers.find(Nt=>Nt.id===Ye.id);if(Ct&&Number(Ye.price)!==Number(Ct==null?void 0:Ct.new_price)){const Nt=(Ct.discounts||[]).reduce((pt,ze)=>pt+=+ze.discount,0);ce.value+=Nt,Ye.new_price=Ye.price,Ye.price=Number(Ct==null?void 0:Ct.new_price),Ye.total_new_price=Number(Ct.total_new_price)}}),Pe.price!==Number(qt.new_price))){const Ye=(qt.discounts||[]).reduce((Ct,Nt)=>Ct+=+Nt.discount,0);ce.value=ce.value+Ye,Pe.new_price=Pe.price,Pe.price=qt.new_price,Pe.discounts=qt.discounts,Pe.total_new_price=Number(qt.total_new_price)}}),O.value=[...O.value],ce.value!==0&&(C.value=ct.total_cart_price)}catch(ct){if(I.value=!1,!Ze.isCancel(ct))throw u.showNotification(((An=(zt=ct==null?void 0:ct.response)==null?void 0:zt.data)==null?void 0:An.user_friendly_message)||"Скидки временно недоступны"),ct}},Ut=async()=>{var se,$e;let pe=D.value;D.value=!0;try{await l.extendOrder([...ye()]),u.deleteCart(),m.refreshOrder(),Q.push({name:"order-ts"})}catch(Ae){throw u.showNotification((($e=(se=Ae==null?void 0:Ae.response)==null?void 0:se.data)==null?void 0:$e.user_friendly_message)||"Не удалось дополнить заказ"),Ae}finally{D.value=pe}},Bi=async()=>{var pe;if(!(Dt.value&&Ar())){De.value=null,o=new AbortController,D.value=!0;try{be.value&&await Rn(),L.value={front_type:xe};const se={paymentMethodId:xe.value,items:qr.value,comment:q.value,isAuthorized:!!w.configPage.userData||!!T,signal:o==null?void 0:o.signal},$e=await br({...w.configPage,resetDiscounts:at},se);De.value=(pe=$e==null?void 0:$e.data)==null?void 0:pe.id,H.value=!1}catch(se){console.log("[cart](createOrder)",se),!Ze.isCancel(se)&&m.isTableService&&m.refresh(),D.value=!1,at()}}},Sr=()=>{var pe;return w.configPage.qr_menu&&["АВТОРИЗОВАТЬСЯ ДЛЯ ЗАКАЗА"].includes(w.textPaymentBtn.toUpperCase())&&!T.value&&v.value.qr_auth_required!==!1?Q.push(`/${ee.params.orgId}/register`):m.isTableService&&((pe=m.data)!=null&&pe.available_extend)?p.open("cart-extend-confirm"):H.value?Bi():dn()},Oo=()=>{var pe;(pe=T.value)!=null&&pe.balance?T.value.balance>0&&(X.value=!X.value):u.showNotification("У Вас пока нет бонусов")};r.onMounted(async()=>{i.loadCart(),U.value=null,C.value=null,R.value=0,at()}),r.onUnmounted(()=>{o&&(o==null||o.abort(),o=null),D.value=!1,De.value=null,U.value=null,C.value=null,R.value=0,O.value.splice(0,O.value.length,...O.value.map(i.makeProductFullyReactive))});const ht=r.computed(()=>w.configPage.qr_menu?N.value.qr_order_minimum_price||0:w.configPage.kiosk_menu&&N.value.kiosk_order_minimum_price||0),me=r.computed(()=>{var pe;return["АВТОРИЗОВАТЬСЯ ДЛЯ ЗАКАЗА"].includes(w.textPaymentBtn.toUpperCase())?!1:m.isTableService&&m.hasOrder&&!((pe=m.data)!=null&&pe.available_extend)||ht.value>x.value&&!m.hasOrder||I.value||D.value||O.value.length===0?!0:(U.value=null,D.value)}),bt=r.computed(()=>{var pe;return((pe=O.value)==null?void 0:pe.reduce((se,$e)=>se+$e.amount,0))||0}),tt=r.computed(()=>{var pe;return(pe=T.value)==null?void 0:pe.phone});r.watch(q,pe=>{var se;return((se=pe==null?void 0:pe.trim())==null?void 0:se.length)&&(K.value=!1)}),r.watch([bt,tt,()=>u.selectedOrderType],()=>{bt.value===0&&(o=null),o==null||o.abort(),D.value=!1});const at=()=>{H.value=!0,i.setBonus(0),O.value.splice(0,O.value.length,...O.value.map(i.makeProductFullyReactive)),ce.value=0,C.value=null,R.value=0};return r.watch([()=>i.cartProducts_lib,tt,bt,()=>u.selectedOrderType],pe=>{if(Ce.value>0){Ce.value--;return}pe&&!I.value&&(X.value=!1,at(),Ce.value=1),I.value=!1},{deep:!0}),(pe,se)=>{var $e,Ae,zt,An,ct,Pe,qt,Ye,Ct,Nt,pt;return r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createElementVNode("div",Pf,[r.createVNode(wf,{onConfirm:It}),r.createVNode(Ef,{onConfirm:Ut}),r.createVNode(da,{visible:r.unref(u).isDrawerOpen,"onUpdate:visible":se[0]||(se[0]=ze=>r.unref(u).isDrawerOpen=ze)},{default:r.withCtx(()=>[r.createVNode(fa)]),_:1},8,["visible"]),r.createElementVNode("header",Lf,[w.configPage.kiosk_menu?(r.openBlock(),r.createElementBlock("div",Ff,[r.createElementVNode("div",Vf,[r.createElementVNode("div",{class:r.normalizeClass(["arrow_wrapper",{arrow_wrapper_kso:w.configPage.kiosk_menu}]),onClick:Ie},[r.createVNode(_r,{class:"cart_header_back_button"}),w.configPage.kiosk_menu?(r.openBlock(),r.createElementBlock("span",Uf,"Назад")):r.createCommentVNode("",!0)],2)]),it.value&&it.value.show?(r.openBlock(),r.createElementBlock("div",zf,[Dt.value?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock(an,{key:0,style:r.normalizeStyle({visibility:!oe.value&&r.unref(O).length>0?"visible":"hidden"}),class:r.normalizeClass({button_kso_comment:a.configPage.kiosk_menu}),textButtonDefault:q.value.length>0?"Редактировать":it.value&&it.value.fieldName||"",onClick:()=>oe.value=!oe.value,id:"button_kso_comment"},null,8,["style","class","textButtonDefault","onClick"]))])):r.createCommentVNode("",!0),r.createElementVNode("div",{class:r.normalizeClass({cart_header_wrapper:w.configPage.kiosk_menu})},[(r.unref(v).kiosk_show_loyalty_card_button||r.unref(v).kiosk_show_loyalty_phone_input_button)&&!w.config_qr?(r.openBlock(),r.createElementBlock("button",{key:0,class:"buttonDefaultWrapper button_payment_cart button_payment_cart_loyal",style:r.normalizeStyle({marginRight:($e=r.unref(v).cart_loyalty_button)!=null&&$e.cart_loyalty_button_sticker?`${Math.ceil(r.unref(rt)/2+10)}px`:"",paddingRight:(Ae=r.unref(v).cart_loyalty_button)!=null&&Ae.cart_loyalty_button_sticker?0:""}),onClick:se[1]||(se[1]=(...ze)=>r.unref(u).openDrawer&&r.unref(u).openDrawer(...ze))},[r.createElementVNode("p",{class:"cart_loyal_program",style:r.normalizeStyle({marginRight:`${Math.ceil(r.unref(rt)/2)}px`})},r.toDisplayString(Qe.value),5),(zt=r.unref(v).cart_loyalty_button)!=null&&zt.cart_loyalty_button_sticker?(r.openBlock(),r.createElementBlock("div",{key:0,ref_key:"stickerLoyality",ref:W,class:"cart_loyal_program_icon",style:r.normalizeStyle({"--sticker-mask":`url(${r.unref(v).cart_loyalty_button.cart_loyalty_button_sticker})`})},[r.createElementVNode("img",{src:r.unref(v).cart_loyalty_button.cart_loyalty_button_sticker},null,8,Hf)],4)):(r.openBlock(),r.createBlock(mf,{key:1,class:"cart_loyal_qr"}))],4)):r.createCommentVNode("",!0)],2)])):r.createCommentVNode("",!0),r.createElementVNode("div",{class:r.normalizeClass([a.config_qr?"cart_kbju_qr_wrapper":"cart_kbju_kso_wrapper"])},[a.config_qr?(r.openBlock(),r.createElementBlock("div",Gf,[r.createElementVNode("div",{class:"arrow_wrapper",onClick:Ie},[r.createVNode(_r,{class:"cart_header_back_button"})])])):r.createCommentVNode("",!0),r.unref(v).show_nutrition_in_cart?(r.openBlock(),r.createElementBlock("div",{key:1,class:"cart_header",style:r.normalizeStyle({paddingTop:w.config_qr?0:"10px",paddingRight:w.config_qr?"10px":0})},[r.createElementVNode("div",Wf,[r.createElementVNode("p",null,[r.createVNode(ft,{price:Ve.value.energy_amount,duration:800},null,8,["price"]),se[9]||(se[9]=r.createTextVNode(" г",-1))]),se[10]||(se[10]=r.createElementVNode("p",{class:"cart_info_name"},"Килокалории",-1))]),r.createElementVNode("div",Xf,[r.createElementVNode("p",null,[r.createVNode(ft,{price:Ve.value.proteins_amount,duration:900},null,8,["price"]),se[11]||(se[11]=r.createTextVNode(" г",-1))]),se[12]||(se[12]=r.createElementVNode("p",{class:"cart_info_name"},"Белки",-1))]),r.createElementVNode("div",$f,[r.createElementVNode("p",null,[r.createVNode(ft,{price:Ve.value.fat_amount,duration:1e3},null,8,["price"]),se[13]||(se[13]=r.createTextVNode(" г",-1))]),se[14]||(se[14]=r.createElementVNode("p",{class:"cart_info_name"},"Жиры",-1))]),r.createElementVNode("div",jf,[r.createElementVNode("p",null,[r.createVNode(ft,{price:Ve.value.carbohydrates_amount,duration:1100},null,8,["price"]),se[15]||(se[15]=r.createTextVNode(" г",-1))]),se[16]||(se[16]=r.createElementVNode("p",{class:"cart_info_name"},"Углеводы",-1))])],4)):r.createCommentVNode("",!0)],2),a.configPage.kiosk_menu&&r.unref(u).orderTypes.length>1?(r.openBlock(),r.createElementBlock("div",qf,[r.createElementVNode("ul",Zf,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(u).orderTypes,ze=>{var un,Wn;return r.openBlock(),r.createElementBlock("li",{key:ze.id,class:"cart-tab","data-active":ze.id===((un=r.unref(u).selectedOrderType)==null?void 0:un.id),onClick:Zt=>r.unref(u).selectedOrderType=ze},[ze.id===((Wn=r.unref(u).selectedOrderType)==null?void 0:Wn.id)?(r.openBlock(),r.createBlock(r.unref(Ot.motion).div,{key:0,class:"cart-underline","layout-id":"cart-underline",id:"cart-underline"})):r.createCommentVNode("",!0),r.createElementVNode("span",null,r.toDisplayString(ze.name),1)],8,Yf)}),128))])])):r.createCommentVNode("",!0)]),(Dt.value||oe.value)&&a.configPage.kiosk_menu&&((An=r.unref(O))!=null&&An.length)?(r.openBlock(),r.createElementBlock("div",Kf,[r.createElementVNode("div",Qf,[r.withDirectives(r.createElementVNode("textarea",{ref_key:"commentEl",ref:j,class:"comment_order",placeholder:it.value&&it.value.placeholder||"Ваш комментарий к заказу...",name:"commentKso",maxlength:"50","aria-invalid":K.value,"onUpdate:modelValue":se[2]||(se[2]=ze=>q.value=ze)},null,8,Jf),[[r.vModelText,q.value]]),r.createElementVNode("p",eh,r.toDisplayString(q.value.length+" / 50"),1)]),Dt.value?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock(an,{key:0,textButtonDefault:"Сохранить",onClick:ot,class:"button_bonus_cart"}))])):r.createCommentVNode("",!0),(Dt.value||de.value)&&a.config_qr&&((ct=r.unref(O))!=null&&ct.length)&&!(r.unref(m).isTableService&&r.unref(m).hasOrder)?(r.openBlock(),r.createElementBlock("div",th,[r.createElementVNode("div",nh,[r.withDirectives(r.createElementVNode("textarea",{ref_key:"commentEl",ref:j,class:"comment_order",placeholder:it.value&&it.value.placeholder||"Ваш комментарий к заказу...",name:"commentQr",maxlength:"50","aria-invalid":K.value,"onUpdate:modelValue":se[3]||(se[3]=ze=>q.value=ze)},null,8,rh),[[r.vModelText,q.value]]),r.createElementVNode("p",ih,r.toDisplayString(q.value.length+" / 50"),1)]),Dt.value?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock(an,{key:0,textButtonDefault:"Сохранить",onClick:ve,class:"button_bonus_cart"}))])):r.createCommentVNode("",!0),a.config_qr&&it.value&&it.value.show&&!(r.unref(m).isTableService&&r.unref(m).hasOrder)?(r.openBlock(),r.createElementBlock("div",oh,[!Dt.value&&!de.value&&r.unref(O).length>0?(r.openBlock(),r.createBlock(an,{key:0,textButtonDefault:q.value.length>0?"Редактировать":it.value.fieldName||"",onClick:()=>de.value=!de.value,id:"button_comments"},null,8,["textButtonDefault","onClick"])):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0),r.unref(m).isTableService&&((Pe=r.unref(m).data)!=null&&Pe.number.toString())?(r.openBlock(),r.createElementBlock("div",{key:3,class:"table_order_table_wrapper",onClick:se[4]||(se[4]=ze=>r.unref(m).order&&r.unref(Q).push({name:"order-ts"}))},[r.createElementVNode("p",sh,r.toDisplayString(`Стол № ${(qt=r.unref(m).data)==null?void 0:qt.number}`),1),(Ye=r.unref(m).order)!=null&&Ye.id?(r.openBlock(),r.createElementBlock("p",ah,r.toDisplayString(`Заказ ${r.unref(m).order.plugin_order.number}`),1)):r.createCommentVNode("",!0)])):r.createCommentVNode("",!0),r.createElementVNode("div",lh,[r.unref(m).hasOrder&&((Nt=(Ct=r.unref(m).order)==null?void 0:Ct.items)!=null&&Nt.length)&&ge.value?(r.openBlock(!0),r.createElementBlock(r.Fragment,{key:0},r.renderList(r.unref(m).order.items,ze=>(r.openBlock(),r.createBlock(bo,{key:ze.idSystem,cardItem:ze},null,8,["cardItem"]))),128)):r.createCommentVNode("",!0),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(O),ze=>(r.openBlock(),r.createBlock(ua,{key:ze.idSystem,cardItem:ze,onDelete:un=>It(ze.idSystem)},null,8,["cardItem","onDelete"]))),128))]),r.createElementVNode("div",ch,[X.value&&!r.unref(H)?(r.openBlock(),r.createElementBlock("p",dh,[se[17]||(se[17]=r.createTextVNode(" Списать ",-1)),r.withDirectives(r.createElementVNode("input",{type:"number",placeholder:"0",style:r.normalizeStyle({maxWidth:`${r.unref(y).toString().length||1}em`}),disabled:r.unref(T)===null||((pt=r.unref(T))==null?void 0:pt.balance)===0,"onUpdate:modelValue":se[5]||(se[5]=ze=>r.isRef(y)?y.value=ze:null),onInput:ar,min:"0",max:r.unref(Me),step:".01",onKeypress:Ue},null,44,uh),[[r.vModelText,r.unref(y),void 0,{number:!0}]]),se[18]||(se[18]=r.createTextVNode(" бонусов ",-1))])):r.createCommentVNode("",!0),X.value&&!r.unref(H)?(r.openBlock(),r.createElementBlock("p",fh,"У вас есть "+r.toDisplayString(r.unref(T)?r.unref(T).balance:0)+" B",1)):r.createCommentVNode("",!0),X.value&&!r.unref(H)?r.withDirectives((r.openBlock(),r.createElementBlock("input",{key:2,type:"range",class:"footer_range","onUpdate:modelValue":se[6]||(se[6]=ze=>r.isRef(y)?y.value=ze:null),step:$.value?".01":"1",min:0,max:r.unref(Me)},null,8,hh)),[[r.vModelText,r.unref(y),void 0,{number:!0}]]):r.createCommentVNode("",!0),r.createElementVNode("ul",mh,[X.value&&!r.unref(H)?(r.openBlock(),r.createElementBlock("li",gh,[se[20]||(se[20]=r.createElementVNode("p",null,"Сумма заказа:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:r.unref(C),fixedFloat:2},null,8,["price"]),se[19]||(se[19]=r.createTextVNode(" ₽",-1))])])):r.createCommentVNode("",!0),X.value&&!r.unref(H)?(r.openBlock(),r.createElementBlock("li",ph,[se[22]||(se[22]=r.createElementVNode("p",null,"Будет оплачено бонусами:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:r.unref(y),fixedFloat:2},null,8,["price"]),se[21]||(se[21]=r.createTextVNode(" Б",-1))])])):r.createCommentVNode("",!0),r.unref(R)!==0?(r.openBlock(),r.createElementBlock("li",xh,[r.createElementVNode("p",wh,r.toDisplayString(r.unref(R)>0?"Надбавка":"Скидка")+": ",1),r.createElementVNode("p",_h,[r.createVNode(ft,{price:Math.abs(r.unref(R)),fixedFloat:2},null,8,["price"]),se[23]||(se[23]=r.createTextVNode(" ₽",-1))])])):ce.value!==0?(r.openBlock(),r.createElementBlock("li",Ch,[r.createElementVNode("p",Eh,r.toDisplayString(ce.value>0?"Надбавка":"Скидка")+": ",1),r.createElementVNode("p",yh,[r.createVNode(ft,{price:Math.abs(ce.value),fixedFloat:2},null,8,["price"]),se[24]||(se[24]=r.createTextVNode(" ₽",-1))])])):r.createCommentVNode("",!0),r.unref(m).isTableService&&r.unref(m).order?(r.openBlock(),r.createElementBlock("li",bh,[se[26]||(se[26]=r.createElementVNode("p",null,"Сумма заказа:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:r.unref(m).order.total_cost,fixedFloat:2},null,8,["price"]),se[25]||(se[25]=r.createTextVNode(" ₽",-1))])])):r.createCommentVNode("",!0),r.unref(m).isTableService&&r.unref(m).order?(r.openBlock(),r.createElementBlock("li",Ah,[se[28]||(se[28]=r.createElementVNode("p",null,"К счёту добавится:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:r.unref(C),fixedFloat:2},null,8,["price"]),se[27]||(se[27]=r.createTextVNode(" ₽",-1))])])):r.createCommentVNode("",!0),r.createElementVNode("li",null,[se[31]||(se[31]=r.createElementVNode("p",{class:"accept_field"},"Итого к оплате:",-1)),r.unref(m).isTableService&&r.unref(m).order?(r.openBlock(),r.createElementBlock("p",Sh,[r.createVNode(ft,{price:r.unref(m).order.total_cost+r.unref(C),fixedFloat:2},null,8,["price"]),se[29]||(se[29]=r.createTextVNode(" ₽",-1))])):(r.openBlock(),r.createElementBlock("p",Ih,[r.createVNode(ft,{price:r.unref(C)-r.unref(y),fixedFloat:2},null,8,["price"]),se[30]||(se[30]=r.createTextVNode(" ₽",-1))]))])]),ht.value&&ht.value>r.unref(x)&&!r.unref(m).hasOrder?(r.openBlock(),r.createElementBlock("div",Nh,[se[32]||(se[32]=r.createTextVNode(" Минимальная сумма заказа ",-1)),r.createVNode(ft,{price:ht.value,fixedFloat:2},null,8,["price"]),r.createTextVNode(" "+r.toDisplayString(r.unref(N).currency_symbol)+". Для оформления заказа необходимо добавить товаров на сумму ",1),r.createVNode(ft,{price:ht.value-r.unref(x),fixedFloat:2},null,8,["price"]),r.createTextVNode(" "+r.toDisplayString(r.unref(N).currency_symbol),1)])):r.createCommentVNode("",!0),r.createElementVNode("div",Th,[r.unref(T)&&!r.unref(H)&&!r.unref(m).isTableService?(r.openBlock(),r.createBlock(an,{key:0,textButtonDefault:r.unref(v).bonuses_button_name||"Бонусы",onClick:Oo,class:"button_bonus_cart"},null,8,["textButtonDefault"])):r.createCommentVNode("",!0),r.createVNode(an,{textButtonDefault:et.value,onClick:Sr,class:"button_payment_cart",disabled:me.value},null,8,["textButtonDefault","disabled"])])])]),r.unref(m).isTableService?r.createCommentVNode("",!0):(r.openBlock(),r.createBlock(cf,{key:0,orderNumber:r.unref(M),pageNumber:1},null,8,["orderNumber"])),r.createVNode(Ei,{visible:r.unref(F),"onUpdate:visible":se[7]||(se[7]=ze=>r.isRef(F)?F.value=ze:null),textNotificationDefault:r.unref(P).textNotification,backgroundColor:r.unref(v).accent_color?r.unref(v).accent_color:"#FF6D2E",buttonAccept:null},null,8,["visible","textNotificationDefault","backgroundColor"]),r.createVNode(xo,{modelValue:r.unref(Z),"onUpdate:modelValue":se[8]||(se[8]=ze=>r.isRef(Z)?Z.value=ze:null),class:"product_card_sheet","snap-points":["80%"]},{default:r.withCtx(()=>{var ze;return[r.createVNode(a1,{"config-page":a.configPage,comment:q.value,"cart-items":qr.value,"is-authorized":!!w.configPage.userData||!!r.unref(T),"order-id":De.value,signal:(ze=r.unref(o))==null?void 0:ze.signal,onSelectPayment:Ri},null,8,["config-page","comment","cart-items","is-authorized","order-id","signal"])]}),_:1},8,["modelValue"])],64)}}}),Rh={},Bh={viewBox:"0 0 24 24"};function Oh(a,l){return r.openBlock(),r.createElementBlock("svg",Bh,[...l[0]||(l[0]=[r.createElementVNode("path",{d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const Mh=Xe(Rh,[["render",Oh]]),Dh={class:"retry_screen"},vh={class:"retry_all_in_screen"},Ph={class:"retry_content"},Lh={class:"retry_icon_wrap"},Fh={class:"retry_icon_circle"},Vh={class:"retry_error_x"},Uh=r.defineComponent({__name:"RetryPage",setup(a){const l=Mt(),o=Te.useRouter(),i=Te.useRoute(),u=()=>{l.notificationData_lib.textNotification="",l.is_notification_lib=!1,o.replace(`/${i.params.orgId}/`)};return(f,m)=>(r.openBlock(),r.createElementBlock("section",Dh,[r.createElementVNode("div",vh,[r.createElementVNode("main",Ph,[r.createElementVNode("div",Lh,[r.createElementVNode("div",Fh,[m[0]||(m[0]=r.createElementVNode("div",{class:"retry_loader_mini"},null,-1)),r.createElementVNode("div",Vh,[r.createVNode(Mh)])])]),m[1]||(m[1]=r.createElementVNode("div",{class:"retry_oops"},"OOPS",-1)),m[2]||(m[2]=r.createElementVNode("h1",{class:"retry_title"},"Что-то пошло не так",-1)),m[3]||(m[3]=r.createElementVNode("div",{class:"retry_hint"},[r.createElementVNode("p",null,"Похоже, произошёл технический сбой."),r.createElementVNode("p",null,"Мы уже знаем о проблеме и сейчас разбираемся."),r.createElementVNode("p",null,"Приносим извинения за доставленные неудобства."),r.createElementVNode("p",null,"Попробуйте начать новый заказ.")],-1))]),r.createElementVNode("div",{class:"retry_footer"},[r.createElementVNode("button",{onClick:u,class:"retry_new_order_btn"},"Новый заказ")]),m[4]||(m[4]=r.createElementVNode("p",{class:"retry_bottom_note"},"Если ошибка повторяется — обратитесь к сотруднику зала.",-1))])]))}}),zh={class:"table_order_wrapper"},Hh={class:"table_order_header_content"},Gh={class:"table_order_kbju_qr_wrapper"},Wh={class:"table_order_qr_button_wrapper"},Xh={key:0,class:"table_order_header",style:{paddingRight:"10px"}},$h={class:"table_order_header_info"},jh={class:"table_order_header_info"},qh={class:"table_order_header_info"},Zh={class:"table_order_header_info"},Yh={key:0,class:"table_order_table_wrapper"},Kh={class:"table_order_desk_number"},Qh={class:"table_order_indent_number"},Jh={class:"table_order_cards"},e2={class:"table_order_footer_wrapper"},t2={key:0,class:"footer_title"},n2=["disabled","max"],r2={key:1,class:"footer_sales"},i2=["step","max"],o2={class:"list_price"},s2={key:0},a2={key:1},l2={key:2},c2={key:3},d2={class:"accept_field"},u2={key:3,class:"wrapper_footer_table_order_btn"},f2=Xe(r.defineComponent({__name:"TableOrderPage",setup(a){const l=st(),o=Gr(),i=Rt(),u=Fn(),{countBonus:f}=we.storeToRefs(l),{itemThemes:m}=we.storeToRefs(i),p=Te.useRouter(),w=Te.useRoute(),x=yn.create(),C=r.ref(!1),y=r.ref(!1),N=r.ref(!1),O=r.ref(!1),T=r.ref(!1),v=r.computed(()=>C.value||!u.hasOrder),D=r.computed(()=>{var P,L;const V={energy_amount:0,proteins_amount:0,fat_amount:0,carbohydrates_amount:0};return((L=(P=u.order)==null?void 0:P.items)==null?void 0:L.reduce((re,Q)=>(Q!=null&&Q.nutrition&&(re.energy_amount+=(Q.nutrition.energy_amount||0)*(Q.amount||0),re.proteins_amount+=(Q.nutrition.proteins_amount||0)*(Q.amount||0),re.fat_amount+=(Q.nutrition.fat_amount||0)*(Q.amount||0),re.carbohydrates_amount+=(Q.nutrition.carbohydrates_amount||0)*(Q.amount||0)),re),V))||V}),U=yt.computedAsync(async V=>{var re;const P=new AbortController;if(V(()=>P.abort()),!y.value||!((re=l.profile)!=null&&re.balance))return 0;const L=await x.maxPayByBonuses(u.order.id,!1,l.profile,P.signal);return L!=null&&L.by_bonuses?(N.value=L.non_integers_allowed||!1,Math.min(u.order.remaining_amount,l.profile.balance,L.by_bonuses)):0},0,{shallow:!0}),M=()=>{T.value=!0},R=()=>p.push(`/${w.params.orgId}/`),F=async()=>{var V,P;C.value=!0;try{const L=await lo(u.order.id,"YOOKASSA");L.url&&window.location.replace(L.url)}catch(L){throw o.showNotification(((P=(V=L==null?void 0:L.response)==null?void 0:V.data)==null?void 0:P.user_friendly_message)||"Ошибка при оплате заказа"),L}finally{C.value=!1}},H=V=>{(N.value?["a","A","+","-","."]:["a","A","+","-",".",","]).includes(V.key)&&V.preventDefault()},Z=()=>{let V=N.value?+f.value.toFixed(2):Math.floor(f.value)||0;V>U.value&&(V=U.value),V!==f.value&&l.setBonus(V)};return(V,P)=>{var L,re,Q,ee,W,X,I,$;return r.openBlock(),r.createElementBlock("div",zh,[r.createElementVNode("header",Hh,[r.createElementVNode("div",Gh,[r.createElementVNode("div",Wh,[r.createElementVNode("div",{class:"arrow_wrapper",onClick:R},[r.createVNode(_r,{class:"table_order_header_back_button"})])]),r.unref(m).show_nutrition_in_cart?(r.openBlock(),r.createElementBlock("div",Xh,[r.createElementVNode("div",$h,[r.createElementVNode("p",null,[r.createVNode(ft,{price:D.value.energy_amount,duration:800},null,8,["price"]),P[2]||(P[2]=r.createTextVNode(" г ",-1))]),P[3]||(P[3]=r.createElementVNode("p",{class:"table_order_info_name"},"Килокалории",-1))]),r.createElementVNode("div",jh,[r.createElementVNode("p",null,[r.createVNode(ft,{price:D.value.proteins_amount,duration:900},null,8,["price"]),P[4]||(P[4]=r.createTextVNode(" г ",-1))]),P[5]||(P[5]=r.createElementVNode("p",{class:"table_order_info_name"},"Белки",-1))]),r.createElementVNode("div",qh,[r.createElementVNode("p",null,[r.createVNode(ft,{price:D.value.fat_amount,duration:1e3},null,8,["price"]),P[6]||(P[6]=r.createTextVNode(" г ",-1))]),P[7]||(P[7]=r.createElementVNode("p",{class:"table_order_info_name"},"Жиры",-1))]),r.createElementVNode("div",Zh,[r.createElementVNode("p",null,[r.createVNode(ft,{price:D.value.carbohydrates_amount,duration:1100},null,8,["price"]),P[8]||(P[8]=r.createTextVNode(" г ",-1))]),P[9]||(P[9]=r.createElementVNode("p",{class:"table_order_info_name"},"Углеводы",-1))])])):r.createCommentVNode("",!0)])]),(L=r.unref(u).order)!=null&&L.id?(r.openBlock(),r.createElementBlock("div",Yh,[r.createElementVNode("p",Kh,r.toDisplayString(`Стол № ${(re=r.unref(u).data)==null?void 0:re.number}`),1),r.createElementVNode("p",Qh,r.toDisplayString(`Заказ ${r.unref(u).order.plugin_order.number}`),1)])):r.createCommentVNode("",!0),r.createElementVNode("div",Jh,[(ee=(Q=r.unref(u).order)==null?void 0:Q.items)!=null&&ee.length?(r.openBlock(!0),r.createElementBlock(r.Fragment,{key:0},r.renderList(r.unref(u).order.items,j=>(r.openBlock(),r.createBlock(bo,{key:j.idSystem,cardItem:j},null,8,["cardItem"]))),128)):r.createCommentVNode("",!0)]),r.createElementVNode("div",e2,[y.value?(r.openBlock(),r.createElementBlock("p",t2,[P[10]||(P[10]=r.createTextVNode(" Списать ",-1)),r.withDirectives(r.createElementVNode("input",{type:"number",placeholder:"0",style:r.normalizeStyle({maxWidth:`${r.unref(f).toString().length||1}em`}),disabled:r.unref(l).profile===null||((W=r.unref(l).profile)==null?void 0:W.balance)===0,"onUpdate:modelValue":P[0]||(P[0]=j=>r.isRef(f)?f.value=j:null),onInput:Z,min:"0",max:r.unref(U),step:".01",onKeypress:H},null,44,n2),[[r.vModelText,r.unref(f),void 0,{number:!0}]]),P[11]||(P[11]=r.createTextVNode(" бонусов ",-1))])):r.createCommentVNode("",!0),y.value?(r.openBlock(),r.createElementBlock("p",r2," У вас есть "+r.toDisplayString(r.unref(l).profile.balance??0)+" B ",1)):r.createCommentVNode("",!0),y.value?r.withDirectives((r.openBlock(),r.createElementBlock("input",{key:2,type:"range",class:"footer_range","onUpdate:modelValue":P[1]||(P[1]=j=>r.isRef(f)?f.value=j:null),step:N.value?".01":"1",min:0,max:r.unref(U)},null,8,i2)),[[r.vModelText,r.unref(f),void 0,{number:!0}]]):r.createCommentVNode("",!0),r.createElementVNode("ul",o2,[r.unref(u).order&&r.unref(u).order.total_cost-r.unref(u).order.remaining_amount>0?(r.openBlock(),r.createElementBlock("li",s2,[P[13]||(P[13]=r.createElementVNode("p",null,"Сумма заказа:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:(X=r.unref(u).order)==null?void 0:X.total_cost,fixedFloat:2},null,8,["price"]),P[12]||(P[12]=r.createTextVNode(" ₽ ",-1))])])):r.createCommentVNode("",!0),r.unref(u).order&&r.unref(u).order.total_cost-r.unref(u).order.remaining_amount>0?(r.openBlock(),r.createElementBlock("li",a2,[P[15]||(P[15]=r.createElementVNode("p",null,"Оплачено:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:r.unref(u).order.total_cost-r.unref(u).order.remaining_amount,fixedFloat:2},null,8,["price"]),P[14]||(P[14]=r.createTextVNode(" ₽ ",-1))])])):r.createCommentVNode("",!0),y.value?(r.openBlock(),r.createElementBlock("li",l2,[P[17]||(P[17]=r.createElementVNode("p",null,"Будет оплачено бонусами:",-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:r.unref(f),fixedFloat:2},null,8,["price"]),P[16]||(P[16]=r.createTextVNode(" Б ",-1))])])):r.createCommentVNode("",!0),(I=r.unref(u).order)!=null&&I.remaining_amount?(r.openBlock(),r.createElementBlock("li",c2,[P[19]||(P[19]=r.createElementVNode("p",{class:"accept_field"},"Итого к оплате:",-1)),r.createElementVNode("p",d2,[r.createVNode(ft,{price:r.unref(u).order.remaining_amount-r.unref(f),fixedFloat:2},null,8,["price"]),P[18]||(P[18]=r.createTextVNode(" ₽ ",-1))])])):r.createCommentVNode("",!0)]),($=r.unref(u).order)!=null&&$.remaining_amount&&r.unref(i).itemThemes.qr_show_pay_button_ts!==!1?(r.openBlock(),r.createElementBlock("div",u2,[r.createVNode(an,{textButtonDefault:O.value?"Запросить счёт":"Оплатить заказ",onClick:O.value?M:F,class:"button_payment_cart",disabled:v.value},null,8,["textButtonDefault","onClick","disabled"])])):r.createCommentVNode("",!0)])])}}}),[["__scopeId","data-v-75fa9255"]]),h2={class:"wrapper_loader"},m2=r.defineComponent({__name:"Loader",props:{size:{type:String,default:"40px"}},setup(a){return(l,o)=>(r.openBlock(),r.createElementBlock("div",h2,[r.createElementVNode("div",{class:"loader",style:r.normalizeStyle({width:a.size})},null,4)]))}}),g2=Xe(r.defineComponent({__name:"AnimationLoader",props:{id:{}},setup(a){const l=r.ref(!0);return r.watch(()=>l.value,()=>{l.value=!1,setTimeout(()=>{l.value=!0},0)}),(o,i)=>(r.openBlock(),r.createElementBlock("div",{class:"opacity-animation",key:a.id},[r.renderSlot(o.$slots,"opacityLoader",{},void 0,!0)]))}}),[["__scopeId","data-v-c6b97942"]]),p2={key:0},x2={class:"card__main__wrapper"},w2={key:0,class:"folder_content_top"},_2={key:0,class:"loader_card_main"},C2=["src","alt"],E2={class:"card_title_price_wrapper"},y2={class:"title"},b2={key:0,class:"price"},A2={key:1},S2={key:0,class:"card_button_add_wrapper"},xa=Xe(r.defineComponent({__name:"CardMain",props:{data:{},activeTags:{},is_group:{type:Boolean},parent:{},isLoading:{type:Boolean},selectGroupChild:{type:Function},takeCurrentCard:{type:Function}},setup(a){Rt();const l=st(),o=Lt(),{is_18_above_content:i,is18Allowed:u,notificationData_lib:f}=we.storeToRefs(l),{isDesktop:m}=Un(),p=a,w=(N,O)=>{var D,U,M;const T={id:N.id,is_fake:N.is_fake||!1,is_od_united_product:N.is_od_united_product||!1,amount:N.amount||1,name:N.name,image_link:N.image_link,price:N.price,old_price:N.price,size:void 0,sizes:[],modifiers:[],groups:N.groups,group_modifiers:[],energy_amount:N.energy_amount??0,proteins_amount:N.proteins_amount??0,fat_amount:N.fat_amount??0,carbohydrates_amount:N.carbohydrates_amount??0},v=!((D=N.modifiers)!=null&&D.length)&&!((U=N.group_modifiers)!=null&&U.length)&&!((M=N.sizes)!=null&&M.length);if(o.isUpSale=!1,N.adult&&!u.value){i.value=!0,v&&(f.value.fastAdd=T);return}if(v){l.addToCart(T);return}if(N.amount||(N.amount=1),p.is_group&&p.selectGroupChild){p.selectGroupChild({...N,parent:p.parent,child:O.child_groups});return}p.takeCurrentCard&&p.takeCurrentCard(O.id)},x=N=>{if(p.is_group&&p.selectGroupChild){N={...N,parent:p.parent,child:N.child_groups},p.selectGroupChild(N);return}if(N.adult&&!u.value){i.value=!0;return}p.takeCurrentCard&&p.takeCurrentCard(N.id)},C=r.computed(()=>p.activeTags.every(N=>p.data.tags.includes(N))),{mediaUrl:y}=Tn(()=>p.data.id+"_image",()=>p.data.image_link);return(N,O)=>{var T;return((T=p.activeTags)==null?void 0:T.length)===0||C.value||p.is_group?(r.openBlock(),r.createElementBlock("div",p2,[r.createVNode(g2,{id:p.data.id},{opacityLoader:r.withCtx(()=>[r.createElementVNode("div",x2,[a.is_group?(r.openBlock(),r.createElementBlock("div",w2)):r.createCommentVNode("",!0),r.createElementVNode("div",{onClick:O[0]||(O[0]=v=>x(p.data)),class:r.normalizeClass(["card__main",{card__main_folder:a.is_group}])},[a.isLoading?(r.openBlock(),r.createElementBlock("div",_2,[r.createVNode(m2)])):(r.openBlock(),r.createElementBlock("div",{key:1,class:r.normalizeClass(["card__main_content",{card_main_desktop_qr:r.unref(m)}])},[r.createElementVNode("img",{src:r.unref(y)||"",class:r.normalizeClass(["img",{card_blur_image:p.data.adult&&!r.unref(u)}]),loading:"lazy",alt:a.data.name},null,10,C2),r.createElementVNode("div",E2,[r.createElementVNode("p",y2,r.toDisplayString(a.data.name),1),a.is_group?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("p",b2,r.toDisplayString(r.unref(hr)(a.data))+" ₽",1))])],2))],2),r.unref(m)?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("div",A2,[a.is_group?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("div",S2,[r.createElementVNode("div",{onClick:O[1]||(O[1]=v=>w(a.data,p.data)),class:"add_button"},[...O[2]||(O[2]=[r.createElementVNode("div",{class:"image_add_button"},null,-1)])])]))]))])]),_:1},8,["id"])])):r.createCommentVNode("",!0)}}}),[["__scopeId","data-v-bfc53e47"]]),I2=["id","onClick"],N2=Xe(r.defineComponent({__name:"GroupMain",props:{menuGroup:{},idActiveGroup:{},activeTakeGroup:{type:Function}},setup(a){const{shouldUseDragScroll:l}=Un(),o=r.ref(null);return(i,u)=>a.menuGroup.length?r.withDirectives((r.openBlock(),r.createElementBlock("ul",{key:0,class:"main__menu",ref_key:"scrollGroup",ref:o},[r.createVNode(ho,{axis:"x",behavior:"smooth",container:o.value,autoScroll:!0,idActive:a.idActiveGroup,clearContainer:!0},{default:r.withCtx(({handleTargetClick:f})=>[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(a.menuGroup,(m,p)=>(r.openBlock(),r.createElementBlock("li",{key:m.id,id:"scrolling"+m.id,onClick:w=>{a.activeTakeGroup&&a.activeTakeGroup(m.id,p),f(w)},style:r.normalizeStyle(a.idActiveGroup==m.id?{fontFamily:"Bounded"}:{})},r.toDisplayString(m.name),13,I2))),128))]),_:1},8,["container","idActive"])])),[[r.unref(Wr),r.unref(l)?{}:!1]]):r.createCommentVNode("",!0)}}),[["__scopeId","data-v-aa0ca388"]]),T2=["id","onClick"],k2=Xe(r.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(a){const l=a,{shouldUseDragScroll:o}=Un(),i=r.ref(null),u=r.computed(()=>{if(l.isSolo&&!l.groupIndex)return Array.isArray(l.currentActiveTag)?l.currentActiveTag:[];if(l.groupIndex!==null&&l.groupIndex!==void 0){const f=l.currentActiveTag[l.groupIndex];return Array.isArray(f)?f:[]}return[]});return(f,m)=>a.menuTags.length>0?r.withDirectives((r.openBlock(),r.createElementBlock("ul",{key:0,class:"main__filters",ref_key:"scrollTagContainer",ref:i},[r.createVNode(ho,{axis:"x",behavior:"smooth",container:i.value,autoScroll:!0,idActive:u.value?u.value[a.currentActiveTag.length-1]:null,clearContainer:!1},{default:r.withCtx(({handleTargetClick:p})=>[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(a.menuTags,(w,x)=>(r.openBlock(),r.createElementBlock("li",{key:x,id:`scrolling${w}`,onClick:C=>{a.activeTakeTags&&(a.groupIndex||a.groupIndex===0)?a.activeTakeTags(w,a.groupIndex):a.activeTakeTagsSolo&&a.activeTakeTagsSolo(w),p(C)},class:r.normalizeClass({main__filter_active:(u.value??[]).includes(w)})},r.toDisplayString(w),11,T2))),128))]),_:1},8,["container","idActive"])])),[[r.unref(Wr),r.unref(o)?{}:!1]]):r.createCommentVNode("",!0)}}),[["__scopeId","data-v-afba730a"]]),R2=["data-id"],B2=["src"],O2=["src"],M2=Xe(r.defineComponent({__name:"DrumItem",props:{group:{},index:{},active:{type:Boolean}},setup(a){const l=a,{mediaUrl:o}=Tn(()=>{var i,u;return(i=l.group)!=null&&i.video_link?`${l.group.id}_video`:(u=l.group)!=null&&u.image_link?`${l.group.id}_image`:null});return(i,u)=>a.group?(r.openBlock(),r.createElementBlock("div",{key:0,class:r.normalizeClass(["drum_item",{active:l.active}]),"data-id":a.group.id},[a.group.video_link?r.withDirectives((r.openBlock(),r.createElementBlock("video",{key:r.unref(o),loop:"",autoplay:"",muted:"",playsinline:"",class:"drum_img"},[r.createElementVNode("source",{src:r.unref(o)||"",type:"video/webm"},null,8,B2)])),[[r.unref(Xr)]]):(r.openBlock(),r.createElementBlock("img",{key:1,class:"drum_img",src:r.unref(o)||""},null,8,O2)),r.createElementVNode("p",null,r.toDisplayString(a.group.name),1)],10,R2)):r.createCommentVNode("",!0)}}),[["__scopeId","data-v-2b994529"]]),D2={},v2={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 P2(a,l){return r.openBlock(),r.createElementBlock("svg",v2,[...l[0]||(l[0]=[r.createElementVNode("desc",null," Created with Pixso. ",-1),r.createElementVNode("defs",null,null,-1),r.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 L2=Xe(D2,[["render",P2]]),F2={class:"recommendation_wrapper"},V2={class:"recommendation_header"},U2={class:"recommendation_info"},z2=Xe(r.defineComponent({__name:"Recommendation",props:{closeCurrentCard:{},openCurrentCard:{}},setup(a){const l=Lt(),{isUpSale:o,dataUpSale:i}=we.storeToRefs(l),u=()=>{o.value=!1};return r.onUnmounted(()=>{i.value=null}),(f,m)=>(r.openBlock(),r.createElementBlock("div",F2,[r.createElementVNode("div",V2,[m[0]||(m[0]=r.createElementVNode("p",{class:"header_title"},"Часто берут вместе",-1)),r.createElementVNode("div",{class:"header_close",onClick:u},[r.createVNode(L2,{class:"close_icon"})])]),r.createElementVNode("div",U2,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(r.unref(i),p=>(r.openBlock(),r.createBlock(xa,{data:p,key:p.id,parent:p.id,is_group:!1,is_product:!0,class:"card",activeTags:[],isLoading:!1,closeCurrentCard:a.closeCurrentCard,takeCurrentCard:()=>a.openCurrentCard(p.id,!0)},null,8,["data","parent","closeCurrentCard","takeCurrentCard"]))),128))])]))}}),[["__scopeId","data-v-d545ec45"]]),H2=r.defineComponent({__name:"Blackout",props:{data:{type:Boolean}},setup(a){const l=a;return r.watch(()=>l.data,o=>{document.body.style.overflow=o?"hidden":""}),()=>{}}}),G2={class:"wrapper_modal"},W2={class:"card_modal"},X2=Xe(r.defineComponent({__name:"ModalWindows",props:{visible:{type:Boolean}},setup(a){const l=a,o=Lt(),{isUpSale:i}=we.storeToRefs(o),u=()=>{i.value=!1};return(f,m)=>(r.openBlock(),r.createElementBlock(r.Fragment,null,[r.createVNode(H2,{data:l.visible},null,8,["data"]),r.createElementVNode("div",{class:"black_modal",onClick:u}),r.createElementVNode("div",G2,[r.createElementVNode("div",W2,[r.renderSlot(f.$slots,"default",{},void 0,!0)])])],64))}}),[["__scopeId","data-v-ec2b2c4d"]]);var _e;(function(a){a[a.QR_CODE=0]="QR_CODE",a[a.AZTEC=1]="AZTEC",a[a.CODABAR=2]="CODABAR",a[a.CODE_39=3]="CODE_39",a[a.CODE_93=4]="CODE_93",a[a.CODE_128=5]="CODE_128",a[a.DATA_MATRIX=6]="DATA_MATRIX",a[a.MAXICODE=7]="MAXICODE",a[a.ITF=8]="ITF",a[a.EAN_13=9]="EAN_13",a[a.EAN_8=10]="EAN_8",a[a.PDF_417=11]="PDF_417",a[a.RSS_14=12]="RSS_14",a[a.RSS_EXPANDED=13]="RSS_EXPANDED",a[a.UPC_A=14]="UPC_A",a[a.UPC_E=15]="UPC_E",a[a.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(_e||(_e={}));var wa=new Map([[_e.QR_CODE,"QR_CODE"],[_e.AZTEC,"AZTEC"],[_e.CODABAR,"CODABAR"],[_e.CODE_39,"CODE_39"],[_e.CODE_93,"CODE_93"],[_e.CODE_128,"CODE_128"],[_e.DATA_MATRIX,"DATA_MATRIX"],[_e.MAXICODE,"MAXICODE"],[_e.ITF,"ITF"],[_e.EAN_13,"EAN_13"],[_e.EAN_8,"EAN_8"],[_e.PDF_417,"PDF_417"],[_e.RSS_14,"RSS_14"],[_e.RSS_EXPANDED,"RSS_EXPANDED"],[_e.UPC_A,"UPC_A"],[_e.UPC_E,"UPC_E"],[_e.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]),_a;(function(a){a[a.UNKNOWN=0]="UNKNOWN",a[a.URL=1]="URL"})(_a||(_a={}));function $2(a){return Object.values(_e).includes(a)}var Ai;(function(a){a[a.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",a[a.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"})(Ai||(Ai={}));var j2=function(){function a(){}return a.GITHUB_PROJECT_URL="https://github.com/mebjas/html5-qrcode",a.SCAN_DEFAULT_FPS=2,a.DEFAULT_DISABLE_FLIP=!1,a.DEFAULT_REMEMBER_LAST_CAMERA_USED=!0,a.DEFAULT_SUPPORTED_SCAN_TYPE=[Ai.SCAN_TYPE_CAMERA,Ai.SCAN_TYPE_FILE],a}(),Ca=function(){function a(l,o){this.format=l,this.formatName=o}return a.prototype.toString=function(){return this.formatName},a.create=function(l){if(!wa.has(l))throw"".concat(l," not in html5QrcodeSupportedFormatsTextMap");return new a(l,wa.get(l))},a}(),Ea=function(){function a(){}return a.createFromText=function(l){var o={text:l};return{decodedText:l,result:o}},a.createFromQrcodeResult=function(l){return{decodedText:l.text,result:l}},a}(),Ao;(function(a){a[a.UNKWOWN_ERROR=0]="UNKWOWN_ERROR",a[a.IMPLEMENTATION_ERROR=1]="IMPLEMENTATION_ERROR",a[a.NO_CODE_FOUND_ERROR=2]="NO_CODE_FOUND_ERROR"})(Ao||(Ao={}));var q2=function(){function a(){}return a.createFrom=function(l){return{errorMessage:l,type:Ao.UNKWOWN_ERROR}},a}(),Z2=function(){function a(l){this.verbose=l}return a.prototype.log=function(l){this.verbose&&console.log(l)},a.prototype.warn=function(l){this.verbose&&console.warn(l)},a.prototype.logError=function(l,o){(this.verbose||o===!0)&&console.error(l)},a.prototype.logErrors=function(l){if(l.length===0)throw"Logger#logError called without arguments";this.verbose&&console.error(l)},a}();function zn(a){return typeof a>"u"||a===null}var Er=function(){function a(){}return a.codeParseError=function(l){return"QR code parse error, error = ".concat(l)},a.errorGettingUserMedia=function(l){return"Error getting userMedia, error = ".concat(l)},a.onlyDeviceSupportedError=function(){return"The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."},a.cameraStreamingNotSupported=function(){return"Camera streaming not supported by the browser."},a.unableToQuerySupportedDevices=function(){return"Unable to query supported devices, unknown error."},a.insecureContextCameraQueryError=function(){return"Camera access is only supported in secure context like https or localhost."},a.scannerPaused=function(){return"Scanner paused"},a}(),ya=function(){function a(){}return a.isMediaStreamConstraintsValid=function(l,o){if(typeof l!="object"){var i=typeof l;return o.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(i,"."),!0),!1}for(var u=["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"],f=new Set(u),m=Object.keys(l),p=0,w=m;p<w.length;p++){var x=w[p];if(f.has(x))return o.logError("".concat(x," is not supported videoConstaints."),!0),!1}return!0},a}(),So={exports:{}};(function(a,l){(function(o,i){i(l)})(wr,function(o){function i(b){return b==null}var u=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 f(b,e){u(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 p(b,e){e===void 0&&(e=b.constructor);var t=Error.captureStackTrace;t&&t(b,e)}var w=function(b){f(e,b);function e(t){var n=this.constructor,s=b.call(this,t)||this;return Object.defineProperty(s,"name",{value:n.name,enumerable:!1}),m(s,n.prototype),p(s),s}return e}(Error);class x extends w{constructor(e=void 0){super(e),this.message=e}getKind(){return this.constructor.kind}}x.kind="Exception";class C extends x{}C.kind="ArgumentException";class y extends x{}y.kind="IllegalArgumentException";class N{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,s){const c=this.binarizer.getLuminanceSource().crop(e,t,n,s);return new N(this.binarizer.createBinarizer(c))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new N(this.binarizer.createBinarizer(e))}rotateCounterClockwise45(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new N(this.binarizer.createBinarizer(e))}toString(){try{return this.getBlackMatrix().toString()}catch{return""}}}class O extends x{static getChecksumInstance(){return new O}}O.kind="ChecksumException";class T{constructor(e){this.source=e}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class v{static arraycopy(e,t,n,s,c){for(;c--;)n[s++]=e[t++]}static currentTimeMillis(){return Date.now()}}class D extends x{}D.kind="IndexOutOfBoundsException";class U extends D{constructor(e=void 0,t=void 0){super(t),this.index=e,this.message=t}}U.kind="ArrayIndexOutOfBoundsException";class M{static fill(e,t){for(let n=0,s=e.length;n<s;n++)e[n]=t}static fillWithin(e,t,n,s){M.rangeCheck(e.length,t,n);for(let c=t;c<n;c++)e[c]=s}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(c=>Array.from({length:t}).fill(n))}static createInt32Array(e,t,n){return Array.from({length:e}).map(c=>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,s=e.length;n<s;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 s=n-t,c=new Int32Array(s);return v.arraycopy(e,t,c,0,s),c}static binarySearch(e,t,n){n===void 0&&(n=M.numberComparator);let s=0,c=e.length-1;for(;s<=c;){const d=c+s>>1,h=n(t,e[d]);if(h>0)s=d+1;else if(h<0)c=d-1;else return d}return-s-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 F{constructor(e,t){e===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=e,t==null?this.bits=F.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=F.makeArray(e);v.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 s=Math.floor(e/32),c=n[s];c&=~((1<<(e&31))-1);const d=n.length;for(;c===0;){if(++s===d)return t;c=n[s]}const h=s*32+R.numberOfTrailingZeros(c);return h>t?t:h}getNextUnset(e){const t=this.size;if(e>=t)return t;const n=this.bits;let s=Math.floor(e/32),c=~n[s];c&=~((1<<(e&31))-1);const d=n.length;for(;c===0;){if(++s===d)return t;c=~n[s]}const h=s*32+R.numberOfTrailingZeros(c);return h>t?t:h}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),s=Math.floor(t/32),c=this.bits;for(let d=n;d<=s;d++){const h=d>n?0:e&31,_=(2<<(d<s?31:t&31))-(1<<h);c[d]|=_}}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 s=Math.floor(e/32),c=Math.floor(t/32),d=this.bits;for(let h=s;h<=c;h++){const g=h>s?0:e&31,E=(2<<(h<c?31:t&31))-(1<<g)&4294967295;if((d[h]&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,s=t.length;n<s;n++)t[n]^=e.bits[n]}toBytes(e,t,n,s){for(let c=0;c<s;c++){let d=0;for(let h=0;h<8;h++)this.get(e)&&(d|=1<<7-h),e++;t[n+c]=d}}getBitArray(){return this.bits}reverse(){const e=new Int32Array(this.bits.length),t=Math.floor((this.size-1)/32),n=t+1,s=this.bits;for(let c=0;c<n;c++){let d=s[c];d=d>>1&1431655765|(d&1431655765)<<1,d=d>>2&858993459|(d&858993459)<<2,d=d>>4&252645135|(d&252645135)<<4,d=d>>8&16711935|(d&16711935)<<8,d=d>>16&65535|(d&65535)<<16,e[t-c]=d}if(this.size!==n*32){const c=n*32-this.size;let d=e[0]>>>c;for(let h=1;h<n;h++){const g=e[h];d|=g<<32-c,e[h-1]=d,d=g>>>c}e[n-1]=d}this.bits=e}static makeArray(e){return new Int32Array(Math.floor((e+31)/32))}equals(e){if(!(e instanceof F))return!1;const t=e;return this.size===t.size&&M.equals(this.bits,t.bits)}hashCode(){return 31*this.size+M.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 F(this.size,this.bits.slice())}}var H;(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"})(H||(H={}));var Z=H;class V extends x{static getFormatInstance(){return new V}}V.kind="FormatException";var P;(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"})(P||(P={}));class L{constructor(e,t,n,...s){this.valueIdentifier=e,this.name=n,typeof t=="number"?this.values=Int32Array.from([t]):this.values=t,this.otherEncodingNames=s,L.VALUE_IDENTIFIER_TO_ECI.set(e,this),L.NAME_TO_ECI.set(n,this);const c=this.values;for(let d=0,h=c.length;d!==h;d++){const g=c[d];L.VALUES_TO_ECI.set(g,this)}for(const d of s)L.NAME_TO_ECI.set(d,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(e){if(e<0||e>=900)throw new V("incorect value");const t=L.VALUES_TO_ECI.get(e);if(t===void 0)throw new V("incorect value");return t}static getCharacterSetECIByName(e){const t=L.NAME_TO_ECI.get(e);if(t===void 0)throw new V("incorect value");return t}equals(e){if(!(e instanceof L))return!1;const t=e;return this.getName()===t.getName()}}L.VALUE_IDENTIFIER_TO_ECI=new Map,L.VALUES_TO_ECI=new Map,L.NAME_TO_ECI=new Map,L.Cp437=new L(P.Cp437,Int32Array.from([0,2]),"Cp437"),L.ISO8859_1=new L(P.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),L.ISO8859_2=new L(P.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),L.ISO8859_3=new L(P.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),L.ISO8859_4=new L(P.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),L.ISO8859_5=new L(P.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),L.ISO8859_6=new L(P.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),L.ISO8859_7=new L(P.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),L.ISO8859_8=new L(P.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),L.ISO8859_9=new L(P.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),L.ISO8859_10=new L(P.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),L.ISO8859_11=new L(P.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),L.ISO8859_13=new L(P.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),L.ISO8859_14=new L(P.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),L.ISO8859_15=new L(P.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),L.ISO8859_16=new L(P.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),L.SJIS=new L(P.SJIS,20,"SJIS","Shift_JIS"),L.Cp1250=new L(P.Cp1250,21,"Cp1250","windows-1250"),L.Cp1251=new L(P.Cp1251,22,"Cp1251","windows-1251"),L.Cp1252=new L(P.Cp1252,23,"Cp1252","windows-1252"),L.Cp1256=new L(P.Cp1256,24,"Cp1256","windows-1256"),L.UnicodeBigUnmarked=new L(P.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),L.UTF8=new L(P.UTF8,26,"UTF8","UTF-8"),L.ASCII=new L(P.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),L.Big5=new L(P.Big5,28,"Big5"),L.GB18030=new L(P.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),L.EUC_KR=new L(P.EUC_KR,30,"EUC_KR","EUC-KR");class re extends x{}re.kind="UnsupportedOperationException";class Q{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!Q.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 L?e:L.getCharacterSetECIByName(e)}static decodeFallback(e,t){const n=this.encodingCharacterSet(t);if(Q.isDecodeFallbackSupported(n)){let s="";for(let c=0,d=e.length;c<d;c++){let h=e[c].toString(16);h.length<2&&(h="0"+h),s+="%"+h}return decodeURIComponent(s)}if(n.equals(L.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(e.buffer));throw new re(`Encoding ${this.encodingName(t)} not supported by fallback.`)}static isDecodeFallbackSupported(e){return e.equals(L.UTF8)||e.equals(L.ISO8859_1)||e.equals(L.ASCII)}static encodeFallback(e){const n=btoa(unescape(encodeURIComponent(e))).split(""),s=[];for(let c=0;c<n.length;c++)s.push(n[c].charCodeAt(0));return new Uint8Array(s)}}class ee{static castAsNonUtf8Char(e,t=null){const n=t?t.getName():this.ISO88591;return Q.decode(new Uint8Array([e]),n)}static guessEncoding(e,t){if(t!=null&&t.get(Z.CHARACTER_SET)!==void 0)return t.get(Z.CHARACTER_SET).toString();const n=e.length;let s=!0,c=!0,d=!0,h=0,g=0,_=0,E=0,A=0,S=0,B=0,z=0,G=0,Y=0,ie=0;const ue=e.length>3&&e[0]===239&&e[1]===187&&e[2]===191;for(let fe=0;fe<n&&(s||c||d);fe++){const le=e[fe]&255;d&&(h>0?le&128?h--:d=!1:le&128&&(le&64?(h++,le&32?(h++,le&16?(h++,le&8?d=!1:E++):_++):g++):d=!1)),s&&(le>127&&le<160?s=!1:le>159&&(le<192||le===215||le===247)&&ie++),c&&(A>0?le<64||le===127||le>252?c=!1:A--:le===128||le===160||le>239?c=!1:le>160&&le<224?(S++,z=0,B++,B>G&&(G=B)):le>127?(A++,B=0,z++,z>Y&&(Y=z)):(B=0,z=0))}return d&&h>0&&(d=!1),c&&A>0&&(c=!1),d&&(ue||g+_+E>0)?ee.UTF8:c&&(ee.ASSUME_SHIFT_JIS||G>=3||Y>=3)?ee.SHIFT_JIS:s&&c?G===2&&S===2||ie*10>=n?ee.SHIFT_JIS:ee.ISO88591:s?ee.ISO88591:c?ee.SHIFT_JIS:d?ee.UTF8:ee.PLATFORM_DEFAULT_ENCODING}static format(e,...t){let n=-1;function s(d,h,g,_,E,A){if(d==="%%")return"%";if(t[++n]===void 0)return;d=_?parseInt(_.substr(1)):void 0;let S=E?parseInt(E.substr(1)):void 0,B;switch(A){case"s":B=t[n];break;case"c":B=t[n][0];break;case"f":B=parseFloat(t[n]).toFixed(d);break;case"p":B=parseFloat(t[n]).toPrecision(d);break;case"e":B=parseFloat(t[n]).toExponential(d);break;case"x":B=parseInt(t[n]).toString(S||16);break;case"d":B=parseFloat(parseInt(t[n],S||10).toPrecision(d)).toFixed(0);break}B=typeof B=="object"?JSON.stringify(B):(+B).toString(S);let z=parseInt(g),G=g&&g[0]+""=="0"?"0":" ";for(;B.length<z;)B=h!==void 0?B+G:G+B;return B}let c=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(c,s)}static getBytes(e,t){return Q.encode(e,t)}static getCharCode(e,t=0){return e.charCodeAt(t)}static getCharAt(e){return String.fromCharCode(e)}}ee.SHIFT_JIS=L.SJIS.getName(),ee.GB2312="GB2312",ee.ISO88591=L.ISO8859_1.getName(),ee.EUC_JP="EUC_JP",ee.UTF8=L.UTF8.getName(),ee.PLATFORM_DEFAULT_ENCODING=ee.UTF8,ee.ASSUME_SHIFT_JIS=!1;class W{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+=ee.castAsNonUtf8Char(e,this.encoding):this.value+=String.fromCharCode(e),this}appendChars(e,t,n){for(let s=t;t<t+n;s++)this.append(e[s]);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,s){if(this.width=e,this.height=t,this.rowSize=n,this.bits=s,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,s==null&&(this.bits=new Int32Array(this.rowSize*this.height))}static parseFromBooleanArray(e){const t=e.length,n=e[0].length,s=new X(n,t);for(let c=0;c<t;c++){const d=e[c];for(let h=0;h<n;h++)d[h]&&s.set(h,c)}return s}static parseFromString(e,t,n){if(e===null)throw new y("stringRepresentation cannot be null");const s=new Array(e.length);let c=0,d=0,h=-1,g=0,_=0;for(;_<e.length;)if(e.charAt(_)===`
12
+ `||e.charAt(_)==="\r"){if(c>d){if(h===-1)h=c-d;else if(c-d!==h)throw new y("row lengths do not match");d=c,g++}_++}else if(e.substring(_,_+t.length)===t)_+=t.length,s[c]=!0,c++;else if(e.substring(_,_+n.length)===n)_+=n.length,s[c]=!1,c++;else throw new y("illegal character encountered: "+e.substring(_));if(c>d){if(h===-1)h=c-d;else if(c-d!==h)throw new y("row lengths do not match");g++}const E=new X(h,g);for(let A=0;A<c;A++)s[A]&&E.set(Math.floor(A%h),Math.floor(A/h));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 F(Math.floor(this.width/32)+1),n=this.rowSize,s=this.bits;for(let c=0,d=this.height;c<d;c++){const h=c*n,g=e.getRow(c,t).getBitArray();for(let _=0;_<n;_++)s[h+_]^=g[_]}}clear(){const e=this.bits,t=e.length;for(let n=0;n<t;n++)e[n]=0}setRegion(e,t,n,s){if(t<0||e<0)throw new y("Left and top must be nonnegative");if(s<1||n<1)throw new y("Height and width must be at least 1");const c=e+n,d=t+s;if(d>this.height||c>this.width)throw new y("The region must fit inside the matrix");const h=this.rowSize,g=this.bits;for(let _=t;_<d;_++){const E=_*h;for(let A=e;A<c;A++)g[E+Math.floor(A/32)]|=1<<(A&31)&4294967295}}getRow(e,t){t==null||t.getSize()<this.width?t=new F(this.width):t.clear();const n=this.rowSize,s=this.bits,c=e*n;for(let d=0;d<n;d++)t.setBulk(d*32,s[c+d]);return t}setRow(e,t){v.arraycopy(t.getBitArray(),0,this.bits,e*this.rowSize,this.rowSize)}rotate180(){const e=this.getWidth(),t=this.getHeight();let n=new F(e),s=new F(e);for(let c=0,d=Math.floor((t+1)/2);c<d;c++)n=this.getRow(c,n),s=this.getRow(t-1-c,s),n.reverse(),s.reverse(),this.setRow(c,s),this.setRow(t-1-c,n)}getEnclosingRectangle(){const e=this.width,t=this.height,n=this.rowSize,s=this.bits;let c=e,d=t,h=-1,g=-1;for(let _=0;_<t;_++)for(let E=0;E<n;E++){const A=s[_*n+E];if(A!==0){if(_<d&&(d=_),_>g&&(g=_),E*32<c){let S=0;for(;!(A<<31-S&4294967295);)S++;E*32+S<c&&(c=E*32+S)}if(E*32+31>h){let S=31;for(;!(A>>>S);)S--;E*32+S>h&&(h=E*32+S)}}}return h<c||g<d?null:Int32Array.from([c,d,h-c+1,g-d+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 s=n/e;let c=n%e*32;const d=t[n];let h=0;for(;!(d<<31-h&4294967295);)h++;return c+=h,Int32Array.from([c,s])}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 s=Math.floor(n/e);let c=Math.floor(n%e)*32;const d=t[n];let h=31;for(;!(d>>>h);)h--;return c+=h,Int32Array.from([c,s])}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&&M.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+M.hashCode(this.bits),e}toString(e="X ",t=" ",n=`
13
+ `){return this.buildToString(e,t,n)}buildToString(e,t,n){let s=new W;for(let c=0,d=this.height;c<d;c++){for(let h=0,g=this.width;h<g;h++)s.append(this.get(h,c)?e:t);s.append(n)}return s.toString()}clone(){return new X(this.width,this.height,this.rowSize,this.bits.slice())}}class I extends x{static getNotFoundInstance(){return new I}}I.kind="NotFoundException";class $ extends T{constructor(e){super(e),this.luminances=$.EMPTY,this.buckets=new Int32Array($.LUMINANCE_BUCKETS)}getBlackRow(e,t){const n=this.getLuminanceSource(),s=n.getWidth();t==null||t.getSize()<s?t=new F(s):t.clear(),this.initArrays(s);const c=n.getRow(e,this.luminances),d=this.buckets;for(let g=0;g<s;g++)d[(c[g]&255)>>$.LUMINANCE_SHIFT]++;const h=$.estimateBlackPoint(d);if(s<3)for(let g=0;g<s;g++)(c[g]&255)<h&&t.set(g);else{let g=c[0]&255,_=c[1]&255;for(let E=1;E<s-1;E++){const A=c[E+1]&255;(_*4-g-A)/2<h&&t.set(E),g=_,_=A}}return t}getBlackMatrix(){const e=this.getLuminanceSource(),t=e.getWidth(),n=e.getHeight(),s=new X(t,n);this.initArrays(t);const c=this.buckets;for(let g=1;g<5;g++){const _=Math.floor(n*g/5),E=e.getRow(_,this.luminances),A=Math.floor(t*4/5);for(let S=Math.floor(t/5);S<A;S++){const B=E[S]&255;c[B>>$.LUMINANCE_SHIFT]++}}const d=$.estimateBlackPoint(c),h=e.getMatrix();for(let g=0;g<n;g++){const _=g*t;for(let E=0;E<t;E++)(h[_+E]&255)<d&&s.set(E,g)}return s}createBinarizer(e){return new $(e)}initArrays(e){this.luminances.length<e&&(this.luminances=new Uint8ClampedArray(e));const t=this.buckets;for(let n=0;n<$.LUMINANCE_BUCKETS;n++)t[n]=0}static estimateBlackPoint(e){const t=e.length;let n=0,s=0,c=0;for(let E=0;E<t;E++)e[E]>c&&(s=E,c=e[E]),e[E]>n&&(n=e[E]);let d=0,h=0;for(let E=0;E<t;E++){const A=E-s,S=e[E]*A*A;S>h&&(d=E,h=S)}if(s>d){const E=s;s=d,d=E}if(d-s<=t/16)throw new I;let g=d-1,_=-1;for(let E=d-1;E>s;E--){const A=E-s,S=A*A*(d-E)*(n-e[E]);S>_&&(g=E,_=S)}return g<<$.LUMINANCE_SHIFT}}$.LUMINANCE_BITS=5,$.LUMINANCE_SHIFT=8-$.LUMINANCE_BITS,$.LUMINANCE_BUCKETS=1<<$.LUMINANCE_BITS,$.EMPTY=Uint8ClampedArray.from([0]);class j extends ${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>=j.MINIMUM_DIMENSION&&n>=j.MINIMUM_DIMENSION){const s=e.getMatrix();let c=t>>j.BLOCK_SIZE_POWER;t&j.BLOCK_SIZE_MASK&&c++;let d=n>>j.BLOCK_SIZE_POWER;n&j.BLOCK_SIZE_MASK&&d++;const h=j.calculateBlackPoints(s,c,d,t,n),g=new X(t,n);j.calculateThresholdForBlock(s,c,d,t,n,h,g),this.matrix=g}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(e){return new j(e)}static calculateThresholdForBlock(e,t,n,s,c,d,h){const g=c-j.BLOCK_SIZE,_=s-j.BLOCK_SIZE;for(let E=0;E<n;E++){let A=E<<j.BLOCK_SIZE_POWER;A>g&&(A=g);const S=j.cap(E,2,n-3);for(let B=0;B<t;B++){let z=B<<j.BLOCK_SIZE_POWER;z>_&&(z=_);const G=j.cap(B,2,t-3);let Y=0;for(let ue=-2;ue<=2;ue++){const fe=d[S+ue];Y+=fe[G-2]+fe[G-1]+fe[G]+fe[G+1]+fe[G+2]}const ie=Y/25;j.thresholdBlock(e,z,A,ie,s,h)}}}static cap(e,t,n){return e<t?t:e>n?n:e}static thresholdBlock(e,t,n,s,c,d){for(let h=0,g=n*c+t;h<j.BLOCK_SIZE;h++,g+=c)for(let _=0;_<j.BLOCK_SIZE;_++)(e[g+_]&255)<=s&&d.set(t+_,n+h)}static calculateBlackPoints(e,t,n,s,c){const d=c-j.BLOCK_SIZE,h=s-j.BLOCK_SIZE,g=new Array(n);for(let _=0;_<n;_++){g[_]=new Int32Array(t);let E=_<<j.BLOCK_SIZE_POWER;E>d&&(E=d);for(let A=0;A<t;A++){let S=A<<j.BLOCK_SIZE_POWER;S>h&&(S=h);let B=0,z=255,G=0;for(let ie=0,ue=E*s+S;ie<j.BLOCK_SIZE;ie++,ue+=s){for(let fe=0;fe<j.BLOCK_SIZE;fe++){const le=e[ue+fe]&255;B+=le,le<z&&(z=le),le>G&&(G=le)}if(G-z>j.MIN_DYNAMIC_RANGE)for(ie++,ue+=s;ie<j.BLOCK_SIZE;ie++,ue+=s)for(let fe=0;fe<j.BLOCK_SIZE;fe++)B+=e[ue+fe]&255}let Y=B>>j.BLOCK_SIZE_POWER*2;if(G-z<=j.MIN_DYNAMIC_RANGE&&(Y=z/2,_>0&&A>0)){const ie=(g[_-1][A]+2*g[_][A-1]+g[_-1][A-1])/4;z<ie&&(Y=ie)}g[_][A]=Y}}return g}}j.BLOCK_SIZE_POWER=3,j.BLOCK_SIZE=1<<j.BLOCK_SIZE_POWER,j.BLOCK_SIZE_MASK=j.BLOCK_SIZE-1,j.MINIMUM_DIMENSION=j.BLOCK_SIZE*5,j.MIN_DYNAMIC_RANGE=24;class q{constructor(e,t){this.width=e,this.height=t}getWidth(){return this.width}getHeight(){return this.height}isCropSupported(){return!1}crop(e,t,n,s){throw new re("This luminance source does not support cropping.")}isRotateSupported(){return!1}rotateCounterClockwise(){throw new re("This luminance source does not support rotation by 90 degrees.")}rotateCounterClockwise45(){throw new re("This luminance source does not support rotation by 45 degrees.")}toString(){const e=new Uint8ClampedArray(this.width);let t=new W;for(let n=0;n<this.height;n++){const s=this.getRow(n,e);for(let c=0;c<this.width;c++){const d=s[c]&255;let h;d<64?h="#":d<128?h="+":d<192?h=".":h=" ",t.append(h)}t.append(`
14
+ `)}return t.toString()}}class K extends q{constructor(e){super(e.getWidth(),e.getHeight()),this.delegate=e}getRow(e,t){const n=this.delegate.getRow(e,t),s=this.getWidth();for(let c=0;c<s;c++)n[c]=255-(n[c]&255);return n}getMatrix(){const e=this.delegate.getMatrix(),t=this.getWidth()*this.getHeight(),n=new Uint8ClampedArray(t);for(let s=0;s<t;s++)n[s]=255-(e[s]&255);return n}isCropSupported(){return this.delegate.isCropSupported()}crop(e,t,n,s){return new K(this.delegate.crop(e,t,n,s))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new K(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new K(this.delegate.rotateCounterClockwise45())}}class oe extends q{constructor(e){super(e.width,e.height),this.canvas=e,this.tempCanvasElement=null,this.buffer=oe.makeBufferFromCanvasImageData(e)}static makeBufferFromCanvasImageData(e){const t=e.getContext("2d").getImageData(0,0,e.width,e.height);return oe.toGrayscaleBuffer(t.data,e.width,e.height)}static toGrayscaleBuffer(e,t,n){const s=new Uint8ClampedArray(t*n);for(let c=0,d=0,h=e.length;c<h;c+=4,d++){let g;if(e[c+3]===0)g=255;else{const E=e[c],A=e[c+1],S=e[c+2];g=306*E+601*A+117*S+512>>10}s[d]=g}return s}getRow(e,t){if(e<0||e>=this.getHeight())throw new y("Requested row is outside the image: "+e);const n=this.getWidth(),s=e*n;return t===null?t=this.buffer.slice(s,s+n):(t.length<n&&(t=new Uint8ClampedArray(n)),t.set(this.buffer.slice(s,s+n))),t}getMatrix(){return this.buffer}isCropSupported(){return!0}crop(e,t,n,s){return super.crop(e,t,n,s),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"),s=e*oe.DEGREE_TO_RADIANS,c=this.canvas.width,d=this.canvas.height,h=Math.ceil(Math.abs(Math.cos(s))*c+Math.abs(Math.sin(s))*d),g=Math.ceil(Math.abs(Math.sin(s))*c+Math.abs(Math.cos(s))*d);return t.width=h,t.height=g,n.translate(h/2,g/2),n.rotate(s),n.drawImage(this.canvas,c/-2,d/-2),this.buffer=oe.makeBufferFromCanvasImageData(t),this}invert(){return new K(this)}}oe.DEGREE_TO_RADIANS=Math.PI/180;class de{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 ce=(globalThis||wr||self||window||void 0)&&(globalThis||wr||self||window||void 0).__awaiter||function(b,e,t,n){function s(c){return c instanceof t?c:new t(function(d){d(c)})}return new(t||(t=Promise))(function(c,d){function h(E){try{_(n.next(E))}catch(A){d(A)}}function g(E){try{_(n.throw(E))}catch(A){d(A)}}function _(E){E.done?c(E.value):s(E.value).then(h,g)}_((n=n.apply(b,e||[])).next())})};class Ce{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 ce(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 s=n.kind==="video"?"videoinput":n.kind;if(s!=="videoinput")continue;const c=n.deviceId||n.id,d=n.label||`Video device ${t.length+1}`,h=n.groupId,g={deviceId:c,label:d,kind:s,groupId:h};t.push(g)}return t})}getVideoInputDevices(){return ce(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(t=>new de(t.deviceId,t.label))})}findDeviceById(e){return ce(this,void 0,void 0,function*(){const t=yield this.listVideoInputDevices();return t?t.find(n=>n.deviceId===e):null})}decodeFromInputVideoDevice(e,t){return ce(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(e,t)})}decodeOnceFromVideoDevice(e,t){return ce(this,void 0,void 0,function*(){this.reset();let n;e?n={deviceId:{exact:e}}:n={facingMode:"environment"};const s={video:n};return yield this.decodeOnceFromConstraints(s,t)})}decodeOnceFromConstraints(e,t){return ce(this,void 0,void 0,function*(){const n=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeOnceFromStream(n,t)})}decodeOnceFromStream(e,t){return ce(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 ce(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(e,t,n)})}decodeFromVideoDevice(e,t,n){return ce(this,void 0,void 0,function*(){let s;e?s={deviceId:{exact:e}}:s={facingMode:"environment"};const c={video:s};return yield this.decodeFromConstraints(c,t,n)})}decodeFromConstraints(e,t,n){return ce(this,void 0,void 0,function*(){const s=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeFromStream(s,t,n)})}decodeFromStream(e,t,n){return ce(this,void 0,void 0,function*(){this.reset();const s=yield this.attachStreamToVideo(e,t);return yield this.decodeContinuously(s,n)})}stopAsyncDecode(){this._stopAsyncDecode=!0}stopContinuousDecode(){this._stopContinuousDecode=!0}attachStreamToVideo(e,t){return ce(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 ce(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(),s=this.decodeFromVideoElementContinuously(n,t);return n.src=e,s}_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 ce(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(e),yield this.decodeOnce(e)})}_decodeOnLoadVideoContinuously(e,t){return ce(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 s=(c,d)=>{if(this._stopAsyncDecode){d(new I("Video stream has ended before any code could be detected.")),this._stopAsyncDecode=void 0;return}try{const h=this.decode(e);c(h)}catch(h){const g=t&&h instanceof I,E=(h instanceof O||h instanceof V)&&n;if(g||E)return setTimeout(s,this._timeBetweenDecodingAttempts,c,d);d(h)}};return new Promise((c,d)=>s(c,d))}decodeContinuously(e,t){this._stopContinuousDecode=!1;const n=()=>{if(this._stopContinuousDecode){this._stopContinuousDecode=void 0;return}try{const s=this.decode(e);t(s,null),setTimeout(n,this.timeBetweenScansMillis)}catch(s){t(null,s);const c=s instanceof O||s instanceof V,d=s instanceof I;(c||d)&&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 oe(t),s=new j(n);return new N(s)}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,s;return typeof e<"u"&&(e instanceof HTMLVideoElement?(n=e.videoWidth,s=e.videoHeight):e instanceof HTMLImageElement&&(n=e.naturalWidth||e.width,s=e.naturalHeight||e.height)),t.style.width=n+"px",t.style.height=s+"px",t.width=n,t.height=s,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 ge{constructor(e,t,n=t==null?0:8*t.length,s,c,d=v.currentTimeMillis()){this.text=e,this.rawBytes=t,this.numBits=n,this.resultPoints=s,this.format=c,this.timestamp=d,this.text=e,this.rawBytes=t,n==null?this.numBits=t==null?0:8*t.length:this.numBits=n,this.resultPoints=s,this.format=c,this.resultMetadata=null,d==null?this.timestamp=v.currentTimeMillis():this.timestamp=d}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);v.arraycopy(t,0,n,0,t.length),v.arraycopy(e,0,n,t.length,e.length),this.resultPoints=n}}getTimestamp(){return this.timestamp}toString(){return this.text}}var De;(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"})(De||(De={}));var xe=De,_t;(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"})(_t||(_t={}));var be=_t;class et{constructor(e,t,n,s,c=-1,d=-1){this.rawBytes=e,this.text=t,this.byteSegments=n,this.ecLevel=s,this.structuredAppendSequenceNumber=c,this.structuredAppendParity=d,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 rt{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 Ve{constructor(e,t){if(t.length===0)throw new y;this.field=e;const n=t.length;if(n>1&&t[0]===0){let s=1;for(;s<n&&t[s]===0;)s++;s===n?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(n-s),v.arraycopy(t,s,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 d=0,h=t.length;d!==h;d++){const g=t[d];n=rt.addOrSubtract(n,g)}return n}n=t[0];const s=t.length,c=this.field;for(let d=1;d<s;d++)n=rt.addOrSubtract(c.multiply(e,n),t[d]);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 d=t;t=n,n=d}let s=new Int32Array(n.length);const c=n.length-t.length;v.arraycopy(n,0,s,0,c);for(let d=c;d<n.length;d++)s[d]=rt.addOrSubtract(t[d-c],n[d]);return new Ve(this.field,s)}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,s=e.coefficients,c=s.length,d=new Int32Array(n+c-1),h=this.field;for(let g=0;g<n;g++){const _=t[g];for(let E=0;E<c;E++)d[g+E]=rt.addOrSubtract(d[g+E],h.multiply(_,s[E]))}return new Ve(h,d)}multiplyScalar(e){if(e===0)return this.field.getZero();if(e===1)return this;const t=this.coefficients.length,n=this.field,s=new Int32Array(t),c=this.coefficients;for(let d=0;d<t;d++)s[d]=n.multiply(c[d],e);return new Ve(n,s)}multiplyByMonomial(e,t){if(e<0)throw new y;if(t===0)return this.field.getZero();const n=this.coefficients,s=n.length,c=new Int32Array(s+e),d=this.field;for(let h=0;h<s;h++)c[h]=d.multiply(n[h],t);return new Ve(d,c)}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(),s=this;const c=e.getCoefficient(e.getDegree()),d=t.inverse(c);for(;s.getDegree()>=e.getDegree()&&!s.isZero();){const h=s.getDegree()-e.getDegree(),g=t.multiply(s.getCoefficient(s.getDegree()),d),_=e.multiplyByMonomial(h,g),E=t.buildMonomial(h,g);n=n.addOrSubtract(E),s=s.addOrSubtract(_)}return[n,s]}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 s=this.field.log(n);s===0?e+="1":s===1?e+="a":(e+="a^",e+=s)}t!==0&&(t===1?e+="x":(e+="x^",e+=t))}}return e}}class it extends x{}it.kind="ArithmeticException";class Me extends rt{constructor(e,t,n){super(),this.primitive=e,this.size=t,this.generatorBase=n;const s=new Int32Array(t);let c=1;for(let h=0;h<t;h++)s[h]=c,c*=2,c>=t&&(c^=e,c&=t-1);this.expTable=s;const d=new Int32Array(t);for(let h=0;h<t-1;h++)d[s[h]]=h;this.logTable=d,this.zero=new Ve(this,Int32Array.from([0])),this.one=new Ve(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 Ve(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"+R.toHexString(this.primitive)+","+this.size+")"}equals(e){return e===this}}Me.AZTEC_DATA_12=new Me(4201,4096,1),Me.AZTEC_DATA_10=new Me(1033,1024,1),Me.AZTEC_DATA_6=new Me(67,64,1),Me.AZTEC_PARAM=new Me(19,16,1),Me.QR_CODE_FIELD_256=new Me(285,256,0),Me.DATA_MATRIX_FIELD_256=new Me(301,256,1),Me.AZTEC_DATA_8=Me.DATA_MATRIX_FIELD_256,Me.MAXICODE_FIELD_64=Me.AZTEC_DATA_6;class Ie extends x{}Ie.kind="ReedSolomonException";class Ue extends x{}Ue.kind="IllegalStateException";class It{constructor(e){this.field=e}decode(e,t){const n=this.field,s=new Ve(n,e),c=new Int32Array(t);let d=!0;for(let B=0;B<t;B++){const z=s.evaluateAt(n.exp(B+n.getGeneratorBase()));c[c.length-1-B]=z,z!==0&&(d=!1)}if(d)return;const h=new Ve(n,c),g=this.runEuclideanAlgorithm(n.buildMonomial(t,1),h,t),_=g[0],E=g[1],A=this.findErrorLocations(_),S=this.findErrorMagnitudes(E,A);for(let B=0;B<A.length;B++){const z=e.length-1-n.log(A[B]);if(z<0)throw new Ie("Bad error location");e[z]=Me.addOrSubtract(e[z],S[B])}}runEuclideanAlgorithm(e,t,n){if(e.getDegree()<t.getDegree()){const B=e;e=t,t=B}const s=this.field;let c=e,d=t,h=s.getZero(),g=s.getOne();for(;d.getDegree()>=(n/2|0);){let B=c,z=h;if(c=d,h=g,c.isZero())throw new Ie("r_{i-1} was zero");d=B;let G=s.getZero();const Y=c.getCoefficient(c.getDegree()),ie=s.inverse(Y);for(;d.getDegree()>=c.getDegree()&&!d.isZero();){const ue=d.getDegree()-c.getDegree(),fe=s.multiply(d.getCoefficient(d.getDegree()),ie);G=G.addOrSubtract(s.buildMonomial(ue,fe)),d=d.addOrSubtract(c.multiplyByMonomial(ue,fe))}if(g=G.multiply(h).addOrSubtract(z),d.getDegree()>=c.getDegree())throw new Ue("Division algorithm failed to reduce polynomial?")}const _=g.getCoefficient(0);if(_===0)throw new Ie("sigmaTilde(0) was zero");const E=s.inverse(_),A=g.multiplyScalar(E),S=d.multiplyScalar(E);return[A,S]}findErrorLocations(e){const t=e.getDegree();if(t===1)return Int32Array.from([e.getCoefficient(1)]);const n=new Int32Array(t);let s=0;const c=this.field;for(let d=1;d<c.getSize()&&s<t;d++)e.evaluateAt(d)===0&&(n[s]=c.inverse(d),s++);if(s!==t)throw new Ie("Error locator degree does not match number of roots");return n}findErrorMagnitudes(e,t){const n=t.length,s=new Int32Array(n),c=this.field;for(let d=0;d<n;d++){const h=c.inverse(t[d]);let g=1;for(let _=0;_<n;_++)if(d!==_){const E=c.multiply(t[_],h),A=E&1?E&-2:E|1;g=c.multiply(g,A)}s[d]=c.multiply(e.evaluateAt(h),c.inverse(g)),c.getGeneratorBase()!==0&&(s[d]=c.multiply(s[d],h))}return s}}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 Qe{decode(e){this.ddata=e;let t=e.getBits(),n=this.extractBits(t),s=this.correctBits(n),c=Qe.convertBoolArrayToByteArray(s),d=Qe.getEncodedData(s),h=new et(c,d,null,null);return h.setNumBits(s.length),h}static highLevelDecode(e){return this.getEncodedData(e)}static getEncodedData(e){let t=e.length,n=ot.UPPER,s=ot.UPPER,c="",d=0;for(;d<t;)if(s===ot.BINARY){if(t-d<5)break;let h=Qe.readCode(e,d,5);if(d+=5,h===0){if(t-d<11)break;h=Qe.readCode(e,d,11)+31,d+=11}for(let g=0;g<h;g++){if(t-d<8){d=t;break}const _=Qe.readCode(e,d,8);c+=ee.castAsNonUtf8Char(_),d+=8}s=n}else{let h=s===ot.DIGIT?4:5;if(t-d<h)break;let g=Qe.readCode(e,d,h);d+=h;let _=Qe.getCharacter(s,g);_.startsWith("CTRL_")?(n=s,s=Qe.getTable(_.charAt(5)),_.charAt(6)==="L"&&(n=s)):(c+=_,s=n)}return c}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 Qe.UPPER_TABLE[t];case ot.LOWER:return Qe.LOWER_TABLE[t];case ot.MIXED:return Qe.MIXED_TABLE[t];case ot.PUNCT:return Qe.PUNCT_TABLE[t];case ot.DIGIT:return Qe.DIGIT_TABLE[t];default:throw new Ue("Bad table")}}correctBits(e){let t,n;this.ddata.getNbLayers()<=2?(n=6,t=Me.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(n=8,t=Me.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(n=10,t=Me.AZTEC_DATA_10):(n=12,t=Me.AZTEC_DATA_12);let s=this.ddata.getNbDatablocks(),c=e.length/n;if(c<s)throw new V;let d=e.length%n,h=new Int32Array(c);for(let S=0;S<c;S++,d+=n)h[S]=Qe.readCode(e,d,n);try{new It(t).decode(h,c-s)}catch(S){throw new V(S)}let g=(1<<n)-1,_=0;for(let S=0;S<s;S++){let B=h[S];if(B===0||B===g)throw new V;(B===1||B===g-1)&&_++}let E=new Array(s*n-_),A=0;for(let S=0;S<s;S++){let B=h[S];if(B===1||B===g-1)E.fill(B>1,A,A+n-1),A+=n-1;else for(let z=n-1;z>=0;--z)E[A++]=(B&1<<z)!==0}return E}extractBits(e){let t=this.ddata.isCompact(),n=this.ddata.getNbLayers(),s=(t?11:14)+n*4,c=new Int32Array(s),d=new Array(this.totalBitsInLayer(n,t));if(t)for(let h=0;h<c.length;h++)c[h]=h;else{let h=s+1+2*R.truncDivision(R.truncDivision(s,2)-1,15),g=s/2,_=R.truncDivision(h,2);for(let E=0;E<g;E++){let A=E+R.truncDivision(E,15);c[g-E-1]=_-A-1,c[g+E]=_+A+1}}for(let h=0,g=0;h<n;h++){let _=(n-h)*4+(t?9:12),E=h*2,A=s-1-E;for(let S=0;S<_;S++){let B=S*2;for(let z=0;z<2;z++)d[g+B+z]=e.get(c[E+z],c[E+S]),d[g+2*_+B+z]=e.get(c[E+S],c[A-z]),d[g+4*_+B+z]=e.get(c[A-z],c[A-S]),d[g+6*_+B+z]=e.get(c[A-S],c[E+z])}g+=_*8}return d}static readCode(e,t,n){let s=0;for(let c=t;c<t+n;c++)s<<=1,e[c]&&(s|=1);return s}static readByte(e,t){let n=e.length-t;return n>=8?Qe.readCode(e,t,8):Qe.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]=Qe.readByte(e,8*n);return t}totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}Qe.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"],Qe.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"],Qe.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"],Qe.PUNCT_TABLE=["","\r",`\r
16
+ `,". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],Qe.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class ve{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,s){const c=e-n,d=t-s;return Math.sqrt(c*c+d*d)}static sum(e){let t=0;for(let n=0,s=e.length;n!==s;n++){const c=e[n];t+=c}return t}}class ar{static floatToIntBits(e){return e}}ar.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*ar.floatToIntBits(this.x)+ar.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]),s=this.distance(e[0],e[2]);let c,d,h;if(n>=t&&n>=s?(d=e[0],c=e[1],h=e[2]):s>=n&&s>=t?(d=e[1],c=e[0],h=e[2]):(d=e[2],c=e[0],h=e[1]),this.crossProductZ(c,d,h)<0){const g=c;c=h,h=g}e[0]=c,e[1]=d,e[2]=h}static distance(e,t){return ve.distance(e.x,e.y,t.x,t.y)}static crossProductZ(e,t,n){const s=t.x,c=t.y;return(n.x-s)*(e.y-c)-(n.y-c)*(e.x-s)}}class br{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class qr extends br{constructor(e,t,n,s,c){super(e,t),this.compact=n,this.nbDatablocks=s,this.nbLayers=c}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class Dt{constructor(e,t,n,s){this.image=e,this.height=e.getHeight(),this.width=e.getWidth(),t==null&&(t=Dt.INIT_SIZE),n==null&&(n=e.getWidth()/2|0),s==null&&(s=e.getHeight()/2|0);const c=t/2|0;if(this.leftInit=n-c,this.rightInit=n+c,this.upInit=s-c,this.downInit=s+c,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new I}detect(){let e=this.leftInit,t=this.rightInit,n=this.upInit,s=this.downInit,c=!1,d=!0,h=!1,g=!1,_=!1,E=!1,A=!1;const S=this.width,B=this.height;for(;d;){d=!1;let z=!0;for(;(z||!g)&&t<S;)z=this.containsBlackPoint(n,s,t,!1),z?(t++,d=!0,g=!0):g||t++;if(t>=S){c=!0;break}let G=!0;for(;(G||!_)&&s<B;)G=this.containsBlackPoint(e,t,s,!0),G?(s++,d=!0,_=!0):_||s++;if(s>=B){c=!0;break}let Y=!0;for(;(Y||!E)&&e>=0;)Y=this.containsBlackPoint(n,s,e,!1),Y?(e--,d=!0,E=!0):E||e--;if(e<0){c=!0;break}let ie=!0;for(;(ie||!A)&&n>=0;)ie=this.containsBlackPoint(e,t,n,!0),ie?(n--,d=!0,A=!0):A||n--;if(n<0){c=!0;break}d&&(h=!0)}if(!c&&h){const z=t-e;let G=null;for(let fe=1;G===null&&fe<z;fe++)G=this.getBlackPointOnSegment(e,s-fe,e+fe,s);if(G==null)throw new I;let Y=null;for(let fe=1;Y===null&&fe<z;fe++)Y=this.getBlackPointOnSegment(e,n+fe,e+fe,n);if(Y==null)throw new I;let ie=null;for(let fe=1;ie===null&&fe<z;fe++)ie=this.getBlackPointOnSegment(t,n+fe,t-fe,n);if(ie==null)throw new I;let ue=null;for(let fe=1;ue===null&&fe<z;fe++)ue=this.getBlackPointOnSegment(t,s-fe,t-fe,s);if(ue==null)throw new I;return this.centerEdges(ue,G,ie,Y)}else throw new I}getBlackPointOnSegment(e,t,n,s){const c=ve.round(ve.distance(e,t,n,s)),d=(n-e)/c,h=(s-t)/c,g=this.image;for(let _=0;_<c;_++){const E=ve.round(e+_*d),A=ve.round(t+_*h);if(g.get(E,A))return new ye(E,A)}return null}centerEdges(e,t,n,s){const c=e.getX(),d=e.getY(),h=t.getX(),g=t.getY(),_=n.getX(),E=n.getY(),A=s.getX(),S=s.getY(),B=Dt.CORR;return c<this.width/2?[new ye(A-B,S+B),new ye(h+B,g+B),new ye(_-B,E-B),new ye(c+B,d-B)]:[new ye(A+B,S+B),new ye(h+B,g-B),new ye(_-B,E+B),new ye(c-B,d-B)]}containsBlackPoint(e,t,n,s){const c=this.image;if(s){for(let d=e;d<=t;d++)if(c.get(d,n))return!0}else for(let d=e;d<=t;d++)if(c.get(n,d))return!0;return!1}}Dt.INIT_SIZE=10,Dt.CORR=1;class Ar{static checkAndNudgePoints(e,t){const n=e.getWidth(),s=e.getHeight();let c=!0;for(let d=0;d<t.length&&c;d+=2){const h=Math.floor(t[d]),g=Math.floor(t[d+1]);if(h<-1||h>n||g<-1||g>s)throw new I;c=!1,h===-1?(t[d]=0,c=!0):h===n&&(t[d]=n-1,c=!0),g===-1?(t[d+1]=0,c=!0):g===s&&(t[d+1]=s-1,c=!0)}c=!0;for(let d=t.length-2;d>=0&&c;d-=2){const h=Math.floor(t[d]),g=Math.floor(t[d+1]);if(h<-1||h>n||g<-1||g>s)throw new I;c=!1,h===-1?(t[d]=0,c=!0):h===n&&(t[d]=n-1,c=!0),g===-1?(t[d+1]=0,c=!0):g===s&&(t[d+1]=s-1,c=!0)}}}class dn{constructor(e,t,n,s,c,d,h,g,_){this.a11=e,this.a21=t,this.a31=n,this.a12=s,this.a22=c,this.a32=d,this.a13=h,this.a23=g,this.a33=_}static quadrilateralToQuadrilateral(e,t,n,s,c,d,h,g,_,E,A,S,B,z,G,Y){const ie=dn.quadrilateralToSquare(e,t,n,s,c,d,h,g);return dn.squareToQuadrilateral(_,E,A,S,B,z,G,Y).times(ie)}transformPoints(e){const t=e.length,n=this.a11,s=this.a12,c=this.a13,d=this.a21,h=this.a22,g=this.a23,_=this.a31,E=this.a32,A=this.a33;for(let S=0;S<t;S+=2){const B=e[S],z=e[S+1],G=c*B+g*z+A;e[S]=(n*B+d*z+_)/G,e[S+1]=(s*B+h*z+E)/G}}transformPointsWithValues(e,t){const n=this.a11,s=this.a12,c=this.a13,d=this.a21,h=this.a22,g=this.a23,_=this.a31,E=this.a32,A=this.a33,S=e.length;for(let B=0;B<S;B++){const z=e[B],G=t[B],Y=c*z+g*G+A;e[B]=(n*z+d*G+_)/Y,t[B]=(s*z+h*G+E)/Y}}static squareToQuadrilateral(e,t,n,s,c,d,h,g){const _=e-n+c-h,E=t-s+d-g;if(_===0&&E===0)return new dn(n-e,c-n,e,s-t,d-s,t,0,0,1);{const A=n-c,S=h-c,B=s-d,z=g-d,G=A*z-S*B,Y=(_*z-S*E)/G,ie=(A*E-_*B)/G;return new dn(n-e+Y*n,h-e+ie*h,e,s-t+Y*s,g-t+ie*g,t,Y,ie,1)}}static quadrilateralToSquare(e,t,n,s,c,d,h,g){return dn.squareToQuadrilateral(e,t,n,s,c,d,h,g).buildAdjoint()}buildAdjoint(){return new dn(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 dn(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 Ri extends Ar{sampleGrid(e,t,n,s,c,d,h,g,_,E,A,S,B,z,G,Y,ie,ue,fe){const le=dn.quadrilateralToQuadrilateral(s,c,d,h,g,_,E,A,S,B,z,G,Y,ie,ue,fe);return this.sampleGridWithTransform(e,t,n,le)}sampleGridWithTransform(e,t,n,s){if(t<=0||n<=0)throw new I;const c=new X(t,n),d=new Float32Array(2*t);for(let h=0;h<n;h++){const g=d.length,_=h+.5;for(let E=0;E<g;E+=2)d[E]=E/2+.5,d[E+1]=_;s.transformPoints(d),Ar.checkAndNudgePoints(e,d);try{for(let E=0;E<g;E+=2)e.get(Math.floor(d[E]),Math.floor(d[E+1]))&&c.set(E/2,h)}catch{throw new I}}return c}}class Rn{static setGridSampler(e){Rn.gridSampler=e}static getInstance(){return Rn.gridSampler}}Rn.gridSampler=new Ri;class Ut{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 Bi{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 d=n[0];n[0]=n[2],n[2]=d}this.extractParameters(n);let s=this.sampleGrid(this.image,n[this.shift%4],n[(this.shift+1)%4],n[(this.shift+2)%4],n[(this.shift+3)%4]),c=this.getMatrixCornerPoints(n);return new qr(s,c,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 I;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 s=0;for(let d=0;d<4;d++){let h=n[(this.shift+d)%4];this.compact?(s<<=7,s+=h>>1&127):(s<<=10,s+=(h>>2&992)+(h>>1&31))}let c=this.getCorrectedParameterData(s,this.compact);this.compact?(this.nbLayers=(c>>6)+1,this.nbDataBlocks=(c&63)+1):(this.nbLayers=(c>>11)+1,this.nbDataBlocks=(c&2047)+1)}getRotation(e,t){let n=0;e.forEach((s,c,d)=>{let h=(s>>t-2<<1)+(s&1);n=(n<<3)+h}),n=((n&1)<<11)+(n>>1);for(let s=0;s<4;s++)if(R.bitCount(n^this.EXPECTED_CORNER_BITS[s])<=2)return s;throw new I}getCorrectedParameterData(e,t){let n,s;t?(n=7,s=2):(n=10,s=4);let c=n-s,d=new Int32Array(n);for(let g=n-1;g>=0;--g)d[g]=e&15,e>>=4;try{new It(Me.AZTEC_PARAM).decode(d,c)}catch{throw new I}let h=0;for(let g=0;g<s;g++)h=(h<<4)+d[g];return h}getBullsEyeCorners(e){let t=e,n=e,s=e,c=e,d=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){let A=this.getFirstDifferent(t,d,1,-1),S=this.getFirstDifferent(n,d,1,1),B=this.getFirstDifferent(s,d,-1,1),z=this.getFirstDifferent(c,d,-1,-1);if(this.nbCenterLayers>2){let G=this.distancePoint(z,A)*this.nbCenterLayers/(this.distancePoint(c,t)*(this.nbCenterLayers+2));if(G<.75||G>1.25||!this.isWhiteOrBlackRectangle(A,S,B,z))break}t=A,n=S,s=B,c=z,d=!d}if(this.nbCenterLayers!==5&&this.nbCenterLayers!==7)throw new I;this.compact=this.nbCenterLayers===5;let h=new ye(t.getX()+.5,t.getY()-.5),g=new ye(n.getX()+.5,n.getY()+.5),_=new ye(s.getX()-.5,s.getY()+.5),E=new ye(c.getX()-.5,c.getY()-.5);return this.expandSquare([h,g,_,E],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let e,t,n,s;try{let h=new Dt(this.image).detect();e=h[0],t=h[1],n=h[2],s=h[3]}catch{let g=this.image.getWidth()/2,_=this.image.getHeight()/2;e=this.getFirstDifferent(new Ut(g+7,_-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new Ut(g+7,_+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new Ut(g-7,_+7),!1,-1,1).toResultPoint(),s=this.getFirstDifferent(new Ut(g-7,_-7),!1,-1,-1).toResultPoint()}let c=ve.round((e.getX()+s.getX()+t.getX()+n.getX())/4),d=ve.round((e.getY()+s.getY()+t.getY()+n.getY())/4);try{let h=new Dt(this.image,15,c,d).detect();e=h[0],t=h[1],n=h[2],s=h[3]}catch{e=this.getFirstDifferent(new Ut(c+7,d-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new Ut(c+7,d+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new Ut(c-7,d+7),!1,-1,1).toResultPoint(),s=this.getFirstDifferent(new Ut(c-7,d-7),!1,-1,-1).toResultPoint()}return c=ve.round((e.getX()+s.getX()+t.getX()+n.getX())/4),d=ve.round((e.getY()+s.getY()+t.getY()+n.getY())/4),new Ut(c,d)}getMatrixCornerPoints(e){return this.expandSquare(e,2*this.nbCenterLayers,this.getDimension())}sampleGrid(e,t,n,s,c){let d=Rn.getInstance(),h=this.getDimension(),g=h/2-this.nbCenterLayers,_=h/2+this.nbCenterLayers;return d.sampleGrid(e,h,h,g,g,_,g,_,_,g,_,t.getX(),t.getY(),n.getX(),n.getY(),s.getX(),s.getY(),c.getX(),c.getY())}sampleLine(e,t,n){let s=0,c=this.distanceResultPoint(e,t),d=c/n,h=e.getX(),g=e.getY(),_=d*(t.getX()-e.getX())/c,E=d*(t.getY()-e.getY())/c;for(let A=0;A<n;A++)this.image.get(ve.round(h+A*_),ve.round(g+A*E))&&(s|=1<<n-A-1);return s}isWhiteOrBlackRectangle(e,t,n,s){let c=3;e=new Ut(e.getX()-c,e.getY()+c),t=new Ut(t.getX()-c,t.getY()-c),n=new Ut(n.getX()+c,n.getY()-c),s=new Ut(s.getX()+c,s.getY()+c);let d=this.getColor(s,e);if(d===0)return!1;let h=this.getColor(e,t);return h!==d||(h=this.getColor(t,n),h!==d)?!1:(h=this.getColor(n,s),h===d)}getColor(e,t){let n=this.distancePoint(e,t),s=(t.getX()-e.getX())/n,c=(t.getY()-e.getY())/n,d=0,h=e.getX(),g=e.getY(),_=this.image.get(e.getX(),e.getY()),E=Math.ceil(n);for(let S=0;S<E;S++)h+=s,g+=c,this.image.get(ve.round(h),ve.round(g))!==_&&d++;let A=d/n;return A>.1&&A<.9?0:A<=.1===_?1:-1}getFirstDifferent(e,t,n,s){let c=e.getX()+n,d=e.getY()+s;for(;this.isValid(c,d)&&this.image.get(c,d)===t;)c+=n,d+=s;for(c-=n,d-=s;this.isValid(c,d)&&this.image.get(c,d)===t;)c+=n;for(c-=n;this.isValid(c,d)&&this.image.get(c,d)===t;)d+=s;return d-=s,new Ut(c,d)}expandSquare(e,t,n){let s=n/(2*t),c=e[0].getX()-e[2].getX(),d=e[0].getY()-e[2].getY(),h=(e[0].getX()+e[2].getX())/2,g=(e[0].getY()+e[2].getY())/2,_=new ye(h+s*c,g+s*d),E=new ye(h-s*c,g-s*d);c=e[1].getX()-e[3].getX(),d=e[1].getY()-e[3].getY(),h=(e[1].getX()+e[3].getX())/2,g=(e[1].getY()+e[3].getY())/2;let A=new ye(h+s*c,g+s*d),S=new ye(h-s*c,g-s*d);return[_,A,E,S]}isValid(e,t){return e>=0&&e<this.image.getWidth()&&t>0&&t<this.image.getHeight()}isValidPoint(e){let t=ve.round(e.getX()),n=ve.round(e.getY());return this.isValid(t,n)}distancePoint(e,t){return ve.distance(e.getX(),e.getY(),t.getX(),t.getY())}distanceResultPoint(e,t){return ve.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 Sr{decode(e,t=null){let n=null,s=new Bi(e.getBlackMatrix()),c=null,d=null;try{let E=s.detectMirror(!1);c=E.getPoints(),this.reportFoundResultPoints(t,c),d=new Qe().decode(E)}catch(E){n=E}if(d==null)try{let E=s.detectMirror(!0);c=E.getPoints(),this.reportFoundResultPoints(t,c),d=new Qe().decode(E)}catch(E){throw n??E}let h=new ge(d.getText(),d.getRawBytes(),d.getNumBits(),c,xe.AZTEC,v.currentTimeMillis()),g=d.getByteSegments();g!=null&&h.putMetadata(be.BYTE_SEGMENTS,g);let _=d.getECLevel();return _!=null&&h.putMetadata(be.ERROR_CORRECTION_LEVEL,_),h}reportFoundResultPoints(e,t){if(e!=null){let n=e.get(Z.NEED_RESULT_POINT_CALLBACK);n!=null&&t.forEach((s,c,d)=>{n.foundPossibleResultPoint(s)})}}reset(){}}class Oo extends Ce{constructor(e=500){super(new Sr,e)}}class ht{decode(e,t){try{return this.doDecode(e,t)}catch{if(t&&t.get(Z.TRY_HARDER)===!0&&e.isRotateSupported()){const c=e.rotateCounterClockwise(),d=this.doDecode(c,t),h=d.getResultMetadata();let g=270;h!==null&&h.get(be.ORIENTATION)===!0&&(g=g+h.get(be.ORIENTATION)%360),d.putMetadata(be.ORIENTATION,g);const _=d.getResultPoints();if(_!==null){const E=c.getHeight();for(let A=0;A<_.length;A++)_[A]=new ye(E-_[A].getY()-1,_[A].getX())}return d}else throw new I}}reset(){}doDecode(e,t){const n=e.getWidth(),s=e.getHeight();let c=new F(n);const d=t&&t.get(Z.TRY_HARDER)===!0,h=Math.max(1,s>>(d?8:5));let g;d?g=s:g=15;const _=Math.trunc(s/2);for(let E=0;E<g;E++){const A=Math.trunc((E+1)/2),S=(E&1)===0,B=_+h*(S?A:-A);if(B<0||B>=s)break;try{c=e.getBlackRow(B,c)}catch{continue}for(let z=0;z<2;z++){if(z===1&&(c.reverse(),t&&t.get(Z.NEED_RESULT_POINT_CALLBACK)===!0)){const G=new Map;t.forEach((Y,ie)=>G.set(ie,Y)),G.delete(Z.NEED_RESULT_POINT_CALLBACK),t=G}try{const G=this.decodeRow(B,c,t);if(z===1){G.putMetadata(be.ORIENTATION,180);const Y=G.getResultPoints();Y!==null&&(Y[0]=new ye(n-Y[0].getX()-1,Y[0].getY()),Y[1]=new ye(n-Y[1].getX()-1,Y[1].getY()))}return G}catch{}}}throw new I}static recordPattern(e,t,n){const s=n.length;for(let _=0;_<s;_++)n[_]=0;const c=e.getSize();if(t>=c)throw new I;let d=!e.get(t),h=0,g=t;for(;g<c;){if(e.get(g)!==d)n[h]++;else{if(++h===s)break;n[h]=1,d=!d}g++}if(!(h===s||h===s-1&&g===c))throw new I}static recordPatternInReverse(e,t,n){let s=n.length,c=e.get(t);for(;t>0&&s>=0;)e.get(--t)!==c&&(s--,c=!c);if(s>=0)throw new I;ht.recordPattern(e,t+1,n)}static patternMatchVariance(e,t,n){const s=e.length;let c=0,d=0;for(let _=0;_<s;_++)c+=e[_],d+=t[_];if(c<d)return Number.POSITIVE_INFINITY;const h=c/d;n*=h;let g=0;for(let _=0;_<s;_++){const E=e[_],A=t[_]*h,S=E>A?E-A:A-E;if(S>n)return Number.POSITIVE_INFINITY;g+=S}return g/c}}class me extends ht{static findStartPattern(e){const t=e.getSize(),n=e.getNextSet(0);let s=0,c=Int32Array.from([0,0,0,0,0,0]),d=n,h=!1;const g=6;for(let _=n;_<t;_++)if(e.get(_)!==h)c[s]++;else{if(s===g-1){let E=me.MAX_AVG_VARIANCE,A=-1;for(let S=me.CODE_START_A;S<=me.CODE_START_C;S++){const B=ht.patternMatchVariance(c,me.CODE_PATTERNS[S],me.MAX_INDIVIDUAL_VARIANCE);B<E&&(E=B,A=S)}if(A>=0&&e.isRange(Math.max(0,d-(_-d)/2),d,!1))return Int32Array.from([d,_,A]);d+=c[0]+c[1],c=c.slice(2,c.length-1),c[s-1]=0,c[s]=0,s--}else s++;c[s]=1,h=!h}throw new I}static decodeCode(e,t,n){ht.recordPattern(e,n,t);let s=me.MAX_AVG_VARIANCE,c=-1;for(let d=0;d<me.CODE_PATTERNS.length;d++){const h=me.CODE_PATTERNS[d],g=this.patternMatchVariance(t,h,me.MAX_INDIVIDUAL_VARIANCE);g<s&&(s=g,c=d)}if(c>=0)return c;throw new I}decodeRow(e,t,n){const s=n&&n.get(Z.ASSUME_GS1)===!0,c=me.findStartPattern(t),d=c[2];let h=0;const g=new Uint8Array(20);g[h++]=d;let _;switch(d){case me.CODE_START_A:_=me.CODE_CODE_A;break;case me.CODE_START_B:_=me.CODE_CODE_B;break;case me.CODE_START_C:_=me.CODE_CODE_C;break;default:throw new V}let E=!1,A=!1,S="",B=c[0],z=c[1];const G=Int32Array.from([0,0,0,0,0,0]);let Y=0,ie=0,ue=d,fe=0,le=!0,je=!1,Fe=!1;for(;!E;){const Mr=A;switch(A=!1,Y=ie,ie=me.decodeCode(t,G,z),g[h++]=ie,ie!==me.CODE_STOP&&(le=!0),ie!==me.CODE_STOP&&(fe++,ue+=fe*ie),B=z,z+=G.reduce((Ug,zg)=>Ug+zg,0),ie){case me.CODE_START_A:case me.CODE_START_B:case me.CODE_START_C:throw new V}switch(_){case me.CODE_CODE_A:if(ie<64)Fe===je?S+=String.fromCharCode(32+ie):S+=String.fromCharCode(32+ie+128),Fe=!1;else if(ie<96)Fe===je?S+=String.fromCharCode(ie-64):S+=String.fromCharCode(ie+64),Fe=!1;else switch(ie!==me.CODE_STOP&&(le=!1),ie){case me.CODE_FNC_1:s&&(S.length===0?S+="]C1":S+="");break;case me.CODE_FNC_2:case me.CODE_FNC_3:break;case me.CODE_FNC_4_A:!je&&Fe?(je=!0,Fe=!1):je&&Fe?(je=!1,Fe=!1):Fe=!0;break;case me.CODE_SHIFT:A=!0,_=me.CODE_CODE_B;break;case me.CODE_CODE_B:_=me.CODE_CODE_B;break;case me.CODE_CODE_C:_=me.CODE_CODE_C;break;case me.CODE_STOP:E=!0;break}break;case me.CODE_CODE_B:if(ie<96)Fe===je?S+=String.fromCharCode(32+ie):S+=String.fromCharCode(32+ie+128),Fe=!1;else switch(ie!==me.CODE_STOP&&(le=!1),ie){case me.CODE_FNC_1:s&&(S.length===0?S+="]C1":S+="");break;case me.CODE_FNC_2:case me.CODE_FNC_3:break;case me.CODE_FNC_4_B:!je&&Fe?(je=!0,Fe=!1):je&&Fe?(je=!1,Fe=!1):Fe=!0;break;case me.CODE_SHIFT:A=!0,_=me.CODE_CODE_A;break;case me.CODE_CODE_A:_=me.CODE_CODE_A;break;case me.CODE_CODE_C:_=me.CODE_CODE_C;break;case me.CODE_STOP:E=!0;break}break;case me.CODE_CODE_C:if(ie<100)ie<10&&(S+="0"),S+=ie;else switch(ie!==me.CODE_STOP&&(le=!1),ie){case me.CODE_FNC_1:s&&(S.length===0?S+="]C1":S+="");break;case me.CODE_CODE_A:_=me.CODE_CODE_A;break;case me.CODE_CODE_B:_=me.CODE_CODE_B;break;case me.CODE_STOP:E=!0;break}break}Mr&&(_=_===me.CODE_CODE_A?me.CODE_CODE_B:me.CODE_CODE_A)}const rn=z-B;if(z=t.getNextUnset(z),!t.isRange(z,Math.min(t.getSize(),z+(z-B)/2),!1))throw new I;if(ue-=fe*Y,ue%103!==Y)throw new O;const Sn=S.length;if(Sn===0)throw new I;Sn>0&&le&&(_===me.CODE_CODE_C?S=S.substring(0,Sn-2):S=S.substring(0,Sn-1));const on=(c[1]+c[0])/2,ut=B+rn/2,Wt=g.length,fn=new Uint8Array(Wt);for(let Mr=0;Mr<Wt;Mr++)fn[Mr]=g[Mr];const Or=[new ye(on,e),new ye(ut,e)];return new ge(S,fn,0,Or,xe.CODE_128,new Date().getTime())}}me.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])],me.MAX_AVG_VARIANCE=.25,me.MAX_INDIVIDUAL_VARIANCE=.7,me.CODE_SHIFT=98,me.CODE_CODE_C=99,me.CODE_CODE_B=100,me.CODE_CODE_A=101,me.CODE_FNC_1=102,me.CODE_FNC_2=97,me.CODE_FNC_3=96,me.CODE_FNC_4_A=101,me.CODE_FNC_4_B=100,me.CODE_START_A=103,me.CODE_START_B=104,me.CODE_START_C=105,me.CODE_STOP=106;class bt extends ht{constructor(e=!1,t=!1){super(),this.usingCheckDigit=e,this.extendedMode=t,this.decodeRowResult="",this.counters=new Int32Array(9)}decodeRow(e,t,n){let s=this.counters;s.fill(0),this.decodeRowResult="";let c=bt.findAsteriskPattern(t,s),d=t.getNextSet(c[1]),h=t.getSize(),g,_;do{bt.recordPattern(t,d,s);let G=bt.toNarrowWidePattern(s);if(G<0)throw new I;g=bt.patternToChar(G),this.decodeRowResult+=g,_=d;for(let Y of s)d+=Y;d=t.getNextSet(d)}while(g!=="*");this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let E=0;for(let G of s)E+=G;let A=d-_-E;if(d!==h&&A*2<E)throw new I;if(this.usingCheckDigit){let G=this.decodeRowResult.length-1,Y=0;for(let ie=0;ie<G;ie++)Y+=bt.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(ie));if(this.decodeRowResult.charAt(G)!==bt.ALPHABET_STRING.charAt(Y%43))throw new O;this.decodeRowResult=this.decodeRowResult.substring(0,G)}if(this.decodeRowResult.length===0)throw new I;let S;this.extendedMode?S=bt.decodeExtended(this.decodeRowResult):S=this.decodeRowResult;let B=(c[1]+c[0])/2,z=_+E/2;return new ge(S,null,0,[new ye(B,e),new ye(z,e)],xe.CODE_39,new Date().getTime())}static findAsteriskPattern(e,t){let n=e.getSize(),s=e.getNextSet(0),c=0,d=s,h=!1,g=t.length;for(let _=s;_<n;_++)if(e.get(_)!==h)t[c]++;else{if(c===g-1){if(this.toNarrowWidePattern(t)===bt.ASTERISK_ENCODING&&e.isRange(Math.max(0,d-Math.floor((_-d)/2)),d,!1))return[d,_];d+=t[0]+t[1],t.copyWithin(0,2,2+c-1),t[c-1]=0,t[c]=0,c--}else c++;t[c]=1,h=!h}throw new I}static toNarrowWidePattern(e){let t=e.length,n=0,s;do{let c=2147483647;for(let g of e)g<c&&g>n&&(c=g);n=c,s=0;let d=0,h=0;for(let g=0;g<t;g++){let _=e[g];_>n&&(h|=1<<t-1-g,s++,d+=_)}if(s===3){for(let g=0;g<t&&s>0;g++){let _=e[g];if(_>n&&(s--,_*2>=d))return-1}return h}}while(s>3);return-1}static patternToChar(e){for(let t=0;t<bt.CHARACTER_ENCODINGS.length;t++)if(bt.CHARACTER_ENCODINGS[t]===e)return bt.ALPHABET_STRING.charAt(t);if(e===bt.ASTERISK_ENCODING)return"*";throw new I}static decodeExtended(e){let t=e.length,n="";for(let s=0;s<t;s++){let c=e.charAt(s);if(c==="+"||c==="$"||c==="%"||c==="/"){let d=e.charAt(s+1),h="\0";switch(c){case"+":if(d>="A"&&d<="Z")h=String.fromCharCode(d.charCodeAt(0)+32);else throw new V;break;case"$":if(d>="A"&&d<="Z")h=String.fromCharCode(d.charCodeAt(0)-64);else throw new V;break;case"%":if(d>="A"&&d<="E")h=String.fromCharCode(d.charCodeAt(0)-38);else if(d>="F"&&d<="J")h=String.fromCharCode(d.charCodeAt(0)-11);else if(d>="K"&&d<="O")h=String.fromCharCode(d.charCodeAt(0)+16);else if(d>="P"&&d<="T")h=String.fromCharCode(d.charCodeAt(0)+43);else if(d==="U")h="\0";else if(d==="V")h="@";else if(d==="W")h="`";else if(d==="X"||d==="Y"||d==="Z")h="";else throw new V;break;case"/":if(d>="A"&&d<="O")h=String.fromCharCode(d.charCodeAt(0)-32);else if(d==="Z")h=":";else throw new V;break}n+=h,s++}else n+=c}return n}}bt.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",bt.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],bt.ASTERISK_ENCODING=148;class tt extends ht{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(e,t,n){let s=this.decodeStart(t),c=this.decodeEnd(t),d=new W;tt.decodeMiddle(t,s[1],c[0],d);let h=d.toString(),g=null;n!=null&&(g=n.get(Z.ALLOWED_LENGTHS)),g==null&&(g=tt.DEFAULT_ALLOWED_LENGTHS);let _=h.length,E=!1,A=0;for(let z of g){if(_===z){E=!0;break}z>A&&(A=z)}if(!E&&_>A&&(E=!0),!E)throw new V;const S=[new ye(s[1],e),new ye(c[0],e)];return new ge(h,null,0,S,xe.ITF,new Date().getTime())}static decodeMiddle(e,t,n,s){let c=new Int32Array(10),d=new Int32Array(5),h=new Int32Array(5);for(c.fill(0),d.fill(0),h.fill(0);t<n;){ht.recordPattern(e,t,c);for(let _=0;_<5;_++){let E=2*_;d[_]=c[E],h[_]=c[E+1]}let g=tt.decodeDigit(d);s.append(g.toString()),g=this.decodeDigit(h),s.append(g.toString()),c.forEach(function(_){t+=_})}}decodeStart(e){let t=tt.skipWhiteSpace(e),n=tt.findGuardPattern(e,t,tt.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 s=t-1;n>0&&s>=0&&!e.get(s);s--)n--;if(n!==0)throw new I}static skipWhiteSpace(e){const t=e.getSize(),n=e.getNextSet(0);if(n===t)throw new I;return n}decodeEnd(e){e.reverse();try{let t=tt.skipWhiteSpace(e),n;try{n=tt.findGuardPattern(e,t,tt.END_PATTERN_REVERSED[0])}catch(c){c instanceof I&&(n=tt.findGuardPattern(e,t,tt.END_PATTERN_REVERSED[1]))}this.validateQuietZone(e,n[0]);let s=n[0];return n[0]=e.getSize()-n[1],n[1]=e.getSize()-s,n}finally{e.reverse()}}static findGuardPattern(e,t,n){let s=n.length,c=new Int32Array(s),d=e.getSize(),h=!1,g=0,_=t;c.fill(0);for(let E=t;E<d;E++)if(e.get(E)!==h)c[g]++;else{if(g===s-1){if(ht.patternMatchVariance(c,n,tt.MAX_INDIVIDUAL_VARIANCE)<tt.MAX_AVG_VARIANCE)return[_,E];_+=c[0]+c[1],v.arraycopy(c,2,c,0,g-1),c[g-1]=0,c[g]=0,g--}else g++;c[g]=1,h=!h}throw new I}static decodeDigit(e){let t=tt.MAX_AVG_VARIANCE,n=-1,s=tt.PATTERNS.length;for(let c=0;c<s;c++){let d=tt.PATTERNS[c],h=ht.patternMatchVariance(e,d,tt.MAX_INDIVIDUAL_VARIANCE);h<t?(t=h,n=c):h===t&&(n=-1)}if(n>=0)return n%10;throw new I}}tt.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])],tt.MAX_AVG_VARIANCE=.38,tt.MAX_INDIVIDUAL_VARIANCE=.5,tt.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],tt.START_PATTERN=Int32Array.from([1,1,1,1]),tt.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class at extends ht{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(e){let t=!1,n,s=0,c=Int32Array.from([0,0,0]);for(;!t;){c=Int32Array.from([0,0,0]),n=at.findGuardPattern(e,s,!1,this.START_END_PATTERN,c);let d=n[0];s=n[1];let h=d-(s-d);h>=0&&(t=e.isRange(h,d,!1))}return n}static checkChecksum(e){return at.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(t===0)return!1;let n=parseInt(e.charAt(t-1),10);return at.getStandardUPCEANChecksum(e.substring(0,t-1))===n}static getStandardUPCEANChecksum(e){let t=e.length,n=0;for(let s=t-1;s>=0;s-=2){let c=e.charAt(s).charCodeAt(0)-48;if(c<0||c>9)throw new V;n+=c}n*=3;for(let s=t-2;s>=0;s-=2){let c=e.charAt(s).charCodeAt(0)-48;if(c<0||c>9)throw new V;n+=c}return(1e3-n)%10}static decodeEnd(e,t){return at.findGuardPattern(e,t,!1,at.START_END_PATTERN,new Int32Array(at.START_END_PATTERN.length).fill(0))}static findGuardPatternWithoutCounters(e,t,n,s){return this.findGuardPattern(e,t,n,s,new Int32Array(s.length))}static findGuardPattern(e,t,n,s,c){let d=e.getSize();t=n?e.getNextUnset(t):e.getNextSet(t);let h=0,g=t,_=s.length,E=n;for(let A=t;A<d;A++)if(e.get(A)!==E)c[h]++;else{if(h===_-1){if(ht.patternMatchVariance(c,s,at.MAX_INDIVIDUAL_VARIANCE)<at.MAX_AVG_VARIANCE)return Int32Array.from([g,A]);g+=c[0]+c[1];let S=c.slice(2,c.length-1);for(let B=0;B<h-1;B++)c[B]=S[B];c[h-1]=0,c[h]=0,h--}else h++;c[h]=1,E=!E}throw new I}static decodeDigit(e,t,n,s){this.recordPattern(e,n,t);let c=this.MAX_AVG_VARIANCE,d=-1,h=s.length;for(let g=0;g<h;g++){let _=s[g],E=ht.patternMatchVariance(t,_,at.MAX_INDIVIDUAL_VARIANCE);E<c&&(c=E,d=g)}if(d>=0)return d;throw new I}}at.MAX_AVG_VARIANCE=.48,at.MAX_INDIVIDUAL_VARIANCE=.7,at.START_END_PATTERN=Int32Array.from([1,1,1]),at.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),at.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),at.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 pe{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 s=this.decodeRowStringBuffer,c=this.decodeMiddle(t,n,s),d=s.toString(),h=pe.parseExtensionString(d),g=[new ye((n[0]+n[1])/2,e),new ye(c,e)],_=new ge(d,null,0,g,xe.UPC_EAN_EXTENSION,new Date().getTime());return h!=null&&_.putAllMetadata(h),_}decodeMiddle(e,t,n){let s=this.decodeMiddleCounters;s[0]=0,s[1]=0,s[2]=0,s[3]=0;let c=e.getSize(),d=t[1],h=0;for(let _=0;_<5&&d<c;_++){let E=at.decodeDigit(e,s,d,at.L_AND_G_PATTERNS);n+=String.fromCharCode(48+E%10);for(let A of s)d+=A;E>=10&&(h|=1<<4-_),_!==4&&(d=e.getNextSet(d),d=e.getNextUnset(d))}if(n.length!==5)throw new I;let g=this.determineCheckDigit(h);if(pe.extensionChecksum(n.toString())!==g)throw new I;return d}static extensionChecksum(e){let t=e.length,n=0;for(let s=t-2;s>=0;s-=2)n+=e.charAt(s).charCodeAt(0)-48;n*=3;for(let s=t-1;s>=0;s-=2)n+=e.charAt(s).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 I}static parseExtensionString(e){if(e.length!==5)return null;let t=pe.parseExtension5String(e);return t==null?null:new Map([[be.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)),s=(n/100).toString(),c=n%100,d=c<10?"0"+c:c.toString();return t+s+"."+d}}class se{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(e,t,n){let s=this.decodeRowStringBuffer,c=this.decodeMiddle(t,n,s),d=s.toString(),h=se.parseExtensionString(d),g=[new ye((n[0]+n[1])/2,e),new ye(c,e)],_=new ge(d,null,0,g,xe.UPC_EAN_EXTENSION,new Date().getTime());return h!=null&&_.putAllMetadata(h),_}decodeMiddle(e,t,n){let s=this.decodeMiddleCounters;s[0]=0,s[1]=0,s[2]=0,s[3]=0;let c=e.getSize(),d=t[1],h=0;for(let g=0;g<2&&d<c;g++){let _=at.decodeDigit(e,s,d,at.L_AND_G_PATTERNS);n+=String.fromCharCode(48+_%10);for(let E of s)d+=E;_>=10&&(h|=1<<1-g),g!==1&&(d=e.getNextSet(d),d=e.getNextUnset(d))}if(n.length!==2)throw new I;if(parseInt(n.toString())%4!==h)throw new I;return d}static parseExtensionString(e){return e.length!==2?null:new Map([[be.ISSUE_NUMBER,parseInt(e)]])}}class $e{static decodeRow(e,t,n){let s=at.findGuardPattern(t,n,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new pe().decodeRow(e,t,s)}catch{return new se().decodeRow(e,t,s)}}}$e.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class Ae extends at{constructor(){super(),this.decodeRowStringBuffer="",Ae.L_AND_G_PATTERNS=Ae.L_PATTERNS.map(e=>Int32Array.from(e));for(let e=10;e<20;e++){let t=Ae.L_PATTERNS[e-10],n=new Int32Array(t.length);for(let s=0;s<t.length;s++)n[s]=t[t.length-s-1];Ae.L_AND_G_PATTERNS[e]=n}}decodeRow(e,t,n){let s=Ae.findStartGuardPattern(t),c=n==null?null:n.get(Z.NEED_RESULT_POINT_CALLBACK);if(c!=null){const le=new ye((s[0]+s[1])/2,e);c.foundPossibleResultPoint(le)}let d=this.decodeMiddle(t,s,this.decodeRowStringBuffer),h=d.rowOffset,g=d.resultString;if(c!=null){const le=new ye(h,e);c.foundPossibleResultPoint(le)}let _=this.decodeEnd(t,h);if(c!=null){const le=new ye((_[0]+_[1])/2,e);c.foundPossibleResultPoint(le)}let E=_[1],A=E+(E-_[0]);if(A>=t.getSize()||!t.isRange(E,A,!1))throw new I;let S=g.toString();if(S.length<8)throw new V;if(!Ae.checkChecksum(S))throw new O;let B=(s[1]+s[0])/2,z=(_[1]+_[0])/2,G=this.getBarcodeFormat(),Y=[new ye(B,e),new ye(z,e)],ie=new ge(S,null,0,Y,G,new Date().getTime()),ue=0;try{let le=$e.decodeRow(e,t,_[1]);ie.putMetadata(be.UPC_EAN_EXTENSION,le.getText()),ie.putAllMetadata(le.getResultMetadata()),ie.addResultPoints(le.getResultPoints()),ue=le.getText().length}catch{}let fe=n==null?null:n.get(Z.ALLOWED_EAN_EXTENSIONS);if(fe!=null){let le=!1;for(let je in fe)if(ue.toString()===je){le=!0;break}if(!le)throw new I}return ie}decodeEnd(e,t){return Ae.findGuardPattern(e,t,!1,Ae.START_END_PATTERN,new Int32Array(Ae.START_END_PATTERN.length).fill(0))}static checkChecksum(e){return Ae.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(t===0)return!1;let n=parseInt(e.charAt(t-1),10);return Ae.getStandardUPCEANChecksum(e.substring(0,t-1))===n}static getStandardUPCEANChecksum(e){let t=e.length,n=0;for(let s=t-1;s>=0;s-=2){let c=e.charAt(s).charCodeAt(0)-48;if(c<0||c>9)throw new V;n+=c}n*=3;for(let s=t-2;s>=0;s-=2){let c=e.charAt(s).charCodeAt(0)-48;if(c<0||c>9)throw new V;n+=c}return(1e3-n)%10}}class zt extends Ae{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(e,t,n){let s=this.decodeMiddleCounters;s[0]=0,s[1]=0,s[2]=0,s[3]=0;let c=e.getSize(),d=t[1],h=0;for(let _=0;_<6&&d<c;_++){let E=Ae.decodeDigit(e,s,d,Ae.L_AND_G_PATTERNS);n+=String.fromCharCode(48+E%10);for(let A of s)d+=A;E>=10&&(h|=1<<5-_)}n=zt.determineFirstDigit(n,h),d=Ae.findGuardPattern(e,d,!0,Ae.MIDDLE_PATTERN,new Int32Array(Ae.MIDDLE_PATTERN.length).fill(0))[1];for(let _=0;_<6&&d<c;_++){let E=Ae.decodeDigit(e,s,d,Ae.L_PATTERNS);n+=String.fromCharCode(48+E);for(let A of s)d+=A}return{rowOffset:d,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 I}}zt.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class An extends Ae{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(e,t,n){const s=this.decodeMiddleCounters;s[0]=0,s[1]=0,s[2]=0,s[3]=0;let c=e.getSize(),d=t[1];for(let g=0;g<4&&d<c;g++){let _=Ae.decodeDigit(e,s,d,Ae.L_PATTERNS);n+=String.fromCharCode(48+_);for(let E of s)d+=E}d=Ae.findGuardPattern(e,d,!0,Ae.MIDDLE_PATTERN,new Int32Array(Ae.MIDDLE_PATTERN.length).fill(0))[1];for(let g=0;g<4&&d<c;g++){let _=Ae.decodeDigit(e,s,d,Ae.L_PATTERNS);n+=String.fromCharCode(48+_);for(let E of s)d+=E}return{rowOffset:d,resultString:n}}getBarcodeFormat(){return xe.EAN_8}}class ct extends Ae{constructor(){super(...arguments),this.ean13Reader=new zt}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 ge(t.substring(1),null,null,e.getResultPoints(),xe.UPC_A);return e.getResultMetadata()!=null&&n.putAllMetadata(e.getResultMetadata()),n}else throw new I}reset(){this.ean13Reader.reset()}}class Pe extends Ae{constructor(){super(),this.decodeMiddleCounters=new Int32Array(4)}decodeMiddle(e,t,n){const s=this.decodeMiddleCounters.map(_=>_);s[0]=0,s[1]=0,s[2]=0,s[3]=0;const c=e.getSize();let d=t[1],h=0;for(let _=0;_<6&&d<c;_++){const E=Pe.decodeDigit(e,s,d,Pe.L_AND_G_PATTERNS);n+=String.fromCharCode(48+E%10);for(let A of s)d+=A;E>=10&&(h|=1<<5-_)}let g=Pe.determineNumSysAndCheckDigit(n,h);return{rowOffset:d,resultString:g}}decodeEnd(e,t){return Pe.findGuardPatternWithoutCounters(e,t,!0,Pe.MIDDLE_END_PATTERN)}checkChecksum(e){return Ae.checkChecksum(Pe.convertUPCEtoUPCA(e))}static determineNumSysAndCheckDigit(e,t){for(let n=0;n<=1;n++)for(let s=0;s<10;s++)if(t===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[n][s]){let c=String.fromCharCode(48+n),d=String.fromCharCode(48+s);return c+e+d}throw I.getNotFoundInstance()}getBarcodeFormat(){return xe.UPC_E}static convertUPCEtoUPCA(e){const t=e.slice(1,7).split("").map(c=>c.charCodeAt(0)),n=new W;n.append(e.charAt(0));let s=t[5];switch(s){case 0:case 1:case 2:n.appendChars(t,0,2),n.append(s),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(s);break}return e.length>=8&&n.append(e.charAt(7)),n.toString()}}Pe.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),Pe.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 qt extends ht{constructor(e){super();let t=e==null?null:e.get(Z.POSSIBLE_FORMATS),n=[];i(t)?(n.push(new zt),n.push(new ct),n.push(new An),n.push(new Pe)):(t.indexOf(xe.EAN_13)>-1&&n.push(new zt),t.indexOf(xe.UPC_A)>-1&&n.push(new ct),t.indexOf(xe.EAN_8)>-1&&n.push(new An),t.indexOf(xe.UPC_E)>-1&&n.push(new Pe)),this.readers=n}decodeRow(e,t,n){for(let s of this.readers)try{const c=s.decodeRow(e,t,n),d=c.getBarcodeFormat()===xe.EAN_13&&c.getText().charAt(0)==="0",h=n==null?null:n.get(Z.POSSIBLE_FORMATS),g=h==null||h.includes(xe.UPC_A);if(d&&g){const _=c.getRawBytes(),E=new ge(c.getText().substring(1),_,_?_.length:null,c.getResultPoints(),xe.UPC_A);return E.putAllMetadata(c.getResultMetadata()),E}return c}catch{}throw new I}reset(){for(let e of this.readers)e.reset()}}class Ye extends ht{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(ht.patternMatchVariance(e,t[n],Ye.MAX_INDIVIDUAL_VARIANCE)<Ye.MAX_AVG_VARIANCE)return n;throw new I}static count(e){return ve.sum(new Int32Array(e))}static increment(e,t){let n=0,s=t[0];for(let c=1;c<e.length;c++)t[c]>s&&(s=t[c],n=c);e[n]++}static decrement(e,t){let n=0,s=t[0];for(let c=1;c<e.length;c++)t[c]<s&&(s=t[c],n=c);e[n]--}static isFinderPattern(e){let t=e[0]+e[1],n=t+e[2]+e[3],s=t/n;if(s>=Ye.MIN_FINDER_PATTERN_RATIO&&s<=Ye.MAX_FINDER_PATTERN_RATIO){let c=Number.MAX_SAFE_INTEGER,d=Number.MIN_SAFE_INTEGER;for(let h of e)h>d&&(d=h),h<c&&(c=h);return d<10*c}return!1}}Ye.MAX_AVG_VARIANCE=.2,Ye.MAX_INDIVIDUAL_VARIANCE=.45,Ye.MIN_FINDER_PATTERN_RATIO=9.5/12,Ye.MAX_FINDER_PATTERN_RATIO=12.5/14;class Ct{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 Ct))return!1;const t=e;return this.value===t.value&&this.checksumPortion===t.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class Nt{constructor(e,t,n,s,c){this.value=e,this.startEnd=t,this.value=e,this.startEnd=t,this.resultPoints=new Array,this.resultPoints.push(new ye(n,c)),this.resultPoints.push(new ye(s,c))}getValue(){return this.value}getStartEnd(){return this.startEnd}getResultPoints(){return this.resultPoints}equals(e){if(!(e instanceof Nt))return!1;const t=e;return this.value===t.value}hashCode(){return this.value}}class pt{constructor(){}static getRSSvalue(e,t,n){let s=0;for(let g of e)s+=g;let c=0,d=0,h=e.length;for(let g=0;g<h-1;g++){let _;for(_=1,d|=1<<g;_<e[g];_++,d&=~(1<<g)){let E=pt.combins(s-_-1,h-g-2);if(n&&d===0&&s-_-(h-g-1)>=h-g-1&&(E-=pt.combins(s-_-(h-g),h-g-2)),h-g-1>1){let A=0;for(let S=s-_-(h-g-2);S>t;S--)A+=pt.combins(s-_-S-1,h-g-3);E-=A*(h-1-g)}else s-_>t&&E--;c+=E}s-=_}return c}static combins(e,t){let n,s;e-t>t?(s=t,n=e-t):(s=e-t,n=t);let c=1,d=1;for(let h=e;h>n;h--)c*=h,d<=s&&(c/=d,d++);for(;d<=s;)c/=d,d++;return c}}class ze{static buildBitArray(e){let t=e.length*2-1;e[e.length-1].getRightChar()==null&&(t-=1);let n=12*t,s=new F(n),c=0,h=e[0].getRightChar().getValue();for(let g=11;g>=0;--g)h&1<<g&&s.set(c),c++;for(let g=1;g<e.length;++g){let _=e[g],E=_.getLeftChar().getValue();for(let A=11;A>=0;--A)E&1<<A&&s.set(c),c++;if(_.getRightChar()!=null){let A=_.getRightChar().getValue();for(let S=11;S>=0;--S)A&1<<S&&s.set(c),c++}}return s}}class un{constructor(e,t){t?this.decodedInformation=null:(this.finished=e,this.decodedInformation=t)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class Wn{constructor(e){this.newPosition=e}getNewPosition(){return this.newPosition}}class Zt extends Wn{constructor(e,t){super(e),this.value=t}getValue(){return this.value}isFNC1(){return this.value===Zt.FNC1}}Zt.FNC1="$";class lr extends Wn{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 mn extends Wn{constructor(e,t,n){if(super(e),t<0||t>10||n<0||n>10)throw new V;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===mn.FNC1}isSecondDigitFNC1(){return this.secondDigit===mn.FNC1}isAnyFNC1(){return this.firstDigit===mn.FNC1||this.secondDigit===mn.FNC1}}mn.FNC1=10;class Ee{constructor(){}static parseFieldsInGeneralPurpose(e){if(!e)return null;if(e.length<2)throw new I;let t=e.substring(0,2);for(let c of Ee.TWO_DIGIT_DATA_LENGTH)if(c[0]===t)return c[1]===Ee.VARIABLE_LENGTH?Ee.processVariableAI(2,c[2],e):Ee.processFixedAI(2,c[1],e);if(e.length<3)throw new I;let n=e.substring(0,3);for(let c of Ee.THREE_DIGIT_DATA_LENGTH)if(c[0]===n)return c[1]===Ee.VARIABLE_LENGTH?Ee.processVariableAI(3,c[2],e):Ee.processFixedAI(3,c[1],e);for(let c of Ee.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(c[0]===n)return c[1]===Ee.VARIABLE_LENGTH?Ee.processVariableAI(4,c[2],e):Ee.processFixedAI(4,c[1],e);if(e.length<4)throw new I;let s=e.substring(0,4);for(let c of Ee.FOUR_DIGIT_DATA_LENGTH)if(c[0]===s)return c[1]===Ee.VARIABLE_LENGTH?Ee.processVariableAI(4,c[2],e):Ee.processFixedAI(4,c[1],e);throw new I}static processFixedAI(e,t,n){if(n.length<e)throw new I;let s=n.substring(0,e);if(n.length<e+t)throw new I;let c=n.substring(e,e+t),d=n.substring(e+t),h="("+s+")"+c,g=Ee.parseFieldsInGeneralPurpose(d);return g==null?h:h+g}static processVariableAI(e,t,n){let s=n.substring(0,e),c;n.length<e+t?c=n.length:c=e+t;let d=n.substring(e,c),h=n.substring(c),g="("+s+")"+d,_=Ee.parseFieldsInGeneralPurpose(h);return _==null?g:g+_}}Ee.VARIABLE_LENGTH=[],Ee.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",Ee.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",Ee.VARIABLE_LENGTH,20],["22",Ee.VARIABLE_LENGTH,29],["30",Ee.VARIABLE_LENGTH,8],["37",Ee.VARIABLE_LENGTH,8],["90",Ee.VARIABLE_LENGTH,30],["91",Ee.VARIABLE_LENGTH,30],["92",Ee.VARIABLE_LENGTH,30],["93",Ee.VARIABLE_LENGTH,30],["94",Ee.VARIABLE_LENGTH,30],["95",Ee.VARIABLE_LENGTH,30],["96",Ee.VARIABLE_LENGTH,30],["97",Ee.VARIABLE_LENGTH,3],["98",Ee.VARIABLE_LENGTH,30],["99",Ee.VARIABLE_LENGTH,30]],Ee.THREE_DIGIT_DATA_LENGTH=[["240",Ee.VARIABLE_LENGTH,30],["241",Ee.VARIABLE_LENGTH,30],["242",Ee.VARIABLE_LENGTH,6],["250",Ee.VARIABLE_LENGTH,30],["251",Ee.VARIABLE_LENGTH,30],["253",Ee.VARIABLE_LENGTH,17],["254",Ee.VARIABLE_LENGTH,20],["400",Ee.VARIABLE_LENGTH,30],["401",Ee.VARIABLE_LENGTH,30],["402",17],["403",Ee.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",Ee.VARIABLE_LENGTH,20],["421",Ee.VARIABLE_LENGTH,15],["422",3],["423",Ee.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],Ee.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",Ee.VARIABLE_LENGTH,15],["391",Ee.VARIABLE_LENGTH,18],["392",Ee.VARIABLE_LENGTH,15],["393",Ee.VARIABLE_LENGTH,18],["703",Ee.VARIABLE_LENGTH,30]],Ee.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",Ee.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",Ee.VARIABLE_LENGTH,20],["8003",Ee.VARIABLE_LENGTH,30],["8004",Ee.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",Ee.VARIABLE_LENGTH,30],["8008",Ee.VARIABLE_LENGTH,12],["8018",18],["8020",Ee.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",Ee.VARIABLE_LENGTH,70],["8200",Ee.VARIABLE_LENGTH,70]];class Ir{constructor(e){this.buffer=new W,this.information=e}decodeAllCodes(e,t){let n=t,s=null;do{let c=this.decodeGeneralPurposeField(n,s),d=Ee.parseFieldsInGeneralPurpose(c.getNewString());if(d!=null&&e.append(d),c.isRemaining()?s=""+c.getRemainingValue():s=null,n===c.getNewPosition())break;n=c.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 c=this.extractNumericValueFromBitArray(e,4);return c===0?new mn(this.information.getSize(),mn.FNC1,mn.FNC1):new mn(this.information.getSize(),c-1,mn.FNC1)}let t=this.extractNumericValueFromBitArray(e,7),n=(t-8)/11,s=(t-8)%11;return new mn(e+7,n,s)}extractNumericValueFromBitArray(e,t){return Ir.extractNumericValueFromBitArray(this.information,e,t)}static extractNumericValueFromBitArray(e,t,n){let s=0;for(let c=0;c<n;++c)e.get(t+c)&&(s|=1<<n-c-1);return s}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 lr(this.current.getPosition(),this.buffer.toString(),n.getRemainingValue()):new lr(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 lr(this.current.getPosition(),this.buffer.toString()):t=new lr(this.current.getPosition(),this.buffer.toString(),e.getSecondDigit()),new un(!0,t)}if(this.buffer.append(e.getFirstDigit()),e.isSecondDigitFNC1()){let t=new lr(this.current.getPosition(),this.buffer.toString());return new un(!0,t)}this.buffer.append(e.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new un(!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 lr(this.current.getPosition(),this.buffer.toString());return new un(!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 un(!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 lr(this.current.getPosition(),this.buffer.toString());return new un(!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 un(!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 s=this.extractNumericValueFromBitArray(e,8);return s>=232&&s<253}decodeIsoIec646(e){let t=this.extractNumericValueFromBitArray(e,5);if(t===15)return new Zt(e+5,Zt.FNC1);if(t>=5&&t<15)return new Zt(e+5,"0"+(t-5));let n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<90)return new Zt(e+7,""+(n+1));if(n>=90&&n<116)return new Zt(e+7,""+(n+7));let s=this.extractNumericValueFromBitArray(e,8),c;switch(s){case 232:c="!";break;case 233:c='"';break;case 234:c="%";break;case 235:c="&";break;case 236:c="'";break;case 237:c="(";break;case 238:c=")";break;case 239:c="*";break;case 240:c="+";break;case 241:c=",";break;case 242:c="-";break;case 243:c=".";break;case 244:c="/";break;case 245:c=":";break;case 246:c=";";break;case 247:c="<";break;case 248:c="=";break;case 249:c=">";break;case 250:c="?";break;case 251:c="_";break;case 252:c=" ";break;default:throw new V}return new Zt(e+8,c)}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 Zt(e+5,Zt.FNC1);if(t>=5&&t<15)return new Zt(e+5,"0"+(t-5));let n=this.extractNumericValueFromBitArray(e,6);if(n>=32&&n<58)return new Zt(e+6,""+(n+33));let s;switch(n){case 58:s="*";break;case 59:s=",";break;case 60:s="-";break;case 61:s=".";break;case 62:s="/";break;default:throw new Ue("Decoding invalid alphanumeric value: "+n)}return new Zt(e+6,s)}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 Mo{constructor(e){this.information=e,this.generalDecoder=new Ir(e)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class tn extends Mo{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 s=0;s<4;++s){let c=this.getGeneralDecoder().extractNumericValueFromBitArray(t+10*s,10);c/100===0&&e.append("0"),c/10===0&&e.append("0"),e.append(c)}tn.appendCheckDigit(e,n)}static appendCheckDigit(e,t){let n=0;for(let s=0;s<13;s++){let c=e.charAt(s+t).charCodeAt(0)-48;n+=s&1?c:3*c}n=10-n%10,n===10&&(n=0),e.append(n)}}tn.GTIN_SIZE=40;class Nr extends tn{constructor(e){super(e)}parseInformation(){let e=new W;e.append("(01)");let t=e.length(),n=this.getGeneralDecoder().extractNumericValueFromBitArray(Nr.HEADER_SIZE,4);return e.append(n),this.encodeCompressedGtinWithoutAI(e,Nr.HEADER_SIZE+4,t),this.getGeneralDecoder().decodeAllCodes(e,Nr.HEADER_SIZE+44)}}Nr.HEADER_SIZE=4;class Oi extends Mo{constructor(e){super(e)}parseInformation(){let e=new W;return this.getGeneralDecoder().decodeAllCodes(e,Oi.HEADER_SIZE)}}Oi.HEADER_SIZE=5;class Mi extends tn{constructor(e){super(e)}encodeCompressedWeight(e,t,n){let s=this.getGeneralDecoder().extractNumericValueFromBitArray(t,n);this.addWeightCode(e,s);let c=this.checkWeight(s),d=1e5;for(let h=0;h<5;++h)c/d===0&&e.append("0"),d/=10;e.append(c)}}class Bn extends Mi{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()!=Bn.HEADER_SIZE+Mi.GTIN_SIZE+Bn.WEIGHT_SIZE)throw new I;let e=new W;return this.encodeCompressedGtin(e,Bn.HEADER_SIZE),this.encodeCompressedWeight(e,Bn.HEADER_SIZE+Mi.GTIN_SIZE,Bn.WEIGHT_SIZE),e.toString()}}Bn.HEADER_SIZE=5,Bn.WEIGHT_SIZE=15;class hg extends Bn{constructor(e){super(e)}addWeightCode(e,t){e.append("(3103)")}checkWeight(e){return e}}class mg extends Bn{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 tn{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<On.HEADER_SIZE+tn.GTIN_SIZE)throw new I;let e=new W;this.encodeCompressedGtin(e,On.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(On.HEADER_SIZE+tn.GTIN_SIZE,On.LAST_DIGIT_SIZE);e.append("(392"),e.append(t),e.append(")");let n=this.getGeneralDecoder().decodeGeneralPurposeField(On.HEADER_SIZE+tn.GTIN_SIZE+On.LAST_DIGIT_SIZE,null);return e.append(n.getNewString()),e.toString()}}On.HEADER_SIZE=8,On.LAST_DIGIT_SIZE=2;class Yt extends tn{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<Yt.HEADER_SIZE+tn.GTIN_SIZE)throw new I;let e=new W;this.encodeCompressedGtin(e,Yt.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(Yt.HEADER_SIZE+tn.GTIN_SIZE,Yt.LAST_DIGIT_SIZE);e.append("(393"),e.append(t),e.append(")");let n=this.getGeneralDecoder().extractNumericValueFromBitArray(Yt.HEADER_SIZE+tn.GTIN_SIZE+Yt.LAST_DIGIT_SIZE,Yt.FIRST_THREE_DIGITS_SIZE);n/100==0&&e.append("0"),n/10==0&&e.append("0"),e.append(n);let s=this.getGeneralDecoder().decodeGeneralPurposeField(Yt.HEADER_SIZE+tn.GTIN_SIZE+Yt.LAST_DIGIT_SIZE+Yt.FIRST_THREE_DIGITS_SIZE,null);return e.append(s.getNewString()),e.toString()}}Yt.HEADER_SIZE=8,Yt.LAST_DIGIT_SIZE=2,Yt.FIRST_THREE_DIGITS_SIZE=10;class Et extends Mi{constructor(e,t,n){super(e),this.dateCode=n,this.firstAIdigits=t}parseInformation(){if(this.getInformation().getSize()!=Et.HEADER_SIZE+Et.GTIN_SIZE+Et.WEIGHT_SIZE+Et.DATE_SIZE)throw new I;let e=new W;return this.encodeCompressedGtin(e,Et.HEADER_SIZE),this.encodeCompressedWeight(e,Et.HEADER_SIZE+Et.GTIN_SIZE,Et.WEIGHT_SIZE),this.encodeCompressedDate(e,Et.HEADER_SIZE+Et.GTIN_SIZE+Et.WEIGHT_SIZE),e.toString()}encodeCompressedDate(e,t){let n=this.getGeneralDecoder().extractNumericValueFromBitArray(t,Et.DATE_SIZE);if(n==38400)return;e.append("("),e.append(this.dateCode),e.append(")");let s=n%32;n/=32;let c=n%12+1;n/=12;let d=n;d/10==0&&e.append("0"),e.append(d),c/10==0&&e.append("0"),e.append(c),s/10==0&&e.append("0"),e.append(s)}addWeightCode(e,t){e.append("("),e.append(this.firstAIdigits),e.append(t/1e5),e.append(")")}checkWeight(e){return e%1e5}}Et.HEADER_SIZE=8,Et.WEIGHT_SIZE=20,Et.DATE_SIZE=16;function $a(b){try{if(b.get(1))return new Nr(b);if(!b.get(2))return new Oi(b);switch(Ir.extractNumericValueFromBitArray(b,1,4)){case 4:return new hg(b);case 5:return new mg(b)}switch(Ir.extractNumericValueFromBitArray(b,1,5)){case 12:return new On(b);case 13:return new Yt(b)}switch(Ir.extractNumericValueFromBitArray(b,1,7)){case 56:return new Et(b,"310","11");case 57:return new Et(b,"320","11");case 58:return new Et(b,"310","13");case 59:return new Et(b,"320","13");case 60:return new Et(b,"310","15");case 61:return new Et(b,"320","15");case 62:return new Et(b,"310","17");case 63:return new Et(b,"320","17")}}catch(e){throw console.log(e),new Ue("unknown decoder: "+b)}}class Xn{constructor(e,t,n,s){this.leftchar=e,this.rightchar=t,this.finderpattern=n,this.maybeLast=s}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 Xn?Xn.equalsOrNull(e.leftchar,t.leftchar)&&Xn.equalsOrNull(e.rightchar,t.rightchar)&&Xn.equalsOrNull(e.finderpattern,t.finderpattern):!1}static equalsOrNull(e,t){return e===null?t===null:Xn.equals(e,t)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class Do{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 Do?this.checkEqualitity(e,t)&&e.wasReversed===t.wasReversed:!1}checkEqualitity(e,t){if(!e||!t)return;let n;return e.forEach((s,c)=>{t.forEach(d=>{s.getLeftChar().getValue()===d.getLeftChar().getValue()&&s.getRightChar().getValue()===d.getRightChar().getValue()&&s.getFinderPatter().getValue()===d.getFinderPatter().getValue()&&(n=!0)})}),n}}class ae extends Ye{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(s){this.verbose&&console.log(s)}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(c){if(c instanceof I){if(!this.pairs.length)throw new I;n=!0}}if(this.checkChecksum())return this.pairs;let s;if(this.rows.length?s=!0:s=!1,this.storeRow(e,!1),s){let c=this.checkRowsBoolean(!1);if(c!=null||(c=this.checkRowsBoolean(!0),c!=null))return c}throw new I}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 s=this.rows[n];this.pairs.length=0;for(let d of e)this.pairs.push(d.getPairs());if(this.pairs.push(s.getPairs()),!ae.isValidSequence(this.pairs))continue;if(this.checkChecksum())return this.pairs;let c=new Array(e);c.push(s);try{return this.checkRows(c,n+1)}catch(d){this.verbose&&console.log(d)}}throw new I}static isValidSequence(e){for(let t of ae.FINDER_PATTERN_SEQUENCES){if(e.length>t.length)continue;let n=!0;for(let s=0;s<e.length;s++)if(e[s].getFinderPattern().getValue()!=t[s]){n=!1;break}if(n)return!0}return!1}storeRow(e,t){let n=0,s=!1,c=!1;for(;n<this.rows.length;){let d=this.rows[n];if(d.getRowNumber()>e){c=d.isEquivalent(this.pairs);break}s=d.isEquivalent(this.pairs),n++}c||s||ae.isPartialRow(this.pairs,this.rows)||(this.rows.push(n,new Do(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 s of n.getPairs())for(let c of e)if(Xn.equals(s,c))break}}static isPartialRow(e,t){for(let n of t){let s=!0;for(let c of e){let d=!1;for(let h of n.getPairs())if(c.equals(h)){d=!0;break}if(!d){s=!1;break}}if(s)return!0}return!1}getRows(){return this.rows}static constructResult(e){let t=ze.buildBitArray(e),s=$a(t).parseInformation(),c=e[0].getFinderPattern().getResultPoints(),d=e[e.length-1].getFinderPattern().getResultPoints(),h=[c[0],c[1],d[0],d[1]];return new ge(s,null,null,h,xe.RSS_EXPANDED,null)}checkChecksum(){let e=this.pairs.get(0),t=e.getLeftChar(),n=e.getRightChar();if(n==null)return!1;let s=n.getChecksumPortion(),c=2;for(let h=1;h<this.pairs.size();++h){let g=this.pairs.get(h);s+=g.getLeftChar().getChecksumPortion(),c++;let _=g.getRightChar();_!=null&&(s+=_.getChecksumPortion(),c++)}return s%=211,211*(c-4)+s==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 s=t.length%2==0;this.startFromEven&&(s=!s);let c,d=!0,h=-1;do this.findNextPair(e,t,h),c=this.parseFoundFinderPattern(e,n,s),c==null?h=ae.getNextSecondBar(e,this.startEnd[0]):d=!1;while(d);let g=this.decodeDataCharacter(e,c,s,!0);if(!this.isEmptyPair(t)&&t[t.length-1].mustBeLast())throw new I;let _;try{_=this.decodeDataCharacter(e,c,s,!1)}catch(E){_=null,this.verbose&&console.log(E)}return new Xn(g,_,c,!0)}isEmptyPair(e){return e.length===0}findNextPair(e,t,n){let s=this.getDecodeFinderCounters();s[0]=0,s[1]=0,s[2]=0,s[3]=0;let c=e.getSize(),d;n>=0?d=n:this.isEmptyPair(t)?d=0:d=t[t.length-1].getFinderPattern().getStartEnd()[1];let h=t.length%2!=0;this.startFromEven&&(h=!h);let g=!1;for(;d<c&&(g=!e.get(d),!!g);)d++;let _=0,E=d;for(let A=d;A<c;A++)if(e.get(A)!=g)s[_]++;else{if(_==3){if(h&&ae.reverseCounters(s),ae.isFinderPattern(s)){this.startEnd[0]=E,this.startEnd[1]=A;return}h&&ae.reverseCounters(s),E+=s[0]+s[1],s[0]=s[2],s[1]=s[3],s[2]=0,s[3]=0,_--}else _++;s[_]=1,g=!g}throw new I}static reverseCounters(e){let t=e.length;for(let n=0;n<t/2;++n){let s=e[n];e[n]=e[t-n-1],e[t-n-1]=s}}parseFoundFinderPattern(e,t,n){let s,c,d;if(n){let _=this.startEnd[0]-1;for(;_>=0&&!e.get(_);)_--;_++,s=this.startEnd[0]-_,c=_,d=this.startEnd[1]}else c=this.startEnd[0],d=e.getNextUnset(this.startEnd[1]+1),s=d-this.startEnd[1];let h=this.getDecodeFinderCounters();v.arraycopy(h,0,h,1,h.length-1),h[0]=s;let g;try{g=this.parseFinderValue(h,ae.FINDER_PATTERNS)}catch{return null}return new Nt(g,[c,d],c,d,t)}decodeDataCharacter(e,t,n,s){let c=this.getDataCharacterCounters();for(let ut=0;ut<c.length;ut++)c[ut]=0;if(s)ae.recordPatternInReverse(e,t.getStartEnd()[0],c);else{ae.recordPattern(e,t.getStartEnd()[1],c);for(let ut=0,Wt=c.length-1;ut<Wt;ut++,Wt--){let fn=c[ut];c[ut]=c[Wt],c[Wt]=fn}}let d=17,h=ve.sum(new Int32Array(c))/d,g=(t.getStartEnd()[1]-t.getStartEnd()[0])/15;if(Math.abs(h-g)/g>.3)throw new I;let _=this.getOddCounts(),E=this.getEvenCounts(),A=this.getOddRoundingErrors(),S=this.getEvenRoundingErrors();for(let ut=0;ut<c.length;ut++){let Wt=1*c[ut]/h,fn=Wt+.5;if(fn<1){if(Wt<.3)throw new I;fn=1}else if(fn>8){if(Wt>8.7)throw new I;fn=8}let Or=ut/2;ut&1?(E[Or]=fn,S[Or]=Wt-fn):(_[Or]=fn,A[Or]=Wt-fn)}this.adjustOddEvenCounts(d);let B=4*t.getValue()+(n?0:2)+(s?0:1)-1,z=0,G=0;for(let ut=_.length-1;ut>=0;ut--){if(ae.isNotA1left(t,n,s)){let Wt=ae.WEIGHTS[B][2*ut];G+=_[ut]*Wt}z+=_[ut]}let Y=0;for(let ut=E.length-1;ut>=0;ut--)if(ae.isNotA1left(t,n,s)){let Wt=ae.WEIGHTS[B][2*ut+1];Y+=E[ut]*Wt}let ie=G+Y;if(z&1||z>13||z<4)throw new I;let ue=(13-z)/2,fe=ae.SYMBOL_WIDEST[ue],le=9-fe,je=pt.getRSSvalue(_,fe,!0),Fe=pt.getRSSvalue(E,le,!1),rn=ae.EVEN_TOTAL_SUBSET[ue],Sn=ae.GSUM[ue],on=je*rn+Fe+Sn;return new Ct(on,ie)}static isNotA1left(e,t,n){return!(e.getValue()==0&&t&&n)}adjustOddEvenCounts(e){let t=ve.sum(new Int32Array(this.getOddCounts())),n=ve.sum(new Int32Array(this.getEvenCounts())),s=!1,c=!1;t>13?c=!0:t<4&&(s=!0);let d=!1,h=!1;n>13?h=!0:n<4&&(d=!0);let g=t+n-e,_=(t&1)==1,E=(n&1)==0;if(g==1)if(_){if(E)throw new I;c=!0}else{if(!E)throw new I;h=!0}else if(g==-1)if(_){if(E)throw new I;s=!0}else{if(!E)throw new I;d=!0}else if(g==0){if(_){if(!E)throw new I;t<n?(s=!0,h=!0):(c=!0,d=!0)}else if(E)throw new I}else throw new I;if(s){if(c)throw new I;ae.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(c&&ae.decrement(this.getOddCounts(),this.getOddRoundingErrors()),d){if(h)throw new I;ae.increment(this.getEvenCounts(),this.getOddRoundingErrors())}h&&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 gg extends Ct{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 Tt extends Ye{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(e,t,n){const s=this.decodePair(t,!1,e,n);Tt.addOrTally(this.possibleLeftPairs,s),t.reverse();let c=this.decodePair(t,!0,e,n);Tt.addOrTally(this.possibleRightPairs,c),t.reverse();for(let d of this.possibleLeftPairs)if(d.getCount()>1){for(let h of this.possibleRightPairs)if(h.getCount()>1&&Tt.checkChecksum(d,h))return Tt.constructResult(d,h)}throw new I}static addOrTally(e,t){if(t==null)return;let n=!1;for(let s of e)if(s.getValue()===t.getValue()){s.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(),s=new String(n).toString(),c=new W;for(let _=13-s.length;_>0;_--)c.append("0");c.append(s);let d=0;for(let _=0;_<13;_++){let E=c.charAt(_).charCodeAt(0)-48;d+=_&1?E:3*E}d=10-d%10,d===10&&(d=0),c.append(d.toString());let h=e.getFinderPattern().getResultPoints(),g=t.getFinderPattern().getResultPoints();return new ge(c.toString(),null,0,[h[0],h[1],g[0],g[1]],xe.RSS_14,new Date().getTime())}static checkChecksum(e,t){let n=(e.getChecksumPortion()+16*t.getChecksumPortion())%79,s=9*e.getFinderPattern().getValue()+t.getFinderPattern().getValue();return s>72&&s--,s>8&&s--,n===s}decodePair(e,t,n,s){try{let c=this.findFinderPattern(e,t),d=this.parseFoundFinderPattern(e,n,t,c),h=s==null?null:s.get(Z.NEED_RESULT_POINT_CALLBACK);if(h!=null){let E=(c[0]+c[1])/2;t&&(E=e.getSize()-1-E),h.foundPossibleResultPoint(new ye(E,n))}let g=this.decodeDataCharacter(e,d,!0),_=this.decodeDataCharacter(e,d,!1);return new gg(1597*g.getValue()+_.getValue(),g.getChecksumPortion()+4*_.getChecksumPortion(),d)}catch{return null}}decodeDataCharacter(e,t,n){let s=this.getDataCharacterCounters();for(let Y=0;Y<s.length;Y++)s[Y]=0;if(n)ht.recordPatternInReverse(e,t.getStartEnd()[0],s);else{ht.recordPattern(e,t.getStartEnd()[1]+1,s);for(let Y=0,ie=s.length-1;Y<ie;Y++,ie--){let ue=s[Y];s[Y]=s[ie],s[ie]=ue}}let c=n?16:15,d=ve.sum(new Int32Array(s))/c,h=this.getOddCounts(),g=this.getEvenCounts(),_=this.getOddRoundingErrors(),E=this.getEvenRoundingErrors();for(let Y=0;Y<s.length;Y++){let ie=s[Y]/d,ue=Math.floor(ie+.5);ue<1?ue=1:ue>8&&(ue=8);let fe=Math.floor(Y/2);Y&1?(g[fe]=ue,E[fe]=ie-ue):(h[fe]=ue,_[fe]=ie-ue)}this.adjustOddEvenCounts(n,c);let A=0,S=0;for(let Y=h.length-1;Y>=0;Y--)S*=9,S+=h[Y],A+=h[Y];let B=0,z=0;for(let Y=g.length-1;Y>=0;Y--)B*=9,B+=g[Y],z+=g[Y];let G=S+3*B;if(n){if(A&1||A>12||A<4)throw new I;let Y=(12-A)/2,ie=Tt.OUTSIDE_ODD_WIDEST[Y],ue=9-ie,fe=pt.getRSSvalue(h,ie,!1),le=pt.getRSSvalue(g,ue,!0),je=Tt.OUTSIDE_EVEN_TOTAL_SUBSET[Y],Fe=Tt.OUTSIDE_GSUM[Y];return new Ct(fe*je+le+Fe,G)}else{if(z&1||z>10||z<4)throw new I;let Y=(10-z)/2,ie=Tt.INSIDE_ODD_WIDEST[Y],ue=9-ie,fe=pt.getRSSvalue(h,ie,!0),le=pt.getRSSvalue(g,ue,!1),je=Tt.INSIDE_ODD_TOTAL_SUBSET[Y],Fe=Tt.INSIDE_GSUM[Y];return new Ct(le*je+fe+Fe,G)}}findFinderPattern(e,t){let n=this.getDecodeFinderCounters();n[0]=0,n[1]=0,n[2]=0,n[3]=0;let s=e.getSize(),c=!1,d=0;for(;d<s&&(c=!e.get(d),t!==c);)d++;let h=0,g=d;for(let _=d;_<s;_++)if(e.get(_)!==c)n[h]++;else{if(h===3){if(Ye.isFinderPattern(n))return[g,_];g+=n[0]+n[1],n[0]=n[2],n[1]=n[3],n[2]=0,n[3]=0,h--}else h++;n[h]=1,c=!c}throw new I}parseFoundFinderPattern(e,t,n,s){let c=e.get(s[0]),d=s[0]-1;for(;d>=0&&c!==e.get(d);)d--;d++;const h=s[0]-d,g=this.getDecodeFinderCounters(),_=new Int32Array(g.length);v.arraycopy(g,0,_,1,g.length-1),_[0]=h;const E=this.parseFinderValue(_,Tt.FINDER_PATTERNS);let A=d,S=s[1];return n&&(A=e.getSize()-1-A,S=e.getSize()-1-S),new Nt(E,[d,s[1]],A,S,t)}adjustOddEvenCounts(e,t){let n=ve.sum(new Int32Array(this.getOddCounts())),s=ve.sum(new Int32Array(this.getEvenCounts())),c=!1,d=!1,h=!1,g=!1;e?(n>12?d=!0:n<4&&(c=!0),s>12?g=!0:s<4&&(h=!0)):(n>11?d=!0:n<5&&(c=!0),s>10?g=!0:s<4&&(h=!0));let _=n+s-t,E=(n&1)===(e?1:0),A=(s&1)===1;if(_===1)if(E){if(A)throw new I;d=!0}else{if(!A)throw new I;g=!0}else if(_===-1)if(E){if(A)throw new I;c=!0}else{if(!A)throw new I;h=!0}else if(_===0){if(E){if(!A)throw new I;n<s?(c=!0,g=!0):(d=!0,h=!0)}else if(A)throw new I}else throw new I;if(c){if(d)throw new I;Ye.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(d&&Ye.decrement(this.getOddCounts(),this.getOddRoundingErrors()),h){if(g)throw new I;Ye.increment(this.getEvenCounts(),this.getOddRoundingErrors())}g&&Ye.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}Tt.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],Tt.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],Tt.OUTSIDE_GSUM=[0,161,961,2015,2715],Tt.INSIDE_GSUM=[0,336,1036,1516],Tt.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],Tt.INSIDE_ODD_WIDEST=[2,4,6,8],Tt.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 Tr extends ht{constructor(e,t){super(),this.readers=[],this.verbose=t===!0;const n=e?e.get(Z.POSSIBLE_FORMATS):null,s=e&&e.get(Z.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 qt(e)),n.includes(xe.CODE_39)&&this.readers.push(new bt(s)),n.includes(xe.CODE_128)&&this.readers.push(new me),n.includes(xe.ITF)&&this.readers.push(new tt),n.includes(xe.RSS_14)&&this.readers.push(new Tt),n.includes(xe.RSS_EXPANDED)&&this.readers.push(new ae(this.verbose))):(this.readers.push(new qt(e)),this.readers.push(new bt),this.readers.push(new qt(e)),this.readers.push(new me),this.readers.push(new tt),this.readers.push(new Tt),this.readers.push(new ae(this.verbose)))}decodeRow(e,t,n){for(let s=0;s<this.readers.length;s++)try{return this.readers[s].decodeRow(e,t,n)}catch{}throw new I}reset(){this.readers.forEach(e=>e.reset())}}class pg extends Ce{constructor(e=500,t){super(new Tr(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 qe{constructor(e,t,n,s,c,d){this.versionNumber=e,this.symbolSizeRows=t,this.symbolSizeColumns=n,this.dataRegionSizeRows=s,this.dataRegionSizeColumns=c,this.ecBlocks=d;let h=0;const g=d.getECCodewords(),_=d.getECBlocks();for(let E of _)h+=E.getCount()*(E.getDataCodewords()+g);this.totalCodewords=h}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 V;for(let n of qe.VERSIONS)if(n.symbolSizeRows===e&&n.symbolSizeColumns===t)return n;throw new V}toString(){return""+this.versionNumber}static buildVersions(){return[new qe(1,10,10,8,8,new nt(5,new Je(1,3))),new qe(2,12,12,10,10,new nt(7,new Je(1,5))),new qe(3,14,14,12,12,new nt(10,new Je(1,8))),new qe(4,16,16,14,14,new nt(12,new Je(1,12))),new qe(5,18,18,16,16,new nt(14,new Je(1,18))),new qe(6,20,20,18,18,new nt(18,new Je(1,22))),new qe(7,22,22,20,20,new nt(20,new Je(1,30))),new qe(8,24,24,22,22,new nt(24,new Je(1,36))),new qe(9,26,26,24,24,new nt(28,new Je(1,44))),new qe(10,32,32,14,14,new nt(36,new Je(1,62))),new qe(11,36,36,16,16,new nt(42,new Je(1,86))),new qe(12,40,40,18,18,new nt(48,new Je(1,114))),new qe(13,44,44,20,20,new nt(56,new Je(1,144))),new qe(14,48,48,22,22,new nt(68,new Je(1,174))),new qe(15,52,52,24,24,new nt(42,new Je(2,102))),new qe(16,64,64,14,14,new nt(56,new Je(2,140))),new qe(17,72,72,16,16,new nt(36,new Je(4,92))),new qe(18,80,80,18,18,new nt(48,new Je(4,114))),new qe(19,88,88,20,20,new nt(56,new Je(4,144))),new qe(20,96,96,22,22,new nt(68,new Je(4,174))),new qe(21,104,104,24,24,new nt(56,new Je(6,136))),new qe(22,120,120,18,18,new nt(68,new Je(6,175))),new qe(23,132,132,20,20,new nt(62,new Je(8,163))),new qe(24,144,144,22,22,new nt(62,new Je(8,156),new Je(2,155))),new qe(25,8,18,6,16,new nt(7,new Je(1,5))),new qe(26,8,32,6,14,new nt(11,new Je(1,10))),new qe(27,12,26,10,24,new nt(14,new Je(1,16))),new qe(28,12,36,10,16,new nt(18,new Je(1,22))),new qe(29,16,36,14,16,new nt(24,new Je(1,32))),new qe(30,16,48,14,22,new nt(28,new Je(1,49)))]}}qe.VERSIONS=qe.buildVersions();class vo{constructor(e){const t=e.getHeight();if(t<8||t>144||t&1)throw new V;this.version=vo.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 qe.getVersionForDimensions(t,n)}readCodewords(){const e=new Int8Array(this.version.getTotalCodewords());let t=0,n=4,s=0;const c=this.mappingBitMatrix.getHeight(),d=this.mappingBitMatrix.getWidth();let h=!1,g=!1,_=!1,E=!1;do if(n===c&&s===0&&!h)e[t++]=this.readCorner1(c,d)&255,n-=2,s+=2,h=!0;else if(n===c-2&&s===0&&d&3&&!g)e[t++]=this.readCorner2(c,d)&255,n-=2,s+=2,g=!0;else if(n===c+4&&s===2&&!(d&7)&&!_)e[t++]=this.readCorner3(c,d)&255,n-=2,s+=2,_=!0;else if(n===c-2&&s===0&&(d&7)===4&&!E)e[t++]=this.readCorner4(c,d)&255,n-=2,s+=2,E=!0;else{do n<c&&s>=0&&!this.readMappingMatrix.get(s,n)&&(e[t++]=this.readUtah(n,s,c,d)&255),n-=2,s+=2;while(n>=0&&s<d);n+=1,s+=3;do n>=0&&s<d&&!this.readMappingMatrix.get(s,n)&&(e[t++]=this.readUtah(n,s,c,d)&255),n+=2,s-=2;while(n<c&&s>=0);n+=3,s+=1}while(n<c||s<d);if(t!==this.version.getTotalCodewords())throw new V;return e}readModule(e,t,n,s){return e<0&&(e+=n,t+=4-(n+4&7)),t<0&&(t+=s,e+=4-(s+4&7)),this.readMappingMatrix.set(t,e),this.mappingBitMatrix.get(t,e)}readUtah(e,t,n,s){let c=0;return this.readModule(e-2,t-2,n,s)&&(c|=1),c<<=1,this.readModule(e-2,t-1,n,s)&&(c|=1),c<<=1,this.readModule(e-1,t-2,n,s)&&(c|=1),c<<=1,this.readModule(e-1,t-1,n,s)&&(c|=1),c<<=1,this.readModule(e-1,t,n,s)&&(c|=1),c<<=1,this.readModule(e,t-2,n,s)&&(c|=1),c<<=1,this.readModule(e,t-1,n,s)&&(c|=1),c<<=1,this.readModule(e,t,n,s)&&(c|=1),c}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 s=this.version.getDataRegionSizeRows(),c=this.version.getDataRegionSizeColumns(),d=t/s|0,h=n/c|0,g=d*s,_=h*c,E=new X(_,g);for(let A=0;A<d;++A){const S=A*s;for(let B=0;B<h;++B){const z=B*c;for(let G=0;G<s;++G){const Y=A*(s+2)+1+G,ie=S+G;for(let ue=0;ue<c;++ue){const fe=B*(c+2)+1+ue;if(e.get(fe,Y)){const le=z+ue;E.set(le,ie)}}}}}return E}}class Po{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t){const n=t.getECBlocks();let s=0;const c=n.getECBlocks();for(let G of c)s+=G.getCount();const d=new Array(s);let h=0;for(let G of c)for(let Y=0;Y<G.getCount();Y++){const ie=G.getDataCodewords(),ue=n.getECCodewords()+ie;d[h++]=new Po(ie,new Uint8Array(ue))}const _=d[0].codewords.length-n.getECCodewords(),E=_-1;let A=0;for(let G=0;G<E;G++)for(let Y=0;Y<h;Y++)d[Y].codewords[G]=e[A++];const S=t.getVersionNumber()===24,B=S?8:h;for(let G=0;G<B;G++)d[G].codewords[_-1]=e[A++];const z=d[0].codewords.length;for(let G=_;G<z;G++)for(let Y=0;Y<h;Y++){const ie=S?(Y+8)%h:Y,ue=S&&ie>7?G-1:G;d[ie].codewords[ue]=e[A++]}if(A!==e.length)throw new y;return d}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class Lo{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,s=this.byteOffset;const c=this.bytes;if(n>0){const d=8-n,h=e<d?e:d,g=d-h,_=255>>8-h<<g;t=(c[s]&_)>>g,e-=h,n+=h,n===8&&(n=0,s++)}if(e>0){for(;e>=8;)t=t<<8|c[s]&255,s++,e-=8;if(e>0){const d=8-e,h=255>>d<<d;t=t<<e|(c[s]&h)>>d,n+=e}}return this.bitOffset=n,this.byteOffset=s,t}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var vt;(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"})(vt||(vt={}));class $n{static decode(e){const t=new Lo(e),n=new W,s=new W,c=new Array;let d=vt.ASCII_ENCODE;do if(d===vt.ASCII_ENCODE)d=this.decodeAsciiSegment(t,n,s);else{switch(d){case vt.C40_ENCODE:this.decodeC40Segment(t,n);break;case vt.TEXT_ENCODE:this.decodeTextSegment(t,n);break;case vt.ANSIX12_ENCODE:this.decodeAnsiX12Segment(t,n);break;case vt.EDIFACT_ENCODE:this.decodeEdifactSegment(t,n);break;case vt.BASE256_ENCODE:this.decodeBase256Segment(t,n,c);break;default:throw new V}d=vt.ASCII_ENCODE}while(d!==vt.PAD_ENCODE&&t.available()>0);return s.length()>0&&n.append(s.toString()),new et(e,n.toString(),c.length===0?null:c,null)}static decodeAsciiSegment(e,t,n){let s=!1;do{let c=e.readBits(8);if(c===0)throw new V;if(c<=128)return s&&(c+=128),t.append(String.fromCharCode(c-1)),vt.ASCII_ENCODE;if(c===129)return vt.PAD_ENCODE;if(c<=229){const d=c-130;d<10&&t.append("0"),t.append(""+d)}else switch(c){case 230:return vt.C40_ENCODE;case 231:return vt.BASE256_ENCODE;case 232:t.append("");break;case 233:case 234:break;case 235:s=!0;break;case 236:t.append("[)>05"),n.insert(0,"");break;case 237:t.append("[)>06"),n.insert(0,"");break;case 238:return vt.ANSIX12_ENCODE;case 239:return vt.TEXT_ENCODE;case 240:return vt.EDIFACT_ENCODE;case 241:break;default:if(c!==254||e.available()!==0)throw new V;break}}while(e.available()>0);return vt.ASCII_ENCODE}static decodeC40Segment(e,t){let n=!1;const s=[];let c=0;do{if(e.available()===8)return;const d=e.readBits(8);if(d===254)return;this.parseTwoBytes(d,e.readBits(8),s);for(let h=0;h<3;h++){const g=s[h];switch(c){case 0:if(g<3)c=g+1;else if(g<this.C40_BASIC_SET_CHARS.length){const _=this.C40_BASIC_SET_CHARS[g];n?(t.append(String.fromCharCode(_.charCodeAt(0)+128)),n=!1):t.append(_)}else throw new V;break;case 1:n?(t.append(String.fromCharCode(g+128)),n=!1):t.append(String.fromCharCode(g)),c=0;break;case 2:if(g<this.C40_SHIFT2_SET_CHARS.length){const _=this.C40_SHIFT2_SET_CHARS[g];n?(t.append(String.fromCharCode(_.charCodeAt(0)+128)),n=!1):t.append(_)}else switch(g){case 27:t.append("");break;case 30:n=!0;break;default:throw new V}c=0;break;case 3:n?(t.append(String.fromCharCode(g+224)),n=!1):t.append(String.fromCharCode(g+96)),c=0;break;default:throw new V}}}while(e.available()>0)}static decodeTextSegment(e,t){let n=!1,s=[],c=0;do{if(e.available()===8)return;const d=e.readBits(8);if(d===254)return;this.parseTwoBytes(d,e.readBits(8),s);for(let h=0;h<3;h++){const g=s[h];switch(c){case 0:if(g<3)c=g+1;else if(g<this.TEXT_BASIC_SET_CHARS.length){const _=this.TEXT_BASIC_SET_CHARS[g];n?(t.append(String.fromCharCode(_.charCodeAt(0)+128)),n=!1):t.append(_)}else throw new V;break;case 1:n?(t.append(String.fromCharCode(g+128)),n=!1):t.append(String.fromCharCode(g)),c=0;break;case 2:if(g<this.TEXT_SHIFT2_SET_CHARS.length){const _=this.TEXT_SHIFT2_SET_CHARS[g];n?(t.append(String.fromCharCode(_.charCodeAt(0)+128)),n=!1):t.append(_)}else switch(g){case 27:t.append("");break;case 30:n=!0;break;default:throw new V}c=0;break;case 3:if(g<this.TEXT_SHIFT3_SET_CHARS.length){const _=this.TEXT_SHIFT3_SET_CHARS[g];n?(t.append(String.fromCharCode(_.charCodeAt(0)+128)),n=!1):t.append(_),c=0}else throw new V;break;default:throw new V}}}while(e.available()>0)}static decodeAnsiX12Segment(e,t){const n=[];do{if(e.available()===8)return;const s=e.readBits(8);if(s===254)return;this.parseTwoBytes(s,e.readBits(8),n);for(let c=0;c<3;c++){const d=n[c];switch(d){case 0:t.append("\r");break;case 1:t.append("*");break;case 2:t.append(">");break;case 3:t.append(" ");break;default:if(d<14)t.append(String.fromCharCode(d+44));else if(d<40)t.append(String.fromCharCode(d+51));else throw new V;break}}}while(e.available()>0)}static parseTwoBytes(e,t,n){let s=(e<<8)+t-1,c=Math.floor(s/1600);n[0]=c,s-=c*1600,c=Math.floor(s/40),n[1]=c,n[2]=s-c*40}static decodeEdifactSegment(e,t){do{if(e.available()<=16)return;for(let n=0;n<4;n++){let s=e.readBits(6);if(s===31){const c=8-e.getBitOffset();c!==8&&e.readBits(c);return}s&32||(s|=64),t.append(String.fromCharCode(s))}}while(e.available()>0)}static decodeBase256Segment(e,t,n){let s=1+e.getByteOffset();const c=this.unrandomize255State(e.readBits(8),s++);let d;if(c===0?d=e.available()/8|0:c<250?d=c:d=250*(c-249)+this.unrandomize255State(e.readBits(8),s++),d<0)throw new V;const h=new Uint8Array(d);for(let g=0;g<d;g++){if(e.available()<8)throw new V;h[g]=this.unrandomize255State(e.readBits(8),s++)}n.push(h);try{t.append(Q.decode(h,ee.ISO88591))}catch(g){throw new Ue("Platform does not support required encoding: "+g.message)}}static unrandomize255State(e,t){const n=149*t%255+1,s=e-n;return s>=0?s:s+256}}$n.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"],$n.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],$n.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"],$n.TEXT_SHIFT2_SET_CHARS=$n.C40_SHIFT2_SET_CHARS,$n.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 xg{constructor(){this.rsDecoder=new It(Me.DATA_MATRIX_FIELD_256)}decode(e){const t=new vo(e),n=t.getVersion(),s=t.readCodewords(),c=Po.getDataBlocks(s,n);let d=0;for(let _ of c)d+=_.getNumDataCodewords();const h=new Uint8Array(d),g=c.length;for(let _=0;_<g;_++){const E=c[_],A=E.getCodewords(),S=E.getNumDataCodewords();this.correctErrors(A,S);for(let B=0;B<S;B++)h[B*g+_]=A[B]}return $n.decode(h)}correctErrors(e,t){const n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new O}for(let s=0;s<t;s++)e[s]=n[s]}}class Bt{constructor(e){this.image=e,this.rectangleDetector=new Dt(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 I;t=this.shiftToModuleCenter(t);const n=t[0],s=t[1],c=t[2],d=t[3];let h=this.transitionsBetween(n,d)+1,g=this.transitionsBetween(c,d)+1;(h&1)===1&&(h+=1),(g&1)===1&&(g+=1),4*h<7*g&&4*g<7*h&&(h=g=Math.max(h,g));let _=Bt.sampleGrid(this.image,n,s,c,d,h,g);return new br(_,[n,s,c,d])}static shiftPoint(e,t,n){let s=(t.getX()-e.getX())/(n+1),c=(t.getY()-e.getY())/(n+1);return new ye(e.getX()+s,e.getY()+c)}static moveAway(e,t,n){let s=e.getX(),c=e.getY();return s<t?s-=1:s+=1,c<n?c-=1:c+=1,new ye(s,c)}detectSolid1(e){let t=e[0],n=e[1],s=e[3],c=e[2],d=this.transitionsBetween(t,n),h=this.transitionsBetween(n,s),g=this.transitionsBetween(s,c),_=this.transitionsBetween(c,t),E=d,A=[c,t,n,s];return E>h&&(E=h,A[0]=t,A[1]=n,A[2]=s,A[3]=c),E>g&&(E=g,A[0]=n,A[1]=s,A[2]=c,A[3]=t),E>_&&(A[0]=s,A[1]=c,A[2]=t,A[3]=n),A}detectSolid2(e){let t=e[0],n=e[1],s=e[2],c=e[3],d=this.transitionsBetween(t,c),h=Bt.shiftPoint(n,s,(d+1)*4),g=Bt.shiftPoint(s,n,(d+1)*4),_=this.transitionsBetween(h,t),E=this.transitionsBetween(g,c);return _<E?(e[0]=t,e[1]=n,e[2]=s,e[3]=c):(e[0]=n,e[1]=s,e[2]=c,e[3]=t),e}correctTopRight(e){let t=e[0],n=e[1],s=e[2],c=e[3],d=this.transitionsBetween(t,c),h=this.transitionsBetween(n,c),g=Bt.shiftPoint(t,n,(h+1)*4),_=Bt.shiftPoint(s,n,(d+1)*4);d=this.transitionsBetween(g,c),h=this.transitionsBetween(_,c);let E=new ye(c.getX()+(s.getX()-n.getX())/(d+1),c.getY()+(s.getY()-n.getY())/(d+1)),A=new ye(c.getX()+(t.getX()-n.getX())/(h+1),c.getY()+(t.getY()-n.getY())/(h+1));if(!this.isValid(E))return this.isValid(A)?A:null;if(!this.isValid(A))return E;let S=this.transitionsBetween(g,E)+this.transitionsBetween(_,E),B=this.transitionsBetween(g,A)+this.transitionsBetween(_,A);return S>B?E:A}shiftToModuleCenter(e){let t=e[0],n=e[1],s=e[2],c=e[3],d=this.transitionsBetween(t,c)+1,h=this.transitionsBetween(s,c)+1,g=Bt.shiftPoint(t,n,h*4),_=Bt.shiftPoint(s,n,d*4);d=this.transitionsBetween(g,c)+1,h=this.transitionsBetween(_,c)+1,(d&1)===1&&(d+=1),(h&1)===1&&(h+=1);let E=(t.getX()+n.getX()+s.getX()+c.getX())/4,A=(t.getY()+n.getY()+s.getY()+c.getY())/4;t=Bt.moveAway(t,E,A),n=Bt.moveAway(n,E,A),s=Bt.moveAway(s,E,A),c=Bt.moveAway(c,E,A);let S,B;return g=Bt.shiftPoint(t,n,h*4),g=Bt.shiftPoint(g,c,d*4),S=Bt.shiftPoint(n,t,h*4),S=Bt.shiftPoint(S,s,d*4),_=Bt.shiftPoint(s,c,h*4),_=Bt.shiftPoint(_,n,d*4),B=Bt.shiftPoint(c,s,h*4),B=Bt.shiftPoint(B,t,d*4),[g,S,_,B]}isValid(e){return e.getX()>=0&&e.getX()<this.image.getWidth()&&e.getY()>0&&e.getY()<this.image.getHeight()}static sampleGrid(e,t,n,s,c,d,h){return Rn.getInstance().sampleGrid(e,d,h,.5,.5,d-.5,.5,d-.5,h-.5,.5,h-.5,t.getX(),t.getY(),c.getX(),c.getY(),s.getX(),s.getY(),n.getX(),n.getY())}transitionsBetween(e,t){let n=Math.trunc(e.getX()),s=Math.trunc(e.getY()),c=Math.trunc(t.getX()),d=Math.trunc(t.getY()),h=Math.abs(d-s)>Math.abs(c-n);if(h){let G=n;n=s,s=G,G=c,c=d,d=G}let g=Math.abs(c-n),_=Math.abs(d-s),E=-g/2,A=s<d?1:-1,S=n<c?1:-1,B=0,z=this.image.get(h?s:n,h?n:s);for(let G=n,Y=s;G!==c;G+=S){let ie=this.image.get(h?Y:G,h?G:Y);if(ie!==z&&(B++,z=ie),E+=_,E>0){if(Y===d)break;Y+=A,E-=g}}return B}}class jn{constructor(){this.decoder=new xg}decode(e,t=null){let n,s;if(t!=null&&t.has(Z.PURE_BARCODE)){const _=jn.extractPureBits(e.getBlackMatrix());n=this.decoder.decode(_),s=jn.NO_POINTS}else{const _=new Bt(e.getBlackMatrix()).detect();n=this.decoder.decode(_.getBits()),s=_.getPoints()}const c=n.getRawBytes(),d=new ge(n.getText(),c,8*c.length,s,xe.DATA_MATRIX,v.currentTimeMillis()),h=n.getByteSegments();h!=null&&d.putMetadata(be.BYTE_SEGMENTS,h);const g=n.getECLevel();return g!=null&&d.putMetadata(be.ERROR_CORRECTION_LEVEL,g),d}reset(){}static extractPureBits(e){const t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t==null||n==null)throw new I;const s=this.moduleSize(t,e);let c=t[1];const d=n[1];let h=t[0];const _=(n[0]-h+1)/s,E=(d-c+1)/s;if(_<=0||E<=0)throw new I;const A=s/2;c+=A,h+=A;const S=new X(_,E);for(let B=0;B<E;B++){const z=c+B*s;for(let G=0;G<_;G++)e.get(h+G*s,z)&&S.set(G,B)}return S}static moduleSize(e,t){const n=t.getWidth();let s=e[0];const c=e[1];for(;s<n&&t.get(s,c);)s++;if(s===n)throw new I;const d=s-e[0];if(d===0)throw new I;return d}}jn.NO_POINTS=[];class wg extends Ce{constructor(e=500){super(new jn,e)}}var kr;(function(b){b[b.L=0]="L",b[b.M=1]="M",b[b.Q=2]="Q",b[b.H=3]="H"})(kr||(kr={}));class mt{constructor(e,t,n){this.value=e,this.stringValue=t,this.bits=n,mt.FOR_BITS.set(n,this),mt.FOR_VALUE.set(e,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(e){switch(e){case"L":return mt.L;case"M":return mt.M;case"Q":return mt.Q;case"H":return mt.H;default:throw new C(e+"not available")}}toString(){return this.stringValue}equals(e){if(!(e instanceof mt))return!1;const t=e;return this.value===t.value}static forBits(e){if(e<0||e>=mt.FOR_BITS.size)throw new y;return mt.FOR_BITS.get(e)}}mt.FOR_BITS=new Map,mt.FOR_VALUE=new Map,mt.L=new mt(kr.L,"L",1),mt.M=new mt(kr.M,"M",0),mt.Q=new mt(kr.Q,"Q",3),mt.H=new mt(kr.H,"H",2);class $t{constructor(e){this.errorCorrectionLevel=mt.forBits(e>>3&3),this.dataMask=e&7}static numBitsDiffering(e,t){return R.bitCount(e^t)}static decodeFormatInformation(e,t){const n=$t.doDecodeFormatInformation(e,t);return n!==null?n:$t.doDecodeFormatInformation(e^$t.FORMAT_INFO_MASK_QR,t^$t.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(e,t){let n=Number.MAX_SAFE_INTEGER,s=0;for(const c of $t.FORMAT_INFO_DECODE_LOOKUP){const d=c[0];if(d===e||d===t)return new $t(c[1]);let h=$t.numBitsDiffering(e,d);h<n&&(s=c[1],n=h),e!==t&&(h=$t.numBitsDiffering(t,d),h<n&&(s=c[1],n=h))}return n<=3?new $t(s):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(e){if(!(e instanceof $t))return!1;const t=e;return this.errorCorrectionLevel===t.errorCorrectionLevel&&this.dataMask===t.dataMask}}$t.FORMAT_INFO_MASK_QR=21522,$t.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 J{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 Ne{constructor(e,t,...n){this.versionNumber=e,this.alignmentPatternCenters=t,this.ecBlocks=n;let s=0;const c=n[0].getECCodewordsPerBlock(),d=n[0].getECBlocks();for(const h of d)s+=h.getCount()*(h.getDataCodewords()+c);this.totalCodewords=s}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 V;try{return this.getVersionForNumber((e-17)/4)}catch{throw new V}}static getVersionForNumber(e){if(e<1||e>40)throw new y;return Ne.VERSIONS[e-1]}static decodeVersionInformation(e){let t=Number.MAX_SAFE_INTEGER,n=0;for(let s=0;s<Ne.VERSION_DECODE_INFO.length;s++){const c=Ne.VERSION_DECODE_INFO[s];if(c===e)return Ne.getVersionForNumber(s+7);const d=$t.numBitsDiffering(e,c);d<t&&(n=s+7,t=d)}return t<=3?Ne.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 s=0;s<n;s++){const c=this.alignmentPatternCenters[s]-2;for(let d=0;d<n;d++)s===0&&(d===0||d===n-1)||s===n-1&&d===0||t.setRegion(this.alignmentPatternCenters[d]-2,c,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}}Ne.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]),Ne.VERSIONS=[new Ne(1,new Int32Array(0),new J(7,new k(1,19)),new J(10,new k(1,16)),new J(13,new k(1,13)),new J(17,new k(1,9))),new Ne(2,Int32Array.from([6,18]),new J(10,new k(1,34)),new J(16,new k(1,28)),new J(22,new k(1,22)),new J(28,new k(1,16))),new Ne(3,Int32Array.from([6,22]),new J(15,new k(1,55)),new J(26,new k(1,44)),new J(18,new k(2,17)),new J(22,new k(2,13))),new Ne(4,Int32Array.from([6,26]),new J(20,new k(1,80)),new J(18,new k(2,32)),new J(26,new k(2,24)),new J(16,new k(4,9))),new Ne(5,Int32Array.from([6,30]),new J(26,new k(1,108)),new J(24,new k(2,43)),new J(18,new k(2,15),new k(2,16)),new J(22,new k(2,11),new k(2,12))),new Ne(6,Int32Array.from([6,34]),new J(18,new k(2,68)),new J(16,new k(4,27)),new J(24,new k(4,19)),new J(28,new k(4,15))),new Ne(7,Int32Array.from([6,22,38]),new J(20,new k(2,78)),new J(18,new k(4,31)),new J(18,new k(2,14),new k(4,15)),new J(26,new k(4,13),new k(1,14))),new Ne(8,Int32Array.from([6,24,42]),new J(24,new k(2,97)),new J(22,new k(2,38),new k(2,39)),new J(22,new k(4,18),new k(2,19)),new J(26,new k(4,14),new k(2,15))),new Ne(9,Int32Array.from([6,26,46]),new J(30,new k(2,116)),new J(22,new k(3,36),new k(2,37)),new J(20,new k(4,16),new k(4,17)),new J(24,new k(4,12),new k(4,13))),new Ne(10,Int32Array.from([6,28,50]),new J(18,new k(2,68),new k(2,69)),new J(26,new k(4,43),new k(1,44)),new J(24,new k(6,19),new k(2,20)),new J(28,new k(6,15),new k(2,16))),new Ne(11,Int32Array.from([6,30,54]),new J(20,new k(4,81)),new J(30,new k(1,50),new k(4,51)),new J(28,new k(4,22),new k(4,23)),new J(24,new k(3,12),new k(8,13))),new Ne(12,Int32Array.from([6,32,58]),new J(24,new k(2,92),new k(2,93)),new J(22,new k(6,36),new k(2,37)),new J(26,new k(4,20),new k(6,21)),new J(28,new k(7,14),new k(4,15))),new Ne(13,Int32Array.from([6,34,62]),new J(26,new k(4,107)),new J(22,new k(8,37),new k(1,38)),new J(24,new k(8,20),new k(4,21)),new J(22,new k(12,11),new k(4,12))),new Ne(14,Int32Array.from([6,26,46,66]),new J(30,new k(3,115),new k(1,116)),new J(24,new k(4,40),new k(5,41)),new J(20,new k(11,16),new k(5,17)),new J(24,new k(11,12),new k(5,13))),new Ne(15,Int32Array.from([6,26,48,70]),new J(22,new k(5,87),new k(1,88)),new J(24,new k(5,41),new k(5,42)),new J(30,new k(5,24),new k(7,25)),new J(24,new k(11,12),new k(7,13))),new Ne(16,Int32Array.from([6,26,50,74]),new J(24,new k(5,98),new k(1,99)),new J(28,new k(7,45),new k(3,46)),new J(24,new k(15,19),new k(2,20)),new J(30,new k(3,15),new k(13,16))),new Ne(17,Int32Array.from([6,30,54,78]),new J(28,new k(1,107),new k(5,108)),new J(28,new k(10,46),new k(1,47)),new J(28,new k(1,22),new k(15,23)),new J(28,new k(2,14),new k(17,15))),new Ne(18,Int32Array.from([6,30,56,82]),new J(30,new k(5,120),new k(1,121)),new J(26,new k(9,43),new k(4,44)),new J(28,new k(17,22),new k(1,23)),new J(28,new k(2,14),new k(19,15))),new Ne(19,Int32Array.from([6,30,58,86]),new J(28,new k(3,113),new k(4,114)),new J(26,new k(3,44),new k(11,45)),new J(26,new k(17,21),new k(4,22)),new J(26,new k(9,13),new k(16,14))),new Ne(20,Int32Array.from([6,34,62,90]),new J(28,new k(3,107),new k(5,108)),new J(26,new k(3,41),new k(13,42)),new J(30,new k(15,24),new k(5,25)),new J(28,new k(15,15),new k(10,16))),new Ne(21,Int32Array.from([6,28,50,72,94]),new J(28,new k(4,116),new k(4,117)),new J(26,new k(17,42)),new J(28,new k(17,22),new k(6,23)),new J(30,new k(19,16),new k(6,17))),new Ne(22,Int32Array.from([6,26,50,74,98]),new J(28,new k(2,111),new k(7,112)),new J(28,new k(17,46)),new J(30,new k(7,24),new k(16,25)),new J(24,new k(34,13))),new Ne(23,Int32Array.from([6,30,54,78,102]),new J(30,new k(4,121),new k(5,122)),new J(28,new k(4,47),new k(14,48)),new J(30,new k(11,24),new k(14,25)),new J(30,new k(16,15),new k(14,16))),new Ne(24,Int32Array.from([6,28,54,80,106]),new J(30,new k(6,117),new k(4,118)),new J(28,new k(6,45),new k(14,46)),new J(30,new k(11,24),new k(16,25)),new J(30,new k(30,16),new k(2,17))),new Ne(25,Int32Array.from([6,32,58,84,110]),new J(26,new k(8,106),new k(4,107)),new J(28,new k(8,47),new k(13,48)),new J(30,new k(7,24),new k(22,25)),new J(30,new k(22,15),new k(13,16))),new Ne(26,Int32Array.from([6,30,58,86,114]),new J(28,new k(10,114),new k(2,115)),new J(28,new k(19,46),new k(4,47)),new J(28,new k(28,22),new k(6,23)),new J(30,new k(33,16),new k(4,17))),new Ne(27,Int32Array.from([6,34,62,90,118]),new J(30,new k(8,122),new k(4,123)),new J(28,new k(22,45),new k(3,46)),new J(30,new k(8,23),new k(26,24)),new J(30,new k(12,15),new k(28,16))),new Ne(28,Int32Array.from([6,26,50,74,98,122]),new J(30,new k(3,117),new k(10,118)),new J(28,new k(3,45),new k(23,46)),new J(30,new k(4,24),new k(31,25)),new J(30,new k(11,15),new k(31,16))),new Ne(29,Int32Array.from([6,30,54,78,102,126]),new J(30,new k(7,116),new k(7,117)),new J(28,new k(21,45),new k(7,46)),new J(30,new k(1,23),new k(37,24)),new J(30,new k(19,15),new k(26,16))),new Ne(30,Int32Array.from([6,26,52,78,104,130]),new J(30,new k(5,115),new k(10,116)),new J(28,new k(19,47),new k(10,48)),new J(30,new k(15,24),new k(25,25)),new J(30,new k(23,15),new k(25,16))),new Ne(31,Int32Array.from([6,30,56,82,108,134]),new J(30,new k(13,115),new k(3,116)),new J(28,new k(2,46),new k(29,47)),new J(30,new k(42,24),new k(1,25)),new J(30,new k(23,15),new k(28,16))),new Ne(32,Int32Array.from([6,34,60,86,112,138]),new J(30,new k(17,115)),new J(28,new k(10,46),new k(23,47)),new J(30,new k(10,24),new k(35,25)),new J(30,new k(19,15),new k(35,16))),new Ne(33,Int32Array.from([6,30,58,86,114,142]),new J(30,new k(17,115),new k(1,116)),new J(28,new k(14,46),new k(21,47)),new J(30,new k(29,24),new k(19,25)),new J(30,new k(11,15),new k(46,16))),new Ne(34,Int32Array.from([6,34,62,90,118,146]),new J(30,new k(13,115),new k(6,116)),new J(28,new k(14,46),new k(23,47)),new J(30,new k(44,24),new k(7,25)),new J(30,new k(59,16),new k(1,17))),new Ne(35,Int32Array.from([6,30,54,78,102,126,150]),new J(30,new k(12,121),new k(7,122)),new J(28,new k(12,47),new k(26,48)),new J(30,new k(39,24),new k(14,25)),new J(30,new k(22,15),new k(41,16))),new Ne(36,Int32Array.from([6,24,50,76,102,128,154]),new J(30,new k(6,121),new k(14,122)),new J(28,new k(6,47),new k(34,48)),new J(30,new k(46,24),new k(10,25)),new J(30,new k(2,15),new k(64,16))),new Ne(37,Int32Array.from([6,28,54,80,106,132,158]),new J(30,new k(17,122),new k(4,123)),new J(28,new k(29,46),new k(14,47)),new J(30,new k(49,24),new k(10,25)),new J(30,new k(24,15),new k(46,16))),new Ne(38,Int32Array.from([6,32,58,84,110,136,162]),new J(30,new k(4,122),new k(18,123)),new J(28,new k(13,46),new k(32,47)),new J(30,new k(48,24),new k(14,25)),new J(30,new k(42,15),new k(32,16))),new Ne(39,Int32Array.from([6,26,54,82,110,138,166]),new J(30,new k(20,117),new k(4,118)),new J(28,new k(40,47),new k(7,48)),new J(30,new k(43,24),new k(22,25)),new J(30,new k(10,15),new k(67,16))),new Ne(40,Int32Array.from([6,30,58,86,114,142,170]),new J(30,new k(19,118),new k(6,119)),new J(28,new k(18,47),new k(31,48)),new J(30,new k(34,24),new k(34,25)),new J(30,new k(20,15),new k(61,16)))];var Ft;(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"})(Ft||(Ft={}));class gn{constructor(e,t){this.value=e,this.isMasked=t}unmaskBitMatrix(e,t){for(let n=0;n<t;n++)for(let s=0;s<t;s++)this.isMasked(n,s)&&e.flip(s,n)}}gn.values=new Map([[Ft.DATA_MASK_000,new gn(Ft.DATA_MASK_000,(b,e)=>(b+e&1)===0)],[Ft.DATA_MASK_001,new gn(Ft.DATA_MASK_001,(b,e)=>(b&1)===0)],[Ft.DATA_MASK_010,new gn(Ft.DATA_MASK_010,(b,e)=>e%3===0)],[Ft.DATA_MASK_011,new gn(Ft.DATA_MASK_011,(b,e)=>(b+e)%3===0)],[Ft.DATA_MASK_100,new gn(Ft.DATA_MASK_100,(b,e)=>(Math.floor(b/2)+Math.floor(e/3)&1)===0)],[Ft.DATA_MASK_101,new gn(Ft.DATA_MASK_101,(b,e)=>b*e%6===0)],[Ft.DATA_MASK_110,new gn(Ft.DATA_MASK_110,(b,e)=>b*e%6<3)],[Ft.DATA_MASK_111,new gn(Ft.DATA_MASK_111,(b,e)=>(b+e+b*e%3&1)===0)]]);class _g{constructor(e){const t=e.getHeight();if(t<21||(t&3)!==1)throw new V;this.bitMatrix=e}readFormatInformation(){if(this.parsedFormatInfo!==null&&this.parsedFormatInfo!==void 0)return this.parsedFormatInfo;let e=0;for(let c=0;c<6;c++)e=this.copyBit(c,8,e);e=this.copyBit(7,8,e),e=this.copyBit(8,8,e),e=this.copyBit(8,7,e);for(let c=5;c>=0;c--)e=this.copyBit(8,c,e);const t=this.bitMatrix.getHeight();let n=0;const s=t-7;for(let c=t-1;c>=s;c--)n=this.copyBit(8,c,n);for(let c=t-8;c<t;c++)n=this.copyBit(c,8,n);if(this.parsedFormatInfo=$t.decodeFormatInformation(e,n),this.parsedFormatInfo!==null)return this.parsedFormatInfo;throw new V}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 Ne.getVersionForNumber(t);let n=0;const s=e-11;for(let d=5;d>=0;d--)for(let h=e-9;h>=s;h--)n=this.copyBit(h,d,n);let c=Ne.decodeVersionInformation(n);if(c!==null&&c.getDimensionForVersion()===e)return this.parsedVersion=c,c;n=0;for(let d=5;d>=0;d--)for(let h=e-9;h>=s;h--)n=this.copyBit(d,h,n);if(c=Ne.decodeVersionInformation(n),c!==null&&c.getDimensionForVersion()===e)return this.parsedVersion=c,c;throw new V}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=gn.values.get(e.getDataMask()),s=this.bitMatrix.getHeight();n.unmaskBitMatrix(this.bitMatrix,s);const c=t.buildFunctionPattern();let d=!0;const h=new Uint8Array(t.getTotalCodewords());let g=0,_=0,E=0;for(let A=s-1;A>0;A-=2){A===6&&A--;for(let S=0;S<s;S++){const B=d?s-1-S:S;for(let z=0;z<2;z++)c.get(A-z,B)||(E++,_<<=1,this.bitMatrix.get(A-z,B)&&(_|=1),E===8&&(h[g++]=_,E=0,_=0))}d=!d}if(g!==t.getTotalCodewords())throw new V;return h}remask(){if(this.parsedFormatInfo===null)return;const e=gn.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 s=t+1,c=e.getHeight();s<c;s++)e.get(t,s)!==e.get(s,t)&&(e.flip(s,t),e.flip(t,s))}}class Fo{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t,n){if(e.length!==t.getTotalCodewords())throw new y;const s=t.getECBlocksForLevel(n);let c=0;const d=s.getECBlocks();for(const z of d)c+=z.getCount();const h=new Array(c);let g=0;for(const z of d)for(let G=0;G<z.getCount();G++){const Y=z.getDataCodewords(),ie=s.getECCodewordsPerBlock()+Y;h[g++]=new Fo(Y,new Uint8Array(ie))}const _=h[0].codewords.length;let E=h.length-1;for(;E>=0&&h[E].codewords.length!==_;)E--;E++;const A=_-s.getECCodewordsPerBlock();let S=0;for(let z=0;z<A;z++)for(let G=0;G<g;G++)h[G].codewords[z]=e[S++];for(let z=E;z<g;z++)h[z].codewords[A]=e[S++];const B=h[0].codewords.length;for(let z=A;z<B;z++)for(let G=0;G<g;G++){const Y=G<E?z:z+1;h[G].codewords[Y]=e[S++]}return h}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}var pn;(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"})(pn||(pn={}));class ke{constructor(e,t,n,s){this.value=e,this.stringValue=t,this.characterCountBitsForVersions=n,this.bits=s,ke.FOR_BITS.set(s,this),ke.FOR_VALUE.set(e,this)}static forBits(e){const t=ke.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 ke))return!1;const t=e;return this.value===t.value}toString(){return this.stringValue}}ke.FOR_BITS=new Map,ke.FOR_VALUE=new Map,ke.TERMINATOR=new ke(pn.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),ke.NUMERIC=new ke(pn.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),ke.ALPHANUMERIC=new ke(pn.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),ke.STRUCTURED_APPEND=new ke(pn.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),ke.BYTE=new ke(pn.BYTE,"BYTE",Int32Array.from([8,16,16]),4),ke.ECI=new ke(pn.ECI,"ECI",Int32Array.from([0,0,0]),7),ke.KANJI=new ke(pn.KANJI,"KANJI",Int32Array.from([8,10,12]),8),ke.FNC1_FIRST_POSITION=new ke(pn.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),ke.FNC1_SECOND_POSITION=new ke(pn.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),ke.HANZI=new ke(pn.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class At{static decode(e,t,n,s){const c=new Lo(e);let d=new W;const h=new Array;let g=-1,_=-1;try{let E=null,A=!1,S;do{if(c.available()<4)S=ke.TERMINATOR;else{const B=c.readBits(4);S=ke.forBits(B)}switch(S){case ke.TERMINATOR:break;case ke.FNC1_FIRST_POSITION:case ke.FNC1_SECOND_POSITION:A=!0;break;case ke.STRUCTURED_APPEND:if(c.available()<16)throw new V;g=c.readBits(8),_=c.readBits(8);break;case ke.ECI:const B=At.parseECIValue(c);if(E=L.getCharacterSetECIByValue(B),E===null)throw new V;break;case ke.HANZI:const z=c.readBits(4),G=c.readBits(S.getCharacterCountBits(t));z===At.GB2312_SUBSET&&At.decodeHanziSegment(c,d,G);break;default:const Y=c.readBits(S.getCharacterCountBits(t));switch(S){case ke.NUMERIC:At.decodeNumericSegment(c,d,Y);break;case ke.ALPHANUMERIC:At.decodeAlphanumericSegment(c,d,Y,A);break;case ke.BYTE:At.decodeByteSegment(c,d,Y,E,h,s);break;case ke.KANJI:At.decodeKanjiSegment(c,d,Y);break;default:throw new V}break}}while(S!==ke.TERMINATOR)}catch{throw new V}return new et(e,d.toString(),h.length===0?null:h,n===null?null:n.toString(),g,_)}static decodeHanziSegment(e,t,n){if(n*13>e.available())throw new V;const s=new Uint8Array(2*n);let c=0;for(;n>0;){const d=e.readBits(13);let h=d/96<<8&4294967295|d%96;h<959?h+=41377:h+=42657,s[c]=h>>8&255,s[c+1]=h&255,c+=2,n--}try{t.append(Q.decode(s,ee.GB2312))}catch(d){throw new V(d)}}static decodeKanjiSegment(e,t,n){if(n*13>e.available())throw new V;const s=new Uint8Array(2*n);let c=0;for(;n>0;){const d=e.readBits(13);let h=d/192<<8&4294967295|d%192;h<7936?h+=33088:h+=49472,s[c]=h>>8,s[c+1]=h,c+=2,n--}try{t.append(Q.decode(s,ee.SHIFT_JIS))}catch(d){throw new V(d)}}static decodeByteSegment(e,t,n,s,c,d){if(8*n>e.available())throw new V;const h=new Uint8Array(n);for(let _=0;_<n;_++)h[_]=e.readBits(8);let g;s===null?g=ee.guessEncoding(h,d):g=s.getName();try{t.append(Q.decode(h,g))}catch(_){throw new V(_)}c.push(h)}static toAlphaNumericChar(e){if(e>=At.ALPHANUMERIC_CHARS.length)throw new V;return At.ALPHANUMERIC_CHARS[e]}static decodeAlphanumericSegment(e,t,n,s){const c=t.length();for(;n>1;){if(e.available()<11)throw new V;const d=e.readBits(11);t.append(At.toAlphaNumericChar(Math.floor(d/45))),t.append(At.toAlphaNumericChar(d%45)),n-=2}if(n===1){if(e.available()<6)throw new V;t.append(At.toAlphaNumericChar(e.readBits(6)))}if(s)for(let d=c;d<t.length();d++)t.charAt(d)==="%"&&(d<t.length()-1&&t.charAt(d+1)==="%"?t.deleteCharAt(d+1):t.setCharAt(d,""))}static decodeNumericSegment(e,t,n){for(;n>=3;){if(e.available()<10)throw new V;const s=e.readBits(10);if(s>=1e3)throw new V;t.append(At.toAlphaNumericChar(Math.floor(s/100))),t.append(At.toAlphaNumericChar(Math.floor(s/10)%10)),t.append(At.toAlphaNumericChar(s%10)),n-=3}if(n===2){if(e.available()<7)throw new V;const s=e.readBits(7);if(s>=100)throw new V;t.append(At.toAlphaNumericChar(Math.floor(s/10))),t.append(At.toAlphaNumericChar(s%10))}else if(n===1){if(e.available()<4)throw new V;const s=e.readBits(4);if(s>=10)throw new V;t.append(At.toAlphaNumericChar(s))}}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 V}}At.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",At.GB2312_SUBSET=1;class ja{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 Cg{constructor(){this.rsDecoder=new It(Me.QR_CODE_FIELD_256)}decodeBooleanArray(e,t){return this.decodeBitMatrix(X.parseFromBooleanArray(e),t)}decodeBitMatrix(e,t){const n=new _g(e);let s=null;try{return this.decodeBitMatrixParser(n,t)}catch(c){s=c}try{n.remask(),n.setMirror(!0),n.readVersion(),n.readFormatInformation(),n.mirror();const c=this.decodeBitMatrixParser(n,t);return c.setOther(new ja(!0)),c}catch(c){throw s!==null?s:c}}decodeBitMatrixParser(e,t){const n=e.readVersion(),s=e.readFormatInformation().getErrorCorrectionLevel(),c=e.readCodewords(),d=Fo.getDataBlocks(c,n,s);let h=0;for(const E of d)h+=E.getNumDataCodewords();const g=new Uint8Array(h);let _=0;for(const E of d){const A=E.getCodewords(),S=E.getNumDataCodewords();this.correctErrors(A,S);for(let B=0;B<S;B++)g[_++]=A[B]}return At.decode(g,n,s,t)}correctErrors(e,t){const n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch{throw new O}for(let s=0;s<t;s++)e[s]=n[s]}}class Vo 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 s=Math.abs(e-this.estimatedModuleSize);return s<=1||s<=this.estimatedModuleSize}return!1}combineEstimate(e,t,n){const s=(this.getX()+t)/2,c=(this.getY()+e)/2,d=(this.estimatedModuleSize+n)/2;return new Vo(s,c,d)}}class Di{constructor(e,t,n,s,c,d,h){this.image=e,this.startX=t,this.startY=n,this.width=s,this.height=c,this.moduleSize=d,this.resultPointCallback=h,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}find(){const e=this.startX,t=this.height,n=this.width,s=e+n,c=this.startY+t/2,d=new Int32Array(3),h=this.image;for(let g=0;g<t;g++){const _=c+(g&1?-Math.floor((g+1)/2):Math.floor((g+1)/2));d[0]=0,d[1]=0,d[2]=0;let E=e;for(;E<s&&!h.get(E,_);)E++;let A=0;for(;E<s;){if(h.get(E,_))if(A===1)d[1]++;else if(A===2){if(this.foundPatternCross(d)){const S=this.handlePossibleCenter(d,_,E);if(S!==null)return S}d[0]=d[2],d[1]=1,d[2]=0,A=1}else d[++A]++;else A===1&&A++,d[A]++;E++}if(this.foundPatternCross(d)){const S=this.handlePossibleCenter(d,_,s);if(S!==null)return S}}if(this.possibleCenters.length!==0)return this.possibleCenters[0];throw new I}static centerFromEnd(e,t){return t-e[2]-e[1]/2}foundPatternCross(e){const t=this.moduleSize,n=t/2;for(let s=0;s<3;s++)if(Math.abs(t-e[s])>=n)return!1;return!0}crossCheckVertical(e,t,n,s){const c=this.image,d=c.getHeight(),h=this.crossCheckStateCount;h[0]=0,h[1]=0,h[2]=0;let g=e;for(;g>=0&&c.get(t,g)&&h[1]<=n;)h[1]++,g--;if(g<0||h[1]>n)return NaN;for(;g>=0&&!c.get(t,g)&&h[0]<=n;)h[0]++,g--;if(h[0]>n)return NaN;for(g=e+1;g<d&&c.get(t,g)&&h[1]<=n;)h[1]++,g++;if(g===d||h[1]>n)return NaN;for(;g<d&&!c.get(t,g)&&h[2]<=n;)h[2]++,g++;if(h[2]>n)return NaN;const _=h[0]+h[1]+h[2];return 5*Math.abs(_-s)>=2*s?NaN:this.foundPatternCross(h)?Di.centerFromEnd(h,g):NaN}handlePossibleCenter(e,t,n){const s=e[0]+e[1]+e[2],c=Di.centerFromEnd(e,n),d=this.crossCheckVertical(t,c,2*e[1],s);if(!isNaN(d)){const h=(e[0]+e[1]+e[2])/3;for(const _ of this.possibleCenters)if(_.aboutEquals(h,d,c))return _.combineEstimate(d,c,h);const g=new Vo(c,d,h);this.possibleCenters.push(g),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(g)}return null}}class Uo extends ye{constructor(e,t,n,s){super(e,t),this.estimatedModuleSize=n,this.count=s,s===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 s=Math.abs(e-this.estimatedModuleSize);return s<=1||s<=this.estimatedModuleSize}return!1}combineEstimate(e,t,n){const s=this.count+1,c=(this.count*this.getX()+t)/s,d=(this.count*this.getY()+e)/s,h=(this.count*this.estimatedModuleSize+n)/s;return new Uo(c,d,h,s)}}class Eg{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(Z.TRY_HARDER)!==void 0,n=e!=null&&e.get(Z.PURE_BARCODE)!==void 0,s=this.image,c=s.getHeight(),d=s.getWidth();let h=Math.floor(3*c/(4*Vt.MAX_MODULES));(h<Vt.MIN_SKIP||t)&&(h=Vt.MIN_SKIP);let g=!1;const _=new Int32Array(5);for(let A=h-1;A<c&&!g;A+=h){_[0]=0,_[1]=0,_[2]=0,_[3]=0,_[4]=0;let S=0;for(let B=0;B<d;B++)if(s.get(B,A))(S&1)===1&&S++,_[S]++;else if(S&1)_[S]++;else if(S===4)if(Vt.foundPatternCross(_)){if(this.handlePossibleCenter(_,A,B,n)===!0)if(h=2,this.hasSkipped===!0)g=this.haveMultiplyConfirmedCenters();else{const G=this.findRowSkip();G>_[2]&&(A+=G-_[2]-h,B=d-1)}else{_[0]=_[2],_[1]=_[3],_[2]=_[4],_[3]=1,_[4]=0,S=3;continue}S=0,_[0]=0,_[1]=0,_[2]=0,_[3]=0,_[4]=0}else _[0]=_[2],_[1]=_[3],_[2]=_[4],_[3]=1,_[4]=0,S=3;else _[++S]++;Vt.foundPatternCross(_)&&this.handlePossibleCenter(_,A,d,n)===!0&&(h=_[0],this.hasSkipped&&(g=this.haveMultiplyConfirmedCenters()))}const E=this.selectBestPatterns();return ye.orderBestPatterns(E),new Eg(E)}static centerFromEnd(e,t){return t-e[4]-e[3]-e[2]/2}static foundPatternCross(e){let t=0;for(let c=0;c<5;c++){const d=e[c];if(d===0)return!1;t+=d}if(t<7)return!1;const n=t/7,s=n/2;return Math.abs(n-e[0])<s&&Math.abs(n-e[1])<s&&Math.abs(3*n-e[2])<3*s&&Math.abs(n-e[3])<s&&Math.abs(n-e[4])<s}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,s){const c=this.getCrossCheckStateCount();let d=0;const h=this.image;for(;e>=d&&t>=d&&h.get(t-d,e-d);)c[2]++,d++;if(e<d||t<d)return!1;for(;e>=d&&t>=d&&!h.get(t-d,e-d)&&c[1]<=n;)c[1]++,d++;if(e<d||t<d||c[1]>n)return!1;for(;e>=d&&t>=d&&h.get(t-d,e-d)&&c[0]<=n;)c[0]++,d++;if(c[0]>n)return!1;const g=h.getHeight(),_=h.getWidth();for(d=1;e+d<g&&t+d<_&&h.get(t+d,e+d);)c[2]++,d++;if(e+d>=g||t+d>=_)return!1;for(;e+d<g&&t+d<_&&!h.get(t+d,e+d)&&c[3]<n;)c[3]++,d++;if(e+d>=g||t+d>=_||c[3]>=n)return!1;for(;e+d<g&&t+d<_&&h.get(t+d,e+d)&&c[4]<n;)c[4]++,d++;if(c[4]>=n)return!1;const E=c[0]+c[1]+c[2]+c[3]+c[4];return Math.abs(E-s)<2*s&&Vt.foundPatternCross(c)}crossCheckVertical(e,t,n,s){const c=this.image,d=c.getHeight(),h=this.getCrossCheckStateCount();let g=e;for(;g>=0&&c.get(t,g);)h[2]++,g--;if(g<0)return NaN;for(;g>=0&&!c.get(t,g)&&h[1]<=n;)h[1]++,g--;if(g<0||h[1]>n)return NaN;for(;g>=0&&c.get(t,g)&&h[0]<=n;)h[0]++,g--;if(h[0]>n)return NaN;for(g=e+1;g<d&&c.get(t,g);)h[2]++,g++;if(g===d)return NaN;for(;g<d&&!c.get(t,g)&&h[3]<n;)h[3]++,g++;if(g===d||h[3]>=n)return NaN;for(;g<d&&c.get(t,g)&&h[4]<n;)h[4]++,g++;if(h[4]>=n)return NaN;const _=h[0]+h[1]+h[2]+h[3]+h[4];return 5*Math.abs(_-s)>=2*s?NaN:Vt.foundPatternCross(h)?Vt.centerFromEnd(h,g):NaN}crossCheckHorizontal(e,t,n,s){const c=this.image,d=c.getWidth(),h=this.getCrossCheckStateCount();let g=e;for(;g>=0&&c.get(g,t);)h[2]++,g--;if(g<0)return NaN;for(;g>=0&&!c.get(g,t)&&h[1]<=n;)h[1]++,g--;if(g<0||h[1]>n)return NaN;for(;g>=0&&c.get(g,t)&&h[0]<=n;)h[0]++,g--;if(h[0]>n)return NaN;for(g=e+1;g<d&&c.get(g,t);)h[2]++,g++;if(g===d)return NaN;for(;g<d&&!c.get(g,t)&&h[3]<n;)h[3]++,g++;if(g===d||h[3]>=n)return NaN;for(;g<d&&c.get(g,t)&&h[4]<n;)h[4]++,g++;if(h[4]>=n)return NaN;const _=h[0]+h[1]+h[2]+h[3]+h[4];return 5*Math.abs(_-s)>=s?NaN:Vt.foundPatternCross(h)?Vt.centerFromEnd(h,g):NaN}handlePossibleCenter(e,t,n,s){const c=e[0]+e[1]+e[2]+e[3]+e[4];let d=Vt.centerFromEnd(e,n),h=this.crossCheckVertical(t,Math.floor(d),e[2],c);if(!isNaN(h)&&(d=this.crossCheckHorizontal(Math.floor(d),Math.floor(h),e[2],c),!isNaN(d)&&(!s||this.crossCheckDiagonal(Math.floor(h),Math.floor(d),e[2],c)))){const g=c/7;let _=!1;const E=this.possibleCenters;for(let A=0,S=E.length;A<S;A++){const B=E[A];if(B.aboutEquals(g,h,d)){E[A]=B.combineEstimate(h,d,g),_=!0;break}}if(!_){const A=new Uo(d,h,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 d of this.possibleCenters)d.getCount()>=Vt.CENTER_QUORUM&&(e++,t+=d.getEstimatedModuleSize());if(e<3)return!1;const s=t/n;let c=0;for(const d of this.possibleCenters)c+=Math.abs(d.getEstimatedModuleSize()-s);return c<=.05*t}selectBestPatterns(){const e=this.possibleCenters.length;if(e<3)throw new I;const t=this.possibleCenters;let n;if(e>3){let s=0,c=0;for(const g of this.possibleCenters){const _=g.getEstimatedModuleSize();s+=_,c+=_*_}n=s/e;let d=Math.sqrt(c/e-n*n);t.sort((g,_)=>{const E=Math.abs(_.getEstimatedModuleSize()-n),A=Math.abs(g.getEstimatedModuleSize()-n);return E<A?-1:E>A?1:0});const h=Math.max(.2*n,d);for(let g=0;g<t.length&&t.length>3;g++){const _=t[g];Math.abs(_.getEstimatedModuleSize()-n)>h&&(t.splice(g,1),g--)}}if(t.length>3){let s=0;for(const c of t)s+=c.getEstimatedModuleSize();n=s/t.length,t.sort((c,d)=>{if(d.getCount()===c.getCount()){const h=Math.abs(d.getEstimatedModuleSize()-n),g=Math.abs(c.getEstimatedModuleSize()-n);return h<g?1:h>g?-1:0}else return d.getCount()-c.getCount()}),t.splice(3)}return[t[0],t[1],t[2]]}}Vt.CENTER_QUORUM=2,Vt.MIN_SKIP=3,Vt.MAX_MODULES=57;class Zr{constructor(e){this.image=e}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(e){this.resultPointCallback=e==null?null:e.get(Z.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(),s=e.getBottomLeft(),c=this.calculateModuleSize(t,n,s);if(c<1)throw new I("No pattern found in proccess finder.");const d=Zr.computeDimension(t,n,s,c),h=Ne.getProvisionalVersionForDimension(d),g=h.getDimensionForVersion()-7;let _=null;if(h.getAlignmentPatternCenters().length>0){const B=n.getX()-t.getX()+s.getX(),z=n.getY()-t.getY()+s.getY(),G=1-3/g,Y=Math.floor(t.getX()+G*(B-t.getX())),ie=Math.floor(t.getY()+G*(z-t.getY()));for(let ue=4;ue<=16;ue<<=1)try{_=this.findAlignmentInRegion(c,Y,ie,ue);break}catch(fe){if(!(fe instanceof I))throw fe}}const E=Zr.createTransform(t,n,s,_,d),A=Zr.sampleGrid(this.image,E,d);let S;return _===null?S=[s,t,n]:S=[s,t,n,_],new br(A,S)}static createTransform(e,t,n,s,c){const d=c-3.5;let h,g,_,E;return s!==null?(h=s.getX(),g=s.getY(),_=d-3,E=_):(h=t.getX()-e.getX()+n.getX(),g=t.getY()-e.getY()+n.getY(),_=d,E=d),dn.quadrilateralToQuadrilateral(3.5,3.5,d,3.5,_,E,3.5,d,e.getX(),e.getY(),t.getX(),t.getY(),h,g,n.getX(),n.getY())}static sampleGrid(e,t,n){return Rn.getInstance().sampleGridWithTransform(e,n,n,t)}static computeDimension(e,t,n,s){const c=ve.round(ye.distance(e,t)/s),d=ve.round(ye.distance(e,n)/s);let h=Math.floor((c+d)/2)+7;switch(h&3){case 0:h++;break;case 2:h--;break;case 3:throw new I("Dimensions could be not found.")}return h}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())),s=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.getX()),Math.floor(t.getY()),Math.floor(e.getX()),Math.floor(e.getY()));return isNaN(n)?s/7:isNaN(s)?n/7:(n+s)/14}sizeOfBlackWhiteBlackRunBothWays(e,t,n,s){let c=this.sizeOfBlackWhiteBlackRun(e,t,n,s),d=1,h=e-(n-e);h<0?(d=e/(e-h),h=0):h>=this.image.getWidth()&&(d=(this.image.getWidth()-1-e)/(h-e),h=this.image.getWidth()-1);let g=Math.floor(t-(s-t)*d);return d=1,g<0?(d=t/(t-g),g=0):g>=this.image.getHeight()&&(d=(this.image.getHeight()-1-t)/(g-t),g=this.image.getHeight()-1),h=Math.floor(e+(h-e)*d),c+=this.sizeOfBlackWhiteBlackRun(e,t,h,g),c-1}sizeOfBlackWhiteBlackRun(e,t,n,s){const c=Math.abs(s-t)>Math.abs(n-e);if(c){let B=e;e=t,t=B,B=n,n=s,s=B}const d=Math.abs(n-e),h=Math.abs(s-t);let g=-d/2;const _=e<n?1:-1,E=t<s?1:-1;let A=0;const S=n+_;for(let B=e,z=t;B!==S;B+=_){const G=c?z:B,Y=c?B:z;if(A===1===this.image.get(G,Y)){if(A===2)return ve.distance(B,z,e,t);A++}if(g+=h,g>0){if(z===s)break;z+=E,g-=d}}return A===2?ve.distance(n+_,s,e,t):NaN}findAlignmentInRegion(e,t,n,s){const c=Math.floor(s*e),d=Math.max(0,t-c),h=Math.min(this.image.getWidth()-1,t+c);if(h-d<e*3)throw new I("Alignment top exceeds estimated module size.");const g=Math.max(0,n-c),_=Math.min(this.image.getHeight()-1,n+c);if(_-g<e*3)throw new I("Alignment bottom exceeds estimated module size.");return new Di(this.image,d,g,h-d,_-g,e,this.resultPointCallback).find()}}class qn{constructor(){this.decoder=new Cg}getDecoder(){return this.decoder}decode(e,t){let n,s;if(t!=null&&t.get(Z.PURE_BARCODE)!==void 0){const g=qn.extractPureBits(e.getBlackMatrix());n=this.decoder.decodeBitMatrix(g,t),s=qn.NO_POINTS}else{const g=new Zr(e.getBlackMatrix()).detect(t);n=this.decoder.decodeBitMatrix(g.getBits(),t),s=g.getPoints()}n.getOther()instanceof ja&&n.getOther().applyMirroredCorrection(s);const c=new ge(n.getText(),n.getRawBytes(),void 0,s,xe.QR_CODE,void 0),d=n.getByteSegments();d!==null&&c.putMetadata(be.BYTE_SEGMENTS,d);const h=n.getECLevel();return h!==null&&c.putMetadata(be.ERROR_CORRECTION_LEVEL,h),n.hasStructuredAppend()&&(c.putMetadata(be.STRUCTURED_APPEND_SEQUENCE,n.getStructuredAppendSequenceNumber()),c.putMetadata(be.STRUCTURED_APPEND_PARITY,n.getStructuredAppendParity())),c}reset(){}static extractPureBits(e){const t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(t===null||n===null)throw new I;const s=this.moduleSize(t,e);let c=t[1],d=n[1],h=t[0],g=n[0];if(h>=g||c>=d)throw new I;if(d-c!==g-h&&(g=h+(d-c),g>=e.getWidth()))throw new I;const _=Math.round((g-h+1)/s),E=Math.round((d-c+1)/s);if(_<=0||E<=0)throw new I;if(E!==_)throw new I;const A=Math.floor(s/2);c+=A,h+=A;const S=h+Math.floor((_-1)*s)-g;if(S>0){if(S>A)throw new I;h-=S}const B=c+Math.floor((E-1)*s)-d;if(B>0){if(B>A)throw new I;c-=B}const z=new X(_,E);for(let G=0;G<E;G++){const Y=c+Math.floor(G*s);for(let ie=0;ie<_;ie++)e.get(h+Math.floor(ie*s),Y)&&z.set(ie,G)}return z}static moduleSize(e,t){const n=t.getHeight(),s=t.getWidth();let c=e[0],d=e[1],h=!0,g=0;for(;c<s&&d<n;){if(h!==t.get(c,d)){if(++g===5)break;h=!h}c++,d++}if(c===s||d===n)throw new I;return(c-e[0])/7}}qn.NO_POINTS=new Array;class Oe{PDF417Common(){}static getBitCountSum(e){return ve.sum(e)}static toIntArray(e){if(e==null||!e.length)return Oe.EMPTY_INT_ARRAY;const t=new Int32Array(e.length);let n=0;for(const s of e)t[n++]=s;return t}static getCodeword(e){const t=M.binarySearch(Oe.SYMBOL_TABLE,e&262143);return t<0?-1:(Oe.CODEWORD_TABLE[t]-1)%Oe.NUMBER_OF_CODEWORDS}}Oe.NUMBER_OF_CODEWORDS=929,Oe.MAX_CODEWORDS_IN_BARCODE=Oe.NUMBER_OF_CODEWORDS-1,Oe.MIN_ROWS_IN_BARCODE=3,Oe.MAX_ROWS_IN_BARCODE=90,Oe.MODULES_IN_CODEWORD=17,Oe.MODULES_IN_STOP_PATTERN=18,Oe.BARS_IN_MODULE=8,Oe.EMPTY_INT_ARRAY=new Int32Array([]),Oe.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]),Oe.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 yg{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class He{static detectMultiple(e,t,n){let s=e.getBlackMatrix(),c=He.detect(n,s);return c.length||(s=s.clone(),s.rotate180(),c=He.detect(n,s)),new yg(s,c)}static detect(e,t){const n=new Array;let s=0,c=0,d=!1;for(;s<t.getHeight();){const h=He.findVertices(t,s,c);if(h[0]==null&&h[3]==null){if(!d)break;d=!1,c=0;for(const g of n)g[1]!=null&&(s=Math.trunc(Math.max(s,g[1].getY()))),g[3]!=null&&(s=Math.max(s,Math.trunc(g[3].getY())));s+=He.ROW_STEP;continue}if(d=!0,n.push(h),!e)break;h[2]!=null?(c=Math.trunc(h[2].getX()),s=Math.trunc(h[2].getY())):(c=Math.trunc(h[4].getX()),s=Math.trunc(h[4].getY()))}return n}static findVertices(e,t,n){const s=e.getHeight(),c=e.getWidth(),d=new Array(8);return He.copyToResult(d,He.findRowsWithPattern(e,s,c,t,n,He.START_PATTERN),He.INDEXES_START_PATTERN),d[4]!=null&&(n=Math.trunc(d[4].getX()),t=Math.trunc(d[4].getY())),He.copyToResult(d,He.findRowsWithPattern(e,s,c,t,n,He.STOP_PATTERN),He.INDEXES_STOP_PATTERN),d}static copyToResult(e,t,n){for(let s=0;s<n.length;s++)e[n[s]]=t[s]}static findRowsWithPattern(e,t,n,s,c,d){const h=new Array(4);let g=!1;const _=new Int32Array(d.length);for(;s<t;s+=He.ROW_STEP){let A=He.findGuardPattern(e,c,s,n,!1,d,_);if(A!=null){for(;s>0;){const S=He.findGuardPattern(e,c,--s,n,!1,d,_);if(S!=null)A=S;else{s++;break}}h[0]=new ye(A[0],s),h[1]=new ye(A[1],s),g=!0;break}}let E=s+1;if(g){let A=0,S=Int32Array.from([Math.trunc(h[0].getX()),Math.trunc(h[1].getX())]);for(;E<t;E++){const B=He.findGuardPattern(e,S[0],E,n,!1,d,_);if(B!=null&&Math.abs(S[0]-B[0])<He.MAX_PATTERN_DRIFT&&Math.abs(S[1]-B[1])<He.MAX_PATTERN_DRIFT)S=B,A=0;else{if(A>He.SKIPPED_ROW_COUNT_MAX)break;A++}}E-=A+1,h[2]=new ye(S[0],E),h[3]=new ye(S[1],E)}return E-s<He.BARCODE_MIN_HEIGHT&&M.fill(h,null),h}static findGuardPattern(e,t,n,s,c,d,h){M.fillWithin(h,0,h.length,0);let g=t,_=0;for(;e.get(g,n)&&g>0&&_++<He.MAX_PIXEL_DRIFT;)g--;let E=g,A=0,S=d.length;for(let B=c;E<s;E++)if(e.get(E,n)!==B)h[A]++;else{if(A===S-1){if(He.patternMatchVariance(h,d,He.MAX_INDIVIDUAL_VARIANCE)<He.MAX_AVG_VARIANCE)return new Int32Array([g,E]);g+=h[0]+h[1],v.arraycopy(h,2,h,0,A-1),h[A-1]=0,h[A]=0,A--}else A++;h[A]=1,B=!B}return A===S-1&&He.patternMatchVariance(h,d,He.MAX_INDIVIDUAL_VARIANCE)<He.MAX_AVG_VARIANCE?new Int32Array([g,E-1]):null}static patternMatchVariance(e,t,n){let s=e.length,c=0,d=0;for(let _=0;_<s;_++)c+=e[_],d+=t[_];if(c<d)return 1/0;let h=c/d;n*=h;let g=0;for(let _=0;_<s;_++){let E=e[_],A=t[_]*h,S=E>A?E-A:A-E;if(S>n)return 1/0;g+=S}return g/c}}He.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),He.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),He.MAX_AVG_VARIANCE=.42,He.MAX_INDIVIDUAL_VARIANCE=.8,He.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),He.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),He.MAX_PIXEL_DRIFT=3,He.MAX_PATTERN_DRIFT=5,He.SKIPPED_ROW_COUNT_MAX=25,He.ROW_STEP=5,He.BARCODE_MIN_HEIGHT=10;class Ht{constructor(e,t){if(t.length===0)throw new y;this.field=e;let n=t.length;if(n>1&&t[0]===0){let s=1;for(;s<n&&t[s]===0;)s++;s===n?this.coefficients=new Int32Array([0]):(this.coefficients=new Int32Array(n-s),v.arraycopy(t,s,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 s=0;for(let c of this.coefficients)s=this.field.add(s,c);return s}let t=this.coefficients[0],n=this.coefficients.length;for(let s=1;s<n;s++)t=this.field.add(this.field.multiply(e,t),this.coefficients[s]);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 d=t;t=n,n=d}let s=new Int32Array(n.length),c=n.length-t.length;v.arraycopy(n,0,s,0,c);for(let d=c;d<n.length;d++)s[d]=this.field.add(t[d-c],n[d]);return new Ht(this.field,s)}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 Ht?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 Ht(this.field,new Int32Array([0]));let t=this.coefficients,n=t.length,s=e.coefficients,c=s.length,d=new Int32Array(n+c-1);for(let h=0;h<n;h++){let g=t[h];for(let _=0;_<c;_++)d[h+_]=this.field.add(d[h+_],this.field.multiply(g,s[_]))}return new Ht(this.field,d)}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 Ht(this.field,t)}multiplyScalar(e){if(e===0)return new Ht(this.field,new Int32Array([0]));if(e===1)return this;let t=this.coefficients.length,n=new Int32Array(t);for(let s=0;s<t;s++)n[s]=this.field.multiply(this.coefficients[s],e);return new Ht(this.field,n)}multiplyByMonomial(e,t){if(e<0)throw new y;if(t===0)return new Ht(this.field,new Int32Array([0]));let n=this.coefficients.length,s=new Int32Array(n+e);for(let c=0;c<n;c++)s[c]=this.field.multiply(this.coefficients[c],t);return new Ht(this.field,s)}toString(){let e=new W;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 bg{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 zo extends bg{constructor(e,t){super(),this.modulus=e,this.expTable=new Int32Array(e),this.logTable=new Int32Array(e);let n=1;for(let s=0;s<e;s++)this.expTable[s]=n,n=n*t%e;for(let s=0;s<e-1;s++)this.logTable[this.expTable[s]]=s;this.zero=new Ht(this,new Int32Array([0])),this.one=new Ht(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 Ht(this,n)}}zo.PDF417_GF=new zo(Oe.NUMBER_OF_CODEWORDS,3);class qa{constructor(){this.field=zo.PDF417_GF}decode(e,t,n){let s=new Ht(this.field,e),c=new Int32Array(t),d=!1;for(let z=t;z>0;z--){let G=s.evaluateAt(this.field.exp(z));c[t-z]=G,G!==0&&(d=!0)}if(!d)return 0;let h=this.field.getOne();if(n!=null)for(const z of n){let G=this.field.exp(e.length-1-z),Y=new Ht(this.field,new Int32Array([this.field.subtract(0,G),1]));h=h.multiply(Y)}let g=new Ht(this.field,c),_=this.runEuclideanAlgorithm(this.field.buildMonomial(t,1),g,t),E=_[0],A=_[1],S=this.findErrorLocations(E),B=this.findErrorMagnitudes(A,E,S);for(let z=0;z<S.length;z++){let G=e.length-1-this.field.log(S[z]);if(G<0)throw O.getChecksumInstance();e[G]=this.field.subtract(e[G],B[z])}return S.length}runEuclideanAlgorithm(e,t,n){if(e.getDegree()<t.getDegree()){let S=e;e=t,t=S}let s=e,c=t,d=this.field.getZero(),h=this.field.getOne();for(;c.getDegree()>=Math.round(n/2);){let S=s,B=d;if(s=c,d=h,s.isZero())throw O.getChecksumInstance();c=S;let z=this.field.getZero(),G=s.getCoefficient(s.getDegree()),Y=this.field.inverse(G);for(;c.getDegree()>=s.getDegree()&&!c.isZero();){let ie=c.getDegree()-s.getDegree(),ue=this.field.multiply(c.getCoefficient(c.getDegree()),Y);z=z.add(this.field.buildMonomial(ie,ue)),c=c.subtract(s.multiplyByMonomial(ie,ue))}h=z.multiply(d).subtract(B).negative()}let g=h.getCoefficient(0);if(g===0)throw O.getChecksumInstance();let _=this.field.inverse(g),E=h.multiply(_),A=c.multiply(_);return[E,A]}findErrorLocations(e){let t=e.getDegree(),n=new Int32Array(t),s=0;for(let c=1;c<this.field.getSize()&&s<t;c++)e.evaluateAt(c)===0&&(n[s]=this.field.inverse(c),s++);if(s!==t)throw O.getChecksumInstance();return n}findErrorMagnitudes(e,t,n){let s=t.getDegree(),c=new Int32Array(s);for(let _=1;_<=s;_++)c[s-_]=this.field.multiply(_,t.getCoefficient(_));let d=new Ht(this.field,c),h=n.length,g=new Int32Array(h);for(let _=0;_<h;_++){let E=this.field.inverse(n[_]),A=this.field.subtract(0,e.evaluateAt(E)),S=this.field.inverse(d.evaluateAt(E));g[_]=this.field.multiply(A,S)}return g}}class cr{constructor(e,t,n,s,c){e instanceof cr?this.constructor_2(e):this.constructor_1(e,t,n,s,c)}constructor_1(e,t,n,s,c){const d=t==null||n==null,h=s==null||c==null;if(d&&h)throw new I;d?(t=new ye(0,s.getY()),n=new ye(0,c.getY())):h&&(s=new ye(e.getWidth()-1,t.getY()),c=new ye(e.getWidth()-1,n.getY())),this.image=e,this.topLeft=t,this.bottomLeft=n,this.topRight=s,this.bottomRight=c,this.minX=Math.trunc(Math.min(t.getX(),n.getX())),this.maxX=Math.trunc(Math.max(s.getX(),c.getX())),this.minY=Math.trunc(Math.min(t.getY(),s.getY())),this.maxY=Math.trunc(Math.max(n.getY(),c.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 cr(e.image,e.topLeft,e.bottomLeft,t.topRight,t.bottomRight)}addMissingRows(e,t,n){let s=this.topLeft,c=this.bottomLeft,d=this.topRight,h=this.bottomRight;if(e>0){let g=n?this.topLeft:this.topRight,_=Math.trunc(g.getY()-e);_<0&&(_=0);let E=new ye(g.getX(),_);n?s=E:d=E}if(t>0){let g=n?this.bottomLeft:this.bottomRight,_=Math.trunc(g.getY()+t);_>=this.image.getHeight()&&(_=this.image.getHeight()-1);let E=new ye(g.getX(),_);n?c=E:h=E}return new cr(this.image,s,c,d,h)}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 Ag{constructor(e,t,n,s){this.columnCount=e,this.errorCorrectionLevel=s,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 Yr{constructor(){this.buffer=""}static form(e,t){let n=-1;function s(d,h,g,_,E,A){if(d==="%%")return"%";if(t[++n]===void 0)return;d=_?parseInt(_.substr(1)):void 0;let S=E?parseInt(E.substr(1)):void 0,B;switch(A){case"s":B=t[n];break;case"c":B=t[n][0];break;case"f":B=parseFloat(t[n]).toFixed(d);break;case"p":B=parseFloat(t[n]).toPrecision(d);break;case"e":B=parseFloat(t[n]).toExponential(d);break;case"x":B=parseInt(t[n]).toString(S||16);break;case"d":B=parseFloat(parseInt(t[n],S||10).toPrecision(d)).toFixed(0);break}B=typeof B=="object"?JSON.stringify(B):(+B).toString(S);let z=parseInt(g),G=g&&g[0]+""=="0"?"0":" ";for(;B.length<z;)B=h!==void 0?B+G:G+B;return B}let c=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(c,s)}format(e,...t){this.buffer+=Yr.form(e,t)}toString(){return this.buffer}}class Kr{constructor(e){this.boundingBox=new cr(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<Kr.MAX_NEARBY_DISTANCE;n++){let s=this.imageRowToCodewordIndex(e)-n;if(s>=0&&(t=this.codewords[s],t!=null)||(s=this.imageRowToCodewordIndex(e)+n,s<this.codewords.length&&(t=this.codewords[s],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 Yr;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()}}Kr.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,s]of this.values.entries()){const c={getKey:()=>n,getValue:()=>s};c.getValue()>e?(e=c.getValue(),t=[],t.push(c.getKey())):c.getValue()===e&&t.push(c.getKey())}return Oe.toIntArray(t)}getConfidence(e){return this.values.get(e)}}class Za extends Kr{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(),s=this._isLeft?n.getTopLeft():n.getTopRight(),c=this._isLeft?n.getBottomLeft():n.getBottomRight(),d=this.imageRowToCodewordIndex(Math.trunc(s.getY())),h=this.imageRowToCodewordIndex(Math.trunc(c.getY())),g=-1,_=1,E=0;for(let A=d;A<h;A++){if(t[A]==null)continue;let S=t[A],B=S.getRowNumber()-g;if(B===0)E++;else if(B===1)_=Math.max(_,E),E=1,g=S.getRowNumber();else if(B<0||S.getRowNumber()>=e.getRowCount()||B>A)t[A]=null;else{let z;_>2?z=(_-2)*B:z=B;let G=z>=A;for(let Y=1;Y<=z&&!G;Y++)G=t[A-Y]!=null;G?t[A]=null:(g=S.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 s=n.getRowNumber();if(s>=t.length)continue;t[s]++}return t}adjustIncompleteIndicatorColumnRowNumbers(e){let t=this.getBoundingBox(),n=this._isLeft?t.getTopLeft():t.getTopRight(),s=this._isLeft?t.getBottomLeft():t.getBottomRight(),c=this.imageRowToCodewordIndex(Math.trunc(n.getY())),d=this.imageRowToCodewordIndex(Math.trunc(s.getY())),h=this.getCodewords(),g=-1;for(let _=c;_<d;_++){if(h[_]==null)continue;let E=h[_];E.setRowNumberAsRowIndicatorColumn();let A=E.getRowNumber()-g;A===0||(A===1?g=E.getRowNumber():E.getRowNumber()>=e.getRowCount()?h[_]=null:g=E.getRowNumber())}}getBarcodeMetadata(){let e=this.getCodewords(),t=new Qr,n=new Qr,s=new Qr,c=new Qr;for(let h of e){if(h==null)continue;h.setRowNumberAsRowIndicatorColumn();let g=h.getValue()%30,_=h.getRowNumber();switch(this._isLeft||(_+=2),_%3){case 0:n.setValue(g*3+1);break;case 1:c.setValue(g/3),s.setValue(g%3);break;case 2:t.setValue(g+1);break}}if(t.getValue().length===0||n.getValue().length===0||s.getValue().length===0||c.getValue().length===0||t.getValue()[0]<1||n.getValue()[0]+s.getValue()[0]<Oe.MIN_ROWS_IN_BARCODE||n.getValue()[0]+s.getValue()[0]>Oe.MAX_ROWS_IN_BARCODE)return null;let d=new Ag(t.getValue()[0],n.getValue()[0],s.getValue()[0],c.getValue()[0]);return this.removeIncorrectCodewords(e,d),d}removeIncorrectCodewords(e,t){for(let n=0;n<e.length;n++){let s=e[n];if(e[n]==null)continue;let c=s.getValue()%30,d=s.getRowNumber();if(d>t.getRowCount()){e[n]=null;continue}switch(this._isLeft||(d+=2),d%3){case 0:c*3+1!==t.getRowCountUpperPart()&&(e[n]=null);break;case 1:(Math.trunc(c/3)!==t.getErrorCorrectionLevel()||c%3!==t.getRowCountLowerPart())&&(e[n]=null);break;case 2:c+1!==t.getColumnCount()&&(e[n]=null);break}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+`
17
+ `+super.toString()}}class Jr{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=Oe.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 s=0;s<n.length;s++)n[s]!=null&&(n[s].hasValidRowNumber()||this.adjustRowNumbers(t,s,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 s=1;s<=this.barcodeColumnCount;s++){let c=this.detectionResultColumns[s].getCodewords()[n];c!=null&&(c.setRowNumber(e[n].getRowNumber()),c.hasValidRowNumber()||(this.detectionResultColumns[s].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 s=t[n].getRowNumber(),c=0;for(let d=this.barcodeColumnCount+1;d>0&&c<this.ADJUST_ROW_NUMBER_SKIP;d--){let h=this.detectionResultColumns[d].getCodewords()[n];h!=null&&(c=Jr.adjustRowNumberIfValid(s,c,h),h.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 s=t[n].getRowNumber(),c=0;for(let d=1;d<this.barcodeColumnCount+1&&c<this.ADJUST_ROW_NUMBER_SKIP;d++){let h=this.detectionResultColumns[d].getCodewords()[n];h!=null&&(c=Jr.adjustRowNumberIfValid(s,c,h),h.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 s=n[t],c=this.detectionResultColumns[e-1].getCodewords(),d=c;this.detectionResultColumns[e+1]!=null&&(d=this.detectionResultColumns[e+1].getCodewords());let h=new Array(14);h[2]=c[t],h[3]=d[t],t>0&&(h[0]=n[t-1],h[4]=c[t-1],h[5]=d[t-1]),t>1&&(h[8]=n[t-2],h[10]=c[t-2],h[11]=d[t-2]),t<n.length-1&&(h[1]=n[t+1],h[6]=c[t+1],h[7]=d[t+1]),t<n.length-2&&(h[9]=n[t+2],h[12]=c[t+2],h[13]=d[t+2]);for(let g of h)if(Jr.adjustRowNumber(s,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 Yr;for(let n=0;n<e.getCodewords().length;n++){t.format("CW %3d:",n);for(let s=0;s<this.barcodeColumnCount+2;s++){if(this.detectionResultColumns[s]==null){t.format(" | ");continue}let c=this.detectionResultColumns[s].getCodewords()[n];if(c==null){t.format(" | ");continue}t.format(" %3d|%3d",c.getRowNumber(),c.getValue())}t.format("%n")}return t.toString()}}class ei{constructor(e,t,n,s){this.rowNumber=ei.BARCODE_ROW_UNKNOWN,this.startX=Math.trunc(e),this.endX=Math.trunc(t),this.bucket=Math.trunc(n),this.value=Math.trunc(s)}hasValidRowNumber(){return this.isValidRowNumber(this.rowNumber)}isValidRowNumber(e){return e!==ei.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}}ei.BARCODE_ROW_UNKNOWN=-1;class nn{static initialize(){for(let e=0;e<Oe.SYMBOL_TABLE.length;e++){let t=Oe.SYMBOL_TABLE[e],n=t&1;for(let s=0;s<Oe.BARS_IN_MODULE;s++){let c=0;for(;(t&1)===n;)c+=1,t>>=1;n=t&1,nn.RATIOS_TABLE[e]||(nn.RATIOS_TABLE[e]=new Array(Oe.BARS_IN_MODULE)),nn.RATIOS_TABLE[e][Oe.BARS_IN_MODULE-s-1]=Math.fround(c/Oe.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(e){let t=nn.getDecodedCodewordValue(nn.sampleBitCounts(e));return t!==-1?t:nn.getClosestDecodedValue(e)}static sampleBitCounts(e){let t=ve.sum(e),n=new Int32Array(Oe.BARS_IN_MODULE),s=0,c=0;for(let d=0;d<Oe.MODULES_IN_CODEWORD;d++){let h=t/(2*Oe.MODULES_IN_CODEWORD)+d*t/Oe.MODULES_IN_CODEWORD;c+e[s]<=h&&(c+=e[s],s++),n[s]++}return n}static getDecodedCodewordValue(e){let t=nn.getBitValue(e);return Oe.getCodeword(t)===-1?-1:t}static getBitValue(e){let t=0;for(let n=0;n<e.length;n++)for(let s=0;s<e[n];s++)t=t<<1|(n%2===0?1:0);return Math.trunc(t)}static getClosestDecodedValue(e){let t=ve.sum(e),n=new Array(Oe.BARS_IN_MODULE);if(t>1)for(let d=0;d<n.length;d++)n[d]=Math.fround(e[d]/t);let s=ar.MAX_VALUE,c=-1;this.bSymbolTableReady||nn.initialize();for(let d=0;d<nn.RATIOS_TABLE.length;d++){let h=0,g=nn.RATIOS_TABLE[d];for(let _=0;_<Oe.BARS_IN_MODULE;_++){let E=Math.fround(g[_]-n[_]);if(h+=Math.fround(E*E),h>=s)break}h<s&&(s=h,c=Oe.SYMBOL_TABLE[d])}return c}}nn.bSymbolTableReady=!1,nn.RATIOS_TABLE=new Array(Oe.SYMBOL_TABLE.length).map(b=>new Array(Oe.BARS_IN_MODULE));class Ya{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 Ka{static parseLong(e,t=void 0){return parseInt(e,t)}}class Qa extends x{}Qa.kind="NullPointerException";class Sg{writeBytes(e){this.writeBytesOffset(e,0,e.length)}writeBytesOffset(e,t,n){if(e==null)throw new Qa;if(t<0||t>e.length||n<0||t+n>e.length||t+n<0)throw new D;if(n===0)return;for(let s=0;s<n;s++)this.write(e[t+s])}flush(){}close(){}}class Ig extends x{}class Ng extends Sg{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 Ig;n=R.MAX_VALUE}this.buf=M.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 D;this.ensureCapacity(this.count+n),v.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 M.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 lt;(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"})(lt||(lt={}));function Ja(){if(typeof window<"u")return window.BigInt||null;if(typeof wr<"u")return wr.BigInt||null;if(typeof self<"u")return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}let vi;function Zn(b){if(typeof vi>"u"&&(vi=Ja()),vi===null)throw new Error("BigInt is not supported!");return vi(b)}function Tg(){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 ne{static decode(e,t){let n=new W(""),s=L.ISO8859_1;n.enableDecoding(s);let c=1,d=e[c++],h=new Ya;for(;c<e[0];){switch(d){case ne.TEXT_COMPACTION_MODE_LATCH:c=ne.textCompaction(e,c,n);break;case ne.BYTE_COMPACTION_MODE_LATCH:case ne.BYTE_COMPACTION_MODE_LATCH_6:c=ne.byteCompaction(d,e,s,c,n);break;case ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(e[c++]);break;case ne.NUMERIC_COMPACTION_MODE_LATCH:c=ne.numericCompaction(e,c,n);break;case ne.ECI_CHARSET:L.getCharacterSetECIByValue(e[c++]);break;case ne.ECI_GENERAL_PURPOSE:c+=2;break;case ne.ECI_USER_DEFINED:c++;break;case ne.BEGIN_MACRO_PDF417_CONTROL_BLOCK:c=ne.decodeMacroBlock(e,c,h);break;case ne.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case ne.MACRO_PDF417_TERMINATOR:throw new V;default:c--,c=ne.textCompaction(e,c,n);break}if(c<e.length)d=e[c++];else throw V.getFormatInstance()}if(n.length()===0)throw V.getFormatInstance();let g=new et(null,n.toString(),null,t);return g.setOther(h),g}static decodeMacroBlock(e,t,n){if(t+ne.NUMBER_OF_SEQUENCE_CODEWORDS>e[0])throw V.getFormatInstance();let s=new Int32Array(ne.NUMBER_OF_SEQUENCE_CODEWORDS);for(let h=0;h<ne.NUMBER_OF_SEQUENCE_CODEWORDS;h++,t++)s[h]=e[t];n.setSegmentIndex(R.parseInt(ne.decodeBase900toBase10(s,ne.NUMBER_OF_SEQUENCE_CODEWORDS)));let c=new W;t=ne.textCompaction(e,t,c),n.setFileId(c.toString());let d=-1;for(e[t]===ne.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(d=t+1);t<e[0];)switch(e[t]){case ne.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(t++,e[t]){case ne.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let h=new W;t=ne.textCompaction(e,t+1,h),n.setFileName(h.toString());break;case ne.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let g=new W;t=ne.textCompaction(e,t+1,g),n.setSender(g.toString());break;case ne.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let _=new W;t=ne.textCompaction(e,t+1,_),n.setAddressee(_.toString());break;case ne.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let E=new W;t=ne.numericCompaction(e,t+1,E),n.setSegmentCount(R.parseInt(E.toString()));break;case ne.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let A=new W;t=ne.numericCompaction(e,t+1,A),n.setTimestamp(Ka.parseLong(A.toString()));break;case ne.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let S=new W;t=ne.numericCompaction(e,t+1,S),n.setChecksum(R.parseInt(S.toString()));break;case ne.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let B=new W;t=ne.numericCompaction(e,t+1,B),n.setFileSize(Ka.parseLong(B.toString()));break;default:throw V.getFormatInstance()}break;case ne.MACRO_PDF417_TERMINATOR:t++,n.setLastSegment(!0);break;default:throw V.getFormatInstance()}if(d!==-1){let h=t-d;n.isLastSegment()&&h--,n.setOptionalData(M.copyOfRange(e,d,d+h))}return t}static textCompaction(e,t,n){let s=new Int32Array((e[0]-t)*2),c=new Int32Array((e[0]-t)*2),d=0,h=!1;for(;t<e[0]&&!h;){let g=e[t++];if(g<ne.TEXT_COMPACTION_MODE_LATCH)s[d]=g/30,s[d+1]=g%30,d+=2;else switch(g){case ne.TEXT_COMPACTION_MODE_LATCH:s[d++]=ne.TEXT_COMPACTION_MODE_LATCH;break;case ne.BYTE_COMPACTION_MODE_LATCH:case ne.BYTE_COMPACTION_MODE_LATCH_6:case ne.NUMERIC_COMPACTION_MODE_LATCH:case ne.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case ne.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case ne.MACRO_PDF417_TERMINATOR:t--,h=!0;break;case ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s[d]=ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,g=e[t++],c[d]=g,d++;break}}return ne.decodeTextCompaction(s,c,d,n),t}static decodeTextCompaction(e,t,n,s){let c=lt.ALPHA,d=lt.ALPHA,h=0;for(;h<n;){let g=e[h],_="";switch(c){case lt.ALPHA:if(g<26)_=String.fromCharCode(65+g);else switch(g){case 26:_=" ";break;case ne.LL:c=lt.LOWER;break;case ne.ML:c=lt.MIXED;break;case ne.PS:d=c,c=lt.PUNCT_SHIFT;break;case ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s.append(t[h]);break;case ne.TEXT_COMPACTION_MODE_LATCH:c=lt.ALPHA;break}break;case lt.LOWER:if(g<26)_=String.fromCharCode(97+g);else switch(g){case 26:_=" ";break;case ne.AS:d=c,c=lt.ALPHA_SHIFT;break;case ne.ML:c=lt.MIXED;break;case ne.PS:d=c,c=lt.PUNCT_SHIFT;break;case ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s.append(t[h]);break;case ne.TEXT_COMPACTION_MODE_LATCH:c=lt.ALPHA;break}break;case lt.MIXED:if(g<ne.PL)_=ne.MIXED_CHARS[g];else switch(g){case ne.PL:c=lt.PUNCT;break;case 26:_=" ";break;case ne.LL:c=lt.LOWER;break;case ne.AL:c=lt.ALPHA;break;case ne.PS:d=c,c=lt.PUNCT_SHIFT;break;case ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s.append(t[h]);break;case ne.TEXT_COMPACTION_MODE_LATCH:c=lt.ALPHA;break}break;case lt.PUNCT:if(g<ne.PAL)_=ne.PUNCT_CHARS[g];else switch(g){case ne.PAL:c=lt.ALPHA;break;case ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s.append(t[h]);break;case ne.TEXT_COMPACTION_MODE_LATCH:c=lt.ALPHA;break}break;case lt.ALPHA_SHIFT:if(c=d,g<26)_=String.fromCharCode(65+g);else switch(g){case 26:_=" ";break;case ne.TEXT_COMPACTION_MODE_LATCH:c=lt.ALPHA;break}break;case lt.PUNCT_SHIFT:if(c=d,g<ne.PAL)_=ne.PUNCT_CHARS[g];else switch(g){case ne.PAL:c=lt.ALPHA;break;case ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:s.append(t[h]);break;case ne.TEXT_COMPACTION_MODE_LATCH:c=lt.ALPHA;break}break}_!==""&&s.append(_),h++}}static byteCompaction(e,t,n,s,c){let d=new Ng,h=0,g=0,_=!1;switch(e){case ne.BYTE_COMPACTION_MODE_LATCH:let E=new Int32Array(6),A=t[s++];for(;s<t[0]&&!_;)switch(E[h++]=A,g=900*g+A,A=t[s++],A){case ne.TEXT_COMPACTION_MODE_LATCH:case ne.BYTE_COMPACTION_MODE_LATCH:case ne.NUMERIC_COMPACTION_MODE_LATCH:case ne.BYTE_COMPACTION_MODE_LATCH_6:case ne.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case ne.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case ne.MACRO_PDF417_TERMINATOR:s--,_=!0;break;default:if(h%5===0&&h>0){for(let S=0;S<6;++S)d.write(Number(Zn(g)>>Zn(8*(5-S))));g=0,h=0}break}s===t[0]&&A<ne.TEXT_COMPACTION_MODE_LATCH&&(E[h++]=A);for(let S=0;S<h;S++)d.write(E[S]);break;case ne.BYTE_COMPACTION_MODE_LATCH_6:for(;s<t[0]&&!_;){let S=t[s++];if(S<ne.TEXT_COMPACTION_MODE_LATCH)h++,g=900*g+S;else switch(S){case ne.TEXT_COMPACTION_MODE_LATCH:case ne.BYTE_COMPACTION_MODE_LATCH:case ne.NUMERIC_COMPACTION_MODE_LATCH:case ne.BYTE_COMPACTION_MODE_LATCH_6:case ne.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case ne.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case ne.MACRO_PDF417_TERMINATOR:s--,_=!0;break}if(h%5===0&&h>0){for(let B=0;B<6;++B)d.write(Number(Zn(g)>>Zn(8*(5-B))));g=0,h=0}}break}return c.append(Q.decode(d.toByteArray(),n)),s}static numericCompaction(e,t,n){let s=0,c=!1,d=new Int32Array(ne.MAX_NUMERIC_CODEWORDS);for(;t<e[0]&&!c;){let h=e[t++];if(t===e[0]&&(c=!0),h<ne.TEXT_COMPACTION_MODE_LATCH)d[s]=h,s++;else switch(h){case ne.TEXT_COMPACTION_MODE_LATCH:case ne.BYTE_COMPACTION_MODE_LATCH:case ne.BYTE_COMPACTION_MODE_LATCH_6:case ne.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case ne.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case ne.MACRO_PDF417_TERMINATOR:t--,c=!0;break}(s%ne.MAX_NUMERIC_CODEWORDS===0||h===ne.NUMERIC_COMPACTION_MODE_LATCH||c)&&s>0&&(n.append(ne.decodeBase900toBase10(d,s)),s=0)}return t}static decodeBase900toBase10(e,t){let n=Zn(0);for(let c=0;c<t;c++)n+=ne.EXP900[t-c-1]*Zn(e[c]);let s=n.toString();if(s.charAt(0)!=="1")throw new V;return s.substring(1)}}ne.TEXT_COMPACTION_MODE_LATCH=900,ne.BYTE_COMPACTION_MODE_LATCH=901,ne.NUMERIC_COMPACTION_MODE_LATCH=902,ne.BYTE_COMPACTION_MODE_LATCH_6=924,ne.ECI_USER_DEFINED=925,ne.ECI_GENERAL_PURPOSE=926,ne.ECI_CHARSET=927,ne.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,ne.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,ne.MACRO_PDF417_TERMINATOR=922,ne.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,ne.MAX_NUMERIC_CODEWORDS=15,ne.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,ne.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,ne.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,ne.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,ne.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,ne.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,ne.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,ne.PL=25,ne.LL=27,ne.AS=27,ne.ML=28,ne.AL=28,ne.PS=29,ne.PAL=29,ne.PUNCT_CHARS=`;<>@[\\]_\`~!\r ,:
18
+ -.$/"|*()?{}'`,ne.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",ne.EXP900=Ja()?Tg():[],ne.NUMBER_OF_SEQUENCE_CODEWORDS=2;class We{constructor(){}static decode(e,t,n,s,c,d,h){let g=new cr(e,t,n,s,c),_=null,E=null,A;for(let z=!0;;z=!1){if(t!=null&&(_=We.getRowIndicatorColumn(e,g,t,!0,d,h)),s!=null&&(E=We.getRowIndicatorColumn(e,g,s,!1,d,h)),A=We.merge(_,E),A==null)throw I.getNotFoundInstance();let G=A.getBoundingBox();if(z&&G!=null&&(G.getMinY()<g.getMinY()||G.getMaxY()>g.getMaxY()))g=G;else break}A.setBoundingBox(g);let S=A.getBarcodeColumnCount()+1;A.setDetectionResultColumn(0,_),A.setDetectionResultColumn(S,E);let B=_!=null;for(let z=1;z<=S;z++){let G=B?z:S-z;if(A.getDetectionResultColumn(G)!==void 0)continue;let Y;G===0||G===S?Y=new Za(g,G===0):Y=new Kr(g),A.setDetectionResultColumn(G,Y);let ie=-1,ue=ie;for(let fe=g.getMinY();fe<=g.getMaxY();fe++){if(ie=We.getStartColumn(A,G,fe,B),ie<0||ie>g.getMaxX()){if(ue===-1)continue;ie=ue}let le=We.detectCodeword(e,g.getMinX(),g.getMaxX(),B,ie,fe,d,h);le!=null&&(Y.setCodeword(fe,le),ue=ie,d=Math.min(d,le.getWidth()),h=Math.max(h,le.getWidth()))}}return We.createDecoderResult(A)}static merge(e,t){if(e==null&&t==null)return null;let n=We.getBarcodeMetadata(e,t);if(n==null)return null;let s=cr.merge(We.adjustBoundingBox(e),We.adjustBoundingBox(t));return new Jr(n,s)}static adjustBoundingBox(e){if(e==null)return null;let t=e.getRowHeights();if(t==null)return null;let n=We.getMax(t),s=0;for(let h of t)if(s+=n-h,h>0)break;let c=e.getCodewords();for(let h=0;s>0&&c[h]==null;h++)s--;let d=0;for(let h=t.length-1;h>=0&&(d+=n-t[h],!(t[h]>0));h--);for(let h=c.length-1;d>0&&c[h]==null;h--)d--;return e.getBoundingBox().addMissingRows(s,d,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 s;return t==null||(s=t.getBarcodeMetadata())==null?n:n.getColumnCount()!==s.getColumnCount()&&n.getErrorCorrectionLevel()!==s.getErrorCorrectionLevel()&&n.getRowCount()!==s.getRowCount()?null:n}static getRowIndicatorColumn(e,t,n,s,c,d){let h=new Za(t,s);for(let g=0;g<2;g++){let _=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+=_){let S=We.detectCodeword(e,0,e.getWidth(),s,E,A,c,d);S!=null&&(h.setCodeword(A,S),s?E=S.getStartX():E=S.getEndX())}}return h}static adjustCodewordCount(e,t){let n=t[0][1],s=n.getValue(),c=e.getBarcodeColumnCount()*e.getBarcodeRowCount()-We.getNumberOfECCodeWords(e.getBarcodeECLevel());if(s.length===0){if(c<1||c>Oe.MAX_CODEWORDS_IN_BARCODE)throw I.getNotFoundInstance();n.setValue(c)}else s[0]!==c&&n.setValue(c)}static createDecoderResult(e){let t=We.createBarcodeMatrix(e);We.adjustCodewordCount(e,t);let n=new Array,s=new Int32Array(e.getBarcodeRowCount()*e.getBarcodeColumnCount()),c=[],d=new Array;for(let g=0;g<e.getBarcodeRowCount();g++)for(let _=0;_<e.getBarcodeColumnCount();_++){let E=t[g][_+1].getValue(),A=g*e.getBarcodeColumnCount()+_;E.length===0?n.push(A):E.length===1?s[A]=E[0]:(d.push(A),c.push(E))}let h=new Array(c.length);for(let g=0;g<h.length;g++)h[g]=c[g];return We.createDecoderResultFromAmbiguousValues(e.getBarcodeECLevel(),s,Oe.toIntArray(n),Oe.toIntArray(d),h)}static createDecoderResultFromAmbiguousValues(e,t,n,s,c){let d=new Int32Array(s.length),h=100;for(;h-- >0;){for(let g=0;g<d.length;g++)t[s[g]]=c[g][d[g]];try{return We.decodeCodewords(t,e,n)}catch(g){if(!(g instanceof O))throw g}if(d.length===0)throw O.getChecksumInstance();for(let g=0;g<d.length;g++)if(d[g]<c[g].length-1){d[g]++;break}else if(d[g]=0,g===d.length-1)throw O.getChecksumInstance()}throw O.getChecksumInstance()}static createBarcodeMatrix(e){let t=Array.from({length:e.getBarcodeRowCount()},()=>new Array(e.getBarcodeColumnCount()+2));for(let s=0;s<t.length;s++)for(let c=0;c<t[s].length;c++)t[s][c]=new Qr;let n=0;for(let s of e.getDetectionResultColumns()){if(s!=null){for(let c of s.getCodewords())if(c!=null){let d=c.getRowNumber();if(d>=0){if(d>=t.length)continue;t[d][n].setValue(c.getValue())}}}n++}return t}static isValidBarcodeColumn(e,t){return t>=0&&t<=e.getBarcodeColumnCount()+1}static getStartColumn(e,t,n,s){let c=s?1:-1,d=null;if(We.isValidBarcodeColumn(e,t-c)&&(d=e.getDetectionResultColumn(t-c).getCodeword(n)),d!=null)return s?d.getEndX():d.getStartX();if(d=e.getDetectionResultColumn(t).getCodewordNearby(n),d!=null)return s?d.getStartX():d.getEndX();if(We.isValidBarcodeColumn(e,t-c)&&(d=e.getDetectionResultColumn(t-c).getCodewordNearby(n)),d!=null)return s?d.getEndX():d.getStartX();let h=0;for(;We.isValidBarcodeColumn(e,t-c);){t-=c;for(let g of e.getDetectionResultColumn(t).getCodewords())if(g!=null)return(s?g.getEndX():g.getStartX())+c*h*(g.getEndX()-g.getStartX());h++}return s?e.getBoundingBox().getMinX():e.getBoundingBox().getMaxX()}static detectCodeword(e,t,n,s,c,d,h,g){c=We.adjustCodewordStartColumn(e,t,n,s,c,d);let _=We.getModuleBitCount(e,t,n,s,c,d);if(_==null)return null;let E,A=ve.sum(_);if(s)E=c+A;else{for(let z=0;z<_.length/2;z++){let G=_[z];_[z]=_[_.length-1-z],_[_.length-1-z]=G}E=c,c=E-A}if(!We.checkCodewordSkew(A,h,g))return null;let S=nn.getDecodedValue(_),B=Oe.getCodeword(S);return B===-1?null:new ei(c,E,We.getCodewordBucketNumber(S),B)}static getModuleBitCount(e,t,n,s,c,d){let h=c,g=new Int32Array(8),_=0,E=s?1:-1,A=s;for(;(s?h<n:h>=t)&&_<g.length;)e.get(h,d)===A?(g[_]++,h+=E):(_++,A=!A);return _===g.length||h===(s?n:t)&&_===g.length-1?g:null}static getNumberOfECCodeWords(e){return 2<<e}static adjustCodewordStartColumn(e,t,n,s,c,d){let h=c,g=s?-1:1;for(let _=0;_<2;_++){for(;(s?h>=t:h<n)&&s===e.get(h,d);){if(Math.abs(c-h)>We.CODEWORD_SKEW_SIZE)return c;h+=g}g=-g,s=!s}return h}static checkCodewordSkew(e,t,n){return t-We.CODEWORD_SKEW_SIZE<=e&&e<=n+We.CODEWORD_SKEW_SIZE}static decodeCodewords(e,t,n){if(e.length===0)throw V.getFormatInstance();let s=1<<t+1,c=We.correctErrors(e,n,s);We.verifyCodewordCount(e,s);let d=ne.decode(e,""+t);return d.setErrorsCorrected(c),d.setErasures(n.length),d}static correctErrors(e,t,n){if(t!=null&&t.length>n/2+We.MAX_ERRORS||n<0||n>We.MAX_EC_CODEWORDS)throw O.getChecksumInstance();return We.errorCorrection.decode(e,n,t)}static verifyCodewordCount(e,t){if(e.length<4)throw V.getFormatInstance();let n=e[0];if(n>e.length)throw V.getFormatInstance();if(n===0)if(t<e.length)e[0]=e.length-t;else throw V.getFormatInstance()}static getBitCountForCodeword(e){let t=new Int32Array(8),n=0,s=t.length-1;for(;!((e&1)!==n&&(n=e&1,s--,s<0));)t[s]++,e>>=1;return t}static getCodewordBucketNumber(e){return e instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(e):this.getCodewordBucketNumber_number(e)}static getCodewordBucketNumber_number(e){return We.getCodewordBucketNumber(We.getBitCountForCodeword(e))}static getCodewordBucketNumber_Int32Array(e){return(e[0]-e[2]+e[4]-e[6]+9)%9}static toString(e){let t=new Yr;for(let n=0;n<e.length;n++){t.format("Row %2d: ",n);for(let s=0;s<e[n].length;s++){let c=e[n][s];c.getValue().length===0?t.format(" ",null):t.format("%4d(%2d)",c.getValue()[0],c.getConfidence(c.getValue()[0]))}t.format("%n")}return t.toString()}}We.CODEWORD_SKEW_SIZE=2,We.MAX_ERRORS=3,We.MAX_EC_CODEWORDS=512,We.errorCorrection=new qa;class Gt{decode(e,t=null){let n=Gt.decode(e,t,!1);if(n==null||n.length===0||n[0]==null)throw I.getNotFoundInstance();return n[0]}decodeMultiple(e,t=null){try{return Gt.decode(e,t,!0)}catch(n){throw n instanceof V||n instanceof O?I.getNotFoundInstance():n}}static decode(e,t,n){const s=new Array,c=He.detectMultiple(e,t,n);for(const d of c.getPoints()){const h=We.decode(c.getBits(),d[4],d[5],d[6],d[7],Gt.getMinCodewordWidth(d),Gt.getMaxCodewordWidth(d)),g=new ge(h.getText(),h.getRawBytes(),void 0,d,xe.PDF_417);g.putMetadata(be.ERROR_CORRECTION_LEVEL,h.getECLevel());const _=h.getOther();_!=null&&g.putMetadata(be.PDF417_EXTRA_METADATA,_),s.push(g)}return s.map(d=>d)}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(Gt.getMaxWidth(e[0],e[4]),Gt.getMaxWidth(e[6],e[2])*Oe.MODULES_IN_CODEWORD/Oe.MODULES_IN_STOP_PATTERN),Math.max(Gt.getMaxWidth(e[1],e[5]),Gt.getMaxWidth(e[7],e[3])*Oe.MODULES_IN_CODEWORD/Oe.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(e){return Math.floor(Math.min(Math.min(Gt.getMinWidth(e[0],e[4]),Gt.getMinWidth(e[6],e[2])*Oe.MODULES_IN_CODEWORD/Oe.MODULES_IN_STOP_PATTERN),Math.min(Gt.getMinWidth(e[1],e[5]),Gt.getMinWidth(e[7],e[3])*Oe.MODULES_IN_CODEWORD/Oe.MODULES_IN_STOP_PATTERN)))}reset(){}}class Pi extends x{}Pi.kind="ReaderException";class el{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=!i(e)&&e.get(Z.TRY_HARDER)===!0,n=i(e)?null:e.get(Z.POSSIBLE_FORMATS),s=new Array;if(!i(n)){const c=n.some(d=>d===xe.UPC_A||d===xe.UPC_E||d===xe.EAN_13||d===xe.EAN_8||d===xe.CODABAR||d===xe.CODE_39||d===xe.CODE_93||d===xe.CODE_128||d===xe.ITF||d===xe.RSS_14||d===xe.RSS_EXPANDED);c&&!t&&s.push(new Tr(e,this.verbose)),n.includes(xe.QR_CODE)&&s.push(new qn),n.includes(xe.DATA_MATRIX)&&s.push(new jn),n.includes(xe.AZTEC)&&s.push(new Sr),n.includes(xe.PDF_417)&&s.push(new Gt),c&&t&&s.push(new Tr(e,this.verbose))}s.length===0&&(t||s.push(new Tr(e,this.verbose)),s.push(new qn),s.push(new jn),s.push(new Sr),s.push(new Gt),t&&s.push(new Tr(e,this.verbose))),this.readers=s}reset(){if(this.readers!==null)for(const e of this.readers)e.reset()}decodeInternal(e){if(this.readers===null)throw new Pi("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 Pi)continue}throw new I("No MultiFormat Readers were able to detect the code.")}}class kg extends Ce{constructor(e=null,t=500){const n=new el;n.setHints(e),super(n,t)}decodeBitmap(e){return this.reader.decodeWithState(e)}}class Rg extends Ce{constructor(e=500){super(new Gt,e)}}class Bg extends Ce{constructor(e=500){super(new qn,e)}}var Ho;(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"})(Ho||(Ho={}));var Pt=Ho;class Go{constructor(e){this.field=e,this.cachedGenerators=[],this.cachedGenerators.push(new Ve(e,Int32Array.from([1])))}buildGenerator(e){const t=this.cachedGenerators;if(e>=t.length){let n=t[t.length-1];const s=this.field;for(let c=t.length;c<=e;c++){const d=n.multiply(new Ve(s,Int32Array.from([1,s.exp(c-1+s.getGeneratorBase())])));t.push(d),n=d}}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 s=this.buildGenerator(t),c=new Int32Array(n);v.arraycopy(e,0,c,0,n);let d=new Ve(this.field,c);d=d.multiplyByMonomial(t,1);const g=d.divide(s)[1].getCoefficients(),_=t-g.length;for(let E=0;E<_;E++)e[n+E]=0;v.arraycopy(g,0,e,n+_,g.length)}}class kt{constructor(){}static applyMaskPenaltyRule1(e){return kt.applyMaskPenaltyRule1Internal(e,!0)+kt.applyMaskPenaltyRule1Internal(e,!1)}static applyMaskPenaltyRule2(e){let t=0;const n=e.getArray(),s=e.getWidth(),c=e.getHeight();for(let d=0;d<c-1;d++){const h=n[d];for(let g=0;g<s-1;g++){const _=h[g];_===h[g+1]&&_===n[d+1][g]&&_===n[d+1][g+1]&&t++}}return kt.N2*t}static applyMaskPenaltyRule3(e){let t=0;const n=e.getArray(),s=e.getWidth(),c=e.getHeight();for(let d=0;d<c;d++)for(let h=0;h<s;h++){const g=n[d];h+6<s&&g[h]===1&&g[h+1]===0&&g[h+2]===1&&g[h+3]===1&&g[h+4]===1&&g[h+5]===0&&g[h+6]===1&&(kt.isWhiteHorizontal(g,h-4,h)||kt.isWhiteHorizontal(g,h+7,h+11))&&t++,d+6<c&&n[d][h]===1&&n[d+1][h]===0&&n[d+2][h]===1&&n[d+3][h]===1&&n[d+4][h]===1&&n[d+5][h]===0&&n[d+6][h]===1&&(kt.isWhiteVertical(n,h,d-4,d)||kt.isWhiteVertical(n,h,d+7,d+11))&&t++}return t*kt.N3}static isWhiteHorizontal(e,t,n){t=Math.max(t,0),n=Math.min(n,e.length);for(let s=t;s<n;s++)if(e[s]===1)return!1;return!0}static isWhiteVertical(e,t,n,s){n=Math.max(n,0),s=Math.min(s,e.length);for(let c=n;c<s;c++)if(e[c][t]===1)return!1;return!0}static applyMaskPenaltyRule4(e){let t=0;const n=e.getArray(),s=e.getWidth(),c=e.getHeight();for(let g=0;g<c;g++){const _=n[g];for(let E=0;E<s;E++)_[E]===1&&t++}const d=e.getHeight()*e.getWidth();return Math.floor(Math.abs(t*2-d)*10/d)*kt.N4}static getDataMaskBit(e,t,n){let s,c;switch(e){case 0:s=n+t&1;break;case 1:s=n&1;break;case 2:s=t%3;break;case 3:s=(n+t)%3;break;case 4:s=Math.floor(n/2)+Math.floor(t/3)&1;break;case 5:c=n*t,s=(c&1)+c%3;break;case 6:c=n*t,s=(c&1)+c%3&1;break;case 7:c=n*t,s=c%3+(n+t&1)&1;break;default:throw new y("Invalid mask pattern: "+e)}return s===0}static applyMaskPenaltyRule1Internal(e,t){let n=0;const s=t?e.getHeight():e.getWidth(),c=t?e.getWidth():e.getHeight(),d=e.getArray();for(let h=0;h<s;h++){let g=0,_=-1;for(let E=0;E<c;E++){const A=t?d[h][E]:d[E][h];A===_?g++:(g>=5&&(n+=kt.N1+(g-5)),g=1,_=A)}g>=5&&(n+=kt.N1+(g-5))}return n}}kt.N1=3,kt.N2=3,kt.N3=40,kt.N4=10;class Li{constructor(e,t){this.width=e,this.height=t;const n=new Array(t);for(let s=0;s!==t;s++)n[s]=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)M.fill(t,e)}equals(e){if(!(e instanceof Li))return!1;const t=e;if(this.width!==t.width||this.height!==t.height)return!1;for(let n=0,s=this.height;n<s;++n){const c=this.bytes[n],d=t.bytes[n];for(let h=0,g=this.width;h<g;++h)if(c[h]!==d[h])return!1}return!0}toString(){const e=new W;for(let t=0,n=this.height;t<n;++t){const s=this.bytes[t];for(let c=0,d=this.width;c<d;++c)switch(s[c]){case 0:e.append(" 0");break;case 1:e.append(" 1");break;default:e.append(" ");break}e.append(`
19
+ `)}return e.toString()}}class dr{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 W;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 ot extends p{}ot.kind="WriterException";class ke{constructor(){}static clearMatrix(e){e.clear(255)}static buildMatrix(e,t,n,r,a){ke.clearMatrix(a),ke.embedBasicPatterns(n,a),ke.embedTypeInfo(t,r,a),ke.maybeEmbedVersionInfo(n,a),ke.embedDataBits(e,r,a)}static embedBasicPatterns(e,t){ke.embedPositionDetectionPatternsAndSeparators(t),ke.embedDarkDotAtLeftBottomCorner(t),ke.maybeEmbedPositionAdjustmentPatterns(e,t),ke.embedTimingPatterns(t)}static embedTypeInfo(e,t,n){const r=new P;ke.makeTypeInfoBits(e,t,r);for(let a=0,c=r.getSize();a<c;++a){const d=r.get(r.getSize()-1-a),g=ke.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 P;ke.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(!ke.isEmpty(n.get(w,d)))continue;let E;r<e.getSize()?(E=e.get(r),++r):E=!1,t!==255&&_t.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=ke.findMSBSet(t);for(e<<=n-1;ke.findMSBSet(e)>=n;)e^=t<<ke.findMSBSet(e)-n;return e}static makeTypeInfoBits(e,t,n){if(!ar.isValidMaskPattern(t))throw new ot("Invalid mask pattern");const r=e.getBits()<<3|t;n.appendBits(r,5);const a=ke.calculateBCHCode(r,ke.TYPE_INFO_POLY);n.appendBits(a,10);const c=new P;if(c.appendBits(ke.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=ke.calculateBCHCode(e.getVersionNumber(),ke.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;ke.isEmpty(e.get(t,6))&&e.setNumber(t,6,n),ke.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(!ke.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(!ke.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=ke.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=ke.POSITION_DETECTION_PATTERN[r];for(let c=0;c<7;++c)n.setNumber(e+c,t+r,a[c])}}static embedPositionDetectionPatternsAndSeparators(e){const t=ke.POSITION_DETECTION_PATTERN[0].length;ke.embedPositionDetectionPattern(0,0,e),ke.embedPositionDetectionPattern(e.getWidth()-t,0,e),ke.embedPositionDetectionPattern(0,e.getWidth()-t,e);const n=8;ke.embedHorizontalSeparationPattern(0,n-1,e),ke.embedHorizontalSeparationPattern(e.getWidth()-n,n-1,e),ke.embedHorizontalSeparationPattern(0,e.getWidth()-n,e);const r=7;ke.embedVerticalSeparationPattern(r,0,e),ke.embedVerticalSeparationPattern(e.getHeight()-r-1,0,e),ke.embedVerticalSeparationPattern(r,e.getHeight()-r,e)}static maybeEmbedPositionAdjustmentPatterns(e,t){if(e.getVersionNumber()<2)return;const n=e.getVersionNumber()-1,r=ke.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&&ke.isEmpty(t.get(w,d))&&ke.embedPositionAdjustmentPattern(w-2,d-2,t)}}}}ke.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])]),ke.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])]),ke.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])]),ke.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])]),ke.VERSION_INFO_POLY=7973,ke.TYPE_INFO_POLY=1335,ke.TYPE_INFO_MASK_PATTERN=21522;class Ng{constructor(e,t){this.dataBytes=e,this.errorCorrectionBytes=t}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class dt{constructor(){}static calculateMaskPenalty(e){return _t.applyMaskPenaltyRule1(e)+_t.applyMaskPenaltyRule2(e)+_t.applyMaskPenaltyRule3(e)+_t.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 P;if(c===Ne.BYTE&&(a||dt.DEFAULT_BYTE_MODE_ENCODING!==r)){const de=j.getCharacterSetECIByName(r);de!==void 0&&this.appendECI(de,d)}this.appendModeInfo(c,d);const g=new P;this.appendBytes(e,c,g,r);let w;if(n!==null&&n.get(Nt.QR_VERSION)!==void 0){const de=Number.parseInt(n.get(Nt.QR_VERSION).toString(),10);w=Se.getVersionForNumber(de);const ce=this.calculateBitsNeeded(c,d,g,w);if(!this.willFit(ce,w,t))throw new ot("Data too big for requested version")}else w=this.recommendVersion(t,c,d,g);const E=new P;E.appendBitArray(d);const A=c===Ne.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 D=this.interleaveWithECBytes(E,w.getTotalCodewords(),R,I.getNumBlocks()),F=new ar;F.setECLevel(t),F.setMode(c),F.setVersion(w);const Y=w.getDimensionForVersion(),te=new Oi(Y,Y),ue=this.chooseMaskPattern(D,t,w,te);return F.setMaskPattern(ue),ke.buildMatrix(D,t,w,ue,te),F.setMatrix(te),F}static recommendVersion(e,t,n,r){const a=this.calculateBitsNeeded(t,n,r,Se.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(j.SJIS.getName()===t&&this.isOnlyDoubleByteKanji(e))return Ne.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 Ne.BYTE}return r?Ne.ALPHANUMERIC:n?Ne.NUMERIC:Ne.BYTE}static isOnlyDoubleByteKanji(e){let t;try{t=oe.encode(e,j.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++){ke.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=Se.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,D=E-I;if(R!==D)throw new ot("EC bytes mismatch");if(n!==g+d)throw new ot("RS blocks mismatch");if(e!==(A+R)*g+(I+D)*d)throw new ot("Total bytes mismatch");r<g?(a[0]=A,c[0]=R):(a[0]=I,c[0]=D)}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],D=new Uint8Array(R);e.toBytes(8*a,D,0,R);const F=dt.generateECBytes(D,I[0]);g.push(new Ng(D,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 P;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(Te.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 Ne.NUMERIC:dt.appendNumericBytes(e,n);break;case Ne.ALPHANUMERIC:dt.appendAlphanumericBytes(e,n);break;case Ne.BYTE:dt.append8BitBytes(e,n,r);break;case Ne.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=oe.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=oe.encode(e,j.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(Ne.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=j.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(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 Ue;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),D=Math.floor((A-d*I)/2),F=this.createSVGElement(E,A);for(let Y=0,te=D;Y<d;Y++,te+=I)for(let ue=0,de=R;ue<c;ue++,de+=I)if(a.get(ue,Y)===1){const ce=this.createSvgRectElement(de,te,I,I);F.appendChild(ce)}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 Ir{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=Ir.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 Ir.renderResult(g,n,r,d)}static renderResult(e,t,n,r){const a=e.getMatrix();if(a===null)throw new Ue;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),D=Math.floor((A-d*I)/2),F=new W(E,A);for(let Y=0,te=D;Y<d;Y++,te+=I)for(let ue=0,de=R;ue<c;ue++,de+=I)a.get(ue,Y)===1&&F.setRegion(de,te,I,I);return F}}Ir.QUIET_ZONE_SIZE=4;class Tg{encode(e,t,n,r,a){let c;switch(t){case xe.QR_CODE:c=new Ir;break;default:throw new y("No encoder available for format "+t)}return c.encode(e,t,n,r,a)}}class Tn extends q{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 L.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 L.arraycopy(this.yuvData,a,r,0,n),r;for(let c=0;c<t;c++){const d=c*e;L.arraycopy(this.yuvData,a,r,d,e),a+=this.dataWidth}return r}isCropSupported(){return!0}crop(e,t,n,r){return new Tn(this.yuvData,this.dataWidth,this.dataHeight,this.left+e,this.top+t,n,r,!1)}renderThumbnail(){const e=this.getWidth()/Tn.THUMBNAIL_SCALE_FACTOR,t=this.getHeight()/Tn.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*Tn.THUMBNAIL_SCALE_FACTOR]&255;n[d+g]=4278190080|w*65793}a+=this.dataWidth*Tn.THUMBNAIL_SCALE_FACTOR}return n}getThumbnailWidth(){return this.getWidth()/Tn.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/Tn.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 $(this)}}Tn.THUMBNAIL_SCALE_FACTOR=2;class Po extends q{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,D=A&255;w[E]=(I+R+D)/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 L.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 L.arraycopy(this.luminances,a,r,0,n),r;for(let c=0;c<t;c++){const d=c*e;L.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 $(this)}}class Za extends j{static forName(e){return this.getCharacterSetECIByName(e)}}class Lo{}Lo.ISO_8859_1=j.ISO8859_1;class Ya{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 $a{static singletonList(e){return[e]}static min(e,t){return e.sort(t)[0]}}class kg{constructor(e){this.previous=e}getPrevious(){return this.previous}}class Sr extends kg{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 Sr(this,e,t)}addBinaryShift(e,t){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new Sr(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 Sr{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 Rg(b,e,t){return new Fo(b,e,t)}function $r(b,e,t){return new Sr(b,e,t)}const Og=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],qn=0,Bi=1,dn=2,Ka=3,kn=4,Bg=new Sr(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)B.fill(e,-1);return b[qn][kn]=0,b[Bi][kn]=0,b[Bi][qn]=28,b[Ka][kn]=0,b[dn][kn]=0,b[dn][qn]=15,b}const Qa=Mg(B.createInt32Array(6,6));class Rn{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===dn?4:5;return r=$r(r,t,a),new Rn(r,e,0,n+a)}shiftAndAppend(e,t){let n=this.token,r=this.mode===dn?4:5;return n=$r(n,Qa[this.mode][e],r),n=$r(n,t,5),new Rn(n,this.mode,0,this.bitCount+r+5)}addBinaryShiftChar(e){let t=this.token,n=this.mode,r=this.bitCount;if(this.mode===kn||this.mode===dn){let d=Vo[n][qn];t=$r(t,d&65535,d>>16),r+=d>>16,n=qn}let a=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,c=new Rn(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=Rg(t,e-this.binaryShiftByteCount,this.binaryShiftByteCount),new Rn(t,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(e){let t=this.bitCount+(Vo[this.mode][e.mode]>>16);return this.binaryShiftByteCount<e.binaryShiftByteCount?t+=Rn.calculateBinaryShiftCost(e)-Rn.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 P;for(const r of t)r.appendTo(n,e);return n}toString(){return ne.format("%s bits=%d bytes=%d",Og[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(e){return e.binaryShiftByteCount>62?21:e.binaryShiftByteCount>31?20:e.binaryShiftByteCount>0?10:0}}Rn.INITIAL_STATE=new Rn(Bg,qn,0,0);function vg(b){const e=ne.getCharCode(" "),t=ne.getCharCode("."),n=ne.getCharCode(",");b[qn][e]=1;const r=ne.getCharCode("Z"),a=ne.getCharCode("A");for(let I=a;I<=r;I++)b[qn][I]=I-a+2;b[Bi][e]=1;const c=ne.getCharCode("z"),d=ne.getCharCode("a");for(let I=d;I<=c;I++)b[Bi][I]=I-d+2;b[dn][e]=1;const g=ne.getCharCode("9"),w=ne.getCharCode("0");for(let I=w;I<=g;I++)b[dn][I]=I-w+2;b[dn][n]=12,b[dn][t]=13;const E=["\0"," ","","","","","","","\x07","\b"," ",`
29
- `,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""];for(let I=0;I<E.length;I++)b[Ka][ne.getCharCode(E[I])]=I;const A=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let I=0;I<A.length;I++)ne.getCharCode(A[I])>0&&(b[kn][ne.getCharCode(A[I])]=I);return b}const Uo=vg(B.createInt32Array(5,256));class Kr{constructor(e){this.text=e}encode(){const e=ne.getCharCode(" "),t=ne.getCharCode(`
30
- `);let n=$a.singletonList(Rn.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 ne.getCharCode("\r"):c=d===t?2:0;break;case ne.getCharCode("."):c=d===e?3:0;break;case ne.getCharCode(","):c=d===e?4:0;break;case ne.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 $a.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<=kn;d++){let g=Uo[d][r];if(g>0){if(c==null&&(c=e.endBinaryShift(t)),!a||d===e.getMode()||d===dn){const w=c.latchAndAppend(d,g);n.push(w)}if(!a&&Qa[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(kn,n)),e.getMode()!==kn&&r.push(a.shiftAndAppend(kn,n)),n===3||n===4){let c=a.latchAndAppend(dn,16-n).latchAndAppend(dn,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 Ke{constructor(){}static encodeBytes(e){return Ke.encode(e,Ke.DEFAULT_EC_PERCENT,Ke.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!==Ke.DEFAULT_AZTEC_LAYERS){if(d=n<0,g=Math.abs(n),g>(d?Ke.MAX_NB_BITS_COMPACT:Ke.MAX_NB_BITS))throw new y(ne.format("Illegal value %s for layers",n));w=Ke.totalBitsInLayer(g,d),E=Ke.WORD_SIZE[g];let ce=w-w%E;if(A=Ke.stuffBits(r,E),A.getSize()+a>ce)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 ce=0;;ce++){if(ce>Ke.MAX_NB_BITS)throw new y("Data too large for an Aztec code");if(d=ce<=3,g=d?ce+1:ce,w=Ke.totalBitsInLayer(g,d),c>w)continue;(A==null||E!==Ke.WORD_SIZE[g])&&(E=Ke.WORD_SIZE[g],A=Ke.stuffBits(r,E));let Xe=w-w%E;if(!(d&&A.getSize()>E*64)&&A.getSize()+a<=Xe)break}}let I=Ke.generateCheckWords(A,w,E),R=A.getSize()/E,D=Ke.generateModeMessage(d,g,R),F=(d?11:14)+g*4,Y=new Int32Array(F),te;if(d){te=F;for(let ce=0;ce<Y.length;ce++)Y[ce]=ce}else{te=F+1+2*O.truncDivision(O.truncDivision(F,2)-1,15);let ce=O.truncDivision(F,2),Xe=O.truncDivision(te,2);for(let Pe=0;Pe<ce;Pe++){let $t=Pe+O.truncDivision(Pe,15);Y[ce-Pe-1]=Xe-$t-1,Y[ce+Pe]=Xe+$t+1}}let ue=new W(te);for(let ce=0,Xe=0;ce<g;ce++){let Pe=(g-ce)*4+(d?9:12);for(let $t=0;$t<Pe;$t++){let _n=$t*2;for(let Kt=0;Kt<2;Kt++)I.get(Xe+_n+Kt)&&ue.set(Y[ce*2+Kt],Y[ce*2+$t]),I.get(Xe+Pe*2+_n+Kt)&&ue.set(Y[ce*2+$t],Y[F-1-ce*2-Kt]),I.get(Xe+Pe*4+_n+Kt)&&ue.set(Y[F-1-ce*2-Kt],Y[F-1-ce*2-$t]),I.get(Xe+Pe*6+_n+Kt)&&ue.set(Y[F-1-ce*2-$t],Y[ce*2+Kt])}Xe+=Pe*8}if(Ke.drawModeMessage(ue,d,te,D),d)Ke.drawBullsEye(ue,O.truncDivision(te,2),5);else{Ke.drawBullsEye(ue,O.truncDivision(te,2),7);for(let ce=0,Xe=0;ce<O.truncDivision(F,2)-1;ce+=15,Xe+=16)for(let Pe=O.truncDivision(te,2)&1;Pe<te;Pe+=2)ue.set(O.truncDivision(te,2)-Xe,Pe),ue.set(O.truncDivision(te,2)+Xe,Pe),ue.set(Pe,O.truncDivision(te,2)-Xe),ue.set(Pe,O.truncDivision(te,2)+Xe)}let de=new Ya;return de.setCompact(d),de.setSize(te),de.setLayers(g),de.setCodeWords(R),de.setMatrix(ue),de}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 P;return e?(r.appendBits(t-1,2),r.appendBits(n-1,6),r=Ke.generateCheckWords(r,28,4)):(r.appendBits(t-1,5),r.appendBits(n-1,11),r=Ke.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(Ke.getGF(n)),c=O.truncDivision(t,n),d=Ke.bitsToWords(e,n,c);a.encode(d,c-r);let g=t%n,w=new P;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 Te.AZTEC_PARAM;case 6:return Te.AZTEC_DATA_6;case 8:return Te.AZTEC_DATA_8;case 10:return Te.AZTEC_DATA_10;case 12:return Te.AZTEC_DATA_12;default:throw new y("Unsupported word size "+e)}}static stuffBits(e,t){let n=new P,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}}Ke.DEFAULT_EC_PERCENT=33,Ke.DEFAULT_AZTEC_LAYERS=0,Ke.MAX_NB_BITS=32,Ke.MAX_NB_BITS_COMPACT=4,Ke.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=Ke.DEFAULT_EC_PERCENT,g=Ke.DEFAULT_AZTEC_LAYERS;return a!=null&&(a.has(Nt.CHARACTER_SET)&&(c=Za.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=Ke.encode(ne.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 Ue;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 W(d,g);for(let R=0,D=A;R<c;R++,D+=w)for(let F=0,Y=E;F<a;F++,Y+=w)r.get(F,R)&&I.setRegion(Y,D,w,w);return I}}i.AbstractExpandedDecoder=Io,i.ArgumentException=C,i.ArithmeticException=kt,i.AztecCode=Ya,i.AztecCodeReader=_r,i.AztecCodeWriter=Mi,i.AztecDecoder=$e,i.AztecDetector=Un,i.AztecDetectorResult=Ai,i.AztecEncoder=Ke,i.AztecHighLevelEncoder=Kr,i.AztecPoint=At,i.BarcodeFormat=xe,i.Binarizer=k,i.BinaryBitmap=N,i.BitArray=P,i.BitMatrix=W,i.BitSource=ko,i.BrowserAztecCodeReader=Gr,i.BrowserBarcodeReader=dg,i.BrowserCodeReader=Ee,i.BrowserDatamatrixCodeReader=hg,i.BrowserMultiFormatReader=Ag,i.BrowserPDF417Reader=Ig,i.BrowserQRCodeReader=Sg,i.BrowserQRCodeSvgWriter=lr,i.CharacterSetECI=j,i.ChecksumException=M,i.Code128Reader=ee,i.Code39Reader=ae,i.DataMatrixDecodedBitStreamParser=Gn,i.DataMatrixReader=Wn,i.DecodeHintType=Z,i.DecoderResult=Ae,i.DefaultGridSampler=Ii,i.DetectorResult=rr,i.EAN13Reader=Be,i.EncodeHintType=Nt,i.Exception=p,i.FormatException=H,i.GenericGF=Te,i.GenericGFPoly=Qe,i.GlobalHistogramBinarizer=z,i.GridSampler=Hr,i.GridSamplerInstance=In,i.HTMLCanvasElementLuminanceSource=re,i.HybridBinarizer=X,i.ITFReader=ye,i.IllegalArgumentException=y,i.IllegalStateException=Ue,i.InvertedLuminanceSource=$,i.LuminanceSource=q,i.MathUtils=Me,i.MultiFormatOneDReader=br,i.MultiFormatReader=qa,i.MultiFormatWriter=Tg,i.NotFoundException=S,i.OneDReader=mt,i.PDF417DecodedBitStreamParser=J,i.PDF417DecoderErrorCorrection=za,i.PDF417Reader=vt,i.PDF417ResultMetadata=Ga,i.PerspectiveTransform=tn,i.PlanarYUVLuminanceSource=Tn,i.QRCodeByteMatrix=Oi,i.QRCodeDataMask=cn,i.QRCodeDecodedBitStreamParser=pt,i.QRCodeDecoderErrorCorrectionLevel=ct,i.QRCodeDecoderFormatInformation=Ft,i.QRCodeEncoder=dt,i.QRCodeEncoderQRCode=ar,i.QRCodeMaskUtil=_t,i.QRCodeMatrixUtil=ke,i.QRCodeMode=Ne,i.QRCodeReader=Xn,i.QRCodeVersion=Se,i.QRCodeWriter=Ir,i.RGBLuminanceSource=Po,i.RSS14Reader=wt,i.RSSExpandedReader=le,i.ReaderException=Ri,i.ReedSolomonDecoder=lt,i.ReedSolomonEncoder=Do,i.ReedSolomonException=Ie,i.Result=me,i.ResultMetadataType=He,i.ResultPoint=we,i.StringUtils=ne,i.UnsupportedOperationException=se,i.VideoInputDevice=he,i.WhiteRectangleDetector=xn,i.WriterException=ot,i.ZXingArrays=B,i.ZXingCharset=Za,i.ZXingInteger=O,i.ZXingStandardCharsets=Lo,i.ZXingStringBuilder=U,i.ZXingStringEncoding=oe,i.ZXingSystem=L,i.createAbstractExpandedDecoder=Va,Object.defineProperty(i,"__esModule",{value:!0})})})(xo,xo.exports);var ut=xo.exports;const jh=nl({__proto__:null,default:Zs(ut)},[ut]);var wa=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(),!jh)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:ma.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}(),qh=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())})},Zh=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}}},_a=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 qh(this,void 0,void 0,function(){var i,u;return Zh(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:ma.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}(),Ca=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())})},Ea=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}}},Yh=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&&_a.isSupported()?(this.primaryDecoder=new _a(s,u,f),this.secondaryDecoder=new wa(s,u,f)):this.primaryDecoder=new wa(s,u,f)}return o.prototype.decodeAsync=function(s){return Ca(this,void 0,void 0,function(){var i;return Ea(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 Ca(this,void 0,void 0,function(){var i,u;return Ea(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)}}(),_i=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())})},Ci=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}}},ya=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}(),$h=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}(ya),Kh=function(o){wo(s,o);function s(i){return o.call(this,"zoom",i)||this}return s}($h),Qh=function(o){wo(s,o);function s(i){return o.call(this,"torch",i)||this}return s}(ya),Jh=function(){function o(s){this.track=s}return o.prototype.zoomFeature=function(){return new Kh(this.track)},o.prototype.torchFeature=function(){return new Qh(this.track)},o}(),e2=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 _i(this,void 0,void 0,function(){var h,m;return Ci(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 _i(this,void 0,void 0,function(){return Ci(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 Jh(this.getFirstTrackOrFail())},o}(),t2=function(){function o(s){this.mediaStream=s}return o.prototype.render=function(s,i,u){return _i(this,void 0,void 0,function(){return Ci(this,function(f){return[2,e2.create(s,this.mediaStream,i,u)]})})},o.create=function(s){return _i(this,void 0,void 0,function(){var i,u;return Ci(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}(),ba=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())})},Aa=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}}},n2=function(){function o(){}return o.failIfNotSupported=function(){return ba(this,void 0,void 0,function(){return Aa(this,function(s){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new o]})})},o.prototype.create=function(s){return ba(this,void 0,void 0,function(){return Aa(this,function(i){return[2,t2.create(s)]})})},o}(),r2=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())})},i2=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}}},o2=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 r2(this,void 0,void 0,function(){var s,i,u,f,h,m,x;return i2(this,function(_){switch(_.label){case 0:return s=function(p){for(var C=p.getVideoTracks(),y=0,N=C;y<N.length;y++){var M=N[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}(),xt;(function(o){o[o.UNKNOWN=0]="UNKNOWN",o[o.NOT_STARTED=1]="NOT_STARTED",o[o.SCANNING=2]="SCANNING",o[o.PAUSED=3]="PAUSED"})(xt||(xt={}));var s2=function(){function o(){this.state=xt.NOT_STARTED,this.onGoingTransactionNewState=xt.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===xt.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var s=this.onGoingTransactionNewState;this.onGoingTransactionNewState=xt.UNKNOWN,this.directTransition(s)},o.prototype.cancel=function(){if(this.onGoingTransactionNewState===xt.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=xt.UNKNOWN},o.prototype.getState=function(){return this.state},o.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==xt.UNKNOWN)throw"Cannot transition to a new state, already under transition"},o.prototype.validateTransition=function(s){switch(this.state){case xt.UNKNOWN:throw"Transition from unknown is not allowed";case xt.NOT_STARTED:this.failIfNewStateIs(s,[xt.PAUSED]);break;case xt.SCANNING:break;case xt.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}(),a2=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()===xt.NOT_STARTED},o.prototype.isScanning=function(){return this.stateManager.getState()!==xt.NOT_STARTED},o.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===xt.SCANNING},o.prototype.isPaused=function(){return this.stateManager.getState()===xt.PAUSED},o}(),l2=function(){function o(){}return o.create=function(){return new a2(new s2)},o}(),c2=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)}}(),en=function(o){c2(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}(Gh),u2=function(){function o(s,i){this.logger=i,this.fps=en.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=en.DEFAULT_DISABLE_FLIP}return o.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?xa.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},o.prototype.isShadedBoxEnabled=function(){return!Dn(this.qrbox)},o.create=function(s,i){return new o(s,i)},o}(),Ia=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 Xh(this.verbose),this.qrcode=new Yh(this.getSupportedFormats(i),this.getUseBarCodeDetectorIfSupported(u),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=l2.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=u2.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:en.DEFAULT_WIDTH,C.style.position="relative",this.shouldScan=!0,this.element=C;var y=this,N=this.stateManagerProxy.startTransition(xt.SCANNING);return new Promise(function(M,k){var L=p?x.videoConstraints:y.createVideoConstraints(s);if(!L){N.cancel(),k("videoConstraints should be defined");return}var v={};(!p||x.aspectRatio)&&(v.aspectRatio=x.aspectRatio);var V={onRenderSurfaceReady:function(B,O){y.setupUi(B,O,x),y.isScanning=!0,y.foreverScan(x,u,m)}};n2.failIfNotSupported().then(function(B){B.create(L).then(function(O){return O.render(h.element,v,V).then(function(P){y.renderedCamera=P,N.execute(),M(null)}).catch(function(P){N.cancel(),k(P)})}).catch(function(O){N.cancel(),k(xr.errorGettingUserMedia(O))})}).catch(function(B){N.cancel(),k(xr.cameraStreamingNotSupported())})})},o.prototype.pause=function(s){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(xt.PAUSED),this.showPausedState(),(Dn(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(xt.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(xt.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var u=function(){if(s.element){var h=document.getElementById(en.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(Dn(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:en.DEFAULT_WIDTH,y=Math.max(p.clientHeight?p.clientHeight:_,en.FILE_SCAN_MIN_HEIGHT),N=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,_,N.x,N.y,N.width,N.height)}var L=en.FILE_SCAN_HIDDEN_CANVAS_PADDING,v=Math.max(m.width,N.width),V=Math.max(m.height,N.height),B=v+2*L,O=V+2*L,P=u.createCanvasElement(B,O);p.appendChild(P);var G=P.getContext("2d");if(!G)throw"Unable to get 2d context from canvas";G.canvas.width=B,G.canvas.height=O,G.drawImage(m,0,0,x,_,L,L,v,V);try{u.qrcode.decodeRobustlyAsync(P).then(function(Z){f(pa.createFromQrcodeResult(Z))}).catch(h)}catch(Z){h("QR code parse error, error = ".concat(Z))}},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 o2.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(!xa.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];Hh(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(Dn(s))return!0;if(!Dn(s.useBarCodeDetectorIfSupported))return s.useBarCodeDetectorIfSupported!==!1;if(Dn(s.experimentalFeatures))return!0;var i=s.experimentalFeatures;return Dn(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<en.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(en.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=Dn(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,pa.createFromQrcodeResult(f)),u.possiblyUpdateShaders(!0),!0}).catch(function(f){u.possiblyUpdateShaders(!1);var h=xr.codeParseError(f);return i(h,Wh.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 N=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(){N()})):N()}).catch(function(M){f.logger.logError("Error happend while scanning context",M),N()})}},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 N=typeof y;throw"Invalid type of 'deviceId' = ".concat(N)}}}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?en.BORDER_SHADER_MATCH_COLOR:en.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=Dn(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(en.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=en.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}(),Sa;(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"})(Sa||(Sa={}));const d2={width:"38",height:"38",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"none"},f2=["stroke"],h2=["stroke"],g2=["stroke"],m2=["stroke"],p2=["stroke"],x2=l.defineComponent({__name:"QR",props:{color:{type:String,required:!1,default:"#FFFFFF"}},setup(o){return(s,i)=>(l.openBlock(),l.createElementBlock("svg",d2,[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,f2),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,h2),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,g2),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,m2),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,p2)]))}}),_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"]},w2={key:0,class:"qr_text"},_2=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=yt(),{itemThemes:C}=_e.storeToRefs(p),y=s,N=V=>V.replace(/^[\s\S]*?((?:tel|sms|smsto|mailto|callto|facetime|viber|whatsapp):)?[\s\S]*?(%2B)?[\s\S]*?/i,(B,O,P)=>P?"+":""),M=async(V,B)=>{var Z,H,ie;if(console.log(V,B),x.value)return;i.isQr||(x.value=!0),v();const O=/[?&]table_id=([a-zA-Z0-9-]+)/,P=V.match(O),G=V.match(/\/([a-f0-9\-]{36})\?/);if(i.isQr){if(P&&G)return(Z=i.takeDataTable)==null?void 0:Z.call(i,G[1],P[1],"qr");{const j=localStorage.getItem("orgID");if(j){const se=await i.axiosInstanceGet.get(`org_unit/${j}/table`,{params:{external_link:V}}).then(oe=>{var ne,U;return((ne=oe.data)==null?void 0:ne.length)>0?(U=oe.data[0])==null?void 0:U.id:null}).catch(()=>null);if(se)return(H=i.takeDataTable)==null?void 0:H.call(i,j,se)}}y("update:is_notification",!0),y("update:notificationData",{textNotification:"Стол не найден"}),y("update:tableData",null),y("update:is_toggleAffiliation",!0)}else{const j=new yn,se=V||B.text,oe=N(se);try{await j.authorizeByCard(oe);const ne=await j.getProfile();y("update:is_notification",!0),y("update:notificationData",{textNotification:`Здравствуйте, ${ne.first_name}
31
- Баланс: ${ne.balance}`})}catch(ne){y("update:is_notification",!0),y("update:notificationData",{textNotification:((ie=ne.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=()=>{},L=async()=>{if(!(f.value||u!=null&&u.isScanning||m.value))try{f.value=!0;try{(await navigator.mediaDevices.getUserMedia({video:!0})).getTracks().forEach(Z=>Z.stop())}catch{y("update:is_notification",!0),y("update:notificationData",{textNotification:"Разрешите доступ к камере"}),f.value=!1,y("update:is_toggleAffiliation",!0);return}u=new Ia("reader");const V=await Ia.getCameras();if(!V||V.length===0){console.error("Камеры не найдены"),f.value=!1;return}let B;if(i.isQr)B=V.find(G=>_o.back.some(Z=>new RegExp(Z,"i").test(G.label))),B||(B=V.find(G=>_o.front.some(Z=>new RegExp(Z,"i").test(G.label))));else if(B=V.find(G=>_o.front.some(Z=>new RegExp(Z,"i").test(G.label))),B||(B=V.find(G=>new RegExp("amera","i").test(G.label))),!B){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],P={fps:60,qrbox:{width:320,height:500}};await u.start(B.id,P,M,k,void 0,O),h.value=!0}catch(V){y("update:is_notification",!0),y("update:notificationData",{textNotification:"Разрешите доступ к камере для сканирования"}),console.error("Ошибка доступа к камере:",V),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(V){console.error("Ошибка остановки камеры:",V)}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}),(V,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",w2,"Наведите QR на камеру")):l.createCommentVNode("",!0)],512),[[l.vShow,f.value]])])),l.createVNode(x2,{color:o.isQr?void 0:"#FFFFFF",onClick:L},null,8,["color"])]))}}),Co=_e.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}}}),Ei=Symbol("clickOutside"),C2={mounted(o,s){o[Ei]=i=>{o.contains(i.target)||s.value(i)},document.addEventListener("click",o[Ei])},unmounted(o){o[Ei]&&document.removeEventListener("click",o[Ei])}};class E2{constructor(s){je(this,"value");je(this,"next");this.value=s}}class y2{constructor(){vi(this,jt);vi(this,Vn);vi(this,tr);this.clear()}enqueue(s){const i=new E2(s);fn(this,jt)?(fn(this,Vn).next=i,On(this,Vn,i)):(On(this,jt,i),On(this,Vn,i)),zo(this,tr)._++}dequeue(){const s=fn(this,jt);if(s)return On(this,jt,fn(this,jt).next),zo(this,tr)._--,fn(this,jt)||On(this,Vn,void 0),s.value}peek(){if(fn(this,jt))return fn(this,jt).value}clear(){On(this,jt,void 0),On(this,Vn,void 0),On(this,tr,0)}get size(){return fn(this,tr)}*[Symbol.iterator](){let s=fn(this,jt);for(;s;)yield s.value,s=s.next}*drain(){for(;fn(this,jt);)yield this.dequeue()}}jt=new WeakMap,Vn=new WeakMap,tr=new WeakMap;function b2(o){Na(o);const s=new y2;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(_){Na(_),o=_,queueMicrotask(()=>{for(;i<o&&s.size>0;)u()})}},map:{async value(_,p){const C=Array.from(_,(y,N)=>this(p,y,N));return Promise.all(C)}}}),x}function Na(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 Xt=null;const Ta=b2(5),A2=async(o,s)=>{Xt&&T2();const i=at(),u=yt(),f=Co(),h=Tt(),{itemThemes:m}=_e.storeToRefs(u),{displayCards:x}=_e.storeToRefs(i),{is_notification_lib:_,notificationData_lib:p}=_e.storeToRefs(f),{stateCard:C,openProduct:y}=_e.storeToRefs(h),N=yn.create();await I2(o),Xt=ri(`wss://${s}/ws/org-unit/${o}/`,{heartbeatTimeout:3e4}),Xt.on("open",()=>console.warn("Realtime WebSocket подключён (pointId:",o,")")),Xt.on("error",M=>console.warn("WebSocket ошибка:",M)),Xt.on("close",()=>console.warn("Realtime WebSocket закрыт")),Xt.on("message",async M=>{try{if(M.type)return;m.value.kiosk_hide_menu_update_notification||(p.value.textNotification="Мы обновили меню");const k=M.params||M,L=k.active_groups||[],v=k.updated_groups||[],V=k.updated_product_groups||[],B=await Yn(),O=new Set(L.map(oe=>oe)),P=new Map(x.value.map(oe=>[oe.id,oe])),G=[],Z=B.transaction("groups","readwrite");let ie=await Z.objectStore("groups").openCursor();for(;ie;){const oe=ie.key;!O.has(oe)&&oe!==o&&(G.push(oe),await ie.delete(),P.delete(oe)),ie=await ie.continue()}await Z.done,x.value=Array.from(P.values()),G.length>0&&await S2(O);const j=[...v.map(oe=>Ta(async()=>{const[ne,U]=await Promise.all([N.getGroupByID(oe),N.loadGroupProducts(oe)]);ne.products=U,P.set(oe,ne),await kr(oe,ne),await Ra(ne,U,!0)})),...V.map(oe=>Ta(async()=>{const[ne,U]=await Promise.all([N.getGroupByID(oe),N.loadGroupProducts(oe)]);ne.products=U,P.set(oe,ne),await kr(oe,ne),await Ra(ne,U,!0),await N2(U,oe)}))];await Promise.all(j),x.value=Array.from(P.values()),await Cl(o,x),p.value.textNotification.length>1&&(_.value=!0);const se=C.value.openCard;if(se!=null&&se.id){const oe=new Set(se.groups??[]),ne=new Set;let U=!1;for(const S of P.values()){const z=S==null?void 0:S.products;if(!Array.isArray(z))continue;const X=z.find(q=>(q==null?void 0:q.id)===se.id);if((X==null?void 0:X.adult)===!0){y.value={id:null,visible:!1},h.reset();return}X&&(S==null?void 0:S.id)!=null&&(ne.add(S.id),(v.includes(S.id)||V.includes(S.id))&&(U=!0))}if(ne.size===0){y.value={id:null,visible:!1},h.reset();return}(!(oe.size===ne.size&&[...oe].every(S=>ne.has(S)))||U)&&await N.getSingleProduct(se==null?void 0:se.id)}}catch(k){console.error("ошибка обновления indexedDB [updateIndexedDB]",k)}}),Xt.connect()},I2=async o=>{try{const s=at(),i=await Hi(o);i!=null&&i.data&&(s.displayCards=i.data)}catch(s){console.error("Ошибка загрузки кэша групп:",s)}},ka=async o=>{const s=at(),i=Co(),u=Tt(),{stateCard:f,openProduct:h}=_e.storeToRefs(u),{cartProducts_lib:m}=_e.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(N=>N.name).slice(0,3).join(", ");i.notificationData_lib.textNotification=`Некоторые позиции стали недоступны и были убраны из заказа: ${y}${_.length>3?` и ещё ${_.length-3}`:""}`,m.value=p,s.updateCartInLocalStorage()}},S2=async o=>{await ka(s=>{var i;return(i=s.groups)!=null&&i.length?!s.groups.some(u=>o.has(u)):!0})},N2=async(o,s)=>{const i=at(),u=new Set(o.filter(f=>!f.adult||i.is18Allowed).map(f=>f.id));await ka(f=>{var h;return(h=f.groups)!=null&&h.includes(s)?!u.has(f.id):!1})},Ra=async(o,s,i=!0)=>{if(o.video_link&&yi(o.video_link,`${o.id}_video`,i),o.image_link&&yi(o.image_link,`${o.id}_image`,i),s!=null&&s.length)for(const u of s)u.video_link&&yi(u.video_link,`${u.id}_video`,i),u.image_link&&yi(u.image_link,`${u.id}_image`,i)},yi=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 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)}},T2=()=>{Xt&&(Xt.off("open"),Xt.off("message"),Xt.off("error"),Xt.off("close"),Xt.close(!0),Xt=null)},k2={key:0,class:"valentine-hearts"},R2=l.defineComponent({__name:"FallingHearts",props:{symbols:{default:()=>["❤","♥","💕"]},max:{default:15},interval:{default:1500}},setup(o){const s=o,i=Vt.useDocumentVisibility(),u=Vt.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),N=m(5,95),M=m(10,18),k=m(0,.3),L=m(.6,.9),v=Math.floor(m(1,6)),B={id:crypto.randomUUID(),icon:C,style:{left:`${N}%`,fontSize:`${y}px`,color:`rgba(255, 105, 180, ${L})`,animationName:`heartFall${v}`,animationDuration:`${M}s`,animationDelay:`${k}s`}};f.value.push(B);const P=setTimeout(()=>{f.value=f.value.filter(G=>G.id!==B.id),clearTimeout(P)},(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",k2,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(f.value,N=>(l.openBlock(),l.createElementBlock("span",{key:N.id,class:"heart",style:l.normalizeStyle(N.style)},l.toDisplayString(N.icon),5))),128))]))}}),O2=["src"],B2=l.defineComponent({__name:"BasketImage",props:{id:{},fallback:{}},setup(o){const s=o,{mediaUrl:i}=vn(()=>s.id,()=>s.fallback);return(u,f)=>(l.openBlock(),l.createElementBlock("img",{src:l.unref(i)||""},null,8,O2))}}),M2={class:"button_price_bg"},v2={class:"wrapper_container_price_bg"},D2={class:"button_price"},P2={key:0,class:"image_product_container"},L2=l.defineComponent({__name:"BasketButton",emits:["goToCart"],setup(o){const s=at(),{isDesktop:i}=bn(),{totalPrice_lib:u,cartProducts_lib:f}=_e.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",v2,[l.createElementVNode("div",D2,[l.unref(u)>0&&h.value.length>0?(l.openBlock(),l.createElementBlock("div",P2,[(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(B2,{id:_.id,fallback:_.fallback,class:"img_product"},null,8,["id","fallback"])]))),128))])):l.createCommentVNode("",!0),l.createVNode(l.unref(Et.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(Ut,{price:l.unref(u),fixedFloat:2},null,8,["price"]),x[1]||(x[1]=l.createTextVNode(" ₽",-1))])]),_:1},8,["whilePress"])])])]))}}),Ur=null,{min:er,max:pn,abs:Oa,floor:F2}=Math,Ba=(o,s,i)=>er(i,pn(s,o)),Ma=o=>[...o].sort((s,i)=>s-i),V2=typeof queueMicrotask=="function"?queueMicrotask:o=>{Promise.resolve().then(o)},Eo=()=>{let o;return[new Promise(s=>{o=s}),o]},va=o=>{let s;return()=>(o&&(s=o(),o=void 0),s)},zr=(o,s,i)=>{const u=i?"unshift":"push";for(let f=0;f<s;f++)o[u](-1);return o},Da=(o,s)=>{const i=o.t[s];return i===-1?o.o:i},U2=(o,s,i)=>{const u=o.t[s]===-1;return o.t[s]=i,o.i=er(s,o.i),u},bi=(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+=Da(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=F2((i+u)/2);bi(o,h)<=s?(f=h,i=h+1):u=h-1}return Ba(f,0,o.l-1)},Pa=(o,s,i)=>{const u=s-o.l;return o.i=i?-1:er(s-1,o.i),o.l=s,u>0?(zr(o.u,u),zr(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))},z2=o=>o.documentElement,H2=o=>o.ownerDocument,G2=o=>o.defaultView,La=va(()=>!!/iP(hone|od|ad)/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>0),W2=va(()=>"scrollBehavior"in z2(document).style),X2=(o,s=40,i=0,u,f=!1)=>{let h=!!i,m=1,x=0,_=0,p=0,C=0,y=0,N=0,M=0,k=0,L=Ur,v=[0,h?pn(i-1,0):-1],V=0,B=!1;const O=((U,W,S)=>({o:W,t:S?zr(S.slice(0,er(U,S.length)),pn(0,U-S.length)):zr([],U),l:U,i:-1,u:zr([],U+1)}))(o,u?u[1]:s,u&&u[0]),P=new Set,G=()=>p-_,Z=()=>G()+y+C,H=(U,W)=>((S,z,X,q)=>{if(q=er(q,S.l-1),bi(S,q)<=z){const $=wr(S,X,q);return[wr(S,z,q,$),$]}{const $=wr(S,z,void 0,q);return[$,wr(S,X,$)]}})(O,U,W,v[0]),ie=()=>bi(O,O.l),j=(U,W)=>{const S=bi(O,U)-y;return W?ie()-S-se(U):S},se=U=>Da(O,U),oe=(U,W=-1)=>O.t[U]===W,ne=U=>{U&&(La()&&M!==0||L&&k===1?y+=U:C+=U)};return{p:()=>{P.clear()},h:()=>m,m:()=>(U=>[U.t.slice(),U.o])(O),v:(U=200)=>{if(!B||h)return v;let W,S;if(N)[W,S]=v;else{let z=pn(0,Z()),X=z+x;f||(U=pn(0,U),M!==1&&(z-=U),M!==2&&(X+=U)),[W,S]=v=H(pn(0,z),pn(0,X)),L&&(W=er(W,L[0]),S=pn(S,L[1]))}return[pn(W,0),er(S,O.l-1)]},S:U=>wr(O,U-_),I:oe,O:j,k:se,j:()=>O.l,N:()=>p,B:()=>M!==0,T:()=>x,q:()=>_,M:ie,P:()=>(N=C,C=0,[N,k===2]),R:(U,W)=>{const S=[U,W];return P.add(S),()=>{P.delete(S)}},A:(U,W)=>{let S,z,X=0;switch(U){case 1:{if(W===p&&k===0)break;const q=N;N=0;const $=W-p,re=Oa($);q&&re<Oa(q)+1||k!==0||(M=$<0?2:1),h&&(h=!1),p=W,X=4;const he=G();he>=-x&&he<=ie()&&(X+=1,z=re>x);break}case 2:X=8,M!==0&&(S=!0,X+=1),M=0,k=0,L=Ur;break;case 3:{const q=W.filter(([$,re])=>!oe($,re));if(!q.length)break;ne(q.reduce(($,[re,he])=>((k===2||(L&&k===1?re<L[0]:j(re+(M===0&&k===0?1:0))<G()))&&($+=he-se(re)),$),0));for(const[$,re]of q){const he=se($),fe=U2(O,$,re);f&&(V+=fe?re:re-he)}f&&x&&V>x&&(ne((($,re)=>{let he=0;const fe=[];$.t.forEach((He,Ae)=>{He!==-1&&(fe.push(He),Ae<re&&he++)}),$.i=-1;const Ee=Ma(fe),me=Ee.length,Ve=me/2|0,xe=me%2==0?(Ee[Ve-1]+Ee[Ve])/2:Ee[Ve],ht=$.o;return(($.o=xe)-ht)*pn(re-he,0)})(O,wr(O,Z()))),f=!1),X=3,z=!0;break}case 4:x!==W&&(x||(B=z=!0),x=W,X=3);break;case 5:W[1]?(ne(Pa(O,W[0],!0)),k=2,X=1):(Pa(O,W[0]),X=1);break;case 6:_=W;break;case 7:k=1;break;case 8:L=H(W,W+x),X=1}X&&(m=1+(2147483647&m),S&&y&&(C+=y,y=0),P.forEach(([q,$])=>{X&q&&$(z)}))}}},yo=setTimeout,bo=(o,s)=>s?-o:o,j2=(o,s,i,u,f,h)=>{const m=Date.now;let x=0,_=!1,p=!1,C=!1,y=!1;const N=(()=>{let V;const B=()=>{V!=Ur&&clearTimeout(V)},O=()=>{B(),V=yo(()=>{V=Ur,(()=>{if(_||p)return _=!1,void N();C=!1,o.A(2)})()},150)};return O.C=B,O})(),M=()=>{x=m(),C&&(y=!0),o.A(1,u()),N()},k=V=>{if(_||!o.B()||V.ctrlKey)return;const B=m()-x;150>B&&50<B&&(i?V.deltaX:V.deltaY)&&(_=!0)},L=()=>{p=!0,C=y=!1},v=()=>{p=!1,La()&&(C=!0)};return s.addEventListener("scroll",M),s.addEventListener("wheel",k,{passive:!0}),s.addEventListener("touchstart",L,{passive:!0}),s.addEventListener("touchend",v,{passive:!0}),{H:()=>{s.removeEventListener("scroll",M),s.removeEventListener("wheel",k),s.removeEventListener("touchstart",L),s.removeEventListener("touchend",v),N.C()},V:()=>{const[V,B]=o.P();V&&(f(V,B,y),y=!1,B&&o.T()>o.M()&&o.A(1,u()))}}},q2=(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&&W2())o.A(8,f()),V2(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()}]},Z2=o=>{let s;return{F(i){(s||(s=new(G2(H2(i))).ResizeObserver(o))).observe(i)},J(i){s.unobserve(i)},H(){s&&s.disconnect()}}},Y2=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:{},N={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&&(N.display="inline-flex"),l.createVNode(_,l.mergeProps({ref:s,style:N},y),typeof(M=h)=="function"||Object.prototype.toString.call(M)==="[object Object]"&&!l.isVNode(M)?h:{default:()=>[h],_:2},16,["style"]);var M}}}),$2=(o,s)=>{const i=o.key;return i??"_"+s},K2=(o,s)=>o[0]===s[0]&&o[1]===s[1],Fa=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=X2(o.data.length,o.itemSize,o.ssrCount,o.cache,!o.itemSize),_=((k,L)=>{let v;const V=L?"width":"height",B=new WeakMap,O=Z2(P=>{const G=[];for(const{target:Z,contentRect:H}of P)if(Z.offsetParent)if(Z===v)k.A(4,H[V]);else{const ie=B.get(Z);ie!=Ur&&G.push([ie,H[V]])}G.length&&k.A(3,G)});return{te(P){O.F(v=P)},re:(P,G)=>(B.set(P,G),O.F(P),()=>{B.delete(P),O.J(P)}),p:O.H}})(x,h),p=((k,L)=>{let v,V,B=Eo(),O=!1;const P=L?"scrollLeft":"scrollTop",G=L?"overflowX":"overflowY",[Z,H]=q2(k,()=>B[0],(ie,j)=>{ie=bo(ie,O),j?v.scrollTo({[L?"left":"top"]:ie,behavior:"smooth"}):v[P]=ie});return{oe(ie){v=ie,L&&(O=getComputedStyle(ie).direction==="rtl"),V=j2(k,ie,L,()=>bo(ie[P],O),(j,se,oe)=>{if(oe){const ne=ie.style,U=ne[G];ne[G]="hidden",yo(()=>{ne[G]=U})}ie[P]=bo(k.N()+j,O),se&&H()}),B[1](!0)},p(){V&&V.H(),B[1](!1),B=Eo()},ne:()=>O,se(ie){Z(()=>ie)},ie(ie){ie+=k.N(),Z(()=>ie)},le(ie,{align:j,smooth:se,offset:oe=0}={}){if(ie=Ba(ie,0,k.j()-1),j==="nearest"){const ne=k.O(ie),U=k.N();if(ne<U)j="start";else{if(!(ne+k.k(ie)>U+k.T()))return;j="end"}}Z(()=>oe+k.q()+k.O(ie)+(j==="end"?k.k(ie)-k.T():j==="center"?(k.k(ie)-k.T())/2:0),se)},ce:()=>{V&&V.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 L=x.v(o.bufferSize);return k&&K2(k,L)?k:L}),N=l.computed(()=>C.value&&x.B()),M=l.computed(()=>C.value&&x.M());return l.onMounted(()=>{f=!1;const k=requestAnimationFrame(()=>{const L=v=>{_.te(v),p.oe(v)};o.scrollRef?L(o.scrollRef):L(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=>pn(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,L=o.item,v=M.value,V=p.ne(),B=!h&&V?"unshift":"push",O=[],P=Z=>{var H;const ie=u.default({item:o.data[Z],index:Z})[0];return l.createVNode(Y2,{key:$2(ie,Z),L:C,W:x,Y:_.re,D:Z,X:ie,U:h,K:V,G:f,Z:L,ee:(H=o.itemProps)===null||H===void 0?void 0:H.call(o,{item:o.data[Z],index:Z})},null,8,["L","W","Y","D","X","U","K","G","Z","ee"])};if(o.keepMounted){const Z=new Set(o.keepMounted);for(let[H,ie]=y.value;H<=ie;H++)Z.add(H);Ma([...Z]).forEach(H=>{O[B](P(H))})}else for(let[Z,H]=y.value;Z<=H;Z++)O[B](P(Z));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:N.value?"none":void 0}},typeof(G=O)=="function"||Object.prototype.toString.call(G)==="[object Object]"&&!l.isVNode(G)?O:{default:()=>[O],_:2},8,["style"]);var G}}}),Q2=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(Fa,{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 _}}}),J2=(o,s=10)=>new Promise(i=>{let u=0,f=0,h=0;const m=()=>{if(!o||o.scrollSize===void 0){i();return}const x=o.scrollSize;x===h&&x>0?u++:(u=0)&&(h=x),f++,u>=2||f>=s?i():requestAnimationFrame(m)};requestAnimationFrame(m)});function eg(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,V)=>V)),C=async()=>{if(f.value&&(m.value="measure",u=!1,h.value=!1,await l.nextTick(),!(!f.value||m.value!=="measure")&&(await J2(f.value),!!f.value))){if(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&&f.value.scrollToIndex(x.value*3,{align:i})}},y=v=>m.value==="measure"?v:x.value===0?0:v%x.value,N=(v,V)=>{f.value&&f.value.scrollToIndex(v,V)},M=(v,V)=>!u||m.value!=="loop"?V:V+Math.round((v-V)/x.value)*x.value,k=v=>{if(!u||m.value!=="loop"||!f.value)return;const V=x.value-1,B=x.value*4;if(v<V)return N(x.value*3-1,{align:"start"});if(v>=B)return N(x.value*3,{align:"start"})},L=()=>{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:N,init:C,onScroll:L}}const tg=Object.prototype.toString,ng=o=>tg.call(o)==="[object Error]",rg=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"]),ig=o=>{if(!(o&&ng(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:rg.has(i)},og={pinch:!0,doubleTap:!0,wheel:!0,buttons:["+","-","=","0"]},sg=o=>{var i;const s=Object.assign({},og,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(ge,"useRoute",{enumerable:!0,get:()=>Oe.useRoute}),Object.defineProperty(ge,"useRouter",{enumerable:!0,get:()=>Oe.useRouter}),ge.BasketButton=L2,ge.BottomSheet=co,ge.ButtonDefault=on,ge.CardMain=fa,ge.CardProductPage=d0,ge.CardReader=sa,ge.CartBox=oa,ge.CartPage=Kf,ge.DrumItem=kh,ge.FallingHearts=R2,ge.GroupMain=bh,ge.InitConnection=yn,ge.ModalWindows=zh,ge.NotificationWindow=pi,ge.PopupWindowDefault=ia,ge.PricePrerender=ur,ge.QrCameraScanner=_2,ge.Recommendation=Lh,ge.RetryPage=lh,ge.TagsMain=Ih,ge.VList=Q2,ge.Virtualizer=Fa,ge.clearAllProductDB=yl,ge.clearLocalStorage=dr,ge.getCachedGroup=Hi,ge.getCachedProduct=Yo,ge.getWebSocketInstance=ri,ge.initPinia=rl,ge.initRouter=ol,ge.isNetworkError=ig,ge.parseTheme=Ks,ge.preventZoom=sg,ge.updateIndexedDB=A2,ge.useCachedMedia=vn,ge.useCardLibStore=Tt,ge.useCartLibStore=bt,ge.useImageCacheStore=ti,ge.useMainLibStore=at,ge.useModal=da,ge.useModalStore=uo,ge.useModulesLibStore=Co,ge.usePdf=bn,ge.useThemeStore=yt,ge.useVirtuaLoop=eg,ge.vClickOutside=C2,ge.vDragScroll=Lr,ge.vMuted=Vr,Object.defineProperty(ge,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<dr.NUM_MASK_PATTERNS}}dr.NUM_MASK_PATTERNS=8;class dt extends x{}dt.kind="WriterException";class Be{constructor(){}static clearMatrix(e){e.clear(255)}static buildMatrix(e,t,n,s,c){Be.clearMatrix(c),Be.embedBasicPatterns(n,c),Be.embedTypeInfo(t,s,c),Be.maybeEmbedVersionInfo(n,c),Be.embedDataBits(e,s,c)}static embedBasicPatterns(e,t){Be.embedPositionDetectionPatternsAndSeparators(t),Be.embedDarkDotAtLeftBottomCorner(t),Be.maybeEmbedPositionAdjustmentPatterns(e,t),Be.embedTimingPatterns(t)}static embedTypeInfo(e,t,n){const s=new F;Be.makeTypeInfoBits(e,t,s);for(let c=0,d=s.getSize();c<d;++c){const h=s.get(s.getSize()-1-c),g=Be.TYPE_INFO_COORDINATES[c],_=g[0],E=g[1];if(n.setBoolean(_,E,h),c<8){const A=n.getWidth()-c-1;n.setBoolean(A,8,h)}else{const S=n.getHeight()-7+(c-8);n.setBoolean(8,S,h)}}}static maybeEmbedVersionInfo(e,t){if(e.getVersionNumber()<7)return;const n=new F;Be.makeVersionInfoBits(e,n);let s=6*3-1;for(let c=0;c<6;++c)for(let d=0;d<3;++d){const h=n.get(s);s--,t.setBoolean(c,t.getHeight()-11+d,h),t.setBoolean(t.getHeight()-11+d,c,h)}}static embedDataBits(e,t,n){let s=0,c=-1,d=n.getWidth()-1,h=n.getHeight()-1;for(;d>0;){for(d===6&&(d-=1);h>=0&&h<n.getHeight();){for(let g=0;g<2;++g){const _=d-g;if(!Be.isEmpty(n.get(_,h)))continue;let E;s<e.getSize()?(E=e.get(s),++s):E=!1,t!==255&&kt.getDataMaskBit(t,_,h)&&(E=!E),n.setBoolean(_,h,E)}h+=c}c=-c,h+=c,d-=2}if(s!==e.getSize())throw new dt("Not all bits consumed: "+s+"/"+e.getSize())}static findMSBSet(e){return 32-R.numberOfLeadingZeros(e)}static calculateBCHCode(e,t){if(t===0)throw new y("0 polynomial");const n=Be.findMSBSet(t);for(e<<=n-1;Be.findMSBSet(e)>=n;)e^=t<<Be.findMSBSet(e)-n;return e}static makeTypeInfoBits(e,t,n){if(!dr.isValidMaskPattern(t))throw new dt("Invalid mask pattern");const s=e.getBits()<<3|t;n.appendBits(s,5);const c=Be.calculateBCHCode(s,Be.TYPE_INFO_POLY);n.appendBits(c,10);const d=new F;if(d.appendBits(Be.TYPE_INFO_MASK_PATTERN,15),n.xor(d),n.getSize()!==15)throw new dt("should not happen but we got: "+n.getSize())}static makeVersionInfoBits(e,t){t.appendBits(e.getVersionNumber(),6);const n=Be.calculateBCHCode(e.getVersionNumber(),Be.VERSION_INFO_POLY);if(t.appendBits(n,12),t.getSize()!==18)throw new dt("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;Be.isEmpty(e.get(t,6))&&e.setNumber(t,6,n),Be.isEmpty(e.get(6,t))&&e.setNumber(6,t,n)}}static embedDarkDotAtLeftBottomCorner(e){if(e.get(8,e.getHeight()-8)===0)throw new dt;e.setNumber(8,e.getHeight()-8,1)}static embedHorizontalSeparationPattern(e,t,n){for(let s=0;s<8;++s){if(!Be.isEmpty(n.get(e+s,t)))throw new dt;n.setNumber(e+s,t,0)}}static embedVerticalSeparationPattern(e,t,n){for(let s=0;s<7;++s){if(!Be.isEmpty(n.get(e,t+s)))throw new dt;n.setNumber(e,t+s,0)}}static embedPositionAdjustmentPattern(e,t,n){for(let s=0;s<5;++s){const c=Be.POSITION_ADJUSTMENT_PATTERN[s];for(let d=0;d<5;++d)n.setNumber(e+d,t+s,c[d])}}static embedPositionDetectionPattern(e,t,n){for(let s=0;s<7;++s){const c=Be.POSITION_DETECTION_PATTERN[s];for(let d=0;d<7;++d)n.setNumber(e+d,t+s,c[d])}}static embedPositionDetectionPatternsAndSeparators(e){const t=Be.POSITION_DETECTION_PATTERN[0].length;Be.embedPositionDetectionPattern(0,0,e),Be.embedPositionDetectionPattern(e.getWidth()-t,0,e),Be.embedPositionDetectionPattern(0,e.getWidth()-t,e);const n=8;Be.embedHorizontalSeparationPattern(0,n-1,e),Be.embedHorizontalSeparationPattern(e.getWidth()-n,n-1,e),Be.embedHorizontalSeparationPattern(0,e.getWidth()-n,e);const s=7;Be.embedVerticalSeparationPattern(s,0,e),Be.embedVerticalSeparationPattern(e.getHeight()-s-1,0,e),Be.embedVerticalSeparationPattern(s,e.getHeight()-s,e)}static maybeEmbedPositionAdjustmentPatterns(e,t){if(e.getVersionNumber()<2)return;const n=e.getVersionNumber()-1,s=Be.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[n];for(let c=0,d=s.length;c!==d;c++){const h=s[c];if(h>=0)for(let g=0;g!==d;g++){const _=s[g];_>=0&&Be.isEmpty(t.get(_,h))&&Be.embedPositionAdjustmentPattern(_-2,h-2,t)}}}}Be.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])]),Be.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])]),Be.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])]),Be.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])]),Be.VERSION_INFO_POLY=7973,Be.TYPE_INFO_POLY=1335,Be.TYPE_INFO_MASK_PATTERN=21522;class Og{constructor(e,t){this.dataBytes=e,this.errorCorrectionBytes=t}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class xt{constructor(){}static calculateMaskPenalty(e){return kt.applyMaskPenaltyRule1(e)+kt.applyMaskPenaltyRule2(e)+kt.applyMaskPenaltyRule3(e)+kt.applyMaskPenaltyRule4(e)}static encode(e,t,n=null){let s=xt.DEFAULT_BYTE_MODE_ENCODING;const c=n!==null&&n.get(Pt.CHARACTER_SET)!==void 0;c&&(s=n.get(Pt.CHARACTER_SET).toString());const d=this.chooseMode(e,s),h=new F;if(d===ke.BYTE&&(c||xt.DEFAULT_BYTE_MODE_ENCODING!==s)){const fe=L.getCharacterSetECIByName(s);fe!==void 0&&this.appendECI(fe,h)}this.appendModeInfo(d,h);const g=new F;this.appendBytes(e,d,g,s);let _;if(n!==null&&n.get(Pt.QR_VERSION)!==void 0){const fe=Number.parseInt(n.get(Pt.QR_VERSION).toString(),10);_=Ne.getVersionForNumber(fe);const le=this.calculateBitsNeeded(d,h,g,_);if(!this.willFit(le,_,t))throw new dt("Data too big for requested version")}else _=this.recommendVersion(t,d,h,g);const E=new F;E.appendBitArray(h);const A=d===ke.BYTE?g.getSizeInBytes():e.length;this.appendLengthInfo(A,_,d,E),E.appendBitArray(g);const S=_.getECBlocksForLevel(t),B=_.getTotalCodewords()-S.getTotalECCodewords();this.terminateBits(B,E);const z=this.interleaveWithECBytes(E,_.getTotalCodewords(),B,S.getNumBlocks()),G=new dr;G.setECLevel(t),G.setMode(d),G.setVersion(_);const Y=_.getDimensionForVersion(),ie=new Li(Y,Y),ue=this.chooseMaskPattern(z,t,_,ie);return G.setMaskPattern(ue),Be.buildMatrix(z,t,_,ue,ie),G.setMatrix(ie),G}static recommendVersion(e,t,n,s){const c=this.calculateBitsNeeded(t,n,s,Ne.getVersionForNumber(1)),d=this.chooseVersion(c,e),h=this.calculateBitsNeeded(t,n,s,d);return this.chooseVersion(h,e)}static calculateBitsNeeded(e,t,n,s){return t.getSize()+e.getCharacterCountBits(s)+n.getSize()}static getAlphanumericCode(e){return e<xt.ALPHANUMERIC_TABLE.length?xt.ALPHANUMERIC_TABLE[e]:-1}static chooseMode(e,t=null){if(L.SJIS.getName()===t&&this.isOnlyDoubleByteKanji(e))return ke.KANJI;let n=!1,s=!1;for(let c=0,d=e.length;c<d;++c){const h=e.charAt(c);if(xt.isDigit(h))n=!0;else if(this.getAlphanumericCode(h.charCodeAt(0))!==-1)s=!0;else return ke.BYTE}return s?ke.ALPHANUMERIC:n?ke.NUMERIC:ke.BYTE}static isOnlyDoubleByteKanji(e){let t;try{t=Q.encode(e,L.SJIS)}catch{return!1}const n=t.length;if(n%2!==0)return!1;for(let s=0;s<n;s+=2){const c=t[s]&255;if((c<129||c>159)&&(c<224||c>235))return!1}return!0}static chooseMaskPattern(e,t,n,s){let c=Number.MAX_SAFE_INTEGER,d=-1;for(let h=0;h<dr.NUM_MASK_PATTERNS;h++){Be.buildMatrix(e,t,n,h,s);let g=this.calculateMaskPenalty(s);g<c&&(c=g,d=h)}return d}static chooseVersion(e,t){for(let n=1;n<=40;n++){const s=Ne.getVersionForNumber(n);if(xt.willFit(e,s,t))return s}throw new dt("Data too big")}static willFit(e,t,n){const s=t.getTotalCodewords(),d=t.getECBlocksForLevel(n).getTotalECCodewords(),h=s-d,g=(e+7)/8;return h>=g}static terminateBits(e,t){const n=e*8;if(t.getSize()>n)throw new dt("data bits cannot fit in the QR Code"+t.getSize()+" > "+n);for(let d=0;d<4&&t.getSize()<n;++d)t.appendBit(!1);const s=t.getSize()&7;if(s>0)for(let d=s;d<8;d++)t.appendBit(!1);const c=e-t.getSizeInBytes();for(let d=0;d<c;++d)t.appendBits(d&1?17:236,8);if(t.getSize()!==n)throw new dt("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(e,t,n,s,c,d){if(s>=n)throw new dt("Block ID too large");const h=e%n,g=n-h,_=Math.floor(e/n),E=_+1,A=Math.floor(t/n),S=A+1,B=_-A,z=E-S;if(B!==z)throw new dt("EC bytes mismatch");if(n!==g+h)throw new dt("RS blocks mismatch");if(e!==(A+B)*g+(S+z)*h)throw new dt("Total bytes mismatch");s<g?(c[0]=A,d[0]=B):(c[0]=S,d[0]=z)}static interleaveWithECBytes(e,t,n,s){if(e.getSizeInBytes()!==n)throw new dt("Number of bits and data bytes does not match");let c=0,d=0,h=0;const g=new Array;for(let E=0;E<s;++E){const A=new Int32Array(1),S=new Int32Array(1);xt.getNumDataBytesAndNumECBytesForBlockID(t,n,s,E,A,S);const B=A[0],z=new Uint8Array(B);e.toBytes(8*c,z,0,B);const G=xt.generateECBytes(z,S[0]);g.push(new Og(z,G)),d=Math.max(d,B),h=Math.max(h,G.length),c+=A[0]}if(n!==c)throw new dt("Data bytes does not match offset");const _=new F;for(let E=0;E<d;++E)for(const A of g){const S=A.getDataBytes();E<S.length&&_.appendBits(S[E],8)}for(let E=0;E<h;++E)for(const A of g){const S=A.getErrorCorrectionBytes();E<S.length&&_.appendBits(S[E],8)}if(t!==_.getSizeInBytes())throw new dt("Interleaving error: "+t+" and "+_.getSizeInBytes()+" differ.");return _}static generateECBytes(e,t){const n=e.length,s=new Int32Array(n+t);for(let d=0;d<n;d++)s[d]=e[d]&255;new Go(Me.QR_CODE_FIELD_256).encode(s,t);const c=new Uint8Array(t);for(let d=0;d<t;d++)c[d]=s[n+d];return c}static appendModeInfo(e,t){t.appendBits(e.getBits(),4)}static appendLengthInfo(e,t,n,s){const c=n.getCharacterCountBits(t);if(e>=1<<c)throw new dt(e+" is bigger than "+((1<<c)-1));s.appendBits(e,c)}static appendBytes(e,t,n,s){switch(t){case ke.NUMERIC:xt.appendNumericBytes(e,n);break;case ke.ALPHANUMERIC:xt.appendAlphanumericBytes(e,n);break;case ke.BYTE:xt.append8BitBytes(e,n,s);break;case ke.KANJI:xt.appendKanjiBytes(e,n);break;default:throw new dt("Invalid mode: "+t)}}static getDigit(e){return e.charCodeAt(0)-48}static isDigit(e){const t=xt.getDigit(e);return t>=0&&t<=9}static appendNumericBytes(e,t){const n=e.length;let s=0;for(;s<n;){const c=xt.getDigit(e.charAt(s));if(s+2<n){const d=xt.getDigit(e.charAt(s+1)),h=xt.getDigit(e.charAt(s+2));t.appendBits(c*100+d*10+h,10),s+=3}else if(s+1<n){const d=xt.getDigit(e.charAt(s+1));t.appendBits(c*10+d,7),s+=2}else t.appendBits(c,4),s++}}static appendAlphanumericBytes(e,t){const n=e.length;let s=0;for(;s<n;){const c=xt.getAlphanumericCode(e.charCodeAt(s));if(c===-1)throw new dt;if(s+1<n){const d=xt.getAlphanumericCode(e.charCodeAt(s+1));if(d===-1)throw new dt;t.appendBits(c*45+d,11),s+=2}else t.appendBits(c,6),s++}}static append8BitBytes(e,t,n){let s;try{s=Q.encode(e,n)}catch(c){throw new dt(c)}for(let c=0,d=s.length;c!==d;c++){const h=s[c];t.appendBits(h,8)}}static appendKanjiBytes(e,t){let n;try{n=Q.encode(e,L.SJIS)}catch(c){throw new dt(c)}const s=n.length;for(let c=0;c<s;c+=2){const d=n[c]&255,h=n[c+1]&255,g=d<<8&4294967295|h;let _=-1;if(g>=33088&&g<=40956?_=g-33088:g>=57408&&g<=60351&&(_=g-49472),_===-1)throw new dt("Invalid byte sequence");const E=(_>>8)*192+(_&255);t.appendBits(E,13)}}static appendECI(e,t){t.appendBits(ke.ECI.getBits(),4),t.appendBits(e.getValue(),8)}}xt.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]),xt.DEFAULT_BYTE_MODE_ENCODING=L.UTF8.getName();class ur{write(e,t,n,s=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 c=mt.L,d=ur.QUIET_ZONE_SIZE;s!==null&&(s.get(Pt.ERROR_CORRECTION)!==void 0&&(c=mt.fromString(s.get(Pt.ERROR_CORRECTION).toString())),s.get(Pt.MARGIN)!==void 0&&(d=Number.parseInt(s.get(Pt.MARGIN).toString(),10)));const h=xt.encode(e,c,s);return this.renderResult(h,t,n,d)}writeToDom(e,t,n,s,c=null){typeof e=="string"&&(e=document.querySelector(e));const d=this.write(t,n,s,c);e&&e.appendChild(d)}renderResult(e,t,n,s){const c=e.getMatrix();if(c===null)throw new Ue;const d=c.getWidth(),h=c.getHeight(),g=d+s*2,_=h+s*2,E=Math.max(t,g),A=Math.max(n,_),S=Math.min(Math.floor(E/g),Math.floor(A/_)),B=Math.floor((E-d*S)/2),z=Math.floor((A-h*S)/2),G=this.createSVGElement(E,A);for(let Y=0,ie=z;Y<h;Y++,ie+=S)for(let ue=0,fe=B;ue<d;ue++,fe+=S)if(c.get(ue,Y)===1){const le=this.createSvgRectElement(fe,ie,S,S);G.appendChild(le)}return G}createSVGElement(e,t){const n=document.createElementNS(ur.SVG_NS,"svg");return n.setAttributeNS(null,"height",e.toString()),n.setAttributeNS(null,"width",t.toString()),n}createSvgRectElement(e,t,n,s){const c=document.createElementNS(ur.SVG_NS,"rect");return c.setAttributeNS(null,"x",e.toString()),c.setAttributeNS(null,"y",t.toString()),c.setAttributeNS(null,"height",n.toString()),c.setAttributeNS(null,"width",s.toString()),c.setAttributeNS(null,"fill","#000000"),c}}ur.QUIET_ZONE_SIZE=4,ur.SVG_NS="http://www.w3.org/2000/svg";class Rr{encode(e,t,n,s,c){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||s<0)throw new y(`Requested dimensions are too small: ${n}x${s}`);let d=mt.L,h=Rr.QUIET_ZONE_SIZE;c!==null&&(c.get(Pt.ERROR_CORRECTION)!==void 0&&(d=mt.fromString(c.get(Pt.ERROR_CORRECTION).toString())),c.get(Pt.MARGIN)!==void 0&&(h=Number.parseInt(c.get(Pt.MARGIN).toString(),10)));const g=xt.encode(e,d,c);return Rr.renderResult(g,n,s,h)}static renderResult(e,t,n,s){const c=e.getMatrix();if(c===null)throw new Ue;const d=c.getWidth(),h=c.getHeight(),g=d+s*2,_=h+s*2,E=Math.max(t,g),A=Math.max(n,_),S=Math.min(Math.floor(E/g),Math.floor(A/_)),B=Math.floor((E-d*S)/2),z=Math.floor((A-h*S)/2),G=new X(E,A);for(let Y=0,ie=z;Y<h;Y++,ie+=S)for(let ue=0,fe=B;ue<d;ue++,fe+=S)c.get(ue,Y)===1&&G.setRegion(fe,ie,S,S);return G}}Rr.QUIET_ZONE_SIZE=4;class Mg{encode(e,t,n,s,c){let d;switch(t){case xe.QR_CODE:d=new Rr;break;default:throw new y("No encoder available for format "+t)}return d.encode(e,t,n,s,c)}}class Mn extends q{constructor(e,t,n,s,c,d,h,g){if(super(d,h),this.yuvData=e,this.dataWidth=t,this.dataHeight=n,this.left=s,this.top=c,s+d>t||c+h>n)throw new y("Crop rectangle does not fit within image data.");g&&this.reverseHorizontal(d,h)}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 s=(e+this.top)*this.dataWidth+this.left;return v.arraycopy(this.yuvData,s,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,s=new Uint8ClampedArray(n);let c=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return v.arraycopy(this.yuvData,c,s,0,n),s;for(let d=0;d<t;d++){const h=d*e;v.arraycopy(this.yuvData,c,s,h,e),c+=this.dataWidth}return s}isCropSupported(){return!0}crop(e,t,n,s){return new Mn(this.yuvData,this.dataWidth,this.dataHeight,this.left+e,this.top+t,n,s,!1)}renderThumbnail(){const e=this.getWidth()/Mn.THUMBNAIL_SCALE_FACTOR,t=this.getHeight()/Mn.THUMBNAIL_SCALE_FACTOR,n=new Int32Array(e*t),s=this.yuvData;let c=this.top*this.dataWidth+this.left;for(let d=0;d<t;d++){const h=d*e;for(let g=0;g<e;g++){const _=s[c+g*Mn.THUMBNAIL_SCALE_FACTOR]&255;n[h+g]=4278190080|_*65793}c+=this.dataWidth*Mn.THUMBNAIL_SCALE_FACTOR}return n}getThumbnailWidth(){return this.getWidth()/Mn.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/Mn.THUMBNAIL_SCALE_FACTOR}reverseHorizontal(e,t){const n=this.yuvData;for(let s=0,c=this.top*this.dataWidth+this.left;s<t;s++,c+=this.dataWidth){const d=c+e/2;for(let h=c,g=c+e-1;h<d;h++,g--){const _=n[h];n[h]=n[g],n[g]=_}}}invert(){return new K(this)}}Mn.THUMBNAIL_SCALE_FACTOR=2;class Wo extends q{constructor(e,t,n,s,c,d,h){if(super(t,n),this.dataWidth=s,this.dataHeight=c,this.left=d,this.top=h,e.BYTES_PER_ELEMENT===4){const g=t*n,_=new Uint8ClampedArray(g);for(let E=0;E<g;E++){const A=e[E],S=A>>16&255,B=A>>7&510,z=A&255;_[E]=(S+B+z)/4&255}this.luminances=_}else this.luminances=e;if(s===void 0&&(this.dataWidth=t),c===void 0&&(this.dataHeight=n),d===void 0&&(this.left=0),h===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 s=(e+this.top)*this.dataWidth+this.left;return v.arraycopy(this.luminances,s,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,s=new Uint8ClampedArray(n);let c=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return v.arraycopy(this.luminances,c,s,0,n),s;for(let d=0;d<t;d++){const h=d*e;v.arraycopy(this.luminances,c,s,h,e),c+=this.dataWidth}return s}isCropSupported(){return!0}crop(e,t,n,s){return new Wo(this.luminances,n,s,this.dataWidth,this.dataHeight,this.left+e,this.top+t)}invert(){return new K(this)}}class tl extends L{static forName(e){return this.getCharacterSetECIByName(e)}}class Xo{}Xo.ISO_8859_1=L.ISO8859_1;class nl{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 rl{static singletonList(e){return[e]}static min(e,t){return e.sort(t)[0]}}class Dg{constructor(e){this.previous=e}getPrevious(){return this.previous}}class Br extends Dg{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 Br(this,e,t)}addBinaryShift(e,t){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new Br(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 $o extends Br{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 $o(this,e,t)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function vg(b,e,t){return new $o(b,e,t)}function ti(b,e,t){return new Br(b,e,t)}const Pg=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],Yn=0,Fi=1,xn=2,il=3,Dn=4,Lg=new Br(null,0,0),jo=[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 Fg(b){for(let e of b)M.fill(e,-1);return b[Yn][Dn]=0,b[Fi][Dn]=0,b[Fi][Yn]=28,b[il][Dn]=0,b[xn][Dn]=0,b[xn][Yn]=15,b}const ol=Fg(M.createInt32Array(6,6));class vn{constructor(e,t,n,s){this.token=e,this.mode=t,this.binaryShiftByteCount=n,this.bitCount=s}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(e,t){let n=this.bitCount,s=this.token;if(e!==this.mode){let d=jo[this.mode][e];s=ti(s,d&65535,d>>16),n+=d>>16}let c=e===xn?4:5;return s=ti(s,t,c),new vn(s,e,0,n+c)}shiftAndAppend(e,t){let n=this.token,s=this.mode===xn?4:5;return n=ti(n,ol[this.mode][e],s),n=ti(n,t,5),new vn(n,this.mode,0,this.bitCount+s+5)}addBinaryShiftChar(e){let t=this.token,n=this.mode,s=this.bitCount;if(this.mode===Dn||this.mode===xn){let h=jo[n][Yn];t=ti(t,h&65535,h>>16),s+=h>>16,n=Yn}let c=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,d=new vn(t,n,this.binaryShiftByteCount+1,s+c);return d.binaryShiftByteCount===2078&&(d=d.endBinaryShift(e+1)),d}endBinaryShift(e){if(this.binaryShiftByteCount===0)return this;let t=this.token;return t=vg(t,e-this.binaryShiftByteCount,this.binaryShiftByteCount),new vn(t,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(e){let t=this.bitCount+(jo[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 s=this.endBinaryShift(e.length).token;s!==null;s=s.getPrevious())t.unshift(s);let n=new F;for(const s of t)s.appendTo(n,e);return n}toString(){return ee.format("%s bits=%d bytes=%d",Pg[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(Lg,Yn,0,0);function Vg(b){const e=ee.getCharCode(" "),t=ee.getCharCode("."),n=ee.getCharCode(",");b[Yn][e]=1;const s=ee.getCharCode("Z"),c=ee.getCharCode("A");for(let S=c;S<=s;S++)b[Yn][S]=S-c+2;b[Fi][e]=1;const d=ee.getCharCode("z"),h=ee.getCharCode("a");for(let S=h;S<=d;S++)b[Fi][S]=S-h+2;b[xn][e]=1;const g=ee.getCharCode("9"),_=ee.getCharCode("0");for(let S=_;S<=g;S++)b[xn][S]=S-_+2;b[xn][n]=12,b[xn][t]=13;const E=["\0"," ","","","","","","","\x07","\b"," ",`
29
+ `,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""];for(let S=0;S<E.length;S++)b[il][ee.getCharCode(E[S])]=S;const A=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let S=0;S<A.length;S++)ee.getCharCode(A[S])>0&&(b[Dn][ee.getCharCode(A[S])]=S);return b}const qo=Vg(M.createInt32Array(5,256));class ni{constructor(e){this.text=e}encode(){const e=ee.getCharCode(" "),t=ee.getCharCode(`
30
+ `);let n=rl.singletonList(vn.INITIAL_STATE);for(let c=0;c<this.text.length;c++){let d,h=c+1<this.text.length?this.text[c+1]:0;switch(this.text[c]){case ee.getCharCode("\r"):d=h===t?2:0;break;case ee.getCharCode("."):d=h===e?3:0;break;case ee.getCharCode(","):d=h===e?4:0;break;case ee.getCharCode(":"):d=h===e?5:0;break;default:d=0}d>0?(n=ni.updateStateListForPair(n,c,d),c++):n=this.updateStateListForChar(n,c)}return rl.min(n,(c,d)=>c.getBitCount()-d.getBitCount()).toBitArray(this.text)}updateStateListForChar(e,t){const n=[];for(let s of e)this.updateStateForChar(s,t,n);return ni.simplifyStates(n)}updateStateForChar(e,t,n){let s=this.text[t]&255,c=qo[e.getMode()][s]>0,d=null;for(let h=0;h<=Dn;h++){let g=qo[h][s];if(g>0){if(d==null&&(d=e.endBinaryShift(t)),!c||h===e.getMode()||h===xn){const _=d.latchAndAppend(h,g);n.push(_)}if(!c&&ol[e.getMode()][h]>=0){const _=d.shiftAndAppend(h,g);n.push(_)}}}if(e.getBinaryShiftByteCount()>0||qo[e.getMode()][s]===0){let h=e.addBinaryShiftChar(t);n.push(h)}}static updateStateListForPair(e,t,n){const s=[];for(let c of e)this.updateStateForPair(c,t,n,s);return this.simplifyStates(s)}static updateStateForPair(e,t,n,s){let c=e.endBinaryShift(t);if(s.push(c.latchAndAppend(Dn,n)),e.getMode()!==Dn&&s.push(c.shiftAndAppend(Dn,n)),n===3||n===4){let d=c.latchAndAppend(xn,16-n).latchAndAppend(xn,1);s.push(d)}if(e.getBinaryShiftByteCount()>0){let d=e.addBinaryShiftChar(t).addBinaryShiftChar(t+1);s.push(d)}}static simplifyStates(e){let t=[];for(const n of e){let s=!0;for(const c of t){if(c.isBetterThanOrEqualTo(n)){s=!1;break}n.isBetterThanOrEqualTo(c)&&(t=t.filter(d=>d!==c))}s&&t.push(n)}return t}}class Ke{constructor(){}static encodeBytes(e){return Ke.encode(e,Ke.DEFAULT_EC_PERCENT,Ke.DEFAULT_AZTEC_LAYERS)}static encode(e,t,n){let s=new ni(e).encode(),c=R.truncDivision(s.getSize()*t,100)+11,d=s.getSize()+c,h,g,_,E,A;if(n!==Ke.DEFAULT_AZTEC_LAYERS){if(h=n<0,g=Math.abs(n),g>(h?Ke.MAX_NB_BITS_COMPACT:Ke.MAX_NB_BITS))throw new y(ee.format("Illegal value %s for layers",n));_=Ke.totalBitsInLayer(g,h),E=Ke.WORD_SIZE[g];let le=_-_%E;if(A=Ke.stuffBits(s,E),A.getSize()+c>le)throw new y("Data to large for user specified layer");if(h&&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>Ke.MAX_NB_BITS)throw new y("Data too large for an Aztec code");if(h=le<=3,g=h?le+1:le,_=Ke.totalBitsInLayer(g,h),d>_)continue;(A==null||E!==Ke.WORD_SIZE[g])&&(E=Ke.WORD_SIZE[g],A=Ke.stuffBits(s,E));let je=_-_%E;if(!(h&&A.getSize()>E*64)&&A.getSize()+c<=je)break}}let S=Ke.generateCheckWords(A,_,E),B=A.getSize()/E,z=Ke.generateModeMessage(h,g,B),G=(h?11:14)+g*4,Y=new Int32Array(G),ie;if(h){ie=G;for(let le=0;le<Y.length;le++)Y[le]=le}else{ie=G+1+2*R.truncDivision(R.truncDivision(G,2)-1,15);let le=R.truncDivision(G,2),je=R.truncDivision(ie,2);for(let Fe=0;Fe<le;Fe++){let rn=Fe+R.truncDivision(Fe,15);Y[le-Fe-1]=je-rn-1,Y[le+Fe]=je+rn+1}}let ue=new X(ie);for(let le=0,je=0;le<g;le++){let Fe=(g-le)*4+(h?9:12);for(let rn=0;rn<Fe;rn++){let Sn=rn*2;for(let on=0;on<2;on++)S.get(je+Sn+on)&&ue.set(Y[le*2+on],Y[le*2+rn]),S.get(je+Fe*2+Sn+on)&&ue.set(Y[le*2+rn],Y[G-1-le*2-on]),S.get(je+Fe*4+Sn+on)&&ue.set(Y[G-1-le*2-on],Y[G-1-le*2-rn]),S.get(je+Fe*6+Sn+on)&&ue.set(Y[G-1-le*2-rn],Y[le*2+on])}je+=Fe*8}if(Ke.drawModeMessage(ue,h,ie,z),h)Ke.drawBullsEye(ue,R.truncDivision(ie,2),5);else{Ke.drawBullsEye(ue,R.truncDivision(ie,2),7);for(let le=0,je=0;le<R.truncDivision(G,2)-1;le+=15,je+=16)for(let Fe=R.truncDivision(ie,2)&1;Fe<ie;Fe+=2)ue.set(R.truncDivision(ie,2)-je,Fe),ue.set(R.truncDivision(ie,2)+je,Fe),ue.set(Fe,R.truncDivision(ie,2)-je),ue.set(Fe,R.truncDivision(ie,2)+je)}let fe=new nl;return fe.setCompact(h),fe.setSize(ie),fe.setLayers(g),fe.setCodeWords(B),fe.setMatrix(ue),fe}static drawBullsEye(e,t,n){for(let s=0;s<n;s+=2)for(let c=t-s;c<=t+s;c++)e.set(c,t-s),e.set(c,t+s),e.set(t-s,c),e.set(t+s,c);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 s=new F;return e?(s.appendBits(t-1,2),s.appendBits(n-1,6),s=Ke.generateCheckWords(s,28,4)):(s.appendBits(t-1,5),s.appendBits(n-1,11),s=Ke.generateCheckWords(s,40,4)),s}static drawModeMessage(e,t,n,s){let c=R.truncDivision(n,2);if(t)for(let d=0;d<7;d++){let h=c-3+d;s.get(d)&&e.set(h,c-5),s.get(d+7)&&e.set(c+5,h),s.get(20-d)&&e.set(h,c+5),s.get(27-d)&&e.set(c-5,h)}else for(let d=0;d<10;d++){let h=c-5+d+R.truncDivision(d,5);s.get(d)&&e.set(h,c-7),s.get(d+10)&&e.set(c+7,h),s.get(29-d)&&e.set(h,c+7),s.get(39-d)&&e.set(c-7,h)}}static generateCheckWords(e,t,n){let s=e.getSize()/n,c=new Go(Ke.getGF(n)),d=R.truncDivision(t,n),h=Ke.bitsToWords(e,n,d);c.encode(h,d-s);let g=t%n,_=new F;_.appendBits(0,g);for(const E of Array.from(h))_.appendBits(E,n);return _}static bitsToWords(e,t,n){let s=new Int32Array(n),c,d;for(c=0,d=e.getSize()/t;c<d;c++){let h=0;for(let g=0;g<t;g++)h|=e.get(c*t+g)?1<<t-g-1:0;s[c]=h}return s}static getGF(e){switch(e){case 4:return Me.AZTEC_PARAM;case 6:return Me.AZTEC_DATA_6;case 8:return Me.AZTEC_DATA_8;case 10:return Me.AZTEC_DATA_10;case 12:return Me.AZTEC_DATA_12;default:throw new y("Unsupported word size "+e)}}static stuffBits(e,t){let n=new F,s=e.getSize(),c=(1<<t)-2;for(let d=0;d<s;d+=t){let h=0;for(let g=0;g<t;g++)(d+g>=s||e.get(d+g))&&(h|=1<<t-1-g);(h&c)===c?(n.appendBits(h&c,t),d--):h&c?n.appendBits(h,t):(n.appendBits(h|1,t),d--)}return n}static totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}Ke.DEFAULT_EC_PERCENT=33,Ke.DEFAULT_AZTEC_LAYERS=0,Ke.MAX_NB_BITS=32,Ke.MAX_NB_BITS_COMPACT=4,Ke.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 Vi{encode(e,t,n,s){return this.encodeWithHints(e,t,n,s,null)}encodeWithHints(e,t,n,s,c){let d=Xo.ISO_8859_1,h=Ke.DEFAULT_EC_PERCENT,g=Ke.DEFAULT_AZTEC_LAYERS;return c!=null&&(c.has(Pt.CHARACTER_SET)&&(d=tl.forName(c.get(Pt.CHARACTER_SET).toString())),c.has(Pt.ERROR_CORRECTION)&&(h=R.parseInt(c.get(Pt.ERROR_CORRECTION).toString())),c.has(Pt.AZTEC_LAYERS)&&(g=R.parseInt(c.get(Pt.AZTEC_LAYERS).toString()))),Vi.encodeLayers(e,t,n,s,d,h,g)}static encodeLayers(e,t,n,s,c,d,h){if(t!==xe.AZTEC)throw new y("Can only encode AZTEC, but got "+t);let g=Ke.encode(ee.getBytes(e,c),d,h);return Vi.renderResult(g,n,s)}static renderResult(e,t,n){let s=e.getMatrix();if(s==null)throw new Ue;let c=s.getWidth(),d=s.getHeight(),h=Math.max(t,c),g=Math.max(n,d),_=Math.min(h/c,g/d),E=(h-c*_)/2,A=(g-d*_)/2,S=new X(h,g);for(let B=0,z=A;B<d;B++,z+=_)for(let G=0,Y=E;G<c;G++,Y+=_)s.get(G,B)&&S.setRegion(Y,z,_,_);return S}}o.AbstractExpandedDecoder=Mo,o.ArgumentException=C,o.ArithmeticException=it,o.AztecCode=nl,o.AztecCodeReader=Sr,o.AztecCodeWriter=Vi,o.AztecDecoder=Qe,o.AztecDetector=Bi,o.AztecDetectorResult=qr,o.AztecEncoder=Ke,o.AztecHighLevelEncoder=ni,o.AztecPoint=Ut,o.BarcodeFormat=xe,o.Binarizer=T,o.BinaryBitmap=N,o.BitArray=F,o.BitMatrix=X,o.BitSource=Lo,o.BrowserAztecCodeReader=Oo,o.BrowserBarcodeReader=pg,o.BrowserCodeReader=Ce,o.BrowserDatamatrixCodeReader=wg,o.BrowserMultiFormatReader=kg,o.BrowserPDF417Reader=Rg,o.BrowserQRCodeReader=Bg,o.BrowserQRCodeSvgWriter=ur,o.CharacterSetECI=L,o.ChecksumException=O,o.Code128Reader=me,o.Code39Reader=bt,o.DataMatrixDecodedBitStreamParser=$n,o.DataMatrixReader=jn,o.DecodeHintType=Z,o.DecoderResult=et,o.DefaultGridSampler=Ri,o.DetectorResult=br,o.EAN13Reader=zt,o.EncodeHintType=Pt,o.Exception=x,o.FormatException=V,o.GenericGF=Me,o.GenericGFPoly=Ve,o.GlobalHistogramBinarizer=$,o.GridSampler=Ar,o.GridSamplerInstance=Rn,o.HTMLCanvasElementLuminanceSource=oe,o.HybridBinarizer=j,o.ITFReader=tt,o.IllegalArgumentException=y,o.IllegalStateException=Ue,o.InvertedLuminanceSource=K,o.LuminanceSource=q,o.MathUtils=ve,o.MultiFormatOneDReader=Tr,o.MultiFormatReader=el,o.MultiFormatWriter=Mg,o.NotFoundException=I,o.OneDReader=ht,o.PDF417DecodedBitStreamParser=ne,o.PDF417DecoderErrorCorrection=qa,o.PDF417Reader=Gt,o.PDF417ResultMetadata=Ya,o.PerspectiveTransform=dn,o.PlanarYUVLuminanceSource=Mn,o.QRCodeByteMatrix=Li,o.QRCodeDataMask=gn,o.QRCodeDecodedBitStreamParser=At,o.QRCodeDecoderErrorCorrectionLevel=mt,o.QRCodeDecoderFormatInformation=$t,o.QRCodeEncoder=xt,o.QRCodeEncoderQRCode=dr,o.QRCodeMaskUtil=kt,o.QRCodeMatrixUtil=Be,o.QRCodeMode=ke,o.QRCodeReader=qn,o.QRCodeVersion=Ne,o.QRCodeWriter=Rr,o.RGBLuminanceSource=Wo,o.RSS14Reader=Tt,o.RSSExpandedReader=ae,o.ReaderException=Pi,o.ReedSolomonDecoder=It,o.ReedSolomonEncoder=Go,o.ReedSolomonException=Ie,o.Result=ge,o.ResultMetadataType=be,o.ResultPoint=ye,o.StringUtils=ee,o.UnsupportedOperationException=re,o.VideoInputDevice=de,o.WhiteRectangleDetector=Dt,o.WriterException=dt,o.ZXingArrays=M,o.ZXingCharset=tl,o.ZXingInteger=R,o.ZXingStandardCharsets=Xo,o.ZXingStringBuilder=W,o.ZXingStringEncoding=Q,o.ZXingSystem=v,o.createAbstractExpandedDecoder=$a,Object.defineProperty(o,"__esModule",{value:!0})})})(So,So.exports);var gt=So.exports;const Y2=cl({__proto__:null,default:ta(gt)},[gt]);var ba=function(){function a(l,o,i){if(this.formatMap=new Map([[_e.QR_CODE,gt.BarcodeFormat.QR_CODE],[_e.AZTEC,gt.BarcodeFormat.AZTEC],[_e.CODABAR,gt.BarcodeFormat.CODABAR],[_e.CODE_39,gt.BarcodeFormat.CODE_39],[_e.CODE_93,gt.BarcodeFormat.CODE_93],[_e.CODE_128,gt.BarcodeFormat.CODE_128],[_e.DATA_MATRIX,gt.BarcodeFormat.DATA_MATRIX],[_e.MAXICODE,gt.BarcodeFormat.MAXICODE],[_e.ITF,gt.BarcodeFormat.ITF],[_e.EAN_13,gt.BarcodeFormat.EAN_13],[_e.EAN_8,gt.BarcodeFormat.EAN_8],[_e.PDF_417,gt.BarcodeFormat.PDF_417],[_e.RSS_14,gt.BarcodeFormat.RSS_14],[_e.RSS_EXPANDED,gt.BarcodeFormat.RSS_EXPANDED],[_e.UPC_A,gt.BarcodeFormat.UPC_A],[_e.UPC_E,gt.BarcodeFormat.UPC_E],[_e.UPC_EAN_EXTENSION,gt.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!Y2)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=o,this.logger=i;var u=this.createZXingFormats(l),f=new Map;f.set(gt.DecodeHintType.POSSIBLE_FORMATS,u),f.set(gt.DecodeHintType.TRY_HARDER,!1),this.hints=f}return a.prototype.decodeAsync=function(l){var o=this;return new Promise(function(i,u){try{i(o.decode(l))}catch(f){u(f)}})},a.prototype.decode=function(l){var o=new gt.MultiFormatReader(this.verbose,this.hints),i=new gt.HTMLCanvasElementLuminanceSource(l),u=new gt.BinaryBitmap(new gt.HybridBinarizer(i)),f=o.decode(u);return{text:f.text,format:Ca.create(this.toHtml5QrcodeSupportedFormats(f.format)),debugData:this.createDebugData()}},a.prototype.createReverseFormatMap=function(){var l=new Map;return this.formatMap.forEach(function(o,i,u){l.set(o,i)}),l},a.prototype.toHtml5QrcodeSupportedFormats=function(l){if(!this.reverseFormatMap.has(l))throw"reverseFormatMap doesn't have ".concat(l);return this.reverseFormatMap.get(l)},a.prototype.createZXingFormats=function(l){for(var o=[],i=0,u=l;i<u.length;i++){var f=u[i];this.formatMap.has(f)?o.push(this.formatMap.get(f)):this.logger.logError("".concat(f," is not supported by")+"ZXingHtml5QrcodeShim")}return o},a.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},a}(),K2=function(a,l,o,i){function u(f){return f instanceof o?f:new o(function(m){m(f)})}return new(o||(o=Promise))(function(f,m){function p(C){try{x(i.next(C))}catch(y){m(y)}}function w(C){try{x(i.throw(C))}catch(y){m(y)}}function x(C){C.done?f(C.value):u(C.value).then(p,w)}x((i=i.apply(a,l||[])).next())})},Q2=function(a,l){var o={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},i,u,f,m;return m={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function p(x){return function(C){return w([x,C])}}function w(x){if(i)throw new TypeError("Generator is already executing.");for(;m&&(m=0,x[0]&&(o=0)),o;)try{if(i=1,u&&(f=x[0]&2?u.return:x[0]?u.throw||((f=u.return)&&f.call(u),0):u.next)&&!(f=f.call(u,x[1])).done)return f;switch(u=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return o.label++,{value:x[1],done:!1};case 5:o.label++,u=x[1],x=[0];continue;case 7:x=o.ops.pop(),o.trys.pop();continue;default:if(f=o.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){o=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){o.label=x[1];break}if(x[0]===6&&o.label<f[1]){o.label=f[1],f=x;break}if(f&&o.label<f[2]){o.label=f[2],o.ops.push(x);break}f[2]&&o.ops.pop(),o.trys.pop();continue}x=l.call(a,o)}catch(C){x=[6,C],u=0}finally{i=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},Aa=function(){function a(l,o,i){if(this.formatMap=new Map([[_e.QR_CODE,"qr_code"],[_e.AZTEC,"aztec"],[_e.CODABAR,"codabar"],[_e.CODE_39,"code_39"],[_e.CODE_93,"code_93"],[_e.CODE_128,"code_128"],[_e.DATA_MATRIX,"data_matrix"],[_e.ITF,"itf"],[_e.EAN_13,"ean_13"],[_e.EAN_8,"ean_8"],[_e.PDF_417,"pdf417"],[_e.UPC_A,"upc_a"],[_e.UPC_E,"upc_e"]]),this.reverseFormatMap=this.createReverseFormatMap(),!a.isSupported())throw"Use html5qrcode.min.js without edit, Use BarcodeDetectorDelegate only if it isSupported();";this.verbose=o,this.logger=i;var u=this.createBarcodeDetectorFormats(l);if(this.detector=new BarcodeDetector(u),!this.detector)throw"BarcodeDetector detector not supported"}return a.isSupported=function(){if(!("BarcodeDetector"in window))return!1;var l=new BarcodeDetector({formats:["qr_code"]});return typeof l<"u"},a.prototype.decodeAsync=function(l){return K2(this,void 0,void 0,function(){var o,i;return Q2(this,function(u){switch(u.label){case 0:return[4,this.detector.detect(l)];case 1:if(o=u.sent(),!o||o.length===0)throw"No barcode or QR code detected.";return i=this.selectLargestBarcode(o),[2,{text:i.rawValue,format:Ca.create(this.toHtml5QrcodeSupportedFormats(i.format)),debugData:this.createDebugData()}]}})})},a.prototype.selectLargestBarcode=function(l){for(var o=null,i=0,u=0,f=l;u<f.length;u++){var m=f[u],p=m.boundingBox.width*m.boundingBox.height;p>i&&(i=p,o=m)}if(!o)throw"No largest barcode found";return o},a.prototype.createBarcodeDetectorFormats=function(l){for(var o=[],i=0,u=l;i<u.length;i++){var f=u[i];this.formatMap.has(f)?o.push(this.formatMap.get(f)):this.logger.warn("".concat(f," is not supported by")+"BarcodeDetectorDelegate")}return{formats:o}},a.prototype.toHtml5QrcodeSupportedFormats=function(l){if(!this.reverseFormatMap.has(l))throw"reverseFormatMap doesn't have ".concat(l);return this.reverseFormatMap.get(l)},a.prototype.createReverseFormatMap=function(){var l=new Map;return this.formatMap.forEach(function(o,i,u){l.set(o,i)}),l},a.prototype.createDebugData=function(){return{decoderName:"BarcodeDetector"}},a}(),Sa=function(a,l,o,i){function u(f){return f instanceof o?f:new o(function(m){m(f)})}return new(o||(o=Promise))(function(f,m){function p(C){try{x(i.next(C))}catch(y){m(y)}}function w(C){try{x(i.throw(C))}catch(y){m(y)}}function x(C){C.done?f(C.value):u(C.value).then(p,w)}x((i=i.apply(a,l||[])).next())})},Ia=function(a,l){var o={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},i,u,f,m;return m={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function p(x){return function(C){return w([x,C])}}function w(x){if(i)throw new TypeError("Generator is already executing.");for(;m&&(m=0,x[0]&&(o=0)),o;)try{if(i=1,u&&(f=x[0]&2?u.return:x[0]?u.throw||((f=u.return)&&f.call(u),0):u.next)&&!(f=f.call(u,x[1])).done)return f;switch(u=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return o.label++,{value:x[1],done:!1};case 5:o.label++,u=x[1],x=[0];continue;case 7:x=o.ops.pop(),o.trys.pop();continue;default:if(f=o.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){o=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){o.label=x[1];break}if(x[0]===6&&o.label<f[1]){o.label=f[1],f=x;break}if(f&&o.label<f[2]){o.label=f[2],o.ops.push(x);break}f[2]&&o.ops.pop(),o.trys.pop();continue}x=l.call(a,o)}catch(C){x=[6,C],u=0}finally{i=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},J2=function(){function a(l,o,i,u){this.EXECUTIONS_TO_REPORT_PERFORMANCE=100,this.executions=0,this.executionResults=[],this.wasPrimaryDecoderUsedInLastDecode=!1,this.verbose=i,o&&Aa.isSupported()?(this.primaryDecoder=new Aa(l,i,u),this.secondaryDecoder=new ba(l,i,u)):this.primaryDecoder=new ba(l,i,u)}return a.prototype.decodeAsync=function(l){return Sa(this,void 0,void 0,function(){var o;return Ia(this,function(i){switch(i.label){case 0:o=performance.now(),i.label=1;case 1:return i.trys.push([1,,3,4]),[4,this.getDecoder().decodeAsync(l)];case 2:return[2,i.sent()];case 3:return this.possiblyLogPerformance(o),[7];case 4:return[2]}})})},a.prototype.decodeRobustlyAsync=function(l){return Sa(this,void 0,void 0,function(){var o,i;return Ia(this,function(u){switch(u.label){case 0:o=performance.now(),u.label=1;case 1:return u.trys.push([1,3,4,5]),[4,this.primaryDecoder.decodeAsync(l)];case 2:return[2,u.sent()];case 3:if(i=u.sent(),this.secondaryDecoder)return[2,this.secondaryDecoder.decodeAsync(l)];throw i;case 4:return this.possiblyLogPerformance(o),[7];case 5:return[2]}})})},a.prototype.getDecoder=function(){return this.secondaryDecoder?this.wasPrimaryDecoderUsedInLastDecode===!1?(this.wasPrimaryDecoderUsedInLastDecode=!0,this.primaryDecoder):(this.wasPrimaryDecoderUsedInLastDecode=!1,this.secondaryDecoder):this.primaryDecoder},a.prototype.possiblyLogPerformance=function(l){if(this.verbose){var o=performance.now()-l;this.executionResults.push(o),this.executions++,this.possiblyFlushPerformanceReport()}},a.prototype.possiblyFlushPerformanceReport=function(){if(!(this.executions<this.EXECUTIONS_TO_REPORT_PERFORMANCE)){for(var l=0,o=0,i=this.executionResults;o<i.length;o++){var u=i[o];l+=u}var f=l/this.executionResults.length;console.log("".concat(f," ms for ").concat(this.executionResults.length," last runs.")),this.executions=0,this.executionResults=[]}},a}(),Io=function(){var a=function(l,o){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,u){i.__proto__=u}||function(i,u){for(var f in u)Object.prototype.hasOwnProperty.call(u,f)&&(i[f]=u[f])},a(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");a(l,o);function i(){this.constructor=l}l.prototype=o===null?Object.create(o):(i.prototype=o.prototype,new i)}}(),Si=function(a,l,o,i){function u(f){return f instanceof o?f:new o(function(m){m(f)})}return new(o||(o=Promise))(function(f,m){function p(C){try{x(i.next(C))}catch(y){m(y)}}function w(C){try{x(i.throw(C))}catch(y){m(y)}}function x(C){C.done?f(C.value):u(C.value).then(p,w)}x((i=i.apply(a,l||[])).next())})},Ii=function(a,l){var o={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},i,u,f,m;return m={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function p(x){return function(C){return w([x,C])}}function w(x){if(i)throw new TypeError("Generator is already executing.");for(;m&&(m=0,x[0]&&(o=0)),o;)try{if(i=1,u&&(f=x[0]&2?u.return:x[0]?u.throw||((f=u.return)&&f.call(u),0):u.next)&&!(f=f.call(u,x[1])).done)return f;switch(u=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return o.label++,{value:x[1],done:!1};case 5:o.label++,u=x[1],x=[0];continue;case 7:x=o.ops.pop(),o.trys.pop();continue;default:if(f=o.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){o=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){o.label=x[1];break}if(x[0]===6&&o.label<f[1]){o.label=f[1],f=x;break}if(f&&o.label<f[2]){o.label=f[2],o.ops.push(x);break}f[2]&&o.ops.pop(),o.trys.pop();continue}x=l.call(a,o)}catch(C){x=[6,C],u=0}finally{i=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},Na=function(){function a(l,o){this.name=l,this.track=o}return a.prototype.isSupported=function(){return this.track.getCapabilities?this.name in this.track.getCapabilities():!1},a.prototype.apply=function(l){var o={};o[this.name]=l;var i={advanced:[o]};return this.track.applyConstraints(i)},a.prototype.value=function(){var l=this.track.getSettings();if(this.name in l){var o=l[this.name];return o}return null},a}(),em=function(a){Io(l,a);function l(o,i){return a.call(this,o,i)||this}return l.prototype.min=function(){return this.getCapabilities().min},l.prototype.max=function(){return this.getCapabilities().max},l.prototype.step=function(){return this.getCapabilities().step},l.prototype.apply=function(o){var i={};i[this.name]=o;var u={advanced:[i]};return this.track.applyConstraints(u)},l.prototype.getCapabilities=function(){this.failIfNotSupported();var o=this.track.getCapabilities(),i=o[this.name];return{min:i.min,max:i.max,step:i.step}},l.prototype.failIfNotSupported=function(){if(!this.isSupported())throw new Error("".concat(this.name," capability not supported"))},l}(Na),tm=function(a){Io(l,a);function l(o){return a.call(this,"zoom",o)||this}return l}(em),nm=function(a){Io(l,a);function l(o){return a.call(this,"torch",o)||this}return l}(Na),rm=function(){function a(l){this.track=l}return a.prototype.zoomFeature=function(){return new tm(this.track)},a.prototype.torchFeature=function(){return new nm(this.track)},a}(),im=function(){function a(l,o,i){this.isClosed=!1,this.parentElement=l,this.mediaStream=o,this.callbacks=i,this.surface=this.createVideoElement(this.parentElement.clientWidth),l.append(this.surface)}return a.prototype.createVideoElement=function(l){var o=document.createElement("video");return o.style.width="".concat(l,"px"),o.style.display="block",o.muted=!0,o.setAttribute("muted","true"),o.playsInline=!0,o},a.prototype.setupSurface=function(){var l=this;this.surface.onabort=function(){throw"RenderedCameraImpl video surface onabort() called"},this.surface.onerror=function(){throw"RenderedCameraImpl video surface onerror() called"};var o=function(){var i=l.surface.clientWidth,u=l.surface.clientHeight;l.callbacks.onRenderSurfaceReady(i,u),l.surface.removeEventListener("playing",o)};this.surface.addEventListener("playing",o),this.surface.srcObject=this.mediaStream,this.surface.play()},a.create=function(l,o,i,u){return Si(this,void 0,void 0,function(){var f,m;return Ii(this,function(p){switch(p.label){case 0:return f=new a(l,o,u),i.aspectRatio?(m={aspectRatio:i.aspectRatio},[4,f.getFirstTrackOrFail().applyConstraints(m)]):[3,2];case 1:p.sent(),p.label=2;case 2:return f.setupSurface(),[2,f]}})})},a.prototype.failIfClosed=function(){if(this.isClosed)throw"The RenderedCamera has already been closed."},a.prototype.getFirstTrackOrFail=function(){if(this.failIfClosed(),this.mediaStream.getVideoTracks().length===0)throw"No video tracks found";return this.mediaStream.getVideoTracks()[0]},a.prototype.pause=function(){this.failIfClosed(),this.surface.pause()},a.prototype.resume=function(l){this.failIfClosed();var o=this,i=function(){setTimeout(l,200),o.surface.removeEventListener("playing",i)};this.surface.addEventListener("playing",i),this.surface.play()},a.prototype.isPaused=function(){return this.failIfClosed(),this.surface.paused},a.prototype.getSurface=function(){return this.failIfClosed(),this.surface},a.prototype.getRunningTrackCapabilities=function(){return this.getFirstTrackOrFail().getCapabilities()},a.prototype.getRunningTrackSettings=function(){return this.getFirstTrackOrFail().getSettings()},a.prototype.applyVideoConstraints=function(l){return Si(this,void 0,void 0,function(){return Ii(this,function(o){if("aspectRatio"in l)throw"Changing 'aspectRatio' in run-time is not yet supported.";return[2,this.getFirstTrackOrFail().applyConstraints(l)]})})},a.prototype.close=function(){if(this.isClosed)return Promise.resolve();var l=this;return new Promise(function(o,i){var u=l.mediaStream.getVideoTracks(),f=u.length,m=0;l.mediaStream.getVideoTracks().forEach(function(p){l.mediaStream.removeTrack(p),p.stop(),++m,m>=f&&(l.isClosed=!0,l.parentElement.removeChild(l.surface),o())})})},a.prototype.getCapabilities=function(){return new rm(this.getFirstTrackOrFail())},a}(),om=function(){function a(l){this.mediaStream=l}return a.prototype.render=function(l,o,i){return Si(this,void 0,void 0,function(){return Ii(this,function(u){return[2,im.create(l,this.mediaStream,o,i)]})})},a.create=function(l){return Si(this,void 0,void 0,function(){var o,i;return Ii(this,function(u){switch(u.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return o={audio:!1,video:l},[4,navigator.mediaDevices.getUserMedia(o)];case 1:return i=u.sent(),[2,new a(i)]}})})},a}(),Ta=function(a,l,o,i){function u(f){return f instanceof o?f:new o(function(m){m(f)})}return new(o||(o=Promise))(function(f,m){function p(C){try{x(i.next(C))}catch(y){m(y)}}function w(C){try{x(i.throw(C))}catch(y){m(y)}}function x(C){C.done?f(C.value):u(C.value).then(p,w)}x((i=i.apply(a,l||[])).next())})},ka=function(a,l){var o={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},i,u,f,m;return m={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function p(x){return function(C){return w([x,C])}}function w(x){if(i)throw new TypeError("Generator is already executing.");for(;m&&(m=0,x[0]&&(o=0)),o;)try{if(i=1,u&&(f=x[0]&2?u.return:x[0]?u.throw||((f=u.return)&&f.call(u),0):u.next)&&!(f=f.call(u,x[1])).done)return f;switch(u=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return o.label++,{value:x[1],done:!1};case 5:o.label++,u=x[1],x=[0];continue;case 7:x=o.ops.pop(),o.trys.pop();continue;default:if(f=o.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){o=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){o.label=x[1];break}if(x[0]===6&&o.label<f[1]){o.label=f[1],f=x;break}if(f&&o.label<f[2]){o.label=f[2],o.ops.push(x);break}f[2]&&o.ops.pop(),o.trys.pop();continue}x=l.call(a,o)}catch(C){x=[6,C],u=0}finally{i=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},sm=function(){function a(){}return a.failIfNotSupported=function(){return Ta(this,void 0,void 0,function(){return ka(this,function(l){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new a]})})},a.prototype.create=function(l){return Ta(this,void 0,void 0,function(){return ka(this,function(o){return[2,om.create(l)]})})},a}(),am=function(a,l,o,i){function u(f){return f instanceof o?f:new o(function(m){m(f)})}return new(o||(o=Promise))(function(f,m){function p(C){try{x(i.next(C))}catch(y){m(y)}}function w(C){try{x(i.throw(C))}catch(y){m(y)}}function x(C){C.done?f(C.value):u(C.value).then(p,w)}x((i=i.apply(a,l||[])).next())})},lm=function(a,l){var o={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},i,u,f,m;return m={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function p(x){return function(C){return w([x,C])}}function w(x){if(i)throw new TypeError("Generator is already executing.");for(;m&&(m=0,x[0]&&(o=0)),o;)try{if(i=1,u&&(f=x[0]&2?u.return:x[0]?u.throw||((f=u.return)&&f.call(u),0):u.next)&&!(f=f.call(u,x[1])).done)return f;switch(u=0,f&&(x=[x[0]&2,f.value]),x[0]){case 0:case 1:f=x;break;case 4:return o.label++,{value:x[1],done:!1};case 5:o.label++,u=x[1],x=[0];continue;case 7:x=o.ops.pop(),o.trys.pop();continue;default:if(f=o.trys,!(f=f.length>0&&f[f.length-1])&&(x[0]===6||x[0]===2)){o=0;continue}if(x[0]===3&&(!f||x[1]>f[0]&&x[1]<f[3])){o.label=x[1];break}if(x[0]===6&&o.label<f[1]){o.label=f[1],f=x;break}if(f&&o.label<f[2]){o.label=f[2],o.ops.push(x);break}f[2]&&o.ops.pop(),o.trys.pop();continue}x=l.call(a,o)}catch(C){x=[6,C],u=0}finally{i=f=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}},cm=function(){function a(){}return a.retrieve=function(){if(navigator.mediaDevices)return a.getCamerasFromMediaDevices();var l=MediaStreamTrack;return MediaStreamTrack&&l.getSources?a.getCamerasFromMediaStreamTrack():a.rejectWithError()},a.rejectWithError=function(){var l=Er.unableToQuerySupportedDevices();return a.isHttpsOrLocalhost()||(l=Er.insecureContextCameraQueryError()),Promise.reject(l)},a.isHttpsOrLocalhost=function(){if(location.protocol==="https:")return!0;var l=location.host.split(":")[0];return l==="127.0.0.1"||l==="localhost"},a.getCamerasFromMediaDevices=function(){return am(this,void 0,void 0,function(){var l,o,i,u,f,m,p;return lm(this,function(w){switch(w.label){case 0:return l=function(x){for(var C=x.getVideoTracks(),y=0,N=C;y<N.length;y++){var O=N[y];O.enabled=!1,O.stop(),x.removeTrack(O)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return o=w.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(i=w.sent(),u=[],f=0,m=i;f<m.length;f++)p=m[f],p.kind==="videoinput"&&u.push({id:p.deviceId,label:p.label});return l(o),[2,u]}})})},a.getCamerasFromMediaStreamTrack=function(){return new Promise(function(l,o){var i=function(f){for(var m=[],p=0,w=f;p<w.length;p++){var x=w[p];x.kind==="video"&&m.push({id:x.id,label:x.label})}l(m)},u=MediaStreamTrack;u.getSources(i)})},a}(),St;(function(a){a[a.UNKNOWN=0]="UNKNOWN",a[a.NOT_STARTED=1]="NOT_STARTED",a[a.SCANNING=2]="SCANNING",a[a.PAUSED=3]="PAUSED"})(St||(St={}));var dm=function(){function a(){this.state=St.NOT_STARTED,this.onGoingTransactionNewState=St.UNKNOWN}return a.prototype.directTransition=function(l){this.failIfTransitionOngoing(),this.validateTransition(l),this.state=l},a.prototype.startTransition=function(l){return this.failIfTransitionOngoing(),this.validateTransition(l),this.onGoingTransactionNewState=l,this},a.prototype.execute=function(){if(this.onGoingTransactionNewState===St.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var l=this.onGoingTransactionNewState;this.onGoingTransactionNewState=St.UNKNOWN,this.directTransition(l)},a.prototype.cancel=function(){if(this.onGoingTransactionNewState===St.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=St.UNKNOWN},a.prototype.getState=function(){return this.state},a.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==St.UNKNOWN)throw"Cannot transition to a new state, already under transition"},a.prototype.validateTransition=function(l){switch(this.state){case St.UNKNOWN:throw"Transition from unknown is not allowed";case St.NOT_STARTED:this.failIfNewStateIs(l,[St.PAUSED]);break;case St.SCANNING:break;case St.PAUSED:break}},a.prototype.failIfNewStateIs=function(l,o){for(var i=0,u=o;i<u.length;i++){var f=u[i];if(l===f)throw"Cannot transition from ".concat(this.state," to ").concat(l)}},a}(),um=function(){function a(l){this.stateManager=l}return a.prototype.startTransition=function(l){return this.stateManager.startTransition(l)},a.prototype.directTransition=function(l){this.stateManager.directTransition(l)},a.prototype.getState=function(){return this.stateManager.getState()},a.prototype.canScanFile=function(){return this.stateManager.getState()===St.NOT_STARTED},a.prototype.isScanning=function(){return this.stateManager.getState()!==St.NOT_STARTED},a.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===St.SCANNING},a.prototype.isPaused=function(){return this.stateManager.getState()===St.PAUSED},a}(),fm=function(){function a(){}return a.create=function(){return new um(new dm)},a}(),hm=function(){var a=function(l,o){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,u){i.__proto__=u}||function(i,u){for(var f in u)Object.prototype.hasOwnProperty.call(u,f)&&(i[f]=u[f])},a(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");a(l,o);function i(){this.constructor=l}l.prototype=o===null?Object.create(o):(i.prototype=o.prototype,new i)}}(),cn=function(a){hm(l,a);function l(){return a!==null&&a.apply(this,arguments)||this}return l.DEFAULT_WIDTH=300,l.DEFAULT_WIDTH_OFFSET=2,l.FILE_SCAN_MIN_HEIGHT=300,l.FILE_SCAN_HIDDEN_CANVAS_PADDING=100,l.MIN_QR_BOX_SIZE=50,l.SHADED_LEFT=1,l.SHADED_RIGHT=2,l.SHADED_TOP=3,l.SHADED_BOTTOM=4,l.SHADED_REGION_ELEMENT_ID="qr-shaded-region",l.VERBOSE=!1,l.BORDER_SHADER_DEFAULT_COLOR="#ffffff",l.BORDER_SHADER_MATCH_COLOR="rgb(90, 193, 56)",l}(j2),mm=function(){function a(l,o){this.logger=o,this.fps=cn.SCAN_DEFAULT_FPS,l?(l.fps&&(this.fps=l.fps),this.disableFlip=l.disableFlip===!0,this.qrbox=l.qrbox,this.aspectRatio=l.aspectRatio,this.videoConstraints=l.videoConstraints):this.disableFlip=cn.DEFAULT_DISABLE_FLIP}return a.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?ya.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},a.prototype.isShadedBoxEnabled=function(){return!zn(this.qrbox)},a.create=function(l,o){return new a(l,o)},a}(),Ra=function(){function a(l,o){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(l))throw"HTML Element with id=".concat(l," not found");this.elementId=l,this.verbose=!1;var i;typeof o=="boolean"?this.verbose=o===!0:o&&(i=o,this.verbose=i.verbose===!0,i.experimentalFeatures),this.logger=new Z2(this.verbose),this.qrcode=new J2(this.getSupportedFormats(o),this.getUseBarCodeDetectorIfSupported(i),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=fm.create()}return a.prototype.start=function(l,o,i,u){var f=this;if(!l)throw"cameraIdOrConfig is required";if(!i||typeof i!="function")throw"qrCodeSuccessCallback is required and should be a function.";var m;u?m=u:m=this.verbose?this.logger.log:function(){};var p=mm.create(o,this.logger);this.clearElement();var w=!1;p.videoConstraints&&(p.isMediaStreamConstraintsValid()?w=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var x=w,C=document.getElementById(this.elementId);C.clientWidth?C.clientWidth:cn.DEFAULT_WIDTH,C.style.position="relative",this.shouldScan=!0,this.element=C;var y=this,N=this.stateManagerProxy.startTransition(St.SCANNING);return new Promise(function(O,T){var v=x?p.videoConstraints:y.createVideoConstraints(l);if(!v){N.cancel(),T("videoConstraints should be defined");return}var D={};(!x||p.aspectRatio)&&(D.aspectRatio=p.aspectRatio);var U={onRenderSurfaceReady:function(M,R){y.setupUi(M,R,p),y.isScanning=!0,y.foreverScan(p,i,m)}};sm.failIfNotSupported().then(function(M){M.create(v).then(function(R){return R.render(f.element,D,U).then(function(F){y.renderedCamera=F,N.execute(),O(null)}).catch(function(F){N.cancel(),T(F)})}).catch(function(R){N.cancel(),T(Er.errorGettingUserMedia(R))})}).catch(function(M){N.cancel(),T(Er.cameraStreamingNotSupported())})})},a.prototype.pause=function(l){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(St.PAUSED),this.showPausedState(),(zn(l)||l!==!0)&&(l=!1),l&&this.renderedCamera&&this.renderedCamera.pause()},a.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 l=this,o=function(){l.stateManagerProxy.directTransition(St.SCANNING),l.hidePausedState()};if(!this.renderedCamera.isPaused()){o();return}this.renderedCamera.resume(function(){o()})},a.prototype.getState=function(){return this.stateManagerProxy.getState()},a.prototype.stop=function(){var l=this;if(!this.stateManagerProxy.isScanning())throw"Cannot stop, scanner is not running or paused.";var o=this.stateManagerProxy.startTransition(St.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var i=function(){if(l.element){var f=document.getElementById(cn.SHADED_REGION_ELEMENT_ID);f&&l.element.removeChild(f)}},u=this;return this.renderedCamera.close().then(function(){return u.renderedCamera=null,u.element&&(u.element.removeChild(u.canvasElement),u.canvasElement=null),i(),u.qrRegion&&(u.qrRegion=null),u.context&&(u.context=null),o.execute(),u.hidePausedState(),u.isScanning=!1,Promise.resolve()})},a.prototype.scanFile=function(l,o){return this.scanFileV2(l,o).then(function(i){return i.decodedText})},a.prototype.scanFileV2=function(l,o){var i=this;if(!l||!(l instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(zn(o)&&(o=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(u,f){i.possiblyCloseLastScanImageFile(),i.clearElement(),i.lastScanImageFile=URL.createObjectURL(l);var m=new Image;m.onload=function(){var p=m.width,w=m.height,x=document.getElementById(i.elementId),C=x.clientWidth?x.clientWidth:cn.DEFAULT_WIDTH,y=Math.max(x.clientHeight?x.clientHeight:w,cn.FILE_SCAN_MIN_HEIGHT),N=i.computeCanvasDrawConfig(p,w,C,y);if(o){var O=i.createCanvasElement(C,y,"qr-canvas-visible");O.style.display="inline-block",x.appendChild(O);var T=O.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,p,w,N.x,N.y,N.width,N.height)}var v=cn.FILE_SCAN_HIDDEN_CANVAS_PADDING,D=Math.max(m.width,N.width),U=Math.max(m.height,N.height),M=D+2*v,R=U+2*v,F=i.createCanvasElement(M,R);x.appendChild(F);var H=F.getContext("2d");if(!H)throw"Unable to get 2d context from canvas";H.canvas.width=M,H.canvas.height=R,H.drawImage(m,0,0,p,w,v,v,D,U);try{i.qrcode.decodeRobustlyAsync(F).then(function(Z){u(Ea.createFromQrcodeResult(Z))}).catch(f)}catch(Z){f("QR code parse error, error = ".concat(Z))}},m.onerror=f,m.onabort=f,m.onstalled=f,m.onsuspend=f,m.src=URL.createObjectURL(l)})},a.prototype.clear=function(){this.clearElement()},a.getCameras=function(){return cm.retrieve()},a.prototype.getRunningTrackCapabilities=function(){return this.getRenderedCameraOrFail().getRunningTrackCapabilities()},a.prototype.getRunningTrackSettings=function(){return this.getRenderedCameraOrFail().getRunningTrackSettings()},a.prototype.getRunningTrackCameraCapabilities=function(){return this.getRenderedCameraOrFail().getCapabilities()},a.prototype.applyVideoConstraints=function(l){if(l){if(!ya.isMediaStreamConstraintsValid(l,this.logger))throw"invalid videoConstaints passed, check logs for more details"}else throw"videoConstaints is required argument.";return this.getRenderedCameraOrFail().applyVideoConstraints(l)},a.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},a.prototype.getSupportedFormats=function(l){var o=[_e.QR_CODE,_e.AZTEC,_e.CODABAR,_e.CODE_39,_e.CODE_93,_e.CODE_128,_e.DATA_MATRIX,_e.MAXICODE,_e.ITF,_e.EAN_13,_e.EAN_8,_e.PDF_417,_e.RSS_14,_e.RSS_EXPANDED,_e.UPC_A,_e.UPC_E,_e.UPC_EAN_EXTENSION];if(!l||typeof l=="boolean"||!l.formatsToSupport)return o;if(!Array.isArray(l.formatsToSupport))throw"configOrVerbosityFlag.formatsToSupport should be undefined or an array.";if(l.formatsToSupport.length===0)throw"Atleast 1 formatsToSupport is needed.";for(var i=[],u=0,f=l.formatsToSupport;u<f.length;u++){var m=f[u];$2(m)?i.push(m):this.logger.warn("Invalid format: ".concat(m," passed in config, ignoring."))}if(i.length===0)throw"None of formatsToSupport match supported values.";return i},a.prototype.getUseBarCodeDetectorIfSupported=function(l){if(zn(l))return!0;if(!zn(l.useBarCodeDetectorIfSupported))return l.useBarCodeDetectorIfSupported!==!1;if(zn(l.experimentalFeatures))return!0;var o=l.experimentalFeatures;return zn(o.useBarCodeDetectorIfSupported)?!0:o.useBarCodeDetectorIfSupported!==!1},a.prototype.validateQrboxSize=function(l,o,i){var u=this,f=i.qrbox;this.validateQrboxConfig(f);var m=this.toQrdimensions(l,o,f),p=function(x){if(x<cn.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(cn.MIN_QR_BOX_SIZE,"px.")},w=function(x){return x>l&&(u.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."),x=l),x};p(m.width),p(m.height),m.width=w(m.width)},a.prototype.validateQrboxConfig=function(l){if(typeof l!="number"&&typeof l!="function"&&(l.width===void 0||l.height===void 0))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},a.prototype.toQrdimensions=function(l,o,i){if(typeof i=="number")return{width:i,height:i};if(typeof i=="function")try{return i(l,o)}catch(u){throw new Error("qrbox config was passed as a function but it failed with unknown error"+u)}return i},a.prototype.setupUi=function(l,o,i){i.isShadedBoxEnabled()&&this.validateQrboxSize(l,o,i);var u=zn(i.qrbox)?{width:l,height:o}:i.qrbox;this.validateQrboxConfig(u);var f=this.toQrdimensions(l,o,u);f.height>o&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var m=i.isShadedBoxEnabled()&&f.height<=o,p={x:0,y:0,width:l,height:o},w=m?this.getShadedRegionBounds(l,o,f):p,x=this.createCanvasElement(w.width,w.height),C={willReadFrequently:!0},y=x.getContext("2d",C);y.canvas.width=w.width,y.canvas.height=w.height,this.element.append(x),m&&this.possiblyInsertShadingElement(this.element,l,o,f),this.createScannerPausedUiElement(this.element),this.qrRegion=w,this.context=y,this.canvasElement=x},a.prototype.createScannerPausedUiElement=function(l){var o=document.createElement("div");o.innerText=Er.scannerPaused(),o.style.display="none",o.style.position="absolute",o.style.top="0px",o.style.zIndex="1",o.style.background="rgba(9, 9, 9, 0.46)",o.style.color="#FFECEC",o.style.textAlign="center",o.style.width="100%",l.appendChild(o),this.scannerPausedUiElement=o},a.prototype.scanContext=function(l,o){var i=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(u){return l(u.text,Ea.createFromQrcodeResult(u)),i.possiblyUpdateShaders(!0),!0}).catch(function(u){i.possiblyUpdateShaders(!1);var f=Er.codeParseError(u);return o(f,q2.createFrom(f)),!1})},a.prototype.foreverScan=function(l,o,i){var u=this;if(this.shouldScan&&this.renderedCamera){var f=this.renderedCamera.getSurface(),m=f.videoWidth/f.clientWidth,p=f.videoHeight/f.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var w=this.qrRegion.width*m,x=this.qrRegion.height*p,C=this.qrRegion.x*m,y=this.qrRegion.y*p;this.context.drawImage(f,C,y,w,x,0,0,this.qrRegion.width,this.qrRegion.height);var N=function(){u.foreverScanTimeout=setTimeout(function(){u.foreverScan(l,o,i)},u.getTimeoutFps(l.fps))};this.scanContext(o,i).then(function(O){!O&&l.disableFlip!==!0?(u.context.translate(u.context.canvas.width,0),u.context.scale(-1,1),u.scanContext(o,i).finally(function(){N()})):N()}).catch(function(O){u.logger.logError("Error happend while scanning context",O),N()})}},a.prototype.createVideoConstraints=function(l){if(typeof l=="string")return{deviceId:{exact:l}};if(typeof l=="object"){var o="facingMode",i="deviceId",u={user:!0,environment:!0},f="exact",m=function(T){if(T in u)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(T,"'")},p=Object.keys(l);if(p.length!==1)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(p.length," keys");var w=Object.keys(l)[0];if(w!==o&&w!==i)throw"Only '".concat(o,"' and '").concat(i,"' ")+" are supported for 'cameraIdOrConfig'";if(w===o){var x=l.facingMode;if(typeof x=="string"){if(m(x))return{facingMode:x}}else if(typeof x=="object")if(f in x){if(m(x["".concat(f)]))return{facingMode:{exact:x["".concat(f)]}}}else throw"'facingMode' should be string or object with"+" ".concat(f," as key.");else{var C=typeof x;throw"Invalid type of 'facingMode' = ".concat(C)}}else{var y=l.deviceId;if(typeof y=="string")return{deviceId:y};if(typeof y=="object"){if(f in y)return{deviceId:{exact:y["".concat(f)]}};throw"'deviceId' should be string or object with"+" ".concat(f," as key.")}else{var N=typeof y;throw"Invalid type of 'deviceId' = ".concat(N)}}}var O=typeof l;throw"Invalid type of 'cameraIdOrConfig' = ".concat(O)},a.prototype.computeCanvasDrawConfig=function(l,o,i,u){if(l<=i&&o<=u){var f=(i-l)/2,m=(u-o)/2;return{x:f,y:m,width:l,height:o}}else{var p=l,w=o;return l>i&&(o=i/l*o,l=i),o>u&&(l=u/o*l,o=u),this.logger.log("Image downsampled from "+"".concat(p,"X").concat(w)+" to ".concat(l,"X").concat(o,".")),this.computeCanvasDrawConfig(l,o,i,u)}},a.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var l=document.getElementById(this.elementId);l&&(l.innerHTML="")},a.prototype.possiblyUpdateShaders=function(l){this.qrMatch!==l&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(o){o.style.backgroundColor=l?cn.BORDER_SHADER_MATCH_COLOR:cn.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=l)},a.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},a.prototype.createCanvasElement=function(l,o,i){var u=l,f=o,m=document.createElement("canvas");return m.style.width="".concat(u,"px"),m.style.height="".concat(f,"px"),m.style.display="none",m.id=zn(i)?"qr-canvas":i,m},a.prototype.getShadedRegionBounds=function(l,o,i){if(i.width>l||i.height>o)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(l-i.width)/2,y:(o-i.height)/2,width:i.width,height:i.height}},a.prototype.possiblyInsertShadingElement=function(l,o,i,u){if(!(o-u.width<1||i-u.height<1)){var f=document.createElement("div");f.style.position="absolute";var m=(o-u.width)/2,p=(i-u.height)/2;if(f.style.borderLeft="".concat(m,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderRight="".concat(m,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderTop="".concat(p,"px solid rgba(0, 0, 0, 0.48)"),f.style.borderBottom="".concat(p,"px solid rgba(0, 0, 0, 0.48)"),f.style.boxSizing="border-box",f.style.top="0px",f.style.bottom="0px",f.style.left="0px",f.style.right="0px",f.id="".concat(cn.SHADED_REGION_ELEMENT_ID),o-u.width<11||i-u.height<11)this.hasBorderShaders=!1;else{var w=5,x=40;this.insertShaderBorders(f,x,w,-w,null,0,!0),this.insertShaderBorders(f,x,w,-w,null,0,!1),this.insertShaderBorders(f,x,w,null,-w,0,!0),this.insertShaderBorders(f,x,w,null,-w,0,!1),this.insertShaderBorders(f,w,x+w,-w,null,-w,!0),this.insertShaderBorders(f,w,x+w,null,-w,-w,!0),this.insertShaderBorders(f,w,x+w,-w,null,-w,!1),this.insertShaderBorders(f,w,x+w,null,-w,-w,!1),this.hasBorderShaders=!0}l.append(f)}},a.prototype.insertShaderBorders=function(l,o,i,u,f,m,p){var w=document.createElement("div");w.style.position="absolute",w.style.backgroundColor=cn.BORDER_SHADER_DEFAULT_COLOR,w.style.width="".concat(o,"px"),w.style.height="".concat(i,"px"),u!==null&&(w.style.top="".concat(u,"px")),f!==null&&(w.style.bottom="".concat(f,"px")),p?w.style.left="".concat(m,"px"):w.style.right="".concat(m,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(w),l.appendChild(w)},a.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},a.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},a.prototype.getTimeoutFps=function(l){return 1e3/l},a}(),Ba;(function(a){a[a.STATUS_DEFAULT=0]="STATUS_DEFAULT",a[a.STATUS_SUCCESS=1]="STATUS_SUCCESS",a[a.STATUS_WARNING=2]="STATUS_WARNING",a[a.STATUS_REQUESTING_PERMISSION=3]="STATUS_REQUESTING_PERMISSION"})(Ba||(Ba={}));const gm={width:"38",height:"38",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"none"},pm=["stroke"],xm=["stroke"],wm=["stroke"],_m=["stroke"],Cm=["stroke"],Em=r.defineComponent({__name:"QR",props:{color:{type:String,required:!1,default:"#FFFFFF"}},setup(a){return(l,o)=>(r.openBlock(),r.createElementBlock("svg",gm,[r.createElementVNode("path",{d:"M11 11H7V7h4ZM17 7h-2v2h2ZM13 17h4v-4h-4ZM7 17h2v-2H7Z",stroke:a.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,pm),r.createElementVNode("path",{d:"M8 3H4a1 1 0 0 0-1 1V8",stroke:a.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,xm),r.createElementVNode("path",{d:"M21 8V4a1 1 0 0 0-1-1H16",stroke:a.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,wm),r.createElementVNode("path",{d:"M3 16v4a1 1 0 0 0 1 1H8",stroke:a.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,_m),r.createElementVNode("path",{d:"M16 21h4a1 1 0 0 0 1-1V16",stroke:a.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"},null,8,Cm)]))}}),No={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"]},ym={key:0,class:"qr_text"},bm=r.defineComponent({__name:"QrCameraScanner",props:{axiosInstanceGet:{type:[Function,Object]},is_toggleAffiliation:{type:Boolean},is_notification:{type:Boolean},notificationData:{},isQr:{type:[Boolean,null]},takeDataTable:{type:Function}},emits:["update:notificationData","update:is_notification","update:is_toggleAffiliation"],setup(a,{emit:l}){const o=a;let i=null;const u=r.ref(!1),f=r.ref(!1),m=r.ref(!1),p=r.ref(!1);let w=null;const x=Rt(),{itemThemes:C}=we.storeToRefs(x),y=l,N=U=>U.replace(/^[\s\S]*?((?:tel|sms|smsto|mailto|callto|facetime|viber|whatsapp):)?[\s\S]*?(%2B)?[\s\S]*?/i,(M,R,F)=>F?"+":""),O=async(U,M)=>{var Z,V,P;if(console.log(U,M),p.value)return;o.isQr||(p.value=!0),D();const R=/[?&]table_id=([a-zA-Z0-9-]+)/,F=U.match(R),H=U.match(/\/([a-f0-9\-]{36})\?/);if(o.isQr){if(F&&H)return(Z=o.takeDataTable)==null?void 0:Z.call(o,H[1],F[1],"qr");{const L=localStorage.getItem("orgID");if(L){const re=await o.axiosInstanceGet.get(`org_unit/${L}/table`,{params:{external_link:U}}).then(Q=>{var ee,W;return((ee=Q.data)==null?void 0:ee.length)>0?(W=Q.data[0])==null?void 0:W.id:null}).catch(()=>null);if(re)return(V=o.takeDataTable)==null?void 0:V.call(o,L,re)}}y("update:is_notification",!0),y("update:notificationData",{textNotification:"Стол не найден"}),y("update:is_toggleAffiliation",!0)}else{const L=new yn,re=U||M.text,Q=N(re);try{await L.authorizeByCard(Q);const ee=await L.getProfile();y("update:is_notification",!0),y("update:notificationData",{textNotification:`Здравствуйте, ${ee.first_name}
31
+ Баланс: ${ee.balance}`})}catch(ee){y("update:is_notification",!0),y("update:notificationData",{textNotification:((P=ee.response)==null?void 0:P.user_friendly_message)||"Карта не найдена"})}finally{m.value=!0,w&&clearTimeout(w),w=setTimeout(()=>{m.value=!1},2e3),p.value=!1}}};window.debugScan=O;const T=()=>{},v=async()=>{if(!(u.value||i!=null&&i.isScanning||m.value))try{u.value=!0;try{(await navigator.mediaDevices.getUserMedia({video:!0})).getTracks().forEach(Z=>Z.stop())}catch{y("update:is_notification",!0),y("update:notificationData",{textNotification:"Разрешите доступ к камере"}),u.value=!1,y("update:is_toggleAffiliation",!0);return}i=new Ra("reader");const U=await Ra.getCameras();if(!U||U.length===0){console.error("Камеры не найдены"),u.value=!1;return}let M;if(o.isQr)M=U.find(H=>No.back.some(Z=>new RegExp(Z,"i").test(H.label))),M||(M=U.find(H=>No.front.some(Z=>new RegExp(Z,"i").test(H.label))));else if(M=U.find(H=>No.front.some(Z=>new RegExp(Z,"i").test(H.label))),M||(M=U.find(H=>new RegExp("amera","i").test(H.label))),!M){y("update:is_notification",!0),y("update:notificationData",{textNotification:"Не найдена фронтальная камера. Для сканирования карт нужна фронтальная камера."}),u.value=!1,y("update:is_toggleAffiliation",!0);return}const R=o.isQr?[_e.QR_CODE]:[_e.QR_CODE,_e.PDF_417,_e.EAN_13,_e.EAN_8,_e.CODE_128],F={fps:60,qrbox:{width:320,height:500}};await i.start(M.id,F,O,T,void 0,R),f.value=!0}catch(U){y("update:is_notification",!0),y("update:notificationData",{textNotification:"Разрешите доступ к камере для сканирования"}),console.error("Ошибка доступа к камере:",U),u.value=!1,f.value=!1,y("update:is_toggleAffiliation",!0)}},D=async()=>{if(i&&i.isScanning)try{await i.stop(),u.value=!1,i=null}catch(U){console.error("Ошибка остановки камеры:",U)}else u.value=!1,i=null,y("update:is_toggleAffiliation",!0);f.value=!1};return r.onUnmounted(()=>{u.value&&D(),w&&(clearTimeout(w),w=null),p.value=!1,m.value=!1,f.value=!1}),(U,M)=>(r.openBlock(),r.createElementBlock("div",null,[(r.openBlock(),r.createBlock(r.Teleport,{to:"body"},[r.withDirectives(r.createElementVNode("div",{class:"blackWindow",onClick:D},[M[0]||(M[0]=r.createElementVNode("div",{id:"reader"},null,-1)),f.value&&!a.isQr?(r.openBlock(),r.createElementBlock("p",ym,"Наведите QR на камеру")):r.createCommentVNode("",!0)],512),[[r.vShow,u.value]])])),r.createVNode(Em,{color:a.isQr?void 0:"#FFFFFF",onClick:v},null,8,["color"])]))}}),Ni=Symbol("clickOutside"),Am={mounted(a,l){a[Ni]=o=>{a.contains(o.target)||l.value(o)},document.addEventListener("click",a[Ni])},unmounted(a){a[Ni]&&document.removeEventListener("click",a[Ni])}};let ir=[],To;const Oa=["#FFD700","#FF6B8A","#7ECFC0","#C4B5FD","#FFA726","#EF5350","#AB47BC","#66BB6A","#42A5F5","#FFCA28"];class Ma{constructor(l){Re(this,"x");Re(this,"y");Re(this,"vx");Re(this,"vy");Re(this,"color");Re(this,"size");Re(this,"rotation");Re(this,"rotationSpeed");Re(this,"gravity");Re(this,"friction");Re(this,"opacity");Re(this,"fadeSpeed");Re(this,"shape");Re(this,"width");Re(this,"height");Re(this,"ctx");this.x=window.innerWidth/2,this.y=window.innerHeight/2;const o=Math.random()*Math.PI*2,i=4+Math.random()*8;this.vx=Math.cos(o)*i,this.vy=Math.sin(o)*i-4,this.color=Oa[Math.floor(Math.random()*Oa.length)],this.size=4+Math.random()*6,this.rotation=Math.random()*360,this.rotationSpeed=(Math.random()-.5)*12,this.gravity=.12+Math.random()*.05,this.friction=.98,this.opacity=1,this.fadeSpeed=.005+Math.random()*.008,this.shape=Math.random()>.5?"rect":"circle",this.width=this.shape==="rect"?this.size*(.4+Math.random()*.6):this.size,this.height=this.shape==="rect"?this.size*(.8+Math.random()*.4):this.size,this.ctx=l}update(){this.vy+=this.gravity,this.vx*=this.friction,this.vy*=this.friction,this.x+=this.vx,this.y+=this.vy,this.rotation+=this.rotationSpeed,this.opacity-=this.fadeSpeed}draw(){this.ctx&&(this.ctx.save(),this.ctx.translate(this.x,this.y),this.ctx.rotate(this.rotation*Math.PI/180),this.ctx.globalAlpha=Math.max(0,this.opacity),this.ctx.fillStyle=this.color,this.shape==="rect"?this.ctx.fillRect(-this.width/2,-this.height/2,this.width,this.height):(this.ctx.beginPath(),this.ctx.arc(0,0,this.size/2,0,Math.PI*2),this.ctx.fill()),this.ctx.restore())}}const Sm={mounted(a){const l=a.getContext("2d"),o=()=>{l.clearRect(0,0,window.innerWidth,window.innerHeight);for(let i of ir)i.update(),i.draw();ir=ir.filter(i=>i.opacity>0),ir.length>0&&(To=requestAnimationFrame(o))};a._resize=()=>{const i=window.devicePixelRatio||1;a.width=window.innerWidth*i,a.height=window.innerHeight*i,l.scale(i,i)},a._resize(),window.addEventListener("resize",a._resize),setTimeout(()=>{for(let i=0;i<90;i++)ir.push(new Ma(l));o()},400),setTimeout(()=>{for(let i=0;i<40;i++)ir.push(new Ma(l))},900)},unmounted(a){window.removeEventListener("resize",a._resize),To&&cancelAnimationFrame(To),ir=[]}},Im={mounted(a){const l=a.getContext("2d");a._resize=()=>{a.width=window.innerWidth,a.height=window.innerHeight},a._resize(),window.addEventListener("resize",a._resize);const o=4,i=null,u="#E52222",f="#fed1b0",m="#1a1aff",p="#222",w="#E8B84B",x=[[i,i,i,u,u,u,u,u,i,i,i,i,i,i,i,i],[i,i,u,u,u,u,u,u,u,u,u,i,i,i,i,i],[i,i,p,p,p,f,f,p,f,i,i,i,i,i,i,i],[i,p,f,p,f,f,f,p,f,f,f,i,i,i,i,i],[i,p,f,p,p,f,f,f,p,f,f,f,i,i,i,i],[i,p,p,f,f,f,f,p,p,p,p,i,i,i,i,i],[i,i,i,f,f,f,f,f,f,f,i,i,i,i,i,i],[i,i,m,m,u,m,m,m,i,i,i,i,i,i,i,i],[i,m,m,m,u,m,m,m,m,m,i,i,i,i,i,i],[m,m,m,m,u,u,m,m,m,m,m,i,i,i,i,i],[f,f,m,u,w,u,u,w,m,f,f,i,i,i,i,i],[f,f,f,u,u,u,u,u,f,f,f,i,i,i,i,i],[f,f,u,u,u,u,u,u,u,f,f,i,i,i,i,i],[i,i,u,u,u,i,i,u,u,u,i,i,i,i,i,i],[i,p,p,p,i,i,i,p,p,p,i,i,i,i,i,i],[p,p,p,p,i,i,p,p,p,p,i,i,i,i,i,i]],C=[[i,i,i,u,u,u,u,u,i,i,i,i,i,i,i,i],[i,i,u,u,u,u,u,u,u,u,u,i,i,i,i,i],[i,i,p,p,p,f,f,p,f,i,i,i,i,i,i,i],[i,p,f,p,f,f,f,p,f,f,f,i,i,i,i,i],[i,p,f,p,p,f,f,f,p,f,f,f,i,i,i,i],[i,p,p,f,f,f,f,p,p,p,p,i,i,i,i,i],[i,i,i,f,f,f,f,f,f,f,i,i,i,i,i,i],[i,i,m,m,u,m,m,m,i,i,i,i,i,i,i,i],[i,m,m,m,u,m,m,m,m,m,i,i,i,i,i,i],[m,m,m,m,u,u,m,m,m,m,m,i,i,i,i,i],[f,f,m,u,w,u,u,w,m,f,f,i,i,i,i,i],[f,f,f,u,u,u,u,u,f,f,f,i,i,i,i,i],[f,f,u,u,u,u,u,u,u,f,f,i,i,i,i,i],[i,u,u,u,i,i,i,i,u,u,u,i,i,i,i,i],[p,p,p,i,i,i,i,i,p,p,p,i,i,i,i,i],[p,p,i,i,i,i,i,i,i,p,p,i,i,i,i,i]],y=[[i,i,i,u,u,u,u,u,i,i,i,i,i,i,i,i],[i,i,u,u,u,u,u,u,u,u,u,i,i,i,i,i],[i,i,p,p,p,f,f,p,f,i,i,i,i,i,i,i],[i,p,f,p,f,f,f,p,f,f,f,i,i,i,i,i],[i,p,f,p,p,f,f,f,p,f,f,f,i,i,i,i],[i,p,p,f,f,f,f,p,p,p,p,i,i,i,i,i],[i,i,i,f,f,f,f,f,f,f,i,i,i,i,i,i],[i,i,m,m,u,m,m,m,i,i,i,i,i,i,i,i],[i,m,m,m,u,m,m,m,m,m,i,i,i,i,i,i],[m,m,m,m,u,u,m,m,m,m,m,i,i,i,i,i],[f,f,m,u,w,u,u,w,m,f,f,i,i,i,i,i],[f,f,f,u,u,u,u,u,f,f,f,i,i,i,i,i],[f,f,u,u,u,u,u,u,u,f,f,i,i,i,i,i],[i,i,i,i,u,u,u,u,i,i,i,i,i,i,i,i],[i,i,i,i,p,p,p,p,p,i,i,i,i,i,i,i],[i,i,i,i,i,p,p,p,p,p,i,i,i,i,i,i]],N=[[i,i,i,i,u,u,u,u,u,i,i,i,i,i,i,i],[i,i,i,u,u,u,u,u,u,u,u,u,i,i,i,i],[i,i,i,p,p,p,f,f,p,f,i,i,i,i,i,i],[i,i,p,f,p,f,f,f,p,f,f,f,i,i,i,i],[i,i,p,f,p,p,f,f,f,p,f,f,i,i,i,i],[i,i,p,p,f,f,f,f,p,p,p,p,i,i,i,i],[i,i,i,i,f,f,f,f,f,f,f,i,i,i,i,i],[i,m,i,i,m,m,u,m,m,m,i,i,m,i,i,i],[m,m,m,m,m,u,m,m,m,m,m,m,m,i,i,i],[m,m,m,m,u,u,m,m,m,m,m,i,i,i,i,i],[f,f,m,u,w,u,u,w,m,f,f,i,i,i,i,i],[f,f,f,u,u,u,u,u,f,f,f,i,i,i,i,i],[f,f,u,u,u,u,u,u,u,f,f,i,i,i,i,i],[i,i,u,u,u,i,i,u,u,u,i,i,i,i,i,i],[i,p,p,p,i,i,i,p,p,p,i,i,i,i,i,i],[p,p,p,p,i,i,p,p,p,p,i,i,i,i,i,i]],O=[[i,w,w,w,w,w,i,i],[w,w,p,w,w,w,w,i],[w,p,w,w,w,w,w,i],[w,p,w,w,w,w,w,i],[w,p,w,w,w,w,w,i],[w,w,p,w,w,w,w,i],[i,w,w,w,w,w,i,i],[i,i,i,i,i,i,i,i]];function T(X,I,$,j,q,K){const oe=I.length,de=I[0].length;for(let ce=0;ce<oe;ce++)for(let Ce=0;Ce<de;Ce++){const ge=I[ce][Ce];if(!ge)continue;const De=K?$+(de-1-Ce)*q:$+Ce*q,xe=j+ce*q;X.fillStyle=ge,X.fillRect(De,xe,q,q)}}let v,D,U,M,R,F,H,Z,V,P,L,re=!1;function Q(){Z=a.height*.46,D=-20*o,U=Z,M=3.2,R=0,v="enter",F=0,H=0,L=!1,V=Z-32*o,P=0,re=!0}function ee(){return a.width/2-6*o}function W(){if(!re)return;const X=a.width,I=a.height;l.clearRect(0,0,X,I),L&&(V+=P,P+=.4,T(l,O,a.width/2-3*o,V,o,!1),V>I+16*o&&(L=!1)),(v==="enter"||v==="exit")&&(H++,H>=6&&(H=0,F=(F+1)%3));const $=[x,C,y];if(v==="enter")D+=M,T(l,$[F],D,U,o,!1),D+5*o>=ee()&&(v="bump_up",M=0,R=-7);else if(v==="bump_up")R+=.7,U+=R,T(l,N,D,U,o,!1),R>=0&&(v="bump_down",L=!0,P=-10,V=U-10*o);else if(v==="bump_down")R+=.7,U+=R,T(l,N,D,U,o,!1),U>=Z&&(U=Z,R=0,M=-3.2,v="exit");else if(v==="exit"&&(D+=M,T(l,$[F],D,U,o,!0),D<-20*o)){re=!1,setTimeout(()=>{Q(),W()},2500);return}requestAnimationFrame(W)}setTimeout(()=>{Q(),W()},1200)},unmounted(a){window.removeEventListener("resize",a._resize)}};class Nm{constructor(l){Re(this,"value");Re(this,"next");this.value=l}}class Tm{constructor(){Ui(this,en);Ui(this,Gn);Ui(this,sr);this.clear()}enqueue(l){const o=new Nm(l);wn(this,en)?(wn(this,Gn).next=o,Pn(this,Gn,o)):(Pn(this,en,o),Pn(this,Gn,o)),Zo(this,sr)._++}dequeue(){const l=wn(this,en);if(l)return Pn(this,en,wn(this,en).next),Zo(this,sr)._--,wn(this,en)||Pn(this,Gn,void 0),l.value}peek(){if(wn(this,en))return wn(this,en).value}clear(){Pn(this,en,void 0),Pn(this,Gn,void 0),Pn(this,sr,0)}get size(){return wn(this,sr)}*[Symbol.iterator](){let l=wn(this,en);for(;l;)yield l.value,l=l.next}*drain(){for(;wn(this,en);)yield this.dequeue()}}en=new WeakMap,Gn=new WeakMap,sr=new WeakMap;function km(a){Da(a);const l=new Tm;let o=0;const i=()=>{o<a&&l.size>0&&(o++,l.dequeue()())},u=()=>{o--,i()},f=async(w,x,C)=>{const y=(async()=>w(...C))();x(y);try{await y}catch{}u()},m=(w,x,C)=>{new Promise(y=>{l.enqueue(y)}).then(f.bind(void 0,w,x,C)),o<a&&i()},p=(w,...x)=>new Promise(C=>{m(w,C,x)});return Object.defineProperties(p,{activeCount:{get:()=>o},pendingCount:{get:()=>l.size},clearQueue:{value(){l.clear()}},concurrency:{get:()=>a,set(w){Da(w),a=w,queueMicrotask(()=>{for(;o<a&&l.size>0;)i()})}},map:{async value(w,x){const C=Array.from(w,(y,N)=>this(x,y,N));return Promise.all(C)}}}),p}function Da(a){if(!((Number.isInteger(a)||a===Number.POSITIVE_INFINITY)&&a>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up")}let Jt=null;const va=km(5),Rm=async(a,l)=>{Jt&&Dm();const o=st(),i=Rt(),u=Gr(),f=Lt(),{itemThemes:m}=we.storeToRefs(i),{displayCards:p}=we.storeToRefs(o),{is_notification_lib:w,notificationData_lib:x}=we.storeToRefs(u),{stateCard:C,openProduct:y}=we.storeToRefs(f),N=yn.create();await Bm(a),Jt=Lr(`wss://${l}/ws/org-unit/${a}/`,{heartbeatTimeout:3e4}),Jt.on("open",()=>console.warn("Realtime WebSocket подключён (pointId:",a,")")),Jt.on("error",O=>console.warn("WebSocket ошибка:",O)),Jt.on("close",()=>console.warn("Realtime WebSocket закрыт")),Jt.on("message",async O=>{try{if(O.type)return;m.value.kiosk_hide_menu_update_notification||(x.value.textNotification="Мы обновили меню");const T=O.params||O,v=T.active_groups||[],D=T.updated_groups||[],U=T.updated_product_groups||[],M=await Qn(),R=new Set(v.map(Q=>Q)),F=new Map(p.value.map(Q=>[Q.id,Q])),H=[],Z=M.transaction("groups","readwrite");let P=await Z.objectStore("groups").openCursor();for(;P;){const Q=P.key;!R.has(Q)&&Q!==a&&(H.push(Q),await P.delete(),F.delete(Q)),P=await P.continue()}await Z.done,p.value=Array.from(F.values()),H.length>0&&await Om(R);const L=[...D.map(Q=>va(async()=>{const[ee,W]=await Promise.all([N.getGroupByID(Q),N.loadGroupProducts(Q)]);ee.products=W,F.set(Q,ee),await Dr(Q,ee),await La(ee,W,!0)})),...U.map(Q=>va(async()=>{const[ee,W]=await Promise.all([N.getGroupByID(Q),N.loadGroupProducts(Q)]);ee.products=W,F.set(Q,ee),await Dr(Q,ee),await La(ee,W,!0),await Mm(W,Q)}))];await Promise.all(L),p.value=Array.from(F.values()),await Nl(a,p),x.value.textNotification.length>1&&(w.value=!0);const re=C.value.openCard;if(re!=null&&re.id){const Q=new Set(re.groups??[]),ee=new Set;let W=!1;for(const I of F.values()){const $=I==null?void 0:I.products;if(!Array.isArray($))continue;const j=$.find(q=>(q==null?void 0:q.id)===re.id);if((j==null?void 0:j.adult)===!0){y.value={id:null,visible:!1},f.reset();return}j&&(I==null?void 0:I.id)!=null&&(ee.add(I.id),(D.includes(I.id)||U.includes(I.id))&&(W=!0))}if(ee.size===0){y.value={id:null,visible:!1},f.reset();return}(!(Q.size===ee.size&&[...Q].every(I=>ee.has(I)))||W)&&await N.getSingleProduct(re==null?void 0:re.id)}}catch(T){console.error("ошибка обновления indexedDB [updateIndexedDB]",T)}}),Jt.connect()},Bm=async a=>{try{const l=st(),o=await qi(a);o!=null&&o.data&&(l.displayCards=o.data)}catch(l){console.error("Ошибка загрузки кэша групп:",l)}},Pa=async a=>{const l=st(),o=Gr(),i=Lt(),{stateCard:u,openProduct:f}=we.storeToRefs(i),{cartProducts_lib:m}=we.storeToRefs(l),p=m.value,w=[],x=[],C=u.value.openCard;for(const y of p)a(y)?(w.push(y),(y.id===(C==null?void 0:C.id)||C!=null&&C.adult)&&(f.value={id:null,visible:!1})):x.push(y);if(w.length>0){const y=w.map(N=>N.name).slice(0,3).join(", ");o.notificationData_lib.textNotification=`Некоторые позиции стали недоступны и были убраны из заказа: ${y}${w.length>3?` и ещё ${w.length-3}`:""}`,m.value=x,l.updateCartInLocalStorage()}},Om=async a=>{await Pa(l=>{var o;return(o=l.groups)!=null&&o.length?!l.groups.some(i=>a.has(i)):!0})},Mm=async(a,l)=>{const o=st(),i=new Set(a.filter(u=>!u.adult||o.is18Allowed).map(u=>u.id));await Pa(u=>{var f;return(f=u.groups)!=null&&f.includes(l)?!i.has(u.id):!1})},La=async(a,l,o=!0)=>{if(a.video_link&&Ti(a.video_link,`${a.id}_video`,o),a.image_link&&Ti(a.image_link,`${a.id}_image`,o),l!=null&&l.length)for(const i of l)i.video_link&&Ti(i.video_link,`${i.id}_video`,o),i.image_link&&Ti(i.image_link,`${i.id}_image`,o)},Ti=async(a,l,o=!1)=>{try{const i=si();if(!o){const m=await fr(l);if(m){i.updateCacheFromBlob(l,m),window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:l,blob:m}}));return}}const u=await fetch(a);if(!u.ok)throw new Error("Network error");const f=await u.blob();if(f.size===0)throw new Error("Empty blob");await Zi(l,f),i.updateCacheFromBlob(l,f),window.dispatchEvent(new CustomEvent("image-cached",{detail:{id:l,blob:f}}))}catch(i){console.warn(`[MediaCache] Failed for ${l}:`,i)}},Dm=()=>{Jt&&(Jt.off("open"),Jt.off("message"),Jt.off("error"),Jt.off("close"),Jt.close(!0),Jt=null)},vm={key:0,class:"valentine-hearts"},Pm=r.defineComponent({__name:"FallingHearts",props:{symbols:{default:()=>["❤","♥","💕"]},max:{default:15},interval:{default:1500}},setup(a){const l=a,o=yt.useDocumentVisibility(),i=yt.useMediaQuery("(prefers-reduced-motion: reduce)"),u=r.ref([]);let f=null;const m=(C,y)=>Math.random()*(y-C)+C,p=()=>{if(i.value||u.value.length>=l.max)return;const C=l.symbols[Math.floor(Math.random()*l.symbols.length)],y=m(18,26),N=m(5,95),O=m(10,18),T=m(0,.3),v=m(.6,.9),D=Math.floor(m(1,6)),M={id:crypto.randomUUID(),icon:C,style:{left:`${N}%`,fontSize:`${y}px`,color:`rgba(255, 105, 180, ${v})`,animationName:`heartFall${D}`,animationDuration:`${O}s`,animationDelay:`${T}s`}};u.value.push(M);const F=setTimeout(()=>{u.value=u.value.filter(H=>H.id!==M.id),clearTimeout(F)},(T+O+1)*1e3)},w=()=>{if(!i.value){for(let C=0;C<3;C++){const y=setTimeout(()=>{p(),clearTimeout(y)},C*200)}f=setInterval(p,l.interval)}},x=()=>{f&&(clearInterval(f),f=null),u.value=[]};return r.onMounted(()=>{i.value||w()}),r.onUnmounted(()=>{x()}),r.watch(o,(C,y)=>{C==="visible"&&y==="hidden"&&w(),C==="hidden"&&y==="visible"&&x()}),(C,y)=>r.unref(i)?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("div",vm,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(u.value,N=>(r.openBlock(),r.createElementBlock("span",{key:N.id,class:"heart",style:r.normalizeStyle(N.style)},r.toDisplayString(N.icon),5))),128))]))}}),Lm=["src"],Fm=r.defineComponent({__name:"BasketImage",props:{id:{},fallback:{}},setup(a){const l=a,{mediaUrl:o}=Tn(()=>l.id,()=>l.fallback);return(i,u)=>(r.openBlock(),r.createElementBlock("img",{src:r.unref(o)||""},null,8,Lm))}}),Vm={class:"button_price_bg"},Um={class:"wrapper_container_price_bg"},zm={class:"button_price"},Hm={key:0,class:"image_product_container"},Gm=r.defineComponent({__name:"BasketButton",emits:["goToCart"],setup(a,{emit:l}){const o=l,i=Te.useRouter(),u=st(),f=Fn(),{totalPrice_lib:m,cartProducts_lib:p}=we.storeToRefs(u),w=r.computed(()=>{var y;return m.value+(((y=f.order)==null?void 0:y.remaining_amount)||0)}),x=r.computed(()=>{var y;return(y=p.value)!=null&&y.length,p.value.slice(0,3).map(N=>({id:`${N.id}_image`,fallback:N.image_link}))}),C=()=>{var y;if(f.isTableService&&f.hasOrder&&!((y=p.value)!=null&&y.length))return i.push({name:"order-ts"});o("goToCart")};return(y,N)=>(r.openBlock(),r.createElementBlock("div",Vm,[r.createElementVNode("div",Um,[r.createElementVNode("div",zm,[r.unref(m)>0&&x.value.length>0?(r.openBlock(),r.createElementBlock("div",Hm,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(x.value,O=>(r.openBlock(),r.createElementBlock("div",{key:O.id,class:"filter_image_product"},[r.createVNode(Fm,{id:O.id,fallback:O.fallback,class:"img_product"},null,8,["id","fallback"])]))),128))])):r.createCommentVNode("",!0),r.createVNode(r.unref(Ot.motion).div,{class:"button_default_main",whilePress:{scale:.92},onClick:C},{default:r.withCtx(()=>[N[1]||(N[1]=r.createElementVNode("div",{class:"icont_cart"},null,-1)),r.createElementVNode("p",null,[r.createVNode(ft,{price:w.value,fixedFloat:2},null,8,["price"]),N[0]||(N[0]=r.createTextVNode(" ₽",-1))])]),_:1})])])]))}}),$r=null,{min:or,max:bn,abs:Fa,floor:Wm}=Math,Va=(a,l,o)=>or(o,bn(l,a)),Ua=a=>[...a].sort((l,o)=>l-o),Xm=typeof queueMicrotask=="function"?queueMicrotask:a=>{Promise.resolve().then(a)},ko=()=>{let a;return[new Promise(l=>{a=l}),a]},za=a=>{let l;return()=>(a&&(l=a(),a=void 0),l)},jr=(a,l,o)=>{const i=o?"unshift":"push";for(let u=0;u<l;u++)a[i](-1);return a},Ha=(a,l)=>{const o=a.t[l];return o===-1?a.o:o},$m=(a,l,o)=>{const i=a.t[l]===-1;return a.t[l]=o,a.i=or(l,a.i),i},ki=(a,l)=>{if(!a.l)return 0;if(a.i>=l)return a.u[l];a.i<0&&(a.u[0]=0,a.i=0);let o=a.i,i=a.u[o];for(;o<l;)i+=Ha(a,o),a.u[++o]=i;return a.i=l,i},yr=(a,l,o=0,i=a.l-1)=>{let u=o;for(;o<=i;){const f=Wm((o+i)/2);ki(a,f)<=l?(u=f,o=f+1):i=f-1}return Va(u,0,a.l-1)},Ga=(a,l,o)=>{const i=l-a.l;return a.i=o?-1:or(l-1,a.i),a.l=l,i>0?(jr(a.u,i),jr(a.t,i,o),a.o*i):(a.u.splice(i),(o?a.t.splice(0,-i):a.t.splice(i)).reduce((u,f)=>u-(f===-1?a.o:f),0))},jm=a=>a.documentElement,qm=a=>a.ownerDocument,Zm=a=>a.defaultView,Wa=za(()=>!!/iP(hone|od|ad)/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>0),Ym=za(()=>"scrollBehavior"in jm(document).style),Km=(a,l=40,o=0,i,u=!1)=>{let f=!!o,m=1,p=0,w=0,x=0,C=0,y=0,N=0,O=0,T=0,v=$r,D=[0,f?bn(o-1,0):-1],U=0,M=!1;const R=((W,X,I)=>({o:X,t:I?jr(I.slice(0,or(W,I.length)),bn(0,W-I.length)):jr([],W),l:W,i:-1,u:jr([],W+1)}))(a,i?i[1]:l,i&&i[0]),F=new Set,H=()=>x-w,Z=()=>H()+y+C,V=(W,X)=>((I,$,j,q)=>{if(q=or(q,I.l-1),ki(I,q)<=$){const K=yr(I,j,q);return[yr(I,$,q,K),K]}{const K=yr(I,$,void 0,q);return[K,yr(I,j,K)]}})(R,W,X,D[0]),P=()=>ki(R,R.l),L=(W,X)=>{const I=ki(R,W)-y;return X?P()-I-re(W):I},re=W=>Ha(R,W),Q=(W,X=-1)=>R.t[W]===X,ee=W=>{W&&(Wa()&&O!==0||v&&T===1?y+=W:C+=W)};return{p:()=>{F.clear()},h:()=>m,m:()=>(W=>[W.t.slice(),W.o])(R),v:(W=200)=>{if(!M||f)return D;let X,I;if(N)[X,I]=D;else{let $=bn(0,Z()),j=$+p;u||(W=bn(0,W),O!==1&&($-=W),O!==2&&(j+=W)),[X,I]=D=V(bn(0,$),bn(0,j)),v&&(X=or(X,v[0]),I=bn(I,v[1]))}return[bn(X,0),or(I,R.l-1)]},S:W=>yr(R,W-w),I:Q,O:L,k:re,j:()=>R.l,N:()=>x,B:()=>O!==0,T:()=>p,q:()=>w,M:P,P:()=>(N=C,C=0,[N,T===2]),R:(W,X)=>{const I=[W,X];return F.add(I),()=>{F.delete(I)}},A:(W,X)=>{let I,$,j=0;switch(W){case 1:{if(X===x&&T===0)break;const q=N;N=0;const K=X-x,oe=Fa(K);q&&oe<Fa(q)+1||T!==0||(O=K<0?2:1),f&&(f=!1),x=X,j=4;const de=H();de>=-p&&de<=P()&&(j+=1,$=oe>p);break}case 2:j=8,O!==0&&(I=!0,j+=1),O=0,T=0,v=$r;break;case 3:{const q=X.filter(([K,oe])=>!Q(K,oe));if(!q.length)break;ee(q.reduce((K,[oe,de])=>((T===2||(v&&T===1?oe<v[0]:L(oe+(O===0&&T===0?1:0))<H()))&&(K+=de-re(oe)),K),0));for(const[K,oe]of q){const de=re(K),ce=$m(R,K,oe);u&&(U+=ce?oe:oe-de)}u&&p&&U>p&&(ee(((K,oe)=>{let de=0;const ce=[];K.t.forEach((be,et)=>{be!==-1&&(ce.push(be),et<oe&&de++)}),K.i=-1;const Ce=Ua(ce),ge=Ce.length,De=ge/2|0,xe=ge%2==0?(Ce[De-1]+Ce[De])/2:Ce[De],_t=K.o;return((K.o=xe)-_t)*bn(oe-de,0)})(R,yr(R,Z()))),u=!1),j=3,$=!0;break}case 4:p!==X&&(p||(M=$=!0),p=X,j=3);break;case 5:X[1]?(ee(Ga(R,X[0],!0)),T=2,j=1):(Ga(R,X[0]),j=1);break;case 6:w=X;break;case 7:T=1;break;case 8:v=V(X,X+p),j=1}j&&(m=1+(2147483647&m),I&&y&&(C+=y,y=0),F.forEach(([q,K])=>{j&q&&K($)}))}}},Ro=setTimeout,Bo=(a,l)=>l?-a:a,Qm=(a,l,o,i,u,f)=>{const m=Date.now;let p=0,w=!1,x=!1,C=!1,y=!1;const N=(()=>{let U;const M=()=>{U!=$r&&clearTimeout(U)},R=()=>{M(),U=Ro(()=>{U=$r,(()=>{if(w||x)return w=!1,void N();C=!1,a.A(2)})()},150)};return R.C=M,R})(),O=()=>{p=m(),C&&(y=!0),a.A(1,i()),N()},T=U=>{if(w||!a.B()||U.ctrlKey)return;const M=m()-p;150>M&&50<M&&(o?U.deltaX:U.deltaY)&&(w=!0)},v=()=>{x=!0,C=y=!1},D=()=>{x=!1,Wa()&&(C=!0)};return l.addEventListener("scroll",O),l.addEventListener("wheel",T,{passive:!0}),l.addEventListener("touchstart",v,{passive:!0}),l.addEventListener("touchend",D,{passive:!0}),{H:()=>{l.removeEventListener("scroll",O),l.removeEventListener("wheel",T),l.removeEventListener("touchstart",v),l.removeEventListener("touchend",D),N.C()},V:()=>{const[U,M]=a.P();U&&(u(U,M,y),y=!1,M&&a.T()>a.M()&&a.A(1,i()))}}},Jm=(a,l,o)=>{let i;return[async(u,f)=>{if(!await l())return;i&&i();const m=()=>{const[p,w]=ko();return i=()=>{w(!1)},a.T()&&Ro(i,150),[p,a.R(2,()=>{w(!0)})]};if(f&&Ym())a.A(8,u()),Xm(async()=>{for(;;){let p=!0;for(let[C,y]=a.v();C<=y;C++)if(a.I(C)){p=!1;break}if(p)break;const[w,x]=m();try{if(!await w)return}finally{x()}}a.A(7),o(u(),f)});else for(;;){const[p,w]=m();try{if(a.A(7),o(u()),!await p)return}finally{w()}}},()=>{i&&i()}]},eg=a=>{let l;return{F(o){(l||(l=new(Zm(qm(o))).ResizeObserver(a))).observe(o)},J(o){l.unobserve(o)},H(){l&&l.disconnect()}}},tg=r.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(a){const l=r.ref(),o=r.computed(()=>a.L.value&&a.W.O(a.D,a.K)),i=r.computed(()=>a.L.value&&a.W.I(a.D));return r.watch(()=>l.value&&a.D,(u,f,m)=>{m(a.Y(l.value,a.D))},{flush:"post"}),()=>{var u;const{X:f,U:m,G:p,Z:w}=a,x=i.value,{style:C,...y}=(u=a.ee)!==null&&u!==void 0?u:{},N={contain:"layout style",position:x&&p?void 0:"absolute",[m?"height":"width"]:"100%",[m?"top":"left"]:"0px",[m?"left":"top"]:o.value+"px",visibility:!x||p?void 0:"hidden",...C};return m&&(N.display="inline-flex"),r.createVNode(w,r.mergeProps({ref:l,style:N},y),typeof(O=f)=="function"||Object.prototype.toString.call(O)==="[object Object]"&&!r.isVNode(O)?f:{default:()=>[f],_:2},16,["style"]);var O}}}),ng=(a,l)=>{const o=a.key;return o??"_"+l},rg=(a,l)=>a[0]===l[0]&&a[1]===l[1],Xa=r.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(a,{emit:l,expose:o,slots:i}){let u=!!a.ssrCount;const f=a.horizontal,m=r.ref(),p=Km(a.data.length,a.itemSize,a.ssrCount,a.cache,!a.itemSize),w=((T,v)=>{let D;const U=v?"width":"height",M=new WeakMap,R=eg(F=>{const H=[];for(const{target:Z,contentRect:V}of F)if(Z.offsetParent)if(Z===D)T.A(4,V[U]);else{const P=M.get(Z);P!=$r&&H.push([P,V[U]])}H.length&&T.A(3,H)});return{te(F){R.F(D=F)},re:(F,H)=>(M.set(F,H),R.F(F),()=>{M.delete(F),R.J(F)}),p:R.H}})(p,f),x=((T,v)=>{let D,U,M=ko(),R=!1;const F=v?"scrollLeft":"scrollTop",H=v?"overflowX":"overflowY",[Z,V]=Jm(T,()=>M[0],(P,L)=>{P=Bo(P,R),L?D.scrollTo({[v?"left":"top"]:P,behavior:"smooth"}):D[F]=P});return{oe(P){D=P,v&&(R=getComputedStyle(P).direction==="rtl"),U=Qm(T,P,v,()=>Bo(P[F],R),(L,re,Q)=>{if(Q){const ee=P.style,W=ee[H];ee[H]="hidden",Ro(()=>{ee[H]=W})}P[F]=Bo(T.N()+L,R),re&&V()}),M[1](!0)},p(){U&&U.H(),M[1](!1),M=ko()},ne:()=>R,se(P){Z(()=>P)},ie(P){P+=T.N(),Z(()=>P)},le(P,{align:L,smooth:re,offset:Q=0}={}){if(P=Va(P,0,T.j()-1),L==="nearest"){const ee=T.O(P),W=T.N();if(ee<W)L="start";else{if(!(ee+T.k(P)>W+T.T()))return;L="end"}}Z(()=>Q+T.q()+T.O(P)+(L==="end"?T.k(P)-T.T():L==="center"?(T.k(P)-T.T())/2:0),re)},ce:()=>{U&&U.V()}}})(p,f),C=r.ref(p.h());p.R(1,()=>{C.value=p.h()}),p.R(4,()=>{l("scroll",p.N())}),p.R(8,()=>{l("scrollEnd")});const y=r.computed(T=>{C.value;const v=p.v(a.bufferSize);return T&&rg(T,v)?T:v}),N=r.computed(()=>C.value&&p.B()),O=r.computed(()=>C.value&&p.M());return r.onMounted(()=>{u=!1;const T=requestAnimationFrame(()=>{const v=D=>{w.te(D),x.oe(D)};a.scrollRef?v(a.scrollRef):v(m.value.parentElement)});r.onUnmounted(()=>{cancelAnimationFrame(T)})}),r.onUnmounted(()=>{p.p(),w.p(),x.p()}),r.watch(()=>a.data.length,T=>{p.A(5,[T,a.shift])}),r.watch(()=>a.startMargin,T=>{p.A(6,T)},{immediate:!0}),r.watch([C],()=>{x.ce()},{flush:"post"}),o({get cache(){return p.m()},get scrollOffset(){return p.N()},get scrollSize(){return(T=>bn(T.M(),T.T()))(p)},get viewportSize(){return p.T()},findItemIndex:p.S,getItemOffset:p.O,getItemSize:p.k,scrollToIndex:x.le,scrollTo:x.se,scrollBy:x.ie}),()=>{const T=a.as,v=a.item,D=O.value,U=x.ne(),M=!f&&U?"unshift":"push",R=[],F=Z=>{var V;const P=i.default({item:a.data[Z],index:Z})[0];return r.createVNode(tg,{key:ng(P,Z),L:C,W:p,Y:w.re,D:Z,X:P,U:f,K:U,G:u,Z:v,ee:(V=a.itemProps)===null||V===void 0?void 0:V.call(a,{item:a.data[Z],index:Z})},null,8,["L","W","Y","D","X","U","K","G","Z","ee"])};if(a.keepMounted){const Z=new Set(a.keepMounted);for(let[V,P]=y.value;V<=P;V++)Z.add(V);Ua([...Z]).forEach(V=>{R[M](F(V))})}else for(let[Z,V]=y.value;Z<=V;Z++)R[M](F(Z));return r.createVNode(T,{ref:m,style:{contain:"size style",overflowAnchor:"none",flex:"none",position:"relative",width:f?D+"px":"100%",height:f?"100%":D+"px",pointerEvents:N.value?"none":void 0}},typeof(H=R)=="function"||Object.prototype.toString.call(H)==="[object Object]"&&!r.isVNode(H)?R:{default:()=>[R],_:2},8,["style"]);var H}}}),ig=r.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(a,{emit:l,expose:o,slots:i}){const u=a.horizontal,f=w=>{l("scroll",w)},m=()=>{l("scrollEnd")},p=r.ref();return o({get cache(){return p.value.cache},get scrollOffset(){return p.value.scrollOffset},get scrollSize(){return p.value.scrollSize},get viewportSize(){return p.value.viewportSize},findItemIndex:(...w)=>p.value.findItemIndex(...w),getItemOffset:(...w)=>p.value.getItemOffset(...w),getItemSize:(...w)=>p.value.getItemSize(...w),scrollToIndex:(...w)=>p.value.scrollToIndex(...w),scrollTo:(...w)=>p.value.scrollTo(...w),scrollBy:(...w)=>p.value.scrollBy(...w)}),()=>{return r.createVNode("div",{style:{display:u?"inline-block":"block",[u?"overflowX":"overflowY"]:"auto",contain:"strict",width:"100%",height:"100%"}},[r.createVNode(Xa,{ref:p,data:a.data,bufferSize:a.bufferSize,itemSize:a.itemSize,itemProps:a.itemProps,shift:a.shift,ssrCount:a.ssrCount,horizontal:u,keepMounted:a.keepMounted,cache:a.cache,onScroll:f,onScrollEnd:m},(w=i,typeof w=="function"||Object.prototype.toString.call(w)==="[object Object]"&&!r.isVNode(w)?i:{default:()=>[i],_:2}),8,["data","bufferSize","itemSize","itemProps","shift","ssrCount","horizontal","keepMounted","cache","onScroll","onScrollEnd"])],4);var w}}}),og=(a,l=10)=>new Promise(o=>{let i=0,u=0,f=0;const m=()=>{if(!a||a.scrollSize===void 0){o();return}const p=a.scrollSize;p===f&&p>0?i++:(i=0)&&(f=p),u++,i>=2||u>=l?o():requestAnimationFrame(m)};requestAnimationFrame(m)});function sg(a,l){const o=(l==null?void 0:l.align)??"start";let i=!1;const u=r.ref(null),f=r.ref(!1),m=r.ref("measure"),p=r.computed(()=>r.toValue(a).length),w=r.computed(()=>m.value==="measure"||m.value==="virtual"?1:5),x=r.computed(()=>Array.from({length:p.value*w.value},(D,U)=>U)),C=async()=>{if(u.value&&(m.value="measure",i=!1,f.value=!1,await r.nextTick(),!(!u.value||m.value!=="measure")&&(await og(u.value),!!u.value))){if(f.value=u.value.scrollSize>u.value.viewportSize,!f.value){i=!1;return}i=!0,m.value=(l==null?void 0:l.mode)||"loop",await r.nextTick(),u.value&&u.value.scrollToIndex(p.value*3,{align:o})}},y=D=>m.value==="measure"?D:p.value===0?0:D%p.value,N=(D,U)=>{u.value&&u.value.scrollToIndex(D,U)},O=(D,U)=>!i||m.value!=="loop"?U:U+Math.round((D-U)/p.value)*p.value,T=D=>{if(!i||m.value!=="loop"||!u.value)return;const U=p.value-1,M=p.value*4;if(D<U)return N(p.value*3-1,{align:"start"});if(D>=M)return N(p.value*3,{align:"start"})},v=()=>{if(!u.value||!i)return;const D=u.value.findItemIndex(u.value.scrollOffset);T(D)};return r.onMounted(C),r.onUnmounted(()=>u.value=null),r.watch(p,()=>r.nextTick(C)),{listRef:u,items:x,hasScroll:f,realIndex:y,findNearestIndex:O,scrollToIndex:N,init:C,onScroll:v}}const ag=Object.prototype.toString,lg=a=>ag.call(a)==="[object Error]",cg=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"]),dg=a=>{if(!(a&&lg(a)&&a.name==="TypeError"&&typeof a.message=="string"))return!1;const{message:o,stack:i}=a;return o==="Load failed"?i===void 0||"__sentry_captured__"in a:o.startsWith("error sending request for url")||o==="Failed to fetch"||o.startsWith("Failed to fetch (")&&o.endsWith(")")?!0:cg.has(o)},ug={pinch:!0,doubleTap:!0,wheel:!0,buttons:["+","-","=","0"]},fg=a=>{var o;const l=Object.assign({},ug,a);if(l.pinch&&(document.addEventListener("touchstart",i=>i.touches.length>1&&i.preventDefault(),{passive:!1}),document.addEventListener("gesturestart",i=>i.preventDefault(),{passive:!1})),l.doubleTap){let i=0;document.addEventListener("touchend",u=>{const f=Date.now();f-i<=250&&u.preventDefault(),i=f},{passive:!1})}l.wheel&&document.addEventListener("wheel",i=>(i.ctrlKey||i.metaKey)&&i.preventDefault(),{passive:!1}),(o=l.buttons)!=null&&o.length&&document.addEventListener("keydown",i=>(i.ctrlKey||i.metaKey)&&l.buttons.includes(i.key)&&i.preventDefault())};Object.defineProperty(he,"useRoute",{enumerable:!0,get:()=>Te.useRoute}),Object.defineProperty(he,"useRouter",{enumerable:!0,get:()=>Te.useRouter}),he.BasketButton=Gm,he.BottomSheet=xo,he.ButtonDefault=an,he.CardMain=xa,he.CardProductPage=E0,he.CardReader=fa,he.CartBox=ua,he.CartPage=kh,he.DrumItem=M2,he.FallingHearts=Pm,he.GroupMain=N2,he.InitConnection=yn,he.ModalWindows=X2,he.NotificationWindow=Ei,he.OrderBox=bo,he.PopupWindowDefault=da,he.PricePrerender=hr,he.QrCameraScanner=bm,he.Recommendation=z2,he.RetryPage=Uh,he.TableOrderPage=f2,he.TagsMain=k2,he.VList=ig,he.Virtualizer=Xa,he.clearAllProductDB=kl,he.clearLocalStorage=mr,he.getCachedGroup=qi,he.getCachedProduct=rs,he.getWebSocketInstance=Lr,he.initPinia=dl,he.initRouter=fl,he.isNetworkError=dg,he.parseTheme=ia,he.preventZoom=fg,he.updateIndexedDB=Rm,he.useCachedMedia=Tn,he.useCardLibStore=Lt,he.useCartLibStore=Mt,he.useImageCacheStore=si,he.useMainLibStore=st,he.useModal=yo,he.useModalStore=bi,he.useModulesLibStore=Gr,he.usePdf=Un,he.useTableStore=Fn,he.useThemeStore=Rt,he.useVirtuaLoop=sg,he.vClickOutside=Am,he.vConfetti=Sm,he.vDragScroll=Wr,he.vMario=Im,he.vMuted=Xr,Object.defineProperty(he,Symbol.toStringTag,{value:"Module"})});