@enablerr-ui/detail 0.3.28 → 0.3.30

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,h;return{setters:[function(e){t=e.Request,n=e.Storage,r=e.task_notification,i=e.currentRoles,o=e.TextArea,s=e.toasts,a=e.settings,l=e.Page},function(e){c=e.getAttractions,d=e.PopOver},function(e){u=e.user},function(e){h=e.taskClipboard}],execute:function(){function f(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.28");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=>e?"(ja)":"(nein)",w=(e,t)=>{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]?g(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]&&g(t[e.name]),t[e.name])))).map((e=>e?.toString().split(" · ").filter((e=>!!e&&!y(e))).join(" · "))).filter((e=>!!e)).join(" • ")},y=e=>/^[0-9a-f]{24}/.test(e),v=(e,t)=>{try{return t.split(".").reduce(((e,t)=>e[t]),e)??""}catch{return""}};function _(){}function I(e){return e()}function C(){return Object.create(null)}function $(e){e.forEach(I)}function E(e){return"function"==typeof e}function A(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function b(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 S(e){return null==e?"":e}function T(e,t,n=t){return e.set(n),t}function N(e,t){e.appendChild(t)}function R(e,t,n){e.insertBefore(t,n||null)}function D(e){e.parentNode.removeChild(e)}function k(e,t){for(let n=0;n<e.length;n+=1)e[n]&&e[n].d(t)}function O(e){return document.createElement(e)}function x(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function M(e){return document.createTextNode(e)}function B(){return M(" ")}function P(){return M("")}function L(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function F(e){return function(t){return t.preventDefault(),e.call(this,t)}}function V(e){return function(t){return t.stopPropagation(),e.call(this,t)}}function U(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 W(e,t){e.value=null==t?"":t}function z(e,t,n,r){e.style.setProperty(t,n,r?"important":"")}function q(e,t,n){e.classList[n?"add":"remove"](t)}let j;function G(e){j=e}function X(){if(!j)throw new Error("Function called outside component initialization");return j}function Y(e){X().$$.on_mount.push(e)}function Z(e){X().$$.on_destroy.push(e)}function K(){const e=X();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 Q(e,t){const n=e.$$.callbacks[t.type];n&&n.slice().forEach((e=>e(t)))}const J=[],ee=[],te=[],ne=[],re=Promise.resolve();let ie=!1;function oe(){ie||(ie=!0,re.then(ue))}function se(){return oe(),re}function ae(e){te.push(e)}function le(e){ne.push(e)}let ce=!1;const de=new Set;function ue(){if(!ce){ce=!0;do{for(let e=0;e<J.length;e+=1){const t=J[e];G(t),he(t.$$)}for(G(null),J.length=0;ee.length;)ee.pop()();for(let e=0;e<te.length;e+=1){const t=te[e];de.has(t)||(de.add(t),t())}te.length=0}while(J.length);for(;ne.length;)ne.pop()();ie=!1,ce=!1,de.clear()}}function he(e){if(null!==e.fragment){e.update(),$(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(ae)}}const fe=new Set;let me;function pe(){me={r:0,c:[],p:me}}function ge(){me.r||$(me.c),me=me.p}function we(e,t){e&&e.i&&(fe.delete(e),e.i(t))}function ye(e,t,n,r){if(e&&e.o){if(fe.has(e))return;fe.add(e),me&&me.c.push((()=>{fe.delete(e),r&&(n&&e.d(1),r())})),e.o(t)}}function ve(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&&(pe(),ye(e,1,1,(()=>{t.blocks[n]===e&&(t.blocks[n]=null)})),ge())})):t.block.d(1),a.c(),we(a,1),a.m(t.mount(),t.anchor),l=!0),t.block=a,t.blocks&&(t.blocks[r]=a),l&&ue()}if((i=e)&&"object"==typeof i&&"function"==typeof i.then){const n=X();if(e.then((e=>{G(n),r(t.then,1,t.value,e),G(null)}),(e=>{if(G(n),r(t.catch,2,t.error,e),G(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 _e(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 Ie="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:global;function Ce(e,t){ye(e,1,1,(()=>{t.delete(e.key)}))}function $e(e,t,n){const r=e.$$.props[t];void 0!==r&&(e.$$.bound[r]=n,n(e.$$.ctx[r]))}function Ee(e){e&&e.c()}function Ae(e,t,n,r){const{fragment:i,on_mount:o,on_destroy:s,after_update:a}=e.$$;i&&i.m(t,n),r||ae((()=>{const t=o.map(I).filter(E);s?s.push(...t):$(t),e.$$.on_mount=[]})),a.forEach(ae)}function be(e,t){const n=e.$$;null!==n.fragment&&($(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function Se(e,t,n,r,i,o,s=[-1]){const a=j;G(e);const l=e.$$={fragment:null,ctx:null,props:o,update:_,not_equal:i,bound:C(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(a?a.$$.context:t.context||[]),callbacks:C(),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]&&(J.push(e),oe(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}(e,t)),n})):[],l.update(),c=!0,$(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(D)}else l.fragment&&l.fragment.c();t.intro&&we(e.$$.fragment),Ae(e,t.target,t.anchor,t.customElement),ue()}G(a)}class Te{$destroy(){be(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 Ne(e){let t,n,r,i;return{c(){t=x("svg"),n=x("path"),r=x("polygon"),U(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"),U(r,"points","12 15 17 21 7 21 12 15"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",i="feather feather-airplay "+e[2])},m(e,i){R(e,t,i),N(t,n),N(t,r)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-airplay "+e[2])&&U(t,"class",i)},i:_,o:_,d(e){e&&D(t)}}}function Re(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 De extends Te{constructor(e){super(),Se(this,e,Re,Ne,A,{size:0,strokeWidth:1,class:2})}}function ke(e){let t,n,r,i,o;return{c(){t=x("svg"),n=x("path"),r=x("line"),i=x("line"),U(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"),U(r,"x1","12"),U(r,"y1","9"),U(r,"x2","12"),U(r,"y2","13"),U(i,"x1","12"),U(i,"y1","17"),U(i,"x2","12.01"),U(i,"y2","17"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",o="feather feather-alert-triangle "+e[2])},m(e,o){R(e,t,o),N(t,n),N(t,r),N(t,i)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-alert-triangle "+e[2])&&U(t,"class",o)},i:_,o:_,d(e){e&&D(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 xe extends Te{constructor(e){super(),Se(this,e,Oe,ke,A,{size:0,strokeWidth:1,class:2})}}function Me(e){let t,n,r,i,o;return{c(){t=x("svg"),n=x("circle"),r=x("polyline"),i=x("line"),U(n,"cx","12"),U(n,"cy","12"),U(n,"r","10"),U(r,"points","8 12 12 16 16 12"),U(i,"x1","12"),U(i,"y1","8"),U(i,"x2","12"),U(i,"y2","16"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",o="feather feather-arrow-down-circle "+e[2])},m(e,o){R(e,t,o),N(t,n),N(t,r),N(t,i)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-arrow-down-circle "+e[2])&&U(t,"class",o)},i:_,o:_,d(e){e&&D(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 Pe extends Te{constructor(e){super(),Se(this,e,Be,Me,A,{size:0,strokeWidth:1,class:2})}}function Le(e){let t,n,r,i;return{c(){t=x("svg"),n=x("path"),r=x("path"),U(n,"d","M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"),U(r,"d","M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",i="feather feather-book-open "+e[2])},m(e,i){R(e,t,i),N(t,n),N(t,r)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-book-open "+e[2])&&U(t,"class",i)},i:_,o:_,d(e){e&&D(t)}}}function Fe(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 Ve extends Te{constructor(e){super(),Se(this,e,Fe,Le,A,{size:0,strokeWidth:1,class:2})}}function Ue(e){let t,n,r,i;return{c(){t=x("svg"),n=x("path"),r=x("circle"),U(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"),U(r,"cx","12"),U(r,"cy","13"),U(r,"r","4"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",i="feather feather-camera "+e[2])},m(e,i){R(e,t,i),N(t,n),N(t,r)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-camera "+e[2])&&U(t,"class",i)},i:_,o:_,d(e){e&&D(t)}}}function He(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 We extends Te{constructor(e){super(),Se(this,e,He,Ue,A,{size:0,strokeWidth:1,class:2})}}function ze(e){let t,n,r,i;return{c(){t=x("svg"),n=x("path"),r=x("polyline"),U(n,"d","M22 11.08V12a10 10 0 1 1-5.93-9.14"),U(r,"points","22 4 12 14.01 9 11.01"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",i="feather feather-check-circle "+e[2])},m(e,i){R(e,t,i),N(t,n),N(t,r)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-check-circle "+e[2])&&U(t,"class",i)},i:_,o:_,d(e){e&&D(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 Te{constructor(e){super(),Se(this,e,qe,ze,A,{size:0,strokeWidth:1,class:2})}}function Ge(e){let t,n,r;return{c(){t=x("svg"),n=x("path"),U(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"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",r="feather feather-command "+e[2])},m(e,r){R(e,t,r),N(t,n)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&r!==(r="feather feather-command "+e[2])&&U(t,"class",r)},i:_,o:_,d(e){e&&D(t)}}}function Xe(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 Ye extends Te{constructor(e){super(),Se(this,e,Xe,Ge,A,{size:0,strokeWidth:1,class:2})}}function Ze(e){let t,n,r,i;return{c(){t=x("svg"),n=x("polyline"),r=x("path"),U(n,"points","9 10 4 15 9 20"),U(r,"d","M20 4v7a4 4 0 0 1-4 4H4"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",i="feather feather-corner-down-left "+e[2])},m(e,i){R(e,t,i),N(t,n),N(t,r)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-corner-down-left "+e[2])&&U(t,"class",i)},i:_,o:_,d(e){e&&D(t)}}}function Ke(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 Qe extends Te{constructor(e){super(),Se(this,e,Ke,Ze,A,{size:0,strokeWidth:1,class:2})}}function Je(e){let t,n,r,i,o;return{c(){t=x("svg"),n=x("path"),r=x("line"),i=x("line"),U(n,"d","M21 4H8l-7 8 7 8h13a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2z"),U(r,"x1","18"),U(r,"y1","9"),U(r,"x2","12"),U(r,"y2","15"),U(i,"x1","12"),U(i,"y1","9"),U(i,"x2","18"),U(i,"y2","15"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",o="feather feather-delete "+e[2])},m(e,o){R(e,t,o),N(t,n),N(t,r),N(t,i)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-delete "+e[2])&&U(t,"class",o)},i:_,o:_,d(e){e&&D(t)}}}function et(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 Te{constructor(e){super(),Se(this,e,et,Je,A,{size:0,strokeWidth:1,class:2})}}function nt(e){let t,n,r,i,o;return{c(){t=x("svg"),n=x("path"),r=x("polyline"),i=x("line"),U(n,"d","M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"),U(r,"points","15 3 21 3 21 9"),U(i,"x1","10"),U(i,"y1","14"),U(i,"x2","21"),U(i,"y2","3"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",o="feather feather-external-link "+e[2])},m(e,o){R(e,t,o),N(t,n),N(t,r),N(t,i)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-external-link "+e[2])&&U(t,"class",o)},i:_,o:_,d(e){e&&D(t)}}}function rt(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 it extends Te{constructor(e){super(),Se(this,e,rt,nt,A,{size:0,strokeWidth:1,class:2})}}function ot(e){let t,n,r,i,o,s;return{c(){t=x("svg"),n=x("path"),r=x("polyline"),i=x("line"),o=x("line"),U(n,"d","M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"),U(r,"points","14 2 14 8 20 8"),U(i,"x1","12"),U(i,"y1","18"),U(i,"x2","12"),U(i,"y2","12"),U(o,"x1","9"),U(o,"y1","15"),U(o,"x2","15"),U(o,"y2","15"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",s="feather feather-file-plus "+e[2])},m(e,s){R(e,t,s),N(t,n),N(t,r),N(t,i),N(t,o)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&s!==(s="feather feather-file-plus "+e[2])&&U(t,"class",s)},i:_,o:_,d(e){e&&D(t)}}}function st(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 at extends Te{constructor(e){super(),Se(this,e,st,ot,A,{size:0,strokeWidth:1,class:2})}}function lt(e){let t,n,r,i,o;return{c(){t=x("svg"),n=x("circle"),r=x("line"),i=x("path"),U(n,"cx","12"),U(n,"cy","12"),U(n,"r","10"),U(r,"x1","2"),U(r,"y1","12"),U(r,"x2","22"),U(r,"y2","12"),U(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"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",o="feather feather-globe "+e[2])},m(e,o){R(e,t,o),N(t,n),N(t,r),N(t,i)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-globe "+e[2])&&U(t,"class",o)},i:_,o:_,d(e){e&&D(t)}}}function ct(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 dt extends Te{constructor(e){super(),Se(this,e,ct,lt,A,{size:0,strokeWidth:1,class:2})}}function ut(e){let t,n,r,i,o,s,a,l;return{c(){t=x("svg"),n=x("line"),r=x("line"),i=x("line"),o=x("line"),s=x("line"),a=x("line"),U(n,"x1","8"),U(n,"y1","6"),U(n,"x2","21"),U(n,"y2","6"),U(r,"x1","8"),U(r,"y1","12"),U(r,"x2","21"),U(r,"y2","12"),U(i,"x1","8"),U(i,"y1","18"),U(i,"x2","21"),U(i,"y2","18"),U(o,"x1","3"),U(o,"y1","6"),U(o,"x2","3.01"),U(o,"y2","6"),U(s,"x1","3"),U(s,"y1","12"),U(s,"x2","3.01"),U(s,"y2","12"),U(a,"x1","3"),U(a,"y1","18"),U(a,"x2","3.01"),U(a,"y2","18"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",l="feather feather-list "+e[2])},m(e,l){R(e,t,l),N(t,n),N(t,r),N(t,i),N(t,o),N(t,s),N(t,a)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&l!==(l="feather feather-list "+e[2])&&U(t,"class",l)},i:_,o:_,d(e){e&&D(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 ft extends Te{constructor(e){super(),Se(this,e,ht,ut,A,{size:0,strokeWidth:1,class:2})}}function mt(e){let t,n,r,i;return{c(){t=x("svg"),n=x("path"),r=x("polyline"),U(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"),U(r,"points","22,6 12,13 2,6"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",i="feather feather-mail "+e[2])},m(e,i){R(e,t,i),N(t,n),N(t,r)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-mail "+e[2])&&U(t,"class",i)},i:_,o:_,d(e){e&&D(t)}}}function pt(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 gt extends Te{constructor(e){super(),Se(this,e,pt,mt,A,{size:0,strokeWidth:1,class:2})}}function wt(e){let t,n,r,i;return{c(){t=x("svg"),n=x("path"),r=x("circle"),U(n,"d","M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"),U(r,"cx","12"),U(r,"cy","10"),U(r,"r","3"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",i="feather feather-map-pin "+e[2])},m(e,i){R(e,t,i),N(t,n),N(t,r)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-map-pin "+e[2])&&U(t,"class",i)},i:_,o:_,d(e){e&&D(t)}}}function yt(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 vt extends Te{constructor(e){super(),Se(this,e,yt,wt,A,{size:0,strokeWidth:1,class:2})}}function _t(e){let t,n,r,i,o;return{c(){t=x("svg"),n=x("polyline"),r=x("line"),i=x("path"),U(n,"points","23 7 23 1 17 1"),U(r,"x1","16"),U(r,"y1","8"),U(r,"x2","23"),U(r,"y2","1"),U(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"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",o="feather feather-phone-outgoing "+e[2])},m(e,o){R(e,t,o),N(t,n),N(t,r),N(t,i)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-phone-outgoing "+e[2])&&U(t,"class",o)},i:_,o:_,d(e){e&&D(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 Ct extends Te{constructor(e){super(),Se(this,e,It,_t,A,{size:0,strokeWidth:1,class:2})}}function $t(e){let t,n,r,i,o;return{c(){t=x("svg"),n=x("polyline"),r=x("path"),i=x("rect"),U(n,"points","6 9 6 2 18 2 18 9"),U(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"),U(i,"x","6"),U(i,"y","14"),U(i,"width","12"),U(i,"height","8"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",o="feather feather-printer "+e[2])},m(e,o){R(e,t,o),N(t,n),N(t,r),N(t,i)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-printer "+e[2])&&U(t,"class",o)},i:_,o:_,d(e){e&&D(t)}}}function Et(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 At extends Te{constructor(e){super(),Se(this,e,Et,$t,A,{size:0,strokeWidth:1,class:2})}}function bt(e){let t,n,r,i;return{c(){t=x("svg"),n=x("circle"),r=x("line"),U(n,"cx","11"),U(n,"cy","11"),U(n,"r","8"),U(r,"x1","21"),U(r,"y1","21"),U(r,"x2","16.65"),U(r,"y2","16.65"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",i="feather feather-search "+e[2])},m(e,i){R(e,t,i),N(t,n),N(t,r)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-search "+e[2])&&U(t,"class",i)},i:_,o:_,d(e){e&&D(t)}}}function St(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 Te{constructor(e){super(),Se(this,e,St,bt,A,{size:0,strokeWidth:1,class:2})}}const{document:Nt}=Ie;function Rt(e){e[49]=e[50].items}function Dt(e,t,n){const r=e.slice();return r[51]=t[n],r[53]=n,r}function kt(e,t,n){const r=e.slice();return r[54]=t[n],r}function Ot(e,t,n){const r=e.slice();return r[54]=t[n],r}function xt(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Mt(e){let t,n,r,i,o,s;Rt(e);let a=e[5]?.length&&Bt(e),l=e[49]?.length&&Lt(e),c=e[5]?.length&&Ut(e);return{c(){a&&a.c(),t=B(),n=O("div"),r=O("table"),l&&l.c(),i=B(),o=O("tbody"),c&&c.c(),U(r,"striped",""),U(r,"class","svelte-47aais"),U(n,"class","eList svelte-47aais")},m(e,d){a&&a.m(e,d),R(e,t,d),R(e,n,d),N(n,r),l&&l.m(r,null),N(r,i),N(r,o),c&&c.m(o,null),s=!0},p(e,n){Rt(e),e[5]?.length?a?(a.p(e,n),32&n[0]&&we(a,1)):(a=Bt(e),a.c(),we(a,1),a.m(t.parentNode,t)):a&&(pe(),ye(a,1,1,(()=>{a=null})),ge()),e[49]?.length?l?l.p(e,n):(l=Lt(e),l.c(),l.m(r,i)):l&&(l.d(1),l=null),e[5]?.length?c?(c.p(e,n),32&n[0]&&we(c,1)):(c=Ut(e),c.c(),we(c,1),c.m(o,null)):c&&(pe(),ye(c,1,1,(()=>{c=null})),ge())},i(e){s||(we(a),we(c),s=!0)},o(e){ye(a),ye(c),s=!1},d(e){a&&a.d(e),e&&D(t),e&&D(n),l&&l.d(),c&&c.d()}}}function Bt(e){let t,n,r,i,o,s,a,l,c,d,u,h=e[6]&&Pt(e);function f(t){e[33](t)}let m={id:e[10]};return void 0!==e[3]&&(m.value=e[3]),i=new e[8]({props:m}),ee.push((()=>$e(i,"value",f))),i.$on("input",e[14]),l=new tt({props:{size:"18"}}),{c(){h&&h.c(),t=B(),n=O("div"),r=M("Suchen: "),Ee(i.$$.fragment),s=B(),a=O("span"),Ee(l.$$.fragment),U(a,"class","feather pointer svelte-47aais"),z(n,"margin-bottom","1em"),z(n,"position","relative")},m(o,f){h&&h.m(o,f),R(o,t,f),R(o,n,f),N(n,r),Ae(i,n,null),N(n,s),N(n,a),Ae(l,a,null),c=!0,d||(u=L(a,"click",e[16]),d=!0)},p(e,n){e[6]?h?64&n[0]&&we(h,1):(h=Pt(e),h.c(),we(h,1),h.m(t.parentNode,t)):h&&(pe(),ye(h,1,1,(()=>{h=null})),ge());const r={};!o&&8&n[0]&&(o=!0,r.value=e[3],le((()=>o=!1))),i.$set(r)},i(e){c||(we(h),we(i.$$.fragment,e),we(l.$$.fragment,e),c=!0)},o(e){ye(h),ye(i.$$.fragment,e),ye(l.$$.fragment,e),c=!1},d(e){h&&h.d(e),e&&D(t),e&&D(n),be(i),be(l),d=!1,u()}}}function Pt(e){let t,n;return t=new e[7]({}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Lt(e){let t,n,r,i=e[4]&&e[0]&&Ft(),o=e[49],s=[];for(let t=0;t<o.length;t+=1)s[t]=Vt(Ot(e,o,t));return{c(){t=O("thead"),n=O("tr"),i&&i.c(),r=B();for(let e=0;e<s.length;e+=1)s[e].c();U(n,"class","svelte-47aais"),U(t,"class","svelte-47aais")},m(e,o){R(e,t,o),N(t,n),i&&i.m(n,null),N(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=Ft(),i.c(),i.m(n,r)):i&&(i.d(1),i=null),8196&t[0]){let r;for(o=e[49],r=0;r<o.length;r+=1){const i=Ot(e,o,r);s[r]?s[r].p(i,t):(s[r]=Vt(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&&D(t),i&&i.d(),k(s,e)}}}function Ft(e){let t;return{c(){t=O("th"),U(t,"class","svelte-47aais")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Vt(e){let t,n,r=e[54]?.designation+"";return{c(){t=O("th"),n=M(r),U(t,"class","svelte-47aais")},m(e,r){R(e,t,r),N(t,n)},p(e,t){4&t[0]&&r!==(r=e[54]?.designation+"")&&H(n,r)},d(e){e&&D(t)}}}function Ut(e){let t,n,r=[],i=new Map,o=e[5];const s=e=>e[51]?._id;for(let t=0;t<o.length;t+=1){let n=Dt(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=P()},m(e,i){for(let t=0;t<r.length;t+=1)r[t].m(e,i);R(e,t,i),n=!0},p(e,n){178239&n[0]&&(o=e[5],pe(),r=function(e,t,n,r,i,o,s,a,l,c,d,u){let h=e.length,f=o.length,m=h;const p={};for(;m--;)p[e[m].key]=m;const g=[],w=new Map,y=new Map;for(m=f;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){we(e,1),e.m(a,d),s.set(e.key,e),d=e.first,f--}for(;h&&f;){const t=g[f-1],n=e[h-1],r=t.key,i=n.key;t===n?(d=t.first,h--,f--):w.has(i)?!s.has(r)||v.has(r)?I(t):_.has(i)?h--:y.get(r)>y.get(i)?(_.add(r),I(t)):(v.add(i),h--):(l(n,s),h--)}for(;h--;){const t=e[h];w.has(t.key)||l(t,s)}for(;f;)I(g[f-1]);return g}(r,n,s,1,e,o,i,t.parentNode,Ce,qt,t,Dt),ge())},i(e){if(!n){for(let e=0;e<o.length;e+=1)we(r[e]);n=!0}},o(e){for(let e=0;e<r.length;e+=1)ye(r[e]);n=!1},d(e){for(let t=0;t<r.length;t+=1)r[t].d(e);e&&D(t)}}}function Ht(e){let t,n,r,i,o,s,a=e[4]&&e[0]&&Wt(e),l=e[49],c=[];for(let t=0;t<l.length;t+=1)c[t]=zt(kt(e,l,t));return{c(){t=O("tr"),a&&a.c(),n=B();for(let e=0;e<c.length;e+=1)c[e].c();r=B(),U(t,"class","pointer svelte-47aais"),q(t,"active",e[51]._id===e[1]),q(t,"blocked",!!e[51].blocked),q(t,"undeliverable",!!e[51].undeliverable)},m(l,d){R(l,t,d),a&&a.m(t,null),N(t,n);for(let e=0;e<c.length;e+=1)c[e].m(t,null);N(t,r),i=!0,o||(s=L(t,"click",V((function(){E(e[12](e[51],e[53]))&&e[12](e[51],e[53]).apply(this,arguments)}))),o=!0)},p(i,o){if((e=i)[4]&&e[0]?a?(a.p(e,o),17&o[0]&&we(a,1)):(a=Wt(e),a.c(),we(a,1),a.m(t,n)):a&&(pe(),ye(a,1,1,(()=>{a=null})),ge()),10276&o[0]){let n;for(l=e[49],n=0;n<l.length;n+=1){const i=kt(e,l,n);c[n]?c[n].p(i,o):(c[n]=zt(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]&&q(t,"active",e[51]._id===e[1]),32&o[0]&&q(t,"blocked",!!e[51].blocked),32&o[0]&&q(t,"undeliverable",!!e[51].undeliverable)},i(e){i||(we(a),i=!0)},o(e){ye(a),i=!1},d(e){e&&D(t),a&&a.d(),k(c,e),o=!1,s()}}}function Wt(e){let t,n,r,i,o;return n=new it({props:{size:"18"}}),{c(){t=O("td"),Ee(n.$$.fragment),U(t,"class","editRow svelte-47aais"),z(t,"color","#326173")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",V((function(){E(e[17](e[51]))&&e[17](e[51]).apply(this,arguments)}))),i=!0)},p(t,n){e=t},i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function zt(e){let t,n,r,i=e[11](e[51],e[54])+"";return{c(){t=O("td"),n=M(i),U(t,"class",r=S(e[54].type)+" svelte-47aais")},m(e,r){R(e,t,r),N(t,n)},p(e,o){36&o[0]&&i!==(i=e[11](e[51],e[54])+"")&&H(n,i),4&o[0]&&r!==(r=S(e[54].type)+" svelte-47aais")&&U(t,"class",r)},d(e){e&&D(t)}}}function qt(e,t){let n,r,i,o=t[15](t[51],t[49],t[3]),s=o&&Ht(t);return{key:e,first:null,c(){n=P(),s&&s.c(),r=P(),this.first=n},m(e,t){R(e,n,t),s&&s.m(e,t),R(e,r,t),i=!0},p(e,n){t=e,44&n[0]&&(o=t[15](t[51],t[49],t[3])),o?s?(s.p(t,n),44&n[0]&&we(s,1)):(s=Ht(t),s.c(),we(s,1),s.m(r.parentNode,r)):s&&(pe(),ye(s,1,1,(()=>{s=null})),ge())},i(e){i||(we(s),i=!0)},o(e){ye(s),i=!1},d(e){e&&D(n),s&&s.d(e),e&&D(r)}}}function jt(e){let t,n;return t=new e[7]({}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p:_,i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Gt(e){let t,n,r,i={ctx:e,current:null,token:null,hasCatch:!1,pending:jt,then:Mt,catch:xt,value:50,blocks:[,,,]};return ve(n=e[2]&&e[13](),i),{c(){t=P(),i.block.c()},m(e,n){R(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[13]())&&ve(n,i)||_e(i,e,r)},i(e){r||(we(i.block),r=!0)},o(e){for(let e=0;e<3;e+=1){ye(i.blocks[e])}r=!1},d(e){e&&D(t),i.block.d(e),i.token=null,i=null}}}const Xt=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)))),a||(a=n.items.find((t=>t.name===e))),!a){const n=(await t.getSchemaByClass(e)).items.find((e=>e.name===s));n&&(a={name:e,designation:n.designation,type:n.type,decimals:n.properties?.decimals||0})}i.find((t=>t?.name===e))||i.push(a)}return i.length?i:n.items}));function Yt(e,i,o){let s;let a=JSON.parse(n.getItem("Locale")).id;const l=K(),{Loading:d,TextField:h}=c,{currentTasks:f}=u;b(e,f,(e=>o(37,s=e)));let p,w,y,v,{inputList:_}=i,{eventId:I}=i,{prevEventId:C}=i,{record:$}=i,{className:E}=i,{rowId:A}=i,{filterForReady:S=!1}=i,{filter:T}=i,{query:N}=i,{refStatus:R}=i,{showEdit:D=!1}=i,{praefix:k=""}=i,{selectionFields:O=!1}=i,{deList:x}=i,{stopAggregation:M=!1}=i,{shouldBlock:B}=i,{inputSearch:P=""}=i,L=!0,F=P,V=E+Math.floor(9e3*Math.random()+1e3).toString()+"search",U=!1,H=!0;const W=(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("_")){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(a,{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?g(n):m(e[`_${t.name}`]||n||"")},z=t.getSchemaByClass(E),q=async(e,n)=>{if(!e)return[];if(T){let n;const r=T.startsWith("!");r&&(n=T.replace("!",""));const i=T.startsWith("$");if(n&&!i&&(e=e.filter((e=>i?e[n]===A:r?!e[n]:!!e[n]))),i){n=T.replace("$","");const[r,i]=n.split(".");if($[i]){const n=await t.getSectionView(r,{[i]:$[i]});e=e.filter((e=>n.find((t=>t._id==e[r]))))}else e=[]}}if(R&&!N)return o(18,R=[].concat(R)),e.filter((e=>!!R.find((t=>e._task.status===t))));if("Information"===n.state.task)return e;if(C){const n=await t.getEvent(C);if("report"===n?.output?.type)return e;if(n?.input?.class?.length&&n.input.class[0].name===E)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))},j=(e,t)=>{if(e){let n,r="1";if("string"==typeof e)n=e;else{const t=Object.keys(e);n=t[0],r=t[1]}"date"===n&&(r="-1");const i=new Intl.Collator(a,{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},G=async e=>{let n,r=0;H=!1;const i=e=>new Promise((t=>setTimeout(t,e))),s=await z;for(;r++<200&&!M&&!(n=await X(e,s.id));)await i(500);o(6,U=!1),M&&t.readTasksByAggregationId(e,!0),n&&(o(5,y=j(w.displaySort,n.data)),window.setTimeout((()=>{const e=document.querySelector("tr.active");e&&e.scrollIntoView({block:"end",behavior:"smooth"}),H=!0}),100))},X=async(e,n)=>await t.readTasksByAggregationId(e,!1,n),Z=async(e,t,n,r)=>{const{value:i,refClass:o}=r,[s,a]=n.split("."),l=i?.get(k),c=l&&await ph(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 fh(o+r._id.toString(),r),r})):e};Y((()=>{window.setTimeout((()=>{const e=document.querySelector("tr.active");e?e.scrollIntoView({block:"end",behavior:"smooth"}):document.getElementById(V)?.focus()}),200)})),r.subscribe((async e=>{if(!e)return;const t=await z;e.eventId===t.id&&(gh(t.class,e.eventId),o(2,L=!o(2,L=!1)))}));return e.$$set=e=>{"inputList"in e&&o(20,_=e.inputList),"eventId"in e&&o(21,I=e.eventId),"prevEventId"in e&&o(22,C=e.prevEventId),"record"in e&&o(23,$=e.record),"className"in e&&o(24,E=e.className),"rowId"in e&&o(1,A=e.rowId),"filterForReady"in e&&o(25,S=e.filterForReady),"filter"in e&&o(26,T=e.filter),"query"in e&&o(27,N=e.query),"refStatus"in e&&o(18,R=e.refStatus),"showEdit"in e&&o(0,D=e.showEdit),"praefix"in e&&o(28,k=e.praefix),"selectionFields"in e&&o(29,O=e.selectionFields),"deList"in e&&o(30,x=e.deList),"stopAggregation"in e&&o(19,M=e.stopAggregation),"shouldBlock"in e&&o(31,B=e.shouldBlock),"inputSearch"in e&&o(32,P=e.inputSearch)},[D,A,L,F,p,y,U,d,h,f,V,W,(e,t)=>n=>{o(19,M=!0);const r=H?e:v[t];l("choose",{row:r})},async()=>{w=await z,o(4,p=(e=>!s?.length||!!s.find((t=>t===e)))(w.id)),N&&o(5,y=v=await t.getTasksFiltered(w.class,N)),y||o(5,y=v=j(w.displaySort,await _||await uh(w.class,w.id))),500!==y?.length||N||(o(6,U=!0),t.getTasksList(w.id,!1,!0).then((({aggregationId:e})=>G(e))));let e,n=!1,r="";const i=O&&O?.find((e=>w.class===e.refClass.split(":")[0])),a=i?.value?.get&&i.value.get(k);if(a){const[s,l]=i.refClass.split(":");w.class===s&&o(5,y=await Z(y,s,l,i)),n=i.parentClass?.find((e=>"quantity"===e.name)),r=i.className,e=await t.getCountedSection(r,l.split(".")[0],a,s,"quantity")}o(0,D&&=!i),!i&&(T||S||R)&&o(5,y=await q(y,w));const{display:c}=w;let d=await Xt(c,w,y);return!D&&n?(d=d.concat([{name:"quantity",designation:"h-Soll",type:"number",decimals:2},{name:"ist",designation:"h-Ist",type:"number",decimals:2}]),o(5,y=y.map((t=>{const n=e.find((e=>e._id===t._id));return n&&(t.ist=n.quantity.$numberDecimal),t}))),e.map((e=>{if(!y.find((t=>t._id===e._id))){const t=v.find((t=>t._id===e._id));t&&(t.ist=e.quantity.$numberDecimal),y.push(t)}})),l("init",y)):x&&o(5,y=y.filter((e=>!x.find((t=>t?._id===e._id))))),B&&o(5,y=y.filter((e=>!e[B]))),{items:d}},({detail:{value:e}})=>{o(3,F=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=W(e,i).toLowerCase();!r&&t.includes(n)&&(r=!0)}return r},()=>{o(3,F="")},async e=>{let t=e._task;t||(t=await hh(E,"",e._id,!0),t=t._task),window.open(`/task/${t.event}/${t.task_id||t._id}/task?view=standalone`,"_blank")},R,M,_,I,C,$,E,S,T,N,k,O,x,B,P,function(e){F=e,o(3,F)}]}class Zt extends Te{constructor(e){var t;super(),Nt.getElementById("svelte-47aais-style")||((t=O("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}",N(Nt.head,t)),Se(this,e,Yt,Gt,A,{inputList:20,eventId:21,prevEventId:22,record:23,className:24,rowId:1,filterForReady:25,filter:26,query:27,refStatus:18,showEdit:0,praefix:28,selectionFields:29,deList:30,stopAggregation:19,shouldBlock:31,inputSearch:32},[-1,-1])}}function Kt(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Qt(e){let t,n,r=e[45]&&Jt(e);return{c(){r&&r.c(),t=P()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,n){e[45]?r?(r.p(e,n),16&n[0]&&we(r,1)):(r=Jt(e),r.c(),we(r,1),r.m(t.parentNode,t)):r&&(pe(),ye(r,1,1,(()=>{r=null})),ge())},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function Jt(e){let t,n;return t=new e[25]({props:{title:e[20]?"Auswahl":e[0],class:"eList "+(e[18]?"form":""),$$slots:{default:[dn]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function en(e){let t,n;return t=new vh({props:{schema:e[2],recID:e[1],readonly:e[19]}}),t.$on("choose",(function(){E(e[34](e[45]))&&e[34](e[45]).apply(this,arguments)})),t.$on("back",e[31]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function tn(e){let t,n,r,i,o,s,a;t=new e[26]({props:{text:e[20]?"Zusätzliche Auswahl":""}});const l=[rn,nn],c=[];function d(e,t){return e[20]?0:1}return r=d(e),i=c[r]=l[r](e),s=new Zt({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(){Ee(t.$$.fragment),n=B(),i.c(),o=B(),Ee(s.$$.fragment)},m(e,i){Ae(t,e,i),R(e,n,i),c[r].m(e,i),R(e,o,i),Ae(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):(pe(),ye(c[u],1,1,(()=>{c[u]=null})),ge(),i=c[r],i?i.p(e,n):(i=c[r]=l[r](e),i.c()),we(i,1),i.m(o.parentNode,o));const h={};32768&n[0]&&(h.inputSearch=e[15]),8&n[0]&&(h.record=e[3]),4&n[0]&&(h.eventId=e[2].id),4&n[0]&&(h.className=e[2].class),16384&n[0]&&(h.prevEventId=e[14]),32&n[0]&&(h.filterForReady=e[5]),64&n[0]&&(h.filter=e[6]),128&n[0]&&(h.query=e[7]),256&n[0]&&(h.refStatus=e[8]),512&n[0]&&(h.praefix=e[9]),1024&n[0]&&(h.selectionFields=e[10]),2&n[0]&&(h.rowId=e[1]),65536&n[0]&&(h.shouldBlock=e[16]),4096&n[0]&&(h.deList=e[12]),16777216&n[0]&&(h.stopAggregation=e[24]),2048&n[0]&&(h.showEdit=e[11]),s.$set(h)},i(e){a||(we(t.$$.fragment,e),we(i),we(s.$$.fragment,e),a=!0)},o(e){ye(t.$$.fragment,e),ye(i),ye(s.$$.fragment,e),a=!1},d(e){be(t,e),e&&D(n),c[r].d(e),e&&D(o),be(s,e)}}}function nn(e){let t,n,r,i;n=new e[27]({props:{outline:!0,$$slots:{default:[on]},$$scope:{ctx:e}}}),n.$on("click",e[32]);let o=e[29]&&e[13]&&sn(e);return{c(){t=O("div"),Ee(n.$$.fragment),r=B(),o&&o.c(),U(t,"class","form--buttons svelte-jb5mrh")},m(e,s){R(e,t,s),Ae(n,t,null),N(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]&&we(o,1)):(o=sn(e),o.c(),we(o,1),o.m(t,null)):o&&(pe(),ye(o,1,1,(()=>{o=null})),ge())},i(e){i||(we(n.$$.fragment,e),we(o),i=!0)},o(e){ye(n.$$.fragment,e),ye(o),i=!1},d(e){e&&D(t),be(n),o&&o.d()}}}function rn(e){let t,n,r,i,o,s,a=e[23]&&ln(e);return r=new e[27]({props:{outline:!0,$$slots:{default:[cn]},$$scope:{ctx:e}}}),r.$on("click",e[32]),o=new e[26]({props:{text:"Liste aus "+e[17]}}),{c(){a&&a.c(),t=B(),n=O("div"),Ee(r.$$.fragment),i=B(),Ee(o.$$.fragment),U(n,"class","form--buttons svelte-jb5mrh")},m(e,l){a&&a.m(e,l),R(e,t,l),R(e,n,l),Ae(r,n,null),R(e,i,l),Ae(o,e,l),s=!0},p(e,n){e[23]?a?(a.p(e,n),8388608&n[0]&&we(a,1)):(a=ln(e),a.c(),we(a,1),a.m(t.parentNode,t)):a&&(pe(),ye(a,1,1,(()=>{a=null})),ge());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||(we(a),we(r.$$.fragment,e),we(o.$$.fragment,e),s=!0)},o(e){ye(a),ye(r.$$.fragment,e),ye(o.$$.fragment,e),s=!1},d(e){a&&a.d(e),e&&D(t),e&&D(n),be(r),e&&D(i),be(o,e)}}}function on(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function sn(e){let t,n;return t=new e[27]({props:{filled:!0,$$slots:{default:[an]},$$scope:{ctx:e}}}),t.$on("click",e[33]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function an(e){let t;return{c(){t=M("Neu")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function ln(e){let t,n;return t=new Ll({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(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function cn(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function dn(e){let t,n,r,i;const o=[tn,en],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=P()},m(e,n){s[t].m(e,n),R(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?s[t].p(e,i):(pe(),ye(s[l],1,1,(()=>{s[l]=null})),ge(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),we(n,1),n.m(r.parentNode,r))},i(e){i||(we(n),i=!0)},o(e){ye(n),i=!1},d(e){s[t].d(e),e&&D(r)}}}function un(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function hn(e){let t,n,r,i={ctx:e,current:null,token:null,hasCatch:!1,pending:un,then:Qt,catch:Kt,value:45,blocks:[,,,]};return ve(n=e[30](e[4]),i),{c(){t=P(),i.block.c()},m(e,n){R(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]))&&ve(n,i)||_e(i,e,r)},i(e){r||(we(i.block),r=!0)},o(e){for(let e=0;e<3;e+=1){ye(i.blocks[e])}r=!1},d(e){e&&D(t),i.block.d(e),i.token=null,i=null}}}function fn(e,n,r){let i;const{Dialog:o,Divider:s,Button:a}=c,l=K(),{currentTasks:d}=u;b(e,d,(e=>r(41,i=e)));let{title:h}=n,{schema:f}=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:C=!1}=n,{showEdit:$=!0}=n,{deList:E}=n,{newAllowed:A=!0}=n,{prevEventId:S}=n,{inputSearch:T}=n,{shouldBlock:N}=n,R=f.id;f.class;let D,k,O,x,M,B,P,L="",F=!1,V=!1;h??=f.identity.designation;const U=!i?.length||i.find((e=>e===R));return e.$$set=e=>{"title"in e&&r(0,h=e.title),"schema"in e&&r(2,f=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,C=e.selectionFields),"showEdit"in e&&r(11,$=e.showEdit),"deList"in e&&r(12,E=e.deList),"newAllowed"in e&&r(13,A=e.newAllowed),"prevEventId"in e&&r(14,S=e.prevEventId),"inputSearch"in e&&r(15,T=e.inputSearch),"shouldBlock"in e&&r(16,N=e.shouldBlock)},[h,p,f,m,g,w,y,v,_,I,C,$,E,A,S,T,N,L,F,D,O,M,B,P,V,o,s,a,d,U,async e=>{if(!e)return!1;const n=await uh(f.class,f.id);if(k=C&&C?.find((e=>f.class===e.refClass.split(":")[0])),r(20,O=k?.value?.get&&k.value.get(I)),O){x=k.refClass;const[e,n]=x.split(":"),[i]=n.split(".");r(21,M=k.parentClass.find((t=>t.name===e)));const o=await t.getSchemaByClass(M.refClass);r(22,B=o.id),r(17,L=k.parentClass.find((e=>e.name===i)).designation)}return n},()=>{r(18,F=!1),p||l("back"),$||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=f.display;t&&t.length&&t.map((t=>{const[n,r]=t.split(".");let i=f.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})=>{O&&r(23,P=e)},({detail:e})=>{if(!e.value)return;const t={_id:e.value};l("choose",{row:t})},function(t){Q(e,t)}]}class mn extends Te{constructor(e){var t;super(),document.getElementById("svelte-jb5mrh-style")||((t=O("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}",N(document.head,t)),Se(this,e,fn,hn,A,{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:pn}=Ie;function gn(e){e[28]=e[30].list,e[29]=e[30].items}function wn(e,t,n){const r=e.slice();return r[31]=t[n],r}function yn(e,t,n){const r=e.slice();return r[34]=t[n],r}function vn(e,t,n){const r=e.slice();return r[34]=t[n],r}function _n(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function In(e){let t,n,r,i,o,s,a,l,c,d,u,h,f,m,p,g,w,y;function v(t){e[25](t)}gn(e),n=new e[7]({props:{outline:!0,$$slots:{default:[Cn]},$$scope:{ctx:e}}}),n.$on("click",e[24]);let _={id:e[8]};void 0!==e[1]&&(_.value=e[1]),s=new e[6]({props:_}),ee.push((()=>$e(s,"value",v))),s.$on("input",e[12]),d=new tt({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]=$n(vn(e,o,t));return{c(){t=O("thead"),n=O("tr"),r=O("th"),i=B();for(let e=0;e<s.length;e+=1)s[e].c();U(r,"class","svelte-14hcfjl"),U(n,"class","svelte-14hcfjl"),U(t,"class","svelte-14hcfjl")},m(e,o){R(e,t,o),N(t,n),N(n,r),N(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=vn(e,o,r);s[r]?s[r].p(i,t):(s[r]=$n(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&&D(t),k(s,e)}}}(e),C=e[28]?.length&&function(e){let t,n,r=e[28],i=[];for(let t=0;t<r.length;t+=1)i[t]=bn(wn(e,r,t));const o=e=>ye(i[e],1,1,(()=>{i[e]=null}));return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=P()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);R(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=wn(e,r,s);i[s]?(i[s].p(o,n),we(i[s],1)):(i[s]=bn(o),i[s].c(),we(i[s],1),i[s].m(t.parentNode,t))}for(pe(),s=r.length;s<i.length;s+=1)o(s);ge()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)we(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)ye(i[e]);n=!1},d(e){k(i,e),e&&D(t)}}}(e);return{c(){t=O("div"),Ee(n.$$.fragment),r=B(),i=O("div"),o=M("Suchen: "),Ee(s.$$.fragment),l=B(),c=O("span"),Ee(d.$$.fragment),u=B(),h=O("div"),f=O("table"),I&&I.c(),m=B(),p=O("tbody"),C&&C.c(),U(t,"class","form--buttons svelte-14hcfjl"),U(c,"class","feather pointer svelte-14hcfjl"),z(i,"margin-bottom","1em"),z(i,"position","relative"),U(f,"striped",""),U(f,"class","svelte-14hcfjl"),U(h,"class","eList svelte-14hcfjl")},m(a,v){R(a,t,v),Ae(n,t,null),R(a,r,v),R(a,i,v),N(i,o),Ae(s,i,null),N(i,l),N(i,c),Ae(d,c,null),R(a,u,v),R(a,h,v),N(h,f),I&&I.m(f,null),N(f,m),N(f,p),C&&C.m(p,null),g=!0,w||(y=L(c,"click",e[14]),w=!0)},p(e,t){gn(e);const r={};256&t[1]&&(r.$$scope={dirty:t,ctx:e}),n.$set(r);const i={};!a&&2&t[0]&&(a=!0,i.value=e[1],le((()=>a=!1))),s.$set(i),e[29]?.length&&I.p(e,t),e[28]?.length&&C.p(e,t)},i(e){g||(we(n.$$.fragment,e),we(s.$$.fragment,e),we(d.$$.fragment,e),we(C),g=!0)},o(e){ye(n.$$.fragment,e),ye(s.$$.fragment,e),ye(d.$$.fragment,e),ye(C),g=!1},d(e){e&&D(t),be(n),e&&D(r),e&&D(i),be(s),be(d),e&&D(u),e&&D(h),I&&I.d(),C&&C.d(),w=!1,y()}}}function Cn(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function $n(e){let t,n,r=e[34]?.designation+"";return{c(){t=O("th"),n=M(r),U(t,"class","svelte-14hcfjl")},m(e,r){R(e,t,r),N(t,n)},p:_,d(e){e&&D(t)}}}function En(e){let t,n,r,i,o,s,a,l;r=new it({props:{size:"18"}});let c=e[29],d=[];for(let t=0;t<c.length;t+=1)d[t]=An(yn(e,c,t));return{c(){t=O("tr"),n=O("td"),Ee(r.$$.fragment),i=B();for(let e=0;e<d.length;e+=1)d[e].c();o=B(),U(n,"class","editRow svelte-14hcfjl"),U(t,"class","pointer svelte-14hcfjl"),q(t,"active",e[31]._id===e[0])},m(c,u){R(c,t,u),N(t,n),Ae(r,n,null),N(t,i);for(let e=0;e<d.length;e+=1)d[e].m(t,null);N(t,o),s=!0,a||(l=L(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=yn(e,c,n);d[n]?d[n].p(i,r):(d[n]=An(i),d[n].c(),d[n].m(t,o))}for(;n<d.length;n+=1)d[n].d(1);d.length=c.length}2049&r[0]&&q(t,"active",e[31]._id===e[0])},i(e){s||(we(r.$$.fragment,e),s=!0)},o(e){ye(r.$$.fragment,e),s=!1},d(e){e&&D(t),be(r),k(d,e),a=!1,l()}}}function An(e){let t,n,r,i,o=e[9](e[31],e[34])+"";return{c(){t=O("td"),n=M(o),U(t,"class","svelte-14hcfjl")},m(o,s){R(o,t,s),N(t,n),r||(i=L(t,"click",V(e[10](e[31]))),r=!0)},p(t,n){e=t},d(e){e&&D(t),r=!1,i()}}}function bn(e){let t,n,r=e[13](e[31],e[29],e[1]),i=r&&En(e);return{c(){i&&i.c(),t=P()},m(e,r){i&&i.m(e,r),R(e,t,r),n=!0},p(e,n){2&n[0]&&(r=e[13](e[31],e[29],e[1])),r?i?(i.p(e,n),2&n[0]&&we(i,1)):(i=En(e),i.c(),we(i,1),i.m(t.parentNode,t)):i&&(pe(),ye(i,1,1,(()=>{i=null})),ge())},i(e){n||(we(i),n=!0)},o(e){ye(i),n=!1},d(e){i&&i.d(e),e&&D(t)}}}function Sn(e){let t,n;return t=new e[5]({}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p:_,i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Tn(e){let t,n,r,i;t=new e[4]({});let o={ctx:e,current:null,token:null,hasCatch:!1,pending:Sn,then:In,catch:_n,value:30,blocks:[,,,]};return ve(e[11](),o),{c(){Ee(t.$$.fragment),n=B(),r=P(),o.block.c()},m(e,s){Ae(t,e,s),R(e,n,s),R(e,r,s),o.block.m(e,o.anchor=s),o.mount=()=>r.parentNode,o.anchor=r,i=!0},p(t,n){_e(o,e=t,n)},i(e){i||(we(t.$$.fragment,e),we(o.block),i=!0)},o(e){ye(t.$$.fragment,e);for(let e=0;e<3;e+=1){ye(o.blocks[e])}i=!1},d(e){be(t,e),e&&D(n),e&&D(r),o.block.d(e),o.token=null,o=null}}}function Nn(e){let t,n;return t=new e[3]({props:{title:"Auswahl",class:"eList",$$slots:{default:[Tn]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Rn(e,n,i){const o=K(),{Dialog:s,Divider:a,Loading:l,TextField:d,Button:u}=c;let{item:h}=n,{classId:f}=n,{className:p}=n,{rowId:w}=n,{viewName:y}=n,{viewValue:v}=n,{recordId:_}=n,{filter:I}=n,{multiValues:C}=n,$="",E=f+Math.floor(9e3*Math.random()+1e3).toString()+"search";const A=(e,t)=>{if(!t)return;const n=e[t.name];return"boolean"==typeof n?g(n):m(e[`_${t.name}`]||e[t.name]||"")},b=t.getSchemaByClass(p);Y((()=>{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&&gh(t.class,e.eventId)}));return e.$$set=e=>{"item"in e&&i(16,h=e.item),"classId"in e&&i(17,f=e.classId),"className"in e&&i(18,p=e.className),"rowId"in e&&i(0,w=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,C=e.multiValues)},[w,$,o,s,a,l,d,u,E,A,e=>()=>o("choose",{row:e}),async()=>{const e=await b;let n=[];if(h.lookup){const r="."+f+"#"+h.lookup,i=document.querySelector(r);let o=i?.value||_;if(C.has(h.lookup)){const r=C.get(h.lookup)[0];n=r?await t.getSectionView(h.name,{[h.lookup]:r},!0):await uh(h.name,e.id)}else if(o&&24===o.toString().length){const e=await ph(h.lookup,o);if(e){const r=e[h.name]?.map((e=>e[h.name]));r&&(n=await t.getSectionView(h.name,{_id:{$in:r}},!0))}}}else{const r="."+f+"#"+y.split(":")[0],i=document.querySelector(r);let o={[y]:i?.value||_};if(h.refItem){const e="."+f+"#"+h.refItem;try{const t=document.querySelector(e);if(t){const e={$or:[{[h.refItem]:t.value},{[h.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 Xt(r,e,n)}},({detail:{value:e}})=>{i(1,$=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(1,$="")},e=>async()=>{const n=await t.getTaskByDocId(e._id,!0),r=`/task/${n.event}/${n._id}/task?view=standalone`;window.open(r)},h,f,p,y,v,_,I,C,()=>o("back"),function(e){$=e,i(1,$)}]}class Dn extends Te{constructor(e){var t;super(),pn.getElementById("svelte-14hcfjl-style")||((t=O("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}",N(pn.head,t)),Se(this,e,Rn,Nn,A,{item:16,classId:17,className:18,rowId:0,viewName:19,viewValue:20,recordId:21,filter:22,multiValues:23},[-1,-1])}}const{document:kn}=Ie;function On(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function xn(e){let t,n,r=e[72]&&function(e){let t,n,r,i,s,a,l,c,d,u,h,f,m,p,g,w,y,v,_;function I(t){e[55](t)}function C(t){e[56](t)}let $={class:"full-width",id:e[32],rows:"1",required:e[2],disabled:e[3],placeholder:e[34],style:"height:2.8em; padding-left:2em;padding-right:2em;overflow-y:hidden; resize:none;"};void 0!==e[1]&&($.value=e[1]);void 0!==e[25]&&($.overwrite=e[25]);n=new o({props:$}),ee.push((()=>$e(n,"value",I))),ee.push((()=>$e(n,"overwrite",C))),n.$on("click",e[37]()),n.$on("blur",e[44]);const E=[Bn,Mn],A=[];function b(e,t){return!e[3]||e[16]?0:e[22]&&e[0]?1:-1}~(a=b(e))&&(l=A[a]=E[a](e));let T=(!e[3]||e[16]||e[17])&&Pn(e);function k(t){e[57](t)}let x={class:"tModal",noClickaway:!0,$$slots:{default:[Un]},$$scope:{ctx:e}};void 0!==e[19]&&(x.open=e[19]);m=new e[28]({props:x}),ee.push((()=>$e(m,"open",k)));let M=e[20]&&Hn(e);return{c(){t=O("div"),Ee(n.$$.fragment),s=B(),l&&l.c(),c=B(),d=O("input"),h=B(),T&&T.c(),f=B(),Ee(m.$$.fragment),g=B(),M&&M.c(),w=P(),U(d,"class",u=S(e[9]||e[10])+" svelte-jox15l"),U(d,"id",e[5]),U(d,"name",e[5]),d.value=e[0],d.hidden=!0,z(t,"position","relative")},m(r,i){R(r,t,i),Ae(n,t,null),N(t,s),~a&&A[a].m(t,null),N(t,c),N(t,d),N(t,h),T&&T.m(t,null),R(r,f,i),Ae(m,r,i),R(r,g,i),M&&M.m(r,i),R(r,w,i),y=!0,v||(_=L(t,"keydown",e[38]),v=!0)},p(e,o){const s={};4&o[0]&&(s.required=e[2]),8&o[0]&&(s.disabled=e[3]),!r&&2&o[0]&&(r=!0,s.value=e[1],le((()=>r=!1))),!i&&33554432&o[0]&&(i=!0,s.overwrite=e[25],le((()=>i=!1))),n.$set(s);let h=a;a=b(e),a===h?~a&&A[a].p(e,o):(l&&(pe(),ye(A[h],1,1,(()=>{A[h]=null})),ge()),~a?(l=A[a],l?l.p(e,o):(l=A[a]=E[a](e),l.c()),we(l,1),l.m(t,c)):l=null),(!y||1536&o[0]&&u!==(u=S(e[9]||e[10])+" svelte-jox15l"))&&U(d,"class",u),(!y||32&o[0])&&U(d,"id",e[5]),(!y||32&o[0])&&U(d,"name",e[5]),(!y||1&o[0]&&d.value!==e[0])&&(d.value=e[0]),!e[3]||e[16]||e[17]?T?(T.p(e,o),196616&o[0]&&we(T,1)):(T=Pn(e),T.c(),we(T,1),T.m(t,null)):T&&(pe(),ye(T,1,1,(()=>{T=null})),ge());const f={};93126097&o[0]|2048&o[2]&&(f.$$scope={dirty:o,ctx:e}),!p&&524288&o[0]&&(p=!0,f.open=e[19],le((()=>p=!1))),m.$set(f),e[20]?M?(M.p(e,o),1048576&o[0]&&we(M,1)):(M=Hn(e),M.c(),we(M,1),M.m(w.parentNode,w)):M&&(pe(),ye(M,1,1,(()=>{M=null})),ge())},i(e){y||(we(n.$$.fragment,e),we(l),we(T),we(m.$$.fragment,e),we(M),y=!0)},o(e){ye(n.$$.fragment,e),ye(l),ye(T),ye(m.$$.fragment,e),ye(M),y=!1},d(e){e&&D(t),be(n),~a&&A[a].d(),T&&T.d(),e&&D(f),be(m,e),e&&D(g),M&&M.d(e),e&&D(w),v=!1,_()}}}(e);return{c(){r&&r.c(),t=P()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,t){e[72]&&r.p(e,t)},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function Mn(e){let t,n,r,i,o;return n=new it({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather pointer svelte-jox15l")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[43]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function Bn(e){let t,n,r,i,o;return n=new Tt({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather pointer svelte-jox15l")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=[L(t,"click",e[37](!0)),L(t,"choose",e[40])],i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,$(o)}}}function Pn(e){let t,n,r,i,o;return n=new tt({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather2 pointer svelte-jox15l")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[42]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function Ln(e){let t,n,r,i;const o=[Vn,Fn],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=P()},m(e,n){s[t].m(e,n),R(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?s[t].p(e,i):(pe(),ye(s[l],1,1,(()=>{s[l]=null})),ge(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),we(n,1),n.m(r.parentNode,r))},i(e){i||(we(n),i=!0)},o(e){ye(n),i=!1},d(e){s[t].d(e),e&&D(r)}}}function Fn(e){let t,n;return t=new mn({props:{title:e[6].designation,newAllowed:e[23],prevEventId:e[11],schema:e[18],filter:e[33],query:e[35](),record:e[7],recID:e[0],isOpening:e[19],filterForReady:e[24],refStatus:e[6].refStatus,selectionFields:e[14],deList:e[15],praefix:e[13],shouldBlock:e[26],inputSearch:e[39]()}}),t.$on("choose",e[40]),t.$on("back",e[41]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),16777216&n[0]&&(r.filterForReady=e[24]),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]),67108864&n[0]&&(r.shouldBlock=e[26]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Vn(e){let t,n;return t=new Dn({props:{item:e[6],className:e[18].class,classId:e[10],rowId:e[0],recordId:e[12],viewName:e[4],viewValue:"",multiValues:e[8]}}),t.$on("choose",e[40]),t.$on("back",e[41]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Un(e){let t,n,r=e[19]&&Ln(e);return{c(){r&&r.c(),t=P()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,n){e[19]?r?(r.p(e,n),524288&n[0]&&we(r,1)):(r=Ln(e),r.c(),we(r,1),r.m(t.parentNode,t)):r&&(pe(),ye(r,1,1,(()=>{r=null})),ge())},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function Hn(e){let t,n,r;function i(t){e[58](t)}let o={class:"tModal",noClickaway:!0,$$slots:{default:[zn]},$$scope:{ctx:e}};return void 0!==e[20]&&(o.open=e[20]),t=new e[28]({props:o}),ee.push((()=>$e(t,"open",i))),{c(){Ee(t.$$.fragment)},m(e,n){Ae(t,e,n),r=!0},p(e,r){const i={};2359297&r[0]|2048&r[2]&&(i.$$scope={dirty:r,ctx:e}),!n&&1048576&r[0]&&(n=!0,i.open=e[20],le((()=>n=!1))),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function Wn(e){let t,n;return t=new vh({props:{schema:e[18],recID:e[0],readonly:!0}}),t.$on("back",e[41]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function zn(e){let t,n;return t=new e[27]({props:{title:e[21],$$slots:{default:[Wn]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};2097152&n[0]&&(r.title=e[21]),262145&n[0]|2048&n[2]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function qn(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function jn(e){let t,n,r={ctx:e,current:null,token:null,hasCatch:!1,pending:qn,then:xn,catch:On,value:72,blocks:[,,,]};return ve(e[36](),r),{c(){t=P(),r.block.c()},m(e,i){R(e,t,i),r.block.m(e,r.anchor=i),r.mount=()=>t.parentNode,r.anchor=t,n=!0},p(t,n){_e(r,e=t,n)},i(e){n||(we(r.block),n=!0)},o(e){for(let e=0;e<3;e+=1){ye(r.blocks[e])}n=!1},d(e){e&&D(t),r.block.d(e),r.token=null,r=null}}}function Gn(e,n,r){let o,s,a,l;b(e,i,(e=>r(54,o=e)));const d=K(),{Dialog:h,Modal:f}=c,{currentTasks:m,environment:p,loggedIn:g}=u;b(e,m,(e=>r(60,s=e))),b(e,p,(e=>r(62,l=e))),b(e,g,(e=>r(61,a=e)));let{id:y}=n,{item:v}=n,{fullRecord:_}=n,{value:I=""}=n,{multiValues:C}=n,{desc:$=""}=n,{noForm:E=!1}=n,{classId:A}=n,{eventId:S}=n,{recordId:T}=n,{withRefValue:N=!1}=n,{refValue:R=""}=n,{shortEdit:D}=n,{required:k}=n,{disabled:O}=n,{readonly:x}=n,{praefix:M}=n,{selectionFields:B}=n,{formnovalidate:P}=n,{selection:L}=n,{deList:F}=n,{isTemplate:V}=n,{noList:U=!1}=n,{multi:H=!1}=n,{initFinished:W}=n;const z="comment_"+y,q=v.filter;let j,G,X,Y,Z,Q,J=!1,ee=!0,te=!0,ne=!0,re=!1,ie="";x||=T&&v.asInput,O||=x,!L&&v.selection&&1===v.selection.split(":").length&&(L=v.selection);const oe=x||O||v.lookup||L&&!v.constraint?"":"Suchbegriff ⏎",se=()=>{v.refItem&&v.refItem.startsWith("owner")&&(r(46,R=l.owner[v.refClass]),R||r(46,R=((e,t)=>{try{return e.split(".").reduce(((e,t)=>e[t]),t)}catch(e){return""}})(v.refItem,l)),R&&(r(45,N=!0),d("change",{value:R})))},ae=async e=>{e.items.filter((e=>e.properties?.default)).forEach((t=>{d("defPrep",{className:e.class,itemName:t.name,value:t.properties.default})}))},le=async e=>{const n=()=>{r(19,J=!0)};if(9==e.which)return;if(I)return e.preventDefault();if(13!=e.which)return;e.preventDefault();const i=X.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:h=!1,end:f=!1}=d;if(o.length<u)return n();const m=(h?"^":"")+o+(f?"$":"");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(X.class,p);1!==g?.length?n():r(0,I=g[0]._id)},ce=e=>{e&&(r(53,ie=r(1,$=w(X,e))),d("setRefDesc",$.split(" •")[0]),d("change",{value:I,description:$}),d("task",{row:e,eventId:X.id}))},de=()=>{r(19,J=!1),r(20,j=!1)};return e.$$set=e=>{"id"in e&&r(5,y=e.id),"item"in e&&r(6,v=e.item),"fullRecord"in e&&r(7,_=e.fullRecord),"value"in e&&r(0,I=e.value),"multiValues"in e&&r(8,C=e.multiValues),"desc"in e&&r(1,$=e.desc),"noForm"in e&&r(9,E=e.noForm),"classId"in e&&r(10,A=e.classId),"eventId"in e&&r(11,S=e.eventId),"recordId"in e&&r(12,T=e.recordId),"withRefValue"in e&&r(45,N=e.withRefValue),"refValue"in e&&r(46,R=e.refValue),"shortEdit"in e&&r(49,D=e.shortEdit),"required"in e&&r(2,k=e.required),"disabled"in e&&r(3,O=e.disabled),"readonly"in e&&r(48,x=e.readonly),"praefix"in e&&r(13,M=e.praefix),"selectionFields"in e&&r(14,B=e.selectionFields),"formnovalidate"in e&&r(50,P=e.formnovalidate),"selection"in e&&r(4,L=e.selection),"deList"in e&&r(15,F=e.deList),"isTemplate"in e&&r(16,V=e.isTemplate),"noList"in e&&r(51,U=e.noList),"multi"in e&&r(17,H=e.multi),"initFinished"in e&&r(47,W=e.initFinished)},e.$$.update=()=>{if(4&e.$$.dirty[0]|524288&e.$$.dirty[1]&&r(2,k=k&&!P),49152&e.$$.dirty[1]&&N&&r(0,I=R),3&e.$$.dirty[0]|4194304&e.$$.dirty[1]&&!$&&I&&ie&&r(1,$=ie),268353&e.$$.dirty[0]|1114112&e.$$.dirty[1]&&I&&X&&!Array.isArray(I)){const e=v.properties?.prefetch?500:0;if(T||v.asInput||v.upate||!1!==v.refItem||!1===v.refItem&&W)if(e){const e="p$"+v.refClass+"$"+S,t=dh(e);t?t.then((e=>{const t=e.find((({_id:e})=>e===I));t?ce(t):hh(v.refClass,X.id,I,!!v.lookup||U).then(ce)})):hh(v.refClass,X.id,I,!!v.lookup||U).then(ce)}else hh(v.refClass,X.id,I,!!v.lookup||U).then(ce);r(47,W=!0)}if(65&e.$$.dirty[0]|10485760&e.$$.dirty[1]&&I&&Y&&v.name===Y.input?.at(0)&&Y.inputLookup?.length){const{domain:e}=Y.inputLookup[0]||{};"user"===e&&(o.some((e=>Y.authorization?.find((t=>t.role===e&&!t.constraint))))||r(3,O=!0))}262145&e.$$.dirty[0]&&!I&&X&&ce({})},[I,$,k,O,L,y,v,_,C,E,A,S,T,M,B,F,V,H,X,J,j,G,Z,ee,te,ne,re,h,f,m,p,g,z,q,oe,()=>{if(!v.query)return;const[e,t]=v.query.split(".");if(!_[t])return;let n=[{$lookup:{from:e,localField:e,foreignField:"_id",as:"__"+e}},{$unwind:{path:"$__"+e,preserveNullAndEmptyArrays:!0}},{$match:{["__"+e+"."+t]:_[t]}}];return v.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":v.refStatus}}])),n},async()=>{try{const e=await t.getEvent(S);if(Q="report"===e.output.type,r(24,te=!v.asInput),r(23,ee=e.output?.class[0].name!==v.refClass),r(18,X=await t.getSchemaByClass(v.refClass)),Q||r(26,re=((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===v.name));if(t?.properties?.blocking)return n.name}return!1})(e,X)),ae(X),r(22,Z=(e=>!s?.length||!!s.find((t=>t===e)))(X.id)),r(52,Y=await t.getSchema(S)),S&&T&&I&&!O&&Y.input?.find((e=>e===v.refClass))&&r(3,O=!0),e.input?.class&&e.input.class[0]&&(e.input.class[0].name===v.refClass&&e.input.class[0].readonly&&r(3,O=!0),T&&e.input.class[0].name===v.refClass&&e.input.class[0].writeState)){(await t.getTaskByDocId(T,!0)).status===e.input.class[0].writeState&&r(3,O=r(48,x=!1))}if(v.properties?.query?.lookup){const{domain:e,value:n}=v.properties.query.lookup;if("user"===e){const e=a.user,i={[n]:e},s=await t.getSectionView(v.refClass,i);if(s?.length){const[{_id:e}]=s;e&&(r(46,R=e),r(45,N=!0),d("change",{value:R}))}o.some((e=>X.authorization?.find((t=>t.role===e&&!t.constraint))))||r(3,O=!0)}}else se();if(!R&&v.filter&&(""===M||void 0===M)){const e=v.filter,n=!0;e.startsWith("!")&&(n=!1,e=e.slice(1));const i=await t.getOneAndOnly(v.refClass,{[v.filter]:n});i&&(r(46,R=i._id),r(45,N=!0),d("change",{value:R}))}return r(21,G=X.identity.designation),!0}catch{return d("initFail",!0),!1}},e=>t=>{if(t.stopPropagation(),!0===e&&r(19,J=!0),e&&"BUTTON"===t.explicitOriginalTarget?.nodeName){const t=document.getElementById(e);return t?.blur()}(v.lookup||L&&!v.constraint||I)&&r(19,J=!0)},le,()=>{if(I)return"";const e=document.getElementById(z);return r(1,$=""),e?.value||""},({detail:e})=>{r(0,I=e.row._id),de()},de,()=>{(Q||Z)&&(H?d("change",{value:I,delete:!0}):(r(0,I=""),r(1,$=""),r(25,ne=!0),d("change",{value:I,description:$}),d("task",{row:{_task:{event:X.id,_id:!1}}})))},async()=>{if(!I)return;let e=await hh(v.refClass,X.id,I);e._task||(e={_task:await t.getTaskByDocId(I,!0)});const n=e._task.task_id||e._task._id,r=`/task/${e._task.event}/${n}/task?view=standalone`;window.open(r)},e=>{I||$&&le({which:13,preventDefault:()=>{},srcElement:{value:$}})},N,R,W,x,D,P,U,Y,ie,o,function(e){$=e,r(1,$),r(0,I),r(53,ie),r(45,N),r(46,R)},function(e){ne=e,r(25,ne)},function(e){J=e,r(19,J)},function(e){j=e,r(20,j)}]}class Xn extends Te{constructor(e){var t;super(),kn.getElementById("svelte-jox15l-style")||((t=O("style")).id="svelte-jox15l-style",t.textContent=".feather.svelte-jox15l{position:absolute;top:0.75em;left:0.5em;color:#4300b0}.feather2.svelte-jox15l{position:absolute;top:0.75em;right:0.5em;color:#4300b0}.text-field textarea:invalid{border-bottom:1px #b80000 solid !important;background-color:#fbeeee !important}",N(kn.head,t)),Se(this,e,Gn,jn,A,{id:5,item:6,fullRecord:7,value:0,multiValues:8,desc:1,noForm:9,classId:10,eventId:11,recordId:12,withRefValue:45,refValue:46,shortEdit:49,required:2,disabled:3,readonly:48,praefix:13,selectionFields:14,formnovalidate:50,selection:4,deList:15,isTemplate:16,noList:51,multi:17,initFinished:47},[-1,-1,-1])}}function Yn(e,t,n){const r=e.slice();return r[40]=t[n],r[42]=n,r}function Zn(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Kn(e){let t,n;return t=new e[16]({props:{outline:!0,$$slots:{default:[er]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};8191&n[0]|4096&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Qn(e){let t,n,r,i,o;return n=new ft({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather pointer")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",(function(){E(e[22](e[0]))&&e[22](e[0]).apply(this,arguments)})),i=!0)},p(t,n){e=t},i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function Jn(e){let t,n;return t=new Xn({props:{classId:e[6],eventId:e[7],required:e[9],disabled:e[1],formnovalidate:e[12],readonly:e[10],id:e[2]+"."+e[42],item:e[3],desc:e[4],value:e[40],noForm:e[5],praefix:e[11],recordId:e[8],multi:!0}}),t.$on("change",e[24]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};64&n[0]&&(r.classId=e[6]),128&n[0]&&(r.eventId=e[7]),512&n[0]&&(r.required=e[9]),2&n[0]&&(r.disabled=e[1]),4096&n[0]&&(r.formnovalidate=e[12]),1024&n[0]&&(r.readonly=e[10]),4&n[0]&&(r.id=e[2]+"."+e[42]),8&n[0]&&(r.item=e[3]),16&n[0]&&(r.desc=e[4]),1&n[0]&&(r.value=e[40]),32&n[0]&&(r.noForm=e[5]),2048&n[0]&&(r.praefix=e[11]),256&n[0]&&(r.recordId=e[8]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function er(e){let t,n,r,i=!e[10]&&Qn(e),o=[].concat(e[0]),s=[];for(let t=0;t<o.length;t+=1)s[t]=Jn(Yn(e,o,t));const a=e=>ye(s[e],1,1,(()=>{s[e]=null}));return{c(){i&&i.c(),t=B();for(let e=0;e<s.length;e+=1)s[e].c();n=P()},m(e,o){i&&i.m(e,o),R(e,t,o);for(let t=0;t<s.length;t+=1)s[t].m(e,o);R(e,n,o),r=!0},p(e,r){if(e[10]?i&&(pe(),ye(i,1,1,(()=>{i=null})),ge()):i?(i.p(e,r),1024&r[0]&&we(i,1)):(i=Qn(e),i.c(),we(i,1),i.m(t.parentNode,t)),16785407&r[0]){let t;for(o=[].concat(e[0]),t=0;t<o.length;t+=1){const i=Yn(e,o,t);s[t]?(s[t].p(i,r),we(s[t],1)):(s[t]=Jn(i),s[t].c(),we(s[t],1),s[t].m(n.parentNode,n))}for(pe(),t=o.length;t<s.length;t+=1)a(t);ge()}},i(e){if(!r){we(i);for(let e=0;e<o.length;e+=1)we(s[e]);r=!0}},o(e){ye(i),s=s.filter(Boolean);for(let e=0;e<s.length;e+=1)ye(s[e]);r=!1},d(e){i&&i.d(e),e&&D(t),k(s,e),e&&D(n)}}}function tr(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function nr(e){let t,n;return t=new e[18]({props:{title:e[14].designation,class:"eList",$$slots:{default:[ir]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};16384&n[0]&&(r.title=e[14].designation),49480&n[0]|4096&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function rr(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function ir(e){let t,n,r,i,o;return n=new e[19]({props:{outline:!0,$$slots:{default:[rr]},$$scope:{ctx:e}}}),n.$on("click",e[25]),i=new Zt({props:{item:e[3],className:e[14].class,classId:e[6],rowId:e[15],recordId:e[8],inputList:e[21]()}}),i.$on("choose",e[23]),i.$on("back",e[25]),{c(){t=O("div"),Ee(n.$$.fragment),r=B(),Ee(i.$$.fragment),U(t,"class","form--buttons")},m(e,s){R(e,t,s),Ae(n,t,null),R(e,r,s),Ae(i,e,s),o=!0},p(e,t){const r={};4096&t[1]&&(r.$$scope={dirty:t,ctx:e}),n.$set(r);const o={};8&t[0]&&(o.item=e[3]),16384&t[0]&&(o.className=e[14].class),64&t[0]&&(o.classId=e[6]),32768&t[0]&&(o.rowId=e[15]),256&t[0]&&(o.recordId=e[8]),i.$set(o)},i(e){o||(we(n.$$.fragment,e),we(i.$$.fragment,e),o=!0)},o(e){ye(n.$$.fragment,e),ye(i.$$.fragment,e),o=!1},d(e){e&&D(t),be(n),e&&D(r),be(i,e)}}}function or(e){let t,n,r=e[13]&&nr(e);return{c(){r&&r.c(),t=P()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,n){e[13]?r?(r.p(e,n),8192&n[0]&&we(r,1)):(r=nr(e),r.c(),we(r,1),r.m(t.parentNode,t)):r&&(pe(),ye(r,1,1,(()=>{r=null})),ge())},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function sr(e){let t,n,r,i,o={ctx:e,current:null,token:null,hasCatch:!1,pending:tr,then:Kn,catch:Zn,value:39,blocks:[,,,]};function s(t){e[34](t)}ve(e[20](),o);let a={class:"tModal",noClickaway:!0,$$slots:{default:[or]},$$scope:{ctx:e}};return void 0!==e[13]&&(a.open=e[13]),n=new e[17]({props:a}),ee.push((()=>$e(n,"open",s))),{c(){o.block.c(),t=B(),Ee(n.$$.fragment)},m(e,r){o.block.m(e,o.anchor=r),o.mount=()=>t.parentNode,o.anchor=t,R(e,t,r),Ae(n,e,r),i=!0},p(t,i){_e(o,e=t,i);const s={};57672&i[0]|4096&i[1]&&(s.$$scope={dirty:i,ctx:e}),!r&&8192&i[0]&&(r=!0,s.open=e[13],le((()=>r=!1))),n.$set(s)},i(e){i||(we(o.block),we(n.$$.fragment,e),i=!0)},o(e){for(let e=0;e<3;e+=1){ye(o.blocks[e])}ye(n.$$.fragment,e),i=!1},d(e){o.block.d(e),o.token=null,o=null,e&&D(t),be(n,e)}}}function ar(e,n,r){const i=K(),{Card:o,Modal:s,Dialog:a,Button:l}=c;let d,u,{id:h}=n,{item:f}=n,{record:m}=n,{values:p=[]}=n,{desc:g=""}=n,{noForm:w=!1}=n,{classId:y}=n,{eventId:v}=n,{recordId:_}=n,{withRefValue:I=!1}=n,{refValue:C=""}=n,{required:$}=n,{disabled:E}=n,{readonly:A}=n,{praefix:b}=n,{selectionFields:S}=n,{formnovalidate:T}=n,{selection:N}=n,{deList:R}=n,{isTemplate:D}=n,{noList:k=!1}=n,O=!1;const{lookup:x,filter:M,constraint:B}=f.properties.multi;E=!0;const P=()=>{r(13,O=!1)};return e.$$set=e=>{"id"in e&&r(2,h=e.id),"item"in e&&r(3,f=e.item),"record"in e&&r(26,m=e.record),"values"in e&&r(0,p=e.values),"desc"in e&&r(4,g=e.desc),"noForm"in e&&r(5,w=e.noForm),"classId"in e&&r(6,y=e.classId),"eventId"in e&&r(7,v=e.eventId),"recordId"in e&&r(8,_=e.recordId),"withRefValue"in e&&r(27,I=e.withRefValue),"refValue"in e&&r(28,C=e.refValue),"required"in e&&r(9,$=e.required),"disabled"in e&&r(1,E=e.disabled),"readonly"in e&&r(10,A=e.readonly),"praefix"in e&&r(11,b=e.praefix),"selectionFields"in e&&r(29,S=e.selectionFields),"formnovalidate"in e&&r(12,T=e.formnovalidate),"selection"in e&&r(30,N=e.selection),"deList"in e&&r(31,R=e.deList),"isTemplate"in e&&r(32,D=e.isTemplate),"noList"in e&&r(33,k=e.noList)},[p,E,h,f,g,w,y,v,_,$,A,b,T,O,d,u,o,s,a,l,async()=>{r(0,p=[].concat(p)),r(14,d=await t.getSchemaByClass(f.refClass))},async()=>{let e=await uh(d.class,d.id);if(!e?.length)return[];if(x&&(e=e.filter((e=>m[x]===e[x]))),B&&e?.length){const{refClass:n,refStatus:r}=B,i=[{$match:{[d.class]:{$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":r}}],o=await t.getSectionView(n,i);e=e.filter((e=>!!o.find((t=>t.project==e._id))))}if(M)for(const t in M)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},e=>()=>{A||(e=[].concat(e),r(13,O=!0),r(15,u=e))},({detail:e})=>{const t=e.row._id;r(0,p=[].concat(p)),Array.isArray(p)&&!p.find((e=>e===t))&&r(0,p=p.concat(e.row._id)),P()},({detail:e})=>{r(0,p=[].concat(p)),e.delete&&r(0,p=p.filter((t=>t!==e.value))),e.value=p,i("change",e),i("multi",{lookup:x,filter:M,name:f.name,value:p})},P,m,I,C,S,N,R,D,k,function(e){O=e,r(13,O)}]}class lr extends Te{constructor(e){var t;super(),document.getElementById("svelte-1m792ni-style")||((t=O("style")).id="svelte-1m792ni-style",t.textContent=".field .card{padding:1em !important;margin-bottom:1em !important}",N(document.head,t)),Se(this,e,ar,sr,A,{id:2,item:3,record:26,values:0,desc:4,noForm:5,classId:6,eventId:7,recordId:8,withRefValue:27,refValue:28,required:9,disabled:1,readonly:10,praefix:11,selectionFields:29,formnovalidate:12,selection:30,deList:31,isTemplate:32,noList:33},[-1,-1])}}const cr=/\d+/g,dr=/%[HMSpPdmyY%]/g;function ur(e,t,n){const r=Math.floor((new Date).getFullYear()/100);let i=!1;if(""===e)return null;const o=t.split(dr);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{cr.lastIndex=s;const o=cr.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 hr(e,t){return null==e||null==t?e:(t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t)}const{document:fr}=Ie;function mr(e,t,n){const r=e.slice();return r[17]=t[n],r}function pr(e,t,n){const r=e.slice();return r[20]=t[n],r}function gr(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function wr(e){let t,n,r,i,o,s,a,l,c,d,u,h,f,m=e[0].items,p=[];for(let t=0;t<m.length;t+=1)p[t]=vr(pr(e,m,t));const g=e=>ye(p[e],1,1,(()=>{p[e]=null}));let w=e[0].list&&_r(e);return l=new e[5]({props:{outline:!0,$$slots:{default:[Cr]},$$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:[$r]},$$scope:{ctx:e}}}),{c(){t=O("form"),n=O("input"),i=B();for(let e=0;e<p.length;e+=1)p[e].c();o=B(),w&&w.c(),s=B(),a=O("div"),Ee(l.$$.fragment),c=B(),Ee(d.$$.fragment),U(n,"class",S(e[6])+" svelte-1phofh5"),U(n,"name","_id"),U(n,"type","hidden"),n.value=r=e[1]._id||"",U(t,"class","fTask svelte-1phofh5"),U(t,"id",e[6]),U(a,"class","form--buttons svelte-1phofh5")},m(r,m){R(r,t,m),N(t,n),N(t,i);for(let e=0;e<p.length;e+=1)p[e].m(t,null);N(t,o),w&&w.m(t,null),R(r,s,m),R(r,a,m),Ae(l,a,null),N(a,c),Ae(d,a,null),u=!0,h||(f=[L(t,"keydown",e[8]),L(t,"submit",F(e[10]))],h=!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=pr(e,m,n);p[n]?(p[n].p(r,i),we(p[n],1)):(p[n]=vr(r),p[n].c(),we(p[n],1),p[n].m(t,o))}for(pe(),n=m.length;n<p.length;n+=1)g(n);ge()}e[0].list?w?(w.p(e,i),1&i&&we(w,1)):(w=_r(e),w.c(),we(w,1),w.m(t,null)):w&&(pe(),ye(w,1,1,(()=>{w=null})),ge());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)we(p[e]);we(w),we(l.$$.fragment,e),we(d.$$.fragment,e),u=!0}},o(e){p=p.filter(Boolean);for(let e=0;e<p.length;e+=1)ye(p[e]);ye(w),ye(l.$$.fragment,e),ye(d.$$.fragment,e),u=!1},d(e){e&&D(t),k(p,e),w&&w.d(),e&&D(s),e&&D(a),be(l),be(d),h=!1,$(f)}}}function yr(e){let t,n;return t=new Ll({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(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function vr(e){let t,n,r=br(!0,e[20]),i=r&&yr(e);return{c(){i&&i.c(),t=P()},m(e,r){i&&i.m(e,r),R(e,t,r),n=!0},p(e,n){1&n&&(r=br(!0,e[20])),r?i?(i.p(e,n),1&n&&we(i,1)):(i=yr(e),i.c(),we(i,1),i.m(t.parentNode,t)):i&&(pe(),ye(i,1,1,(()=>{i=null})),ge())},i(e){n||(we(i),n=!0)},o(e){ye(i),n=!1},d(e){i&&i.d(e),e&&D(t)}}}function _r(e){let t,n,r=e[0].list,i=[];for(let t=0;t<r.length;t+=1)i[t]=Ir(mr(e,r,t));const o=e=>ye(i[e],1,1,(()=>{i[e]=null}));return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=P()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);R(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=mr(e,r,s);i[s]?(i[s].p(o,n),we(i[s],1)):(i[s]=Ir(o),i[s].c(),we(i[s],1),i[s].m(t.parentNode,t))}for(pe(),s=r.length;s<i.length;s+=1)o(s);ge()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)we(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)ye(i[e]);n=!1},d(e){k(i,e),e&&D(t)}}}function Ir(e){let t,n,r,i;return t=new e[4]({props:{text:e[17].designation}}),r=new Lr({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(){Ee(t.$$.fragment),n=B(),Ee(r.$$.fragment)},m(e,o){Ae(t,e,o),R(e,n,o),Ae(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||(we(t.$$.fragment,e),we(r.$$.fragment,e),i=!0)},o(e){ye(t.$$.fragment,e),ye(r.$$.fragment,e),i=!1},d(e){be(t,e),e&&D(n),be(r,e)}}}function Cr(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function $r(e){let t;return{c(){t=M("Speichern")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Er(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Ar(e){let t,n,r,i={ctx:e,current:null,token:null,hasCatch:!1,pending:Er,then:wr,catch:gr,value:16,blocks:[,,,]};return ve(e[7](),i),{c(){t=B(),n=O("section"),i.block.c(),fr.title="Vorgaben",U(n,"class","sTask svelte-1phofh5")},m(e,o){R(e,t,o),R(e,n,o),i.block.m(n,i.anchor=null),i.mount=()=>n,i.anchor=null,r=!0},p(t,[n]){_e(i,e=t,n)},i(e){r||(we(i.block),r=!0)},o(e){for(let e=0;e<3;e+=1){ye(i.blocks[e])}r=!1},d(e){e&&D(t),e&&D(n),i.block.d(),i.token=null,i=null}}}const br=(e,{type:t="",properties:n={}})=>!e||"list"!==t&&("time"===n.format&&(t="time"),!["date","datetime","time"].includes(t)&&(!n.readonly&&!n.hidden));function Sr(e,r,o){let l,d,u;b(e,a,(e=>o(11,d=e))),b(e,i,(e=>o(12,u=e)));const{Divider:h,Button:f,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 ur(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&&o(0,g=e.schema),"record"in e&&o(1,w=e.record)},e.$$.update=()=>{4&e.$$.dirty&&o(3,l=v)},[g,w,v,l,h,f,y,async()=>{const e=await t.getEvent(g.id);if(e.trigger?.startOn&&!e.trigger?.startOn?.some((e=>"Manual"===e.type))&&o(2,v=!0),d.role?.length&&g.authorization?.length){const e=g.authorization.some((e=>u?.find((t=>t===e.role&&"edit"===e.activity))));o(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),s.success("Die Vorgaben wurden gespeichert.",2e3),_()}]}const{document:Tr}=Ie;function Nr(e,t,n){const r=e.slice();return r[28]=t[n],r}function Rr(e){let t,n;return t=new Ll({props:{classId:e[2],item:e[28],listName:e[1].name,eventId:e[3],record:e[0],disabled:e[4],required:e[5],currency:e[8]}}),t.$on("notify",e[14]),t.$on("defPrep",e[16]),t.$on("task",e[21]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};4&n[0]&&(r.classId=e[2]),2&n[0]&&(r.item=e[28]),2&n[0]&&(r.listName=e[1].name),8&n[0]&&(r.eventId=e[3]),1&n[0]&&(r.record=e[0]),16&n[0]&&(r.disabled=e[4]),32&n[0]&&(r.required=e[5]),256&n[0]&&(r.currency=e[8]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Dr(e){let t,n,r=br(e[7],e[28]),i=r&&Rr(e);return{c(){i&&i.c(),t=P()},m(e,r){i&&i.m(e,r),R(e,t,r),n=!0},p(e,n){130&n[0]&&(r=br(e[7],e[28])),r?i?(i.p(e,n),130&n[0]&&we(i,1)):(i=Rr(e),i.c(),we(i,1),i.m(t.parentNode,t)):i&&(pe(),ye(i,1,1,(()=>{i=null})),ge())},i(e){n||(we(i),n=!0)},o(e){ye(i),n=!1},d(e){i&&i.d(e),e&&D(t)}}}function kr(e){let t,n,r,i=e[1].item,o=[];for(let t=0;t<i.length;t+=1)o[t]=Dr(Nr(e,i,t));const s=e=>ye(o[e],1,1,(()=>{o[e]=null}));return{c(){t=O("div");for(let e=0;e<o.length;e+=1)o[e].c();U(t,"id",n=`accordion-content-${e[2]}-${e[1].name}`)},m(e,n){R(e,t,n);for(let e=0;e<o.length;e+=1)o[e].m(t,null);r=!0},p(e,a){if(82367&a[0]){let n;for(i=e[1].item,n=0;n<i.length;n+=1){const r=Nr(e,i,n);o[n]?(o[n].p(r,a),we(o[n],1)):(o[n]=Dr(r),o[n].c(),we(o[n],1),o[n].m(t,null))}for(pe(),n=i.length;n<o.length;n+=1)s(n);ge()}(!r||6&a[0]&&n!==(n=`accordion-content-${e[2]}-${e[1].name}`))&&U(t,"id",n)},i(e){if(!r){for(let e=0;e<i.length;e+=1)we(o[e]);r=!0}},o(e){o=o.filter(Boolean);for(let e=0;e<o.length;e+=1)ye(o[e]);r=!1},d(e){e&&D(t),k(o,e)}}}function Or(e){let t,n,r=e[13](e[9])+"";return{c(){t=O("span"),n=M(r)},m(e,r){R(e,t,r),N(t,n)},p(e,t){512&t[0]&&r!==(r=e[13](e[9])+"")&&H(n,r)},d(e){e&&D(t)}}}function xr(e){let t,n,r;return n=new e[10]({props:{$$slots:{default:[Or]},$$scope:{ctx:e}}}),n.$on("click",(function(){E(e[15](e[27]))&&e[15](e[27]).apply(this,arguments)})),{c(){t=O("div"),Ee(n.$$.fragment),U(t,"class","accordion svelte-148ktt9"),U(t,"slot","handle")},m(e,i){R(e,t,i),Ae(n,t,null),r=!0},p(t,r){e=t;const i={};512&r[0]|1&r[1]&&(i.$$scope={dirty:r,ctx:e}),n.$set(i)},i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function Mr(e){let t,n;return t=new e[12]({props:{open:e[6],$$slots:{handle:[xr,({toggle:e})=>({27:e}),({toggle:e})=>[e?134217728:0]],default:[kr,({toggle:e})=>({27:e}),({toggle:e})=>[e?134217728:0]]},$$scope:{ctx:e}}}),t.$on("panel-open",e[17]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};64&n[0]&&(r.open=e[6]),134218687&n[0]|1&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Br(e){let t,n,r;return n=new e[11]({props:{$$slots:{default:[Mr]},$$scope:{ctx:e}}}),{c(){t=O("div"),Ee(n.$$.fragment),U(t,"class","formList")},m(e,i){R(e,t,i),Ae(n,t,null),r=!0},p(e,t){const r={};1023&t[0]|1&t[1]&&(r.$$scope={dirty:t,ctx:e}),n.$set(r)},i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function Pr(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:h}=n,{disabled:f}=n,{required:w}=n,{open:y=!1}=n,{template:v={}}=n,{isTemplate:_=!1}=n,{currency:I}=n,{update:C=!1}=n,$=new Map;const E={};let A=d[a.name]||{};d[a.name]=A;const b=e=>E[e]?.split(" • ").filter((e=>!!e)).slice(0,2).join(" · "),S=e=>{if(!e)return;const{style:t,scrollHeight:n}=e;n&&(t.height=`${n}px`)};return e.$$set=e=>{"list"in e&&r(1,a=e.list),"schema"in e&&r(18,l=e.schema),"record"in e&&r(0,d=e.record),"classId"in e&&r(2,u=e.classId),"eventId"in e&&r(3,h=e.eventId),"disabled"in e&&r(4,f=e.disabled),"required"in e&&r(5,w=e.required),"open"in e&&r(6,y=e.open),"template"in e&&r(19,v=e.template),"isTemplate"in e&&r(7,_=e.isTemplate),"currency"in e&&r(8,I=e.currency),"update"in e&&r(20,C=e.update)},e.$$.update=()=>{1048579&e.$$.dirty[0]&&C&&d&&r(9,A=d[a.name]||{})},[d,a,u,h,f,w,y,_,I,A,i,o,s,e=>l.filter((t=>void 0!==e[t.name]&&"textarea"!==t.properties?.format&&"html"!==t.properties?.format)).map((t=>"object"===t.type?b(t.name):"boolean"===t.type?g(e[t.name]):"date"===t.type?m(e[t.name]):"datetime"===t.type?p(e[t.name]):e[t.name])).filter((e=>!!e)).join(" • ")||"+",({detail:e})=>{const[t,n]=e.itemName.split(".");if(!n)return;e.desc&&(E[n]=e.desc);const i=d[t];r(0,d[t]={...i,[n]:e.value},d),r(9,A=d[t])},e=>t=>{(()=>{const e=v[a.name]||{};for(const t in e)v[a.name][t]&&!d[a.name][t]&&r(0,d[a.name][t]=v[a.name][t],d)})(),e(t);const n=`#accordion-content-${u}-${a.name} > div.form-field:last-child`,i=document.querySelector(n);se().then((()=>{const e=`#accordion-content-${u}-${a.name} textarea`;Array.from(document.querySelectorAll(e)).forEach(S)})).then((()=>i.scrollIntoView({behavior:"smooth",block:"end"})))},async({detail:{className:e,itemName:n,value:r}})=>{if($.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&&$.set(e,o[0])},()=>{setTimeout((()=>{Array.from($).forEach((([e,t])=>{d[a.name][e]||r(0,d[a.name][e]=t._id,d)}))}),500)},l,v,C,function(t){Q(e,t)}]}class Lr extends Te{constructor(e){var t;super(),Tr.getElementById("svelte-148ktt9-style")||((t=O("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}}",N(Tr.head,t)),Se(this,e,Pr,Br,A,{list:1,schema:18,record:0,classId:2,eventId:3,disabled:4,required:5,open:6,template:19,isTemplate:7,currency:8,update:20},[-1,-1])}}const{document:Fr}=Ie;function Vr(e){e[0]=e[23].list,e[22]=e[23].items}function Ur(e,t,n){const r=e.slice();return r[24]=t[n],r}function Hr(e,t,n){const r=e.slice();return r[27]=t[n],r}function Wr(e,t,n){const r=e.slice();return r[27]=t[n],r}function zr(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function qr(e){let t,n,r,i,o,s,a,l,c,d,u,h,f,m,p,g,w,y;function v(t){e[19](t)}Vr(e),n=new e[7]({props:{outline:!0,$$slots:{default:[jr]},$$scope:{ctx:e}}}),n.$on("click",e[18]);let _={id:e[8]};void 0!==e[1]&&(_.value=e[1]),s=new e[6]({props:_}),ee.push((()=>$e(s,"value",v))),s.$on("input",e[12]),d=new tt({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]=Gr(Wr(e,r,t));return{c(){t=O("thead"),n=O("tr");for(let e=0;e<i.length;e+=1)i[e].c();U(n,"class","svelte-14hcfjl"),U(t,"class","svelte-14hcfjl")},m(e,r){R(e,t,r),N(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=Wr(e,r,o);i[o]?i[o].p(s,t):(i[o]=Gr(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&&D(t),k(i,e)}}}(e),C=e[0]?.length&&function(e){let t,n=e[0],r=[];for(let t=0;t<n.length;t+=1)r[t]=Zr(Ur(e,n,t));return{c(){for(let e=0;e<r.length;e+=1)r[e].c();t=P()},m(e,n){for(let t=0;t<r.length;t+=1)r[t].m(e,n);R(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=Ur(e,n,o);r[o]?r[o].p(s,i):(r[o]=Zr(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){k(r,e),e&&D(t)}}}(e);return{c(){t=O("div"),Ee(n.$$.fragment),r=B(),i=O("div"),o=M("Suchen: "),Ee(s.$$.fragment),l=B(),c=O("span"),Ee(d.$$.fragment),u=B(),h=O("div"),f=O("table"),I&&I.c(),m=B(),p=O("tbody"),C&&C.c(),U(t,"class","form--buttons svelte-14hcfjl"),U(c,"class","feather pointer svelte-14hcfjl"),z(i,"margin-bottom","1em"),z(i,"position","relative"),U(f,"striped",""),U(f,"class","svelte-14hcfjl"),U(h,"class","eList svelte-14hcfjl")},m(a,v){R(a,t,v),Ae(n,t,null),R(a,r,v),R(a,i,v),N(i,o),Ae(s,i,null),N(i,l),N(i,c),Ae(d,c,null),R(a,u,v),R(a,h,v),N(h,f),I&&I.m(f,null),N(f,m),N(f,p),C&&C.m(p,null),g=!0,w||(y=L(c,"click",e[14]),w=!0)},p(e,t){Vr(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],le((()=>a=!1))),s.$set(i),e[22]?.length&&I.p(e,t),e[0]?.length&&C.p(e,t)},i(e){g||(we(n.$$.fragment,e),we(s.$$.fragment,e),we(d.$$.fragment,e),g=!0)},o(e){ye(n.$$.fragment,e),ye(s.$$.fragment,e),ye(d.$$.fragment,e),g=!1},d(e){e&&D(t),be(n),e&&D(r),e&&D(i),be(s),be(d),e&&D(u),e&&D(h),I&&I.d(),C&&C.d(),w=!1,y()}}}function jr(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Gr(e){let t,n,r=e[27]?.designation+"";return{c(){t=O("th"),n=M(r),U(t,"class","svelte-14hcfjl")},m(e,r){R(e,t,r),N(t,n)},p:_,d(e){e&&D(t)}}}function Xr(e){let t,n,r=e[22],i=[];for(let t=0;t<r.length;t+=1)i[t]=Yr(Hr(e,r,t));return{c(){t=O("tr");for(let e=0;e<i.length;e+=1)i[e].c();n=B(),U(t,"class","pointer svelte-14hcfjl")},m(e,r){R(e,t,r);for(let e=0;e<i.length;e+=1)i[e].m(t,null);N(t,n)},p(e,o){if(3584&o[0]){let s;for(r=e[22],s=0;s<r.length;s+=1){const a=Hr(e,r,s);i[s]?i[s].p(a,o):(i[s]=Yr(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&&D(t),k(i,e)}}}function Yr(e){let t,n,r,i,o=e[9](e[24],e[27])+"";return{c(){t=O("td"),n=M(o),U(t,"class","svelte-14hcfjl")},m(o,s){R(o,t,s),N(t,n),r||(i=L(t,"click",V(e[10](e[24]))),r=!0)},p(t,n){e=t},d(e){e&&D(t),r=!1,i()}}}function Zr(e){let t,n=e[13](e[24],e[22],e[1]),r=n&&Xr(e);return{c(){r&&r.c(),t=P()},m(e,n){r&&r.m(e,n),R(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=Xr(e),r.c(),r.m(t.parentNode,t)):r&&(r.d(1),r=null)},d(e){r&&r.d(e),e&&D(t)}}}function Kr(e){let t,n;return t=new e[5]({}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p:_,i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Qr(e){let t,n,r,i;t=new e[4]({});let o={ctx:e,current:null,token:null,hasCatch:!1,pending:Kr,then:qr,catch:zr,value:23,blocks:[,,,]};return ve(e[11](),o),{c(){Ee(t.$$.fragment),n=B(),r=P(),o.block.c()},m(e,s){Ae(t,e,s),R(e,n,s),R(e,r,s),o.block.m(e,o.anchor=s),o.mount=()=>r.parentNode,o.anchor=r,i=!0},p(t,n){_e(o,e=t,n)},i(e){i||(we(t.$$.fragment,e),we(o.block),i=!0)},o(e){ye(t.$$.fragment,e);for(let e=0;e<3;e+=1){ye(o.blocks[e])}i=!1},d(e){be(t,e),e&&D(n),e&&D(r),o.block.d(e),o.token=null,o=null}}}function Jr(e){let t,n;return t=new e[3]({props:{title:"Auswahl",class:"eList",$$slots:{default:[Qr]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ei(e,n,r){const i=K(),{Dialog:o,Divider:s,Loading:a,TextField:l,Button:d}=c;let{item:u}=n,{className:h}=n,{classId:f}=n,{list:p}=n,w="",y=f+Math.floor(9e3*Math.random()+1e3).toString()+"search";const v=(e,t)=>{if(!t)return;const n=e[t.name];return"boolean"==typeof n?g(n):m(e[`_${t.name}`]||e[t.name]||"")},_=t.getSchemaByClass(h);Y((()=>{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,h=e.className),"classId"in e&&r(17,f=e.classId),"list"in e&&r(0,p=e.list)},[p,w,i,o,s,a,l,d,y,v,e=>()=>i("choose",{row:e}),async()=>{const e=await _,t=e.display;let n=await Xt(t,e,p);return{list:p,items:n}},({detail:{value:e}})=>{r(1,w=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,w="")},u,h,f,()=>i("back"),function(e){w=e,r(1,w)}]}class ti extends Te{constructor(e){var t;super(),Fr.getElementById("svelte-14hcfjl-style")||((t=O("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}",N(Fr.head,t)),Se(this,e,ei,Jr,A,{item:15,className:16,classId:17,list:0},[-1,-1])}}const{document:ni}=Ie;function ri(e,t,n){const r=e.slice();return r[11]=t[n],r}function ii(e,t,n){const r=e.slice();return r[3]=t[n],r}function oi(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function si(e){let t,n,r,i=e[7].items,o=[];for(let t=0;t<i.length;t+=1)o[t]=ui(ii(e,i,t));const s=e=>ye(o[e],1,1,(()=>{o[e]=null}));let a=e[7].list&&hi(e);return{c(){for(let e=0;e<o.length;e+=1)o[e].c();t=B(),a&&a.c(),n=P()},m(e,i){for(let t=0;t<o.length;t+=1)o[t].m(e,i);R(e,t,i),a&&a.m(e,i),R(e,n,i),r=!0},p(e,r){if(30327783&r[0]){let n;for(i=e[7].items,n=0;n<i.length;n+=1){const s=ii(e,i,n);o[n]?(o[n].p(s,r),we(o[n],1)):(o[n]=ui(s),o[n].c(),we(o[n],1),o[n].m(t.parentNode,t))}for(pe(),n=i.length;n<o.length;n+=1)s(n);ge()}e[7].list?a?(a.p(e,r),128&r[0]&&we(a,1)):(a=hi(e),a.c(),we(a,1),a.m(n.parentNode,n)):a&&(pe(),ye(a,1,1,(()=>{a=null})),ge())},i(e){if(!r){for(let e=0;e<i.length;e+=1)we(o[e]);we(a),r=!0}},o(e){o=o.filter(Boolean);for(let e=0;e<o.length;e+=1)ye(o[e]);ye(a),r=!1},d(e){k(o,e),e&&D(t),a&&a.d(e),e&&D(n)}}}function ai(e){let t,n,r,i;const o=[ci,li],s=[];function a(e,t){return e[3].name!==e[14]||e[15]?"lookup"!==e[3].properties?.format?1:-1:0}return~(t=a(e))&&(n=s[t]=o[t](e)),{c(){n&&n.c(),r=P()},m(e,n){~t&&s[t].m(e,n),R(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?~t&&s[t].p(e,i):(n&&(pe(),ye(s[l],1,1,(()=>{s[l]=null})),ge()),~t?(n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),we(n,1),n.m(r.parentNode,r)):n=null)},i(e){i||(we(n),i=!0)},o(e){ye(n),i=!1},d(e){~t&&s[t].d(e),e&&D(r)}}}function li(e){let t,n;return t=new Ll({props:{classId:e[8],item:e[3],record:e[6],disabled:e[3].name===e[14]&&e[15]||e[0],eventId:e[5],currency:e[2],changeValue:e[9]}}),t.$on("notify",e[17]),t.$on("multi",e[18]),t.$on("defPrep",e[19]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};256&n[0]&&(r.classId=e[8]),128&n[0]&&(r.item=e[3]),64&n[0]&&(r.record=e[6]),129&n[0]&&(r.disabled=e[3].name===e[14]&&e[15]||e[0]),32&n[0]&&(r.eventId=e[5]),4&n[0]&&(r.currency=e[2]),512&n[0]&&(r.changeValue=e[9]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ci(e){let t,n,r,i;n=new Ll({props:{classId:e[8],item:e[3],record:e[6],disabled:e[0]||!!e[1],required:!0,eventId:e[5],currency:e[2],changeValue:e[9]}}),n.$on("notify",e[17]),n.$on("multi",e[18]),n.$on("defPrep",e[19]),n.$on("record",e[23]),n.$on("objRecord",e[24]);let o=e[1]&&di(e);return{c(){t=O("div"),Ee(n.$$.fragment),r=B(),o&&o.c(),z(t,"padding-top",".25em"),z(t,"background-color","lightyellow"),z(t,"position","relative")},m(e,s){R(e,t,s),Ae(n,t,null),N(t,r),o&&o.m(t,null),i=!0},p(e,r){const i={};256&r[0]&&(i.classId=e[8]),128&r[0]&&(i.item=e[3]),64&r[0]&&(i.record=e[6]),3&r[0]&&(i.disabled=e[0]||!!e[1]),32&r[0]&&(i.eventId=e[5]),4&r[0]&&(i.currency=e[2]),512&r[0]&&(i.changeValue=e[9]),n.$set(i),e[1]?o?(o.p(e,r),2&r[0]&&we(o,1)):(o=di(e),o.c(),we(o,1),o.m(t,null)):o&&(pe(),ye(o,1,1,(()=>{o=null})),ge())},i(e){i||(we(n.$$.fragment,e),we(o),i=!0)},o(e){ye(n.$$.fragment,e),ye(o),i=!1},d(e){e&&D(t),be(n),o&&o.d()}}}function di(e){let t,n,r,i,o;return n=new tt({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather2 pointer svelte-16mo2c")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[22]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function ui(e){let t,n,r="list"!==e[3].type&&ai(e);return{c(){r&&r.c(),t=P()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,n){"list"!==e[3].type?r?(r.p(e,n),128&n[0]&&we(r,1)):(r=ai(e),r.c(),we(r,1),r.m(t.parentNode,t)):r&&(pe(),ye(r,1,1,(()=>{r=null})),ge())},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function hi(e){let t,n,r=e[7].list,i=[];for(let t=0;t<r.length;t+=1)i[t]=mi(ri(e,r,t));const o=e=>ye(i[e],1,1,(()=>{i[e]=null}));return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=P()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);R(e,t,r),n=!0},p(e,n){if(485&n[0]){let s;for(r=e[7].list,s=0;s<r.length;s+=1){const o=ri(e,r,s);i[s]?(i[s].p(o,n),we(i[s],1)):(i[s]=mi(o),i[s].c(),we(i[s],1),i[s].m(t.parentNode,t))}for(pe(),s=r.length;s<i.length;s+=1)o(s);ge()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)we(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)ye(i[e]);n=!1},d(e){k(i,e),e&&D(t)}}}function fi(e){let t,n,r,i;return t=new e[12]({props:{text:e[11].designation}}),r=new Lr({props:{classId:e[8],list:e[11],eventId:e[5],schema:e[11].item,record:e[6],disabled:e[0],currency:e[2],update:!0}}),{c(){Ee(t.$$.fragment),n=B(),Ee(r.$$.fragment)},m(e,o){Ae(t,e,o),R(e,n,o),Ae(r,e,o),i=!0},p(e,n){const i={};128&n[0]&&(i.text=e[11].designation),t.$set(i);const o={};256&n[0]&&(o.classId=e[8]),128&n[0]&&(o.list=e[11]),32&n[0]&&(o.eventId=e[5]),128&n[0]&&(o.schema=e[11].item),64&n[0]&&(o.record=e[6]),1&n[0]&&(o.disabled=e[0]),4&n[0]&&(o.currency=e[2]),r.$set(o)},i(e){i||(we(t.$$.fragment,e),we(r.$$.fragment,e),i=!0)},o(e){ye(t.$$.fragment,e),ye(r.$$.fragment,e),i=!1},d(e){be(t,e),e&&D(n),be(r,e)}}}function mi(e){let t,n,r="array"!==e[11].type&&fi(e);return{c(){r&&r.c(),t=P()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,n){"array"!==e[11].type?r?(r.p(e,n),128&n[0]&&we(r,1)):(r=fi(e),r.c(),we(r,1),r.m(t.parentNode,t)):r&&(pe(),ye(r,1,1,(()=>{r=null})),ge())},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function pi(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function gi(e){let t,n;return t=new ti({props:{item:e[3],className:e[4],classId:e[8],list:e[11]}}),t.$on("choose",e[20]),t.$on("back",e[21]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};8&n[0]&&(r.item=e[3]),16&n[0]&&(r.className=e[4]),256&n[0]&&(r.classId=e[8]),2048&n[0]&&(r.list=e[11]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function wi(e){let t,n,r=e[10]&&gi(e);return{c(){r&&r.c(),t=P()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,n){e[10]?r?(r.p(e,n),1024&n[0]&&we(r,1)):(r=gi(e),r.c(),we(r,1),r.m(t.parentNode,t)):r&&(pe(),ye(r,1,1,(()=>{r=null})),ge())},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function yi(e){let t,n,r,i,o,s,a={ctx:e,current:null,token:null,hasCatch:!1,pending:pi,then:si,catch:oi,value:54,blocks:[,,,]};function l(t){e[30](t)}ve(e[16](),a),n=new e[12]({});let c={class:"tModal",noClickaway:!0,$$slots:{default:[wi]},$$scope:{ctx:e}};return void 0!==e[10]&&(c.open=e[10]),i=new e[13]({props:c}),ee.push((()=>$e(i,"open",l))),{c(){a.block.c(),t=B(),Ee(n.$$.fragment),r=B(),Ee(i.$$.fragment)},m(e,o){a.block.m(e,a.anchor=o),a.mount=()=>t.parentNode,a.anchor=t,R(e,t,o),Ae(n,e,o),R(e,r,o),Ae(i,e,o),s=!0},p(t,n){_e(a,e=t,n);const r={};3352&n[0]|268435456&n[1]&&(r.$$scope={dirty:n,ctx:e}),!o&&1024&n[0]&&(o=!0,r.open=e[10],le((()=>o=!1))),i.$set(r)},i(e){s||(we(a.block),we(n.$$.fragment,e),we(i.$$.fragment,e),s=!0)},o(e){for(let e=0;e<3;e+=1){ye(a.blocks[e])}ye(n.$$.fragment,e),ye(i.$$.fragment,e),s=!1},d(e){a.block.d(e),a.token=null,a=null,e&&D(t),be(n,e),e&&D(r),be(i,e)}}}function vi(e,n,r){const{Divider:i,FormField:o,Modal:s}=c,a=K();let l,d,u,h,f,{required:m}=n,{disabled:p}=n,{readonly:g}=n,{id:w}=n,{item:y}=n,{value:v}=n,{refValue:_}=n,{currency:I}=n,C={},$=[],E=[],A={},b=new Map,S=!1,T="";const N=y.checkOn,R=v,D=e=>{l.items.filter((t=>"object"==typeof(t.properties&&t.properties[e]))).map((t=>{const n=t.properties[e].refItem||"",[r,i]=n.split(".");$.push({action:e,itemName:t.name,refObj:r,refName:i,op:t.properties[e].invert?"!":""})}))},k=()=>{l.items.filter((e=>e.lookup)).forEach((e=>{E.push({name:e.name,lookup:e.lookup})})),l.items.filter((e=>e.properties?.lookup)).forEach((e=>{E.push({name:e.name,lookup:e.properties.lookup.split(":").at(-1)})}))},O=async e=>{const t=$.filter((t=>t.refObj===e));if(t?.length){r(9,A={});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 ph(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(9,A[t]="",A))}}};Y((()=>{x()}));const x=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.add(t.refObj||u);Array.from(e).forEach((e=>O(e)))})(),M())},M=()=>{setTimeout((()=>{Array.from(b).forEach((([e,t])=>{C[e]||r(6,C[e]=t._id,C)}))}),250)},B=async e=>{if(!e.value)return void L();const n={[e.itemName]:{$regex:`(?i)${e.value}`}},i=await t.getSectionView(u,n);i?.length?(r(11,T=i),r(10,S=!0)):(r(1,v=""),r(25,_=""),a("setRefValue",_))},P=()=>{r(10,S=!1)},L=()=>{r(1,v=""),r(25,_=v),r(6,C={}),a("setRefValue",_)};return e.$$set=e=>{"required"in e&&r(26,m=e.required),"disabled"in e&&r(0,p=e.disabled),"readonly"in e&&r(27,g=e.readonly),"id"in e&&r(28,w=e.id),"item"in e&&r(3,y=e.item),"value"in e&&r(1,v=e.value),"refValue"in e&&r(25,_=e.refValue),"currency"in e&&r(2,I=e.currency)},e.$$.update=()=>{134217729&e.$$.dirty[0]&&r(0,p=p||g),536871024&e.$$.dirty[0]&&C&&a("safeReference",{record:C,class:u,event:h,taskId:f})},[p,v,I,y,u,h,C,l,d,A,S,T,i,s,N,R,async()=>{try{if(v){const e=await t.getTask(y.refClass,v);delete e._task,r(6,C=e),r(29,f=(await t.getTaskByDocId(e._id,!0))._id)}else r(6,C={})}catch{}return r(7,l=await t.getSchemaByClass(y.refClass)),r(8,d="form-"+l.class+Math.floor(9e3*Math.random()+1e3).toString()),r(4,u=l.class),l.identity.designation,r(5,h=l.id),["readonly","hidden","required"].map(D),k(),!0},async({detail:e})=>{const{itemName:t,value:n}=e;if(r(6,C[t]=n,C),t===N)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(6,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(6,C[e]=o,C)}}},async({detail:{className:e,itemName:n,value:r}})=>{if(b.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&&b.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(25,_=v),a("setRefValue",_),r(6,C=n[0])),P()},P,L,({detail:e})=>{r(6,C[e.itemName]=e.value,C)},({detail:e})=>{for(const t of e.items)r(6,C[e.listName][t.name]=t.value,C)},_,m,g,w,f,function(e){S=e,r(10,S)}]}class _i extends Te{constructor(e){var t;super(),ni.getElementById("svelte-16mo2c-style")||((t=O("style")).id="svelte-16mo2c-style",t.textContent=".feather2.svelte-16mo2c{position:absolute;top:1em;right:0.5em;color:#4300b0}",N(ni.head,t)),Se(this,e,vi,yi,A,{required:26,disabled:0,readonly:27,id:28,item:3,value:1,refValue:25,currency:2},[-1,-1])}}function Ii(e){let t,n;return{c(){t=O("span"),n=M(e[4]),U(t,"class","item")},m(e,r){R(e,t,r),N(t,n)},p(e,t){16&t[0]&&H(n,e[4])},d(e){e&&D(t)}}}function Ci(e){let t,n,r,i=e[6]&&Ii(e),o=e[14]&&function(e){let t,n,r,i,o;return n=new Pe({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"title","Übernehmen"),U(t,"class","pointer feather svelte-1fuww0c")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[17]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}(e);return{c(){i&&i.c(),t=B(),o&&o.c(),n=P()},m(e,s){i&&i.m(e,s),R(e,t,s),o&&o.m(e,s),R(e,n,s),r=!0},p(e,n){e[6]?i?i.p(e,n):(i=Ii(e),i.c(),i.m(t.parentNode,t)):i&&(i.d(1),i=null),e[14]&&o.p(e,n)},i(e){r||(we(o),r=!0)},o(e){ye(o),r=!1},d(e){i&&i.d(e),e&&D(t),o&&o.d(e),e&&D(n)}}}function $i(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[5],$$slots:{default:[Ci]},$$scope:{ctx:e}}}),n.$on("change",e[15]),n.$on("focus",e[16]),{c(){t=O("div"),Ee(n.$$.fragment),z(t,"position","relative"),z(t,"max-width","10em")},m(e,i){R(e,t,i),Ae(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]),32&t[0]&&(r.required=e[5]),80&t[0]|32&t[1]&&(r.$$scope={dirty:t,ctx:e}),n.$set(r)},i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function Ei(e,t,r){const i=K(),{TextField:o}=c;let{id:s}=t,{item:a}=t,{value:l}=t,{noForm:d=!1}=t,{classId:u}=t,{disabled:h}=t,{formnovalidate:f}=t,{currency:m}=t,{praefix:p}=t,{notifyList:g}=t;const w=JSON.parse(n.getItem("Locale"));let y=["price","amount","amountValue","taxValue","total","__total"].find((e=>e===a.name?.split("-")[0]))||a.properties?.currency;!1===a.properties?.currency&&(y=!1);const v=Number("1.1").toLocaleString(w.id).substring(1,2),{properties:_={}}=a;let{min:I,max:C,step:$,pattern:E,decimals:A=0,unit:b="",placeholder:S,hint:T,readonly:N,negative:R,required:D=!1,transfer:k}=_,O="";l=l?Number(l.toString().replace(",",".")):0,N=!0===N||void 0;const x=e=>Number(e.toString()).toFixed(A).toString().replace(".",v);E||(E=A?`[0-9]+([${v}][0-9]{1,${A}})?`:"[0-9]*"),R&&(E="-?"+E);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,h=e.disabled),"formnovalidate"in e&&r(20,f=e.formnovalidate),"currency"in e&&r(4,m=e.currency),"praefix"in e&&r(21,p=e.praefix),"notifyList"in e&&r(22,g=e.notifyList)},e.$$.update=()=>{1048608&e.$$.dirty[0]&&r(5,D=D&&!f),262144&e.$$.dirty[0]&&(e=>{r(9,O=x(e.toString().replace(",",".")))})(l),4194304&e.$$.dirty[0]&&(async()=>{const e=a.properties?.value?.formula;if(e)void 0!==p&&""!==p?e?.operator?.multiply&&i("formula",{item:a}):e?.operator&&i("formula",{item:a})})()},[s,d,u,h,m,D,y,E,N,O,o,w,$,S,k,({detail:e})=>i("blur",{value:x(e.value)}),({detail:e})=>{N||+l||r(9,O="")},({detail:e})=>{const t=[].concat(k.target);for(const e of t)i("record",{itemName:e,value:l}),i("listRecord",{itemName:e,decimals:a.properties?.decimals,value:l})},l,a,f,p,g]}class Ai extends Te{constructor(e){var t;super(),document.getElementById("svelte-1fuww0c-style")||((t=O("style")).id="svelte-1fuww0c-style",t.textContent=".feather.svelte-1fuww0c{position:absolute;top:0.75em;right:-1em;color:#4300b0}",N(document.head,t)),Se(this,e,Ei,$i,A,{id:0,item:19,value:18,noForm:1,classId:2,disabled:3,formnovalidate:20,currency:4,praefix:21,notifyList:22},[-1,-1])}}const{document:bi}=Ie;function Si(e){e[34]=e[36].list,e[35]=e[36].items}function Ti(e,t,n){const r=e.slice();return r[37]=t[n],r[39]=n,r}function Ni(e,t,n){const r=e.slice();return r[40]=t[n],r[42]=n,r}function Ri(e,t,n){const r=e.slice();return r[40]=t[n],r}function Di(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function ki(e){let t,n,r,i,o,s,a,l,c,d,u,h,f,m,p,g,w,y,v;Si(e),n=new e[9]({props:{outline:!0,$$slots:{default:[Oi]},$$scope:{ctx:e}}}),n.$on("click",e[31]);let _=!e[2]&&xi(e);function I(t){e[32](t)}let C={id:e[12]};void 0!==e[3]&&(C.value=e[3]),a=new e[7]({props:C}),ee.push((()=>$e(a,"value",I))),a.$on("input",e[15]),u=new tt({props:{size:"18"}});let $=e[35]?.length&&function(e){let t,n,r,i,o=!e[2]&&Bi(e),s=e[35],a=[];for(let t=0;t<s.length;t+=1)a[t]=Pi(Ri(e,s,t));return{c(){t=O("thead"),n=O("tr"),o&&o.c(),r=B();for(let e=0;e<a.length;e+=1)a[e].c();U(n,"class","svelte-1m010ne"),U(t,"class","svelte-1m010ne")},m(e,s){R(e,t,s),N(t,n),o&&o.m(n,null),N(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&&(pe(),ye(o,1,1,(()=>{o=null})),ge()):o?(o.p(e,t),4&t[0]&&we(o,1)):(o=Bi(e),o.c(),we(o,1),o.m(n,r)),16384&t[0]){let r;for(s=e[35],r=0;r<s.length;r+=1){const i=Ri(e,s,r);a[r]?a[r].p(i,t):(a[r]=Pi(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||(we(o),i=!0)},o(e){ye(o),i=!1},d(e){e&&D(t),o&&o.d(),k(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]=Hi(Ti(e,r,t));const o=e=>ye(i[e],1,1,(()=>{i[e]=null}));return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=P()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);R(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=Ti(e,r,s);i[s]?(i[s].p(o,n),we(i[s],1)):(i[s]=Hi(o),i[s].c(),we(i[s],1),i[s].m(t.parentNode,t))}for(pe(),s=r.length;s<i.length;s+=1)o(s);ge()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)we(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)ye(i[e]);n=!1},d(e){k(i,e),e&&D(t)}}}(e);return{c(){t=O("div"),Ee(n.$$.fragment),r=B(),_&&_.c(),i=B(),o=O("div"),s=M("Suchen: "),Ee(a.$$.fragment),c=B(),d=O("span"),Ee(u.$$.fragment),h=B(),f=O("div"),m=O("table"),$&&$.c(),p=B(),g=O("tbody"),E&&E.c(),U(t,"class","form--buttons svelte-1m010ne"),U(d,"class","feather pointer svelte-1m010ne"),z(o,"margin-bottom","1em"),z(o,"position","relative"),U(m,"striped",""),U(m,"class","svelte-1m010ne"),U(f,"class","eList svelte-1m010ne")},m(l,I){R(l,t,I),Ae(n,t,null),N(t,r),_&&_.m(t,null),R(l,i,I),R(l,o,I),N(o,s),Ae(a,o,null),N(o,c),N(o,d),Ae(u,d,null),R(l,h,I),R(l,f,I),N(f,m),$&&$.m(m,null),N(m,p),N(m,g),E&&E.m(g,null),w=!0,y||(v=L(d,"click",e[17]),y=!0)},p(e,r){Si(e);const i={};16384&r[1]&&(i.$$scope={dirty:r,ctx:e}),n.$set(i),e[2]?_&&(pe(),ye(_,1,1,(()=>{_=null})),ge()):_?(_.p(e,r),4&r[0]&&we(_,1)):(_=xi(e),_.c(),we(_,1),_.m(t,null));const o={};!l&&8&r[0]&&(l=!0,o.value=e[3],le((()=>l=!1))),a.$set(o),e[35]?.length&&$.p(e,r),e[34]?.length&&E.p(e,r)},i(e){w||(we(n.$$.fragment,e),we(_),we(a.$$.fragment,e),we(u.$$.fragment,e),we($),we(E),w=!0)},o(e){ye(n.$$.fragment,e),ye(_),ye(a.$$.fragment,e),ye(u.$$.fragment,e),ye($),ye(E),w=!1},d(e){e&&D(t),be(n),_&&_.d(),e&&D(i),e&&D(o),be(a),be(u),e&&D(h),e&&D(f),$&&$.d(),E&&E.d(),y=!1,v()}}}function Oi(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function xi(e){let t,n;return t=new e[9]({props:{disabled:!e[34].length,filled:!0,$$slots:{default:[Mi]},$$scope:{ctx:e}}}),t.$on("click",e[18](e[34])),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Mi(e){let t;return{c(){t=M("Bestätigen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Bi(e){let t,n,r,i,o;return n=new je({props:{size:"20"}}),{c(){t=O("th"),Ee(n.$$.fragment),U(t,"class","svelte-1m010ne")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[19](e[34])),i=!0)},p(t,n){e=t},i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function Pi(e){let t,n,r=e[40]+"";return{c(){t=O("th"),n=M(r),U(t,"class","svelte-1m010ne")},m(e,r){R(e,t,r),N(t,n)},p:_,d(e){e&&D(t)}}}function Li(e){let t,n,r,i,o,s,a,l=e[0],c=Vi(e),d=e[35],u=[];for(let t=0;t<d.length;t+=1)u[t]=Ui(Ni(e,d,t));return{c(){t=O("tr"),c.c(),n=B();for(let e=0;e<u.length;e+=1)u[e].c();r=B(),U(t,"style",i=e[2]?"cursor: default;":"cursor: zoom-in;"),U(t,"title","übernimmt den Wert direkt"),U(t,"class","svelte-1m010ne"),q(t,"active",e[0].includes(Array.isArray(e[37])?e[37][0]:e[37]))},m(i,l){R(i,t,l),c.m(t,null),N(t,n);for(let e=0;e<u.length;e+=1)u[e].m(t,null);N(t,r),o=!0,s||(a=L(t,"click",e[20](e[37])),s=!0)},p(s,a){if(e=s,1&a[0]&&A(l,l=e[0])?(pe(),ye(c,1,1,_),ge(),c=Vi(e),c.c(),we(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=Ni(e,d,n);u[n]?u[n].p(i,a):(u[n]=Ui(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;"))&&U(t,"style",i),16385&a[0]&&q(t,"active",e[0].includes(Array.isArray(e[37])?e[37][0]:e[37]))},i(e){o||(we(c),o=!0)},o(e){ye(c),o=!1},d(e){e&&D(t),c.d(e),k(u,e),s=!1,a()}}}function Fi(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=O("td"),Ee(n.$$.fragment),U(t,"title","Wählt den Wert aus"),U(t,"class","svelte-1m010ne")},m(e,i){R(e,t,i),Ae(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||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function Vi(e){let t,n,r=!e[2]&&Fi(e);return{c(){r&&r.c(),t=P()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,n){e[2]?r&&(pe(),ye(r,1,1,(()=>{r=null})),ge()):r?(r.p(e,n),4&n[0]&&we(r,1)):(r=Fi(e),r.c(),we(r,1),r.m(t.parentNode,t))},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function Ui(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=O("td"),n=M(r),U(t,"class","svelte-1m010ne")},m(e,r){R(e,t,r),N(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&&D(t)}}}function Hi(e){let t,n,r=e[16](e[37],e[3]),i=r&&Li(e);return{c(){i&&i.c(),t=P()},m(e,r){i&&i.m(e,r),R(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]&&we(i,1)):(i=Li(e),i.c(),we(i,1),i.m(t.parentNode,t)):i&&(pe(),ye(i,1,1,(()=>{i=null})),ge())},i(e){n||(we(i),n=!0)},o(e){ye(i),n=!1},d(e){i&&i.d(e),e&&D(t)}}}function Wi(e){let t,n;return t=new e[6]({}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p:_,i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function zi(e){let t,n,r,i;t=new e[10]({});let o={ctx:e,current:null,token:null,hasCatch:!1,pending:Wi,then:ki,catch:Di,value:36,blocks:[,,,]};return ve(e[14](),o),{c(){Ee(t.$$.fragment),n=B(),r=P(),o.block.c()},m(e,s){Ae(t,e,s),R(e,n,s),R(e,r,s),o.block.m(e,o.anchor=s),o.mount=()=>r.parentNode,o.anchor=r,i=!0},p(t,n){_e(o,e=t,n)},i(e){i||(we(t.$$.fragment,e),we(o.block),i=!0)},o(e){ye(t.$$.fragment,e);for(let e=0;e<3;e+=1){ye(o.blocks[e])}i=!1},d(e){be(t,e),e&&D(n),e&&D(r),o.block.d(e),o.token=null,o=null}}}function qi(e){let t,n;return t=new e[8]({props:{title:e[1]||"Auswahl",class:"eList",$$slots:{default:[zi]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ji(e,n,r){const i=K(),{Loading:o,TextField:s,Dialog:a,Button:l,Divider:d,Checkbox:u}=c;let{classId:h}=n,{id:f}=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:C}=n,{status:$}=n,{single:E}=n;p||=[];let A="",b=h+Math.floor(9e3*Math.random()+1e3).toString()+"search",S=[];const T=w+y+v+"checkbox",N=(e,t)=>e>t?1:t>e?-1:0;Y((()=>{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,h=e.classId),"id"in e&&r(23,f=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,C=e.uniqueView),"status"in e&&r(30,$=e.status),"single"in e&&r(2,E=e.single)},[p,m,E,A,S,i,o,s,a,l,d,u,b,T,async()=>{let e=[],n=[],i={};if(r(4,S=[]),y)if(_){if(f){const n=h.split("-")[1].slice(0,-4),r="input."+h+"[name='_id']",o=document.querySelector(r).value;i={[y]:f},$&&(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 N(r(e),r(t))}))}}else C?f&&(i={[y]:f,status:!0},Object.entries(C).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 N(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,f,I),e=e.sort(((e,t)=>N(e,t)))):(e=await t.getSection(w,y,f,!1,$),e=e.sort(((e,t)=>{const n=e=>(p.includes(e[v])?"0-":"1-")+e[v];return N(n(e),n(t))})));else i={},f&&!Array.isArray(f)&&(i._id=f),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(T),n=[];t.forEach(((t,r)=>{t.checked&&n.push(e[+t.attributes.data.value])})),i("choose",{list:n})},e=>()=>{document.getElementsByName(T).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,h,f,g,w,y,_,I,C,$,()=>i("back"),function(e){A=e,r(3,A)}]}class Gi extends Te{constructor(e){var t;super(),bi.getElementById("svelte-1m010ne-style")||((t=O("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}",N(bi.head,t)),Se(this,e,ji,qi,A,{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:Xi}=Ie;function Yi(e){let t,n,r,i,o,s=e[7].length+"";return{c(){t=O("span"),n=M("("),r=M(s),i=M(")"),U(t,"class",o=S(e[1]?"showNumber disabled":"showNumber")+" svelte-1rbaejz")},m(e,o){R(e,t,o),N(t,n),N(t,r),N(t,i)},p(e,n){128&n[0]&&s!==(s=e[7].length+"")&&H(r,s),2&n[0]&&o!==(o=S(e[1]?"showNumber disabled":"showNumber")+" svelte-1rbaejz")&&U(t,"class",o)},d(e){e&&D(t)}}}function Zi(e){let t;return{c(){t=O("div"),U(t,"class","load-more-options"),U(t,"slot","load-more-options-message")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Ki(e){let t,n,r,i;const o=[eo,Ji,Qi],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=P()},m(e,n){~t&&s[t].m(e,n),R(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?~t&&s[t].p(e,i):(n&&(pe(),ye(s[l],1,1,(()=>{s[l]=null})),ge()),~t?(n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),we(n,1),n.m(r.parentNode,r)):n=null)},i(e){i||(we(n),i=!0)},o(e){ye(n),i=!1},d(e){~t&&s[t].d(e),e&&D(r)}}}function Qi(e){let t,n,r,i,o;return n=new Pe({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"title","Übernehmen"),U(t,"class","feather pointer svelte-1rbaejz")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[26]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function Ji(e){let t,n,r,i,o;return n=new Ye({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"title",e[17].title||"Generieren"),U(t,"class","feather pointer svelte-1rbaejz")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[25]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function eo(e){let t,n,r,i,o;return n=new tt({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"title","Löschen"),U(t,"class","feather pointer svelte-1rbaejz")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[27]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function to(e){let t,n,r;function i(t){e[37](t)}let o={class:"tModal",noClickaway:!0,$$slots:{default:[no]},$$scope:{ctx:e}};return void 0!==e[10]&&(o.open=e[10]),t=new e[11]({props:o}),ee.push((()=>$e(t,"open",i))),{c(){Ee(t.$$.fragment)},m(e,n){Ae(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],le((()=>n=!1))),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function no(e){let t,n;return t=new Gi({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(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ro(e){let t,n,r,i,o,s,a,l,c,d=!e[16].single&&e[7]?.length&&Yi(e);function u(t){e[35](t)}function h(t){e[36](t)}let f={id:e[3],name:e[3],class:e[3],readonly:e[13],disabled:e[1],required:e[6],placeholder:e[8],getOptions:io,minSearchLength:"3",$$slots:{"load-more-options-message":[Zi]},$$scope:{ctx:e}};void 0!==e[7]&&(f.selection=e[7]),void 0!==e[9]&&(f.maxOptions=e[9]),r=new e[12]({props:f}),ee.push((()=>$e(r,"selection",u))),ee.push((()=>$e(r,"maxOptions",h))),r.$on("change",e[22]);let m=!e[1]&&Ki(e),p=e[10]&&to(e);return{c(){t=O("div"),d&&d.c(),n=B(),Ee(r.$$.fragment),s=B(),m&&m.c(),a=B(),p&&p.c(),l=P(),z(t,"position","relative")},m(e,i){R(e,t,i),d&&d.m(t,null),N(t,n),Ae(r,t,null),N(t,s),m&&m.m(t,null),R(e,a,i),p&&p.m(e,i),R(e,l,i),c=!0},p(e,s){!e[16].single&&e[7]?.length?d?d.p(e,s):(d=Yi(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],le((()=>i=!1))),!o&&512&s[0]&&(o=!0,a.maxOptions=e[9],le((()=>o=!1))),r.$set(a),e[1]?m&&(pe(),ye(m,1,1,(()=>{m=null})),ge()):m?(m.p(e,s),2&s[0]&&we(m,1)):(m=Ki(e),m.c(),we(m,1),m.m(t,null)),e[10]?p?(p.p(e,s),1024&s[0]&&we(p,1)):(p=to(e),p.c(),we(p,1),p.m(l.parentNode,l)):p&&(pe(),ye(p,1,1,(()=>{p=null})),ge())},i(e){c||(we(r.$$.fragment,e),we(m),we(p),c=!0)},o(e){ye(r.$$.fragment,e),ye(m),ye(p),c=!1},d(e){e&&D(t),d&&d.d(),be(r),m&&m.d(),e&&D(a),p&&p.d(e),e&&D(l)}}}async function*io(e){yield[{name:e}]}function oo(e,n,r){const i=K(),{Modal:o,Autocomplete:s}=c;let{classId:a}=n,{id:l}=n,{item:d}=n,{record:u}=n,{value:h}=n,{noForm:f=!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:C,hint:$,readonly:E,required:A=!1,lookup:b="",view:S=!1,multi:T,max:N=1e3,generate:R=!1,status:D=!0,refDoc:k}=I;const[O,x]=b.split(":");let M=!1,B=h.map&&h.map((e=>({name:e})))||[];m||=E,m&&(C="");const P=({detail:e})=>{let t=[];e.value.map((e=>{const n=e.name?.split(",");t=t.concat(n)})),r(7,B=t.map((e=>({name:e.trim()}))));const n=B.map((e=>e.name));i("blur",{value:n}),i("multi",{view:T.view,lookup:b,name:d.name,value:n})};Y((async()=>{i("multi",{view:T.view,lookup:b,name:d.name,value:h});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||N;(T.unique||B.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,B=t.map((e=>({name:e})))),i("blur",{value:t}),i("multi",{view:T.view,lookup:b,name:d.name,value:t}),F()},U=async()=>{const e={[x]:u[x]},n=await t.getSectionView(O,e),r=Array.from({length:n.length},((e,t)=>n[t][d.name]));V({detail:{name:d.name,list:r}})},H=(e=!1)=>{if(m||!T.required)return;const t=T.maxItem;if(!t||T.unique)return;r(9,N=!1!==e?e:v||u[t]||0);const n=B?.length!=N,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,h=e.value),"noForm"in e&&r(28,f=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,B=[]),48&e.$$.dirty[0]&&u&&Array.isArray(u[d.name])&&r(7,B=u[d.name].map((e=>({name:e})))),16&e.$$.dirty[0]|2&e.$$.dirty[1]&&y&&y===d.name&&r(7,B=[]),128&e.$$.dirty[0]&&B&&(r(0,h=B.map&&B.map((e=>e.name))||[]),H()),1073741824&e.$$.dirty[0]&&((e={})=>{const{item:t,value:n,idx:r}=e;void 0!==w&&w!==r||t&&t.name===T.maxItem&&H(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,B=[]);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,B=l.map((e=>({name:e})))),P({detail:{value:B}})}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,B=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,B=[]);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,B=l.map((e=>({name:e})))),P({detail:{value:B}})}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,B=l&&l.map((e=>({name:e}))))}}setTimeout(H,250)}})(_)},[h,m,a,l,d,u,A,B,C,N,M,o,s,E,b,S,T,R,D,k,O,x,P,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[T.maxItem];if(!e)return;let n={};x&&(n={[x]:u[x]}),D&&(n.status=!0);const r=[].concat(u[T.view]||[]);r.length&&(n[T.view]={$in:r});const i=await t.getSectionView(O,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:[]}})},f,p,g,w,y,v,_,function(e){B=e,r(7,B),r(5,u),r(4,d),r(32,y)},function(e){N=e,r(9,N)},function(e){M=e,r(10,M)}]}class so extends Te{constructor(e){var t;super(),Xi.getElementById("svelte-1rbaejz-style")||((t=O("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}",N(Xi.head,t)),Se(this,e,oo,ro,A,{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 ao(e){let t,n,r;return n=new vt({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather2 svelte-9up2nn")},m(e,i){R(e,t,i),Ae(n,t,null),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function lo(e){let t,n,r,i,o;return n=new vt({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather pointer svelte-9up2nn")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[9]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function co(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=[lo,ao],l=[];function c(e,t){return e[7]?0:1}return i=c(e),o=l[i]=a[i](e),{c(){t=O("div"),Ee(n.$$.fragment),r=B(),o.c(),z(t,"position","relative")},m(e,o){R(e,t,o),Ae(n,t,null),N(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):(pe(),ye(l[d],1,1,(()=>{l[d]=null})),ge(),o=l[i],o?o.p(e,r):(o=l[i]=a[i](e),o.c()),we(o,1),o.m(t,null))},i(e){s||(we(n.$$.fragment,e),we(o),s=!0)},o(e){ye(n.$$.fragment,e),ye(o),s=!1},d(e){e&&D(t),be(n),l[i].d()}}}const uo=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 ho(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:h}=t,{record:f}=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,h=e.value),"record"in e&&n(10,f=e.record),"item"in e&&n(11,m=e.item)},[i,o,s,a,l,d,u,h,r,async()=>{if(!h)return;const e=u.includes(".")?f[u.split(".")[0]]:f,t=await uo(e);window.open(t,"_blank")},f,m,function(t){Q(e,t)}]}class fo extends Te{constructor(e){var t;super(),document.getElementById("svelte-9up2nn-style")||((t=O("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}",N(document.head,t)),Se(this,e,ho,co,A,{inputClass:0,disabled:1,formnovalidate:2,readonly:3,required:4,id:5,name:6,value:7,record:10,item:11})}}const{document:mo}=Ie;function po(e){let t;return{c(){t=O("div"),U(t,"class","load-more-options"),U(t,"slot","load-more-options-message")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function go(e){let t,n,r;return n=new vt({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather2 svelte-wpjws5")},m(e,i){R(e,t,i),Ae(n,t,null),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function wo(e){let t,n,r,i,o;return n=new vt({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather pointer svelte-wpjws5")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[8]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function yo(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":[po]},$$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}),ee.push((()=>$e(n,"value",l))),ee.push((()=>$e(n,"selection",c))),ee.push((()=>$e(n,"searchQuery",d))),n.$on("change",e[6]);let h=e[5]&&function(e){let t,n,r,i;const o=[wo,go],s=[];function a(e,t){return e[0]?0:1}return t=a(e),n=s[t]=o[t](e),{c(){n.c(),r=P()},m(e,n){s[t].m(e,n),R(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?s[t].p(e,i):(pe(),ye(s[l],1,1,(()=>{s[l]=null})),ge(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),we(n,1),n.m(r.parentNode,r))},i(e){i||(we(n),i=!0)},o(e){ye(n),i=!1},d(e){s[t].d(e),e&&D(r)}}}(e);return{c(){t=O("div"),Ee(n.$$.fragment),s=B(),h&&h.c(),z(t,"position","relative"),U(t,"class","inputAutoComplete")},m(e,r){R(e,t,r),Ae(n,t,null),N(t,s),h&&h.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]),16&t[1]&&(s.$$scope={dirty:t,ctx:e}),!r&&1&t[0]&&(r=!0,s.value=e[0],le((()=>r=!1))),!i&&4&t[0]&&(i=!0,s.selection=e[2],le((()=>i=!1))),!o&&8&t[0]&&(o=!0,s.searchQuery=e[3],le((()=>o=!1))),n.$set(s),e[5]&&h.p(e,t)},i(e){a||(we(n.$$.fragment,e),we(h),a=!0)},o(e){ye(n.$$.fragment,e),ye(h),a=!1},d(e){e&&D(t),be(n),h&&h.d()}}}function vo(e,t,n){const{Autocomplete:r}=c,i=K();let{classId:o}=t,{id:s}=t,{item:a}=t,{name:l}=t,{listName:d}=t,{record:u}=t,{value:h}=t,{noForm:f=!1}=t,{disabled:m}=t,{formnovalidate:p}=t;const{autocomplete:{input:g,min:w,url:y,output:v},format:_}=a.properties,I=[].concat(g),{name:C}=v,$="map"===_;let E,A=h,b=!1;Y((()=>{const e=document.querySelector("."+a.name+" .autocomplete input");e&&(e.addEventListener("focus",N),e.addEventListener("keyup",T),e.addEventListener("keydown",S));const t=document.getElementById(s);t&&t.classList.add(o)}));const S=e=>{b=8===e.keyCode||32===e.keyCode},T=e=>{8===e.keyCode&&""===A&&n(0,h="")},N=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(h.startsWith(e[0].name))return;n(3,A=n(0,h=e[0].name)),k(h)}else e.find((e=>(A||"").startsWith(e.name)))||h||n(3,A=" ");else h||n(3,A="")},R=async(e="")=>{const t=await fetch(y+"?"+D()+"&name=%5E"+e.trim());if(!t.ok)return;const n=t.headers.get("Content-Type").split(";")[0];let r=[];try{if("text/json"===n){const e=await t.text();r=JSON.parse(e||[])}else"application/json"===n&&(r=await t.json())}catch{}return r.map((e=>({name:e[C]})))},D=()=>I.map((({name:e,refItem:t})=>`${t}=${(d?u[d][e]:u[e]).split(" ")[0]}`)).join("&"),k=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,h=e.value),"noForm"in e&&n(14,f=e.noForm),"disabled"in e&&n(15,m=e.disabled),"formnovalidate"in e&&n(16,p=e.formnovalidate)},[h,s,E,A,r,$,({detail:{value:e}})=>{e.length&&n(3,A=n(0,h=e[0].name)),n(2,E=[]),k(h)},async function*(e){if(b||h&&e.startsWith(h))return n(0,h=e),void k(h);const t=await R(e);if(!t?.length)return n(0,h=e),void k(h);1===t.length?(n(3,A=n(0,h=t[0].name)),n(2,E=[]),k(h)):yield t},async()=>{if(!h)return;const e=l.includes(".")?u[l.split(".")[0]]:u,t=await uo(e);window.open(t,"_blank")},o,a,l,d,u,f,m,p,function(e){h=e,n(0,h)},function(e){E=e,n(2,E)},function(e){A=e,n(3,A)}]}class _o extends Te{constructor(e){var t;super(),mo.getElementById("svelte-wpjws5-style")||((t=O("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}",N(mo.head,t)),Se(this,e,vo,yo,A,{classId:9,id:1,item:10,name:11,listName:12,record:13,value:0,noForm:14,disabled:15,formnovalidate:16},[-1,-1])}}const{document:Io}=Ie;function Co(e){e[26]=e[28].list,e[27]=e[28].items}function $o(e,t,n){const r=e.slice();return r[29]=t[n],r}function Eo(e,t,n){const r=e.slice();return r[32]=t[n],r}function Ao(e,t,n){const r=e.slice();return r[32]=t[n],r}function bo(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function So(e){let t,n,r,i,o,s,a,l,c,d,u,h,f,m,p,g,w,y;function v(t){e[23](t)}Co(e),n=new e[7]({props:{outline:!0,$$slots:{default:[To]},$$scope:{ctx:e}}}),n.$on("click",e[22]);let _={id:e[8]};void 0!==e[1]&&(_.value=e[1]),s=new e[6]({props:_}),ee.push((()=>$e(s,"value",v))),s.$on("input",e[12]),d=new tt({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]=No(Ao(e,r,t));return{c(){t=O("thead"),n=O("tr");for(let e=0;e<i.length;e+=1)i[e].c();U(n,"class","svelte-14hcfjl"),U(t,"class","svelte-14hcfjl")},m(e,r){R(e,t,r),N(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=Ao(e,r,o);i[o]?i[o].p(s,t):(i[o]=No(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&&D(t),k(i,e)}}}(e),C=e[26]?.length&&function(e){let t,n=e[26],r=[];for(let t=0;t<n.length;t+=1)r[t]=ko($o(e,n,t));return{c(){for(let e=0;e<r.length;e+=1)r[e].c();t=P()},m(e,n){for(let t=0;t<r.length;t+=1)r[t].m(e,n);R(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=$o(e,n,o);r[o]?r[o].p(s,i):(r[o]=ko(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){k(r,e),e&&D(t)}}}(e);return{c(){t=O("div"),Ee(n.$$.fragment),r=B(),i=O("div"),o=M("Suchen: "),Ee(s.$$.fragment),l=B(),c=O("span"),Ee(d.$$.fragment),u=B(),h=O("div"),f=O("table"),I&&I.c(),m=B(),p=O("tbody"),C&&C.c(),U(t,"class","form--buttons svelte-14hcfjl"),U(c,"class","feather pointer svelte-14hcfjl"),z(i,"margin-bottom","1em"),z(i,"position","relative"),U(f,"striped",""),U(f,"class","svelte-14hcfjl"),U(h,"class","eList svelte-14hcfjl")},m(a,v){R(a,t,v),Ae(n,t,null),R(a,r,v),R(a,i,v),N(i,o),Ae(s,i,null),N(i,l),N(i,c),Ae(d,c,null),R(a,u,v),R(a,h,v),N(h,f),I&&I.m(f,null),N(f,m),N(f,p),C&&C.m(p,null),g=!0,w||(y=L(c,"click",e[14]),w=!0)},p(e,t){Co(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],le((()=>a=!1))),s.$set(i),e[27]?.length&&I.p(e,t),e[26]?.length&&C.p(e,t)},i(e){g||(we(n.$$.fragment,e),we(s.$$.fragment,e),we(d.$$.fragment,e),g=!0)},o(e){ye(n.$$.fragment,e),ye(s.$$.fragment,e),ye(d.$$.fragment,e),g=!1},d(e){e&&D(t),be(n),e&&D(r),e&&D(i),be(s),be(d),e&&D(u),e&&D(h),I&&I.d(),C&&C.d(),w=!1,y()}}}function To(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function No(e){let t,n,r=e[32]?.designation+"";return{c(){t=O("th"),n=M(r),U(t,"class","svelte-14hcfjl")},m(e,r){R(e,t,r),N(t,n)},p:_,d(e){e&&D(t)}}}function Ro(e){let t,n,r=e[27],i=[];for(let t=0;t<r.length;t+=1)i[t]=Do(Eo(e,r,t));return{c(){t=O("tr");for(let e=0;e<i.length;e+=1)i[e].c();n=B(),U(t,"class","pointer svelte-14hcfjl"),q(t,"active",e[29]._id===e[0])},m(e,r){R(e,t,r);for(let e=0;e<i.length;e+=1)i[e].m(t,null);N(t,n)},p(e,o){if(3584&o[0]){let s;for(r=e[27],s=0;s<r.length;s+=1){const a=Eo(e,r,s);i[s]?i[s].p(a,o):(i[s]=Do(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]&&q(t,"active",e[29]._id===e[0])},d(e){e&&D(t),k(i,e)}}}function Do(e){let t,n,r,i,o=e[9](e[29],e[32])+"";return{c(){t=O("td"),n=M(o),U(t,"class","svelte-14hcfjl")},m(o,s){R(o,t,s),N(t,n),r||(i=L(t,"click",V(e[10](e[29]))),r=!0)},p(t,n){e=t},d(e){e&&D(t),r=!1,i()}}}function ko(e){let t,n=e[13](e[29],e[27],e[1]),r=n&&Ro(e);return{c(){r&&r.c(),t=P()},m(e,n){r&&r.m(e,n),R(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=Ro(e),r.c(),r.m(t.parentNode,t)):r&&(r.d(1),r=null)},d(e){r&&r.d(e),e&&D(t)}}}function Oo(e){let t,n;return t=new e[5]({}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p:_,i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function xo(e){let t,n,r,i;t=new e[4]({});let o={ctx:e,current:null,token:null,hasCatch:!1,pending:Oo,then:So,catch:bo,value:28,blocks:[,,,]};return ve(e[11](),o),{c(){Ee(t.$$.fragment),n=B(),r=P(),o.block.c()},m(e,s){Ae(t,e,s),R(e,n,s),R(e,r,s),o.block.m(e,o.anchor=s),o.mount=()=>r.parentNode,o.anchor=r,i=!0},p(t,n){_e(o,e=t,n)},i(e){i||(we(t.$$.fragment,e),we(o.block),i=!0)},o(e){ye(t.$$.fragment,e);for(let e=0;e<3;e+=1){ye(o.blocks[e])}i=!1},d(e){be(t,e),e&&D(n),e&&D(r),o.block.d(e),o.token=null,o=null}}}function Mo(e){let t,n;return t=new e[3]({props:{title:"Auswahl",class:"eList",$$slots:{default:[xo]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Bo(e,n,i){const o=K(),{Dialog:s,Divider:a,Loading:l,TextField:d,Button:u}=c;let{item:h}=n,{className:f}=n,{classId:p}=n,{rowId:w}=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?g(n):m(e[`_${t.name}`]||e[t.name]||"")},A=t.getSchemaByClass(f);Y((()=>{window.setTimeout((()=>{const e=document.querySelector("tr.active");e?e.scrollIntoView({block:"end",behavior:"smooth"}):document.getElementById($)?.focus()}),200)})),r.subscribe((async e=>{if(!e)return;const t=await A;e.eventId===t.id&&gh(t.class,e.eventId)}));return e.$$set=e=>{"item"in e&&i(15,h=e.item),"className"in e&&i(16,f=e.className),"classId"in e&&i(17,p=e.classId),"rowId"in e&&i(0,w=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)},[w,C,o,s,a,l,d,u,$,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 Xt(o,e,i)}},({detail:{value:e}})=>{i(1,C=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,C="")},h,f,p,y,v,_,I,()=>o("back"),function(e){C=e,i(1,C)}]}class Po extends Te{constructor(e){var t;super(),Io.getElementById("svelte-14hcfjl-style")||((t=O("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}",N(Io.head,t)),Se(this,e,Bo,Mo,A,{item:15,className:16,classId:17,rowId:0,viewName:18,viewValue:19,recordId:20,filter:21},[-1,-1])}}function Lo(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Fo(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}),ee.push((()=>$e(n,"value",s)));let l=!e[6]&&Vo(e);return{c(){t=O("div"),Ee(n.$$.fragment),i=B(),l&&l.c(),z(t,"position","relative")},m(e,r){R(e,t,r),Ae(n,t,null),N(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],le((()=>r=!1))),n.$set(o),e[6]?l&&(pe(),ye(l,1,1,(()=>{l=null})),ge()):l?(l.p(e,i),64&i&&we(l,1)):(l=Vo(e),l.c(),we(l,1),l.m(t,null))},i(e){o||(we(n.$$.fragment,e),we(l),o=!0)},o(e){ye(n.$$.fragment,e),ye(l),o=!1},d(e){e&&D(t),be(n),l&&l.d()}}}function Vo(e){let t,n,r,i,o;return n=new Tt({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather pointer svelte-wbrqzu")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[17]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function Uo(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Ho(e){let t,n,r;function i(t){e[22](t)}let o={class:"tModal",noClickaway:!0,$$slots:{default:[Wo]},$$scope:{ctx:e}};return void 0!==e[8]&&(o.open=e[8]),t=new e[11]({props:o}),ee.push((()=>$e(t,"open",i))),{c(){Ee(t.$$.fragment)},m(e,n){Ae(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],le((()=>n=!1))),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function Wo(e){let t,n;return t=new Po({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(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function zo(e){let t,n,r,i={ctx:e,current:null,token:null,hasCatch:!1,pending:Uo,then:Fo,catch:Lo,value:27,blocks:[,,,]};ve(e[16](),i);let o=e[8]&&Ho(e);return{c(){i.block.c(),t=B(),o&&o.c(),n=P()},m(e,s){i.block.m(e,i.anchor=s),i.mount=()=>t.parentNode,i.anchor=t,R(e,t,s),o&&o.m(e,s),R(e,n,s),r=!0},p(t,[r]){_e(i,e=t,r),e[8]?o?(o.p(e,r),256&r&&we(o,1)):(o=Ho(e),o.c(),we(o,1),o.m(n.parentNode,n)):o&&(pe(),ye(o,1,1,(()=>{o=null})),ge())},i(e){r||(we(i.block),we(o),r=!0)},o(e){for(let e=0;e<3;e+=1){ye(i.blocks[e])}ye(o),r=!1},d(e){i.block.d(e),i.token=null,i=null,e&&D(t),o&&o.d(e),e&&D(n)}}}function qo(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:h}=t,{formnovalidate:f}=t,{praefix:m}=t;const{properties:p={}}=a;let g,{pattern:w,placeholder:y,readonly:v,required:_=!1,view:I}=p,C=!1;const $=()=>{n(8,C=!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,h=e.disabled),"formnovalidate"in e&&n(7,f=e.formnovalidate),"praefix"in e&&n(20,m=e.praefix)},[d,o,s,a,l,u,h,f,C,g,r,i,w,v,_,I,async()=>(n(9,g=l[I.selection]),!0),()=>{n(8,C=!0)},({detail:e})=>{n(0,d=e.row[I.value?I.value:"_id"]),$()},$,m,function(e){d=e,n(0,d)},function(e){C=e,n(8,C)}]}class jo extends Te{constructor(e){var t;super(),document.getElementById("svelte-wbrqzu-style")||((t=O("style")).id="svelte-wbrqzu-style",t.textContent=".feather.svelte-wbrqzu{position:absolute;top:0.75em;left:0.5em;color:#4300b0}",N(document.head,t)),Se(this,e,qo,zo,A,{classId:1,id:2,item:3,record:4,value:0,noForm:5,disabled:6,formnovalidate:7,praefix:20})}}function Go(e,t,n){const r=e.slice();return r[12]=t[n][0],r[13]=t[n][1],r}function Xo(e){let t;return{c(){t=O("option"),t.textContent="- ",t.selected=!0,t.__value="",t.value=t.__value},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Yo(e){let t;return{c(){t=O("option"),t.textContent="-- Bitte wählen -- ",t.disabled=!0,t.selected=!0,t.__value="",t.value=t.__value},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Zo(e){let t,n,r,i,o=e[12]+"";return{c(){t=O("option"),n=M(o),t.__value=r=e[13],t.value=t.__value,t.selected=i=e[0]==e[13]},m(e,r){R(e,t,r),N(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&&D(t)}}}function Ko(e){let t,n,r,i,o,s=!e[7]&&function(e){let t;function n(e,t){return e[5]&&!0!==e[8]?Yo:Xo}let r=n(e),i=r(e);return{c(){i.c(),t=P()},m(e,n){i.m(e,n),R(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&&D(t)}}}(e),a=e[6],l=[];for(let t=0;t<a.length;t+=1)l[t]=Zo(Go(e,a,t));return{c(){t=O("select"),s&&s.c(),n=P();for(let e=0;e<l.length;e+=1)l[e].c();U(t,"class",r=S(e[3]||e[4])+" svelte-5xpzvo"),U(t,"id",e[2]),U(t,"name",e[2]),t.disabled=e[1],t.required=e[5]},m(r,a){R(r,t,a),s&&s.m(t,null),N(t,n);for(let e=0;e<l.length;e+=1)l[e].m(t,null);i||(o=L(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=Go(e,a,r);l[r]?l[r].p(i,n):(l[r]=Zo(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=S(e[3]||e[4])+" svelte-5xpzvo")&&U(t,"class",r),4&n&&U(t,"id",e[2]),4&n&&U(t,"name",e[2]),2&n&&(t.disabled=e[1]),32&n&&(t.required=e[5])},i:_,o:_,d(e){e&&D(t),s&&s.d(),k(l,e),i=!1,o()}}}function Qo(e,t,n){const r=K();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:h,readonly:f}=o.properties;u&&(u=u.map((e=>[e,e]))),"businessMonth"===h&&(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"===h&&(s||=2024,u=[["2024/2025",2024]]),"valueAddedTax"===h&&(s||=0,u=[["0% Steuerbefreit",0],["8.1% Normalsatz",.081],["2.6% Reduzierter Satz",.026],["3.8% Beherbergung",.038]]),c||=!!f,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,h,f,e=>r("blur",{value:e.srcElement.value}),o]}class Jo extends Te{constructor(e){var t;super(),document.getElementById("svelte-5xpzvo-style")||((t=O("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}",N(document.head,t)),Se(this,e,Qo,Ko,A,{id:2,item:10,value:0,noForm:3,classId:4,disabled:1,required:5})}}function es(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 Pe({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"title","Übernehmen"),U(t,"class","pointer feather")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[12]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}(e);return{c(){t=O("input"),r=B(),Ee(i.$$.fragment),o=B(),d&&d.c(),s=P(),U(t,"type","string"),U(t,"class",n=e[3]||e[4]),U(t,"id",e[1]),U(t,"name",e[1]),t.hidden=!0},m(n,u){R(n,t,u),W(t,e[0]),R(n,r,u),Ae(i,n,u),R(n,o,u),d&&d.m(n,u),R(n,s,u),a=!0,l||(c=L(t,"input",e[18]),l=!0)},p(e,[r]){(!a||24&r&&n!==(n=e[3]||e[4]))&&U(t,"class",n),(!a||2&r)&&U(t,"id",e[1]),(!a||2&r)&&U(t,"name",e[1]),1&r&&W(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||(we(i.$$.fragment,e),we(d),a=!0)},o(e){ye(i.$$.fragment,e),ye(d),a=!1},d(e){e&&D(t),e&&D(r),be(i,e),e&&D(o),d&&d.d(e),e&&D(s),l=!1,c()}}}let ts=new Map;function ns(e,n,r){const i=K(),{DatePicker:o}=c;let{value:s}=n,{id:a}=n,{item:l}=n,{record:d}=n,{praefix:u}=n,{noForm:h=!1}=n,{classId:f}=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,C=l.properties?.noCalendar||!1,$=l.properties?.transfer,E=({detail:e})=>{try{r(0,s=hr(e.value,s)),void 0!==u&&ts.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=hr(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,h=e.noForm),"classId"in e&&r(4,f=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&&!$&&ts.has(I)&&r(0,s=ts.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=hr(d[l.name],s))}catch{}},[s,a,u,h,f,p,g,w,o,C,$,E,()=>{i("record",{target:$.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 rs extends Te{constructor(e){super(),Se(this,e,ns,es,A,{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 is(e){let t;return{c(){t=M("Stunden")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function os(e){let t,n;return t=new e[4]({props:{slot:"hours-label",$$slots:{default:[is]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};4096&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ss(e){let t;return{c(){t=M("Minuten")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function as(e){let t,n;return t=new e[4]({props:{slot:"minutes-label",$$slots:{default:[ss]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};4096&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ls(e){let t;return{c(){t=M("Jetzt")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function cs(e){let t,n;return t=new e[4]({props:{slot:"now-label",$$slots:{default:[ls]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};4096&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ds(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":[cs],"minutes-label":[as],"hours-label":[os]},$$scope:{ctx:e}}}),s.$on("change",e[7]),{c(){t=O("input"),r=B(),Ee(i.$$.fragment),o=B(),Ee(s.$$.fragment),U(t,"type","string"),U(t,"class",n=e[2]||e[3]),U(t,"id",e[1]),U(t,"name",e[1]),t.hidden=!0},m(n,d){R(n,t,d),W(t,e[0]),R(n,r,d),Ae(i,n,d),R(n,o,d),Ae(s,n,d),a=!0,l||(c=L(t,"input",e[9]),l=!0)},p(e,[r]){(!a||12&r&&n!==(n=e[2]||e[3]))&&U(t,"class",n),(!a||2&r)&&U(t,"id",e[1]),(!a||2&r)&&U(t,"name",e[1]),1&r&&W(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||(we(i.$$.fragment,e),we(s.$$.fragment,e),a=!0)},o(e){ye(i.$$.fragment,e),ye(s.$$.fragment,e),a=!1},d(e){e&&D(t),e&&D(r),be(i,e),e&&D(o),be(s,e),l=!1,c()}}}function us(e,t,n){const r=K(),{Label:i,DatePicker:o,TimePicker:s}=c;let{value:a}=t,{id:l}=t,{noForm:d=!1}=t,{classId:u}=t;const h=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))),h(a)},({detail:e})=>{n(0,a=hr(e.value,a)),h(a)},function(){a=this.value,n(0,a)}]}class hs extends Te{constructor(e){super(),Se(this,e,us,ds,A,{value:0,id:1,noForm:2,classId:3})}}function fs(e){let t,n,r,i,o,s,a,l,c,d,u,h,f,m,p,g;return u=new e[9]({props:{format:e[5],required:e[3],disabled:e[4],value:e[7],noCalendar:e[10],closeOnSelection:!0}}),u.$on("change",e[11]),f=new e[9]({props:{format:e[6],required:e[3],disabled:e[4],value:e[8],noCalendar:e[10],class:"moveLeft",closeOnSelection:!0}}),f.$on("change",e[12]),{c(){t=O("input"),o=B(),s=O("input"),d=B(),Ee(u.$$.fragment),h=M(" /\n"),Ee(f.$$.fragment),U(t,"type","string"),U(t,"class",n=e[1]||e[2]),U(t,"id",r=e[0]+"_from"),U(t,"name",i=e[0]+"_from"),t.hidden=!0,U(s,"type","string"),U(s,"class",a=e[1]||e[2]),U(s,"id",l=e[0]+"_to"),U(s,"name",c=e[0]+"_to"),s.hidden=!0},m(n,r){R(n,t,r),W(t,e[7]),R(n,o,r),R(n,s,r),W(s,e[8]),R(n,d,r),Ae(u,n,r),R(n,h,r),Ae(f,n,r),m=!0,p||(g=[L(t,"input",e[15]),L(s,"input",e[16])],p=!0)},p(e,[o]){(!m||6&o&&n!==(n=e[1]||e[2]))&&U(t,"class",n),(!m||1&o&&r!==(r=e[0]+"_from"))&&U(t,"id",r),(!m||1&o&&i!==(i=e[0]+"_from"))&&U(t,"name",i),128&o&&W(t,e[7]),(!m||6&o&&a!==(a=e[1]||e[2]))&&U(s,"class",a),(!m||1&o&&l!==(l=e[0]+"_to"))&&U(s,"id",l),(!m||1&o&&c!==(c=e[0]+"_to"))&&U(s,"name",c),256&o&&W(s,e[8]);const d={};32&o&&(d.format=e[5]),8&o&&(d.required=e[3]),16&o&&(d.disabled=e[4]),128&o&&(d.value=e[7]),u.$set(d);const h={};64&o&&(h.format=e[6]),8&o&&(h.required=e[3]),16&o&&(h.disabled=e[4]),256&o&&(h.value=e[8]),f.$set(h)},i(e){m||(we(u.$$.fragment,e),we(f.$$.fragment,e),m=!0)},o(e){ye(u.$$.fragment,e),ye(f.$$.fragment,e),m=!1},d(e){e&&D(t),e&&D(o),e&&D(s),e&&D(d),be(u,e),e&&D(h),be(f,e),p=!1,$(g)}}}function ms(e,t,n){const r=K(),{DatePicker:i}=c;let{value:o}=t,{id:s}=t,{item:a}=t,{noForm:l=!1}=t,{classId:d}=t,{required:u}=t,{disabled:h}=t;const{noCalendar:f,preset:m}=a.properties||{};let p="%d.%m.%Y",g="%d.%m.%Y",w=o?.from,y=o?.to;if(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&&(w=e),t&&(y=t)}"Invalid Date"===w?.toString()&&(w=void 0),"Invalid Date"===y?.toString()&&(y=void 0),h&&(void 0===w&&(p=""),void 0===y&&(g=""));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,h=e.disabled)},[s,l,d,u,h,p,g,w,y,i,f,({detail:e})=>{n(7,w=hr(e.value,w)),y&&w&&y.valueOf()-w.valueOf()<0&&n(7,w=void 0),r("change",{value:w,range:"_from"})},({detail:e})=>{n(8,y=hr(e.value,y)),y&&w&&y.valueOf()-w.valueOf()<0&&n(8,y=void 0),r("change",{value:y,range:"_to"})},o,a,function(){w=this.value,n(7,w)},function(){y=this.value,n(8,y)}]}class ps extends Te{constructor(e){var t;super(),document.getElementById("svelte-7itxk4-style")||((t=O("style")).id="svelte-7itxk4-style",t.textContent="div.date-picker.moveLeft div.dropdown.calendar{left:-3em !important}",N(document.head,t)),Se(this,e,ms,fs,A,{value:13,id:0,item:14,noForm:1,classId:2,required:3,disabled:4})}}function gs(e){let t,n,r,i,o;function s(t){e[13](t)}let a={class:e[0],id:e[1],name:e[2],accept:".xml",max:"1",beforeChange:e[9]};return void 0!==e[3]&&(a.files=e[3]),t=new e[5]({props:a}),ee.push((()=>$e(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(){Ee(t.$$.fragment),r=B(),Ee(i.$$.fragment)},m(e,n){Ae(t,e,n),R(e,r,n),Ae(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],le((()=>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||(we(t.$$.fragment,e),we(i.$$.fragment,e),o=!0)},o(e){ye(t.$$.fragment,e),ye(i.$$.fragment,e),o=!1},d(e){be(t,e),e&&D(r),be(i,e)}}}function ws(e){let t,n;return t=new e[6]({props:{inputClass:e[0],readonly:!0,id:e[1],name:e[1],value:e[4]}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ys(e){let t,n,r,i;const o=[ws,gs],s=[];return t=function(e){return e[7]?0:1}(e),n=s[t]=o[t](e),{c(){n.c(),r=P()},m(e,n){s[t].m(e,n),R(e,r,n),i=!0},p(e,[t]){n.p(e,t)},i(e){i||(we(n),i=!0)},o(e){ye(n),i=!1},d(e){s[t].d(e),e&&D(r)}}}function vs(e,t,n){const{FileDropzone:r,TextField:i}=c,o=K();let{classId:s}=t,{eventId:a}=t,{record:l}=t,{item:d}=t,{id:u}=t,{name:h}=t,f=[],m=l[d.name]||"",p=!!l._id;const g=e=>{if(!e)return"";e=e.replaceAll(" ","").slice(4);let[t,...n]=e.split("00");n=n.join("00");let r="";for(let e=0;e<t.length/2;e++){const n=2*e,i=t.substring(n,n+2);r+=String.fromCharCode(i)}return r+n};return e.$$set=e=>{"classId"in e&&n(0,s=e.classId),"eventId"in e&&n(10,a=e.eventId),"record"in e&&n(11,l=e.record),"item"in e&&n(12,d=e.item),"id"in e&&n(1,u=e.id),"name"in e&&n(2,h=e.name)},[s,u,h,f,m,r,i,p,async()=>{const{list:e}=d.properties,t=f[0];if(t){n(4,m=t.name);const r=(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))})(await t.text()),i=[],s=r.BkToCstmrDbtCdtNtfctn.Ntfctn,a=[].concat(s.Ntry);for(const e of a){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:g(t),information:n.RmtInf?.Ustrd||""};i.push(r)}}i.length&&o("record",{itemName:e,value:i})}},()=>{n(3,f)},a,l,d,function(e){f=e,n(3,f)}]}class _s extends Te{constructor(e){var t;super(),document.getElementById("svelte-157hlzf-style")||((t=O("style")).id="svelte-157hlzf-style",t.textContent="label.file-dropzone{margin-top:0 !important}",N(document.head,t)),Se(this,e,vs,ys,A,{classId:0,eventId:10,record:11,item:12,id:1,name:2})}}const Is=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=Cs(10,n[31]),t.amountVat=$s(Cs(32,n[31]),t.amount)||$s(Cs(33,n[31]),t.amount),t):t},Cs=(e,t)=>{if(!e)return"";if(!t)return"";const n=t.split("/"+e+"/")[1];return n?.split("/")[0]||""},$s=(e,t)=>{if(!e)return"";let n=0;if(e.includes(":")){const t=e.split(";");for(const e of t)n+=e.split(":")[1]}else n=+t/(+e+100)*+e;return n},{document:Es}=Ie;function As(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}),ee.push((()=>$e(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(){Ee(t.$$.fragment),r=B(),Ee(i.$$.fragment)},m(e,n){Ae(t,e,n),R(e,r,n),Ae(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],le((()=>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||(we(t.$$.fragment,e),we(i.$$.fragment,e),o=!0)},o(e){ye(t.$$.fragment,e),ye(i.$$.fragment,e),o=!1},d(e){be(t,e),e&&D(r),be(i,e)}}}function bs(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]&&Ss(e);return{c(){t=O("div"),Ee(n.$$.fragment),r=B(),o&&o.c(),z(t,"position","relative")},m(e,s){R(e,t,s),Ae(n,t,null),N(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&&we(o,1)):(o=Ss(e),o.c(),we(o,1),o.m(t,null)):o&&(pe(),ye(o,1,1,(()=>{o=null})),ge())},i(e){i||(we(n.$$.fragment,e),we(o),i=!0)},o(e){ye(n.$$.fragment,e),ye(o),i=!1},d(e){e&&D(t),be(n),o&&o.d()}}}function Ss(e){let t,n,r,i,o;return n=new De({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather pointer svelte-o0hiko")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[9]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function Ts(e){let t,n,r,i;const o=[bs,As],s=[];return t=function(e){return e[7]?0:1}(e),n=s[t]=o[t](e),{c(){n.c(),r=P()},m(e,n){s[t].m(e,n),R(e,r,n),i=!0},p(e,[t]){n.p(e,t)},i(e){i||(we(n),i=!0)},o(e){ye(n),i=!1},d(e){s[t].d(e),e&&D(r)}}}let Ns;function Rs(e,n,r){const{FileDropzone:i,TextField:o}=c,s=K();let{classId:a}=n,{eventId:l}=n,{record:d}=n,{item:u}=n,{id:h}=n,{name:f}=n,m=[],p=d[u.name]||"",g=!!d._id;const w={scale:{once:!1,value:1,start:1,step:.2,stop:1.6},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=Is(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 Y((()=>{if(Ns)return;let e=document.createElement("script");e.src="/QR/pdf-qr2.js",document.head.append(e),e.onload=function(){Ns=PDF_QR_JS}})),Z((()=>{})),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,h=e.id),"name"in e&&r(2,f=e.name)},[a,h,f,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}}),Ns.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 Ds extends Te{constructor(e){var t;super(),Es.getElementById("svelte-o0hiko-style")||((t=O("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}",N(Es.head,t)),Se(this,e,Rs,Ts,A,{classId:0,eventId:12,record:11,item:13,id:1,name:2})}}const{document:ks}=Ie;function Os(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}),ee.push((()=>$e(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(){Ee(t.$$.fragment),r=B(),Ee(i.$$.fragment)},m(e,n){Ae(t,e,n),R(e,r,n),Ae(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],le((()=>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||(we(t.$$.fragment,e),we(i.$$.fragment,e),o=!0)},o(e){ye(t.$$.fragment,e),ye(i.$$.fragment,e),o=!1},d(e){be(t,e),e&&D(r),be(i,e)}}}function xs(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]&&Ms(e);return{c(){t=O("div"),Ee(n.$$.fragment),r=B(),o&&o.c(),z(t,"position","relative")},m(e,s){R(e,t,s),Ae(n,t,null),N(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&&we(o,1)):(o=Ms(e),o.c(),we(o,1),o.m(t,null)):o&&(pe(),ye(o,1,1,(()=>{o=null})),ge())},i(e){i||(we(n.$$.fragment,e),we(o),i=!0)},o(e){ye(n.$$.fragment,e),ye(o),i=!1},d(e){e&&D(t),be(n),o&&o.d()}}}function Ms(e){let t,n,r,i,o;const s=[Ps,Bs],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=P()},m(e,t){a[n].m(e,t),R(e,i,t),o=!0},p(e,t){let o=n;n=l(e,t),n===o?a[n].p(e,t):(pe(),ye(a[o],1,1,(()=>{a[o]=null})),ge(),r=a[n],r?r.p(e,t):(r=a[n]=s[n](e),r.c()),we(r,1),r.m(i.parentNode,i))},i(e){o||(we(r),o=!0)},o(e){ye(r),o=!1},d(e){a[n].d(e),e&&D(i)}}}function Bs(e){let t,n,r,i,o;return n=new De({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather pointer svelte-o0hiko")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[10]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function Ps(e){let t,n={ctx:e,current:null,token:null,hasCatch:!1,pending:Vs,then:Fs,catch:Ls,value:23};return ve(e[11](),n),{c(){t=P(),n.block.c()},m(e,r){R(e,t,r),n.block.m(e,n.anchor=r),n.mount=()=>t.parentNode,n.anchor=t},p(t,r){_e(n,e=t,r)},i:_,o:_,d(e){e&&D(t),n.block.d(e),n.token=null,n=null}}}function Ls(e){return{c:_,m:_,p:_,d:_}}function Fs(e){let t,n,r,i;return{c(){t=O("video"),n=O("source"),i=M("\n Your browser does not support HTML video."),n.src!==(r=e[23])&&U(n,"src",r),U(n,"type","video/mp4"),U(t,"width","500"),t.controls=!0,z(t,"margin-top","1em")},m(e,r){R(e,t,r),N(t,n),N(t,i)},p:_,d(e){e&&D(t)}}}function Vs(e){return{c:_,m:_,p:_,d:_}}function Us(e){let t,n,r,i;const o=[xs,Os],s=[];function a(e,t){return e[6]?0:1}return t=a(e),n=s[t]=o[t](e),{c(){n.c(),r=P()},m(e,n){s[t].m(e,n),R(e,r,n),i=!0},p(e,[i]){let l=t;t=a(e),t===l?s[t].p(e,i):(pe(),ye(s[l],1,1,(()=>{s[l]=null})),ge(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),we(n,1),n.m(r.parentNode,r))},i(e){i||(we(n),i=!0)},o(e){ye(n),i=!1},d(e){s[t].d(e),e&&D(r)}}}function Hs(e,n,r){const{FileDropzone:i,TextField:o}=c,s=K();let{classId:a}=n,{eventId:l}=n,{record:d}=n,{item:u}=n,{id:h}=n,{name:f}=n,{praefix:m}=n,{recordId:p}=n,{fileType:g="application/pdf"}=n,w=[],y="",v=!1;return Y((()=>{(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)})()})),Z((()=>{})),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,h=e.id),"name"in e&&r(2,f=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,h,f,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 Ws extends Te{constructor(e){var t;super(),ks.getElementById("svelte-o0hiko-style")||((t=O("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}",N(ks.head,t)),Se(this,e,Hs,Us,A,{classId:0,eventId:13,record:14,item:15,id:1,name:2,praefix:16,recordId:17,fileType:3})}}function zs(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:qs,placeholder:js,readonly:e[3],disabled:e[4]}}),n.$on("change",e[6]),{c(){t=O("div"),Ee(n.$$.fragment),z(t,"max-width","4em")},m(e,i){R(e,t,i),Ae(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||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}const qs="([01][0-9]|2[0-3]):([0-5][0-9])",js="";function Gs(e,t,n){const r=K(),{TextField:i}=c;let{id:o}=t,{item:s}=t,{value:a}=t,{inputClass:l}=t,{readonly:d}=t,{disabled:u}=t,{praefix:h}=t;const f=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,h=e.praefix)},[o,a,l,d,u,i,({detail:e})=>{r("blur",{value:f(e.value)}),r("checkRange",{idx:h,fieldId:o,value:e.value})},s,h]}class Xs extends Te{constructor(e){var t;super(),document.getElementById("svelte-vvt0yv-style")||((t=O("style")).id="svelte-vvt0yv-style",t.textContent=".text-field input.invalid{border:1px red solid !important}",N(document.head,t)),Se(this,e,Gs,zs,A,{id:0,item:7,value:1,inputClass:2,readonly:3,disabled:4,praefix:8})}}const{document:Ys}=Ie;function Zs(e,t,n){const r=e.slice();return r[20]=t[n],r}function Ks(e,t,n){const r=e.slice();return r[23]=t[n],r[25]=n,r}function Qs(e){let t,n,r=e[2](e[20],e[23])+"",i=e[25]&&function(){let e;return{c(){e=M(", ")},m(t,n){R(t,e,n)},d(t){t&&D(e)}}}();return{c(){t=O("span"),i&&i.c(),n=M(r),U(t,"class","lookupValue")},m(e,r){R(e,t,r),i&&i.m(t,null),N(t,n)},p(e,t){3&t&&r!==(r=e[2](e[20],e[23])+"")&&H(n,r)},d(e){e&&D(t),i&&i.d()}}}function Js(e){let t,n,r,i,o,s,a,l,c=e[0],d=[];for(let t=0;t<c.length;t+=1)d[t]=Qs(Ks(e,c,t));return i=new it({props:{size:"18"}}),{c(){t=O("div");for(let e=0;e<d.length;e+=1)d[e].c();n=B(),r=O("span"),Ee(i.$$.fragment),o=B(),U(r,"class","feather pointer svelte-1r8jgd4"),U(t,"class","lookupItem svelte-1r8jgd4")},m(c,u){R(c,t,u);for(let e=0;e<d.length;e+=1)d[e].m(t,null);N(t,n),N(t,r),Ae(i,r,null),N(t,o),s=!0,a||(l=L(r,"click",(function(){E(e[3](e[20]._id))&&e[3](e[20]._id).apply(this,arguments)})),a=!0)},p(r,i){if(e=r,7&i){let r;for(c=e[0],r=0;r<c.length;r+=1){const o=Ks(e,c,r);d[r]?d[r].p(o,i):(d[r]=Qs(o),d[r].c(),d[r].m(t,n))}for(;r<d.length;r+=1)d[r].d(1);d.length=c.length}},i(e){s||(we(i.$$.fragment,e),s=!0)},o(e){ye(i.$$.fragment,e),s=!1},d(e){e&&D(t),k(d,e),be(i),a=!1,l()}}}function ea(e){let t,n,r=e[1],i=[];for(let t=0;t<r.length;t+=1)i[t]=Js(Zs(e,r,t));const o=e=>ye(i[e],1,1,(()=>{i[e]=null}));return{c(){t=O("div");for(let e=0;e<i.length;e+=1)i[e].c();U(t,"class","lookup svelte-1r8jgd4")},m(e,r){R(e,t,r);for(let e=0;e<i.length;e+=1)i[e].m(t,null);n=!0},p(e,[n]){if(15&n){let s;for(r=e[1],s=0;s<r.length;s+=1){const o=Zs(e,r,s);i[s]?(i[s].p(o,n),we(i[s],1)):(i[s]=Js(o),i[s].c(),we(i[s],1),i[s].m(t,null))}for(pe(),s=r.length;s<i.length;s+=1)o(s);ge()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)we(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)ye(i[e]);n=!1},d(e){e&&D(t),k(i,e)}}}function ta(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:h}=o.properties;let f=d.split(","),[p,g]=c.split(":"),w=[];const[y,v]=g.split("."),_=(e,t)=>{const[n,r]=t.split(".");return r?e[n][r]:""},I=(e=!0)=>{se().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 Y(I),e.$$set=e=>{"id"in e&&r(4,i=e.id),"item"in e&&r(5,o=e.item),"praefix"in e&&r(6,s=e.praefix),"record"in e&&r(7,a=e.record),"notifyList"in e&&r(8,l=e.notifyList)},e.$$.update=()=>{256&e.$$.dirty&&(async e=>{const{itemName:n,value:i}=e||{};if(n!==p)return;if(r(1,w=[]),!i)return;if(!!u==!!a._id)return I();if(!a._id&&!a[p])return I();const o=!f.some((e=>e.includes(":"))),s=v?v+"."+p:p;let l={[s]:a[p]||a._id};if(h&&(l=[{$match:l},{$addFields:{_ids:{$toString:"$_id"}}},{$lookup:{from:"_task",localField:"_ids",foreignField:"docId",as:"_task"}},{$unwind:{path:"$_task",preserveNullAndEmptyArrays:!0}},{$match:{"_task.status":h}}]),r(1,w=await t.getSectionView(y,l,o)),!o&&w.length){const e=f.find((e=>e.includes(":"))).split(":")[0];r(1,w=w.map((t=>{const n=t[e].find((t=>t[e]===a._id));return n._id=t._id,n}))),r(0,f=f.map((e=>e.split(":")[1])))}I(!w.length)})(l)},[f,w,(e,t)=>"boolean"===o.type?e[t]?"ja":"nein":"object"===o.type?"(ja)":e["_"+t]||m(e[t])||e[t]||_(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)},i,o,s,a,l]}class na extends Te{constructor(e){var t;super(),Ys.getElementById("svelte-1r8jgd4-style")||((t=O("style")).id="svelte-1r8jgd4-style",t.textContent=".feather.svelte-1r8jgd4{position:absolute;top:0;left:-1.5em;color:#4300b0}div.lookup.svelte-1r8jgd4{margin-top:0.75em;color:#aaa}div.lookupItem.svelte-1r8jgd4{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}",N(Ys.head,t)),Se(this,e,ta,ea,A,{id:4,item:5,praefix:6,record:7,notifyList:8})}}function ra(e){let t,n,r;return n=new dt({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather2 svelte-9up2nn")},m(e,i){R(e,t,i),Ae(n,t,null),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function ia(e){let t,n,r,i,o;return n=new dt({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather pointer svelte-9up2nn")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[9]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function oa(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=[ia,ra],l=[];function c(e,t){return e[7]?0:1}return i=c(e),o=l[i]=a[i](e),{c(){t=O("div"),Ee(n.$$.fragment),r=B(),o.c(),z(t,"position","relative")},m(e,o){R(e,t,o),Ae(n,t,null),N(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):(pe(),ye(l[d],1,1,(()=>{l[d]=null})),ge(),o=l[i],o?o.p(e,r):(o=l[i]=a[i](e),o.c()),we(o,1),o.m(t,null))},i(e){s||(we(n.$$.fragment,e),we(o),s=!0)},o(e){ye(n.$$.fragment,e),ye(o),s=!1},d(e){e&&D(t),be(n),l[i].d()}}}function sa(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:h}=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,h=e.value)},[i,o,s,a,l,d,u,h,r,async()=>{if(!h)return;let e=h;e.includes("//")||(e="//"+e),window.open(e,"_blank")},function(t){Q(e,t)}]}class aa extends Te{constructor(e){var t;super(),document.getElementById("svelte-9up2nn-style")||((t=O("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}",N(document.head,t)),Se(this,e,sa,oa,A,{inputClass:0,disabled:1,formnovalidate:2,readonly:3,required:4,id:5,name:6,value:7})}}function la(e){let t,n,r;return n=new Ct({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather2 svelte-9up2nn")},m(e,i){R(e,t,i),Ae(n,t,null),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function ca(e){let t,n,r,i,o;return n=new Ct({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather pointer svelte-9up2nn")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[11]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function da(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[12]);const a=[ca,la],l=[];function c(e,t){return e[9]?0:1}return i=c(e),o=l[i]=a[i](e),{c(){t=O("div"),Ee(n.$$.fragment),r=B(),o.c(),z(t,"position","relative")},m(e,o){R(e,t,o),Ae(n,t,null),N(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):(pe(),ye(l[d],1,1,(()=>{l[d]=null})),ge(),o=l[i],o?o.p(e,r):(o=l[i]=a[i](e),o.c()),we(o,1),o.m(t,null))},i(e){s||(we(n.$$.fragment,e),we(o),s=!0)},o(e){ye(n.$$.fragment,e),ye(o),s=!1},d(e){e&&D(t),be(n),l[i].d()}}}function ua(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:h}=t,{pattern:f}=t,{placeholder:m}=t;f||="(\\+(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})$",m||="+41 58 234 56 78";return e.$$set=e=>{"inputClass"in e&&n(2,i=e.inputClass),"disabled"in e&&n(3,o=e.disabled),"formnovalidate"in e&&n(4,s=e.formnovalidate),"readonly"in e&&n(5,a=e.readonly),"required"in e&&n(6,l=e.required),"id"in e&&n(7,d=e.id),"name"in e&&n(8,u=e.name),"value"in e&&n(9,h=e.value),"pattern"in e&&n(0,f=e.pattern),"placeholder"in e&&n(1,m=e.placeholder)},[f,m,i,o,s,a,l,d,u,h,r,async()=>{if(!h)return;let e="tel:"+h;window.open(e,"_self")},function(t){Q(e,t)}]}class ha extends Te{constructor(e){var t;super(),document.getElementById("svelte-9up2nn-style")||((t=O("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}",N(document.head,t)),Se(this,e,ua,da,A,{inputClass:2,disabled:3,formnovalidate:4,readonly:5,required:6,id:7,name:8,value:9,pattern:0,placeholder:1})}}function fa(e){let t,n,r;return n=new gt({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather2 svelte-9up2nn")},m(e,i){R(e,t,i),Ae(n,t,null),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function ma(e){let t,n,r,i,o;return n=new gt({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather pointer svelte-9up2nn")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[12]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function pa(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=[ma,fa],l=[];function c(e,t){return e[7]?0:1}return i=c(e),o=l[i]=a[i](e),{c(){t=O("div"),Ee(n.$$.fragment),r=B(),o.c(),z(t,"position","relative")},m(e,o){R(e,t,o),Ae(n,t,null),N(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):(pe(),ye(l[d],1,1,(()=>{l[d]=null})),ge(),o=l[i],o?o.p(e,r):(o=l[i]=a[i](e),o.c()),we(o,1),o.m(t,null))},i(e){s||(we(n.$$.fragment,e),we(o),s=!0)},o(e){ye(n.$$.fragment,e),ye(o),s=!1},d(e){e&&D(t),be(n),l[i].d()}}}function ga(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:h}=t,{multiple:f}=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,h=e.value),"multiple"in e&&n(8,f=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,h,f,m,p,r,async()=>{if(!h)return;let e="mailto:"+h;window.open(e,"_self")},function(t){Q(e,t)}]}class wa extends Te{constructor(e){var t;super(),document.getElementById("svelte-9up2nn-style")||((t=O("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}",N(document.head,t)),Se(this,e,ga,pa,A,{inputClass:0,disabled:1,formnovalidate:2,readonly:3,required:4,id:5,name:6,value:7,multiple:8,pattern:9,placeholder:10})}}const ya=["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 va(e){let t;return{c(){t=O("textarea"),U(t,"id",e[0]),z(t,"visibility","hidden")},m(n,r){R(n,t,r),e[19](t)},p(e,n){1&n&&U(t,"id",e[0])},d(n){n&&D(t),e[19](null)}}}function _a(e){let t;return{c(){t=O("div"),U(t,"id",e[0])},m(n,r){R(n,t,r),e[18](t)},p(e,n){1&n&&U(t,"id",e[0])},d(n){n&&D(t),e[18](null)}}}function Ia(e){let t;function n(e,t){return e[1]?_a:va}let r=n(e),i=r(e);return{c(){t=O("div"),i.c(),U(t,"class",e[2])},m(n,r){R(n,t,r),i.m(t,null),e[20](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&&U(t,"class",e[2])},i:_,o:_,d(n){n&&D(t),i.d(),e[20](null)}}}const Ca=e=>e+"_"+Math.floor(1e9*Math.random())+String(Date.now());let $a=(()=>{let e={listeners:[],scriptId:Ca("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 Ea(e,t,n){var r;let i,o,s,{id:a=Ca("tinymce-svelte")}=t,{inline:l}=t,{disabled:c=!1}=t,{apiKey:d="no-api-key"}=t,{licenseKey:u}=t,{channel:h="7"}=t,{scriptSrc:f}=t,{conf:m={}}=t,{modelEvents:p="change input undo redo"}=t,{value:g=""}=t,{text:w=""}=t,{cssClass:y="tinymce-wrapper"}=t,v=g,_=c;const I=K(),C=()=>{const e="undefined"!=typeof window?window:global;return e&&e.tinymce?e.tinymce:null},$=()=>{const e=Object.assign(Object.assign({},m),{target:o,inline:void 0!==l?l:void 0!==m.inline&&m.inline,readonly:c,license_key:u,setup:e=>{n(15,s=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)=>{ya.forEach((n=>{e.on(n,(r=>{t(n.toLowerCase(),{eventName:n,event:r,editor:e})}))}))})(e,I),"function"==typeof m.setup&&m.setup(e)}});n(4,o.style.visibility="",o),C().init(e)};return Y((()=>{if(null!==C())$();else{const e=f||`https://cdn.tiny.cloud/1/${d}/tinymce/${h}/tinymce.min.js`;$a.load(i.ownerDocument,e,(()=>{$()}))}})),Z((()=>{var e;s&&(null===(e=C())||void 0===e||e.remove(s))})),e.$$set=e=>{"id"in e&&n(0,a=e.id),"inline"in e&&n(1,l=e.inline),"disabled"in e&&n(7,c=e.disabled),"apiKey"in e&&n(8,d=e.apiKey),"licenseKey"in e&&n(9,u=e.licenseKey),"channel"in e&&n(10,h=e.channel),"scriptSrc"in e&&n(11,f=e.scriptSrc),"conf"in e&&n(12,m=e.conf),"modelEvents"in e&&n(13,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=()=>{245920&e.$$.dirty&&(s&&v!==g&&(s.setContent(g),n(6,w=s.getContent({format:"text"}))),s&&c!==_&&(n(17,_=c),"function"==typeof(null===n(14,r=s.mode)||void 0===r?void 0:r.set)?s.mode.set(c?"readonly":"design"):s.setMode(c?"readonly":"design")))},[a,l,y,i,o,g,w,c,d,u,h,f,m,p,r,s,v,_,function(e){ee[e?"unshift":"push"]((()=>{o=e,n(4,o)}))},function(e){ee[e?"unshift":"push"]((()=>{o=e,n(4,o)}))},function(e){ee[e?"unshift":"push"]((()=>{i=e,n(3,i)}))}]}class Aa extends Te{constructor(e){super(),Se(this,e,Ea,Ia,A,{id:0,inline:1,disabled:7,apiKey:8,licenseKey:9,channel:10,scriptSrc:11,conf:12,modelEvents:13,value:5,text:6,cssClass:2})}}function ba(e){let t,n,r,i,o,s,a;function l(t){e[9](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 Aa({props:c}),ee.push((()=>$e(n,"value",l))),{c(){t=O("div"),Ee(n.$$.fragment),i=B(),o=O("input"),U(o,"class",s=e[1]||e[2]),U(o,"id",e[3]),U(o,"name",e[3]),o.value=e[0],o.hidden=!0,z(t,"min-height","10em"),z(t,"margin-top","-1em")},m(e,r){R(e,t,r),Ae(n,t,null),N(t,i),N(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],le((()=>r=!1))),n.$set(i),(!a||6&t&&s!==(s=e[1]||e[2]))&&U(o,"class",s),(!a||8&t)&&U(o,"id",e[3]),(!a||8&t)&&U(o,"name",e[3]),(!a||1&t&&o.value!==e[0])&&(o.value=e[0])},i(e){a||(we(n.$$.fragment,e),a=!0)},o(e){ye(n.$$.fragment,e),a=!1},d(e){e&&D(t),be(n)}}}function Sa(e){let t,n,r=e[6]&&ba(e);return{c(){r&&r.c(),t=P()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,[n]){e[6]?r?(r.p(e,n),64&n&&we(r,1)):(r=ba(e),r.c(),we(r,1),r.m(t.parentNode,t)):r&&(pe(),ye(r,1,1,(()=>{r=null})),ge())},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function Ta(e,t,r){const i=K();let o=JSON.parse(n.getItem("Locale")).id;o=o.startsWith("fr")?"fr_FR":o.split("-")[0];let s,{value:a=""}=t,{noForm:l}=t,{classId:c}=t,{id:d}=t,{record:u}=t,{disabled:h}=t,{readonly:f}=t;const m=(e,t)=>{if(!s)return;if(!e)return;if(!e.includes("{{"))return;const n=t.employee;if(n)try{ph("employee",n).then((t=>{if(!t)return;const n=e.replace("{{employee.firstName}}",t.firstName).replace("{{employee.lastName}}",t.lastName);i("blur",{value:n})}))}catch(e){}},p={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:o};return Y((()=>setTimeout((()=>{r(6,s=!0),m(a,u)}),300))),e.$$set=e=>{"value"in e&&r(0,a=e.value),"noForm"in e&&r(1,l=e.noForm),"classId"in e&&r(2,c=e.classId),"id"in e&&r(3,d=e.id),"record"in e&&r(8,u=e.record),"disabled"in e&&r(4,h=e.disabled),"readonly"in e&&r(5,f=e.readonly)},e.$$.update=()=>{257&e.$$.dirty&&(a||u)&&m(a,u)},[a,l,c,d,h,f,s,p,u,function(e){a=e,r(0,a)}]}class Na extends Te{constructor(e){var t;super(),document.getElementById("svelte-yi7lpi-style")||((t=O("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}",N(document.head,t)),Se(this,e,Ta,Sa,A,{value:0,noForm:1,classId:2,id:3,record:8,disabled:4,readonly: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,h;return{setters:[function(e){t=e.Request,n=e.Storage,r=e.task_notification,i=e.currentRoles,o=e.TextArea,s=e.toasts,a=e.settings,l=e.Page},function(e){c=e.getAttractions,d=e.PopOver},function(e){u=e.user},function(e){h=e.taskClipboard}],execute:function(){function f(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.30");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=>e?"(ja)":"(nein)",w=(e,t)=>{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]?g(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]&&g(t[e.name]),t[e.name])))).map((e=>e?.toString().split(" · ").filter((e=>!!e&&!y(e))).join(" · "))).filter((e=>!!e)).join(" • ")},y=e=>/^[0-9a-f]{24}/.test(e),v=(e,t)=>{try{return t.split(".").reduce(((e,t)=>e[t]),e)??""}catch{return""}};function _(){}function I(e){return e()}function C(){return Object.create(null)}function $(e){e.forEach(I)}function E(e){return"function"==typeof e}function A(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function b(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 S(e){return null==e?"":e}function T(e,t,n=t){return e.set(n),t}function N(e,t){e.appendChild(t)}function R(e,t,n){e.insertBefore(t,n||null)}function D(e){e.parentNode.removeChild(e)}function k(e,t){for(let n=0;n<e.length;n+=1)e[n]&&e[n].d(t)}function O(e){return document.createElement(e)}function x(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function M(e){return document.createTextNode(e)}function B(){return M(" ")}function P(){return M("")}function L(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function F(e){return function(t){return t.preventDefault(),e.call(this,t)}}function V(e){return function(t){return t.stopPropagation(),e.call(this,t)}}function U(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 W(e,t){e.value=null==t?"":t}function z(e,t,n,r){e.style.setProperty(t,n,r?"important":"")}function q(e,t,n){e.classList[n?"add":"remove"](t)}let j;function G(e){j=e}function X(){if(!j)throw new Error("Function called outside component initialization");return j}function Y(e){X().$$.on_mount.push(e)}function Z(e){X().$$.on_destroy.push(e)}function K(){const e=X();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 Q(e,t){const n=e.$$.callbacks[t.type];n&&n.slice().forEach((e=>e(t)))}const J=[],ee=[],te=[],ne=[],re=Promise.resolve();let ie=!1;function oe(){ie||(ie=!0,re.then(ue))}function se(){return oe(),re}function ae(e){te.push(e)}function le(e){ne.push(e)}let ce=!1;const de=new Set;function ue(){if(!ce){ce=!0;do{for(let e=0;e<J.length;e+=1){const t=J[e];G(t),he(t.$$)}for(G(null),J.length=0;ee.length;)ee.pop()();for(let e=0;e<te.length;e+=1){const t=te[e];de.has(t)||(de.add(t),t())}te.length=0}while(J.length);for(;ne.length;)ne.pop()();ie=!1,ce=!1,de.clear()}}function he(e){if(null!==e.fragment){e.update(),$(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(ae)}}const fe=new Set;let me;function pe(){me={r:0,c:[],p:me}}function ge(){me.r||$(me.c),me=me.p}function we(e,t){e&&e.i&&(fe.delete(e),e.i(t))}function ye(e,t,n,r){if(e&&e.o){if(fe.has(e))return;fe.add(e),me&&me.c.push((()=>{fe.delete(e),r&&(n&&e.d(1),r())})),e.o(t)}}function ve(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&&(pe(),ye(e,1,1,(()=>{t.blocks[n]===e&&(t.blocks[n]=null)})),ge())})):t.block.d(1),a.c(),we(a,1),a.m(t.mount(),t.anchor),l=!0),t.block=a,t.blocks&&(t.blocks[r]=a),l&&ue()}if((i=e)&&"object"==typeof i&&"function"==typeof i.then){const n=X();if(e.then((e=>{G(n),r(t.then,1,t.value,e),G(null)}),(e=>{if(G(n),r(t.catch,2,t.error,e),G(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 _e(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 Ie="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:global;function Ce(e,t){ye(e,1,1,(()=>{t.delete(e.key)}))}function $e(e,t,n){const r=e.$$.props[t];void 0!==r&&(e.$$.bound[r]=n,n(e.$$.ctx[r]))}function Ee(e){e&&e.c()}function Ae(e,t,n,r){const{fragment:i,on_mount:o,on_destroy:s,after_update:a}=e.$$;i&&i.m(t,n),r||ae((()=>{const t=o.map(I).filter(E);s?s.push(...t):$(t),e.$$.on_mount=[]})),a.forEach(ae)}function be(e,t){const n=e.$$;null!==n.fragment&&($(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function Se(e,t,n,r,i,o,s=[-1]){const a=j;G(e);const l=e.$$={fragment:null,ctx:null,props:o,update:_,not_equal:i,bound:C(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(a?a.$$.context:t.context||[]),callbacks:C(),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]&&(J.push(e),oe(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}(e,t)),n})):[],l.update(),c=!0,$(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(D)}else l.fragment&&l.fragment.c();t.intro&&we(e.$$.fragment),Ae(e,t.target,t.anchor,t.customElement),ue()}G(a)}class Te{$destroy(){be(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 Ne(e){let t,n,r,i;return{c(){t=x("svg"),n=x("path"),r=x("polygon"),U(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"),U(r,"points","12 15 17 21 7 21 12 15"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",i="feather feather-airplay "+e[2])},m(e,i){R(e,t,i),N(t,n),N(t,r)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-airplay "+e[2])&&U(t,"class",i)},i:_,o:_,d(e){e&&D(t)}}}function Re(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 De extends Te{constructor(e){super(),Se(this,e,Re,Ne,A,{size:0,strokeWidth:1,class:2})}}function ke(e){let t,n,r,i,o;return{c(){t=x("svg"),n=x("path"),r=x("line"),i=x("line"),U(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"),U(r,"x1","12"),U(r,"y1","9"),U(r,"x2","12"),U(r,"y2","13"),U(i,"x1","12"),U(i,"y1","17"),U(i,"x2","12.01"),U(i,"y2","17"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",o="feather feather-alert-triangle "+e[2])},m(e,o){R(e,t,o),N(t,n),N(t,r),N(t,i)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-alert-triangle "+e[2])&&U(t,"class",o)},i:_,o:_,d(e){e&&D(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 xe extends Te{constructor(e){super(),Se(this,e,Oe,ke,A,{size:0,strokeWidth:1,class:2})}}function Me(e){let t,n,r,i,o;return{c(){t=x("svg"),n=x("circle"),r=x("polyline"),i=x("line"),U(n,"cx","12"),U(n,"cy","12"),U(n,"r","10"),U(r,"points","8 12 12 16 16 12"),U(i,"x1","12"),U(i,"y1","8"),U(i,"x2","12"),U(i,"y2","16"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",o="feather feather-arrow-down-circle "+e[2])},m(e,o){R(e,t,o),N(t,n),N(t,r),N(t,i)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-arrow-down-circle "+e[2])&&U(t,"class",o)},i:_,o:_,d(e){e&&D(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 Pe extends Te{constructor(e){super(),Se(this,e,Be,Me,A,{size:0,strokeWidth:1,class:2})}}function Le(e){let t,n,r,i;return{c(){t=x("svg"),n=x("path"),r=x("path"),U(n,"d","M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"),U(r,"d","M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",i="feather feather-book-open "+e[2])},m(e,i){R(e,t,i),N(t,n),N(t,r)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-book-open "+e[2])&&U(t,"class",i)},i:_,o:_,d(e){e&&D(t)}}}function Fe(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 Ve extends Te{constructor(e){super(),Se(this,e,Fe,Le,A,{size:0,strokeWidth:1,class:2})}}function Ue(e){let t,n,r,i;return{c(){t=x("svg"),n=x("path"),r=x("circle"),U(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"),U(r,"cx","12"),U(r,"cy","13"),U(r,"r","4"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",i="feather feather-camera "+e[2])},m(e,i){R(e,t,i),N(t,n),N(t,r)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-camera "+e[2])&&U(t,"class",i)},i:_,o:_,d(e){e&&D(t)}}}function He(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 We extends Te{constructor(e){super(),Se(this,e,He,Ue,A,{size:0,strokeWidth:1,class:2})}}function ze(e){let t,n,r,i;return{c(){t=x("svg"),n=x("path"),r=x("polyline"),U(n,"d","M22 11.08V12a10 10 0 1 1-5.93-9.14"),U(r,"points","22 4 12 14.01 9 11.01"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",i="feather feather-check-circle "+e[2])},m(e,i){R(e,t,i),N(t,n),N(t,r)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-check-circle "+e[2])&&U(t,"class",i)},i:_,o:_,d(e){e&&D(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 Te{constructor(e){super(),Se(this,e,qe,ze,A,{size:0,strokeWidth:1,class:2})}}function Ge(e){let t,n,r;return{c(){t=x("svg"),n=x("path"),U(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"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",r="feather feather-command "+e[2])},m(e,r){R(e,t,r),N(t,n)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&r!==(r="feather feather-command "+e[2])&&U(t,"class",r)},i:_,o:_,d(e){e&&D(t)}}}function Xe(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 Ye extends Te{constructor(e){super(),Se(this,e,Xe,Ge,A,{size:0,strokeWidth:1,class:2})}}function Ze(e){let t,n,r,i;return{c(){t=x("svg"),n=x("polyline"),r=x("path"),U(n,"points","9 10 4 15 9 20"),U(r,"d","M20 4v7a4 4 0 0 1-4 4H4"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",i="feather feather-corner-down-left "+e[2])},m(e,i){R(e,t,i),N(t,n),N(t,r)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-corner-down-left "+e[2])&&U(t,"class",i)},i:_,o:_,d(e){e&&D(t)}}}function Ke(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 Qe extends Te{constructor(e){super(),Se(this,e,Ke,Ze,A,{size:0,strokeWidth:1,class:2})}}function Je(e){let t,n,r,i,o;return{c(){t=x("svg"),n=x("path"),r=x("line"),i=x("line"),U(n,"d","M21 4H8l-7 8 7 8h13a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2z"),U(r,"x1","18"),U(r,"y1","9"),U(r,"x2","12"),U(r,"y2","15"),U(i,"x1","12"),U(i,"y1","9"),U(i,"x2","18"),U(i,"y2","15"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",o="feather feather-delete "+e[2])},m(e,o){R(e,t,o),N(t,n),N(t,r),N(t,i)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-delete "+e[2])&&U(t,"class",o)},i:_,o:_,d(e){e&&D(t)}}}function et(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 Te{constructor(e){super(),Se(this,e,et,Je,A,{size:0,strokeWidth:1,class:2})}}function nt(e){let t,n,r,i,o;return{c(){t=x("svg"),n=x("path"),r=x("polyline"),i=x("line"),U(n,"d","M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"),U(r,"points","15 3 21 3 21 9"),U(i,"x1","10"),U(i,"y1","14"),U(i,"x2","21"),U(i,"y2","3"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",o="feather feather-external-link "+e[2])},m(e,o){R(e,t,o),N(t,n),N(t,r),N(t,i)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-external-link "+e[2])&&U(t,"class",o)},i:_,o:_,d(e){e&&D(t)}}}function rt(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 it extends Te{constructor(e){super(),Se(this,e,rt,nt,A,{size:0,strokeWidth:1,class:2})}}function ot(e){let t,n,r,i,o,s;return{c(){t=x("svg"),n=x("path"),r=x("polyline"),i=x("line"),o=x("line"),U(n,"d","M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"),U(r,"points","14 2 14 8 20 8"),U(i,"x1","12"),U(i,"y1","18"),U(i,"x2","12"),U(i,"y2","12"),U(o,"x1","9"),U(o,"y1","15"),U(o,"x2","15"),U(o,"y2","15"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",s="feather feather-file-plus "+e[2])},m(e,s){R(e,t,s),N(t,n),N(t,r),N(t,i),N(t,o)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&s!==(s="feather feather-file-plus "+e[2])&&U(t,"class",s)},i:_,o:_,d(e){e&&D(t)}}}function st(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 at extends Te{constructor(e){super(),Se(this,e,st,ot,A,{size:0,strokeWidth:1,class:2})}}function lt(e){let t,n,r,i,o;return{c(){t=x("svg"),n=x("circle"),r=x("line"),i=x("path"),U(n,"cx","12"),U(n,"cy","12"),U(n,"r","10"),U(r,"x1","2"),U(r,"y1","12"),U(r,"x2","22"),U(r,"y2","12"),U(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"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",o="feather feather-globe "+e[2])},m(e,o){R(e,t,o),N(t,n),N(t,r),N(t,i)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-globe "+e[2])&&U(t,"class",o)},i:_,o:_,d(e){e&&D(t)}}}function ct(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 dt extends Te{constructor(e){super(),Se(this,e,ct,lt,A,{size:0,strokeWidth:1,class:2})}}function ut(e){let t,n,r,i,o,s,a,l;return{c(){t=x("svg"),n=x("line"),r=x("line"),i=x("line"),o=x("line"),s=x("line"),a=x("line"),U(n,"x1","8"),U(n,"y1","6"),U(n,"x2","21"),U(n,"y2","6"),U(r,"x1","8"),U(r,"y1","12"),U(r,"x2","21"),U(r,"y2","12"),U(i,"x1","8"),U(i,"y1","18"),U(i,"x2","21"),U(i,"y2","18"),U(o,"x1","3"),U(o,"y1","6"),U(o,"x2","3.01"),U(o,"y2","6"),U(s,"x1","3"),U(s,"y1","12"),U(s,"x2","3.01"),U(s,"y2","12"),U(a,"x1","3"),U(a,"y1","18"),U(a,"x2","3.01"),U(a,"y2","18"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",l="feather feather-list "+e[2])},m(e,l){R(e,t,l),N(t,n),N(t,r),N(t,i),N(t,o),N(t,s),N(t,a)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&l!==(l="feather feather-list "+e[2])&&U(t,"class",l)},i:_,o:_,d(e){e&&D(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 ft extends Te{constructor(e){super(),Se(this,e,ht,ut,A,{size:0,strokeWidth:1,class:2})}}function mt(e){let t,n,r,i;return{c(){t=x("svg"),n=x("path"),r=x("polyline"),U(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"),U(r,"points","22,6 12,13 2,6"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",i="feather feather-mail "+e[2])},m(e,i){R(e,t,i),N(t,n),N(t,r)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-mail "+e[2])&&U(t,"class",i)},i:_,o:_,d(e){e&&D(t)}}}function pt(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 gt extends Te{constructor(e){super(),Se(this,e,pt,mt,A,{size:0,strokeWidth:1,class:2})}}function wt(e){let t,n,r,i;return{c(){t=x("svg"),n=x("path"),r=x("circle"),U(n,"d","M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"),U(r,"cx","12"),U(r,"cy","10"),U(r,"r","3"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",i="feather feather-map-pin "+e[2])},m(e,i){R(e,t,i),N(t,n),N(t,r)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-map-pin "+e[2])&&U(t,"class",i)},i:_,o:_,d(e){e&&D(t)}}}function yt(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 vt extends Te{constructor(e){super(),Se(this,e,yt,wt,A,{size:0,strokeWidth:1,class:2})}}function _t(e){let t,n,r,i,o;return{c(){t=x("svg"),n=x("polyline"),r=x("line"),i=x("path"),U(n,"points","23 7 23 1 17 1"),U(r,"x1","16"),U(r,"y1","8"),U(r,"x2","23"),U(r,"y2","1"),U(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"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",o="feather feather-phone-outgoing "+e[2])},m(e,o){R(e,t,o),N(t,n),N(t,r),N(t,i)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-phone-outgoing "+e[2])&&U(t,"class",o)},i:_,o:_,d(e){e&&D(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 Ct extends Te{constructor(e){super(),Se(this,e,It,_t,A,{size:0,strokeWidth:1,class:2})}}function $t(e){let t,n,r,i,o;return{c(){t=x("svg"),n=x("polyline"),r=x("path"),i=x("rect"),U(n,"points","6 9 6 2 18 2 18 9"),U(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"),U(i,"x","6"),U(i,"y","14"),U(i,"width","12"),U(i,"height","8"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",o="feather feather-printer "+e[2])},m(e,o){R(e,t,o),N(t,n),N(t,r),N(t,i)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-printer "+e[2])&&U(t,"class",o)},i:_,o:_,d(e){e&&D(t)}}}function Et(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 At extends Te{constructor(e){super(),Se(this,e,Et,$t,A,{size:0,strokeWidth:1,class:2})}}function bt(e){let t,n,r,i;return{c(){t=x("svg"),n=x("circle"),r=x("line"),U(n,"cx","11"),U(n,"cy","11"),U(n,"r","8"),U(r,"x1","21"),U(r,"y1","21"),U(r,"x2","16.65"),U(r,"y2","16.65"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",i="feather feather-search "+e[2])},m(e,i){R(e,t,i),N(t,n),N(t,r)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-search "+e[2])&&U(t,"class",i)},i:_,o:_,d(e){e&&D(t)}}}function St(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 Te{constructor(e){super(),Se(this,e,St,bt,A,{size:0,strokeWidth:1,class:2})}}const{document:Nt}=Ie;function Rt(e){e[49]=e[50].items}function Dt(e,t,n){const r=e.slice();return r[51]=t[n],r[53]=n,r}function kt(e,t,n){const r=e.slice();return r[54]=t[n],r}function Ot(e,t,n){const r=e.slice();return r[54]=t[n],r}function xt(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Mt(e){let t,n,r,i,o,s;Rt(e);let a=e[5]?.length&&Bt(e),l=e[49]?.length&&Lt(e),c=e[5]?.length&&Ut(e);return{c(){a&&a.c(),t=B(),n=O("div"),r=O("table"),l&&l.c(),i=B(),o=O("tbody"),c&&c.c(),U(r,"striped",""),U(r,"class","svelte-47aais"),U(n,"class","eList svelte-47aais")},m(e,d){a&&a.m(e,d),R(e,t,d),R(e,n,d),N(n,r),l&&l.m(r,null),N(r,i),N(r,o),c&&c.m(o,null),s=!0},p(e,n){Rt(e),e[5]?.length?a?(a.p(e,n),32&n[0]&&we(a,1)):(a=Bt(e),a.c(),we(a,1),a.m(t.parentNode,t)):a&&(pe(),ye(a,1,1,(()=>{a=null})),ge()),e[49]?.length?l?l.p(e,n):(l=Lt(e),l.c(),l.m(r,i)):l&&(l.d(1),l=null),e[5]?.length?c?(c.p(e,n),32&n[0]&&we(c,1)):(c=Ut(e),c.c(),we(c,1),c.m(o,null)):c&&(pe(),ye(c,1,1,(()=>{c=null})),ge())},i(e){s||(we(a),we(c),s=!0)},o(e){ye(a),ye(c),s=!1},d(e){a&&a.d(e),e&&D(t),e&&D(n),l&&l.d(),c&&c.d()}}}function Bt(e){let t,n,r,i,o,s,a,l,c,d,u,h=e[6]&&Pt(e);function f(t){e[33](t)}let m={id:e[10]};return void 0!==e[3]&&(m.value=e[3]),i=new e[8]({props:m}),ee.push((()=>$e(i,"value",f))),i.$on("input",e[14]),l=new tt({props:{size:"18"}}),{c(){h&&h.c(),t=B(),n=O("div"),r=M("Suchen: "),Ee(i.$$.fragment),s=B(),a=O("span"),Ee(l.$$.fragment),U(a,"class","feather pointer svelte-47aais"),z(n,"margin-bottom","1em"),z(n,"position","relative")},m(o,f){h&&h.m(o,f),R(o,t,f),R(o,n,f),N(n,r),Ae(i,n,null),N(n,s),N(n,a),Ae(l,a,null),c=!0,d||(u=L(a,"click",e[16]),d=!0)},p(e,n){e[6]?h?64&n[0]&&we(h,1):(h=Pt(e),h.c(),we(h,1),h.m(t.parentNode,t)):h&&(pe(),ye(h,1,1,(()=>{h=null})),ge());const r={};!o&&8&n[0]&&(o=!0,r.value=e[3],le((()=>o=!1))),i.$set(r)},i(e){c||(we(h),we(i.$$.fragment,e),we(l.$$.fragment,e),c=!0)},o(e){ye(h),ye(i.$$.fragment,e),ye(l.$$.fragment,e),c=!1},d(e){h&&h.d(e),e&&D(t),e&&D(n),be(i),be(l),d=!1,u()}}}function Pt(e){let t,n;return t=new e[7]({}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Lt(e){let t,n,r,i=e[4]&&e[0]&&Ft(),o=e[49],s=[];for(let t=0;t<o.length;t+=1)s[t]=Vt(Ot(e,o,t));return{c(){t=O("thead"),n=O("tr"),i&&i.c(),r=B();for(let e=0;e<s.length;e+=1)s[e].c();U(n,"class","svelte-47aais"),U(t,"class","svelte-47aais")},m(e,o){R(e,t,o),N(t,n),i&&i.m(n,null),N(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=Ft(),i.c(),i.m(n,r)):i&&(i.d(1),i=null),8196&t[0]){let r;for(o=e[49],r=0;r<o.length;r+=1){const i=Ot(e,o,r);s[r]?s[r].p(i,t):(s[r]=Vt(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&&D(t),i&&i.d(),k(s,e)}}}function Ft(e){let t;return{c(){t=O("th"),U(t,"class","svelte-47aais")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Vt(e){let t,n,r=e[54]?.designation+"";return{c(){t=O("th"),n=M(r),U(t,"class","svelte-47aais")},m(e,r){R(e,t,r),N(t,n)},p(e,t){4&t[0]&&r!==(r=e[54]?.designation+"")&&H(n,r)},d(e){e&&D(t)}}}function Ut(e){let t,n,r=[],i=new Map,o=e[5];const s=e=>e[51]?._id;for(let t=0;t<o.length;t+=1){let n=Dt(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=P()},m(e,i){for(let t=0;t<r.length;t+=1)r[t].m(e,i);R(e,t,i),n=!0},p(e,n){178239&n[0]&&(o=e[5],pe(),r=function(e,t,n,r,i,o,s,a,l,c,d,u){let h=e.length,f=o.length,m=h;const p={};for(;m--;)p[e[m].key]=m;const g=[],w=new Map,y=new Map;for(m=f;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){we(e,1),e.m(a,d),s.set(e.key,e),d=e.first,f--}for(;h&&f;){const t=g[f-1],n=e[h-1],r=t.key,i=n.key;t===n?(d=t.first,h--,f--):w.has(i)?!s.has(r)||v.has(r)?I(t):_.has(i)?h--:y.get(r)>y.get(i)?(_.add(r),I(t)):(v.add(i),h--):(l(n,s),h--)}for(;h--;){const t=e[h];w.has(t.key)||l(t,s)}for(;f;)I(g[f-1]);return g}(r,n,s,1,e,o,i,t.parentNode,Ce,qt,t,Dt),ge())},i(e){if(!n){for(let e=0;e<o.length;e+=1)we(r[e]);n=!0}},o(e){for(let e=0;e<r.length;e+=1)ye(r[e]);n=!1},d(e){for(let t=0;t<r.length;t+=1)r[t].d(e);e&&D(t)}}}function Ht(e){let t,n,r,i,o,s,a=e[4]&&e[0]&&Wt(e),l=e[49],c=[];for(let t=0;t<l.length;t+=1)c[t]=zt(kt(e,l,t));return{c(){t=O("tr"),a&&a.c(),n=B();for(let e=0;e<c.length;e+=1)c[e].c();r=B(),U(t,"class","pointer svelte-47aais"),q(t,"active",e[51]._id===e[1]),q(t,"blocked",!!e[51].blocked),q(t,"undeliverable",!!e[51].undeliverable)},m(l,d){R(l,t,d),a&&a.m(t,null),N(t,n);for(let e=0;e<c.length;e+=1)c[e].m(t,null);N(t,r),i=!0,o||(s=L(t,"click",V((function(){E(e[12](e[51],e[53]))&&e[12](e[51],e[53]).apply(this,arguments)}))),o=!0)},p(i,o){if((e=i)[4]&&e[0]?a?(a.p(e,o),17&o[0]&&we(a,1)):(a=Wt(e),a.c(),we(a,1),a.m(t,n)):a&&(pe(),ye(a,1,1,(()=>{a=null})),ge()),10276&o[0]){let n;for(l=e[49],n=0;n<l.length;n+=1){const i=kt(e,l,n);c[n]?c[n].p(i,o):(c[n]=zt(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]&&q(t,"active",e[51]._id===e[1]),32&o[0]&&q(t,"blocked",!!e[51].blocked),32&o[0]&&q(t,"undeliverable",!!e[51].undeliverable)},i(e){i||(we(a),i=!0)},o(e){ye(a),i=!1},d(e){e&&D(t),a&&a.d(),k(c,e),o=!1,s()}}}function Wt(e){let t,n,r,i,o;return n=new it({props:{size:"18"}}),{c(){t=O("td"),Ee(n.$$.fragment),U(t,"class","editRow svelte-47aais"),z(t,"color","#326173")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",V((function(){E(e[17](e[51]))&&e[17](e[51]).apply(this,arguments)}))),i=!0)},p(t,n){e=t},i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function zt(e){let t,n,r,i=e[11](e[51],e[54])+"";return{c(){t=O("td"),n=M(i),U(t,"class",r=S(e[54].type)+" svelte-47aais")},m(e,r){R(e,t,r),N(t,n)},p(e,o){36&o[0]&&i!==(i=e[11](e[51],e[54])+"")&&H(n,i),4&o[0]&&r!==(r=S(e[54].type)+" svelte-47aais")&&U(t,"class",r)},d(e){e&&D(t)}}}function qt(e,t){let n,r,i,o=t[15](t[51],t[49],t[3]),s=o&&Ht(t);return{key:e,first:null,c(){n=P(),s&&s.c(),r=P(),this.first=n},m(e,t){R(e,n,t),s&&s.m(e,t),R(e,r,t),i=!0},p(e,n){t=e,44&n[0]&&(o=t[15](t[51],t[49],t[3])),o?s?(s.p(t,n),44&n[0]&&we(s,1)):(s=Ht(t),s.c(),we(s,1),s.m(r.parentNode,r)):s&&(pe(),ye(s,1,1,(()=>{s=null})),ge())},i(e){i||(we(s),i=!0)},o(e){ye(s),i=!1},d(e){e&&D(n),s&&s.d(e),e&&D(r)}}}function jt(e){let t,n;return t=new e[7]({}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p:_,i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Gt(e){let t,n,r,i={ctx:e,current:null,token:null,hasCatch:!1,pending:jt,then:Mt,catch:xt,value:50,blocks:[,,,]};return ve(n=e[2]&&e[13](),i),{c(){t=P(),i.block.c()},m(e,n){R(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[13]())&&ve(n,i)||_e(i,e,r)},i(e){r||(we(i.block),r=!0)},o(e){for(let e=0;e<3;e+=1){ye(i.blocks[e])}r=!1},d(e){e&&D(t),i.block.d(e),i.token=null,i=null}}}const Xt=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)))),a||(a=n.items.find((t=>t.name===e))),!a){const n=(await t.getSchemaByClass(e)).items.find((e=>e.name===s));n&&(a={name:e,designation:n.designation,type:n.type,decimals:n.properties?.decimals||0})}i.find((t=>t?.name===e))||i.push(a)}return i.length?i:n.items}));function Yt(e,i,o){let s;let a=JSON.parse(n.getItem("Locale")).id;const l=K(),{Loading:d,TextField:h}=c,{currentTasks:f}=u;b(e,f,(e=>o(37,s=e)));let p,w,y,v,{inputList:_}=i,{eventId:I}=i,{prevEventId:C}=i,{record:$}=i,{className:E}=i,{rowId:A}=i,{filterForReady:S=!1}=i,{filter:T}=i,{query:N}=i,{refStatus:R}=i,{showEdit:D=!1}=i,{praefix:k=""}=i,{selectionFields:O=!1}=i,{deList:x}=i,{stopAggregation:M=!1}=i,{shouldBlock:B}=i,{inputSearch:P=""}=i,L=!0,F=P,V=E+Math.floor(9e3*Math.random()+1e3).toString()+"search",U=!1,H=!0;const W=(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("_")){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(a,{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?g(n):m(e[`_${t.name}`]||n||"")},z=t.getSchemaByClass(E),q=async(e,n)=>{if(!e)return[];if(T){let n;const r=T.startsWith("!");r&&(n=T.replace("!",""));const i=T.startsWith("$");if(n&&!i&&(e=e.filter((e=>i?e[n]===A:r?!e[n]:!!e[n]))),i){n=T.replace("$","");const[r,i]=n.split(".");if($[i]){const n=await t.getSectionView(r,{[i]:$[i]});e=e.filter((e=>n.find((t=>t._id==e[r]))))}else e=[]}}if(R&&!N)return o(18,R=[].concat(R)),e.filter((e=>!!R.find((t=>e._task.status===t))));if("Information"===n.state.task)return e;if(C){const n=await t.getEvent(C);if("report"===n?.output?.type)return e;if(n?.input?.class?.length&&n.input.class[0].name===E)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))},j=(e,t)=>{if(e){let n,r="1";if("string"==typeof e)n=e;else{const t=Object.keys(e);n=t[0],r=t[1]}"date"===n&&(r="-1");const i=new Intl.Collator(a,{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},G=async e=>{let n,r=0;H=!1;const i=e=>new Promise((t=>setTimeout(t,e))),s=await z;for(;r++<200&&!M&&!(n=await X(e,s.id));)await i(500);o(6,U=!1),M&&t.readTasksByAggregationId(e,!0),n&&(o(5,y=j(w.displaySort,n.data)),window.setTimeout((()=>{const e=document.querySelector("tr.active");e&&e.scrollIntoView({block:"end",behavior:"smooth"}),H=!0}),100))},X=async(e,n)=>await t.readTasksByAggregationId(e,!1,n),Z=async(e,t,n,r)=>{const{value:i,refClass:o}=r,[s,a]=n.split("."),l=i?.get(k),c=l&&await fh(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 uh(o+r._id.toString(),r),r})):e};Y((()=>{window.setTimeout((()=>{const e=document.querySelector("tr.active");e?e.scrollIntoView({block:"end",behavior:"smooth"}):document.getElementById(V)?.focus()}),200)})),r.subscribe((async e=>{if(!e)return;const t=await z;e.eventId===t.id&&(mh(t.class,e.eventId),o(2,L=!o(2,L=!1)))}));return e.$$set=e=>{"inputList"in e&&o(20,_=e.inputList),"eventId"in e&&o(21,I=e.eventId),"prevEventId"in e&&o(22,C=e.prevEventId),"record"in e&&o(23,$=e.record),"className"in e&&o(24,E=e.className),"rowId"in e&&o(1,A=e.rowId),"filterForReady"in e&&o(25,S=e.filterForReady),"filter"in e&&o(26,T=e.filter),"query"in e&&o(27,N=e.query),"refStatus"in e&&o(18,R=e.refStatus),"showEdit"in e&&o(0,D=e.showEdit),"praefix"in e&&o(28,k=e.praefix),"selectionFields"in e&&o(29,O=e.selectionFields),"deList"in e&&o(30,x=e.deList),"stopAggregation"in e&&o(19,M=e.stopAggregation),"shouldBlock"in e&&o(31,B=e.shouldBlock),"inputSearch"in e&&o(32,P=e.inputSearch)},[D,A,L,F,p,y,U,d,h,f,V,W,(e,t)=>n=>{o(19,M=!0);const r=H?e:v[t];l("choose",{row:r})},async()=>{w=await z,o(4,p=(e=>!s?.length||!!s.find((t=>t===e)))(w.id)),N&&o(5,y=v=await t.getTasksFiltered(w.class,N)),y||o(5,y=v=j(w.displaySort,await _||await ch(w.class,w.id))),500!==y?.length||N||(o(6,U=!0),t.getTasksList(w.id,!1,!0).then((({aggregationId:e})=>G(e))));let e,n=!1,r="";const i=O&&O?.find((e=>w.class===e.refClass.split(":")[0])),a=i?.value?.get&&i.value.get(k);if(a){const[s,l]=i.refClass.split(":");w.class===s&&o(5,y=await Z(y,s,l,i)),n=i.parentClass?.find((e=>"quantity"===e.name)),r=i.className,e=await t.getCountedSection(r,l.split(".")[0],a,s,"quantity")}o(0,D&&=!i),!i&&(T||S||R)&&o(5,y=await q(y,w));const{display:c}=w;let d=await Xt(c,w,y);return!D&&n?(d=d.concat([{name:"quantity",designation:"h-Soll",type:"number",decimals:2},{name:"ist",designation:"h-Ist",type:"number",decimals:2}]),o(5,y=y.map((t=>{const n=e.find((e=>e._id===t._id));return n&&(t.ist=n.quantity.$numberDecimal),t}))),e.map((e=>{if(!y.find((t=>t._id===e._id))){const t=v.find((t=>t._id===e._id));t&&(t.ist=e.quantity.$numberDecimal),y.push(t)}})),l("init",y)):x&&o(5,y=y.filter((e=>!x.find((t=>t?._id===e._id))))),B&&o(5,y=y.filter((e=>!e[B]))),{items:d}},({detail:{value:e}})=>{o(3,F=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=W(e,i).toLowerCase();!r&&t.includes(n)&&(r=!0)}return r},()=>{o(3,F="")},async e=>{let t=e._task;t||(t=await dh(E,"",e._id,!0),t=t._task),window.open(`/task/${t.event}/${t.task_id||t._id}/task?view=standalone`,"_blank")},R,M,_,I,C,$,E,S,T,N,k,O,x,B,P,function(e){F=e,o(3,F)}]}class Zt extends Te{constructor(e){var t;super(),Nt.getElementById("svelte-47aais-style")||((t=O("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}",N(Nt.head,t)),Se(this,e,Yt,Gt,A,{inputList:20,eventId:21,prevEventId:22,record:23,className:24,rowId:1,filterForReady:25,filter:26,query:27,refStatus:18,showEdit:0,praefix:28,selectionFields:29,deList:30,stopAggregation:19,shouldBlock:31,inputSearch:32},[-1,-1])}}function Kt(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Qt(e){let t,n,r=e[45]&&Jt(e);return{c(){r&&r.c(),t=P()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,n){e[45]?r?(r.p(e,n),16&n[0]&&we(r,1)):(r=Jt(e),r.c(),we(r,1),r.m(t.parentNode,t)):r&&(pe(),ye(r,1,1,(()=>{r=null})),ge())},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function Jt(e){let t,n;return t=new e[25]({props:{title:e[20]?"Auswahl":e[0],class:"eList "+(e[18]?"form":""),$$slots:{default:[dn]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function en(e){let t,n;return t=new wh({props:{schema:e[2],recID:e[1],readonly:e[19]}}),t.$on("choose",(function(){E(e[34](e[45]))&&e[34](e[45]).apply(this,arguments)})),t.$on("back",e[31]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function tn(e){let t,n,r,i,o,s,a;t=new e[26]({props:{text:e[20]?"Zusätzliche Auswahl":""}});const l=[rn,nn],c=[];function d(e,t){return e[20]?0:1}return r=d(e),i=c[r]=l[r](e),s=new Zt({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(){Ee(t.$$.fragment),n=B(),i.c(),o=B(),Ee(s.$$.fragment)},m(e,i){Ae(t,e,i),R(e,n,i),c[r].m(e,i),R(e,o,i),Ae(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):(pe(),ye(c[u],1,1,(()=>{c[u]=null})),ge(),i=c[r],i?i.p(e,n):(i=c[r]=l[r](e),i.c()),we(i,1),i.m(o.parentNode,o));const h={};32768&n[0]&&(h.inputSearch=e[15]),8&n[0]&&(h.record=e[3]),4&n[0]&&(h.eventId=e[2].id),4&n[0]&&(h.className=e[2].class),16384&n[0]&&(h.prevEventId=e[14]),32&n[0]&&(h.filterForReady=e[5]),64&n[0]&&(h.filter=e[6]),128&n[0]&&(h.query=e[7]),256&n[0]&&(h.refStatus=e[8]),512&n[0]&&(h.praefix=e[9]),1024&n[0]&&(h.selectionFields=e[10]),2&n[0]&&(h.rowId=e[1]),65536&n[0]&&(h.shouldBlock=e[16]),4096&n[0]&&(h.deList=e[12]),16777216&n[0]&&(h.stopAggregation=e[24]),2048&n[0]&&(h.showEdit=e[11]),s.$set(h)},i(e){a||(we(t.$$.fragment,e),we(i),we(s.$$.fragment,e),a=!0)},o(e){ye(t.$$.fragment,e),ye(i),ye(s.$$.fragment,e),a=!1},d(e){be(t,e),e&&D(n),c[r].d(e),e&&D(o),be(s,e)}}}function nn(e){let t,n,r,i;n=new e[27]({props:{outline:!0,$$slots:{default:[on]},$$scope:{ctx:e}}}),n.$on("click",e[32]);let o=e[29]&&e[13]&&sn(e);return{c(){t=O("div"),Ee(n.$$.fragment),r=B(),o&&o.c(),U(t,"class","form--buttons svelte-jb5mrh")},m(e,s){R(e,t,s),Ae(n,t,null),N(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]&&we(o,1)):(o=sn(e),o.c(),we(o,1),o.m(t,null)):o&&(pe(),ye(o,1,1,(()=>{o=null})),ge())},i(e){i||(we(n.$$.fragment,e),we(o),i=!0)},o(e){ye(n.$$.fragment,e),ye(o),i=!1},d(e){e&&D(t),be(n),o&&o.d()}}}function rn(e){let t,n,r,i,o,s,a=e[23]&&ln(e);return r=new e[27]({props:{outline:!0,$$slots:{default:[cn]},$$scope:{ctx:e}}}),r.$on("click",e[32]),o=new e[26]({props:{text:"Liste aus "+e[17]}}),{c(){a&&a.c(),t=B(),n=O("div"),Ee(r.$$.fragment),i=B(),Ee(o.$$.fragment),U(n,"class","form--buttons svelte-jb5mrh")},m(e,l){a&&a.m(e,l),R(e,t,l),R(e,n,l),Ae(r,n,null),R(e,i,l),Ae(o,e,l),s=!0},p(e,n){e[23]?a?(a.p(e,n),8388608&n[0]&&we(a,1)):(a=ln(e),a.c(),we(a,1),a.m(t.parentNode,t)):a&&(pe(),ye(a,1,1,(()=>{a=null})),ge());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||(we(a),we(r.$$.fragment,e),we(o.$$.fragment,e),s=!0)},o(e){ye(a),ye(r.$$.fragment,e),ye(o.$$.fragment,e),s=!1},d(e){a&&a.d(e),e&&D(t),e&&D(n),be(r),e&&D(i),be(o,e)}}}function on(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function sn(e){let t,n;return t=new e[27]({props:{filled:!0,$$slots:{default:[an]},$$scope:{ctx:e}}}),t.$on("click",e[33]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function an(e){let t;return{c(){t=M("Neu")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function ln(e){let t,n;return t=new Ll({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(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function cn(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function dn(e){let t,n,r,i;const o=[tn,en],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=P()},m(e,n){s[t].m(e,n),R(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?s[t].p(e,i):(pe(),ye(s[l],1,1,(()=>{s[l]=null})),ge(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),we(n,1),n.m(r.parentNode,r))},i(e){i||(we(n),i=!0)},o(e){ye(n),i=!1},d(e){s[t].d(e),e&&D(r)}}}function un(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function hn(e){let t,n,r,i={ctx:e,current:null,token:null,hasCatch:!1,pending:un,then:Qt,catch:Kt,value:45,blocks:[,,,]};return ve(n=e[30](e[4]),i),{c(){t=P(),i.block.c()},m(e,n){R(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]))&&ve(n,i)||_e(i,e,r)},i(e){r||(we(i.block),r=!0)},o(e){for(let e=0;e<3;e+=1){ye(i.blocks[e])}r=!1},d(e){e&&D(t),i.block.d(e),i.token=null,i=null}}}function fn(e,n,r){let i;const{Dialog:o,Divider:s,Button:a}=c,l=K(),{currentTasks:d}=u;b(e,d,(e=>r(41,i=e)));let{title:h}=n,{schema:f}=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:C=!1}=n,{showEdit:$=!0}=n,{deList:E}=n,{newAllowed:A=!0}=n,{prevEventId:S}=n,{inputSearch:T}=n,{shouldBlock:N}=n,R=f.id;f.class;let D,k,O,x,M,B,P,L="",F=!1,V=!1;h??=f.identity.designation;const U=!i?.length||i.find((e=>e===R));return e.$$set=e=>{"title"in e&&r(0,h=e.title),"schema"in e&&r(2,f=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,C=e.selectionFields),"showEdit"in e&&r(11,$=e.showEdit),"deList"in e&&r(12,E=e.deList),"newAllowed"in e&&r(13,A=e.newAllowed),"prevEventId"in e&&r(14,S=e.prevEventId),"inputSearch"in e&&r(15,T=e.inputSearch),"shouldBlock"in e&&r(16,N=e.shouldBlock)},[h,p,f,m,g,w,y,v,_,I,C,$,E,A,S,T,N,L,F,D,O,M,B,P,V,o,s,a,d,U,async e=>{if(!e)return!1;const n=await ch(f.class,f.id);if(k=C&&C?.find((e=>f.class===e.refClass.split(":")[0])),r(20,O=k?.value?.get&&k.value.get(I)),O){x=k.refClass;const[e,n]=x.split(":"),[i]=n.split(".");r(21,M=k.parentClass.find((t=>t.name===e)));const o=await t.getSchemaByClass(M.refClass);r(22,B=o.id),r(17,L=k.parentClass.find((e=>e.name===i)).designation)}return n},()=>{r(18,F=!1),p||l("back"),$||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=f.display;t&&t.length&&t.map((t=>{const[n,r]=t.split(".");let i=f.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})=>{O&&r(23,P=e)},({detail:e})=>{if(!e.value)return;const t={_id:e.value};l("choose",{row:t})},function(t){Q(e,t)}]}class mn extends Te{constructor(e){var t;super(),document.getElementById("svelte-jb5mrh-style")||((t=O("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}",N(document.head,t)),Se(this,e,fn,hn,A,{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:pn}=Ie;function gn(e){e[28]=e[30].list,e[29]=e[30].items}function wn(e,t,n){const r=e.slice();return r[31]=t[n],r}function yn(e,t,n){const r=e.slice();return r[34]=t[n],r}function vn(e,t,n){const r=e.slice();return r[34]=t[n],r}function _n(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function In(e){let t,n,r,i,o,s,a,l,c,d,u,h,f,m,p,g,w,y;function v(t){e[25](t)}gn(e),n=new e[7]({props:{outline:!0,$$slots:{default:[Cn]},$$scope:{ctx:e}}}),n.$on("click",e[24]);let _={id:e[8]};void 0!==e[1]&&(_.value=e[1]),s=new e[6]({props:_}),ee.push((()=>$e(s,"value",v))),s.$on("input",e[12]),d=new tt({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]=$n(vn(e,o,t));return{c(){t=O("thead"),n=O("tr"),r=O("th"),i=B();for(let e=0;e<s.length;e+=1)s[e].c();U(r,"class","svelte-14hcfjl"),U(n,"class","svelte-14hcfjl"),U(t,"class","svelte-14hcfjl")},m(e,o){R(e,t,o),N(t,n),N(n,r),N(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=vn(e,o,r);s[r]?s[r].p(i,t):(s[r]=$n(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&&D(t),k(s,e)}}}(e),C=e[28]?.length&&function(e){let t,n,r=e[28],i=[];for(let t=0;t<r.length;t+=1)i[t]=bn(wn(e,r,t));const o=e=>ye(i[e],1,1,(()=>{i[e]=null}));return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=P()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);R(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=wn(e,r,s);i[s]?(i[s].p(o,n),we(i[s],1)):(i[s]=bn(o),i[s].c(),we(i[s],1),i[s].m(t.parentNode,t))}for(pe(),s=r.length;s<i.length;s+=1)o(s);ge()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)we(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)ye(i[e]);n=!1},d(e){k(i,e),e&&D(t)}}}(e);return{c(){t=O("div"),Ee(n.$$.fragment),r=B(),i=O("div"),o=M("Suchen: "),Ee(s.$$.fragment),l=B(),c=O("span"),Ee(d.$$.fragment),u=B(),h=O("div"),f=O("table"),I&&I.c(),m=B(),p=O("tbody"),C&&C.c(),U(t,"class","form--buttons svelte-14hcfjl"),U(c,"class","feather pointer svelte-14hcfjl"),z(i,"margin-bottom","1em"),z(i,"position","relative"),U(f,"striped",""),U(f,"class","svelte-14hcfjl"),U(h,"class","eList svelte-14hcfjl")},m(a,v){R(a,t,v),Ae(n,t,null),R(a,r,v),R(a,i,v),N(i,o),Ae(s,i,null),N(i,l),N(i,c),Ae(d,c,null),R(a,u,v),R(a,h,v),N(h,f),I&&I.m(f,null),N(f,m),N(f,p),C&&C.m(p,null),g=!0,w||(y=L(c,"click",e[14]),w=!0)},p(e,t){gn(e);const r={};256&t[1]&&(r.$$scope={dirty:t,ctx:e}),n.$set(r);const i={};!a&&2&t[0]&&(a=!0,i.value=e[1],le((()=>a=!1))),s.$set(i),e[29]?.length&&I.p(e,t),e[28]?.length&&C.p(e,t)},i(e){g||(we(n.$$.fragment,e),we(s.$$.fragment,e),we(d.$$.fragment,e),we(C),g=!0)},o(e){ye(n.$$.fragment,e),ye(s.$$.fragment,e),ye(d.$$.fragment,e),ye(C),g=!1},d(e){e&&D(t),be(n),e&&D(r),e&&D(i),be(s),be(d),e&&D(u),e&&D(h),I&&I.d(),C&&C.d(),w=!1,y()}}}function Cn(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function $n(e){let t,n,r=e[34]?.designation+"";return{c(){t=O("th"),n=M(r),U(t,"class","svelte-14hcfjl")},m(e,r){R(e,t,r),N(t,n)},p:_,d(e){e&&D(t)}}}function En(e){let t,n,r,i,o,s,a,l;r=new it({props:{size:"18"}});let c=e[29],d=[];for(let t=0;t<c.length;t+=1)d[t]=An(yn(e,c,t));return{c(){t=O("tr"),n=O("td"),Ee(r.$$.fragment),i=B();for(let e=0;e<d.length;e+=1)d[e].c();o=B(),U(n,"class","editRow svelte-14hcfjl"),U(t,"class","pointer svelte-14hcfjl"),q(t,"active",e[31]._id===e[0])},m(c,u){R(c,t,u),N(t,n),Ae(r,n,null),N(t,i);for(let e=0;e<d.length;e+=1)d[e].m(t,null);N(t,o),s=!0,a||(l=L(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=yn(e,c,n);d[n]?d[n].p(i,r):(d[n]=An(i),d[n].c(),d[n].m(t,o))}for(;n<d.length;n+=1)d[n].d(1);d.length=c.length}2049&r[0]&&q(t,"active",e[31]._id===e[0])},i(e){s||(we(r.$$.fragment,e),s=!0)},o(e){ye(r.$$.fragment,e),s=!1},d(e){e&&D(t),be(r),k(d,e),a=!1,l()}}}function An(e){let t,n,r,i,o=e[9](e[31],e[34])+"";return{c(){t=O("td"),n=M(o),U(t,"class","svelte-14hcfjl")},m(o,s){R(o,t,s),N(t,n),r||(i=L(t,"click",V(e[10](e[31]))),r=!0)},p(t,n){e=t},d(e){e&&D(t),r=!1,i()}}}function bn(e){let t,n,r=e[13](e[31],e[29],e[1]),i=r&&En(e);return{c(){i&&i.c(),t=P()},m(e,r){i&&i.m(e,r),R(e,t,r),n=!0},p(e,n){2&n[0]&&(r=e[13](e[31],e[29],e[1])),r?i?(i.p(e,n),2&n[0]&&we(i,1)):(i=En(e),i.c(),we(i,1),i.m(t.parentNode,t)):i&&(pe(),ye(i,1,1,(()=>{i=null})),ge())},i(e){n||(we(i),n=!0)},o(e){ye(i),n=!1},d(e){i&&i.d(e),e&&D(t)}}}function Sn(e){let t,n;return t=new e[5]({}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p:_,i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Tn(e){let t,n,r,i;t=new e[4]({});let o={ctx:e,current:null,token:null,hasCatch:!1,pending:Sn,then:In,catch:_n,value:30,blocks:[,,,]};return ve(e[11](),o),{c(){Ee(t.$$.fragment),n=B(),r=P(),o.block.c()},m(e,s){Ae(t,e,s),R(e,n,s),R(e,r,s),o.block.m(e,o.anchor=s),o.mount=()=>r.parentNode,o.anchor=r,i=!0},p(t,n){_e(o,e=t,n)},i(e){i||(we(t.$$.fragment,e),we(o.block),i=!0)},o(e){ye(t.$$.fragment,e);for(let e=0;e<3;e+=1){ye(o.blocks[e])}i=!1},d(e){be(t,e),e&&D(n),e&&D(r),o.block.d(e),o.token=null,o=null}}}function Nn(e){let t,n;return t=new e[3]({props:{title:"Auswahl",class:"eList",$$slots:{default:[Tn]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Rn(e,n,i){const o=K(),{Dialog:s,Divider:a,Loading:l,TextField:d,Button:u}=c;let{item:h}=n,{classId:f}=n,{className:p}=n,{rowId:w}=n,{viewName:y}=n,{viewValue:v}=n,{recordId:_}=n,{filter:I}=n,{multiValues:C}=n,$="",E=f+Math.floor(9e3*Math.random()+1e3).toString()+"search";const A=(e,t)=>{if(!t)return;const n=e[t.name];return"boolean"==typeof n?g(n):m(e[`_${t.name}`]||e[t.name]||"")},b=t.getSchemaByClass(p);Y((()=>{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&&mh(t.class,e.eventId)}));return e.$$set=e=>{"item"in e&&i(16,h=e.item),"classId"in e&&i(17,f=e.classId),"className"in e&&i(18,p=e.className),"rowId"in e&&i(0,w=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,C=e.multiValues)},[w,$,o,s,a,l,d,u,E,A,e=>()=>o("choose",{row:e}),async()=>{const e=await b;let n=[];if(h.lookup){const r="."+f+"#"+h.lookup,i=document.querySelector(r);let o=i?.value||_;if(C.has(h.lookup)){const r=C.get(h.lookup)[0];n=r?await t.getSectionView(h.name,{[h.lookup]:r},!0):await ch(h.name,e.id)}else if(o&&24===o.toString().length){const e=await fh(h.lookup,o);if(e){const r=e[h.name]?.map((e=>e[h.name]));r&&(n=await t.getSectionView(h.name,{_id:{$in:r}},!0))}}}else{const r="."+f+"#"+y.split(":")[0],i=document.querySelector(r);let o={[y]:i?.value||_};if(h.refItem){const e="."+f+"#"+h.refItem;try{const t=document.querySelector(e);if(t){const e={$or:[{[h.refItem]:t.value},{[h.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 Xt(r,e,n)}},({detail:{value:e}})=>{i(1,$=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(1,$="")},e=>async()=>{const n=await t.getTaskByDocId(e._id,!0),r=`/task/${n.event}/${n._id}/task?view=standalone`;window.open(r)},h,f,p,y,v,_,I,C,()=>o("back"),function(e){$=e,i(1,$)}]}class Dn extends Te{constructor(e){var t;super(),pn.getElementById("svelte-14hcfjl-style")||((t=O("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}",N(pn.head,t)),Se(this,e,Rn,Nn,A,{item:16,classId:17,className:18,rowId:0,viewName:19,viewValue:20,recordId:21,filter:22,multiValues:23},[-1,-1])}}const{document:kn}=Ie;function On(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function xn(e){let t,n,r=e[72]&&function(e){let t,n,r,i,s,a,l,c,d,u,h,f,m,p,g,w,y,v,_;function I(t){e[55](t)}function C(t){e[56](t)}let $={class:"full-width",id:e[32],rows:"1",required:e[2],disabled:e[3],placeholder:e[34],style:"height:2.8em; padding-left:2em;padding-right:2em;overflow-y:hidden; resize:none;"};void 0!==e[1]&&($.value=e[1]);void 0!==e[25]&&($.overwrite=e[25]);n=new o({props:$}),ee.push((()=>$e(n,"value",I))),ee.push((()=>$e(n,"overwrite",C))),n.$on("click",e[37]()),n.$on("blur",e[44]);const E=[Bn,Mn],A=[];function b(e,t){return!e[3]||e[16]?0:e[22]&&e[0]?1:-1}~(a=b(e))&&(l=A[a]=E[a](e));let T=(!e[3]||e[16]||e[17])&&Pn(e);function k(t){e[57](t)}let x={class:"tModal",noClickaway:!0,$$slots:{default:[Un]},$$scope:{ctx:e}};void 0!==e[19]&&(x.open=e[19]);m=new e[28]({props:x}),ee.push((()=>$e(m,"open",k)));let M=e[20]&&Hn(e);return{c(){t=O("div"),Ee(n.$$.fragment),s=B(),l&&l.c(),c=B(),d=O("input"),h=B(),T&&T.c(),f=B(),Ee(m.$$.fragment),g=B(),M&&M.c(),w=P(),U(d,"class",u=S(e[9]||e[10])+" svelte-jox15l"),U(d,"id",e[5]),U(d,"name",e[5]),d.value=e[0],d.hidden=!0,z(t,"position","relative")},m(r,i){R(r,t,i),Ae(n,t,null),N(t,s),~a&&A[a].m(t,null),N(t,c),N(t,d),N(t,h),T&&T.m(t,null),R(r,f,i),Ae(m,r,i),R(r,g,i),M&&M.m(r,i),R(r,w,i),y=!0,v||(_=L(t,"keydown",e[38]),v=!0)},p(e,o){const s={};4&o[0]&&(s.required=e[2]),8&o[0]&&(s.disabled=e[3]),!r&&2&o[0]&&(r=!0,s.value=e[1],le((()=>r=!1))),!i&&33554432&o[0]&&(i=!0,s.overwrite=e[25],le((()=>i=!1))),n.$set(s);let h=a;a=b(e),a===h?~a&&A[a].p(e,o):(l&&(pe(),ye(A[h],1,1,(()=>{A[h]=null})),ge()),~a?(l=A[a],l?l.p(e,o):(l=A[a]=E[a](e),l.c()),we(l,1),l.m(t,c)):l=null),(!y||1536&o[0]&&u!==(u=S(e[9]||e[10])+" svelte-jox15l"))&&U(d,"class",u),(!y||32&o[0])&&U(d,"id",e[5]),(!y||32&o[0])&&U(d,"name",e[5]),(!y||1&o[0]&&d.value!==e[0])&&(d.value=e[0]),!e[3]||e[16]||e[17]?T?(T.p(e,o),196616&o[0]&&we(T,1)):(T=Pn(e),T.c(),we(T,1),T.m(t,null)):T&&(pe(),ye(T,1,1,(()=>{T=null})),ge());const f={};93126097&o[0]|2048&o[2]&&(f.$$scope={dirty:o,ctx:e}),!p&&524288&o[0]&&(p=!0,f.open=e[19],le((()=>p=!1))),m.$set(f),e[20]?M?(M.p(e,o),1048576&o[0]&&we(M,1)):(M=Hn(e),M.c(),we(M,1),M.m(w.parentNode,w)):M&&(pe(),ye(M,1,1,(()=>{M=null})),ge())},i(e){y||(we(n.$$.fragment,e),we(l),we(T),we(m.$$.fragment,e),we(M),y=!0)},o(e){ye(n.$$.fragment,e),ye(l),ye(T),ye(m.$$.fragment,e),ye(M),y=!1},d(e){e&&D(t),be(n),~a&&A[a].d(),T&&T.d(),e&&D(f),be(m,e),e&&D(g),M&&M.d(e),e&&D(w),v=!1,_()}}}(e);return{c(){r&&r.c(),t=P()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,t){e[72]&&r.p(e,t)},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function Mn(e){let t,n,r,i,o;return n=new it({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather pointer svelte-jox15l")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[43]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function Bn(e){let t,n,r,i,o;return n=new Tt({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather pointer svelte-jox15l")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=[L(t,"click",e[37](!0)),L(t,"choose",e[40])],i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,$(o)}}}function Pn(e){let t,n,r,i,o;return n=new tt({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather2 pointer svelte-jox15l")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[42]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function Ln(e){let t,n,r,i;const o=[Vn,Fn],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=P()},m(e,n){s[t].m(e,n),R(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?s[t].p(e,i):(pe(),ye(s[l],1,1,(()=>{s[l]=null})),ge(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),we(n,1),n.m(r.parentNode,r))},i(e){i||(we(n),i=!0)},o(e){ye(n),i=!1},d(e){s[t].d(e),e&&D(r)}}}function Fn(e){let t,n;return t=new mn({props:{title:e[6].designation,newAllowed:e[23],prevEventId:e[11],schema:e[18],filter:e[33],query:e[35](),record:e[7],recID:e[0],isOpening:e[19],filterForReady:e[24],refStatus:e[6].refStatus,selectionFields:e[14],deList:e[15],praefix:e[13],shouldBlock:e[26],inputSearch:e[39]()}}),t.$on("choose",e[40]),t.$on("back",e[41]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),16777216&n[0]&&(r.filterForReady=e[24]),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]),67108864&n[0]&&(r.shouldBlock=e[26]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Vn(e){let t,n;return t=new Dn({props:{item:e[6],className:e[18].class,classId:e[10],rowId:e[0],recordId:e[12],viewName:e[4],viewValue:"",multiValues:e[8]}}),t.$on("choose",e[40]),t.$on("back",e[41]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Un(e){let t,n,r=e[19]&&Ln(e);return{c(){r&&r.c(),t=P()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,n){e[19]?r?(r.p(e,n),524288&n[0]&&we(r,1)):(r=Ln(e),r.c(),we(r,1),r.m(t.parentNode,t)):r&&(pe(),ye(r,1,1,(()=>{r=null})),ge())},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function Hn(e){let t,n,r;function i(t){e[58](t)}let o={class:"tModal",noClickaway:!0,$$slots:{default:[zn]},$$scope:{ctx:e}};return void 0!==e[20]&&(o.open=e[20]),t=new e[28]({props:o}),ee.push((()=>$e(t,"open",i))),{c(){Ee(t.$$.fragment)},m(e,n){Ae(t,e,n),r=!0},p(e,r){const i={};2359297&r[0]|2048&r[2]&&(i.$$scope={dirty:r,ctx:e}),!n&&1048576&r[0]&&(n=!0,i.open=e[20],le((()=>n=!1))),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function Wn(e){let t,n;return t=new wh({props:{schema:e[18],recID:e[0],readonly:!0}}),t.$on("back",e[41]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function zn(e){let t,n;return t=new e[27]({props:{title:e[21],$$slots:{default:[Wn]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};2097152&n[0]&&(r.title=e[21]),262145&n[0]|2048&n[2]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function qn(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function jn(e){let t,n,r={ctx:e,current:null,token:null,hasCatch:!1,pending:qn,then:xn,catch:On,value:72,blocks:[,,,]};return ve(e[36](),r),{c(){t=P(),r.block.c()},m(e,i){R(e,t,i),r.block.m(e,r.anchor=i),r.mount=()=>t.parentNode,r.anchor=t,n=!0},p(t,n){_e(r,e=t,n)},i(e){n||(we(r.block),n=!0)},o(e){for(let e=0;e<3;e+=1){ye(r.blocks[e])}n=!1},d(e){e&&D(t),r.block.d(e),r.token=null,r=null}}}function Gn(e,n,r){let o,s,a,l;b(e,i,(e=>r(54,o=e)));const d=K(),{Dialog:h,Modal:f}=c,{currentTasks:m,environment:p,loggedIn:g}=u;b(e,m,(e=>r(60,s=e))),b(e,p,(e=>r(62,l=e))),b(e,g,(e=>r(61,a=e)));let{id:y}=n,{item:v}=n,{fullRecord:_}=n,{value:I=""}=n,{multiValues:C}=n,{desc:$=""}=n,{noForm:E=!1}=n,{classId:A}=n,{eventId:S}=n,{recordId:T}=n,{withRefValue:N=!1}=n,{refValue:R=""}=n,{shortEdit:D}=n,{required:k}=n,{disabled:O}=n,{readonly:x}=n,{praefix:M}=n,{selectionFields:B}=n,{formnovalidate:P}=n,{selection:L}=n,{deList:F}=n,{isTemplate:V}=n,{noList:U=!1}=n,{multi:H=!1}=n,{initFinished:W}=n;const z="comment_"+y,q=v.filter;let j,G,X,Y,Z,Q,J=!1,ee=!0,te=!0,ne=!0,re=!1,ie="";x||=T&&v.asInput,O||=x,!L&&v.selection&&1===v.selection.split(":").length&&(L=v.selection);const oe=x||O||v.lookup||L&&!v.constraint?"":"Suchbegriff ⏎",se=()=>{v.refItem&&v.refItem.startsWith("owner")&&(r(46,R=l.owner[v.refClass]),R||r(46,R=((e,t)=>{try{return e.split(".").reduce(((e,t)=>e[t]),t)}catch(e){return""}})(v.refItem,l)),R&&(r(45,N=!0),d("change",{value:R})))},ae=async e=>{e.items.filter((e=>e.properties?.default)).forEach((t=>{d("defPrep",{className:e.class,itemName:t.name,value:t.properties.default})}))},le=async e=>{const n=()=>{r(19,J=!0)};if(9==e.which)return;if(I)return e.preventDefault();if(13!=e.which)return;e.preventDefault();const i=X.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:h=!1,end:f=!1}=d;if(o.length<u)return n();const m=(h?"^":"")+o+(f?"$":"");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(X.class,p);1!==g?.length?n():r(0,I=g[0]._id)},ce=e=>{e&&(r(53,ie=r(1,$=w(X,e))),d("setRefDesc",$.split(" •")[0]),d("change",{value:I,description:$}),d("task",{row:e,eventId:X.id}))},de=()=>{r(19,J=!1),r(20,j=!1)};return e.$$set=e=>{"id"in e&&r(5,y=e.id),"item"in e&&r(6,v=e.item),"fullRecord"in e&&r(7,_=e.fullRecord),"value"in e&&r(0,I=e.value),"multiValues"in e&&r(8,C=e.multiValues),"desc"in e&&r(1,$=e.desc),"noForm"in e&&r(9,E=e.noForm),"classId"in e&&r(10,A=e.classId),"eventId"in e&&r(11,S=e.eventId),"recordId"in e&&r(12,T=e.recordId),"withRefValue"in e&&r(45,N=e.withRefValue),"refValue"in e&&r(46,R=e.refValue),"shortEdit"in e&&r(49,D=e.shortEdit),"required"in e&&r(2,k=e.required),"disabled"in e&&r(3,O=e.disabled),"readonly"in e&&r(48,x=e.readonly),"praefix"in e&&r(13,M=e.praefix),"selectionFields"in e&&r(14,B=e.selectionFields),"formnovalidate"in e&&r(50,P=e.formnovalidate),"selection"in e&&r(4,L=e.selection),"deList"in e&&r(15,F=e.deList),"isTemplate"in e&&r(16,V=e.isTemplate),"noList"in e&&r(51,U=e.noList),"multi"in e&&r(17,H=e.multi),"initFinished"in e&&r(47,W=e.initFinished)},e.$$.update=()=>{if(4&e.$$.dirty[0]|524288&e.$$.dirty[1]&&r(2,k=k&&!P),49152&e.$$.dirty[1]&&N&&r(0,I=R),3&e.$$.dirty[0]|4194304&e.$$.dirty[1]&&!$&&I&&ie&&r(1,$=ie),268353&e.$$.dirty[0]|1114112&e.$$.dirty[1]&&I&&X&&!Array.isArray(I)){const e=v.properties?.prefetch?500:0;if(T||v.asInput||v.upate||!1!==v.refItem||!1===v.refItem&&W)if(e){const e="p$"+v.refClass+"$"+S,t=lh(e);t?t.then((e=>{const t=e.find((({_id:e})=>e===I));t?ce(t):dh(v.refClass,X.id,I,!!v.lookup||U).then(ce)})):dh(v.refClass,X.id,I,!!v.lookup||U).then(ce)}else dh(v.refClass,X.id,I,!!v.lookup||U).then(ce);r(47,W=!0)}if(65&e.$$.dirty[0]|10485760&e.$$.dirty[1]&&I&&Y&&v.name===Y.input?.at(0)&&Y.inputLookup?.length){const{domain:e}=Y.inputLookup[0]||{};"user"===e&&(o.some((e=>Y.authorization?.find((t=>t.role===e&&!t.constraint))))||r(3,O=!0))}262145&e.$$.dirty[0]&&!I&&X&&ce({})},[I,$,k,O,L,y,v,_,C,E,A,S,T,M,B,F,V,H,X,J,j,G,Z,ee,te,ne,re,h,f,m,p,g,z,q,oe,()=>{if(!v.query)return;const[e,t]=v.query.split(".");if(!_[t])return;let n=[{$lookup:{from:e,localField:e,foreignField:"_id",as:"__"+e}},{$unwind:{path:"$__"+e,preserveNullAndEmptyArrays:!0}},{$match:{["__"+e+"."+t]:_[t]}}];return v.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":v.refStatus}}])),n},async()=>{try{const e=await t.getEvent(S);if(Q="report"===e.output.type,r(24,te=!v.asInput),r(23,ee=e.output?.class[0].name!==v.refClass),r(18,X=await t.getSchemaByClass(v.refClass)),Q||r(26,re=((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===v.name));if(t?.properties?.blocking)return n.name}return!1})(e,X)),ae(X),r(22,Z=(e=>!s?.length||!!s.find((t=>t===e)))(X.id)),r(52,Y=await t.getSchema(S)),S&&T&&I&&!O&&Y.input?.find((e=>e===v.refClass))&&r(3,O=!0),e.input?.class&&e.input.class[0]&&(e.input.class[0].name===v.refClass&&e.input.class[0].readonly&&r(3,O=!0),T&&e.input.class[0].name===v.refClass&&e.input.class[0].writeState)){(await t.getTaskByDocId(T,!0)).status===e.input.class[0].writeState&&r(3,O=r(48,x=!1))}if(v.properties?.query?.lookup){const{domain:e,value:n}=v.properties.query.lookup;if("user"===e){const e=a.user,i={[n]:e},s=await t.getSectionView(v.refClass,i);if(s?.length){const[{_id:e}]=s;e&&(r(46,R=e),r(45,N=!0),d("change",{value:R}))}o.some((e=>X.authorization?.find((t=>t.role===e&&!t.constraint))))||r(3,O=!0)}}else se();if(!R&&v.filter&&(""===M||void 0===M)){const e=v.filter,n=!0;e.startsWith("!")&&(n=!1,e=e.slice(1));const i=await t.getOneAndOnly(v.refClass,{[v.filter]:n});i&&(r(46,R=i._id),r(45,N=!0),d("change",{value:R}))}return r(21,G=X.identity.designation),!0}catch{return d("initFail",!0),!1}},e=>t=>{if(t.stopPropagation(),!0===e&&r(19,J=!0),e&&"BUTTON"===t.explicitOriginalTarget?.nodeName){const t=document.getElementById(e);return t?.blur()}(v.lookup||L&&!v.constraint||I)&&r(19,J=!0)},le,()=>{if(I)return"";const e=document.getElementById(z);return r(1,$=""),e?.value||""},({detail:e})=>{r(0,I=e.row._id),de()},de,()=>{(Q||Z)&&(H?d("change",{value:I,delete:!0}):(r(0,I=""),r(1,$=""),r(25,ne=!0),d("change",{value:I,description:$}),d("task",{row:{_task:{event:X.id,_id:!1}}})))},async()=>{if(!I)return;let e=await dh(v.refClass,X.id,I);e._task||(e={_task:await t.getTaskByDocId(I,!0)});const n=e._task.task_id||e._task._id,r=`/task/${e._task.event}/${n}/task?view=standalone`;window.open(r)},e=>{I||$&&le({which:13,preventDefault:()=>{},srcElement:{value:$}})},N,R,W,x,D,P,U,Y,ie,o,function(e){$=e,r(1,$),r(0,I),r(53,ie),r(45,N),r(46,R)},function(e){ne=e,r(25,ne)},function(e){J=e,r(19,J)},function(e){j=e,r(20,j)}]}class Xn extends Te{constructor(e){var t;super(),kn.getElementById("svelte-jox15l-style")||((t=O("style")).id="svelte-jox15l-style",t.textContent=".feather.svelte-jox15l{position:absolute;top:0.75em;left:0.5em;color:#4300b0}.feather2.svelte-jox15l{position:absolute;top:0.75em;right:0.5em;color:#4300b0}.text-field textarea:invalid{border-bottom:1px #b80000 solid !important;background-color:#fbeeee !important}",N(kn.head,t)),Se(this,e,Gn,jn,A,{id:5,item:6,fullRecord:7,value:0,multiValues:8,desc:1,noForm:9,classId:10,eventId:11,recordId:12,withRefValue:45,refValue:46,shortEdit:49,required:2,disabled:3,readonly:48,praefix:13,selectionFields:14,formnovalidate:50,selection:4,deList:15,isTemplate:16,noList:51,multi:17,initFinished:47},[-1,-1,-1])}}function Yn(e,t,n){const r=e.slice();return r[40]=t[n],r[42]=n,r}function Zn(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Kn(e){let t,n;return t=new e[16]({props:{outline:!0,$$slots:{default:[er]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};8191&n[0]|4096&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Qn(e){let t,n,r,i,o;return n=new ft({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather pointer")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",(function(){E(e[22](e[0]))&&e[22](e[0]).apply(this,arguments)})),i=!0)},p(t,n){e=t},i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function Jn(e){let t,n;return t=new Xn({props:{classId:e[6],eventId:e[7],required:e[9],disabled:e[1],formnovalidate:e[12],readonly:e[10],id:e[2]+"."+e[42],item:e[3],desc:e[4],value:e[40],noForm:e[5],praefix:e[11],recordId:e[8],multi:!0}}),t.$on("change",e[24]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};64&n[0]&&(r.classId=e[6]),128&n[0]&&(r.eventId=e[7]),512&n[0]&&(r.required=e[9]),2&n[0]&&(r.disabled=e[1]),4096&n[0]&&(r.formnovalidate=e[12]),1024&n[0]&&(r.readonly=e[10]),4&n[0]&&(r.id=e[2]+"."+e[42]),8&n[0]&&(r.item=e[3]),16&n[0]&&(r.desc=e[4]),1&n[0]&&(r.value=e[40]),32&n[0]&&(r.noForm=e[5]),2048&n[0]&&(r.praefix=e[11]),256&n[0]&&(r.recordId=e[8]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function er(e){let t,n,r,i=!e[10]&&Qn(e),o=[].concat(e[0]),s=[];for(let t=0;t<o.length;t+=1)s[t]=Jn(Yn(e,o,t));const a=e=>ye(s[e],1,1,(()=>{s[e]=null}));return{c(){i&&i.c(),t=B();for(let e=0;e<s.length;e+=1)s[e].c();n=P()},m(e,o){i&&i.m(e,o),R(e,t,o);for(let t=0;t<s.length;t+=1)s[t].m(e,o);R(e,n,o),r=!0},p(e,r){if(e[10]?i&&(pe(),ye(i,1,1,(()=>{i=null})),ge()):i?(i.p(e,r),1024&r[0]&&we(i,1)):(i=Qn(e),i.c(),we(i,1),i.m(t.parentNode,t)),16785407&r[0]){let t;for(o=[].concat(e[0]),t=0;t<o.length;t+=1){const i=Yn(e,o,t);s[t]?(s[t].p(i,r),we(s[t],1)):(s[t]=Jn(i),s[t].c(),we(s[t],1),s[t].m(n.parentNode,n))}for(pe(),t=o.length;t<s.length;t+=1)a(t);ge()}},i(e){if(!r){we(i);for(let e=0;e<o.length;e+=1)we(s[e]);r=!0}},o(e){ye(i),s=s.filter(Boolean);for(let e=0;e<s.length;e+=1)ye(s[e]);r=!1},d(e){i&&i.d(e),e&&D(t),k(s,e),e&&D(n)}}}function tr(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function nr(e){let t,n;return t=new e[18]({props:{title:e[14].designation,class:"eList",$$slots:{default:[ir]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};16384&n[0]&&(r.title=e[14].designation),49480&n[0]|4096&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function rr(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function ir(e){let t,n,r,i,o;return n=new e[19]({props:{outline:!0,$$slots:{default:[rr]},$$scope:{ctx:e}}}),n.$on("click",e[25]),i=new Zt({props:{item:e[3],className:e[14].class,classId:e[6],rowId:e[15],recordId:e[8],inputList:e[21]()}}),i.$on("choose",e[23]),i.$on("back",e[25]),{c(){t=O("div"),Ee(n.$$.fragment),r=B(),Ee(i.$$.fragment),U(t,"class","form--buttons")},m(e,s){R(e,t,s),Ae(n,t,null),R(e,r,s),Ae(i,e,s),o=!0},p(e,t){const r={};4096&t[1]&&(r.$$scope={dirty:t,ctx:e}),n.$set(r);const o={};8&t[0]&&(o.item=e[3]),16384&t[0]&&(o.className=e[14].class),64&t[0]&&(o.classId=e[6]),32768&t[0]&&(o.rowId=e[15]),256&t[0]&&(o.recordId=e[8]),i.$set(o)},i(e){o||(we(n.$$.fragment,e),we(i.$$.fragment,e),o=!0)},o(e){ye(n.$$.fragment,e),ye(i.$$.fragment,e),o=!1},d(e){e&&D(t),be(n),e&&D(r),be(i,e)}}}function or(e){let t,n,r=e[13]&&nr(e);return{c(){r&&r.c(),t=P()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,n){e[13]?r?(r.p(e,n),8192&n[0]&&we(r,1)):(r=nr(e),r.c(),we(r,1),r.m(t.parentNode,t)):r&&(pe(),ye(r,1,1,(()=>{r=null})),ge())},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function sr(e){let t,n,r,i,o={ctx:e,current:null,token:null,hasCatch:!1,pending:tr,then:Kn,catch:Zn,value:39,blocks:[,,,]};function s(t){e[34](t)}ve(e[20](),o);let a={class:"tModal",noClickaway:!0,$$slots:{default:[or]},$$scope:{ctx:e}};return void 0!==e[13]&&(a.open=e[13]),n=new e[17]({props:a}),ee.push((()=>$e(n,"open",s))),{c(){o.block.c(),t=B(),Ee(n.$$.fragment)},m(e,r){o.block.m(e,o.anchor=r),o.mount=()=>t.parentNode,o.anchor=t,R(e,t,r),Ae(n,e,r),i=!0},p(t,i){_e(o,e=t,i);const s={};57672&i[0]|4096&i[1]&&(s.$$scope={dirty:i,ctx:e}),!r&&8192&i[0]&&(r=!0,s.open=e[13],le((()=>r=!1))),n.$set(s)},i(e){i||(we(o.block),we(n.$$.fragment,e),i=!0)},o(e){for(let e=0;e<3;e+=1){ye(o.blocks[e])}ye(n.$$.fragment,e),i=!1},d(e){o.block.d(e),o.token=null,o=null,e&&D(t),be(n,e)}}}function ar(e,n,r){const i=K(),{Card:o,Modal:s,Dialog:a,Button:l}=c;let d,u,{id:h}=n,{item:f}=n,{record:m}=n,{values:p=[]}=n,{desc:g=""}=n,{noForm:w=!1}=n,{classId:y}=n,{eventId:v}=n,{recordId:_}=n,{withRefValue:I=!1}=n,{refValue:C=""}=n,{required:$}=n,{disabled:E}=n,{readonly:A}=n,{praefix:b}=n,{selectionFields:S}=n,{formnovalidate:T}=n,{selection:N}=n,{deList:R}=n,{isTemplate:D}=n,{noList:k=!1}=n,O=!1;const{lookup:x,filter:M,constraint:B}=f.properties.multi;E=!0;const P=()=>{r(13,O=!1)};return e.$$set=e=>{"id"in e&&r(2,h=e.id),"item"in e&&r(3,f=e.item),"record"in e&&r(26,m=e.record),"values"in e&&r(0,p=e.values),"desc"in e&&r(4,g=e.desc),"noForm"in e&&r(5,w=e.noForm),"classId"in e&&r(6,y=e.classId),"eventId"in e&&r(7,v=e.eventId),"recordId"in e&&r(8,_=e.recordId),"withRefValue"in e&&r(27,I=e.withRefValue),"refValue"in e&&r(28,C=e.refValue),"required"in e&&r(9,$=e.required),"disabled"in e&&r(1,E=e.disabled),"readonly"in e&&r(10,A=e.readonly),"praefix"in e&&r(11,b=e.praefix),"selectionFields"in e&&r(29,S=e.selectionFields),"formnovalidate"in e&&r(12,T=e.formnovalidate),"selection"in e&&r(30,N=e.selection),"deList"in e&&r(31,R=e.deList),"isTemplate"in e&&r(32,D=e.isTemplate),"noList"in e&&r(33,k=e.noList)},[p,E,h,f,g,w,y,v,_,$,A,b,T,O,d,u,o,s,a,l,async()=>{r(0,p=[].concat(p)),r(14,d=await t.getSchemaByClass(f.refClass))},async()=>{let e=await ch(d.class,d.id);if(!e?.length)return[];if(x&&(e=e.filter((e=>m[x]===e[x]))),B&&e?.length){const{refClass:n,refStatus:r}=B,i=[{$match:{[d.class]:{$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":r}}],o=await t.getSectionView(n,i);e=e.filter((e=>!!o.find((t=>t.project==e._id))))}if(M)for(const t in M)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},e=>()=>{A||(e=[].concat(e),r(13,O=!0),r(15,u=e))},({detail:e})=>{const t=e.row._id;r(0,p=[].concat(p)),Array.isArray(p)&&!p.find((e=>e===t))&&r(0,p=p.concat(e.row._id)),P()},({detail:e})=>{r(0,p=[].concat(p)),e.delete&&r(0,p=p.filter((t=>t!==e.value))),e.value=p,i("change",e),i("multi",{lookup:x,filter:M,name:f.name,value:p})},P,m,I,C,S,N,R,D,k,function(e){O=e,r(13,O)}]}class lr extends Te{constructor(e){var t;super(),document.getElementById("svelte-1m792ni-style")||((t=O("style")).id="svelte-1m792ni-style",t.textContent=".field .card{padding:1em !important;margin-bottom:1em !important}",N(document.head,t)),Se(this,e,ar,sr,A,{id:2,item:3,record:26,values:0,desc:4,noForm:5,classId:6,eventId:7,recordId:8,withRefValue:27,refValue:28,required:9,disabled:1,readonly:10,praefix:11,selectionFields:29,formnovalidate:12,selection:30,deList:31,isTemplate:32,noList:33},[-1,-1])}}const cr=/\d+/g,dr=/%[HMSpPdmyY%]/g;function ur(e,t,n){const r=Math.floor((new Date).getFullYear()/100);let i=!1;if(""===e)return null;const o=t.split(dr);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{cr.lastIndex=s;const o=cr.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 hr(e,t){return null==e||null==t?e:(t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t)}const{document:fr}=Ie;function mr(e,t,n){const r=e.slice();return r[17]=t[n],r}function pr(e,t,n){const r=e.slice();return r[20]=t[n],r}function gr(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function wr(e){let t,n,r,i,o,s,a,l,c,d,u,h,f,m=e[0].items,p=[];for(let t=0;t<m.length;t+=1)p[t]=vr(pr(e,m,t));const g=e=>ye(p[e],1,1,(()=>{p[e]=null}));let w=e[0].list&&_r(e);return l=new e[5]({props:{outline:!0,$$slots:{default:[Cr]},$$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:[$r]},$$scope:{ctx:e}}}),{c(){t=O("form"),n=O("input"),i=B();for(let e=0;e<p.length;e+=1)p[e].c();o=B(),w&&w.c(),s=B(),a=O("div"),Ee(l.$$.fragment),c=B(),Ee(d.$$.fragment),U(n,"class",S(e[6])+" svelte-1phofh5"),U(n,"name","_id"),U(n,"type","hidden"),n.value=r=e[1]._id||"",U(t,"class","fTask svelte-1phofh5"),U(t,"id",e[6]),U(a,"class","form--buttons svelte-1phofh5")},m(r,m){R(r,t,m),N(t,n),N(t,i);for(let e=0;e<p.length;e+=1)p[e].m(t,null);N(t,o),w&&w.m(t,null),R(r,s,m),R(r,a,m),Ae(l,a,null),N(a,c),Ae(d,a,null),u=!0,h||(f=[L(t,"keydown",e[8]),L(t,"submit",F(e[10]))],h=!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=pr(e,m,n);p[n]?(p[n].p(r,i),we(p[n],1)):(p[n]=vr(r),p[n].c(),we(p[n],1),p[n].m(t,o))}for(pe(),n=m.length;n<p.length;n+=1)g(n);ge()}e[0].list?w?(w.p(e,i),1&i&&we(w,1)):(w=_r(e),w.c(),we(w,1),w.m(t,null)):w&&(pe(),ye(w,1,1,(()=>{w=null})),ge());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)we(p[e]);we(w),we(l.$$.fragment,e),we(d.$$.fragment,e),u=!0}},o(e){p=p.filter(Boolean);for(let e=0;e<p.length;e+=1)ye(p[e]);ye(w),ye(l.$$.fragment,e),ye(d.$$.fragment,e),u=!1},d(e){e&&D(t),k(p,e),w&&w.d(),e&&D(s),e&&D(a),be(l),be(d),h=!1,$(f)}}}function yr(e){let t,n;return t=new Ll({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(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function vr(e){let t,n,r=br(!0,e[20]),i=r&&yr(e);return{c(){i&&i.c(),t=P()},m(e,r){i&&i.m(e,r),R(e,t,r),n=!0},p(e,n){1&n&&(r=br(!0,e[20])),r?i?(i.p(e,n),1&n&&we(i,1)):(i=yr(e),i.c(),we(i,1),i.m(t.parentNode,t)):i&&(pe(),ye(i,1,1,(()=>{i=null})),ge())},i(e){n||(we(i),n=!0)},o(e){ye(i),n=!1},d(e){i&&i.d(e),e&&D(t)}}}function _r(e){let t,n,r=e[0].list,i=[];for(let t=0;t<r.length;t+=1)i[t]=Ir(mr(e,r,t));const o=e=>ye(i[e],1,1,(()=>{i[e]=null}));return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=P()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);R(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=mr(e,r,s);i[s]?(i[s].p(o,n),we(i[s],1)):(i[s]=Ir(o),i[s].c(),we(i[s],1),i[s].m(t.parentNode,t))}for(pe(),s=r.length;s<i.length;s+=1)o(s);ge()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)we(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)ye(i[e]);n=!1},d(e){k(i,e),e&&D(t)}}}function Ir(e){let t,n,r,i;return t=new e[4]({props:{text:e[17].designation}}),r=new Lr({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(){Ee(t.$$.fragment),n=B(),Ee(r.$$.fragment)},m(e,o){Ae(t,e,o),R(e,n,o),Ae(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||(we(t.$$.fragment,e),we(r.$$.fragment,e),i=!0)},o(e){ye(t.$$.fragment,e),ye(r.$$.fragment,e),i=!1},d(e){be(t,e),e&&D(n),be(r,e)}}}function Cr(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function $r(e){let t;return{c(){t=M("Speichern")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Er(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Ar(e){let t,n,r,i={ctx:e,current:null,token:null,hasCatch:!1,pending:Er,then:wr,catch:gr,value:16,blocks:[,,,]};return ve(e[7](),i),{c(){t=B(),n=O("section"),i.block.c(),fr.title="Vorgaben",U(n,"class","sTask svelte-1phofh5")},m(e,o){R(e,t,o),R(e,n,o),i.block.m(n,i.anchor=null),i.mount=()=>n,i.anchor=null,r=!0},p(t,[n]){_e(i,e=t,n)},i(e){r||(we(i.block),r=!0)},o(e){for(let e=0;e<3;e+=1){ye(i.blocks[e])}r=!1},d(e){e&&D(t),e&&D(n),i.block.d(),i.token=null,i=null}}}const br=(e,{type:t="",properties:n={}})=>!e||"list"!==t&&("time"===n.format&&(t="time"),!["date","datetime","time"].includes(t)&&(!n.readonly&&!n.hidden));function Sr(e,r,o){let l,d,u;b(e,a,(e=>o(11,d=e))),b(e,i,(e=>o(12,u=e)));const{Divider:h,Button:f,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 ur(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&&o(0,g=e.schema),"record"in e&&o(1,w=e.record)},e.$$.update=()=>{4&e.$$.dirty&&o(3,l=v)},[g,w,v,l,h,f,y,async()=>{const e=await t.getEvent(g.id);if(e.trigger?.startOn&&!e.trigger?.startOn?.some((e=>"Manual"===e.type))&&o(2,v=!0),d.role?.length&&g.authorization?.length){const e=g.authorization.some((e=>u?.find((t=>t===e.role&&"edit"===e.activity))));o(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),s.success("Die Vorgaben wurden gespeichert.",2e3),_()}]}const{document:Tr}=Ie;function Nr(e,t,n){const r=e.slice();return r[28]=t[n],r}function Rr(e){let t,n;return t=new Ll({props:{classId:e[2],item:e[28],listName:e[1].name,eventId:e[3],record:e[0],disabled:e[4],required:e[5],currency:e[8]}}),t.$on("notify",e[14]),t.$on("defPrep",e[16]),t.$on("task",e[21]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};4&n[0]&&(r.classId=e[2]),2&n[0]&&(r.item=e[28]),2&n[0]&&(r.listName=e[1].name),8&n[0]&&(r.eventId=e[3]),1&n[0]&&(r.record=e[0]),16&n[0]&&(r.disabled=e[4]),32&n[0]&&(r.required=e[5]),256&n[0]&&(r.currency=e[8]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Dr(e){let t,n,r=br(e[7],e[28]),i=r&&Rr(e);return{c(){i&&i.c(),t=P()},m(e,r){i&&i.m(e,r),R(e,t,r),n=!0},p(e,n){130&n[0]&&(r=br(e[7],e[28])),r?i?(i.p(e,n),130&n[0]&&we(i,1)):(i=Rr(e),i.c(),we(i,1),i.m(t.parentNode,t)):i&&(pe(),ye(i,1,1,(()=>{i=null})),ge())},i(e){n||(we(i),n=!0)},o(e){ye(i),n=!1},d(e){i&&i.d(e),e&&D(t)}}}function kr(e){let t,n,r,i=e[1].item,o=[];for(let t=0;t<i.length;t+=1)o[t]=Dr(Nr(e,i,t));const s=e=>ye(o[e],1,1,(()=>{o[e]=null}));return{c(){t=O("div");for(let e=0;e<o.length;e+=1)o[e].c();U(t,"id",n=`accordion-content-${e[2]}-${e[1].name}`)},m(e,n){R(e,t,n);for(let e=0;e<o.length;e+=1)o[e].m(t,null);r=!0},p(e,a){if(82367&a[0]){let n;for(i=e[1].item,n=0;n<i.length;n+=1){const r=Nr(e,i,n);o[n]?(o[n].p(r,a),we(o[n],1)):(o[n]=Dr(r),o[n].c(),we(o[n],1),o[n].m(t,null))}for(pe(),n=i.length;n<o.length;n+=1)s(n);ge()}(!r||6&a[0]&&n!==(n=`accordion-content-${e[2]}-${e[1].name}`))&&U(t,"id",n)},i(e){if(!r){for(let e=0;e<i.length;e+=1)we(o[e]);r=!0}},o(e){o=o.filter(Boolean);for(let e=0;e<o.length;e+=1)ye(o[e]);r=!1},d(e){e&&D(t),k(o,e)}}}function Or(e){let t,n,r=e[13](e[9])+"";return{c(){t=O("span"),n=M(r)},m(e,r){R(e,t,r),N(t,n)},p(e,t){512&t[0]&&r!==(r=e[13](e[9])+"")&&H(n,r)},d(e){e&&D(t)}}}function xr(e){let t,n,r;return n=new e[10]({props:{$$slots:{default:[Or]},$$scope:{ctx:e}}}),n.$on("click",(function(){E(e[15](e[27]))&&e[15](e[27]).apply(this,arguments)})),{c(){t=O("div"),Ee(n.$$.fragment),U(t,"class","accordion svelte-148ktt9"),U(t,"slot","handle")},m(e,i){R(e,t,i),Ae(n,t,null),r=!0},p(t,r){e=t;const i={};512&r[0]|1&r[1]&&(i.$$scope={dirty:r,ctx:e}),n.$set(i)},i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function Mr(e){let t,n;return t=new e[12]({props:{open:e[6],$$slots:{handle:[xr,({toggle:e})=>({27:e}),({toggle:e})=>[e?134217728:0]],default:[kr,({toggle:e})=>({27:e}),({toggle:e})=>[e?134217728:0]]},$$scope:{ctx:e}}}),t.$on("panel-open",e[17]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};64&n[0]&&(r.open=e[6]),134218687&n[0]|1&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Br(e){let t,n,r;return n=new e[11]({props:{$$slots:{default:[Mr]},$$scope:{ctx:e}}}),{c(){t=O("div"),Ee(n.$$.fragment),U(t,"class","formList")},m(e,i){R(e,t,i),Ae(n,t,null),r=!0},p(e,t){const r={};1023&t[0]|1&t[1]&&(r.$$scope={dirty:t,ctx:e}),n.$set(r)},i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function Pr(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:h}=n,{disabled:f}=n,{required:w}=n,{open:y=!1}=n,{template:v={}}=n,{isTemplate:_=!1}=n,{currency:I}=n,{update:C=!1}=n,$=new Map;const E={};let A=d[a.name]||{};d[a.name]=A;const b=e=>E[e]?.split(" • ").filter((e=>!!e)).slice(0,2).join(" · "),S=e=>{if(!e)return;const{style:t,scrollHeight:n}=e;n&&(t.height=`${n}px`)};return e.$$set=e=>{"list"in e&&r(1,a=e.list),"schema"in e&&r(18,l=e.schema),"record"in e&&r(0,d=e.record),"classId"in e&&r(2,u=e.classId),"eventId"in e&&r(3,h=e.eventId),"disabled"in e&&r(4,f=e.disabled),"required"in e&&r(5,w=e.required),"open"in e&&r(6,y=e.open),"template"in e&&r(19,v=e.template),"isTemplate"in e&&r(7,_=e.isTemplate),"currency"in e&&r(8,I=e.currency),"update"in e&&r(20,C=e.update)},e.$$.update=()=>{1048579&e.$$.dirty[0]&&C&&d&&r(9,A=d[a.name]||{})},[d,a,u,h,f,w,y,_,I,A,i,o,s,e=>l.filter((t=>void 0!==e[t.name]&&"textarea"!==t.properties?.format&&"html"!==t.properties?.format)).map((t=>"object"===t.type?b(t.name):"boolean"===t.type?g(e[t.name]):"date"===t.type?m(e[t.name]):"datetime"===t.type?p(e[t.name]):e[t.name])).filter((e=>!!e)).join(" • ")||"+",({detail:e})=>{const[t,n]=e.itemName.split(".");if(!n)return;e.desc&&(E[n]=e.desc);const i=d[t];r(0,d[t]={...i,[n]:e.value},d),r(9,A=d[t])},e=>t=>{(()=>{const e=v[a.name]||{};for(const t in e)v[a.name][t]&&!d[a.name][t]&&r(0,d[a.name][t]=v[a.name][t],d)})(),e(t);const n=`#accordion-content-${u}-${a.name} > div.form-field:last-child`,i=document.querySelector(n);se().then((()=>{const e=`#accordion-content-${u}-${a.name} textarea`;Array.from(document.querySelectorAll(e)).forEach(S)})).then((()=>i.scrollIntoView({behavior:"smooth",block:"end"})))},async({detail:{className:e,itemName:n,value:r}})=>{if($.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&&$.set(e,o[0])},()=>{setTimeout((()=>{Array.from($).forEach((([e,t])=>{d[a.name][e]||r(0,d[a.name][e]=t._id,d)}))}),500)},l,v,C,function(t){Q(e,t)}]}class Lr extends Te{constructor(e){var t;super(),Tr.getElementById("svelte-148ktt9-style")||((t=O("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}}",N(Tr.head,t)),Se(this,e,Pr,Br,A,{list:1,schema:18,record:0,classId:2,eventId:3,disabled:4,required:5,open:6,template:19,isTemplate:7,currency:8,update:20},[-1,-1])}}const{document:Fr}=Ie;function Vr(e){e[0]=e[23].list,e[22]=e[23].items}function Ur(e,t,n){const r=e.slice();return r[24]=t[n],r}function Hr(e,t,n){const r=e.slice();return r[27]=t[n],r}function Wr(e,t,n){const r=e.slice();return r[27]=t[n],r}function zr(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function qr(e){let t,n,r,i,o,s,a,l,c,d,u,h,f,m,p,g,w,y;function v(t){e[19](t)}Vr(e),n=new e[7]({props:{outline:!0,$$slots:{default:[jr]},$$scope:{ctx:e}}}),n.$on("click",e[18]);let _={id:e[8]};void 0!==e[1]&&(_.value=e[1]),s=new e[6]({props:_}),ee.push((()=>$e(s,"value",v))),s.$on("input",e[12]),d=new tt({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]=Gr(Wr(e,r,t));return{c(){t=O("thead"),n=O("tr");for(let e=0;e<i.length;e+=1)i[e].c();U(n,"class","svelte-14hcfjl"),U(t,"class","svelte-14hcfjl")},m(e,r){R(e,t,r),N(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=Wr(e,r,o);i[o]?i[o].p(s,t):(i[o]=Gr(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&&D(t),k(i,e)}}}(e),C=e[0]?.length&&function(e){let t,n=e[0],r=[];for(let t=0;t<n.length;t+=1)r[t]=Zr(Ur(e,n,t));return{c(){for(let e=0;e<r.length;e+=1)r[e].c();t=P()},m(e,n){for(let t=0;t<r.length;t+=1)r[t].m(e,n);R(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=Ur(e,n,o);r[o]?r[o].p(s,i):(r[o]=Zr(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){k(r,e),e&&D(t)}}}(e);return{c(){t=O("div"),Ee(n.$$.fragment),r=B(),i=O("div"),o=M("Suchen: "),Ee(s.$$.fragment),l=B(),c=O("span"),Ee(d.$$.fragment),u=B(),h=O("div"),f=O("table"),I&&I.c(),m=B(),p=O("tbody"),C&&C.c(),U(t,"class","form--buttons svelte-14hcfjl"),U(c,"class","feather pointer svelte-14hcfjl"),z(i,"margin-bottom","1em"),z(i,"position","relative"),U(f,"striped",""),U(f,"class","svelte-14hcfjl"),U(h,"class","eList svelte-14hcfjl")},m(a,v){R(a,t,v),Ae(n,t,null),R(a,r,v),R(a,i,v),N(i,o),Ae(s,i,null),N(i,l),N(i,c),Ae(d,c,null),R(a,u,v),R(a,h,v),N(h,f),I&&I.m(f,null),N(f,m),N(f,p),C&&C.m(p,null),g=!0,w||(y=L(c,"click",e[14]),w=!0)},p(e,t){Vr(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],le((()=>a=!1))),s.$set(i),e[22]?.length&&I.p(e,t),e[0]?.length&&C.p(e,t)},i(e){g||(we(n.$$.fragment,e),we(s.$$.fragment,e),we(d.$$.fragment,e),g=!0)},o(e){ye(n.$$.fragment,e),ye(s.$$.fragment,e),ye(d.$$.fragment,e),g=!1},d(e){e&&D(t),be(n),e&&D(r),e&&D(i),be(s),be(d),e&&D(u),e&&D(h),I&&I.d(),C&&C.d(),w=!1,y()}}}function jr(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Gr(e){let t,n,r=e[27]?.designation+"";return{c(){t=O("th"),n=M(r),U(t,"class","svelte-14hcfjl")},m(e,r){R(e,t,r),N(t,n)},p:_,d(e){e&&D(t)}}}function Xr(e){let t,n,r=e[22],i=[];for(let t=0;t<r.length;t+=1)i[t]=Yr(Hr(e,r,t));return{c(){t=O("tr");for(let e=0;e<i.length;e+=1)i[e].c();n=B(),U(t,"class","pointer svelte-14hcfjl")},m(e,r){R(e,t,r);for(let e=0;e<i.length;e+=1)i[e].m(t,null);N(t,n)},p(e,o){if(3584&o[0]){let s;for(r=e[22],s=0;s<r.length;s+=1){const a=Hr(e,r,s);i[s]?i[s].p(a,o):(i[s]=Yr(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&&D(t),k(i,e)}}}function Yr(e){let t,n,r,i,o=e[9](e[24],e[27])+"";return{c(){t=O("td"),n=M(o),U(t,"class","svelte-14hcfjl")},m(o,s){R(o,t,s),N(t,n),r||(i=L(t,"click",V(e[10](e[24]))),r=!0)},p(t,n){e=t},d(e){e&&D(t),r=!1,i()}}}function Zr(e){let t,n=e[13](e[24],e[22],e[1]),r=n&&Xr(e);return{c(){r&&r.c(),t=P()},m(e,n){r&&r.m(e,n),R(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=Xr(e),r.c(),r.m(t.parentNode,t)):r&&(r.d(1),r=null)},d(e){r&&r.d(e),e&&D(t)}}}function Kr(e){let t,n;return t=new e[5]({}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p:_,i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Qr(e){let t,n,r,i;t=new e[4]({});let o={ctx:e,current:null,token:null,hasCatch:!1,pending:Kr,then:qr,catch:zr,value:23,blocks:[,,,]};return ve(e[11](),o),{c(){Ee(t.$$.fragment),n=B(),r=P(),o.block.c()},m(e,s){Ae(t,e,s),R(e,n,s),R(e,r,s),o.block.m(e,o.anchor=s),o.mount=()=>r.parentNode,o.anchor=r,i=!0},p(t,n){_e(o,e=t,n)},i(e){i||(we(t.$$.fragment,e),we(o.block),i=!0)},o(e){ye(t.$$.fragment,e);for(let e=0;e<3;e+=1){ye(o.blocks[e])}i=!1},d(e){be(t,e),e&&D(n),e&&D(r),o.block.d(e),o.token=null,o=null}}}function Jr(e){let t,n;return t=new e[3]({props:{title:"Auswahl",class:"eList",$$slots:{default:[Qr]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ei(e,n,r){const i=K(),{Dialog:o,Divider:s,Loading:a,TextField:l,Button:d}=c;let{item:u}=n,{className:h}=n,{classId:f}=n,{list:p}=n,w="",y=f+Math.floor(9e3*Math.random()+1e3).toString()+"search";const v=(e,t)=>{if(!t)return;const n=e[t.name];return"boolean"==typeof n?g(n):m(e[`_${t.name}`]||e[t.name]||"")},_=t.getSchemaByClass(h);Y((()=>{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,h=e.className),"classId"in e&&r(17,f=e.classId),"list"in e&&r(0,p=e.list)},[p,w,i,o,s,a,l,d,y,v,e=>()=>i("choose",{row:e}),async()=>{const e=await _,t=e.display;let n=await Xt(t,e,p);return{list:p,items:n}},({detail:{value:e}})=>{r(1,w=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,w="")},u,h,f,()=>i("back"),function(e){w=e,r(1,w)}]}class ti extends Te{constructor(e){var t;super(),Fr.getElementById("svelte-14hcfjl-style")||((t=O("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}",N(Fr.head,t)),Se(this,e,ei,Jr,A,{item:15,className:16,classId:17,list:0},[-1,-1])}}const{document:ni}=Ie;function ri(e,t,n){const r=e.slice();return r[11]=t[n],r}function ii(e,t,n){const r=e.slice();return r[3]=t[n],r}function oi(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function si(e){let t,n,r,i=e[7].items,o=[];for(let t=0;t<i.length;t+=1)o[t]=ui(ii(e,i,t));const s=e=>ye(o[e],1,1,(()=>{o[e]=null}));let a=e[7].list&&hi(e);return{c(){for(let e=0;e<o.length;e+=1)o[e].c();t=B(),a&&a.c(),n=P()},m(e,i){for(let t=0;t<o.length;t+=1)o[t].m(e,i);R(e,t,i),a&&a.m(e,i),R(e,n,i),r=!0},p(e,r){if(30327783&r[0]){let n;for(i=e[7].items,n=0;n<i.length;n+=1){const s=ii(e,i,n);o[n]?(o[n].p(s,r),we(o[n],1)):(o[n]=ui(s),o[n].c(),we(o[n],1),o[n].m(t.parentNode,t))}for(pe(),n=i.length;n<o.length;n+=1)s(n);ge()}e[7].list?a?(a.p(e,r),128&r[0]&&we(a,1)):(a=hi(e),a.c(),we(a,1),a.m(n.parentNode,n)):a&&(pe(),ye(a,1,1,(()=>{a=null})),ge())},i(e){if(!r){for(let e=0;e<i.length;e+=1)we(o[e]);we(a),r=!0}},o(e){o=o.filter(Boolean);for(let e=0;e<o.length;e+=1)ye(o[e]);ye(a),r=!1},d(e){k(o,e),e&&D(t),a&&a.d(e),e&&D(n)}}}function ai(e){let t,n,r,i;const o=[ci,li],s=[];function a(e,t){return e[3].name!==e[14]||e[15]?"lookup"!==e[3].properties?.format?1:-1:0}return~(t=a(e))&&(n=s[t]=o[t](e)),{c(){n&&n.c(),r=P()},m(e,n){~t&&s[t].m(e,n),R(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?~t&&s[t].p(e,i):(n&&(pe(),ye(s[l],1,1,(()=>{s[l]=null})),ge()),~t?(n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),we(n,1),n.m(r.parentNode,r)):n=null)},i(e){i||(we(n),i=!0)},o(e){ye(n),i=!1},d(e){~t&&s[t].d(e),e&&D(r)}}}function li(e){let t,n;return t=new Ll({props:{classId:e[8],item:e[3],record:e[6],disabled:e[3].name===e[14]&&e[15]||e[0],eventId:e[5],currency:e[2],changeValue:e[9]}}),t.$on("notify",e[17]),t.$on("multi",e[18]),t.$on("defPrep",e[19]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};256&n[0]&&(r.classId=e[8]),128&n[0]&&(r.item=e[3]),64&n[0]&&(r.record=e[6]),129&n[0]&&(r.disabled=e[3].name===e[14]&&e[15]||e[0]),32&n[0]&&(r.eventId=e[5]),4&n[0]&&(r.currency=e[2]),512&n[0]&&(r.changeValue=e[9]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ci(e){let t,n,r,i;n=new Ll({props:{classId:e[8],item:e[3],record:e[6],disabled:e[0]||!!e[1],required:!0,eventId:e[5],currency:e[2],changeValue:e[9]}}),n.$on("notify",e[17]),n.$on("multi",e[18]),n.$on("defPrep",e[19]),n.$on("record",e[23]),n.$on("objRecord",e[24]);let o=e[1]&&di(e);return{c(){t=O("div"),Ee(n.$$.fragment),r=B(),o&&o.c(),z(t,"padding-top",".25em"),z(t,"background-color","lightyellow"),z(t,"position","relative")},m(e,s){R(e,t,s),Ae(n,t,null),N(t,r),o&&o.m(t,null),i=!0},p(e,r){const i={};256&r[0]&&(i.classId=e[8]),128&r[0]&&(i.item=e[3]),64&r[0]&&(i.record=e[6]),3&r[0]&&(i.disabled=e[0]||!!e[1]),32&r[0]&&(i.eventId=e[5]),4&r[0]&&(i.currency=e[2]),512&r[0]&&(i.changeValue=e[9]),n.$set(i),e[1]?o?(o.p(e,r),2&r[0]&&we(o,1)):(o=di(e),o.c(),we(o,1),o.m(t,null)):o&&(pe(),ye(o,1,1,(()=>{o=null})),ge())},i(e){i||(we(n.$$.fragment,e),we(o),i=!0)},o(e){ye(n.$$.fragment,e),ye(o),i=!1},d(e){e&&D(t),be(n),o&&o.d()}}}function di(e){let t,n,r,i,o;return n=new tt({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather2 pointer svelte-16mo2c")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[22]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function ui(e){let t,n,r="list"!==e[3].type&&ai(e);return{c(){r&&r.c(),t=P()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,n){"list"!==e[3].type?r?(r.p(e,n),128&n[0]&&we(r,1)):(r=ai(e),r.c(),we(r,1),r.m(t.parentNode,t)):r&&(pe(),ye(r,1,1,(()=>{r=null})),ge())},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function hi(e){let t,n,r=e[7].list,i=[];for(let t=0;t<r.length;t+=1)i[t]=mi(ri(e,r,t));const o=e=>ye(i[e],1,1,(()=>{i[e]=null}));return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=P()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);R(e,t,r),n=!0},p(e,n){if(485&n[0]){let s;for(r=e[7].list,s=0;s<r.length;s+=1){const o=ri(e,r,s);i[s]?(i[s].p(o,n),we(i[s],1)):(i[s]=mi(o),i[s].c(),we(i[s],1),i[s].m(t.parentNode,t))}for(pe(),s=r.length;s<i.length;s+=1)o(s);ge()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)we(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)ye(i[e]);n=!1},d(e){k(i,e),e&&D(t)}}}function fi(e){let t,n,r,i;return t=new e[12]({props:{text:e[11].designation}}),r=new Lr({props:{classId:e[8],list:e[11],eventId:e[5],schema:e[11].item,record:e[6],disabled:e[0],currency:e[2],update:!0}}),{c(){Ee(t.$$.fragment),n=B(),Ee(r.$$.fragment)},m(e,o){Ae(t,e,o),R(e,n,o),Ae(r,e,o),i=!0},p(e,n){const i={};128&n[0]&&(i.text=e[11].designation),t.$set(i);const o={};256&n[0]&&(o.classId=e[8]),128&n[0]&&(o.list=e[11]),32&n[0]&&(o.eventId=e[5]),128&n[0]&&(o.schema=e[11].item),64&n[0]&&(o.record=e[6]),1&n[0]&&(o.disabled=e[0]),4&n[0]&&(o.currency=e[2]),r.$set(o)},i(e){i||(we(t.$$.fragment,e),we(r.$$.fragment,e),i=!0)},o(e){ye(t.$$.fragment,e),ye(r.$$.fragment,e),i=!1},d(e){be(t,e),e&&D(n),be(r,e)}}}function mi(e){let t,n,r="array"!==e[11].type&&fi(e);return{c(){r&&r.c(),t=P()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,n){"array"!==e[11].type?r?(r.p(e,n),128&n[0]&&we(r,1)):(r=fi(e),r.c(),we(r,1),r.m(t.parentNode,t)):r&&(pe(),ye(r,1,1,(()=>{r=null})),ge())},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function pi(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function gi(e){let t,n;return t=new ti({props:{item:e[3],className:e[4],classId:e[8],list:e[11]}}),t.$on("choose",e[20]),t.$on("back",e[21]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};8&n[0]&&(r.item=e[3]),16&n[0]&&(r.className=e[4]),256&n[0]&&(r.classId=e[8]),2048&n[0]&&(r.list=e[11]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function wi(e){let t,n,r=e[10]&&gi(e);return{c(){r&&r.c(),t=P()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,n){e[10]?r?(r.p(e,n),1024&n[0]&&we(r,1)):(r=gi(e),r.c(),we(r,1),r.m(t.parentNode,t)):r&&(pe(),ye(r,1,1,(()=>{r=null})),ge())},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function yi(e){let t,n,r,i,o,s,a={ctx:e,current:null,token:null,hasCatch:!1,pending:pi,then:si,catch:oi,value:54,blocks:[,,,]};function l(t){e[30](t)}ve(e[16](),a),n=new e[12]({});let c={class:"tModal",noClickaway:!0,$$slots:{default:[wi]},$$scope:{ctx:e}};return void 0!==e[10]&&(c.open=e[10]),i=new e[13]({props:c}),ee.push((()=>$e(i,"open",l))),{c(){a.block.c(),t=B(),Ee(n.$$.fragment),r=B(),Ee(i.$$.fragment)},m(e,o){a.block.m(e,a.anchor=o),a.mount=()=>t.parentNode,a.anchor=t,R(e,t,o),Ae(n,e,o),R(e,r,o),Ae(i,e,o),s=!0},p(t,n){_e(a,e=t,n);const r={};3352&n[0]|268435456&n[1]&&(r.$$scope={dirty:n,ctx:e}),!o&&1024&n[0]&&(o=!0,r.open=e[10],le((()=>o=!1))),i.$set(r)},i(e){s||(we(a.block),we(n.$$.fragment,e),we(i.$$.fragment,e),s=!0)},o(e){for(let e=0;e<3;e+=1){ye(a.blocks[e])}ye(n.$$.fragment,e),ye(i.$$.fragment,e),s=!1},d(e){a.block.d(e),a.token=null,a=null,e&&D(t),be(n,e),e&&D(r),be(i,e)}}}function vi(e,n,r){const{Divider:i,FormField:o,Modal:s}=c,a=K();let l,d,u,h,f,{required:m}=n,{disabled:p}=n,{readonly:g}=n,{id:w}=n,{item:y}=n,{value:v}=n,{refValue:_}=n,{currency:I}=n,C={},$=[],E=[],A={},b=new Map,S=!1,T="";const N=y.checkOn,R=v,D=e=>{l.items.filter((t=>"object"==typeof(t.properties&&t.properties[e]))).map((t=>{const n=t.properties[e].refItem||"",[r,i]=n.split(".");$.push({action:e,itemName:t.name,refObj:r,refName:i,op:t.properties[e].invert?"!":""})}))},k=()=>{l.items.filter((e=>e.lookup)).forEach((e=>{E.push({name:e.name,lookup:e.lookup})})),l.items.filter((e=>e.properties?.lookup)).forEach((e=>{E.push({name:e.name,lookup:e.properties.lookup.split(":").at(-1)})}))},O=async e=>{const t=$.filter((t=>t.refObj===e));if(t?.length){r(9,A={});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 fh(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(9,A[t]="",A))}}};Y((()=>{x()}));const x=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.add(t.refObj||u);Array.from(e).forEach((e=>O(e)))})(),M())},M=()=>{setTimeout((()=>{Array.from(b).forEach((([e,t])=>{C[e]||r(6,C[e]=t._id,C)}))}),250)},B=async e=>{if(!e.value)return void L();const n={[e.itemName]:{$regex:`(?i)${e.value}`}},i=await t.getSectionView(u,n);i?.length?(r(11,T=i),r(10,S=!0)):(r(1,v=""),r(25,_=""),a("setRefValue",_))},P=()=>{r(10,S=!1)},L=()=>{r(1,v=""),r(25,_=v),r(6,C={}),a("setRefValue",_)};return e.$$set=e=>{"required"in e&&r(26,m=e.required),"disabled"in e&&r(0,p=e.disabled),"readonly"in e&&r(27,g=e.readonly),"id"in e&&r(28,w=e.id),"item"in e&&r(3,y=e.item),"value"in e&&r(1,v=e.value),"refValue"in e&&r(25,_=e.refValue),"currency"in e&&r(2,I=e.currency)},e.$$.update=()=>{134217729&e.$$.dirty[0]&&r(0,p=p||g),536871024&e.$$.dirty[0]&&C&&a("safeReference",{record:C,class:u,event:h,taskId:f})},[p,v,I,y,u,h,C,l,d,A,S,T,i,s,N,R,async()=>{try{if(v){const e=await t.getTask(y.refClass,v);delete e._task,r(6,C=e),r(29,f=(await t.getTaskByDocId(e._id,!0))._id)}else r(6,C={})}catch{}return r(7,l=await t.getSchemaByClass(y.refClass)),r(8,d="form-"+l.class+Math.floor(9e3*Math.random()+1e3).toString()),r(4,u=l.class),l.identity.designation,r(5,h=l.id),["readonly","hidden","required"].map(D),k(),!0},async({detail:e})=>{const{itemName:t,value:n}=e;if(r(6,C[t]=n,C),t===N)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(6,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(6,C[e]=o,C)}}},async({detail:{className:e,itemName:n,value:r}})=>{if(b.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&&b.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(25,_=v),a("setRefValue",_),r(6,C=n[0])),P()},P,L,({detail:e})=>{r(6,C[e.itemName]=e.value,C)},({detail:e})=>{for(const t of e.items)r(6,C[e.listName][t.name]=t.value,C)},_,m,g,w,f,function(e){S=e,r(10,S)}]}class _i extends Te{constructor(e){var t;super(),ni.getElementById("svelte-16mo2c-style")||((t=O("style")).id="svelte-16mo2c-style",t.textContent=".feather2.svelte-16mo2c{position:absolute;top:1em;right:0.5em;color:#4300b0}",N(ni.head,t)),Se(this,e,vi,yi,A,{required:26,disabled:0,readonly:27,id:28,item:3,value:1,refValue:25,currency:2},[-1,-1])}}function Ii(e){let t,n;return{c(){t=O("span"),n=M(e[4]),U(t,"class","item")},m(e,r){R(e,t,r),N(t,n)},p(e,t){16&t[0]&&H(n,e[4])},d(e){e&&D(t)}}}function Ci(e){let t,n,r,i=e[6]&&Ii(e),o=e[14]&&function(e){let t,n,r,i,o;return n=new Pe({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"title","Übernehmen"),U(t,"class","pointer feather svelte-1fuww0c")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[17]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}(e);return{c(){i&&i.c(),t=B(),o&&o.c(),n=P()},m(e,s){i&&i.m(e,s),R(e,t,s),o&&o.m(e,s),R(e,n,s),r=!0},p(e,n){e[6]?i?i.p(e,n):(i=Ii(e),i.c(),i.m(t.parentNode,t)):i&&(i.d(1),i=null),e[14]&&o.p(e,n)},i(e){r||(we(o),r=!0)},o(e){ye(o),r=!1},d(e){i&&i.d(e),e&&D(t),o&&o.d(e),e&&D(n)}}}function $i(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[5],$$slots:{default:[Ci]},$$scope:{ctx:e}}}),n.$on("change",e[15]),n.$on("focus",e[16]),{c(){t=O("div"),Ee(n.$$.fragment),z(t,"position","relative"),z(t,"max-width","10em")},m(e,i){R(e,t,i),Ae(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]),32&t[0]&&(r.required=e[5]),80&t[0]|32&t[1]&&(r.$$scope={dirty:t,ctx:e}),n.$set(r)},i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function Ei(e,t,r){const i=K(),{TextField:o}=c;let{id:s}=t,{item:a}=t,{value:l}=t,{noForm:d=!1}=t,{classId:u}=t,{disabled:h}=t,{formnovalidate:f}=t,{currency:m}=t,{praefix:p}=t,{notifyList:g}=t;const w=JSON.parse(n.getItem("Locale"));let y=["price","amount","amountValue","taxValue","total","__total"].find((e=>e===a.name?.split("-")[0]))||a.properties?.currency;!1===a.properties?.currency&&(y=!1);const v=Number("1.1").toLocaleString(w.id).substring(1,2),{properties:_={}}=a;let{min:I,max:C,step:$,pattern:E,decimals:A=0,unit:b="",placeholder:S,hint:T,readonly:N,negative:R,required:D=!1,transfer:k}=_,O="";l=l?Number(l.toString().replace(",",".")):0,N=!0===N||void 0;const x=e=>Number(e.toString()).toFixed(A).toString().replace(".",v);E||(E=A?`[0-9]+([${v}][0-9]{1,${A}})?`:"[0-9]*"),R&&(E="-?"+E);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,h=e.disabled),"formnovalidate"in e&&r(20,f=e.formnovalidate),"currency"in e&&r(4,m=e.currency),"praefix"in e&&r(21,p=e.praefix),"notifyList"in e&&r(22,g=e.notifyList)},e.$$.update=()=>{1048608&e.$$.dirty[0]&&r(5,D=D&&!f),262144&e.$$.dirty[0]&&(e=>{r(9,O=x(e.toString().replace(",",".")))})(l),4194304&e.$$.dirty[0]&&(async()=>{const e=a.properties?.value?.formula;if(e)void 0!==p&&""!==p?e?.operator?.multiply&&i("formula",{item:a}):e?.operator&&i("formula",{item:a})})()},[s,d,u,h,m,D,y,E,N,O,o,w,$,S,k,({detail:e})=>i("blur",{value:x(e.value)}),({detail:e})=>{N||+l||r(9,O="")},({detail:e})=>{const t=[].concat(k.target);for(const e of t)i("record",{itemName:e,value:l}),i("listRecord",{itemName:e,decimals:a.properties?.decimals,value:l})},l,a,f,p,g]}class Ai extends Te{constructor(e){var t;super(),document.getElementById("svelte-1fuww0c-style")||((t=O("style")).id="svelte-1fuww0c-style",t.textContent=".feather.svelte-1fuww0c{position:absolute;top:0.75em;right:-1em;color:#4300b0}",N(document.head,t)),Se(this,e,Ei,$i,A,{id:0,item:19,value:18,noForm:1,classId:2,disabled:3,formnovalidate:20,currency:4,praefix:21,notifyList:22},[-1,-1])}}const{document:bi}=Ie;function Si(e){e[34]=e[36].list,e[35]=e[36].items}function Ti(e,t,n){const r=e.slice();return r[37]=t[n],r[39]=n,r}function Ni(e,t,n){const r=e.slice();return r[40]=t[n],r[42]=n,r}function Ri(e,t,n){const r=e.slice();return r[40]=t[n],r}function Di(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function ki(e){let t,n,r,i,o,s,a,l,c,d,u,h,f,m,p,g,w,y,v;Si(e),n=new e[9]({props:{outline:!0,$$slots:{default:[Oi]},$$scope:{ctx:e}}}),n.$on("click",e[31]);let _=!e[2]&&xi(e);function I(t){e[32](t)}let C={id:e[12]};void 0!==e[3]&&(C.value=e[3]),a=new e[7]({props:C}),ee.push((()=>$e(a,"value",I))),a.$on("input",e[15]),u=new tt({props:{size:"18"}});let $=e[35]?.length&&function(e){let t,n,r,i,o=!e[2]&&Bi(e),s=e[35],a=[];for(let t=0;t<s.length;t+=1)a[t]=Pi(Ri(e,s,t));return{c(){t=O("thead"),n=O("tr"),o&&o.c(),r=B();for(let e=0;e<a.length;e+=1)a[e].c();U(n,"class","svelte-1m010ne"),U(t,"class","svelte-1m010ne")},m(e,s){R(e,t,s),N(t,n),o&&o.m(n,null),N(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&&(pe(),ye(o,1,1,(()=>{o=null})),ge()):o?(o.p(e,t),4&t[0]&&we(o,1)):(o=Bi(e),o.c(),we(o,1),o.m(n,r)),16384&t[0]){let r;for(s=e[35],r=0;r<s.length;r+=1){const i=Ri(e,s,r);a[r]?a[r].p(i,t):(a[r]=Pi(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||(we(o),i=!0)},o(e){ye(o),i=!1},d(e){e&&D(t),o&&o.d(),k(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]=Hi(Ti(e,r,t));const o=e=>ye(i[e],1,1,(()=>{i[e]=null}));return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=P()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);R(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=Ti(e,r,s);i[s]?(i[s].p(o,n),we(i[s],1)):(i[s]=Hi(o),i[s].c(),we(i[s],1),i[s].m(t.parentNode,t))}for(pe(),s=r.length;s<i.length;s+=1)o(s);ge()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)we(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)ye(i[e]);n=!1},d(e){k(i,e),e&&D(t)}}}(e);return{c(){t=O("div"),Ee(n.$$.fragment),r=B(),_&&_.c(),i=B(),o=O("div"),s=M("Suchen: "),Ee(a.$$.fragment),c=B(),d=O("span"),Ee(u.$$.fragment),h=B(),f=O("div"),m=O("table"),$&&$.c(),p=B(),g=O("tbody"),E&&E.c(),U(t,"class","form--buttons svelte-1m010ne"),U(d,"class","feather pointer svelte-1m010ne"),z(o,"margin-bottom","1em"),z(o,"position","relative"),U(m,"striped",""),U(m,"class","svelte-1m010ne"),U(f,"class","eList svelte-1m010ne")},m(l,I){R(l,t,I),Ae(n,t,null),N(t,r),_&&_.m(t,null),R(l,i,I),R(l,o,I),N(o,s),Ae(a,o,null),N(o,c),N(o,d),Ae(u,d,null),R(l,h,I),R(l,f,I),N(f,m),$&&$.m(m,null),N(m,p),N(m,g),E&&E.m(g,null),w=!0,y||(v=L(d,"click",e[17]),y=!0)},p(e,r){Si(e);const i={};16384&r[1]&&(i.$$scope={dirty:r,ctx:e}),n.$set(i),e[2]?_&&(pe(),ye(_,1,1,(()=>{_=null})),ge()):_?(_.p(e,r),4&r[0]&&we(_,1)):(_=xi(e),_.c(),we(_,1),_.m(t,null));const o={};!l&&8&r[0]&&(l=!0,o.value=e[3],le((()=>l=!1))),a.$set(o),e[35]?.length&&$.p(e,r),e[34]?.length&&E.p(e,r)},i(e){w||(we(n.$$.fragment,e),we(_),we(a.$$.fragment,e),we(u.$$.fragment,e),we($),we(E),w=!0)},o(e){ye(n.$$.fragment,e),ye(_),ye(a.$$.fragment,e),ye(u.$$.fragment,e),ye($),ye(E),w=!1},d(e){e&&D(t),be(n),_&&_.d(),e&&D(i),e&&D(o),be(a),be(u),e&&D(h),e&&D(f),$&&$.d(),E&&E.d(),y=!1,v()}}}function Oi(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function xi(e){let t,n;return t=new e[9]({props:{disabled:!e[34].length,filled:!0,$$slots:{default:[Mi]},$$scope:{ctx:e}}}),t.$on("click",e[18](e[34])),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Mi(e){let t;return{c(){t=M("Bestätigen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Bi(e){let t,n,r,i,o;return n=new je({props:{size:"20"}}),{c(){t=O("th"),Ee(n.$$.fragment),U(t,"class","svelte-1m010ne")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[19](e[34])),i=!0)},p(t,n){e=t},i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function Pi(e){let t,n,r=e[40]+"";return{c(){t=O("th"),n=M(r),U(t,"class","svelte-1m010ne")},m(e,r){R(e,t,r),N(t,n)},p:_,d(e){e&&D(t)}}}function Li(e){let t,n,r,i,o,s,a,l=e[0],c=Vi(e),d=e[35],u=[];for(let t=0;t<d.length;t+=1)u[t]=Ui(Ni(e,d,t));return{c(){t=O("tr"),c.c(),n=B();for(let e=0;e<u.length;e+=1)u[e].c();r=B(),U(t,"style",i=e[2]?"cursor: default;":"cursor: zoom-in;"),U(t,"title","übernimmt den Wert direkt"),U(t,"class","svelte-1m010ne"),q(t,"active",e[0].includes(Array.isArray(e[37])?e[37][0]:e[37]))},m(i,l){R(i,t,l),c.m(t,null),N(t,n);for(let e=0;e<u.length;e+=1)u[e].m(t,null);N(t,r),o=!0,s||(a=L(t,"click",e[20](e[37])),s=!0)},p(s,a){if(e=s,1&a[0]&&A(l,l=e[0])?(pe(),ye(c,1,1,_),ge(),c=Vi(e),c.c(),we(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=Ni(e,d,n);u[n]?u[n].p(i,a):(u[n]=Ui(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;"))&&U(t,"style",i),16385&a[0]&&q(t,"active",e[0].includes(Array.isArray(e[37])?e[37][0]:e[37]))},i(e){o||(we(c),o=!0)},o(e){ye(c),o=!1},d(e){e&&D(t),c.d(e),k(u,e),s=!1,a()}}}function Fi(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=O("td"),Ee(n.$$.fragment),U(t,"title","Wählt den Wert aus"),U(t,"class","svelte-1m010ne")},m(e,i){R(e,t,i),Ae(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||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function Vi(e){let t,n,r=!e[2]&&Fi(e);return{c(){r&&r.c(),t=P()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,n){e[2]?r&&(pe(),ye(r,1,1,(()=>{r=null})),ge()):r?(r.p(e,n),4&n[0]&&we(r,1)):(r=Fi(e),r.c(),we(r,1),r.m(t.parentNode,t))},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function Ui(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=O("td"),n=M(r),U(t,"class","svelte-1m010ne")},m(e,r){R(e,t,r),N(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&&D(t)}}}function Hi(e){let t,n,r=e[16](e[37],e[3]),i=r&&Li(e);return{c(){i&&i.c(),t=P()},m(e,r){i&&i.m(e,r),R(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]&&we(i,1)):(i=Li(e),i.c(),we(i,1),i.m(t.parentNode,t)):i&&(pe(),ye(i,1,1,(()=>{i=null})),ge())},i(e){n||(we(i),n=!0)},o(e){ye(i),n=!1},d(e){i&&i.d(e),e&&D(t)}}}function Wi(e){let t,n;return t=new e[6]({}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p:_,i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function zi(e){let t,n,r,i;t=new e[10]({});let o={ctx:e,current:null,token:null,hasCatch:!1,pending:Wi,then:ki,catch:Di,value:36,blocks:[,,,]};return ve(e[14](),o),{c(){Ee(t.$$.fragment),n=B(),r=P(),o.block.c()},m(e,s){Ae(t,e,s),R(e,n,s),R(e,r,s),o.block.m(e,o.anchor=s),o.mount=()=>r.parentNode,o.anchor=r,i=!0},p(t,n){_e(o,e=t,n)},i(e){i||(we(t.$$.fragment,e),we(o.block),i=!0)},o(e){ye(t.$$.fragment,e);for(let e=0;e<3;e+=1){ye(o.blocks[e])}i=!1},d(e){be(t,e),e&&D(n),e&&D(r),o.block.d(e),o.token=null,o=null}}}function qi(e){let t,n;return t=new e[8]({props:{title:e[1]||"Auswahl",class:"eList",$$slots:{default:[zi]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ji(e,n,r){const i=K(),{Loading:o,TextField:s,Dialog:a,Button:l,Divider:d,Checkbox:u}=c;let{classId:h}=n,{id:f}=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:C}=n,{status:$}=n,{single:E}=n;p||=[];let A="",b=h+Math.floor(9e3*Math.random()+1e3).toString()+"search",S=[];const T=w+y+v+"checkbox",N=(e,t)=>e>t?1:t>e?-1:0;Y((()=>{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,h=e.classId),"id"in e&&r(23,f=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,C=e.uniqueView),"status"in e&&r(30,$=e.status),"single"in e&&r(2,E=e.single)},[p,m,E,A,S,i,o,s,a,l,d,u,b,T,async()=>{let e=[],n=[],i={};if(r(4,S=[]),y)if(_){if(f){const n=h.split("-")[1].slice(0,-4),r="input."+h+"[name='_id']",o=document.querySelector(r).value;i={[y]:f},$&&(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 N(r(e),r(t))}))}}else C?f&&(i={[y]:f,status:!0},Object.entries(C).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 N(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,f,I),e=e.sort(((e,t)=>N(e,t)))):(e=await t.getSection(w,y,f,!1,$),e=e.sort(((e,t)=>{const n=e=>(p.includes(e[v])?"0-":"1-")+e[v];return N(n(e),n(t))})));else i={},f&&!Array.isArray(f)&&(i._id=f),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(T),n=[];t.forEach(((t,r)=>{t.checked&&n.push(e[+t.attributes.data.value])})),i("choose",{list:n})},e=>()=>{document.getElementsByName(T).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,h,f,g,w,y,_,I,C,$,()=>i("back"),function(e){A=e,r(3,A)}]}class Gi extends Te{constructor(e){var t;super(),bi.getElementById("svelte-1m010ne-style")||((t=O("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}",N(bi.head,t)),Se(this,e,ji,qi,A,{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:Xi}=Ie;function Yi(e){let t,n,r,i,o,s=e[7].length+"";return{c(){t=O("span"),n=M("("),r=M(s),i=M(")"),U(t,"class",o=S(e[1]?"showNumber disabled":"showNumber")+" svelte-1rbaejz")},m(e,o){R(e,t,o),N(t,n),N(t,r),N(t,i)},p(e,n){128&n[0]&&s!==(s=e[7].length+"")&&H(r,s),2&n[0]&&o!==(o=S(e[1]?"showNumber disabled":"showNumber")+" svelte-1rbaejz")&&U(t,"class",o)},d(e){e&&D(t)}}}function Zi(e){let t;return{c(){t=O("div"),U(t,"class","load-more-options"),U(t,"slot","load-more-options-message")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Ki(e){let t,n,r,i;const o=[eo,Ji,Qi],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=P()},m(e,n){~t&&s[t].m(e,n),R(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?~t&&s[t].p(e,i):(n&&(pe(),ye(s[l],1,1,(()=>{s[l]=null})),ge()),~t?(n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),we(n,1),n.m(r.parentNode,r)):n=null)},i(e){i||(we(n),i=!0)},o(e){ye(n),i=!1},d(e){~t&&s[t].d(e),e&&D(r)}}}function Qi(e){let t,n,r,i,o;return n=new Pe({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"title","Übernehmen"),U(t,"class","feather pointer svelte-1rbaejz")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[26]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function Ji(e){let t,n,r,i,o;return n=new Ye({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"title",e[17].title||"Generieren"),U(t,"class","feather pointer svelte-1rbaejz")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[25]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function eo(e){let t,n,r,i,o;return n=new tt({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"title","Löschen"),U(t,"class","feather pointer svelte-1rbaejz")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[27]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function to(e){let t,n,r;function i(t){e[37](t)}let o={class:"tModal",noClickaway:!0,$$slots:{default:[no]},$$scope:{ctx:e}};return void 0!==e[10]&&(o.open=e[10]),t=new e[11]({props:o}),ee.push((()=>$e(t,"open",i))),{c(){Ee(t.$$.fragment)},m(e,n){Ae(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],le((()=>n=!1))),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function no(e){let t,n;return t=new Gi({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(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ro(e){let t,n,r,i,o,s,a,l,c,d=!e[16].single&&e[7]?.length&&Yi(e);function u(t){e[35](t)}function h(t){e[36](t)}let f={id:e[3],name:e[3],class:e[3],readonly:e[13],disabled:e[1],required:e[6],placeholder:e[8],getOptions:io,minSearchLength:"3",$$slots:{"load-more-options-message":[Zi]},$$scope:{ctx:e}};void 0!==e[7]&&(f.selection=e[7]),void 0!==e[9]&&(f.maxOptions=e[9]),r=new e[12]({props:f}),ee.push((()=>$e(r,"selection",u))),ee.push((()=>$e(r,"maxOptions",h))),r.$on("change",e[22]);let m=!e[1]&&Ki(e),p=e[10]&&to(e);return{c(){t=O("div"),d&&d.c(),n=B(),Ee(r.$$.fragment),s=B(),m&&m.c(),a=B(),p&&p.c(),l=P(),z(t,"position","relative")},m(e,i){R(e,t,i),d&&d.m(t,null),N(t,n),Ae(r,t,null),N(t,s),m&&m.m(t,null),R(e,a,i),p&&p.m(e,i),R(e,l,i),c=!0},p(e,s){!e[16].single&&e[7]?.length?d?d.p(e,s):(d=Yi(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],le((()=>i=!1))),!o&&512&s[0]&&(o=!0,a.maxOptions=e[9],le((()=>o=!1))),r.$set(a),e[1]?m&&(pe(),ye(m,1,1,(()=>{m=null})),ge()):m?(m.p(e,s),2&s[0]&&we(m,1)):(m=Ki(e),m.c(),we(m,1),m.m(t,null)),e[10]?p?(p.p(e,s),1024&s[0]&&we(p,1)):(p=to(e),p.c(),we(p,1),p.m(l.parentNode,l)):p&&(pe(),ye(p,1,1,(()=>{p=null})),ge())},i(e){c||(we(r.$$.fragment,e),we(m),we(p),c=!0)},o(e){ye(r.$$.fragment,e),ye(m),ye(p),c=!1},d(e){e&&D(t),d&&d.d(),be(r),m&&m.d(),e&&D(a),p&&p.d(e),e&&D(l)}}}async function*io(e){yield[{name:e}]}function oo(e,n,r){const i=K(),{Modal:o,Autocomplete:s}=c;let{classId:a}=n,{id:l}=n,{item:d}=n,{record:u}=n,{value:h}=n,{noForm:f=!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:C,hint:$,readonly:E,required:A=!1,lookup:b="",view:S=!1,multi:T,max:N=1e3,generate:R=!1,status:D=!0,refDoc:k}=I;const[O,x]=b.split(":");let M=!1,B=h.map&&h.map((e=>({name:e})))||[];m||=E,m&&(C="");const P=({detail:e})=>{let t=[];e.value.map((e=>{const n=e.name?.split(",");t=t.concat(n)})),r(7,B=t.map((e=>({name:e.trim()}))));const n=B.map((e=>e.name));i("blur",{value:n}),i("multi",{view:T.view,lookup:b,name:d.name,value:n})};Y((async()=>{i("multi",{view:T.view,lookup:b,name:d.name,value:h});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||N;(T.unique||B.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,B=t.map((e=>({name:e})))),i("blur",{value:t}),i("multi",{view:T.view,lookup:b,name:d.name,value:t}),F()},U=async()=>{const e={[x]:u[x]},n=await t.getSectionView(O,e),r=Array.from({length:n.length},((e,t)=>n[t][d.name]));V({detail:{name:d.name,list:r}})},H=(e=!1)=>{if(m||!T.required)return;const t=T.maxItem;if(!t||T.unique)return;r(9,N=!1!==e?e:v||u[t]||0);const n=B?.length!=N,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,h=e.value),"noForm"in e&&r(28,f=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,B=[]),48&e.$$.dirty[0]&&u&&Array.isArray(u[d.name])&&r(7,B=u[d.name].map((e=>({name:e})))),16&e.$$.dirty[0]|2&e.$$.dirty[1]&&y&&y===d.name&&r(7,B=[]),128&e.$$.dirty[0]&&B&&(r(0,h=B.map&&B.map((e=>e.name))||[]),H()),1073741824&e.$$.dirty[0]&&((e={})=>{const{item:t,value:n,idx:r}=e;void 0!==w&&w!==r||t&&t.name===T.maxItem&&H(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,B=[]);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,B=l.map((e=>({name:e})))),P({detail:{value:B}})}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,B=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,B=[]);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,B=l.map((e=>({name:e})))),P({detail:{value:B}})}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,B=l&&l.map((e=>({name:e}))))}}setTimeout(H,250)}})(_)},[h,m,a,l,d,u,A,B,C,N,M,o,s,E,b,S,T,R,D,k,O,x,P,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[T.maxItem];if(!e)return;let n={};x&&(n={[x]:u[x]}),D&&(n.status=!0);const r=[].concat(u[T.view]||[]);r.length&&(n[T.view]={$in:r});const i=await t.getSectionView(O,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:[]}})},f,p,g,w,y,v,_,function(e){B=e,r(7,B),r(5,u),r(4,d),r(32,y)},function(e){N=e,r(9,N)},function(e){M=e,r(10,M)}]}class so extends Te{constructor(e){var t;super(),Xi.getElementById("svelte-1rbaejz-style")||((t=O("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}",N(Xi.head,t)),Se(this,e,oo,ro,A,{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 ao(e){let t,n,r;return n=new vt({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather2 svelte-9up2nn")},m(e,i){R(e,t,i),Ae(n,t,null),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function lo(e){let t,n,r,i,o;return n=new vt({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather pointer svelte-9up2nn")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[9]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function co(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=[lo,ao],l=[];function c(e,t){return e[7]?0:1}return i=c(e),o=l[i]=a[i](e),{c(){t=O("div"),Ee(n.$$.fragment),r=B(),o.c(),z(t,"position","relative")},m(e,o){R(e,t,o),Ae(n,t,null),N(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):(pe(),ye(l[d],1,1,(()=>{l[d]=null})),ge(),o=l[i],o?o.p(e,r):(o=l[i]=a[i](e),o.c()),we(o,1),o.m(t,null))},i(e){s||(we(n.$$.fragment,e),we(o),s=!0)},o(e){ye(n.$$.fragment,e),ye(o),s=!1},d(e){e&&D(t),be(n),l[i].d()}}}const uo=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 ho(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:h}=t,{record:f}=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,h=e.value),"record"in e&&n(10,f=e.record),"item"in e&&n(11,m=e.item)},[i,o,s,a,l,d,u,h,r,async()=>{if(!h)return;const e=u.includes(".")?f[u.split(".")[0]]:f,t=await uo(e);window.open(t,"_blank")},f,m,function(t){Q(e,t)}]}class fo extends Te{constructor(e){var t;super(),document.getElementById("svelte-9up2nn-style")||((t=O("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}",N(document.head,t)),Se(this,e,ho,co,A,{inputClass:0,disabled:1,formnovalidate:2,readonly:3,required:4,id:5,name:6,value:7,record:10,item:11})}}const{document:mo}=Ie;function po(e){let t;return{c(){t=O("div"),U(t,"class","load-more-options"),U(t,"slot","load-more-options-message")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function go(e){let t,n,r;return n=new vt({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather2 svelte-wpjws5")},m(e,i){R(e,t,i),Ae(n,t,null),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function wo(e){let t,n,r,i,o;return n=new vt({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather pointer svelte-wpjws5")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[8]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function yo(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":[po]},$$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}),ee.push((()=>$e(n,"value",l))),ee.push((()=>$e(n,"selection",c))),ee.push((()=>$e(n,"searchQuery",d))),n.$on("change",e[6]);let h=e[5]&&function(e){let t,n,r,i;const o=[wo,go],s=[];function a(e,t){return e[0]?0:1}return t=a(e),n=s[t]=o[t](e),{c(){n.c(),r=P()},m(e,n){s[t].m(e,n),R(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?s[t].p(e,i):(pe(),ye(s[l],1,1,(()=>{s[l]=null})),ge(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),we(n,1),n.m(r.parentNode,r))},i(e){i||(we(n),i=!0)},o(e){ye(n),i=!1},d(e){s[t].d(e),e&&D(r)}}}(e);return{c(){t=O("div"),Ee(n.$$.fragment),s=B(),h&&h.c(),z(t,"position","relative"),U(t,"class","inputAutoComplete")},m(e,r){R(e,t,r),Ae(n,t,null),N(t,s),h&&h.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]),16&t[1]&&(s.$$scope={dirty:t,ctx:e}),!r&&1&t[0]&&(r=!0,s.value=e[0],le((()=>r=!1))),!i&&4&t[0]&&(i=!0,s.selection=e[2],le((()=>i=!1))),!o&&8&t[0]&&(o=!0,s.searchQuery=e[3],le((()=>o=!1))),n.$set(s),e[5]&&h.p(e,t)},i(e){a||(we(n.$$.fragment,e),we(h),a=!0)},o(e){ye(n.$$.fragment,e),ye(h),a=!1},d(e){e&&D(t),be(n),h&&h.d()}}}function vo(e,t,n){const{Autocomplete:r}=c,i=K();let{classId:o}=t,{id:s}=t,{item:a}=t,{name:l}=t,{listName:d}=t,{record:u}=t,{value:h}=t,{noForm:f=!1}=t,{disabled:m}=t,{formnovalidate:p}=t;const{autocomplete:{input:g,min:w,url:y,output:v},format:_}=a.properties,I=[].concat(g),{name:C}=v,$="map"===_;let E,A=h,b=!1;Y((()=>{const e=document.querySelector("."+a.name+" .autocomplete input");e&&(e.addEventListener("focus",N),e.addEventListener("keyup",T),e.addEventListener("keydown",S));const t=document.getElementById(s);t&&t.classList.add(o)}));const S=e=>{b=8===e.keyCode||32===e.keyCode},T=e=>{8===e.keyCode&&""===A&&n(0,h="")},N=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(h.startsWith(e[0].name))return;n(3,A=n(0,h=e[0].name)),k(h)}else e.find((e=>(A||"").startsWith(e.name)))||h||n(3,A=" ");else h||n(3,A="")},R=async(e="")=>{const t=await fetch(y+"?"+D()+"&name=%5E"+e.trim());if(!t.ok)return;const n=t.headers.get("Content-Type").split(";")[0];let r=[];try{if("text/json"===n){const e=await t.text();r=JSON.parse(e||[])}else"application/json"===n&&(r=await t.json())}catch{}return r.map((e=>({name:e[C]})))},D=()=>I.map((({name:e,refItem:t})=>`${t}=${(d?u[d][e]:u[e]).split(" ")[0]}`)).join("&"),k=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,h=e.value),"noForm"in e&&n(14,f=e.noForm),"disabled"in e&&n(15,m=e.disabled),"formnovalidate"in e&&n(16,p=e.formnovalidate)},[h,s,E,A,r,$,({detail:{value:e}})=>{e.length&&n(3,A=n(0,h=e[0].name)),n(2,E=[]),k(h)},async function*(e){if(b||h&&e.startsWith(h))return n(0,h=e),void k(h);const t=await R(e);if(!t?.length)return n(0,h=e),void k(h);1===t.length?(n(3,A=n(0,h=t[0].name)),n(2,E=[]),k(h)):yield t},async()=>{if(!h)return;const e=l.includes(".")?u[l.split(".")[0]]:u,t=await uo(e);window.open(t,"_blank")},o,a,l,d,u,f,m,p,function(e){h=e,n(0,h)},function(e){E=e,n(2,E)},function(e){A=e,n(3,A)}]}class _o extends Te{constructor(e){var t;super(),mo.getElementById("svelte-wpjws5-style")||((t=O("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}",N(mo.head,t)),Se(this,e,vo,yo,A,{classId:9,id:1,item:10,name:11,listName:12,record:13,value:0,noForm:14,disabled:15,formnovalidate:16},[-1,-1])}}const{document:Io}=Ie;function Co(e){e[26]=e[28].list,e[27]=e[28].items}function $o(e,t,n){const r=e.slice();return r[29]=t[n],r}function Eo(e,t,n){const r=e.slice();return r[32]=t[n],r}function Ao(e,t,n){const r=e.slice();return r[32]=t[n],r}function bo(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function So(e){let t,n,r,i,o,s,a,l,c,d,u,h,f,m,p,g,w,y;function v(t){e[23](t)}Co(e),n=new e[7]({props:{outline:!0,$$slots:{default:[To]},$$scope:{ctx:e}}}),n.$on("click",e[22]);let _={id:e[8]};void 0!==e[1]&&(_.value=e[1]),s=new e[6]({props:_}),ee.push((()=>$e(s,"value",v))),s.$on("input",e[12]),d=new tt({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]=No(Ao(e,r,t));return{c(){t=O("thead"),n=O("tr");for(let e=0;e<i.length;e+=1)i[e].c();U(n,"class","svelte-14hcfjl"),U(t,"class","svelte-14hcfjl")},m(e,r){R(e,t,r),N(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=Ao(e,r,o);i[o]?i[o].p(s,t):(i[o]=No(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&&D(t),k(i,e)}}}(e),C=e[26]?.length&&function(e){let t,n=e[26],r=[];for(let t=0;t<n.length;t+=1)r[t]=ko($o(e,n,t));return{c(){for(let e=0;e<r.length;e+=1)r[e].c();t=P()},m(e,n){for(let t=0;t<r.length;t+=1)r[t].m(e,n);R(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=$o(e,n,o);r[o]?r[o].p(s,i):(r[o]=ko(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){k(r,e),e&&D(t)}}}(e);return{c(){t=O("div"),Ee(n.$$.fragment),r=B(),i=O("div"),o=M("Suchen: "),Ee(s.$$.fragment),l=B(),c=O("span"),Ee(d.$$.fragment),u=B(),h=O("div"),f=O("table"),I&&I.c(),m=B(),p=O("tbody"),C&&C.c(),U(t,"class","form--buttons svelte-14hcfjl"),U(c,"class","feather pointer svelte-14hcfjl"),z(i,"margin-bottom","1em"),z(i,"position","relative"),U(f,"striped",""),U(f,"class","svelte-14hcfjl"),U(h,"class","eList svelte-14hcfjl")},m(a,v){R(a,t,v),Ae(n,t,null),R(a,r,v),R(a,i,v),N(i,o),Ae(s,i,null),N(i,l),N(i,c),Ae(d,c,null),R(a,u,v),R(a,h,v),N(h,f),I&&I.m(f,null),N(f,m),N(f,p),C&&C.m(p,null),g=!0,w||(y=L(c,"click",e[14]),w=!0)},p(e,t){Co(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],le((()=>a=!1))),s.$set(i),e[27]?.length&&I.p(e,t),e[26]?.length&&C.p(e,t)},i(e){g||(we(n.$$.fragment,e),we(s.$$.fragment,e),we(d.$$.fragment,e),g=!0)},o(e){ye(n.$$.fragment,e),ye(s.$$.fragment,e),ye(d.$$.fragment,e),g=!1},d(e){e&&D(t),be(n),e&&D(r),e&&D(i),be(s),be(d),e&&D(u),e&&D(h),I&&I.d(),C&&C.d(),w=!1,y()}}}function To(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function No(e){let t,n,r=e[32]?.designation+"";return{c(){t=O("th"),n=M(r),U(t,"class","svelte-14hcfjl")},m(e,r){R(e,t,r),N(t,n)},p:_,d(e){e&&D(t)}}}function Ro(e){let t,n,r=e[27],i=[];for(let t=0;t<r.length;t+=1)i[t]=Do(Eo(e,r,t));return{c(){t=O("tr");for(let e=0;e<i.length;e+=1)i[e].c();n=B(),U(t,"class","pointer svelte-14hcfjl"),q(t,"active",e[29]._id===e[0])},m(e,r){R(e,t,r);for(let e=0;e<i.length;e+=1)i[e].m(t,null);N(t,n)},p(e,o){if(3584&o[0]){let s;for(r=e[27],s=0;s<r.length;s+=1){const a=Eo(e,r,s);i[s]?i[s].p(a,o):(i[s]=Do(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]&&q(t,"active",e[29]._id===e[0])},d(e){e&&D(t),k(i,e)}}}function Do(e){let t,n,r,i,o=e[9](e[29],e[32])+"";return{c(){t=O("td"),n=M(o),U(t,"class","svelte-14hcfjl")},m(o,s){R(o,t,s),N(t,n),r||(i=L(t,"click",V(e[10](e[29]))),r=!0)},p(t,n){e=t},d(e){e&&D(t),r=!1,i()}}}function ko(e){let t,n=e[13](e[29],e[27],e[1]),r=n&&Ro(e);return{c(){r&&r.c(),t=P()},m(e,n){r&&r.m(e,n),R(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=Ro(e),r.c(),r.m(t.parentNode,t)):r&&(r.d(1),r=null)},d(e){r&&r.d(e),e&&D(t)}}}function Oo(e){let t,n;return t=new e[5]({}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p:_,i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function xo(e){let t,n,r,i;t=new e[4]({});let o={ctx:e,current:null,token:null,hasCatch:!1,pending:Oo,then:So,catch:bo,value:28,blocks:[,,,]};return ve(e[11](),o),{c(){Ee(t.$$.fragment),n=B(),r=P(),o.block.c()},m(e,s){Ae(t,e,s),R(e,n,s),R(e,r,s),o.block.m(e,o.anchor=s),o.mount=()=>r.parentNode,o.anchor=r,i=!0},p(t,n){_e(o,e=t,n)},i(e){i||(we(t.$$.fragment,e),we(o.block),i=!0)},o(e){ye(t.$$.fragment,e);for(let e=0;e<3;e+=1){ye(o.blocks[e])}i=!1},d(e){be(t,e),e&&D(n),e&&D(r),o.block.d(e),o.token=null,o=null}}}function Mo(e){let t,n;return t=new e[3]({props:{title:"Auswahl",class:"eList",$$slots:{default:[xo]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Bo(e,n,i){const o=K(),{Dialog:s,Divider:a,Loading:l,TextField:d,Button:u}=c;let{item:h}=n,{className:f}=n,{classId:p}=n,{rowId:w}=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?g(n):m(e[`_${t.name}`]||e[t.name]||"")},A=t.getSchemaByClass(f);Y((()=>{window.setTimeout((()=>{const e=document.querySelector("tr.active");e?e.scrollIntoView({block:"end",behavior:"smooth"}):document.getElementById($)?.focus()}),200)})),r.subscribe((async e=>{if(!e)return;const t=await A;e.eventId===t.id&&mh(t.class,e.eventId)}));return e.$$set=e=>{"item"in e&&i(15,h=e.item),"className"in e&&i(16,f=e.className),"classId"in e&&i(17,p=e.classId),"rowId"in e&&i(0,w=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)},[w,C,o,s,a,l,d,u,$,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 Xt(o,e,i)}},({detail:{value:e}})=>{i(1,C=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,C="")},h,f,p,y,v,_,I,()=>o("back"),function(e){C=e,i(1,C)}]}class Po extends Te{constructor(e){var t;super(),Io.getElementById("svelte-14hcfjl-style")||((t=O("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}",N(Io.head,t)),Se(this,e,Bo,Mo,A,{item:15,className:16,classId:17,rowId:0,viewName:18,viewValue:19,recordId:20,filter:21},[-1,-1])}}function Lo(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Fo(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}),ee.push((()=>$e(n,"value",s)));let l=!e[6]&&Vo(e);return{c(){t=O("div"),Ee(n.$$.fragment),i=B(),l&&l.c(),z(t,"position","relative")},m(e,r){R(e,t,r),Ae(n,t,null),N(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],le((()=>r=!1))),n.$set(o),e[6]?l&&(pe(),ye(l,1,1,(()=>{l=null})),ge()):l?(l.p(e,i),64&i&&we(l,1)):(l=Vo(e),l.c(),we(l,1),l.m(t,null))},i(e){o||(we(n.$$.fragment,e),we(l),o=!0)},o(e){ye(n.$$.fragment,e),ye(l),o=!1},d(e){e&&D(t),be(n),l&&l.d()}}}function Vo(e){let t,n,r,i,o;return n=new Tt({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather pointer svelte-wbrqzu")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[17]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function Uo(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Ho(e){let t,n,r;function i(t){e[22](t)}let o={class:"tModal",noClickaway:!0,$$slots:{default:[Wo]},$$scope:{ctx:e}};return void 0!==e[8]&&(o.open=e[8]),t=new e[11]({props:o}),ee.push((()=>$e(t,"open",i))),{c(){Ee(t.$$.fragment)},m(e,n){Ae(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],le((()=>n=!1))),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function Wo(e){let t,n;return t=new Po({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(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function zo(e){let t,n,r,i={ctx:e,current:null,token:null,hasCatch:!1,pending:Uo,then:Fo,catch:Lo,value:27,blocks:[,,,]};ve(e[16](),i);let o=e[8]&&Ho(e);return{c(){i.block.c(),t=B(),o&&o.c(),n=P()},m(e,s){i.block.m(e,i.anchor=s),i.mount=()=>t.parentNode,i.anchor=t,R(e,t,s),o&&o.m(e,s),R(e,n,s),r=!0},p(t,[r]){_e(i,e=t,r),e[8]?o?(o.p(e,r),256&r&&we(o,1)):(o=Ho(e),o.c(),we(o,1),o.m(n.parentNode,n)):o&&(pe(),ye(o,1,1,(()=>{o=null})),ge())},i(e){r||(we(i.block),we(o),r=!0)},o(e){for(let e=0;e<3;e+=1){ye(i.blocks[e])}ye(o),r=!1},d(e){i.block.d(e),i.token=null,i=null,e&&D(t),o&&o.d(e),e&&D(n)}}}function qo(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:h}=t,{formnovalidate:f}=t,{praefix:m}=t;const{properties:p={}}=a;let g,{pattern:w,placeholder:y,readonly:v,required:_=!1,view:I}=p,C=!1;const $=()=>{n(8,C=!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,h=e.disabled),"formnovalidate"in e&&n(7,f=e.formnovalidate),"praefix"in e&&n(20,m=e.praefix)},[d,o,s,a,l,u,h,f,C,g,r,i,w,v,_,I,async()=>(n(9,g=l[I.selection]),!0),()=>{n(8,C=!0)},({detail:e})=>{n(0,d=e.row[I.value?I.value:"_id"]),$()},$,m,function(e){d=e,n(0,d)},function(e){C=e,n(8,C)}]}class jo extends Te{constructor(e){var t;super(),document.getElementById("svelte-wbrqzu-style")||((t=O("style")).id="svelte-wbrqzu-style",t.textContent=".feather.svelte-wbrqzu{position:absolute;top:0.75em;left:0.5em;color:#4300b0}",N(document.head,t)),Se(this,e,qo,zo,A,{classId:1,id:2,item:3,record:4,value:0,noForm:5,disabled:6,formnovalidate:7,praefix:20})}}function Go(e,t,n){const r=e.slice();return r[12]=t[n][0],r[13]=t[n][1],r}function Xo(e){let t;return{c(){t=O("option"),t.textContent="- ",t.selected=!0,t.__value="",t.value=t.__value},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Yo(e){let t;return{c(){t=O("option"),t.textContent="-- Bitte wählen -- ",t.disabled=!0,t.selected=!0,t.__value="",t.value=t.__value},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Zo(e){let t,n,r,i,o=e[12]+"";return{c(){t=O("option"),n=M(o),t.__value=r=e[13],t.value=t.__value,t.selected=i=e[0]==e[13]},m(e,r){R(e,t,r),N(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&&D(t)}}}function Ko(e){let t,n,r,i,o,s=!e[7]&&function(e){let t;function n(e,t){return e[5]&&!0!==e[8]?Yo:Xo}let r=n(e),i=r(e);return{c(){i.c(),t=P()},m(e,n){i.m(e,n),R(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&&D(t)}}}(e),a=e[6],l=[];for(let t=0;t<a.length;t+=1)l[t]=Zo(Go(e,a,t));return{c(){t=O("select"),s&&s.c(),n=P();for(let e=0;e<l.length;e+=1)l[e].c();U(t,"class",r=S(e[3]||e[4])+" svelte-5xpzvo"),U(t,"id",e[2]),U(t,"name",e[2]),t.disabled=e[1],t.required=e[5]},m(r,a){R(r,t,a),s&&s.m(t,null),N(t,n);for(let e=0;e<l.length;e+=1)l[e].m(t,null);i||(o=L(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=Go(e,a,r);l[r]?l[r].p(i,n):(l[r]=Zo(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=S(e[3]||e[4])+" svelte-5xpzvo")&&U(t,"class",r),4&n&&U(t,"id",e[2]),4&n&&U(t,"name",e[2]),2&n&&(t.disabled=e[1]),32&n&&(t.required=e[5])},i:_,o:_,d(e){e&&D(t),s&&s.d(),k(l,e),i=!1,o()}}}function Qo(e,t,n){const r=K();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:h,readonly:f}=o.properties;u&&(u=u.map((e=>[e,e]))),"businessMonth"===h&&(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"===h&&(s||=2024,u=[["2024/2025",2024]]),"valueAddedTax"===h&&(s||=0,u=[["0% Steuerbefreit",0],["8.1% Normalsatz",.081],["2.6% Reduzierter Satz",.026],["3.8% Beherbergung",.038]]),c||=!!f,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,h,f,e=>r("blur",{value:e.srcElement.value}),o]}class Jo extends Te{constructor(e){var t;super(),document.getElementById("svelte-5xpzvo-style")||((t=O("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}",N(document.head,t)),Se(this,e,Qo,Ko,A,{id:2,item:10,value:0,noForm:3,classId:4,disabled:1,required:5})}}function es(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 Pe({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"title","Übernehmen"),U(t,"class","pointer feather")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[12]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}(e);return{c(){t=O("input"),r=B(),Ee(i.$$.fragment),o=B(),d&&d.c(),s=P(),U(t,"type","string"),U(t,"class",n=e[3]||e[4]),U(t,"id",e[1]),U(t,"name",e[1]),t.hidden=!0},m(n,u){R(n,t,u),W(t,e[0]),R(n,r,u),Ae(i,n,u),R(n,o,u),d&&d.m(n,u),R(n,s,u),a=!0,l||(c=L(t,"input",e[18]),l=!0)},p(e,[r]){(!a||24&r&&n!==(n=e[3]||e[4]))&&U(t,"class",n),(!a||2&r)&&U(t,"id",e[1]),(!a||2&r)&&U(t,"name",e[1]),1&r&&W(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||(we(i.$$.fragment,e),we(d),a=!0)},o(e){ye(i.$$.fragment,e),ye(d),a=!1},d(e){e&&D(t),e&&D(r),be(i,e),e&&D(o),d&&d.d(e),e&&D(s),l=!1,c()}}}let ts=new Map;function ns(e,n,r){const i=K(),{DatePicker:o}=c;let{value:s}=n,{id:a}=n,{item:l}=n,{record:d}=n,{praefix:u}=n,{noForm:h=!1}=n,{classId:f}=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,C=l.properties?.noCalendar||!1,$=l.properties?.transfer,E=({detail:e})=>{try{r(0,s=hr(e.value,s)),void 0!==u&&ts.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=hr(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,h=e.noForm),"classId"in e&&r(4,f=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&&!$&&ts.has(I)&&r(0,s=ts.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=hr(d[l.name],s))}catch{}},[s,a,u,h,f,p,g,w,o,C,$,E,()=>{i("record",{target:$.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 rs extends Te{constructor(e){super(),Se(this,e,ns,es,A,{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 is(e){let t;return{c(){t=M("Stunden")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function os(e){let t,n;return t=new e[4]({props:{slot:"hours-label",$$slots:{default:[is]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};4096&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ss(e){let t;return{c(){t=M("Minuten")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function as(e){let t,n;return t=new e[4]({props:{slot:"minutes-label",$$slots:{default:[ss]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};4096&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ls(e){let t;return{c(){t=M("Jetzt")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function cs(e){let t,n;return t=new e[4]({props:{slot:"now-label",$$slots:{default:[ls]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};4096&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ds(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":[cs],"minutes-label":[as],"hours-label":[os]},$$scope:{ctx:e}}}),s.$on("change",e[7]),{c(){t=O("input"),r=B(),Ee(i.$$.fragment),o=B(),Ee(s.$$.fragment),U(t,"type","string"),U(t,"class",n=e[2]||e[3]),U(t,"id",e[1]),U(t,"name",e[1]),t.hidden=!0},m(n,d){R(n,t,d),W(t,e[0]),R(n,r,d),Ae(i,n,d),R(n,o,d),Ae(s,n,d),a=!0,l||(c=L(t,"input",e[9]),l=!0)},p(e,[r]){(!a||12&r&&n!==(n=e[2]||e[3]))&&U(t,"class",n),(!a||2&r)&&U(t,"id",e[1]),(!a||2&r)&&U(t,"name",e[1]),1&r&&W(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||(we(i.$$.fragment,e),we(s.$$.fragment,e),a=!0)},o(e){ye(i.$$.fragment,e),ye(s.$$.fragment,e),a=!1},d(e){e&&D(t),e&&D(r),be(i,e),e&&D(o),be(s,e),l=!1,c()}}}function us(e,t,n){const r=K(),{Label:i,DatePicker:o,TimePicker:s}=c;let{value:a}=t,{id:l}=t,{noForm:d=!1}=t,{classId:u}=t;const h=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))),h(a)},({detail:e})=>{n(0,a=hr(e.value,a)),h(a)},function(){a=this.value,n(0,a)}]}class hs extends Te{constructor(e){super(),Se(this,e,us,ds,A,{value:0,id:1,noForm:2,classId:3})}}function fs(e){let t,n,r,i,o,s,a,l,c,d,u,h,f,m,p,g;return u=new e[9]({props:{format:e[5],required:e[3],disabled:e[4],value:e[7],noCalendar:e[10],closeOnSelection:!0}}),u.$on("change",e[11]),f=new e[9]({props:{format:e[6],required:e[3],disabled:e[4],value:e[8],noCalendar:e[10],class:"moveLeft",closeOnSelection:!0}}),f.$on("change",e[12]),{c(){t=O("input"),o=B(),s=O("input"),d=B(),Ee(u.$$.fragment),h=M(" /\n"),Ee(f.$$.fragment),U(t,"type","string"),U(t,"class",n=e[1]||e[2]),U(t,"id",r=e[0]+"_from"),U(t,"name",i=e[0]+"_from"),t.hidden=!0,U(s,"type","string"),U(s,"class",a=e[1]||e[2]),U(s,"id",l=e[0]+"_to"),U(s,"name",c=e[0]+"_to"),s.hidden=!0},m(n,r){R(n,t,r),W(t,e[7]),R(n,o,r),R(n,s,r),W(s,e[8]),R(n,d,r),Ae(u,n,r),R(n,h,r),Ae(f,n,r),m=!0,p||(g=[L(t,"input",e[15]),L(s,"input",e[16])],p=!0)},p(e,[o]){(!m||6&o&&n!==(n=e[1]||e[2]))&&U(t,"class",n),(!m||1&o&&r!==(r=e[0]+"_from"))&&U(t,"id",r),(!m||1&o&&i!==(i=e[0]+"_from"))&&U(t,"name",i),128&o&&W(t,e[7]),(!m||6&o&&a!==(a=e[1]||e[2]))&&U(s,"class",a),(!m||1&o&&l!==(l=e[0]+"_to"))&&U(s,"id",l),(!m||1&o&&c!==(c=e[0]+"_to"))&&U(s,"name",c),256&o&&W(s,e[8]);const d={};32&o&&(d.format=e[5]),8&o&&(d.required=e[3]),16&o&&(d.disabled=e[4]),128&o&&(d.value=e[7]),u.$set(d);const h={};64&o&&(h.format=e[6]),8&o&&(h.required=e[3]),16&o&&(h.disabled=e[4]),256&o&&(h.value=e[8]),f.$set(h)},i(e){m||(we(u.$$.fragment,e),we(f.$$.fragment,e),m=!0)},o(e){ye(u.$$.fragment,e),ye(f.$$.fragment,e),m=!1},d(e){e&&D(t),e&&D(o),e&&D(s),e&&D(d),be(u,e),e&&D(h),be(f,e),p=!1,$(g)}}}function ms(e,t,n){const r=K(),{DatePicker:i}=c;let{value:o}=t,{id:s}=t,{item:a}=t,{noForm:l=!1}=t,{classId:d}=t,{required:u}=t,{disabled:h}=t;const{noCalendar:f,preset:m}=a.properties||{};let p="%d.%m.%Y",g="%d.%m.%Y",w=o?.from,y=o?.to;if(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&&(w=e),t&&(y=t)}"Invalid Date"===w?.toString()&&(w=void 0),"Invalid Date"===y?.toString()&&(y=void 0),h&&(void 0===w&&(p=""),void 0===y&&(g=""));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,h=e.disabled)},[s,l,d,u,h,p,g,w,y,i,f,({detail:e})=>{n(7,w=hr(e.value,w)),y&&w&&y.valueOf()-w.valueOf()<0&&n(7,w=void 0),r("change",{value:w,range:"_from"})},({detail:e})=>{n(8,y=hr(e.value,y)),y&&w&&y.valueOf()-w.valueOf()<0&&n(8,y=void 0),r("change",{value:y,range:"_to"})},o,a,function(){w=this.value,n(7,w)},function(){y=this.value,n(8,y)}]}class ps extends Te{constructor(e){var t;super(),document.getElementById("svelte-7itxk4-style")||((t=O("style")).id="svelte-7itxk4-style",t.textContent="div.date-picker.moveLeft div.dropdown.calendar{left:-3em !important}",N(document.head,t)),Se(this,e,ms,fs,A,{value:13,id:0,item:14,noForm:1,classId:2,required:3,disabled:4})}}function gs(e){let t,n,r,i,o;function s(t){e[13](t)}let a={class:e[0],id:e[1],name:e[2],accept:".xml",max:"1",beforeChange:e[9]};return void 0!==e[3]&&(a.files=e[3]),t=new e[5]({props:a}),ee.push((()=>$e(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(){Ee(t.$$.fragment),r=B(),Ee(i.$$.fragment)},m(e,n){Ae(t,e,n),R(e,r,n),Ae(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],le((()=>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||(we(t.$$.fragment,e),we(i.$$.fragment,e),o=!0)},o(e){ye(t.$$.fragment,e),ye(i.$$.fragment,e),o=!1},d(e){be(t,e),e&&D(r),be(i,e)}}}function ws(e){let t,n;return t=new e[6]({props:{inputClass:e[0],readonly:!0,id:e[1],name:e[1],value:e[4]}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ys(e){let t,n,r,i;const o=[ws,gs],s=[];return t=function(e){return e[7]?0:1}(e),n=s[t]=o[t](e),{c(){n.c(),r=P()},m(e,n){s[t].m(e,n),R(e,r,n),i=!0},p(e,[t]){n.p(e,t)},i(e){i||(we(n),i=!0)},o(e){ye(n),i=!1},d(e){s[t].d(e),e&&D(r)}}}function vs(e,t,n){const{FileDropzone:r,TextField:i}=c,o=K();let{classId:s}=t,{eventId:a}=t,{record:l}=t,{item:d}=t,{id:u}=t,{name:h}=t,f=[],m=l[d.name]||"",p=!!l._id;const g=e=>{if(!e)return"";e=e.replaceAll(" ","").slice(4);let[t,...n]=e.split("00");n=n.join("00");let r="";for(let e=0;e<t.length/2;e++){const n=2*e,i=t.substring(n,n+2);r+=String.fromCharCode(i)}return r+n};return e.$$set=e=>{"classId"in e&&n(0,s=e.classId),"eventId"in e&&n(10,a=e.eventId),"record"in e&&n(11,l=e.record),"item"in e&&n(12,d=e.item),"id"in e&&n(1,u=e.id),"name"in e&&n(2,h=e.name)},[s,u,h,f,m,r,i,p,async()=>{const{list:e}=d.properties,t=f[0];if(t){n(4,m=t.name);const r=(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))})(await t.text()),i=[],s=r.BkToCstmrDbtCdtNtfctn.Ntfctn,a=[].concat(s.Ntry);for(const e of a){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:g(t),information:n.RmtInf?.Ustrd||""};i.push(r)}}i.length&&o("record",{itemName:e,value:i})}},()=>{n(3,f)},a,l,d,function(e){f=e,n(3,f)}]}class _s extends Te{constructor(e){var t;super(),document.getElementById("svelte-157hlzf-style")||((t=O("style")).id="svelte-157hlzf-style",t.textContent="label.file-dropzone{margin-top:0 !important}",N(document.head,t)),Se(this,e,vs,ys,A,{classId:0,eventId:10,record:11,item:12,id:1,name:2})}}const Is=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=Cs(10,n[31]),t.amountVat=$s(Cs(32,n[31]),t.amount)||$s(Cs(33,n[31]),t.amount),t):t},Cs=(e,t)=>{if(!e)return"";if(!t)return"";const n=t.split("/"+e+"/")[1];return n?.split("/")[0]||""},$s=(e,t)=>{if(!e)return"";let n=0;if(e.includes(":")){const t=e.split(";");for(const e of t)n+=e.split(":")[1]}else n=+t/(+e+100)*+e;return n},{document:Es}=Ie;function As(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}),ee.push((()=>$e(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(){Ee(t.$$.fragment),r=B(),Ee(i.$$.fragment)},m(e,n){Ae(t,e,n),R(e,r,n),Ae(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],le((()=>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||(we(t.$$.fragment,e),we(i.$$.fragment,e),o=!0)},o(e){ye(t.$$.fragment,e),ye(i.$$.fragment,e),o=!1},d(e){be(t,e),e&&D(r),be(i,e)}}}function bs(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]&&Ss(e);return{c(){t=O("div"),Ee(n.$$.fragment),r=B(),o&&o.c(),z(t,"position","relative")},m(e,s){R(e,t,s),Ae(n,t,null),N(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&&we(o,1)):(o=Ss(e),o.c(),we(o,1),o.m(t,null)):o&&(pe(),ye(o,1,1,(()=>{o=null})),ge())},i(e){i||(we(n.$$.fragment,e),we(o),i=!0)},o(e){ye(n.$$.fragment,e),ye(o),i=!1},d(e){e&&D(t),be(n),o&&o.d()}}}function Ss(e){let t,n,r,i,o;return n=new De({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather pointer svelte-o0hiko")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[9]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function Ts(e){let t,n,r,i;const o=[bs,As],s=[];return t=function(e){return e[7]?0:1}(e),n=s[t]=o[t](e),{c(){n.c(),r=P()},m(e,n){s[t].m(e,n),R(e,r,n),i=!0},p(e,[t]){n.p(e,t)},i(e){i||(we(n),i=!0)},o(e){ye(n),i=!1},d(e){s[t].d(e),e&&D(r)}}}let Ns;function Rs(e,n,r){const{FileDropzone:i,TextField:o}=c,s=K();let{classId:a}=n,{eventId:l}=n,{record:d}=n,{item:u}=n,{id:h}=n,{name:f}=n,m=[],p=d[u.name]||"",g=!!d._id;const w={scale:{once:!1,value:1,start:1,step:.2,stop:1.6},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=Is(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 Y((()=>{if(Ns)return;let e=document.createElement("script");e.src="/QR/pdf-qr2.js",document.head.append(e),e.onload=function(){Ns=PDF_QR_JS}})),Z((()=>{})),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,h=e.id),"name"in e&&r(2,f=e.name)},[a,h,f,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}}),Ns.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 Ds extends Te{constructor(e){var t;super(),Es.getElementById("svelte-o0hiko-style")||((t=O("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}",N(Es.head,t)),Se(this,e,Rs,Ts,A,{classId:0,eventId:12,record:11,item:13,id:1,name:2})}}const{document:ks}=Ie;function Os(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}),ee.push((()=>$e(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(){Ee(t.$$.fragment),r=B(),Ee(i.$$.fragment)},m(e,n){Ae(t,e,n),R(e,r,n),Ae(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],le((()=>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||(we(t.$$.fragment,e),we(i.$$.fragment,e),o=!0)},o(e){ye(t.$$.fragment,e),ye(i.$$.fragment,e),o=!1},d(e){be(t,e),e&&D(r),be(i,e)}}}function xs(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]&&Ms(e);return{c(){t=O("div"),Ee(n.$$.fragment),r=B(),o&&o.c(),z(t,"position","relative")},m(e,s){R(e,t,s),Ae(n,t,null),N(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&&we(o,1)):(o=Ms(e),o.c(),we(o,1),o.m(t,null)):o&&(pe(),ye(o,1,1,(()=>{o=null})),ge())},i(e){i||(we(n.$$.fragment,e),we(o),i=!0)},o(e){ye(n.$$.fragment,e),ye(o),i=!1},d(e){e&&D(t),be(n),o&&o.d()}}}function Ms(e){let t,n,r,i,o;const s=[Ps,Bs],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=P()},m(e,t){a[n].m(e,t),R(e,i,t),o=!0},p(e,t){let o=n;n=l(e,t),n===o?a[n].p(e,t):(pe(),ye(a[o],1,1,(()=>{a[o]=null})),ge(),r=a[n],r?r.p(e,t):(r=a[n]=s[n](e),r.c()),we(r,1),r.m(i.parentNode,i))},i(e){o||(we(r),o=!0)},o(e){ye(r),o=!1},d(e){a[n].d(e),e&&D(i)}}}function Bs(e){let t,n,r,i,o;return n=new De({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather pointer svelte-o0hiko")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[10]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function Ps(e){let t,n={ctx:e,current:null,token:null,hasCatch:!1,pending:Vs,then:Fs,catch:Ls,value:23};return ve(e[11](),n),{c(){t=P(),n.block.c()},m(e,r){R(e,t,r),n.block.m(e,n.anchor=r),n.mount=()=>t.parentNode,n.anchor=t},p(t,r){_e(n,e=t,r)},i:_,o:_,d(e){e&&D(t),n.block.d(e),n.token=null,n=null}}}function Ls(e){return{c:_,m:_,p:_,d:_}}function Fs(e){let t,n,r,i;return{c(){t=O("video"),n=O("source"),i=M("\n Your browser does not support HTML video."),n.src!==(r=e[23])&&U(n,"src",r),U(n,"type","video/mp4"),U(t,"width","500"),t.controls=!0,z(t,"margin-top","1em")},m(e,r){R(e,t,r),N(t,n),N(t,i)},p:_,d(e){e&&D(t)}}}function Vs(e){return{c:_,m:_,p:_,d:_}}function Us(e){let t,n,r,i;const o=[xs,Os],s=[];function a(e,t){return e[6]?0:1}return t=a(e),n=s[t]=o[t](e),{c(){n.c(),r=P()},m(e,n){s[t].m(e,n),R(e,r,n),i=!0},p(e,[i]){let l=t;t=a(e),t===l?s[t].p(e,i):(pe(),ye(s[l],1,1,(()=>{s[l]=null})),ge(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),we(n,1),n.m(r.parentNode,r))},i(e){i||(we(n),i=!0)},o(e){ye(n),i=!1},d(e){s[t].d(e),e&&D(r)}}}function Hs(e,n,r){const{FileDropzone:i,TextField:o}=c,s=K();let{classId:a}=n,{eventId:l}=n,{record:d}=n,{item:u}=n,{id:h}=n,{name:f}=n,{praefix:m}=n,{recordId:p}=n,{fileType:g="application/pdf"}=n,w=[],y="",v=!1;return Y((()=>{(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)})()})),Z((()=>{})),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,h=e.id),"name"in e&&r(2,f=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,h,f,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 Ws extends Te{constructor(e){var t;super(),ks.getElementById("svelte-o0hiko-style")||((t=O("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}",N(ks.head,t)),Se(this,e,Hs,Us,A,{classId:0,eventId:13,record:14,item:15,id:1,name:2,praefix:16,recordId:17,fileType:3})}}function zs(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:qs,placeholder:js,readonly:e[3],disabled:e[4]}}),n.$on("change",e[6]),{c(){t=O("div"),Ee(n.$$.fragment),z(t,"max-width","4em")},m(e,i){R(e,t,i),Ae(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||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}const qs="([01][0-9]|2[0-3]):([0-5][0-9])",js="";function Gs(e,t,n){const r=K(),{TextField:i}=c;let{id:o}=t,{item:s}=t,{value:a}=t,{inputClass:l}=t,{readonly:d}=t,{disabled:u}=t,{praefix:h}=t;const f=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,h=e.praefix)},[o,a,l,d,u,i,({detail:e})=>{r("blur",{value:f(e.value)}),r("checkRange",{idx:h,fieldId:o,value:e.value})},s,h]}class Xs extends Te{constructor(e){var t;super(),document.getElementById("svelte-vvt0yv-style")||((t=O("style")).id="svelte-vvt0yv-style",t.textContent=".text-field input.invalid{border:1px red solid !important}",N(document.head,t)),Se(this,e,Gs,zs,A,{id:0,item:7,value:1,inputClass:2,readonly:3,disabled:4,praefix:8})}}const{document:Ys}=Ie;function Zs(e,t,n){const r=e.slice();return r[20]=t[n],r}function Ks(e,t,n){const r=e.slice();return r[23]=t[n],r[25]=n,r}function Qs(e){let t,n,r=e[2](e[20],e[23])+"",i=e[25]&&function(){let e;return{c(){e=M(", ")},m(t,n){R(t,e,n)},d(t){t&&D(e)}}}();return{c(){t=O("span"),i&&i.c(),n=M(r),U(t,"class","lookupValue")},m(e,r){R(e,t,r),i&&i.m(t,null),N(t,n)},p(e,t){3&t&&r!==(r=e[2](e[20],e[23])+"")&&H(n,r)},d(e){e&&D(t),i&&i.d()}}}function Js(e){let t,n,r,i,o,s,a,l,c=e[0],d=[];for(let t=0;t<c.length;t+=1)d[t]=Qs(Ks(e,c,t));return i=new it({props:{size:"18"}}),{c(){t=O("div");for(let e=0;e<d.length;e+=1)d[e].c();n=B(),r=O("span"),Ee(i.$$.fragment),o=B(),U(r,"class","feather pointer svelte-1r8jgd4"),U(t,"class","lookupItem svelte-1r8jgd4")},m(c,u){R(c,t,u);for(let e=0;e<d.length;e+=1)d[e].m(t,null);N(t,n),N(t,r),Ae(i,r,null),N(t,o),s=!0,a||(l=L(r,"click",(function(){E(e[3](e[20]._id))&&e[3](e[20]._id).apply(this,arguments)})),a=!0)},p(r,i){if(e=r,7&i){let r;for(c=e[0],r=0;r<c.length;r+=1){const o=Ks(e,c,r);d[r]?d[r].p(o,i):(d[r]=Qs(o),d[r].c(),d[r].m(t,n))}for(;r<d.length;r+=1)d[r].d(1);d.length=c.length}},i(e){s||(we(i.$$.fragment,e),s=!0)},o(e){ye(i.$$.fragment,e),s=!1},d(e){e&&D(t),k(d,e),be(i),a=!1,l()}}}function ea(e){let t,n,r=e[1],i=[];for(let t=0;t<r.length;t+=1)i[t]=Js(Zs(e,r,t));const o=e=>ye(i[e],1,1,(()=>{i[e]=null}));return{c(){t=O("div");for(let e=0;e<i.length;e+=1)i[e].c();U(t,"class","lookup svelte-1r8jgd4")},m(e,r){R(e,t,r);for(let e=0;e<i.length;e+=1)i[e].m(t,null);n=!0},p(e,[n]){if(15&n){let s;for(r=e[1],s=0;s<r.length;s+=1){const o=Zs(e,r,s);i[s]?(i[s].p(o,n),we(i[s],1)):(i[s]=Js(o),i[s].c(),we(i[s],1),i[s].m(t,null))}for(pe(),s=r.length;s<i.length;s+=1)o(s);ge()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)we(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)ye(i[e]);n=!1},d(e){e&&D(t),k(i,e)}}}function ta(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:h}=o.properties;let f=d.split(","),[p,g]=c.split(":"),w=[];const[y,v]=g.split("."),_=(e,t)=>{const[n,r]=t.split(".");return r?e[n][r]:""},I=(e=!0)=>{se().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 Y(I),e.$$set=e=>{"id"in e&&r(4,i=e.id),"item"in e&&r(5,o=e.item),"praefix"in e&&r(6,s=e.praefix),"record"in e&&r(7,a=e.record),"notifyList"in e&&r(8,l=e.notifyList)},e.$$.update=()=>{256&e.$$.dirty&&(async e=>{const{itemName:n,value:i}=e||{};if(n!==p)return;if(r(1,w=[]),!i)return;if(!!u==!!a._id)return I();if(!a._id&&!a[p])return I();const o=!f.some((e=>e.includes(":"))),s=v?v+"."+p:p;let l={[s]:a[p]||a._id};if(h&&(l=[{$match:l},{$addFields:{_ids:{$toString:"$_id"}}},{$lookup:{from:"_task",localField:"_ids",foreignField:"docId",as:"_task"}},{$unwind:{path:"$_task",preserveNullAndEmptyArrays:!0}},{$match:{"_task.status":h}}]),r(1,w=await t.getSectionView(y,l,o)),!o&&w.length){const e=f.find((e=>e.includes(":"))).split(":")[0];r(1,w=w.map((t=>{const n=t[e].find((t=>t[e]===a._id));return n._id=t._id,n}))),r(0,f=f.map((e=>e.split(":")[1])))}I(!w.length)})(l)},[f,w,(e,t)=>"boolean"===o.type?e[t]?"ja":"nein":"object"===o.type?"(ja)":e["_"+t]||m(e[t])||e[t]||_(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)},i,o,s,a,l]}class na extends Te{constructor(e){var t;super(),Ys.getElementById("svelte-1r8jgd4-style")||((t=O("style")).id="svelte-1r8jgd4-style",t.textContent=".feather.svelte-1r8jgd4{position:absolute;top:0;left:-1.5em;color:#4300b0}div.lookup.svelte-1r8jgd4{margin-top:0.75em;color:#aaa}div.lookupItem.svelte-1r8jgd4{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}",N(Ys.head,t)),Se(this,e,ta,ea,A,{id:4,item:5,praefix:6,record:7,notifyList:8})}}function ra(e){let t,n,r;return n=new dt({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather2 svelte-9up2nn")},m(e,i){R(e,t,i),Ae(n,t,null),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function ia(e){let t,n,r,i,o;return n=new dt({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather pointer svelte-9up2nn")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[9]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function oa(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=[ia,ra],l=[];function c(e,t){return e[7]?0:1}return i=c(e),o=l[i]=a[i](e),{c(){t=O("div"),Ee(n.$$.fragment),r=B(),o.c(),z(t,"position","relative")},m(e,o){R(e,t,o),Ae(n,t,null),N(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):(pe(),ye(l[d],1,1,(()=>{l[d]=null})),ge(),o=l[i],o?o.p(e,r):(o=l[i]=a[i](e),o.c()),we(o,1),o.m(t,null))},i(e){s||(we(n.$$.fragment,e),we(o),s=!0)},o(e){ye(n.$$.fragment,e),ye(o),s=!1},d(e){e&&D(t),be(n),l[i].d()}}}function sa(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:h}=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,h=e.value)},[i,o,s,a,l,d,u,h,r,async()=>{if(!h)return;let e=h;e.includes("//")||(e="//"+e),window.open(e,"_blank")},function(t){Q(e,t)}]}class aa extends Te{constructor(e){var t;super(),document.getElementById("svelte-9up2nn-style")||((t=O("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}",N(document.head,t)),Se(this,e,sa,oa,A,{inputClass:0,disabled:1,formnovalidate:2,readonly:3,required:4,id:5,name:6,value:7})}}function la(e){let t,n,r;return n=new Ct({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather2 svelte-9up2nn")},m(e,i){R(e,t,i),Ae(n,t,null),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function ca(e){let t,n,r,i,o;return n=new Ct({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather pointer svelte-9up2nn")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[11]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function da(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[12]);const a=[ca,la],l=[];function c(e,t){return e[9]?0:1}return i=c(e),o=l[i]=a[i](e),{c(){t=O("div"),Ee(n.$$.fragment),r=B(),o.c(),z(t,"position","relative")},m(e,o){R(e,t,o),Ae(n,t,null),N(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):(pe(),ye(l[d],1,1,(()=>{l[d]=null})),ge(),o=l[i],o?o.p(e,r):(o=l[i]=a[i](e),o.c()),we(o,1),o.m(t,null))},i(e){s||(we(n.$$.fragment,e),we(o),s=!0)},o(e){ye(n.$$.fragment,e),ye(o),s=!1},d(e){e&&D(t),be(n),l[i].d()}}}function ua(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:h}=t,{pattern:f}=t,{placeholder:m}=t;f||="(\\+(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})$",m||="+41 58 234 56 78";return e.$$set=e=>{"inputClass"in e&&n(2,i=e.inputClass),"disabled"in e&&n(3,o=e.disabled),"formnovalidate"in e&&n(4,s=e.formnovalidate),"readonly"in e&&n(5,a=e.readonly),"required"in e&&n(6,l=e.required),"id"in e&&n(7,d=e.id),"name"in e&&n(8,u=e.name),"value"in e&&n(9,h=e.value),"pattern"in e&&n(0,f=e.pattern),"placeholder"in e&&n(1,m=e.placeholder)},[f,m,i,o,s,a,l,d,u,h,r,async()=>{if(!h)return;let e="tel:"+h;window.open(e,"_self")},function(t){Q(e,t)}]}class ha extends Te{constructor(e){var t;super(),document.getElementById("svelte-9up2nn-style")||((t=O("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}",N(document.head,t)),Se(this,e,ua,da,A,{inputClass:2,disabled:3,formnovalidate:4,readonly:5,required:6,id:7,name:8,value:9,pattern:0,placeholder:1})}}function fa(e){let t,n,r;return n=new gt({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather2 svelte-9up2nn")},m(e,i){R(e,t,i),Ae(n,t,null),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function ma(e){let t,n,r,i,o;return n=new gt({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather pointer svelte-9up2nn")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[12]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function pa(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=[ma,fa],l=[];function c(e,t){return e[7]?0:1}return i=c(e),o=l[i]=a[i](e),{c(){t=O("div"),Ee(n.$$.fragment),r=B(),o.c(),z(t,"position","relative")},m(e,o){R(e,t,o),Ae(n,t,null),N(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):(pe(),ye(l[d],1,1,(()=>{l[d]=null})),ge(),o=l[i],o?o.p(e,r):(o=l[i]=a[i](e),o.c()),we(o,1),o.m(t,null))},i(e){s||(we(n.$$.fragment,e),we(o),s=!0)},o(e){ye(n.$$.fragment,e),ye(o),s=!1},d(e){e&&D(t),be(n),l[i].d()}}}function ga(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:h}=t,{multiple:f}=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,h=e.value),"multiple"in e&&n(8,f=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,h,f,m,p,r,async()=>{if(!h)return;let e="mailto:"+h;window.open(e,"_self")},function(t){Q(e,t)}]}class wa extends Te{constructor(e){var t;super(),document.getElementById("svelte-9up2nn-style")||((t=O("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}",N(document.head,t)),Se(this,e,ga,pa,A,{inputClass:0,disabled:1,formnovalidate:2,readonly:3,required:4,id:5,name:6,value:7,multiple:8,pattern:9,placeholder:10})}}const ya=["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 va(e){let t;return{c(){t=O("textarea"),U(t,"id",e[0]),z(t,"visibility","hidden")},m(n,r){R(n,t,r),e[19](t)},p(e,n){1&n&&U(t,"id",e[0])},d(n){n&&D(t),e[19](null)}}}function _a(e){let t;return{c(){t=O("div"),U(t,"id",e[0])},m(n,r){R(n,t,r),e[18](t)},p(e,n){1&n&&U(t,"id",e[0])},d(n){n&&D(t),e[18](null)}}}function Ia(e){let t;function n(e,t){return e[1]?_a:va}let r=n(e),i=r(e);return{c(){t=O("div"),i.c(),U(t,"class",e[2])},m(n,r){R(n,t,r),i.m(t,null),e[20](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&&U(t,"class",e[2])},i:_,o:_,d(n){n&&D(t),i.d(),e[20](null)}}}const Ca=e=>e+"_"+Math.floor(1e9*Math.random())+String(Date.now());let $a=(()=>{let e={listeners:[],scriptId:Ca("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 Ea(e,t,n){var r;let i,o,s,{id:a=Ca("tinymce-svelte")}=t,{inline:l}=t,{disabled:c=!1}=t,{apiKey:d="no-api-key"}=t,{licenseKey:u}=t,{channel:h="7"}=t,{scriptSrc:f}=t,{conf:m={}}=t,{modelEvents:p="change input undo redo"}=t,{value:g=""}=t,{text:w=""}=t,{cssClass:y="tinymce-wrapper"}=t,v=g,_=c;const I=K(),C=()=>{const e="undefined"!=typeof window?window:global;return e&&e.tinymce?e.tinymce:null},$=()=>{const e=Object.assign(Object.assign({},m),{target:o,inline:void 0!==l?l:void 0!==m.inline&&m.inline,readonly:c,license_key:u,setup:e=>{n(15,s=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)=>{ya.forEach((n=>{e.on(n,(r=>{t(n.toLowerCase(),{eventName:n,event:r,editor:e})}))}))})(e,I),"function"==typeof m.setup&&m.setup(e)}});n(4,o.style.visibility="",o),C().init(e)};return Y((()=>{if(null!==C())$();else{const e=f||`https://cdn.tiny.cloud/1/${d}/tinymce/${h}/tinymce.min.js`;$a.load(i.ownerDocument,e,(()=>{$()}))}})),Z((()=>{var e;s&&(null===(e=C())||void 0===e||e.remove(s))})),e.$$set=e=>{"id"in e&&n(0,a=e.id),"inline"in e&&n(1,l=e.inline),"disabled"in e&&n(7,c=e.disabled),"apiKey"in e&&n(8,d=e.apiKey),"licenseKey"in e&&n(9,u=e.licenseKey),"channel"in e&&n(10,h=e.channel),"scriptSrc"in e&&n(11,f=e.scriptSrc),"conf"in e&&n(12,m=e.conf),"modelEvents"in e&&n(13,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=()=>{245920&e.$$.dirty&&(s&&v!==g&&(s.setContent(g),n(6,w=s.getContent({format:"text"}))),s&&c!==_&&(n(17,_=c),"function"==typeof(null===n(14,r=s.mode)||void 0===r?void 0:r.set)?s.mode.set(c?"readonly":"design"):s.setMode(c?"readonly":"design")))},[a,l,y,i,o,g,w,c,d,u,h,f,m,p,r,s,v,_,function(e){ee[e?"unshift":"push"]((()=>{o=e,n(4,o)}))},function(e){ee[e?"unshift":"push"]((()=>{o=e,n(4,o)}))},function(e){ee[e?"unshift":"push"]((()=>{i=e,n(3,i)}))}]}class Aa extends Te{constructor(e){super(),Se(this,e,Ea,Ia,A,{id:0,inline:1,disabled:7,apiKey:8,licenseKey:9,channel:10,scriptSrc:11,conf:12,modelEvents:13,value:5,text:6,cssClass:2})}}function ba(e){let t,n,r,i,o,s,a;function l(t){e[9](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 Aa({props:c}),ee.push((()=>$e(n,"value",l))),{c(){t=O("div"),Ee(n.$$.fragment),i=B(),o=O("input"),U(o,"class",s=e[1]||e[2]),U(o,"id",e[3]),U(o,"name",e[3]),o.value=e[0],o.hidden=!0,z(t,"min-height","10em"),z(t,"margin-top","-1em")},m(e,r){R(e,t,r),Ae(n,t,null),N(t,i),N(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],le((()=>r=!1))),n.$set(i),(!a||6&t&&s!==(s=e[1]||e[2]))&&U(o,"class",s),(!a||8&t)&&U(o,"id",e[3]),(!a||8&t)&&U(o,"name",e[3]),(!a||1&t&&o.value!==e[0])&&(o.value=e[0])},i(e){a||(we(n.$$.fragment,e),a=!0)},o(e){ye(n.$$.fragment,e),a=!1},d(e){e&&D(t),be(n)}}}function Sa(e){let t,n,r=e[6]&&ba(e);return{c(){r&&r.c(),t=P()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,[n]){e[6]?r?(r.p(e,n),64&n&&we(r,1)):(r=ba(e),r.c(),we(r,1),r.m(t.parentNode,t)):r&&(pe(),ye(r,1,1,(()=>{r=null})),ge())},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function Ta(e,t,r){const i=K();let o=JSON.parse(n.getItem("Locale")).id;o=o.startsWith("fr")?"fr_FR":o.split("-")[0];let s,{value:a=""}=t,{noForm:l}=t,{classId:c}=t,{id:d}=t,{record:u}=t,{disabled:h}=t,{readonly:f}=t;const m=(e,t)=>{if(!s)return;if(!e)return;if(!e.includes("{{"))return;const n=t.employee;if(n)try{fh("employee",n).then((t=>{if(!t)return;const n=e.replace("{{employee.firstName}}",t.firstName).replace("{{employee.lastName}}",t.lastName);i("blur",{value:n})}))}catch(e){}},p={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:o};return Y((()=>setTimeout((()=>{r(6,s=!0),m(a,u)}),300))),e.$$set=e=>{"value"in e&&r(0,a=e.value),"noForm"in e&&r(1,l=e.noForm),"classId"in e&&r(2,c=e.classId),"id"in e&&r(3,d=e.id),"record"in e&&r(8,u=e.record),"disabled"in e&&r(4,h=e.disabled),"readonly"in e&&r(5,f=e.readonly)},e.$$.update=()=>{257&e.$$.dirty&&(a||u)&&m(a,u)},[a,l,c,d,h,f,s,p,u,function(e){a=e,r(0,a)}]}class Na extends Te{constructor(e){var t;super(),document.getElementById("svelte-yi7lpi-style")||((t=O("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}",N(document.head,t)),Se(this,e,Ta,Sa,A,{value:0,noForm:1,classId:2,id:3,record:8,disabled:4,readonly:5})}}
2
2
  /*!
3
3
  * Signature Pad v5.0.4 | https://github.com/szimek/signature_pad
4
4
  * (c) 2024 Szymon Nowak | Released under the MIT license
5
- */class Ra{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}}class Da{static fromPoints(e,t){const n=this.calculateControlPoints(e[0],e[1],e[2]).c2,r=this.calculateControlPoints(e[1],e[2],e[3]).c1;return new Da(e[1],n,r,e[2],t.start,t.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),h=Math.sqrt(o*o+s*s),f=u+h==0?0:h/(u+h),m=c+(a-c)*f,p=d+(l-d)*f,g=t.x-m,w=t.y-p;return{c1:new Ra(a+g,l+w),c2:new Ra(c+g,d+w)}}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}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}}class ka{constructor(){try{this._et=new EventTarget}catch(e){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)}}class Oa extends ka{constructor(e,t={}){var n,r,i;super(),this.canvas=e,this._drawingStroke=!1,this._isEmpty=!0,this._lastPoints=[],this._data=[],this._lastVelocity=0,this._lastWidth=0,this._handleMouseDown=e=>{this._isLeftButtonPressed(e,!0)&&!this._drawingStroke&&this._strokeBegin(this._pointerEventToSignatureEvent(e))},this._handleMouseMove=e=>{this._isLeftButtonPressed(e,!0)&&this._drawingStroke?this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e)):this._strokeEnd(this._pointerEventToSignatureEvent(e),!1)},this._handleMouseUp=e=>{this._isLeftButtonPressed(e)||this._strokeEnd(this._pointerEventToSignatureEvent(e))},this._handleTouchStart=e=>{1!==e.targetTouches.length||this._drawingStroke||(e.cancelable&&e.preventDefault(),this._strokeBegin(this._touchEventToSignatureEvent(e)))},this._handleTouchMove=e=>{1===e.targetTouches.length&&(e.cancelable&&e.preventDefault(),this._drawingStroke?this._strokeMoveUpdate(this._touchEventToSignatureEvent(e)):this._strokeEnd(this._touchEventToSignatureEvent(e),!1))},this._handleTouchEnd=e=>{0===e.targetTouches.length&&(e.cancelable&&e.preventDefault(),this.canvas.removeEventListener("touchmove",this._handleTouchMove),this._strokeEnd(this._touchEventToSignatureEvent(e)))},this._handlePointerDown=e=>{e.isPrimary&&this._isLeftButtonPressed(e)&&!this._drawingStroke&&(e.preventDefault(),this._strokeBegin(this._pointerEventToSignatureEvent(e)))},this._handlePointerMove=e=>{e.isPrimary&&(this._isLeftButtonPressed(e,!0)&&this._drawingStroke?(e.preventDefault(),this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e))):this._strokeEnd(this._pointerEventToSignatureEvent(e),!1))},this._handlePointerUp=e=>{e.isPrimary&&!this._isLeftButtonPressed(e)&&(e.preventDefault(),this._strokeEnd(this._pointerEventToSignatureEvent(e)))},this.velocityFilterWeight=t.velocityFilterWeight||.7,this.minWidth=t.minWidth||.5,this.maxWidth=t.maxWidth||2.5,this.throttle=null!==(n=t.throttle)&&void 0!==n?n:16,this.minDistance=null!==(r=t.minDistance)&&void 0!==r?r:5,this.dotSize=t.dotSize||0,this.penColor=t.penColor||"black",this.backgroundColor=t.backgroundColor||"rgba(0,0,0,0)",this.compositeOperation=t.compositeOperation||"source-over",this.canvasContextOptions=null!==(i=t.canvasContextOptions)&&void 0!==i?i:{},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}}(Oa.prototype._strokeUpdate,this.throttle):Oa.prototype._strokeUpdate,this._ctx=e.getContext("2d",this.canvasContextOptions),this.clear(),this.on()}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}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}))}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";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.removeEventListener("pointerdown",this._handlePointerDown),this.canvas.removeEventListener("mousedown",this._handleMouseDown),this.canvas.removeEventListener("touchstart",this._handleTouchStart),this._removeMoveUpEventListeners()}_getListenerFunctions(){var e;const t=window.document===this.canvas.ownerDocument?window:null!==(e=this.canvas.ownerDocument.defaultView)&&void 0!==e?e:this.canvas.ownerDocument;return{addEventListener:t.addEventListener.bind(t),removeEventListener:t.removeEventListener.bind(t)}}_removeMoveUpEventListeners(){const{removeEventListener:e}=this._getListenerFunctions();e("pointermove",this._handlePointerMove),e("pointerup",this._handlePointerUp),e("mousemove",this._handleMouseMove),e("mouseup",this._handleMouseUp),e("touchmove",this._handleTouchMove),e("touchend",this._handleTouchEnd)}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}}_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),t("mouseup",this._handleMouseUp);break;case"touchstart":t("touchmove",this._handleTouchMove),t("touchend",this._handleTouchEnd);break;case"pointerdown":t("pointermove",this._handlePointerMove),t("pointerup",this._handlePointerUp)}this._drawingStroke=!0;const n=this._getPointGroupOptions(),r=Object.assign(Object.assign({},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.dispatchEvent(new CustomEvent("endStroke",{detail:e})))}_handlePointerEvents(){this._drawingStroke=!1,this.canvas.addEventListener("pointerdown",this._handlePointerDown)}_handleMouseEvents(){this._drawingStroke=!1,this.canvas.addEventListener("mousedown",this._handleMouseDown)}_handleTouchEvents(){this.canvas.addEventListener("touchstart",this._handleTouchStart)}_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 Ra(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=Da.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 h=d*e.startPoint.y;h+=3*c*o*e.control1.y,h+=3*l*s*e.control2.y,h+=a*e.endPoint.y;const f=Math.min(e.startWidth+a*r,t.maxWidth);this._drawCurveSegment(u,h,f)}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 Ra(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}={}){const t=this._data,n=Math.max(window.devicePixelRatio||1,1),r=this.canvas.width/n,i=this.canvas.height/n,o=document.createElementNS("http://www.w3.org/2000/svg","svg");if(o.setAttribute("xmlns","http://www.w3.org/2000/svg"),o.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),o.setAttribute("viewBox",`0 0 ${r} ${i}`),o.setAttribute("width",r.toString()),o.setAttribute("height",i.toString()),e&&this.backgroundColor){const e=document.createElement("rect");e.setAttribute("width","100%"),e.setAttribute("height","100%"),e.setAttribute("fill",this.backgroundColor),o.appendChild(e)}return this._fromData(t,((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"),o.appendChild(n)}}),((e,{penColor:t,dotSize:n,minWidth:r,maxWidth:i})=>{const s=document.createElement("circle"),a=n>0?n:(r+i)/2;s.setAttribute("r",a.toString()),s.setAttribute("cx",e.x.toString()),s.setAttribute("cy",e.y.toString()),s.setAttribute("fill",t),o.appendChild(s)})),o.outerHTML}}const{document:xa}=Ie;function Ma(e){let t,n,r,i,o;return n=new tt({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather2 pointer svelte-efkzkz")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[5]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function Ba(e){let t,n,r,i,o,s,a=!e[0]&&Ma(e);return{c(){t=O("div"),n=O("canvas"),i=B(),a&&a.c(),U(n,"id",e[1]),U(n,"name",e[1]),U(n,"class",r=e[2]+" signature_pad "+e[3]+(e[0]||e[4]?" signature-readonly":"")+" svelte-efkzkz"),U(t,"class",o=e[2]+"_wrapper wrapper svelte-efkzkz"),U(t,"id","signature_wrapper")},m(e,r){R(e,t,r),N(t,n),N(t,i),a&&a.m(t,null),s=!0},p(e,[i]){(!s||2&i)&&U(n,"id",e[1]),(!s||2&i)&&U(n,"name",e[1]),(!s||29&i&&r!==(r=e[2]+" signature_pad "+e[3]+(e[0]||e[4]?" signature-readonly":"")+" svelte-efkzkz"))&&U(n,"class",r),e[0]?a&&(pe(),ye(a,1,1,(()=>{a=null})),ge()):a?(a.p(e,i),1&i&&we(a,1)):(a=Ma(e),a.c(),we(a,1),a.m(t,null)),(!s||4&i&&o!==(o=e[2]+"_wrapper wrapper svelte-efkzkz"))&&U(t,"class",o)},i(e){s||(we(a),s=!0)},o(e){ye(a),s=!1},d(e){e&&D(t),a&&a.d()}}}const Pa=new Map;let La="";function Fa(e,t,n){const r=K();let i,{id:o}=t,{name:s}=t,{value:a}=t,{record:l}=t,{classId:c}=t,{disabled:d}=t,{readonly:u}=t;const h=l._id||Math.floor(9e3*Math.random()+1e3).toString();u||=d;const f=e=>{La=e,Pa.set(h,La),r("blur",{value:La})};return Y((()=>{La=a||Pa.get(h)||"",Pa.set(h,La);const e=document.querySelector("canvas");n(8,i=new Oa(e)),u||(i.addEventListener("endStroke",(()=>{f(i.toDataURL("image/png"))})),i.addEventListener("afterUpdateStroke",(()=>{f(i.toDataURL("image/png"))})))})),Z((()=>Pa.forEach(((e,t,n)=>{t!==h&&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&&La&&i&&i.fromDataURL(La,{ratio:1})},[u,o,s,c,d,()=>{i.clear(),f("")},a,l,i]}class Va extends Te{constructor(e){var t;super(),xa.getElementById("svelte-efkzkz-style")||((t=O("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}",N(xa.head,t)),Se(this,e,Fa,Ba,A,{id:1,name:2,value:6,record:7,classId:3,disabled:4,readonly:0})}}function Ua(e,t,n){const r=e.slice();return r[36]=t[n],r[38]=n,r}function Ha(e){let t,n,r;return n=new Ve({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather2 svelte-bcd9jd"),U(t,"title",e[21])},m(e,i){R(e,t,i),Ae(n,t,null),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function Wa(e){let t,n,r,i,o;return n=new Ve({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather pointer svelte-bcd9jd"),U(t,"title",e[21])},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[22]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function za(e){let t,n,r;function i(t){e[28](t)}let o={class:"tModal",noClickaway:!0,$$slots:{default:[Za]},$$scope:{ctx:e}};return void 0!==e[8]&&(o.open=e[8]),t=new e[12]({props:o}),ee.push((()=>$e(t,"open",i))),{c(){Ee(t.$$.fragment)},m(e,n){Ae(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],le((()=>n=!1))),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function qa(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function ja(e){let t,n,r,i=(e[10]||"Keine Einträge gefunden!")+"";return{c(){t=O("tr"),n=O("td"),r=M(i),U(n,"class","svelte-bcd9jd"),U(t,"class","svelte-bcd9jd")},m(e,i){R(e,t,i),N(t,n),N(n,r)},p(e,t){1024&t[0]&&i!==(i=(e[10]||"Keine Einträge gefunden!")+"")&&H(r,i)},d(e){e&&D(t)}}}function Ga(e){let t,n=e[9],r=[];for(let t=0;t<n.length;t+=1)r[t]=Xa(Ua(e,n,t));return{c(){for(let e=0;e<r.length;e+=1)r[e].c();t=P()},m(e,n){for(let t=0;t<r.length;t+=1)r[t].m(e,n);R(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=Ua(e,n,o);r[o]?r[o].p(s,i):(r[o]=Xa(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){k(r,e),e&&D(t)}}}function Xa(e){let t,n,r,i,o,s,a=e[23](e[36])+"";return{c(){t=O("tr"),n=O("td"),r=M(a),i=B(),U(n,"class","svelte-bcd9jd"),U(t,"class","pointer svelte-bcd9jd")},m(a,l){R(a,t,l),N(t,n),N(n,r),N(t,i),o||(s=L(t,"click",V(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&&D(t),o=!1,s()}}}function Ya(e){let t,n,r,i,o,s,a,l,c,d,u,h,f;function m(e,t){return e[9]?.length?Ga:ja}n=new e[14]({props:{outline:!0,$$slots:{default:[qa]},$$scope:{ctx:e}}}),n.$on("click",e[25]),i=new e[15]({});let p=m(e),g=p(e);return{c(){t=O("div"),Ee(n.$$.fragment),r=B(),Ee(i.$$.fragment),o=B(),s=O("div"),a=O("table"),l=O("thead"),c=O("tr"),d=O("th"),d.textContent=`${e[20]}`,u=B(),h=O("tbody"),g.c(),U(d,"class","svelte-bcd9jd"),U(c,"class","svelte-bcd9jd"),U(l,"class","svelte-bcd9jd"),U(a,"striped",""),U(a,"class","svelte-bcd9jd"),U(s,"class","eList svelte-bcd9jd")},m(e,m){R(e,t,m),Ae(n,t,null),R(e,r,m),Ae(i,e,m),R(e,o,m),R(e,s,m),N(s,a),N(a,l),N(l,c),N(c,d),N(a,u),N(a,h),g.m(h,null),f=!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(h,null)))},i(e){f||(we(n.$$.fragment,e),we(i.$$.fragment,e),f=!0)},o(e){ye(n.$$.fragment,e),ye(i.$$.fragment,e),f=!1},d(e){e&&D(t),be(n),e&&D(r),be(i,e),e&&D(o),e&&D(s),g.d()}}}function Za(e){let t,n;return t=new e[13]({props:{title:e[21],class:"eList",$$slots:{default:[Ya]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Ka(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}),ee.push((()=>$e(n,"value",d))),n.$on("change",e[27]);const h=[Wa,Ha],f=[];function m(e,t){return e[6]||e[4]._id?1:0}o=m(e),s=f[o]=h[o](e);let p=e[8]&&za(e);return{c(){t=O("div"),Ee(n.$$.fragment),i=B(),s.c(),a=B(),p&&p.c(),l=P(),z(t,"position","relative")},m(e,r){R(e,t,r),Ae(n,t,null),N(t,i),f[o].m(t,null),R(e,a,r),p&&p.m(e,r),R(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],le((()=>r=!1))),n.$set(a);let c=o;o=m(e),o===c?f[o].p(e,i):(pe(),ye(f[c],1,1,(()=>{f[c]=null})),ge(),s=f[o],s?s.p(e,i):(s=f[o]=h[o](e),s.c()),we(s,1),s.m(t,null)),e[8]?p?(p.p(e,i),256&i[0]&&we(p,1)):(p=za(e),p.c(),we(p,1),p.m(l.parentNode,l)):p&&(pe(),ye(p,1,1,(()=>{p=null})),ge())},i(e){c||(we(n.$$.fragment,e),we(s),we(p),c=!0)},o(e){ye(n.$$.fragment,e),ye(s),ye(p),c=!1},d(e){e&&D(t),be(n),f[o].d(),e&&D(a),p&&p.d(e),e&&D(l)}}}function Qa(e,n,r){let i;const{TextField:o,Modal:s,Dialog:a,Button:l,Divider:d}=c,h=K(),{environment:f}=u;b(e,f,(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:C={}}=g;let{pattern:$,placeholder:E,readonly:A,required:S=!1,format:T}=C,N=!1;const{service:{type:R,map:D,title:k,designation:O}}=T;let x,M;const B=()=>{r(8,N=!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,N,x,M,o,s,a,l,d,f,$,A,S,k,O,async()=>{_||w._id||(r(9,x=[]),r(10,M=""),y.length>3&&(r(9,x=await t.getService("address",R,y)),Array.isArray(x)||r(10,M=x.error)),r(8,N=!0))},e=>D.map((({name:t})=>e[t])).filter((e=>!!e)).join(", "),e=>()=>{const t=x[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]})):h("record",{itemName:o,value:t[e]})}n.length&&h("objRecord",{listName:r,items:n}),B()},B,function(e){y=e,r(0,y)},function(t){Q(e,t)},function(e){N=e,r(8,N)}]}class Ja extends Te{constructor(e){var t;super(),document.getElementById("svelte-bcd9jd-style")||((t=O("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}",N(document.head,t)),Se(this,e,Qa,Ka,A,{classId:1,id:2,item:3,record:4,value:0,noForm:5,disabled:6,formnovalidate:7},[-1,-1])}}function el(e){let t,n,r;return n=new it({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather2 svelte-1xgbysl")},m(e,i){R(e,t,i),Ae(n,t,null),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function tl(e){let t,n,r,i,o;return n=new it({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather pointer svelte-1xgbysl")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[6]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function nl(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=[tl,el],l=[];function c(e,t){return e[4]?0:1}return i=c(e),o=l[i]=a[i](e),{c(){t=O("div"),Ee(n.$$.fragment),r=B(),o.c(),z(t,"position","relative")},m(e,o){R(e,t,o),Ae(n,t,null),N(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):(pe(),ye(l[d],1,1,(()=>{l[d]=null})),ge(),o=l[i],o?o.p(e,r):(o=l[i]=a[i](e),o.c()),we(o,1),o.m(t,null))},i(e){s||(we(n.$$.fragment,e),we(o),s=!0)},o(e){ye(n.$$.fragment,e),ye(o),s=!1},d(e){e&&D(t),be(n),l[i].d()}}}function rl(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:h}=t,{record:f}=t;const m=f?.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,h=e.value),"record"in e&&n(10,f=e.record)},[i,s,d,u,h,r,async()=>{m&&window.open(m)},o,a,l,f]}class il extends Te{constructor(e){var t;super(),document.getElementById("svelte-1xgbysl-style")||((t=O("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}",N(document.head,t)),Se(this,e,rl,nl,A,{inputClass:0,disabled:7,formnovalidate:1,readonly:8,required:9,id:2,name:3,value:4,record:10})}}function ol(e){let t,n;return t=new e[30]({props:{id:e[46](e[39]),class:e[0].name+(e[26]?" hidden ":""),nameClass:e[0].properties?.color?"color_"+e[0].properties.color:"",name:e[0].designation,help:e[0].properties?.hint,$$slots:{default:[xl,({notifyList:e})=>({24:e}),({notifyList:e})=>[e?16777216:0]]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};67108865&n[0]&&(r.class=e[0].name+(e[26]?" 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),872415231&n[0]|262144&n[2]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function sl(e){let t,n;return t=new e[33]({props:{text:e[0].designation}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};1&n[0]&&(r.text=e[0].designation),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function al(e){let t,n,r,i;return t=new e[30]({props:{id:e[46](e[39]),class:e[0].name+(e[26]?" hidden ":""),name:e[0].designation,help:e[0].properties?.hint}}),r=new Na({props:{classId:e[9],disabled:e[3],readonly:e[25],id:e[39],name:e[0].name,value:e[28](),record:e[1],noForm:e[8]}}),r.$on("blur",e[42]()),{c(){Ee(t.$$.fragment),n=B(),Ee(r.$$.fragment)},m(e,o){Ae(t,e,o),R(e,n,o),Ae(r,e,o),i=!0},p(e,n){const i={};67108865&n[0]&&(i.class=e[0].name+(e[26]?" hidden ":"")),1&n[0]&&(i.name=e[0].designation),1&n[0]&&(i.help=e[0].properties?.hint),t.$set(i);const o={};512&n[0]&&(o.classId=e[9]),8&n[0]&&(o.disabled=e[3]),33554432&n[0]&&(o.readonly=e[25]),1&n[0]&&(o.name=e[0].name),268435456&n[0]&&(o.value=e[28]()),2&n[0]&&(o.record=e[1]),256&n[0]&&(o.noForm=e[8]),r.$set(o)},i(e){i||(we(t.$$.fragment,e),we(r.$$.fragment,e),i=!0)},o(e){ye(t.$$.fragment,e),ye(r.$$.fragment,e),i=!1},d(e){be(t,e),e&&D(n),be(r,e)}}}function ll(e){let t,n,r,i,o,s;return t=new e[30]({props:{id:e[46](e[39]),class:e[0].name+" hidden",name:e[0].designation,help:e[0].properties?.hint,$$slots:{default:[Ml]},$$scope:{ctx:e}}}),r=new e[33]({props:{text:e[29]}}),o=new _i({props:{required:e[4],disabled:e[3],readonly:e[25],id:e[39],item:e[0],currency:e[19],value:e[28]()}}),o.$on("setRefValue",e[47]),o.$on("safeReference",e[52]),o.$on("objRecord",e[53]),{c(){Ee(t.$$.fragment),n=B(),Ee(r.$$.fragment),i=B(),Ee(o.$$.fragment)},m(e,a){Ae(t,e,a),R(e,n,a),Ae(r,e,a),R(e,i,a),Ae(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),402654721&n[0]|262144&n[2]&&(i.$$scope={dirty:n,ctx:e}),t.$set(i);const s={};536870912&n[0]&&(s.text=e[29]),r.$set(s);const a={};16&n[0]&&(a.required=e[4]),8&n[0]&&(a.disabled=e[3]),33554432&n[0]&&(a.readonly=e[25]),1&n[0]&&(a.item=e[0]),524288&n[0]&&(a.currency=e[19]),268435456&n[0]&&(a.value=e[28]()),o.$set(a)},i(e){s||(we(t.$$.fragment,e),we(r.$$.fragment,e),we(o.$$.fragment,e),s=!0)},o(e){ye(t.$$.fragment,e),ye(r.$$.fragment,e),ye(o.$$.fragment,e),s=!1},d(e){be(t,e),e&&D(n),be(r,e),e&&D(i),be(o,e)}}}function cl(e){let t,n;return t=new e[31]({props:{inputClass:e[8]||e[9],disabled:e[3],formnovalidate:e[12],readonly:e[25],pattern:e[35],required:!0===e[4],placeholder:e[37],id:e[39],name:e[38],value:e[28]()}}),t.$on("change",e[42]()),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),33554432&n[0]&&(r.readonly=e[25]),16&n[0]&&(r.required=!0===e[4]),268435456&n[0]&&(r.value=e[28]()),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function dl(e){let t,n;return t=new ha({props:{inputClass:e[8]||e[9],disabled:e[3],formnovalidate:e[12],readonly:e[25],required:e[4],id:e[39],name:e[38],pattern:e[35],placeholder:e[37],value:e[28]()}}),t.$on("change",e[42]()),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),33554432&n[0]&&(r.readonly=e[25]),16&n[0]&&(r.required=e[4]),268435456&n[0]&&(r.value=e[28]()),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ul(e){let t,n;return t=new il({props:{inputClass:e[8]||e[9],formnovalidate:e[12],id:e[39],name:e[38],value:e[28](),record:e[1],"}":!0}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),268435456&n[0]&&(r.value=e[28]()),2&n[0]&&(r.record=e[1]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function hl(e){let t,n;return t=new aa({props:{inputClass:e[8]||e[9],disabled:e[3],formnovalidate:e[12],readonly:e[25],required:e[4],id:e[39],name:e[38],value:e[28]()}}),t.$on("change",e[42]()),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),33554432&n[0]&&(r.readonly=e[25]),16&n[0]&&(r.required=e[4]),268435456&n[0]&&(r.value=e[28]()),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function fl(e){let t,n;return t=new wa({props:{inputClass:e[8]||e[9],disabled:e[3],formnovalidate:e[12],readonly:e[25],required:e[4],id:e[39],name:e[38],pattern:e[35],multiple:e[36],placeholder:e[37],value:e[28]()}}),t.$on("change",e[42]()),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),33554432&n[0]&&(r.readonly=e[25]),16&n[0]&&(r.required=e[4]),268435456&n[0]&&(r.value=e[28]()),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ml(e){let t,n;return t=new Xs({props:{inputClass:e[8]||e[9],disabled:e[3],readonly:e[25],required:e[4],id:e[39],item:e[0],value:e[28](),praefix:e[5]}}),t.$on("blur",e[42]()),t.$on("checkRange",e[71]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),33554432&n[0]&&(r.readonly=e[25]),16&n[0]&&(r.required=e[4]),1&n[0]&&(r.item=e[0]),268435456&n[0]&&(r.value=e[28]()),32&n[0]&&(r.praefix=e[5]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function pl(e){let t,n;return t=new fo({props:{inputClass:e[8]||e[9],disabled:e[3],formnovalidate:e[12],readonly:e[25],required:e[4],id:e[39],name:e[38],value:e[28](),record:e[1],item:e[0]}}),t.$on("change",e[42]()),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),33554432&n[0]&&(r.readonly=e[25]),16&n[0]&&(r.required=e[4]),268435456&n[0]&&(r.value=e[28]()),2&n[0]&&(r.record=e[1]),1&n[0]&&(r.item=e[0]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function gl(e){let t,n;return t=new hs({props:{classId:e[9],id:e[39],disabled:e[3],required:e[4],value:e[40](),noForm:e[8]}}),t.$on("change",e[42]()),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function wl(e){let t,n;return t=new ps({props:{classId:e[9],id:e[39],item:e[0],disabled:e[3],required:e[4],value:e[41](),noForm:e[8]}}),t.$on("change",e[42]()),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),256&n[0]&&(r.noForm=e[8]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function yl(e){let t,n;return t=new rs({props:{classId:e[9],eventId:e[10],id:e[39],item:e[0],record:e[1],readonly:e[25],disabled:e[3],required:e[4],praefix:e[5],value:e[40](),noForm:e[8],notifyList:e[24],dateInput:e[23]}}),t.$on("change",e[42](!0)),t.$on("formula",e[69]),t.$on("record",e[70]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),33554432&n[0]&&(r.readonly=e[25]),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]),16777216&n[0]&&(r.notifyList=e[24]),8388608&n[0]&&(r.dateInput=e[23]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function vl(e){let t,n;return t=new e[32]({props:{round:!0,inputClass:e[8]||e[9],disabled:e[3]||e[25],required:e[4],id:e[39],name:e[38],checked:e[28](),value:e[28](!0)}}),t.$on("change",e[42]()),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};768&n[0]&&(r.inputClass=e[8]||e[9]),33554440&n[0]&&(r.disabled=e[3]||e[25]),16&n[0]&&(r.required=e[4]),268435456&n[0]&&(r.checked=e[28]()),268435456&n[0]&&(r.value=e[28](!0)),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function _l(e){let t,n;return t=new na({props:{id:e[39],item:e[0],praefix:e[5],record:e[1],notifyList:e[24]}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),16777216&n[0]&&(r.notifyList=e[24]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Il(e){let t,n;return t=new _o({props:{classId:e[9],item:e[0],record:e[1],listName:e[6],disabled:e[3],formnovalidate:e[12],readonly:e[25],pattern:e[35],required:!0===e[4],placeholder:e[37],id:e[39],name:e[38],value:e[28]()}}),t.$on("blur",e[42]()),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),33554432&n[0]&&(r.readonly=e[25]),16&n[0]&&(r.required=!0===e[4]),268435456&n[0]&&(r.value=e[28]()),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Cl(e){let t,n;return t=new jo({props:{classId:e[9],disabled:e[3],required:e[4],id:e[39],item:e[0],record:e[1],value:e[28](),noForm:e[8],view:e[0].properties.view,praefix:e[5]}}),t.$on("blur",e[42]()),t.$on("invalid",e[68]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),268435456&n[0]&&(r.value=e[28]()),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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function $l(e){let t,n;return t=new so({props:{classId:e[9],disabled:e[3],required:e[4],id:e[39],item:e[0],record:e[1],value:e[28](),noForm:e[8],multi:e[0].properties.multi,numberInput:e[14],praefix:e[5],toDelete:e[17],reqQuantity:e[18],notifyList:e[24]}}),t.$on("blur",e[42]()),t.$on("invalid",e[67]),t.$on("record",e[43]),t.$on("multi",e[44]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),268435456&n[0]&&(r.value=e[28]()),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]),16777216&n[0]&&(r.notifyList=e[24]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function El(e){let t,n;return t=new Ai({props:{classId:e[9],disabled:e[3],formnovalidate:e[12],required:e[4],readonly:e[25],id:e[39],item:e[0],currency:e[19],value:e[28](),praefix:e[5],notifyList:e[24],noForm:e[8]}}),t.$on("blur",e[42]()),t.$on("formula",e[64]),t.$on("listRecord",e[65]),t.$on("record",e[66]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),33554432&n[0]&&(r.readonly=e[25]),1&n[0]&&(r.item=e[0]),524288&n[0]&&(r.currency=e[19]),268435456&n[0]&&(r.value=e[28]()),32&n[0]&&(r.praefix=e[5]),16777216&n[0]&&(r.notifyList=e[24]),256&n[0]&&(r.noForm=e[8]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Al(e){let t,n;return t=new Ja({props:{classId:e[9],disabled:e[3],readonly:e[25],required:e[4],id:e[39],item:e[0],record:e[1],value:e[28](),noForm:e[8]}}),t.$on("change",e[42]()),t.$on("record",e[62]),t.$on("objRecord",e[63]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),33554432&n[0]&&(r.readonly=e[25]),16&n[0]&&(r.required=e[4]),1&n[0]&&(r.item=e[0]),2&n[0]&&(r.record=e[1]),268435456&n[0]&&(r.value=e[28]()),256&n[0]&&(r.noForm=e[8]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function bl(e){let t,n;return t=new Jo({props:{classId:e[9],disabled:e[3],required:e[4],id:e[39],item:e[0],value:e[28](),noForm:e[8]}}),t.$on("blur",e[42]()),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),268435456&n[0]&&(r.value=e[28]()),256&n[0]&&(r.noForm=e[8]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Sl(e){let t,n;return t=new Va({props:{classId:e[9],disabled:e[3],readonly:e[25],id:e[39],name:e[0].name,value:e[28](),record:e[1],noForm:e[8],placeholder:e[0].properties?.placeholder}}),t.$on("blur",e[42]()),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),33554432&n[0]&&(r.readonly=e[25]),1&n[0]&&(r.name=e[0].name),268435456&n[0]&&(r.value=e[28]()),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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Tl(e){let t,n;return t=new Ws({props:{praefix:e[5],classId:e[9],disabled:e[3],readonly:e[25],item:e[0],id:e[39],name:e[0].name,eventId:e[10],record:e[1],recordId:e[2],value:e[28](),fileType:e[0].properties?.accept}}),t.$on("record",e[60]),t.$on("listRecord",e[61]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),33554432&n[0]&&(r.readonly=e[25]),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]),268435456&n[0]&&(r.value=e[28]()),1&n[0]&&(r.fileType=e[0].properties?.accept),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Nl(e){let t,n;return t=new Ds({props:{praefix:e[5],classId:e[9],disabled:e[3],readonly:e[25],item:e[0],id:e[39],name:e[0].name,eventId:e[10],record:e[1],value:e[28]()}}),t.$on("record",e[59]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),33554432&n[0]&&(r.readonly=e[25]),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]),268435456&n[0]&&(r.value=e[28]()),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Rl(e){let t,n;return t=new _s({props:{classId:e[9],disabled:e[3],readonly:e[25],item:e[0],id:e[39],name:e[0].name,eventId:e[10],record:e[1],value:e[28]()}}),t.$on("record",e[58]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),33554432&n[0]&&(r.readonly=e[25]),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]),268435456&n[0]&&(r.value=e[28]()),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Dl(e){let t,n;return t=new o({props:{classId:e[9],disabled:e[3],readonly:e[25],id:e[39],name:e[0].name,value:e[28](),noForm:e[8],standard:!0,style:"",placeholder:e[0].properties?.placeholder}}),t.$on("blur",e[42]()),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),33554432&n[0]&&(r.readonly=e[25]),1&n[0]&&(r.name=e[0].name),268435456&n[0]&&(r.value=e[28]()),256&n[0]&&(r.noForm=e[8]),1&n[0]&&(r.placeholder=e[0].properties?.placeholder),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function kl(e){let t,n;return t=new Xn({props:{classId:e[9],eventId:e[10],fullRecord:e[7],required:e[4],disabled:e[3],formnovalidate:e[12],readonly:e[25],id:e[39],item:e[0],desc:e[29],value:e[28](),multiValues:e[20],noForm:e[8],praefix:e[5],selectionFields:e[11],selection:e[13],deList:e[15],recordId:e[2],isTemplate:e[16],shortEdit:e[21],initFinished:e[22]}}),t.$on("task",e[56]),t.$on("change",e[42]()),t.$on("initFail",e[45]),t.$on("defPrep",e[57]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),1024&n[0]&&(r.eventId=e[10]),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]),33554432&n[0]&&(r.readonly=e[25]),1&n[0]&&(r.item=e[0]),536870912&n[0]&&(r.desc=e[29]),268435456&n[0]&&(r.value=e[28]()),1048576&n[0]&&(r.multiValues=e[20]),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]),2097152&n[0]&&(r.shortEdit=e[21]),4194304&n[0]&&(r.initFinished=e[22]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Ol(e){let t,n;return t=new lr({props:{classId:e[9],eventId:e[10],required:e[4],disabled:e[3],formnovalidate:e[12],readonly:e[25],id:e[39],item:e[0],record:e[1],desc:e[29],values:e[28]()||[],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[54]),t.$on("change",e[42]()),t.$on("multi",e[44]),t.$on("initFail",e[45]),t.$on("defPrep",e[55]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),33554432&n[0]&&(r.readonly=e[25]),1&n[0]&&(r.item=e[0]),2&n[0]&&(r.record=e[1]),536870912&n[0]&&(r.desc=e[29]),268435456&n[0]&&(r.values=e[28]()||[]),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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function xl(e){let t,n,r,i;const o=[Ol,kl,Dl,Rl,Nl,Tl,Sl,bl,Al,El,$l,Cl,Il,_l,vl,yl,wl,gl,pl,ml,fl,hl,ul,dl,cl],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=P()},m(e,n){s[t].m(e,n),R(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?s[t].p(e,i):(pe(),ye(s[l],1,1,(()=>{s[l]=null})),ge(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),we(n,1),n.m(r.parentNode,r))},i(e){i||(we(n),i=!0)},o(e){ye(n),i=!1},d(e){s[t].d(e),e&&D(r)}}}function Ml(e){let t,n;return t=new Xn({props:{classId:e[9],eventId:e[10],disabled:!0,readonly:!0,id:e[39],item:e[0],value:e[28](),noList:!0,withRefValue:!0,refValue:e[27]}}),t.$on("setRefDesc",e[48]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),268435456&n[0]&&(r.value=e[28]()),134217728&n[0]&&(r.refValue=e[27]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Bl(e){let t,n,r,i;const o=[ll,al,sl,ol],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=P()},m(e,n){s[t].m(e,n),R(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?s[t].p(e,i):(pe(),ye(s[l],1,1,(()=>{s[l]=null})),ge(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),we(n,1),n.m(r.parentNode,r))},i(e){i||(we(n),i=!0)},o(e){ye(n),i=!1},d(e){s[t].d(e),e&&D(r)}}}function Pl(e,n,r){let i,o,s,a;const l=K(),{FormField:d,TextField:h,DatePicker:f,TimePicker:p,Checkbox:g,Divider:w}=c,{environment:y}=u;b(e,y,(e=>r(51,a=e)));let{praefix:v=""}=n,{item:_}=n,{listName:I=""}=n,{fullRecord:C}=n,{record:$}=n,{recordId:E}=n,{noForm:A=!1}=n,{classId:S}=n,{eventId:T}=n,{disabled:N}=n,{selectionFields:R}=n,{formnovalidate:D}=n,{selection:k=!1}=n,{notifyList:O}=n,{numberInput:x}=n,{deList:M}=n,{required:B}=n,{isTemplate:P}=n,{toDelete:L}=n,{reqQuantity:F}=n,{currency:V}=n,{changeValue:U}=n,{propSelection:H}=n,{multiValues:W}=n,{shortEdit:z}=n,{initFinished:q}=n,{dateInput:j}=n;E||=$._id;let{required:G,readonly:X,hidden:Y,pattern:Z,multiple:J,placeholder:ee}=_.properties||{};if(Y=!0===Y,void 0!==X&&(X=!0===X),X||=E&&_.asInput,void 0===B&&(B=G),N=N||!!X,"string"==typeof _.name){const[e,t]=_.name.split("_");t&&(_.name=t)}const te=(I?I+".":"")+_.name,ne=te+(""!==v?"-"+v:""),re=(e,t=te)=>{try{return t.split(".").reduce(((e,t)=>e[t]),e)}catch(e){return""}},ie=async e=>{const{list:n,values:r}=_.process;if(!e)return void l("save",{itemName:n,value:[],addToRecord:!0});const i={},o=await t.getSchema(T);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}l("save",{itemName:n,value:[i],addToRecord:!0})};let oe=re($);return e.$$set=e=>{"praefix"in e&&r(5,v=e.praefix),"item"in e&&r(0,_=e.item),"listName"in e&&r(6,I=e.listName),"fullRecord"in e&&r(7,C=e.fullRecord),"record"in e&&r(1,$=e.record),"recordId"in e&&r(2,E=e.recordId),"noForm"in e&&r(8,A=e.noForm),"classId"in e&&r(9,S=e.classId),"eventId"in e&&r(10,T=e.eventId),"disabled"in e&&r(3,N=e.disabled),"selectionFields"in e&&r(11,R=e.selectionFields),"formnovalidate"in e&&r(12,D=e.formnovalidate),"selection"in e&&r(13,k=e.selection),"notifyList"in e&&r(24,O=e.notifyList),"numberInput"in e&&r(14,x=e.numberInput),"deList"in e&&r(15,M=e.deList),"required"in e&&r(4,B=e.required),"isTemplate"in e&&r(16,P=e.isTemplate),"toDelete"in e&&r(17,L=e.toDelete),"reqQuantity"in e&&r(18,F=e.reqQuantity),"currency"in e&&r(19,V=e.currency),"changeValue"in e&&r(49,U=e.changeValue),"propSelection"in e&&r(50,H=e.propSelection),"multiValues"in e&&r(20,W=e.multiValues),"shortEdit"in e&&r(21,z=e.shortEdit),"initFinished"in e&&r(22,q=e.initFinished),"dateInput"in e&&r(23,j=e.dateInput)},e.$$.update=()=>{if(1&e.$$.dirty[0]|524288&e.$$.dirty[1]&&H&&_.properties?.selection){const{refClass:e,refItem:t,target:n}=_.properties.selection,r=H.record[e];l("propSelection",{itemName:_.name,itemType:_.type,prop:t,target:n,source:e,sourceId:r})}if(262144&e.$$.dirty[1])for(const e in U)e===te&&r(1,$[te]=U[e],$);7&e.$$.dirty[0]|1048576&e.$$.dirty[1]&&r(28,i=(e=!1)=>{let t;return E||"number"!==_.type&&"string"!==_.type||!_.refItemAlt?.startsWith||!_.refItemAlt.startsWith("owner.")||+re($)?E||"number"!==_.type&&"string"!==_.type||!_.refItem?.startsWith||!_.refItem.startsWith("owner.")?(t=re($),!t&&_.properties?.useId&&(t=$._id),e&&(t=!!t),void 0===t?"":t):(t=re(a,_.refItem),void 0===t?"":t):(t=re(a,_.refItemAlt),void 0===t?"":t)}),2&e.$$.dirty[0]&&(s=re($))},r(29,o=((e=te)=>{let t=$["_"+e];return t=m(t),void 0===t?"":t})()),[_,$,E,N,B,v,I,C,A,S,T,R,D,k,x,M,P,L,F,V,W,z,q,j,O,X,Y,oe,i,o,d,h,g,w,y,Z,J,ee,te,ne,(e=te)=>{let t=re($);return t?new Date(t):""===v?(()=>{const e=new Date;return new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()-1,23))})():void 0},(e=te)=>{const t=re($,e+"_from"),n=re($,e+"_to");return{from:void 0===t?t:new Date(t),to:void 0===n?n:new Date(n)}},e=>({detail:t})=>{let{value:n,checked:i,range:o}=t;void 0!==i&&(n=i);const a=te+(o||"");r(1,$[a]=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,$);const c=Object.values($).every((e=>!e))&&n;l("notify",{oldValue:s,value:n,add:c,itemName:a,desc:t.description}),"boolean"===_.type&&_.process&&ie(i)},({detail:e})=>{l("record",e)},({detail:e})=>{l("multi",e)},()=>r(26,Y=!0),()=>"object"===_.type?"comment_"+ne:ne,({detail:e})=>{r(27,oe=e)},({detail:e})=>{const{designation:t}=_;r(29,o=t+": "+(e||"(Neu)"))},U,H,a,function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)}]}class Ll extends Te{constructor(e){var t;super(),document.getElementById("svelte-rxh0vh-style")||((t=O("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}",N(document.head,t)),Se(this,e,Pl,Bl,A,{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:24,numberInput:14,deList:15,required:4,isTemplate:16,toDelete:17,reqQuantity:18,currency:19,changeValue:49,propSelection:50,multiValues:20,shortEdit:21,initFinished:22,dateInput:23},[-1,-1,-1])}}var Fl;!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"}(Fl||(Fl={}));var Vl,Ul,Hl=new Map([[Fl.QR_CODE,"QR_CODE"],[Fl.AZTEC,"AZTEC"],[Fl.CODABAR,"CODABAR"],[Fl.CODE_39,"CODE_39"],[Fl.CODE_93,"CODE_93"],[Fl.CODE_128,"CODE_128"],[Fl.DATA_MATRIX,"DATA_MATRIX"],[Fl.MAXICODE,"MAXICODE"],[Fl.ITF,"ITF"],[Fl.EAN_13,"EAN_13"],[Fl.EAN_8,"EAN_8"],[Fl.PDF_417,"PDF_417"],[Fl.RSS_14,"RSS_14"],[Fl.RSS_EXPANDED,"RSS_EXPANDED"],[Fl.UPC_A,"UPC_A"],[Fl.UPC_E,"UPC_E"],[Fl.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]);function Wl(e){return Object.values(Fl).includes(e)}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.URL=1]="URL"}(Vl||(Vl={})),function(e){e[e.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",e[e.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"}(Ul||(Ul={}));var zl,ql=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=[Ul.SCAN_TYPE_CAMERA,Ul.SCAN_TYPE_FILE],e}(),jl=function(){function e(e,t){this.format=e,this.formatName=t}return e.prototype.toString=function(){return this.formatName},e.create=function(t){if(!Hl.has(t))throw"".concat(t," not in html5QrcodeSupportedFormatsTextMap");return new e(t,Hl.get(t))},e}(),Gl=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"}(zl||(zl={}));var Xl=function(){function e(){}return e.createFrom=function(e){return{errorMessage:e,type:zl.UNKWOWN_ERROR}},e}(),Yl=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 Zl(e){return null==e}var Kl=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}(),Ql=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}(),Jl="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ec(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function tc(e){var t={exports:{}};return e(t,t.exports),t.exports}var nc,rc,ic=tc((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 h extends l{static getChecksumInstance(){return new h}}h.kind="ChecksumException";class f{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 C extends l{static getFormatInstance(){return new C}}C.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 ${constructor(e,t,n,...r){this.valueIdentifier=e,this.name=n,this.values="number"==typeof t?Int32Array.from([t]):t,this.otherEncodingNames=r,$.VALUE_IDENTIFIER_TO_ECI.set(e,this),$.NAME_TO_ECI.set(n,this);const i=this.values;for(let e=0,t=i.length;e!==t;e++){const t=i[e];$.VALUES_TO_ECI.set(t,this)}for(const e of r)$.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 C("incorect value");const t=$.VALUES_TO_ECI.get(e);if(void 0===t)throw new C("incorect value");return t}static getCharacterSetECIByName(e){const t=$.NAME_TO_ECI.get(e);if(void 0===t)throw new C("incorect value");return t}equals(e){if(!(e instanceof $))return!1;const t=e;return this.getName()===t.getName()}}$.VALUE_IDENTIFIER_TO_ECI=new Map,$.VALUES_TO_ECI=new Map,$.NAME_TO_ECI=new Map,$.Cp437=new $(_.Cp437,Int32Array.from([0,2]),"Cp437"),$.ISO8859_1=new $(_.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),$.ISO8859_2=new $(_.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),$.ISO8859_3=new $(_.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),$.ISO8859_4=new $(_.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),$.ISO8859_5=new $(_.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),$.ISO8859_6=new $(_.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),$.ISO8859_7=new $(_.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),$.ISO8859_8=new $(_.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),$.ISO8859_9=new $(_.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),$.ISO8859_10=new $(_.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),$.ISO8859_11=new $(_.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),$.ISO8859_13=new $(_.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),$.ISO8859_14=new $(_.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),$.ISO8859_15=new $(_.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),$.ISO8859_16=new $(_.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),$.SJIS=new $(_.SJIS,20,"SJIS","Shift_JIS"),$.Cp1250=new $(_.Cp1250,21,"Cp1250","windows-1250"),$.Cp1251=new $(_.Cp1251,22,"Cp1251","windows-1251"),$.Cp1252=new $(_.Cp1252,23,"Cp1252","windows-1252"),$.Cp1256=new $(_.Cp1256,24,"Cp1256","windows-1256"),$.UnicodeBigUnmarked=new $(_.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),$.UTF8=new $(_.UTF8,26,"UTF8","UTF-8"),$.ASCII=new $(_.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),$.Big5=new $(_.Big5,28,"Big5"),$.GB18030=new $(_.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),$.EUC_KR=new $(_.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 $?e:$.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($.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($.UTF8)||e.equals($.ISO8859_1)||e.equals($.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,h=0,f=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++,f=0,h++,h>m&&(m=h)):n>127?(d++,h=0,f++,f>p&&(p=f)):(h=0,f=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=$.SJIS.getName(),b.GB2312="GB2312",b.ISO88591=$.ISO8859_1.getName(),b.EUC_JP="EUC_JP",b.UTF8=$.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 T{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 T(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 T(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 T))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 T(this.width,this.height,this.rowSize,this.bits.slice())}}class N extends l{static getNotFoundInstance(){return new N}}N.kind="NotFoundException";class R extends f{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 T(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 N;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;t&D.BLOCK_SIZE_MASK&&i++;let o=n>>D.BLOCK_SIZE_POWER;n&D.BLOCK_SIZE_MASK&&o++;const s=D.calculateBlackPoints(r,i,o,t,n),a=new T(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 h=u/25;D.thresholdBlock(e,i,c,h,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 k{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 O extends k{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 O(this.delegate.crop(e,t,n,r))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new O(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new O(this.delegate.rotateCounterClockwise45())}}class x extends k{constructor(e){super(e.width,e.height),this.canvas=e,this.tempCanvasElement=null,this.buffer=x.makeBufferFromCanvasImageData(e)}static makeBufferFromCanvasImageData(e){const t=e.getContext("2d").getImageData(0,0,e.width,e.height);return x.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*x.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=x.makeBufferFromCanvasImageData(t),this}invert(){return new O(this)}}x.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 B,P=(globalThis||Jl||self||window?(globalThis||Jl||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 P(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 P(this,void 0,void 0,(function*(){return(yield this.listVideoInputDevices()).map((e=>new M(e.deviceId,e.label)))}))}findDeviceById(e){return P(this,void 0,void 0,(function*(){const t=yield this.listVideoInputDevices();return t?t.find((t=>t.deviceId===e)):null}))}decodeFromInputVideoDevice(e,t){return P(this,void 0,void 0,(function*(){return yield this.decodeOnceFromVideoDevice(e,t)}))}decodeOnceFromVideoDevice(e,t){return P(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 P(this,void 0,void 0,(function*(){const n=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeOnceFromStream(n,t)}))}decodeOnceFromStream(e,t){return P(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 P(this,void 0,void 0,(function*(){return yield this.decodeFromVideoDevice(e,t,n)}))}decodeFromVideoDevice(e,t,n){return P(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 P(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 P(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 P(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 P(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 P(this,void 0,void 0,(function*(){return yield this.playVideoOnLoadAsync(e),yield this.decodeOnce(e)}))}_decodeOnLoadVideoContinuously(e,t){return P(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 N("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 N||(e instanceof h||e instanceof C)&&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 h||e instanceof C||e instanceof N)&&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 x(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"}(B||(B={}));var V,U=B;!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 H,W,z,q,j,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"}(H||(H={}));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=H.UPPER,r=H.UPPER,i="",o=0;for(;o<t;)if(r===H.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===H.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 H.LOWER;case"P":return H.PUNCT;case"M":return H.MIXED;case"D":return H.DIGIT;case"B":return H.BINARY;default:return H.UPPER}}static getCharacter(e,t){switch(e){case H.UPPER:return re.UPPER_TABLE[t];case H.LOWER:return re.LOWER_TABLE[t];case H.MIXED:return re.MIXED_TABLE[t];case H.PUNCT:return re.PUNCT_TABLE[t];case H.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 C;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 C(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 C;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 N}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,h=this.height;for(;o;){o=!1;let f=!0;for(;(f||!a)&&t<u;)f=this.containsBlackPoint(n,r,t,!1),f?(t++,o=!0,a=!0):a||t++;if(t>=u){i=!0;break}let m=!0;for(;(m||!l)&&r<h;)m=this.containsBlackPoint(e,t,r,!0),m?(r++,o=!0,l=!0):l||r++;if(r>=h){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 N;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 N;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 N;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 N;return this.centerEdges(l,o,a,s)}throw new N}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(),h=ce.CORR;return i<this.width/2?[new se(d-h,u+h),new se(s+h,a+h),new se(l-h,c-h),new se(i+h,o-h)]:[new se(d+h,u+h),new se(s+h,a-h),new se(l-h,c+h),new se(i-h,o-h)]}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 N;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 N;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,h,f,m,p){const g=ue.quadrilateralToSquare(e,t,n,r,i,o,s,a);return ue.squareToQuadrilateral(l,c,d,u,h,f,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],h=e[u+1],f=i*t+a*h+d;e[u]=(n*t+o*h+l)/f,e[u+1]=(r*t+s*h+c)/f}}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 h=0;h<u;h++){const u=e[h],f=t[h],m=i*u+a*f+d;e[h]=(n*u+o*f+l)/m,t[h]=(r*u+s*f+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,h=r-o,f=a-o,m=d*f-u*h,p=(l*f-u*c)/m,g=(d*c-l*h)/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 he extends de{sampleGrid(e,t,n,r,i,o,s,a,l,c,d,u,h,f,m,p,g,w,y){const v=ue.quadrilateralToQuadrilateral(r,i,o,s,a,l,c,d,u,h,f,m,p,g,w,y);return this.sampleGridWithTransform(e,t,n,v)}sampleGridWithTransform(e,t,n,r){if(t<=0||n<=0)throw new N;const i=new T(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 N}}return i}}class fe{static setGridSampler(e){fe.gridSampler=e}static getInstance(){return fe.gridSampler}}fe.gridSampler=new he;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 N;let t=2*this.nbCenterLayers,n=new Int32Array([this.sampleLine(e[0],e[1],t),this.sampleLine(e[1],e[2],t),this.sampleLine(e[2],e[3],t),this.sampleLine(e[3],e[0],t)]);this.shift=this.getRotation(n,t);let r=0;for(let 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 N}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 N}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 N;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=fe.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 N}}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 N}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 N;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 N}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 N;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 N}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 N}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 C}let c=!1,d=!1,u="",f=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,$=!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),f=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 C}switch(l){case ve.CODE_CODE_A:if(w<64)u+=E===$?String.fromCharCode(" ".charCodeAt(0)+w):String.fromCharCode(" ".charCodeAt(0)+w+128),E=!1;else if(w<96)u+=E===$?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:!$&&E?($=!0,E=!1):$&&E?($=!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===$?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:!$&&E?($=!0,E=!1):$&&E?($=!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-f;if(m=t.getNextUnset(m),!t.isRange(m,Math.min(t.getSize(),m+(m-f)/2),!1))throw new N;if(y-=v*g,y%103!==g)throw new h;const b=u.length;if(0===b)throw new N;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,T=f+A/2,R=a.length,D=new Uint8Array(R);for(let e=0;e<R;e++)D[e]=a[e];const k=[new se(S,e),new se(T,e)];return new F(u,D,0,k,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 N;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 N;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 h;this.decodeRowResult=this.decodeRowResult.substring(0,e)}if(0===this.decodeRowResult.length)throw new N;c=this.extendedMode?_e.decodeExtended(this.decodeRowResult):this.decodeRowResult;let u=(s[1]+s[0])/2,f=o+d/2;return new F(c,null,0,[new se(u,e),new se(f,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 N}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 N}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 C;o=String.fromCharCode(i.charCodeAt(0)+32);break;case"$":if(!(i>="A"&&i<="Z"))throw new C;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 C;o=""}break;case"/":if(i>="A"&&i<="O")o=String.fromCharCode(i.charCodeAt(0)-32);else{if("Z"!==i)throw new C;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 C;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 N}static skipWhiteSpace(e){const t=e.getSize(),n=e.getNextSet(0);if(n===t)throw new N;return n}decodeEnd(e){e.reverse();try{let t,n=Ie.skipWhiteSpace(e);try{t=Ie.findGuardPattern(e,n,Ie.END_PATTERN_REVERSED[0])}catch(r){r instanceof N&&(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 N}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 N}}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 Ce 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=Ce.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 Ce.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(0===t)return!1;let n=parseInt(e.charAt(t-1),10);return Ce.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 C;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 C;n+=t}return(1e3-n)%10}static decodeEnd(e,t){return Ce.findGuardPattern(e,t,!1,Ce.START_END_PATTERN,new Int32Array(Ce.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,Ce.MAX_INDIVIDUAL_VARIANCE)<Ce.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 N}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,Ce.MAX_INDIVIDUAL_VARIANCE);s<i&&(i=s,o=e)}if(o>=0)return o;throw new N}}Ce.MAX_AVG_VARIANCE=.48,Ce.MAX_INDIVIDUAL_VARIANCE=.7,Ce.START_END_PATTERN=Int32Array.from([1,1,1]),Ce.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),Ce.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),Ce.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 $e{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=$e.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=Ce.decodeDigit(e,r,o,Ce.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 N;let a=this.determineCheckDigit(s);if($e.extensionChecksum(n.toString())!==a)throw new N;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 N}static parseExtensionString(e){if(5!==e.length)return null;let t=$e.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=Ce.decodeDigit(e,r,o,Ce.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 N;if(parseInt(n.toString())%4!==s)throw new N;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=Ce.findGuardPattern(t,n,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return(new $e).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 Ce{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 N;let u=a.toString();if(u.length<8)throw new C;if(!be.checkChecksum(u))throw new h;let f=(r[1]+r[0])/2,m=(l[1]+l[0])/2,p=this.getBarcodeFormat(),g=[new se(f,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 N}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 C;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 C;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 N}}Se.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class Te 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 Ne 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 N}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 N.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 Ne),r.push(new Te),r.push(new Re)):(n.indexOf(U.EAN_13)>-1&&r.push(new Se),n.indexOf(U.UPC_A)>-1&&r.push(new Ne),n.indexOf(U.EAN_8)>-1&&r.push(new Te),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 N}reset(){for(let e of this.readers)e.reset()}}class ke 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],ke.MAX_INDIVIDUAL_VARIANCE)<ke.MAX_AVG_VARIANCE)return n;throw new N}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>=ke.MIN_FINDER_PATTERN_RATIO&&n<=ke.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}}ke.MAX_AVG_VARIANCE=.2,ke.MAX_INDIVIDUAL_VARIANCE=.45,ke.MIN_FINDER_PATTERN_RATIO=9.5/12,ke.MAX_FINDER_PATTERN_RATIO=12.5/14;class Oe{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 Oe))return!1;const t=e;return this.value===t.value&&this.checksumPortion===t.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class xe{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 xe))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 Be{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 Pe{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 C;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 He{constructor(){}static parseFieldsInGeneralPurpose(e){if(!e)return null;if(e.length<2)throw new N;let t=e.substring(0,2);for(let n of He.TWO_DIGIT_DATA_LENGTH)if(n[0]===t)return n[1]===He.VARIABLE_LENGTH?He.processVariableAI(2,n[2],e):He.processFixedAI(2,n[1],e);if(e.length<3)throw new N;let n=e.substring(0,3);for(let t of He.THREE_DIGIT_DATA_LENGTH)if(t[0]===n)return t[1]===He.VARIABLE_LENGTH?He.processVariableAI(3,t[2],e):He.processFixedAI(3,t[1],e);for(let t of He.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(t[0]===n)return t[1]===He.VARIABLE_LENGTH?He.processVariableAI(4,t[2],e):He.processFixedAI(4,t[1],e);if(e.length<4)throw new N;let r=e.substring(0,4);for(let t of He.FOUR_DIGIT_DATA_LENGTH)if(t[0]===r)return t[1]===He.VARIABLE_LENGTH?He.processVariableAI(4,t[2],e):He.processFixedAI(4,t[1],e);throw new N}static processFixedAI(e,t,n){if(n.length<e)throw new N;let r=n.substring(0,e);if(n.length<e+t)throw new N;let i=n.substring(e,e+t),o=n.substring(e+t),s="("+r+")"+i,a=He.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=He.parseFieldsInGeneralPurpose(s);return null==l?a:a+l}}He.VARIABLE_LENGTH=[],He.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",He.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",He.VARIABLE_LENGTH,20],["22",He.VARIABLE_LENGTH,29],["30",He.VARIABLE_LENGTH,8],["37",He.VARIABLE_LENGTH,8],["90",He.VARIABLE_LENGTH,30],["91",He.VARIABLE_LENGTH,30],["92",He.VARIABLE_LENGTH,30],["93",He.VARIABLE_LENGTH,30],["94",He.VARIABLE_LENGTH,30],["95",He.VARIABLE_LENGTH,30],["96",He.VARIABLE_LENGTH,30],["97",He.VARIABLE_LENGTH,3],["98",He.VARIABLE_LENGTH,30],["99",He.VARIABLE_LENGTH,30]],He.THREE_DIGIT_DATA_LENGTH=[["240",He.VARIABLE_LENGTH,30],["241",He.VARIABLE_LENGTH,30],["242",He.VARIABLE_LENGTH,6],["250",He.VARIABLE_LENGTH,30],["251",He.VARIABLE_LENGTH,30],["253",He.VARIABLE_LENGTH,17],["254",He.VARIABLE_LENGTH,20],["400",He.VARIABLE_LENGTH,30],["401",He.VARIABLE_LENGTH,30],["402",17],["403",He.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",He.VARIABLE_LENGTH,20],["421",He.VARIABLE_LENGTH,15],["422",3],["423",He.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],He.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",He.VARIABLE_LENGTH,15],["391",He.VARIABLE_LENGTH,18],["392",He.VARIABLE_LENGTH,15],["393",He.VARIABLE_LENGTH,18],["703",He.VARIABLE_LENGTH,30]],He.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",He.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",He.VARIABLE_LENGTH,20],["8003",He.VARIABLE_LENGTH,30],["8004",He.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",He.VARIABLE_LENGTH,30],["8008",He.VARIABLE_LENGTH,12],["8018",18],["8020",He.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",He.VARIABLE_LENGTH,70],["8200",He.VARIABLE_LENGTH,70]];class We{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=He.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 We.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 Pe(!0,t)}if(this.buffer.append(e.getFirstDigit()),e.isSecondDigitFNC1()){let e=new Ve(this.current.getPosition(),this.buffer.toString());return new Pe(!0,e)}this.buffer.append(e.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new Pe(!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 Pe(!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 Pe(!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 Pe(!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 Pe(!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 C}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 ze{constructor(e){this.information=e,this.generalDecoder=new We(e)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class qe extends ze{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)}qe.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)}}qe.GTIN_SIZE=40;class je extends qe{constructor(e){super(e)}parseInformation(){let e=new S;e.append("(01)");let t=e.length(),n=this.getGeneralDecoder().extractNumericValueFromBitArray(je.HEADER_SIZE,4);return e.append(n),this.encodeCompressedGtinWithoutAI(e,je.HEADER_SIZE+4,t),this.getGeneralDecoder().decodeAllCodes(e,je.HEADER_SIZE+44)}}je.HEADER_SIZE=4;class Ge extends ze{constructor(e){super(e)}parseInformation(){let e=new S;return this.getGeneralDecoder().decodeAllCodes(e,Ge.HEADER_SIZE)}}Ge.HEADER_SIZE=5;class Xe extends qe{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 N;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 qe{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<Qe.HEADER_SIZE+qe.GTIN_SIZE)throw new N;let e=new S;this.encodeCompressedGtin(e,Qe.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(Qe.HEADER_SIZE+qe.GTIN_SIZE,Qe.LAST_DIGIT_SIZE);e.append("(392"),e.append(t),e.append(")");let n=this.getGeneralDecoder().decodeGeneralPurposeField(Qe.HEADER_SIZE+qe.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 qe{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<Je.HEADER_SIZE+qe.GTIN_SIZE)throw new N;let e=new S;this.encodeCompressedGtin(e,Je.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(Je.HEADER_SIZE+qe.GTIN_SIZE,Je.LAST_DIGIT_SIZE);e.append("(393"),e.append(t),e.append(")");let n=this.getGeneralDecoder().extractNumericValueFromBitArray(Je.HEADER_SIZE+qe.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+qe.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 N;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 je(e);if(!e.get(2))return new Ge(e);switch(We.extractNumericValueFromBitArray(e,1,4)){case 4:return new Ze(e);case 5:return new Ke(e)}switch(We.extractNumericValueFromBitArray(e,1,5)){case 12:return new Qe(e);case 13:return new Je(e)}switch(We.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 ke{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 N){if(!this.pairs.length)throw new N;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 N}checkRowsBoolean(e){if(this.rows.length>25)return this.rows.length=0,null;this.pairs.length=0,e&&(this.rows=this.rows.reverse());let t=null;try{t=this.checkRows(new Array,0)}catch(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 N}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(Be.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 N;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 N}static reverseCounters(e){let t=e.length;for(let n=0;n<t/2;++n){let r=e[n];e[n]=e[t-n-1],e[t-n-1]=r}}parseFoundFinderPattern(e,t,n){let r,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 xe(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 N;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 N;n=1}else if(n>8){if(t>8.7)throw new N;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 h=4*t.getValue()+(n?0:2)+(r?0:1)-1,f=0,m=0;for(let e=l.length-1;e>=0;e--){if(it.isNotA1left(t,n,r)){let t=it.WEIGHTS[h][2*e];m+=l[e]*t}f+=l[e]}let p=0;for(let e=c.length-1;e>=0;e--)if(it.isNotA1left(t,n,r)){let t=it.WEIGHTS[h][2*e+1];p+=c[e]*t}let g=m+p;if(1&f||f>13||f<4)throw new N;let w=(13-f)/2,y=it.SYMBOL_WIDEST[w],v=9-y,_=Me.getRSSvalue(l,y,!0),I=Me.getRSSvalue(c,v,!1),C=it.EVEN_TOTAL_SUBSET[w],$=it.GSUM[w];return new Oe(_*C+I+$,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 N;i=!0}else{if(!c)throw new N;s=!0}else if(-1==a)if(l){if(c)throw new N;r=!0}else{if(!c)throw new N;o=!0}else{if(0!=a)throw new N;if(l){if(!c)throw new N;t<n?(r=!0,s=!0):(i=!0,o=!0)}else if(c)throw new N}if(r){if(i)throw new N;it.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(i&&it.decrement(this.getOddCounts(),this.getOddRoundingErrors()),o){if(s)throw new N;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 Oe{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 ke{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 N}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 h=0,f=0;for(let e=a.length-1;e>=0;e--)h*=9,h+=a[e],f+=a[e];let m=u+3*h;if(n){if(1&d||d>12||d<4)throw new N;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 Oe(r*o+i+l,m)}{if(1&f||f>10||f<4)throw new N;let e=(10-f)/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 Oe(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(ke.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 N}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 xe(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 N;o=!0}else{if(!d)throw new N;a=!0}else if(-1===l)if(c){if(d)throw new N;i=!0}else{if(!d)throw new N;s=!0}else{if(0!==l)throw new N;if(c){if(!d)throw new N;n<r?(i=!0,a=!0):(o=!0,s=!0)}else if(d)throw new N}if(i){if(o)throw new N;ke.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(o&&ke.decrement(this.getOddCounts(),this.getOddRoundingErrors()),s){if(a)throw new N;ke.increment(this.getEvenCounts(),this.getOddRoundingErrors())}a&&ke.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 N}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 C;for(let n of ut.VERSIONS)if(n.symbolSizeRows===e&&n.symbolSizeColumns===t)return n;throw new C}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 ht{constructor(e){const t=e.getHeight();if(t<8||t>144||1&t)throw new C;this.version=ht.readVersion(e),this.mappingBitMatrix=this.extractDataRegion(e),this.readMappingMatrix=new T(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 C;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 T(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 ft{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 ft(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(),h=u?8:s;for(let t=0;t<h;t++)o[t].codewords[a-1]=e[c++];const f=o[0].codewords.length;for(let t=a;t<f;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"}(W||(W={}));class pt{static decode(e){const t=new mt(e),n=new S,r=new S,i=new Array;let o=W.ASCII_ENCODE;do{if(o===W.ASCII_ENCODE)o=this.decodeAsciiSegment(t,n,r);else{switch(o){case W.C40_ENCODE:this.decodeC40Segment(t,n);break;case W.TEXT_ENCODE:this.decodeTextSegment(t,n);break;case W.ANSIX12_ENCODE:this.decodeAnsiX12Segment(t,n);break;case W.EDIFACT_ENCODE:this.decodeEdifactSegment(t,n);break;case W.BASE256_ENCODE:this.decodeBase256Segment(t,n,i);break;default:throw new C}o=W.ASCII_ENCODE}}while(o!==W.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 C;if(i<=128)return r&&(i+=128),t.append(String.fromCharCode(i-1)),W.ASCII_ENCODE;if(129===i)return W.PAD_ENCODE;if(i<=229){const e=i-130;e<10&&t.append("0"),t.append(""+e)}else switch(i){case 230:return W.C40_ENCODE;case 231:return W.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 W.ANSIX12_ENCODE;case 239:return W.TEXT_ENCODE;case 240:return W.EDIFACT_ENCODE;default:if(254!==i||0!==e.available())throw new C}}while(e.available()>0);return W.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 C;{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 C}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 C}}}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 C;{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 C}i=0;break;case 3:if(!(o<this.TEXT_SHIFT3_SET_CHARS.length))throw new C;{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 C}}}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 C;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 C;const s=new Uint8Array(o);for(let t=0;t<o;t++){if(e.available()<8)throw new C;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 ht(e),n=t.getVersion(),r=t.readCodewords(),i=ft.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 h}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 N;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,h=(t.getY()+n.getY()+r.getY()+i.getY())/4;return t=wt.moveAway(t,u,h),n=wt.moveAway(n,u,h),r=wt.moveAway(r,u,h),i=wt.moveAway(i,u,h),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 fe.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,h=0,f=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!==f&&(h++,f=n),c+=l,c>0){if(t===o)break;t+=d,c-=a}}return h}}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 N;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 N;const c=r/2;i+=c,s+=c;const d=new T(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 N;const o=r-e[0];if(0===o)throw new N;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"}(z||(z={}));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(z.L,"L",1),_t.M=new _t(z.M,"M",0),_t.Q=new _t(z.Q,"Q",3),_t.H=new _t(z.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 Ct{constructor(e,...t){this.ecCodewordsPerBlock=e,this.ecBlocks=t}getECCodewordsPerBlock(){return this.ecCodewordsPerBlock}getNumBlocks(){let e=0;const t=this.ecBlocks;for(const n of t)e+=n.getCount();return e}getTotalECCodewords(){return this.ecCodewordsPerBlock*this.getNumBlocks()}getECBlocks(){return this.ecBlocks}}class $t{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class 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 C;try{return this.getVersionForNumber((e-17)/4)}catch(e){throw new C}}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 T(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 Ct(7,new $t(1,19)),new Ct(10,new $t(1,16)),new Ct(13,new $t(1,13)),new Ct(17,new $t(1,9))),new Et(2,Int32Array.from([6,18]),new Ct(10,new $t(1,34)),new Ct(16,new $t(1,28)),new Ct(22,new $t(1,22)),new Ct(28,new $t(1,16))),new Et(3,Int32Array.from([6,22]),new Ct(15,new $t(1,55)),new Ct(26,new $t(1,44)),new Ct(18,new $t(2,17)),new Ct(22,new $t(2,13))),new Et(4,Int32Array.from([6,26]),new Ct(20,new $t(1,80)),new Ct(18,new $t(2,32)),new Ct(26,new $t(2,24)),new Ct(16,new $t(4,9))),new Et(5,Int32Array.from([6,30]),new Ct(26,new $t(1,108)),new Ct(24,new $t(2,43)),new Ct(18,new $t(2,15),new $t(2,16)),new Ct(22,new $t(2,11),new $t(2,12))),new Et(6,Int32Array.from([6,34]),new Ct(18,new $t(2,68)),new Ct(16,new $t(4,27)),new Ct(24,new $t(4,19)),new Ct(28,new $t(4,15))),new Et(7,Int32Array.from([6,22,38]),new Ct(20,new $t(2,78)),new Ct(18,new $t(4,31)),new Ct(18,new $t(2,14),new $t(4,15)),new Ct(26,new $t(4,13),new $t(1,14))),new Et(8,Int32Array.from([6,24,42]),new Ct(24,new $t(2,97)),new Ct(22,new $t(2,38),new $t(2,39)),new Ct(22,new $t(4,18),new $t(2,19)),new Ct(26,new $t(4,14),new $t(2,15))),new Et(9,Int32Array.from([6,26,46]),new Ct(30,new $t(2,116)),new Ct(22,new $t(3,36),new $t(2,37)),new Ct(20,new $t(4,16),new $t(4,17)),new Ct(24,new $t(4,12),new $t(4,13))),new Et(10,Int32Array.from([6,28,50]),new Ct(18,new $t(2,68),new $t(2,69)),new Ct(26,new $t(4,43),new $t(1,44)),new Ct(24,new $t(6,19),new $t(2,20)),new Ct(28,new $t(6,15),new $t(2,16))),new Et(11,Int32Array.from([6,30,54]),new Ct(20,new $t(4,81)),new Ct(30,new $t(1,50),new $t(4,51)),new Ct(28,new $t(4,22),new $t(4,23)),new Ct(24,new $t(3,12),new $t(8,13))),new Et(12,Int32Array.from([6,32,58]),new Ct(24,new $t(2,92),new $t(2,93)),new Ct(22,new $t(6,36),new $t(2,37)),new Ct(26,new $t(4,20),new $t(6,21)),new Ct(28,new $t(7,14),new $t(4,15))),new Et(13,Int32Array.from([6,34,62]),new Ct(26,new $t(4,107)),new Ct(22,new $t(8,37),new $t(1,38)),new Ct(24,new $t(8,20),new $t(4,21)),new Ct(22,new $t(12,11),new $t(4,12))),new Et(14,Int32Array.from([6,26,46,66]),new Ct(30,new $t(3,115),new $t(1,116)),new Ct(24,new $t(4,40),new $t(5,41)),new Ct(20,new $t(11,16),new $t(5,17)),new Ct(24,new $t(11,12),new $t(5,13))),new Et(15,Int32Array.from([6,26,48,70]),new Ct(22,new $t(5,87),new $t(1,88)),new Ct(24,new $t(5,41),new $t(5,42)),new Ct(30,new $t(5,24),new $t(7,25)),new Ct(24,new $t(11,12),new $t(7,13))),new Et(16,Int32Array.from([6,26,50,74]),new Ct(24,new $t(5,98),new $t(1,99)),new Ct(28,new $t(7,45),new $t(3,46)),new Ct(24,new $t(15,19),new $t(2,20)),new Ct(30,new $t(3,15),new $t(13,16))),new Et(17,Int32Array.from([6,30,54,78]),new Ct(28,new $t(1,107),new $t(5,108)),new Ct(28,new $t(10,46),new $t(1,47)),new Ct(28,new $t(1,22),new $t(15,23)),new Ct(28,new $t(2,14),new $t(17,15))),new Et(18,Int32Array.from([6,30,56,82]),new Ct(30,new $t(5,120),new $t(1,121)),new Ct(26,new $t(9,43),new $t(4,44)),new Ct(28,new $t(17,22),new $t(1,23)),new Ct(28,new $t(2,14),new $t(19,15))),new Et(19,Int32Array.from([6,30,58,86]),new Ct(28,new $t(3,113),new $t(4,114)),new Ct(26,new $t(3,44),new $t(11,45)),new Ct(26,new $t(17,21),new $t(4,22)),new Ct(26,new $t(9,13),new $t(16,14))),new Et(20,Int32Array.from([6,34,62,90]),new Ct(28,new $t(3,107),new $t(5,108)),new Ct(26,new $t(3,41),new $t(13,42)),new Ct(30,new $t(15,24),new $t(5,25)),new Ct(28,new $t(15,15),new $t(10,16))),new Et(21,Int32Array.from([6,28,50,72,94]),new Ct(28,new $t(4,116),new $t(4,117)),new Ct(26,new $t(17,42)),new Ct(28,new $t(17,22),new $t(6,23)),new Ct(30,new $t(19,16),new $t(6,17))),new Et(22,Int32Array.from([6,26,50,74,98]),new Ct(28,new $t(2,111),new $t(7,112)),new Ct(28,new $t(17,46)),new Ct(30,new $t(7,24),new $t(16,25)),new Ct(24,new $t(34,13))),new Et(23,Int32Array.from([6,30,54,78,102]),new Ct(30,new $t(4,121),new $t(5,122)),new Ct(28,new $t(4,47),new $t(14,48)),new Ct(30,new $t(11,24),new $t(14,25)),new Ct(30,new $t(16,15),new $t(14,16))),new Et(24,Int32Array.from([6,28,54,80,106]),new Ct(30,new $t(6,117),new $t(4,118)),new Ct(28,new $t(6,45),new $t(14,46)),new Ct(30,new $t(11,24),new $t(16,25)),new Ct(30,new $t(30,16),new $t(2,17))),new Et(25,Int32Array.from([6,32,58,84,110]),new Ct(26,new $t(8,106),new $t(4,107)),new Ct(28,new $t(8,47),new $t(13,48)),new Ct(30,new $t(7,24),new $t(22,25)),new Ct(30,new $t(22,15),new $t(13,16))),new Et(26,Int32Array.from([6,30,58,86,114]),new Ct(28,new $t(10,114),new $t(2,115)),new Ct(28,new $t(19,46),new $t(4,47)),new Ct(28,new $t(28,22),new $t(6,23)),new Ct(30,new $t(33,16),new $t(4,17))),new Et(27,Int32Array.from([6,34,62,90,118]),new Ct(30,new $t(8,122),new $t(4,123)),new Ct(28,new $t(22,45),new $t(3,46)),new Ct(30,new $t(8,23),new $t(26,24)),new Ct(30,new $t(12,15),new $t(28,16))),new Et(28,Int32Array.from([6,26,50,74,98,122]),new Ct(30,new $t(3,117),new $t(10,118)),new Ct(28,new $t(3,45),new $t(23,46)),new Ct(30,new $t(4,24),new $t(31,25)),new Ct(30,new $t(11,15),new $t(31,16))),new Et(29,Int32Array.from([6,30,54,78,102,126]),new Ct(30,new $t(7,116),new $t(7,117)),new Ct(28,new $t(21,45),new $t(7,46)),new Ct(30,new $t(1,23),new $t(37,24)),new Ct(30,new $t(19,15),new $t(26,16))),new Et(30,Int32Array.from([6,26,52,78,104,130]),new Ct(30,new $t(5,115),new $t(10,116)),new Ct(28,new $t(19,47),new $t(10,48)),new Ct(30,new $t(15,24),new $t(25,25)),new Ct(30,new $t(23,15),new $t(25,16))),new Et(31,Int32Array.from([6,30,56,82,108,134]),new Ct(30,new $t(13,115),new $t(3,116)),new Ct(28,new $t(2,46),new $t(29,47)),new Ct(30,new $t(42,24),new $t(1,25)),new Ct(30,new $t(23,15),new $t(28,16))),new Et(32,Int32Array.from([6,34,60,86,112,138]),new Ct(30,new $t(17,115)),new Ct(28,new $t(10,46),new $t(23,47)),new Ct(30,new $t(10,24),new $t(35,25)),new Ct(30,new $t(19,15),new $t(35,16))),new Et(33,Int32Array.from([6,30,58,86,114,142]),new Ct(30,new $t(17,115),new $t(1,116)),new Ct(28,new $t(14,46),new $t(21,47)),new Ct(30,new $t(29,24),new $t(19,25)),new Ct(30,new $t(11,15),new $t(46,16))),new Et(34,Int32Array.from([6,34,62,90,118,146]),new Ct(30,new $t(13,115),new $t(6,116)),new Ct(28,new $t(14,46),new $t(23,47)),new Ct(30,new $t(44,24),new $t(7,25)),new Ct(30,new $t(59,16),new $t(1,17))),new Et(35,Int32Array.from([6,30,54,78,102,126,150]),new Ct(30,new $t(12,121),new $t(7,122)),new Ct(28,new $t(12,47),new $t(26,48)),new Ct(30,new $t(39,24),new $t(14,25)),new Ct(30,new $t(22,15),new $t(41,16))),new Et(36,Int32Array.from([6,24,50,76,102,128,154]),new Ct(30,new $t(6,121),new $t(14,122)),new Ct(28,new $t(6,47),new $t(34,48)),new Ct(30,new $t(46,24),new $t(10,25)),new Ct(30,new $t(2,15),new $t(64,16))),new Et(37,Int32Array.from([6,28,54,80,106,132,158]),new Ct(30,new $t(17,122),new $t(4,123)),new Ct(28,new $t(29,46),new $t(14,47)),new Ct(30,new $t(49,24),new $t(10,25)),new Ct(30,new $t(24,15),new $t(46,16))),new Et(38,Int32Array.from([6,32,58,84,110,136,162]),new Ct(30,new $t(4,122),new $t(18,123)),new Ct(28,new $t(13,46),new $t(32,47)),new Ct(30,new $t(48,24),new $t(14,25)),new Ct(30,new $t(42,15),new $t(32,16))),new Et(39,Int32Array.from([6,26,54,82,110,138,166]),new Ct(30,new $t(20,117),new $t(4,118)),new Ct(28,new $t(40,47),new $t(7,48)),new Ct(30,new $t(43,24),new $t(22,25)),new Ct(30,new $t(10,15),new $t(67,16))),new Et(40,Int32Array.from([6,30,58,86,114,142,170]),new Ct(30,new $t(19,118),new $t(6,119)),new Ct(28,new $t(18,47),new $t(31,48)),new Ct(30,new $t(34,24),new $t(34,25)),new Ct(30,new $t(20,15),new $t(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"}(q||(q={}));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([[q.DATA_MASK_000,new At(q.DATA_MASK_000,((e,t)=>!(e+t&1)))],[q.DATA_MASK_001,new At(q.DATA_MASK_001,((e,t)=>!(1&e)))],[q.DATA_MASK_010,new At(q.DATA_MASK_010,((e,t)=>t%3==0))],[q.DATA_MASK_011,new At(q.DATA_MASK_011,((e,t)=>(e+t)%3==0))],[q.DATA_MASK_100,new At(q.DATA_MASK_100,((e,t)=>!(Math.floor(e/2)+Math.floor(t/3)&1)))],[q.DATA_MASK_101,new At(q.DATA_MASK_101,((e,t)=>e*t%6==0))],[q.DATA_MASK_110,new At(q.DATA_MASK_110,((e,t)=>e*t%6<3))],[q.DATA_MASK_111,new At(q.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 C;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 C}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 C}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 C;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 h=0;for(let t=0;t<u;t++)for(let n=0;n<a;n++)s[n].codewords[t]=e[h++];for(let t=c;t<a;t++)s[t].codewords[u]=e[h++];const f=s[0].codewords.length;for(let t=u;t<f;t++)for(let n=0;n<a;n++){const r=n<c?t:t+1;s[n].codewords[r]=e[h++]}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"}(j||(j={}));class Tt{constructor(e,t,n,r){this.value=e,this.stringValue=t,this.characterCountBitsForVersions=n,this.bits=r,Tt.FOR_BITS.set(r,this),Tt.FOR_VALUE.set(e,this)}static forBits(e){const t=Tt.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 Tt))return!1;const t=e;return this.value===t.value}toString(){return this.stringValue}}Tt.FOR_BITS=new Map,Tt.FOR_VALUE=new Map,Tt.TERMINATOR=new Tt(j.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),Tt.NUMERIC=new Tt(j.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),Tt.ALPHANUMERIC=new Tt(j.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),Tt.STRUCTURED_APPEND=new Tt(j.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),Tt.BYTE=new Tt(j.BYTE,"BYTE",Int32Array.from([8,16,16]),4),Tt.ECI=new Tt(j.ECI,"ECI",Int32Array.from([0,0,0]),7),Tt.KANJI=new Tt(j.KANJI,"KANJI",Int32Array.from([8,10,12]),8),Tt.FNC1_FIRST_POSITION=new Tt(j.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),Tt.FNC1_SECOND_POSITION=new Tt(j.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),Tt.HANZI=new Tt(j.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class Nt{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=Tt.TERMINATOR;else{const t=i.readBits(4);e=Tt.forBits(t)}switch(e){case Tt.TERMINATOR:break;case Tt.FNC1_FIRST_POSITION:case Tt.FNC1_SECOND_POSITION:c=!0;break;case Tt.STRUCTURED_APPEND:if(i.available()<16)throw new C;a=i.readBits(8),l=i.readBits(8);break;case Tt.ECI:const d=Nt.parseECIValue(i);if(n=$.getCharacterSetECIByValue(d),null===n)throw new C;break;case Tt.HANZI:const u=i.readBits(4),h=i.readBits(e.getCharacterCountBits(t));u===Nt.GB2312_SUBSET&&Nt.decodeHanziSegment(i,o,h);break;default:const f=i.readBits(e.getCharacterCountBits(t));switch(e){case Tt.NUMERIC:Nt.decodeNumericSegment(i,o,f);break;case Tt.ALPHANUMERIC:Nt.decodeAlphanumericSegment(i,o,f,c);break;case Tt.BYTE:Nt.decodeByteSegment(i,o,f,n,s,r);break;case Tt.KANJI:Nt.decodeKanjiSegment(i,o,f);break;default:throw new C}}}while(e!==Tt.TERMINATOR)}catch(e){throw new C}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 C;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 C(e)}}static decodeKanjiSegment(e,t,n){if(13*n>e.available())throw new C;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 C(e)}}static decodeByteSegment(e,t,n,r,i,o){if(8*n>e.available())throw new C;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 C(e)}i.push(s)}static toAlphaNumericChar(e){if(e>=Nt.ALPHANUMERIC_CHARS.length)throw new C;return Nt.ALPHANUMERIC_CHARS[e]}static decodeAlphanumericSegment(e,t,n,r){const i=t.length();for(;n>1;){if(e.available()<11)throw new C;const r=e.readBits(11);t.append(Nt.toAlphaNumericChar(Math.floor(r/45))),t.append(Nt.toAlphaNumericChar(r%45)),n-=2}if(1===n){if(e.available()<6)throw new C;t.append(Nt.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 C;const r=e.readBits(10);if(r>=1e3)throw new C;t.append(Nt.toAlphaNumericChar(Math.floor(r/100))),t.append(Nt.toAlphaNumericChar(Math.floor(r/10)%10)),t.append(Nt.toAlphaNumericChar(r%10)),n-=3}if(2===n){if(e.available()<7)throw new C;const n=e.readBits(7);if(n>=100)throw new C;t.append(Nt.toAlphaNumericChar(Math.floor(n/10))),t.append(Nt.toAlphaNumericChar(n%10))}else if(1===n){if(e.available()<4)throw new C;const n=e.readBits(4);if(n>=10)throw new C;t.append(Nt.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 C}}Nt.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Nt.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(T.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 Nt.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 h}for(let r=0;r<t;r++)e[r]=n[r]}}class kt 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 kt(r,i,o)}}class Ot{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 N}static centerFromEnd(e,t){return t-e[2]-e[1]/2}foundPatternCross(e){const t=this.moduleSize,n=t/2;for(let r=0;r<3;r++)if(Math.abs(t-e[r])>=n)return!1;return!0}crossCheckVertical(e,t,n,r){const 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)?Ot.centerFromEnd(s,a):NaN}handlePossibleCenter(e,t,n){const r=e[0]+e[1]+e[2],i=Ot.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 kt(i,o,t);this.possibleCenters.push(n),null!==this.resultPointCallback&&void 0!==this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(n)}return null}}class xt 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 xt(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 Bt{constructor(e,t){this.image=e,this.resultPointCallback=t,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=t}getImage(){return this.image}getPossibleCenters(){return this.possibleCenters}find(e){const t=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*Bt.MAX_MODULES));(s<Bt.MIN_SKIP||t)&&(s=Bt.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(Bt.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]++;Bt.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&&Bt.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:Bt.foundPatternCross(s)?Bt.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:Bt.foundPatternCross(s)?Bt.centerFromEnd(s,a):NaN}handlePossibleCenter(e,t,n,r){const i=e[0]+e[1]+e[2]+e[3]+e[4];let o=Bt.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 xt(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()>=Bt.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()>=Bt.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 N;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]]}}Bt.CENTER_QUORUM=2,Bt.MIN_SKIP=3,Bt.MAX_MODULES=57;class Pt{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 Bt(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 N("No pattern found in proccess finder.");const o=Pt.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 N))throw e}}const c=Pt.createTransform(t,n,r,l,o),d=Pt.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 fe.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 N("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,h=t;n!==u;n+=l){const l=i?h:n,u=i?n:h;if(1===d===this.image.get(l,u)){if(2===d)return ie.distance(n,h,e,t);d++}if(a+=s,a>0){if(h===r)break;h+=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 N("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 N("Alignment bottom exceeds estimated module size.");return new Ot(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 Pt(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 N;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 N;if(o-i!=a-s&&(a=s+(o-i),a>=e.getWidth()))throw new N;const l=Math.round((a-s+1)/r),c=Math.round((o-i+1)/r);if(l<=0||c<=0)throw new N;if(c!==l)throw new N;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 N;s-=u}const h=i+Math.floor((c-1)*r)-o;if(h>0){if(h>d)throw new N;i-=h}const f=new T(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)&&f.set(i,t)}return f}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 N;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 Ht{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 Ht(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 Ht?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 Ht(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 Ht(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 Ht(this.field,t)}multiplyScalar(e){if(0===e)return new Ht(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 Ht(this.field,n)}multiplyByMonomial(e,t){if(e<0)throw new d;if(0===t)return new Ht(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 Ht(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 Wt{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 zt extends Wt{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 Ht(this,new Int32Array([0])),this.one=new Ht(this,new Int32Array([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new d;if(0===t)return this.zero;let n=new Int32Array(e+1);return n[0]=t,new Ht(this,n)}}zt.PDF417_GF=new zt(Ft.NUMBER_OF_CODEWORDS,3);class qt{constructor(){this.field=zt.PDF417_GF}decode(e,t,n){let r=new Ht(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 Ht(this.field,new Int32Array([this.field.subtract(0,n),1]));s=s.multiply(r)}let a=new Ht(this.field,i),l=this.runEuclideanAlgorithm(this.field.buildMonomial(t,1),a,t),c=l[0],d=l[1],u=this.findErrorLocations(c),f=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 h.getChecksumInstance();e[n]=this.field.subtract(e[n],f[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 h.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 h.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 h.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 Ht(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 jt{constructor(e,t,n,r,i){e instanceof jt?this.constructor_2(e):this.constructor_1(e,t,n,r,i)}constructor_1(e,t,n,r,i){const o=null==t||null==n,s=null==r||null==i;if(o&&s)throw new N;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 jt(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 jt(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 jt(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!==Jl)return Jl.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 hn{static decode(e,t){let n=new S(""),r=$.ISO8859_1;n.enableDecoding(r);let i=1,o=e[i++],s=new tn;for(;i<e[0];){switch(o){case hn.TEXT_COMPACTION_MODE_LATCH:i=hn.textCompaction(e,i,n);break;case hn.BYTE_COMPACTION_MODE_LATCH:case hn.BYTE_COMPACTION_MODE_LATCH_6:i=hn.byteCompaction(o,e,r,i,n);break;case hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(e[i++]);break;case hn.NUMERIC_COMPACTION_MODE_LATCH:i=hn.numericCompaction(e,i,n);break;case hn.ECI_CHARSET:$.getCharacterSetECIByValue(e[i++]);break;case hn.ECI_GENERAL_PURPOSE:i+=2;break;case hn.ECI_USER_DEFINED:i++;break;case hn.BEGIN_MACRO_PDF417_CONTROL_BLOCK:i=hn.decodeMacroBlock(e,i,s);break;case hn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case hn.MACRO_PDF417_TERMINATOR:throw new C;default:i--,i=hn.textCompaction(e,i,n)}if(!(i<e.length))throw C.getFormatInstance();o=e[i++]}if(0===n.length())throw C.getFormatInstance();let a=new Y(null,n.toString(),null,t);return a.setOther(s),a}static decodeMacroBlock(e,t,n){if(t+hn.NUMBER_OF_SEQUENCE_CODEWORDS>e[0])throw C.getFormatInstance();let r=new Int32Array(hn.NUMBER_OF_SEQUENCE_CODEWORDS);for(let n=0;n<hn.NUMBER_OF_SEQUENCE_CODEWORDS;n++,t++)r[n]=e[t];n.setSegmentIndex(y.parseInt(hn.decodeBase900toBase10(r,hn.NUMBER_OF_SEQUENCE_CODEWORDS)));let i=new S;t=hn.textCompaction(e,t,i),n.setFileId(i.toString());let o=-1;for(e[t]===hn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(o=t+1);t<e[0];)switch(e[t]){case hn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(e[++t]){case hn.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let r=new S;t=hn.textCompaction(e,t+1,r),n.setFileName(r.toString());break;case hn.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let i=new S;t=hn.textCompaction(e,t+1,i),n.setSender(i.toString());break;case hn.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let o=new S;t=hn.textCompaction(e,t+1,o),n.setAddressee(o.toString());break;case hn.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let s=new S;t=hn.numericCompaction(e,t+1,s),n.setSegmentCount(y.parseInt(s.toString()));break;case hn.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let a=new S;t=hn.numericCompaction(e,t+1,a),n.setTimestamp(nn.parseLong(a.toString()));break;case hn.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let l=new S;t=hn.numericCompaction(e,t+1,l),n.setChecksum(y.parseInt(l.toString()));break;case hn.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let c=new S;t=hn.numericCompaction(e,t+1,c),n.setFileSize(nn.parseLong(c.toString()));break;default:throw C.getFormatInstance()}break;case hn.MACRO_PDF417_TERMINATOR:t++,n.setLastSegment(!0);break;default:throw C.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<hn.TEXT_COMPACTION_MODE_LATCH)r[o]=n/30,r[o+1]=n%30,o+=2;else switch(n){case hn.TEXT_COMPACTION_MODE_LATCH:r[o++]=hn.TEXT_COMPACTION_MODE_LATCH;break;case hn.BYTE_COMPACTION_MODE_LATCH:case hn.BYTE_COMPACTION_MODE_LATCH_6:case hn.NUMERIC_COMPACTION_MODE_LATCH:case hn.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case hn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case hn.MACRO_PDF417_TERMINATOR:t--,s=!0;break;case hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r[o]=hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,n=e[t++],i[o]=n,o++}}return hn.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 hn.LL:i=G.LOWER;break;case hn.ML:i=G.MIXED;break;case hn.PS:o=i,i=G.PUNCT_SHIFT;break;case hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[s]);break;case hn.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 hn.AS:o=i,i=G.ALPHA_SHIFT;break;case hn.ML:i=G.MIXED;break;case hn.PS:o=i,i=G.PUNCT_SHIFT;break;case hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[s]);break;case hn.TEXT_COMPACTION_MODE_LATCH:i=G.ALPHA}break;case G.MIXED:if(n<hn.PL)a=hn.MIXED_CHARS[n];else switch(n){case hn.PL:i=G.PUNCT;break;case 26:a=" ";break;case hn.LL:i=G.LOWER;break;case hn.AL:i=G.ALPHA;break;case hn.PS:o=i,i=G.PUNCT_SHIFT;break;case hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[s]);break;case hn.TEXT_COMPACTION_MODE_LATCH:i=G.ALPHA}break;case G.PUNCT:if(n<hn.PAL)a=hn.PUNCT_CHARS[n];else switch(n){case hn.PAL:i=G.ALPHA;break;case hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[s]);break;case hn.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 hn.TEXT_COMPACTION_MODE_LATCH:i=G.ALPHA}break;case G.PUNCT_SHIFT:if(i=o,n<hn.PAL)a=hn.PUNCT_CHARS[n];else switch(n){case hn.PAL:i=G.ALPHA;break;case hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[s]);break;case hn.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 hn.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 hn.TEXT_COMPACTION_MODE_LATCH:case hn.BYTE_COMPACTION_MODE_LATCH:case hn.NUMERIC_COMPACTION_MODE_LATCH:case hn.BYTE_COMPACTION_MODE_LATCH_6:case hn.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case hn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case hn.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<hn.TEXT_COMPACTION_MODE_LATCH&&(e[s++]=n);for(let t=0;t<s;t++)o.write(e[t]);break;case hn.BYTE_COMPACTION_MODE_LATCH_6:for(;r<t[0]&&!l;){let e=t[r++];if(e<hn.TEXT_COMPACTION_MODE_LATCH)s++,a=900*a+e;else switch(e){case hn.TEXT_COMPACTION_MODE_LATCH:case hn.BYTE_COMPACTION_MODE_LATCH:case hn.NUMERIC_COMPACTION_MODE_LATCH:case hn.BYTE_COMPACTION_MODE_LATCH_6:case hn.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case hn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case hn.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(hn.MAX_NUMERIC_CODEWORDS);for(;t<e[0]&&!i;){let s=e[t++];if(t===e[0]&&(i=!0),s<hn.TEXT_COMPACTION_MODE_LATCH)o[r]=s,r++;else switch(s){case hn.TEXT_COMPACTION_MODE_LATCH:case hn.BYTE_COMPACTION_MODE_LATCH:case hn.BYTE_COMPACTION_MODE_LATCH_6:case hn.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case hn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case hn.MACRO_PDF417_TERMINATOR:t--,i=!0}(r%hn.MAX_NUMERIC_CODEWORDS==0||s===hn.NUMERIC_COMPACTION_MODE_LATCH||i)&&r>0&&(n.append(hn.decodeBase900toBase10(o,r)),r=0)}return t}static decodeBase900toBase10(e,t){let n=dn(0);for(let r=0;r<t;r++)n+=hn.EXP900[t-r-1]*dn(e[r]);let r=n.toString();if("1"!==r.charAt(0))throw new C;return r.substring(1)}}hn.TEXT_COMPACTION_MODE_LATCH=900,hn.BYTE_COMPACTION_MODE_LATCH=901,hn.NUMERIC_COMPACTION_MODE_LATCH=902,hn.BYTE_COMPACTION_MODE_LATCH_6=924,hn.ECI_USER_DEFINED=925,hn.ECI_GENERAL_PURPOSE=926,hn.ECI_CHARSET=927,hn.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,hn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,hn.MACRO_PDF417_TERMINATOR=922,hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,hn.MAX_NUMERIC_CODEWORDS=15,hn.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,hn.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,hn.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,hn.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,hn.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,hn.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,hn.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,hn.PL=25,hn.LL=27,hn.AS=27,hn.ML=28,hn.AL=28,hn.PS=29,hn.PAL=29,hn.PUNCT_CHARS=";<>@[\\]_`~!\r\t,:\n-.$/\"|*()?{}'",hn.MIXED_CHARS="0123456789&\r\t,:#-.$/+%*=^",hn.EXP900=ln()?un():[],hn.NUMBER_OF_SEQUENCE_CODEWORDS=2;class fn{constructor(){}static decode(e,t,n,r,i,o,s){let a,l=new jt(e,t,n,r,i),c=null,d=null;for(let n=!0;;n=!1){if(null!=t&&(c=fn.getRowIndicatorColumn(e,l,t,!0,o,s)),null!=r&&(d=fn.getRowIndicatorColumn(e,l,r,!1,o,s)),a=fn.merge(c,d),null==a)throw N.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 h=null!=c;for(let t=1;t<=u;t++){let n,r=h?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=fn.getStartColumn(a,r,t,h),i<0||i>l.getMaxX()){if(-1===c)continue;i=c}let d=fn.detectCodeword(e,l.getMinX(),l.getMaxX(),h,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 fn.createDecoderResult(a)}static merge(e,t){if(null==e&&null==t)return null;let n=fn.getBarcodeMetadata(e,t);if(null==n)return null;let r=jt.merge(fn.adjustBoundingBox(e),fn.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=fn.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=fn.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()-fn.getNumberOfECCodeWords(e.getBarcodeECLevel());if(0===r.length){if(i<1||i>Ft.MAX_CODEWORDS_IN_BARCODE)throw N.getNotFoundInstance();n.setValue(i)}else r[0]!==i&&n.setValue(i)}static createDecoderResult(e){let t=fn.createBarcodeMatrix(e);fn.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 fn.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 fn.decodeCodewords(t,e,n)}catch(e){if(!(e instanceof h))throw e}if(0===o.length)throw h.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 h.getChecksumInstance()}}throw h.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(fn.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(fn.isValidBarcodeColumn(e,t-i)&&(o=e.getDetectionResultColumn(t-i).getCodewordNearby(n)),null!=o)return r?o.getEndX():o.getStartX();let s=0;for(;fn.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=fn.adjustCodewordStartColumn(e,t,n,r,i,o);let l,c=fn.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(!fn.checkCodewordSkew(d,s,a))return null;let u=en.getDecodedValue(c),h=Ft.getCodeword(u);return-1===h?null:new Jt(i,l,fn.getCodewordBucketNumber(u),h)}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)>fn.CODEWORD_SKEW_SIZE)return i;s+=a}a=-a,r=!r}return s}static checkCodewordSkew(e,t,n){return t-fn.CODEWORD_SKEW_SIZE<=e&&e<=n+fn.CODEWORD_SKEW_SIZE}static decodeCodewords(e,t,n){if(0===e.length)throw C.getFormatInstance();let r=1<<t+1,i=fn.correctErrors(e,n,r);fn.verifyCodewordCount(e,r);let o=hn.decode(e,""+t);return o.setErrorsCorrected(i),o.setErasures(n.length),o}static correctErrors(e,t,n){if(null!=t&&t.length>n/2+fn.MAX_ERRORS||n<0||n>fn.MAX_EC_CODEWORDS)throw h.getChecksumInstance();return fn.errorCorrection.decode(e,n,t)}static verifyCodewordCount(e,t){if(e.length<4)throw C.getFormatInstance();let n=e[0];if(n>e.length)throw C.getFormatInstance();if(0===n){if(!(t<e.length))throw C.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 fn.getCodewordBucketNumber(fn.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()}}fn.CODEWORD_SKEW_SIZE=2,fn.MAX_ERRORS=3,fn.MAX_EC_CODEWORDS=512,fn.errorCorrection=new qt;class mn{decode(e,t=null){let n=mn.decode(e,t,!1);if(null==n||0===n.length||null==n[0])throw N.getNotFoundInstance();return n[0]}decodeMultiple(e,t=null){try{return mn.decode(e,t,!0)}catch(e){if(e instanceof C||e instanceof h)throw N.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=fn.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 N("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 Cn{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 $n{constructor(){}static applyMaskPenaltyRule1(e){return $n.applyMaskPenaltyRule1Internal(e,!0)+$n.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 $n.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]&&($n.isWhiteHorizontal(s,o-4,o)||$n.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]&&($n.isWhiteVertical(n,o,e-4,e)||$n.isWhiteVertical(n,o,e+7,e+11))&&t++}return t*$n.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)*$n.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+=$n.N1+(r-5)),r=1,s=i)}r>=5&&(n+=$n.N1+(r-5))}return n}}$n.N1=3,$n.N2=3,$n.N3=40,$n.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&&$n.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 Tn{constructor(e,t){this.dataBytes=e,this.errorCorrectionBytes=t}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class Nn{constructor(){}static calculateMaskPenalty(e){return $n.applyMaskPenaltyRule1(e)+$n.applyMaskPenaltyRule2(e)+$n.applyMaskPenaltyRule3(e)+$n.applyMaskPenaltyRule4(e)}static encode(e,t,n=null){let r=Nn.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===Tt.BYTE&&(i||Nn.DEFAULT_BYTE_MODE_ENCODING!==r)){const e=$.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===Tt.BYTE?a.getSizeInBytes():e.length;this.appendLengthInfo(d,l,o,c),c.appendBitArray(a);const u=l.getECBlocksForLevel(t),h=l.getTotalCodewords()-u.getTotalECCodewords();this.terminateBits(h,c);const f=this.interleaveWithECBytes(c,l.getTotalCodewords(),h,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(f,t,l,g);return m.setMaskPattern(w),Sn.buildMatrix(f,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<Nn.ALPHANUMERIC_TABLE.length?Nn.ALPHANUMERIC_TABLE[e]:-1}static chooseMode(e,t=null){if($.SJIS.getName()===t&&this.isOnlyDoubleByteKanji(e))return Tt.KANJI;let n=!1,r=!1;for(let t=0,i=e.length;t<i;++t){const i=e.charAt(t);if(Nn.isDigit(i))n=!0;else{if(-1===this.getAlphanumericCode(i.charCodeAt(0)))return Tt.BYTE;r=!0}}return r?Tt.ALPHANUMERIC:n?Tt.NUMERIC:Tt.BYTE}static isOnlyDoubleByteKanji(e){let t;try{t=A.encode(e,$.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(Nn.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,h=l-d,f=c-u;if(h!==f)throw new bn("EC bytes mismatch");if(n!==a+s)throw new bn("RS blocks mismatch");if(e!==(d+h)*a+(u+f)*s)throw new bn("Total bytes mismatch");r<a?(i[0]=d,o[0]=h):(i[0]=u,o[0]=f)}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);Nn.getNumDataBytesAndNumECBytesForBlockID(t,n,r,l,c,d);const u=c[0],h=new Uint8Array(u);e.toBytes(8*i,h,0,u);const f=Nn.generateECBytes(h,d[0]);a.push(new Tn(h,f)),o=Math.max(o,u),s=Math.max(s,f.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 Cn(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 Tt.NUMERIC:Nn.appendNumericBytes(e,n);break;case Tt.ALPHANUMERIC:Nn.appendAlphanumericBytes(e,n);break;case Tt.BYTE:Nn.append8BitBytes(e,n,r);break;case Tt.KANJI:Nn.appendKanjiBytes(e,n);break;default:throw new bn("Invalid mode: "+t)}}static getDigit(e){return e.charCodeAt(0)-48}static isDigit(e){const t=Nn.getDigit(e);return t>=0&&t<=9}static appendNumericBytes(e,t){const n=e.length;let r=0;for(;r<n;){const i=Nn.getDigit(e.charAt(r));if(r+2<n){const n=Nn.getDigit(e.charAt(r+1)),o=Nn.getDigit(e.charAt(r+2));t.appendBits(100*i+10*n+o,10),r+=3}else if(r+1<n){const n=Nn.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=Nn.getAlphanumericCode(e.charCodeAt(r));if(-1===i)throw new bn;if(r+1<n){const n=Nn.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,$.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(Tt.ECI.getBits(),4),t.appendBits(e.getValue(),8)}}Nn.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]),Nn.DEFAULT_BYTE_MODE_ENCODING=$.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=Nn.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)),h=Math.floor((c-o*u)/2),f=Math.floor((d-s*u)/2),m=this.createSVGElement(c,d);for(let e=0,t=f;e<s;e++,t+=u)for(let n=0,r=h;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=Nn.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)),h=Math.floor((c-o*u)/2),f=Math.floor((d-s*u)/2),m=new T(c,d);for(let e=0,t=f;e<s;e++,t+=u)for(let n=0,r=h;n<o;n++,r+=u)1===i.get(n,e)&&m.setRegion(r,t,u,u);return m}}Dn.QUIET_ZONE_SIZE=4;class kn{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 On extends k{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 On(this.yuvData,this.dataWidth,this.dataHeight,this.left+e,this.top+t,n,r,!1)}renderThumbnail(){const e=this.getWidth()/On.THUMBNAIL_SCALE_FACTOR,t=this.getHeight()/On.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*On.THUMBNAIL_SCALE_FACTOR];n[t+o]=4278190080|65793*e}i+=this.dataWidth*On.THUMBNAIL_SCALE_FACTOR}return n}getThumbnailWidth(){return this.getWidth()/On.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/On.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 O(this)}}On.THUMBNAIL_SCALE_FACTOR=2;class xn extends k{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 xn(this.luminances,n,r,this.dataWidth,this.dataHeight,this.left+e,this.top+t)}invert(){return new O(this)}}class Mn extends ${static forName(e){return this.getCharacterSetECIByName(e)}}class Bn{}Bn.ISO_8859_1=$.ISO8859_1;class Pn{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 Hn(e,t,n){return new Un(e,t,n)}function Wn(e,t,n){return new Vn(e,t,n)}const zn=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],qn=0,jn=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[qn][Yn]=0,e[jn][Yn]=0,e[jn][qn]=28,e[Xn][Yn]=0,e[Gn][Yn]=0,e[Gn][qn]=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=Wn(r,65535&t,t>>16),n+=t>>16}let i=e===Gn?4:5;return r=Wn(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=Wn(n,Jn[this.mode][e],r),n=Wn(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][qn];t=Wn(t,65535&e,e>>16),r+=e>>16,n=qn}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=Hn(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",zn[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[qn][t]=1;const i=b.getCharCode("Z"),o=b.getCharCode("A");for(let t=o;t<=i;t++)e[qn][t]=t-o+2;e[jn][t]=1;const s=b.getCharCode("z"),a=b.getCharCode("a");for(let t=a;t<=s;t++)e[jn][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,qn,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 h,f=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){h=g;for(let e=0;e<w.length;e++)w[e]=e}else{h=g+1+2*y.truncDivision(y.truncDivision(g,2)-1,15);let e=y.truncDivision(g,2),t=y.truncDivision(h,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 T(h);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++)f.get(t+i+o)&&v.set(w[2*e+o],w[2*e+r]),f.get(t+2*n+i+o)&&v.set(w[2*e+r],w[g-1-2*e-o]),f.get(t+4*n+i+o)&&v.set(w[g-1-2*e-o],w[g-1-2*e-r]),f.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,h,p),r)ir.drawBullsEye(v,y.truncDivision(h,2),5);else{ir.drawBullsEye(v,y.truncDivision(h,2),7);for(let e=0,t=0;e<y.truncDivision(g,2)-1;e+=15,t+=16)for(let e=1&y.truncDivision(h,2);e<h;e+=2)v.set(y.truncDivision(h,2)-t,e),v.set(y.truncDivision(h,2)+t,e),v.set(e,y.truncDivision(h,2)-t),v.set(e,y.truncDivision(h,2)+t)}let _=new Pn;return _.setCompact(r),_.setSize(h),_.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 Cn(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--):s&i?n.appendBits(s,t):(n.appendBits(1|s,t),o--)}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=Bn.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 T(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=ze,e.ArgumentException=c,e.ArithmeticException=Q,e.AztecCode=Pn,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=f,e.BinaryBitmap=u,e.BitArray=v,e.BitMatrix=T,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=$,e.ChecksumException=h,e.Code128Reader=ve,e.Code39Reader=_e,e.DataMatrixDecodedBitStreamParser=pt,e.DataMatrixReader=yt,e.DecodeHintType=I,e.DecoderResult=Y,e.DefaultGridSampler=he,e.DetectorResult=ae,e.EAN13Reader=Se,e.EncodeHintType=In,e.Exception=l,e.FormatException=C,e.GenericGF=J,e.GenericGFPoly=K,e.GlobalHistogramBinarizer=R,e.GridSampler=de,e.GridSamplerInstance=fe,e.HTMLCanvasElementLuminanceSource=x,e.HybridBinarizer=D,e.ITFReader=Ie,e.IllegalArgumentException=d,e.IllegalStateException=te,e.InvertedLuminanceSource=O,e.LuminanceSource=k,e.MathUtils=ie,e.MultiFormatOneDReader=at,e.MultiFormatReader=gn,e.MultiFormatWriter=kn,e.NotFoundException=N,e.OneDReader=ye,e.PDF417DecodedBitStreamParser=hn,e.PDF417DecoderErrorCorrection=qt,e.PDF417Reader=mn,e.PDF417ResultMetadata=tn,e.PerspectiveTransform=ue,e.PlanarYUVLuminanceSource=On,e.QRCodeByteMatrix=En,e.QRCodeDataMask=At,e.QRCodeDecodedBitStreamParser=Nt,e.QRCodeDecoderErrorCorrectionLevel=_t,e.QRCodeDecoderFormatInformation=It,e.QRCodeEncoder=Nn,e.QRCodeEncoderQRCode=An,e.QRCodeMaskUtil=$n,e.QRCodeMatrixUtil=Sn,e.QRCodeMode=Tt,e.QRCodeReader=Lt,e.QRCodeVersion=Et,e.QRCodeWriter=Dn,e.RGBLuminanceSource=xn,e.RSS14Reader=st,e.RSSExpandedReader=it,e.ReaderException=pn,e.ReedSolomonDecoder=ne,e.ReedSolomonEncoder=Cn,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=Bn,e.ZXingStringBuilder=S,e.ZXingStringEncoding=A,e.ZXingSystem=m,e.createAbstractExpandedDecoder=tt,Object.defineProperty(e,"__esModule",{value:!0})}(t)})),oc=f({__proto__:null,default:ec(ic)},[ic]),sc=function(){function e(e,t,n){if(this.formatMap=new Map([[Fl.QR_CODE,ic.BarcodeFormat.QR_CODE],[Fl.AZTEC,ic.BarcodeFormat.AZTEC],[Fl.CODABAR,ic.BarcodeFormat.CODABAR],[Fl.CODE_39,ic.BarcodeFormat.CODE_39],[Fl.CODE_93,ic.BarcodeFormat.CODE_93],[Fl.CODE_128,ic.BarcodeFormat.CODE_128],[Fl.DATA_MATRIX,ic.BarcodeFormat.DATA_MATRIX],[Fl.MAXICODE,ic.BarcodeFormat.MAXICODE],[Fl.ITF,ic.BarcodeFormat.ITF],[Fl.EAN_13,ic.BarcodeFormat.EAN_13],[Fl.EAN_8,ic.BarcodeFormat.EAN_8],[Fl.PDF_417,ic.BarcodeFormat.PDF_417],[Fl.RSS_14,ic.BarcodeFormat.RSS_14],[Fl.RSS_EXPANDED,ic.BarcodeFormat.RSS_EXPANDED],[Fl.UPC_A,ic.BarcodeFormat.UPC_A],[Fl.UPC_E,ic.BarcodeFormat.UPC_E],[Fl.UPC_EAN_EXTENSION,ic.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!oc)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(ic.DecodeHintType.POSSIBLE_FORMATS,r),i.set(ic.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 ic.MultiFormatReader(this.verbose,this.hints),n=new ic.HTMLCanvasElementLuminanceSource(e),r=new ic.BinaryBitmap(new ic.HybridBinarizer(n)),i=t.decode(r);return{text:i.text,format:jl.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}(),ac=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())}))},lc=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])}}},cc=function(){function e(t,n,r){if(this.formatMap=new Map([[Fl.QR_CODE,"qr_code"],[Fl.AZTEC,"aztec"],[Fl.CODABAR,"codabar"],[Fl.CODE_39,"code_39"],[Fl.CODE_93,"code_93"],[Fl.CODE_128,"code_128"],[Fl.DATA_MATRIX,"data_matrix"],[Fl.ITF,"itf"],[Fl.EAN_13,"ean_13"],[Fl.EAN_8,"ean_8"],[Fl.PDF_417,"pdf417"],[Fl.UPC_A,"upc_a"],[Fl.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 ac(this,void 0,void 0,(function(){var t,n;return lc(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:jl.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}(),dc=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())}))},uc=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])}}},hc=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&&cc.isSupported()?(this.primaryDecoder=new cc(e,n,r),this.secondaryDecoder=new sc(e,n,r)):this.primaryDecoder=new sc(e,n,r)}return e.prototype.decodeAsync=function(e){return dc(this,void 0,void 0,(function(){var t;return uc(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 dc(this,void 0,void 0,(function(){var t,n;return uc(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}(),fc=(nc=function(e,t){return nc=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])},nc(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}nc(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),mc=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())}))},pc=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])}}},gc=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}(),wc=function(e){function t(t){return e.call(this,"zoom",t)||this}return fc(t,e),t}(function(e){function t(t,n){return e.call(this,t,n)||this}return fc(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}(gc)),yc=function(e){function t(t){return e.call(this,"torch",t)||this}return fc(t,e),t}(gc),vc=function(){function e(e){this.track=e}return e.prototype.zoomFeature=function(){return new wc(this.track)},e.prototype.torchFeature=function(){return new yc(this.track)},e}(),_c=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 mc(this,void 0,void 0,(function(){var o,s;return pc(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 mc(this,void 0,void 0,(function(){return pc(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 vc(this.getFirstTrackOrFail())},e}(),Ic=function(){function e(e){this.mediaStream=e}return e.prototype.render=function(e,t,n){return mc(this,void 0,void 0,(function(){return pc(this,(function(r){return[2,_c.create(e,this.mediaStream,t,n)]}))}))},e.create=function(t){return mc(this,void 0,void 0,(function(){var n;return pc(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}(),Cc=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())}))},$c=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])}}},Ec=function(){function e(){}return e.failIfNotSupported=function(){return Cc(this,void 0,void 0,(function(){return $c(this,(function(t){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new e]}))}))},e.prototype.create=function(e){return Cc(this,void 0,void 0,(function(){return $c(this,(function(t){return[2,Ic.create(e)]}))}))},e}(),Ac=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())}))},bc=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])}}},Sc=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=Kl.unableToQuerySupportedDevices();return e.isHttpsOrLocalhost()||(t=Kl.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 Ac(this,void 0,void 0,(function(){var e,t,n,r,i,o,s;return bc(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"}(rc||(rc={}));var Tc,Nc=function(){function e(){this.state=rc.NOT_STARTED,this.onGoingTransactionNewState=rc.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===rc.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var e=this.onGoingTransactionNewState;this.onGoingTransactionNewState=rc.UNKNOWN,this.directTransition(e)},e.prototype.cancel=function(){if(this.onGoingTransactionNewState===rc.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=rc.UNKNOWN},e.prototype.getState=function(){return this.state},e.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==rc.UNKNOWN)throw"Cannot transition to a new state, already under transition"},e.prototype.validateTransition=function(e){switch(this.state){case rc.UNKNOWN:throw"Transition from unknown is not allowed";case rc.NOT_STARTED:this.failIfNewStateIs(e,[rc.PAUSED]);case rc.SCANNING:case rc.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}(),Rc=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()===rc.NOT_STARTED},e.prototype.isScanning=function(){return this.stateManager.getState()!==rc.NOT_STARTED},e.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===rc.SCANNING},e.prototype.isPaused=function(){return this.stateManager.getState()===rc.PAUSED},e}(),Dc=function(){function e(){}return e.create=function(){return new Rc(new Nc)},e}(),kc=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)}}(),Oc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return kc(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}(ql),xc=function(){function e(e,t){this.logger=t,this.fps=Oc.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=Oc.DEFAULT_DISABLE_FLIP}return e.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?Ql.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},e.prototype.isShadedBoxEnabled=function(){return!Zl(this.qrbox)},e.create=function(t,n){return new e(t,n)},e}(),Mc=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 Yl(this.verbose),this.qrcode=new hc(this.getSupportedFormats(t),this.getUseBarCodeDetectorIfSupported(n),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=Dc.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=xc.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:Oc.DEFAULT_WIDTH,c.style.position="relative",this.shouldScan=!0,this.element=c;var d=this,u=this.stateManagerProxy.startTransition(rc.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 h={onRenderSurfaceReady:function(e,t){d.setupUi(e,t,s),d.isScanning=!0,d.foreverScan(s,n,i)}};Ec.failIfNotSupported().then((function(e){e.create(a).then((function(e){return e.render(o.element,c,h).then((function(e){d.renderedCamera=e,u.execute(),t(null)})).catch((function(e){u.cancel(),r(e)}))})).catch((function(e){u.cancel(),r(Kl.errorGettingUserMedia(e))}))})).catch((function(e){u.cancel(),r(Kl.cameraStreamingNotSupported())}))}))},e.prototype.pause=function(e){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(rc.PAUSED),this.showPausedState(),(Zl(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(rc.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(rc.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(Oc.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(Zl(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:Oc.DEFAULT_WIDTH,c=Math.max(a.clientHeight?a.clientHeight:s,Oc.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 h=u.getContext("2d");if(!h)throw"Unable to get 2d context from canvas";h.canvas.width=l,h.canvas.height=c,h.drawImage(o,0,0,e,s,d.x,d.y,d.width,d.height)}var f=Oc.FILE_SCAN_HIDDEN_CANVAS_PADDING,m=Math.max(o.width,d.width),p=Math.max(o.height,d.height),g=m+2*f,w=p+2*f,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,f,f,m,p);try{n.qrcode.decodeRobustlyAsync(y).then((function(e){r(Gl.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 Sc.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(!Ql.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=[Fl.QR_CODE,Fl.AZTEC,Fl.CODABAR,Fl.CODE_39,Fl.CODE_93,Fl.CODE_128,Fl.DATA_MATRIX,Fl.MAXICODE,Fl.ITF,Fl.EAN_13,Fl.EAN_8,Fl.PDF_417,Fl.RSS_14,Fl.RSS_EXPANDED,Fl.UPC_A,Fl.UPC_E,Fl.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];Wl(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(Zl(e))return!0;if(!Zl(e.useBarCodeDetectorIfSupported))return!1!==e.useBarCodeDetectorIfSupported;if(Zl(e.experimentalFeatures))return!0;var t=e.experimentalFeatures;return!!Zl(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<Oc.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(Oc.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=Zl(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=Kl.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,Gl.createFromQrcodeResult(t)),n.possiblyUpdateShaders(!0),!0})).catch((function(e){n.possiblyUpdateShaders(!1);var r=Kl.codeParseError(e);return t(r,Xl.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?Oc.BORDER_SHADER_MATCH_COLOR:Oc.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=Zl(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(Oc.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=Oc.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 Bc(e,t,n){const r=e.slice();return r[19]=t[n].id,r[20]=t[n].label,r}function Pc(e){let t,n,r=e[1]&&Lc(e);return{c(){r&&r.c(),t=B(),n=O("reader"),U(n,"id","reader"),U(n,"class","svelte-9062r9")},m(e,i){r&&r.m(e,i),R(e,t,i),R(e,n,i)},p(e,n){e[1]?r?r.p(e,n):(r=Lc(e),r.c(),r.m(t.parentNode,t)):r&&(r.d(1),r=null)},d(e){r&&r.d(e),e&&D(t),e&&D(n)}}}function Lc(e){let t,n,r,i,o,s,a=e[1],l=[];for(let t=0;t<a.length;t+=1)l[t]=Fc(Bc(e,a,t));return{c(){t=O("div"),n=M("Quelle:\n "),r=O("select");for(let e=0;e<l.length;e+=1)l[e].c();r.disabled=i=1===e[1].length},m(i,a){R(i,t,a),N(t,n),N(t,r);for(let e=0;e<l.length;e+=1)l[e].m(r,null);o||(s=L(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=Bc(e,a,n);l[n]?l[n].p(i,t):(l[n]=Fc(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&&D(t),k(l,e),o=!1,s()}}}function Fc(e){let t,n,r,i,o=e[20]+"";return{c(){t=O("option"),n=M(o),t.__value=r=e[19],t.value=t.__value,t.selected=i=e[2]===e[19]},m(e,r){R(e,t,r),N(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&&D(t)}}}function Vc(e){let t,n=!e[0]&&Pc(e);return{c(){t=O("main"),n&&n.c(),U(t,"class","svelte-9062r9")},m(e,r){R(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=Pc(e),n.c(),n.m(t,null))},i:_,o:_,d(e){e&&D(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"}(Tc||(Tc={}));const Uc=()=>Mc.getCameras();function Hc(e,t,n){let r;const i=K(),{loggedIn:o}=u;b(e,o,(e=>n(9,r=e)));let s,a,l,{keyboard:c}=t,{codeTypes:d=""}=t,{readerInit:h=!1}=t,f=!1;const m=r.tenant+"-ENABLERR-CAMERA";Y((function(){if(c)return void(f=!0);try{s||(s=new Mc("reader"));const e=window.localStorage.getItem(m);Uc().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{}})),Z((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),f=!0}catch{}}async function w(e=!1){try{c||(await s.stop(),e&&await s.clear())}catch{}finally{f=!1}}function y(e,t){f&&(i("scan",{text:e}),f=!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,h=e.readerInit)},e.$$.update=()=>{32&e.$$.dirty&&h&&(f=!0,n(5,h=!1))},[c,a,l,o,async e=>{const t=e.target.value;await w(),window.localStorage.setItem(m,t),g(t)},h,d]}class Wc extends Te{constructor(e){var t;super(),document.getElementById("svelte-9062r9-style")||((t=O("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}",N(document.head,t)),Se(this,e,Hc,Vc,A,{keyboard:0,codeTypes:6,readerInit:5})}}const{document:zc}=Ie;function qc(e,t,n){const r=e.slice();return r[143]=t[n],r[145]=n,r}function jc(e,t,n){const r=e.slice();return r[147]=t[n],r[149]=n,r}function Gc(e,t,n){const r=e.slice();return r[156]=t[n],r}function Xc(e,t,n){const r=e.slice();return r[151]=t[n].title,r[152]=t[n].toDelete,r[153]=t[n].icon,r}function Yc(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Zc(e){let t,n,r,i,o,s,a,l,c,d,u,h=(!e[2]||e[15]?.length&&e[15].length>1)&&Kc(e),f=e[19]&&Qc(e),m=!1!==e[4].transfer&&e[49]?.length&&ed(e),p=!e[10]&&e[45]&&e[14]&&0!=e[14]&&nd(e),g=!e[10]&&e[43]&&e[17]&&0!=e[17]&&id(e),w=e[41]&&e[13]&&0!=e[13]&&sd(e);l=new e[36]({props:{class:e[6]+e[4].name,$$slots:{default:[vd,({closeOtherPanels:e})=>({146:e}),({closeOtherPanels:e})=>[0,0,0,0,e?4194304:0]]},$$scope:{ctx:e}}});let y=e[19]&&e[22]&&_d(e);return{c(){h&&h.c(),t=B(),n=O("div"),f&&f.c(),r=B(),m&&m.c(),i=B(),p&&p.c(),o=B(),g&&g.c(),s=B(),w&&w.c(),a=B(),Ee(l.$$.fragment),c=B(),y&&y.c(),d=P(),U(n,"class","formList")},m(e,v){h&&h.m(e,v),R(e,t,v),R(e,n,v),f&&f.m(n,null),N(n,r),m&&m.m(n,null),N(n,i),p&&p.m(n,null),N(n,o),g&&g.m(n,null),N(n,s),w&&w.m(n,null),N(n,a),Ae(l,n,null),R(e,c,v),y&&y.m(e,v),R(e,d,v),u=!0},p(e,c){!e[2]||e[15]?.length&&e[15].length>1?h?(h.p(e,c),32772&c[0]&&we(h,1)):(h=Kc(e),h.c(),we(h,1),h.m(t.parentNode,t)):h&&(pe(),ye(h,1,1,(()=>{h=null})),ge()),e[19]?f?(f.p(e,c),524288&c[0]&&we(f,1)):(f=Qc(e),f.c(),we(f,1),f.m(n,r)):f&&(pe(),ye(f,1,1,(()=>{f=null})),ge()),!1!==e[4].transfer&&e[49]?.length?m?(m.p(e,c),16&c[0]&&we(m,1)):(m=ed(e),m.c(),we(m,1),m.m(n,i)):m&&(pe(),ye(m,1,1,(()=>{m=null})),ge()),!e[10]&&e[45]&&e[14]&&0!=e[14]?p?(p.p(e,c),17408&c[0]&&we(p,1)):(p=nd(e),p.c(),we(p,1),p.m(n,o)):p&&(pe(),ye(p,1,1,(()=>{p=null})),ge()),!e[10]&&e[43]&&e[17]&&0!=e[17]?g?(g.p(e,c),132096&c[0]&&we(g,1)):(g=id(e),g.c(),we(g,1),g.m(n,s)):g&&(pe(),ye(g,1,1,(()=>{g=null})),ge()),e[41]&&e[13]&&0!=e[13]?w?(w.p(e,c),8192&c[0]&&we(w,1)):(w=sd(e),w.c(),we(w,1),w.m(n,a)):w&&(pe(),ye(w,1,1,(()=>{w=null})),ge());const u={};80&c[0]&&(u.class=e[6]+e[4].name),1612554239&c[0]|1&c[1]|4194304&c[4]|16&c[5]&&(u.$$scope={dirty:c,ctx:e}),l.$set(u),e[19]&&e[22]?y?(y.p(e,c),4718592&c[0]&&we(y,1)):(y=_d(e),y.c(),we(y,1),y.m(d.parentNode,d)):y&&(pe(),ye(y,1,1,(()=>{y=null})),ge())},i(e){u||(we(h),we(f),we(m),we(p),we(g),we(w),we(l.$$.fragment,e),we(y),u=!0)},o(e){ye(h),ye(f),ye(m),ye(p),ye(g),ye(w),ye(l.$$.fragment,e),ye(y),u=!1},d(e){h&&h.d(e),e&&D(t),e&&D(n),f&&f.d(),m&&m.d(),p&&p.d(),g&&g.d(),w&&w.d(),be(l),e&&D(c),y&&y.d(e),e&&D(d)}}}function Kc(e){let t,n;return t=new e[38]({props:{text:e[4].designation}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};16&n[0]&&(r.text=e[4].designation),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Qc(e){let t,n;return t=new e[35]({props:{disabled:e[1]||!e[0]._id&&e[21].input,filled:!0,style:"opacity: 0.75; margin-bottom: .5em;",$$slots:{default:[Jc]},$$scope:{ctx:e}}}),t.$on("click",e[70]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};2097155&n[0]&&(r.disabled=e[1]||!e[0]._id&&e[21].input),16&n[5]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Jc(e){let t,n,r;return n=new We({props:{size:"18"}}),{c(){t=O("span"),t.textContent="Barcode scannen",Ee(n.$$.fragment),z(t,"margin-right",".75em")},m(e,i){R(e,t,i),Ae(n,e,i),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n,e)}}}function ed(e){let t,n;return t=new e[35]({props:{filled:!0,style:"opacity: 0.75; margin-bottom: .5em;",$$slots:{default:[td]},$$scope:{ctx:e}}}),t.$on("click",e[77]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};16&n[0]|16&n[5]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function td(e){let t,n,r,i,o=e[69](e[4].transfer)+"";return r=new Pe({props:{size:"18"}}),{c(){t=O("span"),n=M(o),Ee(r.$$.fragment),z(t,"margin-right",".75em")},m(e,o){R(e,t,o),N(t,n),Ae(r,e,o),i=!0},p(e,t){(!i||16&t[0])&&o!==(o=e[69](e[4].transfer)+"")&&H(n,o)},i(e){i||(we(r.$$.fragment,e),i=!0)},o(e){ye(r.$$.fragment,e),i=!1},d(e){e&&D(t),be(r,e)}}}function nd(e){let t,n;return t=new e[34]({props:{name:"Total Wochen",nameClass:"formField_italic",$$slots:{default:[rd]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};16384&n[0]|16&n[5]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function rd(e){let t,n,r;function i(t){e[83](t)}let o={item:e[46],disabled:!0};return void 0!==e[14]&&(o.value=e[14]),t=new Ai({props:o}),ee.push((()=>$e(t,"value",i))),{c(){Ee(t.$$.fragment)},m(e,n){Ae(t,e,n),r=!0},p(e,r){const i={};!n&&16384&r[0]&&(n=!0,i.value=e[14],le((()=>n=!1))),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function id(e){let t,n;return t=new e[34]({props:{name:"Total Stunden",nameClass:"formField_italic",$$slots:{default:[od]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};131072&n[0]|16&n[5]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function od(e){let t,n,r;function i(t){e[84](t)}let o={item:e[44],disabled:!0};return void 0!==e[17]&&(o.value=e[17]),t=new Ai({props:o}),ee.push((()=>$e(t,"value",i))),{c(){Ee(t.$$.fragment)},m(e,n){Ae(t,e,n),r=!0},p(e,r){const i={};!n&&131072&r[0]&&(n=!0,i.value=e[17],le((()=>n=!1))),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function sd(e){let t,n;return t=new e[34]({props:{name:"Total Betrag",nameClass:"formField_italic",$$slots:{default:[ad]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};8448&n[0]|16&n[5]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ad(e){let t,n,r;function i(t){e[85](t)}let o={item:e[42],disabled:!0,currency:e[8]};return void 0!==e[13]&&(o.value=e[13]),t=new Ai({props:o}),ee.push((()=>$e(t,"value",i))),{c(){Ee(t.$$.fragment)},m(e,n){Ae(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],le((()=>n=!1))),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function ld(e){let t,n;return t=new e[37]({props:{class:e[29][e[149]],open:e[12]&&!e[2]&&0===e[149]&&!e[19],$$slots:{handle:[wd,({toggle:e,open:t})=>({150:e,12:t}),({toggle:e,open:t})=>[t?4096:0,0,0,0,e?67108864:0]],default:[hd,({toggle:e,open:t})=>({150:e,12:t}),({toggle:e,open:t})=>[t?4096:0,0,0,0,e?67108864:0]]},$$scope:{ctx:e}}}),t.$on("panel-open",(function(){E(e[66](e[149],e[146]))&&e[66](e[149],e[146]).apply(this,arguments)})),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(n,r){e=n;const i={};536870912&r[0]&&(i.class=e[29][e[149]]),528388&r[0]&&(i.open=e[12]&&!e[2]&&0===e[149]&&!e[19]),1075159035&r[0]|1&r[1]|67108864&r[4]|16&r[5]&&(i.$$scope={dirty:r,ctx:e}),t.$set(i)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function cd(e){let t,n;return t=new Ll({props:{praefix:e[149],item:e[156],eventId:e[7],fullRecord:e[0],record:e[147],recordId:e[0]._id,multiValues:e[5],reqQuantity:e[3],notifyList:e[9],noForm:Bd,classId:e[6],disabled:e[1],required:e[40],selectionFields:e[50],propSelection:e[20],numberInput:e[31],dateInput:{...e[11],l:e[4].name,t:e[149]===e[15].length-1,n:e[48].get(e[156].name)},shortEdit:e[10],currency:e[8],initFinished:e[18],formnovalidate:e[149]===e[15].length-1||e[15][e[149]]._delete}}),t.$on("notify",(function(){E(e[54](e[4],e[156],e[149]))&&e[54](e[4],e[156],e[149]).apply(this,arguments)})),t.$on("task",(function(){E(e[53](e[4]))&&e[53](e[4]).apply(this,arguments)})),t.$on("invalid",e[55]),t.$on("defPrep",e[56]),t.$on("checkRange",e[57]),t.$on("formula",e[67](e[149])),t.$on("record",e[86]),t.$on("listRecord",e[58](e[149])),t.$on("propSelection",e[68](e[149])),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(n,r){e=n;const i={};16&r[0]&&(i.item=e[156]),128&r[0]&&(i.eventId=e[7]),1&r[0]&&(i.fullRecord=e[0]),32768&r[0]&&(i.record=e[147]),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]),1048576&r[0]&&(i.propSelection=e[20]),1&r[1]&&(i.numberInput=e[31]),34832&r[0]&&(i.dateInput={...e[11],l:e[4].name,t:e[149]===e[15].length-1,n:e[48].get(e[156].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[149]===e[15].length-1||e[15][e[149]]._delete),t.$set(i)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function dd(e){let t,n,r=e[4].item,i=[];for(let t=0;t<r.length;t+=1)i[t]=cd(Gc(e,r,t));const o=e=>ye(i[e],1,1,(()=>{i[e]=null}));return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=P()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);R(e,t,r),n=!0},p(e,n){if(1347579&n[0]|264897025&n[1]|96&n[2]){let s;for(r=e[4].item,s=0;s<r.length;s+=1){const o=Gc(e,r,s);i[s]?(i[s].p(o,n),we(i[s],1)):(i[s]=cd(o),i[s].c(),we(i[s],1),i[s].m(t.parentNode,t))}for(pe(),s=r.length;s<i.length;s+=1)o(s);ge()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)we(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)ye(i[e]);n=!1},d(e){k(i,e),e&&D(t)}}}function ud(e){let t,n,r=e[15][e[149]]._delete,i=dd(e);return{c(){i.c(),t=P()},m(e,r){i.m(e,r),R(e,t,r),n=!0},p(e,n){32768&n[0]&&A(r,r=e[15][e[149]]._delete)?(pe(),ye(i,1,1,_),ge(),i=dd(e),i.c(),we(i),i.m(t.parentNode,t)):i.p(e,n)},i(e){n||(we(i),n=!0)},o(e){ye(i),n=!1},d(e){e&&D(t),i.d(e)}}}function hd(e){let t,n,r,i,o=e[15].length,s=ud(e);return{c(){t=O("div"),s.c(),r=B(),U(t,"id",n=`accordion-content-${e[6]}-${e[4].name}-${e[149]}`)},m(e,n){R(e,t,n),s.m(t,null),R(e,r,n),i=!0},p(e,r){32768&r[0]&&A(o,o=e[15].length)?(pe(),ye(s,1,1,_),ge(),s=ud(e),s.c(),we(s),s.m(t,null)):s.p(e,r),(!i||80&r[0]&&n!==(n=`accordion-content-${e[6]}-${e[4].name}-${e[149]}`))&&U(t,"id",n)},i(e){i||(we(s),i=!0)},o(e){ye(s),i=!1},d(e){e&&D(t),s.d(e),e&&D(r)}}}function fd(e){let t,n;return t=new e[35]({props:{$$slots:{default:[md]},$$scope:{ctx:e}}}),t.$on("click",(function(){E(e[59](e[150],e[149],e[12]))&&e[59](e[150],e[149],e[12]).apply(this,arguments)})),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(n,r){e=n;const i={};1073840144&r[0]|16&r[5]&&(i.$$scope={dirty:r,ctx:e}),t.$set(i)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function md(e){let t,n,r,i,o,s=e[52](e[16],e[149])+"";return{c(){t=O("div"),n=M(s),U(t,"class",r=S("draggableListItem "+e[4].name)+" svelte-9vv5ub"),U(t,"draggable",!0),q(t,"delete",e[147]._delete),q(t,"is-active-top",e[30]?.top===e[149]),q(t,"is-active-bottom",e[30]?.bottom===e[149])},m(r,s){R(r,t,s),N(t,n),i||(o=[L(t,"dragover",e[64]),L(t,"dragleave",e[65](e[149])),L(t,"dragstart",e[62](e[149])),L(t,"drop",F(e[61](e[149]))),L(t,"dragenter",e[63](e[149]))],i=!0)},p(i,o){e=i,65536&o[0]&&s!==(s=e[52](e[16],e[149])+"")&&H(n,s),16&o[0]&&r!==(r=S("draggableListItem "+e[4].name)+" svelte-9vv5ub")&&U(t,"class",r),32784&o[0]&&q(t,"delete",e[147]._delete),1073741840&o[0]&&q(t,"is-active-top",e[30]?.top===e[149]),1073741840&o[0]&&q(t,"is-active-bottom",e[30]?.bottom===e[149])},d(e){e&&D(t),i=!1,$(o)}}}function pd(e){let t,n,r;var i=e[153];return i&&(t=new i({props:{size:"20"}})),{c(){t&&Ee(t.$$.fragment),n=P()},m(e,i){t&&Ae(t,e,i),R(e,n,i),r=!0},p(e,r){if(i!==(i=e[153])){if(t){pe();const e=t;ye(e.$$.fragment,1,0,(()=>{be(e,1)})),ge()}i?(t=new i({props:{size:"20"}}),Ee(t.$$.fragment),we(t.$$.fragment,1),Ae(t,n.parentNode,n)):t=null}},i(e){r||(t&&we(t.$$.fragment,e),r=!0)},o(e){t&&ye(t.$$.fragment,e),r=!1},d(e){e&&D(n),t&&be(t,e)}}}function gd(e){let t,n,r,i,o,s=!e[1]&&!e[4].readonly&&pd(e);return{c(){t=O("span"),s&&s.c(),U(t,"class","pointer icon svelte-9vv5ub"),U(t,"title",e[151]),t.hidden=n=e[149]===e[15].length-1||!(e[147]._delete^e[152])},m(n,a){R(n,t,a),s&&s.m(t,null),r=!0,i||(o=L(t,"click",(function(){E(e[60](e[149],e[12],e[150]))&&e[60](e[149],e[12],e[150]).apply(this,arguments)})),i=!0)},p(i,o){(e=i)[1]||e[4].readonly?s&&(pe(),ye(s,1,1,(()=>{s=null})),ge()):s?(s.p(e,o),18&o[0]&&we(s,1)):(s=pd(e),s.c(),we(s,1),s.m(t,null)),(!r||32768&o[0]&&n!==(n=e[149]===e[15].length-1||!(e[147]._delete^e[152])))&&(t.hidden=n)},i(e){r||(we(s),r=!0)},o(e){ye(s),r=!1},d(e){e&&D(t),s&&s.d(),i=!1,o()}}}function wd(e){let t,n,r,i,o,s=!e[10]&&fd(e),a=[{title:"löschen",toDelete:!0,icon:tt},{title:"undo",toDelete:!1,icon:Qe}],l=[];for(let t=0;t<2;t+=1)l[t]=gd(Xc(e,a,t));const c=e=>ye(l[e],1,1,(()=>{l[e]=null}));return{c(){t=O("div"),s&&s.c(),n=B();for(let e=0;e<2;e+=1)l[e].c();r=B(),U(t,"class",i=S("accordion "+e[4].name)+" svelte-9vv5ub"),U(t,"slot","handle")},m(e,i){R(e,t,i),s&&s.m(t,null),N(t,n);for(let e=0;e<2;e+=1)l[e].m(t,null);N(t,r),o=!0},p(e,d){if(e[10]?s&&(pe(),ye(s,1,1,(()=>{s=null})),ge()):s?(s.p(e,d),1024&d[0]&&we(s,1)):(s=fd(e),s.c(),we(s,1),s.m(t,n)),36882&d[0]|536870912&d[1]|67108864&d[4]){let n;for(a=[{title:"löschen",toDelete:!0,icon:tt},{title:"undo",toDelete:!1,icon:Qe}],n=0;n<2;n+=1){const i=Xc(e,a,n);l[n]?(l[n].p(i,d),we(l[n],1)):(l[n]=gd(i),l[n].c(),we(l[n],1),l[n].m(t,r))}for(pe(),n=2;n<2;n+=1)c(n);ge()}(!o||16&d[0]&&i!==(i=S("accordion "+e[4].name)+" svelte-9vv5ub"))&&U(t,"class",i)},i(e){if(!o){we(s);for(let e=0;e<2;e+=1)we(l[e]);o=!0}},o(e){ye(s),l=l.filter(Boolean);for(let e=0;e<2;e+=1)ye(l[e]);o=!1},d(e){e&&D(t),s&&s.d(),k(l,e)}}}function yd(e){let t,n,r=(!e[2]&&!e[1]||e[149]<e[15].length-1)&&ld(e);return{c(){r&&r.c(),t=P()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,n){!e[2]&&!e[1]||e[149]<e[15].length-1?r?(r.p(e,n),32774&n[0]&&we(r,1)):(r=ld(e),r.c(),we(r,1),r.m(t.parentNode,t)):r&&(pe(),ye(r,1,1,(()=>{r=null})),ge())},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function vd(e){let t,n,r=e[15],i=[];for(let t=0;t<r.length;t+=1)i[t]=yd(jc(e,r,t));const o=e=>ye(i[e],1,1,(()=>{i[e]=null}));return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=P()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);R(e,t,r),n=!0},p(e,n){if(1612554239&n[0]|2146042369&n[1]|127&n[2]|71303168&n[4]){let s;for(r=e[15],s=0;s<r.length;s+=1){const o=jc(e,r,s);i[s]?(i[s].p(o,n),we(i[s],1)):(i[s]=yd(o),i[s].c(),we(i[s],1),i[s].m(t.parentNode,t))}for(pe(),s=r.length;s<i.length;s+=1)o(s);ge()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)we(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)ye(i[e]);n=!1},d(e){k(i,e),e&&D(t)}}}function _d(e){let t,n,r;function i(t){e[88](t)}let o={$$slots:{default:[kd,({closeCallback:e})=>({142:e}),({closeCallback:e})=>[0,0,0,0,e?262144:0]]},$$scope:{ctx:e}};return void 0!==e[22]&&(o.open=e[22]),t=new e[32]({props:o}),ee.push((()=>$e(t,"open",i))),{c(){Ee(t.$$.fragment)},m(e,n){Ae(t,e,n),r=!0},p(e,r){const i={};529006592&r[0]|262144&r[4]|16&r[5]&&(i.$$scope={dirty:r,ctx:e}),!n&&4194304&r[0]&&(n=!0,i.open=e[22],le((()=>n=!1))),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function Id(e){let t,n;return{c(){t=O("td"),n=M(e[24])},m(e,r){R(e,t,r),N(t,n)},p(e,t){16777216&t[0]&&H(n,e[24])},d(e){e&&D(t)}}}function Cd(e){let t,n,r,i;return{c(){t=O("td"),n=O("input"),U(n,"id","reader_focusId"),n.autofocus=!0,n.value=e[23]},m(o,s){R(o,t,s),N(t,n),n.focus(),r||(i=[L(n,"focus",e[72]),L(n,"input",(function(){E(e[78](e[19].keyboard.length))&&e[78](e[19].keyboard.length).apply(this,arguments)}))],r=!0)},p(t,r){e=t,8388608&r[0]&&n.value!==e[23]&&(n.value=e[23])},d(e){e&&D(t),r=!1,$(i)}}}function $d(e){let t,n,r,i,o,s=e[73](e[19].refItem,!0)+"";return{c(){t=O("tr"),n=O("th"),r=O("div"),i=M(s),o=M(" nicht gefunden!"),z(r,"color","red"),U(n,"colspan","2")},m(e,s){R(e,t,s),N(t,n),N(n,r),N(r,i),N(r,o)},p(e,t){524288&t[0]&&s!==(s=e[73](e[19].refItem,!0)+"")&&H(i,s)},d(e){e&&D(t)}}}function Ed(e){let t,n,r,i,o,s=e[73](e[19].refItem)+"";return{c(){t=O("tr"),n=O("th"),r=O("div"),i=M(s),o=M(" bereits eingefügt!"),z(r,"color","red"),U(n,"colspan","2")},m(e,s){R(e,t,s),N(t,n),N(n,r),N(r,i),N(r,o)},p(e,t){524288&t[0]&&s!==(s=e[73](e[19].refItem)+"")&&H(i,s)},d(e){e&&D(t)}}}function Ad(e){let t;let n=function(e){return"number"===e[143].type?Sd:bd}(e),r=n(e);return{c(){r.c(),t=P()},m(e,n){r.m(e,n),R(e,t,n)},p(e,t){r.p(e,t)},d(e){r.d(e),e&&D(t)}}}function bd(e){let t;return{c(){t=O("input"),U(t,"id","reader_"+e[143].name),U(t,"type","text")},m(e,n){R(e,t,n)},p:_,d(e){e&&D(t)}}}function Sd(e){let t,n,r;return{c(){t=O("input"),z(t,"width","4em"),U(t,"id","reader_"+e[143].name),U(t,"type","text"),U(t,"min","0")},m(i,o){R(i,t,o),n||(r=L(t,"input",(function(){E(e[78](e[19].keyboard.length,e[143]))&&e[78](e[19].keyboard.length,e[143]).apply(this,arguments)})),n=!0)},p(t,n){e=t},d(e){e&&D(t),n=!1,r()}}}function Td(e){let t,n,r,i,o,s,a=e[73](e[143].name)+"",l=e[25]&&Ad(e);return{c(){t=O("tr"),n=O("th"),r=M(a),i=B(),o=O("td"),l&&l.c(),s=B()},m(e,a){R(e,t,a),N(t,n),N(n,r),N(t,i),N(t,o),l&&l.m(o,null),N(t,s)},p(e,t){e[25]?l?l.p(e,t):(l=Ad(e),l.c(),l.m(o,null)):l&&(l.d(1),l=null)},d(e){e&&D(t),l&&l.d()}}}function Nd(e){let t;return{c(){t=M("Verwerfen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Rd(e){let t;return{c(){t=M("Speichern")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Dd(e){let t,n,r,i,o,s,a,l,c,d,u,h,f,m,p,g,w,y,v,_,I,C,$,E=e[73](e[19].refItem)+"";function A(t){e[87](t)}let b={keyboard:e[19].keyboard,codeTypes:e[19].codeTypes};function S(e,t){return e[19].keyboard?Cd:Id}void 0!==e[27]&&(b.readerInit=e[27]),t=new Wc({props:b}),ee.push((()=>$e(t,"readerInit",A))),t.$on("scan",e[71]),t.$on("exit",e[76]);let T=S(e),x=T(e);function P(e,t){return e[28]?Ed:e[24]&&!e[26]?$d:void 0}let L=P(e),F=L&&L(e),V=e[47],U=[];for(let t=0;t<V.length;t+=1)U[t]=Td(qc(e,V,t));return _=new e[35]({props:{disabled:!e[24],outline:!0,style:"float: left;",$$slots:{default:[Nd]},$$scope:{ctx:e}}}),_.$on("click",e[74]),C=new e[35]({props:{disabled:!e[26],filled:!0,style:"float: right;",$$slots:{default:[Rd]},$$scope:{ctx:e}}}),C.$on("click",e[75]),{c(){Ee(t.$$.fragment),r=B(),i=O("div"),o=O("table"),s=O("tr"),a=O("th"),a.textContent="Code",l=B(),x.c(),c=B(),d=O("tr"),u=O("th"),h=M(E),f=B(),m=O("td"),p=O("div"),g=M(e[25]),w=B(),F&&F.c(),y=B();for(let e=0;e<U.length;e+=1)U[e].c();v=B(),Ee(_.$$.fragment),I=B(),Ee(C.$$.fragment),z(p,"max-width","14em"),z(o,"margin-top","1em"),z(o,"margin-bottom","1em"),z(o,"text-align","left"),z(i,"position","relative"),z(i,"z-index","1000"),z(i,"background-color","white"),z(i,"height","225px")},m(e,n){Ae(t,e,n),R(e,r,n),R(e,i,n),N(i,o),N(o,s),N(s,a),N(s,l),x.m(s,null),N(o,c),N(o,d),N(d,u),N(u,h),N(d,f),N(d,m),N(m,p),N(p,g),N(o,w),F&&F.m(o,null),N(o,y);for(let e=0;e<U.length;e+=1)U[e].m(o,null);N(i,v),Ae(_,i,null),N(i,I),Ae(C,i,null),$=!0},p(e,r){const i={};if(524288&r[0]&&(i.keyboard=e[19].keyboard),524288&r[0]&&(i.codeTypes=e[19].codeTypes),!n&&134217728&r[0]&&(n=!0,i.readerInit=e[27],le((()=>n=!1))),t.$set(i),T===(T=S(e))&&x?x.p(e,r):(x.d(1),x=T(e),x&&(x.c(),x.m(s,null))),(!$||524288&r[0])&&E!==(E=e[73](e[19].refItem)+"")&&H(h,E),(!$||33554432&r[0])&&H(g,e[25]),L===(L=P(e))&&F?F.p(e,r):(F&&F.d(1),F=L&&L(e),F&&(F.c(),F.m(o,y))),34078720&r[0]|65536&r[1]|67584&r[2]){let t;for(V=e[47],t=0;t<V.length;t+=1){const n=qc(e,V,t);U[t]?U[t].p(n,r):(U[t]=Td(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={};16777216&r[0]&&(a.disabled=!e[24]),16&r[5]&&(a.$$scope={dirty:r,ctx:e}),_.$set(a);const l={};67108864&r[0]&&(l.disabled=!e[26]),16&r[5]&&(l.$$scope={dirty:r,ctx:e}),C.$set(l)},i(e){$||(we(t.$$.fragment,e),we(_.$$.fragment,e),we(C.$$.fragment,e),$=!0)},o(e){ye(t.$$.fragment,e),ye(_.$$.fragment,e),ye(C.$$.fragment,e),$=!1},d(e){be(t,e),e&&D(r),e&&D(i),x.d(),F&&F.d(),k(U,e),be(_),be(C)}}}function kd(e){let t,n;return t=new e[33]({props:{title:"Scannen",class:"reader",closeCallback:e[142],$$slots:{default:[Dd]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};262144&n[4]&&(r.closeCallback=e[142]),529006592&n[0]|16&n[5]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Od(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function xd(e){let t,n,r={ctx:e,current:null,token:null,hasCatch:!1,pending:Od,then:Zc,catch:Yc,value:141,blocks:[,,,]};return ve(e[51](),r),{c(){t=P(),r.block.c()},m(e,i){R(e,t,i),r.block.m(e,r.anchor=i),r.mount=()=>t.parentNode,r.anchor=t,n=!0},p(t,n){_e(r,e=t,n)},i(e){n||(we(r.block),n=!0)},o(e){for(let e=0;e<3;e+=1){ye(r.blocks[e])}n=!1},d(e){e&&D(t),r.block.d(e),r.token=null,r=null}}}let Md=new Map;const Bd=!0,Pd="pos/target";function Ld(e,n,r){let i,o,s;const{Modal:a,Dialog:l,FormField:d,TextField:h,Button:f,Accordion:w,AccordionSection:y,Divider:v}=c,_=K(),{loggedIn:I}=u;b(e,I,(e=>r(96,s=e)));let{list:C}=n,{mainSchema:$}=n,{schema:E}=n,{record:A}=n,{multiValues:S}=n,{classId:T}=n,{eventId:N}=n,{disabled:R}=n,{fixed:D}=n,{template:k={}}=n,{reqQuantity:O}=n,{open:x=!1}=n,{currency:M}=n,{notifyList:B}=n,{shortEdit:P}=n,{dateInput:L}=n;const F=E.find((e=>"price"===e.name&&!e.properties?.hidden)),V=E.find((e=>"amount"===e.name&&!e.properties?.hidden))||E.find((e=>e.isAmount&&!e.properties?.hidden)),U=E.find((e=>"quantity"===e.name&&!e.properties?.hidden)),H=V||F&&U,W=H&&U;let z=0;const q=E.find((e=>"quantity"===e.name&&"h"===e.properties?.unit?.constant&&!e.properties?.hidden));let j=0;const G=E.find((e=>"number"===e.type&&"w"===e.properties?.unit?.constant?.toLowerCase()&&!e.properties?.hidden))?.name||"",X=!!G;let Z=0,J=!1;const ee={},te=C.reader;let ne,re,ie,oe=E.properties?.readonly,ae=T.split("form-")[1].slice(0,-4),le=new Map,ce="",de=!0,ue="",he="",fe="",me=!1,pe=!1,ge=!1;const we=E.filter((e=>e.properties?.reader));let ye=new Map;C.group&&(D=!0);const ve={},_e=new Map,Ie=C.item.filter((e=>"number"===e.type&&!!e.properties?.transfer));R||=oe;let Ce,$e,Ee=[],Ae=[],be=!1,Se={},Te=[];const Ne=async e=>{if("saleDelivery"!==C.name||!Ce?.length||e[C.name]?.length){if(r(3,O=e.quantity),P)r(15,Ce=e[C.name]||[]);else if(!e._id&&C.filter){const e=Ce;r(15,Ce=[]);const t=await Ze();r(15,Ce=!1!==t?t.concat({}):e)}else r(15,Ce=((e,t)=>{let n=e[t];if(n?.length||(n=[]),n=n.concat({}),e._id)return n;for(const t of E)t.preset&&!n[0][t.name]&&(n[0][t.name]=e[t.preset]);return n})(e,C.name)||[{}]);Ke(e)}};E.filter((e=>e.selection)).map((e=>Ee.push({className:ae,parentClass:E,refClass:e.selection,value:""})));["readonly","hidden","required"].map((e=>{E.filter((t=>"object"==typeof(t.properties&&t.properties[e]))).map((t=>{const n=t.properties[e].refItem||"",r=t.properties[e].refValue;let[i,o]=n.split(".");o||(o=i,i=void 0),Te.push({action:e,itemName:t.name,refObj:i,refName:o,refValue:r,op:t.properties[e].invert?"!":""})}))}));const Re=(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:""},De=e=>e.slice(0,3).join(", "),ke=(e,t,n)=>async({detail:o})=>{const{oldValue:s,value:a,add:l}=o;if(a&&t.refClass){const e="p$"+t.refClass+"$"+N;let n=await dh(e);0===n?.length&&(await(c=500,new Promise((e=>{setTimeout(e,c)}))),n=await dh(e)),n&&n.find((({_id:e})=>e==a))||await ph(t.refClass,a)}var c;let{desc:d}=o;if(""===s&&""===a&&(d=""),e.refItem){const i=await Me(e,n,t,e.refItem);i&&r(15,Ce=i)}Ve(n,t._formulaActor);const u=Ee?.find((e=>e.refClass.split(":")[1]?.split(".")[0]===t.refClass));u&&(u.value=(u.value||new Map).set(n,a)),a&&Ce.length===n+1&&!P&&r(15,Ce=Ce.concat({})),d&&r(82,ee[a]=d,ee),P||await He(e,n,t,a,s),await Pe(n,t.name),r(16,i=Ce),"number"===t.type&&r(31,Se={item:t,value:a,idx:n}),await Oe(n),Le(n)},Oe=async e=>{if(Ce[e]&&!C.filter&&Ce.length!==e+1)for(const t of E.filter((e=>!!e.refProp))){let n,i=A[t.refItem]||Ce[e][t.refItem];if(!i)continue;if(Array.isArray(i)){if(Ce[e][t.name])continue;i=i[e][t.refItem]}const o="p$"+t.refItem+"$"+N;let s=await dh(o);if(s&&(n=s.find((({_id:e})=>e==i))),n||(n=await ph(t.refItem,i)),!n)continue;const a=xe(n,t.refProp)?.replace(",",".")||n[t.refProp]&&n[t.refProp][t.name]?.replace(",",".")||n[t.refProp];Ce[e][t.name]||r(15,Ce[e][t.name]=a,Ce)}},xe=(e,t)=>{try{return e.split(".").reduce(((e,t)=>e[t]),t)}catch(e){return""}},Me=async(e,t,n,r)=>{if(e.filter)return;const i=A[r];if(!i?.length)return;const o=i[0][r];if(!o)return;const s=await ph(r,o);return s?s[e.name]:void 0},Be=(e,t,n,i)=>{if(!e.filter){if(i&&!1===n.refItem){const e="boolean"!==n.type&&"";Ce[t][n.name]&&r(15,Ce[t][n.name]=e,Ce)}Ce.length!==t+1&&"number"==typeof n.properties?.value&&r(15,Ce[t][n.name]=n.properties.value,Ce)}},Pe=async(e,t)=>{const n=Te.filter((e=>(e.refObj||ae)===t||e.refName===t));if(n?.length)for(const t of n){const{itemName:n,refObj:i,refName:o,refValue:s,op:a}=t;let l,c,{action:d}=t,u=!1,h=!1;if(i){const t=Ce[e][i];i===ae&&o?u=A:t&&(u=await ph(i,t))}!i&&o&&(u=Ce[e]),u&&(h=u[o],Array.isArray(h)&&0===h.length?h=!1:s&&(h=h==(u[s]||A[s]))),"!"===a&&(h=!h),"required"!==d&&"readonly"!==d||(d="required"===d?d:"disabled",setTimeout((()=>{l=`#accordion-content-${T}-${C.name}-${e} .form-field.${n} .field textarea`,c=document.querySelector(l),c||(l=`#accordion-content-${T}-${C.name}-${e} .form-field.${n} .field input#${"dp-"+n+"-"+e}`,c=document.querySelector(l)),c||(l=`#accordion-content-${T}-${C.name}-${e} .form-field.${n} .field input`,c=document.querySelector(l)),c&&h&&c.setAttribute(d,""),c&&!h&&c.removeAttribute(d)}),0)),"hidden"===d&&(l=`#accordion-content-${T}-${C.name}-${e} .form-field.${n}`,c=document.querySelector(l),c?.classList?.toggle("hidden",h),h&&r(15,Ce[e][n]="",Ce))}},Le=(e,t)=>{let n=`#accordion-content-${T}-${C.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-${T}-${C.name}-${e} :not(.form-field.hidden) .field input.invalid`,document.querySelector(n)&&(t=!0)),r(29,Ae[e]=o||t?"invalid":"",Ae)},Fe=e=>{if(!e)return 0;const[t,n=0]=e.split(":");return 60*t+parseInt(n)},Ve=(e,t)=>{if(!t)return;const n=E.find((e=>e.name===t));if(!n)return;const i=n.properties.value.formula,{operator:o,argument:s}=i,a=s.map((t=>Ce[e][t.refItem]||A[t.refItem]));let l=0;if("$preferred"===o){if(void 0!==Ce[e][t])return;l=a.reduce(((e,t)=>{let r=e;return"number"===n.type?r=+r||+t:r||=t,r}))}if("$add"===o&&(l=a.reduce(((e,t)=>+(e||0)+ +(t||0)))),"$subtract"===o&&(l=a.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"===o&&(l=a.reduce(((e,t)=>+(e||0)*+(t||0)))),"$percentMultiply"===o){const[e,t]=a;l=+e,+t>0&&(l*=1-t/100)}if("$percentDivide"===o){const[e,t]=a;0!=+t&&(l=+e/+t*100)}if("$percentSubtract"===o){let[e,t]=a;t.replace&&(t=t.replace(",",".")),0!=+t&&(l=+e-e*+t/100)}const c=`#accordion-content-${T}-${C.name}-${e} .form-field.${t} .field input`,d=document.querySelector(c),u=d?.disabled;r(15,Ce[e][t]="$multiply"===o?l?Ue(l,n.properties?.decimals):"":Ue(l,n.properties?.decimals),Ce),r(31,Se={item:n,value:l,idx:e}),setTimeout((()=>{const t=document.querySelector(c);u&&t&&t.setAttribute("disabled",""),n._formulaActor&&Ve(e,n._formulaActor)}),0)},Ue=(e,t)=>("number"==typeof e&&e||(e=Number(e||0)),e.toFixed(t||0));$e=E.filter((e=>e.refClass)).reduce(((e,t)=>{const n=E.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 He=async(e,t,n,i,o)=>{if(e.filter)return;const s=(await $e).find((e=>e.refClass===n.refClass));if(!s)return;const{refClass:a,items:l,selection:c}=s,d=n.name;if(Te.find((e=>e.itemName===d))){const n=`#accordion-content-${T}-${e.name}-${t} .form-field.${a}.hidden`;if(document.querySelector(n))return}return i?Promise.all(l.map((async e=>{let s=E.find((t=>t.name===e));if(!s)return;let d=s.refName||s.name,u="",h="";if(s.lookup){if(h=Ce[t][s.name],r(15,Ce[t][s.name]="",Ce),!Ce[t][s.refItem])return void r(15,Ce[t][s.name]="",Ce);const[e,n,i]=s.lookup.split("."),o=s.lookupRefItem||s.refItem,a=s.lookupRefName||d,l="p$"+s.refItem+"$"+N;let c,f=await dh(l);if(c=f?.find((({_id:e})=>e==Ce[t][s.refItem])),c||(c=await ph(s.refItem,Ce[t][s.refItem])),c){if(s.refItem2){const e=await ph(s.refItem2,c[s.refItem2]);if("dealerPrice"===d&&A.branch){const e=await ph("branch",A.branch);e?.sector?.includes("Privat")&&(d="price")}e&&(u=e[d])}0==+u&&(u=c[d])}if(A[e]){const r=await ph(e,A[e]);if(r&&r[n]){const e=await ph(n,r[n]);if(e){const n=e[i].find((e=>e[o]===Ce[t][o]));n&&(u=n[a])}}}return Ce[t][s.name]||r(15,Ce[t][s.name]=u||h,Ce),void await Ve(t,s._formulaActor)}if(s.properties?.readonly&&!n.refInput){const i=Ce[t][n.refClass];return Promise.resolve(ph(n.refClass,i,!0)).then((n=>{let i=s.refPos?n[s.refPos]||xe(s.refPos,n):n[e];void 0!==s.factor&&(i*=s.factor),Array.isArray(i)&&(i=i.length?i[0][e]:""),r(15,Ce[t][e]=i,Ce),s._formulaActor&&Ve(t,s._formulaActor)}))}const{refInput:f}=n;if(f&&Ce[t]){const[e,n]=f.split(".");u=n?Ce[t][n]:A[e]}if(c&&i!==o)l.map((e=>{r(15,Ce[t][e]="",Ce)}));else{if(s.refItem2){const[n,i]=s.refItem2.split(".");A[n]&&ph(n,A[n]).then((n=>{n&&+n[i]&&r(15,Ce[t][e]=n[i],Ce)}))}if(f&&!u||We(t,e)||o!==i){const i=E.find((e=>e.refClass===a)),o=Ce[t][i.name];if(n.selection){const i=mh(n.selection+o.toString());if(i)return Promise.resolve(i).then((n=>r(15,Ce[t][e]=n[e],Ce)))}const s="p$"+i.refClass+"$"+N;let l=await dh(s);if(l){const n=l.find((({_id:e})=>e==o));if(n)return Promise.resolve((()=>{r(15,Ce[t][e]=n[e],Ce)}))}return Promise.resolve(ph(i.refClass,o)).then((n=>r(15,Ce[t][e]=n[e],Ce)))}}}))):Promise.resolve(l.map((e=>{r(15,Ce[t][e]="",Ce)})))},We=(e,t)=>{let n=Ce[e][t];return"number"===E.find((e=>e.name===t)).type&&(n=Number(n||0)),!n},ze=e=>{if(!e)return;const{style:t,scrollHeight:n}=e;n&&(t.height=`${n}px`)};let qe=!1;const je=e=>!(!D&&e>=Ce.length-1),Ge=(e,t=!1)=>{const[n,r]=e.split(";");return C.name===r&&(!!je(t)&&((!1===t||t!=n)&&parseInt(n)))};E.filter((e=>e.properties?.value?.formula?.argument)).forEach((e=>{e.properties.value.formula.argument.forEach((t=>{const n=E.find((e=>e.name===t.refItem))||E.find((e=>e.name===t.refItem));n&&(n._formulaActor=e.name)}))}));const Xe=(e,t=!1)=>{const n=`#accordion-content-${T}-${C.name}-${e} > div.form-field:not(.hidden)`,i=document.querySelectorAll(n);if(!i?.length)return;const o=i[i.length-1];se().then((()=>{const t=`#accordion-content-${T}-${C.name}-${e} textarea`;Array.from(document.querySelectorAll(t)).forEach(ze)})).then((()=>{t&&o.scrollIntoView({behavior:"smooth",block:"end"})}));for(const t of E){"number"==typeof t.properties?.value&&r(15,Ce[e][t.name]=t.properties.value,Ce);const n=C.preserve&&C.preserve.includes(t.preset);if(t.preset&&!n&&!Ce[e][t.name]){const n=_e.get(t.preset);n&&r(15,Ce[e][t.name]=n,Ce)}t.refItem&&A[t.refItem]&&ph(t.refItem,A[t.refItem]).then((n=>r(15,Ce[e][t.name]=n[t.name],Ce)))}if(!(e<1)&&Ce?.length&&e===Ce.length-1&&C.preserve&&!A._id)for(const t of C.preserve){if(!Ce[e-1][t])continue;const n=Re(Ce[e-1][t],!0);r(15,Ce[e][t]=n,Ce),_e.set(t,n)}},Ye=new Map,Ze=async()=>{if(!C.filter)return[];let e,n,r,{date:i,level:o,isDealer:s}=A;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=Ye.get("dv"),c=Ye.get("lv"),d=Ye.get("iv");if(l===a&&c===o&&d===!!s)return!1;let u;Ye.set("dv",a),Ye.set("lv",o),Ye.set("iv",!!s),u=s?{$ne:""}:{$eq:""};const h={dealer:u,"_task.status":"Ready",payable:{$lt:a}};o&&(h.levelReminder=o),o||(h.levelReminder={$in:[void 0,!1,""]});const f=[{$addFields:{_docId:{$toString:"$_id"}}},{$lookup:{from:"_task",localField:"_docId",foreignField:"docId",as:"_task"}},{$unwind:{path:"$_task",preserveNullAndEmptyArrays:!0}},{$match:h},{$sort:{payable:1,invoiceId:1}}];return await t.getSectionView("invoice",f)},Ke=async e=>{if(!C.filter){if(e[C.name]?.length)for(const n of E)if((n.properties?.prefetch||1e3)<e[C.name].length){const r="p$"+n.refClass+"$"+N;if(dh(r))continue;ch(r,[]);const i=Qe(e[C.name],n.name);i?.length&&ch(r,t.getSectionView(n.refClass,{_id:{$in:i}}))}r(20,ne={record:e})}},Qe=(e,t)=>e.map((e=>e[t])).filter((e=>!!e)),Je=()=>{r(28,pe=!1),r(25,he=""),r(23,ce=""),de=!0,r(24,ue=""),r(26,fe=""),r(22,ie=!0)},et=async({detail:e})=>{const{refItem:n,refValue:i,refDescription:o,keyboard:s,input:a}=te;let l,c="reader_";for(;e.text.length>s.length;)e.text=e.text.slice(1);if(ue===e.text&&e.item){const t=c+e.item.name;return l=document.getElementById(t),l.value=+(ye.get(e.item.name)||0)+1,ye.set(e.item.name,l.value),l.focus(),de=!0,void r(23,ce="")}if(r(28,pe=!1),r(25,he=""),r(24,ue=e.text||""),!ue)return;const d=E.find((e=>e.name===n))?.refClass;if(!d)return;let u=await t.getSectionView(d,{[i]:ue});u?.length?(u=u[0],r(26,fe=u._id),r(25,he=o.map((e=>u[e])).join(", ")),r(28,pe=Ce.find((e=>e[n]===fe))),setTimeout((()=>{E.filter((e=>e.properties?.reader)).forEach((e=>{const t=document.getElementById("reader_"+e.name);t&&(t.value=ye.get(e.name)||(pe?pe[e.name]:"")),ye.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=+(ye.get(e.item.name)||0)+t,ye.set(e.item.name,l.value),l.focus()}else{const e=E.find((e=>e.properties?.reader)).name,n=c+e;l=document.getElementById(n),l.value=+(ye.get(e)||0)+t,ye.set(e,l.value),l.focus()}de=!0,r(23,ce="")}),0)):setTimeout((()=>{de=!0,r(23,ce=""),r(24,ue=""),ye=new Map;const e=document.getElementById("reader_focusId");e&&e.focus()}),0)},tt=()=>{r(25,he=""),r(26,fe=""),r(28,pe=!1),r(27,me=!0),nt(),ye=new Map},nt=()=>{if(!te.keyboard)return;const e=document.getElementById("reader_focusId");e&&e.focus()};Y((async()=>{if(!C.filter&&(re||r(21,re=await t.getEvent(N)),(A._id||!re.input)&&!(Ce.length>1)&&!R&&te?.autostart)){if("object"==typeof te.autostart){if(!te.autostart.user)return;{const e=s.user,[t,n]=te.autostart.user.split(":"),r=$.find((e=>e.name===t)),i=r?.refClass;if(!i||!n)return;const o=await ph(i,A[t]);if(!o)return;if(o[n]!==e)return}}else if(!0!==te.autostart)return;ge=!1,Je()}}));return e.$$set=e=>{"list"in e&&r(4,C=e.list),"mainSchema"in e&&r(79,$=e.mainSchema),"schema"in e&&r(80,E=e.schema),"record"in e&&r(0,A=e.record),"multiValues"in e&&r(5,S=e.multiValues),"classId"in e&&r(6,T=e.classId),"eventId"in e&&r(7,N=e.eventId),"disabled"in e&&r(1,R=e.disabled),"fixed"in e&&r(2,D=e.fixed),"template"in e&&r(81,k=e.template),"reqQuantity"in e&&r(3,O=e.reqQuantity),"open"in e&&r(12,x=e.open),"currency"in e&&r(8,M=e.currency),"notifyList"in e&&r(9,B=e.notifyList),"shortEdit"in e&&r(10,P=e.shortEdit),"dateInput"in e&&r(11,L=e.dateInput)},e.$$.update=()=>{if(528&e.$$.dirty[0]&&B&&!C.filter){const{itemName:e,value:t}=B;_e.set(e,t),e&&e===C.name&&r(0,A[e]=t,A)}1&e.$$.dirty[0]&&Ne(A),32768&e.$$.dirty[0]&&r(16,i=Ce),122896&e.$$.dirty[0]&&i&&((()=>{if(q)r(17,j=Ce?.reduce(((e,t)=>e+(t._delete?0:+(t.quantity||0))),0)||0)})(),(()=>{if(X)r(14,Z=Ce?.reduce(((e,t)=>e+(t._delete?0:+(t[G]||0))),0)||0)})(),(()=>{if(H)r(13,z=Ce?.reduce(((e,t)=>{if(t.amount){const n=t.amount??0;e+=t._delete?0:+n}else if(t.price){const n=(W?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)})(),se().then((()=>_("save",{listName:C.name,value:Ce,amountValue:z,weeksValue:Z})))),1048576&e.$$.dirty[2]&&(o=e=>ee[e]?.split(" • ").filter((e=>!!e&&!/^[0-9a-f]{24}/.test(e))).slice(0,2).join(" · "))},[A,R,D,O,C,S,T,N,M,B,P,L,x,z,Z,Ce,i,j,J,te,ne,re,ie,ce,ue,he,fe,me,pe,Ae,be,Se,a,l,d,f,w,y,v,I,undefined,H,{name:"amountValue",properties:{decimals:2}},q,{name:"hoursValue",properties:{decimals:2}},X,{name:"weeksValue",properties:{decimals:1}},we,_e,Ie,Ee,async()=>{if(!R&&(re||r(21,re=await t.getEvent(N)),(A._id||!re.input)&&te&&!te.keyboard))try{const e=await Uc();e?.length||r(19,te=!1)}catch{}},(e,t)=>{let n=e[t];return ve["pos"+t]&&(n=ve["pos"+t]),n&&E.filter((e=>!0!==e.properties?.hidden&&("dateRange"===e.type||void 0!==n[e.name])&&"textarea"!==e.properties?.format)).map((e=>""===n[e.name]?"":"object"===e.type?o(n[e.name]):Array.isArray(n[e.name])?De(n[e.name]):"boolean"===e.type?g(n[e.name]):"number"===e.type?Ue(n[e.name],e.properties?.decimals||0):"dateRange"===e.type?((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()})(e.name,n):"date"===e.type?m(Re(n[e.name])):"datetime"===e.type?p(n[e.name]):e.properties?.multi?"":n[e.name])).filter((e=>!!e)).join(" • ")||"+"},e=>({detail:{row:t}})=>{if(_("task",{row:t}),!A._id&&t._id){for(let t=0;t<Ce.length;t++)for(const n of e.item)Be(e,t,n,!J);r(18,J=!0)}},ke,({detail:e})=>{const{idx:t,value:n}=e;Le(t,n)},async({detail:{className:e,itemName:n,value:r}})=>{if(le.has(e))return;if(!0!==r&&(r=(r=[].concat(r)).some((e=>e===ae+"."+C.name))),!r)return;const i={[n]:!0},o=await t.getSectionView(e,i);o?.length&&le.set(e,o[0])},({detail:e})=>{const{idx:t,fieldId:n,value:r}=e;if(!r)return;const i=Fe(r);let o=!1;Ce.forEach(((e,n)=>{if(t===n)return;const{start:r,end:s}=Ce[n];r&&s&&i>Fe(r)&&i<Fe(s)&&(o=!0)}));const s=document.getElementById(n);s?.classList?.toggle("invalid",o)},e=>({detail:t})=>{t.string?r(15,Ce[e][t.itemName]=t.value,Ce):r(15,Ce[e][t.itemName]=Ue(t.value,t.decimals),Ce)},(e,t,n)=>n=>{Ce[t]._delete||(e(n),Xe(t,!0))},(e,t,n)=>i=>{if(r(15,Ce[e]._delete=!Ce[e]._delete,Ce),Ce[e]._delete){ve["pos"+e]={...Ce[e]};for(const t of E)r(15,Ce[e][t.name]="",Ce);t&&n(i)}else{if(ve["pos"+e]){const t={};for(const n of E)t[n.name]=ve["pos"+e][n.name];r(15,Ce[e]=t,Ce)}ve["pos"+e]=void 0,t||n(i)}},e=>t=>{t.preventDefault(),r(30,be=!1);const n=Ge(t.dataTransfer.getData(Pd),e);if(!1===n)return;t.dataTransfer.dropEffect="move";const i=[...Ce].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 Md.set(r,n);var n,r}));let o=[];Ae.map(((e,t)=>{o[t]=Ae[(e=>{const t=Md.get(e);return void 0===t?e:t})(t)]})),r(29,Ae=o),r(15,Ce=i.map(((e,t)=>(delete e._index,e)))),qe=!1},e=>t=>{if(!je(e))return!1;t.dataTransfer.effectAllowed="move",t.dataTransfer.dropEffect="move",t.dataTransfer.setData(Pd,e+";"+C.name),qe=e},e=>t=>{const n=Ge(t.dataTransfer.getData(Pd),e)||qe;return!1===n||n===e?r(30,be=!1):void r(30,be={top:n>e&&e,bottom:n<e&&e})},e=>e.preventDefault(),e=>e=>{r(30,be=!1)},(e,t)=>n=>{setTimeout((()=>{Array.from(le).forEach((([t,n])=>{Ce[e][t]||r(15,Ce[e][t]=n._id,Ce)}))}),500);const i=new Set;for(const e of Te)i.add(e.refObj||ae);for(const t of Array.from(i))Pe(e,t);t(n),Xe(e)},e=>({detail:t})=>{Ve(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,Ce[e][n]="",Ce);let c=await ph(o,a);const d=c[l];c=await ph(C.name,A[C.name][e][C.name]);const u=c[s];let h="number"===i?0:"",f=0;u.forEach((e=>{const t=e[l];t.length<=f||t.every((e=>d.find((t=>t===e))))&&(h=e[n],f=t.length)})),r(15,Ce[e][n]=h,Ce)},e=>e?.description||"Daten übernehmen",Je,et,()=>{de=!0,r(23,ce="")},(e,t=!1)=>t?(tt(),""):E.find((t=>t.name===e))?.designation||"",tt,()=>{const{refItem:e}=te,t={[e]:fe};let n;E.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=Ce;const o=i.findIndex((t=>t[e]===fe));o>=0?(n=i[o],i[o]={...n,...t}):i=i.slice(0,-1).concat(t),r(15,Ce=i),E.filter((e=>e.properties?.reader)).forEach((e=>{ke(e,o>=0?o:0)({detail:{oldValue:n?n[e.name]:"",value:t[e.name]}})})),ge=!0,tt()},()=>{ge&&(_("readerSave"),ge=!1)},()=>{const e=new Map;Ie.forEach((t=>{[].concat(t.properties.transfer.target).forEach((n=>{e.set(n,t.name)}))}));let t=0;for(const n of Ce){for(const[i,o]of e)!n[i]&&n[o]&&r(15,Ce[t][i]=n[o],Ce);t++}r(16,i=Ce)},(e,t)=>n=>{const{data:i}=n;"0123456789".includes(i)&&(de?(r(23,ce=i.toString()),de=!1):(r(23,ce+=i.toString()),"77"===ce&&r(23,ce="7"),ce.length===e&&et({detail:{text:ce,item:t}})))},$,E,k,ee,function(e){Z=e,r(14,Z)},function(e){j=e,r(17,j)},function(e){z=e,r(13,z)},function(t){Q(e,t)},function(e){me=e,r(27,me)},function(e){ie=e,r(22,ie)}]}class Fd extends Te{constructor(e){var t;super(),zc.getElementById("svelte-9vv5ub-style")||((t=O("style")).id="svelte-9vv5ub-style",t.textContent=".accordion.svelte-9vv5ub{display:flex;overflow:hidden}.accordion-content.svelte-9vv5ub{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-9vv5ub{padding-top:1em}div.delete.svelte-9vv5ub{text-decoration:line-through}.icon.svelte-9vv5ub{margin-right:-0.75em}.form-field .formField_italic{font-style:italic}.panel.invalid .btn{border:1px #b80000 solid}.draggableListItem.svelte-9vv5ub{cursor:drag}.draggableListItem.is-active-top.svelte-9vv5ub{border-top:3px purple solid;padding-top:2em}.draggableListItem.is-active-bottom.svelte-9vv5ub{border-bottom:3px purple solid;padding-bottom:2em}.modal-overlay > .dialog.reader{margin-top:0}",N(zc.head,t)),Se(this,e,Ld,xd,A,{list:4,mainSchema:79,schema:80,record:0,multiValues:5,classId:6,eventId:7,disabled:1,fixed:2,template:81,reqQuantity:3,open:12,currency:8,notifyList:9,shortEdit:10,dateInput:11},[-1,-1,-1,-1,-1,-1])}}const{Boolean:Vd,document:Ud}=Ie;function Hd(e,t,n){const r=e.slice();return r[202]=t[n],r[204]=n,r}function Wd(e,t,n){const r=e.slice();return r[206]=t[n],r}function zd(e,t,n){const r=e.slice();return r[209]=t[n],r}function qd(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function jd(e){let t,n,r=e[205]&&function(e){let t,n,r,i,o,s,a,l,c,d,u,h,f,m,p,g,w,y,v,_=e[22]&&Gd(e),I=e[40]&&Yd(e),C=e[0].items,E=[];for(let t=0;t<C.length;t+=1)E[t]=Qd(zd(e,C,t));const A=e=>ye(E[e],1,1,(()=>{E[e]=null}));let b=e[0].list&&Jd(e),T=!e[4]&&!e[2]&&e[38]&&e[5]&&!e[43]&&cu(e);h=new e[48]({props:{outline:!0,$$slots:{default:[uu]},$$scope:{ctx:e}}}),h.$on("click",e[68]);let x=e[36]&&e[35]&&hu(e);const M=[pu,mu],P=[];function V(e,t){return e[10]?0:e[38]?1:-1}~(p=V(e))&&(g=P[p]=M[p](e));return{c(){t=O("section"),_&&_.c(),n=B(),I&&I.c(),r=B(),i=O("form"),o=O("input"),a=B();for(let e=0;e<E.length;e+=1)E[e].c();l=B(),b&&b.c(),c=B(),T&&T.c(),d=B(),u=O("div"),Ee(h.$$.fragment),f=B(),x&&x.c(),m=B(),g&&g.c(),U(o,"class",S(e[55])+" svelte-lfqa43"),U(o,"name","_id"),U(o,"type","hidden"),o.value=s=e[9]._id||"",U(i,"class",S(e[56])+" svelte-lfqa43"),U(i,"id",e[55]),U(u,"class","form--buttons svelte-lfqa43"),U(t,"class",S(e[57])+" svelte-lfqa43")},m(s,g){R(s,t,g),_&&_.m(t,null),N(t,n),I&&I.m(t,null),N(t,r),N(t,i),N(i,o),N(i,a);for(let e=0;e<E.length;e+=1)E[e].m(i,null);N(i,l),b&&b.m(i,null),N(t,c),T&&T.m(t,null),N(t,d),N(t,u),Ae(h,u,null),N(u,f),x&&x.m(u,null),N(u,m),~p&&P[p].m(u,null),w=!0,y||(v=[L(i,"keydown",e[73]),L(i,"submit",F(e[67]))],y=!0)},p(e,a){if(e[22]?_?(_.p(e,a),4194304&a[0]&&we(_,1)):(_=Gd(e),_.c(),we(_,1),_.m(t,n)):_&&(pe(),ye(_,1,1,(()=>{_=null})),ge()),e[40]?I?(I.p(e,a),512&a[1]&&we(I,1)):(I=Yd(e),I.c(),we(I,1),I.m(t,r)):I&&(pe(),ye(I,1,1,(()=>{I=null})),ge()),(!w||512&a[0]&&s!==(s=e[9]._id||""))&&(o.value=s),537430529&a[0]|553652225&a[1]|2033544&a[2]){let t;for(C=e[0].items,t=0;t<C.length;t+=1){const n=zd(e,C,t);E[t]?(E[t].p(n,a),we(E[t],1)):(E[t]=Qd(n),E[t].c(),we(E[t],1),E[t].m(i,l))}for(pe(),t=C.length;t<E.length;t+=1)A(t);ge()}e[0].list?b?(b.p(e,a),1&a[0]&&we(b,1)):(b=Jd(e),b.c(),we(b,1),b.m(i,null)):b&&(pe(),ye(b,1,1,(()=>{b=null})),ge()),e[4]||e[2]||!e[38]||!e[5]||e[43]?T&&(pe(),ye(T,1,1,(()=>{T=null})),ge()):T?(T.p(e,a),52&a[0]|4224&a[1]&&we(T,1)):(T=cu(e),T.c(),we(T,1),T.m(t,d));const c={};67108864&a[6]&&(c.$$scope={dirty:a,ctx:e}),h.$set(c),e[36]&&e[35]?x?(x.p(e,a),48&a[1]&&we(x,1)):(x=hu(e),x.c(),we(x,1),x.m(u,m)):x&&(pe(),ye(x,1,1,(()=>{x=null})),ge());let f=p;p=V(e),p===f?~p&&P[p].p(e,a):(g&&(pe(),ye(P[f],1,1,(()=>{P[f]=null})),ge()),~p?(g=P[p],g?g.p(e,a):(g=P[p]=M[p](e),g.c()),we(g,1),g.m(u,null)):g=null)},i(e){if(!w){we(_),we(I);for(let e=0;e<C.length;e+=1)we(E[e]);we(b),we(T),we(h.$$.fragment,e),we(x),we(g),w=!0}},o(e){ye(_),ye(I),E=E.filter(Vd);for(let e=0;e<E.length;e+=1)ye(E[e]);ye(b),ye(T),ye(h.$$.fragment,e),ye(x),ye(g),w=!1},d(e){e&&D(t),_&&_.d(),I&&I.d(),k(E,e),b&&b.d(),T&&T.d(),be(h),x&&x.d(),~p&&P[p].d(),y=!1,$(v)}}}(e);return{c(){r&&r.c(),t=P()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,t){e[205]&&r.p(e,t)},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function Gd(e){let t,n;return t=new e[48]({props:{disabled:e[43]||e[9]._id,filled:!0,style:"opacity: 0.75; margin-bottom: .5em;",$$slots:{default:[Xd]},$$scope:{ctx:e}}}),t.$on("click",e[90]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};512&n[0]|4096&n[1]&&(r.disabled=e[43]||e[9]._id),67108864&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Xd(e){let t,n,r;return n=new We({props:{size:"18"}}),{c(){t=O("span"),t.textContent="QR Code scannen",Ee(n.$$.fragment),z(t,"margin-right",".75em")},m(e,i){R(e,t,i),Ae(n,e,i),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n,e)}}}function Yd(e){let t,n;return t=new e[48]({props:{filled:!0,style:"opacity: 0.75; margin-bottom: .5em;",$$slots:{default:[Zd]},$$scope:{ctx:e}}}),t.$on("click",e[88]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};67108864&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Zd(e){let t,n,r;return n=new at({props:{size:"18"}}),{c(){t=O("span"),t.textContent="Dokument ergänzen",Ee(n.$$.fragment),z(t,"margin-right",".75em")},m(e,i){R(e,t,i),Ae(n,e,i),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n,e)}}}function Kd(e){let t,n;return t=new Ll({props:{classId:e[55],item:e[209],selection:e[209].selection,record:e[9],disabled:e[43],eventId:e[65],multiValues:e[60],notifyList:e[11],toDelete:e[19],currency:e[15],changeValue:e[31],initFinished:e[29]}}),t.$on("save",e[72]),t.$on("task",e[69]),t.$on("notify",e[70]),t.$on("safeReference",e[79]),t.$on("multi",e[71]),t.$on("defPrep",e[78]),t.$on("record",e[80]),t.$on("objRecord",e[81]),t.$on("formula",e[82]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};1&n[0]&&(r.item=e[209]),1&n[0]&&(r.selection=e[209].selection),512&n[0]&&(r.record=e[9]),4096&n[1]&&(r.disabled=e[43]),2048&n[0]&&(r.notifyList=e[11]),524288&n[0]&&(r.toDelete=e[19]),32768&n[0]&&(r.currency=e[15]),1&n[1]&&(r.changeValue=e[31]),536870912&n[0]&&(r.initFinished=e[29]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Qd(e){let t,n,r="list"!==e[209].type&&Kd(e);return{c(){r&&r.c(),t=P()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,n){"list"!==e[209].type?r?(r.p(e,n),1&n[0]&&we(r,1)):(r=Kd(e),r.c(),we(r,1),r.m(t.parentNode,t)):r&&(pe(),ye(r,1,1,(()=>{r=null})),ge())},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function Jd(e){let t,n,r,i,o,s=e[61]&&e[16]&&0!=e[16]&&eu(e),a=e[17]&&nu(e),l=e[62]&&e[30]&&0!=e[30]&&iu(e),c=e[0].list,d=[];for(let t=0;t<c.length;t+=1)d[t]=lu(Wd(e,c,t));const u=e=>ye(d[e],1,1,(()=>{d[e]=null}));return{c(){s&&s.c(),t=B(),a&&a.c(),n=B(),l&&l.c(),r=B();for(let e=0;e<d.length;e+=1)d[e].c();i=P()},m(e,c){s&&s.m(e,c),R(e,t,c),a&&a.m(e,c),R(e,n,c),l&&l.m(e,c),R(e,r,c);for(let t=0;t<d.length;t+=1)d[t].m(e,c);R(e,i,c),o=!0},p(e,o){if(e[61]&&e[16]&&0!=e[16]?s?(s.p(e,o),65536&o[0]&&we(s,1)):(s=eu(e),s.c(),we(s,1),s.m(t.parentNode,t)):s&&(pe(),ye(s,1,1,(()=>{s=null})),ge()),e[17]?a?(a.p(e,o),131072&o[0]&&we(a,1)):(a=nu(e),a.c(),we(a,1),a.m(n.parentNode,n)):a&&(pe(),ye(a,1,1,(()=>{a=null})),ge()),e[62]&&e[30]&&0!=e[30]?l?(l.p(e,o),1073741824&o[0]&&we(l,1)):(l=iu(e),l.c(),we(l,1),l.m(r.parentNode,r)):l&&(pe(),ye(l,1,1,(()=>{l=null})),ge()),3205701&o[0]|553652230&o[1]|134480904&o[2]){let t;for(c=e[0].list,t=0;t<c.length;t+=1){const n=Wd(e,c,t);d[t]?(d[t].p(n,o),we(d[t],1)):(d[t]=lu(n),d[t].c(),we(d[t],1),d[t].m(i.parentNode,i))}for(pe(),t=c.length;t<d.length;t+=1)u(t);ge()}},i(e){if(!o){we(s),we(a),we(l);for(let e=0;e<c.length;e+=1)we(d[e]);o=!0}},o(e){ye(s),ye(a),ye(l),d=d.filter(Vd);for(let e=0;e<d.length;e+=1)ye(d[e]);o=!1},d(e){s&&s.d(e),e&&D(t),a&&a.d(e),e&&D(n),l&&l.d(e),e&&D(r),k(d,e),e&&D(i)}}}function eu(e){let t,n;return t=new e[49]({props:{name:"Total Dokument",nameClass:"formField_italic",$$slots:{default:[tu]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};98304&n[0]|67108864&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function tu(e){let t,n,r;function i(t){e[105](t)}let o={item:e[58],disabled:!0,currency:e[15]};return void 0!==e[16]&&(o.value=e[16]),t=new Ai({props:o}),ee.push((()=>$e(t,"value",i))),{c(){Ee(t.$$.fragment)},m(e,n){Ae(t,e,n),r=!0},p(e,r){const i={};32768&r[0]&&(i.currency=e[15]),!n&&65536&r[0]&&(n=!0,i.value=e[16],le((()=>n=!1))),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function nu(e){let t,n;return t=new e[49]({props:{name:"Total MWSt "+(e[18]?"("+e[18]+"%)":""),nameClass:"formField_italic",$$slots:{default:[ru]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};262144&n[0]&&(r.name="Total MWSt "+(e[18]?"("+e[18]+"%)":"")),163840&n[0]|67108864&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ru(e){let t,n,r;function i(t){e[106](t)}let o={item:e[59],disabled:!0,currency:e[15]};return void 0!==e[17]&&(o.value=e[17]),t=new Ai({props:o}),ee.push((()=>$e(t,"value",i))),{c(){Ee(t.$$.fragment)},m(e,n){Ae(t,e,n),r=!0},p(e,r){const i={};32768&r[0]&&(i.currency=e[15]),!n&&131072&r[0]&&(n=!0,i.value=e[17],le((()=>n=!1))),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function iu(e){let t,n;return t=new e[49]({props:{name:"Gesamtzeit in Wochen",nameClass:"formField_italic",$$slots:{default:[ou]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};1073741824&n[0]|67108864&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ou(e){let t,n,r;function i(t){e[107](t)}let o={item:e[63],disabled:!0};return void 0!==e[30]&&(o.value=e[30]),t=new Ai({props:o}),ee.push((()=>$e(t,"value",i))),{c(){Ee(t.$$.fragment)},m(e,n){Ae(t,e,n),r=!0},p(e,r){const i={};!n&&1073741824&r[0]&&(n=!0,i.value=e[30],le((()=>n=!1))),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function su(e){let t,n,r,i;return t=new e[47]({props:{text:e[206].designation}}),r=new Lr({props:{classId:e[55],open:!e[2]&&1===e[0].list.length,list:e[206],template:e[32],eventId:e[65],schema:e[206].item,record:e[9],disabled:e[43],currency:e[15],update:e[13]}}),{c(){Ee(t.$$.fragment),n=B(),Ee(r.$$.fragment)},m(e,o){Ae(t,e,o),R(e,n,o),Ae(r,e,o),i=!0},p(e,n){const i={};1&n[0]&&(i.text=e[206].designation),t.$set(i);const o={};5&n[0]&&(o.open=!e[2]&&1===e[0].list.length),1&n[0]&&(o.list=e[206]),2&n[1]&&(o.template=e[32]),1&n[0]&&(o.schema=e[206].item),512&n[0]&&(o.record=e[9]),4096&n[1]&&(o.disabled=e[43]),32768&n[0]&&(o.currency=e[15]),8192&n[0]&&(o.update=e[13]),r.$set(o)},i(e){i||(we(t.$$.fragment,e),we(r.$$.fragment,e),i=!0)},o(e){ye(t.$$.fragment,e),ye(r.$$.fragment,e),i=!1},d(e){be(t,e),e&&D(n),be(r,e)}}}function au(e){let t,n;return t=new Fd({props:{classId:e[55],open:e[21],list:e[206],template:e[33],eventId:e[65],schema:e[206].item,mainSchema:e[0].items,record:e[9],disabled:e[43],fixed:e[206].fixed,reqQuantity:e[20],currency:e[15],notifyList:e[11],multiValues:e[60],shortEdit:e[6],dateInput:e[14]}}),t.$on("save",e[72]),t.$on("record",e[80]),t.$on("readerSave",e[89]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};2097152&n[0]&&(r.open=e[21]),1&n[0]&&(r.list=e[206]),4&n[1]&&(r.template=e[33]),1&n[0]&&(r.schema=e[206].item),1&n[0]&&(r.mainSchema=e[0].items),512&n[0]&&(r.record=e[9]),4096&n[1]&&(r.disabled=e[43]),1&n[0]&&(r.fixed=e[206].fixed),1048576&n[0]&&(r.reqQuantity=e[20]),32768&n[0]&&(r.currency=e[15]),2048&n[0]&&(r.notifyList=e[11]),64&n[0]&&(r.shortEdit=e[6]),16384&n[0]&&(r.dateInput=e[14]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function lu(e){let t,n,r,i;const o=[au,su],s=[];function a(e,t){return"array"===e[206].type?0:1}return t=a(e),n=s[t]=o[t](e),{c(){n.c(),r=P()},m(e,n){s[t].m(e,n),R(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?s[t].p(e,i):(pe(),ye(s[l],1,1,(()=>{s[l]=null})),ge(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),we(n,1),n.m(r.parentNode,r))},i(e){i||(we(n),i=!0)},o(e){ye(n),i=!1},d(e){s[t].d(e),e&&D(r)}}}function cu(e){let t,n,r,i;function o(t){e[108](t)}let s={title:"",$$slots:{default:[du]},$$scope:{ctx:e}};return void 0!==e[37]&&(s.checked=e[37]),n=new e[50]({props:s}),ee.push((()=>$e(n,"checked",o))),{c(){t=O("div"),Ee(n.$$.fragment),U(t,"class","askNext"),z(t,"margin-top","1em"),z(t,"margin-left","23em")},m(e,r){R(e,t,r),Ae(n,t,null),i=!0},p(e,t){const i={};67108864&t[6]&&(i.$$scope={dirty:t,ctx:e}),!r&&64&t[1]&&(r=!0,i.checked=e[37],le((()=>r=!1))),n.$set(i)},i(e){i||(we(n.$$.fragment,e),i=!0)},o(e){ye(n.$$.fragment,e),i=!1},d(e){e&&D(t),be(n)}}}function du(e){let t;return{c(){t=O("span"),t.textContent="Weiter erfassen",z(t,"margin-left",".75em")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function uu(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function hu(e){let t,n;return t=new e[48]({props:{filled:!0,style:"opacity: 0.6;",$$slots:{default:[fu]},$$scope:{ctx:e}}}),t.$on("click",(function(){E(e[74](e[1]))&&e[74](e[1]).apply(this,arguments)})),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(n,r){e=n;const i={};67108864&r[6]&&(i.$$scope={dirty:r,ctx:e}),t.$set(i)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function fu(e){let t,n,r;return n=new At({props:{size:"18"}}),{c(){t=O("span"),t.textContent=`${e[83]()}`,Ee(n.$$.fragment),z(t,"margin-right",".75em")},m(e,i){R(e,t,i),Ae(n,e,i),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n,e)}}}function mu(e){let t,n,r,i,o,s=!(e[39]||e[37])&&gu(e),a=e[5]&&!e[43]&&yu(e),l=e[2]&&e[3]&&_u(e),c=e[34]&&Cu(e);return{c(){s&&s.c(),t=B(),a&&a.c(),n=B(),l&&l.c(),r=B(),c&&c.c(),i=P()},m(e,d){s&&s.m(e,d),R(e,t,d),a&&a.m(e,d),R(e,n,d),l&&l.m(e,d),R(e,r,d),c&&c.m(e,d),R(e,i,d),o=!0},p(e,o){e[39]||e[37]?s&&(pe(),ye(s,1,1,(()=>{s=null})),ge()):s?(s.p(e,o),320&o[1]&&we(s,1)):(s=gu(e),s.c(),we(s,1),s.m(t.parentNode,t)),e[5]&&!e[43]?a?(a.p(e,o),32&o[0]|4096&o[1]&&we(a,1)):(a=yu(e),a.c(),we(a,1),a.m(n.parentNode,n)):a&&(pe(),ye(a,1,1,(()=>{a=null})),ge()),e[2]&&e[3]?l?(l.p(e,o),12&o[0]&&we(l,1)):(l=_u(e),l.c(),we(l,1),l.m(r.parentNode,r)):l&&(pe(),ye(l,1,1,(()=>{l=null})),ge()),e[34]?c?(c.p(e,o),8&o[1]&&we(c,1)):(c=Cu(e),c.c(),we(c,1),c.m(i.parentNode,i)):c&&(pe(),ye(c,1,1,(()=>{c=null})),ge())},i(e){o||(we(s),we(a),we(l),we(c),o=!0)},o(e){ye(s),ye(a),ye(l),ye(c),o=!1},d(e){s&&s.d(e),e&&D(t),a&&a.d(e),e&&D(n),l&&l.d(e),e&&D(r),c&&c.d(e),e&&D(i)}}}function pu(e){let t,n,r,i;t=new e[48]({props:{filled:!0,style:"opacity: 0.75;",$$slots:{default:[Ru]},$$scope:{ctx:e}}}),t.$on("click",e[76]);let o=e[36]&&Du(e);return{c(){Ee(t.$$.fragment),n=B(),o&&o.c(),r=P()},m(e,s){Ae(t,e,s),R(e,n,s),o&&o.m(e,s),R(e,r,s),i=!0},p(e,n){const i={};67108864&n[6]&&(i.$$scope={dirty:n,ctx:e}),t.$set(i),e[36]?o?(o.p(e,n),32&n[1]&&we(o,1)):(o=Du(e),o.c(),we(o,1),o.m(r.parentNode,r)):o&&(pe(),ye(o,1,1,(()=>{o=null})),ge())},i(e){i||(we(t.$$.fragment,e),we(o),i=!0)},o(e){ye(t.$$.fragment,e),ye(o),i=!1},d(e){be(t,e),e&&D(n),o&&o.d(e),e&&D(r)}}}function gu(e){let t,n;return t=new e[48]({props:{class:"close",disabled:e[43],form:e[55],filled:!0,type:"submit",$$slots:{default:[wu]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};4096&n[1]&&(r.disabled=e[43]),67108864&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function wu(e){let t;return{c(){t=M("Speichern und schliessen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function yu(e){let t,n;return t=new e[48]({props:{form:e[55],filled:!0,type:"submit",style:"opacity: 0.75;",$$slots:{default:[vu]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};256&n[1]|67108864&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function vu(e){let t,n=(e[39]||"Speichern")+"";return{c(){t=M(n)},m(e,n){R(e,t,n)},p(e,r){256&r[1]&&n!==(n=(e[39]||"Speichern")+"")&&H(t,n)},d(e){e&&D(t)}}}function _u(e){let t,n;return t=new e[48]({props:{disabled:e[43],danger:!0,outline:!0,$$slots:{default:[Iu]},$$scope:{ctx:e}}}),t.$on("click",e[84]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};4096&n[1]&&(r.disabled=e[43]),67108864&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Iu(e){let t;return{c(){t=M("Löschen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Cu(e){let t,n,r,i,o;const s=[Eu,$u],a=[];t=function(e){return e[64]?0:1}(e),n=a[t]=s[t](e);let l=e[36]&&Tu(e);return{c(){n.c(),r=B(),l&&l.c(),i=P()},m(e,n){a[t].m(e,n),R(e,r,n),l&&l.m(e,n),R(e,i,n),o=!0},p(e,t){n.p(e,t),e[36]?l?(l.p(e,t),32&t[1]&&we(l,1)):(l=Tu(e),l.c(),we(l,1),l.m(i.parentNode,i)):l&&(pe(),ye(l,1,1,(()=>{l=null})),ge())},i(e){o||(we(n),we(l),o=!0)},o(e){ye(n),ye(l),o=!1},d(e){a[t].d(e),e&&D(r),l&&l.d(e),e&&D(i)}}}function $u(e){let t,n;return t=new e[48]({props:{filled:!0,style:"opacity: 0.6;",$$slots:{default:[Au]},$$scope:{ctx:e}}}),t.$on("click",(function(){E(e[74](e[1]))&&e[74](e[1]).apply(this,arguments)})),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(n,r){e=n;const i={};67108864&r[6]&&(i.$$scope={dirty:r,ctx:e}),t.$set(i)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Eu(e){let t,n;return t=new d({props:{text:e[64],extended:!0,$$slots:{default:[Su]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};2&n[0]|67108864&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Au(e){let t,n,r;return n=new At({props:{size:"18"}}),{c(){t=O("span"),t.textContent=`${e[83]()}`,Ee(n.$$.fragment),z(t,"margin-right",".75em")},m(e,i){R(e,t,i),Ae(n,e,i),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n,e)}}}function bu(e){let t,n,r;return n=new At({props:{size:"18"}}),{c(){t=O("span"),t.textContent=`${e[83]()}`,Ee(n.$$.fragment),z(t,"margin-right",".75em")},m(e,i){R(e,t,i),Ae(n,e,i),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n,e)}}}function Su(e){let t,n;return t=new e[48]({props:{filled:!0,style:"opacity: 0.6;",$$slots:{default:[bu]},$$scope:{ctx:e}}}),t.$on("click",(function(){E(e[74](e[1]))&&e[74](e[1]).apply(this,arguments)})),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(n,r){e=n;const i={};67108864&r[6]&&(i.$$scope={dirty:r,ctx:e}),t.$set(i)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Tu(e){let t,n;return t=new e[48]({props:{filled:!0,style:"opacity: 0.75;",$$slots:{default:[Nu]},$$scope:{ctx:e}}}),t.$on("click",(function(){E(e[75](e[1]))&&e[75](e[1]).apply(this,arguments)})),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(n,r){e=n;const i={};67108864&r[6]&&(i.$$scope={dirty:r,ctx:e}),t.$set(i)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Nu(e){let t,n,r;return n=new Tt({props:{size:"18"}}),{c(){t=O("span"),t.textContent="Daten",Ee(n.$$.fragment),z(t,"margin-right",".75em")},m(e,i){R(e,t,i),Ae(n,e,i),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n,e)}}}function Ru(e){let t,n,r;return n=new At({props:{size:"18"}}),{c(){t=O("span"),t.textContent="Erstellen",Ee(n.$$.fragment),z(t,"margin-right",".75em")},m(e,i){R(e,t,i),Ae(n,e,i),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n,e)}}}function Du(e){let t,n;return t=new e[48]({props:{filled:!0,style:"opacity: 0.75;",$$slots:{default:[ku]},$$scope:{ctx:e}}}),t.$on("click",e[77]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};67108864&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ku(e){let t,n,r;return n=new Tt({props:{size:"18"}}),{c(){t=O("span"),t.textContent="Daten",Ee(n.$$.fragment),z(t,"margin-right",".75em")},m(e,i){R(e,t,i),Ae(n,e,i),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n,e)}}}function Ou(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function xu(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Mu(e){let t;return{c(){t=M("Ja, bitte löschen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Bu(e){let t,n,r,i,o,s,a,l,c;return s=new e[48]({props:{filled:!0,$$slots:{default:[xu]},$$scope:{ctx:e}}}),s.$on("click",e[109]),l=new e[48]({props:{danger:!0,outline:!0,$$slots:{default:[Mu]},$$scope:{ctx:e}}}),l.$on("click",e[87]),{c(){t=O("p"),t.textContent="Willst du diese Daten löschen?",n=B(),r=O("p"),r.textContent="Das kann nicht rückgängig gemacht werden.",i=B(),o=O("div"),Ee(s.$$.fragment),a=B(),Ee(l.$$.fragment),U(o,"class","flex_div svelte-lfqa43")},m(e,d){R(e,t,d),R(e,n,d),R(e,r,d),R(e,i,d),R(e,o,d),Ae(s,o,null),N(o,a),Ae(l,o,null),c=!0},p(e,t){const n={};67108864&t[6]&&(n.$$scope={dirty:t,ctx:e}),s.$set(n);const r={};67108864&t[6]&&(r.$$scope={dirty:t,ctx:e}),l.$set(r)},i(e){c||(we(s.$$.fragment,e),we(l.$$.fragment,e),c=!0)},o(e){ye(s.$$.fragment,e),ye(l.$$.fragment,e),c=!1},d(e){e&&D(t),e&&D(n),e&&D(r),e&&D(i),e&&D(o),be(s),be(l)}}}function Pu(e){let t,n,r;return n=new xe({props:{size:"25"}}),{c(){t=O("div"),Ee(n.$$.fragment),U(t,"slot","title-icon")},m(e,i){R(e,t,i),Ae(n,t,null),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function Lu(e){let t,n;return t=new e[46]({props:{title:"Bestätigung",closeCallback:e[201],danger:!0,$$slots:{"title-icon":[Pu],default:[Bu]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};32768&n[6]&&(r.closeCallback=e[201]),67108864&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Fu(e){let t,n,r;function i(t){e[112](t)}let o={$$slots:{default:[Yu,({closeCallback:e})=>({201:e}),({closeCallback:e})=>[0,0,0,0,0,0,e?32768:0]]},$$scope:{ctx:e}};return void 0!==e[23]&&(o.open=e[23]),t=new e[45]({props:o}),ee.push((()=>$e(t,"open",i))),{c(){Ee(t.$$.fragment)},m(e,n){Ae(t,e,n),r=!0},p(e,r){const i={};524288e3&r[0]|67141632&r[6]&&(i.$$scope={dirty:r,ctx:e}),!n&&8388608&r[0]&&(n=!0,i.open=e[23],le((()=>n=!1))),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function Vu(e){let t,n,r,i,o,s=e[93](e[22].refItem,!0)+"";return{c(){t=O("tr"),n=O("th"),r=O("div"),i=M(s),o=M(" nicht gefunden!"),z(r,"color","red"),U(n,"colspan","2")},m(e,s){R(e,t,s),N(t,n),N(n,r),N(r,i),N(r,o)},p(e,t){4194304&t[0]&&s!==(s=e[93](e[22].refItem,!0)+"")&&H(i,s)},d(e){e&&D(t)}}}function Uu(e){let t,n,r,i,o,s=e[93](e[22].refItem)+"";return{c(){t=O("tr"),n=O("th"),r=O("div"),i=M(s),o=M(" bereits eingefügt!"),z(r,"color","red"),U(n,"colspan","2")},m(e,s){R(e,t,s),N(t,n),N(n,r),N(r,i),N(r,o)},p(e,t){4194304&t[0]&&s!==(s=e[93](e[22].refItem)+"")&&H(i,s)},d(e){e&&D(t)}}}function Hu(e){let t;let n=function(e){return"number"===e[202].type?zu:Wu}(e),r=n(e);return{c(){r.c(),t=P()},m(e,n){r.m(e,n),R(e,t,n)},p(e,t){r.p(e,t)},d(e){r.d(e),e&&D(t)}}}function Wu(e){let t;return{c(){t=O("input"),U(t,"id","reader_"+e[202].name),U(t,"type","text")},m(e,n){R(e,t,n)},p:_,d(e){e&&D(t)}}}function zu(e){let t;return{c(){t=O("input"),z(t,"width","4em"),U(t,"id","reader_"+e[202].name),U(t,"type","number"),U(t,"min","0")},m(e,n){R(e,t,n)},p:_,d(e){e&&D(t)}}}function qu(e){let t,n,r,i,o,s,a=e[93](e[202].name)+"",l=e[24]&&e[25]&&Hu(e);return{c(){t=O("tr"),n=O("th"),r=M(a),i=B(),o=O("td"),l&&l.c(),s=B()},m(e,a){R(e,t,a),N(t,n),N(n,r),N(t,i),N(t,o),l&&l.m(o,null),N(t,s)},p(e,t){e[24]&&e[25]?l?l.p(e,t):(l=Hu(e),l.c(),l.m(o,null)):l&&(l.d(1),l=null)},d(e){e&&D(t),l&&l.d()}}}function ju(e){let t;return{c(){t=M("Verwerfen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Gu(e){let t;return{c(){t=M("Speichern")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Xu(e){let t,n,r,i,o,s,a,l,c,d,u,h,f,m,p,g,w,y,v,_,I,C,$,E,A,b=e[93](e[22].refItem)+"";function S(t){e[111](t)}let T={keyboard:e[22].keyboard,codeTypes:e[22].codeTypes};function x(e,t){return e[28]?Uu:e[24]&&!e[26]?Vu:void 0}void 0!==e[27]&&(T.readerInit=e[27]),t=new Wc({props:T}),ee.push((()=>$e(t,"readerInit",S))),t.$on("scan",e[91]),t.$on("exit",e[96]);let P=x(e),L=P&&P(e),F=e[92](),V=[];for(let t=0;t<F.length;t+=1)V[t]=qu(Hd(e,F,t));return C=new e[48]({props:{disabled:!e[24],outline:!0,style:"float: left;",$$slots:{default:[ju]},$$scope:{ctx:e}}}),C.$on("click",e[94]),E=new e[48]({props:{disabled:!e[26],filled:!0,style:"float: right;",$$slots:{default:[Gu]},$$scope:{ctx:e}}}),E.$on("click",e[95]),{c(){Ee(t.$$.fragment),r=B(),i=O("div"),o=O("table"),s=O("tr"),a=O("th"),a.textContent="Code",l=B(),c=O("td"),d=M(e[24]),u=B(),h=O("tr"),f=O("th"),m=M(b),p=B(),g=O("td"),w=O("div"),y=M(e[25]),v=B(),L&&L.c(),_=B();for(let e=0;e<V.length;e+=1)V[e].c();I=B(),Ee(C.$$.fragment),$=B(),Ee(E.$$.fragment),z(w,"max-width","14em"),z(o,"margin-top","1em"),z(o,"margin-bottom","1em"),z(o,"text-align","left"),z(i,"position","relative"),z(i,"z-index","1000"),z(i,"background-color","white"),z(i,"height","225px")},m(e,n){Ae(t,e,n),R(e,r,n),R(e,i,n),N(i,o),N(o,s),N(s,a),N(s,l),N(s,c),N(c,d),N(o,u),N(o,h),N(h,f),N(f,m),N(h,p),N(h,g),N(g,w),N(w,y),N(o,v),L&&L.m(o,null),N(o,_);for(let e=0;e<V.length;e+=1)V[e].m(o,null);N(i,I),Ae(C,i,null),N(i,$),Ae(E,i,null),A=!0},p(e,r){const i={};if(4194304&r[0]&&(i.keyboard=e[22].keyboard),4194304&r[0]&&(i.codeTypes=e[22].codeTypes),!n&&134217728&r[0]&&(n=!0,i.readerInit=e[27],le((()=>n=!1))),t.$set(i),(!A||16777216&r[0])&&H(d,e[24]),(!A||4194304&r[0])&&b!==(b=e[93](e[22].refItem)+"")&&H(m,b),(!A||33554432&r[0])&&H(y,e[25]),P===(P=x(e))&&L?L.p(e,r):(L&&L.d(1),L=P&&P(e),L&&(L.c(),L.m(o,_))),50331648&r[0]|1073741824&r[2]|1&r[3]){let t;for(F=e[92](),t=0;t<F.length;t+=1){const n=Hd(e,F,t);V[t]?V[t].p(n,r):(V[t]=qu(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={};16777216&r[0]&&(s.disabled=!e[24]),67108864&r[6]&&(s.$$scope={dirty:r,ctx:e}),C.$set(s);const a={};67108864&r[0]&&(a.disabled=!e[26]),67108864&r[6]&&(a.$$scope={dirty:r,ctx:e}),E.$set(a)},i(e){A||(we(t.$$.fragment,e),we(C.$$.fragment,e),we(E.$$.fragment,e),A=!0)},o(e){ye(t.$$.fragment,e),ye(C.$$.fragment,e),ye(E.$$.fragment,e),A=!1},d(e){be(t,e),e&&D(r),e&&D(i),L&&L.d(),k(V,e),be(C),be(E)}}}function Yu(e){let t,n;return t=new e[46]({props:{title:"Scannen",class:"reader",closeCallback:e[201],$$slots:{default:[Xu]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};32768&n[6]&&(r.closeCallback=e[201]),524288e3&n[0]|67108864&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Zu(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Ku(e){let t,n,r,i,o;return i=new e[48]({props:{filled:!0,$$slots:{default:[Zu]},$$scope:{ctx:e}}}),i.$on("click",e[113]),{c(){t=O("progress"),n=B(),r=O("div"),Ee(i.$$.fragment),z(t,"width","100%"),U(t,"id","file"),U(t,"max","100"),t.value=e[42],U(r,"class","flex_div svelte-lfqa43")},m(e,s){R(e,t,s),R(e,n,s),R(e,r,s),Ae(i,r,null),o=!0},p(e,n){(!o||2048&n[1])&&(t.value=e[42]);const r={};67108864&n[6]&&(r.$$scope={dirty:n,ctx:e}),i.$set(r)},i(e){o||(we(i.$$.fragment,e),o=!0)},o(e){ye(i.$$.fragment,e),o=!1},d(e){e&&D(t),e&&D(n),e&&D(r),be(i)}}}function Qu(e){let t,n,r;return n=new xe({props:{size:"25"}}),{c(){t=O("div"),Ee(n.$$.fragment),U(t,"slot","title-icon")},m(e,i){R(e,t,i),Ae(n,t,null),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function Ju(e){let t,n;return t=new e[46]({props:{title:"Auswertung wird erstellt",closeCallback:e[201],$$slots:{"title-icon":[Qu],default:[Ku]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};32768&n[6]&&(r.closeCallback=e[201]),2048&n[1]|67108864&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function eh(e){let t,n;return{c(){t=O("p"),n=M(e[8])},m(e,r){R(e,t,r),N(t,n)},p(e,t){256&t[0]&&H(n,e[8])},d(e){e&&D(t)}}}function th(e){let t;return{c(){t=M("Schliessen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function nh(e){let t,n,r,i,o;return t=new e[51]({props:{outline:!0,$$slots:{default:[eh]},$$scope:{ctx:e}}}),i=new e[48]({props:{danger:!0,outline:!0,$$slots:{default:[th]},$$scope:{ctx:e}}}),i.$on("click",e[115]),{c(){Ee(t.$$.fragment),n=B(),r=O("div"),Ee(i.$$.fragment),U(r,"class","flex_div svelte-lfqa43")},m(e,s){Ae(t,e,s),R(e,n,s),R(e,r,s),Ae(i,r,null),o=!0},p(e,n){const r={};256&n[0]|67108864&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r);const o={};67108864&n[6]&&(o.$$scope={dirty:n,ctx:e}),i.$set(o)},i(e){o||(we(t.$$.fragment,e),we(i.$$.fragment,e),o=!0)},o(e){ye(t.$$.fragment,e),ye(i.$$.fragment,e),o=!1},d(e){be(t,e),e&&D(n),e&&D(r),be(i)}}}function rh(e){let t,n,r;return n=new xe({props:{size:"25"}}),{c(){t=O("div"),Ee(n.$$.fragment),U(t,"slot","title-icon")},m(e,i){R(e,t,i),Ae(n,t,null),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function ih(e){let t,n;return t=new e[46]({props:{title:"Speichern nicht erfolgreich",danger:!0,$$slots:{"title-icon":[rh],default:[nh]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};384&n[0]|67108864&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function oh(e){let t,n,r,i,o,s,a,l,c,d,u,h,f;Ud.title=t=e[44];let m={ctx:e,current:null,token:null,hasCatch:!1,pending:Ou,then:jd,catch:qd,value:205,blocks:[,,,]};function p(t){e[110](t)}ve(e[66](),m);let g={$$slots:{default:[Lu,({closeCallback:e})=>({201:e}),({closeCallback:e})=>[0,0,0,0,0,0,e?32768:0]]},$$scope:{ctx:e}};void 0!==e[12]&&(g.open=e[12]),i=new e[45]({props:g}),ee.push((()=>$e(i,"open",p)));let w=e[22]&&e[23]&&Fu(e);function y(t){e[114](t)}let v={$$slots:{default:[Ju,({closeCallback:e})=>({201:e}),({closeCallback:e})=>[0,0,0,0,0,0,e?32768:0]]},$$scope:{ctx:e}};function _(t){e[116](t)}void 0!==e[41]&&(v.open=e[41]),l=new e[45]({props:v}),ee.push((()=>$e(l,"open",y)));let I={$$slots:{default:[ih,({closeCallback:e})=>({201:e}),({closeCallback:e})=>[0,0,0,0,0,0,e?32768:0]]},$$scope:{ctx:e}};return void 0!==e[7]&&(I.open=e[7]),u=new e[45]({props:I}),ee.push((()=>$e(u,"open",_))),{c(){n=B(),m.block.c(),r=B(),Ee(i.$$.fragment),s=B(),w&&w.c(),a=B(),Ee(l.$$.fragment),d=B(),Ee(u.$$.fragment)},m(e,t){R(e,n,t),m.block.m(e,m.anchor=t),m.mount=()=>r.parentNode,m.anchor=r,R(e,r,t),Ae(i,e,t),R(e,s,t),w&&w.m(e,t),R(e,a,t),Ae(l,e,t),R(e,d,t),Ae(u,e,t),f=!0},p(n,r){e=n,(!f||8192&r[1])&&t!==(t=e[44])&&(Ud.title=t),_e(m,e,r);const s={};67141632&r[6]&&(s.$$scope={dirty:r,ctx:e}),!o&&4096&r[0]&&(o=!0,s.open=e[12],le((()=>o=!1))),i.$set(s),e[22]&&e[23]?w?(w.p(e,r),12582912&r[0]&&we(w,1)):(w=Fu(e),w.c(),we(w,1),w.m(a.parentNode,a)):w&&(pe(),ye(w,1,1,(()=>{w=null})),ge());const d={};2048&r[1]|67141632&r[6]&&(d.$$scope={dirty:r,ctx:e}),!c&&1024&r[1]&&(c=!0,d.open=e[41],le((()=>c=!1))),l.$set(d);const p={};384&r[0]|67108864&r[6]&&(p.$$scope={dirty:r,ctx:e}),!h&&128&r[0]&&(h=!0,p.open=e[7],le((()=>h=!1))),u.$set(p)},i(e){f||(we(m.block),we(i.$$.fragment,e),we(w),we(l.$$.fragment,e),we(u.$$.fragment,e),f=!0)},o(e){for(let e=0;e<3;e+=1){ye(m.blocks[e])}ye(i.$$.fragment,e),ye(w),ye(l.$$.fragment,e),ye(u.$$.fragment,e),f=!1},d(e){e&&D(n),m.block.d(e),m.token=null,m=null,e&&D(r),be(i,e),e&&D(s),w&&w.d(e),e&&D(a),be(l,e),e&&D(d),be(u,e)}}}let sh=new Map,ah=new Map,lh=new Map;const ch=(e,t)=>sh.set(e,t),dh=e=>sh.get(e),uh=async(e,n)=>{const r="p$"+e+"$"+n,i=sh.get(r);if(i?.length)return i;const o=n;return sh.has(o)||(sh.set(o,[]),sh.set(o,t.getTasksList(n).then((({data:e})=>e)))),sh.get(o)},hh=async(e,n,r,i=!1)=>{let o=ah.get(r);if(!o)if(i)o=t.getTaskList(e,r),ah.set(r,o);else{const i="p$"+e+"$"+n,s=await sh.get(i);if(!s?.length)return uh(e,n).then((n=>(o=n.find((({_id:e})=>e===r)),o||(o=t.getTaskList(e,r)),ah.set(r,o),o)));o=s.find((({_id:e})=>e===r)),o||(o=t.getTaskList(e,r)),ah.set(r,o)}return o},fh=(e,t)=>{lh.set(e,t)},mh=e=>lh.get(e),ph=(e,n,r=!1)=>{let i=!r&&lh.get(n);return i||(i=t.getTask(e,n),lh.set(n,i)),i},gh=(e,n)=>{if(!sh.get(n))return;const r=n;sh.set(r,t.getTasksList(n).then((({data:e})=>e)))};function wh(e){return new Promise((t=>setTimeout(t,e)))}function yh(e,o,l){let d,f,m,p,g,y,_,I;b(e,h,(e=>l(133,g=e))),b(e,a,(e=>l(134,y=e))),b(e,i,(e=>l(135,_=e)));const{Modal:C,Dialog:$,Divider:E,Button:A,FormField:S,Checkbox:N,Chip:R}=c,{loggedIn:D,currentTasks:k,environment:O}=u;b(e,D,(e=>l(136,I=e))),b(e,k,(e=>l(131,m=e))),b(e,O,(e=>l(132,p=e))),JSON.parse(n.getItem("Locale"));const x=K();let{schema:M}=o,{recID:B}=o,{deletable:P}=o,{prevEventID:L=!1}=o,{prev:F=!1}=o,{taskId:V=!1}=o,{taskOrg:U}=o,{description:H=""}=o,{root:W=!1}=o,{readonly:z}=o,{isStandalone:q}=o,{shortEdit:j=!1}=o,{shortSchema:G=!1}=o,X=!1,Q="",J=window.location.href.split("/task/")[2];J&&(J=J.split(":")[1],J&&(J=J.split("?")[0])),j&&(M=G);let ee,te,ne,re,ie,oe,ae={},le={},ce="form-"+M.class+Math.floor(9e3*Math.random()+1e3).toString(),de=!1,ue=!1;const he=W?"fEmbedded":"fTask",fe=W?"sEmbedded":"sTask";let me="CHF";const pe=new Map;let ge,we,ye=0,ve=0,_e=0,Ie=0,Ce=1,$e=!B&&M.list&&1===M.list.length;const Ee={},Ae=M.items.find((e=>"price"===e.name&&!e.properties?.hidden)),be=M.items.find((e=>"quantity"===e.name&&!e.properties?.hidden)),Se=M.items.find((e=>"amount"===e.name&&!e.properties?.hidden)),Te=!!Ae||!!Se,Ne=M.list?.filter((e=>"array"===e.type))?.length>1||M.items?.filter((e=>e.name.startsWith("amount")))||Te,Re=M.items.find((e=>"number"===e.type&&"w"===e.properties?.unit?.constant?.toLowerCase()&&!e.properties?.hidden))?.name,De=!!Re,ke=M.list?.filter((e=>"array"===e.type))?.length>1||De,Oe={},xe=M.result?.resultDef[0].button?.description;let Me,Be,Pe,Le,Fe,Ve,Ue,He,We,ze,qe,je,Ge,Xe="",Ye="",Ze="",Ke=!1,Qe=!1,Je=!1,et=!1,tt=!1,nt=0,rt=0,it=[],ot=[],st=[],at={},lt=new Map,ct=M.class,dt=M.id,ut=!1,ht=!1,ft=-1!==window.location.search.indexOf("next="),mt=0;const pt=-1!==window.location.search.indexOf("back=true");We=He=!m?.length||m.find((e=>e===dt));["readonly","hidden","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(".");it.push({action:e,itemName:t.name,refObj:r,refName:i,op:t.properties[e].invert?"!":""})}))}));M.items.filter((e=>e.selection&&e.constraint)).map((e=>{ot.push({name:e.name,selection:e.selection,constraint:e.constraint})}));M.items.filter((e=>e.lookup)).forEach((e=>{st.push({name:e.name,lookup:e.lookup})})),M.items.filter((e=>e.properties?.lookup)).forEach((e=>{st.push({name:e.name,lookup:e.properties.lookup.split(":").at(-1)})}));const gt=async e=>{if(e?.length)for(const n of e){if(!n.lookup)break;const{name:e}=n;if(ae[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(9,ae[e]=t,ae)}}}},wt=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(9,ae[i]=d,ae)},yt=async e=>{if(!M.input)return;if(!M.input.length)return;if(M.input.length>1)return;const t=Ve.input.class[0],{name:n,selection:r,state:i,list:o}=t;n||r&&i&&o&&await vt(r,i,o)},vt=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(9,ae={...ae,...o})),100)},_t=()=>{for(const e of M.items)"boolean"==typeof e.properties?.value&&l(9,ae[e.name]=e.properties.value,ae),"string"==typeof e.properties?.value&&l(9,ae[e.name]=e.properties.value,ae),e.properties?.value?.concatenation&&Ct(e);It()},It=async()=>{for(const e of M.list||[])for(const n of e.item)if(n.refItem&&"array"!==e.type)if("owner"===n.refItem){const r=p.owner;r||T(O,p.owner=r=(await t.getSolitaire(n.refItem))[0],p),p.owner||(await t.getSolitaire(n.refItem))[0],r&&(ae[e.name]||l(9,ae[e.name]={},ae),l(9,ae[e.name][n.name]=v(r,n.refPos||n.name),ae))}else if(ae[n.refItem]){const r=await t.getTask(n.refItem,ae[n.refItem]);r&&(ae[e.name]||l(9,ae[e.name]={},ae),l(9,ae[e.name][n.name]=v(r,n.refPos||n.name),ae))}},Ct=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 Et(e.refItemNext));l(9,ae[e.name]=n,ae)},$t=async e=>{const t=it.filter((t=>t.refObj===e||t.itemName===e));if(t?.length){l(31,at={});for(const e of t){const{itemName:t,refObj:n,refName:r,op:i}=e;let{action:o}=e;if(!n)break;let s,a,c=!r&&ae[n];const d=ae[n];d&&r&&(c=(await ph(n,d))[r]),Array.isArray(c)&&0===c.length&&(c=!1),"!"===i&&(c=!c),"required"!==o&&"readonly"!==o||(o="required"===o?o:"disabled",setTimeout((()=>{s=`#${ce} .form-field.${t} .field #${t}`,a=document.querySelector(s),a&&c&&a.setAttribute(o,""),a&&!c&&a.removeAttribute(o)}),0)),"hidden"===o&&(s=`#${ce} .form-field.${t}`,a=document.querySelector(s),a?.classList?.toggle("hidden",!!c),c&&l(31,at[t]="",at))}}},Et=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")},At=(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||ae[i]&&!a&&(a=ae[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 ur(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&&ae[i]){a=ae[i];try{return ur(a,"%d.%m.%Y").toISOString()}catch{return a}}return a},bt=async e=>{B||l(43,d=!0);const n=e.submitter?.className?.includes("close"),r={_docAsync:e?._docAsync};Array.from(document.querySelectorAll("form#"+ce+" ."+ce)).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]=At(i.item,e)}}else r[e.name]=At(M.items,e);else if(e.id){"signature"===M.items.find((t=>t.name===e.id)).type&&(e.name=e.id,r[e.name]=At(M.items,e))}}));let i=!1;if(M.list&&M.list.map((e=>{if(e.mandatory){const t=le[e.name]?.filter((e=>!e._delete)).length;if(!t||t<2)return void(i=!0)}"array"===e.type&&le[e.name]&&(e.item.forEach((t=>{for(const n of le[e.name])void 0===n[t.name]&&(n[t.name]="boolean"!==t.type&&"")})),r[e.name]=le[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]=At(e.item,{name:n,value:r,checked:r},"",!0)),t)),{}))),[]))})),i)return s.failed("Bitte Positionen erfassen",3e3),void l(43,d=!1);if(r._event=dt,r._prevEventId=L,r._taskId=V,re){const e=re.record;for(const t in e)t.includes(".")&&delete e[t];e._event=re.event,e._taskId=re.taskId;const{id:n}=await t.saveData(re.class,e);r[re.class]||(r[re.class]=n)}if(j)return St(M.class,r),Nt();const{id:o,task:a,tax:c,error:u,state:h,info:f}=await t.saveData(M.class,r);if(u?.text){const e=u.field?" in "+u.field+": "+u.value:"";if(l(8,Q=`${u.text} ${e}`),l(7,X=!0),!h)return void l(43,d=!1)}if(je){const e=new FormData;e.append("title",je.fileName),e.append("file",je.file),await t.uploadUserReport(a,e)}f&&!Array.isArray(f)&&f.accepted?f.accepted?.length?s.success(`Email versandt an ${f.accepted.join(", ")}, Dateigrösse: ${f.messageSize} Bytes.`,5e3):(l(8,Q="Email konnte nicht versandt werden!"),l(7,X=!0)):s.success("Die Daten wurden gespeichert.",2e3),l(17,ve=c?._amount||0),l(18,_e=100*(c?._rate||0)||""),xt(),r._id=o;const m=await t.getTaskList(M.class,o);if(x("choose",{row:m}),n)return Nt();if(!B){if(ft){const e=Math.floor(9e3*Math.random()+1e3).toString();return window.singleSpaNavigate(`/task/${dt}/${dt}/task?next=${e}`)}return window.singleSpaNavigate(`/task/${dt}/${a}/task`)}},St=async(e,n)=>{if(!j.lookup)return;const r={};for(const e in n){const t=n[e];Array.isArray(t)||j.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[j.ref];for(let s=0;s<i.length;s++){o=!0;const a=i[s];for(const e in a)if(j.lookup.includes(e)&&a[e]!=n[j.ref][0][e]){o=!1;break}if(o)return i[s]=n[j.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[j.ref].push(n[j.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)},Tt=()=>j||ne||q||!L?Nt():window.history.back(),Nt=()=>pt?x("back"):q?window.close():W?window.singleSpaNavigate("/"):x("back"),Rt=async({detail:e})=>{if(Array.isArray(e.value)&&pe.set(e.name,e.value),!(M.input?.length&&M.input.length>1))return;if(ee?.class!==M.input[0]&&!J)return;let n,{value:r,lookup:i,name:o,view:s}=e;if(!i&&!J)return;if(i&&(n=i.split(":")[0]),s||(n=o,s="_id"),J){if(n=M.input[1],!pe?.size||!pe.get(e.name)?.length)return void l(9,ae[n]=[],ae);s=o,r=[J]}const a=await t.getSectionView(n,{[s]:{$in:r}}),c=a.map((e=>e._id));for(const e of M.input.slice(1)){l(9,ae[e]=[],ae);const r=await t.getSchemaByClass(e);r.id;let i=await t.getTasks(r.id);if(i=i.data.filter((e=>"Ready"===e._task?.status&&(c.includes(e[n])||c.includes(e._id)))),i?.length){const{filter:r}=Ve.input.class.find((t=>t.name===e)),{refItem:o,value:s}=r||{},c=[];if(i.forEach((e=>{if(r){const t=a.find((t=>t._id===e[n]));t&&t[o]===s&&c.push(e._id)}else c.push(e._id)})),c.length){const n=await t.getSectionView(e,{_id:{$in:c}});for(const t of n)t[e]=t._id;l(9,ae[e]=n,ae)}}}},Dt=async(e,n,r)=>{if(1===Ve.input?.class?.length){const t=Ve.input.class[0],{name:r,selection:i,state:o,list:s,exclude:a}=t;e===r&&i&&o&&s&&await kt(e,n,i,o,s,a)}if(M.input&&M.input.length>1&&!J){if(M.input[0]!==e)return;const{name:i,source:o,destination:s,selection:a}=Ve.input.class[1];if(o&&s){const t=await ph(e,n);if(!t)return void l(9,ae[s]=[],ae);const r=await ph(a,t[a]);if(!r)return;const i=r[o]||[];return void l(9,ae[s]=i,ae)}const{recursive:c}=Ve.input.class[1];if(n){let i=await t.getTaskOptions(`${e}:${n}`,dt,c);if(r){const e=s.split(".")[1],t=[];i[e].forEach((n=>{ae[e]?.find((t=>t[e]===n[e]))||t.push(n)})),i={[e]:ae[e]?[...ae[e],...t]:[...t]}}l(9,ae={...ae,...i})}else{const e=M.input.slice(1);for(const t of e)l(9,ae[t]=[],ae)}}for(const e of Ve.output.class[0].item)"date"===e.type&&e.properties?.value?.formula?Wt(e.name):void 0!==e.factor&&l(9,ae[e.name]=ae[e.name]*e.factor,ae);if((async()=>{const e=M.items.find((e=>"textarea"===e.properties?.format&&e.properties?.source));if(e&&!ae[e.name]){const t=new Set;let n="";for(const r of e.properties.source){const[e,i,o]=r.split("."),s=ae[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 ph(a.refClass,s);e&&e[o]&&(n+=e[o])}}if(n)break}if(n)break}n&&l(9,ae[e.name]=n,ae)}})(),M.list?.length){let e=He;for(const t of M.list)"array"===t.type&&t.mandatory&&ae[t.name]&&!ae[t.name].length&&(e=!1);l(38,We=e)}},kt=async(e,t,n,r,i,o)=>{n=[].concat(n);for(const s of n)await Ot(e,t,s,r,i,o)},Ot=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&&Ve.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 h=await t.getSectionView(c,l);for(const e of h)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(9,ae={...ae,...u})),100)},xt=()=>{let e=0;if(Ae){let t=1;be&&(t=Ce),e=Ie*t}Se&&(e=Ie);let t=0;for(const e in Ee)t+=Ee[e];let n=0;for(const e of M.items)e.name.startsWith("amount")&&(n+=+ae[e.name]);l(16,ye=t+e),ae.discount>0&&l(16,ye-=ye*ae.discount*.01),l(16,ye+=n)},Mt=()=>{let e=0;for(const t in Oe)e+=Oe[t];l(30,nt=e+ +rt)},Bt=({detail:e})=>{le[e.listName]=e.value,Ne&&(Ee[e.listName]=e.amountValue,xt()),ke&&(Oe[e.listName]=e.weeksValue||0,Mt()),e.addToRecord&&l(11,ie=e)};r.subscribe((async e=>{if(!e)return;if(!B)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(!sh.get(e))return;const r=t;ah.set(r,n)})(i.event,i.docId,i.data);const o=await t.getTask(n.class,i.docId),s=ae[n.class].filter((e=>e[n.class]==o._id));s?.length&&s.map((e=>{e[n.class]=i.docId})),l(9,ae),l(104,te),l(103,ee),l(0,M)})),Y((async()=>{if(sh=new Map,ah=new Map,lh=new Map,await Lt(),!j)return;const e={...ae};let n=e[j.ref][0];for(const e in n)n[e]||(n[e]=j.value[e]);const r={};for(const t in e){const i=e[t];if(Array.isArray(i))for(const e in n){const t=n[e];j.lookup.includes(e)&&(r[j.ref+"."+e]=t)}else j.lookup.includes(t)&&(r[t]=i)}if(j.lookup.includes("date")){const e=new Date,t=new Date(e.getFullYear(),e.getMonth(),e.getDate()).toISOString();r.date=t}const i=await t.getSectionView(M.class,r);let o=!1;for(const e of i){if((await t.getTaskByDocId(e._id,!0)).status.startsWith("WaitingForApproval")){if(o)break;for(const t of e[j.ref]){let e=!0;for(const r in t)if(j.lookup.includes(r)&&t[r]!=n[r]){e=!1;break}if(e){for(const e in t)j.lookup.includes(e)||(n[e]=t[e]);o=!0;break}}}}l(9,ae[j.ref][0]=n,ae);const s=(j.focus||j.fill.at(-1))+"-0",a=document.getElementById(s);a&&a.focus()}));const Pt=async()=>{Me&&(Be||(Be=await t.getEvent(dt)),l(37,ft=!0),Me.autostart&&Yt())},Lt=async()=>{const e=e=>new Promise((t=>setTimeout(t,e)));let t,n=0;for(;!(t=document.getElementById(ce)&&!et&&!tt)&&++n<20;)await e(50);t||(t=document.getElementById(ce)),t&&(()=>{if(B)return;const e=new Set;for(const t of it)e.add(t.refObj||ct);Array.from(e).forEach((e=>$t(e)))})(),Ft()},Ft=()=>{setTimeout((()=>{Array.from(lt).forEach((([e,t])=>{ae[e]||l(9,ae[e]=t._id,ae)}))}),350)};Z((()=>{B&&T(h,g={[B]:{record:ae,lists:le}},g)}));const Vt=()=>{const e={};Array.from(document.querySelectorAll("form#"+ce+" ."+ce)).map((t=>{if(t.name)if(t.name.includes(".")){const[n,r]=t.name.split("."),i=M.list.find((e=>e.name===n));e[t.name]=At(i.item,t)}else e[t.name]=At(M.items,t,t.name.split("_")[0])})),M.list&&M.list.map((t=>{"array"===t.type&&le[t.name]&&(e[t.name]=le[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]=At(t.item,{name:n,value:r,checked:r},"",!0)),e)),{}))),[]))}));let t=!0;return 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)})),t&&e},Ut=async e=>{let n;for(l(42,mt=0),Gt();!n&&Ge;){l(42,mt++,mt);const r=await t.progressReport(e);if(n=r?.progressValue,mt>300)break;await wh(1e3)}if(Xt(),n){const t="/api/report/list/"+e;window.open(t,"_self","width=1 height=1")}},Ht=(e,t)=>("number"==typeof e&&e||(e=Number(e||0)),e.toFixed(t||0)),Wt=async e=>{if(!e)return;const t=M.items.find((t=>t.name===e)),n=t.properties.value.formula,{operator:r,argument:i}=n,o=i.map((e=>ae[e.refItem]));let s=0;if("$add"===r){if("date"===t.type)return void l(9,ae[e]=await zt(r,i),ae);s=o.reduce(((e,t)=>+(e||0)+ +(t||0)))}if("$subtract"===r&&(s=o.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&&(s=o.reduce(((e,t)=>+(e||0)*+(t||0)))),"$percentMultiply"===r){const[e,t]=o;if(!+e)return;s=+e,+t>0&&(s*=1-t/100)}if("$percentDivide"===r){const[e,t]=o;if(!+e||!+t)return;s=+e/+t*100}l(9,ae[e]="$multiply"===r?s?Ht(s,t.properties?.decimals):"":Ht(s,t.properties?.decimals),ae)},zt=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=qt(ae[r])||Date.now();let l=s?0:i;if(o){if("owner"===o)p.owner||T(O,p.owner=await t.getSectionView("owner",{}),p),l=v(p.owner,s);else if(ae[o]){const e=await ph(o,ae[o]);e&&(l=v(e,s))}}else l=l||ae[s];return c=l||0,(d=new Date(a)).setDate(d.getDate()+Number(c)),d;var c,d},qt=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()},jt=()=>{l(12,de=!1)},Gt=()=>{l(41,Ge=!0)},Xt=()=>{l(41,Ge=!1)},Yt=()=>{l(28,Qe=!1),l(25,Ye=""),l(24,Xe=""),l(26,Ze=""),l(23,Pe=!0)},Zt=()=>{l(24,Xe=""),l(25,Ye=""),l(26,Ze=""),l(28,Qe=!1),l(27,Ke=!0),Kt()},Kt=()=>{if(!Me.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,B=e.recID),"deletable"in e&&l(3,P=e.deletable),"prevEventID"in e&&l(99,L=e.prevEventID),"prev"in e&&l(4,F=e.prev),"taskId"in e&&l(1,V=e.taskId),"taskOrg"in e&&l(100,U=e.taskOrg),"description"in e&&l(97,H=e.description),"root"in e&&l(5,W=e.root),"readonly"in e&&l(98,z=e.readonly),"isStandalone"in e&&l(101,q=e.isStandalone),"shortEdit"in e&&l(6,j=e.shortEdit),"shortSchema"in e&&l(102,G=e.shortSchema)},e.$$.update=()=>{32&e.$$.dirty[3]&&l(43,d=z),1&e.$$.dirty[0]|3072&e.$$.dirty[3]&&te&&ee&&(M.items.map((({name:e,type:t,refItem:n,properties:r})=>{if(!1===n)return;const i=ee.items.find((t=>t.name===e));if(!i)return;if(t!==i.type)return;const o="_"+e;te[e]?l(9,ae[e]=te[e],ae):n&&n.startsWith("owner")||r&&r.readonly||l(9,ae[e]="",ae),te[o]&&l(9,ae[o]=te[o],ae),l(21,$e=!1)})),(()=>{for(const e of M.list||[]){const t=[],n=ae[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||ae[t.refItem])n[t.name]=ae[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(9,ae[e.name]=t,ae)}}})()),32&e.$$.dirty[0]|16&e.$$.dirty[3]&&l(44,f=W?H||"enablerr - Form":document.title)},[M,V,B,P,F,W,j,X,Q,ae,ne,ie,de,ue,oe,me,ye,ve,_e,ge,we,$e,Me,Pe,Xe,Ye,Ze,Ke,Qe,et,nt,at,Le,Fe,ut,ht,Ue,ft,We,ze,qe,Ge,mt,d,f,C,$,E,A,S,N,R,D,k,O,ce,he,fe,{name:"amountValue",properties:{decimals:2}},{name:"taxValue",properties:{decimals:2}},pe,Ne,ke,{name:"weekValue",properties:{decimals:1}},xe,dt,async()=>{if(l(33,Fe=[]),p.owner||T(O,p.owner=await t.getSectionView("owner",{}),p),p.currency?l(15,me=p.currency.designation):t.getSectionView("owner",{}).then((e=>{e?.length&&e[0].currency&&ph("currency",e[0].currency).then((e=>{e&&l(15,me=e.designation)})).catch((e=>console.log("currency not found")))})),ae.currency&&ph("currency",ae.currency).then((e=>{e&&l(15,me=e.designation)})).catch((e=>console.log("currency not found"))),Ve=await t.getEvent(dt),j&&l(9,ae[j.ref]=[{...j.value}],ae),!B){if(l(32,Le=Fe),gt(Ve.input?.class).then((()=>{tt=!0})),_t(),wt(Ve),yt(),J){const e=Ve.input.class[0].selection;ae[e]||(l(9,ae[e]=[J],ae),Rt({detail:{value:[J],name:e}}))}await(async()=>{if(!d&&(Be||(Be=await t.getEvent(dt)),l(22,Me=Be.output.class[0].reader),Me&&!Me.keyboard))try{const e=await getCameras();e?.length||l(22,Me=!1)}catch{}})(),Pt()}if(B){if(g&&g[B]){const e=g[B],t=e.record;M.items.map((e=>{t[e.name]=At(M.items,{name:e.name,value:t[e.name],checked:t[e.name]})})),l(9,ae=t),M.list&&M.list.map((t=>{"array"===t.type&&e.lists[t.name]&&l(9,ae[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]=At(t.item,{name:n,value:r,checked:r},"",!0)),e)),{}))),[]),ae)}))}else l(9,ae=await t.getTask(M.class,B));if(l(97,H=w(M,ae)),l(35,ht=!!M.result?.resultDef),l(34,ut=!!M.result?.resultDef&&!M.result.resultDef[0].createAfterSave),l(17,ve=ae._tax?._amount),l(18,_e=100*ae._tax?._rate||""),l(40,qe=M.list?.find((e=>e.mandatory))&&Ve.input?.class?.length>1),qe){(U||await t.getTaskByDocId(B,!0)).visum&&l(40,qe=!1)}l(11,ie={itemName:M.class,value:B})}if(L){l(98,z=!1),l(103,ee=await t.getSchema(L)),"string"==typeof F&&l(104,te=await t.getTask(ee.class,F));const e=M.items.find((e=>e.refClass===ee.class));e&&l(9,ae[e.name]=te._id,ae)}if(ke&&(rt=ae[Re]||0),Ve.trigger?.startOn&&!Ve.trigger.startOn.some((e=>e.type.indexOf("Manual")>=0))&&l(98,z=!0),y.role?.length&&M.authorization?.length){const e=M.authorization.some((e=>_?.find((t=>t===e.role&&"edit"===e.activity))));l(98,z||=!e)}if(l(10,ne="report"===Ve.output.type),l(39,ze=Ve.output.saveButton),p.userSetting){const e=p.userSetting;if(l(36,Ue=e.isAdmin),!Ue){const e=I.tenants.find((e=>e._id===I.tenant));e&&l(36,Ue=e.admin?.find((e=>e===I.user)))}}else t.getUserSettings().then((e=>{if(l(36,Ue=e.isAdmin),!Ue){const e=I.tenants.find((e=>e._id===I.tenant));e&&l(36,Ue=e.admin?.find((e=>e===I.user)))}}));return l(29,et=!0),!0},bt,Tt,async({detail:e})=>{const{row:n}=e;let{eventId:r}=e;if((()=>{if(B)for(const e of it)e.refName||$t(e.itemName)})(),await(async(e,t)=>{if(!e&&!t?._id)return;let n,r=!1;const i={...ae};for(const o of M.items){if("string"==typeof o.refItem&&(!e||o.properties?.linkOnly)){const[e,s]=o.refItem.split(".");if("owner"===e)o.refItem.split(".").length<3&&(i[o.name]=p.owner[s||o.refClass],r=!0);else if(o.refInput?.includes("|")&&ae[e]){const[t,s]=o.refInput.split("|");n=await ph(e,ae[e]),i[o.name]=n[t]||n[s]||"",r=!0}else if(ae[e]){if((t._id===ae[e]||o.refItemAlt)&&(n=await ph(e,ae[e]),n)){let e;24===n[s]?.toString().length?(n=await ph(s,n[s]),n&&(e=n[o.name||o.refInput])):s?(e=n[s][o.name]||n[s],"object"==typeof e&&(e=void 0)):e=n[o.name],void 0!==e&&(i[o.name]=e,r=!0)}}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((ae[e]||t[e])&&(n=await ph(e,ae[e]||t[e]),n)){let e;24===n[s]?.toString().length?(n=await ph(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&&ae[t.refItem]){n=await ph(refItem,ae[t.refItem]);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}r&&l(9,ae=i)})(!!B,n),B)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=st.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 ph(t,n);e&&e[r]?.length&&(i=e[r][0][r])}i&&l(9,ae[r]=i,ae)}})(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(9,ae[e.name]="",ae)}))),!n._task)return;const i=n._task.event,o=await t.getEvent(i);for(const e of Ve.output.class[0].item)"date"===e.type&&e.properties?.value?.formula&&Wt(e.name);if(!Ve.output?.class?.length)return;const s=Ve.output.class[0]?.item.find((e=>(e.refClass||e.name)===o.output.class[0]?.name));(Ve.input?.class?.length&&Ve.input.class[0].name===o.output.class[0]?.name||s?.asInput)&&(l(103,ee=await t.getSchema(i)),l(99,L=i),l(1,V=n._task._id),V&&n._task.docId?l(104,te=await t.getTask(ee.class,n._task.docId)):l(104,te={}),await Dt(ee.class,n?._task?.docId||n?._task?._id))},async({detail:e})=>{if(!j&&(l(11,ie=e),"quantity"===e.itemName&&l(20,we=ae.quantity),"currency"===e.itemName&&e.value&&ph("currency",e.value).then((e=>{e&&l(15,me=e.designation)})).catch((e=>console.log("currency not found"))),(async(e,t)=>{const n=ot.filter((t=>t.selection===e||t.constraint===e));if(n?.length){l(19,ge=!1);for(const r of n){const{selection:n,constraint:i,name:o}=r;if(t)break;l(9,ae[o]="",ae),e===n&&l(19,ge=i);const s=ae[n];if(s&&e===i){let e=await ph(n,s);const t=ae[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(9,ae[o]=r,ae)}}}}})(e.itemName,e.oldValue===e.value),It(),$t(e.itemName),ke&&Re&&(e.itemName===Re&&(rt=+e.value),Mt()),Te&&Ne)){if(e.itemName===Ae?.name)Ie=e.value;else if(e.itemName===be?.name)Ce=e.value;else{if(e.itemName!==Se?.name)return;Ie=e.value}xt()}},Rt,Bt,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 s.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 a="/viewer/doc/index.html?file="+o+"&type="+i;window.open(a,"","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 se(),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=Vt();if(!e)return;const n=Ve.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(dt,e);await Ut(r),Nt()},async()=>{const e=Vt();if(!e)return;const n=await t.getReportData(dt,e),r=window.screen.height,i=window.open("","_blank","width=800,height="+r+",location=no");await se(),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(ct!==r)return;if(!e)return;if(lt.has(e))return;if(!0!==r&&(r=(r=[].concat(r)).some((e=>e===ct))),!r)return;const i={[n]:!0},o=await t.getSectionView(e,i);o?.length&&lt.set(e,o[0])},({detail:e})=>{re=e},({detail:e})=>{e.target&&M.list?.length?l(14,oe={ref:e.target,val:e.value}):e.itemName.startsWith("$")?je=e.value:setTimeout((()=>{l(9,ae[e.itemName]=e.value,ae)}),200)},({detail:e})=>{l(13,ue=!1);for(const t of e.items)l(9,ae[e.listName][t.name]=t.value,ae);l(13,ue=!0)},({detail:e})=>{Wt(e.item.name)},()=>M.result.resultDef[0].button?.designation||"Dokument erstellen",()=>{l(12,de=!0)},jt,Xt,async()=>{if(ct&&B){(await t.deleteData(ct,B)).taskId?(s.success("Die Daten wurden gelöscht.",3e3),Tt()):s.failed("Die Daten können nicht gelöscht werden!",3e3)}jt()},async()=>{if(!qe)return;const e=Ve.input.class[0].name,t=Ve.input.class[1].destination.split(".")[1];if(!e)return;if(!t)return;if(!ae[e])return;const n=ae[t]?.length||0;await Dt(e,ae[e],!0),n<ae[t].length?(Bt({detail:{listName:t,value:ae[t]}}),bt({})):s.failed("Keine Positionen gefunden!",3e3)},()=>{B&&bt({_docAsync:!0})},Yt,async({detail:e})=>{if(l(28,Qe=!1),l(25,Ye=""),l(24,Xe=e.text||""),!Xe)return;const n=Is(Xe);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(9,ae[e]=n[0]._id,ae)}}else{n[e][i]&&(r[i]=n[e][i]);const o=await t.getSectionView(e,r);o?.length&&l(9,ae[e]=o[0]._id,ae)}}else n[e]&&l(9,ae[e]=n[e],ae)}l(23,Pe=!1)},()=>M.items.filter((e=>e.properties?.reader)),(e,t=!1)=>t?(Zt(),""):M.items.find((t=>t.name===e))?.designation||"",Zt,()=>{const{refItem:e}=Me,t={[e]:Ze};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]===Ze));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]}})})),Je=!0,Zt()},()=>{Je&&(Je=!1,bt({}))},H,z,L,U,q,G,ee,te,function(e){ye=e,l(16,ye)},function(e){ve=e,l(17,ve)},function(e){nt=e,l(30,nt)},function(e){ft=e,l(37,ft)},()=>jt(),function(e){de=e,l(12,de)},function(e){Ke=e,l(27,Ke)},function(e){Pe=e,l(23,Pe)},()=>Xt(),function(e){Ge=e,l(41,Ge)},()=>{l(7,X=!1)},function(e){X=e,l(7,X)}]}class vh extends Te{constructor(e){var t;super(),Ud.getElementById("svelte-lfqa43-style")||((t=O("style")).id="svelte-lfqa43-style",t.textContent="form.disabled.svelte-lfqa43 input.svelte-lfqa43{background-color:red !important}input:placeholder-shown{font-style:italic}form.svelte-lfqa43.svelte-lfqa43{min-width:25em}hr[data-text]{margin-bottom:1em !important}@media only screen and (min-width: 600px){form.svelte-lfqa43.svelte-lfqa43{min-width:30em}}.fEmbedded.svelte-lfqa43.svelte-lfqa43,.fTask.svelte-lfqa43.svelte-lfqa43{overflow-y:auto;padding-right:1em;overflow-x:hidden}.fEmbedded.svelte-lfqa43.svelte-lfqa43{height:fit-content;min-height:30vh;max-height:60vh}.fTask.svelte-lfqa43.svelte-lfqa43{height:fit-content;max-height:70vh}.sTask.svelte-lfqa43.svelte-lfqa43{height:95%;display:inline-grid}.sTask.svelte-lfqa43 .btn.svelte-lfqa43{display:initial !important}.form--buttons.svelte-lfqa43.svelte-lfqa43{display:flex;gap:1em;padding-top:0.75em}.flex_div.svelte-lfqa43.svelte-lfqa43{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}",N(Ud.head,t)),Se(this,e,yh,oh,A,{schema:0,recID:2,deletable:3,prevEventID:99,prev:4,taskId:1,taskOrg:100,description:97,root:5,readonly:98,isStandalone:101,shortEdit:6,shortSchema:102},[-1,-1,-1,-1,-1,-1,-1])}}function _h(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 vh({props:o}),ee.push((()=>$e(t,"description",i))),t.$on("back",e[2]),{c(){Ee(t.$$.fragment)},m(e,n){Ae(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],le((()=>n=!1))),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function Ih(e){let t,n;return t=new l({props:{update:e[1],description:e[0],$$slots:{default:[_h,({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(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Ch(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 $h=tc((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 Eh=ec($h)({component:class extends Te{constructor(e){super(),Se(this,e,Ch,Ih,A,{refresh:3})}},domElementGetter:()=>document.getElementById("detail-app")}),{bootstrap:Ah,mount:bh,unmount:Sh}=Eh;e({bootstrap:Ah,mount:bh,unmount:Sh});e("Form",vh),e("List",Zt),e("Template",class extends Te{constructor(e){var t;super(),fr.getElementById("svelte-1phofh5-style")||((t=O("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}",N(fr.head,t)),Se(this,e,Sr,Ar,A,{schema:0,record:1})}})}}}));
5
+ */class Ra{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}}class Da{static fromPoints(e,t){const n=this.calculateControlPoints(e[0],e[1],e[2]).c2,r=this.calculateControlPoints(e[1],e[2],e[3]).c1;return new Da(e[1],n,r,e[2],t.start,t.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),h=Math.sqrt(o*o+s*s),f=u+h==0?0:h/(u+h),m=c+(a-c)*f,p=d+(l-d)*f,g=t.x-m,w=t.y-p;return{c1:new Ra(a+g,l+w),c2:new Ra(c+g,d+w)}}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}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}}class ka{constructor(){try{this._et=new EventTarget}catch(e){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)}}class Oa extends ka{constructor(e,t={}){var n,r,i;super(),this.canvas=e,this._drawingStroke=!1,this._isEmpty=!0,this._lastPoints=[],this._data=[],this._lastVelocity=0,this._lastWidth=0,this._handleMouseDown=e=>{this._isLeftButtonPressed(e,!0)&&!this._drawingStroke&&this._strokeBegin(this._pointerEventToSignatureEvent(e))},this._handleMouseMove=e=>{this._isLeftButtonPressed(e,!0)&&this._drawingStroke?this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e)):this._strokeEnd(this._pointerEventToSignatureEvent(e),!1)},this._handleMouseUp=e=>{this._isLeftButtonPressed(e)||this._strokeEnd(this._pointerEventToSignatureEvent(e))},this._handleTouchStart=e=>{1!==e.targetTouches.length||this._drawingStroke||(e.cancelable&&e.preventDefault(),this._strokeBegin(this._touchEventToSignatureEvent(e)))},this._handleTouchMove=e=>{1===e.targetTouches.length&&(e.cancelable&&e.preventDefault(),this._drawingStroke?this._strokeMoveUpdate(this._touchEventToSignatureEvent(e)):this._strokeEnd(this._touchEventToSignatureEvent(e),!1))},this._handleTouchEnd=e=>{0===e.targetTouches.length&&(e.cancelable&&e.preventDefault(),this.canvas.removeEventListener("touchmove",this._handleTouchMove),this._strokeEnd(this._touchEventToSignatureEvent(e)))},this._handlePointerDown=e=>{e.isPrimary&&this._isLeftButtonPressed(e)&&!this._drawingStroke&&(e.preventDefault(),this._strokeBegin(this._pointerEventToSignatureEvent(e)))},this._handlePointerMove=e=>{e.isPrimary&&(this._isLeftButtonPressed(e,!0)&&this._drawingStroke?(e.preventDefault(),this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e))):this._strokeEnd(this._pointerEventToSignatureEvent(e),!1))},this._handlePointerUp=e=>{e.isPrimary&&!this._isLeftButtonPressed(e)&&(e.preventDefault(),this._strokeEnd(this._pointerEventToSignatureEvent(e)))},this.velocityFilterWeight=t.velocityFilterWeight||.7,this.minWidth=t.minWidth||.5,this.maxWidth=t.maxWidth||2.5,this.throttle=null!==(n=t.throttle)&&void 0!==n?n:16,this.minDistance=null!==(r=t.minDistance)&&void 0!==r?r:5,this.dotSize=t.dotSize||0,this.penColor=t.penColor||"black",this.backgroundColor=t.backgroundColor||"rgba(0,0,0,0)",this.compositeOperation=t.compositeOperation||"source-over",this.canvasContextOptions=null!==(i=t.canvasContextOptions)&&void 0!==i?i:{},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}}(Oa.prototype._strokeUpdate,this.throttle):Oa.prototype._strokeUpdate,this._ctx=e.getContext("2d",this.canvasContextOptions),this.clear(),this.on()}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}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}))}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";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.removeEventListener("pointerdown",this._handlePointerDown),this.canvas.removeEventListener("mousedown",this._handleMouseDown),this.canvas.removeEventListener("touchstart",this._handleTouchStart),this._removeMoveUpEventListeners()}_getListenerFunctions(){var e;const t=window.document===this.canvas.ownerDocument?window:null!==(e=this.canvas.ownerDocument.defaultView)&&void 0!==e?e:this.canvas.ownerDocument;return{addEventListener:t.addEventListener.bind(t),removeEventListener:t.removeEventListener.bind(t)}}_removeMoveUpEventListeners(){const{removeEventListener:e}=this._getListenerFunctions();e("pointermove",this._handlePointerMove),e("pointerup",this._handlePointerUp),e("mousemove",this._handleMouseMove),e("mouseup",this._handleMouseUp),e("touchmove",this._handleTouchMove),e("touchend",this._handleTouchEnd)}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}}_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),t("mouseup",this._handleMouseUp);break;case"touchstart":t("touchmove",this._handleTouchMove),t("touchend",this._handleTouchEnd);break;case"pointerdown":t("pointermove",this._handlePointerMove),t("pointerup",this._handlePointerUp)}this._drawingStroke=!0;const n=this._getPointGroupOptions(),r=Object.assign(Object.assign({},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.dispatchEvent(new CustomEvent("endStroke",{detail:e})))}_handlePointerEvents(){this._drawingStroke=!1,this.canvas.addEventListener("pointerdown",this._handlePointerDown)}_handleMouseEvents(){this._drawingStroke=!1,this.canvas.addEventListener("mousedown",this._handleMouseDown)}_handleTouchEvents(){this.canvas.addEventListener("touchstart",this._handleTouchStart)}_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 Ra(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=Da.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 h=d*e.startPoint.y;h+=3*c*o*e.control1.y,h+=3*l*s*e.control2.y,h+=a*e.endPoint.y;const f=Math.min(e.startWidth+a*r,t.maxWidth);this._drawCurveSegment(u,h,f)}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 Ra(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}={}){const t=this._data,n=Math.max(window.devicePixelRatio||1,1),r=this.canvas.width/n,i=this.canvas.height/n,o=document.createElementNS("http://www.w3.org/2000/svg","svg");if(o.setAttribute("xmlns","http://www.w3.org/2000/svg"),o.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),o.setAttribute("viewBox",`0 0 ${r} ${i}`),o.setAttribute("width",r.toString()),o.setAttribute("height",i.toString()),e&&this.backgroundColor){const e=document.createElement("rect");e.setAttribute("width","100%"),e.setAttribute("height","100%"),e.setAttribute("fill",this.backgroundColor),o.appendChild(e)}return this._fromData(t,((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"),o.appendChild(n)}}),((e,{penColor:t,dotSize:n,minWidth:r,maxWidth:i})=>{const s=document.createElement("circle"),a=n>0?n:(r+i)/2;s.setAttribute("r",a.toString()),s.setAttribute("cx",e.x.toString()),s.setAttribute("cy",e.y.toString()),s.setAttribute("fill",t),o.appendChild(s)})),o.outerHTML}}const{document:xa}=Ie;function Ma(e){let t,n,r,i,o;return n=new tt({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather2 pointer svelte-efkzkz")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[5]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function Ba(e){let t,n,r,i,o,s,a=!e[0]&&Ma(e);return{c(){t=O("div"),n=O("canvas"),i=B(),a&&a.c(),U(n,"id",e[1]),U(n,"name",e[1]),U(n,"class",r=e[2]+" signature_pad "+e[3]+(e[0]||e[4]?" signature-readonly":"")+" svelte-efkzkz"),U(t,"class",o=e[2]+"_wrapper wrapper svelte-efkzkz"),U(t,"id","signature_wrapper")},m(e,r){R(e,t,r),N(t,n),N(t,i),a&&a.m(t,null),s=!0},p(e,[i]){(!s||2&i)&&U(n,"id",e[1]),(!s||2&i)&&U(n,"name",e[1]),(!s||29&i&&r!==(r=e[2]+" signature_pad "+e[3]+(e[0]||e[4]?" signature-readonly":"")+" svelte-efkzkz"))&&U(n,"class",r),e[0]?a&&(pe(),ye(a,1,1,(()=>{a=null})),ge()):a?(a.p(e,i),1&i&&we(a,1)):(a=Ma(e),a.c(),we(a,1),a.m(t,null)),(!s||4&i&&o!==(o=e[2]+"_wrapper wrapper svelte-efkzkz"))&&U(t,"class",o)},i(e){s||(we(a),s=!0)},o(e){ye(a),s=!1},d(e){e&&D(t),a&&a.d()}}}const Pa=new Map;let La="";function Fa(e,t,n){const r=K();let i,{id:o}=t,{name:s}=t,{value:a}=t,{record:l}=t,{classId:c}=t,{disabled:d}=t,{readonly:u}=t;const h=l._id||Math.floor(9e3*Math.random()+1e3).toString();u||=d;const f=e=>{La=e,Pa.set(h,La),r("blur",{value:La})};return Y((()=>{La=a||Pa.get(h)||"",Pa.set(h,La);const e=document.querySelector("canvas");n(8,i=new Oa(e)),u||(i.addEventListener("endStroke",(()=>{f(i.toDataURL("image/png"))})),i.addEventListener("afterUpdateStroke",(()=>{f(i.toDataURL("image/png"))})))})),Z((()=>Pa.forEach(((e,t,n)=>{t!==h&&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&&La&&i&&i.fromDataURL(La,{ratio:1})},[u,o,s,c,d,()=>{i.clear(),f("")},a,l,i]}class Va extends Te{constructor(e){var t;super(),xa.getElementById("svelte-efkzkz-style")||((t=O("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}",N(xa.head,t)),Se(this,e,Fa,Ba,A,{id:1,name:2,value:6,record:7,classId:3,disabled:4,readonly:0})}}function Ua(e,t,n){const r=e.slice();return r[36]=t[n],r[38]=n,r}function Ha(e){let t,n,r;return n=new Ve({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather2 svelte-bcd9jd"),U(t,"title",e[21])},m(e,i){R(e,t,i),Ae(n,t,null),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function Wa(e){let t,n,r,i,o;return n=new Ve({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather pointer svelte-bcd9jd"),U(t,"title",e[21])},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[22]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function za(e){let t,n,r;function i(t){e[28](t)}let o={class:"tModal",noClickaway:!0,$$slots:{default:[Za]},$$scope:{ctx:e}};return void 0!==e[8]&&(o.open=e[8]),t=new e[12]({props:o}),ee.push((()=>$e(t,"open",i))),{c(){Ee(t.$$.fragment)},m(e,n){Ae(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],le((()=>n=!1))),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function qa(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function ja(e){let t,n,r,i=(e[10]||"Keine Einträge gefunden!")+"";return{c(){t=O("tr"),n=O("td"),r=M(i),U(n,"class","svelte-bcd9jd"),U(t,"class","svelte-bcd9jd")},m(e,i){R(e,t,i),N(t,n),N(n,r)},p(e,t){1024&t[0]&&i!==(i=(e[10]||"Keine Einträge gefunden!")+"")&&H(r,i)},d(e){e&&D(t)}}}function Ga(e){let t,n=e[9],r=[];for(let t=0;t<n.length;t+=1)r[t]=Xa(Ua(e,n,t));return{c(){for(let e=0;e<r.length;e+=1)r[e].c();t=P()},m(e,n){for(let t=0;t<r.length;t+=1)r[t].m(e,n);R(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=Ua(e,n,o);r[o]?r[o].p(s,i):(r[o]=Xa(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){k(r,e),e&&D(t)}}}function Xa(e){let t,n,r,i,o,s,a=e[23](e[36])+"";return{c(){t=O("tr"),n=O("td"),r=M(a),i=B(),U(n,"class","svelte-bcd9jd"),U(t,"class","pointer svelte-bcd9jd")},m(a,l){R(a,t,l),N(t,n),N(n,r),N(t,i),o||(s=L(t,"click",V(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&&D(t),o=!1,s()}}}function Ya(e){let t,n,r,i,o,s,a,l,c,d,u,h,f;function m(e,t){return e[9]?.length?Ga:ja}n=new e[14]({props:{outline:!0,$$slots:{default:[qa]},$$scope:{ctx:e}}}),n.$on("click",e[25]),i=new e[15]({});let p=m(e),g=p(e);return{c(){t=O("div"),Ee(n.$$.fragment),r=B(),Ee(i.$$.fragment),o=B(),s=O("div"),a=O("table"),l=O("thead"),c=O("tr"),d=O("th"),d.textContent=`${e[20]}`,u=B(),h=O("tbody"),g.c(),U(d,"class","svelte-bcd9jd"),U(c,"class","svelte-bcd9jd"),U(l,"class","svelte-bcd9jd"),U(a,"striped",""),U(a,"class","svelte-bcd9jd"),U(s,"class","eList svelte-bcd9jd")},m(e,m){R(e,t,m),Ae(n,t,null),R(e,r,m),Ae(i,e,m),R(e,o,m),R(e,s,m),N(s,a),N(a,l),N(l,c),N(c,d),N(a,u),N(a,h),g.m(h,null),f=!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(h,null)))},i(e){f||(we(n.$$.fragment,e),we(i.$$.fragment,e),f=!0)},o(e){ye(n.$$.fragment,e),ye(i.$$.fragment,e),f=!1},d(e){e&&D(t),be(n),e&&D(r),be(i,e),e&&D(o),e&&D(s),g.d()}}}function Za(e){let t,n;return t=new e[13]({props:{title:e[21],class:"eList",$$slots:{default:[Ya]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Ka(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}),ee.push((()=>$e(n,"value",d))),n.$on("change",e[27]);const h=[Wa,Ha],f=[];function m(e,t){return e[6]||e[4]._id?1:0}o=m(e),s=f[o]=h[o](e);let p=e[8]&&za(e);return{c(){t=O("div"),Ee(n.$$.fragment),i=B(),s.c(),a=B(),p&&p.c(),l=P(),z(t,"position","relative")},m(e,r){R(e,t,r),Ae(n,t,null),N(t,i),f[o].m(t,null),R(e,a,r),p&&p.m(e,r),R(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],le((()=>r=!1))),n.$set(a);let c=o;o=m(e),o===c?f[o].p(e,i):(pe(),ye(f[c],1,1,(()=>{f[c]=null})),ge(),s=f[o],s?s.p(e,i):(s=f[o]=h[o](e),s.c()),we(s,1),s.m(t,null)),e[8]?p?(p.p(e,i),256&i[0]&&we(p,1)):(p=za(e),p.c(),we(p,1),p.m(l.parentNode,l)):p&&(pe(),ye(p,1,1,(()=>{p=null})),ge())},i(e){c||(we(n.$$.fragment,e),we(s),we(p),c=!0)},o(e){ye(n.$$.fragment,e),ye(s),ye(p),c=!1},d(e){e&&D(t),be(n),f[o].d(),e&&D(a),p&&p.d(e),e&&D(l)}}}function Qa(e,n,r){let i;const{TextField:o,Modal:s,Dialog:a,Button:l,Divider:d}=c,h=K(),{environment:f}=u;b(e,f,(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:C={}}=g;let{pattern:$,placeholder:E,readonly:A,required:S=!1,format:T}=C,N=!1;const{service:{type:R,map:D,title:k,designation:O}}=T;let x,M;const B=()=>{r(8,N=!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,N,x,M,o,s,a,l,d,f,$,A,S,k,O,async()=>{_||w._id||(r(9,x=[]),r(10,M=""),y.length>3&&(r(9,x=await t.getService("address",R,y)),Array.isArray(x)||r(10,M=x.error)),r(8,N=!0))},e=>D.map((({name:t})=>e[t])).filter((e=>!!e)).join(", "),e=>()=>{const t=x[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]})):h("record",{itemName:o,value:t[e]})}n.length&&h("objRecord",{listName:r,items:n}),B()},B,function(e){y=e,r(0,y)},function(t){Q(e,t)},function(e){N=e,r(8,N)}]}class Ja extends Te{constructor(e){var t;super(),document.getElementById("svelte-bcd9jd-style")||((t=O("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}",N(document.head,t)),Se(this,e,Qa,Ka,A,{classId:1,id:2,item:3,record:4,value:0,noForm:5,disabled:6,formnovalidate:7},[-1,-1])}}function el(e){let t,n,r;return n=new it({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather2 svelte-1xgbysl")},m(e,i){R(e,t,i),Ae(n,t,null),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function tl(e){let t,n,r,i,o;return n=new it({props:{size:"18"}}),{c(){t=O("span"),Ee(n.$$.fragment),U(t,"class","feather pointer svelte-1xgbysl")},m(s,a){R(s,t,a),Ae(n,t,null),r=!0,i||(o=L(t,"click",e[6]),i=!0)},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function nl(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=[tl,el],l=[];function c(e,t){return e[4]?0:1}return i=c(e),o=l[i]=a[i](e),{c(){t=O("div"),Ee(n.$$.fragment),r=B(),o.c(),z(t,"position","relative")},m(e,o){R(e,t,o),Ae(n,t,null),N(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):(pe(),ye(l[d],1,1,(()=>{l[d]=null})),ge(),o=l[i],o?o.p(e,r):(o=l[i]=a[i](e),o.c()),we(o,1),o.m(t,null))},i(e){s||(we(n.$$.fragment,e),we(o),s=!0)},o(e){ye(n.$$.fragment,e),ye(o),s=!1},d(e){e&&D(t),be(n),l[i].d()}}}function rl(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:h}=t,{record:f}=t;const m=f?.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,h=e.value),"record"in e&&n(10,f=e.record)},[i,s,d,u,h,r,async()=>{m&&window.open(m)},o,a,l,f]}class il extends Te{constructor(e){var t;super(),document.getElementById("svelte-1xgbysl-style")||((t=O("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}",N(document.head,t)),Se(this,e,rl,nl,A,{inputClass:0,disabled:7,formnovalidate:1,readonly:8,required:9,id:2,name:3,value:4,record:10})}}function ol(e){let t,n;return t=new e[30]({props:{id:e[46](e[39]),class:e[0].name+(e[26]?" hidden ":""),nameClass:e[0].properties?.color?"color_"+e[0].properties.color:"",name:e[0].designation,help:e[0].properties?.hint,$$slots:{default:[xl,({notifyList:e})=>({24:e}),({notifyList:e})=>[e?16777216:0]]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};67108865&n[0]&&(r.class=e[0].name+(e[26]?" 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),872415231&n[0]|262144&n[2]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function sl(e){let t,n;return t=new e[33]({props:{text:e[0].designation}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};1&n[0]&&(r.text=e[0].designation),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function al(e){let t,n,r,i;return t=new e[30]({props:{id:e[46](e[39]),class:e[0].name+(e[26]?" hidden ":""),name:e[0].designation,help:e[0].properties?.hint}}),r=new Na({props:{classId:e[9],disabled:e[3],readonly:e[25],id:e[39],name:e[0].name,value:e[28](),record:e[1],noForm:e[8]}}),r.$on("blur",e[42]()),{c(){Ee(t.$$.fragment),n=B(),Ee(r.$$.fragment)},m(e,o){Ae(t,e,o),R(e,n,o),Ae(r,e,o),i=!0},p(e,n){const i={};67108865&n[0]&&(i.class=e[0].name+(e[26]?" hidden ":"")),1&n[0]&&(i.name=e[0].designation),1&n[0]&&(i.help=e[0].properties?.hint),t.$set(i);const o={};512&n[0]&&(o.classId=e[9]),8&n[0]&&(o.disabled=e[3]),33554432&n[0]&&(o.readonly=e[25]),1&n[0]&&(o.name=e[0].name),268435456&n[0]&&(o.value=e[28]()),2&n[0]&&(o.record=e[1]),256&n[0]&&(o.noForm=e[8]),r.$set(o)},i(e){i||(we(t.$$.fragment,e),we(r.$$.fragment,e),i=!0)},o(e){ye(t.$$.fragment,e),ye(r.$$.fragment,e),i=!1},d(e){be(t,e),e&&D(n),be(r,e)}}}function ll(e){let t,n,r,i,o,s;return t=new e[30]({props:{id:e[46](e[39]),class:e[0].name+" hidden",name:e[0].designation,help:e[0].properties?.hint,$$slots:{default:[Ml]},$$scope:{ctx:e}}}),r=new e[33]({props:{text:e[29]}}),o=new _i({props:{required:e[4],disabled:e[3],readonly:e[25],id:e[39],item:e[0],currency:e[19],value:e[28]()}}),o.$on("setRefValue",e[47]),o.$on("safeReference",e[52]),o.$on("objRecord",e[53]),{c(){Ee(t.$$.fragment),n=B(),Ee(r.$$.fragment),i=B(),Ee(o.$$.fragment)},m(e,a){Ae(t,e,a),R(e,n,a),Ae(r,e,a),R(e,i,a),Ae(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),402654721&n[0]|262144&n[2]&&(i.$$scope={dirty:n,ctx:e}),t.$set(i);const s={};536870912&n[0]&&(s.text=e[29]),r.$set(s);const a={};16&n[0]&&(a.required=e[4]),8&n[0]&&(a.disabled=e[3]),33554432&n[0]&&(a.readonly=e[25]),1&n[0]&&(a.item=e[0]),524288&n[0]&&(a.currency=e[19]),268435456&n[0]&&(a.value=e[28]()),o.$set(a)},i(e){s||(we(t.$$.fragment,e),we(r.$$.fragment,e),we(o.$$.fragment,e),s=!0)},o(e){ye(t.$$.fragment,e),ye(r.$$.fragment,e),ye(o.$$.fragment,e),s=!1},d(e){be(t,e),e&&D(n),be(r,e),e&&D(i),be(o,e)}}}function cl(e){let t,n;return t=new e[31]({props:{inputClass:e[8]||e[9],disabled:e[3],formnovalidate:e[12],readonly:e[25],pattern:e[35],required:!0===e[4],placeholder:e[37],id:e[39],name:e[38],value:e[28]()}}),t.$on("change",e[42]()),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),33554432&n[0]&&(r.readonly=e[25]),16&n[0]&&(r.required=!0===e[4]),268435456&n[0]&&(r.value=e[28]()),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function dl(e){let t,n;return t=new ha({props:{inputClass:e[8]||e[9],disabled:e[3],formnovalidate:e[12],readonly:e[25],required:e[4],id:e[39],name:e[38],pattern:e[35],placeholder:e[37],value:e[28]()}}),t.$on("change",e[42]()),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),33554432&n[0]&&(r.readonly=e[25]),16&n[0]&&(r.required=e[4]),268435456&n[0]&&(r.value=e[28]()),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ul(e){let t,n;return t=new il({props:{inputClass:e[8]||e[9],formnovalidate:e[12],id:e[39],name:e[38],value:e[28](),record:e[1],"}":!0}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),268435456&n[0]&&(r.value=e[28]()),2&n[0]&&(r.record=e[1]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function hl(e){let t,n;return t=new aa({props:{inputClass:e[8]||e[9],disabled:e[3],formnovalidate:e[12],readonly:e[25],required:e[4],id:e[39],name:e[38],value:e[28]()}}),t.$on("change",e[42]()),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),33554432&n[0]&&(r.readonly=e[25]),16&n[0]&&(r.required=e[4]),268435456&n[0]&&(r.value=e[28]()),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function fl(e){let t,n;return t=new wa({props:{inputClass:e[8]||e[9],disabled:e[3],formnovalidate:e[12],readonly:e[25],required:e[4],id:e[39],name:e[38],pattern:e[35],multiple:e[36],placeholder:e[37],value:e[28]()}}),t.$on("change",e[42]()),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),33554432&n[0]&&(r.readonly=e[25]),16&n[0]&&(r.required=e[4]),268435456&n[0]&&(r.value=e[28]()),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ml(e){let t,n;return t=new Xs({props:{inputClass:e[8]||e[9],disabled:e[3],readonly:e[25],required:e[4],id:e[39],item:e[0],value:e[28](),praefix:e[5]}}),t.$on("blur",e[42]()),t.$on("checkRange",e[71]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),33554432&n[0]&&(r.readonly=e[25]),16&n[0]&&(r.required=e[4]),1&n[0]&&(r.item=e[0]),268435456&n[0]&&(r.value=e[28]()),32&n[0]&&(r.praefix=e[5]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function pl(e){let t,n;return t=new fo({props:{inputClass:e[8]||e[9],disabled:e[3],formnovalidate:e[12],readonly:e[25],required:e[4],id:e[39],name:e[38],value:e[28](),record:e[1],item:e[0]}}),t.$on("change",e[42]()),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),33554432&n[0]&&(r.readonly=e[25]),16&n[0]&&(r.required=e[4]),268435456&n[0]&&(r.value=e[28]()),2&n[0]&&(r.record=e[1]),1&n[0]&&(r.item=e[0]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function gl(e){let t,n;return t=new hs({props:{classId:e[9],id:e[39],disabled:e[3],required:e[4],value:e[40](),noForm:e[8]}}),t.$on("change",e[42]()),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function wl(e){let t,n;return t=new ps({props:{classId:e[9],id:e[39],item:e[0],disabled:e[3],required:e[4],value:e[41](),noForm:e[8]}}),t.$on("change",e[42]()),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),256&n[0]&&(r.noForm=e[8]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function yl(e){let t,n;return t=new rs({props:{classId:e[9],eventId:e[10],id:e[39],item:e[0],record:e[1],readonly:e[25],disabled:e[3],required:e[4],praefix:e[5],value:e[40](),noForm:e[8],notifyList:e[24],dateInput:e[23]}}),t.$on("change",e[42](!0)),t.$on("formula",e[69]),t.$on("record",e[70]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),33554432&n[0]&&(r.readonly=e[25]),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]),16777216&n[0]&&(r.notifyList=e[24]),8388608&n[0]&&(r.dateInput=e[23]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function vl(e){let t,n;return t=new e[32]({props:{round:!0,inputClass:e[8]||e[9],disabled:e[3]||e[25],required:e[4],id:e[39],name:e[38],checked:e[28](),value:e[28](!0)}}),t.$on("change",e[42]()),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};768&n[0]&&(r.inputClass=e[8]||e[9]),33554440&n[0]&&(r.disabled=e[3]||e[25]),16&n[0]&&(r.required=e[4]),268435456&n[0]&&(r.checked=e[28]()),268435456&n[0]&&(r.value=e[28](!0)),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function _l(e){let t,n;return t=new na({props:{id:e[39],item:e[0],praefix:e[5],record:e[1],notifyList:e[24]}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),16777216&n[0]&&(r.notifyList=e[24]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Il(e){let t,n;return t=new _o({props:{classId:e[9],item:e[0],record:e[1],listName:e[6],disabled:e[3],formnovalidate:e[12],readonly:e[25],pattern:e[35],required:!0===e[4],placeholder:e[37],id:e[39],name:e[38],value:e[28]()}}),t.$on("blur",e[42]()),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),33554432&n[0]&&(r.readonly=e[25]),16&n[0]&&(r.required=!0===e[4]),268435456&n[0]&&(r.value=e[28]()),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Cl(e){let t,n;return t=new jo({props:{classId:e[9],disabled:e[3],required:e[4],id:e[39],item:e[0],record:e[1],value:e[28](),noForm:e[8],view:e[0].properties.view,praefix:e[5]}}),t.$on("blur",e[42]()),t.$on("invalid",e[68]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),268435456&n[0]&&(r.value=e[28]()),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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function $l(e){let t,n;return t=new so({props:{classId:e[9],disabled:e[3],required:e[4],id:e[39],item:e[0],record:e[1],value:e[28](),noForm:e[8],multi:e[0].properties.multi,numberInput:e[14],praefix:e[5],toDelete:e[17],reqQuantity:e[18],notifyList:e[24]}}),t.$on("blur",e[42]()),t.$on("invalid",e[67]),t.$on("record",e[43]),t.$on("multi",e[44]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),268435456&n[0]&&(r.value=e[28]()),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]),16777216&n[0]&&(r.notifyList=e[24]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function El(e){let t,n;return t=new Ai({props:{classId:e[9],disabled:e[3],formnovalidate:e[12],required:e[4],readonly:e[25],id:e[39],item:e[0],currency:e[19],value:e[28](),praefix:e[5],notifyList:e[24],noForm:e[8]}}),t.$on("blur",e[42]()),t.$on("formula",e[64]),t.$on("listRecord",e[65]),t.$on("record",e[66]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),33554432&n[0]&&(r.readonly=e[25]),1&n[0]&&(r.item=e[0]),524288&n[0]&&(r.currency=e[19]),268435456&n[0]&&(r.value=e[28]()),32&n[0]&&(r.praefix=e[5]),16777216&n[0]&&(r.notifyList=e[24]),256&n[0]&&(r.noForm=e[8]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Al(e){let t,n;return t=new Ja({props:{classId:e[9],disabled:e[3],readonly:e[25],required:e[4],id:e[39],item:e[0],record:e[1],value:e[28](),noForm:e[8]}}),t.$on("change",e[42]()),t.$on("record",e[62]),t.$on("objRecord",e[63]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),33554432&n[0]&&(r.readonly=e[25]),16&n[0]&&(r.required=e[4]),1&n[0]&&(r.item=e[0]),2&n[0]&&(r.record=e[1]),268435456&n[0]&&(r.value=e[28]()),256&n[0]&&(r.noForm=e[8]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function bl(e){let t,n;return t=new Jo({props:{classId:e[9],disabled:e[3],required:e[4],id:e[39],item:e[0],value:e[28](),noForm:e[8]}}),t.$on("blur",e[42]()),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),268435456&n[0]&&(r.value=e[28]()),256&n[0]&&(r.noForm=e[8]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Sl(e){let t,n;return t=new Va({props:{classId:e[9],disabled:e[3],readonly:e[25],id:e[39],name:e[0].name,value:e[28](),record:e[1],noForm:e[8],placeholder:e[0].properties?.placeholder}}),t.$on("blur",e[42]()),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),33554432&n[0]&&(r.readonly=e[25]),1&n[0]&&(r.name=e[0].name),268435456&n[0]&&(r.value=e[28]()),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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Tl(e){let t,n;return t=new Ws({props:{praefix:e[5],classId:e[9],disabled:e[3],readonly:e[25],item:e[0],id:e[39],name:e[0].name,eventId:e[10],record:e[1],recordId:e[2],value:e[28](),fileType:e[0].properties?.accept}}),t.$on("record",e[60]),t.$on("listRecord",e[61]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),33554432&n[0]&&(r.readonly=e[25]),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]),268435456&n[0]&&(r.value=e[28]()),1&n[0]&&(r.fileType=e[0].properties?.accept),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Nl(e){let t,n;return t=new Ds({props:{praefix:e[5],classId:e[9],disabled:e[3],readonly:e[25],item:e[0],id:e[39],name:e[0].name,eventId:e[10],record:e[1],value:e[28]()}}),t.$on("record",e[59]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),33554432&n[0]&&(r.readonly=e[25]),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]),268435456&n[0]&&(r.value=e[28]()),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Rl(e){let t,n;return t=new _s({props:{classId:e[9],disabled:e[3],readonly:e[25],item:e[0],id:e[39],name:e[0].name,eventId:e[10],record:e[1],value:e[28]()}}),t.$on("record",e[58]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),33554432&n[0]&&(r.readonly=e[25]),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]),268435456&n[0]&&(r.value=e[28]()),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Dl(e){let t,n;return t=new o({props:{classId:e[9],disabled:e[3],readonly:e[25],id:e[39],name:e[0].name,value:e[28](),noForm:e[8],standard:!0,style:"",placeholder:e[0].properties?.placeholder}}),t.$on("blur",e[42]()),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),33554432&n[0]&&(r.readonly=e[25]),1&n[0]&&(r.name=e[0].name),268435456&n[0]&&(r.value=e[28]()),256&n[0]&&(r.noForm=e[8]),1&n[0]&&(r.placeholder=e[0].properties?.placeholder),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function kl(e){let t,n;return t=new Xn({props:{classId:e[9],eventId:e[10],fullRecord:e[7],required:e[4],disabled:e[3],formnovalidate:e[12],readonly:e[25],id:e[39],item:e[0],desc:e[29],value:e[28](),multiValues:e[20],noForm:e[8],praefix:e[5],selectionFields:e[11],selection:e[13],deList:e[15],recordId:e[2],isTemplate:e[16],shortEdit:e[21],initFinished:e[22]}}),t.$on("task",e[56]),t.$on("change",e[42]()),t.$on("initFail",e[45]),t.$on("defPrep",e[57]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),1024&n[0]&&(r.eventId=e[10]),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]),33554432&n[0]&&(r.readonly=e[25]),1&n[0]&&(r.item=e[0]),536870912&n[0]&&(r.desc=e[29]),268435456&n[0]&&(r.value=e[28]()),1048576&n[0]&&(r.multiValues=e[20]),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]),2097152&n[0]&&(r.shortEdit=e[21]),4194304&n[0]&&(r.initFinished=e[22]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Ol(e){let t,n;return t=new lr({props:{classId:e[9],eventId:e[10],required:e[4],disabled:e[3],formnovalidate:e[12],readonly:e[25],id:e[39],item:e[0],record:e[1],desc:e[29],values:e[28]()||[],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[54]),t.$on("change",e[42]()),t.$on("multi",e[44]),t.$on("initFail",e[45]),t.$on("defPrep",e[55]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),33554432&n[0]&&(r.readonly=e[25]),1&n[0]&&(r.item=e[0]),2&n[0]&&(r.record=e[1]),536870912&n[0]&&(r.desc=e[29]),268435456&n[0]&&(r.values=e[28]()||[]),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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function xl(e){let t,n,r,i;const o=[Ol,kl,Dl,Rl,Nl,Tl,Sl,bl,Al,El,$l,Cl,Il,_l,vl,yl,wl,gl,pl,ml,fl,hl,ul,dl,cl],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=P()},m(e,n){s[t].m(e,n),R(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?s[t].p(e,i):(pe(),ye(s[l],1,1,(()=>{s[l]=null})),ge(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),we(n,1),n.m(r.parentNode,r))},i(e){i||(we(n),i=!0)},o(e){ye(n),i=!1},d(e){s[t].d(e),e&&D(r)}}}function Ml(e){let t,n;return t=new Xn({props:{classId:e[9],eventId:e[10],disabled:!0,readonly:!0,id:e[39],item:e[0],value:e[28](),noList:!0,withRefValue:!0,refValue:e[27]}}),t.$on("setRefDesc",e[48]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(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]),268435456&n[0]&&(r.value=e[28]()),134217728&n[0]&&(r.refValue=e[27]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Bl(e){let t,n,r,i;const o=[ll,al,sl,ol],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=P()},m(e,n){s[t].m(e,n),R(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?s[t].p(e,i):(pe(),ye(s[l],1,1,(()=>{s[l]=null})),ge(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),we(n,1),n.m(r.parentNode,r))},i(e){i||(we(n),i=!0)},o(e){ye(n),i=!1},d(e){s[t].d(e),e&&D(r)}}}function Pl(e,n,r){let i,o,s,a;const l=K(),{FormField:d,TextField:h,DatePicker:f,TimePicker:p,Checkbox:g,Divider:w}=c,{environment:y}=u;b(e,y,(e=>r(51,a=e)));let{praefix:v=""}=n,{item:_}=n,{listName:I=""}=n,{fullRecord:C}=n,{record:$}=n,{recordId:E}=n,{noForm:A=!1}=n,{classId:S}=n,{eventId:T}=n,{disabled:N}=n,{selectionFields:R}=n,{formnovalidate:D}=n,{selection:k=!1}=n,{notifyList:O}=n,{numberInput:x}=n,{deList:M}=n,{required:B}=n,{isTemplate:P}=n,{toDelete:L}=n,{reqQuantity:F}=n,{currency:V}=n,{changeValue:U}=n,{propSelection:H}=n,{multiValues:W}=n,{shortEdit:z}=n,{initFinished:q}=n,{dateInput:j}=n;E||=$._id;let{required:G,readonly:X,hidden:Y,pattern:Z,multiple:J,placeholder:ee}=_.properties||{};if(Y=!0===Y,void 0!==X&&(X=!0===X),X||=E&&_.asInput,void 0===B&&(B=G),N=N||!!X,"string"==typeof _.name){const[e,t]=_.name.split("_");t&&(_.name=t)}const te=(I?I+".":"")+_.name,ne=te+(""!==v?"-"+v:""),re=(e,t=te)=>{try{return t.split(".").reduce(((e,t)=>e[t]),e)}catch(e){return""}},ie=async e=>{const{list:n,values:r}=_.process;if(!e)return void l("save",{itemName:n,value:[],addToRecord:!0});const i={},o=await t.getSchema(T);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}l("save",{itemName:n,value:[i],addToRecord:!0})};let oe=re($);return e.$$set=e=>{"praefix"in e&&r(5,v=e.praefix),"item"in e&&r(0,_=e.item),"listName"in e&&r(6,I=e.listName),"fullRecord"in e&&r(7,C=e.fullRecord),"record"in e&&r(1,$=e.record),"recordId"in e&&r(2,E=e.recordId),"noForm"in e&&r(8,A=e.noForm),"classId"in e&&r(9,S=e.classId),"eventId"in e&&r(10,T=e.eventId),"disabled"in e&&r(3,N=e.disabled),"selectionFields"in e&&r(11,R=e.selectionFields),"formnovalidate"in e&&r(12,D=e.formnovalidate),"selection"in e&&r(13,k=e.selection),"notifyList"in e&&r(24,O=e.notifyList),"numberInput"in e&&r(14,x=e.numberInput),"deList"in e&&r(15,M=e.deList),"required"in e&&r(4,B=e.required),"isTemplate"in e&&r(16,P=e.isTemplate),"toDelete"in e&&r(17,L=e.toDelete),"reqQuantity"in e&&r(18,F=e.reqQuantity),"currency"in e&&r(19,V=e.currency),"changeValue"in e&&r(49,U=e.changeValue),"propSelection"in e&&r(50,H=e.propSelection),"multiValues"in e&&r(20,W=e.multiValues),"shortEdit"in e&&r(21,z=e.shortEdit),"initFinished"in e&&r(22,q=e.initFinished),"dateInput"in e&&r(23,j=e.dateInput)},e.$$.update=()=>{if(1&e.$$.dirty[0]|524288&e.$$.dirty[1]&&H&&_.properties?.selection){const{refClass:e,refItem:t,target:n}=_.properties.selection,r=H.record[e];l("propSelection",{itemName:_.name,itemType:_.type,prop:t,target:n,source:e,sourceId:r})}if(262144&e.$$.dirty[1])for(const e in U)e===te&&r(1,$[te]=U[e],$);7&e.$$.dirty[0]|1048576&e.$$.dirty[1]&&r(28,i=(e=!1)=>{let t;return E||"number"!==_.type&&"string"!==_.type||!_.refItemAlt?.startsWith||!_.refItemAlt.startsWith("owner.")||+re($)?E||"number"!==_.type&&"string"!==_.type||!_.refItem?.startsWith||!_.refItem.startsWith("owner.")?(t=re($),!t&&_.properties?.useId&&(t=$._id),e&&(t=!!t),void 0===t?"":t):(t=re(a,_.refItem),void 0===t?"":t):(t=re(a,_.refItemAlt),void 0===t?"":t)}),2&e.$$.dirty[0]&&(s=re($))},r(29,o=((e=te)=>{let t=$["_"+e];return t=m(t),void 0===t?"":t})()),[_,$,E,N,B,v,I,C,A,S,T,R,D,k,x,M,P,L,F,V,W,z,q,j,O,X,Y,oe,i,o,d,h,g,w,y,Z,J,ee,te,ne,(e=te)=>{let t=re($);return t?new Date(t):""===v?(()=>{const e=new Date;return new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()-1,23))})():void 0},(e=te)=>{const t=re($,e+"_from"),n=re($,e+"_to");return{from:void 0===t?t:new Date(t),to:void 0===n?n:new Date(n)}},e=>({detail:t})=>{let{value:n,checked:i,range:o}=t;void 0!==i&&(n=i);const a=te+(o||"");r(1,$[a]=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,$);const c=Object.values($).every((e=>!e))&&n;l("notify",{oldValue:s,value:n,add:c,itemName:a,desc:t.description}),"boolean"===_.type&&_.process&&ie(i)},({detail:e})=>{l("record",e)},({detail:e})=>{l("multi",e)},()=>r(26,Y=!0),()=>"object"===_.type?"comment_"+ne:ne,({detail:e})=>{r(27,oe=e)},({detail:e})=>{const{designation:t}=_;r(29,o=t+": "+(e||"(Neu)"))},U,H,a,function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)}]}class Ll extends Te{constructor(e){var t;super(),document.getElementById("svelte-rxh0vh-style")||((t=O("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}",N(document.head,t)),Se(this,e,Pl,Bl,A,{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:24,numberInput:14,deList:15,required:4,isTemplate:16,toDelete:17,reqQuantity:18,currency:19,changeValue:49,propSelection:50,multiValues:20,shortEdit:21,initFinished:22,dateInput:23},[-1,-1,-1])}}var Fl;!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"}(Fl||(Fl={}));var Vl,Ul,Hl=new Map([[Fl.QR_CODE,"QR_CODE"],[Fl.AZTEC,"AZTEC"],[Fl.CODABAR,"CODABAR"],[Fl.CODE_39,"CODE_39"],[Fl.CODE_93,"CODE_93"],[Fl.CODE_128,"CODE_128"],[Fl.DATA_MATRIX,"DATA_MATRIX"],[Fl.MAXICODE,"MAXICODE"],[Fl.ITF,"ITF"],[Fl.EAN_13,"EAN_13"],[Fl.EAN_8,"EAN_8"],[Fl.PDF_417,"PDF_417"],[Fl.RSS_14,"RSS_14"],[Fl.RSS_EXPANDED,"RSS_EXPANDED"],[Fl.UPC_A,"UPC_A"],[Fl.UPC_E,"UPC_E"],[Fl.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]);function Wl(e){return Object.values(Fl).includes(e)}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.URL=1]="URL"}(Vl||(Vl={})),function(e){e[e.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",e[e.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"}(Ul||(Ul={}));var zl,ql=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=[Ul.SCAN_TYPE_CAMERA,Ul.SCAN_TYPE_FILE],e}(),jl=function(){function e(e,t){this.format=e,this.formatName=t}return e.prototype.toString=function(){return this.formatName},e.create=function(t){if(!Hl.has(t))throw"".concat(t," not in html5QrcodeSupportedFormatsTextMap");return new e(t,Hl.get(t))},e}(),Gl=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"}(zl||(zl={}));var Xl=function(){function e(){}return e.createFrom=function(e){return{errorMessage:e,type:zl.UNKWOWN_ERROR}},e}(),Yl=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 Zl(e){return null==e}var Kl=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}(),Ql=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}(),Jl="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ec(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function tc(e){var t={exports:{}};return e(t,t.exports),t.exports}var nc,rc,ic=tc((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 h extends l{static getChecksumInstance(){return new h}}h.kind="ChecksumException";class f{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 C extends l{static getFormatInstance(){return new C}}C.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 ${constructor(e,t,n,...r){this.valueIdentifier=e,this.name=n,this.values="number"==typeof t?Int32Array.from([t]):t,this.otherEncodingNames=r,$.VALUE_IDENTIFIER_TO_ECI.set(e,this),$.NAME_TO_ECI.set(n,this);const i=this.values;for(let e=0,t=i.length;e!==t;e++){const t=i[e];$.VALUES_TO_ECI.set(t,this)}for(const e of r)$.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 C("incorect value");const t=$.VALUES_TO_ECI.get(e);if(void 0===t)throw new C("incorect value");return t}static getCharacterSetECIByName(e){const t=$.NAME_TO_ECI.get(e);if(void 0===t)throw new C("incorect value");return t}equals(e){if(!(e instanceof $))return!1;const t=e;return this.getName()===t.getName()}}$.VALUE_IDENTIFIER_TO_ECI=new Map,$.VALUES_TO_ECI=new Map,$.NAME_TO_ECI=new Map,$.Cp437=new $(_.Cp437,Int32Array.from([0,2]),"Cp437"),$.ISO8859_1=new $(_.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),$.ISO8859_2=new $(_.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),$.ISO8859_3=new $(_.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),$.ISO8859_4=new $(_.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),$.ISO8859_5=new $(_.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),$.ISO8859_6=new $(_.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),$.ISO8859_7=new $(_.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),$.ISO8859_8=new $(_.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),$.ISO8859_9=new $(_.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),$.ISO8859_10=new $(_.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),$.ISO8859_11=new $(_.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),$.ISO8859_13=new $(_.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),$.ISO8859_14=new $(_.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),$.ISO8859_15=new $(_.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),$.ISO8859_16=new $(_.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),$.SJIS=new $(_.SJIS,20,"SJIS","Shift_JIS"),$.Cp1250=new $(_.Cp1250,21,"Cp1250","windows-1250"),$.Cp1251=new $(_.Cp1251,22,"Cp1251","windows-1251"),$.Cp1252=new $(_.Cp1252,23,"Cp1252","windows-1252"),$.Cp1256=new $(_.Cp1256,24,"Cp1256","windows-1256"),$.UnicodeBigUnmarked=new $(_.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),$.UTF8=new $(_.UTF8,26,"UTF8","UTF-8"),$.ASCII=new $(_.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),$.Big5=new $(_.Big5,28,"Big5"),$.GB18030=new $(_.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),$.EUC_KR=new $(_.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 $?e:$.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($.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($.UTF8)||e.equals($.ISO8859_1)||e.equals($.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,h=0,f=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++,f=0,h++,h>m&&(m=h)):n>127?(d++,h=0,f++,f>p&&(p=f)):(h=0,f=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=$.SJIS.getName(),b.GB2312="GB2312",b.ISO88591=$.ISO8859_1.getName(),b.EUC_JP="EUC_JP",b.UTF8=$.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 T{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 T(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 T(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 T))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 T(this.width,this.height,this.rowSize,this.bits.slice())}}class N extends l{static getNotFoundInstance(){return new N}}N.kind="NotFoundException";class R extends f{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 T(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 N;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;t&D.BLOCK_SIZE_MASK&&i++;let o=n>>D.BLOCK_SIZE_POWER;n&D.BLOCK_SIZE_MASK&&o++;const s=D.calculateBlackPoints(r,i,o,t,n),a=new T(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 h=u/25;D.thresholdBlock(e,i,c,h,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 k{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 O extends k{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 O(this.delegate.crop(e,t,n,r))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new O(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new O(this.delegate.rotateCounterClockwise45())}}class x extends k{constructor(e){super(e.width,e.height),this.canvas=e,this.tempCanvasElement=null,this.buffer=x.makeBufferFromCanvasImageData(e)}static makeBufferFromCanvasImageData(e){const t=e.getContext("2d").getImageData(0,0,e.width,e.height);return x.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*x.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=x.makeBufferFromCanvasImageData(t),this}invert(){return new O(this)}}x.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 B,P=(globalThis||Jl||self||window?(globalThis||Jl||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 P(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 P(this,void 0,void 0,(function*(){return(yield this.listVideoInputDevices()).map((e=>new M(e.deviceId,e.label)))}))}findDeviceById(e){return P(this,void 0,void 0,(function*(){const t=yield this.listVideoInputDevices();return t?t.find((t=>t.deviceId===e)):null}))}decodeFromInputVideoDevice(e,t){return P(this,void 0,void 0,(function*(){return yield this.decodeOnceFromVideoDevice(e,t)}))}decodeOnceFromVideoDevice(e,t){return P(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 P(this,void 0,void 0,(function*(){const n=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeOnceFromStream(n,t)}))}decodeOnceFromStream(e,t){return P(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 P(this,void 0,void 0,(function*(){return yield this.decodeFromVideoDevice(e,t,n)}))}decodeFromVideoDevice(e,t,n){return P(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 P(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 P(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 P(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 P(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 P(this,void 0,void 0,(function*(){return yield this.playVideoOnLoadAsync(e),yield this.decodeOnce(e)}))}_decodeOnLoadVideoContinuously(e,t){return P(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 N("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 N||(e instanceof h||e instanceof C)&&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 h||e instanceof C||e instanceof N)&&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 x(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"}(B||(B={}));var V,U=B;!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 H,W,z,q,j,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"}(H||(H={}));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=H.UPPER,r=H.UPPER,i="",o=0;for(;o<t;)if(r===H.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===H.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 H.LOWER;case"P":return H.PUNCT;case"M":return H.MIXED;case"D":return H.DIGIT;case"B":return H.BINARY;default:return H.UPPER}}static getCharacter(e,t){switch(e){case H.UPPER:return re.UPPER_TABLE[t];case H.LOWER:return re.LOWER_TABLE[t];case H.MIXED:return re.MIXED_TABLE[t];case H.PUNCT:return re.PUNCT_TABLE[t];case H.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 C;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 C(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 C;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 N}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,h=this.height;for(;o;){o=!1;let f=!0;for(;(f||!a)&&t<u;)f=this.containsBlackPoint(n,r,t,!1),f?(t++,o=!0,a=!0):a||t++;if(t>=u){i=!0;break}let m=!0;for(;(m||!l)&&r<h;)m=this.containsBlackPoint(e,t,r,!0),m?(r++,o=!0,l=!0):l||r++;if(r>=h){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 N;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 N;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 N;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 N;return this.centerEdges(l,o,a,s)}throw new N}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(),h=ce.CORR;return i<this.width/2?[new se(d-h,u+h),new se(s+h,a+h),new se(l-h,c-h),new se(i+h,o-h)]:[new se(d+h,u+h),new se(s+h,a-h),new se(l-h,c+h),new se(i-h,o-h)]}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 N;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 N;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,h,f,m,p){const g=ue.quadrilateralToSquare(e,t,n,r,i,o,s,a);return ue.squareToQuadrilateral(l,c,d,u,h,f,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],h=e[u+1],f=i*t+a*h+d;e[u]=(n*t+o*h+l)/f,e[u+1]=(r*t+s*h+c)/f}}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 h=0;h<u;h++){const u=e[h],f=t[h],m=i*u+a*f+d;e[h]=(n*u+o*f+l)/m,t[h]=(r*u+s*f+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,h=r-o,f=a-o,m=d*f-u*h,p=(l*f-u*c)/m,g=(d*c-l*h)/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 he extends de{sampleGrid(e,t,n,r,i,o,s,a,l,c,d,u,h,f,m,p,g,w,y){const v=ue.quadrilateralToQuadrilateral(r,i,o,s,a,l,c,d,u,h,f,m,p,g,w,y);return this.sampleGridWithTransform(e,t,n,v)}sampleGridWithTransform(e,t,n,r){if(t<=0||n<=0)throw new N;const i=new T(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 N}}return i}}class fe{static setGridSampler(e){fe.gridSampler=e}static getInstance(){return fe.gridSampler}}fe.gridSampler=new he;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 N;let t=2*this.nbCenterLayers,n=new Int32Array([this.sampleLine(e[0],e[1],t),this.sampleLine(e[1],e[2],t),this.sampleLine(e[2],e[3],t),this.sampleLine(e[3],e[0],t)]);this.shift=this.getRotation(n,t);let r=0;for(let 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 N}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 N}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 N;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=fe.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 N}}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 N}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 N;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 N}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 N;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 N}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 N}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 C}let c=!1,d=!1,u="",f=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,$=!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),f=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 C}switch(l){case ve.CODE_CODE_A:if(w<64)u+=E===$?String.fromCharCode(" ".charCodeAt(0)+w):String.fromCharCode(" ".charCodeAt(0)+w+128),E=!1;else if(w<96)u+=E===$?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:!$&&E?($=!0,E=!1):$&&E?($=!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===$?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:!$&&E?($=!0,E=!1):$&&E?($=!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-f;if(m=t.getNextUnset(m),!t.isRange(m,Math.min(t.getSize(),m+(m-f)/2),!1))throw new N;if(y-=v*g,y%103!==g)throw new h;const b=u.length;if(0===b)throw new N;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,T=f+A/2,R=a.length,D=new Uint8Array(R);for(let e=0;e<R;e++)D[e]=a[e];const k=[new se(S,e),new se(T,e)];return new F(u,D,0,k,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 N;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 N;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 h;this.decodeRowResult=this.decodeRowResult.substring(0,e)}if(0===this.decodeRowResult.length)throw new N;c=this.extendedMode?_e.decodeExtended(this.decodeRowResult):this.decodeRowResult;let u=(s[1]+s[0])/2,f=o+d/2;return new F(c,null,0,[new se(u,e),new se(f,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 N}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 N}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 C;o=String.fromCharCode(i.charCodeAt(0)+32);break;case"$":if(!(i>="A"&&i<="Z"))throw new C;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 C;o=""}break;case"/":if(i>="A"&&i<="O")o=String.fromCharCode(i.charCodeAt(0)-32);else{if("Z"!==i)throw new C;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 C;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 N}static skipWhiteSpace(e){const t=e.getSize(),n=e.getNextSet(0);if(n===t)throw new N;return n}decodeEnd(e){e.reverse();try{let t,n=Ie.skipWhiteSpace(e);try{t=Ie.findGuardPattern(e,n,Ie.END_PATTERN_REVERSED[0])}catch(r){r instanceof N&&(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 N}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 N}}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 Ce 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=Ce.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 Ce.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(0===t)return!1;let n=parseInt(e.charAt(t-1),10);return Ce.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 C;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 C;n+=t}return(1e3-n)%10}static decodeEnd(e,t){return Ce.findGuardPattern(e,t,!1,Ce.START_END_PATTERN,new Int32Array(Ce.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,Ce.MAX_INDIVIDUAL_VARIANCE)<Ce.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 N}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,Ce.MAX_INDIVIDUAL_VARIANCE);s<i&&(i=s,o=e)}if(o>=0)return o;throw new N}}Ce.MAX_AVG_VARIANCE=.48,Ce.MAX_INDIVIDUAL_VARIANCE=.7,Ce.START_END_PATTERN=Int32Array.from([1,1,1]),Ce.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),Ce.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),Ce.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 $e{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=$e.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=Ce.decodeDigit(e,r,o,Ce.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 N;let a=this.determineCheckDigit(s);if($e.extensionChecksum(n.toString())!==a)throw new N;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 N}static parseExtensionString(e){if(5!==e.length)return null;let t=$e.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=Ce.decodeDigit(e,r,o,Ce.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 N;if(parseInt(n.toString())%4!==s)throw new N;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=Ce.findGuardPattern(t,n,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return(new $e).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 Ce{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 N;let u=a.toString();if(u.length<8)throw new C;if(!be.checkChecksum(u))throw new h;let f=(r[1]+r[0])/2,m=(l[1]+l[0])/2,p=this.getBarcodeFormat(),g=[new se(f,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 N}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 C;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 C;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 N}}Se.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class Te 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 Ne 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 N}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 N.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 Ne),r.push(new Te),r.push(new Re)):(n.indexOf(U.EAN_13)>-1&&r.push(new Se),n.indexOf(U.UPC_A)>-1&&r.push(new Ne),n.indexOf(U.EAN_8)>-1&&r.push(new Te),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 N}reset(){for(let e of this.readers)e.reset()}}class ke 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],ke.MAX_INDIVIDUAL_VARIANCE)<ke.MAX_AVG_VARIANCE)return n;throw new N}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>=ke.MIN_FINDER_PATTERN_RATIO&&n<=ke.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}}ke.MAX_AVG_VARIANCE=.2,ke.MAX_INDIVIDUAL_VARIANCE=.45,ke.MIN_FINDER_PATTERN_RATIO=9.5/12,ke.MAX_FINDER_PATTERN_RATIO=12.5/14;class Oe{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 Oe))return!1;const t=e;return this.value===t.value&&this.checksumPortion===t.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class xe{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 xe))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 Be{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 Pe{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 C;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 He{constructor(){}static parseFieldsInGeneralPurpose(e){if(!e)return null;if(e.length<2)throw new N;let t=e.substring(0,2);for(let n of He.TWO_DIGIT_DATA_LENGTH)if(n[0]===t)return n[1]===He.VARIABLE_LENGTH?He.processVariableAI(2,n[2],e):He.processFixedAI(2,n[1],e);if(e.length<3)throw new N;let n=e.substring(0,3);for(let t of He.THREE_DIGIT_DATA_LENGTH)if(t[0]===n)return t[1]===He.VARIABLE_LENGTH?He.processVariableAI(3,t[2],e):He.processFixedAI(3,t[1],e);for(let t of He.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(t[0]===n)return t[1]===He.VARIABLE_LENGTH?He.processVariableAI(4,t[2],e):He.processFixedAI(4,t[1],e);if(e.length<4)throw new N;let r=e.substring(0,4);for(let t of He.FOUR_DIGIT_DATA_LENGTH)if(t[0]===r)return t[1]===He.VARIABLE_LENGTH?He.processVariableAI(4,t[2],e):He.processFixedAI(4,t[1],e);throw new N}static processFixedAI(e,t,n){if(n.length<e)throw new N;let r=n.substring(0,e);if(n.length<e+t)throw new N;let i=n.substring(e,e+t),o=n.substring(e+t),s="("+r+")"+i,a=He.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=He.parseFieldsInGeneralPurpose(s);return null==l?a:a+l}}He.VARIABLE_LENGTH=[],He.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",He.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",He.VARIABLE_LENGTH,20],["22",He.VARIABLE_LENGTH,29],["30",He.VARIABLE_LENGTH,8],["37",He.VARIABLE_LENGTH,8],["90",He.VARIABLE_LENGTH,30],["91",He.VARIABLE_LENGTH,30],["92",He.VARIABLE_LENGTH,30],["93",He.VARIABLE_LENGTH,30],["94",He.VARIABLE_LENGTH,30],["95",He.VARIABLE_LENGTH,30],["96",He.VARIABLE_LENGTH,30],["97",He.VARIABLE_LENGTH,3],["98",He.VARIABLE_LENGTH,30],["99",He.VARIABLE_LENGTH,30]],He.THREE_DIGIT_DATA_LENGTH=[["240",He.VARIABLE_LENGTH,30],["241",He.VARIABLE_LENGTH,30],["242",He.VARIABLE_LENGTH,6],["250",He.VARIABLE_LENGTH,30],["251",He.VARIABLE_LENGTH,30],["253",He.VARIABLE_LENGTH,17],["254",He.VARIABLE_LENGTH,20],["400",He.VARIABLE_LENGTH,30],["401",He.VARIABLE_LENGTH,30],["402",17],["403",He.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",He.VARIABLE_LENGTH,20],["421",He.VARIABLE_LENGTH,15],["422",3],["423",He.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],He.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",He.VARIABLE_LENGTH,15],["391",He.VARIABLE_LENGTH,18],["392",He.VARIABLE_LENGTH,15],["393",He.VARIABLE_LENGTH,18],["703",He.VARIABLE_LENGTH,30]],He.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",He.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",He.VARIABLE_LENGTH,20],["8003",He.VARIABLE_LENGTH,30],["8004",He.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",He.VARIABLE_LENGTH,30],["8008",He.VARIABLE_LENGTH,12],["8018",18],["8020",He.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",He.VARIABLE_LENGTH,70],["8200",He.VARIABLE_LENGTH,70]];class We{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=He.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 We.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 Pe(!0,t)}if(this.buffer.append(e.getFirstDigit()),e.isSecondDigitFNC1()){let e=new Ve(this.current.getPosition(),this.buffer.toString());return new Pe(!0,e)}this.buffer.append(e.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new Pe(!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 Pe(!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 Pe(!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 Pe(!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 Pe(!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 C}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 ze{constructor(e){this.information=e,this.generalDecoder=new We(e)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class qe extends ze{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)}qe.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)}}qe.GTIN_SIZE=40;class je extends qe{constructor(e){super(e)}parseInformation(){let e=new S;e.append("(01)");let t=e.length(),n=this.getGeneralDecoder().extractNumericValueFromBitArray(je.HEADER_SIZE,4);return e.append(n),this.encodeCompressedGtinWithoutAI(e,je.HEADER_SIZE+4,t),this.getGeneralDecoder().decodeAllCodes(e,je.HEADER_SIZE+44)}}je.HEADER_SIZE=4;class Ge extends ze{constructor(e){super(e)}parseInformation(){let e=new S;return this.getGeneralDecoder().decodeAllCodes(e,Ge.HEADER_SIZE)}}Ge.HEADER_SIZE=5;class Xe extends qe{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 N;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 qe{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<Qe.HEADER_SIZE+qe.GTIN_SIZE)throw new N;let e=new S;this.encodeCompressedGtin(e,Qe.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(Qe.HEADER_SIZE+qe.GTIN_SIZE,Qe.LAST_DIGIT_SIZE);e.append("(392"),e.append(t),e.append(")");let n=this.getGeneralDecoder().decodeGeneralPurposeField(Qe.HEADER_SIZE+qe.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 qe{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<Je.HEADER_SIZE+qe.GTIN_SIZE)throw new N;let e=new S;this.encodeCompressedGtin(e,Je.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(Je.HEADER_SIZE+qe.GTIN_SIZE,Je.LAST_DIGIT_SIZE);e.append("(393"),e.append(t),e.append(")");let n=this.getGeneralDecoder().extractNumericValueFromBitArray(Je.HEADER_SIZE+qe.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+qe.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 N;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 je(e);if(!e.get(2))return new Ge(e);switch(We.extractNumericValueFromBitArray(e,1,4)){case 4:return new Ze(e);case 5:return new Ke(e)}switch(We.extractNumericValueFromBitArray(e,1,5)){case 12:return new Qe(e);case 13:return new Je(e)}switch(We.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 ke{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 N){if(!this.pairs.length)throw new N;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 N}checkRowsBoolean(e){if(this.rows.length>25)return this.rows.length=0,null;this.pairs.length=0,e&&(this.rows=this.rows.reverse());let t=null;try{t=this.checkRows(new Array,0)}catch(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 N}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(Be.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 N;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 N}static reverseCounters(e){let t=e.length;for(let n=0;n<t/2;++n){let r=e[n];e[n]=e[t-n-1],e[t-n-1]=r}}parseFoundFinderPattern(e,t,n){let r,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 xe(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 N;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 N;n=1}else if(n>8){if(t>8.7)throw new N;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 h=4*t.getValue()+(n?0:2)+(r?0:1)-1,f=0,m=0;for(let e=l.length-1;e>=0;e--){if(it.isNotA1left(t,n,r)){let t=it.WEIGHTS[h][2*e];m+=l[e]*t}f+=l[e]}let p=0;for(let e=c.length-1;e>=0;e--)if(it.isNotA1left(t,n,r)){let t=it.WEIGHTS[h][2*e+1];p+=c[e]*t}let g=m+p;if(1&f||f>13||f<4)throw new N;let w=(13-f)/2,y=it.SYMBOL_WIDEST[w],v=9-y,_=Me.getRSSvalue(l,y,!0),I=Me.getRSSvalue(c,v,!1),C=it.EVEN_TOTAL_SUBSET[w],$=it.GSUM[w];return new Oe(_*C+I+$,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 N;i=!0}else{if(!c)throw new N;s=!0}else if(-1==a)if(l){if(c)throw new N;r=!0}else{if(!c)throw new N;o=!0}else{if(0!=a)throw new N;if(l){if(!c)throw new N;t<n?(r=!0,s=!0):(i=!0,o=!0)}else if(c)throw new N}if(r){if(i)throw new N;it.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(i&&it.decrement(this.getOddCounts(),this.getOddRoundingErrors()),o){if(s)throw new N;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 Oe{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 ke{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 N}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 h=0,f=0;for(let e=a.length-1;e>=0;e--)h*=9,h+=a[e],f+=a[e];let m=u+3*h;if(n){if(1&d||d>12||d<4)throw new N;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 Oe(r*o+i+l,m)}{if(1&f||f>10||f<4)throw new N;let e=(10-f)/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 Oe(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(ke.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 N}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 xe(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 N;o=!0}else{if(!d)throw new N;a=!0}else if(-1===l)if(c){if(d)throw new N;i=!0}else{if(!d)throw new N;s=!0}else{if(0!==l)throw new N;if(c){if(!d)throw new N;n<r?(i=!0,a=!0):(o=!0,s=!0)}else if(d)throw new N}if(i){if(o)throw new N;ke.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(o&&ke.decrement(this.getOddCounts(),this.getOddRoundingErrors()),s){if(a)throw new N;ke.increment(this.getEvenCounts(),this.getOddRoundingErrors())}a&&ke.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 N}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 C;for(let n of ut.VERSIONS)if(n.symbolSizeRows===e&&n.symbolSizeColumns===t)return n;throw new C}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 ht{constructor(e){const t=e.getHeight();if(t<8||t>144||1&t)throw new C;this.version=ht.readVersion(e),this.mappingBitMatrix=this.extractDataRegion(e),this.readMappingMatrix=new T(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 C;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 T(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 ft{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 ft(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(),h=u?8:s;for(let t=0;t<h;t++)o[t].codewords[a-1]=e[c++];const f=o[0].codewords.length;for(let t=a;t<f;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"}(W||(W={}));class pt{static decode(e){const t=new mt(e),n=new S,r=new S,i=new Array;let o=W.ASCII_ENCODE;do{if(o===W.ASCII_ENCODE)o=this.decodeAsciiSegment(t,n,r);else{switch(o){case W.C40_ENCODE:this.decodeC40Segment(t,n);break;case W.TEXT_ENCODE:this.decodeTextSegment(t,n);break;case W.ANSIX12_ENCODE:this.decodeAnsiX12Segment(t,n);break;case W.EDIFACT_ENCODE:this.decodeEdifactSegment(t,n);break;case W.BASE256_ENCODE:this.decodeBase256Segment(t,n,i);break;default:throw new C}o=W.ASCII_ENCODE}}while(o!==W.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 C;if(i<=128)return r&&(i+=128),t.append(String.fromCharCode(i-1)),W.ASCII_ENCODE;if(129===i)return W.PAD_ENCODE;if(i<=229){const e=i-130;e<10&&t.append("0"),t.append(""+e)}else switch(i){case 230:return W.C40_ENCODE;case 231:return W.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 W.ANSIX12_ENCODE;case 239:return W.TEXT_ENCODE;case 240:return W.EDIFACT_ENCODE;default:if(254!==i||0!==e.available())throw new C}}while(e.available()>0);return W.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 C;{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 C}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 C}}}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 C;{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 C}i=0;break;case 3:if(!(o<this.TEXT_SHIFT3_SET_CHARS.length))throw new C;{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 C}}}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 C;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 C;const s=new Uint8Array(o);for(let t=0;t<o;t++){if(e.available()<8)throw new C;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 ht(e),n=t.getVersion(),r=t.readCodewords(),i=ft.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 h}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 N;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,h=(t.getY()+n.getY()+r.getY()+i.getY())/4;return t=wt.moveAway(t,u,h),n=wt.moveAway(n,u,h),r=wt.moveAway(r,u,h),i=wt.moveAway(i,u,h),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 fe.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,h=0,f=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!==f&&(h++,f=n),c+=l,c>0){if(t===o)break;t+=d,c-=a}}return h}}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 N;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 N;const c=r/2;i+=c,s+=c;const d=new T(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 N;const o=r-e[0];if(0===o)throw new N;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"}(z||(z={}));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(z.L,"L",1),_t.M=new _t(z.M,"M",0),_t.Q=new _t(z.Q,"Q",3),_t.H=new _t(z.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 Ct{constructor(e,...t){this.ecCodewordsPerBlock=e,this.ecBlocks=t}getECCodewordsPerBlock(){return this.ecCodewordsPerBlock}getNumBlocks(){let e=0;const t=this.ecBlocks;for(const n of t)e+=n.getCount();return e}getTotalECCodewords(){return this.ecCodewordsPerBlock*this.getNumBlocks()}getECBlocks(){return this.ecBlocks}}class $t{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class 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 C;try{return this.getVersionForNumber((e-17)/4)}catch(e){throw new C}}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 T(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 Ct(7,new $t(1,19)),new Ct(10,new $t(1,16)),new Ct(13,new $t(1,13)),new Ct(17,new $t(1,9))),new Et(2,Int32Array.from([6,18]),new Ct(10,new $t(1,34)),new Ct(16,new $t(1,28)),new Ct(22,new $t(1,22)),new Ct(28,new $t(1,16))),new Et(3,Int32Array.from([6,22]),new Ct(15,new $t(1,55)),new Ct(26,new $t(1,44)),new Ct(18,new $t(2,17)),new Ct(22,new $t(2,13))),new Et(4,Int32Array.from([6,26]),new Ct(20,new $t(1,80)),new Ct(18,new $t(2,32)),new Ct(26,new $t(2,24)),new Ct(16,new $t(4,9))),new Et(5,Int32Array.from([6,30]),new Ct(26,new $t(1,108)),new Ct(24,new $t(2,43)),new Ct(18,new $t(2,15),new $t(2,16)),new Ct(22,new $t(2,11),new $t(2,12))),new Et(6,Int32Array.from([6,34]),new Ct(18,new $t(2,68)),new Ct(16,new $t(4,27)),new Ct(24,new $t(4,19)),new Ct(28,new $t(4,15))),new Et(7,Int32Array.from([6,22,38]),new Ct(20,new $t(2,78)),new Ct(18,new $t(4,31)),new Ct(18,new $t(2,14),new $t(4,15)),new Ct(26,new $t(4,13),new $t(1,14))),new Et(8,Int32Array.from([6,24,42]),new Ct(24,new $t(2,97)),new Ct(22,new $t(2,38),new $t(2,39)),new Ct(22,new $t(4,18),new $t(2,19)),new Ct(26,new $t(4,14),new $t(2,15))),new Et(9,Int32Array.from([6,26,46]),new Ct(30,new $t(2,116)),new Ct(22,new $t(3,36),new $t(2,37)),new Ct(20,new $t(4,16),new $t(4,17)),new Ct(24,new $t(4,12),new $t(4,13))),new Et(10,Int32Array.from([6,28,50]),new Ct(18,new $t(2,68),new $t(2,69)),new Ct(26,new $t(4,43),new $t(1,44)),new Ct(24,new $t(6,19),new $t(2,20)),new Ct(28,new $t(6,15),new $t(2,16))),new Et(11,Int32Array.from([6,30,54]),new Ct(20,new $t(4,81)),new Ct(30,new $t(1,50),new $t(4,51)),new Ct(28,new $t(4,22),new $t(4,23)),new Ct(24,new $t(3,12),new $t(8,13))),new Et(12,Int32Array.from([6,32,58]),new Ct(24,new $t(2,92),new $t(2,93)),new Ct(22,new $t(6,36),new $t(2,37)),new Ct(26,new $t(4,20),new $t(6,21)),new Ct(28,new $t(7,14),new $t(4,15))),new Et(13,Int32Array.from([6,34,62]),new Ct(26,new $t(4,107)),new Ct(22,new $t(8,37),new $t(1,38)),new Ct(24,new $t(8,20),new $t(4,21)),new Ct(22,new $t(12,11),new $t(4,12))),new Et(14,Int32Array.from([6,26,46,66]),new Ct(30,new $t(3,115),new $t(1,116)),new Ct(24,new $t(4,40),new $t(5,41)),new Ct(20,new $t(11,16),new $t(5,17)),new Ct(24,new $t(11,12),new $t(5,13))),new Et(15,Int32Array.from([6,26,48,70]),new Ct(22,new $t(5,87),new $t(1,88)),new Ct(24,new $t(5,41),new $t(5,42)),new Ct(30,new $t(5,24),new $t(7,25)),new Ct(24,new $t(11,12),new $t(7,13))),new Et(16,Int32Array.from([6,26,50,74]),new Ct(24,new $t(5,98),new $t(1,99)),new Ct(28,new $t(7,45),new $t(3,46)),new Ct(24,new $t(15,19),new $t(2,20)),new Ct(30,new $t(3,15),new $t(13,16))),new Et(17,Int32Array.from([6,30,54,78]),new Ct(28,new $t(1,107),new $t(5,108)),new Ct(28,new $t(10,46),new $t(1,47)),new Ct(28,new $t(1,22),new $t(15,23)),new Ct(28,new $t(2,14),new $t(17,15))),new Et(18,Int32Array.from([6,30,56,82]),new Ct(30,new $t(5,120),new $t(1,121)),new Ct(26,new $t(9,43),new $t(4,44)),new Ct(28,new $t(17,22),new $t(1,23)),new Ct(28,new $t(2,14),new $t(19,15))),new Et(19,Int32Array.from([6,30,58,86]),new Ct(28,new $t(3,113),new $t(4,114)),new Ct(26,new $t(3,44),new $t(11,45)),new Ct(26,new $t(17,21),new $t(4,22)),new Ct(26,new $t(9,13),new $t(16,14))),new Et(20,Int32Array.from([6,34,62,90]),new Ct(28,new $t(3,107),new $t(5,108)),new Ct(26,new $t(3,41),new $t(13,42)),new Ct(30,new $t(15,24),new $t(5,25)),new Ct(28,new $t(15,15),new $t(10,16))),new Et(21,Int32Array.from([6,28,50,72,94]),new Ct(28,new $t(4,116),new $t(4,117)),new Ct(26,new $t(17,42)),new Ct(28,new $t(17,22),new $t(6,23)),new Ct(30,new $t(19,16),new $t(6,17))),new Et(22,Int32Array.from([6,26,50,74,98]),new Ct(28,new $t(2,111),new $t(7,112)),new Ct(28,new $t(17,46)),new Ct(30,new $t(7,24),new $t(16,25)),new Ct(24,new $t(34,13))),new Et(23,Int32Array.from([6,30,54,78,102]),new Ct(30,new $t(4,121),new $t(5,122)),new Ct(28,new $t(4,47),new $t(14,48)),new Ct(30,new $t(11,24),new $t(14,25)),new Ct(30,new $t(16,15),new $t(14,16))),new Et(24,Int32Array.from([6,28,54,80,106]),new Ct(30,new $t(6,117),new $t(4,118)),new Ct(28,new $t(6,45),new $t(14,46)),new Ct(30,new $t(11,24),new $t(16,25)),new Ct(30,new $t(30,16),new $t(2,17))),new Et(25,Int32Array.from([6,32,58,84,110]),new Ct(26,new $t(8,106),new $t(4,107)),new Ct(28,new $t(8,47),new $t(13,48)),new Ct(30,new $t(7,24),new $t(22,25)),new Ct(30,new $t(22,15),new $t(13,16))),new Et(26,Int32Array.from([6,30,58,86,114]),new Ct(28,new $t(10,114),new $t(2,115)),new Ct(28,new $t(19,46),new $t(4,47)),new Ct(28,new $t(28,22),new $t(6,23)),new Ct(30,new $t(33,16),new $t(4,17))),new Et(27,Int32Array.from([6,34,62,90,118]),new Ct(30,new $t(8,122),new $t(4,123)),new Ct(28,new $t(22,45),new $t(3,46)),new Ct(30,new $t(8,23),new $t(26,24)),new Ct(30,new $t(12,15),new $t(28,16))),new Et(28,Int32Array.from([6,26,50,74,98,122]),new Ct(30,new $t(3,117),new $t(10,118)),new Ct(28,new $t(3,45),new $t(23,46)),new Ct(30,new $t(4,24),new $t(31,25)),new Ct(30,new $t(11,15),new $t(31,16))),new Et(29,Int32Array.from([6,30,54,78,102,126]),new Ct(30,new $t(7,116),new $t(7,117)),new Ct(28,new $t(21,45),new $t(7,46)),new Ct(30,new $t(1,23),new $t(37,24)),new Ct(30,new $t(19,15),new $t(26,16))),new Et(30,Int32Array.from([6,26,52,78,104,130]),new Ct(30,new $t(5,115),new $t(10,116)),new Ct(28,new $t(19,47),new $t(10,48)),new Ct(30,new $t(15,24),new $t(25,25)),new Ct(30,new $t(23,15),new $t(25,16))),new Et(31,Int32Array.from([6,30,56,82,108,134]),new Ct(30,new $t(13,115),new $t(3,116)),new Ct(28,new $t(2,46),new $t(29,47)),new Ct(30,new $t(42,24),new $t(1,25)),new Ct(30,new $t(23,15),new $t(28,16))),new Et(32,Int32Array.from([6,34,60,86,112,138]),new Ct(30,new $t(17,115)),new Ct(28,new $t(10,46),new $t(23,47)),new Ct(30,new $t(10,24),new $t(35,25)),new Ct(30,new $t(19,15),new $t(35,16))),new Et(33,Int32Array.from([6,30,58,86,114,142]),new Ct(30,new $t(17,115),new $t(1,116)),new Ct(28,new $t(14,46),new $t(21,47)),new Ct(30,new $t(29,24),new $t(19,25)),new Ct(30,new $t(11,15),new $t(46,16))),new Et(34,Int32Array.from([6,34,62,90,118,146]),new Ct(30,new $t(13,115),new $t(6,116)),new Ct(28,new $t(14,46),new $t(23,47)),new Ct(30,new $t(44,24),new $t(7,25)),new Ct(30,new $t(59,16),new $t(1,17))),new Et(35,Int32Array.from([6,30,54,78,102,126,150]),new Ct(30,new $t(12,121),new $t(7,122)),new Ct(28,new $t(12,47),new $t(26,48)),new Ct(30,new $t(39,24),new $t(14,25)),new Ct(30,new $t(22,15),new $t(41,16))),new Et(36,Int32Array.from([6,24,50,76,102,128,154]),new Ct(30,new $t(6,121),new $t(14,122)),new Ct(28,new $t(6,47),new $t(34,48)),new Ct(30,new $t(46,24),new $t(10,25)),new Ct(30,new $t(2,15),new $t(64,16))),new Et(37,Int32Array.from([6,28,54,80,106,132,158]),new Ct(30,new $t(17,122),new $t(4,123)),new Ct(28,new $t(29,46),new $t(14,47)),new Ct(30,new $t(49,24),new $t(10,25)),new Ct(30,new $t(24,15),new $t(46,16))),new Et(38,Int32Array.from([6,32,58,84,110,136,162]),new Ct(30,new $t(4,122),new $t(18,123)),new Ct(28,new $t(13,46),new $t(32,47)),new Ct(30,new $t(48,24),new $t(14,25)),new Ct(30,new $t(42,15),new $t(32,16))),new Et(39,Int32Array.from([6,26,54,82,110,138,166]),new Ct(30,new $t(20,117),new $t(4,118)),new Ct(28,new $t(40,47),new $t(7,48)),new Ct(30,new $t(43,24),new $t(22,25)),new Ct(30,new $t(10,15),new $t(67,16))),new Et(40,Int32Array.from([6,30,58,86,114,142,170]),new Ct(30,new $t(19,118),new $t(6,119)),new Ct(28,new $t(18,47),new $t(31,48)),new Ct(30,new $t(34,24),new $t(34,25)),new Ct(30,new $t(20,15),new $t(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"}(q||(q={}));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([[q.DATA_MASK_000,new At(q.DATA_MASK_000,((e,t)=>!(e+t&1)))],[q.DATA_MASK_001,new At(q.DATA_MASK_001,((e,t)=>!(1&e)))],[q.DATA_MASK_010,new At(q.DATA_MASK_010,((e,t)=>t%3==0))],[q.DATA_MASK_011,new At(q.DATA_MASK_011,((e,t)=>(e+t)%3==0))],[q.DATA_MASK_100,new At(q.DATA_MASK_100,((e,t)=>!(Math.floor(e/2)+Math.floor(t/3)&1)))],[q.DATA_MASK_101,new At(q.DATA_MASK_101,((e,t)=>e*t%6==0))],[q.DATA_MASK_110,new At(q.DATA_MASK_110,((e,t)=>e*t%6<3))],[q.DATA_MASK_111,new At(q.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 C;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 C}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 C}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 C;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 h=0;for(let t=0;t<u;t++)for(let n=0;n<a;n++)s[n].codewords[t]=e[h++];for(let t=c;t<a;t++)s[t].codewords[u]=e[h++];const f=s[0].codewords.length;for(let t=u;t<f;t++)for(let n=0;n<a;n++){const r=n<c?t:t+1;s[n].codewords[r]=e[h++]}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"}(j||(j={}));class Tt{constructor(e,t,n,r){this.value=e,this.stringValue=t,this.characterCountBitsForVersions=n,this.bits=r,Tt.FOR_BITS.set(r,this),Tt.FOR_VALUE.set(e,this)}static forBits(e){const t=Tt.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 Tt))return!1;const t=e;return this.value===t.value}toString(){return this.stringValue}}Tt.FOR_BITS=new Map,Tt.FOR_VALUE=new Map,Tt.TERMINATOR=new Tt(j.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),Tt.NUMERIC=new Tt(j.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),Tt.ALPHANUMERIC=new Tt(j.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),Tt.STRUCTURED_APPEND=new Tt(j.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),Tt.BYTE=new Tt(j.BYTE,"BYTE",Int32Array.from([8,16,16]),4),Tt.ECI=new Tt(j.ECI,"ECI",Int32Array.from([0,0,0]),7),Tt.KANJI=new Tt(j.KANJI,"KANJI",Int32Array.from([8,10,12]),8),Tt.FNC1_FIRST_POSITION=new Tt(j.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),Tt.FNC1_SECOND_POSITION=new Tt(j.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),Tt.HANZI=new Tt(j.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class Nt{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=Tt.TERMINATOR;else{const t=i.readBits(4);e=Tt.forBits(t)}switch(e){case Tt.TERMINATOR:break;case Tt.FNC1_FIRST_POSITION:case Tt.FNC1_SECOND_POSITION:c=!0;break;case Tt.STRUCTURED_APPEND:if(i.available()<16)throw new C;a=i.readBits(8),l=i.readBits(8);break;case Tt.ECI:const d=Nt.parseECIValue(i);if(n=$.getCharacterSetECIByValue(d),null===n)throw new C;break;case Tt.HANZI:const u=i.readBits(4),h=i.readBits(e.getCharacterCountBits(t));u===Nt.GB2312_SUBSET&&Nt.decodeHanziSegment(i,o,h);break;default:const f=i.readBits(e.getCharacterCountBits(t));switch(e){case Tt.NUMERIC:Nt.decodeNumericSegment(i,o,f);break;case Tt.ALPHANUMERIC:Nt.decodeAlphanumericSegment(i,o,f,c);break;case Tt.BYTE:Nt.decodeByteSegment(i,o,f,n,s,r);break;case Tt.KANJI:Nt.decodeKanjiSegment(i,o,f);break;default:throw new C}}}while(e!==Tt.TERMINATOR)}catch(e){throw new C}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 C;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 C(e)}}static decodeKanjiSegment(e,t,n){if(13*n>e.available())throw new C;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 C(e)}}static decodeByteSegment(e,t,n,r,i,o){if(8*n>e.available())throw new C;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 C(e)}i.push(s)}static toAlphaNumericChar(e){if(e>=Nt.ALPHANUMERIC_CHARS.length)throw new C;return Nt.ALPHANUMERIC_CHARS[e]}static decodeAlphanumericSegment(e,t,n,r){const i=t.length();for(;n>1;){if(e.available()<11)throw new C;const r=e.readBits(11);t.append(Nt.toAlphaNumericChar(Math.floor(r/45))),t.append(Nt.toAlphaNumericChar(r%45)),n-=2}if(1===n){if(e.available()<6)throw new C;t.append(Nt.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 C;const r=e.readBits(10);if(r>=1e3)throw new C;t.append(Nt.toAlphaNumericChar(Math.floor(r/100))),t.append(Nt.toAlphaNumericChar(Math.floor(r/10)%10)),t.append(Nt.toAlphaNumericChar(r%10)),n-=3}if(2===n){if(e.available()<7)throw new C;const n=e.readBits(7);if(n>=100)throw new C;t.append(Nt.toAlphaNumericChar(Math.floor(n/10))),t.append(Nt.toAlphaNumericChar(n%10))}else if(1===n){if(e.available()<4)throw new C;const n=e.readBits(4);if(n>=10)throw new C;t.append(Nt.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 C}}Nt.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Nt.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(T.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 Nt.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 h}for(let r=0;r<t;r++)e[r]=n[r]}}class kt 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 kt(r,i,o)}}class Ot{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 N}static centerFromEnd(e,t){return t-e[2]-e[1]/2}foundPatternCross(e){const t=this.moduleSize,n=t/2;for(let r=0;r<3;r++)if(Math.abs(t-e[r])>=n)return!1;return!0}crossCheckVertical(e,t,n,r){const 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)?Ot.centerFromEnd(s,a):NaN}handlePossibleCenter(e,t,n){const r=e[0]+e[1]+e[2],i=Ot.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 kt(i,o,t);this.possibleCenters.push(n),null!==this.resultPointCallback&&void 0!==this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(n)}return null}}class xt 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 xt(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 Bt{constructor(e,t){this.image=e,this.resultPointCallback=t,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=t}getImage(){return this.image}getPossibleCenters(){return this.possibleCenters}find(e){const t=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*Bt.MAX_MODULES));(s<Bt.MIN_SKIP||t)&&(s=Bt.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(Bt.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]++;Bt.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&&Bt.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:Bt.foundPatternCross(s)?Bt.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:Bt.foundPatternCross(s)?Bt.centerFromEnd(s,a):NaN}handlePossibleCenter(e,t,n,r){const i=e[0]+e[1]+e[2]+e[3]+e[4];let o=Bt.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 xt(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()>=Bt.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()>=Bt.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 N;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]]}}Bt.CENTER_QUORUM=2,Bt.MIN_SKIP=3,Bt.MAX_MODULES=57;class Pt{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 Bt(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 N("No pattern found in proccess finder.");const o=Pt.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 N))throw e}}const c=Pt.createTransform(t,n,r,l,o),d=Pt.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 fe.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 N("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,h=t;n!==u;n+=l){const l=i?h:n,u=i?n:h;if(1===d===this.image.get(l,u)){if(2===d)return ie.distance(n,h,e,t);d++}if(a+=s,a>0){if(h===r)break;h+=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 N("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 N("Alignment bottom exceeds estimated module size.");return new Ot(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 Pt(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 N;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 N;if(o-i!=a-s&&(a=s+(o-i),a>=e.getWidth()))throw new N;const l=Math.round((a-s+1)/r),c=Math.round((o-i+1)/r);if(l<=0||c<=0)throw new N;if(c!==l)throw new N;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 N;s-=u}const h=i+Math.floor((c-1)*r)-o;if(h>0){if(h>d)throw new N;i-=h}const f=new T(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)&&f.set(i,t)}return f}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 N;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 Ht{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 Ht(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 Ht?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 Ht(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 Ht(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 Ht(this.field,t)}multiplyScalar(e){if(0===e)return new Ht(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 Ht(this.field,n)}multiplyByMonomial(e,t){if(e<0)throw new d;if(0===t)return new Ht(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 Ht(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 Wt{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 zt extends Wt{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 Ht(this,new Int32Array([0])),this.one=new Ht(this,new Int32Array([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new d;if(0===t)return this.zero;let n=new Int32Array(e+1);return n[0]=t,new Ht(this,n)}}zt.PDF417_GF=new zt(Ft.NUMBER_OF_CODEWORDS,3);class qt{constructor(){this.field=zt.PDF417_GF}decode(e,t,n){let r=new Ht(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 Ht(this.field,new Int32Array([this.field.subtract(0,n),1]));s=s.multiply(r)}let a=new Ht(this.field,i),l=this.runEuclideanAlgorithm(this.field.buildMonomial(t,1),a,t),c=l[0],d=l[1],u=this.findErrorLocations(c),f=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 h.getChecksumInstance();e[n]=this.field.subtract(e[n],f[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 h.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 h.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 h.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 Ht(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 jt{constructor(e,t,n,r,i){e instanceof jt?this.constructor_2(e):this.constructor_1(e,t,n,r,i)}constructor_1(e,t,n,r,i){const o=null==t||null==n,s=null==r||null==i;if(o&&s)throw new N;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 jt(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 jt(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 jt(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!==Jl)return Jl.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 hn{static decode(e,t){let n=new S(""),r=$.ISO8859_1;n.enableDecoding(r);let i=1,o=e[i++],s=new tn;for(;i<e[0];){switch(o){case hn.TEXT_COMPACTION_MODE_LATCH:i=hn.textCompaction(e,i,n);break;case hn.BYTE_COMPACTION_MODE_LATCH:case hn.BYTE_COMPACTION_MODE_LATCH_6:i=hn.byteCompaction(o,e,r,i,n);break;case hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(e[i++]);break;case hn.NUMERIC_COMPACTION_MODE_LATCH:i=hn.numericCompaction(e,i,n);break;case hn.ECI_CHARSET:$.getCharacterSetECIByValue(e[i++]);break;case hn.ECI_GENERAL_PURPOSE:i+=2;break;case hn.ECI_USER_DEFINED:i++;break;case hn.BEGIN_MACRO_PDF417_CONTROL_BLOCK:i=hn.decodeMacroBlock(e,i,s);break;case hn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case hn.MACRO_PDF417_TERMINATOR:throw new C;default:i--,i=hn.textCompaction(e,i,n)}if(!(i<e.length))throw C.getFormatInstance();o=e[i++]}if(0===n.length())throw C.getFormatInstance();let a=new Y(null,n.toString(),null,t);return a.setOther(s),a}static decodeMacroBlock(e,t,n){if(t+hn.NUMBER_OF_SEQUENCE_CODEWORDS>e[0])throw C.getFormatInstance();let r=new Int32Array(hn.NUMBER_OF_SEQUENCE_CODEWORDS);for(let n=0;n<hn.NUMBER_OF_SEQUENCE_CODEWORDS;n++,t++)r[n]=e[t];n.setSegmentIndex(y.parseInt(hn.decodeBase900toBase10(r,hn.NUMBER_OF_SEQUENCE_CODEWORDS)));let i=new S;t=hn.textCompaction(e,t,i),n.setFileId(i.toString());let o=-1;for(e[t]===hn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(o=t+1);t<e[0];)switch(e[t]){case hn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(e[++t]){case hn.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let r=new S;t=hn.textCompaction(e,t+1,r),n.setFileName(r.toString());break;case hn.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let i=new S;t=hn.textCompaction(e,t+1,i),n.setSender(i.toString());break;case hn.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let o=new S;t=hn.textCompaction(e,t+1,o),n.setAddressee(o.toString());break;case hn.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let s=new S;t=hn.numericCompaction(e,t+1,s),n.setSegmentCount(y.parseInt(s.toString()));break;case hn.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let a=new S;t=hn.numericCompaction(e,t+1,a),n.setTimestamp(nn.parseLong(a.toString()));break;case hn.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let l=new S;t=hn.numericCompaction(e,t+1,l),n.setChecksum(y.parseInt(l.toString()));break;case hn.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let c=new S;t=hn.numericCompaction(e,t+1,c),n.setFileSize(nn.parseLong(c.toString()));break;default:throw C.getFormatInstance()}break;case hn.MACRO_PDF417_TERMINATOR:t++,n.setLastSegment(!0);break;default:throw C.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<hn.TEXT_COMPACTION_MODE_LATCH)r[o]=n/30,r[o+1]=n%30,o+=2;else switch(n){case hn.TEXT_COMPACTION_MODE_LATCH:r[o++]=hn.TEXT_COMPACTION_MODE_LATCH;break;case hn.BYTE_COMPACTION_MODE_LATCH:case hn.BYTE_COMPACTION_MODE_LATCH_6:case hn.NUMERIC_COMPACTION_MODE_LATCH:case hn.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case hn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case hn.MACRO_PDF417_TERMINATOR:t--,s=!0;break;case hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r[o]=hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,n=e[t++],i[o]=n,o++}}return hn.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 hn.LL:i=G.LOWER;break;case hn.ML:i=G.MIXED;break;case hn.PS:o=i,i=G.PUNCT_SHIFT;break;case hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[s]);break;case hn.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 hn.AS:o=i,i=G.ALPHA_SHIFT;break;case hn.ML:i=G.MIXED;break;case hn.PS:o=i,i=G.PUNCT_SHIFT;break;case hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[s]);break;case hn.TEXT_COMPACTION_MODE_LATCH:i=G.ALPHA}break;case G.MIXED:if(n<hn.PL)a=hn.MIXED_CHARS[n];else switch(n){case hn.PL:i=G.PUNCT;break;case 26:a=" ";break;case hn.LL:i=G.LOWER;break;case hn.AL:i=G.ALPHA;break;case hn.PS:o=i,i=G.PUNCT_SHIFT;break;case hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[s]);break;case hn.TEXT_COMPACTION_MODE_LATCH:i=G.ALPHA}break;case G.PUNCT:if(n<hn.PAL)a=hn.PUNCT_CHARS[n];else switch(n){case hn.PAL:i=G.ALPHA;break;case hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[s]);break;case hn.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 hn.TEXT_COMPACTION_MODE_LATCH:i=G.ALPHA}break;case G.PUNCT_SHIFT:if(i=o,n<hn.PAL)a=hn.PUNCT_CHARS[n];else switch(n){case hn.PAL:i=G.ALPHA;break;case hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[s]);break;case hn.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 hn.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 hn.TEXT_COMPACTION_MODE_LATCH:case hn.BYTE_COMPACTION_MODE_LATCH:case hn.NUMERIC_COMPACTION_MODE_LATCH:case hn.BYTE_COMPACTION_MODE_LATCH_6:case hn.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case hn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case hn.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<hn.TEXT_COMPACTION_MODE_LATCH&&(e[s++]=n);for(let t=0;t<s;t++)o.write(e[t]);break;case hn.BYTE_COMPACTION_MODE_LATCH_6:for(;r<t[0]&&!l;){let e=t[r++];if(e<hn.TEXT_COMPACTION_MODE_LATCH)s++,a=900*a+e;else switch(e){case hn.TEXT_COMPACTION_MODE_LATCH:case hn.BYTE_COMPACTION_MODE_LATCH:case hn.NUMERIC_COMPACTION_MODE_LATCH:case hn.BYTE_COMPACTION_MODE_LATCH_6:case hn.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case hn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case hn.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(hn.MAX_NUMERIC_CODEWORDS);for(;t<e[0]&&!i;){let s=e[t++];if(t===e[0]&&(i=!0),s<hn.TEXT_COMPACTION_MODE_LATCH)o[r]=s,r++;else switch(s){case hn.TEXT_COMPACTION_MODE_LATCH:case hn.BYTE_COMPACTION_MODE_LATCH:case hn.BYTE_COMPACTION_MODE_LATCH_6:case hn.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case hn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case hn.MACRO_PDF417_TERMINATOR:t--,i=!0}(r%hn.MAX_NUMERIC_CODEWORDS==0||s===hn.NUMERIC_COMPACTION_MODE_LATCH||i)&&r>0&&(n.append(hn.decodeBase900toBase10(o,r)),r=0)}return t}static decodeBase900toBase10(e,t){let n=dn(0);for(let r=0;r<t;r++)n+=hn.EXP900[t-r-1]*dn(e[r]);let r=n.toString();if("1"!==r.charAt(0))throw new C;return r.substring(1)}}hn.TEXT_COMPACTION_MODE_LATCH=900,hn.BYTE_COMPACTION_MODE_LATCH=901,hn.NUMERIC_COMPACTION_MODE_LATCH=902,hn.BYTE_COMPACTION_MODE_LATCH_6=924,hn.ECI_USER_DEFINED=925,hn.ECI_GENERAL_PURPOSE=926,hn.ECI_CHARSET=927,hn.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,hn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,hn.MACRO_PDF417_TERMINATOR=922,hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,hn.MAX_NUMERIC_CODEWORDS=15,hn.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,hn.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,hn.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,hn.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,hn.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,hn.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,hn.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,hn.PL=25,hn.LL=27,hn.AS=27,hn.ML=28,hn.AL=28,hn.PS=29,hn.PAL=29,hn.PUNCT_CHARS=";<>@[\\]_`~!\r\t,:\n-.$/\"|*()?{}'",hn.MIXED_CHARS="0123456789&\r\t,:#-.$/+%*=^",hn.EXP900=ln()?un():[],hn.NUMBER_OF_SEQUENCE_CODEWORDS=2;class fn{constructor(){}static decode(e,t,n,r,i,o,s){let a,l=new jt(e,t,n,r,i),c=null,d=null;for(let n=!0;;n=!1){if(null!=t&&(c=fn.getRowIndicatorColumn(e,l,t,!0,o,s)),null!=r&&(d=fn.getRowIndicatorColumn(e,l,r,!1,o,s)),a=fn.merge(c,d),null==a)throw N.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 h=null!=c;for(let t=1;t<=u;t++){let n,r=h?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=fn.getStartColumn(a,r,t,h),i<0||i>l.getMaxX()){if(-1===c)continue;i=c}let d=fn.detectCodeword(e,l.getMinX(),l.getMaxX(),h,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 fn.createDecoderResult(a)}static merge(e,t){if(null==e&&null==t)return null;let n=fn.getBarcodeMetadata(e,t);if(null==n)return null;let r=jt.merge(fn.adjustBoundingBox(e),fn.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=fn.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=fn.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()-fn.getNumberOfECCodeWords(e.getBarcodeECLevel());if(0===r.length){if(i<1||i>Ft.MAX_CODEWORDS_IN_BARCODE)throw N.getNotFoundInstance();n.setValue(i)}else r[0]!==i&&n.setValue(i)}static createDecoderResult(e){let t=fn.createBarcodeMatrix(e);fn.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 fn.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 fn.decodeCodewords(t,e,n)}catch(e){if(!(e instanceof h))throw e}if(0===o.length)throw h.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 h.getChecksumInstance()}}throw h.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(fn.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(fn.isValidBarcodeColumn(e,t-i)&&(o=e.getDetectionResultColumn(t-i).getCodewordNearby(n)),null!=o)return r?o.getEndX():o.getStartX();let s=0;for(;fn.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=fn.adjustCodewordStartColumn(e,t,n,r,i,o);let l,c=fn.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(!fn.checkCodewordSkew(d,s,a))return null;let u=en.getDecodedValue(c),h=Ft.getCodeword(u);return-1===h?null:new Jt(i,l,fn.getCodewordBucketNumber(u),h)}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)>fn.CODEWORD_SKEW_SIZE)return i;s+=a}a=-a,r=!r}return s}static checkCodewordSkew(e,t,n){return t-fn.CODEWORD_SKEW_SIZE<=e&&e<=n+fn.CODEWORD_SKEW_SIZE}static decodeCodewords(e,t,n){if(0===e.length)throw C.getFormatInstance();let r=1<<t+1,i=fn.correctErrors(e,n,r);fn.verifyCodewordCount(e,r);let o=hn.decode(e,""+t);return o.setErrorsCorrected(i),o.setErasures(n.length),o}static correctErrors(e,t,n){if(null!=t&&t.length>n/2+fn.MAX_ERRORS||n<0||n>fn.MAX_EC_CODEWORDS)throw h.getChecksumInstance();return fn.errorCorrection.decode(e,n,t)}static verifyCodewordCount(e,t){if(e.length<4)throw C.getFormatInstance();let n=e[0];if(n>e.length)throw C.getFormatInstance();if(0===n){if(!(t<e.length))throw C.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 fn.getCodewordBucketNumber(fn.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()}}fn.CODEWORD_SKEW_SIZE=2,fn.MAX_ERRORS=3,fn.MAX_EC_CODEWORDS=512,fn.errorCorrection=new qt;class mn{decode(e,t=null){let n=mn.decode(e,t,!1);if(null==n||0===n.length||null==n[0])throw N.getNotFoundInstance();return n[0]}decodeMultiple(e,t=null){try{return mn.decode(e,t,!0)}catch(e){if(e instanceof C||e instanceof h)throw N.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=fn.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 N("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 Cn{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 $n{constructor(){}static applyMaskPenaltyRule1(e){return $n.applyMaskPenaltyRule1Internal(e,!0)+$n.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 $n.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]&&($n.isWhiteHorizontal(s,o-4,o)||$n.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]&&($n.isWhiteVertical(n,o,e-4,e)||$n.isWhiteVertical(n,o,e+7,e+11))&&t++}return t*$n.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)*$n.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+=$n.N1+(r-5)),r=1,s=i)}r>=5&&(n+=$n.N1+(r-5))}return n}}$n.N1=3,$n.N2=3,$n.N3=40,$n.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&&$n.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 Tn{constructor(e,t){this.dataBytes=e,this.errorCorrectionBytes=t}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class Nn{constructor(){}static calculateMaskPenalty(e){return $n.applyMaskPenaltyRule1(e)+$n.applyMaskPenaltyRule2(e)+$n.applyMaskPenaltyRule3(e)+$n.applyMaskPenaltyRule4(e)}static encode(e,t,n=null){let r=Nn.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===Tt.BYTE&&(i||Nn.DEFAULT_BYTE_MODE_ENCODING!==r)){const e=$.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===Tt.BYTE?a.getSizeInBytes():e.length;this.appendLengthInfo(d,l,o,c),c.appendBitArray(a);const u=l.getECBlocksForLevel(t),h=l.getTotalCodewords()-u.getTotalECCodewords();this.terminateBits(h,c);const f=this.interleaveWithECBytes(c,l.getTotalCodewords(),h,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(f,t,l,g);return m.setMaskPattern(w),Sn.buildMatrix(f,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<Nn.ALPHANUMERIC_TABLE.length?Nn.ALPHANUMERIC_TABLE[e]:-1}static chooseMode(e,t=null){if($.SJIS.getName()===t&&this.isOnlyDoubleByteKanji(e))return Tt.KANJI;let n=!1,r=!1;for(let t=0,i=e.length;t<i;++t){const i=e.charAt(t);if(Nn.isDigit(i))n=!0;else{if(-1===this.getAlphanumericCode(i.charCodeAt(0)))return Tt.BYTE;r=!0}}return r?Tt.ALPHANUMERIC:n?Tt.NUMERIC:Tt.BYTE}static isOnlyDoubleByteKanji(e){let t;try{t=A.encode(e,$.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(Nn.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,h=l-d,f=c-u;if(h!==f)throw new bn("EC bytes mismatch");if(n!==a+s)throw new bn("RS blocks mismatch");if(e!==(d+h)*a+(u+f)*s)throw new bn("Total bytes mismatch");r<a?(i[0]=d,o[0]=h):(i[0]=u,o[0]=f)}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);Nn.getNumDataBytesAndNumECBytesForBlockID(t,n,r,l,c,d);const u=c[0],h=new Uint8Array(u);e.toBytes(8*i,h,0,u);const f=Nn.generateECBytes(h,d[0]);a.push(new Tn(h,f)),o=Math.max(o,u),s=Math.max(s,f.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 Cn(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 Tt.NUMERIC:Nn.appendNumericBytes(e,n);break;case Tt.ALPHANUMERIC:Nn.appendAlphanumericBytes(e,n);break;case Tt.BYTE:Nn.append8BitBytes(e,n,r);break;case Tt.KANJI:Nn.appendKanjiBytes(e,n);break;default:throw new bn("Invalid mode: "+t)}}static getDigit(e){return e.charCodeAt(0)-48}static isDigit(e){const t=Nn.getDigit(e);return t>=0&&t<=9}static appendNumericBytes(e,t){const n=e.length;let r=0;for(;r<n;){const i=Nn.getDigit(e.charAt(r));if(r+2<n){const n=Nn.getDigit(e.charAt(r+1)),o=Nn.getDigit(e.charAt(r+2));t.appendBits(100*i+10*n+o,10),r+=3}else if(r+1<n){const n=Nn.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=Nn.getAlphanumericCode(e.charCodeAt(r));if(-1===i)throw new bn;if(r+1<n){const n=Nn.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,$.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(Tt.ECI.getBits(),4),t.appendBits(e.getValue(),8)}}Nn.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]),Nn.DEFAULT_BYTE_MODE_ENCODING=$.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=Nn.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)),h=Math.floor((c-o*u)/2),f=Math.floor((d-s*u)/2),m=this.createSVGElement(c,d);for(let e=0,t=f;e<s;e++,t+=u)for(let n=0,r=h;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=Nn.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)),h=Math.floor((c-o*u)/2),f=Math.floor((d-s*u)/2),m=new T(c,d);for(let e=0,t=f;e<s;e++,t+=u)for(let n=0,r=h;n<o;n++,r+=u)1===i.get(n,e)&&m.setRegion(r,t,u,u);return m}}Dn.QUIET_ZONE_SIZE=4;class kn{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 On extends k{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 On(this.yuvData,this.dataWidth,this.dataHeight,this.left+e,this.top+t,n,r,!1)}renderThumbnail(){const e=this.getWidth()/On.THUMBNAIL_SCALE_FACTOR,t=this.getHeight()/On.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*On.THUMBNAIL_SCALE_FACTOR];n[t+o]=4278190080|65793*e}i+=this.dataWidth*On.THUMBNAIL_SCALE_FACTOR}return n}getThumbnailWidth(){return this.getWidth()/On.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/On.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 O(this)}}On.THUMBNAIL_SCALE_FACTOR=2;class xn extends k{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 xn(this.luminances,n,r,this.dataWidth,this.dataHeight,this.left+e,this.top+t)}invert(){return new O(this)}}class Mn extends ${static forName(e){return this.getCharacterSetECIByName(e)}}class Bn{}Bn.ISO_8859_1=$.ISO8859_1;class Pn{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 Hn(e,t,n){return new Un(e,t,n)}function Wn(e,t,n){return new Vn(e,t,n)}const zn=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],qn=0,jn=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[qn][Yn]=0,e[jn][Yn]=0,e[jn][qn]=28,e[Xn][Yn]=0,e[Gn][Yn]=0,e[Gn][qn]=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=Wn(r,65535&t,t>>16),n+=t>>16}let i=e===Gn?4:5;return r=Wn(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=Wn(n,Jn[this.mode][e],r),n=Wn(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][qn];t=Wn(t,65535&e,e>>16),r+=e>>16,n=qn}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=Hn(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",zn[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[qn][t]=1;const i=b.getCharCode("Z"),o=b.getCharCode("A");for(let t=o;t<=i;t++)e[qn][t]=t-o+2;e[jn][t]=1;const s=b.getCharCode("z"),a=b.getCharCode("a");for(let t=a;t<=s;t++)e[jn][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,qn,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 h,f=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){h=g;for(let e=0;e<w.length;e++)w[e]=e}else{h=g+1+2*y.truncDivision(y.truncDivision(g,2)-1,15);let e=y.truncDivision(g,2),t=y.truncDivision(h,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 T(h);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++)f.get(t+i+o)&&v.set(w[2*e+o],w[2*e+r]),f.get(t+2*n+i+o)&&v.set(w[2*e+r],w[g-1-2*e-o]),f.get(t+4*n+i+o)&&v.set(w[g-1-2*e-o],w[g-1-2*e-r]),f.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,h,p),r)ir.drawBullsEye(v,y.truncDivision(h,2),5);else{ir.drawBullsEye(v,y.truncDivision(h,2),7);for(let e=0,t=0;e<y.truncDivision(g,2)-1;e+=15,t+=16)for(let e=1&y.truncDivision(h,2);e<h;e+=2)v.set(y.truncDivision(h,2)-t,e),v.set(y.truncDivision(h,2)+t,e),v.set(e,y.truncDivision(h,2)-t),v.set(e,y.truncDivision(h,2)+t)}let _=new Pn;return _.setCompact(r),_.setSize(h),_.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 Cn(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--):s&i?n.appendBits(s,t):(n.appendBits(1|s,t),o--)}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=Bn.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 T(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=ze,e.ArgumentException=c,e.ArithmeticException=Q,e.AztecCode=Pn,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=f,e.BinaryBitmap=u,e.BitArray=v,e.BitMatrix=T,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=$,e.ChecksumException=h,e.Code128Reader=ve,e.Code39Reader=_e,e.DataMatrixDecodedBitStreamParser=pt,e.DataMatrixReader=yt,e.DecodeHintType=I,e.DecoderResult=Y,e.DefaultGridSampler=he,e.DetectorResult=ae,e.EAN13Reader=Se,e.EncodeHintType=In,e.Exception=l,e.FormatException=C,e.GenericGF=J,e.GenericGFPoly=K,e.GlobalHistogramBinarizer=R,e.GridSampler=de,e.GridSamplerInstance=fe,e.HTMLCanvasElementLuminanceSource=x,e.HybridBinarizer=D,e.ITFReader=Ie,e.IllegalArgumentException=d,e.IllegalStateException=te,e.InvertedLuminanceSource=O,e.LuminanceSource=k,e.MathUtils=ie,e.MultiFormatOneDReader=at,e.MultiFormatReader=gn,e.MultiFormatWriter=kn,e.NotFoundException=N,e.OneDReader=ye,e.PDF417DecodedBitStreamParser=hn,e.PDF417DecoderErrorCorrection=qt,e.PDF417Reader=mn,e.PDF417ResultMetadata=tn,e.PerspectiveTransform=ue,e.PlanarYUVLuminanceSource=On,e.QRCodeByteMatrix=En,e.QRCodeDataMask=At,e.QRCodeDecodedBitStreamParser=Nt,e.QRCodeDecoderErrorCorrectionLevel=_t,e.QRCodeDecoderFormatInformation=It,e.QRCodeEncoder=Nn,e.QRCodeEncoderQRCode=An,e.QRCodeMaskUtil=$n,e.QRCodeMatrixUtil=Sn,e.QRCodeMode=Tt,e.QRCodeReader=Lt,e.QRCodeVersion=Et,e.QRCodeWriter=Dn,e.RGBLuminanceSource=xn,e.RSS14Reader=st,e.RSSExpandedReader=it,e.ReaderException=pn,e.ReedSolomonDecoder=ne,e.ReedSolomonEncoder=Cn,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=Bn,e.ZXingStringBuilder=S,e.ZXingStringEncoding=A,e.ZXingSystem=m,e.createAbstractExpandedDecoder=tt,Object.defineProperty(e,"__esModule",{value:!0})}(t)})),oc=f({__proto__:null,default:ec(ic)},[ic]),sc=function(){function e(e,t,n){if(this.formatMap=new Map([[Fl.QR_CODE,ic.BarcodeFormat.QR_CODE],[Fl.AZTEC,ic.BarcodeFormat.AZTEC],[Fl.CODABAR,ic.BarcodeFormat.CODABAR],[Fl.CODE_39,ic.BarcodeFormat.CODE_39],[Fl.CODE_93,ic.BarcodeFormat.CODE_93],[Fl.CODE_128,ic.BarcodeFormat.CODE_128],[Fl.DATA_MATRIX,ic.BarcodeFormat.DATA_MATRIX],[Fl.MAXICODE,ic.BarcodeFormat.MAXICODE],[Fl.ITF,ic.BarcodeFormat.ITF],[Fl.EAN_13,ic.BarcodeFormat.EAN_13],[Fl.EAN_8,ic.BarcodeFormat.EAN_8],[Fl.PDF_417,ic.BarcodeFormat.PDF_417],[Fl.RSS_14,ic.BarcodeFormat.RSS_14],[Fl.RSS_EXPANDED,ic.BarcodeFormat.RSS_EXPANDED],[Fl.UPC_A,ic.BarcodeFormat.UPC_A],[Fl.UPC_E,ic.BarcodeFormat.UPC_E],[Fl.UPC_EAN_EXTENSION,ic.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!oc)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(ic.DecodeHintType.POSSIBLE_FORMATS,r),i.set(ic.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 ic.MultiFormatReader(this.verbose,this.hints),n=new ic.HTMLCanvasElementLuminanceSource(e),r=new ic.BinaryBitmap(new ic.HybridBinarizer(n)),i=t.decode(r);return{text:i.text,format:jl.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}(),ac=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())}))},lc=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])}}},cc=function(){function e(t,n,r){if(this.formatMap=new Map([[Fl.QR_CODE,"qr_code"],[Fl.AZTEC,"aztec"],[Fl.CODABAR,"codabar"],[Fl.CODE_39,"code_39"],[Fl.CODE_93,"code_93"],[Fl.CODE_128,"code_128"],[Fl.DATA_MATRIX,"data_matrix"],[Fl.ITF,"itf"],[Fl.EAN_13,"ean_13"],[Fl.EAN_8,"ean_8"],[Fl.PDF_417,"pdf417"],[Fl.UPC_A,"upc_a"],[Fl.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 ac(this,void 0,void 0,(function(){var t,n;return lc(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:jl.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}(),dc=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())}))},uc=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])}}},hc=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&&cc.isSupported()?(this.primaryDecoder=new cc(e,n,r),this.secondaryDecoder=new sc(e,n,r)):this.primaryDecoder=new sc(e,n,r)}return e.prototype.decodeAsync=function(e){return dc(this,void 0,void 0,(function(){var t;return uc(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 dc(this,void 0,void 0,(function(){var t,n;return uc(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}(),fc=(nc=function(e,t){return nc=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])},nc(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}nc(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),mc=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())}))},pc=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])}}},gc=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}(),wc=function(e){function t(t){return e.call(this,"zoom",t)||this}return fc(t,e),t}(function(e){function t(t,n){return e.call(this,t,n)||this}return fc(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}(gc)),yc=function(e){function t(t){return e.call(this,"torch",t)||this}return fc(t,e),t}(gc),vc=function(){function e(e){this.track=e}return e.prototype.zoomFeature=function(){return new wc(this.track)},e.prototype.torchFeature=function(){return new yc(this.track)},e}(),_c=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 mc(this,void 0,void 0,(function(){var o,s;return pc(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 mc(this,void 0,void 0,(function(){return pc(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 vc(this.getFirstTrackOrFail())},e}(),Ic=function(){function e(e){this.mediaStream=e}return e.prototype.render=function(e,t,n){return mc(this,void 0,void 0,(function(){return pc(this,(function(r){return[2,_c.create(e,this.mediaStream,t,n)]}))}))},e.create=function(t){return mc(this,void 0,void 0,(function(){var n;return pc(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}(),Cc=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())}))},$c=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])}}},Ec=function(){function e(){}return e.failIfNotSupported=function(){return Cc(this,void 0,void 0,(function(){return $c(this,(function(t){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new e]}))}))},e.prototype.create=function(e){return Cc(this,void 0,void 0,(function(){return $c(this,(function(t){return[2,Ic.create(e)]}))}))},e}(),Ac=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())}))},bc=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])}}},Sc=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=Kl.unableToQuerySupportedDevices();return e.isHttpsOrLocalhost()||(t=Kl.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 Ac(this,void 0,void 0,(function(){var e,t,n,r,i,o,s;return bc(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"}(rc||(rc={}));var Tc,Nc=function(){function e(){this.state=rc.NOT_STARTED,this.onGoingTransactionNewState=rc.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===rc.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var e=this.onGoingTransactionNewState;this.onGoingTransactionNewState=rc.UNKNOWN,this.directTransition(e)},e.prototype.cancel=function(){if(this.onGoingTransactionNewState===rc.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=rc.UNKNOWN},e.prototype.getState=function(){return this.state},e.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==rc.UNKNOWN)throw"Cannot transition to a new state, already under transition"},e.prototype.validateTransition=function(e){switch(this.state){case rc.UNKNOWN:throw"Transition from unknown is not allowed";case rc.NOT_STARTED:this.failIfNewStateIs(e,[rc.PAUSED]);case rc.SCANNING:case rc.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}(),Rc=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()===rc.NOT_STARTED},e.prototype.isScanning=function(){return this.stateManager.getState()!==rc.NOT_STARTED},e.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===rc.SCANNING},e.prototype.isPaused=function(){return this.stateManager.getState()===rc.PAUSED},e}(),Dc=function(){function e(){}return e.create=function(){return new Rc(new Nc)},e}(),kc=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)}}(),Oc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return kc(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}(ql),xc=function(){function e(e,t){this.logger=t,this.fps=Oc.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=Oc.DEFAULT_DISABLE_FLIP}return e.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?Ql.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},e.prototype.isShadedBoxEnabled=function(){return!Zl(this.qrbox)},e.create=function(t,n){return new e(t,n)},e}(),Mc=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 Yl(this.verbose),this.qrcode=new hc(this.getSupportedFormats(t),this.getUseBarCodeDetectorIfSupported(n),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=Dc.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=xc.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:Oc.DEFAULT_WIDTH,c.style.position="relative",this.shouldScan=!0,this.element=c;var d=this,u=this.stateManagerProxy.startTransition(rc.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 h={onRenderSurfaceReady:function(e,t){d.setupUi(e,t,s),d.isScanning=!0,d.foreverScan(s,n,i)}};Ec.failIfNotSupported().then((function(e){e.create(a).then((function(e){return e.render(o.element,c,h).then((function(e){d.renderedCamera=e,u.execute(),t(null)})).catch((function(e){u.cancel(),r(e)}))})).catch((function(e){u.cancel(),r(Kl.errorGettingUserMedia(e))}))})).catch((function(e){u.cancel(),r(Kl.cameraStreamingNotSupported())}))}))},e.prototype.pause=function(e){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(rc.PAUSED),this.showPausedState(),(Zl(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(rc.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(rc.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(Oc.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(Zl(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:Oc.DEFAULT_WIDTH,c=Math.max(a.clientHeight?a.clientHeight:s,Oc.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 h=u.getContext("2d");if(!h)throw"Unable to get 2d context from canvas";h.canvas.width=l,h.canvas.height=c,h.drawImage(o,0,0,e,s,d.x,d.y,d.width,d.height)}var f=Oc.FILE_SCAN_HIDDEN_CANVAS_PADDING,m=Math.max(o.width,d.width),p=Math.max(o.height,d.height),g=m+2*f,w=p+2*f,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,f,f,m,p);try{n.qrcode.decodeRobustlyAsync(y).then((function(e){r(Gl.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 Sc.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(!Ql.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=[Fl.QR_CODE,Fl.AZTEC,Fl.CODABAR,Fl.CODE_39,Fl.CODE_93,Fl.CODE_128,Fl.DATA_MATRIX,Fl.MAXICODE,Fl.ITF,Fl.EAN_13,Fl.EAN_8,Fl.PDF_417,Fl.RSS_14,Fl.RSS_EXPANDED,Fl.UPC_A,Fl.UPC_E,Fl.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];Wl(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(Zl(e))return!0;if(!Zl(e.useBarCodeDetectorIfSupported))return!1!==e.useBarCodeDetectorIfSupported;if(Zl(e.experimentalFeatures))return!0;var t=e.experimentalFeatures;return!!Zl(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<Oc.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(Oc.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=Zl(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=Kl.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,Gl.createFromQrcodeResult(t)),n.possiblyUpdateShaders(!0),!0})).catch((function(e){n.possiblyUpdateShaders(!1);var r=Kl.codeParseError(e);return t(r,Xl.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?Oc.BORDER_SHADER_MATCH_COLOR:Oc.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=Zl(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(Oc.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=Oc.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 Bc(e,t,n){const r=e.slice();return r[19]=t[n].id,r[20]=t[n].label,r}function Pc(e){let t,n,r=e[1]&&Lc(e);return{c(){r&&r.c(),t=B(),n=O("reader"),U(n,"id","reader"),U(n,"class","svelte-9062r9")},m(e,i){r&&r.m(e,i),R(e,t,i),R(e,n,i)},p(e,n){e[1]?r?r.p(e,n):(r=Lc(e),r.c(),r.m(t.parentNode,t)):r&&(r.d(1),r=null)},d(e){r&&r.d(e),e&&D(t),e&&D(n)}}}function Lc(e){let t,n,r,i,o,s,a=e[1],l=[];for(let t=0;t<a.length;t+=1)l[t]=Fc(Bc(e,a,t));return{c(){t=O("div"),n=M("Quelle:\n "),r=O("select");for(let e=0;e<l.length;e+=1)l[e].c();r.disabled=i=1===e[1].length},m(i,a){R(i,t,a),N(t,n),N(t,r);for(let e=0;e<l.length;e+=1)l[e].m(r,null);o||(s=L(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=Bc(e,a,n);l[n]?l[n].p(i,t):(l[n]=Fc(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&&D(t),k(l,e),o=!1,s()}}}function Fc(e){let t,n,r,i,o=e[20]+"";return{c(){t=O("option"),n=M(o),t.__value=r=e[19],t.value=t.__value,t.selected=i=e[2]===e[19]},m(e,r){R(e,t,r),N(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&&D(t)}}}function Vc(e){let t,n=!e[0]&&Pc(e);return{c(){t=O("main"),n&&n.c(),U(t,"class","svelte-9062r9")},m(e,r){R(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=Pc(e),n.c(),n.m(t,null))},i:_,o:_,d(e){e&&D(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"}(Tc||(Tc={}));const Uc=()=>Mc.getCameras();function Hc(e,t,n){let r;const i=K(),{loggedIn:o}=u;b(e,o,(e=>n(9,r=e)));let s,a,l,{keyboard:c}=t,{codeTypes:d=""}=t,{readerInit:h=!1}=t,f=!1;const m=r.tenant+"-ENABLERR-CAMERA";Y((function(){if(c)return void(f=!0);try{s||(s=new Mc("reader"));const e=window.localStorage.getItem(m);Uc().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{}})),Z((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),f=!0}catch{}}async function w(e=!1){try{c||(await s.stop(),e&&await s.clear())}catch{}finally{f=!1}}function y(e,t){f&&(i("scan",{text:e}),f=!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,h=e.readerInit)},e.$$.update=()=>{32&e.$$.dirty&&h&&(f=!0,n(5,h=!1))},[c,a,l,o,async e=>{const t=e.target.value;await w(),window.localStorage.setItem(m,t),g(t)},h,d]}class Wc extends Te{constructor(e){var t;super(),document.getElementById("svelte-9062r9-style")||((t=O("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}",N(document.head,t)),Se(this,e,Hc,Vc,A,{keyboard:0,codeTypes:6,readerInit:5})}}const{document:zc}=Ie;function qc(e,t,n){const r=e.slice();return r[143]=t[n],r[145]=n,r}function jc(e,t,n){const r=e.slice();return r[147]=t[n],r[149]=n,r}function Gc(e,t,n){const r=e.slice();return r[156]=t[n],r}function Xc(e,t,n){const r=e.slice();return r[151]=t[n].title,r[152]=t[n].toDelete,r[153]=t[n].icon,r}function Yc(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function Zc(e){let t,n,r,i,o,s,a,l,c,d,u,h=(!e[2]||e[15]?.length&&e[15].length>1)&&Kc(e),f=e[19]&&Qc(e),m=!1!==e[4].transfer&&e[49]?.length&&ed(e),p=!e[10]&&e[45]&&e[14]&&0!=e[14]&&nd(e),g=!e[10]&&e[43]&&e[17]&&0!=e[17]&&id(e),w=e[41]&&e[13]&&0!=e[13]&&sd(e);l=new e[36]({props:{class:e[6]+e[4].name,$$slots:{default:[vd,({closeOtherPanels:e})=>({146:e}),({closeOtherPanels:e})=>[0,0,0,0,e?4194304:0]]},$$scope:{ctx:e}}});let y=e[19]&&e[22]&&_d(e);return{c(){h&&h.c(),t=B(),n=O("div"),f&&f.c(),r=B(),m&&m.c(),i=B(),p&&p.c(),o=B(),g&&g.c(),s=B(),w&&w.c(),a=B(),Ee(l.$$.fragment),c=B(),y&&y.c(),d=P(),U(n,"class","formList")},m(e,v){h&&h.m(e,v),R(e,t,v),R(e,n,v),f&&f.m(n,null),N(n,r),m&&m.m(n,null),N(n,i),p&&p.m(n,null),N(n,o),g&&g.m(n,null),N(n,s),w&&w.m(n,null),N(n,a),Ae(l,n,null),R(e,c,v),y&&y.m(e,v),R(e,d,v),u=!0},p(e,c){!e[2]||e[15]?.length&&e[15].length>1?h?(h.p(e,c),32772&c[0]&&we(h,1)):(h=Kc(e),h.c(),we(h,1),h.m(t.parentNode,t)):h&&(pe(),ye(h,1,1,(()=>{h=null})),ge()),e[19]?f?(f.p(e,c),524288&c[0]&&we(f,1)):(f=Qc(e),f.c(),we(f,1),f.m(n,r)):f&&(pe(),ye(f,1,1,(()=>{f=null})),ge()),!1!==e[4].transfer&&e[49]?.length?m?(m.p(e,c),16&c[0]&&we(m,1)):(m=ed(e),m.c(),we(m,1),m.m(n,i)):m&&(pe(),ye(m,1,1,(()=>{m=null})),ge()),!e[10]&&e[45]&&e[14]&&0!=e[14]?p?(p.p(e,c),17408&c[0]&&we(p,1)):(p=nd(e),p.c(),we(p,1),p.m(n,o)):p&&(pe(),ye(p,1,1,(()=>{p=null})),ge()),!e[10]&&e[43]&&e[17]&&0!=e[17]?g?(g.p(e,c),132096&c[0]&&we(g,1)):(g=id(e),g.c(),we(g,1),g.m(n,s)):g&&(pe(),ye(g,1,1,(()=>{g=null})),ge()),e[41]&&e[13]&&0!=e[13]?w?(w.p(e,c),8192&c[0]&&we(w,1)):(w=sd(e),w.c(),we(w,1),w.m(n,a)):w&&(pe(),ye(w,1,1,(()=>{w=null})),ge());const u={};80&c[0]&&(u.class=e[6]+e[4].name),1612554239&c[0]|1&c[1]|4194304&c[4]|16&c[5]&&(u.$$scope={dirty:c,ctx:e}),l.$set(u),e[19]&&e[22]?y?(y.p(e,c),4718592&c[0]&&we(y,1)):(y=_d(e),y.c(),we(y,1),y.m(d.parentNode,d)):y&&(pe(),ye(y,1,1,(()=>{y=null})),ge())},i(e){u||(we(h),we(f),we(m),we(p),we(g),we(w),we(l.$$.fragment,e),we(y),u=!0)},o(e){ye(h),ye(f),ye(m),ye(p),ye(g),ye(w),ye(l.$$.fragment,e),ye(y),u=!1},d(e){h&&h.d(e),e&&D(t),e&&D(n),f&&f.d(),m&&m.d(),p&&p.d(),g&&g.d(),w&&w.d(),be(l),e&&D(c),y&&y.d(e),e&&D(d)}}}function Kc(e){let t,n;return t=new e[38]({props:{text:e[4].designation}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};16&n[0]&&(r.text=e[4].designation),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Qc(e){let t,n;return t=new e[35]({props:{disabled:e[1]||!e[0]._id&&e[21].input,filled:!0,style:"opacity: 0.75; margin-bottom: .5em;",$$slots:{default:[Jc]},$$scope:{ctx:e}}}),t.$on("click",e[70]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};2097155&n[0]&&(r.disabled=e[1]||!e[0]._id&&e[21].input),16&n[5]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Jc(e){let t,n,r;return n=new We({props:{size:"18"}}),{c(){t=O("span"),t.textContent="Barcode scannen",Ee(n.$$.fragment),z(t,"margin-right",".75em")},m(e,i){R(e,t,i),Ae(n,e,i),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n,e)}}}function ed(e){let t,n;return t=new e[35]({props:{filled:!0,style:"opacity: 0.75; margin-bottom: .5em;",$$slots:{default:[td]},$$scope:{ctx:e}}}),t.$on("click",e[77]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};16&n[0]|16&n[5]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function td(e){let t,n,r,i,o=e[69](e[4].transfer)+"";return r=new Pe({props:{size:"18"}}),{c(){t=O("span"),n=M(o),Ee(r.$$.fragment),z(t,"margin-right",".75em")},m(e,o){R(e,t,o),N(t,n),Ae(r,e,o),i=!0},p(e,t){(!i||16&t[0])&&o!==(o=e[69](e[4].transfer)+"")&&H(n,o)},i(e){i||(we(r.$$.fragment,e),i=!0)},o(e){ye(r.$$.fragment,e),i=!1},d(e){e&&D(t),be(r,e)}}}function nd(e){let t,n;return t=new e[34]({props:{name:"Total Wochen",nameClass:"formField_italic",$$slots:{default:[rd]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};16384&n[0]|16&n[5]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function rd(e){let t,n,r;function i(t){e[83](t)}let o={item:e[46],disabled:!0};return void 0!==e[14]&&(o.value=e[14]),t=new Ai({props:o}),ee.push((()=>$e(t,"value",i))),{c(){Ee(t.$$.fragment)},m(e,n){Ae(t,e,n),r=!0},p(e,r){const i={};!n&&16384&r[0]&&(n=!0,i.value=e[14],le((()=>n=!1))),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function id(e){let t,n;return t=new e[34]({props:{name:"Total Stunden",nameClass:"formField_italic",$$slots:{default:[od]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};131072&n[0]|16&n[5]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function od(e){let t,n,r;function i(t){e[84](t)}let o={item:e[44],disabled:!0};return void 0!==e[17]&&(o.value=e[17]),t=new Ai({props:o}),ee.push((()=>$e(t,"value",i))),{c(){Ee(t.$$.fragment)},m(e,n){Ae(t,e,n),r=!0},p(e,r){const i={};!n&&131072&r[0]&&(n=!0,i.value=e[17],le((()=>n=!1))),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function sd(e){let t,n;return t=new e[34]({props:{name:"Total Betrag",nameClass:"formField_italic",$$slots:{default:[ad]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};8448&n[0]|16&n[5]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ad(e){let t,n,r;function i(t){e[85](t)}let o={item:e[42],disabled:!0,currency:e[8]};return void 0!==e[13]&&(o.value=e[13]),t=new Ai({props:o}),ee.push((()=>$e(t,"value",i))),{c(){Ee(t.$$.fragment)},m(e,n){Ae(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],le((()=>n=!1))),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function ld(e){let t,n;return t=new e[37]({props:{class:e[29][e[149]],open:e[12]&&!e[2]&&0===e[149]&&!e[19],$$slots:{handle:[wd,({toggle:e,open:t})=>({150:e,12:t}),({toggle:e,open:t})=>[t?4096:0,0,0,0,e?67108864:0]],default:[hd,({toggle:e,open:t})=>({150:e,12:t}),({toggle:e,open:t})=>[t?4096:0,0,0,0,e?67108864:0]]},$$scope:{ctx:e}}}),t.$on("panel-open",(function(){E(e[66](e[149],e[146]))&&e[66](e[149],e[146]).apply(this,arguments)})),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(n,r){e=n;const i={};536870912&r[0]&&(i.class=e[29][e[149]]),528388&r[0]&&(i.open=e[12]&&!e[2]&&0===e[149]&&!e[19]),1075159035&r[0]|1&r[1]|67108864&r[4]|16&r[5]&&(i.$$scope={dirty:r,ctx:e}),t.$set(i)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function cd(e){let t,n;return t=new Ll({props:{praefix:e[149],item:e[156],eventId:e[7],fullRecord:e[0],record:e[147],recordId:e[0]._id,multiValues:e[5],reqQuantity:e[3],notifyList:e[9],noForm:Bd,classId:e[6],disabled:e[1],required:e[40],selectionFields:e[50],propSelection:e[20],numberInput:e[31],dateInput:{...e[11],l:e[4].name,t:e[149]===e[15].length-1,n:e[48].get(e[156].name)},shortEdit:e[10],currency:e[8],initFinished:e[18],formnovalidate:e[149]===e[15].length-1||e[15][e[149]]._delete}}),t.$on("notify",(function(){E(e[54](e[4],e[156],e[149]))&&e[54](e[4],e[156],e[149]).apply(this,arguments)})),t.$on("task",(function(){E(e[53](e[4]))&&e[53](e[4]).apply(this,arguments)})),t.$on("invalid",e[55]),t.$on("defPrep",e[56]),t.$on("checkRange",e[57]),t.$on("formula",e[67](e[149])),t.$on("record",e[86]),t.$on("listRecord",e[58](e[149])),t.$on("propSelection",e[68](e[149])),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(n,r){e=n;const i={};16&r[0]&&(i.item=e[156]),128&r[0]&&(i.eventId=e[7]),1&r[0]&&(i.fullRecord=e[0]),32768&r[0]&&(i.record=e[147]),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]),1048576&r[0]&&(i.propSelection=e[20]),1&r[1]&&(i.numberInput=e[31]),34832&r[0]&&(i.dateInput={...e[11],l:e[4].name,t:e[149]===e[15].length-1,n:e[48].get(e[156].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[149]===e[15].length-1||e[15][e[149]]._delete),t.$set(i)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function dd(e){let t,n,r=e[4].item,i=[];for(let t=0;t<r.length;t+=1)i[t]=cd(Gc(e,r,t));const o=e=>ye(i[e],1,1,(()=>{i[e]=null}));return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=P()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);R(e,t,r),n=!0},p(e,n){if(1347579&n[0]|264897025&n[1]|96&n[2]){let s;for(r=e[4].item,s=0;s<r.length;s+=1){const o=Gc(e,r,s);i[s]?(i[s].p(o,n),we(i[s],1)):(i[s]=cd(o),i[s].c(),we(i[s],1),i[s].m(t.parentNode,t))}for(pe(),s=r.length;s<i.length;s+=1)o(s);ge()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)we(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)ye(i[e]);n=!1},d(e){k(i,e),e&&D(t)}}}function ud(e){let t,n,r=e[15][e[149]]._delete,i=dd(e);return{c(){i.c(),t=P()},m(e,r){i.m(e,r),R(e,t,r),n=!0},p(e,n){32768&n[0]&&A(r,r=e[15][e[149]]._delete)?(pe(),ye(i,1,1,_),ge(),i=dd(e),i.c(),we(i),i.m(t.parentNode,t)):i.p(e,n)},i(e){n||(we(i),n=!0)},o(e){ye(i),n=!1},d(e){e&&D(t),i.d(e)}}}function hd(e){let t,n,r,i,o=e[15].length,s=ud(e);return{c(){t=O("div"),s.c(),r=B(),U(t,"id",n=`accordion-content-${e[6]}-${e[4].name}-${e[149]}`)},m(e,n){R(e,t,n),s.m(t,null),R(e,r,n),i=!0},p(e,r){32768&r[0]&&A(o,o=e[15].length)?(pe(),ye(s,1,1,_),ge(),s=ud(e),s.c(),we(s),s.m(t,null)):s.p(e,r),(!i||80&r[0]&&n!==(n=`accordion-content-${e[6]}-${e[4].name}-${e[149]}`))&&U(t,"id",n)},i(e){i||(we(s),i=!0)},o(e){ye(s),i=!1},d(e){e&&D(t),s.d(e),e&&D(r)}}}function fd(e){let t,n;return t=new e[35]({props:{$$slots:{default:[md]},$$scope:{ctx:e}}}),t.$on("click",(function(){E(e[59](e[150],e[149],e[12]))&&e[59](e[150],e[149],e[12]).apply(this,arguments)})),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(n,r){e=n;const i={};1073840144&r[0]|16&r[5]&&(i.$$scope={dirty:r,ctx:e}),t.$set(i)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function md(e){let t,n,r,i,o,s=e[52](e[16],e[149])+"";return{c(){t=O("div"),n=M(s),U(t,"class",r=S("draggableListItem "+e[4].name)+" svelte-9vv5ub"),U(t,"draggable",!0),q(t,"delete",e[147]._delete),q(t,"is-active-top",e[30]?.top===e[149]),q(t,"is-active-bottom",e[30]?.bottom===e[149])},m(r,s){R(r,t,s),N(t,n),i||(o=[L(t,"dragover",e[64]),L(t,"dragleave",e[65](e[149])),L(t,"dragstart",e[62](e[149])),L(t,"drop",F(e[61](e[149]))),L(t,"dragenter",e[63](e[149]))],i=!0)},p(i,o){e=i,65536&o[0]&&s!==(s=e[52](e[16],e[149])+"")&&H(n,s),16&o[0]&&r!==(r=S("draggableListItem "+e[4].name)+" svelte-9vv5ub")&&U(t,"class",r),32784&o[0]&&q(t,"delete",e[147]._delete),1073741840&o[0]&&q(t,"is-active-top",e[30]?.top===e[149]),1073741840&o[0]&&q(t,"is-active-bottom",e[30]?.bottom===e[149])},d(e){e&&D(t),i=!1,$(o)}}}function pd(e){let t,n,r;var i=e[153];return i&&(t=new i({props:{size:"20"}})),{c(){t&&Ee(t.$$.fragment),n=P()},m(e,i){t&&Ae(t,e,i),R(e,n,i),r=!0},p(e,r){if(i!==(i=e[153])){if(t){pe();const e=t;ye(e.$$.fragment,1,0,(()=>{be(e,1)})),ge()}i?(t=new i({props:{size:"20"}}),Ee(t.$$.fragment),we(t.$$.fragment,1),Ae(t,n.parentNode,n)):t=null}},i(e){r||(t&&we(t.$$.fragment,e),r=!0)},o(e){t&&ye(t.$$.fragment,e),r=!1},d(e){e&&D(n),t&&be(t,e)}}}function gd(e){let t,n,r,i,o,s=!e[1]&&!e[4].readonly&&pd(e);return{c(){t=O("span"),s&&s.c(),U(t,"class","pointer icon svelte-9vv5ub"),U(t,"title",e[151]),t.hidden=n=e[149]===e[15].length-1||!(e[147]._delete^e[152])},m(n,a){R(n,t,a),s&&s.m(t,null),r=!0,i||(o=L(t,"click",(function(){E(e[60](e[149],e[12],e[150]))&&e[60](e[149],e[12],e[150]).apply(this,arguments)})),i=!0)},p(i,o){(e=i)[1]||e[4].readonly?s&&(pe(),ye(s,1,1,(()=>{s=null})),ge()):s?(s.p(e,o),18&o[0]&&we(s,1)):(s=pd(e),s.c(),we(s,1),s.m(t,null)),(!r||32768&o[0]&&n!==(n=e[149]===e[15].length-1||!(e[147]._delete^e[152])))&&(t.hidden=n)},i(e){r||(we(s),r=!0)},o(e){ye(s),r=!1},d(e){e&&D(t),s&&s.d(),i=!1,o()}}}function wd(e){let t,n,r,i,o,s=!e[10]&&fd(e),a=[{title:"löschen",toDelete:!0,icon:tt},{title:"undo",toDelete:!1,icon:Qe}],l=[];for(let t=0;t<2;t+=1)l[t]=gd(Xc(e,a,t));const c=e=>ye(l[e],1,1,(()=>{l[e]=null}));return{c(){t=O("div"),s&&s.c(),n=B();for(let e=0;e<2;e+=1)l[e].c();r=B(),U(t,"class",i=S("accordion "+e[4].name)+" svelte-9vv5ub"),U(t,"slot","handle")},m(e,i){R(e,t,i),s&&s.m(t,null),N(t,n);for(let e=0;e<2;e+=1)l[e].m(t,null);N(t,r),o=!0},p(e,d){if(e[10]?s&&(pe(),ye(s,1,1,(()=>{s=null})),ge()):s?(s.p(e,d),1024&d[0]&&we(s,1)):(s=fd(e),s.c(),we(s,1),s.m(t,n)),36882&d[0]|536870912&d[1]|67108864&d[4]){let n;for(a=[{title:"löschen",toDelete:!0,icon:tt},{title:"undo",toDelete:!1,icon:Qe}],n=0;n<2;n+=1){const i=Xc(e,a,n);l[n]?(l[n].p(i,d),we(l[n],1)):(l[n]=gd(i),l[n].c(),we(l[n],1),l[n].m(t,r))}for(pe(),n=2;n<2;n+=1)c(n);ge()}(!o||16&d[0]&&i!==(i=S("accordion "+e[4].name)+" svelte-9vv5ub"))&&U(t,"class",i)},i(e){if(!o){we(s);for(let e=0;e<2;e+=1)we(l[e]);o=!0}},o(e){ye(s),l=l.filter(Boolean);for(let e=0;e<2;e+=1)ye(l[e]);o=!1},d(e){e&&D(t),s&&s.d(),k(l,e)}}}function yd(e){let t,n,r=(!e[2]&&!e[1]||e[149]<e[15].length-1)&&ld(e);return{c(){r&&r.c(),t=P()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,n){!e[2]&&!e[1]||e[149]<e[15].length-1?r?(r.p(e,n),32774&n[0]&&we(r,1)):(r=ld(e),r.c(),we(r,1),r.m(t.parentNode,t)):r&&(pe(),ye(r,1,1,(()=>{r=null})),ge())},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function vd(e){let t,n,r=e[15],i=[];for(let t=0;t<r.length;t+=1)i[t]=yd(jc(e,r,t));const o=e=>ye(i[e],1,1,(()=>{i[e]=null}));return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=P()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);R(e,t,r),n=!0},p(e,n){if(1612554239&n[0]|2146042369&n[1]|127&n[2]|71303168&n[4]){let s;for(r=e[15],s=0;s<r.length;s+=1){const o=jc(e,r,s);i[s]?(i[s].p(o,n),we(i[s],1)):(i[s]=yd(o),i[s].c(),we(i[s],1),i[s].m(t.parentNode,t))}for(pe(),s=r.length;s<i.length;s+=1)o(s);ge()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)we(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)ye(i[e]);n=!1},d(e){k(i,e),e&&D(t)}}}function _d(e){let t,n,r;function i(t){e[88](t)}let o={$$slots:{default:[kd,({closeCallback:e})=>({142:e}),({closeCallback:e})=>[0,0,0,0,e?262144:0]]},$$scope:{ctx:e}};return void 0!==e[22]&&(o.open=e[22]),t=new e[32]({props:o}),ee.push((()=>$e(t,"open",i))),{c(){Ee(t.$$.fragment)},m(e,n){Ae(t,e,n),r=!0},p(e,r){const i={};529006592&r[0]|262144&r[4]|16&r[5]&&(i.$$scope={dirty:r,ctx:e}),!n&&4194304&r[0]&&(n=!0,i.open=e[22],le((()=>n=!1))),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function Id(e){let t,n;return{c(){t=O("td"),n=M(e[24])},m(e,r){R(e,t,r),N(t,n)},p(e,t){16777216&t[0]&&H(n,e[24])},d(e){e&&D(t)}}}function Cd(e){let t,n,r,i;return{c(){t=O("td"),n=O("input"),U(n,"id","reader_focusId"),n.autofocus=!0,n.value=e[23]},m(o,s){R(o,t,s),N(t,n),n.focus(),r||(i=[L(n,"focus",e[72]),L(n,"input",(function(){E(e[78](e[19].keyboard.length))&&e[78](e[19].keyboard.length).apply(this,arguments)}))],r=!0)},p(t,r){e=t,8388608&r[0]&&n.value!==e[23]&&(n.value=e[23])},d(e){e&&D(t),r=!1,$(i)}}}function $d(e){let t,n,r,i,o,s=e[73](e[19].refItem,!0)+"";return{c(){t=O("tr"),n=O("th"),r=O("div"),i=M(s),o=M(" nicht gefunden!"),z(r,"color","red"),U(n,"colspan","2")},m(e,s){R(e,t,s),N(t,n),N(n,r),N(r,i),N(r,o)},p(e,t){524288&t[0]&&s!==(s=e[73](e[19].refItem,!0)+"")&&H(i,s)},d(e){e&&D(t)}}}function Ed(e){let t,n,r,i,o,s=e[73](e[19].refItem)+"";return{c(){t=O("tr"),n=O("th"),r=O("div"),i=M(s),o=M(" bereits eingefügt!"),z(r,"color","red"),U(n,"colspan","2")},m(e,s){R(e,t,s),N(t,n),N(n,r),N(r,i),N(r,o)},p(e,t){524288&t[0]&&s!==(s=e[73](e[19].refItem)+"")&&H(i,s)},d(e){e&&D(t)}}}function Ad(e){let t;let n=function(e){return"number"===e[143].type?Sd:bd}(e),r=n(e);return{c(){r.c(),t=P()},m(e,n){r.m(e,n),R(e,t,n)},p(e,t){r.p(e,t)},d(e){r.d(e),e&&D(t)}}}function bd(e){let t;return{c(){t=O("input"),U(t,"id","reader_"+e[143].name),U(t,"type","text")},m(e,n){R(e,t,n)},p:_,d(e){e&&D(t)}}}function Sd(e){let t,n,r;return{c(){t=O("input"),z(t,"width","4em"),U(t,"id","reader_"+e[143].name),U(t,"type","text"),U(t,"min","0")},m(i,o){R(i,t,o),n||(r=L(t,"input",(function(){E(e[78](e[19].keyboard.length,e[143]))&&e[78](e[19].keyboard.length,e[143]).apply(this,arguments)})),n=!0)},p(t,n){e=t},d(e){e&&D(t),n=!1,r()}}}function Td(e){let t,n,r,i,o,s,a=e[73](e[143].name)+"",l=e[25]&&Ad(e);return{c(){t=O("tr"),n=O("th"),r=M(a),i=B(),o=O("td"),l&&l.c(),s=B()},m(e,a){R(e,t,a),N(t,n),N(n,r),N(t,i),N(t,o),l&&l.m(o,null),N(t,s)},p(e,t){e[25]?l?l.p(e,t):(l=Ad(e),l.c(),l.m(o,null)):l&&(l.d(1),l=null)},d(e){e&&D(t),l&&l.d()}}}function Nd(e){let t;return{c(){t=M("Verwerfen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Rd(e){let t;return{c(){t=M("Speichern")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Dd(e){let t,n,r,i,o,s,a,l,c,d,u,h,f,m,p,g,w,y,v,_,I,C,$,E=e[73](e[19].refItem)+"";function A(t){e[87](t)}let b={keyboard:e[19].keyboard,codeTypes:e[19].codeTypes};function S(e,t){return e[19].keyboard?Cd:Id}void 0!==e[27]&&(b.readerInit=e[27]),t=new Wc({props:b}),ee.push((()=>$e(t,"readerInit",A))),t.$on("scan",e[71]),t.$on("exit",e[76]);let T=S(e),x=T(e);function P(e,t){return e[28]?Ed:e[24]&&!e[26]?$d:void 0}let L=P(e),F=L&&L(e),V=e[47],U=[];for(let t=0;t<V.length;t+=1)U[t]=Td(qc(e,V,t));return _=new e[35]({props:{disabled:!e[24],outline:!0,style:"float: left;",$$slots:{default:[Nd]},$$scope:{ctx:e}}}),_.$on("click",e[74]),C=new e[35]({props:{disabled:!e[26],filled:!0,style:"float: right;",$$slots:{default:[Rd]},$$scope:{ctx:e}}}),C.$on("click",e[75]),{c(){Ee(t.$$.fragment),r=B(),i=O("div"),o=O("table"),s=O("tr"),a=O("th"),a.textContent="Code",l=B(),x.c(),c=B(),d=O("tr"),u=O("th"),h=M(E),f=B(),m=O("td"),p=O("div"),g=M(e[25]),w=B(),F&&F.c(),y=B();for(let e=0;e<U.length;e+=1)U[e].c();v=B(),Ee(_.$$.fragment),I=B(),Ee(C.$$.fragment),z(p,"max-width","14em"),z(o,"margin-top","1em"),z(o,"margin-bottom","1em"),z(o,"text-align","left"),z(i,"position","relative"),z(i,"z-index","1000"),z(i,"background-color","white"),z(i,"height","225px")},m(e,n){Ae(t,e,n),R(e,r,n),R(e,i,n),N(i,o),N(o,s),N(s,a),N(s,l),x.m(s,null),N(o,c),N(o,d),N(d,u),N(u,h),N(d,f),N(d,m),N(m,p),N(p,g),N(o,w),F&&F.m(o,null),N(o,y);for(let e=0;e<U.length;e+=1)U[e].m(o,null);N(i,v),Ae(_,i,null),N(i,I),Ae(C,i,null),$=!0},p(e,r){const i={};if(524288&r[0]&&(i.keyboard=e[19].keyboard),524288&r[0]&&(i.codeTypes=e[19].codeTypes),!n&&134217728&r[0]&&(n=!0,i.readerInit=e[27],le((()=>n=!1))),t.$set(i),T===(T=S(e))&&x?x.p(e,r):(x.d(1),x=T(e),x&&(x.c(),x.m(s,null))),(!$||524288&r[0])&&E!==(E=e[73](e[19].refItem)+"")&&H(h,E),(!$||33554432&r[0])&&H(g,e[25]),L===(L=P(e))&&F?F.p(e,r):(F&&F.d(1),F=L&&L(e),F&&(F.c(),F.m(o,y))),34078720&r[0]|65536&r[1]|67584&r[2]){let t;for(V=e[47],t=0;t<V.length;t+=1){const n=qc(e,V,t);U[t]?U[t].p(n,r):(U[t]=Td(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={};16777216&r[0]&&(a.disabled=!e[24]),16&r[5]&&(a.$$scope={dirty:r,ctx:e}),_.$set(a);const l={};67108864&r[0]&&(l.disabled=!e[26]),16&r[5]&&(l.$$scope={dirty:r,ctx:e}),C.$set(l)},i(e){$||(we(t.$$.fragment,e),we(_.$$.fragment,e),we(C.$$.fragment,e),$=!0)},o(e){ye(t.$$.fragment,e),ye(_.$$.fragment,e),ye(C.$$.fragment,e),$=!1},d(e){be(t,e),e&&D(r),e&&D(i),x.d(),F&&F.d(),k(U,e),be(_),be(C)}}}function kd(e){let t,n;return t=new e[33]({props:{title:"Scannen",class:"reader",closeCallback:e[142],$$slots:{default:[Dd]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};262144&n[4]&&(r.closeCallback=e[142]),529006592&n[0]|16&n[5]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Od(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function xd(e){let t,n,r={ctx:e,current:null,token:null,hasCatch:!1,pending:Od,then:Zc,catch:Yc,value:141,blocks:[,,,]};return ve(e[51](),r),{c(){t=P(),r.block.c()},m(e,i){R(e,t,i),r.block.m(e,r.anchor=i),r.mount=()=>t.parentNode,r.anchor=t,n=!0},p(t,n){_e(r,e=t,n)},i(e){n||(we(r.block),n=!0)},o(e){for(let e=0;e<3;e+=1){ye(r.blocks[e])}n=!1},d(e){e&&D(t),r.block.d(e),r.token=null,r=null}}}let Md=new Map;const Bd=!0,Pd="pos/target";function Ld(e,n,r){let i,o,s;const{Modal:a,Dialog:l,FormField:d,TextField:h,Button:f,Accordion:w,AccordionSection:y,Divider:v}=c,_=K(),{loggedIn:I}=u;b(e,I,(e=>r(96,s=e)));let{list:C}=n,{mainSchema:$}=n,{schema:E}=n,{record:A}=n,{multiValues:S}=n,{classId:T}=n,{eventId:N}=n,{disabled:R}=n,{fixed:D}=n,{template:k={}}=n,{reqQuantity:O}=n,{open:x=!1}=n,{currency:M}=n,{notifyList:B}=n,{shortEdit:P}=n,{dateInput:L}=n;const F=E.find((e=>"price"===e.name&&!e.properties?.hidden)),V=E.find((e=>"amount"===e.name&&!e.properties?.hidden))||E.find((e=>e.isAmount&&!e.properties?.hidden)),U=E.find((e=>"quantity"===e.name&&!e.properties?.hidden)),H=V||F&&U,W=H&&U;let z=0;const q=E.find((e=>"quantity"===e.name&&"h"===e.properties?.unit?.constant&&!e.properties?.hidden));let j=0;const G=E.find((e=>"number"===e.type&&"w"===e.properties?.unit?.constant?.toLowerCase()&&!e.properties?.hidden))?.name||"",X=!!G;let Z=0,J=!1;const ee={},te=C.reader;let ne,re,ie,oe=E.properties?.readonly,ae=T.split("form-")[1].slice(0,-4),le=new Map,ce="",de=!0,ue="",he="",fe="",me=!1,pe=!1,ge=!1;const we=E.filter((e=>e.properties?.reader));let ye=new Map;C.group&&(D=!0);const ve={},_e=new Map,Ie=C.item.filter((e=>"number"===e.type&&!!e.properties?.transfer));R||=oe;let Ce,$e,Ee=[],Ae=[],be=!1,Se={},Te=[];const Ne=async e=>{if("saleDelivery"!==C.name||!Ce?.length||e[C.name]?.length){if(r(3,O=e.quantity),P)r(15,Ce=e[C.name]||[]);else if(!e._id&&C.filter){const e=Ce;r(15,Ce=[]);const t=await Ze();r(15,Ce=!1!==t?t.concat({}):e)}else r(15,Ce=((e,t)=>{let n=e[t];if(n?.length||(n=[]),n=n.concat({}),e._id)return n;for(const t of E)t.preset&&!n[0][t.name]&&(n[0][t.name]=e[t.preset]);return n})(e,C.name)||[{}]);Ke(e)}};E.filter((e=>e.selection)).map((e=>Ee.push({className:ae,parentClass:E,refClass:e.selection,value:""})));["readonly","hidden","required"].map((e=>{E.filter((t=>"object"==typeof(t.properties&&t.properties[e]))).map((t=>{const n=t.properties[e].refItem||"",r=t.properties[e].refValue;let[i,o]=n.split(".");o||(o=i,i=void 0),Te.push({action:e,itemName:t.name,refObj:i,refName:o,refValue:r,op:t.properties[e].invert?"!":""})}))}));const Re=(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:""},De=e=>e.slice(0,3).join(", "),ke=(e,t,n)=>async({detail:o})=>{const{oldValue:s,value:a,add:l}=o;if(a&&t.refClass){const e="p$"+t.refClass+"$"+N;let n=await lh(e);0===n?.length&&(await(c=500,new Promise((e=>{setTimeout(e,c)}))),n=await lh(e)),n&&n.find((({_id:e})=>e==a))||await fh(t.refClass,a)}var c;let{desc:d}=o;if(""===s&&""===a&&(d=""),e.refItem){const i=await Me(e,n,t,e.refItem);i&&r(15,Ce=i)}Ve(n,t._formulaActor);const u=Ee?.find((e=>e.refClass.split(":")[1]?.split(".")[0]===t.refClass));u&&(u.value=(u.value||new Map).set(n,a)),a&&Ce.length===n+1&&!P&&r(15,Ce=Ce.concat({})),d&&r(82,ee[a]=d,ee),P||await He(e,n,t,a,s),await Pe(n,t.name),r(16,i=Ce),"number"===t.type&&r(31,Se={item:t,value:a,idx:n}),await Oe(n),Le(n)},Oe=async e=>{if(Ce[e]&&!C.filter&&Ce.length!==e+1)for(const t of E.filter((e=>!!e.refProp))){let n,i=A[t.refItem]||Ce[e][t.refItem];if(!i)continue;if(Array.isArray(i)){if(Ce[e][t.name])continue;i=i[e][t.refItem]}const o="p$"+t.refItem+"$"+N;let s=await lh(o);if(s&&(n=s.find((({_id:e})=>e==i))),n||(n=await fh(t.refItem,i)),!n)continue;const a=xe(n,t.refProp)?.replace(",",".")||n[t.refProp]&&n[t.refProp][t.name]?.replace(",",".")||n[t.refProp];Ce[e][t.name]||r(15,Ce[e][t.name]=a,Ce)}},xe=(e,t)=>{try{return e.split(".").reduce(((e,t)=>e[t]),t)}catch(e){return""}},Me=async(e,t,n,r)=>{if(e.filter)return;const i=A[r];if(!i?.length)return;const o=i[0][r];if(!o)return;const s=await fh(r,o);return s?s[e.name]:void 0},Be=(e,t,n,i)=>{if(!e.filter){if(i&&!1===n.refItem){const e="boolean"!==n.type&&"";Ce[t][n.name]&&r(15,Ce[t][n.name]=e,Ce)}Ce.length!==t+1&&"number"==typeof n.properties?.value&&r(15,Ce[t][n.name]=n.properties.value,Ce)}},Pe=async(e,t)=>{const n=Te.filter((e=>(e.refObj||ae)===t||e.refName===t));if(n?.length)for(const t of n){const{itemName:n,refObj:i,refName:o,refValue:s,op:a}=t;let l,c,{action:d}=t,u=!1,h=!1;if(i){const t=Ce[e][i];i===ae&&o?u=A:t&&(u=await fh(i,t))}!i&&o&&(u=Ce[e]),u&&(h=u[o],Array.isArray(h)&&0===h.length?h=!1:s&&(h=h==(u[s]||A[s]))),"!"===a&&(h=!h),"required"!==d&&"readonly"!==d||(d="required"===d?d:"disabled",setTimeout((()=>{l=`#accordion-content-${T}-${C.name}-${e} .form-field.${n} .field textarea`,c=document.querySelector(l),c||(l=`#accordion-content-${T}-${C.name}-${e} .form-field.${n} .field input#${"dp-"+n+"-"+e}`,c=document.querySelector(l)),c||(l=`#accordion-content-${T}-${C.name}-${e} .form-field.${n} .field input`,c=document.querySelector(l)),c&&h&&c.setAttribute(d,""),c&&!h&&c.removeAttribute(d)}),0)),"hidden"===d&&(l=`#accordion-content-${T}-${C.name}-${e} .form-field.${n}`,c=document.querySelector(l),c?.classList?.toggle("hidden",h),h&&r(15,Ce[e][n]="",Ce))}},Le=(e,t)=>{let n=`#accordion-content-${T}-${C.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-${T}-${C.name}-${e} :not(.form-field.hidden) .field input.invalid`,document.querySelector(n)&&(t=!0)),r(29,Ae[e]=o||t?"invalid":"",Ae)},Fe=e=>{if(!e)return 0;const[t,n=0]=e.split(":");return 60*t+parseInt(n)},Ve=(e,t)=>{if(!t)return;const n=E.find((e=>e.name===t));if(!n)return;const i=n.properties.value.formula,{operator:o,argument:s}=i,a=s.map((t=>Ce[e][t.refItem]||A[t.refItem]));let l=0;if("$preferred"===o){if(void 0!==Ce[e][t])return;l=a.reduce(((e,t)=>{let r=e;return"number"===n.type?r=+r||+t:r||=t,r}))}if("$add"===o&&(l=a.reduce(((e,t)=>+(e||0)+ +(t||0)))),"$subtract"===o&&(l=a.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"===o&&(l=a.reduce(((e,t)=>+(e||0)*+(t||0)))),"$percentMultiply"===o){const[e,t]=a;l=+e,+t>0&&(l*=1-t/100)}if("$percentDivide"===o){const[e,t]=a;0!=+t&&(l=+e/+t*100)}if("$percentSubtract"===o){let[e,t]=a;t.replace&&(t=t.replace(",",".")),0!=+t&&(l=+e-e*+t/100)}const c=`#accordion-content-${T}-${C.name}-${e} .form-field.${t} .field input`,d=document.querySelector(c),u=d?.disabled;r(15,Ce[e][t]="$multiply"===o?l?Ue(l,n.properties?.decimals):"":Ue(l,n.properties?.decimals),Ce),r(31,Se={item:n,value:l,idx:e}),setTimeout((()=>{const t=document.querySelector(c);u&&t&&t.setAttribute("disabled",""),n._formulaActor&&Ve(e,n._formulaActor)}),0)},Ue=(e,t)=>("number"==typeof e&&e||(e=Number(e||0)),e.toFixed(t||0));$e=E.filter((e=>e.refClass)).reduce(((e,t)=>{const n=E.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 He=async(e,t,n,i,o)=>{if(e.filter)return;const s=(await $e).find((e=>e.refClass===n.refClass));if(!s)return;const{refClass:a,items:l,selection:c}=s,d=n.name;if(Te.find((e=>e.itemName===d))){const n=`#accordion-content-${T}-${e.name}-${t} .form-field.${a}.hidden`;if(document.querySelector(n))return}return i?Promise.all(l.map((async e=>{let s=E.find((t=>t.name===e));if(!s)return;let d=s.refName||s.name,u="",h="";if(s.lookup){if(h=Ce[t][s.name],r(15,Ce[t][s.name]="",Ce),!Ce[t][s.refItem])return void r(15,Ce[t][s.name]="",Ce);const[e,n,i]=s.lookup.split("."),o=s.lookupRefItem||s.refItem,a=s.lookupRefName||d,l="p$"+s.refItem+"$"+N;let c,f=await lh(l);if(c=f?.find((({_id:e})=>e==Ce[t][s.refItem])),c||(c=await fh(s.refItem,Ce[t][s.refItem])),c){if(s.refItem2){const e=await fh(s.refItem2,c[s.refItem2]);if("dealerPrice"===d&&A.branch){const e=await fh("branch",A.branch);e?.sector?.includes("Privat")&&(d="price")}e&&(u=e[d])}0==+u&&(u=c[d])}if(A[e]){const r=await fh(e,A[e]);if(r&&r[n]){const e=await fh(n,r[n]);if(e){const n=e[i].find((e=>e[o]===Ce[t][o]));n&&(u=n[a])}}}return Ce[t][s.name]||r(15,Ce[t][s.name]=u||h,Ce),void await Ve(t,s._formulaActor)}if(s.properties?.readonly&&!n.refInput){const i=Ce[t][n.refClass];return Promise.resolve(fh(n.refClass,i,!0)).then((n=>{let i=s.refPos?n[s.refPos]||xe(s.refPos,n):n[e];void 0!==s.factor&&(i*=s.factor),Array.isArray(i)&&(i=i.length?i[0][e]:""),r(15,Ce[t][e]=i,Ce),s._formulaActor&&Ve(t,s._formulaActor)}))}const{refInput:f}=n;if(f&&Ce[t]){const[e,n]=f.split(".");u=n?Ce[t][n]:A[e]}if(c&&i!==o)l.map((e=>{r(15,Ce[t][e]="",Ce)}));else{if(s.refItem2){const[n,i]=s.refItem2.split(".");A[n]&&fh(n,A[n]).then((n=>{n&&+n[i]&&r(15,Ce[t][e]=n[i],Ce)}))}if(f&&!u||We(t,e)||o!==i){const i=E.find((e=>e.refClass===a)),o=Ce[t][i.name];if(n.selection){const i=hh(n.selection+o.toString());if(i)return Promise.resolve(i).then((n=>r(15,Ce[t][e]=n[e],Ce)))}const s="p$"+i.refClass+"$"+N;let l=await lh(s);if(l){const n=l.find((({_id:e})=>e==o));if(n)return Promise.resolve((()=>{r(15,Ce[t][e]=n[e],Ce)}))}return Promise.resolve(fh(i.refClass,o)).then((n=>r(15,Ce[t][e]=n[e],Ce)))}}}))):Promise.resolve(l.map((e=>{r(15,Ce[t][e]="",Ce)})))},We=(e,t)=>{let n=Ce[e][t];return"number"===E.find((e=>e.name===t)).type&&(n=Number(n||0)),!n},ze=e=>{if(!e)return;const{style:t,scrollHeight:n}=e;n&&(t.height=`${n}px`)};let qe=!1;const je=e=>!(!D&&e>=Ce.length-1),Ge=(e,t=!1)=>{const[n,r]=e.split(";");return C.name===r&&(!!je(t)&&((!1===t||t!=n)&&parseInt(n)))};E.filter((e=>e.properties?.value?.formula?.argument)).forEach((e=>{e.properties.value.formula.argument.forEach((t=>{const n=E.find((e=>e.name===t.refItem))||E.find((e=>e.name===t.refItem));n&&(n._formulaActor=e.name)}))}));const Xe=(e,t=!1)=>{const n=`#accordion-content-${T}-${C.name}-${e} > div.form-field:not(.hidden)`,i=document.querySelectorAll(n);if(!i?.length)return;const o=i[i.length-1];se().then((()=>{const t=`#accordion-content-${T}-${C.name}-${e} textarea`;Array.from(document.querySelectorAll(t)).forEach(ze)})).then((()=>{t&&o.scrollIntoView({behavior:"smooth",block:"end"})}));for(const t of E){"number"==typeof t.properties?.value&&r(15,Ce[e][t.name]=t.properties.value,Ce);const n=C.preserve&&C.preserve.includes(t.preset);if(t.preset&&!n&&!Ce[e][t.name]){const n=_e.get(t.preset);n&&r(15,Ce[e][t.name]=n,Ce)}t.refItem&&A[t.refItem]&&fh(t.refItem,A[t.refItem]).then((n=>r(15,Ce[e][t.name]=n[t.name],Ce)))}if(!(e<1)&&Ce?.length&&e===Ce.length-1&&C.preserve&&!A._id)for(const t of C.preserve){if(!Ce[e-1][t])continue;const n=Re(Ce[e-1][t],!0);r(15,Ce[e][t]=n,Ce),_e.set(t,n)}},Ye=new Map,Ze=async()=>{if(!C.filter)return[];let e,n,r,{date:i,level:o,isDealer:s}=A;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=Ye.get("dv"),c=Ye.get("lv"),d=Ye.get("iv");if(l===a&&c===o&&d===!!s)return!1;let u;Ye.set("dv",a),Ye.set("lv",o),Ye.set("iv",!!s),u=s?{$ne:""}:{$eq:""};const h={dealer:u,"_task.status":"Ready",payable:{$lt:a}};o&&(h.levelReminder=o),o||(h.levelReminder={$in:[void 0,!1,""]});const f=[{$addFields:{_docId:{$toString:"$_id"}}},{$lookup:{from:"_task",localField:"_docId",foreignField:"docId",as:"_task"}},{$unwind:{path:"$_task",preserveNullAndEmptyArrays:!0}},{$match:h},{$sort:{payable:1,invoiceId:1}}];return await t.getSectionView("invoice",f)},Ke=async e=>{if(!C.filter){if(e[C.name]?.length)for(const n of E)if((n.properties?.prefetch||1e3)<e[C.name].length){const r="p$"+n.refClass+"$"+N;if(lh(r))continue;ah(r,[]);const i=Qe(e[C.name],n.name);i?.length&&ah(r,t.getSectionView(n.refClass,{_id:{$in:i}}))}r(20,ne={record:e})}},Qe=(e,t)=>e.map((e=>e[t])).filter((e=>!!e)),Je=()=>{r(28,pe=!1),r(25,he=""),r(23,ce=""),de=!0,r(24,ue=""),r(26,fe=""),r(22,ie=!0)},et=async({detail:e})=>{const{refItem:n,refValue:i,refDescription:o,keyboard:s,input:a}=te;let l,c="reader_";for(;e.text.length>s.length;)e.text=e.text.slice(1);if(ue===e.text&&e.item){const t=c+e.item.name;return l=document.getElementById(t),l.value=+(ye.get(e.item.name)||0)+1,ye.set(e.item.name,l.value),l.focus(),de=!0,void r(23,ce="")}if(r(28,pe=!1),r(25,he=""),r(24,ue=e.text||""),!ue)return;const d=E.find((e=>e.name===n))?.refClass;if(!d)return;let u=await t.getSectionView(d,{[i]:ue});u?.length?(u=u[0],r(26,fe=u._id),r(25,he=o.map((e=>u[e])).join(", ")),r(28,pe=Ce.find((e=>e[n]===fe))),setTimeout((()=>{E.filter((e=>e.properties?.reader)).forEach((e=>{const t=document.getElementById("reader_"+e.name);t&&(t.value=ye.get(e.name)||(pe?pe[e.name]:"")),ye.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=+(ye.get(e.item.name)||0)+t,ye.set(e.item.name,l.value),l.focus()}else{const e=E.find((e=>e.properties?.reader)).name,n=c+e;l=document.getElementById(n),l.value=+(ye.get(e)||0)+t,ye.set(e,l.value),l.focus()}de=!0,r(23,ce="")}),0)):setTimeout((()=>{de=!0,r(23,ce=""),r(24,ue=""),ye=new Map;const e=document.getElementById("reader_focusId");e&&e.focus()}),0)},tt=()=>{r(25,he=""),r(26,fe=""),r(28,pe=!1),r(27,me=!0),nt(),ye=new Map},nt=()=>{if(!te.keyboard)return;const e=document.getElementById("reader_focusId");e&&e.focus()};Y((async()=>{if(!C.filter&&(re||r(21,re=await t.getEvent(N)),(A._id||!re.input)&&!(Ce.length>1)&&!R&&te?.autostart)){if("object"==typeof te.autostart){if(!te.autostart.user)return;{const e=s.user,[t,n]=te.autostart.user.split(":"),r=$.find((e=>e.name===t)),i=r?.refClass;if(!i||!n)return;const o=await fh(i,A[t]);if(!o)return;if(o[n]!==e)return}}else if(!0!==te.autostart)return;ge=!1,Je()}}));return e.$$set=e=>{"list"in e&&r(4,C=e.list),"mainSchema"in e&&r(79,$=e.mainSchema),"schema"in e&&r(80,E=e.schema),"record"in e&&r(0,A=e.record),"multiValues"in e&&r(5,S=e.multiValues),"classId"in e&&r(6,T=e.classId),"eventId"in e&&r(7,N=e.eventId),"disabled"in e&&r(1,R=e.disabled),"fixed"in e&&r(2,D=e.fixed),"template"in e&&r(81,k=e.template),"reqQuantity"in e&&r(3,O=e.reqQuantity),"open"in e&&r(12,x=e.open),"currency"in e&&r(8,M=e.currency),"notifyList"in e&&r(9,B=e.notifyList),"shortEdit"in e&&r(10,P=e.shortEdit),"dateInput"in e&&r(11,L=e.dateInput)},e.$$.update=()=>{if(528&e.$$.dirty[0]&&B&&!C.filter){const{itemName:e,value:t}=B;_e.set(e,t),e&&e===C.name&&r(0,A[e]=t,A)}1&e.$$.dirty[0]&&Ne(A),32768&e.$$.dirty[0]&&r(16,i=Ce),122896&e.$$.dirty[0]&&i&&((()=>{if(q)r(17,j=Ce?.reduce(((e,t)=>e+(t._delete?0:+(t.quantity||0))),0)||0)})(),(()=>{if(X)r(14,Z=Ce?.reduce(((e,t)=>e+(t._delete?0:+(t[G]||0))),0)||0)})(),(()=>{if(H)r(13,z=Ce?.reduce(((e,t)=>{if(t.amount){const n=t.amount??0;e+=t._delete?0:+n}else if(t.price){const n=(W?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)})(),se().then((()=>_("save",{listName:C.name,value:Ce,amountValue:z,weeksValue:Z})))),1048576&e.$$.dirty[2]&&(o=e=>ee[e]?.split(" • ").filter((e=>!!e&&!/^[0-9a-f]{24}/.test(e))).slice(0,2).join(" · "))},[A,R,D,O,C,S,T,N,M,B,P,L,x,z,Z,Ce,i,j,J,te,ne,re,ie,ce,ue,he,fe,me,pe,Ae,be,Se,a,l,d,f,w,y,v,I,undefined,H,{name:"amountValue",properties:{decimals:2}},q,{name:"hoursValue",properties:{decimals:2}},X,{name:"weeksValue",properties:{decimals:1}},we,_e,Ie,Ee,async()=>{if(!R&&(re||r(21,re=await t.getEvent(N)),(A._id||!re.input)&&te&&!te.keyboard))try{const e=await Uc();e?.length||r(19,te=!1)}catch{}},(e,t)=>{let n=e[t];return ve["pos"+t]&&(n=ve["pos"+t]),n&&E.filter((e=>!0!==e.properties?.hidden&&("dateRange"===e.type||void 0!==n[e.name])&&"textarea"!==e.properties?.format)).map((e=>""===n[e.name]?"":"object"===e.type?o(n[e.name]):Array.isArray(n[e.name])?De(n[e.name]):"boolean"===e.type?g(n[e.name]):"number"===e.type?Ue(n[e.name],e.properties?.decimals||0):"dateRange"===e.type?((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()})(e.name,n):"date"===e.type?m(Re(n[e.name])):"datetime"===e.type?p(n[e.name]):e.properties?.multi?"":n[e.name])).filter((e=>!!e)).join(" • ")||"+"},e=>({detail:{row:t}})=>{if(_("task",{row:t}),!A._id&&t._id){for(let t=0;t<Ce.length;t++)for(const n of e.item)Be(e,t,n,!J);r(18,J=!0)}},ke,({detail:e})=>{const{idx:t,value:n}=e;Le(t,n)},async({detail:{className:e,itemName:n,value:r}})=>{if(le.has(e))return;if(!0!==r&&(r=(r=[].concat(r)).some((e=>e===ae+"."+C.name))),!r)return;const i={[n]:!0},o=await t.getSectionView(e,i);o?.length&&le.set(e,o[0])},({detail:e})=>{const{idx:t,fieldId:n,value:r}=e;if(!r)return;const i=Fe(r);let o=!1;Ce.forEach(((e,n)=>{if(t===n)return;const{start:r,end:s}=Ce[n];r&&s&&i>Fe(r)&&i<Fe(s)&&(o=!0)}));const s=document.getElementById(n);s?.classList?.toggle("invalid",o)},e=>({detail:t})=>{t.string?r(15,Ce[e][t.itemName]=t.value,Ce):r(15,Ce[e][t.itemName]=Ue(t.value,t.decimals),Ce)},(e,t,n)=>n=>{Ce[t]._delete||(e(n),Xe(t,!0))},(e,t,n)=>i=>{if(r(15,Ce[e]._delete=!Ce[e]._delete,Ce),Ce[e]._delete){ve["pos"+e]={...Ce[e]};for(const t of E)r(15,Ce[e][t.name]="",Ce);t&&n(i)}else{if(ve["pos"+e]){const t={};for(const n of E)t[n.name]=ve["pos"+e][n.name];r(15,Ce[e]=t,Ce)}ve["pos"+e]=void 0,t||n(i)}},e=>t=>{t.preventDefault(),r(30,be=!1);const n=Ge(t.dataTransfer.getData(Pd),e);if(!1===n)return;t.dataTransfer.dropEffect="move";const i=[...Ce].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 Md.set(r,n);var n,r}));let o=[];Ae.map(((e,t)=>{o[t]=Ae[(e=>{const t=Md.get(e);return void 0===t?e:t})(t)]})),r(29,Ae=o),r(15,Ce=i.map(((e,t)=>(delete e._index,e)))),qe=!1},e=>t=>{if(!je(e))return!1;t.dataTransfer.effectAllowed="move",t.dataTransfer.dropEffect="move",t.dataTransfer.setData(Pd,e+";"+C.name),qe=e},e=>t=>{const n=Ge(t.dataTransfer.getData(Pd),e)||qe;return!1===n||n===e?r(30,be=!1):void r(30,be={top:n>e&&e,bottom:n<e&&e})},e=>e.preventDefault(),e=>e=>{r(30,be=!1)},(e,t)=>n=>{setTimeout((()=>{Array.from(le).forEach((([t,n])=>{Ce[e][t]||r(15,Ce[e][t]=n._id,Ce)}))}),500);const i=new Set;for(const e of Te)i.add(e.refObj||ae);for(const t of Array.from(i))Pe(e,t);t(n),Xe(e)},e=>({detail:t})=>{Ve(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,Ce[e][n]="",Ce);let c=await fh(o,a);const d=c[l];c=await fh(C.name,A[C.name][e][C.name]);const u=c[s];let h="number"===i?0:"",f=0;u.forEach((e=>{const t=e[l];t.length<=f||t.every((e=>d.find((t=>t===e))))&&(h=e[n],f=t.length)})),r(15,Ce[e][n]=h,Ce)},e=>e?.description||"Daten übernehmen",Je,et,()=>{de=!0,r(23,ce="")},(e,t=!1)=>t?(tt(),""):E.find((t=>t.name===e))?.designation||"",tt,()=>{const{refItem:e}=te,t={[e]:fe};let n;E.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=Ce;const o=i.findIndex((t=>t[e]===fe));o>=0?(n=i[o],i[o]={...n,...t}):i=i.slice(0,-1).concat(t),r(15,Ce=i),E.filter((e=>e.properties?.reader)).forEach((e=>{ke(e,o>=0?o:0)({detail:{oldValue:n?n[e.name]:"",value:t[e.name]}})})),ge=!0,tt()},()=>{ge&&(_("readerSave"),ge=!1)},()=>{const e=new Map;Ie.forEach((t=>{[].concat(t.properties.transfer.target).forEach((n=>{e.set(n,t.name)}))}));let t=0;for(const n of Ce){for(const[i,o]of e)!n[i]&&n[o]&&r(15,Ce[t][i]=n[o],Ce);t++}r(16,i=Ce)},(e,t)=>n=>{const{data:i}=n;"0123456789".includes(i)&&(de?(r(23,ce=i.toString()),de=!1):(r(23,ce+=i.toString()),"77"===ce&&r(23,ce="7"),ce.length===e&&et({detail:{text:ce,item:t}})))},$,E,k,ee,function(e){Z=e,r(14,Z)},function(e){j=e,r(17,j)},function(e){z=e,r(13,z)},function(t){Q(e,t)},function(e){me=e,r(27,me)},function(e){ie=e,r(22,ie)}]}class Fd extends Te{constructor(e){var t;super(),zc.getElementById("svelte-9vv5ub-style")||((t=O("style")).id="svelte-9vv5ub-style",t.textContent=".accordion.svelte-9vv5ub{display:flex;overflow:hidden}.accordion-content.svelte-9vv5ub{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-9vv5ub{padding-top:1em}div.delete.svelte-9vv5ub{text-decoration:line-through}.icon.svelte-9vv5ub{margin-right:-0.75em}.form-field .formField_italic{font-style:italic}.panel.invalid .btn{border:1px #b80000 solid}.draggableListItem.svelte-9vv5ub{cursor:drag}.draggableListItem.is-active-top.svelte-9vv5ub{border-top:3px purple solid;padding-top:2em}.draggableListItem.is-active-bottom.svelte-9vv5ub{border-bottom:3px purple solid;padding-bottom:2em}.modal-overlay > .dialog.reader{margin-top:0}",N(zc.head,t)),Se(this,e,Ld,xd,A,{list:4,mainSchema:79,schema:80,record:0,multiValues:5,classId:6,eventId:7,disabled:1,fixed:2,template:81,reqQuantity:3,open:12,currency:8,notifyList:9,shortEdit:10,dateInput:11},[-1,-1,-1,-1,-1,-1])}}const{Boolean:Vd,document:Ud}=Ie;function Hd(e,t,n){const r=e.slice();return r[202]=t[n],r[204]=n,r}function Wd(e,t,n){const r=e.slice();return r[206]=t[n],r}function zd(e,t,n){const r=e.slice();return r[209]=t[n],r}function qd(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function jd(e){let t,n,r=e[205]&&function(e){let t,n,r,i,o,s,a,l,c,d,u,h,f,m,p,g,w,y,v=e[22]&&Gd(e),_=e[39]&&Yd(e),I=e[0].items,C=[];for(let t=0;t<I.length;t+=1)C[t]=Qd(zd(e,I,t));const E=e=>ye(C[e],1,1,(()=>{C[e]=null}));let A=e[0].list&&Jd(e),b=!e[4]&&!e[2]&&e[37]&&e[5]&&!e[42]&&cu(e);h=new e[47]({props:{outline:!0,$$slots:{default:[uu]},$$scope:{ctx:e}}}),h.$on("click",e[67]);const T=[fu,hu],x=[];function M(e,t){return e[10]?0:e[37]?1:-1}~(m=M(e))&&(p=x[m]=T[m](e));return{c(){t=O("section"),v&&v.c(),n=B(),_&&_.c(),r=B(),i=O("form"),o=O("input"),a=B();for(let e=0;e<C.length;e+=1)C[e].c();l=B(),A&&A.c(),c=B(),b&&b.c(),d=B(),u=O("div"),Ee(h.$$.fragment),f=B(),p&&p.c(),U(o,"class",S(e[54])+" svelte-lfqa43"),U(o,"name","_id"),U(o,"type","hidden"),o.value=s=e[9]._id||"",U(i,"class",S(e[55])+" svelte-lfqa43"),U(i,"id",e[54]),U(u,"class","form--buttons svelte-lfqa43"),U(t,"class",S(e[56])+" svelte-lfqa43")},m(s,p){R(s,t,p),v&&v.m(t,null),N(t,n),_&&_.m(t,null),N(t,r),N(t,i),N(i,o),N(i,a);for(let e=0;e<C.length;e+=1)C[e].m(i,null);N(i,l),A&&A.m(i,null),N(t,c),b&&b.m(t,null),N(t,d),N(t,u),Ae(h,u,null),N(u,f),~m&&x[m].m(u,null),g=!0,w||(y=[L(i,"keydown",e[72]),L(i,"submit",F(e[66]))],w=!0)},p(e,a){if(e[22]?v?(v.p(e,a),4194304&a[0]&&we(v,1)):(v=Gd(e),v.c(),we(v,1),v.m(t,n)):v&&(pe(),ye(v,1,1,(()=>{v=null})),ge()),e[39]?_?(_.p(e,a),256&a[1]&&we(_,1)):(_=Yd(e),_.c(),we(_,1),_.m(t,r)):_&&(pe(),ye(_,1,1,(()=>{_=null})),ge()),(!g||512&a[0]&&s!==(s=e[9]._id||""))&&(o.value=s),537430529&a[0]|276826113&a[1]|1016772&a[2]){let t;for(I=e[0].items,t=0;t<I.length;t+=1){const n=zd(e,I,t);C[t]?(C[t].p(n,a),we(C[t],1)):(C[t]=Qd(n),C[t].c(),we(C[t],1),C[t].m(i,l))}for(pe(),t=I.length;t<C.length;t+=1)E(t);ge()}e[0].list?A?(A.p(e,a),1&a[0]&&we(A,1)):(A=Jd(e),A.c(),we(A,1),A.m(i,null)):A&&(pe(),ye(A,1,1,(()=>{A=null})),ge()),e[4]||e[2]||!e[37]||!e[5]||e[42]?b&&(pe(),ye(b,1,1,(()=>{b=null})),ge()):b?(b.p(e,a),52&a[0]|2112&a[1]&&we(b,1)):(b=cu(e),b.c(),we(b,1),b.m(t,d));const c={};67108864&a[6]&&(c.$$scope={dirty:a,ctx:e}),h.$set(c);let f=m;m=M(e),m===f?~m&&x[m].p(e,a):(p&&(pe(),ye(x[f],1,1,(()=>{x[f]=null})),ge()),~m?(p=x[m],p?p.p(e,a):(p=x[m]=T[m](e),p.c()),we(p,1),p.m(u,null)):p=null)},i(e){if(!g){we(v),we(_);for(let e=0;e<I.length;e+=1)we(C[e]);we(A),we(b),we(h.$$.fragment,e),we(p),g=!0}},o(e){ye(v),ye(_),C=C.filter(Vd);for(let e=0;e<C.length;e+=1)ye(C[e]);ye(A),ye(b),ye(h.$$.fragment,e),ye(p),g=!1},d(e){e&&D(t),v&&v.d(),_&&_.d(),k(C,e),A&&A.d(),b&&b.d(),be(h),~m&&x[m].d(),w=!1,$(y)}}}(e);return{c(){r&&r.c(),t=P()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,t){e[205]&&r.p(e,t)},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function Gd(e){let t,n;return t=new e[47]({props:{disabled:e[42]||e[9]._id,filled:!0,style:"opacity: 0.75; margin-bottom: .5em;",$$slots:{default:[Xd]},$$scope:{ctx:e}}}),t.$on("click",e[89]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};512&n[0]|2048&n[1]&&(r.disabled=e[42]||e[9]._id),67108864&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Xd(e){let t,n,r;return n=new We({props:{size:"18"}}),{c(){t=O("span"),t.textContent="QR Code scannen",Ee(n.$$.fragment),z(t,"margin-right",".75em")},m(e,i){R(e,t,i),Ae(n,e,i),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n,e)}}}function Yd(e){let t,n;return t=new e[47]({props:{filled:!0,style:"opacity: 0.75; margin-bottom: .5em;",$$slots:{default:[Zd]},$$scope:{ctx:e}}}),t.$on("click",e[87]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};67108864&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Zd(e){let t,n,r;return n=new at({props:{size:"18"}}),{c(){t=O("span"),t.textContent="Dokument ergänzen",Ee(n.$$.fragment),z(t,"margin-right",".75em")},m(e,i){R(e,t,i),Ae(n,e,i),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n,e)}}}function Kd(e){let t,n;return t=new Ll({props:{classId:e[54],item:e[209],selection:e[209].selection,record:e[9],disabled:e[42],eventId:e[64],multiValues:e[59],notifyList:e[11],toDelete:e[19],currency:e[15],changeValue:e[31],initFinished:e[29]}}),t.$on("save",e[71]),t.$on("task",e[68]),t.$on("notify",e[69]),t.$on("safeReference",e[78]),t.$on("multi",e[70]),t.$on("defPrep",e[77]),t.$on("record",e[79]),t.$on("objRecord",e[80]),t.$on("formula",e[81]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};1&n[0]&&(r.item=e[209]),1&n[0]&&(r.selection=e[209].selection),512&n[0]&&(r.record=e[9]),2048&n[1]&&(r.disabled=e[42]),2048&n[0]&&(r.notifyList=e[11]),524288&n[0]&&(r.toDelete=e[19]),32768&n[0]&&(r.currency=e[15]),1&n[1]&&(r.changeValue=e[31]),536870912&n[0]&&(r.initFinished=e[29]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Qd(e){let t,n,r="list"!==e[209].type&&Kd(e);return{c(){r&&r.c(),t=P()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,n){"list"!==e[209].type?r?(r.p(e,n),1&n[0]&&we(r,1)):(r=Kd(e),r.c(),we(r,1),r.m(t.parentNode,t)):r&&(pe(),ye(r,1,1,(()=>{r=null})),ge())},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function Jd(e){let t,n,r,i,o,s=e[60]&&e[16]&&0!=e[16]&&eu(e),a=e[17]&&nu(e),l=e[61]&&e[30]&&0!=e[30]&&iu(e),c=e[0].list,d=[];for(let t=0;t<c.length;t+=1)d[t]=lu(Wd(e,c,t));const u=e=>ye(d[e],1,1,(()=>{d[e]=null}));return{c(){s&&s.c(),t=B(),a&&a.c(),n=B(),l&&l.c(),r=B();for(let e=0;e<d.length;e+=1)d[e].c();i=P()},m(e,c){s&&s.m(e,c),R(e,t,c),a&&a.m(e,c),R(e,n,c),l&&l.m(e,c),R(e,r,c);for(let t=0;t<d.length;t+=1)d[t].m(e,c);R(e,i,c),o=!0},p(e,o){if(e[60]&&e[16]&&0!=e[16]?s?(s.p(e,o),65536&o[0]&&we(s,1)):(s=eu(e),s.c(),we(s,1),s.m(t.parentNode,t)):s&&(pe(),ye(s,1,1,(()=>{s=null})),ge()),e[17]?a?(a.p(e,o),131072&o[0]&&we(a,1)):(a=nu(e),a.c(),we(a,1),a.m(n.parentNode,n)):a&&(pe(),ye(a,1,1,(()=>{a=null})),ge()),e[61]&&e[30]&&0!=e[30]?l?(l.p(e,o),1073741824&o[0]&&we(l,1)):(l=iu(e),l.c(),we(l,1),l.m(r.parentNode,r)):l&&(pe(),ye(l,1,1,(()=>{l=null})),ge()),3205701&o[0]|276826118&o[1]|67240452&o[2]){let t;for(c=e[0].list,t=0;t<c.length;t+=1){const n=Wd(e,c,t);d[t]?(d[t].p(n,o),we(d[t],1)):(d[t]=lu(n),d[t].c(),we(d[t],1),d[t].m(i.parentNode,i))}for(pe(),t=c.length;t<d.length;t+=1)u(t);ge()}},i(e){if(!o){we(s),we(a),we(l);for(let e=0;e<c.length;e+=1)we(d[e]);o=!0}},o(e){ye(s),ye(a),ye(l),d=d.filter(Vd);for(let e=0;e<d.length;e+=1)ye(d[e]);o=!1},d(e){s&&s.d(e),e&&D(t),a&&a.d(e),e&&D(n),l&&l.d(e),e&&D(r),k(d,e),e&&D(i)}}}function eu(e){let t,n;return t=new e[48]({props:{name:"Total Dokument",nameClass:"formField_italic",$$slots:{default:[tu]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};98304&n[0]|67108864&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function tu(e){let t,n,r;function i(t){e[104](t)}let o={item:e[57],disabled:!0,currency:e[15]};return void 0!==e[16]&&(o.value=e[16]),t=new Ai({props:o}),ee.push((()=>$e(t,"value",i))),{c(){Ee(t.$$.fragment)},m(e,n){Ae(t,e,n),r=!0},p(e,r){const i={};32768&r[0]&&(i.currency=e[15]),!n&&65536&r[0]&&(n=!0,i.value=e[16],le((()=>n=!1))),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function nu(e){let t,n;return t=new e[48]({props:{name:"Total MWSt "+(e[18]?"("+e[18]+"%)":""),nameClass:"formField_italic",$$slots:{default:[ru]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};262144&n[0]&&(r.name="Total MWSt "+(e[18]?"("+e[18]+"%)":"")),163840&n[0]|67108864&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ru(e){let t,n,r;function i(t){e[105](t)}let o={item:e[58],disabled:!0,currency:e[15]};return void 0!==e[17]&&(o.value=e[17]),t=new Ai({props:o}),ee.push((()=>$e(t,"value",i))),{c(){Ee(t.$$.fragment)},m(e,n){Ae(t,e,n),r=!0},p(e,r){const i={};32768&r[0]&&(i.currency=e[15]),!n&&131072&r[0]&&(n=!0,i.value=e[17],le((()=>n=!1))),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function iu(e){let t,n;return t=new e[48]({props:{name:"Gesamtzeit in Wochen",nameClass:"formField_italic",$$slots:{default:[ou]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};1073741824&n[0]|67108864&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ou(e){let t,n,r;function i(t){e[106](t)}let o={item:e[62],disabled:!0};return void 0!==e[30]&&(o.value=e[30]),t=new Ai({props:o}),ee.push((()=>$e(t,"value",i))),{c(){Ee(t.$$.fragment)},m(e,n){Ae(t,e,n),r=!0},p(e,r){const i={};!n&&1073741824&r[0]&&(n=!0,i.value=e[30],le((()=>n=!1))),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function su(e){let t,n,r,i;return t=new e[46]({props:{text:e[206].designation}}),r=new Lr({props:{classId:e[54],open:!e[2]&&1===e[0].list.length,list:e[206],template:e[32],eventId:e[64],schema:e[206].item,record:e[9],disabled:e[42],currency:e[15],update:e[13]}}),{c(){Ee(t.$$.fragment),n=B(),Ee(r.$$.fragment)},m(e,o){Ae(t,e,o),R(e,n,o),Ae(r,e,o),i=!0},p(e,n){const i={};1&n[0]&&(i.text=e[206].designation),t.$set(i);const o={};5&n[0]&&(o.open=!e[2]&&1===e[0].list.length),1&n[0]&&(o.list=e[206]),2&n[1]&&(o.template=e[32]),1&n[0]&&(o.schema=e[206].item),512&n[0]&&(o.record=e[9]),2048&n[1]&&(o.disabled=e[42]),32768&n[0]&&(o.currency=e[15]),8192&n[0]&&(o.update=e[13]),r.$set(o)},i(e){i||(we(t.$$.fragment,e),we(r.$$.fragment,e),i=!0)},o(e){ye(t.$$.fragment,e),ye(r.$$.fragment,e),i=!1},d(e){be(t,e),e&&D(n),be(r,e)}}}function au(e){let t,n;return t=new Fd({props:{classId:e[54],open:e[21],list:e[206],template:e[33],eventId:e[64],schema:e[206].item,mainSchema:e[0].items,record:e[9],disabled:e[42],fixed:e[206].fixed,reqQuantity:e[20],currency:e[15],notifyList:e[11],multiValues:e[59],shortEdit:e[6],dateInput:e[14]}}),t.$on("save",e[71]),t.$on("record",e[79]),t.$on("readerSave",e[88]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};2097152&n[0]&&(r.open=e[21]),1&n[0]&&(r.list=e[206]),4&n[1]&&(r.template=e[33]),1&n[0]&&(r.schema=e[206].item),1&n[0]&&(r.mainSchema=e[0].items),512&n[0]&&(r.record=e[9]),2048&n[1]&&(r.disabled=e[42]),1&n[0]&&(r.fixed=e[206].fixed),1048576&n[0]&&(r.reqQuantity=e[20]),32768&n[0]&&(r.currency=e[15]),2048&n[0]&&(r.notifyList=e[11]),64&n[0]&&(r.shortEdit=e[6]),16384&n[0]&&(r.dateInput=e[14]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function lu(e){let t,n,r,i;const o=[au,su],s=[];function a(e,t){return"array"===e[206].type?0:1}return t=a(e),n=s[t]=o[t](e),{c(){n.c(),r=P()},m(e,n){s[t].m(e,n),R(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?s[t].p(e,i):(pe(),ye(s[l],1,1,(()=>{s[l]=null})),ge(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),we(n,1),n.m(r.parentNode,r))},i(e){i||(we(n),i=!0)},o(e){ye(n),i=!1},d(e){s[t].d(e),e&&D(r)}}}function cu(e){let t,n,r,i;function o(t){e[107](t)}let s={title:"",$$slots:{default:[du]},$$scope:{ctx:e}};return void 0!==e[36]&&(s.checked=e[36]),n=new e[49]({props:s}),ee.push((()=>$e(n,"checked",o))),{c(){t=O("div"),Ee(n.$$.fragment),U(t,"class","askNext"),z(t,"margin-top","1em"),z(t,"margin-left","23em")},m(e,r){R(e,t,r),Ae(n,t,null),i=!0},p(e,t){const i={};67108864&t[6]&&(i.$$scope={dirty:t,ctx:e}),!r&&32&t[1]&&(r=!0,i.checked=e[36],le((()=>r=!1))),n.$set(i)},i(e){i||(we(n.$$.fragment,e),i=!0)},o(e){ye(n.$$.fragment,e),i=!1},d(e){e&&D(t),be(n)}}}function du(e){let t;return{c(){t=O("span"),t.textContent="Weiter erfassen",z(t,"margin-left",".75em")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function uu(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function hu(e){let t,n,r,i,o,s=!(e[38]||e[36])&&mu(e),a=e[5]&&!e[42]&&gu(e),l=e[2]&&e[3]&&yu(e),c=e[34]&&_u(e);return{c(){s&&s.c(),t=B(),a&&a.c(),n=B(),l&&l.c(),r=B(),c&&c.c(),i=P()},m(e,d){s&&s.m(e,d),R(e,t,d),a&&a.m(e,d),R(e,n,d),l&&l.m(e,d),R(e,r,d),c&&c.m(e,d),R(e,i,d),o=!0},p(e,o){e[38]||e[36]?s&&(pe(),ye(s,1,1,(()=>{s=null})),ge()):s?(s.p(e,o),160&o[1]&&we(s,1)):(s=mu(e),s.c(),we(s,1),s.m(t.parentNode,t)),e[5]&&!e[42]?a?(a.p(e,o),32&o[0]|2048&o[1]&&we(a,1)):(a=gu(e),a.c(),we(a,1),a.m(n.parentNode,n)):a&&(pe(),ye(a,1,1,(()=>{a=null})),ge()),e[2]&&e[3]?l?(l.p(e,o),12&o[0]&&we(l,1)):(l=yu(e),l.c(),we(l,1),l.m(r.parentNode,r)):l&&(pe(),ye(l,1,1,(()=>{l=null})),ge()),e[34]?c?(c.p(e,o),8&o[1]&&we(c,1)):(c=_u(e),c.c(),we(c,1),c.m(i.parentNode,i)):c&&(pe(),ye(c,1,1,(()=>{c=null})),ge())},i(e){o||(we(s),we(a),we(l),we(c),o=!0)},o(e){ye(s),ye(a),ye(l),ye(c),o=!1},d(e){s&&s.d(e),e&&D(t),a&&a.d(e),e&&D(n),l&&l.d(e),e&&D(r),c&&c.d(e),e&&D(i)}}}function fu(e){let t,n,r,i;t=new e[47]({props:{filled:!0,style:"opacity: 0.75;",$$slots:{default:[Tu]},$$scope:{ctx:e}}}),t.$on("click",e[75]);let o=e[35]&&Nu(e);return{c(){Ee(t.$$.fragment),n=B(),o&&o.c(),r=P()},m(e,s){Ae(t,e,s),R(e,n,s),o&&o.m(e,s),R(e,r,s),i=!0},p(e,n){const i={};67108864&n[6]&&(i.$$scope={dirty:n,ctx:e}),t.$set(i),e[35]?o?(o.p(e,n),16&n[1]&&we(o,1)):(o=Nu(e),o.c(),we(o,1),o.m(r.parentNode,r)):o&&(pe(),ye(o,1,1,(()=>{o=null})),ge())},i(e){i||(we(t.$$.fragment,e),we(o),i=!0)},o(e){ye(t.$$.fragment,e),ye(o),i=!1},d(e){be(t,e),e&&D(n),o&&o.d(e),e&&D(r)}}}function mu(e){let t,n;return t=new e[47]({props:{class:"close",disabled:e[42],form:e[54],filled:!0,type:"submit",$$slots:{default:[pu]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};2048&n[1]&&(r.disabled=e[42]),67108864&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function pu(e){let t;return{c(){t=M("Speichern und schliessen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function gu(e){let t,n;return t=new e[47]({props:{form:e[54],filled:!0,type:"submit",style:"opacity: 0.75;",$$slots:{default:[wu]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};128&n[1]|67108864&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function wu(e){let t,n=(e[38]||"Speichern")+"";return{c(){t=M(n)},m(e,n){R(e,t,n)},p(e,r){128&r[1]&&n!==(n=(e[38]||"Speichern")+"")&&H(t,n)},d(e){e&&D(t)}}}function yu(e){let t,n;return t=new e[47]({props:{disabled:e[42],danger:!0,outline:!0,$$slots:{default:[vu]},$$scope:{ctx:e}}}),t.$on("click",e[83]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};2048&n[1]&&(r.disabled=e[42]),67108864&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function vu(e){let t;return{c(){t=M("Löschen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function _u(e){let t,n,r,i,o;const s=[Cu,Iu],a=[];t=function(e){return e[63]?0:1}(e),n=a[t]=s[t](e);let l=e[35]&&bu(e);return{c(){n.c(),r=B(),l&&l.c(),i=P()},m(e,n){a[t].m(e,n),R(e,r,n),l&&l.m(e,n),R(e,i,n),o=!0},p(e,t){n.p(e,t),e[35]?l?(l.p(e,t),16&t[1]&&we(l,1)):(l=bu(e),l.c(),we(l,1),l.m(i.parentNode,i)):l&&(pe(),ye(l,1,1,(()=>{l=null})),ge())},i(e){o||(we(n),we(l),o=!0)},o(e){ye(n),ye(l),o=!1},d(e){a[t].d(e),e&&D(r),l&&l.d(e),e&&D(i)}}}function Iu(e){let t,n;return t=new e[47]({props:{filled:!0,style:"opacity: 0.6;",$$slots:{default:[$u]},$$scope:{ctx:e}}}),t.$on("click",(function(){E(e[73](e[1]))&&e[73](e[1]).apply(this,arguments)})),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(n,r){e=n;const i={};67108864&r[6]&&(i.$$scope={dirty:r,ctx:e}),t.$set(i)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Cu(e){let t,n;return t=new d({props:{text:e[63],extended:!0,$$slots:{default:[Au]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};2&n[0]|67108864&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function $u(e){let t,n,r;return n=new At({props:{size:"18"}}),{c(){t=O("span"),t.textContent=`${e[82]()}`,Ee(n.$$.fragment),z(t,"margin-right",".75em")},m(e,i){R(e,t,i),Ae(n,e,i),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n,e)}}}function Eu(e){let t,n,r;return n=new At({props:{size:"18"}}),{c(){t=O("span"),t.textContent=`${e[82]()}`,Ee(n.$$.fragment),z(t,"margin-right",".75em")},m(e,i){R(e,t,i),Ae(n,e,i),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n,e)}}}function Au(e){let t,n;return t=new e[47]({props:{filled:!0,style:"opacity: 0.6;",$$slots:{default:[Eu]},$$scope:{ctx:e}}}),t.$on("click",(function(){E(e[73](e[1]))&&e[73](e[1]).apply(this,arguments)})),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(n,r){e=n;const i={};67108864&r[6]&&(i.$$scope={dirty:r,ctx:e}),t.$set(i)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function bu(e){let t,n;return t=new e[47]({props:{filled:!0,style:"opacity: 0.75;",$$slots:{default:[Su]},$$scope:{ctx:e}}}),t.$on("click",(function(){E(e[74](e[1]))&&e[74](e[1]).apply(this,arguments)})),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(n,r){e=n;const i={};67108864&r[6]&&(i.$$scope={dirty:r,ctx:e}),t.$set(i)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Su(e){let t,n,r;return n=new Tt({props:{size:"18"}}),{c(){t=O("span"),t.textContent="Daten",Ee(n.$$.fragment),z(t,"margin-right",".75em")},m(e,i){R(e,t,i),Ae(n,e,i),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n,e)}}}function Tu(e){let t,n,r;return n=new At({props:{size:"18"}}),{c(){t=O("span"),t.textContent="Erstellen",Ee(n.$$.fragment),z(t,"margin-right",".75em")},m(e,i){R(e,t,i),Ae(n,e,i),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n,e)}}}function Nu(e){let t,n;return t=new e[47]({props:{filled:!0,style:"opacity: 0.75;",$$slots:{default:[Ru]},$$scope:{ctx:e}}}),t.$on("click",e[76]),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};67108864&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Ru(e){let t,n,r;return n=new Tt({props:{size:"18"}}),{c(){t=O("span"),t.textContent="Daten",Ee(n.$$.fragment),z(t,"margin-right",".75em")},m(e,i){R(e,t,i),Ae(n,e,i),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n,e)}}}function Du(e){return{c:_,m:_,p:_,i:_,o:_,d:_}}function ku(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Ou(e){let t;return{c(){t=M("Ja, bitte löschen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function xu(e){let t,n,r,i,o,s,a,l,c;return s=new e[47]({props:{filled:!0,$$slots:{default:[ku]},$$scope:{ctx:e}}}),s.$on("click",e[108]),l=new e[47]({props:{danger:!0,outline:!0,$$slots:{default:[Ou]},$$scope:{ctx:e}}}),l.$on("click",e[86]),{c(){t=O("p"),t.textContent="Willst du diese Daten löschen?",n=B(),r=O("p"),r.textContent="Das kann nicht rückgängig gemacht werden.",i=B(),o=O("div"),Ee(s.$$.fragment),a=B(),Ee(l.$$.fragment),U(o,"class","flex_div svelte-lfqa43")},m(e,d){R(e,t,d),R(e,n,d),R(e,r,d),R(e,i,d),R(e,o,d),Ae(s,o,null),N(o,a),Ae(l,o,null),c=!0},p(e,t){const n={};67108864&t[6]&&(n.$$scope={dirty:t,ctx:e}),s.$set(n);const r={};67108864&t[6]&&(r.$$scope={dirty:t,ctx:e}),l.$set(r)},i(e){c||(we(s.$$.fragment,e),we(l.$$.fragment,e),c=!0)},o(e){ye(s.$$.fragment,e),ye(l.$$.fragment,e),c=!1},d(e){e&&D(t),e&&D(n),e&&D(r),e&&D(i),e&&D(o),be(s),be(l)}}}function Mu(e){let t,n,r;return n=new xe({props:{size:"25"}}),{c(){t=O("div"),Ee(n.$$.fragment),U(t,"slot","title-icon")},m(e,i){R(e,t,i),Ae(n,t,null),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function Bu(e){let t,n;return t=new e[45]({props:{title:"Bestätigung",closeCallback:e[201],danger:!0,$$slots:{"title-icon":[Mu],default:[xu]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};32768&n[6]&&(r.closeCallback=e[201]),67108864&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Pu(e){let t,n,r;function i(t){e[111](t)}let o={$$slots:{default:[Gu,({closeCallback:e})=>({201:e}),({closeCallback:e})=>[0,0,0,0,0,0,e?32768:0]]},$$scope:{ctx:e}};return void 0!==e[23]&&(o.open=e[23]),t=new e[44]({props:o}),ee.push((()=>$e(t,"open",i))),{c(){Ee(t.$$.fragment)},m(e,n){Ae(t,e,n),r=!0},p(e,r){const i={};524288e3&r[0]|67141632&r[6]&&(i.$$scope={dirty:r,ctx:e}),!n&&8388608&r[0]&&(n=!0,i.open=e[23],le((()=>n=!1))),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function Lu(e){let t,n,r,i,o,s=e[92](e[22].refItem,!0)+"";return{c(){t=O("tr"),n=O("th"),r=O("div"),i=M(s),o=M(" nicht gefunden!"),z(r,"color","red"),U(n,"colspan","2")},m(e,s){R(e,t,s),N(t,n),N(n,r),N(r,i),N(r,o)},p(e,t){4194304&t[0]&&s!==(s=e[92](e[22].refItem,!0)+"")&&H(i,s)},d(e){e&&D(t)}}}function Fu(e){let t,n,r,i,o,s=e[92](e[22].refItem)+"";return{c(){t=O("tr"),n=O("th"),r=O("div"),i=M(s),o=M(" bereits eingefügt!"),z(r,"color","red"),U(n,"colspan","2")},m(e,s){R(e,t,s),N(t,n),N(n,r),N(r,i),N(r,o)},p(e,t){4194304&t[0]&&s!==(s=e[92](e[22].refItem)+"")&&H(i,s)},d(e){e&&D(t)}}}function Vu(e){let t;let n=function(e){return"number"===e[202].type?Hu:Uu}(e),r=n(e);return{c(){r.c(),t=P()},m(e,n){r.m(e,n),R(e,t,n)},p(e,t){r.p(e,t)},d(e){r.d(e),e&&D(t)}}}function Uu(e){let t;return{c(){t=O("input"),U(t,"id","reader_"+e[202].name),U(t,"type","text")},m(e,n){R(e,t,n)},p:_,d(e){e&&D(t)}}}function Hu(e){let t;return{c(){t=O("input"),z(t,"width","4em"),U(t,"id","reader_"+e[202].name),U(t,"type","number"),U(t,"min","0")},m(e,n){R(e,t,n)},p:_,d(e){e&&D(t)}}}function Wu(e){let t,n,r,i,o,s,a=e[92](e[202].name)+"",l=e[24]&&e[25]&&Vu(e);return{c(){t=O("tr"),n=O("th"),r=M(a),i=B(),o=O("td"),l&&l.c(),s=B()},m(e,a){R(e,t,a),N(t,n),N(n,r),N(t,i),N(t,o),l&&l.m(o,null),N(t,s)},p(e,t){e[24]&&e[25]?l?l.p(e,t):(l=Vu(e),l.c(),l.m(o,null)):l&&(l.d(1),l=null)},d(e){e&&D(t),l&&l.d()}}}function zu(e){let t;return{c(){t=M("Verwerfen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function qu(e){let t;return{c(){t=M("Speichern")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function ju(e){let t,n,r,i,o,s,a,l,c,d,u,h,f,m,p,g,w,y,v,_,I,C,$,E,A,b=e[92](e[22].refItem)+"";function S(t){e[110](t)}let T={keyboard:e[22].keyboard,codeTypes:e[22].codeTypes};function x(e,t){return e[28]?Fu:e[24]&&!e[26]?Lu:void 0}void 0!==e[27]&&(T.readerInit=e[27]),t=new Wc({props:T}),ee.push((()=>$e(t,"readerInit",S))),t.$on("scan",e[90]),t.$on("exit",e[95]);let P=x(e),L=P&&P(e),F=e[91](),V=[];for(let t=0;t<F.length;t+=1)V[t]=Wu(Hd(e,F,t));return C=new e[47]({props:{disabled:!e[24],outline:!0,style:"float: left;",$$slots:{default:[zu]},$$scope:{ctx:e}}}),C.$on("click",e[93]),E=new e[47]({props:{disabled:!e[26],filled:!0,style:"float: right;",$$slots:{default:[qu]},$$scope:{ctx:e}}}),E.$on("click",e[94]),{c(){Ee(t.$$.fragment),r=B(),i=O("div"),o=O("table"),s=O("tr"),a=O("th"),a.textContent="Code",l=B(),c=O("td"),d=M(e[24]),u=B(),h=O("tr"),f=O("th"),m=M(b),p=B(),g=O("td"),w=O("div"),y=M(e[25]),v=B(),L&&L.c(),_=B();for(let e=0;e<V.length;e+=1)V[e].c();I=B(),Ee(C.$$.fragment),$=B(),Ee(E.$$.fragment),z(w,"max-width","14em"),z(o,"margin-top","1em"),z(o,"margin-bottom","1em"),z(o,"text-align","left"),z(i,"position","relative"),z(i,"z-index","1000"),z(i,"background-color","white"),z(i,"height","225px")},m(e,n){Ae(t,e,n),R(e,r,n),R(e,i,n),N(i,o),N(o,s),N(s,a),N(s,l),N(s,c),N(c,d),N(o,u),N(o,h),N(h,f),N(f,m),N(h,p),N(h,g),N(g,w),N(w,y),N(o,v),L&&L.m(o,null),N(o,_);for(let e=0;e<V.length;e+=1)V[e].m(o,null);N(i,I),Ae(C,i,null),N(i,$),Ae(E,i,null),A=!0},p(e,r){const i={};if(4194304&r[0]&&(i.keyboard=e[22].keyboard),4194304&r[0]&&(i.codeTypes=e[22].codeTypes),!n&&134217728&r[0]&&(n=!0,i.readerInit=e[27],le((()=>n=!1))),t.$set(i),(!A||16777216&r[0])&&H(d,e[24]),(!A||4194304&r[0])&&b!==(b=e[92](e[22].refItem)+"")&&H(m,b),(!A||33554432&r[0])&&H(y,e[25]),P===(P=x(e))&&L?L.p(e,r):(L&&L.d(1),L=P&&P(e),L&&(L.c(),L.m(o,_))),50331648&r[0]|1610612736&r[2]){let t;for(F=e[91](),t=0;t<F.length;t+=1){const n=Hd(e,F,t);V[t]?V[t].p(n,r):(V[t]=Wu(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={};16777216&r[0]&&(s.disabled=!e[24]),67108864&r[6]&&(s.$$scope={dirty:r,ctx:e}),C.$set(s);const a={};67108864&r[0]&&(a.disabled=!e[26]),67108864&r[6]&&(a.$$scope={dirty:r,ctx:e}),E.$set(a)},i(e){A||(we(t.$$.fragment,e),we(C.$$.fragment,e),we(E.$$.fragment,e),A=!0)},o(e){ye(t.$$.fragment,e),ye(C.$$.fragment,e),ye(E.$$.fragment,e),A=!1},d(e){be(t,e),e&&D(r),e&&D(i),L&&L.d(),k(V,e),be(C),be(E)}}}function Gu(e){let t,n;return t=new e[45]({props:{title:"Scannen",class:"reader",closeCallback:e[201],$$slots:{default:[ju]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};32768&n[6]&&(r.closeCallback=e[201]),524288e3&n[0]|67108864&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Xu(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Yu(e){let t,n,r,i,o;return i=new e[47]({props:{filled:!0,$$slots:{default:[Xu]},$$scope:{ctx:e}}}),i.$on("click",e[112]),{c(){t=O("progress"),n=B(),r=O("div"),Ee(i.$$.fragment),z(t,"width","100%"),U(t,"id","file"),U(t,"max","100"),t.value=e[41],U(r,"class","flex_div svelte-lfqa43")},m(e,s){R(e,t,s),R(e,n,s),R(e,r,s),Ae(i,r,null),o=!0},p(e,n){(!o||1024&n[1])&&(t.value=e[41]);const r={};67108864&n[6]&&(r.$$scope={dirty:n,ctx:e}),i.$set(r)},i(e){o||(we(i.$$.fragment,e),o=!0)},o(e){ye(i.$$.fragment,e),o=!1},d(e){e&&D(t),e&&D(n),e&&D(r),be(i)}}}function Zu(e){let t,n,r;return n=new xe({props:{size:"25"}}),{c(){t=O("div"),Ee(n.$$.fragment),U(t,"slot","title-icon")},m(e,i){R(e,t,i),Ae(n,t,null),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function Ku(e){let t,n;return t=new e[45]({props:{title:"Auswertung wird erstellt",closeCallback:e[201],$$slots:{"title-icon":[Zu],default:[Yu]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};32768&n[6]&&(r.closeCallback=e[201]),1024&n[1]|67108864&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Qu(e){let t,n;return{c(){t=O("p"),n=M(e[8])},m(e,r){R(e,t,r),N(t,n)},p(e,t){256&t[0]&&H(n,e[8])},d(e){e&&D(t)}}}function Ju(e){let t;return{c(){t=M("Schliessen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function eh(e){let t,n,r,i,o;return t=new e[50]({props:{outline:!0,$$slots:{default:[Qu]},$$scope:{ctx:e}}}),i=new e[47]({props:{danger:!0,outline:!0,$$slots:{default:[Ju]},$$scope:{ctx:e}}}),i.$on("click",e[114]),{c(){Ee(t.$$.fragment),n=B(),r=O("div"),Ee(i.$$.fragment),U(r,"class","flex_div svelte-lfqa43")},m(e,s){Ae(t,e,s),R(e,n,s),R(e,r,s),Ae(i,r,null),o=!0},p(e,n){const r={};256&n[0]|67108864&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r);const o={};67108864&n[6]&&(o.$$scope={dirty:n,ctx:e}),i.$set(o)},i(e){o||(we(t.$$.fragment,e),we(i.$$.fragment,e),o=!0)},o(e){ye(t.$$.fragment,e),ye(i.$$.fragment,e),o=!1},d(e){be(t,e),e&&D(n),e&&D(r),be(i)}}}function th(e){let t,n,r;return n=new xe({props:{size:"25"}}),{c(){t=O("div"),Ee(n.$$.fragment),U(t,"slot","title-icon")},m(e,i){R(e,t,i),Ae(n,t,null),r=!0},p:_,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function nh(e){let t,n;return t=new e[45]({props:{title:"Speichern nicht erfolgreich",danger:!0,$$slots:{"title-icon":[th],default:[eh]},$$scope:{ctx:e}}}),{c(){Ee(t.$$.fragment)},m(e,r){Ae(t,e,r),n=!0},p(e,n){const r={};384&n[0]|67108864&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function rh(e){let t,n,r,i,o,s,a,l,c,d,u,h,f;Ud.title=t=e[43];let m={ctx:e,current:null,token:null,hasCatch:!1,pending:Du,then:jd,catch:qd,value:205,blocks:[,,,]};function p(t){e[109](t)}ve(e[65](),m);let g={$$slots:{default:[Bu,({closeCallback:e})=>({201:e}),({closeCallback:e})=>[0,0,0,0,0,0,e?32768:0]]},$$scope:{ctx:e}};void 0!==e[12]&&(g.open=e[12]),i=new e[44]({props:g}),ee.push((()=>$e(i,"open",p)));let w=e[22]&&e[23]&&Pu(e);function y(t){e[113](t)}let v={$$slots:{default:[Ku,({closeCallback:e})=>({201:e}),({closeCallback:e})=>[0,0,0,0,0,0,e?32768:0]]},$$scope:{ctx:e}};function _(t){e[115](t)}void 0!==e[40]&&(v.open=e[40]),l=new e[44]({props:v}),ee.push((()=>$e(l,"open",y)));let I={$$slots:{default:[nh,({closeCallback:e})=>({201:e}),({closeCallback:e})=>[0,0,0,0,0,0,e?32768:0]]},$$scope:{ctx:e}};return void 0!==e[7]&&(I.open=e[7]),u=new e[44]({props:I}),ee.push((()=>$e(u,"open",_))),{c(){n=B(),m.block.c(),r=B(),Ee(i.$$.fragment),s=B(),w&&w.c(),a=B(),Ee(l.$$.fragment),d=B(),Ee(u.$$.fragment)},m(e,t){R(e,n,t),m.block.m(e,m.anchor=t),m.mount=()=>r.parentNode,m.anchor=r,R(e,r,t),Ae(i,e,t),R(e,s,t),w&&w.m(e,t),R(e,a,t),Ae(l,e,t),R(e,d,t),Ae(u,e,t),f=!0},p(n,r){e=n,(!f||4096&r[1])&&t!==(t=e[43])&&(Ud.title=t),_e(m,e,r);const s={};67141632&r[6]&&(s.$$scope={dirty:r,ctx:e}),!o&&4096&r[0]&&(o=!0,s.open=e[12],le((()=>o=!1))),i.$set(s),e[22]&&e[23]?w?(w.p(e,r),12582912&r[0]&&we(w,1)):(w=Pu(e),w.c(),we(w,1),w.m(a.parentNode,a)):w&&(pe(),ye(w,1,1,(()=>{w=null})),ge());const d={};1024&r[1]|67141632&r[6]&&(d.$$scope={dirty:r,ctx:e}),!c&&512&r[1]&&(c=!0,d.open=e[40],le((()=>c=!1))),l.$set(d);const p={};384&r[0]|67108864&r[6]&&(p.$$scope={dirty:r,ctx:e}),!h&&128&r[0]&&(h=!0,p.open=e[7],le((()=>h=!1))),u.$set(p)},i(e){f||(we(m.block),we(i.$$.fragment,e),we(w),we(l.$$.fragment,e),we(u.$$.fragment,e),f=!0)},o(e){for(let e=0;e<3;e+=1){ye(m.blocks[e])}ye(i.$$.fragment,e),ye(w),ye(l.$$.fragment,e),ye(u.$$.fragment,e),f=!1},d(e){e&&D(n),m.block.d(e),m.token=null,m=null,e&&D(r),be(i,e),e&&D(s),w&&w.d(e),e&&D(a),be(l,e),e&&D(d),be(u,e)}}}let ih=new Map,oh=new Map,sh=new Map;const ah=(e,t)=>ih.set(e,t),lh=e=>ih.get(e),ch=async(e,n)=>{const r="p$"+e+"$"+n,i=ih.get(r);if(i?.length)return i;const o=n;return ih.has(o)||(ih.set(o,[]),ih.set(o,t.getTasksList(n).then((({data:e})=>e)))),ih.get(o)},dh=async(e,n,r,i=!1)=>{let o=oh.get(r);if(!o)if(i)o=t.getTaskList(e,r),oh.set(r,o);else{const i="p$"+e+"$"+n,s=await ih.get(i);if(!s?.length)return ch(e,n).then((n=>(o=n.find((({_id:e})=>e===r)),o||(o=t.getTaskList(e,r)),oh.set(r,o),o)));o=s.find((({_id:e})=>e===r)),o||(o=t.getTaskList(e,r)),oh.set(r,o)}return o},uh=(e,t)=>{sh.set(e,t)},hh=e=>sh.get(e),fh=(e,n,r=!1)=>{let i=!r&&sh.get(n);return i||(i=t.getTask(e,n),sh.set(n,i)),i},mh=(e,n)=>{if(!ih.get(n))return;const r=n;ih.set(r,t.getTasksList(n).then((({data:e})=>e)))};function ph(e){return new Promise((t=>setTimeout(t,e)))}function gh(e,o,l){let d,f,m,p,g,y,_,I;b(e,h,(e=>l(133,g=e))),b(e,a,(e=>l(134,y=e))),b(e,i,(e=>l(135,_=e)));const{Modal:C,Dialog:$,Divider:E,Button:A,FormField:S,Checkbox:N,Chip:R}=c,{loggedIn:D,currentTasks:k,environment:O}=u;b(e,D,(e=>l(136,I=e))),b(e,k,(e=>l(131,m=e))),b(e,O,(e=>l(132,p=e))),JSON.parse(n.getItem("Locale"));const x=K();let{schema:M}=o,{recID:B}=o,{deletable:P}=o,{prevEventID:L=!1}=o,{prev:F=!1}=o,{taskId:V=!1}=o,{taskOrg:U}=o,{description:H=""}=o,{root:W=!1}=o,{readonly:z}=o,{isStandalone:q}=o,{shortEdit:j=!1}=o,{shortSchema:G=!1}=o,X=!1,Q="",J=window.location.href.split("/task/")[2];J&&(J=J.split(":")[1],J&&(J=J.split("?")[0])),j&&(M=G);let ee,te,ne,re,ie,oe,ae={},le={},ce="form-"+M.class+Math.floor(9e3*Math.random()+1e3).toString(),de=!1,ue=!1;const he=W?"fEmbedded":"fTask",fe=W?"sEmbedded":"sTask";let me="CHF";const pe=new Map;let ge,we,ye=0,ve=0,_e=0,Ie=0,Ce=1,$e=!B&&M.list&&1===M.list.length;const Ee={},Ae=M.items.find((e=>"price"===e.name&&!e.properties?.hidden)),be=M.items.find((e=>"quantity"===e.name&&!e.properties?.hidden)),Se=M.items.find((e=>"amount"===e.name&&!e.properties?.hidden)),Te=!!Ae||!!Se,Ne=M.list?.filter((e=>"array"===e.type))?.length>1||M.items?.filter((e=>e.name.startsWith("amount")))||Te,Re=M.items.find((e=>"number"===e.type&&"w"===e.properties?.unit?.constant?.toLowerCase()&&!e.properties?.hidden))?.name,De=!!Re,ke=M.list?.filter((e=>"array"===e.type))?.length>1||De,Oe={},xe=M.result?.resultDef[0].button?.description;let Me,Be,Pe,Le,Fe,Ve,Ue,He,We,ze,qe,je,Ge,Xe="",Ye="",Ze="",Ke=!1,Qe=!1,Je=!1,et=!1,tt=!1,nt=0,rt=0,it=[],ot=[],st=[],at={},lt=new Map,ct=M.class,dt=M.id,ut=!1,ht=-1!==window.location.search.indexOf("next="),ft=0;const mt=-1!==window.location.search.indexOf("back=true");We=He=!m?.length||m.find((e=>e===dt));["readonly","hidden","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(".");it.push({action:e,itemName:t.name,refObj:r,refName:i,op:t.properties[e].invert?"!":""})}))}));M.items.filter((e=>e.selection&&e.constraint)).map((e=>{ot.push({name:e.name,selection:e.selection,constraint:e.constraint})}));M.items.filter((e=>e.lookup)).forEach((e=>{st.push({name:e.name,lookup:e.lookup})})),M.items.filter((e=>e.properties?.lookup)).forEach((e=>{st.push({name:e.name,lookup:e.properties.lookup.split(":").at(-1)})}));const pt=async e=>{if(e?.length)for(const n of e){if(!n.lookup)break;const{name:e}=n;if(ae[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(9,ae[e]=t,ae)}}}},gt=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(9,ae[i]=d,ae)},wt=async e=>{if(!M.input)return;if(!M.input.length)return;if(M.input.length>1)return;const t=Ve.input.class[0],{name:n,selection:r,state:i,list:o}=t;n||r&&i&&o&&await yt(r,i,o)},yt=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(9,ae={...ae,...o})),100)},vt=()=>{for(const e of M.items)"boolean"==typeof e.properties?.value&&l(9,ae[e.name]=e.properties.value,ae),"string"==typeof e.properties?.value&&l(9,ae[e.name]=e.properties.value,ae),e.properties?.value?.concatenation&&It(e);_t()},_t=async()=>{for(const e of M.list||[])for(const n of e.item)if(n.refItem&&"array"!==e.type)if("owner"===n.refItem){const r=p.owner;r||T(O,p.owner=r=(await t.getSolitaire(n.refItem))[0],p),p.owner||(await t.getSolitaire(n.refItem))[0],r&&(ae[e.name]||l(9,ae[e.name]={},ae),l(9,ae[e.name][n.name]=v(r,n.refPos||n.name),ae))}else if(ae[n.refItem]){const r=await t.getTask(n.refItem,ae[n.refItem]);r&&(ae[e.name]||l(9,ae[e.name]={},ae),l(9,ae[e.name][n.name]=v(r,n.refPos||n.name),ae))}},It=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 $t(e.refItemNext));l(9,ae[e.name]=n,ae)},Ct=async e=>{const t=it.filter((t=>t.refObj===e||t.itemName===e));if(t?.length){l(31,at={});for(const e of t){const{itemName:t,refObj:n,refName:r,op:i}=e;let{action:o}=e;if(!n)break;let s,a,c=!r&&ae[n];const d=ae[n];d&&r&&(c=(await fh(n,d))[r]),Array.isArray(c)&&0===c.length&&(c=!1),"!"===i&&(c=!c),"required"!==o&&"readonly"!==o||(o="required"===o?o:"disabled",setTimeout((()=>{s=`#${ce} .form-field.${t} .field #${t}`,a=document.querySelector(s),a&&c&&a.setAttribute(o,""),a&&!c&&a.removeAttribute(o)}),0)),"hidden"===o&&(s=`#${ce} .form-field.${t}`,a=document.querySelector(s),a?.classList?.toggle("hidden",!!c),c&&l(31,at[t]="",at))}}},$t=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")},Et=(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||ae[i]&&!a&&(a=ae[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 ur(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&&ae[i]){a=ae[i];try{return ur(a,"%d.%m.%Y").toISOString()}catch{return a}}return a},At=async e=>{l(42,d=!0);const n=e.submitter?.className?.includes("close"),r={_docAsync:e?._docAsync};Array.from(document.querySelectorAll("form#"+ce+" ."+ce)).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]=Et(i.item,e)}}else r[e.name]=Et(M.items,e);else if(e.id){"signature"===M.items.find((t=>t.name===e.id)).type&&(e.name=e.id,r[e.name]=Et(M.items,e))}}));let i=!1;if(M.list&&M.list.map((e=>{if(e.mandatory){const t=le[e.name]?.filter((e=>!e._delete)).length;if(!t||t<2)return void(i=!0)}"array"===e.type&&le[e.name]&&(e.item.forEach((t=>{for(const n of le[e.name])void 0===n[t.name]&&(n[t.name]="boolean"!==t.type&&"")})),r[e.name]=le[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]=Et(e.item,{name:n,value:r,checked:r},"",!0)),t)),{}))),[]))})),i)return s.failed("Bitte Positionen erfassen",3e3),void l(42,d=!1);if(r._event=dt,r._prevEventId=L,r._taskId=V,re){const e=re.record;for(const t in e)t.includes(".")&&delete e[t];e._event=re.event,e._taskId=re.taskId;const{id:n}=await t.saveData(re.class,e);r[re.class]||(r[re.class]=n)}if(j)return bt(M.class,r),l(42,d=!1),Tt();const{id:o,task:a,tax:c,error:u,state:h,info:f}=await t.saveData(M.class,r);if(u?.text){const e=u.field?" in "+u.field+": "+u.value:"";if(l(8,Q=`${u.text} ${e}`),l(7,X=!0),!h)return void l(42,d=!1)}if(je){const e=new FormData;e.append("title",je.fileName),e.append("file",je.file),await t.uploadUserReport(a,e)}f&&!Array.isArray(f)&&f.accepted?f.accepted?.length?s.success(`Email versandt an ${f.accepted.join(", ")}, Dateigrösse: ${f.messageSize} Bytes.`,5e3):(l(8,Q="Email konnte nicht versandt werden!"),l(7,X=!0)):s.success("Die Daten wurden gespeichert.",2e3),l(42,d=!1),l(17,ve=c?._amount||0),l(18,_e=100*(c?._rate||0)||""),Ot(),r._id=o;const m=await t.getTaskList(M.class,o);if(x("choose",{row:m}),n)return l(42,d=!1),Tt();if(!B){if(ht){const e=Math.floor(9e3*Math.random()+1e3).toString();return window.singleSpaNavigate(`/task/${dt}/${dt}/task?next=${e}`)}return window.singleSpaNavigate(`/task/${dt}/${a}/task`)}},bt=async(e,n)=>{if(!j.lookup)return;const r={};for(const e in n){const t=n[e];Array.isArray(t)||j.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[j.ref];for(let s=0;s<i.length;s++){o=!0;const a=i[s];for(const e in a)if(j.lookup.includes(e)&&a[e]!=n[j.ref][0][e]){o=!1;break}if(o)return i[s]=n[j.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[j.ref].push(n[j.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)},St=()=>j||ne||q||!L?Tt():window.history.back(),Tt=()=>mt?x("back"):q?window.close():W?window.singleSpaNavigate("/"):x("back"),Nt=async({detail:e})=>{if(Array.isArray(e.value)&&pe.set(e.name,e.value),!(M.input?.length&&M.input.length>1))return;if(ee?.class!==M.input[0]&&!J)return;let n,{value:r,lookup:i,name:o,view:s}=e;if(!i&&!J)return;if(i&&(n=i.split(":")[0]),s||(n=o,s="_id"),J){if(n=M.input[1],!pe?.size||!pe.get(e.name)?.length)return void l(9,ae[n]=[],ae);s=o,r=[J]}const a=await t.getSectionView(n,{[s]:{$in:r}}),c=a.map((e=>e._id));for(const e of M.input.slice(1)){l(9,ae[e]=[],ae);const r=await t.getSchemaByClass(e);r.id;let i=await t.getTasks(r.id);if(i=i.data.filter((e=>"Ready"===e._task?.status&&(c.includes(e[n])||c.includes(e._id)))),i?.length){const{filter:r}=Ve.input.class.find((t=>t.name===e)),{refItem:o,value:s}=r||{},c=[];if(i.forEach((e=>{if(r){const t=a.find((t=>t._id===e[n]));t&&t[o]===s&&c.push(e._id)}else c.push(e._id)})),c.length){const n=await t.getSectionView(e,{_id:{$in:c}});for(const t of n)t[e]=t._id;l(9,ae[e]=n,ae)}}}},Rt=async(e,n,r)=>{if(1===Ve.input?.class?.length){const t=Ve.input.class[0],{name:r,selection:i,state:o,list:s,exclude:a}=t;e===r&&i&&o&&s&&await Dt(e,n,i,o,s,a)}if(M.input&&M.input.length>1&&!J){if(M.input[0]!==e)return;const{name:i,source:o,destination:s,selection:a}=Ve.input.class[1];if(o&&s){const t=await fh(e,n);if(!t)return void l(9,ae[s]=[],ae);const r=await fh(a,t[a]);if(!r)return;const i=r[o]||[];return void l(9,ae[s]=i,ae)}const{recursive:c}=Ve.input.class[1];if(n){let i=await t.getTaskOptions(`${e}:${n}`,dt,c);if(r){const e=s.split(".")[1],t=[];i[e].forEach((n=>{ae[e]?.find((t=>t[e]===n[e]))||t.push(n)})),i={[e]:ae[e]?[...ae[e],...t]:[...t]}}l(9,ae={...ae,...i})}else{const e=M.input.slice(1);for(const t of e)l(9,ae[t]=[],ae)}}for(const e of Ve.output.class[0].item)"date"===e.type&&e.properties?.value?.formula?Ht(e.name):void 0!==e.factor&&l(9,ae[e.name]=ae[e.name]*e.factor,ae);if((async()=>{const e=M.items.find((e=>"textarea"===e.properties?.format&&e.properties?.source));if(e&&!ae[e.name]){const t=new Set;let n="";for(const r of e.properties.source){const[e,i,o]=r.split("."),s=ae[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 fh(a.refClass,s);e&&e[o]&&(n+=e[o])}}if(n)break}if(n)break}n&&l(9,ae[e.name]=n,ae)}})(),M.list?.length){let e=He;for(const t of M.list)"array"===t.type&&t.mandatory&&ae[t.name]&&!ae[t.name].length&&(e=!1);l(37,We=e)}},Dt=async(e,t,n,r,i,o)=>{n=[].concat(n);for(const s of n)await kt(e,t,s,r,i,o)},kt=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&&Ve.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 h=await t.getSectionView(c,l);for(const e of h)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(9,ae={...ae,...u})),100)},Ot=()=>{let e=0;if(Ae){let t=1;be&&(t=Ce),e=Ie*t}Se&&(e=Ie);let t=0;for(const e in Ee)t+=Ee[e];let n=0;for(const e of M.items)e.name.startsWith("amount")&&(n+=+ae[e.name]);l(16,ye=t+e),ae.discount>0&&l(16,ye-=ye*ae.discount*.01),l(16,ye+=n)},xt=()=>{let e=0;for(const t in Oe)e+=Oe[t];l(30,nt=e+ +rt)},Mt=({detail:e})=>{le[e.listName]=e.value,Ne&&(Ee[e.listName]=e.amountValue,Ot()),ke&&(Oe[e.listName]=e.weeksValue||0,xt()),e.addToRecord&&l(11,ie=e)};r.subscribe((async e=>{if(!e)return;if(!B)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(!ih.get(e))return;const r=t;oh.set(r,n)})(i.event,i.docId,i.data);const o=await t.getTask(n.class,i.docId),s=ae[n.class].filter((e=>e[n.class]==o._id));s?.length&&s.map((e=>{e[n.class]=i.docId})),l(9,ae),l(103,te),l(102,ee),l(0,M)})),Y((async()=>{if(ih=new Map,oh=new Map,sh=new Map,await Pt(),!j)return;const e={...ae};let n=e[j.ref][0];for(const e in n)n[e]||(n[e]=j.value[e]);const r={};for(const t in e){const i=e[t];if(Array.isArray(i))for(const e in n){const t=n[e];j.lookup.includes(e)&&(r[j.ref+"."+e]=t)}else j.lookup.includes(t)&&(r[t]=i)}if(j.lookup.includes("date")){const e=new Date,t=new Date(e.getFullYear(),e.getMonth(),e.getDate()).toISOString();r.date=t}const i=await t.getSectionView(M.class,r);let o=!1;for(const e of i){if((await t.getTaskByDocId(e._id,!0)).status.startsWith("WaitingForApproval")){if(o)break;for(const t of e[j.ref]){let e=!0;for(const r in t)if(j.lookup.includes(r)&&t[r]!=n[r]){e=!1;break}if(e){for(const e in t)j.lookup.includes(e)||(n[e]=t[e]);o=!0;break}}}}l(9,ae[j.ref][0]=n,ae);const s=(j.focus||j.fill.at(-1))+"-0",a=document.getElementById(s);a&&a.focus()}));const Bt=async()=>{Me&&(Be||(Be=await t.getEvent(dt)),l(36,ht=!0),Me.autostart&&Xt())},Pt=async()=>{const e=e=>new Promise((t=>setTimeout(t,e)));let t,n=0;for(;!(t=document.getElementById(ce)&&!et&&!tt)&&++n<20;)await e(50);t||(t=document.getElementById(ce)),t&&(()=>{if(B)return;const e=new Set;for(const t of it)e.add(t.refObj||ct);Array.from(e).forEach((e=>Ct(e)))})(),Lt()},Lt=()=>{setTimeout((()=>{Array.from(lt).forEach((([e,t])=>{ae[e]||l(9,ae[e]=t._id,ae)}))}),350)};Z((()=>{B&&T(h,g={[B]:{record:ae,lists:le}},g)}));const Ft=()=>{const e={};Array.from(document.querySelectorAll("form#"+ce+" ."+ce)).map((t=>{if(t.name)if(t.name.includes(".")){const[n,r]=t.name.split("."),i=M.list.find((e=>e.name===n));e[t.name]=Et(i.item,t)}else e[t.name]=Et(M.items,t,t.name.split("_")[0])})),M.list&&M.list.map((t=>{"array"===t.type&&le[t.name]&&(e[t.name]=le[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]=Et(t.item,{name:n,value:r,checked:r},"",!0)),e)),{}))),[]))}));let t=!0;return 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)})),t&&e},Vt=async e=>{let n;for(l(41,ft=0),jt();!n&&Ge;){l(41,ft++,ft);const r=await t.progressReport(e);if(n=r?.progressValue,ft>300)break;await ph(1e3)}if(Gt(),n){const t="/api/report/list/"+e;window.open(t,"_self","width=1 height=1")}},Ut=(e,t)=>("number"==typeof e&&e||(e=Number(e||0)),e.toFixed(t||0)),Ht=async e=>{if(!e)return;const t=M.items.find((t=>t.name===e)),n=t.properties.value.formula,{operator:r,argument:i}=n,o=i.map((e=>ae[e.refItem]));let s=0;if("$add"===r){if("date"===t.type)return void l(9,ae[e]=await Wt(r,i),ae);s=o.reduce(((e,t)=>+(e||0)+ +(t||0)))}if("$subtract"===r&&(s=o.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&&(s=o.reduce(((e,t)=>+(e||0)*+(t||0)))),"$percentMultiply"===r){const[e,t]=o;if(!+e)return;s=+e,+t>0&&(s*=1-t/100)}if("$percentDivide"===r){const[e,t]=o;if(!+e||!+t)return;s=+e/+t*100}l(9,ae[e]="$multiply"===r?s?Ut(s,t.properties?.decimals):"":Ut(s,t.properties?.decimals),ae)},Wt=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=zt(ae[r])||Date.now();let l=s?0:i;if(o){if("owner"===o)p.owner||T(O,p.owner=await t.getSectionView("owner",{}),p),l=v(p.owner,s);else if(ae[o]){const e=await fh(o,ae[o]);e&&(l=v(e,s))}}else l=l||ae[s];return c=l||0,(d=new Date(a)).setDate(d.getDate()+Number(c)),d;var c,d},zt=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()},qt=()=>{l(12,de=!1)},jt=()=>{l(40,Ge=!0)},Gt=()=>{l(40,Ge=!1)},Xt=()=>{l(28,Qe=!1),l(25,Ye=""),l(24,Xe=""),l(26,Ze=""),l(23,Pe=!0)},Yt=()=>{l(24,Xe=""),l(25,Ye=""),l(26,Ze=""),l(28,Qe=!1),l(27,Ke=!0),Zt()},Zt=()=>{if(!Me.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,B=e.recID),"deletable"in e&&l(3,P=e.deletable),"prevEventID"in e&&l(98,L=e.prevEventID),"prev"in e&&l(4,F=e.prev),"taskId"in e&&l(1,V=e.taskId),"taskOrg"in e&&l(99,U=e.taskOrg),"description"in e&&l(96,H=e.description),"root"in e&&l(5,W=e.root),"readonly"in e&&l(97,z=e.readonly),"isStandalone"in e&&l(100,q=e.isStandalone),"shortEdit"in e&&l(6,j=e.shortEdit),"shortSchema"in e&&l(101,G=e.shortSchema)},e.$$.update=()=>{16&e.$$.dirty[3]&&l(42,d=z),1&e.$$.dirty[0]|1536&e.$$.dirty[3]&&te&&ee&&(M.items.map((({name:e,type:t,refItem:n,properties:r})=>{if(!1===n)return;const i=ee.items.find((t=>t.name===e));if(!i)return;if(t!==i.type)return;const o="_"+e;te[e]?l(9,ae[e]=te[e],ae):n&&n.startsWith("owner")||r&&r.readonly||l(9,ae[e]="",ae),te[o]&&l(9,ae[o]=te[o],ae),l(21,$e=!1)})),(()=>{for(const e of M.list||[]){const t=[],n=ae[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||ae[t.refItem])n[t.name]=ae[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(9,ae[e.name]=t,ae)}}})()),32&e.$$.dirty[0]|8&e.$$.dirty[3]&&l(43,f=W?H||"enablerr - Form":document.title)},[M,V,B,P,F,W,j,X,Q,ae,ne,ie,de,ue,oe,me,ye,ve,_e,ge,we,$e,Me,Pe,Xe,Ye,Ze,Ke,Qe,et,nt,at,Le,Fe,ut,Ue,ht,We,ze,qe,Ge,ft,d,f,C,$,E,A,S,N,R,D,k,O,ce,he,fe,{name:"amountValue",properties:{decimals:2}},{name:"taxValue",properties:{decimals:2}},pe,Ne,ke,{name:"weekValue",properties:{decimals:1}},xe,dt,async()=>{if(l(33,Fe=[]),p.owner||T(O,p.owner=await t.getSectionView("owner",{}),p),p.currency?l(15,me=p.currency.designation):t.getSectionView("owner",{}).then((e=>{e?.length&&e[0].currency&&fh("currency",e[0].currency).then((e=>{e&&l(15,me=e.designation)})).catch((e=>console.log("currency not found")))})),ae.currency&&fh("currency",ae.currency).then((e=>{e&&l(15,me=e.designation)})).catch((e=>console.log("currency not found"))),Ve=await t.getEvent(dt),j&&l(9,ae[j.ref]=[{...j.value}],ae),!B){if(l(32,Le=Fe),pt(Ve.input?.class).then((()=>{tt=!0})),vt(),gt(Ve),wt(),J){const e=Ve.input.class[0].selection;ae[e]||(l(9,ae[e]=[J],ae),Nt({detail:{value:[J],name:e}}))}await(async()=>{if(!d&&(Be||(Be=await t.getEvent(dt)),l(22,Me=Be.output.class[0].reader),Me&&!Me.keyboard))try{const e=await getCameras();e?.length||l(22,Me=!1)}catch{}})(),Bt()}if(B){if(g&&g[B]){const e=g[B],t=e.record;M.items.map((e=>{t[e.name]=Et(M.items,{name:e.name,value:t[e.name],checked:t[e.name]})})),l(9,ae=t),M.list&&M.list.map((t=>{"array"===t.type&&e.lists[t.name]&&l(9,ae[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]=Et(t.item,{name:n,value:r,checked:r},"",!0)),e)),{}))),[]),ae)}))}else l(9,ae=await t.getTask(M.class,B));if(l(96,H=w(M,ae)),M.result,l(34,ut=!!M.result?.resultDef&&!M.result.resultDef[0].createAfterSave),l(17,ve=ae._tax?._amount),l(18,_e=100*ae._tax?._rate||""),l(39,qe=M.list?.find((e=>e.mandatory))&&Ve.input?.class?.length>1),qe){(U||await t.getTaskByDocId(B,!0)).visum&&l(39,qe=!1)}l(11,ie={itemName:M.class,value:B})}if(L){l(97,z=!1),l(102,ee=await t.getSchema(L)),"string"==typeof F&&l(103,te=await t.getTask(ee.class,F));const e=M.items.find((e=>e.refClass===ee.class));e&&l(9,ae[e.name]=te._id,ae)}if(ke&&(rt=ae[Re]||0),Ve.trigger?.startOn&&!Ve.trigger.startOn.some((e=>e.type.indexOf("Manual")>=0))&&l(97,z=!0),y.role?.length&&M.authorization?.length){const e=M.authorization.some((e=>_?.find((t=>t===e.role&&"edit"===e.activity))));l(97,z||=!e)}if(l(10,ne="report"===Ve.output.type),l(38,ze=Ve.output.saveButton),p.userSetting){const e=p.userSetting;if(l(35,Ue=e.isAdmin),!Ue){const e=I.tenants.find((e=>e._id===I.tenant));e&&l(35,Ue=e.admin?.find((e=>e===I.user)))}}else t.getUserSettings().then((e=>{if(l(35,Ue=e.isAdmin),!Ue){const e=I.tenants.find((e=>e._id===I.tenant));e&&l(35,Ue=e.admin?.find((e=>e===I.user)))}}));return l(29,et=!0),!0},At,St,async({detail:e})=>{const{row:n}=e;let{eventId:r}=e;if((()=>{if(B)for(const e of it)e.refName||Ct(e.itemName)})(),await(async(e,t)=>{if(!e&&!t?._id)return;let n,r=!1;const i={...ae};for(const o of M.items){if("string"==typeof o.refItem&&(!e||o.properties?.linkOnly)){const[e,s]=o.refItem.split(".");if("owner"===e)o.refItem.split(".").length<3&&(i[o.name]=p.owner[s||o.refClass],r=!0);else if(o.refInput?.includes("|")&&ae[e]){const[t,s]=o.refInput.split("|");n=await fh(e,ae[e]),i[o.name]=n[t]||n[s]||"",r=!0}else if(ae[e]){if((t._id===ae[e]||o.refItemAlt)&&(n=await fh(e,ae[e]),n)){let e;24===n[s]?.toString().length?(n=await fh(s,n[s]),n&&(e=n[o.name||o.refInput])):s?(e=n[s][o.name]||n[s],"object"==typeof e&&(e=void 0)):e=n[o.name],void 0!==e&&(i[o.name]=e,r=!0)}}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((ae[e]||t[e])&&(n=await fh(e,ae[e]||t[e]),n)){let e;24===n[s]?.toString().length?(n=await fh(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&&ae[t.refItem]){n=await fh(refItem,ae[t.refItem]);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}r&&l(9,ae=i)})(!!B,n),B)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=st.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 fh(t,n);e&&e[r]?.length&&(i=e[r][0][r])}i&&l(9,ae[r]=i,ae)}})(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(9,ae[e.name]="",ae)}))),!n._task)return;const i=n._task.event,o=await t.getEvent(i);for(const e of Ve.output.class[0].item)"date"===e.type&&e.properties?.value?.formula&&Ht(e.name);if(!Ve.output?.class?.length)return;const s=Ve.output.class[0]?.item.find((e=>(e.refClass||e.name)===o.output.class[0]?.name));(Ve.input?.class?.length&&Ve.input.class[0].name===o.output.class[0]?.name||s?.asInput)&&(l(102,ee=await t.getSchema(i)),l(98,L=i),l(1,V=n._task._id),V&&n._task.docId?l(103,te=await t.getTask(ee.class,n._task.docId)):l(103,te={}),await Rt(ee.class,n?._task?.docId||n?._task?._id))},async({detail:e})=>{if(!j&&(l(11,ie=e),"quantity"===e.itemName&&l(20,we=ae.quantity),"currency"===e.itemName&&e.value&&fh("currency",e.value).then((e=>{e&&l(15,me=e.designation)})).catch((e=>console.log("currency not found"))),(async(e,t)=>{const n=ot.filter((t=>t.selection===e||t.constraint===e));if(n?.length){l(19,ge=!1);for(const r of n){const{selection:n,constraint:i,name:o}=r;if(t)break;l(9,ae[o]="",ae),e===n&&l(19,ge=i);const s=ae[n];if(s&&e===i){let e=await fh(n,s);const t=ae[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(9,ae[o]=r,ae)}}}}})(e.itemName,e.oldValue===e.value),_t(),Ct(e.itemName),ke&&Re&&(e.itemName===Re&&(rt=+e.value),xt()),Te&&Ne)){if(e.itemName===Ae?.name)Ie=e.value;else if(e.itemName===be?.name)Ce=e.value;else{if(e.itemName!==Se?.name)return;Ie=e.value}Ot()}},Nt,Mt,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 s.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 a="/viewer/doc/index.html?file="+o+"&type="+i;window.open(a,"","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 se(),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=Ft();if(!e)return;const n=Ve.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(dt,e);await Vt(r),Tt()},async()=>{const e=Ft();if(!e)return;const n=await t.getReportData(dt,e),r=window.screen.height,i=window.open("","_blank","width=800,height="+r+",location=no");await se(),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(ct!==r)return;if(!e)return;if(lt.has(e))return;if(!0!==r&&(r=(r=[].concat(r)).some((e=>e===ct))),!r)return;const i={[n]:!0},o=await t.getSectionView(e,i);o?.length&&lt.set(e,o[0])},({detail:e})=>{re=e},({detail:e})=>{e.target&&M.list?.length?l(14,oe={ref:e.target,val:e.value}):e.itemName.startsWith("$")?je=e.value:setTimeout((()=>{l(9,ae[e.itemName]=e.value,ae)}),200)},({detail:e})=>{l(13,ue=!1);for(const t of e.items)l(9,ae[e.listName][t.name]=t.value,ae);l(13,ue=!0)},({detail:e})=>{Ht(e.item.name)},()=>M.result.resultDef[0].button?.designation||"Dokument erstellen",()=>{l(12,de=!0)},qt,Gt,async()=>{if(ct&&B){(await t.deleteData(ct,B)).taskId?(s.success("Die Daten wurden gelöscht.",3e3),St()):s.failed("Die Daten können nicht gelöscht werden!",3e3)}qt()},async()=>{if(!qe)return;const e=Ve.input.class[0].name,t=Ve.input.class[1].destination.split(".")[1];if(!e)return;if(!t)return;if(!ae[e])return;const n=ae[t]?.length||0;await Rt(e,ae[e],!0),n<ae[t].length?(Mt({detail:{listName:t,value:ae[t]}}),At({})):s.failed("Keine Positionen gefunden!",3e3)},()=>{B&&At({_docAsync:!0})},Xt,async({detail:e})=>{if(l(28,Qe=!1),l(25,Ye=""),l(24,Xe=e.text||""),!Xe)return;const n=Is(Xe);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(9,ae[e]=n[0]._id,ae)}}else{n[e][i]&&(r[i]=n[e][i]);const o=await t.getSectionView(e,r);o?.length&&l(9,ae[e]=o[0]._id,ae)}}else n[e]&&l(9,ae[e]=n[e],ae)}l(23,Pe=!1)},()=>M.items.filter((e=>e.properties?.reader)),(e,t=!1)=>t?(Yt(),""):M.items.find((t=>t.name===e))?.designation||"",Yt,()=>{const{refItem:e}=Me,t={[e]:Ze};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]===Ze));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]}})})),Je=!0,Yt()},()=>{Je&&(Je=!1,At({}))},H,z,L,U,q,G,ee,te,function(e){ye=e,l(16,ye)},function(e){ve=e,l(17,ve)},function(e){nt=e,l(30,nt)},function(e){ht=e,l(36,ht)},()=>qt(),function(e){de=e,l(12,de)},function(e){Ke=e,l(27,Ke)},function(e){Pe=e,l(23,Pe)},()=>Gt(),function(e){Ge=e,l(40,Ge)},()=>{l(7,X=!1)},function(e){X=e,l(7,X)}]}class wh extends Te{constructor(e){var t;super(),Ud.getElementById("svelte-lfqa43-style")||((t=O("style")).id="svelte-lfqa43-style",t.textContent="form.disabled.svelte-lfqa43 input.svelte-lfqa43{background-color:red !important}input:placeholder-shown{font-style:italic}form.svelte-lfqa43.svelte-lfqa43{min-width:25em}hr[data-text]{margin-bottom:1em !important}@media only screen and (min-width: 600px){form.svelte-lfqa43.svelte-lfqa43{min-width:30em}}.fEmbedded.svelte-lfqa43.svelte-lfqa43,.fTask.svelte-lfqa43.svelte-lfqa43{overflow-y:auto;padding-right:1em;overflow-x:hidden}.fEmbedded.svelte-lfqa43.svelte-lfqa43{height:fit-content;min-height:30vh;max-height:60vh}.fTask.svelte-lfqa43.svelte-lfqa43{height:fit-content;max-height:70vh}.sTask.svelte-lfqa43.svelte-lfqa43{height:95%;display:inline-grid}.sTask.svelte-lfqa43 .btn.svelte-lfqa43{display:initial !important}.form--buttons.svelte-lfqa43.svelte-lfqa43{display:flex;gap:1em;padding-top:0.75em}.flex_div.svelte-lfqa43.svelte-lfqa43{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}",N(Ud.head,t)),Se(this,e,gh,rh,A,{schema:0,recID:2,deletable:3,prevEventID:98,prev:4,taskId:1,taskOrg:99,description:96,root:5,readonly:97,isStandalone:100,shortEdit:6,shortSchema:101},[-1,-1,-1,-1,-1,-1,-1])}}function yh(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 wh({props:o}),ee.push((()=>$e(t,"description",i))),t.$on("back",e[2]),{c(){Ee(t.$$.fragment)},m(e,n){Ae(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],le((()=>n=!1))),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function vh(e){let t,n;return t=new l({props:{update:e[1],description:e[0],$$slots:{default:[yh,({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(){Ee(t.$$.fragment)},m(e,r){Ae(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||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function _h(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 Ih=tc((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 Ch=ec(Ih)({component:class extends Te{constructor(e){super(),Se(this,e,_h,vh,A,{refresh:3})}},domElementGetter:()=>document.getElementById("detail-app")}),{bootstrap:$h,mount:Eh,unmount:Ah}=Ch;e({bootstrap:$h,mount:Eh,unmount:Ah});e("Form",wh),e("List",Zt),e("Template",class extends Te{constructor(e){var t;super(),fr.getElementById("svelte-1phofh5-style")||((t=O("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}",N(fr.head,t)),Se(this,e,Sr,Ar,A,{schema:0,record:1})}})}}}));