@enablerr-ui/detail 0.3.203 → 0.3.205

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.min.js CHANGED
@@ -1,5 +1,5 @@
1
- System.register(["@enablerr-ui/form","@enablerr-ui/layout","@enablerr-ui/auth","@enablerr-ui/task"],function(e){"use strict";var t,n,r,i,o,s,a,l,c,d,u,f;return{setters:[function(e){t=e.Request,n=e.Storage,r=e.task_notification,i=e.currentRoles,o=e.settings,s=e.TextArea,a=e.toasts,l=e.Page},function(e){c=e.getAttractions,d=e.PopOver},function(e){u=e.user},function(e){f=e.taskClipboard}],execute:function(){function h(e,t){return t.forEach(function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach(function(n){if("default"!==n&&!(n in e)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})}),Object.freeze(e)}e("version","0.3.203");const m=e("checkDate",(e,t)=>"string"!=typeof e||e.length<20||!(t=e.split(" · "))?e:t.map(e=>2===e.split("T").length&&3===e.split("T")[0].split("-").length?new Date(e).toLocaleDateString():e).filter(e=>!!e).join(" · ")),p=e=>{try{return new Date(e).toLocaleString()}catch{return e}},g=(e,t)=>{let n,r;try{n=t[e+"_from"],n=new Date(n||"").toLocaleDateString(),"Invalid Date"===n&&(n=" ")}catch{n=" "}try{r=t[e+"_to"],r=new Date(r||"").toLocaleDateString(),"Invalid Date"===r&&(r="")}catch{r=""}return[n,r].filter(e=>""!==e).join(" - ").trim()},w=e=>!0===e?"(ja)":!1===e?"(nein)":"",y=(e,t)=>{if(!e.display&&!e.items)return"";const n={...t};return(e.display?.reduce((t,r)=>{let[i,o]=r.split(".");if(e.list?.find(({name:e})=>e===i)&&o&&void 0!==n[i]){const e=`${i}_${o}`;n[e]=n[i][o],i=e}return t.find(e=>e===i)||t.push(i),t},[]).map(e=>"boolean"==typeof n[e]?w(n[e]):m(n["_"+e]||n[e]))||e.items.map(e=>"object"===e.type?t["_"+e.name]:"list"===e.type?"":("boolean"==typeof t[e.name]&&w(t[e.name]),t[e.name]))).map(e=>e?.toString().split(" · ").filter(e=>!!e&&!v(e)).join(" · ")).filter(e=>!!e).join(" • ")},v=e=>/^[0-9a-f]{24}/.test(e),$=(e,t)=>{try{return t.split(".").reduce((e,t)=>e[t],e)??""}catch{return""}};const I=e=>{if(t=e,"[object Date]"===Object.prototype.toString.call(t))return e;var t;if("string"!=typeof e)return e;try{if((e=e.slice(0,10)).includes(".")){const[t,n,r]=e.split(".");return new Date(r,n-1,t)}if(e.includes("-")){const[t,n,r]=e.split("-");return new Date(t,n-1,r)}}catch{return e}return e};function _(){}function C(e){return e()}function E(){return Object.create(null)}function A(e){e.forEach(C)}function b(e){return"function"==typeof e}function S(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function N(e,t,n){e.$$.on_destroy.push(function(e,...t){if(null==e)return _;const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}(t,n))}function T(e){return null==e?"":e}function R(e,t,n=t){return e.set(n),t}function D(e,t){e.appendChild(t)}function x(e,t,n){e.insertBefore(t,n||null)}function k(e){e.parentNode.removeChild(e)}function O(e,t){for(let n=0;n<e.length;n+=1)e[n]&&e[n].d(t)}function M(e){return document.createElement(e)}function P(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function B(e){return document.createTextNode(e)}function L(){return B(" ")}function F(){return B("")}function V(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function U(e){return function(t){return t.preventDefault(),e.call(this,t)}}function W(e){return function(t){return t.stopPropagation(),e.call(this,t)}}function z(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function H(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}function j(e,t){e.value=null==t?"":t}function q(e,t,n,r){e.style.setProperty(t,n,r?"important":"")}function G(e,t,n){e.classList[n?"add":"remove"](t)}class X{constructor(e=null){this.a=e,this.e=this.n=null}m(e,t,n=null){this.e||(this.e=M(t.nodeName),this.t=t,this.h(e)),this.i(n)}h(e){this.e.innerHTML=e,this.n=Array.from(this.e.childNodes)}i(e){for(let t=0;t<this.n.length;t+=1)x(this.t,this.n[t],e)}p(e){this.d(),this.h(e),this.i(this.a)}d(){this.n.forEach(k)}}let Y;function Z(e){Y=e}function K(){if(!Y)throw new Error("Function called outside component initialization");return Y}function Q(e){K().$$.on_mount.push(e)}function J(e){K().$$.on_destroy.push(e)}function ee(){const e=K();return(t,n)=>{const r=e.$$.callbacks[t];if(r){const i=function(e,t){const n=document.createEvent("CustomEvent");return n.initCustomEvent(e,!1,!1,t),n}(t,n);r.slice().forEach(t=>{t.call(e,i)})}}}function te(e,t){const n=e.$$.callbacks[t.type];n&&n.slice().forEach(e=>e(t))}const ne=[],re=[],ie=[],oe=[],se=Promise.resolve();let ae=!1;function le(){ae||(ae=!0,se.then(me))}function ce(){return le(),se}function de(e){ie.push(e)}function ue(e){oe.push(e)}let fe=!1;const he=new Set;function me(){if(!fe){fe=!0;do{for(let e=0;e<ne.length;e+=1){const t=ne[e];Z(t),pe(t.$$)}for(Z(null),ne.length=0;re.length;)re.pop()();for(let e=0;e<ie.length;e+=1){const t=ie[e];he.has(t)||(he.add(t),t())}ie.length=0}while(ne.length);for(;oe.length;)oe.pop()();ae=!1,fe=!1,he.clear()}}function pe(e){if(null!==e.fragment){e.update(),A(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(de)}}const ge=new Set;let we;function ye(){we={r:0,c:[],p:we}}function ve(){we.r||A(we.c),we=we.p}function $e(e,t){e&&e.i&&(ge.delete(e),e.i(t))}function Ie(e,t,n,r){if(e&&e.o){if(ge.has(e))return;ge.add(e),we&&we.c.push(()=>{ge.delete(e),r&&(n&&e.d(1),r())}),e.o(t)}}function _e(e,t){const n=t.token={};function r(e,r,i,o){if(t.token!==n)return;t.resolved=o;let s=t.ctx;void 0!==i&&(s=s.slice(),s[i]=o);const a=e&&(t.current=e)(s);let l=!1;t.block&&(t.blocks?t.blocks.forEach((e,n)=>{n!==r&&e&&(ye(),Ie(e,1,1,()=>{t.blocks[n]===e&&(t.blocks[n]=null)}),ve())}):t.block.d(1),a.c(),$e(a,1),a.m(t.mount(),t.anchor),l=!0),t.block=a,t.blocks&&(t.blocks[r]=a),l&&me()}if((i=e)&&"object"==typeof i&&"function"==typeof i.then){const n=K();if(e.then(e=>{Z(n),r(t.then,1,t.value,e),Z(null)},e=>{if(Z(n),r(t.catch,2,t.error,e),Z(null),!t.hasCatch)throw e}),t.current!==t.pending)return r(t.pending,0),!0}else{if(t.current!==t.then)return r(t.then,1,t.value,e),!0;t.resolved=e}var i}function Ce(e,t,n){const r=t.slice(),{resolved:i}=e;e.current===e.then&&(r[e.value]=i),e.current===e.catch&&(r[e.error]=i),e.block.p(r,n)}const Ee="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:global;function Ae(e,t){Ie(e,1,1,()=>{t.delete(e.key)})}function be(e,t,n,r,i,o,s,a,l,c,d,u){let f=e.length,h=o.length,m=f;const p={};for(;m--;)p[e[m].key]=m;const g=[],w=new Map,y=new Map;for(m=h;m--;){const e=u(i,o,m),a=n(e);let l=s.get(a);l?r&&l.p(e,t):(l=c(a,e),l.c()),w.set(a,g[m]=l),a in p&&y.set(a,Math.abs(m-p[a]))}const v=new Set,$=new Set;function I(e){$e(e,1),e.m(a,d),s.set(e.key,e),d=e.first,h--}for(;f&&h;){const t=g[h-1],n=e[f-1],r=t.key,i=n.key;t===n?(d=t.first,f--,h--):w.has(i)?!s.has(r)||v.has(r)?I(t):$.has(i)?f--:y.get(r)>y.get(i)?($.add(r),I(t)):(v.add(i),f--):(l(n,s),f--)}for(;f--;){const t=e[f];w.has(t.key)||l(t,s)}for(;h;)I(g[h-1]);return g}function Se(e,t,n){const r=e.$$.props[t];void 0!==r&&(e.$$.bound[r]=n,n(e.$$.ctx[r]))}function Ne(e){e&&e.c()}function Te(e,t,n,r){const{fragment:i,on_mount:o,on_destroy:s,after_update:a}=e.$$;i&&i.m(t,n),r||de(()=>{const t=o.map(C).filter(b);s?s.push(...t):A(t),e.$$.on_mount=[]}),a.forEach(de)}function Re(e,t){const n=e.$$;null!==n.fragment&&(A(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function De(e,t,n,r,i,o,s=[-1]){const a=Y;Z(e);const l=e.$$={fragment:null,ctx:null,props:o,update:_,not_equal:i,bound:E(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(a?a.$$.context:t.context||[]),callbacks:E(),dirty:s,skip_bound:!1};let c=!1;if(l.ctx=n?n(e,t.props||{},(t,n,...r)=>{const o=r.length?r[0]:n;return l.ctx&&i(l.ctx[t],l.ctx[t]=o)&&(!l.skip_bound&&l.bound[t]&&l.bound[t](o),c&&function(e,t){-1===e.$$.dirty[0]&&(ne.push(e),le(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}(e,t)),n}):[],l.update(),c=!0,A(l.before_update),l.fragment=!!r&&r(l.ctx),t.target){if(t.hydrate){const e=function(e){return Array.from(e.childNodes)}(t.target);l.fragment&&l.fragment.l(e),e.forEach(k)}else l.fragment&&l.fragment.c();t.intro&&$e(e.$$.fragment),Te(e,t.target,t.anchor,t.customElement),me()}Z(a)}class xe{$destroy(){Re(this,1),this.$destroy=_}$on(e,t){const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}$set(e){var t;this.$$set&&(t=e,0!==Object.keys(t).length)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}function ke(e){let t,n,r,i;return{c(){t=P("svg"),n=P("path"),r=P("polygon"),z(n,"d","M5 17H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-1"),z(r,"points","12 15 17 21 7 21 12 15"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",i="feather feather-airplay "+e[2])},m(e,i){x(e,t,i),D(t,n),D(t,r)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-airplay "+e[2])&&z(t,"class",i)},i:_,o:_,d(e){e&&k(t)}}}function Oe(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class Me extends xe{constructor(e){super(),De(this,e,Oe,ke,S,{size:0,strokeWidth:1,class:2})}}function Pe(e){let t,n,r,i,o;return{c(){t=P("svg"),n=P("path"),r=P("line"),i=P("line"),z(n,"d","M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"),z(r,"x1","12"),z(r,"y1","9"),z(r,"x2","12"),z(r,"y2","13"),z(i,"x1","12"),z(i,"y1","17"),z(i,"x2","12.01"),z(i,"y2","17"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",o="feather feather-alert-triangle "+e[2])},m(e,o){x(e,t,o),D(t,n),D(t,r),D(t,i)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-alert-triangle "+e[2])&&z(t,"class",o)},i:_,o:_,d(e){e&&k(t)}}}function Be(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class Le extends xe{constructor(e){super(),De(this,e,Be,Pe,S,{size:0,strokeWidth:1,class:2})}}function Fe(e){let t,n,r,i,o;return{c(){t=P("svg"),n=P("circle"),r=P("polyline"),i=P("line"),z(n,"cx","12"),z(n,"cy","12"),z(n,"r","10"),z(r,"points","8 12 12 16 16 12"),z(i,"x1","12"),z(i,"y1","8"),z(i,"x2","12"),z(i,"y2","16"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",o="feather feather-arrow-down-circle "+e[2])},m(e,o){x(e,t,o),D(t,n),D(t,r),D(t,i)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-arrow-down-circle "+e[2])&&z(t,"class",o)},i:_,o:_,d(e){e&&k(t)}}}function Ve(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class Ue extends xe{constructor(e){super(),De(this,e,Ve,Fe,S,{size:0,strokeWidth:1,class:2})}}function We(e){let t,n,r,i;return{c(){t=P("svg"),n=P("path"),r=P("path"),z(n,"d","M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"),z(r,"d","M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",i="feather feather-book-open "+e[2])},m(e,i){x(e,t,i),D(t,n),D(t,r)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-book-open "+e[2])&&z(t,"class",i)},i:_,o:_,d(e){e&&k(t)}}}function ze(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class He extends xe{constructor(e){super(),De(this,e,ze,We,S,{size:0,strokeWidth:1,class:2})}}function je(e){let t,n,r,i;return{c(){t=P("svg"),n=P("path"),r=P("circle"),z(n,"d","M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"),z(r,"cx","12"),z(r,"cy","13"),z(r,"r","4"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",i="feather feather-camera "+e[2])},m(e,i){x(e,t,i),D(t,n),D(t,r)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-camera "+e[2])&&z(t,"class",i)},i:_,o:_,d(e){e&&k(t)}}}function qe(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class Ge extends xe{constructor(e){super(),De(this,e,qe,je,S,{size:0,strokeWidth:1,class:2})}}function Xe(e){let t,n,r,i;return{c(){t=P("svg"),n=P("path"),r=P("polyline"),z(n,"d","M22 11.08V12a10 10 0 1 1-5.93-9.14"),z(r,"points","22 4 12 14.01 9 11.01"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",i="feather feather-check-circle "+e[2])},m(e,i){x(e,t,i),D(t,n),D(t,r)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-check-circle "+e[2])&&z(t,"class",i)},i:_,o:_,d(e){e&&k(t)}}}function Ye(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class Ze extends xe{constructor(e){super(),De(this,e,Ye,Xe,S,{size:0,strokeWidth:1,class:2})}}function Ke(e){let t,n,r;return{c(){t=P("svg"),n=P("path"),z(n,"d","M18 3a3 3 0 0 0-3 3v12a3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3H6a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3V6a3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3h12a3 3 0 0 0 3-3 3 3 0 0 0-3-3z"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",r="feather feather-command "+e[2])},m(e,r){x(e,t,r),D(t,n)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&r!==(r="feather feather-command "+e[2])&&z(t,"class",r)},i:_,o:_,d(e){e&&k(t)}}}function Qe(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class Je extends xe{constructor(e){super(),De(this,e,Qe,Ke,S,{size:0,strokeWidth:1,class:2})}}function et(e){let t,n,r,i;return{c(){t=P("svg"),n=P("polyline"),r=P("path"),z(n,"points","9 10 4 15 9 20"),z(r,"d","M20 4v7a4 4 0 0 1-4 4H4"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",i="feather feather-corner-down-left "+e[2])},m(e,i){x(e,t,i),D(t,n),D(t,r)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-corner-down-left "+e[2])&&z(t,"class",i)},i:_,o:_,d(e){e&&k(t)}}}function tt(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class nt extends xe{constructor(e){super(),De(this,e,tt,et,S,{size:0,strokeWidth:1,class:2})}}function rt(e){let t,n,r,i,o;return{c(){t=P("svg"),n=P("path"),r=P("line"),i=P("line"),z(n,"d","M21 4H8l-7 8 7 8h13a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2z"),z(r,"x1","18"),z(r,"y1","9"),z(r,"x2","12"),z(r,"y2","15"),z(i,"x1","12"),z(i,"y1","9"),z(i,"x2","18"),z(i,"y2","15"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",o="feather feather-delete "+e[2])},m(e,o){x(e,t,o),D(t,n),D(t,r),D(t,i)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-delete "+e[2])&&z(t,"class",o)},i:_,o:_,d(e){e&&k(t)}}}function it(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class ot extends xe{constructor(e){super(),De(this,e,it,rt,S,{size:0,strokeWidth:1,class:2})}}function st(e){let t,n,r,i,o;return{c(){t=P("svg"),n=P("path"),r=P("polyline"),i=P("line"),z(n,"d","M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"),z(r,"points","15 3 21 3 21 9"),z(i,"x1","10"),z(i,"y1","14"),z(i,"x2","21"),z(i,"y2","3"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",o="feather feather-external-link "+e[2])},m(e,o){x(e,t,o),D(t,n),D(t,r),D(t,i)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-external-link "+e[2])&&z(t,"class",o)},i:_,o:_,d(e){e&&k(t)}}}function at(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class lt extends xe{constructor(e){super(),De(this,e,at,st,S,{size:0,strokeWidth:1,class:2})}}function ct(e){let t,n,r,i,o,s;return{c(){t=P("svg"),n=P("path"),r=P("polyline"),i=P("line"),o=P("line"),z(n,"d","M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"),z(r,"points","14 2 14 8 20 8"),z(i,"x1","12"),z(i,"y1","18"),z(i,"x2","12"),z(i,"y2","12"),z(o,"x1","9"),z(o,"y1","15"),z(o,"x2","15"),z(o,"y2","15"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",s="feather feather-file-plus "+e[2])},m(e,s){x(e,t,s),D(t,n),D(t,r),D(t,i),D(t,o)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&s!==(s="feather feather-file-plus "+e[2])&&z(t,"class",s)},i:_,o:_,d(e){e&&k(t)}}}function dt(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class ut extends xe{constructor(e){super(),De(this,e,dt,ct,S,{size:0,strokeWidth:1,class:2})}}function ft(e){let t,n,r,i,o;return{c(){t=P("svg"),n=P("circle"),r=P("line"),i=P("path"),z(n,"cx","12"),z(n,"cy","12"),z(n,"r","10"),z(r,"x1","2"),z(r,"y1","12"),z(r,"x2","22"),z(r,"y2","12"),z(i,"d","M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",o="feather feather-globe "+e[2])},m(e,o){x(e,t,o),D(t,n),D(t,r),D(t,i)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-globe "+e[2])&&z(t,"class",o)},i:_,o:_,d(e){e&&k(t)}}}function ht(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class mt extends xe{constructor(e){super(),De(this,e,ht,ft,S,{size:0,strokeWidth:1,class:2})}}function pt(e){let t,n,r,i,o,s,a,l;return{c(){t=P("svg"),n=P("line"),r=P("line"),i=P("line"),o=P("line"),s=P("line"),a=P("line"),z(n,"x1","8"),z(n,"y1","6"),z(n,"x2","21"),z(n,"y2","6"),z(r,"x1","8"),z(r,"y1","12"),z(r,"x2","21"),z(r,"y2","12"),z(i,"x1","8"),z(i,"y1","18"),z(i,"x2","21"),z(i,"y2","18"),z(o,"x1","3"),z(o,"y1","6"),z(o,"x2","3.01"),z(o,"y2","6"),z(s,"x1","3"),z(s,"y1","12"),z(s,"x2","3.01"),z(s,"y2","12"),z(a,"x1","3"),z(a,"y1","18"),z(a,"x2","3.01"),z(a,"y2","18"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",l="feather feather-list "+e[2])},m(e,l){x(e,t,l),D(t,n),D(t,r),D(t,i),D(t,o),D(t,s),D(t,a)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&l!==(l="feather feather-list "+e[2])&&z(t,"class",l)},i:_,o:_,d(e){e&&k(t)}}}function gt(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class wt extends xe{constructor(e){super(),De(this,e,gt,pt,S,{size:0,strokeWidth:1,class:2})}}function yt(e){let t,n,r,i;return{c(){t=P("svg"),n=P("path"),r=P("polyline"),z(n,"d","M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"),z(r,"points","22,6 12,13 2,6"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",i="feather feather-mail "+e[2])},m(e,i){x(e,t,i),D(t,n),D(t,r)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-mail "+e[2])&&z(t,"class",i)},i:_,o:_,d(e){e&&k(t)}}}function vt(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class $t extends xe{constructor(e){super(),De(this,e,vt,yt,S,{size:0,strokeWidth:1,class:2})}}function It(e){let t,n,r,i;return{c(){t=P("svg"),n=P("path"),r=P("circle"),z(n,"d","M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"),z(r,"cx","12"),z(r,"cy","10"),z(r,"r","3"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",i="feather feather-map-pin "+e[2])},m(e,i){x(e,t,i),D(t,n),D(t,r)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-map-pin "+e[2])&&z(t,"class",i)},i:_,o:_,d(e){e&&k(t)}}}function _t(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class Ct extends xe{constructor(e){super(),De(this,e,_t,It,S,{size:0,strokeWidth:1,class:2})}}function Et(e){let t,n,r,i,o;return{c(){t=P("svg"),n=P("polyline"),r=P("line"),i=P("path"),z(n,"points","23 7 23 1 17 1"),z(r,"x1","16"),z(r,"y1","8"),z(r,"x2","23"),z(r,"y2","1"),z(i,"d","M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",o="feather feather-phone-outgoing "+e[2])},m(e,o){x(e,t,o),D(t,n),D(t,r),D(t,i)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-phone-outgoing "+e[2])&&z(t,"class",o)},i:_,o:_,d(e){e&&k(t)}}}function At(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class bt extends xe{constructor(e){super(),De(this,e,At,Et,S,{size:0,strokeWidth:1,class:2})}}function St(e){let t,n,r,i,o;return{c(){t=P("svg"),n=P("rect"),r=P("line"),i=P("line"),z(n,"x","3"),z(n,"y","3"),z(n,"width","18"),z(n,"height","18"),z(n,"rx","2"),z(n,"ry","2"),z(r,"x1","12"),z(r,"y1","8"),z(r,"x2","12"),z(r,"y2","16"),z(i,"x1","8"),z(i,"y1","12"),z(i,"x2","16"),z(i,"y2","12"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",o="feather feather-plus-square "+e[2])},m(e,o){x(e,t,o),D(t,n),D(t,r),D(t,i)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-plus-square "+e[2])&&z(t,"class",o)},i:_,o:_,d(e){e&&k(t)}}}function Nt(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class Tt extends xe{constructor(e){super(),De(this,e,Nt,St,S,{size:0,strokeWidth:1,class:2})}}function Rt(e){let t,n,r,i,o;return{c(){t=P("svg"),n=P("polyline"),r=P("path"),i=P("rect"),z(n,"points","6 9 6 2 18 2 18 9"),z(r,"d","M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"),z(i,"x","6"),z(i,"y","14"),z(i,"width","12"),z(i,"height","8"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",o="feather feather-printer "+e[2])},m(e,o){x(e,t,o),D(t,n),D(t,r),D(t,i)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-printer "+e[2])&&z(t,"class",o)},i:_,o:_,d(e){e&&k(t)}}}function Dt(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class xt extends xe{constructor(e){super(),De(this,e,Dt,Rt,S,{size:0,strokeWidth:1,class:2})}}function kt(e){let t,n,r,i;return{c(){t=P("svg"),n=P("circle"),r=P("line"),z(n,"cx","11"),z(n,"cy","11"),z(n,"r","8"),z(r,"x1","21"),z(r,"y1","21"),z(r,"x2","16.65"),z(r,"y2","16.65"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",i="feather feather-search "+e[2])},m(e,i){x(e,t,i),D(t,n),D(t,r)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-search "+e[2])&&z(t,"class",i)},i:_,o:_,d(e){e&&k(t)}}}function Ot(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class Mt extends xe{constructor(e){super(),De(this,e,Ot,kt,S,{size:0,strokeWidth:1,class:2})}}const{document:Pt}=Ee;function Bt(e){e[53]=e[54].items}function Lt(e,t,n){const r=e.slice();return r[55]=t[n],r[57]=n,r}function Ft(e,t,n){const r=e.slice();return r[58]=t[n],r}function Vt(e,t,n){const r=e.slice();return r[58]=t[n],r}function Ut(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Wt(e){let t,n,r,i,o,s;Bt(e);let a=e[5]?.length&&zt(e),l=e[53]?.length&&jt(e),c=e[5]?.length&&Xt(e);return{c(){a&&a.c(),t=L(),n=M("div"),r=M("table"),l&&l.c(),i=L(),o=M("tbody"),c&&c.c(),z(r,"striped",""),z(r,"class","svelte-47aais"),z(n,"class","eList svelte-47aais")},m(e,d){a&&a.m(e,d),x(e,t,d),x(e,n,d),D(n,r),l&&l.m(r,null),D(r,i),D(r,o),c&&c.m(o,null),s=!0},p(e,n){Bt(e),e[5]?.length?a?(a.p(e,n),32&n[0]&&$e(a,1)):(a=zt(e),a.c(),$e(a,1),a.m(t.parentNode,t)):a&&(ye(),Ie(a,1,1,()=>{a=null}),ve()),e[53]?.length?l?l.p(e,n):(l=jt(e),l.c(),l.m(r,i)):l&&(l.d(1),l=null),e[5]?.length?c?(c.p(e,n),32&n[0]&&$e(c,1)):(c=Xt(e),c.c(),$e(c,1),c.m(o,null)):c&&(ye(),Ie(c,1,1,()=>{c=null}),ve())},i(e){s||($e(a),$e(c),s=!0)},o(e){Ie(a),Ie(c),s=!1},d(e){a&&a.d(e),e&&k(t),e&&k(n),l&&l.d(),c&&c.d()}}}function zt(e){let t,n,r,i,o,s,a,l,c,d,u,f=e[6]&&Ht(e);function h(t){e[34](t)}let m={id:e[11]};return void 0!==e[3]&&(m.value=e[3]),i=new e[8]({props:m}),re.push(()=>Se(i,"value",h)),i.$on("input",e[15]),l=new ot({props:{size:"18"}}),{c(){f&&f.c(),t=L(),n=M("div"),r=B("Suchen: "),Ne(i.$$.fragment),s=L(),a=M("span"),Ne(l.$$.fragment),z(a,"class","feather pointer svelte-47aais"),q(n,"margin-bottom","1em"),q(n,"position","relative")},m(o,h){f&&f.m(o,h),x(o,t,h),x(o,n,h),D(n,r),Te(i,n,null),D(n,s),D(n,a),Te(l,a,null),c=!0,d||(u=V(a,"click",e[17]),d=!0)},p(e,n){e[6]?f?64&n[0]&&$e(f,1):(f=Ht(e),f.c(),$e(f,1),f.m(t.parentNode,t)):f&&(ye(),Ie(f,1,1,()=>{f=null}),ve());const r={};!o&&8&n[0]&&(o=!0,r.value=e[3],ue(()=>o=!1)),i.$set(r)},i(e){c||($e(f),$e(i.$$.fragment,e),$e(l.$$.fragment,e),c=!0)},o(e){Ie(f),Ie(i.$$.fragment,e),Ie(l.$$.fragment,e),c=!1},d(e){f&&f.d(e),e&&k(t),e&&k(n),Re(i),Re(l),d=!1,u()}}}function Ht(e){let t,n;return t=new e[7]({}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function jt(e){let t,n,r,i=e[4]&&e[0]&&qt(),o=e[53],s=[];for(let t=0;t<o.length;t+=1)s[t]=Gt(Vt(e,o,t));return{c(){t=M("thead"),n=M("tr"),i&&i.c(),r=L();for(let e=0;e<s.length;e+=1)s[e].c();z(n,"class","svelte-47aais"),z(t,"class","svelte-47aais")},m(e,o){x(e,t,o),D(t,n),i&&i.m(n,null),D(n,r);for(let e=0;e<s.length;e+=1)s[e].m(n,null)},p(e,t){if(e[4]&&e[0]?i||(i=qt(),i.c(),i.m(n,r)):i&&(i.d(1),i=null),16388&t[0]){let r;for(o=e[53],r=0;r<o.length;r+=1){const i=Vt(e,o,r);s[r]?s[r].p(i,t):(s[r]=Gt(i),s[r].c(),s[r].m(n,null))}for(;r<s.length;r+=1)s[r].d(1);s.length=o.length}},d(e){e&&k(t),i&&i.d(),O(s,e)}}}function qt(e){let t;return{c(){t=M("th"),z(t,"class","svelte-47aais")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Gt(e){let t,n,r=e[58]?.designation+"";return{c(){t=M("th"),n=B(r),z(t,"class","svelte-47aais")},m(e,r){x(e,t,r),D(t,n)},p(e,t){4&t[0]&&r!==(r=e[58]?.designation+"")&&H(n,r)},d(e){e&&k(t)}}}function Xt(e){let t,n,r=[],i=new Map,o=e[5];const s=e=>e[55].index||e[55]?._id;for(let t=0;t<o.length;t+=1){let n=Lt(e,o,t),a=s(n);i.set(a,r[t]=Qt(a,n))}return{c(){for(let e=0;e<r.length;e+=1)r[e].c();t=F()},m(e,i){for(let t=0;t<r.length;t+=1)r[t].m(e,i);x(e,t,i),n=!0},p(e,n){356415&n[0]&&(o=e[5],ye(),r=be(r,n,s,1,e,o,i,t.parentNode,Ae,Qt,t,Lt),ve())},i(e){if(!n){for(let e=0;e<o.length;e+=1)$e(r[e]);n=!0}},o(e){for(let e=0;e<r.length;e+=1)Ie(r[e]);n=!1},d(e){for(let t=0;t<r.length;t+=1)r[t].d(e);e&&k(t)}}}function Yt(e){let t,n,r,i,o,s,a=e[4]&&e[0]&&Zt(e),l=e[53],c=[];for(let t=0;t<l.length;t+=1)c[t]=Kt(Ft(e,l,t));return{c(){t=M("tr"),a&&a.c(),n=L();for(let e=0;e<c.length;e+=1)c[e].c();r=L(),z(t,"class","pointer svelte-47aais"),G(t,"active",e[55]._id===e[1]),G(t,"blocked",!!e[55].blocked),G(t,"undeliverable",!!e[55].undeliverable)},m(l,d){x(l,t,d),a&&a.m(t,null),D(t,n);for(let e=0;e<c.length;e+=1)c[e].m(t,null);D(t,r),i=!0,o||(s=V(t,"click",W(function(){b(e[13](e[55],e[57]))&&e[13](e[55],e[57]).apply(this,arguments)})),o=!0)},p(i,o){if((e=i)[4]&&e[0]?a?(a.p(e,o),17&o[0]&&$e(a,1)):(a=Zt(e),a.c(),$e(a,1),a.m(t,n)):a&&(ye(),Ie(a,1,1,()=>{a=null}),ve()),20516&o[0]){let n;for(l=e[53],n=0;n<l.length;n+=1){const i=Ft(e,l,n);c[n]?c[n].p(i,o):(c[n]=Kt(i),c[n].c(),c[n].m(t,r))}for(;n<c.length;n+=1)c[n].d(1);c.length=l.length}34&o[0]&&G(t,"active",e[55]._id===e[1]),32&o[0]&&G(t,"blocked",!!e[55].blocked),32&o[0]&&G(t,"undeliverable",!!e[55].undeliverable)},i(e){i||($e(a),i=!0)},o(e){Ie(a),i=!1},d(e){e&&k(t),a&&a.d(),O(c,e),o=!1,s()}}}function Zt(e){let t,n,r,i,o;return n=new lt({props:{size:"18"}}),{c(){t=M("td"),Ne(n.$$.fragment),z(t,"class","editRow svelte-47aais"),q(t,"color","#326173")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",W(function(){b(e[18](e[55]))&&e[18](e[55]).apply(this,arguments)})),i=!0)},p(t,n){e=t},i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function Kt(e){let t,n,r,i=e[12](e[55],e[58])+"";return{c(){t=M("td"),n=B(i),z(t,"class",r=T(e[58].type)+" svelte-47aais")},m(e,r){x(e,t,r),D(t,n)},p(e,o){36&o[0]&&i!==(i=e[12](e[55],e[58])+"")&&H(n,i),4&o[0]&&r!==(r=T(e[58].type)+" svelte-47aais")&&z(t,"class",r)},d(e){e&&k(t)}}}function Qt(e,t){let n,r,i,o=t[16](t[55],t[53],t[3]),s=o&&Yt(t);return{key:e,first:null,c(){n=F(),s&&s.c(),r=F(),this.first=n},m(e,t){x(e,n,t),s&&s.m(e,t),x(e,r,t),i=!0},p(e,n){t=e,44&n[0]&&(o=t[16](t[55],t[53],t[3])),o?s?(s.p(t,n),44&n[0]&&$e(s,1)):(s=Yt(t),s.c(),$e(s,1),s.m(r.parentNode,r)):s&&(ye(),Ie(s,1,1,()=>{s=null}),ve())},i(e){i||($e(s),i=!0)},o(e){Ie(s),i=!1},d(e){e&&k(n),s&&s.d(e),e&&k(r)}}}function Jt(e){let t,n;return t=new e[7]({}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p:_,i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function en(e){let t,n,r,i={ctx:e,current:null,token:null,hasCatch:!1,pending:Jt,then:Wt,catch:Ut,value:54,blocks:[,,,]};return _e(n=e[2]&&e[14](),i),{c(){t=F(),i.block.c()},m(e,n){x(e,t,n),i.block.m(e,i.anchor=n),i.mount=()=>t.parentNode,i.anchor=t,r=!0},p(t,r){e=t,i.ctx=e,4&r[0]&&n!==(n=e[2]&&e[14]())&&_e(n,i)||Ce(i,e,r)},i(e){r||($e(i.block),r=!0)},o(e){for(let e=0;e<3;e+=1){Ie(i.blocks[e])}r=!1},d(e){e&&k(t),i.block.d(e),i.token=null,i=null}}}const tn=e("getDisplayItems",async(e,n,r)=>{if(!e)return;let i=[];for(const o of e){if("_total"===o){i.push({name:"_total",designation:"Betrag",type:"number"});continue}if("__total"===o){i.push({name:"__total",designation:"Total CHF",type:"number",decimals:2});continue}const[e,s]=o.split(".");let a=n.list?.find(t=>t.name===e)?.item?.find(e=>e.name===s);if(a&&(a={...a},a.name=`${e}_${s}`,r=r.map(t=>(t[e]&&(t[a.name]=t["_"+e]?t["_"+e][s]:t[e][s]),t))),o.endsWith("_from")||o.endsWith("_to")){const t=a=n.items.find(t=>t.name===e.split("_")[0]);t&&(a={name:o,designation:t.designation,type:"date",decimals:0})}if(a||(a=n.items.find(t=>t.name===e)),!a){const n=await t.getSchemaByClass(e),r=n.items?.find(e=>e.name===s);r&&(a={name:e,designation:r.designation,type:r.type,decimals:r.properties?.decimals||0})}i.find(t=>t?.name===e)||i.push(a)}return i.length?i:n.items});function nn(e,o,s){let a,l,d;N(e,i,e=>s(40,l=e));let f=JSON.parse(n.getItem("Locale")).id;const h=ee(),{Loading:p,TextField:g}=c,{currentTasks:y,loggedIn:v}=u;N(e,y,e=>s(39,a=e)),N(e,v,e=>s(41,d=e));let $,I,_,C,E,{inputList:A}=o,{eventId:b}=o,{prevEventId:S}=o,{record:T}=o,{className:R}=o,{rowId:D}=o,{filterForReady:x=!1}=o,{filter:k}=o,{query:O}=o,{refStatus:M}=o,{showEdit:P=!1}=o,{praefix:B=""}=o,{selectionFields:L=!1}=o,{deList:F}=o,{stopAggregation:V=!1}=o,{shouldBlock:U}=o,{inputSearch:W=""}=o,z=!0,H=W,j=R+Math.floor(9e3*Math.random()+1e3).toString()+"search",q=!1,G=!0;const X=(e,t)=>{if(!t)return;let n=e[t.name];if("__total"===t.name&&void 0===n&&(n=1.081*e._total),!n&&t.name.includes("_")&&!t.name.startsWith("_")&&!t.name.endsWith("_from")&&!t.name.endsWith("_to")){const[r,i]=t.name.split("_");try{n=e[r][i]}catch{}}if(Array.isArray(n)){const e=e=>e.replaceAll(" ",String.fromCharCode(160));if(n.length&&Array.isArray(n[0].serialno)){let t=[];for(const r of n)t=t.concat(r.serialno.map(e));n=t.join(", ")}else n=n.map(e),n.length>3&&(n=n.slice(0,3),n=n.concat("...")),n=n.join(", ")}if(!n&&t.name.split("_").length>1){const[r,i]=t.name.split("_");try{n=e[r][0][i],Array.isArray(n)&&(n=n.join(", "))}catch{}}return"number"===t.type&&(n||(n=e[`_${t.name}`]),n=Number(n)?Number(n).toLocaleString(f,{minimumFractionDigits:t.properties?.decimals||t.decimals||0,maximumFractionDigits:t.properties?.decimals||t.decimals||0}):""),"boolean"===t.type&&"Aktiv"===n&&(n=!1),"number"===t.type?n:"boolean"==typeof n||"boolean"===t.type?w(n):m(e[`_${t.name}`]||n||"")},Y=t.getSchemaByClass(R),Z=async(e,n)=>{if(!e)return[];if(k){let n=k;const r=k.startsWith("!");r&&(n=k.replace("!",""));const i=k.startsWith("$");if(n&&!i&&(e=e.filter(e=>r?!e[n]:!!e[n])),i){n=k.replace("$","");const[r,i]=n.split(".");if(T[i]){const n=await t.getSectionView(r,{[i]:T[i]});e=e.filter(e=>n.find(t=>t._id==e[r]))}else e=[]}}if(M&&!O)return s(19,M=[].concat(M)),e.filter(e=>!!M.find(t=>e._task.status===t));if("Information"===n.state.task)return e;if(S){const n=await t.getEvent(S);if("report"===n?.output?.type)return e;if(n?.input?.class?.length&&n.input.class[0].name===R)return"Information"===n.state.task?e.filter(e=>"Closed"!==e._task.status):e.filter(e=>"Ready"===e._task.status)}return e.filter(e=>"WaitingForApproval"===e._task.status||"Ready"===e._task.status||"Closing"===e._task.status)},K=(e,t)=>{if(e){let n,r="1";if("string"==typeof e)n=e;else{const t=Object.keys(e);n=t[0],r=e[t[0]]}"date"===n&&(r="-1");const i=new Intl.Collator(f,{numeric:!0});return 1==+r?t.sort((e,t)=>i.compare(e[n],t[n])):t.sort((e,t)=>i.compare(t[n],e[n]))}return t},J=async e=>{let n,r=0;G=!1;const i=e=>new Promise(t=>setTimeout(t,e)),o=await Y;for(;r++<200&&!V&&!(n=await te(e,o.id));)await i(500);s(6,q=!1),V&&t.readTasksByAggregationId(e,!0),n&&(s(5,_=K(I.displaySort,n.data)),window.setTimeout(()=>{const e=document.querySelector("tr.active");e&&e.scrollIntoView({block:"end",behavior:"smooth"}),G=!0,document.getElementById(j)?.focus()},100))},te=async(e,n)=>await t.readTasksByAggregationId(e,!1,n),ne=async(e,t,n,r)=>{const{value:i,refClass:o}=r,[s,a]=n.split("."),l=i?.get(B),c=l&&await xp(s,l);if(!c)return e;const d=c[a];return d?.length?d.map(n=>{let r=e?.find(e=>e._id===n[t])||{};r={...r};for(const e in r)n[e]&&(r[e]=n[e]);for(const e in n)n[e]&&(r[e]=n[e]);return Rp(o+r._id.toString(),r),r}):e};Q(()=>{window.setTimeout(()=>{const e=document.querySelector("tr.active");e&&e.scrollIntoView({block:"end",behavior:"smooth"}),document.getElementById(j)?.focus()},200)}),r.subscribe(async e=>{if(!e)return;const t=await Y;e.eventId===t.id&&(kp(t.class,e.eventId),s(2,z=!s(2,z=!1)))});return e.$$set=e=>{"inputList"in e&&s(21,A=e.inputList),"eventId"in e&&s(22,b=e.eventId),"prevEventId"in e&&s(23,S=e.prevEventId),"record"in e&&s(24,T=e.record),"className"in e&&s(25,R=e.className),"rowId"in e&&s(1,D=e.rowId),"filterForReady"in e&&s(26,x=e.filterForReady),"filter"in e&&s(27,k=e.filter),"query"in e&&s(28,O=e.query),"refStatus"in e&&s(19,M=e.refStatus),"showEdit"in e&&s(0,P=e.showEdit),"praefix"in e&&s(29,B=e.praefix),"selectionFields"in e&&s(30,L=e.selectionFields),"deList"in e&&s(31,F=e.deList),"stopAggregation"in e&&s(20,V=e.stopAggregation),"shouldBlock"in e&&s(32,U=e.shouldBlock),"inputSearch"in e&&s(33,W=e.inputSearch)},[P,D,z,H,$,_,q,p,g,y,v,j,X,(e,t)=>n=>{s(20,V=!0);const r=G?e:C[t];h("choose",{row:r})},async()=>{I=await Y,s(4,$=(e=>!a?.length||!!a.find(t=>t===e))(I.id)),O&&s(5,_=C=await t.getTasksFiltered(I.class,O)),_||s(5,_=C=K(I.displaySort,await A||await Np(I.class,I.id))),500!==_?.length||O||(s(6,q=!0),await t.getTasksList(I.id,!1,!0).then(({aggregationId:e})=>J(e)));let e,n=!1,r="";const i=L&&L?.find(e=>I.class===e.refClass.split(":")[0]),o=i?.value?.get&&i.value.get(B);if(o){const[a,l]=i.refClass.split(":");I.class===a&&s(5,_=await ne(_,a,l,i)),n=i.parentClass?.find(e=>"quantity"===e.name),r=i.className,e=await t.getCountedSection(r,l.split(".")[0],o,a,"quantity")}s(0,P&&=!i),!i&&(k||x||M)&&s(5,_=await Z(_,I)),E=I.authorization?.find(e=>"employee"===e.constraint)&&!l.some(e=>I.authorization?.find(t=>t.role===e&&"employee"!==t.constraint));const{display:c}=I;let u=await tn(c,I,_);if(!P&&n?(u=u.concat([{name:"quantity",designation:"h-Soll",type:"number",decimals:2},{name:"ist",designation:"h-Ist",type:"number",decimals:2}]),s(5,_=_.map((t,n)=>{const r=e.find(e=>e._id===t._id);return r&&(t.ist=r.quantity.$numberDecimal),t.index=n,t})),e.map(e=>{if(!_.find(t=>t._id===e._id)){const t=C.find(t=>t._id===e._id);t&&(t.ist=e.quantity.$numberDecimal),_.push(t)}}),h("init",_)):F&&s(5,_=_.filter(e=>!F.find(t=>t?._id===e._id))),U&&s(5,_=_.filter(e=>!e[U])),E){const e={businessEmail:d.user},n=await t.getSectionView("employee",e);s(5,_=n?.length?_.filter(e=>e.employee===n[0]._id):[])}return{items:u}},({detail:{value:e}})=>{s(3,H=e)},(e,t,n)=>{if(!e)return!1;if(!n)return!0;"string"!=typeof n&&(n=n.toString()),n=n.toLowerCase();let r=!1;for(const i of t){const t=X(e,i).toLowerCase();!r&&t.includes(n)&&(r=!0)}return r},()=>{s(3,H="")},async e=>{let t=e._task;t||(t=await Tp(R,"",e._id,!0),t=t._task),window.open(`/task/${t.event}/${t.task_id||t._id}/task?view=standalone`,"_blank")},M,V,A,b,S,T,R,x,k,O,B,L,F,U,W,function(e){H=e,s(3,H)}]}class rn extends xe{constructor(e){var t;super(),Pt.getElementById("svelte-47aais-style")||((t=M("style")).id="svelte-47aais-style",t.textContent=".feather.svelte-47aais.svelte-47aais{position:absolute;top:2em;right:0.5em;color:#326173}.eList.svelte-47aais.svelte-47aais{height:fit-content;max-height:65vh;overflow-y:scroll;overflow-x:auto}.eList.svelte-47aais .editRow.svelte-47aais{width:1em}.eList.svelte-47aais table.svelte-47aais{min-width:30vw;position:relative;width:max-content !important;max-width:50vh !important}.eList.svelte-47aais table thead.svelte-47aais{position:sticky;top:0;background:#326173;color:white}.eList.svelte-47aais table thead tr.svelte-47aais{height:2.3em}.eList.svelte-47aais table tbody tr.svelte-47aais{height:2.75em !important}th.svelte-47aais.svelte-47aais,td.svelte-47aais.svelte-47aais{padding-left:0.4em;padding-right:0.4em}td.number.svelte-47aais.svelte-47aais{text-align:end}tr.pointer.svelte-47aais.svelte-47aais:hover{background-color:#DAE1E5}tr.active.svelte-47aais.svelte-47aais{color:#326173;background-color:#fcebd5}tr.blocked.svelte-47aais.svelte-47aais{color:red !important}tr.undeliverable.svelte-47aais.svelte-47aais{color:orange}",D(Pt.head,t)),De(this,e,nn,en,S,{inputList:21,eventId:22,prevEventId:23,record:24,className:25,rowId:1,filterForReady:26,filter:27,query:28,refStatus:19,showEdit:0,praefix:29,selectionFields:30,deList:31,stopAggregation:20,shouldBlock:32,inputSearch:33},[-1,-1,-1])}}function on(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function sn(e){let t,n,r=e[45]&&an(e);return{c(){r&&r.c(),t=F()},m(e,i){r&&r.m(e,i),x(e,t,i),n=!0},p(e,n){e[45]?r?(r.p(e,n),16&n[0]&&$e(r,1)):(r=an(e),r.c(),$e(r,1),r.m(t.parentNode,t)):r&&(ye(),Ie(r,1,1,()=>{r=null}),ve())},i(e){n||($e(r),n=!0)},o(e){Ie(r),n=!1},d(e){r&&r.d(e),e&&k(t)}}}function an(e){let t,n;return t=new e[25]({props:{title:e[20]?"Auswahl":e[0],class:"eList "+(e[18]?"form":""),$$slots:{default:[wn]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};1048577&n[0]&&(r.title=e[20]?"Auswahl":e[0]),262144&n[0]&&(r.class="eList "+(e[18]?"form":"")),33554430&n[0]|32768&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function ln(e){let t,n;return t=new Fp({props:{schema:e[2],recID:e[1],readonly:e[19]}}),t.$on("choose",function(){b(e[34](e[45]))&&e[34](e[45]).apply(this,arguments)}),t.$on("back",e[31]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(n,r){e=n;const i={};4&r[0]&&(i.schema=e[2]),2&r[0]&&(i.recID=e[1]),524288&r[0]&&(i.readonly=e[19]),t.$set(i)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function cn(e){let t,n,r,i,o,s,a;t=new e[26]({props:{text:e[20]?"Zusätzliche Auswahl":""}});const l=[un,dn],c=[];function d(e,t){return e[20]?0:1}return r=d(e),i=c[r]=l[r](e),s=new rn({props:{inputSearch:e[15],record:e[3],eventId:e[2].id,className:e[2].class,prevEventId:e[14],filterForReady:e[5],filter:e[6],query:e[7],refStatus:e[8],praefix:e[9],selectionFields:e[10],rowId:e[1],shouldBlock:e[16],deList:e[12],stopAggregation:e[24],showEdit:e[11]}}),s.$on("edit",e[35]),s.$on("choose",e[38]),s.$on("init",e[36]),{c(){Ne(t.$$.fragment),n=L(),i.c(),o=L(),Ne(s.$$.fragment)},m(e,i){Te(t,e,i),x(e,n,i),c[r].m(e,i),x(e,o,i),Te(s,e,i),a=!0},p(e,n){const a={};1048576&n[0]&&(a.text=e[20]?"Zusätzliche Auswahl":""),t.$set(a);let u=r;r=d(e),r===u?c[r].p(e,n):(ye(),Ie(c[u],1,1,()=>{c[u]=null}),ve(),i=c[r],i?i.p(e,n):(i=c[r]=l[r](e),i.c()),$e(i,1),i.m(o.parentNode,o));const f={};32768&n[0]&&(f.inputSearch=e[15]),8&n[0]&&(f.record=e[3]),4&n[0]&&(f.eventId=e[2].id),4&n[0]&&(f.className=e[2].class),16384&n[0]&&(f.prevEventId=e[14]),32&n[0]&&(f.filterForReady=e[5]),64&n[0]&&(f.filter=e[6]),128&n[0]&&(f.query=e[7]),256&n[0]&&(f.refStatus=e[8]),512&n[0]&&(f.praefix=e[9]),1024&n[0]&&(f.selectionFields=e[10]),2&n[0]&&(f.rowId=e[1]),65536&n[0]&&(f.shouldBlock=e[16]),4096&n[0]&&(f.deList=e[12]),16777216&n[0]&&(f.stopAggregation=e[24]),2048&n[0]&&(f.showEdit=e[11]),s.$set(f)},i(e){a||($e(t.$$.fragment,e),$e(i),$e(s.$$.fragment,e),a=!0)},o(e){Ie(t.$$.fragment,e),Ie(i),Ie(s.$$.fragment,e),a=!1},d(e){Re(t,e),e&&k(n),c[r].d(e),e&&k(o),Re(s,e)}}}function dn(e){let t,n,r,i;n=new e[27]({props:{outline:!0,$$slots:{default:[fn]},$$scope:{ctx:e}}}),n.$on("click",e[32]);let o=e[29]&&e[13]&&hn(e);return{c(){t=M("div"),Ne(n.$$.fragment),r=L(),o&&o.c(),z(t,"class","form--buttons svelte-jb5mrh")},m(e,s){x(e,t,s),Te(n,t,null),D(t,r),o&&o.m(t,null),i=!0},p(e,r){const i={};32768&r[1]&&(i.$$scope={dirty:r,ctx:e}),n.$set(i),e[29]&&e[13]?o?(o.p(e,r),8192&r[0]&&$e(o,1)):(o=hn(e),o.c(),$e(o,1),o.m(t,null)):o&&(ye(),Ie(o,1,1,()=>{o=null}),ve())},i(e){i||($e(n.$$.fragment,e),$e(o),i=!0)},o(e){Ie(n.$$.fragment,e),Ie(o),i=!1},d(e){e&&k(t),Re(n),o&&o.d()}}}function un(e){let t,n,r,i,o,s,a=e[23]&&pn(e);return r=new e[27]({props:{outline:!0,$$slots:{default:[gn]},$$scope:{ctx:e}}}),r.$on("click",e[32]),o=new e[26]({props:{text:"Liste aus "+e[17]}}),{c(){a&&a.c(),t=L(),n=M("div"),Ne(r.$$.fragment),i=L(),Ne(o.$$.fragment),z(n,"class","form--buttons svelte-jb5mrh")},m(e,l){a&&a.m(e,l),x(e,t,l),x(e,n,l),Te(r,n,null),x(e,i,l),Te(o,e,l),s=!0},p(e,n){e[23]?a?(a.p(e,n),8388608&n[0]&&$e(a,1)):(a=pn(e),a.c(),$e(a,1),a.m(t.parentNode,t)):a&&(ye(),Ie(a,1,1,()=>{a=null}),ve());const i={};32768&n[1]&&(i.$$scope={dirty:n,ctx:e}),r.$set(i);const s={};131072&n[0]&&(s.text="Liste aus "+e[17]),o.$set(s)},i(e){s||($e(a),$e(r.$$.fragment,e),$e(o.$$.fragment,e),s=!0)},o(e){Ie(a),Ie(r.$$.fragment,e),Ie(o.$$.fragment,e),s=!1},d(e){a&&a.d(e),e&&k(t),e&&k(n),Re(r),e&&k(i),Re(o,e)}}}function fn(e){let t;return{c(){t=B("Abbrechen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function hn(e){let t,n;return t=new e[27]({props:{filled:!0,$$slots:{default:[mn]},$$scope:{ctx:e}}}),t.$on("click",e[33]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};32768&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function mn(e){let t;return{c(){t=B("Neu")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function pn(e){let t,n;return t=new Su({props:{item:e[21],record:{_id:"",[e[21].name]:""},noForm:"true",classId:"sel_"+e[21].name,eventId:e[22],required:!1,hidden:!1,readonly:!1,deList:e[23]}}),t.$on("notify",e[37]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};2097152&n[0]&&(r.item=e[21]),2097152&n[0]&&(r.record={_id:"",[e[21].name]:""}),2097152&n[0]&&(r.classId="sel_"+e[21].name),4194304&n[0]&&(r.eventId=e[22]),8388608&n[0]&&(r.deList=e[23]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function gn(e){let t;return{c(){t=B("Abbrechen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function wn(e){let t,n,r,i;const o=[cn,ln],s=[];function a(e,t){return e[45].length&&!e[18]?0:1}return t=a(e),n=s[t]=o[t](e),{c(){n.c(),r=F()},m(e,n){s[t].m(e,n),x(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?s[t].p(e,i):(ye(),Ie(s[l],1,1,()=>{s[l]=null}),ve(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),$e(n,1),n.m(r.parentNode,r))},i(e){i||($e(n),i=!0)},o(e){Ie(n),i=!1},d(e){s[t].d(e),e&&k(r)}}}function yn(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function vn(e){let t,n,r,i={ctx:e,current:null,token:null,hasCatch:!1,pending:yn,then:sn,catch:on,value:45,blocks:[,,,]};return _e(n=e[30](e[4]),i),{c(){t=F(),i.block.c()},m(e,n){x(e,t,n),i.block.m(e,i.anchor=n),i.mount=()=>t.parentNode,i.anchor=t,r=!0},p(t,r){e=t,i.ctx=e,16&r[0]&&n!==(n=e[30](e[4]))&&_e(n,i)||Ce(i,e,r)},i(e){r||($e(i.block),r=!0)},o(e){for(let e=0;e<3;e+=1){Ie(i.blocks[e])}r=!1},d(e){e&&k(t),i.block.d(e),i.token=null,i=null}}}function $n(e,n,r){let i;const{Dialog:o,Divider:s,Button:a}=c,l=ee(),{currentTasks:d}=u;N(e,d,e=>r(41,i=e));let{title:f}=n,{schema:h}=n,{record:m}=n,{recID:p}=n,{isOpening:g=!0}=n,{filterForReady:w=!1}=n,{filter:y}=n,{query:v}=n,{refStatus:$}=n,{praefix:I=""}=n,{selectionFields:_=!1}=n,{showEdit:C=!0}=n,{deList:E}=n,{newAllowed:A=!0}=n,{prevEventId:b}=n,{inputSearch:S}=n,{shouldBlock:T}=n,R=h.id;h.class;let D,x,k,O,M,P,B,L="",F=!1,V=!1;f??=h.identity.designation;const U=!i?.length||i.find(e=>e===R);return e.$$set=e=>{"title"in e&&r(0,f=e.title),"schema"in e&&r(2,h=e.schema),"record"in e&&r(3,m=e.record),"recID"in e&&r(1,p=e.recID),"isOpening"in e&&r(4,g=e.isOpening),"filterForReady"in e&&r(5,w=e.filterForReady),"filter"in e&&r(6,y=e.filter),"query"in e&&r(7,v=e.query),"refStatus"in e&&r(8,$=e.refStatus),"praefix"in e&&r(9,I=e.praefix),"selectionFields"in e&&r(10,_=e.selectionFields),"showEdit"in e&&r(11,C=e.showEdit),"deList"in e&&r(12,E=e.deList),"newAllowed"in e&&r(13,A=e.newAllowed),"prevEventId"in e&&r(14,b=e.prevEventId),"inputSearch"in e&&r(15,S=e.inputSearch),"shouldBlock"in e&&r(16,T=e.shouldBlock)},[f,p,h,m,g,w,y,v,$,I,_,C,E,A,b,S,T,L,F,D,k,M,P,B,V,o,s,a,d,U,async e=>{if(!e)return!1;const n=await Np(h.class,h.id);if(x=_&&_?.find(e=>h.class===e.refClass.split(":")[0]),r(20,k=x?.value?.get&&x.value.get(I)),k){O=x.refClass;const[e,n]=O.split(":"),[i]=n.split(".");r(21,M=x.parentClass.find(t=>t.name===e));const o=await t.getSchemaByClass(M.refClass);r(22,P=o.id),r(17,L=x.parentClass.find(e=>e.name===i).designation)}return n},()=>{r(18,F=!1),p||l("back"),C||l("back")},()=>{r(24,V=!0),r(18,F=!1),l("back")},()=>{r(24,V=!0),r(1,p=!1),r(19,D=!1),r(18,F=!0)},e=>({detail:{row:e}})=>{let t=h.display;t&&t.length&&t.map(t=>{const[n,r]=t.split(".");let i=h.list?.find(e=>e.name===n)?.item.find(e=>e.name===r);if(i){e[`${n}_${r}`]=e[n][r]}}),l("choose",{row:e})},({detail:e})=>{r(19,D=!!e._task.visum||"Closed"===e._task.status),r(1,p=e._docId),r(18,F=!0)},({detail:e})=>{k&&r(23,B=e)},({detail:e})=>{if(!e.value)return;const t={_id:e.value};l("choose",{row:t})},function(t){te(e,t)}]}class In extends xe{constructor(e){var t;super(),document.getElementById("svelte-jb5mrh-style")||((t=M("style")).id="svelte-jb5mrh-style",t.textContent=".eList .flex button.btn{width:max-content !important}.dialog.eList{max-height:90vh}.form--buttons.svelte-jb5mrh{display:flex;gap:1em;padding:0.5em 0}",D(document.head,t)),De(this,e,$n,vn,S,{title:0,schema:2,record:3,recID:1,isOpening:4,filterForReady:5,filter:6,query:7,refStatus:8,praefix:9,selectionFields:10,showEdit:11,deList:12,newAllowed:13,prevEventId:14,inputSearch:15,shouldBlock:16},[-1,-1])}}const{document:_n}=Ee;function Cn(e){e[28]=e[30].list,e[29]=e[30].items}function En(e,t,n){const r=e.slice();return r[31]=t[n],r}function An(e,t,n){const r=e.slice();return r[34]=t[n],r}function bn(e,t,n){const r=e.slice();return r[34]=t[n],r}function Sn(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Nn(e){let t,n,r,i,o,s,a,l,c,d,u,f,h,m,p,g,w,y;function v(t){e[25](t)}Cn(e),n=new e[7]({props:{outline:!0,$$slots:{default:[Tn]},$$scope:{ctx:e}}}),n.$on("click",e[24]);let $={id:e[8]};void 0!==e[0]&&($.value=e[0]),s=new e[6]({props:$}),re.push(()=>Se(s,"value",v)),s.$on("input",e[12]),d=new ot({props:{size:"18"}});let I=e[29]?.length&&function(e){let t,n,r,i,o=e[29],s=[];for(let t=0;t<o.length;t+=1)s[t]=Rn(bn(e,o,t));return{c(){t=M("thead"),n=M("tr"),r=M("th"),i=L();for(let e=0;e<s.length;e+=1)s[e].c();z(r,"class","svelte-14hcfjl"),z(n,"class","svelte-14hcfjl"),z(t,"class","svelte-14hcfjl")},m(e,o){x(e,t,o),D(t,n),D(n,r),D(n,i);for(let e=0;e<s.length;e+=1)s[e].m(n,null)},p(e,t){if(2048&t[0]){let r;for(o=e[29],r=0;r<o.length;r+=1){const i=bn(e,o,r);s[r]?s[r].p(i,t):(s[r]=Rn(i),s[r].c(),s[r].m(n,null))}for(;r<s.length;r+=1)s[r].d(1);s.length=o.length}},d(e){e&&k(t),O(s,e)}}}(e),_=e[28]?.length&&function(e){let t,n,r=e[28],i=[];for(let t=0;t<r.length;t+=1)i[t]=kn(En(e,r,t));const o=e=>Ie(i[e],1,1,()=>{i[e]=null});return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=F()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);x(e,t,r),n=!0},p(e,n){if(44547&n[0]){let s;for(r=e[28],s=0;s<r.length;s+=1){const o=En(e,r,s);i[s]?(i[s].p(o,n),$e(i[s],1)):(i[s]=kn(o),i[s].c(),$e(i[s],1),i[s].m(t.parentNode,t))}for(ye(),s=r.length;s<i.length;s+=1)o(s);ve()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)$e(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)Ie(i[e]);n=!1},d(e){O(i,e),e&&k(t)}}}(e);return{c(){t=M("div"),Ne(n.$$.fragment),r=L(),i=M("div"),o=B("Suchen: "),Ne(s.$$.fragment),l=L(),c=M("span"),Ne(d.$$.fragment),u=L(),f=M("div"),h=M("table"),I&&I.c(),m=L(),p=M("tbody"),_&&_.c(),z(t,"class","form--buttons svelte-14hcfjl"),z(c,"class","feather pointer svelte-14hcfjl"),q(i,"margin-bottom","1em"),q(i,"position","relative"),z(h,"striped",""),z(h,"class","svelte-14hcfjl"),z(f,"class","eList svelte-14hcfjl")},m(a,v){x(a,t,v),Te(n,t,null),x(a,r,v),x(a,i,v),D(i,o),Te(s,i,null),D(i,l),D(i,c),Te(d,c,null),x(a,u,v),x(a,f,v),D(f,h),I&&I.m(h,null),D(h,m),D(h,p),_&&_.m(p,null),g=!0,w||(y=V(c,"click",e[14]),w=!0)},p(e,t){Cn(e);const r={};256&t[1]&&(r.$$scope={dirty:t,ctx:e}),n.$set(r);const i={};!a&&1&t[0]&&(a=!0,i.value=e[0],ue(()=>a=!1)),s.$set(i),e[29]?.length&&I.p(e,t),e[28]?.length&&_.p(e,t)},i(e){g||($e(n.$$.fragment,e),$e(s.$$.fragment,e),$e(d.$$.fragment,e),$e(_),g=!0)},o(e){Ie(n.$$.fragment,e),Ie(s.$$.fragment,e),Ie(d.$$.fragment,e),Ie(_),g=!1},d(e){e&&k(t),Re(n),e&&k(r),e&&k(i),Re(s),Re(d),e&&k(u),e&&k(f),I&&I.d(),_&&_.d(),w=!1,y()}}}function Tn(e){let t;return{c(){t=B("Abbrechen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Rn(e){let t,n,r=e[34]?.designation+"";return{c(){t=M("th"),n=B(r),z(t,"class","svelte-14hcfjl")},m(e,r){x(e,t,r),D(t,n)},p:_,d(e){e&&k(t)}}}function Dn(e){let t,n,r,i,o,s,a,l;r=new lt({props:{size:"18"}});let c=e[29],d=[];for(let t=0;t<c.length;t+=1)d[t]=xn(An(e,c,t));return{c(){t=M("tr"),n=M("td"),Ne(r.$$.fragment),i=L();for(let e=0;e<d.length;e+=1)d[e].c();o=L(),z(n,"class","editRow svelte-14hcfjl"),z(t,"class","pointer svelte-14hcfjl"),G(t,"active",e[31]._id===e[1])},m(c,u){x(c,t,u),D(t,n),Te(r,n,null),D(t,i);for(let e=0;e<d.length;e+=1)d[e].m(t,null);D(t,o),s=!0,a||(l=V(n,"click",e[15](e[31])),a=!0)},p(n,r){if(e=n,3584&r[0]){let n;for(c=e[29],n=0;n<c.length;n+=1){const i=An(e,c,n);d[n]?d[n].p(i,r):(d[n]=xn(i),d[n].c(),d[n].m(t,o))}for(;n<d.length;n+=1)d[n].d(1);d.length=c.length}2050&r[0]&&G(t,"active",e[31]._id===e[1])},i(e){s||($e(r.$$.fragment,e),s=!0)},o(e){Ie(r.$$.fragment,e),s=!1},d(e){e&&k(t),Re(r),O(d,e),a=!1,l()}}}function xn(e){let t,n,r,i,o=e[9](e[31],e[34])+"";return{c(){t=M("td"),n=B(o),z(t,"class","svelte-14hcfjl")},m(o,s){x(o,t,s),D(t,n),r||(i=V(t,"click",W(e[10](e[31]))),r=!0)},p(t,n){e=t},d(e){e&&k(t),r=!1,i()}}}function kn(e){let t,n,r=e[13](e[31],e[29],e[0]),i=r&&Dn(e);return{c(){i&&i.c(),t=F()},m(e,r){i&&i.m(e,r),x(e,t,r),n=!0},p(e,n){1&n[0]&&(r=e[13](e[31],e[29],e[0])),r?i?(i.p(e,n),1&n[0]&&$e(i,1)):(i=Dn(e),i.c(),$e(i,1),i.m(t.parentNode,t)):i&&(ye(),Ie(i,1,1,()=>{i=null}),ve())},i(e){n||($e(i),n=!0)},o(e){Ie(i),n=!1},d(e){i&&i.d(e),e&&k(t)}}}function On(e){let t,n;return t=new e[5]({}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p:_,i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Mn(e){let t,n,r,i;t=new e[4]({});let o={ctx:e,current:null,token:null,hasCatch:!1,pending:On,then:Nn,catch:Sn,value:30,blocks:[,,,]};return _e(e[11](),o),{c(){Ne(t.$$.fragment),n=L(),r=F(),o.block.c()},m(e,s){Te(t,e,s),x(e,n,s),x(e,r,s),o.block.m(e,o.anchor=s),o.mount=()=>r.parentNode,o.anchor=r,i=!0},p(t,n){Ce(o,e=t,n)},i(e){i||($e(t.$$.fragment,e),$e(o.block),i=!0)},o(e){Ie(t.$$.fragment,e);for(let e=0;e<3;e+=1){Ie(o.blocks[e])}i=!1},d(e){Re(t,e),e&&k(n),e&&k(r),o.block.d(e),o.token=null,o=null}}}function Pn(e){let t,n;return t=new e[3]({props:{title:"Auswahl",class:"eList",$$slots:{default:[Mn]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};3&n[0]|256&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Bn(e,n,i){const o=ee(),{Dialog:s,Divider:a,Loading:l,TextField:d,Button:u}=c;let{item:f}=n,{classId:h}=n,{className:p}=n,{rowId:g}=n,{viewName:y}=n,{viewValue:v}=n,{recordId:$}=n,{filter:I}=n,{multiValues:_}=n,{searchValue:C=""}=n,E=h+Math.floor(9e3*Math.random()+1e3).toString()+"search";const A=(e,t)=>{if(!t)return;const n=e[t.name];return"boolean"==typeof n?w(n):m(e[`_${t.name}`]||e[t.name]||"")},b=t.getSchemaByClass(p);Q(()=>{window.setTimeout(()=>{const e=document.querySelector("tr.active");e&&e.scrollIntoView({block:"end",behavior:"smooth"}),document.getElementById(E)?.focus()},200)}),r.subscribe(async e=>{if(!e)return;const t=await b;e.eventId===t.id&&kp(t.class,e.eventId)});return e.$$set=e=>{"item"in e&&i(16,f=e.item),"classId"in e&&i(17,h=e.classId),"className"in e&&i(18,p=e.className),"rowId"in e&&i(1,g=e.rowId),"viewName"in e&&i(19,y=e.viewName),"viewValue"in e&&i(20,v=e.viewValue),"recordId"in e&&i(21,$=e.recordId),"filter"in e&&i(22,I=e.filter),"multiValues"in e&&i(23,_=e.multiValues),"searchValue"in e&&i(0,C=e.searchValue)},[C,g,o,s,a,l,d,u,E,A,e=>()=>o("choose",{row:e}),async()=>{const e=await b;let n=[];if(f.lookup){let r,i,o;if("string"==typeof f.lookup){if(r="."+h+"#"+f.lookup,i=document.querySelector(r),o=i?.value||$,_.has(f.lookup)){const r=_.get(f.lookup)[0];n=r?await t.getSectionView(f.name,{[f.lookup]:r},!0):await Np(f.name,e.id)}else if(o&&24===o.toString().length){const e=await xp(f.lookup,o);if(e&&e[f.name]&&e[f.name].length){const r=e[f.name]?.map(e=>e[f.name]);r?.length&&(n=await t.getSectionView(f.name,{_id:{$in:r}},!0)),n?.length||(n=await t.getSectionView(f.refClass,{[f.lookup]:o},!0))}else n=await t.getSectionView(f.refClass,{[f.lookup]:o},!0)}}else{const{refItem:e,refList:s}=f.lookup,[a,l]=e.split(".");if(r="."+h+"#"+a,i=document.querySelector(r),o=i?.value||$,o){let e=await t.getDocById(a,o);if(e&&l&&(e=await t.getDocById(l,e[l])),e&&e[s]){const r=e[s].map(e=>e[f.name]);n=await t.getSectionView(f.name,{_id:{$in:r}},!0)}}}}else{const r="."+h+"#"+y.split(":")[0],i=document.querySelector(r);let o={[y]:i?.value||$};if(f.refItem){const e="."+h+"#"+f.refItem;try{const t=document.querySelector(e);if(t){const e={$or:[{[f.refItem]:t.value},{[f.refItem]:{$exists:!0,$eq:""}}]};o={...o,...e}}}catch{}}o[y]&&(n=await t.getSectionView(e.class,o,!0)),I&&(n=n.filter(e=>e._id!=I))}const r=e.display;return{list:n,items:await tn(r,e,n)}},({detail:{value:e}})=>{i(0,C=e)},(e,t,n)=>{if(!n)return!0;for(const r of t)if(A(e,r)?.toLowerCase()?.includes(n.toLowerCase()))return!0;return!1},()=>{i(0,C="")},e=>async()=>{const n=await t.getTaskByDocId(e._id,!0),r=`/task/${n.event}/${n._id}/task?view=standalone`;window.open(r)},f,h,p,y,v,$,I,_,()=>o("back"),function(e){C=e,i(0,C)}]}class Ln extends xe{constructor(e){var t;super(),_n.getElementById("svelte-14hcfjl-style")||((t=M("style")).id="svelte-14hcfjl-style",t.textContent=".feather.svelte-14hcfjl.svelte-14hcfjl{position:absolute;top:2em;right:0.5em;color:#326173}.eList.svelte-14hcfjl.svelte-14hcfjl{height:fit-content;max-height:65vh;overflow-y:scroll;overflow-x:auto}.eList.svelte-14hcfjl .editRow.svelte-14hcfjl{width:1em}.eList.svelte-14hcfjl table.svelte-14hcfjl{min-width:30vw;position:relative;width:max-content !important;max-width:50vh !important}.eList.svelte-14hcfjl table thead.svelte-14hcfjl{position:sticky;top:0;background:#326173;color:white}.eList.svelte-14hcfjl table tbody tr.svelte-14hcfjl{height:2.3em}th.svelte-14hcfjl.svelte-14hcfjl,td.svelte-14hcfjl.svelte-14hcfjl{padding-left:0.4em;padding-right:0.4em}tr.pointer.svelte-14hcfjl.svelte-14hcfjl:hover{background-color:#DAE1E5}tr.active.svelte-14hcfjl.svelte-14hcfjl{color:#326173;background-color:#fcebd5}.form--buttons.svelte-14hcfjl.svelte-14hcfjl{display:flex;gap:1em;padding:0.5em 0}",D(_n.head,t)),De(this,e,Bn,Pn,S,{item:16,classId:17,className:18,rowId:1,viewName:19,viewValue:20,recordId:21,filter:22,multiValues:23,searchValue:0},[-1,-1])}}const{document:Fn}=Ee;function Vn(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Un(e){let t,n,r=e[83]&&function(e){let t,n,r,i,o,a,l,c,d,u,f,h,m,p,g,w,y,v,$,I;function _(t){e[63](t)}function C(t){e[64](t)}let E={class:"full-width",id:e[34],name:e[34],rows:"1",required:e[2],disabled:e[3]||e[36],placeholder:e[36]?"":e[37],style:"height:2.8em; padding-left:2em;padding-right:2em;overflow-y:hidden; resize:none;"};void 0!==e[1]&&(E.value=e[1]);void 0!==e[27]&&(E.overwrite=e[27]);n=new s({props:E}),re.push(()=>Se(n,"value",_)),re.push(()=>Se(n,"overwrite",C)),n.$on("click",e[40]()),n.$on("blur",e[49]);const A=[Hn,zn,Wn],b=[];function S(e,t){return e[36]?0:!e[3]||e[16]?1:e[22]&&e[0]?2:-1}~(a=S(e))&&(l=b[a]=A[a](e));let N=(!e[3]||e[16])&&e[0]&&!e[17]&&!e[36]&&Xn(e);function R(t){e[65](t)}let O={class:"tModal",noClickaway:!0,$$slots:{default:[Qn]},$$scope:{ctx:e}};void 0!==e[19]&&(O.open=e[19]);m=new e[30]({props:O}),re.push(()=>Se(m,"open",R));let P=e[20]&&Jn(e),B=e[24]&&nr(e);return{c(){t=M("div"),Ne(n.$$.fragment),o=L(),l&&l.c(),c=L(),d=M("input"),f=L(),N&&N.c(),h=L(),Ne(m.$$.fragment),g=L(),P&&P.c(),w=L(),B&&B.c(),y=F(),z(d,"class",u=T(e[9]||e[10])+" svelte-10ggg6v"),z(d,"id",e[5]),z(d,"name",e[5]),d.value=e[0],d.hidden=!0,q(t,"position","relative")},m(r,i){x(r,t,i),Te(n,t,null),D(t,o),~a&&b[a].m(t,null),D(t,c),D(t,d),D(t,f),N&&N.m(t,null),x(r,h,i),Te(m,r,i),x(r,g,i),P&&P.m(r,i),x(r,w,i),B&&B.m(r,i),x(r,y,i),v=!0,$||(I=V(t,"keydown",e[41]),$=!0)},p(e,o){const s={};4&o[0]&&(s.required=e[2]),8&o[0]&&(s.disabled=e[3]||e[36]),!r&&2&o[0]&&(r=!0,s.value=e[1],ue(()=>r=!1)),!i&&134217728&o[0]&&(i=!0,s.overwrite=e[27],ue(()=>i=!1)),n.$set(s);let f=a;a=S(e),a===f?~a&&b[a].p(e,o):(l&&(ye(),Ie(b[f],1,1,()=>{b[f]=null}),ve()),~a?(l=b[a],l?l.p(e,o):(l=b[a]=A[a](e),l.c()),$e(l,1),l.m(t,c)):l=null),(!v||1536&o[0]&&u!==(u=T(e[9]||e[10])+" svelte-10ggg6v"))&&z(d,"class",u),(!v||32&o[0])&&z(d,"id",e[5]),(!v||32&o[0])&&z(d,"name",e[5]),(!v||1&o[0]&&d.value!==e[0])&&(d.value=e[0]),e[3]&&!e[16]||!e[0]||e[17]||e[36]?N&&(ye(),Ie(N,1,1,()=>{N=null}),ve()):N?(N.p(e,o),196617&o[0]&&$e(N,1)):(N=Xn(e),N.c(),$e(N,1),N.m(t,null));const h={};344784337&o[0]|4194304&o[2]&&(h.$$scope={dirty:o,ctx:e}),!p&&524288&o[0]&&(p=!0,h.open=e[19],ue(()=>p=!1)),m.$set(h),e[20]?P?(P.p(e,o),1048576&o[0]&&$e(P,1)):(P=Jn(e),P.c(),$e(P,1),P.m(w.parentNode,w)):P&&(ye(),Ie(P,1,1,()=>{P=null}),ve()),e[24]?B?(B.p(e,o),16777216&o[0]&&$e(B,1)):(B=nr(e),B.c(),$e(B,1),B.m(y.parentNode,y)):B&&(ye(),Ie(B,1,1,()=>{B=null}),ve())},i(e){v||($e(n.$$.fragment,e),$e(l),$e(N),$e(m.$$.fragment,e),$e(P),$e(B),v=!0)},o(e){Ie(n.$$.fragment,e),Ie(l),Ie(N),Ie(m.$$.fragment,e),Ie(P),Ie(B),v=!1},d(e){e&&k(t),Re(n),~a&&b[a].d(),N&&N.d(),e&&k(h),Re(m,e),e&&k(g),P&&P.d(e),e&&k(w),B&&B.d(e),e&&k(y),$=!1,I()}}}(e);return{c(){r&&r.c(),t=F()},m(e,i){r&&r.m(e,i),x(e,t,i),n=!0},p(e,t){e[83]&&r.p(e,t)},i(e){n||($e(r),n=!0)},o(e){Ie(r),n=!1},d(e){r&&r.d(e),e&&k(t)}}}function Wn(e){let t,n,r,i,o;return n=new lt({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather pointer svelte-10ggg6v")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[48]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function zn(e){let t,n,r,i,o;return n=new Mt({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather pointer svelte-10ggg6v")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=[V(t,"click",e[40](!0)),V(t,"choose",e[44])],i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,A(o)}}}function Hn(e){let t,n,r,i;const o=[Gn,qn,jn],s=[];function a(e,t){return e[0]?0:!e[3]&&e[12]?1:2}return t=a(e),n=s[t]=o[t](e),{c(){n.c(),r=F()},m(e,n){s[t].m(e,n),x(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?s[t].p(e,i):(ye(),Ie(s[l],1,1,()=>{s[l]=null}),ve(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),$e(n,1),n.m(r.parentNode,r))},i(e){i||($e(n),i=!0)},o(e){Ie(n),i=!1},d(e){s[t].d(e),e&&k(r)}}}function jn(e){let t,n,r;return n=new Tt({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather3 svelte-10ggg6v")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function qn(e){let t,n,r,i,o;return n=new Tt({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather pointer svelte-10ggg6v")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[50]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function Gn(e){let t,n,r,i,o;return n=new lt({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather pointer svelte-10ggg6v")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[48]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function Xn(e){let t,n,r,i,o;return n=new ot({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather2 pointer svelte-10ggg6v")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[47]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function Yn(e){let t,n,r,i;const o=[Kn,Zn],s=[];function a(e,t){return e[6].lookup||e[4]&&!e[6].constraint?0:1}return t=a(e),n=s[t]=o[t](e),{c(){n.c(),r=F()},m(e,n){s[t].m(e,n),x(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?s[t].p(e,i):(ye(),Ie(s[l],1,1,()=>{s[l]=null}),ve(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),$e(n,1),n.m(r.parentNode,r))},i(e){i||($e(n),i=!0)},o(e){Ie(n),i=!1},d(e){s[t].d(e),e&&k(r)}}}function Zn(e){let t,n;return t=new In({props:{title:e[6].designation,newAllowed:e[23],prevEventId:e[11],schema:e[18],filter:e[35],query:e[38](),record:e[7],recID:e[0],isOpening:e[19],filterForReady:e[26],refStatus:e[6].refStatus,selectionFields:e[14],deList:e[15],praefix:e[13],shouldBlock:e[28],inputSearch:e[42]()}}),t.$on("choose",e[44]),t.$on("back",e[45]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};64&n[0]&&(r.title=e[6].designation),8388608&n[0]&&(r.newAllowed=e[23]),2048&n[0]&&(r.prevEventId=e[11]),262144&n[0]&&(r.schema=e[18]),128&n[0]&&(r.record=e[7]),1&n[0]&&(r.recID=e[0]),524288&n[0]&&(r.isOpening=e[19]),67108864&n[0]&&(r.filterForReady=e[26]),64&n[0]&&(r.refStatus=e[6].refStatus),16384&n[0]&&(r.selectionFields=e[14]),32768&n[0]&&(r.deList=e[15]),8192&n[0]&&(r.praefix=e[13]),268435456&n[0]&&(r.shouldBlock=e[28]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Kn(e){let t,n;return t=new Ln({props:{item:e[6],className:e[18].class,classId:e[10],rowId:e[0],recordId:e[12],viewName:e[4],viewValue:"",multiValues:e[8],searchValue:e[42]()}}),t.$on("choose",e[44]),t.$on("back",e[45]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};64&n[0]&&(r.item=e[6]),262144&n[0]&&(r.className=e[18].class),1024&n[0]&&(r.classId=e[10]),1&n[0]&&(r.rowId=e[0]),4096&n[0]&&(r.recordId=e[12]),16&n[0]&&(r.viewName=e[4]),256&n[0]&&(r.multiValues=e[8]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Qn(e){let t,n,r=e[19]&&Yn(e);return{c(){r&&r.c(),t=F()},m(e,i){r&&r.m(e,i),x(e,t,i),n=!0},p(e,n){e[19]?r?(r.p(e,n),524288&n[0]&&$e(r,1)):(r=Yn(e),r.c(),$e(r,1),r.m(t.parentNode,t)):r&&(ye(),Ie(r,1,1,()=>{r=null}),ve())},i(e){n||($e(r),n=!0)},o(e){Ie(r),n=!1},d(e){r&&r.d(e),e&&k(t)}}}function Jn(e){let t,n,r;function i(t){e[66](t)}let o={class:"tModal",noClickaway:!0,$$slots:{default:[tr]},$$scope:{ctx:e}};return void 0!==e[20]&&(o.open=e[20]),t=new e[30]({props:o}),re.push(()=>Se(t,"open",i)),{c(){Ne(t.$$.fragment)},m(e,n){Te(t,e,n),r=!0},p(e,r){const i={};2359297&r[0]|4194304&r[2]&&(i.$$scope={dirty:r,ctx:e}),!n&&1048576&r[0]&&(n=!0,i.open=e[20],ue(()=>n=!1)),t.$set(i)},i(e){r||($e(t.$$.fragment,e),r=!0)},o(e){Ie(t.$$.fragment,e),r=!1},d(e){Re(t,e)}}}function er(e){let t,n;return t=new Fp({props:{schema:e[18],recID:e[0],readonly:!0}}),t.$on("back",e[45]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};262144&n[0]&&(r.schema=e[18]),1&n[0]&&(r.recID=e[0]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function tr(e){let t,n;return t=new e[29]({props:{title:e[21],$$slots:{default:[er]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};2097152&n[0]&&(r.title=e[21]),262145&n[0]|4194304&n[2]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function nr(e){let t,n,r;function i(t){e[67](t)}let o={class:"tModal2",noClickaway:!0,$$slots:{default:[ir]},$$scope:{ctx:e}};return void 0!==e[24]&&(o.open=e[24]),t=new e[30]({props:o}),re.push(()=>Se(t,"open",i)),{c(){Ne(t.$$.fragment)},m(e,n){Te(t,e,n),r=!0},p(e,r){const i={};35913728&r[0]|4194304&r[2]&&(i.$$scope={dirty:r,ctx:e}),!n&&16777216&r[0]&&(n=!0,i.open=e[24],ue(()=>n=!1)),t.$set(i)},i(e){r||($e(t.$$.fragment,e),r=!0)},o(e){Ie(t.$$.fragment,e),r=!1},d(e){Re(t,e)}}}function rr(e){let t,n;return t=new Fp({props:{schema:e[18],dialogAttr:e[25]}}),t.$on("back",e[46]),t.$on("choose",e[43]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};262144&n[0]&&(r.schema=e[18]),33554432&n[0]&&(r.dialogAttr=e[25]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function ir(e){let t,n;return t=new e[29]({props:{title:e[21],$$slots:{default:[rr]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};2097152&n[0]&&(r.title=e[21]),33816576&n[0]|4194304&n[2]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function or(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function sr(e){let t,n,r={ctx:e,current:null,token:null,hasCatch:!1,pending:or,then:Un,catch:Vn,value:83,blocks:[,,,]};return _e(e[39](),r),{c(){t=F(),r.block.c()},m(e,i){x(e,t,i),r.block.m(e,r.anchor=i),r.mount=()=>t.parentNode,r.anchor=t,n=!0},p(t,n){Ce(r,e=t,n)},i(e){n||($e(r.block),n=!0)},o(e){for(let e=0;e<3;e+=1){Ie(r.blocks[e])}n=!1},d(e){e&&k(t),r.block.d(e),r.token=null,r=null}}}function ar(e,n,r){let s,a,l,d,f;N(e,i,e=>r(62,s=e)),N(e,o,e=>r(73,f=e));const h=ee(),{Dialog:m,Modal:p}=c,{currentTasks:g,environment:w,loggedIn:v}=u;N(e,g,e=>r(70,a=e)),N(e,w,e=>r(72,d=e)),N(e,v,e=>r(71,l=e));let{id:$}=n,{item:I}=n,{record:_}=n,{fullRecord:C}=n,{value:E=""}=n,{multiValues:A}=n,{desc:b=""}=n,{noForm:S=!1}=n,{classId:T}=n,{eventId:R}=n,{recordId:D}=n,{withRefValue:x=!1}=n,{refValue:k=""}=n,{shortEdit:O}=n,{required:M}=n,{disabled:P}=n,{readonly:B}=n,{praefix:L}=n,{selectionFields:F}=n,{formnovalidate:V}=n,{selection:U}=n,{deList:W}=n,{isTemplate:z}=n,{noList:H=!1}=n,{multi:j=!1}=n,{initFinished:q}=n,{listName:G=""}=n;const X="comment_"+$,Y=I.filter,Z=I.properties?.startDialog;let K,Q,J,te,ne,re,ie,oe,se=!1,ae=!0,le=!1,ce=!0,de=!0,ue=!1,fe="";!U&&I.selection&&1===I.selection.split(":").length&&(U=I.selection);const he=B||P||I.lookup||U&&!I.constraint?"":"Suchbegriff ⏎",me=(e,t)=>{try{return e.split(".").reduce((e,t)=>e[t],t)}catch(e){return""}},pe=()=>{I.refItem&&I.refItem.startsWith("owner")&&(r(52,k=d.owner[I.refClass]),k||r(52,k=me(I.refItem,d)),k&&(r(51,x=!0),h("change",{value:k})))},ge=async e=>{e.items.filter(e=>e.properties?.default).forEach(t=>{h("defPrep",{className:e.class,itemName:t.name,value:t.properties.default})})},we=async e=>{const n=()=>{r(19,se=!0)};if(9==e.which)return;if(E)return e.preventDefault();if(13!=e.which)return;if(e.preventDefault(),I.lookup)return n();const i=te.items.find(e=>e.properties?.search);if(!i)return n();const o=e.srcElement.value,{name:s,checkOn:a,refClass:l,properties:c}=i;let{search:d}=c;!0===d&&(d={}),"number"==typeof d&&(d={min:d});const{min:u=3,start:f=!1,end:h=!1}=d;if(o.length<u)return n();const m=(f?"^":"")+o+(h?"$":"");let p={[s]:{$regex:m,$options:"i"}};a&&(p=[{$lookup:{from:l,localField:s,foreignField:"_id",as:l}},{$match:{[l+"."+a]:{$regex:m,$options:"i"}}}]);const g=await t.getSectionView(te.class,p);1!==g?.length?n():r(0,E=g[0]._id)},ye=e=>{e&&(r(61,fe=r(1,b=y(te,e))),h("setRefDesc",b.split(" •")[0]),h("change",{value:E,description:b}),h("task",{row:e,eventId:te.id}))},ve=()=>{r(19,se=!1),r(20,Q=!1)},$e=()=>{r(24,le=!1)};return e.$$set=e=>{"id"in e&&r(5,$=e.id),"item"in e&&r(6,I=e.item),"record"in e&&r(55,_=e.record),"fullRecord"in e&&r(7,C=e.fullRecord),"value"in e&&r(0,E=e.value),"multiValues"in e&&r(8,A=e.multiValues),"desc"in e&&r(1,b=e.desc),"noForm"in e&&r(9,S=e.noForm),"classId"in e&&r(10,T=e.classId),"eventId"in e&&r(11,R=e.eventId),"recordId"in e&&r(12,D=e.recordId),"withRefValue"in e&&r(51,x=e.withRefValue),"refValue"in e&&r(52,k=e.refValue),"shortEdit"in e&&r(56,O=e.shortEdit),"required"in e&&r(2,M=e.required),"disabled"in e&&r(3,P=e.disabled),"readonly"in e&&r(53,B=e.readonly),"praefix"in e&&r(13,L=e.praefix),"selectionFields"in e&&r(14,F=e.selectionFields),"formnovalidate"in e&&r(57,V=e.formnovalidate),"selection"in e&&r(4,U=e.selection),"deList"in e&&r(15,W=e.deList),"isTemplate"in e&&r(16,z=e.isTemplate),"noList"in e&&r(58,H=e.noList),"multi"in e&&r(17,j=e.multi),"initFinished"in e&&r(54,q=e.initFinished),"listName"in e&&r(59,G=e.listName)},e.$$.update=()=>{if(4&e.$$.dirty[0]|67108864&e.$$.dirty[1]&&r(2,M="boolean"==typeof M&&(M&&!V)),4160&e.$$.dirty[0]|4194304&e.$$.dirty[1]&&r(53,B||=D&&I.asInput),8&e.$$.dirty[0]|4194304&e.$$.dirty[1]&&r(3,P||=B),3145728&e.$$.dirty[1]&&x&&r(0,E=k),3&e.$$.dirty[0]|1073741824&e.$$.dirty[1]&&!b&&E&&fe&&r(1,b=fe),399425&e.$$.dirty[0]|411041792&e.$$.dirty[1]&&E&&te){let e=!1;if(!Array.isArray(E)){if(D||I.asInput||I.upate||!1!==I.refItem||!0===j||!1===I.refItem&&q){const t="p$"+G+"$"+I.refClass+"$"+R,n=Sp(t);n?.then?n.then(e=>{const t=e.find(({_id:e})=>e===E);t?ye(t):Tp(I.refClass,te.id,E,!!I.lookup||H).then(ye)}):e=!0}e&&Tp(I.refClass,te.id,E,!!I.lookup||H).then(ye),r(54,q=!0)}}if(65&e.$$.dirty[0]|536870912&e.$$.dirty[1]|1&e.$$.dirty[2]&&E&&ne&&I.name===ne.input?.at(0)&&ne.inputLookup?.length){const{domain:e}=ne.inputLookup[0]||{};"user"===e&&(s.some(e=>ne.authorization?.find(t=>t.role===e&&!t.constraint))||r(3,P=!0))}262145&e.$$.dirty[0]&&!E&&te&&ye({})},[E,b,M,P,U,$,I,C,A,S,T,R,D,L,F,W,z,j,te,se,Q,J,re,ae,le,ie,ce,de,ue,m,p,g,w,v,X,Y,Z,he,()=>{if(!I.query)return;const[e,t]=I.query.split(".");let n;return n=C[t]?[{$lookup:{from:e,localField:e,foreignField:"_id",as:"__"+e}},{$unwind:{path:"$__"+e,preserveNullAndEmptyArrays:!0}},{$match:{["__"+e+"."+t]:C[t]}}]:[{$match:{[e]:C[e]}}],I.refStatus&&(n=n.concat([{$addFields:{_docId:{$toString:"$_id"}}},{$lookup:{from:"_task",localField:"_docId",foreignField:"docId",as:"_task"}},{$unwind:{path:"$_task",preserveNullAndEmptyArrays:!0}},{$match:{"_task.status":I.refStatus}}])),n},async()=>{try{if(K=await t.getEvent(R),oe="report"===K.output.type,r(26,ce=!I.asInput),r(23,ae=K.output?.class[0].name!==I.refClass),r(18,te=await t.getSchemaByClass(I.refClass)),te?.blocked)return h("initFail",!0),!1;if(oe||r(28,ue=((e,t)=>{let n=t.items.find(e=>!!e.properties?.blocking);if(!n)return!1;if(e.input?.class?.find(e=>e.name===t.class))return n.name;const r=e.output?.class.at(0)?.list||[];for(const e of r){const t=e.item.find(e=>e.name===I.name);if(t?.properties?.blocking)return n.name}return!1})(K,te)),r(22,re=(e=>!a?.length||!!a.find(t=>t===e))(te.id)),r(60,ne=await t.getSchema(R)),R&&D&&E&&!P&&ne.input?.find(e=>e===I.refClass)&&r(3,P=!0),K.input?.class&&K.input.class[0]&&(K.input.class[0].name===I.refClass&&K.input.class[0].readonly&&r(3,P=!0),D&&K.input.class[0].name===I.refClass&&K.input.class[0].writeState)){(await t.getTaskByDocId(D,!0)).status===K.input.class[0].writeState&&r(3,P=r(53,B=!1))}if(I.properties?.query?.lookup){const{domain:e,value:n}=I.properties.query.lookup;if("user"===e){const e=l.user,i={[n]:e},o=await t.getSectionView(I.refClass,i);if(o?.length){const[{_id:e}]=o;e&&(r(52,k=e),r(51,x=!0),h("change",{value:k}))}s.some(e=>te.authorization?.find(t=>t.role===e&&!t.constraint))||r(3,P=!0)}}else pe();if(!P&&!k&&I.filter&&(""===L||void 0===L)){const e=I.filter,n=!0;e.startsWith("!")&&(n=!1,e=e.slice(1));const i=await t.getOneAndOnly(I.refClass,{[I.filter]:n});i&&(r(52,k=i._id),r(51,x=!0),h("change",{value:k}))}return r(21,J=te.identity.designation),E||ge(te),!0}catch{return h("initFail",!0),!1}},e=>t=>{if(t.stopPropagation(),!Z){if(!0===e&&r(19,se=!0),e&&"BUTTON"===t.explicitOriginalTarget?.nodeName){const t=document.getElementById(e);return t?.blur()}(I.lookup||U&&!I.constraint||E)&&r(19,se=!0)}},we,()=>{if(E)return"";r(1,b="");const e="#"+T+(G?" ."+T+G:"")+" #"+X,t=document.querySelectorAll(e)[0];return t?.value?t.value:""},async({detail:e})=>{if(e.className=te.class,r(0,E=e.row._id),""===L||void 0===L?h("saveDialog",{itemName:I.name,value:E,closeTask:I.properties?.closeTask}):h("listChange",e),I.properties?.closeTask&&K.output?.approval){const e=await t.getTaskByDocId(_._id),n=K.output.approval.flatMap(({refRole:e})=>e),r={eventId:R,eventDesignation:K.identity.designation,docId:_._id,role:n.filter(e=>s.find(t=>t===e)).join(", "),user:f.email,timeStamp:(new Date).toISOString()};await t.setTaskVisum(e._id,r)}$e()},({detail:e})=>{r(0,E=e.row._id),ve()},ve,$e,()=>{(oe||re)&&(j?h("change",{value:E,delete:!0}):(r(0,E=""),r(1,b=""),r(27,de=!0),h("change",{value:E,description:b}),h("task",{row:{_task:{event:te.id},_id:!1},eventId:te.id})))},async()=>{if(!E)return;let e=await Tp(I.refClass,te.id,E);e._task||(e={_task:await t.getTaskByDocId(E,!0)});const n=e._task.task_id||e._task._id,r=`/task/${e._task.event}/${n}/task?view=standalone`;window.open(r)},e=>{E||b&&we({which:13,preventDefault:()=>{},srcElement:{value:b}})},async e=>{r(25,ie={});for(const e in Z){let n=Z[e],i="";if(n.startsWith("owner"))i=me(n,d);else if(n.startsWith("+")){const[e,r]=n.slice(1).split(".");n=e;const o=await t.getSchemaByClass(n),s=_[n];let a=await Np("",o.id);if(a?.length){a=a.sort((e,t)=>e[r]>t[r]?1:e[r]<t[r]?-1:0);const e=a.findIndex(e=>e._id===s);i=a[+e+1]._id||""}}else if(n.includes("|"))for(const e of n.split("|"))i||(i=_[e]);else i=_[n]||C&&C[n];r(25,ie[e]=i,ie)}r(24,le=!0)},x,k,B,q,_,O,V,H,G,ne,fe,s,function(e){b=e,r(1,b),r(0,E),r(61,fe),r(51,x),r(52,k)},function(e){de=e,r(27,de)},function(e){se=e,r(19,se)},function(e){Q=e,r(20,Q)},function(e){le=e,r(24,le)}]}class lr extends xe{constructor(e){var t;super(),Fn.getElementById("svelte-10ggg6v-style")||((t=M("style")).id="svelte-10ggg6v-style",t.textContent=".feather.svelte-10ggg6v{position:absolute;top:0.75em;left:0.5em;color:#4300b0}.feather2.svelte-10ggg6v{position:absolute;top:0.75em;right:0.5em;color:#4300b0}.feather3.svelte-10ggg6v{position:absolute;top:0.75em;left:0.5em;color:gray}.text-field textarea:invalid{border-bottom:1px #b80000 solid !important;background-color:#fbeeee !important}.modal-overlay.tModal2 > .dialog{margin-top:0 !important}",D(Fn.head,t)),De(this,e,ar,sr,S,{id:5,item:6,record:55,fullRecord:7,value:0,multiValues:8,desc:1,noForm:9,classId:10,eventId:11,recordId:12,withRefValue:51,refValue:52,shortEdit:56,required:2,disabled:3,readonly:53,praefix:13,selectionFields:14,formnovalidate:57,selection:4,deList:15,isTemplate:16,noList:58,multi:17,initFinished:54,listName:59},[-1,-1,-1])}}const{document:cr}=Ee;function dr(e){e[45]=e[46].items}function ur(e,t,n){const r=e.slice();return r[47]=t[n],r[49]=n,r}function fr(e,t,n){const r=e.slice();return r[50]=t[n],r[52]=n,r}function hr(e,t,n){const r=e.slice();return r[50]=t[n],r}function mr(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function pr(e){let t,n,r,i;dr(e);const o=[wr,gr],s=[];function a(e,t){return e[6]?1:0}return t=a(e),n=s[t]=o[t](e),{c(){n.c(),r=F()},m(e,n){s[t].m(e,n),x(e,r,n),i=!0},p(e,i){dr(e);let l=t;t=a(e),t===l?s[t].p(e,i):(ye(),Ie(s[l],1,1,()=>{s[l]=null}),ve(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),$e(n,1),n.m(r.parentNode,r))},i(e){i||($e(n),i=!0)},o(e){Ie(n),i=!1},d(e){s[t].d(e),e&&k(r)}}}function gr(e){let t,n;return t=new Fp({props:{schema:e[4],recID:e[7]}}),t.$on("choose",e[24]),t.$on("back",e[25]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};16&n[0]&&(r.schema=e[4]),128&n[0]&&(r.recID=e[7]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function wr(e){let t,n,r,i,o,s,a,l,c,d,u,f,h,m,p,g,w,y,v,$,I,_;n=new e[12]({props:{outline:!0,$$slots:{default:[yr]},$$scope:{ctx:e}}}),n.$on("click",e[33]);let C=e[1]&&vr(e);o=new e[12]({props:{disabled:!e[5].length,filled:!0,$$slots:{default:[Ir]},$$scope:{ctx:e}}}),o.$on("click",e[17]);let E=e[14]&&function(e){let t,n;return t=new e[9]({}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}(e);function A(t){e[34](t)}let b={id:e[13]};void 0!==e[3]&&(b.value=e[3]),d=new e[10]({props:b}),re.push(()=>Se(d,"value",A)),d.$on("input",e[19]),m=new ot({props:{size:"18"}});let S=e[45]?.length&&_r(e),N=e[5]?.length&&Er(e);return{c(){t=M("div"),Ne(n.$$.fragment),r=L(),C&&C.c(),i=L(),Ne(o.$$.fragment),s=L(),E&&E.c(),a=L(),l=M("div"),c=B("Suchen: "),Ne(d.$$.fragment),f=L(),h=M("span"),Ne(m.$$.fragment),p=L(),g=M("div"),w=M("table"),S&&S.c(),y=L(),v=M("tbody"),N&&N.c(),z(t,"class","form--buttons svelte-4visk8"),z(h,"class","feather pointer svelte-4visk8"),q(l,"margin-bottom","1em"),q(l,"position","relative"),z(w,"striped",""),z(w,"class","svelte-4visk8"),z(g,"class","eList svelte-4visk8")},m(u,A){x(u,t,A),Te(n,t,null),D(t,r),C&&C.m(t,null),D(t,i),Te(o,t,null),x(u,s,A),E&&E.m(u,A),x(u,a,A),x(u,l,A),D(l,c),Te(d,l,null),D(l,f),D(l,h),Te(m,h,null),x(u,p,A),x(u,g,A),D(g,w),S&&S.m(w,null),D(w,y),D(w,v),N&&N.m(v,null),$=!0,I||(_=V(h,"click",e[21]),I=!0)},p(e,r){const s={};16777216&r[1]&&(s.$$scope={dirty:r,ctx:e}),n.$set(s),e[1]?C?(C.p(e,r),2&r[0]&&$e(C,1)):(C=vr(e),C.c(),$e(C,1),C.m(t,i)):C&&(ye(),Ie(C,1,1,()=>{C=null}),ve());const a={};32&r[0]&&(a.disabled=!e[5].length),16777216&r[1]&&(a.$$scope={dirty:r,ctx:e}),o.$set(a);const l={};!u&&8&r[0]&&(u=!0,l.value=e[3],ue(()=>u=!1)),d.$set(l),e[45]?.length?S?(S.p(e,r),4&r[0]&&$e(S,1)):(S=_r(e),S.c(),$e(S,1),S.m(w,y)):S&&(ye(),Ie(S,1,1,()=>{S=null}),ve()),e[5]?.length?N?(N.p(e,r),32&r[0]&&$e(N,1)):(N=Er(e),N.c(),$e(N,1),N.m(v,null)):N&&(ye(),Ie(N,1,1,()=>{N=null}),ve())},i(e){$||($e(n.$$.fragment,e),$e(C),$e(o.$$.fragment,e),$e(E),$e(d.$$.fragment,e),$e(m.$$.fragment,e),$e(S),$e(N),$=!0)},o(e){Ie(n.$$.fragment,e),Ie(C),Ie(o.$$.fragment,e),Ie(E),Ie(d.$$.fragment,e),Ie(m.$$.fragment,e),Ie(S),Ie(N),$=!1},d(e){e&&k(t),Re(n),C&&C.d(),Re(o),e&&k(s),E&&E.d(e),e&&k(a),e&&k(l),Re(d),Re(m),e&&k(p),e&&k(g),S&&S.d(),N&&N.d(),I=!1,_()}}}function yr(e){let t;return{c(){t=B("Abbrechen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function vr(e){let t,n;return t=new e[12]({props:{filled:!0,$$slots:{default:[$r]},$$scope:{ctx:e}}}),t.$on("click",e[23]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};16777216&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function $r(e){let t;return{c(){t=B("Neu")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Ir(e){let t;return{c(){t=B("Bestätigen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function _r(e){let t,n,r,i,o,s,a,l;i=new Ze({props:{size:"20",style:"color: #326173;"}});let c=e[45],d=[];for(let t=0;t<c.length;t+=1)d[t]=Cr(hr(e,c,t));return{c(){t=M("thead"),n=M("tr"),r=M("th"),Ne(i.$$.fragment),o=L();for(let e=0;e<d.length;e+=1)d[e].c();z(r,"class","svelte-4visk8"),z(n,"class","svelte-4visk8"),z(t,"class","svelte-4visk8")},m(c,u){x(c,t,u),D(t,n),D(n,r),Te(i,r,null),D(n,o);for(let e=0;e<d.length;e+=1)d[e].m(n,null);s=!0,a||(l=V(r,"click",function(){b(e[22](e[5]))&&e[22](e[5]).apply(this,arguments)}),a=!0)},p(t,r){if(e=t,262148&r[0]){let t;for(c=e[45],t=0;t<c.length;t+=1){const i=hr(e,c,t);d[t]?d[t].p(i,r):(d[t]=Cr(i),d[t].c(),d[t].m(n,null))}for(;t<d.length;t+=1)d[t].d(1);d.length=c.length}},i(e){s||($e(i.$$.fragment,e),s=!0)},o(e){Ie(i.$$.fragment,e),s=!1},d(e){e&&k(t),Re(i),O(d,e),a=!1,l()}}}function Cr(e){let t,n,r=e[50]?.designation+"";return{c(){t=M("th"),n=B(r),z(t,"class","svelte-4visk8")},m(e,r){x(e,t,r),D(t,n)},p(e,t){4&t[0]&&r!==(r=e[50]?.designation+"")&&H(n,r)},d(e){e&&k(t)}}}function Er(e){let t,n,r=[],i=new Map,o=e[5];const s=e=>e[47]._id;for(let t=0;t<o.length;t+=1){let n=ur(e,o,t),a=s(n);i.set(a,r[t]=Nr(a,n))}return{c(){for(let e=0;e<r.length;e+=1)r[e].c();t=F()},m(e,i){for(let t=0;t<r.length;t+=1)r[t].m(e,i);x(e,t,i),n=!0},p(e,n){1409069&n[0]&&(o=e[5],ye(),r=be(r,n,s,1,e,o,i,t.parentNode,Ae,Nr,t,ur),ve())},i(e){if(!n){for(let e=0;e<o.length;e+=1)$e(r[e]);n=!0}},o(e){for(let e=0;e<r.length;e+=1)Ie(r[e]);n=!1},d(e){for(let t=0;t<r.length;t+=1)r[t].d(e);e&&k(t)}}}function Ar(e){let t,n,r,i,o=e[0],s=br(e),a=e[45],l=[];for(let t=0;t<a.length;t+=1)l[t]=Sr(fr(e,a,t));return{c(){t=M("tr"),s.c(),n=L();for(let e=0;e<l.length;e+=1)l[e].c();r=L(),z(t,"class","svelte-4visk8"),G(t,"active",e[0].includes(e[47]._id))},m(e,o){x(e,t,o),s.m(t,null),D(t,n);for(let e=0;e<l.length;e+=1)l[e].m(t,null);D(t,r),i=!0},p(e,i){if(1&i[0]&&S(o,o=e[0])?(ye(),Ie(s,1,1,_),ve(),s=br(e),s.c(),$e(s),s.m(t,n)):s.p(e,i),327716&i[0]){let n;for(a=e[45],n=0;n<a.length;n+=1){const o=fr(e,a,n);l[n]?l[n].p(o,i):(l[n]=Sr(o),l[n].c(),l[n].m(t,r))}for(;n<l.length;n+=1)l[n].d(1);l.length=a.length}33&i[0]&&G(t,"active",e[0].includes(e[47]._id))},i(e){i||($e(s),i=!0)},o(e){Ie(s),i=!1},d(e){e&&k(t),s.d(e),O(l,e)}}}function br(e){let t,n,r;return n=new e[11]({props:{name:e[15],data:e[47]._id,checked:e[0].includes(e[47]._id),round:!0}}),{c(){t=M("td"),Ne(n.$$.fragment),z(t,"title","Wählt den Wert aus"),z(t,"class","svelte-4visk8")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p(e,t){const r={};32&t[0]&&(r.data=e[47]._id),33&t[0]&&(r.checked=e[0].includes(e[47]._id)),n.$set(r)},i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function Sr(e){let t,n,r,i=e[16](e[47],e[50])+"";return{c(){t=M("td"),n=B(i),z(t,"class",r=T(e[50].type)+" svelte-4visk8")},m(e,r){x(e,t,r),D(t,n)},p(e,o){36&o[0]&&i!==(i=e[16](e[47],e[50])+"")&&H(n,i),4&o[0]&&r!==(r=T(e[50].type)+" svelte-4visk8")&&z(t,"class",r)},d(e){e&&k(t)}}}function Nr(e,t){let n,r,i,o=t[20](t[47],t[45],t[3]),s=o&&Ar(t);return{key:e,first:null,c(){n=F(),s&&s.c(),r=F(),this.first=n},m(e,t){x(e,n,t),s&&s.m(e,t),x(e,r,t),i=!0},p(e,n){t=e,44&n[0]&&(o=t[20](t[47],t[45],t[3])),o?s?(s.p(t,n),44&n[0]&&$e(s,1)):(s=Ar(t),s.c(),$e(s,1),s.m(r.parentNode,r)):s&&(ye(),Ie(s,1,1,()=>{s=null}),ve())},i(e){i||($e(s),i=!0)},o(e){Ie(s),i=!1},d(e){e&&k(n),s&&s.d(e),e&&k(r)}}}function Tr(e){let t,n;return t=new e[9]({}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p:_,i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Rr(e){let t,n,r,i={ctx:e,current:null,token:null,hasCatch:!1,pending:Tr,then:pr,catch:mr,value:46,blocks:[,,,]};return _e(n=e[2]&&e[18](),i),{c(){t=F(),i.block.c()},m(e,n){x(e,t,n),i.block.m(e,i.anchor=n),i.mount=()=>t.parentNode,i.anchor=t,r=!0},p(t,r){e=t,i.ctx=e,4&r[0]&&n!==(n=e[2]&&e[18]())&&_e(n,i)||Ce(i,e,r)},i(e){r||($e(i.block),r=!0)},o(e){for(let e=0;e<3;e+=1){Ie(i.blocks[e])}r=!1},d(e){e&&k(t),i.block.d(e),i.token=null,i=null}}}function Dr(e,i,o){let s=JSON.parse(n.getItem("Locale")).id;const a=ee(),{Loading:l,TextField:d,Checkbox:u,Button:f}=c;let h,p,g,y,{inputList:v}=i,{selection:$}=i,{item:I}=i,{target:_}=i,{className:C}=i,{classId:E}=i,{recordId:A}=i,{stopAggregation:b=!1}=i,{shouldNew:S}=i,N=!0,T=C+Math.floor(9e3*Math.random()+1e3).toString()+"search",R=!1;$||=[];let D=$;const x=C+_+"checkbox",k=(e,t)=>{if(!t)return;let n=e[t.name];if("__total"===t.name&&void 0===n&&(n=1.081*e._total),!n&&t.name.includes("_")&&!t.name.startsWith("_")&&!t.name.endsWith("_from")&&!t.name.endsWith("_to")){const[r,i]=t.name.split("_");try{n=e[r][i]}catch{}}if(Array.isArray(n)){const e=e=>e.replaceAll(" ",String.fromCharCode(160));if(n.length&&Array.isArray(n[0].serialno)){let t=[];for(const r of n)t=t.concat(r.serialno.map(e));n=t.join(", ")}else n=n.map(e),n.length>3&&(n=n.slice(0,3),n=n.concat("...")),n=n.join(", ")}if(!n&&t.name.split("_").length>1){const[r,i]=t.name.split("_");try{n=e[r][0][i],Array.isArray(n)&&(n=n.join(", "))}catch{}}return"number"===t.type&&(n||(n=e[`_${t.name}`]),n=Number(n)?Number(n).toLocaleString(s,{minimumFractionDigits:t.properties?.decimals||t.decimals||0,maximumFractionDigits:t.properties?.decimals||t.decimals||0}):""),"boolean"===t.type&&"Aktiv"===n&&(n=!1),"number"===t.type?n:"boolean"==typeof n||"boolean"===t.type?w(n):m(e[`_${t.name}`]||n||"")},O=t.getSchemaByClass(C),M=(e,t)=>{if(e){let n,r="1";if("string"==typeof e)n=e;else{const t=Object.keys(e);n=t[0],r=e[t[0]]}"date"===n&&(r="-1");const i=new Intl.Collator(s,{numeric:!0});return 1==+r?t.sort((e,t)=>i.compare(e[n],t[n])):t.sort((e,t)=>i.compare(t[n],e[n]))}return t};Q(()=>{window.setTimeout(()=>{const e=document.querySelector("tr.active");e&&e.scrollIntoView({block:"end",behavior:"smooth"}),document.getElementById(T)?.focus()},200)}),r.subscribe(async e=>{if(!e)return;const t=await O;e.eventId===t.id&&(kp(t.class,e.eventId),o(2,N=!o(2,N=!1)))});const P=()=>{o(6,R=!1)};return e.$$set=e=>{"inputList"in e&&o(26,v=e.inputList),"selection"in e&&o(0,$=e.selection),"item"in e&&o(27,I=e.item),"target"in e&&o(28,_=e.target),"className"in e&&o(29,C=e.className),"classId"in e&&o(30,E=e.classId),"recordId"in e&&o(31,A=e.recordId),"stopAggregation"in e&&o(32,b=e.stopAggregation),"shouldNew"in e&&o(1,S=e.shouldNew)},[$,S,N,h,p,g,R,y,a,l,d,u,f,T,!1,x,k,()=>{const e=document.getElementsByName(x),t=Array.from(e).filter(e=>e.checked).map(e=>e.attributes.data.value);if(h){const e=D.filter(e=>!t.find(t=>t==e));o(0,$=t.concat(e)),D=[...$]}else o(0,$=t),D=[];a("choose",{list:$})},async()=>{o(4,p=await O),g||o(5,g=M(p.displaySort,await v||await Np(p.class,p.id)));const{display:e}=p;let n=await(async(e,n,r)=>{if(!e)return;let i=[];for(const o of e){if("_total"===o){i.push({name:"_total",designation:"Betrag",type:"number"});continue}if("__total"===o){i.push({name:"__total",designation:"Total CHF",type:"number",decimals:2});continue}const[e,s]=o.split(".");let a=n.list?.find(t=>t.name===e)?.item?.find(e=>e.name===s);if(a&&(a={...a},a.name=`${e}_${s}`,r=r.map(t=>(t[e]&&(t[a.name]=t["_"+e]?t["_"+e][s]:t[e][s]),t))),o.endsWith("_from")||o.endsWith("_to")){const t=a=n.items.find(t=>t.name===e.split("_")[0]);t&&(a={name:o,designation:t.designation,type:"date",decimals:0})}if(a||(a=n.items.find(t=>t.name===e)),!a){const n=await t.getSchemaByClass(e),r=n.items?.find(e=>e.name===s);r&&(a={name:e,designation:r.designation,type:r.type,decimals:r.properties?.decimals||0})}i.find(t=>t?.name===e)||i.push(a)}return i.length?i:n.items})(e,p,g);return{items:n}},({detail:{value:e}})=>{o(3,h=e)},(e,t,n)=>{if(!e)return!1;if(!n)return!0;"string"!=typeof n&&(n=n.toString()),n=n.toLowerCase();let r=!1;for(const i of t){const t=k(e,i).toLowerCase();!r&&t.includes(n)&&(r=!0)}return r},()=>{o(3,h="")},e=>()=>{document.getElementsByName(x).forEach((e,t)=>{e.checked=!e.checked})},()=>{o(7,y=!1),o(6,R=!0)},async e=>{o(5,g=M(p.displaySort,await Np(p.class,p.id))),e.detail?.row?._id&&$.push(e.detail.row._id),P()},P,v,I,_,C,E,A,b,()=>a("back"),function(e){h=e,o(3,h)}]}class xr extends xe{constructor(e){var t;super(),cr.getElementById("svelte-4visk8-style")||((t=M("style")).id="svelte-4visk8-style",t.textContent=".feather.svelte-4visk8.svelte-4visk8{position:absolute;top:2em;right:0.5em;color:#326173}td .checkbox .selector{border:0.125em solid #326173 !important}.eList.svelte-4visk8.svelte-4visk8{height:fit-content;max-height:65vh;overflow-y:scroll;overflow-x:auto}.eList.svelte-4visk8 .editRow.svelte-4visk8{width:1em}.eList.svelte-4visk8 table.svelte-4visk8{min-width:30vw;position:relative;width:max-content !important;max-width:50vh !important}.eList.svelte-4visk8 table thead.svelte-4visk8{position:sticky;top:0;background:#326173;color:white}.eList.svelte-4visk8 table thead tr.svelte-4visk8{height:2.3em}.eList.svelte-4visk8 table tbody tr.svelte-4visk8{height:2.75em !important}th.svelte-4visk8.svelte-4visk8,td.svelte-4visk8.svelte-4visk8{padding-left:0.4em;padding-right:0.4em}td.number.svelte-4visk8.svelte-4visk8{text-align:end}tr.active.svelte-4visk8.svelte-4visk8{color:#326173;background-color:#fcebd5}.form--buttons.svelte-4visk8.svelte-4visk8{display:flex;gap:1em;padding:0.5em 0}",D(cr.head,t)),De(this,e,Dr,Rr,S,{inputList:26,selection:0,item:27,target:28,className:29,classId:30,recordId:31,stopAggregation:32,shouldNew:1},[-1,-1])}}function kr(e,t,n){const r=e.slice();return r[12]=t[n],r[42]=n,r}function Or(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Mr(e){let t,n;return t=new e[17]({props:{outline:!0,$$slots:{default:[Lr]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};36863&n[0]|4096&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Pr(e){let t,n,r,i,o;return n=new wt({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather pointer")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[23]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function Br(e){let t,n;return t=new lr({props:{classId:e[5],eventId:e[6],required:e[8],disabled:e[0],formnovalidate:e[11],readonly:e[9],id:e[1]+"."+e[42],item:e[2],desc:e[3],value:e[12],noForm:e[4],praefix:e[10],recordId:e[7],multi:!0+"}"}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};32&n[0]&&(r.classId=e[5]),64&n[0]&&(r.eventId=e[6]),256&n[0]&&(r.required=e[8]),1&n[0]&&(r.disabled=e[0]),2048&n[0]&&(r.formnovalidate=e[11]),512&n[0]&&(r.readonly=e[9]),2&n[0]&&(r.id=e[1]+"."+e[42]),4&n[0]&&(r.item=e[2]),8&n[0]&&(r.desc=e[3]),32768&n[0]&&(r.value=e[12]),16&n[0]&&(r.noForm=e[4]),1024&n[0]&&(r.praefix=e[10]),128&n[0]&&(r.recordId=e[7]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Lr(e){let t,n,r,i=!e[9]&&Pr(e),o=e[15],s=[];for(let t=0;t<o.length;t+=1)s[t]=Br(kr(e,o,t));const a=e=>Ie(s[e],1,1,()=>{s[e]=null});return{c(){i&&i.c(),t=L();for(let e=0;e<s.length;e+=1)s[e].c();n=F()},m(e,o){i&&i.m(e,o),x(e,t,o);for(let t=0;t<s.length;t+=1)s[t].m(e,o);x(e,n,o),r=!0},p(e,r){if(e[9]?i&&(ye(),Ie(i,1,1,()=>{i=null}),ve()):i?(i.p(e,r),512&r[0]&&$e(i,1)):(i=Pr(e),i.c(),$e(i,1),i.m(t.parentNode,t)),36863&r[0]){let t;for(o=e[15],t=0;t<o.length;t+=1){const i=kr(e,o,t);s[t]?(s[t].p(i,r),$e(s[t],1)):(s[t]=Br(i),s[t].c(),$e(s[t],1),s[t].m(n.parentNode,n))}for(ye(),t=o.length;t<s.length;t+=1)a(t);ve()}},i(e){if(!r){$e(i);for(let e=0;e<o.length;e+=1)$e(s[e]);r=!0}},o(e){Ie(i),s=s.filter(Boolean);for(let e=0;e<s.length;e+=1)Ie(s[e]);r=!1},d(e){i&&i.d(e),e&&k(t),O(s,e),e&&k(n)}}}function Fr(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Vr(e){let t,n;return t=new e[19]({props:{title:e[14].designation,class:"eList",$$slots:{default:[Ur]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};16384&n[0]&&(r.title=e[14].designation),82084&n[0]|4096&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Ur(e){let t,n;return t=new xr({props:{selection:e[16],item:e[2],className:e[14].class,classId:e[5],recordId:e[7],inputList:e[22](),target:e[2].name,shouldNew:!e[20]}}),t.$on("choose",e[24]),t.$on("back",e[25]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};65536&n[0]&&(r.selection=e[16]),4&n[0]&&(r.item=e[2]),16384&n[0]&&(r.className=e[14].class),32&n[0]&&(r.classId=e[5]),128&n[0]&&(r.recordId=e[7]),4&n[0]&&(r.target=e[2].name),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Wr(e){let t,n,r=e[13]&&Vr(e);return{c(){r&&r.c(),t=F()},m(e,i){r&&r.m(e,i),x(e,t,i),n=!0},p(e,n){e[13]?r?(r.p(e,n),8192&n[0]&&$e(r,1)):(r=Vr(e),r.c(),$e(r,1),r.m(t.parentNode,t)):r&&(ye(),Ie(r,1,1,()=>{r=null}),ve())},i(e){n||($e(r),n=!0)},o(e){Ie(r),n=!1},d(e){r&&r.d(e),e&&k(t)}}}function zr(e){let t,n,r,i,o={ctx:e,current:null,token:null,hasCatch:!1,pending:Fr,then:Mr,catch:Or,value:40,blocks:[,,,]};function s(t){e[34](t)}_e(e[21](),o);let a={class:"tModal",noClickaway:!0,$$slots:{default:[Wr]},$$scope:{ctx:e}};return void 0!==e[13]&&(a.open=e[13]),n=new e[18]({props:a}),re.push(()=>Se(n,"open",s)),{c(){o.block.c(),t=L(),Ne(n.$$.fragment)},m(e,r){o.block.m(e,o.anchor=r),o.mount=()=>t.parentNode,o.anchor=t,x(e,t,r),Te(n,e,r),i=!0},p(t,i){Ce(o,e=t,i);const s={};90276&i[0]|4096&i[1]&&(s.$$scope={dirty:i,ctx:e}),!r&&8192&i[0]&&(r=!0,s.open=e[13],ue(()=>r=!1)),n.$set(s)},i(e){i||($e(o.block),$e(n.$$.fragment,e),i=!0)},o(e){for(let e=0;e<3;e+=1){Ie(o.blocks[e])}Ie(n.$$.fragment,e),i=!1},d(e){o.block.d(e),o.token=null,o=null,e&&k(t),Re(n,e)}}}function Hr(e,n,r){const i=ee(),{Card:o,Modal:s,Dialog:a,Button:l}=c;let d,u,f,{id:h}=n,{item:m}=n,{record:p}=n,{value:g=[]}=n,{desc:w=""}=n,{noForm:y=!1}=n,{classId:v}=n,{eventId:$}=n,{recordId:I}=n,{withRefValue:_=!1}=n,{refValue:C=""}=n,{required:E}=n,{disabled:A}=n,{readonly:b}=n,{praefix:S}=n,{selectionFields:N}=n,{formnovalidate:T}=n,{selection:R}=n,{deList:D}=n,{isTemplate:x}=n,{noList:k=!1}=n,O=!1;const{lookup:M,refStatus:P,filter:B,constraint:L}=m.properties.multi;A=!0;const F=()=>{r(13,O=!1)};return e.$$set=e=>{"id"in e&&r(1,h=e.id),"item"in e&&r(2,m=e.item),"record"in e&&r(26,p=e.record),"value"in e&&r(12,g=e.value),"desc"in e&&r(3,w=e.desc),"noForm"in e&&r(4,y=e.noForm),"classId"in e&&r(5,v=e.classId),"eventId"in e&&r(6,$=e.eventId),"recordId"in e&&r(7,I=e.recordId),"withRefValue"in e&&r(27,_=e.withRefValue),"refValue"in e&&r(28,C=e.refValue),"required"in e&&r(8,E=e.required),"disabled"in e&&r(0,A=e.disabled),"readonly"in e&&r(9,b=e.readonly),"praefix"in e&&r(10,S=e.praefix),"selectionFields"in e&&r(29,N=e.selectionFields),"formnovalidate"in e&&r(11,T=e.formnovalidate),"selection"in e&&r(30,R=e.selection),"deList"in e&&r(31,D=e.deList),"isTemplate"in e&&r(32,x=e.isTemplate),"noList"in e&&r(33,k=e.noList)},[A,h,m,w,y,v,$,I,E,b,S,T,g,O,d,u,f,o,s,a,M,async()=>{r(15,u=[].concat(g)),r(14,d=await t.getSchemaByClass(m.refClass))},async()=>{let e,n;if(M)if(M.refClass){if(p[M.refClass]){const r=await xp(M.refClass,p[M.refClass]);r&&Array.isArray(r[M.refItem])&&(n=[{$match:{_id:{$in:r[M.refItem]}}}],e=await t.getSectionView(d.class,n,!0))}}else n=[{$match:{[M]:p[M]}}],P&&(n=n.concat([{$addFields:{_docId:{$toString:"$_id"}}},{$lookup:{from:"_task",localField:"_docId",foreignField:"docId",as:"_task"}},{$unwind:{path:"$_task",preserveNullAndEmptyArrays:!0}},{$match:{"_task.status":P}}])),e=await t.getSectionView(d.class,n,!0);else e=await Np("",d.id);if(!e?.length)return[];if(L&&e?.length){const{refClass:r,refStatus:i}=L,o=d.class===r?"_id":d.class;n=[{$match:{[o]:{$in:e.map(({_id:e})=>e)}}},{$addFields:{_docId:{$toString:"$_id"}}},{$lookup:{from:"_task",localField:"_docId",foreignField:"docId",as:"_task"}},{$unwind:{path:"$_task",preserveNullAndEmptyArrays:!0}},{$match:{"_task.status":i}}];const s=await t.getSectionView(r,n,!0);"project"!==r&&(e=e.filter(e=>!!s.find(t=>t.project==e._id)))}if(B)for(const t in B)e=e.filter(e=>{let[n,r]=t.split(".");if(r||(r=n,n=""),n){if(e[n][0]&&e[n][0][r].length)return!0}else if(e[r])return!0;return!1});return e},()=>{b||(r(13,O=!0),r(16,f=u))},({detail:e})=>{p.__id||(r(15,u=e.list),i("change",{value:u}),i("multi",{lookup:M,filter:B,name:m.name,value:u})),F()},F,p,_,C,N,R,D,x,k,function(e){O=e,r(13,O)}]}class jr extends xe{constructor(e){var t;super(),document.getElementById("svelte-1m792ni-style")||((t=M("style")).id="svelte-1m792ni-style",t.textContent=".field .card{padding:1em !important;margin-bottom:1em !important}",D(document.head,t)),De(this,e,Hr,zr,S,{id:1,item:2,record:26,value:12,desc:3,noForm:4,classId:5,eventId:6,recordId:7,withRefValue:27,refValue:28,required:8,disabled:0,readonly:9,praefix:10,selectionFields:29,formnovalidate:11,selection:30,deList:31,isTemplate:32,noList:33},[-1,-1])}}const qr=/\d+/g,Gr=/%[HMSpPdmyY%]/g;function Xr(e,t,n){const r=Math.floor((new Date).getFullYear()/100);let i=!1;if(""===e)return null;const o=t.split(Gr);let s=0,a=0;const l=new Date(0);for(const c of o){if(!e.startsWith(c,s))return n;if(s+=c.length,s===e.length){if(a!==t.length)return n;break}if("%"!==t[a+c.length])break;if(a+=c.length+1,"%"===t[a]){if("%"!==e[s])return n;s++}else if("p"===t[a].toLowerCase()){const t=e.substr(s,2).toUpperCase();if("AM"===t)i=!1,l.getHours()>=12&&l.setHours(l.getHours()-12);else{if("PM"!==t)return n;i=!0,l.getHours()<12&&l.setHours(l.getHours()+12)}}else{qr.lastIndex=s;const o=qr.exec(e);if(null==o)return n;switch(t[a]){case"H":l.setHours(parseInt(o[0])+12*i);break;case"M":l.setMinutes(o[0]);break;case"S":l.setSeconds(o[0]);break;case"d":l.setDate(o[0]);break;case"m":l.setMonth(o[0]-1);break;case"y":l.setFullYear(100*r+parseInt(o[0]));break;case"Y":l.setFullYear(o[0])}s+=o[0].length}a++}return isNaN(l.valueOf())?n:l}function Yr(e,t){return null==e||null==t?e:(t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t)}const{document:Zr}=Ee;function Kr(e,t,n){const r=e.slice();return r[17]=t[n],r}function Qr(e,t,n){const r=e.slice();return r[20]=t[n],r}function Jr(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function ei(e){let t,n,r,i,o,s,a,l,c,d,u,f,h,m=e[0].items,p=[];for(let t=0;t<m.length;t+=1)p[t]=ni(Qr(e,m,t));const g=e=>Ie(p[e],1,1,()=>{p[e]=null});let w=e[0].list&&ri(e);return l=new e[5]({props:{outline:!0,$$slots:{default:[oi]},$$scope:{ctx:e}}}),l.$on("click",e[9]),d=new e[5]({props:{disabled:e[2],class:"close",form:e[6],filled:!0,type:"submit",$$slots:{default:[si]},$$scope:{ctx:e}}}),{c(){t=M("form"),n=M("input"),i=L();for(let e=0;e<p.length;e+=1)p[e].c();o=L(),w&&w.c(),s=L(),a=M("div"),Ne(l.$$.fragment),c=L(),Ne(d.$$.fragment),z(n,"class",T(e[6])+" svelte-1phofh5"),z(n,"name","_id"),z(n,"type","hidden"),n.value=r=e[1]._id||"",z(t,"class","fTask svelte-1phofh5"),z(t,"id",e[6]),z(a,"class","form--buttons svelte-1phofh5")},m(r,m){x(r,t,m),D(t,n),D(t,i);for(let e=0;e<p.length;e+=1)p[e].m(t,null);D(t,o),w&&w.m(t,null),x(r,s,m),x(r,a,m),Te(l,a,null),D(a,c),Te(d,a,null),u=!0,f||(h=[V(t,"keydown",e[8]),V(t,"submit",U(e[10]))],f=!0)},p(e,i){if((!u||2&i&&r!==(r=e[1]._id||""))&&(n.value=r),75&i){let n;for(m=e[0].items,n=0;n<m.length;n+=1){const r=Qr(e,m,n);p[n]?(p[n].p(r,i),$e(p[n],1)):(p[n]=ni(r),p[n].c(),$e(p[n],1),p[n].m(t,o))}for(ye(),n=m.length;n<p.length;n+=1)g(n);ve()}e[0].list?w?(w.p(e,i),1&i&&$e(w,1)):(w=ri(e),w.c(),$e(w,1),w.m(t,null)):w&&(ye(),Ie(w,1,1,()=>{w=null}),ve());const s={};8388608&i&&(s.$$scope={dirty:i,ctx:e}),l.$set(s);const a={};4&i&&(a.disabled=e[2]),8388608&i&&(a.$$scope={dirty:i,ctx:e}),d.$set(a)},i(e){if(!u){for(let e=0;e<m.length;e+=1)$e(p[e]);$e(w),$e(l.$$.fragment,e),$e(d.$$.fragment,e),u=!0}},o(e){p=p.filter(Boolean);for(let e=0;e<p.length;e+=1)Ie(p[e]);Ie(w),Ie(l.$$.fragment,e),Ie(d.$$.fragment,e),u=!1},d(e){e&&k(t),O(p,e),w&&w.d(),e&&k(s),e&&k(a),Re(l),Re(d),f=!1,A(h)}}}function ti(e){let t,n;return t=new Su({props:{classId:e[6],item:e[20],selection:e[20].selection,record:e[1],disabled:e[3],eventId:e[0].id,required:!1,isTemplate:!0}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};1&n&&(r.item=e[20]),1&n&&(r.selection=e[20].selection),2&n&&(r.record=e[1]),8&n&&(r.disabled=e[3]),1&n&&(r.eventId=e[0].id),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function ni(e){let t,n,r=ci(!0,e[20]),i=r&&ti(e);return{c(){i&&i.c(),t=F()},m(e,r){i&&i.m(e,r),x(e,t,r),n=!0},p(e,n){1&n&&(r=ci(!0,e[20])),r?i?(i.p(e,n),1&n&&$e(i,1)):(i=ti(e),i.c(),$e(i,1),i.m(t.parentNode,t)):i&&(ye(),Ie(i,1,1,()=>{i=null}),ve())},i(e){n||($e(i),n=!0)},o(e){Ie(i),n=!1},d(e){i&&i.d(e),e&&k(t)}}}function ri(e){let t,n,r=e[0].list,i=[];for(let t=0;t<r.length;t+=1)i[t]=ii(Kr(e,r,t));const o=e=>Ie(i[e],1,1,()=>{i[e]=null});return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=F()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);x(e,t,r),n=!0},p(e,n){if(75&n){let s;for(r=e[0].list,s=0;s<r.length;s+=1){const o=Kr(e,r,s);i[s]?(i[s].p(o,n),$e(i[s],1)):(i[s]=ii(o),i[s].c(),$e(i[s],1),i[s].m(t.parentNode,t))}for(ye(),s=r.length;s<i.length;s+=1)o(s);ve()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)$e(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)Ie(i[e]);n=!1},d(e){O(i,e),e&&k(t)}}}function ii(e){let t,n,r,i;return t=new e[4]({props:{text:e[17].designation}}),r=new Ii({props:{classId:e[6],list:e[17],eventId:e[0].id,schema:e[17].item,record:e[1],disabled:e[3],required:!1,open:!0,isTemplate:!0}}),{c(){Ne(t.$$.fragment),n=L(),Ne(r.$$.fragment)},m(e,o){Te(t,e,o),x(e,n,o),Te(r,e,o),i=!0},p(e,n){const i={};1&n&&(i.text=e[17].designation),t.$set(i);const o={};1&n&&(o.list=e[17]),1&n&&(o.eventId=e[0].id),1&n&&(o.schema=e[17].item),2&n&&(o.record=e[1]),8&n&&(o.disabled=e[3]),r.$set(o)},i(e){i||($e(t.$$.fragment,e),$e(r.$$.fragment,e),i=!0)},o(e){Ie(t.$$.fragment,e),Ie(r.$$.fragment,e),i=!1},d(e){Re(t,e),e&&k(n),Re(r,e)}}}function oi(e){let t;return{c(){t=B("Abbrechen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function si(e){let t;return{c(){t=B("Speichern")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function ai(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function li(e){let t,n,r,i={ctx:e,current:null,token:null,hasCatch:!1,pending:ai,then:ei,catch:Jr,value:16,blocks:[,,,]};return _e(e[7](),i),{c(){t=L(),n=M("section"),i.block.c(),Zr.title="Vorgaben",z(n,"class","sTask svelte-1phofh5")},m(e,o){x(e,t,o),x(e,n,o),i.block.m(n,i.anchor=null),i.mount=()=>n,i.anchor=null,r=!0},p(t,[n]){Ce(i,e=t,n)},i(e){r||($e(i.block),r=!0)},o(e){for(let e=0;e<3;e+=1){Ie(i.blocks[e])}r=!1},d(e){e&&k(t),e&&k(n),i.block.d(),i.token=null,i=null}}}const ci=(e,{type:t="",properties:n={}})=>!e||"list"!==t&&("time"===n.format&&(t="time"),!["date","datetime","time"].includes(t)&&(!n.readonly&&!n.hidden));function di(e,r,s){let l,d,u;N(e,o,e=>s(11,d=e)),N(e,i,e=>s(12,u=e));const{Divider:f,Button:h,FormField:m}=c,p=JSON.parse(n.getItem("Locale"));let{schema:g}=r,{record:w}=r,y="template-"+g.class+Math.floor(9e3*Math.random()+1e3).toString(),v=!1;const $=()=>window.history.back(),I=(e,t,n=!1)=>{const r=t.id,i=e.find(e=>e.name===r);let o=t.value;if(!n&&i&&i.properties?.multi&&(o=w[r]),o&&i&&i.type.startsWith("date"))try{return Xr(o,"%d.%m.%Y").toISOString()}catch{return new Date(o).toISOString()}if(i&&"boolean"===i.type&&(o=!!t.checked),i&&"number"===i.type){const e=Number("1.1").toLocaleString(p.id).substring(1,2);try{o=Number(o.replace(e,".")).toString()}catch{}}return o};return e.$$set=e=>{"schema"in e&&s(0,g=e.schema),"record"in e&&s(1,w=e.record)},e.$$.update=()=>{4&e.$$.dirty&&s(3,l=v)},[g,w,v,l,f,h,y,async()=>{const e=await t.getEvent(g.id);if(e.trigger?.startOn&&!e.trigger?.startOn?.some(e=>"Manual"===e.type)&&s(2,v=!0),d.role?.length&&g.authorization?.length){const e=g.authorization.some(e=>u?.find(t=>t===e.role&&"edit"===e.activity));s(2,v||=!e)}},e=>{"button"!==e.srcElement?.type&&"textarea"!==e.srcElement?.type&&13==e.which&&e.preventDefault()},$,async e=>{const n={};Array.from(document.querySelectorAll("form#"+y+" ."+y)).map(e=>{const t=e.id||e.name;if(t)if(t.includes(".")){const[r,i]=t.split("."),o=g.list.find(e=>e.name===r);n[t]=I(o.item,e)}else n[t]=I(g.items,e)}),await t.saveTemplate(g.class,n),a.success("Die Vorgaben wurden gespeichert.",2e3),$()}]}const{document:ui}=Ee;function fi(e,t,n){const r=e.slice();return r[35]=t[n],r}function hi(e){let t,n;return t=new Su({props:{classId:e[3],item:e[35],listName:e[2].name,eventId:e[4],record:e[0],disabled:e[5],required:e[6],currency:e[9],notifyList:e[1]}}),t.$on("notify",e[15]),t.$on("defPrep",e[17]),t.$on("formula",e[19]),t.$on("task",e[23]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};8&n[0]&&(r.classId=e[3]),4&n[0]&&(r.item=e[35]),4&n[0]&&(r.listName=e[2].name),16&n[0]&&(r.eventId=e[4]),1&n[0]&&(r.record=e[0]),32&n[0]&&(r.disabled=e[5]),64&n[0]&&(r.required=e[6]),512&n[0]&&(r.currency=e[9]),2&n[0]&&(r.notifyList=e[1]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function mi(e){let t,n,r=ci(e[8],e[35]),i=r&&hi(e);return{c(){i&&i.c(),t=F()},m(e,r){i&&i.m(e,r),x(e,t,r),n=!0},p(e,n){260&n[0]&&(r=ci(e[8],e[35])),r?i?(i.p(e,n),260&n[0]&&$e(i,1)):(i=hi(e),i.c(),$e(i,1),i.m(t.parentNode,t)):i&&(ye(),Ie(i,1,1,()=>{i=null}),ve())},i(e){n||($e(i),n=!0)},o(e){Ie(i),n=!1},d(e){i&&i.d(e),e&&k(t)}}}function pi(e){let t,n,r,i=e[2].item,o=[];for(let t=0;t<i.length;t+=1)o[t]=mi(fi(e,i,t));const s=e=>Ie(o[e],1,1,()=>{o[e]=null});return{c(){t=M("div");for(let e=0;e<o.length;e+=1)o[e].c();z(t,"id",n=`accordion-content-${e[3]}-${e[2].name}`)},m(e,n){x(e,t,n);for(let e=0;e<o.length;e+=1)o[e].m(t,null);r=!0},p(e,a){if(689023&a[0]){let n;for(i=e[2].item,n=0;n<i.length;n+=1){const r=fi(e,i,n);o[n]?(o[n].p(r,a),$e(o[n],1)):(o[n]=mi(r),o[n].c(),$e(o[n],1),o[n].m(t,null))}for(ye(),n=i.length;n<o.length;n+=1)s(n);ve()}(!r||12&a[0]&&n!==(n=`accordion-content-${e[3]}-${e[2].name}`))&&z(t,"id",n)},i(e){if(!r){for(let e=0;e<i.length;e+=1)$e(o[e]);r=!0}},o(e){o=o.filter(Boolean);for(let e=0;e<o.length;e+=1)Ie(o[e]);r=!1},d(e){e&&k(t),O(o,e)}}}function gi(e){let t,n,r=e[14](e[10])+"";return{c(){t=M("span"),n=B(r)},m(e,r){x(e,t,r),D(t,n)},p(e,t){1024&t[0]&&r!==(r=e[14](e[10])+"")&&H(n,r)},d(e){e&&k(t)}}}function wi(e){let t,n,r;return n=new e[11]({props:{$$slots:{default:[gi]},$$scope:{ctx:e}}}),n.$on("click",function(){b(e[16](e[34]))&&e[16](e[34]).apply(this,arguments)}),{c(){t=M("div"),Ne(n.$$.fragment),z(t,"class","accordion svelte-148ktt9"),z(t,"slot","handle")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p(t,r){e=t;const i={};1024&r[0]|128&r[1]&&(i.$$scope={dirty:r,ctx:e}),n.$set(i)},i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function yi(e){let t,n;return t=new e[13]({props:{open:e[7],$$slots:{handle:[wi,({toggle:e})=>({34:e}),({toggle:e})=>[0,e?8:0]],default:[pi,({toggle:e})=>({34:e}),({toggle:e})=>[0,e?8:0]]},$$scope:{ctx:e}}}),t.$on("panel-open",e[18]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};128&n[0]&&(r.open=e[7]),1919&n[0]|136&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function vi(e){let t,n,r;return n=new e[12]({props:{$$slots:{default:[yi]},$$scope:{ctx:e}}}),{c(){t=M("div"),Ne(n.$$.fragment),z(t,"class","formList")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p(e,t){const r={};2047&t[0]|128&t[1]&&(r.$$scope={dirty:t,ctx:e}),n.$set(r)},i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function $i(e,n,r){const{Button:i,Accordion:o,AccordionSection:s}=c;let{list:a}=n,{schema:l}=n,{record:d}=n,{classId:u}=n,{eventId:f}=n,{disabled:h}=n,{required:y}=n,{open:v=!1}=n,{template:$={}}=n,{isTemplate:I=!1}=n,{currency:_}=n,{update:C=!1}=n,{notifyList:E}=n,A=new Map;const b={};let S=d[a.name]||{};d[a.name]=S;const N=(e,t)=>""===t[e.name]?"":e._attr?T(e,t[e.name]):"object"===e.type?D(t[e.name]):Array.isArray(t[e.name])?R(t[e.name]):"boolean"===e.type?w(t[e.name]):"number"===e.type?x(t[e.name],e.properties?.decimals||0):"dateRange"===e.type?g(e.name,t):"date"===e.type?m(gDate(t[e.name])):"datetime"===e.type?p(t[e.name]):e.properties?.multi?"":t[e.name],T=(e,t)=>b[t]?.split(" • ").at(e._attr),R=e=>e.slice(0,3).join(", "),D=e=>b[e]?.split(" • ").filter(e=>!!e).slice(0,2).join(" · "),x=(e,t)=>(t||=0,"number"==typeof e&&e||(e=Number(e||0)),(+(Math.round(e+"e+"+t)+"e-"+t)).toFixed(t)),k=e=>{if(!e)return;const{style:t,scrollHeight:n}=e;n&&(t.height=`${n}px`)},O=async({item:e,value:t})=>{const n=l.find(t=>t.properties?.value?.formula?.argument?.find(t=>t.refItem===e.name));if(!n)return;const i=n.properties.value.formula,{operator:o,argument:s}=i,c=s.map(n=>n.refItem===e.name?t:S[n.refItem]||d[n.refItem]);let u=0;"$add"===o&&(u=c.reduce((e,t)=>+(e||0)+ +(t||0))),r(0,d[a.name][n.name]=x(u,n.properties?.decimals),d)};return e.$$set=e=>{"list"in e&&r(2,a=e.list),"schema"in e&&r(20,l=e.schema),"record"in e&&r(0,d=e.record),"classId"in e&&r(3,u=e.classId),"eventId"in e&&r(4,f=e.eventId),"disabled"in e&&r(5,h=e.disabled),"required"in e&&r(6,y=e.required),"open"in e&&r(7,v=e.open),"template"in e&&r(21,$=e.template),"isTemplate"in e&&r(8,I=e.isTemplate),"currency"in e&&r(9,_=e.currency),"update"in e&&r(22,C=e.update),"notifyList"in e&&r(1,E=e.notifyList)},e.$$.update=()=>{4194309&e.$$.dirty[0]&&C&&d&&r(10,S=d[a.name]||{})},[d,E,a,u,f,h,y,v,I,_,S,i,o,s,e=>{let t=l;return a.display?.refItem&&(t=a.display.refItem.map(e=>{const[t,n]=e.split("."),r=l.find(e=>e.name===t);if(r)return r._attr=n,r}).filter(e=>!!e)),e&&t.filter(t=>!0!==t.properties?.hidden&&("dateRange"===t.type||void 0!==e[t.name])&&"html"!==t.properties?.format&&"textarea"!==t.properties?.format).map(t=>N(t,e)).filter(e=>!!e).join(" • ")||"+"},({detail:e})=>{const[t,n]=e.itemName.split(".");if(!n)return;r(1,E={listName:a.name,itemName:e.itemName,value:e.value}),e.desc&&(b[n]=e.desc);const i=d[t];r(0,d[t]={...i,[n]:e.value},d),r(10,S=d[t])},e=>t=>{(()=>{const e=$[a.name]||{};for(const t in e)$[a.name][t]&&!d[a.name][t]&&r(0,d[a.name][t]=$[a.name][t],d)})(),e(t);const n=`#accordion-content-${u}-${a.name} > div.form-field:last-child`;document.querySelector(n),ce().then(()=>{const e=`#accordion-content-${u}-${a.name} textarea`;Array.from(document.querySelectorAll(e)).forEach(k)})},async({detail:{className:e,itemName:n,value:r}})=>{if(A.has(e))return;if(!0!==r&&(r=(r=[].concat(r)).some(e=>e===className+"."+a.name)),!r)return;const i={[n]:!0},o=await t.getSectionView(e,i);o?.length&&A.set(e,o[0])},()=>{setTimeout(()=>{Array.from(A).forEach(([e,t])=>{d[a.name][e]||r(0,d[a.name][e]=t._id,d)})},500)},({detail:e})=>{O(e)},l,$,C,function(t){te(e,t)}]}class Ii extends xe{constructor(e){var t;super(),ui.getElementById("svelte-148ktt9-style")||((t=M("style")).id="svelte-148ktt9-style",t.textContent=".accordion.svelte-148ktt9{display:flex}.formList .accordion > .btn{display:inline-block;width:97%;margin-bottom:1em;background-color:#F5F5F5}@media screen and (max-width: 600px){.formList .accordion > .btn{width:25em}}",D(ui.head,t)),De(this,e,$i,vi,S,{list:2,schema:20,record:0,classId:3,eventId:4,disabled:5,required:6,open:7,template:21,isTemplate:8,currency:9,update:22,notifyList:1},[-1,-1])}}const{document:_i}=Ee;function Ci(e){e[0]=e[23].list,e[22]=e[23].items}function Ei(e,t,n){const r=e.slice();return r[24]=t[n],r}function Ai(e,t,n){const r=e.slice();return r[27]=t[n],r}function bi(e,t,n){const r=e.slice();return r[27]=t[n],r}function Si(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Ni(e){let t,n,r,i,o,s,a,l,c,d,u,f,h,m,p,g,w,y;function v(t){e[19](t)}Ci(e),n=new e[7]({props:{outline:!0,$$slots:{default:[Ti]},$$scope:{ctx:e}}}),n.$on("click",e[18]);let $={id:e[8]};void 0!==e[1]&&($.value=e[1]),s=new e[6]({props:$}),re.push(()=>Se(s,"value",v)),s.$on("input",e[12]),d=new ot({props:{size:"18"}});let I=e[22]?.length&&function(e){let t,n,r=e[22],i=[];for(let t=0;t<r.length;t+=1)i[t]=Ri(bi(e,r,t));return{c(){t=M("thead"),n=M("tr");for(let e=0;e<i.length;e+=1)i[e].c();z(n,"class","svelte-14hcfjl"),z(t,"class","svelte-14hcfjl")},m(e,r){x(e,t,r),D(t,n);for(let e=0;e<i.length;e+=1)i[e].m(n,null)},p(e,t){if(2048&t[0]){let o;for(r=e[22],o=0;o<r.length;o+=1){const s=bi(e,r,o);i[o]?i[o].p(s,t):(i[o]=Ri(s),i[o].c(),i[o].m(n,null))}for(;o<i.length;o+=1)i[o].d(1);i.length=r.length}},d(e){e&&k(t),O(i,e)}}}(e),_=e[0]?.length&&function(e){let t,n=e[0],r=[];for(let t=0;t<n.length;t+=1)r[t]=ki(Ei(e,n,t));return{c(){for(let e=0;e<r.length;e+=1)r[e].c();t=F()},m(e,n){for(let t=0;t<r.length;t+=1)r[t].m(e,n);x(e,t,n)},p(e,i){if(11778&i[0]){let o;for(n=e[0],o=0;o<n.length;o+=1){const s=Ei(e,n,o);r[o]?r[o].p(s,i):(r[o]=ki(s),r[o].c(),r[o].m(t.parentNode,t))}for(;o<r.length;o+=1)r[o].d(1);r.length=n.length}},d(e){O(r,e),e&&k(t)}}}(e);return{c(){t=M("div"),Ne(n.$$.fragment),r=L(),i=M("div"),o=B("Suchen: "),Ne(s.$$.fragment),l=L(),c=M("span"),Ne(d.$$.fragment),u=L(),f=M("div"),h=M("table"),I&&I.c(),m=L(),p=M("tbody"),_&&_.c(),z(t,"class","form--buttons svelte-14hcfjl"),z(c,"class","feather pointer svelte-14hcfjl"),q(i,"margin-bottom","1em"),q(i,"position","relative"),z(h,"striped",""),z(h,"class","svelte-14hcfjl"),z(f,"class","eList svelte-14hcfjl")},m(a,v){x(a,t,v),Te(n,t,null),x(a,r,v),x(a,i,v),D(i,o),Te(s,i,null),D(i,l),D(i,c),Te(d,c,null),x(a,u,v),x(a,f,v),D(f,h),I&&I.m(h,null),D(h,m),D(h,p),_&&_.m(p,null),g=!0,w||(y=V(c,"click",e[14]),w=!0)},p(e,t){Ci(e);const r={};2&t[1]&&(r.$$scope={dirty:t,ctx:e}),n.$set(r);const i={};!a&&2&t[0]&&(a=!0,i.value=e[1],ue(()=>a=!1)),s.$set(i),e[22]?.length&&I.p(e,t),e[0]?.length&&_.p(e,t)},i(e){g||($e(n.$$.fragment,e),$e(s.$$.fragment,e),$e(d.$$.fragment,e),g=!0)},o(e){Ie(n.$$.fragment,e),Ie(s.$$.fragment,e),Ie(d.$$.fragment,e),g=!1},d(e){e&&k(t),Re(n),e&&k(r),e&&k(i),Re(s),Re(d),e&&k(u),e&&k(f),I&&I.d(),_&&_.d(),w=!1,y()}}}function Ti(e){let t;return{c(){t=B("Abbrechen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Ri(e){let t,n,r=e[27]?.designation+"";return{c(){t=M("th"),n=B(r),z(t,"class","svelte-14hcfjl")},m(e,r){x(e,t,r),D(t,n)},p:_,d(e){e&&k(t)}}}function Di(e){let t,n,r=e[22],i=[];for(let t=0;t<r.length;t+=1)i[t]=xi(Ai(e,r,t));return{c(){t=M("tr");for(let e=0;e<i.length;e+=1)i[e].c();n=L(),z(t,"class","pointer svelte-14hcfjl")},m(e,r){x(e,t,r);for(let e=0;e<i.length;e+=1)i[e].m(t,null);D(t,n)},p(e,o){if(3584&o[0]){let s;for(r=e[22],s=0;s<r.length;s+=1){const a=Ai(e,r,s);i[s]?i[s].p(a,o):(i[s]=xi(a),i[s].c(),i[s].m(t,n))}for(;s<i.length;s+=1)i[s].d(1);i.length=r.length}},d(e){e&&k(t),O(i,e)}}}function xi(e){let t,n,r,i,o=e[9](e[24],e[27])+"";return{c(){t=M("td"),n=B(o),z(t,"class","svelte-14hcfjl")},m(o,s){x(o,t,s),D(t,n),r||(i=V(t,"click",W(e[10](e[24]))),r=!0)},p(t,n){e=t},d(e){e&&k(t),r=!1,i()}}}function ki(e){let t,n=e[13](e[24],e[22],e[1]),r=n&&Di(e);return{c(){r&&r.c(),t=F()},m(e,n){r&&r.m(e,n),x(e,t,n)},p(e,i){2&i[0]&&(n=e[13](e[24],e[22],e[1])),n?r?r.p(e,i):(r=Di(e),r.c(),r.m(t.parentNode,t)):r&&(r.d(1),r=null)},d(e){r&&r.d(e),e&&k(t)}}}function Oi(e){let t,n;return t=new e[5]({}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p:_,i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Mi(e){let t,n,r,i;t=new e[4]({});let o={ctx:e,current:null,token:null,hasCatch:!1,pending:Oi,then:Ni,catch:Si,value:23,blocks:[,,,]};return _e(e[11](),o),{c(){Ne(t.$$.fragment),n=L(),r=F(),o.block.c()},m(e,s){Te(t,e,s),x(e,n,s),x(e,r,s),o.block.m(e,o.anchor=s),o.mount=()=>r.parentNode,o.anchor=r,i=!0},p(t,n){Ce(o,e=t,n)},i(e){i||($e(t.$$.fragment,e),$e(o.block),i=!0)},o(e){Ie(t.$$.fragment,e);for(let e=0;e<3;e+=1){Ie(o.blocks[e])}i=!1},d(e){Re(t,e),e&&k(n),e&&k(r),o.block.d(e),o.token=null,o=null}}}function Pi(e){let t,n;return t=new e[3]({props:{title:"Auswahl",class:"eList",$$slots:{default:[Mi]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};2&n[0]|2&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Bi(e,n,r){const i=ee(),{Dialog:o,Divider:s,Loading:a,TextField:l,Button:d}=c;let{item:u}=n,{className:f}=n,{classId:h}=n,{list:p}=n,g="",y=h+Math.floor(9e3*Math.random()+1e3).toString()+"search";const v=(e,t)=>{if(!t)return;const n=e[t.name];return"boolean"==typeof n?w(n):m(e[`_${t.name}`]||e[t.name]||"")},$=t.getSchemaByClass(f);Q(()=>{window.setTimeout(()=>{const e=document.querySelector("tr.active");e&&e.scrollIntoView({block:"end",behavior:"smooth"}),document.getElementById(y)?.focus()},200)});return e.$$set=e=>{"item"in e&&r(15,u=e.item),"className"in e&&r(16,f=e.className),"classId"in e&&r(17,h=e.classId),"list"in e&&r(0,p=e.list)},[p,g,i,o,s,a,l,d,y,v,e=>()=>i("choose",{row:e}),async()=>{const e=await $,t=e.display;let n=await tn(t,e,p);return{list:p,items:n}},({detail:{value:e}})=>{r(1,g=e)},(e,t,n)=>{if(!n)return!0;for(const r of t)if(v(e,r)?.toLowerCase()?.includes(n.toLowerCase()))return!0;return!1},()=>{r(1,g="")},u,f,h,()=>i("back"),function(e){g=e,r(1,g)}]}class Li extends xe{constructor(e){var t;super(),_i.getElementById("svelte-14hcfjl-style")||((t=M("style")).id="svelte-14hcfjl-style",t.textContent=".feather.svelte-14hcfjl.svelte-14hcfjl{position:absolute;top:2em;right:0.5em;color:#326173}.eList.svelte-14hcfjl.svelte-14hcfjl{height:fit-content;max-height:65vh;overflow-y:scroll;overflow-x:auto}.eList.svelte-14hcfjl table.svelte-14hcfjl{min-width:30vw;position:relative;width:max-content !important;max-width:50vh !important}.eList.svelte-14hcfjl table thead.svelte-14hcfjl{position:sticky;top:0;background:#326173;color:white}.eList.svelte-14hcfjl table tbody tr.svelte-14hcfjl{height:2.3em}th.svelte-14hcfjl.svelte-14hcfjl,td.svelte-14hcfjl.svelte-14hcfjl{padding-left:0.4em;padding-right:0.4em}tr.pointer.svelte-14hcfjl.svelte-14hcfjl:hover{background-color:#DAE1E5}.form--buttons.svelte-14hcfjl.svelte-14hcfjl{display:flex;gap:1em;padding:0.5em 0}",D(_i.head,t)),De(this,e,Bi,Pi,S,{item:15,className:16,classId:17,list:0},[-1,-1])}}const{document:Fi}=Ee;function Vi(e,t,n){const r=e.slice();return r[12]=t[n],r}function Ui(e,t,n){const r=e.slice();return r[4]=t[n],r}function Wi(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function zi(e){let t,n,r,i=e[8].items,o=[];for(let t=0;t<i.length;t+=1)o[t]=Xi(Ui(e,i,t));const s=e=>Ie(o[e],1,1,()=>{o[e]=null});let a=e[8].list&&Yi(e);return{c(){for(let e=0;e<o.length;e+=1)o[e].c();t=L(),a&&a.c(),n=F()},m(e,i){for(let t=0;t<o.length;t+=1)o[t].m(e,i);x(e,t,i),a&&a.m(e,i),x(e,n,i),r=!0},p(e,r){if(60655567&r[0]){let n;for(i=e[8].items,n=0;n<i.length;n+=1){const s=Ui(e,i,n);o[n]?(o[n].p(s,r),$e(o[n],1)):(o[n]=Xi(s),o[n].c(),$e(o[n],1),o[n].m(t.parentNode,t))}for(ye(),n=i.length;n<o.length;n+=1)s(n);ve()}e[8].list?a?(a.p(e,r),256&r[0]&&$e(a,1)):(a=Yi(e),a.c(),$e(a,1),a.m(n.parentNode,n)):a&&(ye(),Ie(a,1,1,()=>{a=null}),ve())},i(e){if(!r){for(let e=0;e<i.length;e+=1)$e(o[e]);$e(a),r=!0}},o(e){o=o.filter(Boolean);for(let e=0;e<o.length;e+=1)Ie(o[e]);Ie(a),r=!1},d(e){O(o,e),e&&k(t),a&&a.d(e),e&&k(n)}}}function Hi(e){let t,n,r,i;const o=[qi,ji],s=[];function a(e,t){return e[4].name!==e[15]||e[16]?"lookup"!==e[4].properties?.format?1:-1:0}return~(t=a(e))&&(n=s[t]=o[t](e)),{c(){n&&n.c(),r=F()},m(e,n){~t&&s[t].m(e,n),x(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?~t&&s[t].p(e,i):(n&&(ye(),Ie(s[l],1,1,()=>{s[l]=null}),ve()),~t?(n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),$e(n,1),n.m(r.parentNode,r)):n=null)},i(e){i||($e(n),i=!0)},o(e){Ie(n),i=!1},d(e){~t&&s[t].d(e),e&&k(r)}}}function ji(e){let t,n;return t=new Su({props:{classId:e[9],item:e[4],record:e[7],disabled:e[4].name===e[15]&&e[16]||e[0],eventId:e[6],notifyList:e[2],currency:e[3],changeValue:e[10]}}),t.$on("notify",e[18]),t.$on("multi",e[19]),t.$on("defPrep",e[20]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),256&n[0]&&(r.item=e[4]),128&n[0]&&(r.record=e[7]),257&n[0]&&(r.disabled=e[4].name===e[15]&&e[16]||e[0]),64&n[0]&&(r.eventId=e[6]),4&n[0]&&(r.notifyList=e[2]),8&n[0]&&(r.currency=e[3]),1024&n[0]&&(r.changeValue=e[10]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function qi(e){let t,n,r,i;n=new Su({props:{classId:e[9],item:e[4],record:e[7],disabled:e[0]||!!e[1],required:!0,eventId:e[6],notifyList:!0,currency:e[3],changeValue:e[10]}}),n.$on("notify",e[18]),n.$on("multi",e[19]),n.$on("defPrep",e[20]),n.$on("record",e[24]),n.$on("objRecord",e[25]);let o=e[1]&&Gi(e);return{c(){t=M("div"),Ne(n.$$.fragment),r=L(),o&&o.c(),q(t,"padding-top",".25em"),q(t,"background-color","lightyellow"),q(t,"position","relative")},m(e,s){x(e,t,s),Te(n,t,null),D(t,r),o&&o.m(t,null),i=!0},p(e,r){const i={};512&r[0]&&(i.classId=e[9]),256&r[0]&&(i.item=e[4]),128&r[0]&&(i.record=e[7]),3&r[0]&&(i.disabled=e[0]||!!e[1]),64&r[0]&&(i.eventId=e[6]),8&r[0]&&(i.currency=e[3]),1024&r[0]&&(i.changeValue=e[10]),n.$set(i),e[1]?o?(o.p(e,r),2&r[0]&&$e(o,1)):(o=Gi(e),o.c(),$e(o,1),o.m(t,null)):o&&(ye(),Ie(o,1,1,()=>{o=null}),ve())},i(e){i||($e(n.$$.fragment,e),$e(o),i=!0)},o(e){Ie(n.$$.fragment,e),Ie(o),i=!1},d(e){e&&k(t),Re(n),o&&o.d()}}}function Gi(e){let t,n,r,i,o;return n=new ot({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather2 pointer svelte-16mo2c")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[23]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function Xi(e){let t,n,r="list"!==e[4].type&&Hi(e);return{c(){r&&r.c(),t=F()},m(e,i){r&&r.m(e,i),x(e,t,i),n=!0},p(e,n){"list"!==e[4].type?r?(r.p(e,n),256&n[0]&&$e(r,1)):(r=Hi(e),r.c(),$e(r,1),r.m(t.parentNode,t)):r&&(ye(),Ie(r,1,1,()=>{r=null}),ve())},i(e){n||($e(r),n=!0)},o(e){Ie(r),n=!1},d(e){r&&r.d(e),e&&k(t)}}}function Yi(e){let t,n,r=e[8].list,i=[];for(let t=0;t<r.length;t+=1)i[t]=Ki(Vi(e,r,t));const o=e=>Ie(i[e],1,1,()=>{i[e]=null});return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=F()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);x(e,t,r),n=!0},p(e,n){if(973&n[0]){let s;for(r=e[8].list,s=0;s<r.length;s+=1){const o=Vi(e,r,s);i[s]?(i[s].p(o,n),$e(i[s],1)):(i[s]=Ki(o),i[s].c(),$e(i[s],1),i[s].m(t.parentNode,t))}for(ye(),s=r.length;s<i.length;s+=1)o(s);ve()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)$e(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)Ie(i[e]);n=!1},d(e){O(i,e),e&&k(t)}}}function Zi(e){let t,n,r,i,o;function s(t){e[31](t)}t=new e[13]({props:{text:e[12].designation}});let a={classId:e[9],list:e[12],eventId:e[6],schema:e[12].item,record:e[7],disabled:e[0],currency:e[3],update:!0};return void 0!==e[2]&&(a.notifyList=e[2]),r=new Ii({props:a}),re.push(()=>Se(r,"notifyList",s)),{c(){Ne(t.$$.fragment),n=L(),Ne(r.$$.fragment)},m(e,i){Te(t,e,i),x(e,n,i),Te(r,e,i),o=!0},p(e,n){const o={};256&n[0]&&(o.text=e[12].designation),t.$set(o);const s={};512&n[0]&&(s.classId=e[9]),256&n[0]&&(s.list=e[12]),64&n[0]&&(s.eventId=e[6]),256&n[0]&&(s.schema=e[12].item),128&n[0]&&(s.record=e[7]),1&n[0]&&(s.disabled=e[0]),8&n[0]&&(s.currency=e[3]),!i&&4&n[0]&&(i=!0,s.notifyList=e[2],ue(()=>i=!1)),r.$set(s)},i(e){o||($e(t.$$.fragment,e),$e(r.$$.fragment,e),o=!0)},o(e){Ie(t.$$.fragment,e),Ie(r.$$.fragment,e),o=!1},d(e){Re(t,e),e&&k(n),Re(r,e)}}}function Ki(e){let t,n,r="array"!==e[12].type&&Zi(e);return{c(){r&&r.c(),t=F()},m(e,i){r&&r.m(e,i),x(e,t,i),n=!0},p(e,n){"array"!==e[12].type?r?(r.p(e,n),256&n[0]&&$e(r,1)):(r=Zi(e),r.c(),$e(r,1),r.m(t.parentNode,t)):r&&(ye(),Ie(r,1,1,()=>{r=null}),ve())},i(e){n||($e(r),n=!0)},o(e){Ie(r),n=!1},d(e){r&&r.d(e),e&&k(t)}}}function Qi(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Ji(e){let t,n;return t=new Li({props:{item:e[4],className:e[5],classId:e[9],list:e[12]}}),t.$on("choose",e[21]),t.$on("back",e[22]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};16&n[0]&&(r.item=e[4]),32&n[0]&&(r.className=e[5]),512&n[0]&&(r.classId=e[9]),4096&n[0]&&(r.list=e[12]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function eo(e){let t,n,r=e[11]&&Ji(e);return{c(){r&&r.c(),t=F()},m(e,i){r&&r.m(e,i),x(e,t,i),n=!0},p(e,n){e[11]?r?(r.p(e,n),2048&n[0]&&$e(r,1)):(r=Ji(e),r.c(),$e(r,1),r.m(t.parentNode,t)):r&&(ye(),Ie(r,1,1,()=>{r=null}),ve())},i(e){n||($e(r),n=!0)},o(e){Ie(r),n=!1},d(e){r&&r.d(e),e&&k(t)}}}function to(e){let t,n,r,i,o,s,a={ctx:e,current:null,token:null,hasCatch:!1,pending:Qi,then:zi,catch:Wi,value:56,blocks:[,,,]};function l(t){e[32](t)}_e(e[17](),a),n=new e[13]({});let c={class:"tModal",noClickaway:!0,$$slots:{default:[eo]},$$scope:{ctx:e}};return void 0!==e[11]&&(c.open=e[11]),i=new e[14]({props:c}),re.push(()=>Se(i,"open",l)),{c(){a.block.c(),t=L(),Ne(n.$$.fragment),r=L(),Ne(i.$$.fragment)},m(e,o){a.block.m(e,a.anchor=o),a.mount=()=>t.parentNode,a.anchor=t,x(e,t,o),Te(n,e,o),x(e,r,o),Te(i,e,o),s=!0},p(t,n){Ce(a,e=t,n);const r={};6704&n[0]|1073741824&n[1]&&(r.$$scope={dirty:n,ctx:e}),!o&&2048&n[0]&&(o=!0,r.open=e[11],ue(()=>o=!1)),i.$set(r)},i(e){s||($e(a.block),$e(n.$$.fragment,e),$e(i.$$.fragment,e),s=!0)},o(e){for(let e=0;e<3;e+=1){Ie(a.blocks[e])}Ie(n.$$.fragment,e),Ie(i.$$.fragment,e),s=!1},d(e){a.block.d(e),a.token=null,a=null,e&&k(t),Re(n,e),e&&k(r),Re(i,e)}}}function no(e,n,r){const{Divider:i,FormField:o,Modal:s}=c,a=ee();let l,d,u,f,h,{required:m}=n,{disabled:p}=n,{readonly:g}=n,{id:w}=n,{item:y}=n,{value:v}=n,{refValue:$}=n,{currency:I}=n,{notifyList:_}=n,C={},E=[],A=[],b={},S=new Map,N=!1,T="";const R=y.checkOn,D=v,x=e=>{l.items.filter(t=>"object"==typeof(t.properties&&t.properties[e])).map(t=>{const n=t.properties[e].refItem||"",[r,i]=n.split(".");E.push({action:e,itemName:t.name,refObj:r,refName:i,op:t.properties[e].invert?"!":""})})},k=()=>{l.items.filter(e=>e.lookup).forEach(e=>{A.push({name:e.name,lookup:e.lookup})}),l.items.filter(e=>e.properties?.lookup).forEach(e=>{A.push({name:e.name,lookup:e.properties.lookup.split(":").at(-1)})})},O=async e=>{const t=E.filter(t=>t.refObj===e);if(t?.length){r(10,b={});for(const e of t){const{itemName:t,refObj:n,refName:i,op:o}=e;let{action:s}=e;if(!n)break;let a,l,c=!i&&C[n];const u=C[n];u&&i&&(c=(await xp(n,u))[i]),Array.isArray(c)&&0===c.length&&(c=!1),"!"===o&&(c=!c),"required"!==s&&"readonly"!==s||(s="required"===s?s:"disabled",setTimeout(()=>{a=`#${d} .form-field.${t} .field textarea`,l=document.querySelector(a),l||(a=`#${d} .form-field.${t} .field input`,l=document.querySelector(a)),l&&c&&l.setAttribute(s,""),l&&!c&&l.removeAttribute(s)},0)),"hidden"===s&&(a=`#${d} .form-field.${t}`,l=document.querySelector(a),l?.classList?.toggle("hidden",!!c),c&&r(10,b[t]="",b))}}};Q(()=>{M()});const M=async()=>{const e=e=>new Promise(t=>setTimeout(t,e));let t,n=0;for(;!(t=document.getElementById(d))&&++n<20;)await e(50);t&&((()=>{if(recID)return;const e=new Set;for(const t of E)e.add(t.refObj||u);Array.from(e).forEach(e=>O(e))})(),P())},P=()=>{setTimeout(()=>{Array.from(S).forEach(([e,t])=>{C[e]||r(7,C[e]=t._id,C)})},250)},B=async e=>{if(!e.value)return void F();const n={[e.itemName]:{$regex:`(?i)${e.value}`}},i=await t.getSectionView(u,n);i?.length?(r(12,T=i),r(11,N=!0)):(r(1,v=""),r(26,$=""),a("setRefValue",$))},L=()=>{r(11,N=!1)},F=()=>{r(1,v=""),r(26,$=v),r(7,C={}),a("setRefValue",$)};return e.$$set=e=>{"required"in e&&r(27,m=e.required),"disabled"in e&&r(0,p=e.disabled),"readonly"in e&&r(28,g=e.readonly),"id"in e&&r(29,w=e.id),"item"in e&&r(4,y=e.item),"value"in e&&r(1,v=e.value),"refValue"in e&&r(26,$=e.refValue),"currency"in e&&r(3,I=e.currency),"notifyList"in e&&r(2,_=e.notifyList)},e.$$.update=()=>{268435457&e.$$.dirty[0]&&r(0,p=p||g),1073742048&e.$$.dirty[0]&&C&&a("safeReference",{record:C,class:u,event:f,taskId:h})},[p,v,_,I,y,u,f,C,l,d,b,N,T,i,s,R,D,async()=>{try{if(v){const e=await t.getTask(y.refClass,v);delete e._task,r(7,C=e),r(30,h=(await t.getTaskByDocId(e._id,!0))._id)}else r(7,C={})}catch{}return r(8,l=await t.getSchemaByClass(y.refClass)),r(9,d="form-"+l.class+Math.floor(9e3*Math.random()+1e3).toString()),r(5,u=l.class),l.identity.designation,r(6,f=l.id),["readonly","hidden","required"].map(x),k(),!0},async({detail:e})=>{const{itemName:t,value:n}=e;if(r(7,C[t]=n,C),t===R)return B(e);O(t)},async({detail:e})=>{if(!(l.input?.length&&l.input.length>1))return;if(prevSchema?.class!==l.input[0])return;const{value:n,lookup:i,view:o}=e,[s]=i.split(":"),a=(await t.getSectionView(s,{[o]:{$in:n}})).map(e=>e._id);for(const e of l.input.slice(1)){r(7,C[e]=[],C);const n=await t.getSchemaByClass(e);n.id;let i=await t.getTasks(n.id);if(i=i.data.filter(e=>"Ready"===e._task?.status&&a.includes(e[s])),i?.length){const n=i.map(e=>e._id),o=await t.getSectionView(e,{_id:{$in:n}});for(const t of o)t[e]=t._id;r(7,C[e]=o,C)}}},async({detail:{className:e,itemName:n,value:r}})=>{if(S.has(e))return;if(!0!==r&&(r=(r=[].concat(r)).some(e=>e===u)),!r)return;const i={[n]:!0},o=await t.getSectionView(e,i);o?.length&&S.set(e,o[0])},async({detail:e})=>{const n=await t.getSectionView(u,{_id:e.row._id});n?.length&&(r(1,v=n[0]._id),r(26,$=v),a("setRefValue",$),r(7,C=n[0])),L()},L,F,({detail:e})=>{r(7,C[e.itemName]=e.value,C)},({detail:e})=>{for(const t of e.items)r(7,C[e.listName][t.name]=t.value,C)},$,m,g,w,h,function(e){_=e,r(2,_)},function(e){N=e,r(11,N)}]}class ro extends xe{constructor(e){var t;super(),Fi.getElementById("svelte-16mo2c-style")||((t=M("style")).id="svelte-16mo2c-style",t.textContent=".feather2.svelte-16mo2c{position:absolute;top:1em;right:0.5em;color:#4300b0}",D(Fi.head,t)),De(this,e,no,to,S,{required:27,disabled:0,readonly:28,id:29,item:4,value:1,refValue:26,currency:3,notifyList:2},[-1,-1])}}function io(e){let t,n;return{c(){t=M("span"),n=B(e[5]),z(t,"class","item")},m(e,r){x(e,t,r),D(t,n)},p(e,t){32&t[0]&&H(n,e[5])},d(e){e&&k(t)}}}function oo(e){let t,n,r,i=e[6]&&io(e),o=e[14]&&function(e){let t,n,r,i,o;return n=new Ue({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"title","Übernehmen"),z(t,"class","pointer feather svelte-1fuww0c")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[17]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}(e);return{c(){i&&i.c(),t=L(),o&&o.c(),n=F()},m(e,s){i&&i.m(e,s),x(e,t,s),o&&o.m(e,s),x(e,n,s),r=!0},p(e,n){e[6]?i?i.p(e,n):(i=io(e),i.c(),i.m(t.parentNode,t)):i&&(i.d(1),i=null),e[14]&&o.p(e,n)},i(e){r||($e(o),r=!0)},o(e){Ie(o),r=!1},d(e){i&&i.d(e),e&&k(t),o&&o.d(e),e&&k(n)}}}function so(e){let t,n,r;return n=new e[10]({props:{withItem:!0,itemLeft:!0,lang:e[11].id,class:"left",type:"string",inputClass:"txt-right"+(e[1]?"":" "+e[2]),id:e[0],name:e[0],value:e[9],step:e[12],pattern:e[7],placeholder:e[13],readonly:e[8],disabled:e[3],required:e[4],$$slots:{default:[oo]},$$scope:{ctx:e}}}),n.$on("change",e[15]),n.$on("focus",e[16]),{c(){t=M("div"),Ne(n.$$.fragment),q(t,"position","relative"),q(t,"max-width","10em")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p(e,t){const r={};6&t[0]&&(r.inputClass="txt-right"+(e[1]?"":" "+e[2])),1&t[0]&&(r.id=e[0]),1&t[0]&&(r.name=e[0]),512&t[0]&&(r.value=e[9]),128&t[0]&&(r.pattern=e[7]),256&t[0]&&(r.readonly=e[8]),8&t[0]&&(r.disabled=e[3]),16&t[0]&&(r.required=e[4]),96&t[0]|256&t[1]&&(r.$$scope={dirty:t,ctx:e}),n.$set(r)},i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function ao(e,t,r){const i=ee(),{TextField:o}=c;let{id:s}=t,{item:a}=t,{value:l}=t,{noForm:d=!1}=t,{classId:u}=t,{disabled:f}=t,{formnovalidate:h}=t,{currency:m}=t,{ownCurrency:p}=t,{praefix:g}=t,{notifyList:w}=t;const y=JSON.parse(n.getItem("Locale"));let v=m,$=["price","amount","amountValue","taxValue","total","__total"].find(e=>e===a.name?.split("-")[0])||a.properties?.currency;!1===a.properties?.currency&&($=!1),"owner.currency"===a.properties?.currency&&(v=p);const I=Number("1.1").toLocaleString(y.id).substring(1,2),{properties:_={}}=a;let{min:C,max:E,step:A,pattern:b,decimals:S=0,unit:N="",placeholder:T,hint:R,readonly:D,negative:x,required:k=!1,transfer:O}=_,M="";$&&(S=2),l=l?Number(l.toString().replace(",",".")):0,D=!0===D||void 0;const P=e=>function(e,t){return(+(Math.round(e+"e+"+t)+"e-"+t)).toFixed(t)}(Number(e.toString()),S).replace(".",I);b||(b=S?`[0-9]+([${I}][0-9]{1,${S}})?`:"[0-9]*"),x&&(b="-?"+b);return e.$$set=e=>{"id"in e&&r(0,s=e.id),"item"in e&&r(19,a=e.item),"value"in e&&r(18,l=e.value),"noForm"in e&&r(1,d=e.noForm),"classId"in e&&r(2,u=e.classId),"disabled"in e&&r(3,f=e.disabled),"formnovalidate"in e&&r(20,h=e.formnovalidate),"currency"in e&&r(21,m=e.currency),"ownCurrency"in e&&r(22,p=e.ownCurrency),"praefix"in e&&r(23,g=e.praefix),"notifyList"in e&&r(24,w=e.notifyList)},e.$$.update=()=>{6815744&e.$$.dirty[0]&&m&&("owner.currency"===a.properties?.currency?r(5,v=p):r(5,v=m)),1048592&e.$$.dirty[0]&&r(4,k=k&&!h),262144&e.$$.dirty[0]&&(e=>{r(9,M=P((e||"0").toString().replace(",",".")))})(l),16777216&e.$$.dirty[0]&&(async()=>{const e=a.properties?.value?.formula;if(e)void 0!==g&&""!==g?e?.operator?.multiply&&i("formula",{item:a}):e?.operator&&i("formula",{item:a})})()},[s,d,u,f,k,v,$,b,D,M,o,y,A,T,O,({detail:e})=>{void 0!==g&&""!==g||i("formula",{item:a,value:e.value}),i("blur",{value:P(e.value)})},({detail:e})=>{D||+l||r(9,M="")},({detail:e})=>{const t=[].concat(O.target);if(void 0===g||""===g)for(const e of t)i("record",{itemName:e,value:l});else for(const e of t)i("listRecord",{itemName:e,decimals:a.properties?.decimals,value:l})},l,a,h,m,p,g,w]}class lo extends xe{constructor(e){var t;super(),document.getElementById("svelte-1fuww0c-style")||((t=M("style")).id="svelte-1fuww0c-style",t.textContent=".feather.svelte-1fuww0c{position:absolute;top:0.75em;right:-1em;color:#4300b0}",D(document.head,t)),De(this,e,ao,so,S,{id:0,item:19,value:18,noForm:1,classId:2,disabled:3,formnovalidate:20,currency:21,ownCurrency:22,praefix:23,notifyList:24},[-1,-1])}}const{document:co}=Ee;function uo(e){e[34]=e[36].list,e[35]=e[36].items}function fo(e,t,n){const r=e.slice();return r[37]=t[n],r[39]=n,r}function ho(e,t,n){const r=e.slice();return r[40]=t[n],r[42]=n,r}function mo(e,t,n){const r=e.slice();return r[40]=t[n],r}function po(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function go(e){let t,n,r,i,o,s,a,l,c,d,u,f,h,m,p,g,w,y,v;uo(e),n=new e[9]({props:{outline:!0,$$slots:{default:[wo]},$$scope:{ctx:e}}}),n.$on("click",e[31]);let $=!e[2]&&yo(e);function I(t){e[32](t)}let _={id:e[12]};void 0!==e[3]&&(_.value=e[3]),a=new e[7]({props:_}),re.push(()=>Se(a,"value",I)),a.$on("input",e[15]),u=new ot({props:{size:"18"}});let C=e[35]?.length&&function(e){let t,n,r,i,o=!e[2]&&$o(e),s=e[35],a=[];for(let t=0;t<s.length;t+=1)a[t]=Io(mo(e,s,t));return{c(){t=M("thead"),n=M("tr"),o&&o.c(),r=L();for(let e=0;e<a.length;e+=1)a[e].c();z(n,"class","svelte-1m010ne"),z(t,"class","svelte-1m010ne")},m(e,s){x(e,t,s),D(t,n),o&&o.m(n,null),D(n,r);for(let e=0;e<a.length;e+=1)a[e].m(n,null);i=!0},p(e,t){if(e[2]?o&&(ye(),Ie(o,1,1,()=>{o=null}),ve()):o?(o.p(e,t),4&t[0]&&$e(o,1)):(o=$o(e),o.c(),$e(o,1),o.m(n,r)),16384&t[0]){let r;for(s=e[35],r=0;r<s.length;r+=1){const i=mo(e,s,r);a[r]?a[r].p(i,t):(a[r]=Io(i),a[r].c(),a[r].m(n,null))}for(;r<a.length;r+=1)a[r].d(1);a.length=s.length}},i(e){i||($e(o),i=!0)},o(e){Ie(o),i=!1},d(e){e&&k(t),o&&o.d(),O(a,e)}}}(e),E=e[34]?.length&&function(e){let t,n,r=e[34],i=[];for(let t=0;t<r.length;t+=1)i[t]=bo(fo(e,r,t));const o=e=>Ie(i[e],1,1,()=>{i[e]=null});return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=F()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);x(e,t,r),n=!0},p(e,n){if(1138717&n[0]){let s;for(r=e[34],s=0;s<r.length;s+=1){const o=fo(e,r,s);i[s]?(i[s].p(o,n),$e(i[s],1)):(i[s]=bo(o),i[s].c(),$e(i[s],1),i[s].m(t.parentNode,t))}for(ye(),s=r.length;s<i.length;s+=1)o(s);ve()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)$e(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)Ie(i[e]);n=!1},d(e){O(i,e),e&&k(t)}}}(e);return{c(){t=M("div"),Ne(n.$$.fragment),r=L(),$&&$.c(),i=L(),o=M("div"),s=B("Suchen: "),Ne(a.$$.fragment),c=L(),d=M("span"),Ne(u.$$.fragment),f=L(),h=M("div"),m=M("table"),C&&C.c(),p=L(),g=M("tbody"),E&&E.c(),z(t,"class","form--buttons svelte-1m010ne"),z(d,"class","feather pointer svelte-1m010ne"),q(o,"margin-bottom","1em"),q(o,"position","relative"),z(m,"striped",""),z(m,"class","svelte-1m010ne"),z(h,"class","eList svelte-1m010ne")},m(l,I){x(l,t,I),Te(n,t,null),D(t,r),$&&$.m(t,null),x(l,i,I),x(l,o,I),D(o,s),Te(a,o,null),D(o,c),D(o,d),Te(u,d,null),x(l,f,I),x(l,h,I),D(h,m),C&&C.m(m,null),D(m,p),D(m,g),E&&E.m(g,null),w=!0,y||(v=V(d,"click",e[17]),y=!0)},p(e,r){uo(e);const i={};16384&r[1]&&(i.$$scope={dirty:r,ctx:e}),n.$set(i),e[2]?$&&(ye(),Ie($,1,1,()=>{$=null}),ve()):$?($.p(e,r),4&r[0]&&$e($,1)):($=yo(e),$.c(),$e($,1),$.m(t,null));const o={};!l&&8&r[0]&&(l=!0,o.value=e[3],ue(()=>l=!1)),a.$set(o),e[35]?.length&&C.p(e,r),e[34]?.length&&E.p(e,r)},i(e){w||($e(n.$$.fragment,e),$e($),$e(a.$$.fragment,e),$e(u.$$.fragment,e),$e(C),$e(E),w=!0)},o(e){Ie(n.$$.fragment,e),Ie($),Ie(a.$$.fragment,e),Ie(u.$$.fragment,e),Ie(C),Ie(E),w=!1},d(e){e&&k(t),Re(n),$&&$.d(),e&&k(i),e&&k(o),Re(a),Re(u),e&&k(f),e&&k(h),C&&C.d(),E&&E.d(),y=!1,v()}}}function wo(e){let t;return{c(){t=B("Abbrechen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function yo(e){let t,n;return t=new e[9]({props:{disabled:!e[34].length,filled:!0,$$slots:{default:[vo]},$$scope:{ctx:e}}}),t.$on("click",e[18](e[34])),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};16384&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function vo(e){let t;return{c(){t=B("Bestätigen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function $o(e){let t,n,r,i,o;return n=new Ze({props:{size:"20"}}),{c(){t=M("th"),Ne(n.$$.fragment),z(t,"class","svelte-1m010ne")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[19](e[34])),i=!0)},p(t,n){e=t},i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function Io(e){let t,n,r=e[40]+"";return{c(){t=M("th"),n=B(r),z(t,"class","svelte-1m010ne")},m(e,r){x(e,t,r),D(t,n)},p:_,d(e){e&&k(t)}}}function _o(e){let t,n,r,i,o,s,a,l=e[0],c=Eo(e),d=e[35],u=[];for(let t=0;t<d.length;t+=1)u[t]=Ao(ho(e,d,t));return{c(){t=M("tr"),c.c(),n=L();for(let e=0;e<u.length;e+=1)u[e].c();r=L(),z(t,"style",i=e[2]?"cursor: default;":"cursor: zoom-in;"),z(t,"title","übernimmt den Wert direkt"),z(t,"class","svelte-1m010ne"),G(t,"active",e[0].includes(Array.isArray(e[37])?e[37][0]:e[37]))},m(i,l){x(i,t,l),c.m(t,null),D(t,n);for(let e=0;e<u.length;e+=1)u[e].m(t,null);D(t,r),o=!0,s||(a=V(t,"click",e[20](e[37])),s=!0)},p(s,a){if(e=s,1&a[0]&&S(l,l=e[0])?(ye(),Ie(c,1,1,_),ve(),c=Eo(e),c.c(),$e(c),c.m(t,n)):c.p(e,a),16400&a[0]){let n;for(d=e[35],n=0;n<d.length;n+=1){const i=ho(e,d,n);u[n]?u[n].p(i,a):(u[n]=Ao(i),u[n].c(),u[n].m(t,r))}for(;n<u.length;n+=1)u[n].d(1);u.length=d.length}(!o||4&a[0]&&i!==(i=e[2]?"cursor: default;":"cursor: zoom-in;"))&&z(t,"style",i),16385&a[0]&&G(t,"active",e[0].includes(Array.isArray(e[37])?e[37][0]:e[37]))},i(e){o||($e(c),o=!0)},o(e){Ie(c),o=!1},d(e){e&&k(t),c.d(e),O(u,e),s=!1,a()}}}function Co(e){let t,n,r;return n=new e[11]({props:{name:e[13],data:e[39],checked:e[0].includes(Array.isArray(e[37])?e[37][0]:e[37]),round:!0}}),{c(){t=M("td"),Ne(n.$$.fragment),z(t,"title","Wählt den Wert aus"),z(t,"class","svelte-1m010ne")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p(e,t){const r={};1&t[0]&&(r.checked=e[0].includes(Array.isArray(e[37])?e[37][0]:e[37])),n.$set(r)},i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function Eo(e){let t,n,r=!e[2]&&Co(e);return{c(){r&&r.c(),t=F()},m(e,i){r&&r.m(e,i),x(e,t,i),n=!0},p(e,n){e[2]?r&&(ye(),Ie(r,1,1,()=>{r=null}),ve()):r?(r.p(e,n),4&n[0]&&$e(r,1)):(r=Co(e),r.c(),$e(r,1),r.m(t.parentNode,t))},i(e){n||($e(r),n=!0)},o(e){Ie(r),n=!1},d(e){r&&r.d(e),e&&k(t)}}}function Ao(e){let t,n,r=(Array.isArray(e[37])?e[37][e[42]]:e[4][e[39]]?e[4][e[39]][e[42]]:e[37])+"";return{c(){t=M("td"),n=B(r),z(t,"class","svelte-1m010ne")},m(e,r){x(e,t,r),D(t,n)},p(e,t){16&t[0]&&r!==(r=(Array.isArray(e[37])?e[37][e[42]]:e[4][e[39]]?e[4][e[39]][e[42]]:e[37])+"")&&H(n,r)},d(e){e&&k(t)}}}function bo(e){let t,n,r=e[16](e[37],e[3]),i=r&&_o(e);return{c(){i&&i.c(),t=F()},m(e,r){i&&i.m(e,r),x(e,t,r),n=!0},p(e,n){8&n[0]&&(r=e[16](e[37],e[3])),r?i?(i.p(e,n),8&n[0]&&$e(i,1)):(i=_o(e),i.c(),$e(i,1),i.m(t.parentNode,t)):i&&(ye(),Ie(i,1,1,()=>{i=null}),ve())},i(e){n||($e(i),n=!0)},o(e){Ie(i),n=!1},d(e){i&&i.d(e),e&&k(t)}}}function So(e){let t,n;return t=new e[6]({}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p:_,i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function No(e){let t,n,r,i;t=new e[10]({});let o={ctx:e,current:null,token:null,hasCatch:!1,pending:So,then:go,catch:po,value:36,blocks:[,,,]};return _e(e[14](),o),{c(){Ne(t.$$.fragment),n=L(),r=F(),o.block.c()},m(e,s){Te(t,e,s),x(e,n,s),x(e,r,s),o.block.m(e,o.anchor=s),o.mount=()=>r.parentNode,o.anchor=r,i=!0},p(t,n){Ce(o,e=t,n)},i(e){i||($e(t.$$.fragment,e),$e(o.block),i=!0)},o(e){Ie(t.$$.fragment,e);for(let e=0;e<3;e+=1){Ie(o.blocks[e])}i=!1},d(e){Re(t,e),e&&k(n),e&&k(r),o.block.d(e),o.token=null,o=null}}}function To(e){let t,n;return t=new e[8]({props:{title:e[1]||"Auswahl",class:"eList",$$slots:{default:[No]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};2&n[0]&&(r.title=e[1]||"Auswahl"),29&n[0]|16384&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Ro(e,n,r){const i=ee(),{Loading:o,TextField:s,Dialog:a,Button:l,Divider:d,Checkbox:u}=c;let{classId:f}=n,{id:h}=n,{designation:m}=n,{selection:p}=n,{refDoc:g}=n,{tableName:w}=n,{idName:y}=n,{target:v}=n,{view:$}=n,{unique:I}=n,{uniqueView:_}=n,{status:C}=n,{single:E}=n;p||=[];let A="",b=f+Math.floor(9e3*Math.random()+1e3).toString()+"search",S=[];const N=w+y+v+"checkbox",T=(e,t)=>e>t?1:t>e?-1:0;Q(()=>{window.setTimeout(()=>{const e=document.querySelector("tr.active");e?e.scrollIntoView({block:"end",behavior:"smooth"}):document.getElementById(b)?.focus()},200)});return e.$$set=e=>{"classId"in e&&r(22,f=e.classId),"id"in e&&r(23,h=e.id),"designation"in e&&r(1,m=e.designation),"selection"in e&&r(0,p=e.selection),"refDoc"in e&&r(24,g=e.refDoc),"tableName"in e&&r(25,w=e.tableName),"idName"in e&&r(26,y=e.idName),"target"in e&&r(21,v=e.target),"view"in e&&r(27,$=e.view),"unique"in e&&r(28,I=e.unique),"uniqueView"in e&&r(29,_=e.uniqueView),"status"in e&&r(30,C=e.status),"single"in e&&r(2,E=e.single)},[p,m,E,A,S,i,o,s,a,l,d,u,b,N,async()=>{let e=[],n=[],i={};if(r(4,S=[]),y)if($){if(h){const n=f.split("-")[1].slice(0,-4),r="input."+f+"[name='_id']",o=document.querySelector(r).value;i={[y]:h},C&&(i.$or=[{status:!0},{[n]:o}]),e=await t.getSectionView(w,i),e=e.sort((e,t)=>{const r=e=>(e[n]||"z").toString()+e[v];return T(r(e),r(t))})}}else _?h&&(i={[y]:h,status:!0},Object.entries(_).map(([e,t])=>{t?.length&&(i[e]={$in:t}),n.push(e)}),e=await t.getSectionView(w,i),e=e.sort((e,t)=>{const n=e=>(p.includes(e[v])?"0-":"1-")+e[v];return T(n(e),n(t))}),r(4,S=e.map(e=>{const t=[e[v]];return n.map(n=>t.push(e[n])),t}))):I?(e=await t.getSection(w,y,h,I),e=e.sort((e,t)=>T(e,t))):(e=await t.getSection(w,y,h,!1,C),e=e.sort((e,t)=>{const n=e=>(p.includes(e[v])?"0-":"1-")+e[v];return T(n(e),n(t))}));else i={},h&&!Array.isArray(h)&&(i._id=h),e=await t.getSectionView(w,i);const o=await t.getSchemaByClass(w),s=[];if(g){const t=o.items[0].name,n=o.items[1].name,i=o.list[0].name,s=e.find(e=>e[t]===g);e=s?s[i]:[],r(21,v=n)}let a;return e.map(e=>{let t=e[v];if(t||w!==v||(r(21,v=o.items[0].name),t=e[v]),Array.isArray(t))for(const e of t){let t=e;"string"!=typeof e&&(t=Array.from(Object.values(e)).filter(e=>!!e&&24!==e?.length).join(", ")),s.push(t||[])}else g&&(t=o.list[0].item.map(t=>e[t.name]||"")),s.push(t||[])}),a=g?o.list[0].item.map(e=>e.designation):[o.items.find(e=>e.name===v)?.designation],n=n.map(e=>o.items.find(t=>t.name===e)?.designation),{list:g?s:s.flat(),items:[...a,...n]}},({detail:{value:e}})=>{r(3,A=e)},(e,t)=>{if(!t)return!0;return!!(Array.isArray(e)?e.join(" "):e).toLowerCase().includes(t.toLowerCase())},()=>{r(3,A="")},e=>()=>{const t=document.getElementsByName(N),n=[];t.forEach((t,r)=>{t.checked&&n.push(e[+t.attributes.data.value])}),i("choose",{list:n})},e=>()=>{document.getElementsByName(N).forEach((e,t)=>{e.checked=!e.checked})},e=>t=>{if("TD"===t.target?.nodeName){const t=Array.isArray(e)?e[0]:e;E?i("choose",{list:[].concat(t)}):(r(0,p=p.includes(t)?p.filter(e=>e!==t):p.concat(t)),i("choose",{list:p}))}},v,f,h,g,w,y,$,I,_,C,()=>i("back"),function(e){A=e,r(3,A)}]}class Do extends xe{constructor(e){var t;super(),co.getElementById("svelte-1m010ne-style")||((t=M("style")).id="svelte-1m010ne-style",t.textContent=".feather.svelte-1m010ne.svelte-1m010ne{position:absolute;top:2em;right:0.5em;color:#326173}.eList.svelte-1m010ne.svelte-1m010ne{height:fit-content;max-height:65vh;overflow-y:scroll;overflow-x:auto}.eList.svelte-1m010ne table.svelte-1m010ne{min-width:30vw;position:relative;width:max-content !important;max-width:50vh !important}.eList.svelte-1m010ne table thead.svelte-1m010ne{position:sticky;top:0;background:#326173;color:white}.eList.svelte-1m010ne table tbody tr.svelte-1m010ne{height:2.3em}th.svelte-1m010ne.svelte-1m010ne,td.svelte-1m010ne.svelte-1m010ne{padding-left:0.4em;padding-right:0.4em}tr.active.svelte-1m010ne.svelte-1m010ne{color:#326173;background-color:#fcebd5}.dialog.eList{max-height:90vh}.checkbox.round > .selector{border-color:#326173 !important}.form--buttons.svelte-1m010ne.svelte-1m010ne{display:flex;gap:1em;padding:0.5em 0}",D(co.head,t)),De(this,e,Ro,To,S,{classId:22,id:23,designation:1,selection:0,refDoc:24,tableName:25,idName:26,target:21,view:27,unique:28,uniqueView:29,status:30,single:2},[-1,-1])}}const{document:xo}=Ee;function ko(e){let t,n,r,i,o,s=e[7].length+"";return{c(){t=M("span"),n=B("("),r=B(s),i=B(")"),z(t,"class",o=T(e[1]?"showNumber disabled":"showNumber")+" svelte-1rbaejz")},m(e,o){x(e,t,o),D(t,n),D(t,r),D(t,i)},p(e,n){128&n[0]&&s!==(s=e[7].length+"")&&H(r,s),2&n[0]&&o!==(o=T(e[1]?"showNumber disabled":"showNumber")+" svelte-1rbaejz")&&z(t,"class",o)},d(e){e&&k(t)}}}function Oo(e){let t;return{c(){t=M("div"),z(t,"class","load-more-options"),z(t,"slot","load-more-options-message")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Mo(e){let t,n,r,i;const o=[Lo,Bo,Po],s=[];function a(e,t){return!e[16].single&&e[7]?.length?0:e[17]?1:e[14]&&e[16].view&&e[16].maxItem?2:-1}return~(t=a(e))&&(n=s[t]=o[t](e)),{c(){n&&n.c(),r=F()},m(e,n){~t&&s[t].m(e,n),x(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?~t&&s[t].p(e,i):(n&&(ye(),Ie(s[l],1,1,()=>{s[l]=null}),ve()),~t?(n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),$e(n,1),n.m(r.parentNode,r)):n=null)},i(e){i||($e(n),i=!0)},o(e){Ie(n),i=!1},d(e){~t&&s[t].d(e),e&&k(r)}}}function Po(e){let t,n,r,i,o;return n=new Ue({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"title","Übernehmen"),z(t,"class","feather pointer svelte-1rbaejz")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[26]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function Bo(e){let t,n,r,i,o;return n=new Je({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"title",e[17].title||"Generieren"),z(t,"class","feather pointer svelte-1rbaejz")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[25]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function Lo(e){let t,n,r,i,o;return n=new ot({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"title","Löschen"),z(t,"class","feather pointer svelte-1rbaejz")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[27]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function Fo(e){let t,n,r;function i(t){e[37](t)}let o={class:"tModal",noClickaway:!0,$$slots:{default:[Vo]},$$scope:{ctx:e}};return void 0!==e[10]&&(o.open=e[10]),t=new e[11]({props:o}),re.push(()=>Se(t,"open",i)),{c(){Ne(t.$$.fragment)},m(e,n){Te(t,e,n),r=!0},p(e,r){const i={};53&r[0]|32768&r[1]&&(i.$$scope={dirty:r,ctx:e}),!n&&1024&r[0]&&(n=!0,i.open=e[10],ue(()=>n=!1)),t.$set(i)},i(e){r||($e(t.$$.fragment,e),r=!0)},o(e){Ie(t.$$.fragment,e),r=!1},d(e){Re(t,e)}}}function Vo(e){let t,n;return t=new Do({props:{classId:e[2],selection:e[0],refDoc:e[19],view:e[15],status:e[18],unique:e[16].unique&&e[4].name,uniqueView:e[16].view&&{[e[16].view]:e[5][e[16].view]},id:e[5][e[21]||e[20]],tableName:e[20],idName:e[21],designation:e[4].designation,target:e[4].name,single:e[16].single}}),t.$on("choose",e[24]),t.$on("back",e[23]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};4&n[0]&&(r.classId=e[2]),1&n[0]&&(r.selection=e[0]),16&n[0]&&(r.unique=e[16].unique&&e[4].name),32&n[0]&&(r.uniqueView=e[16].view&&{[e[16].view]:e[5][e[16].view]}),32&n[0]&&(r.id=e[5][e[21]||e[20]]),16&n[0]&&(r.designation=e[4].designation),16&n[0]&&(r.target=e[4].name),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Uo(e){let t,n,r,i,o,s,a,l,c,d=!e[16].single&&e[7]?.length&&ko(e);function u(t){e[35](t)}function f(t){e[36](t)}let h={id:e[3],name:e[3],class:e[3],readonly:e[13],disabled:e[1],required:e[6],placeholder:e[8],getOptions:Wo,minSearchLength:"3",$$slots:{"load-more-options-message":[Oo]},$$scope:{ctx:e}};void 0!==e[7]&&(h.selection=e[7]),void 0!==e[9]&&(h.maxOptions=e[9]),r=new e[12]({props:h}),re.push(()=>Se(r,"selection",u)),re.push(()=>Se(r,"maxOptions",f)),r.$on("change",e[22]);let m=!e[1]&&Mo(e),p=e[10]&&Fo(e);return{c(){t=M("div"),d&&d.c(),n=L(),Ne(r.$$.fragment),s=L(),m&&m.c(),a=L(),p&&p.c(),l=F(),q(t,"position","relative")},m(e,i){x(e,t,i),d&&d.m(t,null),D(t,n),Te(r,t,null),D(t,s),m&&m.m(t,null),x(e,a,i),p&&p.m(e,i),x(e,l,i),c=!0},p(e,s){!e[16].single&&e[7]?.length?d?d.p(e,s):(d=ko(e),d.c(),d.m(t,n)):d&&(d.d(1),d=null);const a={};8&s[0]&&(a.id=e[3]),8&s[0]&&(a.name=e[3]),8&s[0]&&(a.class=e[3]),2&s[0]&&(a.disabled=e[1]),64&s[0]&&(a.required=e[6]),256&s[0]&&(a.placeholder=e[8]),32768&s[1]&&(a.$$scope={dirty:s,ctx:e}),!i&&128&s[0]&&(i=!0,a.selection=e[7],ue(()=>i=!1)),!o&&512&s[0]&&(o=!0,a.maxOptions=e[9],ue(()=>o=!1)),r.$set(a),e[1]?m&&(ye(),Ie(m,1,1,()=>{m=null}),ve()):m?(m.p(e,s),2&s[0]&&$e(m,1)):(m=Mo(e),m.c(),$e(m,1),m.m(t,null)),e[10]?p?(p.p(e,s),1024&s[0]&&$e(p,1)):(p=Fo(e),p.c(),$e(p,1),p.m(l.parentNode,l)):p&&(ye(),Ie(p,1,1,()=>{p=null}),ve())},i(e){c||($e(r.$$.fragment,e),$e(m),$e(p),c=!0)},o(e){Ie(r.$$.fragment,e),Ie(m),Ie(p),c=!1},d(e){e&&k(t),d&&d.d(),Re(r),m&&m.d(),e&&k(a),p&&p.d(e),e&&k(l)}}}async function*Wo(e){yield[{name:e}]}function zo(e,n,r){const i=ee(),{Modal:o,Autocomplete:s}=c;let{classId:a}=n,{id:l}=n,{item:d}=n,{record:u}=n,{value:f}=n,{noForm:h=!1}=n,{disabled:m}=n,{formnovalidate:p}=n,{numberInput:g}=n,{praefix:w}=n,{toDelete:y}=n,{reqQuantity:v}=n,{notifyList:$}=n;const{properties:I={}}=d;let{placeholder:_,hint:C,readonly:E,required:A=!1,lookup:b="",view:S=!1,multi:N,max:T=1e3,generate:R=!1,status:D=!0,refDoc:x}=I;const[k,O]=b.split(":");let M=!1,P=f.map&&f.map(e=>({name:e}))||[];m||=E,m&&(_="");const B=({detail:e})=>{let t=[];e.value.map(e=>{const n=e.name?.split(",");t=t.concat(n)}),r(7,P=t.map(e=>({name:e.trim()})));const n=P.map(e=>e.name);i("blur",{value:n}),i("multi",{view:N.view,lookup:b,name:d.name,value:n})};Q(async()=>{i("multi",{view:N.view,lookup:b,name:d.name,value:f});const e=document.getElementById(l);e.classList.add(a),!E&&b&&e.addEventListener("focus",L)});const L=()=>{if(b){document.getElementById(l).blur();const e=v||T;(N.unique||P.length<e)&&r(10,M=!0)}},F=()=>{r(10,M&&=!1)},V=({detail:e})=>{const t=e.list.map(e=>Array.isArray(e)?e[0]:e);r(7,P=t.map(e=>({name:e}))),i("blur",{value:t}),i("multi",{view:N.view,lookup:b,name:d.name,value:t}),F()},U=async()=>{const e={[O]:u[O]},n=await t.getSectionView(k,e),r=Array.from({length:n.length},(e,t)=>n[t][d.name]);V({detail:{name:d.name,list:r}})},W=(e=!1)=>{if(m||!N.required)return;const t=N.maxItem;if(!t||N.unique)return;r(9,T=!1!==e?e:v||u[t]||0);const n=P?.length!=T,o=document.getElementById(l);o?.classList?.toggle("invalid",n),i("invalid",{idx:w,value:n})};return e.$$set=e=>{"classId"in e&&r(2,a=e.classId),"id"in e&&r(3,l=e.id),"item"in e&&r(4,d=e.item),"record"in e&&r(5,u=e.record),"value"in e&&r(0,f=e.value),"noForm"in e&&r(28,h=e.noForm),"disabled"in e&&r(1,m=e.disabled),"formnovalidate"in e&&r(29,p=e.formnovalidate),"numberInput"in e&&r(30,g=e.numberInput),"praefix"in e&&r(31,w=e.praefix),"toDelete"in e&&r(32,y=e.toDelete),"reqQuantity"in e&&r(33,v=e.reqQuantity),"notifyList"in e&&r(34,$=e.notifyList)},e.$$.update=()=>{48&e.$$.dirty[0]&&u&&""===u[d.name]&&r(7,P=[]),48&e.$$.dirty[0]&&u&&Array.isArray(u[d.name])&&r(7,P=u[d.name].map(e=>({name:e}))),16&e.$$.dirty[0]|2&e.$$.dirty[1]&&y&&y===d.name&&r(7,P=[]),128&e.$$.dirty[0]&&P&&(r(0,f=P.map&&P.map(e=>e.name)||[]),W()),1073741824&e.$$.dirty[0]&&((e={})=>{const{item:t,value:n,idx:r}=e;void 0!==w&&w!==r||t&&t.name===N.maxItem&&W(n)})(g),536870976&e.$$.dirty[0]&&r(6,A=A&&!p),8&e.$$.dirty[1]&&(async e=>{if(void 0===w)return;const{itemName:n,value:o}=e||{};if(o){if(d.refItem&&d.refItem?.split(".")[0]===n){let[e,n]=d.refItem.split(".");if(Array.isArray(o)){if(e=e.slice(0,-1),!o.length)return i("record",{itemName:"quantity",value:0}),void r(7,P=[]);const s={_id:{$in:o}},a=await t.getSectionView(e,s);let l=[];for(const e of a)e[n]&&(l=l.concat(e[n][0][d.name]));if(!l.length)return;i("record",{itemName:"quantity",value:l.length}),r(7,P=l.map(e=>({name:e}))),B({detail:{value:P}})}else{const s=await t.getTask(e,o);if(!s||!s[n])return;const a=s[n];if(!Array.isArray(a)&&!a.length)return;const l=a[w][d.name];i("record",{itemName:"quantity",value:l?.length||0}),r(7,P=l&&l.map(e=>({name:e})))}}if(d.refItem2&&d.refItem2?.split(".")[0]===n){let[e,n]=d.refItem2.split(".");if(Array.isArray(o))if(Array.isArray(o)){if(e=e.slice(0,-1),!o.length)return i("record",{itemName:"quantity",value:0}),void r(7,P=[]);const s={_id:{$in:o}},a=await t.getSectionView(e,s);let l=[];for(const e of a)e[n]&&(l=l.concat(e[n][0][d.name]));if(!l.length)return;i("record",{itemName:"quantity",value:l.length}),r(7,P=l.map(e=>({name:e}))),B({detail:{value:P}})}else{const s=await t.getTask(e,o);if(!s||!s[n])return;const a=s[n];if(!Array.isArray(a)&&!a.length)return;const l=a[w][d.name];i("record",{itemName:"quantity",value:l?.length||0}),r(7,P=l&&l.map(e=>({name:e})))}}setTimeout(W,250)}})($)},[f,m,a,l,d,u,A,P,_,T,M,o,s,E,b,S,N,R,D,x,k,O,B,F,V,()=>{const e=u[R.itemQuantity]||v;if(!e)return;const t=R.prefix||"",n=u[R.variable]||"",r=R.len||5,i=Array.from({length:e},(e,i)=>t+n+"-"+i.toString().padStart(r,"0"));V({detail:{name:d.name,list:i}})},async()=>{if(!0===S)return U();const e=v||u[N.maxItem];if(!e)return;let n={};O&&(n={[O]:u[O]}),D&&(n.status=!0);const r=[].concat(u[N.view]||[]);r.length&&(n[N.view]={$in:r});const i=await t.getSectionView(k,n),o=Array.from({length:e<i.length?e:i.length},(e,t)=>i[t][d.name]);V({detail:{name:d.name,list:o}})},()=>{V({detail:{name:d.name,list:[]}})},h,p,g,w,y,v,$,function(e){P=e,r(7,P),r(5,u),r(4,d),r(32,y)},function(e){T=e,r(9,T)},function(e){M=e,r(10,M)}]}class Ho extends xe{constructor(e){var t;super(),xo.getElementById("svelte-1rbaejz-style")||((t=M("style")).id="svelte-1rbaejz-style",t.textContent=".feather.svelte-1rbaejz{position:absolute;top:1em;right:0.5em;color:#4300b0}.showNumber.svelte-1rbaejz{position:absolute;display:inline-block;width:3.5em;text-align:right;top:1em;left:-4em;color:#4300b0}.showNumber.disabled.svelte-1rbaejz{color:#888 !important}.autocomplete .notice,.autocomplete .load-more-options,.autocomplete .show-on-focus,.autocomplete.disabled .chip button.btn,.autocomplete.disabled .chip+.autocomplete-field input{display:none}.autocomplete-field input.invalid{border:1px red solid !important}.autocomplete.disabled .chip{height:2.25em !important;padding-right:0.75em !important}",D(xo.head,t)),De(this,e,zo,Uo,S,{classId:2,id:3,item:4,record:5,value:0,noForm:28,disabled:1,formnovalidate:29,numberInput:30,praefix:31,toDelete:32,reqQuantity:33,notifyList:34},[-1,-1])}}function jo(e){let t,n,r;return n=new Ct({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather2 svelte-9up2nn")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function qo(e){let t,n,r,i,o;return n=new Ct({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather pointer svelte-9up2nn")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[9]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function Go(e){let t,n,r,i,o,s;n=new e[8]({props:{inputClass:e[0],disabled:e[1],formnovalidate:e[2],readonly:e[3],required:e[4],id:e[5],name:e[6],value:e[7]}}),n.$on("change",e[12]);const a=[qo,jo],l=[];function c(e,t){return e[7]?0:1}return i=c(e),o=l[i]=a[i](e),{c(){t=M("div"),Ne(n.$$.fragment),r=L(),o.c(),q(t,"position","relative")},m(e,o){x(e,t,o),Te(n,t,null),D(t,r),l[i].m(t,null),s=!0},p(e,[r]){const s={};1&r&&(s.inputClass=e[0]),2&r&&(s.disabled=e[1]),4&r&&(s.formnovalidate=e[2]),8&r&&(s.readonly=e[3]),16&r&&(s.required=e[4]),32&r&&(s.id=e[5]),64&r&&(s.name=e[6]),128&r&&(s.value=e[7]),n.$set(s);let d=i;i=c(e),i===d?l[i].p(e,r):(ye(),Ie(l[d],1,1,()=>{l[d]=null}),ve(),o=l[i],o?o.p(e,r):(o=l[i]=a[i](e),o.c()),$e(o,1),o.m(t,null))},i(e){s||($e(n.$$.fragment,e),$e(o),s=!0)},o(e){Ie(n.$$.fragment,e),Ie(o),s=!1},d(e){e&&k(t),Re(n),l[i].d()}}}const Xo=e("getMapLink",async e=>{const{street:n,houseNo:r,postcode:i,location:o,country:s}=e,a=[n&&r?n+" "+r:n,i&&o?i+" "+o:i||o||"",s&&(await t.getTask("country",s)).designation].filter(e=>!!e).join(", ");return"https://bing.com/maps/default.aspx?where1="+encodeURIComponent(a)});function Yo(e,t,n){const{TextField:r}=c;let{inputClass:i}=t,{disabled:o}=t,{formnovalidate:s}=t,{readonly:a}=t,{required:l}=t,{id:d}=t,{name:u}=t,{value:f}=t,{record:h}=t,{item:m}=t;return e.$$set=e=>{"inputClass"in e&&n(0,i=e.inputClass),"disabled"in e&&n(1,o=e.disabled),"formnovalidate"in e&&n(2,s=e.formnovalidate),"readonly"in e&&n(3,a=e.readonly),"required"in e&&n(4,l=e.required),"id"in e&&n(5,d=e.id),"name"in e&&n(6,u=e.name),"value"in e&&n(7,f=e.value),"record"in e&&n(10,h=e.record),"item"in e&&n(11,m=e.item)},[i,o,s,a,l,d,u,f,r,async()=>{if(!f)return;const e=u.includes(".")?h[u.split(".")[0]]:h,t=await Xo(e);window.open(t,"_blank")},h,m,function(t){te(e,t)}]}class Zo extends xe{constructor(e){var t;super(),document.getElementById("svelte-9up2nn-style")||((t=M("style")).id="svelte-9up2nn-style",t.textContent=".feather.svelte-9up2nn{position:absolute;top:0.75em;left:0.5em;color:#4300b0;margin-left:-2em}.feather2.svelte-9up2nn{position:absolute;top:0.75em;left:0.5em;color:light-gray;margin-left:-2em}",D(document.head,t)),De(this,e,Yo,Go,S,{inputClass:0,disabled:1,formnovalidate:2,readonly:3,required:4,id:5,name:6,value:7,record:10,item:11})}}const{document:Ko}=Ee;function Qo(e){let t;return{c(){t=M("div"),z(t,"class","load-more-options"),z(t,"slot","load-more-options-message")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Jo(e){let t,n,r;return n=new Ct({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather2 svelte-wpjws5")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function es(e){let t,n,r,i,o;return n=new Ct({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather pointer svelte-wpjws5")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[8]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function ts(e){let t,n,r,i,o,s,a;function l(t){e[17](t)}function c(t){e[18](t)}function d(t){e[19](t)}let u={id:e[1],name:e[1],class:e[1],minSearchLength:"1",maxOptions:"1",getOptions:e[7],$$slots:{"load-more-options-message":[Qo]},$$scope:{ctx:e}};void 0!==e[0]&&(u.value=e[0]),void 0!==e[2]&&(u.selection=e[2]),void 0!==e[3]&&(u.searchQuery=e[3]),n=new e[4]({props:u}),re.push(()=>Se(n,"value",l)),re.push(()=>Se(n,"selection",c)),re.push(()=>Se(n,"searchQuery",d)),n.$on("change",e[6]);let f=e[5]&&function(e){let t,n,r,i;const o=[es,Jo],s=[];function a(e,t){return e[0]?0:1}return t=a(e),n=s[t]=o[t](e),{c(){n.c(),r=F()},m(e,n){s[t].m(e,n),x(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?s[t].p(e,i):(ye(),Ie(s[l],1,1,()=>{s[l]=null}),ve(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),$e(n,1),n.m(r.parentNode,r))},i(e){i||($e(n),i=!0)},o(e){Ie(n),i=!1},d(e){s[t].d(e),e&&k(r)}}}(e);return{c(){t=M("div"),Ne(n.$$.fragment),s=L(),f&&f.c(),q(t,"position","relative"),z(t,"class","inputAutoComplete")},m(e,r){x(e,t,r),Te(n,t,null),D(t,s),f&&f.m(t,null),a=!0},p(e,t){const s={};2&t[0]&&(s.id=e[1]),2&t[0]&&(s.name=e[1]),2&t[0]&&(s.class=e[1]),32&t[1]&&(s.$$scope={dirty:t,ctx:e}),!r&&1&t[0]&&(r=!0,s.value=e[0],ue(()=>r=!1)),!i&&4&t[0]&&(i=!0,s.selection=e[2],ue(()=>i=!1)),!o&&8&t[0]&&(o=!0,s.searchQuery=e[3],ue(()=>o=!1)),n.$set(s),e[5]&&f.p(e,t)},i(e){a||($e(n.$$.fragment,e),$e(f),a=!0)},o(e){Ie(n.$$.fragment,e),Ie(f),a=!1},d(e){e&&k(t),Re(n),f&&f.d()}}}function ns(e,t,n){const{Autocomplete:r}=c,i=ee();let{classId:o}=t,{id:s}=t,{item:a}=t,{name:l}=t,{listName:d}=t,{record:u}=t,{value:f}=t,{noForm:h=!1}=t,{disabled:m}=t,{formnovalidate:p}=t,{autocomplete:{input:g,min:w,url:y,output:v},format:$}=a.properties;y="https://openplzapi.org/";const I=[].concat(g),{name:_}=v,C="map"===$;let E,A=f,b=!1;Q(()=>{const e=document.querySelector("."+a.name+" .autocomplete input");e&&(e.addEventListener("focus",T),e.addEventListener("keyup",N),e.addEventListener("keydown",S));const t=document.getElementById(s);t&&t.classList.add(o)});const S=e=>{b=8===e.keyCode||32===e.keyCode},N=e=>{8===e.keyCode&&""===A&&n(0,f="")},T=async()=>{if(w){const e=I[0].name;if((d?u[d][e]:u[e]).length<w)return}const e=await R();if(e?.length)if(1===e.length){if(f.startsWith(e[0].name))return;n(3,A=n(0,f=e[0].name)),x(f)}else e.find(e=>(A||"").startsWith(e.name))||f||n(3,A=" ");else n(0,f=n(3,A=""))},R=async(e="")=>{const t=await(async()=>{const e=d?u[d].country:u.country;if(e){const t=await xp("country",e);if(t?.countryCode)return t.countryCode?.toLowerCase()}return"ch"})();let n="Streets";"postalCode"===I[0].refItem&&(n="Localities");const r=await fetch(y+t+"/"+n+"?"+D()+"&name=%5E"+e.trim());if(!r.ok)return;const i=r.headers.get("Content-Type").split(";")[0];let o=[];try{if("text/json"===i){const e=await r.text();o=JSON.parse(e||[])}else"application/json"===i&&(o=await r.json())}catch{}return o=o.filter((e,t,n)=>n.findIndex(t=>t.name===e.name)===t),o.map(e=>({name:e[_]}))},D=()=>I.map(({name:e,refItem:t})=>`${t}=${(d?u[d][e]:u[e]).split(" ")[0]}`).join("&"),x=e=>{i("blur",{value:e})};return e.$$set=e=>{"classId"in e&&n(9,o=e.classId),"id"in e&&n(1,s=e.id),"item"in e&&n(10,a=e.item),"name"in e&&n(11,l=e.name),"listName"in e&&n(12,d=e.listName),"record"in e&&n(13,u=e.record),"value"in e&&n(0,f=e.value),"noForm"in e&&n(14,h=e.noForm),"disabled"in e&&n(15,m=e.disabled),"formnovalidate"in e&&n(16,p=e.formnovalidate)},[f,s,E,A,r,C,({detail:{value:e}})=>{e.length&&n(3,A=n(0,f=e[0].name)),n(2,E=[]),x(f)},async function*(e){if(b||f&&e.startsWith(f))return n(0,f=e),void x(f);const t=await R(e);if(!t?.length)return n(0,f=e),void x(f);1===t.length?(n(3,A=n(0,f=t[0].name)),n(2,E=[]),x(f)):yield t},async()=>{if(!f)return;const e=l.includes(".")?u[l.split(".")[0]]:u,t=await Xo(e);window.open(t,"_blank")},o,a,l,d,u,h,m,p,function(e){f=e,n(0,f)},function(e){E=e,n(2,E)},function(e){A=e,n(3,A)}]}class rs extends xe{constructor(e){var t;super(),Ko.getElementById("svelte-wpjws5-style")||((t=M("style")).id="svelte-wpjws5-style",t.textContent=".feather.svelte-wpjws5{position:absolute;top:1em;left:0.5em;color:#4300b0;margin-left:-2em}.feather2.svelte-wpjws5{position:absolute;top:1em;left:0.5em;color:light-gray;margin-left:-2em}.inputAutoComplete .autocomplete .chip,.inputAutoComplete .autocomplete .shown-on-focus{display:none !important}",D(Ko.head,t)),De(this,e,ns,ts,S,{classId:9,id:1,item:10,name:11,listName:12,record:13,value:0,noForm:14,disabled:15,formnovalidate:16},[-1,-1])}}const{document:is}=Ee;function os(e){e[26]=e[28].list,e[27]=e[28].items}function ss(e,t,n){const r=e.slice();return r[29]=t[n],r}function as(e,t,n){const r=e.slice();return r[32]=t[n],r}function ls(e,t,n){const r=e.slice();return r[32]=t[n],r}function cs(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function ds(e){let t,n,r,i,o,s,a,l,c,d,u,f,h,m,p,g,w,y;function v(t){e[23](t)}os(e),n=new e[7]({props:{outline:!0,$$slots:{default:[us]},$$scope:{ctx:e}}}),n.$on("click",e[22]);let $={id:e[8]};void 0!==e[1]&&($.value=e[1]),s=new e[6]({props:$}),re.push(()=>Se(s,"value",v)),s.$on("input",e[12]),d=new ot({props:{size:"18"}});let I=e[27]?.length&&function(e){let t,n,r=e[27],i=[];for(let t=0;t<r.length;t+=1)i[t]=fs(ls(e,r,t));return{c(){t=M("thead"),n=M("tr");for(let e=0;e<i.length;e+=1)i[e].c();z(n,"class","svelte-14hcfjl"),z(t,"class","svelte-14hcfjl")},m(e,r){x(e,t,r),D(t,n);for(let e=0;e<i.length;e+=1)i[e].m(n,null)},p(e,t){if(2048&t[0]){let o;for(r=e[27],o=0;o<r.length;o+=1){const s=ls(e,r,o);i[o]?i[o].p(s,t):(i[o]=fs(s),i[o].c(),i[o].m(n,null))}for(;o<i.length;o+=1)i[o].d(1);i.length=r.length}},d(e){e&&k(t),O(i,e)}}}(e),_=e[26]?.length&&function(e){let t,n=e[26],r=[];for(let t=0;t<n.length;t+=1)r[t]=ps(ss(e,n,t));return{c(){for(let e=0;e<r.length;e+=1)r[e].c();t=F()},m(e,n){for(let t=0;t<r.length;t+=1)r[t].m(e,n);x(e,t,n)},p(e,i){if(11779&i[0]){let o;for(n=e[26],o=0;o<n.length;o+=1){const s=ss(e,n,o);r[o]?r[o].p(s,i):(r[o]=ps(s),r[o].c(),r[o].m(t.parentNode,t))}for(;o<r.length;o+=1)r[o].d(1);r.length=n.length}},d(e){O(r,e),e&&k(t)}}}(e);return{c(){t=M("div"),Ne(n.$$.fragment),r=L(),i=M("div"),o=B("Suchen: "),Ne(s.$$.fragment),l=L(),c=M("span"),Ne(d.$$.fragment),u=L(),f=M("div"),h=M("table"),I&&I.c(),m=L(),p=M("tbody"),_&&_.c(),z(t,"class","form--buttons svelte-14hcfjl"),z(c,"class","feather pointer svelte-14hcfjl"),q(i,"margin-bottom","1em"),q(i,"position","relative"),z(h,"striped",""),z(h,"class","svelte-14hcfjl"),z(f,"class","eList svelte-14hcfjl")},m(a,v){x(a,t,v),Te(n,t,null),x(a,r,v),x(a,i,v),D(i,o),Te(s,i,null),D(i,l),D(i,c),Te(d,c,null),x(a,u,v),x(a,f,v),D(f,h),I&&I.m(h,null),D(h,m),D(h,p),_&&_.m(p,null),g=!0,w||(y=V(c,"click",e[14]),w=!0)},p(e,t){os(e);const r={};64&t[1]&&(r.$$scope={dirty:t,ctx:e}),n.$set(r);const i={};!a&&2&t[0]&&(a=!0,i.value=e[1],ue(()=>a=!1)),s.$set(i),e[27]?.length&&I.p(e,t),e[26]?.length&&_.p(e,t)},i(e){g||($e(n.$$.fragment,e),$e(s.$$.fragment,e),$e(d.$$.fragment,e),g=!0)},o(e){Ie(n.$$.fragment,e),Ie(s.$$.fragment,e),Ie(d.$$.fragment,e),g=!1},d(e){e&&k(t),Re(n),e&&k(r),e&&k(i),Re(s),Re(d),e&&k(u),e&&k(f),I&&I.d(),_&&_.d(),w=!1,y()}}}function us(e){let t;return{c(){t=B("Abbrechen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function fs(e){let t,n,r=e[32]?.designation+"";return{c(){t=M("th"),n=B(r),z(t,"class","svelte-14hcfjl")},m(e,r){x(e,t,r),D(t,n)},p:_,d(e){e&&k(t)}}}function hs(e){let t,n,r=e[27],i=[];for(let t=0;t<r.length;t+=1)i[t]=ms(as(e,r,t));return{c(){t=M("tr");for(let e=0;e<i.length;e+=1)i[e].c();n=L(),z(t,"class","pointer svelte-14hcfjl"),G(t,"active",e[29]._id===e[0])},m(e,r){x(e,t,r);for(let e=0;e<i.length;e+=1)i[e].m(t,null);D(t,n)},p(e,o){if(3584&o[0]){let s;for(r=e[27],s=0;s<r.length;s+=1){const a=as(e,r,s);i[s]?i[s].p(a,o):(i[s]=ms(a),i[s].c(),i[s].m(t,n))}for(;s<i.length;s+=1)i[s].d(1);i.length=r.length}2049&o[0]&&G(t,"active",e[29]._id===e[0])},d(e){e&&k(t),O(i,e)}}}function ms(e){let t,n,r,i,o=e[9](e[29],e[32])+"";return{c(){t=M("td"),n=B(o),z(t,"class","svelte-14hcfjl")},m(o,s){x(o,t,s),D(t,n),r||(i=V(t,"click",W(e[10](e[29]))),r=!0)},p(t,n){e=t},d(e){e&&k(t),r=!1,i()}}}function ps(e){let t,n=e[13](e[29],e[27],e[1]),r=n&&hs(e);return{c(){r&&r.c(),t=F()},m(e,n){r&&r.m(e,n),x(e,t,n)},p(e,i){2&i[0]&&(n=e[13](e[29],e[27],e[1])),n?r?r.p(e,i):(r=hs(e),r.c(),r.m(t.parentNode,t)):r&&(r.d(1),r=null)},d(e){r&&r.d(e),e&&k(t)}}}function gs(e){let t,n;return t=new e[5]({}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p:_,i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function ws(e){let t,n,r,i;t=new e[4]({});let o={ctx:e,current:null,token:null,hasCatch:!1,pending:gs,then:ds,catch:cs,value:28,blocks:[,,,]};return _e(e[11](),o),{c(){Ne(t.$$.fragment),n=L(),r=F(),o.block.c()},m(e,s){Te(t,e,s),x(e,n,s),x(e,r,s),o.block.m(e,o.anchor=s),o.mount=()=>r.parentNode,o.anchor=r,i=!0},p(t,n){Ce(o,e=t,n)},i(e){i||($e(t.$$.fragment,e),$e(o.block),i=!0)},o(e){Ie(t.$$.fragment,e);for(let e=0;e<3;e+=1){Ie(o.blocks[e])}i=!1},d(e){Re(t,e),e&&k(n),e&&k(r),o.block.d(e),o.token=null,o=null}}}function ys(e){let t,n;return t=new e[3]({props:{title:"Auswahl",class:"eList",$$slots:{default:[ws]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};3&n[0]|64&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function vs(e,n,i){const o=ee(),{Dialog:s,Divider:a,Loading:l,TextField:d,Button:u}=c;let{item:f}=n,{className:h}=n,{classId:p}=n,{rowId:g}=n,{viewName:y}=n,{viewValue:v}=n,{recordId:$}=n,{filter:I}=n,_="",C=p+Math.floor(9e3*Math.random()+1e3).toString()+"search";const E=(e,t)=>{if(!t)return;const n=e[t.name];return"boolean"==typeof n?w(n):m(e[`_${t.name}`]||e[t.name]||"")},A=t.getSchemaByClass(h);Q(()=>{window.setTimeout(()=>{const e=document.querySelector("tr.active");e&&e.scrollIntoView({block:"end",behavior:"smooth"}),document.getElementById(C)?.focus()},200)}),r.subscribe(async e=>{if(!e)return;const t=await A;e.eventId===t.id&&kp(t.class,e.eventId)});return e.$$set=e=>{"item"in e&&i(15,f=e.item),"className"in e&&i(16,h=e.className),"classId"in e&&i(17,p=e.classId),"rowId"in e&&i(0,g=e.rowId),"viewName"in e&&i(18,y=e.viewName),"viewValue"in e&&i(19,v=e.viewValue),"recordId"in e&&i(20,$=e.recordId),"filter"in e&&i(21,I=e.filter)},[g,_,o,s,a,l,d,u,C,E,e=>()=>o("choose",{row:e}),async()=>{const e=await A,n="."+p+"#"+y;document.querySelector(n);let r={[y]:v},i=[];r[y]&&(i=await t.getSectionView(e.class,r,!0)),I&&(i=i.filter(e=>e._id!=I));const o=e.display;return{list:i,items:await tn(o,e,i)}},({detail:{value:e}})=>{i(1,_=e)},(e,t,n)=>{if(!n)return!0;for(const r of t)if(E(e,r)?.toLowerCase()?.includes(n.toLowerCase()))return!0;return!1},()=>{i(1,_="")},f,h,p,y,v,$,I,()=>o("back"),function(e){_=e,i(1,_)}]}class $s extends xe{constructor(e){var t;super(),is.getElementById("svelte-14hcfjl-style")||((t=M("style")).id="svelte-14hcfjl-style",t.textContent=".feather.svelte-14hcfjl.svelte-14hcfjl{position:absolute;top:2em;right:0.5em;color:#326173}.eList.svelte-14hcfjl.svelte-14hcfjl{height:fit-content;max-height:65vh;overflow-y:scroll;overflow-x:auto}.eList.svelte-14hcfjl table.svelte-14hcfjl{min-width:30vw;position:relative;width:max-content !important;max-width:50vh !important}.eList.svelte-14hcfjl table thead.svelte-14hcfjl{position:sticky;top:0;background:#326173;color:white}.eList.svelte-14hcfjl table tbody tr.svelte-14hcfjl{height:2.3em}th.svelte-14hcfjl.svelte-14hcfjl,td.svelte-14hcfjl.svelte-14hcfjl{padding-left:0.4em;padding-right:0.4em}tr.pointer.svelte-14hcfjl.svelte-14hcfjl:hover{background-color:#DAE1E5}tr.active.svelte-14hcfjl.svelte-14hcfjl{color:#326173;background-color:#fcebd5}.form--buttons.svelte-14hcfjl.svelte-14hcfjl{display:flex;gap:1em;padding:0.5em 0}",D(is.head,t)),De(this,e,vs,ys,S,{item:15,className:16,classId:17,rowId:0,viewName:18,viewValue:19,recordId:20,filter:21},[-1,-1])}}function Is(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function _s(e){let t,n,r,i,o;function s(t){e[21](t)}let a={id:e[2],name:e[3].name,inputClass:e[5]||e[1],disabled:e[6],formnovalidate:e[7],readonly:e[13],pattern:e[12],required:e[14],style:"padding-left:2em;"};void 0!==e[0]&&(a.value=e[0]),n=new e[10]({props:a}),re.push(()=>Se(n,"value",s));let l=!e[6]&&Cs(e);return{c(){t=M("div"),Ne(n.$$.fragment),i=L(),l&&l.c(),q(t,"position","relative")},m(e,r){x(e,t,r),Te(n,t,null),D(t,i),l&&l.m(t,null),o=!0},p(e,i){const o={};4&i&&(o.id=e[2]),8&i&&(o.name=e[3].name),34&i&&(o.inputClass=e[5]||e[1]),64&i&&(o.disabled=e[6]),128&i&&(o.formnovalidate=e[7]),!r&&1&i&&(r=!0,o.value=e[0],ue(()=>r=!1)),n.$set(o),e[6]?l&&(ye(),Ie(l,1,1,()=>{l=null}),ve()):l?(l.p(e,i),64&i&&$e(l,1)):(l=Cs(e),l.c(),$e(l,1),l.m(t,null))},i(e){o||($e(n.$$.fragment,e),$e(l),o=!0)},o(e){Ie(n.$$.fragment,e),Ie(l),o=!1},d(e){e&&k(t),Re(n),l&&l.d()}}}function Cs(e){let t,n,r,i,o;return n=new Mt({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather pointer svelte-wbrqzu")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[17]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function Es(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function As(e){let t,n,r;function i(t){e[22](t)}let o={class:"tModal",noClickaway:!0,$$slots:{default:[bs]},$$scope:{ctx:e}};return void 0!==e[8]&&(o.open=e[8]),t=new e[11]({props:o}),re.push(()=>Se(t,"open",i)),{c(){Ne(t.$$.fragment)},m(e,n){Te(t,e,n),r=!0},p(e,r){const i={};268435994&r&&(i.$$scope={dirty:r,ctx:e}),!n&&256&r&&(n=!0,i.open=e[8],ue(()=>n=!1)),t.$set(i)},i(e){r||($e(t.$$.fragment,e),r=!0)},o(e){Ie(t.$$.fragment,e),r=!1},d(e){Re(t,e)}}}function bs(e){let t,n;return t=new $s({props:{item:e[3],className:e[3].refClass,classId:e[1],rowId:"",recordId:e[4]._id,viewName:e[15].selection,viewValue:e[9],filter:e[4]._id}}),t.$on("choose",e[18]),t.$on("back",e[19]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};8&n&&(r.item=e[3]),8&n&&(r.className=e[3].refClass),2&n&&(r.classId=e[1]),16&n&&(r.recordId=e[4]._id),512&n&&(r.viewValue=e[9]),16&n&&(r.filter=e[4]._id),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Ss(e){let t,n,r,i={ctx:e,current:null,token:null,hasCatch:!1,pending:Es,then:_s,catch:Is,value:27,blocks:[,,,]};_e(e[16](),i);let o=e[8]&&As(e);return{c(){i.block.c(),t=L(),o&&o.c(),n=F()},m(e,s){i.block.m(e,i.anchor=s),i.mount=()=>t.parentNode,i.anchor=t,x(e,t,s),o&&o.m(e,s),x(e,n,s),r=!0},p(t,[r]){Ce(i,e=t,r),e[8]?o?(o.p(e,r),256&r&&$e(o,1)):(o=As(e),o.c(),$e(o,1),o.m(n.parentNode,n)):o&&(ye(),Ie(o,1,1,()=>{o=null}),ve())},i(e){r||($e(i.block),$e(o),r=!0)},o(e){for(let e=0;e<3;e+=1){Ie(i.blocks[e])}Ie(o),r=!1},d(e){i.block.d(e),i.token=null,i=null,e&&k(t),o&&o.d(e),e&&k(n)}}}function Ns(e,t,n){const{TextField:r,Modal:i}=c;let{classId:o}=t,{id:s}=t,{item:a}=t,{record:l}=t,{value:d}=t,{noForm:u=!1}=t,{disabled:f}=t,{formnovalidate:h}=t,{praefix:m}=t;const{properties:p={}}=a;let g,{pattern:w,placeholder:y,readonly:v,required:$=!1,view:I}=p,_=!1;const C=()=>{n(8,_=!1)};return e.$$set=e=>{"classId"in e&&n(1,o=e.classId),"id"in e&&n(2,s=e.id),"item"in e&&n(3,a=e.item),"record"in e&&n(4,l=e.record),"value"in e&&n(0,d=e.value),"noForm"in e&&n(5,u=e.noForm),"disabled"in e&&n(6,f=e.disabled),"formnovalidate"in e&&n(7,h=e.formnovalidate),"praefix"in e&&n(20,m=e.praefix)},[d,o,s,a,l,u,f,h,_,g,r,i,w,v,$,I,async()=>(n(9,g=l[I.selection]),!0),()=>{n(8,_=!0)},({detail:e})=>{n(0,d=e.row[I.value?I.value:"_id"]),C()},C,m,function(e){d=e,n(0,d)},function(e){_=e,n(8,_)}]}class Ts extends xe{constructor(e){var t;super(),document.getElementById("svelte-wbrqzu-style")||((t=M("style")).id="svelte-wbrqzu-style",t.textContent=".feather.svelte-wbrqzu{position:absolute;top:0.75em;left:0.5em;color:#4300b0}",D(document.head,t)),De(this,e,Ns,Ss,S,{classId:1,id:2,item:3,record:4,value:0,noForm:5,disabled:6,formnovalidate:7,praefix:20})}}function Rs(e,t,n){const r=e.slice();return r[12]=t[n][0],r[13]=t[n][1],r}function Ds(e){let t;return{c(){t=M("option"),t.textContent="- ",t.selected=!0,t.__value="",t.value=t.__value},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function xs(e){let t;return{c(){t=M("option"),t.textContent="-- Bitte wählen -- ",t.disabled=!0,t.selected=!0,t.__value="",t.value=t.__value},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function ks(e){let t,n,r,i,o=e[12]+"";return{c(){t=M("option"),n=B(o),t.__value=r=e[13],t.value=t.__value,t.selected=i=e[0]==e[13]},m(e,r){x(e,t,r),D(t,n)},p(e,s){64&s&&o!==(o=e[12]+"")&&H(n,o),64&s&&r!==(r=e[13])&&(t.__value=r,t.value=t.__value),65&s&&i!==(i=e[0]==e[13])&&(t.selected=i)},d(e){e&&k(t)}}}function Os(e){let t,n,r,i,o,s=!e[7]&&function(e){let t;function n(e,t){return e[5]&&!0!==e[8]?xs:Ds}let r=n(e),i=r(e);return{c(){i.c(),t=F()},m(e,n){i.m(e,n),x(e,t,n)},p(e,o){r!==(r=n(e))&&(i.d(1),i=r(e),i&&(i.c(),i.m(t.parentNode,t)))},d(e){i.d(e),e&&k(t)}}}(e),a=e[6],l=[];for(let t=0;t<a.length;t+=1)l[t]=ks(Rs(e,a,t));return{c(){t=M("select"),s&&s.c(),n=F();for(let e=0;e<l.length;e+=1)l[e].c();z(t,"class",r=T(e[3]||e[4])+" svelte-5xpzvo"),z(t,"id",e[2]),z(t,"name",e[2]),t.disabled=e[1],t.required=e[5]},m(r,a){x(r,t,a),s&&s.m(t,null),D(t,n);for(let e=0;e<l.length;e+=1)l[e].m(t,null);i||(o=V(t,"change",e[9]),i=!0)},p(e,[n]){if(e[7]||s.p(e,n),65&n){let r;for(a=e[6],r=0;r<a.length;r+=1){const i=Rs(e,a,r);l[r]?l[r].p(i,n):(l[r]=ks(i),l[r].c(),l[r].m(t,null))}for(;r<l.length;r+=1)l[r].d(1);l.length=a.length}24&n&&r!==(r=T(e[3]||e[4])+" svelte-5xpzvo")&&z(t,"class",r),4&n&&z(t,"id",e[2]),4&n&&z(t,"name",e[2]),2&n&&(t.disabled=e[1]),32&n&&(t.required=e[5])},i:_,o:_,d(e){e&&k(t),s&&s.d(),O(l,e),i=!1,o()}}}function Ms(e,t,n){const r=ee();let{id:i}=t,{item:o}=t,{value:s}=t,{noForm:a=!1}=t,{classId:l}=t,{disabled:c}=t,{required:d}=t,{enum:u,regulation:f,readonly:h}=o.properties;u&&(u=u.map(e=>[e,e])),"businessMonth"===f&&(s||=1,u=[["Januar",1],["Februar",2],["März",3],["April",4],["Mai",5],["Juni",6],["Juli",7],["August",8],["September",9],["Oktober",10],["November",11],["Dezember",12]]),"financialAccounting"===f&&(s||=2024,u=[["2024/2025",2024]]),"valueAddedTax"===f&&(s||=0,u=[["0% Steuerbefreit",0],["8.1% Normalsatz",.081],["2.6% Reduzierter Satz",.026],["3.8% Beherbergung",.038]]),c||=!0===h,c||(c=void 0);return e.$$set=e=>{"id"in e&&n(2,i=e.id),"item"in e&&n(10,o=e.item),"value"in e&&n(0,s=e.value),"noForm"in e&&n(3,a=e.noForm),"classId"in e&&n(4,l=e.classId),"disabled"in e&&n(1,c=e.disabled),"required"in e&&n(5,d=e.required)},[s,c,i,a,l,d,u,f,h,e=>r("blur",{value:e.srcElement.value}),o]}class Ps extends xe{constructor(e){var t;super(),document.getElementById("svelte-5xpzvo-style")||((t=M("style")).id="svelte-5xpzvo-style",t.textContent="select.svelte-5xpzvo{padding:0 0.625em 0.0625em;box-sizing:border-box;width:100%;border:0 solid rgba(0, 0, 0, 0.42);border-bottom-width:0px;border-bottom-width:0.0625em;border-top-left-radius:0.375em;border-top-right-radius:0.375em;background-color:#f5f5f5;outline:none;font-size:1rem;font-weight:300;height:2.8em}select.svelte-5xpzvo:focus{border:none;border-bottom:2px solid #4300b0}",D(document.head,t)),De(this,e,Ms,Os,S,{id:2,item:10,value:0,noForm:3,classId:4,disabled:1,required:5})}}function Bs(e){let t,n,r,i,o,s,a,l,c;i=new e[8]({props:{id:"dp-"+e[1]+(e[2]?"-"+e[2]:""),value:e[0],readonly:e[5],required:e[7],disabled:e[6],noCalendar:e[9],closeOnSelection:!0}}),i.$on("change",e[11]);let d=e[10]&&function(e){let t,n,r,i,o;return n=new Ue({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"title","Übernehmen"),z(t,"class","pointer feather")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[12]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}(e);return{c(){t=M("input"),r=L(),Ne(i.$$.fragment),o=L(),d&&d.c(),s=F(),z(t,"type","string"),z(t,"class",n=e[3]||e[4]),z(t,"id",e[1]),z(t,"name",e[1]),t.hidden=!0},m(n,u){x(n,t,u),j(t,e[0]),x(n,r,u),Te(i,n,u),x(n,o,u),d&&d.m(n,u),x(n,s,u),a=!0,l||(c=V(t,"input",e[18]),l=!0)},p(e,[r]){(!a||24&r&&n!==(n=e[3]||e[4]))&&z(t,"class",n),(!a||2&r)&&z(t,"id",e[1]),(!a||2&r)&&z(t,"name",e[1]),1&r&&j(t,e[0]);const o={};6&r&&(o.id="dp-"+e[1]+(e[2]?"-"+e[2]:"")),1&r&&(o.value=e[0]),32&r&&(o.readonly=e[5]),128&r&&(o.required=e[7]),64&r&&(o.disabled=e[6]),i.$set(o),e[10]&&d.p(e,r)},i(e){a||($e(i.$$.fragment,e),$e(d),a=!0)},o(e){Ie(i.$$.fragment,e),Ie(d),a=!1},d(e){e&&k(t),e&&k(r),Re(i,e),e&&k(o),d&&d.d(e),e&&k(s),l=!1,c()}}}let Ls=new Map;function Fs(e,n,r){const i=ee(),{DatePicker:o}=c;let{value:s}=n,{id:a}=n,{item:l}=n,{record:d}=n,{praefix:u}=n,{noForm:f=!1}=n,{classId:h}=n,{eventId:m}=n,{readonly:p}=n,{disabled:g}=n,{required:w}=n,{notifyList:y}=n,{dateInput:v}=n;s||(s=void 0);let $=null;const I=(void 0===u?"":u.toString())+"-"+m+"-"+l.name,_=l.properties?.noCalendar||!1,C=l.properties?.transfer,E=({detail:e})=>{try{r(0,s=Yr(e.value,s)),void 0!==u&&""!==u&&Ls.set(I,new Date(s.valueOf())),A(s)}catch{r(0,s=void 0)}},A=e=>{i("change",{value:new Date(e.valueOf())})};if(void 0!==u&&!s){const e=new Date,t=new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0);s=Yr(t,s)}return e.$$set=e=>{"value"in e&&r(0,s=e.value),"id"in e&&r(1,a=e.id),"item"in e&&r(13,l=e.item),"record"in e&&r(14,d=e.record),"praefix"in e&&r(2,u=e.praefix),"noForm"in e&&r(3,f=e.noForm),"classId"in e&&r(4,h=e.classId),"eventId"in e&&r(15,m=e.eventId),"readonly"in e&&r(5,p=e.readonly),"disabled"in e&&r(6,g=e.disabled),"required"in e&&r(7,w=e.required),"notifyList"in e&&r(16,y=e.notifyList),"dateInput"in e&&r(17,v=e.dateInput)},e.$$.update=()=>{if(1&e.$$.dirty&&s&&!C&&Ls.has(I)&&r(0,s=Ls.get(I)),65536&e.$$.dirty&&(async e=>{if(null===$){const e=(await t.getEvent(m)).output.class[0].item;$=e.find(e=>e.properties?.value?.formula)}$&&$.properties.value.formula.argument[0].refItem===l.name&&(e&&e.itemName!==l.name&&!$.properties.value.formula.argument[1].value&&e.itemName!==$.properties.value.formula.argument[1].refItem.split(".")[0]||i("formula",{item:$}))})(y),131072&e.$$.dirty&&((e={})=>{let{ref:t,val:n,t:r,l:i,n:o}=e;if(o&&(n=o),!n||isNaN(new Date(n)))return;if(r)return;if(!t)return;const[s,a]=t.split(".");s===i&&a===l.name&&null!=u&&E({detail:{value:new Date(n)}})})(v),24673&e.$$.dirty&&d&&d[l.name])try{g||p||r(0,s=Yr(d[l.name],s))}catch{}},[s,a,u,f,h,p,g,w,o,_,C,E,()=>{i("record",{target:C.target,value:s.toISOString()})},l,d,m,y,v,function(){s=this.value,r(0,s),r(14,d),r(13,l),r(6,g),r(5,p)}]}class Vs extends xe{constructor(e){super(),De(this,e,Fs,Bs,S,{value:0,id:1,item:13,record:14,praefix:2,noForm:3,classId:4,eventId:15,readonly:5,disabled:6,required:7,notifyList:16,dateInput:17})}}function Us(e){let t;return{c(){t=B("Stunden")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Ws(e){let t,n;return t=new e[4]({props:{slot:"hours-label",$$slots:{default:[Us]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};4096&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function zs(e){let t;return{c(){t=B("Minuten")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Hs(e){let t,n;return t=new e[4]({props:{slot:"minutes-label",$$slots:{default:[zs]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};4096&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function js(e){let t;return{c(){t=B("Jetzt")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function qs(e){let t,n;return t=new e[4]({props:{slot:"now-label",$$slots:{default:[js]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};4096&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Gs(e){let t,n,r,i,o,s,a,l,c;return i=new e[5]({props:{value:e[0],closeOnSelection:!0}}),i.$on("change",e[8]),s=new e[6]({props:{value:e[0],$$slots:{"now-label":[qs],"minutes-label":[Hs],"hours-label":[Ws]},$$scope:{ctx:e}}}),s.$on("change",e[7]),{c(){t=M("input"),r=L(),Ne(i.$$.fragment),o=L(),Ne(s.$$.fragment),z(t,"type","string"),z(t,"class",n=e[2]||e[3]),z(t,"id",e[1]),z(t,"name",e[1]),t.hidden=!0},m(n,d){x(n,t,d),j(t,e[0]),x(n,r,d),Te(i,n,d),x(n,o,d),Te(s,n,d),a=!0,l||(c=V(t,"input",e[9]),l=!0)},p(e,[r]){(!a||12&r&&n!==(n=e[2]||e[3]))&&z(t,"class",n),(!a||2&r)&&z(t,"id",e[1]),(!a||2&r)&&z(t,"name",e[1]),1&r&&j(t,e[0]);const o={};1&r&&(o.value=e[0]),i.$set(o);const l={};1&r&&(l.value=e[0]),4096&r&&(l.$$scope={dirty:r,ctx:e}),s.$set(l)},i(e){a||($e(i.$$.fragment,e),$e(s.$$.fragment,e),a=!0)},o(e){Ie(i.$$.fragment,e),Ie(s.$$.fragment,e),a=!1},d(e){e&&k(t),e&&k(r),Re(i,e),e&&k(o),Re(s,e),l=!1,c()}}}function Xs(e,t,n){const r=ee(),{Label:i,DatePicker:o,TimePicker:s}=c;let{value:a}=t,{id:l}=t,{noForm:d=!1}=t,{classId:u}=t;const f=e=>r("change",{value:e});return e.$$set=e=>{"value"in e&&n(0,a=e.value),"id"in e&&n(1,l=e.id),"noForm"in e&&n(2,d=e.noForm),"classId"in e&&n(3,u=e.classId)},[a,l,d,u,i,o,s,({detail:e})=>{var t,r;n(0,(t=e.value,r=a,a=null==t||null==r?t:(r.setHours(t.getHours(),t.getMinutes(),t.getSeconds()),r))),f(a)},({detail:e})=>{n(0,a=Yr(e.value,a)),f(a)},function(){a=this.value,n(0,a)}]}class Ys extends xe{constructor(e){super(),De(this,e,Xs,Gs,S,{value:0,id:1,noForm:2,classId:3})}}function Zs(e){let t,n,r,i,o,s,a,l,c,d,u,f,h,m,p,g;return u=new e[9]({props:{format:e[7],required:e[3],disabled:e[4],value:e[5],noCalendar:e[10],closeOnSelection:!0}}),u.$on("change",e[11]),h=new e[9]({props:{format:e[8],required:e[3],disabled:e[4],value:e[6],noCalendar:e[10],class:"moveLeft",closeOnSelection:!0}}),h.$on("change",e[12]),{c(){t=M("input"),o=L(),s=M("input"),d=L(),Ne(u.$$.fragment),f=B(" /\n"),Ne(h.$$.fragment),z(t,"type","string"),z(t,"class",n=e[1]||e[2]),z(t,"id",r=e[0]+"_from"),z(t,"name",i=e[0]+"_from"),t.hidden=!0,z(s,"type","string"),z(s,"class",a=e[1]||e[2]),z(s,"id",l=e[0]+"_to"),z(s,"name",c=e[0]+"_to"),s.hidden=!0},m(n,r){x(n,t,r),j(t,e[5]),x(n,o,r),x(n,s,r),j(s,e[6]),x(n,d,r),Te(u,n,r),x(n,f,r),Te(h,n,r),m=!0,p||(g=[V(t,"input",e[15]),V(s,"input",e[16])],p=!0)},p(e,[o]){(!m||6&o&&n!==(n=e[1]||e[2]))&&z(t,"class",n),(!m||1&o&&r!==(r=e[0]+"_from"))&&z(t,"id",r),(!m||1&o&&i!==(i=e[0]+"_from"))&&z(t,"name",i),32&o&&j(t,e[5]),(!m||6&o&&a!==(a=e[1]||e[2]))&&z(s,"class",a),(!m||1&o&&l!==(l=e[0]+"_to"))&&z(s,"id",l),(!m||1&o&&c!==(c=e[0]+"_to"))&&z(s,"name",c),64&o&&j(s,e[6]);const d={};128&o&&(d.format=e[7]),8&o&&(d.required=e[3]),16&o&&(d.disabled=e[4]),32&o&&(d.value=e[5]),u.$set(d);const f={};256&o&&(f.format=e[8]),8&o&&(f.required=e[3]),16&o&&(f.disabled=e[4]),64&o&&(f.value=e[6]),h.$set(f)},i(e){m||($e(u.$$.fragment,e),$e(h.$$.fragment,e),m=!0)},o(e){Ie(u.$$.fragment,e),Ie(h.$$.fragment,e),m=!1},d(e){e&&k(t),e&&k(o),e&&k(s),e&&k(d),Re(u,e),e&&k(f),Re(h,e),p=!1,A(g)}}}function Ks(e,t,n){const r=ee(),{DatePicker:i}=c;let{value:o}=t,{id:s}=t,{item:a}=t,{noForm:l=!1}=t,{classId:d}=t,{required:u}=t,{disabled:f}=t;const{noCalendar:h,preset:m}=a.properties||{};let p,g,w="%d.%m.%Y",y="%d.%m.%Y";return e.$$set=e=>{"value"in e&&n(13,o=e.value),"id"in e&&n(0,s=e.id),"item"in e&&n(14,a=e.item),"noForm"in e&&n(1,l=e.noForm),"classId"in e&&n(2,d=e.classId),"required"in e&&n(3,u=e.required),"disabled"in e&&n(4,f=e.disabled)},e.$$.update=()=>{if(8304&e.$$.dirty&&o){if((o?.from||o?.to)&&(n(5,p=o?.from),n(6,g=o?.to)),m){const{first:e,last:t}=function(e){const t=new Date;let n=t.getFullYear();const r=t.getMonth();let i,o;switch(t.getDate(),e){case"currentMonth":i=o=r;break;case"currentYear":i=0,o=i+11;break;case"lastSemiYear":i=r<6?6:0,o=i+5,i>5&&--n;break;case"lastQuarter":i=r<3?9:r<6?0:r<9?3:6,o=i+2,i>8&&--n;break;case"lastMonth":i=o=0===r?11:r-1,11===i&&--n;break;default:i=0,o=i+11,--n}return{first:new Date(n,i,1),last:new Date(n,o+1,0)}}(m);e&&!p&&n(5,p=e),t&&!g&&n(6,g=t)}"Invalid Date"===p?.toString()&&n(5,p=void 0),"Invalid Date"===g?.toString()&&n(6,g=void 0),f&&(n(7,w=void 0===p?"":"%d.%m.%Y"),n(8,y=void 0===g?"":"%d.%m.%Y"))}},[s,l,d,u,f,p,g,w,y,i,h,({detail:e})=>{n(5,p=Yr(e.value,p)),g&&p&&g.valueOf()-p.valueOf()<0&&n(5,p=void 0),n(13,o.from=p,o),r("change",{value:p,range:"_from"})},({detail:e})=>{n(6,g=Yr(e.value,g)),g&&p&&g.valueOf()-p.valueOf()<0&&n(6,g=void 0),n(13,o.to=g,o),r("change",{value:g,range:"_to"})},o,a,function(){p=this.value,n(5,p),n(13,o),n(6,g),n(4,f)},function(){g=this.value,n(6,g),n(13,o),n(5,p),n(4,f)}]}class Qs extends xe{constructor(e){var t;super(),document.getElementById("svelte-7itxk4-style")||((t=M("style")).id="svelte-7itxk4-style",t.textContent="div.date-picker.moveLeft div.dropdown.calendar{left:-3em !important}",D(document.head,t)),De(this,e,Ks,Zs,S,{value:13,id:0,item:14,noForm:1,classId:2,required:3,disabled:4})}}var Js={globalLocale:"en-US",globalFormat:"$0,0.00",globalRoundingMode:"HALF_EVEN",globalFormatRoundingMode:"HALF_AWAY_FROM_ZERO",globalExchangeRatesApi:{endpoint:void 0,headers:void 0,propertyPath:void 0}};function ea(e){return ea="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ea(e)}function ta(e){return function(e){if(Array.isArray(e))return e}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return na(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return na(e,t)}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function na(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ra={normalizePrecision:function(e){var t=e.reduce(function(e,t){return Math.max(e.getPrecision(),t.getPrecision())});return e.map(function(e){return e.getPrecision()!==t?e.convertPrecision(t):e})},minimum:function(e){var t=ta(e),n=t[0],r=t.slice(1),i=n;return r.forEach(function(e){i=i.lessThan(e)?i:e}),i},maximum:function(e){var t=ta(e),n=t[0],r=t.slice(1),i=n;return r.forEach(function(e){i=i.greaterThan(e)?i:e}),i}};function ia(e){return!isNaN(parseInt(e))&&isFinite(e)}function oa(e){return e%2==0}function sa(e){return ia(e)&&!Number.isInteger(e)}function aa(e){return Math.abs(e)%1==.5}function la(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(n,r){var i=Object.assign(new XMLHttpRequest,{onreadystatechange:function(){4===i.readyState&&(i.status>=200&&i.status<400?n(JSON.parse(i.responseText)):r(new Error(i.statusText)))},onerror:function(){r(new Error("Network error"))}});i.open("GET",e,!0),function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for(var n in t)e.setRequestHeader(n,t[n])}(i,t.headers),i.send()})}function ca(e){return void 0===e}function da(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:".",n={};return Object.entries(e).forEach(function(e){if("object"===ea(e[1])){var r=da(e[1]);Object.entries(r).forEach(function(r){n[e[0]+t+r[0]]=r[1]})}else n[e[0]]=e[1]}),n}function ua(){var e=function(e,t){var n=function(e){return Math.pow(10,function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0).toString();if(e.indexOf("e-")>0)return parseInt(e.split("e-")[1]);var t=e.split(".")[1];return t?t.length:0}(e))},r=Math.max(n(e),n(t));return Math.round(e*r)*Math.round(t*r)/(r*r)},t={HALF_ODD:function(e){var t=Math.round(e);return aa(e)&&oa(t)?t-1:t},HALF_EVEN:function(e){var t=Math.round(e);return aa(e)?oa(t)?t:t-1:t},HALF_UP:function(e){return Math.round(e)},HALF_DOWN:function(e){return aa(e)?Math.floor(e):Math.round(e)},HALF_TOWARDS_ZERO:function(e){return aa(e)?Math.sign(e)*Math.floor(Math.abs(e)):Math.round(e)},HALF_AWAY_FROM_ZERO:function(e){return aa(e)?Math.sign(e)*Math.ceil(Math.abs(e)):Math.round(e)},DOWN:function(e){return Math.floor(e)}};return{add:function(e,t){return e+t},subtract:function(e,t){return e-t},multiply:function(t,n){return sa(t)||sa(n)?e(t,n):t*n},divide:function(e,t){return e/t},modulo:function(e,t){return e%t},round:function(e){return t[arguments.length>1&&void 0!==arguments[1]?arguments[1]:"HALF_EVEN"](e)}}}var fa=ua();function ha(e){var t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;for(var n in t)e=e.replace("{{".concat(n,"}}"),t[n]);return e};return{getExchangeRate:function(n,r){return(i=e.endpoint,!Boolean(i)||"object"!==ea(i)&&"function"!=typeof i||"function"!=typeof i.then?function(n,r){return la(t(e.endpoint,{from:n,to:r}),{headers:e.headers})}(n,r):e.endpoint).then(function(i){return da(i)[t(e.propertyPath,{from:n,to:r})]});var i}}}function ma(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Error;if(!e)throw new n(t)}function pa(e){ma(function(e){return ia(e)&&e<=100&&e>=0}(e),"You must provide a numeric value between 0 and 100.",RangeError)}function ga(e){ma(Number.isInteger(e),"You must provide an integer.",TypeError)}var wa=ua(),ya=Object.assign(function e(t){var n=Object.assign({},{amount:e.defaultAmount,currency:e.defaultCurrency,precision:e.defaultPrecision},t),r=n.amount,i=n.currency,o=n.precision;ga(r),ga(o);var s=e.globalLocale,a=e.globalFormat,l=e.globalRoundingMode,c=e.globalFormatRoundingMode,d=Object.assign({},e.globalExchangeRatesApi),u=function(t){var n=Object.assign({},Object.assign({},{amount:r,currency:i,precision:o},t),Object.assign({},{locale:this.locale},t));return Object.assign(e({amount:n.amount,currency:n.currency,precision:n.precision}),{locale:n.locale})},f=function(e){ma(this.hasSameCurrency(e),"You must provide a Dinero instance with the same currency.",TypeError)};return{getAmount:function(){return r},getCurrency:function(){return i},getLocale:function(){return this.locale||s},setLocale:function(e){return u.call(this,{locale:e})},getPrecision:function(){return o},convertPrecision:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c;ga(e);var n=this.getPrecision(),r=e>n,i=r?wa.multiply:wa.divide,o=r?[e,n]:[n,e],s=Math.pow(10,wa.subtract.apply(wa,o));return u.call(this,{amount:wa.round(i(this.getAmount(),s),t),precision:e})},add:function(t){f.call(this,t);var n=e.normalizePrecision([this,t]);return u.call(this,{amount:wa.add(n[0].getAmount(),n[1].getAmount()),precision:n[0].getPrecision()})},subtract:function(t){f.call(this,t);var n=e.normalizePrecision([this,t]);return u.call(this,{amount:wa.subtract(n[0].getAmount(),n[1].getAmount()),precision:n[0].getPrecision()})},multiply:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l;return u.call(this,{amount:wa.round(wa.multiply(this.getAmount(),e),t)})},divide:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l;return u.call(this,{amount:wa.round(wa.divide(this.getAmount(),e),t)})},percentage:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l;return pa(e),this.multiply(wa.divide(e,100),t)},allocate:function(e){var t=this;!function(e){ma(function(e){return e.length>0&&e.every(function(e){return e>=0})&&e.some(function(e){return e>0})}(e),"You must provide a non-empty array of numeric values greater than 0.",TypeError)}(e);for(var n=e.reduce(function(e,t){return wa.add(e,t)}),r=this.getAmount(),i=e.map(function(e){var i=Math.floor(wa.divide(wa.multiply(t.getAmount(),e),n));return r=wa.subtract(r,i),u.call(t,{amount:i})}),o=0;r>0;)e[o]>0&&(i[o]=i[o].add(u.call(this,{amount:1})),r=wa.subtract(r,1)),o+=1;return i},convert:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.endpoint,i=void 0===r?d.endpoint:r,o=n.propertyPath,s=void 0===o?d.propertyPath||"rates.{{to}}":o,a=n.headers,c=void 0===a?d.headers:a,f=n.roundingMode,h=void 0===f?l:f,m=Object.assign({},{endpoint:i,propertyPath:s,headers:c,roundingMode:h});return ha(m).getExchangeRate(this.getCurrency(),e).then(function(n){return ma(!ca(n),'No rate was found for the destination currency "'.concat(e,'".'),TypeError),u.call(t,{amount:wa.round(wa.multiply(t.getAmount(),parseFloat(n)),m.roundingMode),currency:e})})},equalsTo:function(e){return this.hasSameAmount(e)&&this.hasSameCurrency(e)},lessThan:function(t){f.call(this,t);var n=e.normalizePrecision([this,t]);return n[0].getAmount()<n[1].getAmount()},lessThanOrEqual:function(t){f.call(this,t);var n=e.normalizePrecision([this,t]);return n[0].getAmount()<=n[1].getAmount()},greaterThan:function(t){f.call(this,t);var n=e.normalizePrecision([this,t]);return n[0].getAmount()>n[1].getAmount()},greaterThanOrEqual:function(t){f.call(this,t);var n=e.normalizePrecision([this,t]);return n[0].getAmount()>=n[1].getAmount()},isZero:function(){return 0===this.getAmount()},isPositive:function(){return this.getAmount()>=0},isNegative:function(){return this.getAmount()<0},hasSubUnits:function(){return 0!==wa.modulo(this.getAmount(),Math.pow(10,o))},hasCents:function(){return 0!==wa.modulo(this.getAmount(),Math.pow(10,o))},hasSameCurrency:function(e){return this.getCurrency()===e.getCurrency()},hasSameAmount:function(t){var n=e.normalizePrecision([this,t]);return n[0].getAmount()===n[1].getAmount()},toFormat:function(){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c,t=function(e){var t=/^(?:(\$|USD)?0(?:(,)0)?(\.)?(0+)?|0(?:(,)0)?(\.)?(0+)?\s?(dollar)?)$/gm.exec(e);return{getMatches:function(){return null!==t?t.slice(1).filter(function(e){return!ca(e)}):[]},getMinimumFractionDigits:function(){var e=function(e){return"."===e};return ca(this.getMatches().find(e))?0:this.getMatches()[fa.add(this.getMatches().findIndex(e),1)].split("").length},getCurrencyDisplay:function(){return{USD:"code",dollar:"name",$:"symbol"}[this.getMatches().find(function(e){return"USD"===e||"dollar"===e||"$"===e})]},getStyle:function(){return ca(this.getCurrencyDisplay(this.getMatches()))?"decimal":"currency"},getUseGrouping:function(){return!ca(this.getMatches().find(function(e){return","===e}))}}}(arguments.length>0&&void 0!==arguments[0]?arguments[0]:a);return this.toRoundedUnit(t.getMinimumFractionDigits(),e).toLocaleString(this.getLocale(),{currencyDisplay:t.getCurrencyDisplay(),useGrouping:t.getUseGrouping(),minimumFractionDigits:t.getMinimumFractionDigits(),style:t.getStyle(),currency:this.getCurrency()})},toUnit:function(){return wa.divide(this.getAmount(),Math.pow(10,o))},toRoundedUnit:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c,n=Math.pow(10,e);return wa.divide(wa.round(wa.multiply(this.toUnit(),n),t),n)},toObject:function(){return{amount:r,currency:i,precision:o}},toJSON:function(){return this.toObject()}}},{defaultAmount:0,defaultCurrency:"USD",defaultPrecision:2},Js,ra),va={},$a={};!function(e){const t=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",n="["+t+"]["+(t+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040")+"]*",r=new RegExp("^"+n+"$");e.isExist=function(e){return void 0!==e},e.isEmptyObject=function(e){return 0===Object.keys(e).length},e.merge=function(e,t,n){if(t){const r=Object.keys(t),i=r.length;for(let o=0;o<i;o++)e[r[o]]="strict"===n?[t[r[o]]]:t[r[o]]}},e.getValue=function(t){return e.isExist(t)?t:""},e.isName=function(e){const t=r.exec(e);return!(null==t)},e.getAllMatches=function(e,t){const n=[];let r=t.exec(e);for(;r;){const i=[];i.startIndex=t.lastIndex-r[0].length;const o=r.length;for(let e=0;e<o;e++)i.push(r[e]);n.push(i),r=t.exec(e)}return n},e.nameRegexp=n}($a);const Ia=$a,_a={allowBooleanAttributes:!1,unpairedTags:[]};function Ca(e){return" "===e||"\t"===e||"\n"===e||"\r"===e}function Ea(e,t){const n=t;for(;t<e.length;t++)if("?"==e[t]||" "==e[t]){const r=e.substr(n,t-n);if(t>5&&"xml"===r)return xa("InvalidXml","XML declaration allowed only at the start of the document.",Ma(e,t));if("?"==e[t]&&">"==e[t+1]){t++;break}continue}return t}function Aa(e,t){if(e.length>t+5&&"-"===e[t+1]&&"-"===e[t+2]){for(t+=3;t<e.length;t++)if("-"===e[t]&&"-"===e[t+1]&&">"===e[t+2]){t+=2;break}}else if(e.length>t+8&&"D"===e[t+1]&&"O"===e[t+2]&&"C"===e[t+3]&&"T"===e[t+4]&&"Y"===e[t+5]&&"P"===e[t+6]&&"E"===e[t+7]){let n=1;for(t+=8;t<e.length;t++)if("<"===e[t])n++;else if(">"===e[t]&&(n--,0===n))break}else if(e.length>t+9&&"["===e[t+1]&&"C"===e[t+2]&&"D"===e[t+3]&&"A"===e[t+4]&&"T"===e[t+5]&&"A"===e[t+6]&&"["===e[t+7])for(t+=8;t<e.length;t++)if("]"===e[t]&&"]"===e[t+1]&&">"===e[t+2]){t+=2;break}return t}va.validate=function(e,t){t=Object.assign({},_a,t);const n=[];let r=!1,i=!1;"\ufeff"===e[0]&&(e=e.substr(1));for(let o=0;o<e.length;o++)if("<"===e[o]&&"?"===e[o+1]){if(o+=2,o=Ea(e,o),o.err)return o}else{if("<"!==e[o]){if(Ca(e[o]))continue;return xa("InvalidChar","char '"+e[o]+"' is not expected.",Ma(e,o))}{let s=o;if(o++,"!"===e[o]){o=Aa(e,o);continue}{let a=!1;"/"===e[o]&&(a=!0,o++);let l="";for(;o<e.length&&">"!==e[o]&&" "!==e[o]&&"\t"!==e[o]&&"\n"!==e[o]&&"\r"!==e[o];o++)l+=e[o];if(l=l.trim(),"/"===l[l.length-1]&&(l=l.substring(0,l.length-1),o--),!Oa(l)){let t;return t=0===l.trim().length?"Invalid space after '<'.":"Tag '"+l+"' is an invalid name.",xa("InvalidTag",t,Ma(e,o))}const c=Na(e,o);if(!1===c)return xa("InvalidAttr","Attributes for '"+l+"' have open quote.",Ma(e,o));let d=c.value;if(o=c.index,"/"===d[d.length-1]){const n=o-d.length;d=d.substring(0,d.length-1);const i=Ra(d,t);if(!0!==i)return xa(i.err.code,i.err.msg,Ma(e,n+i.err.line));r=!0}else if(a){if(!c.tagClosed)return xa("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",Ma(e,o));if(d.trim().length>0)return xa("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",Ma(e,s));if(0===n.length)return xa("InvalidTag","Closing tag '"+l+"' has not been opened.",Ma(e,s));{const t=n.pop();if(l!==t.tagName){let n=Ma(e,t.tagStartPos);return xa("InvalidTag","Expected closing tag '"+t.tagName+"' (opened in line "+n.line+", col "+n.col+") instead of closing tag '"+l+"'.",Ma(e,s))}0==n.length&&(i=!0)}}else{const a=Ra(d,t);if(!0!==a)return xa(a.err.code,a.err.msg,Ma(e,o-d.length+a.err.line));if(!0===i)return xa("InvalidXml","Multiple possible root nodes found.",Ma(e,o));-1!==t.unpairedTags.indexOf(l)||n.push({tagName:l,tagStartPos:s}),r=!0}for(o++;o<e.length;o++)if("<"===e[o]){if("!"===e[o+1]){o++,o=Aa(e,o);continue}if("?"!==e[o+1])break;if(o=Ea(e,++o),o.err)return o}else if("&"===e[o]){const t=Da(e,o);if(-1==t)return xa("InvalidChar","char '&' is not expected.",Ma(e,o));o=t}else if(!0===i&&!Ca(e[o]))return xa("InvalidXml","Extra text at the end",Ma(e,o));"<"===e[o]&&o--}}}return r?1==n.length?xa("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",Ma(e,n[0].tagStartPos)):!(n.length>0)||xa("InvalidXml","Invalid '"+JSON.stringify(n.map(e=>e.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):xa("InvalidXml","Start tag expected.",1)};const ba='"',Sa="'";function Na(e,t){let n="",r="",i=!1;for(;t<e.length;t++){if(e[t]===ba||e[t]===Sa)""===r?r=e[t]:r!==e[t]||(r="");else if(">"===e[t]&&""===r){i=!0;break}n+=e[t]}return""===r&&{value:n,index:t,tagClosed:i}}const Ta=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function Ra(e,t){const n=Ia.getAllMatches(e,Ta),r={};for(let e=0;e<n.length;e++){if(0===n[e][1].length)return xa("InvalidAttr","Attribute '"+n[e][2]+"' has no space in starting.",Pa(n[e]));if(void 0!==n[e][3]&&void 0===n[e][4])return xa("InvalidAttr","Attribute '"+n[e][2]+"' is without value.",Pa(n[e]));if(void 0===n[e][3]&&!t.allowBooleanAttributes)return xa("InvalidAttr","boolean attribute '"+n[e][2]+"' is not allowed.",Pa(n[e]));const i=n[e][2];if(!ka(i))return xa("InvalidAttr","Attribute '"+i+"' is an invalid name.",Pa(n[e]));if(r.hasOwnProperty(i))return xa("InvalidAttr","Attribute '"+i+"' is repeated.",Pa(n[e]));r[i]=1}return!0}function Da(e,t){if(";"===e[++t])return-1;if("#"===e[t])return function(e,t){let n=/\d/;for("x"===e[t]&&(t++,n=/[\da-fA-F]/);t<e.length;t++){if(";"===e[t])return t;if(!e[t].match(n))break}return-1}(e,++t);let n=0;for(;t<e.length;t++,n++)if(!(e[t].match(/\w/)&&n<20)){if(";"===e[t])break;return-1}return t}function xa(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function ka(e){return Ia.isName(e)}function Oa(e){return Ia.isName(e)}function Ma(e,t){const n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function Pa(e){return e.startIndex+e[1].length}var Ba={};const La={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,n){return e}};Ba.buildOptions=function(e){return Object.assign({},La,e)},Ba.defaultOptions=La;var Fa=class{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,t){"__proto__"===e&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e){"__proto__"===e.tagname&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}};const Va=$a;function Ua(e,t){let n="";for(;t<e.length&&"'"!==e[t]&&'"'!==e[t];t++)n+=e[t];if(n=n.trim(),-1!==n.indexOf(" "))throw new Error("External entites are not supported");const r=e[t++];let i="";for(;t<e.length&&e[t]!==r;t++)i+=e[t];return[n,i,t]}function Wa(e,t){return"!"===e[t+1]&&"-"===e[t+2]&&"-"===e[t+3]}function za(e,t){return"!"===e[t+1]&&"E"===e[t+2]&&"N"===e[t+3]&&"T"===e[t+4]&&"I"===e[t+5]&&"T"===e[t+6]&&"Y"===e[t+7]}function Ha(e,t){return"!"===e[t+1]&&"E"===e[t+2]&&"L"===e[t+3]&&"E"===e[t+4]&&"M"===e[t+5]&&"E"===e[t+6]&&"N"===e[t+7]&&"T"===e[t+8]}function ja(e,t){return"!"===e[t+1]&&"A"===e[t+2]&&"T"===e[t+3]&&"T"===e[t+4]&&"L"===e[t+5]&&"I"===e[t+6]&&"S"===e[t+7]&&"T"===e[t+8]}function qa(e,t){return"!"===e[t+1]&&"N"===e[t+2]&&"O"===e[t+3]&&"T"===e[t+4]&&"A"===e[t+5]&&"T"===e[t+6]&&"I"===e[t+7]&&"O"===e[t+8]&&"N"===e[t+9]}function Ga(e){if(Va.isName(e))return e;throw new Error(`Invalid entity name ${e}`)}var Xa=function(e,t){const n={};if("O"!==e[t+3]||"C"!==e[t+4]||"T"!==e[t+5]||"Y"!==e[t+6]||"P"!==e[t+7]||"E"!==e[t+8])throw new Error("Invalid Tag instead of DOCTYPE");{t+=9;let r=1,i=!1,o=!1,s="";for(;t<e.length;t++)if("<"!==e[t]||o)if(">"===e[t]){if(o?"-"===e[t-1]&&"-"===e[t-2]&&(o=!1,r--):r--,0===r)break}else"["===e[t]?i=!0:s+=e[t];else{if(i&&za(e,t))t+=7,[entityName,val,t]=Ua(e,t+1),-1===val.indexOf("&")&&(n[Ga(entityName)]={regx:RegExp(`&${entityName};`,"g"),val:val});else if(i&&Ha(e,t))t+=8;else if(i&&ja(e,t))t+=8;else if(i&&qa(e,t))t+=9;else{if(!Wa)throw new Error("Invalid DOCTYPE");o=!0}r++,s=""}if(0!==r)throw new Error("Unclosed DOCTYPE")}return{entities:n,i:t}};const Ya=/^[-+]?0x[a-fA-F0-9]+$/,Za=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt),!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const Ka={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};var Qa=function(e){return"function"==typeof e?e:Array.isArray(e)?t=>{for(const n of e){if("string"==typeof n&&t===n)return!0;if(n instanceof RegExp&&n.test(t))return!0}}:()=>!1};const Ja=$a,el=Fa,tl=Xa,nl=function(e,t={}){if(t=Object.assign({},Ka,t),!e||"string"!=typeof e)return e;let n=e.trim();if(void 0!==t.skipLike&&t.skipLike.test(n))return e;if(t.hex&&Ya.test(n))return Number.parseInt(n,16);{const r=Za.exec(n);if(r){const i=r[1],o=r[2];let s=function(e){if(e&&-1!==e.indexOf("."))return"."===(e=e.replace(/0+$/,""))?e="0":"."===e[0]?e="0"+e:"."===e[e.length-1]&&(e=e.substr(0,e.length-1)),e;return e}(r[3]);const a=r[4]||r[6];if(!t.leadingZeros&&o.length>0&&i&&"."!==n[2])return e;if(!t.leadingZeros&&o.length>0&&!i&&"."!==n[1])return e;{const r=Number(n),l=""+r;return-1!==l.search(/[eE]/)||a?t.eNotation?r:e:-1!==n.indexOf(".")?"0"===l&&""===s||l===s||i&&l==="-"+s?r:e:o?s===l||i+s===l?r:e:n===l||n===i+l?r:e}}return e}},rl=Qa;function il(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];this.lastEntities[r]={regex:new RegExp("&"+r+";","g"),val:e[r]}}}function ol(e,t,n,r,i,o,s){if(void 0!==e&&(this.options.trimValues&&!r&&(e=e.trim()),e.length>0)){s||(e=this.replaceEntitiesValue(e));const r=this.options.tagValueProcessor(t,e,n,i,o);if(null==r)return e;if(typeof r!=typeof e||r!==e)return r;if(this.options.trimValues)return wl(e,this.options.parseTagValue,this.options.numberParseOptions);return e.trim()===e?wl(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function sl(e){if(this.options.removeNSPrefix){const t=e.split(":"),n="/"===e.charAt(0)?"/":"";if("xmlns"===t[0])return"";2===t.length&&(e=n+t[1])}return e}const al=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function ll(e,t,n){if(!0!==this.options.ignoreAttributes&&"string"==typeof e){const n=Ja.getAllMatches(e,al),r=n.length,i={};for(let e=0;e<r;e++){const r=this.resolveNameSpace(n[e][1]);if(this.ignoreAttributesFn(r,t))continue;let o=n[e][4],s=this.options.attributeNamePrefix+r;if(r.length)if(this.options.transformAttributeName&&(s=this.options.transformAttributeName(s)),"__proto__"===s&&(s="#__proto__"),void 0!==o){this.options.trimValues&&(o=o.trim()),o=this.replaceEntitiesValue(o);const e=this.options.attributeValueProcessor(r,o,t);i[s]=null==e?o:typeof e!=typeof o||e!==o?e:wl(o,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(i[s]=!0)}if(!Object.keys(i).length)return;if(this.options.attributesGroupName){const e={};return e[this.options.attributesGroupName]=i,e}return i}}const cl=function(e){e=e.replace(/\r\n?/g,"\n");const t=new el("!xml");let n=t,r="",i="";for(let o=0;o<e.length;o++){if("<"===e[o])if("/"===e[o+1]){const t=ml(e,">",o,"Closing Tag is not closed.");let s=e.substring(o+2,t).trim();if(this.options.removeNSPrefix){const e=s.indexOf(":");-1!==e&&(s=s.substr(e+1))}this.options.transformTagName&&(s=this.options.transformTagName(s)),n&&(r=this.saveTextToParentTag(r,n,i));const a=i.substring(i.lastIndexOf(".")+1);if(s&&-1!==this.options.unpairedTags.indexOf(s))throw new Error(`Unpaired tag can not be used as closing tag: </${s}>`);let l=0;a&&-1!==this.options.unpairedTags.indexOf(a)?(l=i.lastIndexOf(".",i.lastIndexOf(".")-1),this.tagsNodeStack.pop()):l=i.lastIndexOf("."),i=i.substring(0,l),n=this.tagsNodeStack.pop(),r="",o=t}else if("?"===e[o+1]){let t=pl(e,o,!1,"?>");if(!t)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,i),this.options.ignoreDeclaration&&"?xml"===t.tagName||this.options.ignorePiTags);else{const e=new el(t.tagName);e.add(this.options.textNodeName,""),t.tagName!==t.tagExp&&t.attrExpPresent&&(e[":@"]=this.buildAttributesMap(t.tagExp,i,t.tagName)),this.addChild(n,e,i)}o=t.closeIndex+1}else if("!--"===e.substr(o+1,3)){const t=ml(e,"--\x3e",o+4,"Comment is not closed.");if(this.options.commentPropName){const s=e.substring(o+4,t-2);r=this.saveTextToParentTag(r,n,i),n.add(this.options.commentPropName,[{[this.options.textNodeName]:s}])}o=t}else if("!D"===e.substr(o+1,2)){const t=tl(e,o);this.docTypeEntities=t.entities,o=t.i}else if("!["===e.substr(o+1,2)){const t=ml(e,"]]>",o,"CDATA is not closed.")-2,s=e.substring(o+9,t);r=this.saveTextToParentTag(r,n,i);let a=this.parseTextData(s,n.tagname,i,!0,!1,!0,!0);null==a&&(a=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:s}]):n.add(this.options.textNodeName,a),o=t+2}else{let s=pl(e,o,this.options.removeNSPrefix),a=s.tagName;const l=s.rawTagName;let c=s.tagExp,d=s.attrExpPresent,u=s.closeIndex;this.options.transformTagName&&(a=this.options.transformTagName(a)),n&&r&&"!xml"!==n.tagname&&(r=this.saveTextToParentTag(r,n,i,!1));const f=n;if(f&&-1!==this.options.unpairedTags.indexOf(f.tagname)&&(n=this.tagsNodeStack.pop(),i=i.substring(0,i.lastIndexOf("."))),a!==t.tagname&&(i+=i?"."+a:a),this.isItStopNode(this.options.stopNodes,i,a)){let t="";if(c.length>0&&c.lastIndexOf("/")===c.length-1)"/"===a[a.length-1]?(a=a.substr(0,a.length-1),i=i.substr(0,i.length-1),c=a):c=c.substr(0,c.length-1),o=s.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(a))o=s.closeIndex;else{const n=this.readStopNodeData(e,l,u+1);if(!n)throw new Error(`Unexpected end of ${l}`);o=n.i,t=n.tagContent}const r=new el(a);a!==c&&d&&(r[":@"]=this.buildAttributesMap(c,i,a)),t&&(t=this.parseTextData(t,a,i,!0,d,!0,!0)),i=i.substr(0,i.lastIndexOf(".")),r.add(this.options.textNodeName,t),this.addChild(n,r,i)}else{if(c.length>0&&c.lastIndexOf("/")===c.length-1){"/"===a[a.length-1]?(a=a.substr(0,a.length-1),i=i.substr(0,i.length-1),c=a):c=c.substr(0,c.length-1),this.options.transformTagName&&(a=this.options.transformTagName(a));const e=new el(a);a!==c&&d&&(e[":@"]=this.buildAttributesMap(c,i,a)),this.addChild(n,e,i),i=i.substr(0,i.lastIndexOf("."))}else{const e=new el(a);this.tagsNodeStack.push(n),a!==c&&d&&(e[":@"]=this.buildAttributesMap(c,i,a)),this.addChild(n,e,i),n=e}r="",o=u}}else r+=e[o]}return t.child};function dl(e,t,n){const r=this.options.updateTag(t.tagname,n,t[":@"]);!1===r||("string"==typeof r?(t.tagname=r,e.addChild(t)):e.addChild(t))}const ul=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){const n=this.docTypeEntities[t];e=e.replace(n.regx,n.val)}for(let t in this.lastEntities){const n=this.lastEntities[t];e=e.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){const n=this.htmlEntities[t];e=e.replace(n.regex,n.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function fl(e,t,n,r){return e&&(void 0===r&&(r=0===Object.keys(t.child).length),void 0!==(e=this.parseTextData(e,t.tagname,n,!1,!!t[":@"]&&0!==Object.keys(t[":@"]).length,r))&&""!==e&&t.add(this.options.textNodeName,e),e=""),e}function hl(e,t,n){const r="*."+n;for(const n in e){const i=e[n];if(r===i||t===i)return!0}return!1}function ml(e,t,n,r){const i=e.indexOf(t,n);if(-1===i)throw new Error(r);return i+t.length-1}function pl(e,t,n,r=">"){const i=function(e,t,n=">"){let r,i="";for(let o=t;o<e.length;o++){let t=e[o];if(r)t===r&&(r="");else if('"'===t||"'"===t)r=t;else if(t===n[0]){if(!n[1])return{data:i,index:o};if(e[o+1]===n[1])return{data:i,index:o}}else"\t"===t&&(t=" ");i+=t}}(e,t+1,r);if(!i)return;let o=i.data;const s=i.index,a=o.search(/\s/);let l=o,c=!0;-1!==a&&(l=o.substring(0,a),o=o.substring(a+1).trimStart());const d=l;if(n){const e=l.indexOf(":");-1!==e&&(l=l.substr(e+1),c=l!==i.data.substr(e+1))}return{tagName:l,tagExp:o,closeIndex:s,attrExpPresent:c,rawTagName:d}}function gl(e,t,n){const r=n;let i=1;for(;n<e.length;n++)if("<"===e[n])if("/"===e[n+1]){const o=ml(e,">",n,`${t} is not closed`);if(e.substring(n+2,o).trim()===t&&(i--,0===i))return{tagContent:e.substring(r,n),i:o};n=o}else if("?"===e[n+1]){n=ml(e,"?>",n+1,"StopNode is not closed.")}else if("!--"===e.substr(n+1,3)){n=ml(e,"--\x3e",n+3,"StopNode is not closed.")}else if("!["===e.substr(n+1,2)){n=ml(e,"]]>",n,"StopNode is not closed.")-2}else{const r=pl(e,n,">");if(r){(r&&r.tagName)===t&&"/"!==r.tagExp[r.tagExp.length-1]&&i++,n=r.closeIndex}}}function wl(e,t,n){if(t&&"string"==typeof e){const t=e.trim();return"true"===t||"false"!==t&&(t.length>15?t:nl(e,n))}return Ja.isExist(e)?e:""}var yl=class{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(e,t)=>String.fromCharCode(Number.parseInt(t,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(e,t)=>String.fromCharCode(Number.parseInt(t,16))}},this.addExternalEntities=il,this.parseXml=cl,this.parseTextData=ol,this.resolveNameSpace=sl,this.buildAttributesMap=ll,this.isItStopNode=hl,this.replaceEntitiesValue=ul,this.readStopNodeData=gl,this.saveTextToParentTag=fl,this.addChild=dl,this.ignoreAttributesFn=rl(this.options.ignoreAttributes)}},vl={};function $l(e,t,n){let r;const i={};for(let o=0;o<e.length;o++){const s=e[o],a=Il(s);let l="";if(l=void 0===n?a:n+"."+a,a===t.textNodeName)void 0===r?r=s[a]:r+=""+s[a];else{if(void 0===a)continue;if(s[a]){let e=$l(s[a],t,l);const n=Cl(e,t);s[":@"]?_l(e,s[":@"],l,t):1!==Object.keys(e).length||void 0===e[t.textNodeName]||t.alwaysCreateTextNode?0===Object.keys(e).length&&(t.alwaysCreateTextNode?e[t.textNodeName]="":e=""):e=e[t.textNodeName],void 0!==i[a]&&i.hasOwnProperty(a)?(Array.isArray(i[a])||(i[a]=[i[a]]),i[a].push(e)):t.isArray(a,l,n)?i[a]=[e]:i[a]=e}}}return"string"==typeof r?r.length>0&&(i[t.textNodeName]=r):void 0!==r&&(i[t.textNodeName]=r),i}function Il(e){const t=Object.keys(e);for(let e=0;e<t.length;e++){const n=t[e];if(":@"!==n)return n}}function _l(e,t,n,r){if(t){const i=Object.keys(t),o=i.length;for(let s=0;s<o;s++){const o=i[s];r.isArray(o,n+"."+o,!0,!0)?e[o]=[t[o]]:e[o]=t[o]}}}function Cl(e,t){const{textNodeName:n}=t,r=Object.keys(e).length;return 0===r||!(1!==r||!e[n]&&"boolean"!=typeof e[n]&&0!==e[n])}vl.prettify=function(e,t){return $l(e,t)};const{buildOptions:El}=Ba,Al=yl,{prettify:bl}=vl,Sl=va;var Nl=class{constructor(e){this.externalEntities={},this.options=El(e)}parse(e,t){if("string"==typeof e);else{if(!e.toString)throw new Error("XML data is accepted in String or Bytes[] form.");e=e.toString()}if(t){!0===t&&(t={});const n=Sl.validate(e,t);if(!0!==n)throw Error(`${n.err.msg}:${n.err.line}:${n.err.col}`)}const n=new Al(this.options);n.addExternalEntities(this.externalEntities);const r=n.parseXml(e);return this.options.preserveOrder||void 0===r?r:bl(r,this.options)}addEntity(e,t){if(-1!==t.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==e.indexOf("&")||-1!==e.indexOf(";"))throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if("&"===t)throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=t}};function Tl(e,t,n,r){let i="",o=!1;for(let s=0;s<e.length;s++){const a=e[s],l=Rl(a);if(void 0===l)continue;let c="";if(c=0===n.length?l:`${n}.${l}`,l===t.textNodeName){let e=a[l];xl(c,t)||(e=t.tagValueProcessor(l,e),e=kl(e,t)),o&&(i+=r),i+=e,o=!1;continue}if(l===t.cdataPropName){o&&(i+=r),i+=`<![CDATA[${a[l][0][t.textNodeName]}]]>`,o=!1;continue}if(l===t.commentPropName){i+=r+`\x3c!--${a[l][0][t.textNodeName]}--\x3e`,o=!0;continue}if("?"===l[0]){const e=Dl(a[":@"],t),n="?xml"===l?"":r;let s=a[l][0][t.textNodeName];s=0!==s.length?" "+s:"",i+=n+`<${l}${s}${e}?>`,o=!0;continue}let d=r;""!==d&&(d+=t.indentBy);const u=r+`<${l}${Dl(a[":@"],t)}`,f=Tl(a[l],t,c,d);-1!==t.unpairedTags.indexOf(l)?t.suppressUnpairedNode?i+=u+">":i+=u+"/>":f&&0!==f.length||!t.suppressEmptyNode?f&&f.endsWith(">")?i+=u+`>${f}${r}</${l}>`:(i+=u+">",f&&""!==r&&(f.includes("/>")||f.includes("</"))?i+=r+t.indentBy+f+r:i+=f,i+=`</${l}>`):i+=u+"/>",o=!0}return i}function Rl(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(e.hasOwnProperty(r)&&":@"!==r)return r}}function Dl(e,t){let n="";if(e&&!t.ignoreAttributes)for(let r in e){if(!e.hasOwnProperty(r))continue;let i=t.attributeValueProcessor(r,e[r]);i=kl(i,t),!0===i&&t.suppressBooleanAttributes?n+=` ${r.substr(t.attributeNamePrefix.length)}`:n+=` ${r.substr(t.attributeNamePrefix.length)}="${i}"`}return n}function xl(e,t){let n=(e=e.substr(0,e.length-t.textNodeName.length-1)).substr(e.lastIndexOf(".")+1);for(let r in t.stopNodes)if(t.stopNodes[r]===e||t.stopNodes[r]==="*."+n)return!0;return!1}function kl(e,t){if(e&&e.length>0&&t.processEntities)for(let n=0;n<t.entities.length;n++){const r=t.entities[n];e=e.replace(r.regex,r.val)}return e}const Ol=function(e,t){let n="";return t.format&&t.indentBy.length>0&&(n="\n"),Tl(e,t,"",n)},Ml=Qa,Pl={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function Bl(e){this.options=Object.assign({},Pl,e),!0===this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=Ml(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Vl),this.processTextOrObjNode=Ll,this.options.format?(this.indentate=Fl,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function Ll(e,t,n,r){const i=this.j2x(e,n+1,r.concat(t));return void 0!==e[this.options.textNodeName]&&1===Object.keys(e).length?this.buildTextValNode(e[this.options.textNodeName],t,i.attrStr,n):this.buildObjectNode(i.val,t,i.attrStr,n)}function Fl(e){return this.options.indentBy.repeat(e)}function Vl(e){return!(!e.startsWith(this.options.attributeNamePrefix)||e===this.options.textNodeName)&&e.substr(this.attrPrefixLen)}Bl.prototype.build=function(e){return this.options.preserveOrder?Ol(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0,[]).val)},Bl.prototype.j2x=function(e,t,n){let r="",i="";const o=n.join(".");for(let s in e)if(Object.prototype.hasOwnProperty.call(e,s))if(void 0===e[s])this.isAttribute(s)&&(i+="");else if(null===e[s])this.isAttribute(s)?i+="":"?"===s[0]?i+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:i+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(e[s]instanceof Date)i+=this.buildTextValNode(e[s],s,"",t);else if("object"!=typeof e[s]){const n=this.isAttribute(s);if(n&&!this.ignoreAttributesFn(n,o))r+=this.buildAttrPairStr(n,""+e[s]);else if(!n)if(s===this.options.textNodeName){let t=this.options.tagValueProcessor(s,""+e[s]);i+=this.replaceEntitiesValue(t)}else i+=this.buildTextValNode(e[s],s,"",t)}else if(Array.isArray(e[s])){const r=e[s].length;let o="",a="";for(let l=0;l<r;l++){const r=e[s][l];if(void 0===r);else if(null===r)"?"===s[0]?i+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:i+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if("object"==typeof r)if(this.options.oneListGroup){const e=this.j2x(r,t+1,n.concat(s));o+=e.val,this.options.attributesGroupName&&r.hasOwnProperty(this.options.attributesGroupName)&&(a+=e.attrStr)}else o+=this.processTextOrObjNode(r,s,t,n);else if(this.options.oneListGroup){let e=this.options.tagValueProcessor(s,r);e=this.replaceEntitiesValue(e),o+=e}else o+=this.buildTextValNode(r,s,"",t)}this.options.oneListGroup&&(o=this.buildObjectNode(o,s,a,t)),i+=o}else if(this.options.attributesGroupName&&s===this.options.attributesGroupName){const t=Object.keys(e[s]),n=t.length;for(let i=0;i<n;i++)r+=this.buildAttrPairStr(t[i],""+e[s][t[i]])}else i+=this.processTextOrObjNode(e[s],s,t,n);return{attrStr:r,val:i}},Bl.prototype.buildAttrPairStr=function(e,t){return t=this.options.attributeValueProcessor(e,""+t),t=this.replaceEntitiesValue(t),this.options.suppressBooleanAttributes&&"true"===t?" "+e:" "+e+'="'+t+'"'},Bl.prototype.buildObjectNode=function(e,t,n,r){if(""===e)return"?"===t[0]?this.indentate(r)+"<"+t+n+"?"+this.tagEndChar:this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar;{let i="</"+t+this.tagEndChar,o="";return"?"===t[0]&&(o="?",i=""),!n&&""!==n||-1!==e.indexOf("<")?!1!==this.options.commentPropName&&t===this.options.commentPropName&&0===o.length?this.indentate(r)+`\x3c!--${e}--\x3e`+this.newLine:this.indentate(r)+"<"+t+n+o+this.tagEndChar+e+this.indentate(r)+i:this.indentate(r)+"<"+t+n+o+">"+e+i}},Bl.prototype.closeTag=function(e){let t="";return-1!==this.options.unpairedTags.indexOf(e)?this.options.suppressUnpairedNode||(t="/"):t=this.options.suppressEmptyNode?"/":`></${e}`,t},Bl.prototype.buildTextValNode=function(e,t,n,r){if(!1!==this.options.cdataPropName&&t===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${e}]]>`+this.newLine;if(!1!==this.options.commentPropName&&t===this.options.commentPropName)return this.indentate(r)+`\x3c!--${e}--\x3e`+this.newLine;if("?"===t[0])return this.indentate(r)+"<"+t+n+"?"+this.tagEndChar;{let i=this.options.tagValueProcessor(t,e);return i=this.replaceEntitiesValue(i),""===i?this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(r)+"<"+t+n+">"+i+"</"+t+this.tagEndChar}},Bl.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){const n=this.options.entities[t];e=e.replace(n.regex,n.val)}return e};for(var Ul={XMLParser:Nl,XMLValidator:va,XMLBuilder:Bl},Wl=[],zl=0;zl<256;++zl)Wl.push((zl+256).toString(16).slice(1));"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);class Hl extends Error{constructor(e){super(e),this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class jl extends Hl{constructor(e){super(e)}}class ql extends Hl{constructor(e){super(e)}}const Gl=e=>e.Id.IBAN?{iban:e.Id.IBAN}:{...e.Id?.Othr?.Id&&{accountNumber:String(e.Id.Othr.Id)},...e.Nm&&{name:e.Nm},...e.Ccy&&{currency:e.Ccy}},Xl=e=>{if(e){if(e.FinInstnId?.BIC)return{bic:e.FinInstnId.BIC};if(e.FinInstnId?.BICFI)return{bic:e.FinInstnId.BICFI};if(e.FinInstnId){const t=e.FinInstnId.Othr?.Id||e.FinInstnId.ClrSysMmbId?.MmbId;if(t)return{abaRoutingNumber:t.toString()}}}},Yl=(e,t="USD")=>{const n=ya({currency:t});return Math.floor(Number(e)*10**n.getPrecision())},Zl=e=>{const t=e.DtTm||e.Dt;return new Date(t)},Kl=e=>{const t=e.Id.toString(),n=e.ElctrncSeqNb,r=e.LglSeqNb,i=new Date(e.CreDtTm);let o,s;e.FrToDt&&(o=new Date(e.FrToDt.FrDtTm),s=new Date(e.FrToDt.ToDtTm));const a=e.TxsSummry?.TtlNtries.NbOfNtries,l=e.TxsSummry?.TtlNtries.Sum,c=e.TxsSummry?.TtlNtries.TtlNetNtryAmt;let d;c&&(d=Yl(c));const u=e.TxsSummry?.TtlCdtNtries.NbOfNtries,f=e.TxsSummry?.TtlCdtNtries.Sum,h=e.TxsSummry?.TtlDbtNtries.NbOfNtries,m=e.TxsSummry?.TtlDbtNtries.Sum,p=Gl(e.Acct),g=Xl(e.Acct.Svcr);let w=[];Array.isArray(e.Bal)?w=e.Bal.map(Ql):e.Bal&&(w=[Ql(e.Bal)]);let y=[];return Array.isArray(e.Ntry)?y=e.Ntry.map(Jl):e.Ntry&&(y=[Jl(e.Ntry)]),{id:t,electronicSequenceNumber:n,legalSequenceNumber:r,creationDate:i,fromDate:o,toDate:s,account:p,agent:g,numOfEntries:a,sumOfEntries:l,netAmountOfEntries:d,numOfCredits:u,sumOfCredits:f,numOfDebits:h,sumOfDebits:m,balances:w,entries:y}},Ql=e=>{const t=e.Amt["#text"],n=e.Amt["@_Ccy"],r=Yl(t,n),i="CRDT"===e.CdtDbtInd?"credit":"debit",o=e.Tp.CdOrPrtry.Cd;return{date:Zl(e.Dt),amount:r,currency:n,creditDebitIndicator:i,type:o}},Jl=e=>{const t=e.NtryRef,n="CRDT"===e.CdtDbtInd?"credit":"debit",r=Zl(e.BookgDt),i=!0===e.RvslInd,o=e.Amt["#text"],s=e.Amt["@_Ccy"],a=Yl(o,s),l=e.BkTxCd.Prtry?.Cd,c=(e=>{if(e)return Array.isArray(e)?e.join("\n"):e})(e.AddtlNtryInf),d=e.AcctSvcrRef,u=tc(e.BkTxCd);let f=e.NtryDtls||[];Array.isArray(f)||(f=[f]);return{referenceId:t,creditDebitIndicator:n,bookingDate:r,reversal:i,amount:a,currency:s,proprietaryCode:l,transactions:f.map(e=>{let t=e.TxDtls||[];return Array.isArray(t)||(t=[t]),t.map(ec)}).flat(),additionalInformation:c,accountServicerReferenceId:d,bankTransactionCode:u}},ec=e=>{const t=e.Refs?.MsgId,n=e.Refs?.AcctSvcrRef,r=e.Refs?.PmtInfId,i=e.RmtInf?.Ustrd,o=e.Purp?.Prtry,s=e.RtrInf?.Rsn,a=e.RtrInf?.AddtlInf,l=e.Refs?.EndToEndId,c=e.Amt["@_Ccy"],d=e.Amt["#text"],u=e.RmtInf?.Strd?.CdtrRefInf?.Ref?.toString(),f=e.RmtInf?.Strd?.AddtlRmtInf;let h,m,p,g,w,y,v,$;return e.RltdPties?.Dbtr&&(m=e.RltdPties.Dbtr.Nm||e.RltdPties.Dbtr.Pty?.Nm),e.RltdPties?.DbtrAcct&&(p=Gl(e.RltdPties.DbtrAcct)),e.RltdAgts?.DbtrAgt&&(g=Xl(e.RltdAgts.DbtrAgt)),(m||p||g)&&(h={name:m,account:p,agent:g}),e.RltdPties?.Cdtr&&(y=e.RltdPties.Cdtr.Nm||e.RltdPties.Cdtr.Pty?.Nm),e.RltdPties?.CdtrAcct&&(v=Gl(e.RltdPties.CdtrAcct)),e.RltdAgts?.CdtrAgt&&($=Xl(e.RltdAgts.CdtrAgt)),(y||v||$)&&(w={name:y,account:v,agent:$}),{messageId:t,accountServicerReferenceId:n,endToEndId:l,currency:c,amount:d,paymentInformationId:r,remittanceInformation:i,proprietaryPurpose:o,returnReason:s,returnAdditionalInformation:a,debtor:h,creditor:w,invoiceRef:u,invoiceRefAdd:f}},tc=e=>{const t=e?.Domn?.Cd,n=e?.Domn?.Fmly?.Cd,r=e?.Domn?.Fmly?.SubFmlyCd,i=e.Prtry?.Cd,o=e.Prtry?.Issr;return{domainCode:t,domainFamilyCode:n,domainSubFamilyCode:r,proprietaryCode:i,proprietaryCodeIssuer:o}};class nc{_messageId;_creationDate;_recipient;_statements;constructor(e){this._messageId=e.messageId,this._creationDate=e.creationDate,this._recipient=e.recipient,this._statements=e.statements}static getParser(){return new Ul.XMLParser({ignoreAttributes:!1,tagValueProcessor:(e,t,n,r,i)=>{if(!i||!["Cd","NtryRef"].includes(e))return t}})}static fromXML(e){const t=nc.getParser().parse(e);if(!t.Document)throw new jl("Invalid XML format");if(!(t.Document["@_xmlns"]||t.Document["@_Xmlns"]).startsWith("urn:iso:std:iso:20022:tech:xsd:camt.053.001."))throw new ql("Invalid CAMT.053 namespace");const n=t.Document.BkToCstmrStmt,r=n.GrpHdr.CreDtTm,i=new Date(r);let o=[];o=Array.isArray(n.Stmt)?n.Stmt.map(e=>Kl(e)):[Kl(n.Stmt)];const s=n.GrpHdr.MsgRcpt;return new nc({messageId:n.GrpHdr.MsgId.toString(),creationDate:i,recipient:s?(a=s,{id:a.Id?.OrgId?.Othr?.Id,name:a.Nm}):void 0,statements:o});var a}get balances(){return this._statements.flatMap(e=>e.balances)}get transactions(){return this._statements.flatMap(e=>e.entries).flatMap(e=>e.transactions)}get entries(){return this._statements.flatMap(e=>e.entries)}get messageId(){return this._messageId}get recipient(){return this._recipient}get creationDate(){return this._creationDate}get statements(){return this._statements}}function rc(e){let t,n,r,i,o;function s(t){e[17](t)}let a={class:e[0],id:e[1],name:e[2],accept:"text/xml",max:"1",beforeChange:e[13]};return void 0!==e[3]&&(a.files=e[3]),t=new e[7]({props:a}),re.push(()=>Se(t,"files",s)),t.$on("change",e[12]),i=new e[8]({props:{inputClass:e[0],hidden:!0,id:e[1],name:e[1],value:e[4]}}),{c(){Ne(t.$$.fragment),r=L(),Ne(i.$$.fragment)},m(e,n){Te(t,e,n),x(e,r,n),Te(i,e,n),o=!0},p(e,r){const o={};1&r&&(o.class=e[0]),2&r&&(o.id=e[1]),4&r&&(o.name=e[2]),!n&&8&r&&(n=!0,o.files=e[3],ue(()=>n=!1)),t.$set(o);const s={};1&r&&(s.inputClass=e[0]),2&r&&(s.id=e[1]),2&r&&(s.name=e[1]),16&r&&(s.value=e[4]),i.$set(s)},i(e){o||($e(t.$$.fragment,e),$e(i.$$.fragment,e),o=!0)},o(e){Ie(t.$$.fragment,e),Ie(i.$$.fragment,e),o=!1},d(e){Re(t,e),e&&k(r),Re(i,e)}}}function ic(e){let t,n;return t=new e[8]({props:{inputClass:e[0],readonly:!0,id:e[1],name:e[1],value:e[4]}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};1&n&&(r.inputClass=e[0]),2&n&&(r.id=e[1]),2&n&&(r.name=e[1]),16&n&&(r.value=e[4]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function oc(e){let t,n,r;return n=new e[9]({props:{outline:!0,$$slots:{default:[sc]},$$scope:{ctx:e}}}),{c(){t=M("div"),Ne(n.$$.fragment),q(t,"margin-top","1em")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p(e,t){const r={};1073741888&t&&(r.$$scope={dirty:t,ctx:e}),n.$set(r)},i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function sc(e){let t,n,r,i;return r=new e[10]({}),{c(){t=B(e[6]),n=L(),Ne(r.$$.fragment)},m(e,o){x(e,t,o),x(e,n,o),Te(r,e,o),i=!0},p(e,n){(!i||64&n)&&H(t,e[6])},i(e){i||($e(r.$$.fragment,e),i=!0)},o(e){Ie(r.$$.fragment,e),i=!1},d(e){e&&k(t),e&&k(n),Re(r,e)}}}function ac(e){let t,n,r,i,o;const s=[ic,rc],a=[];t=function(e){return e[11]?0:1}(e),n=a[t]=s[t](e);let l=e[5]&&oc(e);return{c(){n.c(),r=L(),l&&l.c(),i=F()},m(e,n){a[t].m(e,n),x(e,r,n),l&&l.m(e,n),x(e,i,n),o=!0},p(e,[t]){n.p(e,t),e[5]?l?(l.p(e,t),32&t&&$e(l,1)):(l=oc(e),l.c(),$e(l,1),l.m(i.parentNode,i)):l&&(ye(),Ie(l,1,1,()=>{l=null}),ve())},i(e){o||($e(n),$e(l),o=!0)},o(e){Ie(n),Ie(l),o=!1},d(e){a[t].d(e),e&&k(r),l&&l.d(e),e&&k(i)}}}function lc(e,n,r){const{FileDropzone:i,TextField:o,Chip:s,Loading:a}=c,l=ee();let{classId:d}=n,{eventId:u}=n,{record:f}=n,{item:h}=n,{id:m}=n,{name:p}=n;const g="camt53"===h.properties?.type;let w=[],y=f[h.name]||"",v=!!f._id,$=!1,I="In Verarbeitung!";const _=async(e,n,r,i,o,s)=>{try{if("debit"!==e)return"";if(n)return"";let a;if(r&&(a=await t.getSectionView("creditPayment",{creditPaymentId:r.split(".")[0]})),a?.length){let e=a[0].listBill.find(e=>i&&e.reference.replaceAll(" ","")===i);if(!e&&s&&(e=a[0].listBill.find(e=>e.iban.replaceAll(" ","")===s&&+e.amount==+o)),e)return e.bill}}catch{}return""},C=async(e,n,r,i,o,s,a=[])=>{try{if("credit"!==e)return"";let i,o=N(n);if(o.startsWith("R-")||(o=""),!o&&r&&(r=r.toString(),o=N(r.replaceAll(" ","")),o.startsWith("R-")||(o=""),!o&&r.includes("R-"))){o="R-"+r.split("R-")[1].slice(0,8)}const l=+Number.parseFloat(+s-.04).toFixed(2),c=+Number.parseFloat(+s+.04).toFixed(2);if(o&&(i=await t.getSectionView("invoice",{invoiceId:o}),i?.length)){const e=i[0];if(!a.find(t=>t.invoice==e._id)&&e.__total>=l&&e.__total<=c)return e._id}}catch{}return""},E=async(e,n,r)=>{try{if(!e)return;const n=await t.getSectionView("incomingPayment",{invoice:e});if(!n?.length)return;const i=n[0];return r===i._total&&i._id}catch{}},A=async e=>{try{if(!e)return;const n=await t.getSectionView("outgoingPayment",{bill:e});if(n?.length)return n[0]._id}catch{}},b=async e=>{try{const n=await t.getSectionView("accountingPlan",{iban:e});if(n?.length)return n[0]._id}catch{}return""},S=async(e,n)=>{try{const i=n.output.class[0].list,o=await(async e=>{if(!e.includes("xsd:camt.053"))return;let t;try{t=nc.fromXML(e)}catch(e){console.log("error",e)}return t})(e);if(!o||!o.messageId)return r(6,I="Das ist keine camt53 Datei!"),void r(5,$=!0);const s=await t.getSectionView("dailyJournal",{messageId:o.messageId});if(s?.length)return r(6,I="Bereits eingelesen!"),void r(5,$=!0);o._saldo=o.balances[1].amount/100,o._saldoDate_from=o.balances[0].date,o._saldoDate_to=o.balances[1].date;let a=!0;for(const e of n.output.class[0].item.filter(e=>e.properties?.source)){let t=o[e.properties.source];if(e.properties?.required&&!t){a=!1;break}if("dateRange"===e.type){const t=o[e.properties.source+"_from"],n=o[e.properties.source+"_to"];l("record",{itemName:e.name+"_from",value:t}),l("record",{itemName:e.name+"_to",value:n});continue}"[object Date]"===Object.prototype.toString.call(t)&&(t=new Date(t)),l("record",{itemName:e.name,value:t})}if(!a)return r(6,I="Ungültiger Inhalt!"),void r(5,$=!0);l("record",{itemName:"status",value:"offen"}),await Promise.all(i.map(async e=>await(async(e,t,n)=>{if(f._id)return;if(!e.process)return;n.output.class[0].name;const i=e.process.target;if(!i)return;r(6,I="In Verarbeitung!"),r(5,$=!0);const o=[],s=[],{refItem:a,value:c}=e.process.filter;for(const n of t[e.source]){const t=await b(n.account?.iban);for(const r of n.entries){if(r[a]!==c)continue;let l="SALA"===r.bankTransactionCode?.domainSubFamilyCode,d=!1;for(const a of r.transactions){let c=await C(r.creditDebitIndicator,a.invoiceRef,a.remittanceInformation,e.process.creditor,a.debtor,a.amount,s),u=await E(c,r.bookingDate,a.amount);!1===u&&(c=void 0,u=void 0);const f=await _(r.creditDebitIndicator,l,a.paymentInformationId,a.invoiceRef,a.amount,a.creditor?.account?.iban),h=await A(f),m="",p="",g={accountServicerReferenceId:a.accountServicerReferenceId,messageId:a.messageId,account:n.account.iban,accountDebit:t,creditDebitIndicator:r.creditDebitIndicator,bookingDate:r.bookingDate,amount:a.amount,currency:a.currency,debtor:a.debtor?.name||"",debtorAccount:a.debtor?.account?.iban||"",creditor:a.creditor?.name||"",creditorAccount:a.creditor?.account?.iban||"",paymentInformationId:a.paymentInformationId,invoiceRef:a.invoiceRef,invoiceRefAdd:a.invoiceRefAdd,remittanceInformation:a.remittanceInformation,returnAdditionalInformation:a.returnAdditionalInformation,additionalInformation:r.additionalInformation,invoice:c,incomingPayment:u,payDebtorAvis:p,isSalary:l,bill:f,outgoingPayment:h,journalFinAcc:m};if(l){if(d)continue;g.amount=r.amount/100,d=!0}g[i]?o.push(g):s.push(g)}}}o.length&&l("record",{itemName:e.name,value:o}),s.length&&l("record",{itemName:"open"+e.name,value:s})})(e,o,n))),setTimeout(()=>{l("saveFull"),r(5,$=!1)},2e3)}catch{r(6,I="Ungültiger Inhalt!"),r(5,$=!0)}},N=e=>{try{if(!e?.length)return"";if(e.length<14)return"";const t=e.replaceAll(" ","").slice(-14),n=t.slice(-8),r=t.slice(0,4);let i="";for(let e=0;e<r.length/2;e++){const t=2*e,n=r.substring(t,t+2);i+=String.fromCharCode(n)}return i+n}catch{}return""};return e.$$set=e=>{"classId"in e&&r(0,d=e.classId),"eventId"in e&&r(14,u=e.eventId),"record"in e&&r(15,f=e.record),"item"in e&&r(16,h=e.item),"id"in e&&r(1,m=e.id),"name"in e&&r(2,p=e.name)},e.$$.update=()=>{8&e.$$.dirty&&(w.length||r(5,$=!1))},[d,m,p,w,y,$,I,i,o,s,a,v,async()=>{const{list:e}=h.properties,n=w[0],i=await t.getEvent(u);if(n){r(4,y=n.name);const t=await n.text();if(g)return await S(t,i);const o=(e=>{var t={toObj:function(e){var n={};if(1==e.nodeType){if(e.attributes.length)for(var r=0;r<e.attributes.length;r++)n["@"+e.attributes[r].nodeName]=(e.attributes[r].nodeValue||"").toString();if(e.firstChild){for(var i=0,o=0,s=!1,a=e.firstChild;a;a=a.nextSibling)1==a.nodeType?s=!0:3==a.nodeType&&a.nodeValue.match(/[^ \f\n\r\t\v]/)?i++:4==a.nodeType&&o++;if(s)if(i<2&&o<2)for(t.removeWhite(e),a=e.firstChild;a;a=a.nextSibling)3==a.nodeType?n["#text"]=t.escape(a.nodeValue):4==a.nodeType?n["#cdata"]=t.escape(a.nodeValue):n[a.nodeName]?n[a.nodeName]instanceof Array?n[a.nodeName][n[a.nodeName].length]=t.toObj(a):n[a.nodeName]=[n[a.nodeName],t.toObj(a)]:n[a.nodeName]=t.toObj(a);else e.attributes.length?n["#text"]=t.escape(t.innerXml(e)):n=t.escape(t.innerXml(e));else if(i)e.attributes.length?n["#text"]=t.escape(t.innerXml(e)):n=t.escape(t.innerXml(e));else if(o)if(o>1)n=t.escape(t.innerXml(e));else for(a=e.firstChild;a;a=a.nextSibling)n["#cdata"]=t.escape(a.nodeValue)}e.attributes.length||e.firstChild||(n=null)}else 9==e.nodeType&&(n=t.toObj(e.documentElement));return n},toJson:function(e,n,r){var i=n?'"'+n+'"':"";if(e instanceof Array){for(var o=0,s=e.length;o<s;o++)e[o]=t.toJson(e[o],"",r+"\t");i+=(n?":[":"[")+(e.length>1?"\n"+r+"\t"+e.join(",\n"+r+"\t")+"\n"+r:e.join(""))+"]"}else if(null==e)i+=(n&&":")+"null";else if("object"==typeof e){var a=[];for(var l in e)a[a.length]=t.toJson(e[l],l,r+"\t");i+=(n?":{":"{")+(a.length>1?"\n"+r+"\t"+a.join(",\n"+r+"\t")+"\n"+r:a.join(""))+"}"}else i+="string"==typeof e?(n&&":")+'"'+e.toString()+'"':(n&&":")+e.toString();return i},innerXml:function(e){var t="";if("innerHTML"in e)t=e.innerHTML;else for(var n=function(e){var t="";if(1==e.nodeType){t+="<"+e.nodeName;for(var r=0;r<e.attributes.length;r++)t+=" "+e.attributes[r].nodeName+'="'+(e.attributes[r].nodeValue||"").toString()+'"';if(e.firstChild){t+=">";for(var i=e.firstChild;i;i=i.nextSibling)t+=n(i);t+="</"+e.nodeName+">"}else t+="/>"}else 3==e.nodeType?t+=e.nodeValue:4==e.nodeType&&(t+="<![CDATA["+e.nodeValue+"]]>");return t},r=e.firstChild;r;r=r.nextSibling)t+=n(r);return t},escape:function(e){return e.replace(/[\\]/g,"\\\\").replace(/[\"]/g,'\\"').replace(/[\n]/g,"\\n").replace(/[\r]/g,"\\r")},removeWhite:function(e){e.normalize();for(var n=e.firstChild;n;)if(3==n.nodeType)if(n.nodeValue.match(/[^ \f\n\r\t\v]/))n=n.nextSibling;else{var r=n.nextSibling;e.removeChild(n),n=r}else 1==n.nodeType?(t.removeWhite(n),n=n.nextSibling):n=n.nextSibling;return e}};return e=(new window.DOMParser).parseFromString(e,"text/xml"),t.toObj(t.removeWhite(e))})(t),s=[],a=o.BkToCstmrDbtCdtNtfctn.Ntfctn,c=[].concat(a.Ntry);for(const e of c){let t=[].concat(e.NtryDtls.TxDtls);for(const n of t){const t=n.RmtInf?.Strd?.CdtrRefInf?.Ref||n.Refs.EndToEndId||"",r={date:e.ValDt.Dt,branchName:n.RltdPties?.Dbtr?.Nm||"",amount:n.AmtDtls?.TxAmt?.Amt["#text"]||n.Amt["#text"],reference:t,invoiceId:N(t),information:n.RmtInf?.Ustrd||""};s.push(r)}}s.length&&l("record",{itemName:e,value:s})}},()=>{r(3,w)},u,f,h,function(e){w=e,r(3,w)}]}class cc extends xe{constructor(e){var t;super(),document.getElementById("svelte-157hlzf-style")||((t=M("style")).id="svelte-157hlzf-style",t.textContent="label.file-dropzone{margin-top:0 !important}",D(document.head,t)),De(this,e,lc,ac,S,{classId:0,eventId:14,record:15,item:16,id:1,name:2})}}const dc=e=>{const t={},n=e.replaceAll("\r","").split("\n");return n?(t.iban=n[3],t.supplierText=n[5]+", "+n[6]+", "+n[7]+", "+n[8]+", "+n[9],t.supplier={company:{}},t.supplier.company.companyName=n[5],t.supplier.company.postcode=n[8],t.amount=n[18],t.amountOrg=n[18],t.currency={},t.currency.designation=n[19],t.reference=n[28],t.additionalInfo=n[29],t.extReference=uc(10,n[31]),t.amountVat=fc(!0,uc(32,n[31]),t.amount)||fc(!1,uc(33,n[31]),t.amount),t):t},uc=(e,t)=>{if(!e)return"";if(!t)return"";const n=t.split("/"+e+"/")[1];return n?.split("/")[0]||""},fc=(e,t,n)=>{if(!t)return"";let r=0;if(t.includes(":")){const n=t.split(";");for(const t of n){const[n,i]=t.split(":");r+=e?i/100*n:i}}else r=+n/(+t+100)*+t;return r},{document:hc}=Ee;function mc(e){let t,n,r,i,o;function s(t){e[14](t)}let a={class:e[0],id:e[1],name:e[2],accept:"application/pdf",max:"1",beforeChange:e[10]};return void 0!==e[3]&&(a.files=e[3]),t=new e[5]({props:a}),re.push(()=>Se(t,"files",s)),t.$on("change",e[8]),i=new e[6]({props:{inputClass:e[0],hidden:!0,id:e[1],name:e[1],value:e[4]}}),{c(){Ne(t.$$.fragment),r=L(),Ne(i.$$.fragment)},m(e,n){Te(t,e,n),x(e,r,n),Te(i,e,n),o=!0},p(e,r){const o={};1&r&&(o.class=e[0]),2&r&&(o.id=e[1]),4&r&&(o.name=e[2]),!n&&8&r&&(n=!0,o.files=e[3],ue(()=>n=!1)),t.$set(o);const s={};1&r&&(s.inputClass=e[0]),2&r&&(s.id=e[1]),2&r&&(s.name=e[1]),16&r&&(s.value=e[4]),i.$set(s)},i(e){o||($e(t.$$.fragment,e),$e(i.$$.fragment,e),o=!0)},o(e){Ie(t.$$.fragment,e),Ie(i.$$.fragment,e),o=!1},d(e){Re(t,e),e&&k(r),Re(i,e)}}}function pc(e){let t,n,r,i;n=new e[6]({props:{inputClass:e[0],readonly:!0,id:e[1],name:e[1],value:e[4]}});let o=e[4]&&gc(e);return{c(){t=M("div"),Ne(n.$$.fragment),r=L(),o&&o.c(),q(t,"position","relative")},m(e,s){x(e,t,s),Te(n,t,null),D(t,r),o&&o.m(t,null),i=!0},p(e,r){const i={};1&r&&(i.inputClass=e[0]),2&r&&(i.id=e[1]),2&r&&(i.name=e[1]),16&r&&(i.value=e[4]),n.$set(i),e[4]?o?(o.p(e,r),16&r&&$e(o,1)):(o=gc(e),o.c(),$e(o,1),o.m(t,null)):o&&(ye(),Ie(o,1,1,()=>{o=null}),ve())},i(e){i||($e(n.$$.fragment,e),$e(o),i=!0)},o(e){Ie(n.$$.fragment,e),Ie(o),i=!1},d(e){e&&k(t),Re(n),o&&o.d()}}}function gc(e){let t,n,r,i,o;return n=new Me({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather pointer svelte-o0hiko")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[9]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function wc(e){let t,n,r,i;const o=[pc,mc],s=[];return t=function(e){return e[7]?0:1}(e),n=s[t]=o[t](e),{c(){n.c(),r=F()},m(e,n){s[t].m(e,n),x(e,r,n),i=!0},p(e,[t]){n.p(e,t)},i(e){i||($e(n),i=!0)},o(e){Ie(n),i=!1},d(e){s[t].d(e),e&&k(r)}}}let yc;function vc(e,n,r){const{FileDropzone:i,TextField:o}=c,s=ee();let{classId:a}=n,{eventId:l}=n,{record:d}=n,{item:u}=n,{id:f}=n,{name:h}=n,m=[],p=d[u.name]||"",g=!!d._id;const w={scale:{once:!1,value:3,start:3,step:.4,stop:4},resultOpts:{singleCodeInPage:!0,multiCodesInPage:!1,maxCodesInPage:1},improve:!0,jsQR:{}};var y=async function(e){if(!e.success)return;const n=await t.getSchema(l),i=e.codes?.filter(e=>!!e)?.at(0);if(!i?.length)return;if(!i.startsWith("SPC"))return;const o=dc(i);for(const e in o){if(n.items.find(t=>t.name===e)){if("object"==typeof o[e]){let n={};for(const i in o[e])if("object"==typeof o[e][i])for(const s in o[e][i]){o[e][i][s]&&(n[s]=o[e][i][s]);const a=await t.getSectionView(i,n);if(a?.length){const n=await t.getSectionView(e,{[i]:a[0]._id});n?.length&&r(11,d[e]=n[0]._id,d)}}else{o[e][i]&&(n[i]=o[e][i]);const s=await t.getSectionView(e,n);s?.length&&r(11,d[e]=s[0]._id,d)}}else o[e]&&r(11,d[e]=o[e],d);s("record",{itemName:e,value:d[e]})}}};return Q(()=>{if(yc)return;let e=document.createElement("script");e.src="/QR/pdf-qr2.js",document.head.append(e),e.onload=function(){yc=PDF_QR_JS}}),J(()=>{}),e.$$set=e=>{"classId"in e&&r(0,a=e.classId),"eventId"in e&&r(12,l=e.eventId),"record"in e&&r(11,d=e.record),"item"in e&&r(13,u=e.item),"id"in e&&r(1,f=e.id),"name"in e&&r(2,h=e.name)},[a,f,h,m,p,i,o,g,async e=>{const n=m[0];if(!n){s("record",{itemName:"$file",value:!1});const e=await t.getSchema(l);for(const t of e.items)s("record",{itemName:t.name,value:""});return}const i=URL.createObjectURL(n);r(4,p=n.name),s("record",{itemName:"$file",value:{fileName:p,file:n}}),yc.decodeDocument(i,w,y)},async()=>{if(!d?._id)return;const e=await t.getTaskByDocId(d._id,!0);if(!e)return;const n=await t.getUserReports(e._id);if(!n?.length)return;let r="/viewer/doc/index.html?file="+("/api/userreport/"+n[0]._id)+"&type=pdf";window.open(r,"","popup=yes toolbar=no width=800 height=1024")},()=>{r(3,m)},d,l,u,function(e){m=e,r(3,m)}]}class $c extends xe{constructor(e){var t;super(),hc.getElementById("svelte-o0hiko-style")||((t=M("style")).id="svelte-o0hiko-style",t.textContent=".feather.svelte-o0hiko{position:absolute;top:0.75em;left:-1.25em;color:#4300b0}label.file-dropzone{margin-top:0 !important}",D(hc.head,t)),De(this,e,vc,wc,S,{classId:0,eventId:12,record:11,item:13,id:1,name:2})}}const{document:Ic}=Ee;function _c(e){let t,n,r,i,o;function s(t){e[18](t)}let a={class:e[0],id:e[1],name:e[2],accept:e[3],max:"1",beforeChange:e[12]};return void 0!==e[4]&&(a.files=e[4]),t=new e[7]({props:a}),re.push(()=>Se(t,"files",s)),t.$on("change",e[9]),i=new e[8]({props:{inputClass:e[0],hidden:!0,id:e[1],name:e[1],value:e[5]}}),{c(){Ne(t.$$.fragment),r=L(),Ne(i.$$.fragment)},m(e,n){Te(t,e,n),x(e,r,n),Te(i,e,n),o=!0},p(e,r){const o={};1&r&&(o.class=e[0]),2&r&&(o.id=e[1]),4&r&&(o.name=e[2]),8&r&&(o.accept=e[3]),!n&&16&r&&(n=!0,o.files=e[4],ue(()=>n=!1)),t.$set(o);const s={};1&r&&(s.inputClass=e[0]),2&r&&(s.id=e[1]),2&r&&(s.name=e[1]),32&r&&(s.value=e[5]),i.$set(s)},i(e){o||($e(t.$$.fragment,e),$e(i.$$.fragment,e),o=!0)},o(e){Ie(t.$$.fragment,e),Ie(i.$$.fragment,e),o=!1},d(e){Re(t,e),e&&k(r),Re(i,e)}}}function Cc(e){let t,n,r,i;n=new e[8]({props:{inputClass:e[0],readonly:!0,id:e[1],name:e[1],value:e[5]}});let o=e[5]&&Ec(e);return{c(){t=M("div"),Ne(n.$$.fragment),r=L(),o&&o.c(),q(t,"position","relative")},m(e,s){x(e,t,s),Te(n,t,null),D(t,r),o&&o.m(t,null),i=!0},p(e,r){const i={};1&r&&(i.inputClass=e[0]),2&r&&(i.id=e[1]),2&r&&(i.name=e[1]),32&r&&(i.value=e[5]),n.$set(i),e[5]?o?(o.p(e,r),32&r&&$e(o,1)):(o=Ec(e),o.c(),$e(o,1),o.m(t,null)):o&&(ye(),Ie(o,1,1,()=>{o=null}),ve())},i(e){i||($e(n.$$.fragment,e),$e(o),i=!0)},o(e){Ie(n.$$.fragment,e),Ie(o),i=!1},d(e){e&&k(t),Re(n),o&&o.d()}}}function Ec(e){let t,n,r,i,o;const s=[bc,Ac],a=[];function l(e,n){return 32&n&&(t=!!e[5].endsWith(".mp4")),t?0:1}return n=l(e,-1),r=a[n]=s[n](e),{c(){r.c(),i=F()},m(e,t){a[n].m(e,t),x(e,i,t),o=!0},p(e,t){let o=n;n=l(e,t),n===o?a[n].p(e,t):(ye(),Ie(a[o],1,1,()=>{a[o]=null}),ve(),r=a[n],r?r.p(e,t):(r=a[n]=s[n](e),r.c()),$e(r,1),r.m(i.parentNode,i))},i(e){o||($e(r),o=!0)},o(e){Ie(r),o=!1},d(e){a[n].d(e),e&&k(i)}}}function Ac(e){let t,n,r,i,o;return n=new Me({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather pointer svelte-o0hiko")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[10]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function bc(e){let t,n={ctx:e,current:null,token:null,hasCatch:!1,pending:Tc,then:Nc,catch:Sc,value:23};return _e(e[11](),n),{c(){t=F(),n.block.c()},m(e,r){x(e,t,r),n.block.m(e,n.anchor=r),n.mount=()=>t.parentNode,n.anchor=t},p(t,r){Ce(n,e=t,r)},i:_,o:_,d(e){e&&k(t),n.block.d(e),n.token=null,n=null}}}function Sc(e){return{c:_,m:_,p:_,d:_}}function Nc(e){let t,n,r,i;return{c(){t=M("video"),n=M("source"),i=B("\n Your browser does not support HTML video."),n.src!==(r=e[23])&&z(n,"src",r),z(n,"type","video/mp4"),z(t,"width","500"),t.controls=!0,q(t,"margin-top","1em")},m(e,r){x(e,t,r),D(t,n),D(t,i)},p:_,d(e){e&&k(t)}}}function Tc(e){return{c:_,m:_,p:_,d:_}}function Rc(e){let t,n,r,i;const o=[Cc,_c],s=[];function a(e,t){return e[6]?0:1}return t=a(e),n=s[t]=o[t](e),{c(){n.c(),r=F()},m(e,n){s[t].m(e,n),x(e,r,n),i=!0},p(e,[i]){let l=t;t=a(e),t===l?s[t].p(e,i):(ye(),Ie(s[l],1,1,()=>{s[l]=null}),ve(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),$e(n,1),n.m(r.parentNode,r))},i(e){i||($e(n),i=!0)},o(e){Ie(n),i=!1},d(e){s[t].d(e),e&&k(r)}}}function Dc(e,n,r){const{FileDropzone:i,TextField:o}=c,s=ee();let{classId:a}=n,{eventId:l}=n,{record:d}=n,{item:u}=n,{id:f}=n,{name:h}=n,{praefix:m}=n,{recordId:p}=n,{fileType:g="application/pdf"}=n,w=[],y="",v=!1;return Q(()=>{(async()=>{if(!p)return;const e=await t.getTaskByDocId(p,!0);if(!e)return s("listRecord",{itemName:"fileName",value:"",string:!0});const n=d[u.name];if(!n)return s("listRecord",{itemName:"fileName",value:"",string:!0});const i=await t.getUserReports(e._id);if(!i?.length)return s("listRecord",{itemName:"fileName",value:"",string:!0});let o=i.find(e=>e.fileName===n);if(!o)return s("listRecord",{itemName:"fileName",value:"",string:!0});r(5,y=o.fileName),r(6,v=void 0===m?!!p:!!y)})()}),J(()=>{}),e.$$set=e=>{"classId"in e&&r(0,a=e.classId),"eventId"in e&&r(13,l=e.eventId),"record"in e&&r(14,d=e.record),"item"in e&&r(15,u=e.item),"id"in e&&r(1,f=e.id),"name"in e&&r(2,h=e.name),"praefix"in e&&r(16,m=e.praefix),"recordId"in e&&r(17,p=e.recordId),"fileType"in e&&r(3,g=e.fileType)},[a,f,h,g,w,y,v,i,o,async e=>{const t=w[0];URL.createObjectURL(t),r(5,y=t.name),s("record",{itemName:"$file",value:{fileName:y,file:t}}),void 0!==m&&s("listRecord",{itemName:"fileName",value:y,string:!0})},async()=>{if(!p)return;let e;const n=await t.getTaskByDocId(p,!0);if(!n)return;const r=await t.getUserReports(n._id);if(!r?.length)return;let i=r.find(e=>e.fileName===y);i||(i=r[0]);e="/viewer/doc/index.html?file="+("/api/userreport/"+i._id)+"&type=pdf",window.open(e,"","popup=yes toolbar=no width=800 height=1024")},async()=>{const e=await t.getTaskByDocId(p,!0);if(!e)return"";const n=await t.getUserReports(e._id);if(!n?.length)return"";let r=n.find(e=>e.fileName===y);return r||(r=n[0]),"/api/userreport/"+r._id},()=>{r(4,w)},l,d,u,m,p,function(e){w=e,r(4,w)}]}class xc extends xe{constructor(e){var t;super(),Ic.getElementById("svelte-o0hiko-style")||((t=M("style")).id="svelte-o0hiko-style",t.textContent=".feather.svelte-o0hiko{position:absolute;top:0.75em;left:-1.25em;color:#4300b0}label.file-dropzone{margin-top:0 !important}",D(Ic.head,t)),De(this,e,Dc,Rc,S,{classId:0,eventId:13,record:14,item:15,id:1,name:2,praefix:16,recordId:17,fileType:3})}}function kc(e){let t,n,r;return n=new e[5]({props:{type:"string",inputClass:e[2],id:e[0],name:e[0],value:e[1],pattern:Oc,placeholder:Mc,readonly:e[3],disabled:e[4]}}),n.$on("change",e[6]),{c(){t=M("div"),Ne(n.$$.fragment),q(t,"max-width","4em")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p(e,[t]){const r={};4&t&&(r.inputClass=e[2]),1&t&&(r.id=e[0]),1&t&&(r.name=e[0]),2&t&&(r.value=e[1]),8&t&&(r.readonly=e[3]),16&t&&(r.disabled=e[4]),n.$set(r)},i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}const Oc="([01][0-9]|2[0-3]):([0-5][0-9])",Mc="";function Pc(e,t,n){const r=ee(),{TextField:i}=c;let{id:o}=t,{item:s}=t,{value:a}=t,{inputClass:l}=t,{readonly:d}=t,{disabled:u}=t,{praefix:f}=t;const h=e=>{if(!e)return"";const[t,n]=e.split(":");return 4===t.length?`${t.substr(0,2)}:${t.substring(2,4)}`:3===t.length?t.substring(0,2)>23?`0${t.substring(0,1)}:${t.substring(1,3)}`:`${t.substring(0,2)}:${t.substring(2,3)}0`:2===t.length?t>23?`0${t.substring(0,1)}:${t.substring(1,2)}0`:`${t}:${(n||"0").padStart(2,"0")}`:`0${t}:${(n||"0").padStart(2,"0")}`};return e.$$set=e=>{"id"in e&&n(0,o=e.id),"item"in e&&n(7,s=e.item),"value"in e&&n(1,a=e.value),"inputClass"in e&&n(2,l=e.inputClass),"readonly"in e&&n(3,d=e.readonly),"disabled"in e&&n(4,u=e.disabled),"praefix"in e&&n(8,f=e.praefix)},[o,a,l,d,u,i,({detail:e})=>{r("blur",{value:h(e.value)}),r("checkRange",{idx:f,fieldId:o,value:e.value})},s,f]}class Bc extends xe{constructor(e){var t;super(),document.getElementById("svelte-vvt0yv-style")||((t=M("style")).id="svelte-vvt0yv-style",t.textContent=".text-field input.invalid{border:1px red solid !important}",D(document.head,t)),De(this,e,Pc,kc,S,{id:0,item:7,value:1,inputClass:2,readonly:3,disabled:4,praefix:8})}}const{document:Lc}=Ee;function Fc(e,t,n){const r=e.slice();return r[22]=t[n],r}function Vc(e,t,n){const r=e.slice();return r[25]=t[n],r[27]=n,r}function Uc(e){let t,n,r=e[3](e[22],e[25])+"",i=e[27]&&function(){let e;return{c(){e=B(", ")},m(t,n){x(t,e,n)},d(t){t&&k(e)}}}();return{c(){t=M("span"),i&&i.c(),n=B(r),z(t,"class","lookupValue")},m(e,r){x(e,t,r),i&&i.m(t,null),D(t,n)},p(e,t){3&t&&r!==(r=e[3](e[22],e[25])+"")&&H(n,r)},d(e){e&&k(t),i&&i.d()}}}function Wc(e){let t,n,r,i,o,s,a,l,c,d=e[0],u=[];for(let t=0;t<d.length;t+=1)u[t]=Uc(Vc(e,d,t));i=new lt({props:{size:"18"}});let f=e[2]&&function(e){let t,n,r,i,o,s,a,l,c;return i=new Me({props:{size:"18"}}),{c(){t=M("span"),t.textContent="  /  ",n=L(),r=M("span"),Ne(i.$$.fragment),o=L(),s=M("span"),s.textContent="Rechnung",z(r,"class","pointer feather2 svelte-1jurfpd")},m(d,u){x(d,t,u),x(d,n,u),x(d,r,u),Te(i,r,null),x(d,o,u),x(d,s,u),a=!0,l||(c=V(r,"click",function(){b(e[5](e[22]._id))&&e[5](e[22]._id).apply(this,arguments)}),l=!0)},p(t,n){e=t},i(e){a||($e(i.$$.fragment,e),a=!0)},o(e){Ie(i.$$.fragment,e),a=!1},d(e){e&&k(t),e&&k(n),e&&k(r),Re(i),e&&k(o),e&&k(s),l=!1,c()}}}(e);return{c(){t=M("div");for(let e=0;e<u.length;e+=1)u[e].c();n=L(),r=M("span"),Ne(i.$$.fragment),o=L(),f&&f.c(),s=L(),z(r,"class","feather pointer svelte-1jurfpd"),z(t,"class","lookupItem svelte-1jurfpd")},m(d,h){x(d,t,h);for(let e=0;e<u.length;e+=1)u[e].m(t,null);D(t,n),D(t,r),Te(i,r,null),D(t,o),f&&f.m(t,null),D(t,s),a=!0,l||(c=V(r,"click",function(){b(e[4](e[22]._id))&&e[4](e[22]._id).apply(this,arguments)}),l=!0)},p(r,i){if(e=r,11&i){let r;for(d=e[0],r=0;r<d.length;r+=1){const o=Vc(e,d,r);u[r]?u[r].p(o,i):(u[r]=Uc(o),u[r].c(),u[r].m(t,n))}for(;r<u.length;r+=1)u[r].d(1);u.length=d.length}e[2]&&f.p(e,i)},i(e){a||($e(i.$$.fragment,e),$e(f),a=!0)},o(e){Ie(i.$$.fragment,e),Ie(f),a=!1},d(e){e&&k(t),O(u,e),Re(i),f&&f.d(),l=!1,c()}}}function zc(e){let t,n,r=e[1],i=[];for(let t=0;t<r.length;t+=1)i[t]=Wc(Fc(e,r,t));const o=e=>Ie(i[e],1,1,()=>{i[e]=null});return{c(){t=M("div");for(let e=0;e<i.length;e+=1)i[e].c();z(t,"class","lookup svelte-1jurfpd")},m(e,r){x(e,t,r);for(let e=0;e<i.length;e+=1)i[e].m(t,null);n=!0},p(e,[n]){if(63&n){let s;for(r=e[1],s=0;s<r.length;s+=1){const o=Fc(e,r,s);i[s]?(i[s].p(o,n),$e(i[s],1)):(i[s]=Wc(o),i[s].c(),$e(i[s],1),i[s].m(t,null))}for(ye(),s=r.length;s<i.length;s+=1)o(s);ve()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)$e(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)Ie(i[e]);n=!1},d(e){e&&k(t),O(i,e)}}}function Hc(e,n,r){let{id:i}=n,{item:o}=n,{praefix:s}=n,{record:a}=n,{notifyList:l}=n;const{refItem:c,view:d,beforeSave:u,_state:f,addAttachment:h}=o.properties;let p=d.split(","),[g,w]=c.split(":"),y=[];const[v,$]=w.split("."),I=(e,t)=>{const[n,r]=t.split(".");return r?e[n]?e[n][r]:void 0:""},_=(e=!0)=>{ce().then(()=>{const t=document.querySelector("div.form-field."+o.name);if(t&&(t.style.display=e?"none":"flex"),!e&&u){const e=t.querySelector("div label");e&&(e.style.color="red")}})};return Q(_),e.$$set=e=>{"id"in e&&r(6,i=e.id),"item"in e&&r(7,o=e.item),"praefix"in e&&r(8,s=e.praefix),"record"in e&&r(9,a=e.record),"notifyList"in e&&r(10,l=e.notifyList)},e.$$.update=()=>{1024&e.$$.dirty&&(async e=>{const{itemName:n,value:i}=e||{};if(n!==g)return;if(r(1,y=[]),!i)return;if(!!u==!!a._id)return _();if(!a._id&&!a[g])return _();const o=!p.some(e=>e.includes(":")),s=$?$+"."+g:g;let l={[s]:a[g]||a._id};f&&(l=[{$match:l},{$addFields:{_ids:{$toString:"$_id"}}},{$lookup:{from:"_task",localField:"_ids",foreignField:"docId",as:"_task"}},{$unwind:{path:"$_task",preserveNullAndEmptyArrays:!0}},{$match:{"_task.status":f}}]);let c=!1;if(!s.includes(".")){const e=(await t.getSchemaByClass(v)).items.find(e=>e.name===s);e?.properties?.multi&&(c=!0)}if(r(1,y=await t.getSectionView(v,l,o,!0,c)),!o&&y.length){const e=p.find(e=>e.includes(":")),t=e.split(":")[0];r(1,y=y.map(e=>{const n=e[t].find(e=>e[t]===a._id);return n._id=e._id,n})),r(0,p=p.map(e=>e.split(":")[1]))}_(!y.length)})(l)},[p,y,h,(e,t)=>"boolean"===o.type?e[t]?"ja":"nein":"object"===o.type?"(ja)":e["_"+t]||m(e[t])||e[t]||I(e,t),e=>async()=>{const n=await t.getTaskByDocId(e,!0);if(!n)return;const r=n._id,i=`/task/${n.event}/${r}/task?view=standalone`;window.open(i)},e=>async()=>{let n;const r=await t.getTaskByDocId(e,!0);if(!r)return;const i=await t.getUserReports(r._id);if(!i?.length)return;n="/viewer/doc/index.html?file="+("/api/userreport/"+i[0]._id)+"&type=pdf",window.open(n,"","popup=yes toolbar=no width=800 height=1024")},i,o,s,a,l]}class jc extends xe{constructor(e){var t;super(),Lc.getElementById("svelte-1jurfpd-style")||((t=M("style")).id="svelte-1jurfpd-style",t.textContent=".feather.svelte-1jurfpd{position:absolute;top:0;left:-1.5em;color:#4300b0}.feather2.svelte-1jurfpd{color:#4300b0}div.lookup.svelte-1jurfpd{margin-top:0.75em;color:#aaa}div.lookupItem.svelte-1jurfpd{position:relative;margin-left:2em;padding-bottom:0.75em}div.form-field:has(div.lookup){margin-bottom:0.5em !important}div.field:has(div.lookupItem){background-color:#f5f5f5 !important}div.field:has(div.lookup){margin-bottom:0.25em !important}",D(Lc.head,t)),De(this,e,Hc,zc,S,{id:6,item:7,praefix:8,record:9,notifyList:10})}}function qc(e){let t,n,r;return n=new mt({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather2 svelte-9up2nn")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function Gc(e){let t,n,r,i,o;return n=new mt({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather pointer svelte-9up2nn")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[9]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function Xc(e){let t,n,r,i,o,s;n=new e[8]({props:{inputClass:e[0],disabled:e[1],formnovalidate:e[2],readonly:e[3],required:e[4],id:e[5],name:e[6],value:e[7]}}),n.$on("change",e[10]);const a=[Gc,qc],l=[];function c(e,t){return e[7]?0:1}return i=c(e),o=l[i]=a[i](e),{c(){t=M("div"),Ne(n.$$.fragment),r=L(),o.c(),q(t,"position","relative")},m(e,o){x(e,t,o),Te(n,t,null),D(t,r),l[i].m(t,null),s=!0},p(e,[r]){const s={};1&r&&(s.inputClass=e[0]),2&r&&(s.disabled=e[1]),4&r&&(s.formnovalidate=e[2]),8&r&&(s.readonly=e[3]),16&r&&(s.required=e[4]),32&r&&(s.id=e[5]),64&r&&(s.name=e[6]),128&r&&(s.value=e[7]),n.$set(s);let d=i;i=c(e),i===d?l[i].p(e,r):(ye(),Ie(l[d],1,1,()=>{l[d]=null}),ve(),o=l[i],o?o.p(e,r):(o=l[i]=a[i](e),o.c()),$e(o,1),o.m(t,null))},i(e){s||($e(n.$$.fragment,e),$e(o),s=!0)},o(e){Ie(n.$$.fragment,e),Ie(o),s=!1},d(e){e&&k(t),Re(n),l[i].d()}}}function Yc(e,t,n){const{TextField:r}=c;let{inputClass:i}=t,{disabled:o}=t,{formnovalidate:s}=t,{readonly:a}=t,{required:l}=t,{id:d}=t,{name:u}=t,{value:f}=t;return e.$$set=e=>{"inputClass"in e&&n(0,i=e.inputClass),"disabled"in e&&n(1,o=e.disabled),"formnovalidate"in e&&n(2,s=e.formnovalidate),"readonly"in e&&n(3,a=e.readonly),"required"in e&&n(4,l=e.required),"id"in e&&n(5,d=e.id),"name"in e&&n(6,u=e.name),"value"in e&&n(7,f=e.value)},[i,o,s,a,l,d,u,f,r,async()=>{if(!f)return;let e=f;e.includes("//")||(e="//"+e),window.open(e,"_blank")},function(t){te(e,t)}]}class Zc extends xe{constructor(e){var t;super(),document.getElementById("svelte-9up2nn-style")||((t=M("style")).id="svelte-9up2nn-style",t.textContent=".feather.svelte-9up2nn{position:absolute;top:0.75em;left:0.5em;color:#4300b0;margin-left:-2em}.feather2.svelte-9up2nn{position:absolute;top:0.75em;left:0.5em;color:light-gray;margin-left:-2em}",D(document.head,t)),De(this,e,Yc,Xc,S,{inputClass:0,disabled:1,formnovalidate:2,readonly:3,required:4,id:5,name:6,value:7})}}function Kc(e){let t,n,r;return n=new bt({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather2 svelte-9up2nn")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function Qc(e){let t,n,r,i,o;return n=new bt({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather pointer svelte-9up2nn")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[12]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function Jc(e){let t,n,r,i,o,s;n=new e[10]({props:{inputClass:e[2],pattern:e[0],placeholder:e[1],disabled:e[3],formnovalidate:e[4],readonly:e[5],required:e[6],id:e[7],name:e[8],value:e[9]}}),n.$on("change",e[15]);const a=[Qc,Kc],l=[];function c(e,t){return e[9]?0:1}return i=c(e),o=l[i]=a[i](e),{c(){t=M("div"),Ne(n.$$.fragment),r=L(),o.c(),q(t,"position","relative")},m(e,o){x(e,t,o),Te(n,t,null),D(t,r),l[i].m(t,null),s=!0},p(e,[r]){const s={};4&r&&(s.inputClass=e[2]),1&r&&(s.pattern=e[0]),2&r&&(s.placeholder=e[1]),8&r&&(s.disabled=e[3]),16&r&&(s.formnovalidate=e[4]),32&r&&(s.readonly=e[5]),64&r&&(s.required=e[6]),128&r&&(s.id=e[7]),256&r&&(s.name=e[8]),512&r&&(s.value=e[9]),n.$set(s);let d=i;i=c(e),i===d?l[i].p(e,r):(ye(),Ie(l[d],1,1,()=>{l[d]=null}),ve(),o=l[i],o?o.p(e,r):(o=l[i]=a[i](e),o.c()),$e(o,1),o.m(t,null))},i(e){s||($e(n.$$.fragment,e),$e(o),s=!0)},o(e){Ie(n.$$.fragment,e),Ie(o),s=!1},d(e){e&&k(t),Re(n),l[i].d()}}}function ed(e,t,r){let i;const{TextField:o}=c,{environment:s}=u;N(e,s,e=>r(16,i=e));const a=JSON.parse(n.getItem("Locale"));let{inputClass:l}=t,{disabled:d}=t,{formnovalidate:f}=t,{readonly:h}=t,{required:m}=t,{id:p}=t,{name:g}=t,{value:w}=t,{pattern:y}=t,{placeholder:v}=t,{notifyList:$}=t,{country:I}=t;y||="(\\+(9[976]\\d|8[987530]\\d|6[987]\\d|5[90]\\d|42\\d|3[875]\\d|2[98654321]\\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1))?\\W*\\d\\W*\\d\\W*\\d\\W*\\d\\W*\\d\\W*\\d\\W*\\d\\W*\\d\\W*\\d\\W*(\\d{1,2})$",v||="+41 58 234 56 78";const _={ch:"^(((\\+41|0041)\\s?\\d{2})|0\\d{2})(\\s?\\d){7}$",li:"^(((\\+41|0041)\\s?\\d{2})|0\\d{2})(\\s?\\d){7}$",de:"^((\\+49|0049)\\s?)?(0|\\s?)?\\d{2,5}(\\s?\\d){4,9}$",at:"^((\\+43|0043)\\s?)?(0\\s?)?[1-9]\\d{1,4}(\\s?\\d){4,10}$",us:"^((\\+1|001)\\s?)?(\\d{3}\\s?){2}\\d{4}$",zh:"^((\\+86|0086)\\s?)?((1\\d{10})|(0\\d{2,3}\\s?\\d{7,8}))$"},C={ch:"+41 58 234 5678",li:"+41 58 234 5678",de:"+49 619 1234 5678",at:"+43 800 123 456",us:"+1 2345 678 901",zh:"+86 123 456 7589"};return e.$$set=e=>{"inputClass"in e&&r(2,l=e.inputClass),"disabled"in e&&r(3,d=e.disabled),"formnovalidate"in e&&r(4,f=e.formnovalidate),"readonly"in e&&r(5,h=e.readonly),"required"in e&&r(6,m=e.required),"id"in e&&r(7,p=e.id),"name"in e&&r(8,g=e.name),"value"in e&&r(9,w=e.value),"pattern"in e&&r(0,y=e.pattern),"placeholder"in e&&r(1,v=e.placeholder),"notifyList"in e&&r(13,$=e.notifyList),"country"in e&&r(14,I=e.country)},e.$$.update=()=>{8192&e.$$.dirty&&(async e=>{const{listName:t,itemName:n,value:o}=e||{},s=i?.country?.countryCode?.toLowerCase()||a.lang;I&&n===I&&o?xp("country",o).then(e=>{if(e.phonePattern)r(0,y=e.phonePattern),r(1,v=e.phonePlaceholder||"");else{const t=e.countryCode.toLowerCase();_[t]&&(r(0,y=_[t]),r(1,v=C[t]))}}).catch(()=>{r(0,y=_[s]),r(1,v=C[s])}):I&&(r(0,y=_[s]),r(1,v=C[s]))})($)},[y,v,l,d,f,h,m,p,g,w,o,s,async()=>{if(!w)return;let e="tel:"+w;window.open(e,"_self")},$,I,function(t){te(e,t)}]}class td extends xe{constructor(e){var t;super(),document.getElementById("svelte-9up2nn-style")||((t=M("style")).id="svelte-9up2nn-style",t.textContent=".feather.svelte-9up2nn{position:absolute;top:0.75em;left:0.5em;color:#4300b0;margin-left:-2em}.feather2.svelte-9up2nn{position:absolute;top:0.75em;left:0.5em;color:light-gray;margin-left:-2em}",D(document.head,t)),De(this,e,ed,Jc,S,{inputClass:2,disabled:3,formnovalidate:4,readonly:5,required:6,id:7,name:8,value:9,pattern:0,placeholder:1,notifyList:13,country:14})}}function nd(e){let t,n,r;return n=new $t({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather2 svelte-9up2nn")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function rd(e){let t,n,r,i,o;return n=new $t({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather pointer svelte-9up2nn")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[12]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function id(e){let t,n,r,i,o,s;n=new e[11]({props:{type:"email",inputClass:e[0],pattern:e[9],placeholder:e[10],disabled:e[1],formnovalidate:e[2],readonly:e[3],required:e[4],id:e[5],name:e[6],multiple:e[8],value:e[7]}}),n.$on("change",e[13]);const a=[rd,nd],l=[];function c(e,t){return e[7]?0:1}return i=c(e),o=l[i]=a[i](e),{c(){t=M("div"),Ne(n.$$.fragment),r=L(),o.c(),q(t,"position","relative")},m(e,o){x(e,t,o),Te(n,t,null),D(t,r),l[i].m(t,null),s=!0},p(e,[r]){const s={};1&r&&(s.inputClass=e[0]),512&r&&(s.pattern=e[9]),1024&r&&(s.placeholder=e[10]),2&r&&(s.disabled=e[1]),4&r&&(s.formnovalidate=e[2]),8&r&&(s.readonly=e[3]),16&r&&(s.required=e[4]),32&r&&(s.id=e[5]),64&r&&(s.name=e[6]),256&r&&(s.multiple=e[8]),128&r&&(s.value=e[7]),n.$set(s);let d=i;i=c(e),i===d?l[i].p(e,r):(ye(),Ie(l[d],1,1,()=>{l[d]=null}),ve(),o=l[i],o?o.p(e,r):(o=l[i]=a[i](e),o.c()),$e(o,1),o.m(t,null))},i(e){s||($e(n.$$.fragment,e),$e(o),s=!0)},o(e){Ie(n.$$.fragment,e),Ie(o),s=!1},d(e){e&&k(t),Re(n),l[i].d()}}}function od(e,t,n){const{TextField:r}=c;let{inputClass:i}=t,{disabled:o}=t,{formnovalidate:s}=t,{readonly:a}=t,{required:l}=t,{id:d}=t,{name:u}=t,{value:f}=t,{multiple:h}=t,{pattern:m}=t,{placeholder:p}=t;return e.$$set=e=>{"inputClass"in e&&n(0,i=e.inputClass),"disabled"in e&&n(1,o=e.disabled),"formnovalidate"in e&&n(2,s=e.formnovalidate),"readonly"in e&&n(3,a=e.readonly),"required"in e&&n(4,l=e.required),"id"in e&&n(5,d=e.id),"name"in e&&n(6,u=e.name),"value"in e&&n(7,f=e.value),"multiple"in e&&n(8,h=e.multiple),"pattern"in e&&n(9,m=e.pattern),"placeholder"in e&&n(10,p=e.placeholder)},[i,o,s,a,l,d,u,f,h,m,p,r,async()=>{if(!f)return;let e="mailto:"+f;window.open(e,"_self")},function(t){te(e,t)}]}class sd extends xe{constructor(e){var t;super(),document.getElementById("svelte-9up2nn-style")||((t=M("style")).id="svelte-9up2nn-style",t.textContent=".feather.svelte-9up2nn{position:absolute;top:0.75em;left:0.5em;color:#4300b0;margin-left:-2em}.feather2.svelte-9up2nn{position:absolute;top:0.75em;left:0.5em;color:light-gray;margin-left:-2em}",D(document.head,t)),De(this,e,od,id,S,{inputClass:0,disabled:1,formnovalidate:2,readonly:3,required:4,id:5,name:6,value:7,multiple:8,pattern:9,placeholder:10})}}const ad=["Activate","AddUndo","BeforeAddUndo","BeforeExecCommand","BeforeGetContent","BeforeRenderUI","BeforeSetContent","BeforePaste","Blur","Change","ClearUndos","Click","CommentChange","CompositionEnd","CompositionStart","CompositionUpdate","ContextMenu","Copy","Cut","Dblclick","Deactivate","Dirty","Drag","DragDrop","DragEnd","DragGesture","DragOver","Drop","ExecCommand","Focus","FocusIn","FocusOut","GetContent","Hide","Init","Input","KeyDown","KeyPress","KeyUp","LoadContent","MouseDown","MouseEnter","MouseLeave","MouseMove","MouseOut","MouseOver","MouseUp","NodeChange","ObjectResizeStart","ObjectResized","ObjectSelected","Paste","PostProcess","PostRender","PreProcess","ProgressState","Redo","Remove","Reset","ResizeEditor","SaveContent","SelectionChange","SetAttrib","SetContent","Show","Submit","Undo","VisualAid"];function ld(e){let t;return{c(){t=M("textarea"),z(t,"id",e[0]),q(t,"visibility","hidden")},m(n,r){x(n,t,r),e[20](t)},p(e,n){1&n&&z(t,"id",e[0])},d(n){n&&k(t),e[20](null)}}}function cd(e){let t;return{c(){t=M("div"),z(t,"id",e[0])},m(n,r){x(n,t,r),e[19](t)},p(e,n){1&n&&z(t,"id",e[0])},d(n){n&&k(t),e[19](null)}}}function dd(e){let t;function n(e,t){return e[1]?cd:ld}let r=n(e),i=r(e);return{c(){t=M("div"),i.c(),z(t,"class",e[2])},m(n,r){x(n,t,r),i.m(t,null),e[21](t)},p(e,[o]){r===(r=n(e))&&i?i.p(e,o):(i.d(1),i=r(e),i&&(i.c(),i.m(t,null))),4&o&&z(t,"class",e[2])},i:_,o:_,d(n){n&&k(t),i.d(),e[21](null)}}}const ud=e=>e+"_"+Math.floor(1e9*Math.random())+String(Date.now());let fd=(()=>{let e={listeners:[],scriptId:ud("tiny-script"),scriptLoaded:!1,injected:!1};return{load:(t,n,r)=>{e.scriptLoaded?r():(e.listeners.push(r),e.injected||((t,n,r,i)=>{e.injected=!0;const o=n.createElement("script");o.referrerPolicy="origin",o.type="application/javascript",o.src=r,o.onload=()=>{i()},n.head&&n.head.appendChild(o)})(e.scriptId,t,n,()=>{e.listeners.forEach(e=>e()),e.scriptLoaded=!0}))}}})();function hd(e,t,n){let r,i,o,{id:s=ud("tinymce-svelte")}=t,{inline:a}=t,{disabled:l=!1}=t,{readonly:c=!1}=t,{apiKey:d="no-api-key"}=t,{licenseKey:u}=t,{channel:f="8"}=t,{scriptSrc:h}=t,{conf:m={}}=t,{modelEvents:p="change input undo redo"}=t,{value:g=""}=t,{text:w=""}=t,{cssClass:y="tinymce-wrapper"}=t,v=g,$=l,I=c;const _=(e,t)=>{var n;"function"==typeof(null===(n=e.mode)||void 0===n?void 0:n.set)&&e.mode.set(t?"readonly":"design")},C=(e,t)=>{(e=>"function"==typeof e.options.set&&e.options.isRegistered("disabled"))(e)?e.options.set("disabled",t):e.mode.set(t?"readonly":"design")},E=ee(),A=()=>{const e="undefined"!=typeof window?window:global;return e&&e.tinymce?e.tinymce:null},b=()=>{var e;const t=Object.assign(Object.assign({},m),{target:i,inline:void 0!==a?a:void 0!==m.inline&&m.inline,license_key:u,setup:e=>{e.on("PreInit",()=>{C(e,l),_(e,c)}),n(15,o=e),e.on("init",()=>{e.setContent(g),e.on(p,()=>{n(16,v=e.getContent()),v!==g&&(n(5,g=v),n(6,w=e.getContent({format:"text"})))})}),((e,t)=>{ad.forEach(n=>{e.on(n,r=>{t(n.toLowerCase(),{eventName:n,event:r,editor:e})})})})(e,E),"function"==typeof m.setup&&m.setup(e)}});n(4,i.style.visibility="",i),null===(e=A())||void 0===e||e.init(t)};return Q(()=>{if(null!==A())b();else{const e=h||`https://cdn.tiny.cloud/1/${d}/tinymce/${f}/tinymce.min.js`;fd.load(r.ownerDocument,e,()=>{b()})}}),J(()=>{var e;o&&(null===(e=A())||void 0===e||e.remove(o))}),e.$$set=e=>{"id"in e&&n(0,s=e.id),"inline"in e&&n(1,a=e.inline),"disabled"in e&&n(7,l=e.disabled),"readonly"in e&&n(8,c=e.readonly),"apiKey"in e&&n(9,d=e.apiKey),"licenseKey"in e&&n(10,u=e.licenseKey),"channel"in e&&n(11,f=e.channel),"scriptSrc"in e&&n(12,h=e.scriptSrc),"conf"in e&&n(13,m=e.conf),"modelEvents"in e&&n(14,p=e.modelEvents),"value"in e&&n(5,g=e.value),"text"in e&&n(6,w=e.text),"cssClass"in e&&n(2,y=e.cssClass)},e.$$.update=()=>{491936&e.$$.dirty&&(o&&v!==g&&(o.setContent(g),n(6,w=o.getContent({format:"text"}))),o&&c!==I&&(n(18,I=c),_(o,c)),o&&l!==$&&(n(17,$=l),C(o,l)))},[s,a,y,r,i,g,w,l,c,d,u,f,h,m,p,o,v,$,I,function(e){re[e?"unshift":"push"](()=>{i=e,n(4,i)})},function(e){re[e?"unshift":"push"](()=>{i=e,n(4,i)})},function(e){re[e?"unshift":"push"](()=>{r=e,n(3,r)})}]}class md extends xe{constructor(e){super(),De(this,e,hd,dd,S,{id:0,inline:1,disabled:7,readonly:8,apiKey:9,licenseKey:10,channel:11,scriptSrc:12,conf:13,modelEvents:14,value:5,text:6,cssClass:2})}}function pd(e){let t,n,r,i,o,s,a;function l(t){e[11](t)}let c={scriptSrc:"/tinymce/tinymce.min.js",licenseKey:"gpl",conf:e[7],disabled:e[4],readonly:e[5]};return void 0!==e[0]&&(c.value=e[0]),n=new md({props:c}),re.push(()=>Se(n,"value",l)),n.$on("init",e[8]),{c(){t=M("div"),Ne(n.$$.fragment),i=L(),o=M("input"),z(o,"class",s=e[1]||e[2]),z(o,"id",e[3]),z(o,"name",e[3]),o.value=e[0],o.hidden=!0,q(t,"min-height","10em"),q(t,"margin-top","-1em")},m(e,r){x(e,t,r),Te(n,t,null),D(t,i),D(t,o),a=!0},p(e,[t]){const i={};16&t&&(i.disabled=e[4]),32&t&&(i.readonly=e[5]),!r&&1&t&&(r=!0,i.value=e[0],ue(()=>r=!1)),n.$set(i),(!a||6&t&&s!==(s=e[1]||e[2]))&&z(o,"class",s),(!a||8&t)&&z(o,"id",e[3]),(!a||8&t)&&z(o,"name",e[3]),(!a||1&t&&o.value!==e[0])&&(o.value=e[0])},i(e){a||($e(n.$$.fragment,e),a=!0)},o(e){Ie(n.$$.fragment,e),a=!1},d(e){e&&k(t),Re(n)}}}let gd=!1;function wd(e,t,r){let i;const{environment:o}=u;N(e,o,e=>r(15,i=e));const s=ee();let a=JSON.parse(n.getItem("Locale")).id;a=a.startsWith("fr")?"fr_FR":a.split("-")[0];let l,c,{value:d=""}=t,{noForm:f}=t,{classId:h}=t,{id:m}=t,{record:p}=t,{disabled:g}=t,{readonly:w}=t,{keepOrigin:y}=t;const v=(e,t,n)=>{const r=e.split("{{").slice(1).map(e=>e.split("}}")[0]);if(r?.length)return r.reduce((e,r)=>{let[i,o,s]=r.split(".");if(!o)return e;if(!t[i]&&!n[i])return e;s&&(o=o+"."+s);const a=e.find(e=>e.table===i);return a?a.attrs=a.attrs.concat(o):e.push({table:i,attrs:[o]}),e},[])},I={plugins:"advlist link image lists table preview emoticons fullscreen",menu:{file:{title:"File",items:"preview"}},menubar:"edit view insert format table",toolbar:"undo redo | styles | bold italic | alignleft aligncenter alignright alignjustify | outdent indent | bullist numlist | fullscreen",height:600,language:a};return e.$$set=e=>{"value"in e&&r(0,d=e.value),"noForm"in e&&r(1,f=e.noForm),"classId"in e&&r(2,h=e.classId),"id"in e&&r(3,m=e.id),"record"in e&&r(9,p=e.record),"disabled"in e&&r(4,g=e.disabled),"readonly"in e&&r(5,w=e.readonly),"keepOrigin"in e&&r(10,y=e.keepOrigin)},e.$$.update=()=>{513&e.$$.dirty&&((e,t)=>{if(y)return;if(!l)return;if(gd)return;if(!e)return;if(!e.includes("{{"))return;const n=v(d,p,c);n?.length&&(gd=!0,Promise.all(n.map(async(e,n)=>{let r;return t[e.table]&&(r=await xp(e.table,t[e.table]).catch(()=>{})),{table:r,def:e}})).then(t=>{if(t?.length){for(const n of t)for(const t of n.def.attrs){let r=$(n.table||c[n.def.table],t);if(r?.endsWith("Z")&&24===r?.length){let[e,t,n]=r.split("-");n=n.slice(0,2),r=`${n}.${t}.${e}`}e=e.replace(`{{${n.def.table}.${t}}}`,r)}s("blur",{value:e||""})}}).catch(e=>{console.log("error",e)}).finally(()=>{r(0,d=e||""),gd=!1}))})(d,p)},[d,f,h,m,g,w,o,I,e=>{c={owner:i.owner},l=!0},p,y,function(e){d=e,r(0,d)}]}class yd extends xe{constructor(e){var t;super(),document.getElementById("svelte-yi7lpi-style")||((t=M("style")).id="svelte-yi7lpi-style",t.textContent="div.tox-statusbar__text-container, div.tox-promotion{display:none !important}div.tox.tox-tinymce{border:1px #808080 solid}.tox-edit-area__iframe{background-color:#f9f3f6 !important}",D(document.head,t)),De(this,e,wd,pd,S,{value:0,noForm:1,classId:2,id:3,record:9,disabled:4,readonly:5,keepOrigin:10})}}
1
+ System.register(["@enablerr-ui/form","@enablerr-ui/layout","@enablerr-ui/auth","@enablerr-ui/task"],function(e){"use strict";var t,n,r,i,o,s,a,l,c,d,u,f;return{setters:[function(e){t=e.Request,n=e.Storage,r=e.task_notification,i=e.currentRoles,o=e.settings,s=e.TextArea,a=e.toasts,l=e.Page},function(e){c=e.getAttractions,d=e.PopOver},function(e){u=e.user},function(e){f=e.taskClipboard}],execute:function(){function h(e,t){return t.forEach(function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach(function(n){if("default"!==n&&!(n in e)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})}),Object.freeze(e)}e("version","0.3.205");const m=e("checkDate",(e,t)=>"string"!=typeof e||e.length<20||!(t=e.split(" · "))?e:t.map(e=>2===e.split("T").length&&3===e.split("T")[0].split("-").length?new Date(e).toLocaleDateString():e).filter(e=>!!e).join(" · ")),p=e=>{try{return new Date(e).toLocaleString()}catch{return e}},g=(e,t)=>{let n,r;try{n=t[e+"_from"],n=new Date(n||"").toLocaleDateString(),"Invalid Date"===n&&(n=" ")}catch{n=" "}try{r=t[e+"_to"],r=new Date(r||"").toLocaleDateString(),"Invalid Date"===r&&(r="")}catch{r=""}return[n,r].filter(e=>""!==e).join(" - ").trim()},w=e=>!0===e?"(ja)":!1===e?"(nein)":"",y=(e,t)=>{if(!e.display&&!e.items)return"";const n={...t};return(e.display?.reduce((t,r)=>{let[i,o]=r.split(".");if(e.list?.find(({name:e})=>e===i)&&o&&void 0!==n[i]){const e=`${i}_${o}`;n[e]=n[i][o],i=e}return t.find(e=>e===i)||t.push(i),t},[]).map(e=>{const t=n[e];if("boolean"==typeof t)return w(t);if("number"==typeof t){const e=t.toString().split(".")[1];return e&&e.length>2?((e,t)=>(t||=0,"number"==typeof e&&e||(e=Number(e||0)),(+(Math.round(e+"e+"+t)+"e-"+t)).toString()))(t,2):t}return m(n["_"+e]||t)})||e.items.map(e=>"object"===e.type?t["_"+e.name]:"list"===e.type?"":("boolean"==typeof t[e.name]&&w(t[e.name]),t[e.name]))).map(e=>e?.toString().split(" · ").filter(e=>!!e&&!v(e)).join(" · ")).filter(e=>!!e).join(" • ")},v=e=>/^[0-9a-f]{24}/.test(e),$=(e,t)=>{try{return t.split(".").reduce((e,t)=>e[t],e)??""}catch{return""}};const I=e=>{if(t=e,"[object Date]"===Object.prototype.toString.call(t))return e;var t;if("string"!=typeof e)return e;try{if((e=e.slice(0,10)).includes(".")){const[t,n,r]=e.split(".");return new Date(r,n-1,t)}if(e.includes("-")){const[t,n,r]=e.split("-");return new Date(t,n-1,r)}}catch{return e}return e};function _(){}function C(e){return e()}function E(){return Object.create(null)}function A(e){e.forEach(C)}function b(e){return"function"==typeof e}function S(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function N(e,t,n){e.$$.on_destroy.push(function(e,...t){if(null==e)return _;const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}(t,n))}function T(e){return null==e?"":e}function R(e,t,n=t){return e.set(n),t}function D(e,t){e.appendChild(t)}function x(e,t,n){e.insertBefore(t,n||null)}function k(e){e.parentNode.removeChild(e)}function O(e,t){for(let n=0;n<e.length;n+=1)e[n]&&e[n].d(t)}function M(e){return document.createElement(e)}function P(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function B(e){return document.createTextNode(e)}function L(){return B(" ")}function F(){return B("")}function V(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function U(e){return function(t){return t.preventDefault(),e.call(this,t)}}function W(e){return function(t){return t.stopPropagation(),e.call(this,t)}}function z(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function H(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}function j(e,t){e.value=null==t?"":t}function q(e,t,n,r){e.style.setProperty(t,n,r?"important":"")}function G(e,t,n){e.classList[n?"add":"remove"](t)}class X{constructor(e=null){this.a=e,this.e=this.n=null}m(e,t,n=null){this.e||(this.e=M(t.nodeName),this.t=t,this.h(e)),this.i(n)}h(e){this.e.innerHTML=e,this.n=Array.from(this.e.childNodes)}i(e){for(let t=0;t<this.n.length;t+=1)x(this.t,this.n[t],e)}p(e){this.d(),this.h(e),this.i(this.a)}d(){this.n.forEach(k)}}let Y;function Z(e){Y=e}function K(){if(!Y)throw new Error("Function called outside component initialization");return Y}function Q(e){K().$$.on_mount.push(e)}function J(e){K().$$.on_destroy.push(e)}function ee(){const e=K();return(t,n)=>{const r=e.$$.callbacks[t];if(r){const i=function(e,t){const n=document.createEvent("CustomEvent");return n.initCustomEvent(e,!1,!1,t),n}(t,n);r.slice().forEach(t=>{t.call(e,i)})}}}function te(e,t){const n=e.$$.callbacks[t.type];n&&n.slice().forEach(e=>e(t))}const ne=[],re=[],ie=[],oe=[],se=Promise.resolve();let ae=!1;function le(){ae||(ae=!0,se.then(me))}function ce(){return le(),se}function de(e){ie.push(e)}function ue(e){oe.push(e)}let fe=!1;const he=new Set;function me(){if(!fe){fe=!0;do{for(let e=0;e<ne.length;e+=1){const t=ne[e];Z(t),pe(t.$$)}for(Z(null),ne.length=0;re.length;)re.pop()();for(let e=0;e<ie.length;e+=1){const t=ie[e];he.has(t)||(he.add(t),t())}ie.length=0}while(ne.length);for(;oe.length;)oe.pop()();ae=!1,fe=!1,he.clear()}}function pe(e){if(null!==e.fragment){e.update(),A(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(de)}}const ge=new Set;let we;function ye(){we={r:0,c:[],p:we}}function ve(){we.r||A(we.c),we=we.p}function $e(e,t){e&&e.i&&(ge.delete(e),e.i(t))}function Ie(e,t,n,r){if(e&&e.o){if(ge.has(e))return;ge.add(e),we&&we.c.push(()=>{ge.delete(e),r&&(n&&e.d(1),r())}),e.o(t)}}function _e(e,t){const n=t.token={};function r(e,r,i,o){if(t.token!==n)return;t.resolved=o;let s=t.ctx;void 0!==i&&(s=s.slice(),s[i]=o);const a=e&&(t.current=e)(s);let l=!1;t.block&&(t.blocks?t.blocks.forEach((e,n)=>{n!==r&&e&&(ye(),Ie(e,1,1,()=>{t.blocks[n]===e&&(t.blocks[n]=null)}),ve())}):t.block.d(1),a.c(),$e(a,1),a.m(t.mount(),t.anchor),l=!0),t.block=a,t.blocks&&(t.blocks[r]=a),l&&me()}if((i=e)&&"object"==typeof i&&"function"==typeof i.then){const n=K();if(e.then(e=>{Z(n),r(t.then,1,t.value,e),Z(null)},e=>{if(Z(n),r(t.catch,2,t.error,e),Z(null),!t.hasCatch)throw e}),t.current!==t.pending)return r(t.pending,0),!0}else{if(t.current!==t.then)return r(t.then,1,t.value,e),!0;t.resolved=e}var i}function Ce(e,t,n){const r=t.slice(),{resolved:i}=e;e.current===e.then&&(r[e.value]=i),e.current===e.catch&&(r[e.error]=i),e.block.p(r,n)}const Ee="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:global;function Ae(e,t){Ie(e,1,1,()=>{t.delete(e.key)})}function be(e,t,n,r,i,o,s,a,l,c,d,u){let f=e.length,h=o.length,m=f;const p={};for(;m--;)p[e[m].key]=m;const g=[],w=new Map,y=new Map;for(m=h;m--;){const e=u(i,o,m),a=n(e);let l=s.get(a);l?r&&l.p(e,t):(l=c(a,e),l.c()),w.set(a,g[m]=l),a in p&&y.set(a,Math.abs(m-p[a]))}const v=new Set,$=new Set;function I(e){$e(e,1),e.m(a,d),s.set(e.key,e),d=e.first,h--}for(;f&&h;){const t=g[h-1],n=e[f-1],r=t.key,i=n.key;t===n?(d=t.first,f--,h--):w.has(i)?!s.has(r)||v.has(r)?I(t):$.has(i)?f--:y.get(r)>y.get(i)?($.add(r),I(t)):(v.add(i),f--):(l(n,s),f--)}for(;f--;){const t=e[f];w.has(t.key)||l(t,s)}for(;h;)I(g[h-1]);return g}function Se(e,t,n){const r=e.$$.props[t];void 0!==r&&(e.$$.bound[r]=n,n(e.$$.ctx[r]))}function Ne(e){e&&e.c()}function Te(e,t,n,r){const{fragment:i,on_mount:o,on_destroy:s,after_update:a}=e.$$;i&&i.m(t,n),r||de(()=>{const t=o.map(C).filter(b);s?s.push(...t):A(t),e.$$.on_mount=[]}),a.forEach(de)}function Re(e,t){const n=e.$$;null!==n.fragment&&(A(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function De(e,t,n,r,i,o,s=[-1]){const a=Y;Z(e);const l=e.$$={fragment:null,ctx:null,props:o,update:_,not_equal:i,bound:E(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(a?a.$$.context:t.context||[]),callbacks:E(),dirty:s,skip_bound:!1};let c=!1;if(l.ctx=n?n(e,t.props||{},(t,n,...r)=>{const o=r.length?r[0]:n;return l.ctx&&i(l.ctx[t],l.ctx[t]=o)&&(!l.skip_bound&&l.bound[t]&&l.bound[t](o),c&&function(e,t){-1===e.$$.dirty[0]&&(ne.push(e),le(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}(e,t)),n}):[],l.update(),c=!0,A(l.before_update),l.fragment=!!r&&r(l.ctx),t.target){if(t.hydrate){const e=function(e){return Array.from(e.childNodes)}(t.target);l.fragment&&l.fragment.l(e),e.forEach(k)}else l.fragment&&l.fragment.c();t.intro&&$e(e.$$.fragment),Te(e,t.target,t.anchor,t.customElement),me()}Z(a)}class xe{$destroy(){Re(this,1),this.$destroy=_}$on(e,t){const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}$set(e){var t;this.$$set&&(t=e,0!==Object.keys(t).length)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}function ke(e){let t,n,r,i;return{c(){t=P("svg"),n=P("path"),r=P("polygon"),z(n,"d","M5 17H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-1"),z(r,"points","12 15 17 21 7 21 12 15"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",i="feather feather-airplay "+e[2])},m(e,i){x(e,t,i),D(t,n),D(t,r)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-airplay "+e[2])&&z(t,"class",i)},i:_,o:_,d(e){e&&k(t)}}}function Oe(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class Me extends xe{constructor(e){super(),De(this,e,Oe,ke,S,{size:0,strokeWidth:1,class:2})}}function Pe(e){let t,n,r,i,o;return{c(){t=P("svg"),n=P("path"),r=P("line"),i=P("line"),z(n,"d","M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"),z(r,"x1","12"),z(r,"y1","9"),z(r,"x2","12"),z(r,"y2","13"),z(i,"x1","12"),z(i,"y1","17"),z(i,"x2","12.01"),z(i,"y2","17"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",o="feather feather-alert-triangle "+e[2])},m(e,o){x(e,t,o),D(t,n),D(t,r),D(t,i)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-alert-triangle "+e[2])&&z(t,"class",o)},i:_,o:_,d(e){e&&k(t)}}}function Be(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class Le extends xe{constructor(e){super(),De(this,e,Be,Pe,S,{size:0,strokeWidth:1,class:2})}}function Fe(e){let t,n,r,i,o;return{c(){t=P("svg"),n=P("circle"),r=P("polyline"),i=P("line"),z(n,"cx","12"),z(n,"cy","12"),z(n,"r","10"),z(r,"points","8 12 12 16 16 12"),z(i,"x1","12"),z(i,"y1","8"),z(i,"x2","12"),z(i,"y2","16"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",o="feather feather-arrow-down-circle "+e[2])},m(e,o){x(e,t,o),D(t,n),D(t,r),D(t,i)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-arrow-down-circle "+e[2])&&z(t,"class",o)},i:_,o:_,d(e){e&&k(t)}}}function Ve(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class Ue extends xe{constructor(e){super(),De(this,e,Ve,Fe,S,{size:0,strokeWidth:1,class:2})}}function We(e){let t,n,r,i;return{c(){t=P("svg"),n=P("path"),r=P("path"),z(n,"d","M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"),z(r,"d","M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",i="feather feather-book-open "+e[2])},m(e,i){x(e,t,i),D(t,n),D(t,r)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-book-open "+e[2])&&z(t,"class",i)},i:_,o:_,d(e){e&&k(t)}}}function ze(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class He extends xe{constructor(e){super(),De(this,e,ze,We,S,{size:0,strokeWidth:1,class:2})}}function je(e){let t,n,r,i;return{c(){t=P("svg"),n=P("path"),r=P("circle"),z(n,"d","M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"),z(r,"cx","12"),z(r,"cy","13"),z(r,"r","4"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",i="feather feather-camera "+e[2])},m(e,i){x(e,t,i),D(t,n),D(t,r)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-camera "+e[2])&&z(t,"class",i)},i:_,o:_,d(e){e&&k(t)}}}function qe(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class Ge extends xe{constructor(e){super(),De(this,e,qe,je,S,{size:0,strokeWidth:1,class:2})}}function Xe(e){let t,n,r,i;return{c(){t=P("svg"),n=P("path"),r=P("polyline"),z(n,"d","M22 11.08V12a10 10 0 1 1-5.93-9.14"),z(r,"points","22 4 12 14.01 9 11.01"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",i="feather feather-check-circle "+e[2])},m(e,i){x(e,t,i),D(t,n),D(t,r)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-check-circle "+e[2])&&z(t,"class",i)},i:_,o:_,d(e){e&&k(t)}}}function Ye(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class Ze extends xe{constructor(e){super(),De(this,e,Ye,Xe,S,{size:0,strokeWidth:1,class:2})}}function Ke(e){let t,n,r;return{c(){t=P("svg"),n=P("path"),z(n,"d","M18 3a3 3 0 0 0-3 3v12a3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3H6a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3V6a3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3h12a3 3 0 0 0 3-3 3 3 0 0 0-3-3z"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",r="feather feather-command "+e[2])},m(e,r){x(e,t,r),D(t,n)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&r!==(r="feather feather-command "+e[2])&&z(t,"class",r)},i:_,o:_,d(e){e&&k(t)}}}function Qe(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class Je extends xe{constructor(e){super(),De(this,e,Qe,Ke,S,{size:0,strokeWidth:1,class:2})}}function et(e){let t,n,r,i;return{c(){t=P("svg"),n=P("polyline"),r=P("path"),z(n,"points","9 10 4 15 9 20"),z(r,"d","M20 4v7a4 4 0 0 1-4 4H4"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",i="feather feather-corner-down-left "+e[2])},m(e,i){x(e,t,i),D(t,n),D(t,r)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-corner-down-left "+e[2])&&z(t,"class",i)},i:_,o:_,d(e){e&&k(t)}}}function tt(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class nt extends xe{constructor(e){super(),De(this,e,tt,et,S,{size:0,strokeWidth:1,class:2})}}function rt(e){let t,n,r,i,o;return{c(){t=P("svg"),n=P("path"),r=P("line"),i=P("line"),z(n,"d","M21 4H8l-7 8 7 8h13a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2z"),z(r,"x1","18"),z(r,"y1","9"),z(r,"x2","12"),z(r,"y2","15"),z(i,"x1","12"),z(i,"y1","9"),z(i,"x2","18"),z(i,"y2","15"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",o="feather feather-delete "+e[2])},m(e,o){x(e,t,o),D(t,n),D(t,r),D(t,i)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-delete "+e[2])&&z(t,"class",o)},i:_,o:_,d(e){e&&k(t)}}}function it(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class ot extends xe{constructor(e){super(),De(this,e,it,rt,S,{size:0,strokeWidth:1,class:2})}}function st(e){let t,n,r,i,o;return{c(){t=P("svg"),n=P("path"),r=P("polyline"),i=P("line"),z(n,"d","M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"),z(r,"points","15 3 21 3 21 9"),z(i,"x1","10"),z(i,"y1","14"),z(i,"x2","21"),z(i,"y2","3"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",o="feather feather-external-link "+e[2])},m(e,o){x(e,t,o),D(t,n),D(t,r),D(t,i)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-external-link "+e[2])&&z(t,"class",o)},i:_,o:_,d(e){e&&k(t)}}}function at(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class lt extends xe{constructor(e){super(),De(this,e,at,st,S,{size:0,strokeWidth:1,class:2})}}function ct(e){let t,n,r,i,o,s;return{c(){t=P("svg"),n=P("path"),r=P("polyline"),i=P("line"),o=P("line"),z(n,"d","M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"),z(r,"points","14 2 14 8 20 8"),z(i,"x1","12"),z(i,"y1","18"),z(i,"x2","12"),z(i,"y2","12"),z(o,"x1","9"),z(o,"y1","15"),z(o,"x2","15"),z(o,"y2","15"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",s="feather feather-file-plus "+e[2])},m(e,s){x(e,t,s),D(t,n),D(t,r),D(t,i),D(t,o)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&s!==(s="feather feather-file-plus "+e[2])&&z(t,"class",s)},i:_,o:_,d(e){e&&k(t)}}}function dt(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class ut extends xe{constructor(e){super(),De(this,e,dt,ct,S,{size:0,strokeWidth:1,class:2})}}function ft(e){let t,n,r,i,o;return{c(){t=P("svg"),n=P("circle"),r=P("line"),i=P("path"),z(n,"cx","12"),z(n,"cy","12"),z(n,"r","10"),z(r,"x1","2"),z(r,"y1","12"),z(r,"x2","22"),z(r,"y2","12"),z(i,"d","M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",o="feather feather-globe "+e[2])},m(e,o){x(e,t,o),D(t,n),D(t,r),D(t,i)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-globe "+e[2])&&z(t,"class",o)},i:_,o:_,d(e){e&&k(t)}}}function ht(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class mt extends xe{constructor(e){super(),De(this,e,ht,ft,S,{size:0,strokeWidth:1,class:2})}}function pt(e){let t,n,r,i,o,s,a,l;return{c(){t=P("svg"),n=P("line"),r=P("line"),i=P("line"),o=P("line"),s=P("line"),a=P("line"),z(n,"x1","8"),z(n,"y1","6"),z(n,"x2","21"),z(n,"y2","6"),z(r,"x1","8"),z(r,"y1","12"),z(r,"x2","21"),z(r,"y2","12"),z(i,"x1","8"),z(i,"y1","18"),z(i,"x2","21"),z(i,"y2","18"),z(o,"x1","3"),z(o,"y1","6"),z(o,"x2","3.01"),z(o,"y2","6"),z(s,"x1","3"),z(s,"y1","12"),z(s,"x2","3.01"),z(s,"y2","12"),z(a,"x1","3"),z(a,"y1","18"),z(a,"x2","3.01"),z(a,"y2","18"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",l="feather feather-list "+e[2])},m(e,l){x(e,t,l),D(t,n),D(t,r),D(t,i),D(t,o),D(t,s),D(t,a)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&l!==(l="feather feather-list "+e[2])&&z(t,"class",l)},i:_,o:_,d(e){e&&k(t)}}}function gt(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class wt extends xe{constructor(e){super(),De(this,e,gt,pt,S,{size:0,strokeWidth:1,class:2})}}function yt(e){let t,n,r,i;return{c(){t=P("svg"),n=P("path"),r=P("polyline"),z(n,"d","M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"),z(r,"points","22,6 12,13 2,6"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",i="feather feather-mail "+e[2])},m(e,i){x(e,t,i),D(t,n),D(t,r)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-mail "+e[2])&&z(t,"class",i)},i:_,o:_,d(e){e&&k(t)}}}function vt(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class $t extends xe{constructor(e){super(),De(this,e,vt,yt,S,{size:0,strokeWidth:1,class:2})}}function It(e){let t,n,r,i;return{c(){t=P("svg"),n=P("path"),r=P("circle"),z(n,"d","M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"),z(r,"cx","12"),z(r,"cy","10"),z(r,"r","3"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",i="feather feather-map-pin "+e[2])},m(e,i){x(e,t,i),D(t,n),D(t,r)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-map-pin "+e[2])&&z(t,"class",i)},i:_,o:_,d(e){e&&k(t)}}}function _t(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class Ct extends xe{constructor(e){super(),De(this,e,_t,It,S,{size:0,strokeWidth:1,class:2})}}function Et(e){let t,n,r,i,o;return{c(){t=P("svg"),n=P("polyline"),r=P("line"),i=P("path"),z(n,"points","23 7 23 1 17 1"),z(r,"x1","16"),z(r,"y1","8"),z(r,"x2","23"),z(r,"y2","1"),z(i,"d","M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",o="feather feather-phone-outgoing "+e[2])},m(e,o){x(e,t,o),D(t,n),D(t,r),D(t,i)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-phone-outgoing "+e[2])&&z(t,"class",o)},i:_,o:_,d(e){e&&k(t)}}}function At(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class bt extends xe{constructor(e){super(),De(this,e,At,Et,S,{size:0,strokeWidth:1,class:2})}}function St(e){let t,n,r,i,o;return{c(){t=P("svg"),n=P("rect"),r=P("line"),i=P("line"),z(n,"x","3"),z(n,"y","3"),z(n,"width","18"),z(n,"height","18"),z(n,"rx","2"),z(n,"ry","2"),z(r,"x1","12"),z(r,"y1","8"),z(r,"x2","12"),z(r,"y2","16"),z(i,"x1","8"),z(i,"y1","12"),z(i,"x2","16"),z(i,"y2","12"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",o="feather feather-plus-square "+e[2])},m(e,o){x(e,t,o),D(t,n),D(t,r),D(t,i)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-plus-square "+e[2])&&z(t,"class",o)},i:_,o:_,d(e){e&&k(t)}}}function Nt(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class Tt extends xe{constructor(e){super(),De(this,e,Nt,St,S,{size:0,strokeWidth:1,class:2})}}function Rt(e){let t,n,r,i,o;return{c(){t=P("svg"),n=P("polyline"),r=P("path"),i=P("rect"),z(n,"points","6 9 6 2 18 2 18 9"),z(r,"d","M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"),z(i,"x","6"),z(i,"y","14"),z(i,"width","12"),z(i,"height","8"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",o="feather feather-printer "+e[2])},m(e,o){x(e,t,o),D(t,n),D(t,r),D(t,i)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-printer "+e[2])&&z(t,"class",o)},i:_,o:_,d(e){e&&k(t)}}}function Dt(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class xt extends xe{constructor(e){super(),De(this,e,Dt,Rt,S,{size:0,strokeWidth:1,class:2})}}function kt(e){let t,n,r,i;return{c(){t=P("svg"),n=P("circle"),r=P("line"),z(n,"cx","11"),z(n,"cy","11"),z(n,"r","8"),z(r,"x1","21"),z(r,"y1","21"),z(r,"x2","16.65"),z(r,"y2","16.65"),z(t,"xmlns","http://www.w3.org/2000/svg"),z(t,"width",e[0]),z(t,"height",e[0]),z(t,"fill","none"),z(t,"viewBox","0 0 24 24"),z(t,"stroke","currentColor"),z(t,"stroke-width",e[1]),z(t,"stroke-linecap","round"),z(t,"stroke-linejoin","round"),z(t,"class",i="feather feather-search "+e[2])},m(e,i){x(e,t,i),D(t,n),D(t,r)},p(e,[n]){1&n&&z(t,"width",e[0]),1&n&&z(t,"height",e[0]),2&n&&z(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-search "+e[2])&&z(t,"class",i)},i:_,o:_,d(e){e&&k(t)}}}function Ot(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class Mt extends xe{constructor(e){super(),De(this,e,Ot,kt,S,{size:0,strokeWidth:1,class:2})}}const{document:Pt}=Ee;function Bt(e){e[53]=e[54].items}function Lt(e,t,n){const r=e.slice();return r[55]=t[n],r[57]=n,r}function Ft(e,t,n){const r=e.slice();return r[58]=t[n],r}function Vt(e,t,n){const r=e.slice();return r[58]=t[n],r}function Ut(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Wt(e){let t,n,r,i,o,s;Bt(e);let a=e[5]?.length&&zt(e),l=e[53]?.length&&jt(e),c=e[5]?.length&&Xt(e);return{c(){a&&a.c(),t=L(),n=M("div"),r=M("table"),l&&l.c(),i=L(),o=M("tbody"),c&&c.c(),z(r,"striped",""),z(r,"class","svelte-47aais"),z(n,"class","eList svelte-47aais")},m(e,d){a&&a.m(e,d),x(e,t,d),x(e,n,d),D(n,r),l&&l.m(r,null),D(r,i),D(r,o),c&&c.m(o,null),s=!0},p(e,n){Bt(e),e[5]?.length?a?(a.p(e,n),32&n[0]&&$e(a,1)):(a=zt(e),a.c(),$e(a,1),a.m(t.parentNode,t)):a&&(ye(),Ie(a,1,1,()=>{a=null}),ve()),e[53]?.length?l?l.p(e,n):(l=jt(e),l.c(),l.m(r,i)):l&&(l.d(1),l=null),e[5]?.length?c?(c.p(e,n),32&n[0]&&$e(c,1)):(c=Xt(e),c.c(),$e(c,1),c.m(o,null)):c&&(ye(),Ie(c,1,1,()=>{c=null}),ve())},i(e){s||($e(a),$e(c),s=!0)},o(e){Ie(a),Ie(c),s=!1},d(e){a&&a.d(e),e&&k(t),e&&k(n),l&&l.d(),c&&c.d()}}}function zt(e){let t,n,r,i,o,s,a,l,c,d,u,f=e[6]&&Ht(e);function h(t){e[34](t)}let m={id:e[11]};return void 0!==e[3]&&(m.value=e[3]),i=new e[8]({props:m}),re.push(()=>Se(i,"value",h)),i.$on("input",e[15]),l=new ot({props:{size:"18"}}),{c(){f&&f.c(),t=L(),n=M("div"),r=B("Suchen: "),Ne(i.$$.fragment),s=L(),a=M("span"),Ne(l.$$.fragment),z(a,"class","feather pointer svelte-47aais"),q(n,"margin-bottom","1em"),q(n,"position","relative")},m(o,h){f&&f.m(o,h),x(o,t,h),x(o,n,h),D(n,r),Te(i,n,null),D(n,s),D(n,a),Te(l,a,null),c=!0,d||(u=V(a,"click",e[17]),d=!0)},p(e,n){e[6]?f?64&n[0]&&$e(f,1):(f=Ht(e),f.c(),$e(f,1),f.m(t.parentNode,t)):f&&(ye(),Ie(f,1,1,()=>{f=null}),ve());const r={};!o&&8&n[0]&&(o=!0,r.value=e[3],ue(()=>o=!1)),i.$set(r)},i(e){c||($e(f),$e(i.$$.fragment,e),$e(l.$$.fragment,e),c=!0)},o(e){Ie(f),Ie(i.$$.fragment,e),Ie(l.$$.fragment,e),c=!1},d(e){f&&f.d(e),e&&k(t),e&&k(n),Re(i),Re(l),d=!1,u()}}}function Ht(e){let t,n;return t=new e[7]({}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function jt(e){let t,n,r,i=e[4]&&e[0]&&qt(),o=e[53],s=[];for(let t=0;t<o.length;t+=1)s[t]=Gt(Vt(e,o,t));return{c(){t=M("thead"),n=M("tr"),i&&i.c(),r=L();for(let e=0;e<s.length;e+=1)s[e].c();z(n,"class","svelte-47aais"),z(t,"class","svelte-47aais")},m(e,o){x(e,t,o),D(t,n),i&&i.m(n,null),D(n,r);for(let e=0;e<s.length;e+=1)s[e].m(n,null)},p(e,t){if(e[4]&&e[0]?i||(i=qt(),i.c(),i.m(n,r)):i&&(i.d(1),i=null),16388&t[0]){let r;for(o=e[53],r=0;r<o.length;r+=1){const i=Vt(e,o,r);s[r]?s[r].p(i,t):(s[r]=Gt(i),s[r].c(),s[r].m(n,null))}for(;r<s.length;r+=1)s[r].d(1);s.length=o.length}},d(e){e&&k(t),i&&i.d(),O(s,e)}}}function qt(e){let t;return{c(){t=M("th"),z(t,"class","svelte-47aais")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Gt(e){let t,n,r=e[58]?.designation+"";return{c(){t=M("th"),n=B(r),z(t,"class","svelte-47aais")},m(e,r){x(e,t,r),D(t,n)},p(e,t){4&t[0]&&r!==(r=e[58]?.designation+"")&&H(n,r)},d(e){e&&k(t)}}}function Xt(e){let t,n,r=[],i=new Map,o=e[5];const s=e=>e[55].index||e[55]?._id;for(let t=0;t<o.length;t+=1){let n=Lt(e,o,t),a=s(n);i.set(a,r[t]=Qt(a,n))}return{c(){for(let e=0;e<r.length;e+=1)r[e].c();t=F()},m(e,i){for(let t=0;t<r.length;t+=1)r[t].m(e,i);x(e,t,i),n=!0},p(e,n){356415&n[0]&&(o=e[5],ye(),r=be(r,n,s,1,e,o,i,t.parentNode,Ae,Qt,t,Lt),ve())},i(e){if(!n){for(let e=0;e<o.length;e+=1)$e(r[e]);n=!0}},o(e){for(let e=0;e<r.length;e+=1)Ie(r[e]);n=!1},d(e){for(let t=0;t<r.length;t+=1)r[t].d(e);e&&k(t)}}}function Yt(e){let t,n,r,i,o,s,a=e[4]&&e[0]&&Zt(e),l=e[53],c=[];for(let t=0;t<l.length;t+=1)c[t]=Kt(Ft(e,l,t));return{c(){t=M("tr"),a&&a.c(),n=L();for(let e=0;e<c.length;e+=1)c[e].c();r=L(),z(t,"class","pointer svelte-47aais"),G(t,"active",e[55]._id===e[1]),G(t,"blocked",!!e[55].blocked),G(t,"undeliverable",!!e[55].undeliverable)},m(l,d){x(l,t,d),a&&a.m(t,null),D(t,n);for(let e=0;e<c.length;e+=1)c[e].m(t,null);D(t,r),i=!0,o||(s=V(t,"click",W(function(){b(e[13](e[55],e[57]))&&e[13](e[55],e[57]).apply(this,arguments)})),o=!0)},p(i,o){if((e=i)[4]&&e[0]?a?(a.p(e,o),17&o[0]&&$e(a,1)):(a=Zt(e),a.c(),$e(a,1),a.m(t,n)):a&&(ye(),Ie(a,1,1,()=>{a=null}),ve()),20516&o[0]){let n;for(l=e[53],n=0;n<l.length;n+=1){const i=Ft(e,l,n);c[n]?c[n].p(i,o):(c[n]=Kt(i),c[n].c(),c[n].m(t,r))}for(;n<c.length;n+=1)c[n].d(1);c.length=l.length}34&o[0]&&G(t,"active",e[55]._id===e[1]),32&o[0]&&G(t,"blocked",!!e[55].blocked),32&o[0]&&G(t,"undeliverable",!!e[55].undeliverable)},i(e){i||($e(a),i=!0)},o(e){Ie(a),i=!1},d(e){e&&k(t),a&&a.d(),O(c,e),o=!1,s()}}}function Zt(e){let t,n,r,i,o;return n=new lt({props:{size:"18"}}),{c(){t=M("td"),Ne(n.$$.fragment),z(t,"class","editRow svelte-47aais"),q(t,"color","#326173")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",W(function(){b(e[18](e[55]))&&e[18](e[55]).apply(this,arguments)})),i=!0)},p(t,n){e=t},i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function Kt(e){let t,n,r,i=e[12](e[55],e[58])+"";return{c(){t=M("td"),n=B(i),z(t,"class",r=T(e[58].type)+" svelte-47aais")},m(e,r){x(e,t,r),D(t,n)},p(e,o){36&o[0]&&i!==(i=e[12](e[55],e[58])+"")&&H(n,i),4&o[0]&&r!==(r=T(e[58].type)+" svelte-47aais")&&z(t,"class",r)},d(e){e&&k(t)}}}function Qt(e,t){let n,r,i,o=t[16](t[55],t[53],t[3]),s=o&&Yt(t);return{key:e,first:null,c(){n=F(),s&&s.c(),r=F(),this.first=n},m(e,t){x(e,n,t),s&&s.m(e,t),x(e,r,t),i=!0},p(e,n){t=e,44&n[0]&&(o=t[16](t[55],t[53],t[3])),o?s?(s.p(t,n),44&n[0]&&$e(s,1)):(s=Yt(t),s.c(),$e(s,1),s.m(r.parentNode,r)):s&&(ye(),Ie(s,1,1,()=>{s=null}),ve())},i(e){i||($e(s),i=!0)},o(e){Ie(s),i=!1},d(e){e&&k(n),s&&s.d(e),e&&k(r)}}}function Jt(e){let t,n;return t=new e[7]({}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p:_,i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function en(e){let t,n,r,i={ctx:e,current:null,token:null,hasCatch:!1,pending:Jt,then:Wt,catch:Ut,value:54,blocks:[,,,]};return _e(n=e[2]&&e[14](),i),{c(){t=F(),i.block.c()},m(e,n){x(e,t,n),i.block.m(e,i.anchor=n),i.mount=()=>t.parentNode,i.anchor=t,r=!0},p(t,r){e=t,i.ctx=e,4&r[0]&&n!==(n=e[2]&&e[14]())&&_e(n,i)||Ce(i,e,r)},i(e){r||($e(i.block),r=!0)},o(e){for(let e=0;e<3;e+=1){Ie(i.blocks[e])}r=!1},d(e){e&&k(t),i.block.d(e),i.token=null,i=null}}}const tn=e("getDisplayItems",async(e,n,r)=>{if(!e)return;let i=[];for(const o of e){if("_total"===o){i.push({name:"_total",designation:"Betrag",type:"number"});continue}if("__total"===o){i.push({name:"__total",designation:"Total CHF",type:"number",decimals:2});continue}const[e,s]=o.split(".");let a=n.list?.find(t=>t.name===e)?.item?.find(e=>e.name===s);if(a&&(a={...a},a.name=`${e}_${s}`,r=r.map(t=>(t[e]&&(t[a.name]=t["_"+e]?t["_"+e][s]:t[e][s]),t))),o.endsWith("_from")||o.endsWith("_to")){const t=a=n.items.find(t=>t.name===e.split("_")[0]);t&&(a={name:o,designation:t.designation,type:"date",decimals:0})}if(a||(a=n.items.find(t=>t.name===e)),!a){const n=await t.getSchemaByClass(e),r=n.items?.find(e=>e.name===s);r&&(a={name:e,designation:r.designation,type:r.type,decimals:r.properties?.decimals||0})}i.find(t=>t?.name===e)||i.push(a)}return i.length?i:n.items});function nn(e,o,s){let a,l,d;N(e,i,e=>s(40,l=e));let f=JSON.parse(n.getItem("Locale")).id;const h=ee(),{Loading:p,TextField:g}=c,{currentTasks:y,loggedIn:v}=u;N(e,y,e=>s(39,a=e)),N(e,v,e=>s(41,d=e));let $,I,_,C,E,{inputList:A}=o,{eventId:b}=o,{prevEventId:S}=o,{record:T}=o,{className:R}=o,{rowId:D}=o,{filterForReady:x=!1}=o,{filter:k}=o,{query:O}=o,{refStatus:M}=o,{showEdit:P=!1}=o,{praefix:B=""}=o,{selectionFields:L=!1}=o,{deList:F}=o,{stopAggregation:V=!1}=o,{shouldBlock:U}=o,{inputSearch:W=""}=o,z=!0,H=W,j=R+Math.floor(9e3*Math.random()+1e3).toString()+"search",q=!1,G=!0;const X=(e,t)=>{if(!t)return;let n=e[t.name];if("__total"===t.name&&void 0===n&&(n=1.081*e._total),!n&&t.name.includes("_")&&!t.name.startsWith("_")&&!t.name.endsWith("_from")&&!t.name.endsWith("_to")){const[r,i]=t.name.split("_");try{n=e[r][i]}catch{}}if(Array.isArray(n)){const e=e=>e.replaceAll(" ",String.fromCharCode(160));if(n.length&&Array.isArray(n[0].serialno)){let t=[];for(const r of n)t=t.concat(r.serialno.map(e));n=t.join(", ")}else n=n.map(e),n.length>3&&(n=n.slice(0,3),n=n.concat("...")),n=n.join(", ")}if(!n&&t.name.split("_").length>1){const[r,i]=t.name.split("_");try{n=e[r][0][i],Array.isArray(n)&&(n=n.join(", "))}catch{}}return"number"===t.type&&(n||(n=e[`_${t.name}`]),n=Number(n)?Number(n).toLocaleString(f,{minimumFractionDigits:t.properties?.decimals||t.decimals||0,maximumFractionDigits:t.properties?.decimals||t.decimals||0}):""),"boolean"===t.type&&"Aktiv"===n&&(n=!1),"number"===t.type?n:"boolean"==typeof n||"boolean"===t.type?w(n):m(e[`_${t.name}`]||n||"")},Y=t.getSchemaByClass(R),Z=async(e,n)=>{if(!e)return[];if(k){let n=k;const r=k.startsWith("!");r&&(n=k.replace("!",""));const i=k.startsWith("$");if(n&&!i&&(e=e.filter(e=>r?!e[n]:!!e[n])),i){n=k.replace("$","");const[r,i]=n.split(".");if(T[i]){const n=await t.getSectionView(r,{[i]:T[i]});e=e.filter(e=>n.find(t=>t._id==e[r]))}else e=[]}}if(M&&!O)return s(19,M=[].concat(M)),e.filter(e=>!!M.find(t=>e._task.status===t));if("Information"===n.state.task)return e;if(S){const n=await t.getEvent(S);if("report"===n?.output?.type)return e;if(n?.input?.class?.length&&n.input.class[0].name===R)return"Information"===n.state.task?e.filter(e=>"Closed"!==e._task.status):e.filter(e=>"Ready"===e._task.status)}return e.filter(e=>"WaitingForApproval"===e._task.status||"Ready"===e._task.status||"Closing"===e._task.status)},K=(e,t)=>{if(e){let n,r="1";if("string"==typeof e)n=e;else{const t=Object.keys(e);n=t[0],r=e[t[0]]}"date"===n&&(r="-1");const i=new Intl.Collator(f,{numeric:!0});return 1==+r?t.sort((e,t)=>i.compare(e[n],t[n])):t.sort((e,t)=>i.compare(t[n],e[n]))}return t},J=async e=>{let n,r=0;G=!1;const i=e=>new Promise(t=>setTimeout(t,e)),o=await Y;for(;r++<200&&!V&&!(n=await te(e,o.id));)await i(500);s(6,q=!1),V&&t.readTasksByAggregationId(e,!0),n&&(s(5,_=K(I.displaySort,n.data)),window.setTimeout(()=>{const e=document.querySelector("tr.active");e&&e.scrollIntoView({block:"end",behavior:"smooth"}),G=!0,document.getElementById(j)?.focus()},100))},te=async(e,n)=>await t.readTasksByAggregationId(e,!1,n),ne=async(e,t,n,r)=>{const{value:i,refClass:o}=r,[s,a]=n.split("."),l=i?.get(B),c=l&&await xp(s,l);if(!c)return e;const d=c[a];return d?.length?d.map(n=>{let r=e?.find(e=>e._id===n[t])||{};r={...r};for(const e in r)n[e]&&(r[e]=n[e]);for(const e in n)n[e]&&(r[e]=n[e]);return Rp(o+r._id.toString(),r),r}):e};Q(()=>{window.setTimeout(()=>{const e=document.querySelector("tr.active");e&&e.scrollIntoView({block:"end",behavior:"smooth"}),document.getElementById(j)?.focus()},200)}),r.subscribe(async e=>{if(!e)return;const t=await Y;e.eventId===t.id&&(kp(t.class,e.eventId),s(2,z=!s(2,z=!1)))});return e.$$set=e=>{"inputList"in e&&s(21,A=e.inputList),"eventId"in e&&s(22,b=e.eventId),"prevEventId"in e&&s(23,S=e.prevEventId),"record"in e&&s(24,T=e.record),"className"in e&&s(25,R=e.className),"rowId"in e&&s(1,D=e.rowId),"filterForReady"in e&&s(26,x=e.filterForReady),"filter"in e&&s(27,k=e.filter),"query"in e&&s(28,O=e.query),"refStatus"in e&&s(19,M=e.refStatus),"showEdit"in e&&s(0,P=e.showEdit),"praefix"in e&&s(29,B=e.praefix),"selectionFields"in e&&s(30,L=e.selectionFields),"deList"in e&&s(31,F=e.deList),"stopAggregation"in e&&s(20,V=e.stopAggregation),"shouldBlock"in e&&s(32,U=e.shouldBlock),"inputSearch"in e&&s(33,W=e.inputSearch)},[P,D,z,H,$,_,q,p,g,y,v,j,X,(e,t)=>n=>{s(20,V=!0);const r=G?e:C[t];h("choose",{row:r})},async()=>{I=await Y,s(4,$=(e=>!a?.length||!!a.find(t=>t===e))(I.id)),O&&s(5,_=C=await t.getTasksFiltered(I.class,O)),_||s(5,_=C=K(I.displaySort,await A||await Np(I.class,I.id))),500!==_?.length||O||(s(6,q=!0),await t.getTasksList(I.id,!1,!0).then(({aggregationId:e})=>J(e)));let e,n=!1,r="";const i=L&&L?.find(e=>I.class===e.refClass.split(":")[0]),o=i?.value?.get&&i.value.get(B);if(o){const[a,l]=i.refClass.split(":");I.class===a&&s(5,_=await ne(_,a,l,i)),n=i.parentClass?.find(e=>"quantity"===e.name),r=i.className,e=await t.getCountedSection(r,l.split(".")[0],o,a,"quantity")}s(0,P&&=!i),!i&&(k||x||M)&&s(5,_=await Z(_,I)),E=I.authorization?.find(e=>"employee"===e.constraint)&&!l.some(e=>I.authorization?.find(t=>t.role===e&&"employee"!==t.constraint));const{display:c}=I;let u=await tn(c,I,_);if(!P&&n?(u=u.concat([{name:"quantity",designation:"h-Soll",type:"number",decimals:2},{name:"ist",designation:"h-Ist",type:"number",decimals:2}]),s(5,_=_.map((t,n)=>{const r=e.find(e=>e._id===t._id);return r&&(t.ist=r.quantity.$numberDecimal),t.index=n,t})),e.map(e=>{if(!_.find(t=>t._id===e._id)){const t=C.find(t=>t._id===e._id);t&&(t.ist=e.quantity.$numberDecimal),_.push(t)}}),h("init",_)):F&&s(5,_=_.filter(e=>!F.find(t=>t?._id===e._id))),U&&s(5,_=_.filter(e=>!e[U])),E){const e={businessEmail:d.user},n=await t.getSectionView("employee",e);s(5,_=n?.length?_.filter(e=>e.employee===n[0]._id):[])}return{items:u}},({detail:{value:e}})=>{s(3,H=e)},(e,t,n)=>{if(!e)return!1;if(!n)return!0;"string"!=typeof n&&(n=n.toString()),n=n.toLowerCase();let r=!1;for(const i of t){const t=X(e,i).toLowerCase();!r&&t.includes(n)&&(r=!0)}return r},()=>{s(3,H="")},async e=>{let t=e._task;t||(t=await Tp(R,"",e._id,!0),t=t._task),window.open(`/task/${t.event}/${t.task_id||t._id}/task?view=standalone`,"_blank")},M,V,A,b,S,T,R,x,k,O,B,L,F,U,W,function(e){H=e,s(3,H)}]}class rn extends xe{constructor(e){var t;super(),Pt.getElementById("svelte-47aais-style")||((t=M("style")).id="svelte-47aais-style",t.textContent=".feather.svelte-47aais.svelte-47aais{position:absolute;top:2em;right:0.5em;color:#326173}.eList.svelte-47aais.svelte-47aais{height:fit-content;max-height:65vh;overflow-y:scroll;overflow-x:auto}.eList.svelte-47aais .editRow.svelte-47aais{width:1em}.eList.svelte-47aais table.svelte-47aais{min-width:30vw;position:relative;width:max-content !important;max-width:50vh !important}.eList.svelte-47aais table thead.svelte-47aais{position:sticky;top:0;background:#326173;color:white}.eList.svelte-47aais table thead tr.svelte-47aais{height:2.3em}.eList.svelte-47aais table tbody tr.svelte-47aais{height:2.75em !important}th.svelte-47aais.svelte-47aais,td.svelte-47aais.svelte-47aais{padding-left:0.4em;padding-right:0.4em}td.number.svelte-47aais.svelte-47aais{text-align:end}tr.pointer.svelte-47aais.svelte-47aais:hover{background-color:#DAE1E5}tr.active.svelte-47aais.svelte-47aais{color:#326173;background-color:#fcebd5}tr.blocked.svelte-47aais.svelte-47aais{color:red !important}tr.undeliverable.svelte-47aais.svelte-47aais{color:orange}",D(Pt.head,t)),De(this,e,nn,en,S,{inputList:21,eventId:22,prevEventId:23,record:24,className:25,rowId:1,filterForReady:26,filter:27,query:28,refStatus:19,showEdit:0,praefix:29,selectionFields:30,deList:31,stopAggregation:20,shouldBlock:32,inputSearch:33},[-1,-1,-1])}}function on(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function sn(e){let t,n,r=e[45]&&an(e);return{c(){r&&r.c(),t=F()},m(e,i){r&&r.m(e,i),x(e,t,i),n=!0},p(e,n){e[45]?r?(r.p(e,n),16&n[0]&&$e(r,1)):(r=an(e),r.c(),$e(r,1),r.m(t.parentNode,t)):r&&(ye(),Ie(r,1,1,()=>{r=null}),ve())},i(e){n||($e(r),n=!0)},o(e){Ie(r),n=!1},d(e){r&&r.d(e),e&&k(t)}}}function an(e){let t,n;return t=new e[25]({props:{title:e[20]?"Auswahl":e[0],class:"eList "+(e[18]?"form":""),$$slots:{default:[wn]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};1048577&n[0]&&(r.title=e[20]?"Auswahl":e[0]),262144&n[0]&&(r.class="eList "+(e[18]?"form":"")),33554430&n[0]|32768&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function ln(e){let t,n;return t=new Fp({props:{schema:e[2],recID:e[1],readonly:e[19]}}),t.$on("choose",function(){b(e[34](e[45]))&&e[34](e[45]).apply(this,arguments)}),t.$on("back",e[31]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(n,r){e=n;const i={};4&r[0]&&(i.schema=e[2]),2&r[0]&&(i.recID=e[1]),524288&r[0]&&(i.readonly=e[19]),t.$set(i)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function cn(e){let t,n,r,i,o,s,a;t=new e[26]({props:{text:e[20]?"Zusätzliche Auswahl":""}});const l=[un,dn],c=[];function d(e,t){return e[20]?0:1}return r=d(e),i=c[r]=l[r](e),s=new rn({props:{inputSearch:e[15],record:e[3],eventId:e[2].id,className:e[2].class,prevEventId:e[14],filterForReady:e[5],filter:e[6],query:e[7],refStatus:e[8],praefix:e[9],selectionFields:e[10],rowId:e[1],shouldBlock:e[16],deList:e[12],stopAggregation:e[24],showEdit:e[11]}}),s.$on("edit",e[35]),s.$on("choose",e[38]),s.$on("init",e[36]),{c(){Ne(t.$$.fragment),n=L(),i.c(),o=L(),Ne(s.$$.fragment)},m(e,i){Te(t,e,i),x(e,n,i),c[r].m(e,i),x(e,o,i),Te(s,e,i),a=!0},p(e,n){const a={};1048576&n[0]&&(a.text=e[20]?"Zusätzliche Auswahl":""),t.$set(a);let u=r;r=d(e),r===u?c[r].p(e,n):(ye(),Ie(c[u],1,1,()=>{c[u]=null}),ve(),i=c[r],i?i.p(e,n):(i=c[r]=l[r](e),i.c()),$e(i,1),i.m(o.parentNode,o));const f={};32768&n[0]&&(f.inputSearch=e[15]),8&n[0]&&(f.record=e[3]),4&n[0]&&(f.eventId=e[2].id),4&n[0]&&(f.className=e[2].class),16384&n[0]&&(f.prevEventId=e[14]),32&n[0]&&(f.filterForReady=e[5]),64&n[0]&&(f.filter=e[6]),128&n[0]&&(f.query=e[7]),256&n[0]&&(f.refStatus=e[8]),512&n[0]&&(f.praefix=e[9]),1024&n[0]&&(f.selectionFields=e[10]),2&n[0]&&(f.rowId=e[1]),65536&n[0]&&(f.shouldBlock=e[16]),4096&n[0]&&(f.deList=e[12]),16777216&n[0]&&(f.stopAggregation=e[24]),2048&n[0]&&(f.showEdit=e[11]),s.$set(f)},i(e){a||($e(t.$$.fragment,e),$e(i),$e(s.$$.fragment,e),a=!0)},o(e){Ie(t.$$.fragment,e),Ie(i),Ie(s.$$.fragment,e),a=!1},d(e){Re(t,e),e&&k(n),c[r].d(e),e&&k(o),Re(s,e)}}}function dn(e){let t,n,r,i;n=new e[27]({props:{outline:!0,$$slots:{default:[fn]},$$scope:{ctx:e}}}),n.$on("click",e[32]);let o=e[29]&&e[13]&&hn(e);return{c(){t=M("div"),Ne(n.$$.fragment),r=L(),o&&o.c(),z(t,"class","form--buttons svelte-jb5mrh")},m(e,s){x(e,t,s),Te(n,t,null),D(t,r),o&&o.m(t,null),i=!0},p(e,r){const i={};32768&r[1]&&(i.$$scope={dirty:r,ctx:e}),n.$set(i),e[29]&&e[13]?o?(o.p(e,r),8192&r[0]&&$e(o,1)):(o=hn(e),o.c(),$e(o,1),o.m(t,null)):o&&(ye(),Ie(o,1,1,()=>{o=null}),ve())},i(e){i||($e(n.$$.fragment,e),$e(o),i=!0)},o(e){Ie(n.$$.fragment,e),Ie(o),i=!1},d(e){e&&k(t),Re(n),o&&o.d()}}}function un(e){let t,n,r,i,o,s,a=e[23]&&pn(e);return r=new e[27]({props:{outline:!0,$$slots:{default:[gn]},$$scope:{ctx:e}}}),r.$on("click",e[32]),o=new e[26]({props:{text:"Liste aus "+e[17]}}),{c(){a&&a.c(),t=L(),n=M("div"),Ne(r.$$.fragment),i=L(),Ne(o.$$.fragment),z(n,"class","form--buttons svelte-jb5mrh")},m(e,l){a&&a.m(e,l),x(e,t,l),x(e,n,l),Te(r,n,null),x(e,i,l),Te(o,e,l),s=!0},p(e,n){e[23]?a?(a.p(e,n),8388608&n[0]&&$e(a,1)):(a=pn(e),a.c(),$e(a,1),a.m(t.parentNode,t)):a&&(ye(),Ie(a,1,1,()=>{a=null}),ve());const i={};32768&n[1]&&(i.$$scope={dirty:n,ctx:e}),r.$set(i);const s={};131072&n[0]&&(s.text="Liste aus "+e[17]),o.$set(s)},i(e){s||($e(a),$e(r.$$.fragment,e),$e(o.$$.fragment,e),s=!0)},o(e){Ie(a),Ie(r.$$.fragment,e),Ie(o.$$.fragment,e),s=!1},d(e){a&&a.d(e),e&&k(t),e&&k(n),Re(r),e&&k(i),Re(o,e)}}}function fn(e){let t;return{c(){t=B("Abbrechen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function hn(e){let t,n;return t=new e[27]({props:{filled:!0,$$slots:{default:[mn]},$$scope:{ctx:e}}}),t.$on("click",e[33]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};32768&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function mn(e){let t;return{c(){t=B("Neu")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function pn(e){let t,n;return t=new Su({props:{item:e[21],record:{_id:"",[e[21].name]:""},noForm:"true",classId:"sel_"+e[21].name,eventId:e[22],required:!1,hidden:!1,readonly:!1,deList:e[23]}}),t.$on("notify",e[37]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};2097152&n[0]&&(r.item=e[21]),2097152&n[0]&&(r.record={_id:"",[e[21].name]:""}),2097152&n[0]&&(r.classId="sel_"+e[21].name),4194304&n[0]&&(r.eventId=e[22]),8388608&n[0]&&(r.deList=e[23]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function gn(e){let t;return{c(){t=B("Abbrechen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function wn(e){let t,n,r,i;const o=[cn,ln],s=[];function a(e,t){return e[45].length&&!e[18]?0:1}return t=a(e),n=s[t]=o[t](e),{c(){n.c(),r=F()},m(e,n){s[t].m(e,n),x(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?s[t].p(e,i):(ye(),Ie(s[l],1,1,()=>{s[l]=null}),ve(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),$e(n,1),n.m(r.parentNode,r))},i(e){i||($e(n),i=!0)},o(e){Ie(n),i=!1},d(e){s[t].d(e),e&&k(r)}}}function yn(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function vn(e){let t,n,r,i={ctx:e,current:null,token:null,hasCatch:!1,pending:yn,then:sn,catch:on,value:45,blocks:[,,,]};return _e(n=e[30](e[4]),i),{c(){t=F(),i.block.c()},m(e,n){x(e,t,n),i.block.m(e,i.anchor=n),i.mount=()=>t.parentNode,i.anchor=t,r=!0},p(t,r){e=t,i.ctx=e,16&r[0]&&n!==(n=e[30](e[4]))&&_e(n,i)||Ce(i,e,r)},i(e){r||($e(i.block),r=!0)},o(e){for(let e=0;e<3;e+=1){Ie(i.blocks[e])}r=!1},d(e){e&&k(t),i.block.d(e),i.token=null,i=null}}}function $n(e,n,r){let i;const{Dialog:o,Divider:s,Button:a}=c,l=ee(),{currentTasks:d}=u;N(e,d,e=>r(41,i=e));let{title:f}=n,{schema:h}=n,{record:m}=n,{recID:p}=n,{isOpening:g=!0}=n,{filterForReady:w=!1}=n,{filter:y}=n,{query:v}=n,{refStatus:$}=n,{praefix:I=""}=n,{selectionFields:_=!1}=n,{showEdit:C=!0}=n,{deList:E}=n,{newAllowed:A=!0}=n,{prevEventId:b}=n,{inputSearch:S}=n,{shouldBlock:T}=n,R=h.id;h.class;let D,x,k,O,M,P,B,L="",F=!1,V=!1;f??=h.identity.designation;const U=!i?.length||i.find(e=>e===R);return e.$$set=e=>{"title"in e&&r(0,f=e.title),"schema"in e&&r(2,h=e.schema),"record"in e&&r(3,m=e.record),"recID"in e&&r(1,p=e.recID),"isOpening"in e&&r(4,g=e.isOpening),"filterForReady"in e&&r(5,w=e.filterForReady),"filter"in e&&r(6,y=e.filter),"query"in e&&r(7,v=e.query),"refStatus"in e&&r(8,$=e.refStatus),"praefix"in e&&r(9,I=e.praefix),"selectionFields"in e&&r(10,_=e.selectionFields),"showEdit"in e&&r(11,C=e.showEdit),"deList"in e&&r(12,E=e.deList),"newAllowed"in e&&r(13,A=e.newAllowed),"prevEventId"in e&&r(14,b=e.prevEventId),"inputSearch"in e&&r(15,S=e.inputSearch),"shouldBlock"in e&&r(16,T=e.shouldBlock)},[f,p,h,m,g,w,y,v,$,I,_,C,E,A,b,S,T,L,F,D,k,M,P,B,V,o,s,a,d,U,async e=>{if(!e)return!1;const n=await Np(h.class,h.id);if(x=_&&_?.find(e=>h.class===e.refClass.split(":")[0]),r(20,k=x?.value?.get&&x.value.get(I)),k){O=x.refClass;const[e,n]=O.split(":"),[i]=n.split(".");r(21,M=x.parentClass.find(t=>t.name===e));const o=await t.getSchemaByClass(M.refClass);r(22,P=o.id),r(17,L=x.parentClass.find(e=>e.name===i).designation)}return n},()=>{r(18,F=!1),p||l("back"),C||l("back")},()=>{r(24,V=!0),r(18,F=!1),l("back")},()=>{r(24,V=!0),r(1,p=!1),r(19,D=!1),r(18,F=!0)},e=>({detail:{row:e}})=>{let t=h.display;t&&t.length&&t.map(t=>{const[n,r]=t.split(".");let i=h.list?.find(e=>e.name===n)?.item.find(e=>e.name===r);if(i){e[`${n}_${r}`]=e[n][r]}}),l("choose",{row:e})},({detail:e})=>{r(19,D=!!e._task.visum||"Closed"===e._task.status),r(1,p=e._docId),r(18,F=!0)},({detail:e})=>{k&&r(23,B=e)},({detail:e})=>{if(!e.value)return;const t={_id:e.value};l("choose",{row:t})},function(t){te(e,t)}]}class In extends xe{constructor(e){var t;super(),document.getElementById("svelte-jb5mrh-style")||((t=M("style")).id="svelte-jb5mrh-style",t.textContent=".eList .flex button.btn{width:max-content !important}.dialog.eList{max-height:90vh}.form--buttons.svelte-jb5mrh{display:flex;gap:1em;padding:0.5em 0}",D(document.head,t)),De(this,e,$n,vn,S,{title:0,schema:2,record:3,recID:1,isOpening:4,filterForReady:5,filter:6,query:7,refStatus:8,praefix:9,selectionFields:10,showEdit:11,deList:12,newAllowed:13,prevEventId:14,inputSearch:15,shouldBlock:16},[-1,-1])}}const{document:_n}=Ee;function Cn(e){e[28]=e[30].list,e[29]=e[30].items}function En(e,t,n){const r=e.slice();return r[31]=t[n],r}function An(e,t,n){const r=e.slice();return r[34]=t[n],r}function bn(e,t,n){const r=e.slice();return r[34]=t[n],r}function Sn(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Nn(e){let t,n,r,i,o,s,a,l,c,d,u,f,h,m,p,g,w,y;function v(t){e[25](t)}Cn(e),n=new e[7]({props:{outline:!0,$$slots:{default:[Tn]},$$scope:{ctx:e}}}),n.$on("click",e[24]);let $={id:e[8]};void 0!==e[0]&&($.value=e[0]),s=new e[6]({props:$}),re.push(()=>Se(s,"value",v)),s.$on("input",e[12]),d=new ot({props:{size:"18"}});let I=e[29]?.length&&function(e){let t,n,r,i,o=e[29],s=[];for(let t=0;t<o.length;t+=1)s[t]=Rn(bn(e,o,t));return{c(){t=M("thead"),n=M("tr"),r=M("th"),i=L();for(let e=0;e<s.length;e+=1)s[e].c();z(r,"class","svelte-14hcfjl"),z(n,"class","svelte-14hcfjl"),z(t,"class","svelte-14hcfjl")},m(e,o){x(e,t,o),D(t,n),D(n,r),D(n,i);for(let e=0;e<s.length;e+=1)s[e].m(n,null)},p(e,t){if(2048&t[0]){let r;for(o=e[29],r=0;r<o.length;r+=1){const i=bn(e,o,r);s[r]?s[r].p(i,t):(s[r]=Rn(i),s[r].c(),s[r].m(n,null))}for(;r<s.length;r+=1)s[r].d(1);s.length=o.length}},d(e){e&&k(t),O(s,e)}}}(e),_=e[28]?.length&&function(e){let t,n,r=e[28],i=[];for(let t=0;t<r.length;t+=1)i[t]=kn(En(e,r,t));const o=e=>Ie(i[e],1,1,()=>{i[e]=null});return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=F()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);x(e,t,r),n=!0},p(e,n){if(44547&n[0]){let s;for(r=e[28],s=0;s<r.length;s+=1){const o=En(e,r,s);i[s]?(i[s].p(o,n),$e(i[s],1)):(i[s]=kn(o),i[s].c(),$e(i[s],1),i[s].m(t.parentNode,t))}for(ye(),s=r.length;s<i.length;s+=1)o(s);ve()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)$e(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)Ie(i[e]);n=!1},d(e){O(i,e),e&&k(t)}}}(e);return{c(){t=M("div"),Ne(n.$$.fragment),r=L(),i=M("div"),o=B("Suchen: "),Ne(s.$$.fragment),l=L(),c=M("span"),Ne(d.$$.fragment),u=L(),f=M("div"),h=M("table"),I&&I.c(),m=L(),p=M("tbody"),_&&_.c(),z(t,"class","form--buttons svelte-14hcfjl"),z(c,"class","feather pointer svelte-14hcfjl"),q(i,"margin-bottom","1em"),q(i,"position","relative"),z(h,"striped",""),z(h,"class","svelte-14hcfjl"),z(f,"class","eList svelte-14hcfjl")},m(a,v){x(a,t,v),Te(n,t,null),x(a,r,v),x(a,i,v),D(i,o),Te(s,i,null),D(i,l),D(i,c),Te(d,c,null),x(a,u,v),x(a,f,v),D(f,h),I&&I.m(h,null),D(h,m),D(h,p),_&&_.m(p,null),g=!0,w||(y=V(c,"click",e[14]),w=!0)},p(e,t){Cn(e);const r={};256&t[1]&&(r.$$scope={dirty:t,ctx:e}),n.$set(r);const i={};!a&&1&t[0]&&(a=!0,i.value=e[0],ue(()=>a=!1)),s.$set(i),e[29]?.length&&I.p(e,t),e[28]?.length&&_.p(e,t)},i(e){g||($e(n.$$.fragment,e),$e(s.$$.fragment,e),$e(d.$$.fragment,e),$e(_),g=!0)},o(e){Ie(n.$$.fragment,e),Ie(s.$$.fragment,e),Ie(d.$$.fragment,e),Ie(_),g=!1},d(e){e&&k(t),Re(n),e&&k(r),e&&k(i),Re(s),Re(d),e&&k(u),e&&k(f),I&&I.d(),_&&_.d(),w=!1,y()}}}function Tn(e){let t;return{c(){t=B("Abbrechen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Rn(e){let t,n,r=e[34]?.designation+"";return{c(){t=M("th"),n=B(r),z(t,"class","svelte-14hcfjl")},m(e,r){x(e,t,r),D(t,n)},p:_,d(e){e&&k(t)}}}function Dn(e){let t,n,r,i,o,s,a,l;r=new lt({props:{size:"18"}});let c=e[29],d=[];for(let t=0;t<c.length;t+=1)d[t]=xn(An(e,c,t));return{c(){t=M("tr"),n=M("td"),Ne(r.$$.fragment),i=L();for(let e=0;e<d.length;e+=1)d[e].c();o=L(),z(n,"class","editRow svelte-14hcfjl"),z(t,"class","pointer svelte-14hcfjl"),G(t,"active",e[31]._id===e[1])},m(c,u){x(c,t,u),D(t,n),Te(r,n,null),D(t,i);for(let e=0;e<d.length;e+=1)d[e].m(t,null);D(t,o),s=!0,a||(l=V(n,"click",e[15](e[31])),a=!0)},p(n,r){if(e=n,3584&r[0]){let n;for(c=e[29],n=0;n<c.length;n+=1){const i=An(e,c,n);d[n]?d[n].p(i,r):(d[n]=xn(i),d[n].c(),d[n].m(t,o))}for(;n<d.length;n+=1)d[n].d(1);d.length=c.length}2050&r[0]&&G(t,"active",e[31]._id===e[1])},i(e){s||($e(r.$$.fragment,e),s=!0)},o(e){Ie(r.$$.fragment,e),s=!1},d(e){e&&k(t),Re(r),O(d,e),a=!1,l()}}}function xn(e){let t,n,r,i,o=e[9](e[31],e[34])+"";return{c(){t=M("td"),n=B(o),z(t,"class","svelte-14hcfjl")},m(o,s){x(o,t,s),D(t,n),r||(i=V(t,"click",W(e[10](e[31]))),r=!0)},p(t,n){e=t},d(e){e&&k(t),r=!1,i()}}}function kn(e){let t,n,r=e[13](e[31],e[29],e[0]),i=r&&Dn(e);return{c(){i&&i.c(),t=F()},m(e,r){i&&i.m(e,r),x(e,t,r),n=!0},p(e,n){1&n[0]&&(r=e[13](e[31],e[29],e[0])),r?i?(i.p(e,n),1&n[0]&&$e(i,1)):(i=Dn(e),i.c(),$e(i,1),i.m(t.parentNode,t)):i&&(ye(),Ie(i,1,1,()=>{i=null}),ve())},i(e){n||($e(i),n=!0)},o(e){Ie(i),n=!1},d(e){i&&i.d(e),e&&k(t)}}}function On(e){let t,n;return t=new e[5]({}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p:_,i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Mn(e){let t,n,r,i;t=new e[4]({});let o={ctx:e,current:null,token:null,hasCatch:!1,pending:On,then:Nn,catch:Sn,value:30,blocks:[,,,]};return _e(e[11](),o),{c(){Ne(t.$$.fragment),n=L(),r=F(),o.block.c()},m(e,s){Te(t,e,s),x(e,n,s),x(e,r,s),o.block.m(e,o.anchor=s),o.mount=()=>r.parentNode,o.anchor=r,i=!0},p(t,n){Ce(o,e=t,n)},i(e){i||($e(t.$$.fragment,e),$e(o.block),i=!0)},o(e){Ie(t.$$.fragment,e);for(let e=0;e<3;e+=1){Ie(o.blocks[e])}i=!1},d(e){Re(t,e),e&&k(n),e&&k(r),o.block.d(e),o.token=null,o=null}}}function Pn(e){let t,n;return t=new e[3]({props:{title:"Auswahl",class:"eList",$$slots:{default:[Mn]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};3&n[0]|256&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Bn(e,n,i){const o=ee(),{Dialog:s,Divider:a,Loading:l,TextField:d,Button:u}=c;let{item:f}=n,{classId:h}=n,{className:p}=n,{rowId:g}=n,{viewName:y}=n,{viewValue:v}=n,{recordId:$}=n,{filter:I}=n,{multiValues:_}=n,{searchValue:C=""}=n,E=h+Math.floor(9e3*Math.random()+1e3).toString()+"search";const A=(e,t)=>{if(!t)return;const n=e[t.name];return"boolean"==typeof n?w(n):m(e[`_${t.name}`]||e[t.name]||"")},b=t.getSchemaByClass(p);Q(()=>{window.setTimeout(()=>{const e=document.querySelector("tr.active");e&&e.scrollIntoView({block:"end",behavior:"smooth"}),document.getElementById(E)?.focus()},200)}),r.subscribe(async e=>{if(!e)return;const t=await b;e.eventId===t.id&&kp(t.class,e.eventId)});return e.$$set=e=>{"item"in e&&i(16,f=e.item),"classId"in e&&i(17,h=e.classId),"className"in e&&i(18,p=e.className),"rowId"in e&&i(1,g=e.rowId),"viewName"in e&&i(19,y=e.viewName),"viewValue"in e&&i(20,v=e.viewValue),"recordId"in e&&i(21,$=e.recordId),"filter"in e&&i(22,I=e.filter),"multiValues"in e&&i(23,_=e.multiValues),"searchValue"in e&&i(0,C=e.searchValue)},[C,g,o,s,a,l,d,u,E,A,e=>()=>o("choose",{row:e}),async()=>{const e=await b;let n=[];if(f.lookup){let r,i,o;if("string"==typeof f.lookup){if(r="."+h+"#"+f.lookup,i=document.querySelector(r),o=i?.value||$,_.has(f.lookup)){const r=_.get(f.lookup)[0];n=r?await t.getSectionView(f.name,{[f.lookup]:r},!0):await Np(f.name,e.id)}else if(o&&24===o.toString().length){const e=await xp(f.lookup,o);if(e&&e[f.name]&&e[f.name].length){const r=e[f.name]?.map(e=>e[f.name]);r?.length&&(n=await t.getSectionView(f.name,{_id:{$in:r}},!0)),n?.length||(n=await t.getSectionView(f.refClass,{[f.lookup]:o},!0))}else n=await t.getSectionView(f.refClass,{[f.lookup]:o},!0)}}else{const{refItem:e,refList:s}=f.lookup,[a,l]=e.split(".");if(r="."+h+"#"+a,i=document.querySelector(r),o=i?.value||$,o){let e=await t.getDocById(a,o);if(e&&l&&(e=await t.getDocById(l,e[l])),e&&e[s]){const r=e[s].map(e=>e[f.name]);n=await t.getSectionView(f.name,{_id:{$in:r}},!0)}}}}else{const r="."+h+"#"+y.split(":")[0],i=document.querySelector(r);let o={[y]:i?.value||$};if(f.refItem){const e="."+h+"#"+f.refItem;try{const t=document.querySelector(e);if(t){const e={$or:[{[f.refItem]:t.value},{[f.refItem]:{$exists:!0,$eq:""}}]};o={...o,...e}}}catch{}}o[y]&&(n=await t.getSectionView(e.class,o,!0)),I&&(n=n.filter(e=>e._id!=I))}const r=e.display;return{list:n,items:await tn(r,e,n)}},({detail:{value:e}})=>{i(0,C=e)},(e,t,n)=>{if(!n)return!0;for(const r of t)if(A(e,r)?.toLowerCase()?.includes(n.toLowerCase()))return!0;return!1},()=>{i(0,C="")},e=>async()=>{const n=await t.getTaskByDocId(e._id,!0),r=`/task/${n.event}/${n._id}/task?view=standalone`;window.open(r)},f,h,p,y,v,$,I,_,()=>o("back"),function(e){C=e,i(0,C)}]}class Ln extends xe{constructor(e){var t;super(),_n.getElementById("svelte-14hcfjl-style")||((t=M("style")).id="svelte-14hcfjl-style",t.textContent=".feather.svelte-14hcfjl.svelte-14hcfjl{position:absolute;top:2em;right:0.5em;color:#326173}.eList.svelte-14hcfjl.svelte-14hcfjl{height:fit-content;max-height:65vh;overflow-y:scroll;overflow-x:auto}.eList.svelte-14hcfjl .editRow.svelte-14hcfjl{width:1em}.eList.svelte-14hcfjl table.svelte-14hcfjl{min-width:30vw;position:relative;width:max-content !important;max-width:50vh !important}.eList.svelte-14hcfjl table thead.svelte-14hcfjl{position:sticky;top:0;background:#326173;color:white}.eList.svelte-14hcfjl table tbody tr.svelte-14hcfjl{height:2.3em}th.svelte-14hcfjl.svelte-14hcfjl,td.svelte-14hcfjl.svelte-14hcfjl{padding-left:0.4em;padding-right:0.4em}tr.pointer.svelte-14hcfjl.svelte-14hcfjl:hover{background-color:#DAE1E5}tr.active.svelte-14hcfjl.svelte-14hcfjl{color:#326173;background-color:#fcebd5}.form--buttons.svelte-14hcfjl.svelte-14hcfjl{display:flex;gap:1em;padding:0.5em 0}",D(_n.head,t)),De(this,e,Bn,Pn,S,{item:16,classId:17,className:18,rowId:1,viewName:19,viewValue:20,recordId:21,filter:22,multiValues:23,searchValue:0},[-1,-1])}}const{document:Fn}=Ee;function Vn(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Un(e){let t,n,r=e[83]&&function(e){let t,n,r,i,o,a,l,c,d,u,f,h,m,p,g,w,y,v,$,I;function _(t){e[63](t)}function C(t){e[64](t)}let E={class:"full-width",id:e[34],name:e[34],rows:"1",required:e[2],disabled:e[3]||e[36],placeholder:e[36]?"":e[37],style:"height:2.8em; padding-left:2em;padding-right:2em;overflow-y:hidden; resize:none;"};void 0!==e[1]&&(E.value=e[1]);void 0!==e[27]&&(E.overwrite=e[27]);n=new s({props:E}),re.push(()=>Se(n,"value",_)),re.push(()=>Se(n,"overwrite",C)),n.$on("click",e[40]()),n.$on("blur",e[49]);const A=[Hn,zn,Wn],b=[];function S(e,t){return e[36]?0:!e[3]||e[16]?1:e[22]&&e[0]?2:-1}~(a=S(e))&&(l=b[a]=A[a](e));let N=(!e[3]||e[16])&&e[0]&&!e[17]&&!e[36]&&Xn(e);function R(t){e[65](t)}let O={class:"tModal",noClickaway:!0,$$slots:{default:[Qn]},$$scope:{ctx:e}};void 0!==e[19]&&(O.open=e[19]);m=new e[30]({props:O}),re.push(()=>Se(m,"open",R));let P=e[20]&&Jn(e),B=e[24]&&nr(e);return{c(){t=M("div"),Ne(n.$$.fragment),o=L(),l&&l.c(),c=L(),d=M("input"),f=L(),N&&N.c(),h=L(),Ne(m.$$.fragment),g=L(),P&&P.c(),w=L(),B&&B.c(),y=F(),z(d,"class",u=T(e[9]||e[10])+" svelte-10ggg6v"),z(d,"id",e[5]),z(d,"name",e[5]),d.value=e[0],d.hidden=!0,q(t,"position","relative")},m(r,i){x(r,t,i),Te(n,t,null),D(t,o),~a&&b[a].m(t,null),D(t,c),D(t,d),D(t,f),N&&N.m(t,null),x(r,h,i),Te(m,r,i),x(r,g,i),P&&P.m(r,i),x(r,w,i),B&&B.m(r,i),x(r,y,i),v=!0,$||(I=V(t,"keydown",e[41]),$=!0)},p(e,o){const s={};4&o[0]&&(s.required=e[2]),8&o[0]&&(s.disabled=e[3]||e[36]),!r&&2&o[0]&&(r=!0,s.value=e[1],ue(()=>r=!1)),!i&&134217728&o[0]&&(i=!0,s.overwrite=e[27],ue(()=>i=!1)),n.$set(s);let f=a;a=S(e),a===f?~a&&b[a].p(e,o):(l&&(ye(),Ie(b[f],1,1,()=>{b[f]=null}),ve()),~a?(l=b[a],l?l.p(e,o):(l=b[a]=A[a](e),l.c()),$e(l,1),l.m(t,c)):l=null),(!v||1536&o[0]&&u!==(u=T(e[9]||e[10])+" svelte-10ggg6v"))&&z(d,"class",u),(!v||32&o[0])&&z(d,"id",e[5]),(!v||32&o[0])&&z(d,"name",e[5]),(!v||1&o[0]&&d.value!==e[0])&&(d.value=e[0]),e[3]&&!e[16]||!e[0]||e[17]||e[36]?N&&(ye(),Ie(N,1,1,()=>{N=null}),ve()):N?(N.p(e,o),196617&o[0]&&$e(N,1)):(N=Xn(e),N.c(),$e(N,1),N.m(t,null));const h={};344784337&o[0]|4194304&o[2]&&(h.$$scope={dirty:o,ctx:e}),!p&&524288&o[0]&&(p=!0,h.open=e[19],ue(()=>p=!1)),m.$set(h),e[20]?P?(P.p(e,o),1048576&o[0]&&$e(P,1)):(P=Jn(e),P.c(),$e(P,1),P.m(w.parentNode,w)):P&&(ye(),Ie(P,1,1,()=>{P=null}),ve()),e[24]?B?(B.p(e,o),16777216&o[0]&&$e(B,1)):(B=nr(e),B.c(),$e(B,1),B.m(y.parentNode,y)):B&&(ye(),Ie(B,1,1,()=>{B=null}),ve())},i(e){v||($e(n.$$.fragment,e),$e(l),$e(N),$e(m.$$.fragment,e),$e(P),$e(B),v=!0)},o(e){Ie(n.$$.fragment,e),Ie(l),Ie(N),Ie(m.$$.fragment,e),Ie(P),Ie(B),v=!1},d(e){e&&k(t),Re(n),~a&&b[a].d(),N&&N.d(),e&&k(h),Re(m,e),e&&k(g),P&&P.d(e),e&&k(w),B&&B.d(e),e&&k(y),$=!1,I()}}}(e);return{c(){r&&r.c(),t=F()},m(e,i){r&&r.m(e,i),x(e,t,i),n=!0},p(e,t){e[83]&&r.p(e,t)},i(e){n||($e(r),n=!0)},o(e){Ie(r),n=!1},d(e){r&&r.d(e),e&&k(t)}}}function Wn(e){let t,n,r,i,o;return n=new lt({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather pointer svelte-10ggg6v")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[48]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function zn(e){let t,n,r,i,o;return n=new Mt({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather pointer svelte-10ggg6v")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=[V(t,"click",e[40](!0)),V(t,"choose",e[44])],i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,A(o)}}}function Hn(e){let t,n,r,i;const o=[Gn,qn,jn],s=[];function a(e,t){return e[0]?0:!e[3]&&e[12]?1:2}return t=a(e),n=s[t]=o[t](e),{c(){n.c(),r=F()},m(e,n){s[t].m(e,n),x(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?s[t].p(e,i):(ye(),Ie(s[l],1,1,()=>{s[l]=null}),ve(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),$e(n,1),n.m(r.parentNode,r))},i(e){i||($e(n),i=!0)},o(e){Ie(n),i=!1},d(e){s[t].d(e),e&&k(r)}}}function jn(e){let t,n,r;return n=new Tt({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather3 svelte-10ggg6v")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function qn(e){let t,n,r,i,o;return n=new Tt({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather pointer svelte-10ggg6v")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[50]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function Gn(e){let t,n,r,i,o;return n=new lt({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather pointer svelte-10ggg6v")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[48]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function Xn(e){let t,n,r,i,o;return n=new ot({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather2 pointer svelte-10ggg6v")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[47]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function Yn(e){let t,n,r,i;const o=[Kn,Zn],s=[];function a(e,t){return e[6].lookup||e[4]&&!e[6].constraint?0:1}return t=a(e),n=s[t]=o[t](e),{c(){n.c(),r=F()},m(e,n){s[t].m(e,n),x(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?s[t].p(e,i):(ye(),Ie(s[l],1,1,()=>{s[l]=null}),ve(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),$e(n,1),n.m(r.parentNode,r))},i(e){i||($e(n),i=!0)},o(e){Ie(n),i=!1},d(e){s[t].d(e),e&&k(r)}}}function Zn(e){let t,n;return t=new In({props:{title:e[6].designation,newAllowed:e[23],prevEventId:e[11],schema:e[18],filter:e[35],query:e[38](),record:e[7],recID:e[0],isOpening:e[19],filterForReady:e[26],refStatus:e[6].refStatus,selectionFields:e[14],deList:e[15],praefix:e[13],shouldBlock:e[28],inputSearch:e[42]()}}),t.$on("choose",e[44]),t.$on("back",e[45]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};64&n[0]&&(r.title=e[6].designation),8388608&n[0]&&(r.newAllowed=e[23]),2048&n[0]&&(r.prevEventId=e[11]),262144&n[0]&&(r.schema=e[18]),128&n[0]&&(r.record=e[7]),1&n[0]&&(r.recID=e[0]),524288&n[0]&&(r.isOpening=e[19]),67108864&n[0]&&(r.filterForReady=e[26]),64&n[0]&&(r.refStatus=e[6].refStatus),16384&n[0]&&(r.selectionFields=e[14]),32768&n[0]&&(r.deList=e[15]),8192&n[0]&&(r.praefix=e[13]),268435456&n[0]&&(r.shouldBlock=e[28]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Kn(e){let t,n;return t=new Ln({props:{item:e[6],className:e[18].class,classId:e[10],rowId:e[0],recordId:e[12],viewName:e[4],viewValue:"",multiValues:e[8],searchValue:e[42]()}}),t.$on("choose",e[44]),t.$on("back",e[45]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};64&n[0]&&(r.item=e[6]),262144&n[0]&&(r.className=e[18].class),1024&n[0]&&(r.classId=e[10]),1&n[0]&&(r.rowId=e[0]),4096&n[0]&&(r.recordId=e[12]),16&n[0]&&(r.viewName=e[4]),256&n[0]&&(r.multiValues=e[8]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Qn(e){let t,n,r=e[19]&&Yn(e);return{c(){r&&r.c(),t=F()},m(e,i){r&&r.m(e,i),x(e,t,i),n=!0},p(e,n){e[19]?r?(r.p(e,n),524288&n[0]&&$e(r,1)):(r=Yn(e),r.c(),$e(r,1),r.m(t.parentNode,t)):r&&(ye(),Ie(r,1,1,()=>{r=null}),ve())},i(e){n||($e(r),n=!0)},o(e){Ie(r),n=!1},d(e){r&&r.d(e),e&&k(t)}}}function Jn(e){let t,n,r;function i(t){e[66](t)}let o={class:"tModal",noClickaway:!0,$$slots:{default:[tr]},$$scope:{ctx:e}};return void 0!==e[20]&&(o.open=e[20]),t=new e[30]({props:o}),re.push(()=>Se(t,"open",i)),{c(){Ne(t.$$.fragment)},m(e,n){Te(t,e,n),r=!0},p(e,r){const i={};2359297&r[0]|4194304&r[2]&&(i.$$scope={dirty:r,ctx:e}),!n&&1048576&r[0]&&(n=!0,i.open=e[20],ue(()=>n=!1)),t.$set(i)},i(e){r||($e(t.$$.fragment,e),r=!0)},o(e){Ie(t.$$.fragment,e),r=!1},d(e){Re(t,e)}}}function er(e){let t,n;return t=new Fp({props:{schema:e[18],recID:e[0],readonly:!0}}),t.$on("back",e[45]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};262144&n[0]&&(r.schema=e[18]),1&n[0]&&(r.recID=e[0]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function tr(e){let t,n;return t=new e[29]({props:{title:e[21],$$slots:{default:[er]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};2097152&n[0]&&(r.title=e[21]),262145&n[0]|4194304&n[2]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function nr(e){let t,n,r;function i(t){e[67](t)}let o={class:"tModal2",noClickaway:!0,$$slots:{default:[ir]},$$scope:{ctx:e}};return void 0!==e[24]&&(o.open=e[24]),t=new e[30]({props:o}),re.push(()=>Se(t,"open",i)),{c(){Ne(t.$$.fragment)},m(e,n){Te(t,e,n),r=!0},p(e,r){const i={};35913728&r[0]|4194304&r[2]&&(i.$$scope={dirty:r,ctx:e}),!n&&16777216&r[0]&&(n=!0,i.open=e[24],ue(()=>n=!1)),t.$set(i)},i(e){r||($e(t.$$.fragment,e),r=!0)},o(e){Ie(t.$$.fragment,e),r=!1},d(e){Re(t,e)}}}function rr(e){let t,n;return t=new Fp({props:{schema:e[18],dialogAttr:e[25]}}),t.$on("back",e[46]),t.$on("choose",e[43]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};262144&n[0]&&(r.schema=e[18]),33554432&n[0]&&(r.dialogAttr=e[25]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function ir(e){let t,n;return t=new e[29]({props:{title:e[21],$$slots:{default:[rr]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};2097152&n[0]&&(r.title=e[21]),33816576&n[0]|4194304&n[2]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function or(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function sr(e){let t,n,r={ctx:e,current:null,token:null,hasCatch:!1,pending:or,then:Un,catch:Vn,value:83,blocks:[,,,]};return _e(e[39](),r),{c(){t=F(),r.block.c()},m(e,i){x(e,t,i),r.block.m(e,r.anchor=i),r.mount=()=>t.parentNode,r.anchor=t,n=!0},p(t,n){Ce(r,e=t,n)},i(e){n||($e(r.block),n=!0)},o(e){for(let e=0;e<3;e+=1){Ie(r.blocks[e])}n=!1},d(e){e&&k(t),r.block.d(e),r.token=null,r=null}}}function ar(e,n,r){let s,a,l,d,f;N(e,i,e=>r(62,s=e)),N(e,o,e=>r(73,f=e));const h=ee(),{Dialog:m,Modal:p}=c,{currentTasks:g,environment:w,loggedIn:v}=u;N(e,g,e=>r(70,a=e)),N(e,w,e=>r(72,d=e)),N(e,v,e=>r(71,l=e));let{id:$}=n,{item:I}=n,{record:_}=n,{fullRecord:C}=n,{value:E=""}=n,{multiValues:A}=n,{desc:b=""}=n,{noForm:S=!1}=n,{classId:T}=n,{eventId:R}=n,{recordId:D}=n,{withRefValue:x=!1}=n,{refValue:k=""}=n,{shortEdit:O}=n,{required:M}=n,{disabled:P}=n,{readonly:B}=n,{praefix:L}=n,{selectionFields:F}=n,{formnovalidate:V}=n,{selection:U}=n,{deList:W}=n,{isTemplate:z}=n,{noList:H=!1}=n,{multi:j=!1}=n,{initFinished:q}=n,{listName:G=""}=n;const X="comment_"+$,Y=I.filter,Z=I.properties?.startDialog;let K,Q,J,te,ne,re,ie,oe,se=!1,ae=!0,le=!1,ce=!0,de=!0,ue=!1,fe="";!U&&I.selection&&1===I.selection.split(":").length&&(U=I.selection);const he=B||P||I.lookup||U&&!I.constraint?"":"Suchbegriff ⏎",me=(e,t)=>{try{return e.split(".").reduce((e,t)=>e[t],t)}catch(e){return""}},pe=()=>{I.refItem&&I.refItem.startsWith("owner")&&(r(52,k=d.owner[I.refClass]),k||r(52,k=me(I.refItem,d)),k&&(r(51,x=!0),h("change",{value:k})))},ge=async e=>{e.items.filter(e=>e.properties?.default).forEach(t=>{h("defPrep",{className:e.class,itemName:t.name,value:t.properties.default})})},we=async e=>{const n=()=>{r(19,se=!0)};if(9==e.which)return;if(E)return e.preventDefault();if(13!=e.which)return;if(e.preventDefault(),I.lookup)return n();const i=te.items.find(e=>e.properties?.search);if(!i)return n();const o=e.srcElement.value,{name:s,checkOn:a,refClass:l,properties:c}=i;let{search:d}=c;!0===d&&(d={}),"number"==typeof d&&(d={min:d});const{min:u=3,start:f=!1,end:h=!1}=d;if(o.length<u)return n();const m=(f?"^":"")+o+(h?"$":"");let p={[s]:{$regex:m,$options:"i"}};a&&(p=[{$lookup:{from:l,localField:s,foreignField:"_id",as:l}},{$match:{[l+"."+a]:{$regex:m,$options:"i"}}}]);const g=await t.getSectionView(te.class,p);1!==g?.length?n():r(0,E=g[0]._id)},ye=e=>{e&&(r(61,fe=r(1,b=y(te,e))),h("setRefDesc",b.split(" •")[0]),h("change",{value:E,description:b}),h("task",{row:e,eventId:te.id}))},ve=()=>{r(19,se=!1),r(20,Q=!1)},$e=()=>{r(24,le=!1)};return e.$$set=e=>{"id"in e&&r(5,$=e.id),"item"in e&&r(6,I=e.item),"record"in e&&r(55,_=e.record),"fullRecord"in e&&r(7,C=e.fullRecord),"value"in e&&r(0,E=e.value),"multiValues"in e&&r(8,A=e.multiValues),"desc"in e&&r(1,b=e.desc),"noForm"in e&&r(9,S=e.noForm),"classId"in e&&r(10,T=e.classId),"eventId"in e&&r(11,R=e.eventId),"recordId"in e&&r(12,D=e.recordId),"withRefValue"in e&&r(51,x=e.withRefValue),"refValue"in e&&r(52,k=e.refValue),"shortEdit"in e&&r(56,O=e.shortEdit),"required"in e&&r(2,M=e.required),"disabled"in e&&r(3,P=e.disabled),"readonly"in e&&r(53,B=e.readonly),"praefix"in e&&r(13,L=e.praefix),"selectionFields"in e&&r(14,F=e.selectionFields),"formnovalidate"in e&&r(57,V=e.formnovalidate),"selection"in e&&r(4,U=e.selection),"deList"in e&&r(15,W=e.deList),"isTemplate"in e&&r(16,z=e.isTemplate),"noList"in e&&r(58,H=e.noList),"multi"in e&&r(17,j=e.multi),"initFinished"in e&&r(54,q=e.initFinished),"listName"in e&&r(59,G=e.listName)},e.$$.update=()=>{if(4&e.$$.dirty[0]|67108864&e.$$.dirty[1]&&r(2,M="boolean"==typeof M&&(M&&!V)),4160&e.$$.dirty[0]|4194304&e.$$.dirty[1]&&r(53,B||=D&&I.asInput),8&e.$$.dirty[0]|4194304&e.$$.dirty[1]&&r(3,P||=B),3145728&e.$$.dirty[1]&&x&&r(0,E=k),3&e.$$.dirty[0]|1073741824&e.$$.dirty[1]&&!b&&E&&fe&&r(1,b=fe),399425&e.$$.dirty[0]|411041792&e.$$.dirty[1]&&E&&te){let e=!1;if(!Array.isArray(E)){if(D||I.asInput||I.upate||!1!==I.refItem||!0===j||!1===I.refItem&&q){const t="p$"+G+"$"+I.refClass+"$"+R,n=Sp(t);n?.then?n.then(e=>{const t=e.find(({_id:e})=>e===E);t?ye(t):Tp(I.refClass,te.id,E,!!I.lookup||H).then(ye)}):e=!0}e&&Tp(I.refClass,te.id,E,!!I.lookup||H).then(ye),r(54,q=!0)}}if(65&e.$$.dirty[0]|536870912&e.$$.dirty[1]|1&e.$$.dirty[2]&&E&&ne&&I.name===ne.input?.at(0)&&ne.inputLookup?.length){const{domain:e}=ne.inputLookup[0]||{};"user"===e&&(s.some(e=>ne.authorization?.find(t=>t.role===e&&!t.constraint))||r(3,P=!0))}262145&e.$$.dirty[0]&&!E&&te&&ye({})},[E,b,M,P,U,$,I,C,A,S,T,R,D,L,F,W,z,j,te,se,Q,J,re,ae,le,ie,ce,de,ue,m,p,g,w,v,X,Y,Z,he,()=>{if(!I.query)return;const[e,t]=I.query.split(".");let n;return n=C[t]?[{$lookup:{from:e,localField:e,foreignField:"_id",as:"__"+e}},{$unwind:{path:"$__"+e,preserveNullAndEmptyArrays:!0}},{$match:{["__"+e+"."+t]:C[t]}}]:[{$match:{[e]:C[e]}}],I.refStatus&&(n=n.concat([{$addFields:{_docId:{$toString:"$_id"}}},{$lookup:{from:"_task",localField:"_docId",foreignField:"docId",as:"_task"}},{$unwind:{path:"$_task",preserveNullAndEmptyArrays:!0}},{$match:{"_task.status":I.refStatus}}])),n},async()=>{try{if(K=await t.getEvent(R),oe="report"===K.output.type,r(26,ce=!I.asInput),r(23,ae=K.output?.class[0].name!==I.refClass),r(18,te=await t.getSchemaByClass(I.refClass)),te?.blocked)return h("initFail",!0),!1;if(oe||r(28,ue=((e,t)=>{let n=t.items.find(e=>!!e.properties?.blocking);if(!n)return!1;if(e.input?.class?.find(e=>e.name===t.class))return n.name;const r=e.output?.class.at(0)?.list||[];for(const e of r){const t=e.item.find(e=>e.name===I.name);if(t?.properties?.blocking)return n.name}return!1})(K,te)),r(22,re=(e=>!a?.length||!!a.find(t=>t===e))(te.id)),r(60,ne=await t.getSchema(R)),R&&D&&E&&!P&&ne.input?.find(e=>e===I.refClass)&&r(3,P=!0),K.input?.class&&K.input.class[0]&&(K.input.class[0].name===I.refClass&&K.input.class[0].readonly&&r(3,P=!0),D&&K.input.class[0].name===I.refClass&&K.input.class[0].writeState)){(await t.getTaskByDocId(D,!0)).status===K.input.class[0].writeState&&r(3,P=r(53,B=!1))}if(I.properties?.query?.lookup){const{domain:e,value:n}=I.properties.query.lookup;if("user"===e){const e=l.user,i={[n]:e},o=await t.getSectionView(I.refClass,i);if(o?.length){const[{_id:e}]=o;e&&(r(52,k=e),r(51,x=!0),h("change",{value:k}))}s.some(e=>te.authorization?.find(t=>t.role===e&&!t.constraint))||r(3,P=!0)}}else pe();if(!P&&!k&&I.filter&&(""===L||void 0===L)){const e=I.filter,n=!0;e.startsWith("!")&&(n=!1,e=e.slice(1));const i=await t.getOneAndOnly(I.refClass,{[I.filter]:n});i&&(r(52,k=i._id),r(51,x=!0),h("change",{value:k}))}return r(21,J=te.identity.designation),E||ge(te),!0}catch{return h("initFail",!0),!1}},e=>t=>{if(t.stopPropagation(),!Z){if(!0===e&&r(19,se=!0),e&&"BUTTON"===t.explicitOriginalTarget?.nodeName){const t=document.getElementById(e);return t?.blur()}(I.lookup||U&&!I.constraint||E)&&r(19,se=!0)}},we,()=>{if(E)return"";r(1,b="");const e="#"+T+(G?" ."+T+G:"")+" #"+X,t=document.querySelectorAll(e)[0];return t?.value?t.value:""},async({detail:e})=>{if(e.className=te.class,r(0,E=e.row._id),""===L||void 0===L?h("saveDialog",{itemName:I.name,value:E,closeTask:I.properties?.closeTask}):h("listChange",e),I.properties?.closeTask&&K.output?.approval){const e=await t.getTaskByDocId(_._id),n=K.output.approval.flatMap(({refRole:e})=>e),r={eventId:R,eventDesignation:K.identity.designation,docId:_._id,role:n.filter(e=>s.find(t=>t===e)).join(", "),user:f.email,timeStamp:(new Date).toISOString()};await t.setTaskVisum(e._id,r)}$e()},({detail:e})=>{r(0,E=e.row._id),ve()},ve,$e,()=>{(oe||re)&&(j?h("change",{value:E,delete:!0}):(r(0,E=""),r(1,b=""),r(27,de=!0),h("change",{value:E,description:b}),h("task",{row:{_task:{event:te.id},_id:!1},eventId:te.id})))},async()=>{if(!E)return;let e=await Tp(I.refClass,te.id,E);e._task||(e={_task:await t.getTaskByDocId(E,!0)});const n=e._task.task_id||e._task._id,r=`/task/${e._task.event}/${n}/task?view=standalone`;window.open(r)},e=>{E||b&&we({which:13,preventDefault:()=>{},srcElement:{value:b}})},async e=>{r(25,ie={});for(const e in Z){let n=Z[e],i="";if(n.startsWith("owner"))i=me(n,d);else if(n.startsWith("+")){const[e,r]=n.slice(1).split(".");n=e;const o=await t.getSchemaByClass(n),s=_[n];let a=await Np("",o.id);if(a?.length){a=a.sort((e,t)=>e[r]>t[r]?1:e[r]<t[r]?-1:0);const e=a.findIndex(e=>e._id===s);i=a[+e+1]._id||""}}else if(n.includes("|"))for(const e of n.split("|"))i||(i=_[e]);else i=_[n]||C&&C[n];r(25,ie[e]=i,ie)}r(24,le=!0)},x,k,B,q,_,O,V,H,G,ne,fe,s,function(e){b=e,r(1,b),r(0,E),r(61,fe),r(51,x),r(52,k)},function(e){de=e,r(27,de)},function(e){se=e,r(19,se)},function(e){Q=e,r(20,Q)},function(e){le=e,r(24,le)}]}class lr extends xe{constructor(e){var t;super(),Fn.getElementById("svelte-10ggg6v-style")||((t=M("style")).id="svelte-10ggg6v-style",t.textContent=".feather.svelte-10ggg6v{position:absolute;top:0.75em;left:0.5em;color:#4300b0}.feather2.svelte-10ggg6v{position:absolute;top:0.75em;right:0.5em;color:#4300b0}.feather3.svelte-10ggg6v{position:absolute;top:0.75em;left:0.5em;color:gray}.text-field textarea:invalid{border-bottom:1px #b80000 solid !important;background-color:#fbeeee !important}.modal-overlay.tModal2 > .dialog{margin-top:0 !important}",D(Fn.head,t)),De(this,e,ar,sr,S,{id:5,item:6,record:55,fullRecord:7,value:0,multiValues:8,desc:1,noForm:9,classId:10,eventId:11,recordId:12,withRefValue:51,refValue:52,shortEdit:56,required:2,disabled:3,readonly:53,praefix:13,selectionFields:14,formnovalidate:57,selection:4,deList:15,isTemplate:16,noList:58,multi:17,initFinished:54,listName:59},[-1,-1,-1])}}const{document:cr}=Ee;function dr(e){e[45]=e[46].items}function ur(e,t,n){const r=e.slice();return r[47]=t[n],r[49]=n,r}function fr(e,t,n){const r=e.slice();return r[50]=t[n],r[52]=n,r}function hr(e,t,n){const r=e.slice();return r[50]=t[n],r}function mr(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function pr(e){let t,n,r,i;dr(e);const o=[wr,gr],s=[];function a(e,t){return e[6]?1:0}return t=a(e),n=s[t]=o[t](e),{c(){n.c(),r=F()},m(e,n){s[t].m(e,n),x(e,r,n),i=!0},p(e,i){dr(e);let l=t;t=a(e),t===l?s[t].p(e,i):(ye(),Ie(s[l],1,1,()=>{s[l]=null}),ve(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),$e(n,1),n.m(r.parentNode,r))},i(e){i||($e(n),i=!0)},o(e){Ie(n),i=!1},d(e){s[t].d(e),e&&k(r)}}}function gr(e){let t,n;return t=new Fp({props:{schema:e[4],recID:e[7]}}),t.$on("choose",e[24]),t.$on("back",e[25]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};16&n[0]&&(r.schema=e[4]),128&n[0]&&(r.recID=e[7]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function wr(e){let t,n,r,i,o,s,a,l,c,d,u,f,h,m,p,g,w,y,v,$,I,_;n=new e[12]({props:{outline:!0,$$slots:{default:[yr]},$$scope:{ctx:e}}}),n.$on("click",e[33]);let C=e[1]&&vr(e);o=new e[12]({props:{disabled:!e[5].length,filled:!0,$$slots:{default:[Ir]},$$scope:{ctx:e}}}),o.$on("click",e[17]);let E=e[14]&&function(e){let t,n;return t=new e[9]({}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}(e);function A(t){e[34](t)}let b={id:e[13]};void 0!==e[3]&&(b.value=e[3]),d=new e[10]({props:b}),re.push(()=>Se(d,"value",A)),d.$on("input",e[19]),m=new ot({props:{size:"18"}});let S=e[45]?.length&&_r(e),N=e[5]?.length&&Er(e);return{c(){t=M("div"),Ne(n.$$.fragment),r=L(),C&&C.c(),i=L(),Ne(o.$$.fragment),s=L(),E&&E.c(),a=L(),l=M("div"),c=B("Suchen: "),Ne(d.$$.fragment),f=L(),h=M("span"),Ne(m.$$.fragment),p=L(),g=M("div"),w=M("table"),S&&S.c(),y=L(),v=M("tbody"),N&&N.c(),z(t,"class","form--buttons svelte-4visk8"),z(h,"class","feather pointer svelte-4visk8"),q(l,"margin-bottom","1em"),q(l,"position","relative"),z(w,"striped",""),z(w,"class","svelte-4visk8"),z(g,"class","eList svelte-4visk8")},m(u,A){x(u,t,A),Te(n,t,null),D(t,r),C&&C.m(t,null),D(t,i),Te(o,t,null),x(u,s,A),E&&E.m(u,A),x(u,a,A),x(u,l,A),D(l,c),Te(d,l,null),D(l,f),D(l,h),Te(m,h,null),x(u,p,A),x(u,g,A),D(g,w),S&&S.m(w,null),D(w,y),D(w,v),N&&N.m(v,null),$=!0,I||(_=V(h,"click",e[21]),I=!0)},p(e,r){const s={};16777216&r[1]&&(s.$$scope={dirty:r,ctx:e}),n.$set(s),e[1]?C?(C.p(e,r),2&r[0]&&$e(C,1)):(C=vr(e),C.c(),$e(C,1),C.m(t,i)):C&&(ye(),Ie(C,1,1,()=>{C=null}),ve());const a={};32&r[0]&&(a.disabled=!e[5].length),16777216&r[1]&&(a.$$scope={dirty:r,ctx:e}),o.$set(a);const l={};!u&&8&r[0]&&(u=!0,l.value=e[3],ue(()=>u=!1)),d.$set(l),e[45]?.length?S?(S.p(e,r),4&r[0]&&$e(S,1)):(S=_r(e),S.c(),$e(S,1),S.m(w,y)):S&&(ye(),Ie(S,1,1,()=>{S=null}),ve()),e[5]?.length?N?(N.p(e,r),32&r[0]&&$e(N,1)):(N=Er(e),N.c(),$e(N,1),N.m(v,null)):N&&(ye(),Ie(N,1,1,()=>{N=null}),ve())},i(e){$||($e(n.$$.fragment,e),$e(C),$e(o.$$.fragment,e),$e(E),$e(d.$$.fragment,e),$e(m.$$.fragment,e),$e(S),$e(N),$=!0)},o(e){Ie(n.$$.fragment,e),Ie(C),Ie(o.$$.fragment,e),Ie(E),Ie(d.$$.fragment,e),Ie(m.$$.fragment,e),Ie(S),Ie(N),$=!1},d(e){e&&k(t),Re(n),C&&C.d(),Re(o),e&&k(s),E&&E.d(e),e&&k(a),e&&k(l),Re(d),Re(m),e&&k(p),e&&k(g),S&&S.d(),N&&N.d(),I=!1,_()}}}function yr(e){let t;return{c(){t=B("Abbrechen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function vr(e){let t,n;return t=new e[12]({props:{filled:!0,$$slots:{default:[$r]},$$scope:{ctx:e}}}),t.$on("click",e[23]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};16777216&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function $r(e){let t;return{c(){t=B("Neu")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Ir(e){let t;return{c(){t=B("Bestätigen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function _r(e){let t,n,r,i,o,s,a,l;i=new Ze({props:{size:"20",style:"color: #326173;"}});let c=e[45],d=[];for(let t=0;t<c.length;t+=1)d[t]=Cr(hr(e,c,t));return{c(){t=M("thead"),n=M("tr"),r=M("th"),Ne(i.$$.fragment),o=L();for(let e=0;e<d.length;e+=1)d[e].c();z(r,"class","svelte-4visk8"),z(n,"class","svelte-4visk8"),z(t,"class","svelte-4visk8")},m(c,u){x(c,t,u),D(t,n),D(n,r),Te(i,r,null),D(n,o);for(let e=0;e<d.length;e+=1)d[e].m(n,null);s=!0,a||(l=V(r,"click",function(){b(e[22](e[5]))&&e[22](e[5]).apply(this,arguments)}),a=!0)},p(t,r){if(e=t,262148&r[0]){let t;for(c=e[45],t=0;t<c.length;t+=1){const i=hr(e,c,t);d[t]?d[t].p(i,r):(d[t]=Cr(i),d[t].c(),d[t].m(n,null))}for(;t<d.length;t+=1)d[t].d(1);d.length=c.length}},i(e){s||($e(i.$$.fragment,e),s=!0)},o(e){Ie(i.$$.fragment,e),s=!1},d(e){e&&k(t),Re(i),O(d,e),a=!1,l()}}}function Cr(e){let t,n,r=e[50]?.designation+"";return{c(){t=M("th"),n=B(r),z(t,"class","svelte-4visk8")},m(e,r){x(e,t,r),D(t,n)},p(e,t){4&t[0]&&r!==(r=e[50]?.designation+"")&&H(n,r)},d(e){e&&k(t)}}}function Er(e){let t,n,r=[],i=new Map,o=e[5];const s=e=>e[47]._id;for(let t=0;t<o.length;t+=1){let n=ur(e,o,t),a=s(n);i.set(a,r[t]=Nr(a,n))}return{c(){for(let e=0;e<r.length;e+=1)r[e].c();t=F()},m(e,i){for(let t=0;t<r.length;t+=1)r[t].m(e,i);x(e,t,i),n=!0},p(e,n){1409069&n[0]&&(o=e[5],ye(),r=be(r,n,s,1,e,o,i,t.parentNode,Ae,Nr,t,ur),ve())},i(e){if(!n){for(let e=0;e<o.length;e+=1)$e(r[e]);n=!0}},o(e){for(let e=0;e<r.length;e+=1)Ie(r[e]);n=!1},d(e){for(let t=0;t<r.length;t+=1)r[t].d(e);e&&k(t)}}}function Ar(e){let t,n,r,i,o=e[0],s=br(e),a=e[45],l=[];for(let t=0;t<a.length;t+=1)l[t]=Sr(fr(e,a,t));return{c(){t=M("tr"),s.c(),n=L();for(let e=0;e<l.length;e+=1)l[e].c();r=L(),z(t,"class","svelte-4visk8"),G(t,"active",e[0].includes(e[47]._id))},m(e,o){x(e,t,o),s.m(t,null),D(t,n);for(let e=0;e<l.length;e+=1)l[e].m(t,null);D(t,r),i=!0},p(e,i){if(1&i[0]&&S(o,o=e[0])?(ye(),Ie(s,1,1,_),ve(),s=br(e),s.c(),$e(s),s.m(t,n)):s.p(e,i),327716&i[0]){let n;for(a=e[45],n=0;n<a.length;n+=1){const o=fr(e,a,n);l[n]?l[n].p(o,i):(l[n]=Sr(o),l[n].c(),l[n].m(t,r))}for(;n<l.length;n+=1)l[n].d(1);l.length=a.length}33&i[0]&&G(t,"active",e[0].includes(e[47]._id))},i(e){i||($e(s),i=!0)},o(e){Ie(s),i=!1},d(e){e&&k(t),s.d(e),O(l,e)}}}function br(e){let t,n,r;return n=new e[11]({props:{name:e[15],data:e[47]._id,checked:e[0].includes(e[47]._id),round:!0}}),{c(){t=M("td"),Ne(n.$$.fragment),z(t,"title","Wählt den Wert aus"),z(t,"class","svelte-4visk8")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p(e,t){const r={};32&t[0]&&(r.data=e[47]._id),33&t[0]&&(r.checked=e[0].includes(e[47]._id)),n.$set(r)},i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function Sr(e){let t,n,r,i=e[16](e[47],e[50])+"";return{c(){t=M("td"),n=B(i),z(t,"class",r=T(e[50].type)+" svelte-4visk8")},m(e,r){x(e,t,r),D(t,n)},p(e,o){36&o[0]&&i!==(i=e[16](e[47],e[50])+"")&&H(n,i),4&o[0]&&r!==(r=T(e[50].type)+" svelte-4visk8")&&z(t,"class",r)},d(e){e&&k(t)}}}function Nr(e,t){let n,r,i,o=t[20](t[47],t[45],t[3]),s=o&&Ar(t);return{key:e,first:null,c(){n=F(),s&&s.c(),r=F(),this.first=n},m(e,t){x(e,n,t),s&&s.m(e,t),x(e,r,t),i=!0},p(e,n){t=e,44&n[0]&&(o=t[20](t[47],t[45],t[3])),o?s?(s.p(t,n),44&n[0]&&$e(s,1)):(s=Ar(t),s.c(),$e(s,1),s.m(r.parentNode,r)):s&&(ye(),Ie(s,1,1,()=>{s=null}),ve())},i(e){i||($e(s),i=!0)},o(e){Ie(s),i=!1},d(e){e&&k(n),s&&s.d(e),e&&k(r)}}}function Tr(e){let t,n;return t=new e[9]({}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p:_,i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Rr(e){let t,n,r,i={ctx:e,current:null,token:null,hasCatch:!1,pending:Tr,then:pr,catch:mr,value:46,blocks:[,,,]};return _e(n=e[2]&&e[18](),i),{c(){t=F(),i.block.c()},m(e,n){x(e,t,n),i.block.m(e,i.anchor=n),i.mount=()=>t.parentNode,i.anchor=t,r=!0},p(t,r){e=t,i.ctx=e,4&r[0]&&n!==(n=e[2]&&e[18]())&&_e(n,i)||Ce(i,e,r)},i(e){r||($e(i.block),r=!0)},o(e){for(let e=0;e<3;e+=1){Ie(i.blocks[e])}r=!1},d(e){e&&k(t),i.block.d(e),i.token=null,i=null}}}function Dr(e,i,o){let s=JSON.parse(n.getItem("Locale")).id;const a=ee(),{Loading:l,TextField:d,Checkbox:u,Button:f}=c;let h,p,g,y,{inputList:v}=i,{selection:$}=i,{item:I}=i,{target:_}=i,{className:C}=i,{classId:E}=i,{recordId:A}=i,{stopAggregation:b=!1}=i,{shouldNew:S}=i,N=!0,T=C+Math.floor(9e3*Math.random()+1e3).toString()+"search",R=!1;$||=[];let D=$;const x=C+_+"checkbox",k=(e,t)=>{if(!t)return;let n=e[t.name];if("__total"===t.name&&void 0===n&&(n=1.081*e._total),!n&&t.name.includes("_")&&!t.name.startsWith("_")&&!t.name.endsWith("_from")&&!t.name.endsWith("_to")){const[r,i]=t.name.split("_");try{n=e[r][i]}catch{}}if(Array.isArray(n)){const e=e=>e.replaceAll(" ",String.fromCharCode(160));if(n.length&&Array.isArray(n[0].serialno)){let t=[];for(const r of n)t=t.concat(r.serialno.map(e));n=t.join(", ")}else n=n.map(e),n.length>3&&(n=n.slice(0,3),n=n.concat("...")),n=n.join(", ")}if(!n&&t.name.split("_").length>1){const[r,i]=t.name.split("_");try{n=e[r][0][i],Array.isArray(n)&&(n=n.join(", "))}catch{}}return"number"===t.type&&(n||(n=e[`_${t.name}`]),n=Number(n)?Number(n).toLocaleString(s,{minimumFractionDigits:t.properties?.decimals||t.decimals||0,maximumFractionDigits:t.properties?.decimals||t.decimals||0}):""),"boolean"===t.type&&"Aktiv"===n&&(n=!1),"number"===t.type?n:"boolean"==typeof n||"boolean"===t.type?w(n):m(e[`_${t.name}`]||n||"")},O=t.getSchemaByClass(C),M=(e,t)=>{if(e){let n,r="1";if("string"==typeof e)n=e;else{const t=Object.keys(e);n=t[0],r=e[t[0]]}"date"===n&&(r="-1");const i=new Intl.Collator(s,{numeric:!0});return 1==+r?t.sort((e,t)=>i.compare(e[n],t[n])):t.sort((e,t)=>i.compare(t[n],e[n]))}return t};Q(()=>{window.setTimeout(()=>{const e=document.querySelector("tr.active");e&&e.scrollIntoView({block:"end",behavior:"smooth"}),document.getElementById(T)?.focus()},200)}),r.subscribe(async e=>{if(!e)return;const t=await O;e.eventId===t.id&&(kp(t.class,e.eventId),o(2,N=!o(2,N=!1)))});const P=()=>{o(6,R=!1)};return e.$$set=e=>{"inputList"in e&&o(26,v=e.inputList),"selection"in e&&o(0,$=e.selection),"item"in e&&o(27,I=e.item),"target"in e&&o(28,_=e.target),"className"in e&&o(29,C=e.className),"classId"in e&&o(30,E=e.classId),"recordId"in e&&o(31,A=e.recordId),"stopAggregation"in e&&o(32,b=e.stopAggregation),"shouldNew"in e&&o(1,S=e.shouldNew)},[$,S,N,h,p,g,R,y,a,l,d,u,f,T,!1,x,k,()=>{const e=document.getElementsByName(x),t=Array.from(e).filter(e=>e.checked).map(e=>e.attributes.data.value);if(h){const e=D.filter(e=>!t.find(t=>t==e));o(0,$=t.concat(e)),D=[...$]}else o(0,$=t),D=[];a("choose",{list:$})},async()=>{o(4,p=await O),g||o(5,g=M(p.displaySort,await v||await Np(p.class,p.id)));const{display:e}=p;let n=await(async(e,n,r)=>{if(!e)return;let i=[];for(const o of e){if("_total"===o){i.push({name:"_total",designation:"Betrag",type:"number"});continue}if("__total"===o){i.push({name:"__total",designation:"Total CHF",type:"number",decimals:2});continue}const[e,s]=o.split(".");let a=n.list?.find(t=>t.name===e)?.item?.find(e=>e.name===s);if(a&&(a={...a},a.name=`${e}_${s}`,r=r.map(t=>(t[e]&&(t[a.name]=t["_"+e]?t["_"+e][s]:t[e][s]),t))),o.endsWith("_from")||o.endsWith("_to")){const t=a=n.items.find(t=>t.name===e.split("_")[0]);t&&(a={name:o,designation:t.designation,type:"date",decimals:0})}if(a||(a=n.items.find(t=>t.name===e)),!a){const n=await t.getSchemaByClass(e),r=n.items?.find(e=>e.name===s);r&&(a={name:e,designation:r.designation,type:r.type,decimals:r.properties?.decimals||0})}i.find(t=>t?.name===e)||i.push(a)}return i.length?i:n.items})(e,p,g);return{items:n}},({detail:{value:e}})=>{o(3,h=e)},(e,t,n)=>{if(!e)return!1;if(!n)return!0;"string"!=typeof n&&(n=n.toString()),n=n.toLowerCase();let r=!1;for(const i of t){const t=k(e,i).toLowerCase();!r&&t.includes(n)&&(r=!0)}return r},()=>{o(3,h="")},e=>()=>{document.getElementsByName(x).forEach((e,t)=>{e.checked=!e.checked})},()=>{o(7,y=!1),o(6,R=!0)},async e=>{o(5,g=M(p.displaySort,await Np(p.class,p.id))),e.detail?.row?._id&&$.push(e.detail.row._id),P()},P,v,I,_,C,E,A,b,()=>a("back"),function(e){h=e,o(3,h)}]}class xr extends xe{constructor(e){var t;super(),cr.getElementById("svelte-4visk8-style")||((t=M("style")).id="svelte-4visk8-style",t.textContent=".feather.svelte-4visk8.svelte-4visk8{position:absolute;top:2em;right:0.5em;color:#326173}td .checkbox .selector{border:0.125em solid #326173 !important}.eList.svelte-4visk8.svelte-4visk8{height:fit-content;max-height:65vh;overflow-y:scroll;overflow-x:auto}.eList.svelte-4visk8 .editRow.svelte-4visk8{width:1em}.eList.svelte-4visk8 table.svelte-4visk8{min-width:30vw;position:relative;width:max-content !important;max-width:50vh !important}.eList.svelte-4visk8 table thead.svelte-4visk8{position:sticky;top:0;background:#326173;color:white}.eList.svelte-4visk8 table thead tr.svelte-4visk8{height:2.3em}.eList.svelte-4visk8 table tbody tr.svelte-4visk8{height:2.75em !important}th.svelte-4visk8.svelte-4visk8,td.svelte-4visk8.svelte-4visk8{padding-left:0.4em;padding-right:0.4em}td.number.svelte-4visk8.svelte-4visk8{text-align:end}tr.active.svelte-4visk8.svelte-4visk8{color:#326173;background-color:#fcebd5}.form--buttons.svelte-4visk8.svelte-4visk8{display:flex;gap:1em;padding:0.5em 0}",D(cr.head,t)),De(this,e,Dr,Rr,S,{inputList:26,selection:0,item:27,target:28,className:29,classId:30,recordId:31,stopAggregation:32,shouldNew:1},[-1,-1])}}function kr(e,t,n){const r=e.slice();return r[12]=t[n],r[42]=n,r}function Or(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Mr(e){let t,n;return t=new e[17]({props:{outline:!0,$$slots:{default:[Lr]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};36863&n[0]|4096&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Pr(e){let t,n,r,i,o;return n=new wt({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather pointer")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[23]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function Br(e){let t,n;return t=new lr({props:{classId:e[5],eventId:e[6],required:e[8],disabled:e[0],formnovalidate:e[11],readonly:e[9],id:e[1]+"."+e[42],item:e[2],desc:e[3],value:e[12],noForm:e[4],praefix:e[10],recordId:e[7],multi:!0+"}"}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};32&n[0]&&(r.classId=e[5]),64&n[0]&&(r.eventId=e[6]),256&n[0]&&(r.required=e[8]),1&n[0]&&(r.disabled=e[0]),2048&n[0]&&(r.formnovalidate=e[11]),512&n[0]&&(r.readonly=e[9]),2&n[0]&&(r.id=e[1]+"."+e[42]),4&n[0]&&(r.item=e[2]),8&n[0]&&(r.desc=e[3]),32768&n[0]&&(r.value=e[12]),16&n[0]&&(r.noForm=e[4]),1024&n[0]&&(r.praefix=e[10]),128&n[0]&&(r.recordId=e[7]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Lr(e){let t,n,r,i=!e[9]&&Pr(e),o=e[15],s=[];for(let t=0;t<o.length;t+=1)s[t]=Br(kr(e,o,t));const a=e=>Ie(s[e],1,1,()=>{s[e]=null});return{c(){i&&i.c(),t=L();for(let e=0;e<s.length;e+=1)s[e].c();n=F()},m(e,o){i&&i.m(e,o),x(e,t,o);for(let t=0;t<s.length;t+=1)s[t].m(e,o);x(e,n,o),r=!0},p(e,r){if(e[9]?i&&(ye(),Ie(i,1,1,()=>{i=null}),ve()):i?(i.p(e,r),512&r[0]&&$e(i,1)):(i=Pr(e),i.c(),$e(i,1),i.m(t.parentNode,t)),36863&r[0]){let t;for(o=e[15],t=0;t<o.length;t+=1){const i=kr(e,o,t);s[t]?(s[t].p(i,r),$e(s[t],1)):(s[t]=Br(i),s[t].c(),$e(s[t],1),s[t].m(n.parentNode,n))}for(ye(),t=o.length;t<s.length;t+=1)a(t);ve()}},i(e){if(!r){$e(i);for(let e=0;e<o.length;e+=1)$e(s[e]);r=!0}},o(e){Ie(i),s=s.filter(Boolean);for(let e=0;e<s.length;e+=1)Ie(s[e]);r=!1},d(e){i&&i.d(e),e&&k(t),O(s,e),e&&k(n)}}}function Fr(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Vr(e){let t,n;return t=new e[19]({props:{title:e[14].designation,class:"eList",$$slots:{default:[Ur]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};16384&n[0]&&(r.title=e[14].designation),82084&n[0]|4096&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Ur(e){let t,n;return t=new xr({props:{selection:e[16],item:e[2],className:e[14].class,classId:e[5],recordId:e[7],inputList:e[22](),target:e[2].name,shouldNew:!e[20]}}),t.$on("choose",e[24]),t.$on("back",e[25]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};65536&n[0]&&(r.selection=e[16]),4&n[0]&&(r.item=e[2]),16384&n[0]&&(r.className=e[14].class),32&n[0]&&(r.classId=e[5]),128&n[0]&&(r.recordId=e[7]),4&n[0]&&(r.target=e[2].name),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Wr(e){let t,n,r=e[13]&&Vr(e);return{c(){r&&r.c(),t=F()},m(e,i){r&&r.m(e,i),x(e,t,i),n=!0},p(e,n){e[13]?r?(r.p(e,n),8192&n[0]&&$e(r,1)):(r=Vr(e),r.c(),$e(r,1),r.m(t.parentNode,t)):r&&(ye(),Ie(r,1,1,()=>{r=null}),ve())},i(e){n||($e(r),n=!0)},o(e){Ie(r),n=!1},d(e){r&&r.d(e),e&&k(t)}}}function zr(e){let t,n,r,i,o={ctx:e,current:null,token:null,hasCatch:!1,pending:Fr,then:Mr,catch:Or,value:40,blocks:[,,,]};function s(t){e[34](t)}_e(e[21](),o);let a={class:"tModal",noClickaway:!0,$$slots:{default:[Wr]},$$scope:{ctx:e}};return void 0!==e[13]&&(a.open=e[13]),n=new e[18]({props:a}),re.push(()=>Se(n,"open",s)),{c(){o.block.c(),t=L(),Ne(n.$$.fragment)},m(e,r){o.block.m(e,o.anchor=r),o.mount=()=>t.parentNode,o.anchor=t,x(e,t,r),Te(n,e,r),i=!0},p(t,i){Ce(o,e=t,i);const s={};90276&i[0]|4096&i[1]&&(s.$$scope={dirty:i,ctx:e}),!r&&8192&i[0]&&(r=!0,s.open=e[13],ue(()=>r=!1)),n.$set(s)},i(e){i||($e(o.block),$e(n.$$.fragment,e),i=!0)},o(e){for(let e=0;e<3;e+=1){Ie(o.blocks[e])}Ie(n.$$.fragment,e),i=!1},d(e){o.block.d(e),o.token=null,o=null,e&&k(t),Re(n,e)}}}function Hr(e,n,r){const i=ee(),{Card:o,Modal:s,Dialog:a,Button:l}=c;let d,u,f,{id:h}=n,{item:m}=n,{record:p}=n,{value:g=[]}=n,{desc:w=""}=n,{noForm:y=!1}=n,{classId:v}=n,{eventId:$}=n,{recordId:I}=n,{withRefValue:_=!1}=n,{refValue:C=""}=n,{required:E}=n,{disabled:A}=n,{readonly:b}=n,{praefix:S}=n,{selectionFields:N}=n,{formnovalidate:T}=n,{selection:R}=n,{deList:D}=n,{isTemplate:x}=n,{noList:k=!1}=n,O=!1;const{lookup:M,refStatus:P,filter:B,constraint:L}=m.properties.multi;A=!0;const F=()=>{r(13,O=!1)};return e.$$set=e=>{"id"in e&&r(1,h=e.id),"item"in e&&r(2,m=e.item),"record"in e&&r(26,p=e.record),"value"in e&&r(12,g=e.value),"desc"in e&&r(3,w=e.desc),"noForm"in e&&r(4,y=e.noForm),"classId"in e&&r(5,v=e.classId),"eventId"in e&&r(6,$=e.eventId),"recordId"in e&&r(7,I=e.recordId),"withRefValue"in e&&r(27,_=e.withRefValue),"refValue"in e&&r(28,C=e.refValue),"required"in e&&r(8,E=e.required),"disabled"in e&&r(0,A=e.disabled),"readonly"in e&&r(9,b=e.readonly),"praefix"in e&&r(10,S=e.praefix),"selectionFields"in e&&r(29,N=e.selectionFields),"formnovalidate"in e&&r(11,T=e.formnovalidate),"selection"in e&&r(30,R=e.selection),"deList"in e&&r(31,D=e.deList),"isTemplate"in e&&r(32,x=e.isTemplate),"noList"in e&&r(33,k=e.noList)},[A,h,m,w,y,v,$,I,E,b,S,T,g,O,d,u,f,o,s,a,M,async()=>{r(15,u=[].concat(g)),r(14,d=await t.getSchemaByClass(m.refClass))},async()=>{let e,n;if(M)if(M.refClass){if(p[M.refClass]){const r=await xp(M.refClass,p[M.refClass]);r&&Array.isArray(r[M.refItem])&&(n=[{$match:{_id:{$in:r[M.refItem]}}}],e=await t.getSectionView(d.class,n,!0))}}else n=[{$match:{[M]:p[M]}}],P&&(n=n.concat([{$addFields:{_docId:{$toString:"$_id"}}},{$lookup:{from:"_task",localField:"_docId",foreignField:"docId",as:"_task"}},{$unwind:{path:"$_task",preserveNullAndEmptyArrays:!0}},{$match:{"_task.status":P}}])),e=await t.getSectionView(d.class,n,!0);else e=await Np("",d.id);if(!e?.length)return[];if(L&&e?.length){const{refClass:r,refStatus:i}=L,o=d.class===r?"_id":d.class;n=[{$match:{[o]:{$in:e.map(({_id:e})=>e)}}},{$addFields:{_docId:{$toString:"$_id"}}},{$lookup:{from:"_task",localField:"_docId",foreignField:"docId",as:"_task"}},{$unwind:{path:"$_task",preserveNullAndEmptyArrays:!0}},{$match:{"_task.status":i}}];const s=await t.getSectionView(r,n,!0);"project"!==r&&(e=e.filter(e=>!!s.find(t=>t.project==e._id)))}if(B)for(const t in B)e=e.filter(e=>{let[n,r]=t.split(".");if(r||(r=n,n=""),n){if(e[n][0]&&e[n][0][r].length)return!0}else if(e[r])return!0;return!1});return e},()=>{b||(r(13,O=!0),r(16,f=u))},({detail:e})=>{p.__id||(r(15,u=e.list),i("change",{value:u}),i("multi",{lookup:M,filter:B,name:m.name,value:u})),F()},F,p,_,C,N,R,D,x,k,function(e){O=e,r(13,O)}]}class jr extends xe{constructor(e){var t;super(),document.getElementById("svelte-1m792ni-style")||((t=M("style")).id="svelte-1m792ni-style",t.textContent=".field .card{padding:1em !important;margin-bottom:1em !important}",D(document.head,t)),De(this,e,Hr,zr,S,{id:1,item:2,record:26,value:12,desc:3,noForm:4,classId:5,eventId:6,recordId:7,withRefValue:27,refValue:28,required:8,disabled:0,readonly:9,praefix:10,selectionFields:29,formnovalidate:11,selection:30,deList:31,isTemplate:32,noList:33},[-1,-1])}}const qr=/\d+/g,Gr=/%[HMSpPdmyY%]/g;function Xr(e,t,n){const r=Math.floor((new Date).getFullYear()/100);let i=!1;if(""===e)return null;const o=t.split(Gr);let s=0,a=0;const l=new Date(0);for(const c of o){if(!e.startsWith(c,s))return n;if(s+=c.length,s===e.length){if(a!==t.length)return n;break}if("%"!==t[a+c.length])break;if(a+=c.length+1,"%"===t[a]){if("%"!==e[s])return n;s++}else if("p"===t[a].toLowerCase()){const t=e.substr(s,2).toUpperCase();if("AM"===t)i=!1,l.getHours()>=12&&l.setHours(l.getHours()-12);else{if("PM"!==t)return n;i=!0,l.getHours()<12&&l.setHours(l.getHours()+12)}}else{qr.lastIndex=s;const o=qr.exec(e);if(null==o)return n;switch(t[a]){case"H":l.setHours(parseInt(o[0])+12*i);break;case"M":l.setMinutes(o[0]);break;case"S":l.setSeconds(o[0]);break;case"d":l.setDate(o[0]);break;case"m":l.setMonth(o[0]-1);break;case"y":l.setFullYear(100*r+parseInt(o[0]));break;case"Y":l.setFullYear(o[0])}s+=o[0].length}a++}return isNaN(l.valueOf())?n:l}function Yr(e,t){return null==e||null==t?e:(t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t)}const{document:Zr}=Ee;function Kr(e,t,n){const r=e.slice();return r[17]=t[n],r}function Qr(e,t,n){const r=e.slice();return r[20]=t[n],r}function Jr(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function ei(e){let t,n,r,i,o,s,a,l,c,d,u,f,h,m=e[0].items,p=[];for(let t=0;t<m.length;t+=1)p[t]=ni(Qr(e,m,t));const g=e=>Ie(p[e],1,1,()=>{p[e]=null});let w=e[0].list&&ri(e);return l=new e[5]({props:{outline:!0,$$slots:{default:[oi]},$$scope:{ctx:e}}}),l.$on("click",e[9]),d=new e[5]({props:{disabled:e[2],class:"close",form:e[6],filled:!0,type:"submit",$$slots:{default:[si]},$$scope:{ctx:e}}}),{c(){t=M("form"),n=M("input"),i=L();for(let e=0;e<p.length;e+=1)p[e].c();o=L(),w&&w.c(),s=L(),a=M("div"),Ne(l.$$.fragment),c=L(),Ne(d.$$.fragment),z(n,"class",T(e[6])+" svelte-1phofh5"),z(n,"name","_id"),z(n,"type","hidden"),n.value=r=e[1]._id||"",z(t,"class","fTask svelte-1phofh5"),z(t,"id",e[6]),z(a,"class","form--buttons svelte-1phofh5")},m(r,m){x(r,t,m),D(t,n),D(t,i);for(let e=0;e<p.length;e+=1)p[e].m(t,null);D(t,o),w&&w.m(t,null),x(r,s,m),x(r,a,m),Te(l,a,null),D(a,c),Te(d,a,null),u=!0,f||(h=[V(t,"keydown",e[8]),V(t,"submit",U(e[10]))],f=!0)},p(e,i){if((!u||2&i&&r!==(r=e[1]._id||""))&&(n.value=r),75&i){let n;for(m=e[0].items,n=0;n<m.length;n+=1){const r=Qr(e,m,n);p[n]?(p[n].p(r,i),$e(p[n],1)):(p[n]=ni(r),p[n].c(),$e(p[n],1),p[n].m(t,o))}for(ye(),n=m.length;n<p.length;n+=1)g(n);ve()}e[0].list?w?(w.p(e,i),1&i&&$e(w,1)):(w=ri(e),w.c(),$e(w,1),w.m(t,null)):w&&(ye(),Ie(w,1,1,()=>{w=null}),ve());const s={};8388608&i&&(s.$$scope={dirty:i,ctx:e}),l.$set(s);const a={};4&i&&(a.disabled=e[2]),8388608&i&&(a.$$scope={dirty:i,ctx:e}),d.$set(a)},i(e){if(!u){for(let e=0;e<m.length;e+=1)$e(p[e]);$e(w),$e(l.$$.fragment,e),$e(d.$$.fragment,e),u=!0}},o(e){p=p.filter(Boolean);for(let e=0;e<p.length;e+=1)Ie(p[e]);Ie(w),Ie(l.$$.fragment,e),Ie(d.$$.fragment,e),u=!1},d(e){e&&k(t),O(p,e),w&&w.d(),e&&k(s),e&&k(a),Re(l),Re(d),f=!1,A(h)}}}function ti(e){let t,n;return t=new Su({props:{classId:e[6],item:e[20],selection:e[20].selection,record:e[1],disabled:e[3],eventId:e[0].id,required:!1,isTemplate:!0}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};1&n&&(r.item=e[20]),1&n&&(r.selection=e[20].selection),2&n&&(r.record=e[1]),8&n&&(r.disabled=e[3]),1&n&&(r.eventId=e[0].id),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function ni(e){let t,n,r=ci(!0,e[20]),i=r&&ti(e);return{c(){i&&i.c(),t=F()},m(e,r){i&&i.m(e,r),x(e,t,r),n=!0},p(e,n){1&n&&(r=ci(!0,e[20])),r?i?(i.p(e,n),1&n&&$e(i,1)):(i=ti(e),i.c(),$e(i,1),i.m(t.parentNode,t)):i&&(ye(),Ie(i,1,1,()=>{i=null}),ve())},i(e){n||($e(i),n=!0)},o(e){Ie(i),n=!1},d(e){i&&i.d(e),e&&k(t)}}}function ri(e){let t,n,r=e[0].list,i=[];for(let t=0;t<r.length;t+=1)i[t]=ii(Kr(e,r,t));const o=e=>Ie(i[e],1,1,()=>{i[e]=null});return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=F()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);x(e,t,r),n=!0},p(e,n){if(75&n){let s;for(r=e[0].list,s=0;s<r.length;s+=1){const o=Kr(e,r,s);i[s]?(i[s].p(o,n),$e(i[s],1)):(i[s]=ii(o),i[s].c(),$e(i[s],1),i[s].m(t.parentNode,t))}for(ye(),s=r.length;s<i.length;s+=1)o(s);ve()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)$e(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)Ie(i[e]);n=!1},d(e){O(i,e),e&&k(t)}}}function ii(e){let t,n,r,i;return t=new e[4]({props:{text:e[17].designation}}),r=new Ii({props:{classId:e[6],list:e[17],eventId:e[0].id,schema:e[17].item,record:e[1],disabled:e[3],required:!1,open:!0,isTemplate:!0}}),{c(){Ne(t.$$.fragment),n=L(),Ne(r.$$.fragment)},m(e,o){Te(t,e,o),x(e,n,o),Te(r,e,o),i=!0},p(e,n){const i={};1&n&&(i.text=e[17].designation),t.$set(i);const o={};1&n&&(o.list=e[17]),1&n&&(o.eventId=e[0].id),1&n&&(o.schema=e[17].item),2&n&&(o.record=e[1]),8&n&&(o.disabled=e[3]),r.$set(o)},i(e){i||($e(t.$$.fragment,e),$e(r.$$.fragment,e),i=!0)},o(e){Ie(t.$$.fragment,e),Ie(r.$$.fragment,e),i=!1},d(e){Re(t,e),e&&k(n),Re(r,e)}}}function oi(e){let t;return{c(){t=B("Abbrechen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function si(e){let t;return{c(){t=B("Speichern")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function ai(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function li(e){let t,n,r,i={ctx:e,current:null,token:null,hasCatch:!1,pending:ai,then:ei,catch:Jr,value:16,blocks:[,,,]};return _e(e[7](),i),{c(){t=L(),n=M("section"),i.block.c(),Zr.title="Vorgaben",z(n,"class","sTask svelte-1phofh5")},m(e,o){x(e,t,o),x(e,n,o),i.block.m(n,i.anchor=null),i.mount=()=>n,i.anchor=null,r=!0},p(t,[n]){Ce(i,e=t,n)},i(e){r||($e(i.block),r=!0)},o(e){for(let e=0;e<3;e+=1){Ie(i.blocks[e])}r=!1},d(e){e&&k(t),e&&k(n),i.block.d(),i.token=null,i=null}}}const ci=(e,{type:t="",properties:n={}})=>!e||"list"!==t&&("time"===n.format&&(t="time"),!["date","datetime","time"].includes(t)&&(!n.readonly&&!n.hidden));function di(e,r,s){let l,d,u;N(e,o,e=>s(11,d=e)),N(e,i,e=>s(12,u=e));const{Divider:f,Button:h,FormField:m}=c,p=JSON.parse(n.getItem("Locale"));let{schema:g}=r,{record:w}=r,y="template-"+g.class+Math.floor(9e3*Math.random()+1e3).toString(),v=!1;const $=()=>window.history.back(),I=(e,t,n=!1)=>{const r=t.id,i=e.find(e=>e.name===r);let o=t.value;if(!n&&i&&i.properties?.multi&&(o=w[r]),o&&i&&i.type.startsWith("date"))try{return Xr(o,"%d.%m.%Y").toISOString()}catch{return new Date(o).toISOString()}if(i&&"boolean"===i.type&&(o=!!t.checked),i&&"number"===i.type){const e=Number("1.1").toLocaleString(p.id).substring(1,2);try{o=Number(o.replace(e,".")).toString()}catch{}}return o};return e.$$set=e=>{"schema"in e&&s(0,g=e.schema),"record"in e&&s(1,w=e.record)},e.$$.update=()=>{4&e.$$.dirty&&s(3,l=v)},[g,w,v,l,f,h,y,async()=>{const e=await t.getEvent(g.id);if(e.trigger?.startOn&&!e.trigger?.startOn?.some(e=>"Manual"===e.type)&&s(2,v=!0),d.role?.length&&g.authorization?.length){const e=g.authorization.some(e=>u?.find(t=>t===e.role&&"edit"===e.activity));s(2,v||=!e)}},e=>{"button"!==e.srcElement?.type&&"textarea"!==e.srcElement?.type&&13==e.which&&e.preventDefault()},$,async e=>{const n={};Array.from(document.querySelectorAll("form#"+y+" ."+y)).map(e=>{const t=e.id||e.name;if(t)if(t.includes(".")){const[r,i]=t.split("."),o=g.list.find(e=>e.name===r);n[t]=I(o.item,e)}else n[t]=I(g.items,e)}),await t.saveTemplate(g.class,n),a.success("Die Vorgaben wurden gespeichert.",2e3),$()}]}const{document:ui}=Ee;function fi(e,t,n){const r=e.slice();return r[35]=t[n],r}function hi(e){let t,n;return t=new Su({props:{classId:e[3],item:e[35],listName:e[2].name,eventId:e[4],record:e[0],disabled:e[5],required:e[6],currency:e[9],notifyList:e[1]}}),t.$on("notify",e[15]),t.$on("defPrep",e[17]),t.$on("formula",e[19]),t.$on("task",e[23]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};8&n[0]&&(r.classId=e[3]),4&n[0]&&(r.item=e[35]),4&n[0]&&(r.listName=e[2].name),16&n[0]&&(r.eventId=e[4]),1&n[0]&&(r.record=e[0]),32&n[0]&&(r.disabled=e[5]),64&n[0]&&(r.required=e[6]),512&n[0]&&(r.currency=e[9]),2&n[0]&&(r.notifyList=e[1]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function mi(e){let t,n,r=ci(e[8],e[35]),i=r&&hi(e);return{c(){i&&i.c(),t=F()},m(e,r){i&&i.m(e,r),x(e,t,r),n=!0},p(e,n){260&n[0]&&(r=ci(e[8],e[35])),r?i?(i.p(e,n),260&n[0]&&$e(i,1)):(i=hi(e),i.c(),$e(i,1),i.m(t.parentNode,t)):i&&(ye(),Ie(i,1,1,()=>{i=null}),ve())},i(e){n||($e(i),n=!0)},o(e){Ie(i),n=!1},d(e){i&&i.d(e),e&&k(t)}}}function pi(e){let t,n,r,i=e[2].item,o=[];for(let t=0;t<i.length;t+=1)o[t]=mi(fi(e,i,t));const s=e=>Ie(o[e],1,1,()=>{o[e]=null});return{c(){t=M("div");for(let e=0;e<o.length;e+=1)o[e].c();z(t,"id",n=`accordion-content-${e[3]}-${e[2].name}`)},m(e,n){x(e,t,n);for(let e=0;e<o.length;e+=1)o[e].m(t,null);r=!0},p(e,a){if(689023&a[0]){let n;for(i=e[2].item,n=0;n<i.length;n+=1){const r=fi(e,i,n);o[n]?(o[n].p(r,a),$e(o[n],1)):(o[n]=mi(r),o[n].c(),$e(o[n],1),o[n].m(t,null))}for(ye(),n=i.length;n<o.length;n+=1)s(n);ve()}(!r||12&a[0]&&n!==(n=`accordion-content-${e[3]}-${e[2].name}`))&&z(t,"id",n)},i(e){if(!r){for(let e=0;e<i.length;e+=1)$e(o[e]);r=!0}},o(e){o=o.filter(Boolean);for(let e=0;e<o.length;e+=1)Ie(o[e]);r=!1},d(e){e&&k(t),O(o,e)}}}function gi(e){let t,n,r=e[14](e[10])+"";return{c(){t=M("span"),n=B(r)},m(e,r){x(e,t,r),D(t,n)},p(e,t){1024&t[0]&&r!==(r=e[14](e[10])+"")&&H(n,r)},d(e){e&&k(t)}}}function wi(e){let t,n,r;return n=new e[11]({props:{$$slots:{default:[gi]},$$scope:{ctx:e}}}),n.$on("click",function(){b(e[16](e[34]))&&e[16](e[34]).apply(this,arguments)}),{c(){t=M("div"),Ne(n.$$.fragment),z(t,"class","accordion svelte-148ktt9"),z(t,"slot","handle")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p(t,r){e=t;const i={};1024&r[0]|128&r[1]&&(i.$$scope={dirty:r,ctx:e}),n.$set(i)},i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function yi(e){let t,n;return t=new e[13]({props:{open:e[7],$$slots:{handle:[wi,({toggle:e})=>({34:e}),({toggle:e})=>[0,e?8:0]],default:[pi,({toggle:e})=>({34:e}),({toggle:e})=>[0,e?8:0]]},$$scope:{ctx:e}}}),t.$on("panel-open",e[18]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};128&n[0]&&(r.open=e[7]),1919&n[0]|136&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function vi(e){let t,n,r;return n=new e[12]({props:{$$slots:{default:[yi]},$$scope:{ctx:e}}}),{c(){t=M("div"),Ne(n.$$.fragment),z(t,"class","formList")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p(e,t){const r={};2047&t[0]|128&t[1]&&(r.$$scope={dirty:t,ctx:e}),n.$set(r)},i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function $i(e,n,r){const{Button:i,Accordion:o,AccordionSection:s}=c;let{list:a}=n,{schema:l}=n,{record:d}=n,{classId:u}=n,{eventId:f}=n,{disabled:h}=n,{required:y}=n,{open:v=!1}=n,{template:$={}}=n,{isTemplate:I=!1}=n,{currency:_}=n,{update:C=!1}=n,{notifyList:E}=n,A=new Map;const b={};let S=d[a.name]||{};d[a.name]=S;const N=(e,t)=>""===t[e.name]?"":e._attr?T(e,t[e.name]):"object"===e.type?D(t[e.name]):Array.isArray(t[e.name])?R(t[e.name]):"boolean"===e.type?w(t[e.name]):"number"===e.type?x(t[e.name],e.properties?.decimals||0):"dateRange"===e.type?g(e.name,t):"date"===e.type?m(gDate(t[e.name])):"datetime"===e.type?p(t[e.name]):e.properties?.multi?"":t[e.name],T=(e,t)=>b[t]?.split(" • ").at(e._attr),R=e=>e.slice(0,3).join(", "),D=e=>b[e]?.split(" • ").filter(e=>!!e).slice(0,2).join(" · "),x=(e,t)=>(t||=0,"number"==typeof e&&e||(e=Number(e||0)),(+(Math.round(e+"e+"+t)+"e-"+t)).toFixed(t)),k=e=>{if(!e)return;const{style:t,scrollHeight:n}=e;n&&(t.height=`${n}px`)},O=async({item:e,value:t})=>{const n=l.find(t=>t.properties?.value?.formula?.argument?.find(t=>t.refItem===e.name));if(!n)return;const i=n.properties.value.formula,{operator:o,argument:s}=i,c=s.map(n=>n.refItem===e.name?t:S[n.refItem]||d[n.refItem]);let u=0;"$add"===o&&(u=c.reduce((e,t)=>+(e||0)+ +(t||0))),r(0,d[a.name][n.name]=x(u,n.properties?.decimals),d)};return e.$$set=e=>{"list"in e&&r(2,a=e.list),"schema"in e&&r(20,l=e.schema),"record"in e&&r(0,d=e.record),"classId"in e&&r(3,u=e.classId),"eventId"in e&&r(4,f=e.eventId),"disabled"in e&&r(5,h=e.disabled),"required"in e&&r(6,y=e.required),"open"in e&&r(7,v=e.open),"template"in e&&r(21,$=e.template),"isTemplate"in e&&r(8,I=e.isTemplate),"currency"in e&&r(9,_=e.currency),"update"in e&&r(22,C=e.update),"notifyList"in e&&r(1,E=e.notifyList)},e.$$.update=()=>{4194309&e.$$.dirty[0]&&C&&d&&r(10,S=d[a.name]||{})},[d,E,a,u,f,h,y,v,I,_,S,i,o,s,e=>{let t=l;return a.display?.refItem&&(t=a.display.refItem.map(e=>{const[t,n]=e.split("."),r=l.find(e=>e.name===t);if(r)return r._attr=n,r}).filter(e=>!!e)),e&&t.filter(t=>!0!==t.properties?.hidden&&("dateRange"===t.type||void 0!==e[t.name])&&"html"!==t.properties?.format&&"textarea"!==t.properties?.format).map(t=>N(t,e)).filter(e=>!!e).join(" • ")||"+"},({detail:e})=>{const[t,n]=e.itemName.split(".");if(!n)return;r(1,E={listName:a.name,itemName:e.itemName,value:e.value}),e.desc&&(b[n]=e.desc);const i=d[t];r(0,d[t]={...i,[n]:e.value},d),r(10,S=d[t])},e=>t=>{(()=>{const e=$[a.name]||{};for(const t in e)$[a.name][t]&&!d[a.name][t]&&r(0,d[a.name][t]=$[a.name][t],d)})(),e(t);const n=`#accordion-content-${u}-${a.name} > div.form-field:last-child`;document.querySelector(n),ce().then(()=>{const e=`#accordion-content-${u}-${a.name} textarea`;Array.from(document.querySelectorAll(e)).forEach(k)})},async({detail:{className:e,itemName:n,value:r}})=>{if(A.has(e))return;if(!0!==r&&(r=(r=[].concat(r)).some(e=>e===className+"."+a.name)),!r)return;const i={[n]:!0},o=await t.getSectionView(e,i);o?.length&&A.set(e,o[0])},()=>{setTimeout(()=>{Array.from(A).forEach(([e,t])=>{d[a.name][e]||r(0,d[a.name][e]=t._id,d)})},500)},({detail:e})=>{O(e)},l,$,C,function(t){te(e,t)}]}class Ii extends xe{constructor(e){var t;super(),ui.getElementById("svelte-148ktt9-style")||((t=M("style")).id="svelte-148ktt9-style",t.textContent=".accordion.svelte-148ktt9{display:flex}.formList .accordion > .btn{display:inline-block;width:97%;margin-bottom:1em;background-color:#F5F5F5}@media screen and (max-width: 600px){.formList .accordion > .btn{width:25em}}",D(ui.head,t)),De(this,e,$i,vi,S,{list:2,schema:20,record:0,classId:3,eventId:4,disabled:5,required:6,open:7,template:21,isTemplate:8,currency:9,update:22,notifyList:1},[-1,-1])}}const{document:_i}=Ee;function Ci(e){e[0]=e[23].list,e[22]=e[23].items}function Ei(e,t,n){const r=e.slice();return r[24]=t[n],r}function Ai(e,t,n){const r=e.slice();return r[27]=t[n],r}function bi(e,t,n){const r=e.slice();return r[27]=t[n],r}function Si(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Ni(e){let t,n,r,i,o,s,a,l,c,d,u,f,h,m,p,g,w,y;function v(t){e[19](t)}Ci(e),n=new e[7]({props:{outline:!0,$$slots:{default:[Ti]},$$scope:{ctx:e}}}),n.$on("click",e[18]);let $={id:e[8]};void 0!==e[1]&&($.value=e[1]),s=new e[6]({props:$}),re.push(()=>Se(s,"value",v)),s.$on("input",e[12]),d=new ot({props:{size:"18"}});let I=e[22]?.length&&function(e){let t,n,r=e[22],i=[];for(let t=0;t<r.length;t+=1)i[t]=Ri(bi(e,r,t));return{c(){t=M("thead"),n=M("tr");for(let e=0;e<i.length;e+=1)i[e].c();z(n,"class","svelte-14hcfjl"),z(t,"class","svelte-14hcfjl")},m(e,r){x(e,t,r),D(t,n);for(let e=0;e<i.length;e+=1)i[e].m(n,null)},p(e,t){if(2048&t[0]){let o;for(r=e[22],o=0;o<r.length;o+=1){const s=bi(e,r,o);i[o]?i[o].p(s,t):(i[o]=Ri(s),i[o].c(),i[o].m(n,null))}for(;o<i.length;o+=1)i[o].d(1);i.length=r.length}},d(e){e&&k(t),O(i,e)}}}(e),_=e[0]?.length&&function(e){let t,n=e[0],r=[];for(let t=0;t<n.length;t+=1)r[t]=ki(Ei(e,n,t));return{c(){for(let e=0;e<r.length;e+=1)r[e].c();t=F()},m(e,n){for(let t=0;t<r.length;t+=1)r[t].m(e,n);x(e,t,n)},p(e,i){if(11778&i[0]){let o;for(n=e[0],o=0;o<n.length;o+=1){const s=Ei(e,n,o);r[o]?r[o].p(s,i):(r[o]=ki(s),r[o].c(),r[o].m(t.parentNode,t))}for(;o<r.length;o+=1)r[o].d(1);r.length=n.length}},d(e){O(r,e),e&&k(t)}}}(e);return{c(){t=M("div"),Ne(n.$$.fragment),r=L(),i=M("div"),o=B("Suchen: "),Ne(s.$$.fragment),l=L(),c=M("span"),Ne(d.$$.fragment),u=L(),f=M("div"),h=M("table"),I&&I.c(),m=L(),p=M("tbody"),_&&_.c(),z(t,"class","form--buttons svelte-14hcfjl"),z(c,"class","feather pointer svelte-14hcfjl"),q(i,"margin-bottom","1em"),q(i,"position","relative"),z(h,"striped",""),z(h,"class","svelte-14hcfjl"),z(f,"class","eList svelte-14hcfjl")},m(a,v){x(a,t,v),Te(n,t,null),x(a,r,v),x(a,i,v),D(i,o),Te(s,i,null),D(i,l),D(i,c),Te(d,c,null),x(a,u,v),x(a,f,v),D(f,h),I&&I.m(h,null),D(h,m),D(h,p),_&&_.m(p,null),g=!0,w||(y=V(c,"click",e[14]),w=!0)},p(e,t){Ci(e);const r={};2&t[1]&&(r.$$scope={dirty:t,ctx:e}),n.$set(r);const i={};!a&&2&t[0]&&(a=!0,i.value=e[1],ue(()=>a=!1)),s.$set(i),e[22]?.length&&I.p(e,t),e[0]?.length&&_.p(e,t)},i(e){g||($e(n.$$.fragment,e),$e(s.$$.fragment,e),$e(d.$$.fragment,e),g=!0)},o(e){Ie(n.$$.fragment,e),Ie(s.$$.fragment,e),Ie(d.$$.fragment,e),g=!1},d(e){e&&k(t),Re(n),e&&k(r),e&&k(i),Re(s),Re(d),e&&k(u),e&&k(f),I&&I.d(),_&&_.d(),w=!1,y()}}}function Ti(e){let t;return{c(){t=B("Abbrechen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Ri(e){let t,n,r=e[27]?.designation+"";return{c(){t=M("th"),n=B(r),z(t,"class","svelte-14hcfjl")},m(e,r){x(e,t,r),D(t,n)},p:_,d(e){e&&k(t)}}}function Di(e){let t,n,r=e[22],i=[];for(let t=0;t<r.length;t+=1)i[t]=xi(Ai(e,r,t));return{c(){t=M("tr");for(let e=0;e<i.length;e+=1)i[e].c();n=L(),z(t,"class","pointer svelte-14hcfjl")},m(e,r){x(e,t,r);for(let e=0;e<i.length;e+=1)i[e].m(t,null);D(t,n)},p(e,o){if(3584&o[0]){let s;for(r=e[22],s=0;s<r.length;s+=1){const a=Ai(e,r,s);i[s]?i[s].p(a,o):(i[s]=xi(a),i[s].c(),i[s].m(t,n))}for(;s<i.length;s+=1)i[s].d(1);i.length=r.length}},d(e){e&&k(t),O(i,e)}}}function xi(e){let t,n,r,i,o=e[9](e[24],e[27])+"";return{c(){t=M("td"),n=B(o),z(t,"class","svelte-14hcfjl")},m(o,s){x(o,t,s),D(t,n),r||(i=V(t,"click",W(e[10](e[24]))),r=!0)},p(t,n){e=t},d(e){e&&k(t),r=!1,i()}}}function ki(e){let t,n=e[13](e[24],e[22],e[1]),r=n&&Di(e);return{c(){r&&r.c(),t=F()},m(e,n){r&&r.m(e,n),x(e,t,n)},p(e,i){2&i[0]&&(n=e[13](e[24],e[22],e[1])),n?r?r.p(e,i):(r=Di(e),r.c(),r.m(t.parentNode,t)):r&&(r.d(1),r=null)},d(e){r&&r.d(e),e&&k(t)}}}function Oi(e){let t,n;return t=new e[5]({}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p:_,i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Mi(e){let t,n,r,i;t=new e[4]({});let o={ctx:e,current:null,token:null,hasCatch:!1,pending:Oi,then:Ni,catch:Si,value:23,blocks:[,,,]};return _e(e[11](),o),{c(){Ne(t.$$.fragment),n=L(),r=F(),o.block.c()},m(e,s){Te(t,e,s),x(e,n,s),x(e,r,s),o.block.m(e,o.anchor=s),o.mount=()=>r.parentNode,o.anchor=r,i=!0},p(t,n){Ce(o,e=t,n)},i(e){i||($e(t.$$.fragment,e),$e(o.block),i=!0)},o(e){Ie(t.$$.fragment,e);for(let e=0;e<3;e+=1){Ie(o.blocks[e])}i=!1},d(e){Re(t,e),e&&k(n),e&&k(r),o.block.d(e),o.token=null,o=null}}}function Pi(e){let t,n;return t=new e[3]({props:{title:"Auswahl",class:"eList",$$slots:{default:[Mi]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};2&n[0]|2&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Bi(e,n,r){const i=ee(),{Dialog:o,Divider:s,Loading:a,TextField:l,Button:d}=c;let{item:u}=n,{className:f}=n,{classId:h}=n,{list:p}=n,g="",y=h+Math.floor(9e3*Math.random()+1e3).toString()+"search";const v=(e,t)=>{if(!t)return;const n=e[t.name];return"boolean"==typeof n?w(n):m(e[`_${t.name}`]||e[t.name]||"")},$=t.getSchemaByClass(f);Q(()=>{window.setTimeout(()=>{const e=document.querySelector("tr.active");e&&e.scrollIntoView({block:"end",behavior:"smooth"}),document.getElementById(y)?.focus()},200)});return e.$$set=e=>{"item"in e&&r(15,u=e.item),"className"in e&&r(16,f=e.className),"classId"in e&&r(17,h=e.classId),"list"in e&&r(0,p=e.list)},[p,g,i,o,s,a,l,d,y,v,e=>()=>i("choose",{row:e}),async()=>{const e=await $,t=e.display;let n=await tn(t,e,p);return{list:p,items:n}},({detail:{value:e}})=>{r(1,g=e)},(e,t,n)=>{if(!n)return!0;for(const r of t)if(v(e,r)?.toLowerCase()?.includes(n.toLowerCase()))return!0;return!1},()=>{r(1,g="")},u,f,h,()=>i("back"),function(e){g=e,r(1,g)}]}class Li extends xe{constructor(e){var t;super(),_i.getElementById("svelte-14hcfjl-style")||((t=M("style")).id="svelte-14hcfjl-style",t.textContent=".feather.svelte-14hcfjl.svelte-14hcfjl{position:absolute;top:2em;right:0.5em;color:#326173}.eList.svelte-14hcfjl.svelte-14hcfjl{height:fit-content;max-height:65vh;overflow-y:scroll;overflow-x:auto}.eList.svelte-14hcfjl table.svelte-14hcfjl{min-width:30vw;position:relative;width:max-content !important;max-width:50vh !important}.eList.svelte-14hcfjl table thead.svelte-14hcfjl{position:sticky;top:0;background:#326173;color:white}.eList.svelte-14hcfjl table tbody tr.svelte-14hcfjl{height:2.3em}th.svelte-14hcfjl.svelte-14hcfjl,td.svelte-14hcfjl.svelte-14hcfjl{padding-left:0.4em;padding-right:0.4em}tr.pointer.svelte-14hcfjl.svelte-14hcfjl:hover{background-color:#DAE1E5}.form--buttons.svelte-14hcfjl.svelte-14hcfjl{display:flex;gap:1em;padding:0.5em 0}",D(_i.head,t)),De(this,e,Bi,Pi,S,{item:15,className:16,classId:17,list:0},[-1,-1])}}const{document:Fi}=Ee;function Vi(e,t,n){const r=e.slice();return r[12]=t[n],r}function Ui(e,t,n){const r=e.slice();return r[4]=t[n],r}function Wi(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function zi(e){let t,n,r,i=e[8].items,o=[];for(let t=0;t<i.length;t+=1)o[t]=Xi(Ui(e,i,t));const s=e=>Ie(o[e],1,1,()=>{o[e]=null});let a=e[8].list&&Yi(e);return{c(){for(let e=0;e<o.length;e+=1)o[e].c();t=L(),a&&a.c(),n=F()},m(e,i){for(let t=0;t<o.length;t+=1)o[t].m(e,i);x(e,t,i),a&&a.m(e,i),x(e,n,i),r=!0},p(e,r){if(60655567&r[0]){let n;for(i=e[8].items,n=0;n<i.length;n+=1){const s=Ui(e,i,n);o[n]?(o[n].p(s,r),$e(o[n],1)):(o[n]=Xi(s),o[n].c(),$e(o[n],1),o[n].m(t.parentNode,t))}for(ye(),n=i.length;n<o.length;n+=1)s(n);ve()}e[8].list?a?(a.p(e,r),256&r[0]&&$e(a,1)):(a=Yi(e),a.c(),$e(a,1),a.m(n.parentNode,n)):a&&(ye(),Ie(a,1,1,()=>{a=null}),ve())},i(e){if(!r){for(let e=0;e<i.length;e+=1)$e(o[e]);$e(a),r=!0}},o(e){o=o.filter(Boolean);for(let e=0;e<o.length;e+=1)Ie(o[e]);Ie(a),r=!1},d(e){O(o,e),e&&k(t),a&&a.d(e),e&&k(n)}}}function Hi(e){let t,n,r,i;const o=[qi,ji],s=[];function a(e,t){return e[4].name!==e[15]||e[16]?"lookup"!==e[4].properties?.format?1:-1:0}return~(t=a(e))&&(n=s[t]=o[t](e)),{c(){n&&n.c(),r=F()},m(e,n){~t&&s[t].m(e,n),x(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?~t&&s[t].p(e,i):(n&&(ye(),Ie(s[l],1,1,()=>{s[l]=null}),ve()),~t?(n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),$e(n,1),n.m(r.parentNode,r)):n=null)},i(e){i||($e(n),i=!0)},o(e){Ie(n),i=!1},d(e){~t&&s[t].d(e),e&&k(r)}}}function ji(e){let t,n;return t=new Su({props:{classId:e[9],item:e[4],record:e[7],disabled:e[4].name===e[15]&&e[16]||e[0],eventId:e[6],notifyList:e[2],currency:e[3],changeValue:e[10]}}),t.$on("notify",e[18]),t.$on("multi",e[19]),t.$on("defPrep",e[20]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),256&n[0]&&(r.item=e[4]),128&n[0]&&(r.record=e[7]),257&n[0]&&(r.disabled=e[4].name===e[15]&&e[16]||e[0]),64&n[0]&&(r.eventId=e[6]),4&n[0]&&(r.notifyList=e[2]),8&n[0]&&(r.currency=e[3]),1024&n[0]&&(r.changeValue=e[10]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function qi(e){let t,n,r,i;n=new Su({props:{classId:e[9],item:e[4],record:e[7],disabled:e[0]||!!e[1],required:!0,eventId:e[6],notifyList:!0,currency:e[3],changeValue:e[10]}}),n.$on("notify",e[18]),n.$on("multi",e[19]),n.$on("defPrep",e[20]),n.$on("record",e[24]),n.$on("objRecord",e[25]);let o=e[1]&&Gi(e);return{c(){t=M("div"),Ne(n.$$.fragment),r=L(),o&&o.c(),q(t,"padding-top",".25em"),q(t,"background-color","lightyellow"),q(t,"position","relative")},m(e,s){x(e,t,s),Te(n,t,null),D(t,r),o&&o.m(t,null),i=!0},p(e,r){const i={};512&r[0]&&(i.classId=e[9]),256&r[0]&&(i.item=e[4]),128&r[0]&&(i.record=e[7]),3&r[0]&&(i.disabled=e[0]||!!e[1]),64&r[0]&&(i.eventId=e[6]),8&r[0]&&(i.currency=e[3]),1024&r[0]&&(i.changeValue=e[10]),n.$set(i),e[1]?o?(o.p(e,r),2&r[0]&&$e(o,1)):(o=Gi(e),o.c(),$e(o,1),o.m(t,null)):o&&(ye(),Ie(o,1,1,()=>{o=null}),ve())},i(e){i||($e(n.$$.fragment,e),$e(o),i=!0)},o(e){Ie(n.$$.fragment,e),Ie(o),i=!1},d(e){e&&k(t),Re(n),o&&o.d()}}}function Gi(e){let t,n,r,i,o;return n=new ot({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather2 pointer svelte-16mo2c")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[23]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function Xi(e){let t,n,r="list"!==e[4].type&&Hi(e);return{c(){r&&r.c(),t=F()},m(e,i){r&&r.m(e,i),x(e,t,i),n=!0},p(e,n){"list"!==e[4].type?r?(r.p(e,n),256&n[0]&&$e(r,1)):(r=Hi(e),r.c(),$e(r,1),r.m(t.parentNode,t)):r&&(ye(),Ie(r,1,1,()=>{r=null}),ve())},i(e){n||($e(r),n=!0)},o(e){Ie(r),n=!1},d(e){r&&r.d(e),e&&k(t)}}}function Yi(e){let t,n,r=e[8].list,i=[];for(let t=0;t<r.length;t+=1)i[t]=Ki(Vi(e,r,t));const o=e=>Ie(i[e],1,1,()=>{i[e]=null});return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=F()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);x(e,t,r),n=!0},p(e,n){if(973&n[0]){let s;for(r=e[8].list,s=0;s<r.length;s+=1){const o=Vi(e,r,s);i[s]?(i[s].p(o,n),$e(i[s],1)):(i[s]=Ki(o),i[s].c(),$e(i[s],1),i[s].m(t.parentNode,t))}for(ye(),s=r.length;s<i.length;s+=1)o(s);ve()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)$e(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)Ie(i[e]);n=!1},d(e){O(i,e),e&&k(t)}}}function Zi(e){let t,n,r,i,o;function s(t){e[31](t)}t=new e[13]({props:{text:e[12].designation}});let a={classId:e[9],list:e[12],eventId:e[6],schema:e[12].item,record:e[7],disabled:e[0],currency:e[3],update:!0};return void 0!==e[2]&&(a.notifyList=e[2]),r=new Ii({props:a}),re.push(()=>Se(r,"notifyList",s)),{c(){Ne(t.$$.fragment),n=L(),Ne(r.$$.fragment)},m(e,i){Te(t,e,i),x(e,n,i),Te(r,e,i),o=!0},p(e,n){const o={};256&n[0]&&(o.text=e[12].designation),t.$set(o);const s={};512&n[0]&&(s.classId=e[9]),256&n[0]&&(s.list=e[12]),64&n[0]&&(s.eventId=e[6]),256&n[0]&&(s.schema=e[12].item),128&n[0]&&(s.record=e[7]),1&n[0]&&(s.disabled=e[0]),8&n[0]&&(s.currency=e[3]),!i&&4&n[0]&&(i=!0,s.notifyList=e[2],ue(()=>i=!1)),r.$set(s)},i(e){o||($e(t.$$.fragment,e),$e(r.$$.fragment,e),o=!0)},o(e){Ie(t.$$.fragment,e),Ie(r.$$.fragment,e),o=!1},d(e){Re(t,e),e&&k(n),Re(r,e)}}}function Ki(e){let t,n,r="array"!==e[12].type&&Zi(e);return{c(){r&&r.c(),t=F()},m(e,i){r&&r.m(e,i),x(e,t,i),n=!0},p(e,n){"array"!==e[12].type?r?(r.p(e,n),256&n[0]&&$e(r,1)):(r=Zi(e),r.c(),$e(r,1),r.m(t.parentNode,t)):r&&(ye(),Ie(r,1,1,()=>{r=null}),ve())},i(e){n||($e(r),n=!0)},o(e){Ie(r),n=!1},d(e){r&&r.d(e),e&&k(t)}}}function Qi(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Ji(e){let t,n;return t=new Li({props:{item:e[4],className:e[5],classId:e[9],list:e[12]}}),t.$on("choose",e[21]),t.$on("back",e[22]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};16&n[0]&&(r.item=e[4]),32&n[0]&&(r.className=e[5]),512&n[0]&&(r.classId=e[9]),4096&n[0]&&(r.list=e[12]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function eo(e){let t,n,r=e[11]&&Ji(e);return{c(){r&&r.c(),t=F()},m(e,i){r&&r.m(e,i),x(e,t,i),n=!0},p(e,n){e[11]?r?(r.p(e,n),2048&n[0]&&$e(r,1)):(r=Ji(e),r.c(),$e(r,1),r.m(t.parentNode,t)):r&&(ye(),Ie(r,1,1,()=>{r=null}),ve())},i(e){n||($e(r),n=!0)},o(e){Ie(r),n=!1},d(e){r&&r.d(e),e&&k(t)}}}function to(e){let t,n,r,i,o,s,a={ctx:e,current:null,token:null,hasCatch:!1,pending:Qi,then:zi,catch:Wi,value:56,blocks:[,,,]};function l(t){e[32](t)}_e(e[17](),a),n=new e[13]({});let c={class:"tModal",noClickaway:!0,$$slots:{default:[eo]},$$scope:{ctx:e}};return void 0!==e[11]&&(c.open=e[11]),i=new e[14]({props:c}),re.push(()=>Se(i,"open",l)),{c(){a.block.c(),t=L(),Ne(n.$$.fragment),r=L(),Ne(i.$$.fragment)},m(e,o){a.block.m(e,a.anchor=o),a.mount=()=>t.parentNode,a.anchor=t,x(e,t,o),Te(n,e,o),x(e,r,o),Te(i,e,o),s=!0},p(t,n){Ce(a,e=t,n);const r={};6704&n[0]|1073741824&n[1]&&(r.$$scope={dirty:n,ctx:e}),!o&&2048&n[0]&&(o=!0,r.open=e[11],ue(()=>o=!1)),i.$set(r)},i(e){s||($e(a.block),$e(n.$$.fragment,e),$e(i.$$.fragment,e),s=!0)},o(e){for(let e=0;e<3;e+=1){Ie(a.blocks[e])}Ie(n.$$.fragment,e),Ie(i.$$.fragment,e),s=!1},d(e){a.block.d(e),a.token=null,a=null,e&&k(t),Re(n,e),e&&k(r),Re(i,e)}}}function no(e,n,r){const{Divider:i,FormField:o,Modal:s}=c,a=ee();let l,d,u,f,h,{required:m}=n,{disabled:p}=n,{readonly:g}=n,{id:w}=n,{item:y}=n,{value:v}=n,{refValue:$}=n,{currency:I}=n,{notifyList:_}=n,C={},E=[],A=[],b={},S=new Map,N=!1,T="";const R=y.checkOn,D=v,x=e=>{l.items.filter(t=>"object"==typeof(t.properties&&t.properties[e])).map(t=>{const n=t.properties[e].refItem||"",[r,i]=n.split(".");E.push({action:e,itemName:t.name,refObj:r,refName:i,op:t.properties[e].invert?"!":""})})},k=()=>{l.items.filter(e=>e.lookup).forEach(e=>{A.push({name:e.name,lookup:e.lookup})}),l.items.filter(e=>e.properties?.lookup).forEach(e=>{A.push({name:e.name,lookup:e.properties.lookup.split(":").at(-1)})})},O=async e=>{const t=E.filter(t=>t.refObj===e);if(t?.length){r(10,b={});for(const e of t){const{itemName:t,refObj:n,refName:i,op:o}=e;let{action:s}=e;if(!n)break;let a,l,c=!i&&C[n];const u=C[n];u&&i&&(c=(await xp(n,u))[i]),Array.isArray(c)&&0===c.length&&(c=!1),"!"===o&&(c=!c),"required"!==s&&"readonly"!==s||(s="required"===s?s:"disabled",setTimeout(()=>{a=`#${d} .form-field.${t} .field textarea`,l=document.querySelector(a),l||(a=`#${d} .form-field.${t} .field input`,l=document.querySelector(a)),l&&c&&l.setAttribute(s,""),l&&!c&&l.removeAttribute(s)},0)),"hidden"===s&&(a=`#${d} .form-field.${t}`,l=document.querySelector(a),l?.classList?.toggle("hidden",!!c),c&&r(10,b[t]="",b))}}};Q(()=>{M()});const M=async()=>{const e=e=>new Promise(t=>setTimeout(t,e));let t,n=0;for(;!(t=document.getElementById(d))&&++n<20;)await e(50);t&&((()=>{if(recID)return;const e=new Set;for(const t of E)e.add(t.refObj||u);Array.from(e).forEach(e=>O(e))})(),P())},P=()=>{setTimeout(()=>{Array.from(S).forEach(([e,t])=>{C[e]||r(7,C[e]=t._id,C)})},250)},B=async e=>{if(!e.value)return void F();const n={[e.itemName]:{$regex:`(?i)${e.value}`}},i=await t.getSectionView(u,n);i?.length?(r(12,T=i),r(11,N=!0)):(r(1,v=""),r(26,$=""),a("setRefValue",$))},L=()=>{r(11,N=!1)},F=()=>{r(1,v=""),r(26,$=v),r(7,C={}),a("setRefValue",$)};return e.$$set=e=>{"required"in e&&r(27,m=e.required),"disabled"in e&&r(0,p=e.disabled),"readonly"in e&&r(28,g=e.readonly),"id"in e&&r(29,w=e.id),"item"in e&&r(4,y=e.item),"value"in e&&r(1,v=e.value),"refValue"in e&&r(26,$=e.refValue),"currency"in e&&r(3,I=e.currency),"notifyList"in e&&r(2,_=e.notifyList)},e.$$.update=()=>{268435457&e.$$.dirty[0]&&r(0,p=p||g),1073742048&e.$$.dirty[0]&&C&&a("safeReference",{record:C,class:u,event:f,taskId:h})},[p,v,_,I,y,u,f,C,l,d,b,N,T,i,s,R,D,async()=>{try{if(v){const e=await t.getTask(y.refClass,v);delete e._task,r(7,C=e),r(30,h=(await t.getTaskByDocId(e._id,!0))._id)}else r(7,C={})}catch{}return r(8,l=await t.getSchemaByClass(y.refClass)),r(9,d="form-"+l.class+Math.floor(9e3*Math.random()+1e3).toString()),r(5,u=l.class),l.identity.designation,r(6,f=l.id),["readonly","hidden","required"].map(x),k(),!0},async({detail:e})=>{const{itemName:t,value:n}=e;if(r(7,C[t]=n,C),t===R)return B(e);O(t)},async({detail:e})=>{if(!(l.input?.length&&l.input.length>1))return;if(prevSchema?.class!==l.input[0])return;const{value:n,lookup:i,view:o}=e,[s]=i.split(":"),a=(await t.getSectionView(s,{[o]:{$in:n}})).map(e=>e._id);for(const e of l.input.slice(1)){r(7,C[e]=[],C);const n=await t.getSchemaByClass(e);n.id;let i=await t.getTasks(n.id);if(i=i.data.filter(e=>"Ready"===e._task?.status&&a.includes(e[s])),i?.length){const n=i.map(e=>e._id),o=await t.getSectionView(e,{_id:{$in:n}});for(const t of o)t[e]=t._id;r(7,C[e]=o,C)}}},async({detail:{className:e,itemName:n,value:r}})=>{if(S.has(e))return;if(!0!==r&&(r=(r=[].concat(r)).some(e=>e===u)),!r)return;const i={[n]:!0},o=await t.getSectionView(e,i);o?.length&&S.set(e,o[0])},async({detail:e})=>{const n=await t.getSectionView(u,{_id:e.row._id});n?.length&&(r(1,v=n[0]._id),r(26,$=v),a("setRefValue",$),r(7,C=n[0])),L()},L,F,({detail:e})=>{r(7,C[e.itemName]=e.value,C)},({detail:e})=>{for(const t of e.items)r(7,C[e.listName][t.name]=t.value,C)},$,m,g,w,h,function(e){_=e,r(2,_)},function(e){N=e,r(11,N)}]}class ro extends xe{constructor(e){var t;super(),Fi.getElementById("svelte-16mo2c-style")||((t=M("style")).id="svelte-16mo2c-style",t.textContent=".feather2.svelte-16mo2c{position:absolute;top:1em;right:0.5em;color:#4300b0}",D(Fi.head,t)),De(this,e,no,to,S,{required:27,disabled:0,readonly:28,id:29,item:4,value:1,refValue:26,currency:3,notifyList:2},[-1,-1])}}function io(e){let t,n;return{c(){t=M("span"),n=B(e[5]),z(t,"class","item")},m(e,r){x(e,t,r),D(t,n)},p(e,t){32&t[0]&&H(n,e[5])},d(e){e&&k(t)}}}function oo(e){let t,n,r,i=e[6]&&io(e),o=e[14]&&function(e){let t,n,r,i,o;return n=new Ue({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"title","Übernehmen"),z(t,"class","pointer feather svelte-1fuww0c")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[17]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}(e);return{c(){i&&i.c(),t=L(),o&&o.c(),n=F()},m(e,s){i&&i.m(e,s),x(e,t,s),o&&o.m(e,s),x(e,n,s),r=!0},p(e,n){e[6]?i?i.p(e,n):(i=io(e),i.c(),i.m(t.parentNode,t)):i&&(i.d(1),i=null),e[14]&&o.p(e,n)},i(e){r||($e(o),r=!0)},o(e){Ie(o),r=!1},d(e){i&&i.d(e),e&&k(t),o&&o.d(e),e&&k(n)}}}function so(e){let t,n,r;return n=new e[10]({props:{withItem:!0,itemLeft:!0,lang:e[11].id,class:"left",type:"string",inputClass:"txt-right"+(e[1]?"":" "+e[2]),id:e[0],name:e[0],value:e[9],step:e[12],pattern:e[7],placeholder:e[13],readonly:e[8],disabled:e[3],required:e[4],$$slots:{default:[oo]},$$scope:{ctx:e}}}),n.$on("change",e[15]),n.$on("focus",e[16]),{c(){t=M("div"),Ne(n.$$.fragment),q(t,"position","relative"),q(t,"max-width","10em")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p(e,t){const r={};6&t[0]&&(r.inputClass="txt-right"+(e[1]?"":" "+e[2])),1&t[0]&&(r.id=e[0]),1&t[0]&&(r.name=e[0]),512&t[0]&&(r.value=e[9]),128&t[0]&&(r.pattern=e[7]),256&t[0]&&(r.readonly=e[8]),8&t[0]&&(r.disabled=e[3]),16&t[0]&&(r.required=e[4]),96&t[0]|256&t[1]&&(r.$$scope={dirty:t,ctx:e}),n.$set(r)},i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function ao(e,t,r){const i=ee(),{TextField:o}=c;let{id:s}=t,{item:a}=t,{value:l}=t,{noForm:d=!1}=t,{classId:u}=t,{disabled:f}=t,{formnovalidate:h}=t,{currency:m}=t,{ownCurrency:p}=t,{praefix:g}=t,{notifyList:w}=t;const y=JSON.parse(n.getItem("Locale"));let v=m,$=["price","amount","amountValue","taxValue","total","__total"].find(e=>e===a.name?.split("-")[0])||a.properties?.currency;!1===a.properties?.currency&&($=!1),"owner.currency"===a.properties?.currency&&(v=p);const I=Number("1.1").toLocaleString(y.id).substring(1,2),{properties:_={}}=a;let{min:C,max:E,step:A,pattern:b,decimals:S=0,unit:N="",placeholder:T,hint:R,readonly:D,negative:x,required:k=!1,transfer:O}=_,M="";$&&(S=2),l=l?Number(l.toString().replace(",",".")):0,D=!0===D||void 0;const P=e=>function(e,t){return(+(Math.round(e+"e+"+t)+"e-"+t)).toFixed(t)}(Number(e.toString()),S).replace(".",I);b||(b=S?`[0-9]+([${I}][0-9]{1,${S}})?`:"[0-9]*"),x&&(b="-?"+b);return e.$$set=e=>{"id"in e&&r(0,s=e.id),"item"in e&&r(19,a=e.item),"value"in e&&r(18,l=e.value),"noForm"in e&&r(1,d=e.noForm),"classId"in e&&r(2,u=e.classId),"disabled"in e&&r(3,f=e.disabled),"formnovalidate"in e&&r(20,h=e.formnovalidate),"currency"in e&&r(21,m=e.currency),"ownCurrency"in e&&r(22,p=e.ownCurrency),"praefix"in e&&r(23,g=e.praefix),"notifyList"in e&&r(24,w=e.notifyList)},e.$$.update=()=>{6815744&e.$$.dirty[0]&&m&&("owner.currency"===a.properties?.currency?r(5,v=p):r(5,v=m)),1048592&e.$$.dirty[0]&&r(4,k=k&&!h),262144&e.$$.dirty[0]&&(e=>{r(9,M=P((e||"0").toString().replace(",",".")))})(l),16777216&e.$$.dirty[0]&&(async()=>{const e=a.properties?.value?.formula;if(e)void 0!==g&&""!==g?e?.operator?.multiply&&i("formula",{item:a}):e?.operator&&i("formula",{item:a})})()},[s,d,u,f,k,v,$,b,D,M,o,y,A,T,O,({detail:e})=>{void 0!==g&&""!==g||i("formula",{item:a,value:e.value}),i("blur",{value:P(e.value)})},({detail:e})=>{D||+l||r(9,M="")},({detail:e})=>{const t=[].concat(O.target);if(void 0===g||""===g)for(const e of t)i("record",{itemName:e,value:l});else for(const e of t)i("listRecord",{itemName:e,decimals:a.properties?.decimals,value:l})},l,a,h,m,p,g,w]}class lo extends xe{constructor(e){var t;super(),document.getElementById("svelte-1fuww0c-style")||((t=M("style")).id="svelte-1fuww0c-style",t.textContent=".feather.svelte-1fuww0c{position:absolute;top:0.75em;right:-1em;color:#4300b0}",D(document.head,t)),De(this,e,ao,so,S,{id:0,item:19,value:18,noForm:1,classId:2,disabled:3,formnovalidate:20,currency:21,ownCurrency:22,praefix:23,notifyList:24},[-1,-1])}}const{document:co}=Ee;function uo(e){e[34]=e[36].list,e[35]=e[36].items}function fo(e,t,n){const r=e.slice();return r[37]=t[n],r[39]=n,r}function ho(e,t,n){const r=e.slice();return r[40]=t[n],r[42]=n,r}function mo(e,t,n){const r=e.slice();return r[40]=t[n],r}function po(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function go(e){let t,n,r,i,o,s,a,l,c,d,u,f,h,m,p,g,w,y,v;uo(e),n=new e[9]({props:{outline:!0,$$slots:{default:[wo]},$$scope:{ctx:e}}}),n.$on("click",e[31]);let $=!e[2]&&yo(e);function I(t){e[32](t)}let _={id:e[12]};void 0!==e[3]&&(_.value=e[3]),a=new e[7]({props:_}),re.push(()=>Se(a,"value",I)),a.$on("input",e[15]),u=new ot({props:{size:"18"}});let C=e[35]?.length&&function(e){let t,n,r,i,o=!e[2]&&$o(e),s=e[35],a=[];for(let t=0;t<s.length;t+=1)a[t]=Io(mo(e,s,t));return{c(){t=M("thead"),n=M("tr"),o&&o.c(),r=L();for(let e=0;e<a.length;e+=1)a[e].c();z(n,"class","svelte-1m010ne"),z(t,"class","svelte-1m010ne")},m(e,s){x(e,t,s),D(t,n),o&&o.m(n,null),D(n,r);for(let e=0;e<a.length;e+=1)a[e].m(n,null);i=!0},p(e,t){if(e[2]?o&&(ye(),Ie(o,1,1,()=>{o=null}),ve()):o?(o.p(e,t),4&t[0]&&$e(o,1)):(o=$o(e),o.c(),$e(o,1),o.m(n,r)),16384&t[0]){let r;for(s=e[35],r=0;r<s.length;r+=1){const i=mo(e,s,r);a[r]?a[r].p(i,t):(a[r]=Io(i),a[r].c(),a[r].m(n,null))}for(;r<a.length;r+=1)a[r].d(1);a.length=s.length}},i(e){i||($e(o),i=!0)},o(e){Ie(o),i=!1},d(e){e&&k(t),o&&o.d(),O(a,e)}}}(e),E=e[34]?.length&&function(e){let t,n,r=e[34],i=[];for(let t=0;t<r.length;t+=1)i[t]=bo(fo(e,r,t));const o=e=>Ie(i[e],1,1,()=>{i[e]=null});return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=F()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);x(e,t,r),n=!0},p(e,n){if(1138717&n[0]){let s;for(r=e[34],s=0;s<r.length;s+=1){const o=fo(e,r,s);i[s]?(i[s].p(o,n),$e(i[s],1)):(i[s]=bo(o),i[s].c(),$e(i[s],1),i[s].m(t.parentNode,t))}for(ye(),s=r.length;s<i.length;s+=1)o(s);ve()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)$e(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)Ie(i[e]);n=!1},d(e){O(i,e),e&&k(t)}}}(e);return{c(){t=M("div"),Ne(n.$$.fragment),r=L(),$&&$.c(),i=L(),o=M("div"),s=B("Suchen: "),Ne(a.$$.fragment),c=L(),d=M("span"),Ne(u.$$.fragment),f=L(),h=M("div"),m=M("table"),C&&C.c(),p=L(),g=M("tbody"),E&&E.c(),z(t,"class","form--buttons svelte-1m010ne"),z(d,"class","feather pointer svelte-1m010ne"),q(o,"margin-bottom","1em"),q(o,"position","relative"),z(m,"striped",""),z(m,"class","svelte-1m010ne"),z(h,"class","eList svelte-1m010ne")},m(l,I){x(l,t,I),Te(n,t,null),D(t,r),$&&$.m(t,null),x(l,i,I),x(l,o,I),D(o,s),Te(a,o,null),D(o,c),D(o,d),Te(u,d,null),x(l,f,I),x(l,h,I),D(h,m),C&&C.m(m,null),D(m,p),D(m,g),E&&E.m(g,null),w=!0,y||(v=V(d,"click",e[17]),y=!0)},p(e,r){uo(e);const i={};16384&r[1]&&(i.$$scope={dirty:r,ctx:e}),n.$set(i),e[2]?$&&(ye(),Ie($,1,1,()=>{$=null}),ve()):$?($.p(e,r),4&r[0]&&$e($,1)):($=yo(e),$.c(),$e($,1),$.m(t,null));const o={};!l&&8&r[0]&&(l=!0,o.value=e[3],ue(()=>l=!1)),a.$set(o),e[35]?.length&&C.p(e,r),e[34]?.length&&E.p(e,r)},i(e){w||($e(n.$$.fragment,e),$e($),$e(a.$$.fragment,e),$e(u.$$.fragment,e),$e(C),$e(E),w=!0)},o(e){Ie(n.$$.fragment,e),Ie($),Ie(a.$$.fragment,e),Ie(u.$$.fragment,e),Ie(C),Ie(E),w=!1},d(e){e&&k(t),Re(n),$&&$.d(),e&&k(i),e&&k(o),Re(a),Re(u),e&&k(f),e&&k(h),C&&C.d(),E&&E.d(),y=!1,v()}}}function wo(e){let t;return{c(){t=B("Abbrechen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function yo(e){let t,n;return t=new e[9]({props:{disabled:!e[34].length,filled:!0,$$slots:{default:[vo]},$$scope:{ctx:e}}}),t.$on("click",e[18](e[34])),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};16384&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function vo(e){let t;return{c(){t=B("Bestätigen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function $o(e){let t,n,r,i,o;return n=new Ze({props:{size:"20"}}),{c(){t=M("th"),Ne(n.$$.fragment),z(t,"class","svelte-1m010ne")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[19](e[34])),i=!0)},p(t,n){e=t},i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function Io(e){let t,n,r=e[40]+"";return{c(){t=M("th"),n=B(r),z(t,"class","svelte-1m010ne")},m(e,r){x(e,t,r),D(t,n)},p:_,d(e){e&&k(t)}}}function _o(e){let t,n,r,i,o,s,a,l=e[0],c=Eo(e),d=e[35],u=[];for(let t=0;t<d.length;t+=1)u[t]=Ao(ho(e,d,t));return{c(){t=M("tr"),c.c(),n=L();for(let e=0;e<u.length;e+=1)u[e].c();r=L(),z(t,"style",i=e[2]?"cursor: default;":"cursor: zoom-in;"),z(t,"title","übernimmt den Wert direkt"),z(t,"class","svelte-1m010ne"),G(t,"active",e[0].includes(Array.isArray(e[37])?e[37][0]:e[37]))},m(i,l){x(i,t,l),c.m(t,null),D(t,n);for(let e=0;e<u.length;e+=1)u[e].m(t,null);D(t,r),o=!0,s||(a=V(t,"click",e[20](e[37])),s=!0)},p(s,a){if(e=s,1&a[0]&&S(l,l=e[0])?(ye(),Ie(c,1,1,_),ve(),c=Eo(e),c.c(),$e(c),c.m(t,n)):c.p(e,a),16400&a[0]){let n;for(d=e[35],n=0;n<d.length;n+=1){const i=ho(e,d,n);u[n]?u[n].p(i,a):(u[n]=Ao(i),u[n].c(),u[n].m(t,r))}for(;n<u.length;n+=1)u[n].d(1);u.length=d.length}(!o||4&a[0]&&i!==(i=e[2]?"cursor: default;":"cursor: zoom-in;"))&&z(t,"style",i),16385&a[0]&&G(t,"active",e[0].includes(Array.isArray(e[37])?e[37][0]:e[37]))},i(e){o||($e(c),o=!0)},o(e){Ie(c),o=!1},d(e){e&&k(t),c.d(e),O(u,e),s=!1,a()}}}function Co(e){let t,n,r;return n=new e[11]({props:{name:e[13],data:e[39],checked:e[0].includes(Array.isArray(e[37])?e[37][0]:e[37]),round:!0}}),{c(){t=M("td"),Ne(n.$$.fragment),z(t,"title","Wählt den Wert aus"),z(t,"class","svelte-1m010ne")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p(e,t){const r={};1&t[0]&&(r.checked=e[0].includes(Array.isArray(e[37])?e[37][0]:e[37])),n.$set(r)},i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function Eo(e){let t,n,r=!e[2]&&Co(e);return{c(){r&&r.c(),t=F()},m(e,i){r&&r.m(e,i),x(e,t,i),n=!0},p(e,n){e[2]?r&&(ye(),Ie(r,1,1,()=>{r=null}),ve()):r?(r.p(e,n),4&n[0]&&$e(r,1)):(r=Co(e),r.c(),$e(r,1),r.m(t.parentNode,t))},i(e){n||($e(r),n=!0)},o(e){Ie(r),n=!1},d(e){r&&r.d(e),e&&k(t)}}}function Ao(e){let t,n,r=(Array.isArray(e[37])?e[37][e[42]]:e[4][e[39]]?e[4][e[39]][e[42]]:e[37])+"";return{c(){t=M("td"),n=B(r),z(t,"class","svelte-1m010ne")},m(e,r){x(e,t,r),D(t,n)},p(e,t){16&t[0]&&r!==(r=(Array.isArray(e[37])?e[37][e[42]]:e[4][e[39]]?e[4][e[39]][e[42]]:e[37])+"")&&H(n,r)},d(e){e&&k(t)}}}function bo(e){let t,n,r=e[16](e[37],e[3]),i=r&&_o(e);return{c(){i&&i.c(),t=F()},m(e,r){i&&i.m(e,r),x(e,t,r),n=!0},p(e,n){8&n[0]&&(r=e[16](e[37],e[3])),r?i?(i.p(e,n),8&n[0]&&$e(i,1)):(i=_o(e),i.c(),$e(i,1),i.m(t.parentNode,t)):i&&(ye(),Ie(i,1,1,()=>{i=null}),ve())},i(e){n||($e(i),n=!0)},o(e){Ie(i),n=!1},d(e){i&&i.d(e),e&&k(t)}}}function So(e){let t,n;return t=new e[6]({}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p:_,i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function No(e){let t,n,r,i;t=new e[10]({});let o={ctx:e,current:null,token:null,hasCatch:!1,pending:So,then:go,catch:po,value:36,blocks:[,,,]};return _e(e[14](),o),{c(){Ne(t.$$.fragment),n=L(),r=F(),o.block.c()},m(e,s){Te(t,e,s),x(e,n,s),x(e,r,s),o.block.m(e,o.anchor=s),o.mount=()=>r.parentNode,o.anchor=r,i=!0},p(t,n){Ce(o,e=t,n)},i(e){i||($e(t.$$.fragment,e),$e(o.block),i=!0)},o(e){Ie(t.$$.fragment,e);for(let e=0;e<3;e+=1){Ie(o.blocks[e])}i=!1},d(e){Re(t,e),e&&k(n),e&&k(r),o.block.d(e),o.token=null,o=null}}}function To(e){let t,n;return t=new e[8]({props:{title:e[1]||"Auswahl",class:"eList",$$slots:{default:[No]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};2&n[0]&&(r.title=e[1]||"Auswahl"),29&n[0]|16384&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Ro(e,n,r){const i=ee(),{Loading:o,TextField:s,Dialog:a,Button:l,Divider:d,Checkbox:u}=c;let{classId:f}=n,{id:h}=n,{designation:m}=n,{selection:p}=n,{refDoc:g}=n,{tableName:w}=n,{idName:y}=n,{target:v}=n,{view:$}=n,{unique:I}=n,{uniqueView:_}=n,{status:C}=n,{single:E}=n;p||=[];let A="",b=f+Math.floor(9e3*Math.random()+1e3).toString()+"search",S=[];const N=w+y+v+"checkbox",T=(e,t)=>e>t?1:t>e?-1:0;Q(()=>{window.setTimeout(()=>{const e=document.querySelector("tr.active");e?e.scrollIntoView({block:"end",behavior:"smooth"}):document.getElementById(b)?.focus()},200)});return e.$$set=e=>{"classId"in e&&r(22,f=e.classId),"id"in e&&r(23,h=e.id),"designation"in e&&r(1,m=e.designation),"selection"in e&&r(0,p=e.selection),"refDoc"in e&&r(24,g=e.refDoc),"tableName"in e&&r(25,w=e.tableName),"idName"in e&&r(26,y=e.idName),"target"in e&&r(21,v=e.target),"view"in e&&r(27,$=e.view),"unique"in e&&r(28,I=e.unique),"uniqueView"in e&&r(29,_=e.uniqueView),"status"in e&&r(30,C=e.status),"single"in e&&r(2,E=e.single)},[p,m,E,A,S,i,o,s,a,l,d,u,b,N,async()=>{let e=[],n=[],i={};if(r(4,S=[]),y)if($){if(h){const n=f.split("-")[1].slice(0,-4),r="input."+f+"[name='_id']",o=document.querySelector(r).value;i={[y]:h},C&&(i.$or=[{status:!0},{[n]:o}]),e=await t.getSectionView(w,i),e=e.sort((e,t)=>{const r=e=>(e[n]||"z").toString()+e[v];return T(r(e),r(t))})}}else _?h&&(i={[y]:h,status:!0},Object.entries(_).map(([e,t])=>{t?.length&&(i[e]={$in:t}),n.push(e)}),e=await t.getSectionView(w,i),e=e.sort((e,t)=>{const n=e=>(p.includes(e[v])?"0-":"1-")+e[v];return T(n(e),n(t))}),r(4,S=e.map(e=>{const t=[e[v]];return n.map(n=>t.push(e[n])),t}))):I?(e=await t.getSection(w,y,h,I),e=e.sort((e,t)=>T(e,t))):(e=await t.getSection(w,y,h,!1,C),e=e.sort((e,t)=>{const n=e=>(p.includes(e[v])?"0-":"1-")+e[v];return T(n(e),n(t))}));else i={},h&&!Array.isArray(h)&&(i._id=h),e=await t.getSectionView(w,i);const o=await t.getSchemaByClass(w),s=[];if(g){const t=o.items[0].name,n=o.items[1].name,i=o.list[0].name,s=e.find(e=>e[t]===g);e=s?s[i]:[],r(21,v=n)}let a;return e.map(e=>{let t=e[v];if(t||w!==v||(r(21,v=o.items[0].name),t=e[v]),Array.isArray(t))for(const e of t){let t=e;"string"!=typeof e&&(t=Array.from(Object.values(e)).filter(e=>!!e&&24!==e?.length).join(", ")),s.push(t||[])}else g&&(t=o.list[0].item.map(t=>e[t.name]||"")),s.push(t||[])}),a=g?o.list[0].item.map(e=>e.designation):[o.items.find(e=>e.name===v)?.designation],n=n.map(e=>o.items.find(t=>t.name===e)?.designation),{list:g?s:s.flat(),items:[...a,...n]}},({detail:{value:e}})=>{r(3,A=e)},(e,t)=>{if(!t)return!0;return!!(Array.isArray(e)?e.join(" "):e).toLowerCase().includes(t.toLowerCase())},()=>{r(3,A="")},e=>()=>{const t=document.getElementsByName(N),n=[];t.forEach((t,r)=>{t.checked&&n.push(e[+t.attributes.data.value])}),i("choose",{list:n})},e=>()=>{document.getElementsByName(N).forEach((e,t)=>{e.checked=!e.checked})},e=>t=>{if("TD"===t.target?.nodeName){const t=Array.isArray(e)?e[0]:e;E?i("choose",{list:[].concat(t)}):(r(0,p=p.includes(t)?p.filter(e=>e!==t):p.concat(t)),i("choose",{list:p}))}},v,f,h,g,w,y,$,I,_,C,()=>i("back"),function(e){A=e,r(3,A)}]}class Do extends xe{constructor(e){var t;super(),co.getElementById("svelte-1m010ne-style")||((t=M("style")).id="svelte-1m010ne-style",t.textContent=".feather.svelte-1m010ne.svelte-1m010ne{position:absolute;top:2em;right:0.5em;color:#326173}.eList.svelte-1m010ne.svelte-1m010ne{height:fit-content;max-height:65vh;overflow-y:scroll;overflow-x:auto}.eList.svelte-1m010ne table.svelte-1m010ne{min-width:30vw;position:relative;width:max-content !important;max-width:50vh !important}.eList.svelte-1m010ne table thead.svelte-1m010ne{position:sticky;top:0;background:#326173;color:white}.eList.svelte-1m010ne table tbody tr.svelte-1m010ne{height:2.3em}th.svelte-1m010ne.svelte-1m010ne,td.svelte-1m010ne.svelte-1m010ne{padding-left:0.4em;padding-right:0.4em}tr.active.svelte-1m010ne.svelte-1m010ne{color:#326173;background-color:#fcebd5}.dialog.eList{max-height:90vh}.checkbox.round > .selector{border-color:#326173 !important}.form--buttons.svelte-1m010ne.svelte-1m010ne{display:flex;gap:1em;padding:0.5em 0}",D(co.head,t)),De(this,e,Ro,To,S,{classId:22,id:23,designation:1,selection:0,refDoc:24,tableName:25,idName:26,target:21,view:27,unique:28,uniqueView:29,status:30,single:2},[-1,-1])}}const{document:xo}=Ee;function ko(e){let t,n,r,i,o,s=e[7].length+"";return{c(){t=M("span"),n=B("("),r=B(s),i=B(")"),z(t,"class",o=T(e[1]?"showNumber disabled":"showNumber")+" svelte-1rbaejz")},m(e,o){x(e,t,o),D(t,n),D(t,r),D(t,i)},p(e,n){128&n[0]&&s!==(s=e[7].length+"")&&H(r,s),2&n[0]&&o!==(o=T(e[1]?"showNumber disabled":"showNumber")+" svelte-1rbaejz")&&z(t,"class",o)},d(e){e&&k(t)}}}function Oo(e){let t;return{c(){t=M("div"),z(t,"class","load-more-options"),z(t,"slot","load-more-options-message")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Mo(e){let t,n,r,i;const o=[Lo,Bo,Po],s=[];function a(e,t){return!e[16].single&&e[7]?.length?0:e[17]?1:e[14]&&e[16].view&&e[16].maxItem?2:-1}return~(t=a(e))&&(n=s[t]=o[t](e)),{c(){n&&n.c(),r=F()},m(e,n){~t&&s[t].m(e,n),x(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?~t&&s[t].p(e,i):(n&&(ye(),Ie(s[l],1,1,()=>{s[l]=null}),ve()),~t?(n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),$e(n,1),n.m(r.parentNode,r)):n=null)},i(e){i||($e(n),i=!0)},o(e){Ie(n),i=!1},d(e){~t&&s[t].d(e),e&&k(r)}}}function Po(e){let t,n,r,i,o;return n=new Ue({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"title","Übernehmen"),z(t,"class","feather pointer svelte-1rbaejz")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[26]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function Bo(e){let t,n,r,i,o;return n=new Je({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"title",e[17].title||"Generieren"),z(t,"class","feather pointer svelte-1rbaejz")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[25]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function Lo(e){let t,n,r,i,o;return n=new ot({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"title","Löschen"),z(t,"class","feather pointer svelte-1rbaejz")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[27]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function Fo(e){let t,n,r;function i(t){e[37](t)}let o={class:"tModal",noClickaway:!0,$$slots:{default:[Vo]},$$scope:{ctx:e}};return void 0!==e[10]&&(o.open=e[10]),t=new e[11]({props:o}),re.push(()=>Se(t,"open",i)),{c(){Ne(t.$$.fragment)},m(e,n){Te(t,e,n),r=!0},p(e,r){const i={};53&r[0]|32768&r[1]&&(i.$$scope={dirty:r,ctx:e}),!n&&1024&r[0]&&(n=!0,i.open=e[10],ue(()=>n=!1)),t.$set(i)},i(e){r||($e(t.$$.fragment,e),r=!0)},o(e){Ie(t.$$.fragment,e),r=!1},d(e){Re(t,e)}}}function Vo(e){let t,n;return t=new Do({props:{classId:e[2],selection:e[0],refDoc:e[19],view:e[15],status:e[18],unique:e[16].unique&&e[4].name,uniqueView:e[16].view&&{[e[16].view]:e[5][e[16].view]},id:e[5][e[21]||e[20]],tableName:e[20],idName:e[21],designation:e[4].designation,target:e[4].name,single:e[16].single}}),t.$on("choose",e[24]),t.$on("back",e[23]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};4&n[0]&&(r.classId=e[2]),1&n[0]&&(r.selection=e[0]),16&n[0]&&(r.unique=e[16].unique&&e[4].name),32&n[0]&&(r.uniqueView=e[16].view&&{[e[16].view]:e[5][e[16].view]}),32&n[0]&&(r.id=e[5][e[21]||e[20]]),16&n[0]&&(r.designation=e[4].designation),16&n[0]&&(r.target=e[4].name),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Uo(e){let t,n,r,i,o,s,a,l,c,d=!e[16].single&&e[7]?.length&&ko(e);function u(t){e[35](t)}function f(t){e[36](t)}let h={id:e[3],name:e[3],class:e[3],readonly:e[13],disabled:e[1],required:e[6],placeholder:e[8],getOptions:Wo,minSearchLength:"3",$$slots:{"load-more-options-message":[Oo]},$$scope:{ctx:e}};void 0!==e[7]&&(h.selection=e[7]),void 0!==e[9]&&(h.maxOptions=e[9]),r=new e[12]({props:h}),re.push(()=>Se(r,"selection",u)),re.push(()=>Se(r,"maxOptions",f)),r.$on("change",e[22]);let m=!e[1]&&Mo(e),p=e[10]&&Fo(e);return{c(){t=M("div"),d&&d.c(),n=L(),Ne(r.$$.fragment),s=L(),m&&m.c(),a=L(),p&&p.c(),l=F(),q(t,"position","relative")},m(e,i){x(e,t,i),d&&d.m(t,null),D(t,n),Te(r,t,null),D(t,s),m&&m.m(t,null),x(e,a,i),p&&p.m(e,i),x(e,l,i),c=!0},p(e,s){!e[16].single&&e[7]?.length?d?d.p(e,s):(d=ko(e),d.c(),d.m(t,n)):d&&(d.d(1),d=null);const a={};8&s[0]&&(a.id=e[3]),8&s[0]&&(a.name=e[3]),8&s[0]&&(a.class=e[3]),2&s[0]&&(a.disabled=e[1]),64&s[0]&&(a.required=e[6]),256&s[0]&&(a.placeholder=e[8]),32768&s[1]&&(a.$$scope={dirty:s,ctx:e}),!i&&128&s[0]&&(i=!0,a.selection=e[7],ue(()=>i=!1)),!o&&512&s[0]&&(o=!0,a.maxOptions=e[9],ue(()=>o=!1)),r.$set(a),e[1]?m&&(ye(),Ie(m,1,1,()=>{m=null}),ve()):m?(m.p(e,s),2&s[0]&&$e(m,1)):(m=Mo(e),m.c(),$e(m,1),m.m(t,null)),e[10]?p?(p.p(e,s),1024&s[0]&&$e(p,1)):(p=Fo(e),p.c(),$e(p,1),p.m(l.parentNode,l)):p&&(ye(),Ie(p,1,1,()=>{p=null}),ve())},i(e){c||($e(r.$$.fragment,e),$e(m),$e(p),c=!0)},o(e){Ie(r.$$.fragment,e),Ie(m),Ie(p),c=!1},d(e){e&&k(t),d&&d.d(),Re(r),m&&m.d(),e&&k(a),p&&p.d(e),e&&k(l)}}}async function*Wo(e){yield[{name:e}]}function zo(e,n,r){const i=ee(),{Modal:o,Autocomplete:s}=c;let{classId:a}=n,{id:l}=n,{item:d}=n,{record:u}=n,{value:f}=n,{noForm:h=!1}=n,{disabled:m}=n,{formnovalidate:p}=n,{numberInput:g}=n,{praefix:w}=n,{toDelete:y}=n,{reqQuantity:v}=n,{notifyList:$}=n;const{properties:I={}}=d;let{placeholder:_,hint:C,readonly:E,required:A=!1,lookup:b="",view:S=!1,multi:N,max:T=1e3,generate:R=!1,status:D=!0,refDoc:x}=I;const[k,O]=b.split(":");let M=!1,P=f.map&&f.map(e=>({name:e}))||[];m||=E,m&&(_="");const B=({detail:e})=>{let t=[];e.value.map(e=>{const n=e.name?.split(",");t=t.concat(n)}),r(7,P=t.map(e=>({name:e.trim()})));const n=P.map(e=>e.name);i("blur",{value:n}),i("multi",{view:N.view,lookup:b,name:d.name,value:n})};Q(async()=>{i("multi",{view:N.view,lookup:b,name:d.name,value:f});const e=document.getElementById(l);e.classList.add(a),!E&&b&&e.addEventListener("focus",L)});const L=()=>{if(b){document.getElementById(l).blur();const e=v||T;(N.unique||P.length<e)&&r(10,M=!0)}},F=()=>{r(10,M&&=!1)},V=({detail:e})=>{const t=e.list.map(e=>Array.isArray(e)?e[0]:e);r(7,P=t.map(e=>({name:e}))),i("blur",{value:t}),i("multi",{view:N.view,lookup:b,name:d.name,value:t}),F()},U=async()=>{const e={[O]:u[O]},n=await t.getSectionView(k,e),r=Array.from({length:n.length},(e,t)=>n[t][d.name]);V({detail:{name:d.name,list:r}})},W=(e=!1)=>{if(m||!N.required)return;const t=N.maxItem;if(!t||N.unique)return;r(9,T=!1!==e?e:v||u[t]||0);const n=P?.length!=T,o=document.getElementById(l);o?.classList?.toggle("invalid",n),i("invalid",{idx:w,value:n})};return e.$$set=e=>{"classId"in e&&r(2,a=e.classId),"id"in e&&r(3,l=e.id),"item"in e&&r(4,d=e.item),"record"in e&&r(5,u=e.record),"value"in e&&r(0,f=e.value),"noForm"in e&&r(28,h=e.noForm),"disabled"in e&&r(1,m=e.disabled),"formnovalidate"in e&&r(29,p=e.formnovalidate),"numberInput"in e&&r(30,g=e.numberInput),"praefix"in e&&r(31,w=e.praefix),"toDelete"in e&&r(32,y=e.toDelete),"reqQuantity"in e&&r(33,v=e.reqQuantity),"notifyList"in e&&r(34,$=e.notifyList)},e.$$.update=()=>{48&e.$$.dirty[0]&&u&&""===u[d.name]&&r(7,P=[]),48&e.$$.dirty[0]&&u&&Array.isArray(u[d.name])&&r(7,P=u[d.name].map(e=>({name:e}))),16&e.$$.dirty[0]|2&e.$$.dirty[1]&&y&&y===d.name&&r(7,P=[]),128&e.$$.dirty[0]&&P&&(r(0,f=P.map&&P.map(e=>e.name)||[]),W()),1073741824&e.$$.dirty[0]&&((e={})=>{const{item:t,value:n,idx:r}=e;void 0!==w&&w!==r||t&&t.name===N.maxItem&&W(n)})(g),536870976&e.$$.dirty[0]&&r(6,A=A&&!p),8&e.$$.dirty[1]&&(async e=>{if(void 0===w)return;const{itemName:n,value:o}=e||{};if(o){if(d.refItem&&d.refItem?.split(".")[0]===n){let[e,n]=d.refItem.split(".");if(Array.isArray(o)){if(e=e.slice(0,-1),!o.length)return i("record",{itemName:"quantity",value:0}),void r(7,P=[]);const s={_id:{$in:o}},a=await t.getSectionView(e,s);let l=[];for(const e of a)e[n]&&(l=l.concat(e[n][0][d.name]));if(!l.length)return;i("record",{itemName:"quantity",value:l.length}),r(7,P=l.map(e=>({name:e}))),B({detail:{value:P}})}else{const s=await t.getTask(e,o);if(!s||!s[n])return;const a=s[n];if(!Array.isArray(a)&&!a.length)return;const l=a[w][d.name];i("record",{itemName:"quantity",value:l?.length||0}),r(7,P=l&&l.map(e=>({name:e})))}}if(d.refItem2&&d.refItem2?.split(".")[0]===n){let[e,n]=d.refItem2.split(".");if(Array.isArray(o))if(Array.isArray(o)){if(e=e.slice(0,-1),!o.length)return i("record",{itemName:"quantity",value:0}),void r(7,P=[]);const s={_id:{$in:o}},a=await t.getSectionView(e,s);let l=[];for(const e of a)e[n]&&(l=l.concat(e[n][0][d.name]));if(!l.length)return;i("record",{itemName:"quantity",value:l.length}),r(7,P=l.map(e=>({name:e}))),B({detail:{value:P}})}else{const s=await t.getTask(e,o);if(!s||!s[n])return;const a=s[n];if(!Array.isArray(a)&&!a.length)return;const l=a[w][d.name];i("record",{itemName:"quantity",value:l?.length||0}),r(7,P=l&&l.map(e=>({name:e})))}}setTimeout(W,250)}})($)},[f,m,a,l,d,u,A,P,_,T,M,o,s,E,b,S,N,R,D,x,k,O,B,F,V,()=>{const e=u[R.itemQuantity]||v;if(!e)return;const t=R.prefix||"",n=u[R.variable]||"",r=R.len||5,i=Array.from({length:e},(e,i)=>t+n+"-"+i.toString().padStart(r,"0"));V({detail:{name:d.name,list:i}})},async()=>{if(!0===S)return U();const e=v||u[N.maxItem];if(!e)return;let n={};O&&(n={[O]:u[O]}),D&&(n.status=!0);const r=[].concat(u[N.view]||[]);r.length&&(n[N.view]={$in:r});const i=await t.getSectionView(k,n),o=Array.from({length:e<i.length?e:i.length},(e,t)=>i[t][d.name]);V({detail:{name:d.name,list:o}})},()=>{V({detail:{name:d.name,list:[]}})},h,p,g,w,y,v,$,function(e){P=e,r(7,P),r(5,u),r(4,d),r(32,y)},function(e){T=e,r(9,T)},function(e){M=e,r(10,M)}]}class Ho extends xe{constructor(e){var t;super(),xo.getElementById("svelte-1rbaejz-style")||((t=M("style")).id="svelte-1rbaejz-style",t.textContent=".feather.svelte-1rbaejz{position:absolute;top:1em;right:0.5em;color:#4300b0}.showNumber.svelte-1rbaejz{position:absolute;display:inline-block;width:3.5em;text-align:right;top:1em;left:-4em;color:#4300b0}.showNumber.disabled.svelte-1rbaejz{color:#888 !important}.autocomplete .notice,.autocomplete .load-more-options,.autocomplete .show-on-focus,.autocomplete.disabled .chip button.btn,.autocomplete.disabled .chip+.autocomplete-field input{display:none}.autocomplete-field input.invalid{border:1px red solid !important}.autocomplete.disabled .chip{height:2.25em !important;padding-right:0.75em !important}",D(xo.head,t)),De(this,e,zo,Uo,S,{classId:2,id:3,item:4,record:5,value:0,noForm:28,disabled:1,formnovalidate:29,numberInput:30,praefix:31,toDelete:32,reqQuantity:33,notifyList:34},[-1,-1])}}function jo(e){let t,n,r;return n=new Ct({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather2 svelte-9up2nn")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function qo(e){let t,n,r,i,o;return n=new Ct({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather pointer svelte-9up2nn")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[9]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function Go(e){let t,n,r,i,o,s;n=new e[8]({props:{inputClass:e[0],disabled:e[1],formnovalidate:e[2],readonly:e[3],required:e[4],id:e[5],name:e[6],value:e[7]}}),n.$on("change",e[12]);const a=[qo,jo],l=[];function c(e,t){return e[7]?0:1}return i=c(e),o=l[i]=a[i](e),{c(){t=M("div"),Ne(n.$$.fragment),r=L(),o.c(),q(t,"position","relative")},m(e,o){x(e,t,o),Te(n,t,null),D(t,r),l[i].m(t,null),s=!0},p(e,[r]){const s={};1&r&&(s.inputClass=e[0]),2&r&&(s.disabled=e[1]),4&r&&(s.formnovalidate=e[2]),8&r&&(s.readonly=e[3]),16&r&&(s.required=e[4]),32&r&&(s.id=e[5]),64&r&&(s.name=e[6]),128&r&&(s.value=e[7]),n.$set(s);let d=i;i=c(e),i===d?l[i].p(e,r):(ye(),Ie(l[d],1,1,()=>{l[d]=null}),ve(),o=l[i],o?o.p(e,r):(o=l[i]=a[i](e),o.c()),$e(o,1),o.m(t,null))},i(e){s||($e(n.$$.fragment,e),$e(o),s=!0)},o(e){Ie(n.$$.fragment,e),Ie(o),s=!1},d(e){e&&k(t),Re(n),l[i].d()}}}const Xo=e("getMapLink",async e=>{const{street:n,houseNo:r,postcode:i,location:o,country:s}=e,a=[n&&r?n+" "+r:n,i&&o?i+" "+o:i||o||"",s&&(await t.getTask("country",s)).designation].filter(e=>!!e).join(", ");return"https://bing.com/maps/default.aspx?where1="+encodeURIComponent(a)});function Yo(e,t,n){const{TextField:r}=c;let{inputClass:i}=t,{disabled:o}=t,{formnovalidate:s}=t,{readonly:a}=t,{required:l}=t,{id:d}=t,{name:u}=t,{value:f}=t,{record:h}=t,{item:m}=t;return e.$$set=e=>{"inputClass"in e&&n(0,i=e.inputClass),"disabled"in e&&n(1,o=e.disabled),"formnovalidate"in e&&n(2,s=e.formnovalidate),"readonly"in e&&n(3,a=e.readonly),"required"in e&&n(4,l=e.required),"id"in e&&n(5,d=e.id),"name"in e&&n(6,u=e.name),"value"in e&&n(7,f=e.value),"record"in e&&n(10,h=e.record),"item"in e&&n(11,m=e.item)},[i,o,s,a,l,d,u,f,r,async()=>{if(!f)return;const e=u.includes(".")?h[u.split(".")[0]]:h,t=await Xo(e);window.open(t,"_blank")},h,m,function(t){te(e,t)}]}class Zo extends xe{constructor(e){var t;super(),document.getElementById("svelte-9up2nn-style")||((t=M("style")).id="svelte-9up2nn-style",t.textContent=".feather.svelte-9up2nn{position:absolute;top:0.75em;left:0.5em;color:#4300b0;margin-left:-2em}.feather2.svelte-9up2nn{position:absolute;top:0.75em;left:0.5em;color:light-gray;margin-left:-2em}",D(document.head,t)),De(this,e,Yo,Go,S,{inputClass:0,disabled:1,formnovalidate:2,readonly:3,required:4,id:5,name:6,value:7,record:10,item:11})}}const{document:Ko}=Ee;function Qo(e){let t;return{c(){t=M("div"),z(t,"class","load-more-options"),z(t,"slot","load-more-options-message")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Jo(e){let t,n,r;return n=new Ct({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather2 svelte-wpjws5")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function es(e){let t,n,r,i,o;return n=new Ct({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather pointer svelte-wpjws5")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[8]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function ts(e){let t,n,r,i,o,s,a;function l(t){e[17](t)}function c(t){e[18](t)}function d(t){e[19](t)}let u={id:e[1],name:e[1],class:e[1],minSearchLength:"1",maxOptions:"1",getOptions:e[7],$$slots:{"load-more-options-message":[Qo]},$$scope:{ctx:e}};void 0!==e[0]&&(u.value=e[0]),void 0!==e[2]&&(u.selection=e[2]),void 0!==e[3]&&(u.searchQuery=e[3]),n=new e[4]({props:u}),re.push(()=>Se(n,"value",l)),re.push(()=>Se(n,"selection",c)),re.push(()=>Se(n,"searchQuery",d)),n.$on("change",e[6]);let f=e[5]&&function(e){let t,n,r,i;const o=[es,Jo],s=[];function a(e,t){return e[0]?0:1}return t=a(e),n=s[t]=o[t](e),{c(){n.c(),r=F()},m(e,n){s[t].m(e,n),x(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?s[t].p(e,i):(ye(),Ie(s[l],1,1,()=>{s[l]=null}),ve(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),$e(n,1),n.m(r.parentNode,r))},i(e){i||($e(n),i=!0)},o(e){Ie(n),i=!1},d(e){s[t].d(e),e&&k(r)}}}(e);return{c(){t=M("div"),Ne(n.$$.fragment),s=L(),f&&f.c(),q(t,"position","relative"),z(t,"class","inputAutoComplete")},m(e,r){x(e,t,r),Te(n,t,null),D(t,s),f&&f.m(t,null),a=!0},p(e,t){const s={};2&t[0]&&(s.id=e[1]),2&t[0]&&(s.name=e[1]),2&t[0]&&(s.class=e[1]),32&t[1]&&(s.$$scope={dirty:t,ctx:e}),!r&&1&t[0]&&(r=!0,s.value=e[0],ue(()=>r=!1)),!i&&4&t[0]&&(i=!0,s.selection=e[2],ue(()=>i=!1)),!o&&8&t[0]&&(o=!0,s.searchQuery=e[3],ue(()=>o=!1)),n.$set(s),e[5]&&f.p(e,t)},i(e){a||($e(n.$$.fragment,e),$e(f),a=!0)},o(e){Ie(n.$$.fragment,e),Ie(f),a=!1},d(e){e&&k(t),Re(n),f&&f.d()}}}function ns(e,t,n){const{Autocomplete:r}=c,i=ee();let{classId:o}=t,{id:s}=t,{item:a}=t,{name:l}=t,{listName:d}=t,{record:u}=t,{value:f}=t,{noForm:h=!1}=t,{disabled:m}=t,{formnovalidate:p}=t,{autocomplete:{input:g,min:w,url:y,output:v},format:$}=a.properties;y="https://openplzapi.org/";const I=[].concat(g),{name:_}=v,C="map"===$;let E,A=f,b=!1;Q(()=>{const e=document.querySelector("."+a.name+" .autocomplete input");e&&(e.addEventListener("focus",T),e.addEventListener("keyup",N),e.addEventListener("keydown",S));const t=document.getElementById(s);t&&t.classList.add(o)});const S=e=>{b=8===e.keyCode||32===e.keyCode},N=e=>{8===e.keyCode&&""===A&&n(0,f="")},T=async()=>{if(w){const e=I[0].name;if((d?u[d][e]:u[e]).length<w)return}const e=await R();if(e?.length)if(1===e.length){if(f.startsWith(e[0].name))return;n(3,A=n(0,f=e[0].name)),x(f)}else e.find(e=>(A||"").startsWith(e.name))||f||n(3,A=" ");else n(0,f=n(3,A=""))},R=async(e="")=>{const t=await(async()=>{const e=d?u[d].country:u.country;if(e){const t=await xp("country",e);if(t?.countryCode)return t.countryCode?.toLowerCase()}return"ch"})();let n="Streets";"postalCode"===I[0].refItem&&(n="Localities");const r=await fetch(y+t+"/"+n+"?"+D()+"&name=%5E"+e.trim());if(!r.ok)return;const i=r.headers.get("Content-Type").split(";")[0];let o=[];try{if("text/json"===i){const e=await r.text();o=JSON.parse(e||[])}else"application/json"===i&&(o=await r.json())}catch{}return o=o.filter((e,t,n)=>n.findIndex(t=>t.name===e.name)===t),o.map(e=>({name:e[_]}))},D=()=>I.map(({name:e,refItem:t})=>`${t}=${(d?u[d][e]:u[e]).split(" ")[0]}`).join("&"),x=e=>{i("blur",{value:e})};return e.$$set=e=>{"classId"in e&&n(9,o=e.classId),"id"in e&&n(1,s=e.id),"item"in e&&n(10,a=e.item),"name"in e&&n(11,l=e.name),"listName"in e&&n(12,d=e.listName),"record"in e&&n(13,u=e.record),"value"in e&&n(0,f=e.value),"noForm"in e&&n(14,h=e.noForm),"disabled"in e&&n(15,m=e.disabled),"formnovalidate"in e&&n(16,p=e.formnovalidate)},[f,s,E,A,r,C,({detail:{value:e}})=>{e.length&&n(3,A=n(0,f=e[0].name)),n(2,E=[]),x(f)},async function*(e){if(b||f&&e.startsWith(f))return n(0,f=e),void x(f);const t=await R(e);if(!t?.length)return n(0,f=e),void x(f);1===t.length?(n(3,A=n(0,f=t[0].name)),n(2,E=[]),x(f)):yield t},async()=>{if(!f)return;const e=l.includes(".")?u[l.split(".")[0]]:u,t=await Xo(e);window.open(t,"_blank")},o,a,l,d,u,h,m,p,function(e){f=e,n(0,f)},function(e){E=e,n(2,E)},function(e){A=e,n(3,A)}]}class rs extends xe{constructor(e){var t;super(),Ko.getElementById("svelte-wpjws5-style")||((t=M("style")).id="svelte-wpjws5-style",t.textContent=".feather.svelte-wpjws5{position:absolute;top:1em;left:0.5em;color:#4300b0;margin-left:-2em}.feather2.svelte-wpjws5{position:absolute;top:1em;left:0.5em;color:light-gray;margin-left:-2em}.inputAutoComplete .autocomplete .chip,.inputAutoComplete .autocomplete .shown-on-focus{display:none !important}",D(Ko.head,t)),De(this,e,ns,ts,S,{classId:9,id:1,item:10,name:11,listName:12,record:13,value:0,noForm:14,disabled:15,formnovalidate:16},[-1,-1])}}const{document:is}=Ee;function os(e){e[26]=e[28].list,e[27]=e[28].items}function ss(e,t,n){const r=e.slice();return r[29]=t[n],r}function as(e,t,n){const r=e.slice();return r[32]=t[n],r}function ls(e,t,n){const r=e.slice();return r[32]=t[n],r}function cs(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function ds(e){let t,n,r,i,o,s,a,l,c,d,u,f,h,m,p,g,w,y;function v(t){e[23](t)}os(e),n=new e[7]({props:{outline:!0,$$slots:{default:[us]},$$scope:{ctx:e}}}),n.$on("click",e[22]);let $={id:e[8]};void 0!==e[1]&&($.value=e[1]),s=new e[6]({props:$}),re.push(()=>Se(s,"value",v)),s.$on("input",e[12]),d=new ot({props:{size:"18"}});let I=e[27]?.length&&function(e){let t,n,r=e[27],i=[];for(let t=0;t<r.length;t+=1)i[t]=fs(ls(e,r,t));return{c(){t=M("thead"),n=M("tr");for(let e=0;e<i.length;e+=1)i[e].c();z(n,"class","svelte-14hcfjl"),z(t,"class","svelte-14hcfjl")},m(e,r){x(e,t,r),D(t,n);for(let e=0;e<i.length;e+=1)i[e].m(n,null)},p(e,t){if(2048&t[0]){let o;for(r=e[27],o=0;o<r.length;o+=1){const s=ls(e,r,o);i[o]?i[o].p(s,t):(i[o]=fs(s),i[o].c(),i[o].m(n,null))}for(;o<i.length;o+=1)i[o].d(1);i.length=r.length}},d(e){e&&k(t),O(i,e)}}}(e),_=e[26]?.length&&function(e){let t,n=e[26],r=[];for(let t=0;t<n.length;t+=1)r[t]=ps(ss(e,n,t));return{c(){for(let e=0;e<r.length;e+=1)r[e].c();t=F()},m(e,n){for(let t=0;t<r.length;t+=1)r[t].m(e,n);x(e,t,n)},p(e,i){if(11779&i[0]){let o;for(n=e[26],o=0;o<n.length;o+=1){const s=ss(e,n,o);r[o]?r[o].p(s,i):(r[o]=ps(s),r[o].c(),r[o].m(t.parentNode,t))}for(;o<r.length;o+=1)r[o].d(1);r.length=n.length}},d(e){O(r,e),e&&k(t)}}}(e);return{c(){t=M("div"),Ne(n.$$.fragment),r=L(),i=M("div"),o=B("Suchen: "),Ne(s.$$.fragment),l=L(),c=M("span"),Ne(d.$$.fragment),u=L(),f=M("div"),h=M("table"),I&&I.c(),m=L(),p=M("tbody"),_&&_.c(),z(t,"class","form--buttons svelte-14hcfjl"),z(c,"class","feather pointer svelte-14hcfjl"),q(i,"margin-bottom","1em"),q(i,"position","relative"),z(h,"striped",""),z(h,"class","svelte-14hcfjl"),z(f,"class","eList svelte-14hcfjl")},m(a,v){x(a,t,v),Te(n,t,null),x(a,r,v),x(a,i,v),D(i,o),Te(s,i,null),D(i,l),D(i,c),Te(d,c,null),x(a,u,v),x(a,f,v),D(f,h),I&&I.m(h,null),D(h,m),D(h,p),_&&_.m(p,null),g=!0,w||(y=V(c,"click",e[14]),w=!0)},p(e,t){os(e);const r={};64&t[1]&&(r.$$scope={dirty:t,ctx:e}),n.$set(r);const i={};!a&&2&t[0]&&(a=!0,i.value=e[1],ue(()=>a=!1)),s.$set(i),e[27]?.length&&I.p(e,t),e[26]?.length&&_.p(e,t)},i(e){g||($e(n.$$.fragment,e),$e(s.$$.fragment,e),$e(d.$$.fragment,e),g=!0)},o(e){Ie(n.$$.fragment,e),Ie(s.$$.fragment,e),Ie(d.$$.fragment,e),g=!1},d(e){e&&k(t),Re(n),e&&k(r),e&&k(i),Re(s),Re(d),e&&k(u),e&&k(f),I&&I.d(),_&&_.d(),w=!1,y()}}}function us(e){let t;return{c(){t=B("Abbrechen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function fs(e){let t,n,r=e[32]?.designation+"";return{c(){t=M("th"),n=B(r),z(t,"class","svelte-14hcfjl")},m(e,r){x(e,t,r),D(t,n)},p:_,d(e){e&&k(t)}}}function hs(e){let t,n,r=e[27],i=[];for(let t=0;t<r.length;t+=1)i[t]=ms(as(e,r,t));return{c(){t=M("tr");for(let e=0;e<i.length;e+=1)i[e].c();n=L(),z(t,"class","pointer svelte-14hcfjl"),G(t,"active",e[29]._id===e[0])},m(e,r){x(e,t,r);for(let e=0;e<i.length;e+=1)i[e].m(t,null);D(t,n)},p(e,o){if(3584&o[0]){let s;for(r=e[27],s=0;s<r.length;s+=1){const a=as(e,r,s);i[s]?i[s].p(a,o):(i[s]=ms(a),i[s].c(),i[s].m(t,n))}for(;s<i.length;s+=1)i[s].d(1);i.length=r.length}2049&o[0]&&G(t,"active",e[29]._id===e[0])},d(e){e&&k(t),O(i,e)}}}function ms(e){let t,n,r,i,o=e[9](e[29],e[32])+"";return{c(){t=M("td"),n=B(o),z(t,"class","svelte-14hcfjl")},m(o,s){x(o,t,s),D(t,n),r||(i=V(t,"click",W(e[10](e[29]))),r=!0)},p(t,n){e=t},d(e){e&&k(t),r=!1,i()}}}function ps(e){let t,n=e[13](e[29],e[27],e[1]),r=n&&hs(e);return{c(){r&&r.c(),t=F()},m(e,n){r&&r.m(e,n),x(e,t,n)},p(e,i){2&i[0]&&(n=e[13](e[29],e[27],e[1])),n?r?r.p(e,i):(r=hs(e),r.c(),r.m(t.parentNode,t)):r&&(r.d(1),r=null)},d(e){r&&r.d(e),e&&k(t)}}}function gs(e){let t,n;return t=new e[5]({}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p:_,i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function ws(e){let t,n,r,i;t=new e[4]({});let o={ctx:e,current:null,token:null,hasCatch:!1,pending:gs,then:ds,catch:cs,value:28,blocks:[,,,]};return _e(e[11](),o),{c(){Ne(t.$$.fragment),n=L(),r=F(),o.block.c()},m(e,s){Te(t,e,s),x(e,n,s),x(e,r,s),o.block.m(e,o.anchor=s),o.mount=()=>r.parentNode,o.anchor=r,i=!0},p(t,n){Ce(o,e=t,n)},i(e){i||($e(t.$$.fragment,e),$e(o.block),i=!0)},o(e){Ie(t.$$.fragment,e);for(let e=0;e<3;e+=1){Ie(o.blocks[e])}i=!1},d(e){Re(t,e),e&&k(n),e&&k(r),o.block.d(e),o.token=null,o=null}}}function ys(e){let t,n;return t=new e[3]({props:{title:"Auswahl",class:"eList",$$slots:{default:[ws]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};3&n[0]|64&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function vs(e,n,i){const o=ee(),{Dialog:s,Divider:a,Loading:l,TextField:d,Button:u}=c;let{item:f}=n,{className:h}=n,{classId:p}=n,{rowId:g}=n,{viewName:y}=n,{viewValue:v}=n,{recordId:$}=n,{filter:I}=n,_="",C=p+Math.floor(9e3*Math.random()+1e3).toString()+"search";const E=(e,t)=>{if(!t)return;const n=e[t.name];return"boolean"==typeof n?w(n):m(e[`_${t.name}`]||e[t.name]||"")},A=t.getSchemaByClass(h);Q(()=>{window.setTimeout(()=>{const e=document.querySelector("tr.active");e&&e.scrollIntoView({block:"end",behavior:"smooth"}),document.getElementById(C)?.focus()},200)}),r.subscribe(async e=>{if(!e)return;const t=await A;e.eventId===t.id&&kp(t.class,e.eventId)});return e.$$set=e=>{"item"in e&&i(15,f=e.item),"className"in e&&i(16,h=e.className),"classId"in e&&i(17,p=e.classId),"rowId"in e&&i(0,g=e.rowId),"viewName"in e&&i(18,y=e.viewName),"viewValue"in e&&i(19,v=e.viewValue),"recordId"in e&&i(20,$=e.recordId),"filter"in e&&i(21,I=e.filter)},[g,_,o,s,a,l,d,u,C,E,e=>()=>o("choose",{row:e}),async()=>{const e=await A,n="."+p+"#"+y;document.querySelector(n);let r={[y]:v},i=[];r[y]&&(i=await t.getSectionView(e.class,r,!0)),I&&(i=i.filter(e=>e._id!=I));const o=e.display;return{list:i,items:await tn(o,e,i)}},({detail:{value:e}})=>{i(1,_=e)},(e,t,n)=>{if(!n)return!0;for(const r of t)if(E(e,r)?.toLowerCase()?.includes(n.toLowerCase()))return!0;return!1},()=>{i(1,_="")},f,h,p,y,v,$,I,()=>o("back"),function(e){_=e,i(1,_)}]}class $s extends xe{constructor(e){var t;super(),is.getElementById("svelte-14hcfjl-style")||((t=M("style")).id="svelte-14hcfjl-style",t.textContent=".feather.svelte-14hcfjl.svelte-14hcfjl{position:absolute;top:2em;right:0.5em;color:#326173}.eList.svelte-14hcfjl.svelte-14hcfjl{height:fit-content;max-height:65vh;overflow-y:scroll;overflow-x:auto}.eList.svelte-14hcfjl table.svelte-14hcfjl{min-width:30vw;position:relative;width:max-content !important;max-width:50vh !important}.eList.svelte-14hcfjl table thead.svelte-14hcfjl{position:sticky;top:0;background:#326173;color:white}.eList.svelte-14hcfjl table tbody tr.svelte-14hcfjl{height:2.3em}th.svelte-14hcfjl.svelte-14hcfjl,td.svelte-14hcfjl.svelte-14hcfjl{padding-left:0.4em;padding-right:0.4em}tr.pointer.svelte-14hcfjl.svelte-14hcfjl:hover{background-color:#DAE1E5}tr.active.svelte-14hcfjl.svelte-14hcfjl{color:#326173;background-color:#fcebd5}.form--buttons.svelte-14hcfjl.svelte-14hcfjl{display:flex;gap:1em;padding:0.5em 0}",D(is.head,t)),De(this,e,vs,ys,S,{item:15,className:16,classId:17,rowId:0,viewName:18,viewValue:19,recordId:20,filter:21},[-1,-1])}}function Is(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function _s(e){let t,n,r,i,o;function s(t){e[21](t)}let a={id:e[2],name:e[3].name,inputClass:e[5]||e[1],disabled:e[6],formnovalidate:e[7],readonly:e[13],pattern:e[12],required:e[14],style:"padding-left:2em;"};void 0!==e[0]&&(a.value=e[0]),n=new e[10]({props:a}),re.push(()=>Se(n,"value",s));let l=!e[6]&&Cs(e);return{c(){t=M("div"),Ne(n.$$.fragment),i=L(),l&&l.c(),q(t,"position","relative")},m(e,r){x(e,t,r),Te(n,t,null),D(t,i),l&&l.m(t,null),o=!0},p(e,i){const o={};4&i&&(o.id=e[2]),8&i&&(o.name=e[3].name),34&i&&(o.inputClass=e[5]||e[1]),64&i&&(o.disabled=e[6]),128&i&&(o.formnovalidate=e[7]),!r&&1&i&&(r=!0,o.value=e[0],ue(()=>r=!1)),n.$set(o),e[6]?l&&(ye(),Ie(l,1,1,()=>{l=null}),ve()):l?(l.p(e,i),64&i&&$e(l,1)):(l=Cs(e),l.c(),$e(l,1),l.m(t,null))},i(e){o||($e(n.$$.fragment,e),$e(l),o=!0)},o(e){Ie(n.$$.fragment,e),Ie(l),o=!1},d(e){e&&k(t),Re(n),l&&l.d()}}}function Cs(e){let t,n,r,i,o;return n=new Mt({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather pointer svelte-wbrqzu")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[17]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function Es(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function As(e){let t,n,r;function i(t){e[22](t)}let o={class:"tModal",noClickaway:!0,$$slots:{default:[bs]},$$scope:{ctx:e}};return void 0!==e[8]&&(o.open=e[8]),t=new e[11]({props:o}),re.push(()=>Se(t,"open",i)),{c(){Ne(t.$$.fragment)},m(e,n){Te(t,e,n),r=!0},p(e,r){const i={};268435994&r&&(i.$$scope={dirty:r,ctx:e}),!n&&256&r&&(n=!0,i.open=e[8],ue(()=>n=!1)),t.$set(i)},i(e){r||($e(t.$$.fragment,e),r=!0)},o(e){Ie(t.$$.fragment,e),r=!1},d(e){Re(t,e)}}}function bs(e){let t,n;return t=new $s({props:{item:e[3],className:e[3].refClass,classId:e[1],rowId:"",recordId:e[4]._id,viewName:e[15].selection,viewValue:e[9],filter:e[4]._id}}),t.$on("choose",e[18]),t.$on("back",e[19]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};8&n&&(r.item=e[3]),8&n&&(r.className=e[3].refClass),2&n&&(r.classId=e[1]),16&n&&(r.recordId=e[4]._id),512&n&&(r.viewValue=e[9]),16&n&&(r.filter=e[4]._id),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Ss(e){let t,n,r,i={ctx:e,current:null,token:null,hasCatch:!1,pending:Es,then:_s,catch:Is,value:27,blocks:[,,,]};_e(e[16](),i);let o=e[8]&&As(e);return{c(){i.block.c(),t=L(),o&&o.c(),n=F()},m(e,s){i.block.m(e,i.anchor=s),i.mount=()=>t.parentNode,i.anchor=t,x(e,t,s),o&&o.m(e,s),x(e,n,s),r=!0},p(t,[r]){Ce(i,e=t,r),e[8]?o?(o.p(e,r),256&r&&$e(o,1)):(o=As(e),o.c(),$e(o,1),o.m(n.parentNode,n)):o&&(ye(),Ie(o,1,1,()=>{o=null}),ve())},i(e){r||($e(i.block),$e(o),r=!0)},o(e){for(let e=0;e<3;e+=1){Ie(i.blocks[e])}Ie(o),r=!1},d(e){i.block.d(e),i.token=null,i=null,e&&k(t),o&&o.d(e),e&&k(n)}}}function Ns(e,t,n){const{TextField:r,Modal:i}=c;let{classId:o}=t,{id:s}=t,{item:a}=t,{record:l}=t,{value:d}=t,{noForm:u=!1}=t,{disabled:f}=t,{formnovalidate:h}=t,{praefix:m}=t;const{properties:p={}}=a;let g,{pattern:w,placeholder:y,readonly:v,required:$=!1,view:I}=p,_=!1;const C=()=>{n(8,_=!1)};return e.$$set=e=>{"classId"in e&&n(1,o=e.classId),"id"in e&&n(2,s=e.id),"item"in e&&n(3,a=e.item),"record"in e&&n(4,l=e.record),"value"in e&&n(0,d=e.value),"noForm"in e&&n(5,u=e.noForm),"disabled"in e&&n(6,f=e.disabled),"formnovalidate"in e&&n(7,h=e.formnovalidate),"praefix"in e&&n(20,m=e.praefix)},[d,o,s,a,l,u,f,h,_,g,r,i,w,v,$,I,async()=>(n(9,g=l[I.selection]),!0),()=>{n(8,_=!0)},({detail:e})=>{n(0,d=e.row[I.value?I.value:"_id"]),C()},C,m,function(e){d=e,n(0,d)},function(e){_=e,n(8,_)}]}class Ts extends xe{constructor(e){var t;super(),document.getElementById("svelte-wbrqzu-style")||((t=M("style")).id="svelte-wbrqzu-style",t.textContent=".feather.svelte-wbrqzu{position:absolute;top:0.75em;left:0.5em;color:#4300b0}",D(document.head,t)),De(this,e,Ns,Ss,S,{classId:1,id:2,item:3,record:4,value:0,noForm:5,disabled:6,formnovalidate:7,praefix:20})}}function Rs(e,t,n){const r=e.slice();return r[12]=t[n][0],r[13]=t[n][1],r}function Ds(e){let t;return{c(){t=M("option"),t.textContent="- ",t.selected=!0,t.__value="",t.value=t.__value},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function xs(e){let t;return{c(){t=M("option"),t.textContent="-- Bitte wählen -- ",t.disabled=!0,t.selected=!0,t.__value="",t.value=t.__value},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function ks(e){let t,n,r,i,o=e[12]+"";return{c(){t=M("option"),n=B(o),t.__value=r=e[13],t.value=t.__value,t.selected=i=e[0]==e[13]},m(e,r){x(e,t,r),D(t,n)},p(e,s){64&s&&o!==(o=e[12]+"")&&H(n,o),64&s&&r!==(r=e[13])&&(t.__value=r,t.value=t.__value),65&s&&i!==(i=e[0]==e[13])&&(t.selected=i)},d(e){e&&k(t)}}}function Os(e){let t,n,r,i,o,s=!e[7]&&function(e){let t;function n(e,t){return e[5]&&!0!==e[8]?xs:Ds}let r=n(e),i=r(e);return{c(){i.c(),t=F()},m(e,n){i.m(e,n),x(e,t,n)},p(e,o){r!==(r=n(e))&&(i.d(1),i=r(e),i&&(i.c(),i.m(t.parentNode,t)))},d(e){i.d(e),e&&k(t)}}}(e),a=e[6],l=[];for(let t=0;t<a.length;t+=1)l[t]=ks(Rs(e,a,t));return{c(){t=M("select"),s&&s.c(),n=F();for(let e=0;e<l.length;e+=1)l[e].c();z(t,"class",r=T(e[3]||e[4])+" svelte-5xpzvo"),z(t,"id",e[2]),z(t,"name",e[2]),t.disabled=e[1],t.required=e[5]},m(r,a){x(r,t,a),s&&s.m(t,null),D(t,n);for(let e=0;e<l.length;e+=1)l[e].m(t,null);i||(o=V(t,"change",e[9]),i=!0)},p(e,[n]){if(e[7]||s.p(e,n),65&n){let r;for(a=e[6],r=0;r<a.length;r+=1){const i=Rs(e,a,r);l[r]?l[r].p(i,n):(l[r]=ks(i),l[r].c(),l[r].m(t,null))}for(;r<l.length;r+=1)l[r].d(1);l.length=a.length}24&n&&r!==(r=T(e[3]||e[4])+" svelte-5xpzvo")&&z(t,"class",r),4&n&&z(t,"id",e[2]),4&n&&z(t,"name",e[2]),2&n&&(t.disabled=e[1]),32&n&&(t.required=e[5])},i:_,o:_,d(e){e&&k(t),s&&s.d(),O(l,e),i=!1,o()}}}function Ms(e,t,n){const r=ee();let{id:i}=t,{item:o}=t,{value:s}=t,{noForm:a=!1}=t,{classId:l}=t,{disabled:c}=t,{required:d}=t,{enum:u,regulation:f,readonly:h}=o.properties;u&&(u=u.map(e=>[e,e])),"businessMonth"===f&&(s||=1,u=[["Januar",1],["Februar",2],["März",3],["April",4],["Mai",5],["Juni",6],["Juli",7],["August",8],["September",9],["Oktober",10],["November",11],["Dezember",12]]),"financialAccounting"===f&&(s||=2024,u=[["2024/2025",2024]]),"valueAddedTax"===f&&(s||=0,u=[["0% Steuerbefreit",0],["8.1% Normalsatz",.081],["2.6% Reduzierter Satz",.026],["3.8% Beherbergung",.038]]),c||=!0===h,c||(c=void 0);return e.$$set=e=>{"id"in e&&n(2,i=e.id),"item"in e&&n(10,o=e.item),"value"in e&&n(0,s=e.value),"noForm"in e&&n(3,a=e.noForm),"classId"in e&&n(4,l=e.classId),"disabled"in e&&n(1,c=e.disabled),"required"in e&&n(5,d=e.required)},[s,c,i,a,l,d,u,f,h,e=>r("blur",{value:e.srcElement.value}),o]}class Ps extends xe{constructor(e){var t;super(),document.getElementById("svelte-5xpzvo-style")||((t=M("style")).id="svelte-5xpzvo-style",t.textContent="select.svelte-5xpzvo{padding:0 0.625em 0.0625em;box-sizing:border-box;width:100%;border:0 solid rgba(0, 0, 0, 0.42);border-bottom-width:0px;border-bottom-width:0.0625em;border-top-left-radius:0.375em;border-top-right-radius:0.375em;background-color:#f5f5f5;outline:none;font-size:1rem;font-weight:300;height:2.8em}select.svelte-5xpzvo:focus{border:none;border-bottom:2px solid #4300b0}",D(document.head,t)),De(this,e,Ms,Os,S,{id:2,item:10,value:0,noForm:3,classId:4,disabled:1,required:5})}}function Bs(e){let t,n,r,i,o,s,a,l,c;i=new e[8]({props:{id:"dp-"+e[1]+(e[2]?"-"+e[2]:""),value:e[0],readonly:e[5],required:e[7],disabled:e[6],noCalendar:e[9],closeOnSelection:!0}}),i.$on("change",e[11]);let d=e[10]&&function(e){let t,n,r,i,o;return n=new Ue({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"title","Übernehmen"),z(t,"class","pointer feather")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[12]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}(e);return{c(){t=M("input"),r=L(),Ne(i.$$.fragment),o=L(),d&&d.c(),s=F(),z(t,"type","string"),z(t,"class",n=e[3]||e[4]),z(t,"id",e[1]),z(t,"name",e[1]),t.hidden=!0},m(n,u){x(n,t,u),j(t,e[0]),x(n,r,u),Te(i,n,u),x(n,o,u),d&&d.m(n,u),x(n,s,u),a=!0,l||(c=V(t,"input",e[18]),l=!0)},p(e,[r]){(!a||24&r&&n!==(n=e[3]||e[4]))&&z(t,"class",n),(!a||2&r)&&z(t,"id",e[1]),(!a||2&r)&&z(t,"name",e[1]),1&r&&j(t,e[0]);const o={};6&r&&(o.id="dp-"+e[1]+(e[2]?"-"+e[2]:"")),1&r&&(o.value=e[0]),32&r&&(o.readonly=e[5]),128&r&&(o.required=e[7]),64&r&&(o.disabled=e[6]),i.$set(o),e[10]&&d.p(e,r)},i(e){a||($e(i.$$.fragment,e),$e(d),a=!0)},o(e){Ie(i.$$.fragment,e),Ie(d),a=!1},d(e){e&&k(t),e&&k(r),Re(i,e),e&&k(o),d&&d.d(e),e&&k(s),l=!1,c()}}}let Ls=new Map;function Fs(e,n,r){const i=ee(),{DatePicker:o}=c;let{value:s}=n,{id:a}=n,{item:l}=n,{record:d}=n,{praefix:u}=n,{noForm:f=!1}=n,{classId:h}=n,{eventId:m}=n,{readonly:p}=n,{disabled:g}=n,{required:w}=n,{notifyList:y}=n,{dateInput:v}=n;s||(s=void 0);let $=null;const I=(void 0===u?"":u.toString())+"-"+m+"-"+l.name,_=l.properties?.noCalendar||!1,C=l.properties?.transfer,E=({detail:e})=>{try{r(0,s=Yr(e.value,s)),void 0!==u&&""!==u&&Ls.set(I,new Date(s.valueOf())),A(s)}catch{r(0,s=void 0)}},A=e=>{i("change",{value:new Date(e.valueOf())})};if(void 0!==u&&!s){const e=new Date,t=new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0);s=Yr(t,s)}return e.$$set=e=>{"value"in e&&r(0,s=e.value),"id"in e&&r(1,a=e.id),"item"in e&&r(13,l=e.item),"record"in e&&r(14,d=e.record),"praefix"in e&&r(2,u=e.praefix),"noForm"in e&&r(3,f=e.noForm),"classId"in e&&r(4,h=e.classId),"eventId"in e&&r(15,m=e.eventId),"readonly"in e&&r(5,p=e.readonly),"disabled"in e&&r(6,g=e.disabled),"required"in e&&r(7,w=e.required),"notifyList"in e&&r(16,y=e.notifyList),"dateInput"in e&&r(17,v=e.dateInput)},e.$$.update=()=>{if(1&e.$$.dirty&&s&&!C&&Ls.has(I)&&r(0,s=Ls.get(I)),65536&e.$$.dirty&&(async e=>{if(null===$){const e=(await t.getEvent(m)).output.class[0].item;$=e.find(e=>e.properties?.value?.formula)}$&&$.properties.value.formula.argument[0].refItem===l.name&&(e&&e.itemName!==l.name&&!$.properties.value.formula.argument[1].value&&e.itemName!==$.properties.value.formula.argument[1].refItem.split(".")[0]||i("formula",{item:$}))})(y),131072&e.$$.dirty&&((e={})=>{let{ref:t,val:n,t:r,l:i,n:o}=e;if(o&&(n=o),!n||isNaN(new Date(n)))return;if(r)return;if(!t)return;const[s,a]=t.split(".");s===i&&a===l.name&&null!=u&&E({detail:{value:new Date(n)}})})(v),24673&e.$$.dirty&&d&&d[l.name])try{g||p||r(0,s=Yr(d[l.name],s))}catch{}},[s,a,u,f,h,p,g,w,o,_,C,E,()=>{i("record",{target:C.target,value:s.toISOString()})},l,d,m,y,v,function(){s=this.value,r(0,s),r(14,d),r(13,l),r(6,g),r(5,p)}]}class Vs extends xe{constructor(e){super(),De(this,e,Fs,Bs,S,{value:0,id:1,item:13,record:14,praefix:2,noForm:3,classId:4,eventId:15,readonly:5,disabled:6,required:7,notifyList:16,dateInput:17})}}function Us(e){let t;return{c(){t=B("Stunden")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Ws(e){let t,n;return t=new e[4]({props:{slot:"hours-label",$$slots:{default:[Us]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};4096&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function zs(e){let t;return{c(){t=B("Minuten")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Hs(e){let t,n;return t=new e[4]({props:{slot:"minutes-label",$$slots:{default:[zs]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};4096&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function js(e){let t;return{c(){t=B("Jetzt")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function qs(e){let t,n;return t=new e[4]({props:{slot:"now-label",$$slots:{default:[js]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};4096&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Gs(e){let t,n,r,i,o,s,a,l,c;return i=new e[5]({props:{value:e[0],closeOnSelection:!0}}),i.$on("change",e[8]),s=new e[6]({props:{value:e[0],$$slots:{"now-label":[qs],"minutes-label":[Hs],"hours-label":[Ws]},$$scope:{ctx:e}}}),s.$on("change",e[7]),{c(){t=M("input"),r=L(),Ne(i.$$.fragment),o=L(),Ne(s.$$.fragment),z(t,"type","string"),z(t,"class",n=e[2]||e[3]),z(t,"id",e[1]),z(t,"name",e[1]),t.hidden=!0},m(n,d){x(n,t,d),j(t,e[0]),x(n,r,d),Te(i,n,d),x(n,o,d),Te(s,n,d),a=!0,l||(c=V(t,"input",e[9]),l=!0)},p(e,[r]){(!a||12&r&&n!==(n=e[2]||e[3]))&&z(t,"class",n),(!a||2&r)&&z(t,"id",e[1]),(!a||2&r)&&z(t,"name",e[1]),1&r&&j(t,e[0]);const o={};1&r&&(o.value=e[0]),i.$set(o);const l={};1&r&&(l.value=e[0]),4096&r&&(l.$$scope={dirty:r,ctx:e}),s.$set(l)},i(e){a||($e(i.$$.fragment,e),$e(s.$$.fragment,e),a=!0)},o(e){Ie(i.$$.fragment,e),Ie(s.$$.fragment,e),a=!1},d(e){e&&k(t),e&&k(r),Re(i,e),e&&k(o),Re(s,e),l=!1,c()}}}function Xs(e,t,n){const r=ee(),{Label:i,DatePicker:o,TimePicker:s}=c;let{value:a}=t,{id:l}=t,{noForm:d=!1}=t,{classId:u}=t;const f=e=>r("change",{value:e});return e.$$set=e=>{"value"in e&&n(0,a=e.value),"id"in e&&n(1,l=e.id),"noForm"in e&&n(2,d=e.noForm),"classId"in e&&n(3,u=e.classId)},[a,l,d,u,i,o,s,({detail:e})=>{var t,r;n(0,(t=e.value,r=a,a=null==t||null==r?t:(r.setHours(t.getHours(),t.getMinutes(),t.getSeconds()),r))),f(a)},({detail:e})=>{n(0,a=Yr(e.value,a)),f(a)},function(){a=this.value,n(0,a)}]}class Ys extends xe{constructor(e){super(),De(this,e,Xs,Gs,S,{value:0,id:1,noForm:2,classId:3})}}function Zs(e){let t,n,r,i,o,s,a,l,c,d,u,f,h,m,p,g;return u=new e[9]({props:{format:e[7],required:e[3],disabled:e[4],value:e[5],noCalendar:e[10],closeOnSelection:!0}}),u.$on("change",e[11]),h=new e[9]({props:{format:e[8],required:e[3],disabled:e[4],value:e[6],noCalendar:e[10],class:"moveLeft",closeOnSelection:!0}}),h.$on("change",e[12]),{c(){t=M("input"),o=L(),s=M("input"),d=L(),Ne(u.$$.fragment),f=B(" /\n"),Ne(h.$$.fragment),z(t,"type","string"),z(t,"class",n=e[1]||e[2]),z(t,"id",r=e[0]+"_from"),z(t,"name",i=e[0]+"_from"),t.hidden=!0,z(s,"type","string"),z(s,"class",a=e[1]||e[2]),z(s,"id",l=e[0]+"_to"),z(s,"name",c=e[0]+"_to"),s.hidden=!0},m(n,r){x(n,t,r),j(t,e[5]),x(n,o,r),x(n,s,r),j(s,e[6]),x(n,d,r),Te(u,n,r),x(n,f,r),Te(h,n,r),m=!0,p||(g=[V(t,"input",e[15]),V(s,"input",e[16])],p=!0)},p(e,[o]){(!m||6&o&&n!==(n=e[1]||e[2]))&&z(t,"class",n),(!m||1&o&&r!==(r=e[0]+"_from"))&&z(t,"id",r),(!m||1&o&&i!==(i=e[0]+"_from"))&&z(t,"name",i),32&o&&j(t,e[5]),(!m||6&o&&a!==(a=e[1]||e[2]))&&z(s,"class",a),(!m||1&o&&l!==(l=e[0]+"_to"))&&z(s,"id",l),(!m||1&o&&c!==(c=e[0]+"_to"))&&z(s,"name",c),64&o&&j(s,e[6]);const d={};128&o&&(d.format=e[7]),8&o&&(d.required=e[3]),16&o&&(d.disabled=e[4]),32&o&&(d.value=e[5]),u.$set(d);const f={};256&o&&(f.format=e[8]),8&o&&(f.required=e[3]),16&o&&(f.disabled=e[4]),64&o&&(f.value=e[6]),h.$set(f)},i(e){m||($e(u.$$.fragment,e),$e(h.$$.fragment,e),m=!0)},o(e){Ie(u.$$.fragment,e),Ie(h.$$.fragment,e),m=!1},d(e){e&&k(t),e&&k(o),e&&k(s),e&&k(d),Re(u,e),e&&k(f),Re(h,e),p=!1,A(g)}}}function Ks(e,t,n){const r=ee(),{DatePicker:i}=c;let{value:o}=t,{id:s}=t,{item:a}=t,{noForm:l=!1}=t,{classId:d}=t,{required:u}=t,{disabled:f}=t;const{noCalendar:h,preset:m}=a.properties||{};let p,g,w="%d.%m.%Y",y="%d.%m.%Y";return e.$$set=e=>{"value"in e&&n(13,o=e.value),"id"in e&&n(0,s=e.id),"item"in e&&n(14,a=e.item),"noForm"in e&&n(1,l=e.noForm),"classId"in e&&n(2,d=e.classId),"required"in e&&n(3,u=e.required),"disabled"in e&&n(4,f=e.disabled)},e.$$.update=()=>{if(8304&e.$$.dirty&&o){if((o?.from||o?.to)&&(n(5,p=o?.from),n(6,g=o?.to)),m){const{first:e,last:t}=function(e){const t=new Date;let n=t.getFullYear();const r=t.getMonth();let i,o;switch(t.getDate(),e){case"currentMonth":i=o=r;break;case"currentYear":i=0,o=i+11;break;case"lastSemiYear":i=r<6?6:0,o=i+5,i>5&&--n;break;case"lastQuarter":i=r<3?9:r<6?0:r<9?3:6,o=i+2,i>8&&--n;break;case"lastMonth":i=o=0===r?11:r-1,11===i&&--n;break;default:i=0,o=i+11,--n}return{first:new Date(n,i,1),last:new Date(n,o+1,0)}}(m);e&&!p&&n(5,p=e),t&&!g&&n(6,g=t)}"Invalid Date"===p?.toString()&&n(5,p=void 0),"Invalid Date"===g?.toString()&&n(6,g=void 0),f&&(n(7,w=void 0===p?"":"%d.%m.%Y"),n(8,y=void 0===g?"":"%d.%m.%Y"))}},[s,l,d,u,f,p,g,w,y,i,h,({detail:e})=>{n(5,p=Yr(e.value,p)),g&&p&&g.valueOf()-p.valueOf()<0&&n(5,p=void 0),n(13,o.from=p,o),r("change",{value:p,range:"_from"})},({detail:e})=>{n(6,g=Yr(e.value,g)),g&&p&&g.valueOf()-p.valueOf()<0&&n(6,g=void 0),n(13,o.to=g,o),r("change",{value:g,range:"_to"})},o,a,function(){p=this.value,n(5,p),n(13,o),n(6,g),n(4,f)},function(){g=this.value,n(6,g),n(13,o),n(5,p),n(4,f)}]}class Qs extends xe{constructor(e){var t;super(),document.getElementById("svelte-7itxk4-style")||((t=M("style")).id="svelte-7itxk4-style",t.textContent="div.date-picker.moveLeft div.dropdown.calendar{left:-3em !important}",D(document.head,t)),De(this,e,Ks,Zs,S,{value:13,id:0,item:14,noForm:1,classId:2,required:3,disabled:4})}}var Js={globalLocale:"en-US",globalFormat:"$0,0.00",globalRoundingMode:"HALF_EVEN",globalFormatRoundingMode:"HALF_AWAY_FROM_ZERO",globalExchangeRatesApi:{endpoint:void 0,headers:void 0,propertyPath:void 0}};function ea(e){return ea="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ea(e)}function ta(e){return function(e){if(Array.isArray(e))return e}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return na(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return na(e,t)}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function na(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ra={normalizePrecision:function(e){var t=e.reduce(function(e,t){return Math.max(e.getPrecision(),t.getPrecision())});return e.map(function(e){return e.getPrecision()!==t?e.convertPrecision(t):e})},minimum:function(e){var t=ta(e),n=t[0],r=t.slice(1),i=n;return r.forEach(function(e){i=i.lessThan(e)?i:e}),i},maximum:function(e){var t=ta(e),n=t[0],r=t.slice(1),i=n;return r.forEach(function(e){i=i.greaterThan(e)?i:e}),i}};function ia(e){return!isNaN(parseInt(e))&&isFinite(e)}function oa(e){return e%2==0}function sa(e){return ia(e)&&!Number.isInteger(e)}function aa(e){return Math.abs(e)%1==.5}function la(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(n,r){var i=Object.assign(new XMLHttpRequest,{onreadystatechange:function(){4===i.readyState&&(i.status>=200&&i.status<400?n(JSON.parse(i.responseText)):r(new Error(i.statusText)))},onerror:function(){r(new Error("Network error"))}});i.open("GET",e,!0),function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for(var n in t)e.setRequestHeader(n,t[n])}(i,t.headers),i.send()})}function ca(e){return void 0===e}function da(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:".",n={};return Object.entries(e).forEach(function(e){if("object"===ea(e[1])){var r=da(e[1]);Object.entries(r).forEach(function(r){n[e[0]+t+r[0]]=r[1]})}else n[e[0]]=e[1]}),n}function ua(){var e=function(e,t){var n=function(e){return Math.pow(10,function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0).toString();if(e.indexOf("e-")>0)return parseInt(e.split("e-")[1]);var t=e.split(".")[1];return t?t.length:0}(e))},r=Math.max(n(e),n(t));return Math.round(e*r)*Math.round(t*r)/(r*r)},t={HALF_ODD:function(e){var t=Math.round(e);return aa(e)&&oa(t)?t-1:t},HALF_EVEN:function(e){var t=Math.round(e);return aa(e)?oa(t)?t:t-1:t},HALF_UP:function(e){return Math.round(e)},HALF_DOWN:function(e){return aa(e)?Math.floor(e):Math.round(e)},HALF_TOWARDS_ZERO:function(e){return aa(e)?Math.sign(e)*Math.floor(Math.abs(e)):Math.round(e)},HALF_AWAY_FROM_ZERO:function(e){return aa(e)?Math.sign(e)*Math.ceil(Math.abs(e)):Math.round(e)},DOWN:function(e){return Math.floor(e)}};return{add:function(e,t){return e+t},subtract:function(e,t){return e-t},multiply:function(t,n){return sa(t)||sa(n)?e(t,n):t*n},divide:function(e,t){return e/t},modulo:function(e,t){return e%t},round:function(e){return t[arguments.length>1&&void 0!==arguments[1]?arguments[1]:"HALF_EVEN"](e)}}}var fa=ua();function ha(e){var t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;for(var n in t)e=e.replace("{{".concat(n,"}}"),t[n]);return e};return{getExchangeRate:function(n,r){return(i=e.endpoint,!Boolean(i)||"object"!==ea(i)&&"function"!=typeof i||"function"!=typeof i.then?function(n,r){return la(t(e.endpoint,{from:n,to:r}),{headers:e.headers})}(n,r):e.endpoint).then(function(i){return da(i)[t(e.propertyPath,{from:n,to:r})]});var i}}}function ma(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Error;if(!e)throw new n(t)}function pa(e){ma(function(e){return ia(e)&&e<=100&&e>=0}(e),"You must provide a numeric value between 0 and 100.",RangeError)}function ga(e){ma(Number.isInteger(e),"You must provide an integer.",TypeError)}var wa=ua(),ya=Object.assign(function e(t){var n=Object.assign({},{amount:e.defaultAmount,currency:e.defaultCurrency,precision:e.defaultPrecision},t),r=n.amount,i=n.currency,o=n.precision;ga(r),ga(o);var s=e.globalLocale,a=e.globalFormat,l=e.globalRoundingMode,c=e.globalFormatRoundingMode,d=Object.assign({},e.globalExchangeRatesApi),u=function(t){var n=Object.assign({},Object.assign({},{amount:r,currency:i,precision:o},t),Object.assign({},{locale:this.locale},t));return Object.assign(e({amount:n.amount,currency:n.currency,precision:n.precision}),{locale:n.locale})},f=function(e){ma(this.hasSameCurrency(e),"You must provide a Dinero instance with the same currency.",TypeError)};return{getAmount:function(){return r},getCurrency:function(){return i},getLocale:function(){return this.locale||s},setLocale:function(e){return u.call(this,{locale:e})},getPrecision:function(){return o},convertPrecision:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c;ga(e);var n=this.getPrecision(),r=e>n,i=r?wa.multiply:wa.divide,o=r?[e,n]:[n,e],s=Math.pow(10,wa.subtract.apply(wa,o));return u.call(this,{amount:wa.round(i(this.getAmount(),s),t),precision:e})},add:function(t){f.call(this,t);var n=e.normalizePrecision([this,t]);return u.call(this,{amount:wa.add(n[0].getAmount(),n[1].getAmount()),precision:n[0].getPrecision()})},subtract:function(t){f.call(this,t);var n=e.normalizePrecision([this,t]);return u.call(this,{amount:wa.subtract(n[0].getAmount(),n[1].getAmount()),precision:n[0].getPrecision()})},multiply:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l;return u.call(this,{amount:wa.round(wa.multiply(this.getAmount(),e),t)})},divide:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l;return u.call(this,{amount:wa.round(wa.divide(this.getAmount(),e),t)})},percentage:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l;return pa(e),this.multiply(wa.divide(e,100),t)},allocate:function(e){var t=this;!function(e){ma(function(e){return e.length>0&&e.every(function(e){return e>=0})&&e.some(function(e){return e>0})}(e),"You must provide a non-empty array of numeric values greater than 0.",TypeError)}(e);for(var n=e.reduce(function(e,t){return wa.add(e,t)}),r=this.getAmount(),i=e.map(function(e){var i=Math.floor(wa.divide(wa.multiply(t.getAmount(),e),n));return r=wa.subtract(r,i),u.call(t,{amount:i})}),o=0;r>0;)e[o]>0&&(i[o]=i[o].add(u.call(this,{amount:1})),r=wa.subtract(r,1)),o+=1;return i},convert:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.endpoint,i=void 0===r?d.endpoint:r,o=n.propertyPath,s=void 0===o?d.propertyPath||"rates.{{to}}":o,a=n.headers,c=void 0===a?d.headers:a,f=n.roundingMode,h=void 0===f?l:f,m=Object.assign({},{endpoint:i,propertyPath:s,headers:c,roundingMode:h});return ha(m).getExchangeRate(this.getCurrency(),e).then(function(n){return ma(!ca(n),'No rate was found for the destination currency "'.concat(e,'".'),TypeError),u.call(t,{amount:wa.round(wa.multiply(t.getAmount(),parseFloat(n)),m.roundingMode),currency:e})})},equalsTo:function(e){return this.hasSameAmount(e)&&this.hasSameCurrency(e)},lessThan:function(t){f.call(this,t);var n=e.normalizePrecision([this,t]);return n[0].getAmount()<n[1].getAmount()},lessThanOrEqual:function(t){f.call(this,t);var n=e.normalizePrecision([this,t]);return n[0].getAmount()<=n[1].getAmount()},greaterThan:function(t){f.call(this,t);var n=e.normalizePrecision([this,t]);return n[0].getAmount()>n[1].getAmount()},greaterThanOrEqual:function(t){f.call(this,t);var n=e.normalizePrecision([this,t]);return n[0].getAmount()>=n[1].getAmount()},isZero:function(){return 0===this.getAmount()},isPositive:function(){return this.getAmount()>=0},isNegative:function(){return this.getAmount()<0},hasSubUnits:function(){return 0!==wa.modulo(this.getAmount(),Math.pow(10,o))},hasCents:function(){return 0!==wa.modulo(this.getAmount(),Math.pow(10,o))},hasSameCurrency:function(e){return this.getCurrency()===e.getCurrency()},hasSameAmount:function(t){var n=e.normalizePrecision([this,t]);return n[0].getAmount()===n[1].getAmount()},toFormat:function(){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c,t=function(e){var t=/^(?:(\$|USD)?0(?:(,)0)?(\.)?(0+)?|0(?:(,)0)?(\.)?(0+)?\s?(dollar)?)$/gm.exec(e);return{getMatches:function(){return null!==t?t.slice(1).filter(function(e){return!ca(e)}):[]},getMinimumFractionDigits:function(){var e=function(e){return"."===e};return ca(this.getMatches().find(e))?0:this.getMatches()[fa.add(this.getMatches().findIndex(e),1)].split("").length},getCurrencyDisplay:function(){return{USD:"code",dollar:"name",$:"symbol"}[this.getMatches().find(function(e){return"USD"===e||"dollar"===e||"$"===e})]},getStyle:function(){return ca(this.getCurrencyDisplay(this.getMatches()))?"decimal":"currency"},getUseGrouping:function(){return!ca(this.getMatches().find(function(e){return","===e}))}}}(arguments.length>0&&void 0!==arguments[0]?arguments[0]:a);return this.toRoundedUnit(t.getMinimumFractionDigits(),e).toLocaleString(this.getLocale(),{currencyDisplay:t.getCurrencyDisplay(),useGrouping:t.getUseGrouping(),minimumFractionDigits:t.getMinimumFractionDigits(),style:t.getStyle(),currency:this.getCurrency()})},toUnit:function(){return wa.divide(this.getAmount(),Math.pow(10,o))},toRoundedUnit:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c,n=Math.pow(10,e);return wa.divide(wa.round(wa.multiply(this.toUnit(),n),t),n)},toObject:function(){return{amount:r,currency:i,precision:o}},toJSON:function(){return this.toObject()}}},{defaultAmount:0,defaultCurrency:"USD",defaultPrecision:2},Js,ra),va={},$a={};!function(e){const t=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",n="["+t+"]["+(t+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040")+"]*",r=new RegExp("^"+n+"$");e.isExist=function(e){return void 0!==e},e.isEmptyObject=function(e){return 0===Object.keys(e).length},e.merge=function(e,t,n){if(t){const r=Object.keys(t),i=r.length;for(let o=0;o<i;o++)e[r[o]]="strict"===n?[t[r[o]]]:t[r[o]]}},e.getValue=function(t){return e.isExist(t)?t:""},e.isName=function(e){const t=r.exec(e);return!(null==t)},e.getAllMatches=function(e,t){const n=[];let r=t.exec(e);for(;r;){const i=[];i.startIndex=t.lastIndex-r[0].length;const o=r.length;for(let e=0;e<o;e++)i.push(r[e]);n.push(i),r=t.exec(e)}return n},e.nameRegexp=n}($a);const Ia=$a,_a={allowBooleanAttributes:!1,unpairedTags:[]};function Ca(e){return" "===e||"\t"===e||"\n"===e||"\r"===e}function Ea(e,t){const n=t;for(;t<e.length;t++)if("?"==e[t]||" "==e[t]){const r=e.substr(n,t-n);if(t>5&&"xml"===r)return xa("InvalidXml","XML declaration allowed only at the start of the document.",Ma(e,t));if("?"==e[t]&&">"==e[t+1]){t++;break}continue}return t}function Aa(e,t){if(e.length>t+5&&"-"===e[t+1]&&"-"===e[t+2]){for(t+=3;t<e.length;t++)if("-"===e[t]&&"-"===e[t+1]&&">"===e[t+2]){t+=2;break}}else if(e.length>t+8&&"D"===e[t+1]&&"O"===e[t+2]&&"C"===e[t+3]&&"T"===e[t+4]&&"Y"===e[t+5]&&"P"===e[t+6]&&"E"===e[t+7]){let n=1;for(t+=8;t<e.length;t++)if("<"===e[t])n++;else if(">"===e[t]&&(n--,0===n))break}else if(e.length>t+9&&"["===e[t+1]&&"C"===e[t+2]&&"D"===e[t+3]&&"A"===e[t+4]&&"T"===e[t+5]&&"A"===e[t+6]&&"["===e[t+7])for(t+=8;t<e.length;t++)if("]"===e[t]&&"]"===e[t+1]&&">"===e[t+2]){t+=2;break}return t}va.validate=function(e,t){t=Object.assign({},_a,t);const n=[];let r=!1,i=!1;"\ufeff"===e[0]&&(e=e.substr(1));for(let o=0;o<e.length;o++)if("<"===e[o]&&"?"===e[o+1]){if(o+=2,o=Ea(e,o),o.err)return o}else{if("<"!==e[o]){if(Ca(e[o]))continue;return xa("InvalidChar","char '"+e[o]+"' is not expected.",Ma(e,o))}{let s=o;if(o++,"!"===e[o]){o=Aa(e,o);continue}{let a=!1;"/"===e[o]&&(a=!0,o++);let l="";for(;o<e.length&&">"!==e[o]&&" "!==e[o]&&"\t"!==e[o]&&"\n"!==e[o]&&"\r"!==e[o];o++)l+=e[o];if(l=l.trim(),"/"===l[l.length-1]&&(l=l.substring(0,l.length-1),o--),!Oa(l)){let t;return t=0===l.trim().length?"Invalid space after '<'.":"Tag '"+l+"' is an invalid name.",xa("InvalidTag",t,Ma(e,o))}const c=Na(e,o);if(!1===c)return xa("InvalidAttr","Attributes for '"+l+"' have open quote.",Ma(e,o));let d=c.value;if(o=c.index,"/"===d[d.length-1]){const n=o-d.length;d=d.substring(0,d.length-1);const i=Ra(d,t);if(!0!==i)return xa(i.err.code,i.err.msg,Ma(e,n+i.err.line));r=!0}else if(a){if(!c.tagClosed)return xa("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",Ma(e,o));if(d.trim().length>0)return xa("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",Ma(e,s));if(0===n.length)return xa("InvalidTag","Closing tag '"+l+"' has not been opened.",Ma(e,s));{const t=n.pop();if(l!==t.tagName){let n=Ma(e,t.tagStartPos);return xa("InvalidTag","Expected closing tag '"+t.tagName+"' (opened in line "+n.line+", col "+n.col+") instead of closing tag '"+l+"'.",Ma(e,s))}0==n.length&&(i=!0)}}else{const a=Ra(d,t);if(!0!==a)return xa(a.err.code,a.err.msg,Ma(e,o-d.length+a.err.line));if(!0===i)return xa("InvalidXml","Multiple possible root nodes found.",Ma(e,o));-1!==t.unpairedTags.indexOf(l)||n.push({tagName:l,tagStartPos:s}),r=!0}for(o++;o<e.length;o++)if("<"===e[o]){if("!"===e[o+1]){o++,o=Aa(e,o);continue}if("?"!==e[o+1])break;if(o=Ea(e,++o),o.err)return o}else if("&"===e[o]){const t=Da(e,o);if(-1==t)return xa("InvalidChar","char '&' is not expected.",Ma(e,o));o=t}else if(!0===i&&!Ca(e[o]))return xa("InvalidXml","Extra text at the end",Ma(e,o));"<"===e[o]&&o--}}}return r?1==n.length?xa("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",Ma(e,n[0].tagStartPos)):!(n.length>0)||xa("InvalidXml","Invalid '"+JSON.stringify(n.map(e=>e.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):xa("InvalidXml","Start tag expected.",1)};const ba='"',Sa="'";function Na(e,t){let n="",r="",i=!1;for(;t<e.length;t++){if(e[t]===ba||e[t]===Sa)""===r?r=e[t]:r!==e[t]||(r="");else if(">"===e[t]&&""===r){i=!0;break}n+=e[t]}return""===r&&{value:n,index:t,tagClosed:i}}const Ta=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function Ra(e,t){const n=Ia.getAllMatches(e,Ta),r={};for(let e=0;e<n.length;e++){if(0===n[e][1].length)return xa("InvalidAttr","Attribute '"+n[e][2]+"' has no space in starting.",Pa(n[e]));if(void 0!==n[e][3]&&void 0===n[e][4])return xa("InvalidAttr","Attribute '"+n[e][2]+"' is without value.",Pa(n[e]));if(void 0===n[e][3]&&!t.allowBooleanAttributes)return xa("InvalidAttr","boolean attribute '"+n[e][2]+"' is not allowed.",Pa(n[e]));const i=n[e][2];if(!ka(i))return xa("InvalidAttr","Attribute '"+i+"' is an invalid name.",Pa(n[e]));if(r.hasOwnProperty(i))return xa("InvalidAttr","Attribute '"+i+"' is repeated.",Pa(n[e]));r[i]=1}return!0}function Da(e,t){if(";"===e[++t])return-1;if("#"===e[t])return function(e,t){let n=/\d/;for("x"===e[t]&&(t++,n=/[\da-fA-F]/);t<e.length;t++){if(";"===e[t])return t;if(!e[t].match(n))break}return-1}(e,++t);let n=0;for(;t<e.length;t++,n++)if(!(e[t].match(/\w/)&&n<20)){if(";"===e[t])break;return-1}return t}function xa(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function ka(e){return Ia.isName(e)}function Oa(e){return Ia.isName(e)}function Ma(e,t){const n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function Pa(e){return e.startIndex+e[1].length}var Ba={};const La={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,n){return e}};Ba.buildOptions=function(e){return Object.assign({},La,e)},Ba.defaultOptions=La;var Fa=class{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,t){"__proto__"===e&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e){"__proto__"===e.tagname&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}};const Va=$a;function Ua(e,t){let n="";for(;t<e.length&&"'"!==e[t]&&'"'!==e[t];t++)n+=e[t];if(n=n.trim(),-1!==n.indexOf(" "))throw new Error("External entites are not supported");const r=e[t++];let i="";for(;t<e.length&&e[t]!==r;t++)i+=e[t];return[n,i,t]}function Wa(e,t){return"!"===e[t+1]&&"-"===e[t+2]&&"-"===e[t+3]}function za(e,t){return"!"===e[t+1]&&"E"===e[t+2]&&"N"===e[t+3]&&"T"===e[t+4]&&"I"===e[t+5]&&"T"===e[t+6]&&"Y"===e[t+7]}function Ha(e,t){return"!"===e[t+1]&&"E"===e[t+2]&&"L"===e[t+3]&&"E"===e[t+4]&&"M"===e[t+5]&&"E"===e[t+6]&&"N"===e[t+7]&&"T"===e[t+8]}function ja(e,t){return"!"===e[t+1]&&"A"===e[t+2]&&"T"===e[t+3]&&"T"===e[t+4]&&"L"===e[t+5]&&"I"===e[t+6]&&"S"===e[t+7]&&"T"===e[t+8]}function qa(e,t){return"!"===e[t+1]&&"N"===e[t+2]&&"O"===e[t+3]&&"T"===e[t+4]&&"A"===e[t+5]&&"T"===e[t+6]&&"I"===e[t+7]&&"O"===e[t+8]&&"N"===e[t+9]}function Ga(e){if(Va.isName(e))return e;throw new Error(`Invalid entity name ${e}`)}var Xa=function(e,t){const n={};if("O"!==e[t+3]||"C"!==e[t+4]||"T"!==e[t+5]||"Y"!==e[t+6]||"P"!==e[t+7]||"E"!==e[t+8])throw new Error("Invalid Tag instead of DOCTYPE");{t+=9;let r=1,i=!1,o=!1,s="";for(;t<e.length;t++)if("<"!==e[t]||o)if(">"===e[t]){if(o?"-"===e[t-1]&&"-"===e[t-2]&&(o=!1,r--):r--,0===r)break}else"["===e[t]?i=!0:s+=e[t];else{if(i&&za(e,t))t+=7,[entityName,val,t]=Ua(e,t+1),-1===val.indexOf("&")&&(n[Ga(entityName)]={regx:RegExp(`&${entityName};`,"g"),val:val});else if(i&&Ha(e,t))t+=8;else if(i&&ja(e,t))t+=8;else if(i&&qa(e,t))t+=9;else{if(!Wa)throw new Error("Invalid DOCTYPE");o=!0}r++,s=""}if(0!==r)throw new Error("Unclosed DOCTYPE")}return{entities:n,i:t}};const Ya=/^[-+]?0x[a-fA-F0-9]+$/,Za=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt),!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const Ka={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};var Qa=function(e){return"function"==typeof e?e:Array.isArray(e)?t=>{for(const n of e){if("string"==typeof n&&t===n)return!0;if(n instanceof RegExp&&n.test(t))return!0}}:()=>!1};const Ja=$a,el=Fa,tl=Xa,nl=function(e,t={}){if(t=Object.assign({},Ka,t),!e||"string"!=typeof e)return e;let n=e.trim();if(void 0!==t.skipLike&&t.skipLike.test(n))return e;if(t.hex&&Ya.test(n))return Number.parseInt(n,16);{const r=Za.exec(n);if(r){const i=r[1],o=r[2];let s=function(e){if(e&&-1!==e.indexOf("."))return"."===(e=e.replace(/0+$/,""))?e="0":"."===e[0]?e="0"+e:"."===e[e.length-1]&&(e=e.substr(0,e.length-1)),e;return e}(r[3]);const a=r[4]||r[6];if(!t.leadingZeros&&o.length>0&&i&&"."!==n[2])return e;if(!t.leadingZeros&&o.length>0&&!i&&"."!==n[1])return e;{const r=Number(n),l=""+r;return-1!==l.search(/[eE]/)||a?t.eNotation?r:e:-1!==n.indexOf(".")?"0"===l&&""===s||l===s||i&&l==="-"+s?r:e:o?s===l||i+s===l?r:e:n===l||n===i+l?r:e}}return e}},rl=Qa;function il(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];this.lastEntities[r]={regex:new RegExp("&"+r+";","g"),val:e[r]}}}function ol(e,t,n,r,i,o,s){if(void 0!==e&&(this.options.trimValues&&!r&&(e=e.trim()),e.length>0)){s||(e=this.replaceEntitiesValue(e));const r=this.options.tagValueProcessor(t,e,n,i,o);if(null==r)return e;if(typeof r!=typeof e||r!==e)return r;if(this.options.trimValues)return wl(e,this.options.parseTagValue,this.options.numberParseOptions);return e.trim()===e?wl(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function sl(e){if(this.options.removeNSPrefix){const t=e.split(":"),n="/"===e.charAt(0)?"/":"";if("xmlns"===t[0])return"";2===t.length&&(e=n+t[1])}return e}const al=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function ll(e,t,n){if(!0!==this.options.ignoreAttributes&&"string"==typeof e){const n=Ja.getAllMatches(e,al),r=n.length,i={};for(let e=0;e<r;e++){const r=this.resolveNameSpace(n[e][1]);if(this.ignoreAttributesFn(r,t))continue;let o=n[e][4],s=this.options.attributeNamePrefix+r;if(r.length)if(this.options.transformAttributeName&&(s=this.options.transformAttributeName(s)),"__proto__"===s&&(s="#__proto__"),void 0!==o){this.options.trimValues&&(o=o.trim()),o=this.replaceEntitiesValue(o);const e=this.options.attributeValueProcessor(r,o,t);i[s]=null==e?o:typeof e!=typeof o||e!==o?e:wl(o,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(i[s]=!0)}if(!Object.keys(i).length)return;if(this.options.attributesGroupName){const e={};return e[this.options.attributesGroupName]=i,e}return i}}const cl=function(e){e=e.replace(/\r\n?/g,"\n");const t=new el("!xml");let n=t,r="",i="";for(let o=0;o<e.length;o++){if("<"===e[o])if("/"===e[o+1]){const t=ml(e,">",o,"Closing Tag is not closed.");let s=e.substring(o+2,t).trim();if(this.options.removeNSPrefix){const e=s.indexOf(":");-1!==e&&(s=s.substr(e+1))}this.options.transformTagName&&(s=this.options.transformTagName(s)),n&&(r=this.saveTextToParentTag(r,n,i));const a=i.substring(i.lastIndexOf(".")+1);if(s&&-1!==this.options.unpairedTags.indexOf(s))throw new Error(`Unpaired tag can not be used as closing tag: </${s}>`);let l=0;a&&-1!==this.options.unpairedTags.indexOf(a)?(l=i.lastIndexOf(".",i.lastIndexOf(".")-1),this.tagsNodeStack.pop()):l=i.lastIndexOf("."),i=i.substring(0,l),n=this.tagsNodeStack.pop(),r="",o=t}else if("?"===e[o+1]){let t=pl(e,o,!1,"?>");if(!t)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,i),this.options.ignoreDeclaration&&"?xml"===t.tagName||this.options.ignorePiTags);else{const e=new el(t.tagName);e.add(this.options.textNodeName,""),t.tagName!==t.tagExp&&t.attrExpPresent&&(e[":@"]=this.buildAttributesMap(t.tagExp,i,t.tagName)),this.addChild(n,e,i)}o=t.closeIndex+1}else if("!--"===e.substr(o+1,3)){const t=ml(e,"--\x3e",o+4,"Comment is not closed.");if(this.options.commentPropName){const s=e.substring(o+4,t-2);r=this.saveTextToParentTag(r,n,i),n.add(this.options.commentPropName,[{[this.options.textNodeName]:s}])}o=t}else if("!D"===e.substr(o+1,2)){const t=tl(e,o);this.docTypeEntities=t.entities,o=t.i}else if("!["===e.substr(o+1,2)){const t=ml(e,"]]>",o,"CDATA is not closed.")-2,s=e.substring(o+9,t);r=this.saveTextToParentTag(r,n,i);let a=this.parseTextData(s,n.tagname,i,!0,!1,!0,!0);null==a&&(a=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:s}]):n.add(this.options.textNodeName,a),o=t+2}else{let s=pl(e,o,this.options.removeNSPrefix),a=s.tagName;const l=s.rawTagName;let c=s.tagExp,d=s.attrExpPresent,u=s.closeIndex;this.options.transformTagName&&(a=this.options.transformTagName(a)),n&&r&&"!xml"!==n.tagname&&(r=this.saveTextToParentTag(r,n,i,!1));const f=n;if(f&&-1!==this.options.unpairedTags.indexOf(f.tagname)&&(n=this.tagsNodeStack.pop(),i=i.substring(0,i.lastIndexOf("."))),a!==t.tagname&&(i+=i?"."+a:a),this.isItStopNode(this.options.stopNodes,i,a)){let t="";if(c.length>0&&c.lastIndexOf("/")===c.length-1)"/"===a[a.length-1]?(a=a.substr(0,a.length-1),i=i.substr(0,i.length-1),c=a):c=c.substr(0,c.length-1),o=s.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(a))o=s.closeIndex;else{const n=this.readStopNodeData(e,l,u+1);if(!n)throw new Error(`Unexpected end of ${l}`);o=n.i,t=n.tagContent}const r=new el(a);a!==c&&d&&(r[":@"]=this.buildAttributesMap(c,i,a)),t&&(t=this.parseTextData(t,a,i,!0,d,!0,!0)),i=i.substr(0,i.lastIndexOf(".")),r.add(this.options.textNodeName,t),this.addChild(n,r,i)}else{if(c.length>0&&c.lastIndexOf("/")===c.length-1){"/"===a[a.length-1]?(a=a.substr(0,a.length-1),i=i.substr(0,i.length-1),c=a):c=c.substr(0,c.length-1),this.options.transformTagName&&(a=this.options.transformTagName(a));const e=new el(a);a!==c&&d&&(e[":@"]=this.buildAttributesMap(c,i,a)),this.addChild(n,e,i),i=i.substr(0,i.lastIndexOf("."))}else{const e=new el(a);this.tagsNodeStack.push(n),a!==c&&d&&(e[":@"]=this.buildAttributesMap(c,i,a)),this.addChild(n,e,i),n=e}r="",o=u}}else r+=e[o]}return t.child};function dl(e,t,n){const r=this.options.updateTag(t.tagname,n,t[":@"]);!1===r||("string"==typeof r?(t.tagname=r,e.addChild(t)):e.addChild(t))}const ul=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){const n=this.docTypeEntities[t];e=e.replace(n.regx,n.val)}for(let t in this.lastEntities){const n=this.lastEntities[t];e=e.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){const n=this.htmlEntities[t];e=e.replace(n.regex,n.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function fl(e,t,n,r){return e&&(void 0===r&&(r=0===Object.keys(t.child).length),void 0!==(e=this.parseTextData(e,t.tagname,n,!1,!!t[":@"]&&0!==Object.keys(t[":@"]).length,r))&&""!==e&&t.add(this.options.textNodeName,e),e=""),e}function hl(e,t,n){const r="*."+n;for(const n in e){const i=e[n];if(r===i||t===i)return!0}return!1}function ml(e,t,n,r){const i=e.indexOf(t,n);if(-1===i)throw new Error(r);return i+t.length-1}function pl(e,t,n,r=">"){const i=function(e,t,n=">"){let r,i="";for(let o=t;o<e.length;o++){let t=e[o];if(r)t===r&&(r="");else if('"'===t||"'"===t)r=t;else if(t===n[0]){if(!n[1])return{data:i,index:o};if(e[o+1]===n[1])return{data:i,index:o}}else"\t"===t&&(t=" ");i+=t}}(e,t+1,r);if(!i)return;let o=i.data;const s=i.index,a=o.search(/\s/);let l=o,c=!0;-1!==a&&(l=o.substring(0,a),o=o.substring(a+1).trimStart());const d=l;if(n){const e=l.indexOf(":");-1!==e&&(l=l.substr(e+1),c=l!==i.data.substr(e+1))}return{tagName:l,tagExp:o,closeIndex:s,attrExpPresent:c,rawTagName:d}}function gl(e,t,n){const r=n;let i=1;for(;n<e.length;n++)if("<"===e[n])if("/"===e[n+1]){const o=ml(e,">",n,`${t} is not closed`);if(e.substring(n+2,o).trim()===t&&(i--,0===i))return{tagContent:e.substring(r,n),i:o};n=o}else if("?"===e[n+1]){n=ml(e,"?>",n+1,"StopNode is not closed.")}else if("!--"===e.substr(n+1,3)){n=ml(e,"--\x3e",n+3,"StopNode is not closed.")}else if("!["===e.substr(n+1,2)){n=ml(e,"]]>",n,"StopNode is not closed.")-2}else{const r=pl(e,n,">");if(r){(r&&r.tagName)===t&&"/"!==r.tagExp[r.tagExp.length-1]&&i++,n=r.closeIndex}}}function wl(e,t,n){if(t&&"string"==typeof e){const t=e.trim();return"true"===t||"false"!==t&&(t.length>15?t:nl(e,n))}return Ja.isExist(e)?e:""}var yl=class{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(e,t)=>String.fromCharCode(Number.parseInt(t,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(e,t)=>String.fromCharCode(Number.parseInt(t,16))}},this.addExternalEntities=il,this.parseXml=cl,this.parseTextData=ol,this.resolveNameSpace=sl,this.buildAttributesMap=ll,this.isItStopNode=hl,this.replaceEntitiesValue=ul,this.readStopNodeData=gl,this.saveTextToParentTag=fl,this.addChild=dl,this.ignoreAttributesFn=rl(this.options.ignoreAttributes)}},vl={};function $l(e,t,n){let r;const i={};for(let o=0;o<e.length;o++){const s=e[o],a=Il(s);let l="";if(l=void 0===n?a:n+"."+a,a===t.textNodeName)void 0===r?r=s[a]:r+=""+s[a];else{if(void 0===a)continue;if(s[a]){let e=$l(s[a],t,l);const n=Cl(e,t);s[":@"]?_l(e,s[":@"],l,t):1!==Object.keys(e).length||void 0===e[t.textNodeName]||t.alwaysCreateTextNode?0===Object.keys(e).length&&(t.alwaysCreateTextNode?e[t.textNodeName]="":e=""):e=e[t.textNodeName],void 0!==i[a]&&i.hasOwnProperty(a)?(Array.isArray(i[a])||(i[a]=[i[a]]),i[a].push(e)):t.isArray(a,l,n)?i[a]=[e]:i[a]=e}}}return"string"==typeof r?r.length>0&&(i[t.textNodeName]=r):void 0!==r&&(i[t.textNodeName]=r),i}function Il(e){const t=Object.keys(e);for(let e=0;e<t.length;e++){const n=t[e];if(":@"!==n)return n}}function _l(e,t,n,r){if(t){const i=Object.keys(t),o=i.length;for(let s=0;s<o;s++){const o=i[s];r.isArray(o,n+"."+o,!0,!0)?e[o]=[t[o]]:e[o]=t[o]}}}function Cl(e,t){const{textNodeName:n}=t,r=Object.keys(e).length;return 0===r||!(1!==r||!e[n]&&"boolean"!=typeof e[n]&&0!==e[n])}vl.prettify=function(e,t){return $l(e,t)};const{buildOptions:El}=Ba,Al=yl,{prettify:bl}=vl,Sl=va;var Nl=class{constructor(e){this.externalEntities={},this.options=El(e)}parse(e,t){if("string"==typeof e);else{if(!e.toString)throw new Error("XML data is accepted in String or Bytes[] form.");e=e.toString()}if(t){!0===t&&(t={});const n=Sl.validate(e,t);if(!0!==n)throw Error(`${n.err.msg}:${n.err.line}:${n.err.col}`)}const n=new Al(this.options);n.addExternalEntities(this.externalEntities);const r=n.parseXml(e);return this.options.preserveOrder||void 0===r?r:bl(r,this.options)}addEntity(e,t){if(-1!==t.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==e.indexOf("&")||-1!==e.indexOf(";"))throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if("&"===t)throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=t}};function Tl(e,t,n,r){let i="",o=!1;for(let s=0;s<e.length;s++){const a=e[s],l=Rl(a);if(void 0===l)continue;let c="";if(c=0===n.length?l:`${n}.${l}`,l===t.textNodeName){let e=a[l];xl(c,t)||(e=t.tagValueProcessor(l,e),e=kl(e,t)),o&&(i+=r),i+=e,o=!1;continue}if(l===t.cdataPropName){o&&(i+=r),i+=`<![CDATA[${a[l][0][t.textNodeName]}]]>`,o=!1;continue}if(l===t.commentPropName){i+=r+`\x3c!--${a[l][0][t.textNodeName]}--\x3e`,o=!0;continue}if("?"===l[0]){const e=Dl(a[":@"],t),n="?xml"===l?"":r;let s=a[l][0][t.textNodeName];s=0!==s.length?" "+s:"",i+=n+`<${l}${s}${e}?>`,o=!0;continue}let d=r;""!==d&&(d+=t.indentBy);const u=r+`<${l}${Dl(a[":@"],t)}`,f=Tl(a[l],t,c,d);-1!==t.unpairedTags.indexOf(l)?t.suppressUnpairedNode?i+=u+">":i+=u+"/>":f&&0!==f.length||!t.suppressEmptyNode?f&&f.endsWith(">")?i+=u+`>${f}${r}</${l}>`:(i+=u+">",f&&""!==r&&(f.includes("/>")||f.includes("</"))?i+=r+t.indentBy+f+r:i+=f,i+=`</${l}>`):i+=u+"/>",o=!0}return i}function Rl(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(e.hasOwnProperty(r)&&":@"!==r)return r}}function Dl(e,t){let n="";if(e&&!t.ignoreAttributes)for(let r in e){if(!e.hasOwnProperty(r))continue;let i=t.attributeValueProcessor(r,e[r]);i=kl(i,t),!0===i&&t.suppressBooleanAttributes?n+=` ${r.substr(t.attributeNamePrefix.length)}`:n+=` ${r.substr(t.attributeNamePrefix.length)}="${i}"`}return n}function xl(e,t){let n=(e=e.substr(0,e.length-t.textNodeName.length-1)).substr(e.lastIndexOf(".")+1);for(let r in t.stopNodes)if(t.stopNodes[r]===e||t.stopNodes[r]==="*."+n)return!0;return!1}function kl(e,t){if(e&&e.length>0&&t.processEntities)for(let n=0;n<t.entities.length;n++){const r=t.entities[n];e=e.replace(r.regex,r.val)}return e}const Ol=function(e,t){let n="";return t.format&&t.indentBy.length>0&&(n="\n"),Tl(e,t,"",n)},Ml=Qa,Pl={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function Bl(e){this.options=Object.assign({},Pl,e),!0===this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=Ml(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Vl),this.processTextOrObjNode=Ll,this.options.format?(this.indentate=Fl,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function Ll(e,t,n,r){const i=this.j2x(e,n+1,r.concat(t));return void 0!==e[this.options.textNodeName]&&1===Object.keys(e).length?this.buildTextValNode(e[this.options.textNodeName],t,i.attrStr,n):this.buildObjectNode(i.val,t,i.attrStr,n)}function Fl(e){return this.options.indentBy.repeat(e)}function Vl(e){return!(!e.startsWith(this.options.attributeNamePrefix)||e===this.options.textNodeName)&&e.substr(this.attrPrefixLen)}Bl.prototype.build=function(e){return this.options.preserveOrder?Ol(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0,[]).val)},Bl.prototype.j2x=function(e,t,n){let r="",i="";const o=n.join(".");for(let s in e)if(Object.prototype.hasOwnProperty.call(e,s))if(void 0===e[s])this.isAttribute(s)&&(i+="");else if(null===e[s])this.isAttribute(s)?i+="":"?"===s[0]?i+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:i+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(e[s]instanceof Date)i+=this.buildTextValNode(e[s],s,"",t);else if("object"!=typeof e[s]){const n=this.isAttribute(s);if(n&&!this.ignoreAttributesFn(n,o))r+=this.buildAttrPairStr(n,""+e[s]);else if(!n)if(s===this.options.textNodeName){let t=this.options.tagValueProcessor(s,""+e[s]);i+=this.replaceEntitiesValue(t)}else i+=this.buildTextValNode(e[s],s,"",t)}else if(Array.isArray(e[s])){const r=e[s].length;let o="",a="";for(let l=0;l<r;l++){const r=e[s][l];if(void 0===r);else if(null===r)"?"===s[0]?i+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:i+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if("object"==typeof r)if(this.options.oneListGroup){const e=this.j2x(r,t+1,n.concat(s));o+=e.val,this.options.attributesGroupName&&r.hasOwnProperty(this.options.attributesGroupName)&&(a+=e.attrStr)}else o+=this.processTextOrObjNode(r,s,t,n);else if(this.options.oneListGroup){let e=this.options.tagValueProcessor(s,r);e=this.replaceEntitiesValue(e),o+=e}else o+=this.buildTextValNode(r,s,"",t)}this.options.oneListGroup&&(o=this.buildObjectNode(o,s,a,t)),i+=o}else if(this.options.attributesGroupName&&s===this.options.attributesGroupName){const t=Object.keys(e[s]),n=t.length;for(let i=0;i<n;i++)r+=this.buildAttrPairStr(t[i],""+e[s][t[i]])}else i+=this.processTextOrObjNode(e[s],s,t,n);return{attrStr:r,val:i}},Bl.prototype.buildAttrPairStr=function(e,t){return t=this.options.attributeValueProcessor(e,""+t),t=this.replaceEntitiesValue(t),this.options.suppressBooleanAttributes&&"true"===t?" "+e:" "+e+'="'+t+'"'},Bl.prototype.buildObjectNode=function(e,t,n,r){if(""===e)return"?"===t[0]?this.indentate(r)+"<"+t+n+"?"+this.tagEndChar:this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar;{let i="</"+t+this.tagEndChar,o="";return"?"===t[0]&&(o="?",i=""),!n&&""!==n||-1!==e.indexOf("<")?!1!==this.options.commentPropName&&t===this.options.commentPropName&&0===o.length?this.indentate(r)+`\x3c!--${e}--\x3e`+this.newLine:this.indentate(r)+"<"+t+n+o+this.tagEndChar+e+this.indentate(r)+i:this.indentate(r)+"<"+t+n+o+">"+e+i}},Bl.prototype.closeTag=function(e){let t="";return-1!==this.options.unpairedTags.indexOf(e)?this.options.suppressUnpairedNode||(t="/"):t=this.options.suppressEmptyNode?"/":`></${e}`,t},Bl.prototype.buildTextValNode=function(e,t,n,r){if(!1!==this.options.cdataPropName&&t===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${e}]]>`+this.newLine;if(!1!==this.options.commentPropName&&t===this.options.commentPropName)return this.indentate(r)+`\x3c!--${e}--\x3e`+this.newLine;if("?"===t[0])return this.indentate(r)+"<"+t+n+"?"+this.tagEndChar;{let i=this.options.tagValueProcessor(t,e);return i=this.replaceEntitiesValue(i),""===i?this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(r)+"<"+t+n+">"+i+"</"+t+this.tagEndChar}},Bl.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){const n=this.options.entities[t];e=e.replace(n.regex,n.val)}return e};for(var Ul={XMLParser:Nl,XMLValidator:va,XMLBuilder:Bl},Wl=[],zl=0;zl<256;++zl)Wl.push((zl+256).toString(16).slice(1));"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);class Hl extends Error{constructor(e){super(e),this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class jl extends Hl{constructor(e){super(e)}}class ql extends Hl{constructor(e){super(e)}}const Gl=e=>e.Id.IBAN?{iban:e.Id.IBAN}:{...e.Id?.Othr?.Id&&{accountNumber:String(e.Id.Othr.Id)},...e.Nm&&{name:e.Nm},...e.Ccy&&{currency:e.Ccy}},Xl=e=>{if(e){if(e.FinInstnId?.BIC)return{bic:e.FinInstnId.BIC};if(e.FinInstnId?.BICFI)return{bic:e.FinInstnId.BICFI};if(e.FinInstnId){const t=e.FinInstnId.Othr?.Id||e.FinInstnId.ClrSysMmbId?.MmbId;if(t)return{abaRoutingNumber:t.toString()}}}},Yl=(e,t="USD")=>{const n=ya({currency:t});return Math.floor(Number(e)*10**n.getPrecision())},Zl=e=>{const t=e.DtTm||e.Dt;return new Date(t)},Kl=e=>{const t=e.Id.toString(),n=e.ElctrncSeqNb,r=e.LglSeqNb,i=new Date(e.CreDtTm);let o,s;e.FrToDt&&(o=new Date(e.FrToDt.FrDtTm),s=new Date(e.FrToDt.ToDtTm));const a=e.TxsSummry?.TtlNtries.NbOfNtries,l=e.TxsSummry?.TtlNtries.Sum,c=e.TxsSummry?.TtlNtries.TtlNetNtryAmt;let d;c&&(d=Yl(c));const u=e.TxsSummry?.TtlCdtNtries.NbOfNtries,f=e.TxsSummry?.TtlCdtNtries.Sum,h=e.TxsSummry?.TtlDbtNtries.NbOfNtries,m=e.TxsSummry?.TtlDbtNtries.Sum,p=Gl(e.Acct),g=Xl(e.Acct.Svcr);let w=[];Array.isArray(e.Bal)?w=e.Bal.map(Ql):e.Bal&&(w=[Ql(e.Bal)]);let y=[];return Array.isArray(e.Ntry)?y=e.Ntry.map(Jl):e.Ntry&&(y=[Jl(e.Ntry)]),{id:t,electronicSequenceNumber:n,legalSequenceNumber:r,creationDate:i,fromDate:o,toDate:s,account:p,agent:g,numOfEntries:a,sumOfEntries:l,netAmountOfEntries:d,numOfCredits:u,sumOfCredits:f,numOfDebits:h,sumOfDebits:m,balances:w,entries:y}},Ql=e=>{const t=e.Amt["#text"],n=e.Amt["@_Ccy"],r=Yl(t,n),i="CRDT"===e.CdtDbtInd?"credit":"debit",o=e.Tp.CdOrPrtry.Cd;return{date:Zl(e.Dt),amount:r,currency:n,creditDebitIndicator:i,type:o}},Jl=e=>{const t=e.NtryRef,n="CRDT"===e.CdtDbtInd?"credit":"debit",r=Zl(e.BookgDt),i=!0===e.RvslInd,o=e.Amt["#text"],s=e.Amt["@_Ccy"],a=Yl(o,s),l=e.BkTxCd.Prtry?.Cd,c=(e=>{if(e)return Array.isArray(e)?e.join("\n"):e})(e.AddtlNtryInf),d=e.AcctSvcrRef,u=tc(e.BkTxCd);let f=e.NtryDtls||[];Array.isArray(f)||(f=[f]);return{referenceId:t,creditDebitIndicator:n,bookingDate:r,reversal:i,amount:a,currency:s,proprietaryCode:l,transactions:f.map(e=>{let t=e.TxDtls||[];return Array.isArray(t)||(t=[t]),t.map(ec)}).flat(),additionalInformation:c,accountServicerReferenceId:d,bankTransactionCode:u}},ec=e=>{const t=e.Refs?.MsgId,n=e.Refs?.AcctSvcrRef,r=e.Refs?.PmtInfId,i=e.RmtInf?.Ustrd,o=e.Purp?.Prtry,s=e.RtrInf?.Rsn,a=e.RtrInf?.AddtlInf,l=e.Refs?.EndToEndId,c=e.Amt["@_Ccy"],d=e.Amt["#text"],u=e.RmtInf?.Strd?.CdtrRefInf?.Ref?.toString(),f=e.RmtInf?.Strd?.AddtlRmtInf;let h,m,p,g,w,y,v,$;return e.RltdPties?.Dbtr&&(m=e.RltdPties.Dbtr.Nm||e.RltdPties.Dbtr.Pty?.Nm),e.RltdPties?.DbtrAcct&&(p=Gl(e.RltdPties.DbtrAcct)),e.RltdAgts?.DbtrAgt&&(g=Xl(e.RltdAgts.DbtrAgt)),(m||p||g)&&(h={name:m,account:p,agent:g}),e.RltdPties?.Cdtr&&(y=e.RltdPties.Cdtr.Nm||e.RltdPties.Cdtr.Pty?.Nm),e.RltdPties?.CdtrAcct&&(v=Gl(e.RltdPties.CdtrAcct)),e.RltdAgts?.CdtrAgt&&($=Xl(e.RltdAgts.CdtrAgt)),(y||v||$)&&(w={name:y,account:v,agent:$}),{messageId:t,accountServicerReferenceId:n,endToEndId:l,currency:c,amount:d,paymentInformationId:r,remittanceInformation:i,proprietaryPurpose:o,returnReason:s,returnAdditionalInformation:a,debtor:h,creditor:w,invoiceRef:u,invoiceRefAdd:f}},tc=e=>{const t=e?.Domn?.Cd,n=e?.Domn?.Fmly?.Cd,r=e?.Domn?.Fmly?.SubFmlyCd,i=e.Prtry?.Cd,o=e.Prtry?.Issr;return{domainCode:t,domainFamilyCode:n,domainSubFamilyCode:r,proprietaryCode:i,proprietaryCodeIssuer:o}};class nc{_messageId;_creationDate;_recipient;_statements;constructor(e){this._messageId=e.messageId,this._creationDate=e.creationDate,this._recipient=e.recipient,this._statements=e.statements}static getParser(){return new Ul.XMLParser({ignoreAttributes:!1,tagValueProcessor:(e,t,n,r,i)=>{if(!i||!["Cd","NtryRef"].includes(e))return t}})}static fromXML(e){const t=nc.getParser().parse(e);if(!t.Document)throw new jl("Invalid XML format");if(!(t.Document["@_xmlns"]||t.Document["@_Xmlns"]).startsWith("urn:iso:std:iso:20022:tech:xsd:camt.053.001."))throw new ql("Invalid CAMT.053 namespace");const n=t.Document.BkToCstmrStmt,r=n.GrpHdr.CreDtTm,i=new Date(r);let o=[];o=Array.isArray(n.Stmt)?n.Stmt.map(e=>Kl(e)):[Kl(n.Stmt)];const s=n.GrpHdr.MsgRcpt;return new nc({messageId:n.GrpHdr.MsgId.toString(),creationDate:i,recipient:s?(a=s,{id:a.Id?.OrgId?.Othr?.Id,name:a.Nm}):void 0,statements:o});var a}get balances(){return this._statements.flatMap(e=>e.balances)}get transactions(){return this._statements.flatMap(e=>e.entries).flatMap(e=>e.transactions)}get entries(){return this._statements.flatMap(e=>e.entries)}get messageId(){return this._messageId}get recipient(){return this._recipient}get creationDate(){return this._creationDate}get statements(){return this._statements}}function rc(e){let t,n,r,i,o;function s(t){e[17](t)}let a={class:e[0],id:e[1],name:e[2],accept:"text/xml",max:"1",beforeChange:e[13]};return void 0!==e[3]&&(a.files=e[3]),t=new e[7]({props:a}),re.push(()=>Se(t,"files",s)),t.$on("change",e[12]),i=new e[8]({props:{inputClass:e[0],hidden:!0,id:e[1],name:e[1],value:e[4]}}),{c(){Ne(t.$$.fragment),r=L(),Ne(i.$$.fragment)},m(e,n){Te(t,e,n),x(e,r,n),Te(i,e,n),o=!0},p(e,r){const o={};1&r&&(o.class=e[0]),2&r&&(o.id=e[1]),4&r&&(o.name=e[2]),!n&&8&r&&(n=!0,o.files=e[3],ue(()=>n=!1)),t.$set(o);const s={};1&r&&(s.inputClass=e[0]),2&r&&(s.id=e[1]),2&r&&(s.name=e[1]),16&r&&(s.value=e[4]),i.$set(s)},i(e){o||($e(t.$$.fragment,e),$e(i.$$.fragment,e),o=!0)},o(e){Ie(t.$$.fragment,e),Ie(i.$$.fragment,e),o=!1},d(e){Re(t,e),e&&k(r),Re(i,e)}}}function ic(e){let t,n;return t=new e[8]({props:{inputClass:e[0],readonly:!0,id:e[1],name:e[1],value:e[4]}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};1&n&&(r.inputClass=e[0]),2&n&&(r.id=e[1]),2&n&&(r.name=e[1]),16&n&&(r.value=e[4]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function oc(e){let t,n,r;return n=new e[9]({props:{outline:!0,$$slots:{default:[sc]},$$scope:{ctx:e}}}),{c(){t=M("div"),Ne(n.$$.fragment),q(t,"margin-top","1em")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p(e,t){const r={};1073741888&t&&(r.$$scope={dirty:t,ctx:e}),n.$set(r)},i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function sc(e){let t,n,r,i;return r=new e[10]({}),{c(){t=B(e[6]),n=L(),Ne(r.$$.fragment)},m(e,o){x(e,t,o),x(e,n,o),Te(r,e,o),i=!0},p(e,n){(!i||64&n)&&H(t,e[6])},i(e){i||($e(r.$$.fragment,e),i=!0)},o(e){Ie(r.$$.fragment,e),i=!1},d(e){e&&k(t),e&&k(n),Re(r,e)}}}function ac(e){let t,n,r,i,o;const s=[ic,rc],a=[];t=function(e){return e[11]?0:1}(e),n=a[t]=s[t](e);let l=e[5]&&oc(e);return{c(){n.c(),r=L(),l&&l.c(),i=F()},m(e,n){a[t].m(e,n),x(e,r,n),l&&l.m(e,n),x(e,i,n),o=!0},p(e,[t]){n.p(e,t),e[5]?l?(l.p(e,t),32&t&&$e(l,1)):(l=oc(e),l.c(),$e(l,1),l.m(i.parentNode,i)):l&&(ye(),Ie(l,1,1,()=>{l=null}),ve())},i(e){o||($e(n),$e(l),o=!0)},o(e){Ie(n),Ie(l),o=!1},d(e){a[t].d(e),e&&k(r),l&&l.d(e),e&&k(i)}}}function lc(e,n,r){const{FileDropzone:i,TextField:o,Chip:s,Loading:a}=c,l=ee();let{classId:d}=n,{eventId:u}=n,{record:f}=n,{item:h}=n,{id:m}=n,{name:p}=n;const g="camt53"===h.properties?.type;let w=[],y=f[h.name]||"",v=!!f._id,$=!1,I="In Verarbeitung!";const _=async(e,n,r,i,o,s)=>{try{if("debit"!==e)return"";if(n)return"";let a;if(r&&(a=await t.getSectionView("creditPayment",{creditPaymentId:r.split(".")[0]})),a?.length){let e=a[0].listBill.find(e=>i&&e.reference.replaceAll(" ","")===i);if(!e&&s&&(e=a[0].listBill.find(e=>e.iban.replaceAll(" ","")===s&&+e.amount==+o)),e)return e.bill}}catch{}return""},C=async(e,n,r,i,o,s,a=[])=>{try{if("credit"!==e)return"";let i,o=N(n);if(o.startsWith("R-")||(o=""),!o&&r&&(r=r.toString(),o=N(r.replaceAll(" ","")),o.startsWith("R-")||(o=""),!o&&r.includes("R-"))){o="R-"+r.split("R-")[1].slice(0,8)}const l=+Number.parseFloat(+s-.04).toFixed(2),c=+Number.parseFloat(+s+.04).toFixed(2);if(o&&(i=await t.getSectionView("invoice",{invoiceId:o}),i?.length)){const e=i[0];if(!a.find(t=>t.invoice==e._id)&&e.__total>=l&&e.__total<=c)return e._id}}catch{}return""},E=async(e,n,r)=>{try{if(!e)return;const n=await t.getSectionView("incomingPayment",{invoice:e});if(!n?.length)return;const i=n[0];return r===i._total&&i._id}catch{}},A=async e=>{try{if(!e)return;const n=await t.getSectionView("outgoingPayment",{bill:e});if(n?.length)return n[0]._id}catch{}},b=async e=>{try{const n=await t.getSectionView("accountingPlan",{iban:e});if(n?.length)return n[0]._id}catch{}return""},S=async(e,n)=>{try{const i=n.output.class[0].list,o=await(async e=>{if(!e.includes("xsd:camt.053"))return;let t;try{t=nc.fromXML(e)}catch(e){console.log("error",e)}return t})(e);if(!o||!o.messageId)return r(6,I="Das ist keine camt53 Datei!"),void r(5,$=!0);const s=await t.getSectionView("dailyJournal",{messageId:o.messageId});if(s?.length)return r(6,I="Bereits eingelesen!"),void r(5,$=!0);o._saldo=o.balances[1].amount/100,o._saldoDate_from=o.balances[0].date,o._saldoDate_to=o.balances[1].date;let a=!0;for(const e of n.output.class[0].item.filter(e=>e.properties?.source)){let t=o[e.properties.source];if(e.properties?.required&&!t){a=!1;break}if("dateRange"===e.type){const t=o[e.properties.source+"_from"],n=o[e.properties.source+"_to"];l("record",{itemName:e.name+"_from",value:t}),l("record",{itemName:e.name+"_to",value:n});continue}"[object Date]"===Object.prototype.toString.call(t)&&(t=new Date(t)),l("record",{itemName:e.name,value:t})}if(!a)return r(6,I="Ungültiger Inhalt!"),void r(5,$=!0);l("record",{itemName:"status",value:"offen"}),await Promise.all(i.map(async e=>await(async(e,t,n)=>{if(f._id)return;if(!e.process)return;n.output.class[0].name;const i=e.process.target;if(!i)return;r(6,I="In Verarbeitung!"),r(5,$=!0);const o=[],s=[],{refItem:a,value:c}=e.process.filter;for(const n of t[e.source]){const t=await b(n.account?.iban);for(const r of n.entries){if(r[a]!==c)continue;let l="SALA"===r.bankTransactionCode?.domainSubFamilyCode,d=!1;for(const a of r.transactions){let c=await C(r.creditDebitIndicator,a.invoiceRef,a.remittanceInformation,e.process.creditor,a.debtor,a.amount,s),u=await E(c,r.bookingDate,a.amount);!1===u&&(c=void 0,u=void 0);const f=await _(r.creditDebitIndicator,l,a.paymentInformationId,a.invoiceRef,a.amount,a.creditor?.account?.iban),h=await A(f),m="",p="",g={accountServicerReferenceId:a.accountServicerReferenceId,messageId:a.messageId,account:n.account.iban,accountDebit:t,creditDebitIndicator:r.creditDebitIndicator,bookingDate:r.bookingDate,amount:a.amount,currency:a.currency,debtor:a.debtor?.name||"",debtorAccount:a.debtor?.account?.iban||"",creditor:a.creditor?.name||"",creditorAccount:a.creditor?.account?.iban||"",paymentInformationId:a.paymentInformationId,invoiceRef:a.invoiceRef,invoiceRefAdd:a.invoiceRefAdd,remittanceInformation:a.remittanceInformation,returnAdditionalInformation:a.returnAdditionalInformation,additionalInformation:r.additionalInformation,invoice:c,incomingPayment:u,payDebtorAvis:p,isSalary:l,bill:f,outgoingPayment:h,journalFinAcc:m};if(l){if(d)continue;g.amount=r.amount/100,d=!0}g[i]?o.push(g):s.push(g)}}}o.length&&l("record",{itemName:e.name,value:o}),s.length&&l("record",{itemName:"open"+e.name,value:s})})(e,o,n))),setTimeout(()=>{l("saveFull"),r(5,$=!1)},2e3)}catch{r(6,I="Ungültiger Inhalt!"),r(5,$=!0)}},N=e=>{try{if(!e?.length)return"";if(e.length<14)return"";const t=e.replaceAll(" ","").slice(-14),n=t.slice(-8),r=t.slice(0,4);let i="";for(let e=0;e<r.length/2;e++){const t=2*e,n=r.substring(t,t+2);i+=String.fromCharCode(n)}return i+n}catch{}return""};return e.$$set=e=>{"classId"in e&&r(0,d=e.classId),"eventId"in e&&r(14,u=e.eventId),"record"in e&&r(15,f=e.record),"item"in e&&r(16,h=e.item),"id"in e&&r(1,m=e.id),"name"in e&&r(2,p=e.name)},e.$$.update=()=>{8&e.$$.dirty&&(w.length||r(5,$=!1))},[d,m,p,w,y,$,I,i,o,s,a,v,async()=>{const{list:e}=h.properties,n=w[0],i=await t.getEvent(u);if(n){r(4,y=n.name);const t=await n.text();if(g)return await S(t,i);const o=(e=>{var t={toObj:function(e){var n={};if(1==e.nodeType){if(e.attributes.length)for(var r=0;r<e.attributes.length;r++)n["@"+e.attributes[r].nodeName]=(e.attributes[r].nodeValue||"").toString();if(e.firstChild){for(var i=0,o=0,s=!1,a=e.firstChild;a;a=a.nextSibling)1==a.nodeType?s=!0:3==a.nodeType&&a.nodeValue.match(/[^ \f\n\r\t\v]/)?i++:4==a.nodeType&&o++;if(s)if(i<2&&o<2)for(t.removeWhite(e),a=e.firstChild;a;a=a.nextSibling)3==a.nodeType?n["#text"]=t.escape(a.nodeValue):4==a.nodeType?n["#cdata"]=t.escape(a.nodeValue):n[a.nodeName]?n[a.nodeName]instanceof Array?n[a.nodeName][n[a.nodeName].length]=t.toObj(a):n[a.nodeName]=[n[a.nodeName],t.toObj(a)]:n[a.nodeName]=t.toObj(a);else e.attributes.length?n["#text"]=t.escape(t.innerXml(e)):n=t.escape(t.innerXml(e));else if(i)e.attributes.length?n["#text"]=t.escape(t.innerXml(e)):n=t.escape(t.innerXml(e));else if(o)if(o>1)n=t.escape(t.innerXml(e));else for(a=e.firstChild;a;a=a.nextSibling)n["#cdata"]=t.escape(a.nodeValue)}e.attributes.length||e.firstChild||(n=null)}else 9==e.nodeType&&(n=t.toObj(e.documentElement));return n},toJson:function(e,n,r){var i=n?'"'+n+'"':"";if(e instanceof Array){for(var o=0,s=e.length;o<s;o++)e[o]=t.toJson(e[o],"",r+"\t");i+=(n?":[":"[")+(e.length>1?"\n"+r+"\t"+e.join(",\n"+r+"\t")+"\n"+r:e.join(""))+"]"}else if(null==e)i+=(n&&":")+"null";else if("object"==typeof e){var a=[];for(var l in e)a[a.length]=t.toJson(e[l],l,r+"\t");i+=(n?":{":"{")+(a.length>1?"\n"+r+"\t"+a.join(",\n"+r+"\t")+"\n"+r:a.join(""))+"}"}else i+="string"==typeof e?(n&&":")+'"'+e.toString()+'"':(n&&":")+e.toString();return i},innerXml:function(e){var t="";if("innerHTML"in e)t=e.innerHTML;else for(var n=function(e){var t="";if(1==e.nodeType){t+="<"+e.nodeName;for(var r=0;r<e.attributes.length;r++)t+=" "+e.attributes[r].nodeName+'="'+(e.attributes[r].nodeValue||"").toString()+'"';if(e.firstChild){t+=">";for(var i=e.firstChild;i;i=i.nextSibling)t+=n(i);t+="</"+e.nodeName+">"}else t+="/>"}else 3==e.nodeType?t+=e.nodeValue:4==e.nodeType&&(t+="<![CDATA["+e.nodeValue+"]]>");return t},r=e.firstChild;r;r=r.nextSibling)t+=n(r);return t},escape:function(e){return e.replace(/[\\]/g,"\\\\").replace(/[\"]/g,'\\"').replace(/[\n]/g,"\\n").replace(/[\r]/g,"\\r")},removeWhite:function(e){e.normalize();for(var n=e.firstChild;n;)if(3==n.nodeType)if(n.nodeValue.match(/[^ \f\n\r\t\v]/))n=n.nextSibling;else{var r=n.nextSibling;e.removeChild(n),n=r}else 1==n.nodeType?(t.removeWhite(n),n=n.nextSibling):n=n.nextSibling;return e}};return e=(new window.DOMParser).parseFromString(e,"text/xml"),t.toObj(t.removeWhite(e))})(t),s=[],a=o.BkToCstmrDbtCdtNtfctn.Ntfctn,c=[].concat(a.Ntry);for(const e of c){let t=[].concat(e.NtryDtls.TxDtls);for(const n of t){const t=n.RmtInf?.Strd?.CdtrRefInf?.Ref||n.Refs.EndToEndId||"",r={date:e.ValDt.Dt,branchName:n.RltdPties?.Dbtr?.Nm||"",amount:n.AmtDtls?.TxAmt?.Amt["#text"]||n.Amt["#text"],reference:t,invoiceId:N(t),information:n.RmtInf?.Ustrd||""};s.push(r)}}s.length&&l("record",{itemName:e,value:s})}},()=>{r(3,w)},u,f,h,function(e){w=e,r(3,w)}]}class cc extends xe{constructor(e){var t;super(),document.getElementById("svelte-157hlzf-style")||((t=M("style")).id="svelte-157hlzf-style",t.textContent="label.file-dropzone{margin-top:0 !important}",D(document.head,t)),De(this,e,lc,ac,S,{classId:0,eventId:14,record:15,item:16,id:1,name:2})}}const dc=e=>{const t={},n=e.replaceAll("\r","").split("\n");return n?(t.iban=n[3],t.supplierText=n[5]+", "+n[6]+", "+n[7]+", "+n[8]+", "+n[9],t.supplier={company:{}},t.supplier.company.companyName=n[5],t.supplier.company.postcode=n[8],t.amount=n[18],t.amountOrg=n[18],t.currency={},t.currency.designation=n[19],t.reference=n[28],t.additionalInfo=n[29],t.extReference=uc(10,n[31]),t.amountVat=fc(!0,uc(32,n[31]),t.amount)||fc(!1,uc(33,n[31]),t.amount),t):t},uc=(e,t)=>{if(!e)return"";if(!t)return"";const n=t.split("/"+e+"/")[1];return n?.split("/")[0]||""},fc=(e,t,n)=>{if(!t)return"";let r=0;if(t.includes(":")){const n=t.split(";");for(const t of n){const[n,i]=t.split(":");r+=e?i/100*n:i}}else r=+n/(+t+100)*+t;return r},{document:hc}=Ee;function mc(e){let t,n,r,i,o;function s(t){e[14](t)}let a={class:e[0],id:e[1],name:e[2],accept:"application/pdf",max:"1",beforeChange:e[10]};return void 0!==e[3]&&(a.files=e[3]),t=new e[5]({props:a}),re.push(()=>Se(t,"files",s)),t.$on("change",e[8]),i=new e[6]({props:{inputClass:e[0],hidden:!0,id:e[1],name:e[1],value:e[4]}}),{c(){Ne(t.$$.fragment),r=L(),Ne(i.$$.fragment)},m(e,n){Te(t,e,n),x(e,r,n),Te(i,e,n),o=!0},p(e,r){const o={};1&r&&(o.class=e[0]),2&r&&(o.id=e[1]),4&r&&(o.name=e[2]),!n&&8&r&&(n=!0,o.files=e[3],ue(()=>n=!1)),t.$set(o);const s={};1&r&&(s.inputClass=e[0]),2&r&&(s.id=e[1]),2&r&&(s.name=e[1]),16&r&&(s.value=e[4]),i.$set(s)},i(e){o||($e(t.$$.fragment,e),$e(i.$$.fragment,e),o=!0)},o(e){Ie(t.$$.fragment,e),Ie(i.$$.fragment,e),o=!1},d(e){Re(t,e),e&&k(r),Re(i,e)}}}function pc(e){let t,n,r,i;n=new e[6]({props:{inputClass:e[0],readonly:!0,id:e[1],name:e[1],value:e[4]}});let o=e[4]&&gc(e);return{c(){t=M("div"),Ne(n.$$.fragment),r=L(),o&&o.c(),q(t,"position","relative")},m(e,s){x(e,t,s),Te(n,t,null),D(t,r),o&&o.m(t,null),i=!0},p(e,r){const i={};1&r&&(i.inputClass=e[0]),2&r&&(i.id=e[1]),2&r&&(i.name=e[1]),16&r&&(i.value=e[4]),n.$set(i),e[4]?o?(o.p(e,r),16&r&&$e(o,1)):(o=gc(e),o.c(),$e(o,1),o.m(t,null)):o&&(ye(),Ie(o,1,1,()=>{o=null}),ve())},i(e){i||($e(n.$$.fragment,e),$e(o),i=!0)},o(e){Ie(n.$$.fragment,e),Ie(o),i=!1},d(e){e&&k(t),Re(n),o&&o.d()}}}function gc(e){let t,n,r,i,o;return n=new Me({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather pointer svelte-o0hiko")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[9]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function wc(e){let t,n,r,i;const o=[pc,mc],s=[];return t=function(e){return e[7]?0:1}(e),n=s[t]=o[t](e),{c(){n.c(),r=F()},m(e,n){s[t].m(e,n),x(e,r,n),i=!0},p(e,[t]){n.p(e,t)},i(e){i||($e(n),i=!0)},o(e){Ie(n),i=!1},d(e){s[t].d(e),e&&k(r)}}}let yc;function vc(e,n,r){const{FileDropzone:i,TextField:o}=c,s=ee();let{classId:a}=n,{eventId:l}=n,{record:d}=n,{item:u}=n,{id:f}=n,{name:h}=n,m=[],p=d[u.name]||"",g=!!d._id;const w={scale:{once:!1,value:3,start:3,step:.4,stop:4},resultOpts:{singleCodeInPage:!0,multiCodesInPage:!1,maxCodesInPage:1},improve:!0,jsQR:{}};var y=async function(e){if(!e.success)return;const n=await t.getSchema(l),i=e.codes?.filter(e=>!!e)?.at(0);if(!i?.length)return;if(!i.startsWith("SPC"))return;const o=dc(i);for(const e in o){if(n.items.find(t=>t.name===e)){if("object"==typeof o[e]){let n={};for(const i in o[e])if("object"==typeof o[e][i])for(const s in o[e][i]){o[e][i][s]&&(n[s]=o[e][i][s]);const a=await t.getSectionView(i,n);if(a?.length){const n=await t.getSectionView(e,{[i]:a[0]._id});n?.length&&r(11,d[e]=n[0]._id,d)}}else{o[e][i]&&(n[i]=o[e][i]);const s=await t.getSectionView(e,n);s?.length&&r(11,d[e]=s[0]._id,d)}}else o[e]&&r(11,d[e]=o[e],d);s("record",{itemName:e,value:d[e]})}}};return Q(()=>{if(yc)return;let e=document.createElement("script");e.src="/QR/pdf-qr2.js",document.head.append(e),e.onload=function(){yc=PDF_QR_JS}}),J(()=>{}),e.$$set=e=>{"classId"in e&&r(0,a=e.classId),"eventId"in e&&r(12,l=e.eventId),"record"in e&&r(11,d=e.record),"item"in e&&r(13,u=e.item),"id"in e&&r(1,f=e.id),"name"in e&&r(2,h=e.name)},[a,f,h,m,p,i,o,g,async e=>{const n=m[0];if(!n){s("record",{itemName:"$file",value:!1});const e=await t.getSchema(l);for(const t of e.items)s("record",{itemName:t.name,value:""});return}const i=URL.createObjectURL(n);r(4,p=n.name),s("record",{itemName:"$file",value:{fileName:p,file:n}}),yc.decodeDocument(i,w,y)},async()=>{if(!d?._id)return;const e=await t.getTaskByDocId(d._id,!0);if(!e)return;const n=await t.getUserReports(e._id);if(!n?.length)return;let r="/viewer/doc/index.html?file="+("/api/userreport/"+n[0]._id)+"&type=pdf";window.open(r,"","popup=yes toolbar=no width=800 height=1024")},()=>{r(3,m)},d,l,u,function(e){m=e,r(3,m)}]}class $c extends xe{constructor(e){var t;super(),hc.getElementById("svelte-o0hiko-style")||((t=M("style")).id="svelte-o0hiko-style",t.textContent=".feather.svelte-o0hiko{position:absolute;top:0.75em;left:-1.25em;color:#4300b0}label.file-dropzone{margin-top:0 !important}",D(hc.head,t)),De(this,e,vc,wc,S,{classId:0,eventId:12,record:11,item:13,id:1,name:2})}}const{document:Ic}=Ee;function _c(e){let t,n,r,i,o;function s(t){e[18](t)}let a={class:e[0],id:e[1],name:e[2],accept:e[3],max:"1",beforeChange:e[12]};return void 0!==e[4]&&(a.files=e[4]),t=new e[7]({props:a}),re.push(()=>Se(t,"files",s)),t.$on("change",e[9]),i=new e[8]({props:{inputClass:e[0],hidden:!0,id:e[1],name:e[1],value:e[5]}}),{c(){Ne(t.$$.fragment),r=L(),Ne(i.$$.fragment)},m(e,n){Te(t,e,n),x(e,r,n),Te(i,e,n),o=!0},p(e,r){const o={};1&r&&(o.class=e[0]),2&r&&(o.id=e[1]),4&r&&(o.name=e[2]),8&r&&(o.accept=e[3]),!n&&16&r&&(n=!0,o.files=e[4],ue(()=>n=!1)),t.$set(o);const s={};1&r&&(s.inputClass=e[0]),2&r&&(s.id=e[1]),2&r&&(s.name=e[1]),32&r&&(s.value=e[5]),i.$set(s)},i(e){o||($e(t.$$.fragment,e),$e(i.$$.fragment,e),o=!0)},o(e){Ie(t.$$.fragment,e),Ie(i.$$.fragment,e),o=!1},d(e){Re(t,e),e&&k(r),Re(i,e)}}}function Cc(e){let t,n,r,i;n=new e[8]({props:{inputClass:e[0],readonly:!0,id:e[1],name:e[1],value:e[5]}});let o=e[5]&&Ec(e);return{c(){t=M("div"),Ne(n.$$.fragment),r=L(),o&&o.c(),q(t,"position","relative")},m(e,s){x(e,t,s),Te(n,t,null),D(t,r),o&&o.m(t,null),i=!0},p(e,r){const i={};1&r&&(i.inputClass=e[0]),2&r&&(i.id=e[1]),2&r&&(i.name=e[1]),32&r&&(i.value=e[5]),n.$set(i),e[5]?o?(o.p(e,r),32&r&&$e(o,1)):(o=Ec(e),o.c(),$e(o,1),o.m(t,null)):o&&(ye(),Ie(o,1,1,()=>{o=null}),ve())},i(e){i||($e(n.$$.fragment,e),$e(o),i=!0)},o(e){Ie(n.$$.fragment,e),Ie(o),i=!1},d(e){e&&k(t),Re(n),o&&o.d()}}}function Ec(e){let t,n,r,i,o;const s=[bc,Ac],a=[];function l(e,n){return 32&n&&(t=!!e[5].endsWith(".mp4")),t?0:1}return n=l(e,-1),r=a[n]=s[n](e),{c(){r.c(),i=F()},m(e,t){a[n].m(e,t),x(e,i,t),o=!0},p(e,t){let o=n;n=l(e,t),n===o?a[n].p(e,t):(ye(),Ie(a[o],1,1,()=>{a[o]=null}),ve(),r=a[n],r?r.p(e,t):(r=a[n]=s[n](e),r.c()),$e(r,1),r.m(i.parentNode,i))},i(e){o||($e(r),o=!0)},o(e){Ie(r),o=!1},d(e){a[n].d(e),e&&k(i)}}}function Ac(e){let t,n,r,i,o;return n=new Me({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather pointer svelte-o0hiko")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[10]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function bc(e){let t,n={ctx:e,current:null,token:null,hasCatch:!1,pending:Tc,then:Nc,catch:Sc,value:23};return _e(e[11](),n),{c(){t=F(),n.block.c()},m(e,r){x(e,t,r),n.block.m(e,n.anchor=r),n.mount=()=>t.parentNode,n.anchor=t},p(t,r){Ce(n,e=t,r)},i:_,o:_,d(e){e&&k(t),n.block.d(e),n.token=null,n=null}}}function Sc(e){return{c:_,m:_,p:_,d:_}}function Nc(e){let t,n,r,i;return{c(){t=M("video"),n=M("source"),i=B("\n Your browser does not support HTML video."),n.src!==(r=e[23])&&z(n,"src",r),z(n,"type","video/mp4"),z(t,"width","500"),t.controls=!0,q(t,"margin-top","1em")},m(e,r){x(e,t,r),D(t,n),D(t,i)},p:_,d(e){e&&k(t)}}}function Tc(e){return{c:_,m:_,p:_,d:_}}function Rc(e){let t,n,r,i;const o=[Cc,_c],s=[];function a(e,t){return e[6]?0:1}return t=a(e),n=s[t]=o[t](e),{c(){n.c(),r=F()},m(e,n){s[t].m(e,n),x(e,r,n),i=!0},p(e,[i]){let l=t;t=a(e),t===l?s[t].p(e,i):(ye(),Ie(s[l],1,1,()=>{s[l]=null}),ve(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),$e(n,1),n.m(r.parentNode,r))},i(e){i||($e(n),i=!0)},o(e){Ie(n),i=!1},d(e){s[t].d(e),e&&k(r)}}}function Dc(e,n,r){const{FileDropzone:i,TextField:o}=c,s=ee();let{classId:a}=n,{eventId:l}=n,{record:d}=n,{item:u}=n,{id:f}=n,{name:h}=n,{praefix:m}=n,{recordId:p}=n,{fileType:g="application/pdf"}=n,w=[],y="",v=!1;return Q(()=>{(async()=>{if(!p)return;const e=await t.getTaskByDocId(p,!0);if(!e)return s("listRecord",{itemName:"fileName",value:"",string:!0});const n=d[u.name];if(!n)return s("listRecord",{itemName:"fileName",value:"",string:!0});const i=await t.getUserReports(e._id);if(!i?.length)return s("listRecord",{itemName:"fileName",value:"",string:!0});let o=i.find(e=>e.fileName===n);if(!o)return s("listRecord",{itemName:"fileName",value:"",string:!0});r(5,y=o.fileName),r(6,v=void 0===m?!!p:!!y)})()}),J(()=>{}),e.$$set=e=>{"classId"in e&&r(0,a=e.classId),"eventId"in e&&r(13,l=e.eventId),"record"in e&&r(14,d=e.record),"item"in e&&r(15,u=e.item),"id"in e&&r(1,f=e.id),"name"in e&&r(2,h=e.name),"praefix"in e&&r(16,m=e.praefix),"recordId"in e&&r(17,p=e.recordId),"fileType"in e&&r(3,g=e.fileType)},[a,f,h,g,w,y,v,i,o,async e=>{const t=w[0];URL.createObjectURL(t),r(5,y=t.name),s("record",{itemName:"$file",value:{fileName:y,file:t}}),void 0!==m&&s("listRecord",{itemName:"fileName",value:y,string:!0})},async()=>{if(!p)return;let e;const n=await t.getTaskByDocId(p,!0);if(!n)return;const r=await t.getUserReports(n._id);if(!r?.length)return;let i=r.find(e=>e.fileName===y);i||(i=r[0]);e="/viewer/doc/index.html?file="+("/api/userreport/"+i._id)+"&type=pdf",window.open(e,"","popup=yes toolbar=no width=800 height=1024")},async()=>{const e=await t.getTaskByDocId(p,!0);if(!e)return"";const n=await t.getUserReports(e._id);if(!n?.length)return"";let r=n.find(e=>e.fileName===y);return r||(r=n[0]),"/api/userreport/"+r._id},()=>{r(4,w)},l,d,u,m,p,function(e){w=e,r(4,w)}]}class xc extends xe{constructor(e){var t;super(),Ic.getElementById("svelte-o0hiko-style")||((t=M("style")).id="svelte-o0hiko-style",t.textContent=".feather.svelte-o0hiko{position:absolute;top:0.75em;left:-1.25em;color:#4300b0}label.file-dropzone{margin-top:0 !important}",D(Ic.head,t)),De(this,e,Dc,Rc,S,{classId:0,eventId:13,record:14,item:15,id:1,name:2,praefix:16,recordId:17,fileType:3})}}function kc(e){let t,n,r;return n=new e[5]({props:{type:"string",inputClass:e[2],id:e[0],name:e[0],value:e[1],pattern:Oc,placeholder:Mc,readonly:e[3],disabled:e[4]}}),n.$on("change",e[6]),{c(){t=M("div"),Ne(n.$$.fragment),q(t,"max-width","4em")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p(e,[t]){const r={};4&t&&(r.inputClass=e[2]),1&t&&(r.id=e[0]),1&t&&(r.name=e[0]),2&t&&(r.value=e[1]),8&t&&(r.readonly=e[3]),16&t&&(r.disabled=e[4]),n.$set(r)},i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}const Oc="([01][0-9]|2[0-3]):([0-5][0-9])",Mc="";function Pc(e,t,n){const r=ee(),{TextField:i}=c;let{id:o}=t,{item:s}=t,{value:a}=t,{inputClass:l}=t,{readonly:d}=t,{disabled:u}=t,{praefix:f}=t;const h=e=>{if(!e)return"";const[t,n]=e.split(":");return 4===t.length?`${t.substr(0,2)}:${t.substring(2,4)}`:3===t.length?t.substring(0,2)>23?`0${t.substring(0,1)}:${t.substring(1,3)}`:`${t.substring(0,2)}:${t.substring(2,3)}0`:2===t.length?t>23?`0${t.substring(0,1)}:${t.substring(1,2)}0`:`${t}:${(n||"0").padStart(2,"0")}`:`0${t}:${(n||"0").padStart(2,"0")}`};return e.$$set=e=>{"id"in e&&n(0,o=e.id),"item"in e&&n(7,s=e.item),"value"in e&&n(1,a=e.value),"inputClass"in e&&n(2,l=e.inputClass),"readonly"in e&&n(3,d=e.readonly),"disabled"in e&&n(4,u=e.disabled),"praefix"in e&&n(8,f=e.praefix)},[o,a,l,d,u,i,({detail:e})=>{r("blur",{value:h(e.value)}),r("checkRange",{idx:f,fieldId:o,value:e.value})},s,f]}class Bc extends xe{constructor(e){var t;super(),document.getElementById("svelte-vvt0yv-style")||((t=M("style")).id="svelte-vvt0yv-style",t.textContent=".text-field input.invalid{border:1px red solid !important}",D(document.head,t)),De(this,e,Pc,kc,S,{id:0,item:7,value:1,inputClass:2,readonly:3,disabled:4,praefix:8})}}const{document:Lc}=Ee;function Fc(e,t,n){const r=e.slice();return r[22]=t[n],r}function Vc(e,t,n){const r=e.slice();return r[25]=t[n],r[27]=n,r}function Uc(e){let t,n,r=e[3](e[22],e[25])+"",i=e[27]&&function(){let e;return{c(){e=B(", ")},m(t,n){x(t,e,n)},d(t){t&&k(e)}}}();return{c(){t=M("span"),i&&i.c(),n=B(r),z(t,"class","lookupValue")},m(e,r){x(e,t,r),i&&i.m(t,null),D(t,n)},p(e,t){3&t&&r!==(r=e[3](e[22],e[25])+"")&&H(n,r)},d(e){e&&k(t),i&&i.d()}}}function Wc(e){let t,n,r,i,o,s,a,l,c,d=e[0],u=[];for(let t=0;t<d.length;t+=1)u[t]=Uc(Vc(e,d,t));i=new lt({props:{size:"18"}});let f=e[2]&&function(e){let t,n,r,i,o,s,a,l,c;return i=new Me({props:{size:"18"}}),{c(){t=M("span"),t.textContent="  /  ",n=L(),r=M("span"),Ne(i.$$.fragment),o=L(),s=M("span"),s.textContent="Rechnung",z(r,"class","pointer feather2 svelte-1jurfpd")},m(d,u){x(d,t,u),x(d,n,u),x(d,r,u),Te(i,r,null),x(d,o,u),x(d,s,u),a=!0,l||(c=V(r,"click",function(){b(e[5](e[22]._id))&&e[5](e[22]._id).apply(this,arguments)}),l=!0)},p(t,n){e=t},i(e){a||($e(i.$$.fragment,e),a=!0)},o(e){Ie(i.$$.fragment,e),a=!1},d(e){e&&k(t),e&&k(n),e&&k(r),Re(i),e&&k(o),e&&k(s),l=!1,c()}}}(e);return{c(){t=M("div");for(let e=0;e<u.length;e+=1)u[e].c();n=L(),r=M("span"),Ne(i.$$.fragment),o=L(),f&&f.c(),s=L(),z(r,"class","feather pointer svelte-1jurfpd"),z(t,"class","lookupItem svelte-1jurfpd")},m(d,h){x(d,t,h);for(let e=0;e<u.length;e+=1)u[e].m(t,null);D(t,n),D(t,r),Te(i,r,null),D(t,o),f&&f.m(t,null),D(t,s),a=!0,l||(c=V(r,"click",function(){b(e[4](e[22]._id))&&e[4](e[22]._id).apply(this,arguments)}),l=!0)},p(r,i){if(e=r,11&i){let r;for(d=e[0],r=0;r<d.length;r+=1){const o=Vc(e,d,r);u[r]?u[r].p(o,i):(u[r]=Uc(o),u[r].c(),u[r].m(t,n))}for(;r<u.length;r+=1)u[r].d(1);u.length=d.length}e[2]&&f.p(e,i)},i(e){a||($e(i.$$.fragment,e),$e(f),a=!0)},o(e){Ie(i.$$.fragment,e),Ie(f),a=!1},d(e){e&&k(t),O(u,e),Re(i),f&&f.d(),l=!1,c()}}}function zc(e){let t,n,r=e[1],i=[];for(let t=0;t<r.length;t+=1)i[t]=Wc(Fc(e,r,t));const o=e=>Ie(i[e],1,1,()=>{i[e]=null});return{c(){t=M("div");for(let e=0;e<i.length;e+=1)i[e].c();z(t,"class","lookup svelte-1jurfpd")},m(e,r){x(e,t,r);for(let e=0;e<i.length;e+=1)i[e].m(t,null);n=!0},p(e,[n]){if(63&n){let s;for(r=e[1],s=0;s<r.length;s+=1){const o=Fc(e,r,s);i[s]?(i[s].p(o,n),$e(i[s],1)):(i[s]=Wc(o),i[s].c(),$e(i[s],1),i[s].m(t,null))}for(ye(),s=r.length;s<i.length;s+=1)o(s);ve()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)$e(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)Ie(i[e]);n=!1},d(e){e&&k(t),O(i,e)}}}function Hc(e,n,r){let{id:i}=n,{item:o}=n,{praefix:s}=n,{record:a}=n,{notifyList:l}=n;const{refItem:c,view:d,beforeSave:u,_state:f,addAttachment:h}=o.properties;let p=d.split(","),[g,w]=c.split(":"),y=[];const[v,$]=w.split("."),I=(e,t)=>{const[n,r]=t.split(".");return r?e[n]?e[n][r]:void 0:""},_=(e=!0)=>{ce().then(()=>{const t=document.querySelector("div.form-field."+o.name);if(t&&(t.style.display=e?"none":"flex"),!e&&u){const e=t.querySelector("div label");e&&(e.style.color="red")}})};return Q(_),e.$$set=e=>{"id"in e&&r(6,i=e.id),"item"in e&&r(7,o=e.item),"praefix"in e&&r(8,s=e.praefix),"record"in e&&r(9,a=e.record),"notifyList"in e&&r(10,l=e.notifyList)},e.$$.update=()=>{1024&e.$$.dirty&&(async e=>{const{itemName:n,value:i}=e||{};if(n!==g)return;if(r(1,y=[]),!i)return;if(!!u==!!a._id)return _();if(!a._id&&!a[g])return _();const o=!p.some(e=>e.includes(":")),s=$?$+"."+g:g;let l={[s]:a[g]||a._id};f&&(l=[{$match:l},{$addFields:{_ids:{$toString:"$_id"}}},{$lookup:{from:"_task",localField:"_ids",foreignField:"docId",as:"_task"}},{$unwind:{path:"$_task",preserveNullAndEmptyArrays:!0}},{$match:{"_task.status":f}}]);let c=!1;if(!s.includes(".")){const e=(await t.getSchemaByClass(v)).items.find(e=>e.name===s);e?.properties?.multi&&(c=!0)}if(r(1,y=await t.getSectionView(v,l,o,!0,c)),!o&&y.length){const e=p.find(e=>e.includes(":")),t=e.split(":")[0];r(1,y=y.map(e=>{const n=e[t].find(e=>e[t]===a._id);return n._id=e._id,n})),r(0,p=p.map(e=>e.split(":")[1]))}_(!y.length)})(l)},[p,y,h,(e,t)=>"boolean"===o.type?e[t]?"ja":"nein":"object"===o.type?"(ja)":e["_"+t]||m(e[t])||e[t]||I(e,t),e=>async()=>{const n=await t.getTaskByDocId(e,!0);if(!n)return;const r=n._id,i=`/task/${n.event}/${r}/task?view=standalone`;window.open(i)},e=>async()=>{let n;const r=await t.getTaskByDocId(e,!0);if(!r)return;const i=await t.getUserReports(r._id);if(!i?.length)return;n="/viewer/doc/index.html?file="+("/api/userreport/"+i[0]._id)+"&type=pdf",window.open(n,"","popup=yes toolbar=no width=800 height=1024")},i,o,s,a,l]}class jc extends xe{constructor(e){var t;super(),Lc.getElementById("svelte-1jurfpd-style")||((t=M("style")).id="svelte-1jurfpd-style",t.textContent=".feather.svelte-1jurfpd{position:absolute;top:0;left:-1.5em;color:#4300b0}.feather2.svelte-1jurfpd{color:#4300b0}div.lookup.svelte-1jurfpd{margin-top:0.75em;color:#aaa}div.lookupItem.svelte-1jurfpd{position:relative;margin-left:2em;padding-bottom:0.75em}div.form-field:has(div.lookup){margin-bottom:0.5em !important}div.field:has(div.lookupItem){background-color:#f5f5f5 !important}div.field:has(div.lookup){margin-bottom:0.25em !important}",D(Lc.head,t)),De(this,e,Hc,zc,S,{id:6,item:7,praefix:8,record:9,notifyList:10})}}function qc(e){let t,n,r;return n=new mt({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather2 svelte-9up2nn")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function Gc(e){let t,n,r,i,o;return n=new mt({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather pointer svelte-9up2nn")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[9]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function Xc(e){let t,n,r,i,o,s;n=new e[8]({props:{inputClass:e[0],disabled:e[1],formnovalidate:e[2],readonly:e[3],required:e[4],id:e[5],name:e[6],value:e[7]}}),n.$on("change",e[10]);const a=[Gc,qc],l=[];function c(e,t){return e[7]?0:1}return i=c(e),o=l[i]=a[i](e),{c(){t=M("div"),Ne(n.$$.fragment),r=L(),o.c(),q(t,"position","relative")},m(e,o){x(e,t,o),Te(n,t,null),D(t,r),l[i].m(t,null),s=!0},p(e,[r]){const s={};1&r&&(s.inputClass=e[0]),2&r&&(s.disabled=e[1]),4&r&&(s.formnovalidate=e[2]),8&r&&(s.readonly=e[3]),16&r&&(s.required=e[4]),32&r&&(s.id=e[5]),64&r&&(s.name=e[6]),128&r&&(s.value=e[7]),n.$set(s);let d=i;i=c(e),i===d?l[i].p(e,r):(ye(),Ie(l[d],1,1,()=>{l[d]=null}),ve(),o=l[i],o?o.p(e,r):(o=l[i]=a[i](e),o.c()),$e(o,1),o.m(t,null))},i(e){s||($e(n.$$.fragment,e),$e(o),s=!0)},o(e){Ie(n.$$.fragment,e),Ie(o),s=!1},d(e){e&&k(t),Re(n),l[i].d()}}}function Yc(e,t,n){const{TextField:r}=c;let{inputClass:i}=t,{disabled:o}=t,{formnovalidate:s}=t,{readonly:a}=t,{required:l}=t,{id:d}=t,{name:u}=t,{value:f}=t;return e.$$set=e=>{"inputClass"in e&&n(0,i=e.inputClass),"disabled"in e&&n(1,o=e.disabled),"formnovalidate"in e&&n(2,s=e.formnovalidate),"readonly"in e&&n(3,a=e.readonly),"required"in e&&n(4,l=e.required),"id"in e&&n(5,d=e.id),"name"in e&&n(6,u=e.name),"value"in e&&n(7,f=e.value)},[i,o,s,a,l,d,u,f,r,async()=>{if(!f)return;let e=f;e.includes("//")||(e="//"+e),window.open(e,"_blank")},function(t){te(e,t)}]}class Zc extends xe{constructor(e){var t;super(),document.getElementById("svelte-9up2nn-style")||((t=M("style")).id="svelte-9up2nn-style",t.textContent=".feather.svelte-9up2nn{position:absolute;top:0.75em;left:0.5em;color:#4300b0;margin-left:-2em}.feather2.svelte-9up2nn{position:absolute;top:0.75em;left:0.5em;color:light-gray;margin-left:-2em}",D(document.head,t)),De(this,e,Yc,Xc,S,{inputClass:0,disabled:1,formnovalidate:2,readonly:3,required:4,id:5,name:6,value:7})}}function Kc(e){let t,n,r;return n=new bt({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather2 svelte-9up2nn")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function Qc(e){let t,n,r,i,o;return n=new bt({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather pointer svelte-9up2nn")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[12]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function Jc(e){let t,n,r,i,o,s;n=new e[10]({props:{inputClass:e[2],pattern:e[0],placeholder:e[1],disabled:e[3],formnovalidate:e[4],readonly:e[5],required:e[6],id:e[7],name:e[8],value:e[9]}}),n.$on("change",e[15]);const a=[Qc,Kc],l=[];function c(e,t){return e[9]?0:1}return i=c(e),o=l[i]=a[i](e),{c(){t=M("div"),Ne(n.$$.fragment),r=L(),o.c(),q(t,"position","relative")},m(e,o){x(e,t,o),Te(n,t,null),D(t,r),l[i].m(t,null),s=!0},p(e,[r]){const s={};4&r&&(s.inputClass=e[2]),1&r&&(s.pattern=e[0]),2&r&&(s.placeholder=e[1]),8&r&&(s.disabled=e[3]),16&r&&(s.formnovalidate=e[4]),32&r&&(s.readonly=e[5]),64&r&&(s.required=e[6]),128&r&&(s.id=e[7]),256&r&&(s.name=e[8]),512&r&&(s.value=e[9]),n.$set(s);let d=i;i=c(e),i===d?l[i].p(e,r):(ye(),Ie(l[d],1,1,()=>{l[d]=null}),ve(),o=l[i],o?o.p(e,r):(o=l[i]=a[i](e),o.c()),$e(o,1),o.m(t,null))},i(e){s||($e(n.$$.fragment,e),$e(o),s=!0)},o(e){Ie(n.$$.fragment,e),Ie(o),s=!1},d(e){e&&k(t),Re(n),l[i].d()}}}function ed(e,t,r){let i;const{TextField:o}=c,{environment:s}=u;N(e,s,e=>r(16,i=e));const a=JSON.parse(n.getItem("Locale"));let{inputClass:l}=t,{disabled:d}=t,{formnovalidate:f}=t,{readonly:h}=t,{required:m}=t,{id:p}=t,{name:g}=t,{value:w}=t,{pattern:y}=t,{placeholder:v}=t,{notifyList:$}=t,{country:I}=t;y||="(\\+(9[976]\\d|8[987530]\\d|6[987]\\d|5[90]\\d|42\\d|3[875]\\d|2[98654321]\\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1))?\\W*\\d\\W*\\d\\W*\\d\\W*\\d\\W*\\d\\W*\\d\\W*\\d\\W*\\d\\W*\\d\\W*(\\d{1,2})$",v||="+41 58 234 56 78";const _={ch:"^(((\\+41|0041)\\s?\\d{2})|0\\d{2})(\\s?\\d){7}$",li:"^(((\\+41|0041)\\s?\\d{2})|0\\d{2})(\\s?\\d){7}$",de:"^((\\+49|0049)\\s?)?(0|\\s?)?\\d{2,5}(\\s?\\d){4,9}$",at:"^((\\+43|0043)\\s?)?(0\\s?)?[1-9]\\d{1,4}(\\s?\\d){4,10}$",us:"^((\\+1|001)\\s?)?(\\d{3}\\s?){2}\\d{4}$",zh:"^((\\+86|0086)\\s?)?((1\\d{10})|(0\\d{2,3}\\s?\\d{7,8}))$"},C={ch:"+41 58 234 5678",li:"+41 58 234 5678",de:"+49 619 1234 5678",at:"+43 800 123 456",us:"+1 2345 678 901",zh:"+86 123 456 7589"};return e.$$set=e=>{"inputClass"in e&&r(2,l=e.inputClass),"disabled"in e&&r(3,d=e.disabled),"formnovalidate"in e&&r(4,f=e.formnovalidate),"readonly"in e&&r(5,h=e.readonly),"required"in e&&r(6,m=e.required),"id"in e&&r(7,p=e.id),"name"in e&&r(8,g=e.name),"value"in e&&r(9,w=e.value),"pattern"in e&&r(0,y=e.pattern),"placeholder"in e&&r(1,v=e.placeholder),"notifyList"in e&&r(13,$=e.notifyList),"country"in e&&r(14,I=e.country)},e.$$.update=()=>{8192&e.$$.dirty&&(async e=>{const{listName:t,itemName:n,value:o}=e||{},s=i?.country?.countryCode?.toLowerCase()||a.lang;I&&n===I&&o?xp("country",o).then(e=>{if(e.phonePattern)r(0,y=e.phonePattern),r(1,v=e.phonePlaceholder||"");else{const t=e.countryCode.toLowerCase();_[t]&&(r(0,y=_[t]),r(1,v=C[t]))}}).catch(()=>{r(0,y=_[s]),r(1,v=C[s])}):I&&(r(0,y=_[s]),r(1,v=C[s]))})($)},[y,v,l,d,f,h,m,p,g,w,o,s,async()=>{if(!w)return;let e="tel:"+w;window.open(e,"_self")},$,I,function(t){te(e,t)}]}class td extends xe{constructor(e){var t;super(),document.getElementById("svelte-9up2nn-style")||((t=M("style")).id="svelte-9up2nn-style",t.textContent=".feather.svelte-9up2nn{position:absolute;top:0.75em;left:0.5em;color:#4300b0;margin-left:-2em}.feather2.svelte-9up2nn{position:absolute;top:0.75em;left:0.5em;color:light-gray;margin-left:-2em}",D(document.head,t)),De(this,e,ed,Jc,S,{inputClass:2,disabled:3,formnovalidate:4,readonly:5,required:6,id:7,name:8,value:9,pattern:0,placeholder:1,notifyList:13,country:14})}}function nd(e){let t,n,r;return n=new $t({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather2 svelte-9up2nn")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function rd(e){let t,n,r,i,o;return n=new $t({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather pointer svelte-9up2nn")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[12]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function id(e){let t,n,r,i,o,s;n=new e[11]({props:{type:"email",inputClass:e[0],pattern:e[9],placeholder:e[10],disabled:e[1],formnovalidate:e[2],readonly:e[3],required:e[4],id:e[5],name:e[6],multiple:e[8],value:e[7]}}),n.$on("change",e[13]);const a=[rd,nd],l=[];function c(e,t){return e[7]?0:1}return i=c(e),o=l[i]=a[i](e),{c(){t=M("div"),Ne(n.$$.fragment),r=L(),o.c(),q(t,"position","relative")},m(e,o){x(e,t,o),Te(n,t,null),D(t,r),l[i].m(t,null),s=!0},p(e,[r]){const s={};1&r&&(s.inputClass=e[0]),512&r&&(s.pattern=e[9]),1024&r&&(s.placeholder=e[10]),2&r&&(s.disabled=e[1]),4&r&&(s.formnovalidate=e[2]),8&r&&(s.readonly=e[3]),16&r&&(s.required=e[4]),32&r&&(s.id=e[5]),64&r&&(s.name=e[6]),256&r&&(s.multiple=e[8]),128&r&&(s.value=e[7]),n.$set(s);let d=i;i=c(e),i===d?l[i].p(e,r):(ye(),Ie(l[d],1,1,()=>{l[d]=null}),ve(),o=l[i],o?o.p(e,r):(o=l[i]=a[i](e),o.c()),$e(o,1),o.m(t,null))},i(e){s||($e(n.$$.fragment,e),$e(o),s=!0)},o(e){Ie(n.$$.fragment,e),Ie(o),s=!1},d(e){e&&k(t),Re(n),l[i].d()}}}function od(e,t,n){const{TextField:r}=c;let{inputClass:i}=t,{disabled:o}=t,{formnovalidate:s}=t,{readonly:a}=t,{required:l}=t,{id:d}=t,{name:u}=t,{value:f}=t,{multiple:h}=t,{pattern:m}=t,{placeholder:p}=t;return e.$$set=e=>{"inputClass"in e&&n(0,i=e.inputClass),"disabled"in e&&n(1,o=e.disabled),"formnovalidate"in e&&n(2,s=e.formnovalidate),"readonly"in e&&n(3,a=e.readonly),"required"in e&&n(4,l=e.required),"id"in e&&n(5,d=e.id),"name"in e&&n(6,u=e.name),"value"in e&&n(7,f=e.value),"multiple"in e&&n(8,h=e.multiple),"pattern"in e&&n(9,m=e.pattern),"placeholder"in e&&n(10,p=e.placeholder)},[i,o,s,a,l,d,u,f,h,m,p,r,async()=>{if(!f)return;let e="mailto:"+f;window.open(e,"_self")},function(t){te(e,t)}]}class sd extends xe{constructor(e){var t;super(),document.getElementById("svelte-9up2nn-style")||((t=M("style")).id="svelte-9up2nn-style",t.textContent=".feather.svelte-9up2nn{position:absolute;top:0.75em;left:0.5em;color:#4300b0;margin-left:-2em}.feather2.svelte-9up2nn{position:absolute;top:0.75em;left:0.5em;color:light-gray;margin-left:-2em}",D(document.head,t)),De(this,e,od,id,S,{inputClass:0,disabled:1,formnovalidate:2,readonly:3,required:4,id:5,name:6,value:7,multiple:8,pattern:9,placeholder:10})}}const ad=["Activate","AddUndo","BeforeAddUndo","BeforeExecCommand","BeforeGetContent","BeforeRenderUI","BeforeSetContent","BeforePaste","Blur","Change","ClearUndos","Click","CommentChange","CompositionEnd","CompositionStart","CompositionUpdate","ContextMenu","Copy","Cut","Dblclick","Deactivate","Dirty","Drag","DragDrop","DragEnd","DragGesture","DragOver","Drop","ExecCommand","Focus","FocusIn","FocusOut","GetContent","Hide","Init","Input","KeyDown","KeyPress","KeyUp","LoadContent","MouseDown","MouseEnter","MouseLeave","MouseMove","MouseOut","MouseOver","MouseUp","NodeChange","ObjectResizeStart","ObjectResized","ObjectSelected","Paste","PostProcess","PostRender","PreProcess","ProgressState","Redo","Remove","Reset","ResizeEditor","SaveContent","SelectionChange","SetAttrib","SetContent","Show","Submit","Undo","VisualAid"];function ld(e){let t;return{c(){t=M("textarea"),z(t,"id",e[0]),q(t,"visibility","hidden")},m(n,r){x(n,t,r),e[20](t)},p(e,n){1&n&&z(t,"id",e[0])},d(n){n&&k(t),e[20](null)}}}function cd(e){let t;return{c(){t=M("div"),z(t,"id",e[0])},m(n,r){x(n,t,r),e[19](t)},p(e,n){1&n&&z(t,"id",e[0])},d(n){n&&k(t),e[19](null)}}}function dd(e){let t;function n(e,t){return e[1]?cd:ld}let r=n(e),i=r(e);return{c(){t=M("div"),i.c(),z(t,"class",e[2])},m(n,r){x(n,t,r),i.m(t,null),e[21](t)},p(e,[o]){r===(r=n(e))&&i?i.p(e,o):(i.d(1),i=r(e),i&&(i.c(),i.m(t,null))),4&o&&z(t,"class",e[2])},i:_,o:_,d(n){n&&k(t),i.d(),e[21](null)}}}const ud=e=>e+"_"+Math.floor(1e9*Math.random())+String(Date.now());let fd=(()=>{let e={listeners:[],scriptId:ud("tiny-script"),scriptLoaded:!1,injected:!1};return{load:(t,n,r)=>{e.scriptLoaded?r():(e.listeners.push(r),e.injected||((t,n,r,i)=>{e.injected=!0;const o=n.createElement("script");o.referrerPolicy="origin",o.type="application/javascript",o.src=r,o.onload=()=>{i()},n.head&&n.head.appendChild(o)})(e.scriptId,t,n,()=>{e.listeners.forEach(e=>e()),e.scriptLoaded=!0}))}}})();function hd(e,t,n){let r,i,o,{id:s=ud("tinymce-svelte")}=t,{inline:a}=t,{disabled:l=!1}=t,{readonly:c=!1}=t,{apiKey:d="no-api-key"}=t,{licenseKey:u}=t,{channel:f="8"}=t,{scriptSrc:h}=t,{conf:m={}}=t,{modelEvents:p="change input undo redo"}=t,{value:g=""}=t,{text:w=""}=t,{cssClass:y="tinymce-wrapper"}=t,v=g,$=l,I=c;const _=(e,t)=>{var n;"function"==typeof(null===(n=e.mode)||void 0===n?void 0:n.set)&&e.mode.set(t?"readonly":"design")},C=(e,t)=>{(e=>"function"==typeof e.options.set&&e.options.isRegistered("disabled"))(e)?e.options.set("disabled",t):e.mode.set(t?"readonly":"design")},E=ee(),A=()=>{const e="undefined"!=typeof window?window:global;return e&&e.tinymce?e.tinymce:null},b=()=>{var e;const t=Object.assign(Object.assign({},m),{target:i,inline:void 0!==a?a:void 0!==m.inline&&m.inline,license_key:u,setup:e=>{e.on("PreInit",()=>{C(e,l),_(e,c)}),n(15,o=e),e.on("init",()=>{e.setContent(g),e.on(p,()=>{n(16,v=e.getContent()),v!==g&&(n(5,g=v),n(6,w=e.getContent({format:"text"})))})}),((e,t)=>{ad.forEach(n=>{e.on(n,r=>{t(n.toLowerCase(),{eventName:n,event:r,editor:e})})})})(e,E),"function"==typeof m.setup&&m.setup(e)}});n(4,i.style.visibility="",i),null===(e=A())||void 0===e||e.init(t)};return Q(()=>{if(null!==A())b();else{const e=h||`https://cdn.tiny.cloud/1/${d}/tinymce/${f}/tinymce.min.js`;fd.load(r.ownerDocument,e,()=>{b()})}}),J(()=>{var e;o&&(null===(e=A())||void 0===e||e.remove(o))}),e.$$set=e=>{"id"in e&&n(0,s=e.id),"inline"in e&&n(1,a=e.inline),"disabled"in e&&n(7,l=e.disabled),"readonly"in e&&n(8,c=e.readonly),"apiKey"in e&&n(9,d=e.apiKey),"licenseKey"in e&&n(10,u=e.licenseKey),"channel"in e&&n(11,f=e.channel),"scriptSrc"in e&&n(12,h=e.scriptSrc),"conf"in e&&n(13,m=e.conf),"modelEvents"in e&&n(14,p=e.modelEvents),"value"in e&&n(5,g=e.value),"text"in e&&n(6,w=e.text),"cssClass"in e&&n(2,y=e.cssClass)},e.$$.update=()=>{491936&e.$$.dirty&&(o&&v!==g&&(o.setContent(g),n(6,w=o.getContent({format:"text"}))),o&&c!==I&&(n(18,I=c),_(o,c)),o&&l!==$&&(n(17,$=l),C(o,l)))},[s,a,y,r,i,g,w,l,c,d,u,f,h,m,p,o,v,$,I,function(e){re[e?"unshift":"push"](()=>{i=e,n(4,i)})},function(e){re[e?"unshift":"push"](()=>{i=e,n(4,i)})},function(e){re[e?"unshift":"push"](()=>{r=e,n(3,r)})}]}class md extends xe{constructor(e){super(),De(this,e,hd,dd,S,{id:0,inline:1,disabled:7,readonly:8,apiKey:9,licenseKey:10,channel:11,scriptSrc:12,conf:13,modelEvents:14,value:5,text:6,cssClass:2})}}function pd(e){let t,n,r,i,o,s,a;function l(t){e[11](t)}let c={scriptSrc:"/tinymce/tinymce.min.js",licenseKey:"gpl",conf:e[7],disabled:e[4],readonly:e[5]};return void 0!==e[0]&&(c.value=e[0]),n=new md({props:c}),re.push(()=>Se(n,"value",l)),n.$on("init",e[8]),{c(){t=M("div"),Ne(n.$$.fragment),i=L(),o=M("input"),z(o,"class",s=e[1]||e[2]),z(o,"id",e[3]),z(o,"name",e[3]),o.value=e[0],o.hidden=!0,q(t,"min-height","10em"),q(t,"margin-top","-1em")},m(e,r){x(e,t,r),Te(n,t,null),D(t,i),D(t,o),a=!0},p(e,[t]){const i={};16&t&&(i.disabled=e[4]),32&t&&(i.readonly=e[5]),!r&&1&t&&(r=!0,i.value=e[0],ue(()=>r=!1)),n.$set(i),(!a||6&t&&s!==(s=e[1]||e[2]))&&z(o,"class",s),(!a||8&t)&&z(o,"id",e[3]),(!a||8&t)&&z(o,"name",e[3]),(!a||1&t&&o.value!==e[0])&&(o.value=e[0])},i(e){a||($e(n.$$.fragment,e),a=!0)},o(e){Ie(n.$$.fragment,e),a=!1},d(e){e&&k(t),Re(n)}}}let gd=!1;function wd(e,t,r){let i;const{environment:o}=u;N(e,o,e=>r(15,i=e));const s=ee();let a=JSON.parse(n.getItem("Locale")).id;a=a.startsWith("fr")?"fr_FR":a.split("-")[0];let l,c,{value:d=""}=t,{noForm:f}=t,{classId:h}=t,{id:m}=t,{record:p}=t,{disabled:g}=t,{readonly:w}=t,{keepOrigin:y}=t;const v=(e,t,n)=>{const r=e.split("{{").slice(1).map(e=>e.split("}}")[0]);if(r?.length)return r.reduce((e,r)=>{let[i,o,s]=r.split(".");if(!o)return e;if(!t[i]&&!n[i])return e;s&&(o=o+"."+s);const a=e.find(e=>e.table===i);return a?a.attrs=a.attrs.concat(o):e.push({table:i,attrs:[o]}),e},[])},I={plugins:"advlist link image lists table preview emoticons fullscreen",menu:{file:{title:"File",items:"preview"}},menubar:"edit view insert format table",toolbar:"undo redo | styles | bold italic | alignleft aligncenter alignright alignjustify | outdent indent | bullist numlist | fullscreen",height:600,language:a};return e.$$set=e=>{"value"in e&&r(0,d=e.value),"noForm"in e&&r(1,f=e.noForm),"classId"in e&&r(2,h=e.classId),"id"in e&&r(3,m=e.id),"record"in e&&r(9,p=e.record),"disabled"in e&&r(4,g=e.disabled),"readonly"in e&&r(5,w=e.readonly),"keepOrigin"in e&&r(10,y=e.keepOrigin)},e.$$.update=()=>{513&e.$$.dirty&&((e,t)=>{if(y)return;if(!l)return;if(gd)return;if(!e)return;if(!e.includes("{{"))return;const n=v(d,p,c);n?.length&&(gd=!0,Promise.all(n.map(async(e,n)=>{let r;return t[e.table]&&(r=await xp(e.table,t[e.table]).catch(()=>{})),{table:r,def:e}})).then(t=>{if(t?.length){for(const n of t)for(const t of n.def.attrs){let r=$(n.table||c[n.def.table],t);if(r?.endsWith("Z")&&24===r?.length){let[e,t,n]=r.split("-");n=n.slice(0,2),r=`${n}.${t}.${e}`}e=e.replace(`{{${n.def.table}.${t}}}`,r)}s("blur",{value:e||""})}}).catch(e=>{console.log("error",e)}).finally(()=>{r(0,d=e||""),gd=!1}))})(d,p)},[d,f,h,m,g,w,o,I,e=>{c={owner:i.owner},l=!0},p,y,function(e){d=e,r(0,d)}]}class yd extends xe{constructor(e){var t;super(),document.getElementById("svelte-yi7lpi-style")||((t=M("style")).id="svelte-yi7lpi-style",t.textContent="div.tox-statusbar__text-container, div.tox-promotion{display:none !important}div.tox.tox-tinymce{border:1px #808080 solid}.tox-edit-area__iframe{background-color:#f9f3f6 !important}",D(document.head,t)),De(this,e,wd,pd,S,{value:0,noForm:1,classId:2,id:3,record:9,disabled:4,readonly:5,keepOrigin:10})}}
2
2
  /*!
3
3
  * Signature Pad v5.1.3 | https://github.com/szimek/signature_pad
4
4
  * (c) 2025 Szymon Nowak | Released under the MIT license
5
- */var vd=class{x;y;pressure;time;constructor(e,t,n,r){if(isNaN(e)||isNaN(t))throw new Error(`Point is invalid: (${e}, ${t})`);this.x=+e,this.y=+t,this.pressure=n||0,this.time=r||Date.now()}distanceTo(e){return Math.sqrt(Math.pow(this.x-e.x,2)+Math.pow(this.y-e.y,2))}equals(e){return this.x===e.x&&this.y===e.y&&this.pressure===e.pressure&&this.time===e.time}velocityFrom(e){return this.time!==e.time?this.distanceTo(e)/(this.time-e.time):0}},$d=class e{constructor(e,t,n,r,i,o){this.startPoint=e,this.control2=t,this.control1=n,this.endPoint=r,this.startWidth=i,this.endWidth=o}static fromPoints(t,n){const r=this.calculateControlPoints(t[0],t[1],t[2]).c2,i=this.calculateControlPoints(t[1],t[2],t[3]).c1;return new e(t[1],r,i,t[2],n.start,n.end)}static calculateControlPoints(e,t,n){const r=e.x-t.x,i=e.y-t.y,o=t.x-n.x,s=t.y-n.y,a=(e.x+t.x)/2,l=(e.y+t.y)/2,c=(t.x+n.x)/2,d=(t.y+n.y)/2,u=Math.sqrt(r*r+i*i),f=Math.sqrt(o*o+s*s),h=u+f==0?0:f/(u+f),m=c+(a-c)*h,p=d+(l-d)*h,g=t.x-m,w=t.y-p;return{c1:new vd(a+g,l+w),c2:new vd(c+g,d+w)}}length(){let e,t,n=0;for(let r=0;r<=10;r+=1){const i=r/10,o=this.point(i,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),s=this.point(i,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(r>0){const r=o-e,i=s-t;n+=Math.sqrt(r*r+i*i)}e=o,t=s}return n}point(e,t,n,r,i){return t*(1-e)*(1-e)*(1-e)+3*n*(1-e)*(1-e)*e+3*r*(1-e)*e*e+i*e*e*e}},Id=class{_et;constructor(){try{this._et=new EventTarget}catch{this._et=document}}addEventListener(e,t,n){this._et.addEventListener(e,t,n)}dispatchEvent(e){return this._et.dispatchEvent(e)}removeEventListener(e,t,n){this._et.removeEventListener(e,t,n)}};var _d=class e extends Id{constructor(t,n={}){super(),this.canvas=t,this.velocityFilterWeight=n.velocityFilterWeight||.7,this.minWidth=n.minWidth||.5,this.maxWidth=n.maxWidth||2.5,this.throttle=n.throttle??16,this.minDistance=n.minDistance??5,this.dotSize=n.dotSize||0,this.penColor=n.penColor||"black",this.backgroundColor=n.backgroundColor||"rgba(0,0,0,0)",this.compositeOperation=n.compositeOperation||"source-over",this.canvasContextOptions=n.canvasContextOptions??{},this._strokeMoveUpdate=this.throttle?function(e,t=250){let n,r,i,o=0,s=null;const a=()=>{o=Date.now(),s=null,n=e.apply(r,i),s||(r=null,i=[])};return function(...l){const c=Date.now(),d=t-(c-o);return r=this,i=l,d<=0||d>t?(s&&(clearTimeout(s),s=null),o=c,n=e.apply(r,i),s||(r=null,i=[])):s||(s=window.setTimeout(a,d)),n}}(e.prototype._strokeUpdate,this.throttle):e.prototype._strokeUpdate,this._handleMouseDown=this._handleMouseDown.bind(this),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this._handleTouchStart=this._handleTouchStart.bind(this),this._handleTouchMove=this._handleTouchMove.bind(this),this._handleTouchEnd=this._handleTouchEnd.bind(this),this._handlePointerDown=this._handlePointerDown.bind(this),this._handlePointerMove=this._handlePointerMove.bind(this),this._handlePointerUp=this._handlePointerUp.bind(this),this._handlePointerCancel=this._handlePointerCancel.bind(this),this._handleTouchCancel=this._handleTouchCancel.bind(this),this._ctx=t.getContext("2d",this.canvasContextOptions),this.clear(),this.on()}dotSize;minWidth;maxWidth;penColor;minDistance;velocityFilterWeight;compositeOperation;backgroundColor;throttle;canvasContextOptions;_ctx;_drawingStroke=!1;_isEmpty=!0;_dataUrl;_dataUrlOptions;_lastPoints=[];_data=[];_lastVelocity=0;_lastWidth=0;_strokeMoveUpdate;_strokePointerId;clear(){const{_ctx:e,canvas:t}=this;e.fillStyle=this.backgroundColor,e.clearRect(0,0,t.width,t.height),e.fillRect(0,0,t.width,t.height),this._data=[],this._reset(this._getPointGroupOptions()),this._isEmpty=!0,this._dataUrl=void 0,this._dataUrlOptions=void 0,this._strokePointerId=void 0}redraw(){const e=this._data,t=this._dataUrl,n=this._dataUrlOptions;this.clear(),t&&this.fromDataURL(t,n),this.fromData(e,{clear:!1})}fromDataURL(e,t={}){return new Promise((n,r)=>{const i=new Image,o=t.ratio||window.devicePixelRatio||1,s=t.width||this.canvas.width/o,a=t.height||this.canvas.height/o,l=t.xOffset||0,c=t.yOffset||0;this._reset(this._getPointGroupOptions()),i.onload=()=>{this._ctx.drawImage(i,l,c,s,a),n()},i.onerror=e=>{r(e)},i.crossOrigin="anonymous",i.src=e,this._isEmpty=!1,this._dataUrl=e,this._dataUrlOptions={...t}})}toDataURL(e="image/png",t){return"image/svg+xml"===e?("object"!=typeof t&&(t=void 0),`data:image/svg+xml;base64,${btoa(this.toSVG(t))}`):("number"!=typeof t&&(t=void 0),this.canvas.toDataURL(e,t))}on(){this.canvas.style.touchAction="none",this.canvas.style.msTouchAction="none",this.canvas.style.userSelect="none",this.canvas.style.webkitUserSelect="none";const e=/Macintosh/.test(navigator.userAgent)&&"ontouchstart"in document;window.PointerEvent&&!e?this._handlePointerEvents():(this._handleMouseEvents(),"ontouchstart"in window&&this._handleTouchEvents())}off(){this.canvas.style.touchAction="auto",this.canvas.style.msTouchAction="auto",this.canvas.style.userSelect="auto",this.canvas.style.webkitUserSelect="auto",this.canvas.removeEventListener("pointerdown",this._handlePointerDown),this.canvas.removeEventListener("mousedown",this._handleMouseDown),this.canvas.removeEventListener("touchstart",this._handleTouchStart),this._removeMoveUpEventListeners()}_getListenerFunctions(){const e=window.document===this.canvas.ownerDocument?window:this.canvas.ownerDocument.defaultView??this.canvas.ownerDocument;return{addEventListener:e.addEventListener.bind(e),removeEventListener:e.removeEventListener.bind(e)}}_removeMoveUpEventListeners(){const{removeEventListener:e}=this._getListenerFunctions();e("pointermove",this._handlePointerMove),e("pointerup",this._handlePointerUp),e("pointercancel",this._handlePointerCancel),e("mousemove",this._handleMouseMove),e("mouseup",this._handleMouseUp),e("touchmove",this._handleTouchMove),e("touchend",this._handleTouchEnd),e("touchcancel",this._handleTouchCancel)}isEmpty(){return this._isEmpty}fromData(e,{clear:t=!0}={}){t&&this.clear(),this._fromData(e,this._drawCurve.bind(this),this._drawDot.bind(this)),this._data=this._data.concat(e)}toData(){return this._data}_isLeftButtonPressed(e,t){return t?1===e.buttons:!(1&~e.buttons)}_pointerEventToSignatureEvent(e){return{event:e,type:e.type,x:e.clientX,y:e.clientY,pressure:"pressure"in e?e.pressure:0}}_touchEventToSignatureEvent(e){const t=e.changedTouches[0];return{event:e,type:e.type,x:t.clientX,y:t.clientY,pressure:t.force}}_handleMouseDown(e){this._isLeftButtonPressed(e,!0)&&!this._drawingStroke&&this._strokeBegin(this._pointerEventToSignatureEvent(e))}_handleMouseMove(e){this._isLeftButtonPressed(e,!0)&&this._drawingStroke?this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e)):this._strokeEnd(this._pointerEventToSignatureEvent(e),!1)}_handleMouseUp(e){this._isLeftButtonPressed(e)||this._strokeEnd(this._pointerEventToSignatureEvent(e))}_handleTouchStart(e){1!==e.targetTouches.length||this._drawingStroke||(e.cancelable&&e.preventDefault(),this._strokeBegin(this._touchEventToSignatureEvent(e)))}_handleTouchMove(e){1===e.targetTouches.length&&(e.cancelable&&e.preventDefault(),this._drawingStroke?this._strokeMoveUpdate(this._touchEventToSignatureEvent(e)):this._strokeEnd(this._touchEventToSignatureEvent(e),!1))}_handleTouchEnd(e){0===e.targetTouches.length&&(e.cancelable&&e.preventDefault(),this._strokeEnd(this._touchEventToSignatureEvent(e)))}_handlePointerCancel(e){this._allowPointerId(e)&&(e.preventDefault(),this._strokeEnd(this._pointerEventToSignatureEvent(e),!1))}_handleTouchCancel(e){e.cancelable&&e.preventDefault(),this._strokeEnd(this._touchEventToSignatureEvent(e),!1)}_getPointerId(e){return e.persistentDeviceId||e.pointerId}_allowPointerId(e,t=!1){return void 0===this._strokePointerId?t:this._getPointerId(e)===this._strokePointerId}_handlePointerDown(e){!this._drawingStroke&&this._isLeftButtonPressed(e)&&this._allowPointerId(e,!0)&&(this._strokePointerId=this._getPointerId(e),e.preventDefault(),this._strokeBegin(this._pointerEventToSignatureEvent(e)))}_handlePointerMove(e){this._allowPointerId(e)&&(this._isLeftButtonPressed(e,!0)&&this._drawingStroke?(e.preventDefault(),this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e))):this._strokeEnd(this._pointerEventToSignatureEvent(e),!1))}_handlePointerUp(e){!this._isLeftButtonPressed(e)&&this._allowPointerId(e)&&(e.preventDefault(),this._strokeEnd(this._pointerEventToSignatureEvent(e)))}_getPointGroupOptions(e){return{penColor:e&&"penColor"in e?e.penColor:this.penColor,dotSize:e&&"dotSize"in e?e.dotSize:this.dotSize,minWidth:e&&"minWidth"in e?e.minWidth:this.minWidth,maxWidth:e&&"maxWidth"in e?e.maxWidth:this.maxWidth,velocityFilterWeight:e&&"velocityFilterWeight"in e?e.velocityFilterWeight:this.velocityFilterWeight,compositeOperation:e&&"compositeOperation"in e?e.compositeOperation:this.compositeOperation}}_strokeBegin(e){if(!this.dispatchEvent(new CustomEvent("beginStroke",{detail:e,cancelable:!0})))return;const{addEventListener:t}=this._getListenerFunctions();switch(e.event.type){case"mousedown":t("mousemove",this._handleMouseMove,{passive:!1}),t("mouseup",this._handleMouseUp,{passive:!1});break;case"touchstart":t("touchmove",this._handleTouchMove,{passive:!1}),t("touchend",this._handleTouchEnd,{passive:!1}),t("touchcancel",this._handleTouchCancel,{passive:!1});break;case"pointerdown":t("pointermove",this._handlePointerMove,{passive:!1}),t("pointerup",this._handlePointerUp,{passive:!1}),t("pointercancel",this._handlePointerCancel,{passive:!1})}this._drawingStroke=!0;const n=this._getPointGroupOptions(),r={...n,points:[]};this._data.push(r),this._reset(n),this._strokeUpdate(e)}_strokeUpdate(e){if(!this._drawingStroke)return;if(0===this._data.length)return void this._strokeBegin(e);this.dispatchEvent(new CustomEvent("beforeUpdateStroke",{detail:e}));const t=this._createPoint(e.x,e.y,e.pressure),n=this._data[this._data.length-1],r=n.points,i=r.length>0&&r[r.length-1],o=!!i&&t.distanceTo(i)<=this.minDistance,s=this._getPointGroupOptions(n);if(!i||!i||!o){const e=this._addPoint(t,s);i?e&&this._drawCurve(e,s):this._drawDot(t,s),r.push({time:t.time,x:t.x,y:t.y,pressure:t.pressure})}this.dispatchEvent(new CustomEvent("afterUpdateStroke",{detail:e}))}_strokeEnd(e,t=!0){this._removeMoveUpEventListeners(),this._drawingStroke&&(t&&this._strokeUpdate(e),this._drawingStroke=!1,this._strokePointerId=void 0,this.dispatchEvent(new CustomEvent("endStroke",{detail:e})))}_handlePointerEvents(){this._drawingStroke=!1,this.canvas.addEventListener("pointerdown",this._handlePointerDown,{passive:!1})}_handleMouseEvents(){this._drawingStroke=!1,this.canvas.addEventListener("mousedown",this._handleMouseDown,{passive:!1})}_handleTouchEvents(){this.canvas.addEventListener("touchstart",this._handleTouchStart,{passive:!1})}_reset(e){this._lastPoints=[],this._lastVelocity=0,this._lastWidth=(e.minWidth+e.maxWidth)/2,this._ctx.fillStyle=e.penColor,this._ctx.globalCompositeOperation=e.compositeOperation}_createPoint(e,t,n){const r=this.canvas.getBoundingClientRect();return new vd(e-r.left,t-r.top,n,(new Date).getTime())}_addPoint(e,t){const{_lastPoints:n}=this;if(n.push(e),n.length>2){3===n.length&&n.unshift(n[0]);const e=this._calculateCurveWidths(n[1],n[2],t),r=$d.fromPoints(n,e);return n.shift(),r}return null}_calculateCurveWidths(e,t,n){const r=n.velocityFilterWeight*t.velocityFrom(e)+(1-n.velocityFilterWeight)*this._lastVelocity,i=this._strokeWidth(r,n),o={end:i,start:this._lastWidth};return this._lastVelocity=r,this._lastWidth=i,o}_strokeWidth(e,t){return Math.max(t.maxWidth/(e+1),t.minWidth)}_drawCurveSegment(e,t,n){const r=this._ctx;r.moveTo(e,t),r.arc(e,t,n,0,2*Math.PI,!1),this._isEmpty=!1}_drawCurve(e,t){const n=this._ctx,r=e.endWidth-e.startWidth,i=2*Math.ceil(e.length());n.beginPath(),n.fillStyle=t.penColor;for(let n=0;n<i;n+=1){const o=n/i,s=o*o,a=s*o,l=1-o,c=l*l,d=c*l;let u=d*e.startPoint.x;u+=3*c*o*e.control1.x,u+=3*l*s*e.control2.x,u+=a*e.endPoint.x;let f=d*e.startPoint.y;f+=3*c*o*e.control1.y,f+=3*l*s*e.control2.y,f+=a*e.endPoint.y;const h=Math.min(e.startWidth+a*r,t.maxWidth);this._drawCurveSegment(u,f,h)}n.closePath(),n.fill()}_drawDot(e,t){const n=this._ctx,r=t.dotSize>0?t.dotSize:(t.minWidth+t.maxWidth)/2;n.beginPath(),this._drawCurveSegment(e.x,e.y,r),n.closePath(),n.fillStyle=t.penColor,n.fill()}_fromData(e,t,n){for(const r of e){const{points:e}=r,i=this._getPointGroupOptions(r);if(e.length>1)for(let n=0;n<e.length;n+=1){const r=e[n],o=new vd(r.x,r.y,r.pressure,r.time);0===n&&this._reset(i);const s=this._addPoint(o,i);s&&t(s,i)}else this._reset(i),n(e[0],i)}}toSVG({includeBackgroundColor:e=!1,includeDataUrl:t=!1}={}){const n=this._data,r=Math.max(window.devicePixelRatio||1,1),i=this.canvas.width/r,o=this.canvas.height/r,s=document.createElementNS("http://www.w3.org/2000/svg","svg");if(s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),s.setAttribute("viewBox",`0 0 ${i} ${o}`),s.setAttribute("width",i.toString()),s.setAttribute("height",o.toString()),e&&this.backgroundColor){const e=document.createElement("rect");e.setAttribute("width","100%"),e.setAttribute("height","100%"),e.setAttribute("fill",this.backgroundColor),s.appendChild(e)}if(t&&this._dataUrl){const e=this._dataUrlOptions?.ratio||window.devicePixelRatio||1,t=this._dataUrlOptions?.width||this.canvas.width/e,n=this._dataUrlOptions?.height||this.canvas.height/e,r=this._dataUrlOptions?.xOffset||0,i=this._dataUrlOptions?.yOffset||0,o=document.createElement("image");o.setAttribute("x",r.toString()),o.setAttribute("y",i.toString()),o.setAttribute("width",t.toString()),o.setAttribute("height",n.toString()),o.setAttribute("preserveAspectRatio","none"),o.setAttribute("href",this._dataUrl),s.appendChild(o)}return this._fromData(n,(e,{penColor:t})=>{const n=document.createElement("path");if(!(isNaN(e.control1.x)||isNaN(e.control1.y)||isNaN(e.control2.x)||isNaN(e.control2.y))){const r=`M ${e.startPoint.x.toFixed(3)},${e.startPoint.y.toFixed(3)} C ${e.control1.x.toFixed(3)},${e.control1.y.toFixed(3)} ${e.control2.x.toFixed(3)},${e.control2.y.toFixed(3)} ${e.endPoint.x.toFixed(3)},${e.endPoint.y.toFixed(3)}`;n.setAttribute("d",r),n.setAttribute("stroke-width",(2.25*e.endWidth).toFixed(3)),n.setAttribute("stroke",t),n.setAttribute("fill","none"),n.setAttribute("stroke-linecap","round"),s.appendChild(n)}},(e,{penColor:t,dotSize:n,minWidth:r,maxWidth:i})=>{const o=document.createElement("circle"),a=n>0?n:(r+i)/2;o.setAttribute("r",a.toString()),o.setAttribute("cx",e.x.toString()),o.setAttribute("cy",e.y.toString()),o.setAttribute("fill",t),s.appendChild(o)}),s.outerHTML}};const{document:Cd}=Ee;function Ed(e){let t,n,r,i,o;return n=new ot({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather2 pointer svelte-efkzkz")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[5]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function Ad(e){let t,n,r,i,o,s,a=!e[0]&&Ed(e);return{c(){t=M("div"),n=M("canvas"),i=L(),a&&a.c(),z(n,"id",e[1]),z(n,"name",e[1]),z(n,"class",r=e[2]+" signature_pad "+e[3]+(e[0]||e[4]?" signature-readonly":"")+" svelte-efkzkz"),z(t,"class",o=e[2]+"_wrapper wrapper svelte-efkzkz"),z(t,"id","signature_wrapper")},m(e,r){x(e,t,r),D(t,n),D(t,i),a&&a.m(t,null),s=!0},p(e,[i]){(!s||2&i)&&z(n,"id",e[1]),(!s||2&i)&&z(n,"name",e[1]),(!s||29&i&&r!==(r=e[2]+" signature_pad "+e[3]+(e[0]||e[4]?" signature-readonly":"")+" svelte-efkzkz"))&&z(n,"class",r),e[0]?a&&(ye(),Ie(a,1,1,()=>{a=null}),ve()):a?(a.p(e,i),1&i&&$e(a,1)):(a=Ed(e),a.c(),$e(a,1),a.m(t,null)),(!s||4&i&&o!==(o=e[2]+"_wrapper wrapper svelte-efkzkz"))&&z(t,"class",o)},i(e){s||($e(a),s=!0)},o(e){Ie(a),s=!1},d(e){e&&k(t),a&&a.d()}}}const bd=new Map;let Sd="";function Nd(e,t,n){const r=ee();let i,{id:o}=t,{name:s}=t,{value:a}=t,{record:l}=t,{classId:c}=t,{disabled:d}=t,{readonly:u}=t;const f=l._id||Math.floor(9e3*Math.random()+1e3).toString();u||=d;const h=e=>{Sd=e,bd.set(f,Sd),r("blur",{value:Sd})};return Q(()=>{Sd=a||bd.get(f)||"",bd.set(f,Sd);const e=document.querySelector("canvas");n(8,i=new _d(e)),u||(i.addEventListener("endStroke",()=>{h(i.toDataURL("image/png"))}),i.addEventListener("afterUpdateStroke",()=>{h(i.toDataURL("image/png"))}))}),J(()=>bd.forEach((e,t,n)=>{t!==f&&n.delete(t)})),e.$$set=e=>{"id"in e&&n(1,o=e.id),"name"in e&&n(2,s=e.name),"value"in e&&n(6,a=e.value),"record"in e&&n(7,l=e.record),"classId"in e&&n(3,c=e.classId),"disabled"in e&&n(4,d=e.disabled),"readonly"in e&&n(0,u=e.readonly)},e.$$.update=()=>{256&e.$$.dirty&&Sd&&i&&i.fromDataURL(Sd,{ratio:1})},[u,o,s,c,d,()=>{i.clear(),h("")},a,l,i]}class Td extends xe{constructor(e){var t;super(),Cd.getElementById("svelte-efkzkz-style")||((t=M("style")).id="svelte-efkzkz-style",t.textContent=".feather2.svelte-efkzkz{position:absolute;top:0.25em;right:0.25em;color:#4300b0}.wrapper.svelte-efkzkz{position:relative;width:100%;height:200px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none;border:1px solid #36697d}canvas.svelte-efkzkz{width:100%;height:100%;display:block;background-color:lightyellow}.signature-readonly.svelte-efkzkz{cursor:not-allowed;pointer-events:none}",D(Cd.head,t)),De(this,e,Nd,Ad,S,{id:1,name:2,value:6,record:7,classId:3,disabled:4,readonly:0})}}function Rd(e,t,n){const r=e.slice();return r[36]=t[n],r[38]=n,r}function Dd(e){let t,n,r;return n=new He({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather2 svelte-bcd9jd"),z(t,"title",e[21])},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function xd(e){let t,n,r,i,o;return n=new He({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather pointer svelte-bcd9jd"),z(t,"title",e[21])},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[22]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function kd(e){let t,n,r;function i(t){e[28](t)}let o={class:"tModal",noClickaway:!0,$$slots:{default:[Fd]},$$scope:{ctx:e}};return void 0!==e[8]&&(o.open=e[8]),t=new e[12]({props:o}),re.push(()=>Se(t,"open",i)),{c(){Ne(t.$$.fragment)},m(e,n){Te(t,e,n),r=!0},p(e,r){const i={};1536&r[0]|256&r[1]&&(i.$$scope={dirty:r,ctx:e}),!n&&256&r[0]&&(n=!0,i.open=e[8],ue(()=>n=!1)),t.$set(i)},i(e){r||($e(t.$$.fragment,e),r=!0)},o(e){Ie(t.$$.fragment,e),r=!1},d(e){Re(t,e)}}}function Od(e){let t;return{c(){t=B("Abbrechen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Md(e){let t,n,r,i=(e[10]||"Keine Einträge gefunden!")+"";return{c(){t=M("tr"),n=M("td"),r=B(i),z(n,"class","svelte-bcd9jd"),z(t,"class","svelte-bcd9jd")},m(e,i){x(e,t,i),D(t,n),D(n,r)},p(e,t){1024&t[0]&&i!==(i=(e[10]||"Keine Einträge gefunden!")+"")&&H(r,i)},d(e){e&&k(t)}}}function Pd(e){let t,n=e[9],r=[];for(let t=0;t<n.length;t+=1)r[t]=Bd(Rd(e,n,t));return{c(){for(let e=0;e<r.length;e+=1)r[e].c();t=F()},m(e,n){for(let t=0;t<r.length;t+=1)r[t].m(e,n);x(e,t,n)},p(e,i){if(25166336&i[0]){let o;for(n=e[9],o=0;o<n.length;o+=1){const s=Rd(e,n,o);r[o]?r[o].p(s,i):(r[o]=Bd(s),r[o].c(),r[o].m(t.parentNode,t))}for(;o<r.length;o+=1)r[o].d(1);r.length=n.length}},d(e){O(r,e),e&&k(t)}}}function Bd(e){let t,n,r,i,o,s,a=e[23](e[36])+"";return{c(){t=M("tr"),n=M("td"),r=B(a),i=L(),z(n,"class","svelte-bcd9jd"),z(t,"class","pointer svelte-bcd9jd")},m(a,l){x(a,t,l),D(t,n),D(n,r),D(t,i),o||(s=V(t,"click",W(e[24](e[38]))),o=!0)},p(t,n){e=t,512&n[0]&&a!==(a=e[23](e[36])+"")&&H(r,a)},d(e){e&&k(t),o=!1,s()}}}function Ld(e){let t,n,r,i,o,s,a,l,c,d,u,f,h;function m(e,t){return e[9]?.length?Pd:Md}n=new e[14]({props:{outline:!0,$$slots:{default:[Od]},$$scope:{ctx:e}}}),n.$on("click",e[25]),i=new e[15]({});let p=m(e),g=p(e);return{c(){t=M("div"),Ne(n.$$.fragment),r=L(),Ne(i.$$.fragment),o=L(),s=M("div"),a=M("table"),l=M("thead"),c=M("tr"),d=M("th"),d.textContent=`${e[20]}`,u=L(),f=M("tbody"),g.c(),z(d,"class","svelte-bcd9jd"),z(c,"class","svelte-bcd9jd"),z(l,"class","svelte-bcd9jd"),z(a,"striped",""),z(a,"class","svelte-bcd9jd"),z(s,"class","eList svelte-bcd9jd")},m(e,m){x(e,t,m),Te(n,t,null),x(e,r,m),Te(i,e,m),x(e,o,m),x(e,s,m),D(s,a),D(a,l),D(l,c),D(c,d),D(a,u),D(a,f),g.m(f,null),h=!0},p(e,t){const r={};256&t[1]&&(r.$$scope={dirty:t,ctx:e}),n.$set(r),p===(p=m(e))&&g?g.p(e,t):(g.d(1),g=p(e),g&&(g.c(),g.m(f,null)))},i(e){h||($e(n.$$.fragment,e),$e(i.$$.fragment,e),h=!0)},o(e){Ie(n.$$.fragment,e),Ie(i.$$.fragment,e),h=!1},d(e){e&&k(t),Re(n),e&&k(r),Re(i,e),e&&k(o),e&&k(s),g.d()}}}function Fd(e){let t,n;return t=new e[13]({props:{title:e[21],class:"eList",$$slots:{default:[Ld]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};1536&n[0]|256&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Vd(e){let t,n,r,i,o,s,a,l,c;function d(t){e[26](t)}let u={id:e[2],name:e[3].name,inputClass:e[5]||e[1],disabled:e[6],formnovalidate:e[7],readonly:e[18],pattern:e[17],required:e[19],style:"padding-left:2em;"};void 0!==e[0]&&(u.value=e[0]),n=new e[11]({props:u}),re.push(()=>Se(n,"value",d)),n.$on("change",e[27]);const f=[xd,Dd],h=[];function m(e,t){return e[6]||e[4]._id?1:0}o=m(e),s=h[o]=f[o](e);let p=e[8]&&kd(e);return{c(){t=M("div"),Ne(n.$$.fragment),i=L(),s.c(),a=L(),p&&p.c(),l=F(),q(t,"position","relative")},m(e,r){x(e,t,r),Te(n,t,null),D(t,i),h[o].m(t,null),x(e,a,r),p&&p.m(e,r),x(e,l,r),c=!0},p(e,i){const a={};4&i[0]&&(a.id=e[2]),8&i[0]&&(a.name=e[3].name),34&i[0]&&(a.inputClass=e[5]||e[1]),64&i[0]&&(a.disabled=e[6]),128&i[0]&&(a.formnovalidate=e[7]),!r&&1&i[0]&&(r=!0,a.value=e[0],ue(()=>r=!1)),n.$set(a);let c=o;o=m(e),o===c?h[o].p(e,i):(ye(),Ie(h[c],1,1,()=>{h[c]=null}),ve(),s=h[o],s?s.p(e,i):(s=h[o]=f[o](e),s.c()),$e(s,1),s.m(t,null)),e[8]?p?(p.p(e,i),256&i[0]&&$e(p,1)):(p=kd(e),p.c(),$e(p,1),p.m(l.parentNode,l)):p&&(ye(),Ie(p,1,1,()=>{p=null}),ve())},i(e){c||($e(n.$$.fragment,e),$e(s),$e(p),c=!0)},o(e){Ie(n.$$.fragment,e),Ie(s),Ie(p),c=!1},d(e){e&&k(t),Re(n),h[o].d(),e&&k(a),p&&p.d(e),e&&k(l)}}}function Ud(e,n,r){let i;const{TextField:o,Modal:s,Dialog:a,Button:l,Divider:d}=c,f=ee(),{environment:h}=u;N(e,h,e=>r(29,i=e));let{classId:m}=n,{id:p}=n,{item:g}=n,{record:w={}}=n,{value:y}=n,{noForm:v=!1}=n,{disabled:$}=n,{formnovalidate:I}=n;const{properties:_={}}=g;let{pattern:C,placeholder:E,readonly:A,required:b=!1,format:S}=_,T=!1;const{service:{type:R,map:D,title:x,designation:k}}=S;let O,M;const P=()=>{r(8,T=!1)};return e.$$set=e=>{"classId"in e&&r(1,m=e.classId),"id"in e&&r(2,p=e.id),"item"in e&&r(3,g=e.item),"record"in e&&r(4,w=e.record),"value"in e&&r(0,y=e.value),"noForm"in e&&r(5,v=e.noForm),"disabled"in e&&r(6,$=e.disabled),"formnovalidate"in e&&r(7,I=e.formnovalidate)},[y,m,p,g,w,v,$,I,T,O,M,o,s,a,l,d,h,C,A,b,x,k,async()=>{$||w._id||(r(9,O=[]),r(10,M=""),y.length>3&&(r(9,O=await t.getService("address",R,y)),Array.isArray(O)||r(10,M=O.error)),r(8,T=!0))},e=>D.map(({name:t})=>e[t]).filter(e=>!!e).join(", "),e=>()=>{const t=O[e],n=[];let r="";for(const{name:e,refItem:o}of D){const[s,a]=o.split(".");a?(r=s,"owner.country"===e&&(t[e]=i.country?._id||""),n.push({name:a,value:t[e]})):f("record",{itemName:o,value:t[e]})}n.length&&f("objRecord",{listName:r,items:n}),P()},P,function(e){y=e,r(0,y)},function(t){te(e,t)},function(e){T=e,r(8,T)}]}class Wd extends xe{constructor(e){var t;super(),document.getElementById("svelte-bcd9jd-style")||((t=M("style")).id="svelte-bcd9jd-style",t.textContent=".feather.svelte-bcd9jd.svelte-bcd9jd{position:absolute;top:0.75em;left:0.5em;color:#326173}.feather2.svelte-bcd9jd.svelte-bcd9jd{position:absolute;top:0.75em;left:0.5em;color:light-gray}.eList.svelte-bcd9jd.svelte-bcd9jd{height:fit-content;max-height:65vh;overflow-y:scroll;overflow-x:auto}.eList.svelte-bcd9jd table.svelte-bcd9jd{min-width:30vw;position:relative;width:max-content !important;max-width:50vh !important}.eList.svelte-bcd9jd table thead.svelte-bcd9jd{position:sticky;top:0;background:#326173;color:white}.eList.svelte-bcd9jd table thead tr.svelte-bcd9jd{height:2.3em}.eList.svelte-bcd9jd table tbody tr.svelte-bcd9jd{height:2.75em !important}th.svelte-bcd9jd.svelte-bcd9jd,td.svelte-bcd9jd.svelte-bcd9jd{padding-left:0.4em;padding-right:0.4em}",D(document.head,t)),De(this,e,Ud,Vd,S,{classId:1,id:2,item:3,record:4,value:0,noForm:5,disabled:6,formnovalidate:7},[-1,-1])}}function zd(e){let t,n,r;return n=new lt({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather2 svelte-1xgbysl")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function Hd(e){let t,n,r,i,o;return n=new lt({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather pointer svelte-1xgbysl")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[6]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function jd(e){let t,n,r,i,o,s;n=new e[5]({props:{inputClass:e[0],disabled:!0,formnovalidate:e[1],readonly:!0,id:e[2],name:e[3],value:e[4],style:"padding-left: 2em;"}});const a=[Hd,zd],l=[];function c(e,t){return e[4]?0:1}return i=c(e),o=l[i]=a[i](e),{c(){t=M("div"),Ne(n.$$.fragment),r=L(),o.c(),q(t,"position","relative")},m(e,o){x(e,t,o),Te(n,t,null),D(t,r),l[i].m(t,null),s=!0},p(e,[r]){const s={};1&r&&(s.inputClass=e[0]),2&r&&(s.formnovalidate=e[1]),4&r&&(s.id=e[2]),8&r&&(s.name=e[3]),16&r&&(s.value=e[4]),n.$set(s);let d=i;i=c(e),i===d?l[i].p(e,r):(ye(),Ie(l[d],1,1,()=>{l[d]=null}),ve(),o=l[i],o?o.p(e,r):(o=l[i]=a[i](e),o.c()),$e(o,1),o.m(t,null))},i(e){s||($e(n.$$.fragment,e),$e(o),s=!0)},o(e){Ie(n.$$.fragment,e),Ie(o),s=!1},d(e){e&&k(t),Re(n),l[i].d()}}}function qd(e,t,n){const{TextField:r}=c;let{inputClass:i}=t,{disabled:o}=t,{formnovalidate:s}=t,{readonly:a}=t,{required:l}=t,{id:d}=t,{name:u}=t,{value:f}=t,{record:h}=t;const m=h?.task;return e.$$set=e=>{"inputClass"in e&&n(0,i=e.inputClass),"disabled"in e&&n(7,o=e.disabled),"formnovalidate"in e&&n(1,s=e.formnovalidate),"readonly"in e&&n(8,a=e.readonly),"required"in e&&n(9,l=e.required),"id"in e&&n(2,d=e.id),"name"in e&&n(3,u=e.name),"value"in e&&n(4,f=e.value),"record"in e&&n(10,h=e.record)},[i,s,d,u,f,r,async()=>{m&&window.open(m)},o,a,l,h]}class Gd extends xe{constructor(e){var t;super(),document.getElementById("svelte-1xgbysl-style")||((t=M("style")).id="svelte-1xgbysl-style",t.textContent=".feather.svelte-1xgbysl{position:absolute;top:0.75em;left:0.5em;color:#4300b0}.feather2.svelte-1xgbysl{position:absolute;top:0.75em;left:0.5em;color:light-gray}",D(document.head,t)),De(this,e,qd,jd,S,{inputClass:0,disabled:7,formnovalidate:1,readonly:8,required:9,id:2,name:3,value:4,record:10})}}function Xd(e){let t,n;return t=new e[32]({props:{id:e[47](e[41]),class:e[0].name+(e[27]?" hidden ":""),nameClass:e[0].properties?.color?"color_"+e[0].properties.color:"",name:e[0].designation,help:e[0].properties?.hint,$$slots:{default:[Cu,({notifyList:e})=>({25:e}),({notifyList:e})=>[e?33554432:0]]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};134217729&n[0]&&(r.class=e[0].name+(e[27]?" hidden ":"")),1&n[0]&&(r.nameClass=e[0].properties?.color?"color_"+e[0].properties.color:""),1&n[0]&&(r.name=e[0].designation),1&n[0]&&(r.help=e[0].properties?.hint),1744830463&n[0]|1&n[1]|8388608&n[2]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Yd(e){let t,n;return t=new e[35]({props:{text:e[0].designation}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};1&n[0]&&(r.text=e[0].designation),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Zd(e){let t,n,r,i;return t=new e[32]({props:{id:e[47](e[41]),class:e[0].name+(e[27]?" hidden ":""),name:e[0].designation,help:e[0].properties?.hint}}),r=new yd({props:{keepOrigin:e[0].properties.keepOrigin,classId:e[9],disabled:e[3],readonly:e[26],id:e[41],name:e[0].name,value:e[29](),record:e[1],noForm:e[8]}}),r.$on("blur",e[43]()),{c(){Ne(t.$$.fragment),n=L(),Ne(r.$$.fragment)},m(e,o){Te(t,e,o),x(e,n,o),Te(r,e,o),i=!0},p(e,n){const i={};134217729&n[0]&&(i.class=e[0].name+(e[27]?" hidden ":"")),1&n[0]&&(i.name=e[0].designation),1&n[0]&&(i.help=e[0].properties?.hint),t.$set(i);const o={};1&n[0]&&(o.keepOrigin=e[0].properties.keepOrigin),512&n[0]&&(o.classId=e[9]),8&n[0]&&(o.disabled=e[3]),67108864&n[0]&&(o.readonly=e[26]),1&n[0]&&(o.name=e[0].name),536870912&n[0]&&(o.value=e[29]()),2&n[0]&&(o.record=e[1]),256&n[0]&&(o.noForm=e[8]),r.$set(o)},i(e){i||($e(t.$$.fragment,e),$e(r.$$.fragment,e),i=!0)},o(e){Ie(t.$$.fragment,e),Ie(r.$$.fragment,e),i=!1},d(e){Re(t,e),e&&k(n),Re(r,e)}}}function Kd(e){let t,n,r,i,o,s;return t=new e[32]({props:{id:e[47](e[41]),class:e[0].name+" hidden",name:e[0].designation,help:e[0].properties?.hint,$$slots:{default:[Eu]},$$scope:{ctx:e}}}),r=new e[35]({props:{text:e[31]}}),o=new ro({props:{required:e[4],disabled:e[3],readonly:e[26],id:e[41],item:e[0],currency:e[19],value:e[29](),notifyList:!0}}),o.$on("setRefValue",e[48]),o.$on("safeReference",e[53]),o.$on("objRecord",e[54]),{c(){Ne(t.$$.fragment),n=L(),Ne(r.$$.fragment),i=L(),Ne(o.$$.fragment)},m(e,a){Te(t,e,a),x(e,n,a),Te(r,e,a),x(e,i,a),Te(o,e,a),s=!0},p(e,n){const i={};1&n[0]&&(i.class=e[0].name+" hidden"),1&n[0]&&(i.name=e[0].designation),1&n[0]&&(i.help=e[0].properties?.hint),805307905&n[0]|8388608&n[2]&&(i.$$scope={dirty:n,ctx:e}),t.$set(i);const s={};1&n[1]&&(s.text=e[31]),r.$set(s);const a={};16&n[0]&&(a.required=e[4]),8&n[0]&&(a.disabled=e[3]),67108864&n[0]&&(a.readonly=e[26]),1&n[0]&&(a.item=e[0]),524288&n[0]&&(a.currency=e[19]),536870912&n[0]&&(a.value=e[29]()),o.$set(a)},i(e){s||($e(t.$$.fragment,e),$e(r.$$.fragment,e),$e(o.$$.fragment,e),s=!0)},o(e){Ie(t.$$.fragment,e),Ie(r.$$.fragment,e),Ie(o.$$.fragment,e),s=!1},d(e){Re(t,e),e&&k(n),Re(r,e),e&&k(i),Re(o,e)}}}function Qd(e){let t,n;return t=new e[33]({props:{inputClass:e[8]||e[9],disabled:e[3],formnovalidate:e[12],readonly:e[26],pattern:e[37],required:!0===e[4],placeholder:e[39],id:e[41],name:e[40],value:e[29]()}}),t.$on("change",e[43]()),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};768&n[0]&&(r.inputClass=e[8]||e[9]),8&n[0]&&(r.disabled=e[3]),4096&n[0]&&(r.formnovalidate=e[12]),67108864&n[0]&&(r.readonly=e[26]),16&n[0]&&(r.required=!0===e[4]),536870912&n[0]&&(r.value=e[29]()),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Jd(e){let t,n;return t=new td({props:{inputClass:e[8]||e[9],disabled:e[3],country:e[0].properties?.country,formnovalidate:e[12],readonly:e[26],required:e[4],id:e[41],name:e[40],pattern:e[37],placeholder:e[39],value:e[29](),notifyList:e[25]}}),t.$on("change",e[43]()),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};768&n[0]&&(r.inputClass=e[8]||e[9]),8&n[0]&&(r.disabled=e[3]),1&n[0]&&(r.country=e[0].properties?.country),4096&n[0]&&(r.formnovalidate=e[12]),67108864&n[0]&&(r.readonly=e[26]),16&n[0]&&(r.required=e[4]),536870912&n[0]&&(r.value=e[29]()),33554432&n[0]&&(r.notifyList=e[25]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function eu(e){let t,n;return t=new Gd({props:{inputClass:e[8]||e[9],formnovalidate:e[12],id:e[41],name:e[40],value:e[29](),record:e[1],"}":!0}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};768&n[0]&&(r.inputClass=e[8]||e[9]),4096&n[0]&&(r.formnovalidate=e[12]),536870912&n[0]&&(r.value=e[29]()),2&n[0]&&(r.record=e[1]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function tu(e){let t,n;return t=new Zc({props:{inputClass:e[8]||e[9],disabled:e[3],formnovalidate:e[12],readonly:e[26],required:e[4],id:e[41],name:e[40],value:e[29]()}}),t.$on("change",e[43]()),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};768&n[0]&&(r.inputClass=e[8]||e[9]),8&n[0]&&(r.disabled=e[3]),4096&n[0]&&(r.formnovalidate=e[12]),67108864&n[0]&&(r.readonly=e[26]),16&n[0]&&(r.required=e[4]),536870912&n[0]&&(r.value=e[29]()),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function nu(e){let t,n;return t=new sd({props:{inputClass:e[8]||e[9],disabled:e[3],formnovalidate:e[12],readonly:e[26],required:e[4],id:e[41],name:e[40],pattern:e[37],multiple:e[38],placeholder:e[39],value:e[29]()}}),t.$on("change",e[43]()),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};768&n[0]&&(r.inputClass=e[8]||e[9]),8&n[0]&&(r.disabled=e[3]),4096&n[0]&&(r.formnovalidate=e[12]),67108864&n[0]&&(r.readonly=e[26]),16&n[0]&&(r.required=e[4]),536870912&n[0]&&(r.value=e[29]()),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function ru(e){let t,n;return t=new Bc({props:{inputClass:e[8]||e[9],disabled:e[3],readonly:e[26],required:e[4],id:e[41],item:e[0],value:e[29](),praefix:e[5]}}),t.$on("blur",e[43]()),t.$on("checkRange",e[76]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};768&n[0]&&(r.inputClass=e[8]||e[9]),8&n[0]&&(r.disabled=e[3]),67108864&n[0]&&(r.readonly=e[26]),16&n[0]&&(r.required=e[4]),1&n[0]&&(r.item=e[0]),536870912&n[0]&&(r.value=e[29]()),32&n[0]&&(r.praefix=e[5]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function iu(e){let t,n;return t=new Zo({props:{inputClass:e[8]||e[9],disabled:e[3],formnovalidate:e[12],readonly:e[26],required:e[4],id:e[41],name:e[40],value:e[29](),record:e[1],item:e[0]}}),t.$on("change",e[43]()),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};768&n[0]&&(r.inputClass=e[8]||e[9]),8&n[0]&&(r.disabled=e[3]),4096&n[0]&&(r.formnovalidate=e[12]),67108864&n[0]&&(r.readonly=e[26]),16&n[0]&&(r.required=e[4]),536870912&n[0]&&(r.value=e[29]()),2&n[0]&&(r.record=e[1]),1&n[0]&&(r.item=e[0]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function ou(e){let t,n;return t=new Ys({props:{classId:e[9],id:e[41],disabled:e[3],required:e[4],value:e[42](),noForm:e[8]}}),t.$on("change",e[43]()),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),16&n[0]&&(r.required=e[4]),256&n[0]&&(r.noForm=e[8]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function su(e){let t,n;return t=new Qs({props:{classId:e[9],id:e[41],item:e[0],disabled:e[3],required:e[4],value:e[30](),noForm:e[8]}}),t.$on("change",e[43](!0)),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),1&n[0]&&(r.item=e[0]),8&n[0]&&(r.disabled=e[3]),16&n[0]&&(r.required=e[4]),1073741824&n[0]&&(r.value=e[30]()),256&n[0]&&(r.noForm=e[8]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function au(e){let t,n;return t=new Vs({props:{classId:e[9],eventId:e[10],id:e[41],item:e[0],record:e[1],readonly:e[26],disabled:e[3],required:e[4],praefix:e[5],value:e[42](),noForm:e[8],notifyList:e[25],dateInput:e[24]}}),t.$on("change",e[43](!0)),t.$on("formula",e[74]),t.$on("record",e[75]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),1024&n[0]&&(r.eventId=e[10]),1&n[0]&&(r.item=e[0]),2&n[0]&&(r.record=e[1]),67108864&n[0]&&(r.readonly=e[26]),8&n[0]&&(r.disabled=e[3]),16&n[0]&&(r.required=e[4]),32&n[0]&&(r.praefix=e[5]),256&n[0]&&(r.noForm=e[8]),33554432&n[0]&&(r.notifyList=e[25]),16777216&n[0]&&(r.dateInput=e[24]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function lu(e){let t,n;return t=new e[34]({props:{round:!0,inputClass:e[8]||e[9],disabled:e[3]||e[26],required:e[4],id:e[41],name:e[40],checked:e[29](),value:e[29](!0)}}),t.$on("change",e[43]()),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};768&n[0]&&(r.inputClass=e[8]||e[9]),67108872&n[0]&&(r.disabled=e[3]||e[26]),16&n[0]&&(r.required=e[4]),536870912&n[0]&&(r.checked=e[29]()),536870912&n[0]&&(r.value=e[29](!0)),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function cu(e){let t,n;return t=new jc({props:{id:e[41],item:e[0],praefix:e[5],record:e[1],notifyList:e[25]}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};1&n[0]&&(r.item=e[0]),32&n[0]&&(r.praefix=e[5]),2&n[0]&&(r.record=e[1]),33554432&n[0]&&(r.notifyList=e[25]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function du(e){let t,n;return t=new rs({props:{classId:e[9],item:e[0],record:e[1],listName:e[6],disabled:e[3],formnovalidate:e[12],readonly:e[26],pattern:e[37],required:!0===e[4],placeholder:e[39],id:e[41],name:e[40],value:e[29]()}}),t.$on("blur",e[43]()),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),1&n[0]&&(r.item=e[0]),2&n[0]&&(r.record=e[1]),64&n[0]&&(r.listName=e[6]),8&n[0]&&(r.disabled=e[3]),4096&n[0]&&(r.formnovalidate=e[12]),67108864&n[0]&&(r.readonly=e[26]),16&n[0]&&(r.required=!0===e[4]),536870912&n[0]&&(r.value=e[29]()),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function uu(e){let t,n;return t=new Ts({props:{classId:e[9],disabled:e[3],required:e[4],id:e[41],item:e[0],record:e[1],value:e[29](),noForm:e[8],view:e[0].properties.view,praefix:e[5]}}),t.$on("blur",e[43]()),t.$on("invalid",e[73]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),16&n[0]&&(r.required=e[4]),1&n[0]&&(r.item=e[0]),2&n[0]&&(r.record=e[1]),536870912&n[0]&&(r.value=e[29]()),256&n[0]&&(r.noForm=e[8]),1&n[0]&&(r.view=e[0].properties.view),32&n[0]&&(r.praefix=e[5]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function fu(e){let t,n;return t=new Ho({props:{classId:e[9],disabled:e[3],required:e[4],id:e[41],item:e[0],record:e[1],value:e[29](),noForm:e[8],multi:e[0].properties.multi,numberInput:e[14],praefix:e[5],toDelete:e[17],reqQuantity:e[18],notifyList:e[25]}}),t.$on("blur",e[43]()),t.$on("invalid",e[72]),t.$on("record",e[44]),t.$on("multi",e[45]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),16&n[0]&&(r.required=e[4]),1&n[0]&&(r.item=e[0]),2&n[0]&&(r.record=e[1]),536870912&n[0]&&(r.value=e[29]()),256&n[0]&&(r.noForm=e[8]),1&n[0]&&(r.multi=e[0].properties.multi),16384&n[0]&&(r.numberInput=e[14]),32&n[0]&&(r.praefix=e[5]),131072&n[0]&&(r.toDelete=e[17]),262144&n[0]&&(r.reqQuantity=e[18]),33554432&n[0]&&(r.notifyList=e[25]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function hu(e){let t,n;return t=new lo({props:{classId:e[9],disabled:e[3],formnovalidate:e[12],required:e[4],readonly:e[26],id:e[41],item:e[0],ownCurrency:e[20],currency:e[19],value:e[29](),praefix:e[5],notifyList:e[25],noForm:e[8]}}),t.$on("blur",e[43]()),t.$on("formula",e[69]),t.$on("listRecord",e[70]),t.$on("record",e[71]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),4096&n[0]&&(r.formnovalidate=e[12]),16&n[0]&&(r.required=e[4]),67108864&n[0]&&(r.readonly=e[26]),1&n[0]&&(r.item=e[0]),1048576&n[0]&&(r.ownCurrency=e[20]),524288&n[0]&&(r.currency=e[19]),536870912&n[0]&&(r.value=e[29]()),32&n[0]&&(r.praefix=e[5]),33554432&n[0]&&(r.notifyList=e[25]),256&n[0]&&(r.noForm=e[8]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function mu(e){let t,n;return t=new Wd({props:{classId:e[9],disabled:e[3],readonly:e[26],required:e[4],id:e[41],item:e[0],record:e[1],value:e[29](),noForm:e[8]}}),t.$on("change",e[43]()),t.$on("record",e[67]),t.$on("objRecord",e[68]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),67108864&n[0]&&(r.readonly=e[26]),16&n[0]&&(r.required=e[4]),1&n[0]&&(r.item=e[0]),2&n[0]&&(r.record=e[1]),536870912&n[0]&&(r.value=e[29]()),256&n[0]&&(r.noForm=e[8]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function pu(e){let t,n;return t=new Ps({props:{classId:e[9],disabled:e[3],required:e[4],id:e[41],item:e[0],value:e[29](),noForm:e[8]}}),t.$on("blur",e[43]()),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),16&n[0]&&(r.required=e[4]),1&n[0]&&(r.item=e[0]),536870912&n[0]&&(r.value=e[29]()),256&n[0]&&(r.noForm=e[8]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function gu(e){let t,n;return t=new Td({props:{classId:e[9],disabled:e[3],readonly:e[26],id:e[41],name:e[0].name,value:e[29](),record:e[1],noForm:e[8],placeholder:e[0].properties?.placeholder}}),t.$on("blur",e[43]()),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),67108864&n[0]&&(r.readonly=e[26]),1&n[0]&&(r.name=e[0].name),536870912&n[0]&&(r.value=e[29]()),2&n[0]&&(r.record=e[1]),256&n[0]&&(r.noForm=e[8]),1&n[0]&&(r.placeholder=e[0].properties?.placeholder),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function wu(e){let t,n;return t=new xc({props:{praefix:e[5],classId:e[9],disabled:e[3],readonly:e[26],item:e[0],id:e[41],name:e[0].name,eventId:e[10],record:e[1],recordId:e[2],value:e[29](),fileType:e[0].properties?.accept}}),t.$on("record",e[65]),t.$on("listRecord",e[66]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};32&n[0]&&(r.praefix=e[5]),512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),67108864&n[0]&&(r.readonly=e[26]),1&n[0]&&(r.item=e[0]),1&n[0]&&(r.name=e[0].name),1024&n[0]&&(r.eventId=e[10]),2&n[0]&&(r.record=e[1]),4&n[0]&&(r.recordId=e[2]),536870912&n[0]&&(r.value=e[29]()),1&n[0]&&(r.fileType=e[0].properties?.accept),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function yu(e){let t,n;return t=new $c({props:{praefix:e[5],classId:e[9],disabled:e[3],readonly:e[26],item:e[0],id:e[41],name:e[0].name,eventId:e[10],record:e[1],value:e[29]()}}),t.$on("record",e[64]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};32&n[0]&&(r.praefix=e[5]),512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),67108864&n[0]&&(r.readonly=e[26]),1&n[0]&&(r.item=e[0]),1&n[0]&&(r.name=e[0].name),1024&n[0]&&(r.eventId=e[10]),2&n[0]&&(r.record=e[1]),536870912&n[0]&&(r.value=e[29]()),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function vu(e){let t,n;return t=new cc({props:{classId:e[9],disabled:e[3],readonly:e[26],item:e[0],id:e[41],name:e[0].name,eventId:e[10],record:e[1],value:e[29]()}}),t.$on("record",e[62]),t.$on("saveFull",e[63]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),67108864&n[0]&&(r.readonly=e[26]),1&n[0]&&(r.item=e[0]),1&n[0]&&(r.name=e[0].name),1024&n[0]&&(r.eventId=e[10]),2&n[0]&&(r.record=e[1]),536870912&n[0]&&(r.value=e[29]()),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function $u(e){let t,n;return t=new s({props:{classId:e[9],disabled:e[3],readonly:e[26],id:e[41],name:e[0].name,value:e[29](),noForm:e[8],standard:!0,style:"",placeholder:e[0].properties?.placeholder}}),t.$on("blur",e[43]()),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),67108864&n[0]&&(r.readonly=e[26]),1&n[0]&&(r.name=e[0].name),536870912&n[0]&&(r.value=e[29]()),256&n[0]&&(r.noForm=e[8]),1&n[0]&&(r.placeholder=e[0].properties?.placeholder),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Iu(e){let t,n;return t=new lr({props:{classId:e[9],eventId:e[10],listName:e[24]?.l||"",record:e[1],fullRecord:e[7],required:e[4],disabled:e[3],formnovalidate:e[12],readonly:e[26],id:e[41],item:e[0],desc:e[31],value:e[29](),multiValues:e[21],noForm:e[8],praefix:e[5],selectionFields:e[11],selection:e[13],deList:e[15],recordId:e[2],isTemplate:e[16],shortEdit:e[22],initFinished:e[23]}}),t.$on("task",e[57]),t.$on("record",e[58]),t.$on("listChange",e[59]),t.$on("saveDialog",e[60]),t.$on("change",e[43]()),t.$on("initFail",e[46]),t.$on("defPrep",e[61]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),1024&n[0]&&(r.eventId=e[10]),16777216&n[0]&&(r.listName=e[24]?.l||""),2&n[0]&&(r.record=e[1]),128&n[0]&&(r.fullRecord=e[7]),16&n[0]&&(r.required=e[4]),8&n[0]&&(r.disabled=e[3]),4096&n[0]&&(r.formnovalidate=e[12]),67108864&n[0]&&(r.readonly=e[26]),1&n[0]&&(r.item=e[0]),1&n[1]&&(r.desc=e[31]),536870912&n[0]&&(r.value=e[29]()),2097152&n[0]&&(r.multiValues=e[21]),256&n[0]&&(r.noForm=e[8]),32&n[0]&&(r.praefix=e[5]),2048&n[0]&&(r.selectionFields=e[11]),8192&n[0]&&(r.selection=e[13]),32768&n[0]&&(r.deList=e[15]),4&n[0]&&(r.recordId=e[2]),65536&n[0]&&(r.isTemplate=e[16]),4194304&n[0]&&(r.shortEdit=e[22]),8388608&n[0]&&(r.initFinished=e[23]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function _u(e){let t,n;return t=new jr({props:{classId:e[9],eventId:e[10],required:e[4],disabled:e[3],formnovalidate:e[12],readonly:e[26],id:e[41],item:e[0],record:e[1],desc:e[31],value:e[29]()||[],noForm:e[8],praefix:e[5],selectionFields:e[11],selection:e[13],deList:e[15],recordId:e[2],isTemplate:e[16]}}),t.$on("task",e[55]),t.$on("change",e[43]()),t.$on("multi",e[45]),t.$on("initFail",e[46]),t.$on("defPrep",e[56]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),1024&n[0]&&(r.eventId=e[10]),16&n[0]&&(r.required=e[4]),8&n[0]&&(r.disabled=e[3]),4096&n[0]&&(r.formnovalidate=e[12]),67108864&n[0]&&(r.readonly=e[26]),1&n[0]&&(r.item=e[0]),2&n[0]&&(r.record=e[1]),1&n[1]&&(r.desc=e[31]),536870912&n[0]&&(r.value=e[29]()||[]),256&n[0]&&(r.noForm=e[8]),32&n[0]&&(r.praefix=e[5]),2048&n[0]&&(r.selectionFields=e[11]),8192&n[0]&&(r.selection=e[13]),32768&n[0]&&(r.deList=e[15]),4&n[0]&&(r.recordId=e[2]),65536&n[0]&&(r.isTemplate=e[16]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Cu(e){let t,n,r,i;const o=[_u,Iu,$u,vu,yu,wu,gu,pu,mu,hu,fu,uu,du,cu,lu,au,su,ou,iu,ru,nu,tu,eu,Jd,Qd],s=[];function a(e,t){return"object"===e[0].type&&e[0].properties?.multi?0:"object"===e[0].type?1:"textarea"===e[0].type||e[0].properties&&"textarea"===e[0].properties.format?2:"file"===e[0].type?3:"fileQR"===e[0].type?4:"filePDF"===e[0].type?5:"signature"===e[0].type?6:e[0].properties&&(e[0].properties.enum||e[0].properties.regulation)?7:e[0].properties?.format?.service?8:"number"===e[0].type?9:e[0].properties&&e[0].properties.multi?10:e[0].properties&&e[0].properties.view&&"lookup"!==e[0].properties.format?11:e[0].properties?.autocomplete?12:"lookup"===e[0].properties?.format?13:"boolean"===e[0].type?14:"date"===e[0].type?15:"dateRange"===e[0].type?16:"datetime"===e[0].type?17:"map"===e[0].properties?.format?18:"time"===e[0].properties?.format?19:"email"===e[0].type||"email"===e[0].properties?.format?20:"url"===e[0].properties?.format?21:"task"===e[0].properties?.format?22:"tel"===e[0].properties?.format?23:24}return t=a(e),n=s[t]=o[t](e),{c(){n.c(),r=F()},m(e,n){s[t].m(e,n),x(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?s[t].p(e,i):(ye(),Ie(s[l],1,1,()=>{s[l]=null}),ve(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),$e(n,1),n.m(r.parentNode,r))},i(e){i||($e(n),i=!0)},o(e){Ie(n),i=!1},d(e){s[t].d(e),e&&k(r)}}}function Eu(e){let t,n;return t=new lr({props:{classId:e[9],eventId:e[10],disabled:!0,readonly:!0,id:e[41],item:e[0],value:e[29](),noList:!0,withRefValue:!0,refValue:e[28]}}),t.$on("setRefDesc",e[49]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),1024&n[0]&&(r.eventId=e[10]),1&n[0]&&(r.item=e[0]),536870912&n[0]&&(r.value=e[29]()),268435456&n[0]&&(r.refValue=e[28]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Au(e){let t,n,r,i;const o=[Kd,Zd,Yd,Xd],s=[];function a(e,t){return e[5]||"reference"!==e[0].saveAs||"object"!==e[0].type?"html"===e[0].properties?.format?1:"divider"===e[0].type?2:3:0}return t=a(e),n=s[t]=o[t](e),{c(){n.c(),r=F()},m(e,n){s[t].m(e,n),x(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?s[t].p(e,i):(ye(),Ie(s[l],1,1,()=>{s[l]=null}),ve(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),$e(n,1),n.m(r.parentNode,r))},i(e){i||($e(n),i=!0)},o(e){Ie(n),i=!1},d(e){s[t].d(e),e&&k(r)}}}function bu(e,n,r){let i,o,s,a,l;const d=ee(),{FormField:f,TextField:h,DatePicker:p,TimePicker:g,Checkbox:w,Divider:y}=c,{environment:v}=u;N(e,v,e=>r(52,l=e));let{praefix:$=""}=n,{item:_}=n,{listName:C=""}=n,{fullRecord:E}=n,{record:A}=n,{recordId:b}=n,{noForm:S=!1}=n,{classId:T}=n,{eventId:R}=n,{disabled:D}=n,{selectionFields:x}=n,{formnovalidate:k}=n,{selection:O=!1}=n,{notifyList:M}=n,{numberInput:P}=n,{deList:B}=n,{required:L}=n,{isTemplate:F}=n,{toDelete:V}=n,{reqQuantity:U}=n,{currency:W}=n,{ownCurrency:z}=n,{changeValue:H}=n,{propSelection:j}=n,{multiValues:q}=n,{shortEdit:G}=n,{initFinished:X}=n,{dateInput:Y}=n;b||=A._id;let{required:Z,readonly:K,hidden:Q,pattern:J,multiple:ne,placeholder:re}=_.properties||{};if(Q=!0===Q,void 0!==K&&(K=!0===K),K||=b&&_.asInput,void 0===L&&(L=Z),D=D||!!K,"string"==typeof _.name){const[e,t]=_.name.split("_");t&&(_.name=t)}const ie=(C?C+".":"")+_.name,oe=ie+(""!==$?"-"+$:""),se=(e,t=ie)=>{try{return t.split(".").reduce((e,t)=>e[t],e)}catch(e){return""}},ae=async e=>{const{list:n,values:r}=_.process;if(!e)return void d("save",{itemName:n,value:[],addToRecord:!0});const i={},o=await t.getSchema(R);for(const e in r){const s=r[e];if(e.includes(".")){const[r,a]=e.split("."),l={[a]:s};let c=await t.getSectionView(r,l);if(!c?.length)continue;c=c[0],i[r]=c._id;const d=o.list.find(e=>e.name===n);for(const e of d.item){const{name:t}=e;i[t]||(i[t]=c[t])}}else i[e]=s}d("save",{itemName:n,value:[i],addToRecord:!0})};let le=se(A);return e.$$set=e=>{"praefix"in e&&r(5,$=e.praefix),"item"in e&&r(0,_=e.item),"listName"in e&&r(6,C=e.listName),"fullRecord"in e&&r(7,E=e.fullRecord),"record"in e&&r(1,A=e.record),"recordId"in e&&r(2,b=e.recordId),"noForm"in e&&r(8,S=e.noForm),"classId"in e&&r(9,T=e.classId),"eventId"in e&&r(10,R=e.eventId),"disabled"in e&&r(3,D=e.disabled),"selectionFields"in e&&r(11,x=e.selectionFields),"formnovalidate"in e&&r(12,k=e.formnovalidate),"selection"in e&&r(13,O=e.selection),"notifyList"in e&&r(25,M=e.notifyList),"numberInput"in e&&r(14,P=e.numberInput),"deList"in e&&r(15,B=e.deList),"required"in e&&r(4,L=e.required),"isTemplate"in e&&r(16,F=e.isTemplate),"toDelete"in e&&r(17,V=e.toDelete),"reqQuantity"in e&&r(18,U=e.reqQuantity),"currency"in e&&r(19,W=e.currency),"ownCurrency"in e&&r(20,z=e.ownCurrency),"changeValue"in e&&r(50,H=e.changeValue),"propSelection"in e&&r(51,j=e.propSelection),"multiValues"in e&&r(21,q=e.multiValues),"shortEdit"in e&&r(22,G=e.shortEdit),"initFinished"in e&&r(23,X=e.initFinished),"dateInput"in e&&r(24,Y=e.dateInput)},e.$$.update=()=>{if(1&e.$$.dirty[0]|1048576&e.$$.dirty[1]&&j&&_.properties?.selection){const{refClass:e,refItem:t,target:n}=_.properties.selection,r=j.record[e];d("propSelection",{itemName:_.name,itemType:_.type,prop:t,target:n,source:e,sourceId:r})}if(524288&e.$$.dirty[1])for(const e in H)e===ie&&r(1,A[ie]=H[e],A);7&e.$$.dirty[0]|2097152&e.$$.dirty[1]&&r(29,i=(e=!1)=>{let t;return b||"number"!==_.type&&"string"!==_.type||!_.refItemAlt?.startsWith||!_.refItemAlt.startsWith("owner.")||+se(A)?b||"number"!==_.type&&"string"!==_.type||!_.refItem?.startsWith||!_.refItem.startsWith("owner.")?(t=se(A),!t&&_.properties?.useId&&(t=A._id),e&&(t=!!t),void 0===t?"":t):(t=se(l,_.refItem),void 0===t?"":t):(t=se(l,_.refItemAlt),void 0===t?"":t)}),2&e.$$.dirty[0]&&r(30,o=(e=ie)=>{const t=se(A,e+"_from"),n=se(A,e+"_to");return{from:void 0===t?t:I(t),to:void 0===n?n:I(n)}}),2&e.$$.dirty[0]&&(a=se(A))},r(31,s=((e=ie)=>{let t=A["_"+e];return t=m(t),void 0===t?"":t})()),[_,A,b,D,L,$,C,E,S,T,R,x,k,O,P,B,F,V,U,W,z,q,G,X,Y,M,K,Q,le,i,o,s,f,h,w,y,v,J,ne,re,ie,oe,(e=ie)=>{let t=se(A);return t?new Date(t):""===$?(()=>{const e=new Date;return new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()-1,23))})():void 0},e=>({detail:t})=>{let{value:n,checked:i,range:o}=t;void 0!==i&&(n=i);const s=ie+(o||"");r(1,A[s]=e?function(e,t){if(null==e)return null;let n=e.getHours();return/%p/i.test(t)&&(n%=12,0===n&&(n=12)),t.replace("%Y",e.getFullYear()).replace("%y",(e.getFullYear()%100).toString().padStart(2,"0")).replace("%m",(e.getMonth()+1).toString().padStart(2,"0")).replace("%d",e.getDate().toString().padStart(2,"0")).replace("%H",n.toString().padStart(2,"0")).replace("%M",e.getMinutes().toString().padStart(2,"0")).replace("%S",e.getSeconds().toString().padStart(2,"0")).replace("%p",e.getHours()<12?"am":"pm").replace("%P",e.getHours()<12?"AM":"PM").replace("%%","%")}(n,"%d.%m.%Y"):n,A);const l=Object.values(A).every(e=>!e)&&n;d("notify",{oldValue:a,value:n,add:l,itemName:s,desc:t.description}),"boolean"===_.type&&_.process&&ae(i)},({detail:e})=>{d("record",e)},({detail:e})=>{d("multi",e)},()=>r(27,Q=!0),()=>"object"===_.type?"comment_"+oe:oe,({detail:e})=>{r(28,le=e)},({detail:e})=>{const{designation:t}=_;r(31,s=t+": "+(e||"(Neu)"))},H,j,l,function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)}]}class Su extends xe{constructor(e){var t;super(),document.getElementById("svelte-rxh0vh-style")||((t=M("style")).id="svelte-rxh0vh-style",t.textContent=".form-field{margin-bottom:0.5em !important}.form-field.hidden{display:none !important}.form-field > .description{padding-top:0.75em;color:black}.form-field div.field > label.checkbox{padding-top:0.5em}.form-field label.color_red{color:red}",D(document.head,t)),De(this,e,bu,Au,S,{praefix:5,item:0,listName:6,fullRecord:7,record:1,recordId:2,noForm:8,classId:9,eventId:10,disabled:3,selectionFields:11,formnovalidate:12,selection:13,notifyList:25,numberInput:14,deList:15,required:4,isTemplate:16,toDelete:17,reqQuantity:18,currency:19,ownCurrency:20,changeValue:50,propSelection:51,multiValues:21,shortEdit:22,initFinished:23,dateInput:24},[-1,-1,-1])}}const{document:Nu}=Ee;function Tu(e){e[18]=e[20].defList,e[1]=e[20].list,e[19]=e[20].items}function Ru(e,t,n){const r=e.slice();return r[21]=t[n],r[23]=n,r}function Du(e,t,n){const r=e.slice();return r[24]=t[n],r[26]=n,r}function xu(e,t,n){const r=e.slice();return r[24]=t[n],r}function ku(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Ou(e){let t,n,r,i,o,s,a,l,c,d;Tu(e),n=new e[5]({props:{outline:!0,$$slots:{default:[Mu]},$$scope:{ctx:e}}}),n.$on("click",e[14]),i=new e[5]({props:{disabled:!e[1].length,filled:!0,$$slots:{default:[Pu]},$$scope:{ctx:e}}}),i.$on("click",e[10](e[1]));let u=e[19]?.length&&function(e){let t,n,r,i,o,s,a,l;i=new Ze({props:{size:"20"}});let c=e[19],d=[];for(let t=0;t<c.length;t+=1)d[t]=Bu(xu(e,c,t));return{c(){t=M("thead"),n=M("tr"),r=M("th"),Ne(i.$$.fragment),o=L();for(let e=0;e<d.length;e+=1)d[e].c();z(r,"class","svelte-1m010ne"),z(n,"class","svelte-1m010ne"),z(t,"class","svelte-1m010ne")},m(c,u){x(c,t,u),D(t,n),D(n,r),Te(i,r,null),D(n,o);for(let e=0;e<d.length;e+=1)d[e].m(n,null);s=!0,a||(l=V(r,"click",e[11](e[1])),a=!0)},p(t,r){if(e=t,512&r){let t;for(c=e[19],t=0;t<c.length;t+=1){const i=xu(e,c,t);d[t]?d[t].p(i,r):(d[t]=Bu(i),d[t].c(),d[t].m(n,null))}for(;t<d.length;t+=1)d[t].d(1);d.length=c.length}},i(e){s||($e(i.$$.fragment,e),s=!0)},o(e){Ie(i.$$.fragment,e),s=!1},d(e){e&&k(t),Re(i),O(d,e),a=!1,l()}}}(e),f=e[1]?.length&&function(e){let t,n,r=e[1],i=[];for(let t=0;t<r.length;t+=1)i[t]=Vu(Ru(e,r,t));const o=e=>Ie(i[e],1,1,()=>{i[e]=null});return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=F()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);x(e,t,r),n=!0},p(e,n){if(4864&n){let s;for(r=e[1],s=0;s<r.length;s+=1){const o=Ru(e,r,s);i[s]?(i[s].p(o,n),$e(i[s],1)):(i[s]=Vu(o),i[s].c(),$e(i[s],1),i[s].m(t.parentNode,t))}for(ye(),s=r.length;s<i.length;s+=1)o(s);ve()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)$e(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)Ie(i[e]);n=!1},d(e){O(i,e),e&&k(t)}}}(e);return{c(){t=M("div"),Ne(n.$$.fragment),r=L(),Ne(i.$$.fragment),o=L(),s=M("div"),a=M("table"),u&&u.c(),l=L(),c=M("tbody"),f&&f.c(),z(t,"class","form--buttons svelte-1m010ne"),z(a,"striped",""),z(a,"class","svelte-1m010ne"),z(s,"class","eList svelte-1m010ne")},m(e,h){x(e,t,h),Te(n,t,null),D(t,r),Te(i,t,null),x(e,o,h),x(e,s,h),D(s,a),u&&u.m(a,null),D(a,l),D(a,c),f&&f.m(c,null),d=!0},p(e,t){Tu(e);const r={};536870912&t&&(r.$$scope={dirty:t,ctx:e}),n.$set(r);const o={};536870912&t&&(o.$$scope={dirty:t,ctx:e}),i.$set(o),e[19]?.length&&u.p(e,t),e[1]?.length&&f.p(e,t)},i(e){d||($e(n.$$.fragment,e),$e(i.$$.fragment,e),$e(u),$e(f),d=!0)},o(e){Ie(n.$$.fragment,e),Ie(i.$$.fragment,e),Ie(u),Ie(f),d=!1},d(e){e&&k(t),Re(n),Re(i),e&&k(o),e&&k(s),u&&u.d(),f&&f.d()}}}function Mu(e){let t;return{c(){t=B("Abbrechen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Pu(e){let t;return{c(){t=B("Bestätigen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Bu(e){let t,n,r=e[24].designation+"";return{c(){t=M("th"),n=B(r),z(t,"class","svelte-1m010ne")},m(e,r){x(e,t,r),D(t,n)},p:_,d(e){e&&k(t)}}}function Lu(e){let t,n,r;return n=new e[7]({props:{name:e[8],data:e[23],checked:e[12](e[18],e[21]),round:!0}}),{c(){t=M("td"),Ne(n.$$.fragment),z(t,"title","Wählt den Wert aus"),z(t,"class","svelte-1m010ne")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function Fu(e){let t,n,r=e[21][e[24].name]+"";return{c(){t=M("td"),n=B(r),z(t,"class","svelte-1m010ne")},m(e,r){x(e,t,r),D(t,n)},p:_,d(e){e&&k(t)}}}function Vu(e){let t,n,r,i,o=e[0],s=Lu(e),a=e[19],l=[];for(let t=0;t<a.length;t+=1)l[t]=Fu(Du(e,a,t));return{c(){t=M("tr"),s.c(),n=L();for(let e=0;e<l.length;e+=1)l[e].c();r=L(),z(t,"style","cursor: default;"),z(t,"class","svelte-1m010ne")},m(e,o){x(e,t,o),s.m(t,null),D(t,n);for(let e=0;e<l.length;e+=1)l[e].m(t,null);D(t,r),i=!0},p(e,i){if(1&i&&S(o,o=e[0])?(ye(),Ie(s,1,1,_),ve(),s=Lu(e),s.c(),$e(s),s.m(t,n)):s.p(e,i),512&i){let n;for(a=e[19],n=0;n<a.length;n+=1){const o=Du(e,a,n);l[n]?l[n].p(o,i):(l[n]=Fu(o),l[n].c(),l[n].m(t,r))}for(;n<l.length;n+=1)l[n].d(1);l.length=a.length}},i(e){i||($e(s),i=!0)},o(e){Ie(s),i=!1},d(e){e&&k(t),s.d(e),O(l,e)}}}function Uu(e){let t,n;return t=new e[3]({}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p:_,i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Wu(e){let t,n,r,i;t=new e[6]({});let o={ctx:e,current:null,token:null,hasCatch:!1,pending:Uu,then:Ou,catch:ku,value:20,blocks:[,,,]};return _e(e[9](),o),{c(){Ne(t.$$.fragment),n=L(),r=F(),o.block.c()},m(e,s){Te(t,e,s),x(e,n,s),x(e,r,s),o.block.m(e,o.anchor=s),o.mount=()=>r.parentNode,o.anchor=r,i=!0},p(t,n){Ce(o,e=t,n)},i(e){i||($e(t.$$.fragment,e),$e(o.block),i=!0)},o(e){Ie(t.$$.fragment,e);for(let e=0;e<3;e+=1){Ie(o.blocks[e])}i=!1},d(e){Re(t,e),e&&k(n),e&&k(r),o.block.d(e),o.token=null,o=null}}}function zu(e){let t,n;return t=new e[4]({props:{title:"Auswahl",class:"eList",$$slots:{default:[Wu]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,[n]){const r={};536870912&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Hu(e,n,r){const i=ee(),{Loading:o,TextField:s,Dialog:a,Button:l,Divider:d,Checkbox:u}=c;let{classId:f}=n,{list:h}=n,{selection:m=[]}=n;const p=f+h.name+"checkbox";Q(()=>{window.setTimeout(()=>{const e=document.querySelector("tr.active");e&&e.scrollIntoView({block:"end",behavior:"smooth"})},200)});return e.$$set=e=>{"classId"in e&&r(13,f=e.classId),"list"in e&&r(1,h=e.list),"selection"in e&&r(0,m=e.selection)},[m,h,i,o,a,l,d,u,p,async()=>{const{refItem:e}=h,{item:n,refList:r,display:i}=h.merge,o="."+f+"#"+e,s=document.querySelector(o),a=s?.value;if(!a)return{items:[],list:[]};const l=await t.getDocById(e,a);let c,d=[];if(l&&l[r]){const o=l[r].map(e=>e[n]),s=await t.getSectionView(n,{_id:{$in:o}},!1);d=l[r].map(e=>(e.designation=e.text||s.find(t=>t._id===e[n])?.designation,e.perWeek=s.find(t=>t._id===e[n])?.perWeek,e));c=(await t.getSchemaByClass(e)).list.find(e=>e.name===r),c=c.item.filter(e=>i.includes(e.name)),c.unshift({name:"designation",designation:"Artikel",type:"string"})}return{defList:h,list:d,items:c}},e=>()=>{const t=document.getElementsByName(p),n=[];t.forEach((t,r)=>{t.checked&&n.push(e[+t.attributes.data.value])}),i("choose",{list:n})},e=>()=>{document.getElementsByName(p).forEach((e,t)=>{e.checked=!e.checked})},(e,t)=>{const n=e.merge.id||[e.merge.item];return m.find(e=>{let r=!0;for(const i of n)r&&(r=t[i]===e[i]);return r})},f,()=>i("back")]}class ju extends xe{constructor(e){var t;super(),Nu.getElementById("svelte-1m010ne-style")||((t=M("style")).id="svelte-1m010ne-style",t.textContent=".eList.svelte-1m010ne.svelte-1m010ne{height:fit-content;max-height:65vh;overflow-y:scroll;overflow-x:auto}.eList.svelte-1m010ne table.svelte-1m010ne{min-width:30vw;position:relative;width:max-content !important;max-width:50vh !important}.eList.svelte-1m010ne table thead.svelte-1m010ne{position:sticky;top:0;background:#326173;color:white}.eList.svelte-1m010ne table tbody tr.svelte-1m010ne{height:2.3em}th.svelte-1m010ne.svelte-1m010ne,td.svelte-1m010ne.svelte-1m010ne{padding-left:0.4em;padding-right:0.4em}.dialog.eList{max-height:90vh}.checkbox.round > .selector{border-color:#326173 !important}.form--buttons.svelte-1m010ne.svelte-1m010ne{display:flex;gap:1em;padding:0.5em 0}",D(Nu.head,t)),De(this,e,Hu,zu,S,{classId:13,list:1,selection:0})}}var qu;!function(e){e[e.QR_CODE=0]="QR_CODE",e[e.AZTEC=1]="AZTEC",e[e.CODABAR=2]="CODABAR",e[e.CODE_39=3]="CODE_39",e[e.CODE_93=4]="CODE_93",e[e.CODE_128=5]="CODE_128",e[e.DATA_MATRIX=6]="DATA_MATRIX",e[e.MAXICODE=7]="MAXICODE",e[e.ITF=8]="ITF",e[e.EAN_13=9]="EAN_13",e[e.EAN_8=10]="EAN_8",e[e.PDF_417=11]="PDF_417",e[e.RSS_14=12]="RSS_14",e[e.RSS_EXPANDED=13]="RSS_EXPANDED",e[e.UPC_A=14]="UPC_A",e[e.UPC_E=15]="UPC_E",e[e.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"}(qu||(qu={}));var Gu,Xu,Yu=new Map([[qu.QR_CODE,"QR_CODE"],[qu.AZTEC,"AZTEC"],[qu.CODABAR,"CODABAR"],[qu.CODE_39,"CODE_39"],[qu.CODE_93,"CODE_93"],[qu.CODE_128,"CODE_128"],[qu.DATA_MATRIX,"DATA_MATRIX"],[qu.MAXICODE,"MAXICODE"],[qu.ITF,"ITF"],[qu.EAN_13,"EAN_13"],[qu.EAN_8,"EAN_8"],[qu.PDF_417,"PDF_417"],[qu.RSS_14,"RSS_14"],[qu.RSS_EXPANDED,"RSS_EXPANDED"],[qu.UPC_A,"UPC_A"],[qu.UPC_E,"UPC_E"],[qu.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]);function Zu(e){return Object.values(qu).includes(e)}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.URL=1]="URL"}(Gu||(Gu={})),function(e){e[e.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",e[e.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"}(Xu||(Xu={}));var Ku,Qu=function(){function e(){}return e.GITHUB_PROJECT_URL="https://github.com/mebjas/html5-qrcode",e.SCAN_DEFAULT_FPS=2,e.DEFAULT_DISABLE_FLIP=!1,e.DEFAULT_REMEMBER_LAST_CAMERA_USED=!0,e.DEFAULT_SUPPORTED_SCAN_TYPE=[Xu.SCAN_TYPE_CAMERA,Xu.SCAN_TYPE_FILE],e}(),Ju=function(){function e(e,t){this.format=e,this.formatName=t}return e.prototype.toString=function(){return this.formatName},e.create=function(t){if(!Yu.has(t))throw"".concat(t," not in html5QrcodeSupportedFormatsTextMap");return new e(t,Yu.get(t))},e}(),ef=function(){function e(){}return e.createFromText=function(e){return{decodedText:e,result:{text:e}}},e.createFromQrcodeResult=function(e){return{decodedText:e.text,result:e}},e}();!function(e){e[e.UNKWOWN_ERROR=0]="UNKWOWN_ERROR",e[e.IMPLEMENTATION_ERROR=1]="IMPLEMENTATION_ERROR",e[e.NO_CODE_FOUND_ERROR=2]="NO_CODE_FOUND_ERROR"}(Ku||(Ku={}));var tf=function(){function e(){}return e.createFrom=function(e){return{errorMessage:e,type:Ku.UNKWOWN_ERROR}},e}(),nf=function(){function e(e){this.verbose=e}return e.prototype.log=function(e){this.verbose&&console.log(e)},e.prototype.warn=function(e){this.verbose&&console.warn(e)},e.prototype.logError=function(e,t){(this.verbose||!0===t)&&console.error(e)},e.prototype.logErrors=function(e){if(0===e.length)throw"Logger#logError called without arguments";this.verbose&&console.error(e)},e}();function rf(e){return null==e}var of=function(){function e(){}return e.codeParseError=function(e){return"QR code parse error, error = ".concat(e)},e.errorGettingUserMedia=function(e){return"Error getting userMedia, error = ".concat(e)},e.onlyDeviceSupportedError=function(){return"The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."},e.cameraStreamingNotSupported=function(){return"Camera streaming not supported by the browser."},e.unableToQuerySupportedDevices=function(){return"Unable to query supported devices, unknown error."},e.insecureContextCameraQueryError=function(){return"Camera access is only supported in secure context like https or localhost."},e.scannerPaused=function(){return"Scanner paused"},e}(),sf=function(){function e(){}return e.isMediaStreamConstraintsValid=function(e,t){if("object"!=typeof e){var n=typeof e;return t.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(n,"."),!0),!1}for(var r=new Set(["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"]),i=0,o=Object.keys(e);i<o.length;i++){var s=o[i];if(r.has(s))return t.logError("".concat(s," is not supported videoConstaints."),!0),!1}return!0},e}(),af="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function lf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function cf(e){var t={exports:{}};return e(t,t.exports),t.exports}var df,uf,ff=cf(function(e,t){!function(e){function t(e){return null==e}var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};function r(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function i(e,t){var n=Object.setPrototypeOf;n?n(e,t):e.__proto__=t}function o(e,t){void 0===t&&(t=e.constructor);var n=Error.captureStackTrace;n&&n(e,t)}var s,a=function(e){function t(t){var n=this.constructor,r=e.call(this,t)||this;return Object.defineProperty(r,"name",{value:n.name,enumerable:!1}),i(r,n.prototype),o(r),r}return r(t,e),t}(Error);class l extends a{constructor(e=void 0){super(e),this.message=e}getKind(){return this.constructor.kind}}l.kind="Exception";class c extends l{}c.kind="ArgumentException";class d extends l{}d.kind="IllegalArgumentException";class u{constructor(e){if(this.binarizer=e,null===e)throw new d("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 null!==this.matrix&&void 0!==this.matrix||(this.matrix=this.binarizer.getBlackMatrix()),this.matrix}isCropSupported(){return this.binarizer.getLuminanceSource().isCropSupported()}crop(e,t,n,r){const i=this.binarizer.getLuminanceSource().crop(e,t,n,r);return new u(this.binarizer.createBinarizer(i))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new u(this.binarizer.createBinarizer(e))}rotateCounterClockwise45(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new u(this.binarizer.createBinarizer(e))}toString(){try{return this.getBlackMatrix().toString()}catch(e){return""}}}class f extends l{static getChecksumInstance(){return new f}}f.kind="ChecksumException";class h{constructor(e){this.source=e}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class m{static arraycopy(e,t,n,r,i){for(;i--;)n[r++]=e[t++]}static currentTimeMillis(){return Date.now()}}class p extends l{}p.kind="IndexOutOfBoundsException";class g extends p{constructor(e=void 0,t=void 0){super(t),this.index=e,this.message=t}}g.kind="ArrayIndexOutOfBoundsException";class w{static fill(e,t){for(let n=0,r=e.length;n<r;n++)e[n]=t}static fillWithin(e,t,n,r){w.rangeCheck(e.length,t,n);for(let i=t;i<n;i++)e[i]=r}static rangeCheck(e,t,n){if(t>n)throw new d("fromIndex("+t+") > toIndex("+n+")");if(t<0)throw new g(t);if(n>e)throw new g(n)}static asList(...e){return e}static create(e,t,n){return Array.from({length:e}).map(e=>Array.from({length:t}).fill(n))}static createInt32Array(e,t,n){return Array.from({length:e}).map(e=>Int32Array.from({length:t}).fill(n))}static equals(e,t){if(!e)return!1;if(!t)return!1;if(!e.length)return!1;if(!t.length)return!1;if(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(null===e)return 0;let t=1;for(const n of e)t=31*t+n;return t}static fillUint8Array(e,t){for(let n=0;n!==e.length;n++)e[n]=t}static copyOf(e,t){return e.slice(0,t)}static copyOfUint8Array(e,t){if(e.length<=t){const n=new Uint8Array(t);return n.set(e),n}return e.slice(0,t)}static copyOfRange(e,t,n){const r=n-t,i=new Int32Array(r);return m.arraycopy(e,t,i,0,r),i}static binarySearch(e,t,n){void 0===n&&(n=w.numberComparator);let r=0,i=e.length-1;for(;r<=i;){const o=i+r>>1,s=n(t,e[o]);if(s>0)r=o+1;else{if(!(s<0))return o;i=o-1}}return-r-1}static numberComparator(e,t){return e-t}}class y{static numberOfTrailingZeros(e){let t;if(0===e)return 32;let n=31;return t=e<<16,0!==t&&(n-=16,e=t),t=e<<8,0!==t&&(n-=8,e=t),t=e<<4,0!==t&&(n-=4,e=t),t=e<<2,0!==t&&(n-=2,e=t),n-(e<<1>>>31)}static numberOfLeadingZeros(e){if(0===e)return 32;let t=1;return e>>>16==0&&(t+=16,e<<=16),e>>>24==0&&(t+=8,e<<=8),e>>>28==0&&(t+=4,e<<=4),e>>>30==0&&(t+=2,e<<=2),t-=e>>>31,t}static toHexString(e){return e.toString(16)}static toBinaryString(e){return String(parseInt(String(e),2))}static bitCount(e){return e=(e=(858993459&(e-=e>>>1&1431655765))+(e>>>2&858993459))+(e>>>4)&252645135,e+=e>>>8,63&(e+=e>>>16)}static truncDivision(e,t){return Math.trunc(e/t)}static parseInt(e,t=void 0){return parseInt(e,t)}}y.MIN_VALUE_32_BITS=-2147483648,y.MAX_VALUE=Number.MAX_SAFE_INTEGER;class v{constructor(e,t){void 0===e?(this.size=0,this.bits=new Int32Array(1)):(this.size=e,this.bits=null==t?v.makeArray(e):t)}getSize(){return this.size}getSizeInBytes(){return Math.floor((this.size+7)/8)}ensureCapacity(e){if(e>32*this.bits.length){const t=v.makeArray(e);m.arraycopy(this.bits,0,t,0,this.bits.length),this.bits=t}}get(e){return!!(this.bits[Math.floor(e/32)]&1<<(31&e))}set(e){this.bits[Math.floor(e/32)]|=1<<(31&e)}flip(e){this.bits[Math.floor(e/32)]^=1<<(31&e)}getNextSet(e){const t=this.size;if(e>=t)return t;const n=this.bits;let r=Math.floor(e/32),i=n[r];i&=~((1<<(31&e))-1);const o=n.length;for(;0===i;){if(++r===o)return t;i=n[r]}const s=32*r+y.numberOfTrailingZeros(i);return s>t?t:s}getNextUnset(e){const t=this.size;if(e>=t)return t;const n=this.bits;let r=Math.floor(e/32),i=~n[r];i&=~((1<<(31&e))-1);const o=n.length;for(;0===i;){if(++r===o)return t;i=~n[r]}const s=32*r+y.numberOfTrailingZeros(i);return s>t?t:s}setBulk(e,t){this.bits[Math.floor(e/32)]=t}setRange(e,t){if(t<e||e<0||t>this.size)throw new d;if(t===e)return;t--;const n=Math.floor(e/32),r=Math.floor(t/32),i=this.bits;for(let o=n;o<=r;o++){const s=(2<<(o<r?31:31&t))-(1<<(o>n?0:31&e));i[o]|=s}}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 d;if(t===e)return!0;t--;const r=Math.floor(e/32),i=Math.floor(t/32),o=this.bits;for(let s=r;s<=i;s++){const a=(2<<(s<i?31:31&t))-(1<<(s>r?0:31&e))&4294967295;if((o[s]&a)!==(n?a:0))return!1}return!0}appendBit(e){this.ensureCapacity(this.size+1),e&&(this.bits[Math.floor(this.size/32)]|=1<<(31&this.size)),this.size++}appendBits(e,t){if(t<0||t>32)throw new d("Num bits must be between 0 and 32");this.ensureCapacity(this.size+t);for(let n=t;n>0;n--)this.appendBit(1==(e>>n-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 d("Sizes don't match");const t=this.bits;for(let n=0,r=t.length;n<r;n++)t[n]^=e.bits[n]}toBytes(e,t,n,r){for(let i=0;i<r;i++){let r=0;for(let t=0;t<8;t++)this.get(e)&&(r|=1<<7-t),e++;t[n+i]=r}}getBitArray(){return this.bits}reverse(){const e=new Int32Array(this.bits.length),t=Math.floor((this.size-1)/32),n=t+1,r=this.bits;for(let i=0;i<n;i++){let n=r[i];n=n>>1&1431655765|(1431655765&n)<<1,n=n>>2&858993459|(858993459&n)<<2,n=n>>4&252645135|(252645135&n)<<4,n=n>>8&16711935|(16711935&n)<<8,n=n>>16&65535|(65535&n)<<16,e[t-i]=n}if(this.size!==32*n){const t=32*n-this.size;let r=e[0]>>>t;for(let i=1;i<n;i++){const n=e[i];r|=n<<32-t,e[i-1]=r,r=n>>>t}e[n-1]=r}this.bits=e}static makeArray(e){return new Int32Array(Math.floor((e+31)/32))}equals(e){if(!(e instanceof v))return!1;const t=e;return this.size===t.size&&w.equals(this.bits,t.bits)}hashCode(){return 31*this.size+w.hashCode(this.bits)}toString(){let e="";for(let t=0,n=this.size;t<n;t++)7&t||(e+=" "),e+=this.get(t)?"X":".";return e}clone(){return new v(this.size,this.bits.slice())}}!function(e){e[e.OTHER=0]="OTHER",e[e.PURE_BARCODE=1]="PURE_BARCODE",e[e.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",e[e.TRY_HARDER=3]="TRY_HARDER",e[e.CHARACTER_SET=4]="CHARACTER_SET",e[e.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",e[e.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",e[e.ASSUME_GS1=7]="ASSUME_GS1",e[e.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",e[e.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",e[e.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS"}(s||(s={}));var $,I=s;class _ extends l{static getFormatInstance(){return new _}}_.kind="FormatException",function(e){e[e.Cp437=0]="Cp437",e[e.ISO8859_1=1]="ISO8859_1",e[e.ISO8859_2=2]="ISO8859_2",e[e.ISO8859_3=3]="ISO8859_3",e[e.ISO8859_4=4]="ISO8859_4",e[e.ISO8859_5=5]="ISO8859_5",e[e.ISO8859_6=6]="ISO8859_6",e[e.ISO8859_7=7]="ISO8859_7",e[e.ISO8859_8=8]="ISO8859_8",e[e.ISO8859_9=9]="ISO8859_9",e[e.ISO8859_10=10]="ISO8859_10",e[e.ISO8859_11=11]="ISO8859_11",e[e.ISO8859_13=12]="ISO8859_13",e[e.ISO8859_14=13]="ISO8859_14",e[e.ISO8859_15=14]="ISO8859_15",e[e.ISO8859_16=15]="ISO8859_16",e[e.SJIS=16]="SJIS",e[e.Cp1250=17]="Cp1250",e[e.Cp1251=18]="Cp1251",e[e.Cp1252=19]="Cp1252",e[e.Cp1256=20]="Cp1256",e[e.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",e[e.UTF8=22]="UTF8",e[e.ASCII=23]="ASCII",e[e.Big5=24]="Big5",e[e.GB18030=25]="GB18030",e[e.EUC_KR=26]="EUC_KR"}($||($={}));class C{constructor(e,t,n,...r){this.valueIdentifier=e,this.name=n,this.values="number"==typeof t?Int32Array.from([t]):t,this.otherEncodingNames=r,C.VALUE_IDENTIFIER_TO_ECI.set(e,this),C.NAME_TO_ECI.set(n,this);const i=this.values;for(let e=0,t=i.length;e!==t;e++){const t=i[e];C.VALUES_TO_ECI.set(t,this)}for(const e of r)C.NAME_TO_ECI.set(e,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(e){if(e<0||e>=900)throw new _("incorect value");const t=C.VALUES_TO_ECI.get(e);if(void 0===t)throw new _("incorect value");return t}static getCharacterSetECIByName(e){const t=C.NAME_TO_ECI.get(e);if(void 0===t)throw new _("incorect value");return t}equals(e){if(!(e instanceof C))return!1;const t=e;return this.getName()===t.getName()}}C.VALUE_IDENTIFIER_TO_ECI=new Map,C.VALUES_TO_ECI=new Map,C.NAME_TO_ECI=new Map,C.Cp437=new C($.Cp437,Int32Array.from([0,2]),"Cp437"),C.ISO8859_1=new C($.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),C.ISO8859_2=new C($.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),C.ISO8859_3=new C($.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),C.ISO8859_4=new C($.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),C.ISO8859_5=new C($.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),C.ISO8859_6=new C($.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),C.ISO8859_7=new C($.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),C.ISO8859_8=new C($.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),C.ISO8859_9=new C($.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),C.ISO8859_10=new C($.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),C.ISO8859_11=new C($.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),C.ISO8859_13=new C($.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),C.ISO8859_14=new C($.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),C.ISO8859_15=new C($.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),C.ISO8859_16=new C($.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),C.SJIS=new C($.SJIS,20,"SJIS","Shift_JIS"),C.Cp1250=new C($.Cp1250,21,"Cp1250","windows-1250"),C.Cp1251=new C($.Cp1251,22,"Cp1251","windows-1251"),C.Cp1252=new C($.Cp1252,23,"Cp1252","windows-1252"),C.Cp1256=new C($.Cp1256,24,"Cp1256","windows-1256"),C.UnicodeBigUnmarked=new C($.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),C.UTF8=new C($.UTF8,26,"UTF8","UTF-8"),C.ASCII=new C($.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),C.Big5=new C($.Big5,28,"Big5"),C.GB18030=new C($.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),C.EUC_KR=new C($.EUC_KR,30,"EUC_KR","EUC-KR");class E extends l{}E.kind="UnsupportedOperationException";class A{static decode(e,t){const n=this.encodingName(t);return this.customDecoder?this.customDecoder(e,n):"undefined"==typeof TextDecoder||this.shouldDecodeOnFallback(n)?this.decodeFallback(e,n):new TextDecoder(n).decode(e)}static shouldDecodeOnFallback(e){return!A.isBrowser()&&"ISO-8859-1"===e}static encode(e,t){const n=this.encodingName(t);return this.customEncoder?this.customEncoder(e,n):"undefined"==typeof TextEncoder?this.encodeFallback(e):(new TextEncoder).encode(e)}static isBrowser(){return"undefined"!=typeof window&&"[object Window]"==={}.toString.call(window)}static encodingName(e){return"string"==typeof e?e:e.getName()}static encodingCharacterSet(e){return e instanceof C?e:C.getCharacterSetECIByName(e)}static decodeFallback(e,t){const n=this.encodingCharacterSet(t);if(A.isDecodeFallbackSupported(n)){let t="";for(let n=0,r=e.length;n<r;n++){let r=e[n].toString(16);r.length<2&&(r="0"+r),t+="%"+r}return decodeURIComponent(t)}if(n.equals(C.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(e.buffer));throw new E(`Encoding ${this.encodingName(t)} not supported by fallback.`)}static isDecodeFallbackSupported(e){return e.equals(C.UTF8)||e.equals(C.ISO8859_1)||e.equals(C.ASCII)}static encodeFallback(e){const t=btoa(unescape(encodeURIComponent(e))).split(""),n=[];for(let e=0;e<t.length;e++)n.push(t[e].charCodeAt(0));return new Uint8Array(n)}}class b{static castAsNonUtf8Char(e,t=null){const n=t?t.getName():this.ISO88591;return A.decode(new Uint8Array([e]),n)}static guessEncoding(e,t){if(null!=t&&void 0!==t.get(I.CHARACTER_SET))return t.get(I.CHARACTER_SET).toString();const n=e.length;let r=!0,i=!0,o=!0,s=0,a=0,l=0,c=0,d=0,u=0,f=0,h=0,m=0,p=0,g=0;const w=e.length>3&&239===e[0]&&187===e[1]&&191===e[2];for(let t=0;t<n&&(r||i||o);t++){const n=255&e[t];o&&(s>0?128&n?s--:o=!1:128&n&&(64&n?(s++,32&n?(s++,16&n?(s++,8&n?o=!1:c++):l++):a++):o=!1)),r&&(n>127&&n<160?r=!1:n>159&&(n<192||215===n||247===n)&&g++),i&&(d>0?n<64||127===n||n>252?i=!1:d--:128===n||160===n||n>239?i=!1:n>160&&n<224?(u++,h=0,f++,f>m&&(m=f)):n>127?(d++,f=0,h++,h>p&&(p=h)):(f=0,h=0))}return o&&s>0&&(o=!1),i&&d>0&&(i=!1),o&&(w||a+l+c>0)?b.UTF8:i&&(b.ASSUME_SHIFT_JIS||m>=3||p>=3)?b.SHIFT_JIS:r&&i?2===m&&2===u||10*g>=n?b.SHIFT_JIS:b.ISO88591:r?b.ISO88591:i?b.SHIFT_JIS:o?b.UTF8:b.PLATFORM_DEFAULT_ENCODING}static format(e,...t){let n=-1;function r(e,r,i,o,s,a){if("%%"===e)return"%";if(void 0===t[++n])return;e=o?parseInt(o.substr(1)):void 0;let l,c=s?parseInt(s.substr(1)):void 0;switch(a){case"s":l=t[n];break;case"c":l=t[n][0];break;case"f":l=parseFloat(t[n]).toFixed(e);break;case"p":l=parseFloat(t[n]).toPrecision(e);break;case"e":l=parseFloat(t[n]).toExponential(e);break;case"x":l=parseInt(t[n]).toString(c||16);break;case"d":l=parseFloat(parseInt(t[n],c||10).toPrecision(e)).toFixed(0)}l="object"==typeof l?JSON.stringify(l):(+l).toString(c);let d=parseInt(i),u=i&&i[0]+""=="0"?"0":" ";for(;l.length<d;)l=void 0!==r?l+u:u+l;return l}let i=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(i,r)}static getBytes(e,t){return A.encode(e,t)}static getCharCode(e,t=0){return e.charCodeAt(t)}static getCharAt(e){return String.fromCharCode(e)}}b.SHIFT_JIS=C.SJIS.getName(),b.GB2312="GB2312",b.ISO88591=C.ISO8859_1.getName(),b.EUC_JP="EUC_JP",b.UTF8=C.UTF8.getName(),b.PLATFORM_DEFAULT_ENCODING=b.UTF8,b.ASSUME_SHIFT_JIS=!1;class S{constructor(e=""){this.value=e}enableDecoding(e){return this.encoding=e,this}append(e){return"string"==typeof e?this.value+=e.toString():this.encoding?this.value+=b.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 N{constructor(e,t,n,r){if(this.width=e,this.height=t,this.rowSize=n,this.bits=r,null==t&&(t=e),this.height=t,e<1||t<1)throw new d("Both dimensions must be greater than 0");null==n&&(n=Math.floor((e+31)/32)),this.rowSize=n,null==r&&(this.bits=new Int32Array(this.rowSize*this.height))}static parseFromBooleanArray(e){const t=e.length,n=e[0].length,r=new N(n,t);for(let i=0;i<t;i++){const t=e[i];for(let e=0;e<n;e++)t[e]&&r.set(e,i)}return r}static parseFromString(e,t,n){if(null===e)throw new d("stringRepresentation cannot be null");const r=new Array(e.length);let i=0,o=0,s=-1,a=0,l=0;for(;l<e.length;)if("\n"===e.charAt(l)||"\r"===e.charAt(l)){if(i>o){if(-1===s)s=i-o;else if(i-o!==s)throw new d("row lengths do not match");o=i,a++}l++}else if(e.substring(l,l+t.length)===t)l+=t.length,r[i]=!0,i++;else{if(e.substring(l,l+n.length)!==n)throw new d("illegal character encountered: "+e.substring(l));l+=n.length,r[i]=!1,i++}if(i>o){if(-1===s)s=i-o;else if(i-o!==s)throw new d("row lengths do not match");a++}const c=new N(s,a);for(let e=0;e<i;e++)r[e]&&c.set(Math.floor(e%s),Math.floor(e/s));return c}get(e,t){const n=t*this.rowSize+Math.floor(e/32);return!!(this.bits[n]>>>(31&e)&1)}set(e,t){const n=t*this.rowSize+Math.floor(e/32);this.bits[n]|=1<<(31&e)&4294967295}unset(e,t){const n=t*this.rowSize+Math.floor(e/32);this.bits[n]&=~(1<<(31&e)&4294967295)}flip(e,t){const n=t*this.rowSize+Math.floor(e/32);this.bits[n]^=1<<(31&e)&4294967295}xor(e){if(this.width!==e.getWidth()||this.height!==e.getHeight()||this.rowSize!==e.getRowSize())throw new d("input matrix dimensions do not match");const t=new v(Math.floor(this.width/32)+1),n=this.rowSize,r=this.bits;for(let i=0,o=this.height;i<o;i++){const o=i*n,s=e.getRow(i,t).getBitArray();for(let e=0;e<n;e++)r[o+e]^=s[e]}}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 d("Left and top must be nonnegative");if(r<1||n<1)throw new d("Height and width must be at least 1");const i=e+n,o=t+r;if(o>this.height||i>this.width)throw new d("The region must fit inside the matrix");const s=this.rowSize,a=this.bits;for(let n=t;n<o;n++){const t=n*s;for(let n=e;n<i;n++)a[t+Math.floor(n/32)]|=1<<(31&n)&4294967295}}getRow(e,t){null==t||t.getSize()<this.width?t=new v(this.width):t.clear();const n=this.rowSize,r=this.bits,i=e*n;for(let e=0;e<n;e++)t.setBulk(32*e,r[i+e]);return t}setRow(e,t){m.arraycopy(t.getBitArray(),0,this.bits,e*this.rowSize,this.rowSize)}rotate180(){const e=this.getWidth(),t=this.getHeight();let n=new v(e),r=new v(e);for(let e=0,i=Math.floor((t+1)/2);e<i;e++)n=this.getRow(e,n),r=this.getRow(t-1-e,r),n.reverse(),r.reverse(),this.setRow(e,r),this.setRow(t-1-e,n)}getEnclosingRectangle(){const e=this.width,t=this.height,n=this.rowSize,r=this.bits;let i=e,o=t,s=-1,a=-1;for(let e=0;e<t;e++)for(let t=0;t<n;t++){const l=r[e*n+t];if(0!==l){if(e<o&&(o=e),e>a&&(a=e),32*t<i){let e=0;for(;!(l<<31-e&4294967295);)e++;32*t+e<i&&(i=32*t+e)}if(32*t+31>s){let e=31;for(;l>>>e===0;)e--;32*t+e>s&&(s=32*t+e)}}}return s<i||a<o?null:Int32Array.from([i,o,s-i+1,a-o+1])}getTopLeftOnBit(){const e=this.rowSize,t=this.bits;let n=0;for(;n<t.length&&0===t[n];)n++;if(n===t.length)return null;const r=n/e;let i=n%e*32;const o=t[n];let s=0;for(;!(o<<31-s&4294967295);)s++;return i+=s,Int32Array.from([i,r])}getBottomRightOnBit(){const e=this.rowSize,t=this.bits;let n=t.length-1;for(;n>=0&&0===t[n];)n--;if(n<0)return null;const r=Math.floor(n/e);let i=32*Math.floor(n%e);const o=t[n];let s=31;for(;o>>>s===0;)s--;return i+=s,Int32Array.from([i,r])}getWidth(){return this.width}getHeight(){return this.height}getRowSize(){return this.rowSize}equals(e){if(!(e instanceof N))return!1;const t=e;return this.width===t.width&&this.height===t.height&&this.rowSize===t.rowSize&&w.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+w.hashCode(this.bits),e}toString(e="X ",t=" ",n="\n"){return this.buildToString(e,t,n)}buildToString(e,t,n){let r=new S;for(let i=0,o=this.height;i<o;i++){for(let n=0,o=this.width;n<o;n++)r.append(this.get(n,i)?e:t);r.append(n)}return r.toString()}clone(){return new N(this.width,this.height,this.rowSize,this.bits.slice())}}class T extends l{static getNotFoundInstance(){return new T}}T.kind="NotFoundException";class R extends h{constructor(e){super(e),this.luminances=R.EMPTY,this.buckets=new Int32Array(R.LUMINANCE_BUCKETS)}getBlackRow(e,t){const n=this.getLuminanceSource(),r=n.getWidth();null==t||t.getSize()<r?t=new v(r):t.clear(),this.initArrays(r);const i=n.getRow(e,this.luminances),o=this.buckets;for(let e=0;e<r;e++)o[(255&i[e])>>R.LUMINANCE_SHIFT]++;const s=R.estimateBlackPoint(o);if(r<3)for(let e=0;e<r;e++)(255&i[e])<s&&t.set(e);else{let e=255&i[0],n=255&i[1];for(let o=1;o<r-1;o++){const r=255&i[o+1];(4*n-e-r)/2<s&&t.set(o),e=n,n=r}}return t}getBlackMatrix(){const e=this.getLuminanceSource(),t=e.getWidth(),n=e.getHeight(),r=new N(t,n);this.initArrays(t);const i=this.buckets;for(let r=1;r<5;r++){const o=Math.floor(n*r/5),s=e.getRow(o,this.luminances),a=Math.floor(4*t/5);for(let e=Math.floor(t/5);e<a;e++)i[(255&s[e])>>R.LUMINANCE_SHIFT]++}const o=R.estimateBlackPoint(i),s=e.getMatrix();for(let e=0;e<n;e++){const n=e*t;for(let i=0;i<t;i++)(255&s[n+i])<o&&r.set(i,e)}return r}createBinarizer(e){return new R(e)}initArrays(e){this.luminances.length<e&&(this.luminances=new Uint8ClampedArray(e));const t=this.buckets;for(let e=0;e<R.LUMINANCE_BUCKETS;e++)t[e]=0}static estimateBlackPoint(e){const t=e.length;let n=0,r=0,i=0;for(let o=0;o<t;o++)e[o]>i&&(r=o,i=e[o]),e[o]>n&&(n=e[o]);let o=0,s=0;for(let n=0;n<t;n++){const t=n-r,i=e[n]*t*t;i>s&&(o=n,s=i)}if(r>o){const e=r;r=o,o=e}if(o-r<=t/16)throw new T;let a=o-1,l=-1;for(let t=o-1;t>r;t--){const i=t-r,s=i*i*(o-t)*(n-e[t]);s>l&&(a=t,l=s)}return a<<R.LUMINANCE_SHIFT}}R.LUMINANCE_BITS=5,R.LUMINANCE_SHIFT=8-R.LUMINANCE_BITS,R.LUMINANCE_BUCKETS=1<<R.LUMINANCE_BITS,R.EMPTY=Uint8ClampedArray.from([0]);class D extends R{constructor(e){super(e),this.matrix=null}getBlackMatrix(){if(null!==this.matrix)return this.matrix;const e=this.getLuminanceSource(),t=e.getWidth(),n=e.getHeight();if(t>=D.MINIMUM_DIMENSION&&n>=D.MINIMUM_DIMENSION){const r=e.getMatrix();let i=t>>D.BLOCK_SIZE_POWER;0!==(t&D.BLOCK_SIZE_MASK)&&i++;let o=n>>D.BLOCK_SIZE_POWER;0!==(n&D.BLOCK_SIZE_MASK)&&o++;const s=D.calculateBlackPoints(r,i,o,t,n),a=new N(t,n);D.calculateThresholdForBlock(r,i,o,t,n,s,a),this.matrix=a}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(e){return new D(e)}static calculateThresholdForBlock(e,t,n,r,i,o,s){const a=i-D.BLOCK_SIZE,l=r-D.BLOCK_SIZE;for(let i=0;i<n;i++){let c=i<<D.BLOCK_SIZE_POWER;c>a&&(c=a);const d=D.cap(i,2,n-3);for(let n=0;n<t;n++){let i=n<<D.BLOCK_SIZE_POWER;i>l&&(i=l);const a=D.cap(n,2,t-3);let u=0;for(let e=-2;e<=2;e++){const t=o[d+e];u+=t[a-2]+t[a-1]+t[a]+t[a+1]+t[a+2]}const f=u/25;D.thresholdBlock(e,i,c,f,r,s)}}}static cap(e,t,n){return e<t?t:e>n?n:e}static thresholdBlock(e,t,n,r,i,o){for(let s=0,a=n*i+t;s<D.BLOCK_SIZE;s++,a+=i)for(let i=0;i<D.BLOCK_SIZE;i++)(255&e[a+i])<=r&&o.set(t+i,n+s)}static calculateBlackPoints(e,t,n,r,i){const o=i-D.BLOCK_SIZE,s=r-D.BLOCK_SIZE,a=new Array(n);for(let i=0;i<n;i++){a[i]=new Int32Array(t);let n=i<<D.BLOCK_SIZE_POWER;n>o&&(n=o);for(let o=0;o<t;o++){let t=o<<D.BLOCK_SIZE_POWER;t>s&&(t=s);let l=0,c=255,d=0;for(let i=0,o=n*r+t;i<D.BLOCK_SIZE;i++,o+=r){for(let t=0;t<D.BLOCK_SIZE;t++){const n=255&e[o+t];l+=n,n<c&&(c=n),n>d&&(d=n)}if(d-c>D.MIN_DYNAMIC_RANGE)for(i++,o+=r;i<D.BLOCK_SIZE;i++,o+=r)for(let t=0;t<D.BLOCK_SIZE;t++)l+=255&e[o+t]}let u=l>>2*D.BLOCK_SIZE_POWER;if(d-c<=D.MIN_DYNAMIC_RANGE&&(u=c/2,i>0&&o>0)){const e=(a[i-1][o]+2*a[i][o-1]+a[i-1][o-1])/4;c<e&&(u=e)}a[i][o]=u}}return a}}D.BLOCK_SIZE_POWER=3,D.BLOCK_SIZE=1<<D.BLOCK_SIZE_POWER,D.BLOCK_SIZE_MASK=D.BLOCK_SIZE-1,D.MINIMUM_DIMENSION=5*D.BLOCK_SIZE,D.MIN_DYNAMIC_RANGE=24;class x{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 E("This luminance source does not support cropping.")}isRotateSupported(){return!1}rotateCounterClockwise(){throw new E("This luminance source does not support rotation by 90 degrees.")}rotateCounterClockwise45(){throw new E("This luminance source does not support rotation by 45 degrees.")}toString(){const e=new Uint8ClampedArray(this.width);let t=new S;for(let n=0;n<this.height;n++){const r=this.getRow(n,e);for(let e=0;e<this.width;e++){const n=255&r[e];let i;i=n<64?"#":n<128?"+":n<192?".":" ",t.append(i)}t.append("\n")}return t.toString()}}class k extends x{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 e=0;e<r;e++)n[e]=255-(255&n[e]);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-(255&e[r]);return n}isCropSupported(){return this.delegate.isCropSupported()}crop(e,t,n,r){return new k(this.delegate.crop(e,t,n,r))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new k(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new k(this.delegate.rotateCounterClockwise45())}}class O extends x{constructor(e){super(e.width,e.height),this.canvas=e,this.tempCanvasElement=null,this.buffer=O.makeBufferFromCanvasImageData(e)}static makeBufferFromCanvasImageData(e){const t=e.getContext("2d").getImageData(0,0,e.width,e.height);return O.toGrayscaleBuffer(t.data,e.width,e.height)}static toGrayscaleBuffer(e,t,n){const r=new Uint8ClampedArray(t*n);for(let t=0,n=0,i=e.length;t<i;t+=4,n++){let i;i=0===e[t+3]?255:306*e[t]+601*e[t+1]+117*e[t+2]+512>>10,r[n]=i}return r}getRow(e,t){if(e<0||e>=this.getHeight())throw new d("Requested row is outside the image: "+e);const n=this.getWidth(),r=e*n;return null===t?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(null===this.tempCanvasElement){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*O.DEGREE_TO_RADIANS,i=this.canvas.width,o=this.canvas.height,s=Math.ceil(Math.abs(Math.cos(r))*i+Math.abs(Math.sin(r))*o),a=Math.ceil(Math.abs(Math.sin(r))*i+Math.abs(Math.cos(r))*o);return t.width=s,t.height=a,n.translate(s/2,a/2),n.rotate(r),n.drawImage(this.canvas,i/-2,o/-2),this.buffer=O.makeBufferFromCanvasImageData(t),this}invert(){return new k(this)}}O.DEGREE_TO_RADIANS=Math.PI/180;class M{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 P,B=(globalThis||af||self||window?(globalThis||af||self||window||void 0).__awaiter:void 0)||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?n(e.value):i(e.value).then(s,a)}l((r=r.apply(e,t||[])).next())})};class L{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"undefined"!=typeof navigator}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 B(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 e="video"===n.kind?"videoinput":n.kind;if("videoinput"!==e)continue;const r={deviceId:n.deviceId||n.id,label:n.label||`Video device ${t.length+1}`,kind:e,groupId:n.groupId};t.push(r)}return t})}getVideoInputDevices(){return B(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(e=>new M(e.deviceId,e.label))})}findDeviceById(e){return B(this,void 0,void 0,function*(){const t=yield this.listVideoInputDevices();return t?t.find(t=>t.deviceId===e):null})}decodeFromInputVideoDevice(e,t){return B(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(e,t)})}decodeOnceFromVideoDevice(e,t){return B(this,void 0,void 0,function*(){let n;this.reset(),n=e?{deviceId:{exact:e}}:{facingMode:"environment"};const r={video:n};return yield this.decodeOnceFromConstraints(r,t)})}decodeOnceFromConstraints(e,t){return B(this,void 0,void 0,function*(){const n=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeOnceFromStream(n,t)})}decodeOnceFromStream(e,t){return B(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 B(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(e,t,n)})}decodeFromVideoDevice(e,t,n){return B(this,void 0,void 0,function*(){let r;r=e?{deviceId:{exact:e}}:{facingMode:"environment"};const i={video:r};return yield this.decodeFromConstraints(i,t,n)})}decodeFromConstraints(e,t,n){return B(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 B(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 B(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 B(this,void 0,void 0,function*(){if(this.isVideoPlaying(e))console.warn("Trying to play video that is already playing.");else try{yield e.play()}catch(e){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(void 0===e&&void 0===t)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);let n;return this.imageElement=t,n=this.isImageLoaded(t)?this.decodeOnce(t,!1,!0):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 B(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(e),yield this.decodeOnce(e)})}_decodeOnLoadVideoContinuously(e,t){return B(this,void 0,void 0,function*(){yield this.playVideoOnLoadAsync(e),this.decodeContinuously(e,t)})}isImageLoaded(e){return!!e.complete&&0!==e.naturalWidth}prepareImageElement(e){let t;return void 0===e&&(t=document.createElement("img"),t.width=200,t.height=200),"string"==typeof e&&(t=this.getMediaElement(e,"img")),e instanceof HTMLImageElement&&(t=e),t}prepareVideoElement(e){let t;return e||"undefined"==typeof document||(t=document.createElement("video"),t.width=200,t.height=200),"string"==typeof e&&(t=this.getMediaElement(e,"video")),e instanceof HTMLVideoElement&&(t=e),t.setAttribute("autoplay","true"),t.setAttribute("muted","true"),t.setAttribute("playsinline","true"),t}decodeOnce(e,t=!0,n=!0){this._stopAsyncDecode=!1;const r=(i,o)=>{if(this._stopAsyncDecode)return o(new T("Video stream has ended before any code could be detected.")),void(this._stopAsyncDecode=void 0);try{i(this.decode(e))}catch(e){if(t&&e instanceof T||(e instanceof f||e instanceof _)&&n)return setTimeout(r,this._timeBetweenDecodingAttempts,i,o);o(e)}};return new Promise((e,t)=>r(e,t))}decodeContinuously(e,t){this._stopContinuousDecode=!1;const n=()=>{if(this._stopContinuousDecode)this._stopContinuousDecode=void 0;else try{const r=this.decode(e);t(r,null),setTimeout(n,this.timeBetweenScansMillis)}catch(e){t(null,e),(e instanceof f||e instanceof _||e instanceof T)&&setTimeout(n,this._timeBetweenDecodingAttempts)}};n()}decode(e){const t=this.createBinaryBitmap(e);return this.decodeBitmap(t)}_isHTMLVideoElement(e){return 0!==e.videoWidth}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 O(t),r=new D(n);return new u(r)}getCaptureCanvasContext(e){if(!this.captureCanvasContext){const t=this.getCaptureCanvas(e).getContext("2d");this.captureCanvasContext=t}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("undefined"==typeof document)return this._destroyCaptureCanvas(),null;const t=document.createElement("canvas");let n,r;return void 0!==e&&(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),!1===this._stopAsyncDecode&&this.stopAsyncDecode(),!1===this._stopContinuousDecode&&this.stopContinuousDecode()}reset(){this.stopStreams(),this._destroyVideoElement(),this._destroyImageElement(),this._destroyCaptureCanvas()}_destroyVideoElement(){this.videoElement&&(void 0!==this.videoEndedListener&&this.videoElement.removeEventListener("ended",this.videoEndedListener),void 0!==this.videoPlayingEventListener&&this.videoElement.removeEventListener("playing",this.videoPlayingEventListener),void 0!==this.videoCanPlayListener&&this.videoElement.removeEventListener("loadedmetadata",this.videoCanPlayListener),this.cleanVideoSource(this.videoElement),this.videoElement=void 0)}_destroyImageElement(){this.imageElement&&(void 0!==this.imageLoadedListener&&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(n){e.src=URL.createObjectURL(t)}}cleanVideoSource(e){try{e.srcObject=null}catch(t){e.src=""}this.videoElement.removeAttribute("src")}}class F{constructor(e,t,n=(null==t?0:8*t.length),r,i,o=m.currentTimeMillis()){this.text=e,this.rawBytes=t,this.numBits=n,this.resultPoints=r,this.format=i,this.timestamp=o,this.text=e,this.rawBytes=t,this.numBits=null==n?null==t?0:8*t.length:n,this.resultPoints=r,this.format=i,this.resultMetadata=null,this.timestamp=null==o?m.currentTimeMillis():o}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){null===this.resultMetadata&&(this.resultMetadata=new Map),this.resultMetadata.set(e,t)}putAllMetadata(e){null!==e&&(null===this.resultMetadata?this.resultMetadata=e:this.resultMetadata=new Map(e))}addResultPoints(e){const t=this.resultPoints;if(null===t)this.resultPoints=e;else if(null!==e&&e.length>0){const n=new Array(t.length+e.length);m.arraycopy(t,0,n,0,t.length),m.arraycopy(e,0,n,t.length,e.length),this.resultPoints=n}}getTimestamp(){return this.timestamp}toString(){return this.text}}!function(e){e[e.AZTEC=0]="AZTEC",e[e.CODABAR=1]="CODABAR",e[e.CODE_39=2]="CODE_39",e[e.CODE_93=3]="CODE_93",e[e.CODE_128=4]="CODE_128",e[e.DATA_MATRIX=5]="DATA_MATRIX",e[e.EAN_8=6]="EAN_8",e[e.EAN_13=7]="EAN_13",e[e.ITF=8]="ITF",e[e.MAXICODE=9]="MAXICODE",e[e.PDF_417=10]="PDF_417",e[e.QR_CODE=11]="QR_CODE",e[e.RSS_14=12]="RSS_14",e[e.RSS_EXPANDED=13]="RSS_EXPANDED",e[e.UPC_A=14]="UPC_A",e[e.UPC_E=15]="UPC_E",e[e.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"}(P||(P={}));var V,U=P;!function(e){e[e.OTHER=0]="OTHER",e[e.ORIENTATION=1]="ORIENTATION",e[e.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",e[e.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",e[e.ISSUE_NUMBER=4]="ISSUE_NUMBER",e[e.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",e[e.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",e[e.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",e[e.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",e[e.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",e[e.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY"}(V||(V={}));var W,z,H,j,q,G,X=V;class Y{constructor(e,t,n,r,i=-1,o=-1){this.rawBytes=e,this.text=t,this.byteSegments=n,this.ecLevel=r,this.structuredAppendSequenceNumber=i,this.structuredAppendParity=o,this.numBits=null==e?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 Z{exp(e){return this.expTable[e]}log(e){if(0===e)throw new d;return this.logTable[e]}static addOrSubtract(e,t){return e^t}}class K{constructor(e,t){if(0===t.length)throw new d;this.field=e;const n=t.length;if(n>1&&0===t[0]){let e=1;for(;e<n&&0===t[e];)e++;e===n?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(n-e),m.arraycopy(t,e,this.coefficients,0,this.coefficients.length))}else this.coefficients=t}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return 0===this.coefficients[0]}getCoefficient(e){return this.coefficients[this.coefficients.length-1-e]}evaluateAt(e){if(0===e)return this.getCoefficient(0);const t=this.coefficients;let n;if(1===e){n=0;for(let e=0,r=t.length;e!==r;e++){const r=t[e];n=Z.addOrSubtract(n,r)}return n}n=t[0];const r=t.length,i=this.field;for(let o=1;o<r;o++)n=Z.addOrSubtract(i.multiply(e,n),t[o]);return n}addOrSubtract(e){if(!this.field.equals(e.field))throw new d("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 e=t;t=n,n=e}let r=new Int32Array(n.length);const i=n.length-t.length;m.arraycopy(n,0,r,0,i);for(let e=i;e<n.length;e++)r[e]=Z.addOrSubtract(t[e-i],n[e]);return new K(this.field,r)}multiply(e){if(!this.field.equals(e.field))throw new d("GenericGFPolys do not have same GenericGF field");if(this.isZero()||e.isZero())return this.field.getZero();const t=this.coefficients,n=t.length,r=e.coefficients,i=r.length,o=new Int32Array(n+i-1),s=this.field;for(let e=0;e<n;e++){const n=t[e];for(let t=0;t<i;t++)o[e+t]=Z.addOrSubtract(o[e+t],s.multiply(n,r[t]))}return new K(s,o)}multiplyScalar(e){if(0===e)return this.field.getZero();if(1===e)return this;const t=this.coefficients.length,n=this.field,r=new Int32Array(t),i=this.coefficients;for(let o=0;o<t;o++)r[o]=n.multiply(i[o],e);return new K(n,r)}multiplyByMonomial(e,t){if(e<0)throw new d;if(0===t)return this.field.getZero();const n=this.coefficients,r=n.length,i=new Int32Array(r+e),o=this.field;for(let e=0;e<r;e++)i[e]=o.multiply(n[e],t);return new K(o,i)}divide(e){if(!this.field.equals(e.field))throw new d("GenericGFPolys do not have same GenericGF field");if(e.isZero())throw new d("Divide by 0");const t=this.field;let n=t.getZero(),r=this;const i=e.getCoefficient(e.getDegree()),o=t.inverse(i);for(;r.getDegree()>=e.getDegree()&&!r.isZero();){const i=r.getDegree()-e.getDegree(),s=t.multiply(r.getCoefficient(r.getDegree()),o),a=e.multiplyByMonomial(i,s),l=t.buildMonomial(i,s);n=n.addOrSubtract(l),r=r.addOrSubtract(a)}return[n,r]}toString(){let e="";for(let t=this.getDegree();t>=0;t--){let n=this.getCoefficient(t);if(0!==n){if(n<0?(e+=" - ",n=-n):e.length>0&&(e+=" + "),0===t||1!==n){const t=this.field.log(n);0===t?e+="1":1===t?e+="a":(e+="a^",e+=t)}0!==t&&(1===t?e+="x":(e+="x^",e+=t))}}return e}}class Q extends l{}Q.kind="ArithmeticException";class J extends Z{constructor(e,t,n){super(),this.primitive=e,this.size=t,this.generatorBase=n;const r=new Int32Array(t);let i=1;for(let n=0;n<t;n++)r[n]=i,i*=2,i>=t&&(i^=e,i&=t-1);this.expTable=r;const o=new Int32Array(t);for(let e=0;e<t-1;e++)o[r[e]]=e;this.logTable=o,this.zero=new K(this,Int32Array.from([0])),this.one=new K(this,Int32Array.from([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new d;if(0===t)return this.zero;const n=new Int32Array(e+1);return n[0]=t,new K(this,n)}inverse(e){if(0===e)throw new Q;return this.expTable[this.size-this.logTable[e]-1]}multiply(e,t){return 0===e||0===t?0:this.expTable[(this.logTable[e]+this.logTable[t])%(this.size-1)]}getSize(){return this.size}getGeneratorBase(){return this.generatorBase}toString(){return"GF(0x"+y.toHexString(this.primitive)+","+this.size+")"}equals(e){return e===this}}J.AZTEC_DATA_12=new J(4201,4096,1),J.AZTEC_DATA_10=new J(1033,1024,1),J.AZTEC_DATA_6=new J(67,64,1),J.AZTEC_PARAM=new J(19,16,1),J.QR_CODE_FIELD_256=new J(285,256,0),J.DATA_MATRIX_FIELD_256=new J(301,256,1),J.AZTEC_DATA_8=J.DATA_MATRIX_FIELD_256,J.MAXICODE_FIELD_64=J.AZTEC_DATA_6;class ee extends l{}ee.kind="ReedSolomonException";class te extends l{}te.kind="IllegalStateException";class ne{constructor(e){this.field=e}decode(e,t){const n=this.field,r=new K(n,e),i=new Int32Array(t);let o=!0;for(let e=0;e<t;e++){const t=r.evaluateAt(n.exp(e+n.getGeneratorBase()));i[i.length-1-e]=t,0!==t&&(o=!1)}if(o)return;const s=new K(n,i),a=this.runEuclideanAlgorithm(n.buildMonomial(t,1),s,t),l=a[0],c=a[1],d=this.findErrorLocations(l),u=this.findErrorMagnitudes(c,d);for(let t=0;t<d.length;t++){const r=e.length-1-n.log(d[t]);if(r<0)throw new ee("Bad error location");e[r]=J.addOrSubtract(e[r],u[t])}}runEuclideanAlgorithm(e,t,n){if(e.getDegree()<t.getDegree()){const n=e;e=t,t=n}const r=this.field;let i=e,o=t,s=r.getZero(),a=r.getOne();for(;o.getDegree()>=(n/2|0);){let e=i,t=s;if(i=o,s=a,i.isZero())throw new ee("r_{i-1} was zero");o=e;let n=r.getZero();const l=i.getCoefficient(i.getDegree()),c=r.inverse(l);for(;o.getDegree()>=i.getDegree()&&!o.isZero();){const e=o.getDegree()-i.getDegree(),t=r.multiply(o.getCoefficient(o.getDegree()),c);n=n.addOrSubtract(r.buildMonomial(e,t)),o=o.addOrSubtract(i.multiplyByMonomial(e,t))}if(a=n.multiply(s).addOrSubtract(t),o.getDegree()>=i.getDegree())throw new te("Division algorithm failed to reduce polynomial?")}const l=a.getCoefficient(0);if(0===l)throw new ee("sigmaTilde(0) was zero");const c=r.inverse(l);return[a.multiplyScalar(c),o.multiplyScalar(c)]}findErrorLocations(e){const t=e.getDegree();if(1===t)return Int32Array.from([e.getCoefficient(1)]);const n=new Int32Array(t);let r=0;const i=this.field;for(let o=1;o<i.getSize()&&r<t;o++)0===e.evaluateAt(o)&&(n[r]=i.inverse(o),r++);if(r!==t)throw new ee("Error locator degree does not match number of roots");return n}findErrorMagnitudes(e,t){const n=t.length,r=new Int32Array(n),i=this.field;for(let o=0;o<n;o++){const s=i.inverse(t[o]);let a=1;for(let e=0;e<n;e++)if(o!==e){const n=i.multiply(t[e],s),r=1&n?-2&n:1|n;a=i.multiply(a,r)}r[o]=i.multiply(e.evaluateAt(s),i.inverse(a)),0!==i.getGeneratorBase()&&(r[o]=i.multiply(r[o],s))}return r}}!function(e){e[e.UPPER=0]="UPPER",e[e.LOWER=1]="LOWER",e[e.MIXED=2]="MIXED",e[e.DIGIT=3]="DIGIT",e[e.PUNCT=4]="PUNCT",e[e.BINARY=5]="BINARY"}(W||(W={}));class re{decode(e){this.ddata=e;let t=e.getBits(),n=this.extractBits(t),r=this.correctBits(n),i=re.convertBoolArrayToByteArray(r),o=re.getEncodedData(r),s=new Y(i,o,null,null);return s.setNumBits(r.length),s}static highLevelDecode(e){return this.getEncodedData(e)}static getEncodedData(e){let t=e.length,n=W.UPPER,r=W.UPPER,i="",o=0;for(;o<t;)if(r===W.BINARY){if(t-o<5)break;let s=re.readCode(e,o,5);if(o+=5,0===s){if(t-o<11)break;s=re.readCode(e,o,11)+31,o+=11}for(let n=0;n<s;n++){if(t-o<8){o=t;break}const n=re.readCode(e,o,8);i+=b.castAsNonUtf8Char(n),o+=8}r=n}else{let s=r===W.DIGIT?4:5;if(t-o<s)break;let a=re.readCode(e,o,s);o+=s;let l=re.getCharacter(r,a);l.startsWith("CTRL_")?(n=r,r=re.getTable(l.charAt(5)),"L"===l.charAt(6)&&(n=r)):(i+=l,r=n)}return i}static getTable(e){switch(e){case"L":return W.LOWER;case"P":return W.PUNCT;case"M":return W.MIXED;case"D":return W.DIGIT;case"B":return W.BINARY;default:return W.UPPER}}static getCharacter(e,t){switch(e){case W.UPPER:return re.UPPER_TABLE[t];case W.LOWER:return re.LOWER_TABLE[t];case W.MIXED:return re.MIXED_TABLE[t];case W.PUNCT:return re.PUNCT_TABLE[t];case W.DIGIT:return re.DIGIT_TABLE[t];default:throw new te("Bad table")}}correctBits(e){let t,n;this.ddata.getNbLayers()<=2?(n=6,t=J.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(n=8,t=J.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(n=10,t=J.AZTEC_DATA_10):(n=12,t=J.AZTEC_DATA_12);let r=this.ddata.getNbDatablocks(),i=e.length/n;if(i<r)throw new _;let o=e.length%n,s=new Int32Array(i);for(let t=0;t<i;t++,o+=n)s[t]=re.readCode(e,o,n);try{new ne(t).decode(s,i-r)}catch(e){throw new _(e)}let a=(1<<n)-1,l=0;for(let e=0;e<r;e++){let t=s[e];if(0===t||t===a)throw new _;1!==t&&t!==a-1||l++}let c=new Array(r*n-l),d=0;for(let e=0;e<r;e++){let t=s[e];if(1===t||t===a-1)c.fill(t>1,d,d+n-1),d+=n-1;else for(let e=n-1;e>=0;--e)c[d++]=!!(t&1<<e)}return c}extractBits(e){let t=this.ddata.isCompact(),n=this.ddata.getNbLayers(),r=(t?11:14)+4*n,i=new Int32Array(r),o=new Array(this.totalBitsInLayer(n,t));if(t)for(let e=0;e<i.length;e++)i[e]=e;else{let e=r+1+2*y.truncDivision(y.truncDivision(r,2)-1,15),t=r/2,n=y.truncDivision(e,2);for(let e=0;e<t;e++){let r=e+y.truncDivision(e,15);i[t-e-1]=n-r-1,i[t+e]=n+r+1}}for(let s=0,a=0;s<n;s++){let l=4*(n-s)+(t?9:12),c=2*s,d=r-1-c;for(let t=0;t<l;t++){let n=2*t;for(let r=0;r<2;r++)o[a+n+r]=e.get(i[c+r],i[c+t]),o[a+2*l+n+r]=e.get(i[c+t],i[d-r]),o[a+4*l+n+r]=e.get(i[d-r],i[d-t]),o[a+6*l+n+r]=e.get(i[d-t],i[c+r])}a+=8*l}return o}static readCode(e,t,n){let r=0;for(let i=t;i<t+n;i++)r<<=1,e[i]&&(r|=1);return r}static readByte(e,t){let n=e.length-t;return n>=8?re.readCode(e,t,8):re.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]=re.readByte(e,8*n);return t}totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}re.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"],re.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"],re.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b","\t","\n","\\13","\f","\r","\\33","\\34","\\35","\\36","\\37","@","\\","^","_","`","|","~","\\177","CTRL_LL","CTRL_UL","CTRL_PL","CTRL_BS"],re.PUNCT_TABLE=["","\r","\r\n",". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],re.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class ie{constructor(){}static round(e){return NaN===e?0:e<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:e>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:e+(e<0?-.5:.5)|0}static distance(e,t,n,r){const i=e-n,o=t-r;return Math.sqrt(i*i+o*o)}static sum(e){let t=0;for(let n=0,r=e.length;n!==r;n++)t+=e[n];return t}}class oe{static floatToIntBits(e){return e}}oe.MAX_VALUE=Number.MAX_SAFE_INTEGER;class se{constructor(e,t){this.x=e,this.y=t}getX(){return this.x}getY(){return this.y}equals(e){if(e instanceof se){const t=e;return this.x===t.x&&this.y===t.y}return!1}hashCode(){return 31*oe.floatToIntBits(this.x)+oe.floatToIntBits(this.y)}toString(){return"("+this.x+","+this.y+")"}static orderBestPatterns(e){const t=this.distance(e[0],e[1]),n=this.distance(e[1],e[2]),r=this.distance(e[0],e[2]);let i,o,s;if(n>=t&&n>=r?(o=e[0],i=e[1],s=e[2]):r>=n&&r>=t?(o=e[1],i=e[0],s=e[2]):(o=e[2],i=e[0],s=e[1]),this.crossProductZ(i,o,s)<0){const e=i;i=s,s=e}e[0]=i,e[1]=o,e[2]=s}static distance(e,t){return ie.distance(e.x,e.y,t.x,t.y)}static crossProductZ(e,t,n){const r=t.x,i=t.y;return(n.x-r)*(e.y-i)-(n.y-i)*(e.x-r)}}class ae{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class le extends ae{constructor(e,t,n,r,i){super(e,t),this.compact=n,this.nbDatablocks=r,this.nbLayers=i}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class ce{constructor(e,t,n,r){this.image=e,this.height=e.getHeight(),this.width=e.getWidth(),null==t&&(t=ce.INIT_SIZE),null==n&&(n=e.getWidth()/2|0),null==r&&(r=e.getHeight()/2|0);const i=t/2|0;if(this.leftInit=n-i,this.rightInit=n+i,this.upInit=r-i,this.downInit=r+i,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new T}detect(){let e=this.leftInit,t=this.rightInit,n=this.upInit,r=this.downInit,i=!1,o=!0,s=!1,a=!1,l=!1,c=!1,d=!1;const u=this.width,f=this.height;for(;o;){o=!1;let h=!0;for(;(h||!a)&&t<u;)h=this.containsBlackPoint(n,r,t,!1),h?(t++,o=!0,a=!0):a||t++;if(t>=u){i=!0;break}let m=!0;for(;(m||!l)&&r<f;)m=this.containsBlackPoint(e,t,r,!0),m?(r++,o=!0,l=!0):l||r++;if(r>=f){i=!0;break}let p=!0;for(;(p||!c)&&e>=0;)p=this.containsBlackPoint(n,r,e,!1),p?(e--,o=!0,c=!0):c||e--;if(e<0){i=!0;break}let g=!0;for(;(g||!d)&&n>=0;)g=this.containsBlackPoint(e,t,n,!0),g?(n--,o=!0,d=!0):d||n--;if(n<0){i=!0;break}o&&(s=!0)}if(!i&&s){const i=t-e;let o=null;for(let t=1;null===o&&t<i;t++)o=this.getBlackPointOnSegment(e,r-t,e+t,r);if(null==o)throw new T;let s=null;for(let t=1;null===s&&t<i;t++)s=this.getBlackPointOnSegment(e,n+t,e+t,n);if(null==s)throw new T;let a=null;for(let e=1;null===a&&e<i;e++)a=this.getBlackPointOnSegment(t,n+e,t-e,n);if(null==a)throw new T;let l=null;for(let e=1;null===l&&e<i;e++)l=this.getBlackPointOnSegment(t,r-e,t-e,r);if(null==l)throw new T;return this.centerEdges(l,o,a,s)}throw new T}getBlackPointOnSegment(e,t,n,r){const i=ie.round(ie.distance(e,t,n,r)),o=(n-e)/i,s=(r-t)/i,a=this.image;for(let n=0;n<i;n++){const r=ie.round(e+n*o),i=ie.round(t+n*s);if(a.get(r,i))return new se(r,i)}return null}centerEdges(e,t,n,r){const i=e.getX(),o=e.getY(),s=t.getX(),a=t.getY(),l=n.getX(),c=n.getY(),d=r.getX(),u=r.getY(),f=ce.CORR;return i<this.width/2?[new se(d-f,u+f),new se(s+f,a+f),new se(l-f,c-f),new se(i+f,o-f)]:[new se(d+f,u+f),new se(s+f,a-f),new se(l-f,c+f),new se(i-f,o-f)]}containsBlackPoint(e,t,n,r){const i=this.image;if(r){for(let r=e;r<=t;r++)if(i.get(r,n))return!0}else for(let r=e;r<=t;r++)if(i.get(n,r))return!0;return!1}}ce.INIT_SIZE=10,ce.CORR=1;class de{static checkAndNudgePoints(e,t){const n=e.getWidth(),r=e.getHeight();let i=!0;for(let e=0;e<t.length&&i;e+=2){const o=Math.floor(t[e]),s=Math.floor(t[e+1]);if(o<-1||o>n||s<-1||s>r)throw new T;i=!1,-1===o?(t[e]=0,i=!0):o===n&&(t[e]=n-1,i=!0),-1===s?(t[e+1]=0,i=!0):s===r&&(t[e+1]=r-1,i=!0)}i=!0;for(let e=t.length-2;e>=0&&i;e-=2){const o=Math.floor(t[e]),s=Math.floor(t[e+1]);if(o<-1||o>n||s<-1||s>r)throw new T;i=!1,-1===o?(t[e]=0,i=!0):o===n&&(t[e]=n-1,i=!0),-1===s?(t[e+1]=0,i=!0):s===r&&(t[e+1]=r-1,i=!0)}}}class ue{constructor(e,t,n,r,i,o,s,a,l){this.a11=e,this.a21=t,this.a31=n,this.a12=r,this.a22=i,this.a32=o,this.a13=s,this.a23=a,this.a33=l}static quadrilateralToQuadrilateral(e,t,n,r,i,o,s,a,l,c,d,u,f,h,m,p){const g=ue.quadrilateralToSquare(e,t,n,r,i,o,s,a);return ue.squareToQuadrilateral(l,c,d,u,f,h,m,p).times(g)}transformPoints(e){const t=e.length,n=this.a11,r=this.a12,i=this.a13,o=this.a21,s=this.a22,a=this.a23,l=this.a31,c=this.a32,d=this.a33;for(let u=0;u<t;u+=2){const t=e[u],f=e[u+1],h=i*t+a*f+d;e[u]=(n*t+o*f+l)/h,e[u+1]=(r*t+s*f+c)/h}}transformPointsWithValues(e,t){const n=this.a11,r=this.a12,i=this.a13,o=this.a21,s=this.a22,a=this.a23,l=this.a31,c=this.a32,d=this.a33,u=e.length;for(let f=0;f<u;f++){const u=e[f],h=t[f],m=i*u+a*h+d;e[f]=(n*u+o*h+l)/m,t[f]=(r*u+s*h+c)/m}}static squareToQuadrilateral(e,t,n,r,i,o,s,a){const l=e-n+i-s,c=t-r+o-a;if(0===l&&0===c)return new ue(n-e,i-n,e,r-t,o-r,t,0,0,1);{const d=n-i,u=s-i,f=r-o,h=a-o,m=d*h-u*f,p=(l*h-u*c)/m,g=(d*c-l*f)/m;return new ue(n-e+p*n,s-e+g*s,e,r-t+p*r,a-t+g*a,t,p,g,1)}}static quadrilateralToSquare(e,t,n,r,i,o,s,a){return ue.squareToQuadrilateral(e,t,n,r,i,o,s,a).buildAdjoint()}buildAdjoint(){return new ue(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 ue(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 fe extends de{sampleGrid(e,t,n,r,i,o,s,a,l,c,d,u,f,h,m,p,g,w,y){const v=ue.quadrilateralToQuadrilateral(r,i,o,s,a,l,c,d,u,f,h,m,p,g,w,y);return this.sampleGridWithTransform(e,t,n,v)}sampleGridWithTransform(e,t,n,r){if(t<=0||n<=0)throw new T;const i=new N(t,n),o=new Float32Array(2*t);for(let t=0;t<n;t++){const n=o.length,s=t+.5;for(let e=0;e<n;e+=2)o[e]=e/2+.5,o[e+1]=s;r.transformPoints(o),de.checkAndNudgePoints(e,o);try{for(let r=0;r<n;r+=2)e.get(Math.floor(o[r]),Math.floor(o[r+1]))&&i.set(r/2,t)}catch(e){throw new T}}return i}}class he{static setGridSampler(e){he.gridSampler=e}static getInstance(){return he.gridSampler}}he.gridSampler=new fe;class me{constructor(e,t){this.x=e,this.y=t}toResultPoint(){return new se(this.getX(),this.getY())}getX(){return this.x}getY(){return this.y}}class pe{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 e=n[0];n[0]=n[2],n[2]=e}this.extractParameters(n);let r=this.sampleGrid(this.image,n[this.shift%4],n[(this.shift+1)%4],n[(this.shift+2)%4],n[(this.shift+3)%4]),i=this.getMatrixCornerPoints(n);return new le(r,i,this.compact,this.nbDataBlocks,this.nbLayers)}extractParameters(e){if(!(this.isValidPoint(e[0])&&this.isValidPoint(e[1])&&this.isValidPoint(e[2])&&this.isValidPoint(e[3])))throw new T;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 e=0;e<4;e++){let t=n[(this.shift+e)%4];this.compact?(r<<=7,r+=t>>1&127):(r<<=10,r+=(t>>2&992)+(t>>1&31))}let i=this.getCorrectedParameterData(r,this.compact);this.compact?(this.nbLayers=1+(i>>6),this.nbDataBlocks=1+(63&i)):(this.nbLayers=1+(i>>11),this.nbDataBlocks=1+(2047&i))}getRotation(e,t){let n=0;e.forEach((e,r,i)=>{n=(e>>t-2<<1)+(1&e)+(n<<3)}),n=((1&n)<<11)+(n>>1);for(let e=0;e<4;e++)if(y.bitCount(n^this.EXPECTED_CORNER_BITS[e])<=2)return e;throw new T}getCorrectedParameterData(e,t){let n,r;t?(n=7,r=2):(n=10,r=4);let i=n-r,o=new Int32Array(n);for(let t=n-1;t>=0;--t)o[t]=15&e,e>>=4;try{new ne(J.AZTEC_PARAM).decode(o,i)}catch(e){throw new T}let s=0;for(let e=0;e<r;e++)s=(s<<4)+o[e];return s}getBullsEyeCorners(e){let t=e,n=e,r=e,i=e,o=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){let e=this.getFirstDifferent(t,o,1,-1),s=this.getFirstDifferent(n,o,1,1),a=this.getFirstDifferent(r,o,-1,1),l=this.getFirstDifferent(i,o,-1,-1);if(this.nbCenterLayers>2){let n=this.distancePoint(l,e)*this.nbCenterLayers/(this.distancePoint(i,t)*(this.nbCenterLayers+2));if(n<.75||n>1.25||!this.isWhiteOrBlackRectangle(e,s,a,l))break}t=e,n=s,r=a,i=l,o=!o}if(5!==this.nbCenterLayers&&7!==this.nbCenterLayers)throw new T;this.compact=5===this.nbCenterLayers;let s=new se(t.getX()+.5,t.getY()-.5),a=new se(n.getX()+.5,n.getY()+.5),l=new se(r.getX()-.5,r.getY()+.5),c=new se(i.getX()-.5,i.getY()-.5);return this.expandSquare([s,a,l,c],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let e,t,n,r;try{let i=new ce(this.image).detect();e=i[0],t=i[1],n=i[2],r=i[3]}catch(i){let o=this.image.getWidth()/2,s=this.image.getHeight()/2;e=this.getFirstDifferent(new me(o+7,s-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new me(o+7,s+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new me(o-7,s+7),!1,-1,1).toResultPoint(),r=this.getFirstDifferent(new me(o-7,s-7),!1,-1,-1).toResultPoint()}let i=ie.round((e.getX()+r.getX()+t.getX()+n.getX())/4),o=ie.round((e.getY()+r.getY()+t.getY()+n.getY())/4);try{let s=new ce(this.image,15,i,o).detect();e=s[0],t=s[1],n=s[2],r=s[3]}catch(s){e=this.getFirstDifferent(new me(i+7,o-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new me(i+7,o+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new me(i-7,o+7),!1,-1,1).toResultPoint(),r=this.getFirstDifferent(new me(i-7,o-7),!1,-1,-1).toResultPoint()}return i=ie.round((e.getX()+r.getX()+t.getX()+n.getX())/4),o=ie.round((e.getY()+r.getY()+t.getY()+n.getY())/4),new me(i,o)}getMatrixCornerPoints(e){return this.expandSquare(e,2*this.nbCenterLayers,this.getDimension())}sampleGrid(e,t,n,r,i){let o=he.getInstance(),s=this.getDimension(),a=s/2-this.nbCenterLayers,l=s/2+this.nbCenterLayers;return o.sampleGrid(e,s,s,a,a,l,a,l,l,a,l,t.getX(),t.getY(),n.getX(),n.getY(),r.getX(),r.getY(),i.getX(),i.getY())}sampleLine(e,t,n){let r=0,i=this.distanceResultPoint(e,t),o=i/n,s=e.getX(),a=e.getY(),l=o*(t.getX()-e.getX())/i,c=o*(t.getY()-e.getY())/i;for(let e=0;e<n;e++)this.image.get(ie.round(s+e*l),ie.round(a+e*c))&&(r|=1<<n-e-1);return r}isWhiteOrBlackRectangle(e,t,n,r){let i=3;e=new me(e.getX()-i,e.getY()+i),t=new me(t.getX()-i,t.getY()-i),n=new me(n.getX()+i,n.getY()-i),r=new me(r.getX()+i,r.getY()+i);let o=this.getColor(r,e);if(0===o)return!1;let s=this.getColor(e,t);return s===o&&(s=this.getColor(t,n),s===o&&(s=this.getColor(n,r),s===o))}getColor(e,t){let n=this.distancePoint(e,t),r=(t.getX()-e.getX())/n,i=(t.getY()-e.getY())/n,o=0,s=e.getX(),a=e.getY(),l=this.image.get(e.getX(),e.getY()),c=Math.ceil(n);for(let e=0;e<c;e++)s+=r,a+=i,this.image.get(ie.round(s),ie.round(a))!==l&&o++;let d=o/n;return d>.1&&d<.9?0:d<=.1===l?1:-1}getFirstDifferent(e,t,n,r){let i=e.getX()+n,o=e.getY()+r;for(;this.isValid(i,o)&&this.image.get(i,o)===t;)i+=n,o+=r;for(i-=n,o-=r;this.isValid(i,o)&&this.image.get(i,o)===t;)i+=n;for(i-=n;this.isValid(i,o)&&this.image.get(i,o)===t;)o+=r;return o-=r,new me(i,o)}expandSquare(e,t,n){let r=n/(2*t),i=e[0].getX()-e[2].getX(),o=e[0].getY()-e[2].getY(),s=(e[0].getX()+e[2].getX())/2,a=(e[0].getY()+e[2].getY())/2,l=new se(s+r*i,a+r*o),c=new se(s-r*i,a-r*o);return i=e[1].getX()-e[3].getX(),o=e[1].getY()-e[3].getY(),s=(e[1].getX()+e[3].getX())/2,a=(e[1].getY()+e[3].getY())/2,[l,new se(s+r*i,a+r*o),c,new se(s-r*i,a-r*o)]}isValid(e,t){return e>=0&&e<this.image.getWidth()&&t>0&&t<this.image.getHeight()}isValidPoint(e){let t=ie.round(e.getX()),n=ie.round(e.getY());return this.isValid(t,n)}distancePoint(e,t){return ie.distance(e.getX(),e.getY(),t.getX(),t.getY())}distanceResultPoint(e,t){return ie.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*(y.truncDivision(this.nbLayers-4,8)+1)+15}}class ge{decode(e,t=null){let n=null,r=new pe(e.getBlackMatrix()),i=null,o=null;try{let e=r.detectMirror(!1);i=e.getPoints(),this.reportFoundResultPoints(t,i),o=(new re).decode(e)}catch(e){n=e}if(null==o)try{let e=r.detectMirror(!0);i=e.getPoints(),this.reportFoundResultPoints(t,i),o=(new re).decode(e)}catch(e){if(null!=n)throw n;throw e}let s=new F(o.getText(),o.getRawBytes(),o.getNumBits(),i,U.AZTEC,m.currentTimeMillis()),a=o.getByteSegments();null!=a&&s.putMetadata(X.BYTE_SEGMENTS,a);let l=o.getECLevel();return null!=l&&s.putMetadata(X.ERROR_CORRECTION_LEVEL,l),s}reportFoundResultPoints(e,t){if(null!=e){let n=e.get(I.NEED_RESULT_POINT_CALLBACK);null!=n&&t.forEach((e,t,r)=>{n.foundPossibleResultPoint(e)})}}reset(){}}class we extends L{constructor(e=500){super(new ge,e)}}class ye{decode(e,t){try{return this.doDecode(e,t)}catch(n){if(t&&!0===t.get(I.TRY_HARDER)&&e.isRotateSupported()){const n=e.rotateCounterClockwise(),r=this.doDecode(n,t),i=r.getResultMetadata();let o=270;null!==i&&!0===i.get(X.ORIENTATION)&&(o+=i.get(X.ORIENTATION)%360),r.putMetadata(X.ORIENTATION,o);const s=r.getResultPoints();if(null!==s){const e=n.getHeight();for(let t=0;t<s.length;t++)s[t]=new se(e-s[t].getY()-1,s[t].getX())}return r}throw new T}}reset(){}doDecode(e,t){const n=e.getWidth(),r=e.getHeight();let i=new v(n);const o=t&&!0===t.get(I.TRY_HARDER),s=Math.max(1,r>>(o?8:5));let a;a=o?r:15;const l=Math.trunc(r/2);for(let o=0;o<a;o++){const a=Math.trunc((o+1)/2),c=l+s*(1&o?-a:a);if(c<0||c>=r)break;try{i=e.getBlackRow(c,i)}catch(e){continue}for(let e=0;e<2;e++){if(1===e&&(i.reverse(),t&&!0===t.get(I.NEED_RESULT_POINT_CALLBACK))){const e=new Map;t.forEach((t,n)=>e.set(n,t)),e.delete(I.NEED_RESULT_POINT_CALLBACK),t=e}try{const r=this.decodeRow(c,i,t);if(1===e){r.putMetadata(X.ORIENTATION,180);const e=r.getResultPoints();null!==e&&(e[0]=new se(n-e[0].getX()-1,e[0].getY()),e[1]=new se(n-e[1].getX()-1,e[1].getY()))}return r}catch(e){}}}throw new T}static recordPattern(e,t,n){const r=n.length;for(let e=0;e<r;e++)n[e]=0;const i=e.getSize();if(t>=i)throw new T;let o=!e.get(t),s=0,a=t;for(;a<i;){if(e.get(a)!==o)n[s]++;else{if(++s===r)break;n[s]=1,o=!o}a++}if(s!==r&&(s!==r-1||a!==i))throw new T}static recordPatternInReverse(e,t,n){let r=n.length,i=e.get(t);for(;t>0&&r>=0;)e.get(--t)!==i&&(r--,i=!i);if(r>=0)throw new T;ye.recordPattern(e,t+1,n)}static patternMatchVariance(e,t,n){const r=e.length;let i=0,o=0;for(let n=0;n<r;n++)i+=e[n],o+=t[n];if(i<o)return Number.POSITIVE_INFINITY;const s=i/o;n*=s;let a=0;for(let i=0;i<r;i++){const r=e[i],o=t[i]*s,l=r>o?r-o:o-r;if(l>n)return Number.POSITIVE_INFINITY;a+=l}return a/i}}class ve extends ye{static findStartPattern(e){const t=e.getSize(),n=e.getNextSet(0);let r=0,i=Int32Array.from([0,0,0,0,0,0]),o=n,s=!1;const a=6;for(let l=n;l<t;l++)if(e.get(l)!==s)i[r]++;else{if(r===a-1){let t=ve.MAX_AVG_VARIANCE,n=-1;for(let e=ve.CODE_START_A;e<=ve.CODE_START_C;e++){const r=ye.patternMatchVariance(i,ve.CODE_PATTERNS[e],ve.MAX_INDIVIDUAL_VARIANCE);r<t&&(t=r,n=e)}if(n>=0&&e.isRange(Math.max(0,o-(l-o)/2),o,!1))return Int32Array.from([o,l,n]);o+=i[0]+i[1],i=i.slice(2,i.length-1),i[r-1]=0,i[r]=0,r--}else r++;i[r]=1,s=!s}throw new T}static decodeCode(e,t,n){ye.recordPattern(e,n,t);let r=ve.MAX_AVG_VARIANCE,i=-1;for(let e=0;e<ve.CODE_PATTERNS.length;e++){const n=ve.CODE_PATTERNS[e],o=this.patternMatchVariance(t,n,ve.MAX_INDIVIDUAL_VARIANCE);o<r&&(r=o,i=e)}if(i>=0)return i;throw new T}decodeRow(e,t,n){const r=n&&!0===n.get(I.ASSUME_GS1),i=ve.findStartPattern(t),o=i[2];let s=0;const a=new Uint8Array(20);let l;switch(a[s++]=o,o){case ve.CODE_START_A:l=ve.CODE_CODE_A;break;case ve.CODE_START_B:l=ve.CODE_CODE_B;break;case ve.CODE_START_C:l=ve.CODE_CODE_C;break;default:throw new _}let c=!1,d=!1,u="",h=i[0],m=i[1];const p=Int32Array.from([0,0,0,0,0,0]);let g=0,w=0,y=o,v=0,$=!0,C=!1,E=!1;for(;!c;){const e=d;switch(d=!1,g=w,w=ve.decodeCode(t,p,m),a[s++]=w,w!==ve.CODE_STOP&&($=!0),w!==ve.CODE_STOP&&(v++,y+=v*w),h=m,m+=p.reduce((e,t)=>e+t,0),w){case ve.CODE_START_A:case ve.CODE_START_B:case ve.CODE_START_C:throw new _}switch(l){case ve.CODE_CODE_A:if(w<64)u+=E===C?String.fromCharCode(" ".charCodeAt(0)+w):String.fromCharCode(" ".charCodeAt(0)+w+128),E=!1;else if(w<96)u+=E===C?String.fromCharCode(w-64):String.fromCharCode(w+64),E=!1;else switch(w!==ve.CODE_STOP&&($=!1),w){case ve.CODE_FNC_1:r&&(0===u.length?u+="]C1":u+=String.fromCharCode(29));break;case ve.CODE_FNC_2:case ve.CODE_FNC_3:break;case ve.CODE_FNC_4_A:!C&&E?(C=!0,E=!1):C&&E?(C=!1,E=!1):E=!0;break;case ve.CODE_SHIFT:d=!0,l=ve.CODE_CODE_B;break;case ve.CODE_CODE_B:l=ve.CODE_CODE_B;break;case ve.CODE_CODE_C:l=ve.CODE_CODE_C;break;case ve.CODE_STOP:c=!0}break;case ve.CODE_CODE_B:if(w<96)u+=E===C?String.fromCharCode(" ".charCodeAt(0)+w):String.fromCharCode(" ".charCodeAt(0)+w+128),E=!1;else switch(w!==ve.CODE_STOP&&($=!1),w){case ve.CODE_FNC_1:r&&(0===u.length?u+="]C1":u+=String.fromCharCode(29));break;case ve.CODE_FNC_2:case ve.CODE_FNC_3:break;case ve.CODE_FNC_4_B:!C&&E?(C=!0,E=!1):C&&E?(C=!1,E=!1):E=!0;break;case ve.CODE_SHIFT:d=!0,l=ve.CODE_CODE_A;break;case ve.CODE_CODE_A:l=ve.CODE_CODE_A;break;case ve.CODE_CODE_C:l=ve.CODE_CODE_C;break;case ve.CODE_STOP:c=!0}break;case ve.CODE_CODE_C:if(w<100)w<10&&(u+="0"),u+=w;else switch(w!==ve.CODE_STOP&&($=!1),w){case ve.CODE_FNC_1:r&&(0===u.length?u+="]C1":u+=String.fromCharCode(29));break;case ve.CODE_CODE_A:l=ve.CODE_CODE_A;break;case ve.CODE_CODE_B:l=ve.CODE_CODE_B;break;case ve.CODE_STOP:c=!0}}e&&(l=l===ve.CODE_CODE_A?ve.CODE_CODE_B:ve.CODE_CODE_A)}const A=m-h;if(m=t.getNextUnset(m),!t.isRange(m,Math.min(t.getSize(),m+(m-h)/2),!1))throw new T;if(y-=v*g,y%103!==g)throw new f;const b=u.length;if(0===b)throw new T;b>0&&$&&(u=l===ve.CODE_CODE_C?u.substring(0,b-2):u.substring(0,b-1));const S=(i[1]+i[0])/2,N=h+A/2,R=a.length,D=new Uint8Array(R);for(let e=0;e<R;e++)D[e]=a[e];const x=[new se(S,e),new se(N,e)];return new F(u,D,0,x,U.CODE_128,(new Date).getTime())}}ve.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])],ve.MAX_AVG_VARIANCE=.25,ve.MAX_INDIVIDUAL_VARIANCE=.7,ve.CODE_SHIFT=98,ve.CODE_CODE_C=99,ve.CODE_CODE_B=100,ve.CODE_CODE_A=101,ve.CODE_FNC_1=102,ve.CODE_FNC_2=97,ve.CODE_FNC_3=96,ve.CODE_FNC_4_A=101,ve.CODE_FNC_4_B=100,ve.CODE_START_A=103,ve.CODE_START_B=104,ve.CODE_START_C=105,ve.CODE_STOP=106;class $e extends ye{constructor(e=!1,t=!1){super(),this.usingCheckDigit=e,this.extendedMode=t,this.decodeRowResult="",this.counters=new Int32Array(9)}decodeRow(e,t,n){let r=this.counters;r.fill(0),this.decodeRowResult="";let i,o,s=$e.findAsteriskPattern(t,r),a=t.getNextSet(s[1]),l=t.getSize();do{$e.recordPattern(t,a,r);let e=$e.toNarrowWidePattern(r);if(e<0)throw new T;i=$e.patternToChar(e),this.decodeRowResult+=i,o=a;for(let e of r)a+=e;a=t.getNextSet(a)}while("*"!==i);this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let c,d=0;for(let e of r)d+=e;if(a!==l&&2*(a-o-d)<d)throw new T;if(this.usingCheckDigit){let e=this.decodeRowResult.length-1,t=0;for(let n=0;n<e;n++)t+=$e.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(n));if(this.decodeRowResult.charAt(e)!==$e.ALPHABET_STRING.charAt(t%43))throw new f;this.decodeRowResult=this.decodeRowResult.substring(0,e)}if(0===this.decodeRowResult.length)throw new T;c=this.extendedMode?$e.decodeExtended(this.decodeRowResult):this.decodeRowResult;let u=(s[1]+s[0])/2,h=o+d/2;return new F(c,null,0,[new se(u,e),new se(h,e)],U.CODE_39,(new Date).getTime())}static findAsteriskPattern(e,t){let n=e.getSize(),r=e.getNextSet(0),i=0,o=r,s=!1,a=t.length;for(let l=r;l<n;l++)if(e.get(l)!==s)t[i]++;else{if(i===a-1){if(this.toNarrowWidePattern(t)===$e.ASTERISK_ENCODING&&e.isRange(Math.max(0,o-Math.floor((l-o)/2)),o,!1))return[o,l];o+=t[0]+t[1],t.copyWithin(0,2,2+i-1),t[i-1]=0,t[i]=0,i--}else i++;t[i]=1,s=!s}throw new T}static toNarrowWidePattern(e){let t,n=e.length,r=0;do{let i=2147483647;for(let t of e)t<i&&t>r&&(i=t);r=i,t=0;let o=0,s=0;for(let i=0;i<n;i++){let a=e[i];a>r&&(s|=1<<n-1-i,t++,o+=a)}if(3===t){for(let i=0;i<n&&t>0;i++){let n=e[i];if(n>r&&(t--,2*n>=o))return-1}return s}}while(t>3);return-1}static patternToChar(e){for(let t=0;t<$e.CHARACTER_ENCODINGS.length;t++)if($e.CHARACTER_ENCODINGS[t]===e)return $e.ALPHABET_STRING.charAt(t);if(e===$e.ASTERISK_ENCODING)return"*";throw new T}static decodeExtended(e){let t=e.length,n="";for(let r=0;r<t;r++){let t=e.charAt(r);if("+"===t||"$"===t||"%"===t||"/"===t){let i=e.charAt(r+1),o="\0";switch(t){case"+":if(!(i>="A"&&i<="Z"))throw new _;o=String.fromCharCode(i.charCodeAt(0)+32);break;case"$":if(!(i>="A"&&i<="Z"))throw new _;o=String.fromCharCode(i.charCodeAt(0)-64);break;case"%":if(i>="A"&&i<="E")o=String.fromCharCode(i.charCodeAt(0)-38);else if(i>="F"&&i<="J")o=String.fromCharCode(i.charCodeAt(0)-11);else if(i>="K"&&i<="O")o=String.fromCharCode(i.charCodeAt(0)+16);else if(i>="P"&&i<="T")o=String.fromCharCode(i.charCodeAt(0)+43);else if("U"===i)o="\0";else if("V"===i)o="@";else if("W"===i)o="`";else{if("X"!==i&&"Y"!==i&&"Z"!==i)throw new _;o=""}break;case"/":if(i>="A"&&i<="O")o=String.fromCharCode(i.charCodeAt(0)-32);else{if("Z"!==i)throw new _;o=":"}}n+=o,r++}else n+=t}return n}}$e.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",$e.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],$e.ASTERISK_ENCODING=148;class Ie extends ye{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(e,t,n){let r=this.decodeStart(t),i=this.decodeEnd(t),o=new S;Ie.decodeMiddle(t,r[1],i[0],o);let s=o.toString(),a=null;null!=n&&(a=n.get(I.ALLOWED_LENGTHS)),null==a&&(a=Ie.DEFAULT_ALLOWED_LENGTHS);let l=s.length,c=!1,d=0;for(let e of a){if(l===e){c=!0;break}e>d&&(d=e)}if(!c&&l>d&&(c=!0),!c)throw new _;const u=[new se(r[1],e),new se(i[0],e)];return new F(s,null,0,u,U.ITF,(new Date).getTime())}static decodeMiddle(e,t,n,r){let i=new Int32Array(10),o=new Int32Array(5),s=new Int32Array(5);for(i.fill(0),o.fill(0),s.fill(0);t<n;){ye.recordPattern(e,t,i);for(let e=0;e<5;e++){let t=2*e;o[e]=i[t],s[e]=i[t+1]}let n=Ie.decodeDigit(o);r.append(n.toString()),n=this.decodeDigit(s),r.append(n.toString()),i.forEach(function(e){t+=e})}}decodeStart(e){let t=Ie.skipWhiteSpace(e),n=Ie.findGuardPattern(e,t,Ie.START_PATTERN);return this.narrowLineWidth=(n[1]-n[0])/4,this.validateQuietZone(e,n[0]),n}validateQuietZone(e,t){let n=10*this.narrowLineWidth;n=n<t?n:t;for(let r=t-1;n>0&&r>=0&&!e.get(r);r--)n--;if(0!==n)throw new T}static skipWhiteSpace(e){const t=e.getSize(),n=e.getNextSet(0);if(n===t)throw new T;return n}decodeEnd(e){e.reverse();try{let t,n=Ie.skipWhiteSpace(e);try{t=Ie.findGuardPattern(e,n,Ie.END_PATTERN_REVERSED[0])}catch(r){r instanceof T&&(t=Ie.findGuardPattern(e,n,Ie.END_PATTERN_REVERSED[1]))}this.validateQuietZone(e,t[0]);let r=t[0];return t[0]=e.getSize()-t[1],t[1]=e.getSize()-r,t}finally{e.reverse()}}static findGuardPattern(e,t,n){let r=n.length,i=new Int32Array(r),o=e.getSize(),s=!1,a=0,l=t;i.fill(0);for(let c=t;c<o;c++)if(e.get(c)!==s)i[a]++;else{if(a===r-1){if(ye.patternMatchVariance(i,n,Ie.MAX_INDIVIDUAL_VARIANCE)<Ie.MAX_AVG_VARIANCE)return[l,c];l+=i[0]+i[1],m.arraycopy(i,2,i,0,a-1),i[a-1]=0,i[a]=0,a--}else a++;i[a]=1,s=!s}throw new T}static decodeDigit(e){let t=Ie.MAX_AVG_VARIANCE,n=-1,r=Ie.PATTERNS.length;for(let i=0;i<r;i++){let r=Ie.PATTERNS[i],o=ye.patternMatchVariance(e,r,Ie.MAX_INDIVIDUAL_VARIANCE);o<t?(t=o,n=i):o===t&&(n=-1)}if(n>=0)return n%10;throw new T}}Ie.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])],Ie.MAX_AVG_VARIANCE=.38,Ie.MAX_INDIVIDUAL_VARIANCE=.5,Ie.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],Ie.START_PATTERN=Int32Array.from([1,1,1,1]),Ie.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class _e extends ye{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(e){let t,n=!1,r=0,i=Int32Array.from([0,0,0]);for(;!n;){i=Int32Array.from([0,0,0]),t=_e.findGuardPattern(e,r,!1,this.START_END_PATTERN,i);let o=t[0];r=t[1];let s=o-(r-o);s>=0&&(n=e.isRange(s,o,!1))}return t}static checkChecksum(e){return _e.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(0===t)return!1;let n=parseInt(e.charAt(t-1),10);return _e.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 t=e.charAt(r).charCodeAt(0)-"0".charCodeAt(0);if(t<0||t>9)throw new _;n+=t}n*=3;for(let r=t-2;r>=0;r-=2){let t=e.charAt(r).charCodeAt(0)-"0".charCodeAt(0);if(t<0||t>9)throw new _;n+=t}return(1e3-n)%10}static decodeEnd(e,t){return _e.findGuardPattern(e,t,!1,_e.START_END_PATTERN,new Int32Array(_e.START_END_PATTERN.length).fill(0))}static findGuardPatternWithoutCounters(e,t,n,r){return this.findGuardPattern(e,t,n,r,new Int32Array(r.length))}static findGuardPattern(e,t,n,r,i){let o=e.getSize(),s=0,a=t=n?e.getNextUnset(t):e.getNextSet(t),l=r.length,c=n;for(let n=t;n<o;n++)if(e.get(n)!==c)i[s]++;else{if(s===l-1){if(ye.patternMatchVariance(i,r,_e.MAX_INDIVIDUAL_VARIANCE)<_e.MAX_AVG_VARIANCE)return Int32Array.from([a,n]);a+=i[0]+i[1];let e=i.slice(2,i.length-1);for(let t=0;t<s-1;t++)i[t]=e[t];i[s-1]=0,i[s]=0,s--}else s++;i[s]=1,c=!c}throw new T}static decodeDigit(e,t,n,r){this.recordPattern(e,n,t);let i=this.MAX_AVG_VARIANCE,o=-1,s=r.length;for(let e=0;e<s;e++){let n=r[e],s=ye.patternMatchVariance(t,n,_e.MAX_INDIVIDUAL_VARIANCE);s<i&&(i=s,o=e)}if(o>=0)return o;throw new T}}_e.MAX_AVG_VARIANCE=.48,_e.MAX_INDIVIDUAL_VARIANCE=.7,_e.START_END_PATTERN=Int32Array.from([1,1,1]),_e.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),_e.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),_e.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 Ce{constructor(){this.CHECK_DIGIT_ENCODINGS=[24,20,18,17,12,6,3,10,9,5],this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(e,t,n){let r=this.decodeRowStringBuffer,i=this.decodeMiddle(t,n,r),o=r.toString(),s=Ce.parseExtensionString(o),a=[new se((n[0]+n[1])/2,e),new se(i,e)],l=new F(o,null,0,a,U.UPC_EAN_EXTENSION,(new Date).getTime());return null!=s&&l.putAllMetadata(s),l}decodeMiddle(e,t,n){let r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let i=e.getSize(),o=t[1],s=0;for(let t=0;t<5&&o<i;t++){let i=_e.decodeDigit(e,r,o,_e.L_AND_G_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+i%10);for(let e of r)o+=e;i>=10&&(s|=1<<4-t),4!==t&&(o=e.getNextSet(o),o=e.getNextUnset(o))}if(5!==n.length)throw new T;let a=this.determineCheckDigit(s);if(Ce.extensionChecksum(n.toString())!==a)throw new T;return o}static extensionChecksum(e){let t=e.length,n=0;for(let r=t-2;r>=0;r-=2)n+=e.charAt(r).charCodeAt(0)-"0".charCodeAt(0);n*=3;for(let r=t-1;r>=0;r-=2)n+=e.charAt(r).charCodeAt(0)-"0".charCodeAt(0);return n*=3,n%10}determineCheckDigit(e){for(let t=0;t<10;t++)if(e===this.CHECK_DIGIT_ENCODINGS[t])return t;throw new T}static parseExtensionString(e){if(5!==e.length)return null;let t=Ce.parseExtension5String(e);return null==t?null:new Map([[X.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=""}let n=parseInt(e.substring(1)),r=n%100;return t+(n/100).toString()+"."+(r<10?"0"+r:r.toString())}}class Ee{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(e,t,n){let r=this.decodeRowStringBuffer,i=this.decodeMiddle(t,n,r),o=r.toString(),s=Ee.parseExtensionString(o),a=[new se((n[0]+n[1])/2,e),new se(i,e)],l=new F(o,null,0,a,U.UPC_EAN_EXTENSION,(new Date).getTime());return null!=s&&l.putAllMetadata(s),l}decodeMiddle(e,t,n){let r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let i=e.getSize(),o=t[1],s=0;for(let t=0;t<2&&o<i;t++){let i=_e.decodeDigit(e,r,o,_e.L_AND_G_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+i%10);for(let e of r)o+=e;i>=10&&(s|=1<<1-t),1!==t&&(o=e.getNextSet(o),o=e.getNextUnset(o))}if(2!==n.length)throw new T;if(parseInt(n.toString())%4!==s)throw new T;return o}static parseExtensionString(e){return 2!==e.length?null:new Map([[X.ISSUE_NUMBER,parseInt(e)]])}}class Ae{static decodeRow(e,t,n){let r=_e.findGuardPattern(t,n,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return(new Ce).decodeRow(e,t,r)}catch(n){return(new Ee).decodeRow(e,t,r)}}}Ae.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class be extends _e{constructor(){super(),this.decodeRowStringBuffer="",be.L_AND_G_PATTERNS=be.L_PATTERNS.map(e=>Int32Array.from(e));for(let e=10;e<20;e++){let t=be.L_PATTERNS[e-10],n=new Int32Array(t.length);for(let e=0;e<t.length;e++)n[e]=t[t.length-e-1];be.L_AND_G_PATTERNS[e]=n}}decodeRow(e,t,n){let r=be.findStartGuardPattern(t),i=null==n?null:n.get(I.NEED_RESULT_POINT_CALLBACK);if(null!=i){const t=new se((r[0]+r[1])/2,e);i.foundPossibleResultPoint(t)}let o=this.decodeMiddle(t,r,this.decodeRowStringBuffer),s=o.rowOffset,a=o.resultString;if(null!=i){const t=new se(s,e);i.foundPossibleResultPoint(t)}let l=this.decodeEnd(t,s);if(null!=i){const t=new se((l[0]+l[1])/2,e);i.foundPossibleResultPoint(t)}let c=l[1],d=c+(c-l[0]);if(d>=t.getSize()||!t.isRange(c,d,!1))throw new T;let u=a.toString();if(u.length<8)throw new _;if(!be.checkChecksum(u))throw new f;let h=(r[1]+r[0])/2,m=(l[1]+l[0])/2,p=this.getBarcodeFormat(),g=[new se(h,e),new se(m,e)],w=new F(u,null,0,g,p,(new Date).getTime()),y=0;try{let n=Ae.decodeRow(e,t,l[1]);w.putMetadata(X.UPC_EAN_EXTENSION,n.getText()),w.putAllMetadata(n.getResultMetadata()),w.addResultPoints(n.getResultPoints()),y=n.getText().length}catch(e){}let v=null==n?null:n.get(I.ALLOWED_EAN_EXTENSIONS);if(null!=v){let e=!1;for(let t in v)if(y.toString()===t){e=!0;break}if(!e)throw new T}return w}decodeEnd(e,t){return be.findGuardPattern(e,t,!1,be.START_END_PATTERN,new Int32Array(be.START_END_PATTERN.length).fill(0))}static checkChecksum(e){return be.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(0===t)return!1;let n=parseInt(e.charAt(t-1),10);return be.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 t=e.charAt(r).charCodeAt(0)-"0".charCodeAt(0);if(t<0||t>9)throw new _;n+=t}n*=3;for(let r=t-2;r>=0;r-=2){let t=e.charAt(r).charCodeAt(0)-"0".charCodeAt(0);if(t<0||t>9)throw new _;n+=t}return(1e3-n)%10}}class Se extends be{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(e,t,n){let r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let i=e.getSize(),o=t[1],s=0;for(let t=0;t<6&&o<i;t++){let i=be.decodeDigit(e,r,o,be.L_AND_G_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+i%10);for(let e of r)o+=e;i>=10&&(s|=1<<5-t)}n=Se.determineFirstDigit(n,s),o=be.findGuardPattern(e,o,!0,be.MIDDLE_PATTERN,new Int32Array(be.MIDDLE_PATTERN.length).fill(0))[1];for(let t=0;t<6&&o<i;t++){let t=be.decodeDigit(e,r,o,be.L_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+t);for(let e of r)o+=e}return{rowOffset:o,resultString:n}}getBarcodeFormat(){return U.EAN_13}static determineFirstDigit(e,t){for(let n=0;n<10;n++)if(t===this.FIRST_DIGIT_ENCODINGS[n])return e=String.fromCharCode("0".charCodeAt(0)+n)+e;throw new T}}Se.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class Ne extends be{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(e,t,n){const r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let i=e.getSize(),o=t[1];for(let t=0;t<4&&o<i;t++){let t=be.decodeDigit(e,r,o,be.L_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+t);for(let e of r)o+=e}o=be.findGuardPattern(e,o,!0,be.MIDDLE_PATTERN,new Int32Array(be.MIDDLE_PATTERN.length).fill(0))[1];for(let t=0;t<4&&o<i;t++){let t=be.decodeDigit(e,r,o,be.L_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+t);for(let e of r)o+=e}return{rowOffset:o,resultString:n}}getBarcodeFormat(){return U.EAN_8}}class Te extends be{constructor(){super(...arguments),this.ean13Reader=new Se}getBarcodeFormat(){return U.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("0"===t.charAt(0)){let n=new F(t.substring(1),null,null,e.getResultPoints(),U.UPC_A);return null!=e.getResultMetadata()&&n.putAllMetadata(e.getResultMetadata()),n}throw new T}reset(){this.ean13Reader.reset()}}class Re extends be{constructor(){super(),this.decodeMiddleCounters=new Int32Array(4)}decodeMiddle(e,t,n){const r=this.decodeMiddleCounters.map(e=>e);r[0]=0,r[1]=0,r[2]=0,r[3]=0;const i=e.getSize();let o=t[1],s=0;for(let t=0;t<6&&o<i;t++){const i=Re.decodeDigit(e,r,o,Re.L_AND_G_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+i%10);for(let e of r)o+=e;i>=10&&(s|=1<<5-t)}return{rowOffset:o,resultString:Re.determineNumSysAndCheckDigit(n,s)}}decodeEnd(e,t){return Re.findGuardPatternWithoutCounters(e,t,!0,Re.MIDDLE_END_PATTERN)}checkChecksum(e){return be.checkChecksum(Re.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])return String.fromCharCode("0".charCodeAt(0)+n)+e+String.fromCharCode("0".charCodeAt(0)+r);throw T.getNotFoundInstance()}getBarcodeFormat(){return U.UPC_E}static convertUPCEtoUPCA(e){const t=e.slice(1,7).split("").map(e=>e.charCodeAt(0)),n=new S;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)}return e.length>=8&&n.append(e.charAt(7)),n.toString()}}Re.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),Re.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 De extends ye{constructor(e){super();let n=null==e?null:e.get(I.POSSIBLE_FORMATS),r=[];t(n)?(r.push(new Se),r.push(new Te),r.push(new Ne),r.push(new Re)):(n.indexOf(U.EAN_13)>-1&&r.push(new Se),n.indexOf(U.UPC_A)>-1&&r.push(new Te),n.indexOf(U.EAN_8)>-1&&r.push(new Ne),n.indexOf(U.UPC_E)>-1&&r.push(new Re)),this.readers=r}decodeRow(e,t,n){for(let r of this.readers)try{const i=r.decodeRow(e,t,n),o=i.getBarcodeFormat()===U.EAN_13&&"0"===i.getText().charAt(0),s=null==n?null:n.get(I.POSSIBLE_FORMATS),a=null==s||s.includes(U.UPC_A);if(o&&a){const e=i.getRawBytes(),t=new F(i.getText().substring(1),e,e?e.length:null,i.getResultPoints(),U.UPC_A);return t.putAllMetadata(i.getResultMetadata()),t}return i}catch(e){}throw new T}reset(){for(let e of this.readers)e.reset()}}class xe extends ye{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(ye.patternMatchVariance(e,t[n],xe.MAX_INDIVIDUAL_VARIANCE)<xe.MAX_AVG_VARIANCE)return n;throw new T}static count(e){return ie.sum(new Int32Array(e))}static increment(e,t){let n=0,r=t[0];for(let i=1;i<e.length;i++)t[i]>r&&(r=t[i],n=i);e[n]++}static decrement(e,t){let n=0,r=t[0];for(let i=1;i<e.length;i++)t[i]<r&&(r=t[i],n=i);e[n]--}static isFinderPattern(e){let t=e[0]+e[1],n=t/(t+e[2]+e[3]);if(n>=xe.MIN_FINDER_PATTERN_RATIO&&n<=xe.MAX_FINDER_PATTERN_RATIO){let t=Number.MAX_SAFE_INTEGER,n=Number.MIN_SAFE_INTEGER;for(let r of e)r>n&&(n=r),r<t&&(t=r);return n<10*t}return!1}}xe.MAX_AVG_VARIANCE=.2,xe.MAX_INDIVIDUAL_VARIANCE=.45,xe.MIN_FINDER_PATTERN_RATIO=9.5/12,xe.MAX_FINDER_PATTERN_RATIO=12.5/14;class ke{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 ke))return!1;const t=e;return this.value===t.value&&this.checksumPortion===t.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class Oe{constructor(e,t,n,r,i){this.value=e,this.startEnd=t,this.value=e,this.startEnd=t,this.resultPoints=new Array,this.resultPoints.push(new se(n,i)),this.resultPoints.push(new se(r,i))}getValue(){return this.value}getStartEnd(){return this.startEnd}getResultPoints(){return this.resultPoints}equals(e){if(!(e instanceof Oe))return!1;const t=e;return this.value===t.value}hashCode(){return this.value}}class Me{constructor(){}static getRSSvalue(e,t,n){let r=0;for(let t of e)r+=t;let i=0,o=0,s=e.length;for(let a=0;a<s-1;a++){let l;for(l=1,o|=1<<a;l<e[a];l++,o&=~(1<<a)){let e=Me.combins(r-l-1,s-a-2);if(n&&0===o&&r-l-(s-a-1)>=s-a-1&&(e-=Me.combins(r-l-(s-a),s-a-2)),s-a-1>1){let n=0;for(let e=r-l-(s-a-2);e>t;e--)n+=Me.combins(r-l-e-1,s-a-3);e-=n*(s-1-a)}else r-l>t&&e--;i+=e}r-=l}return i}static combins(e,t){let n,r;e-t>t?(r=t,n=e-t):(r=e-t,n=t);let i=1,o=1;for(let t=e;t>n;t--)i*=t,o<=r&&(i/=o,o++);for(;o<=r;)i/=o,o++;return i}}class Pe{static buildBitArray(e){let t=2*e.length-1;null==e[e.length-1].getRightChar()&&(t-=1);let n=new v(12*t),r=0,i=e[0].getRightChar().getValue();for(let e=11;e>=0;--e)i&1<<e&&n.set(r),r++;for(let t=1;t<e.length;++t){let i=e[t],o=i.getLeftChar().getValue();for(let e=11;e>=0;--e)o&1<<e&&n.set(r),r++;if(null!=i.getRightChar()){let e=i.getRightChar().getValue();for(let t=11;t>=0;--t)e&1<<t&&n.set(r),r++}}return n}}class Be{constructor(e,t){t?this.decodedInformation=null:(this.finished=e,this.decodedInformation=t)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class Le{constructor(e){this.newPosition=e}getNewPosition(){return this.newPosition}}class Fe extends Le{constructor(e,t){super(e),this.value=t}getValue(){return this.value}isFNC1(){return this.value===Fe.FNC1}}Fe.FNC1="$";class Ve extends Le{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 Ue extends Le{constructor(e,t,n){if(super(e),t<0||t>10||n<0||n>10)throw new _;this.firstDigit=t,this.secondDigit=n}getFirstDigit(){return this.firstDigit}getSecondDigit(){return this.secondDigit}getValue(){return 10*this.firstDigit+this.secondDigit}isFirstDigitFNC1(){return this.firstDigit===Ue.FNC1}isSecondDigitFNC1(){return this.secondDigit===Ue.FNC1}isAnyFNC1(){return this.firstDigit===Ue.FNC1||this.secondDigit===Ue.FNC1}}Ue.FNC1=10;class We{constructor(){}static parseFieldsInGeneralPurpose(e){if(!e)return null;if(e.length<2)throw new T;let t=e.substring(0,2);for(let n of We.TWO_DIGIT_DATA_LENGTH)if(n[0]===t)return n[1]===We.VARIABLE_LENGTH?We.processVariableAI(2,n[2],e):We.processFixedAI(2,n[1],e);if(e.length<3)throw new T;let n=e.substring(0,3);for(let t of We.THREE_DIGIT_DATA_LENGTH)if(t[0]===n)return t[1]===We.VARIABLE_LENGTH?We.processVariableAI(3,t[2],e):We.processFixedAI(3,t[1],e);for(let t of We.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(t[0]===n)return t[1]===We.VARIABLE_LENGTH?We.processVariableAI(4,t[2],e):We.processFixedAI(4,t[1],e);if(e.length<4)throw new T;let r=e.substring(0,4);for(let t of We.FOUR_DIGIT_DATA_LENGTH)if(t[0]===r)return t[1]===We.VARIABLE_LENGTH?We.processVariableAI(4,t[2],e):We.processFixedAI(4,t[1],e);throw new T}static processFixedAI(e,t,n){if(n.length<e)throw new T;let r=n.substring(0,e);if(n.length<e+t)throw new T;let i=n.substring(e,e+t),o=n.substring(e+t),s="("+r+")"+i,a=We.parseFieldsInGeneralPurpose(o);return null==a?s:s+a}static processVariableAI(e,t,n){let r,i=n.substring(0,e);r=n.length<e+t?n.length:e+t;let o=n.substring(e,r),s=n.substring(r),a="("+i+")"+o,l=We.parseFieldsInGeneralPurpose(s);return null==l?a:a+l}}We.VARIABLE_LENGTH=[],We.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",We.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",We.VARIABLE_LENGTH,20],["22",We.VARIABLE_LENGTH,29],["30",We.VARIABLE_LENGTH,8],["37",We.VARIABLE_LENGTH,8],["90",We.VARIABLE_LENGTH,30],["91",We.VARIABLE_LENGTH,30],["92",We.VARIABLE_LENGTH,30],["93",We.VARIABLE_LENGTH,30],["94",We.VARIABLE_LENGTH,30],["95",We.VARIABLE_LENGTH,30],["96",We.VARIABLE_LENGTH,30],["97",We.VARIABLE_LENGTH,3],["98",We.VARIABLE_LENGTH,30],["99",We.VARIABLE_LENGTH,30]],We.THREE_DIGIT_DATA_LENGTH=[["240",We.VARIABLE_LENGTH,30],["241",We.VARIABLE_LENGTH,30],["242",We.VARIABLE_LENGTH,6],["250",We.VARIABLE_LENGTH,30],["251",We.VARIABLE_LENGTH,30],["253",We.VARIABLE_LENGTH,17],["254",We.VARIABLE_LENGTH,20],["400",We.VARIABLE_LENGTH,30],["401",We.VARIABLE_LENGTH,30],["402",17],["403",We.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",We.VARIABLE_LENGTH,20],["421",We.VARIABLE_LENGTH,15],["422",3],["423",We.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],We.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",We.VARIABLE_LENGTH,15],["391",We.VARIABLE_LENGTH,18],["392",We.VARIABLE_LENGTH,15],["393",We.VARIABLE_LENGTH,18],["703",We.VARIABLE_LENGTH,30]],We.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",We.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",We.VARIABLE_LENGTH,20],["8003",We.VARIABLE_LENGTH,30],["8004",We.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",We.VARIABLE_LENGTH,30],["8008",We.VARIABLE_LENGTH,12],["8018",18],["8020",We.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",We.VARIABLE_LENGTH,70],["8200",We.VARIABLE_LENGTH,70]];class ze{constructor(e){this.buffer=new S,this.information=e}decodeAllCodes(e,t){let n=t,r=null;for(;;){let t=this.decodeGeneralPurposeField(n,r),i=We.parseFieldsInGeneralPurpose(t.getNewString());if(null!=i&&e.append(i),r=t.isRemaining()?""+t.getRemainingValue():null,n===t.getNewPosition())break;n=t.getNewPosition()}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 t=this.extractNumericValueFromBitArray(e,4);return new Ue(this.information.getSize(),0===t?Ue.FNC1:t-1,Ue.FNC1)}let t=this.extractNumericValueFromBitArray(e,7);return new Ue(e+7,(t-8)/11,(t-8)%11)}extractNumericValueFromBitArray(e,t){return ze.extractNumericValueFromBitArray(this.information,e,t)}static extractNumericValueFromBitArray(e,t,n){let r=0;for(let i=0;i<n;++i)e.get(t+i)&&(r|=1<<n-i-1);return r}decodeGeneralPurposeField(e,t){this.buffer.setLengthToZero(),null!=t&&this.buffer.append(t),this.current.setPosition(e);let n=this.parseBlocks();return null!=n&&n.isRemaining()?new Ve(this.current.getPosition(),this.buffer.toString(),n.getRemainingValue()):new Ve(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 t=e.isSecondDigitFNC1()?new Ve(this.current.getPosition(),this.buffer.toString()):new Ve(this.current.getPosition(),this.buffer.toString(),e.getSecondDigit()),new Be(!0,t)}if(this.buffer.append(e.getFirstDigit()),e.isSecondDigitFNC1()){let e=new Ve(this.current.getPosition(),this.buffer.toString());return new Be(!0,e)}this.buffer.append(e.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new Be(!1)}parseIsoIec646Block(){for(;this.isStillIsoIec646(this.current.getPosition());){let e=this.decodeIsoIec646(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1()){let e=new Ve(this.current.getPosition(),this.buffer.toString());return new Be(!0,e)}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 Be(!1)}parseAlphaBlock(){for(;this.isStillAlpha(this.current.getPosition());){let e=this.decodeAlphanumeric(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1()){let e=new Ve(this.current.getPosition(),this.buffer.toString());return new Be(!0,e)}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 Be(!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(15===t)return new Fe(e+5,Fe.FNC1);if(t>=5&&t<15)return new Fe(e+5,"0"+(t-5));let n,r=this.extractNumericValueFromBitArray(e,7);if(r>=64&&r<90)return new Fe(e+7,""+(r+1));if(r>=90&&r<116)return new Fe(e+7,""+(r+7));switch(this.extractNumericValueFromBitArray(e,8)){case 232:n="!";break;case 233:n='"';break;case 234:n="%";break;case 235:n="&";break;case 236:n="'";break;case 237:n="(";break;case 238:n=")";break;case 239:n="*";break;case 240:n="+";break;case 241:n=",";break;case 242:n="-";break;case 243:n=".";break;case 244:n="/";break;case 245:n=":";break;case 246:n=";";break;case 247:n="<";break;case 248:n="=";break;case 249:n=">";break;case 250:n="?";break;case 251:n="_";break;case 252:n=" ";break;default:throw new _}return new Fe(e+8,n)}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(15===t)return new Fe(e+5,Fe.FNC1);if(t>=5&&t<15)return new Fe(e+5,"0"+(t-5));let n,r=this.extractNumericValueFromBitArray(e,6);if(r>=32&&r<58)return new Fe(e+6,""+(r+33));switch(r){case 58:n="*";break;case 59:n=",";break;case 60:n="-";break;case 61:n=".";break;case 62:n="/";break;default:throw new te("Decoding invalid alphanumeric value: "+r)}return new Fe(e+6,n)}isAlphaTo646ToAlphaLatch(e){if(e+1>this.information.getSize())return!1;for(let t=0;t<5&&t+e<this.information.getSize();++t)if(2===t){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 He{constructor(e){this.information=e,this.generalDecoder=new ze(e)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class je extends He{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 n=0;n<4;++n){let r=this.getGeneralDecoder().extractNumericValueFromBitArray(t+10*n,10);r/100==0&&e.append("0"),r/10==0&&e.append("0"),e.append(r)}je.appendCheckDigit(e,n)}static appendCheckDigit(e,t){let n=0;for(let r=0;r<13;r++){let i=e.charAt(r+t).charCodeAt(0)-"0".charCodeAt(0);n+=1&r?i:3*i}n=10-n%10,10===n&&(n=0),e.append(n)}}je.GTIN_SIZE=40;class qe extends je{constructor(e){super(e)}parseInformation(){let e=new S;e.append("(01)");let t=e.length(),n=this.getGeneralDecoder().extractNumericValueFromBitArray(qe.HEADER_SIZE,4);return e.append(n),this.encodeCompressedGtinWithoutAI(e,qe.HEADER_SIZE+4,t),this.getGeneralDecoder().decodeAllCodes(e,qe.HEADER_SIZE+44)}}qe.HEADER_SIZE=4;class Ge extends He{constructor(e){super(e)}parseInformation(){let e=new S;return this.getGeneralDecoder().decodeAllCodes(e,Ge.HEADER_SIZE)}}Ge.HEADER_SIZE=5;class Xe extends je{constructor(e){super(e)}encodeCompressedWeight(e,t,n){let r=this.getGeneralDecoder().extractNumericValueFromBitArray(t,n);this.addWeightCode(e,r);let i=this.checkWeight(r),o=1e5;for(let t=0;t<5;++t)i/o===0&&e.append("0"),o/=10;e.append(i)}}class Ye extends Xe{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()!=Ye.HEADER_SIZE+Xe.GTIN_SIZE+Ye.WEIGHT_SIZE)throw new T;let e=new S;return this.encodeCompressedGtin(e,Ye.HEADER_SIZE),this.encodeCompressedWeight(e,Ye.HEADER_SIZE+Xe.GTIN_SIZE,Ye.WEIGHT_SIZE),e.toString()}}Ye.HEADER_SIZE=5,Ye.WEIGHT_SIZE=15;class Ze extends Ye{constructor(e){super(e)}addWeightCode(e,t){e.append("(3103)")}checkWeight(e){return e}}class Ke extends Ye{constructor(e){super(e)}addWeightCode(e,t){t<1e4?e.append("(3202)"):e.append("(3203)")}checkWeight(e){return e<1e4?e:e-1e4}}class Qe extends je{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<Qe.HEADER_SIZE+je.GTIN_SIZE)throw new T;let e=new S;this.encodeCompressedGtin(e,Qe.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(Qe.HEADER_SIZE+je.GTIN_SIZE,Qe.LAST_DIGIT_SIZE);e.append("(392"),e.append(t),e.append(")");let n=this.getGeneralDecoder().decodeGeneralPurposeField(Qe.HEADER_SIZE+je.GTIN_SIZE+Qe.LAST_DIGIT_SIZE,null);return e.append(n.getNewString()),e.toString()}}Qe.HEADER_SIZE=8,Qe.LAST_DIGIT_SIZE=2;class Je extends je{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<Je.HEADER_SIZE+je.GTIN_SIZE)throw new T;let e=new S;this.encodeCompressedGtin(e,Je.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(Je.HEADER_SIZE+je.GTIN_SIZE,Je.LAST_DIGIT_SIZE);e.append("(393"),e.append(t),e.append(")");let n=this.getGeneralDecoder().extractNumericValueFromBitArray(Je.HEADER_SIZE+je.GTIN_SIZE+Je.LAST_DIGIT_SIZE,Je.FIRST_THREE_DIGITS_SIZE);n/100==0&&e.append("0"),n/10==0&&e.append("0"),e.append(n);let r=this.getGeneralDecoder().decodeGeneralPurposeField(Je.HEADER_SIZE+je.GTIN_SIZE+Je.LAST_DIGIT_SIZE+Je.FIRST_THREE_DIGITS_SIZE,null);return e.append(r.getNewString()),e.toString()}}Je.HEADER_SIZE=8,Je.LAST_DIGIT_SIZE=2,Je.FIRST_THREE_DIGITS_SIZE=10;class et extends Xe{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 T;let e=new S;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(38400==n)return;e.append("("),e.append(this.dateCode),e.append(")");let r=n%32;n/=32;let i=n%12+1;n/=12;let o=n;o/10==0&&e.append("0"),e.append(o),i/10==0&&e.append("0"),e.append(i),r/10==0&&e.append("0"),e.append(r)}addWeightCode(e,t){e.append("("),e.append(this.firstAIdigits),e.append(t/1e5),e.append(")")}checkWeight(e){return e%1e5}}function tt(e){try{if(e.get(1))return new qe(e);if(!e.get(2))return new Ge(e);switch(ze.extractNumericValueFromBitArray(e,1,4)){case 4:return new Ze(e);case 5:return new Ke(e)}switch(ze.extractNumericValueFromBitArray(e,1,5)){case 12:return new Qe(e);case 13:return new Je(e)}switch(ze.extractNumericValueFromBitArray(e,1,7)){case 56:return new et(e,"310","11");case 57:return new et(e,"320","11");case 58:return new et(e,"310","13");case 59:return new et(e,"320","13");case 60:return new et(e,"310","15");case 61:return new et(e,"320","15");case 62:return new et(e,"310","17");case 63:return new et(e,"320","17")}}catch(t){throw console.log(t),new te("unknown decoder: "+e)}}et.HEADER_SIZE=8,et.WEIGHT_SIZE=20,et.DATE_SIZE=16;class nt{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 null==this.rightchar}toString(){return"[ "+this.leftchar+", "+this.rightchar+" : "+(null==this.finderpattern?"null":this.finderpattern.getValue())+" ]"}static equals(e,t){return e instanceof nt&&nt.equalsOrNull(e.leftchar,t.leftchar)&&nt.equalsOrNull(e.rightchar,t.rightchar)&&nt.equalsOrNull(e.finderpattern,t.finderpattern)}static equalsOrNull(e,t){return null===e?null===t:nt.equals(e,t)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class rt{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 rt&&this.checkEqualitity(e,t)&&e.wasReversed===t.wasReversed}checkEqualitity(e,t){if(!e||!t)return;let n;return e.forEach((e,r)=>{t.forEach(t=>{e.getLeftChar().getValue()===t.getLeftChar().getValue()&&e.getRightChar().getValue()===t.getRightChar().getValue()&&e.getFinderPatter().getValue()===t.getFinderPatter().getValue()&&(n=!0)})}),n}}class it extends xe{constructor(e){super(...arguments),this.pairs=new Array(it.MAX_PAIRS),this.rows=new Array,this.startEnd=[2],this.verbose=!0===e}decodeRow(e,t,n){this.pairs.length=0,this.startFromEven=!1;try{return it.constructResult(this.decodeRow2pairs(e,t))}catch(e){this.verbose&&console.log(e)}return this.pairs.length=0,this.startFromEven=!0,it.constructResult(this.decodeRow2pairs(e,t))}reset(){this.pairs.length=0,this.rows.length=0}decodeRow2pairs(e,t){let n,r=!1;for(;!r;)try{this.pairs.push(this.retrieveNextPair(t,this.pairs,e))}catch(e){if(e instanceof T){if(!this.pairs.length)throw new T;r=!0}}if(this.checkChecksum())return this.pairs;if(n=!!this.rows.length,this.storeRow(e,!1),n){let e=this.checkRowsBoolean(!1);if(null!=e)return e;if(e=this.checkRowsBoolean(!0),null!=e)return e}throw new T}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(e){this.verbose&&console.log(e)}return e&&(this.rows=this.rows.reverse()),t}checkRows(e,t){for(let n=t;n<this.rows.length;n++){let t=this.rows[n];this.pairs.length=0;for(let t of e)this.pairs.push(t.getPairs());if(this.pairs.push(t.getPairs()),!it.isValidSequence(this.pairs))continue;if(this.checkChecksum())return this.pairs;let r=new Array(e);r.push(t);try{return this.checkRows(r,n+1)}catch(e){this.verbose&&console.log(e)}}throw new T}static isValidSequence(e){for(let t of it.FINDER_PATTERN_SEQUENCES){if(e.length>t.length)continue;let n=!0;for(let r=0;r<e.length;r++)if(e[r].getFinderPattern().getValue()!=t[r]){n=!1;break}if(n)return!0}return!1}storeRow(e,t){let n=0,r=!1,i=!1;for(;n<this.rows.length;){let t=this.rows[n];if(t.getRowNumber()>e){i=t.isEquivalent(this.pairs);break}r=t.isEquivalent(this.pairs),n++}i||r||it.isPartialRow(this.pairs,this.rows)||(this.rows.push(n,new rt(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 t of n.getPairs())for(let n of e)if(nt.equals(t,n))break}static isPartialRow(e,t){for(let n of t){let t=!0;for(let r of e){let e=!1;for(let t of n.getPairs())if(r.equals(t)){e=!0;break}if(!e){t=!1;break}}if(t)return!0}return!1}getRows(){return this.rows}static constructResult(e){let t=tt(Pe.buildBitArray(e)).parseInformation(),n=e[0].getFinderPattern().getResultPoints(),r=e[e.length-1].getFinderPattern().getResultPoints(),i=[n[0],n[1],r[0],r[1]];return new F(t,null,null,i,U.RSS_EXPANDED,null)}checkChecksum(){let e=this.pairs.get(0),t=e.getLeftChar(),n=e.getRightChar();if(null==n)return!1;let r=n.getChecksumPortion(),i=2;for(let e=1;e<this.pairs.size();++e){let t=this.pairs.get(e);r+=t.getLeftChar().getChecksumPortion(),i++;let n=t.getRightChar();null!=n&&(r+=n.getChecksumPortion(),i++)}return r%=211,211*(i-4)+r==t.getValue()}static getNextSecondBar(e,t){let n;return e.get(t)?(n=e.getNextUnset(t),n=e.getNextSet(n)):(n=e.getNextSet(t),n=e.getNextUnset(n)),n}retrieveNextPair(e,t,n){let r,i=t.length%2==0;this.startFromEven&&(i=!i);let o=!0,s=-1;do{this.findNextPair(e,t,s),r=this.parseFoundFinderPattern(e,n,i),null==r?s=it.getNextSecondBar(e,this.startEnd[0]):o=!1}while(o);let a,l=this.decodeDataCharacter(e,r,i,!0);if(!this.isEmptyPair(t)&&t[t.length-1].mustBeLast())throw new T;try{a=this.decodeDataCharacter(e,r,i,!1)}catch(e){a=null,this.verbose&&console.log(e)}return new nt(l,a,r,!0)}isEmptyPair(e){return 0===e.length}findNextPair(e,t,n){let r=this.getDecodeFinderCounters();r[0]=0,r[1]=0,r[2]=0,r[3]=0;let i,o=e.getSize();i=n>=0?n:this.isEmptyPair(t)?0:t[t.length-1].getFinderPattern().getStartEnd()[1];let s=t.length%2!=0;this.startFromEven&&(s=!s);let a=!1;for(;i<o&&(a=!e.get(i),a);)i++;let l=0,c=i;for(let t=i;t<o;t++)if(e.get(t)!=a)r[l]++;else{if(3==l){if(s&&it.reverseCounters(r),it.isFinderPattern(r))return this.startEnd[0]=c,void(this.startEnd[1]=t);s&&it.reverseCounters(r),c+=r[0]+r[1],r[0]=r[2],r[1]=r[3],r[2]=0,r[3]=0,l--}else l++;r[l]=1,a=!a}throw new T}static reverseCounters(e){let t=e.length;for(let n=0;n<t/2;++n){let r=e[n];e[n]=e[t-n-1],e[t-n-1]=r}}parseFoundFinderPattern(e,t,n){let r,i,o;if(n){let t=this.startEnd[0]-1;for(;t>=0&&!e.get(t);)t--;t++,r=this.startEnd[0]-t,i=t,o=this.startEnd[1]}else i=this.startEnd[0],o=e.getNextUnset(this.startEnd[1]+1),r=o-this.startEnd[1];let s,a=this.getDecodeFinderCounters();m.arraycopy(a,0,a,1,a.length-1),a[0]=r;try{s=this.parseFinderValue(a,it.FINDER_PATTERNS)}catch(e){return null}return new Oe(s,[i,o],i,o,t)}decodeDataCharacter(e,t,n,r){let i=this.getDataCharacterCounters();for(let e=0;e<i.length;e++)i[e]=0;if(r)it.recordPatternInReverse(e,t.getStartEnd()[0],i);else{it.recordPattern(e,t.getStartEnd()[1],i);for(let e=0,t=i.length-1;e<t;e++,t--){let n=i[e];i[e]=i[t],i[t]=n}}let o=17,s=ie.sum(new Int32Array(i))/o,a=(t.getStartEnd()[1]-t.getStartEnd()[0])/15;if(Math.abs(s-a)/a>.3)throw new T;let l=this.getOddCounts(),c=this.getEvenCounts(),d=this.getOddRoundingErrors(),u=this.getEvenRoundingErrors();for(let e=0;e<i.length;e++){let t=1*i[e]/s,n=t+.5;if(n<1){if(t<.3)throw new T;n=1}else if(n>8){if(t>8.7)throw new T;n=8}let r=e/2;1&e?(c[r]=n,u[r]=t-n):(l[r]=n,d[r]=t-n)}this.adjustOddEvenCounts(o);let f=4*t.getValue()+(n?0:2)+(r?0:1)-1,h=0,m=0;for(let e=l.length-1;e>=0;e--){if(it.isNotA1left(t,n,r)){let t=it.WEIGHTS[f][2*e];m+=l[e]*t}h+=l[e]}let p=0;for(let e=c.length-1;e>=0;e--)if(it.isNotA1left(t,n,r)){let t=it.WEIGHTS[f][2*e+1];p+=c[e]*t}let g=m+p;if(1&h||h>13||h<4)throw new T;let w=(13-h)/2,y=it.SYMBOL_WIDEST[w],v=9-y,$=Me.getRSSvalue(l,y,!0),I=Me.getRSSvalue(c,v,!1),_=it.EVEN_TOTAL_SUBSET[w],C=it.GSUM[w];return new ke($*_+I+C,g)}static isNotA1left(e,t,n){return!(0==e.getValue()&&t&&n)}adjustOddEvenCounts(e){let t=ie.sum(new Int32Array(this.getOddCounts())),n=ie.sum(new Int32Array(this.getEvenCounts())),r=!1,i=!1;t>13?i=!0:t<4&&(r=!0);let o=!1,s=!1;n>13?s=!0:n<4&&(o=!0);let a=t+n-e,l=!(1&~t),c=!(1&n);if(1==a)if(l){if(c)throw new T;i=!0}else{if(!c)throw new T;s=!0}else if(-1==a)if(l){if(c)throw new T;r=!0}else{if(!c)throw new T;o=!0}else{if(0!=a)throw new T;if(l){if(!c)throw new T;t<n?(r=!0,s=!0):(i=!0,o=!0)}else if(c)throw new T}if(r){if(i)throw new T;it.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(i&&it.decrement(this.getOddCounts(),this.getOddRoundingErrors()),o){if(s)throw new T;it.increment(this.getEvenCounts(),this.getOddRoundingErrors())}s&&it.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}it.SYMBOL_WIDEST=[7,5,4,3,1],it.EVEN_TOTAL_SUBSET=[4,20,52,104,204],it.GSUM=[0,348,1388,2948,3988],it.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])],it.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]],it.FINDER_PAT_A=0,it.FINDER_PAT_B=1,it.FINDER_PAT_C=2,it.FINDER_PAT_D=3,it.FINDER_PAT_E=4,it.FINDER_PAT_F=5,it.FINDER_PATTERN_SEQUENCES=[[it.FINDER_PAT_A,it.FINDER_PAT_A],[it.FINDER_PAT_A,it.FINDER_PAT_B,it.FINDER_PAT_B],[it.FINDER_PAT_A,it.FINDER_PAT_C,it.FINDER_PAT_B,it.FINDER_PAT_D],[it.FINDER_PAT_A,it.FINDER_PAT_E,it.FINDER_PAT_B,it.FINDER_PAT_D,it.FINDER_PAT_C],[it.FINDER_PAT_A,it.FINDER_PAT_E,it.FINDER_PAT_B,it.FINDER_PAT_D,it.FINDER_PAT_D,it.FINDER_PAT_F],[it.FINDER_PAT_A,it.FINDER_PAT_E,it.FINDER_PAT_B,it.FINDER_PAT_D,it.FINDER_PAT_E,it.FINDER_PAT_F,it.FINDER_PAT_F],[it.FINDER_PAT_A,it.FINDER_PAT_A,it.FINDER_PAT_B,it.FINDER_PAT_B,it.FINDER_PAT_C,it.FINDER_PAT_C,it.FINDER_PAT_D,it.FINDER_PAT_D],[it.FINDER_PAT_A,it.FINDER_PAT_A,it.FINDER_PAT_B,it.FINDER_PAT_B,it.FINDER_PAT_C,it.FINDER_PAT_C,it.FINDER_PAT_D,it.FINDER_PAT_E,it.FINDER_PAT_E],[it.FINDER_PAT_A,it.FINDER_PAT_A,it.FINDER_PAT_B,it.FINDER_PAT_B,it.FINDER_PAT_C,it.FINDER_PAT_C,it.FINDER_PAT_D,it.FINDER_PAT_E,it.FINDER_PAT_F,it.FINDER_PAT_F],[it.FINDER_PAT_A,it.FINDER_PAT_A,it.FINDER_PAT_B,it.FINDER_PAT_B,it.FINDER_PAT_C,it.FINDER_PAT_D,it.FINDER_PAT_D,it.FINDER_PAT_E,it.FINDER_PAT_E,it.FINDER_PAT_F,it.FINDER_PAT_F]],it.MAX_PAIRS=11;class ot extends ke{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 st extends xe{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(e,t,n){const r=this.decodePair(t,!1,e,n);st.addOrTally(this.possibleLeftPairs,r),t.reverse();let i=this.decodePair(t,!0,e,n);st.addOrTally(this.possibleRightPairs,i),t.reverse();for(let e of this.possibleLeftPairs)if(e.getCount()>1)for(let t of this.possibleRightPairs)if(t.getCount()>1&&st.checkChecksum(e,t))return st.constructResult(e,t);throw new T}static addOrTally(e,t){if(null==t)return;let n=!1;for(let r of e)if(r.getValue()===t.getValue()){r.incrementCount(),n=!0;break}n||e.push(t)}reset(){this.possibleLeftPairs.length=0,this.possibleRightPairs.length=0}static constructResult(e,t){let n=4537077*e.getValue()+t.getValue(),r=new String(n).toString(),i=new S;for(let e=13-r.length;e>0;e--)i.append("0");i.append(r);let o=0;for(let e=0;e<13;e++){let t=i.charAt(e).charCodeAt(0)-"0".charCodeAt(0);o+=1&e?t:3*t}o=10-o%10,10===o&&(o=0),i.append(o.toString());let s=e.getFinderPattern().getResultPoints(),a=t.getFinderPattern().getResultPoints();return new F(i.toString(),null,0,[s[0],s[1],a[0],a[1]],U.RSS_14,(new Date).getTime())}static checkChecksum(e,t){let n=(e.getChecksumPortion()+16*t.getChecksumPortion())%79,r=9*e.getFinderPattern().getValue()+t.getFinderPattern().getValue();return r>72&&r--,r>8&&r--,n===r}decodePair(e,t,n,r){try{let i=this.findFinderPattern(e,t),o=this.parseFoundFinderPattern(e,n,t,i),s=null==r?null:r.get(I.NEED_RESULT_POINT_CALLBACK);if(null!=s){let r=(i[0]+i[1])/2;t&&(r=e.getSize()-1-r),s.foundPossibleResultPoint(new se(r,n))}let a=this.decodeDataCharacter(e,o,!0),l=this.decodeDataCharacter(e,o,!1);return new ot(1597*a.getValue()+l.getValue(),a.getChecksumPortion()+4*l.getChecksumPortion(),o)}catch(e){return null}}decodeDataCharacter(e,t,n){let r=this.getDataCharacterCounters();for(let e=0;e<r.length;e++)r[e]=0;if(n)ye.recordPatternInReverse(e,t.getStartEnd()[0],r);else{ye.recordPattern(e,t.getStartEnd()[1]+1,r);for(let e=0,t=r.length-1;e<t;e++,t--){let n=r[e];r[e]=r[t],r[t]=n}}let i=n?16:15,o=ie.sum(new Int32Array(r))/i,s=this.getOddCounts(),a=this.getEvenCounts(),l=this.getOddRoundingErrors(),c=this.getEvenRoundingErrors();for(let e=0;e<r.length;e++){let t=r[e]/o,n=Math.floor(t+.5);n<1?n=1:n>8&&(n=8);let i=Math.floor(e/2);1&e?(a[i]=n,c[i]=t-n):(s[i]=n,l[i]=t-n)}this.adjustOddEvenCounts(n,i);let d=0,u=0;for(let e=s.length-1;e>=0;e--)u*=9,u+=s[e],d+=s[e];let f=0,h=0;for(let e=a.length-1;e>=0;e--)f*=9,f+=a[e],h+=a[e];let m=u+3*f;if(n){if(1&d||d>12||d<4)throw new T;let e=(12-d)/2,t=st.OUTSIDE_ODD_WIDEST[e],n=9-t,r=Me.getRSSvalue(s,t,!1),i=Me.getRSSvalue(a,n,!0),o=st.OUTSIDE_EVEN_TOTAL_SUBSET[e],l=st.OUTSIDE_GSUM[e];return new ke(r*o+i+l,m)}{if(1&h||h>10||h<4)throw new T;let e=(10-h)/2,t=st.INSIDE_ODD_WIDEST[e],n=9-t,r=Me.getRSSvalue(s,t,!0),i=Me.getRSSvalue(a,n,!1),o=st.INSIDE_ODD_TOTAL_SUBSET[e],l=st.INSIDE_GSUM[e];return new ke(i*o+r+l,m)}}findFinderPattern(e,t){let n=this.getDecodeFinderCounters();n[0]=0,n[1]=0,n[2]=0,n[3]=0;let r=e.getSize(),i=!1,o=0;for(;o<r&&(i=!e.get(o),t!==i);)o++;let s=0,a=o;for(let t=o;t<r;t++)if(e.get(t)!==i)n[s]++;else{if(3===s){if(xe.isFinderPattern(n))return[a,t];a+=n[0]+n[1],n[0]=n[2],n[1]=n[3],n[2]=0,n[3]=0,s--}else s++;n[s]=1,i=!i}throw new T}parseFoundFinderPattern(e,t,n,r){let i=e.get(r[0]),o=r[0]-1;for(;o>=0&&i!==e.get(o);)o--;o++;const s=r[0]-o,a=this.getDecodeFinderCounters(),l=new Int32Array(a.length);m.arraycopy(a,0,l,1,a.length-1),l[0]=s;const c=this.parseFinderValue(l,st.FINDER_PATTERNS);let d=o,u=r[1];return n&&(d=e.getSize()-1-d,u=e.getSize()-1-u),new Oe(c,[o,r[1]],d,u,t)}adjustOddEvenCounts(e,t){let n=ie.sum(new Int32Array(this.getOddCounts())),r=ie.sum(new Int32Array(this.getEvenCounts())),i=!1,o=!1,s=!1,a=!1;e?(n>12?o=!0:n<4&&(i=!0),r>12?a=!0:r<4&&(s=!0)):(n>11?o=!0:n<5&&(i=!0),r>10?a=!0:r<4&&(s=!0));let l=n+r-t,c=(1&n)==(e?1:0),d=!(1&~r);if(1===l)if(c){if(d)throw new T;o=!0}else{if(!d)throw new T;a=!0}else if(-1===l)if(c){if(d)throw new T;i=!0}else{if(!d)throw new T;s=!0}else{if(0!==l)throw new T;if(c){if(!d)throw new T;n<r?(i=!0,a=!0):(o=!0,s=!0)}else if(d)throw new T}if(i){if(o)throw new T;xe.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(o&&xe.decrement(this.getOddCounts(),this.getOddRoundingErrors()),s){if(a)throw new T;xe.increment(this.getEvenCounts(),this.getOddRoundingErrors())}a&&xe.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}st.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],st.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],st.OUTSIDE_GSUM=[0,161,961,2015,2715],st.INSIDE_GSUM=[0,336,1036,1516],st.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],st.INSIDE_ODD_WIDEST=[2,4,6,8],st.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 at extends ye{constructor(e,t){super(),this.readers=[],this.verbose=!0===t;const n=e?e.get(I.POSSIBLE_FORMATS):null,r=e&&void 0!==e.get(I.ASSUME_CODE_39_CHECK_DIGIT);n?((n.includes(U.EAN_13)||n.includes(U.UPC_A)||n.includes(U.EAN_8)||n.includes(U.UPC_E))&&this.readers.push(new De(e)),n.includes(U.CODE_39)&&this.readers.push(new $e(r)),n.includes(U.CODE_128)&&this.readers.push(new ve),n.includes(U.ITF)&&this.readers.push(new Ie),n.includes(U.RSS_14)&&this.readers.push(new st),n.includes(U.RSS_EXPANDED)&&this.readers.push(new it(this.verbose))):(this.readers.push(new De(e)),this.readers.push(new $e),this.readers.push(new De(e)),this.readers.push(new ve),this.readers.push(new Ie),this.readers.push(new st),this.readers.push(new it(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(e){}throw new T}reset(){this.readers.forEach(e=>e.reset())}}class lt extends L{constructor(e=500,t){super(new at(t),e,t)}}class ct{constructor(e,t,n){this.ecCodewords=e,this.ecBlocks=[t],n&&this.ecBlocks.push(n)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class dt{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class ut{constructor(e,t,n,r,i,o){this.versionNumber=e,this.symbolSizeRows=t,this.symbolSizeColumns=n,this.dataRegionSizeRows=r,this.dataRegionSizeColumns=i,this.ecBlocks=o;let s=0;const a=o.getECCodewords(),l=o.getECBlocks();for(let e of l)s+=e.getCount()*(e.getDataCodewords()+a);this.totalCodewords=s}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(1&e||1&t)throw new _;for(let n of ut.VERSIONS)if(n.symbolSizeRows===e&&n.symbolSizeColumns===t)return n;throw new _}toString(){return""+this.versionNumber}static buildVersions(){return[new ut(1,10,10,8,8,new ct(5,new dt(1,3))),new ut(2,12,12,10,10,new ct(7,new dt(1,5))),new ut(3,14,14,12,12,new ct(10,new dt(1,8))),new ut(4,16,16,14,14,new ct(12,new dt(1,12))),new ut(5,18,18,16,16,new ct(14,new dt(1,18))),new ut(6,20,20,18,18,new ct(18,new dt(1,22))),new ut(7,22,22,20,20,new ct(20,new dt(1,30))),new ut(8,24,24,22,22,new ct(24,new dt(1,36))),new ut(9,26,26,24,24,new ct(28,new dt(1,44))),new ut(10,32,32,14,14,new ct(36,new dt(1,62))),new ut(11,36,36,16,16,new ct(42,new dt(1,86))),new ut(12,40,40,18,18,new ct(48,new dt(1,114))),new ut(13,44,44,20,20,new ct(56,new dt(1,144))),new ut(14,48,48,22,22,new ct(68,new dt(1,174))),new ut(15,52,52,24,24,new ct(42,new dt(2,102))),new ut(16,64,64,14,14,new ct(56,new dt(2,140))),new ut(17,72,72,16,16,new ct(36,new dt(4,92))),new ut(18,80,80,18,18,new ct(48,new dt(4,114))),new ut(19,88,88,20,20,new ct(56,new dt(4,144))),new ut(20,96,96,22,22,new ct(68,new dt(4,174))),new ut(21,104,104,24,24,new ct(56,new dt(6,136))),new ut(22,120,120,18,18,new ct(68,new dt(6,175))),new ut(23,132,132,20,20,new ct(62,new dt(8,163))),new ut(24,144,144,22,22,new ct(62,new dt(8,156),new dt(2,155))),new ut(25,8,18,6,16,new ct(7,new dt(1,5))),new ut(26,8,32,6,14,new ct(11,new dt(1,10))),new ut(27,12,26,10,24,new ct(14,new dt(1,16))),new ut(28,12,36,10,16,new ct(18,new dt(1,22))),new ut(29,16,36,14,16,new ct(24,new dt(1,32))),new ut(30,16,48,14,22,new ct(28,new dt(1,49)))]}}ut.VERSIONS=ut.buildVersions();class ft{constructor(e){const t=e.getHeight();if(t<8||t>144||1&t)throw new _;this.version=ft.readVersion(e),this.mappingBitMatrix=this.extractDataRegion(e),this.readMappingMatrix=new N(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(e){const t=e.getHeight(),n=e.getWidth();return ut.getVersionForDimensions(t,n)}readCodewords(){const e=new Int8Array(this.version.getTotalCodewords());let t=0,n=4,r=0;const i=this.mappingBitMatrix.getHeight(),o=this.mappingBitMatrix.getWidth();let s=!1,a=!1,l=!1,c=!1;do{if(n!==i||0!==r||s)if(n===i-2&&0===r&&3&o&&!a)e[t++]=255&this.readCorner2(i,o),n-=2,r+=2,a=!0;else if(n!==i+4||2!==r||7&o||l)if(n!==i-2||0!==r||4!=(7&o)||c){do{n<i&&r>=0&&!this.readMappingMatrix.get(r,n)&&(e[t++]=255&this.readUtah(n,r,i,o)),n-=2,r+=2}while(n>=0&&r<o);n+=1,r+=3;do{n>=0&&r<o&&!this.readMappingMatrix.get(r,n)&&(e[t++]=255&this.readUtah(n,r,i,o)),n+=2,r-=2}while(n<i&&r>=0);n+=3,r+=1}else e[t++]=255&this.readCorner4(i,o),n-=2,r+=2,c=!0;else e[t++]=255&this.readCorner3(i,o),n-=2,r+=2,l=!0;else e[t++]=255&this.readCorner1(i,o),n-=2,r+=2,s=!0}while(n<i||r<o);if(t!==this.version.getTotalCodewords())throw new _;return e}readModule(e,t,n,r){return e<0&&(e+=n,t+=4-(n+4&7)),t<0&&(t+=r,e+=4-(r+4&7)),this.readMappingMatrix.set(t,e),this.mappingBitMatrix.get(t,e)}readUtah(e,t,n,r){let i=0;return this.readModule(e-2,t-2,n,r)&&(i|=1),i<<=1,this.readModule(e-2,t-1,n,r)&&(i|=1),i<<=1,this.readModule(e-1,t-2,n,r)&&(i|=1),i<<=1,this.readModule(e-1,t-1,n,r)&&(i|=1),i<<=1,this.readModule(e-1,t,n,r)&&(i|=1),i<<=1,this.readModule(e,t-2,n,r)&&(i|=1),i<<=1,this.readModule(e,t-1,n,r)&&(i|=1),i<<=1,this.readModule(e,t,n,r)&&(i|=1),i}readCorner1(e,t){let n=0;return this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,1,e,t)&&(n|=1),n<<=1,this.readModule(e-1,2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(2,t-1,e,t)&&(n|=1),n<<=1,this.readModule(3,t-1,e,t)&&(n|=1),n}readCorner2(e,t){let n=0;return this.readModule(e-3,0,e,t)&&(n|=1),n<<=1,this.readModule(e-2,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(0,t-4,e,t)&&(n|=1),n<<=1,this.readModule(0,t-3,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n}readCorner3(e,t){let n=0;return this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(0,t-3,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-3,e,t)&&(n|=1),n<<=1,this.readModule(1,t-2,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n}readCorner4(e,t){let n=0;return this.readModule(e-3,0,e,t)&&(n|=1),n<<=1,this.readModule(e-2,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(2,t-1,e,t)&&(n|=1),n<<=1,this.readModule(3,t-1,e,t)&&(n|=1),n}extractDataRegion(e){const t=this.version.getSymbolSizeRows(),n=this.version.getSymbolSizeColumns();if(e.getHeight()!==t)throw new d("Dimension of bitMatrix must match the version size");const r=this.version.getDataRegionSizeRows(),i=this.version.getDataRegionSizeColumns(),o=t/r|0,s=n/i|0,a=new N(s*i,o*r);for(let t=0;t<o;++t){const n=t*r;for(let o=0;o<s;++o){const s=o*i;for(let l=0;l<r;++l){const c=t*(r+2)+1+l,d=n+l;for(let t=0;t<i;++t){const n=o*(i+2)+1+t;if(e.get(n,c)){const e=s+t;a.set(e,d)}}}}}return a}}class ht{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t){const n=t.getECBlocks();let r=0;const i=n.getECBlocks();for(let e of i)r+=e.getCount();const o=new Array(r);let s=0;for(let e of i)for(let t=0;t<e.getCount();t++){const t=e.getDataCodewords(),r=n.getECCodewords()+t;o[s++]=new ht(t,new Uint8Array(r))}const a=o[0].codewords.length-n.getECCodewords(),l=a-1;let c=0;for(let t=0;t<l;t++)for(let n=0;n<s;n++)o[n].codewords[t]=e[c++];const u=24===t.getVersionNumber(),f=u?8:s;for(let t=0;t<f;t++)o[t].codewords[a-1]=e[c++];const h=o[0].codewords.length;for(let t=a;t<h;t++)for(let n=0;n<s;n++){const r=u?(n+8)%s:n,i=u&&r>7?t-1:t;o[r].codewords[i]=e[c++]}if(c!==e.length)throw new d;return o}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class mt{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 d(""+e);let t=0,n=this.bitOffset,r=this.byteOffset;const i=this.bytes;if(n>0){const o=8-n,s=e<o?e:o,a=o-s,l=255>>8-s<<a;t=(i[r]&l)>>a,e-=s,n+=s,8===n&&(n=0,r++)}if(e>0){for(;e>=8;)t=t<<8|255&i[r],r++,e-=8;if(e>0){const o=8-e,s=255>>o<<o;t=t<<e|(i[r]&s)>>o,n+=e}}return this.bitOffset=n,this.byteOffset=r,t}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}!function(e){e[e.PAD_ENCODE=0]="PAD_ENCODE",e[e.ASCII_ENCODE=1]="ASCII_ENCODE",e[e.C40_ENCODE=2]="C40_ENCODE",e[e.TEXT_ENCODE=3]="TEXT_ENCODE",e[e.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",e[e.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",e[e.BASE256_ENCODE=6]="BASE256_ENCODE"}(z||(z={}));class pt{static decode(e){const t=new mt(e),n=new S,r=new S,i=new Array;let o=z.ASCII_ENCODE;do{if(o===z.ASCII_ENCODE)o=this.decodeAsciiSegment(t,n,r);else{switch(o){case z.C40_ENCODE:this.decodeC40Segment(t,n);break;case z.TEXT_ENCODE:this.decodeTextSegment(t,n);break;case z.ANSIX12_ENCODE:this.decodeAnsiX12Segment(t,n);break;case z.EDIFACT_ENCODE:this.decodeEdifactSegment(t,n);break;case z.BASE256_ENCODE:this.decodeBase256Segment(t,n,i);break;default:throw new _}o=z.ASCII_ENCODE}}while(o!==z.PAD_ENCODE&&t.available()>0);return r.length()>0&&n.append(r.toString()),new Y(e,n.toString(),0===i.length?null:i,null)}static decodeAsciiSegment(e,t,n){let r=!1;do{let i=e.readBits(8);if(0===i)throw new _;if(i<=128)return r&&(i+=128),t.append(String.fromCharCode(i-1)),z.ASCII_ENCODE;if(129===i)return z.PAD_ENCODE;if(i<=229){const e=i-130;e<10&&t.append("0"),t.append(""+e)}else switch(i){case 230:return z.C40_ENCODE;case 231:return z.BASE256_ENCODE;case 232:t.append(String.fromCharCode(29));break;case 233:case 234:case 241: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 z.ANSIX12_ENCODE;case 239:return z.TEXT_ENCODE;case 240:return z.EDIFACT_ENCODE;default:if(254!==i||0!==e.available())throw new _}}while(e.available()>0);return z.ASCII_ENCODE}static decodeC40Segment(e,t){let n=!1;const r=[];let i=0;do{if(8===e.available())return;const o=e.readBits(8);if(254===o)return;this.parseTwoBytes(o,e.readBits(8),r);for(let e=0;e<3;e++){const o=r[e];switch(i){case 0:if(o<3)i=o+1;else{if(!(o<this.C40_BASIC_SET_CHARS.length))throw new _;{const e=this.C40_BASIC_SET_CHARS[o];n?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),n=!1):t.append(e)}}break;case 1:n?(t.append(String.fromCharCode(o+128)),n=!1):t.append(String.fromCharCode(o)),i=0;break;case 2:if(o<this.C40_SHIFT2_SET_CHARS.length){const e=this.C40_SHIFT2_SET_CHARS[o];n?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),n=!1):t.append(e)}else switch(o){case 27:t.append(String.fromCharCode(29));break;case 30:n=!0;break;default:throw new _}i=0;break;case 3:n?(t.append(String.fromCharCode(o+224)),n=!1):t.append(String.fromCharCode(o+96)),i=0;break;default:throw new _}}}while(e.available()>0)}static decodeTextSegment(e,t){let n=!1,r=[],i=0;do{if(8===e.available())return;const o=e.readBits(8);if(254===o)return;this.parseTwoBytes(o,e.readBits(8),r);for(let e=0;e<3;e++){const o=r[e];switch(i){case 0:if(o<3)i=o+1;else{if(!(o<this.TEXT_BASIC_SET_CHARS.length))throw new _;{const e=this.TEXT_BASIC_SET_CHARS[o];n?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),n=!1):t.append(e)}}break;case 1:n?(t.append(String.fromCharCode(o+128)),n=!1):t.append(String.fromCharCode(o)),i=0;break;case 2:if(o<this.TEXT_SHIFT2_SET_CHARS.length){const e=this.TEXT_SHIFT2_SET_CHARS[o];n?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),n=!1):t.append(e)}else switch(o){case 27:t.append(String.fromCharCode(29));break;case 30:n=!0;break;default:throw new _}i=0;break;case 3:if(!(o<this.TEXT_SHIFT3_SET_CHARS.length))throw new _;{const e=this.TEXT_SHIFT3_SET_CHARS[o];n?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),n=!1):t.append(e),i=0}break;default:throw new _}}}while(e.available()>0)}static decodeAnsiX12Segment(e,t){const n=[];do{if(8===e.available())return;const r=e.readBits(8);if(254===r)return;this.parseTwoBytes(r,e.readBits(8),n);for(let e=0;e<3;e++){const r=n[e];switch(r){case 0:t.append("\r");break;case 1:t.append("*");break;case 2:t.append(">");break;case 3:t.append(" ");break;default:if(r<14)t.append(String.fromCharCode(r+44));else{if(!(r<40))throw new _;t.append(String.fromCharCode(r+51))}}}}while(e.available()>0)}static parseTwoBytes(e,t,n){let r=(e<<8)+t-1,i=Math.floor(r/1600);n[0]=i,r-=1600*i,i=Math.floor(r/40),n[1]=i,n[2]=r-40*i}static decodeEdifactSegment(e,t){do{if(e.available()<=16)return;for(let n=0;n<4;n++){let n=e.readBits(6);if(31===n){const t=8-e.getBitOffset();return void(8!==t&&e.readBits(t))}32&n||(n|=64),t.append(String.fromCharCode(n))}}while(e.available()>0)}static decodeBase256Segment(e,t,n){let r=1+e.getByteOffset();const i=this.unrandomize255State(e.readBits(8),r++);let o;if(o=0===i?e.available()/8|0:i<250?i:250*(i-249)+this.unrandomize255State(e.readBits(8),r++),o<0)throw new _;const s=new Uint8Array(o);for(let t=0;t<o;t++){if(e.available()<8)throw new _;s[t]=this.unrandomize255State(e.readBits(8),r++)}n.push(s);try{t.append(A.decode(s,b.ISO88591))}catch(e){throw new te("Platform does not support required encoding: "+e.message)}}static unrandomize255State(e,t){const n=e-(149*t%255+1);return n>=0?n:n+256}}pt.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"],pt.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],pt.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"],pt.TEXT_SHIFT2_SET_CHARS=pt.C40_SHIFT2_SET_CHARS,pt.TEXT_SHIFT3_SET_CHARS=["`","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","{","|","}","~",String.fromCharCode(127)];class gt{constructor(){this.rsDecoder=new ne(J.DATA_MATRIX_FIELD_256)}decode(e){const t=new ft(e),n=t.getVersion(),r=t.readCodewords(),i=ht.getDataBlocks(r,n);let o=0;for(let e of i)o+=e.getNumDataCodewords();const s=new Uint8Array(o),a=i.length;for(let e=0;e<a;e++){const t=i[e],n=t.getCodewords(),r=t.getNumDataCodewords();this.correctErrors(n,r);for(let t=0;t<r;t++)s[t*a+e]=n[t]}return pt.decode(s)}correctErrors(e,t){const n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch(e){throw new f}for(let r=0;r<t;r++)e[r]=n[r]}}class wt{constructor(e){this.image=e,this.rectangleDetector=new ce(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 T;t=this.shiftToModuleCenter(t);const n=t[0],r=t[1],i=t[2],o=t[3];let s=this.transitionsBetween(n,o)+1,a=this.transitionsBetween(i,o)+1;1&~s||(s+=1),1&~a||(a+=1),4*s<7*a&&4*a<7*s&&(s=a=Math.max(s,a));let l=wt.sampleGrid(this.image,n,r,i,o,s,a);return new ae(l,[n,r,i,o])}static shiftPoint(e,t,n){let r=(t.getX()-e.getX())/(n+1),i=(t.getY()-e.getY())/(n+1);return new se(e.getX()+r,e.getY()+i)}static moveAway(e,t,n){let r=e.getX(),i=e.getY();return r<t?r-=1:r+=1,i<n?i-=1:i+=1,new se(r,i)}detectSolid1(e){let t=e[0],n=e[1],r=e[3],i=e[2],o=this.transitionsBetween(t,n),s=this.transitionsBetween(n,r),a=this.transitionsBetween(r,i),l=this.transitionsBetween(i,t),c=o,d=[i,t,n,r];return c>s&&(c=s,d[0]=t,d[1]=n,d[2]=r,d[3]=i),c>a&&(c=a,d[0]=n,d[1]=r,d[2]=i,d[3]=t),c>l&&(d[0]=r,d[1]=i,d[2]=t,d[3]=n),d}detectSolid2(e){let t=e[0],n=e[1],r=e[2],i=e[3],o=this.transitionsBetween(t,i),s=wt.shiftPoint(n,r,4*(o+1)),a=wt.shiftPoint(r,n,4*(o+1));return this.transitionsBetween(s,t)<this.transitionsBetween(a,i)?(e[0]=t,e[1]=n,e[2]=r,e[3]=i):(e[0]=n,e[1]=r,e[2]=i,e[3]=t),e}correctTopRight(e){let t=e[0],n=e[1],r=e[2],i=e[3],o=this.transitionsBetween(t,i),s=this.transitionsBetween(n,i),a=wt.shiftPoint(t,n,4*(s+1)),l=wt.shiftPoint(r,n,4*(o+1));o=this.transitionsBetween(a,i),s=this.transitionsBetween(l,i);let c=new se(i.getX()+(r.getX()-n.getX())/(o+1),i.getY()+(r.getY()-n.getY())/(o+1)),d=new se(i.getX()+(t.getX()-n.getX())/(s+1),i.getY()+(t.getY()-n.getY())/(s+1));return this.isValid(c)?this.isValid(d)?this.transitionsBetween(a,c)+this.transitionsBetween(l,c)>this.transitionsBetween(a,d)+this.transitionsBetween(l,d)?c:d:c:this.isValid(d)?d:null}shiftToModuleCenter(e){let t=e[0],n=e[1],r=e[2],i=e[3],o=this.transitionsBetween(t,i)+1,s=this.transitionsBetween(r,i)+1,a=wt.shiftPoint(t,n,4*s),l=wt.shiftPoint(r,n,4*o);o=this.transitionsBetween(a,i)+1,s=this.transitionsBetween(l,i)+1,1&~o||(o+=1),1&~s||(s+=1);let c,d,u=(t.getX()+n.getX()+r.getX()+i.getX())/4,f=(t.getY()+n.getY()+r.getY()+i.getY())/4;return t=wt.moveAway(t,u,f),n=wt.moveAway(n,u,f),r=wt.moveAway(r,u,f),i=wt.moveAway(i,u,f),a=wt.shiftPoint(t,n,4*s),a=wt.shiftPoint(a,i,4*o),c=wt.shiftPoint(n,t,4*s),c=wt.shiftPoint(c,r,4*o),l=wt.shiftPoint(r,i,4*s),l=wt.shiftPoint(l,n,4*o),d=wt.shiftPoint(i,r,4*s),d=wt.shiftPoint(d,t,4*o),[a,c,l,d]}isValid(e){return e.getX()>=0&&e.getX()<this.image.getWidth()&&e.getY()>0&&e.getY()<this.image.getHeight()}static sampleGrid(e,t,n,r,i,o,s){return he.getInstance().sampleGrid(e,o,s,.5,.5,o-.5,.5,o-.5,s-.5,.5,s-.5,t.getX(),t.getY(),i.getX(),i.getY(),r.getX(),r.getY(),n.getX(),n.getY())}transitionsBetween(e,t){let n=Math.trunc(e.getX()),r=Math.trunc(e.getY()),i=Math.trunc(t.getX()),o=Math.trunc(t.getY()),s=Math.abs(o-r)>Math.abs(i-n);if(s){let e=n;n=r,r=e,e=i,i=o,o=e}let a=Math.abs(i-n),l=Math.abs(o-r),c=-a/2,d=r<o?1:-1,u=n<i?1:-1,f=0,h=this.image.get(s?r:n,s?n:r);for(let e=n,t=r;e!==i;e+=u){let n=this.image.get(s?t:e,s?e:t);if(n!==h&&(f++,h=n),c+=l,c>0){if(t===o)break;t+=d,c-=a}}return f}}class yt{constructor(){this.decoder=new gt}decode(e,t=null){let n,r;if(null!=t&&t.has(I.PURE_BARCODE)){const t=yt.extractPureBits(e.getBlackMatrix());n=this.decoder.decode(t),r=yt.NO_POINTS}else{const t=new wt(e.getBlackMatrix()).detect();n=this.decoder.decode(t.getBits()),r=t.getPoints()}const i=n.getRawBytes(),o=new F(n.getText(),i,8*i.length,r,U.DATA_MATRIX,m.currentTimeMillis()),s=n.getByteSegments();null!=s&&o.putMetadata(X.BYTE_SEGMENTS,s);const a=n.getECLevel();return null!=a&&o.putMetadata(X.ERROR_CORRECTION_LEVEL,a),o}reset(){}static extractPureBits(e){const t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(null==t||null==n)throw new T;const r=this.moduleSize(t,e);let i=t[1];const o=n[1];let s=t[0];const a=(n[0]-s+1)/r,l=(o-i+1)/r;if(a<=0||l<=0)throw new T;const c=r/2;i+=c,s+=c;const d=new N(a,l);for(let t=0;t<l;t++){const n=i+t*r;for(let i=0;i<a;i++)e.get(s+i*r,n)&&d.set(i,t)}return d}static moduleSize(e,t){const n=t.getWidth();let r=e[0];const i=e[1];for(;r<n&&t.get(r,i);)r++;if(r===n)throw new T;const o=r-e[0];if(0===o)throw new T;return o}}yt.NO_POINTS=[];class vt extends L{constructor(e=500){super(new yt,e)}}!function(e){e[e.L=0]="L",e[e.M=1]="M",e[e.Q=2]="Q",e[e.H=3]="H"}(H||(H={}));class $t{constructor(e,t,n){this.value=e,this.stringValue=t,this.bits=n,$t.FOR_BITS.set(n,this),$t.FOR_VALUE.set(e,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(e){switch(e){case"L":return $t.L;case"M":return $t.M;case"Q":return $t.Q;case"H":return $t.H;default:throw new c(e+"not available")}}toString(){return this.stringValue}equals(e){if(!(e instanceof $t))return!1;const t=e;return this.value===t.value}static forBits(e){if(e<0||e>=$t.FOR_BITS.size)throw new d;return $t.FOR_BITS.get(e)}}$t.FOR_BITS=new Map,$t.FOR_VALUE=new Map,$t.L=new $t(H.L,"L",1),$t.M=new $t(H.M,"M",0),$t.Q=new $t(H.Q,"Q",3),$t.H=new $t(H.H,"H",2);class It{constructor(e){this.errorCorrectionLevel=$t.forBits(e>>3&3),this.dataMask=7&e}static numBitsDiffering(e,t){return y.bitCount(e^t)}static decodeFormatInformation(e,t){const n=It.doDecodeFormatInformation(e,t);return null!==n?n:It.doDecodeFormatInformation(e^It.FORMAT_INFO_MASK_QR,t^It.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(e,t){let n=Number.MAX_SAFE_INTEGER,r=0;for(const i of It.FORMAT_INFO_DECODE_LOOKUP){const o=i[0];if(o===e||o===t)return new It(i[1]);let s=It.numBitsDiffering(e,o);s<n&&(r=i[1],n=s),e!==t&&(s=It.numBitsDiffering(t,o),s<n&&(r=i[1],n=s))}return n<=3?new It(r):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(e){if(!(e instanceof It))return!1;const t=e;return this.errorCorrectionLevel===t.errorCorrectionLevel&&this.dataMask===t.dataMask}}It.FORMAT_INFO_MASK_QR=21522,It.FORMAT_INFO_DECODE_LOOKUP=[Int32Array.from([21522,0]),Int32Array.from([20773,1]),Int32Array.from([24188,2]),Int32Array.from([23371,3]),Int32Array.from([17913,4]),Int32Array.from([16590,5]),Int32Array.from([20375,6]),Int32Array.from([19104,7]),Int32Array.from([30660,8]),Int32Array.from([29427,9]),Int32Array.from([32170,10]),Int32Array.from([30877,11]),Int32Array.from([26159,12]),Int32Array.from([25368,13]),Int32Array.from([27713,14]),Int32Array.from([26998,15]),Int32Array.from([5769,16]),Int32Array.from([5054,17]),Int32Array.from([7399,18]),Int32Array.from([6608,19]),Int32Array.from([1890,20]),Int32Array.from([597,21]),Int32Array.from([3340,22]),Int32Array.from([2107,23]),Int32Array.from([13663,24]),Int32Array.from([12392,25]),Int32Array.from([16177,26]),Int32Array.from([14854,27]),Int32Array.from([9396,28]),Int32Array.from([8579,29]),Int32Array.from([11994,30]),Int32Array.from([11245,31])];class _t{constructor(e,...t){this.ecCodewordsPerBlock=e,this.ecBlocks=t}getECCodewordsPerBlock(){return this.ecCodewordsPerBlock}getNumBlocks(){let e=0;const t=this.ecBlocks;for(const n of t)e+=n.getCount();return e}getTotalECCodewords(){return this.ecCodewordsPerBlock*this.getNumBlocks()}getECBlocks(){return this.ecBlocks}}class Ct{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class Et{constructor(e,t,...n){this.versionNumber=e,this.alignmentPatternCenters=t,this.ecBlocks=n;let r=0;const i=n[0].getECCodewordsPerBlock(),o=n[0].getECBlocks();for(const e of o)r+=e.getCount()*(e.getDataCodewords()+i);this.totalCodewords=r}getVersionNumber(){return this.versionNumber}getAlignmentPatternCenters(){return this.alignmentPatternCenters}getTotalCodewords(){return this.totalCodewords}getDimensionForVersion(){return 17+4*this.versionNumber}getECBlocksForLevel(e){return this.ecBlocks[e.getValue()]}static getProvisionalVersionForDimension(e){if(e%4!=1)throw new _;try{return this.getVersionForNumber((e-17)/4)}catch(e){throw new _}}static getVersionForNumber(e){if(e<1||e>40)throw new d;return Et.VERSIONS[e-1]}static decodeVersionInformation(e){let t=Number.MAX_SAFE_INTEGER,n=0;for(let r=0;r<Et.VERSION_DECODE_INFO.length;r++){const i=Et.VERSION_DECODE_INFO[r];if(i===e)return Et.getVersionForNumber(r+7);const o=It.numBitsDiffering(e,i);o<t&&(n=r+7,t=o)}return t<=3?Et.getVersionForNumber(n):null}buildFunctionPattern(){const e=this.getDimensionForVersion(),t=new N(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 e=0;e<n;e++){const r=this.alignmentPatternCenters[e]-2;for(let i=0;i<n;i++)0===e&&(0===i||i===n-1)||e===n-1&&0===i||t.setRegion(this.alignmentPatternCenters[i]-2,r,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}}Et.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]),Et.VERSIONS=[new Et(1,new Int32Array(0),new _t(7,new Ct(1,19)),new _t(10,new Ct(1,16)),new _t(13,new Ct(1,13)),new _t(17,new Ct(1,9))),new Et(2,Int32Array.from([6,18]),new _t(10,new Ct(1,34)),new _t(16,new Ct(1,28)),new _t(22,new Ct(1,22)),new _t(28,new Ct(1,16))),new Et(3,Int32Array.from([6,22]),new _t(15,new Ct(1,55)),new _t(26,new Ct(1,44)),new _t(18,new Ct(2,17)),new _t(22,new Ct(2,13))),new Et(4,Int32Array.from([6,26]),new _t(20,new Ct(1,80)),new _t(18,new Ct(2,32)),new _t(26,new Ct(2,24)),new _t(16,new Ct(4,9))),new Et(5,Int32Array.from([6,30]),new _t(26,new Ct(1,108)),new _t(24,new Ct(2,43)),new _t(18,new Ct(2,15),new Ct(2,16)),new _t(22,new Ct(2,11),new Ct(2,12))),new Et(6,Int32Array.from([6,34]),new _t(18,new Ct(2,68)),new _t(16,new Ct(4,27)),new _t(24,new Ct(4,19)),new _t(28,new Ct(4,15))),new Et(7,Int32Array.from([6,22,38]),new _t(20,new Ct(2,78)),new _t(18,new Ct(4,31)),new _t(18,new Ct(2,14),new Ct(4,15)),new _t(26,new Ct(4,13),new Ct(1,14))),new Et(8,Int32Array.from([6,24,42]),new _t(24,new Ct(2,97)),new _t(22,new Ct(2,38),new Ct(2,39)),new _t(22,new Ct(4,18),new Ct(2,19)),new _t(26,new Ct(4,14),new Ct(2,15))),new Et(9,Int32Array.from([6,26,46]),new _t(30,new Ct(2,116)),new _t(22,new Ct(3,36),new Ct(2,37)),new _t(20,new Ct(4,16),new Ct(4,17)),new _t(24,new Ct(4,12),new Ct(4,13))),new Et(10,Int32Array.from([6,28,50]),new _t(18,new Ct(2,68),new Ct(2,69)),new _t(26,new Ct(4,43),new Ct(1,44)),new _t(24,new Ct(6,19),new Ct(2,20)),new _t(28,new Ct(6,15),new Ct(2,16))),new Et(11,Int32Array.from([6,30,54]),new _t(20,new Ct(4,81)),new _t(30,new Ct(1,50),new Ct(4,51)),new _t(28,new Ct(4,22),new Ct(4,23)),new _t(24,new Ct(3,12),new Ct(8,13))),new Et(12,Int32Array.from([6,32,58]),new _t(24,new Ct(2,92),new Ct(2,93)),new _t(22,new Ct(6,36),new Ct(2,37)),new _t(26,new Ct(4,20),new Ct(6,21)),new _t(28,new Ct(7,14),new Ct(4,15))),new Et(13,Int32Array.from([6,34,62]),new _t(26,new Ct(4,107)),new _t(22,new Ct(8,37),new Ct(1,38)),new _t(24,new Ct(8,20),new Ct(4,21)),new _t(22,new Ct(12,11),new Ct(4,12))),new Et(14,Int32Array.from([6,26,46,66]),new _t(30,new Ct(3,115),new Ct(1,116)),new _t(24,new Ct(4,40),new Ct(5,41)),new _t(20,new Ct(11,16),new Ct(5,17)),new _t(24,new Ct(11,12),new Ct(5,13))),new Et(15,Int32Array.from([6,26,48,70]),new _t(22,new Ct(5,87),new Ct(1,88)),new _t(24,new Ct(5,41),new Ct(5,42)),new _t(30,new Ct(5,24),new Ct(7,25)),new _t(24,new Ct(11,12),new Ct(7,13))),new Et(16,Int32Array.from([6,26,50,74]),new _t(24,new Ct(5,98),new Ct(1,99)),new _t(28,new Ct(7,45),new Ct(3,46)),new _t(24,new Ct(15,19),new Ct(2,20)),new _t(30,new Ct(3,15),new Ct(13,16))),new Et(17,Int32Array.from([6,30,54,78]),new _t(28,new Ct(1,107),new Ct(5,108)),new _t(28,new Ct(10,46),new Ct(1,47)),new _t(28,new Ct(1,22),new Ct(15,23)),new _t(28,new Ct(2,14),new Ct(17,15))),new Et(18,Int32Array.from([6,30,56,82]),new _t(30,new Ct(5,120),new Ct(1,121)),new _t(26,new Ct(9,43),new Ct(4,44)),new _t(28,new Ct(17,22),new Ct(1,23)),new _t(28,new Ct(2,14),new Ct(19,15))),new Et(19,Int32Array.from([6,30,58,86]),new _t(28,new Ct(3,113),new Ct(4,114)),new _t(26,new Ct(3,44),new Ct(11,45)),new _t(26,new Ct(17,21),new Ct(4,22)),new _t(26,new Ct(9,13),new Ct(16,14))),new Et(20,Int32Array.from([6,34,62,90]),new _t(28,new Ct(3,107),new Ct(5,108)),new _t(26,new Ct(3,41),new Ct(13,42)),new _t(30,new Ct(15,24),new Ct(5,25)),new _t(28,new Ct(15,15),new Ct(10,16))),new Et(21,Int32Array.from([6,28,50,72,94]),new _t(28,new Ct(4,116),new Ct(4,117)),new _t(26,new Ct(17,42)),new _t(28,new Ct(17,22),new Ct(6,23)),new _t(30,new Ct(19,16),new Ct(6,17))),new Et(22,Int32Array.from([6,26,50,74,98]),new _t(28,new Ct(2,111),new Ct(7,112)),new _t(28,new Ct(17,46)),new _t(30,new Ct(7,24),new Ct(16,25)),new _t(24,new Ct(34,13))),new Et(23,Int32Array.from([6,30,54,78,102]),new _t(30,new Ct(4,121),new Ct(5,122)),new _t(28,new Ct(4,47),new Ct(14,48)),new _t(30,new Ct(11,24),new Ct(14,25)),new _t(30,new Ct(16,15),new Ct(14,16))),new Et(24,Int32Array.from([6,28,54,80,106]),new _t(30,new Ct(6,117),new Ct(4,118)),new _t(28,new Ct(6,45),new Ct(14,46)),new _t(30,new Ct(11,24),new Ct(16,25)),new _t(30,new Ct(30,16),new Ct(2,17))),new Et(25,Int32Array.from([6,32,58,84,110]),new _t(26,new Ct(8,106),new Ct(4,107)),new _t(28,new Ct(8,47),new Ct(13,48)),new _t(30,new Ct(7,24),new Ct(22,25)),new _t(30,new Ct(22,15),new Ct(13,16))),new Et(26,Int32Array.from([6,30,58,86,114]),new _t(28,new Ct(10,114),new Ct(2,115)),new _t(28,new Ct(19,46),new Ct(4,47)),new _t(28,new Ct(28,22),new Ct(6,23)),new _t(30,new Ct(33,16),new Ct(4,17))),new Et(27,Int32Array.from([6,34,62,90,118]),new _t(30,new Ct(8,122),new Ct(4,123)),new _t(28,new Ct(22,45),new Ct(3,46)),new _t(30,new Ct(8,23),new Ct(26,24)),new _t(30,new Ct(12,15),new Ct(28,16))),new Et(28,Int32Array.from([6,26,50,74,98,122]),new _t(30,new Ct(3,117),new Ct(10,118)),new _t(28,new Ct(3,45),new Ct(23,46)),new _t(30,new Ct(4,24),new Ct(31,25)),new _t(30,new Ct(11,15),new Ct(31,16))),new Et(29,Int32Array.from([6,30,54,78,102,126]),new _t(30,new Ct(7,116),new Ct(7,117)),new _t(28,new Ct(21,45),new Ct(7,46)),new _t(30,new Ct(1,23),new Ct(37,24)),new _t(30,new Ct(19,15),new Ct(26,16))),new Et(30,Int32Array.from([6,26,52,78,104,130]),new _t(30,new Ct(5,115),new Ct(10,116)),new _t(28,new Ct(19,47),new Ct(10,48)),new _t(30,new Ct(15,24),new Ct(25,25)),new _t(30,new Ct(23,15),new Ct(25,16))),new Et(31,Int32Array.from([6,30,56,82,108,134]),new _t(30,new Ct(13,115),new Ct(3,116)),new _t(28,new Ct(2,46),new Ct(29,47)),new _t(30,new Ct(42,24),new Ct(1,25)),new _t(30,new Ct(23,15),new Ct(28,16))),new Et(32,Int32Array.from([6,34,60,86,112,138]),new _t(30,new Ct(17,115)),new _t(28,new Ct(10,46),new Ct(23,47)),new _t(30,new Ct(10,24),new Ct(35,25)),new _t(30,new Ct(19,15),new Ct(35,16))),new Et(33,Int32Array.from([6,30,58,86,114,142]),new _t(30,new Ct(17,115),new Ct(1,116)),new _t(28,new Ct(14,46),new Ct(21,47)),new _t(30,new Ct(29,24),new Ct(19,25)),new _t(30,new Ct(11,15),new Ct(46,16))),new Et(34,Int32Array.from([6,34,62,90,118,146]),new _t(30,new Ct(13,115),new Ct(6,116)),new _t(28,new Ct(14,46),new Ct(23,47)),new _t(30,new Ct(44,24),new Ct(7,25)),new _t(30,new Ct(59,16),new Ct(1,17))),new Et(35,Int32Array.from([6,30,54,78,102,126,150]),new _t(30,new Ct(12,121),new Ct(7,122)),new _t(28,new Ct(12,47),new Ct(26,48)),new _t(30,new Ct(39,24),new Ct(14,25)),new _t(30,new Ct(22,15),new Ct(41,16))),new Et(36,Int32Array.from([6,24,50,76,102,128,154]),new _t(30,new Ct(6,121),new Ct(14,122)),new _t(28,new Ct(6,47),new Ct(34,48)),new _t(30,new Ct(46,24),new Ct(10,25)),new _t(30,new Ct(2,15),new Ct(64,16))),new Et(37,Int32Array.from([6,28,54,80,106,132,158]),new _t(30,new Ct(17,122),new Ct(4,123)),new _t(28,new Ct(29,46),new Ct(14,47)),new _t(30,new Ct(49,24),new Ct(10,25)),new _t(30,new Ct(24,15),new Ct(46,16))),new Et(38,Int32Array.from([6,32,58,84,110,136,162]),new _t(30,new Ct(4,122),new Ct(18,123)),new _t(28,new Ct(13,46),new Ct(32,47)),new _t(30,new Ct(48,24),new Ct(14,25)),new _t(30,new Ct(42,15),new Ct(32,16))),new Et(39,Int32Array.from([6,26,54,82,110,138,166]),new _t(30,new Ct(20,117),new Ct(4,118)),new _t(28,new Ct(40,47),new Ct(7,48)),new _t(30,new Ct(43,24),new Ct(22,25)),new _t(30,new Ct(10,15),new Ct(67,16))),new Et(40,Int32Array.from([6,30,58,86,114,142,170]),new _t(30,new Ct(19,118),new Ct(6,119)),new _t(28,new Ct(18,47),new Ct(31,48)),new _t(30,new Ct(34,24),new Ct(34,25)),new _t(30,new Ct(20,15),new Ct(61,16)))],function(e){e[e.DATA_MASK_000=0]="DATA_MASK_000",e[e.DATA_MASK_001=1]="DATA_MASK_001",e[e.DATA_MASK_010=2]="DATA_MASK_010",e[e.DATA_MASK_011=3]="DATA_MASK_011",e[e.DATA_MASK_100=4]="DATA_MASK_100",e[e.DATA_MASK_101=5]="DATA_MASK_101",e[e.DATA_MASK_110=6]="DATA_MASK_110",e[e.DATA_MASK_111=7]="DATA_MASK_111"}(j||(j={}));class At{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)}}At.values=new Map([[j.DATA_MASK_000,new At(j.DATA_MASK_000,(e,t)=>!(e+t&1))],[j.DATA_MASK_001,new At(j.DATA_MASK_001,(e,t)=>!(1&e))],[j.DATA_MASK_010,new At(j.DATA_MASK_010,(e,t)=>t%3==0)],[j.DATA_MASK_011,new At(j.DATA_MASK_011,(e,t)=>(e+t)%3==0)],[j.DATA_MASK_100,new At(j.DATA_MASK_100,(e,t)=>!(Math.floor(e/2)+Math.floor(t/3)&1))],[j.DATA_MASK_101,new At(j.DATA_MASK_101,(e,t)=>e*t%6==0)],[j.DATA_MASK_110,new At(j.DATA_MASK_110,(e,t)=>e*t%6<3)],[j.DATA_MASK_111,new At(j.DATA_MASK_111,(e,t)=>!(e+t+e*t%3&1))]]);class bt{constructor(e){const t=e.getHeight();if(t<21||1!=(3&t))throw new _;this.bitMatrix=e}readFormatInformation(){if(null!==this.parsedFormatInfo&&void 0!==this.parsedFormatInfo)return this.parsedFormatInfo;let e=0;for(let t=0;t<6;t++)e=this.copyBit(t,8,e);e=this.copyBit(7,8,e),e=this.copyBit(8,8,e),e=this.copyBit(8,7,e);for(let t=5;t>=0;t--)e=this.copyBit(8,t,e);const t=this.bitMatrix.getHeight();let n=0;const r=t-7;for(let e=t-1;e>=r;e--)n=this.copyBit(8,e,n);for(let e=t-8;e<t;e++)n=this.copyBit(e,8,n);if(this.parsedFormatInfo=It.decodeFormatInformation(e,n),null!==this.parsedFormatInfo)return this.parsedFormatInfo;throw new _}readVersion(){if(null!==this.parsedVersion&&void 0!==this.parsedVersion)return this.parsedVersion;const e=this.bitMatrix.getHeight(),t=Math.floor((e-17)/4);if(t<=6)return Et.getVersionForNumber(t);let n=0;const r=e-11;for(let t=5;t>=0;t--)for(let i=e-9;i>=r;i--)n=this.copyBit(i,t,n);let i=Et.decodeVersionInformation(n);if(null!==i&&i.getDimensionForVersion()===e)return this.parsedVersion=i,i;n=0;for(let t=5;t>=0;t--)for(let i=e-9;i>=r;i--)n=this.copyBit(t,i,n);if(i=Et.decodeVersionInformation(n),null!==i&&i.getDimensionForVersion()===e)return this.parsedVersion=i,i;throw new _}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=At.values.get(e.getDataMask()),r=this.bitMatrix.getHeight();n.unmaskBitMatrix(this.bitMatrix,r);const i=t.buildFunctionPattern();let o=!0;const s=new Uint8Array(t.getTotalCodewords());let a=0,l=0,c=0;for(let e=r-1;e>0;e-=2){6===e&&e--;for(let t=0;t<r;t++){const n=o?r-1-t:t;for(let t=0;t<2;t++)i.get(e-t,n)||(c++,l<<=1,this.bitMatrix.get(e-t,n)&&(l|=1),8===c&&(s[a++]=l,c=0,l=0))}o=!o}if(a!==t.getTotalCodewords())throw new _;return s}remask(){if(null===this.parsedFormatInfo)return;const e=At.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 n=t+1,r=e.getHeight();n<r;n++)e.get(t,n)!==e.get(n,t)&&(e.flip(n,t),e.flip(t,n))}}class St{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t,n){if(e.length!==t.getTotalCodewords())throw new d;const r=t.getECBlocksForLevel(n);let i=0;const o=r.getECBlocks();for(const e of o)i+=e.getCount();const s=new Array(i);let a=0;for(const e of o)for(let t=0;t<e.getCount();t++){const t=e.getDataCodewords(),n=r.getECCodewordsPerBlock()+t;s[a++]=new St(t,new Uint8Array(n))}const l=s[0].codewords.length;let c=s.length-1;for(;c>=0&&s[c].codewords.length!==l;)c--;c++;const u=l-r.getECCodewordsPerBlock();let f=0;for(let t=0;t<u;t++)for(let n=0;n<a;n++)s[n].codewords[t]=e[f++];for(let t=c;t<a;t++)s[t].codewords[u]=e[f++];const h=s[0].codewords.length;for(let t=u;t<h;t++)for(let n=0;n<a;n++){const r=n<c?t:t+1;s[n].codewords[r]=e[f++]}return s}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}!function(e){e[e.TERMINATOR=0]="TERMINATOR",e[e.NUMERIC=1]="NUMERIC",e[e.ALPHANUMERIC=2]="ALPHANUMERIC",e[e.STRUCTURED_APPEND=3]="STRUCTURED_APPEND",e[e.BYTE=4]="BYTE",e[e.ECI=5]="ECI",e[e.KANJI=6]="KANJI",e[e.FNC1_FIRST_POSITION=7]="FNC1_FIRST_POSITION",e[e.FNC1_SECOND_POSITION=8]="FNC1_SECOND_POSITION",e[e.HANZI=9]="HANZI"}(q||(q={}));class Nt{constructor(e,t,n,r){this.value=e,this.stringValue=t,this.characterCountBitsForVersions=n,this.bits=r,Nt.FOR_BITS.set(r,this),Nt.FOR_VALUE.set(e,this)}static forBits(e){const t=Nt.FOR_BITS.get(e);if(void 0===t)throw new d;return t}getCharacterCountBits(e){const t=e.getVersionNumber();let n;return n=t<=9?0:t<=26?1:2,this.characterCountBitsForVersions[n]}getValue(){return this.value}getBits(){return this.bits}equals(e){if(!(e instanceof Nt))return!1;const t=e;return this.value===t.value}toString(){return this.stringValue}}Nt.FOR_BITS=new Map,Nt.FOR_VALUE=new Map,Nt.TERMINATOR=new Nt(q.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),Nt.NUMERIC=new Nt(q.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),Nt.ALPHANUMERIC=new Nt(q.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),Nt.STRUCTURED_APPEND=new Nt(q.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),Nt.BYTE=new Nt(q.BYTE,"BYTE",Int32Array.from([8,16,16]),4),Nt.ECI=new Nt(q.ECI,"ECI",Int32Array.from([0,0,0]),7),Nt.KANJI=new Nt(q.KANJI,"KANJI",Int32Array.from([8,10,12]),8),Nt.FNC1_FIRST_POSITION=new Nt(q.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),Nt.FNC1_SECOND_POSITION=new Nt(q.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),Nt.HANZI=new Nt(q.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class Tt{static decode(e,t,n,r){const i=new mt(e);let o=new S;const s=new Array;let a=-1,l=-1;try{let e,n=null,c=!1;do{if(i.available()<4)e=Nt.TERMINATOR;else{const t=i.readBits(4);e=Nt.forBits(t)}switch(e){case Nt.TERMINATOR:break;case Nt.FNC1_FIRST_POSITION:case Nt.FNC1_SECOND_POSITION:c=!0;break;case Nt.STRUCTURED_APPEND:if(i.available()<16)throw new _;a=i.readBits(8),l=i.readBits(8);break;case Nt.ECI:const d=Tt.parseECIValue(i);if(n=C.getCharacterSetECIByValue(d),null===n)throw new _;break;case Nt.HANZI:const u=i.readBits(4),f=i.readBits(e.getCharacterCountBits(t));u===Tt.GB2312_SUBSET&&Tt.decodeHanziSegment(i,o,f);break;default:const h=i.readBits(e.getCharacterCountBits(t));switch(e){case Nt.NUMERIC:Tt.decodeNumericSegment(i,o,h);break;case Nt.ALPHANUMERIC:Tt.decodeAlphanumericSegment(i,o,h,c);break;case Nt.BYTE:Tt.decodeByteSegment(i,o,h,n,s,r);break;case Nt.KANJI:Tt.decodeKanjiSegment(i,o,h);break;default:throw new _}}}while(e!==Nt.TERMINATOR)}catch(e){throw new _}return new Y(e,o.toString(),0===s.length?null:s,null===n?null:n.toString(),a,l)}static decodeHanziSegment(e,t,n){if(13*n>e.available())throw new _;const r=new Uint8Array(2*n);let i=0;for(;n>0;){const t=e.readBits(13);let o=t/96<<8&4294967295|t%96;o+=o<959?41377:42657,r[i]=o>>8&255,r[i+1]=255&o,i+=2,n--}try{t.append(A.decode(r,b.GB2312))}catch(e){throw new _(e)}}static decodeKanjiSegment(e,t,n){if(13*n>e.available())throw new _;const r=new Uint8Array(2*n);let i=0;for(;n>0;){const t=e.readBits(13);let o=t/192<<8&4294967295|t%192;o+=o<7936?33088:49472,r[i]=o>>8,r[i+1]=o,i+=2,n--}try{t.append(A.decode(r,b.SHIFT_JIS))}catch(e){throw new _(e)}}static decodeByteSegment(e,t,n,r,i,o){if(8*n>e.available())throw new _;const s=new Uint8Array(n);for(let t=0;t<n;t++)s[t]=e.readBits(8);let a;a=null===r?b.guessEncoding(s,o):r.getName();try{t.append(A.decode(s,a))}catch(e){throw new _(e)}i.push(s)}static toAlphaNumericChar(e){if(e>=Tt.ALPHANUMERIC_CHARS.length)throw new _;return Tt.ALPHANUMERIC_CHARS[e]}static decodeAlphanumericSegment(e,t,n,r){const i=t.length();for(;n>1;){if(e.available()<11)throw new _;const r=e.readBits(11);t.append(Tt.toAlphaNumericChar(Math.floor(r/45))),t.append(Tt.toAlphaNumericChar(r%45)),n-=2}if(1===n){if(e.available()<6)throw new _;t.append(Tt.toAlphaNumericChar(e.readBits(6)))}if(r)for(let e=i;e<t.length();e++)"%"===t.charAt(e)&&(e<t.length()-1&&"%"===t.charAt(e+1)?t.deleteCharAt(e+1):t.setCharAt(e,String.fromCharCode(29)))}static decodeNumericSegment(e,t,n){for(;n>=3;){if(e.available()<10)throw new _;const r=e.readBits(10);if(r>=1e3)throw new _;t.append(Tt.toAlphaNumericChar(Math.floor(r/100))),t.append(Tt.toAlphaNumericChar(Math.floor(r/10)%10)),t.append(Tt.toAlphaNumericChar(r%10)),n-=3}if(2===n){if(e.available()<7)throw new _;const n=e.readBits(7);if(n>=100)throw new _;t.append(Tt.toAlphaNumericChar(Math.floor(n/10))),t.append(Tt.toAlphaNumericChar(n%10))}else if(1===n){if(e.available()<4)throw new _;const n=e.readBits(4);if(n>=10)throw new _;t.append(Tt.toAlphaNumericChar(n))}}static parseECIValue(e){const t=e.readBits(8);if(!(128&t))return 127&t;if(128==(192&t))return(63&t)<<8&4294967295|e.readBits(8);if(192==(224&t))return(31&t)<<16&4294967295|e.readBits(16);throw new _}}Tt.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Tt.GB2312_SUBSET=1;class Rt{constructor(e){this.mirrored=e}isMirrored(){return this.mirrored}applyMirroredCorrection(e){if(!this.mirrored||null===e||e.length<3)return;const t=e[0];e[0]=e[2],e[2]=t}}class Dt{constructor(){this.rsDecoder=new ne(J.QR_CODE_FIELD_256)}decodeBooleanArray(e,t){return this.decodeBitMatrix(N.parseFromBooleanArray(e),t)}decodeBitMatrix(e,t){const n=new bt(e);let r=null;try{return this.decodeBitMatrixParser(n,t)}catch(e){r=e}try{n.remask(),n.setMirror(!0),n.readVersion(),n.readFormatInformation(),n.mirror();const e=this.decodeBitMatrixParser(n,t);return e.setOther(new Rt(!0)),e}catch(e){if(null!==r)throw r;throw e}}decodeBitMatrixParser(e,t){const n=e.readVersion(),r=e.readFormatInformation().getErrorCorrectionLevel(),i=e.readCodewords(),o=St.getDataBlocks(i,n,r);let s=0;for(const e of o)s+=e.getNumDataCodewords();const a=new Uint8Array(s);let l=0;for(const e of o){const t=e.getCodewords(),n=e.getNumDataCodewords();this.correctErrors(t,n);for(let e=0;e<n;e++)a[l++]=t[e]}return Tt.decode(a,n,r,t)}correctErrors(e,t){const n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch(e){throw new f}for(let r=0;r<t;r++)e[r]=n[r]}}class xt extends se{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 t=Math.abs(e-this.estimatedModuleSize);return t<=1||t<=this.estimatedModuleSize}return!1}combineEstimate(e,t,n){const r=(this.getX()+t)/2,i=(this.getY()+e)/2,o=(this.estimatedModuleSize+n)/2;return new xt(r,i,o)}}class kt{constructor(e,t,n,r,i,o,s){this.image=e,this.startX=t,this.startY=n,this.width=r,this.height=i,this.moduleSize=o,this.resultPointCallback=s,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}find(){const e=this.startX,t=this.height,n=e+this.width,r=this.startY+t/2,i=new Int32Array(3),o=this.image;for(let s=0;s<t;s++){const t=r+(1&s?-Math.floor((s+1)/2):Math.floor((s+1)/2));i[0]=0,i[1]=0,i[2]=0;let a=e;for(;a<n&&!o.get(a,t);)a++;let l=0;for(;a<n;){if(o.get(a,t))if(1===l)i[1]++;else if(2===l){if(this.foundPatternCross(i)){const e=this.handlePossibleCenter(i,t,a);if(null!==e)return e}i[0]=i[2],i[1]=1,i[2]=0,l=1}else i[++l]++;else 1===l&&l++,i[l]++;a++}if(this.foundPatternCross(i)){const e=this.handlePossibleCenter(i,t,n);if(null!==e)return e}}if(0!==this.possibleCenters.length)return this.possibleCenters[0];throw new T}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 i=this.image,o=i.getHeight(),s=this.crossCheckStateCount;s[0]=0,s[1]=0,s[2]=0;let a=e;for(;a>=0&&i.get(t,a)&&s[1]<=n;)s[1]++,a--;if(a<0||s[1]>n)return NaN;for(;a>=0&&!i.get(t,a)&&s[0]<=n;)s[0]++,a--;if(s[0]>n)return NaN;for(a=e+1;a<o&&i.get(t,a)&&s[1]<=n;)s[1]++,a++;if(a===o||s[1]>n)return NaN;for(;a<o&&!i.get(t,a)&&s[2]<=n;)s[2]++,a++;if(s[2]>n)return NaN;const l=s[0]+s[1]+s[2];return 5*Math.abs(l-r)>=2*r?NaN:this.foundPatternCross(s)?kt.centerFromEnd(s,a):NaN}handlePossibleCenter(e,t,n){const r=e[0]+e[1]+e[2],i=kt.centerFromEnd(e,n),o=this.crossCheckVertical(t,i,2*e[1],r);if(!isNaN(o)){const t=(e[0]+e[1]+e[2])/3;for(const e of this.possibleCenters)if(e.aboutEquals(t,o,i))return e.combineEstimate(o,i,t);const n=new xt(i,o,t);this.possibleCenters.push(n),null!==this.resultPointCallback&&void 0!==this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(n)}return null}}class Ot extends se{constructor(e,t,n,r){super(e,t),this.estimatedModuleSize=n,this.count=r,void 0===r&&(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 t=Math.abs(e-this.estimatedModuleSize);return t<=1||t<=this.estimatedModuleSize}return!1}combineEstimate(e,t,n){const r=this.count+1,i=(this.count*this.getX()+t)/r,o=(this.count*this.getY()+e)/r,s=(this.count*this.estimatedModuleSize+n)/r;return new Ot(i,o,s,r)}}class Mt{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 Pt{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=null!=e&&void 0!==e.get(I.TRY_HARDER),n=null!=e&&void 0!==e.get(I.PURE_BARCODE),r=this.image,i=r.getHeight(),o=r.getWidth();let s=Math.floor(3*i/(4*Pt.MAX_MODULES));(s<Pt.MIN_SKIP||t)&&(s=Pt.MIN_SKIP);let a=!1;const l=new Int32Array(5);for(let e=s-1;e<i&&!a;e+=s){l[0]=0,l[1]=0,l[2]=0,l[3]=0,l[4]=0;let t=0;for(let i=0;i<o;i++)if(r.get(i,e))1&~t||t++,l[t]++;else if(1&t)l[t]++;else if(4===t)if(Pt.foundPatternCross(l)){if(!0!==this.handlePossibleCenter(l,e,i,n)){l[0]=l[2],l[1]=l[3],l[2]=l[4],l[3]=1,l[4]=0,t=3;continue}if(s=2,!0===this.hasSkipped)a=this.haveMultiplyConfirmedCenters();else{const t=this.findRowSkip();t>l[2]&&(e+=t-l[2]-s,i=o-1)}t=0,l[0]=0,l[1]=0,l[2]=0,l[3]=0,l[4]=0}else l[0]=l[2],l[1]=l[3],l[2]=l[4],l[3]=1,l[4]=0,t=3;else l[++t]++;Pt.foundPatternCross(l)&&!0===this.handlePossibleCenter(l,e,o,n)&&(s=l[0],this.hasSkipped&&(a=this.haveMultiplyConfirmedCenters()))}const c=this.selectBestPatterns();return se.orderBestPatterns(c),new Mt(c)}static centerFromEnd(e,t){return t-e[4]-e[3]-e[2]/2}static foundPatternCross(e){let t=0;for(let n=0;n<5;n++){const r=e[n];if(0===r)return!1;t+=r}if(t<7)return!1;const n=t/7,r=n/2;return Math.abs(n-e[0])<r&&Math.abs(n-e[1])<r&&Math.abs(3*n-e[2])<3*r&&Math.abs(n-e[3])<r&&Math.abs(n-e[4])<r}getCrossCheckStateCount(){const e=this.crossCheckStateCount;return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e}crossCheckDiagonal(e,t,n,r){const i=this.getCrossCheckStateCount();let o=0;const s=this.image;for(;e>=o&&t>=o&&s.get(t-o,e-o);)i[2]++,o++;if(e<o||t<o)return!1;for(;e>=o&&t>=o&&!s.get(t-o,e-o)&&i[1]<=n;)i[1]++,o++;if(e<o||t<o||i[1]>n)return!1;for(;e>=o&&t>=o&&s.get(t-o,e-o)&&i[0]<=n;)i[0]++,o++;if(i[0]>n)return!1;const a=s.getHeight(),l=s.getWidth();for(o=1;e+o<a&&t+o<l&&s.get(t+o,e+o);)i[2]++,o++;if(e+o>=a||t+o>=l)return!1;for(;e+o<a&&t+o<l&&!s.get(t+o,e+o)&&i[3]<n;)i[3]++,o++;if(e+o>=a||t+o>=l||i[3]>=n)return!1;for(;e+o<a&&t+o<l&&s.get(t+o,e+o)&&i[4]<n;)i[4]++,o++;if(i[4]>=n)return!1;const c=i[0]+i[1]+i[2]+i[3]+i[4];return Math.abs(c-r)<2*r&&Pt.foundPatternCross(i)}crossCheckVertical(e,t,n,r){const i=this.image,o=i.getHeight(),s=this.getCrossCheckStateCount();let a=e;for(;a>=0&&i.get(t,a);)s[2]++,a--;if(a<0)return NaN;for(;a>=0&&!i.get(t,a)&&s[1]<=n;)s[1]++,a--;if(a<0||s[1]>n)return NaN;for(;a>=0&&i.get(t,a)&&s[0]<=n;)s[0]++,a--;if(s[0]>n)return NaN;for(a=e+1;a<o&&i.get(t,a);)s[2]++,a++;if(a===o)return NaN;for(;a<o&&!i.get(t,a)&&s[3]<n;)s[3]++,a++;if(a===o||s[3]>=n)return NaN;for(;a<o&&i.get(t,a)&&s[4]<n;)s[4]++,a++;if(s[4]>=n)return NaN;const l=s[0]+s[1]+s[2]+s[3]+s[4];return 5*Math.abs(l-r)>=2*r?NaN:Pt.foundPatternCross(s)?Pt.centerFromEnd(s,a):NaN}crossCheckHorizontal(e,t,n,r){const i=this.image,o=i.getWidth(),s=this.getCrossCheckStateCount();let a=e;for(;a>=0&&i.get(a,t);)s[2]++,a--;if(a<0)return NaN;for(;a>=0&&!i.get(a,t)&&s[1]<=n;)s[1]++,a--;if(a<0||s[1]>n)return NaN;for(;a>=0&&i.get(a,t)&&s[0]<=n;)s[0]++,a--;if(s[0]>n)return NaN;for(a=e+1;a<o&&i.get(a,t);)s[2]++,a++;if(a===o)return NaN;for(;a<o&&!i.get(a,t)&&s[3]<n;)s[3]++,a++;if(a===o||s[3]>=n)return NaN;for(;a<o&&i.get(a,t)&&s[4]<n;)s[4]++,a++;if(s[4]>=n)return NaN;const l=s[0]+s[1]+s[2]+s[3]+s[4];return 5*Math.abs(l-r)>=r?NaN:Pt.foundPatternCross(s)?Pt.centerFromEnd(s,a):NaN}handlePossibleCenter(e,t,n,r){const i=e[0]+e[1]+e[2]+e[3]+e[4];let o=Pt.centerFromEnd(e,n),s=this.crossCheckVertical(t,Math.floor(o),e[2],i);if(!isNaN(s)&&(o=this.crossCheckHorizontal(Math.floor(o),Math.floor(s),e[2],i),!isNaN(o)&&(!r||this.crossCheckDiagonal(Math.floor(s),Math.floor(o),e[2],i)))){const e=i/7;let t=!1;const n=this.possibleCenters;for(let r=0,i=n.length;r<i;r++){const i=n[r];if(i.aboutEquals(e,s,o)){n[r]=i.combineEstimate(s,o,e),t=!0;break}}if(!t){const t=new Ot(o,s,e);n.push(t),null!==this.resultPointCallback&&void 0!==this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(t)}return!0}return!1}findRowSkip(){if(this.possibleCenters.length<=1)return 0;let e=null;for(const t of this.possibleCenters)if(t.getCount()>=Pt.CENTER_QUORUM){if(null!=e)return this.hasSkipped=!0,Math.floor((Math.abs(e.getX()-t.getX())-Math.abs(e.getY()-t.getY()))/2);e=t}return 0}haveMultiplyConfirmedCenters(){let e=0,t=0;const n=this.possibleCenters.length;for(const n of this.possibleCenters)n.getCount()>=Pt.CENTER_QUORUM&&(e++,t+=n.getEstimatedModuleSize());if(e<3)return!1;const r=t/n;let i=0;for(const e of this.possibleCenters)i+=Math.abs(e.getEstimatedModuleSize()-r);return i<=.05*t}selectBestPatterns(){const e=this.possibleCenters.length;if(e<3)throw new T;const t=this.possibleCenters;let n;if(e>3){let r=0,i=0;for(const e of this.possibleCenters){const t=e.getEstimatedModuleSize();r+=t,i+=t*t}n=r/e;let o=Math.sqrt(i/e-n*n);t.sort((e,t)=>{const r=Math.abs(t.getEstimatedModuleSize()-n),i=Math.abs(e.getEstimatedModuleSize()-n);return r<i?-1:r>i?1:0});const s=Math.max(.2*n,o);for(let e=0;e<t.length&&t.length>3;e++){const r=t[e];Math.abs(r.getEstimatedModuleSize()-n)>s&&(t.splice(e,1),e--)}}if(t.length>3){let e=0;for(const n of t)e+=n.getEstimatedModuleSize();n=e/t.length,t.sort((e,t)=>{if(t.getCount()===e.getCount()){const r=Math.abs(t.getEstimatedModuleSize()-n),i=Math.abs(e.getEstimatedModuleSize()-n);return r<i?1:r>i?-1:0}return t.getCount()-e.getCount()}),t.splice(3)}return[t[0],t[1],t[2]]}}Pt.CENTER_QUORUM=2,Pt.MIN_SKIP=3,Pt.MAX_MODULES=57;class Bt{constructor(e){this.image=e}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(e){this.resultPointCallback=null==e?null:e.get(I.NEED_RESULT_POINT_CALLBACK);const t=new Pt(this.image,this.resultPointCallback).find(e);return this.processFinderPatternInfo(t)}processFinderPatternInfo(e){const t=e.getTopLeft(),n=e.getTopRight(),r=e.getBottomLeft(),i=this.calculateModuleSize(t,n,r);if(i<1)throw new T("No pattern found in proccess finder.");const o=Bt.computeDimension(t,n,r,i),s=Et.getProvisionalVersionForDimension(o),a=s.getDimensionForVersion()-7;let l=null;if(s.getAlignmentPatternCenters().length>0){const e=n.getX()-t.getX()+r.getX(),o=n.getY()-t.getY()+r.getY(),s=1-3/a,c=Math.floor(t.getX()+s*(e-t.getX())),d=Math.floor(t.getY()+s*(o-t.getY()));for(let e=4;e<=16;e<<=1)try{l=this.findAlignmentInRegion(i,c,d,e);break}catch(e){if(!(e instanceof T))throw e}}const c=Bt.createTransform(t,n,r,l,o),d=Bt.sampleGrid(this.image,c,o);let u;return u=null===l?[r,t,n]:[r,t,n,l],new ae(d,u)}static createTransform(e,t,n,r,i){const o=i-3.5;let s,a,l,c;return null!==r?(s=r.getX(),a=r.getY(),l=o-3,c=l):(s=t.getX()-e.getX()+n.getX(),a=t.getY()-e.getY()+n.getY(),l=o,c=o),ue.quadrilateralToQuadrilateral(3.5,3.5,o,3.5,l,c,3.5,o,e.getX(),e.getY(),t.getX(),t.getY(),s,a,n.getX(),n.getY())}static sampleGrid(e,t,n){return he.getInstance().sampleGridWithTransform(e,n,n,t)}static computeDimension(e,t,n,r){const i=ie.round(se.distance(e,t)/r),o=ie.round(se.distance(e,n)/r);let s=Math.floor((i+o)/2)+7;switch(3&s){case 0:s++;break;case 2:s--;break;case 3:throw new T("Dimensions could be not found.")}return s}calculateModuleSize(e,t,n){return(this.calculateModuleSizeOneWay(e,t)+this.calculateModuleSizeOneWay(e,n))/2}calculateModuleSizeOneWay(e,t){const n=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(e.getX()),Math.floor(e.getY()),Math.floor(t.getX()),Math.floor(t.getY())),r=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.getX()),Math.floor(t.getY()),Math.floor(e.getX()),Math.floor(e.getY()));return isNaN(n)?r/7:isNaN(r)?n/7:(n+r)/14}sizeOfBlackWhiteBlackRunBothWays(e,t,n,r){let i=this.sizeOfBlackWhiteBlackRun(e,t,n,r),o=1,s=e-(n-e);s<0?(o=e/(e-s),s=0):s>=this.image.getWidth()&&(o=(this.image.getWidth()-1-e)/(s-e),s=this.image.getWidth()-1);let a=Math.floor(t-(r-t)*o);return o=1,a<0?(o=t/(t-a),a=0):a>=this.image.getHeight()&&(o=(this.image.getHeight()-1-t)/(a-t),a=this.image.getHeight()-1),s=Math.floor(e+(s-e)*o),i+=this.sizeOfBlackWhiteBlackRun(e,t,s,a),i-1}sizeOfBlackWhiteBlackRun(e,t,n,r){const i=Math.abs(r-t)>Math.abs(n-e);if(i){let i=e;e=t,t=i,i=n,n=r,r=i}const o=Math.abs(n-e),s=Math.abs(r-t);let a=-o/2;const l=e<n?1:-1,c=t<r?1:-1;let d=0;const u=n+l;for(let n=e,f=t;n!==u;n+=l){const l=i?f:n,u=i?n:f;if(1===d===this.image.get(l,u)){if(2===d)return ie.distance(n,f,e,t);d++}if(a+=s,a>0){if(f===r)break;f+=c,a-=o}}return 2===d?ie.distance(n+l,r,e,t):NaN}findAlignmentInRegion(e,t,n,r){const i=Math.floor(r*e),o=Math.max(0,t-i),s=Math.min(this.image.getWidth()-1,t+i);if(s-o<3*e)throw new T("Alignment top exceeds estimated module size.");const a=Math.max(0,n-i),l=Math.min(this.image.getHeight()-1,n+i);if(l-a<3*e)throw new T("Alignment bottom exceeds estimated module size.");return new kt(this.image,o,a,s-o,l-a,e,this.resultPointCallback).find()}}class Lt{constructor(){this.decoder=new Dt}getDecoder(){return this.decoder}decode(e,t){let n,r;if(null!=t&&void 0!==t.get(I.PURE_BARCODE)){const i=Lt.extractPureBits(e.getBlackMatrix());n=this.decoder.decodeBitMatrix(i,t),r=Lt.NO_POINTS}else{const i=new Bt(e.getBlackMatrix()).detect(t);n=this.decoder.decodeBitMatrix(i.getBits(),t),r=i.getPoints()}n.getOther()instanceof Rt&&n.getOther().applyMirroredCorrection(r);const i=new F(n.getText(),n.getRawBytes(),void 0,r,U.QR_CODE,void 0),o=n.getByteSegments();null!==o&&i.putMetadata(X.BYTE_SEGMENTS,o);const s=n.getECLevel();return null!==s&&i.putMetadata(X.ERROR_CORRECTION_LEVEL,s),n.hasStructuredAppend()&&(i.putMetadata(X.STRUCTURED_APPEND_SEQUENCE,n.getStructuredAppendSequenceNumber()),i.putMetadata(X.STRUCTURED_APPEND_PARITY,n.getStructuredAppendParity())),i}reset(){}static extractPureBits(e){const t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(null===t||null===n)throw new T;const r=this.moduleSize(t,e);let i=t[1],o=n[1],s=t[0],a=n[0];if(s>=a||i>=o)throw new T;if(o-i!==a-s&&(a=s+(o-i),a>=e.getWidth()))throw new T;const l=Math.round((a-s+1)/r),c=Math.round((o-i+1)/r);if(l<=0||c<=0)throw new T;if(c!==l)throw new T;const d=Math.floor(r/2);i+=d,s+=d;const u=s+Math.floor((l-1)*r)-a;if(u>0){if(u>d)throw new T;s-=u}const f=i+Math.floor((c-1)*r)-o;if(f>0){if(f>d)throw new T;i-=f}const h=new N(l,c);for(let t=0;t<c;t++){const n=i+Math.floor(t*r);for(let i=0;i<l;i++)e.get(s+Math.floor(i*r),n)&&h.set(i,t)}return h}static moduleSize(e,t){const n=t.getHeight(),r=t.getWidth();let i=e[0],o=e[1],s=!0,a=0;for(;i<r&&o<n;){if(s!==t.get(i,o)){if(5===++a)break;s=!s}i++,o++}if(i===r||o===n)throw new T;return(i-e[0])/7}}Lt.NO_POINTS=new Array;class Ft{PDF417Common(){}static getBitCountSum(e){return ie.sum(e)}static toIntArray(e){if(null==e||!e.length)return Ft.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=w.binarySearch(Ft.SYMBOL_TABLE,262143&e);return t<0?-1:(Ft.CODEWORD_TABLE[t]-1)%Ft.NUMBER_OF_CODEWORDS}}Ft.NUMBER_OF_CODEWORDS=929,Ft.MAX_CODEWORDS_IN_BARCODE=Ft.NUMBER_OF_CODEWORDS-1,Ft.MIN_ROWS_IN_BARCODE=3,Ft.MAX_ROWS_IN_BARCODE=90,Ft.MODULES_IN_CODEWORD=17,Ft.MODULES_IN_STOP_PATTERN=18,Ft.BARS_IN_MODULE=8,Ft.EMPTY_INT_ARRAY=new Int32Array([]),Ft.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]),Ft.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 Vt{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class Ut{static detectMultiple(e,t,n){let r=e.getBlackMatrix(),i=Ut.detect(n,r);return i.length||(r=r.clone(),r.rotate180(),i=Ut.detect(n,r)),new Vt(r,i)}static detect(e,t){const n=new Array;let r=0,i=0,o=!1;for(;r<t.getHeight();){const s=Ut.findVertices(t,r,i);if(null!=s[0]||null!=s[3]){if(o=!0,n.push(s),!e)break;null!=s[2]?(i=Math.trunc(s[2].getX()),r=Math.trunc(s[2].getY())):(i=Math.trunc(s[4].getX()),r=Math.trunc(s[4].getY()))}else{if(!o)break;o=!1,i=0;for(const e of n)null!=e[1]&&(r=Math.trunc(Math.max(r,e[1].getY()))),null!=e[3]&&(r=Math.max(r,Math.trunc(e[3].getY())));r+=Ut.ROW_STEP}}return n}static findVertices(e,t,n){const r=e.getHeight(),i=e.getWidth(),o=new Array(8);return Ut.copyToResult(o,Ut.findRowsWithPattern(e,r,i,t,n,Ut.START_PATTERN),Ut.INDEXES_START_PATTERN),null!=o[4]&&(n=Math.trunc(o[4].getX()),t=Math.trunc(o[4].getY())),Ut.copyToResult(o,Ut.findRowsWithPattern(e,r,i,t,n,Ut.STOP_PATTERN),Ut.INDEXES_STOP_PATTERN),o}static copyToResult(e,t,n){for(let r=0;r<n.length;r++)e[n[r]]=t[r]}static findRowsWithPattern(e,t,n,r,i,o){const s=new Array(4);let a=!1;const l=new Int32Array(o.length);for(;r<t;r+=Ut.ROW_STEP){let t=Ut.findGuardPattern(e,i,r,n,!1,o,l);if(null!=t){for(;r>0;){const s=Ut.findGuardPattern(e,i,--r,n,!1,o,l);if(null==s){r++;break}t=s}s[0]=new se(t[0],r),s[1]=new se(t[1],r),a=!0;break}}let c=r+1;if(a){let r=0,i=Int32Array.from([Math.trunc(s[0].getX()),Math.trunc(s[1].getX())]);for(;c<t;c++){const t=Ut.findGuardPattern(e,i[0],c,n,!1,o,l);if(null!=t&&Math.abs(i[0]-t[0])<Ut.MAX_PATTERN_DRIFT&&Math.abs(i[1]-t[1])<Ut.MAX_PATTERN_DRIFT)i=t,r=0;else{if(r>Ut.SKIPPED_ROW_COUNT_MAX)break;r++}}c-=r+1,s[2]=new se(i[0],c),s[3]=new se(i[1],c)}return c-r<Ut.BARCODE_MIN_HEIGHT&&w.fill(s,null),s}static findGuardPattern(e,t,n,r,i,o,s){w.fillWithin(s,0,s.length,0);let a=t,l=0;for(;e.get(a,n)&&a>0&&l++<Ut.MAX_PIXEL_DRIFT;)a--;let c=a,d=0,u=o.length;for(let t=i;c<r;c++)if(e.get(c,n)!==t)s[d]++;else{if(d===u-1){if(Ut.patternMatchVariance(s,o,Ut.MAX_INDIVIDUAL_VARIANCE)<Ut.MAX_AVG_VARIANCE)return new Int32Array([a,c]);a+=s[0]+s[1],m.arraycopy(s,2,s,0,d-1),s[d-1]=0,s[d]=0,d--}else d++;s[d]=1,t=!t}return d===u-1&&Ut.patternMatchVariance(s,o,Ut.MAX_INDIVIDUAL_VARIANCE)<Ut.MAX_AVG_VARIANCE?new Int32Array([a,c-1]):null}static patternMatchVariance(e,t,n){let r=e.length,i=0,o=0;for(let n=0;n<r;n++)i+=e[n],o+=t[n];if(i<o)return 1/0;let s=i/o;n*=s;let a=0;for(let i=0;i<r;i++){let r=e[i],o=t[i]*s,l=r>o?r-o:o-r;if(l>n)return 1/0;a+=l}return a/i}}Ut.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),Ut.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),Ut.MAX_AVG_VARIANCE=.42,Ut.MAX_INDIVIDUAL_VARIANCE=.8,Ut.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),Ut.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),Ut.MAX_PIXEL_DRIFT=3,Ut.MAX_PATTERN_DRIFT=5,Ut.SKIPPED_ROW_COUNT_MAX=25,Ut.ROW_STEP=5,Ut.BARCODE_MIN_HEIGHT=10;class Wt{constructor(e,t){if(0===t.length)throw new d;this.field=e;let n=t.length;if(n>1&&0===t[0]){let e=1;for(;e<n&&0===t[e];)e++;e===n?this.coefficients=new Int32Array([0]):(this.coefficients=new Int32Array(n-e),m.arraycopy(t,e,this.coefficients,0,this.coefficients.length))}else this.coefficients=t}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return 0===this.coefficients[0]}getCoefficient(e){return this.coefficients[this.coefficients.length-1-e]}evaluateAt(e){if(0===e)return this.getCoefficient(0);if(1===e){let e=0;for(let t of this.coefficients)e=this.field.add(e,t);return e}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 d("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 e=t;t=n,n=e}let r=new Int32Array(n.length),i=n.length-t.length;m.arraycopy(n,0,r,0,i);for(let e=i;e<n.length;e++)r[e]=this.field.add(t[e-i],n[e]);return new Wt(this.field,r)}subtract(e){if(!this.field.equals(e.field))throw new d("ModulusPolys do not have same ModulusGF field");return e.isZero()?this:this.add(e.negative())}multiply(e){return e instanceof Wt?this.multiplyOther(e):this.multiplyScalar(e)}multiplyOther(e){if(!this.field.equals(e.field))throw new d("ModulusPolys do not have same ModulusGF field");if(this.isZero()||e.isZero())return new Wt(this.field,new Int32Array([0]));let t=this.coefficients,n=t.length,r=e.coefficients,i=r.length,o=new Int32Array(n+i-1);for(let e=0;e<n;e++){let n=t[e];for(let t=0;t<i;t++)o[e+t]=this.field.add(o[e+t],this.field.multiply(n,r[t]))}return new Wt(this.field,o)}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 Wt(this.field,t)}multiplyScalar(e){if(0===e)return new Wt(this.field,new Int32Array([0]));if(1===e)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 Wt(this.field,n)}multiplyByMonomial(e,t){if(e<0)throw new d;if(0===t)return new Wt(this.field,new Int32Array([0]));let n=this.coefficients.length,r=new Int32Array(n+e);for(let e=0;e<n;e++)r[e]=this.field.multiply(this.coefficients[e],t);return new Wt(this.field,r)}toString(){let e=new S;for(let t=this.getDegree();t>=0;t--){let n=this.getCoefficient(t);0!==n&&(n<0?(e.append(" - "),n=-n):e.length()>0&&e.append(" + "),0!==t&&1===n||e.append(n),0!==t&&(1===t?e.append("x"):(e.append("x^"),e.append(t))))}return e.toString()}}class zt{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(0===e)throw new d;return this.logTable[e]}inverse(e){if(0===e)throw new Q;return this.expTable[this.modulus-this.logTable[e]-1]}multiply(e,t){return 0===e||0===t?0:this.expTable[(this.logTable[e]+this.logTable[t])%(this.modulus-1)]}getSize(){return this.modulus}equals(e){return e===this}}class Ht extends zt{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 t=0;t<e-1;t++)this.logTable[this.expTable[t]]=t;this.zero=new Wt(this,new Int32Array([0])),this.one=new Wt(this,new Int32Array([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new d;if(0===t)return this.zero;let n=new Int32Array(e+1);return n[0]=t,new Wt(this,n)}}Ht.PDF417_GF=new Ht(Ft.NUMBER_OF_CODEWORDS,3);class jt{constructor(){this.field=Ht.PDF417_GF}decode(e,t,n){let r=new Wt(this.field,e),i=new Int32Array(t),o=!1;for(let e=t;e>0;e--){let n=r.evaluateAt(this.field.exp(e));i[t-e]=n,0!==n&&(o=!0)}if(!o)return 0;let s=this.field.getOne();if(null!=n)for(const t of n){let n=this.field.exp(e.length-1-t),r=new Wt(this.field,new Int32Array([this.field.subtract(0,n),1]));s=s.multiply(r)}let a=new Wt(this.field,i),l=this.runEuclideanAlgorithm(this.field.buildMonomial(t,1),a,t),c=l[0],d=l[1],u=this.findErrorLocations(c),h=this.findErrorMagnitudes(d,c,u);for(let t=0;t<u.length;t++){let n=e.length-1-this.field.log(u[t]);if(n<0)throw f.getChecksumInstance();e[n]=this.field.subtract(e[n],h[t])}return u.length}runEuclideanAlgorithm(e,t,n){if(e.getDegree()<t.getDegree()){let n=e;e=t,t=n}let r=e,i=t,o=this.field.getZero(),s=this.field.getOne();for(;i.getDegree()>=Math.round(n/2);){let e=r,t=o;if(r=i,o=s,r.isZero())throw f.getChecksumInstance();i=e;let n=this.field.getZero(),a=r.getCoefficient(r.getDegree()),l=this.field.inverse(a);for(;i.getDegree()>=r.getDegree()&&!i.isZero();){let e=i.getDegree()-r.getDegree(),t=this.field.multiply(i.getCoefficient(i.getDegree()),l);n=n.add(this.field.buildMonomial(e,t)),i=i.subtract(r.multiplyByMonomial(e,t))}s=n.multiply(o).subtract(t).negative()}let a=s.getCoefficient(0);if(0===a)throw f.getChecksumInstance();let l=this.field.inverse(a);return[s.multiply(l),i.multiply(l)]}findErrorLocations(e){let t=e.getDegree(),n=new Int32Array(t),r=0;for(let i=1;i<this.field.getSize()&&r<t;i++)0===e.evaluateAt(i)&&(n[r]=this.field.inverse(i),r++);if(r!==t)throw f.getChecksumInstance();return n}findErrorMagnitudes(e,t,n){let r=t.getDegree(),i=new Int32Array(r);for(let e=1;e<=r;e++)i[r-e]=this.field.multiply(e,t.getCoefficient(e));let o=new Wt(this.field,i),s=n.length,a=new Int32Array(s);for(let t=0;t<s;t++){let r=this.field.inverse(n[t]),i=this.field.subtract(0,e.evaluateAt(r)),s=this.field.inverse(o.evaluateAt(r));a[t]=this.field.multiply(i,s)}return a}}class qt{constructor(e,t,n,r,i){e instanceof qt?this.constructor_2(e):this.constructor_1(e,t,n,r,i)}constructor_1(e,t,n,r,i){const o=null==t||null==n,s=null==r||null==i;if(o&&s)throw new T;o?(t=new se(0,r.getY()),n=new se(0,i.getY())):s&&(r=new se(e.getWidth()-1,t.getY()),i=new se(e.getWidth()-1,n.getY())),this.image=e,this.topLeft=t,this.bottomLeft=n,this.topRight=r,this.bottomRight=i,this.minX=Math.trunc(Math.min(t.getX(),n.getX())),this.maxX=Math.trunc(Math.max(r.getX(),i.getX())),this.minY=Math.trunc(Math.min(t.getY(),r.getY())),this.maxY=Math.trunc(Math.max(n.getY(),i.getY()))}constructor_2(e){this.image=e.image,this.topLeft=e.getTopLeft(),this.bottomLeft=e.getBottomLeft(),this.topRight=e.getTopRight(),this.bottomRight=e.getBottomRight(),this.minX=e.getMinX(),this.maxX=e.getMaxX(),this.minY=e.getMinY(),this.maxY=e.getMaxY()}static merge(e,t){return null==e?t:null==t?e:new qt(e.image,e.topLeft,e.bottomLeft,t.topRight,t.bottomRight)}addMissingRows(e,t,n){let r=this.topLeft,i=this.bottomLeft,o=this.topRight,s=this.bottomRight;if(e>0){let t=n?this.topLeft:this.topRight,i=Math.trunc(t.getY()-e);i<0&&(i=0);let s=new se(t.getX(),i);n?r=s:o=s}if(t>0){let e=n?this.bottomLeft:this.bottomRight,r=Math.trunc(e.getY()+t);r>=this.image.getHeight()&&(r=this.image.getHeight()-1);let o=new se(e.getX(),r);n?i=o:s=o}return new qt(this.image,r,i,o,s)}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 Gt{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 Xt{constructor(){this.buffer=""}static form(e,t){let n=-1;function r(e,r,i,o,s,a){if("%%"===e)return"%";if(void 0===t[++n])return;e=o?parseInt(o.substr(1)):void 0;let l,c=s?parseInt(s.substr(1)):void 0;switch(a){case"s":l=t[n];break;case"c":l=t[n][0];break;case"f":l=parseFloat(t[n]).toFixed(e);break;case"p":l=parseFloat(t[n]).toPrecision(e);break;case"e":l=parseFloat(t[n]).toExponential(e);break;case"x":l=parseInt(t[n]).toString(c||16);break;case"d":l=parseFloat(parseInt(t[n],c||10).toPrecision(e)).toFixed(0)}l="object"==typeof l?JSON.stringify(l):(+l).toString(c);let d=parseInt(i),u=i&&i[0]+""=="0"?"0":" ";for(;l.length<d;)l=void 0!==r?l+u:u+l;return l}let i=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(i,r)}format(e,...t){this.buffer+=Xt.form(e,t)}toString(){return this.buffer}}class Yt{constructor(e){this.boundingBox=new qt(e),this.codewords=new Array(e.getMaxY()-e.getMinY()+1)}getCodewordNearby(e){let t=this.getCodeword(e);if(null!=t)return t;for(let n=1;n<Yt.MAX_NEARBY_DISTANCE;n++){let r=this.imageRowToCodewordIndex(e)-n;if(r>=0&&(t=this.codewords[r],null!=t))return t;if(r=this.imageRowToCodewordIndex(e)+n,r<this.codewords.length&&(t=this.codewords[r],null!=t))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 Xt;let t=0;for(const n of this.codewords)null!=n?e.format("%3d: %3d|%3d%n",t++,n.getRowNumber(),n.getValue()):e.format("%3d: | %n",t++);return e.toString()}}Yt.MAX_NEARBY_DISTANCE=5;class Zt{constructor(){this.values=new Map}setValue(e){e=Math.trunc(e);let t=this.values.get(e);null==t&&(t=0),t++,this.values.set(e,t)}getValue(){let e=-1,t=new Array;for(const[n,r]of this.values.entries()){const i={getKey:()=>n,getValue:()=>r};i.getValue()>e?(e=i.getValue(),t=[],t.push(i.getKey())):i.getValue()===e&&t.push(i.getKey())}return Ft.toIntArray(t)}getConfidence(e){return this.values.get(e)}}class Kt extends Yt{constructor(e,t){super(e),this._isLeft=t}setRowNumbers(){for(let e of this.getCodewords())null!=e&&e.setRowNumberAsRowIndicatorColumn()}adjustCompleteIndicatorColumnRowNumbers(e){let t=this.getCodewords();this.setRowNumbers(),this.removeIncorrectCodewords(t,e);let n=this.getBoundingBox(),r=this._isLeft?n.getTopLeft():n.getTopRight(),i=this._isLeft?n.getBottomLeft():n.getBottomRight(),o=this.imageRowToCodewordIndex(Math.trunc(r.getY())),s=this.imageRowToCodewordIndex(Math.trunc(i.getY())),a=-1,l=1,c=0;for(let n=o;n<s;n++){if(null==t[n])continue;let r=t[n],i=r.getRowNumber()-a;if(0===i)c++;else if(1===i)l=Math.max(l,c),c=1,a=r.getRowNumber();else if(i<0||r.getRowNumber()>=e.getRowCount()||i>n)t[n]=null;else{let e;e=l>2?(l-2)*i:i;let o=e>=n;for(let r=1;r<=e&&!o;r++)o=null!=t[n-r];o?t[n]=null:(a=r.getRowNumber(),c=1)}}}getRowHeights(){let e=this.getBarcodeMetadata();if(null==e)return null;this.adjustIncompleteIndicatorColumnRowNumbers(e);let t=new Int32Array(e.getRowCount());for(let e of this.getCodewords())if(null!=e){let n=e.getRowNumber();if(n>=t.length)continue;t[n]++}return t}adjustIncompleteIndicatorColumnRowNumbers(e){let t=this.getBoundingBox(),n=this._isLeft?t.getTopLeft():t.getTopRight(),r=this._isLeft?t.getBottomLeft():t.getBottomRight(),i=this.imageRowToCodewordIndex(Math.trunc(n.getY())),o=this.imageRowToCodewordIndex(Math.trunc(r.getY())),s=this.getCodewords(),a=-1;for(let t=i;t<o;t++){if(null==s[t])continue;let n=s[t];n.setRowNumberAsRowIndicatorColumn();let r=n.getRowNumber()-a;0===r||(1===r?a=n.getRowNumber():n.getRowNumber()>=e.getRowCount()?s[t]=null:a=n.getRowNumber())}}getBarcodeMetadata(){let e=this.getCodewords(),t=new Zt,n=new Zt,r=new Zt,i=new Zt;for(let o of e){if(null==o)continue;o.setRowNumberAsRowIndicatorColumn();let e=o.getValue()%30,s=o.getRowNumber();switch(this._isLeft||(s+=2),s%3){case 0:n.setValue(3*e+1);break;case 1:i.setValue(e/3),r.setValue(e%3);break;case 2:t.setValue(e+1)}}if(0===t.getValue().length||0===n.getValue().length||0===r.getValue().length||0===i.getValue().length||t.getValue()[0]<1||n.getValue()[0]+r.getValue()[0]<Ft.MIN_ROWS_IN_BARCODE||n.getValue()[0]+r.getValue()[0]>Ft.MAX_ROWS_IN_BARCODE)return null;let o=new Gt(t.getValue()[0],n.getValue()[0],r.getValue()[0],i.getValue()[0]);return this.removeIncorrectCodewords(e,o),o}removeIncorrectCodewords(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(null==e[n])continue;let i=r.getValue()%30,o=r.getRowNumber();if(o>t.getRowCount())e[n]=null;else switch(this._isLeft||(o+=2),o%3){case 0:3*i+1!==t.getRowCountUpperPart()&&(e[n]=null);break;case 1:Math.trunc(i/3)===t.getErrorCorrectionLevel()&&i%3===t.getRowCountLowerPart()||(e[n]=null);break;case 2:i+1!==t.getColumnCount()&&(e[n]=null)}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+"\n"+super.toString()}}class Qt{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,t=Ft.MAX_CODEWORDS_IN_BARCODE;do{e=t,t=this.adjustRowNumbersAndGetCount()}while(t>0&&t<e);return this.detectionResultColumns}adjustIndicatorColumnRowNumbers(e){null!=e&&e.adjustCompleteIndicatorColumnRowNumbers(this.barcodeMetadata)}adjustRowNumbersAndGetCount(){let e=this.adjustRowNumbersByRow();if(0===e)return 0;for(let e=1;e<this.barcodeColumnCount+1;e++){let t=this.detectionResultColumns[e].getCodewords();for(let n=0;n<t.length;n++)null!=t[n]&&(t[n].hasValidRowNumber()||this.adjustRowNumbers(e,n,t))}return e}adjustRowNumbersByRow(){return this.adjustRowNumbersFromBothRI(),this.adjustRowNumbersFromLRI()+this.adjustRowNumbersFromRRI()}adjustRowNumbersFromBothRI(){if(null==this.detectionResultColumns[0]||null==this.detectionResultColumns[this.barcodeColumnCount+1])return;let e=this.detectionResultColumns[0].getCodewords(),t=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let n=0;n<e.length;n++)if(null!=e[n]&&null!=t[n]&&e[n].getRowNumber()===t[n].getRowNumber())for(let t=1;t<=this.barcodeColumnCount;t++){let r=this.detectionResultColumns[t].getCodewords()[n];null!=r&&(r.setRowNumber(e[n].getRowNumber()),r.hasValidRowNumber()||(this.detectionResultColumns[t].getCodewords()[n]=null))}}adjustRowNumbersFromRRI(){if(null==this.detectionResultColumns[this.barcodeColumnCount+1])return 0;let e=0,t=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let n=0;n<t.length;n++){if(null==t[n])continue;let r=t[n].getRowNumber(),i=0;for(let t=this.barcodeColumnCount+1;t>0&&i<this.ADJUST_ROW_NUMBER_SKIP;t--){let o=this.detectionResultColumns[t].getCodewords()[n];null!=o&&(i=Qt.adjustRowNumberIfValid(r,i,o),o.hasValidRowNumber()||e++)}}return e}adjustRowNumbersFromLRI(){if(null==this.detectionResultColumns[0])return 0;let e=0,t=this.detectionResultColumns[0].getCodewords();for(let n=0;n<t.length;n++){if(null==t[n])continue;let r=t[n].getRowNumber(),i=0;for(let t=1;t<this.barcodeColumnCount+1&&i<this.ADJUST_ROW_NUMBER_SKIP;t++){let o=this.detectionResultColumns[t].getCodewords()[n];null!=o&&(i=Qt.adjustRowNumberIfValid(r,i,o),o.hasValidRowNumber()||e++)}}return e}static adjustRowNumberIfValid(e,t,n){return null==n||n.hasValidRowNumber()||(n.isValidRowNumber(e)?(n.setRowNumber(e),t=0):++t),t}adjustRowNumbers(e,t,n){if(!this.detectionResultColumns[e-1])return;let r=n[t],i=this.detectionResultColumns[e-1].getCodewords(),o=i;null!=this.detectionResultColumns[e+1]&&(o=this.detectionResultColumns[e+1].getCodewords());let s=new Array(14);s[2]=i[t],s[3]=o[t],t>0&&(s[0]=n[t-1],s[4]=i[t-1],s[5]=o[t-1]),t>1&&(s[8]=n[t-2],s[10]=i[t-2],s[11]=o[t-2]),t<n.length-1&&(s[1]=n[t+1],s[6]=i[t+1],s[7]=o[t+1]),t<n.length-2&&(s[9]=n[t+2],s[12]=i[t+2],s[13]=o[t+2]);for(let e of s)if(Qt.adjustRowNumber(r,e))return}static adjustRowNumber(e,t){return!(null==t||!t.hasValidRowNumber()||t.getBucket()!==e.getBucket()||(e.setRowNumber(t.getRowNumber()),0))}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];null==e&&(e=this.detectionResultColumns[this.barcodeColumnCount+1]);let t=new Xt;for(let n=0;n<e.getCodewords().length;n++){t.format("CW %3d:",n);for(let e=0;e<this.barcodeColumnCount+2;e++){if(null==this.detectionResultColumns[e]){t.format(" | ");continue}let r=this.detectionResultColumns[e].getCodewords()[n];null!=r?t.format(" %3d|%3d",r.getRowNumber(),r.getValue()):t.format(" | ")}t.format("%n")}return t.toString()}}class Jt{constructor(e,t,n,r){this.rowNumber=Jt.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!==Jt.BARCODE_ROW_UNKNOWN&&this.bucket===e%3*3}setRowNumberAsRowIndicatorColumn(){this.rowNumber=Math.trunc(3*Math.trunc(this.value/30)+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}}Jt.BARCODE_ROW_UNKNOWN=-1;class en{static initialize(){for(let e=0;e<Ft.SYMBOL_TABLE.length;e++){let t=Ft.SYMBOL_TABLE[e],n=1&t;for(let r=0;r<Ft.BARS_IN_MODULE;r++){let i=0;for(;(1&t)===n;)i+=1,t>>=1;n=1&t,en.RATIOS_TABLE[e]||(en.RATIOS_TABLE[e]=new Array(Ft.BARS_IN_MODULE)),en.RATIOS_TABLE[e][Ft.BARS_IN_MODULE-r-1]=Math.fround(i/Ft.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(e){let t=en.getDecodedCodewordValue(en.sampleBitCounts(e));return-1!==t?t:en.getClosestDecodedValue(e)}static sampleBitCounts(e){let t=ie.sum(e),n=new Int32Array(Ft.BARS_IN_MODULE),r=0,i=0;for(let o=0;o<Ft.MODULES_IN_CODEWORD;o++){let s=t/(2*Ft.MODULES_IN_CODEWORD)+o*t/Ft.MODULES_IN_CODEWORD;i+e[r]<=s&&(i+=e[r],r++),n[r]++}return n}static getDecodedCodewordValue(e){let t=en.getBitValue(e);return-1===Ft.getCodeword(t)?-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=ie.sum(e),n=new Array(Ft.BARS_IN_MODULE);if(t>1)for(let r=0;r<n.length;r++)n[r]=Math.fround(e[r]/t);let r=oe.MAX_VALUE,i=-1;this.bSymbolTableReady||en.initialize();for(let e=0;e<en.RATIOS_TABLE.length;e++){let t=0,o=en.RATIOS_TABLE[e];for(let e=0;e<Ft.BARS_IN_MODULE;e++){let i=Math.fround(o[e]-n[e]);if(t+=Math.fround(i*i),t>=r)break}t<r&&(r=t,i=Ft.SYMBOL_TABLE[e])}return i}}en.bSymbolTableReady=!1,en.RATIOS_TABLE=new Array(Ft.SYMBOL_TABLE.length).map(e=>new Array(Ft.BARS_IN_MODULE));class tn{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 nn{static parseLong(e,t=void 0){return parseInt(e,t)}}class rn extends l{}rn.kind="NullPointerException";class on{writeBytes(e){this.writeBytesOffset(e,0,e.length)}writeBytesOffset(e,t,n){if(null==e)throw new rn;if(t<0||t>e.length||n<0||t+n>e.length||t+n<0)throw new p;if(0!==n)for(let r=0;r<n;r++)this.write(e[t+r])}flush(){}close(){}}class sn extends l{}class an extends on{constructor(e=32){if(super(),this.count=0,e<0)throw new d("Negative initial size: "+e);this.buf=new Uint8Array(e)}ensureCapacity(e){e-this.buf.length>0&&this.grow(e)}grow(e){let t=this.buf.length<<1;if(t-e<0&&(t=e),t<0){if(e<0)throw new sn;t=y.MAX_VALUE}this.buf=w.copyOfUint8Array(this.buf,t)}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 p;this.ensureCapacity(this.count+n),m.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 w.copyOfUint8Array(this.buf,this.count)}size(){return this.count}toString(e){return e?"string"==typeof e?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(){}}function ln(){if("undefined"!=typeof window)return window.BigInt||null;if(void 0!==af)return af.BigInt||null;if("undefined"!=typeof self)return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}let cn;function dn(e){if(void 0===cn&&(cn=ln()),null===cn)throw new Error("BigInt is not supported!");return cn(e)}function un(){let e=[];e[0]=dn(1);let t=dn(900);e[1]=t;for(let n=2;n<16;n++)e[n]=e[n-1]*t;return e}!function(e){e[e.ALPHA=0]="ALPHA",e[e.LOWER=1]="LOWER",e[e.MIXED=2]="MIXED",e[e.PUNCT=3]="PUNCT",e[e.ALPHA_SHIFT=4]="ALPHA_SHIFT",e[e.PUNCT_SHIFT=5]="PUNCT_SHIFT"}(G||(G={}));class fn{static decode(e,t){let n=new S(""),r=C.ISO8859_1;n.enableDecoding(r);let i=1,o=e[i++],s=new tn;for(;i<e[0];){switch(o){case fn.TEXT_COMPACTION_MODE_LATCH:i=fn.textCompaction(e,i,n);break;case fn.BYTE_COMPACTION_MODE_LATCH:case fn.BYTE_COMPACTION_MODE_LATCH_6:i=fn.byteCompaction(o,e,r,i,n);break;case fn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(e[i++]);break;case fn.NUMERIC_COMPACTION_MODE_LATCH:i=fn.numericCompaction(e,i,n);break;case fn.ECI_CHARSET:C.getCharacterSetECIByValue(e[i++]);break;case fn.ECI_GENERAL_PURPOSE:i+=2;break;case fn.ECI_USER_DEFINED:i++;break;case fn.BEGIN_MACRO_PDF417_CONTROL_BLOCK:i=fn.decodeMacroBlock(e,i,s);break;case fn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case fn.MACRO_PDF417_TERMINATOR:throw new _;default:i--,i=fn.textCompaction(e,i,n)}if(!(i<e.length))throw _.getFormatInstance();o=e[i++]}if(0===n.length())throw _.getFormatInstance();let a=new Y(null,n.toString(),null,t);return a.setOther(s),a}static decodeMacroBlock(e,t,n){if(t+fn.NUMBER_OF_SEQUENCE_CODEWORDS>e[0])throw _.getFormatInstance();let r=new Int32Array(fn.NUMBER_OF_SEQUENCE_CODEWORDS);for(let n=0;n<fn.NUMBER_OF_SEQUENCE_CODEWORDS;n++,t++)r[n]=e[t];n.setSegmentIndex(y.parseInt(fn.decodeBase900toBase10(r,fn.NUMBER_OF_SEQUENCE_CODEWORDS)));let i=new S;t=fn.textCompaction(e,t,i),n.setFileId(i.toString());let o=-1;for(e[t]===fn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(o=t+1);t<e[0];)switch(e[t]){case fn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(e[++t]){case fn.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let r=new S;t=fn.textCompaction(e,t+1,r),n.setFileName(r.toString());break;case fn.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let i=new S;t=fn.textCompaction(e,t+1,i),n.setSender(i.toString());break;case fn.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let o=new S;t=fn.textCompaction(e,t+1,o),n.setAddressee(o.toString());break;case fn.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let s=new S;t=fn.numericCompaction(e,t+1,s),n.setSegmentCount(y.parseInt(s.toString()));break;case fn.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let a=new S;t=fn.numericCompaction(e,t+1,a),n.setTimestamp(nn.parseLong(a.toString()));break;case fn.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let l=new S;t=fn.numericCompaction(e,t+1,l),n.setChecksum(y.parseInt(l.toString()));break;case fn.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let c=new S;t=fn.numericCompaction(e,t+1,c),n.setFileSize(nn.parseLong(c.toString()));break;default:throw _.getFormatInstance()}break;case fn.MACRO_PDF417_TERMINATOR:t++,n.setLastSegment(!0);break;default:throw _.getFormatInstance()}if(-1!==o){let r=t-o;n.isLastSegment()&&r--,n.setOptionalData(w.copyOfRange(e,o,o+r))}return t}static textCompaction(e,t,n){let r=new Int32Array(2*(e[0]-t)),i=new Int32Array(2*(e[0]-t)),o=0,s=!1;for(;t<e[0]&&!s;){let n=e[t++];if(n<fn.TEXT_COMPACTION_MODE_LATCH)r[o]=n/30,r[o+1]=n%30,o+=2;else switch(n){case fn.TEXT_COMPACTION_MODE_LATCH:r[o++]=fn.TEXT_COMPACTION_MODE_LATCH;break;case fn.BYTE_COMPACTION_MODE_LATCH:case fn.BYTE_COMPACTION_MODE_LATCH_6:case fn.NUMERIC_COMPACTION_MODE_LATCH:case fn.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case fn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case fn.MACRO_PDF417_TERMINATOR:t--,s=!0;break;case fn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r[o]=fn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,n=e[t++],i[o]=n,o++}}return fn.decodeTextCompaction(r,i,o,n),t}static decodeTextCompaction(e,t,n,r){let i=G.ALPHA,o=G.ALPHA,s=0;for(;s<n;){let n=e[s],a="";switch(i){case G.ALPHA:if(n<26)a=String.fromCharCode(65+n);else switch(n){case 26:a=" ";break;case fn.LL:i=G.LOWER;break;case fn.ML:i=G.MIXED;break;case fn.PS:o=i,i=G.PUNCT_SHIFT;break;case fn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[s]);break;case fn.TEXT_COMPACTION_MODE_LATCH:i=G.ALPHA}break;case G.LOWER:if(n<26)a=String.fromCharCode(97+n);else switch(n){case 26:a=" ";break;case fn.AS:o=i,i=G.ALPHA_SHIFT;break;case fn.ML:i=G.MIXED;break;case fn.PS:o=i,i=G.PUNCT_SHIFT;break;case fn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[s]);break;case fn.TEXT_COMPACTION_MODE_LATCH:i=G.ALPHA}break;case G.MIXED:if(n<fn.PL)a=fn.MIXED_CHARS[n];else switch(n){case fn.PL:i=G.PUNCT;break;case 26:a=" ";break;case fn.LL:i=G.LOWER;break;case fn.AL:i=G.ALPHA;break;case fn.PS:o=i,i=G.PUNCT_SHIFT;break;case fn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[s]);break;case fn.TEXT_COMPACTION_MODE_LATCH:i=G.ALPHA}break;case G.PUNCT:if(n<fn.PAL)a=fn.PUNCT_CHARS[n];else switch(n){case fn.PAL:i=G.ALPHA;break;case fn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[s]);break;case fn.TEXT_COMPACTION_MODE_LATCH:i=G.ALPHA}break;case G.ALPHA_SHIFT:if(i=o,n<26)a=String.fromCharCode(65+n);else switch(n){case 26:a=" ";break;case fn.TEXT_COMPACTION_MODE_LATCH:i=G.ALPHA}break;case G.PUNCT_SHIFT:if(i=o,n<fn.PAL)a=fn.PUNCT_CHARS[n];else switch(n){case fn.PAL:i=G.ALPHA;break;case fn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[s]);break;case fn.TEXT_COMPACTION_MODE_LATCH:i=G.ALPHA}}""!==a&&r.append(a),s++}}static byteCompaction(e,t,n,r,i){let o=new an,s=0,a=0,l=!1;switch(e){case fn.BYTE_COMPACTION_MODE_LATCH:let e=new Int32Array(6),n=t[r++];for(;r<t[0]&&!l;)switch(e[s++]=n,a=900*a+n,n=t[r++],n){case fn.TEXT_COMPACTION_MODE_LATCH:case fn.BYTE_COMPACTION_MODE_LATCH:case fn.NUMERIC_COMPACTION_MODE_LATCH:case fn.BYTE_COMPACTION_MODE_LATCH_6:case fn.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case fn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case fn.MACRO_PDF417_TERMINATOR:r--,l=!0;break;default:if(s%5==0&&s>0){for(let e=0;e<6;++e)o.write(Number(dn(a)>>dn(8*(5-e))));a=0,s=0}}r===t[0]&&n<fn.TEXT_COMPACTION_MODE_LATCH&&(e[s++]=n);for(let t=0;t<s;t++)o.write(e[t]);break;case fn.BYTE_COMPACTION_MODE_LATCH_6:for(;r<t[0]&&!l;){let e=t[r++];if(e<fn.TEXT_COMPACTION_MODE_LATCH)s++,a=900*a+e;else switch(e){case fn.TEXT_COMPACTION_MODE_LATCH:case fn.BYTE_COMPACTION_MODE_LATCH:case fn.NUMERIC_COMPACTION_MODE_LATCH:case fn.BYTE_COMPACTION_MODE_LATCH_6:case fn.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case fn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case fn.MACRO_PDF417_TERMINATOR:r--,l=!0}if(s%5==0&&s>0){for(let e=0;e<6;++e)o.write(Number(dn(a)>>dn(8*(5-e))));a=0,s=0}}}return i.append(A.decode(o.toByteArray(),n)),r}static numericCompaction(e,t,n){let r=0,i=!1,o=new Int32Array(fn.MAX_NUMERIC_CODEWORDS);for(;t<e[0]&&!i;){let s=e[t++];if(t===e[0]&&(i=!0),s<fn.TEXT_COMPACTION_MODE_LATCH)o[r]=s,r++;else switch(s){case fn.TEXT_COMPACTION_MODE_LATCH:case fn.BYTE_COMPACTION_MODE_LATCH:case fn.BYTE_COMPACTION_MODE_LATCH_6:case fn.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case fn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case fn.MACRO_PDF417_TERMINATOR:t--,i=!0}(r%fn.MAX_NUMERIC_CODEWORDS===0||s===fn.NUMERIC_COMPACTION_MODE_LATCH||i)&&r>0&&(n.append(fn.decodeBase900toBase10(o,r)),r=0)}return t}static decodeBase900toBase10(e,t){let n=dn(0);for(let r=0;r<t;r++)n+=fn.EXP900[t-r-1]*dn(e[r]);let r=n.toString();if("1"!==r.charAt(0))throw new _;return r.substring(1)}}fn.TEXT_COMPACTION_MODE_LATCH=900,fn.BYTE_COMPACTION_MODE_LATCH=901,fn.NUMERIC_COMPACTION_MODE_LATCH=902,fn.BYTE_COMPACTION_MODE_LATCH_6=924,fn.ECI_USER_DEFINED=925,fn.ECI_GENERAL_PURPOSE=926,fn.ECI_CHARSET=927,fn.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,fn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,fn.MACRO_PDF417_TERMINATOR=922,fn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,fn.MAX_NUMERIC_CODEWORDS=15,fn.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,fn.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,fn.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,fn.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,fn.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,fn.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,fn.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,fn.PL=25,fn.LL=27,fn.AS=27,fn.ML=28,fn.AL=28,fn.PS=29,fn.PAL=29,fn.PUNCT_CHARS=";<>@[\\]_`~!\r\t,:\n-.$/\"|*()?{}'",fn.MIXED_CHARS="0123456789&\r\t,:#-.$/+%*=^",fn.EXP900=ln()?un():[],fn.NUMBER_OF_SEQUENCE_CODEWORDS=2;class hn{constructor(){}static decode(e,t,n,r,i,o,s){let a,l=new qt(e,t,n,r,i),c=null,d=null;for(let n=!0;;n=!1){if(null!=t&&(c=hn.getRowIndicatorColumn(e,l,t,!0,o,s)),null!=r&&(d=hn.getRowIndicatorColumn(e,l,r,!1,o,s)),a=hn.merge(c,d),null==a)throw T.getNotFoundInstance();let i=a.getBoundingBox();if(!n||null==i||!(i.getMinY()<l.getMinY()||i.getMaxY()>l.getMaxY()))break;l=i}a.setBoundingBox(l);let u=a.getBarcodeColumnCount()+1;a.setDetectionResultColumn(0,c),a.setDetectionResultColumn(u,d);let f=null!=c;for(let t=1;t<=u;t++){let n,r=f?t:u-t;if(void 0!==a.getDetectionResultColumn(r))continue;n=0===r||r===u?new Kt(l,0===r):new Yt(l),a.setDetectionResultColumn(r,n);let i=-1,c=i;for(let t=l.getMinY();t<=l.getMaxY();t++){if(i=hn.getStartColumn(a,r,t,f),i<0||i>l.getMaxX()){if(-1===c)continue;i=c}let d=hn.detectCodeword(e,l.getMinX(),l.getMaxX(),f,i,t,o,s);null!=d&&(n.setCodeword(t,d),c=i,o=Math.min(o,d.getWidth()),s=Math.max(s,d.getWidth()))}}return hn.createDecoderResult(a)}static merge(e,t){if(null==e&&null==t)return null;let n=hn.getBarcodeMetadata(e,t);if(null==n)return null;let r=qt.merge(hn.adjustBoundingBox(e),hn.adjustBoundingBox(t));return new Qt(n,r)}static adjustBoundingBox(e){if(null==e)return null;let t=e.getRowHeights();if(null==t)return null;let n=hn.getMax(t),r=0;for(let e of t)if(r+=n-e,e>0)break;let i=e.getCodewords();for(let e=0;r>0&&null==i[e];e++)r--;let o=0;for(let e=t.length-1;e>=0&&(o+=n-t[e],!(t[e]>0));e--);for(let e=i.length-1;o>0&&null==i[e];e--)o--;return e.getBoundingBox().addMissingRows(r,o,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,r;return null==e||null==(n=e.getBarcodeMetadata())?null==t?null:t.getBarcodeMetadata():null==t||null==(r=t.getBarcodeMetadata())?n:n.getColumnCount()!==r.getColumnCount()&&n.getErrorCorrectionLevel()!==r.getErrorCorrectionLevel()&&n.getRowCount()!==r.getRowCount()?null:n}static getRowIndicatorColumn(e,t,n,r,i,o){let s=new Kt(t,r);for(let a=0;a<2;a++){let l=0===a?1:-1,c=Math.trunc(Math.trunc(n.getX()));for(let a=Math.trunc(Math.trunc(n.getY()));a<=t.getMaxY()&&a>=t.getMinY();a+=l){let t=hn.detectCodeword(e,0,e.getWidth(),r,c,a,i,o);null!=t&&(s.setCodeword(a,t),c=r?t.getStartX():t.getEndX())}}return s}static adjustCodewordCount(e,t){let n=t[0][1],r=n.getValue(),i=e.getBarcodeColumnCount()*e.getBarcodeRowCount()-hn.getNumberOfECCodeWords(e.getBarcodeECLevel());if(0===r.length){if(i<1||i>Ft.MAX_CODEWORDS_IN_BARCODE)throw T.getNotFoundInstance();n.setValue(i)}else r[0]!==i&&n.setValue(i)}static createDecoderResult(e){let t=hn.createBarcodeMatrix(e);hn.adjustCodewordCount(e,t);let n=new Array,r=new Int32Array(e.getBarcodeRowCount()*e.getBarcodeColumnCount()),i=[],o=new Array;for(let s=0;s<e.getBarcodeRowCount();s++)for(let a=0;a<e.getBarcodeColumnCount();a++){let l=t[s][a+1].getValue(),c=s*e.getBarcodeColumnCount()+a;0===l.length?n.push(c):1===l.length?r[c]=l[0]:(o.push(c),i.push(l))}let s=new Array(i.length);for(let e=0;e<s.length;e++)s[e]=i[e];return hn.createDecoderResultFromAmbiguousValues(e.getBarcodeECLevel(),r,Ft.toIntArray(n),Ft.toIntArray(o),s)}static createDecoderResultFromAmbiguousValues(e,t,n,r,i){let o=new Int32Array(r.length),s=100;for(;s-- >0;){for(let e=0;e<o.length;e++)t[r[e]]=i[e][o[e]];try{return hn.decodeCodewords(t,e,n)}catch(e){if(!(e instanceof f))throw e}if(0===o.length)throw f.getChecksumInstance();for(let e=0;e<o.length;e++){if(o[e]<i[e].length-1){o[e]++;break}if(o[e]=0,e===o.length-1)throw f.getChecksumInstance()}}throw f.getChecksumInstance()}static createBarcodeMatrix(e){let t=Array.from({length:e.getBarcodeRowCount()},()=>new Array(e.getBarcodeColumnCount()+2));for(let e=0;e<t.length;e++)for(let n=0;n<t[e].length;n++)t[e][n]=new Zt;let n=0;for(let r of e.getDetectionResultColumns()){if(null!=r)for(let e of r.getCodewords())if(null!=e){let r=e.getRowNumber();if(r>=0){if(r>=t.length)continue;t[r][n].setValue(e.getValue())}}n++}return t}static isValidBarcodeColumn(e,t){return t>=0&&t<=e.getBarcodeColumnCount()+1}static getStartColumn(e,t,n,r){let i=r?1:-1,o=null;if(hn.isValidBarcodeColumn(e,t-i)&&(o=e.getDetectionResultColumn(t-i).getCodeword(n)),null!=o)return r?o.getEndX():o.getStartX();if(o=e.getDetectionResultColumn(t).getCodewordNearby(n),null!=o)return r?o.getStartX():o.getEndX();if(hn.isValidBarcodeColumn(e,t-i)&&(o=e.getDetectionResultColumn(t-i).getCodewordNearby(n)),null!=o)return r?o.getEndX():o.getStartX();let s=0;for(;hn.isValidBarcodeColumn(e,t-i);){t-=i;for(let n of e.getDetectionResultColumn(t).getCodewords())if(null!=n)return(r?n.getEndX():n.getStartX())+i*s*(n.getEndX()-n.getStartX());s++}return r?e.getBoundingBox().getMinX():e.getBoundingBox().getMaxX()}static detectCodeword(e,t,n,r,i,o,s,a){i=hn.adjustCodewordStartColumn(e,t,n,r,i,o);let l,c=hn.getModuleBitCount(e,t,n,r,i,o);if(null==c)return null;let d=ie.sum(c);if(r)l=i+d;else{for(let e=0;e<c.length/2;e++){let t=c[e];c[e]=c[c.length-1-e],c[c.length-1-e]=t}l=i,i=l-d}if(!hn.checkCodewordSkew(d,s,a))return null;let u=en.getDecodedValue(c),f=Ft.getCodeword(u);return-1===f?null:new Jt(i,l,hn.getCodewordBucketNumber(u),f)}static getModuleBitCount(e,t,n,r,i,o){let s=i,a=new Int32Array(8),l=0,c=r?1:-1,d=r;for(;(r?s<n:s>=t)&&l<a.length;)e.get(s,o)===d?(a[l]++,s+=c):(l++,d=!d);return l===a.length||s===(r?n:t)&&l===a.length-1?a:null}static getNumberOfECCodeWords(e){return 2<<e}static adjustCodewordStartColumn(e,t,n,r,i,o){let s=i,a=r?-1:1;for(let l=0;l<2;l++){for(;(r?s>=t:s<n)&&r===e.get(s,o);){if(Math.abs(i-s)>hn.CODEWORD_SKEW_SIZE)return i;s+=a}a=-a,r=!r}return s}static checkCodewordSkew(e,t,n){return t-hn.CODEWORD_SKEW_SIZE<=e&&e<=n+hn.CODEWORD_SKEW_SIZE}static decodeCodewords(e,t,n){if(0===e.length)throw _.getFormatInstance();let r=1<<t+1,i=hn.correctErrors(e,n,r);hn.verifyCodewordCount(e,r);let o=fn.decode(e,""+t);return o.setErrorsCorrected(i),o.setErasures(n.length),o}static correctErrors(e,t,n){if(null!=t&&t.length>n/2+hn.MAX_ERRORS||n<0||n>hn.MAX_EC_CODEWORDS)throw f.getChecksumInstance();return hn.errorCorrection.decode(e,n,t)}static verifyCodewordCount(e,t){if(e.length<4)throw _.getFormatInstance();let n=e[0];if(n>e.length)throw _.getFormatInstance();if(0===n){if(!(t<e.length))throw _.getFormatInstance();e[0]=e.length-t}}static getBitCountForCodeword(e){let t=new Int32Array(8),n=0,r=t.length-1;for(;!((1&e)!==n&&(n=1&e,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 hn.getCodewordBucketNumber(hn.getBitCountForCodeword(e))}static getCodewordBucketNumber_Int32Array(e){return(e[0]-e[2]+e[4]-e[6]+9)%9}static toString(e){let t=new Xt;for(let n=0;n<e.length;n++){t.format("Row %2d: ",n);for(let r=0;r<e[n].length;r++){let i=e[n][r];0===i.getValue().length?t.format(" ",null):t.format("%4d(%2d)",i.getValue()[0],i.getConfidence(i.getValue()[0]))}t.format("%n")}return t.toString()}}hn.CODEWORD_SKEW_SIZE=2,hn.MAX_ERRORS=3,hn.MAX_EC_CODEWORDS=512,hn.errorCorrection=new jt;class mn{decode(e,t=null){let n=mn.decode(e,t,!1);if(null==n||0===n.length||null==n[0])throw T.getNotFoundInstance();return n[0]}decodeMultiple(e,t=null){try{return mn.decode(e,t,!0)}catch(e){if(e instanceof _||e instanceof f)throw T.getNotFoundInstance();throw e}}static decode(e,t,n){const r=new Array,i=Ut.detectMultiple(e,t,n);for(const e of i.getPoints()){const t=hn.decode(i.getBits(),e[4],e[5],e[6],e[7],mn.getMinCodewordWidth(e),mn.getMaxCodewordWidth(e)),n=new F(t.getText(),t.getRawBytes(),void 0,e,U.PDF_417);n.putMetadata(X.ERROR_CORRECTION_LEVEL,t.getECLevel());const o=t.getOther();null!=o&&n.putMetadata(X.PDF417_EXTRA_METADATA,o),r.push(n)}return r.map(e=>e)}static getMaxWidth(e,t){return null==e||null==t?0:Math.trunc(Math.abs(e.getX()-t.getX()))}static getMinWidth(e,t){return null==e||null==t?y.MAX_VALUE:Math.trunc(Math.abs(e.getX()-t.getX()))}static getMaxCodewordWidth(e){return Math.floor(Math.max(Math.max(mn.getMaxWidth(e[0],e[4]),mn.getMaxWidth(e[6],e[2])*Ft.MODULES_IN_CODEWORD/Ft.MODULES_IN_STOP_PATTERN),Math.max(mn.getMaxWidth(e[1],e[5]),mn.getMaxWidth(e[7],e[3])*Ft.MODULES_IN_CODEWORD/Ft.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(e){return Math.floor(Math.min(Math.min(mn.getMinWidth(e[0],e[4]),mn.getMinWidth(e[6],e[2])*Ft.MODULES_IN_CODEWORD/Ft.MODULES_IN_STOP_PATTERN),Math.min(mn.getMinWidth(e[1],e[5]),mn.getMinWidth(e[7],e[3])*Ft.MODULES_IN_CODEWORD/Ft.MODULES_IN_STOP_PATTERN)))}reset(){}}class pn extends l{}pn.kind="ReaderException";class gn{constructor(e,t){this.verbose=!0===e,t&&this.setHints(t)}decode(e,t){return t&&this.setHints(t),this.decodeInternal(e)}decodeWithState(e){return null!==this.readers&&void 0!==this.readers||this.setHints(null),this.decodeInternal(e)}setHints(e){this.hints=e;const n=!t(e)&&!0===e.get(I.TRY_HARDER),r=t(e)?null:e.get(I.POSSIBLE_FORMATS),i=new Array;if(!t(r)){const t=r.some(e=>e===U.UPC_A||e===U.UPC_E||e===U.EAN_13||e===U.EAN_8||e===U.CODABAR||e===U.CODE_39||e===U.CODE_93||e===U.CODE_128||e===U.ITF||e===U.RSS_14||e===U.RSS_EXPANDED);t&&!n&&i.push(new at(e,this.verbose)),r.includes(U.QR_CODE)&&i.push(new Lt),r.includes(U.DATA_MATRIX)&&i.push(new yt),r.includes(U.AZTEC)&&i.push(new ge),r.includes(U.PDF_417)&&i.push(new mn),t&&n&&i.push(new at(e,this.verbose))}0===i.length&&(n||i.push(new at(e,this.verbose)),i.push(new Lt),i.push(new yt),i.push(new ge),i.push(new mn),n&&i.push(new at(e,this.verbose))),this.readers=i}reset(){if(null!==this.readers)for(const e of this.readers)e.reset()}decodeInternal(e){if(null===this.readers)throw new pn("No readers where selected, nothing can be read.");for(const t of this.readers)try{return t.decode(e,this.hints)}catch(e){if(e instanceof pn)continue}throw new T("No MultiFormat Readers were able to detect the code.")}}class wn extends L{constructor(e=null,t=500){const n=new gn;n.setHints(e),super(n,t)}decodeBitmap(e){return this.reader.decodeWithState(e)}}class yn extends L{constructor(e=500){super(new mn,e)}}class vn extends L{constructor(e=500){super(new Lt,e)}}var $n;!function(e){e[e.ERROR_CORRECTION=0]="ERROR_CORRECTION",e[e.CHARACTER_SET=1]="CHARACTER_SET",e[e.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",e[e.MIN_SIZE=3]="MIN_SIZE",e[e.MAX_SIZE=4]="MAX_SIZE",e[e.MARGIN=5]="MARGIN",e[e.PDF417_COMPACT=6]="PDF417_COMPACT",e[e.PDF417_COMPACTION=7]="PDF417_COMPACTION",e[e.PDF417_DIMENSIONS=8]="PDF417_DIMENSIONS",e[e.AZTEC_LAYERS=9]="AZTEC_LAYERS",e[e.QR_VERSION=10]="QR_VERSION"}($n||($n={}));var In=$n;class _n{constructor(e){this.field=e,this.cachedGenerators=[],this.cachedGenerators.push(new K(e,Int32Array.from([1])))}buildGenerator(e){const t=this.cachedGenerators;if(e>=t.length){let n=t[t.length-1];const r=this.field;for(let i=t.length;i<=e;i++){const e=n.multiply(new K(r,Int32Array.from([1,r.exp(i-1+r.getGeneratorBase())])));t.push(e),n=e}}return t[e]}encode(e,t){if(0===t)throw new d("No error correction bytes");const n=e.length-t;if(n<=0)throw new d("No data bytes provided");const r=this.buildGenerator(t),i=new Int32Array(n);m.arraycopy(e,0,i,0,n);let o=new K(this.field,i);o=o.multiplyByMonomial(t,1);const s=o.divide(r)[1].getCoefficients(),a=t-s.length;for(let t=0;t<a;t++)e[n+t]=0;m.arraycopy(s,0,e,n+a,s.length)}}class Cn{constructor(){}static applyMaskPenaltyRule1(e){return Cn.applyMaskPenaltyRule1Internal(e,!0)+Cn.applyMaskPenaltyRule1Internal(e,!1)}static applyMaskPenaltyRule2(e){let t=0;const n=e.getArray(),r=e.getWidth(),i=e.getHeight();for(let e=0;e<i-1;e++){const i=n[e];for(let o=0;o<r-1;o++){const r=i[o];r===i[o+1]&&r===n[e+1][o]&&r===n[e+1][o+1]&&t++}}return Cn.N2*t}static applyMaskPenaltyRule3(e){let t=0;const n=e.getArray(),r=e.getWidth(),i=e.getHeight();for(let e=0;e<i;e++)for(let o=0;o<r;o++){const s=n[e];o+6<r&&1===s[o]&&0===s[o+1]&&1===s[o+2]&&1===s[o+3]&&1===s[o+4]&&0===s[o+5]&&1===s[o+6]&&(Cn.isWhiteHorizontal(s,o-4,o)||Cn.isWhiteHorizontal(s,o+7,o+11))&&t++,e+6<i&&1===n[e][o]&&0===n[e+1][o]&&1===n[e+2][o]&&1===n[e+3][o]&&1===n[e+4][o]&&0===n[e+5][o]&&1===n[e+6][o]&&(Cn.isWhiteVertical(n,o,e-4,e)||Cn.isWhiteVertical(n,o,e+7,e+11))&&t++}return t*Cn.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(1===e[r])return!1;return!0}static isWhiteVertical(e,t,n,r){n=Math.max(n,0),r=Math.min(r,e.length);for(let i=n;i<r;i++)if(1===e[i][t])return!1;return!0}static applyMaskPenaltyRule4(e){let t=0;const n=e.getArray(),r=e.getWidth(),i=e.getHeight();for(let e=0;e<i;e++){const i=n[e];for(let e=0;e<r;e++)1===i[e]&&t++}const o=e.getHeight()*e.getWidth();return Math.floor(10*Math.abs(2*t-o)/o)*Cn.N4}static getDataMaskBit(e,t,n){let r,i;switch(e){case 0:r=n+t&1;break;case 1:r=1&n;break;case 2:r=t%3;break;case 3:r=(n+t)%3;break;case 4:r=Math.floor(n/2)+Math.floor(t/3)&1;break;case 5:i=n*t,r=(1&i)+i%3;break;case 6:i=n*t,r=(1&i)+i%3&1;break;case 7:i=n*t,r=i%3+(n+t&1)&1;break;default:throw new d("Invalid mask pattern: "+e)}return 0===r}static applyMaskPenaltyRule1Internal(e,t){let n=0;const r=t?e.getHeight():e.getWidth(),i=t?e.getWidth():e.getHeight(),o=e.getArray();for(let e=0;e<r;e++){let r=0,s=-1;for(let a=0;a<i;a++){const i=t?o[e][a]:o[a][e];i===s?r++:(r>=5&&(n+=Cn.N1+(r-5)),r=1,s=i)}r>=5&&(n+=Cn.N1+(r-5))}return n}}Cn.N1=3,Cn.N2=3,Cn.N3=40,Cn.N4=10;class En{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)w.fill(t,e)}equals(e){if(!(e instanceof En))return!1;const t=e;if(this.width!==t.width)return!1;if(this.height!==t.height)return!1;for(let e=0,n=this.height;e<n;++e){const n=this.bytes[e],r=t.bytes[e];for(let e=0,t=this.width;e<t;++e)if(n[e]!==r[e])return!1}return!0}toString(){const e=new S;for(let t=0,n=this.height;t<n;++t){const n=this.bytes[t];for(let t=0,r=this.width;t<r;++t)switch(n[t]){case 0:e.append(" 0");break;case 1:e.append(" 1");break;default:e.append(" ")}e.append("\n")}return e.toString()}}class An{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 S;return e.append("<<\n"),e.append(" mode: "),e.append(this.mode?this.mode.toString():"null"),e.append("\n ecLevel: "),e.append(this.ecLevel?this.ecLevel.toString():"null"),e.append("\n version: "),e.append(this.version?this.version.toString():"null"),e.append("\n maskPattern: "),e.append(this.maskPattern.toString()),this.matrix?(e.append("\n matrix:\n"),e.append(this.matrix.toString())):e.append("\n matrix: null\n"),e.append(">>\n"),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<An.NUM_MASK_PATTERNS}}An.NUM_MASK_PATTERNS=8;class bn extends l{}bn.kind="WriterException";class Sn{constructor(){}static clearMatrix(e){e.clear(255)}static buildMatrix(e,t,n,r,i){Sn.clearMatrix(i),Sn.embedBasicPatterns(n,i),Sn.embedTypeInfo(t,r,i),Sn.maybeEmbedVersionInfo(n,i),Sn.embedDataBits(e,r,i)}static embedBasicPatterns(e,t){Sn.embedPositionDetectionPatternsAndSeparators(t),Sn.embedDarkDotAtLeftBottomCorner(t),Sn.maybeEmbedPositionAdjustmentPatterns(e,t),Sn.embedTimingPatterns(t)}static embedTypeInfo(e,t,n){const r=new v;Sn.makeTypeInfoBits(e,t,r);for(let e=0,t=r.getSize();e<t;++e){const t=r.get(r.getSize()-1-e),i=Sn.TYPE_INFO_COORDINATES[e],o=i[0],s=i[1];if(n.setBoolean(o,s,t),e<8){const r=n.getWidth()-e-1,i=8;n.setBoolean(r,i,t)}else{const r=8,i=n.getHeight()-7+(e-8);n.setBoolean(r,i,t)}}}static maybeEmbedVersionInfo(e,t){if(e.getVersionNumber()<7)return;const n=new v;Sn.makeVersionInfoBits(e,n);let r=17;for(let e=0;e<6;++e)for(let i=0;i<3;++i){const o=n.get(r);r--,t.setBoolean(e,t.getHeight()-11+i,o),t.setBoolean(t.getHeight()-11+i,e,o)}}static embedDataBits(e,t,n){let r=0,i=-1,o=n.getWidth()-1,s=n.getHeight()-1;for(;o>0;){for(6===o&&(o-=1);s>=0&&s<n.getHeight();){for(let i=0;i<2;++i){const a=o-i;if(!Sn.isEmpty(n.get(a,s)))continue;let l;r<e.getSize()?(l=e.get(r),++r):l=!1,255!==t&&Cn.getDataMaskBit(t,a,s)&&(l=!l),n.setBoolean(a,s,l)}s+=i}i=-i,s+=i,o-=2}if(r!==e.getSize())throw new bn("Not all bits consumed: "+r+"/"+e.getSize())}static findMSBSet(e){return 32-y.numberOfLeadingZeros(e)}static calculateBCHCode(e,t){if(0===t)throw new d("0 polynomial");const n=Sn.findMSBSet(t);for(e<<=n-1;Sn.findMSBSet(e)>=n;)e^=t<<Sn.findMSBSet(e)-n;return e}static makeTypeInfoBits(e,t,n){if(!An.isValidMaskPattern(t))throw new bn("Invalid mask pattern");const r=e.getBits()<<3|t;n.appendBits(r,5);const i=Sn.calculateBCHCode(r,Sn.TYPE_INFO_POLY);n.appendBits(i,10);const o=new v;if(o.appendBits(Sn.TYPE_INFO_MASK_PATTERN,15),n.xor(o),15!==n.getSize())throw new bn("should not happen but we got: "+n.getSize())}static makeVersionInfoBits(e,t){t.appendBits(e.getVersionNumber(),6);const n=Sn.calculateBCHCode(e.getVersionNumber(),Sn.VERSION_INFO_POLY);if(t.appendBits(n,12),18!==t.getSize())throw new bn("should not happen but we got: "+t.getSize())}static isEmpty(e){return 255===e}static embedTimingPatterns(e){for(let t=8;t<e.getWidth()-8;++t){const n=(t+1)%2;Sn.isEmpty(e.get(t,6))&&e.setNumber(t,6,n),Sn.isEmpty(e.get(6,t))&&e.setNumber(6,t,n)}}static embedDarkDotAtLeftBottomCorner(e){if(0===e.get(8,e.getHeight()-8))throw new bn;e.setNumber(8,e.getHeight()-8,1)}static embedHorizontalSeparationPattern(e,t,n){for(let r=0;r<8;++r){if(!Sn.isEmpty(n.get(e+r,t)))throw new bn;n.setNumber(e+r,t,0)}}static embedVerticalSeparationPattern(e,t,n){for(let r=0;r<7;++r){if(!Sn.isEmpty(n.get(e,t+r)))throw new bn;n.setNumber(e,t+r,0)}}static embedPositionAdjustmentPattern(e,t,n){for(let r=0;r<5;++r){const i=Sn.POSITION_ADJUSTMENT_PATTERN[r];for(let o=0;o<5;++o)n.setNumber(e+o,t+r,i[o])}}static embedPositionDetectionPattern(e,t,n){for(let r=0;r<7;++r){const i=Sn.POSITION_DETECTION_PATTERN[r];for(let o=0;o<7;++o)n.setNumber(e+o,t+r,i[o])}}static embedPositionDetectionPatternsAndSeparators(e){const t=Sn.POSITION_DETECTION_PATTERN[0].length;Sn.embedPositionDetectionPattern(0,0,e),Sn.embedPositionDetectionPattern(e.getWidth()-t,0,e),Sn.embedPositionDetectionPattern(0,e.getWidth()-t,e);const n=8;Sn.embedHorizontalSeparationPattern(0,n-1,e),Sn.embedHorizontalSeparationPattern(e.getWidth()-n,n-1,e),Sn.embedHorizontalSeparationPattern(0,e.getWidth()-n,e);const r=7;Sn.embedVerticalSeparationPattern(r,0,e),Sn.embedVerticalSeparationPattern(e.getHeight()-r-1,0,e),Sn.embedVerticalSeparationPattern(r,e.getHeight()-r,e)}static maybeEmbedPositionAdjustmentPatterns(e,t){if(e.getVersionNumber()<2)return;const n=e.getVersionNumber()-1,r=Sn.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[n];for(let e=0,n=r.length;e!==n;e++){const i=r[e];if(i>=0)for(let e=0;e!==n;e++){const n=r[e];n>=0&&Sn.isEmpty(t.get(n,i))&&Sn.embedPositionAdjustmentPattern(n-2,i-2,t)}}}}Sn.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])]),Sn.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])]),Sn.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])]),Sn.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])]),Sn.VERSION_INFO_POLY=7973,Sn.TYPE_INFO_POLY=1335,Sn.TYPE_INFO_MASK_PATTERN=21522;class Nn{constructor(e,t){this.dataBytes=e,this.errorCorrectionBytes=t}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class Tn{constructor(){}static calculateMaskPenalty(e){return Cn.applyMaskPenaltyRule1(e)+Cn.applyMaskPenaltyRule2(e)+Cn.applyMaskPenaltyRule3(e)+Cn.applyMaskPenaltyRule4(e)}static encode(e,t,n=null){let r=Tn.DEFAULT_BYTE_MODE_ENCODING;const i=null!==n&&void 0!==n.get(In.CHARACTER_SET);i&&(r=n.get(In.CHARACTER_SET).toString());const o=this.chooseMode(e,r),s=new v;if(o===Nt.BYTE&&(i||Tn.DEFAULT_BYTE_MODE_ENCODING!==r)){const e=C.getCharacterSetECIByName(r);void 0!==e&&this.appendECI(e,s)}this.appendModeInfo(o,s);const a=new v;let l;if(this.appendBytes(e,o,a,r),null!==n&&void 0!==n.get(In.QR_VERSION)){const e=Number.parseInt(n.get(In.QR_VERSION).toString(),10);l=Et.getVersionForNumber(e);const r=this.calculateBitsNeeded(o,s,a,l);if(!this.willFit(r,l,t))throw new bn("Data too big for requested version")}else l=this.recommendVersion(t,o,s,a);const c=new v;c.appendBitArray(s);const d=o===Nt.BYTE?a.getSizeInBytes():e.length;this.appendLengthInfo(d,l,o,c),c.appendBitArray(a);const u=l.getECBlocksForLevel(t),f=l.getTotalCodewords()-u.getTotalECCodewords();this.terminateBits(f,c);const h=this.interleaveWithECBytes(c,l.getTotalCodewords(),f,u.getNumBlocks()),m=new An;m.setECLevel(t),m.setMode(o),m.setVersion(l);const p=l.getDimensionForVersion(),g=new En(p,p),w=this.chooseMaskPattern(h,t,l,g);return m.setMaskPattern(w),Sn.buildMatrix(h,t,l,w,g),m.setMatrix(g),m}static recommendVersion(e,t,n,r){const i=this.calculateBitsNeeded(t,n,r,Et.getVersionForNumber(1)),o=this.chooseVersion(i,e),s=this.calculateBitsNeeded(t,n,r,o);return this.chooseVersion(s,e)}static calculateBitsNeeded(e,t,n,r){return t.getSize()+e.getCharacterCountBits(r)+n.getSize()}static getAlphanumericCode(e){return e<Tn.ALPHANUMERIC_TABLE.length?Tn.ALPHANUMERIC_TABLE[e]:-1}static chooseMode(e,t=null){if(C.SJIS.getName()===t&&this.isOnlyDoubleByteKanji(e))return Nt.KANJI;let n=!1,r=!1;for(let t=0,i=e.length;t<i;++t){const i=e.charAt(t);if(Tn.isDigit(i))n=!0;else{if(-1===this.getAlphanumericCode(i.charCodeAt(0)))return Nt.BYTE;r=!0}}return r?Nt.ALPHANUMERIC:n?Nt.NUMERIC:Nt.BYTE}static isOnlyDoubleByteKanji(e){let t;try{t=A.encode(e,C.SJIS)}catch(e){return!1}const n=t.length;if(n%2!=0)return!1;for(let e=0;e<n;e+=2){const n=255&t[e];if((n<129||n>159)&&(n<224||n>235))return!1}return!0}static chooseMaskPattern(e,t,n,r){let i=Number.MAX_SAFE_INTEGER,o=-1;for(let s=0;s<An.NUM_MASK_PATTERNS;s++){Sn.buildMatrix(e,t,n,s,r);let a=this.calculateMaskPenalty(r);a<i&&(i=a,o=s)}return o}static chooseVersion(e,t){for(let n=1;n<=40;n++){const r=Et.getVersionForNumber(n);if(Tn.willFit(e,r,t))return r}throw new bn("Data too big")}static willFit(e,t,n){return t.getTotalCodewords()-t.getECBlocksForLevel(n).getTotalECCodewords()>=(e+7)/8}static terminateBits(e,t){const n=8*e;if(t.getSize()>n)throw new bn("data bits cannot fit in the QR Code"+t.getSize()+" > "+n);for(let e=0;e<4&&t.getSize()<n;++e)t.appendBit(!1);const r=7&t.getSize();if(r>0)for(let e=r;e<8;e++)t.appendBit(!1);const i=e-t.getSizeInBytes();for(let e=0;e<i;++e)t.appendBits(1&e?17:236,8);if(t.getSize()!==n)throw new bn("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(e,t,n,r,i,o){if(r>=n)throw new bn("Block ID too large");const s=e%n,a=n-s,l=Math.floor(e/n),c=l+1,d=Math.floor(t/n),u=d+1,f=l-d,h=c-u;if(f!==h)throw new bn("EC bytes mismatch");if(n!==a+s)throw new bn("RS blocks mismatch");if(e!==(d+f)*a+(u+h)*s)throw new bn("Total bytes mismatch");r<a?(i[0]=d,o[0]=f):(i[0]=u,o[0]=h)}static interleaveWithECBytes(e,t,n,r){if(e.getSizeInBytes()!==n)throw new bn("Number of bits and data bytes does not match");let i=0,o=0,s=0;const a=new Array;for(let l=0;l<r;++l){const c=new Int32Array(1),d=new Int32Array(1);Tn.getNumDataBytesAndNumECBytesForBlockID(t,n,r,l,c,d);const u=c[0],f=new Uint8Array(u);e.toBytes(8*i,f,0,u);const h=Tn.generateECBytes(f,d[0]);a.push(new Nn(f,h)),o=Math.max(o,u),s=Math.max(s,h.length),i+=c[0]}if(n!==i)throw new bn("Data bytes does not match offset");const l=new v;for(let e=0;e<o;++e)for(const t of a){const n=t.getDataBytes();e<n.length&&l.appendBits(n[e],8)}for(let e=0;e<s;++e)for(const t of a){const n=t.getErrorCorrectionBytes();e<n.length&&l.appendBits(n[e],8)}if(t!==l.getSizeInBytes())throw new bn("Interleaving error: "+t+" and "+l.getSizeInBytes()+" differ.");return l}static generateECBytes(e,t){const n=e.length,r=new Int32Array(n+t);for(let t=0;t<n;t++)r[t]=255&e[t];new _n(J.QR_CODE_FIELD_256).encode(r,t);const i=new Uint8Array(t);for(let e=0;e<t;e++)i[e]=r[n+e];return i}static appendModeInfo(e,t){t.appendBits(e.getBits(),4)}static appendLengthInfo(e,t,n,r){const i=n.getCharacterCountBits(t);if(e>=1<<i)throw new bn(e+" is bigger than "+((1<<i)-1));r.appendBits(e,i)}static appendBytes(e,t,n,r){switch(t){case Nt.NUMERIC:Tn.appendNumericBytes(e,n);break;case Nt.ALPHANUMERIC:Tn.appendAlphanumericBytes(e,n);break;case Nt.BYTE:Tn.append8BitBytes(e,n,r);break;case Nt.KANJI:Tn.appendKanjiBytes(e,n);break;default:throw new bn("Invalid mode: "+t)}}static getDigit(e){return e.charCodeAt(0)-48}static isDigit(e){const t=Tn.getDigit(e);return t>=0&&t<=9}static appendNumericBytes(e,t){const n=e.length;let r=0;for(;r<n;){const i=Tn.getDigit(e.charAt(r));if(r+2<n){const n=Tn.getDigit(e.charAt(r+1)),o=Tn.getDigit(e.charAt(r+2));t.appendBits(100*i+10*n+o,10),r+=3}else if(r+1<n){const n=Tn.getDigit(e.charAt(r+1));t.appendBits(10*i+n,7),r+=2}else t.appendBits(i,4),r++}}static appendAlphanumericBytes(e,t){const n=e.length;let r=0;for(;r<n;){const i=Tn.getAlphanumericCode(e.charCodeAt(r));if(-1===i)throw new bn;if(r+1<n){const n=Tn.getAlphanumericCode(e.charCodeAt(r+1));if(-1===n)throw new bn;t.appendBits(45*i+n,11),r+=2}else t.appendBits(i,6),r++}}static append8BitBytes(e,t,n){let r;try{r=A.encode(e,n)}catch(e){throw new bn(e)}for(let e=0,n=r.length;e!==n;e++){const n=r[e];t.appendBits(n,8)}}static appendKanjiBytes(e,t){let n;try{n=A.encode(e,C.SJIS)}catch(e){throw new bn(e)}const r=n.length;for(let e=0;e<r;e+=2){const r=(255&n[e])<<8&4294967295|255&n[e+1];let i=-1;if(r>=33088&&r<=40956?i=r-33088:r>=57408&&r<=60351&&(i=r-49472),-1===i)throw new bn("Invalid byte sequence");const o=192*(i>>8)+(255&i);t.appendBits(o,13)}}static appendECI(e,t){t.appendBits(Nt.ECI.getBits(),4),t.appendBits(e.getValue(),8)}}Tn.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]),Tn.DEFAULT_BYTE_MODE_ENCODING=C.UTF8.getName();class Rn{write(e,t,n,r=null){if(0===e.length)throw new d("Found empty contents");if(t<0||n<0)throw new d("Requested dimensions are too small: "+t+"x"+n);let i=$t.L,o=Rn.QUIET_ZONE_SIZE;null!==r&&(void 0!==r.get(In.ERROR_CORRECTION)&&(i=$t.fromString(r.get(In.ERROR_CORRECTION).toString())),void 0!==r.get(In.MARGIN)&&(o=Number.parseInt(r.get(In.MARGIN).toString(),10)));const s=Tn.encode(e,i,r);return this.renderResult(s,t,n,o)}writeToDom(e,t,n,r,i=null){"string"==typeof e&&(e=document.querySelector(e));const o=this.write(t,n,r,i);e&&e.appendChild(o)}renderResult(e,t,n,r){const i=e.getMatrix();if(null===i)throw new te;const o=i.getWidth(),s=i.getHeight(),a=o+2*r,l=s+2*r,c=Math.max(t,a),d=Math.max(n,l),u=Math.min(Math.floor(c/a),Math.floor(d/l)),f=Math.floor((c-o*u)/2),h=Math.floor((d-s*u)/2),m=this.createSVGElement(c,d);for(let e=0,t=h;e<s;e++,t+=u)for(let n=0,r=f;n<o;n++,r+=u)if(1===i.get(n,e)){const e=this.createSvgRectElement(r,t,u,u);m.appendChild(e)}return m}createSVGElement(e,t){const n=document.createElementNS(Rn.SVG_NS,"svg");return n.setAttributeNS(null,"height",e.toString()),n.setAttributeNS(null,"width",t.toString()),n}createSvgRectElement(e,t,n,r){const i=document.createElementNS(Rn.SVG_NS,"rect");return i.setAttributeNS(null,"x",e.toString()),i.setAttributeNS(null,"y",t.toString()),i.setAttributeNS(null,"height",n.toString()),i.setAttributeNS(null,"width",r.toString()),i.setAttributeNS(null,"fill","#000000"),i}}Rn.QUIET_ZONE_SIZE=4,Rn.SVG_NS="http://www.w3.org/2000/svg";class Dn{encode(e,t,n,r,i){if(0===e.length)throw new d("Found empty contents");if(t!==U.QR_CODE)throw new d("Can only encode QR_CODE, but got "+t);if(n<0||r<0)throw new d(`Requested dimensions are too small: ${n}x${r}`);let o=$t.L,s=Dn.QUIET_ZONE_SIZE;null!==i&&(void 0!==i.get(In.ERROR_CORRECTION)&&(o=$t.fromString(i.get(In.ERROR_CORRECTION).toString())),void 0!==i.get(In.MARGIN)&&(s=Number.parseInt(i.get(In.MARGIN).toString(),10)));const a=Tn.encode(e,o,i);return Dn.renderResult(a,n,r,s)}static renderResult(e,t,n,r){const i=e.getMatrix();if(null===i)throw new te;const o=i.getWidth(),s=i.getHeight(),a=o+2*r,l=s+2*r,c=Math.max(t,a),d=Math.max(n,l),u=Math.min(Math.floor(c/a),Math.floor(d/l)),f=Math.floor((c-o*u)/2),h=Math.floor((d-s*u)/2),m=new N(c,d);for(let e=0,t=h;e<s;e++,t+=u)for(let n=0,r=f;n<o;n++,r+=u)1===i.get(n,e)&&m.setRegion(r,t,u,u);return m}}Dn.QUIET_ZONE_SIZE=4;class xn{encode(e,t,n,r,i){let o;if(t!==U.QR_CODE)throw new d("No encoder available for format "+t);return o=new Dn,o.encode(e,t,n,r,i)}}class kn extends x{constructor(e,t,n,r,i,o,s,a){if(super(o,s),this.yuvData=e,this.dataWidth=t,this.dataHeight=n,this.left=r,this.top=i,r+o>t||i+s>n)throw new d("Crop rectangle does not fit within image data.");a&&this.reverseHorizontal(o,s)}getRow(e,t){if(e<0||e>=this.getHeight())throw new d("Requested row is outside the image: "+e);const n=this.getWidth();(null==t||t.length<n)&&(t=new Uint8ClampedArray(n));const r=(e+this.top)*this.dataWidth+this.left;return m.arraycopy(this.yuvData,r,t,0,n),t}getMatrix(){const e=this.getWidth(),t=this.getHeight();if(e===this.dataWidth&&t===this.dataHeight)return this.yuvData;const n=e*t,r=new Uint8ClampedArray(n);let i=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return m.arraycopy(this.yuvData,i,r,0,n),r;for(let n=0;n<t;n++){const t=n*e;m.arraycopy(this.yuvData,i,r,t,e),i+=this.dataWidth}return r}isCropSupported(){return!0}crop(e,t,n,r){return new kn(this.yuvData,this.dataWidth,this.dataHeight,this.left+e,this.top+t,n,r,!1)}renderThumbnail(){const e=this.getWidth()/kn.THUMBNAIL_SCALE_FACTOR,t=this.getHeight()/kn.THUMBNAIL_SCALE_FACTOR,n=new Int32Array(e*t),r=this.yuvData;let i=this.top*this.dataWidth+this.left;for(let o=0;o<t;o++){const t=o*e;for(let o=0;o<e;o++){const e=255&r[i+o*kn.THUMBNAIL_SCALE_FACTOR];n[t+o]=4278190080|65793*e}i+=this.dataWidth*kn.THUMBNAIL_SCALE_FACTOR}return n}getThumbnailWidth(){return this.getWidth()/kn.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/kn.THUMBNAIL_SCALE_FACTOR}reverseHorizontal(e,t){const n=this.yuvData;for(let r=0,i=this.top*this.dataWidth+this.left;r<t;r++,i+=this.dataWidth){const t=i+e/2;for(let r=i,o=i+e-1;r<t;r++,o--){const e=n[r];n[r]=n[o],n[o]=e}}}invert(){return new k(this)}}kn.THUMBNAIL_SCALE_FACTOR=2;class On extends x{constructor(e,t,n,r,i,o,s){if(super(t,n),this.dataWidth=r,this.dataHeight=i,this.left=o,this.top=s,4===e.BYTES_PER_ELEMENT){const r=t*n,i=new Uint8ClampedArray(r);for(let t=0;t<r;t++){const n=e[t],r=n>>16&255,o=n>>7&510,s=255&n;i[t]=(r+o+s)/4&255}this.luminances=i}else this.luminances=e;if(void 0===r&&(this.dataWidth=t),void 0===i&&(this.dataHeight=n),void 0===o&&(this.left=0),void 0===s&&(this.top=0),this.left+t>this.dataWidth||this.top+n>this.dataHeight)throw new d("Crop rectangle does not fit within image data.")}getRow(e,t){if(e<0||e>=this.getHeight())throw new d("Requested row is outside the image: "+e);const n=this.getWidth();(null==t||t.length<n)&&(t=new Uint8ClampedArray(n));const r=(e+this.top)*this.dataWidth+this.left;return m.arraycopy(this.luminances,r,t,0,n),t}getMatrix(){const e=this.getWidth(),t=this.getHeight();if(e===this.dataWidth&&t===this.dataHeight)return this.luminances;const n=e*t,r=new Uint8ClampedArray(n);let i=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return m.arraycopy(this.luminances,i,r,0,n),r;for(let n=0;n<t;n++){const t=n*e;m.arraycopy(this.luminances,i,r,t,e),i+=this.dataWidth}return r}isCropSupported(){return!0}crop(e,t,n,r){return new On(this.luminances,n,r,this.dataWidth,this.dataHeight,this.left+e,this.top+t)}invert(){return new k(this)}}class Mn extends C{static forName(e){return this.getCharacterSetECIByName(e)}}class Pn{}Pn.ISO_8859_1=C.ISO8859_1;class Bn{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 Ln{static singletonList(e){return[e]}static min(e,t){return e.sort(t)[0]}}class Fn{constructor(e){this.previous=e}getPrevious(){return this.previous}}class Vn extends Fn{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 Vn(this,e,t)}addBinaryShift(e,t){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new Vn(this,e,t)}toString(){let e=this.value&(1<<this.bitCount)-1;return e|=1<<this.bitCount,"<"+y.toBinaryString(e|1<<this.bitCount).substring(1)+">"}}class Un extends Vn{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++)(0===n||31===n&&this.binaryShiftByteCount<=62)&&(e.appendBits(31,5),this.binaryShiftByteCount>62?e.appendBits(this.binaryShiftByteCount-31,16):0===n?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 Un(this,e,t)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function Wn(e,t,n){return new Un(e,t,n)}function zn(e,t,n){return new Vn(e,t,n)}const Hn=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],jn=0,qn=1,Gn=2,Xn=3,Yn=4,Zn=new Vn(null,0,0),Kn=[Int32Array.from([0,327708,327710,327709,656318]),Int32Array.from([590318,0,327710,327709,656318]),Int32Array.from([262158,590300,0,590301,932798]),Int32Array.from([327709,327708,656318,0,327710]),Int32Array.from([327711,656380,656382,656381,0])];function Qn(e){for(let t of e)w.fill(t,-1);return e[jn][Yn]=0,e[qn][Yn]=0,e[qn][jn]=28,e[Xn][Yn]=0,e[Gn][Yn]=0,e[Gn][jn]=15,e}const Jn=Qn(w.createInt32Array(6,6));class er{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 t=Kn[this.mode][e];r=zn(r,65535&t,t>>16),n+=t>>16}let i=e===Gn?4:5;return r=zn(r,t,i),new er(r,e,0,n+i)}shiftAndAppend(e,t){let n=this.token,r=this.mode===Gn?4:5;return n=zn(n,Jn[this.mode][e],r),n=zn(n,t,5),new er(n,this.mode,0,this.bitCount+r+5)}addBinaryShiftChar(e){let t=this.token,n=this.mode,r=this.bitCount;if(this.mode===Yn||this.mode===Gn){let e=Kn[n][jn];t=zn(t,65535&e,e>>16),r+=e>>16,n=jn}let i=0===this.binaryShiftByteCount||31===this.binaryShiftByteCount?18:62===this.binaryShiftByteCount?9:8,o=new er(t,n,this.binaryShiftByteCount+1,r+i);return 2078===o.binaryShiftByteCount&&(o=o.endBinaryShift(e+1)),o}endBinaryShift(e){if(0===this.binaryShiftByteCount)return this;let t=this.token;return t=Wn(t,e-this.binaryShiftByteCount,this.binaryShiftByteCount),new er(t,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(e){let t=this.bitCount+(Kn[this.mode][e.mode]>>16);return this.binaryShiftByteCount<e.binaryShiftByteCount?t+=er.calculateBinaryShiftCost(e)-er.calculateBinaryShiftCost(this):this.binaryShiftByteCount>e.binaryShiftByteCount&&e.binaryShiftByteCount>0&&(t+=10),t<=e.bitCount}toBitArray(e){let t=[];for(let n=this.endBinaryShift(e.length).token;null!==n;n=n.getPrevious())t.unshift(n);let n=new v;for(const r of t)r.appendTo(n,e);return n}toString(){return b.format("%s bits=%d bytes=%d",Hn[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(e){return e.binaryShiftByteCount>62?21:e.binaryShiftByteCount>31?20:e.binaryShiftByteCount>0?10:0}}function tr(e){const t=b.getCharCode(" "),n=b.getCharCode("."),r=b.getCharCode(",");e[jn][t]=1;const i=b.getCharCode("Z"),o=b.getCharCode("A");for(let t=o;t<=i;t++)e[jn][t]=t-o+2;e[qn][t]=1;const s=b.getCharCode("z"),a=b.getCharCode("a");for(let t=a;t<=s;t++)e[qn][t]=t-a+2;e[Gn][t]=1;const l=b.getCharCode("9"),c=b.getCharCode("0");for(let t=c;t<=l;t++)e[Gn][t]=t-c+2;e[Gn][r]=12,e[Gn][n]=13;const d=["\0"," ","","","","","","","","\b","\t","\n","\v","\f","\r","","","","","","@","\\","^","_","`","|","~",""];for(let t=0;t<d.length;t++)e[Xn][b.getCharCode(d[t])]=t;const u=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let t=0;t<u.length;t++)b.getCharCode(u[t])>0&&(e[Yn][b.getCharCode(u[t])]=t);return e}er.INITIAL_STATE=new er(Zn,jn,0,0);const nr=tr(w.createInt32Array(5,256));class rr{constructor(e){this.text=e}encode(){const e=b.getCharCode(" "),t=b.getCharCode("\n");let n=Ln.singletonList(er.INITIAL_STATE);for(let r=0;r<this.text.length;r++){let i,o=r+1<this.text.length?this.text[r+1]:0;switch(this.text[r]){case b.getCharCode("\r"):i=o===t?2:0;break;case b.getCharCode("."):i=o===e?3:0;break;case b.getCharCode(","):i=o===e?4:0;break;case b.getCharCode(":"):i=o===e?5:0;break;default:i=0}i>0?(n=rr.updateStateListForPair(n,r,i),r++):n=this.updateStateListForChar(n,r)}return Ln.min(n,(e,t)=>e.getBitCount()-t.getBitCount()).toBitArray(this.text)}updateStateListForChar(e,t){const n=[];for(let r of e)this.updateStateForChar(r,t,n);return rr.simplifyStates(n)}updateStateForChar(e,t,n){let r=255&this.text[t],i=nr[e.getMode()][r]>0,o=null;for(let s=0;s<=Yn;s++){let a=nr[s][r];if(a>0){if(null==o&&(o=e.endBinaryShift(t)),!i||s===e.getMode()||s===Gn){const e=o.latchAndAppend(s,a);n.push(e)}if(!i&&Jn[e.getMode()][s]>=0){const e=o.shiftAndAppend(s,a);n.push(e)}}}if(e.getBinaryShiftByteCount()>0||0===nr[e.getMode()][r]){let r=e.addBinaryShiftChar(t);n.push(r)}}static updateStateListForPair(e,t,n){const r=[];for(let i of e)this.updateStateForPair(i,t,n,r);return this.simplifyStates(r)}static updateStateForPair(e,t,n,r){let i=e.endBinaryShift(t);if(r.push(i.latchAndAppend(Yn,n)),e.getMode()!==Yn&&r.push(i.shiftAndAppend(Yn,n)),3===n||4===n){let e=i.latchAndAppend(Gn,16-n).latchAndAppend(Gn,1);r.push(e)}if(e.getBinaryShiftByteCount()>0){let n=e.addBinaryShiftChar(t).addBinaryShiftChar(t+1);r.push(n)}}static simplifyStates(e){let t=[];for(const n of e){let e=!0;for(const r of t){if(r.isBetterThanOrEqualTo(n)){e=!1;break}n.isBetterThanOrEqualTo(r)&&(t=t.filter(e=>e!==r))}e&&t.push(n)}return t}}class ir{constructor(){}static encodeBytes(e){return ir.encode(e,ir.DEFAULT_EC_PERCENT,ir.DEFAULT_AZTEC_LAYERS)}static encode(e,t,n){let r,i,o,s,a,l=new rr(e).encode(),c=y.truncDivision(l.getSize()*t,100)+11,u=l.getSize()+c;if(n!==ir.DEFAULT_AZTEC_LAYERS){if(r=n<0,i=Math.abs(n),i>(r?ir.MAX_NB_BITS_COMPACT:ir.MAX_NB_BITS))throw new d(b.format("Illegal value %s for layers",n));o=ir.totalBitsInLayer(i,r),s=ir.WORD_SIZE[i];let e=o-o%s;if(a=ir.stuffBits(l,s),a.getSize()+c>e)throw new d("Data to large for user specified layer");if(r&&a.getSize()>64*s)throw new d("Data to large for user specified layer")}else{s=0,a=null;for(let e=0;;e++){if(e>ir.MAX_NB_BITS)throw new d("Data too large for an Aztec code");if(r=e<=3,i=r?e+1:e,o=ir.totalBitsInLayer(i,r),u>o)continue;null!=a&&s===ir.WORD_SIZE[i]||(s=ir.WORD_SIZE[i],a=ir.stuffBits(l,s));let t=o-o%s;if(!(r&&a.getSize()>64*s)&&a.getSize()+c<=t)break}}let f,h=ir.generateCheckWords(a,o,s),m=a.getSize()/s,p=ir.generateModeMessage(r,i,m),g=(r?11:14)+4*i,w=new Int32Array(g);if(r){f=g;for(let e=0;e<w.length;e++)w[e]=e}else{f=g+1+2*y.truncDivision(y.truncDivision(g,2)-1,15);let e=y.truncDivision(g,2),t=y.truncDivision(f,2);for(let n=0;n<e;n++){let r=n+y.truncDivision(n,15);w[e-n-1]=t-r-1,w[e+n]=t+r+1}}let v=new N(f);for(let e=0,t=0;e<i;e++){let n=4*(i-e)+(r?9:12);for(let r=0;r<n;r++){let i=2*r;for(let o=0;o<2;o++)h.get(t+i+o)&&v.set(w[2*e+o],w[2*e+r]),h.get(t+2*n+i+o)&&v.set(w[2*e+r],w[g-1-2*e-o]),h.get(t+4*n+i+o)&&v.set(w[g-1-2*e-o],w[g-1-2*e-r]),h.get(t+6*n+i+o)&&v.set(w[g-1-2*e-r],w[2*e+o])}t+=8*n}if(ir.drawModeMessage(v,r,f,p),r)ir.drawBullsEye(v,y.truncDivision(f,2),5);else{ir.drawBullsEye(v,y.truncDivision(f,2),7);for(let e=0,t=0;e<y.truncDivision(g,2)-1;e+=15,t+=16)for(let e=1&y.truncDivision(f,2);e<f;e+=2)v.set(y.truncDivision(f,2)-t,e),v.set(y.truncDivision(f,2)+t,e),v.set(e,y.truncDivision(f,2)-t),v.set(e,y.truncDivision(f,2)+t)}let $=new Bn;return $.setCompact(r),$.setSize(f),$.setLayers(i),$.setCodeWords(m),$.setMatrix(v),$}static drawBullsEye(e,t,n){for(let r=0;r<n;r+=2)for(let n=t-r;n<=t+r;n++)e.set(n,t-r),e.set(n,t+r),e.set(t-r,n),e.set(t+r,n);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 v;return e?(r.appendBits(t-1,2),r.appendBits(n-1,6),r=ir.generateCheckWords(r,28,4)):(r.appendBits(t-1,5),r.appendBits(n-1,11),r=ir.generateCheckWords(r,40,4)),r}static drawModeMessage(e,t,n,r){let i=y.truncDivision(n,2);if(t)for(let t=0;t<7;t++){let n=i-3+t;r.get(t)&&e.set(n,i-5),r.get(t+7)&&e.set(i+5,n),r.get(20-t)&&e.set(n,i+5),r.get(27-t)&&e.set(i-5,n)}else for(let t=0;t<10;t++){let n=i-5+t+y.truncDivision(t,5);r.get(t)&&e.set(n,i-7),r.get(t+10)&&e.set(i+7,n),r.get(29-t)&&e.set(n,i+7),r.get(39-t)&&e.set(i-7,n)}}static generateCheckWords(e,t,n){let r=e.getSize()/n,i=new _n(ir.getGF(n)),o=y.truncDivision(t,n),s=ir.bitsToWords(e,n,o);i.encode(s,o-r);let a=t%n,l=new v;l.appendBits(0,a);for(const e of Array.from(s))l.appendBits(e,n);return l}static bitsToWords(e,t,n){let r,i,o=new Int32Array(n);for(r=0,i=e.getSize()/t;r<i;r++){let n=0;for(let i=0;i<t;i++)n|=e.get(r*t+i)?1<<t-i-1:0;o[r]=n}return o}static getGF(e){switch(e){case 4:return J.AZTEC_PARAM;case 6:return J.AZTEC_DATA_6;case 8:return J.AZTEC_DATA_8;case 10:return J.AZTEC_DATA_10;case 12:return J.AZTEC_DATA_12;default:throw new d("Unsupported word size "+e)}}static stuffBits(e,t){let n=new v,r=e.getSize(),i=(1<<t)-2;for(let o=0;o<r;o+=t){let s=0;for(let n=0;n<t;n++)(o+n>=r||e.get(o+n))&&(s|=1<<t-1-n);(s&i)===i?(n.appendBits(s&i,t),o--):0===(s&i)?(n.appendBits(1|s,t),o--):n.appendBits(s,t)}return n}static totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}ir.DEFAULT_EC_PERCENT=33,ir.DEFAULT_AZTEC_LAYERS=0,ir.MAX_NB_BITS=32,ir.MAX_NB_BITS_COMPACT=4,ir.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 or{encode(e,t,n,r){return this.encodeWithHints(e,t,n,r,null)}encodeWithHints(e,t,n,r,i){let o=Pn.ISO_8859_1,s=ir.DEFAULT_EC_PERCENT,a=ir.DEFAULT_AZTEC_LAYERS;return null!=i&&(i.has(In.CHARACTER_SET)&&(o=Mn.forName(i.get(In.CHARACTER_SET).toString())),i.has(In.ERROR_CORRECTION)&&(s=y.parseInt(i.get(In.ERROR_CORRECTION).toString())),i.has(In.AZTEC_LAYERS)&&(a=y.parseInt(i.get(In.AZTEC_LAYERS).toString()))),or.encodeLayers(e,t,n,r,o,s,a)}static encodeLayers(e,t,n,r,i,o,s){if(t!==U.AZTEC)throw new d("Can only encode AZTEC, but got "+t);let a=ir.encode(b.getBytes(e,i),o,s);return or.renderResult(a,n,r)}static renderResult(e,t,n){let r=e.getMatrix();if(null==r)throw new te;let i=r.getWidth(),o=r.getHeight(),s=Math.max(t,i),a=Math.max(n,o),l=Math.min(s/i,a/o),c=(s-i*l)/2,d=(a-o*l)/2,u=new N(s,a);for(let e=0,t=d;e<o;e++,t+=l)for(let n=0,o=c;n<i;n++,o+=l)r.get(n,e)&&u.setRegion(o,t,l,l);return u}}e.AbstractExpandedDecoder=He,e.ArgumentException=c,e.ArithmeticException=Q,e.AztecCode=Bn,e.AztecCodeReader=ge,e.AztecCodeWriter=or,e.AztecDecoder=re,e.AztecDetector=pe,e.AztecDetectorResult=le,e.AztecEncoder=ir,e.AztecHighLevelEncoder=rr,e.AztecPoint=me,e.BarcodeFormat=U,e.Binarizer=h,e.BinaryBitmap=u,e.BitArray=v,e.BitMatrix=N,e.BitSource=mt,e.BrowserAztecCodeReader=we,e.BrowserBarcodeReader=lt,e.BrowserCodeReader=L,e.BrowserDatamatrixCodeReader=vt,e.BrowserMultiFormatReader=wn,e.BrowserPDF417Reader=yn,e.BrowserQRCodeReader=vn,e.BrowserQRCodeSvgWriter=Rn,e.CharacterSetECI=C,e.ChecksumException=f,e.Code128Reader=ve,e.Code39Reader=$e,e.DataMatrixDecodedBitStreamParser=pt,e.DataMatrixReader=yt,e.DecodeHintType=I,e.DecoderResult=Y,e.DefaultGridSampler=fe,e.DetectorResult=ae,e.EAN13Reader=Se,e.EncodeHintType=In,e.Exception=l,e.FormatException=_,e.GenericGF=J,e.GenericGFPoly=K,e.GlobalHistogramBinarizer=R,e.GridSampler=de,e.GridSamplerInstance=he,e.HTMLCanvasElementLuminanceSource=O,e.HybridBinarizer=D,e.ITFReader=Ie,e.IllegalArgumentException=d,e.IllegalStateException=te,e.InvertedLuminanceSource=k,e.LuminanceSource=x,e.MathUtils=ie,e.MultiFormatOneDReader=at,e.MultiFormatReader=gn,e.MultiFormatWriter=xn,e.NotFoundException=T,e.OneDReader=ye,e.PDF417DecodedBitStreamParser=fn,e.PDF417DecoderErrorCorrection=jt,e.PDF417Reader=mn,e.PDF417ResultMetadata=tn,e.PerspectiveTransform=ue,e.PlanarYUVLuminanceSource=kn,e.QRCodeByteMatrix=En,e.QRCodeDataMask=At,e.QRCodeDecodedBitStreamParser=Tt,e.QRCodeDecoderErrorCorrectionLevel=$t,e.QRCodeDecoderFormatInformation=It,e.QRCodeEncoder=Tn,e.QRCodeEncoderQRCode=An,e.QRCodeMaskUtil=Cn,e.QRCodeMatrixUtil=Sn,e.QRCodeMode=Nt,e.QRCodeReader=Lt,e.QRCodeVersion=Et,e.QRCodeWriter=Dn,e.RGBLuminanceSource=On,e.RSS14Reader=st,e.RSSExpandedReader=it,e.ReaderException=pn,e.ReedSolomonDecoder=ne,e.ReedSolomonEncoder=_n,e.ReedSolomonException=ee,e.Result=F,e.ResultMetadataType=X,e.ResultPoint=se,e.StringUtils=b,e.UnsupportedOperationException=E,e.VideoInputDevice=M,e.WhiteRectangleDetector=ce,e.WriterException=bn,e.ZXingArrays=w,e.ZXingCharset=Mn,e.ZXingInteger=y,e.ZXingStandardCharsets=Pn,e.ZXingStringBuilder=S,e.ZXingStringEncoding=A,e.ZXingSystem=m,e.createAbstractExpandedDecoder=tt,Object.defineProperty(e,"__esModule",{value:!0})}(t)}),hf=h({__proto__:null,default:lf(ff)},[ff]),mf=function(){function e(e,t,n){if(this.formatMap=new Map([[qu.QR_CODE,ff.BarcodeFormat.QR_CODE],[qu.AZTEC,ff.BarcodeFormat.AZTEC],[qu.CODABAR,ff.BarcodeFormat.CODABAR],[qu.CODE_39,ff.BarcodeFormat.CODE_39],[qu.CODE_93,ff.BarcodeFormat.CODE_93],[qu.CODE_128,ff.BarcodeFormat.CODE_128],[qu.DATA_MATRIX,ff.BarcodeFormat.DATA_MATRIX],[qu.MAXICODE,ff.BarcodeFormat.MAXICODE],[qu.ITF,ff.BarcodeFormat.ITF],[qu.EAN_13,ff.BarcodeFormat.EAN_13],[qu.EAN_8,ff.BarcodeFormat.EAN_8],[qu.PDF_417,ff.BarcodeFormat.PDF_417],[qu.RSS_14,ff.BarcodeFormat.RSS_14],[qu.RSS_EXPANDED,ff.BarcodeFormat.RSS_EXPANDED],[qu.UPC_A,ff.BarcodeFormat.UPC_A],[qu.UPC_E,ff.BarcodeFormat.UPC_E],[qu.UPC_EAN_EXTENSION,ff.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!hf)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=t,this.logger=n;var r=this.createZXingFormats(e),i=new Map;i.set(ff.DecodeHintType.POSSIBLE_FORMATS,r),i.set(ff.DecodeHintType.TRY_HARDER,!1),this.hints=i}return e.prototype.decodeAsync=function(e){var t=this;return new Promise(function(n,r){try{n(t.decode(e))}catch(e){r(e)}})},e.prototype.decode=function(e){var t=new ff.MultiFormatReader(this.verbose,this.hints),n=new ff.HTMLCanvasElementLuminanceSource(e),r=new ff.BinaryBitmap(new ff.HybridBinarizer(n)),i=t.decode(r);return{text:i.text,format:Ju.create(this.toHtml5QrcodeSupportedFormats(i.format)),debugData:this.createDebugData()}},e.prototype.createReverseFormatMap=function(){var e=new Map;return this.formatMap.forEach(function(t,n,r){e.set(t,n)}),e},e.prototype.toHtml5QrcodeSupportedFormats=function(e){if(!this.reverseFormatMap.has(e))throw"reverseFormatMap doesn't have ".concat(e);return this.reverseFormatMap.get(e)},e.prototype.createZXingFormats=function(e){for(var t=[],n=0,r=e;n<r.length;n++){var i=r[n];this.formatMap.has(i)?t.push(this.formatMap.get(i)):this.logger.logError("".concat(i," is not supported by")+"ZXingHtml5QrcodeShim")}return t},e.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},e}(),pf=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((r=r.apply(e,t||[])).next())})},gf=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}},wf=function(){function e(t,n,r){if(this.formatMap=new Map([[qu.QR_CODE,"qr_code"],[qu.AZTEC,"aztec"],[qu.CODABAR,"codabar"],[qu.CODE_39,"code_39"],[qu.CODE_93,"code_93"],[qu.CODE_128,"code_128"],[qu.DATA_MATRIX,"data_matrix"],[qu.ITF,"itf"],[qu.EAN_13,"ean_13"],[qu.EAN_8,"ean_8"],[qu.PDF_417,"pdf417"],[qu.UPC_A,"upc_a"],[qu.UPC_E,"upc_e"]]),this.reverseFormatMap=this.createReverseFormatMap(),!e.isSupported())throw"Use html5qrcode.min.js without edit, Use BarcodeDetectorDelegate only if it isSupported();";this.verbose=n,this.logger=r;var i=this.createBarcodeDetectorFormats(t);if(this.detector=new BarcodeDetector(i),!this.detector)throw"BarcodeDetector detector not supported"}return e.isSupported=function(){return"BarcodeDetector"in window&&void 0!==new BarcodeDetector({formats:["qr_code"]})},e.prototype.decodeAsync=function(e){return pf(this,void 0,void 0,function(){var t,n;return gf(this,function(r){switch(r.label){case 0:return[4,this.detector.detect(e)];case 1:if(!(t=r.sent())||0===t.length)throw"No barcode or QR code detected.";return[2,{text:(n=this.selectLargestBarcode(t)).rawValue,format:Ju.create(this.toHtml5QrcodeSupportedFormats(n.format)),debugData:this.createDebugData()}]}})})},e.prototype.selectLargestBarcode=function(e){for(var t=null,n=0,r=0,i=e;r<i.length;r++){var o=i[r],s=o.boundingBox.width*o.boundingBox.height;s>n&&(n=s,t=o)}if(!t)throw"No largest barcode found";return t},e.prototype.createBarcodeDetectorFormats=function(e){for(var t=[],n=0,r=e;n<r.length;n++){var i=r[n];this.formatMap.has(i)?t.push(this.formatMap.get(i)):this.logger.warn("".concat(i," is not supported by")+"BarcodeDetectorDelegate")}return{formats:t}},e.prototype.toHtml5QrcodeSupportedFormats=function(e){if(!this.reverseFormatMap.has(e))throw"reverseFormatMap doesn't have ".concat(e);return this.reverseFormatMap.get(e)},e.prototype.createReverseFormatMap=function(){var e=new Map;return this.formatMap.forEach(function(t,n,r){e.set(t,n)}),e},e.prototype.createDebugData=function(){return{decoderName:"BarcodeDetector"}},e}(),yf=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((r=r.apply(e,t||[])).next())})},vf=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}},$f=function(){function e(e,t,n,r){this.EXECUTIONS_TO_REPORT_PERFORMANCE=100,this.executions=0,this.executionResults=[],this.wasPrimaryDecoderUsedInLastDecode=!1,this.verbose=n,t&&wf.isSupported()?(this.primaryDecoder=new wf(e,n,r),this.secondaryDecoder=new mf(e,n,r)):this.primaryDecoder=new mf(e,n,r)}return e.prototype.decodeAsync=function(e){return yf(this,void 0,void 0,function(){var t;return vf(this,function(n){switch(n.label){case 0:t=performance.now(),n.label=1;case 1:return n.trys.push([1,,3,4]),[4,this.getDecoder().decodeAsync(e)];case 2:return[2,n.sent()];case 3:return this.possiblyLogPerformance(t),[7];case 4:return[2]}})})},e.prototype.decodeRobustlyAsync=function(e){return yf(this,void 0,void 0,function(){var t,n;return vf(this,function(r){switch(r.label){case 0:t=performance.now(),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,this.primaryDecoder.decodeAsync(e)];case 2:return[2,r.sent()];case 3:if(n=r.sent(),this.secondaryDecoder)return[2,this.secondaryDecoder.decodeAsync(e)];throw n;case 4:return this.possiblyLogPerformance(t),[7];case 5:return[2]}})})},e.prototype.getDecoder=function(){return this.secondaryDecoder?!1===this.wasPrimaryDecoderUsedInLastDecode?(this.wasPrimaryDecoderUsedInLastDecode=!0,this.primaryDecoder):(this.wasPrimaryDecoderUsedInLastDecode=!1,this.secondaryDecoder):this.primaryDecoder},e.prototype.possiblyLogPerformance=function(e){if(this.verbose){var t=performance.now()-e;this.executionResults.push(t),this.executions++,this.possiblyFlushPerformanceReport()}},e.prototype.possiblyFlushPerformanceReport=function(){if(!(this.executions<this.EXECUTIONS_TO_REPORT_PERFORMANCE)){for(var e=0,t=0,n=this.executionResults;t<n.length;t++){e+=n[t]}var r=e/this.executionResults.length;console.log("".concat(r," ms for ").concat(this.executionResults.length," last runs.")),this.executions=0,this.executionResults=[]}},e}(),If=(df=function(e,t){return df=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},df(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}df(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),_f=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((r=r.apply(e,t||[])).next())})},Cf=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}},Ef=function(){function e(e,t){this.name=e,this.track=t}return e.prototype.isSupported=function(){return!!this.track.getCapabilities&&this.name in this.track.getCapabilities()},e.prototype.apply=function(e){var t={};t[this.name]=e;var n={advanced:[t]};return this.track.applyConstraints(n)},e.prototype.value=function(){var e=this.track.getSettings();return this.name in e?e[this.name]:null},e}(),Af=function(e){function t(t){return e.call(this,"zoom",t)||this}return If(t,e),t}(function(e){function t(t,n){return e.call(this,t,n)||this}return If(t,e),t.prototype.min=function(){return this.getCapabilities().min},t.prototype.max=function(){return this.getCapabilities().max},t.prototype.step=function(){return this.getCapabilities().step},t.prototype.apply=function(e){var t={};t[this.name]=e;var n={advanced:[t]};return this.track.applyConstraints(n)},t.prototype.getCapabilities=function(){this.failIfNotSupported();var e=this.track.getCapabilities()[this.name];return{min:e.min,max:e.max,step:e.step}},t.prototype.failIfNotSupported=function(){if(!this.isSupported())throw new Error("".concat(this.name," capability not supported"))},t}(Ef)),bf=function(e){function t(t){return e.call(this,"torch",t)||this}return If(t,e),t}(Ef),Sf=function(){function e(e){this.track=e}return e.prototype.zoomFeature=function(){return new Af(this.track)},e.prototype.torchFeature=function(){return new bf(this.track)},e}(),Nf=function(){function e(e,t,n){this.isClosed=!1,this.parentElement=e,this.mediaStream=t,this.callbacks=n,this.surface=this.createVideoElement(this.parentElement.clientWidth),e.append(this.surface)}return e.prototype.createVideoElement=function(e){var t=document.createElement("video");return t.style.width="".concat(e,"px"),t.style.display="block",t.muted=!0,t.setAttribute("muted","true"),t.playsInline=!0,t},e.prototype.setupSurface=function(){var e=this;this.surface.onabort=function(){throw"RenderedCameraImpl video surface onabort() called"},this.surface.onerror=function(){throw"RenderedCameraImpl video surface onerror() called"};var t=function(){var n=e.surface.clientWidth,r=e.surface.clientHeight;e.callbacks.onRenderSurfaceReady(n,r),e.surface.removeEventListener("playing",t)};this.surface.addEventListener("playing",t),this.surface.srcObject=this.mediaStream,this.surface.play()},e.create=function(t,n,r,i){return _f(this,void 0,void 0,function(){var o,s;return Cf(this,function(a){switch(a.label){case 0:return o=new e(t,n,i),r.aspectRatio?(s={aspectRatio:r.aspectRatio},[4,o.getFirstTrackOrFail().applyConstraints(s)]):[3,2];case 1:a.sent(),a.label=2;case 2:return o.setupSurface(),[2,o]}})})},e.prototype.failIfClosed=function(){if(this.isClosed)throw"The RenderedCamera has already been closed."},e.prototype.getFirstTrackOrFail=function(){if(this.failIfClosed(),0===this.mediaStream.getVideoTracks().length)throw"No video tracks found";return this.mediaStream.getVideoTracks()[0]},e.prototype.pause=function(){this.failIfClosed(),this.surface.pause()},e.prototype.resume=function(e){this.failIfClosed();var t=this,n=function(){setTimeout(e,200),t.surface.removeEventListener("playing",n)};this.surface.addEventListener("playing",n),this.surface.play()},e.prototype.isPaused=function(){return this.failIfClosed(),this.surface.paused},e.prototype.getSurface=function(){return this.failIfClosed(),this.surface},e.prototype.getRunningTrackCapabilities=function(){return this.getFirstTrackOrFail().getCapabilities()},e.prototype.getRunningTrackSettings=function(){return this.getFirstTrackOrFail().getSettings()},e.prototype.applyVideoConstraints=function(e){return _f(this,void 0,void 0,function(){return Cf(this,function(t){if("aspectRatio"in e)throw"Changing 'aspectRatio' in run-time is not yet supported.";return[2,this.getFirstTrackOrFail().applyConstraints(e)]})})},e.prototype.close=function(){if(this.isClosed)return Promise.resolve();var e=this;return new Promise(function(t,n){var r=e.mediaStream.getVideoTracks().length,i=0;e.mediaStream.getVideoTracks().forEach(function(n){e.mediaStream.removeTrack(n),n.stop(),++i>=r&&(e.isClosed=!0,e.parentElement.removeChild(e.surface),t())})})},e.prototype.getCapabilities=function(){return new Sf(this.getFirstTrackOrFail())},e}(),Tf=function(){function e(e){this.mediaStream=e}return e.prototype.render=function(e,t,n){return _f(this,void 0,void 0,function(){return Cf(this,function(r){return[2,Nf.create(e,this.mediaStream,t,n)]})})},e.create=function(t){return _f(this,void 0,void 0,function(){var n;return Cf(this,function(r){switch(r.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return n={audio:!1,video:t},[4,navigator.mediaDevices.getUserMedia(n)];case 1:return[2,new e(r.sent())]}})})},e}(),Rf=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((r=r.apply(e,t||[])).next())})},Df=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}},xf=function(){function e(){}return e.failIfNotSupported=function(){return Rf(this,void 0,void 0,function(){return Df(this,function(t){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new e]})})},e.prototype.create=function(e){return Rf(this,void 0,void 0,function(){return Df(this,function(t){return[2,Tf.create(e)]})})},e}(),kf=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((r=r.apply(e,t||[])).next())})},Of=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}},Mf=function(){function e(){}return e.retrieve=function(){if(navigator.mediaDevices)return e.getCamerasFromMediaDevices();var t=MediaStreamTrack;return MediaStreamTrack&&t.getSources?e.getCamerasFromMediaStreamTrack():e.rejectWithError()},e.rejectWithError=function(){var t=of.unableToQuerySupportedDevices();return e.isHttpsOrLocalhost()||(t=of.insecureContextCameraQueryError()),Promise.reject(t)},e.isHttpsOrLocalhost=function(){if("https:"===location.protocol)return!0;var e=location.host.split(":")[0];return"127.0.0.1"===e||"localhost"===e},e.getCamerasFromMediaDevices=function(){return kf(this,void 0,void 0,function(){var e,t,n,r,i,o,s;return Of(this,function(a){switch(a.label){case 0:return e=function(e){for(var t=0,n=e.getVideoTracks();t<n.length;t++){var r=n[t];r.enabled=!1,r.stop(),e.removeTrack(r)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return t=a.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(n=a.sent(),r=[],i=0,o=n;i<o.length;i++)"videoinput"===(s=o[i]).kind&&r.push({id:s.deviceId,label:s.label});return e(t),[2,r]}})})},e.getCamerasFromMediaStreamTrack=function(){return new Promise(function(e,t){MediaStreamTrack.getSources(function(t){for(var n=[],r=0,i=t;r<i.length;r++){var o=i[r];"video"===o.kind&&n.push({id:o.id,label:o.label})}e(n)})})},e}();!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.NOT_STARTED=1]="NOT_STARTED",e[e.SCANNING=2]="SCANNING",e[e.PAUSED=3]="PAUSED"}(uf||(uf={}));var Pf,Bf=function(){function e(){this.state=uf.NOT_STARTED,this.onGoingTransactionNewState=uf.UNKNOWN}return e.prototype.directTransition=function(e){this.failIfTransitionOngoing(),this.validateTransition(e),this.state=e},e.prototype.startTransition=function(e){return this.failIfTransitionOngoing(),this.validateTransition(e),this.onGoingTransactionNewState=e,this},e.prototype.execute=function(){if(this.onGoingTransactionNewState===uf.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var e=this.onGoingTransactionNewState;this.onGoingTransactionNewState=uf.UNKNOWN,this.directTransition(e)},e.prototype.cancel=function(){if(this.onGoingTransactionNewState===uf.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=uf.UNKNOWN},e.prototype.getState=function(){return this.state},e.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==uf.UNKNOWN)throw"Cannot transition to a new state, already under transition"},e.prototype.validateTransition=function(e){switch(this.state){case uf.UNKNOWN:throw"Transition from unknown is not allowed";case uf.NOT_STARTED:this.failIfNewStateIs(e,[uf.PAUSED]);case uf.SCANNING:case uf.PAUSED:}},e.prototype.failIfNewStateIs=function(e,t){for(var n=0,r=t;n<r.length;n++){if(e===r[n])throw"Cannot transition from ".concat(this.state," to ").concat(e)}},e}(),Lf=function(){function e(e){this.stateManager=e}return e.prototype.startTransition=function(e){return this.stateManager.startTransition(e)},e.prototype.directTransition=function(e){this.stateManager.directTransition(e)},e.prototype.getState=function(){return this.stateManager.getState()},e.prototype.canScanFile=function(){return this.stateManager.getState()===uf.NOT_STARTED},e.prototype.isScanning=function(){return this.stateManager.getState()!==uf.NOT_STARTED},e.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===uf.SCANNING},e.prototype.isPaused=function(){return this.stateManager.getState()===uf.PAUSED},e}(),Ff=function(){function e(){}return e.create=function(){return new Lf(new Bf)},e}(),Vf=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Uf=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Vf(t,e),t.DEFAULT_WIDTH=300,t.DEFAULT_WIDTH_OFFSET=2,t.FILE_SCAN_MIN_HEIGHT=300,t.FILE_SCAN_HIDDEN_CANVAS_PADDING=100,t.MIN_QR_BOX_SIZE=50,t.SHADED_LEFT=1,t.SHADED_RIGHT=2,t.SHADED_TOP=3,t.SHADED_BOTTOM=4,t.SHADED_REGION_ELEMENT_ID="qr-shaded-region",t.VERBOSE=!1,t.BORDER_SHADER_DEFAULT_COLOR="#ffffff",t.BORDER_SHADER_MATCH_COLOR="rgb(90, 193, 56)",t}(Qu),Wf=function(){function e(e,t){this.logger=t,this.fps=Uf.SCAN_DEFAULT_FPS,e?(e.fps&&(this.fps=e.fps),this.disableFlip=!0===e.disableFlip,this.qrbox=e.qrbox,this.aspectRatio=e.aspectRatio,this.videoConstraints=e.videoConstraints):this.disableFlip=Uf.DEFAULT_DISABLE_FLIP}return e.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?sf.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},e.prototype.isShadedBoxEnabled=function(){return!rf(this.qrbox)},e.create=function(t,n){return new e(t,n)},e}(),zf=function(){function e(e,t){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(e))throw"HTML Element with id=".concat(e," not found");var n;this.elementId=e,this.verbose=!1,"boolean"==typeof t?this.verbose=!0===t:t&&(n=t,this.verbose=!0===n.verbose,n.experimentalFeatures),this.logger=new nf(this.verbose),this.qrcode=new $f(this.getSupportedFormats(t),this.getUseBarCodeDetectorIfSupported(n),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=Ff.create()}return e.prototype.start=function(e,t,n,r){var i,o=this;if(!e)throw"cameraIdOrConfig is required";if(!n||"function"!=typeof n)throw"qrCodeSuccessCallback is required and should be a function.";i=r||(this.verbose?this.logger.log:function(){});var s=Wf.create(t,this.logger);this.clearElement();var a=!1;s.videoConstraints&&(s.isMediaStreamConstraintsValid()?a=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var l=a,c=document.getElementById(this.elementId);c.clientWidth?c.clientWidth:Uf.DEFAULT_WIDTH,c.style.position="relative",this.shouldScan=!0,this.element=c;var d=this,u=this.stateManagerProxy.startTransition(uf.SCANNING);return new Promise(function(t,r){var a=l?s.videoConstraints:d.createVideoConstraints(e);if(!a)return u.cancel(),void r("videoConstraints should be defined");var c={};l&&!s.aspectRatio||(c.aspectRatio=s.aspectRatio);var f={onRenderSurfaceReady:function(e,t){d.setupUi(e,t,s),d.isScanning=!0,d.foreverScan(s,n,i)}};xf.failIfNotSupported().then(function(e){e.create(a).then(function(e){return e.render(o.element,c,f).then(function(e){d.renderedCamera=e,u.execute(),t(null)}).catch(function(e){u.cancel(),r(e)})}).catch(function(e){u.cancel(),r(of.errorGettingUserMedia(e))})}).catch(function(e){u.cancel(),r(of.cameraStreamingNotSupported())})})},e.prototype.pause=function(e){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(uf.PAUSED),this.showPausedState(),(rf(e)||!0!==e)&&(e=!1),e&&this.renderedCamera&&this.renderedCamera.pause()},e.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 e=this,t=function(){e.stateManagerProxy.directTransition(uf.SCANNING),e.hidePausedState()};this.renderedCamera.isPaused()?this.renderedCamera.resume(function(){t()}):t()},e.prototype.getState=function(){return this.stateManagerProxy.getState()},e.prototype.stop=function(){var e=this;if(!this.stateManagerProxy.isScanning())throw"Cannot stop, scanner is not running or paused.";var t=this.stateManagerProxy.startTransition(uf.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var n=this;return this.renderedCamera.close().then(function(){return n.renderedCamera=null,n.element&&(n.element.removeChild(n.canvasElement),n.canvasElement=null),function(){if(e.element){var t=document.getElementById(Uf.SHADED_REGION_ELEMENT_ID);t&&e.element.removeChild(t)}}(),n.qrRegion&&(n.qrRegion=null),n.context&&(n.context=null),t.execute(),n.hidePausedState(),n.isScanning=!1,Promise.resolve()})},e.prototype.scanFile=function(e,t){return this.scanFileV2(e,t).then(function(e){return e.decodedText})},e.prototype.scanFileV2=function(e,t){var n=this;if(!(e&&e instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(rf(t)&&(t=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(r,i){n.possiblyCloseLastScanImageFile(),n.clearElement(),n.lastScanImageFile=URL.createObjectURL(e);var o=new Image;o.onload=function(){var e=o.width,s=o.height,a=document.getElementById(n.elementId),l=a.clientWidth?a.clientWidth:Uf.DEFAULT_WIDTH,c=Math.max(a.clientHeight?a.clientHeight:s,Uf.FILE_SCAN_MIN_HEIGHT),d=n.computeCanvasDrawConfig(e,s,l,c);if(t){var u=n.createCanvasElement(l,c,"qr-canvas-visible");u.style.display="inline-block",a.appendChild(u);var f=u.getContext("2d");if(!f)throw"Unable to get 2d context from canvas";f.canvas.width=l,f.canvas.height=c,f.drawImage(o,0,0,e,s,d.x,d.y,d.width,d.height)}var h=Uf.FILE_SCAN_HIDDEN_CANVAS_PADDING,m=Math.max(o.width,d.width),p=Math.max(o.height,d.height),g=m+2*h,w=p+2*h,y=n.createCanvasElement(g,w);a.appendChild(y);var v=y.getContext("2d");if(!v)throw"Unable to get 2d context from canvas";v.canvas.width=g,v.canvas.height=w,v.drawImage(o,0,0,e,s,h,h,m,p);try{n.qrcode.decodeRobustlyAsync(y).then(function(e){r(ef.createFromQrcodeResult(e))}).catch(i)}catch(e){i("QR code parse error, error = ".concat(e))}},o.onerror=i,o.onabort=i,o.onstalled=i,o.onsuspend=i,o.src=URL.createObjectURL(e)})},e.prototype.clear=function(){this.clearElement()},e.getCameras=function(){return Mf.retrieve()},e.prototype.getRunningTrackCapabilities=function(){return this.getRenderedCameraOrFail().getRunningTrackCapabilities()},e.prototype.getRunningTrackSettings=function(){return this.getRenderedCameraOrFail().getRunningTrackSettings()},e.prototype.getRunningTrackCameraCapabilities=function(){return this.getRenderedCameraOrFail().getCapabilities()},e.prototype.applyVideoConstraints=function(e){if(!e)throw"videoConstaints is required argument.";if(!sf.isMediaStreamConstraintsValid(e,this.logger))throw"invalid videoConstaints passed, check logs for more details";return this.getRenderedCameraOrFail().applyVideoConstraints(e)},e.prototype.getRenderedCameraOrFail=function(){if(null==this.renderedCamera)throw"Scanning is not in running state, call this API only when QR code scanning using camera is in running state.";return this.renderedCamera},e.prototype.getSupportedFormats=function(e){var t=[qu.QR_CODE,qu.AZTEC,qu.CODABAR,qu.CODE_39,qu.CODE_93,qu.CODE_128,qu.DATA_MATRIX,qu.MAXICODE,qu.ITF,qu.EAN_13,qu.EAN_8,qu.PDF_417,qu.RSS_14,qu.RSS_EXPANDED,qu.UPC_A,qu.UPC_E,qu.UPC_EAN_EXTENSION];if(!e||"boolean"==typeof e)return t;if(!e.formatsToSupport)return t;if(!Array.isArray(e.formatsToSupport))throw"configOrVerbosityFlag.formatsToSupport should be undefined or an array.";if(0===e.formatsToSupport.length)throw"Atleast 1 formatsToSupport is needed.";for(var n=[],r=0,i=e.formatsToSupport;r<i.length;r++){var o=i[r];Zu(o)?n.push(o):this.logger.warn("Invalid format: ".concat(o," passed in config, ignoring."))}if(0===n.length)throw"None of formatsToSupport match supported values.";return n},e.prototype.getUseBarCodeDetectorIfSupported=function(e){if(rf(e))return!0;if(!rf(e.useBarCodeDetectorIfSupported))return!1!==e.useBarCodeDetectorIfSupported;if(rf(e.experimentalFeatures))return!0;var t=e.experimentalFeatures;return!!rf(t.useBarCodeDetectorIfSupported)||!1!==t.useBarCodeDetectorIfSupported},e.prototype.validateQrboxSize=function(e,t,n){var r=this,i=n.qrbox;this.validateQrboxConfig(i);var o,s=this.toQrdimensions(e,t,i),a=function(e){if(e<Uf.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(Uf.MIN_QR_BOX_SIZE,"px.")};a(s.width),a(s.height),s.width=((o=s.width)>e&&(r.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."),o=e),o)},e.prototype.validateQrboxConfig=function(e){if("number"!=typeof e&&"function"!=typeof e&&(void 0===e.width||void 0===e.height))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},e.prototype.toQrdimensions=function(e,t,n){if("number"==typeof n)return{width:n,height:n};if("function"==typeof n)try{return n(e,t)}catch(e){throw new Error("qrbox config was passed as a function but it failed with unknown error"+e)}return n},e.prototype.setupUi=function(e,t,n){n.isShadedBoxEnabled()&&this.validateQrboxSize(e,t,n);var r=rf(n.qrbox)?{width:e,height:t}:n.qrbox;this.validateQrboxConfig(r);var i=this.toQrdimensions(e,t,r);i.height>t&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var o=n.isShadedBoxEnabled()&&i.height<=t,s={x:0,y:0,width:e,height:t},a=o?this.getShadedRegionBounds(e,t,i):s,l=this.createCanvasElement(a.width,a.height),c=l.getContext("2d",{willReadFrequently:!0});c.canvas.width=a.width,c.canvas.height=a.height,this.element.append(l),o&&this.possiblyInsertShadingElement(this.element,e,t,i),this.createScannerPausedUiElement(this.element),this.qrRegion=a,this.context=c,this.canvasElement=l},e.prototype.createScannerPausedUiElement=function(e){var t=document.createElement("div");t.innerText=of.scannerPaused(),t.style.display="none",t.style.position="absolute",t.style.top="0px",t.style.zIndex="1",t.style.background="rgba(9, 9, 9, 0.46)",t.style.color="#FFECEC",t.style.textAlign="center",t.style.width="100%",e.appendChild(t),this.scannerPausedUiElement=t},e.prototype.scanContext=function(e,t){var n=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(t){return e(t.text,ef.createFromQrcodeResult(t)),n.possiblyUpdateShaders(!0),!0}).catch(function(e){n.possiblyUpdateShaders(!1);var r=of.codeParseError(e);return t(r,tf.createFrom(r)),!1})},e.prototype.foreverScan=function(e,t,n){var r=this;if(this.shouldScan&&this.renderedCamera){var i=this.renderedCamera.getSurface(),o=i.videoWidth/i.clientWidth,s=i.videoHeight/i.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var a=this.qrRegion.width*o,l=this.qrRegion.height*s,c=this.qrRegion.x*o,d=this.qrRegion.y*s;this.context.drawImage(i,c,d,a,l,0,0,this.qrRegion.width,this.qrRegion.height);var u=function(){r.foreverScanTimeout=setTimeout(function(){r.foreverScan(e,t,n)},r.getTimeoutFps(e.fps))};this.scanContext(t,n).then(function(i){i||!0===e.disableFlip?u():(r.context.translate(r.context.canvas.width,0),r.context.scale(-1,1),r.scanContext(t,n).finally(function(){u()}))}).catch(function(e){r.logger.logError("Error happend while scanning context",e),u()})}},e.prototype.createVideoConstraints=function(e){if("string"==typeof e)return{deviceId:{exact:e}};if("object"==typeof e){var t="facingMode",n="deviceId",r={user:!0,environment:!0},i="exact",o=function(e){if(e in r)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(e,"'")},s=Object.keys(e);if(1!==s.length)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(s.length," keys");var a=Object.keys(e)[0];if(a!==t&&a!==n)throw"Only '".concat(t,"' and '").concat(n,"' ")+" are supported for 'cameraIdOrConfig'";if(a!==t){var l=e.deviceId;if("string"==typeof l)return{deviceId:l};if("object"==typeof l){if(i in l)return{deviceId:{exact:l["".concat(i)]}};throw"'deviceId' should be string or object with"+" ".concat(i," as key.")}throw"Invalid type of 'deviceId' = ".concat(typeof l)}var c=e.facingMode;if("string"==typeof c){if(o(c))return{facingMode:c}}else{if("object"!=typeof c)throw"Invalid type of 'facingMode' = ".concat(typeof c);if(!(i in c))throw"'facingMode' should be string or object with"+" ".concat(i," as key.");if(o(c["".concat(i)]))return{facingMode:{exact:c["".concat(i)]}}}}throw"Invalid type of 'cameraIdOrConfig' = ".concat(typeof e)},e.prototype.computeCanvasDrawConfig=function(e,t,n,r){if(e<=n&&t<=r)return{x:(n-e)/2,y:(r-t)/2,width:e,height:t};var i=e,o=t;return e>n&&(t*=n/e,e=n),t>r&&(e*=r/t,t=r),this.logger.log("Image downsampled from "+"".concat(i,"X").concat(o)+" to ".concat(e,"X").concat(t,".")),this.computeCanvasDrawConfig(e,t,n,r)},e.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var e=document.getElementById(this.elementId);e&&(e.innerHTML="")},e.prototype.possiblyUpdateShaders=function(e){this.qrMatch!==e&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(t){t.style.backgroundColor=e?Uf.BORDER_SHADER_MATCH_COLOR:Uf.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=e)},e.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},e.prototype.createCanvasElement=function(e,t,n){var r=e,i=t,o=document.createElement("canvas");return o.style.width="".concat(r,"px"),o.style.height="".concat(i,"px"),o.style.display="none",o.id=rf(n)?"qr-canvas":n,o},e.prototype.getShadedRegionBounds=function(e,t,n){if(n.width>e||n.height>t)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(e-n.width)/2,y:(t-n.height)/2,width:n.width,height:n.height}},e.prototype.possiblyInsertShadingElement=function(e,t,n,r){if(!(t-r.width<1||n-r.height<1)){var i=document.createElement("div");i.style.position="absolute";var o=(t-r.width)/2,s=(n-r.height)/2;if(i.style.borderLeft="".concat(o,"px solid rgba(0, 0, 0, 0.48)"),i.style.borderRight="".concat(o,"px solid rgba(0, 0, 0, 0.48)"),i.style.borderTop="".concat(s,"px solid rgba(0, 0, 0, 0.48)"),i.style.borderBottom="".concat(s,"px solid rgba(0, 0, 0, 0.48)"),i.style.boxSizing="border-box",i.style.top="0px",i.style.bottom="0px",i.style.left="0px",i.style.right="0px",i.id="".concat(Uf.SHADED_REGION_ELEMENT_ID),t-r.width<11||n-r.height<11)this.hasBorderShaders=!1;else{var a=40;this.insertShaderBorders(i,a,5,-5,null,0,!0),this.insertShaderBorders(i,a,5,-5,null,0,!1),this.insertShaderBorders(i,a,5,null,-5,0,!0),this.insertShaderBorders(i,a,5,null,-5,0,!1),this.insertShaderBorders(i,5,45,-5,null,-5,!0),this.insertShaderBorders(i,5,45,null,-5,-5,!0),this.insertShaderBorders(i,5,45,-5,null,-5,!1),this.insertShaderBorders(i,5,45,null,-5,-5,!1),this.hasBorderShaders=!0}e.append(i)}},e.prototype.insertShaderBorders=function(e,t,n,r,i,o,s){var a=document.createElement("div");a.style.position="absolute",a.style.backgroundColor=Uf.BORDER_SHADER_DEFAULT_COLOR,a.style.width="".concat(t,"px"),a.style.height="".concat(n,"px"),null!==r&&(a.style.top="".concat(r,"px")),null!==i&&(a.style.bottom="".concat(i,"px")),s?a.style.left="".concat(o,"px"):a.style.right="".concat(o,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(a),e.appendChild(a)},e.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},e.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},e.prototype.getTimeoutFps=function(e){return 1e3/e},e}();function Hf(e,t,n){const r=e.slice();return r[19]=t[n].id,r[20]=t[n].label,r}function jf(e){let t,n,r=e[1]&&qf(e);return{c(){r&&r.c(),t=L(),n=M("reader"),z(n,"id","reader"),z(n,"class","svelte-9062r9")},m(e,i){r&&r.m(e,i),x(e,t,i),x(e,n,i)},p(e,n){e[1]?r?r.p(e,n):(r=qf(e),r.c(),r.m(t.parentNode,t)):r&&(r.d(1),r=null)},d(e){r&&r.d(e),e&&k(t),e&&k(n)}}}function qf(e){let t,n,r,i,o,s,a=e[1],l=[];for(let t=0;t<a.length;t+=1)l[t]=Gf(Hf(e,a,t));return{c(){t=M("div"),n=B("Quelle:\n "),r=M("select");for(let e=0;e<l.length;e+=1)l[e].c();r.disabled=i=1===e[1].length},m(i,a){x(i,t,a),D(t,n),D(t,r);for(let e=0;e<l.length;e+=1)l[e].m(r,null);o||(s=V(r,"change",e[4]),o=!0)},p(e,t){if(6&t){let n;for(a=e[1],n=0;n<a.length;n+=1){const i=Hf(e,a,n);l[n]?l[n].p(i,t):(l[n]=Gf(i),l[n].c(),l[n].m(r,null))}for(;n<l.length;n+=1)l[n].d(1);l.length=a.length}2&t&&i!==(i=1===e[1].length)&&(r.disabled=i)},d(e){e&&k(t),O(l,e),o=!1,s()}}}function Gf(e){let t,n,r,i,o=e[20]+"";return{c(){t=M("option"),n=B(o),t.__value=r=e[19],t.value=t.__value,t.selected=i=e[2]===e[19]},m(e,r){x(e,t,r),D(t,n)},p(e,s){2&s&&o!==(o=e[20]+"")&&H(n,o),2&s&&r!==(r=e[19])&&(t.__value=r,t.value=t.__value),6&s&&i!==(i=e[2]===e[19])&&(t.selected=i)},d(e){e&&k(t)}}}function Xf(e){let t,n=!e[0]&&jf(e);return{c(){t=M("main"),n&&n.c(),z(t,"class","svelte-9062r9")},m(e,r){x(e,t,r),n&&n.m(t,null)},p(e,[r]){e[0]?n&&(n.d(1),n=null):n?n.p(e,r):(n=jf(e),n.c(),n.m(t,null))},i:_,o:_,d(e){e&&k(t),n&&n.d()}}}!function(e){e[e.STATUS_DEFAULT=0]="STATUS_DEFAULT",e[e.STATUS_SUCCESS=1]="STATUS_SUCCESS",e[e.STATUS_WARNING=2]="STATUS_WARNING",e[e.STATUS_REQUESTING_PERMISSION=3]="STATUS_REQUESTING_PERMISSION"}(Pf||(Pf={}));const Yf=()=>zf.getCameras();function Zf(e,t,n){let r;const i=ee(),{loggedIn:o}=u;N(e,o,e=>n(9,r=e));let s,a,l,{keyboard:c}=t,{codeTypes:d=""}=t,{readerInit:f=!1}=t,h=!1;const m=r.tenant+"-ENABLERR-CAMERA";Q(function(){if(c)return void(h=!0);try{s||(s=new zf("reader"));const e=window.localStorage.getItem(m);Yf().then(t=>{if(!t?.length)return;n(1,a=t);const r=t.find(t=>t.id===e);r&&window.localStorage.setItem(m,r.id),g(r?.id||a[0].id)})}catch{}}),J(function(){w(),i("exit")});var p=function(e,t){var n=250,r=e>t?t:e,i=Math.floor(.75*r);return i<n?r<n?{width:r,height:r}:{width:n,height:n}:{width:i,height:i}};function g(e){if(e&&n(2,l=e),l)try{s.start(l,{fps:5,qrbox:p,formatsToSupport:d||void 0,facingMode:"environment"},y),h=!0}catch{}}async function w(e=!1){try{c||(await s.stop(),e&&await s.clear())}catch{}finally{h=!1}}function y(e,t){h&&(i("scan",{text:e}),h=!1)}return e.$$set=e=>{"keyboard"in e&&n(0,c=e.keyboard),"codeTypes"in e&&n(6,d=e.codeTypes),"readerInit"in e&&n(5,f=e.readerInit)},e.$$.update=()=>{32&e.$$.dirty&&f&&(h=!0,n(5,f=!1))},[c,a,l,o,async e=>{const t=e.target.value;await w(),window.localStorage.setItem(m,t),g(t)},f,d]}class Kf extends xe{constructor(e){var t;super(),document.getElementById("svelte-9062r9-style")||((t=M("style")).id="svelte-9062r9-style",t.textContent="main.svelte-9062r9{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:20px;max-height:400px}reader.svelte-9062r9{width:400px;height:300px;background-color:gray}",D(document.head,t)),De(this,e,Zf,Xf,S,{keyboard:0,codeTypes:6,readerInit:5})}}const{document:Qf}=Ee;function Jf(e,t,n){const r=e.slice();return r[166]=t[n],r[168]=n,r}function eh(e,t,n){const r=e.slice();return r[170]=t[n],r[172]=n,r}function th(e,t,n){const r=e.slice();return r[179]=t[n],r}function nh(e,t,n){const r=e.slice();return r[174]=t[n].title,r[175]=t[n].toDelete,r[176]=t[n].icon,r}function rh(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function ih(e){let t,n,r,i,o,s,a,l,c,d,u=e[31],f=(!e[2]||e[15]?.length&&e[15].length>1)&&oh(e),h=e[21]&&sh(e),m=!1!==e[4].transfer&&e[52]?.length&&lh(e),p=!e[10]&&e[48]&&e[14]&&0!=e[14]&&dh(e),g=!e[10]&&e[46]&&e[17]&&0!=e[17]&&fh(e),w=e[44]&&e[13]&&0!=e[13]&&mh(e),y=Th(e),v=e[21]&&e[24]&&Rh(e);return{c(){f&&f.c(),t=L(),n=M("div"),h&&h.c(),r=L(),m&&m.c(),i=L(),p&&p.c(),o=L(),g&&g.c(),s=L(),w&&w.c(),a=L(),y.c(),l=L(),v&&v.c(),c=F(),z(n,"class","formList")},m(e,u){f&&f.m(e,u),x(e,t,u),x(e,n,u),h&&h.m(n,null),D(n,r),m&&m.m(n,null),D(n,i),p&&p.m(n,null),D(n,o),g&&g.m(n,null),D(n,s),w&&w.m(n,null),D(n,a),y.m(n,null),x(e,l,u),v&&v.m(e,u),x(e,c,u),d=!0},p(e,l){!e[2]||e[15]?.length&&e[15].length>1?f?(f.p(e,l),32772&l[0]&&$e(f,1)):(f=oh(e),f.c(),$e(f,1),f.m(t.parentNode,t)):f&&(ye(),Ie(f,1,1,()=>{f=null}),ve()),e[21]?h?(h.p(e,l),2097152&l[0]&&$e(h,1)):(h=sh(e),h.c(),$e(h,1),h.m(n,r)):h&&(ye(),Ie(h,1,1,()=>{h=null}),ve()),!1!==e[4].transfer&&e[52]?.length?m?(m.p(e,l),16&l[0]&&$e(m,1)):(m=lh(e),m.c(),$e(m,1),m.m(n,i)):m&&(ye(),Ie(m,1,1,()=>{m=null}),ve()),!e[10]&&e[48]&&e[14]&&0!=e[14]?p?(p.p(e,l),17408&l[0]&&$e(p,1)):(p=dh(e),p.c(),$e(p,1),p.m(n,o)):p&&(ye(),Ie(p,1,1,()=>{p=null}),ve()),!e[10]&&e[46]&&e[17]&&0!=e[17]?g?(g.p(e,l),132096&l[0]&&$e(g,1)):(g=fh(e),g.c(),$e(g,1),g.m(n,s)):g&&(ye(),Ie(g,1,1,()=>{g=null}),ve()),e[44]&&e[13]&&0!=e[13]?w?(w.p(e,l),8192&l[0]&&$e(w,1)):(w=mh(e),w.c(),$e(w,1),w.m(n,a)):w&&(ye(),Ie(w,1,1,()=>{w=null}),ve()),1&l[1]&&S(u,u=e[31])?(ye(),Ie(y,1,1,_),ve(),y=Th(e),y.c(),$e(y),y.m(n,null)):y.p(e,l),e[21]&&e[24]?v?(v.p(e,l),18874368&l[0]&&$e(v,1)):(v=Rh(e),v.c(),$e(v,1),v.m(c.parentNode,c)):v&&(ye(),Ie(v,1,1,()=>{v=null}),ve())},i(e){d||($e(f),$e(h),$e(m),$e(p),$e(g),$e(w),$e(y),$e(v),d=!0)},o(e){Ie(f),Ie(h),Ie(m),Ie(p),Ie(g),Ie(w),Ie(y),Ie(v),d=!1},d(e){f&&f.d(e),e&&k(t),e&&k(n),h&&h.d(),m&&m.d(),p&&p.d(),g&&g.d(),w&&w.d(),y.d(e),e&&k(l),v&&v.d(e),e&&k(c)}}}function oh(e){let t,n;return t=new e[41]({props:{text:e[4].designation}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};16&n[0]&&(r.text=e[4].designation),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function sh(e){let t,n;return t=new e[38]({props:{disabled:e[1]||!e[0]._id&&e[23].input,filled:!0,style:"opacity: 0.75; margin-bottom: .5em;",$$slots:{default:[ah]},$$scope:{ctx:e}}}),t.$on("click",e[74]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};8388611&n[0]&&(r.disabled=e[1]||!e[0]._id&&e[23].input),134217728&n[5]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function ah(e){let t,n,r;return n=new Ge({props:{size:"18"}}),{c(){t=M("span"),t.textContent="Barcode scannen",Ne(n.$$.fragment),q(t,"margin-right",".75em")},m(e,i){x(e,t,i),Te(n,e,i),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n,e)}}}function lh(e){let t,n;return t=new e[38]({props:{filled:!0,style:"opacity: 0.75; margin-bottom: .5em;",$$slots:{default:[ch]},$$scope:{ctx:e}}}),t.$on("click",e[81]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};16&n[0]|134217728&n[5]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function ch(e){let t,n,r,i,o=e[73](e[4].transfer)+"";return r=new Ue({props:{size:"18"}}),{c(){t=M("span"),n=B(o),Ne(r.$$.fragment),q(t,"margin-right",".75em")},m(e,o){x(e,t,o),D(t,n),Te(r,e,o),i=!0},p(e,t){(!i||16&t[0])&&o!==(o=e[73](e[4].transfer)+"")&&H(n,o)},i(e){i||($e(r.$$.fragment,e),i=!0)},o(e){Ie(r.$$.fragment,e),i=!1},d(e){e&&k(t),Re(r,e)}}}function dh(e){let t,n;return t=new e[37]({props:{name:"Total Wochen",nameClass:"formField_italic",$$slots:{default:[uh]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};16384&n[0]|134217728&n[5]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function uh(e){let t,n,r;function i(t){e[94](t)}let o={item:e[49],disabled:!0};return void 0!==e[14]&&(o.value=e[14]),t=new lo({props:o}),re.push(()=>Se(t,"value",i)),{c(){Ne(t.$$.fragment)},m(e,n){Te(t,e,n),r=!0},p(e,r){const i={};!n&&16384&r[0]&&(n=!0,i.value=e[14],ue(()=>n=!1)),t.$set(i)},i(e){r||($e(t.$$.fragment,e),r=!0)},o(e){Ie(t.$$.fragment,e),r=!1},d(e){Re(t,e)}}}function fh(e){let t,n;return t=new e[37]({props:{name:"Total Stunden",nameClass:"formField_italic",$$slots:{default:[hh]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};131072&n[0]|134217728&n[5]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function hh(e){let t,n,r;function i(t){e[95](t)}let o={item:e[47],disabled:!0};return void 0!==e[17]&&(o.value=e[17]),t=new lo({props:o}),re.push(()=>Se(t,"value",i)),{c(){Ne(t.$$.fragment)},m(e,n){Te(t,e,n),r=!0},p(e,r){const i={};!n&&131072&r[0]&&(n=!0,i.value=e[17],ue(()=>n=!1)),t.$set(i)},i(e){r||($e(t.$$.fragment,e),r=!0)},o(e){Ie(t.$$.fragment,e),r=!1},d(e){Re(t,e)}}}function mh(e){let t,n;return t=new e[37]({props:{name:"Total Betrag",nameClass:"formField_italic",$$slots:{default:[ph]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};8448&n[0]|134217728&n[5]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function ph(e){let t,n,r;function i(t){e[96](t)}let o={item:e[45],disabled:!0,currency:e[8]};return void 0!==e[13]&&(o.value=e[13]),t=new lo({props:o}),re.push(()=>Se(t,"value",i)),{c(){Ne(t.$$.fragment)},m(e,n){Te(t,e,n),r=!0},p(e,r){const i={};256&r[0]&&(i.currency=e[8]),!n&&8192&r[0]&&(n=!0,i.value=e[13],ue(()=>n=!1)),t.$set(i)},i(e){r||($e(t.$$.fragment,e),r=!0)},o(e){Ie(t.$$.fragment,e),r=!1},d(e){Re(t,e)}}}function gh(e){let t,n;return t=new e[40]({props:{class:e[32][e[172]],open:e[12]&&!e[2]&&0===e[172]&&!e[21],$$slots:{handle:[bh,({toggle:e,open:t})=>({173:e,12:t}),({toggle:e,open:t})=>[t?4096:0,0,0,0,0,e?262144:0]],default:[$h,({toggle:e,open:t})=>({173:e,12:t}),({toggle:e,open:t})=>[t?4096:0,0,0,0,0,e?262144:0]]},$$scope:{ctx:e}}}),t.$on("panel-open",function(){b(e[70](e[172],e[169]))&&e[70](e[172],e[169]).apply(this,arguments)}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(n,r){e=n;const i={};2&r[1]&&(i.class=e[32][e[172]]),2101252&r[0]&&(i.open=e[12]&&!e[2]&&0===e[172]&&!e[21]),4562943&r[0]|12&r[1]|134479872&r[5]&&(i.$$scope={dirty:r,ctx:e}),t.$set(i)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function wh(e){let t,n;return t=new Su({props:{praefix:e[172],item:e[179],eventId:e[7],fullRecord:e[0],record:e[170],recordId:e[0]._id,multiValues:e[5],reqQuantity:e[3],notifyList:e[9],noForm:Xh,classId:e[6],disabled:e[1],required:e[43],selectionFields:e[53],propSelection:e[22],numberInput:e[34],dateInput:{...e[11],l:e[4].name,t:e[172]===e[15].length-1,n:e[51].get(e[179].name)},shortEdit:e[10],currency:e[8],initFinished:e[18],formnovalidate:e[172]===e[15].length-1||e[15][e[172]]._delete}}),t.$on("notify",function(){b(e[57](e[4],e[179],e[172]))&&e[57](e[4],e[179],e[172]).apply(this,arguments)}),t.$on("task",function(){b(e[56](e[4]))&&e[56](e[4]).apply(this,arguments)}),t.$on("invalid",e[58]),t.$on("defPrep",e[59]),t.$on("checkRange",e[60]),t.$on("formula",e[71](e[172])),t.$on("record",e[97]),t.$on("listRecord",e[61](e[172])),t.$on("propSelection",e[72](e[172])),t.$on("listChange",e[62]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(n,r){e=n;const i={};16&r[0]&&(i.item=e[179]),128&r[0]&&(i.eventId=e[7]),1&r[0]&&(i.fullRecord=e[0]),32768&r[0]&&(i.record=e[170]),1&r[0]&&(i.recordId=e[0]._id),32&r[0]&&(i.multiValues=e[5]),8&r[0]&&(i.reqQuantity=e[3]),512&r[0]&&(i.notifyList=e[9]),64&r[0]&&(i.classId=e[6]),2&r[0]&&(i.disabled=e[1]),4194304&r[0]&&(i.propSelection=e[22]),8&r[1]&&(i.numberInput=e[34]),34832&r[0]&&(i.dateInput={...e[11],l:e[4].name,t:e[172]===e[15].length-1,n:e[51].get(e[179].name)}),1024&r[0]&&(i.shortEdit=e[10]),256&r[0]&&(i.currency=e[8]),262144&r[0]&&(i.initFinished=e[18]),32768&r[0]&&(i.formnovalidate=e[172]===e[15].length-1||e[15][e[172]]._delete),t.$set(i)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function yh(e){let t,n,r=e[4].item,i=[];for(let t=0;t<r.length;t+=1)i[t]=wh(th(e,r,t));const o=e=>Ie(i[e],1,1,()=>{i[e]=null});return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=F()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);x(e,t,r),n=!0},p(e,n){if(4493307&n[0]|2119176200&n[1]|1537&n[2]){let s;for(r=e[4].item,s=0;s<r.length;s+=1){const o=th(e,r,s);i[s]?(i[s].p(o,n),$e(i[s],1)):(i[s]=wh(o),i[s].c(),$e(i[s],1),i[s].m(t.parentNode,t))}for(ye(),s=r.length;s<i.length;s+=1)o(s);ve()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)$e(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)Ie(i[e]);n=!1},d(e){O(i,e),e&&k(t)}}}function vh(e){let t,n,r=e[15][e[172]]._delete,i=yh(e);return{c(){i.c(),t=F()},m(e,r){i.m(e,r),x(e,t,r),n=!0},p(e,n){32768&n[0]&&S(r,r=e[15][e[172]]._delete)?(ye(),Ie(i,1,1,_),ve(),i=yh(e),i.c(),$e(i),i.m(t.parentNode,t)):i.p(e,n)},i(e){n||($e(i),n=!0)},o(e){Ie(i),n=!1},d(e){e&&k(t),i.d(e)}}}function $h(e){let t,n,r,i,o=e[15].length,s=vh(e);return{c(){t=M("div"),s.c(),r=L(),z(t,"id",n=`accordion-content-${e[6]}-${e[4].name}-${e[172]}`)},m(e,n){x(e,t,n),s.m(t,null),x(e,r,n),i=!0},p(e,r){32768&r[0]&&S(o,o=e[15].length)?(ye(),Ie(s,1,1,_),ve(),s=vh(e),s.c(),$e(s),s.m(t,null)):s.p(e,r),(!i||80&r[0]&&n!==(n=`accordion-content-${e[6]}-${e[4].name}-${e[172]}`))&&z(t,"id",n)},i(e){i||($e(s),i=!0)},o(e){Ie(s),i=!1},d(e){e&&k(t),s.d(e),e&&k(r)}}}function Ih(e){let t,n;return t=new e[38]({props:{$$slots:{default:[Ch]},$$scope:{ctx:e}}}),t.$on("click",function(){b(e[63](e[173],e[172],e[12]))&&e[63](e[173],e[172],e[12]).apply(this,arguments)}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(n,r){e=n;const i={};98326&r[0]|4&r[1]|134217728&r[5]&&(i.$$scope={dirty:r,ctx:e}),t.$set(i)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function _h(e){let t,n,r,i,o;var s=wt;return s&&(n=new s({props:{size:"20"}})),{c(){t=M("span"),n&&Ne(n.$$.fragment),z(t,"class","pointer icon2 svelte-ai576v")},m(s,a){x(s,t,a),n&&Te(n,t,null),r=!0,i||(o=V(t,"click",e[85]),i=!0)},p(e,r){if(s!==(s=wt)){if(n){ye();const e=n;Ie(e.$$.fragment,1,0,()=>{Re(e,1)}),ve()}s?(n=new s({props:{size:"20"}}),Ne(n.$$.fragment),$e(n.$$.fragment,1),Te(n,t,null)):n=null}},i(e){r||(n&&$e(n.$$.fragment,e),r=!0)},o(e){n&&Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),n&&Re(n),i=!1,o()}}}function Ch(e){let t,n,r,i,o,s,a,l,c=e[55](e[16],e[172])+"",d=e[4].merge&&!e[1]&&0===e[172]&&_h(e);return{c(){t=M("div"),d&&d.c(),n=L(),r=new X(null),z(t,"class",i=T(e[4].name)+" svelte-ai576v"),z(t,"draggable",o=!e[4].sort),G(t,"align-left",e[4].alignLeft&&(e[2]||e[172]+1<e[15].length)),G(t,"delete",e[170]._delete),G(t,"draggableListItem",!e[4].sort),G(t,"is-active-top",e[33]?.top===e[172]),G(t,"is-active-bottom",e[33]?.bottom===e[172])},m(i,o){x(i,t,o),d&&d.m(t,null),D(t,n),r.m(c,t),s=!0,a||(l=[V(t,"dragover",e[68]),V(t,"dragleave",e[69](e[172])),V(t,"dragstart",e[66](e[172])),V(t,"drop",U(e[65](e[172]))),V(t,"dragenter",e[67](e[172]))],a=!0)},p(a,l){(e=a)[4].merge&&!e[1]&&0===e[172]?d?(d.p(e,l),18&l[0]&&$e(d,1)):(d=_h(e),d.c(),$e(d,1),d.m(t,n)):d&&(ye(),Ie(d,1,1,()=>{d=null}),ve()),(!s||65536&l[0])&&c!==(c=e[55](e[16],e[172])+"")&&r.p(c),(!s||16&l[0]&&i!==(i=T(e[4].name)+" svelte-ai576v"))&&z(t,"class",i),(!s||16&l[0]&&o!==(o=!e[4].sort))&&z(t,"draggable",o),32788&l[0]&&G(t,"align-left",e[4].alignLeft&&(e[2]||e[172]+1<e[15].length)),32784&l[0]&&G(t,"delete",e[170]._delete),16&l[0]&&G(t,"draggableListItem",!e[4].sort),16&l[0]|4&l[1]&&G(t,"is-active-top",e[33]?.top===e[172]),16&l[0]|4&l[1]&&G(t,"is-active-bottom",e[33]?.bottom===e[172])},i(e){s||($e(d),s=!0)},o(e){Ie(d),s=!1},d(e){e&&k(t),d&&d.d(),a=!1,A(l)}}}function Eh(e){let t,n,r;var i=e[176];return i&&(t=new i({props:{size:"20"}})),{c(){t&&Ne(t.$$.fragment),n=F()},m(e,i){t&&Te(t,e,i),x(e,n,i),r=!0},p(e,r){if(i!==(i=e[176])){if(t){ye();const e=t;Ie(e.$$.fragment,1,0,()=>{Re(e,1)}),ve()}i?(t=new i({props:{size:"20"}}),Ne(t.$$.fragment),$e(t.$$.fragment,1),Te(t,n.parentNode,n)):t=null}},i(e){r||(t&&$e(t.$$.fragment,e),r=!0)},o(e){t&&Ie(t.$$.fragment,e),r=!1},d(e){e&&k(n),t&&Re(t,e)}}}function Ah(e){let t,n,r,i,o,s=!e[1]&&!e[4].readonly&&Eh(e);return{c(){t=M("span"),s&&s.c(),z(t,"class","pointer icon svelte-ai576v"),z(t,"title",e[174]),t.hidden=n=e[172]===e[15].length-1||!(e[170]._delete^e[175])},m(n,a){x(n,t,a),s&&s.m(t,null),r=!0,i||(o=V(t,"click",function(){b(e[64](e[172],e[12],e[173]))&&e[64](e[172],e[12],e[173]).apply(this,arguments)}),i=!0)},p(i,o){(e=i)[1]||e[4].readonly?s&&(ye(),Ie(s,1,1,()=>{s=null}),ve()):s?(s.p(e,o),18&o[0]&&$e(s,1)):(s=Eh(e),s.c(),$e(s,1),s.m(t,null)),(!r||32768&o[0]&&n!==(n=e[172]===e[15].length-1||!(e[170]._delete^e[175])))&&(t.hidden=n)},i(e){r||($e(s),r=!0)},o(e){Ie(s),r=!1},d(e){e&&k(t),s&&s.d(),i=!1,o()}}}function bh(e){let t,n,r,i,o,s=!e[10]&&Ih(e),a=[{title:"löschen",toDelete:!0,icon:ot},{title:"undo",toDelete:!1,icon:nt}],l=[];for(let t=0;t<2;t+=1)l[t]=Ah(nh(e,a,t));const c=e=>Ie(l[e],1,1,()=>{l[e]=null});return{c(){t=M("div"),s&&s.c(),n=L();for(let e=0;e<2;e+=1)l[e].c();r=L(),z(t,"class",i=T("accordion "+e[4].name)+" svelte-ai576v"),z(t,"slot","handle")},m(e,i){x(e,t,i),s&&s.m(t,null),D(t,n);for(let e=0;e<2;e+=1)l[e].m(t,null);D(t,r),o=!0},p(e,d){if(e[10]?s&&(ye(),Ie(s,1,1,()=>{s=null}),ve()):s?(s.p(e,d),1024&d[0]&&$e(s,1)):(s=Ih(e),s.c(),$e(s,1),s.m(t,n)),36882&d[0]|4&d[2]|262144&d[5]){let n;for(a=[{title:"löschen",toDelete:!0,icon:ot},{title:"undo",toDelete:!1,icon:nt}],n=0;n<2;n+=1){const i=nh(e,a,n);l[n]?(l[n].p(i,d),$e(l[n],1)):(l[n]=Ah(i),l[n].c(),$e(l[n],1),l[n].m(t,r))}for(ye(),n=2;n<2;n+=1)c(n);ve()}(!o||16&d[0]&&i!==(i=T("accordion "+e[4].name)+" svelte-ai576v"))&&z(t,"class",i)},i(e){if(!o){$e(s);for(let e=0;e<2;e+=1)$e(l[e]);o=!0}},o(e){Ie(s),l=l.filter(Boolean);for(let e=0;e<2;e+=1)Ie(l[e]);o=!1},d(e){e&&k(t),s&&s.d(),O(l,e)}}}function Sh(e){let t,n,r=!e[2]&&e[86](e[172])&&!e[1]||(!e[4].merge||e[1])&&e[172]<e[15].length-1,i=r&&gh(e);return{c(){i&&i.c(),t=F()},m(e,r){i&&i.m(e,r),x(e,t,r),n=!0},p(e,n){32790&n[0]&&(r=!e[2]&&e[86](e[172])&&!e[1]||(!e[4].merge||e[1])&&e[172]<e[15].length-1),r?i?(i.p(e,n),32790&n[0]&&$e(i,1)):(i=gh(e),i.c(),$e(i,1),i.m(t.parentNode,t)):i&&(ye(),Ie(i,1,1,()=>{i=null}),ve())},i(e){n||($e(i),n=!0)},o(e){Ie(i),n=!1},d(e){i&&i.d(e),e&&k(t)}}}function Nh(e){let t,n,r=e[15],i=[];for(let t=0;t<r.length;t+=1)i[t]=Sh(eh(e,r,t));const o=e=>Ie(i[e],1,1,()=>{i[e]=null});return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=F()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);x(e,t,r),n=!0},p(e,n){if(6660095&n[0]|2135953422&n[1]|25167871&n[2]|278528&n[5]){let s;for(r=e[15],s=0;s<r.length;s+=1){const o=eh(e,r,s);i[s]?(i[s].p(o,n),$e(i[s],1)):(i[s]=Sh(o),i[s].c(),$e(i[s],1),i[s].m(t.parentNode,t))}for(ye(),s=r.length;s<i.length;s+=1)o(s);ve()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)$e(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)Ie(i[e]);n=!1},d(e){O(i,e),e&&k(t)}}}function Th(e){let t,n;return t=new e[39]({props:{class:e[6]+e[4].name,$$slots:{default:[Nh,({closeOtherPanels:e})=>({169:e}),({closeOtherPanels:e})=>[0,0,0,0,0,e?16384:0]]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};80&n[0]&&(r.class=e[6]+e[4].name),6660095&n[0]|14&n[1]|134234112&n[5]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Rh(e){let t,n,r;function i(t){e[99](t)}let o={$$slots:{default:[Wh,({closeCallback:e})=>({165:e}),({closeCallback:e})=>[0,0,0,0,0,e?1024:0]]},$$scope:{ctx:e}};return void 0!==e[24]&&(o.open=e[24]),t=new e[35]({props:o}),re.push(()=>Se(t,"open",i)),{c(){Ne(t.$$.fragment)},m(e,n){Te(t,e,n),r=!0},p(e,r){const i={};2116026368&r[0]|134218752&r[5]&&(i.$$scope={dirty:r,ctx:e}),!n&&16777216&r[0]&&(n=!0,i.open=e[24],ue(()=>n=!1)),t.$set(i)},i(e){r||($e(t.$$.fragment,e),r=!0)},o(e){Ie(t.$$.fragment,e),r=!1},d(e){Re(t,e)}}}function Dh(e){let t,n;return{c(){t=M("td"),n=B(e[26])},m(e,r){x(e,t,r),D(t,n)},p(e,t){67108864&t[0]&&H(n,e[26])},d(e){e&&k(t)}}}function xh(e){let t,n,r,i;return{c(){t=M("td"),n=M("input"),z(n,"id","reader_focusId"),n.autofocus=!0,n.value=e[25]},m(o,s){x(o,t,s),D(t,n),n.focus(),r||(i=[V(n,"focus",e[76]),V(n,"input",function(){b(e[82](e[21].keyboard.length))&&e[82](e[21].keyboard.length).apply(this,arguments)})],r=!0)},p(t,r){e=t,33554432&r[0]&&n.value!==e[25]&&(n.value=e[25])},d(e){e&&k(t),r=!1,A(i)}}}function kh(e){let t,n,r,i,o,s=e[77](e[21].refItem,!0)+"";return{c(){t=M("tr"),n=M("th"),r=M("div"),i=B(s),o=B(" nicht gefunden!"),q(r,"color","red"),z(n,"colspan","2")},m(e,s){x(e,t,s),D(t,n),D(n,r),D(r,i),D(r,o)},p(e,t){2097152&t[0]&&s!==(s=e[77](e[21].refItem,!0)+"")&&H(i,s)},d(e){e&&k(t)}}}function Oh(e){let t,n,r,i,o,s=e[77](e[21].refItem)+"";return{c(){t=M("tr"),n=M("th"),r=M("div"),i=B(s),o=B(" bereits eingefügt!"),q(r,"color","red"),z(n,"colspan","2")},m(e,s){x(e,t,s),D(t,n),D(n,r),D(r,i),D(r,o)},p(e,t){2097152&t[0]&&s!==(s=e[77](e[21].refItem)+"")&&H(i,s)},d(e){e&&k(t)}}}function Mh(e){let t;let n=function(e){return"number"===e[166].type?Bh:Ph}(e),r=n(e);return{c(){r.c(),t=F()},m(e,n){r.m(e,n),x(e,t,n)},p(e,t){r.p(e,t)},d(e){r.d(e),e&&k(t)}}}function Ph(e){let t;return{c(){t=M("input"),z(t,"id","reader_"+e[166].name),z(t,"type","text")},m(e,n){x(e,t,n)},p:_,d(e){e&&k(t)}}}function Bh(e){let t,n,r;return{c(){t=M("input"),q(t,"width","4em"),z(t,"id","reader_"+e[166].name),z(t,"type","number"),z(t,"min","0")},m(i,o){x(i,t,o),n||(r=V(t,"input",function(){b(e[82](e[21].keyboard.length,e[166]))&&e[82](e[21].keyboard.length,e[166]).apply(this,arguments)}),n=!0)},p(t,n){e=t},d(e){e&&k(t),n=!1,r()}}}function Lh(e){let t,n,r,i,o,s,a=e[77](e[166].name)+"",l=e[27]&&Mh(e);return{c(){t=M("tr"),n=M("th"),r=B(a),i=L(),o=M("td"),l&&l.c(),s=L()},m(e,a){x(e,t,a),D(t,n),D(n,r),D(t,i),D(t,o),l&&l.m(o,null),D(t,s)},p(e,t){e[27]?l?l.p(e,t):(l=Mh(e),l.c(),l.m(o,null)):l&&(l.d(1),l=null)},d(e){e&&k(t),l&&l.d()}}}function Fh(e){let t;return{c(){t=B("Verwerfen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Vh(e){let t;return{c(){t=B("Speichern")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Uh(e){let t,n,r,i,o,s,a,l,c,d,u,f,h,m,p,g,w,y,v,$,I,_,C,E=e[77](e[21].refItem)+"";function A(t){e[98](t)}let b={keyboard:e[21].keyboard,codeTypes:e[21].codeTypes};function S(e,t){return e[21].keyboard?xh:Dh}void 0!==e[29]&&(b.readerInit=e[29]),t=new Kf({props:b}),re.push(()=>Se(t,"readerInit",A)),t.$on("scan",e[75]),t.$on("exit",e[80]);let N=S(e),T=N(e);function R(e,t){return e[30]?Oh:e[26]&&!e[28]?kh:void 0}let P=R(e),F=P&&P(e),V=e[50],U=[];for(let t=0;t<V.length;t+=1)U[t]=Lh(Jf(e,V,t));return $=new e[38]({props:{disabled:!e[26],outline:!0,style:"float: left;",$$slots:{default:[Fh]},$$scope:{ctx:e}}}),$.$on("click",e[78]),_=new e[38]({props:{disabled:!e[28],filled:!0,style:"float: right;",$$slots:{default:[Vh]},$$scope:{ctx:e}}}),_.$on("click",e[79]),{c(){Ne(t.$$.fragment),r=L(),i=M("div"),o=M("table"),s=M("tr"),a=M("th"),a.textContent="Code",l=L(),T.c(),c=L(),d=M("tr"),u=M("th"),f=B(E),h=L(),m=M("td"),p=M("div"),g=B(e[27]),w=L(),F&&F.c(),y=L();for(let e=0;e<U.length;e+=1)U[e].c();v=L(),Ne($.$$.fragment),I=L(),Ne(_.$$.fragment),q(p,"max-width","14em"),q(o,"margin-top","1em"),q(o,"margin-bottom","1em"),q(o,"text-align","left"),q(i,"position","relative"),q(i,"z-index","1000"),q(i,"background-color","white"),q(i,"height","225px")},m(e,n){Te(t,e,n),x(e,r,n),x(e,i,n),D(i,o),D(o,s),D(s,a),D(s,l),T.m(s,null),D(o,c),D(o,d),D(d,u),D(u,f),D(d,h),D(d,m),D(m,p),D(p,g),D(o,w),F&&F.m(o,null),D(o,y);for(let e=0;e<U.length;e+=1)U[e].m(o,null);D(i,v),Te($,i,null),D(i,I),Te(_,i,null),C=!0},p(e,r){const i={};if(2097152&r[0]&&(i.keyboard=e[21].keyboard),2097152&r[0]&&(i.codeTypes=e[21].codeTypes),!n&&536870912&r[0]&&(n=!0,i.readerInit=e[29],ue(()=>n=!1)),t.$set(i),N===(N=S(e))&&T?T.p(e,r):(T.d(1),T=N(e),T&&(T.c(),T.m(s,null))),(!C||2097152&r[0])&&E!==(E=e[77](e[21].refItem)+"")&&H(f,E),(!C||134217728&r[0])&&H(g,e[27]),P===(P=R(e))&&F?F.p(e,r):(F&&F.d(1),F=P&&P(e),F&&(F.c(),F.m(o,y))),136314880&r[0]|524288&r[1]|1081344&r[2]){let t;for(V=e[50],t=0;t<V.length;t+=1){const n=Jf(e,V,t);U[t]?U[t].p(n,r):(U[t]=Lh(n),U[t].c(),U[t].m(o,null))}for(;t<U.length;t+=1)U[t].d(1);U.length=V.length}const a={};67108864&r[0]&&(a.disabled=!e[26]),134217728&r[5]&&(a.$$scope={dirty:r,ctx:e}),$.$set(a);const l={};268435456&r[0]&&(l.disabled=!e[28]),134217728&r[5]&&(l.$$scope={dirty:r,ctx:e}),_.$set(l)},i(e){C||($e(t.$$.fragment,e),$e($.$$.fragment,e),$e(_.$$.fragment,e),C=!0)},o(e){Ie(t.$$.fragment,e),Ie($.$$.fragment,e),Ie(_.$$.fragment,e),C=!1},d(e){Re(t,e),e&&k(r),e&&k(i),T.d(),F&&F.d(),O(U,e),Re($),Re(_)}}}function Wh(e){let t,n;return t=new e[36]({props:{title:"Scannen",class:"reader",closeCallback:e[165],$$slots:{default:[Uh]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};1024&n[5]&&(r.closeCallback=e[165]),2116026368&n[0]|134217728&n[5]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function zh(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Hh(e){let t,n;return t=new ju({props:{classId:e[6],list:e[4],selection:e[20]}}),t.$on("choose",e[84]),t.$on("back",e[83]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};64&n[0]&&(r.classId=e[6]),16&n[0]&&(r.list=e[4]),1048576&n[0]&&(r.selection=e[20]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function jh(e){let t,n,r=e[19]&&Hh(e);return{c(){r&&r.c(),t=F()},m(e,i){r&&r.m(e,i),x(e,t,i),n=!0},p(e,n){e[19]?r?(r.p(e,n),524288&n[0]&&$e(r,1)):(r=Hh(e),r.c(),$e(r,1),r.m(t.parentNode,t)):r&&(ye(),Ie(r,1,1,()=>{r=null}),ve())},i(e){n||($e(r),n=!0)},o(e){Ie(r),n=!1},d(e){r&&r.d(e),e&&k(t)}}}function qh(e){let t,n,r,i,o={ctx:e,current:null,token:null,hasCatch:!1,pending:zh,then:ih,catch:rh,value:164,blocks:[,,,]};function s(t){e[100](t)}_e(e[54](),o);let a={noClickaway:!0,$$slots:{default:[jh]},$$scope:{ctx:e}};return void 0!==e[19]&&(a.open=e[19]),n=new e[35]({props:a}),re.push(()=>Se(n,"open",s)),{c(){o.block.c(),t=L(),Ne(n.$$.fragment)},m(e,r){o.block.m(e,o.anchor=r),o.mount=()=>t.parentNode,o.anchor=t,x(e,t,r),Te(n,e,r),i=!0},p(t,i){Ce(o,e=t,i);const s={};1572944&i[0]|134217728&i[5]&&(s.$$scope={dirty:i,ctx:e}),!r&&524288&i[0]&&(r=!0,s.open=e[19],ue(()=>r=!1)),n.$set(s)},i(e){i||($e(o.block),$e(n.$$.fragment,e),i=!0)},o(e){for(let e=0;e<3;e+=1){Ie(o.blocks[e])}Ie(n.$$.fragment,e),i=!1},d(e){o.block.d(e),o.token=null,o=null,e&&k(t),Re(n,e)}}}let Gh=new Map;const Xh=!0,Yh="pos/target";function Zh(e,n,r){let i,o,s;const{Modal:a,Dialog:l,FormField:d,TextField:f,Button:h,Accordion:y,AccordionSection:v,Divider:$}=c,_=ee(),{loggedIn:C}=u;N(e,C,e=>r(108,s=e));let{list:E}=n,{mainSchema:A}=n,{schema:b}=n,{record:S}=n,{multiValues:T}=n,{classId:R}=n,{eventId:D}=n,{disabled:x}=n,{fixed:k}=n,{template:O={}}=n,{reqQuantity:M}=n,{open:P=!1}=n,{currency:B}=n,{notifyList:L}=n,{shortEdit:F}=n,{dateInput:V}=n,{listInput:U}=n,{refresh:W}=n,{listValues:z}=n;const H=b.find(e=>"price"===e.name&&!e.properties?.hidden),j=b.find(e=>"amount"===e.name&&!e.properties?.hidden)||b.find(e=>e.isAmount&&!e.properties?.hidden),q=b.find(e=>"quantity"===e.name&&!e.properties?.hidden),G=j||H&&q,X=G&&q;let Y=0;const Z=b.find(e=>"quantity"===e.name&&"h"===e.properties?.unit?.constant&&!e.properties?.hidden);let K=0;const J=b.find(e=>"number"===e.type&&"w"===e.properties?.unit?.constant?.toLowerCase()&&!e.properties?.hidden)?.name||"",ne=!!J;let re=0,ie=!1,oe=!1,se=[];const ae={},le=E.display?.highlight,de=E.reader;let ue,fe,he,me=b.properties?.readonly,pe=R.split("form-")[1].slice(0,-4),ge=new Map,we="",ye=!0,ve="",$e="",Ie="",_e=!1,Ce=!1,Ee=!1;const Ae=b.filter(e=>e.properties?.reader);let be=new Map,Se=0;E.group&&(k=!0);let Ne={};const Te=new Map;z[E.name]=[];const Re=e=>{let t,n,r=1;if(e.includes("=")){const[i,o]=e.split("="),[s,a]=o.split(":");if(i&&s&&a){t=s,n=a;let e=S[i+"_from"],o=S[i+"_to"];if(e&&o){const t=function(e,t){const n=new Date(e),r=new Date(t).getTime()-n.getTime();return Math.round(r/864e5)}(I(e),I(o));r=Math.floor((t+6)/7)}}}return{quantity:r,_d2:t,_d3:n}},De=E.item.filter(e=>"number"===e.type&&!!e.properties?.transfer);x||=me;let xe,ke,Oe=[],Me=[],Pe=!1,Be={},Le=[];const Fe=async e=>{if(("saleDelivery"!==E.name||!xe?.length||e[E.name]?.length)&&(!E.merge||!xe?.length||e[E.name]?.length)&&(!Array.isArray(E.source)||!xe?.length||e[E.name]?.length)&&(!E.add||!xe?.length||e[E.name]?.length)){if(r(3,M=e.quantity),F)r(15,xe=e[E.name]||[]);else if(!e._id&&E.filter){const e=xe;r(15,xe=[]);const t=await lt();r(15,xe=!1!==t?t.concat({}):e)}else r(15,xe=((e,t)=>{let n=e[t];if(n?.length||(n=[]),n=n.concat({}),e._id)return n;for(const t of b)t.preset&&!n[0][t.name]&&(n[0][t.name]=e[t.preset]);return n})(e,E.name)||[{}]);dt(e)}};b.filter(e=>e.selection).map(e=>Oe.push({className:pe,parentClass:b,refClass:e.selection,value:""}));["readonly","hidden","required"].map(e=>{b.filter(t=>"object"==typeof(t.properties&&t.properties[e])).forEach(t=>{const n=t.properties[e].refItem||"",r=t.properties[e].refValue;let[i,o]=n.split(".");o||(o=i,i=void 0),i||b.find(e=>e.name===o)?Le.push({action:e,itemName:t.name,refObj:i,refName:o,refValue:r,op:t.properties[e].invert?"!":""}):Le.push({action:e,itemName:o,refObj:i,refName:t.name,refValue:r,op:t.properties[e].invert?"!":"",revert:!0})})});const Ve=(e,t)=>""===t[e.name]?"":e._attr?Ue(e,t[e.name]):"object"===e.type?o(t[e.name]):Array.isArray(t[e.name])?ze(t[e.name]):"boolean"===e.type?w(t[e.name]):"number"===e.type?Je(t[e.name],e.properties?.decimals||0):"dateRange"===e.type?g(e.name,t):"date"===e.type?m(We(t[e.name])):"datetime"===e.type?p(t[e.name]):e.properties?.multi?"":t[e.name],Ue=(e,t)=>ae[t]?.split(" • ").at(e._attr),We=(e,t=!1)=>{if(!e)return"";try{if(e.split&&3===e.split("-").length)return new Date(e)?.toISOString();if(e.split&&3===e.split(".").length){const[t,n,r]=e.split("."),i=new Date(r,n-1,t);if(!isNaN(i))return i.toISOString()}}catch{}return t?e:""},ze=e=>e.slice(0,3).join(", "),He=(e,t,n)=>async({detail:o})=>{const{oldValue:s,value:a,add:l}=o;if(s&&!a){const e=b.find(e=>e.refItem===t.refClass&&e._formulaActor);e&&Qe(n,e._formulaActor,!0)}if(a&&!Array.isArray(a)&&t.refClass){const e=ct(t.refClass,D);let n=await Sp(e);0===n?.length&&(await(c=500,new Promise(e=>{setTimeout(e,c)})),n=await Sp(e)),n&&n.find(({_id:e})=>e==a)||await xp(t.refClass,a)}var c;let{desc:d}=o;if(""===s&&""===a&&(d=""),e.refItem){const i=await Ge(e,n,t,e.refItem);i&&r(15,xe=i)}Qe(n,t._formulaActor);const u=Oe?.find(e=>e.refClass.split(":")[1]?.split(".")[0]===t.refClass);u&&(u.value=(u.value||new Map).set(n,a)),a&&xe.length===n+1&&!F&&r(15,xe=xe.concat({})),d&&r(93,ae[a]=d,ae),F||await et(e,n,t,a,s),await Ye(n,t.name),r(16,i=xe),"number"===t.type&&r(34,Be={item:t,value:a,idx:n}),await je(n),Ze(n)},je=async e=>{if(xe[e]&&!E.filter&&xe.length!==e+1)for(const t of b.filter(e=>!!e.refProp)){let n,i=S[t.refItem]||xe[e][t.refItem];if(!i)continue;if(Array.isArray(i)){if(xe[e][t.name])continue;i=i[e][t.refItem]}const o=ct(t.refItem,D);let s=await Sp(o);if(s&&(n=s.find(({_id:e})=>e==i)),n||(n=await xp(t.refItem,i)),!n)continue;const a=qe(n,t.refProp)?.replace(",",".")||n[t.refProp]&&n[t.refProp][t.name]?.replace(",",".")||n[t.refProp];xe[e][t.name]||r(15,xe[e][t.name]=a,xe)}},qe=(e,t)=>{try{return e.split(".").reduce((e,t)=>e[t],t)}catch(e){return""}},Ge=async(e,t,n,r)=>{if(e.filter)return;const i=S[r];if(!i?.length)return;const o=i[0][r];if(!o)return;const s=await xp(r,o);return s?s[e.name]:void 0},Xe=(e,t,n,i)=>{if(!e.filter){if(i&&!1===n.refItem){const e="boolean"!==n.type&&"";xe[t][n.name]&&r(15,xe[t][n.name]=e,xe)}xe.length!==t+1&&"number"==typeof n.properties?.value&&r(15,xe[t][n.name]=n.properties.value,xe)}},Ye=async(e,t)=>{const n=Le.filter(e=>(e.refObj||pe)===t||e.refName===t);if(n?.length)for(const t of n){const{refObj:n,refName:i,refValue:o,op:s,revert:a}=t;if(a&&!k&&xe.length===e+1)return;let l,c,{itemName:d,action:u}=t,f=!1,h=!1;if(n){const t=xe[e][n];n===pe&&i?f=S:t&&(f=await xp(n,t))}!n&&i&&(f=xe[e]),!a&&f&&(h=f[i],Array.isArray(h)&&0===h.length?h=!1:o&&(h=h==(f[o]||S[o]))),!h&&a&&void 0!==S[d]&&(h=S[d]),"!"===s&&(h=!h),a&&(d=i),"required"!==u&&"readonly"!==u||(u="required"===u?u:"disabled",setTimeout(()=>{l=`#accordion-content-${R}-${E.name}-${e} .form-field.${d} .field textarea`,c=document.querySelector(l),c||(l=`#accordion-content-${R}-${E.name}-${e} .form-field.${d} .field input#${"dp-"+d+"-"+e}`,c=document.querySelector(l)),c||(l=`#accordion-content-${R}-${E.name}-${e} .form-field.${d} .field input`,c=document.querySelector(l)),c&&h&&c.setAttribute(u,""),c&&!h&&c.removeAttribute(u)},0)),"hidden"===u&&(l=`#accordion-content-${R}-${E.name}-${e} .form-field.${d}`,c=document.querySelector(l),c?.classList?.toggle("hidden",h),!a&&h&&r(15,xe[e][d]="",xe))}},Ze=(e,t)=>{let n=`#accordion-content-${R}-${E.name}-${e} .form-field:not(.hidden) .field :required:not(:disabled)`;const i=document.querySelectorAll(n);let o=!1;i.forEach(e=>{!e.id.startsWith("dp-")&&e.required&&""===e.value&&(o=!0)}),void 0===t&&(n=`#accordion-content-${R}-${E.name}-${e} :not(.form-field.hidden) .field input.invalid`,document.querySelector(n)&&(t=!0)),r(32,Me[e]=o||t?"invalid":"",Me)},Ke=e=>{if(!e)return 0;const[t,n=0]=e.split(":");return 60*t+parseInt(n)},Qe=(e,t,n=!1)=>{if(!t)return;const i=b.find(e=>e.name===t);if(!i)return;const o=i.properties.value.formula,{operator:s,argument:a}=o,l=a.map(t=>xe[e][t.refItem]||S[t.refItem]);let c=0;if("$preferred"===s)if(n)c="";else{const n=xe[e][t];if(S._id&&n!=("number"===i.type?0:void 0))return;c=l.reduce((e,t)=>{let n=e;return"number"===i.type?n=+(n||0)||+(t||0):n||=t,n})}if("$add"===s&&(c=l.reduce((e,t)=>+(e||0)+ +(t||0))),"$subtract"===s&&(c=l.reduce((e,t)=>{e||(e=""),t||(t=""),"number"==typeof e&&(e=e.toString());const[n,r]=e.split(":");e=r?(+n+ +r/60).toFixed(2):+(n||0);let[i,o]=t.split(":");return i||(i=0),e-=o?(+i+ +o/60).toFixed(2):+(i||0)})),"$multiply"===s&&(c=l.reduce((e,t)=>+(e||0)*+(t||0))),"$percentMultiply"===s){const[e,t]=l;c=+e,+t>0&&(c*=1-t/100)}if("$percentDivide"===s){const[e,t]=l;0!=+t&&(c=+e/+t*100)}if("$percentSubtract"===s){let[e,t]=l;t.replace&&(t=t.replace(",",".")),0!=+t&&(c=+e-e*+t/100)}const d=`#accordion-content-${R}-${E.name}-${e} .form-field.${t} .field input`,u=document.querySelector(d),f=u?.disabled;r(15,xe[e][t]="$multiply"===s?c?Je(c,i.properties?.decimals):"":Je(c,i.properties?.decimals),xe),r(34,Be={item:i,value:c,idx:e}),setTimeout(()=>{const t=document.querySelector(d);f&&t&&t.setAttribute("disabled",""),i._formulaActor&&Qe(e,i._formulaActor)},0)},Je=(e,t)=>(t||=0,"number"==typeof e&&e||(e=Number(e||0)),(+(Math.round(e+"e+"+t)+"e-"+t)).toFixed(t));ke=b.filter(e=>e.refClass).reduce((e,t)=>{const n=b.filter(e=>e.refItem===t.refClass);if(!n?.length)return e;if(t.selection){const[n,r]=t.selection.split(":"),[i]=r?.split(".")||[];i&&e.push({refClass:i,items:[n],selection:t.selection})}const r={refClass:t.refClass,items:[]};return n.forEach(e=>{r.items.push(e.name)}),e.push(r),e},[]);const et=async(e,t,n,i,o)=>{if(e.filter)return;const s=(await ke).find(e=>e.refClass===n.refClass);if(!s)return;const{refClass:a,items:l,selection:c}=s,d=n.name;if(Le.find(e=>e.itemName===d)){const n=`#accordion-content-${R}-${e.name}-${t} .form-field.${a}.hidden`;if(document.querySelector(n))return}return i?Promise.all(l.map(async e=>{let s=b.find(t=>t.name===e);if(!s)return;let d=s.refName||s.name,u="",f="";if(s.lookup){if(f=xe[t][s.name],r(15,xe[t][s.name]="",xe),!xe[t][s.refItem])return void r(15,xe[t][s.name]="",xe);let[e,n,i]=s.lookup.split(".");i||(i=n,n="");const o=s.lookupRefItem||s.refItem,a=s.lookupRefName||d,l=ct(s.refItem,D);let c,h=await Sp(l);if(c=h?.find(({_id:e})=>e==xe[t][s.refItem]),c||(c=await xp(s.refItem,xe[t][s.refItem])),c){if(s.refItem2){const e=await xp(s.refItem2,c[s.refItem2]);if("dealerPrice"===d&&S.branch){const e=await xp("branch",S.branch);e?.sector?.includes("Privat")&&(d="price")}e&&(u=e[d])}0===+u&&(u=c[d])}if(S[e]){const r=await xp(e,S[e]);if(r&&r[n]){const e=await xp(n,r[n]);if(e){const n=e[i].find(e=>e[o]===xe[t][o]);n&&(u=n[a])}}else if(r&&r[i]){const e=r[i].find(e=>e[o]===xe[t][o]);e&&(u=e[a])}}return xe[t][s.name]||r(15,xe[t][s.name]=u||f,xe),void await Qe(t,s._formulaActor)}if(s.properties?.readonly&&!n.refInput){const i=xe[t][n.refClass];return Promise.resolve(xp(n.refClass,i,!0)).then(n=>{let i=s.refPos?n[s.refPos]||qe(s.refPos,n):n[e];void 0!==s.factor&&(i*=s.factor),Array.isArray(i)&&(i=i.length?i[0][e]:""),r(15,xe[t][e]=i,xe),s._formulaActor&&Qe(t,s._formulaActor)})}const{refInput:h}=n;if(h&&xe[t]){const[e,n]=h.split(".");u=n?xe[t][n]:S[e]}if(c&&i!==o)l.map(e=>{r(15,xe[t][e]="",xe)});else{if(s.refItem2){const[n,i]=s.refItem2.split(".");S[n]&&xp(n,S[n]).then(n=>{n&&+n[i]&&r(15,xe[t][e]=n[i],xe)})}if(h&&!u||tt(t,e)||o!==i){const i=b.find(e=>e.refClass===a),o=xe[t][i.name];if(n.selection){const[i,s]=n.selection.split(":"),[a,l]=s?.split(".");if(i&&a&&l){const s=await xp(a,xe[t][a]);if(s&&s[l]&&s[l].find(e=>e[i]===o)){const i=Dp(n.selection+o.toString());if(i)return Promise.resolve(i).then(n=>r(15,xe[t][e]=n[e],xe))}}}const l=ct(i.refClass,D);let c=await Sp(l);if(c){const n=c.find(({_id:e})=>e==o);if(n)return Promise.resolve(()=>{r(15,xe[t][e]=n[e],xe)})}if(o)return Promise.resolve(xp(i.refClass,o)).then(n=>r(15,xe[t][e]=n[s.refInput||e],xe))}}})):Promise.resolve(l.map(e=>{r(15,xe[t][e]="",xe)}))},tt=(e,t)=>{let n=xe[e][t];return"number"===b.find(e=>e.name===t).type&&(n=Number(n||0)),!n},nt=e=>{if(!e)return;const{style:t,scrollHeight:n}=e;n&&(t.height=`${n}px`)};let rt=!1;const it=e=>!E.sort&&!(!k&&e>=xe.length-1),ot=(e,t=!1)=>{const[n,r]=e.split(";");return E.name===r&&(!!it(t)&&((!1===t||t!=n)&&parseInt(n)))};b.filter(e=>e.properties?.value?.formula?.argument).forEach(e=>{e.properties.value.formula.argument.forEach(t=>{const n=b.find(e=>e.name===t.refItem)||b.find(e=>e.name===t.refItem);n&&(n._formulaActor=e.name)})});const st=(e,t=!1)=>{const n=`#accordion-content-${R}-${E.name}-${e} > div.form-field:not(.hidden)`,i=document.querySelectorAll(n);if(!i?.length)return;const o=i[i.length-1];ce().then(()=>{const t=`#accordion-content-${R}-${E.name}-${e} textarea`;Array.from(document.querySelectorAll(t)).forEach(nt)}).then(()=>{t&&o.scrollIntoView({behavior:"smooth",block:"end"})});for(const t of b){"number"==typeof t.properties?.value&&r(15,xe[e][t.name]=t.properties.value,xe);const n=E.preserve&&E.preserve.includes(t.preset);if(t.preset&&!n&&!xe[e][t.name]){const n=Te.get(t.preset);n&&r(15,xe[e][t.name]=n,xe)}!S._id&&t.refItem&&S[t.refItem]&&xp(t.refItem,S[t.refItem]).then(n=>r(15,xe[e][t.name]=n[t.name],xe))}if(!(e<1)&&xe?.length&&e===xe.length-1&&E.preserve&&!S._id)for(const t of E.preserve){if(!xe[e-1][t])continue;const n=We(xe[e-1][t],!0);r(15,xe[e][t]=n,xe),Te.set(t,n)}},at=new Map,lt=async()=>{if(!E.filter)return[];let e,n,r,{date:i,level:o,isDealer:s}=S;if(i)[e,n,r]=i.split(".");else{i=(new Date).toISOString();const t=i.split("T")[0];[r,n,e]=t.split("-")}const a=`${r}-${n}-${e}`,l=at.get("dv"),c=at.get("lv"),d=at.get("iv");if(l===a&&c===o&&d===!!s)return!1;let u;at.set("dv",a),at.set("lv",o),at.set("iv",!!s),u=s?{$ne:""}:{$eq:""};const f={dealer:u,"_task.status":"Ready",payable:{$lt:a},_total:{$gt:0}};o&&(f.levelReminder=o),o||(f.levelReminder={$in:[void 0,!1,""]});const h=[{$addFields:{_docId:{$toString:"$_id"}}},{$lookup:{from:"_task",localField:"_docId",foreignField:"docId",as:"_task"}},{$unwind:{path:"$_task",preserveNullAndEmptyArrays:!0}},{$match:f},{$sort:{payable:1,invoiceId:1}}];return await t.getSectionView("invoice",h)},ct=(e,t)=>"p$"+E.name+"$"+e+"$"+t,dt=async e=>{if(!E.filter){if(e[E.name]?.length)for(const n of b)if((n.properties?.prefetch||1e3)<e[E.name].length){const r=ct(n.refClass,D);if(Sp(r))continue;bp(r,[]);const i=ut(e[E.name],n.name);i?.length&&bp(r,t.getSectionView(n.refClass,{_id:{$in:i}}))}r(22,ue={record:e})}},ut=(e,t)=>Array.from(new Set(e.map(e=>e[t]).filter(e=>!!e))),ft=()=>{r(30,Ce=!1),r(27,$e=""),r(25,we=""),ye=!0,r(26,ve=""),r(28,Ie=""),r(24,he=!0)},ht=async({detail:e})=>{const{refItem:n,refValue:i,refDescription:o,keyboard:s,input:a}=de;let l,c="reader_";for(;e.text.length>s.length;)e.text=e.text.slice(1);if(ve===e.text&&e.item){const t=c+e.item.name;return l=document.getElementById(t),l.value=+(be.get(e.item.name)||0)+1,be.set(e.item.name,l.value),l.focus(),ye=!0,void r(25,we="")}if(r(30,Ce=!1),r(27,$e=""),r(26,ve=e.text||""),!ve)return;const d=b.find(e=>e.name===n)?.refClass;if(!d)return;let u=await t.getSectionView(d,{[i]:ve});u?.length?(u=u[0],r(28,Ie=u._id),r(27,$e=o.map(e=>u[e]).join(", ")),r(30,Ce=xe.find(e=>e[n]===Ie)),setTimeout(()=>{b.filter(e=>e.properties?.reader).forEach(e=>{const t=document.getElementById("reader_"+e.name);t&&(t.value=be.get(e.name)||(Ce?Ce[e.name]:"")),be.set(e.name,t.value)});let t=1;if(a){const{refItem:e,refValue:n}=a;for(const r of n){const{value:n,factor:i}=r,o=u[e];n.includes(","+o.split("-")[0]+"-,")&&(t=i)}}if(e.item){const n=c+e.item.name;l=document.getElementById(n),l.value=+(be.get(e.item.name)||0)+t,be.set(e.item.name,l.value),l.focus()}else{const e=b.find(e=>e.properties?.reader).name,n=c+e;l=document.getElementById(n),l.value=+(be.get(e)||0)+t,be.set(e,l.value),l.focus()}ye=!0,r(25,we="")},0)):setTimeout(()=>{ye=!0,r(25,we=""),r(26,ve=""),be=new Map;const e=document.getElementById("reader_focusId");e&&e.focus()},0)},mt=()=>{r(27,$e=""),r(28,Ie=""),r(30,Ce=!1),r(29,_e=!0),pt(),be=new Map},pt=()=>{if(!de.keyboard)return;const e=document.getElementById("reader_focusId");e&&e.focus()};Q(async()=>{if(!E.filter&&(fe||r(23,fe=await t.getEvent(D)),(S._id||!fe.input)&&!(xe.length>1)&&!x&&de?.autostart)){if("object"==typeof de.autostart){if(!de.autostart.user)return;{const e=s.user,[t,n]=de.autostart.user.split(":"),r=A.find(e=>e.name===t),i=r?.refClass;if(!i||!n)return;const o=await xp(i,S[t]);if(!o)return;if(o[n]!==e)return}}else if(!0!==de.autostart)return;Ee=!1,ft()}});const gt=e=>{const t=xe.find(t=>{const n=E.merge.id||[E.merge.item];let r=!0;for(const i of n)r&&(r=e[i]===t[i]);return r});return t},wt=e=>{const t=gt(e);return t?t.price:e.price},yt=(e,t)=>{const n=gt(e);return n?n.quantity:t};return e.$$set=e=>{"list"in e&&r(4,E=e.list),"mainSchema"in e&&r(89,A=e.mainSchema),"schema"in e&&r(90,b=e.schema),"record"in e&&r(0,S=e.record),"multiValues"in e&&r(5,T=e.multiValues),"classId"in e&&r(6,R=e.classId),"eventId"in e&&r(7,D=e.eventId),"disabled"in e&&r(1,x=e.disabled),"fixed"in e&&r(2,k=e.fixed),"template"in e&&r(91,O=e.template),"reqQuantity"in e&&r(3,M=e.reqQuantity),"open"in e&&r(12,P=e.open),"currency"in e&&r(8,B=e.currency),"notifyList"in e&&r(9,L=e.notifyList),"shortEdit"in e&&r(10,F=e.shortEdit),"dateInput"in e&&r(11,V=e.dateInput),"listInput"in e&&r(92,U=e.listInput),"refresh"in e&&r(87,W=e.refresh),"listValues"in e&&r(88,z=e.listValues)},e.$$.update=()=>{if(16&e.$$.dirty[0]|1&e.$$.dirty[1]|33554432&e.$$.dirty[2]&&E.sort&&W&&W[E.name]&&(r(15,xe=W[E.name]),Ne={},r(88,z[E.name]=[],z),r(87,W=!1),r(31,Se+=1)),528&e.$$.dirty[0]&&L)if(Array.isArray(E.source)&&E.source?.length)E.item?.length&&(async e=>{const{refItem:n}=E,{listName:i,itemName:o,oldValue:s,value:a}=e;if(o!==n)return;if(s===a)return;if(!a&&s)return r(0,S[E.name]=[],S),void r(15,xe=[]);if(!a)return;let l=[];for(const e of E.source){let{refItem:n,refDestination:r,destination:i,quantity:s}=e;if(!n.startsWith(o))continue;let c,d,u="",[f,h,m]=n.split(".");if(m||(m=h,h=""),h&&s.includes("=")){const e=Re(s);s=e.quantity,c=e._d2,d=e._d3}const[p,g]=r.split("."),w=await t.getSectionView(p,{[g]:i}),y=await xp(f,a);h?c&&d&&s&&(u=y[h].reduce((e,t)=>{const n=t[c],r=t[d]||1e3;return+s>=+n&&+s<=+r?t[m]:e},"0.00")):u=y[m],w?.length&&(l=l.concat({[p]:w[0]._id.toString(),quantity:s,price:u}))}l.length&&r(0,S[E.name]=l,S)})(L);else if(E.add)(async e=>{if(S._id)return;const{refItem:n}=E,{item:i,filter:o}=E.add;if(e.itemName!==n)return;if(!e.value)return void r(0,S[E.name]=[],S);let s=await t.getSectionView(i,{});s=s.filter(e=>+e[o]).map(e=>(e[i]=e._id,e.quantity=1,e)),r(15,xe=s)})(L);else if(E.merge)(async e=>{const{refItem:t}=E,{itemName:n,oldValue:i,value:o}=e;n===t&&i!==o&&(o||r(15,xe=[]))})(L);else if(!E.filter){const{listName:e,itemName:t,oldValue:n,value:i}=L;e&&e===E.name&&r(0,S[e]=i,S),t&&(Te.set(t,i),t===E.name&&r(0,S[t]=i,S))}1&e.$$.dirty[0]&&Fe(S),32768&e.$$.dirty[0]&&r(16,i=xe),122896&e.$$.dirty[0]&&i&&((()=>{if(Z)r(17,K=xe?.reduce((e,t)=>e+(t._delete?0:+(t.quantity||0)),0)||0)})(),(()=>{if(ne)r(14,re=xe?.reduce((e,t)=>e+(t._delete?0:+(t[J]||0)),0)||0)})(),(()=>{if(G)r(13,Y=xe?.reduce((e,t)=>{if(t.amount){const n=t.amount??0;e+=t._delete?0:+n}else if(t.price){const n=(X?t.quantity??0:1)*(t.price??0);e+=t._delete?0:n}else if(t.value){const n=t.value??0;e+=t._delete?0:+n}return e},0)||0)})(),ce().then(()=>_("save",{listName:E.name,value:xe,amountValue:Y,weeksValue:re}))),1&e.$$.dirty[3]&&(o=e=>ae[e]?.split(" • ").filter(e=>!!e&&!/^[0-9a-f]{24}/.test(e)).slice(0,2).join(" · "))},[S,x,k,M,E,T,R,D,B,L,F,V,P,Y,re,xe,i,K,ie,oe,se,de,ue,fe,he,we,ve,$e,Ie,_e,Ce,Se,Me,Pe,Be,a,l,d,h,y,v,$,C,undefined,G,{name:"amountValue",properties:{decimals:2}},Z,{name:"hoursValue",properties:{decimals:2}},ne,{name:"weeksValue",properties:{decimals:1}},Ae,Te,De,Oe,async()=>{if(!x&&(fe||r(23,fe=await t.getEvent(D)),(S._id||!fe.input)&&de&&!de.keyboard))try{const e=await Yf();e?.length||r(21,de=!1)}catch{}},(e,t)=>{if(1===xe.length&&E.merge&&0===t)return"";let n=e[t];Ne["pos"+t]&&(n=Ne["pos"+t]);let i=b;E.display?.refItem&&(i=E.display.refItem.map(e=>{let[t,n]=e.split(".");const r=b.find(e=>e.name===t);if(r)return r._attr=n,r}).filter(e=>!!e));let o=n&&i.filter(e=>!0!==e.properties?.hidden&&("dateRange"===e.type||void 0!==n[e.name])&&"html"!==e.properties?.format&&"textarea"!==e.properties?.format).map(e=>Ve(e,n)).filter(e=>!!e).join(" • ")||"+";if(E.sort){const e=n&&i.filter(e=>!0!==e.properties?.hidden&&("dateRange"===e.type||void 0!==n[e.name])&&"html"!==e.properties?.format&&"textarea"!==e.properties?.format).map(e=>Ve(e,n)).join(" • ");r(88,z[E.name][t]=e,z)}if(le?.item&&n[le.item]){o=`<span style="color: ${le?.color||"red"};">${o}</span>`}return o},e=>({detail:{row:t}})=>{if(_("task",{row:t}),!S._id&&t._id){for(let t=0;t<xe.length;t++)for(const n of e.item)Xe(e,t,n,!ie);r(18,ie=!0)}},He,({detail:e})=>{const{idx:t,value:n}=e;Ze(t,n)},async({detail:{className:e,itemName:n,value:r}})=>{if(ge.has(e))return;if(!0!==r&&(r=(r=[].concat(r)).some(e=>e===pe+"."+E.name)),!r)return;const i={[n]:!0},o=await t.getSectionView(e,i);o?.length&&ge.set(e,o[0])},({detail:e})=>{const{idx:t,fieldId:n,value:r}=e;if(!r)return;const i=Ke(r);let o=!1;xe.forEach((e,n)=>{if(t===n)return;const{start:r,end:s}=xe[n];r&&s&&i>Ke(r)&&i<Ke(s)&&(o=!0)});const s=document.getElementById(n);s?.classList?.toggle("invalid",o)},e=>({detail:t})=>{if(t.string)r(15,xe[e][t.itemName]=t.value,xe);else{r(15,xe[e][t.itemName]=Je(t.value,t.decimals),xe);const n=b.find(e=>e.name===t.itemName&&e._formulaActor);n&&Qe(e,n._formulaActor,!0)}},async({detail:e})=>{const{className:t,row:n}=e,i=await xp(t,n._id);if(!i?.messageId)return;let o=[...xe];const s={...o.find(e=>e.messageId==i.messageId)};s[t]=n._id;const a=E.name.slice(4),l=[...S[a]].concat(s);_("save",{listName:a,value:l,listInput:!0}),r(15,xe=o.filter(e=>e.messageId!=i.messageId)),_("save",{listName:E.name,value:xe}),xe?.length||_("save",{itemName:"status",value:"abgeschlossen"}),setTimeout(()=>{_("saveFull")},2e3)},(e,t,n)=>n=>{E.merge&&xe.length===t+1||xe[t]._delete||(e(n),st(t,!0))},(e,t,n)=>i=>{if(r(15,xe[e]._delete=!xe[e]._delete,xe),xe[e]._delete){Ne["pos"+e]={...xe[e]};for(const t of b)r(15,xe[e][t.name]="",xe);t&&n(i)}else{if(Ne["pos"+e]){const t={};for(const n of b)t[n.name]=Ne["pos"+e][n.name];r(15,xe[e]=t,xe)}Ne["pos"+e]=void 0,t||n(i)}},e=>t=>{t.preventDefault(),r(33,Pe=!1);const n=ot(t.dataTransfer.getData(Yh),e);if(!1===n)return;t.dataTransfer.dropEffect="move";const i=[...xe].map((e,t)=>(e._index=t,e));n<e?(i.splice(e+1,0,i[n]),i.splice(n,1)):(i.splice(e,0,i[n]),i.splice(n+1,1)),i.map((e,t)=>{return n=e._index,r=t,void Gh.set(r,n);var n,r});let o=[];Me.map((e,t)=>{o[t]=Me[(e=>{const t=Gh.get(e);return void 0===t?e:t})(t)]}),r(32,Me=o),r(15,xe=i.map((e,t)=>(delete e._index,e))),rt=!1},e=>t=>{if(!it(e))return!1;t.dataTransfer.effectAllowed="move",t.dataTransfer.dropEffect="move",t.dataTransfer.setData(Yh,e+";"+E.name),rt=e},e=>t=>{const n=ot(t.dataTransfer.getData(Yh),e)||rt;return!1===n||n===e?r(33,Pe=!1):void r(33,Pe={top:n>e&&e,bottom:n<e&&e})},e=>e.preventDefault(),e=>e=>{r(33,Pe=!1)},(e,t)=>n=>{setTimeout(()=>{Array.from(ge).forEach(([t,n])=>{xe[e][t]||r(15,xe[e][t]=n._id,xe)})},500);const i=new Set;for(const e of Le)i.add(e.refObj||pe);for(const t of Array.from(i))Ye(e,t);t(n),st(e)},e=>({detail:t})=>{Qe(e,t.item.name)},e=>async({detail:t})=>{const{itemName:n,itemType:i,source:o,target:s,sourceId:a,prop:l}=t;if(!a)return void r(15,xe[e][n]="",xe);let c=await xp(o,a);const d=c[l];c=await xp(E.name,S[E.name][e][E.name]);const u=c[s];let f="number"===i?0:"",h=0;u.forEach(e=>{const t=e[l];t.length<=h||t.every(e=>d.find(t=>t===e))&&(f=e[n],h=t.length)}),r(15,xe[e][n]=f,xe)},e=>e?.description||"Daten übernehmen",ft,ht,()=>{ye=!0,r(25,we="")},(e,t=!1)=>t?(mt(),""):b.find(t=>t.name===e)?.designation||"",mt,()=>{const{refItem:e}=de,t={[e]:Ie};let n;b.filter(e=>e.properties?.reader).forEach(e=>{const n=document.getElementById("reader_"+e.name);n&&(t[e.name]=n.value||("number"===e.type?0:""))});let i=xe;const o=i.findIndex(t=>t[e]===Ie);o>=0?(n=i[o],i[o]={...n,...t}):i=i.slice(0,-1).concat(t),r(15,xe=i),b.filter(e=>e.properties?.reader).forEach(e=>{He(e,o>=0?o:0)({detail:{oldValue:n?n[e.name]:"",value:t[e.name]}})}),Ee=!0,mt()},()=>{Ee&&(_("readerSave"),Ee=!1)},()=>{const e=new Map;De.forEach(t=>{[].concat(t.properties.transfer.target).forEach(n=>{e.set(n,t.name)})});let t=0;for(const n of xe){for(const[i,o]of e)!n[i]&&n[o]&&r(15,xe[t][i]=n[o],xe);t++}r(16,i=xe)},(e,t)=>n=>{const{data:i}=n;"0123456789".includes(i)&&(ye?(r(25,we=i.toString()),ye=!1):(r(25,we+=i.toString()),"77"===we&&r(25,we="7"),we.length===e&&ht({detail:{text:we,item:t}})))},()=>{r(19,oe=!1)},({detail:e})=>{r(19,oe=!1);const{list:t}=e,n=[];for(const e of t)n.push({article:e.article,designation:e.designation,quantity:yt(e,e.perWeek?Re(E.merge.quantity).quantity:1),price:wt(e)});n.push({}),r(15,xe=n)},e=>{e.stopImmediatePropagation();const t=E.merge.id||[E.merge.item];r(20,se=xe.map(e=>(e=>{const n={};for(const r of t)n[r]=e[r];return n})(e))),r(19,oe=!0)},e=>!E.merge||!(e>0&&xe.length===e+1),W,z,A,b,O,U,ae,function(e){re=e,r(14,re)},function(e){K=e,r(17,K)},function(e){Y=e,r(13,Y)},function(t){te(e,t)},function(e){_e=e,r(29,_e)},function(e){he=e,r(24,he)},function(e){oe=e,r(19,oe)}]}class Kh extends xe{constructor(e){var t;super(),Qf.getElementById("svelte-ai576v-style")||((t=M("style")).id="svelte-ai576v-style",t.textContent=".accordion.svelte-ai576v{display:flex;overflow:hidden}.accordion-content.svelte-ai576v{position:relative}.formList .accordion > .btn{display:inline-block;margin-bottom:1em;background-color:#F5F5F5}.sTask .formList .accordion > .btn{width:95% !important}.sEmbedded .formList .accordion > .btn{width:97%}@media screen and (max-width: 600px){.formList .accordion > .btn{width:25em}}span.pointer.svelte-ai576v{padding-top:1em}div.delete.svelte-ai576v{text-decoration:line-through}.icon.svelte-ai576v{margin-right:-0.75em}.icon2.svelte-ai576v{display:inline-flex;padding-top:0 !important;float:left}.form-field .formField_italic{font-style:italic}.panel.invalid .btn{border:1px #b80000 solid}.draggableListItem.svelte-ai576v{cursor:drag}.draggableListItem.is-active-top.svelte-ai576v{border-top:3px purple solid;padding-top:2em}.draggableListItem.is-active-bottom.svelte-ai576v{border-bottom:3px purple solid;padding-bottom:2em}.modal-overlay > .dialog.reader{margin-top:0}.align-left.svelte-ai576v{text-align:left}",D(Qf.head,t)),De(this,e,Zh,qh,S,{list:4,mainSchema:89,schema:90,record:0,multiValues:5,classId:6,eventId:7,disabled:1,fixed:2,template:91,reqQuantity:3,open:12,currency:8,notifyList:9,shortEdit:10,dateInput:11,listInput:92,refresh:87,listValues:88},[-1,-1,-1,-1,-1,-1])}}const{Boolean:Qh,document:Jh}=Ee;function em(e,t,n){const r=e.slice();return r[219]=t[n],r[221]=n,r}function tm(e,t,n){const r=e.slice();return r[223]=t[n],r}function nm(e,t,n){const r=e.slice();return r[226]=t[n],r}function rm(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function im(e){let t,n,r=e[222]&&function(e){let t,n,r,i,o,s,a,l,c,d,u,f,h,m,p,g,w,y,v,$,I=e[26]&&om(e),_=e[44]&&am(e),C=e[0].items,E=[];for(let t=0;t<C.length;t+=1)E[t]=dm(nm(e,C,t));const b=e=>Ie(E[e],1,1,()=>{E[e]=null});let S=e[0].list&&um(e),N=!e[4]&&!e[2]&&e[42]&&e[5]&&!e[49]&&Im(e);f=new e[54]({props:{outline:!0,$$slots:{default:[Cm]},$$scope:{ctx:e}}}),f.$on("click",e[74]);let R=e[39]&&!e[38]&&!!e[49]&&Em(e);const P=[Nm,Sm,bm],B=[];function F(e,t){return e[13]?0:e[42]?1:2}return p=F(e),g=B[p]=P[p](e),{c(){t=M("section"),I&&I.c(),n=L(),_&&_.c(),r=L(),i=M("form"),o=M("input"),a=L();for(let e=0;e<E.length;e+=1)E[e].c();l=L(),S&&S.c(),c=L(),N&&N.c(),d=L(),u=M("div"),Ne(f.$$.fragment),h=L(),R&&R.c(),m=L(),g.c(),z(o,"class",T(e[61])+" svelte-11r31hb"),z(o,"name","_id"),z(o,"type","hidden"),o.value=s=e[12]._id||"",z(i,"class",T(e[62])+" svelte-11r31hb"),z(i,"id",e[61]),z(u,"class",w=T(e[13]||e[7]?"form--buttons isReport":"form--buttons")+" svelte-11r31hb"),z(t,"class",T(e[63])+" svelte-11r31hb")},m(s,g){x(s,t,g),I&&I.m(t,null),D(t,n),_&&_.m(t,null),D(t,r),D(t,i),D(i,o),D(i,a);for(let e=0;e<E.length;e+=1)E[e].m(i,null);D(i,l),S&&S.m(i,null),D(t,c),N&&N.m(t,null),D(t,d),D(t,u),Te(f,u,null),D(u,h),R&&R.m(u,null),D(u,m),B[p].m(u,null),y=!0,v||($=[V(i,"keydown",e[81]),V(i,"submit",U(e[73]))],v=!0)},p(e,a){if(e[26]?I?(I.p(e,a),67108864&a[0]&&$e(I,1)):(I=om(e),I.c(),$e(I,1),I.m(t,n)):I&&(ye(),Ie(I,1,1,()=>{I=null}),ve()),e[44]?_?(_.p(e,a),8192&a[1]&&$e(_,1)):(_=am(e),_.c(),$e(_,1),_.m(t,r)):_&&(ye(),Ie(_,1,1,()=>{_=null}),ve()),(!y||4096&a[0]&&s!==(s=e[12]._id||""))&&(o.value=s),9195521&a[0]|1074003988&a[1]|520610320&a[2]){let t;for(C=e[0].items,t=0;t<C.length;t+=1){const n=nm(e,C,t);E[t]?(E[t].p(n,a),$e(E[t],1)):(E[t]=dm(n),E[t].c(),$e(E[t],1),E[t].m(i,l))}for(ye(),t=C.length;t<E.length;t+=1)b(t);ve()}e[0].list?S?(S.p(e,a),1&a[0]&&$e(S,1)):(S=um(e),S.c(),$e(S,1),S.m(i,null)):S&&(ye(),Ie(S,1,1,()=>{S=null}),ve()),e[4]||e[2]||!e[42]||!e[5]||e[49]?N&&(ye(),Ie(N,1,1,()=>{N=null}),ve()):N?(N.p(e,a),52&a[0]|264192&a[1]&&$e(N,1)):(N=Im(e),N.c(),$e(N,1),N.m(t,d));const c={};4096&a[7]&&(c.$$scope={dirty:a,ctx:e}),f.$set(c),e[39]&&!e[38]&&e[49]?R?(R.p(e,a),262528&a[1]&&$e(R,1)):(R=Em(e),R.c(),$e(R,1),R.m(u,m)):R&&(ye(),Ie(R,1,1,()=>{R=null}),ve());let h=p;p=F(e),p===h?B[p].p(e,a):(ye(),Ie(B[h],1,1,()=>{B[h]=null}),ve(),g=B[p],g?g.p(e,a):(g=B[p]=P[p](e),g.c()),$e(g,1),g.m(u,null)),(!y||8320&a[0]&&w!==(w=T(e[13]||e[7]?"form--buttons isReport":"form--buttons")+" svelte-11r31hb"))&&z(u,"class",w)},i(e){if(!y){$e(I),$e(_);for(let e=0;e<C.length;e+=1)$e(E[e]);$e(S),$e(N),$e(f.$$.fragment,e),$e(R),$e(g),y=!0}},o(e){Ie(I),Ie(_),E=E.filter(Qh);for(let e=0;e<E.length;e+=1)Ie(E[e]);Ie(S),Ie(N),Ie(f.$$.fragment,e),Ie(R),Ie(g),y=!1},d(e){e&&k(t),I&&I.d(),_&&_.d(),O(E,e),S&&S.d(),N&&N.d(),Re(f),R&&R.d(),B[p].d(),v=!1,A($)}}}(e);return{c(){r&&r.c(),t=F()},m(e,i){r&&r.m(e,i),x(e,t,i),n=!0},p(e,t){e[222]&&r.p(e,t)},i(e){n||($e(r),n=!0)},o(e){Ie(r),n=!1},d(e){r&&r.d(e),e&&k(t)}}}function om(e){let t,n;return t=new e[54]({props:{disabled:e[49]||e[12]._id,filled:!0,style:"opacity: 0.75; margin-bottom: .5em;",$$slots:{default:[sm]},$$scope:{ctx:e}}}),t.$on("click",e[98]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};4096&n[0]|262144&n[1]&&(r.disabled=e[49]||e[12]._id),4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function sm(e){let t,n,r;return n=new Ge({props:{size:"18"}}),{c(){t=M("span"),t.textContent="QR Code scannen",Ne(n.$$.fragment),q(t,"margin-right",".75em")},m(e,i){x(e,t,i),Te(n,e,i),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n,e)}}}function am(e){let t,n;return t=new e[54]({props:{filled:!0,style:"opacity: 0.75; margin-bottom: .5em;",$$slots:{default:[lm]},$$scope:{ctx:e}}}),t.$on("click",e[96]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function lm(e){let t,n,r;return n=new ut({props:{size:"18"}}),{c(){t=M("span"),t.textContent="Dokument ergänzen",Ne(n.$$.fragment),q(t,"margin-right",".75em")},m(e,i){x(e,t,i),Te(n,e,i),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n,e)}}}function cm(e){let t,n;return t=new Su({props:{classId:e[61],item:e[226],selection:e[226].selection,record:e[12],disabled:e[49],eventId:e[71],multiValues:e[66],notifyList:e[14],toDelete:e[23],currency:e[18],ownCurrency:e[19],changeValue:e[35],initFinished:e[33]}}),t.$on("save",e[80]),t.$on("saveFull",e[78]),t.$on("saveDialog",e[79]),t.$on("task",e[75]),t.$on("notify",e[76]),t.$on("safeReference",e[87]),t.$on("multi",e[77]),t.$on("defPrep",e[86]),t.$on("record",e[88]),t.$on("objRecord",e[89]),t.$on("formula",e[90]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};1&n[0]&&(r.item=e[226]),1&n[0]&&(r.selection=e[226].selection),4096&n[0]&&(r.record=e[12]),262144&n[1]&&(r.disabled=e[49]),16384&n[0]&&(r.notifyList=e[14]),8388608&n[0]&&(r.toDelete=e[23]),262144&n[0]&&(r.currency=e[18]),524288&n[0]&&(r.ownCurrency=e[19]),16&n[1]&&(r.changeValue=e[35]),4&n[1]&&(r.initFinished=e[33]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function dm(e){let t,n,r="list"!==e[226].type&&cm(e);return{c(){r&&r.c(),t=F()},m(e,i){r&&r.m(e,i),x(e,t,i),n=!0},p(e,n){"list"!==e[226].type?r?(r.p(e,n),1&n[0]&&$e(r,1)):(r=cm(e),r.c(),$e(r,1),r.m(t.parentNode,t)):r&&(ye(),Ie(r,1,1,()=>{r=null}),ve())},i(e){n||($e(r),n=!0)},o(e){Ie(r),n=!1},d(e){r&&r.d(e),e&&k(t)}}}function um(e){let t,n,r,i,o,s=e[8]&&e[67]&&e[20]&&0!=e[20]&&fm(e),a=e[8]&&e[21]&&mm(e),l=e[68]&&e[34]&&0!=e[34]&&gm(e),c=e[0].list,d=[];for(let t=0;t<c.length;t+=1)d[t]=$m(tm(e,c,t));const u=e=>Ie(d[e],1,1,()=>{d[e]=null});return{c(){s&&s.c(),t=L(),a&&a.c(),n=L(),l&&l.c(),r=L();for(let e=0;e<d.length;e+=1)d[e].c();i=F()},m(e,c){s&&s.m(e,c),x(e,t,c),a&&a.m(e,c),x(e,n,c),l&&l.m(e,c),x(e,r,c);for(let t=0;t<d.length;t+=1)d[t].m(e,c);x(e,i,c),o=!0},p(e,o){if(e[8]&&e[67]&&e[20]&&0!=e[20]?s?(s.p(e,o),1048832&o[0]&&$e(s,1)):(s=fm(e),s.c(),$e(s,1),s.m(t.parentNode,t)):s&&(ye(),Ie(s,1,1,()=>{s=null}),ve()),e[8]&&e[21]?a?(a.p(e,o),2097408&o[0]&&$e(a,1)):(a=mm(e),a.c(),$e(a,1),a.m(n.parentNode,n)):a&&(ye(),Ie(a,1,1,()=>{a=null}),ve()),e[68]&&e[34]&&0!=e[34]?l?(l.p(e,o),8&o[1]&&$e(l,1)):(l=gm(e),l.c(),$e(l,1),l.m(r.parentNode,r)):l&&(ye(),Ie(l,1,1,()=>{l=null}),ve()),51335237&o[0]|1074200672&o[1]|67437072&o[2]|16&o[3]){let t;for(c=e[0].list,t=0;t<c.length;t+=1){const n=tm(e,c,t);d[t]?(d[t].p(n,o),$e(d[t],1)):(d[t]=$m(n),d[t].c(),$e(d[t],1),d[t].m(i.parentNode,i))}for(ye(),t=c.length;t<d.length;t+=1)u(t);ve()}},i(e){if(!o){$e(s),$e(a),$e(l);for(let e=0;e<c.length;e+=1)$e(d[e]);o=!0}},o(e){Ie(s),Ie(a),Ie(l),d=d.filter(Qh);for(let e=0;e<d.length;e+=1)Ie(d[e]);o=!1},d(e){s&&s.d(e),e&&k(t),a&&a.d(e),e&&k(n),l&&l.d(e),e&&k(r),O(d,e),e&&k(i)}}}function fm(e){let t,n;return t=new e[55]({props:{name:"Total Dokument",nameClass:"formField_italic",$$slots:{default:[hm]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};1572864&n[0]|4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function hm(e){let t,n,r;function i(t){e[113](t)}let o={item:e[64],disabled:!0,currency:e[19]};return void 0!==e[20]&&(o.value=e[20]),t=new lo({props:o}),re.push(()=>Se(t,"value",i)),{c(){Ne(t.$$.fragment)},m(e,n){Te(t,e,n),r=!0},p(e,r){const i={};524288&r[0]&&(i.currency=e[19]),!n&&1048576&r[0]&&(n=!0,i.value=e[20],ue(()=>n=!1)),t.$set(i)},i(e){r||($e(t.$$.fragment,e),r=!0)},o(e){Ie(t.$$.fragment,e),r=!1},d(e){Re(t,e)}}}function mm(e){let t,n;return t=new e[55]({props:{name:"Total MWSt "+(e[22]?"("+e[22]+"%)":""),nameClass:"formField_italic",$$slots:{default:[pm]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};4194304&n[0]&&(r.name="Total MWSt "+(e[22]?"("+e[22]+"%)":"")),2621440&n[0]|4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function pm(e){let t,n,r;function i(t){e[114](t)}let o={item:e[65],disabled:!0,currency:e[19]};return void 0!==e[21]&&(o.value=e[21]),t=new lo({props:o}),re.push(()=>Se(t,"value",i)),{c(){Ne(t.$$.fragment)},m(e,n){Te(t,e,n),r=!0},p(e,r){const i={};524288&r[0]&&(i.currency=e[19]),!n&&2097152&r[0]&&(n=!0,i.value=e[21],ue(()=>n=!1)),t.$set(i)},i(e){r||($e(t.$$.fragment,e),r=!0)},o(e){Ie(t.$$.fragment,e),r=!1},d(e){Re(t,e)}}}function gm(e){let t,n;return t=new e[55]({props:{name:"Gesamtzeit in Wochen",nameClass:"formField_italic",$$slots:{default:[wm]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};8&n[1]|4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function wm(e){let t,n,r;function i(t){e[115](t)}let o={item:e[69],disabled:!0};return void 0!==e[34]&&(o.value=e[34]),t=new lo({props:o}),re.push(()=>Se(t,"value",i)),{c(){Ne(t.$$.fragment)},m(e,n){Te(t,e,n),r=!0},p(e,r){const i={};!n&&8&r[1]&&(n=!0,i.value=e[34],ue(()=>n=!1)),t.$set(i)},i(e){r||($e(t.$$.fragment,e),r=!0)},o(e){Ie(t.$$.fragment,e),r=!1},d(e){Re(t,e)}}}function ym(e){let t,n,r,i,o;function s(t){e[118](t)}t=new e[53]({props:{text:e[223].designation}});let a={classId:e[61],open:!e[2]&&1===e[0].list.length,list:e[223],template:e[36],eventId:e[71],schema:e[223].item,record:e[12],disabled:e[49],currency:e[223].foreignCurrency?e[18]:e[19],update:e[16]};return void 0!==e[14]&&(a.notifyList=e[14]),r=new Ii({props:a}),re.push(()=>Se(r,"notifyList",s)),{c(){Ne(t.$$.fragment),n=L(),Ne(r.$$.fragment)},m(e,i){Te(t,e,i),x(e,n,i),Te(r,e,i),o=!0},p(e,n){const o={};1&n[0]&&(o.text=e[223].designation),t.$set(o);const s={};5&n[0]&&(s.open=!e[2]&&1===e[0].list.length),1&n[0]&&(s.list=e[223]),32&n[1]&&(s.template=e[36]),1&n[0]&&(s.schema=e[223].item),4096&n[0]&&(s.record=e[12]),262144&n[1]&&(s.disabled=e[49]),786433&n[0]&&(s.currency=e[223].foreignCurrency?e[18]:e[19]),65536&n[0]&&(s.update=e[16]),!i&&16384&n[0]&&(i=!0,s.notifyList=e[14],ue(()=>i=!1)),r.$set(s)},i(e){o||($e(t.$$.fragment,e),$e(r.$$.fragment,e),o=!0)},o(e){Ie(t.$$.fragment,e),Ie(r.$$.fragment,e),o=!1},d(e){Re(t,e),e&&k(n),Re(r,e)}}}function vm(e){let t,n,r,i;function o(t){e[116](t)}function s(t){e[117](t)}let a={classId:e[61],open:e[25],list:e[223],template:e[37],eventId:e[71],schema:e[223].item,mainSchema:e[0].items,record:e[12],disabled:e[49],fixed:e[223].fixed,reqQuantity:e[24],currency:e[223].foreignCurrency?e[18]:e[19],notifyList:e[14],multiValues:e[66],shortEdit:e[6],dateInput:e[17],listInput:Op};return void 0!==e[47]&&(a.refresh=e[47]),void 0!==e[48]&&(a.listValues=e[48]),t=new Kh({props:a}),re.push(()=>Se(t,"refresh",o)),re.push(()=>Se(t,"listValues",s)),t.$on("save",e[80]),t.$on("saveFull",e[78]),t.$on("record",e[88]),t.$on("readerSave",e[97]),{c(){Ne(t.$$.fragment)},m(e,n){Te(t,e,n),i=!0},p(e,i){const o={};33554432&i[0]&&(o.open=e[25]),1&i[0]&&(o.list=e[223]),64&i[1]&&(o.template=e[37]),1&i[0]&&(o.schema=e[223].item),1&i[0]&&(o.mainSchema=e[0].items),4096&i[0]&&(o.record=e[12]),262144&i[1]&&(o.disabled=e[49]),1&i[0]&&(o.fixed=e[223].fixed),16777216&i[0]&&(o.reqQuantity=e[24]),786433&i[0]&&(o.currency=e[223].foreignCurrency?e[18]:e[19]),16384&i[0]&&(o.notifyList=e[14]),64&i[0]&&(o.shortEdit=e[6]),131072&i[0]&&(o.dateInput=e[17]),!n&&65536&i[1]&&(n=!0,o.refresh=e[47],ue(()=>n=!1)),!r&&131072&i[1]&&(r=!0,o.listValues=e[48],ue(()=>r=!1)),t.$set(o)},i(e){i||($e(t.$$.fragment,e),i=!0)},o(e){Ie(t.$$.fragment,e),i=!1},d(e){Re(t,e)}}}function $m(e){let t,n,r,i;const o=[vm,ym],s=[];function a(e,t){return"array"===e[223].type?0:1}return t=a(e),n=s[t]=o[t](e),{c(){n.c(),r=F()},m(e,n){s[t].m(e,n),x(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?s[t].p(e,i):(ye(),Ie(s[l],1,1,()=>{s[l]=null}),ve(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),$e(n,1),n.m(r.parentNode,r))},i(e){i||($e(n),i=!0)},o(e){Ie(n),i=!1},d(e){s[t].d(e),e&&k(r)}}}function Im(e){let t,n,r,i;function o(t){e[119](t)}let s={title:"",$$slots:{default:[_m]},$$scope:{ctx:e}};return void 0!==e[41]&&(s.checked=e[41]),n=new e[56]({props:s}),re.push(()=>Se(n,"checked",o)),{c(){t=M("div"),Ne(n.$$.fragment),z(t,"class","askNext"),q(t,"margin-top","1em"),q(t,"margin-left","23em")},m(e,r){x(e,t,r),Te(n,t,null),i=!0},p(e,t){const i={};4096&t[7]&&(i.$$scope={dirty:t,ctx:e}),!r&&1024&t[1]&&(r=!0,i.checked=e[41],ue(()=>r=!1)),n.$set(i)},i(e){i||($e(n.$$.fragment,e),i=!0)},o(e){Ie(n.$$.fragment,e),i=!1},d(e){e&&k(t),Re(n)}}}function _m(e){let t;return{c(){t=M("span"),t.textContent="Weiter erfassen",q(t,"margin-left",".75em")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Cm(e){let t;return{c(){t=B("Abbrechen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Em(e){let t,n;return t=new e[54]({props:{filled:!0,style:"opacity: 0.6;",$$slots:{default:[Am]},$$scope:{ctx:e}}}),t.$on("click",function(){b(e[82](e[1]))&&e[82](e[1]).apply(this,arguments)}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(n,r){e=n;const i={};4096&r[7]&&(i.$$scope={dirty:r,ctx:e}),t.$set(i)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Am(e){let t,n,r;return n=new xt({props:{size:"18"}}),{c(){t=M("span"),t.textContent=`${e[91]()}`,Ne(n.$$.fragment),q(t,"margin-right",".75em")},m(e,i){x(e,t,i),Te(n,e,i),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n,e)}}}function bm(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Sm(e){let t,n,r,i,o,s;const a=[Rm,Tm],l=[];function c(e,t){return e[7]?0:1}t=c(e),n=l[t]=a[t](e);let d=e[2]&&e[3]&&Pm(e),u=e[38]&&Lm(e);return{c(){n.c(),r=L(),d&&d.c(),i=L(),u&&u.c(),o=F()},m(e,n){l[t].m(e,n),x(e,r,n),d&&d.m(e,n),x(e,i,n),u&&u.m(e,n),x(e,o,n),s=!0},p(e,s){let f=t;t=c(e),t===f?l[t].p(e,s):(ye(),Ie(l[f],1,1,()=>{l[f]=null}),ve(),n=l[t],n?n.p(e,s):(n=l[t]=a[t](e),n.c()),$e(n,1),n.m(r.parentNode,r)),e[2]&&e[3]?d?(d.p(e,s),12&s[0]&&$e(d,1)):(d=Pm(e),d.c(),$e(d,1),d.m(i.parentNode,i)):d&&(ye(),Ie(d,1,1,()=>{d=null}),ve()),e[38]?u?(u.p(e,s),128&s[1]&&$e(u,1)):(u=Lm(e),u.c(),$e(u,1),u.m(o.parentNode,o)):u&&(ye(),Ie(u,1,1,()=>{u=null}),ve())},i(e){s||($e(n),$e(d),$e(u),s=!0)},o(e){Ie(n),Ie(d),Ie(u),s=!1},d(e){l[t].d(e),e&&k(r),d&&d.d(e),e&&k(i),u&&u.d(e),e&&k(o)}}}function Nm(e){let t,n,r,i;t=new e[54]({props:{filled:!0,style:"opacity: 0.75;",$$slots:{default:[qm]},$$scope:{ctx:e}}}),t.$on("click",e[84]);let o=e[40]&&Gm(e);return{c(){Ne(t.$$.fragment),n=L(),o&&o.c(),r=F()},m(e,s){Te(t,e,s),x(e,n,s),o&&o.m(e,s),x(e,r,s),i=!0},p(e,n){const i={};4096&n[7]&&(i.$$scope={dirty:n,ctx:e}),t.$set(i),e[40]?o?(o.p(e,n),512&n[1]&&$e(o,1)):(o=Gm(e),o.c(),$e(o,1),o.m(r.parentNode,r)):o&&(ye(),Ie(o,1,1,()=>{o=null}),ve())},i(e){i||($e(t.$$.fragment,e),$e(o),i=!0)},o(e){Ie(t.$$.fragment,e),Ie(o),i=!1},d(e){Re(t,e),e&&k(n),o&&o.d(e),e&&k(r)}}}function Tm(e){let t,n,r,i=!(e[43]||e[41])&&Dm(e),o=e[5]&&!e[49]&&km(e);return{c(){i&&i.c(),t=L(),o&&o.c(),n=F()},m(e,s){i&&i.m(e,s),x(e,t,s),o&&o.m(e,s),x(e,n,s),r=!0},p(e,r){e[43]||e[41]?i&&(ye(),Ie(i,1,1,()=>{i=null}),ve()):i?(i.p(e,r),5120&r[1]&&$e(i,1)):(i=Dm(e),i.c(),$e(i,1),i.m(t.parentNode,t)),e[5]&&!e[49]?o?(o.p(e,r),32&r[0]|262144&r[1]&&$e(o,1)):(o=km(e),o.c(),$e(o,1),o.m(n.parentNode,n)):o&&(ye(),Ie(o,1,1,()=>{o=null}),ve())},i(e){r||($e(i),$e(o),r=!0)},o(e){Ie(i),Ie(o),r=!1},d(e){i&&i.d(e),e&&k(t),o&&o.d(e),e&&k(n)}}}function Rm(e){let t,n;return t=new e[54]({props:{class:"close",disabled:e[49],form:e[61],filled:!0,type:"submit",$$slots:{default:[Mm]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};262144&n[1]&&(r.disabled=e[49]),4096&n[1]|4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Dm(e){let t,n;return t=new e[54]({props:{class:"close",disabled:e[49],form:e[61],filled:!0,type:"submit",$$slots:{default:[xm]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};262144&n[1]&&(r.disabled=e[49]),4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function xm(e){let t;return{c(){t=B("Speichern und schliessen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function km(e){let t,n;return t=new e[54]({props:{form:e[61],filled:!0,type:"submit",style:"opacity: 0.75;",$$slots:{default:[Om]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};4096&n[1]|4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Om(e){let t,n=(e[43]||"Speichern")+"";return{c(){t=B(n)},m(e,n){x(e,t,n)},p(e,r){4096&r[1]&&n!==(n=(e[43]||"Speichern")+"")&&H(t,n)},d(e){e&&k(t)}}}function Mm(e){let t,n=(e[43]||"Speichern")+"";return{c(){t=B(n)},m(e,n){x(e,t,n)},p(e,r){4096&r[1]&&n!==(n=(e[43]||"Speichern")+"")&&H(t,n)},d(e){e&&k(t)}}}function Pm(e){let t,n;return t=new e[54]({props:{disabled:e[49],danger:!0,outline:!0,$$slots:{default:[Bm]},$$scope:{ctx:e}}}),t.$on("click",e[92]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};262144&n[1]&&(r.disabled=e[49]),4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Bm(e){let t;return{c(){t=B("Löschen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Lm(e){let t,n,r,i,o;const s=[Vm,Fm],a=[];t=function(e){return e[70]?0:1}(e),n=a[t]=s[t](e);let l=e[40]&&Hm(e);return{c(){n.c(),r=L(),l&&l.c(),i=F()},m(e,n){a[t].m(e,n),x(e,r,n),l&&l.m(e,n),x(e,i,n),o=!0},p(e,t){n.p(e,t),e[40]?l?(l.p(e,t),512&t[1]&&$e(l,1)):(l=Hm(e),l.c(),$e(l,1),l.m(i.parentNode,i)):l&&(ye(),Ie(l,1,1,()=>{l=null}),ve())},i(e){o||($e(n),$e(l),o=!0)},o(e){Ie(n),Ie(l),o=!1},d(e){a[t].d(e),e&&k(r),l&&l.d(e),e&&k(i)}}}function Fm(e){let t,n;return t=new e[54]({props:{filled:!0,style:"opacity: 0.6;",$$slots:{default:[Um]},$$scope:{ctx:e}}}),t.$on("click",function(){b(e[82](e[1]))&&e[82](e[1]).apply(this,arguments)}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(n,r){e=n;const i={};4096&r[7]&&(i.$$scope={dirty:r,ctx:e}),t.$set(i)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Vm(e){let t,n;return t=new d({props:{text:e[70],extended:!0,$$slots:{default:[zm]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};2&n[0]|4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Um(e){let t,n,r;return n=new xt({props:{size:"18"}}),{c(){t=M("span"),t.textContent=`${e[91]()}`,Ne(n.$$.fragment),q(t,"margin-right",".75em")},m(e,i){x(e,t,i),Te(n,e,i),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n,e)}}}function Wm(e){let t,n,r;return n=new xt({props:{size:"18"}}),{c(){t=M("span"),t.textContent=`${e[91]()}`,Ne(n.$$.fragment),q(t,"margin-right",".75em")},m(e,i){x(e,t,i),Te(n,e,i),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n,e)}}}function zm(e){let t,n;return t=new e[54]({props:{filled:!0,style:"opacity: 0.6;",$$slots:{default:[Wm]},$$scope:{ctx:e}}}),t.$on("click",function(){b(e[82](e[1]))&&e[82](e[1]).apply(this,arguments)}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(n,r){e=n;const i={};4096&r[7]&&(i.$$scope={dirty:r,ctx:e}),t.$set(i)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Hm(e){let t,n;return t=new e[54]({props:{filled:!0,style:"opacity: 0.75;",$$slots:{default:[jm]},$$scope:{ctx:e}}}),t.$on("click",function(){b(e[83](e[1]))&&e[83](e[1]).apply(this,arguments)}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(n,r){e=n;const i={};4096&r[7]&&(i.$$scope={dirty:r,ctx:e}),t.$set(i)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function jm(e){let t,n,r;return n=new Mt({props:{size:"18"}}),{c(){t=M("span"),t.textContent="Daten",Ne(n.$$.fragment),q(t,"margin-right",".75em")},m(e,i){x(e,t,i),Te(n,e,i),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n,e)}}}function qm(e){let t,n,r;return n=new xt({props:{size:"18"}}),{c(){t=M("span"),t.textContent="Erstellen",Ne(n.$$.fragment),q(t,"margin-right",".75em")},m(e,i){x(e,t,i),Te(n,e,i),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n,e)}}}function Gm(e){let t,n;return t=new e[54]({props:{filled:!0,style:"opacity: 0.75;",$$slots:{default:[Xm]},$$scope:{ctx:e}}}),t.$on("click",e[85]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Xm(e){let t,n,r;return n=new Mt({props:{size:"18"}}),{c(){t=M("span"),t.textContent="Daten",Ne(n.$$.fragment),q(t,"margin-right",".75em")},m(e,i){x(e,t,i),Te(n,e,i),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n,e)}}}function Ym(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Zm(e){let t;return{c(){t=B("Abbrechen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Km(e){let t;return{c(){t=B("Ja, bitte löschen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Qm(e){let t,n,r,i,o,s,a,l,c,d;return a=new e[54]({props:{filled:!0,$$slots:{default:[Zm]},$$scope:{ctx:e}}}),a.$on("click",e[120]),c=new e[54]({props:{danger:!0,outline:!0,$$slots:{default:[Km]},$$scope:{ctx:e}}}),c.$on("click",e[95]),{c(){t=M("p"),n=B(e[11]),r=L(),i=M("p"),i.textContent="Das kann nicht rückgängig gemacht werden.",o=L(),s=M("div"),Ne(a.$$.fragment),l=L(),Ne(c.$$.fragment),z(s,"class","flex_div svelte-11r31hb")},m(e,u){x(e,t,u),D(t,n),x(e,r,u),x(e,i,u),x(e,o,u),x(e,s,u),Te(a,s,null),D(s,l),Te(c,s,null),d=!0},p(e,t){(!d||2048&t[0])&&H(n,e[11]);const r={};4096&t[7]&&(r.$$scope={dirty:t,ctx:e}),a.$set(r);const i={};4096&t[7]&&(i.$$scope={dirty:t,ctx:e}),c.$set(i)},i(e){d||($e(a.$$.fragment,e),$e(c.$$.fragment,e),d=!0)},o(e){Ie(a.$$.fragment,e),Ie(c.$$.fragment,e),d=!1},d(e){e&&k(t),e&&k(r),e&&k(i),e&&k(o),e&&k(s),Re(a),Re(c)}}}function Jm(e){let t,n,r;return n=new Le({props:{size:"25"}}),{c(){t=M("div"),Ne(n.$$.fragment),z(t,"slot","title-icon")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function ep(e){let t,n;return t=new e[52]({props:{title:"Bestätigung",closeCallback:e[218],danger:!0,$$slots:{"title-icon":[Jm],default:[Qm]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};2&n[7]&&(r.closeCallback=e[218]),2048&n[0]|4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function tp(e){let t,n,r;function i(t){e[123](t)}let o={$$slots:{default:[up,({closeCallback:e})=>({218:e}),({closeCallback:e})=>[0,0,0,0,0,0,0,e?2:0]]},$$scope:{ctx:e}};return void 0!==e[27]&&(o.open=e[27]),t=new e[51]({props:o}),re.push(()=>Se(t,"open",i)),{c(){Ne(t.$$.fragment)},m(e,n){Te(t,e,n),r=!0},p(e,r){const i={};1946157056&r[0]|3&r[1]|4098&r[7]&&(i.$$scope={dirty:r,ctx:e}),!n&&134217728&r[0]&&(n=!0,i.open=e[27],ue(()=>n=!1)),t.$set(i)},i(e){r||($e(t.$$.fragment,e),r=!0)},o(e){Ie(t.$$.fragment,e),r=!1},d(e){Re(t,e)}}}function np(e){let t,n,r,i,o,s=e[101](e[26].refItem,!0)+"";return{c(){t=M("tr"),n=M("th"),r=M("div"),i=B(s),o=B(" nicht gefunden!"),q(r,"color","red"),z(n,"colspan","2")},m(e,s){x(e,t,s),D(t,n),D(n,r),D(r,i),D(r,o)},p(e,t){67108864&t[0]&&s!==(s=e[101](e[26].refItem,!0)+"")&&H(i,s)},d(e){e&&k(t)}}}function rp(e){let t,n,r,i,o,s=e[101](e[26].refItem)+"";return{c(){t=M("tr"),n=M("th"),r=M("div"),i=B(s),o=B(" bereits eingefügt!"),q(r,"color","red"),z(n,"colspan","2")},m(e,s){x(e,t,s),D(t,n),D(n,r),D(r,i),D(r,o)},p(e,t){67108864&t[0]&&s!==(s=e[101](e[26].refItem)+"")&&H(i,s)},d(e){e&&k(t)}}}function ip(e){let t;let n=function(e){return"number"===e[219].type?sp:op}(e),r=n(e);return{c(){r.c(),t=F()},m(e,n){r.m(e,n),x(e,t,n)},p(e,t){r.p(e,t)},d(e){r.d(e),e&&k(t)}}}function op(e){let t;return{c(){t=M("input"),z(t,"id","reader_"+e[219].name),z(t,"type","text")},m(e,n){x(e,t,n)},p:_,d(e){e&&k(t)}}}function sp(e){let t;return{c(){t=M("input"),q(t,"width","4em"),z(t,"id","reader_"+e[219].name),z(t,"type","number"),z(t,"min","0")},m(e,n){x(e,t,n)},p:_,d(e){e&&k(t)}}}function ap(e){let t,n,r,i,o,s,a=e[101](e[219].name)+"",l=e[28]&&e[29]&&ip(e);return{c(){t=M("tr"),n=M("th"),r=B(a),i=L(),o=M("td"),l&&l.c(),s=L()},m(e,a){x(e,t,a),D(t,n),D(n,r),D(t,i),D(t,o),l&&l.m(o,null),D(t,s)},p(e,t){e[28]&&e[29]?l?l.p(e,t):(l=ip(e),l.c(),l.m(o,null)):l&&(l.d(1),l=null)},d(e){e&&k(t),l&&l.d()}}}function lp(e){let t;return{c(){t=B("Verwerfen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function cp(e){let t;return{c(){t=B("Speichern")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function dp(e){let t,n,r,i,o,s,a,l,c,d,u,f,h,m,p,g,w,y,v,$,I,_,C,E,A,b=e[101](e[26].refItem)+"";function S(t){e[122](t)}let N={keyboard:e[26].keyboard,codeTypes:e[26].codeTypes};function T(e,t){return e[32]?rp:e[28]&&!e[30]?np:void 0}void 0!==e[31]&&(N.readerInit=e[31]),t=new Kf({props:N}),re.push(()=>Se(t,"readerInit",S)),t.$on("scan",e[99]),t.$on("exit",e[104]);let R=T(e),P=R&&R(e),F=e[100](),V=[];for(let t=0;t<F.length;t+=1)V[t]=ap(em(e,F,t));return _=new e[54]({props:{disabled:!e[28],outline:!0,style:"float: left;",$$slots:{default:[lp]},$$scope:{ctx:e}}}),_.$on("click",e[102]),E=new e[54]({props:{disabled:!e[30],filled:!0,style:"float: right;",$$slots:{default:[cp]},$$scope:{ctx:e}}}),E.$on("click",e[103]),{c(){Ne(t.$$.fragment),r=L(),i=M("div"),o=M("table"),s=M("tr"),a=M("th"),a.textContent="Code",l=L(),c=M("td"),d=B(e[28]),u=L(),f=M("tr"),h=M("th"),m=B(b),p=L(),g=M("td"),w=M("div"),y=B(e[29]),v=L(),P&&P.c(),$=L();for(let e=0;e<V.length;e+=1)V[e].c();I=L(),Ne(_.$$.fragment),C=L(),Ne(E.$$.fragment),q(w,"max-width","14em"),q(o,"margin-top","1em"),q(o,"margin-bottom","1em"),q(o,"text-align","left"),q(i,"position","relative"),q(i,"z-index","1000"),q(i,"background-color","white"),q(i,"height","225px")},m(e,n){Te(t,e,n),x(e,r,n),x(e,i,n),D(i,o),D(o,s),D(s,a),D(s,l),D(s,c),D(c,d),D(o,u),D(o,f),D(f,h),D(h,m),D(f,p),D(f,g),D(g,w),D(w,y),D(o,v),P&&P.m(o,null),D(o,$);for(let e=0;e<V.length;e+=1)V[e].m(o,null);D(i,I),Te(_,i,null),D(i,C),Te(E,i,null),A=!0},p(e,r){const i={};if(67108864&r[0]&&(i.keyboard=e[26].keyboard),67108864&r[0]&&(i.codeTypes=e[26].codeTypes),!n&&1&r[1]&&(n=!0,i.readerInit=e[31],ue(()=>n=!1)),t.$set(i),(!A||268435456&r[0])&&H(d,e[28]),(!A||67108864&r[0])&&b!==(b=e[101](e[26].refItem)+"")&&H(m,b),(!A||536870912&r[0])&&H(y,e[29]),R===(R=T(e))&&P?P.p(e,r):(P&&P.d(1),P=R&&R(e),P&&(P.c(),P.m(o,$))),805306368&r[0]|384&r[3]){let t;for(F=e[100](),t=0;t<F.length;t+=1){const n=em(e,F,t);V[t]?V[t].p(n,r):(V[t]=ap(n),V[t].c(),V[t].m(o,null))}for(;t<V.length;t+=1)V[t].d(1);V.length=F.length}const s={};268435456&r[0]&&(s.disabled=!e[28]),4096&r[7]&&(s.$$scope={dirty:r,ctx:e}),_.$set(s);const a={};1073741824&r[0]&&(a.disabled=!e[30]),4096&r[7]&&(a.$$scope={dirty:r,ctx:e}),E.$set(a)},i(e){A||($e(t.$$.fragment,e),$e(_.$$.fragment,e),$e(E.$$.fragment,e),A=!0)},o(e){Ie(t.$$.fragment,e),Ie(_.$$.fragment,e),Ie(E.$$.fragment,e),A=!1},d(e){Re(t,e),e&&k(r),e&&k(i),P&&P.d(),O(V,e),Re(_),Re(E)}}}function up(e){let t,n;return t=new e[52]({props:{title:"Scannen",class:"reader",closeCallback:e[218],$$slots:{default:[dp]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};2&n[7]&&(r.closeCallback=e[218]),1946157056&n[0]|3&n[1]|4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function fp(e){let t;return{c(){t=B("Abbrechen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function hp(e){let t,n,r,i,o;return i=new e[54]({props:{filled:!0,$$slots:{default:[fp]},$$scope:{ctx:e}}}),i.$on("click",e[124]),{c(){t=M("progress"),n=L(),r=M("div"),Ne(i.$$.fragment),q(t,"width","100%"),z(t,"id","file"),z(t,"max","100"),t.value=e[46],z(r,"class","flex_div svelte-11r31hb")},m(e,s){x(e,t,s),x(e,n,s),x(e,r,s),Te(i,r,null),o=!0},p(e,n){(!o||32768&n[1])&&(t.value=e[46]);const r={};4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),i.$set(r)},i(e){o||($e(i.$$.fragment,e),o=!0)},o(e){Ie(i.$$.fragment,e),o=!1},d(e){e&&k(t),e&&k(n),e&&k(r),Re(i)}}}function mp(e){let t,n,r;return n=new Le({props:{size:"25"}}),{c(){t=M("div"),Ne(n.$$.fragment),z(t,"slot","title-icon")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function pp(e){let t,n;return t=new e[52]({props:{title:"Auswertung wird erstellt",closeCallback:e[218],$$slots:{"title-icon":[mp],default:[hp]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};2&n[7]&&(r.closeCallback=e[218]),32768&n[1]|4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function gp(e){let t,n;return{c(){t=M("p"),n=B(e[10])},m(e,r){x(e,t,r),D(t,n)},p(e,t){1024&t[0]&&H(n,e[10])},d(e){e&&k(t)}}}function wp(e){let t;return{c(){t=B("Schliessen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function yp(e){let t,n,r,i,o;return t=new e[57]({props:{outline:!0,$$slots:{default:[gp]},$$scope:{ctx:e}}}),i=new e[54]({props:{danger:!0,outline:!0,$$slots:{default:[wp]},$$scope:{ctx:e}}}),i.$on("click",e[126]),{c(){Ne(t.$$.fragment),n=L(),r=M("div"),Ne(i.$$.fragment),z(r,"class","flex_div svelte-11r31hb")},m(e,s){Te(t,e,s),x(e,n,s),x(e,r,s),Te(i,r,null),o=!0},p(e,n){const r={};1024&n[0]|4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r);const o={};4096&n[7]&&(o.$$scope={dirty:n,ctx:e}),i.$set(o)},i(e){o||($e(t.$$.fragment,e),$e(i.$$.fragment,e),o=!0)},o(e){Ie(t.$$.fragment,e),Ie(i.$$.fragment,e),o=!1},d(e){Re(t,e),e&&k(n),e&&k(r),Re(i)}}}function vp(e){let t,n,r;return n=new Le({props:{size:"25"}}),{c(){t=M("div"),Ne(n.$$.fragment),z(t,"slot","title-icon")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function $p(e){let t,n;return t=new e[52]({props:{title:"Speichern nicht erfolgreich",danger:!0,$$slots:{"title-icon":[vp],default:[yp]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};1536&n[0]|4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Ip(e){let t,n,r,i,o,s,a,l,c,d,u,f,h;Jh.title=t=e[50];let m={ctx:e,current:null,token:null,hasCatch:!1,pending:Ym,then:im,catch:rm,value:222,blocks:[,,,]};function p(t){e[121](t)}_e(e[72](),m);let g={$$slots:{default:[ep,({closeCallback:e})=>({218:e}),({closeCallback:e})=>[0,0,0,0,0,0,0,e?2:0]]},$$scope:{ctx:e}};void 0!==e[15]&&(g.open=e[15]),i=new e[51]({props:g}),re.push(()=>Se(i,"open",p));let w=e[26]&&e[27]&&tp(e);function y(t){e[125](t)}let v={$$slots:{default:[pp,({closeCallback:e})=>({218:e}),({closeCallback:e})=>[0,0,0,0,0,0,0,e?2:0]]},$$scope:{ctx:e}};function $(t){e[127](t)}void 0!==e[45]&&(v.open=e[45]),l=new e[51]({props:v}),re.push(()=>Se(l,"open",y));let I={$$slots:{default:[$p,({closeCallback:e})=>({218:e}),({closeCallback:e})=>[0,0,0,0,0,0,0,e?2:0]]},$$scope:{ctx:e}};return void 0!==e[9]&&(I.open=e[9]),u=new e[51]({props:I}),re.push(()=>Se(u,"open",$)),{c(){n=L(),m.block.c(),r=L(),Ne(i.$$.fragment),s=L(),w&&w.c(),a=L(),Ne(l.$$.fragment),d=L(),Ne(u.$$.fragment)},m(e,t){x(e,n,t),m.block.m(e,m.anchor=t),m.mount=()=>r.parentNode,m.anchor=r,x(e,r,t),Te(i,e,t),x(e,s,t),w&&w.m(e,t),x(e,a,t),Te(l,e,t),x(e,d,t),Te(u,e,t),h=!0},p(n,r){e=n,(!h||524288&r[1])&&t!==(t=e[50])&&(Jh.title=t),Ce(m,e,r);const s={};2048&r[0]|4098&r[7]&&(s.$$scope={dirty:r,ctx:e}),!o&&32768&r[0]&&(o=!0,s.open=e[15],ue(()=>o=!1)),i.$set(s),e[26]&&e[27]?w?(w.p(e,r),201326592&r[0]&&$e(w,1)):(w=tp(e),w.c(),$e(w,1),w.m(a.parentNode,a)):w&&(ye(),Ie(w,1,1,()=>{w=null}),ve());const d={};32768&r[1]|4098&r[7]&&(d.$$scope={dirty:r,ctx:e}),!c&&16384&r[1]&&(c=!0,d.open=e[45],ue(()=>c=!1)),l.$set(d);const p={};1536&r[0]|4096&r[7]&&(p.$$scope={dirty:r,ctx:e}),!f&&512&r[0]&&(f=!0,p.open=e[9],ue(()=>f=!1)),u.$set(p)},i(e){h||($e(m.block),$e(i.$$.fragment,e),$e(w),$e(l.$$.fragment,e),$e(u.$$.fragment,e),h=!0)},o(e){for(let e=0;e<3;e+=1){Ie(m.blocks[e])}Ie(i.$$.fragment,e),Ie(w),Ie(l.$$.fragment,e),Ie(u.$$.fragment,e),h=!1},d(e){e&&k(n),m.block.d(e),m.token=null,m=null,e&&k(r),Re(i,e),e&&k(s),w&&w.d(e),e&&k(a),Re(l,e),e&&k(d),Re(u,e)}}}let _p,Cp=new Map,Ep=new Map,Ap=new Map;const bp=(e,t)=>Cp.set(e,t),Sp=e=>Cp.get(e),Np=async(e,n)=>{if(e){const t="p$"+e+"$"+n,r=Cp.get(t);if(r?.length)return r}const r=n;return Cp.has(r)||(Cp.set(r,[]),Cp.set(r,t.getTasksList(n).then(({data:e})=>e))),Cp.get(r)},Tp=async(e,n,r,i=!1)=>{let o=Ep.get(r);if(!o)if(i)o=t.getTaskList(e,r),Ep.set(r,o);else{const i="p$"+e+"$"+n,s=await Cp.get(i);if(!s?.length)return Np(e,n).then(n=>(o=n.find(({_id:e})=>e===r),o||(o=t.getTaskList(e,r)),Ep.set(r,o),o));o=s.find(({_id:e})=>e===r),o||(o=t.getTaskList(e,r)),Ep.set(r,o)}return o},Rp=(e,t)=>{Ap.set(e,t)},Dp=e=>Ap.get(e),xp=(e,n,r=!1)=>{let i=!r&&Ap.get(n);return i||(i=t.getTask(e,n),Ap.set(n,i)),i},kp=(e,n)=>{if(!Cp.get(n))return;const r=n;Cp.set(r,t.getTasksList(n).then(({data:e})=>e))};let Op=!1;function Mp(e){let t="";if(function(e){return/^\d{4}-([0]\d|1[0-2])-([0-2]\d|3[01])/.test(e)}(e))return Pp(+e.replace("-",""));e=e.toUpperCase();for(let n=0;n<e.length;n++)t+=String.fromCharCode(90-(e.charCodeAt(n)-65));return t}function Pp(e){return 999999999999-e}function Bp(e){return new Promise(t=>setTimeout(t,e))}function Lp(e,s,l){let d,h,m,p,g,w,v,I;N(e,f,e=>l(147,g=e)),N(e,o,e=>l(148,w=e)),N(e,i,e=>l(149,v=e));const{Modal:_,Dialog:C,Divider:E,Button:A,FormField:b,Checkbox:S,Chip:T}=c,{loggedIn:D,currentTasks:x,environment:k}=u;N(e,D,e=>l(150,I=e)),N(e,x,e=>l(145,m=e)),N(e,k,e=>l(146,p=e)),JSON.parse(n.getItem("Locale"));const O=ee();let{schema:M}=s,{recID:P}=s,{deletable:B}=s,{prevEventID:L=!1}=s,{prev:F=!1}=s,{taskId:V=!1}=s,{taskOrg:U}=s,{description:W=""}=s,{root:z=!1}=s,{readonly:H}=s,{isStandalone:j}=s,{shortEdit:q=!1}=s,{shortSchema:G=!1}=s,{dialogAttr:X=!1}=s,Y=!0,Z=!1,K="",te="Willst du diese Daten löschen?",ne=window.location.href.split("/task/")[2];ne&&(ne=ne.split(":")[1],ne&&(ne=ne.split("?")[0])),q&&(M=G);let re,ie,oe,se,ae,le,de={},ue={},fe="form-"+M.class+Math.floor(9e3*Math.random()+1e3).toString(),he=!1,me=!1;const pe=z?"fEmbedded":"fTask",ge=z?"sEmbedded":"sTask";let we="CHF",ye="CHF";const ve=new Map;let $e,Ie,_e=0,Ce=0,Ee=0,Ae=0,be=1,Se=!P&&M.list&&1===M.list.length;const Ne={},Te={},Re=M.items.find(e=>"price"===e.name&&!e.properties?.hidden),De=M.items.find(e=>"quantity"===e.name&&!e.properties?.hidden),xe=M.items.find(e=>"amount"===e.name&&!e.properties?.hidden),ke=!!Re||!!xe,Oe=M.list?.filter(e=>"array"===e.type)?.length>1||M.items?.find(e=>e.name.startsWith("amount"))||ke,Me=M.items.find(e=>"number"===e.type&&"w"===e.properties?.unit?.constant?.toLowerCase()&&!e.properties?.hidden)?.name,Pe=!!Me,Be=M.list?.filter(e=>"array"===e.type)?.length>1||Pe,Le={},Fe=M.result?.resultDef[0].button?.description;let Ve,Ue,We,ze,He,je,qe,Ge,Xe,Ye,Ze,Ke,Qe,Je,et,tt="",nt="",rt="",it=!1,ot=!1,st=!1,at=!1,lt=!1,ct=0,dt=0,ut=[],ft=[],ht=[],mt={},pt=new Map,gt=M.class,wt=M.id,yt=!1,vt=!1,$t=-1!==window.location.search.indexOf("next="),It=0,_t=!1,Ct={};const Et=-1!==window.location.search.indexOf("back=true");["readonly","hidden","hidden2","required"].map(e=>{M.items.filter(t=>"object"==typeof(t.properties&&t.properties[e])).map(t=>{const n=t.properties[e].refItem||"",[r,i]=n.split(".");ut.push({action:e,itemName:t.name,refObj:r,refName:i,op:t.properties[e].invert?"!":"",empty:t.properties[e].empty})})});M.items.filter(e=>e.selection&&e.constraint).map(e=>{ft.push({name:e.name,selection:e.selection,constraint:e.constraint})});M.items.filter(e=>e.lookup).forEach(e=>{ht.push({name:e.name,lookup:e.lookup})}),M.items.filter(e=>e.properties?.lookup?.split).forEach(e=>{ht.push({name:e.name,lookup:e.properties.lookup.split(":").at(-1)})});const At=async e=>{if(e?.length)for(const n of e){if(!n.lookup)break;const{name:e}=n;if(de[e])break;const{domain:r,value:i}=n.lookup;if("user"===r&&i){const n=I.user,r={[i]:n},o=await t.getSectionView(e,r);if(o?.length){const[{_id:t}]=o;t&&l(12,de[e]=t,de)}}}},bt=async e=>{if(!M.input)return;if(!M.input.length)return;if(M.input.length<2)return;const n=!e.input.class[0].name&&e.input.class[0].selection;if(!n)return;const r=e.input.class[1].name,[i,o]=e.input.class[1].destination?.split(".");if(!r||!o)return;const s=M.list?.find(e=>e.name===i);if(!s)return;if(s.filter)return;const a=await t.getSchemaByClass(n),c=(await t.getTasks(a.id)).data;if(!c?.length)return;const d=[];for(const e of c)if(e.active??1){const t={};for(const n of s.item)n.name===o?t[n.name]=e._id:e[n.name]&&(t[n.name]=e[n.name]);d.push(t)}d.length&&l(12,de[i]=d,de)},St=async e=>{if(!M.input)return;if(!M.input.length)return;if(M.input.length>1)return;const t=je.input.class[0],{name:n,selection:r,state:i,list:o}=t;n||r&&i&&o&&await Nt(r,i,o)},Nt=async(e,n,r)=>{const i=(await t.getEvents()).filter(t=>t.output?.class?.at(0)?.name===e),o={[r]:[]};for(const s of i){let i={event:s._id,status:n};const a=await t.getSectionView("_task",i);if(a?.length){i={_id:{$in:a.map(e=>e.docId)}};const n=await t.getSectionView(e,i);for(const t of n){const n=M.list.find(e=>e.name===r);if(n){const i={[e]:t._id.toString()};for(const e of n.item)t[e.name]&&(i[e.name]=t[e.name]);o[r].push(i)}}}}setTimeout(()=>l(12,de={...de,...o}),100)},Tt=()=>{for(const e of M.items)"boolean"==typeof e.properties?.value&&l(12,de[e.name]=e.properties.value,de),"string"==typeof e.properties?.value&&l(12,de[e.name]=e.properties.value,de),e.properties?.value?.concatenation&&Dt(e);Rt()},Rt=async()=>{for(const e of M.list||[])if("array"===e.type||!de._id)for(const n of e.item)if(n.refItem&&"array"!==e.type)if("owner"===n.refItem){const r=p.owner;r||R(k,p.owner=r=await t.getSolitaire(n.refItem),p),p.owner||await t.getSolitaire(n.refItem),r&&(de[e.name]||l(12,de[e.name]={},de),l(12,de[e.name][n.name]=$(r,n.refPos||n.name),de))}else if(de[n.refItem]){const r=await t.getTask(n.refItem,de[n.refItem]);r&&(de[e.name]||l(12,de[e.name]={},de),l(12,de[e.name][n.name]=$(r,n.refPos||n.name),de))}},Dt=async e=>{const t=e.properties.value.concatenation;let n="";for(const e of t)void 0!==e.constant&&(n+=e.constant),"year"===e.variable&&(n+=(new Date).getFullYear()),e.refItemNext&&(n+=await kt(e.refItemNext));l(12,de[e.name]=n,de)},xt=async e=>{const t=ut.filter(t=>t.refObj===e||t.itemName===e);if(t?.length){l(35,mt={});for(const e of t){const{itemName:t,refObj:n,refName:r,op:i,empty:o}=e;let{action:s}=e;if(!n)break;let a,c,d=!r&&de[n];const u=de[n];if(u&&r&&(d=(await xp(n,u))[r]),Array.isArray(d)&&0===d.length&&(d=!1),"!"===i&&(d=!d),"hidden"===s&&(de._id&&o&&(d=!de[t]),a=`#${fe} .form-field.${t}`,c=document.querySelector(a),c?.classList?.toggle("hidden",!!d),c?.classList?.toggle("_hidden",!!d),de._id&&o||!d||l(35,mt[t]="",mt)),"hidden2"===s){if(a=`#${fe} .form-field.${t}`,c=document.querySelector(a),!c?.classList)continue;if(Array.from(c.classList).includes("_hidden"))continue;c?.classList?.toggle("hidden",!!d),d&&l(35,mt[t]="",mt)}"required"!==s&&"readonly"!==s||(s="required"===s?s:"disabled",setTimeout(()=>{a=`#${fe} .form-field.${t} .field textarea`,c=document.querySelector(a),c||(a=`#${fe} .form-field.${t} .field input#${t}`,c=document.querySelector(a)),c||(a=`#${fe} .form-field.${t} .field input`,c=document.querySelector(a)),c||(a=`#${fe} .form-field.${t} .field select`,c=document.querySelector(a)),c&&d&&c.setAttribute(s,""),c&&!d&&c.removeAttribute(s)},0))}}},kt=async e=>{const[n,r]=e.offset?.split(",")||[0,0],i=+e.base||0,o=+e.step||1;e.type;const s=e.refItem,a=await t.getLastId(M.class,s);if(!a?.length)return(i+o).toString().padStart(r,"0");let l=a[0][s];+l<i&&(l=i.toString());return((+l?.substring(n,n+r)||i)+o).toString().padStart(r,"0")},Ot=(e,t,n,r=!1)=>{const i=n||t.name,o=i.startsWith("_")?i:i.split("_")[0],s=e.find(e=>e.name===o);let a=t.value;if(!s)return a;if(r||"signature"!==s.type&&!s.properties?.multi||de[i]&&!a&&(a=de[i]),"dateRange"===s.type){if(null===a)return;let e=new Date(a);if("Invalid Date"==e)return;return e=`${e.getFullYear()}-${(e.getMonth()+1).toString().padStart(2,"0")}-${e.getDate().toString().padStart(2,"0")}T00:00:00.000Z`,new Date(e).toISOString()}if(a&&s.type.startsWith("date"))try{return Xr(a,"%d.%m.%Y").toISOString()}catch{return new Date(a).toISOString()}if("boolean"===s.type&&(a=!!t.checked),"number"===s.type){const e=s.properties?.decimals||0;try{a=Number(a.replace(",",".")).toFixed(e).toString()}catch{}}if(r&&"date"===s.type&&s.properties?.required&&!a&&de[i]){a=de[i];try{return Xr(a,"%d.%m.%Y").toISOString()}catch{return a}}return a};const Mt=async e=>{l(49,d=!0);const n=e.submitter?.className?.includes("close"),r={_docAsync:e?._docAsync};Array.from(document.querySelectorAll("form#"+fe+" ."+fe)).map(e=>{if(e.name)if(e.name.includes(".")){const t=e.name.split(".")[0],n=M.items.find(e=>e.name===t);if(n&&"object"===n.type&&n.properties?.multi)r[t]=(r[t]||[]).concat(e.value);else{const[t,n]=e.name.split("."),i=M.list.find(e=>e.name===t);r[e.name]=Ot(i.item,e)}}else r[e.name]=Ot(M.items,e);else if(e.id){const t=M.items.find(t=>t.name===e.id);"signature"===t.type&&(e.name=e.id,r[e.name]=Ot(M.items,e))}}),e.itemName&&(r[e.itemName]=e.value);let i=!1,o={},s=!1;if(M.list&&M.list.map(e=>{if(s||=!!e.sort,e.mandatory){const t=ue[e.name]?.filter(e=>!e._delete).length;if(!t||t<2)return void(i=!0)}if("array"!==e.type||!ue[e.name])return;e.item.forEach(t=>{for(const n of ue[e.name])void 0===n[t.name]&&(n[t.name]="boolean"!==t.type&&"")});let t=[...ue[e.name]].reduce((t,n)=>n._delete||!Object.values(n).some(Boolean)?t:t.concat(Object.entries(n).reduce((t,[n,r])=>("_delete"!==n&&(t[n]=Ot(e.item,{name:n,value:r,checked:r},"",!0)),t),{})),[]);if(e.sort){let n=[];for(const t in e.sort)n.push((-1===e.sort[t]?"!":"")+t);t=function(e,t,n,r){function i(e,t){let i="";for(let o of t){let t=!0;o.startsWith("!")&&(t=!1,o=o.slice(1));const[s,a]=o.split(".");let l="";if(a){let t=n?.findIndex(e=>e===s);if(t<0&&(t=n?.findIndex(e=>e===o)),t>=0){const n=r[e._index].split(" • ")[t];n&&(l=n.split(" · ")[a]||n||"")}}else l=$(e,o);switch(typeof l){case"boolean":t||(l=!l),i+=String(+l);break;case"string":i+=t?l.padEnd(30):Mp(l).padEnd(30);break;case"number":i+=t?String(l).padStart(12,"0"):String(Pp(l)).padStart(12,"0");break;case"object":Array.isArray(l)&&(i+=t?[].concat(l).join("").padEnd(30):[].concat(Mp(l)).join("").padEnd(30))}}return i}let o=e.map((e,t)=>(e._index=t,e));return o=o.sort((e,n)=>i(e,t).localeCompare(i(n,t))),o.map(e=>(delete e._index,e))}(t,n,e.display?.refItem,Ct[e.name])}r[e.name]=t,e.item.forEach(t=>{for(const n of r[e.name])if(t.properties?.setBy){const e=r[t.properties.setBy];e&&(n[t.name]=e)}}),e.sort&&(o[e.name]=r[e.name])}),i)return a.failed("Bitte Positionen erfassen",3e3),void l(49,d=!1);if(r._event=wt,r._prevEventId=L,r._taskId=V,se){const e=se.record;for(const t in e)t.includes(".")&&delete e[t];e._event=se.event,e._taskId=se.taskId;const{id:n}=await t.saveData(se.class,e);r[se.class]||(r[se.class]=n)}if(q)return Pt(M.class,r),l(49,d=!1),Lt();s&&l(47,_t=o);const{id:c,task:u,tax:f,error:h,state:m,info:p}=await t.saveData(M.class,r);if(h?.text){const e=h.field?" in "+h.field+": "+h.value:"";if(l(10,K=`${h.text} ${e}`),l(9,Z=!0),!m)return void l(49,d=!1)}if(Je){const e=new FormData;e.append("title",Je.fileName),e.append("file",Je.file),await t.uploadUserReport(u,e)}p&&!Array.isArray(p)&&p.accepted?p.accepted?.length?a.success(`Email versandt an ${p.accepted.join(", ")}, Dateigrösse: ${p.messageSize} Bytes.`,5e3):(l(10,K="Email konnte nicht versandt werden!"),l(9,Z=!0)):a.success("Die Daten wurden gespeichert.",2e3),l(49,d=!1),l(21,Ce=f?._amount||0),l(22,Ee=100*(f?._rate||0)||""),Ht(),r._id=c;const g=await t.getTaskList(M.class,c);if(O("choose",{row:g}),n)return l(49,d=!1),Lt();if(!P){if($t){const e=Math.floor(9e3*Math.random()+1e3).toString();return window.singleSpaNavigate(`/task/${wt}/${wt}/task?next=${e}`)}return window.singleSpaNavigate(`/task/${wt}/${u}/task`)}},Pt=async(e,n)=>{if(!q.lookup)return;const r={};for(const e in n){const t=n[e];Array.isArray(t)||q.lookup.includes(e)&&(r[e]=n[e])}const i=await t.getSectionView(M.class,r);if(!i?.length)return void await t.saveData(e,n);let o,s;for(const r of i.toReversed()){if(!(await t.getTaskByDocId(r._id,!0)).status.startsWith("WaitingForApproval"))continue;s=r;const i=r[q.ref];for(let s=0;s<i.length;s++){o=!0;const a=i[s];for(const e in a)if(q.lookup.includes(e)&&a[e]!=n[q.ref][0][e]){o=!1;break}if(o)return i[s]=n[q.ref][0],r._event=n._event,r._prevEventId=n._prevEventId,r._taskId=n._taskId,void await t.saveData(e,r)}}if(s){const r=s;r[q.ref].push(n[q.ref][0]),r._event=n._event,r._prevEventId=n._prevEventId,r._taskId=n._taskId,await t.saveData(e,r)}else await t.saveData(e,n)},Bt=()=>q||oe||j||X||!L?Lt():window.history.back(),Lt=()=>Et?O("back"):j?window.close():z?window.singleSpaNavigate("/"):O("back"),Ft=async(e,t,n,r,i)=>{const o=await xp(e,t);if(o){for(const r of o[n])r[e]=t;return i=i.concat(o[n])}},Vt=async({detail:e})=>{Array.isArray(e.value)&&ve.set(e.name,e.value);const n=je.input?.class?.at(0);if(!n)return;const{selection:r}=n;if(2===je.input.class?.length){const t=je.input.class[1],{name:n,refStatus:i,source:o,destination:s}=t;if(o){if(de._id)return;if(r&&Array.isArray(e.value)){let t=[];for(const r of e.value)t=await Ft(n,r,o,0,t);return void l(12,de[s]=t,de)}}}if(!(M.input?.length&&M.input.length>1))return;if(re?.class!==M.input[0]&&!ne)return;let i,{value:o,lookup:s,name:a,view:c}=e;if(!s&&!ne)return;if(s&&(i=s.split(":")[0]),c||(i=a,c="_id"),ne){if(i=M.input[1],!ve?.size||!ve.get(e.name)?.length)return void l(12,de[i]=[],de);c=a,o=[ne]}const d=await t.getSectionView(i,{[c]:{$in:o}}),u=d.map(e=>e._id);for(const e of M.input.slice(1)){l(12,de[e]=[],de);const n=await t.getSchemaByClass(e);n.id;let r=(await t.getTasksListStatus(n.id,"Ready")).data;if(r=r.filter(e=>"Ready"===e._task?.status&&(u.includes(e[i])||u.includes(e._id))),r?.length){const{filter:n}=je.input.class.find(t=>t.name===e),{refItem:o,value:s}=n||{},a=[];if(r.forEach(e=>{if(n){const t=d.find(t=>t._id===e[i]);t&&t[o]===s&&a.push(e._id)}else a.push(e._id)}),a.length){const n=await t.getSectionView(e,{_id:{$in:a}});for(const t of n)t[e]=t._id;l(12,de[e]=n,de)}}}},Ut=async(e,n,r)=>{if(1===je.input?.class?.length){const t=je.input.class[0],{name:r,selection:i,state:o,list:s,exclude:a}=t;e===r&&i&&o&&s&&await Wt(e,n,i,o,s,a)}const i=je.output.class[0].item.find(e=>e.properties?.multi?.lookup);if(P||n||i?.properties.multi.lookup!==e||Vt({detail:{value:[]}}),M.input&&M.input.length>1&&!ne){if(M.input[0]!==e)return;const{name:i,source:o,destination:s,selection:a}=je.input.class[1];if(a&&o&&s){const t=await xp(e,n);if(!t)return void l(12,de[s]=[],de);const r=await xp(a,t[a]);if(!r)return;const i=r[o]||[];return void l(12,de[s]=i,de)}const{recursive:c}=je.input.class[1];if(n){let i=await t.getTaskOptions(`${e}:${n}`,wt,c);if(r){const e=s.split(".")[1],t=[];i[e].forEach(n=>{de[e]?.find(t=>t[e]===n[e])||t.push(n)}),i={[e]:de[e]?[...de[e],...t]:[...t]}}l(12,de={...de,...i})}else{const e=M.input.slice(1);for(const t of e)l(12,de[t]=[],de)}}for(const t of je.output.class[0].item)if("date"===t.type&&t.properties?.value?.formula?Jt(t.name):void 0!==t.factor?l(12,de[t.name]=de[t.name]*t.factor,de):t.properties?.value?.formula&&await Jt(t.name),!n){const n=t.refItem||t.lookup?.refItem;n&&n.startsWith(e)&&l(12,de[t.name]="",de)}if((async()=>{const e=M.items.find(e=>"textarea"===e.properties?.format&&e.properties?.source);if(e&&!de[e.name]){const t=new Set;let n="";for(const r of e.properties.source){const[e,i,o]=r.split("."),s=de[e];for(const r of s||[]){const s=r[i];if(s&&!t.has(s)){t.add(s);const r=M.list?.find(t=>t.name===e),a=r?.item.find(e=>e.name===i);if(a?.refClass){const e=await xp(a.refClass,s);e&&e[o]&&(n+=e[o])}}if(n)break}if(n)break}n&&l(12,de[e.name]=n,de)}})(),M.list?.length){let e=Ge;for(const t of M.list)"array"===t.type&&t.mandatory&&de[t.name]&&!de[t.name].length&&(e=!1);l(42,Xe=e)}},Wt=async(e,t,n,r,i,o)=>{n=[].concat(n);for(const s of n)await zt(e,t,s,r,i,o)},zt=async(e,n,r,i,o,s)=>{let[a,c]=r.split(".");c||(c=r,a=""),o=[].concat(o);const d=a?(await t.getEvents()).filter(e=>e.output?.class?.at(0)?.name===c):(await t.getEvents()).filter(e=>e.output?.class?.at(0)?.name===c&&je.output?.class?.at(0)?.list?.find(t=>t.name===e.identity.name)),u={};for(const r of d)if(u[r.identity.name]=[],n){let l={event:r._id,status:i};const d=await t.getSectionView("_task",l);if(d?.length){const i=[];l={_id:{$in:d.map(e=>e.docId)},[e]:n};const f=await t.getSectionView(c,l);for(const e of f)for(const n of o)if(n.startsWith("$")){const t=n.slice(1),r=[];for(const n of e[t]||[]){const t={...n,[c]:e._id};for(const e in t)!t.quantity&&e.startsWith("quantity")&&(t.quantity=t[e]);t.quantity&&r.push(t)}let i=u[t]||[];i=i.concat(r),u[t]=i}else if(a){let r=!0;if(s){const i=await t.getSectionView(M.class,{[n+"."+c]:e._id});r=!i?.length}const o={[c]:e._id.toString()};r&&i.push(o)}else for(const t of e[n]||[]){const n={...t,[c]:e._id};for(const e in n)!n.quantity&&e.startsWith("quantity")&&(n.quantity=n[e]);n.quantity&&i.push(n)}a?u[o[0]]=i.length?i:[]:u[r.identity.name]=i.length?i:[]}}else a&&(u[o[0]]=[]);setTimeout(()=>l(12,de={...de,...u}),100)},Ht=()=>{let e=0;if(Re){let t=1;De&&(t=be),e=Ae*t}xe&&(e=Ae);let t=0;for(const e in Ne)t+=Ne[e];let n=0;for(const e of M.items)e.name.startsWith("amount")&&(n+=+de[e.name]);l(20,_e=t+e),de.discount>0&&l(20,_e-=_e*de.discount*.01),l(20,_e+=n)},jt=()=>{let e=0;for(const t in Le)e+=Le[t];l(34,ct=e+ +dt)},qt=({detail:e})=>{if(ue[e.listName]=e.value,Oe&&void 0!==e.amountValue){const t=Qe.find(t=>t.name===e.listName);if(!1!==t?.includeInTotal){let n=e.amountValue;Te[e.listName]=n,t.foreignCurrency&&de.currencyRate&&(n*=de.currencyRate),Ne[e.listName]=n,Ht()}}Be&&void 0!==e.weeksValue&&(Le[e.listName]=e.weeksValue||0,jt()),e.addToRecord&&l(14,ae=e),e.listInput&&l(14,ae={listName:e.listName,value:e.value})};r.subscribe(async e=>{if(!e)return;if(!P)return;const n=await t.getSchema(e.eventId);if(!n)return;const r=M.list?.find(e=>e.name===n.class);if(!r)return;const i=await t.getTaskById(e.taskId);((e,t,n)=>{if(!Cp.get(e))return;const r=t;Ep.set(r,n)})(i.event,i.docId,i.data);const o=await t.getTask(n.class,i.docId),s=de[n.class].filter(e=>e[n.class]==o._id);s?.length&&s.map(e=>{e[n.class]=i.docId}),l(12,de),l(112,ie),l(111,re),l(0,M)}),Q(async()=>{if(Cp=new Map,Ep=new Map,Ap=new Map,await Xt(),!q){if(!P){const t=document.getElementById(fe);if(!t)return;for(var e=0;e<t.length;e++)if(null!=!t[e].readonly&&"hidden"!=t[e].type&&1!=t[e].disabled&&"none"!=t[e].style.display)return void t[e].focus()}return}const n={...de};let r=n[q.ref][0];for(const e in r)r[e]||(r[e]=q.value[e]);const i={};for(const e in n){const t=n[e];if(Array.isArray(t))for(const e in r){const t=r[e];q.lookup.includes(e)&&(i[q.ref+"."+e]=t)}else q.lookup.includes(e)&&(i[e]=t)}if(q.lookup.includes("date")){const e=new Date,t=new Date(e.getFullYear(),e.getMonth(),e.getDate()).toISOString(),n=new Date(e.getFullYear(),e.getMonth(),e.getDate()+1).toISOString();i.date=t,i.date={$gte:t,$lt:n}}const o=await t.getSectionView(M.class,i);let s=!1;for(const e of o){if((await t.getTaskByDocId(e._id,!0)).status.startsWith("WaitingForApproval")){if(s)break;for(const t of e[q.ref]){let e=!0;for(const n in t)if(q.lookup.includes(n)&&t[n]!=r[n]){e=!1;break}if(e){for(const e in t)q.lookup.includes(e)||(r[e]=t[e]);s=!0;break}}}}l(12,de[q.ref][0]=r,de);const a=(q.focus||q.fill.at(-1))+"-0",c=document.getElementById(a);c&&c.focus()});const Gt=async()=>{Ve&&(Ue||(Ue=await t.getEvent(wt)),l(41,$t=!0),Ve.autostart&&sn())},Xt=async()=>{const e=e=>new Promise(t=>setTimeout(t,e));let t,n=0;for(;!(t=document.getElementById(fe)&&!at&&!lt)&&++n<20;)await e(50);t||(t=document.getElementById(fe)),t&&(()=>{const e=new Set;for(const t of ut)if(P){const n=M.items.find(e=>e.name===t.itemName);n?.properties?.enum&&e.add(t.refObj||gt)}else e.add(t.refObj||gt);Array.from(e).forEach(e=>xt(e))})(),Yt()},Yt=()=>{setTimeout(()=>{Array.from(pt).forEach(([e,t])=>{de[e]||l(12,de[e]=t._id,de)})},350)};J(()=>{P&&R(f,g={[P]:{record:de,lists:ue}},g)});const Zt=()=>{const e={};Array.from(document.querySelectorAll("form#"+fe+" ."+fe)).map(t=>{if(t.name){const n=M.items.find(e=>e.name===t.name.split(".")[0]);if(n&&"object"===n.type&&n.properties?.multi){const n=t.name.split(".")[0];e[n]=(e[n]||[]).concat(t.value)}else if(t.name.includes(".")){const[n,r]=t.name.split("."),i=M.list.find(e=>e.name===n);e[t.name]=Ot(i.item,t)}else e[t.name]=Ot(M.items,t,t.name.split("_")[0])}}),M.list&&M.list.map(t=>{"array"===t.type&&ue[t.name]&&(e[t.name]=ue[t.name].reduce((e,n)=>n._delete||!Object.values(n).some(Boolean)?e:e.concat(Object.entries(n).reduce((e,[n,r])=>("_delete"!==n&&(e[n]=Ot(t.item,{name:n,value:r,checked:r},"",!0)),e),{})),[]))});let t=!0;Object.entries(e).map(([e,n])=>{e=e.split("_")[0];const r=M.items.find(t=>t.name===e);r?.properties?.required&&!n&&(t=!1)});const n=M.items.filter(e=>e.properties?.multi&&e.properties?.required);for(const r of n)e[r.name]||(t=!1);return t&&e},Kt=async e=>{let n;for(l(46,It=0),rn();!n&&et;){l(46,It++,It);const r=await t.progressReport(e);if(n=r?.progressValue,It>300)break;await Bp(1e3)}if(on(),n){const t="/api/report/list/"+e;window.open(t,"_self","width=1 height=1")}},Qt=(e,t)=>(t||=0,"number"==typeof e&&e||(e=Number(e||0)),(+(Math.round(e+"e+"+t)+"e-"+t)).toString()),Jt=async e=>{if(!e)return;if(d)return;const t=M.items.find(t=>t.name===e),n=t.properties.value?.formula;if(!n)return;const{operator:r,argument:i,filter:o}=n;if(o&&de[o])return void l(12,de[e]=0,de);const s=i.map(e=>de[e.refItem]);let a="number"===t.type?0:"";if("$concat"===r){if(de._id&&void 0!==de[e])return;return a=s.reduce((e,t)=>e+(t||"")),void(a&&l(12,de[e]=a,de))}if("$preferred"===r){if(de._id&&void 0!==de[e])return;a=s.reduce((e,n)=>{let r=e;return"number"===t.type?r=+r||+n:r||=n,r})}if("$add"===r){if("date"===t.type)return void l(12,de[e]=await en(r,i),de);a=s.reduce((e,t)=>+(e||0)+ +(t||0))}if("$subtract"===r&&(a=s.reduce((e,t)=>{e||(e=""),t||(t="");const[n,r]=e.toString().split(":");e=r?(+n+ +r/60).toFixed(2):+(n||0);let[i,o]=t.toString().split(":");return i||(i=0),e-=o?(+i+ +o/60).toFixed(2):+(i||0)})),"$multiply"===r&&(a=s.reduce((e,t)=>+(e||0)*+(t||0))),"$percentMultiply"===r){const[e,t]=s;if(!+e)return;a=+e,+t>0&&(a*=1-t/100)}if("$percentDivide"===r){const[e,t]=s;if(!+e||!+t)return;a=+e/+t*100}"$multiply"===r?l(12,de[e]=a?Qt(a,t.properties?.decimals):"",de):"$preferred"===r&&"number"!==t.type?l(12,de[e]=a,de):l(12,de[e]=Qt(a,t.properties?.decimals),de)},en=async(e,n)=>{const[r,i]=n.map(e=>e.refItem||e.value);let o,s;"string"==typeof i&&([o,...s]=i.split("."),0===s.length?(s=o,o=""):s=s.join("."));const a=tn(de[r])||Date.now();let l=s?0:i;if(o){if("owner"===o)p.owner||R(k,p.owner=await t.getSolitaire("owner"),p),l=$(p.owner,s);else if(de[o]){const e=await xp(o,de[o]);e&&(l=$(e,s))}}else l=l||de[s];return c=l||0,(d=new Date(a)).setDate(d.getDate()+Number(c)),d;var c,d},tn=e=>{if(!e)return;let t,n,r;e.includes("T")?([t,n,r]=e.split("-"),r=r.split("T")[0]):[r,n,t]=e.split(".");return new Date(+t,+n-1,+r).toISOString()},nn=()=>{l(15,he=!1)},rn=()=>{l(45,et=!0)},on=()=>{l(45,et=!1)},sn=()=>{l(32,ot=!1),l(29,nt=""),l(28,tt=""),l(30,rt=""),l(27,We=!0)},an=()=>{l(28,tt=""),l(29,nt=""),l(30,rt=""),l(32,ot=!1),l(31,it=!0),ln()},ln=()=>{if(!Ve.keyboard)return;const e=document.getElementById("reader_focusId");e&&e.focus()};return e.$$set=e=>{"schema"in e&&l(0,M=e.schema),"recID"in e&&l(2,P=e.recID),"deletable"in e&&l(3,B=e.deletable),"prevEventID"in e&&l(107,L=e.prevEventID),"prev"in e&&l(4,F=e.prev),"taskId"in e&&l(1,V=e.taskId),"taskOrg"in e&&l(108,U=e.taskOrg),"description"in e&&l(105,W=e.description),"root"in e&&l(5,z=e.root),"readonly"in e&&l(106,H=e.readonly),"isStandalone"in e&&l(109,j=e.isStandalone),"shortEdit"in e&&l(6,q=e.shortEdit),"shortSchema"in e&&l(110,G=e.shortSchema),"dialogAttr"in e&&l(7,X=e.dialogAttr)},e.$$.update=()=>{8192&e.$$.dirty[3]&&l(49,d=H),1&e.$$.dirty[0]|786432&e.$$.dirty[3]&&ie&&re&&(M.items.map(({name:e,type:t,refItem:n,properties:r})=>{if(!1===n)return;const i=re.items.find(t=>t.name===e);if(!i)return;if(t!==i.type)return;if(re.class!==n&&r?.readonly)return;const o="_"+e;ie[e]?l(12,de[e]=ie[e],de):n&&n.startsWith("owner")||r&&r.readonly||l(12,de[e]="",de),ie[o]&&l(12,de[o]=ie[o],de),l(25,Se=!1)}),(()=>{for(const e of M.list||[]){if(e.source)continue;if(e.add)continue;const t=[],n=de[e.name];if(n?.length){for(const r of n){const n=r;for(const t of e.item)if(!1===t.refItem)n[t.name]="boolean"!==t.type&&"";else if(t.refItem)if("date"!==t.type||de[t.refItem])n[t.name]=de[t.refItem];else{const e=new Date,r=new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0);n[t.name]=r}t.push(n)}l(12,de[e.name]=t,de)}}})()),32&e.$$.dirty[0]|4096&e.$$.dirty[3]&&l(50,h=z?W||"enablerr - Form":document.title)},[M,V,P,B,F,z,q,X,Y,Z,K,te,de,oe,ae,he,me,le,we,ye,_e,Ce,Ee,$e,Ie,Se,Ve,We,tt,nt,rt,it,ot,at,ct,mt,ze,He,yt,vt,qe,$t,Xe,Ye,Ze,et,It,_t,Ct,d,h,_,C,E,A,b,S,T,D,x,k,fe,pe,ge,{name:"amountValue",properties:{decimals:2}},{name:"taxValue",properties:{decimals:2}},ve,Oe,Be,{name:"weekValue",properties:{decimals:1}},Fe,wt,async()=>{if(l(42,Xe=Ge=await(async e=>!m.length||(!!m.find(t=>t===e)||!(await t.getEvents()).find(t=>t._id==e)))(wt)),_p={},l(37,He=[]),X){const e=new Map;for(const t in X){let[n,r]=t.split(".");if(r||(r=n,n=!1),n){const i=e.get(n)||{};i[r]=X[t],e.set(n,i)}else l(12,de[r]=X[t],de)}for(const t of e.keys())de[t]||l(12,de[t]=[],de),l(12,de[t][0]=e.get(t),de)}if(p.owner||R(k,p.owner=await t.getSolitaire("owner"),p),p.currency?l(18,we=l(19,ye=p.currency.designation)):t.getSectionView("owner",{}).then(e=>{e?.length&&e[0].currency&&xp("currency",e[0].currency).then(e=>{e&&l(18,we=l(19,ye=e.designation))}).catch(e=>console.log("currency not found"))}),je=await t.getEvent(wt),Ke=je.output.class[0].noSave,Qe=je.output.class[0].list,je.output.class[0].textDelete&&l(11,te=je.output.class[0].textDelete),l(42,Xe=Xe&&!Ke),q&&l(12,de[q.ref]=[{...q.value}],de),!P){if(l(36,ze=He),At(je.input?.class).then(()=>{lt=!0}),Tt(),bt(je),St(),ne){const e=je.input.class[0].selection;de[e]||(l(12,de[e]=[ne],de),Vt({detail:{value:[ne],name:e}}))}await(async()=>{if(!d&&(Ue||(Ue=await t.getEvent(wt)),l(26,Ve=Ue.output.class[0].reader),Ve&&!Ve.keyboard))try{const e=await getCameras();e?.length||l(26,Ve=!1)}catch{}})(),Gt()}if(P){if(g&&g[P]){const e=g[P],t=e.record;M.items.map(e=>{t[e.name]=Ot(M.items,{name:e.name,value:t[e.name],checked:t[e.name]})}),l(12,de=t),M.list&&M.list.map(t=>{"array"===t.type&&e.lists[t.name]&&l(12,de[t.name]=e.lists[t.name].reduce((e,n)=>n._delete||!Object.values(n).some(Boolean)?e:e.concat(Object.entries(n).reduce((e,[n,r])=>("_delete"!==n&&(e[n]=Ot(t.item,{name:n,value:r,checked:r},"",!0)),e),{})),[]),de)})}else l(12,de=await t.getTask(M.class,P));if(de.currency){const e=await xp("currency",de.currency);e&&(l(19,ye=we),l(18,we=e.designation))}if(l(105,W=y(M,de)),l(39,vt=!!M.result?.resultDef),l(38,yt=!!M.result?.resultDef&&!M.result.resultDef[0].createAfterSave),l(21,Ce=de._tax?._amount),l(22,Ee=100*de._tax?._rate||""),l(44,Ze=M.list?.find(e=>e.mandatory)&&je.input?.class?.length>1),Ze){(U||await t.getTaskByDocId(P,!0)).visum&&l(44,Ze=!1)}l(14,ae={itemName:M.class,value:P})}if(L){let e;l(106,H=!1),l(111,re=await t.getSchema(L)),"string"==typeof F&&(e=await t.getTask(re.class,F));const n=M.items.find(e=>e.refClass===re.class);n&&e?l(12,de[n.name]=e._id,de):l(112,ie=e)}if(Be&&(dt=de[Me]||0),je.trigger?.startOn&&!je.trigger.startOn.some(e=>e.type.indexOf("Manual")>=0)&&l(106,H=!0),w.role?.length&&M.authorization?.length){const e=M.authorization.some(e=>v?.find(t=>t===e.role&&"edit"===e.activity));l(106,H||=!e)}if(l(13,oe="report"===je.output.type),l(8,Y=!1!==je.output.class?.at(0)?.documentTotal),l(43,Ye=je.output.saveButton),p.userSetting){const e=p.userSetting;if(l(40,qe=e.isAdmin),!qe){const e=I.tenants.find(e=>e._id===I.tenant);e&&l(40,qe=e.admin?.find(e=>e===I.user))}}else t.getUserSettings().then(e=>{if(l(40,qe=e.isAdmin),!qe){const e=I.tenants.find(e=>e._id===I.tenant);e&&l(40,qe=e.admin?.find(e=>e===I.user))}});return l(33,at=!0),!0},Mt,Bt,async({detail:e})=>{const{row:n}=e;let{eventId:r}=e;if((()=>{if(P)for(const e of ut)e.refName||xt(e.itemName)})(),await(async(e,t)=>{if(!e&&!t)return;let n,r=!1;const i={...de};for(const o of M.items){if("string"==typeof o.refItem&&(!e||o.properties?.linkOnly)){const[e,s]=o.refItem.split(".");if(o.refSelection){const{name:e,list:t,attr:s,ref:a}=o.refSelection;if(n=de[e]&&await xp(e,de[e]),n&&n[t]&&(n[t][a]||n[t].length)){let e=n[t][a];e=e?n[t]:n[t].find(e=>e[s]==de[s]),e&&(i[o.name]=e[a],r=!0)}}else if("owner"===e)o.refItem.split(".").length<3&&(i[o.name]=p.owner[s||o.refClass],r=!0);else if(o.refInput?.includes("|")&&de[e]){const[t,s]=o.refInput.split("|");n=await xp(e,de[e]),i[o.name]=n[t]||n[s]||"",r=!0}else if(de[e]){if((t._id===de[e]||o.refItemAlt)&&(n=await xp(e,de[e]),n)){let e;24===n[s]?.toString().length?(n=await xp(s,n[s]),n&&(e=n[o.name]||n[o.refInput])):s?(e=null!==n[s]&&void 0!==n[s]&&(n[s][o.name]||n[s]),o.refInput&&(e=e[o.refInput]),"object"==typeof e&&(e=void 0)):"dateRange"===o.type?(i[o.name+"_from"]=n[o.name+"_from"],_p[o.name+"_from"]=n[o.name+"_from"],i[o.name+"_to"]=n[o.name+"_to"],_p[o.name+"_to"]=n[o.name+"_to"],r=!0):e=n[o.name],void 0!==e&&(i[o.name]=e,r=!0,_p[o.name]=e)}}else s&&(i[o.name]="",r=!0)}if(!i[o.name]&&"string"==typeof o.refItemAlt&&(!e||o.properties?.linkOnly)){const[e,s]=o.refItemAlt.split(".");if((de[e]||t[e])&&(n=await xp(e,de[e]||t[e]),n)){let e;24===n[s]?.toString().length?(n=await xp(s,n[s]),n&&(e=n[o.name||o.refInput])):e=s?n[s][o.name]||n[s]:n[o.name],void 0!==e&&(i[o.name]=e,r=!0)}}}for(const t of M.list||[])if((!e||t.properties?.linkOnly)&&t.refItem&&de[t.refItem]&&(n=await xp(t.refItem,de[t.refItem]),n&&n[t.name])){const e=[];for(const i of n[t.name]){const n={};for(const e of t.item)i[e.name]&&(n[e.name]=i[e.name]);e.push(n),r=!0}i[t.name]=e}if(r){for(const e in _p)i[e]=_p[e];l(12,de=i)}})(!!P,n),P)return;if(r||=n._task?.event,r&&(await(async(e,n)=>{if(!e)return;const r=(await t.getEvent(e)).output.class[0].name,i=ht.filter(e=>e.lookup===r);if(i?.length)for(const e of i){const{lookup:t,name:r}=e;let i="";if(n){let e=await xp(t,n);e&&e[r]?.length&&(i=e[r][0][r])}i&&l(12,de[r]=i,de)}})(r,n._id),M.items.filter(e=>e.properties?.lookup).forEach(async e=>{const n=await t.getEvent(r);n.output.class[0]?.name===e.properties.lookup&&l(12,de[e.name]="",de)})),!n._task)return;const i=n._task.event,o=await t.getEvent(i);for(const e of je.output.class[0].item)"date"===e.type?e.properties?.value?.formula&&Jt(e.name):("$preferred"===e.properties?.value?.formula?.operator||"$concat"===e.properties?.value?.formula?.operator)&&Jt(e.name);if(!je.output?.class?.length)return;const s=je.output.class[0]?.item.find(e=>(e.refClass||e.name)===o.output.class[0]?.name);if(je.input?.class?.length&&je.input.class[0].name===o.output.class[0]?.name||s?.asInput){l(111,re=await t.getSchema(i)),l(107,L=i),l(1,V=n._task._id),V&&(n._task.docId||n.localId)?l(112,ie=await t.getTask(re.class,n._task.docId||n._id)):l(112,ie={});for(const e of M.list)"array"!==e.type&&ie[e.name]&&(l(16,me=!1),l(12,de[e.name]=ie[e.name],de),l(16,me=!0));re.class&&await Ut(re.class,n?._task?.docId||n?._task?._id)}},async({detail:e})=>{if(q)return;const{oldValue:t,value:n,itemName:r}=e;if("currencyRate"===r&&Oe){for(const e of Qe)if(!1!==e?.includeInTotal){let t=Te[e.name];e.foreignCurrency&&de.currencyRate&&(t*=de.currencyRate),Ne[e.name]=t}return void Ht()}const i=M.items.find(e=>e.properties?.value?.formula?.argument?.find(e=>e.refItem===r));if("$concat"===i?.properties.value.formula.operator&&t!==n&&Jt(i.name),Array.isArray(e.value)&&1===e.value.length)for(const t of M.items){if(e.itemName!==t.refItem)continue;const n=await xp(t.refItem,e.value[0]);n&&l(12,de[t.name]=n[t.refClass],de)}if(l(14,ae=e),"quantity"===e.itemName&&l(24,Ie=de.quantity),"currency"===e.itemName&&e.value){const t=await xp("currency",e.value);t&&l(18,we=t.designation)}if((async(e,t)=>{const n=ft.filter(t=>t.selection===e||t.constraint===e);if(n?.length){l(23,$e=!1);for(const r of n){const{selection:n,constraint:i,name:o}=r;if(t)break;l(12,de[o]="",de),e===n&&l(23,$e=i);const s=de[n];if(s&&e===i){let e=await xp(n,s);const t=de[i];if(t?.length){const n=t[0].split(", ");e=e[i];let r="";for(const t of e)Object.values(t).map(e=>{n.includes(e)&&(r=t[o])});l(12,de[o]=r,de)}}}}})(e.itemName,e.oldValue===e.value),Rt(),xt(e.itemName),Be&&Me&&(e.itemName===Me&&(dt=+e.value),jt()),ke&&Oe){if(e.itemName===Re?.name)Ae=e.value;else if(e.itemName===De?.name)be=e.value;else{if(e.itemName!==xe?.name)return;Ae=e.value}Ht()}},Vt,({detail:e})=>{Mt({_docAsync:!0})},async({detail:e})=>{await Mt(e),e.closeTask&&l(49,d=!0)},qt,e=>{"button"!==e.srcElement?.type&&"textarea"!==e.srcElement?.type&&13==e.which&&e.preventDefault()},e=>async()=>{const n=await t.getReportDoc(e)||{},{userReportId:r,type:i}=n;if(!r)return;if("eps"===i)return void a.success("Die Datei wurde erstellt und im Anhang abgelegt.");const o="/api/userreport/"+r;if("ics"===i)return window.open(o,"_self","width=1 height=1");const s="/viewer/doc/index.html?file="+o+"&type="+i;window.open(s,"","popup=yes toolbar=no width=624 height=900")},e=>async()=>{const e=await t.getDocData(V);(async e=>{const t=window.screen.height,n=window.open("","_blank","width=800,height="+t+",location=no");await ce(),n?.document.write("<title>Report Daten für '"+M.identity.designation+"'</title>"),n?.document.write("<textarea readonly style='resize: none; width: 100%; height: 100%;'>"+e+"</textarea>")})(JSON.stringify(e,null,4),M.identity.designation)},async()=>{const e=Zt();if(!e)return;const n=je.result?.resultDef[0]?.addToReports;if(n){const r=e[n];if(r){const n={docId:r},i=(await t.getSectionView("_task",n))[0];e._taskId=i._id}}const{reportId:r,type:i}=await t.createReport(wt,e);await Kt(r),setTimeout(Lt,2e3)},async()=>{const e=Zt();if(!e)return;const n=await t.getReportData(wt,e),r=window.screen.height,i=window.open("","_blank","width=800,height="+r+",location=no");await ce(),i?.document.write("<title>Report Daten für '"+M.identity.designation+"'</title>"),i?.document.write("<textarea readonly style='resize: none; width: 100%; height: 100%;'>"+JSON.stringify(n,null,4)+"</textarea>")},async({detail:{className:e,itemName:n,value:r}})=>{if(gt!==r)return;if(!e)return;if(pt.has(e))return;if(!0!==r&&(r=(r=[].concat(r)).some(e=>e===gt)),!r)return;const i={[n]:!0},o=await t.getSectionView(e,i);o?.length&&pt.set(e,o[0])},async({detail:e})=>{se=e;for(const t of M.items){if(t.saveAs||!t.refItem)continue;const[n,r]=t.refItem?.split(".");if(e.class!==n||!e.record._id)continue;let i=await xp(n,e.record._id);if(i){let e;24===i[r]?.toString().length?(i=await xp(r,i[r]),i&&(e=i[t.name]||i[t.refInput])):r?(e=null!==i[r]&&void 0!==i[r]&&(i[r][t.name]||i[r]),t.refInput&&(e=e[t.refInput]),"object"==typeof e&&(e=void 0)):e=i[t.name],e&&l(12,de[t.name]=e,de)}}},({detail:e})=>{e.target&&M.list?.length?l(17,le={ref:e.target,val:e.value}):e.itemName.startsWith("$")?Je=e.value:setTimeout(()=>{l(12,de[e.itemName]=e.value,de);for(const e of M.items.filter(e=>!!e.properties?.value?.formula))Jt(e.name)},200)},({detail:e})=>{l(16,me=!1);for(const t of e.items)l(12,de[e.listName][t.name]=t.value,de);l(16,me=!0)},({detail:e})=>{Jt(e.item.name)},()=>M.result.resultDef[0].button?.designation||"Dokument erstellen",()=>{l(15,he=!0)},nn,on,async()=>{if(gt&&P){(await t.deleteData(gt,P)).taskId?(a.success("Die Daten wurden gelöscht.",3e3),Bt()):a.failed("Die Daten können nicht gelöscht werden!",3e3)}nn()},async()=>{if(!Ze)return;const e=je.input.class[0].name,t=je.input.class[1].destination.split(".")[1];if(!e)return;if(!t)return;if(!de[e])return;const n=de[t]?.length||0;await Ut(e,de[e],!0),n<de[t].length?(qt({detail:{listName:t,value:de[t]}}),Mt({})):a.failed("Keine Positionen gefunden!",3e3)},()=>{P&&Mt({_docAsync:!0})},sn,async({detail:e})=>{if(l(32,ot=!1),l(29,nt=""),l(28,tt=e.text||""),!tt)return;const n=dc(tt);for(const e in n){if(M.items.find(t=>t.name===e))if("object"==typeof n[e]){let r={};for(const i in n[e])if("object"==typeof n[e][i])for(const o in n[e][i]){n[e][i][o]&&(r[o]=n[e][i][o]);const s=await t.getSectionView(i,r);if(s?.length){const n=await t.getSectionView(e,{[i]:s[0]._id});n?.length&&l(12,de[e]=n[0]._id,de)}}else{n[e][i]&&(r[i]=n[e][i]);const o=await t.getSectionView(e,r);o?.length&&l(12,de[e]=o[0]._id,de)}}else n[e]&&l(12,de[e]=n[e],de)}l(27,We=!1)},()=>M.items.filter(e=>e.properties?.reader),(e,t=!1)=>t?(an(),""):M.items.find(t=>t.name===e)?.designation||"",an,()=>{const{refItem:e}=Ve,t={[e]:rt};let n;M.filter(e=>e.properties?.reader).forEach(e=>{const n=document.getElementById("reader_"+e.name);n&&(t[e.name]=n.value||("number"===e.type?0:""))});let r=rec;const i=r.findIndex(t=>t[e]===rt);i>=0?(n=r[i],r[i]={...n,...t}):r=r.slice(0,-1).concat(t),rec=r,M.filter(e=>e.properties?.reader).forEach(e=>{notify(e,i>=0?i:0)({detail:{oldValue:n?n[e.name]:"",value:t[e.name]}})}),st=!0,an()},()=>{st&&(st=!1,Mt({}))},W,H,L,U,j,G,re,ie,function(e){_e=e,l(20,_e)},function(e){Ce=e,l(21,Ce)},function(e){ct=e,l(34,ct)},function(e){_t=e,l(47,_t)},function(e){Ct=e,l(48,Ct)},function(e){ae=e,l(14,ae)},function(e){$t=e,l(41,$t)},()=>nn(),function(e){he=e,l(15,he)},function(e){it=e,l(31,it)},function(e){We=e,l(27,We)},()=>on(),function(e){et=e,l(45,et)},()=>{l(9,Z=!1)},function(e){Z=e,l(9,Z)}]}class Fp extends xe{constructor(e){var t;super(),Jh.getElementById("svelte-11r31hb-style")||((t=M("style")).id="svelte-11r31hb-style",t.textContent="form.disabled.svelte-11r31hb input.svelte-11r31hb{background-color:red !important}input:placeholder-shown{font-style:italic}form.svelte-11r31hb.svelte-11r31hb{min-width:25em}hr[data-text]{margin-bottom:1em !important}@media only screen and (min-width: 600px){form.svelte-11r31hb.svelte-11r31hb{min-width:30em}}.fEmbedded.svelte-11r31hb.svelte-11r31hb,.fTask.svelte-11r31hb.svelte-11r31hb{overflow-y:auto;padding-right:1em;overflow-x:hidden}.fEmbedded.svelte-11r31hb.svelte-11r31hb{height:fit-content;min-height:30vh;max-height:60vh}.fTask.svelte-11r31hb.svelte-11r31hb{height:fit-content;max-height:70vh}.sTask.svelte-11r31hb.svelte-11r31hb{height:95%;display:inline-grid}.sTask.svelte-11r31hb .btn.svelte-11r31hb{display:initial !important}.form--buttons.svelte-11r31hb.svelte-11r31hb:not(.isReport){z-index:10000}.form--buttons.svelte-11r31hb.svelte-11r31hb{display:flex;gap:1em;padding-top:0.75em}.flex_div.svelte-11r31hb.svelte-11r31hb{display:flex;margin-top:1em;gap:0.5em;justify-content:space-between}section.sTask div.date-picker div.dropdown-shell div.dropdown.calendar{position:fixed !important;left:auto !important}form.fTask div.form-field{min-width:49vw}section.data + .modal-overlay > .dialog{margin-top:-5em}",D(Jh.head,t)),De(this,e,Lp,Ip,S,{schema:0,recID:2,deletable:3,prevEventID:107,prev:4,taskId:1,taskOrg:108,description:105,root:5,readonly:106,isStandalone:109,shortEdit:6,shortSchema:110,dialogAttr:7},[-1,-1,-1,-1,-1,-1,-1,-1])}}function Vp(e){let t,n,r;function i(t){e[4](t)}let o={schema:e[5],recID:e[6]};return void 0!==e[0]&&(o.description=e[0]),t=new Fp({props:o}),re.push(()=>Se(t,"description",i)),t.$on("back",e[2]),{c(){Ne(t.$$.fragment)},m(e,n){Te(t,e,n),r=!0},p(e,r){const i={};32&r&&(i.schema=e[5]),64&r&&(i.recID=e[6]),!n&&1&r&&(n=!0,i.description=e[0],ue(()=>n=!1)),t.$set(i)},i(e){r||($e(t.$$.fragment,e),r=!0)},o(e){Ie(t.$$.fragment,e),r=!1},d(e){Re(t,e)}}}function Up(e){let t,n;return t=new l({props:{update:e[1],description:e[0],$$slots:{default:[Vp,({prop:{schema:e,recID:t,eventID:n}})=>({5:e,6:t,7:n}),({prop:e})=>(e?32:0)|(e?64:0)|(e?128:0)]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,[n]){const r={};1&n&&(r.description=e[0]),353&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Wp(e,n,r){let i,{refresh:o}=n;return e.$$set=e=>{"refresh"in e&&r(3,o=e.refresh)},[i,(e,n)=>t.getSchema(e).then(t=>({schema:t,recID:n,eventID:e,title:t.identity.designation})),e=>{},o,function(e){i=e,r(0,i)}]}var zp=cf(function(e,t){function n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function r(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach(function(t){i(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if("object"!==o(e))throw new Error("single-spa-svelte requires a configuration object");var t=r(r({},s),e);if(!t.component)throw new Error("single-spa-svelte must be passed opts.component");var n={};return{bootstrap:a.bind(null,t,n),mount:l.bind(null,t,n),unmount:c.bind(null,t,n),update:d.bind(null,t,n)}};var s={component:null,domElementGetter:null,props:{}};function a(e){return Promise.resolve()}function l(e,t,n){var i=Object.keys(s),o=Object.keys(e).reduce(function(t,n){return i.includes(n)||(t[n]=e[n]),t},{});return Promise.resolve().then(function(){var i=function(e,t){return(t=t&&t.customProps?t.customProps:t).domElement?function(){return t.domElement}:t.domElementGetter?function(){return t.domElementGetter(t)}:e.domElementGetter?function(){return e.domElementGetter(t)}:function(e){var t=e.appName||e.name;if(!t)throw Error("single-spa-svelte was not given an application name as a prop, so it can't make a unique dom element container for the svelte application");var n="single-spa-application:".concat(t);return function(){var e=document.getElementById(n);return e||((e=document.createElement("div")).id=n,document.body.appendChild(e)),e}}(t)}(e,n),s=i();t.instance=new e.component(r(r({},o),{},{target:s,props:Object.assign({},n,e.props)}))})}function c(e,t){return Promise.resolve().then(function(){t.instance.$destroy?t.instance.$destroy():t.instance.destroy()})}function d(e,t,n){return Promise.resolve().then(function(){t.instance.$set?t.instance.$set(n):t.instance.set(n)})}});const Hp=lf(zp)({component:class extends xe{constructor(e){super(),De(this,e,Wp,Up,S,{refresh:3})}},domElementGetter:()=>document.getElementById("detail-app")}),{bootstrap:jp,mount:qp,unmount:Gp}=Hp;e({bootstrap:jp,mount:qp,unmount:Gp});e("Form",Fp),e("List",rn),e("Template",class extends xe{constructor(e){var t;super(),Zr.getElementById("svelte-1phofh5-style")||((t=M("style")).id="svelte-1phofh5-style",t.textContent="form.svelte-1phofh5.svelte-1phofh5{min-width:25em}@media only screen and (min-width: 600px){form.svelte-1phofh5.svelte-1phofh5{min-width:30em}}.fEmbedded.svelte-1phofh5.svelte-1phofh5,.fTask.svelte-1phofh5.svelte-1phofh5{overflow-y:auto;padding-right:1em;overflow-x:hidden}.fEmbedded.svelte-1phofh5.svelte-1phofh5{height:fit-content;min-height:30vh;max-height:60vh}.fTask.svelte-1phofh5.svelte-1phofh5{height:fit-content;max-height:70vh}.sTask.svelte-1phofh5.svelte-1phofh5{height:95%;display:inline-grid;min-width:40em}.sTask.svelte-1phofh5 .btn.svelte-1phofh5{display:initial !important}.form--buttons.svelte-1phofh5.svelte-1phofh5{display:flex;gap:1em;padding-bottom:0.5em}",D(Zr.head,t)),De(this,e,di,li,S,{schema:0,record:1})}})}}});
5
+ */var vd=class{x;y;pressure;time;constructor(e,t,n,r){if(isNaN(e)||isNaN(t))throw new Error(`Point is invalid: (${e}, ${t})`);this.x=+e,this.y=+t,this.pressure=n||0,this.time=r||Date.now()}distanceTo(e){return Math.sqrt(Math.pow(this.x-e.x,2)+Math.pow(this.y-e.y,2))}equals(e){return this.x===e.x&&this.y===e.y&&this.pressure===e.pressure&&this.time===e.time}velocityFrom(e){return this.time!==e.time?this.distanceTo(e)/(this.time-e.time):0}},$d=class e{constructor(e,t,n,r,i,o){this.startPoint=e,this.control2=t,this.control1=n,this.endPoint=r,this.startWidth=i,this.endWidth=o}static fromPoints(t,n){const r=this.calculateControlPoints(t[0],t[1],t[2]).c2,i=this.calculateControlPoints(t[1],t[2],t[3]).c1;return new e(t[1],r,i,t[2],n.start,n.end)}static calculateControlPoints(e,t,n){const r=e.x-t.x,i=e.y-t.y,o=t.x-n.x,s=t.y-n.y,a=(e.x+t.x)/2,l=(e.y+t.y)/2,c=(t.x+n.x)/2,d=(t.y+n.y)/2,u=Math.sqrt(r*r+i*i),f=Math.sqrt(o*o+s*s),h=u+f==0?0:f/(u+f),m=c+(a-c)*h,p=d+(l-d)*h,g=t.x-m,w=t.y-p;return{c1:new vd(a+g,l+w),c2:new vd(c+g,d+w)}}length(){let e,t,n=0;for(let r=0;r<=10;r+=1){const i=r/10,o=this.point(i,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),s=this.point(i,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(r>0){const r=o-e,i=s-t;n+=Math.sqrt(r*r+i*i)}e=o,t=s}return n}point(e,t,n,r,i){return t*(1-e)*(1-e)*(1-e)+3*n*(1-e)*(1-e)*e+3*r*(1-e)*e*e+i*e*e*e}},Id=class{_et;constructor(){try{this._et=new EventTarget}catch{this._et=document}}addEventListener(e,t,n){this._et.addEventListener(e,t,n)}dispatchEvent(e){return this._et.dispatchEvent(e)}removeEventListener(e,t,n){this._et.removeEventListener(e,t,n)}};var _d=class e extends Id{constructor(t,n={}){super(),this.canvas=t,this.velocityFilterWeight=n.velocityFilterWeight||.7,this.minWidth=n.minWidth||.5,this.maxWidth=n.maxWidth||2.5,this.throttle=n.throttle??16,this.minDistance=n.minDistance??5,this.dotSize=n.dotSize||0,this.penColor=n.penColor||"black",this.backgroundColor=n.backgroundColor||"rgba(0,0,0,0)",this.compositeOperation=n.compositeOperation||"source-over",this.canvasContextOptions=n.canvasContextOptions??{},this._strokeMoveUpdate=this.throttle?function(e,t=250){let n,r,i,o=0,s=null;const a=()=>{o=Date.now(),s=null,n=e.apply(r,i),s||(r=null,i=[])};return function(...l){const c=Date.now(),d=t-(c-o);return r=this,i=l,d<=0||d>t?(s&&(clearTimeout(s),s=null),o=c,n=e.apply(r,i),s||(r=null,i=[])):s||(s=window.setTimeout(a,d)),n}}(e.prototype._strokeUpdate,this.throttle):e.prototype._strokeUpdate,this._handleMouseDown=this._handleMouseDown.bind(this),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this._handleTouchStart=this._handleTouchStart.bind(this),this._handleTouchMove=this._handleTouchMove.bind(this),this._handleTouchEnd=this._handleTouchEnd.bind(this),this._handlePointerDown=this._handlePointerDown.bind(this),this._handlePointerMove=this._handlePointerMove.bind(this),this._handlePointerUp=this._handlePointerUp.bind(this),this._handlePointerCancel=this._handlePointerCancel.bind(this),this._handleTouchCancel=this._handleTouchCancel.bind(this),this._ctx=t.getContext("2d",this.canvasContextOptions),this.clear(),this.on()}dotSize;minWidth;maxWidth;penColor;minDistance;velocityFilterWeight;compositeOperation;backgroundColor;throttle;canvasContextOptions;_ctx;_drawingStroke=!1;_isEmpty=!0;_dataUrl;_dataUrlOptions;_lastPoints=[];_data=[];_lastVelocity=0;_lastWidth=0;_strokeMoveUpdate;_strokePointerId;clear(){const{_ctx:e,canvas:t}=this;e.fillStyle=this.backgroundColor,e.clearRect(0,0,t.width,t.height),e.fillRect(0,0,t.width,t.height),this._data=[],this._reset(this._getPointGroupOptions()),this._isEmpty=!0,this._dataUrl=void 0,this._dataUrlOptions=void 0,this._strokePointerId=void 0}redraw(){const e=this._data,t=this._dataUrl,n=this._dataUrlOptions;this.clear(),t&&this.fromDataURL(t,n),this.fromData(e,{clear:!1})}fromDataURL(e,t={}){return new Promise((n,r)=>{const i=new Image,o=t.ratio||window.devicePixelRatio||1,s=t.width||this.canvas.width/o,a=t.height||this.canvas.height/o,l=t.xOffset||0,c=t.yOffset||0;this._reset(this._getPointGroupOptions()),i.onload=()=>{this._ctx.drawImage(i,l,c,s,a),n()},i.onerror=e=>{r(e)},i.crossOrigin="anonymous",i.src=e,this._isEmpty=!1,this._dataUrl=e,this._dataUrlOptions={...t}})}toDataURL(e="image/png",t){return"image/svg+xml"===e?("object"!=typeof t&&(t=void 0),`data:image/svg+xml;base64,${btoa(this.toSVG(t))}`):("number"!=typeof t&&(t=void 0),this.canvas.toDataURL(e,t))}on(){this.canvas.style.touchAction="none",this.canvas.style.msTouchAction="none",this.canvas.style.userSelect="none",this.canvas.style.webkitUserSelect="none";const e=/Macintosh/.test(navigator.userAgent)&&"ontouchstart"in document;window.PointerEvent&&!e?this._handlePointerEvents():(this._handleMouseEvents(),"ontouchstart"in window&&this._handleTouchEvents())}off(){this.canvas.style.touchAction="auto",this.canvas.style.msTouchAction="auto",this.canvas.style.userSelect="auto",this.canvas.style.webkitUserSelect="auto",this.canvas.removeEventListener("pointerdown",this._handlePointerDown),this.canvas.removeEventListener("mousedown",this._handleMouseDown),this.canvas.removeEventListener("touchstart",this._handleTouchStart),this._removeMoveUpEventListeners()}_getListenerFunctions(){const e=window.document===this.canvas.ownerDocument?window:this.canvas.ownerDocument.defaultView??this.canvas.ownerDocument;return{addEventListener:e.addEventListener.bind(e),removeEventListener:e.removeEventListener.bind(e)}}_removeMoveUpEventListeners(){const{removeEventListener:e}=this._getListenerFunctions();e("pointermove",this._handlePointerMove),e("pointerup",this._handlePointerUp),e("pointercancel",this._handlePointerCancel),e("mousemove",this._handleMouseMove),e("mouseup",this._handleMouseUp),e("touchmove",this._handleTouchMove),e("touchend",this._handleTouchEnd),e("touchcancel",this._handleTouchCancel)}isEmpty(){return this._isEmpty}fromData(e,{clear:t=!0}={}){t&&this.clear(),this._fromData(e,this._drawCurve.bind(this),this._drawDot.bind(this)),this._data=this._data.concat(e)}toData(){return this._data}_isLeftButtonPressed(e,t){return t?1===e.buttons:!(1&~e.buttons)}_pointerEventToSignatureEvent(e){return{event:e,type:e.type,x:e.clientX,y:e.clientY,pressure:"pressure"in e?e.pressure:0}}_touchEventToSignatureEvent(e){const t=e.changedTouches[0];return{event:e,type:e.type,x:t.clientX,y:t.clientY,pressure:t.force}}_handleMouseDown(e){this._isLeftButtonPressed(e,!0)&&!this._drawingStroke&&this._strokeBegin(this._pointerEventToSignatureEvent(e))}_handleMouseMove(e){this._isLeftButtonPressed(e,!0)&&this._drawingStroke?this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e)):this._strokeEnd(this._pointerEventToSignatureEvent(e),!1)}_handleMouseUp(e){this._isLeftButtonPressed(e)||this._strokeEnd(this._pointerEventToSignatureEvent(e))}_handleTouchStart(e){1!==e.targetTouches.length||this._drawingStroke||(e.cancelable&&e.preventDefault(),this._strokeBegin(this._touchEventToSignatureEvent(e)))}_handleTouchMove(e){1===e.targetTouches.length&&(e.cancelable&&e.preventDefault(),this._drawingStroke?this._strokeMoveUpdate(this._touchEventToSignatureEvent(e)):this._strokeEnd(this._touchEventToSignatureEvent(e),!1))}_handleTouchEnd(e){0===e.targetTouches.length&&(e.cancelable&&e.preventDefault(),this._strokeEnd(this._touchEventToSignatureEvent(e)))}_handlePointerCancel(e){this._allowPointerId(e)&&(e.preventDefault(),this._strokeEnd(this._pointerEventToSignatureEvent(e),!1))}_handleTouchCancel(e){e.cancelable&&e.preventDefault(),this._strokeEnd(this._touchEventToSignatureEvent(e),!1)}_getPointerId(e){return e.persistentDeviceId||e.pointerId}_allowPointerId(e,t=!1){return void 0===this._strokePointerId?t:this._getPointerId(e)===this._strokePointerId}_handlePointerDown(e){!this._drawingStroke&&this._isLeftButtonPressed(e)&&this._allowPointerId(e,!0)&&(this._strokePointerId=this._getPointerId(e),e.preventDefault(),this._strokeBegin(this._pointerEventToSignatureEvent(e)))}_handlePointerMove(e){this._allowPointerId(e)&&(this._isLeftButtonPressed(e,!0)&&this._drawingStroke?(e.preventDefault(),this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e))):this._strokeEnd(this._pointerEventToSignatureEvent(e),!1))}_handlePointerUp(e){!this._isLeftButtonPressed(e)&&this._allowPointerId(e)&&(e.preventDefault(),this._strokeEnd(this._pointerEventToSignatureEvent(e)))}_getPointGroupOptions(e){return{penColor:e&&"penColor"in e?e.penColor:this.penColor,dotSize:e&&"dotSize"in e?e.dotSize:this.dotSize,minWidth:e&&"minWidth"in e?e.minWidth:this.minWidth,maxWidth:e&&"maxWidth"in e?e.maxWidth:this.maxWidth,velocityFilterWeight:e&&"velocityFilterWeight"in e?e.velocityFilterWeight:this.velocityFilterWeight,compositeOperation:e&&"compositeOperation"in e?e.compositeOperation:this.compositeOperation}}_strokeBegin(e){if(!this.dispatchEvent(new CustomEvent("beginStroke",{detail:e,cancelable:!0})))return;const{addEventListener:t}=this._getListenerFunctions();switch(e.event.type){case"mousedown":t("mousemove",this._handleMouseMove,{passive:!1}),t("mouseup",this._handleMouseUp,{passive:!1});break;case"touchstart":t("touchmove",this._handleTouchMove,{passive:!1}),t("touchend",this._handleTouchEnd,{passive:!1}),t("touchcancel",this._handleTouchCancel,{passive:!1});break;case"pointerdown":t("pointermove",this._handlePointerMove,{passive:!1}),t("pointerup",this._handlePointerUp,{passive:!1}),t("pointercancel",this._handlePointerCancel,{passive:!1})}this._drawingStroke=!0;const n=this._getPointGroupOptions(),r={...n,points:[]};this._data.push(r),this._reset(n),this._strokeUpdate(e)}_strokeUpdate(e){if(!this._drawingStroke)return;if(0===this._data.length)return void this._strokeBegin(e);this.dispatchEvent(new CustomEvent("beforeUpdateStroke",{detail:e}));const t=this._createPoint(e.x,e.y,e.pressure),n=this._data[this._data.length-1],r=n.points,i=r.length>0&&r[r.length-1],o=!!i&&t.distanceTo(i)<=this.minDistance,s=this._getPointGroupOptions(n);if(!i||!i||!o){const e=this._addPoint(t,s);i?e&&this._drawCurve(e,s):this._drawDot(t,s),r.push({time:t.time,x:t.x,y:t.y,pressure:t.pressure})}this.dispatchEvent(new CustomEvent("afterUpdateStroke",{detail:e}))}_strokeEnd(e,t=!0){this._removeMoveUpEventListeners(),this._drawingStroke&&(t&&this._strokeUpdate(e),this._drawingStroke=!1,this._strokePointerId=void 0,this.dispatchEvent(new CustomEvent("endStroke",{detail:e})))}_handlePointerEvents(){this._drawingStroke=!1,this.canvas.addEventListener("pointerdown",this._handlePointerDown,{passive:!1})}_handleMouseEvents(){this._drawingStroke=!1,this.canvas.addEventListener("mousedown",this._handleMouseDown,{passive:!1})}_handleTouchEvents(){this.canvas.addEventListener("touchstart",this._handleTouchStart,{passive:!1})}_reset(e){this._lastPoints=[],this._lastVelocity=0,this._lastWidth=(e.minWidth+e.maxWidth)/2,this._ctx.fillStyle=e.penColor,this._ctx.globalCompositeOperation=e.compositeOperation}_createPoint(e,t,n){const r=this.canvas.getBoundingClientRect();return new vd(e-r.left,t-r.top,n,(new Date).getTime())}_addPoint(e,t){const{_lastPoints:n}=this;if(n.push(e),n.length>2){3===n.length&&n.unshift(n[0]);const e=this._calculateCurveWidths(n[1],n[2],t),r=$d.fromPoints(n,e);return n.shift(),r}return null}_calculateCurveWidths(e,t,n){const r=n.velocityFilterWeight*t.velocityFrom(e)+(1-n.velocityFilterWeight)*this._lastVelocity,i=this._strokeWidth(r,n),o={end:i,start:this._lastWidth};return this._lastVelocity=r,this._lastWidth=i,o}_strokeWidth(e,t){return Math.max(t.maxWidth/(e+1),t.minWidth)}_drawCurveSegment(e,t,n){const r=this._ctx;r.moveTo(e,t),r.arc(e,t,n,0,2*Math.PI,!1),this._isEmpty=!1}_drawCurve(e,t){const n=this._ctx,r=e.endWidth-e.startWidth,i=2*Math.ceil(e.length());n.beginPath(),n.fillStyle=t.penColor;for(let n=0;n<i;n+=1){const o=n/i,s=o*o,a=s*o,l=1-o,c=l*l,d=c*l;let u=d*e.startPoint.x;u+=3*c*o*e.control1.x,u+=3*l*s*e.control2.x,u+=a*e.endPoint.x;let f=d*e.startPoint.y;f+=3*c*o*e.control1.y,f+=3*l*s*e.control2.y,f+=a*e.endPoint.y;const h=Math.min(e.startWidth+a*r,t.maxWidth);this._drawCurveSegment(u,f,h)}n.closePath(),n.fill()}_drawDot(e,t){const n=this._ctx,r=t.dotSize>0?t.dotSize:(t.minWidth+t.maxWidth)/2;n.beginPath(),this._drawCurveSegment(e.x,e.y,r),n.closePath(),n.fillStyle=t.penColor,n.fill()}_fromData(e,t,n){for(const r of e){const{points:e}=r,i=this._getPointGroupOptions(r);if(e.length>1)for(let n=0;n<e.length;n+=1){const r=e[n],o=new vd(r.x,r.y,r.pressure,r.time);0===n&&this._reset(i);const s=this._addPoint(o,i);s&&t(s,i)}else this._reset(i),n(e[0],i)}}toSVG({includeBackgroundColor:e=!1,includeDataUrl:t=!1}={}){const n=this._data,r=Math.max(window.devicePixelRatio||1,1),i=this.canvas.width/r,o=this.canvas.height/r,s=document.createElementNS("http://www.w3.org/2000/svg","svg");if(s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),s.setAttribute("viewBox",`0 0 ${i} ${o}`),s.setAttribute("width",i.toString()),s.setAttribute("height",o.toString()),e&&this.backgroundColor){const e=document.createElement("rect");e.setAttribute("width","100%"),e.setAttribute("height","100%"),e.setAttribute("fill",this.backgroundColor),s.appendChild(e)}if(t&&this._dataUrl){const e=this._dataUrlOptions?.ratio||window.devicePixelRatio||1,t=this._dataUrlOptions?.width||this.canvas.width/e,n=this._dataUrlOptions?.height||this.canvas.height/e,r=this._dataUrlOptions?.xOffset||0,i=this._dataUrlOptions?.yOffset||0,o=document.createElement("image");o.setAttribute("x",r.toString()),o.setAttribute("y",i.toString()),o.setAttribute("width",t.toString()),o.setAttribute("height",n.toString()),o.setAttribute("preserveAspectRatio","none"),o.setAttribute("href",this._dataUrl),s.appendChild(o)}return this._fromData(n,(e,{penColor:t})=>{const n=document.createElement("path");if(!(isNaN(e.control1.x)||isNaN(e.control1.y)||isNaN(e.control2.x)||isNaN(e.control2.y))){const r=`M ${e.startPoint.x.toFixed(3)},${e.startPoint.y.toFixed(3)} C ${e.control1.x.toFixed(3)},${e.control1.y.toFixed(3)} ${e.control2.x.toFixed(3)},${e.control2.y.toFixed(3)} ${e.endPoint.x.toFixed(3)},${e.endPoint.y.toFixed(3)}`;n.setAttribute("d",r),n.setAttribute("stroke-width",(2.25*e.endWidth).toFixed(3)),n.setAttribute("stroke",t),n.setAttribute("fill","none"),n.setAttribute("stroke-linecap","round"),s.appendChild(n)}},(e,{penColor:t,dotSize:n,minWidth:r,maxWidth:i})=>{const o=document.createElement("circle"),a=n>0?n:(r+i)/2;o.setAttribute("r",a.toString()),o.setAttribute("cx",e.x.toString()),o.setAttribute("cy",e.y.toString()),o.setAttribute("fill",t),s.appendChild(o)}),s.outerHTML}};const{document:Cd}=Ee;function Ed(e){let t,n,r,i,o;return n=new ot({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather2 pointer svelte-efkzkz")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[5]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function Ad(e){let t,n,r,i,o,s,a=!e[0]&&Ed(e);return{c(){t=M("div"),n=M("canvas"),i=L(),a&&a.c(),z(n,"id",e[1]),z(n,"name",e[1]),z(n,"class",r=e[2]+" signature_pad "+e[3]+(e[0]||e[4]?" signature-readonly":"")+" svelte-efkzkz"),z(t,"class",o=e[2]+"_wrapper wrapper svelte-efkzkz"),z(t,"id","signature_wrapper")},m(e,r){x(e,t,r),D(t,n),D(t,i),a&&a.m(t,null),s=!0},p(e,[i]){(!s||2&i)&&z(n,"id",e[1]),(!s||2&i)&&z(n,"name",e[1]),(!s||29&i&&r!==(r=e[2]+" signature_pad "+e[3]+(e[0]||e[4]?" signature-readonly":"")+" svelte-efkzkz"))&&z(n,"class",r),e[0]?a&&(ye(),Ie(a,1,1,()=>{a=null}),ve()):a?(a.p(e,i),1&i&&$e(a,1)):(a=Ed(e),a.c(),$e(a,1),a.m(t,null)),(!s||4&i&&o!==(o=e[2]+"_wrapper wrapper svelte-efkzkz"))&&z(t,"class",o)},i(e){s||($e(a),s=!0)},o(e){Ie(a),s=!1},d(e){e&&k(t),a&&a.d()}}}const bd=new Map;let Sd="";function Nd(e,t,n){const r=ee();let i,{id:o}=t,{name:s}=t,{value:a}=t,{record:l}=t,{classId:c}=t,{disabled:d}=t,{readonly:u}=t;const f=l._id||Math.floor(9e3*Math.random()+1e3).toString();u||=d;const h=e=>{Sd=e,bd.set(f,Sd),r("blur",{value:Sd})};return Q(()=>{Sd=a||bd.get(f)||"",bd.set(f,Sd);const e=document.querySelector("canvas");n(8,i=new _d(e)),u||(i.addEventListener("endStroke",()=>{h(i.toDataURL("image/png"))}),i.addEventListener("afterUpdateStroke",()=>{h(i.toDataURL("image/png"))}))}),J(()=>bd.forEach((e,t,n)=>{t!==f&&n.delete(t)})),e.$$set=e=>{"id"in e&&n(1,o=e.id),"name"in e&&n(2,s=e.name),"value"in e&&n(6,a=e.value),"record"in e&&n(7,l=e.record),"classId"in e&&n(3,c=e.classId),"disabled"in e&&n(4,d=e.disabled),"readonly"in e&&n(0,u=e.readonly)},e.$$.update=()=>{256&e.$$.dirty&&Sd&&i&&i.fromDataURL(Sd,{ratio:1})},[u,o,s,c,d,()=>{i.clear(),h("")},a,l,i]}class Td extends xe{constructor(e){var t;super(),Cd.getElementById("svelte-efkzkz-style")||((t=M("style")).id="svelte-efkzkz-style",t.textContent=".feather2.svelte-efkzkz{position:absolute;top:0.25em;right:0.25em;color:#4300b0}.wrapper.svelte-efkzkz{position:relative;width:100%;height:200px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none;border:1px solid #36697d}canvas.svelte-efkzkz{width:100%;height:100%;display:block;background-color:lightyellow}.signature-readonly.svelte-efkzkz{cursor:not-allowed;pointer-events:none}",D(Cd.head,t)),De(this,e,Nd,Ad,S,{id:1,name:2,value:6,record:7,classId:3,disabled:4,readonly:0})}}function Rd(e,t,n){const r=e.slice();return r[36]=t[n],r[38]=n,r}function Dd(e){let t,n,r;return n=new He({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather2 svelte-bcd9jd"),z(t,"title",e[21])},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function xd(e){let t,n,r,i,o;return n=new He({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather pointer svelte-bcd9jd"),z(t,"title",e[21])},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[22]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function kd(e){let t,n,r;function i(t){e[28](t)}let o={class:"tModal",noClickaway:!0,$$slots:{default:[Fd]},$$scope:{ctx:e}};return void 0!==e[8]&&(o.open=e[8]),t=new e[12]({props:o}),re.push(()=>Se(t,"open",i)),{c(){Ne(t.$$.fragment)},m(e,n){Te(t,e,n),r=!0},p(e,r){const i={};1536&r[0]|256&r[1]&&(i.$$scope={dirty:r,ctx:e}),!n&&256&r[0]&&(n=!0,i.open=e[8],ue(()=>n=!1)),t.$set(i)},i(e){r||($e(t.$$.fragment,e),r=!0)},o(e){Ie(t.$$.fragment,e),r=!1},d(e){Re(t,e)}}}function Od(e){let t;return{c(){t=B("Abbrechen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Md(e){let t,n,r,i=(e[10]||"Keine Einträge gefunden!")+"";return{c(){t=M("tr"),n=M("td"),r=B(i),z(n,"class","svelte-bcd9jd"),z(t,"class","svelte-bcd9jd")},m(e,i){x(e,t,i),D(t,n),D(n,r)},p(e,t){1024&t[0]&&i!==(i=(e[10]||"Keine Einträge gefunden!")+"")&&H(r,i)},d(e){e&&k(t)}}}function Pd(e){let t,n=e[9],r=[];for(let t=0;t<n.length;t+=1)r[t]=Bd(Rd(e,n,t));return{c(){for(let e=0;e<r.length;e+=1)r[e].c();t=F()},m(e,n){for(let t=0;t<r.length;t+=1)r[t].m(e,n);x(e,t,n)},p(e,i){if(25166336&i[0]){let o;for(n=e[9],o=0;o<n.length;o+=1){const s=Rd(e,n,o);r[o]?r[o].p(s,i):(r[o]=Bd(s),r[o].c(),r[o].m(t.parentNode,t))}for(;o<r.length;o+=1)r[o].d(1);r.length=n.length}},d(e){O(r,e),e&&k(t)}}}function Bd(e){let t,n,r,i,o,s,a=e[23](e[36])+"";return{c(){t=M("tr"),n=M("td"),r=B(a),i=L(),z(n,"class","svelte-bcd9jd"),z(t,"class","pointer svelte-bcd9jd")},m(a,l){x(a,t,l),D(t,n),D(n,r),D(t,i),o||(s=V(t,"click",W(e[24](e[38]))),o=!0)},p(t,n){e=t,512&n[0]&&a!==(a=e[23](e[36])+"")&&H(r,a)},d(e){e&&k(t),o=!1,s()}}}function Ld(e){let t,n,r,i,o,s,a,l,c,d,u,f,h;function m(e,t){return e[9]?.length?Pd:Md}n=new e[14]({props:{outline:!0,$$slots:{default:[Od]},$$scope:{ctx:e}}}),n.$on("click",e[25]),i=new e[15]({});let p=m(e),g=p(e);return{c(){t=M("div"),Ne(n.$$.fragment),r=L(),Ne(i.$$.fragment),o=L(),s=M("div"),a=M("table"),l=M("thead"),c=M("tr"),d=M("th"),d.textContent=`${e[20]}`,u=L(),f=M("tbody"),g.c(),z(d,"class","svelte-bcd9jd"),z(c,"class","svelte-bcd9jd"),z(l,"class","svelte-bcd9jd"),z(a,"striped",""),z(a,"class","svelte-bcd9jd"),z(s,"class","eList svelte-bcd9jd")},m(e,m){x(e,t,m),Te(n,t,null),x(e,r,m),Te(i,e,m),x(e,o,m),x(e,s,m),D(s,a),D(a,l),D(l,c),D(c,d),D(a,u),D(a,f),g.m(f,null),h=!0},p(e,t){const r={};256&t[1]&&(r.$$scope={dirty:t,ctx:e}),n.$set(r),p===(p=m(e))&&g?g.p(e,t):(g.d(1),g=p(e),g&&(g.c(),g.m(f,null)))},i(e){h||($e(n.$$.fragment,e),$e(i.$$.fragment,e),h=!0)},o(e){Ie(n.$$.fragment,e),Ie(i.$$.fragment,e),h=!1},d(e){e&&k(t),Re(n),e&&k(r),Re(i,e),e&&k(o),e&&k(s),g.d()}}}function Fd(e){let t,n;return t=new e[13]({props:{title:e[21],class:"eList",$$slots:{default:[Ld]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};1536&n[0]|256&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Vd(e){let t,n,r,i,o,s,a,l,c;function d(t){e[26](t)}let u={id:e[2],name:e[3].name,inputClass:e[5]||e[1],disabled:e[6],formnovalidate:e[7],readonly:e[18],pattern:e[17],required:e[19],style:"padding-left:2em;"};void 0!==e[0]&&(u.value=e[0]),n=new e[11]({props:u}),re.push(()=>Se(n,"value",d)),n.$on("change",e[27]);const f=[xd,Dd],h=[];function m(e,t){return e[6]||e[4]._id?1:0}o=m(e),s=h[o]=f[o](e);let p=e[8]&&kd(e);return{c(){t=M("div"),Ne(n.$$.fragment),i=L(),s.c(),a=L(),p&&p.c(),l=F(),q(t,"position","relative")},m(e,r){x(e,t,r),Te(n,t,null),D(t,i),h[o].m(t,null),x(e,a,r),p&&p.m(e,r),x(e,l,r),c=!0},p(e,i){const a={};4&i[0]&&(a.id=e[2]),8&i[0]&&(a.name=e[3].name),34&i[0]&&(a.inputClass=e[5]||e[1]),64&i[0]&&(a.disabled=e[6]),128&i[0]&&(a.formnovalidate=e[7]),!r&&1&i[0]&&(r=!0,a.value=e[0],ue(()=>r=!1)),n.$set(a);let c=o;o=m(e),o===c?h[o].p(e,i):(ye(),Ie(h[c],1,1,()=>{h[c]=null}),ve(),s=h[o],s?s.p(e,i):(s=h[o]=f[o](e),s.c()),$e(s,1),s.m(t,null)),e[8]?p?(p.p(e,i),256&i[0]&&$e(p,1)):(p=kd(e),p.c(),$e(p,1),p.m(l.parentNode,l)):p&&(ye(),Ie(p,1,1,()=>{p=null}),ve())},i(e){c||($e(n.$$.fragment,e),$e(s),$e(p),c=!0)},o(e){Ie(n.$$.fragment,e),Ie(s),Ie(p),c=!1},d(e){e&&k(t),Re(n),h[o].d(),e&&k(a),p&&p.d(e),e&&k(l)}}}function Ud(e,n,r){let i;const{TextField:o,Modal:s,Dialog:a,Button:l,Divider:d}=c,f=ee(),{environment:h}=u;N(e,h,e=>r(29,i=e));let{classId:m}=n,{id:p}=n,{item:g}=n,{record:w={}}=n,{value:y}=n,{noForm:v=!1}=n,{disabled:$}=n,{formnovalidate:I}=n;const{properties:_={}}=g;let{pattern:C,placeholder:E,readonly:A,required:b=!1,format:S}=_,T=!1;const{service:{type:R,map:D,title:x,designation:k}}=S;let O,M;const P=()=>{r(8,T=!1)};return e.$$set=e=>{"classId"in e&&r(1,m=e.classId),"id"in e&&r(2,p=e.id),"item"in e&&r(3,g=e.item),"record"in e&&r(4,w=e.record),"value"in e&&r(0,y=e.value),"noForm"in e&&r(5,v=e.noForm),"disabled"in e&&r(6,$=e.disabled),"formnovalidate"in e&&r(7,I=e.formnovalidate)},[y,m,p,g,w,v,$,I,T,O,M,o,s,a,l,d,h,C,A,b,x,k,async()=>{$||w._id||(r(9,O=[]),r(10,M=""),y.length>3&&(r(9,O=await t.getService("address",R,y)),Array.isArray(O)||r(10,M=O.error)),r(8,T=!0))},e=>D.map(({name:t})=>e[t]).filter(e=>!!e).join(", "),e=>()=>{const t=O[e],n=[];let r="";for(const{name:e,refItem:o}of D){const[s,a]=o.split(".");a?(r=s,"owner.country"===e&&(t[e]=i.country?._id||""),n.push({name:a,value:t[e]})):f("record",{itemName:o,value:t[e]})}n.length&&f("objRecord",{listName:r,items:n}),P()},P,function(e){y=e,r(0,y)},function(t){te(e,t)},function(e){T=e,r(8,T)}]}class Wd extends xe{constructor(e){var t;super(),document.getElementById("svelte-bcd9jd-style")||((t=M("style")).id="svelte-bcd9jd-style",t.textContent=".feather.svelte-bcd9jd.svelte-bcd9jd{position:absolute;top:0.75em;left:0.5em;color:#326173}.feather2.svelte-bcd9jd.svelte-bcd9jd{position:absolute;top:0.75em;left:0.5em;color:light-gray}.eList.svelte-bcd9jd.svelte-bcd9jd{height:fit-content;max-height:65vh;overflow-y:scroll;overflow-x:auto}.eList.svelte-bcd9jd table.svelte-bcd9jd{min-width:30vw;position:relative;width:max-content !important;max-width:50vh !important}.eList.svelte-bcd9jd table thead.svelte-bcd9jd{position:sticky;top:0;background:#326173;color:white}.eList.svelte-bcd9jd table thead tr.svelte-bcd9jd{height:2.3em}.eList.svelte-bcd9jd table tbody tr.svelte-bcd9jd{height:2.75em !important}th.svelte-bcd9jd.svelte-bcd9jd,td.svelte-bcd9jd.svelte-bcd9jd{padding-left:0.4em;padding-right:0.4em}",D(document.head,t)),De(this,e,Ud,Vd,S,{classId:1,id:2,item:3,record:4,value:0,noForm:5,disabled:6,formnovalidate:7},[-1,-1])}}function zd(e){let t,n,r;return n=new lt({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather2 svelte-1xgbysl")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function Hd(e){let t,n,r,i,o;return n=new lt({props:{size:"18"}}),{c(){t=M("span"),Ne(n.$$.fragment),z(t,"class","feather pointer svelte-1xgbysl")},m(s,a){x(s,t,a),Te(n,t,null),r=!0,i||(o=V(t,"click",e[6]),i=!0)},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n),i=!1,o()}}}function jd(e){let t,n,r,i,o,s;n=new e[5]({props:{inputClass:e[0],disabled:!0,formnovalidate:e[1],readonly:!0,id:e[2],name:e[3],value:e[4],style:"padding-left: 2em;"}});const a=[Hd,zd],l=[];function c(e,t){return e[4]?0:1}return i=c(e),o=l[i]=a[i](e),{c(){t=M("div"),Ne(n.$$.fragment),r=L(),o.c(),q(t,"position","relative")},m(e,o){x(e,t,o),Te(n,t,null),D(t,r),l[i].m(t,null),s=!0},p(e,[r]){const s={};1&r&&(s.inputClass=e[0]),2&r&&(s.formnovalidate=e[1]),4&r&&(s.id=e[2]),8&r&&(s.name=e[3]),16&r&&(s.value=e[4]),n.$set(s);let d=i;i=c(e),i===d?l[i].p(e,r):(ye(),Ie(l[d],1,1,()=>{l[d]=null}),ve(),o=l[i],o?o.p(e,r):(o=l[i]=a[i](e),o.c()),$e(o,1),o.m(t,null))},i(e){s||($e(n.$$.fragment,e),$e(o),s=!0)},o(e){Ie(n.$$.fragment,e),Ie(o),s=!1},d(e){e&&k(t),Re(n),l[i].d()}}}function qd(e,t,n){const{TextField:r}=c;let{inputClass:i}=t,{disabled:o}=t,{formnovalidate:s}=t,{readonly:a}=t,{required:l}=t,{id:d}=t,{name:u}=t,{value:f}=t,{record:h}=t;const m=h?.task;return e.$$set=e=>{"inputClass"in e&&n(0,i=e.inputClass),"disabled"in e&&n(7,o=e.disabled),"formnovalidate"in e&&n(1,s=e.formnovalidate),"readonly"in e&&n(8,a=e.readonly),"required"in e&&n(9,l=e.required),"id"in e&&n(2,d=e.id),"name"in e&&n(3,u=e.name),"value"in e&&n(4,f=e.value),"record"in e&&n(10,h=e.record)},[i,s,d,u,f,r,async()=>{m&&window.open(m)},o,a,l,h]}class Gd extends xe{constructor(e){var t;super(),document.getElementById("svelte-1xgbysl-style")||((t=M("style")).id="svelte-1xgbysl-style",t.textContent=".feather.svelte-1xgbysl{position:absolute;top:0.75em;left:0.5em;color:#4300b0}.feather2.svelte-1xgbysl{position:absolute;top:0.75em;left:0.5em;color:light-gray}",D(document.head,t)),De(this,e,qd,jd,S,{inputClass:0,disabled:7,formnovalidate:1,readonly:8,required:9,id:2,name:3,value:4,record:10})}}function Xd(e){let t,n;return t=new e[32]({props:{id:e[47](e[41]),class:e[0].name+(e[27]?" hidden ":""),nameClass:e[0].properties?.color?"color_"+e[0].properties.color:"",name:e[0].designation,help:e[0].properties?.hint,$$slots:{default:[Cu,({notifyList:e})=>({25:e}),({notifyList:e})=>[e?33554432:0]]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};134217729&n[0]&&(r.class=e[0].name+(e[27]?" hidden ":"")),1&n[0]&&(r.nameClass=e[0].properties?.color?"color_"+e[0].properties.color:""),1&n[0]&&(r.name=e[0].designation),1&n[0]&&(r.help=e[0].properties?.hint),1744830463&n[0]|1&n[1]|8388608&n[2]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Yd(e){let t,n;return t=new e[35]({props:{text:e[0].designation}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};1&n[0]&&(r.text=e[0].designation),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Zd(e){let t,n,r,i;return t=new e[32]({props:{id:e[47](e[41]),class:e[0].name+(e[27]?" hidden ":""),name:e[0].designation,help:e[0].properties?.hint}}),r=new yd({props:{keepOrigin:e[0].properties.keepOrigin,classId:e[9],disabled:e[3],readonly:e[26],id:e[41],name:e[0].name,value:e[29](),record:e[1],noForm:e[8]}}),r.$on("blur",e[43]()),{c(){Ne(t.$$.fragment),n=L(),Ne(r.$$.fragment)},m(e,o){Te(t,e,o),x(e,n,o),Te(r,e,o),i=!0},p(e,n){const i={};134217729&n[0]&&(i.class=e[0].name+(e[27]?" hidden ":"")),1&n[0]&&(i.name=e[0].designation),1&n[0]&&(i.help=e[0].properties?.hint),t.$set(i);const o={};1&n[0]&&(o.keepOrigin=e[0].properties.keepOrigin),512&n[0]&&(o.classId=e[9]),8&n[0]&&(o.disabled=e[3]),67108864&n[0]&&(o.readonly=e[26]),1&n[0]&&(o.name=e[0].name),536870912&n[0]&&(o.value=e[29]()),2&n[0]&&(o.record=e[1]),256&n[0]&&(o.noForm=e[8]),r.$set(o)},i(e){i||($e(t.$$.fragment,e),$e(r.$$.fragment,e),i=!0)},o(e){Ie(t.$$.fragment,e),Ie(r.$$.fragment,e),i=!1},d(e){Re(t,e),e&&k(n),Re(r,e)}}}function Kd(e){let t,n,r,i,o,s;return t=new e[32]({props:{id:e[47](e[41]),class:e[0].name+" hidden",name:e[0].designation,help:e[0].properties?.hint,$$slots:{default:[Eu]},$$scope:{ctx:e}}}),r=new e[35]({props:{text:e[31]}}),o=new ro({props:{required:e[4],disabled:e[3],readonly:e[26],id:e[41],item:e[0],currency:e[19],value:e[29](),notifyList:!0}}),o.$on("setRefValue",e[48]),o.$on("safeReference",e[53]),o.$on("objRecord",e[54]),{c(){Ne(t.$$.fragment),n=L(),Ne(r.$$.fragment),i=L(),Ne(o.$$.fragment)},m(e,a){Te(t,e,a),x(e,n,a),Te(r,e,a),x(e,i,a),Te(o,e,a),s=!0},p(e,n){const i={};1&n[0]&&(i.class=e[0].name+" hidden"),1&n[0]&&(i.name=e[0].designation),1&n[0]&&(i.help=e[0].properties?.hint),805307905&n[0]|8388608&n[2]&&(i.$$scope={dirty:n,ctx:e}),t.$set(i);const s={};1&n[1]&&(s.text=e[31]),r.$set(s);const a={};16&n[0]&&(a.required=e[4]),8&n[0]&&(a.disabled=e[3]),67108864&n[0]&&(a.readonly=e[26]),1&n[0]&&(a.item=e[0]),524288&n[0]&&(a.currency=e[19]),536870912&n[0]&&(a.value=e[29]()),o.$set(a)},i(e){s||($e(t.$$.fragment,e),$e(r.$$.fragment,e),$e(o.$$.fragment,e),s=!0)},o(e){Ie(t.$$.fragment,e),Ie(r.$$.fragment,e),Ie(o.$$.fragment,e),s=!1},d(e){Re(t,e),e&&k(n),Re(r,e),e&&k(i),Re(o,e)}}}function Qd(e){let t,n;return t=new e[33]({props:{inputClass:e[8]||e[9],disabled:e[3],formnovalidate:e[12],readonly:e[26],pattern:e[37],required:!0===e[4],placeholder:e[39],id:e[41],name:e[40],value:e[29]()}}),t.$on("change",e[43]()),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};768&n[0]&&(r.inputClass=e[8]||e[9]),8&n[0]&&(r.disabled=e[3]),4096&n[0]&&(r.formnovalidate=e[12]),67108864&n[0]&&(r.readonly=e[26]),16&n[0]&&(r.required=!0===e[4]),536870912&n[0]&&(r.value=e[29]()),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Jd(e){let t,n;return t=new td({props:{inputClass:e[8]||e[9],disabled:e[3],country:e[0].properties?.country,formnovalidate:e[12],readonly:e[26],required:e[4],id:e[41],name:e[40],pattern:e[37],placeholder:e[39],value:e[29](),notifyList:e[25]}}),t.$on("change",e[43]()),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};768&n[0]&&(r.inputClass=e[8]||e[9]),8&n[0]&&(r.disabled=e[3]),1&n[0]&&(r.country=e[0].properties?.country),4096&n[0]&&(r.formnovalidate=e[12]),67108864&n[0]&&(r.readonly=e[26]),16&n[0]&&(r.required=e[4]),536870912&n[0]&&(r.value=e[29]()),33554432&n[0]&&(r.notifyList=e[25]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function eu(e){let t,n;return t=new Gd({props:{inputClass:e[8]||e[9],formnovalidate:e[12],id:e[41],name:e[40],value:e[29](),record:e[1],"}":!0}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};768&n[0]&&(r.inputClass=e[8]||e[9]),4096&n[0]&&(r.formnovalidate=e[12]),536870912&n[0]&&(r.value=e[29]()),2&n[0]&&(r.record=e[1]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function tu(e){let t,n;return t=new Zc({props:{inputClass:e[8]||e[9],disabled:e[3],formnovalidate:e[12],readonly:e[26],required:e[4],id:e[41],name:e[40],value:e[29]()}}),t.$on("change",e[43]()),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};768&n[0]&&(r.inputClass=e[8]||e[9]),8&n[0]&&(r.disabled=e[3]),4096&n[0]&&(r.formnovalidate=e[12]),67108864&n[0]&&(r.readonly=e[26]),16&n[0]&&(r.required=e[4]),536870912&n[0]&&(r.value=e[29]()),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function nu(e){let t,n;return t=new sd({props:{inputClass:e[8]||e[9],disabled:e[3],formnovalidate:e[12],readonly:e[26],required:e[4],id:e[41],name:e[40],pattern:e[37],multiple:e[38],placeholder:e[39],value:e[29]()}}),t.$on("change",e[43]()),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};768&n[0]&&(r.inputClass=e[8]||e[9]),8&n[0]&&(r.disabled=e[3]),4096&n[0]&&(r.formnovalidate=e[12]),67108864&n[0]&&(r.readonly=e[26]),16&n[0]&&(r.required=e[4]),536870912&n[0]&&(r.value=e[29]()),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function ru(e){let t,n;return t=new Bc({props:{inputClass:e[8]||e[9],disabled:e[3],readonly:e[26],required:e[4],id:e[41],item:e[0],value:e[29](),praefix:e[5]}}),t.$on("blur",e[43]()),t.$on("checkRange",e[76]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};768&n[0]&&(r.inputClass=e[8]||e[9]),8&n[0]&&(r.disabled=e[3]),67108864&n[0]&&(r.readonly=e[26]),16&n[0]&&(r.required=e[4]),1&n[0]&&(r.item=e[0]),536870912&n[0]&&(r.value=e[29]()),32&n[0]&&(r.praefix=e[5]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function iu(e){let t,n;return t=new Zo({props:{inputClass:e[8]||e[9],disabled:e[3],formnovalidate:e[12],readonly:e[26],required:e[4],id:e[41],name:e[40],value:e[29](),record:e[1],item:e[0]}}),t.$on("change",e[43]()),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};768&n[0]&&(r.inputClass=e[8]||e[9]),8&n[0]&&(r.disabled=e[3]),4096&n[0]&&(r.formnovalidate=e[12]),67108864&n[0]&&(r.readonly=e[26]),16&n[0]&&(r.required=e[4]),536870912&n[0]&&(r.value=e[29]()),2&n[0]&&(r.record=e[1]),1&n[0]&&(r.item=e[0]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function ou(e){let t,n;return t=new Ys({props:{classId:e[9],id:e[41],disabled:e[3],required:e[4],value:e[42](),noForm:e[8]}}),t.$on("change",e[43]()),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),16&n[0]&&(r.required=e[4]),256&n[0]&&(r.noForm=e[8]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function su(e){let t,n;return t=new Qs({props:{classId:e[9],id:e[41],item:e[0],disabled:e[3],required:e[4],value:e[30](),noForm:e[8]}}),t.$on("change",e[43](!0)),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),1&n[0]&&(r.item=e[0]),8&n[0]&&(r.disabled=e[3]),16&n[0]&&(r.required=e[4]),1073741824&n[0]&&(r.value=e[30]()),256&n[0]&&(r.noForm=e[8]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function au(e){let t,n;return t=new Vs({props:{classId:e[9],eventId:e[10],id:e[41],item:e[0],record:e[1],readonly:e[26],disabled:e[3],required:e[4],praefix:e[5],value:e[42](),noForm:e[8],notifyList:e[25],dateInput:e[24]}}),t.$on("change",e[43](!0)),t.$on("formula",e[74]),t.$on("record",e[75]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),1024&n[0]&&(r.eventId=e[10]),1&n[0]&&(r.item=e[0]),2&n[0]&&(r.record=e[1]),67108864&n[0]&&(r.readonly=e[26]),8&n[0]&&(r.disabled=e[3]),16&n[0]&&(r.required=e[4]),32&n[0]&&(r.praefix=e[5]),256&n[0]&&(r.noForm=e[8]),33554432&n[0]&&(r.notifyList=e[25]),16777216&n[0]&&(r.dateInput=e[24]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function lu(e){let t,n;return t=new e[34]({props:{round:!0,inputClass:e[8]||e[9],disabled:e[3]||e[26],required:e[4],id:e[41],name:e[40],checked:e[29](),value:e[29](!0)}}),t.$on("change",e[43]()),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};768&n[0]&&(r.inputClass=e[8]||e[9]),67108872&n[0]&&(r.disabled=e[3]||e[26]),16&n[0]&&(r.required=e[4]),536870912&n[0]&&(r.checked=e[29]()),536870912&n[0]&&(r.value=e[29](!0)),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function cu(e){let t,n;return t=new jc({props:{id:e[41],item:e[0],praefix:e[5],record:e[1],notifyList:e[25]}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};1&n[0]&&(r.item=e[0]),32&n[0]&&(r.praefix=e[5]),2&n[0]&&(r.record=e[1]),33554432&n[0]&&(r.notifyList=e[25]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function du(e){let t,n;return t=new rs({props:{classId:e[9],item:e[0],record:e[1],listName:e[6],disabled:e[3],formnovalidate:e[12],readonly:e[26],pattern:e[37],required:!0===e[4],placeholder:e[39],id:e[41],name:e[40],value:e[29]()}}),t.$on("blur",e[43]()),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),1&n[0]&&(r.item=e[0]),2&n[0]&&(r.record=e[1]),64&n[0]&&(r.listName=e[6]),8&n[0]&&(r.disabled=e[3]),4096&n[0]&&(r.formnovalidate=e[12]),67108864&n[0]&&(r.readonly=e[26]),16&n[0]&&(r.required=!0===e[4]),536870912&n[0]&&(r.value=e[29]()),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function uu(e){let t,n;return t=new Ts({props:{classId:e[9],disabled:e[3],required:e[4],id:e[41],item:e[0],record:e[1],value:e[29](),noForm:e[8],view:e[0].properties.view,praefix:e[5]}}),t.$on("blur",e[43]()),t.$on("invalid",e[73]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),16&n[0]&&(r.required=e[4]),1&n[0]&&(r.item=e[0]),2&n[0]&&(r.record=e[1]),536870912&n[0]&&(r.value=e[29]()),256&n[0]&&(r.noForm=e[8]),1&n[0]&&(r.view=e[0].properties.view),32&n[0]&&(r.praefix=e[5]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function fu(e){let t,n;return t=new Ho({props:{classId:e[9],disabled:e[3],required:e[4],id:e[41],item:e[0],record:e[1],value:e[29](),noForm:e[8],multi:e[0].properties.multi,numberInput:e[14],praefix:e[5],toDelete:e[17],reqQuantity:e[18],notifyList:e[25]}}),t.$on("blur",e[43]()),t.$on("invalid",e[72]),t.$on("record",e[44]),t.$on("multi",e[45]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),16&n[0]&&(r.required=e[4]),1&n[0]&&(r.item=e[0]),2&n[0]&&(r.record=e[1]),536870912&n[0]&&(r.value=e[29]()),256&n[0]&&(r.noForm=e[8]),1&n[0]&&(r.multi=e[0].properties.multi),16384&n[0]&&(r.numberInput=e[14]),32&n[0]&&(r.praefix=e[5]),131072&n[0]&&(r.toDelete=e[17]),262144&n[0]&&(r.reqQuantity=e[18]),33554432&n[0]&&(r.notifyList=e[25]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function hu(e){let t,n;return t=new lo({props:{classId:e[9],disabled:e[3],formnovalidate:e[12],required:e[4],readonly:e[26],id:e[41],item:e[0],ownCurrency:e[20],currency:e[19],value:e[29](),praefix:e[5],notifyList:e[25],noForm:e[8]}}),t.$on("blur",e[43]()),t.$on("formula",e[69]),t.$on("listRecord",e[70]),t.$on("record",e[71]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),4096&n[0]&&(r.formnovalidate=e[12]),16&n[0]&&(r.required=e[4]),67108864&n[0]&&(r.readonly=e[26]),1&n[0]&&(r.item=e[0]),1048576&n[0]&&(r.ownCurrency=e[20]),524288&n[0]&&(r.currency=e[19]),536870912&n[0]&&(r.value=e[29]()),32&n[0]&&(r.praefix=e[5]),33554432&n[0]&&(r.notifyList=e[25]),256&n[0]&&(r.noForm=e[8]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function mu(e){let t,n;return t=new Wd({props:{classId:e[9],disabled:e[3],readonly:e[26],required:e[4],id:e[41],item:e[0],record:e[1],value:e[29](),noForm:e[8]}}),t.$on("change",e[43]()),t.$on("record",e[67]),t.$on("objRecord",e[68]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),67108864&n[0]&&(r.readonly=e[26]),16&n[0]&&(r.required=e[4]),1&n[0]&&(r.item=e[0]),2&n[0]&&(r.record=e[1]),536870912&n[0]&&(r.value=e[29]()),256&n[0]&&(r.noForm=e[8]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function pu(e){let t,n;return t=new Ps({props:{classId:e[9],disabled:e[3],required:e[4],id:e[41],item:e[0],value:e[29](),noForm:e[8]}}),t.$on("blur",e[43]()),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),16&n[0]&&(r.required=e[4]),1&n[0]&&(r.item=e[0]),536870912&n[0]&&(r.value=e[29]()),256&n[0]&&(r.noForm=e[8]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function gu(e){let t,n;return t=new Td({props:{classId:e[9],disabled:e[3],readonly:e[26],id:e[41],name:e[0].name,value:e[29](),record:e[1],noForm:e[8],placeholder:e[0].properties?.placeholder}}),t.$on("blur",e[43]()),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),67108864&n[0]&&(r.readonly=e[26]),1&n[0]&&(r.name=e[0].name),536870912&n[0]&&(r.value=e[29]()),2&n[0]&&(r.record=e[1]),256&n[0]&&(r.noForm=e[8]),1&n[0]&&(r.placeholder=e[0].properties?.placeholder),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function wu(e){let t,n;return t=new xc({props:{praefix:e[5],classId:e[9],disabled:e[3],readonly:e[26],item:e[0],id:e[41],name:e[0].name,eventId:e[10],record:e[1],recordId:e[2],value:e[29](),fileType:e[0].properties?.accept}}),t.$on("record",e[65]),t.$on("listRecord",e[66]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};32&n[0]&&(r.praefix=e[5]),512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),67108864&n[0]&&(r.readonly=e[26]),1&n[0]&&(r.item=e[0]),1&n[0]&&(r.name=e[0].name),1024&n[0]&&(r.eventId=e[10]),2&n[0]&&(r.record=e[1]),4&n[0]&&(r.recordId=e[2]),536870912&n[0]&&(r.value=e[29]()),1&n[0]&&(r.fileType=e[0].properties?.accept),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function yu(e){let t,n;return t=new $c({props:{praefix:e[5],classId:e[9],disabled:e[3],readonly:e[26],item:e[0],id:e[41],name:e[0].name,eventId:e[10],record:e[1],value:e[29]()}}),t.$on("record",e[64]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};32&n[0]&&(r.praefix=e[5]),512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),67108864&n[0]&&(r.readonly=e[26]),1&n[0]&&(r.item=e[0]),1&n[0]&&(r.name=e[0].name),1024&n[0]&&(r.eventId=e[10]),2&n[0]&&(r.record=e[1]),536870912&n[0]&&(r.value=e[29]()),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function vu(e){let t,n;return t=new cc({props:{classId:e[9],disabled:e[3],readonly:e[26],item:e[0],id:e[41],name:e[0].name,eventId:e[10],record:e[1],value:e[29]()}}),t.$on("record",e[62]),t.$on("saveFull",e[63]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),67108864&n[0]&&(r.readonly=e[26]),1&n[0]&&(r.item=e[0]),1&n[0]&&(r.name=e[0].name),1024&n[0]&&(r.eventId=e[10]),2&n[0]&&(r.record=e[1]),536870912&n[0]&&(r.value=e[29]()),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function $u(e){let t,n;return t=new s({props:{classId:e[9],disabled:e[3],readonly:e[26],id:e[41],name:e[0].name,value:e[29](),noForm:e[8],standard:!0,style:"",placeholder:e[0].properties?.placeholder}}),t.$on("blur",e[43]()),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),67108864&n[0]&&(r.readonly=e[26]),1&n[0]&&(r.name=e[0].name),536870912&n[0]&&(r.value=e[29]()),256&n[0]&&(r.noForm=e[8]),1&n[0]&&(r.placeholder=e[0].properties?.placeholder),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Iu(e){let t,n;return t=new lr({props:{classId:e[9],eventId:e[10],listName:e[24]?.l||"",record:e[1],fullRecord:e[7],required:e[4],disabled:e[3],formnovalidate:e[12],readonly:e[26],id:e[41],item:e[0],desc:e[31],value:e[29](),multiValues:e[21],noForm:e[8],praefix:e[5],selectionFields:e[11],selection:e[13],deList:e[15],recordId:e[2],isTemplate:e[16],shortEdit:e[22],initFinished:e[23]}}),t.$on("task",e[57]),t.$on("record",e[58]),t.$on("listChange",e[59]),t.$on("saveDialog",e[60]),t.$on("change",e[43]()),t.$on("initFail",e[46]),t.$on("defPrep",e[61]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),1024&n[0]&&(r.eventId=e[10]),16777216&n[0]&&(r.listName=e[24]?.l||""),2&n[0]&&(r.record=e[1]),128&n[0]&&(r.fullRecord=e[7]),16&n[0]&&(r.required=e[4]),8&n[0]&&(r.disabled=e[3]),4096&n[0]&&(r.formnovalidate=e[12]),67108864&n[0]&&(r.readonly=e[26]),1&n[0]&&(r.item=e[0]),1&n[1]&&(r.desc=e[31]),536870912&n[0]&&(r.value=e[29]()),2097152&n[0]&&(r.multiValues=e[21]),256&n[0]&&(r.noForm=e[8]),32&n[0]&&(r.praefix=e[5]),2048&n[0]&&(r.selectionFields=e[11]),8192&n[0]&&(r.selection=e[13]),32768&n[0]&&(r.deList=e[15]),4&n[0]&&(r.recordId=e[2]),65536&n[0]&&(r.isTemplate=e[16]),4194304&n[0]&&(r.shortEdit=e[22]),8388608&n[0]&&(r.initFinished=e[23]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function _u(e){let t,n;return t=new jr({props:{classId:e[9],eventId:e[10],required:e[4],disabled:e[3],formnovalidate:e[12],readonly:e[26],id:e[41],item:e[0],record:e[1],desc:e[31],value:e[29]()||[],noForm:e[8],praefix:e[5],selectionFields:e[11],selection:e[13],deList:e[15],recordId:e[2],isTemplate:e[16]}}),t.$on("task",e[55]),t.$on("change",e[43]()),t.$on("multi",e[45]),t.$on("initFail",e[46]),t.$on("defPrep",e[56]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),1024&n[0]&&(r.eventId=e[10]),16&n[0]&&(r.required=e[4]),8&n[0]&&(r.disabled=e[3]),4096&n[0]&&(r.formnovalidate=e[12]),67108864&n[0]&&(r.readonly=e[26]),1&n[0]&&(r.item=e[0]),2&n[0]&&(r.record=e[1]),1&n[1]&&(r.desc=e[31]),536870912&n[0]&&(r.value=e[29]()||[]),256&n[0]&&(r.noForm=e[8]),32&n[0]&&(r.praefix=e[5]),2048&n[0]&&(r.selectionFields=e[11]),8192&n[0]&&(r.selection=e[13]),32768&n[0]&&(r.deList=e[15]),4&n[0]&&(r.recordId=e[2]),65536&n[0]&&(r.isTemplate=e[16]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Cu(e){let t,n,r,i;const o=[_u,Iu,$u,vu,yu,wu,gu,pu,mu,hu,fu,uu,du,cu,lu,au,su,ou,iu,ru,nu,tu,eu,Jd,Qd],s=[];function a(e,t){return"object"===e[0].type&&e[0].properties?.multi?0:"object"===e[0].type?1:"textarea"===e[0].type||e[0].properties&&"textarea"===e[0].properties.format?2:"file"===e[0].type?3:"fileQR"===e[0].type?4:"filePDF"===e[0].type?5:"signature"===e[0].type?6:e[0].properties&&(e[0].properties.enum||e[0].properties.regulation)?7:e[0].properties?.format?.service?8:"number"===e[0].type?9:e[0].properties&&e[0].properties.multi?10:e[0].properties&&e[0].properties.view&&"lookup"!==e[0].properties.format?11:e[0].properties?.autocomplete?12:"lookup"===e[0].properties?.format?13:"boolean"===e[0].type?14:"date"===e[0].type?15:"dateRange"===e[0].type?16:"datetime"===e[0].type?17:"map"===e[0].properties?.format?18:"time"===e[0].properties?.format?19:"email"===e[0].type||"email"===e[0].properties?.format?20:"url"===e[0].properties?.format?21:"task"===e[0].properties?.format?22:"tel"===e[0].properties?.format?23:24}return t=a(e),n=s[t]=o[t](e),{c(){n.c(),r=F()},m(e,n){s[t].m(e,n),x(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?s[t].p(e,i):(ye(),Ie(s[l],1,1,()=>{s[l]=null}),ve(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),$e(n,1),n.m(r.parentNode,r))},i(e){i||($e(n),i=!0)},o(e){Ie(n),i=!1},d(e){s[t].d(e),e&&k(r)}}}function Eu(e){let t,n;return t=new lr({props:{classId:e[9],eventId:e[10],disabled:!0,readonly:!0,id:e[41],item:e[0],value:e[29](),noList:!0,withRefValue:!0,refValue:e[28]}}),t.$on("setRefDesc",e[49]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),1024&n[0]&&(r.eventId=e[10]),1&n[0]&&(r.item=e[0]),536870912&n[0]&&(r.value=e[29]()),268435456&n[0]&&(r.refValue=e[28]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Au(e){let t,n,r,i;const o=[Kd,Zd,Yd,Xd],s=[];function a(e,t){return e[5]||"reference"!==e[0].saveAs||"object"!==e[0].type?"html"===e[0].properties?.format?1:"divider"===e[0].type?2:3:0}return t=a(e),n=s[t]=o[t](e),{c(){n.c(),r=F()},m(e,n){s[t].m(e,n),x(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?s[t].p(e,i):(ye(),Ie(s[l],1,1,()=>{s[l]=null}),ve(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),$e(n,1),n.m(r.parentNode,r))},i(e){i||($e(n),i=!0)},o(e){Ie(n),i=!1},d(e){s[t].d(e),e&&k(r)}}}function bu(e,n,r){let i,o,s,a,l;const d=ee(),{FormField:f,TextField:h,DatePicker:p,TimePicker:g,Checkbox:w,Divider:y}=c,{environment:v}=u;N(e,v,e=>r(52,l=e));let{praefix:$=""}=n,{item:_}=n,{listName:C=""}=n,{fullRecord:E}=n,{record:A}=n,{recordId:b}=n,{noForm:S=!1}=n,{classId:T}=n,{eventId:R}=n,{disabled:D}=n,{selectionFields:x}=n,{formnovalidate:k}=n,{selection:O=!1}=n,{notifyList:M}=n,{numberInput:P}=n,{deList:B}=n,{required:L}=n,{isTemplate:F}=n,{toDelete:V}=n,{reqQuantity:U}=n,{currency:W}=n,{ownCurrency:z}=n,{changeValue:H}=n,{propSelection:j}=n,{multiValues:q}=n,{shortEdit:G}=n,{initFinished:X}=n,{dateInput:Y}=n;b||=A._id;let{required:Z,readonly:K,hidden:Q,pattern:J,multiple:ne,placeholder:re}=_.properties||{};if(Q=!0===Q,void 0!==K&&(K=!0===K),K||=b&&_.asInput,void 0===L&&(L=Z),D=D||!!K,"string"==typeof _.name){const[e,t]=_.name.split("_");t&&(_.name=t)}const ie=(C?C+".":"")+_.name,oe=ie+(""!==$?"-"+$:""),se=(e,t=ie)=>{try{return t.split(".").reduce((e,t)=>e[t],e)}catch(e){return""}},ae=async e=>{const{list:n,values:r}=_.process;if(!e)return void d("save",{itemName:n,value:[],addToRecord:!0});const i={},o=await t.getSchema(R);for(const e in r){const s=r[e];if(e.includes(".")){const[r,a]=e.split("."),l={[a]:s};let c=await t.getSectionView(r,l);if(!c?.length)continue;c=c[0],i[r]=c._id;const d=o.list.find(e=>e.name===n);for(const e of d.item){const{name:t}=e;i[t]||(i[t]=c[t])}}else i[e]=s}d("save",{itemName:n,value:[i],addToRecord:!0})};let le=se(A);return e.$$set=e=>{"praefix"in e&&r(5,$=e.praefix),"item"in e&&r(0,_=e.item),"listName"in e&&r(6,C=e.listName),"fullRecord"in e&&r(7,E=e.fullRecord),"record"in e&&r(1,A=e.record),"recordId"in e&&r(2,b=e.recordId),"noForm"in e&&r(8,S=e.noForm),"classId"in e&&r(9,T=e.classId),"eventId"in e&&r(10,R=e.eventId),"disabled"in e&&r(3,D=e.disabled),"selectionFields"in e&&r(11,x=e.selectionFields),"formnovalidate"in e&&r(12,k=e.formnovalidate),"selection"in e&&r(13,O=e.selection),"notifyList"in e&&r(25,M=e.notifyList),"numberInput"in e&&r(14,P=e.numberInput),"deList"in e&&r(15,B=e.deList),"required"in e&&r(4,L=e.required),"isTemplate"in e&&r(16,F=e.isTemplate),"toDelete"in e&&r(17,V=e.toDelete),"reqQuantity"in e&&r(18,U=e.reqQuantity),"currency"in e&&r(19,W=e.currency),"ownCurrency"in e&&r(20,z=e.ownCurrency),"changeValue"in e&&r(50,H=e.changeValue),"propSelection"in e&&r(51,j=e.propSelection),"multiValues"in e&&r(21,q=e.multiValues),"shortEdit"in e&&r(22,G=e.shortEdit),"initFinished"in e&&r(23,X=e.initFinished),"dateInput"in e&&r(24,Y=e.dateInput)},e.$$.update=()=>{if(1&e.$$.dirty[0]|1048576&e.$$.dirty[1]&&j&&_.properties?.selection){const{refClass:e,refItem:t,target:n}=_.properties.selection,r=j.record[e];d("propSelection",{itemName:_.name,itemType:_.type,prop:t,target:n,source:e,sourceId:r})}if(524288&e.$$.dirty[1])for(const e in H)e===ie&&r(1,A[ie]=H[e],A);7&e.$$.dirty[0]|2097152&e.$$.dirty[1]&&r(29,i=(e=!1)=>{let t;return b||"number"!==_.type&&"string"!==_.type||!_.refItemAlt?.startsWith||!_.refItemAlt.startsWith("owner.")||+se(A)?b||"number"!==_.type&&"string"!==_.type||!_.refItem?.startsWith||!_.refItem.startsWith("owner.")?(t=se(A),!t&&_.properties?.useId&&(t=A._id),e&&(t=!!t),void 0===t?"":t):(t=se(l,_.refItem),void 0===t?"":t):(t=se(l,_.refItemAlt),void 0===t?"":t)}),2&e.$$.dirty[0]&&r(30,o=(e=ie)=>{const t=se(A,e+"_from"),n=se(A,e+"_to");return{from:void 0===t?t:I(t),to:void 0===n?n:I(n)}}),2&e.$$.dirty[0]&&(a=se(A))},r(31,s=((e=ie)=>{let t=A["_"+e];return t=m(t),void 0===t?"":t})()),[_,A,b,D,L,$,C,E,S,T,R,x,k,O,P,B,F,V,U,W,z,q,G,X,Y,M,K,Q,le,i,o,s,f,h,w,y,v,J,ne,re,ie,oe,(e=ie)=>{let t=se(A);return t?new Date(t):""===$?(()=>{const e=new Date;return new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()-1,23))})():void 0},e=>({detail:t})=>{let{value:n,checked:i,range:o}=t;void 0!==i&&(n=i);const s=ie+(o||"");r(1,A[s]=e?function(e,t){if(null==e)return null;let n=e.getHours();return/%p/i.test(t)&&(n%=12,0===n&&(n=12)),t.replace("%Y",e.getFullYear()).replace("%y",(e.getFullYear()%100).toString().padStart(2,"0")).replace("%m",(e.getMonth()+1).toString().padStart(2,"0")).replace("%d",e.getDate().toString().padStart(2,"0")).replace("%H",n.toString().padStart(2,"0")).replace("%M",e.getMinutes().toString().padStart(2,"0")).replace("%S",e.getSeconds().toString().padStart(2,"0")).replace("%p",e.getHours()<12?"am":"pm").replace("%P",e.getHours()<12?"AM":"PM").replace("%%","%")}(n,"%d.%m.%Y"):n,A);const l=Object.values(A).every(e=>!e)&&n;d("notify",{oldValue:a,value:n,add:l,itemName:s,desc:t.description}),"boolean"===_.type&&_.process&&ae(i)},({detail:e})=>{d("record",e)},({detail:e})=>{d("multi",e)},()=>r(27,Q=!0),()=>"object"===_.type?"comment_"+oe:oe,({detail:e})=>{r(28,le=e)},({detail:e})=>{const{designation:t}=_;r(31,s=t+": "+(e||"(Neu)"))},H,j,l,function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)},function(t){te(e,t)}]}class Su extends xe{constructor(e){var t;super(),document.getElementById("svelte-rxh0vh-style")||((t=M("style")).id="svelte-rxh0vh-style",t.textContent=".form-field{margin-bottom:0.5em !important}.form-field.hidden{display:none !important}.form-field > .description{padding-top:0.75em;color:black}.form-field div.field > label.checkbox{padding-top:0.5em}.form-field label.color_red{color:red}",D(document.head,t)),De(this,e,bu,Au,S,{praefix:5,item:0,listName:6,fullRecord:7,record:1,recordId:2,noForm:8,classId:9,eventId:10,disabled:3,selectionFields:11,formnovalidate:12,selection:13,notifyList:25,numberInput:14,deList:15,required:4,isTemplate:16,toDelete:17,reqQuantity:18,currency:19,ownCurrency:20,changeValue:50,propSelection:51,multiValues:21,shortEdit:22,initFinished:23,dateInput:24},[-1,-1,-1])}}const{document:Nu}=Ee;function Tu(e){e[18]=e[20].defList,e[1]=e[20].list,e[19]=e[20].items}function Ru(e,t,n){const r=e.slice();return r[21]=t[n],r[23]=n,r}function Du(e,t,n){const r=e.slice();return r[24]=t[n],r[26]=n,r}function xu(e,t,n){const r=e.slice();return r[24]=t[n],r}function ku(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Ou(e){let t,n,r,i,o,s,a,l,c,d;Tu(e),n=new e[5]({props:{outline:!0,$$slots:{default:[Mu]},$$scope:{ctx:e}}}),n.$on("click",e[14]),i=new e[5]({props:{disabled:!e[1].length,filled:!0,$$slots:{default:[Pu]},$$scope:{ctx:e}}}),i.$on("click",e[10](e[1]));let u=e[19]?.length&&function(e){let t,n,r,i,o,s,a,l;i=new Ze({props:{size:"20"}});let c=e[19],d=[];for(let t=0;t<c.length;t+=1)d[t]=Bu(xu(e,c,t));return{c(){t=M("thead"),n=M("tr"),r=M("th"),Ne(i.$$.fragment),o=L();for(let e=0;e<d.length;e+=1)d[e].c();z(r,"class","svelte-1m010ne"),z(n,"class","svelte-1m010ne"),z(t,"class","svelte-1m010ne")},m(c,u){x(c,t,u),D(t,n),D(n,r),Te(i,r,null),D(n,o);for(let e=0;e<d.length;e+=1)d[e].m(n,null);s=!0,a||(l=V(r,"click",e[11](e[1])),a=!0)},p(t,r){if(e=t,512&r){let t;for(c=e[19],t=0;t<c.length;t+=1){const i=xu(e,c,t);d[t]?d[t].p(i,r):(d[t]=Bu(i),d[t].c(),d[t].m(n,null))}for(;t<d.length;t+=1)d[t].d(1);d.length=c.length}},i(e){s||($e(i.$$.fragment,e),s=!0)},o(e){Ie(i.$$.fragment,e),s=!1},d(e){e&&k(t),Re(i),O(d,e),a=!1,l()}}}(e),f=e[1]?.length&&function(e){let t,n,r=e[1],i=[];for(let t=0;t<r.length;t+=1)i[t]=Vu(Ru(e,r,t));const o=e=>Ie(i[e],1,1,()=>{i[e]=null});return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=F()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);x(e,t,r),n=!0},p(e,n){if(4864&n){let s;for(r=e[1],s=0;s<r.length;s+=1){const o=Ru(e,r,s);i[s]?(i[s].p(o,n),$e(i[s],1)):(i[s]=Vu(o),i[s].c(),$e(i[s],1),i[s].m(t.parentNode,t))}for(ye(),s=r.length;s<i.length;s+=1)o(s);ve()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)$e(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)Ie(i[e]);n=!1},d(e){O(i,e),e&&k(t)}}}(e);return{c(){t=M("div"),Ne(n.$$.fragment),r=L(),Ne(i.$$.fragment),o=L(),s=M("div"),a=M("table"),u&&u.c(),l=L(),c=M("tbody"),f&&f.c(),z(t,"class","form--buttons svelte-1m010ne"),z(a,"striped",""),z(a,"class","svelte-1m010ne"),z(s,"class","eList svelte-1m010ne")},m(e,h){x(e,t,h),Te(n,t,null),D(t,r),Te(i,t,null),x(e,o,h),x(e,s,h),D(s,a),u&&u.m(a,null),D(a,l),D(a,c),f&&f.m(c,null),d=!0},p(e,t){Tu(e);const r={};536870912&t&&(r.$$scope={dirty:t,ctx:e}),n.$set(r);const o={};536870912&t&&(o.$$scope={dirty:t,ctx:e}),i.$set(o),e[19]?.length&&u.p(e,t),e[1]?.length&&f.p(e,t)},i(e){d||($e(n.$$.fragment,e),$e(i.$$.fragment,e),$e(u),$e(f),d=!0)},o(e){Ie(n.$$.fragment,e),Ie(i.$$.fragment,e),Ie(u),Ie(f),d=!1},d(e){e&&k(t),Re(n),Re(i),e&&k(o),e&&k(s),u&&u.d(),f&&f.d()}}}function Mu(e){let t;return{c(){t=B("Abbrechen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Pu(e){let t;return{c(){t=B("Bestätigen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Bu(e){let t,n,r=e[24].designation+"";return{c(){t=M("th"),n=B(r),z(t,"class","svelte-1m010ne")},m(e,r){x(e,t,r),D(t,n)},p:_,d(e){e&&k(t)}}}function Lu(e){let t,n,r;return n=new e[7]({props:{name:e[8],data:e[23],checked:e[12](e[18],e[21]),round:!0}}),{c(){t=M("td"),Ne(n.$$.fragment),z(t,"title","Wählt den Wert aus"),z(t,"class","svelte-1m010ne")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function Fu(e){let t,n,r=e[21][e[24].name]+"";return{c(){t=M("td"),n=B(r),z(t,"class","svelte-1m010ne")},m(e,r){x(e,t,r),D(t,n)},p:_,d(e){e&&k(t)}}}function Vu(e){let t,n,r,i,o=e[0],s=Lu(e),a=e[19],l=[];for(let t=0;t<a.length;t+=1)l[t]=Fu(Du(e,a,t));return{c(){t=M("tr"),s.c(),n=L();for(let e=0;e<l.length;e+=1)l[e].c();r=L(),z(t,"style","cursor: default;"),z(t,"class","svelte-1m010ne")},m(e,o){x(e,t,o),s.m(t,null),D(t,n);for(let e=0;e<l.length;e+=1)l[e].m(t,null);D(t,r),i=!0},p(e,i){if(1&i&&S(o,o=e[0])?(ye(),Ie(s,1,1,_),ve(),s=Lu(e),s.c(),$e(s),s.m(t,n)):s.p(e,i),512&i){let n;for(a=e[19],n=0;n<a.length;n+=1){const o=Du(e,a,n);l[n]?l[n].p(o,i):(l[n]=Fu(o),l[n].c(),l[n].m(t,r))}for(;n<l.length;n+=1)l[n].d(1);l.length=a.length}},i(e){i||($e(s),i=!0)},o(e){Ie(s),i=!1},d(e){e&&k(t),s.d(e),O(l,e)}}}function Uu(e){let t,n;return t=new e[3]({}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p:_,i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Wu(e){let t,n,r,i;t=new e[6]({});let o={ctx:e,current:null,token:null,hasCatch:!1,pending:Uu,then:Ou,catch:ku,value:20,blocks:[,,,]};return _e(e[9](),o),{c(){Ne(t.$$.fragment),n=L(),r=F(),o.block.c()},m(e,s){Te(t,e,s),x(e,n,s),x(e,r,s),o.block.m(e,o.anchor=s),o.mount=()=>r.parentNode,o.anchor=r,i=!0},p(t,n){Ce(o,e=t,n)},i(e){i||($e(t.$$.fragment,e),$e(o.block),i=!0)},o(e){Ie(t.$$.fragment,e);for(let e=0;e<3;e+=1){Ie(o.blocks[e])}i=!1},d(e){Re(t,e),e&&k(n),e&&k(r),o.block.d(e),o.token=null,o=null}}}function zu(e){let t,n;return t=new e[4]({props:{title:"Auswahl",class:"eList",$$slots:{default:[Wu]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,[n]){const r={};536870912&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Hu(e,n,r){const i=ee(),{Loading:o,TextField:s,Dialog:a,Button:l,Divider:d,Checkbox:u}=c;let{classId:f}=n,{list:h}=n,{selection:m=[]}=n;const p=f+h.name+"checkbox";Q(()=>{window.setTimeout(()=>{const e=document.querySelector("tr.active");e&&e.scrollIntoView({block:"end",behavior:"smooth"})},200)});return e.$$set=e=>{"classId"in e&&r(13,f=e.classId),"list"in e&&r(1,h=e.list),"selection"in e&&r(0,m=e.selection)},[m,h,i,o,a,l,d,u,p,async()=>{const{refItem:e}=h,{item:n,refList:r,display:i}=h.merge,o="."+f+"#"+e,s=document.querySelector(o),a=s?.value;if(!a)return{items:[],list:[]};const l=await t.getDocById(e,a);let c,d=[];if(l&&l[r]){const o=l[r].map(e=>e[n]),s=await t.getSectionView(n,{_id:{$in:o}},!1);d=l[r].map(e=>(e.designation=e.text||s.find(t=>t._id===e[n])?.designation,e.perWeek=s.find(t=>t._id===e[n])?.perWeek,e));c=(await t.getSchemaByClass(e)).list.find(e=>e.name===r),c=c.item.filter(e=>i.includes(e.name)),c.unshift({name:"designation",designation:"Artikel",type:"string"})}return{defList:h,list:d,items:c}},e=>()=>{const t=document.getElementsByName(p),n=[];t.forEach((t,r)=>{t.checked&&n.push(e[+t.attributes.data.value])}),i("choose",{list:n})},e=>()=>{document.getElementsByName(p).forEach((e,t)=>{e.checked=!e.checked})},(e,t)=>{const n=e.merge.id||[e.merge.item];return m.find(e=>{let r=!0;for(const i of n)r&&(r=t[i]===e[i]);return r})},f,()=>i("back")]}class ju extends xe{constructor(e){var t;super(),Nu.getElementById("svelte-1m010ne-style")||((t=M("style")).id="svelte-1m010ne-style",t.textContent=".eList.svelte-1m010ne.svelte-1m010ne{height:fit-content;max-height:65vh;overflow-y:scroll;overflow-x:auto}.eList.svelte-1m010ne table.svelte-1m010ne{min-width:30vw;position:relative;width:max-content !important;max-width:50vh !important}.eList.svelte-1m010ne table thead.svelte-1m010ne{position:sticky;top:0;background:#326173;color:white}.eList.svelte-1m010ne table tbody tr.svelte-1m010ne{height:2.3em}th.svelte-1m010ne.svelte-1m010ne,td.svelte-1m010ne.svelte-1m010ne{padding-left:0.4em;padding-right:0.4em}.dialog.eList{max-height:90vh}.checkbox.round > .selector{border-color:#326173 !important}.form--buttons.svelte-1m010ne.svelte-1m010ne{display:flex;gap:1em;padding:0.5em 0}",D(Nu.head,t)),De(this,e,Hu,zu,S,{classId:13,list:1,selection:0})}}var qu;!function(e){e[e.QR_CODE=0]="QR_CODE",e[e.AZTEC=1]="AZTEC",e[e.CODABAR=2]="CODABAR",e[e.CODE_39=3]="CODE_39",e[e.CODE_93=4]="CODE_93",e[e.CODE_128=5]="CODE_128",e[e.DATA_MATRIX=6]="DATA_MATRIX",e[e.MAXICODE=7]="MAXICODE",e[e.ITF=8]="ITF",e[e.EAN_13=9]="EAN_13",e[e.EAN_8=10]="EAN_8",e[e.PDF_417=11]="PDF_417",e[e.RSS_14=12]="RSS_14",e[e.RSS_EXPANDED=13]="RSS_EXPANDED",e[e.UPC_A=14]="UPC_A",e[e.UPC_E=15]="UPC_E",e[e.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"}(qu||(qu={}));var Gu,Xu,Yu=new Map([[qu.QR_CODE,"QR_CODE"],[qu.AZTEC,"AZTEC"],[qu.CODABAR,"CODABAR"],[qu.CODE_39,"CODE_39"],[qu.CODE_93,"CODE_93"],[qu.CODE_128,"CODE_128"],[qu.DATA_MATRIX,"DATA_MATRIX"],[qu.MAXICODE,"MAXICODE"],[qu.ITF,"ITF"],[qu.EAN_13,"EAN_13"],[qu.EAN_8,"EAN_8"],[qu.PDF_417,"PDF_417"],[qu.RSS_14,"RSS_14"],[qu.RSS_EXPANDED,"RSS_EXPANDED"],[qu.UPC_A,"UPC_A"],[qu.UPC_E,"UPC_E"],[qu.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]);function Zu(e){return Object.values(qu).includes(e)}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.URL=1]="URL"}(Gu||(Gu={})),function(e){e[e.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",e[e.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"}(Xu||(Xu={}));var Ku,Qu=function(){function e(){}return e.GITHUB_PROJECT_URL="https://github.com/mebjas/html5-qrcode",e.SCAN_DEFAULT_FPS=2,e.DEFAULT_DISABLE_FLIP=!1,e.DEFAULT_REMEMBER_LAST_CAMERA_USED=!0,e.DEFAULT_SUPPORTED_SCAN_TYPE=[Xu.SCAN_TYPE_CAMERA,Xu.SCAN_TYPE_FILE],e}(),Ju=function(){function e(e,t){this.format=e,this.formatName=t}return e.prototype.toString=function(){return this.formatName},e.create=function(t){if(!Yu.has(t))throw"".concat(t," not in html5QrcodeSupportedFormatsTextMap");return new e(t,Yu.get(t))},e}(),ef=function(){function e(){}return e.createFromText=function(e){return{decodedText:e,result:{text:e}}},e.createFromQrcodeResult=function(e){return{decodedText:e.text,result:e}},e}();!function(e){e[e.UNKWOWN_ERROR=0]="UNKWOWN_ERROR",e[e.IMPLEMENTATION_ERROR=1]="IMPLEMENTATION_ERROR",e[e.NO_CODE_FOUND_ERROR=2]="NO_CODE_FOUND_ERROR"}(Ku||(Ku={}));var tf=function(){function e(){}return e.createFrom=function(e){return{errorMessage:e,type:Ku.UNKWOWN_ERROR}},e}(),nf=function(){function e(e){this.verbose=e}return e.prototype.log=function(e){this.verbose&&console.log(e)},e.prototype.warn=function(e){this.verbose&&console.warn(e)},e.prototype.logError=function(e,t){(this.verbose||!0===t)&&console.error(e)},e.prototype.logErrors=function(e){if(0===e.length)throw"Logger#logError called without arguments";this.verbose&&console.error(e)},e}();function rf(e){return null==e}var of=function(){function e(){}return e.codeParseError=function(e){return"QR code parse error, error = ".concat(e)},e.errorGettingUserMedia=function(e){return"Error getting userMedia, error = ".concat(e)},e.onlyDeviceSupportedError=function(){return"The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."},e.cameraStreamingNotSupported=function(){return"Camera streaming not supported by the browser."},e.unableToQuerySupportedDevices=function(){return"Unable to query supported devices, unknown error."},e.insecureContextCameraQueryError=function(){return"Camera access is only supported in secure context like https or localhost."},e.scannerPaused=function(){return"Scanner paused"},e}(),sf=function(){function e(){}return e.isMediaStreamConstraintsValid=function(e,t){if("object"!=typeof e){var n=typeof e;return t.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(n,"."),!0),!1}for(var r=new Set(["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"]),i=0,o=Object.keys(e);i<o.length;i++){var s=o[i];if(r.has(s))return t.logError("".concat(s," is not supported videoConstaints."),!0),!1}return!0},e}(),af="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function lf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function cf(e){var t={exports:{}};return e(t,t.exports),t.exports}var df,uf,ff=cf(function(e,t){!function(e){function t(e){return null==e}var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};function r(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function i(e,t){var n=Object.setPrototypeOf;n?n(e,t):e.__proto__=t}function o(e,t){void 0===t&&(t=e.constructor);var n=Error.captureStackTrace;n&&n(e,t)}var s,a=function(e){function t(t){var n=this.constructor,r=e.call(this,t)||this;return Object.defineProperty(r,"name",{value:n.name,enumerable:!1}),i(r,n.prototype),o(r),r}return r(t,e),t}(Error);class l extends a{constructor(e=void 0){super(e),this.message=e}getKind(){return this.constructor.kind}}l.kind="Exception";class c extends l{}c.kind="ArgumentException";class d extends l{}d.kind="IllegalArgumentException";class u{constructor(e){if(this.binarizer=e,null===e)throw new d("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 null!==this.matrix&&void 0!==this.matrix||(this.matrix=this.binarizer.getBlackMatrix()),this.matrix}isCropSupported(){return this.binarizer.getLuminanceSource().isCropSupported()}crop(e,t,n,r){const i=this.binarizer.getLuminanceSource().crop(e,t,n,r);return new u(this.binarizer.createBinarizer(i))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new u(this.binarizer.createBinarizer(e))}rotateCounterClockwise45(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new u(this.binarizer.createBinarizer(e))}toString(){try{return this.getBlackMatrix().toString()}catch(e){return""}}}class f extends l{static getChecksumInstance(){return new f}}f.kind="ChecksumException";class h{constructor(e){this.source=e}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class m{static arraycopy(e,t,n,r,i){for(;i--;)n[r++]=e[t++]}static currentTimeMillis(){return Date.now()}}class p extends l{}p.kind="IndexOutOfBoundsException";class g extends p{constructor(e=void 0,t=void 0){super(t),this.index=e,this.message=t}}g.kind="ArrayIndexOutOfBoundsException";class w{static fill(e,t){for(let n=0,r=e.length;n<r;n++)e[n]=t}static fillWithin(e,t,n,r){w.rangeCheck(e.length,t,n);for(let i=t;i<n;i++)e[i]=r}static rangeCheck(e,t,n){if(t>n)throw new d("fromIndex("+t+") > toIndex("+n+")");if(t<0)throw new g(t);if(n>e)throw new g(n)}static asList(...e){return e}static create(e,t,n){return Array.from({length:e}).map(e=>Array.from({length:t}).fill(n))}static createInt32Array(e,t,n){return Array.from({length:e}).map(e=>Int32Array.from({length:t}).fill(n))}static equals(e,t){if(!e)return!1;if(!t)return!1;if(!e.length)return!1;if(!t.length)return!1;if(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(null===e)return 0;let t=1;for(const n of e)t=31*t+n;return t}static fillUint8Array(e,t){for(let n=0;n!==e.length;n++)e[n]=t}static copyOf(e,t){return e.slice(0,t)}static copyOfUint8Array(e,t){if(e.length<=t){const n=new Uint8Array(t);return n.set(e),n}return e.slice(0,t)}static copyOfRange(e,t,n){const r=n-t,i=new Int32Array(r);return m.arraycopy(e,t,i,0,r),i}static binarySearch(e,t,n){void 0===n&&(n=w.numberComparator);let r=0,i=e.length-1;for(;r<=i;){const o=i+r>>1,s=n(t,e[o]);if(s>0)r=o+1;else{if(!(s<0))return o;i=o-1}}return-r-1}static numberComparator(e,t){return e-t}}class y{static numberOfTrailingZeros(e){let t;if(0===e)return 32;let n=31;return t=e<<16,0!==t&&(n-=16,e=t),t=e<<8,0!==t&&(n-=8,e=t),t=e<<4,0!==t&&(n-=4,e=t),t=e<<2,0!==t&&(n-=2,e=t),n-(e<<1>>>31)}static numberOfLeadingZeros(e){if(0===e)return 32;let t=1;return e>>>16==0&&(t+=16,e<<=16),e>>>24==0&&(t+=8,e<<=8),e>>>28==0&&(t+=4,e<<=4),e>>>30==0&&(t+=2,e<<=2),t-=e>>>31,t}static toHexString(e){return e.toString(16)}static toBinaryString(e){return String(parseInt(String(e),2))}static bitCount(e){return e=(e=(858993459&(e-=e>>>1&1431655765))+(e>>>2&858993459))+(e>>>4)&252645135,e+=e>>>8,63&(e+=e>>>16)}static truncDivision(e,t){return Math.trunc(e/t)}static parseInt(e,t=void 0){return parseInt(e,t)}}y.MIN_VALUE_32_BITS=-2147483648,y.MAX_VALUE=Number.MAX_SAFE_INTEGER;class v{constructor(e,t){void 0===e?(this.size=0,this.bits=new Int32Array(1)):(this.size=e,this.bits=null==t?v.makeArray(e):t)}getSize(){return this.size}getSizeInBytes(){return Math.floor((this.size+7)/8)}ensureCapacity(e){if(e>32*this.bits.length){const t=v.makeArray(e);m.arraycopy(this.bits,0,t,0,this.bits.length),this.bits=t}}get(e){return!!(this.bits[Math.floor(e/32)]&1<<(31&e))}set(e){this.bits[Math.floor(e/32)]|=1<<(31&e)}flip(e){this.bits[Math.floor(e/32)]^=1<<(31&e)}getNextSet(e){const t=this.size;if(e>=t)return t;const n=this.bits;let r=Math.floor(e/32),i=n[r];i&=~((1<<(31&e))-1);const o=n.length;for(;0===i;){if(++r===o)return t;i=n[r]}const s=32*r+y.numberOfTrailingZeros(i);return s>t?t:s}getNextUnset(e){const t=this.size;if(e>=t)return t;const n=this.bits;let r=Math.floor(e/32),i=~n[r];i&=~((1<<(31&e))-1);const o=n.length;for(;0===i;){if(++r===o)return t;i=~n[r]}const s=32*r+y.numberOfTrailingZeros(i);return s>t?t:s}setBulk(e,t){this.bits[Math.floor(e/32)]=t}setRange(e,t){if(t<e||e<0||t>this.size)throw new d;if(t===e)return;t--;const n=Math.floor(e/32),r=Math.floor(t/32),i=this.bits;for(let o=n;o<=r;o++){const s=(2<<(o<r?31:31&t))-(1<<(o>n?0:31&e));i[o]|=s}}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 d;if(t===e)return!0;t--;const r=Math.floor(e/32),i=Math.floor(t/32),o=this.bits;for(let s=r;s<=i;s++){const a=(2<<(s<i?31:31&t))-(1<<(s>r?0:31&e))&4294967295;if((o[s]&a)!==(n?a:0))return!1}return!0}appendBit(e){this.ensureCapacity(this.size+1),e&&(this.bits[Math.floor(this.size/32)]|=1<<(31&this.size)),this.size++}appendBits(e,t){if(t<0||t>32)throw new d("Num bits must be between 0 and 32");this.ensureCapacity(this.size+t);for(let n=t;n>0;n--)this.appendBit(1==(e>>n-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 d("Sizes don't match");const t=this.bits;for(let n=0,r=t.length;n<r;n++)t[n]^=e.bits[n]}toBytes(e,t,n,r){for(let i=0;i<r;i++){let r=0;for(let t=0;t<8;t++)this.get(e)&&(r|=1<<7-t),e++;t[n+i]=r}}getBitArray(){return this.bits}reverse(){const e=new Int32Array(this.bits.length),t=Math.floor((this.size-1)/32),n=t+1,r=this.bits;for(let i=0;i<n;i++){let n=r[i];n=n>>1&1431655765|(1431655765&n)<<1,n=n>>2&858993459|(858993459&n)<<2,n=n>>4&252645135|(252645135&n)<<4,n=n>>8&16711935|(16711935&n)<<8,n=n>>16&65535|(65535&n)<<16,e[t-i]=n}if(this.size!==32*n){const t=32*n-this.size;let r=e[0]>>>t;for(let i=1;i<n;i++){const n=e[i];r|=n<<32-t,e[i-1]=r,r=n>>>t}e[n-1]=r}this.bits=e}static makeArray(e){return new Int32Array(Math.floor((e+31)/32))}equals(e){if(!(e instanceof v))return!1;const t=e;return this.size===t.size&&w.equals(this.bits,t.bits)}hashCode(){return 31*this.size+w.hashCode(this.bits)}toString(){let e="";for(let t=0,n=this.size;t<n;t++)7&t||(e+=" "),e+=this.get(t)?"X":".";return e}clone(){return new v(this.size,this.bits.slice())}}!function(e){e[e.OTHER=0]="OTHER",e[e.PURE_BARCODE=1]="PURE_BARCODE",e[e.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",e[e.TRY_HARDER=3]="TRY_HARDER",e[e.CHARACTER_SET=4]="CHARACTER_SET",e[e.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",e[e.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",e[e.ASSUME_GS1=7]="ASSUME_GS1",e[e.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",e[e.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",e[e.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS"}(s||(s={}));var $,I=s;class _ extends l{static getFormatInstance(){return new _}}_.kind="FormatException",function(e){e[e.Cp437=0]="Cp437",e[e.ISO8859_1=1]="ISO8859_1",e[e.ISO8859_2=2]="ISO8859_2",e[e.ISO8859_3=3]="ISO8859_3",e[e.ISO8859_4=4]="ISO8859_4",e[e.ISO8859_5=5]="ISO8859_5",e[e.ISO8859_6=6]="ISO8859_6",e[e.ISO8859_7=7]="ISO8859_7",e[e.ISO8859_8=8]="ISO8859_8",e[e.ISO8859_9=9]="ISO8859_9",e[e.ISO8859_10=10]="ISO8859_10",e[e.ISO8859_11=11]="ISO8859_11",e[e.ISO8859_13=12]="ISO8859_13",e[e.ISO8859_14=13]="ISO8859_14",e[e.ISO8859_15=14]="ISO8859_15",e[e.ISO8859_16=15]="ISO8859_16",e[e.SJIS=16]="SJIS",e[e.Cp1250=17]="Cp1250",e[e.Cp1251=18]="Cp1251",e[e.Cp1252=19]="Cp1252",e[e.Cp1256=20]="Cp1256",e[e.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",e[e.UTF8=22]="UTF8",e[e.ASCII=23]="ASCII",e[e.Big5=24]="Big5",e[e.GB18030=25]="GB18030",e[e.EUC_KR=26]="EUC_KR"}($||($={}));class C{constructor(e,t,n,...r){this.valueIdentifier=e,this.name=n,this.values="number"==typeof t?Int32Array.from([t]):t,this.otherEncodingNames=r,C.VALUE_IDENTIFIER_TO_ECI.set(e,this),C.NAME_TO_ECI.set(n,this);const i=this.values;for(let e=0,t=i.length;e!==t;e++){const t=i[e];C.VALUES_TO_ECI.set(t,this)}for(const e of r)C.NAME_TO_ECI.set(e,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(e){if(e<0||e>=900)throw new _("incorect value");const t=C.VALUES_TO_ECI.get(e);if(void 0===t)throw new _("incorect value");return t}static getCharacterSetECIByName(e){const t=C.NAME_TO_ECI.get(e);if(void 0===t)throw new _("incorect value");return t}equals(e){if(!(e instanceof C))return!1;const t=e;return this.getName()===t.getName()}}C.VALUE_IDENTIFIER_TO_ECI=new Map,C.VALUES_TO_ECI=new Map,C.NAME_TO_ECI=new Map,C.Cp437=new C($.Cp437,Int32Array.from([0,2]),"Cp437"),C.ISO8859_1=new C($.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),C.ISO8859_2=new C($.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),C.ISO8859_3=new C($.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),C.ISO8859_4=new C($.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),C.ISO8859_5=new C($.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),C.ISO8859_6=new C($.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),C.ISO8859_7=new C($.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),C.ISO8859_8=new C($.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),C.ISO8859_9=new C($.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),C.ISO8859_10=new C($.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),C.ISO8859_11=new C($.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),C.ISO8859_13=new C($.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),C.ISO8859_14=new C($.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),C.ISO8859_15=new C($.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),C.ISO8859_16=new C($.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),C.SJIS=new C($.SJIS,20,"SJIS","Shift_JIS"),C.Cp1250=new C($.Cp1250,21,"Cp1250","windows-1250"),C.Cp1251=new C($.Cp1251,22,"Cp1251","windows-1251"),C.Cp1252=new C($.Cp1252,23,"Cp1252","windows-1252"),C.Cp1256=new C($.Cp1256,24,"Cp1256","windows-1256"),C.UnicodeBigUnmarked=new C($.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),C.UTF8=new C($.UTF8,26,"UTF8","UTF-8"),C.ASCII=new C($.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),C.Big5=new C($.Big5,28,"Big5"),C.GB18030=new C($.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),C.EUC_KR=new C($.EUC_KR,30,"EUC_KR","EUC-KR");class E extends l{}E.kind="UnsupportedOperationException";class A{static decode(e,t){const n=this.encodingName(t);return this.customDecoder?this.customDecoder(e,n):"undefined"==typeof TextDecoder||this.shouldDecodeOnFallback(n)?this.decodeFallback(e,n):new TextDecoder(n).decode(e)}static shouldDecodeOnFallback(e){return!A.isBrowser()&&"ISO-8859-1"===e}static encode(e,t){const n=this.encodingName(t);return this.customEncoder?this.customEncoder(e,n):"undefined"==typeof TextEncoder?this.encodeFallback(e):(new TextEncoder).encode(e)}static isBrowser(){return"undefined"!=typeof window&&"[object Window]"==={}.toString.call(window)}static encodingName(e){return"string"==typeof e?e:e.getName()}static encodingCharacterSet(e){return e instanceof C?e:C.getCharacterSetECIByName(e)}static decodeFallback(e,t){const n=this.encodingCharacterSet(t);if(A.isDecodeFallbackSupported(n)){let t="";for(let n=0,r=e.length;n<r;n++){let r=e[n].toString(16);r.length<2&&(r="0"+r),t+="%"+r}return decodeURIComponent(t)}if(n.equals(C.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(e.buffer));throw new E(`Encoding ${this.encodingName(t)} not supported by fallback.`)}static isDecodeFallbackSupported(e){return e.equals(C.UTF8)||e.equals(C.ISO8859_1)||e.equals(C.ASCII)}static encodeFallback(e){const t=btoa(unescape(encodeURIComponent(e))).split(""),n=[];for(let e=0;e<t.length;e++)n.push(t[e].charCodeAt(0));return new Uint8Array(n)}}class b{static castAsNonUtf8Char(e,t=null){const n=t?t.getName():this.ISO88591;return A.decode(new Uint8Array([e]),n)}static guessEncoding(e,t){if(null!=t&&void 0!==t.get(I.CHARACTER_SET))return t.get(I.CHARACTER_SET).toString();const n=e.length;let r=!0,i=!0,o=!0,s=0,a=0,l=0,c=0,d=0,u=0,f=0,h=0,m=0,p=0,g=0;const w=e.length>3&&239===e[0]&&187===e[1]&&191===e[2];for(let t=0;t<n&&(r||i||o);t++){const n=255&e[t];o&&(s>0?128&n?s--:o=!1:128&n&&(64&n?(s++,32&n?(s++,16&n?(s++,8&n?o=!1:c++):l++):a++):o=!1)),r&&(n>127&&n<160?r=!1:n>159&&(n<192||215===n||247===n)&&g++),i&&(d>0?n<64||127===n||n>252?i=!1:d--:128===n||160===n||n>239?i=!1:n>160&&n<224?(u++,h=0,f++,f>m&&(m=f)):n>127?(d++,f=0,h++,h>p&&(p=h)):(f=0,h=0))}return o&&s>0&&(o=!1),i&&d>0&&(i=!1),o&&(w||a+l+c>0)?b.UTF8:i&&(b.ASSUME_SHIFT_JIS||m>=3||p>=3)?b.SHIFT_JIS:r&&i?2===m&&2===u||10*g>=n?b.SHIFT_JIS:b.ISO88591:r?b.ISO88591:i?b.SHIFT_JIS:o?b.UTF8:b.PLATFORM_DEFAULT_ENCODING}static format(e,...t){let n=-1;function r(e,r,i,o,s,a){if("%%"===e)return"%";if(void 0===t[++n])return;e=o?parseInt(o.substr(1)):void 0;let l,c=s?parseInt(s.substr(1)):void 0;switch(a){case"s":l=t[n];break;case"c":l=t[n][0];break;case"f":l=parseFloat(t[n]).toFixed(e);break;case"p":l=parseFloat(t[n]).toPrecision(e);break;case"e":l=parseFloat(t[n]).toExponential(e);break;case"x":l=parseInt(t[n]).toString(c||16);break;case"d":l=parseFloat(parseInt(t[n],c||10).toPrecision(e)).toFixed(0)}l="object"==typeof l?JSON.stringify(l):(+l).toString(c);let d=parseInt(i),u=i&&i[0]+""=="0"?"0":" ";for(;l.length<d;)l=void 0!==r?l+u:u+l;return l}let i=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(i,r)}static getBytes(e,t){return A.encode(e,t)}static getCharCode(e,t=0){return e.charCodeAt(t)}static getCharAt(e){return String.fromCharCode(e)}}b.SHIFT_JIS=C.SJIS.getName(),b.GB2312="GB2312",b.ISO88591=C.ISO8859_1.getName(),b.EUC_JP="EUC_JP",b.UTF8=C.UTF8.getName(),b.PLATFORM_DEFAULT_ENCODING=b.UTF8,b.ASSUME_SHIFT_JIS=!1;class S{constructor(e=""){this.value=e}enableDecoding(e){return this.encoding=e,this}append(e){return"string"==typeof e?this.value+=e.toString():this.encoding?this.value+=b.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 N{constructor(e,t,n,r){if(this.width=e,this.height=t,this.rowSize=n,this.bits=r,null==t&&(t=e),this.height=t,e<1||t<1)throw new d("Both dimensions must be greater than 0");null==n&&(n=Math.floor((e+31)/32)),this.rowSize=n,null==r&&(this.bits=new Int32Array(this.rowSize*this.height))}static parseFromBooleanArray(e){const t=e.length,n=e[0].length,r=new N(n,t);for(let i=0;i<t;i++){const t=e[i];for(let e=0;e<n;e++)t[e]&&r.set(e,i)}return r}static parseFromString(e,t,n){if(null===e)throw new d("stringRepresentation cannot be null");const r=new Array(e.length);let i=0,o=0,s=-1,a=0,l=0;for(;l<e.length;)if("\n"===e.charAt(l)||"\r"===e.charAt(l)){if(i>o){if(-1===s)s=i-o;else if(i-o!==s)throw new d("row lengths do not match");o=i,a++}l++}else if(e.substring(l,l+t.length)===t)l+=t.length,r[i]=!0,i++;else{if(e.substring(l,l+n.length)!==n)throw new d("illegal character encountered: "+e.substring(l));l+=n.length,r[i]=!1,i++}if(i>o){if(-1===s)s=i-o;else if(i-o!==s)throw new d("row lengths do not match");a++}const c=new N(s,a);for(let e=0;e<i;e++)r[e]&&c.set(Math.floor(e%s),Math.floor(e/s));return c}get(e,t){const n=t*this.rowSize+Math.floor(e/32);return!!(this.bits[n]>>>(31&e)&1)}set(e,t){const n=t*this.rowSize+Math.floor(e/32);this.bits[n]|=1<<(31&e)&4294967295}unset(e,t){const n=t*this.rowSize+Math.floor(e/32);this.bits[n]&=~(1<<(31&e)&4294967295)}flip(e,t){const n=t*this.rowSize+Math.floor(e/32);this.bits[n]^=1<<(31&e)&4294967295}xor(e){if(this.width!==e.getWidth()||this.height!==e.getHeight()||this.rowSize!==e.getRowSize())throw new d("input matrix dimensions do not match");const t=new v(Math.floor(this.width/32)+1),n=this.rowSize,r=this.bits;for(let i=0,o=this.height;i<o;i++){const o=i*n,s=e.getRow(i,t).getBitArray();for(let e=0;e<n;e++)r[o+e]^=s[e]}}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 d("Left and top must be nonnegative");if(r<1||n<1)throw new d("Height and width must be at least 1");const i=e+n,o=t+r;if(o>this.height||i>this.width)throw new d("The region must fit inside the matrix");const s=this.rowSize,a=this.bits;for(let n=t;n<o;n++){const t=n*s;for(let n=e;n<i;n++)a[t+Math.floor(n/32)]|=1<<(31&n)&4294967295}}getRow(e,t){null==t||t.getSize()<this.width?t=new v(this.width):t.clear();const n=this.rowSize,r=this.bits,i=e*n;for(let e=0;e<n;e++)t.setBulk(32*e,r[i+e]);return t}setRow(e,t){m.arraycopy(t.getBitArray(),0,this.bits,e*this.rowSize,this.rowSize)}rotate180(){const e=this.getWidth(),t=this.getHeight();let n=new v(e),r=new v(e);for(let e=0,i=Math.floor((t+1)/2);e<i;e++)n=this.getRow(e,n),r=this.getRow(t-1-e,r),n.reverse(),r.reverse(),this.setRow(e,r),this.setRow(t-1-e,n)}getEnclosingRectangle(){const e=this.width,t=this.height,n=this.rowSize,r=this.bits;let i=e,o=t,s=-1,a=-1;for(let e=0;e<t;e++)for(let t=0;t<n;t++){const l=r[e*n+t];if(0!==l){if(e<o&&(o=e),e>a&&(a=e),32*t<i){let e=0;for(;!(l<<31-e&4294967295);)e++;32*t+e<i&&(i=32*t+e)}if(32*t+31>s){let e=31;for(;l>>>e===0;)e--;32*t+e>s&&(s=32*t+e)}}}return s<i||a<o?null:Int32Array.from([i,o,s-i+1,a-o+1])}getTopLeftOnBit(){const e=this.rowSize,t=this.bits;let n=0;for(;n<t.length&&0===t[n];)n++;if(n===t.length)return null;const r=n/e;let i=n%e*32;const o=t[n];let s=0;for(;!(o<<31-s&4294967295);)s++;return i+=s,Int32Array.from([i,r])}getBottomRightOnBit(){const e=this.rowSize,t=this.bits;let n=t.length-1;for(;n>=0&&0===t[n];)n--;if(n<0)return null;const r=Math.floor(n/e);let i=32*Math.floor(n%e);const o=t[n];let s=31;for(;o>>>s===0;)s--;return i+=s,Int32Array.from([i,r])}getWidth(){return this.width}getHeight(){return this.height}getRowSize(){return this.rowSize}equals(e){if(!(e instanceof N))return!1;const t=e;return this.width===t.width&&this.height===t.height&&this.rowSize===t.rowSize&&w.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+w.hashCode(this.bits),e}toString(e="X ",t=" ",n="\n"){return this.buildToString(e,t,n)}buildToString(e,t,n){let r=new S;for(let i=0,o=this.height;i<o;i++){for(let n=0,o=this.width;n<o;n++)r.append(this.get(n,i)?e:t);r.append(n)}return r.toString()}clone(){return new N(this.width,this.height,this.rowSize,this.bits.slice())}}class T extends l{static getNotFoundInstance(){return new T}}T.kind="NotFoundException";class R extends h{constructor(e){super(e),this.luminances=R.EMPTY,this.buckets=new Int32Array(R.LUMINANCE_BUCKETS)}getBlackRow(e,t){const n=this.getLuminanceSource(),r=n.getWidth();null==t||t.getSize()<r?t=new v(r):t.clear(),this.initArrays(r);const i=n.getRow(e,this.luminances),o=this.buckets;for(let e=0;e<r;e++)o[(255&i[e])>>R.LUMINANCE_SHIFT]++;const s=R.estimateBlackPoint(o);if(r<3)for(let e=0;e<r;e++)(255&i[e])<s&&t.set(e);else{let e=255&i[0],n=255&i[1];for(let o=1;o<r-1;o++){const r=255&i[o+1];(4*n-e-r)/2<s&&t.set(o),e=n,n=r}}return t}getBlackMatrix(){const e=this.getLuminanceSource(),t=e.getWidth(),n=e.getHeight(),r=new N(t,n);this.initArrays(t);const i=this.buckets;for(let r=1;r<5;r++){const o=Math.floor(n*r/5),s=e.getRow(o,this.luminances),a=Math.floor(4*t/5);for(let e=Math.floor(t/5);e<a;e++)i[(255&s[e])>>R.LUMINANCE_SHIFT]++}const o=R.estimateBlackPoint(i),s=e.getMatrix();for(let e=0;e<n;e++){const n=e*t;for(let i=0;i<t;i++)(255&s[n+i])<o&&r.set(i,e)}return r}createBinarizer(e){return new R(e)}initArrays(e){this.luminances.length<e&&(this.luminances=new Uint8ClampedArray(e));const t=this.buckets;for(let e=0;e<R.LUMINANCE_BUCKETS;e++)t[e]=0}static estimateBlackPoint(e){const t=e.length;let n=0,r=0,i=0;for(let o=0;o<t;o++)e[o]>i&&(r=o,i=e[o]),e[o]>n&&(n=e[o]);let o=0,s=0;for(let n=0;n<t;n++){const t=n-r,i=e[n]*t*t;i>s&&(o=n,s=i)}if(r>o){const e=r;r=o,o=e}if(o-r<=t/16)throw new T;let a=o-1,l=-1;for(let t=o-1;t>r;t--){const i=t-r,s=i*i*(o-t)*(n-e[t]);s>l&&(a=t,l=s)}return a<<R.LUMINANCE_SHIFT}}R.LUMINANCE_BITS=5,R.LUMINANCE_SHIFT=8-R.LUMINANCE_BITS,R.LUMINANCE_BUCKETS=1<<R.LUMINANCE_BITS,R.EMPTY=Uint8ClampedArray.from([0]);class D extends R{constructor(e){super(e),this.matrix=null}getBlackMatrix(){if(null!==this.matrix)return this.matrix;const e=this.getLuminanceSource(),t=e.getWidth(),n=e.getHeight();if(t>=D.MINIMUM_DIMENSION&&n>=D.MINIMUM_DIMENSION){const r=e.getMatrix();let i=t>>D.BLOCK_SIZE_POWER;0!==(t&D.BLOCK_SIZE_MASK)&&i++;let o=n>>D.BLOCK_SIZE_POWER;0!==(n&D.BLOCK_SIZE_MASK)&&o++;const s=D.calculateBlackPoints(r,i,o,t,n),a=new N(t,n);D.calculateThresholdForBlock(r,i,o,t,n,s,a),this.matrix=a}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(e){return new D(e)}static calculateThresholdForBlock(e,t,n,r,i,o,s){const a=i-D.BLOCK_SIZE,l=r-D.BLOCK_SIZE;for(let i=0;i<n;i++){let c=i<<D.BLOCK_SIZE_POWER;c>a&&(c=a);const d=D.cap(i,2,n-3);for(let n=0;n<t;n++){let i=n<<D.BLOCK_SIZE_POWER;i>l&&(i=l);const a=D.cap(n,2,t-3);let u=0;for(let e=-2;e<=2;e++){const t=o[d+e];u+=t[a-2]+t[a-1]+t[a]+t[a+1]+t[a+2]}const f=u/25;D.thresholdBlock(e,i,c,f,r,s)}}}static cap(e,t,n){return e<t?t:e>n?n:e}static thresholdBlock(e,t,n,r,i,o){for(let s=0,a=n*i+t;s<D.BLOCK_SIZE;s++,a+=i)for(let i=0;i<D.BLOCK_SIZE;i++)(255&e[a+i])<=r&&o.set(t+i,n+s)}static calculateBlackPoints(e,t,n,r,i){const o=i-D.BLOCK_SIZE,s=r-D.BLOCK_SIZE,a=new Array(n);for(let i=0;i<n;i++){a[i]=new Int32Array(t);let n=i<<D.BLOCK_SIZE_POWER;n>o&&(n=o);for(let o=0;o<t;o++){let t=o<<D.BLOCK_SIZE_POWER;t>s&&(t=s);let l=0,c=255,d=0;for(let i=0,o=n*r+t;i<D.BLOCK_SIZE;i++,o+=r){for(let t=0;t<D.BLOCK_SIZE;t++){const n=255&e[o+t];l+=n,n<c&&(c=n),n>d&&(d=n)}if(d-c>D.MIN_DYNAMIC_RANGE)for(i++,o+=r;i<D.BLOCK_SIZE;i++,o+=r)for(let t=0;t<D.BLOCK_SIZE;t++)l+=255&e[o+t]}let u=l>>2*D.BLOCK_SIZE_POWER;if(d-c<=D.MIN_DYNAMIC_RANGE&&(u=c/2,i>0&&o>0)){const e=(a[i-1][o]+2*a[i][o-1]+a[i-1][o-1])/4;c<e&&(u=e)}a[i][o]=u}}return a}}D.BLOCK_SIZE_POWER=3,D.BLOCK_SIZE=1<<D.BLOCK_SIZE_POWER,D.BLOCK_SIZE_MASK=D.BLOCK_SIZE-1,D.MINIMUM_DIMENSION=5*D.BLOCK_SIZE,D.MIN_DYNAMIC_RANGE=24;class x{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 E("This luminance source does not support cropping.")}isRotateSupported(){return!1}rotateCounterClockwise(){throw new E("This luminance source does not support rotation by 90 degrees.")}rotateCounterClockwise45(){throw new E("This luminance source does not support rotation by 45 degrees.")}toString(){const e=new Uint8ClampedArray(this.width);let t=new S;for(let n=0;n<this.height;n++){const r=this.getRow(n,e);for(let e=0;e<this.width;e++){const n=255&r[e];let i;i=n<64?"#":n<128?"+":n<192?".":" ",t.append(i)}t.append("\n")}return t.toString()}}class k extends x{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 e=0;e<r;e++)n[e]=255-(255&n[e]);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-(255&e[r]);return n}isCropSupported(){return this.delegate.isCropSupported()}crop(e,t,n,r){return new k(this.delegate.crop(e,t,n,r))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new k(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new k(this.delegate.rotateCounterClockwise45())}}class O extends x{constructor(e){super(e.width,e.height),this.canvas=e,this.tempCanvasElement=null,this.buffer=O.makeBufferFromCanvasImageData(e)}static makeBufferFromCanvasImageData(e){const t=e.getContext("2d").getImageData(0,0,e.width,e.height);return O.toGrayscaleBuffer(t.data,e.width,e.height)}static toGrayscaleBuffer(e,t,n){const r=new Uint8ClampedArray(t*n);for(let t=0,n=0,i=e.length;t<i;t+=4,n++){let i;i=0===e[t+3]?255:306*e[t]+601*e[t+1]+117*e[t+2]+512>>10,r[n]=i}return r}getRow(e,t){if(e<0||e>=this.getHeight())throw new d("Requested row is outside the image: "+e);const n=this.getWidth(),r=e*n;return null===t?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(null===this.tempCanvasElement){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*O.DEGREE_TO_RADIANS,i=this.canvas.width,o=this.canvas.height,s=Math.ceil(Math.abs(Math.cos(r))*i+Math.abs(Math.sin(r))*o),a=Math.ceil(Math.abs(Math.sin(r))*i+Math.abs(Math.cos(r))*o);return t.width=s,t.height=a,n.translate(s/2,a/2),n.rotate(r),n.drawImage(this.canvas,i/-2,o/-2),this.buffer=O.makeBufferFromCanvasImageData(t),this}invert(){return new k(this)}}O.DEGREE_TO_RADIANS=Math.PI/180;class M{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 P,B=(globalThis||af||self||window?(globalThis||af||self||window||void 0).__awaiter:void 0)||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?n(e.value):i(e.value).then(s,a)}l((r=r.apply(e,t||[])).next())})};class L{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"undefined"!=typeof navigator}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 B(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 e="video"===n.kind?"videoinput":n.kind;if("videoinput"!==e)continue;const r={deviceId:n.deviceId||n.id,label:n.label||`Video device ${t.length+1}`,kind:e,groupId:n.groupId};t.push(r)}return t})}getVideoInputDevices(){return B(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(e=>new M(e.deviceId,e.label))})}findDeviceById(e){return B(this,void 0,void 0,function*(){const t=yield this.listVideoInputDevices();return t?t.find(t=>t.deviceId===e):null})}decodeFromInputVideoDevice(e,t){return B(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(e,t)})}decodeOnceFromVideoDevice(e,t){return B(this,void 0,void 0,function*(){let n;this.reset(),n=e?{deviceId:{exact:e}}:{facingMode:"environment"};const r={video:n};return yield this.decodeOnceFromConstraints(r,t)})}decodeOnceFromConstraints(e,t){return B(this,void 0,void 0,function*(){const n=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeOnceFromStream(n,t)})}decodeOnceFromStream(e,t){return B(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 B(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(e,t,n)})}decodeFromVideoDevice(e,t,n){return B(this,void 0,void 0,function*(){let r;r=e?{deviceId:{exact:e}}:{facingMode:"environment"};const i={video:r};return yield this.decodeFromConstraints(i,t,n)})}decodeFromConstraints(e,t,n){return B(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 B(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 B(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 B(this,void 0,void 0,function*(){if(this.isVideoPlaying(e))console.warn("Trying to play video that is already playing.");else try{yield e.play()}catch(e){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(void 0===e&&void 0===t)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);let n;return this.imageElement=t,n=this.isImageLoaded(t)?this.decodeOnce(t,!1,!0):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 B(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(e),yield this.decodeOnce(e)})}_decodeOnLoadVideoContinuously(e,t){return B(this,void 0,void 0,function*(){yield this.playVideoOnLoadAsync(e),this.decodeContinuously(e,t)})}isImageLoaded(e){return!!e.complete&&0!==e.naturalWidth}prepareImageElement(e){let t;return void 0===e&&(t=document.createElement("img"),t.width=200,t.height=200),"string"==typeof e&&(t=this.getMediaElement(e,"img")),e instanceof HTMLImageElement&&(t=e),t}prepareVideoElement(e){let t;return e||"undefined"==typeof document||(t=document.createElement("video"),t.width=200,t.height=200),"string"==typeof e&&(t=this.getMediaElement(e,"video")),e instanceof HTMLVideoElement&&(t=e),t.setAttribute("autoplay","true"),t.setAttribute("muted","true"),t.setAttribute("playsinline","true"),t}decodeOnce(e,t=!0,n=!0){this._stopAsyncDecode=!1;const r=(i,o)=>{if(this._stopAsyncDecode)return o(new T("Video stream has ended before any code could be detected.")),void(this._stopAsyncDecode=void 0);try{i(this.decode(e))}catch(e){if(t&&e instanceof T||(e instanceof f||e instanceof _)&&n)return setTimeout(r,this._timeBetweenDecodingAttempts,i,o);o(e)}};return new Promise((e,t)=>r(e,t))}decodeContinuously(e,t){this._stopContinuousDecode=!1;const n=()=>{if(this._stopContinuousDecode)this._stopContinuousDecode=void 0;else try{const r=this.decode(e);t(r,null),setTimeout(n,this.timeBetweenScansMillis)}catch(e){t(null,e),(e instanceof f||e instanceof _||e instanceof T)&&setTimeout(n,this._timeBetweenDecodingAttempts)}};n()}decode(e){const t=this.createBinaryBitmap(e);return this.decodeBitmap(t)}_isHTMLVideoElement(e){return 0!==e.videoWidth}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 O(t),r=new D(n);return new u(r)}getCaptureCanvasContext(e){if(!this.captureCanvasContext){const t=this.getCaptureCanvas(e).getContext("2d");this.captureCanvasContext=t}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("undefined"==typeof document)return this._destroyCaptureCanvas(),null;const t=document.createElement("canvas");let n,r;return void 0!==e&&(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),!1===this._stopAsyncDecode&&this.stopAsyncDecode(),!1===this._stopContinuousDecode&&this.stopContinuousDecode()}reset(){this.stopStreams(),this._destroyVideoElement(),this._destroyImageElement(),this._destroyCaptureCanvas()}_destroyVideoElement(){this.videoElement&&(void 0!==this.videoEndedListener&&this.videoElement.removeEventListener("ended",this.videoEndedListener),void 0!==this.videoPlayingEventListener&&this.videoElement.removeEventListener("playing",this.videoPlayingEventListener),void 0!==this.videoCanPlayListener&&this.videoElement.removeEventListener("loadedmetadata",this.videoCanPlayListener),this.cleanVideoSource(this.videoElement),this.videoElement=void 0)}_destroyImageElement(){this.imageElement&&(void 0!==this.imageLoadedListener&&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(n){e.src=URL.createObjectURL(t)}}cleanVideoSource(e){try{e.srcObject=null}catch(t){e.src=""}this.videoElement.removeAttribute("src")}}class F{constructor(e,t,n=(null==t?0:8*t.length),r,i,o=m.currentTimeMillis()){this.text=e,this.rawBytes=t,this.numBits=n,this.resultPoints=r,this.format=i,this.timestamp=o,this.text=e,this.rawBytes=t,this.numBits=null==n?null==t?0:8*t.length:n,this.resultPoints=r,this.format=i,this.resultMetadata=null,this.timestamp=null==o?m.currentTimeMillis():o}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){null===this.resultMetadata&&(this.resultMetadata=new Map),this.resultMetadata.set(e,t)}putAllMetadata(e){null!==e&&(null===this.resultMetadata?this.resultMetadata=e:this.resultMetadata=new Map(e))}addResultPoints(e){const t=this.resultPoints;if(null===t)this.resultPoints=e;else if(null!==e&&e.length>0){const n=new Array(t.length+e.length);m.arraycopy(t,0,n,0,t.length),m.arraycopy(e,0,n,t.length,e.length),this.resultPoints=n}}getTimestamp(){return this.timestamp}toString(){return this.text}}!function(e){e[e.AZTEC=0]="AZTEC",e[e.CODABAR=1]="CODABAR",e[e.CODE_39=2]="CODE_39",e[e.CODE_93=3]="CODE_93",e[e.CODE_128=4]="CODE_128",e[e.DATA_MATRIX=5]="DATA_MATRIX",e[e.EAN_8=6]="EAN_8",e[e.EAN_13=7]="EAN_13",e[e.ITF=8]="ITF",e[e.MAXICODE=9]="MAXICODE",e[e.PDF_417=10]="PDF_417",e[e.QR_CODE=11]="QR_CODE",e[e.RSS_14=12]="RSS_14",e[e.RSS_EXPANDED=13]="RSS_EXPANDED",e[e.UPC_A=14]="UPC_A",e[e.UPC_E=15]="UPC_E",e[e.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"}(P||(P={}));var V,U=P;!function(e){e[e.OTHER=0]="OTHER",e[e.ORIENTATION=1]="ORIENTATION",e[e.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",e[e.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",e[e.ISSUE_NUMBER=4]="ISSUE_NUMBER",e[e.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",e[e.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",e[e.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",e[e.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",e[e.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",e[e.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY"}(V||(V={}));var W,z,H,j,q,G,X=V;class Y{constructor(e,t,n,r,i=-1,o=-1){this.rawBytes=e,this.text=t,this.byteSegments=n,this.ecLevel=r,this.structuredAppendSequenceNumber=i,this.structuredAppendParity=o,this.numBits=null==e?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 Z{exp(e){return this.expTable[e]}log(e){if(0===e)throw new d;return this.logTable[e]}static addOrSubtract(e,t){return e^t}}class K{constructor(e,t){if(0===t.length)throw new d;this.field=e;const n=t.length;if(n>1&&0===t[0]){let e=1;for(;e<n&&0===t[e];)e++;e===n?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(n-e),m.arraycopy(t,e,this.coefficients,0,this.coefficients.length))}else this.coefficients=t}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return 0===this.coefficients[0]}getCoefficient(e){return this.coefficients[this.coefficients.length-1-e]}evaluateAt(e){if(0===e)return this.getCoefficient(0);const t=this.coefficients;let n;if(1===e){n=0;for(let e=0,r=t.length;e!==r;e++){const r=t[e];n=Z.addOrSubtract(n,r)}return n}n=t[0];const r=t.length,i=this.field;for(let o=1;o<r;o++)n=Z.addOrSubtract(i.multiply(e,n),t[o]);return n}addOrSubtract(e){if(!this.field.equals(e.field))throw new d("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 e=t;t=n,n=e}let r=new Int32Array(n.length);const i=n.length-t.length;m.arraycopy(n,0,r,0,i);for(let e=i;e<n.length;e++)r[e]=Z.addOrSubtract(t[e-i],n[e]);return new K(this.field,r)}multiply(e){if(!this.field.equals(e.field))throw new d("GenericGFPolys do not have same GenericGF field");if(this.isZero()||e.isZero())return this.field.getZero();const t=this.coefficients,n=t.length,r=e.coefficients,i=r.length,o=new Int32Array(n+i-1),s=this.field;for(let e=0;e<n;e++){const n=t[e];for(let t=0;t<i;t++)o[e+t]=Z.addOrSubtract(o[e+t],s.multiply(n,r[t]))}return new K(s,o)}multiplyScalar(e){if(0===e)return this.field.getZero();if(1===e)return this;const t=this.coefficients.length,n=this.field,r=new Int32Array(t),i=this.coefficients;for(let o=0;o<t;o++)r[o]=n.multiply(i[o],e);return new K(n,r)}multiplyByMonomial(e,t){if(e<0)throw new d;if(0===t)return this.field.getZero();const n=this.coefficients,r=n.length,i=new Int32Array(r+e),o=this.field;for(let e=0;e<r;e++)i[e]=o.multiply(n[e],t);return new K(o,i)}divide(e){if(!this.field.equals(e.field))throw new d("GenericGFPolys do not have same GenericGF field");if(e.isZero())throw new d("Divide by 0");const t=this.field;let n=t.getZero(),r=this;const i=e.getCoefficient(e.getDegree()),o=t.inverse(i);for(;r.getDegree()>=e.getDegree()&&!r.isZero();){const i=r.getDegree()-e.getDegree(),s=t.multiply(r.getCoefficient(r.getDegree()),o),a=e.multiplyByMonomial(i,s),l=t.buildMonomial(i,s);n=n.addOrSubtract(l),r=r.addOrSubtract(a)}return[n,r]}toString(){let e="";for(let t=this.getDegree();t>=0;t--){let n=this.getCoefficient(t);if(0!==n){if(n<0?(e+=" - ",n=-n):e.length>0&&(e+=" + "),0===t||1!==n){const t=this.field.log(n);0===t?e+="1":1===t?e+="a":(e+="a^",e+=t)}0!==t&&(1===t?e+="x":(e+="x^",e+=t))}}return e}}class Q extends l{}Q.kind="ArithmeticException";class J extends Z{constructor(e,t,n){super(),this.primitive=e,this.size=t,this.generatorBase=n;const r=new Int32Array(t);let i=1;for(let n=0;n<t;n++)r[n]=i,i*=2,i>=t&&(i^=e,i&=t-1);this.expTable=r;const o=new Int32Array(t);for(let e=0;e<t-1;e++)o[r[e]]=e;this.logTable=o,this.zero=new K(this,Int32Array.from([0])),this.one=new K(this,Int32Array.from([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new d;if(0===t)return this.zero;const n=new Int32Array(e+1);return n[0]=t,new K(this,n)}inverse(e){if(0===e)throw new Q;return this.expTable[this.size-this.logTable[e]-1]}multiply(e,t){return 0===e||0===t?0:this.expTable[(this.logTable[e]+this.logTable[t])%(this.size-1)]}getSize(){return this.size}getGeneratorBase(){return this.generatorBase}toString(){return"GF(0x"+y.toHexString(this.primitive)+","+this.size+")"}equals(e){return e===this}}J.AZTEC_DATA_12=new J(4201,4096,1),J.AZTEC_DATA_10=new J(1033,1024,1),J.AZTEC_DATA_6=new J(67,64,1),J.AZTEC_PARAM=new J(19,16,1),J.QR_CODE_FIELD_256=new J(285,256,0),J.DATA_MATRIX_FIELD_256=new J(301,256,1),J.AZTEC_DATA_8=J.DATA_MATRIX_FIELD_256,J.MAXICODE_FIELD_64=J.AZTEC_DATA_6;class ee extends l{}ee.kind="ReedSolomonException";class te extends l{}te.kind="IllegalStateException";class ne{constructor(e){this.field=e}decode(e,t){const n=this.field,r=new K(n,e),i=new Int32Array(t);let o=!0;for(let e=0;e<t;e++){const t=r.evaluateAt(n.exp(e+n.getGeneratorBase()));i[i.length-1-e]=t,0!==t&&(o=!1)}if(o)return;const s=new K(n,i),a=this.runEuclideanAlgorithm(n.buildMonomial(t,1),s,t),l=a[0],c=a[1],d=this.findErrorLocations(l),u=this.findErrorMagnitudes(c,d);for(let t=0;t<d.length;t++){const r=e.length-1-n.log(d[t]);if(r<0)throw new ee("Bad error location");e[r]=J.addOrSubtract(e[r],u[t])}}runEuclideanAlgorithm(e,t,n){if(e.getDegree()<t.getDegree()){const n=e;e=t,t=n}const r=this.field;let i=e,o=t,s=r.getZero(),a=r.getOne();for(;o.getDegree()>=(n/2|0);){let e=i,t=s;if(i=o,s=a,i.isZero())throw new ee("r_{i-1} was zero");o=e;let n=r.getZero();const l=i.getCoefficient(i.getDegree()),c=r.inverse(l);for(;o.getDegree()>=i.getDegree()&&!o.isZero();){const e=o.getDegree()-i.getDegree(),t=r.multiply(o.getCoefficient(o.getDegree()),c);n=n.addOrSubtract(r.buildMonomial(e,t)),o=o.addOrSubtract(i.multiplyByMonomial(e,t))}if(a=n.multiply(s).addOrSubtract(t),o.getDegree()>=i.getDegree())throw new te("Division algorithm failed to reduce polynomial?")}const l=a.getCoefficient(0);if(0===l)throw new ee("sigmaTilde(0) was zero");const c=r.inverse(l);return[a.multiplyScalar(c),o.multiplyScalar(c)]}findErrorLocations(e){const t=e.getDegree();if(1===t)return Int32Array.from([e.getCoefficient(1)]);const n=new Int32Array(t);let r=0;const i=this.field;for(let o=1;o<i.getSize()&&r<t;o++)0===e.evaluateAt(o)&&(n[r]=i.inverse(o),r++);if(r!==t)throw new ee("Error locator degree does not match number of roots");return n}findErrorMagnitudes(e,t){const n=t.length,r=new Int32Array(n),i=this.field;for(let o=0;o<n;o++){const s=i.inverse(t[o]);let a=1;for(let e=0;e<n;e++)if(o!==e){const n=i.multiply(t[e],s),r=1&n?-2&n:1|n;a=i.multiply(a,r)}r[o]=i.multiply(e.evaluateAt(s),i.inverse(a)),0!==i.getGeneratorBase()&&(r[o]=i.multiply(r[o],s))}return r}}!function(e){e[e.UPPER=0]="UPPER",e[e.LOWER=1]="LOWER",e[e.MIXED=2]="MIXED",e[e.DIGIT=3]="DIGIT",e[e.PUNCT=4]="PUNCT",e[e.BINARY=5]="BINARY"}(W||(W={}));class re{decode(e){this.ddata=e;let t=e.getBits(),n=this.extractBits(t),r=this.correctBits(n),i=re.convertBoolArrayToByteArray(r),o=re.getEncodedData(r),s=new Y(i,o,null,null);return s.setNumBits(r.length),s}static highLevelDecode(e){return this.getEncodedData(e)}static getEncodedData(e){let t=e.length,n=W.UPPER,r=W.UPPER,i="",o=0;for(;o<t;)if(r===W.BINARY){if(t-o<5)break;let s=re.readCode(e,o,5);if(o+=5,0===s){if(t-o<11)break;s=re.readCode(e,o,11)+31,o+=11}for(let n=0;n<s;n++){if(t-o<8){o=t;break}const n=re.readCode(e,o,8);i+=b.castAsNonUtf8Char(n),o+=8}r=n}else{let s=r===W.DIGIT?4:5;if(t-o<s)break;let a=re.readCode(e,o,s);o+=s;let l=re.getCharacter(r,a);l.startsWith("CTRL_")?(n=r,r=re.getTable(l.charAt(5)),"L"===l.charAt(6)&&(n=r)):(i+=l,r=n)}return i}static getTable(e){switch(e){case"L":return W.LOWER;case"P":return W.PUNCT;case"M":return W.MIXED;case"D":return W.DIGIT;case"B":return W.BINARY;default:return W.UPPER}}static getCharacter(e,t){switch(e){case W.UPPER:return re.UPPER_TABLE[t];case W.LOWER:return re.LOWER_TABLE[t];case W.MIXED:return re.MIXED_TABLE[t];case W.PUNCT:return re.PUNCT_TABLE[t];case W.DIGIT:return re.DIGIT_TABLE[t];default:throw new te("Bad table")}}correctBits(e){let t,n;this.ddata.getNbLayers()<=2?(n=6,t=J.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(n=8,t=J.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(n=10,t=J.AZTEC_DATA_10):(n=12,t=J.AZTEC_DATA_12);let r=this.ddata.getNbDatablocks(),i=e.length/n;if(i<r)throw new _;let o=e.length%n,s=new Int32Array(i);for(let t=0;t<i;t++,o+=n)s[t]=re.readCode(e,o,n);try{new ne(t).decode(s,i-r)}catch(e){throw new _(e)}let a=(1<<n)-1,l=0;for(let e=0;e<r;e++){let t=s[e];if(0===t||t===a)throw new _;1!==t&&t!==a-1||l++}let c=new Array(r*n-l),d=0;for(let e=0;e<r;e++){let t=s[e];if(1===t||t===a-1)c.fill(t>1,d,d+n-1),d+=n-1;else for(let e=n-1;e>=0;--e)c[d++]=!!(t&1<<e)}return c}extractBits(e){let t=this.ddata.isCompact(),n=this.ddata.getNbLayers(),r=(t?11:14)+4*n,i=new Int32Array(r),o=new Array(this.totalBitsInLayer(n,t));if(t)for(let e=0;e<i.length;e++)i[e]=e;else{let e=r+1+2*y.truncDivision(y.truncDivision(r,2)-1,15),t=r/2,n=y.truncDivision(e,2);for(let e=0;e<t;e++){let r=e+y.truncDivision(e,15);i[t-e-1]=n-r-1,i[t+e]=n+r+1}}for(let s=0,a=0;s<n;s++){let l=4*(n-s)+(t?9:12),c=2*s,d=r-1-c;for(let t=0;t<l;t++){let n=2*t;for(let r=0;r<2;r++)o[a+n+r]=e.get(i[c+r],i[c+t]),o[a+2*l+n+r]=e.get(i[c+t],i[d-r]),o[a+4*l+n+r]=e.get(i[d-r],i[d-t]),o[a+6*l+n+r]=e.get(i[d-t],i[c+r])}a+=8*l}return o}static readCode(e,t,n){let r=0;for(let i=t;i<t+n;i++)r<<=1,e[i]&&(r|=1);return r}static readByte(e,t){let n=e.length-t;return n>=8?re.readCode(e,t,8):re.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]=re.readByte(e,8*n);return t}totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}re.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"],re.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"],re.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b","\t","\n","\\13","\f","\r","\\33","\\34","\\35","\\36","\\37","@","\\","^","_","`","|","~","\\177","CTRL_LL","CTRL_UL","CTRL_PL","CTRL_BS"],re.PUNCT_TABLE=["","\r","\r\n",". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],re.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class ie{constructor(){}static round(e){return NaN===e?0:e<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:e>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:e+(e<0?-.5:.5)|0}static distance(e,t,n,r){const i=e-n,o=t-r;return Math.sqrt(i*i+o*o)}static sum(e){let t=0;for(let n=0,r=e.length;n!==r;n++)t+=e[n];return t}}class oe{static floatToIntBits(e){return e}}oe.MAX_VALUE=Number.MAX_SAFE_INTEGER;class se{constructor(e,t){this.x=e,this.y=t}getX(){return this.x}getY(){return this.y}equals(e){if(e instanceof se){const t=e;return this.x===t.x&&this.y===t.y}return!1}hashCode(){return 31*oe.floatToIntBits(this.x)+oe.floatToIntBits(this.y)}toString(){return"("+this.x+","+this.y+")"}static orderBestPatterns(e){const t=this.distance(e[0],e[1]),n=this.distance(e[1],e[2]),r=this.distance(e[0],e[2]);let i,o,s;if(n>=t&&n>=r?(o=e[0],i=e[1],s=e[2]):r>=n&&r>=t?(o=e[1],i=e[0],s=e[2]):(o=e[2],i=e[0],s=e[1]),this.crossProductZ(i,o,s)<0){const e=i;i=s,s=e}e[0]=i,e[1]=o,e[2]=s}static distance(e,t){return ie.distance(e.x,e.y,t.x,t.y)}static crossProductZ(e,t,n){const r=t.x,i=t.y;return(n.x-r)*(e.y-i)-(n.y-i)*(e.x-r)}}class ae{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class le extends ae{constructor(e,t,n,r,i){super(e,t),this.compact=n,this.nbDatablocks=r,this.nbLayers=i}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class ce{constructor(e,t,n,r){this.image=e,this.height=e.getHeight(),this.width=e.getWidth(),null==t&&(t=ce.INIT_SIZE),null==n&&(n=e.getWidth()/2|0),null==r&&(r=e.getHeight()/2|0);const i=t/2|0;if(this.leftInit=n-i,this.rightInit=n+i,this.upInit=r-i,this.downInit=r+i,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new T}detect(){let e=this.leftInit,t=this.rightInit,n=this.upInit,r=this.downInit,i=!1,o=!0,s=!1,a=!1,l=!1,c=!1,d=!1;const u=this.width,f=this.height;for(;o;){o=!1;let h=!0;for(;(h||!a)&&t<u;)h=this.containsBlackPoint(n,r,t,!1),h?(t++,o=!0,a=!0):a||t++;if(t>=u){i=!0;break}let m=!0;for(;(m||!l)&&r<f;)m=this.containsBlackPoint(e,t,r,!0),m?(r++,o=!0,l=!0):l||r++;if(r>=f){i=!0;break}let p=!0;for(;(p||!c)&&e>=0;)p=this.containsBlackPoint(n,r,e,!1),p?(e--,o=!0,c=!0):c||e--;if(e<0){i=!0;break}let g=!0;for(;(g||!d)&&n>=0;)g=this.containsBlackPoint(e,t,n,!0),g?(n--,o=!0,d=!0):d||n--;if(n<0){i=!0;break}o&&(s=!0)}if(!i&&s){const i=t-e;let o=null;for(let t=1;null===o&&t<i;t++)o=this.getBlackPointOnSegment(e,r-t,e+t,r);if(null==o)throw new T;let s=null;for(let t=1;null===s&&t<i;t++)s=this.getBlackPointOnSegment(e,n+t,e+t,n);if(null==s)throw new T;let a=null;for(let e=1;null===a&&e<i;e++)a=this.getBlackPointOnSegment(t,n+e,t-e,n);if(null==a)throw new T;let l=null;for(let e=1;null===l&&e<i;e++)l=this.getBlackPointOnSegment(t,r-e,t-e,r);if(null==l)throw new T;return this.centerEdges(l,o,a,s)}throw new T}getBlackPointOnSegment(e,t,n,r){const i=ie.round(ie.distance(e,t,n,r)),o=(n-e)/i,s=(r-t)/i,a=this.image;for(let n=0;n<i;n++){const r=ie.round(e+n*o),i=ie.round(t+n*s);if(a.get(r,i))return new se(r,i)}return null}centerEdges(e,t,n,r){const i=e.getX(),o=e.getY(),s=t.getX(),a=t.getY(),l=n.getX(),c=n.getY(),d=r.getX(),u=r.getY(),f=ce.CORR;return i<this.width/2?[new se(d-f,u+f),new se(s+f,a+f),new se(l-f,c-f),new se(i+f,o-f)]:[new se(d+f,u+f),new se(s+f,a-f),new se(l-f,c+f),new se(i-f,o-f)]}containsBlackPoint(e,t,n,r){const i=this.image;if(r){for(let r=e;r<=t;r++)if(i.get(r,n))return!0}else for(let r=e;r<=t;r++)if(i.get(n,r))return!0;return!1}}ce.INIT_SIZE=10,ce.CORR=1;class de{static checkAndNudgePoints(e,t){const n=e.getWidth(),r=e.getHeight();let i=!0;for(let e=0;e<t.length&&i;e+=2){const o=Math.floor(t[e]),s=Math.floor(t[e+1]);if(o<-1||o>n||s<-1||s>r)throw new T;i=!1,-1===o?(t[e]=0,i=!0):o===n&&(t[e]=n-1,i=!0),-1===s?(t[e+1]=0,i=!0):s===r&&(t[e+1]=r-1,i=!0)}i=!0;for(let e=t.length-2;e>=0&&i;e-=2){const o=Math.floor(t[e]),s=Math.floor(t[e+1]);if(o<-1||o>n||s<-1||s>r)throw new T;i=!1,-1===o?(t[e]=0,i=!0):o===n&&(t[e]=n-1,i=!0),-1===s?(t[e+1]=0,i=!0):s===r&&(t[e+1]=r-1,i=!0)}}}class ue{constructor(e,t,n,r,i,o,s,a,l){this.a11=e,this.a21=t,this.a31=n,this.a12=r,this.a22=i,this.a32=o,this.a13=s,this.a23=a,this.a33=l}static quadrilateralToQuadrilateral(e,t,n,r,i,o,s,a,l,c,d,u,f,h,m,p){const g=ue.quadrilateralToSquare(e,t,n,r,i,o,s,a);return ue.squareToQuadrilateral(l,c,d,u,f,h,m,p).times(g)}transformPoints(e){const t=e.length,n=this.a11,r=this.a12,i=this.a13,o=this.a21,s=this.a22,a=this.a23,l=this.a31,c=this.a32,d=this.a33;for(let u=0;u<t;u+=2){const t=e[u],f=e[u+1],h=i*t+a*f+d;e[u]=(n*t+o*f+l)/h,e[u+1]=(r*t+s*f+c)/h}}transformPointsWithValues(e,t){const n=this.a11,r=this.a12,i=this.a13,o=this.a21,s=this.a22,a=this.a23,l=this.a31,c=this.a32,d=this.a33,u=e.length;for(let f=0;f<u;f++){const u=e[f],h=t[f],m=i*u+a*h+d;e[f]=(n*u+o*h+l)/m,t[f]=(r*u+s*h+c)/m}}static squareToQuadrilateral(e,t,n,r,i,o,s,a){const l=e-n+i-s,c=t-r+o-a;if(0===l&&0===c)return new ue(n-e,i-n,e,r-t,o-r,t,0,0,1);{const d=n-i,u=s-i,f=r-o,h=a-o,m=d*h-u*f,p=(l*h-u*c)/m,g=(d*c-l*f)/m;return new ue(n-e+p*n,s-e+g*s,e,r-t+p*r,a-t+g*a,t,p,g,1)}}static quadrilateralToSquare(e,t,n,r,i,o,s,a){return ue.squareToQuadrilateral(e,t,n,r,i,o,s,a).buildAdjoint()}buildAdjoint(){return new ue(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 ue(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 fe extends de{sampleGrid(e,t,n,r,i,o,s,a,l,c,d,u,f,h,m,p,g,w,y){const v=ue.quadrilateralToQuadrilateral(r,i,o,s,a,l,c,d,u,f,h,m,p,g,w,y);return this.sampleGridWithTransform(e,t,n,v)}sampleGridWithTransform(e,t,n,r){if(t<=0||n<=0)throw new T;const i=new N(t,n),o=new Float32Array(2*t);for(let t=0;t<n;t++){const n=o.length,s=t+.5;for(let e=0;e<n;e+=2)o[e]=e/2+.5,o[e+1]=s;r.transformPoints(o),de.checkAndNudgePoints(e,o);try{for(let r=0;r<n;r+=2)e.get(Math.floor(o[r]),Math.floor(o[r+1]))&&i.set(r/2,t)}catch(e){throw new T}}return i}}class he{static setGridSampler(e){he.gridSampler=e}static getInstance(){return he.gridSampler}}he.gridSampler=new fe;class me{constructor(e,t){this.x=e,this.y=t}toResultPoint(){return new se(this.getX(),this.getY())}getX(){return this.x}getY(){return this.y}}class pe{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 e=n[0];n[0]=n[2],n[2]=e}this.extractParameters(n);let r=this.sampleGrid(this.image,n[this.shift%4],n[(this.shift+1)%4],n[(this.shift+2)%4],n[(this.shift+3)%4]),i=this.getMatrixCornerPoints(n);return new le(r,i,this.compact,this.nbDataBlocks,this.nbLayers)}extractParameters(e){if(!(this.isValidPoint(e[0])&&this.isValidPoint(e[1])&&this.isValidPoint(e[2])&&this.isValidPoint(e[3])))throw new T;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 e=0;e<4;e++){let t=n[(this.shift+e)%4];this.compact?(r<<=7,r+=t>>1&127):(r<<=10,r+=(t>>2&992)+(t>>1&31))}let i=this.getCorrectedParameterData(r,this.compact);this.compact?(this.nbLayers=1+(i>>6),this.nbDataBlocks=1+(63&i)):(this.nbLayers=1+(i>>11),this.nbDataBlocks=1+(2047&i))}getRotation(e,t){let n=0;e.forEach((e,r,i)=>{n=(e>>t-2<<1)+(1&e)+(n<<3)}),n=((1&n)<<11)+(n>>1);for(let e=0;e<4;e++)if(y.bitCount(n^this.EXPECTED_CORNER_BITS[e])<=2)return e;throw new T}getCorrectedParameterData(e,t){let n,r;t?(n=7,r=2):(n=10,r=4);let i=n-r,o=new Int32Array(n);for(let t=n-1;t>=0;--t)o[t]=15&e,e>>=4;try{new ne(J.AZTEC_PARAM).decode(o,i)}catch(e){throw new T}let s=0;for(let e=0;e<r;e++)s=(s<<4)+o[e];return s}getBullsEyeCorners(e){let t=e,n=e,r=e,i=e,o=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){let e=this.getFirstDifferent(t,o,1,-1),s=this.getFirstDifferent(n,o,1,1),a=this.getFirstDifferent(r,o,-1,1),l=this.getFirstDifferent(i,o,-1,-1);if(this.nbCenterLayers>2){let n=this.distancePoint(l,e)*this.nbCenterLayers/(this.distancePoint(i,t)*(this.nbCenterLayers+2));if(n<.75||n>1.25||!this.isWhiteOrBlackRectangle(e,s,a,l))break}t=e,n=s,r=a,i=l,o=!o}if(5!==this.nbCenterLayers&&7!==this.nbCenterLayers)throw new T;this.compact=5===this.nbCenterLayers;let s=new se(t.getX()+.5,t.getY()-.5),a=new se(n.getX()+.5,n.getY()+.5),l=new se(r.getX()-.5,r.getY()+.5),c=new se(i.getX()-.5,i.getY()-.5);return this.expandSquare([s,a,l,c],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let e,t,n,r;try{let i=new ce(this.image).detect();e=i[0],t=i[1],n=i[2],r=i[3]}catch(i){let o=this.image.getWidth()/2,s=this.image.getHeight()/2;e=this.getFirstDifferent(new me(o+7,s-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new me(o+7,s+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new me(o-7,s+7),!1,-1,1).toResultPoint(),r=this.getFirstDifferent(new me(o-7,s-7),!1,-1,-1).toResultPoint()}let i=ie.round((e.getX()+r.getX()+t.getX()+n.getX())/4),o=ie.round((e.getY()+r.getY()+t.getY()+n.getY())/4);try{let s=new ce(this.image,15,i,o).detect();e=s[0],t=s[1],n=s[2],r=s[3]}catch(s){e=this.getFirstDifferent(new me(i+7,o-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new me(i+7,o+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new me(i-7,o+7),!1,-1,1).toResultPoint(),r=this.getFirstDifferent(new me(i-7,o-7),!1,-1,-1).toResultPoint()}return i=ie.round((e.getX()+r.getX()+t.getX()+n.getX())/4),o=ie.round((e.getY()+r.getY()+t.getY()+n.getY())/4),new me(i,o)}getMatrixCornerPoints(e){return this.expandSquare(e,2*this.nbCenterLayers,this.getDimension())}sampleGrid(e,t,n,r,i){let o=he.getInstance(),s=this.getDimension(),a=s/2-this.nbCenterLayers,l=s/2+this.nbCenterLayers;return o.sampleGrid(e,s,s,a,a,l,a,l,l,a,l,t.getX(),t.getY(),n.getX(),n.getY(),r.getX(),r.getY(),i.getX(),i.getY())}sampleLine(e,t,n){let r=0,i=this.distanceResultPoint(e,t),o=i/n,s=e.getX(),a=e.getY(),l=o*(t.getX()-e.getX())/i,c=o*(t.getY()-e.getY())/i;for(let e=0;e<n;e++)this.image.get(ie.round(s+e*l),ie.round(a+e*c))&&(r|=1<<n-e-1);return r}isWhiteOrBlackRectangle(e,t,n,r){let i=3;e=new me(e.getX()-i,e.getY()+i),t=new me(t.getX()-i,t.getY()-i),n=new me(n.getX()+i,n.getY()-i),r=new me(r.getX()+i,r.getY()+i);let o=this.getColor(r,e);if(0===o)return!1;let s=this.getColor(e,t);return s===o&&(s=this.getColor(t,n),s===o&&(s=this.getColor(n,r),s===o))}getColor(e,t){let n=this.distancePoint(e,t),r=(t.getX()-e.getX())/n,i=(t.getY()-e.getY())/n,o=0,s=e.getX(),a=e.getY(),l=this.image.get(e.getX(),e.getY()),c=Math.ceil(n);for(let e=0;e<c;e++)s+=r,a+=i,this.image.get(ie.round(s),ie.round(a))!==l&&o++;let d=o/n;return d>.1&&d<.9?0:d<=.1===l?1:-1}getFirstDifferent(e,t,n,r){let i=e.getX()+n,o=e.getY()+r;for(;this.isValid(i,o)&&this.image.get(i,o)===t;)i+=n,o+=r;for(i-=n,o-=r;this.isValid(i,o)&&this.image.get(i,o)===t;)i+=n;for(i-=n;this.isValid(i,o)&&this.image.get(i,o)===t;)o+=r;return o-=r,new me(i,o)}expandSquare(e,t,n){let r=n/(2*t),i=e[0].getX()-e[2].getX(),o=e[0].getY()-e[2].getY(),s=(e[0].getX()+e[2].getX())/2,a=(e[0].getY()+e[2].getY())/2,l=new se(s+r*i,a+r*o),c=new se(s-r*i,a-r*o);return i=e[1].getX()-e[3].getX(),o=e[1].getY()-e[3].getY(),s=(e[1].getX()+e[3].getX())/2,a=(e[1].getY()+e[3].getY())/2,[l,new se(s+r*i,a+r*o),c,new se(s-r*i,a-r*o)]}isValid(e,t){return e>=0&&e<this.image.getWidth()&&t>0&&t<this.image.getHeight()}isValidPoint(e){let t=ie.round(e.getX()),n=ie.round(e.getY());return this.isValid(t,n)}distancePoint(e,t){return ie.distance(e.getX(),e.getY(),t.getX(),t.getY())}distanceResultPoint(e,t){return ie.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*(y.truncDivision(this.nbLayers-4,8)+1)+15}}class ge{decode(e,t=null){let n=null,r=new pe(e.getBlackMatrix()),i=null,o=null;try{let e=r.detectMirror(!1);i=e.getPoints(),this.reportFoundResultPoints(t,i),o=(new re).decode(e)}catch(e){n=e}if(null==o)try{let e=r.detectMirror(!0);i=e.getPoints(),this.reportFoundResultPoints(t,i),o=(new re).decode(e)}catch(e){if(null!=n)throw n;throw e}let s=new F(o.getText(),o.getRawBytes(),o.getNumBits(),i,U.AZTEC,m.currentTimeMillis()),a=o.getByteSegments();null!=a&&s.putMetadata(X.BYTE_SEGMENTS,a);let l=o.getECLevel();return null!=l&&s.putMetadata(X.ERROR_CORRECTION_LEVEL,l),s}reportFoundResultPoints(e,t){if(null!=e){let n=e.get(I.NEED_RESULT_POINT_CALLBACK);null!=n&&t.forEach((e,t,r)=>{n.foundPossibleResultPoint(e)})}}reset(){}}class we extends L{constructor(e=500){super(new ge,e)}}class ye{decode(e,t){try{return this.doDecode(e,t)}catch(n){if(t&&!0===t.get(I.TRY_HARDER)&&e.isRotateSupported()){const n=e.rotateCounterClockwise(),r=this.doDecode(n,t),i=r.getResultMetadata();let o=270;null!==i&&!0===i.get(X.ORIENTATION)&&(o+=i.get(X.ORIENTATION)%360),r.putMetadata(X.ORIENTATION,o);const s=r.getResultPoints();if(null!==s){const e=n.getHeight();for(let t=0;t<s.length;t++)s[t]=new se(e-s[t].getY()-1,s[t].getX())}return r}throw new T}}reset(){}doDecode(e,t){const n=e.getWidth(),r=e.getHeight();let i=new v(n);const o=t&&!0===t.get(I.TRY_HARDER),s=Math.max(1,r>>(o?8:5));let a;a=o?r:15;const l=Math.trunc(r/2);for(let o=0;o<a;o++){const a=Math.trunc((o+1)/2),c=l+s*(1&o?-a:a);if(c<0||c>=r)break;try{i=e.getBlackRow(c,i)}catch(e){continue}for(let e=0;e<2;e++){if(1===e&&(i.reverse(),t&&!0===t.get(I.NEED_RESULT_POINT_CALLBACK))){const e=new Map;t.forEach((t,n)=>e.set(n,t)),e.delete(I.NEED_RESULT_POINT_CALLBACK),t=e}try{const r=this.decodeRow(c,i,t);if(1===e){r.putMetadata(X.ORIENTATION,180);const e=r.getResultPoints();null!==e&&(e[0]=new se(n-e[0].getX()-1,e[0].getY()),e[1]=new se(n-e[1].getX()-1,e[1].getY()))}return r}catch(e){}}}throw new T}static recordPattern(e,t,n){const r=n.length;for(let e=0;e<r;e++)n[e]=0;const i=e.getSize();if(t>=i)throw new T;let o=!e.get(t),s=0,a=t;for(;a<i;){if(e.get(a)!==o)n[s]++;else{if(++s===r)break;n[s]=1,o=!o}a++}if(s!==r&&(s!==r-1||a!==i))throw new T}static recordPatternInReverse(e,t,n){let r=n.length,i=e.get(t);for(;t>0&&r>=0;)e.get(--t)!==i&&(r--,i=!i);if(r>=0)throw new T;ye.recordPattern(e,t+1,n)}static patternMatchVariance(e,t,n){const r=e.length;let i=0,o=0;for(let n=0;n<r;n++)i+=e[n],o+=t[n];if(i<o)return Number.POSITIVE_INFINITY;const s=i/o;n*=s;let a=0;for(let i=0;i<r;i++){const r=e[i],o=t[i]*s,l=r>o?r-o:o-r;if(l>n)return Number.POSITIVE_INFINITY;a+=l}return a/i}}class ve extends ye{static findStartPattern(e){const t=e.getSize(),n=e.getNextSet(0);let r=0,i=Int32Array.from([0,0,0,0,0,0]),o=n,s=!1;const a=6;for(let l=n;l<t;l++)if(e.get(l)!==s)i[r]++;else{if(r===a-1){let t=ve.MAX_AVG_VARIANCE,n=-1;for(let e=ve.CODE_START_A;e<=ve.CODE_START_C;e++){const r=ye.patternMatchVariance(i,ve.CODE_PATTERNS[e],ve.MAX_INDIVIDUAL_VARIANCE);r<t&&(t=r,n=e)}if(n>=0&&e.isRange(Math.max(0,o-(l-o)/2),o,!1))return Int32Array.from([o,l,n]);o+=i[0]+i[1],i=i.slice(2,i.length-1),i[r-1]=0,i[r]=0,r--}else r++;i[r]=1,s=!s}throw new T}static decodeCode(e,t,n){ye.recordPattern(e,n,t);let r=ve.MAX_AVG_VARIANCE,i=-1;for(let e=0;e<ve.CODE_PATTERNS.length;e++){const n=ve.CODE_PATTERNS[e],o=this.patternMatchVariance(t,n,ve.MAX_INDIVIDUAL_VARIANCE);o<r&&(r=o,i=e)}if(i>=0)return i;throw new T}decodeRow(e,t,n){const r=n&&!0===n.get(I.ASSUME_GS1),i=ve.findStartPattern(t),o=i[2];let s=0;const a=new Uint8Array(20);let l;switch(a[s++]=o,o){case ve.CODE_START_A:l=ve.CODE_CODE_A;break;case ve.CODE_START_B:l=ve.CODE_CODE_B;break;case ve.CODE_START_C:l=ve.CODE_CODE_C;break;default:throw new _}let c=!1,d=!1,u="",h=i[0],m=i[1];const p=Int32Array.from([0,0,0,0,0,0]);let g=0,w=0,y=o,v=0,$=!0,C=!1,E=!1;for(;!c;){const e=d;switch(d=!1,g=w,w=ve.decodeCode(t,p,m),a[s++]=w,w!==ve.CODE_STOP&&($=!0),w!==ve.CODE_STOP&&(v++,y+=v*w),h=m,m+=p.reduce((e,t)=>e+t,0),w){case ve.CODE_START_A:case ve.CODE_START_B:case ve.CODE_START_C:throw new _}switch(l){case ve.CODE_CODE_A:if(w<64)u+=E===C?String.fromCharCode(" ".charCodeAt(0)+w):String.fromCharCode(" ".charCodeAt(0)+w+128),E=!1;else if(w<96)u+=E===C?String.fromCharCode(w-64):String.fromCharCode(w+64),E=!1;else switch(w!==ve.CODE_STOP&&($=!1),w){case ve.CODE_FNC_1:r&&(0===u.length?u+="]C1":u+=String.fromCharCode(29));break;case ve.CODE_FNC_2:case ve.CODE_FNC_3:break;case ve.CODE_FNC_4_A:!C&&E?(C=!0,E=!1):C&&E?(C=!1,E=!1):E=!0;break;case ve.CODE_SHIFT:d=!0,l=ve.CODE_CODE_B;break;case ve.CODE_CODE_B:l=ve.CODE_CODE_B;break;case ve.CODE_CODE_C:l=ve.CODE_CODE_C;break;case ve.CODE_STOP:c=!0}break;case ve.CODE_CODE_B:if(w<96)u+=E===C?String.fromCharCode(" ".charCodeAt(0)+w):String.fromCharCode(" ".charCodeAt(0)+w+128),E=!1;else switch(w!==ve.CODE_STOP&&($=!1),w){case ve.CODE_FNC_1:r&&(0===u.length?u+="]C1":u+=String.fromCharCode(29));break;case ve.CODE_FNC_2:case ve.CODE_FNC_3:break;case ve.CODE_FNC_4_B:!C&&E?(C=!0,E=!1):C&&E?(C=!1,E=!1):E=!0;break;case ve.CODE_SHIFT:d=!0,l=ve.CODE_CODE_A;break;case ve.CODE_CODE_A:l=ve.CODE_CODE_A;break;case ve.CODE_CODE_C:l=ve.CODE_CODE_C;break;case ve.CODE_STOP:c=!0}break;case ve.CODE_CODE_C:if(w<100)w<10&&(u+="0"),u+=w;else switch(w!==ve.CODE_STOP&&($=!1),w){case ve.CODE_FNC_1:r&&(0===u.length?u+="]C1":u+=String.fromCharCode(29));break;case ve.CODE_CODE_A:l=ve.CODE_CODE_A;break;case ve.CODE_CODE_B:l=ve.CODE_CODE_B;break;case ve.CODE_STOP:c=!0}}e&&(l=l===ve.CODE_CODE_A?ve.CODE_CODE_B:ve.CODE_CODE_A)}const A=m-h;if(m=t.getNextUnset(m),!t.isRange(m,Math.min(t.getSize(),m+(m-h)/2),!1))throw new T;if(y-=v*g,y%103!==g)throw new f;const b=u.length;if(0===b)throw new T;b>0&&$&&(u=l===ve.CODE_CODE_C?u.substring(0,b-2):u.substring(0,b-1));const S=(i[1]+i[0])/2,N=h+A/2,R=a.length,D=new Uint8Array(R);for(let e=0;e<R;e++)D[e]=a[e];const x=[new se(S,e),new se(N,e)];return new F(u,D,0,x,U.CODE_128,(new Date).getTime())}}ve.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])],ve.MAX_AVG_VARIANCE=.25,ve.MAX_INDIVIDUAL_VARIANCE=.7,ve.CODE_SHIFT=98,ve.CODE_CODE_C=99,ve.CODE_CODE_B=100,ve.CODE_CODE_A=101,ve.CODE_FNC_1=102,ve.CODE_FNC_2=97,ve.CODE_FNC_3=96,ve.CODE_FNC_4_A=101,ve.CODE_FNC_4_B=100,ve.CODE_START_A=103,ve.CODE_START_B=104,ve.CODE_START_C=105,ve.CODE_STOP=106;class $e extends ye{constructor(e=!1,t=!1){super(),this.usingCheckDigit=e,this.extendedMode=t,this.decodeRowResult="",this.counters=new Int32Array(9)}decodeRow(e,t,n){let r=this.counters;r.fill(0),this.decodeRowResult="";let i,o,s=$e.findAsteriskPattern(t,r),a=t.getNextSet(s[1]),l=t.getSize();do{$e.recordPattern(t,a,r);let e=$e.toNarrowWidePattern(r);if(e<0)throw new T;i=$e.patternToChar(e),this.decodeRowResult+=i,o=a;for(let e of r)a+=e;a=t.getNextSet(a)}while("*"!==i);this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let c,d=0;for(let e of r)d+=e;if(a!==l&&2*(a-o-d)<d)throw new T;if(this.usingCheckDigit){let e=this.decodeRowResult.length-1,t=0;for(let n=0;n<e;n++)t+=$e.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(n));if(this.decodeRowResult.charAt(e)!==$e.ALPHABET_STRING.charAt(t%43))throw new f;this.decodeRowResult=this.decodeRowResult.substring(0,e)}if(0===this.decodeRowResult.length)throw new T;c=this.extendedMode?$e.decodeExtended(this.decodeRowResult):this.decodeRowResult;let u=(s[1]+s[0])/2,h=o+d/2;return new F(c,null,0,[new se(u,e),new se(h,e)],U.CODE_39,(new Date).getTime())}static findAsteriskPattern(e,t){let n=e.getSize(),r=e.getNextSet(0),i=0,o=r,s=!1,a=t.length;for(let l=r;l<n;l++)if(e.get(l)!==s)t[i]++;else{if(i===a-1){if(this.toNarrowWidePattern(t)===$e.ASTERISK_ENCODING&&e.isRange(Math.max(0,o-Math.floor((l-o)/2)),o,!1))return[o,l];o+=t[0]+t[1],t.copyWithin(0,2,2+i-1),t[i-1]=0,t[i]=0,i--}else i++;t[i]=1,s=!s}throw new T}static toNarrowWidePattern(e){let t,n=e.length,r=0;do{let i=2147483647;for(let t of e)t<i&&t>r&&(i=t);r=i,t=0;let o=0,s=0;for(let i=0;i<n;i++){let a=e[i];a>r&&(s|=1<<n-1-i,t++,o+=a)}if(3===t){for(let i=0;i<n&&t>0;i++){let n=e[i];if(n>r&&(t--,2*n>=o))return-1}return s}}while(t>3);return-1}static patternToChar(e){for(let t=0;t<$e.CHARACTER_ENCODINGS.length;t++)if($e.CHARACTER_ENCODINGS[t]===e)return $e.ALPHABET_STRING.charAt(t);if(e===$e.ASTERISK_ENCODING)return"*";throw new T}static decodeExtended(e){let t=e.length,n="";for(let r=0;r<t;r++){let t=e.charAt(r);if("+"===t||"$"===t||"%"===t||"/"===t){let i=e.charAt(r+1),o="\0";switch(t){case"+":if(!(i>="A"&&i<="Z"))throw new _;o=String.fromCharCode(i.charCodeAt(0)+32);break;case"$":if(!(i>="A"&&i<="Z"))throw new _;o=String.fromCharCode(i.charCodeAt(0)-64);break;case"%":if(i>="A"&&i<="E")o=String.fromCharCode(i.charCodeAt(0)-38);else if(i>="F"&&i<="J")o=String.fromCharCode(i.charCodeAt(0)-11);else if(i>="K"&&i<="O")o=String.fromCharCode(i.charCodeAt(0)+16);else if(i>="P"&&i<="T")o=String.fromCharCode(i.charCodeAt(0)+43);else if("U"===i)o="\0";else if("V"===i)o="@";else if("W"===i)o="`";else{if("X"!==i&&"Y"!==i&&"Z"!==i)throw new _;o=""}break;case"/":if(i>="A"&&i<="O")o=String.fromCharCode(i.charCodeAt(0)-32);else{if("Z"!==i)throw new _;o=":"}}n+=o,r++}else n+=t}return n}}$e.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",$e.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],$e.ASTERISK_ENCODING=148;class Ie extends ye{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(e,t,n){let r=this.decodeStart(t),i=this.decodeEnd(t),o=new S;Ie.decodeMiddle(t,r[1],i[0],o);let s=o.toString(),a=null;null!=n&&(a=n.get(I.ALLOWED_LENGTHS)),null==a&&(a=Ie.DEFAULT_ALLOWED_LENGTHS);let l=s.length,c=!1,d=0;for(let e of a){if(l===e){c=!0;break}e>d&&(d=e)}if(!c&&l>d&&(c=!0),!c)throw new _;const u=[new se(r[1],e),new se(i[0],e)];return new F(s,null,0,u,U.ITF,(new Date).getTime())}static decodeMiddle(e,t,n,r){let i=new Int32Array(10),o=new Int32Array(5),s=new Int32Array(5);for(i.fill(0),o.fill(0),s.fill(0);t<n;){ye.recordPattern(e,t,i);for(let e=0;e<5;e++){let t=2*e;o[e]=i[t],s[e]=i[t+1]}let n=Ie.decodeDigit(o);r.append(n.toString()),n=this.decodeDigit(s),r.append(n.toString()),i.forEach(function(e){t+=e})}}decodeStart(e){let t=Ie.skipWhiteSpace(e),n=Ie.findGuardPattern(e,t,Ie.START_PATTERN);return this.narrowLineWidth=(n[1]-n[0])/4,this.validateQuietZone(e,n[0]),n}validateQuietZone(e,t){let n=10*this.narrowLineWidth;n=n<t?n:t;for(let r=t-1;n>0&&r>=0&&!e.get(r);r--)n--;if(0!==n)throw new T}static skipWhiteSpace(e){const t=e.getSize(),n=e.getNextSet(0);if(n===t)throw new T;return n}decodeEnd(e){e.reverse();try{let t,n=Ie.skipWhiteSpace(e);try{t=Ie.findGuardPattern(e,n,Ie.END_PATTERN_REVERSED[0])}catch(r){r instanceof T&&(t=Ie.findGuardPattern(e,n,Ie.END_PATTERN_REVERSED[1]))}this.validateQuietZone(e,t[0]);let r=t[0];return t[0]=e.getSize()-t[1],t[1]=e.getSize()-r,t}finally{e.reverse()}}static findGuardPattern(e,t,n){let r=n.length,i=new Int32Array(r),o=e.getSize(),s=!1,a=0,l=t;i.fill(0);for(let c=t;c<o;c++)if(e.get(c)!==s)i[a]++;else{if(a===r-1){if(ye.patternMatchVariance(i,n,Ie.MAX_INDIVIDUAL_VARIANCE)<Ie.MAX_AVG_VARIANCE)return[l,c];l+=i[0]+i[1],m.arraycopy(i,2,i,0,a-1),i[a-1]=0,i[a]=0,a--}else a++;i[a]=1,s=!s}throw new T}static decodeDigit(e){let t=Ie.MAX_AVG_VARIANCE,n=-1,r=Ie.PATTERNS.length;for(let i=0;i<r;i++){let r=Ie.PATTERNS[i],o=ye.patternMatchVariance(e,r,Ie.MAX_INDIVIDUAL_VARIANCE);o<t?(t=o,n=i):o===t&&(n=-1)}if(n>=0)return n%10;throw new T}}Ie.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])],Ie.MAX_AVG_VARIANCE=.38,Ie.MAX_INDIVIDUAL_VARIANCE=.5,Ie.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],Ie.START_PATTERN=Int32Array.from([1,1,1,1]),Ie.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class _e extends ye{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(e){let t,n=!1,r=0,i=Int32Array.from([0,0,0]);for(;!n;){i=Int32Array.from([0,0,0]),t=_e.findGuardPattern(e,r,!1,this.START_END_PATTERN,i);let o=t[0];r=t[1];let s=o-(r-o);s>=0&&(n=e.isRange(s,o,!1))}return t}static checkChecksum(e){return _e.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(0===t)return!1;let n=parseInt(e.charAt(t-1),10);return _e.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 t=e.charAt(r).charCodeAt(0)-"0".charCodeAt(0);if(t<0||t>9)throw new _;n+=t}n*=3;for(let r=t-2;r>=0;r-=2){let t=e.charAt(r).charCodeAt(0)-"0".charCodeAt(0);if(t<0||t>9)throw new _;n+=t}return(1e3-n)%10}static decodeEnd(e,t){return _e.findGuardPattern(e,t,!1,_e.START_END_PATTERN,new Int32Array(_e.START_END_PATTERN.length).fill(0))}static findGuardPatternWithoutCounters(e,t,n,r){return this.findGuardPattern(e,t,n,r,new Int32Array(r.length))}static findGuardPattern(e,t,n,r,i){let o=e.getSize(),s=0,a=t=n?e.getNextUnset(t):e.getNextSet(t),l=r.length,c=n;for(let n=t;n<o;n++)if(e.get(n)!==c)i[s]++;else{if(s===l-1){if(ye.patternMatchVariance(i,r,_e.MAX_INDIVIDUAL_VARIANCE)<_e.MAX_AVG_VARIANCE)return Int32Array.from([a,n]);a+=i[0]+i[1];let e=i.slice(2,i.length-1);for(let t=0;t<s-1;t++)i[t]=e[t];i[s-1]=0,i[s]=0,s--}else s++;i[s]=1,c=!c}throw new T}static decodeDigit(e,t,n,r){this.recordPattern(e,n,t);let i=this.MAX_AVG_VARIANCE,o=-1,s=r.length;for(let e=0;e<s;e++){let n=r[e],s=ye.patternMatchVariance(t,n,_e.MAX_INDIVIDUAL_VARIANCE);s<i&&(i=s,o=e)}if(o>=0)return o;throw new T}}_e.MAX_AVG_VARIANCE=.48,_e.MAX_INDIVIDUAL_VARIANCE=.7,_e.START_END_PATTERN=Int32Array.from([1,1,1]),_e.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),_e.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),_e.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 Ce{constructor(){this.CHECK_DIGIT_ENCODINGS=[24,20,18,17,12,6,3,10,9,5],this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(e,t,n){let r=this.decodeRowStringBuffer,i=this.decodeMiddle(t,n,r),o=r.toString(),s=Ce.parseExtensionString(o),a=[new se((n[0]+n[1])/2,e),new se(i,e)],l=new F(o,null,0,a,U.UPC_EAN_EXTENSION,(new Date).getTime());return null!=s&&l.putAllMetadata(s),l}decodeMiddle(e,t,n){let r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let i=e.getSize(),o=t[1],s=0;for(let t=0;t<5&&o<i;t++){let i=_e.decodeDigit(e,r,o,_e.L_AND_G_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+i%10);for(let e of r)o+=e;i>=10&&(s|=1<<4-t),4!==t&&(o=e.getNextSet(o),o=e.getNextUnset(o))}if(5!==n.length)throw new T;let a=this.determineCheckDigit(s);if(Ce.extensionChecksum(n.toString())!==a)throw new T;return o}static extensionChecksum(e){let t=e.length,n=0;for(let r=t-2;r>=0;r-=2)n+=e.charAt(r).charCodeAt(0)-"0".charCodeAt(0);n*=3;for(let r=t-1;r>=0;r-=2)n+=e.charAt(r).charCodeAt(0)-"0".charCodeAt(0);return n*=3,n%10}determineCheckDigit(e){for(let t=0;t<10;t++)if(e===this.CHECK_DIGIT_ENCODINGS[t])return t;throw new T}static parseExtensionString(e){if(5!==e.length)return null;let t=Ce.parseExtension5String(e);return null==t?null:new Map([[X.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=""}let n=parseInt(e.substring(1)),r=n%100;return t+(n/100).toString()+"."+(r<10?"0"+r:r.toString())}}class Ee{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(e,t,n){let r=this.decodeRowStringBuffer,i=this.decodeMiddle(t,n,r),o=r.toString(),s=Ee.parseExtensionString(o),a=[new se((n[0]+n[1])/2,e),new se(i,e)],l=new F(o,null,0,a,U.UPC_EAN_EXTENSION,(new Date).getTime());return null!=s&&l.putAllMetadata(s),l}decodeMiddle(e,t,n){let r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let i=e.getSize(),o=t[1],s=0;for(let t=0;t<2&&o<i;t++){let i=_e.decodeDigit(e,r,o,_e.L_AND_G_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+i%10);for(let e of r)o+=e;i>=10&&(s|=1<<1-t),1!==t&&(o=e.getNextSet(o),o=e.getNextUnset(o))}if(2!==n.length)throw new T;if(parseInt(n.toString())%4!==s)throw new T;return o}static parseExtensionString(e){return 2!==e.length?null:new Map([[X.ISSUE_NUMBER,parseInt(e)]])}}class Ae{static decodeRow(e,t,n){let r=_e.findGuardPattern(t,n,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return(new Ce).decodeRow(e,t,r)}catch(n){return(new Ee).decodeRow(e,t,r)}}}Ae.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class be extends _e{constructor(){super(),this.decodeRowStringBuffer="",be.L_AND_G_PATTERNS=be.L_PATTERNS.map(e=>Int32Array.from(e));for(let e=10;e<20;e++){let t=be.L_PATTERNS[e-10],n=new Int32Array(t.length);for(let e=0;e<t.length;e++)n[e]=t[t.length-e-1];be.L_AND_G_PATTERNS[e]=n}}decodeRow(e,t,n){let r=be.findStartGuardPattern(t),i=null==n?null:n.get(I.NEED_RESULT_POINT_CALLBACK);if(null!=i){const t=new se((r[0]+r[1])/2,e);i.foundPossibleResultPoint(t)}let o=this.decodeMiddle(t,r,this.decodeRowStringBuffer),s=o.rowOffset,a=o.resultString;if(null!=i){const t=new se(s,e);i.foundPossibleResultPoint(t)}let l=this.decodeEnd(t,s);if(null!=i){const t=new se((l[0]+l[1])/2,e);i.foundPossibleResultPoint(t)}let c=l[1],d=c+(c-l[0]);if(d>=t.getSize()||!t.isRange(c,d,!1))throw new T;let u=a.toString();if(u.length<8)throw new _;if(!be.checkChecksum(u))throw new f;let h=(r[1]+r[0])/2,m=(l[1]+l[0])/2,p=this.getBarcodeFormat(),g=[new se(h,e),new se(m,e)],w=new F(u,null,0,g,p,(new Date).getTime()),y=0;try{let n=Ae.decodeRow(e,t,l[1]);w.putMetadata(X.UPC_EAN_EXTENSION,n.getText()),w.putAllMetadata(n.getResultMetadata()),w.addResultPoints(n.getResultPoints()),y=n.getText().length}catch(e){}let v=null==n?null:n.get(I.ALLOWED_EAN_EXTENSIONS);if(null!=v){let e=!1;for(let t in v)if(y.toString()===t){e=!0;break}if(!e)throw new T}return w}decodeEnd(e,t){return be.findGuardPattern(e,t,!1,be.START_END_PATTERN,new Int32Array(be.START_END_PATTERN.length).fill(0))}static checkChecksum(e){return be.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(0===t)return!1;let n=parseInt(e.charAt(t-1),10);return be.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 t=e.charAt(r).charCodeAt(0)-"0".charCodeAt(0);if(t<0||t>9)throw new _;n+=t}n*=3;for(let r=t-2;r>=0;r-=2){let t=e.charAt(r).charCodeAt(0)-"0".charCodeAt(0);if(t<0||t>9)throw new _;n+=t}return(1e3-n)%10}}class Se extends be{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(e,t,n){let r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let i=e.getSize(),o=t[1],s=0;for(let t=0;t<6&&o<i;t++){let i=be.decodeDigit(e,r,o,be.L_AND_G_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+i%10);for(let e of r)o+=e;i>=10&&(s|=1<<5-t)}n=Se.determineFirstDigit(n,s),o=be.findGuardPattern(e,o,!0,be.MIDDLE_PATTERN,new Int32Array(be.MIDDLE_PATTERN.length).fill(0))[1];for(let t=0;t<6&&o<i;t++){let t=be.decodeDigit(e,r,o,be.L_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+t);for(let e of r)o+=e}return{rowOffset:o,resultString:n}}getBarcodeFormat(){return U.EAN_13}static determineFirstDigit(e,t){for(let n=0;n<10;n++)if(t===this.FIRST_DIGIT_ENCODINGS[n])return e=String.fromCharCode("0".charCodeAt(0)+n)+e;throw new T}}Se.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class Ne extends be{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(e,t,n){const r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let i=e.getSize(),o=t[1];for(let t=0;t<4&&o<i;t++){let t=be.decodeDigit(e,r,o,be.L_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+t);for(let e of r)o+=e}o=be.findGuardPattern(e,o,!0,be.MIDDLE_PATTERN,new Int32Array(be.MIDDLE_PATTERN.length).fill(0))[1];for(let t=0;t<4&&o<i;t++){let t=be.decodeDigit(e,r,o,be.L_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+t);for(let e of r)o+=e}return{rowOffset:o,resultString:n}}getBarcodeFormat(){return U.EAN_8}}class Te extends be{constructor(){super(...arguments),this.ean13Reader=new Se}getBarcodeFormat(){return U.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("0"===t.charAt(0)){let n=new F(t.substring(1),null,null,e.getResultPoints(),U.UPC_A);return null!=e.getResultMetadata()&&n.putAllMetadata(e.getResultMetadata()),n}throw new T}reset(){this.ean13Reader.reset()}}class Re extends be{constructor(){super(),this.decodeMiddleCounters=new Int32Array(4)}decodeMiddle(e,t,n){const r=this.decodeMiddleCounters.map(e=>e);r[0]=0,r[1]=0,r[2]=0,r[3]=0;const i=e.getSize();let o=t[1],s=0;for(let t=0;t<6&&o<i;t++){const i=Re.decodeDigit(e,r,o,Re.L_AND_G_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+i%10);for(let e of r)o+=e;i>=10&&(s|=1<<5-t)}return{rowOffset:o,resultString:Re.determineNumSysAndCheckDigit(n,s)}}decodeEnd(e,t){return Re.findGuardPatternWithoutCounters(e,t,!0,Re.MIDDLE_END_PATTERN)}checkChecksum(e){return be.checkChecksum(Re.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])return String.fromCharCode("0".charCodeAt(0)+n)+e+String.fromCharCode("0".charCodeAt(0)+r);throw T.getNotFoundInstance()}getBarcodeFormat(){return U.UPC_E}static convertUPCEtoUPCA(e){const t=e.slice(1,7).split("").map(e=>e.charCodeAt(0)),n=new S;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)}return e.length>=8&&n.append(e.charAt(7)),n.toString()}}Re.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),Re.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 De extends ye{constructor(e){super();let n=null==e?null:e.get(I.POSSIBLE_FORMATS),r=[];t(n)?(r.push(new Se),r.push(new Te),r.push(new Ne),r.push(new Re)):(n.indexOf(U.EAN_13)>-1&&r.push(new Se),n.indexOf(U.UPC_A)>-1&&r.push(new Te),n.indexOf(U.EAN_8)>-1&&r.push(new Ne),n.indexOf(U.UPC_E)>-1&&r.push(new Re)),this.readers=r}decodeRow(e,t,n){for(let r of this.readers)try{const i=r.decodeRow(e,t,n),o=i.getBarcodeFormat()===U.EAN_13&&"0"===i.getText().charAt(0),s=null==n?null:n.get(I.POSSIBLE_FORMATS),a=null==s||s.includes(U.UPC_A);if(o&&a){const e=i.getRawBytes(),t=new F(i.getText().substring(1),e,e?e.length:null,i.getResultPoints(),U.UPC_A);return t.putAllMetadata(i.getResultMetadata()),t}return i}catch(e){}throw new T}reset(){for(let e of this.readers)e.reset()}}class xe extends ye{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(ye.patternMatchVariance(e,t[n],xe.MAX_INDIVIDUAL_VARIANCE)<xe.MAX_AVG_VARIANCE)return n;throw new T}static count(e){return ie.sum(new Int32Array(e))}static increment(e,t){let n=0,r=t[0];for(let i=1;i<e.length;i++)t[i]>r&&(r=t[i],n=i);e[n]++}static decrement(e,t){let n=0,r=t[0];for(let i=1;i<e.length;i++)t[i]<r&&(r=t[i],n=i);e[n]--}static isFinderPattern(e){let t=e[0]+e[1],n=t/(t+e[2]+e[3]);if(n>=xe.MIN_FINDER_PATTERN_RATIO&&n<=xe.MAX_FINDER_PATTERN_RATIO){let t=Number.MAX_SAFE_INTEGER,n=Number.MIN_SAFE_INTEGER;for(let r of e)r>n&&(n=r),r<t&&(t=r);return n<10*t}return!1}}xe.MAX_AVG_VARIANCE=.2,xe.MAX_INDIVIDUAL_VARIANCE=.45,xe.MIN_FINDER_PATTERN_RATIO=9.5/12,xe.MAX_FINDER_PATTERN_RATIO=12.5/14;class ke{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 ke))return!1;const t=e;return this.value===t.value&&this.checksumPortion===t.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class Oe{constructor(e,t,n,r,i){this.value=e,this.startEnd=t,this.value=e,this.startEnd=t,this.resultPoints=new Array,this.resultPoints.push(new se(n,i)),this.resultPoints.push(new se(r,i))}getValue(){return this.value}getStartEnd(){return this.startEnd}getResultPoints(){return this.resultPoints}equals(e){if(!(e instanceof Oe))return!1;const t=e;return this.value===t.value}hashCode(){return this.value}}class Me{constructor(){}static getRSSvalue(e,t,n){let r=0;for(let t of e)r+=t;let i=0,o=0,s=e.length;for(let a=0;a<s-1;a++){let l;for(l=1,o|=1<<a;l<e[a];l++,o&=~(1<<a)){let e=Me.combins(r-l-1,s-a-2);if(n&&0===o&&r-l-(s-a-1)>=s-a-1&&(e-=Me.combins(r-l-(s-a),s-a-2)),s-a-1>1){let n=0;for(let e=r-l-(s-a-2);e>t;e--)n+=Me.combins(r-l-e-1,s-a-3);e-=n*(s-1-a)}else r-l>t&&e--;i+=e}r-=l}return i}static combins(e,t){let n,r;e-t>t?(r=t,n=e-t):(r=e-t,n=t);let i=1,o=1;for(let t=e;t>n;t--)i*=t,o<=r&&(i/=o,o++);for(;o<=r;)i/=o,o++;return i}}class Pe{static buildBitArray(e){let t=2*e.length-1;null==e[e.length-1].getRightChar()&&(t-=1);let n=new v(12*t),r=0,i=e[0].getRightChar().getValue();for(let e=11;e>=0;--e)i&1<<e&&n.set(r),r++;for(let t=1;t<e.length;++t){let i=e[t],o=i.getLeftChar().getValue();for(let e=11;e>=0;--e)o&1<<e&&n.set(r),r++;if(null!=i.getRightChar()){let e=i.getRightChar().getValue();for(let t=11;t>=0;--t)e&1<<t&&n.set(r),r++}}return n}}class Be{constructor(e,t){t?this.decodedInformation=null:(this.finished=e,this.decodedInformation=t)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class Le{constructor(e){this.newPosition=e}getNewPosition(){return this.newPosition}}class Fe extends Le{constructor(e,t){super(e),this.value=t}getValue(){return this.value}isFNC1(){return this.value===Fe.FNC1}}Fe.FNC1="$";class Ve extends Le{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 Ue extends Le{constructor(e,t,n){if(super(e),t<0||t>10||n<0||n>10)throw new _;this.firstDigit=t,this.secondDigit=n}getFirstDigit(){return this.firstDigit}getSecondDigit(){return this.secondDigit}getValue(){return 10*this.firstDigit+this.secondDigit}isFirstDigitFNC1(){return this.firstDigit===Ue.FNC1}isSecondDigitFNC1(){return this.secondDigit===Ue.FNC1}isAnyFNC1(){return this.firstDigit===Ue.FNC1||this.secondDigit===Ue.FNC1}}Ue.FNC1=10;class We{constructor(){}static parseFieldsInGeneralPurpose(e){if(!e)return null;if(e.length<2)throw new T;let t=e.substring(0,2);for(let n of We.TWO_DIGIT_DATA_LENGTH)if(n[0]===t)return n[1]===We.VARIABLE_LENGTH?We.processVariableAI(2,n[2],e):We.processFixedAI(2,n[1],e);if(e.length<3)throw new T;let n=e.substring(0,3);for(let t of We.THREE_DIGIT_DATA_LENGTH)if(t[0]===n)return t[1]===We.VARIABLE_LENGTH?We.processVariableAI(3,t[2],e):We.processFixedAI(3,t[1],e);for(let t of We.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(t[0]===n)return t[1]===We.VARIABLE_LENGTH?We.processVariableAI(4,t[2],e):We.processFixedAI(4,t[1],e);if(e.length<4)throw new T;let r=e.substring(0,4);for(let t of We.FOUR_DIGIT_DATA_LENGTH)if(t[0]===r)return t[1]===We.VARIABLE_LENGTH?We.processVariableAI(4,t[2],e):We.processFixedAI(4,t[1],e);throw new T}static processFixedAI(e,t,n){if(n.length<e)throw new T;let r=n.substring(0,e);if(n.length<e+t)throw new T;let i=n.substring(e,e+t),o=n.substring(e+t),s="("+r+")"+i,a=We.parseFieldsInGeneralPurpose(o);return null==a?s:s+a}static processVariableAI(e,t,n){let r,i=n.substring(0,e);r=n.length<e+t?n.length:e+t;let o=n.substring(e,r),s=n.substring(r),a="("+i+")"+o,l=We.parseFieldsInGeneralPurpose(s);return null==l?a:a+l}}We.VARIABLE_LENGTH=[],We.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",We.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",We.VARIABLE_LENGTH,20],["22",We.VARIABLE_LENGTH,29],["30",We.VARIABLE_LENGTH,8],["37",We.VARIABLE_LENGTH,8],["90",We.VARIABLE_LENGTH,30],["91",We.VARIABLE_LENGTH,30],["92",We.VARIABLE_LENGTH,30],["93",We.VARIABLE_LENGTH,30],["94",We.VARIABLE_LENGTH,30],["95",We.VARIABLE_LENGTH,30],["96",We.VARIABLE_LENGTH,30],["97",We.VARIABLE_LENGTH,3],["98",We.VARIABLE_LENGTH,30],["99",We.VARIABLE_LENGTH,30]],We.THREE_DIGIT_DATA_LENGTH=[["240",We.VARIABLE_LENGTH,30],["241",We.VARIABLE_LENGTH,30],["242",We.VARIABLE_LENGTH,6],["250",We.VARIABLE_LENGTH,30],["251",We.VARIABLE_LENGTH,30],["253",We.VARIABLE_LENGTH,17],["254",We.VARIABLE_LENGTH,20],["400",We.VARIABLE_LENGTH,30],["401",We.VARIABLE_LENGTH,30],["402",17],["403",We.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",We.VARIABLE_LENGTH,20],["421",We.VARIABLE_LENGTH,15],["422",3],["423",We.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],We.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",We.VARIABLE_LENGTH,15],["391",We.VARIABLE_LENGTH,18],["392",We.VARIABLE_LENGTH,15],["393",We.VARIABLE_LENGTH,18],["703",We.VARIABLE_LENGTH,30]],We.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",We.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",We.VARIABLE_LENGTH,20],["8003",We.VARIABLE_LENGTH,30],["8004",We.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",We.VARIABLE_LENGTH,30],["8008",We.VARIABLE_LENGTH,12],["8018",18],["8020",We.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",We.VARIABLE_LENGTH,70],["8200",We.VARIABLE_LENGTH,70]];class ze{constructor(e){this.buffer=new S,this.information=e}decodeAllCodes(e,t){let n=t,r=null;for(;;){let t=this.decodeGeneralPurposeField(n,r),i=We.parseFieldsInGeneralPurpose(t.getNewString());if(null!=i&&e.append(i),r=t.isRemaining()?""+t.getRemainingValue():null,n===t.getNewPosition())break;n=t.getNewPosition()}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 t=this.extractNumericValueFromBitArray(e,4);return new Ue(this.information.getSize(),0===t?Ue.FNC1:t-1,Ue.FNC1)}let t=this.extractNumericValueFromBitArray(e,7);return new Ue(e+7,(t-8)/11,(t-8)%11)}extractNumericValueFromBitArray(e,t){return ze.extractNumericValueFromBitArray(this.information,e,t)}static extractNumericValueFromBitArray(e,t,n){let r=0;for(let i=0;i<n;++i)e.get(t+i)&&(r|=1<<n-i-1);return r}decodeGeneralPurposeField(e,t){this.buffer.setLengthToZero(),null!=t&&this.buffer.append(t),this.current.setPosition(e);let n=this.parseBlocks();return null!=n&&n.isRemaining()?new Ve(this.current.getPosition(),this.buffer.toString(),n.getRemainingValue()):new Ve(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 t=e.isSecondDigitFNC1()?new Ve(this.current.getPosition(),this.buffer.toString()):new Ve(this.current.getPosition(),this.buffer.toString(),e.getSecondDigit()),new Be(!0,t)}if(this.buffer.append(e.getFirstDigit()),e.isSecondDigitFNC1()){let e=new Ve(this.current.getPosition(),this.buffer.toString());return new Be(!0,e)}this.buffer.append(e.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new Be(!1)}parseIsoIec646Block(){for(;this.isStillIsoIec646(this.current.getPosition());){let e=this.decodeIsoIec646(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1()){let e=new Ve(this.current.getPosition(),this.buffer.toString());return new Be(!0,e)}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 Be(!1)}parseAlphaBlock(){for(;this.isStillAlpha(this.current.getPosition());){let e=this.decodeAlphanumeric(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1()){let e=new Ve(this.current.getPosition(),this.buffer.toString());return new Be(!0,e)}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 Be(!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(15===t)return new Fe(e+5,Fe.FNC1);if(t>=5&&t<15)return new Fe(e+5,"0"+(t-5));let n,r=this.extractNumericValueFromBitArray(e,7);if(r>=64&&r<90)return new Fe(e+7,""+(r+1));if(r>=90&&r<116)return new Fe(e+7,""+(r+7));switch(this.extractNumericValueFromBitArray(e,8)){case 232:n="!";break;case 233:n='"';break;case 234:n="%";break;case 235:n="&";break;case 236:n="'";break;case 237:n="(";break;case 238:n=")";break;case 239:n="*";break;case 240:n="+";break;case 241:n=",";break;case 242:n="-";break;case 243:n=".";break;case 244:n="/";break;case 245:n=":";break;case 246:n=";";break;case 247:n="<";break;case 248:n="=";break;case 249:n=">";break;case 250:n="?";break;case 251:n="_";break;case 252:n=" ";break;default:throw new _}return new Fe(e+8,n)}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(15===t)return new Fe(e+5,Fe.FNC1);if(t>=5&&t<15)return new Fe(e+5,"0"+(t-5));let n,r=this.extractNumericValueFromBitArray(e,6);if(r>=32&&r<58)return new Fe(e+6,""+(r+33));switch(r){case 58:n="*";break;case 59:n=",";break;case 60:n="-";break;case 61:n=".";break;case 62:n="/";break;default:throw new te("Decoding invalid alphanumeric value: "+r)}return new Fe(e+6,n)}isAlphaTo646ToAlphaLatch(e){if(e+1>this.information.getSize())return!1;for(let t=0;t<5&&t+e<this.information.getSize();++t)if(2===t){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 He{constructor(e){this.information=e,this.generalDecoder=new ze(e)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class je extends He{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 n=0;n<4;++n){let r=this.getGeneralDecoder().extractNumericValueFromBitArray(t+10*n,10);r/100==0&&e.append("0"),r/10==0&&e.append("0"),e.append(r)}je.appendCheckDigit(e,n)}static appendCheckDigit(e,t){let n=0;for(let r=0;r<13;r++){let i=e.charAt(r+t).charCodeAt(0)-"0".charCodeAt(0);n+=1&r?i:3*i}n=10-n%10,10===n&&(n=0),e.append(n)}}je.GTIN_SIZE=40;class qe extends je{constructor(e){super(e)}parseInformation(){let e=new S;e.append("(01)");let t=e.length(),n=this.getGeneralDecoder().extractNumericValueFromBitArray(qe.HEADER_SIZE,4);return e.append(n),this.encodeCompressedGtinWithoutAI(e,qe.HEADER_SIZE+4,t),this.getGeneralDecoder().decodeAllCodes(e,qe.HEADER_SIZE+44)}}qe.HEADER_SIZE=4;class Ge extends He{constructor(e){super(e)}parseInformation(){let e=new S;return this.getGeneralDecoder().decodeAllCodes(e,Ge.HEADER_SIZE)}}Ge.HEADER_SIZE=5;class Xe extends je{constructor(e){super(e)}encodeCompressedWeight(e,t,n){let r=this.getGeneralDecoder().extractNumericValueFromBitArray(t,n);this.addWeightCode(e,r);let i=this.checkWeight(r),o=1e5;for(let t=0;t<5;++t)i/o===0&&e.append("0"),o/=10;e.append(i)}}class Ye extends Xe{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()!=Ye.HEADER_SIZE+Xe.GTIN_SIZE+Ye.WEIGHT_SIZE)throw new T;let e=new S;return this.encodeCompressedGtin(e,Ye.HEADER_SIZE),this.encodeCompressedWeight(e,Ye.HEADER_SIZE+Xe.GTIN_SIZE,Ye.WEIGHT_SIZE),e.toString()}}Ye.HEADER_SIZE=5,Ye.WEIGHT_SIZE=15;class Ze extends Ye{constructor(e){super(e)}addWeightCode(e,t){e.append("(3103)")}checkWeight(e){return e}}class Ke extends Ye{constructor(e){super(e)}addWeightCode(e,t){t<1e4?e.append("(3202)"):e.append("(3203)")}checkWeight(e){return e<1e4?e:e-1e4}}class Qe extends je{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<Qe.HEADER_SIZE+je.GTIN_SIZE)throw new T;let e=new S;this.encodeCompressedGtin(e,Qe.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(Qe.HEADER_SIZE+je.GTIN_SIZE,Qe.LAST_DIGIT_SIZE);e.append("(392"),e.append(t),e.append(")");let n=this.getGeneralDecoder().decodeGeneralPurposeField(Qe.HEADER_SIZE+je.GTIN_SIZE+Qe.LAST_DIGIT_SIZE,null);return e.append(n.getNewString()),e.toString()}}Qe.HEADER_SIZE=8,Qe.LAST_DIGIT_SIZE=2;class Je extends je{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<Je.HEADER_SIZE+je.GTIN_SIZE)throw new T;let e=new S;this.encodeCompressedGtin(e,Je.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(Je.HEADER_SIZE+je.GTIN_SIZE,Je.LAST_DIGIT_SIZE);e.append("(393"),e.append(t),e.append(")");let n=this.getGeneralDecoder().extractNumericValueFromBitArray(Je.HEADER_SIZE+je.GTIN_SIZE+Je.LAST_DIGIT_SIZE,Je.FIRST_THREE_DIGITS_SIZE);n/100==0&&e.append("0"),n/10==0&&e.append("0"),e.append(n);let r=this.getGeneralDecoder().decodeGeneralPurposeField(Je.HEADER_SIZE+je.GTIN_SIZE+Je.LAST_DIGIT_SIZE+Je.FIRST_THREE_DIGITS_SIZE,null);return e.append(r.getNewString()),e.toString()}}Je.HEADER_SIZE=8,Je.LAST_DIGIT_SIZE=2,Je.FIRST_THREE_DIGITS_SIZE=10;class et extends Xe{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 T;let e=new S;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(38400==n)return;e.append("("),e.append(this.dateCode),e.append(")");let r=n%32;n/=32;let i=n%12+1;n/=12;let o=n;o/10==0&&e.append("0"),e.append(o),i/10==0&&e.append("0"),e.append(i),r/10==0&&e.append("0"),e.append(r)}addWeightCode(e,t){e.append("("),e.append(this.firstAIdigits),e.append(t/1e5),e.append(")")}checkWeight(e){return e%1e5}}function tt(e){try{if(e.get(1))return new qe(e);if(!e.get(2))return new Ge(e);switch(ze.extractNumericValueFromBitArray(e,1,4)){case 4:return new Ze(e);case 5:return new Ke(e)}switch(ze.extractNumericValueFromBitArray(e,1,5)){case 12:return new Qe(e);case 13:return new Je(e)}switch(ze.extractNumericValueFromBitArray(e,1,7)){case 56:return new et(e,"310","11");case 57:return new et(e,"320","11");case 58:return new et(e,"310","13");case 59:return new et(e,"320","13");case 60:return new et(e,"310","15");case 61:return new et(e,"320","15");case 62:return new et(e,"310","17");case 63:return new et(e,"320","17")}}catch(t){throw console.log(t),new te("unknown decoder: "+e)}}et.HEADER_SIZE=8,et.WEIGHT_SIZE=20,et.DATE_SIZE=16;class nt{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 null==this.rightchar}toString(){return"[ "+this.leftchar+", "+this.rightchar+" : "+(null==this.finderpattern?"null":this.finderpattern.getValue())+" ]"}static equals(e,t){return e instanceof nt&&nt.equalsOrNull(e.leftchar,t.leftchar)&&nt.equalsOrNull(e.rightchar,t.rightchar)&&nt.equalsOrNull(e.finderpattern,t.finderpattern)}static equalsOrNull(e,t){return null===e?null===t:nt.equals(e,t)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class rt{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 rt&&this.checkEqualitity(e,t)&&e.wasReversed===t.wasReversed}checkEqualitity(e,t){if(!e||!t)return;let n;return e.forEach((e,r)=>{t.forEach(t=>{e.getLeftChar().getValue()===t.getLeftChar().getValue()&&e.getRightChar().getValue()===t.getRightChar().getValue()&&e.getFinderPatter().getValue()===t.getFinderPatter().getValue()&&(n=!0)})}),n}}class it extends xe{constructor(e){super(...arguments),this.pairs=new Array(it.MAX_PAIRS),this.rows=new Array,this.startEnd=[2],this.verbose=!0===e}decodeRow(e,t,n){this.pairs.length=0,this.startFromEven=!1;try{return it.constructResult(this.decodeRow2pairs(e,t))}catch(e){this.verbose&&console.log(e)}return this.pairs.length=0,this.startFromEven=!0,it.constructResult(this.decodeRow2pairs(e,t))}reset(){this.pairs.length=0,this.rows.length=0}decodeRow2pairs(e,t){let n,r=!1;for(;!r;)try{this.pairs.push(this.retrieveNextPair(t,this.pairs,e))}catch(e){if(e instanceof T){if(!this.pairs.length)throw new T;r=!0}}if(this.checkChecksum())return this.pairs;if(n=!!this.rows.length,this.storeRow(e,!1),n){let e=this.checkRowsBoolean(!1);if(null!=e)return e;if(e=this.checkRowsBoolean(!0),null!=e)return e}throw new T}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(e){this.verbose&&console.log(e)}return e&&(this.rows=this.rows.reverse()),t}checkRows(e,t){for(let n=t;n<this.rows.length;n++){let t=this.rows[n];this.pairs.length=0;for(let t of e)this.pairs.push(t.getPairs());if(this.pairs.push(t.getPairs()),!it.isValidSequence(this.pairs))continue;if(this.checkChecksum())return this.pairs;let r=new Array(e);r.push(t);try{return this.checkRows(r,n+1)}catch(e){this.verbose&&console.log(e)}}throw new T}static isValidSequence(e){for(let t of it.FINDER_PATTERN_SEQUENCES){if(e.length>t.length)continue;let n=!0;for(let r=0;r<e.length;r++)if(e[r].getFinderPattern().getValue()!=t[r]){n=!1;break}if(n)return!0}return!1}storeRow(e,t){let n=0,r=!1,i=!1;for(;n<this.rows.length;){let t=this.rows[n];if(t.getRowNumber()>e){i=t.isEquivalent(this.pairs);break}r=t.isEquivalent(this.pairs),n++}i||r||it.isPartialRow(this.pairs,this.rows)||(this.rows.push(n,new rt(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 t of n.getPairs())for(let n of e)if(nt.equals(t,n))break}static isPartialRow(e,t){for(let n of t){let t=!0;for(let r of e){let e=!1;for(let t of n.getPairs())if(r.equals(t)){e=!0;break}if(!e){t=!1;break}}if(t)return!0}return!1}getRows(){return this.rows}static constructResult(e){let t=tt(Pe.buildBitArray(e)).parseInformation(),n=e[0].getFinderPattern().getResultPoints(),r=e[e.length-1].getFinderPattern().getResultPoints(),i=[n[0],n[1],r[0],r[1]];return new F(t,null,null,i,U.RSS_EXPANDED,null)}checkChecksum(){let e=this.pairs.get(0),t=e.getLeftChar(),n=e.getRightChar();if(null==n)return!1;let r=n.getChecksumPortion(),i=2;for(let e=1;e<this.pairs.size();++e){let t=this.pairs.get(e);r+=t.getLeftChar().getChecksumPortion(),i++;let n=t.getRightChar();null!=n&&(r+=n.getChecksumPortion(),i++)}return r%=211,211*(i-4)+r==t.getValue()}static getNextSecondBar(e,t){let n;return e.get(t)?(n=e.getNextUnset(t),n=e.getNextSet(n)):(n=e.getNextSet(t),n=e.getNextUnset(n)),n}retrieveNextPair(e,t,n){let r,i=t.length%2==0;this.startFromEven&&(i=!i);let o=!0,s=-1;do{this.findNextPair(e,t,s),r=this.parseFoundFinderPattern(e,n,i),null==r?s=it.getNextSecondBar(e,this.startEnd[0]):o=!1}while(o);let a,l=this.decodeDataCharacter(e,r,i,!0);if(!this.isEmptyPair(t)&&t[t.length-1].mustBeLast())throw new T;try{a=this.decodeDataCharacter(e,r,i,!1)}catch(e){a=null,this.verbose&&console.log(e)}return new nt(l,a,r,!0)}isEmptyPair(e){return 0===e.length}findNextPair(e,t,n){let r=this.getDecodeFinderCounters();r[0]=0,r[1]=0,r[2]=0,r[3]=0;let i,o=e.getSize();i=n>=0?n:this.isEmptyPair(t)?0:t[t.length-1].getFinderPattern().getStartEnd()[1];let s=t.length%2!=0;this.startFromEven&&(s=!s);let a=!1;for(;i<o&&(a=!e.get(i),a);)i++;let l=0,c=i;for(let t=i;t<o;t++)if(e.get(t)!=a)r[l]++;else{if(3==l){if(s&&it.reverseCounters(r),it.isFinderPattern(r))return this.startEnd[0]=c,void(this.startEnd[1]=t);s&&it.reverseCounters(r),c+=r[0]+r[1],r[0]=r[2],r[1]=r[3],r[2]=0,r[3]=0,l--}else l++;r[l]=1,a=!a}throw new T}static reverseCounters(e){let t=e.length;for(let n=0;n<t/2;++n){let r=e[n];e[n]=e[t-n-1],e[t-n-1]=r}}parseFoundFinderPattern(e,t,n){let r,i,o;if(n){let t=this.startEnd[0]-1;for(;t>=0&&!e.get(t);)t--;t++,r=this.startEnd[0]-t,i=t,o=this.startEnd[1]}else i=this.startEnd[0],o=e.getNextUnset(this.startEnd[1]+1),r=o-this.startEnd[1];let s,a=this.getDecodeFinderCounters();m.arraycopy(a,0,a,1,a.length-1),a[0]=r;try{s=this.parseFinderValue(a,it.FINDER_PATTERNS)}catch(e){return null}return new Oe(s,[i,o],i,o,t)}decodeDataCharacter(e,t,n,r){let i=this.getDataCharacterCounters();for(let e=0;e<i.length;e++)i[e]=0;if(r)it.recordPatternInReverse(e,t.getStartEnd()[0],i);else{it.recordPattern(e,t.getStartEnd()[1],i);for(let e=0,t=i.length-1;e<t;e++,t--){let n=i[e];i[e]=i[t],i[t]=n}}let o=17,s=ie.sum(new Int32Array(i))/o,a=(t.getStartEnd()[1]-t.getStartEnd()[0])/15;if(Math.abs(s-a)/a>.3)throw new T;let l=this.getOddCounts(),c=this.getEvenCounts(),d=this.getOddRoundingErrors(),u=this.getEvenRoundingErrors();for(let e=0;e<i.length;e++){let t=1*i[e]/s,n=t+.5;if(n<1){if(t<.3)throw new T;n=1}else if(n>8){if(t>8.7)throw new T;n=8}let r=e/2;1&e?(c[r]=n,u[r]=t-n):(l[r]=n,d[r]=t-n)}this.adjustOddEvenCounts(o);let f=4*t.getValue()+(n?0:2)+(r?0:1)-1,h=0,m=0;for(let e=l.length-1;e>=0;e--){if(it.isNotA1left(t,n,r)){let t=it.WEIGHTS[f][2*e];m+=l[e]*t}h+=l[e]}let p=0;for(let e=c.length-1;e>=0;e--)if(it.isNotA1left(t,n,r)){let t=it.WEIGHTS[f][2*e+1];p+=c[e]*t}let g=m+p;if(1&h||h>13||h<4)throw new T;let w=(13-h)/2,y=it.SYMBOL_WIDEST[w],v=9-y,$=Me.getRSSvalue(l,y,!0),I=Me.getRSSvalue(c,v,!1),_=it.EVEN_TOTAL_SUBSET[w],C=it.GSUM[w];return new ke($*_+I+C,g)}static isNotA1left(e,t,n){return!(0==e.getValue()&&t&&n)}adjustOddEvenCounts(e){let t=ie.sum(new Int32Array(this.getOddCounts())),n=ie.sum(new Int32Array(this.getEvenCounts())),r=!1,i=!1;t>13?i=!0:t<4&&(r=!0);let o=!1,s=!1;n>13?s=!0:n<4&&(o=!0);let a=t+n-e,l=!(1&~t),c=!(1&n);if(1==a)if(l){if(c)throw new T;i=!0}else{if(!c)throw new T;s=!0}else if(-1==a)if(l){if(c)throw new T;r=!0}else{if(!c)throw new T;o=!0}else{if(0!=a)throw new T;if(l){if(!c)throw new T;t<n?(r=!0,s=!0):(i=!0,o=!0)}else if(c)throw new T}if(r){if(i)throw new T;it.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(i&&it.decrement(this.getOddCounts(),this.getOddRoundingErrors()),o){if(s)throw new T;it.increment(this.getEvenCounts(),this.getOddRoundingErrors())}s&&it.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}it.SYMBOL_WIDEST=[7,5,4,3,1],it.EVEN_TOTAL_SUBSET=[4,20,52,104,204],it.GSUM=[0,348,1388,2948,3988],it.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])],it.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]],it.FINDER_PAT_A=0,it.FINDER_PAT_B=1,it.FINDER_PAT_C=2,it.FINDER_PAT_D=3,it.FINDER_PAT_E=4,it.FINDER_PAT_F=5,it.FINDER_PATTERN_SEQUENCES=[[it.FINDER_PAT_A,it.FINDER_PAT_A],[it.FINDER_PAT_A,it.FINDER_PAT_B,it.FINDER_PAT_B],[it.FINDER_PAT_A,it.FINDER_PAT_C,it.FINDER_PAT_B,it.FINDER_PAT_D],[it.FINDER_PAT_A,it.FINDER_PAT_E,it.FINDER_PAT_B,it.FINDER_PAT_D,it.FINDER_PAT_C],[it.FINDER_PAT_A,it.FINDER_PAT_E,it.FINDER_PAT_B,it.FINDER_PAT_D,it.FINDER_PAT_D,it.FINDER_PAT_F],[it.FINDER_PAT_A,it.FINDER_PAT_E,it.FINDER_PAT_B,it.FINDER_PAT_D,it.FINDER_PAT_E,it.FINDER_PAT_F,it.FINDER_PAT_F],[it.FINDER_PAT_A,it.FINDER_PAT_A,it.FINDER_PAT_B,it.FINDER_PAT_B,it.FINDER_PAT_C,it.FINDER_PAT_C,it.FINDER_PAT_D,it.FINDER_PAT_D],[it.FINDER_PAT_A,it.FINDER_PAT_A,it.FINDER_PAT_B,it.FINDER_PAT_B,it.FINDER_PAT_C,it.FINDER_PAT_C,it.FINDER_PAT_D,it.FINDER_PAT_E,it.FINDER_PAT_E],[it.FINDER_PAT_A,it.FINDER_PAT_A,it.FINDER_PAT_B,it.FINDER_PAT_B,it.FINDER_PAT_C,it.FINDER_PAT_C,it.FINDER_PAT_D,it.FINDER_PAT_E,it.FINDER_PAT_F,it.FINDER_PAT_F],[it.FINDER_PAT_A,it.FINDER_PAT_A,it.FINDER_PAT_B,it.FINDER_PAT_B,it.FINDER_PAT_C,it.FINDER_PAT_D,it.FINDER_PAT_D,it.FINDER_PAT_E,it.FINDER_PAT_E,it.FINDER_PAT_F,it.FINDER_PAT_F]],it.MAX_PAIRS=11;class ot extends ke{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 st extends xe{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(e,t,n){const r=this.decodePair(t,!1,e,n);st.addOrTally(this.possibleLeftPairs,r),t.reverse();let i=this.decodePair(t,!0,e,n);st.addOrTally(this.possibleRightPairs,i),t.reverse();for(let e of this.possibleLeftPairs)if(e.getCount()>1)for(let t of this.possibleRightPairs)if(t.getCount()>1&&st.checkChecksum(e,t))return st.constructResult(e,t);throw new T}static addOrTally(e,t){if(null==t)return;let n=!1;for(let r of e)if(r.getValue()===t.getValue()){r.incrementCount(),n=!0;break}n||e.push(t)}reset(){this.possibleLeftPairs.length=0,this.possibleRightPairs.length=0}static constructResult(e,t){let n=4537077*e.getValue()+t.getValue(),r=new String(n).toString(),i=new S;for(let e=13-r.length;e>0;e--)i.append("0");i.append(r);let o=0;for(let e=0;e<13;e++){let t=i.charAt(e).charCodeAt(0)-"0".charCodeAt(0);o+=1&e?t:3*t}o=10-o%10,10===o&&(o=0),i.append(o.toString());let s=e.getFinderPattern().getResultPoints(),a=t.getFinderPattern().getResultPoints();return new F(i.toString(),null,0,[s[0],s[1],a[0],a[1]],U.RSS_14,(new Date).getTime())}static checkChecksum(e,t){let n=(e.getChecksumPortion()+16*t.getChecksumPortion())%79,r=9*e.getFinderPattern().getValue()+t.getFinderPattern().getValue();return r>72&&r--,r>8&&r--,n===r}decodePair(e,t,n,r){try{let i=this.findFinderPattern(e,t),o=this.parseFoundFinderPattern(e,n,t,i),s=null==r?null:r.get(I.NEED_RESULT_POINT_CALLBACK);if(null!=s){let r=(i[0]+i[1])/2;t&&(r=e.getSize()-1-r),s.foundPossibleResultPoint(new se(r,n))}let a=this.decodeDataCharacter(e,o,!0),l=this.decodeDataCharacter(e,o,!1);return new ot(1597*a.getValue()+l.getValue(),a.getChecksumPortion()+4*l.getChecksumPortion(),o)}catch(e){return null}}decodeDataCharacter(e,t,n){let r=this.getDataCharacterCounters();for(let e=0;e<r.length;e++)r[e]=0;if(n)ye.recordPatternInReverse(e,t.getStartEnd()[0],r);else{ye.recordPattern(e,t.getStartEnd()[1]+1,r);for(let e=0,t=r.length-1;e<t;e++,t--){let n=r[e];r[e]=r[t],r[t]=n}}let i=n?16:15,o=ie.sum(new Int32Array(r))/i,s=this.getOddCounts(),a=this.getEvenCounts(),l=this.getOddRoundingErrors(),c=this.getEvenRoundingErrors();for(let e=0;e<r.length;e++){let t=r[e]/o,n=Math.floor(t+.5);n<1?n=1:n>8&&(n=8);let i=Math.floor(e/2);1&e?(a[i]=n,c[i]=t-n):(s[i]=n,l[i]=t-n)}this.adjustOddEvenCounts(n,i);let d=0,u=0;for(let e=s.length-1;e>=0;e--)u*=9,u+=s[e],d+=s[e];let f=0,h=0;for(let e=a.length-1;e>=0;e--)f*=9,f+=a[e],h+=a[e];let m=u+3*f;if(n){if(1&d||d>12||d<4)throw new T;let e=(12-d)/2,t=st.OUTSIDE_ODD_WIDEST[e],n=9-t,r=Me.getRSSvalue(s,t,!1),i=Me.getRSSvalue(a,n,!0),o=st.OUTSIDE_EVEN_TOTAL_SUBSET[e],l=st.OUTSIDE_GSUM[e];return new ke(r*o+i+l,m)}{if(1&h||h>10||h<4)throw new T;let e=(10-h)/2,t=st.INSIDE_ODD_WIDEST[e],n=9-t,r=Me.getRSSvalue(s,t,!0),i=Me.getRSSvalue(a,n,!1),o=st.INSIDE_ODD_TOTAL_SUBSET[e],l=st.INSIDE_GSUM[e];return new ke(i*o+r+l,m)}}findFinderPattern(e,t){let n=this.getDecodeFinderCounters();n[0]=0,n[1]=0,n[2]=0,n[3]=0;let r=e.getSize(),i=!1,o=0;for(;o<r&&(i=!e.get(o),t!==i);)o++;let s=0,a=o;for(let t=o;t<r;t++)if(e.get(t)!==i)n[s]++;else{if(3===s){if(xe.isFinderPattern(n))return[a,t];a+=n[0]+n[1],n[0]=n[2],n[1]=n[3],n[2]=0,n[3]=0,s--}else s++;n[s]=1,i=!i}throw new T}parseFoundFinderPattern(e,t,n,r){let i=e.get(r[0]),o=r[0]-1;for(;o>=0&&i!==e.get(o);)o--;o++;const s=r[0]-o,a=this.getDecodeFinderCounters(),l=new Int32Array(a.length);m.arraycopy(a,0,l,1,a.length-1),l[0]=s;const c=this.parseFinderValue(l,st.FINDER_PATTERNS);let d=o,u=r[1];return n&&(d=e.getSize()-1-d,u=e.getSize()-1-u),new Oe(c,[o,r[1]],d,u,t)}adjustOddEvenCounts(e,t){let n=ie.sum(new Int32Array(this.getOddCounts())),r=ie.sum(new Int32Array(this.getEvenCounts())),i=!1,o=!1,s=!1,a=!1;e?(n>12?o=!0:n<4&&(i=!0),r>12?a=!0:r<4&&(s=!0)):(n>11?o=!0:n<5&&(i=!0),r>10?a=!0:r<4&&(s=!0));let l=n+r-t,c=(1&n)==(e?1:0),d=!(1&~r);if(1===l)if(c){if(d)throw new T;o=!0}else{if(!d)throw new T;a=!0}else if(-1===l)if(c){if(d)throw new T;i=!0}else{if(!d)throw new T;s=!0}else{if(0!==l)throw new T;if(c){if(!d)throw new T;n<r?(i=!0,a=!0):(o=!0,s=!0)}else if(d)throw new T}if(i){if(o)throw new T;xe.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(o&&xe.decrement(this.getOddCounts(),this.getOddRoundingErrors()),s){if(a)throw new T;xe.increment(this.getEvenCounts(),this.getOddRoundingErrors())}a&&xe.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}st.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],st.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],st.OUTSIDE_GSUM=[0,161,961,2015,2715],st.INSIDE_GSUM=[0,336,1036,1516],st.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],st.INSIDE_ODD_WIDEST=[2,4,6,8],st.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 at extends ye{constructor(e,t){super(),this.readers=[],this.verbose=!0===t;const n=e?e.get(I.POSSIBLE_FORMATS):null,r=e&&void 0!==e.get(I.ASSUME_CODE_39_CHECK_DIGIT);n?((n.includes(U.EAN_13)||n.includes(U.UPC_A)||n.includes(U.EAN_8)||n.includes(U.UPC_E))&&this.readers.push(new De(e)),n.includes(U.CODE_39)&&this.readers.push(new $e(r)),n.includes(U.CODE_128)&&this.readers.push(new ve),n.includes(U.ITF)&&this.readers.push(new Ie),n.includes(U.RSS_14)&&this.readers.push(new st),n.includes(U.RSS_EXPANDED)&&this.readers.push(new it(this.verbose))):(this.readers.push(new De(e)),this.readers.push(new $e),this.readers.push(new De(e)),this.readers.push(new ve),this.readers.push(new Ie),this.readers.push(new st),this.readers.push(new it(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(e){}throw new T}reset(){this.readers.forEach(e=>e.reset())}}class lt extends L{constructor(e=500,t){super(new at(t),e,t)}}class ct{constructor(e,t,n){this.ecCodewords=e,this.ecBlocks=[t],n&&this.ecBlocks.push(n)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class dt{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class ut{constructor(e,t,n,r,i,o){this.versionNumber=e,this.symbolSizeRows=t,this.symbolSizeColumns=n,this.dataRegionSizeRows=r,this.dataRegionSizeColumns=i,this.ecBlocks=o;let s=0;const a=o.getECCodewords(),l=o.getECBlocks();for(let e of l)s+=e.getCount()*(e.getDataCodewords()+a);this.totalCodewords=s}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(1&e||1&t)throw new _;for(let n of ut.VERSIONS)if(n.symbolSizeRows===e&&n.symbolSizeColumns===t)return n;throw new _}toString(){return""+this.versionNumber}static buildVersions(){return[new ut(1,10,10,8,8,new ct(5,new dt(1,3))),new ut(2,12,12,10,10,new ct(7,new dt(1,5))),new ut(3,14,14,12,12,new ct(10,new dt(1,8))),new ut(4,16,16,14,14,new ct(12,new dt(1,12))),new ut(5,18,18,16,16,new ct(14,new dt(1,18))),new ut(6,20,20,18,18,new ct(18,new dt(1,22))),new ut(7,22,22,20,20,new ct(20,new dt(1,30))),new ut(8,24,24,22,22,new ct(24,new dt(1,36))),new ut(9,26,26,24,24,new ct(28,new dt(1,44))),new ut(10,32,32,14,14,new ct(36,new dt(1,62))),new ut(11,36,36,16,16,new ct(42,new dt(1,86))),new ut(12,40,40,18,18,new ct(48,new dt(1,114))),new ut(13,44,44,20,20,new ct(56,new dt(1,144))),new ut(14,48,48,22,22,new ct(68,new dt(1,174))),new ut(15,52,52,24,24,new ct(42,new dt(2,102))),new ut(16,64,64,14,14,new ct(56,new dt(2,140))),new ut(17,72,72,16,16,new ct(36,new dt(4,92))),new ut(18,80,80,18,18,new ct(48,new dt(4,114))),new ut(19,88,88,20,20,new ct(56,new dt(4,144))),new ut(20,96,96,22,22,new ct(68,new dt(4,174))),new ut(21,104,104,24,24,new ct(56,new dt(6,136))),new ut(22,120,120,18,18,new ct(68,new dt(6,175))),new ut(23,132,132,20,20,new ct(62,new dt(8,163))),new ut(24,144,144,22,22,new ct(62,new dt(8,156),new dt(2,155))),new ut(25,8,18,6,16,new ct(7,new dt(1,5))),new ut(26,8,32,6,14,new ct(11,new dt(1,10))),new ut(27,12,26,10,24,new ct(14,new dt(1,16))),new ut(28,12,36,10,16,new ct(18,new dt(1,22))),new ut(29,16,36,14,16,new ct(24,new dt(1,32))),new ut(30,16,48,14,22,new ct(28,new dt(1,49)))]}}ut.VERSIONS=ut.buildVersions();class ft{constructor(e){const t=e.getHeight();if(t<8||t>144||1&t)throw new _;this.version=ft.readVersion(e),this.mappingBitMatrix=this.extractDataRegion(e),this.readMappingMatrix=new N(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(e){const t=e.getHeight(),n=e.getWidth();return ut.getVersionForDimensions(t,n)}readCodewords(){const e=new Int8Array(this.version.getTotalCodewords());let t=0,n=4,r=0;const i=this.mappingBitMatrix.getHeight(),o=this.mappingBitMatrix.getWidth();let s=!1,a=!1,l=!1,c=!1;do{if(n!==i||0!==r||s)if(n===i-2&&0===r&&3&o&&!a)e[t++]=255&this.readCorner2(i,o),n-=2,r+=2,a=!0;else if(n!==i+4||2!==r||7&o||l)if(n!==i-2||0!==r||4!=(7&o)||c){do{n<i&&r>=0&&!this.readMappingMatrix.get(r,n)&&(e[t++]=255&this.readUtah(n,r,i,o)),n-=2,r+=2}while(n>=0&&r<o);n+=1,r+=3;do{n>=0&&r<o&&!this.readMappingMatrix.get(r,n)&&(e[t++]=255&this.readUtah(n,r,i,o)),n+=2,r-=2}while(n<i&&r>=0);n+=3,r+=1}else e[t++]=255&this.readCorner4(i,o),n-=2,r+=2,c=!0;else e[t++]=255&this.readCorner3(i,o),n-=2,r+=2,l=!0;else e[t++]=255&this.readCorner1(i,o),n-=2,r+=2,s=!0}while(n<i||r<o);if(t!==this.version.getTotalCodewords())throw new _;return e}readModule(e,t,n,r){return e<0&&(e+=n,t+=4-(n+4&7)),t<0&&(t+=r,e+=4-(r+4&7)),this.readMappingMatrix.set(t,e),this.mappingBitMatrix.get(t,e)}readUtah(e,t,n,r){let i=0;return this.readModule(e-2,t-2,n,r)&&(i|=1),i<<=1,this.readModule(e-2,t-1,n,r)&&(i|=1),i<<=1,this.readModule(e-1,t-2,n,r)&&(i|=1),i<<=1,this.readModule(e-1,t-1,n,r)&&(i|=1),i<<=1,this.readModule(e-1,t,n,r)&&(i|=1),i<<=1,this.readModule(e,t-2,n,r)&&(i|=1),i<<=1,this.readModule(e,t-1,n,r)&&(i|=1),i<<=1,this.readModule(e,t,n,r)&&(i|=1),i}readCorner1(e,t){let n=0;return this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,1,e,t)&&(n|=1),n<<=1,this.readModule(e-1,2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(2,t-1,e,t)&&(n|=1),n<<=1,this.readModule(3,t-1,e,t)&&(n|=1),n}readCorner2(e,t){let n=0;return this.readModule(e-3,0,e,t)&&(n|=1),n<<=1,this.readModule(e-2,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(0,t-4,e,t)&&(n|=1),n<<=1,this.readModule(0,t-3,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n}readCorner3(e,t){let n=0;return this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(0,t-3,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-3,e,t)&&(n|=1),n<<=1,this.readModule(1,t-2,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n}readCorner4(e,t){let n=0;return this.readModule(e-3,0,e,t)&&(n|=1),n<<=1,this.readModule(e-2,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(2,t-1,e,t)&&(n|=1),n<<=1,this.readModule(3,t-1,e,t)&&(n|=1),n}extractDataRegion(e){const t=this.version.getSymbolSizeRows(),n=this.version.getSymbolSizeColumns();if(e.getHeight()!==t)throw new d("Dimension of bitMatrix must match the version size");const r=this.version.getDataRegionSizeRows(),i=this.version.getDataRegionSizeColumns(),o=t/r|0,s=n/i|0,a=new N(s*i,o*r);for(let t=0;t<o;++t){const n=t*r;for(let o=0;o<s;++o){const s=o*i;for(let l=0;l<r;++l){const c=t*(r+2)+1+l,d=n+l;for(let t=0;t<i;++t){const n=o*(i+2)+1+t;if(e.get(n,c)){const e=s+t;a.set(e,d)}}}}}return a}}class ht{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t){const n=t.getECBlocks();let r=0;const i=n.getECBlocks();for(let e of i)r+=e.getCount();const o=new Array(r);let s=0;for(let e of i)for(let t=0;t<e.getCount();t++){const t=e.getDataCodewords(),r=n.getECCodewords()+t;o[s++]=new ht(t,new Uint8Array(r))}const a=o[0].codewords.length-n.getECCodewords(),l=a-1;let c=0;for(let t=0;t<l;t++)for(let n=0;n<s;n++)o[n].codewords[t]=e[c++];const u=24===t.getVersionNumber(),f=u?8:s;for(let t=0;t<f;t++)o[t].codewords[a-1]=e[c++];const h=o[0].codewords.length;for(let t=a;t<h;t++)for(let n=0;n<s;n++){const r=u?(n+8)%s:n,i=u&&r>7?t-1:t;o[r].codewords[i]=e[c++]}if(c!==e.length)throw new d;return o}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class mt{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 d(""+e);let t=0,n=this.bitOffset,r=this.byteOffset;const i=this.bytes;if(n>0){const o=8-n,s=e<o?e:o,a=o-s,l=255>>8-s<<a;t=(i[r]&l)>>a,e-=s,n+=s,8===n&&(n=0,r++)}if(e>0){for(;e>=8;)t=t<<8|255&i[r],r++,e-=8;if(e>0){const o=8-e,s=255>>o<<o;t=t<<e|(i[r]&s)>>o,n+=e}}return this.bitOffset=n,this.byteOffset=r,t}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}!function(e){e[e.PAD_ENCODE=0]="PAD_ENCODE",e[e.ASCII_ENCODE=1]="ASCII_ENCODE",e[e.C40_ENCODE=2]="C40_ENCODE",e[e.TEXT_ENCODE=3]="TEXT_ENCODE",e[e.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",e[e.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",e[e.BASE256_ENCODE=6]="BASE256_ENCODE"}(z||(z={}));class pt{static decode(e){const t=new mt(e),n=new S,r=new S,i=new Array;let o=z.ASCII_ENCODE;do{if(o===z.ASCII_ENCODE)o=this.decodeAsciiSegment(t,n,r);else{switch(o){case z.C40_ENCODE:this.decodeC40Segment(t,n);break;case z.TEXT_ENCODE:this.decodeTextSegment(t,n);break;case z.ANSIX12_ENCODE:this.decodeAnsiX12Segment(t,n);break;case z.EDIFACT_ENCODE:this.decodeEdifactSegment(t,n);break;case z.BASE256_ENCODE:this.decodeBase256Segment(t,n,i);break;default:throw new _}o=z.ASCII_ENCODE}}while(o!==z.PAD_ENCODE&&t.available()>0);return r.length()>0&&n.append(r.toString()),new Y(e,n.toString(),0===i.length?null:i,null)}static decodeAsciiSegment(e,t,n){let r=!1;do{let i=e.readBits(8);if(0===i)throw new _;if(i<=128)return r&&(i+=128),t.append(String.fromCharCode(i-1)),z.ASCII_ENCODE;if(129===i)return z.PAD_ENCODE;if(i<=229){const e=i-130;e<10&&t.append("0"),t.append(""+e)}else switch(i){case 230:return z.C40_ENCODE;case 231:return z.BASE256_ENCODE;case 232:t.append(String.fromCharCode(29));break;case 233:case 234:case 241: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 z.ANSIX12_ENCODE;case 239:return z.TEXT_ENCODE;case 240:return z.EDIFACT_ENCODE;default:if(254!==i||0!==e.available())throw new _}}while(e.available()>0);return z.ASCII_ENCODE}static decodeC40Segment(e,t){let n=!1;const r=[];let i=0;do{if(8===e.available())return;const o=e.readBits(8);if(254===o)return;this.parseTwoBytes(o,e.readBits(8),r);for(let e=0;e<3;e++){const o=r[e];switch(i){case 0:if(o<3)i=o+1;else{if(!(o<this.C40_BASIC_SET_CHARS.length))throw new _;{const e=this.C40_BASIC_SET_CHARS[o];n?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),n=!1):t.append(e)}}break;case 1:n?(t.append(String.fromCharCode(o+128)),n=!1):t.append(String.fromCharCode(o)),i=0;break;case 2:if(o<this.C40_SHIFT2_SET_CHARS.length){const e=this.C40_SHIFT2_SET_CHARS[o];n?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),n=!1):t.append(e)}else switch(o){case 27:t.append(String.fromCharCode(29));break;case 30:n=!0;break;default:throw new _}i=0;break;case 3:n?(t.append(String.fromCharCode(o+224)),n=!1):t.append(String.fromCharCode(o+96)),i=0;break;default:throw new _}}}while(e.available()>0)}static decodeTextSegment(e,t){let n=!1,r=[],i=0;do{if(8===e.available())return;const o=e.readBits(8);if(254===o)return;this.parseTwoBytes(o,e.readBits(8),r);for(let e=0;e<3;e++){const o=r[e];switch(i){case 0:if(o<3)i=o+1;else{if(!(o<this.TEXT_BASIC_SET_CHARS.length))throw new _;{const e=this.TEXT_BASIC_SET_CHARS[o];n?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),n=!1):t.append(e)}}break;case 1:n?(t.append(String.fromCharCode(o+128)),n=!1):t.append(String.fromCharCode(o)),i=0;break;case 2:if(o<this.TEXT_SHIFT2_SET_CHARS.length){const e=this.TEXT_SHIFT2_SET_CHARS[o];n?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),n=!1):t.append(e)}else switch(o){case 27:t.append(String.fromCharCode(29));break;case 30:n=!0;break;default:throw new _}i=0;break;case 3:if(!(o<this.TEXT_SHIFT3_SET_CHARS.length))throw new _;{const e=this.TEXT_SHIFT3_SET_CHARS[o];n?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),n=!1):t.append(e),i=0}break;default:throw new _}}}while(e.available()>0)}static decodeAnsiX12Segment(e,t){const n=[];do{if(8===e.available())return;const r=e.readBits(8);if(254===r)return;this.parseTwoBytes(r,e.readBits(8),n);for(let e=0;e<3;e++){const r=n[e];switch(r){case 0:t.append("\r");break;case 1:t.append("*");break;case 2:t.append(">");break;case 3:t.append(" ");break;default:if(r<14)t.append(String.fromCharCode(r+44));else{if(!(r<40))throw new _;t.append(String.fromCharCode(r+51))}}}}while(e.available()>0)}static parseTwoBytes(e,t,n){let r=(e<<8)+t-1,i=Math.floor(r/1600);n[0]=i,r-=1600*i,i=Math.floor(r/40),n[1]=i,n[2]=r-40*i}static decodeEdifactSegment(e,t){do{if(e.available()<=16)return;for(let n=0;n<4;n++){let n=e.readBits(6);if(31===n){const t=8-e.getBitOffset();return void(8!==t&&e.readBits(t))}32&n||(n|=64),t.append(String.fromCharCode(n))}}while(e.available()>0)}static decodeBase256Segment(e,t,n){let r=1+e.getByteOffset();const i=this.unrandomize255State(e.readBits(8),r++);let o;if(o=0===i?e.available()/8|0:i<250?i:250*(i-249)+this.unrandomize255State(e.readBits(8),r++),o<0)throw new _;const s=new Uint8Array(o);for(let t=0;t<o;t++){if(e.available()<8)throw new _;s[t]=this.unrandomize255State(e.readBits(8),r++)}n.push(s);try{t.append(A.decode(s,b.ISO88591))}catch(e){throw new te("Platform does not support required encoding: "+e.message)}}static unrandomize255State(e,t){const n=e-(149*t%255+1);return n>=0?n:n+256}}pt.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"],pt.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],pt.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"],pt.TEXT_SHIFT2_SET_CHARS=pt.C40_SHIFT2_SET_CHARS,pt.TEXT_SHIFT3_SET_CHARS=["`","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","{","|","}","~",String.fromCharCode(127)];class gt{constructor(){this.rsDecoder=new ne(J.DATA_MATRIX_FIELD_256)}decode(e){const t=new ft(e),n=t.getVersion(),r=t.readCodewords(),i=ht.getDataBlocks(r,n);let o=0;for(let e of i)o+=e.getNumDataCodewords();const s=new Uint8Array(o),a=i.length;for(let e=0;e<a;e++){const t=i[e],n=t.getCodewords(),r=t.getNumDataCodewords();this.correctErrors(n,r);for(let t=0;t<r;t++)s[t*a+e]=n[t]}return pt.decode(s)}correctErrors(e,t){const n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch(e){throw new f}for(let r=0;r<t;r++)e[r]=n[r]}}class wt{constructor(e){this.image=e,this.rectangleDetector=new ce(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 T;t=this.shiftToModuleCenter(t);const n=t[0],r=t[1],i=t[2],o=t[3];let s=this.transitionsBetween(n,o)+1,a=this.transitionsBetween(i,o)+1;1&~s||(s+=1),1&~a||(a+=1),4*s<7*a&&4*a<7*s&&(s=a=Math.max(s,a));let l=wt.sampleGrid(this.image,n,r,i,o,s,a);return new ae(l,[n,r,i,o])}static shiftPoint(e,t,n){let r=(t.getX()-e.getX())/(n+1),i=(t.getY()-e.getY())/(n+1);return new se(e.getX()+r,e.getY()+i)}static moveAway(e,t,n){let r=e.getX(),i=e.getY();return r<t?r-=1:r+=1,i<n?i-=1:i+=1,new se(r,i)}detectSolid1(e){let t=e[0],n=e[1],r=e[3],i=e[2],o=this.transitionsBetween(t,n),s=this.transitionsBetween(n,r),a=this.transitionsBetween(r,i),l=this.transitionsBetween(i,t),c=o,d=[i,t,n,r];return c>s&&(c=s,d[0]=t,d[1]=n,d[2]=r,d[3]=i),c>a&&(c=a,d[0]=n,d[1]=r,d[2]=i,d[3]=t),c>l&&(d[0]=r,d[1]=i,d[2]=t,d[3]=n),d}detectSolid2(e){let t=e[0],n=e[1],r=e[2],i=e[3],o=this.transitionsBetween(t,i),s=wt.shiftPoint(n,r,4*(o+1)),a=wt.shiftPoint(r,n,4*(o+1));return this.transitionsBetween(s,t)<this.transitionsBetween(a,i)?(e[0]=t,e[1]=n,e[2]=r,e[3]=i):(e[0]=n,e[1]=r,e[2]=i,e[3]=t),e}correctTopRight(e){let t=e[0],n=e[1],r=e[2],i=e[3],o=this.transitionsBetween(t,i),s=this.transitionsBetween(n,i),a=wt.shiftPoint(t,n,4*(s+1)),l=wt.shiftPoint(r,n,4*(o+1));o=this.transitionsBetween(a,i),s=this.transitionsBetween(l,i);let c=new se(i.getX()+(r.getX()-n.getX())/(o+1),i.getY()+(r.getY()-n.getY())/(o+1)),d=new se(i.getX()+(t.getX()-n.getX())/(s+1),i.getY()+(t.getY()-n.getY())/(s+1));return this.isValid(c)?this.isValid(d)?this.transitionsBetween(a,c)+this.transitionsBetween(l,c)>this.transitionsBetween(a,d)+this.transitionsBetween(l,d)?c:d:c:this.isValid(d)?d:null}shiftToModuleCenter(e){let t=e[0],n=e[1],r=e[2],i=e[3],o=this.transitionsBetween(t,i)+1,s=this.transitionsBetween(r,i)+1,a=wt.shiftPoint(t,n,4*s),l=wt.shiftPoint(r,n,4*o);o=this.transitionsBetween(a,i)+1,s=this.transitionsBetween(l,i)+1,1&~o||(o+=1),1&~s||(s+=1);let c,d,u=(t.getX()+n.getX()+r.getX()+i.getX())/4,f=(t.getY()+n.getY()+r.getY()+i.getY())/4;return t=wt.moveAway(t,u,f),n=wt.moveAway(n,u,f),r=wt.moveAway(r,u,f),i=wt.moveAway(i,u,f),a=wt.shiftPoint(t,n,4*s),a=wt.shiftPoint(a,i,4*o),c=wt.shiftPoint(n,t,4*s),c=wt.shiftPoint(c,r,4*o),l=wt.shiftPoint(r,i,4*s),l=wt.shiftPoint(l,n,4*o),d=wt.shiftPoint(i,r,4*s),d=wt.shiftPoint(d,t,4*o),[a,c,l,d]}isValid(e){return e.getX()>=0&&e.getX()<this.image.getWidth()&&e.getY()>0&&e.getY()<this.image.getHeight()}static sampleGrid(e,t,n,r,i,o,s){return he.getInstance().sampleGrid(e,o,s,.5,.5,o-.5,.5,o-.5,s-.5,.5,s-.5,t.getX(),t.getY(),i.getX(),i.getY(),r.getX(),r.getY(),n.getX(),n.getY())}transitionsBetween(e,t){let n=Math.trunc(e.getX()),r=Math.trunc(e.getY()),i=Math.trunc(t.getX()),o=Math.trunc(t.getY()),s=Math.abs(o-r)>Math.abs(i-n);if(s){let e=n;n=r,r=e,e=i,i=o,o=e}let a=Math.abs(i-n),l=Math.abs(o-r),c=-a/2,d=r<o?1:-1,u=n<i?1:-1,f=0,h=this.image.get(s?r:n,s?n:r);for(let e=n,t=r;e!==i;e+=u){let n=this.image.get(s?t:e,s?e:t);if(n!==h&&(f++,h=n),c+=l,c>0){if(t===o)break;t+=d,c-=a}}return f}}class yt{constructor(){this.decoder=new gt}decode(e,t=null){let n,r;if(null!=t&&t.has(I.PURE_BARCODE)){const t=yt.extractPureBits(e.getBlackMatrix());n=this.decoder.decode(t),r=yt.NO_POINTS}else{const t=new wt(e.getBlackMatrix()).detect();n=this.decoder.decode(t.getBits()),r=t.getPoints()}const i=n.getRawBytes(),o=new F(n.getText(),i,8*i.length,r,U.DATA_MATRIX,m.currentTimeMillis()),s=n.getByteSegments();null!=s&&o.putMetadata(X.BYTE_SEGMENTS,s);const a=n.getECLevel();return null!=a&&o.putMetadata(X.ERROR_CORRECTION_LEVEL,a),o}reset(){}static extractPureBits(e){const t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(null==t||null==n)throw new T;const r=this.moduleSize(t,e);let i=t[1];const o=n[1];let s=t[0];const a=(n[0]-s+1)/r,l=(o-i+1)/r;if(a<=0||l<=0)throw new T;const c=r/2;i+=c,s+=c;const d=new N(a,l);for(let t=0;t<l;t++){const n=i+t*r;for(let i=0;i<a;i++)e.get(s+i*r,n)&&d.set(i,t)}return d}static moduleSize(e,t){const n=t.getWidth();let r=e[0];const i=e[1];for(;r<n&&t.get(r,i);)r++;if(r===n)throw new T;const o=r-e[0];if(0===o)throw new T;return o}}yt.NO_POINTS=[];class vt extends L{constructor(e=500){super(new yt,e)}}!function(e){e[e.L=0]="L",e[e.M=1]="M",e[e.Q=2]="Q",e[e.H=3]="H"}(H||(H={}));class $t{constructor(e,t,n){this.value=e,this.stringValue=t,this.bits=n,$t.FOR_BITS.set(n,this),$t.FOR_VALUE.set(e,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(e){switch(e){case"L":return $t.L;case"M":return $t.M;case"Q":return $t.Q;case"H":return $t.H;default:throw new c(e+"not available")}}toString(){return this.stringValue}equals(e){if(!(e instanceof $t))return!1;const t=e;return this.value===t.value}static forBits(e){if(e<0||e>=$t.FOR_BITS.size)throw new d;return $t.FOR_BITS.get(e)}}$t.FOR_BITS=new Map,$t.FOR_VALUE=new Map,$t.L=new $t(H.L,"L",1),$t.M=new $t(H.M,"M",0),$t.Q=new $t(H.Q,"Q",3),$t.H=new $t(H.H,"H",2);class It{constructor(e){this.errorCorrectionLevel=$t.forBits(e>>3&3),this.dataMask=7&e}static numBitsDiffering(e,t){return y.bitCount(e^t)}static decodeFormatInformation(e,t){const n=It.doDecodeFormatInformation(e,t);return null!==n?n:It.doDecodeFormatInformation(e^It.FORMAT_INFO_MASK_QR,t^It.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(e,t){let n=Number.MAX_SAFE_INTEGER,r=0;for(const i of It.FORMAT_INFO_DECODE_LOOKUP){const o=i[0];if(o===e||o===t)return new It(i[1]);let s=It.numBitsDiffering(e,o);s<n&&(r=i[1],n=s),e!==t&&(s=It.numBitsDiffering(t,o),s<n&&(r=i[1],n=s))}return n<=3?new It(r):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(e){if(!(e instanceof It))return!1;const t=e;return this.errorCorrectionLevel===t.errorCorrectionLevel&&this.dataMask===t.dataMask}}It.FORMAT_INFO_MASK_QR=21522,It.FORMAT_INFO_DECODE_LOOKUP=[Int32Array.from([21522,0]),Int32Array.from([20773,1]),Int32Array.from([24188,2]),Int32Array.from([23371,3]),Int32Array.from([17913,4]),Int32Array.from([16590,5]),Int32Array.from([20375,6]),Int32Array.from([19104,7]),Int32Array.from([30660,8]),Int32Array.from([29427,9]),Int32Array.from([32170,10]),Int32Array.from([30877,11]),Int32Array.from([26159,12]),Int32Array.from([25368,13]),Int32Array.from([27713,14]),Int32Array.from([26998,15]),Int32Array.from([5769,16]),Int32Array.from([5054,17]),Int32Array.from([7399,18]),Int32Array.from([6608,19]),Int32Array.from([1890,20]),Int32Array.from([597,21]),Int32Array.from([3340,22]),Int32Array.from([2107,23]),Int32Array.from([13663,24]),Int32Array.from([12392,25]),Int32Array.from([16177,26]),Int32Array.from([14854,27]),Int32Array.from([9396,28]),Int32Array.from([8579,29]),Int32Array.from([11994,30]),Int32Array.from([11245,31])];class _t{constructor(e,...t){this.ecCodewordsPerBlock=e,this.ecBlocks=t}getECCodewordsPerBlock(){return this.ecCodewordsPerBlock}getNumBlocks(){let e=0;const t=this.ecBlocks;for(const n of t)e+=n.getCount();return e}getTotalECCodewords(){return this.ecCodewordsPerBlock*this.getNumBlocks()}getECBlocks(){return this.ecBlocks}}class Ct{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class Et{constructor(e,t,...n){this.versionNumber=e,this.alignmentPatternCenters=t,this.ecBlocks=n;let r=0;const i=n[0].getECCodewordsPerBlock(),o=n[0].getECBlocks();for(const e of o)r+=e.getCount()*(e.getDataCodewords()+i);this.totalCodewords=r}getVersionNumber(){return this.versionNumber}getAlignmentPatternCenters(){return this.alignmentPatternCenters}getTotalCodewords(){return this.totalCodewords}getDimensionForVersion(){return 17+4*this.versionNumber}getECBlocksForLevel(e){return this.ecBlocks[e.getValue()]}static getProvisionalVersionForDimension(e){if(e%4!=1)throw new _;try{return this.getVersionForNumber((e-17)/4)}catch(e){throw new _}}static getVersionForNumber(e){if(e<1||e>40)throw new d;return Et.VERSIONS[e-1]}static decodeVersionInformation(e){let t=Number.MAX_SAFE_INTEGER,n=0;for(let r=0;r<Et.VERSION_DECODE_INFO.length;r++){const i=Et.VERSION_DECODE_INFO[r];if(i===e)return Et.getVersionForNumber(r+7);const o=It.numBitsDiffering(e,i);o<t&&(n=r+7,t=o)}return t<=3?Et.getVersionForNumber(n):null}buildFunctionPattern(){const e=this.getDimensionForVersion(),t=new N(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 e=0;e<n;e++){const r=this.alignmentPatternCenters[e]-2;for(let i=0;i<n;i++)0===e&&(0===i||i===n-1)||e===n-1&&0===i||t.setRegion(this.alignmentPatternCenters[i]-2,r,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}}Et.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]),Et.VERSIONS=[new Et(1,new Int32Array(0),new _t(7,new Ct(1,19)),new _t(10,new Ct(1,16)),new _t(13,new Ct(1,13)),new _t(17,new Ct(1,9))),new Et(2,Int32Array.from([6,18]),new _t(10,new Ct(1,34)),new _t(16,new Ct(1,28)),new _t(22,new Ct(1,22)),new _t(28,new Ct(1,16))),new Et(3,Int32Array.from([6,22]),new _t(15,new Ct(1,55)),new _t(26,new Ct(1,44)),new _t(18,new Ct(2,17)),new _t(22,new Ct(2,13))),new Et(4,Int32Array.from([6,26]),new _t(20,new Ct(1,80)),new _t(18,new Ct(2,32)),new _t(26,new Ct(2,24)),new _t(16,new Ct(4,9))),new Et(5,Int32Array.from([6,30]),new _t(26,new Ct(1,108)),new _t(24,new Ct(2,43)),new _t(18,new Ct(2,15),new Ct(2,16)),new _t(22,new Ct(2,11),new Ct(2,12))),new Et(6,Int32Array.from([6,34]),new _t(18,new Ct(2,68)),new _t(16,new Ct(4,27)),new _t(24,new Ct(4,19)),new _t(28,new Ct(4,15))),new Et(7,Int32Array.from([6,22,38]),new _t(20,new Ct(2,78)),new _t(18,new Ct(4,31)),new _t(18,new Ct(2,14),new Ct(4,15)),new _t(26,new Ct(4,13),new Ct(1,14))),new Et(8,Int32Array.from([6,24,42]),new _t(24,new Ct(2,97)),new _t(22,new Ct(2,38),new Ct(2,39)),new _t(22,new Ct(4,18),new Ct(2,19)),new _t(26,new Ct(4,14),new Ct(2,15))),new Et(9,Int32Array.from([6,26,46]),new _t(30,new Ct(2,116)),new _t(22,new Ct(3,36),new Ct(2,37)),new _t(20,new Ct(4,16),new Ct(4,17)),new _t(24,new Ct(4,12),new Ct(4,13))),new Et(10,Int32Array.from([6,28,50]),new _t(18,new Ct(2,68),new Ct(2,69)),new _t(26,new Ct(4,43),new Ct(1,44)),new _t(24,new Ct(6,19),new Ct(2,20)),new _t(28,new Ct(6,15),new Ct(2,16))),new Et(11,Int32Array.from([6,30,54]),new _t(20,new Ct(4,81)),new _t(30,new Ct(1,50),new Ct(4,51)),new _t(28,new Ct(4,22),new Ct(4,23)),new _t(24,new Ct(3,12),new Ct(8,13))),new Et(12,Int32Array.from([6,32,58]),new _t(24,new Ct(2,92),new Ct(2,93)),new _t(22,new Ct(6,36),new Ct(2,37)),new _t(26,new Ct(4,20),new Ct(6,21)),new _t(28,new Ct(7,14),new Ct(4,15))),new Et(13,Int32Array.from([6,34,62]),new _t(26,new Ct(4,107)),new _t(22,new Ct(8,37),new Ct(1,38)),new _t(24,new Ct(8,20),new Ct(4,21)),new _t(22,new Ct(12,11),new Ct(4,12))),new Et(14,Int32Array.from([6,26,46,66]),new _t(30,new Ct(3,115),new Ct(1,116)),new _t(24,new Ct(4,40),new Ct(5,41)),new _t(20,new Ct(11,16),new Ct(5,17)),new _t(24,new Ct(11,12),new Ct(5,13))),new Et(15,Int32Array.from([6,26,48,70]),new _t(22,new Ct(5,87),new Ct(1,88)),new _t(24,new Ct(5,41),new Ct(5,42)),new _t(30,new Ct(5,24),new Ct(7,25)),new _t(24,new Ct(11,12),new Ct(7,13))),new Et(16,Int32Array.from([6,26,50,74]),new _t(24,new Ct(5,98),new Ct(1,99)),new _t(28,new Ct(7,45),new Ct(3,46)),new _t(24,new Ct(15,19),new Ct(2,20)),new _t(30,new Ct(3,15),new Ct(13,16))),new Et(17,Int32Array.from([6,30,54,78]),new _t(28,new Ct(1,107),new Ct(5,108)),new _t(28,new Ct(10,46),new Ct(1,47)),new _t(28,new Ct(1,22),new Ct(15,23)),new _t(28,new Ct(2,14),new Ct(17,15))),new Et(18,Int32Array.from([6,30,56,82]),new _t(30,new Ct(5,120),new Ct(1,121)),new _t(26,new Ct(9,43),new Ct(4,44)),new _t(28,new Ct(17,22),new Ct(1,23)),new _t(28,new Ct(2,14),new Ct(19,15))),new Et(19,Int32Array.from([6,30,58,86]),new _t(28,new Ct(3,113),new Ct(4,114)),new _t(26,new Ct(3,44),new Ct(11,45)),new _t(26,new Ct(17,21),new Ct(4,22)),new _t(26,new Ct(9,13),new Ct(16,14))),new Et(20,Int32Array.from([6,34,62,90]),new _t(28,new Ct(3,107),new Ct(5,108)),new _t(26,new Ct(3,41),new Ct(13,42)),new _t(30,new Ct(15,24),new Ct(5,25)),new _t(28,new Ct(15,15),new Ct(10,16))),new Et(21,Int32Array.from([6,28,50,72,94]),new _t(28,new Ct(4,116),new Ct(4,117)),new _t(26,new Ct(17,42)),new _t(28,new Ct(17,22),new Ct(6,23)),new _t(30,new Ct(19,16),new Ct(6,17))),new Et(22,Int32Array.from([6,26,50,74,98]),new _t(28,new Ct(2,111),new Ct(7,112)),new _t(28,new Ct(17,46)),new _t(30,new Ct(7,24),new Ct(16,25)),new _t(24,new Ct(34,13))),new Et(23,Int32Array.from([6,30,54,78,102]),new _t(30,new Ct(4,121),new Ct(5,122)),new _t(28,new Ct(4,47),new Ct(14,48)),new _t(30,new Ct(11,24),new Ct(14,25)),new _t(30,new Ct(16,15),new Ct(14,16))),new Et(24,Int32Array.from([6,28,54,80,106]),new _t(30,new Ct(6,117),new Ct(4,118)),new _t(28,new Ct(6,45),new Ct(14,46)),new _t(30,new Ct(11,24),new Ct(16,25)),new _t(30,new Ct(30,16),new Ct(2,17))),new Et(25,Int32Array.from([6,32,58,84,110]),new _t(26,new Ct(8,106),new Ct(4,107)),new _t(28,new Ct(8,47),new Ct(13,48)),new _t(30,new Ct(7,24),new Ct(22,25)),new _t(30,new Ct(22,15),new Ct(13,16))),new Et(26,Int32Array.from([6,30,58,86,114]),new _t(28,new Ct(10,114),new Ct(2,115)),new _t(28,new Ct(19,46),new Ct(4,47)),new _t(28,new Ct(28,22),new Ct(6,23)),new _t(30,new Ct(33,16),new Ct(4,17))),new Et(27,Int32Array.from([6,34,62,90,118]),new _t(30,new Ct(8,122),new Ct(4,123)),new _t(28,new Ct(22,45),new Ct(3,46)),new _t(30,new Ct(8,23),new Ct(26,24)),new _t(30,new Ct(12,15),new Ct(28,16))),new Et(28,Int32Array.from([6,26,50,74,98,122]),new _t(30,new Ct(3,117),new Ct(10,118)),new _t(28,new Ct(3,45),new Ct(23,46)),new _t(30,new Ct(4,24),new Ct(31,25)),new _t(30,new Ct(11,15),new Ct(31,16))),new Et(29,Int32Array.from([6,30,54,78,102,126]),new _t(30,new Ct(7,116),new Ct(7,117)),new _t(28,new Ct(21,45),new Ct(7,46)),new _t(30,new Ct(1,23),new Ct(37,24)),new _t(30,new Ct(19,15),new Ct(26,16))),new Et(30,Int32Array.from([6,26,52,78,104,130]),new _t(30,new Ct(5,115),new Ct(10,116)),new _t(28,new Ct(19,47),new Ct(10,48)),new _t(30,new Ct(15,24),new Ct(25,25)),new _t(30,new Ct(23,15),new Ct(25,16))),new Et(31,Int32Array.from([6,30,56,82,108,134]),new _t(30,new Ct(13,115),new Ct(3,116)),new _t(28,new Ct(2,46),new Ct(29,47)),new _t(30,new Ct(42,24),new Ct(1,25)),new _t(30,new Ct(23,15),new Ct(28,16))),new Et(32,Int32Array.from([6,34,60,86,112,138]),new _t(30,new Ct(17,115)),new _t(28,new Ct(10,46),new Ct(23,47)),new _t(30,new Ct(10,24),new Ct(35,25)),new _t(30,new Ct(19,15),new Ct(35,16))),new Et(33,Int32Array.from([6,30,58,86,114,142]),new _t(30,new Ct(17,115),new Ct(1,116)),new _t(28,new Ct(14,46),new Ct(21,47)),new _t(30,new Ct(29,24),new Ct(19,25)),new _t(30,new Ct(11,15),new Ct(46,16))),new Et(34,Int32Array.from([6,34,62,90,118,146]),new _t(30,new Ct(13,115),new Ct(6,116)),new _t(28,new Ct(14,46),new Ct(23,47)),new _t(30,new Ct(44,24),new Ct(7,25)),new _t(30,new Ct(59,16),new Ct(1,17))),new Et(35,Int32Array.from([6,30,54,78,102,126,150]),new _t(30,new Ct(12,121),new Ct(7,122)),new _t(28,new Ct(12,47),new Ct(26,48)),new _t(30,new Ct(39,24),new Ct(14,25)),new _t(30,new Ct(22,15),new Ct(41,16))),new Et(36,Int32Array.from([6,24,50,76,102,128,154]),new _t(30,new Ct(6,121),new Ct(14,122)),new _t(28,new Ct(6,47),new Ct(34,48)),new _t(30,new Ct(46,24),new Ct(10,25)),new _t(30,new Ct(2,15),new Ct(64,16))),new Et(37,Int32Array.from([6,28,54,80,106,132,158]),new _t(30,new Ct(17,122),new Ct(4,123)),new _t(28,new Ct(29,46),new Ct(14,47)),new _t(30,new Ct(49,24),new Ct(10,25)),new _t(30,new Ct(24,15),new Ct(46,16))),new Et(38,Int32Array.from([6,32,58,84,110,136,162]),new _t(30,new Ct(4,122),new Ct(18,123)),new _t(28,new Ct(13,46),new Ct(32,47)),new _t(30,new Ct(48,24),new Ct(14,25)),new _t(30,new Ct(42,15),new Ct(32,16))),new Et(39,Int32Array.from([6,26,54,82,110,138,166]),new _t(30,new Ct(20,117),new Ct(4,118)),new _t(28,new Ct(40,47),new Ct(7,48)),new _t(30,new Ct(43,24),new Ct(22,25)),new _t(30,new Ct(10,15),new Ct(67,16))),new Et(40,Int32Array.from([6,30,58,86,114,142,170]),new _t(30,new Ct(19,118),new Ct(6,119)),new _t(28,new Ct(18,47),new Ct(31,48)),new _t(30,new Ct(34,24),new Ct(34,25)),new _t(30,new Ct(20,15),new Ct(61,16)))],function(e){e[e.DATA_MASK_000=0]="DATA_MASK_000",e[e.DATA_MASK_001=1]="DATA_MASK_001",e[e.DATA_MASK_010=2]="DATA_MASK_010",e[e.DATA_MASK_011=3]="DATA_MASK_011",e[e.DATA_MASK_100=4]="DATA_MASK_100",e[e.DATA_MASK_101=5]="DATA_MASK_101",e[e.DATA_MASK_110=6]="DATA_MASK_110",e[e.DATA_MASK_111=7]="DATA_MASK_111"}(j||(j={}));class At{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)}}At.values=new Map([[j.DATA_MASK_000,new At(j.DATA_MASK_000,(e,t)=>!(e+t&1))],[j.DATA_MASK_001,new At(j.DATA_MASK_001,(e,t)=>!(1&e))],[j.DATA_MASK_010,new At(j.DATA_MASK_010,(e,t)=>t%3==0)],[j.DATA_MASK_011,new At(j.DATA_MASK_011,(e,t)=>(e+t)%3==0)],[j.DATA_MASK_100,new At(j.DATA_MASK_100,(e,t)=>!(Math.floor(e/2)+Math.floor(t/3)&1))],[j.DATA_MASK_101,new At(j.DATA_MASK_101,(e,t)=>e*t%6==0)],[j.DATA_MASK_110,new At(j.DATA_MASK_110,(e,t)=>e*t%6<3)],[j.DATA_MASK_111,new At(j.DATA_MASK_111,(e,t)=>!(e+t+e*t%3&1))]]);class bt{constructor(e){const t=e.getHeight();if(t<21||1!=(3&t))throw new _;this.bitMatrix=e}readFormatInformation(){if(null!==this.parsedFormatInfo&&void 0!==this.parsedFormatInfo)return this.parsedFormatInfo;let e=0;for(let t=0;t<6;t++)e=this.copyBit(t,8,e);e=this.copyBit(7,8,e),e=this.copyBit(8,8,e),e=this.copyBit(8,7,e);for(let t=5;t>=0;t--)e=this.copyBit(8,t,e);const t=this.bitMatrix.getHeight();let n=0;const r=t-7;for(let e=t-1;e>=r;e--)n=this.copyBit(8,e,n);for(let e=t-8;e<t;e++)n=this.copyBit(e,8,n);if(this.parsedFormatInfo=It.decodeFormatInformation(e,n),null!==this.parsedFormatInfo)return this.parsedFormatInfo;throw new _}readVersion(){if(null!==this.parsedVersion&&void 0!==this.parsedVersion)return this.parsedVersion;const e=this.bitMatrix.getHeight(),t=Math.floor((e-17)/4);if(t<=6)return Et.getVersionForNumber(t);let n=0;const r=e-11;for(let t=5;t>=0;t--)for(let i=e-9;i>=r;i--)n=this.copyBit(i,t,n);let i=Et.decodeVersionInformation(n);if(null!==i&&i.getDimensionForVersion()===e)return this.parsedVersion=i,i;n=0;for(let t=5;t>=0;t--)for(let i=e-9;i>=r;i--)n=this.copyBit(t,i,n);if(i=Et.decodeVersionInformation(n),null!==i&&i.getDimensionForVersion()===e)return this.parsedVersion=i,i;throw new _}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=At.values.get(e.getDataMask()),r=this.bitMatrix.getHeight();n.unmaskBitMatrix(this.bitMatrix,r);const i=t.buildFunctionPattern();let o=!0;const s=new Uint8Array(t.getTotalCodewords());let a=0,l=0,c=0;for(let e=r-1;e>0;e-=2){6===e&&e--;for(let t=0;t<r;t++){const n=o?r-1-t:t;for(let t=0;t<2;t++)i.get(e-t,n)||(c++,l<<=1,this.bitMatrix.get(e-t,n)&&(l|=1),8===c&&(s[a++]=l,c=0,l=0))}o=!o}if(a!==t.getTotalCodewords())throw new _;return s}remask(){if(null===this.parsedFormatInfo)return;const e=At.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 n=t+1,r=e.getHeight();n<r;n++)e.get(t,n)!==e.get(n,t)&&(e.flip(n,t),e.flip(t,n))}}class St{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t,n){if(e.length!==t.getTotalCodewords())throw new d;const r=t.getECBlocksForLevel(n);let i=0;const o=r.getECBlocks();for(const e of o)i+=e.getCount();const s=new Array(i);let a=0;for(const e of o)for(let t=0;t<e.getCount();t++){const t=e.getDataCodewords(),n=r.getECCodewordsPerBlock()+t;s[a++]=new St(t,new Uint8Array(n))}const l=s[0].codewords.length;let c=s.length-1;for(;c>=0&&s[c].codewords.length!==l;)c--;c++;const u=l-r.getECCodewordsPerBlock();let f=0;for(let t=0;t<u;t++)for(let n=0;n<a;n++)s[n].codewords[t]=e[f++];for(let t=c;t<a;t++)s[t].codewords[u]=e[f++];const h=s[0].codewords.length;for(let t=u;t<h;t++)for(let n=0;n<a;n++){const r=n<c?t:t+1;s[n].codewords[r]=e[f++]}return s}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}!function(e){e[e.TERMINATOR=0]="TERMINATOR",e[e.NUMERIC=1]="NUMERIC",e[e.ALPHANUMERIC=2]="ALPHANUMERIC",e[e.STRUCTURED_APPEND=3]="STRUCTURED_APPEND",e[e.BYTE=4]="BYTE",e[e.ECI=5]="ECI",e[e.KANJI=6]="KANJI",e[e.FNC1_FIRST_POSITION=7]="FNC1_FIRST_POSITION",e[e.FNC1_SECOND_POSITION=8]="FNC1_SECOND_POSITION",e[e.HANZI=9]="HANZI"}(q||(q={}));class Nt{constructor(e,t,n,r){this.value=e,this.stringValue=t,this.characterCountBitsForVersions=n,this.bits=r,Nt.FOR_BITS.set(r,this),Nt.FOR_VALUE.set(e,this)}static forBits(e){const t=Nt.FOR_BITS.get(e);if(void 0===t)throw new d;return t}getCharacterCountBits(e){const t=e.getVersionNumber();let n;return n=t<=9?0:t<=26?1:2,this.characterCountBitsForVersions[n]}getValue(){return this.value}getBits(){return this.bits}equals(e){if(!(e instanceof Nt))return!1;const t=e;return this.value===t.value}toString(){return this.stringValue}}Nt.FOR_BITS=new Map,Nt.FOR_VALUE=new Map,Nt.TERMINATOR=new Nt(q.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),Nt.NUMERIC=new Nt(q.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),Nt.ALPHANUMERIC=new Nt(q.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),Nt.STRUCTURED_APPEND=new Nt(q.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),Nt.BYTE=new Nt(q.BYTE,"BYTE",Int32Array.from([8,16,16]),4),Nt.ECI=new Nt(q.ECI,"ECI",Int32Array.from([0,0,0]),7),Nt.KANJI=new Nt(q.KANJI,"KANJI",Int32Array.from([8,10,12]),8),Nt.FNC1_FIRST_POSITION=new Nt(q.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),Nt.FNC1_SECOND_POSITION=new Nt(q.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),Nt.HANZI=new Nt(q.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class Tt{static decode(e,t,n,r){const i=new mt(e);let o=new S;const s=new Array;let a=-1,l=-1;try{let e,n=null,c=!1;do{if(i.available()<4)e=Nt.TERMINATOR;else{const t=i.readBits(4);e=Nt.forBits(t)}switch(e){case Nt.TERMINATOR:break;case Nt.FNC1_FIRST_POSITION:case Nt.FNC1_SECOND_POSITION:c=!0;break;case Nt.STRUCTURED_APPEND:if(i.available()<16)throw new _;a=i.readBits(8),l=i.readBits(8);break;case Nt.ECI:const d=Tt.parseECIValue(i);if(n=C.getCharacterSetECIByValue(d),null===n)throw new _;break;case Nt.HANZI:const u=i.readBits(4),f=i.readBits(e.getCharacterCountBits(t));u===Tt.GB2312_SUBSET&&Tt.decodeHanziSegment(i,o,f);break;default:const h=i.readBits(e.getCharacterCountBits(t));switch(e){case Nt.NUMERIC:Tt.decodeNumericSegment(i,o,h);break;case Nt.ALPHANUMERIC:Tt.decodeAlphanumericSegment(i,o,h,c);break;case Nt.BYTE:Tt.decodeByteSegment(i,o,h,n,s,r);break;case Nt.KANJI:Tt.decodeKanjiSegment(i,o,h);break;default:throw new _}}}while(e!==Nt.TERMINATOR)}catch(e){throw new _}return new Y(e,o.toString(),0===s.length?null:s,null===n?null:n.toString(),a,l)}static decodeHanziSegment(e,t,n){if(13*n>e.available())throw new _;const r=new Uint8Array(2*n);let i=0;for(;n>0;){const t=e.readBits(13);let o=t/96<<8&4294967295|t%96;o+=o<959?41377:42657,r[i]=o>>8&255,r[i+1]=255&o,i+=2,n--}try{t.append(A.decode(r,b.GB2312))}catch(e){throw new _(e)}}static decodeKanjiSegment(e,t,n){if(13*n>e.available())throw new _;const r=new Uint8Array(2*n);let i=0;for(;n>0;){const t=e.readBits(13);let o=t/192<<8&4294967295|t%192;o+=o<7936?33088:49472,r[i]=o>>8,r[i+1]=o,i+=2,n--}try{t.append(A.decode(r,b.SHIFT_JIS))}catch(e){throw new _(e)}}static decodeByteSegment(e,t,n,r,i,o){if(8*n>e.available())throw new _;const s=new Uint8Array(n);for(let t=0;t<n;t++)s[t]=e.readBits(8);let a;a=null===r?b.guessEncoding(s,o):r.getName();try{t.append(A.decode(s,a))}catch(e){throw new _(e)}i.push(s)}static toAlphaNumericChar(e){if(e>=Tt.ALPHANUMERIC_CHARS.length)throw new _;return Tt.ALPHANUMERIC_CHARS[e]}static decodeAlphanumericSegment(e,t,n,r){const i=t.length();for(;n>1;){if(e.available()<11)throw new _;const r=e.readBits(11);t.append(Tt.toAlphaNumericChar(Math.floor(r/45))),t.append(Tt.toAlphaNumericChar(r%45)),n-=2}if(1===n){if(e.available()<6)throw new _;t.append(Tt.toAlphaNumericChar(e.readBits(6)))}if(r)for(let e=i;e<t.length();e++)"%"===t.charAt(e)&&(e<t.length()-1&&"%"===t.charAt(e+1)?t.deleteCharAt(e+1):t.setCharAt(e,String.fromCharCode(29)))}static decodeNumericSegment(e,t,n){for(;n>=3;){if(e.available()<10)throw new _;const r=e.readBits(10);if(r>=1e3)throw new _;t.append(Tt.toAlphaNumericChar(Math.floor(r/100))),t.append(Tt.toAlphaNumericChar(Math.floor(r/10)%10)),t.append(Tt.toAlphaNumericChar(r%10)),n-=3}if(2===n){if(e.available()<7)throw new _;const n=e.readBits(7);if(n>=100)throw new _;t.append(Tt.toAlphaNumericChar(Math.floor(n/10))),t.append(Tt.toAlphaNumericChar(n%10))}else if(1===n){if(e.available()<4)throw new _;const n=e.readBits(4);if(n>=10)throw new _;t.append(Tt.toAlphaNumericChar(n))}}static parseECIValue(e){const t=e.readBits(8);if(!(128&t))return 127&t;if(128==(192&t))return(63&t)<<8&4294967295|e.readBits(8);if(192==(224&t))return(31&t)<<16&4294967295|e.readBits(16);throw new _}}Tt.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Tt.GB2312_SUBSET=1;class Rt{constructor(e){this.mirrored=e}isMirrored(){return this.mirrored}applyMirroredCorrection(e){if(!this.mirrored||null===e||e.length<3)return;const t=e[0];e[0]=e[2],e[2]=t}}class Dt{constructor(){this.rsDecoder=new ne(J.QR_CODE_FIELD_256)}decodeBooleanArray(e,t){return this.decodeBitMatrix(N.parseFromBooleanArray(e),t)}decodeBitMatrix(e,t){const n=new bt(e);let r=null;try{return this.decodeBitMatrixParser(n,t)}catch(e){r=e}try{n.remask(),n.setMirror(!0),n.readVersion(),n.readFormatInformation(),n.mirror();const e=this.decodeBitMatrixParser(n,t);return e.setOther(new Rt(!0)),e}catch(e){if(null!==r)throw r;throw e}}decodeBitMatrixParser(e,t){const n=e.readVersion(),r=e.readFormatInformation().getErrorCorrectionLevel(),i=e.readCodewords(),o=St.getDataBlocks(i,n,r);let s=0;for(const e of o)s+=e.getNumDataCodewords();const a=new Uint8Array(s);let l=0;for(const e of o){const t=e.getCodewords(),n=e.getNumDataCodewords();this.correctErrors(t,n);for(let e=0;e<n;e++)a[l++]=t[e]}return Tt.decode(a,n,r,t)}correctErrors(e,t){const n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch(e){throw new f}for(let r=0;r<t;r++)e[r]=n[r]}}class xt extends se{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 t=Math.abs(e-this.estimatedModuleSize);return t<=1||t<=this.estimatedModuleSize}return!1}combineEstimate(e,t,n){const r=(this.getX()+t)/2,i=(this.getY()+e)/2,o=(this.estimatedModuleSize+n)/2;return new xt(r,i,o)}}class kt{constructor(e,t,n,r,i,o,s){this.image=e,this.startX=t,this.startY=n,this.width=r,this.height=i,this.moduleSize=o,this.resultPointCallback=s,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}find(){const e=this.startX,t=this.height,n=e+this.width,r=this.startY+t/2,i=new Int32Array(3),o=this.image;for(let s=0;s<t;s++){const t=r+(1&s?-Math.floor((s+1)/2):Math.floor((s+1)/2));i[0]=0,i[1]=0,i[2]=0;let a=e;for(;a<n&&!o.get(a,t);)a++;let l=0;for(;a<n;){if(o.get(a,t))if(1===l)i[1]++;else if(2===l){if(this.foundPatternCross(i)){const e=this.handlePossibleCenter(i,t,a);if(null!==e)return e}i[0]=i[2],i[1]=1,i[2]=0,l=1}else i[++l]++;else 1===l&&l++,i[l]++;a++}if(this.foundPatternCross(i)){const e=this.handlePossibleCenter(i,t,n);if(null!==e)return e}}if(0!==this.possibleCenters.length)return this.possibleCenters[0];throw new T}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 i=this.image,o=i.getHeight(),s=this.crossCheckStateCount;s[0]=0,s[1]=0,s[2]=0;let a=e;for(;a>=0&&i.get(t,a)&&s[1]<=n;)s[1]++,a--;if(a<0||s[1]>n)return NaN;for(;a>=0&&!i.get(t,a)&&s[0]<=n;)s[0]++,a--;if(s[0]>n)return NaN;for(a=e+1;a<o&&i.get(t,a)&&s[1]<=n;)s[1]++,a++;if(a===o||s[1]>n)return NaN;for(;a<o&&!i.get(t,a)&&s[2]<=n;)s[2]++,a++;if(s[2]>n)return NaN;const l=s[0]+s[1]+s[2];return 5*Math.abs(l-r)>=2*r?NaN:this.foundPatternCross(s)?kt.centerFromEnd(s,a):NaN}handlePossibleCenter(e,t,n){const r=e[0]+e[1]+e[2],i=kt.centerFromEnd(e,n),o=this.crossCheckVertical(t,i,2*e[1],r);if(!isNaN(o)){const t=(e[0]+e[1]+e[2])/3;for(const e of this.possibleCenters)if(e.aboutEquals(t,o,i))return e.combineEstimate(o,i,t);const n=new xt(i,o,t);this.possibleCenters.push(n),null!==this.resultPointCallback&&void 0!==this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(n)}return null}}class Ot extends se{constructor(e,t,n,r){super(e,t),this.estimatedModuleSize=n,this.count=r,void 0===r&&(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 t=Math.abs(e-this.estimatedModuleSize);return t<=1||t<=this.estimatedModuleSize}return!1}combineEstimate(e,t,n){const r=this.count+1,i=(this.count*this.getX()+t)/r,o=(this.count*this.getY()+e)/r,s=(this.count*this.estimatedModuleSize+n)/r;return new Ot(i,o,s,r)}}class Mt{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 Pt{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=null!=e&&void 0!==e.get(I.TRY_HARDER),n=null!=e&&void 0!==e.get(I.PURE_BARCODE),r=this.image,i=r.getHeight(),o=r.getWidth();let s=Math.floor(3*i/(4*Pt.MAX_MODULES));(s<Pt.MIN_SKIP||t)&&(s=Pt.MIN_SKIP);let a=!1;const l=new Int32Array(5);for(let e=s-1;e<i&&!a;e+=s){l[0]=0,l[1]=0,l[2]=0,l[3]=0,l[4]=0;let t=0;for(let i=0;i<o;i++)if(r.get(i,e))1&~t||t++,l[t]++;else if(1&t)l[t]++;else if(4===t)if(Pt.foundPatternCross(l)){if(!0!==this.handlePossibleCenter(l,e,i,n)){l[0]=l[2],l[1]=l[3],l[2]=l[4],l[3]=1,l[4]=0,t=3;continue}if(s=2,!0===this.hasSkipped)a=this.haveMultiplyConfirmedCenters();else{const t=this.findRowSkip();t>l[2]&&(e+=t-l[2]-s,i=o-1)}t=0,l[0]=0,l[1]=0,l[2]=0,l[3]=0,l[4]=0}else l[0]=l[2],l[1]=l[3],l[2]=l[4],l[3]=1,l[4]=0,t=3;else l[++t]++;Pt.foundPatternCross(l)&&!0===this.handlePossibleCenter(l,e,o,n)&&(s=l[0],this.hasSkipped&&(a=this.haveMultiplyConfirmedCenters()))}const c=this.selectBestPatterns();return se.orderBestPatterns(c),new Mt(c)}static centerFromEnd(e,t){return t-e[4]-e[3]-e[2]/2}static foundPatternCross(e){let t=0;for(let n=0;n<5;n++){const r=e[n];if(0===r)return!1;t+=r}if(t<7)return!1;const n=t/7,r=n/2;return Math.abs(n-e[0])<r&&Math.abs(n-e[1])<r&&Math.abs(3*n-e[2])<3*r&&Math.abs(n-e[3])<r&&Math.abs(n-e[4])<r}getCrossCheckStateCount(){const e=this.crossCheckStateCount;return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e}crossCheckDiagonal(e,t,n,r){const i=this.getCrossCheckStateCount();let o=0;const s=this.image;for(;e>=o&&t>=o&&s.get(t-o,e-o);)i[2]++,o++;if(e<o||t<o)return!1;for(;e>=o&&t>=o&&!s.get(t-o,e-o)&&i[1]<=n;)i[1]++,o++;if(e<o||t<o||i[1]>n)return!1;for(;e>=o&&t>=o&&s.get(t-o,e-o)&&i[0]<=n;)i[0]++,o++;if(i[0]>n)return!1;const a=s.getHeight(),l=s.getWidth();for(o=1;e+o<a&&t+o<l&&s.get(t+o,e+o);)i[2]++,o++;if(e+o>=a||t+o>=l)return!1;for(;e+o<a&&t+o<l&&!s.get(t+o,e+o)&&i[3]<n;)i[3]++,o++;if(e+o>=a||t+o>=l||i[3]>=n)return!1;for(;e+o<a&&t+o<l&&s.get(t+o,e+o)&&i[4]<n;)i[4]++,o++;if(i[4]>=n)return!1;const c=i[0]+i[1]+i[2]+i[3]+i[4];return Math.abs(c-r)<2*r&&Pt.foundPatternCross(i)}crossCheckVertical(e,t,n,r){const i=this.image,o=i.getHeight(),s=this.getCrossCheckStateCount();let a=e;for(;a>=0&&i.get(t,a);)s[2]++,a--;if(a<0)return NaN;for(;a>=0&&!i.get(t,a)&&s[1]<=n;)s[1]++,a--;if(a<0||s[1]>n)return NaN;for(;a>=0&&i.get(t,a)&&s[0]<=n;)s[0]++,a--;if(s[0]>n)return NaN;for(a=e+1;a<o&&i.get(t,a);)s[2]++,a++;if(a===o)return NaN;for(;a<o&&!i.get(t,a)&&s[3]<n;)s[3]++,a++;if(a===o||s[3]>=n)return NaN;for(;a<o&&i.get(t,a)&&s[4]<n;)s[4]++,a++;if(s[4]>=n)return NaN;const l=s[0]+s[1]+s[2]+s[3]+s[4];return 5*Math.abs(l-r)>=2*r?NaN:Pt.foundPatternCross(s)?Pt.centerFromEnd(s,a):NaN}crossCheckHorizontal(e,t,n,r){const i=this.image,o=i.getWidth(),s=this.getCrossCheckStateCount();let a=e;for(;a>=0&&i.get(a,t);)s[2]++,a--;if(a<0)return NaN;for(;a>=0&&!i.get(a,t)&&s[1]<=n;)s[1]++,a--;if(a<0||s[1]>n)return NaN;for(;a>=0&&i.get(a,t)&&s[0]<=n;)s[0]++,a--;if(s[0]>n)return NaN;for(a=e+1;a<o&&i.get(a,t);)s[2]++,a++;if(a===o)return NaN;for(;a<o&&!i.get(a,t)&&s[3]<n;)s[3]++,a++;if(a===o||s[3]>=n)return NaN;for(;a<o&&i.get(a,t)&&s[4]<n;)s[4]++,a++;if(s[4]>=n)return NaN;const l=s[0]+s[1]+s[2]+s[3]+s[4];return 5*Math.abs(l-r)>=r?NaN:Pt.foundPatternCross(s)?Pt.centerFromEnd(s,a):NaN}handlePossibleCenter(e,t,n,r){const i=e[0]+e[1]+e[2]+e[3]+e[4];let o=Pt.centerFromEnd(e,n),s=this.crossCheckVertical(t,Math.floor(o),e[2],i);if(!isNaN(s)&&(o=this.crossCheckHorizontal(Math.floor(o),Math.floor(s),e[2],i),!isNaN(o)&&(!r||this.crossCheckDiagonal(Math.floor(s),Math.floor(o),e[2],i)))){const e=i/7;let t=!1;const n=this.possibleCenters;for(let r=0,i=n.length;r<i;r++){const i=n[r];if(i.aboutEquals(e,s,o)){n[r]=i.combineEstimate(s,o,e),t=!0;break}}if(!t){const t=new Ot(o,s,e);n.push(t),null!==this.resultPointCallback&&void 0!==this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(t)}return!0}return!1}findRowSkip(){if(this.possibleCenters.length<=1)return 0;let e=null;for(const t of this.possibleCenters)if(t.getCount()>=Pt.CENTER_QUORUM){if(null!=e)return this.hasSkipped=!0,Math.floor((Math.abs(e.getX()-t.getX())-Math.abs(e.getY()-t.getY()))/2);e=t}return 0}haveMultiplyConfirmedCenters(){let e=0,t=0;const n=this.possibleCenters.length;for(const n of this.possibleCenters)n.getCount()>=Pt.CENTER_QUORUM&&(e++,t+=n.getEstimatedModuleSize());if(e<3)return!1;const r=t/n;let i=0;for(const e of this.possibleCenters)i+=Math.abs(e.getEstimatedModuleSize()-r);return i<=.05*t}selectBestPatterns(){const e=this.possibleCenters.length;if(e<3)throw new T;const t=this.possibleCenters;let n;if(e>3){let r=0,i=0;for(const e of this.possibleCenters){const t=e.getEstimatedModuleSize();r+=t,i+=t*t}n=r/e;let o=Math.sqrt(i/e-n*n);t.sort((e,t)=>{const r=Math.abs(t.getEstimatedModuleSize()-n),i=Math.abs(e.getEstimatedModuleSize()-n);return r<i?-1:r>i?1:0});const s=Math.max(.2*n,o);for(let e=0;e<t.length&&t.length>3;e++){const r=t[e];Math.abs(r.getEstimatedModuleSize()-n)>s&&(t.splice(e,1),e--)}}if(t.length>3){let e=0;for(const n of t)e+=n.getEstimatedModuleSize();n=e/t.length,t.sort((e,t)=>{if(t.getCount()===e.getCount()){const r=Math.abs(t.getEstimatedModuleSize()-n),i=Math.abs(e.getEstimatedModuleSize()-n);return r<i?1:r>i?-1:0}return t.getCount()-e.getCount()}),t.splice(3)}return[t[0],t[1],t[2]]}}Pt.CENTER_QUORUM=2,Pt.MIN_SKIP=3,Pt.MAX_MODULES=57;class Bt{constructor(e){this.image=e}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(e){this.resultPointCallback=null==e?null:e.get(I.NEED_RESULT_POINT_CALLBACK);const t=new Pt(this.image,this.resultPointCallback).find(e);return this.processFinderPatternInfo(t)}processFinderPatternInfo(e){const t=e.getTopLeft(),n=e.getTopRight(),r=e.getBottomLeft(),i=this.calculateModuleSize(t,n,r);if(i<1)throw new T("No pattern found in proccess finder.");const o=Bt.computeDimension(t,n,r,i),s=Et.getProvisionalVersionForDimension(o),a=s.getDimensionForVersion()-7;let l=null;if(s.getAlignmentPatternCenters().length>0){const e=n.getX()-t.getX()+r.getX(),o=n.getY()-t.getY()+r.getY(),s=1-3/a,c=Math.floor(t.getX()+s*(e-t.getX())),d=Math.floor(t.getY()+s*(o-t.getY()));for(let e=4;e<=16;e<<=1)try{l=this.findAlignmentInRegion(i,c,d,e);break}catch(e){if(!(e instanceof T))throw e}}const c=Bt.createTransform(t,n,r,l,o),d=Bt.sampleGrid(this.image,c,o);let u;return u=null===l?[r,t,n]:[r,t,n,l],new ae(d,u)}static createTransform(e,t,n,r,i){const o=i-3.5;let s,a,l,c;return null!==r?(s=r.getX(),a=r.getY(),l=o-3,c=l):(s=t.getX()-e.getX()+n.getX(),a=t.getY()-e.getY()+n.getY(),l=o,c=o),ue.quadrilateralToQuadrilateral(3.5,3.5,o,3.5,l,c,3.5,o,e.getX(),e.getY(),t.getX(),t.getY(),s,a,n.getX(),n.getY())}static sampleGrid(e,t,n){return he.getInstance().sampleGridWithTransform(e,n,n,t)}static computeDimension(e,t,n,r){const i=ie.round(se.distance(e,t)/r),o=ie.round(se.distance(e,n)/r);let s=Math.floor((i+o)/2)+7;switch(3&s){case 0:s++;break;case 2:s--;break;case 3:throw new T("Dimensions could be not found.")}return s}calculateModuleSize(e,t,n){return(this.calculateModuleSizeOneWay(e,t)+this.calculateModuleSizeOneWay(e,n))/2}calculateModuleSizeOneWay(e,t){const n=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(e.getX()),Math.floor(e.getY()),Math.floor(t.getX()),Math.floor(t.getY())),r=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.getX()),Math.floor(t.getY()),Math.floor(e.getX()),Math.floor(e.getY()));return isNaN(n)?r/7:isNaN(r)?n/7:(n+r)/14}sizeOfBlackWhiteBlackRunBothWays(e,t,n,r){let i=this.sizeOfBlackWhiteBlackRun(e,t,n,r),o=1,s=e-(n-e);s<0?(o=e/(e-s),s=0):s>=this.image.getWidth()&&(o=(this.image.getWidth()-1-e)/(s-e),s=this.image.getWidth()-1);let a=Math.floor(t-(r-t)*o);return o=1,a<0?(o=t/(t-a),a=0):a>=this.image.getHeight()&&(o=(this.image.getHeight()-1-t)/(a-t),a=this.image.getHeight()-1),s=Math.floor(e+(s-e)*o),i+=this.sizeOfBlackWhiteBlackRun(e,t,s,a),i-1}sizeOfBlackWhiteBlackRun(e,t,n,r){const i=Math.abs(r-t)>Math.abs(n-e);if(i){let i=e;e=t,t=i,i=n,n=r,r=i}const o=Math.abs(n-e),s=Math.abs(r-t);let a=-o/2;const l=e<n?1:-1,c=t<r?1:-1;let d=0;const u=n+l;for(let n=e,f=t;n!==u;n+=l){const l=i?f:n,u=i?n:f;if(1===d===this.image.get(l,u)){if(2===d)return ie.distance(n,f,e,t);d++}if(a+=s,a>0){if(f===r)break;f+=c,a-=o}}return 2===d?ie.distance(n+l,r,e,t):NaN}findAlignmentInRegion(e,t,n,r){const i=Math.floor(r*e),o=Math.max(0,t-i),s=Math.min(this.image.getWidth()-1,t+i);if(s-o<3*e)throw new T("Alignment top exceeds estimated module size.");const a=Math.max(0,n-i),l=Math.min(this.image.getHeight()-1,n+i);if(l-a<3*e)throw new T("Alignment bottom exceeds estimated module size.");return new kt(this.image,o,a,s-o,l-a,e,this.resultPointCallback).find()}}class Lt{constructor(){this.decoder=new Dt}getDecoder(){return this.decoder}decode(e,t){let n,r;if(null!=t&&void 0!==t.get(I.PURE_BARCODE)){const i=Lt.extractPureBits(e.getBlackMatrix());n=this.decoder.decodeBitMatrix(i,t),r=Lt.NO_POINTS}else{const i=new Bt(e.getBlackMatrix()).detect(t);n=this.decoder.decodeBitMatrix(i.getBits(),t),r=i.getPoints()}n.getOther()instanceof Rt&&n.getOther().applyMirroredCorrection(r);const i=new F(n.getText(),n.getRawBytes(),void 0,r,U.QR_CODE,void 0),o=n.getByteSegments();null!==o&&i.putMetadata(X.BYTE_SEGMENTS,o);const s=n.getECLevel();return null!==s&&i.putMetadata(X.ERROR_CORRECTION_LEVEL,s),n.hasStructuredAppend()&&(i.putMetadata(X.STRUCTURED_APPEND_SEQUENCE,n.getStructuredAppendSequenceNumber()),i.putMetadata(X.STRUCTURED_APPEND_PARITY,n.getStructuredAppendParity())),i}reset(){}static extractPureBits(e){const t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(null===t||null===n)throw new T;const r=this.moduleSize(t,e);let i=t[1],o=n[1],s=t[0],a=n[0];if(s>=a||i>=o)throw new T;if(o-i!==a-s&&(a=s+(o-i),a>=e.getWidth()))throw new T;const l=Math.round((a-s+1)/r),c=Math.round((o-i+1)/r);if(l<=0||c<=0)throw new T;if(c!==l)throw new T;const d=Math.floor(r/2);i+=d,s+=d;const u=s+Math.floor((l-1)*r)-a;if(u>0){if(u>d)throw new T;s-=u}const f=i+Math.floor((c-1)*r)-o;if(f>0){if(f>d)throw new T;i-=f}const h=new N(l,c);for(let t=0;t<c;t++){const n=i+Math.floor(t*r);for(let i=0;i<l;i++)e.get(s+Math.floor(i*r),n)&&h.set(i,t)}return h}static moduleSize(e,t){const n=t.getHeight(),r=t.getWidth();let i=e[0],o=e[1],s=!0,a=0;for(;i<r&&o<n;){if(s!==t.get(i,o)){if(5===++a)break;s=!s}i++,o++}if(i===r||o===n)throw new T;return(i-e[0])/7}}Lt.NO_POINTS=new Array;class Ft{PDF417Common(){}static getBitCountSum(e){return ie.sum(e)}static toIntArray(e){if(null==e||!e.length)return Ft.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=w.binarySearch(Ft.SYMBOL_TABLE,262143&e);return t<0?-1:(Ft.CODEWORD_TABLE[t]-1)%Ft.NUMBER_OF_CODEWORDS}}Ft.NUMBER_OF_CODEWORDS=929,Ft.MAX_CODEWORDS_IN_BARCODE=Ft.NUMBER_OF_CODEWORDS-1,Ft.MIN_ROWS_IN_BARCODE=3,Ft.MAX_ROWS_IN_BARCODE=90,Ft.MODULES_IN_CODEWORD=17,Ft.MODULES_IN_STOP_PATTERN=18,Ft.BARS_IN_MODULE=8,Ft.EMPTY_INT_ARRAY=new Int32Array([]),Ft.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]),Ft.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 Vt{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class Ut{static detectMultiple(e,t,n){let r=e.getBlackMatrix(),i=Ut.detect(n,r);return i.length||(r=r.clone(),r.rotate180(),i=Ut.detect(n,r)),new Vt(r,i)}static detect(e,t){const n=new Array;let r=0,i=0,o=!1;for(;r<t.getHeight();){const s=Ut.findVertices(t,r,i);if(null!=s[0]||null!=s[3]){if(o=!0,n.push(s),!e)break;null!=s[2]?(i=Math.trunc(s[2].getX()),r=Math.trunc(s[2].getY())):(i=Math.trunc(s[4].getX()),r=Math.trunc(s[4].getY()))}else{if(!o)break;o=!1,i=0;for(const e of n)null!=e[1]&&(r=Math.trunc(Math.max(r,e[1].getY()))),null!=e[3]&&(r=Math.max(r,Math.trunc(e[3].getY())));r+=Ut.ROW_STEP}}return n}static findVertices(e,t,n){const r=e.getHeight(),i=e.getWidth(),o=new Array(8);return Ut.copyToResult(o,Ut.findRowsWithPattern(e,r,i,t,n,Ut.START_PATTERN),Ut.INDEXES_START_PATTERN),null!=o[4]&&(n=Math.trunc(o[4].getX()),t=Math.trunc(o[4].getY())),Ut.copyToResult(o,Ut.findRowsWithPattern(e,r,i,t,n,Ut.STOP_PATTERN),Ut.INDEXES_STOP_PATTERN),o}static copyToResult(e,t,n){for(let r=0;r<n.length;r++)e[n[r]]=t[r]}static findRowsWithPattern(e,t,n,r,i,o){const s=new Array(4);let a=!1;const l=new Int32Array(o.length);for(;r<t;r+=Ut.ROW_STEP){let t=Ut.findGuardPattern(e,i,r,n,!1,o,l);if(null!=t){for(;r>0;){const s=Ut.findGuardPattern(e,i,--r,n,!1,o,l);if(null==s){r++;break}t=s}s[0]=new se(t[0],r),s[1]=new se(t[1],r),a=!0;break}}let c=r+1;if(a){let r=0,i=Int32Array.from([Math.trunc(s[0].getX()),Math.trunc(s[1].getX())]);for(;c<t;c++){const t=Ut.findGuardPattern(e,i[0],c,n,!1,o,l);if(null!=t&&Math.abs(i[0]-t[0])<Ut.MAX_PATTERN_DRIFT&&Math.abs(i[1]-t[1])<Ut.MAX_PATTERN_DRIFT)i=t,r=0;else{if(r>Ut.SKIPPED_ROW_COUNT_MAX)break;r++}}c-=r+1,s[2]=new se(i[0],c),s[3]=new se(i[1],c)}return c-r<Ut.BARCODE_MIN_HEIGHT&&w.fill(s,null),s}static findGuardPattern(e,t,n,r,i,o,s){w.fillWithin(s,0,s.length,0);let a=t,l=0;for(;e.get(a,n)&&a>0&&l++<Ut.MAX_PIXEL_DRIFT;)a--;let c=a,d=0,u=o.length;for(let t=i;c<r;c++)if(e.get(c,n)!==t)s[d]++;else{if(d===u-1){if(Ut.patternMatchVariance(s,o,Ut.MAX_INDIVIDUAL_VARIANCE)<Ut.MAX_AVG_VARIANCE)return new Int32Array([a,c]);a+=s[0]+s[1],m.arraycopy(s,2,s,0,d-1),s[d-1]=0,s[d]=0,d--}else d++;s[d]=1,t=!t}return d===u-1&&Ut.patternMatchVariance(s,o,Ut.MAX_INDIVIDUAL_VARIANCE)<Ut.MAX_AVG_VARIANCE?new Int32Array([a,c-1]):null}static patternMatchVariance(e,t,n){let r=e.length,i=0,o=0;for(let n=0;n<r;n++)i+=e[n],o+=t[n];if(i<o)return 1/0;let s=i/o;n*=s;let a=0;for(let i=0;i<r;i++){let r=e[i],o=t[i]*s,l=r>o?r-o:o-r;if(l>n)return 1/0;a+=l}return a/i}}Ut.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),Ut.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),Ut.MAX_AVG_VARIANCE=.42,Ut.MAX_INDIVIDUAL_VARIANCE=.8,Ut.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),Ut.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),Ut.MAX_PIXEL_DRIFT=3,Ut.MAX_PATTERN_DRIFT=5,Ut.SKIPPED_ROW_COUNT_MAX=25,Ut.ROW_STEP=5,Ut.BARCODE_MIN_HEIGHT=10;class Wt{constructor(e,t){if(0===t.length)throw new d;this.field=e;let n=t.length;if(n>1&&0===t[0]){let e=1;for(;e<n&&0===t[e];)e++;e===n?this.coefficients=new Int32Array([0]):(this.coefficients=new Int32Array(n-e),m.arraycopy(t,e,this.coefficients,0,this.coefficients.length))}else this.coefficients=t}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return 0===this.coefficients[0]}getCoefficient(e){return this.coefficients[this.coefficients.length-1-e]}evaluateAt(e){if(0===e)return this.getCoefficient(0);if(1===e){let e=0;for(let t of this.coefficients)e=this.field.add(e,t);return e}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 d("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 e=t;t=n,n=e}let r=new Int32Array(n.length),i=n.length-t.length;m.arraycopy(n,0,r,0,i);for(let e=i;e<n.length;e++)r[e]=this.field.add(t[e-i],n[e]);return new Wt(this.field,r)}subtract(e){if(!this.field.equals(e.field))throw new d("ModulusPolys do not have same ModulusGF field");return e.isZero()?this:this.add(e.negative())}multiply(e){return e instanceof Wt?this.multiplyOther(e):this.multiplyScalar(e)}multiplyOther(e){if(!this.field.equals(e.field))throw new d("ModulusPolys do not have same ModulusGF field");if(this.isZero()||e.isZero())return new Wt(this.field,new Int32Array([0]));let t=this.coefficients,n=t.length,r=e.coefficients,i=r.length,o=new Int32Array(n+i-1);for(let e=0;e<n;e++){let n=t[e];for(let t=0;t<i;t++)o[e+t]=this.field.add(o[e+t],this.field.multiply(n,r[t]))}return new Wt(this.field,o)}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 Wt(this.field,t)}multiplyScalar(e){if(0===e)return new Wt(this.field,new Int32Array([0]));if(1===e)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 Wt(this.field,n)}multiplyByMonomial(e,t){if(e<0)throw new d;if(0===t)return new Wt(this.field,new Int32Array([0]));let n=this.coefficients.length,r=new Int32Array(n+e);for(let e=0;e<n;e++)r[e]=this.field.multiply(this.coefficients[e],t);return new Wt(this.field,r)}toString(){let e=new S;for(let t=this.getDegree();t>=0;t--){let n=this.getCoefficient(t);0!==n&&(n<0?(e.append(" - "),n=-n):e.length()>0&&e.append(" + "),0!==t&&1===n||e.append(n),0!==t&&(1===t?e.append("x"):(e.append("x^"),e.append(t))))}return e.toString()}}class zt{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(0===e)throw new d;return this.logTable[e]}inverse(e){if(0===e)throw new Q;return this.expTable[this.modulus-this.logTable[e]-1]}multiply(e,t){return 0===e||0===t?0:this.expTable[(this.logTable[e]+this.logTable[t])%(this.modulus-1)]}getSize(){return this.modulus}equals(e){return e===this}}class Ht extends zt{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 t=0;t<e-1;t++)this.logTable[this.expTable[t]]=t;this.zero=new Wt(this,new Int32Array([0])),this.one=new Wt(this,new Int32Array([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new d;if(0===t)return this.zero;let n=new Int32Array(e+1);return n[0]=t,new Wt(this,n)}}Ht.PDF417_GF=new Ht(Ft.NUMBER_OF_CODEWORDS,3);class jt{constructor(){this.field=Ht.PDF417_GF}decode(e,t,n){let r=new Wt(this.field,e),i=new Int32Array(t),o=!1;for(let e=t;e>0;e--){let n=r.evaluateAt(this.field.exp(e));i[t-e]=n,0!==n&&(o=!0)}if(!o)return 0;let s=this.field.getOne();if(null!=n)for(const t of n){let n=this.field.exp(e.length-1-t),r=new Wt(this.field,new Int32Array([this.field.subtract(0,n),1]));s=s.multiply(r)}let a=new Wt(this.field,i),l=this.runEuclideanAlgorithm(this.field.buildMonomial(t,1),a,t),c=l[0],d=l[1],u=this.findErrorLocations(c),h=this.findErrorMagnitudes(d,c,u);for(let t=0;t<u.length;t++){let n=e.length-1-this.field.log(u[t]);if(n<0)throw f.getChecksumInstance();e[n]=this.field.subtract(e[n],h[t])}return u.length}runEuclideanAlgorithm(e,t,n){if(e.getDegree()<t.getDegree()){let n=e;e=t,t=n}let r=e,i=t,o=this.field.getZero(),s=this.field.getOne();for(;i.getDegree()>=Math.round(n/2);){let e=r,t=o;if(r=i,o=s,r.isZero())throw f.getChecksumInstance();i=e;let n=this.field.getZero(),a=r.getCoefficient(r.getDegree()),l=this.field.inverse(a);for(;i.getDegree()>=r.getDegree()&&!i.isZero();){let e=i.getDegree()-r.getDegree(),t=this.field.multiply(i.getCoefficient(i.getDegree()),l);n=n.add(this.field.buildMonomial(e,t)),i=i.subtract(r.multiplyByMonomial(e,t))}s=n.multiply(o).subtract(t).negative()}let a=s.getCoefficient(0);if(0===a)throw f.getChecksumInstance();let l=this.field.inverse(a);return[s.multiply(l),i.multiply(l)]}findErrorLocations(e){let t=e.getDegree(),n=new Int32Array(t),r=0;for(let i=1;i<this.field.getSize()&&r<t;i++)0===e.evaluateAt(i)&&(n[r]=this.field.inverse(i),r++);if(r!==t)throw f.getChecksumInstance();return n}findErrorMagnitudes(e,t,n){let r=t.getDegree(),i=new Int32Array(r);for(let e=1;e<=r;e++)i[r-e]=this.field.multiply(e,t.getCoefficient(e));let o=new Wt(this.field,i),s=n.length,a=new Int32Array(s);for(let t=0;t<s;t++){let r=this.field.inverse(n[t]),i=this.field.subtract(0,e.evaluateAt(r)),s=this.field.inverse(o.evaluateAt(r));a[t]=this.field.multiply(i,s)}return a}}class qt{constructor(e,t,n,r,i){e instanceof qt?this.constructor_2(e):this.constructor_1(e,t,n,r,i)}constructor_1(e,t,n,r,i){const o=null==t||null==n,s=null==r||null==i;if(o&&s)throw new T;o?(t=new se(0,r.getY()),n=new se(0,i.getY())):s&&(r=new se(e.getWidth()-1,t.getY()),i=new se(e.getWidth()-1,n.getY())),this.image=e,this.topLeft=t,this.bottomLeft=n,this.topRight=r,this.bottomRight=i,this.minX=Math.trunc(Math.min(t.getX(),n.getX())),this.maxX=Math.trunc(Math.max(r.getX(),i.getX())),this.minY=Math.trunc(Math.min(t.getY(),r.getY())),this.maxY=Math.trunc(Math.max(n.getY(),i.getY()))}constructor_2(e){this.image=e.image,this.topLeft=e.getTopLeft(),this.bottomLeft=e.getBottomLeft(),this.topRight=e.getTopRight(),this.bottomRight=e.getBottomRight(),this.minX=e.getMinX(),this.maxX=e.getMaxX(),this.minY=e.getMinY(),this.maxY=e.getMaxY()}static merge(e,t){return null==e?t:null==t?e:new qt(e.image,e.topLeft,e.bottomLeft,t.topRight,t.bottomRight)}addMissingRows(e,t,n){let r=this.topLeft,i=this.bottomLeft,o=this.topRight,s=this.bottomRight;if(e>0){let t=n?this.topLeft:this.topRight,i=Math.trunc(t.getY()-e);i<0&&(i=0);let s=new se(t.getX(),i);n?r=s:o=s}if(t>0){let e=n?this.bottomLeft:this.bottomRight,r=Math.trunc(e.getY()+t);r>=this.image.getHeight()&&(r=this.image.getHeight()-1);let o=new se(e.getX(),r);n?i=o:s=o}return new qt(this.image,r,i,o,s)}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 Gt{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 Xt{constructor(){this.buffer=""}static form(e,t){let n=-1;function r(e,r,i,o,s,a){if("%%"===e)return"%";if(void 0===t[++n])return;e=o?parseInt(o.substr(1)):void 0;let l,c=s?parseInt(s.substr(1)):void 0;switch(a){case"s":l=t[n];break;case"c":l=t[n][0];break;case"f":l=parseFloat(t[n]).toFixed(e);break;case"p":l=parseFloat(t[n]).toPrecision(e);break;case"e":l=parseFloat(t[n]).toExponential(e);break;case"x":l=parseInt(t[n]).toString(c||16);break;case"d":l=parseFloat(parseInt(t[n],c||10).toPrecision(e)).toFixed(0)}l="object"==typeof l?JSON.stringify(l):(+l).toString(c);let d=parseInt(i),u=i&&i[0]+""=="0"?"0":" ";for(;l.length<d;)l=void 0!==r?l+u:u+l;return l}let i=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(i,r)}format(e,...t){this.buffer+=Xt.form(e,t)}toString(){return this.buffer}}class Yt{constructor(e){this.boundingBox=new qt(e),this.codewords=new Array(e.getMaxY()-e.getMinY()+1)}getCodewordNearby(e){let t=this.getCodeword(e);if(null!=t)return t;for(let n=1;n<Yt.MAX_NEARBY_DISTANCE;n++){let r=this.imageRowToCodewordIndex(e)-n;if(r>=0&&(t=this.codewords[r],null!=t))return t;if(r=this.imageRowToCodewordIndex(e)+n,r<this.codewords.length&&(t=this.codewords[r],null!=t))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 Xt;let t=0;for(const n of this.codewords)null!=n?e.format("%3d: %3d|%3d%n",t++,n.getRowNumber(),n.getValue()):e.format("%3d: | %n",t++);return e.toString()}}Yt.MAX_NEARBY_DISTANCE=5;class Zt{constructor(){this.values=new Map}setValue(e){e=Math.trunc(e);let t=this.values.get(e);null==t&&(t=0),t++,this.values.set(e,t)}getValue(){let e=-1,t=new Array;for(const[n,r]of this.values.entries()){const i={getKey:()=>n,getValue:()=>r};i.getValue()>e?(e=i.getValue(),t=[],t.push(i.getKey())):i.getValue()===e&&t.push(i.getKey())}return Ft.toIntArray(t)}getConfidence(e){return this.values.get(e)}}class Kt extends Yt{constructor(e,t){super(e),this._isLeft=t}setRowNumbers(){for(let e of this.getCodewords())null!=e&&e.setRowNumberAsRowIndicatorColumn()}adjustCompleteIndicatorColumnRowNumbers(e){let t=this.getCodewords();this.setRowNumbers(),this.removeIncorrectCodewords(t,e);let n=this.getBoundingBox(),r=this._isLeft?n.getTopLeft():n.getTopRight(),i=this._isLeft?n.getBottomLeft():n.getBottomRight(),o=this.imageRowToCodewordIndex(Math.trunc(r.getY())),s=this.imageRowToCodewordIndex(Math.trunc(i.getY())),a=-1,l=1,c=0;for(let n=o;n<s;n++){if(null==t[n])continue;let r=t[n],i=r.getRowNumber()-a;if(0===i)c++;else if(1===i)l=Math.max(l,c),c=1,a=r.getRowNumber();else if(i<0||r.getRowNumber()>=e.getRowCount()||i>n)t[n]=null;else{let e;e=l>2?(l-2)*i:i;let o=e>=n;for(let r=1;r<=e&&!o;r++)o=null!=t[n-r];o?t[n]=null:(a=r.getRowNumber(),c=1)}}}getRowHeights(){let e=this.getBarcodeMetadata();if(null==e)return null;this.adjustIncompleteIndicatorColumnRowNumbers(e);let t=new Int32Array(e.getRowCount());for(let e of this.getCodewords())if(null!=e){let n=e.getRowNumber();if(n>=t.length)continue;t[n]++}return t}adjustIncompleteIndicatorColumnRowNumbers(e){let t=this.getBoundingBox(),n=this._isLeft?t.getTopLeft():t.getTopRight(),r=this._isLeft?t.getBottomLeft():t.getBottomRight(),i=this.imageRowToCodewordIndex(Math.trunc(n.getY())),o=this.imageRowToCodewordIndex(Math.trunc(r.getY())),s=this.getCodewords(),a=-1;for(let t=i;t<o;t++){if(null==s[t])continue;let n=s[t];n.setRowNumberAsRowIndicatorColumn();let r=n.getRowNumber()-a;0===r||(1===r?a=n.getRowNumber():n.getRowNumber()>=e.getRowCount()?s[t]=null:a=n.getRowNumber())}}getBarcodeMetadata(){let e=this.getCodewords(),t=new Zt,n=new Zt,r=new Zt,i=new Zt;for(let o of e){if(null==o)continue;o.setRowNumberAsRowIndicatorColumn();let e=o.getValue()%30,s=o.getRowNumber();switch(this._isLeft||(s+=2),s%3){case 0:n.setValue(3*e+1);break;case 1:i.setValue(e/3),r.setValue(e%3);break;case 2:t.setValue(e+1)}}if(0===t.getValue().length||0===n.getValue().length||0===r.getValue().length||0===i.getValue().length||t.getValue()[0]<1||n.getValue()[0]+r.getValue()[0]<Ft.MIN_ROWS_IN_BARCODE||n.getValue()[0]+r.getValue()[0]>Ft.MAX_ROWS_IN_BARCODE)return null;let o=new Gt(t.getValue()[0],n.getValue()[0],r.getValue()[0],i.getValue()[0]);return this.removeIncorrectCodewords(e,o),o}removeIncorrectCodewords(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(null==e[n])continue;let i=r.getValue()%30,o=r.getRowNumber();if(o>t.getRowCount())e[n]=null;else switch(this._isLeft||(o+=2),o%3){case 0:3*i+1!==t.getRowCountUpperPart()&&(e[n]=null);break;case 1:Math.trunc(i/3)===t.getErrorCorrectionLevel()&&i%3===t.getRowCountLowerPart()||(e[n]=null);break;case 2:i+1!==t.getColumnCount()&&(e[n]=null)}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+"\n"+super.toString()}}class Qt{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,t=Ft.MAX_CODEWORDS_IN_BARCODE;do{e=t,t=this.adjustRowNumbersAndGetCount()}while(t>0&&t<e);return this.detectionResultColumns}adjustIndicatorColumnRowNumbers(e){null!=e&&e.adjustCompleteIndicatorColumnRowNumbers(this.barcodeMetadata)}adjustRowNumbersAndGetCount(){let e=this.adjustRowNumbersByRow();if(0===e)return 0;for(let e=1;e<this.barcodeColumnCount+1;e++){let t=this.detectionResultColumns[e].getCodewords();for(let n=0;n<t.length;n++)null!=t[n]&&(t[n].hasValidRowNumber()||this.adjustRowNumbers(e,n,t))}return e}adjustRowNumbersByRow(){return this.adjustRowNumbersFromBothRI(),this.adjustRowNumbersFromLRI()+this.adjustRowNumbersFromRRI()}adjustRowNumbersFromBothRI(){if(null==this.detectionResultColumns[0]||null==this.detectionResultColumns[this.barcodeColumnCount+1])return;let e=this.detectionResultColumns[0].getCodewords(),t=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let n=0;n<e.length;n++)if(null!=e[n]&&null!=t[n]&&e[n].getRowNumber()===t[n].getRowNumber())for(let t=1;t<=this.barcodeColumnCount;t++){let r=this.detectionResultColumns[t].getCodewords()[n];null!=r&&(r.setRowNumber(e[n].getRowNumber()),r.hasValidRowNumber()||(this.detectionResultColumns[t].getCodewords()[n]=null))}}adjustRowNumbersFromRRI(){if(null==this.detectionResultColumns[this.barcodeColumnCount+1])return 0;let e=0,t=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let n=0;n<t.length;n++){if(null==t[n])continue;let r=t[n].getRowNumber(),i=0;for(let t=this.barcodeColumnCount+1;t>0&&i<this.ADJUST_ROW_NUMBER_SKIP;t--){let o=this.detectionResultColumns[t].getCodewords()[n];null!=o&&(i=Qt.adjustRowNumberIfValid(r,i,o),o.hasValidRowNumber()||e++)}}return e}adjustRowNumbersFromLRI(){if(null==this.detectionResultColumns[0])return 0;let e=0,t=this.detectionResultColumns[0].getCodewords();for(let n=0;n<t.length;n++){if(null==t[n])continue;let r=t[n].getRowNumber(),i=0;for(let t=1;t<this.barcodeColumnCount+1&&i<this.ADJUST_ROW_NUMBER_SKIP;t++){let o=this.detectionResultColumns[t].getCodewords()[n];null!=o&&(i=Qt.adjustRowNumberIfValid(r,i,o),o.hasValidRowNumber()||e++)}}return e}static adjustRowNumberIfValid(e,t,n){return null==n||n.hasValidRowNumber()||(n.isValidRowNumber(e)?(n.setRowNumber(e),t=0):++t),t}adjustRowNumbers(e,t,n){if(!this.detectionResultColumns[e-1])return;let r=n[t],i=this.detectionResultColumns[e-1].getCodewords(),o=i;null!=this.detectionResultColumns[e+1]&&(o=this.detectionResultColumns[e+1].getCodewords());let s=new Array(14);s[2]=i[t],s[3]=o[t],t>0&&(s[0]=n[t-1],s[4]=i[t-1],s[5]=o[t-1]),t>1&&(s[8]=n[t-2],s[10]=i[t-2],s[11]=o[t-2]),t<n.length-1&&(s[1]=n[t+1],s[6]=i[t+1],s[7]=o[t+1]),t<n.length-2&&(s[9]=n[t+2],s[12]=i[t+2],s[13]=o[t+2]);for(let e of s)if(Qt.adjustRowNumber(r,e))return}static adjustRowNumber(e,t){return!(null==t||!t.hasValidRowNumber()||t.getBucket()!==e.getBucket()||(e.setRowNumber(t.getRowNumber()),0))}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];null==e&&(e=this.detectionResultColumns[this.barcodeColumnCount+1]);let t=new Xt;for(let n=0;n<e.getCodewords().length;n++){t.format("CW %3d:",n);for(let e=0;e<this.barcodeColumnCount+2;e++){if(null==this.detectionResultColumns[e]){t.format(" | ");continue}let r=this.detectionResultColumns[e].getCodewords()[n];null!=r?t.format(" %3d|%3d",r.getRowNumber(),r.getValue()):t.format(" | ")}t.format("%n")}return t.toString()}}class Jt{constructor(e,t,n,r){this.rowNumber=Jt.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!==Jt.BARCODE_ROW_UNKNOWN&&this.bucket===e%3*3}setRowNumberAsRowIndicatorColumn(){this.rowNumber=Math.trunc(3*Math.trunc(this.value/30)+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}}Jt.BARCODE_ROW_UNKNOWN=-1;class en{static initialize(){for(let e=0;e<Ft.SYMBOL_TABLE.length;e++){let t=Ft.SYMBOL_TABLE[e],n=1&t;for(let r=0;r<Ft.BARS_IN_MODULE;r++){let i=0;for(;(1&t)===n;)i+=1,t>>=1;n=1&t,en.RATIOS_TABLE[e]||(en.RATIOS_TABLE[e]=new Array(Ft.BARS_IN_MODULE)),en.RATIOS_TABLE[e][Ft.BARS_IN_MODULE-r-1]=Math.fround(i/Ft.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(e){let t=en.getDecodedCodewordValue(en.sampleBitCounts(e));return-1!==t?t:en.getClosestDecodedValue(e)}static sampleBitCounts(e){let t=ie.sum(e),n=new Int32Array(Ft.BARS_IN_MODULE),r=0,i=0;for(let o=0;o<Ft.MODULES_IN_CODEWORD;o++){let s=t/(2*Ft.MODULES_IN_CODEWORD)+o*t/Ft.MODULES_IN_CODEWORD;i+e[r]<=s&&(i+=e[r],r++),n[r]++}return n}static getDecodedCodewordValue(e){let t=en.getBitValue(e);return-1===Ft.getCodeword(t)?-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=ie.sum(e),n=new Array(Ft.BARS_IN_MODULE);if(t>1)for(let r=0;r<n.length;r++)n[r]=Math.fround(e[r]/t);let r=oe.MAX_VALUE,i=-1;this.bSymbolTableReady||en.initialize();for(let e=0;e<en.RATIOS_TABLE.length;e++){let t=0,o=en.RATIOS_TABLE[e];for(let e=0;e<Ft.BARS_IN_MODULE;e++){let i=Math.fround(o[e]-n[e]);if(t+=Math.fround(i*i),t>=r)break}t<r&&(r=t,i=Ft.SYMBOL_TABLE[e])}return i}}en.bSymbolTableReady=!1,en.RATIOS_TABLE=new Array(Ft.SYMBOL_TABLE.length).map(e=>new Array(Ft.BARS_IN_MODULE));class tn{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 nn{static parseLong(e,t=void 0){return parseInt(e,t)}}class rn extends l{}rn.kind="NullPointerException";class on{writeBytes(e){this.writeBytesOffset(e,0,e.length)}writeBytesOffset(e,t,n){if(null==e)throw new rn;if(t<0||t>e.length||n<0||t+n>e.length||t+n<0)throw new p;if(0!==n)for(let r=0;r<n;r++)this.write(e[t+r])}flush(){}close(){}}class sn extends l{}class an extends on{constructor(e=32){if(super(),this.count=0,e<0)throw new d("Negative initial size: "+e);this.buf=new Uint8Array(e)}ensureCapacity(e){e-this.buf.length>0&&this.grow(e)}grow(e){let t=this.buf.length<<1;if(t-e<0&&(t=e),t<0){if(e<0)throw new sn;t=y.MAX_VALUE}this.buf=w.copyOfUint8Array(this.buf,t)}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 p;this.ensureCapacity(this.count+n),m.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 w.copyOfUint8Array(this.buf,this.count)}size(){return this.count}toString(e){return e?"string"==typeof e?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(){}}function ln(){if("undefined"!=typeof window)return window.BigInt||null;if(void 0!==af)return af.BigInt||null;if("undefined"!=typeof self)return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}let cn;function dn(e){if(void 0===cn&&(cn=ln()),null===cn)throw new Error("BigInt is not supported!");return cn(e)}function un(){let e=[];e[0]=dn(1);let t=dn(900);e[1]=t;for(let n=2;n<16;n++)e[n]=e[n-1]*t;return e}!function(e){e[e.ALPHA=0]="ALPHA",e[e.LOWER=1]="LOWER",e[e.MIXED=2]="MIXED",e[e.PUNCT=3]="PUNCT",e[e.ALPHA_SHIFT=4]="ALPHA_SHIFT",e[e.PUNCT_SHIFT=5]="PUNCT_SHIFT"}(G||(G={}));class fn{static decode(e,t){let n=new S(""),r=C.ISO8859_1;n.enableDecoding(r);let i=1,o=e[i++],s=new tn;for(;i<e[0];){switch(o){case fn.TEXT_COMPACTION_MODE_LATCH:i=fn.textCompaction(e,i,n);break;case fn.BYTE_COMPACTION_MODE_LATCH:case fn.BYTE_COMPACTION_MODE_LATCH_6:i=fn.byteCompaction(o,e,r,i,n);break;case fn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(e[i++]);break;case fn.NUMERIC_COMPACTION_MODE_LATCH:i=fn.numericCompaction(e,i,n);break;case fn.ECI_CHARSET:C.getCharacterSetECIByValue(e[i++]);break;case fn.ECI_GENERAL_PURPOSE:i+=2;break;case fn.ECI_USER_DEFINED:i++;break;case fn.BEGIN_MACRO_PDF417_CONTROL_BLOCK:i=fn.decodeMacroBlock(e,i,s);break;case fn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case fn.MACRO_PDF417_TERMINATOR:throw new _;default:i--,i=fn.textCompaction(e,i,n)}if(!(i<e.length))throw _.getFormatInstance();o=e[i++]}if(0===n.length())throw _.getFormatInstance();let a=new Y(null,n.toString(),null,t);return a.setOther(s),a}static decodeMacroBlock(e,t,n){if(t+fn.NUMBER_OF_SEQUENCE_CODEWORDS>e[0])throw _.getFormatInstance();let r=new Int32Array(fn.NUMBER_OF_SEQUENCE_CODEWORDS);for(let n=0;n<fn.NUMBER_OF_SEQUENCE_CODEWORDS;n++,t++)r[n]=e[t];n.setSegmentIndex(y.parseInt(fn.decodeBase900toBase10(r,fn.NUMBER_OF_SEQUENCE_CODEWORDS)));let i=new S;t=fn.textCompaction(e,t,i),n.setFileId(i.toString());let o=-1;for(e[t]===fn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(o=t+1);t<e[0];)switch(e[t]){case fn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(e[++t]){case fn.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let r=new S;t=fn.textCompaction(e,t+1,r),n.setFileName(r.toString());break;case fn.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let i=new S;t=fn.textCompaction(e,t+1,i),n.setSender(i.toString());break;case fn.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let o=new S;t=fn.textCompaction(e,t+1,o),n.setAddressee(o.toString());break;case fn.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let s=new S;t=fn.numericCompaction(e,t+1,s),n.setSegmentCount(y.parseInt(s.toString()));break;case fn.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let a=new S;t=fn.numericCompaction(e,t+1,a),n.setTimestamp(nn.parseLong(a.toString()));break;case fn.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let l=new S;t=fn.numericCompaction(e,t+1,l),n.setChecksum(y.parseInt(l.toString()));break;case fn.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let c=new S;t=fn.numericCompaction(e,t+1,c),n.setFileSize(nn.parseLong(c.toString()));break;default:throw _.getFormatInstance()}break;case fn.MACRO_PDF417_TERMINATOR:t++,n.setLastSegment(!0);break;default:throw _.getFormatInstance()}if(-1!==o){let r=t-o;n.isLastSegment()&&r--,n.setOptionalData(w.copyOfRange(e,o,o+r))}return t}static textCompaction(e,t,n){let r=new Int32Array(2*(e[0]-t)),i=new Int32Array(2*(e[0]-t)),o=0,s=!1;for(;t<e[0]&&!s;){let n=e[t++];if(n<fn.TEXT_COMPACTION_MODE_LATCH)r[o]=n/30,r[o+1]=n%30,o+=2;else switch(n){case fn.TEXT_COMPACTION_MODE_LATCH:r[o++]=fn.TEXT_COMPACTION_MODE_LATCH;break;case fn.BYTE_COMPACTION_MODE_LATCH:case fn.BYTE_COMPACTION_MODE_LATCH_6:case fn.NUMERIC_COMPACTION_MODE_LATCH:case fn.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case fn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case fn.MACRO_PDF417_TERMINATOR:t--,s=!0;break;case fn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r[o]=fn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,n=e[t++],i[o]=n,o++}}return fn.decodeTextCompaction(r,i,o,n),t}static decodeTextCompaction(e,t,n,r){let i=G.ALPHA,o=G.ALPHA,s=0;for(;s<n;){let n=e[s],a="";switch(i){case G.ALPHA:if(n<26)a=String.fromCharCode(65+n);else switch(n){case 26:a=" ";break;case fn.LL:i=G.LOWER;break;case fn.ML:i=G.MIXED;break;case fn.PS:o=i,i=G.PUNCT_SHIFT;break;case fn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[s]);break;case fn.TEXT_COMPACTION_MODE_LATCH:i=G.ALPHA}break;case G.LOWER:if(n<26)a=String.fromCharCode(97+n);else switch(n){case 26:a=" ";break;case fn.AS:o=i,i=G.ALPHA_SHIFT;break;case fn.ML:i=G.MIXED;break;case fn.PS:o=i,i=G.PUNCT_SHIFT;break;case fn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[s]);break;case fn.TEXT_COMPACTION_MODE_LATCH:i=G.ALPHA}break;case G.MIXED:if(n<fn.PL)a=fn.MIXED_CHARS[n];else switch(n){case fn.PL:i=G.PUNCT;break;case 26:a=" ";break;case fn.LL:i=G.LOWER;break;case fn.AL:i=G.ALPHA;break;case fn.PS:o=i,i=G.PUNCT_SHIFT;break;case fn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[s]);break;case fn.TEXT_COMPACTION_MODE_LATCH:i=G.ALPHA}break;case G.PUNCT:if(n<fn.PAL)a=fn.PUNCT_CHARS[n];else switch(n){case fn.PAL:i=G.ALPHA;break;case fn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[s]);break;case fn.TEXT_COMPACTION_MODE_LATCH:i=G.ALPHA}break;case G.ALPHA_SHIFT:if(i=o,n<26)a=String.fromCharCode(65+n);else switch(n){case 26:a=" ";break;case fn.TEXT_COMPACTION_MODE_LATCH:i=G.ALPHA}break;case G.PUNCT_SHIFT:if(i=o,n<fn.PAL)a=fn.PUNCT_CHARS[n];else switch(n){case fn.PAL:i=G.ALPHA;break;case fn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[s]);break;case fn.TEXT_COMPACTION_MODE_LATCH:i=G.ALPHA}}""!==a&&r.append(a),s++}}static byteCompaction(e,t,n,r,i){let o=new an,s=0,a=0,l=!1;switch(e){case fn.BYTE_COMPACTION_MODE_LATCH:let e=new Int32Array(6),n=t[r++];for(;r<t[0]&&!l;)switch(e[s++]=n,a=900*a+n,n=t[r++],n){case fn.TEXT_COMPACTION_MODE_LATCH:case fn.BYTE_COMPACTION_MODE_LATCH:case fn.NUMERIC_COMPACTION_MODE_LATCH:case fn.BYTE_COMPACTION_MODE_LATCH_6:case fn.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case fn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case fn.MACRO_PDF417_TERMINATOR:r--,l=!0;break;default:if(s%5==0&&s>0){for(let e=0;e<6;++e)o.write(Number(dn(a)>>dn(8*(5-e))));a=0,s=0}}r===t[0]&&n<fn.TEXT_COMPACTION_MODE_LATCH&&(e[s++]=n);for(let t=0;t<s;t++)o.write(e[t]);break;case fn.BYTE_COMPACTION_MODE_LATCH_6:for(;r<t[0]&&!l;){let e=t[r++];if(e<fn.TEXT_COMPACTION_MODE_LATCH)s++,a=900*a+e;else switch(e){case fn.TEXT_COMPACTION_MODE_LATCH:case fn.BYTE_COMPACTION_MODE_LATCH:case fn.NUMERIC_COMPACTION_MODE_LATCH:case fn.BYTE_COMPACTION_MODE_LATCH_6:case fn.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case fn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case fn.MACRO_PDF417_TERMINATOR:r--,l=!0}if(s%5==0&&s>0){for(let e=0;e<6;++e)o.write(Number(dn(a)>>dn(8*(5-e))));a=0,s=0}}}return i.append(A.decode(o.toByteArray(),n)),r}static numericCompaction(e,t,n){let r=0,i=!1,o=new Int32Array(fn.MAX_NUMERIC_CODEWORDS);for(;t<e[0]&&!i;){let s=e[t++];if(t===e[0]&&(i=!0),s<fn.TEXT_COMPACTION_MODE_LATCH)o[r]=s,r++;else switch(s){case fn.TEXT_COMPACTION_MODE_LATCH:case fn.BYTE_COMPACTION_MODE_LATCH:case fn.BYTE_COMPACTION_MODE_LATCH_6:case fn.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case fn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case fn.MACRO_PDF417_TERMINATOR:t--,i=!0}(r%fn.MAX_NUMERIC_CODEWORDS===0||s===fn.NUMERIC_COMPACTION_MODE_LATCH||i)&&r>0&&(n.append(fn.decodeBase900toBase10(o,r)),r=0)}return t}static decodeBase900toBase10(e,t){let n=dn(0);for(let r=0;r<t;r++)n+=fn.EXP900[t-r-1]*dn(e[r]);let r=n.toString();if("1"!==r.charAt(0))throw new _;return r.substring(1)}}fn.TEXT_COMPACTION_MODE_LATCH=900,fn.BYTE_COMPACTION_MODE_LATCH=901,fn.NUMERIC_COMPACTION_MODE_LATCH=902,fn.BYTE_COMPACTION_MODE_LATCH_6=924,fn.ECI_USER_DEFINED=925,fn.ECI_GENERAL_PURPOSE=926,fn.ECI_CHARSET=927,fn.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,fn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,fn.MACRO_PDF417_TERMINATOR=922,fn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,fn.MAX_NUMERIC_CODEWORDS=15,fn.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,fn.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,fn.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,fn.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,fn.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,fn.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,fn.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,fn.PL=25,fn.LL=27,fn.AS=27,fn.ML=28,fn.AL=28,fn.PS=29,fn.PAL=29,fn.PUNCT_CHARS=";<>@[\\]_`~!\r\t,:\n-.$/\"|*()?{}'",fn.MIXED_CHARS="0123456789&\r\t,:#-.$/+%*=^",fn.EXP900=ln()?un():[],fn.NUMBER_OF_SEQUENCE_CODEWORDS=2;class hn{constructor(){}static decode(e,t,n,r,i,o,s){let a,l=new qt(e,t,n,r,i),c=null,d=null;for(let n=!0;;n=!1){if(null!=t&&(c=hn.getRowIndicatorColumn(e,l,t,!0,o,s)),null!=r&&(d=hn.getRowIndicatorColumn(e,l,r,!1,o,s)),a=hn.merge(c,d),null==a)throw T.getNotFoundInstance();let i=a.getBoundingBox();if(!n||null==i||!(i.getMinY()<l.getMinY()||i.getMaxY()>l.getMaxY()))break;l=i}a.setBoundingBox(l);let u=a.getBarcodeColumnCount()+1;a.setDetectionResultColumn(0,c),a.setDetectionResultColumn(u,d);let f=null!=c;for(let t=1;t<=u;t++){let n,r=f?t:u-t;if(void 0!==a.getDetectionResultColumn(r))continue;n=0===r||r===u?new Kt(l,0===r):new Yt(l),a.setDetectionResultColumn(r,n);let i=-1,c=i;for(let t=l.getMinY();t<=l.getMaxY();t++){if(i=hn.getStartColumn(a,r,t,f),i<0||i>l.getMaxX()){if(-1===c)continue;i=c}let d=hn.detectCodeword(e,l.getMinX(),l.getMaxX(),f,i,t,o,s);null!=d&&(n.setCodeword(t,d),c=i,o=Math.min(o,d.getWidth()),s=Math.max(s,d.getWidth()))}}return hn.createDecoderResult(a)}static merge(e,t){if(null==e&&null==t)return null;let n=hn.getBarcodeMetadata(e,t);if(null==n)return null;let r=qt.merge(hn.adjustBoundingBox(e),hn.adjustBoundingBox(t));return new Qt(n,r)}static adjustBoundingBox(e){if(null==e)return null;let t=e.getRowHeights();if(null==t)return null;let n=hn.getMax(t),r=0;for(let e of t)if(r+=n-e,e>0)break;let i=e.getCodewords();for(let e=0;r>0&&null==i[e];e++)r--;let o=0;for(let e=t.length-1;e>=0&&(o+=n-t[e],!(t[e]>0));e--);for(let e=i.length-1;o>0&&null==i[e];e--)o--;return e.getBoundingBox().addMissingRows(r,o,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,r;return null==e||null==(n=e.getBarcodeMetadata())?null==t?null:t.getBarcodeMetadata():null==t||null==(r=t.getBarcodeMetadata())?n:n.getColumnCount()!==r.getColumnCount()&&n.getErrorCorrectionLevel()!==r.getErrorCorrectionLevel()&&n.getRowCount()!==r.getRowCount()?null:n}static getRowIndicatorColumn(e,t,n,r,i,o){let s=new Kt(t,r);for(let a=0;a<2;a++){let l=0===a?1:-1,c=Math.trunc(Math.trunc(n.getX()));for(let a=Math.trunc(Math.trunc(n.getY()));a<=t.getMaxY()&&a>=t.getMinY();a+=l){let t=hn.detectCodeword(e,0,e.getWidth(),r,c,a,i,o);null!=t&&(s.setCodeword(a,t),c=r?t.getStartX():t.getEndX())}}return s}static adjustCodewordCount(e,t){let n=t[0][1],r=n.getValue(),i=e.getBarcodeColumnCount()*e.getBarcodeRowCount()-hn.getNumberOfECCodeWords(e.getBarcodeECLevel());if(0===r.length){if(i<1||i>Ft.MAX_CODEWORDS_IN_BARCODE)throw T.getNotFoundInstance();n.setValue(i)}else r[0]!==i&&n.setValue(i)}static createDecoderResult(e){let t=hn.createBarcodeMatrix(e);hn.adjustCodewordCount(e,t);let n=new Array,r=new Int32Array(e.getBarcodeRowCount()*e.getBarcodeColumnCount()),i=[],o=new Array;for(let s=0;s<e.getBarcodeRowCount();s++)for(let a=0;a<e.getBarcodeColumnCount();a++){let l=t[s][a+1].getValue(),c=s*e.getBarcodeColumnCount()+a;0===l.length?n.push(c):1===l.length?r[c]=l[0]:(o.push(c),i.push(l))}let s=new Array(i.length);for(let e=0;e<s.length;e++)s[e]=i[e];return hn.createDecoderResultFromAmbiguousValues(e.getBarcodeECLevel(),r,Ft.toIntArray(n),Ft.toIntArray(o),s)}static createDecoderResultFromAmbiguousValues(e,t,n,r,i){let o=new Int32Array(r.length),s=100;for(;s-- >0;){for(let e=0;e<o.length;e++)t[r[e]]=i[e][o[e]];try{return hn.decodeCodewords(t,e,n)}catch(e){if(!(e instanceof f))throw e}if(0===o.length)throw f.getChecksumInstance();for(let e=0;e<o.length;e++){if(o[e]<i[e].length-1){o[e]++;break}if(o[e]=0,e===o.length-1)throw f.getChecksumInstance()}}throw f.getChecksumInstance()}static createBarcodeMatrix(e){let t=Array.from({length:e.getBarcodeRowCount()},()=>new Array(e.getBarcodeColumnCount()+2));for(let e=0;e<t.length;e++)for(let n=0;n<t[e].length;n++)t[e][n]=new Zt;let n=0;for(let r of e.getDetectionResultColumns()){if(null!=r)for(let e of r.getCodewords())if(null!=e){let r=e.getRowNumber();if(r>=0){if(r>=t.length)continue;t[r][n].setValue(e.getValue())}}n++}return t}static isValidBarcodeColumn(e,t){return t>=0&&t<=e.getBarcodeColumnCount()+1}static getStartColumn(e,t,n,r){let i=r?1:-1,o=null;if(hn.isValidBarcodeColumn(e,t-i)&&(o=e.getDetectionResultColumn(t-i).getCodeword(n)),null!=o)return r?o.getEndX():o.getStartX();if(o=e.getDetectionResultColumn(t).getCodewordNearby(n),null!=o)return r?o.getStartX():o.getEndX();if(hn.isValidBarcodeColumn(e,t-i)&&(o=e.getDetectionResultColumn(t-i).getCodewordNearby(n)),null!=o)return r?o.getEndX():o.getStartX();let s=0;for(;hn.isValidBarcodeColumn(e,t-i);){t-=i;for(let n of e.getDetectionResultColumn(t).getCodewords())if(null!=n)return(r?n.getEndX():n.getStartX())+i*s*(n.getEndX()-n.getStartX());s++}return r?e.getBoundingBox().getMinX():e.getBoundingBox().getMaxX()}static detectCodeword(e,t,n,r,i,o,s,a){i=hn.adjustCodewordStartColumn(e,t,n,r,i,o);let l,c=hn.getModuleBitCount(e,t,n,r,i,o);if(null==c)return null;let d=ie.sum(c);if(r)l=i+d;else{for(let e=0;e<c.length/2;e++){let t=c[e];c[e]=c[c.length-1-e],c[c.length-1-e]=t}l=i,i=l-d}if(!hn.checkCodewordSkew(d,s,a))return null;let u=en.getDecodedValue(c),f=Ft.getCodeword(u);return-1===f?null:new Jt(i,l,hn.getCodewordBucketNumber(u),f)}static getModuleBitCount(e,t,n,r,i,o){let s=i,a=new Int32Array(8),l=0,c=r?1:-1,d=r;for(;(r?s<n:s>=t)&&l<a.length;)e.get(s,o)===d?(a[l]++,s+=c):(l++,d=!d);return l===a.length||s===(r?n:t)&&l===a.length-1?a:null}static getNumberOfECCodeWords(e){return 2<<e}static adjustCodewordStartColumn(e,t,n,r,i,o){let s=i,a=r?-1:1;for(let l=0;l<2;l++){for(;(r?s>=t:s<n)&&r===e.get(s,o);){if(Math.abs(i-s)>hn.CODEWORD_SKEW_SIZE)return i;s+=a}a=-a,r=!r}return s}static checkCodewordSkew(e,t,n){return t-hn.CODEWORD_SKEW_SIZE<=e&&e<=n+hn.CODEWORD_SKEW_SIZE}static decodeCodewords(e,t,n){if(0===e.length)throw _.getFormatInstance();let r=1<<t+1,i=hn.correctErrors(e,n,r);hn.verifyCodewordCount(e,r);let o=fn.decode(e,""+t);return o.setErrorsCorrected(i),o.setErasures(n.length),o}static correctErrors(e,t,n){if(null!=t&&t.length>n/2+hn.MAX_ERRORS||n<0||n>hn.MAX_EC_CODEWORDS)throw f.getChecksumInstance();return hn.errorCorrection.decode(e,n,t)}static verifyCodewordCount(e,t){if(e.length<4)throw _.getFormatInstance();let n=e[0];if(n>e.length)throw _.getFormatInstance();if(0===n){if(!(t<e.length))throw _.getFormatInstance();e[0]=e.length-t}}static getBitCountForCodeword(e){let t=new Int32Array(8),n=0,r=t.length-1;for(;!((1&e)!==n&&(n=1&e,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 hn.getCodewordBucketNumber(hn.getBitCountForCodeword(e))}static getCodewordBucketNumber_Int32Array(e){return(e[0]-e[2]+e[4]-e[6]+9)%9}static toString(e){let t=new Xt;for(let n=0;n<e.length;n++){t.format("Row %2d: ",n);for(let r=0;r<e[n].length;r++){let i=e[n][r];0===i.getValue().length?t.format(" ",null):t.format("%4d(%2d)",i.getValue()[0],i.getConfidence(i.getValue()[0]))}t.format("%n")}return t.toString()}}hn.CODEWORD_SKEW_SIZE=2,hn.MAX_ERRORS=3,hn.MAX_EC_CODEWORDS=512,hn.errorCorrection=new jt;class mn{decode(e,t=null){let n=mn.decode(e,t,!1);if(null==n||0===n.length||null==n[0])throw T.getNotFoundInstance();return n[0]}decodeMultiple(e,t=null){try{return mn.decode(e,t,!0)}catch(e){if(e instanceof _||e instanceof f)throw T.getNotFoundInstance();throw e}}static decode(e,t,n){const r=new Array,i=Ut.detectMultiple(e,t,n);for(const e of i.getPoints()){const t=hn.decode(i.getBits(),e[4],e[5],e[6],e[7],mn.getMinCodewordWidth(e),mn.getMaxCodewordWidth(e)),n=new F(t.getText(),t.getRawBytes(),void 0,e,U.PDF_417);n.putMetadata(X.ERROR_CORRECTION_LEVEL,t.getECLevel());const o=t.getOther();null!=o&&n.putMetadata(X.PDF417_EXTRA_METADATA,o),r.push(n)}return r.map(e=>e)}static getMaxWidth(e,t){return null==e||null==t?0:Math.trunc(Math.abs(e.getX()-t.getX()))}static getMinWidth(e,t){return null==e||null==t?y.MAX_VALUE:Math.trunc(Math.abs(e.getX()-t.getX()))}static getMaxCodewordWidth(e){return Math.floor(Math.max(Math.max(mn.getMaxWidth(e[0],e[4]),mn.getMaxWidth(e[6],e[2])*Ft.MODULES_IN_CODEWORD/Ft.MODULES_IN_STOP_PATTERN),Math.max(mn.getMaxWidth(e[1],e[5]),mn.getMaxWidth(e[7],e[3])*Ft.MODULES_IN_CODEWORD/Ft.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(e){return Math.floor(Math.min(Math.min(mn.getMinWidth(e[0],e[4]),mn.getMinWidth(e[6],e[2])*Ft.MODULES_IN_CODEWORD/Ft.MODULES_IN_STOP_PATTERN),Math.min(mn.getMinWidth(e[1],e[5]),mn.getMinWidth(e[7],e[3])*Ft.MODULES_IN_CODEWORD/Ft.MODULES_IN_STOP_PATTERN)))}reset(){}}class pn extends l{}pn.kind="ReaderException";class gn{constructor(e,t){this.verbose=!0===e,t&&this.setHints(t)}decode(e,t){return t&&this.setHints(t),this.decodeInternal(e)}decodeWithState(e){return null!==this.readers&&void 0!==this.readers||this.setHints(null),this.decodeInternal(e)}setHints(e){this.hints=e;const n=!t(e)&&!0===e.get(I.TRY_HARDER),r=t(e)?null:e.get(I.POSSIBLE_FORMATS),i=new Array;if(!t(r)){const t=r.some(e=>e===U.UPC_A||e===U.UPC_E||e===U.EAN_13||e===U.EAN_8||e===U.CODABAR||e===U.CODE_39||e===U.CODE_93||e===U.CODE_128||e===U.ITF||e===U.RSS_14||e===U.RSS_EXPANDED);t&&!n&&i.push(new at(e,this.verbose)),r.includes(U.QR_CODE)&&i.push(new Lt),r.includes(U.DATA_MATRIX)&&i.push(new yt),r.includes(U.AZTEC)&&i.push(new ge),r.includes(U.PDF_417)&&i.push(new mn),t&&n&&i.push(new at(e,this.verbose))}0===i.length&&(n||i.push(new at(e,this.verbose)),i.push(new Lt),i.push(new yt),i.push(new ge),i.push(new mn),n&&i.push(new at(e,this.verbose))),this.readers=i}reset(){if(null!==this.readers)for(const e of this.readers)e.reset()}decodeInternal(e){if(null===this.readers)throw new pn("No readers where selected, nothing can be read.");for(const t of this.readers)try{return t.decode(e,this.hints)}catch(e){if(e instanceof pn)continue}throw new T("No MultiFormat Readers were able to detect the code.")}}class wn extends L{constructor(e=null,t=500){const n=new gn;n.setHints(e),super(n,t)}decodeBitmap(e){return this.reader.decodeWithState(e)}}class yn extends L{constructor(e=500){super(new mn,e)}}class vn extends L{constructor(e=500){super(new Lt,e)}}var $n;!function(e){e[e.ERROR_CORRECTION=0]="ERROR_CORRECTION",e[e.CHARACTER_SET=1]="CHARACTER_SET",e[e.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",e[e.MIN_SIZE=3]="MIN_SIZE",e[e.MAX_SIZE=4]="MAX_SIZE",e[e.MARGIN=5]="MARGIN",e[e.PDF417_COMPACT=6]="PDF417_COMPACT",e[e.PDF417_COMPACTION=7]="PDF417_COMPACTION",e[e.PDF417_DIMENSIONS=8]="PDF417_DIMENSIONS",e[e.AZTEC_LAYERS=9]="AZTEC_LAYERS",e[e.QR_VERSION=10]="QR_VERSION"}($n||($n={}));var In=$n;class _n{constructor(e){this.field=e,this.cachedGenerators=[],this.cachedGenerators.push(new K(e,Int32Array.from([1])))}buildGenerator(e){const t=this.cachedGenerators;if(e>=t.length){let n=t[t.length-1];const r=this.field;for(let i=t.length;i<=e;i++){const e=n.multiply(new K(r,Int32Array.from([1,r.exp(i-1+r.getGeneratorBase())])));t.push(e),n=e}}return t[e]}encode(e,t){if(0===t)throw new d("No error correction bytes");const n=e.length-t;if(n<=0)throw new d("No data bytes provided");const r=this.buildGenerator(t),i=new Int32Array(n);m.arraycopy(e,0,i,0,n);let o=new K(this.field,i);o=o.multiplyByMonomial(t,1);const s=o.divide(r)[1].getCoefficients(),a=t-s.length;for(let t=0;t<a;t++)e[n+t]=0;m.arraycopy(s,0,e,n+a,s.length)}}class Cn{constructor(){}static applyMaskPenaltyRule1(e){return Cn.applyMaskPenaltyRule1Internal(e,!0)+Cn.applyMaskPenaltyRule1Internal(e,!1)}static applyMaskPenaltyRule2(e){let t=0;const n=e.getArray(),r=e.getWidth(),i=e.getHeight();for(let e=0;e<i-1;e++){const i=n[e];for(let o=0;o<r-1;o++){const r=i[o];r===i[o+1]&&r===n[e+1][o]&&r===n[e+1][o+1]&&t++}}return Cn.N2*t}static applyMaskPenaltyRule3(e){let t=0;const n=e.getArray(),r=e.getWidth(),i=e.getHeight();for(let e=0;e<i;e++)for(let o=0;o<r;o++){const s=n[e];o+6<r&&1===s[o]&&0===s[o+1]&&1===s[o+2]&&1===s[o+3]&&1===s[o+4]&&0===s[o+5]&&1===s[o+6]&&(Cn.isWhiteHorizontal(s,o-4,o)||Cn.isWhiteHorizontal(s,o+7,o+11))&&t++,e+6<i&&1===n[e][o]&&0===n[e+1][o]&&1===n[e+2][o]&&1===n[e+3][o]&&1===n[e+4][o]&&0===n[e+5][o]&&1===n[e+6][o]&&(Cn.isWhiteVertical(n,o,e-4,e)||Cn.isWhiteVertical(n,o,e+7,e+11))&&t++}return t*Cn.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(1===e[r])return!1;return!0}static isWhiteVertical(e,t,n,r){n=Math.max(n,0),r=Math.min(r,e.length);for(let i=n;i<r;i++)if(1===e[i][t])return!1;return!0}static applyMaskPenaltyRule4(e){let t=0;const n=e.getArray(),r=e.getWidth(),i=e.getHeight();for(let e=0;e<i;e++){const i=n[e];for(let e=0;e<r;e++)1===i[e]&&t++}const o=e.getHeight()*e.getWidth();return Math.floor(10*Math.abs(2*t-o)/o)*Cn.N4}static getDataMaskBit(e,t,n){let r,i;switch(e){case 0:r=n+t&1;break;case 1:r=1&n;break;case 2:r=t%3;break;case 3:r=(n+t)%3;break;case 4:r=Math.floor(n/2)+Math.floor(t/3)&1;break;case 5:i=n*t,r=(1&i)+i%3;break;case 6:i=n*t,r=(1&i)+i%3&1;break;case 7:i=n*t,r=i%3+(n+t&1)&1;break;default:throw new d("Invalid mask pattern: "+e)}return 0===r}static applyMaskPenaltyRule1Internal(e,t){let n=0;const r=t?e.getHeight():e.getWidth(),i=t?e.getWidth():e.getHeight(),o=e.getArray();for(let e=0;e<r;e++){let r=0,s=-1;for(let a=0;a<i;a++){const i=t?o[e][a]:o[a][e];i===s?r++:(r>=5&&(n+=Cn.N1+(r-5)),r=1,s=i)}r>=5&&(n+=Cn.N1+(r-5))}return n}}Cn.N1=3,Cn.N2=3,Cn.N3=40,Cn.N4=10;class En{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)w.fill(t,e)}equals(e){if(!(e instanceof En))return!1;const t=e;if(this.width!==t.width)return!1;if(this.height!==t.height)return!1;for(let e=0,n=this.height;e<n;++e){const n=this.bytes[e],r=t.bytes[e];for(let e=0,t=this.width;e<t;++e)if(n[e]!==r[e])return!1}return!0}toString(){const e=new S;for(let t=0,n=this.height;t<n;++t){const n=this.bytes[t];for(let t=0,r=this.width;t<r;++t)switch(n[t]){case 0:e.append(" 0");break;case 1:e.append(" 1");break;default:e.append(" ")}e.append("\n")}return e.toString()}}class An{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 S;return e.append("<<\n"),e.append(" mode: "),e.append(this.mode?this.mode.toString():"null"),e.append("\n ecLevel: "),e.append(this.ecLevel?this.ecLevel.toString():"null"),e.append("\n version: "),e.append(this.version?this.version.toString():"null"),e.append("\n maskPattern: "),e.append(this.maskPattern.toString()),this.matrix?(e.append("\n matrix:\n"),e.append(this.matrix.toString())):e.append("\n matrix: null\n"),e.append(">>\n"),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<An.NUM_MASK_PATTERNS}}An.NUM_MASK_PATTERNS=8;class bn extends l{}bn.kind="WriterException";class Sn{constructor(){}static clearMatrix(e){e.clear(255)}static buildMatrix(e,t,n,r,i){Sn.clearMatrix(i),Sn.embedBasicPatterns(n,i),Sn.embedTypeInfo(t,r,i),Sn.maybeEmbedVersionInfo(n,i),Sn.embedDataBits(e,r,i)}static embedBasicPatterns(e,t){Sn.embedPositionDetectionPatternsAndSeparators(t),Sn.embedDarkDotAtLeftBottomCorner(t),Sn.maybeEmbedPositionAdjustmentPatterns(e,t),Sn.embedTimingPatterns(t)}static embedTypeInfo(e,t,n){const r=new v;Sn.makeTypeInfoBits(e,t,r);for(let e=0,t=r.getSize();e<t;++e){const t=r.get(r.getSize()-1-e),i=Sn.TYPE_INFO_COORDINATES[e],o=i[0],s=i[1];if(n.setBoolean(o,s,t),e<8){const r=n.getWidth()-e-1,i=8;n.setBoolean(r,i,t)}else{const r=8,i=n.getHeight()-7+(e-8);n.setBoolean(r,i,t)}}}static maybeEmbedVersionInfo(e,t){if(e.getVersionNumber()<7)return;const n=new v;Sn.makeVersionInfoBits(e,n);let r=17;for(let e=0;e<6;++e)for(let i=0;i<3;++i){const o=n.get(r);r--,t.setBoolean(e,t.getHeight()-11+i,o),t.setBoolean(t.getHeight()-11+i,e,o)}}static embedDataBits(e,t,n){let r=0,i=-1,o=n.getWidth()-1,s=n.getHeight()-1;for(;o>0;){for(6===o&&(o-=1);s>=0&&s<n.getHeight();){for(let i=0;i<2;++i){const a=o-i;if(!Sn.isEmpty(n.get(a,s)))continue;let l;r<e.getSize()?(l=e.get(r),++r):l=!1,255!==t&&Cn.getDataMaskBit(t,a,s)&&(l=!l),n.setBoolean(a,s,l)}s+=i}i=-i,s+=i,o-=2}if(r!==e.getSize())throw new bn("Not all bits consumed: "+r+"/"+e.getSize())}static findMSBSet(e){return 32-y.numberOfLeadingZeros(e)}static calculateBCHCode(e,t){if(0===t)throw new d("0 polynomial");const n=Sn.findMSBSet(t);for(e<<=n-1;Sn.findMSBSet(e)>=n;)e^=t<<Sn.findMSBSet(e)-n;return e}static makeTypeInfoBits(e,t,n){if(!An.isValidMaskPattern(t))throw new bn("Invalid mask pattern");const r=e.getBits()<<3|t;n.appendBits(r,5);const i=Sn.calculateBCHCode(r,Sn.TYPE_INFO_POLY);n.appendBits(i,10);const o=new v;if(o.appendBits(Sn.TYPE_INFO_MASK_PATTERN,15),n.xor(o),15!==n.getSize())throw new bn("should not happen but we got: "+n.getSize())}static makeVersionInfoBits(e,t){t.appendBits(e.getVersionNumber(),6);const n=Sn.calculateBCHCode(e.getVersionNumber(),Sn.VERSION_INFO_POLY);if(t.appendBits(n,12),18!==t.getSize())throw new bn("should not happen but we got: "+t.getSize())}static isEmpty(e){return 255===e}static embedTimingPatterns(e){for(let t=8;t<e.getWidth()-8;++t){const n=(t+1)%2;Sn.isEmpty(e.get(t,6))&&e.setNumber(t,6,n),Sn.isEmpty(e.get(6,t))&&e.setNumber(6,t,n)}}static embedDarkDotAtLeftBottomCorner(e){if(0===e.get(8,e.getHeight()-8))throw new bn;e.setNumber(8,e.getHeight()-8,1)}static embedHorizontalSeparationPattern(e,t,n){for(let r=0;r<8;++r){if(!Sn.isEmpty(n.get(e+r,t)))throw new bn;n.setNumber(e+r,t,0)}}static embedVerticalSeparationPattern(e,t,n){for(let r=0;r<7;++r){if(!Sn.isEmpty(n.get(e,t+r)))throw new bn;n.setNumber(e,t+r,0)}}static embedPositionAdjustmentPattern(e,t,n){for(let r=0;r<5;++r){const i=Sn.POSITION_ADJUSTMENT_PATTERN[r];for(let o=0;o<5;++o)n.setNumber(e+o,t+r,i[o])}}static embedPositionDetectionPattern(e,t,n){for(let r=0;r<7;++r){const i=Sn.POSITION_DETECTION_PATTERN[r];for(let o=0;o<7;++o)n.setNumber(e+o,t+r,i[o])}}static embedPositionDetectionPatternsAndSeparators(e){const t=Sn.POSITION_DETECTION_PATTERN[0].length;Sn.embedPositionDetectionPattern(0,0,e),Sn.embedPositionDetectionPattern(e.getWidth()-t,0,e),Sn.embedPositionDetectionPattern(0,e.getWidth()-t,e);const n=8;Sn.embedHorizontalSeparationPattern(0,n-1,e),Sn.embedHorizontalSeparationPattern(e.getWidth()-n,n-1,e),Sn.embedHorizontalSeparationPattern(0,e.getWidth()-n,e);const r=7;Sn.embedVerticalSeparationPattern(r,0,e),Sn.embedVerticalSeparationPattern(e.getHeight()-r-1,0,e),Sn.embedVerticalSeparationPattern(r,e.getHeight()-r,e)}static maybeEmbedPositionAdjustmentPatterns(e,t){if(e.getVersionNumber()<2)return;const n=e.getVersionNumber()-1,r=Sn.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[n];for(let e=0,n=r.length;e!==n;e++){const i=r[e];if(i>=0)for(let e=0;e!==n;e++){const n=r[e];n>=0&&Sn.isEmpty(t.get(n,i))&&Sn.embedPositionAdjustmentPattern(n-2,i-2,t)}}}}Sn.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])]),Sn.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])]),Sn.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])]),Sn.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])]),Sn.VERSION_INFO_POLY=7973,Sn.TYPE_INFO_POLY=1335,Sn.TYPE_INFO_MASK_PATTERN=21522;class Nn{constructor(e,t){this.dataBytes=e,this.errorCorrectionBytes=t}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class Tn{constructor(){}static calculateMaskPenalty(e){return Cn.applyMaskPenaltyRule1(e)+Cn.applyMaskPenaltyRule2(e)+Cn.applyMaskPenaltyRule3(e)+Cn.applyMaskPenaltyRule4(e)}static encode(e,t,n=null){let r=Tn.DEFAULT_BYTE_MODE_ENCODING;const i=null!==n&&void 0!==n.get(In.CHARACTER_SET);i&&(r=n.get(In.CHARACTER_SET).toString());const o=this.chooseMode(e,r),s=new v;if(o===Nt.BYTE&&(i||Tn.DEFAULT_BYTE_MODE_ENCODING!==r)){const e=C.getCharacterSetECIByName(r);void 0!==e&&this.appendECI(e,s)}this.appendModeInfo(o,s);const a=new v;let l;if(this.appendBytes(e,o,a,r),null!==n&&void 0!==n.get(In.QR_VERSION)){const e=Number.parseInt(n.get(In.QR_VERSION).toString(),10);l=Et.getVersionForNumber(e);const r=this.calculateBitsNeeded(o,s,a,l);if(!this.willFit(r,l,t))throw new bn("Data too big for requested version")}else l=this.recommendVersion(t,o,s,a);const c=new v;c.appendBitArray(s);const d=o===Nt.BYTE?a.getSizeInBytes():e.length;this.appendLengthInfo(d,l,o,c),c.appendBitArray(a);const u=l.getECBlocksForLevel(t),f=l.getTotalCodewords()-u.getTotalECCodewords();this.terminateBits(f,c);const h=this.interleaveWithECBytes(c,l.getTotalCodewords(),f,u.getNumBlocks()),m=new An;m.setECLevel(t),m.setMode(o),m.setVersion(l);const p=l.getDimensionForVersion(),g=new En(p,p),w=this.chooseMaskPattern(h,t,l,g);return m.setMaskPattern(w),Sn.buildMatrix(h,t,l,w,g),m.setMatrix(g),m}static recommendVersion(e,t,n,r){const i=this.calculateBitsNeeded(t,n,r,Et.getVersionForNumber(1)),o=this.chooseVersion(i,e),s=this.calculateBitsNeeded(t,n,r,o);return this.chooseVersion(s,e)}static calculateBitsNeeded(e,t,n,r){return t.getSize()+e.getCharacterCountBits(r)+n.getSize()}static getAlphanumericCode(e){return e<Tn.ALPHANUMERIC_TABLE.length?Tn.ALPHANUMERIC_TABLE[e]:-1}static chooseMode(e,t=null){if(C.SJIS.getName()===t&&this.isOnlyDoubleByteKanji(e))return Nt.KANJI;let n=!1,r=!1;for(let t=0,i=e.length;t<i;++t){const i=e.charAt(t);if(Tn.isDigit(i))n=!0;else{if(-1===this.getAlphanumericCode(i.charCodeAt(0)))return Nt.BYTE;r=!0}}return r?Nt.ALPHANUMERIC:n?Nt.NUMERIC:Nt.BYTE}static isOnlyDoubleByteKanji(e){let t;try{t=A.encode(e,C.SJIS)}catch(e){return!1}const n=t.length;if(n%2!=0)return!1;for(let e=0;e<n;e+=2){const n=255&t[e];if((n<129||n>159)&&(n<224||n>235))return!1}return!0}static chooseMaskPattern(e,t,n,r){let i=Number.MAX_SAFE_INTEGER,o=-1;for(let s=0;s<An.NUM_MASK_PATTERNS;s++){Sn.buildMatrix(e,t,n,s,r);let a=this.calculateMaskPenalty(r);a<i&&(i=a,o=s)}return o}static chooseVersion(e,t){for(let n=1;n<=40;n++){const r=Et.getVersionForNumber(n);if(Tn.willFit(e,r,t))return r}throw new bn("Data too big")}static willFit(e,t,n){return t.getTotalCodewords()-t.getECBlocksForLevel(n).getTotalECCodewords()>=(e+7)/8}static terminateBits(e,t){const n=8*e;if(t.getSize()>n)throw new bn("data bits cannot fit in the QR Code"+t.getSize()+" > "+n);for(let e=0;e<4&&t.getSize()<n;++e)t.appendBit(!1);const r=7&t.getSize();if(r>0)for(let e=r;e<8;e++)t.appendBit(!1);const i=e-t.getSizeInBytes();for(let e=0;e<i;++e)t.appendBits(1&e?17:236,8);if(t.getSize()!==n)throw new bn("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(e,t,n,r,i,o){if(r>=n)throw new bn("Block ID too large");const s=e%n,a=n-s,l=Math.floor(e/n),c=l+1,d=Math.floor(t/n),u=d+1,f=l-d,h=c-u;if(f!==h)throw new bn("EC bytes mismatch");if(n!==a+s)throw new bn("RS blocks mismatch");if(e!==(d+f)*a+(u+h)*s)throw new bn("Total bytes mismatch");r<a?(i[0]=d,o[0]=f):(i[0]=u,o[0]=h)}static interleaveWithECBytes(e,t,n,r){if(e.getSizeInBytes()!==n)throw new bn("Number of bits and data bytes does not match");let i=0,o=0,s=0;const a=new Array;for(let l=0;l<r;++l){const c=new Int32Array(1),d=new Int32Array(1);Tn.getNumDataBytesAndNumECBytesForBlockID(t,n,r,l,c,d);const u=c[0],f=new Uint8Array(u);e.toBytes(8*i,f,0,u);const h=Tn.generateECBytes(f,d[0]);a.push(new Nn(f,h)),o=Math.max(o,u),s=Math.max(s,h.length),i+=c[0]}if(n!==i)throw new bn("Data bytes does not match offset");const l=new v;for(let e=0;e<o;++e)for(const t of a){const n=t.getDataBytes();e<n.length&&l.appendBits(n[e],8)}for(let e=0;e<s;++e)for(const t of a){const n=t.getErrorCorrectionBytes();e<n.length&&l.appendBits(n[e],8)}if(t!==l.getSizeInBytes())throw new bn("Interleaving error: "+t+" and "+l.getSizeInBytes()+" differ.");return l}static generateECBytes(e,t){const n=e.length,r=new Int32Array(n+t);for(let t=0;t<n;t++)r[t]=255&e[t];new _n(J.QR_CODE_FIELD_256).encode(r,t);const i=new Uint8Array(t);for(let e=0;e<t;e++)i[e]=r[n+e];return i}static appendModeInfo(e,t){t.appendBits(e.getBits(),4)}static appendLengthInfo(e,t,n,r){const i=n.getCharacterCountBits(t);if(e>=1<<i)throw new bn(e+" is bigger than "+((1<<i)-1));r.appendBits(e,i)}static appendBytes(e,t,n,r){switch(t){case Nt.NUMERIC:Tn.appendNumericBytes(e,n);break;case Nt.ALPHANUMERIC:Tn.appendAlphanumericBytes(e,n);break;case Nt.BYTE:Tn.append8BitBytes(e,n,r);break;case Nt.KANJI:Tn.appendKanjiBytes(e,n);break;default:throw new bn("Invalid mode: "+t)}}static getDigit(e){return e.charCodeAt(0)-48}static isDigit(e){const t=Tn.getDigit(e);return t>=0&&t<=9}static appendNumericBytes(e,t){const n=e.length;let r=0;for(;r<n;){const i=Tn.getDigit(e.charAt(r));if(r+2<n){const n=Tn.getDigit(e.charAt(r+1)),o=Tn.getDigit(e.charAt(r+2));t.appendBits(100*i+10*n+o,10),r+=3}else if(r+1<n){const n=Tn.getDigit(e.charAt(r+1));t.appendBits(10*i+n,7),r+=2}else t.appendBits(i,4),r++}}static appendAlphanumericBytes(e,t){const n=e.length;let r=0;for(;r<n;){const i=Tn.getAlphanumericCode(e.charCodeAt(r));if(-1===i)throw new bn;if(r+1<n){const n=Tn.getAlphanumericCode(e.charCodeAt(r+1));if(-1===n)throw new bn;t.appendBits(45*i+n,11),r+=2}else t.appendBits(i,6),r++}}static append8BitBytes(e,t,n){let r;try{r=A.encode(e,n)}catch(e){throw new bn(e)}for(let e=0,n=r.length;e!==n;e++){const n=r[e];t.appendBits(n,8)}}static appendKanjiBytes(e,t){let n;try{n=A.encode(e,C.SJIS)}catch(e){throw new bn(e)}const r=n.length;for(let e=0;e<r;e+=2){const r=(255&n[e])<<8&4294967295|255&n[e+1];let i=-1;if(r>=33088&&r<=40956?i=r-33088:r>=57408&&r<=60351&&(i=r-49472),-1===i)throw new bn("Invalid byte sequence");const o=192*(i>>8)+(255&i);t.appendBits(o,13)}}static appendECI(e,t){t.appendBits(Nt.ECI.getBits(),4),t.appendBits(e.getValue(),8)}}Tn.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]),Tn.DEFAULT_BYTE_MODE_ENCODING=C.UTF8.getName();class Rn{write(e,t,n,r=null){if(0===e.length)throw new d("Found empty contents");if(t<0||n<0)throw new d("Requested dimensions are too small: "+t+"x"+n);let i=$t.L,o=Rn.QUIET_ZONE_SIZE;null!==r&&(void 0!==r.get(In.ERROR_CORRECTION)&&(i=$t.fromString(r.get(In.ERROR_CORRECTION).toString())),void 0!==r.get(In.MARGIN)&&(o=Number.parseInt(r.get(In.MARGIN).toString(),10)));const s=Tn.encode(e,i,r);return this.renderResult(s,t,n,o)}writeToDom(e,t,n,r,i=null){"string"==typeof e&&(e=document.querySelector(e));const o=this.write(t,n,r,i);e&&e.appendChild(o)}renderResult(e,t,n,r){const i=e.getMatrix();if(null===i)throw new te;const o=i.getWidth(),s=i.getHeight(),a=o+2*r,l=s+2*r,c=Math.max(t,a),d=Math.max(n,l),u=Math.min(Math.floor(c/a),Math.floor(d/l)),f=Math.floor((c-o*u)/2),h=Math.floor((d-s*u)/2),m=this.createSVGElement(c,d);for(let e=0,t=h;e<s;e++,t+=u)for(let n=0,r=f;n<o;n++,r+=u)if(1===i.get(n,e)){const e=this.createSvgRectElement(r,t,u,u);m.appendChild(e)}return m}createSVGElement(e,t){const n=document.createElementNS(Rn.SVG_NS,"svg");return n.setAttributeNS(null,"height",e.toString()),n.setAttributeNS(null,"width",t.toString()),n}createSvgRectElement(e,t,n,r){const i=document.createElementNS(Rn.SVG_NS,"rect");return i.setAttributeNS(null,"x",e.toString()),i.setAttributeNS(null,"y",t.toString()),i.setAttributeNS(null,"height",n.toString()),i.setAttributeNS(null,"width",r.toString()),i.setAttributeNS(null,"fill","#000000"),i}}Rn.QUIET_ZONE_SIZE=4,Rn.SVG_NS="http://www.w3.org/2000/svg";class Dn{encode(e,t,n,r,i){if(0===e.length)throw new d("Found empty contents");if(t!==U.QR_CODE)throw new d("Can only encode QR_CODE, but got "+t);if(n<0||r<0)throw new d(`Requested dimensions are too small: ${n}x${r}`);let o=$t.L,s=Dn.QUIET_ZONE_SIZE;null!==i&&(void 0!==i.get(In.ERROR_CORRECTION)&&(o=$t.fromString(i.get(In.ERROR_CORRECTION).toString())),void 0!==i.get(In.MARGIN)&&(s=Number.parseInt(i.get(In.MARGIN).toString(),10)));const a=Tn.encode(e,o,i);return Dn.renderResult(a,n,r,s)}static renderResult(e,t,n,r){const i=e.getMatrix();if(null===i)throw new te;const o=i.getWidth(),s=i.getHeight(),a=o+2*r,l=s+2*r,c=Math.max(t,a),d=Math.max(n,l),u=Math.min(Math.floor(c/a),Math.floor(d/l)),f=Math.floor((c-o*u)/2),h=Math.floor((d-s*u)/2),m=new N(c,d);for(let e=0,t=h;e<s;e++,t+=u)for(let n=0,r=f;n<o;n++,r+=u)1===i.get(n,e)&&m.setRegion(r,t,u,u);return m}}Dn.QUIET_ZONE_SIZE=4;class xn{encode(e,t,n,r,i){let o;if(t!==U.QR_CODE)throw new d("No encoder available for format "+t);return o=new Dn,o.encode(e,t,n,r,i)}}class kn extends x{constructor(e,t,n,r,i,o,s,a){if(super(o,s),this.yuvData=e,this.dataWidth=t,this.dataHeight=n,this.left=r,this.top=i,r+o>t||i+s>n)throw new d("Crop rectangle does not fit within image data.");a&&this.reverseHorizontal(o,s)}getRow(e,t){if(e<0||e>=this.getHeight())throw new d("Requested row is outside the image: "+e);const n=this.getWidth();(null==t||t.length<n)&&(t=new Uint8ClampedArray(n));const r=(e+this.top)*this.dataWidth+this.left;return m.arraycopy(this.yuvData,r,t,0,n),t}getMatrix(){const e=this.getWidth(),t=this.getHeight();if(e===this.dataWidth&&t===this.dataHeight)return this.yuvData;const n=e*t,r=new Uint8ClampedArray(n);let i=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return m.arraycopy(this.yuvData,i,r,0,n),r;for(let n=0;n<t;n++){const t=n*e;m.arraycopy(this.yuvData,i,r,t,e),i+=this.dataWidth}return r}isCropSupported(){return!0}crop(e,t,n,r){return new kn(this.yuvData,this.dataWidth,this.dataHeight,this.left+e,this.top+t,n,r,!1)}renderThumbnail(){const e=this.getWidth()/kn.THUMBNAIL_SCALE_FACTOR,t=this.getHeight()/kn.THUMBNAIL_SCALE_FACTOR,n=new Int32Array(e*t),r=this.yuvData;let i=this.top*this.dataWidth+this.left;for(let o=0;o<t;o++){const t=o*e;for(let o=0;o<e;o++){const e=255&r[i+o*kn.THUMBNAIL_SCALE_FACTOR];n[t+o]=4278190080|65793*e}i+=this.dataWidth*kn.THUMBNAIL_SCALE_FACTOR}return n}getThumbnailWidth(){return this.getWidth()/kn.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/kn.THUMBNAIL_SCALE_FACTOR}reverseHorizontal(e,t){const n=this.yuvData;for(let r=0,i=this.top*this.dataWidth+this.left;r<t;r++,i+=this.dataWidth){const t=i+e/2;for(let r=i,o=i+e-1;r<t;r++,o--){const e=n[r];n[r]=n[o],n[o]=e}}}invert(){return new k(this)}}kn.THUMBNAIL_SCALE_FACTOR=2;class On extends x{constructor(e,t,n,r,i,o,s){if(super(t,n),this.dataWidth=r,this.dataHeight=i,this.left=o,this.top=s,4===e.BYTES_PER_ELEMENT){const r=t*n,i=new Uint8ClampedArray(r);for(let t=0;t<r;t++){const n=e[t],r=n>>16&255,o=n>>7&510,s=255&n;i[t]=(r+o+s)/4&255}this.luminances=i}else this.luminances=e;if(void 0===r&&(this.dataWidth=t),void 0===i&&(this.dataHeight=n),void 0===o&&(this.left=0),void 0===s&&(this.top=0),this.left+t>this.dataWidth||this.top+n>this.dataHeight)throw new d("Crop rectangle does not fit within image data.")}getRow(e,t){if(e<0||e>=this.getHeight())throw new d("Requested row is outside the image: "+e);const n=this.getWidth();(null==t||t.length<n)&&(t=new Uint8ClampedArray(n));const r=(e+this.top)*this.dataWidth+this.left;return m.arraycopy(this.luminances,r,t,0,n),t}getMatrix(){const e=this.getWidth(),t=this.getHeight();if(e===this.dataWidth&&t===this.dataHeight)return this.luminances;const n=e*t,r=new Uint8ClampedArray(n);let i=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return m.arraycopy(this.luminances,i,r,0,n),r;for(let n=0;n<t;n++){const t=n*e;m.arraycopy(this.luminances,i,r,t,e),i+=this.dataWidth}return r}isCropSupported(){return!0}crop(e,t,n,r){return new On(this.luminances,n,r,this.dataWidth,this.dataHeight,this.left+e,this.top+t)}invert(){return new k(this)}}class Mn extends C{static forName(e){return this.getCharacterSetECIByName(e)}}class Pn{}Pn.ISO_8859_1=C.ISO8859_1;class Bn{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 Ln{static singletonList(e){return[e]}static min(e,t){return e.sort(t)[0]}}class Fn{constructor(e){this.previous=e}getPrevious(){return this.previous}}class Vn extends Fn{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 Vn(this,e,t)}addBinaryShift(e,t){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new Vn(this,e,t)}toString(){let e=this.value&(1<<this.bitCount)-1;return e|=1<<this.bitCount,"<"+y.toBinaryString(e|1<<this.bitCount).substring(1)+">"}}class Un extends Vn{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++)(0===n||31===n&&this.binaryShiftByteCount<=62)&&(e.appendBits(31,5),this.binaryShiftByteCount>62?e.appendBits(this.binaryShiftByteCount-31,16):0===n?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 Un(this,e,t)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function Wn(e,t,n){return new Un(e,t,n)}function zn(e,t,n){return new Vn(e,t,n)}const Hn=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],jn=0,qn=1,Gn=2,Xn=3,Yn=4,Zn=new Vn(null,0,0),Kn=[Int32Array.from([0,327708,327710,327709,656318]),Int32Array.from([590318,0,327710,327709,656318]),Int32Array.from([262158,590300,0,590301,932798]),Int32Array.from([327709,327708,656318,0,327710]),Int32Array.from([327711,656380,656382,656381,0])];function Qn(e){for(let t of e)w.fill(t,-1);return e[jn][Yn]=0,e[qn][Yn]=0,e[qn][jn]=28,e[Xn][Yn]=0,e[Gn][Yn]=0,e[Gn][jn]=15,e}const Jn=Qn(w.createInt32Array(6,6));class er{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 t=Kn[this.mode][e];r=zn(r,65535&t,t>>16),n+=t>>16}let i=e===Gn?4:5;return r=zn(r,t,i),new er(r,e,0,n+i)}shiftAndAppend(e,t){let n=this.token,r=this.mode===Gn?4:5;return n=zn(n,Jn[this.mode][e],r),n=zn(n,t,5),new er(n,this.mode,0,this.bitCount+r+5)}addBinaryShiftChar(e){let t=this.token,n=this.mode,r=this.bitCount;if(this.mode===Yn||this.mode===Gn){let e=Kn[n][jn];t=zn(t,65535&e,e>>16),r+=e>>16,n=jn}let i=0===this.binaryShiftByteCount||31===this.binaryShiftByteCount?18:62===this.binaryShiftByteCount?9:8,o=new er(t,n,this.binaryShiftByteCount+1,r+i);return 2078===o.binaryShiftByteCount&&(o=o.endBinaryShift(e+1)),o}endBinaryShift(e){if(0===this.binaryShiftByteCount)return this;let t=this.token;return t=Wn(t,e-this.binaryShiftByteCount,this.binaryShiftByteCount),new er(t,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(e){let t=this.bitCount+(Kn[this.mode][e.mode]>>16);return this.binaryShiftByteCount<e.binaryShiftByteCount?t+=er.calculateBinaryShiftCost(e)-er.calculateBinaryShiftCost(this):this.binaryShiftByteCount>e.binaryShiftByteCount&&e.binaryShiftByteCount>0&&(t+=10),t<=e.bitCount}toBitArray(e){let t=[];for(let n=this.endBinaryShift(e.length).token;null!==n;n=n.getPrevious())t.unshift(n);let n=new v;for(const r of t)r.appendTo(n,e);return n}toString(){return b.format("%s bits=%d bytes=%d",Hn[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(e){return e.binaryShiftByteCount>62?21:e.binaryShiftByteCount>31?20:e.binaryShiftByteCount>0?10:0}}function tr(e){const t=b.getCharCode(" "),n=b.getCharCode("."),r=b.getCharCode(",");e[jn][t]=1;const i=b.getCharCode("Z"),o=b.getCharCode("A");for(let t=o;t<=i;t++)e[jn][t]=t-o+2;e[qn][t]=1;const s=b.getCharCode("z"),a=b.getCharCode("a");for(let t=a;t<=s;t++)e[qn][t]=t-a+2;e[Gn][t]=1;const l=b.getCharCode("9"),c=b.getCharCode("0");for(let t=c;t<=l;t++)e[Gn][t]=t-c+2;e[Gn][r]=12,e[Gn][n]=13;const d=["\0"," ","","","","","","","","\b","\t","\n","\v","\f","\r","","","","","","@","\\","^","_","`","|","~",""];for(let t=0;t<d.length;t++)e[Xn][b.getCharCode(d[t])]=t;const u=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let t=0;t<u.length;t++)b.getCharCode(u[t])>0&&(e[Yn][b.getCharCode(u[t])]=t);return e}er.INITIAL_STATE=new er(Zn,jn,0,0);const nr=tr(w.createInt32Array(5,256));class rr{constructor(e){this.text=e}encode(){const e=b.getCharCode(" "),t=b.getCharCode("\n");let n=Ln.singletonList(er.INITIAL_STATE);for(let r=0;r<this.text.length;r++){let i,o=r+1<this.text.length?this.text[r+1]:0;switch(this.text[r]){case b.getCharCode("\r"):i=o===t?2:0;break;case b.getCharCode("."):i=o===e?3:0;break;case b.getCharCode(","):i=o===e?4:0;break;case b.getCharCode(":"):i=o===e?5:0;break;default:i=0}i>0?(n=rr.updateStateListForPair(n,r,i),r++):n=this.updateStateListForChar(n,r)}return Ln.min(n,(e,t)=>e.getBitCount()-t.getBitCount()).toBitArray(this.text)}updateStateListForChar(e,t){const n=[];for(let r of e)this.updateStateForChar(r,t,n);return rr.simplifyStates(n)}updateStateForChar(e,t,n){let r=255&this.text[t],i=nr[e.getMode()][r]>0,o=null;for(let s=0;s<=Yn;s++){let a=nr[s][r];if(a>0){if(null==o&&(o=e.endBinaryShift(t)),!i||s===e.getMode()||s===Gn){const e=o.latchAndAppend(s,a);n.push(e)}if(!i&&Jn[e.getMode()][s]>=0){const e=o.shiftAndAppend(s,a);n.push(e)}}}if(e.getBinaryShiftByteCount()>0||0===nr[e.getMode()][r]){let r=e.addBinaryShiftChar(t);n.push(r)}}static updateStateListForPair(e,t,n){const r=[];for(let i of e)this.updateStateForPair(i,t,n,r);return this.simplifyStates(r)}static updateStateForPair(e,t,n,r){let i=e.endBinaryShift(t);if(r.push(i.latchAndAppend(Yn,n)),e.getMode()!==Yn&&r.push(i.shiftAndAppend(Yn,n)),3===n||4===n){let e=i.latchAndAppend(Gn,16-n).latchAndAppend(Gn,1);r.push(e)}if(e.getBinaryShiftByteCount()>0){let n=e.addBinaryShiftChar(t).addBinaryShiftChar(t+1);r.push(n)}}static simplifyStates(e){let t=[];for(const n of e){let e=!0;for(const r of t){if(r.isBetterThanOrEqualTo(n)){e=!1;break}n.isBetterThanOrEqualTo(r)&&(t=t.filter(e=>e!==r))}e&&t.push(n)}return t}}class ir{constructor(){}static encodeBytes(e){return ir.encode(e,ir.DEFAULT_EC_PERCENT,ir.DEFAULT_AZTEC_LAYERS)}static encode(e,t,n){let r,i,o,s,a,l=new rr(e).encode(),c=y.truncDivision(l.getSize()*t,100)+11,u=l.getSize()+c;if(n!==ir.DEFAULT_AZTEC_LAYERS){if(r=n<0,i=Math.abs(n),i>(r?ir.MAX_NB_BITS_COMPACT:ir.MAX_NB_BITS))throw new d(b.format("Illegal value %s for layers",n));o=ir.totalBitsInLayer(i,r),s=ir.WORD_SIZE[i];let e=o-o%s;if(a=ir.stuffBits(l,s),a.getSize()+c>e)throw new d("Data to large for user specified layer");if(r&&a.getSize()>64*s)throw new d("Data to large for user specified layer")}else{s=0,a=null;for(let e=0;;e++){if(e>ir.MAX_NB_BITS)throw new d("Data too large for an Aztec code");if(r=e<=3,i=r?e+1:e,o=ir.totalBitsInLayer(i,r),u>o)continue;null!=a&&s===ir.WORD_SIZE[i]||(s=ir.WORD_SIZE[i],a=ir.stuffBits(l,s));let t=o-o%s;if(!(r&&a.getSize()>64*s)&&a.getSize()+c<=t)break}}let f,h=ir.generateCheckWords(a,o,s),m=a.getSize()/s,p=ir.generateModeMessage(r,i,m),g=(r?11:14)+4*i,w=new Int32Array(g);if(r){f=g;for(let e=0;e<w.length;e++)w[e]=e}else{f=g+1+2*y.truncDivision(y.truncDivision(g,2)-1,15);let e=y.truncDivision(g,2),t=y.truncDivision(f,2);for(let n=0;n<e;n++){let r=n+y.truncDivision(n,15);w[e-n-1]=t-r-1,w[e+n]=t+r+1}}let v=new N(f);for(let e=0,t=0;e<i;e++){let n=4*(i-e)+(r?9:12);for(let r=0;r<n;r++){let i=2*r;for(let o=0;o<2;o++)h.get(t+i+o)&&v.set(w[2*e+o],w[2*e+r]),h.get(t+2*n+i+o)&&v.set(w[2*e+r],w[g-1-2*e-o]),h.get(t+4*n+i+o)&&v.set(w[g-1-2*e-o],w[g-1-2*e-r]),h.get(t+6*n+i+o)&&v.set(w[g-1-2*e-r],w[2*e+o])}t+=8*n}if(ir.drawModeMessage(v,r,f,p),r)ir.drawBullsEye(v,y.truncDivision(f,2),5);else{ir.drawBullsEye(v,y.truncDivision(f,2),7);for(let e=0,t=0;e<y.truncDivision(g,2)-1;e+=15,t+=16)for(let e=1&y.truncDivision(f,2);e<f;e+=2)v.set(y.truncDivision(f,2)-t,e),v.set(y.truncDivision(f,2)+t,e),v.set(e,y.truncDivision(f,2)-t),v.set(e,y.truncDivision(f,2)+t)}let $=new Bn;return $.setCompact(r),$.setSize(f),$.setLayers(i),$.setCodeWords(m),$.setMatrix(v),$}static drawBullsEye(e,t,n){for(let r=0;r<n;r+=2)for(let n=t-r;n<=t+r;n++)e.set(n,t-r),e.set(n,t+r),e.set(t-r,n),e.set(t+r,n);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 v;return e?(r.appendBits(t-1,2),r.appendBits(n-1,6),r=ir.generateCheckWords(r,28,4)):(r.appendBits(t-1,5),r.appendBits(n-1,11),r=ir.generateCheckWords(r,40,4)),r}static drawModeMessage(e,t,n,r){let i=y.truncDivision(n,2);if(t)for(let t=0;t<7;t++){let n=i-3+t;r.get(t)&&e.set(n,i-5),r.get(t+7)&&e.set(i+5,n),r.get(20-t)&&e.set(n,i+5),r.get(27-t)&&e.set(i-5,n)}else for(let t=0;t<10;t++){let n=i-5+t+y.truncDivision(t,5);r.get(t)&&e.set(n,i-7),r.get(t+10)&&e.set(i+7,n),r.get(29-t)&&e.set(n,i+7),r.get(39-t)&&e.set(i-7,n)}}static generateCheckWords(e,t,n){let r=e.getSize()/n,i=new _n(ir.getGF(n)),o=y.truncDivision(t,n),s=ir.bitsToWords(e,n,o);i.encode(s,o-r);let a=t%n,l=new v;l.appendBits(0,a);for(const e of Array.from(s))l.appendBits(e,n);return l}static bitsToWords(e,t,n){let r,i,o=new Int32Array(n);for(r=0,i=e.getSize()/t;r<i;r++){let n=0;for(let i=0;i<t;i++)n|=e.get(r*t+i)?1<<t-i-1:0;o[r]=n}return o}static getGF(e){switch(e){case 4:return J.AZTEC_PARAM;case 6:return J.AZTEC_DATA_6;case 8:return J.AZTEC_DATA_8;case 10:return J.AZTEC_DATA_10;case 12:return J.AZTEC_DATA_12;default:throw new d("Unsupported word size "+e)}}static stuffBits(e,t){let n=new v,r=e.getSize(),i=(1<<t)-2;for(let o=0;o<r;o+=t){let s=0;for(let n=0;n<t;n++)(o+n>=r||e.get(o+n))&&(s|=1<<t-1-n);(s&i)===i?(n.appendBits(s&i,t),o--):0===(s&i)?(n.appendBits(1|s,t),o--):n.appendBits(s,t)}return n}static totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}ir.DEFAULT_EC_PERCENT=33,ir.DEFAULT_AZTEC_LAYERS=0,ir.MAX_NB_BITS=32,ir.MAX_NB_BITS_COMPACT=4,ir.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 or{encode(e,t,n,r){return this.encodeWithHints(e,t,n,r,null)}encodeWithHints(e,t,n,r,i){let o=Pn.ISO_8859_1,s=ir.DEFAULT_EC_PERCENT,a=ir.DEFAULT_AZTEC_LAYERS;return null!=i&&(i.has(In.CHARACTER_SET)&&(o=Mn.forName(i.get(In.CHARACTER_SET).toString())),i.has(In.ERROR_CORRECTION)&&(s=y.parseInt(i.get(In.ERROR_CORRECTION).toString())),i.has(In.AZTEC_LAYERS)&&(a=y.parseInt(i.get(In.AZTEC_LAYERS).toString()))),or.encodeLayers(e,t,n,r,o,s,a)}static encodeLayers(e,t,n,r,i,o,s){if(t!==U.AZTEC)throw new d("Can only encode AZTEC, but got "+t);let a=ir.encode(b.getBytes(e,i),o,s);return or.renderResult(a,n,r)}static renderResult(e,t,n){let r=e.getMatrix();if(null==r)throw new te;let i=r.getWidth(),o=r.getHeight(),s=Math.max(t,i),a=Math.max(n,o),l=Math.min(s/i,a/o),c=(s-i*l)/2,d=(a-o*l)/2,u=new N(s,a);for(let e=0,t=d;e<o;e++,t+=l)for(let n=0,o=c;n<i;n++,o+=l)r.get(n,e)&&u.setRegion(o,t,l,l);return u}}e.AbstractExpandedDecoder=He,e.ArgumentException=c,e.ArithmeticException=Q,e.AztecCode=Bn,e.AztecCodeReader=ge,e.AztecCodeWriter=or,e.AztecDecoder=re,e.AztecDetector=pe,e.AztecDetectorResult=le,e.AztecEncoder=ir,e.AztecHighLevelEncoder=rr,e.AztecPoint=me,e.BarcodeFormat=U,e.Binarizer=h,e.BinaryBitmap=u,e.BitArray=v,e.BitMatrix=N,e.BitSource=mt,e.BrowserAztecCodeReader=we,e.BrowserBarcodeReader=lt,e.BrowserCodeReader=L,e.BrowserDatamatrixCodeReader=vt,e.BrowserMultiFormatReader=wn,e.BrowserPDF417Reader=yn,e.BrowserQRCodeReader=vn,e.BrowserQRCodeSvgWriter=Rn,e.CharacterSetECI=C,e.ChecksumException=f,e.Code128Reader=ve,e.Code39Reader=$e,e.DataMatrixDecodedBitStreamParser=pt,e.DataMatrixReader=yt,e.DecodeHintType=I,e.DecoderResult=Y,e.DefaultGridSampler=fe,e.DetectorResult=ae,e.EAN13Reader=Se,e.EncodeHintType=In,e.Exception=l,e.FormatException=_,e.GenericGF=J,e.GenericGFPoly=K,e.GlobalHistogramBinarizer=R,e.GridSampler=de,e.GridSamplerInstance=he,e.HTMLCanvasElementLuminanceSource=O,e.HybridBinarizer=D,e.ITFReader=Ie,e.IllegalArgumentException=d,e.IllegalStateException=te,e.InvertedLuminanceSource=k,e.LuminanceSource=x,e.MathUtils=ie,e.MultiFormatOneDReader=at,e.MultiFormatReader=gn,e.MultiFormatWriter=xn,e.NotFoundException=T,e.OneDReader=ye,e.PDF417DecodedBitStreamParser=fn,e.PDF417DecoderErrorCorrection=jt,e.PDF417Reader=mn,e.PDF417ResultMetadata=tn,e.PerspectiveTransform=ue,e.PlanarYUVLuminanceSource=kn,e.QRCodeByteMatrix=En,e.QRCodeDataMask=At,e.QRCodeDecodedBitStreamParser=Tt,e.QRCodeDecoderErrorCorrectionLevel=$t,e.QRCodeDecoderFormatInformation=It,e.QRCodeEncoder=Tn,e.QRCodeEncoderQRCode=An,e.QRCodeMaskUtil=Cn,e.QRCodeMatrixUtil=Sn,e.QRCodeMode=Nt,e.QRCodeReader=Lt,e.QRCodeVersion=Et,e.QRCodeWriter=Dn,e.RGBLuminanceSource=On,e.RSS14Reader=st,e.RSSExpandedReader=it,e.ReaderException=pn,e.ReedSolomonDecoder=ne,e.ReedSolomonEncoder=_n,e.ReedSolomonException=ee,e.Result=F,e.ResultMetadataType=X,e.ResultPoint=se,e.StringUtils=b,e.UnsupportedOperationException=E,e.VideoInputDevice=M,e.WhiteRectangleDetector=ce,e.WriterException=bn,e.ZXingArrays=w,e.ZXingCharset=Mn,e.ZXingInteger=y,e.ZXingStandardCharsets=Pn,e.ZXingStringBuilder=S,e.ZXingStringEncoding=A,e.ZXingSystem=m,e.createAbstractExpandedDecoder=tt,Object.defineProperty(e,"__esModule",{value:!0})}(t)}),hf=h({__proto__:null,default:lf(ff)},[ff]),mf=function(){function e(e,t,n){if(this.formatMap=new Map([[qu.QR_CODE,ff.BarcodeFormat.QR_CODE],[qu.AZTEC,ff.BarcodeFormat.AZTEC],[qu.CODABAR,ff.BarcodeFormat.CODABAR],[qu.CODE_39,ff.BarcodeFormat.CODE_39],[qu.CODE_93,ff.BarcodeFormat.CODE_93],[qu.CODE_128,ff.BarcodeFormat.CODE_128],[qu.DATA_MATRIX,ff.BarcodeFormat.DATA_MATRIX],[qu.MAXICODE,ff.BarcodeFormat.MAXICODE],[qu.ITF,ff.BarcodeFormat.ITF],[qu.EAN_13,ff.BarcodeFormat.EAN_13],[qu.EAN_8,ff.BarcodeFormat.EAN_8],[qu.PDF_417,ff.BarcodeFormat.PDF_417],[qu.RSS_14,ff.BarcodeFormat.RSS_14],[qu.RSS_EXPANDED,ff.BarcodeFormat.RSS_EXPANDED],[qu.UPC_A,ff.BarcodeFormat.UPC_A],[qu.UPC_E,ff.BarcodeFormat.UPC_E],[qu.UPC_EAN_EXTENSION,ff.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!hf)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=t,this.logger=n;var r=this.createZXingFormats(e),i=new Map;i.set(ff.DecodeHintType.POSSIBLE_FORMATS,r),i.set(ff.DecodeHintType.TRY_HARDER,!1),this.hints=i}return e.prototype.decodeAsync=function(e){var t=this;return new Promise(function(n,r){try{n(t.decode(e))}catch(e){r(e)}})},e.prototype.decode=function(e){var t=new ff.MultiFormatReader(this.verbose,this.hints),n=new ff.HTMLCanvasElementLuminanceSource(e),r=new ff.BinaryBitmap(new ff.HybridBinarizer(n)),i=t.decode(r);return{text:i.text,format:Ju.create(this.toHtml5QrcodeSupportedFormats(i.format)),debugData:this.createDebugData()}},e.prototype.createReverseFormatMap=function(){var e=new Map;return this.formatMap.forEach(function(t,n,r){e.set(t,n)}),e},e.prototype.toHtml5QrcodeSupportedFormats=function(e){if(!this.reverseFormatMap.has(e))throw"reverseFormatMap doesn't have ".concat(e);return this.reverseFormatMap.get(e)},e.prototype.createZXingFormats=function(e){for(var t=[],n=0,r=e;n<r.length;n++){var i=r[n];this.formatMap.has(i)?t.push(this.formatMap.get(i)):this.logger.logError("".concat(i," is not supported by")+"ZXingHtml5QrcodeShim")}return t},e.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},e}(),pf=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((r=r.apply(e,t||[])).next())})},gf=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}},wf=function(){function e(t,n,r){if(this.formatMap=new Map([[qu.QR_CODE,"qr_code"],[qu.AZTEC,"aztec"],[qu.CODABAR,"codabar"],[qu.CODE_39,"code_39"],[qu.CODE_93,"code_93"],[qu.CODE_128,"code_128"],[qu.DATA_MATRIX,"data_matrix"],[qu.ITF,"itf"],[qu.EAN_13,"ean_13"],[qu.EAN_8,"ean_8"],[qu.PDF_417,"pdf417"],[qu.UPC_A,"upc_a"],[qu.UPC_E,"upc_e"]]),this.reverseFormatMap=this.createReverseFormatMap(),!e.isSupported())throw"Use html5qrcode.min.js without edit, Use BarcodeDetectorDelegate only if it isSupported();";this.verbose=n,this.logger=r;var i=this.createBarcodeDetectorFormats(t);if(this.detector=new BarcodeDetector(i),!this.detector)throw"BarcodeDetector detector not supported"}return e.isSupported=function(){return"BarcodeDetector"in window&&void 0!==new BarcodeDetector({formats:["qr_code"]})},e.prototype.decodeAsync=function(e){return pf(this,void 0,void 0,function(){var t,n;return gf(this,function(r){switch(r.label){case 0:return[4,this.detector.detect(e)];case 1:if(!(t=r.sent())||0===t.length)throw"No barcode or QR code detected.";return[2,{text:(n=this.selectLargestBarcode(t)).rawValue,format:Ju.create(this.toHtml5QrcodeSupportedFormats(n.format)),debugData:this.createDebugData()}]}})})},e.prototype.selectLargestBarcode=function(e){for(var t=null,n=0,r=0,i=e;r<i.length;r++){var o=i[r],s=o.boundingBox.width*o.boundingBox.height;s>n&&(n=s,t=o)}if(!t)throw"No largest barcode found";return t},e.prototype.createBarcodeDetectorFormats=function(e){for(var t=[],n=0,r=e;n<r.length;n++){var i=r[n];this.formatMap.has(i)?t.push(this.formatMap.get(i)):this.logger.warn("".concat(i," is not supported by")+"BarcodeDetectorDelegate")}return{formats:t}},e.prototype.toHtml5QrcodeSupportedFormats=function(e){if(!this.reverseFormatMap.has(e))throw"reverseFormatMap doesn't have ".concat(e);return this.reverseFormatMap.get(e)},e.prototype.createReverseFormatMap=function(){var e=new Map;return this.formatMap.forEach(function(t,n,r){e.set(t,n)}),e},e.prototype.createDebugData=function(){return{decoderName:"BarcodeDetector"}},e}(),yf=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((r=r.apply(e,t||[])).next())})},vf=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}},$f=function(){function e(e,t,n,r){this.EXECUTIONS_TO_REPORT_PERFORMANCE=100,this.executions=0,this.executionResults=[],this.wasPrimaryDecoderUsedInLastDecode=!1,this.verbose=n,t&&wf.isSupported()?(this.primaryDecoder=new wf(e,n,r),this.secondaryDecoder=new mf(e,n,r)):this.primaryDecoder=new mf(e,n,r)}return e.prototype.decodeAsync=function(e){return yf(this,void 0,void 0,function(){var t;return vf(this,function(n){switch(n.label){case 0:t=performance.now(),n.label=1;case 1:return n.trys.push([1,,3,4]),[4,this.getDecoder().decodeAsync(e)];case 2:return[2,n.sent()];case 3:return this.possiblyLogPerformance(t),[7];case 4:return[2]}})})},e.prototype.decodeRobustlyAsync=function(e){return yf(this,void 0,void 0,function(){var t,n;return vf(this,function(r){switch(r.label){case 0:t=performance.now(),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,this.primaryDecoder.decodeAsync(e)];case 2:return[2,r.sent()];case 3:if(n=r.sent(),this.secondaryDecoder)return[2,this.secondaryDecoder.decodeAsync(e)];throw n;case 4:return this.possiblyLogPerformance(t),[7];case 5:return[2]}})})},e.prototype.getDecoder=function(){return this.secondaryDecoder?!1===this.wasPrimaryDecoderUsedInLastDecode?(this.wasPrimaryDecoderUsedInLastDecode=!0,this.primaryDecoder):(this.wasPrimaryDecoderUsedInLastDecode=!1,this.secondaryDecoder):this.primaryDecoder},e.prototype.possiblyLogPerformance=function(e){if(this.verbose){var t=performance.now()-e;this.executionResults.push(t),this.executions++,this.possiblyFlushPerformanceReport()}},e.prototype.possiblyFlushPerformanceReport=function(){if(!(this.executions<this.EXECUTIONS_TO_REPORT_PERFORMANCE)){for(var e=0,t=0,n=this.executionResults;t<n.length;t++){e+=n[t]}var r=e/this.executionResults.length;console.log("".concat(r," ms for ").concat(this.executionResults.length," last runs.")),this.executions=0,this.executionResults=[]}},e}(),If=(df=function(e,t){return df=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},df(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}df(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),_f=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((r=r.apply(e,t||[])).next())})},Cf=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}},Ef=function(){function e(e,t){this.name=e,this.track=t}return e.prototype.isSupported=function(){return!!this.track.getCapabilities&&this.name in this.track.getCapabilities()},e.prototype.apply=function(e){var t={};t[this.name]=e;var n={advanced:[t]};return this.track.applyConstraints(n)},e.prototype.value=function(){var e=this.track.getSettings();return this.name in e?e[this.name]:null},e}(),Af=function(e){function t(t){return e.call(this,"zoom",t)||this}return If(t,e),t}(function(e){function t(t,n){return e.call(this,t,n)||this}return If(t,e),t.prototype.min=function(){return this.getCapabilities().min},t.prototype.max=function(){return this.getCapabilities().max},t.prototype.step=function(){return this.getCapabilities().step},t.prototype.apply=function(e){var t={};t[this.name]=e;var n={advanced:[t]};return this.track.applyConstraints(n)},t.prototype.getCapabilities=function(){this.failIfNotSupported();var e=this.track.getCapabilities()[this.name];return{min:e.min,max:e.max,step:e.step}},t.prototype.failIfNotSupported=function(){if(!this.isSupported())throw new Error("".concat(this.name," capability not supported"))},t}(Ef)),bf=function(e){function t(t){return e.call(this,"torch",t)||this}return If(t,e),t}(Ef),Sf=function(){function e(e){this.track=e}return e.prototype.zoomFeature=function(){return new Af(this.track)},e.prototype.torchFeature=function(){return new bf(this.track)},e}(),Nf=function(){function e(e,t,n){this.isClosed=!1,this.parentElement=e,this.mediaStream=t,this.callbacks=n,this.surface=this.createVideoElement(this.parentElement.clientWidth),e.append(this.surface)}return e.prototype.createVideoElement=function(e){var t=document.createElement("video");return t.style.width="".concat(e,"px"),t.style.display="block",t.muted=!0,t.setAttribute("muted","true"),t.playsInline=!0,t},e.prototype.setupSurface=function(){var e=this;this.surface.onabort=function(){throw"RenderedCameraImpl video surface onabort() called"},this.surface.onerror=function(){throw"RenderedCameraImpl video surface onerror() called"};var t=function(){var n=e.surface.clientWidth,r=e.surface.clientHeight;e.callbacks.onRenderSurfaceReady(n,r),e.surface.removeEventListener("playing",t)};this.surface.addEventListener("playing",t),this.surface.srcObject=this.mediaStream,this.surface.play()},e.create=function(t,n,r,i){return _f(this,void 0,void 0,function(){var o,s;return Cf(this,function(a){switch(a.label){case 0:return o=new e(t,n,i),r.aspectRatio?(s={aspectRatio:r.aspectRatio},[4,o.getFirstTrackOrFail().applyConstraints(s)]):[3,2];case 1:a.sent(),a.label=2;case 2:return o.setupSurface(),[2,o]}})})},e.prototype.failIfClosed=function(){if(this.isClosed)throw"The RenderedCamera has already been closed."},e.prototype.getFirstTrackOrFail=function(){if(this.failIfClosed(),0===this.mediaStream.getVideoTracks().length)throw"No video tracks found";return this.mediaStream.getVideoTracks()[0]},e.prototype.pause=function(){this.failIfClosed(),this.surface.pause()},e.prototype.resume=function(e){this.failIfClosed();var t=this,n=function(){setTimeout(e,200),t.surface.removeEventListener("playing",n)};this.surface.addEventListener("playing",n),this.surface.play()},e.prototype.isPaused=function(){return this.failIfClosed(),this.surface.paused},e.prototype.getSurface=function(){return this.failIfClosed(),this.surface},e.prototype.getRunningTrackCapabilities=function(){return this.getFirstTrackOrFail().getCapabilities()},e.prototype.getRunningTrackSettings=function(){return this.getFirstTrackOrFail().getSettings()},e.prototype.applyVideoConstraints=function(e){return _f(this,void 0,void 0,function(){return Cf(this,function(t){if("aspectRatio"in e)throw"Changing 'aspectRatio' in run-time is not yet supported.";return[2,this.getFirstTrackOrFail().applyConstraints(e)]})})},e.prototype.close=function(){if(this.isClosed)return Promise.resolve();var e=this;return new Promise(function(t,n){var r=e.mediaStream.getVideoTracks().length,i=0;e.mediaStream.getVideoTracks().forEach(function(n){e.mediaStream.removeTrack(n),n.stop(),++i>=r&&(e.isClosed=!0,e.parentElement.removeChild(e.surface),t())})})},e.prototype.getCapabilities=function(){return new Sf(this.getFirstTrackOrFail())},e}(),Tf=function(){function e(e){this.mediaStream=e}return e.prototype.render=function(e,t,n){return _f(this,void 0,void 0,function(){return Cf(this,function(r){return[2,Nf.create(e,this.mediaStream,t,n)]})})},e.create=function(t){return _f(this,void 0,void 0,function(){var n;return Cf(this,function(r){switch(r.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return n={audio:!1,video:t},[4,navigator.mediaDevices.getUserMedia(n)];case 1:return[2,new e(r.sent())]}})})},e}(),Rf=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((r=r.apply(e,t||[])).next())})},Df=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}},xf=function(){function e(){}return e.failIfNotSupported=function(){return Rf(this,void 0,void 0,function(){return Df(this,function(t){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new e]})})},e.prototype.create=function(e){return Rf(this,void 0,void 0,function(){return Df(this,function(t){return[2,Tf.create(e)]})})},e}(),kf=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((r=r.apply(e,t||[])).next())})},Of=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}},Mf=function(){function e(){}return e.retrieve=function(){if(navigator.mediaDevices)return e.getCamerasFromMediaDevices();var t=MediaStreamTrack;return MediaStreamTrack&&t.getSources?e.getCamerasFromMediaStreamTrack():e.rejectWithError()},e.rejectWithError=function(){var t=of.unableToQuerySupportedDevices();return e.isHttpsOrLocalhost()||(t=of.insecureContextCameraQueryError()),Promise.reject(t)},e.isHttpsOrLocalhost=function(){if("https:"===location.protocol)return!0;var e=location.host.split(":")[0];return"127.0.0.1"===e||"localhost"===e},e.getCamerasFromMediaDevices=function(){return kf(this,void 0,void 0,function(){var e,t,n,r,i,o,s;return Of(this,function(a){switch(a.label){case 0:return e=function(e){for(var t=0,n=e.getVideoTracks();t<n.length;t++){var r=n[t];r.enabled=!1,r.stop(),e.removeTrack(r)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return t=a.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(n=a.sent(),r=[],i=0,o=n;i<o.length;i++)"videoinput"===(s=o[i]).kind&&r.push({id:s.deviceId,label:s.label});return e(t),[2,r]}})})},e.getCamerasFromMediaStreamTrack=function(){return new Promise(function(e,t){MediaStreamTrack.getSources(function(t){for(var n=[],r=0,i=t;r<i.length;r++){var o=i[r];"video"===o.kind&&n.push({id:o.id,label:o.label})}e(n)})})},e}();!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.NOT_STARTED=1]="NOT_STARTED",e[e.SCANNING=2]="SCANNING",e[e.PAUSED=3]="PAUSED"}(uf||(uf={}));var Pf,Bf=function(){function e(){this.state=uf.NOT_STARTED,this.onGoingTransactionNewState=uf.UNKNOWN}return e.prototype.directTransition=function(e){this.failIfTransitionOngoing(),this.validateTransition(e),this.state=e},e.prototype.startTransition=function(e){return this.failIfTransitionOngoing(),this.validateTransition(e),this.onGoingTransactionNewState=e,this},e.prototype.execute=function(){if(this.onGoingTransactionNewState===uf.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var e=this.onGoingTransactionNewState;this.onGoingTransactionNewState=uf.UNKNOWN,this.directTransition(e)},e.prototype.cancel=function(){if(this.onGoingTransactionNewState===uf.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=uf.UNKNOWN},e.prototype.getState=function(){return this.state},e.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==uf.UNKNOWN)throw"Cannot transition to a new state, already under transition"},e.prototype.validateTransition=function(e){switch(this.state){case uf.UNKNOWN:throw"Transition from unknown is not allowed";case uf.NOT_STARTED:this.failIfNewStateIs(e,[uf.PAUSED]);case uf.SCANNING:case uf.PAUSED:}},e.prototype.failIfNewStateIs=function(e,t){for(var n=0,r=t;n<r.length;n++){if(e===r[n])throw"Cannot transition from ".concat(this.state," to ").concat(e)}},e}(),Lf=function(){function e(e){this.stateManager=e}return e.prototype.startTransition=function(e){return this.stateManager.startTransition(e)},e.prototype.directTransition=function(e){this.stateManager.directTransition(e)},e.prototype.getState=function(){return this.stateManager.getState()},e.prototype.canScanFile=function(){return this.stateManager.getState()===uf.NOT_STARTED},e.prototype.isScanning=function(){return this.stateManager.getState()!==uf.NOT_STARTED},e.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===uf.SCANNING},e.prototype.isPaused=function(){return this.stateManager.getState()===uf.PAUSED},e}(),Ff=function(){function e(){}return e.create=function(){return new Lf(new Bf)},e}(),Vf=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Uf=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Vf(t,e),t.DEFAULT_WIDTH=300,t.DEFAULT_WIDTH_OFFSET=2,t.FILE_SCAN_MIN_HEIGHT=300,t.FILE_SCAN_HIDDEN_CANVAS_PADDING=100,t.MIN_QR_BOX_SIZE=50,t.SHADED_LEFT=1,t.SHADED_RIGHT=2,t.SHADED_TOP=3,t.SHADED_BOTTOM=4,t.SHADED_REGION_ELEMENT_ID="qr-shaded-region",t.VERBOSE=!1,t.BORDER_SHADER_DEFAULT_COLOR="#ffffff",t.BORDER_SHADER_MATCH_COLOR="rgb(90, 193, 56)",t}(Qu),Wf=function(){function e(e,t){this.logger=t,this.fps=Uf.SCAN_DEFAULT_FPS,e?(e.fps&&(this.fps=e.fps),this.disableFlip=!0===e.disableFlip,this.qrbox=e.qrbox,this.aspectRatio=e.aspectRatio,this.videoConstraints=e.videoConstraints):this.disableFlip=Uf.DEFAULT_DISABLE_FLIP}return e.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?sf.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},e.prototype.isShadedBoxEnabled=function(){return!rf(this.qrbox)},e.create=function(t,n){return new e(t,n)},e}(),zf=function(){function e(e,t){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(e))throw"HTML Element with id=".concat(e," not found");var n;this.elementId=e,this.verbose=!1,"boolean"==typeof t?this.verbose=!0===t:t&&(n=t,this.verbose=!0===n.verbose,n.experimentalFeatures),this.logger=new nf(this.verbose),this.qrcode=new $f(this.getSupportedFormats(t),this.getUseBarCodeDetectorIfSupported(n),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=Ff.create()}return e.prototype.start=function(e,t,n,r){var i,o=this;if(!e)throw"cameraIdOrConfig is required";if(!n||"function"!=typeof n)throw"qrCodeSuccessCallback is required and should be a function.";i=r||(this.verbose?this.logger.log:function(){});var s=Wf.create(t,this.logger);this.clearElement();var a=!1;s.videoConstraints&&(s.isMediaStreamConstraintsValid()?a=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var l=a,c=document.getElementById(this.elementId);c.clientWidth?c.clientWidth:Uf.DEFAULT_WIDTH,c.style.position="relative",this.shouldScan=!0,this.element=c;var d=this,u=this.stateManagerProxy.startTransition(uf.SCANNING);return new Promise(function(t,r){var a=l?s.videoConstraints:d.createVideoConstraints(e);if(!a)return u.cancel(),void r("videoConstraints should be defined");var c={};l&&!s.aspectRatio||(c.aspectRatio=s.aspectRatio);var f={onRenderSurfaceReady:function(e,t){d.setupUi(e,t,s),d.isScanning=!0,d.foreverScan(s,n,i)}};xf.failIfNotSupported().then(function(e){e.create(a).then(function(e){return e.render(o.element,c,f).then(function(e){d.renderedCamera=e,u.execute(),t(null)}).catch(function(e){u.cancel(),r(e)})}).catch(function(e){u.cancel(),r(of.errorGettingUserMedia(e))})}).catch(function(e){u.cancel(),r(of.cameraStreamingNotSupported())})})},e.prototype.pause=function(e){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(uf.PAUSED),this.showPausedState(),(rf(e)||!0!==e)&&(e=!1),e&&this.renderedCamera&&this.renderedCamera.pause()},e.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 e=this,t=function(){e.stateManagerProxy.directTransition(uf.SCANNING),e.hidePausedState()};this.renderedCamera.isPaused()?this.renderedCamera.resume(function(){t()}):t()},e.prototype.getState=function(){return this.stateManagerProxy.getState()},e.prototype.stop=function(){var e=this;if(!this.stateManagerProxy.isScanning())throw"Cannot stop, scanner is not running or paused.";var t=this.stateManagerProxy.startTransition(uf.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var n=this;return this.renderedCamera.close().then(function(){return n.renderedCamera=null,n.element&&(n.element.removeChild(n.canvasElement),n.canvasElement=null),function(){if(e.element){var t=document.getElementById(Uf.SHADED_REGION_ELEMENT_ID);t&&e.element.removeChild(t)}}(),n.qrRegion&&(n.qrRegion=null),n.context&&(n.context=null),t.execute(),n.hidePausedState(),n.isScanning=!1,Promise.resolve()})},e.prototype.scanFile=function(e,t){return this.scanFileV2(e,t).then(function(e){return e.decodedText})},e.prototype.scanFileV2=function(e,t){var n=this;if(!(e&&e instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(rf(t)&&(t=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(r,i){n.possiblyCloseLastScanImageFile(),n.clearElement(),n.lastScanImageFile=URL.createObjectURL(e);var o=new Image;o.onload=function(){var e=o.width,s=o.height,a=document.getElementById(n.elementId),l=a.clientWidth?a.clientWidth:Uf.DEFAULT_WIDTH,c=Math.max(a.clientHeight?a.clientHeight:s,Uf.FILE_SCAN_MIN_HEIGHT),d=n.computeCanvasDrawConfig(e,s,l,c);if(t){var u=n.createCanvasElement(l,c,"qr-canvas-visible");u.style.display="inline-block",a.appendChild(u);var f=u.getContext("2d");if(!f)throw"Unable to get 2d context from canvas";f.canvas.width=l,f.canvas.height=c,f.drawImage(o,0,0,e,s,d.x,d.y,d.width,d.height)}var h=Uf.FILE_SCAN_HIDDEN_CANVAS_PADDING,m=Math.max(o.width,d.width),p=Math.max(o.height,d.height),g=m+2*h,w=p+2*h,y=n.createCanvasElement(g,w);a.appendChild(y);var v=y.getContext("2d");if(!v)throw"Unable to get 2d context from canvas";v.canvas.width=g,v.canvas.height=w,v.drawImage(o,0,0,e,s,h,h,m,p);try{n.qrcode.decodeRobustlyAsync(y).then(function(e){r(ef.createFromQrcodeResult(e))}).catch(i)}catch(e){i("QR code parse error, error = ".concat(e))}},o.onerror=i,o.onabort=i,o.onstalled=i,o.onsuspend=i,o.src=URL.createObjectURL(e)})},e.prototype.clear=function(){this.clearElement()},e.getCameras=function(){return Mf.retrieve()},e.prototype.getRunningTrackCapabilities=function(){return this.getRenderedCameraOrFail().getRunningTrackCapabilities()},e.prototype.getRunningTrackSettings=function(){return this.getRenderedCameraOrFail().getRunningTrackSettings()},e.prototype.getRunningTrackCameraCapabilities=function(){return this.getRenderedCameraOrFail().getCapabilities()},e.prototype.applyVideoConstraints=function(e){if(!e)throw"videoConstaints is required argument.";if(!sf.isMediaStreamConstraintsValid(e,this.logger))throw"invalid videoConstaints passed, check logs for more details";return this.getRenderedCameraOrFail().applyVideoConstraints(e)},e.prototype.getRenderedCameraOrFail=function(){if(null==this.renderedCamera)throw"Scanning is not in running state, call this API only when QR code scanning using camera is in running state.";return this.renderedCamera},e.prototype.getSupportedFormats=function(e){var t=[qu.QR_CODE,qu.AZTEC,qu.CODABAR,qu.CODE_39,qu.CODE_93,qu.CODE_128,qu.DATA_MATRIX,qu.MAXICODE,qu.ITF,qu.EAN_13,qu.EAN_8,qu.PDF_417,qu.RSS_14,qu.RSS_EXPANDED,qu.UPC_A,qu.UPC_E,qu.UPC_EAN_EXTENSION];if(!e||"boolean"==typeof e)return t;if(!e.formatsToSupport)return t;if(!Array.isArray(e.formatsToSupport))throw"configOrVerbosityFlag.formatsToSupport should be undefined or an array.";if(0===e.formatsToSupport.length)throw"Atleast 1 formatsToSupport is needed.";for(var n=[],r=0,i=e.formatsToSupport;r<i.length;r++){var o=i[r];Zu(o)?n.push(o):this.logger.warn("Invalid format: ".concat(o," passed in config, ignoring."))}if(0===n.length)throw"None of formatsToSupport match supported values.";return n},e.prototype.getUseBarCodeDetectorIfSupported=function(e){if(rf(e))return!0;if(!rf(e.useBarCodeDetectorIfSupported))return!1!==e.useBarCodeDetectorIfSupported;if(rf(e.experimentalFeatures))return!0;var t=e.experimentalFeatures;return!!rf(t.useBarCodeDetectorIfSupported)||!1!==t.useBarCodeDetectorIfSupported},e.prototype.validateQrboxSize=function(e,t,n){var r=this,i=n.qrbox;this.validateQrboxConfig(i);var o,s=this.toQrdimensions(e,t,i),a=function(e){if(e<Uf.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(Uf.MIN_QR_BOX_SIZE,"px.")};a(s.width),a(s.height),s.width=((o=s.width)>e&&(r.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."),o=e),o)},e.prototype.validateQrboxConfig=function(e){if("number"!=typeof e&&"function"!=typeof e&&(void 0===e.width||void 0===e.height))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},e.prototype.toQrdimensions=function(e,t,n){if("number"==typeof n)return{width:n,height:n};if("function"==typeof n)try{return n(e,t)}catch(e){throw new Error("qrbox config was passed as a function but it failed with unknown error"+e)}return n},e.prototype.setupUi=function(e,t,n){n.isShadedBoxEnabled()&&this.validateQrboxSize(e,t,n);var r=rf(n.qrbox)?{width:e,height:t}:n.qrbox;this.validateQrboxConfig(r);var i=this.toQrdimensions(e,t,r);i.height>t&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var o=n.isShadedBoxEnabled()&&i.height<=t,s={x:0,y:0,width:e,height:t},a=o?this.getShadedRegionBounds(e,t,i):s,l=this.createCanvasElement(a.width,a.height),c=l.getContext("2d",{willReadFrequently:!0});c.canvas.width=a.width,c.canvas.height=a.height,this.element.append(l),o&&this.possiblyInsertShadingElement(this.element,e,t,i),this.createScannerPausedUiElement(this.element),this.qrRegion=a,this.context=c,this.canvasElement=l},e.prototype.createScannerPausedUiElement=function(e){var t=document.createElement("div");t.innerText=of.scannerPaused(),t.style.display="none",t.style.position="absolute",t.style.top="0px",t.style.zIndex="1",t.style.background="rgba(9, 9, 9, 0.46)",t.style.color="#FFECEC",t.style.textAlign="center",t.style.width="100%",e.appendChild(t),this.scannerPausedUiElement=t},e.prototype.scanContext=function(e,t){var n=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(t){return e(t.text,ef.createFromQrcodeResult(t)),n.possiblyUpdateShaders(!0),!0}).catch(function(e){n.possiblyUpdateShaders(!1);var r=of.codeParseError(e);return t(r,tf.createFrom(r)),!1})},e.prototype.foreverScan=function(e,t,n){var r=this;if(this.shouldScan&&this.renderedCamera){var i=this.renderedCamera.getSurface(),o=i.videoWidth/i.clientWidth,s=i.videoHeight/i.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var a=this.qrRegion.width*o,l=this.qrRegion.height*s,c=this.qrRegion.x*o,d=this.qrRegion.y*s;this.context.drawImage(i,c,d,a,l,0,0,this.qrRegion.width,this.qrRegion.height);var u=function(){r.foreverScanTimeout=setTimeout(function(){r.foreverScan(e,t,n)},r.getTimeoutFps(e.fps))};this.scanContext(t,n).then(function(i){i||!0===e.disableFlip?u():(r.context.translate(r.context.canvas.width,0),r.context.scale(-1,1),r.scanContext(t,n).finally(function(){u()}))}).catch(function(e){r.logger.logError("Error happend while scanning context",e),u()})}},e.prototype.createVideoConstraints=function(e){if("string"==typeof e)return{deviceId:{exact:e}};if("object"==typeof e){var t="facingMode",n="deviceId",r={user:!0,environment:!0},i="exact",o=function(e){if(e in r)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(e,"'")},s=Object.keys(e);if(1!==s.length)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(s.length," keys");var a=Object.keys(e)[0];if(a!==t&&a!==n)throw"Only '".concat(t,"' and '").concat(n,"' ")+" are supported for 'cameraIdOrConfig'";if(a!==t){var l=e.deviceId;if("string"==typeof l)return{deviceId:l};if("object"==typeof l){if(i in l)return{deviceId:{exact:l["".concat(i)]}};throw"'deviceId' should be string or object with"+" ".concat(i," as key.")}throw"Invalid type of 'deviceId' = ".concat(typeof l)}var c=e.facingMode;if("string"==typeof c){if(o(c))return{facingMode:c}}else{if("object"!=typeof c)throw"Invalid type of 'facingMode' = ".concat(typeof c);if(!(i in c))throw"'facingMode' should be string or object with"+" ".concat(i," as key.");if(o(c["".concat(i)]))return{facingMode:{exact:c["".concat(i)]}}}}throw"Invalid type of 'cameraIdOrConfig' = ".concat(typeof e)},e.prototype.computeCanvasDrawConfig=function(e,t,n,r){if(e<=n&&t<=r)return{x:(n-e)/2,y:(r-t)/2,width:e,height:t};var i=e,o=t;return e>n&&(t*=n/e,e=n),t>r&&(e*=r/t,t=r),this.logger.log("Image downsampled from "+"".concat(i,"X").concat(o)+" to ".concat(e,"X").concat(t,".")),this.computeCanvasDrawConfig(e,t,n,r)},e.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var e=document.getElementById(this.elementId);e&&(e.innerHTML="")},e.prototype.possiblyUpdateShaders=function(e){this.qrMatch!==e&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(t){t.style.backgroundColor=e?Uf.BORDER_SHADER_MATCH_COLOR:Uf.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=e)},e.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},e.prototype.createCanvasElement=function(e,t,n){var r=e,i=t,o=document.createElement("canvas");return o.style.width="".concat(r,"px"),o.style.height="".concat(i,"px"),o.style.display="none",o.id=rf(n)?"qr-canvas":n,o},e.prototype.getShadedRegionBounds=function(e,t,n){if(n.width>e||n.height>t)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(e-n.width)/2,y:(t-n.height)/2,width:n.width,height:n.height}},e.prototype.possiblyInsertShadingElement=function(e,t,n,r){if(!(t-r.width<1||n-r.height<1)){var i=document.createElement("div");i.style.position="absolute";var o=(t-r.width)/2,s=(n-r.height)/2;if(i.style.borderLeft="".concat(o,"px solid rgba(0, 0, 0, 0.48)"),i.style.borderRight="".concat(o,"px solid rgba(0, 0, 0, 0.48)"),i.style.borderTop="".concat(s,"px solid rgba(0, 0, 0, 0.48)"),i.style.borderBottom="".concat(s,"px solid rgba(0, 0, 0, 0.48)"),i.style.boxSizing="border-box",i.style.top="0px",i.style.bottom="0px",i.style.left="0px",i.style.right="0px",i.id="".concat(Uf.SHADED_REGION_ELEMENT_ID),t-r.width<11||n-r.height<11)this.hasBorderShaders=!1;else{var a=40;this.insertShaderBorders(i,a,5,-5,null,0,!0),this.insertShaderBorders(i,a,5,-5,null,0,!1),this.insertShaderBorders(i,a,5,null,-5,0,!0),this.insertShaderBorders(i,a,5,null,-5,0,!1),this.insertShaderBorders(i,5,45,-5,null,-5,!0),this.insertShaderBorders(i,5,45,null,-5,-5,!0),this.insertShaderBorders(i,5,45,-5,null,-5,!1),this.insertShaderBorders(i,5,45,null,-5,-5,!1),this.hasBorderShaders=!0}e.append(i)}},e.prototype.insertShaderBorders=function(e,t,n,r,i,o,s){var a=document.createElement("div");a.style.position="absolute",a.style.backgroundColor=Uf.BORDER_SHADER_DEFAULT_COLOR,a.style.width="".concat(t,"px"),a.style.height="".concat(n,"px"),null!==r&&(a.style.top="".concat(r,"px")),null!==i&&(a.style.bottom="".concat(i,"px")),s?a.style.left="".concat(o,"px"):a.style.right="".concat(o,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(a),e.appendChild(a)},e.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},e.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},e.prototype.getTimeoutFps=function(e){return 1e3/e},e}();function Hf(e,t,n){const r=e.slice();return r[19]=t[n].id,r[20]=t[n].label,r}function jf(e){let t,n,r=e[1]&&qf(e);return{c(){r&&r.c(),t=L(),n=M("reader"),z(n,"id","reader"),z(n,"class","svelte-9062r9")},m(e,i){r&&r.m(e,i),x(e,t,i),x(e,n,i)},p(e,n){e[1]?r?r.p(e,n):(r=qf(e),r.c(),r.m(t.parentNode,t)):r&&(r.d(1),r=null)},d(e){r&&r.d(e),e&&k(t),e&&k(n)}}}function qf(e){let t,n,r,i,o,s,a=e[1],l=[];for(let t=0;t<a.length;t+=1)l[t]=Gf(Hf(e,a,t));return{c(){t=M("div"),n=B("Quelle:\n "),r=M("select");for(let e=0;e<l.length;e+=1)l[e].c();r.disabled=i=1===e[1].length},m(i,a){x(i,t,a),D(t,n),D(t,r);for(let e=0;e<l.length;e+=1)l[e].m(r,null);o||(s=V(r,"change",e[4]),o=!0)},p(e,t){if(6&t){let n;for(a=e[1],n=0;n<a.length;n+=1){const i=Hf(e,a,n);l[n]?l[n].p(i,t):(l[n]=Gf(i),l[n].c(),l[n].m(r,null))}for(;n<l.length;n+=1)l[n].d(1);l.length=a.length}2&t&&i!==(i=1===e[1].length)&&(r.disabled=i)},d(e){e&&k(t),O(l,e),o=!1,s()}}}function Gf(e){let t,n,r,i,o=e[20]+"";return{c(){t=M("option"),n=B(o),t.__value=r=e[19],t.value=t.__value,t.selected=i=e[2]===e[19]},m(e,r){x(e,t,r),D(t,n)},p(e,s){2&s&&o!==(o=e[20]+"")&&H(n,o),2&s&&r!==(r=e[19])&&(t.__value=r,t.value=t.__value),6&s&&i!==(i=e[2]===e[19])&&(t.selected=i)},d(e){e&&k(t)}}}function Xf(e){let t,n=!e[0]&&jf(e);return{c(){t=M("main"),n&&n.c(),z(t,"class","svelte-9062r9")},m(e,r){x(e,t,r),n&&n.m(t,null)},p(e,[r]){e[0]?n&&(n.d(1),n=null):n?n.p(e,r):(n=jf(e),n.c(),n.m(t,null))},i:_,o:_,d(e){e&&k(t),n&&n.d()}}}!function(e){e[e.STATUS_DEFAULT=0]="STATUS_DEFAULT",e[e.STATUS_SUCCESS=1]="STATUS_SUCCESS",e[e.STATUS_WARNING=2]="STATUS_WARNING",e[e.STATUS_REQUESTING_PERMISSION=3]="STATUS_REQUESTING_PERMISSION"}(Pf||(Pf={}));const Yf=()=>zf.getCameras();function Zf(e,t,n){let r;const i=ee(),{loggedIn:o}=u;N(e,o,e=>n(9,r=e));let s,a,l,{keyboard:c}=t,{codeTypes:d=""}=t,{readerInit:f=!1}=t,h=!1;const m=r.tenant+"-ENABLERR-CAMERA";Q(function(){if(c)return void(h=!0);try{s||(s=new zf("reader"));const e=window.localStorage.getItem(m);Yf().then(t=>{if(!t?.length)return;n(1,a=t);const r=t.find(t=>t.id===e);r&&window.localStorage.setItem(m,r.id),g(r?.id||a[0].id)})}catch{}}),J(function(){w(),i("exit")});var p=function(e,t){var n=250,r=e>t?t:e,i=Math.floor(.75*r);return i<n?r<n?{width:r,height:r}:{width:n,height:n}:{width:i,height:i}};function g(e){if(e&&n(2,l=e),l)try{s.start(l,{fps:5,qrbox:p,formatsToSupport:d||void 0,facingMode:"environment"},y),h=!0}catch{}}async function w(e=!1){try{c||(await s.stop(),e&&await s.clear())}catch{}finally{h=!1}}function y(e,t){h&&(i("scan",{text:e}),h=!1)}return e.$$set=e=>{"keyboard"in e&&n(0,c=e.keyboard),"codeTypes"in e&&n(6,d=e.codeTypes),"readerInit"in e&&n(5,f=e.readerInit)},e.$$.update=()=>{32&e.$$.dirty&&f&&(h=!0,n(5,f=!1))},[c,a,l,o,async e=>{const t=e.target.value;await w(),window.localStorage.setItem(m,t),g(t)},f,d]}class Kf extends xe{constructor(e){var t;super(),document.getElementById("svelte-9062r9-style")||((t=M("style")).id="svelte-9062r9-style",t.textContent="main.svelte-9062r9{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:20px;max-height:400px}reader.svelte-9062r9{width:400px;height:300px;background-color:gray}",D(document.head,t)),De(this,e,Zf,Xf,S,{keyboard:0,codeTypes:6,readerInit:5})}}const{document:Qf}=Ee;function Jf(e,t,n){const r=e.slice();return r[166]=t[n],r[168]=n,r}function eh(e,t,n){const r=e.slice();return r[170]=t[n],r[172]=n,r}function th(e,t,n){const r=e.slice();return r[179]=t[n],r}function nh(e,t,n){const r=e.slice();return r[174]=t[n].title,r[175]=t[n].toDelete,r[176]=t[n].icon,r}function rh(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function ih(e){let t,n,r,i,o,s,a,l,c,d,u=e[31],f=(!e[2]||e[15]?.length&&e[15].length>1)&&oh(e),h=e[21]&&sh(e),m=!1!==e[4].transfer&&e[52]?.length&&lh(e),p=!e[10]&&e[48]&&e[14]&&0!=e[14]&&dh(e),g=!e[10]&&e[46]&&e[17]&&0!=e[17]&&fh(e),w=e[44]&&e[13]&&0!=e[13]&&mh(e),y=Th(e),v=e[21]&&e[24]&&Rh(e);return{c(){f&&f.c(),t=L(),n=M("div"),h&&h.c(),r=L(),m&&m.c(),i=L(),p&&p.c(),o=L(),g&&g.c(),s=L(),w&&w.c(),a=L(),y.c(),l=L(),v&&v.c(),c=F(),z(n,"class","formList")},m(e,u){f&&f.m(e,u),x(e,t,u),x(e,n,u),h&&h.m(n,null),D(n,r),m&&m.m(n,null),D(n,i),p&&p.m(n,null),D(n,o),g&&g.m(n,null),D(n,s),w&&w.m(n,null),D(n,a),y.m(n,null),x(e,l,u),v&&v.m(e,u),x(e,c,u),d=!0},p(e,l){!e[2]||e[15]?.length&&e[15].length>1?f?(f.p(e,l),32772&l[0]&&$e(f,1)):(f=oh(e),f.c(),$e(f,1),f.m(t.parentNode,t)):f&&(ye(),Ie(f,1,1,()=>{f=null}),ve()),e[21]?h?(h.p(e,l),2097152&l[0]&&$e(h,1)):(h=sh(e),h.c(),$e(h,1),h.m(n,r)):h&&(ye(),Ie(h,1,1,()=>{h=null}),ve()),!1!==e[4].transfer&&e[52]?.length?m?(m.p(e,l),16&l[0]&&$e(m,1)):(m=lh(e),m.c(),$e(m,1),m.m(n,i)):m&&(ye(),Ie(m,1,1,()=>{m=null}),ve()),!e[10]&&e[48]&&e[14]&&0!=e[14]?p?(p.p(e,l),17408&l[0]&&$e(p,1)):(p=dh(e),p.c(),$e(p,1),p.m(n,o)):p&&(ye(),Ie(p,1,1,()=>{p=null}),ve()),!e[10]&&e[46]&&e[17]&&0!=e[17]?g?(g.p(e,l),132096&l[0]&&$e(g,1)):(g=fh(e),g.c(),$e(g,1),g.m(n,s)):g&&(ye(),Ie(g,1,1,()=>{g=null}),ve()),e[44]&&e[13]&&0!=e[13]?w?(w.p(e,l),8192&l[0]&&$e(w,1)):(w=mh(e),w.c(),$e(w,1),w.m(n,a)):w&&(ye(),Ie(w,1,1,()=>{w=null}),ve()),1&l[1]&&S(u,u=e[31])?(ye(),Ie(y,1,1,_),ve(),y=Th(e),y.c(),$e(y),y.m(n,null)):y.p(e,l),e[21]&&e[24]?v?(v.p(e,l),18874368&l[0]&&$e(v,1)):(v=Rh(e),v.c(),$e(v,1),v.m(c.parentNode,c)):v&&(ye(),Ie(v,1,1,()=>{v=null}),ve())},i(e){d||($e(f),$e(h),$e(m),$e(p),$e(g),$e(w),$e(y),$e(v),d=!0)},o(e){Ie(f),Ie(h),Ie(m),Ie(p),Ie(g),Ie(w),Ie(y),Ie(v),d=!1},d(e){f&&f.d(e),e&&k(t),e&&k(n),h&&h.d(),m&&m.d(),p&&p.d(),g&&g.d(),w&&w.d(),y.d(e),e&&k(l),v&&v.d(e),e&&k(c)}}}function oh(e){let t,n;return t=new e[41]({props:{text:e[4].designation}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};16&n[0]&&(r.text=e[4].designation),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function sh(e){let t,n;return t=new e[38]({props:{disabled:e[1]||!e[0]._id&&e[23].input,filled:!0,style:"opacity: 0.75; margin-bottom: .5em;",$$slots:{default:[ah]},$$scope:{ctx:e}}}),t.$on("click",e[74]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};8388611&n[0]&&(r.disabled=e[1]||!e[0]._id&&e[23].input),134217728&n[5]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function ah(e){let t,n,r;return n=new Ge({props:{size:"18"}}),{c(){t=M("span"),t.textContent="Barcode scannen",Ne(n.$$.fragment),q(t,"margin-right",".75em")},m(e,i){x(e,t,i),Te(n,e,i),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n,e)}}}function lh(e){let t,n;return t=new e[38]({props:{filled:!0,style:"opacity: 0.75; margin-bottom: .5em;",$$slots:{default:[ch]},$$scope:{ctx:e}}}),t.$on("click",e[81]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};16&n[0]|134217728&n[5]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function ch(e){let t,n,r,i,o=e[73](e[4].transfer)+"";return r=new Ue({props:{size:"18"}}),{c(){t=M("span"),n=B(o),Ne(r.$$.fragment),q(t,"margin-right",".75em")},m(e,o){x(e,t,o),D(t,n),Te(r,e,o),i=!0},p(e,t){(!i||16&t[0])&&o!==(o=e[73](e[4].transfer)+"")&&H(n,o)},i(e){i||($e(r.$$.fragment,e),i=!0)},o(e){Ie(r.$$.fragment,e),i=!1},d(e){e&&k(t),Re(r,e)}}}function dh(e){let t,n;return t=new e[37]({props:{name:"Total Wochen",nameClass:"formField_italic",$$slots:{default:[uh]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};16384&n[0]|134217728&n[5]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function uh(e){let t,n,r;function i(t){e[94](t)}let o={item:e[49],disabled:!0};return void 0!==e[14]&&(o.value=e[14]),t=new lo({props:o}),re.push(()=>Se(t,"value",i)),{c(){Ne(t.$$.fragment)},m(e,n){Te(t,e,n),r=!0},p(e,r){const i={};!n&&16384&r[0]&&(n=!0,i.value=e[14],ue(()=>n=!1)),t.$set(i)},i(e){r||($e(t.$$.fragment,e),r=!0)},o(e){Ie(t.$$.fragment,e),r=!1},d(e){Re(t,e)}}}function fh(e){let t,n;return t=new e[37]({props:{name:"Total Stunden",nameClass:"formField_italic",$$slots:{default:[hh]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};131072&n[0]|134217728&n[5]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function hh(e){let t,n,r;function i(t){e[95](t)}let o={item:e[47],disabled:!0};return void 0!==e[17]&&(o.value=e[17]),t=new lo({props:o}),re.push(()=>Se(t,"value",i)),{c(){Ne(t.$$.fragment)},m(e,n){Te(t,e,n),r=!0},p(e,r){const i={};!n&&131072&r[0]&&(n=!0,i.value=e[17],ue(()=>n=!1)),t.$set(i)},i(e){r||($e(t.$$.fragment,e),r=!0)},o(e){Ie(t.$$.fragment,e),r=!1},d(e){Re(t,e)}}}function mh(e){let t,n;return t=new e[37]({props:{name:"Total Betrag",nameClass:"formField_italic",$$slots:{default:[ph]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};8448&n[0]|134217728&n[5]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function ph(e){let t,n,r;function i(t){e[96](t)}let o={item:e[45],disabled:!0,currency:e[8]};return void 0!==e[13]&&(o.value=e[13]),t=new lo({props:o}),re.push(()=>Se(t,"value",i)),{c(){Ne(t.$$.fragment)},m(e,n){Te(t,e,n),r=!0},p(e,r){const i={};256&r[0]&&(i.currency=e[8]),!n&&8192&r[0]&&(n=!0,i.value=e[13],ue(()=>n=!1)),t.$set(i)},i(e){r||($e(t.$$.fragment,e),r=!0)},o(e){Ie(t.$$.fragment,e),r=!1},d(e){Re(t,e)}}}function gh(e){let t,n;return t=new e[40]({props:{class:e[32][e[172]],open:e[12]&&!e[2]&&0===e[172]&&!e[21],$$slots:{handle:[bh,({toggle:e,open:t})=>({173:e,12:t}),({toggle:e,open:t})=>[t?4096:0,0,0,0,0,e?262144:0]],default:[$h,({toggle:e,open:t})=>({173:e,12:t}),({toggle:e,open:t})=>[t?4096:0,0,0,0,0,e?262144:0]]},$$scope:{ctx:e}}}),t.$on("panel-open",function(){b(e[70](e[172],e[169]))&&e[70](e[172],e[169]).apply(this,arguments)}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(n,r){e=n;const i={};2&r[1]&&(i.class=e[32][e[172]]),2101252&r[0]&&(i.open=e[12]&&!e[2]&&0===e[172]&&!e[21]),4562943&r[0]|12&r[1]|134479872&r[5]&&(i.$$scope={dirty:r,ctx:e}),t.$set(i)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function wh(e){let t,n;return t=new Su({props:{praefix:e[172],item:e[179],eventId:e[7],fullRecord:e[0],record:e[170],recordId:e[0]._id,multiValues:e[5],reqQuantity:e[3],notifyList:e[9],noForm:Xh,classId:e[6],disabled:e[1],required:e[43],selectionFields:e[53],propSelection:e[22],numberInput:e[34],dateInput:{...e[11],l:e[4].name,t:e[172]===e[15].length-1,n:e[51].get(e[179].name)},shortEdit:e[10],currency:e[8],initFinished:e[18],formnovalidate:e[172]===e[15].length-1||e[15][e[172]]._delete}}),t.$on("notify",function(){b(e[57](e[4],e[179],e[172]))&&e[57](e[4],e[179],e[172]).apply(this,arguments)}),t.$on("task",function(){b(e[56](e[4]))&&e[56](e[4]).apply(this,arguments)}),t.$on("invalid",e[58]),t.$on("defPrep",e[59]),t.$on("checkRange",e[60]),t.$on("formula",e[71](e[172])),t.$on("record",e[97]),t.$on("listRecord",e[61](e[172])),t.$on("propSelection",e[72](e[172])),t.$on("listChange",e[62]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(n,r){e=n;const i={};16&r[0]&&(i.item=e[179]),128&r[0]&&(i.eventId=e[7]),1&r[0]&&(i.fullRecord=e[0]),32768&r[0]&&(i.record=e[170]),1&r[0]&&(i.recordId=e[0]._id),32&r[0]&&(i.multiValues=e[5]),8&r[0]&&(i.reqQuantity=e[3]),512&r[0]&&(i.notifyList=e[9]),64&r[0]&&(i.classId=e[6]),2&r[0]&&(i.disabled=e[1]),4194304&r[0]&&(i.propSelection=e[22]),8&r[1]&&(i.numberInput=e[34]),34832&r[0]&&(i.dateInput={...e[11],l:e[4].name,t:e[172]===e[15].length-1,n:e[51].get(e[179].name)}),1024&r[0]&&(i.shortEdit=e[10]),256&r[0]&&(i.currency=e[8]),262144&r[0]&&(i.initFinished=e[18]),32768&r[0]&&(i.formnovalidate=e[172]===e[15].length-1||e[15][e[172]]._delete),t.$set(i)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function yh(e){let t,n,r=e[4].item,i=[];for(let t=0;t<r.length;t+=1)i[t]=wh(th(e,r,t));const o=e=>Ie(i[e],1,1,()=>{i[e]=null});return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=F()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);x(e,t,r),n=!0},p(e,n){if(4493307&n[0]|2119176200&n[1]|1537&n[2]){let s;for(r=e[4].item,s=0;s<r.length;s+=1){const o=th(e,r,s);i[s]?(i[s].p(o,n),$e(i[s],1)):(i[s]=wh(o),i[s].c(),$e(i[s],1),i[s].m(t.parentNode,t))}for(ye(),s=r.length;s<i.length;s+=1)o(s);ve()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)$e(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)Ie(i[e]);n=!1},d(e){O(i,e),e&&k(t)}}}function vh(e){let t,n,r=e[15][e[172]]._delete,i=yh(e);return{c(){i.c(),t=F()},m(e,r){i.m(e,r),x(e,t,r),n=!0},p(e,n){32768&n[0]&&S(r,r=e[15][e[172]]._delete)?(ye(),Ie(i,1,1,_),ve(),i=yh(e),i.c(),$e(i),i.m(t.parentNode,t)):i.p(e,n)},i(e){n||($e(i),n=!0)},o(e){Ie(i),n=!1},d(e){e&&k(t),i.d(e)}}}function $h(e){let t,n,r,i,o=e[15].length,s=vh(e);return{c(){t=M("div"),s.c(),r=L(),z(t,"id",n=`accordion-content-${e[6]}-${e[4].name}-${e[172]}`)},m(e,n){x(e,t,n),s.m(t,null),x(e,r,n),i=!0},p(e,r){32768&r[0]&&S(o,o=e[15].length)?(ye(),Ie(s,1,1,_),ve(),s=vh(e),s.c(),$e(s),s.m(t,null)):s.p(e,r),(!i||80&r[0]&&n!==(n=`accordion-content-${e[6]}-${e[4].name}-${e[172]}`))&&z(t,"id",n)},i(e){i||($e(s),i=!0)},o(e){Ie(s),i=!1},d(e){e&&k(t),s.d(e),e&&k(r)}}}function Ih(e){let t,n;return t=new e[38]({props:{$$slots:{default:[Ch]},$$scope:{ctx:e}}}),t.$on("click",function(){b(e[63](e[173],e[172],e[12]))&&e[63](e[173],e[172],e[12]).apply(this,arguments)}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(n,r){e=n;const i={};98326&r[0]|4&r[1]|134217728&r[5]&&(i.$$scope={dirty:r,ctx:e}),t.$set(i)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function _h(e){let t,n,r,i,o;var s=wt;return s&&(n=new s({props:{size:"20"}})),{c(){t=M("span"),n&&Ne(n.$$.fragment),z(t,"class","pointer icon2 svelte-ai576v")},m(s,a){x(s,t,a),n&&Te(n,t,null),r=!0,i||(o=V(t,"click",e[85]),i=!0)},p(e,r){if(s!==(s=wt)){if(n){ye();const e=n;Ie(e.$$.fragment,1,0,()=>{Re(e,1)}),ve()}s?(n=new s({props:{size:"20"}}),Ne(n.$$.fragment),$e(n.$$.fragment,1),Te(n,t,null)):n=null}},i(e){r||(n&&$e(n.$$.fragment,e),r=!0)},o(e){n&&Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),n&&Re(n),i=!1,o()}}}function Ch(e){let t,n,r,i,o,s,a,l,c=e[55](e[16],e[172])+"",d=e[4].merge&&!e[1]&&0===e[172]&&_h(e);return{c(){t=M("div"),d&&d.c(),n=L(),r=new X(null),z(t,"class",i=T(e[4].name)+" svelte-ai576v"),z(t,"draggable",o=!e[4].sort),G(t,"align-left",e[4].alignLeft&&(e[2]||e[172]+1<e[15].length)),G(t,"delete",e[170]._delete),G(t,"draggableListItem",!e[4].sort),G(t,"is-active-top",e[33]?.top===e[172]),G(t,"is-active-bottom",e[33]?.bottom===e[172])},m(i,o){x(i,t,o),d&&d.m(t,null),D(t,n),r.m(c,t),s=!0,a||(l=[V(t,"dragover",e[68]),V(t,"dragleave",e[69](e[172])),V(t,"dragstart",e[66](e[172])),V(t,"drop",U(e[65](e[172]))),V(t,"dragenter",e[67](e[172]))],a=!0)},p(a,l){(e=a)[4].merge&&!e[1]&&0===e[172]?d?(d.p(e,l),18&l[0]&&$e(d,1)):(d=_h(e),d.c(),$e(d,1),d.m(t,n)):d&&(ye(),Ie(d,1,1,()=>{d=null}),ve()),(!s||65536&l[0])&&c!==(c=e[55](e[16],e[172])+"")&&r.p(c),(!s||16&l[0]&&i!==(i=T(e[4].name)+" svelte-ai576v"))&&z(t,"class",i),(!s||16&l[0]&&o!==(o=!e[4].sort))&&z(t,"draggable",o),32788&l[0]&&G(t,"align-left",e[4].alignLeft&&(e[2]||e[172]+1<e[15].length)),32784&l[0]&&G(t,"delete",e[170]._delete),16&l[0]&&G(t,"draggableListItem",!e[4].sort),16&l[0]|4&l[1]&&G(t,"is-active-top",e[33]?.top===e[172]),16&l[0]|4&l[1]&&G(t,"is-active-bottom",e[33]?.bottom===e[172])},i(e){s||($e(d),s=!0)},o(e){Ie(d),s=!1},d(e){e&&k(t),d&&d.d(),a=!1,A(l)}}}function Eh(e){let t,n,r;var i=e[176];return i&&(t=new i({props:{size:"20"}})),{c(){t&&Ne(t.$$.fragment),n=F()},m(e,i){t&&Te(t,e,i),x(e,n,i),r=!0},p(e,r){if(i!==(i=e[176])){if(t){ye();const e=t;Ie(e.$$.fragment,1,0,()=>{Re(e,1)}),ve()}i?(t=new i({props:{size:"20"}}),Ne(t.$$.fragment),$e(t.$$.fragment,1),Te(t,n.parentNode,n)):t=null}},i(e){r||(t&&$e(t.$$.fragment,e),r=!0)},o(e){t&&Ie(t.$$.fragment,e),r=!1},d(e){e&&k(n),t&&Re(t,e)}}}function Ah(e){let t,n,r,i,o,s=!e[1]&&!e[4].readonly&&Eh(e);return{c(){t=M("span"),s&&s.c(),z(t,"class","pointer icon svelte-ai576v"),z(t,"title",e[174]),t.hidden=n=e[172]===e[15].length-1||!(e[170]._delete^e[175])},m(n,a){x(n,t,a),s&&s.m(t,null),r=!0,i||(o=V(t,"click",function(){b(e[64](e[172],e[12],e[173]))&&e[64](e[172],e[12],e[173]).apply(this,arguments)}),i=!0)},p(i,o){(e=i)[1]||e[4].readonly?s&&(ye(),Ie(s,1,1,()=>{s=null}),ve()):s?(s.p(e,o),18&o[0]&&$e(s,1)):(s=Eh(e),s.c(),$e(s,1),s.m(t,null)),(!r||32768&o[0]&&n!==(n=e[172]===e[15].length-1||!(e[170]._delete^e[175])))&&(t.hidden=n)},i(e){r||($e(s),r=!0)},o(e){Ie(s),r=!1},d(e){e&&k(t),s&&s.d(),i=!1,o()}}}function bh(e){let t,n,r,i,o,s=!e[10]&&Ih(e),a=[{title:"löschen",toDelete:!0,icon:ot},{title:"undo",toDelete:!1,icon:nt}],l=[];for(let t=0;t<2;t+=1)l[t]=Ah(nh(e,a,t));const c=e=>Ie(l[e],1,1,()=>{l[e]=null});return{c(){t=M("div"),s&&s.c(),n=L();for(let e=0;e<2;e+=1)l[e].c();r=L(),z(t,"class",i=T("accordion "+e[4].name)+" svelte-ai576v"),z(t,"slot","handle")},m(e,i){x(e,t,i),s&&s.m(t,null),D(t,n);for(let e=0;e<2;e+=1)l[e].m(t,null);D(t,r),o=!0},p(e,d){if(e[10]?s&&(ye(),Ie(s,1,1,()=>{s=null}),ve()):s?(s.p(e,d),1024&d[0]&&$e(s,1)):(s=Ih(e),s.c(),$e(s,1),s.m(t,n)),36882&d[0]|4&d[2]|262144&d[5]){let n;for(a=[{title:"löschen",toDelete:!0,icon:ot},{title:"undo",toDelete:!1,icon:nt}],n=0;n<2;n+=1){const i=nh(e,a,n);l[n]?(l[n].p(i,d),$e(l[n],1)):(l[n]=Ah(i),l[n].c(),$e(l[n],1),l[n].m(t,r))}for(ye(),n=2;n<2;n+=1)c(n);ve()}(!o||16&d[0]&&i!==(i=T("accordion "+e[4].name)+" svelte-ai576v"))&&z(t,"class",i)},i(e){if(!o){$e(s);for(let e=0;e<2;e+=1)$e(l[e]);o=!0}},o(e){Ie(s),l=l.filter(Boolean);for(let e=0;e<2;e+=1)Ie(l[e]);o=!1},d(e){e&&k(t),s&&s.d(),O(l,e)}}}function Sh(e){let t,n,r=!e[2]&&e[86](e[172])&&!e[1]||(!e[4].merge||e[1])&&e[172]<e[15].length-1,i=r&&gh(e);return{c(){i&&i.c(),t=F()},m(e,r){i&&i.m(e,r),x(e,t,r),n=!0},p(e,n){32790&n[0]&&(r=!e[2]&&e[86](e[172])&&!e[1]||(!e[4].merge||e[1])&&e[172]<e[15].length-1),r?i?(i.p(e,n),32790&n[0]&&$e(i,1)):(i=gh(e),i.c(),$e(i,1),i.m(t.parentNode,t)):i&&(ye(),Ie(i,1,1,()=>{i=null}),ve())},i(e){n||($e(i),n=!0)},o(e){Ie(i),n=!1},d(e){i&&i.d(e),e&&k(t)}}}function Nh(e){let t,n,r=e[15],i=[];for(let t=0;t<r.length;t+=1)i[t]=Sh(eh(e,r,t));const o=e=>Ie(i[e],1,1,()=>{i[e]=null});return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=F()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);x(e,t,r),n=!0},p(e,n){if(6660095&n[0]|2135953422&n[1]|25167871&n[2]|278528&n[5]){let s;for(r=e[15],s=0;s<r.length;s+=1){const o=eh(e,r,s);i[s]?(i[s].p(o,n),$e(i[s],1)):(i[s]=Sh(o),i[s].c(),$e(i[s],1),i[s].m(t.parentNode,t))}for(ye(),s=r.length;s<i.length;s+=1)o(s);ve()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)$e(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)Ie(i[e]);n=!1},d(e){O(i,e),e&&k(t)}}}function Th(e){let t,n;return t=new e[39]({props:{class:e[6]+e[4].name,$$slots:{default:[Nh,({closeOtherPanels:e})=>({169:e}),({closeOtherPanels:e})=>[0,0,0,0,0,e?16384:0]]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};80&n[0]&&(r.class=e[6]+e[4].name),6660095&n[0]|14&n[1]|134234112&n[5]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Rh(e){let t,n,r;function i(t){e[99](t)}let o={$$slots:{default:[Wh,({closeCallback:e})=>({165:e}),({closeCallback:e})=>[0,0,0,0,0,e?1024:0]]},$$scope:{ctx:e}};return void 0!==e[24]&&(o.open=e[24]),t=new e[35]({props:o}),re.push(()=>Se(t,"open",i)),{c(){Ne(t.$$.fragment)},m(e,n){Te(t,e,n),r=!0},p(e,r){const i={};2116026368&r[0]|134218752&r[5]&&(i.$$scope={dirty:r,ctx:e}),!n&&16777216&r[0]&&(n=!0,i.open=e[24],ue(()=>n=!1)),t.$set(i)},i(e){r||($e(t.$$.fragment,e),r=!0)},o(e){Ie(t.$$.fragment,e),r=!1},d(e){Re(t,e)}}}function Dh(e){let t,n;return{c(){t=M("td"),n=B(e[26])},m(e,r){x(e,t,r),D(t,n)},p(e,t){67108864&t[0]&&H(n,e[26])},d(e){e&&k(t)}}}function xh(e){let t,n,r,i;return{c(){t=M("td"),n=M("input"),z(n,"id","reader_focusId"),n.autofocus=!0,n.value=e[25]},m(o,s){x(o,t,s),D(t,n),n.focus(),r||(i=[V(n,"focus",e[76]),V(n,"input",function(){b(e[82](e[21].keyboard.length))&&e[82](e[21].keyboard.length).apply(this,arguments)})],r=!0)},p(t,r){e=t,33554432&r[0]&&n.value!==e[25]&&(n.value=e[25])},d(e){e&&k(t),r=!1,A(i)}}}function kh(e){let t,n,r,i,o,s=e[77](e[21].refItem,!0)+"";return{c(){t=M("tr"),n=M("th"),r=M("div"),i=B(s),o=B(" nicht gefunden!"),q(r,"color","red"),z(n,"colspan","2")},m(e,s){x(e,t,s),D(t,n),D(n,r),D(r,i),D(r,o)},p(e,t){2097152&t[0]&&s!==(s=e[77](e[21].refItem,!0)+"")&&H(i,s)},d(e){e&&k(t)}}}function Oh(e){let t,n,r,i,o,s=e[77](e[21].refItem)+"";return{c(){t=M("tr"),n=M("th"),r=M("div"),i=B(s),o=B(" bereits eingefügt!"),q(r,"color","red"),z(n,"colspan","2")},m(e,s){x(e,t,s),D(t,n),D(n,r),D(r,i),D(r,o)},p(e,t){2097152&t[0]&&s!==(s=e[77](e[21].refItem)+"")&&H(i,s)},d(e){e&&k(t)}}}function Mh(e){let t;let n=function(e){return"number"===e[166].type?Bh:Ph}(e),r=n(e);return{c(){r.c(),t=F()},m(e,n){r.m(e,n),x(e,t,n)},p(e,t){r.p(e,t)},d(e){r.d(e),e&&k(t)}}}function Ph(e){let t;return{c(){t=M("input"),z(t,"id","reader_"+e[166].name),z(t,"type","text")},m(e,n){x(e,t,n)},p:_,d(e){e&&k(t)}}}function Bh(e){let t,n,r;return{c(){t=M("input"),q(t,"width","4em"),z(t,"id","reader_"+e[166].name),z(t,"type","number"),z(t,"min","0")},m(i,o){x(i,t,o),n||(r=V(t,"input",function(){b(e[82](e[21].keyboard.length,e[166]))&&e[82](e[21].keyboard.length,e[166]).apply(this,arguments)}),n=!0)},p(t,n){e=t},d(e){e&&k(t),n=!1,r()}}}function Lh(e){let t,n,r,i,o,s,a=e[77](e[166].name)+"",l=e[27]&&Mh(e);return{c(){t=M("tr"),n=M("th"),r=B(a),i=L(),o=M("td"),l&&l.c(),s=L()},m(e,a){x(e,t,a),D(t,n),D(n,r),D(t,i),D(t,o),l&&l.m(o,null),D(t,s)},p(e,t){e[27]?l?l.p(e,t):(l=Mh(e),l.c(),l.m(o,null)):l&&(l.d(1),l=null)},d(e){e&&k(t),l&&l.d()}}}function Fh(e){let t;return{c(){t=B("Verwerfen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Vh(e){let t;return{c(){t=B("Speichern")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Uh(e){let t,n,r,i,o,s,a,l,c,d,u,f,h,m,p,g,w,y,v,$,I,_,C,E=e[77](e[21].refItem)+"";function A(t){e[98](t)}let b={keyboard:e[21].keyboard,codeTypes:e[21].codeTypes};function S(e,t){return e[21].keyboard?xh:Dh}void 0!==e[29]&&(b.readerInit=e[29]),t=new Kf({props:b}),re.push(()=>Se(t,"readerInit",A)),t.$on("scan",e[75]),t.$on("exit",e[80]);let N=S(e),T=N(e);function R(e,t){return e[30]?Oh:e[26]&&!e[28]?kh:void 0}let P=R(e),F=P&&P(e),V=e[50],U=[];for(let t=0;t<V.length;t+=1)U[t]=Lh(Jf(e,V,t));return $=new e[38]({props:{disabled:!e[26],outline:!0,style:"float: left;",$$slots:{default:[Fh]},$$scope:{ctx:e}}}),$.$on("click",e[78]),_=new e[38]({props:{disabled:!e[28],filled:!0,style:"float: right;",$$slots:{default:[Vh]},$$scope:{ctx:e}}}),_.$on("click",e[79]),{c(){Ne(t.$$.fragment),r=L(),i=M("div"),o=M("table"),s=M("tr"),a=M("th"),a.textContent="Code",l=L(),T.c(),c=L(),d=M("tr"),u=M("th"),f=B(E),h=L(),m=M("td"),p=M("div"),g=B(e[27]),w=L(),F&&F.c(),y=L();for(let e=0;e<U.length;e+=1)U[e].c();v=L(),Ne($.$$.fragment),I=L(),Ne(_.$$.fragment),q(p,"max-width","14em"),q(o,"margin-top","1em"),q(o,"margin-bottom","1em"),q(o,"text-align","left"),q(i,"position","relative"),q(i,"z-index","1000"),q(i,"background-color","white"),q(i,"height","225px")},m(e,n){Te(t,e,n),x(e,r,n),x(e,i,n),D(i,o),D(o,s),D(s,a),D(s,l),T.m(s,null),D(o,c),D(o,d),D(d,u),D(u,f),D(d,h),D(d,m),D(m,p),D(p,g),D(o,w),F&&F.m(o,null),D(o,y);for(let e=0;e<U.length;e+=1)U[e].m(o,null);D(i,v),Te($,i,null),D(i,I),Te(_,i,null),C=!0},p(e,r){const i={};if(2097152&r[0]&&(i.keyboard=e[21].keyboard),2097152&r[0]&&(i.codeTypes=e[21].codeTypes),!n&&536870912&r[0]&&(n=!0,i.readerInit=e[29],ue(()=>n=!1)),t.$set(i),N===(N=S(e))&&T?T.p(e,r):(T.d(1),T=N(e),T&&(T.c(),T.m(s,null))),(!C||2097152&r[0])&&E!==(E=e[77](e[21].refItem)+"")&&H(f,E),(!C||134217728&r[0])&&H(g,e[27]),P===(P=R(e))&&F?F.p(e,r):(F&&F.d(1),F=P&&P(e),F&&(F.c(),F.m(o,y))),136314880&r[0]|524288&r[1]|1081344&r[2]){let t;for(V=e[50],t=0;t<V.length;t+=1){const n=Jf(e,V,t);U[t]?U[t].p(n,r):(U[t]=Lh(n),U[t].c(),U[t].m(o,null))}for(;t<U.length;t+=1)U[t].d(1);U.length=V.length}const a={};67108864&r[0]&&(a.disabled=!e[26]),134217728&r[5]&&(a.$$scope={dirty:r,ctx:e}),$.$set(a);const l={};268435456&r[0]&&(l.disabled=!e[28]),134217728&r[5]&&(l.$$scope={dirty:r,ctx:e}),_.$set(l)},i(e){C||($e(t.$$.fragment,e),$e($.$$.fragment,e),$e(_.$$.fragment,e),C=!0)},o(e){Ie(t.$$.fragment,e),Ie($.$$.fragment,e),Ie(_.$$.fragment,e),C=!1},d(e){Re(t,e),e&&k(r),e&&k(i),T.d(),F&&F.d(),O(U,e),Re($),Re(_)}}}function Wh(e){let t,n;return t=new e[36]({props:{title:"Scannen",class:"reader",closeCallback:e[165],$$slots:{default:[Uh]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};1024&n[5]&&(r.closeCallback=e[165]),2116026368&n[0]|134217728&n[5]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function zh(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Hh(e){let t,n;return t=new ju({props:{classId:e[6],list:e[4],selection:e[20]}}),t.$on("choose",e[84]),t.$on("back",e[83]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};64&n[0]&&(r.classId=e[6]),16&n[0]&&(r.list=e[4]),1048576&n[0]&&(r.selection=e[20]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function jh(e){let t,n,r=e[19]&&Hh(e);return{c(){r&&r.c(),t=F()},m(e,i){r&&r.m(e,i),x(e,t,i),n=!0},p(e,n){e[19]?r?(r.p(e,n),524288&n[0]&&$e(r,1)):(r=Hh(e),r.c(),$e(r,1),r.m(t.parentNode,t)):r&&(ye(),Ie(r,1,1,()=>{r=null}),ve())},i(e){n||($e(r),n=!0)},o(e){Ie(r),n=!1},d(e){r&&r.d(e),e&&k(t)}}}function qh(e){let t,n,r,i,o={ctx:e,current:null,token:null,hasCatch:!1,pending:zh,then:ih,catch:rh,value:164,blocks:[,,,]};function s(t){e[100](t)}_e(e[54](),o);let a={noClickaway:!0,$$slots:{default:[jh]},$$scope:{ctx:e}};return void 0!==e[19]&&(a.open=e[19]),n=new e[35]({props:a}),re.push(()=>Se(n,"open",s)),{c(){o.block.c(),t=L(),Ne(n.$$.fragment)},m(e,r){o.block.m(e,o.anchor=r),o.mount=()=>t.parentNode,o.anchor=t,x(e,t,r),Te(n,e,r),i=!0},p(t,i){Ce(o,e=t,i);const s={};1572944&i[0]|134217728&i[5]&&(s.$$scope={dirty:i,ctx:e}),!r&&524288&i[0]&&(r=!0,s.open=e[19],ue(()=>r=!1)),n.$set(s)},i(e){i||($e(o.block),$e(n.$$.fragment,e),i=!0)},o(e){for(let e=0;e<3;e+=1){Ie(o.blocks[e])}Ie(n.$$.fragment,e),i=!1},d(e){o.block.d(e),o.token=null,o=null,e&&k(t),Re(n,e)}}}let Gh=new Map;const Xh=!0,Yh="pos/target";function Zh(e,n,r){let i,o,s;const{Modal:a,Dialog:l,FormField:d,TextField:f,Button:h,Accordion:y,AccordionSection:v,Divider:$}=c,_=ee(),{loggedIn:C}=u;N(e,C,e=>r(108,s=e));let{list:E}=n,{mainSchema:A}=n,{schema:b}=n,{record:S}=n,{multiValues:T}=n,{classId:R}=n,{eventId:D}=n,{disabled:x}=n,{fixed:k}=n,{template:O={}}=n,{reqQuantity:M}=n,{open:P=!1}=n,{currency:B}=n,{notifyList:L}=n,{shortEdit:F}=n,{dateInput:V}=n,{listInput:U}=n,{refresh:W}=n,{listValues:z}=n;const H=b.find(e=>"price"===e.name&&!e.properties?.hidden),j=b.find(e=>"amount"===e.name&&!e.properties?.hidden)||b.find(e=>e.isAmount&&!e.properties?.hidden),q=b.find(e=>"quantity"===e.name&&!e.properties?.hidden),G=j||H&&q,X=G&&q;let Y=0;const Z=b.find(e=>"quantity"===e.name&&"h"===e.properties?.unit?.constant&&!e.properties?.hidden);let K=0;const J=b.find(e=>"number"===e.type&&"w"===e.properties?.unit?.constant?.toLowerCase()&&!e.properties?.hidden)?.name||"",ne=!!J;let re=0,ie=!1,oe=!1,se=[];const ae={},le=E.display?.highlight,de=E.reader;let ue,fe,he,me=b.properties?.readonly,pe=R.split("form-")[1].slice(0,-4),ge=new Map,we="",ye=!0,ve="",$e="",Ie="",_e=!1,Ce=!1,Ee=!1;const Ae=b.filter(e=>e.properties?.reader);let be=new Map,Se=0;E.group&&(k=!0);let Ne={};const Te=new Map;z[E.name]=[];const Re=e=>{let t,n,r=1;if(e.includes("=")){const[i,o]=e.split("="),[s,a]=o.split(":");if(i&&s&&a){t=s,n=a;let e=S[i+"_from"],o=S[i+"_to"];if(e&&o){const t=function(e,t){const n=new Date(e),r=new Date(t).getTime()-n.getTime();return Math.round(r/864e5)}(I(e),I(o));r=Math.floor((t+6)/7)}}}return{quantity:r,_d2:t,_d3:n}},De=E.item.filter(e=>"number"===e.type&&!!e.properties?.transfer);x||=me;let xe,ke,Oe=[],Me=[],Pe=!1,Be={},Le=[];const Fe=async e=>{if(("saleDelivery"!==E.name||!xe?.length||e[E.name]?.length)&&(!E.merge||!xe?.length||e[E.name]?.length)&&(!Array.isArray(E.source)||!xe?.length||e[E.name]?.length)&&(!E.add||!xe?.length||e[E.name]?.length)){if(r(3,M=e.quantity),F)r(15,xe=e[E.name]||[]);else if(!e._id&&E.filter){const e=xe;r(15,xe=[]);const t=await lt();r(15,xe=!1!==t?t.concat({}):e)}else r(15,xe=((e,t)=>{let n=e[t];if(n?.length||(n=[]),n=n.concat({}),e._id)return n;for(const t of b)t.preset&&!n[0][t.name]&&(n[0][t.name]=e[t.preset]);return n})(e,E.name)||[{}]);dt(e)}};b.filter(e=>e.selection).map(e=>Oe.push({className:pe,parentClass:b,refClass:e.selection,value:""}));["readonly","hidden","required"].map(e=>{b.filter(t=>"object"==typeof(t.properties&&t.properties[e])).forEach(t=>{const n=t.properties[e].refItem||"",r=t.properties[e].refValue;let[i,o]=n.split(".");o||(o=i,i=void 0),i||b.find(e=>e.name===o)?Le.push({action:e,itemName:t.name,refObj:i,refName:o,refValue:r,op:t.properties[e].invert?"!":""}):Le.push({action:e,itemName:o,refObj:i,refName:t.name,refValue:r,op:t.properties[e].invert?"!":"",revert:!0})})});const Ve=(e,t)=>""===t[e.name]?"":e._attr?Ue(e,t[e.name]):"object"===e.type?o(t[e.name]):Array.isArray(t[e.name])?ze(t[e.name]):"boolean"===e.type?w(t[e.name]):"number"===e.type?Je(t[e.name],e.properties?.decimals||0):"dateRange"===e.type?g(e.name,t):"date"===e.type?m(We(t[e.name])):"datetime"===e.type?p(t[e.name]):e.properties?.multi?"":t[e.name],Ue=(e,t)=>ae[t]?.split(" • ").at(e._attr),We=(e,t=!1)=>{if(!e)return"";try{if(e.split&&3===e.split("-").length)return new Date(e)?.toISOString();if(e.split&&3===e.split(".").length){const[t,n,r]=e.split("."),i=new Date(r,n-1,t);if(!isNaN(i))return i.toISOString()}}catch{}return t?e:""},ze=e=>e.slice(0,3).join(", "),He=(e,t,n)=>async({detail:o})=>{const{oldValue:s,value:a,add:l}=o;if(s&&!a){const e=b.find(e=>e.refItem===t.refClass&&e._formulaActor);e&&Qe(n,e._formulaActor,!0)}if(a&&!Array.isArray(a)&&t.refClass){const e=ct(t.refClass,D);let n=await Sp(e);0===n?.length&&(await(c=500,new Promise(e=>{setTimeout(e,c)})),n=await Sp(e)),n&&n.find(({_id:e})=>e==a)||await xp(t.refClass,a)}var c;let{desc:d}=o;if(""===s&&""===a&&(d=""),e.refItem){const i=await Ge(e,n,t,e.refItem);i&&r(15,xe=i)}Qe(n,t._formulaActor);const u=Oe?.find(e=>e.refClass.split(":")[1]?.split(".")[0]===t.refClass);u&&(u.value=(u.value||new Map).set(n,a)),a&&xe.length===n+1&&!F&&r(15,xe=xe.concat({})),d&&r(93,ae[a]=d,ae),F||await et(e,n,t,a,s),await Ye(n,t.name),r(16,i=xe),"number"===t.type&&r(34,Be={item:t,value:a,idx:n}),await je(n),Ze(n)},je=async e=>{if(xe[e]&&!E.filter&&xe.length!==e+1)for(const t of b.filter(e=>!!e.refProp)){let n,i=S[t.refItem]||xe[e][t.refItem];if(!i)continue;if(Array.isArray(i)){if(xe[e][t.name])continue;i=i[e][t.refItem]}const o=ct(t.refItem,D);let s=await Sp(o);if(s&&(n=s.find(({_id:e})=>e==i)),n||(n=await xp(t.refItem,i)),!n)continue;const a=qe(n,t.refProp)?.replace(",",".")||n[t.refProp]&&n[t.refProp][t.name]?.replace(",",".")||n[t.refProp];xe[e][t.name]||r(15,xe[e][t.name]=a,xe)}},qe=(e,t)=>{try{return e.split(".").reduce((e,t)=>e[t],t)}catch(e){return""}},Ge=async(e,t,n,r)=>{if(e.filter)return;const i=S[r];if(!i?.length)return;const o=i[0][r];if(!o)return;const s=await xp(r,o);return s?s[e.name]:void 0},Xe=(e,t,n,i)=>{if(!e.filter){if(i&&!1===n.refItem){const e="boolean"!==n.type&&"";xe[t][n.name]&&r(15,xe[t][n.name]=e,xe)}xe.length!==t+1&&"number"==typeof n.properties?.value&&r(15,xe[t][n.name]=n.properties.value,xe)}},Ye=async(e,t)=>{const n=Le.filter(e=>(e.refObj||pe)===t||e.refName===t);if(n?.length)for(const t of n){const{refObj:n,refName:i,refValue:o,op:s,revert:a}=t;if(a&&!k&&xe.length===e+1)return;let l,c,{itemName:d,action:u}=t,f=!1,h=!1;if(n){const t=xe[e][n];n===pe&&i?f=S:t&&(f=await xp(n,t))}!n&&i&&(f=xe[e]),!a&&f&&(h=f[i],Array.isArray(h)&&0===h.length?h=!1:o&&(h=h==(f[o]||S[o]))),!h&&a&&void 0!==S[d]&&(h=S[d]),"!"===s&&(h=!h),a&&(d=i),"required"!==u&&"readonly"!==u||(u="required"===u?u:"disabled",setTimeout(()=>{l=`#accordion-content-${R}-${E.name}-${e} .form-field.${d} .field textarea`,c=document.querySelector(l),c||(l=`#accordion-content-${R}-${E.name}-${e} .form-field.${d} .field input#${"dp-"+d+"-"+e}`,c=document.querySelector(l)),c||(l=`#accordion-content-${R}-${E.name}-${e} .form-field.${d} .field input`,c=document.querySelector(l)),c&&h&&c.setAttribute(u,""),c&&!h&&c.removeAttribute(u)},0)),"hidden"===u&&(l=`#accordion-content-${R}-${E.name}-${e} .form-field.${d}`,c=document.querySelector(l),c?.classList?.toggle("hidden",h),!a&&h&&r(15,xe[e][d]="",xe))}},Ze=(e,t)=>{let n=`#accordion-content-${R}-${E.name}-${e} .form-field:not(.hidden) .field :required:not(:disabled)`;const i=document.querySelectorAll(n);let o=!1;i.forEach(e=>{!e.id.startsWith("dp-")&&e.required&&""===e.value&&(o=!0)}),void 0===t&&(n=`#accordion-content-${R}-${E.name}-${e} :not(.form-field.hidden) .field input.invalid`,document.querySelector(n)&&(t=!0)),r(32,Me[e]=o||t?"invalid":"",Me)},Ke=e=>{if(!e)return 0;const[t,n=0]=e.split(":");return 60*t+parseInt(n)},Qe=(e,t,n=!1)=>{if(!t)return;const i=b.find(e=>e.name===t);if(!i)return;const o=i.properties.value.formula,{operator:s,argument:a}=o,l=a.map(t=>xe[e][t.refItem]||S[t.refItem]);let c=0;if("$preferred"===s)if(n)c="";else{const n=xe[e][t];if(S._id&&n!=("number"===i.type?0:void 0))return;c=l.reduce((e,t)=>{let n=e;return"number"===i.type?n=+(n||0)||+(t||0):n||=t,n})}if("$add"===s&&(c=l.reduce((e,t)=>+(e||0)+ +(t||0))),"$subtract"===s&&(c=l.reduce((e,t)=>{e||(e=""),t||(t=""),"number"==typeof e&&(e=e.toString());const[n,r]=e.split(":");e=r?(+n+ +r/60).toFixed(2):+(n||0);let[i,o]=t.split(":");return i||(i=0),e-=o?(+i+ +o/60).toFixed(2):+(i||0)})),"$multiply"===s&&(c=l.reduce((e,t)=>+(e||0)*+(t||0))),"$percentMultiply"===s){const[e,t]=l;c=+e,+t>0&&(c*=1-t/100)}if("$percentDivide"===s){const[e,t]=l;0!=+t&&(c=+e/+t*100)}if("$percentSubtract"===s){let[e,t]=l;t.replace&&(t=t.replace(",",".")),0!=+t&&(c=+e-e*+t/100)}const d=`#accordion-content-${R}-${E.name}-${e} .form-field.${t} .field input`,u=document.querySelector(d),f=u?.disabled;r(15,xe[e][t]="$multiply"===s?c?Je(c,i.properties?.decimals):"":Je(c,i.properties?.decimals),xe),r(34,Be={item:i,value:c,idx:e}),setTimeout(()=>{const t=document.querySelector(d);f&&t&&t.setAttribute("disabled",""),i._formulaActor&&Qe(e,i._formulaActor)},0)},Je=(e,t)=>(t||=0,"number"==typeof e&&e||(e=Number(e||0)),(+(Math.round(e+"e+"+t)+"e-"+t)).toFixed(t));ke=b.filter(e=>e.refClass).reduce((e,t)=>{const n=b.filter(e=>e.refItem===t.refClass);if(!n?.length)return e;if(t.selection){const[n,r]=t.selection.split(":"),[i]=r?.split(".")||[];i&&e.push({refClass:i,items:[n],selection:t.selection})}const r={refClass:t.refClass,items:[]};return n.forEach(e=>{r.items.push(e.name)}),e.push(r),e},[]);const et=async(e,t,n,i,o)=>{if(e.filter)return;const s=(await ke).find(e=>e.refClass===n.refClass);if(!s)return;const{refClass:a,items:l,selection:c}=s,d=n.name;if(Le.find(e=>e.itemName===d)){const n=`#accordion-content-${R}-${e.name}-${t} .form-field.${a}.hidden`;if(document.querySelector(n))return}return i?Promise.all(l.map(async e=>{let s=b.find(t=>t.name===e);if(!s)return;let d=s.refName||s.name,u="",f="";if(s.lookup){if(f=xe[t][s.name],r(15,xe[t][s.name]="",xe),!xe[t][s.refItem])return void r(15,xe[t][s.name]="",xe);let[e,n,i]=s.lookup.split(".");i||(i=n,n="");const o=s.lookupRefItem||s.refItem,a=s.lookupRefName||d,l=ct(s.refItem,D);let c,h=await Sp(l);if(c=h?.find(({_id:e})=>e==xe[t][s.refItem]),c||(c=await xp(s.refItem,xe[t][s.refItem])),c){if(s.refItem2){const e=await xp(s.refItem2,c[s.refItem2]);if("dealerPrice"===d&&S.branch){const e=await xp("branch",S.branch);e?.sector?.includes("Privat")&&(d="price")}e&&(u=e[d])}0===+u&&(u=c[d])}if(S[e]){const r=await xp(e,S[e]);if(r&&r[n]){const e=await xp(n,r[n]);if(e){const n=e[i].find(e=>e[o]===xe[t][o]);n&&(u=n[a])}}else if(r&&r[i]){const e=r[i].find(e=>e[o]===xe[t][o]);e&&(u=e[a])}}return xe[t][s.name]||r(15,xe[t][s.name]=u||f,xe),void await Qe(t,s._formulaActor)}if(s.properties?.readonly&&!n.refInput){const i=xe[t][n.refClass];return Promise.resolve(xp(n.refClass,i,!0)).then(n=>{let i=s.refPos?n[s.refPos]||qe(s.refPos,n):n[e];void 0!==s.factor&&(i*=s.factor),Array.isArray(i)&&(i=i.length?i[0][e]:""),r(15,xe[t][e]=i,xe),s._formulaActor&&Qe(t,s._formulaActor)})}const{refInput:h}=n;if(h&&xe[t]){const[e,n]=h.split(".");u=n?xe[t][n]:S[e]}if(c&&i!==o)l.map(e=>{r(15,xe[t][e]="",xe)});else{if(s.refItem2){const[n,i]=s.refItem2.split(".");S[n]&&xp(n,S[n]).then(n=>{n&&+n[i]&&r(15,xe[t][e]=n[i],xe)})}if(h&&!u||tt(t,e)||o!==i){const i=b.find(e=>e.refClass===a),o=xe[t][i.name];if(n.selection){const[i,s]=n.selection.split(":"),[a,l]=s?.split(".");if(i&&a&&l){const s=await xp(a,xe[t][a]);if(s&&s[l]&&s[l].find(e=>e[i]===o)){const i=Dp(n.selection+o.toString());if(i)return Promise.resolve(i).then(n=>r(15,xe[t][e]=n[e],xe))}}}const l=ct(i.refClass,D);let c=await Sp(l);if(c){const n=c.find(({_id:e})=>e==o);if(n)return Promise.resolve(()=>{r(15,xe[t][e]=n[e],xe)})}if(o)return Promise.resolve(xp(i.refClass,o)).then(n=>r(15,xe[t][e]=n[s.refInput||e],xe))}}})):Promise.resolve(l.map(e=>{r(15,xe[t][e]="",xe)}))},tt=(e,t)=>{let n=xe[e][t];return"number"===b.find(e=>e.name===t).type&&(n=Number(n||0)),!n},nt=e=>{if(!e)return;const{style:t,scrollHeight:n}=e;n&&(t.height=`${n}px`)};let rt=!1;const it=e=>!E.sort&&!(!k&&e>=xe.length-1),ot=(e,t=!1)=>{const[n,r]=e.split(";");return E.name===r&&(!!it(t)&&((!1===t||t!=n)&&parseInt(n)))};b.filter(e=>e.properties?.value?.formula?.argument).forEach(e=>{e.properties.value.formula.argument.forEach(t=>{const n=b.find(e=>e.name===t.refItem)||b.find(e=>e.name===t.refItem);n&&(n._formulaActor=e.name)})});const st=(e,t=!1)=>{const n=`#accordion-content-${R}-${E.name}-${e} > div.form-field:not(.hidden)`,i=document.querySelectorAll(n);if(!i?.length)return;const o=i[i.length-1];ce().then(()=>{const t=`#accordion-content-${R}-${E.name}-${e} textarea`;Array.from(document.querySelectorAll(t)).forEach(nt)}).then(()=>{t&&o.scrollIntoView({behavior:"smooth",block:"end"})});for(const t of b){"number"==typeof t.properties?.value&&r(15,xe[e][t.name]=t.properties.value,xe);const n=E.preserve&&E.preserve.includes(t.preset);if(t.preset&&!n&&!xe[e][t.name]){const n=Te.get(t.preset);n&&r(15,xe[e][t.name]=n,xe)}!S._id&&t.refItem&&S[t.refItem]&&xp(t.refItem,S[t.refItem]).then(n=>r(15,xe[e][t.name]=n[t.name],xe))}if(!(e<1)&&xe?.length&&e===xe.length-1&&E.preserve&&!S._id)for(const t of E.preserve){if(!xe[e-1][t])continue;const n=We(xe[e-1][t],!0);r(15,xe[e][t]=n,xe),Te.set(t,n)}},at=new Map,lt=async()=>{if(!E.filter)return[];let e,n,r,{date:i,level:o,isDealer:s}=S;if(i)[e,n,r]=i.split(".");else{i=(new Date).toISOString();const t=i.split("T")[0];[r,n,e]=t.split("-")}const a=`${r}-${n}-${e}`,l=at.get("dv"),c=at.get("lv"),d=at.get("iv");if(l===a&&c===o&&d===!!s)return!1;let u;at.set("dv",a),at.set("lv",o),at.set("iv",!!s),u=s?{$ne:""}:{$in:[void 0,!1,""]};const f={dealer:u,"_task.status":"Ready",payable:{$lt:a},_total:{$gt:0}};o&&(f.levelReminder=o),o||(f.levelReminder={$in:[void 0,!1,""]});const h=[{$addFields:{_docId:{$toString:"$_id"}}},{$lookup:{from:"_task",localField:"_docId",foreignField:"docId",as:"_task"}},{$unwind:{path:"$_task",preserveNullAndEmptyArrays:!0}},{$match:f},{$sort:{payable:1,invoiceId:1}}];return await t.getSectionView("invoice",h)},ct=(e,t)=>"p$"+E.name+"$"+e+"$"+t,dt=async e=>{if(!E.filter){if(e[E.name]?.length)for(const n of b)if((n.properties?.prefetch||1e3)<e[E.name].length){const r=ct(n.refClass,D);if(Sp(r))continue;bp(r,[]);const i=ut(e[E.name],n.name);i?.length&&bp(r,t.getSectionView(n.refClass,{_id:{$in:i}}))}r(22,ue={record:e})}},ut=(e,t)=>Array.from(new Set(e.map(e=>e[t]).filter(e=>!!e))),ft=()=>{r(30,Ce=!1),r(27,$e=""),r(25,we=""),ye=!0,r(26,ve=""),r(28,Ie=""),r(24,he=!0)},ht=async({detail:e})=>{const{refItem:n,refValue:i,refDescription:o,keyboard:s,input:a}=de;let l,c="reader_";for(;e.text.length>s.length;)e.text=e.text.slice(1);if(ve===e.text&&e.item){const t=c+e.item.name;return l=document.getElementById(t),l.value=+(be.get(e.item.name)||0)+1,be.set(e.item.name,l.value),l.focus(),ye=!0,void r(25,we="")}if(r(30,Ce=!1),r(27,$e=""),r(26,ve=e.text||""),!ve)return;const d=b.find(e=>e.name===n)?.refClass;if(!d)return;let u=await t.getSectionView(d,{[i]:ve});u?.length?(u=u[0],r(28,Ie=u._id),r(27,$e=o.map(e=>u[e]).join(", ")),r(30,Ce=xe.find(e=>e[n]===Ie)),setTimeout(()=>{b.filter(e=>e.properties?.reader).forEach(e=>{const t=document.getElementById("reader_"+e.name);t&&(t.value=be.get(e.name)||(Ce?Ce[e.name]:"")),be.set(e.name,t.value)});let t=1;if(a){const{refItem:e,refValue:n}=a;for(const r of n){const{value:n,factor:i}=r,o=u[e];n.includes(","+o.split("-")[0]+"-,")&&(t=i)}}if(e.item){const n=c+e.item.name;l=document.getElementById(n),l.value=+(be.get(e.item.name)||0)+t,be.set(e.item.name,l.value),l.focus()}else{const e=b.find(e=>e.properties?.reader).name,n=c+e;l=document.getElementById(n),l.value=+(be.get(e)||0)+t,be.set(e,l.value),l.focus()}ye=!0,r(25,we="")},0)):setTimeout(()=>{ye=!0,r(25,we=""),r(26,ve=""),be=new Map;const e=document.getElementById("reader_focusId");e&&e.focus()},0)},mt=()=>{r(27,$e=""),r(28,Ie=""),r(30,Ce=!1),r(29,_e=!0),pt(),be=new Map},pt=()=>{if(!de.keyboard)return;const e=document.getElementById("reader_focusId");e&&e.focus()};Q(async()=>{if(!E.filter&&(fe||r(23,fe=await t.getEvent(D)),(S._id||!fe.input)&&!(xe.length>1)&&!x&&de?.autostart)){if("object"==typeof de.autostart){if(!de.autostart.user)return;{const e=s.user,[t,n]=de.autostart.user.split(":"),r=A.find(e=>e.name===t),i=r?.refClass;if(!i||!n)return;const o=await xp(i,S[t]);if(!o)return;if(o[n]!==e)return}}else if(!0!==de.autostart)return;Ee=!1,ft()}});const gt=e=>{const t=xe.find(t=>{const n=E.merge.id||[E.merge.item];let r=!0;for(const i of n)r&&(r=e[i]===t[i]);return r});return t},wt=e=>{const t=gt(e);return t?t.price:e.price},yt=(e,t)=>{const n=gt(e);return n?n.quantity:t};return e.$$set=e=>{"list"in e&&r(4,E=e.list),"mainSchema"in e&&r(89,A=e.mainSchema),"schema"in e&&r(90,b=e.schema),"record"in e&&r(0,S=e.record),"multiValues"in e&&r(5,T=e.multiValues),"classId"in e&&r(6,R=e.classId),"eventId"in e&&r(7,D=e.eventId),"disabled"in e&&r(1,x=e.disabled),"fixed"in e&&r(2,k=e.fixed),"template"in e&&r(91,O=e.template),"reqQuantity"in e&&r(3,M=e.reqQuantity),"open"in e&&r(12,P=e.open),"currency"in e&&r(8,B=e.currency),"notifyList"in e&&r(9,L=e.notifyList),"shortEdit"in e&&r(10,F=e.shortEdit),"dateInput"in e&&r(11,V=e.dateInput),"listInput"in e&&r(92,U=e.listInput),"refresh"in e&&r(87,W=e.refresh),"listValues"in e&&r(88,z=e.listValues)},e.$$.update=()=>{if(16&e.$$.dirty[0]|1&e.$$.dirty[1]|33554432&e.$$.dirty[2]&&E.sort&&W&&W[E.name]&&(r(15,xe=W[E.name]),Ne={},r(88,z[E.name]=[],z),r(87,W=!1),r(31,Se+=1)),528&e.$$.dirty[0]&&L)if(Array.isArray(E.source)&&E.source?.length)E.item?.length&&(async e=>{const{refItem:n}=E,{listName:i,itemName:o,oldValue:s,value:a}=e;if(o!==n)return;if(s===a)return;if(!a&&s)return r(0,S[E.name]=[],S),void r(15,xe=[]);if(!a)return;let l=[];for(const e of E.source){let{refItem:n,refDestination:r,destination:i,quantity:s}=e;if(!n.startsWith(o))continue;let c,d,u="",[f,h,m]=n.split(".");if(m||(m=h,h=""),h&&s.includes("=")){const e=Re(s);s=e.quantity,c=e._d2,d=e._d3}const[p,g]=r.split("."),w=await t.getSectionView(p,{[g]:i}),y=await xp(f,a);h?c&&d&&s&&(u=y[h].reduce((e,t)=>{const n=t[c],r=t[d]||1e3;return+s>=+n&&+s<=+r?t[m]:e},"0.00")):u=y[m],w?.length&&(l=l.concat({[p]:w[0]._id.toString(),quantity:s,price:u}))}l.length&&r(0,S[E.name]=l,S)})(L);else if(E.add)(async e=>{if(S._id)return;const{refItem:n}=E,{item:i,filter:o}=E.add;if(e.itemName!==n)return;if(!e.value)return void r(0,S[E.name]=[],S);let s=await t.getSectionView(i,{});s=s.filter(e=>+e[o]).map(e=>(e[i]=e._id,e.quantity=1,e)),r(15,xe=s)})(L);else if(E.merge)(async e=>{const{refItem:t}=E,{itemName:n,oldValue:i,value:o}=e;n===t&&i!==o&&(o||r(15,xe=[]))})(L);else if(!E.filter){const{listName:e,itemName:t,oldValue:n,value:i}=L;e&&e===E.name&&r(0,S[e]=i,S),t&&(Te.set(t,i),t===E.name&&r(0,S[t]=i,S))}1&e.$$.dirty[0]&&Fe(S),32768&e.$$.dirty[0]&&r(16,i=xe),122896&e.$$.dirty[0]&&i&&((()=>{if(Z)r(17,K=xe?.reduce((e,t)=>e+(t._delete?0:+(t.quantity||0)),0)||0)})(),(()=>{if(ne)r(14,re=xe?.reduce((e,t)=>e+(t._delete?0:+(t[J]||0)),0)||0)})(),(()=>{if(G)r(13,Y=xe?.reduce((e,t)=>{if(t.amount){const n=t.amount??0;e+=t._delete?0:+n}else if(t.price){const n=(X?t.quantity??0:1)*(t.price??0);e+=t._delete?0:n}else if(t.value){const n=t.value??0;e+=t._delete?0:+n}return e},0)||0)})(),ce().then(()=>_("save",{listName:E.name,value:xe,amountValue:Y,weeksValue:re}))),1&e.$$.dirty[3]&&(o=e=>ae[e]?.split(" • ").filter(e=>!!e&&!/^[0-9a-f]{24}/.test(e)).slice(0,2).join(" · "))},[S,x,k,M,E,T,R,D,B,L,F,V,P,Y,re,xe,i,K,ie,oe,se,de,ue,fe,he,we,ve,$e,Ie,_e,Ce,Se,Me,Pe,Be,a,l,d,h,y,v,$,C,undefined,G,{name:"amountValue",properties:{decimals:2}},Z,{name:"hoursValue",properties:{decimals:2}},ne,{name:"weeksValue",properties:{decimals:1}},Ae,Te,De,Oe,async()=>{if(!x&&(fe||r(23,fe=await t.getEvent(D)),(S._id||!fe.input)&&de&&!de.keyboard))try{const e=await Yf();e?.length||r(21,de=!1)}catch{}},(e,t)=>{if(1===xe.length&&E.merge&&0===t)return"";let n=e[t];Ne["pos"+t]&&(n=Ne["pos"+t]);let i=b;E.display?.refItem&&(i=E.display.refItem.map(e=>{let[t,n]=e.split(".");const r=b.find(e=>e.name===t);if(r)return r._attr=n,r}).filter(e=>!!e));let o=n&&i.filter(e=>!0!==e.properties?.hidden&&("dateRange"===e.type||void 0!==n[e.name])&&"html"!==e.properties?.format&&"textarea"!==e.properties?.format).map(e=>Ve(e,n)).filter(e=>!!e).join(" • ")||"+";if(E.sort){const e=n&&i.filter(e=>!0!==e.properties?.hidden&&("dateRange"===e.type||void 0!==n[e.name])&&"html"!==e.properties?.format&&"textarea"!==e.properties?.format).map(e=>Ve(e,n)).join(" • ");r(88,z[E.name][t]=e,z)}if(le?.item&&n[le.item]){o=`<span style="color: ${le?.color||"red"};">${o}</span>`}return o},e=>({detail:{row:t}})=>{if(_("task",{row:t}),!S._id&&t._id){for(let t=0;t<xe.length;t++)for(const n of e.item)Xe(e,t,n,!ie);r(18,ie=!0)}},He,({detail:e})=>{const{idx:t,value:n}=e;Ze(t,n)},async({detail:{className:e,itemName:n,value:r}})=>{if(ge.has(e))return;if(!0!==r&&(r=(r=[].concat(r)).some(e=>e===pe+"."+E.name)),!r)return;const i={[n]:!0},o=await t.getSectionView(e,i);o?.length&&ge.set(e,o[0])},({detail:e})=>{const{idx:t,fieldId:n,value:r}=e;if(!r)return;const i=Ke(r);let o=!1;xe.forEach((e,n)=>{if(t===n)return;const{start:r,end:s}=xe[n];r&&s&&i>Ke(r)&&i<Ke(s)&&(o=!0)});const s=document.getElementById(n);s?.classList?.toggle("invalid",o)},e=>({detail:t})=>{if(t.string)r(15,xe[e][t.itemName]=t.value,xe);else{r(15,xe[e][t.itemName]=Je(t.value,t.decimals),xe);const n=b.find(e=>e.name===t.itemName&&e._formulaActor);n&&Qe(e,n._formulaActor,!0)}},async({detail:e})=>{const{className:t,row:n}=e,i=await xp(t,n._id);if(!i?.messageId)return;let o=[...xe];const s={...o.find(e=>e.messageId==i.messageId)};s[t]=n._id;const a=E.name.slice(4),l=[...S[a]].concat(s);_("save",{listName:a,value:l,listInput:!0}),r(15,xe=o.filter(e=>e.messageId!=i.messageId)),_("save",{listName:E.name,value:xe}),xe?.length||_("save",{itemName:"status",value:"abgeschlossen"}),setTimeout(()=>{_("saveFull")},2e3)},(e,t,n)=>n=>{E.merge&&xe.length===t+1||xe[t]._delete||(e(n),st(t,!0))},(e,t,n)=>i=>{if(r(15,xe[e]._delete=!xe[e]._delete,xe),xe[e]._delete){Ne["pos"+e]={...xe[e]};for(const t of b)r(15,xe[e][t.name]="",xe);t&&n(i)}else{if(Ne["pos"+e]){const t={};for(const n of b)t[n.name]=Ne["pos"+e][n.name];r(15,xe[e]=t,xe)}Ne["pos"+e]=void 0,t||n(i)}},e=>t=>{t.preventDefault(),r(33,Pe=!1);const n=ot(t.dataTransfer.getData(Yh),e);if(!1===n)return;t.dataTransfer.dropEffect="move";const i=[...xe].map((e,t)=>(e._index=t,e));n<e?(i.splice(e+1,0,i[n]),i.splice(n,1)):(i.splice(e,0,i[n]),i.splice(n+1,1)),i.map((e,t)=>{return n=e._index,r=t,void Gh.set(r,n);var n,r});let o=[];Me.map((e,t)=>{o[t]=Me[(e=>{const t=Gh.get(e);return void 0===t?e:t})(t)]}),r(32,Me=o),r(15,xe=i.map((e,t)=>(delete e._index,e))),rt=!1},e=>t=>{if(!it(e))return!1;t.dataTransfer.effectAllowed="move",t.dataTransfer.dropEffect="move",t.dataTransfer.setData(Yh,e+";"+E.name),rt=e},e=>t=>{const n=ot(t.dataTransfer.getData(Yh),e)||rt;return!1===n||n===e?r(33,Pe=!1):void r(33,Pe={top:n>e&&e,bottom:n<e&&e})},e=>e.preventDefault(),e=>e=>{r(33,Pe=!1)},(e,t)=>n=>{setTimeout(()=>{Array.from(ge).forEach(([t,n])=>{xe[e][t]||r(15,xe[e][t]=n._id,xe)})},500);const i=new Set;for(const e of Le)i.add(e.refObj||pe);for(const t of Array.from(i))Ye(e,t);t(n),st(e)},e=>({detail:t})=>{Qe(e,t.item.name)},e=>async({detail:t})=>{const{itemName:n,itemType:i,source:o,target:s,sourceId:a,prop:l}=t;if(!a)return void r(15,xe[e][n]="",xe);let c=await xp(o,a);const d=c[l];c=await xp(E.name,S[E.name][e][E.name]);const u=c[s];let f="number"===i?0:"",h=0;u.forEach(e=>{const t=e[l];t.length<=h||t.every(e=>d.find(t=>t===e))&&(f=e[n],h=t.length)}),r(15,xe[e][n]=f,xe)},e=>e?.description||"Daten übernehmen",ft,ht,()=>{ye=!0,r(25,we="")},(e,t=!1)=>t?(mt(),""):b.find(t=>t.name===e)?.designation||"",mt,()=>{const{refItem:e}=de,t={[e]:Ie};let n;b.filter(e=>e.properties?.reader).forEach(e=>{const n=document.getElementById("reader_"+e.name);n&&(t[e.name]=n.value||("number"===e.type?0:""))});let i=xe;const o=i.findIndex(t=>t[e]===Ie);o>=0?(n=i[o],i[o]={...n,...t}):i=i.slice(0,-1).concat(t),r(15,xe=i),b.filter(e=>e.properties?.reader).forEach(e=>{He(e,o>=0?o:0)({detail:{oldValue:n?n[e.name]:"",value:t[e.name]}})}),Ee=!0,mt()},()=>{Ee&&(_("readerSave"),Ee=!1)},()=>{const e=new Map;De.forEach(t=>{[].concat(t.properties.transfer.target).forEach(n=>{e.set(n,t.name)})});let t=0;for(const n of xe){for(const[i,o]of e)!n[i]&&n[o]&&r(15,xe[t][i]=n[o],xe);t++}r(16,i=xe)},(e,t)=>n=>{const{data:i}=n;"0123456789".includes(i)&&(ye?(r(25,we=i.toString()),ye=!1):(r(25,we+=i.toString()),"77"===we&&r(25,we="7"),we.length===e&&ht({detail:{text:we,item:t}})))},()=>{r(19,oe=!1)},({detail:e})=>{r(19,oe=!1);const{list:t}=e,n=[];for(const e of t)n.push({article:e.article,designation:e.designation,quantity:yt(e,e.perWeek?Re(E.merge.quantity).quantity:1),price:wt(e)});n.push({}),r(15,xe=n)},e=>{e.stopImmediatePropagation();const t=E.merge.id||[E.merge.item];r(20,se=xe.map(e=>(e=>{const n={};for(const r of t)n[r]=e[r];return n})(e))),r(19,oe=!0)},e=>!E.merge||!(e>0&&xe.length===e+1),W,z,A,b,O,U,ae,function(e){re=e,r(14,re)},function(e){K=e,r(17,K)},function(e){Y=e,r(13,Y)},function(t){te(e,t)},function(e){_e=e,r(29,_e)},function(e){he=e,r(24,he)},function(e){oe=e,r(19,oe)}]}class Kh extends xe{constructor(e){var t;super(),Qf.getElementById("svelte-ai576v-style")||((t=M("style")).id="svelte-ai576v-style",t.textContent=".accordion.svelte-ai576v{display:flex;overflow:hidden}.accordion-content.svelte-ai576v{position:relative}.formList .accordion > .btn{display:inline-block;margin-bottom:1em;background-color:#F5F5F5}.sTask .formList .accordion > .btn{width:95% !important}.sEmbedded .formList .accordion > .btn{width:97%}@media screen and (max-width: 600px){.formList .accordion > .btn{width:25em}}span.pointer.svelte-ai576v{padding-top:1em}div.delete.svelte-ai576v{text-decoration:line-through}.icon.svelte-ai576v{margin-right:-0.75em}.icon2.svelte-ai576v{display:inline-flex;padding-top:0 !important;float:left}.form-field .formField_italic{font-style:italic}.panel.invalid .btn{border:1px #b80000 solid}.draggableListItem.svelte-ai576v{cursor:drag}.draggableListItem.is-active-top.svelte-ai576v{border-top:3px purple solid;padding-top:2em}.draggableListItem.is-active-bottom.svelte-ai576v{border-bottom:3px purple solid;padding-bottom:2em}.modal-overlay > .dialog.reader{margin-top:0}.align-left.svelte-ai576v{text-align:left}",D(Qf.head,t)),De(this,e,Zh,qh,S,{list:4,mainSchema:89,schema:90,record:0,multiValues:5,classId:6,eventId:7,disabled:1,fixed:2,template:91,reqQuantity:3,open:12,currency:8,notifyList:9,shortEdit:10,dateInput:11,listInput:92,refresh:87,listValues:88},[-1,-1,-1,-1,-1,-1])}}const{Boolean:Qh,document:Jh}=Ee;function em(e,t,n){const r=e.slice();return r[219]=t[n],r[221]=n,r}function tm(e,t,n){const r=e.slice();return r[223]=t[n],r}function nm(e,t,n){const r=e.slice();return r[226]=t[n],r}function rm(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function im(e){let t,n,r=e[222]&&function(e){let t,n,r,i,o,s,a,l,c,d,u,f,h,m,p,g,w,y,v,$,I=e[26]&&om(e),_=e[44]&&am(e),C=e[0].items,E=[];for(let t=0;t<C.length;t+=1)E[t]=dm(nm(e,C,t));const b=e=>Ie(E[e],1,1,()=>{E[e]=null});let S=e[0].list&&um(e),N=!e[4]&&!e[2]&&e[42]&&e[5]&&!e[49]&&Im(e);f=new e[54]({props:{outline:!0,$$slots:{default:[Cm]},$$scope:{ctx:e}}}),f.$on("click",e[74]);let R=e[39]&&!e[38]&&!!e[49]&&Em(e);const P=[Nm,Sm,bm],B=[];function F(e,t){return e[13]?0:e[42]?1:2}return p=F(e),g=B[p]=P[p](e),{c(){t=M("section"),I&&I.c(),n=L(),_&&_.c(),r=L(),i=M("form"),o=M("input"),a=L();for(let e=0;e<E.length;e+=1)E[e].c();l=L(),S&&S.c(),c=L(),N&&N.c(),d=L(),u=M("div"),Ne(f.$$.fragment),h=L(),R&&R.c(),m=L(),g.c(),z(o,"class",T(e[61])+" svelte-11r31hb"),z(o,"name","_id"),z(o,"type","hidden"),o.value=s=e[12]._id||"",z(i,"class",T(e[62])+" svelte-11r31hb"),z(i,"id",e[61]),z(u,"class",w=T(e[13]||e[7]?"form--buttons isReport":"form--buttons")+" svelte-11r31hb"),z(t,"class",T(e[63])+" svelte-11r31hb")},m(s,g){x(s,t,g),I&&I.m(t,null),D(t,n),_&&_.m(t,null),D(t,r),D(t,i),D(i,o),D(i,a);for(let e=0;e<E.length;e+=1)E[e].m(i,null);D(i,l),S&&S.m(i,null),D(t,c),N&&N.m(t,null),D(t,d),D(t,u),Te(f,u,null),D(u,h),R&&R.m(u,null),D(u,m),B[p].m(u,null),y=!0,v||($=[V(i,"keydown",e[81]),V(i,"submit",U(e[73]))],v=!0)},p(e,a){if(e[26]?I?(I.p(e,a),67108864&a[0]&&$e(I,1)):(I=om(e),I.c(),$e(I,1),I.m(t,n)):I&&(ye(),Ie(I,1,1,()=>{I=null}),ve()),e[44]?_?(_.p(e,a),8192&a[1]&&$e(_,1)):(_=am(e),_.c(),$e(_,1),_.m(t,r)):_&&(ye(),Ie(_,1,1,()=>{_=null}),ve()),(!y||4096&a[0]&&s!==(s=e[12]._id||""))&&(o.value=s),9195521&a[0]|1074003988&a[1]|520610320&a[2]){let t;for(C=e[0].items,t=0;t<C.length;t+=1){const n=nm(e,C,t);E[t]?(E[t].p(n,a),$e(E[t],1)):(E[t]=dm(n),E[t].c(),$e(E[t],1),E[t].m(i,l))}for(ye(),t=C.length;t<E.length;t+=1)b(t);ve()}e[0].list?S?(S.p(e,a),1&a[0]&&$e(S,1)):(S=um(e),S.c(),$e(S,1),S.m(i,null)):S&&(ye(),Ie(S,1,1,()=>{S=null}),ve()),e[4]||e[2]||!e[42]||!e[5]||e[49]?N&&(ye(),Ie(N,1,1,()=>{N=null}),ve()):N?(N.p(e,a),52&a[0]|264192&a[1]&&$e(N,1)):(N=Im(e),N.c(),$e(N,1),N.m(t,d));const c={};4096&a[7]&&(c.$$scope={dirty:a,ctx:e}),f.$set(c),e[39]&&!e[38]&&e[49]?R?(R.p(e,a),262528&a[1]&&$e(R,1)):(R=Em(e),R.c(),$e(R,1),R.m(u,m)):R&&(ye(),Ie(R,1,1,()=>{R=null}),ve());let h=p;p=F(e),p===h?B[p].p(e,a):(ye(),Ie(B[h],1,1,()=>{B[h]=null}),ve(),g=B[p],g?g.p(e,a):(g=B[p]=P[p](e),g.c()),$e(g,1),g.m(u,null)),(!y||8320&a[0]&&w!==(w=T(e[13]||e[7]?"form--buttons isReport":"form--buttons")+" svelte-11r31hb"))&&z(u,"class",w)},i(e){if(!y){$e(I),$e(_);for(let e=0;e<C.length;e+=1)$e(E[e]);$e(S),$e(N),$e(f.$$.fragment,e),$e(R),$e(g),y=!0}},o(e){Ie(I),Ie(_),E=E.filter(Qh);for(let e=0;e<E.length;e+=1)Ie(E[e]);Ie(S),Ie(N),Ie(f.$$.fragment,e),Ie(R),Ie(g),y=!1},d(e){e&&k(t),I&&I.d(),_&&_.d(),O(E,e),S&&S.d(),N&&N.d(),Re(f),R&&R.d(),B[p].d(),v=!1,A($)}}}(e);return{c(){r&&r.c(),t=F()},m(e,i){r&&r.m(e,i),x(e,t,i),n=!0},p(e,t){e[222]&&r.p(e,t)},i(e){n||($e(r),n=!0)},o(e){Ie(r),n=!1},d(e){r&&r.d(e),e&&k(t)}}}function om(e){let t,n;return t=new e[54]({props:{disabled:e[49]||e[12]._id,filled:!0,style:"opacity: 0.75; margin-bottom: .5em;",$$slots:{default:[sm]},$$scope:{ctx:e}}}),t.$on("click",e[98]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};4096&n[0]|262144&n[1]&&(r.disabled=e[49]||e[12]._id),4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function sm(e){let t,n,r;return n=new Ge({props:{size:"18"}}),{c(){t=M("span"),t.textContent="QR Code scannen",Ne(n.$$.fragment),q(t,"margin-right",".75em")},m(e,i){x(e,t,i),Te(n,e,i),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n,e)}}}function am(e){let t,n;return t=new e[54]({props:{filled:!0,style:"opacity: 0.75; margin-bottom: .5em;",$$slots:{default:[lm]},$$scope:{ctx:e}}}),t.$on("click",e[96]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function lm(e){let t,n,r;return n=new ut({props:{size:"18"}}),{c(){t=M("span"),t.textContent="Dokument ergänzen",Ne(n.$$.fragment),q(t,"margin-right",".75em")},m(e,i){x(e,t,i),Te(n,e,i),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n,e)}}}function cm(e){let t,n;return t=new Su({props:{classId:e[61],item:e[226],selection:e[226].selection,record:e[12],disabled:e[49],eventId:e[71],multiValues:e[66],notifyList:e[14],toDelete:e[23],currency:e[18],ownCurrency:e[19],changeValue:e[35],initFinished:e[33]}}),t.$on("save",e[80]),t.$on("saveFull",e[78]),t.$on("saveDialog",e[79]),t.$on("task",e[75]),t.$on("notify",e[76]),t.$on("safeReference",e[87]),t.$on("multi",e[77]),t.$on("defPrep",e[86]),t.$on("record",e[88]),t.$on("objRecord",e[89]),t.$on("formula",e[90]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};1&n[0]&&(r.item=e[226]),1&n[0]&&(r.selection=e[226].selection),4096&n[0]&&(r.record=e[12]),262144&n[1]&&(r.disabled=e[49]),16384&n[0]&&(r.notifyList=e[14]),8388608&n[0]&&(r.toDelete=e[23]),262144&n[0]&&(r.currency=e[18]),524288&n[0]&&(r.ownCurrency=e[19]),16&n[1]&&(r.changeValue=e[35]),4&n[1]&&(r.initFinished=e[33]),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function dm(e){let t,n,r="list"!==e[226].type&&cm(e);return{c(){r&&r.c(),t=F()},m(e,i){r&&r.m(e,i),x(e,t,i),n=!0},p(e,n){"list"!==e[226].type?r?(r.p(e,n),1&n[0]&&$e(r,1)):(r=cm(e),r.c(),$e(r,1),r.m(t.parentNode,t)):r&&(ye(),Ie(r,1,1,()=>{r=null}),ve())},i(e){n||($e(r),n=!0)},o(e){Ie(r),n=!1},d(e){r&&r.d(e),e&&k(t)}}}function um(e){let t,n,r,i,o,s=e[8]&&e[67]&&e[20]&&0!=e[20]&&fm(e),a=e[8]&&e[21]&&mm(e),l=e[68]&&e[34]&&0!=e[34]&&gm(e),c=e[0].list,d=[];for(let t=0;t<c.length;t+=1)d[t]=$m(tm(e,c,t));const u=e=>Ie(d[e],1,1,()=>{d[e]=null});return{c(){s&&s.c(),t=L(),a&&a.c(),n=L(),l&&l.c(),r=L();for(let e=0;e<d.length;e+=1)d[e].c();i=F()},m(e,c){s&&s.m(e,c),x(e,t,c),a&&a.m(e,c),x(e,n,c),l&&l.m(e,c),x(e,r,c);for(let t=0;t<d.length;t+=1)d[t].m(e,c);x(e,i,c),o=!0},p(e,o){if(e[8]&&e[67]&&e[20]&&0!=e[20]?s?(s.p(e,o),1048832&o[0]&&$e(s,1)):(s=fm(e),s.c(),$e(s,1),s.m(t.parentNode,t)):s&&(ye(),Ie(s,1,1,()=>{s=null}),ve()),e[8]&&e[21]?a?(a.p(e,o),2097408&o[0]&&$e(a,1)):(a=mm(e),a.c(),$e(a,1),a.m(n.parentNode,n)):a&&(ye(),Ie(a,1,1,()=>{a=null}),ve()),e[68]&&e[34]&&0!=e[34]?l?(l.p(e,o),8&o[1]&&$e(l,1)):(l=gm(e),l.c(),$e(l,1),l.m(r.parentNode,r)):l&&(ye(),Ie(l,1,1,()=>{l=null}),ve()),51335237&o[0]|1074200672&o[1]|67437072&o[2]|16&o[3]){let t;for(c=e[0].list,t=0;t<c.length;t+=1){const n=tm(e,c,t);d[t]?(d[t].p(n,o),$e(d[t],1)):(d[t]=$m(n),d[t].c(),$e(d[t],1),d[t].m(i.parentNode,i))}for(ye(),t=c.length;t<d.length;t+=1)u(t);ve()}},i(e){if(!o){$e(s),$e(a),$e(l);for(let e=0;e<c.length;e+=1)$e(d[e]);o=!0}},o(e){Ie(s),Ie(a),Ie(l),d=d.filter(Qh);for(let e=0;e<d.length;e+=1)Ie(d[e]);o=!1},d(e){s&&s.d(e),e&&k(t),a&&a.d(e),e&&k(n),l&&l.d(e),e&&k(r),O(d,e),e&&k(i)}}}function fm(e){let t,n;return t=new e[55]({props:{name:"Total Dokument",nameClass:"formField_italic",$$slots:{default:[hm]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};1572864&n[0]|4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function hm(e){let t,n,r;function i(t){e[113](t)}let o={item:e[64],disabled:!0,currency:e[19]};return void 0!==e[20]&&(o.value=e[20]),t=new lo({props:o}),re.push(()=>Se(t,"value",i)),{c(){Ne(t.$$.fragment)},m(e,n){Te(t,e,n),r=!0},p(e,r){const i={};524288&r[0]&&(i.currency=e[19]),!n&&1048576&r[0]&&(n=!0,i.value=e[20],ue(()=>n=!1)),t.$set(i)},i(e){r||($e(t.$$.fragment,e),r=!0)},o(e){Ie(t.$$.fragment,e),r=!1},d(e){Re(t,e)}}}function mm(e){let t,n;return t=new e[55]({props:{name:"Total MWSt "+(e[22]?"("+e[22]+"%)":""),nameClass:"formField_italic",$$slots:{default:[pm]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};4194304&n[0]&&(r.name="Total MWSt "+(e[22]?"("+e[22]+"%)":"")),2621440&n[0]|4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function pm(e){let t,n,r;function i(t){e[114](t)}let o={item:e[65],disabled:!0,currency:e[19]};return void 0!==e[21]&&(o.value=e[21]),t=new lo({props:o}),re.push(()=>Se(t,"value",i)),{c(){Ne(t.$$.fragment)},m(e,n){Te(t,e,n),r=!0},p(e,r){const i={};524288&r[0]&&(i.currency=e[19]),!n&&2097152&r[0]&&(n=!0,i.value=e[21],ue(()=>n=!1)),t.$set(i)},i(e){r||($e(t.$$.fragment,e),r=!0)},o(e){Ie(t.$$.fragment,e),r=!1},d(e){Re(t,e)}}}function gm(e){let t,n;return t=new e[55]({props:{name:"Gesamtzeit in Wochen",nameClass:"formField_italic",$$slots:{default:[wm]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};8&n[1]|4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function wm(e){let t,n,r;function i(t){e[115](t)}let o={item:e[69],disabled:!0};return void 0!==e[34]&&(o.value=e[34]),t=new lo({props:o}),re.push(()=>Se(t,"value",i)),{c(){Ne(t.$$.fragment)},m(e,n){Te(t,e,n),r=!0},p(e,r){const i={};!n&&8&r[1]&&(n=!0,i.value=e[34],ue(()=>n=!1)),t.$set(i)},i(e){r||($e(t.$$.fragment,e),r=!0)},o(e){Ie(t.$$.fragment,e),r=!1},d(e){Re(t,e)}}}function ym(e){let t,n,r,i,o;function s(t){e[118](t)}t=new e[53]({props:{text:e[223].designation}});let a={classId:e[61],open:!e[2]&&1===e[0].list.length,list:e[223],template:e[36],eventId:e[71],schema:e[223].item,record:e[12],disabled:e[49],currency:e[223].foreignCurrency?e[18]:e[19],update:e[16]};return void 0!==e[14]&&(a.notifyList=e[14]),r=new Ii({props:a}),re.push(()=>Se(r,"notifyList",s)),{c(){Ne(t.$$.fragment),n=L(),Ne(r.$$.fragment)},m(e,i){Te(t,e,i),x(e,n,i),Te(r,e,i),o=!0},p(e,n){const o={};1&n[0]&&(o.text=e[223].designation),t.$set(o);const s={};5&n[0]&&(s.open=!e[2]&&1===e[0].list.length),1&n[0]&&(s.list=e[223]),32&n[1]&&(s.template=e[36]),1&n[0]&&(s.schema=e[223].item),4096&n[0]&&(s.record=e[12]),262144&n[1]&&(s.disabled=e[49]),786433&n[0]&&(s.currency=e[223].foreignCurrency?e[18]:e[19]),65536&n[0]&&(s.update=e[16]),!i&&16384&n[0]&&(i=!0,s.notifyList=e[14],ue(()=>i=!1)),r.$set(s)},i(e){o||($e(t.$$.fragment,e),$e(r.$$.fragment,e),o=!0)},o(e){Ie(t.$$.fragment,e),Ie(r.$$.fragment,e),o=!1},d(e){Re(t,e),e&&k(n),Re(r,e)}}}function vm(e){let t,n,r,i;function o(t){e[116](t)}function s(t){e[117](t)}let a={classId:e[61],open:e[25],list:e[223],template:e[37],eventId:e[71],schema:e[223].item,mainSchema:e[0].items,record:e[12],disabled:e[49],fixed:e[223].fixed,reqQuantity:e[24],currency:e[223].foreignCurrency?e[18]:e[19],notifyList:e[14],multiValues:e[66],shortEdit:e[6],dateInput:e[17],listInput:Op};return void 0!==e[47]&&(a.refresh=e[47]),void 0!==e[48]&&(a.listValues=e[48]),t=new Kh({props:a}),re.push(()=>Se(t,"refresh",o)),re.push(()=>Se(t,"listValues",s)),t.$on("save",e[80]),t.$on("saveFull",e[78]),t.$on("record",e[88]),t.$on("readerSave",e[97]),{c(){Ne(t.$$.fragment)},m(e,n){Te(t,e,n),i=!0},p(e,i){const o={};33554432&i[0]&&(o.open=e[25]),1&i[0]&&(o.list=e[223]),64&i[1]&&(o.template=e[37]),1&i[0]&&(o.schema=e[223].item),1&i[0]&&(o.mainSchema=e[0].items),4096&i[0]&&(o.record=e[12]),262144&i[1]&&(o.disabled=e[49]),1&i[0]&&(o.fixed=e[223].fixed),16777216&i[0]&&(o.reqQuantity=e[24]),786433&i[0]&&(o.currency=e[223].foreignCurrency?e[18]:e[19]),16384&i[0]&&(o.notifyList=e[14]),64&i[0]&&(o.shortEdit=e[6]),131072&i[0]&&(o.dateInput=e[17]),!n&&65536&i[1]&&(n=!0,o.refresh=e[47],ue(()=>n=!1)),!r&&131072&i[1]&&(r=!0,o.listValues=e[48],ue(()=>r=!1)),t.$set(o)},i(e){i||($e(t.$$.fragment,e),i=!0)},o(e){Ie(t.$$.fragment,e),i=!1},d(e){Re(t,e)}}}function $m(e){let t,n,r,i;const o=[vm,ym],s=[];function a(e,t){return"array"===e[223].type?0:1}return t=a(e),n=s[t]=o[t](e),{c(){n.c(),r=F()},m(e,n){s[t].m(e,n),x(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?s[t].p(e,i):(ye(),Ie(s[l],1,1,()=>{s[l]=null}),ve(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),$e(n,1),n.m(r.parentNode,r))},i(e){i||($e(n),i=!0)},o(e){Ie(n),i=!1},d(e){s[t].d(e),e&&k(r)}}}function Im(e){let t,n,r,i;function o(t){e[119](t)}let s={title:"",$$slots:{default:[_m]},$$scope:{ctx:e}};return void 0!==e[41]&&(s.checked=e[41]),n=new e[56]({props:s}),re.push(()=>Se(n,"checked",o)),{c(){t=M("div"),Ne(n.$$.fragment),z(t,"class","askNext"),q(t,"margin-top","1em"),q(t,"margin-left","23em")},m(e,r){x(e,t,r),Te(n,t,null),i=!0},p(e,t){const i={};4096&t[7]&&(i.$$scope={dirty:t,ctx:e}),!r&&1024&t[1]&&(r=!0,i.checked=e[41],ue(()=>r=!1)),n.$set(i)},i(e){i||($e(n.$$.fragment,e),i=!0)},o(e){Ie(n.$$.fragment,e),i=!1},d(e){e&&k(t),Re(n)}}}function _m(e){let t;return{c(){t=M("span"),t.textContent="Weiter erfassen",q(t,"margin-left",".75em")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Cm(e){let t;return{c(){t=B("Abbrechen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Em(e){let t,n;return t=new e[54]({props:{filled:!0,style:"opacity: 0.6;",$$slots:{default:[Am]},$$scope:{ctx:e}}}),t.$on("click",function(){b(e[82](e[1]))&&e[82](e[1]).apply(this,arguments)}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(n,r){e=n;const i={};4096&r[7]&&(i.$$scope={dirty:r,ctx:e}),t.$set(i)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Am(e){let t,n,r;return n=new xt({props:{size:"18"}}),{c(){t=M("span"),t.textContent=`${e[91]()}`,Ne(n.$$.fragment),q(t,"margin-right",".75em")},m(e,i){x(e,t,i),Te(n,e,i),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n,e)}}}function bm(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Sm(e){let t,n,r,i,o,s;const a=[Rm,Tm],l=[];function c(e,t){return e[7]?0:1}t=c(e),n=l[t]=a[t](e);let d=e[2]&&e[3]&&Pm(e),u=e[38]&&Lm(e);return{c(){n.c(),r=L(),d&&d.c(),i=L(),u&&u.c(),o=F()},m(e,n){l[t].m(e,n),x(e,r,n),d&&d.m(e,n),x(e,i,n),u&&u.m(e,n),x(e,o,n),s=!0},p(e,s){let f=t;t=c(e),t===f?l[t].p(e,s):(ye(),Ie(l[f],1,1,()=>{l[f]=null}),ve(),n=l[t],n?n.p(e,s):(n=l[t]=a[t](e),n.c()),$e(n,1),n.m(r.parentNode,r)),e[2]&&e[3]?d?(d.p(e,s),12&s[0]&&$e(d,1)):(d=Pm(e),d.c(),$e(d,1),d.m(i.parentNode,i)):d&&(ye(),Ie(d,1,1,()=>{d=null}),ve()),e[38]?u?(u.p(e,s),128&s[1]&&$e(u,1)):(u=Lm(e),u.c(),$e(u,1),u.m(o.parentNode,o)):u&&(ye(),Ie(u,1,1,()=>{u=null}),ve())},i(e){s||($e(n),$e(d),$e(u),s=!0)},o(e){Ie(n),Ie(d),Ie(u),s=!1},d(e){l[t].d(e),e&&k(r),d&&d.d(e),e&&k(i),u&&u.d(e),e&&k(o)}}}function Nm(e){let t,n,r,i;t=new e[54]({props:{filled:!0,style:"opacity: 0.75;",$$slots:{default:[qm]},$$scope:{ctx:e}}}),t.$on("click",e[84]);let o=e[40]&&Gm(e);return{c(){Ne(t.$$.fragment),n=L(),o&&o.c(),r=F()},m(e,s){Te(t,e,s),x(e,n,s),o&&o.m(e,s),x(e,r,s),i=!0},p(e,n){const i={};4096&n[7]&&(i.$$scope={dirty:n,ctx:e}),t.$set(i),e[40]?o?(o.p(e,n),512&n[1]&&$e(o,1)):(o=Gm(e),o.c(),$e(o,1),o.m(r.parentNode,r)):o&&(ye(),Ie(o,1,1,()=>{o=null}),ve())},i(e){i||($e(t.$$.fragment,e),$e(o),i=!0)},o(e){Ie(t.$$.fragment,e),Ie(o),i=!1},d(e){Re(t,e),e&&k(n),o&&o.d(e),e&&k(r)}}}function Tm(e){let t,n,r,i=!(e[43]||e[41])&&Dm(e),o=e[5]&&!e[49]&&km(e);return{c(){i&&i.c(),t=L(),o&&o.c(),n=F()},m(e,s){i&&i.m(e,s),x(e,t,s),o&&o.m(e,s),x(e,n,s),r=!0},p(e,r){e[43]||e[41]?i&&(ye(),Ie(i,1,1,()=>{i=null}),ve()):i?(i.p(e,r),5120&r[1]&&$e(i,1)):(i=Dm(e),i.c(),$e(i,1),i.m(t.parentNode,t)),e[5]&&!e[49]?o?(o.p(e,r),32&r[0]|262144&r[1]&&$e(o,1)):(o=km(e),o.c(),$e(o,1),o.m(n.parentNode,n)):o&&(ye(),Ie(o,1,1,()=>{o=null}),ve())},i(e){r||($e(i),$e(o),r=!0)},o(e){Ie(i),Ie(o),r=!1},d(e){i&&i.d(e),e&&k(t),o&&o.d(e),e&&k(n)}}}function Rm(e){let t,n;return t=new e[54]({props:{class:"close",disabled:e[49],form:e[61],filled:!0,type:"submit",$$slots:{default:[Mm]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};262144&n[1]&&(r.disabled=e[49]),4096&n[1]|4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Dm(e){let t,n;return t=new e[54]({props:{class:"close",disabled:e[49],form:e[61],filled:!0,type:"submit",$$slots:{default:[xm]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};262144&n[1]&&(r.disabled=e[49]),4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function xm(e){let t;return{c(){t=B("Speichern und schliessen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function km(e){let t,n;return t=new e[54]({props:{form:e[61],filled:!0,type:"submit",style:"opacity: 0.75;",$$slots:{default:[Om]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};4096&n[1]|4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Om(e){let t,n=(e[43]||"Speichern")+"";return{c(){t=B(n)},m(e,n){x(e,t,n)},p(e,r){4096&r[1]&&n!==(n=(e[43]||"Speichern")+"")&&H(t,n)},d(e){e&&k(t)}}}function Mm(e){let t,n=(e[43]||"Speichern")+"";return{c(){t=B(n)},m(e,n){x(e,t,n)},p(e,r){4096&r[1]&&n!==(n=(e[43]||"Speichern")+"")&&H(t,n)},d(e){e&&k(t)}}}function Pm(e){let t,n;return t=new e[54]({props:{disabled:e[49],danger:!0,outline:!0,$$slots:{default:[Bm]},$$scope:{ctx:e}}}),t.$on("click",e[92]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};262144&n[1]&&(r.disabled=e[49]),4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Bm(e){let t;return{c(){t=B("Löschen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Lm(e){let t,n,r,i,o;const s=[Vm,Fm],a=[];t=function(e){return e[70]?0:1}(e),n=a[t]=s[t](e);let l=e[40]&&Hm(e);return{c(){n.c(),r=L(),l&&l.c(),i=F()},m(e,n){a[t].m(e,n),x(e,r,n),l&&l.m(e,n),x(e,i,n),o=!0},p(e,t){n.p(e,t),e[40]?l?(l.p(e,t),512&t[1]&&$e(l,1)):(l=Hm(e),l.c(),$e(l,1),l.m(i.parentNode,i)):l&&(ye(),Ie(l,1,1,()=>{l=null}),ve())},i(e){o||($e(n),$e(l),o=!0)},o(e){Ie(n),Ie(l),o=!1},d(e){a[t].d(e),e&&k(r),l&&l.d(e),e&&k(i)}}}function Fm(e){let t,n;return t=new e[54]({props:{filled:!0,style:"opacity: 0.6;",$$slots:{default:[Um]},$$scope:{ctx:e}}}),t.$on("click",function(){b(e[82](e[1]))&&e[82](e[1]).apply(this,arguments)}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(n,r){e=n;const i={};4096&r[7]&&(i.$$scope={dirty:r,ctx:e}),t.$set(i)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Vm(e){let t,n;return t=new d({props:{text:e[70],extended:!0,$$slots:{default:[zm]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};2&n[0]|4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Um(e){let t,n,r;return n=new xt({props:{size:"18"}}),{c(){t=M("span"),t.textContent=`${e[91]()}`,Ne(n.$$.fragment),q(t,"margin-right",".75em")},m(e,i){x(e,t,i),Te(n,e,i),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n,e)}}}function Wm(e){let t,n,r;return n=new xt({props:{size:"18"}}),{c(){t=M("span"),t.textContent=`${e[91]()}`,Ne(n.$$.fragment),q(t,"margin-right",".75em")},m(e,i){x(e,t,i),Te(n,e,i),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n,e)}}}function zm(e){let t,n;return t=new e[54]({props:{filled:!0,style:"opacity: 0.6;",$$slots:{default:[Wm]},$$scope:{ctx:e}}}),t.$on("click",function(){b(e[82](e[1]))&&e[82](e[1]).apply(this,arguments)}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(n,r){e=n;const i={};4096&r[7]&&(i.$$scope={dirty:r,ctx:e}),t.$set(i)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Hm(e){let t,n;return t=new e[54]({props:{filled:!0,style:"opacity: 0.75;",$$slots:{default:[jm]},$$scope:{ctx:e}}}),t.$on("click",function(){b(e[83](e[1]))&&e[83](e[1]).apply(this,arguments)}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(n,r){e=n;const i={};4096&r[7]&&(i.$$scope={dirty:r,ctx:e}),t.$set(i)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function jm(e){let t,n,r;return n=new Mt({props:{size:"18"}}),{c(){t=M("span"),t.textContent="Daten",Ne(n.$$.fragment),q(t,"margin-right",".75em")},m(e,i){x(e,t,i),Te(n,e,i),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n,e)}}}function qm(e){let t,n,r;return n=new xt({props:{size:"18"}}),{c(){t=M("span"),t.textContent="Erstellen",Ne(n.$$.fragment),q(t,"margin-right",".75em")},m(e,i){x(e,t,i),Te(n,e,i),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n,e)}}}function Gm(e){let t,n;return t=new e[54]({props:{filled:!0,style:"opacity: 0.75;",$$slots:{default:[Xm]},$$scope:{ctx:e}}}),t.$on("click",e[85]),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Xm(e){let t,n,r;return n=new Mt({props:{size:"18"}}),{c(){t=M("span"),t.textContent="Daten",Ne(n.$$.fragment),q(t,"margin-right",".75em")},m(e,i){x(e,t,i),Te(n,e,i),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n,e)}}}function Ym(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Zm(e){let t;return{c(){t=B("Abbrechen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Km(e){let t;return{c(){t=B("Ja, bitte löschen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function Qm(e){let t,n,r,i,o,s,a,l,c,d;return a=new e[54]({props:{filled:!0,$$slots:{default:[Zm]},$$scope:{ctx:e}}}),a.$on("click",e[120]),c=new e[54]({props:{danger:!0,outline:!0,$$slots:{default:[Km]},$$scope:{ctx:e}}}),c.$on("click",e[95]),{c(){t=M("p"),n=B(e[11]),r=L(),i=M("p"),i.textContent="Das kann nicht rückgängig gemacht werden.",o=L(),s=M("div"),Ne(a.$$.fragment),l=L(),Ne(c.$$.fragment),z(s,"class","flex_div svelte-11r31hb")},m(e,u){x(e,t,u),D(t,n),x(e,r,u),x(e,i,u),x(e,o,u),x(e,s,u),Te(a,s,null),D(s,l),Te(c,s,null),d=!0},p(e,t){(!d||2048&t[0])&&H(n,e[11]);const r={};4096&t[7]&&(r.$$scope={dirty:t,ctx:e}),a.$set(r);const i={};4096&t[7]&&(i.$$scope={dirty:t,ctx:e}),c.$set(i)},i(e){d||($e(a.$$.fragment,e),$e(c.$$.fragment,e),d=!0)},o(e){Ie(a.$$.fragment,e),Ie(c.$$.fragment,e),d=!1},d(e){e&&k(t),e&&k(r),e&&k(i),e&&k(o),e&&k(s),Re(a),Re(c)}}}function Jm(e){let t,n,r;return n=new Le({props:{size:"25"}}),{c(){t=M("div"),Ne(n.$$.fragment),z(t,"slot","title-icon")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function ep(e){let t,n;return t=new e[52]({props:{title:"Bestätigung",closeCallback:e[218],danger:!0,$$slots:{"title-icon":[Jm],default:[Qm]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};2&n[7]&&(r.closeCallback=e[218]),2048&n[0]|4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function tp(e){let t,n,r;function i(t){e[123](t)}let o={$$slots:{default:[up,({closeCallback:e})=>({218:e}),({closeCallback:e})=>[0,0,0,0,0,0,0,e?2:0]]},$$scope:{ctx:e}};return void 0!==e[27]&&(o.open=e[27]),t=new e[51]({props:o}),re.push(()=>Se(t,"open",i)),{c(){Ne(t.$$.fragment)},m(e,n){Te(t,e,n),r=!0},p(e,r){const i={};1946157056&r[0]|3&r[1]|4098&r[7]&&(i.$$scope={dirty:r,ctx:e}),!n&&134217728&r[0]&&(n=!0,i.open=e[27],ue(()=>n=!1)),t.$set(i)},i(e){r||($e(t.$$.fragment,e),r=!0)},o(e){Ie(t.$$.fragment,e),r=!1},d(e){Re(t,e)}}}function np(e){let t,n,r,i,o,s=e[101](e[26].refItem,!0)+"";return{c(){t=M("tr"),n=M("th"),r=M("div"),i=B(s),o=B(" nicht gefunden!"),q(r,"color","red"),z(n,"colspan","2")},m(e,s){x(e,t,s),D(t,n),D(n,r),D(r,i),D(r,o)},p(e,t){67108864&t[0]&&s!==(s=e[101](e[26].refItem,!0)+"")&&H(i,s)},d(e){e&&k(t)}}}function rp(e){let t,n,r,i,o,s=e[101](e[26].refItem)+"";return{c(){t=M("tr"),n=M("th"),r=M("div"),i=B(s),o=B(" bereits eingefügt!"),q(r,"color","red"),z(n,"colspan","2")},m(e,s){x(e,t,s),D(t,n),D(n,r),D(r,i),D(r,o)},p(e,t){67108864&t[0]&&s!==(s=e[101](e[26].refItem)+"")&&H(i,s)},d(e){e&&k(t)}}}function ip(e){let t;let n=function(e){return"number"===e[219].type?sp:op}(e),r=n(e);return{c(){r.c(),t=F()},m(e,n){r.m(e,n),x(e,t,n)},p(e,t){r.p(e,t)},d(e){r.d(e),e&&k(t)}}}function op(e){let t;return{c(){t=M("input"),z(t,"id","reader_"+e[219].name),z(t,"type","text")},m(e,n){x(e,t,n)},p:_,d(e){e&&k(t)}}}function sp(e){let t;return{c(){t=M("input"),q(t,"width","4em"),z(t,"id","reader_"+e[219].name),z(t,"type","number"),z(t,"min","0")},m(e,n){x(e,t,n)},p:_,d(e){e&&k(t)}}}function ap(e){let t,n,r,i,o,s,a=e[101](e[219].name)+"",l=e[28]&&e[29]&&ip(e);return{c(){t=M("tr"),n=M("th"),r=B(a),i=L(),o=M("td"),l&&l.c(),s=L()},m(e,a){x(e,t,a),D(t,n),D(n,r),D(t,i),D(t,o),l&&l.m(o,null),D(t,s)},p(e,t){e[28]&&e[29]?l?l.p(e,t):(l=ip(e),l.c(),l.m(o,null)):l&&(l.d(1),l=null)},d(e){e&&k(t),l&&l.d()}}}function lp(e){let t;return{c(){t=B("Verwerfen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function cp(e){let t;return{c(){t=B("Speichern")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function dp(e){let t,n,r,i,o,s,a,l,c,d,u,f,h,m,p,g,w,y,v,$,I,_,C,E,A,b=e[101](e[26].refItem)+"";function S(t){e[122](t)}let N={keyboard:e[26].keyboard,codeTypes:e[26].codeTypes};function T(e,t){return e[32]?rp:e[28]&&!e[30]?np:void 0}void 0!==e[31]&&(N.readerInit=e[31]),t=new Kf({props:N}),re.push(()=>Se(t,"readerInit",S)),t.$on("scan",e[99]),t.$on("exit",e[104]);let R=T(e),P=R&&R(e),F=e[100](),V=[];for(let t=0;t<F.length;t+=1)V[t]=ap(em(e,F,t));return _=new e[54]({props:{disabled:!e[28],outline:!0,style:"float: left;",$$slots:{default:[lp]},$$scope:{ctx:e}}}),_.$on("click",e[102]),E=new e[54]({props:{disabled:!e[30],filled:!0,style:"float: right;",$$slots:{default:[cp]},$$scope:{ctx:e}}}),E.$on("click",e[103]),{c(){Ne(t.$$.fragment),r=L(),i=M("div"),o=M("table"),s=M("tr"),a=M("th"),a.textContent="Code",l=L(),c=M("td"),d=B(e[28]),u=L(),f=M("tr"),h=M("th"),m=B(b),p=L(),g=M("td"),w=M("div"),y=B(e[29]),v=L(),P&&P.c(),$=L();for(let e=0;e<V.length;e+=1)V[e].c();I=L(),Ne(_.$$.fragment),C=L(),Ne(E.$$.fragment),q(w,"max-width","14em"),q(o,"margin-top","1em"),q(o,"margin-bottom","1em"),q(o,"text-align","left"),q(i,"position","relative"),q(i,"z-index","1000"),q(i,"background-color","white"),q(i,"height","225px")},m(e,n){Te(t,e,n),x(e,r,n),x(e,i,n),D(i,o),D(o,s),D(s,a),D(s,l),D(s,c),D(c,d),D(o,u),D(o,f),D(f,h),D(h,m),D(f,p),D(f,g),D(g,w),D(w,y),D(o,v),P&&P.m(o,null),D(o,$);for(let e=0;e<V.length;e+=1)V[e].m(o,null);D(i,I),Te(_,i,null),D(i,C),Te(E,i,null),A=!0},p(e,r){const i={};if(67108864&r[0]&&(i.keyboard=e[26].keyboard),67108864&r[0]&&(i.codeTypes=e[26].codeTypes),!n&&1&r[1]&&(n=!0,i.readerInit=e[31],ue(()=>n=!1)),t.$set(i),(!A||268435456&r[0])&&H(d,e[28]),(!A||67108864&r[0])&&b!==(b=e[101](e[26].refItem)+"")&&H(m,b),(!A||536870912&r[0])&&H(y,e[29]),R===(R=T(e))&&P?P.p(e,r):(P&&P.d(1),P=R&&R(e),P&&(P.c(),P.m(o,$))),805306368&r[0]|384&r[3]){let t;for(F=e[100](),t=0;t<F.length;t+=1){const n=em(e,F,t);V[t]?V[t].p(n,r):(V[t]=ap(n),V[t].c(),V[t].m(o,null))}for(;t<V.length;t+=1)V[t].d(1);V.length=F.length}const s={};268435456&r[0]&&(s.disabled=!e[28]),4096&r[7]&&(s.$$scope={dirty:r,ctx:e}),_.$set(s);const a={};1073741824&r[0]&&(a.disabled=!e[30]),4096&r[7]&&(a.$$scope={dirty:r,ctx:e}),E.$set(a)},i(e){A||($e(t.$$.fragment,e),$e(_.$$.fragment,e),$e(E.$$.fragment,e),A=!0)},o(e){Ie(t.$$.fragment,e),Ie(_.$$.fragment,e),Ie(E.$$.fragment,e),A=!1},d(e){Re(t,e),e&&k(r),e&&k(i),P&&P.d(),O(V,e),Re(_),Re(E)}}}function up(e){let t,n;return t=new e[52]({props:{title:"Scannen",class:"reader",closeCallback:e[218],$$slots:{default:[dp]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};2&n[7]&&(r.closeCallback=e[218]),1946157056&n[0]|3&n[1]|4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function fp(e){let t;return{c(){t=B("Abbrechen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function hp(e){let t,n,r,i,o;return i=new e[54]({props:{filled:!0,$$slots:{default:[fp]},$$scope:{ctx:e}}}),i.$on("click",e[124]),{c(){t=M("progress"),n=L(),r=M("div"),Ne(i.$$.fragment),q(t,"width","100%"),z(t,"id","file"),z(t,"max","100"),t.value=e[46],z(r,"class","flex_div svelte-11r31hb")},m(e,s){x(e,t,s),x(e,n,s),x(e,r,s),Te(i,r,null),o=!0},p(e,n){(!o||32768&n[1])&&(t.value=e[46]);const r={};4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),i.$set(r)},i(e){o||($e(i.$$.fragment,e),o=!0)},o(e){Ie(i.$$.fragment,e),o=!1},d(e){e&&k(t),e&&k(n),e&&k(r),Re(i)}}}function mp(e){let t,n,r;return n=new Le({props:{size:"25"}}),{c(){t=M("div"),Ne(n.$$.fragment),z(t,"slot","title-icon")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function pp(e){let t,n;return t=new e[52]({props:{title:"Auswertung wird erstellt",closeCallback:e[218],$$slots:{"title-icon":[mp],default:[hp]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};2&n[7]&&(r.closeCallback=e[218]),32768&n[1]|4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function gp(e){let t,n;return{c(){t=M("p"),n=B(e[10])},m(e,r){x(e,t,r),D(t,n)},p(e,t){1024&t[0]&&H(n,e[10])},d(e){e&&k(t)}}}function wp(e){let t;return{c(){t=B("Schliessen")},m(e,n){x(e,t,n)},d(e){e&&k(t)}}}function yp(e){let t,n,r,i,o;return t=new e[57]({props:{outline:!0,$$slots:{default:[gp]},$$scope:{ctx:e}}}),i=new e[54]({props:{danger:!0,outline:!0,$$slots:{default:[wp]},$$scope:{ctx:e}}}),i.$on("click",e[126]),{c(){Ne(t.$$.fragment),n=L(),r=M("div"),Ne(i.$$.fragment),z(r,"class","flex_div svelte-11r31hb")},m(e,s){Te(t,e,s),x(e,n,s),x(e,r,s),Te(i,r,null),o=!0},p(e,n){const r={};1024&n[0]|4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r);const o={};4096&n[7]&&(o.$$scope={dirty:n,ctx:e}),i.$set(o)},i(e){o||($e(t.$$.fragment,e),$e(i.$$.fragment,e),o=!0)},o(e){Ie(t.$$.fragment,e),Ie(i.$$.fragment,e),o=!1},d(e){Re(t,e),e&&k(n),e&&k(r),Re(i)}}}function vp(e){let t,n,r;return n=new Le({props:{size:"25"}}),{c(){t=M("div"),Ne(n.$$.fragment),z(t,"slot","title-icon")},m(e,i){x(e,t,i),Te(n,t,null),r=!0},p:_,i(e){r||($e(n.$$.fragment,e),r=!0)},o(e){Ie(n.$$.fragment,e),r=!1},d(e){e&&k(t),Re(n)}}}function $p(e){let t,n;return t=new e[52]({props:{title:"Speichern nicht erfolgreich",danger:!0,$$slots:{"title-icon":[vp],default:[yp]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,n){const r={};1536&n[0]|4096&n[7]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Ip(e){let t,n,r,i,o,s,a,l,c,d,u,f,h;Jh.title=t=e[50];let m={ctx:e,current:null,token:null,hasCatch:!1,pending:Ym,then:im,catch:rm,value:222,blocks:[,,,]};function p(t){e[121](t)}_e(e[72](),m);let g={$$slots:{default:[ep,({closeCallback:e})=>({218:e}),({closeCallback:e})=>[0,0,0,0,0,0,0,e?2:0]]},$$scope:{ctx:e}};void 0!==e[15]&&(g.open=e[15]),i=new e[51]({props:g}),re.push(()=>Se(i,"open",p));let w=e[26]&&e[27]&&tp(e);function y(t){e[125](t)}let v={$$slots:{default:[pp,({closeCallback:e})=>({218:e}),({closeCallback:e})=>[0,0,0,0,0,0,0,e?2:0]]},$$scope:{ctx:e}};function $(t){e[127](t)}void 0!==e[45]&&(v.open=e[45]),l=new e[51]({props:v}),re.push(()=>Se(l,"open",y));let I={$$slots:{default:[$p,({closeCallback:e})=>({218:e}),({closeCallback:e})=>[0,0,0,0,0,0,0,e?2:0]]},$$scope:{ctx:e}};return void 0!==e[9]&&(I.open=e[9]),u=new e[51]({props:I}),re.push(()=>Se(u,"open",$)),{c(){n=L(),m.block.c(),r=L(),Ne(i.$$.fragment),s=L(),w&&w.c(),a=L(),Ne(l.$$.fragment),d=L(),Ne(u.$$.fragment)},m(e,t){x(e,n,t),m.block.m(e,m.anchor=t),m.mount=()=>r.parentNode,m.anchor=r,x(e,r,t),Te(i,e,t),x(e,s,t),w&&w.m(e,t),x(e,a,t),Te(l,e,t),x(e,d,t),Te(u,e,t),h=!0},p(n,r){e=n,(!h||524288&r[1])&&t!==(t=e[50])&&(Jh.title=t),Ce(m,e,r);const s={};2048&r[0]|4098&r[7]&&(s.$$scope={dirty:r,ctx:e}),!o&&32768&r[0]&&(o=!0,s.open=e[15],ue(()=>o=!1)),i.$set(s),e[26]&&e[27]?w?(w.p(e,r),201326592&r[0]&&$e(w,1)):(w=tp(e),w.c(),$e(w,1),w.m(a.parentNode,a)):w&&(ye(),Ie(w,1,1,()=>{w=null}),ve());const d={};32768&r[1]|4098&r[7]&&(d.$$scope={dirty:r,ctx:e}),!c&&16384&r[1]&&(c=!0,d.open=e[45],ue(()=>c=!1)),l.$set(d);const p={};1536&r[0]|4096&r[7]&&(p.$$scope={dirty:r,ctx:e}),!f&&512&r[0]&&(f=!0,p.open=e[9],ue(()=>f=!1)),u.$set(p)},i(e){h||($e(m.block),$e(i.$$.fragment,e),$e(w),$e(l.$$.fragment,e),$e(u.$$.fragment,e),h=!0)},o(e){for(let e=0;e<3;e+=1){Ie(m.blocks[e])}Ie(i.$$.fragment,e),Ie(w),Ie(l.$$.fragment,e),Ie(u.$$.fragment,e),h=!1},d(e){e&&k(n),m.block.d(e),m.token=null,m=null,e&&k(r),Re(i,e),e&&k(s),w&&w.d(e),e&&k(a),Re(l,e),e&&k(d),Re(u,e)}}}let _p,Cp=new Map,Ep=new Map,Ap=new Map;const bp=(e,t)=>Cp.set(e,t),Sp=e=>Cp.get(e),Np=async(e,n)=>{if(e){const t="p$"+e+"$"+n,r=Cp.get(t);if(r?.length)return r}const r=n;return Cp.has(r)||(Cp.set(r,[]),Cp.set(r,t.getTasksList(n).then(({data:e})=>e))),Cp.get(r)},Tp=async(e,n,r,i=!1)=>{let o=Ep.get(r);if(!o)if(i)o=t.getTaskList(e,r),Ep.set(r,o);else{const i="p$"+e+"$"+n,s=await Cp.get(i);if(!s?.length)return Np(e,n).then(n=>(o=n.find(({_id:e})=>e===r),o||(o=t.getTaskList(e,r)),Ep.set(r,o),o));o=s.find(({_id:e})=>e===r),o||(o=t.getTaskList(e,r)),Ep.set(r,o)}return o},Rp=(e,t)=>{Ap.set(e,t)},Dp=e=>Ap.get(e),xp=(e,n,r=!1)=>{let i=!r&&Ap.get(n);return i||(i=t.getTask(e,n),Ap.set(n,i)),i},kp=(e,n)=>{if(!Cp.get(n))return;const r=n;Cp.set(r,t.getTasksList(n).then(({data:e})=>e))};let Op=!1;function Mp(e){let t="";if(function(e){return/^\d{4}-([0]\d|1[0-2])-([0-2]\d|3[01])/.test(e)}(e))return Pp(+e.replace("-",""));e=e.toUpperCase();for(let n=0;n<e.length;n++)t+=String.fromCharCode(90-(e.charCodeAt(n)-65));return t}function Pp(e){return 999999999999-e}function Bp(e){return new Promise(t=>setTimeout(t,e))}function Lp(e,s,l){let d,h,m,p,g,w,v,I;N(e,f,e=>l(147,g=e)),N(e,o,e=>l(148,w=e)),N(e,i,e=>l(149,v=e));const{Modal:_,Dialog:C,Divider:E,Button:A,FormField:b,Checkbox:S,Chip:T}=c,{loggedIn:D,currentTasks:x,environment:k}=u;N(e,D,e=>l(150,I=e)),N(e,x,e=>l(145,m=e)),N(e,k,e=>l(146,p=e)),JSON.parse(n.getItem("Locale"));const O=ee();let{schema:M}=s,{recID:P}=s,{deletable:B}=s,{prevEventID:L=!1}=s,{prev:F=!1}=s,{taskId:V=!1}=s,{taskOrg:U}=s,{description:W=""}=s,{root:z=!1}=s,{readonly:H}=s,{isStandalone:j}=s,{shortEdit:q=!1}=s,{shortSchema:G=!1}=s,{dialogAttr:X=!1}=s,Y=!0,Z=!1,K="",te="Willst du diese Daten löschen?",ne=window.location.href.split("/task/")[2];ne&&(ne=ne.split(":")[1],ne&&(ne=ne.split("?")[0])),q&&(M=G);let re,ie,oe,se,ae,le,de={},ue={},fe="form-"+M.class+Math.floor(9e3*Math.random()+1e3).toString(),he=!1,me=!1;const pe=z?"fEmbedded":"fTask",ge=z?"sEmbedded":"sTask";let we="CHF",ye="CHF";const ve=new Map;let $e,Ie,_e=0,Ce=0,Ee=0,Ae=0,be=1,Se=!P&&M.list&&1===M.list.length;const Ne={},Te={},Re=M.items.find(e=>"price"===e.name&&!e.properties?.hidden),De=M.items.find(e=>"quantity"===e.name&&!e.properties?.hidden),xe=M.items.find(e=>"amount"===e.name&&!e.properties?.hidden),ke=!!Re||!!xe,Oe=M.list?.filter(e=>"array"===e.type)?.length>1||M.items?.find(e=>e.name.startsWith("amount"))||ke,Me=M.items.find(e=>"number"===e.type&&"w"===e.properties?.unit?.constant?.toLowerCase()&&!e.properties?.hidden)?.name,Pe=!!Me,Be=M.list?.filter(e=>"array"===e.type)?.length>1||Pe,Le={},Fe=M.result?.resultDef[0].button?.description;let Ve,Ue,We,ze,He,je,qe,Ge,Xe,Ye,Ze,Ke,Qe,Je,et,tt="",nt="",rt="",it=!1,ot=!1,st=!1,at=!1,lt=!1,ct=0,dt=0,ut=[],ft=[],ht=[],mt={},pt=new Map,gt=M.class,wt=M.id,yt=!1,vt=!1,$t=-1!==window.location.search.indexOf("next="),It=0,_t=!1,Ct={};const Et=-1!==window.location.search.indexOf("back=true");["readonly","hidden","hidden2","required"].map(e=>{M.items.filter(t=>"object"==typeof(t.properties&&t.properties[e])).map(t=>{const n=t.properties[e].refItem||"",[r,i]=n.split(".");ut.push({action:e,itemName:t.name,refObj:r,refName:i,op:t.properties[e].invert?"!":"",empty:t.properties[e].empty})})});M.items.filter(e=>e.selection&&e.constraint).map(e=>{ft.push({name:e.name,selection:e.selection,constraint:e.constraint})});M.items.filter(e=>e.lookup).forEach(e=>{ht.push({name:e.name,lookup:e.lookup})}),M.items.filter(e=>e.properties?.lookup?.split).forEach(e=>{ht.push({name:e.name,lookup:e.properties.lookup.split(":").at(-1)})});const At=async e=>{if(e?.length)for(const n of e){if(!n.lookup)break;const{name:e}=n;if(de[e])break;const{domain:r,value:i}=n.lookup;if("user"===r&&i){const n=I.user,r={[i]:n},o=await t.getSectionView(e,r);if(o?.length){const[{_id:t}]=o;t&&l(12,de[e]=t,de)}}}},bt=async e=>{if(!M.input)return;if(!M.input.length)return;if(M.input.length<2)return;const n=!e.input.class[0].name&&e.input.class[0].selection;if(!n)return;const r=e.input.class[1].name,[i,o]=e.input.class[1].destination?.split(".");if(!r||!o)return;const s=M.list?.find(e=>e.name===i);if(!s)return;if(s.filter)return;const a=await t.getSchemaByClass(n),c=(await t.getTasks(a.id)).data;if(!c?.length)return;const d=[];for(const e of c)if(e.active??1){const t={};for(const n of s.item)n.name===o?t[n.name]=e._id:e[n.name]&&(t[n.name]=e[n.name]);d.push(t)}d.length&&l(12,de[i]=d,de)},St=async e=>{if(!M.input)return;if(!M.input.length)return;if(M.input.length>1)return;const t=je.input.class[0],{name:n,selection:r,state:i,list:o}=t;n||r&&i&&o&&await Nt(r,i,o)},Nt=async(e,n,r)=>{const i=(await t.getEvents()).filter(t=>t.output?.class?.at(0)?.name===e),o={[r]:[]};for(const s of i){let i={event:s._id,status:n};const a=await t.getSectionView("_task",i);if(a?.length){i={_id:{$in:a.map(e=>e.docId)}};const n=await t.getSectionView(e,i);for(const t of n){const n=M.list.find(e=>e.name===r);if(n){const i={[e]:t._id.toString()};for(const e of n.item)t[e.name]&&(i[e.name]=t[e.name]);o[r].push(i)}}}}setTimeout(()=>l(12,de={...de,...o}),100)},Tt=()=>{for(const e of M.items)"boolean"==typeof e.properties?.value&&l(12,de[e.name]=e.properties.value,de),"string"==typeof e.properties?.value&&l(12,de[e.name]=e.properties.value,de),e.properties?.value?.concatenation&&Dt(e);Rt()},Rt=async()=>{for(const e of M.list||[])if("array"===e.type||!de._id)for(const n of e.item)if(n.refItem&&"array"!==e.type)if("owner"===n.refItem){const r=p.owner;r||R(k,p.owner=r=await t.getSolitaire(n.refItem),p),p.owner||await t.getSolitaire(n.refItem),r&&(de[e.name]||l(12,de[e.name]={},de),l(12,de[e.name][n.name]=$(r,n.refPos||n.name),de))}else if(de[n.refItem]){const r=await t.getTask(n.refItem,de[n.refItem]);r&&(de[e.name]||l(12,de[e.name]={},de),l(12,de[e.name][n.name]=$(r,n.refPos||n.name),de))}},Dt=async e=>{const t=e.properties.value.concatenation;let n="";for(const e of t)void 0!==e.constant&&(n+=e.constant),"year"===e.variable&&(n+=(new Date).getFullYear()),e.refItemNext&&(n+=await kt(e.refItemNext));l(12,de[e.name]=n,de)},xt=async e=>{const t=ut.filter(t=>t.refObj===e||t.itemName===e);if(t?.length){l(35,mt={});for(const e of t){const{itemName:t,refObj:n,refName:r,op:i,empty:o}=e;let{action:s}=e;if(!n)break;let a,c,d=!r&&de[n];const u=de[n];if(u&&r&&(d=(await xp(n,u))[r]),Array.isArray(d)&&0===d.length&&(d=!1),"!"===i&&(d=!d),"hidden"===s&&(de._id&&o&&(d=!de[t]),a=`#${fe} .form-field.${t}`,c=document.querySelector(a),c?.classList?.toggle("hidden",!!d),c?.classList?.toggle("_hidden",!!d),de._id&&o||!d||l(35,mt[t]="",mt)),"hidden2"===s){if(a=`#${fe} .form-field.${t}`,c=document.querySelector(a),!c?.classList)continue;if(Array.from(c.classList).includes("_hidden"))continue;c?.classList?.toggle("hidden",!!d),d&&l(35,mt[t]="",mt)}"required"!==s&&"readonly"!==s||(s="required"===s?s:"disabled",setTimeout(()=>{a=`#${fe} .form-field.${t} .field textarea`,c=document.querySelector(a),c||(a=`#${fe} .form-field.${t} .field input#${t}`,c=document.querySelector(a)),c||(a=`#${fe} .form-field.${t} .field input`,c=document.querySelector(a)),c||(a=`#${fe} .form-field.${t} .field select`,c=document.querySelector(a)),c&&d&&c.setAttribute(s,""),c&&!d&&c.removeAttribute(s)},0))}}},kt=async e=>{const[n,r]=e.offset?.split(",")||[0,0],i=+e.base||0,o=+e.step||1;e.type;const s=e.refItem,a=await t.getLastId(M.class,s);if(!a?.length)return(i+o).toString().padStart(r,"0");let l=a[0][s];+l<i&&(l=i.toString());return((+l?.substring(n,n+r)||i)+o).toString().padStart(r,"0")},Ot=(e,t,n,r=!1)=>{const i=n||t.name,o=i.startsWith("_")?i:i.split("_")[0],s=e.find(e=>e.name===o);let a=t.value;if(!s)return a;if(r||"signature"!==s.type&&!s.properties?.multi||de[i]&&!a&&(a=de[i]),"dateRange"===s.type){if(null===a)return;let e=new Date(a);if("Invalid Date"==e)return;return e=`${e.getFullYear()}-${(e.getMonth()+1).toString().padStart(2,"0")}-${e.getDate().toString().padStart(2,"0")}T00:00:00.000Z`,new Date(e).toISOString()}if(a&&s.type.startsWith("date"))try{return Xr(a,"%d.%m.%Y").toISOString()}catch{return new Date(a).toISOString()}if("boolean"===s.type&&(a=!!t.checked),"number"===s.type){const e=s.properties?.decimals||0;try{a=Number(a.replace(",",".")).toFixed(e).toString()}catch{}}if(r&&"date"===s.type&&s.properties?.required&&!a&&de[i]){a=de[i];try{return Xr(a,"%d.%m.%Y").toISOString()}catch{return a}}return a};const Mt=async e=>{l(49,d=!0);const n=e.submitter?.className?.includes("close"),r={_docAsync:e?._docAsync};Array.from(document.querySelectorAll("form#"+fe+" ."+fe)).map(e=>{if(e.name)if(e.name.includes(".")){const t=e.name.split(".")[0],n=M.items.find(e=>e.name===t);if(n&&"object"===n.type&&n.properties?.multi)r[t]=(r[t]||[]).concat(e.value);else{const[t,n]=e.name.split("."),i=M.list.find(e=>e.name===t);r[e.name]=Ot(i.item,e)}}else r[e.name]=Ot(M.items,e);else if(e.id){const t=M.items.find(t=>t.name===e.id);"signature"===t.type&&(e.name=e.id,r[e.name]=Ot(M.items,e))}}),e.itemName&&(r[e.itemName]=e.value);let i=!1,o={},s=!1;if(M.list&&M.list.map(e=>{if(s||=!!e.sort,e.mandatory){const t=ue[e.name]?.filter(e=>!e._delete).length;if(!t||t<2)return void(i=!0)}if("array"!==e.type||!ue[e.name])return;e.item.forEach(t=>{for(const n of ue[e.name])void 0===n[t.name]&&(n[t.name]="boolean"!==t.type&&"")});let t=[...ue[e.name]].reduce((t,n)=>n._delete||!Object.values(n).some(Boolean)?t:t.concat(Object.entries(n).reduce((t,[n,r])=>("_delete"!==n&&(t[n]=Ot(e.item,{name:n,value:r,checked:r},"",!0)),t),{})),[]);if(e.sort){let n=[];for(const t in e.sort)n.push((-1===e.sort[t]?"!":"")+t);t=function(e,t,n,r){function i(e,t){let i="";for(let o of t){let t=!0;o.startsWith("!")&&(t=!1,o=o.slice(1));const[s,a]=o.split(".");let l="";if(a){let t=n?.findIndex(e=>e===s);if(t<0&&(t=n?.findIndex(e=>e===o)),t>=0){const n=r[e._index].split(" • ")[t];n&&(l=n.split(" · ")[a]||n||"")}}else l=$(e,o);switch(typeof l){case"boolean":t||(l=!l),i+=String(+l);break;case"string":i+=t?l.padEnd(30):Mp(l).padEnd(30);break;case"number":i+=t?String(l).padStart(12,"0"):String(Pp(l)).padStart(12,"0");break;case"object":Array.isArray(l)&&(i+=t?[].concat(l).join("").padEnd(30):[].concat(Mp(l)).join("").padEnd(30))}}return i}let o=e.map((e,t)=>(e._index=t,e));return o=o.sort((e,n)=>i(e,t).localeCompare(i(n,t))),o.map(e=>(delete e._index,e))}(t,n,e.display?.refItem,Ct[e.name])}r[e.name]=t,e.item.forEach(t=>{for(const n of r[e.name])if(t.properties?.setBy){const e=r[t.properties.setBy];e&&(n[t.name]=e)}}),e.sort&&(o[e.name]=r[e.name])}),i)return a.failed("Bitte Positionen erfassen",3e3),void l(49,d=!1);if(r._event=wt,r._prevEventId=L,r._taskId=V,se){const e=se.record;for(const t in e)t.includes(".")&&delete e[t];e._event=se.event,e._taskId=se.taskId;const{id:n}=await t.saveData(se.class,e);r[se.class]||(r[se.class]=n)}if(q)return Pt(M.class,r),l(49,d=!1),Lt();s&&l(47,_t=o);const{id:c,task:u,tax:f,error:h,state:m,info:p}=await t.saveData(M.class,r);if(h?.text){const e=h.field?" in "+h.field+": "+h.value:"";if(l(10,K=`${h.text} ${e}`),l(9,Z=!0),!m)return void l(49,d=!1)}if(Je){const e=new FormData;e.append("title",Je.fileName),e.append("file",Je.file),await t.uploadUserReport(u,e)}p&&!Array.isArray(p)&&p.accepted?p.accepted?.length?a.success(`Email versandt an ${p.accepted.join(", ")}, Dateigrösse: ${p.messageSize} Bytes.`,5e3):(l(10,K="Email konnte nicht versandt werden!"),l(9,Z=!0)):a.success("Die Daten wurden gespeichert.",2e3),l(49,d=!1),l(21,Ce=f?._amount||0),l(22,Ee=100*(f?._rate||0)||""),Ht(),r._id=c;const g=await t.getTaskList(M.class,c);if(O("choose",{row:g}),n)return l(49,d=!1),Lt();if(!P){if($t){const e=Math.floor(9e3*Math.random()+1e3).toString();return window.singleSpaNavigate(`/task/${wt}/${wt}/task?next=${e}`)}return window.singleSpaNavigate(`/task/${wt}/${u}/task`)}},Pt=async(e,n)=>{if(!q.lookup)return;const r={};for(const e in n){const t=n[e];Array.isArray(t)||q.lookup.includes(e)&&(r[e]=n[e])}const i=await t.getSectionView(M.class,r);if(!i?.length)return void await t.saveData(e,n);let o,s;for(const r of i.toReversed()){if(!(await t.getTaskByDocId(r._id,!0)).status.startsWith("WaitingForApproval"))continue;s=r;const i=r[q.ref];for(let s=0;s<i.length;s++){o=!0;const a=i[s];for(const e in a)if(q.lookup.includes(e)&&a[e]!=n[q.ref][0][e]){o=!1;break}if(o)return i[s]=n[q.ref][0],r._event=n._event,r._prevEventId=n._prevEventId,r._taskId=n._taskId,void await t.saveData(e,r)}}if(s){const r=s;r[q.ref].push(n[q.ref][0]),r._event=n._event,r._prevEventId=n._prevEventId,r._taskId=n._taskId,await t.saveData(e,r)}else await t.saveData(e,n)},Bt=()=>q||oe||j||X||!L?Lt():window.history.back(),Lt=()=>Et?O("back"):j?window.close():z?window.singleSpaNavigate("/"):O("back"),Ft=async(e,t,n,r,i)=>{const o=await xp(e,t);if(o){for(const r of o[n])r[e]=t;return i=i.concat(o[n])}},Vt=async({detail:e})=>{Array.isArray(e.value)&&ve.set(e.name,e.value);const n=je.input?.class?.at(0);if(!n)return;const{selection:r}=n;if(2===je.input.class?.length){const t=je.input.class[1],{name:n,refStatus:i,source:o,destination:s}=t;if(o){if(de._id)return;if(r&&Array.isArray(e.value)){let t=[];for(const r of e.value)t=await Ft(n,r,o,0,t);return void l(12,de[s]=t,de)}}}if(!(M.input?.length&&M.input.length>1))return;if(re?.class!==M.input[0]&&!ne)return;let i,{value:o,lookup:s,name:a,view:c}=e;if(!s&&!ne)return;if(s&&(i=s.split(":")[0]),c||(i=a,c="_id"),ne){if(i=M.input[1],!ve?.size||!ve.get(e.name)?.length)return void l(12,de[i]=[],de);c=a,o=[ne]}const d=await t.getSectionView(i,{[c]:{$in:o}}),u=d.map(e=>e._id);for(const e of M.input.slice(1)){l(12,de[e]=[],de);const n=await t.getSchemaByClass(e);n.id;let r=(await t.getTasksListStatus(n.id,"Ready")).data;if(r=r.filter(e=>"Ready"===e._task?.status&&(u.includes(e[i])||u.includes(e._id))),r?.length){const{filter:n}=je.input.class.find(t=>t.name===e),{refItem:o,value:s}=n||{},a=[];if(r.forEach(e=>{if(n){const t=d.find(t=>t._id===e[i]);t&&t[o]===s&&a.push(e._id)}else a.push(e._id)}),a.length){const n=await t.getSectionView(e,{_id:{$in:a}});for(const t of n)t[e]=t._id;l(12,de[e]=n,de)}}}},Ut=async(e,n,r)=>{if(1===je.input?.class?.length){const t=je.input.class[0],{name:r,selection:i,state:o,list:s,exclude:a}=t;e===r&&i&&o&&s&&await Wt(e,n,i,o,s,a)}const i=je.output.class[0].item.find(e=>e.properties?.multi?.lookup);if(P||n||i?.properties.multi.lookup!==e||Vt({detail:{value:[]}}),M.input&&M.input.length>1&&!ne){if(M.input[0]!==e)return;const{name:i,source:o,destination:s,selection:a}=je.input.class[1];if(a&&o&&s){const t=await xp(e,n);if(!t)return void l(12,de[s]=[],de);const r=await xp(a,t[a]);if(!r)return;const i=r[o]||[];return void l(12,de[s]=i,de)}const{recursive:c}=je.input.class[1];if(n){let i=await t.getTaskOptions(`${e}:${n}`,wt,c);if(r){const e=s.split(".")[1],t=[];i[e].forEach(n=>{de[e]?.find(t=>t[e]===n[e])||t.push(n)}),i={[e]:de[e]?[...de[e],...t]:[...t]}}l(12,de={...de,...i})}else{const e=M.input.slice(1);for(const t of e)l(12,de[t]=[],de)}}for(const t of je.output.class[0].item)if("date"===t.type&&t.properties?.value?.formula?Jt(t.name):void 0!==t.factor?l(12,de[t.name]=de[t.name]*t.factor,de):t.properties?.value?.formula&&await Jt(t.name),!n){const n=t.refItem||t.lookup?.refItem;n&&n.startsWith(e)&&l(12,de[t.name]="",de)}if((async()=>{const e=M.items.find(e=>"textarea"===e.properties?.format&&e.properties?.source);if(e&&!de[e.name]){const t=new Set;let n="";for(const r of e.properties.source){const[e,i,o]=r.split("."),s=de[e];for(const r of s||[]){const s=r[i];if(s&&!t.has(s)){t.add(s);const r=M.list?.find(t=>t.name===e),a=r?.item.find(e=>e.name===i);if(a?.refClass){const e=await xp(a.refClass,s);e&&e[o]&&(n+=e[o])}}if(n)break}if(n)break}n&&l(12,de[e.name]=n,de)}})(),M.list?.length){let e=Ge;for(const t of M.list)"array"===t.type&&t.mandatory&&de[t.name]&&!de[t.name].length&&(e=!1);l(42,Xe=e)}},Wt=async(e,t,n,r,i,o)=>{n=[].concat(n);for(const s of n)await zt(e,t,s,r,i,o)},zt=async(e,n,r,i,o,s)=>{let[a,c]=r.split(".");c||(c=r,a=""),o=[].concat(o);const d=a?(await t.getEvents()).filter(e=>e.output?.class?.at(0)?.name===c):(await t.getEvents()).filter(e=>e.output?.class?.at(0)?.name===c&&je.output?.class?.at(0)?.list?.find(t=>t.name===e.identity.name)),u={};for(const r of d)if(u[r.identity.name]=[],n){let l={event:r._id,status:i};const d=await t.getSectionView("_task",l);if(d?.length){const i=[];l={_id:{$in:d.map(e=>e.docId)},[e]:n};const f=await t.getSectionView(c,l);for(const e of f)for(const n of o)if(n.startsWith("$")){const t=n.slice(1),r=[];for(const n of e[t]||[]){const t={...n,[c]:e._id};for(const e in t)!t.quantity&&e.startsWith("quantity")&&(t.quantity=t[e]);t.quantity&&r.push(t)}let i=u[t]||[];i=i.concat(r),u[t]=i}else if(a){let r=!0;if(s){const i=await t.getSectionView(M.class,{[n+"."+c]:e._id});r=!i?.length}const o={[c]:e._id.toString()};r&&i.push(o)}else for(const t of e[n]||[]){const n={...t,[c]:e._id};for(const e in n)!n.quantity&&e.startsWith("quantity")&&(n.quantity=n[e]);n.quantity&&i.push(n)}a?u[o[0]]=i.length?i:[]:u[r.identity.name]=i.length?i:[]}}else a&&(u[o[0]]=[]);setTimeout(()=>l(12,de={...de,...u}),100)},Ht=()=>{let e=0;if(Re){let t=1;De&&(t=be),e=Ae*t}xe&&(e=Ae);let t=0;for(const e in Ne)t+=Ne[e];let n=0;for(const e of M.items)e.name.startsWith("amount")&&(n+=+de[e.name]);l(20,_e=t+e),de.discount>0&&l(20,_e-=_e*de.discount*.01),l(20,_e+=n)},jt=()=>{let e=0;for(const t in Le)e+=Le[t];l(34,ct=e+ +dt)},qt=({detail:e})=>{if(ue[e.listName]=e.value,Oe&&void 0!==e.amountValue){const t=Qe.find(t=>t.name===e.listName);if(!1!==t?.includeInTotal){let n=e.amountValue;Te[e.listName]=n,t.foreignCurrency&&de.currencyRate&&(n*=de.currencyRate),Ne[e.listName]=n,Ht()}}Be&&void 0!==e.weeksValue&&(Le[e.listName]=e.weeksValue||0,jt()),e.addToRecord&&l(14,ae=e),e.listInput&&l(14,ae={listName:e.listName,value:e.value})};r.subscribe(async e=>{if(!e)return;if(!P)return;const n=await t.getSchema(e.eventId);if(!n)return;const r=M.list?.find(e=>e.name===n.class);if(!r)return;const i=await t.getTaskById(e.taskId);((e,t,n)=>{if(!Cp.get(e))return;const r=t;Ep.set(r,n)})(i.event,i.docId,i.data);const o=await t.getTask(n.class,i.docId),s=de[n.class].filter(e=>e[n.class]==o._id);s?.length&&s.map(e=>{e[n.class]=i.docId}),l(12,de),l(112,ie),l(111,re),l(0,M)}),Q(async()=>{if(Cp=new Map,Ep=new Map,Ap=new Map,await Xt(),!q){if(!P){const t=document.getElementById(fe);if(!t)return;for(var e=0;e<t.length;e++)if(null!=!t[e].readonly&&"hidden"!=t[e].type&&1!=t[e].disabled&&"none"!=t[e].style.display)return void t[e].focus()}return}const n={...de};let r=n[q.ref][0];for(const e in r)r[e]||(r[e]=q.value[e]);const i={};for(const e in n){const t=n[e];if(Array.isArray(t))for(const e in r){const t=r[e];q.lookup.includes(e)&&(i[q.ref+"."+e]=t)}else q.lookup.includes(e)&&(i[e]=t)}if(q.lookup.includes("date")){const e=new Date,t=new Date(e.getFullYear(),e.getMonth(),e.getDate()).toISOString(),n=new Date(e.getFullYear(),e.getMonth(),e.getDate()+1).toISOString();i.date=t,i.date={$gte:t,$lt:n}}const o=await t.getSectionView(M.class,i);let s=!1;for(const e of o){if((await t.getTaskByDocId(e._id,!0)).status.startsWith("WaitingForApproval")){if(s)break;for(const t of e[q.ref]){let e=!0;for(const n in t)if(q.lookup.includes(n)&&t[n]!=r[n]){e=!1;break}if(e){for(const e in t)q.lookup.includes(e)||(r[e]=t[e]);s=!0;break}}}}l(12,de[q.ref][0]=r,de);const a=(q.focus||q.fill.at(-1))+"-0",c=document.getElementById(a);c&&c.focus()});const Gt=async()=>{Ve&&(Ue||(Ue=await t.getEvent(wt)),l(41,$t=!0),Ve.autostart&&sn())},Xt=async()=>{const e=e=>new Promise(t=>setTimeout(t,e));let t,n=0;for(;!(t=document.getElementById(fe)&&!at&&!lt)&&++n<20;)await e(50);t||(t=document.getElementById(fe)),t&&(()=>{const e=new Set;for(const t of ut)if(P){const n=M.items.find(e=>e.name===t.itemName);n?.properties?.enum&&e.add(t.refObj||gt)}else e.add(t.refObj||gt);Array.from(e).forEach(e=>xt(e))})(),Yt()},Yt=()=>{setTimeout(()=>{Array.from(pt).forEach(([e,t])=>{de[e]||l(12,de[e]=t._id,de)})},350)};J(()=>{P&&R(f,g={[P]:{record:de,lists:ue}},g)});const Zt=()=>{const e={};Array.from(document.querySelectorAll("form#"+fe+" ."+fe)).map(t=>{if(t.name){const n=M.items.find(e=>e.name===t.name.split(".")[0]);if(n&&"object"===n.type&&n.properties?.multi){const n=t.name.split(".")[0];e[n]=(e[n]||[]).concat(t.value)}else if(t.name.includes(".")){const[n,r]=t.name.split("."),i=M.list.find(e=>e.name===n);e[t.name]=Ot(i.item,t)}else e[t.name]=Ot(M.items,t,t.name.split("_")[0])}}),M.list&&M.list.map(t=>{"array"===t.type&&ue[t.name]&&(e[t.name]=ue[t.name].reduce((e,n)=>n._delete||!Object.values(n).some(Boolean)?e:e.concat(Object.entries(n).reduce((e,[n,r])=>("_delete"!==n&&(e[n]=Ot(t.item,{name:n,value:r,checked:r},"",!0)),e),{})),[]))});let t=!0;Object.entries(e).map(([e,n])=>{e=e.split("_")[0];const r=M.items.find(t=>t.name===e);r?.properties?.required&&!n&&(t=!1)});const n=M.items.filter(e=>e.properties?.multi&&e.properties?.required);for(const r of n)e[r.name]||(t=!1);return t&&e},Kt=async e=>{let n;for(l(46,It=0),rn();!n&&et;){l(46,It++,It);const r=await t.progressReport(e);if(n=r?.progressValue,It>300)break;await Bp(1e3)}if(on(),n){const t="/api/report/list/"+e;window.open(t,"_self","width=1 height=1")}},Qt=(e,t)=>(t||=0,"number"==typeof e&&e||(e=Number(e||0)),(+(Math.round(e+"e+"+t)+"e-"+t)).toString()),Jt=async e=>{if(!e)return;if(d)return;const t=M.items.find(t=>t.name===e),n=t.properties.value?.formula;if(!n)return;const{operator:r,argument:i,filter:o}=n;if(o&&de[o])return void l(12,de[e]=0,de);const s=i.map(e=>de[e.refItem]);let a="number"===t.type?0:"";if("$concat"===r){if(de._id&&void 0!==de[e])return;return a=s.reduce((e,t)=>e+(t||"")),void(a&&l(12,de[e]=a,de))}if("$preferred"===r){if(de._id&&void 0!==de[e])return;a=s.reduce((e,n)=>{let r=e;return"number"===t.type?r=+r||+n:r||=n,r})}if("$add"===r){if("date"===t.type)return void l(12,de[e]=await en(r,i),de);a=s.reduce((e,t)=>+(e||0)+ +(t||0))}if("$subtract"===r&&(a=s.reduce((e,t)=>{e||(e=""),t||(t="");const[n,r]=e.toString().split(":");e=r?(+n+ +r/60).toFixed(2):+(n||0);let[i,o]=t.toString().split(":");return i||(i=0),e-=o?(+i+ +o/60).toFixed(2):+(i||0)})),"$multiply"===r&&(a=s.reduce((e,t)=>+(e||0)*+(t||0))),"$percentMultiply"===r){const[e,t]=s;if(!+e)return;a=+e,+t>0&&(a*=1-t/100)}if("$percentDivide"===r){const[e,t]=s;if(!+e||!+t)return;a=+e/+t*100}"$multiply"===r?l(12,de[e]=a?Qt(a,t.properties?.decimals):"",de):"$preferred"===r&&"number"!==t.type?l(12,de[e]=a,de):l(12,de[e]=Qt(a,t.properties?.decimals),de)},en=async(e,n)=>{const[r,i]=n.map(e=>e.refItem||e.value);let o,s;"string"==typeof i&&([o,...s]=i.split("."),0===s.length?(s=o,o=""):s=s.join("."));const a=tn(de[r])||Date.now();let l=s?0:i;if(o){if("owner"===o)p.owner||R(k,p.owner=await t.getSolitaire("owner"),p),l=$(p.owner,s);else if(de[o]){const e=await xp(o,de[o]);e&&(l=$(e,s))}}else l=l||de[s];return c=l||0,(d=new Date(a)).setDate(d.getDate()+Number(c)),d;var c,d},tn=e=>{if(!e)return;let t,n,r;e.includes("T")?([t,n,r]=e.split("-"),r=r.split("T")[0]):[r,n,t]=e.split(".");return new Date(+t,+n-1,+r).toISOString()},nn=()=>{l(15,he=!1)},rn=()=>{l(45,et=!0)},on=()=>{l(45,et=!1)},sn=()=>{l(32,ot=!1),l(29,nt=""),l(28,tt=""),l(30,rt=""),l(27,We=!0)},an=()=>{l(28,tt=""),l(29,nt=""),l(30,rt=""),l(32,ot=!1),l(31,it=!0),ln()},ln=()=>{if(!Ve.keyboard)return;const e=document.getElementById("reader_focusId");e&&e.focus()};return e.$$set=e=>{"schema"in e&&l(0,M=e.schema),"recID"in e&&l(2,P=e.recID),"deletable"in e&&l(3,B=e.deletable),"prevEventID"in e&&l(107,L=e.prevEventID),"prev"in e&&l(4,F=e.prev),"taskId"in e&&l(1,V=e.taskId),"taskOrg"in e&&l(108,U=e.taskOrg),"description"in e&&l(105,W=e.description),"root"in e&&l(5,z=e.root),"readonly"in e&&l(106,H=e.readonly),"isStandalone"in e&&l(109,j=e.isStandalone),"shortEdit"in e&&l(6,q=e.shortEdit),"shortSchema"in e&&l(110,G=e.shortSchema),"dialogAttr"in e&&l(7,X=e.dialogAttr)},e.$$.update=()=>{8192&e.$$.dirty[3]&&l(49,d=H),1&e.$$.dirty[0]|786432&e.$$.dirty[3]&&ie&&re&&(M.items.map(({name:e,type:t,refItem:n,properties:r})=>{if(!1===n)return;const i=re.items.find(t=>t.name===e);if(!i)return;if(t!==i.type)return;if(re.class!==n&&r?.readonly)return;const o="_"+e;ie[e]?l(12,de[e]=ie[e],de):n&&n.startsWith("owner")||r&&r.readonly||l(12,de[e]="",de),ie[o]&&l(12,de[o]=ie[o],de),l(25,Se=!1)}),(()=>{for(const e of M.list||[]){if(e.source)continue;if(e.add)continue;const t=[],n=de[e.name];if(n?.length){for(const r of n){const n=r;for(const t of e.item)if(!1===t.refItem)n[t.name]="boolean"!==t.type&&"";else if(t.refItem)if("date"!==t.type||de[t.refItem])n[t.name]=de[t.refItem];else{const e=new Date,r=new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0);n[t.name]=r}t.push(n)}l(12,de[e.name]=t,de)}}})()),32&e.$$.dirty[0]|4096&e.$$.dirty[3]&&l(50,h=z?W||"enablerr - Form":document.title)},[M,V,P,B,F,z,q,X,Y,Z,K,te,de,oe,ae,he,me,le,we,ye,_e,Ce,Ee,$e,Ie,Se,Ve,We,tt,nt,rt,it,ot,at,ct,mt,ze,He,yt,vt,qe,$t,Xe,Ye,Ze,et,It,_t,Ct,d,h,_,C,E,A,b,S,T,D,x,k,fe,pe,ge,{name:"amountValue",properties:{decimals:2}},{name:"taxValue",properties:{decimals:2}},ve,Oe,Be,{name:"weekValue",properties:{decimals:1}},Fe,wt,async()=>{if(l(42,Xe=Ge=await(async e=>!m.length||(!!m.find(t=>t===e)||!(await t.getEvents()).find(t=>t._id==e)))(wt)),_p={},l(37,He=[]),X){const e=new Map;for(const t in X){let[n,r]=t.split(".");if(r||(r=n,n=!1),n){const i=e.get(n)||{};i[r]=X[t],e.set(n,i)}else l(12,de[r]=X[t],de)}for(const t of e.keys())de[t]||l(12,de[t]=[],de),l(12,de[t][0]=e.get(t),de)}if(p.owner||R(k,p.owner=await t.getSolitaire("owner"),p),p.currency?l(18,we=l(19,ye=p.currency.designation)):t.getSectionView("owner",{}).then(e=>{e?.length&&e[0].currency&&xp("currency",e[0].currency).then(e=>{e&&l(18,we=l(19,ye=e.designation))}).catch(e=>console.log("currency not found"))}),je=await t.getEvent(wt),Ke=je.output.class[0].noSave,Qe=je.output.class[0].list,je.output.class[0].textDelete&&l(11,te=je.output.class[0].textDelete),l(42,Xe=Xe&&!Ke),q&&l(12,de[q.ref]=[{...q.value}],de),!P){if(l(36,ze=He),At(je.input?.class).then(()=>{lt=!0}),Tt(),bt(je),St(),ne){const e=je.input.class[0].selection;de[e]||(l(12,de[e]=[ne],de),Vt({detail:{value:[ne],name:e}}))}await(async()=>{if(!d&&(Ue||(Ue=await t.getEvent(wt)),l(26,Ve=Ue.output.class[0].reader),Ve&&!Ve.keyboard))try{const e=await getCameras();e?.length||l(26,Ve=!1)}catch{}})(),Gt()}if(P){if(g&&g[P]){const e=g[P],t=e.record;M.items.map(e=>{t[e.name]=Ot(M.items,{name:e.name,value:t[e.name],checked:t[e.name]})}),l(12,de=t),M.list&&M.list.map(t=>{"array"===t.type&&e.lists[t.name]&&l(12,de[t.name]=e.lists[t.name].reduce((e,n)=>n._delete||!Object.values(n).some(Boolean)?e:e.concat(Object.entries(n).reduce((e,[n,r])=>("_delete"!==n&&(e[n]=Ot(t.item,{name:n,value:r,checked:r},"",!0)),e),{})),[]),de)})}else l(12,de=await t.getTask(M.class,P));if(de.currency){const e=await xp("currency",de.currency);e&&(l(19,ye=we),l(18,we=e.designation))}if(l(105,W=y(M,de)),l(39,vt=!!M.result?.resultDef),l(38,yt=!!M.result?.resultDef&&!M.result.resultDef[0].createAfterSave),l(21,Ce=de._tax?._amount),l(22,Ee=100*de._tax?._rate||""),l(44,Ze=M.list?.find(e=>e.mandatory)&&je.input?.class?.length>1),Ze){(U||await t.getTaskByDocId(P,!0)).visum&&l(44,Ze=!1)}l(14,ae={itemName:M.class,value:P})}if(L){let e;l(106,H=!1),l(111,re=await t.getSchema(L)),"string"==typeof F&&(e=await t.getTask(re.class,F));const n=M.items.find(e=>e.refClass===re.class);n&&e?l(12,de[n.name]=e._id,de):l(112,ie=e)}if(Be&&(dt=de[Me]||0),je.trigger?.startOn&&!je.trigger.startOn.some(e=>e.type.indexOf("Manual")>=0)&&l(106,H=!0),w.role?.length&&M.authorization?.length){const e=M.authorization.some(e=>v?.find(t=>t===e.role&&"edit"===e.activity));l(106,H||=!e)}if(l(13,oe="report"===je.output.type),l(8,Y=!1!==je.output.class?.at(0)?.documentTotal),l(43,Ye=je.output.saveButton),p.userSetting){const e=p.userSetting;if(l(40,qe=e.isAdmin),!qe){const e=I.tenants.find(e=>e._id===I.tenant);e&&l(40,qe=e.admin?.find(e=>e===I.user))}}else t.getUserSettings().then(e=>{if(l(40,qe=e.isAdmin),!qe){const e=I.tenants.find(e=>e._id===I.tenant);e&&l(40,qe=e.admin?.find(e=>e===I.user))}});return l(33,at=!0),!0},Mt,Bt,async({detail:e})=>{const{row:n}=e;let{eventId:r}=e;if((()=>{if(P)for(const e of ut)e.refName||xt(e.itemName)})(),await(async(e,t)=>{if(!e&&!t)return;let n,r=!1;const i={...de};for(const o of M.items){if("string"==typeof o.refItem&&(!e||o.properties?.linkOnly)){const[e,s]=o.refItem.split(".");if(o.refSelection){const{name:e,list:t,attr:s,ref:a}=o.refSelection;if(n=de[e]&&await xp(e,de[e]),n&&n[t]&&(n[t][a]||n[t].length)){let e=n[t][a];e=e?n[t]:n[t].find(e=>e[s]==de[s]),e&&(i[o.name]=e[a],r=!0)}}else if("owner"===e)o.refItem.split(".").length<3&&(i[o.name]=p.owner[s||o.refClass],r=!0);else if(o.refInput?.includes("|")&&de[e]){const[t,s]=o.refInput.split("|");n=await xp(e,de[e]),i[o.name]=n[t]||n[s]||"",r=!0}else if(de[e]){if((t._id===de[e]||o.refItemAlt)&&(n=await xp(e,de[e]),n)){let e;24===n[s]?.toString().length?(n=await xp(s,n[s]),n&&(e=n[o.name]||n[o.refInput])):s?(e=null!==n[s]&&void 0!==n[s]&&(n[s][o.name]||n[s]),o.refInput&&(e=e[o.refInput]),"object"==typeof e&&(e=void 0)):"dateRange"===o.type?(i[o.name+"_from"]=n[o.name+"_from"],_p[o.name+"_from"]=n[o.name+"_from"],i[o.name+"_to"]=n[o.name+"_to"],_p[o.name+"_to"]=n[o.name+"_to"],r=!0):e=n[o.name],void 0!==e&&(i[o.name]=e,r=!0,_p[o.name]=e)}}else s&&(i[o.name]="",r=!0)}if(!i[o.name]&&"string"==typeof o.refItemAlt&&(!e||o.properties?.linkOnly)){const[e,s]=o.refItemAlt.split(".");if((de[e]||t[e])&&(n=await xp(e,de[e]||t[e]),n)){let e;24===n[s]?.toString().length?(n=await xp(s,n[s]),n&&(e=n[o.name||o.refInput])):e=s?n[s][o.name]||n[s]:n[o.name],void 0!==e&&(i[o.name]=e,r=!0)}}}for(const t of M.list||[])if((!e||t.properties?.linkOnly)&&t.refItem&&de[t.refItem]&&(n=await xp(t.refItem,de[t.refItem]),n&&n[t.name])){const e=[];for(const i of n[t.name]){const n={};for(const e of t.item)i[e.name]&&(n[e.name]=i[e.name]);e.push(n),r=!0}i[t.name]=e}if(r){for(const e in _p)i[e]=_p[e];l(12,de=i)}})(!!P,n),P)return;if(r||=n._task?.event,r&&(await(async(e,n)=>{if(!e)return;const r=(await t.getEvent(e)).output.class[0].name,i=ht.filter(e=>e.lookup===r);if(i?.length)for(const e of i){const{lookup:t,name:r}=e;let i="";if(n){let e=await xp(t,n);e&&e[r]?.length&&(i=e[r][0][r])}i&&l(12,de[r]=i,de)}})(r,n._id),M.items.filter(e=>e.properties?.lookup).forEach(async e=>{const n=await t.getEvent(r);n.output.class[0]?.name===e.properties.lookup&&l(12,de[e.name]="",de)})),!n._task)return;const i=n._task.event,o=await t.getEvent(i);for(const e of je.output.class[0].item)"date"===e.type?e.properties?.value?.formula&&Jt(e.name):("$preferred"===e.properties?.value?.formula?.operator||"$concat"===e.properties?.value?.formula?.operator)&&Jt(e.name);if(!je.output?.class?.length)return;const s=je.output.class[0]?.item.find(e=>(e.refClass||e.name)===o.output.class[0]?.name);if(je.input?.class?.length&&je.input.class[0].name===o.output.class[0]?.name||s?.asInput){l(111,re=await t.getSchema(i)),l(107,L=i),l(1,V=n._task._id),V&&(n._task.docId||n.localId)?l(112,ie=await t.getTask(re.class,n._task.docId||n._id)):l(112,ie={});for(const e of M.list)"array"!==e.type&&ie[e.name]&&(l(16,me=!1),l(12,de[e.name]=ie[e.name],de),l(16,me=!0));re.class&&await Ut(re.class,n?._task?.docId||n?._task?._id)}},async({detail:e})=>{if(q)return;const{oldValue:t,value:n,itemName:r}=e;if("currencyRate"===r&&Oe){for(const e of Qe)if(!1!==e?.includeInTotal){let t=Te[e.name];e.foreignCurrency&&de.currencyRate&&(t*=de.currencyRate),Ne[e.name]=t}return void Ht()}const i=M.items.find(e=>e.properties?.value?.formula?.argument?.find(e=>e.refItem===r));if("$concat"===i?.properties.value.formula.operator&&t!==n&&Jt(i.name),Array.isArray(e.value)&&1===e.value.length)for(const t of M.items){if(e.itemName!==t.refItem)continue;const n=await xp(t.refItem,e.value[0]);n&&l(12,de[t.name]=n[t.refClass],de)}if(l(14,ae=e),"quantity"===e.itemName&&l(24,Ie=de.quantity),"currency"===e.itemName&&e.value){const t=await xp("currency",e.value);t&&l(18,we=t.designation)}if((async(e,t)=>{const n=ft.filter(t=>t.selection===e||t.constraint===e);if(n?.length){l(23,$e=!1);for(const r of n){const{selection:n,constraint:i,name:o}=r;if(t)break;l(12,de[o]="",de),e===n&&l(23,$e=i);const s=de[n];if(s&&e===i){let e=await xp(n,s);const t=de[i];if(t?.length){const n=t[0].split(", ");e=e[i];let r="";for(const t of e)Object.values(t).map(e=>{n.includes(e)&&(r=t[o])});l(12,de[o]=r,de)}}}}})(e.itemName,e.oldValue===e.value),Rt(),xt(e.itemName),Be&&Me&&(e.itemName===Me&&(dt=+e.value),jt()),ke&&Oe){if(e.itemName===Re?.name)Ae=e.value;else if(e.itemName===De?.name)be=e.value;else{if(e.itemName!==xe?.name)return;Ae=e.value}Ht()}},Vt,({detail:e})=>{Mt({_docAsync:!0})},async({detail:e})=>{await Mt(e),e.closeTask&&l(49,d=!0)},qt,e=>{"button"!==e.srcElement?.type&&"textarea"!==e.srcElement?.type&&13==e.which&&e.preventDefault()},e=>async()=>{const n=await t.getReportDoc(e)||{},{userReportId:r,type:i}=n;if(!r)return;if("eps"===i)return void a.success("Die Datei wurde erstellt und im Anhang abgelegt.");const o="/api/userreport/"+r;if("ics"===i)return window.open(o,"_self","width=1 height=1");const s="/viewer/doc/index.html?file="+o+"&type="+i;window.open(s,"","popup=yes toolbar=no width=624 height=900")},e=>async()=>{const e=await t.getDocData(V);(async e=>{const t=window.screen.height,n=window.open("","_blank","width=800,height="+t+",location=no");await ce(),n?.document.write("<title>Report Daten für '"+M.identity.designation+"'</title>"),n?.document.write("<textarea readonly style='resize: none; width: 100%; height: 100%;'>"+e+"</textarea>")})(JSON.stringify(e,null,4),M.identity.designation)},async()=>{const e=Zt();if(!e)return;const n=je.result?.resultDef[0]?.addToReports;if(n){const r=e[n];if(r){const n={docId:r},i=(await t.getSectionView("_task",n))[0];e._taskId=i._id}}const{reportId:r,type:i}=await t.createReport(wt,e);await Kt(r),setTimeout(Lt,2e3)},async()=>{const e=Zt();if(!e)return;const n=await t.getReportData(wt,e),r=window.screen.height,i=window.open("","_blank","width=800,height="+r+",location=no");await ce(),i?.document.write("<title>Report Daten für '"+M.identity.designation+"'</title>"),i?.document.write("<textarea readonly style='resize: none; width: 100%; height: 100%;'>"+JSON.stringify(n,null,4)+"</textarea>")},async({detail:{className:e,itemName:n,value:r}})=>{if(gt!==r)return;if(!e)return;if(pt.has(e))return;if(!0!==r&&(r=(r=[].concat(r)).some(e=>e===gt)),!r)return;const i={[n]:!0},o=await t.getSectionView(e,i);o?.length&&pt.set(e,o[0])},async({detail:e})=>{se=e;for(const t of M.items){if(t.saveAs||!t.refItem)continue;const[n,r]=t.refItem?.split(".");if(e.class!==n||!e.record._id)continue;let i=await xp(n,e.record._id);if(i){let e;24===i[r]?.toString().length?(i=await xp(r,i[r]),i&&(e=i[t.name]||i[t.refInput])):r?(e=null!==i[r]&&void 0!==i[r]&&(i[r][t.name]||i[r]),t.refInput&&(e=e[t.refInput]),"object"==typeof e&&(e=void 0)):e=i[t.name],e&&l(12,de[t.name]=e,de)}}},({detail:e})=>{e.target&&M.list?.length?l(17,le={ref:e.target,val:e.value}):e.itemName.startsWith("$")?Je=e.value:setTimeout(()=>{l(12,de[e.itemName]=e.value,de);for(const e of M.items.filter(e=>!!e.properties?.value?.formula))Jt(e.name)},200)},({detail:e})=>{l(16,me=!1);for(const t of e.items)l(12,de[e.listName][t.name]=t.value,de);l(16,me=!0)},({detail:e})=>{Jt(e.item.name)},()=>M.result.resultDef[0].button?.designation||"Dokument erstellen",()=>{l(15,he=!0)},nn,on,async()=>{if(gt&&P){(await t.deleteData(gt,P)).taskId?(a.success("Die Daten wurden gelöscht.",3e3),Bt()):a.failed("Die Daten können nicht gelöscht werden!",3e3)}nn()},async()=>{if(!Ze)return;const e=je.input.class[0].name,t=je.input.class[1].destination.split(".")[1];if(!e)return;if(!t)return;if(!de[e])return;const n=de[t]?.length||0;await Ut(e,de[e],!0),n<de[t].length?(qt({detail:{listName:t,value:de[t]}}),Mt({})):a.failed("Keine Positionen gefunden!",3e3)},()=>{P&&Mt({_docAsync:!0})},sn,async({detail:e})=>{if(l(32,ot=!1),l(29,nt=""),l(28,tt=e.text||""),!tt)return;const n=dc(tt);for(const e in n){if(M.items.find(t=>t.name===e))if("object"==typeof n[e]){let r={};for(const i in n[e])if("object"==typeof n[e][i])for(const o in n[e][i]){n[e][i][o]&&(r[o]=n[e][i][o]);const s=await t.getSectionView(i,r);if(s?.length){const n=await t.getSectionView(e,{[i]:s[0]._id});n?.length&&l(12,de[e]=n[0]._id,de)}}else{n[e][i]&&(r[i]=n[e][i]);const o=await t.getSectionView(e,r);o?.length&&l(12,de[e]=o[0]._id,de)}}else n[e]&&l(12,de[e]=n[e],de)}l(27,We=!1)},()=>M.items.filter(e=>e.properties?.reader),(e,t=!1)=>t?(an(),""):M.items.find(t=>t.name===e)?.designation||"",an,()=>{const{refItem:e}=Ve,t={[e]:rt};let n;M.filter(e=>e.properties?.reader).forEach(e=>{const n=document.getElementById("reader_"+e.name);n&&(t[e.name]=n.value||("number"===e.type?0:""))});let r=rec;const i=r.findIndex(t=>t[e]===rt);i>=0?(n=r[i],r[i]={...n,...t}):r=r.slice(0,-1).concat(t),rec=r,M.filter(e=>e.properties?.reader).forEach(e=>{notify(e,i>=0?i:0)({detail:{oldValue:n?n[e.name]:"",value:t[e.name]}})}),st=!0,an()},()=>{st&&(st=!1,Mt({}))},W,H,L,U,j,G,re,ie,function(e){_e=e,l(20,_e)},function(e){Ce=e,l(21,Ce)},function(e){ct=e,l(34,ct)},function(e){_t=e,l(47,_t)},function(e){Ct=e,l(48,Ct)},function(e){ae=e,l(14,ae)},function(e){$t=e,l(41,$t)},()=>nn(),function(e){he=e,l(15,he)},function(e){it=e,l(31,it)},function(e){We=e,l(27,We)},()=>on(),function(e){et=e,l(45,et)},()=>{l(9,Z=!1)},function(e){Z=e,l(9,Z)}]}class Fp extends xe{constructor(e){var t;super(),Jh.getElementById("svelte-11r31hb-style")||((t=M("style")).id="svelte-11r31hb-style",t.textContent="form.disabled.svelte-11r31hb input.svelte-11r31hb{background-color:red !important}input:placeholder-shown{font-style:italic}form.svelte-11r31hb.svelte-11r31hb{min-width:25em}hr[data-text]{margin-bottom:1em !important}@media only screen and (min-width: 600px){form.svelte-11r31hb.svelte-11r31hb{min-width:30em}}.fEmbedded.svelte-11r31hb.svelte-11r31hb,.fTask.svelte-11r31hb.svelte-11r31hb{overflow-y:auto;padding-right:1em;overflow-x:hidden}.fEmbedded.svelte-11r31hb.svelte-11r31hb{height:fit-content;min-height:30vh;max-height:60vh}.fTask.svelte-11r31hb.svelte-11r31hb{height:fit-content;max-height:70vh}.sTask.svelte-11r31hb.svelte-11r31hb{height:95%;display:inline-grid}.sTask.svelte-11r31hb .btn.svelte-11r31hb{display:initial !important}.form--buttons.svelte-11r31hb.svelte-11r31hb:not(.isReport){z-index:10000}.form--buttons.svelte-11r31hb.svelte-11r31hb{display:flex;gap:1em;padding-top:0.75em}.flex_div.svelte-11r31hb.svelte-11r31hb{display:flex;margin-top:1em;gap:0.5em;justify-content:space-between}section.sTask div.date-picker div.dropdown-shell div.dropdown.calendar{position:fixed !important;left:auto !important}form.fTask div.form-field{min-width:49vw}section.data + .modal-overlay > .dialog{margin-top:-5em}",D(Jh.head,t)),De(this,e,Lp,Ip,S,{schema:0,recID:2,deletable:3,prevEventID:107,prev:4,taskId:1,taskOrg:108,description:105,root:5,readonly:106,isStandalone:109,shortEdit:6,shortSchema:110,dialogAttr:7},[-1,-1,-1,-1,-1,-1,-1,-1])}}function Vp(e){let t,n,r;function i(t){e[4](t)}let o={schema:e[5],recID:e[6]};return void 0!==e[0]&&(o.description=e[0]),t=new Fp({props:o}),re.push(()=>Se(t,"description",i)),t.$on("back",e[2]),{c(){Ne(t.$$.fragment)},m(e,n){Te(t,e,n),r=!0},p(e,r){const i={};32&r&&(i.schema=e[5]),64&r&&(i.recID=e[6]),!n&&1&r&&(n=!0,i.description=e[0],ue(()=>n=!1)),t.$set(i)},i(e){r||($e(t.$$.fragment,e),r=!0)},o(e){Ie(t.$$.fragment,e),r=!1},d(e){Re(t,e)}}}function Up(e){let t,n;return t=new l({props:{update:e[1],description:e[0],$$slots:{default:[Vp,({prop:{schema:e,recID:t,eventID:n}})=>({5:e,6:t,7:n}),({prop:e})=>(e?32:0)|(e?64:0)|(e?128:0)]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(e,r){Te(t,e,r),n=!0},p(e,[n]){const r={};1&n&&(r.description=e[0]),353&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||($e(t.$$.fragment,e),n=!0)},o(e){Ie(t.$$.fragment,e),n=!1},d(e){Re(t,e)}}}function Wp(e,n,r){let i,{refresh:o}=n;return e.$$set=e=>{"refresh"in e&&r(3,o=e.refresh)},[i,(e,n)=>t.getSchema(e).then(t=>({schema:t,recID:n,eventID:e,title:t.identity.designation})),e=>{},o,function(e){i=e,r(0,i)}]}var zp=cf(function(e,t){function n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function r(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach(function(t){i(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if("object"!==o(e))throw new Error("single-spa-svelte requires a configuration object");var t=r(r({},s),e);if(!t.component)throw new Error("single-spa-svelte must be passed opts.component");var n={};return{bootstrap:a.bind(null,t,n),mount:l.bind(null,t,n),unmount:c.bind(null,t,n),update:d.bind(null,t,n)}};var s={component:null,domElementGetter:null,props:{}};function a(e){return Promise.resolve()}function l(e,t,n){var i=Object.keys(s),o=Object.keys(e).reduce(function(t,n){return i.includes(n)||(t[n]=e[n]),t},{});return Promise.resolve().then(function(){var i=function(e,t){return(t=t&&t.customProps?t.customProps:t).domElement?function(){return t.domElement}:t.domElementGetter?function(){return t.domElementGetter(t)}:e.domElementGetter?function(){return e.domElementGetter(t)}:function(e){var t=e.appName||e.name;if(!t)throw Error("single-spa-svelte was not given an application name as a prop, so it can't make a unique dom element container for the svelte application");var n="single-spa-application:".concat(t);return function(){var e=document.getElementById(n);return e||((e=document.createElement("div")).id=n,document.body.appendChild(e)),e}}(t)}(e,n),s=i();t.instance=new e.component(r(r({},o),{},{target:s,props:Object.assign({},n,e.props)}))})}function c(e,t){return Promise.resolve().then(function(){t.instance.$destroy?t.instance.$destroy():t.instance.destroy()})}function d(e,t,n){return Promise.resolve().then(function(){t.instance.$set?t.instance.$set(n):t.instance.set(n)})}});const Hp=lf(zp)({component:class extends xe{constructor(e){super(),De(this,e,Wp,Up,S,{refresh:3})}},domElementGetter:()=>document.getElementById("detail-app")}),{bootstrap:jp,mount:qp,unmount:Gp}=Hp;e({bootstrap:jp,mount:qp,unmount:Gp});e("Form",Fp),e("List",rn),e("Template",class extends xe{constructor(e){var t;super(),Zr.getElementById("svelte-1phofh5-style")||((t=M("style")).id="svelte-1phofh5-style",t.textContent="form.svelte-1phofh5.svelte-1phofh5{min-width:25em}@media only screen and (min-width: 600px){form.svelte-1phofh5.svelte-1phofh5{min-width:30em}}.fEmbedded.svelte-1phofh5.svelte-1phofh5,.fTask.svelte-1phofh5.svelte-1phofh5{overflow-y:auto;padding-right:1em;overflow-x:hidden}.fEmbedded.svelte-1phofh5.svelte-1phofh5{height:fit-content;min-height:30vh;max-height:60vh}.fTask.svelte-1phofh5.svelte-1phofh5{height:fit-content;max-height:70vh}.sTask.svelte-1phofh5.svelte-1phofh5{height:95%;display:inline-grid;min-width:40em}.sTask.svelte-1phofh5 .btn.svelte-1phofh5{display:initial !important}.form--buttons.svelte-1phofh5.svelte-1phofh5{display:flex;gap:1em;padding-bottom:0.5em}",D(Zr.head,t)),De(this,e,di,li,S,{schema:0,record:1})}})}}});