@seedtactics/insight-client 17.0.0-beta.0 → 17.0.0-beta.1
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/assets/{index-BkKYqUM0.js → index-gLnatT5a.js} +27 -27
- package/dist/cell-status/rebookings.d.ts +1 -0
- package/dist/cell-status/rebookings.js +4 -1
- package/dist/components/station-monitor/BasketLoadStationWork.js +6 -2
- package/dist/components/station-monitor/LoadStation.js +16 -1
- package/dist/components/station-monitor/Material.js +2 -0
- package/dist/data/move-arrows.d.ts +6 -1
- package/dist/data/move-arrows.js +14 -2
- package/dist/index.html +1 -1
- package/dist/network/backend.d.ts +1 -1
- package/package.json +1 -1
|
@@ -256,29 +256,29 @@ To suppress this warning, you need to explicitly provide the \`palette.${t}Chann
|
|
|
256
256
|
<tbody>
|
|
257
257
|
`;for(let n of e)if(!n.startofcycle)for(let e of n.material)t+=`<tr>`,t+=`<td>`+n.endUTC.toLocaleString(void 0,{month:`short`,day:`numeric`,year:`numeric`,hour:`numeric`,minute:`2-digit`})+`</td>`,t+=`<td>`+e.part+`-`+e.proc.toString()+`</td>`,t+=`<td>`+Gk(n)+`</td>`,t+=`<td>`+n.pal.toString()+`</td>`,t+=`<td>`+(e.serial||``)+`</td>`,t+=`<td>`+(e.workorder||``)+`</td>`,t+=`<td>`+Kk(n)+`</td>`,t+=`<td>`+BO(n.elapsed).toFixed(1)+`</td>`,t+=`<td>`+BO(n.active).toFixed(1)+`</td>`,t+=`</tr>
|
|
258
258
|
`;return t+=`</tbody>
|
|
259
|
-
</table>`,t}function Jk(e){Ak(qk(e)).catch(console.error)}var Yk=P([]),Xk=Yk,Zk=P([]),Qk=Zk;function $k(e,t){return e.map(e=>({station:e.stationGroup+` #`+e.stationNum.toString(),stationLabel:ak(e.stationGroup,e.stationNum,t),start:e.startUTC,end:e.endUTC,plannedDown:e.planDown??!1,parts:e.parts?.map(e=>({uniq:e.jobUnique,proc:e.process,path:e.path}))}))}var eA=P(null,(e,t,n)=>{let r=e(br)?.loadStationNames;t(Yk,e=>e.concat($k(n.stationUse,r)))}),tA=P(null,(e,t,{evt:n,now:r,expire:i})=>{if(n.newJobs?.stationUse){let a=n.newJobs?.stationUse,o=e(br)?.loadStationNames;t(Yk,e=>{if(i){let t=LT(r,-30),n=Q.of(e).minBy(e=>e.end.getTime());if((n===void 0||n.start>=t)&&a.length===0)return e;e=e.filter(e=>e.start>=t)}return e.concat($k(a,o))})}}),nA=P(null,(e,t,n)=>{let r=e(br)?.loadStationNames;t(Zk,$k(n.stationUse,r))});function rA(e){let{target:t}=e;if(!(t instanceof SVGElement))return null;let n=t instanceof SVGSVGElement?t:t.ownerSVGElement;if(!n)return null;let r=n.getScreenCTM();if(!r)return null;let i=n.createSVGPoint();return`changedTouches`in e?(i.x=e.changedTouches[0].clientX,i.y=e.changedTouches[0].clientY):(i.x=e.clientX,i.y=e.clientY),i.matrixTransform(r.inverse())}var iA=`__bms_measure_text_element`;function aA(e,t){try{let n=document.getElementById(iA),r;if(n instanceof SVGTextElement)r=n;else{let e=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);e.setAttribute(`aria-hidden`,`true`),e.style.position=`absolute`,e.style.top=`-100%`,e.style.left=`-100%`,e.style.width=`0`,e.style.height=`0`,e.style.opacity=`0`;let n=document.createElementNS(`http://www.w3.org/2000/svg`,`text`);if(!(n instanceof SVGTextElement))return null;r=n,r.setAttribute(`id`,iA),t&&(r.style.fontSize=t.toString()),e.appendChild(r),document.body.appendChild(e)}return r.textContent=e,r.getComputedTextLength()}catch{return null}}function oA(e,t,{signal:n,edges:r}={}){let i,a=null,o=r!=null&&r.includes(`leading`),s=r==null||r.includes(`trailing`),c=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},l=()=>{s&&c(),p()},u=null,d=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,l()},t)},f=()=>{u!==null&&(clearTimeout(u),u=null)},p=()=>{f(),i=void 0,a=null},m=()=>{c()},h=function(...e){if(n?.aborted)return;i=this,a=e;let t=u==null;d(),o&&t&&c()};return h.schedule=d,h.cancel=p,h.flush=m,n?.addEventListener(`abort`,p,{once:!0}),h}function sA(e,t=0,n={}){typeof n!=`object`&&(n={});let{leading:r=!1,trailing:i=!0,maxWait:a}=n,o=[,,];r&&(o[0]=`leading`),i&&(o[1]=`trailing`);let s,c=null,l=oA(function(...t){s=e.apply(this,t),c=null},t,{edges:o}),u=function(...t){return a!=null&&(c===null&&(c=Date.now()),Date.now()-c>=a)?(s=e.apply(this,t),c=Date.now(),l.cancel(),l.schedule(),s):(l.apply(this,t),s)};return u.cancel=l.cancel,u.flush=()=>(l.flush(),s),u}function cA(e,t=0,n={}){let{leading:r=!0,trailing:i=!0}=n;return sA(e,t,{leading:r,maxWait:t,trailing:i})}var lA=(e,t,n,r)=>{switch(t){case`debounce`:return sA(e,n,r);case`throttle`:return cA(e,n,r);default:return e}},uA=e=>{let t=L.useRef(e);return L.useEffect(()=>{t.current=e}),L.useMemo(()=>((...e)=>t.current?.call(t,...e)),[])},dA=e=>{let[t,n]=L.useState(e?.current||null);return e&&setTimeout(()=>{e.current!==t&&n(e.current)},0),{refProxy:L.useMemo(()=>new Proxy(e=>{e!==t&&n(e)},{get(e,n){return n===`current`?t:e[n]},set(e,t,r){return t===`current`?n(r):e[t]=r,!0}}),[t]),refElement:t,setRefElement:n}},fA=(e,t)=>{let n=e.borderBoxSize?.[0],r=e.contentBoxSize?.[0];return t===`border-box`&&n?{width:n.inlineSize,height:n.blockSize}:t===`content-box`&&r?{width:r.inlineSize,height:r.blockSize}:{width:e.contentRect.width,height:e.contentRect.height}};function pA({skipOnMount:e=!1,refreshMode:t,refreshRate:n=1e3,refreshOptions:r,handleWidth:i=!0,handleHeight:a=!0,targetRef:o,observerOptions:s,onResize:c,disableRerender:l=!1}={}){let u=(0,L.useRef)(e),d=uA(c),[f,p]=(0,L.useState)({width:void 0,height:void 0}),m=(0,L.useRef)({width:void 0,height:void 0}),{refProxy:h,refElement:g}=dA(o),{box:_}=s||{},v=(0,L.useCallback)(e=>{if(!i&&!a)return;if(u.current){u.current=!1;return}let t=(e,t)=>i&&e.width!==t.width||a&&e.height!==t.height;e.forEach(e=>{let n=fA(e,_);l?t(m.current,n)&&(m.current.width=n.width,m.current.height=n.height,d?.({width:n.width,height:n.height,entry:e})):p(r=>t(r,n)?(d?.({width:n.width,height:n.height,entry:e}),n):r)})},[i,a,u,_,l]),y=(0,L.useCallback)(lA(v,t,n,r),[v,t,n,r]);return(0,L.useEffect)(()=>{let e;if(g)try{e=new window.ResizeObserver(y),e.observe(g,s)}catch(e){console.warn(`ResizeObserver not supported or failed to initialize:`,e)}else(f.width||f.height)&&(d?.({width:null,height:null,entry:null}),m.current.width=void 0,m.current.height=void 0,l||p({width:void 0,height:void 0}));return()=>{var t,n,r;(t=e?.disconnect)==null||t.call(e),(r=(n=y).cancel)==null||r.call(n)}},[y,g]),Object.assign({ref:h},l?m.current:f)}var mA=G(`div`)({backgroundColor:Lr[700],color:`white`,padding:`0.3rem 0.5rem`,borderRadius:`3px`,boxShadow:`0 1px 2px rgba(33, 33, 33, 0.2)`,pointerEvents:`none`});function hA({chartHeight:e,chartWidth:t,atom:n,TooltipContent:r}){let i=R(n),{ref:a,width:o,height:s}=pA({refreshMode:`debounce`,refreshRate:100});if(!i)return null;let c=i.left,l=i.top;return o!==void 0&&(c+10+o>t&&c+10>t/2?c=c-o-30:c+=10),s!==void 0&&(l+10+s>e&&l+10>e/2?l=l-s-10:l+=10),(0,H.jsx)(`div`,{style:{visibility:s!==void 0&&o!==void 0?`visible`:`hidden`,position:`absolute`,left:c,top:l,zIndex:10},children:(0,H.jsx)(mA,{ref:a,style:i?.zIndex?{zIndex:i.zIndex}:void 0,children:(0,H.jsx)(r,{tooltip:i})})})}function gA({chart:e,tooltipAtom:t,TooltipContent:n,sx:r,autoHeight:i}){let{ref:a,width:o,height:s}=pA({refreshMode:`debounce`,refreshRate:100});return(0,H.jsx)(J,{ref:a,sx:r,children:(0,H.jsxs)(J,{sx:{position:`relative`,overflow:`hidden`},children:[o&&(s||i)?e({width:o,height:s??0}):void 0,s&&o?(0,H.jsx)(hA,{chartHeight:s,chartWidth:o,atom:t,TooltipContent:n}):void 0]})})}function _A(e){return Q.ofObject(e.baskets??{}).collect(([,e])=>e.position.location===_t.LoadUnload||e.position.location===_t.LoadStationStaging?[e.basketId,{group:`L/U`,num:e.position.locationNum}]:null).toRMap(([e,t])=>[e,t])}function vA(e,t,n){return e.action.type===st.LoadingToBasket?n.get(e.action.loadToBasketId??0)??null:e.action.type===st.Loading?e.action.loadOntoPalletNum?t.get(e.action.loadOntoPalletNum)??null:e.action.loadFromBasketId?n.get(e.action.loadFromBasketId)??null:null:e.location.palletNum?t.get(e.location.palletNum)??null:e.location.basketId?n.get(e.location.basketId)??null:null}function yA(e,t,n,r){return Q.of(e.material).collect(e=>{if(e.action.type!==st.Machining||!e.location.palletNum)return null;let t=n.get(e.location.palletNum);return t?{mat:e,loc:t}:null}).groupBy(({loc:e})=>e.group,({loc:e})=>e.num).map(([[n,i],a])=>{let o=t.get(new VO(a[0].mat.partName,n,a[0].mat.action.program??``)),s=zO(a[0].mat.action.elapsedMachiningTime??`PT0S`),c=zO(a[0].mat.action.expectedRemainingMachiningTime??`PT0S`);return{station:ak(n,i,r),start:YT(e.timeOfCurrentStatusUTC,-s),expectedEnd:YT(e.timeOfCurrentStatusUTC,c),isOutlier:o?qO(o,s/60/a.length):!1,parts:[{part:a[0].mat.partName,oper:a[0].mat.action.program??``}]}})}function bA(e,t,n,r){let i=_A(e);return Q.of(e.material).collect(e=>{if(e.action.type===st.UnloadToCompletedMaterial||e.action.type===st.UnloadToInProcess){let t=vA(e,n,i);return t?{mat:e,material:[e],proc:e.process,path:e.path,loc:t}:null}else if(e.action.type===st.Loading||e.action.type===st.LoadingToBasket){let t=vA(e,n,i);return t?{mat:e,material:[e],proc:e.action.processAfterLoad??e.process,path:e.action.pathAfterLoad??e.path,loc:t}:null}return null}).map(t=>{let n=e.jobs[t.mat.jobUnique],r=n?.procsAndPaths?.[t.proc-1],i=n?.procsAndPaths?.[t.proc-1]?.paths?.[t.path-1];if(t.mat.action.type===st.Loading||t.mat.action.type===st.LoadingToBasket){let e=t.mat.action.type===st.Loading?i?.expectedLoadTime:r?.expectedBasketLoadTime??i?.expectedLoadTime;return{...t,expectedLoadSecs:zO(e??`PT0S`)}}else{let e=t.mat.location.palletNum!==null&&t.mat.location.palletNum!==void 0?i?.expectedUnloadTime:r?.expectedBasketUnloadTime??i?.expectedUnloadTime;return{...t,expectedLoadSecs:zO(e??`PT0S`)}}}).groupBy(({loc:e})=>e.group,({loc:e})=>e.num).map(([[n,i],a])=>{let o=XO(a,e=>BO(e.mat.action.elapsedLoadUnloadTime??`PT0S`),e=>e.expectedLoadSecs/60),s=!1,c=0;for(let{cycle:e,elapsedForSingleMaterialMinutes:r}of o){let i=t.get(new VO(e.mat.partName,n,e.mat.action.type===st.Loading||e.mat.action.type===st.LoadingToBasket?`LOAD-`+e.proc.toString():`UNLOAD-`+e.proc.toString()));i&&qO(i,r)&&(s=!0),e.expectedLoadSecs>0?c+=e.expectedLoadSecs:i?.expectedCycleMinutesForSingleMat&&(c+=i.expectedCycleMinutesForSingleMat*60)}let l=zO(a[0].mat.action.elapsedLoadUnloadTime??`PT0S`);return{station:ak(n,i,r),start:YT(e.timeOfCurrentStatusUTC,-l),expectedEnd:YT(e.timeOfCurrentStatusUTC,-l+c),isOutlier:s,parts:Q.of(a).distinctAndSortBy(e=>e.mat.partName,e=>e.proc,e=>e.mat.action.type===st.Loading||e.mat.action.type===st.LoadingToBasket?`LOAD`:`UNLOAD`).map(e=>({part:e.mat.partName+`-`+e.proc.toString(),oper:e.mat.action.type===st.Loading||e.mat.action.type===st.LoadingToBasket?`LOAD`:`UNLOAD`})).toRArray()}})}function xA(e,t,n){let r=Q.ofObject(e.pallets).buildHashMap(([,e])=>e.palletNum,(e,[,t])=>t.currentPalletLocation);return yA(e,t,r,n).concat(bA(e,t,r,n)).toRArray()}function SA({scale:e,width:t,tickOverride:n}){return(0,H.jsx)(`g`,{children:(n??e.ticks()).map((n,r)=>(0,H.jsx)(`line`,{x1:0,y1:e(n),x2:t,y2:e(n),stroke:`#eaf0f6`,strokeWidth:1},r))})}function CA({scale:e,height:t,tickOverride:n}){return(0,H.jsx)(`g`,{children:(n??e.ticks()).map((n,r)=>(0,H.jsx)(`line`,{x1:e(n),y1:0,x2:e(n),y2:t,stroke:`#eaf0f6`,strokeWidth:1},r))})}function wA({xScale:e,yScale:t,width:n,height:r,rowTickOverride:i,colTickOverride:a}){return(0,H.jsxs)(`g`,{children:[(0,H.jsx)(SA,{scale:t,width:n,tickOverride:i}),(0,H.jsx)(CA,{scale:e,height:r,tickOverride:a})]})}var TA=8;function EA(e,t){if(t)return t.map(t=>({tick:t,pos:e(t)??0}));if(`ticks`in e&&e.ticks)return e.ticks().map(t=>({tick:t,pos:e(t)??0}));if(`bandwidth`in e&&e.bandwidth){let t=e.bandwidth();return e.domain().map(n=>({tick:n,pos:(e(n)??0)+t/2}))}else return e.domain().map(t=>({tick:t,pos:e(t)??0}))}function DA({top:e,scale:t,label:n,fontSize:r,tickFormat:i,tickOverride:a}){r??=10,i??=`tickFormat`in t&&t.tickFormat?t.tickFormat():e=>String(e);let o=EA(t,a),s=t.range();return(0,H.jsxs)(`g`,{transform:`translate(0, ${e})`,children:[(0,H.jsx)(`line`,{x1:s[0],y1:0,x2:s[1],y2:0,stroke:`#222`,strokeWidth:1,shapeRendering:`crispEdges`}),o.map((e,t)=>(0,H.jsxs)(`g`,{transform:`translate(${e.pos}, 0)`,children:[(0,H.jsx)(`line`,{y1:TA,y2:0,stroke:`#222`,strokeWidth:1,shapeRendering:`crispEdges`}),(0,H.jsx)(`text`,{dy:13,textAnchor:`middle`,fontSize:r,fill:`#222`,dominantBaseline:`hanging`,children:i(e.tick)})]},t)),n?(0,H.jsx)(`text`,{x:(s[0]+s[1])/2,y:TA+r+20,textAnchor:`middle`,fontSize:r+2,fill:`#222`,children:n}):void 0]})}function OA({left:e,scale:t,label:n,fontSize:r,tickFormat:i,tickOverride:a}){r??=10,i??=`tickFormat`in t&&t.tickFormat?t.tickFormat():e=>String(e);let o=EA(t,a),s=t.range();return(0,H.jsxs)(`g`,{transform:`translate(${e}, 0)`,children:[(0,H.jsx)(`line`,{x1:0,y1:s[0],x2:0,y2:s[1],stroke:`#222`,strokeWidth:1,shapeRendering:`crispEdges`}),o.map((e,t)=>(0,H.jsxs)(`g`,{transform:`translate(0, ${e.pos})`,children:[(0,H.jsx)(`line`,{x1:-8,x2:0,y1:0,y2:0,stroke:`#222`,strokeWidth:1,shapeRendering:`crispEdges`}),(0,H.jsx)(`text`,{dx:-13,textAnchor:`end`,fontSize:r,fill:`#222`,dominantBaseline:`middle`,children:i(e.tick)})]},t)),n?(0,H.jsx)(`text`,{x:-(s[0]+s[1])/2,y:-8-r-20,textAnchor:`middle`,fontSize:r+2,fill:`#222`,transform:`rotate(-90)`,children:n}):void 0]})}function kA({top:e,scale:t,label:n,fontSize:r,tickFormat:i,tickOverride:a}){r??=10,i??=`tickFormat`in t&&t.tickFormat?t.tickFormat():e=>String(e);let o=EA(t,a),s=t.range();return(0,H.jsxs)(`g`,{transform:`translate(0, ${e})`,children:[(0,H.jsx)(`line`,{x1:s[0],y1:0,x2:s[1],y2:0,stroke:`#222`,strokeWidth:1,shapeRendering:`crispEdges`}),o.map((e,t)=>(0,H.jsxs)(`g`,{transform:`translate(${e.pos}, 0)`,children:[(0,H.jsx)(`line`,{y1:0,y2:-8,stroke:`#222`,strokeWidth:1,shapeRendering:`crispEdges`}),(0,H.jsx)(`text`,{dy:-13,textAnchor:`middle`,fontSize:r,fill:`#222`,children:i(e.tick)})]},t)),n?(0,H.jsx)(`text`,{x:(s[0]+s[1])/2,y:-8-r-20,textAnchor:`middle`,fontSize:r+2,fill:`#222`,children:n}):void 0]})}function AA(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function jA(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function MA(e){let t,n,r;e.length===2?(t=e===AA||e===jA?e:NA,n=e,r=e):(t=AA,n=(t,n)=>AA(e(t),n),r=(t,n)=>e(t)-n);function i(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<0?i=t+1:a=t}while(i<a)}return i}function a(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<=0?i=t+1:a=t}while(i<a)}return i}function o(e,t,n=0,a=e.length){let o=i(e,t,n,a-1);return o>n&&r(e[o-1],t)>-r(e[o],t)?o-1:o}return{left:i,center:o,right:a}}function NA(){return 0}function PA(e){return e===null?NaN:+e}var FA=MA(AA),IA=FA.right;FA.left,MA(PA).center;var LA=class extends Map{constructor(e,t=VA){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),e!=null)for(let[t,n]of e)this.set(t,n)}get(e){return super.get(RA(this,e))}has(e){return super.has(RA(this,e))}set(e,t){return super.set(zA(this,e),t)}delete(e){return super.delete(BA(this,e))}};function RA({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function zA({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function BA({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function VA(e){return typeof e==`object`&&e?e.valueOf():e}var HA=Math.sqrt(50),UA=Math.sqrt(10),WA=Math.sqrt(2);function GA(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=HA?10:a>=UA?5:a>=WA?2:1,s,c,l;return i<0?(l=10**-i/o,s=Math.round(e*l),c=Math.round(t*l),s/l<e&&++s,c/l>t&&--c,l=-l):(l=10**i*o,s=Math.round(e/l),c=Math.round(t/l),s*l<e&&++s,c*l>t&&--c),c<s&&.5<=n&&n<2?GA(e,t,n*2):[s,c,l]}function KA(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];let r=t<e,[i,a,o]=r?GA(t,e,n):GA(e,t,n);if(!(a>=i))return[];let s=a-i+1,c=Array(s);if(r)if(o<0)for(let e=0;e<s;++e)c[e]=(a-e)/-o;else for(let e=0;e<s;++e)c[e]=(a-e)*o;else if(o<0)for(let e=0;e<s;++e)c[e]=(i+e)/-o;else for(let e=0;e<s;++e)c[e]=(i+e)*o;return c}function qA(e,t,n){return t=+t,e=+e,n=+n,GA(e,t,n)[2]}function JA(e,t,n){t=+t,e=+e,n=+n;let r=t<e,i=r?qA(t,e,n):qA(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function YA(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++r<i;)a[r]=e+r*n;return a}function XA(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}var ZA=Symbol(`implicit`);function QA(){var e=new LA,t=[],n=[],r=ZA;function i(i){let a=e.get(i);if(a===void 0){if(r!==ZA)return r;e.set(i,a=t.push(i)-1)}return n[a%n.length]}return i.domain=function(n){if(!arguments.length)return t.slice();t=[],e=new LA;for(let r of n)e.has(r)||e.set(r,t.push(r)-1);return i},i.range=function(e){return arguments.length?(n=Array.from(e),i):n.slice()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return QA(t,n).unknown(r)},XA.apply(i,arguments),i}function $A(){var e=QA().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,a,o,s=!1,c=0,l=0,u=.5;delete e.unknown;function d(){var e=t().length,d=i<r,f=d?i:r,p=d?r:i;a=(p-f)/Math.max(1,e-c+l*2),s&&(a=Math.floor(a)),f+=(p-f-a*(e-c))*u,o=a*(1-c),s&&(f=Math.round(f),o=Math.round(o));var m=YA(e).map(function(e){return f+a*e});return n(d?m.reverse():m)}return e.domain=function(e){return arguments.length?(t(e),d()):t()},e.range=function(e){return arguments.length?([r,i]=e,r=+r,i=+i,d()):[r,i]},e.rangeRound=function(e){return[r,i]=e,r=+r,i=+i,s=!0,d()},e.bandwidth=function(){return o},e.step=function(){return a},e.round=function(e){return arguments.length?(s=!!e,d()):s},e.padding=function(e){return arguments.length?(c=Math.min(1,l=+e),d()):c},e.paddingInner=function(e){return arguments.length?(c=Math.min(1,e),d()):c},e.paddingOuter=function(e){return arguments.length?(l=+e,d()):l},e.align=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),d()):u},e.copy=function(){return $A(t(),[r,i]).round(s).paddingInner(c).paddingOuter(l).align(u)},XA.apply(d(),arguments)}function ej(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function tj(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function nj(){}var rj=.7,ij=1/rj,aj=`\\s*([+-]?\\d+)\\s*`,oj=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,sj=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,cj=/^#([0-9a-f]{3,8})$/,lj=RegExp(`^rgb\\(${aj},${aj},${aj}\\)$`),uj=RegExp(`^rgb\\(${sj},${sj},${sj}\\)$`),dj=RegExp(`^rgba\\(${aj},${aj},${aj},${oj}\\)$`),fj=RegExp(`^rgba\\(${sj},${sj},${sj},${oj}\\)$`),pj=RegExp(`^hsl\\(${oj},${sj},${sj}\\)$`),mj=RegExp(`^hsla\\(${oj},${sj},${sj},${oj}\\)$`),hj={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};ej(nj,bj,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:gj,formatHex:gj,formatHex8:_j,formatHsl:vj,formatRgb:yj,toString:yj});function gj(){return this.rgb().formatHex()}function _j(){return this.rgb().formatHex8()}function vj(){return Nj(this).formatHsl()}function yj(){return this.rgb().formatRgb()}function bj(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=cj.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?xj(t):n===3?new Tj(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Sj(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Sj(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=lj.exec(e))?new Tj(t[1],t[2],t[3],1):(t=uj.exec(e))?new Tj(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=dj.exec(e))?Sj(t[1],t[2],t[3],t[4]):(t=fj.exec(e))?Sj(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=pj.exec(e))?Mj(t[1],t[2]/100,t[3]/100,1):(t=mj.exec(e))?Mj(t[1],t[2]/100,t[3]/100,t[4]):hj.hasOwnProperty(e)?xj(hj[e]):e===`transparent`?new Tj(NaN,NaN,NaN,0):null}function xj(e){return new Tj(e>>16&255,e>>8&255,e&255,1)}function Sj(e,t,n,r){return r<=0&&(e=t=n=NaN),new Tj(e,t,n,r)}function Cj(e){return e instanceof nj||(e=bj(e)),e?(e=e.rgb(),new Tj(e.r,e.g,e.b,e.opacity)):new Tj}function wj(e,t,n,r){return arguments.length===1?Cj(e):new Tj(e,t,n,r??1)}function Tj(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}ej(Tj,wj,tj(nj,{brighter(e){return e=e==null?ij:ij**+e,new Tj(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?rj:rj**+e,new Tj(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Tj(Aj(this.r),Aj(this.g),Aj(this.b),kj(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ej,formatHex:Ej,formatHex8:Dj,formatRgb:Oj,toString:Oj}));function Ej(){return`#${jj(this.r)}${jj(this.g)}${jj(this.b)}`}function Dj(){return`#${jj(this.r)}${jj(this.g)}${jj(this.b)}${jj((isNaN(this.opacity)?1:this.opacity)*255)}`}function Oj(){let e=kj(this.opacity);return`${e===1?`rgb(`:`rgba(`}${Aj(this.r)}, ${Aj(this.g)}, ${Aj(this.b)}${e===1?`)`:`, ${e})`}`}function kj(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Aj(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function jj(e){return e=Aj(e),(e<16?`0`:``)+e.toString(16)}function Mj(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Fj(e,t,n,r)}function Nj(e){if(e instanceof Fj)return new Fj(e.h,e.s,e.l,e.opacity);if(e instanceof nj||(e=bj(e)),!e)return new Fj;if(e instanceof Fj)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new Fj(o,s,c,e.opacity)}function Pj(e,t,n,r){return arguments.length===1?Nj(e):new Fj(e,t,n,r??1)}function Fj(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}ej(Fj,Pj,tj(nj,{brighter(e){return e=e==null?ij:ij**+e,new Fj(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?rj:rj**+e,new Fj(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Tj(Rj(e>=240?e-240:e+120,i,r),Rj(e,i,r),Rj(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Fj(Ij(this.h),Lj(this.s),Lj(this.l),kj(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=kj(this.opacity);return`${e===1?`hsl(`:`hsla(`}${Ij(this.h)}, ${Lj(this.s)*100}%, ${Lj(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function Ij(e){return e=(e||0)%360,e<0?e+360:e}function Lj(e){return Math.max(0,Math.min(1,e||0))}function Rj(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var zj=e=>()=>e;function Bj(e,t){return function(n){return e+n*t}}function Vj(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function Hj(e){return(e=+e)==1?Uj:function(t,n){return n-t?Vj(t,n,e):zj(isNaN(t)?n:t)}}function Uj(e,t){var n=t-e;return n?Bj(e,n):zj(isNaN(e)?t:e)}var Wj=(function e(t){var n=Hj(t);function r(e,t){var r=n((e=wj(e)).r,(t=wj(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=Uj(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function Gj(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function Kj(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function qj(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o<r;++o)i[o]=nM(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function Jj(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Yj(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Xj(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=nM(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var Zj=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Qj=new RegExp(Zj.source,`g`);function $j(e){return function(){return e}}function eM(e){return function(t){return e(t)+``}}function tM(e,t){var n=Zj.lastIndex=Qj.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=Zj.exec(e))&&(i=Qj.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:Yj(r,i)})),n=Qj.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?eM(c[0].x):$j(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function nM(e,t){var n=typeof t,r;return t==null||n===`boolean`?zj(t):(n===`number`?Yj:n===`string`?(r=bj(t))?(t=r,Wj):tM:t instanceof bj?Wj:t instanceof Date?Jj:Kj(t)?Gj:Array.isArray(t)?qj:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?Xj:Yj)(e,t)}function rM(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function iM(e){return function(){return e}}function aM(e){return+e}var oM=[0,1];function sM(e){return e}function cM(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:iM(isNaN(t)?NaN:.5)}function lM(e,t){var n;return e>t&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function uM(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i<r?(r=cM(i,r),a=n(o,a)):(r=cM(r,i),a=n(a,o)),function(e){return a(r(e))}}function dM(e,t,n){var r=Math.min(e.length,t.length)-1,i=Array(r),a=Array(r),o=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<r;)i[o]=cM(e[o],e[o+1]),a[o]=n(t[o],t[o+1]);return function(t){var n=IA(e,t,1,r)-1;return a[n](i[n](t))}}function fM(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function pM(){var e=oM,t=oM,n=nM,r,i,a,o=sM,s,c,l;function u(){var n=Math.min(e.length,t.length);return o!==sM&&(o=lM(e[0],e[n-1])),s=n>2?dM:uM,c=l=null,d}function d(i){return i==null||isNaN(i=+i)?a:(c||=s(e.map(r),t,n))(r(o(i)))}return d.invert=function(n){return o(i((l||=s(t,e.map(r),Yj))(n)))},d.domain=function(t){return arguments.length?(e=Array.from(t,aM),u()):e.slice()},d.range=function(e){return arguments.length?(t=Array.from(e),u()):t.slice()},d.rangeRound=function(e){return t=Array.from(e),n=rM,u()},d.clamp=function(e){return arguments.length?(o=e?!0:sM,u()):o!==sM},d.interpolate=function(e){return arguments.length?(n=e,u()):n},d.unknown=function(e){return arguments.length?(a=e,d):a},function(e,t){return r=e,i=t,u()}}function mM(){return pM()(sM,sM)}function hM(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function gM(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf(`e`),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function _M(e){return e=gM(Math.abs(e)),e?e[1]:NaN}function vM(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}function yM(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var bM=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function xM(e){if(!(t=bM.exec(e)))throw Error(`invalid format: `+e);var t;return new SM({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}xM.prototype=SM.prototype;function SM(e){this.fill=e.fill===void 0?` `:e.fill+``,this.align=e.align===void 0?`>`:e.align+``,this.sign=e.sign===void 0?`-`:e.sign+``,this.symbol=e.symbol===void 0?``:e.symbol+``,this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?``:e.type+``}SM.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?`0`:``)+(this.width===void 0?``:Math.max(1,this.width|0))+(this.comma?`,`:``)+(this.precision===void 0?``:`.`+Math.max(0,this.precision|0))+(this.trim?`~`:``)+this.type};function CM(e){out:for(var t=e.length,n=1,r=-1,i;n<t;++n)switch(e[n]){case`.`:r=i=n;break;case`0`:r===0&&(r=n),i=n;break;default:if(!+e[n])break out;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var wM;function TM(e,t){var n=gM(e,t);if(!n)return wM=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(wM=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join(`0`):a>0?r.slice(0,a)+`.`+r.slice(a):`0.`+Array(1-a).join(`0`)+gM(e,Math.max(0,t+a-1))[0]}function EM(e,t){var n=gM(e,t);if(!n)return e+``;var r=n[0],i=n[1];return i<0?`0.`+Array(-i).join(`0`)+r:r.length>i+1?r.slice(0,i+1)+`.`+r.slice(i+1):r+Array(i-r.length+2).join(`0`)}var DM={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:hM,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>EM(e*100,t),r:EM,s:TM,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function OM(e){return e}var kM=Array.prototype.map,AM=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function jM(e){var t=e.grouping===void 0||e.thousands===void 0?OM:vM(kM.call(e.grouping,Number),e.thousands+``),n=e.currency===void 0?``:e.currency[0]+``,r=e.currency===void 0?``:e.currency[1]+``,i=e.decimal===void 0?`.`:e.decimal+``,a=e.numerals===void 0?OM:yM(kM.call(e.numerals,String)),o=e.percent===void 0?`%`:e.percent+``,s=e.minus===void 0?`−`:e.minus+``,c=e.nan===void 0?`NaN`:e.nan+``;function l(e,l){e=xM(e);var u=e.fill,d=e.align,f=e.sign,p=e.symbol,m=e.zero,h=e.width,g=e.comma,_=e.precision,v=e.trim,y=e.type;y===`n`?(g=!0,y=`g`):DM[y]||(_===void 0&&(_=12),v=!0,y=`g`),(m||u===`0`&&d===`=`)&&(m=!0,u=`0`,d=`=`);var b=(l&&l.prefix!==void 0?l.prefix:``)+(p===`$`?n:p===`#`&&/[boxX]/.test(y)?`0`+y.toLowerCase():``),x=(p===`$`?r:/[%p]/.test(y)?o:``)+(l&&l.suffix!==void 0?l.suffix:``),S=DM[y],C=/[defgprs%]/.test(y);_=_===void 0?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function w(e){var n=b,r=x,o,l,p;if(y===`c`)r=S(e)+r,e=``;else{e=+e;var w=e<0||1/e<0;if(e=isNaN(e)?c:S(Math.abs(e),_),v&&(e=CM(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&wM!==void 0?AM[8+wM/3]:``)+r+(w&&f===`(`?`)`:``),C){for(o=-1,l=e.length;++o<l;)if(p=e.charCodeAt(o),48>p||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var T=n.length+e.length+r.length,E=T<h?Array(h-T+1).join(u):``;switch(g&&m&&(e=t(E+e,E.length?h-r.length:1/0),E=``),d){case`<`:e=n+e+r+E;break;case`=`:e=n+E+e+r;break;case`^`:e=E.slice(0,T=E.length>>1)+n+e+r+E.slice(T);break;default:e=E+n+e+r;break}return a(e)}return w.toString=function(){return e+``},w}function u(e,t){var n=Math.max(-8,Math.min(8,Math.floor(_M(t)/3)))*3,r=10**-n,i=l((e=xM(e),e.type=`f`,e),{suffix:AM[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var MM,NM,PM;FM({thousands:`,`,grouping:[3],currency:[`$`,``]});function FM(e){return MM=jM(e),NM=MM.format,PM=MM.formatPrefix,MM}function IM(e){return Math.max(0,-_M(Math.abs(e)))}function LM(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(_M(t)/3)))*3-_M(Math.abs(e)))}function RM(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,_M(t)-_M(e))+1}function zM(e,t,n,r){var i=JA(e,t,n),a;switch(r=xM(r??`,f`),r.type){case`s`:var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=LM(i,o))&&(r.precision=a),PM(r,o);case``:case`e`:case`g`:case`p`:case`r`:r.precision==null&&!isNaN(a=RM(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type===`e`));break;case`f`:case`%`:r.precision==null&&!isNaN(a=IM(i))&&(r.precision=a-(r.type===`%`)*2);break}return NM(r)}function BM(e){var t=e.domain;return e.ticks=function(e){var n=t();return KA(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return zM(r[0],r[r.length-1],e??10,n)},e.nice=function(n){n??=10;var r=t(),i=0,a=r.length-1,o=r[i],s=r[a],c,l,u=10;for(s<o&&(l=o,o=s,s=l,l=i,i=a,a=l);u-->0;){if(l=qA(o,s,n),l===c)return r[i]=o,r[a]=s,t(r);if(l>0)o=Math.floor(o/l)*l,s=Math.ceil(s/l)*l;else if(l<0)o=Math.ceil(o*l)/l,s=Math.floor(s*l)/l;else break;c=l}return e},e}function VM(){var e=mM();return e.copy=function(){return fM(e,VM())},XA.apply(e,arguments),BM(e)}function HM(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],o;return a<i&&(o=n,n=r,r=o,o=i,i=a,a=o),e[n]=t.floor(i),e[r]=t.ceil(a),e}var UM=new Date,WM=new Date;function GM(e,t,n,r){function i(t){return e(t=arguments.length===0?new Date:new Date(+t)),t}return i.floor=t=>(e(t=new Date(+t)),t),i.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),i.round=e=>{let t=i(e),n=i.ceil(e);return e-t<n-e?t:n},i.offset=(e,n)=>(t(e=new Date(+e),n==null?1:Math.floor(n)),e),i.range=(n,r,a)=>{let o=[];if(n=i.ceil(n),a=a==null?1:Math.floor(a),!(n<r)||!(a>0))return o;let s;do o.push(s=new Date(+n)),t(n,a),e(n);while(s<n&&n<r);return o},i.filter=n=>GM(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}),n&&(i.count=(t,r)=>(UM.setTime(+t),WM.setTime(+r),e(UM),e(WM),Math.floor(n(UM,WM))),i.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?i.filter(r?t=>r(t)%e===0:t=>i.count(0,t)%e===0):i)),i}var KM=GM(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);KM.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?GM(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):KM),KM.range;var qM=1e3,JM=qM*60,YM=JM*60,XM=YM*24,ZM=XM*7,QM=XM*30,$M=XM*365,eN=GM(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*qM)},(e,t)=>(t-e)/qM,e=>e.getUTCSeconds());eN.range;var tN=GM(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*qM)},(e,t)=>{e.setTime(+e+t*JM)},(e,t)=>(t-e)/JM,e=>e.getMinutes());tN.range;var nN=GM(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*JM)},(e,t)=>(t-e)/JM,e=>e.getUTCMinutes());nN.range;var rN=GM(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*qM-e.getMinutes()*JM)},(e,t)=>{e.setTime(+e+t*YM)},(e,t)=>(t-e)/YM,e=>e.getHours());rN.range;var iN=GM(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*YM)},(e,t)=>(t-e)/YM,e=>e.getUTCHours());iN.range;var aN=GM(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*JM)/XM,e=>e.getDate()-1);aN.range;var oN=GM(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/XM,e=>e.getUTCDate()-1);oN.range;var sN=GM(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/XM,e=>Math.floor(e/XM));sN.range;function cN(e){return GM(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+t*7)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*JM)/ZM)}var lN=cN(0),uN=cN(1),dN=cN(2),fN=cN(3),pN=cN(4),mN=cN(5),hN=cN(6);lN.range,uN.range,dN.range,fN.range,pN.range,mN.range,hN.range;function gN(e){return GM(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t*7)},(e,t)=>(t-e)/ZM)}var _N=gN(0),vN=gN(1),yN=gN(2),bN=gN(3),xN=gN(4),SN=gN(5),CN=gN(6);_N.range,vN.range,yN.range,bN.range,xN.range,SN.range,CN.range;var wN=GM(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());wN.range;var TN=GM(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());TN.range;var EN=GM(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());EN.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:GM(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}),EN.range;var DN=GM(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());DN.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:GM(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}),DN.range;function ON(e,t,n,r,i,a){let o=[[eN,1,qM],[eN,5,5*qM],[eN,15,15*qM],[eN,30,30*qM],[a,1,JM],[a,5,5*JM],[a,15,15*JM],[a,30,30*JM],[i,1,YM],[i,3,3*YM],[i,6,6*YM],[i,12,12*YM],[r,1,XM],[r,2,2*XM],[n,1,ZM],[t,1,QM],[t,3,3*QM],[e,1,$M]];function s(e,t,n){let r=t<e;r&&([e,t]=[t,e]);let i=n&&typeof n.range==`function`?n:c(e,t,n),a=i?i.range(e,+t+1):[];return r?a.reverse():a}function c(t,n,r){let i=Math.abs(n-t)/r,a=MA(([,,e])=>e).right(o,i);if(a===o.length)return e.every(JA(t/$M,n/$M,r));if(a===0)return KM.every(Math.max(JA(t,n,r),1));let[s,c]=o[i/o[a-1][2]<o[a][2]/i?a-1:a];return s.every(c)}return[s,c]}var[nie,rie]=ON(DN,TN,_N,sN,iN,nN),[kN,AN]=ON(EN,wN,lN,aN,rN,tN);function jN(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function MN(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function NN(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function PN(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,a=e.days,o=e.shortDays,s=e.months,c=e.shortMonths,l=VN(i),u=HN(i),d=VN(a),f=HN(a),p=VN(o),m=HN(o),h=VN(s),g=HN(s),_=VN(c),v=HN(c),y={a:j,A:M,b:ne,B:re,c:null,d:lP,e:lP,f:mP,g:TP,G:DP,H:uP,I:dP,j:fP,L:pP,m:hP,M:gP,p:ie,q:ae,Q:YP,s:XP,S:_P,u:vP,U:yP,V:xP,w:SP,W:CP,x:null,X:null,y:wP,Y:EP,Z:OP,"%":JP},b={a:N,A:oe,b:se,B:ce,c:null,d:kP,e:kP,f:PP,g:WP,G:KP,H:AP,I:jP,j:MP,L:NP,m:iie,M:FP,p:P,q:le,Q:YP,s:XP,S:IP,u:LP,U:RP,V:BP,w:VP,W:HP,x:null,X:null,y:UP,Y:GP,Z:qP,"%":JP},x={a:E,A:D,b:O,B:ee,c:te,d:$N,e:$N,f:aP,g:YN,G:JN,H:tP,I:tP,j:eP,L:iP,m:QN,M:nP,p:T,q:ZN,Q:sP,s:cP,S:rP,u:WN,U:GN,V:KN,w:UN,W:qN,x:k,X:A,y:YN,Y:JN,Z:XN,"%":oP};y.x=S(n,y),y.X=S(r,y),y.c=S(t,y),b.x=S(n,b),b.X=S(r,b),b.c=S(t,b);function S(e,t){return function(n){var r=[],i=-1,a=0,o=e.length,s,c,l;for(n instanceof Date||(n=new Date(+n));++i<o;)e.charCodeAt(i)===37&&(r.push(e.slice(a,i)),(c=FN[s=e.charAt(++i)])==null?c=s===`e`?` `:`0`:s=e.charAt(++i),(l=t[s])&&(s=l(n,c)),r.push(s),a=i+1);return r.push(e.slice(a,i)),r.join(``)}}function C(e,t){return function(n){var r=NN(1900,void 0,1),i=w(r,e,n+=``,0),a,o;if(i!=n.length)return null;if(`Q`in r)return new Date(r.Q);if(`s`in r)return new Date(r.s*1e3+(`L`in r?r.L:0));if(t&&!(`Z`in r)&&(r.Z=0),`p`in r&&(r.H=r.H%12+r.p*12),r.m===void 0&&(r.m=`q`in r?r.q:0),`V`in r){if(r.V<1||r.V>53)return null;`w`in r||(r.w=1),`Z`in r?(a=MN(NN(r.y,0,1)),o=a.getUTCDay(),a=o>4||o===0?vN.ceil(a):vN(a),a=oN.offset(a,(r.V-1)*7),r.y=a.getUTCFullYear(),r.m=a.getUTCMonth(),r.d=a.getUTCDate()+(r.w+6)%7):(a=jN(NN(r.y,0,1)),o=a.getDay(),a=o>4||o===0?uN.ceil(a):uN(a),a=aN.offset(a,(r.V-1)*7),r.y=a.getFullYear(),r.m=a.getMonth(),r.d=a.getDate()+(r.w+6)%7)}else(`W`in r||`U`in r)&&(`w`in r||(r.w=`u`in r?r.u%7:+(`W`in r)),o=`Z`in r?MN(NN(r.y,0,1)).getUTCDay():jN(NN(r.y,0,1)).getDay(),r.m=0,r.d=`W`in r?(r.w+6)%7+r.W*7-(o+5)%7:r.w+r.U*7-(o+6)%7);return`Z`in r?(r.H+=r.Z/100|0,r.M+=r.Z%100,MN(r)):jN(r)}}function w(e,t,n,r){for(var i=0,a=t.length,o=n.length,s,c;i<a;){if(r>=o)return-1;if(s=t.charCodeAt(i++),s===37){if(s=t.charAt(i++),c=x[s in FN?t.charAt(i++):s],!c||(r=c(e,n,r))<0)return-1}else if(s!=n.charCodeAt(r++))return-1}return r}function T(e,t,n){var r=l.exec(t.slice(n));return r?(e.p=u.get(r[0].toLowerCase()),n+r[0].length):-1}function E(e,t,n){var r=p.exec(t.slice(n));return r?(e.w=m.get(r[0].toLowerCase()),n+r[0].length):-1}function D(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=f.get(r[0].toLowerCase()),n+r[0].length):-1}function O(e,t,n){var r=_.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1}function ee(e,t,n){var r=h.exec(t.slice(n));return r?(e.m=g.get(r[0].toLowerCase()),n+r[0].length):-1}function te(e,n,r){return w(e,t,n,r)}function k(e,t,r){return w(e,n,t,r)}function A(e,t,n){return w(e,r,t,n)}function j(e){return o[e.getDay()]}function M(e){return a[e.getDay()]}function ne(e){return c[e.getMonth()]}function re(e){return s[e.getMonth()]}function ie(e){return i[+(e.getHours()>=12)]}function ae(e){return 1+~~(e.getMonth()/3)}function N(e){return o[e.getUTCDay()]}function oe(e){return a[e.getUTCDay()]}function se(e){return c[e.getUTCMonth()]}function ce(e){return s[e.getUTCMonth()]}function P(e){return i[+(e.getUTCHours()>=12)]}function le(e){return 1+~~(e.getUTCMonth()/3)}return{format:function(e){var t=S(e+=``,y);return t.toString=function(){return e},t},parse:function(e){var t=C(e+=``,!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=S(e+=``,b);return t.toString=function(){return e},t},utcParse:function(e){var t=C(e+=``,!0);return t.toString=function(){return e},t}}}var FN={"-":``,_:` `,0:`0`},IN=/^\s*\d+/,LN=/^%/,RN=/[\\^$*+?|[\]().{}]/g;function zN(e,t,n){var r=e<0?`-`:``,i=(r?-e:e)+``,a=i.length;return r+(a<n?Array(n-a+1).join(t)+i:i)}function BN(e){return e.replace(RN,`\\$&`)}function VN(e){return RegExp(`^(?:`+e.map(BN).join(`|`)+`)`,`i`)}function HN(e){return new Map(e.map((e,t)=>[e.toLowerCase(),t]))}function UN(e,t,n){var r=IN.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function WN(e,t,n){var r=IN.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function GN(e,t,n){var r=IN.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function KN(e,t,n){var r=IN.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function qN(e,t,n){var r=IN.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function JN(e,t,n){var r=IN.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function YN(e,t,n){var r=IN.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function XN(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||`00`)),n+r[0].length):-1}function ZN(e,t,n){var r=IN.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function QN(e,t,n){var r=IN.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function $N(e,t,n){var r=IN.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function eP(e,t,n){var r=IN.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function tP(e,t,n){var r=IN.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function nP(e,t,n){var r=IN.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function rP(e,t,n){var r=IN.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function iP(e,t,n){var r=IN.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function aP(e,t,n){var r=IN.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function oP(e,t,n){var r=LN.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function sP(e,t,n){var r=IN.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function cP(e,t,n){var r=IN.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function lP(e,t){return zN(e.getDate(),t,2)}function uP(e,t){return zN(e.getHours(),t,2)}function dP(e,t){return zN(e.getHours()%12||12,t,2)}function fP(e,t){return zN(1+aN.count(EN(e),e),t,3)}function pP(e,t){return zN(e.getMilliseconds(),t,3)}function mP(e,t){return pP(e,t)+`000`}function hP(e,t){return zN(e.getMonth()+1,t,2)}function gP(e,t){return zN(e.getMinutes(),t,2)}function _P(e,t){return zN(e.getSeconds(),t,2)}function vP(e){var t=e.getDay();return t===0?7:t}function yP(e,t){return zN(lN.count(EN(e)-1,e),t,2)}function bP(e){var t=e.getDay();return t>=4||t===0?pN(e):pN.ceil(e)}function xP(e,t){return e=bP(e),zN(pN.count(EN(e),e)+(EN(e).getDay()===4),t,2)}function SP(e){return e.getDay()}function CP(e,t){return zN(uN.count(EN(e)-1,e),t,2)}function wP(e,t){return zN(e.getFullYear()%100,t,2)}function TP(e,t){return e=bP(e),zN(e.getFullYear()%100,t,2)}function EP(e,t){return zN(e.getFullYear()%1e4,t,4)}function DP(e,t){var n=e.getDay();return e=n>=4||n===0?pN(e):pN.ceil(e),zN(e.getFullYear()%1e4,t,4)}function OP(e){var t=e.getTimezoneOffset();return(t>0?`-`:(t*=-1,`+`))+zN(t/60|0,`0`,2)+zN(t%60,`0`,2)}function kP(e,t){return zN(e.getUTCDate(),t,2)}function AP(e,t){return zN(e.getUTCHours(),t,2)}function jP(e,t){return zN(e.getUTCHours()%12||12,t,2)}function MP(e,t){return zN(1+oN.count(DN(e),e),t,3)}function NP(e,t){return zN(e.getUTCMilliseconds(),t,3)}function PP(e,t){return NP(e,t)+`000`}function iie(e,t){return zN(e.getUTCMonth()+1,t,2)}function FP(e,t){return zN(e.getUTCMinutes(),t,2)}function IP(e,t){return zN(e.getUTCSeconds(),t,2)}function LP(e){var t=e.getUTCDay();return t===0?7:t}function RP(e,t){return zN(_N.count(DN(e)-1,e),t,2)}function zP(e){var t=e.getUTCDay();return t>=4||t===0?xN(e):xN.ceil(e)}function BP(e,t){return e=zP(e),zN(xN.count(DN(e),e)+(DN(e).getUTCDay()===4),t,2)}function VP(e){return e.getUTCDay()}function HP(e,t){return zN(vN.count(DN(e)-1,e),t,2)}function UP(e,t){return zN(e.getUTCFullYear()%100,t,2)}function WP(e,t){return e=zP(e),zN(e.getUTCFullYear()%100,t,2)}function GP(e,t){return zN(e.getUTCFullYear()%1e4,t,4)}function KP(e,t){var n=e.getUTCDay();return e=n>=4||n===0?xN(e):xN.ceil(e),zN(e.getUTCFullYear()%1e4,t,4)}function qP(){return`+0000`}function JP(){return`%`}function YP(e){return+e}function XP(e){return Math.floor(e/1e3)}var ZP,QP;$P({dateTime:`%x, %X`,date:`%-m/%-d/%Y`,time:`%-I:%M:%S %p`,periods:[`AM`,`PM`],days:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],shortDays:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],months:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],shortMonths:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`]});function $P(e){return ZP=PN(e),QP=ZP.format,ZP.parse,ZP.utcFormat,ZP.utcParse,ZP}function eF(e){return new Date(e)}function tF(e){return e instanceof Date?+e:+new Date(+e)}function nF(e,t,n,r,i,a,o,s,c,l){var u=mM(),d=u.invert,f=u.domain,p=l(`.%L`),m=l(`:%S`),h=l(`%I:%M`),g=l(`%I %p`),_=l(`%a %d`),v=l(`%b %d`),y=l(`%B`),b=l(`%Y`);function x(e){return(c(e)<e?p:s(e)<e?m:o(e)<e?h:a(e)<e?g:r(e)<e?i(e)<e?_:v:n(e)<e?y:b)(e)}return u.invert=function(e){return new Date(d(e))},u.domain=function(e){return arguments.length?f(Array.from(e,tF)):f().map(eF)},u.ticks=function(t){var n=f();return e(n[0],n[n.length-1],t??10)},u.tickFormat=function(e,t){return t==null?x:l(t)},u.nice=function(e){var n=f();return(!e||typeof e.range!=`function`)&&(e=t(n[0],n[n.length-1],e??10)),e?f(HM(n,e)):u},u.copy=function(){return fM(u,nF(e,t,n,r,i,a,o,s,c,l))},u}function rF(){return XA.apply(nF(kN,AN,EN,wN,lN,aN,rN,tN,eN,QP).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}var iF=Pr[200],aF=Pr[600],oF=Pr[900],sF=Ar[700],cF=Lr[400],lF=Lr[100];function uF(){let e=R(sO),t=R(Xk);return(0,L.useMemo)(()=>{let n=BT(new Date,-12);return Q.of(t).filter(e=>e.end>=n).sortBy(e=>+!!e.plannedDown).map(t=>({station:t.stationLabel,start:t.start,end:t.end,plannedDown:t.plannedDown,parts:Q.of(t.parts??[]).collect(t=>{let n=e.get(t.uniq);return n?n.partName+`-`+t.proc.toString():null}).distinctAndSortBy(e=>e).toRArray()})).toRArray()},[e,t])}var dF=P(null),fF=14,pF=20,mF=10,hF=2;function gF(e,t,n,r,i){let a=QD.build(e,e=>e.station).union(QD.build(t,e=>e.station)),o=(a.toAscLazySeq().map(e=>aA(e,fF)).maxBy(e=>e??0)??20)+30,s=Math.max(r-o-hF,5),c=Math.max(i-mF-pF,5),l=rF().domain([BT(n,-12),BT(n,8)]).range([0,s]),u=$A().domain(Array.from(a)).range([0,c]).padding(.3);return{xScale:l,yScale:u,actualPlannedScale:$A().domain([`actual`,`planned`]).range([0,u.bandwidth()]).padding(.1),marginLeft:o}}function _F({xScale:e,yScale:t}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(DA,{scale:e,top:t.range()[1]}),(0,H.jsx)(OA,{scale:t,left:e.range()[0],fontSize:fF}),(0,H.jsx)(CA,{scale:e,height:t.range()[1]-t.range()[0]})]})}function vF({cycles:e,xScale:t,yScale:n,actualPlannedScale:r,hideTooltipRef:i}){let a=r(`actual`)??0,o=z(dF);function s(e){return t=>{let n=rA(t);n&&(i.current!==null&&(clearTimeout(i.current),i.current=null),o({left:n.x,top:n.y,data:{kind:`actual`,cycle:e}}))}}let c=(0,L.useCallback)(()=>{i.current=setTimeout(()=>{o(null)},300)},[i,o]);return(0,H.jsx)(`g`,{children:e.map((e,i)=>e.endActive&&e.endActive<e.endOccupied?(0,H.jsxs)(`g`,{onMouseOver:s(e),onMouseLeave:c,children:[(0,H.jsx)(`rect`,{x:t(e.startTime),y:(n(e.station)??0)+a,width:t(e.endOccupied)-t(e.startTime),height:r.bandwidth(),fill:aF}),(0,H.jsx)(`rect`,{x:t(e.endActive),y:(n(e.station)??0)+a+r.bandwidth()/10,width:t(e.endOccupied)-t(e.endActive),height:r.bandwidth()*8/10,fill:e.outlier?sF:oF})]},i):(0,H.jsx)(`g`,{onMouseOver:s(e),onMouseLeave:c,children:(0,H.jsx)(`rect`,{x:t(e.startTime),y:(n(e.station)??0)+a,width:t(e.endOccupied)-t(e.startTime),height:r.bandwidth(),fill:aF})},i))})}function yF(e,t,n,r){return`M ${e} ${t} A ${n} ${r} 0 0 1 ${e} ${t+r}`}function bF({now:e,cycles:t,xScale:n,yScale:r,actualPlannedScale:i,hideTooltipRef:a}){let o=i(`actual`)??0,s=z(dF);function c(t){return n=>{let r=rA(n);r&&(a.current!==null&&(clearTimeout(a.current),a.current=null),s({left:r.x,top:r.y,data:{kind:`current`,cycle:t,now:e}}))}}let l=(0,L.useCallback)(()=>{a.current=setTimeout(()=>{s(null)},300)},[a,s]);return(0,H.jsx)(`g`,{children:t.map((t,a)=>(0,H.jsxs)(`g`,{onMouseOver:c(t),onMouseLeave:l,children:[(0,H.jsx)(`rect`,{x:n(t.start),y:(r(t.station)??0)+o,width:n(e)-n(t.start),height:i.bandwidth(),fill:aF}),t.expectedEnd<e?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`rect`,{x:n(t.expectedEnd),y:(r(t.station)??0)+o+i.bandwidth()/10,width:n(e)-n(t.expectedEnd),height:i.bandwidth()*8/10,fill:t.isOutlier?sF:oF}),(0,H.jsx)(`path`,{d:yF(n(e),(r(t.station)??0)+o,80,i.bandwidth()),fill:iF})]}):(0,H.jsx)(`rect`,{x:n(e),y:(r(t.station)??0)+o,width:n(t.expectedEnd)-n(e),height:i.bandwidth(),fill:iF})]},a))})}function aie({sim:e,xScale:t,yScale:n,actualPlannedScale:r,hideTooltipRef:i}){let a=r(`planned`)??0,o=z(dF);function s(e){return t=>{let n=rA(t);n&&(i.current!==null&&(clearTimeout(i.current),i.current=null),o({left:n.x,top:n.y,data:{kind:`sim`,cycle:e}}))}}let c=(0,L.useCallback)(()=>{i.current=setTimeout(()=>{o(null)},300)},[i,o]);return(0,H.jsx)(`g`,{children:e.map((e,i)=>(0,H.jsx)(`g`,{onMouseOver:s(e),onMouseLeave:c,children:(0,H.jsx)(`rect`,{x:t(e.start),y:(n(e.station)??0)+a,width:t(e.end)-t(e.start),height:r.bandwidth(),fill:e.plannedDown?lF:cF})},i))})}function oie({tooltip:e}){return(0,H.jsx)(RC,{children:e.data.kind===`actual`?(0,H.jsxs)(H.Fragment,{children:[e.data.cycle.outlier?(0,H.jsxs)(`div`,{children:[`Outlier Cycle for `,e.data.cycle.station]}):(0,H.jsx)(`div`,{children:e.data.cycle.station}),(0,H.jsxs)(`div`,{children:[`Start: `,e.data.cycle.startTime.toLocaleString()]}),(0,H.jsxs)(`div`,{children:[`End: `,e.data.cycle.endOccupied.toLocaleString()]}),e.data.cycle.endActive===void 0?void 0:(0,H.jsxs)(`div`,{children:[`Active Minutes:`,` `,rE(e.data.cycle.endActive,e.data.cycle.startTime)]}),(0,H.jsxs)(`div`,{children:[`Occupied Minutes:`,` `,rE(e.data.cycle.endOccupied,e.data.cycle.startTime)]}),e.data.cycle.parts.map((e,t)=>(0,H.jsxs)(`div`,{children:[`Part: `,e.part,` `,e.oper]},t))]}):e.data.kind===`sim`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{children:[`Simulation of `,e.data.cycle.station]}),e.data.cycle.parts.map((e,t)=>(0,H.jsxs)(`div`,{children:[`Part: `,e]},t)),(0,H.jsxs)(`div`,{children:[`Predicted Start: `,e.data.cycle.start.toLocaleString()]}),(0,H.jsxs)(`div`,{children:[`Predicted End: `,e.data.cycle.end.toLocaleString()]}),e.data.cycle.plannedDown?(0,H.jsx)(`div`,{children:`Planned Downtime`}):void 0]}):(0,H.jsxs)(H.Fragment,{children:[e.data.cycle.isOutlier?(0,H.jsxs)(`div`,{children:[`Current Outlier Cycle for `,e.data.cycle.station]}):(0,H.jsxs)(`div`,{children:[`Current `,e.data.cycle.station]}),(0,H.jsxs)(`div`,{children:[`Start: `,e.data.cycle.start.toLocaleString()]}),(0,H.jsxs)(`div`,{children:[`Expected End: `,e.data.cycle.expectedEnd.toLocaleString()]}),e.data.cycle.expectedEnd<e.data.now?(0,H.jsxs)(`div`,{children:[`Cycle Exceeding Expected By`,` `,rE(e.data.now,e.data.cycle.expectedEnd),` Minutes`]}):(0,H.jsxs)(`div`,{children:[`Expected Remaining Minutes:`,` `,rE(e.data.cycle.expectedEnd,e.data.now)]}),(0,H.jsxs)(`div`,{children:[`Occupied Minutes: `,rE(e.data.now,e.data.cycle.start)]}),e.data.cycle.parts.map((e,t)=>(0,H.jsxs)(`div`,{children:[`Part: `,e.part,` `,e.oper]},t))]})})}function sie({now:e,xScale:t,yScale:n}){let r=t(e);return(0,H.jsxs)(`g`,{children:[(0,H.jsx)(`line`,{x1:r,x2:r,y1:n.range()[0],y2:n.range()[1]+8,stroke:`black`}),(0,H.jsx)(`text`,{x:r,y:n.range()[1]+8+11,textAnchor:`middle`,fontSize:11,children:`Now`})]})}function xF({height:e,width:t}){let n=R(uk),r=R(UO),i=uF(),a=R(NO),o=R(br),s=(0,L.useMemo)(()=>{let e=BT(new Date,-12);return zk(n.valuesToLazySeq().filter(t=>t.endTime>=e))},[n]),c=(0,L.useMemo)(()=>xA(a,r,o.loadStationNames),[a,r,o.loadStationNames]),l=new Date,[,u]=(0,L.useState)(0),d=(0,L.useRef)(null);(0,L.useEffect)(()=>{d.current!==null&&clearTimeout(d.current),d.current=setTimeout(()=>{u(e=>e+1)},300*1e3)});let{xScale:f,yScale:p,actualPlannedScale:m,marginLeft:h}=gF(s,c,l,t,e),g=(0,L.useRef)(null);return e<=0||t<=0?null:(0,H.jsxs)(`div`,{style:{position:`relative`,overflow:`hidden`},children:[(0,H.jsx)(`svg`,{height:e,width:t,children:(0,H.jsxs)(`g`,{transform:`translate(${h}, ${mF})`,children:[(0,H.jsx)(`clipPath`,{id:`recent-cycle-clip-body`,children:(0,H.jsx)(`rect`,{x:0,y:0,width:t-hF-h,height:e-pF-mF})}),(0,H.jsx)(_F,{xScale:f,yScale:p}),(0,H.jsxs)(`g`,{clipPath:`url(#recent-cycle-clip-body)`,children:[(0,H.jsx)(vF,{cycles:s,xScale:f,yScale:p,hideTooltipRef:g,actualPlannedScale:m}),(0,H.jsx)(bF,{now:l,cycles:c,xScale:f,yScale:p,hideTooltipRef:g,actualPlannedScale:m}),(0,H.jsx)(aie,{sim:i,xScale:f,yScale:p,actualPlannedScale:m,hideTooltipRef:g})]}),(0,H.jsx)(sie,{now:l,xScale:f,yScale:p})]})}),(0,H.jsx)(hA,{chartHeight:e,chartWidth:t,atom:dF,TooltipContent:oie})]})}var cie=Object.defineProperty,SF=(e,t)=>cie(e,`name`,{value:t,configurable:!0}),CF=class{type=3;name=``;prefix=``;value=``;suffix=``;modifier=3;constructor(e,t,n,r,i,a){this.type=e,this.name=t,this.prefix=n,this.value=r,this.suffix=i,this.modifier=a}hasCustomName(){return this.name!==``&&typeof this.name!=`number`}};SF(CF,`Part`);var lie=/[$_\p{ID_Start}]/u,uie=/[$_\u200C\u200D\p{ID_Continue}]/u,wF=`.*`;function TF(e,t){return(t?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(e)}SF(TF,`isASCII`);function EF(e,t=!1){let n=[],r=0;for(;r<e.length;){let i=e[r],a=SF(function(i){if(!t)throw TypeError(i);n.push({type:`INVALID_CHAR`,index:r,value:e[r++]})},`ErrorOrInvalid`);if(i===`*`){n.push({type:`ASTERISK`,index:r,value:e[r++]});continue}if(i===`+`||i===`?`){n.push({type:`OTHER_MODIFIER`,index:r,value:e[r++]});continue}if(i===`\\`){n.push({type:`ESCAPED_CHAR`,index:r++,value:e[r++]});continue}if(i===`{`){n.push({type:`OPEN`,index:r,value:e[r++]});continue}if(i===`}`){n.push({type:`CLOSE`,index:r,value:e[r++]});continue}if(i===`:`){let t=``,i=r+1;for(;i<e.length;){let n=e.substr(i,1);if(i===r+1&&lie.test(n)||i!==r+1&&uie.test(n)){t+=e[i++];continue}break}if(!t){a(`Missing parameter name at ${r}`);continue}n.push({type:`NAME`,index:r,value:t}),r=i;continue}if(i===`(`){let t=1,i=``,o=r+1,s=!1;if(e[o]===`?`){a(`Pattern cannot start with "?" at ${o}`);continue}for(;o<e.length;){if(!TF(e[o],!1)){a(`Invalid character '${e[o]}' at ${o}.`),s=!0;break}if(e[o]===`\\`){i+=e[o++]+e[o++];continue}if(e[o]===`)`){if(t--,t===0){o++;break}}else if(e[o]===`(`&&(t++,e[o+1]!==`?`)){a(`Capturing groups are not allowed at ${o}`),s=!0;break}i+=e[o++]}if(s)continue;if(t){a(`Unbalanced pattern at ${r}`);continue}if(!i){a(`Missing pattern at ${r}`);continue}n.push({type:`REGEX`,index:r,value:i}),r=o;continue}n.push({type:`CHAR`,index:r,value:e[r++]})}return n.push({type:`END`,index:r,value:``}),n}SF(EF,`lexer`);function DF(e,t={}){let n=EF(e);t.delimiter??=`/#?`,t.prefixes??=`./`;let r=`[^${OF(t.delimiter)}]+?`,i=[],a=0,o=0,s=new Set,c=SF(e=>{if(o<n.length&&n[o].type===e)return n[o++].value},`tryConsume`),l=SF(()=>c(`OTHER_MODIFIER`)??c(`ASTERISK`),`tryConsumeModifier`),u=SF(e=>{let t=c(e);if(t!==void 0)return t;let{type:r,index:i}=n[o];throw TypeError(`Unexpected ${r} at ${i}, expected ${e}`)},`mustConsume`),d=SF(()=>{let e=``,t;for(;t=c(`CHAR`)??c(`ESCAPED_CHAR`);)e+=t;return e},`consumeText`),f=SF(e=>e,`DefaultEncodePart`),p=t.encodePart||f,m=``,h=SF(e=>{m+=e},`appendToPendingFixedValue`),g=SF(()=>{m.length&&(i.push(new CF(3,``,``,p(m),``,3)),m=``)},`maybeAddPartFromPendingFixedValue`),_=SF((e,t,n,o,c)=>{let l=3;switch(c){case`?`:l=1;break;case`*`:l=0;break;case`+`:l=2;break}if(!t&&!n&&l===3){h(e);return}if(g(),!t&&!n){if(!e)return;i.push(new CF(3,``,``,p(e),``,l));return}let u;u=n?n===`*`?wF:n:r;let d=2;u===r?(d=1,u=``):u===wF&&(d=0,u=``);let f;if(t?f=t:n&&(f=a++),s.has(f))throw TypeError(`Duplicate name '${f}'.`);s.add(f),i.push(new CF(d,f,p(e),u,p(o),l))},`addPart`);for(;o<n.length;){let e=c(`CHAR`),n=c(`NAME`),r=c(`REGEX`);if(!n&&!r&&(r=c(`ASTERISK`)),n||r){let i=e??``;t.prefixes.indexOf(i)===-1&&(h(i),i=``),g();let a=l();_(i,n,r,``,a);continue}let i=e??c(`ESCAPED_CHAR`);if(i){h(i);continue}if(c(`OPEN`)){let e=d(),t=c(`NAME`),n=c(`REGEX`);!t&&!n&&(n=c(`ASTERISK`));let r=d();u(`CLOSE`);let i=l();_(e,t,n,r,i);continue}g(),u(`END`)}return i}SF(DF,`parse`);function OF(e){return e.replace(/([.+*?^${}()[\]|/\\])/g,`\\$1`)}SF(OF,`escapeString`);function kF(e){return e&&e.ignoreCase?`ui`:`u`}SF(kF,`flags`);function AF(e,t,n){return MF(DF(e,n),t,n)}SF(AF,`stringToRegexp`);function jF(e){switch(e){case 0:return`*`;case 1:return`?`;case 2:return`+`;case 3:return``}}SF(jF,`modifierToString`);function MF(e,t,n={}){n.delimiter??=`/#?`,n.prefixes??=`./`,n.sensitive??=!1,n.strict??=!1,n.end??=!0,n.start??=!0,n.endsWith=``;let r=n.start?`^`:``;for(let i of e){if(i.type===3){i.modifier===3?r+=OF(i.value):r+=`(?:${OF(i.value)})${jF(i.modifier)}`;continue}t&&t.push(i.name);let e=`[^${OF(n.delimiter)}]+?`,a=i.value;if(i.type===1?a=e:i.type===0&&(a=wF),!i.prefix.length&&!i.suffix.length){i.modifier===3||i.modifier===1?r+=`(${a})${jF(i.modifier)}`:r+=`((?:${a})${jF(i.modifier)})`;continue}if(i.modifier===3||i.modifier===1){r+=`(?:${OF(i.prefix)}(${a})${OF(i.suffix)})`,r+=jF(i.modifier);continue}r+=`(?:${OF(i.prefix)}`,r+=`((?:${a})(?:`,r+=OF(i.suffix),r+=OF(i.prefix),r+=`(?:${a}))*)${OF(i.suffix)})`,i.modifier===0&&(r+=`?`)}let i=`[${OF(n.endsWith)}]|$`,a=`[${OF(n.delimiter)}]`;if(n.end)return n.strict||(r+=`${a}?`),n.endsWith.length?r+=`(?=${i})`:r+=`$`,new RegExp(r,kF(n));n.strict||(r+=`(?:${a}(?=${i}))?`);let o=!1;if(e.length){let t=e[e.length-1];t.type===3&&t.modifier===3&&(o=n.delimiter.indexOf(t)>-1)}return o||(r+=`(?=${a}|${i})`),new RegExp(r,kF(n))}SF(MF,`partsToRegexp`);var NF={delimiter:``,prefixes:``,sensitive:!0,strict:!0},die={delimiter:`.`,prefixes:``,sensitive:!0,strict:!0},fie={delimiter:`/`,prefixes:`/`,sensitive:!0,strict:!0};function PF(e,t){return e.length?e[0]===`/`?!0:!t||e.length<2?!1:(e[0]==`\\`||e[0]==`{`)&&e[1]==`/`:!1}SF(PF,`isAbsolutePathname`);function FF(e,t){return e.startsWith(t)?e.substring(t.length,e.length):e}SF(FF,`maybeStripPrefix`);function IF(e,t){return e.endsWith(t)?e.substr(0,e.length-t.length):e}SF(IF,`maybeStripSuffix`);function LF(e){return!e||e.length<2?!1:e[0]===`[`||(e[0]===`\\`||e[0]===`{`)&&e[1]===`[`}SF(LF,`treatAsIPv6Hostname`);var RF=[`ftp`,`file`,`http`,`https`,`ws`,`wss`];function zF(e){if(!e)return!0;for(let t of RF)if(e.test(t))return!0;return!1}SF(zF,`isSpecialScheme`);function BF(e,t){if(e=FF(e,`#`),t||e===``)return e;let n=new URL(`https://example.com`);return n.hash=e,n.hash?n.hash.substring(1,n.hash.length):``}SF(BF,`canonicalizeHash`);function VF(e,t){if(e=FF(e,`?`),t||e===``)return e;let n=new URL(`https://example.com`);return n.search=e,n.search?n.search.substring(1,n.search.length):``}SF(VF,`canonicalizeSearch`);function HF(e,t){return t||e===``?e:LF(e)?$F(e):QF(e)}SF(HF,`canonicalizeHostname`);function UF(e,t){if(t||e===``)return e;let n=new URL(`https://example.com`);return n.password=e,n.password}SF(UF,`canonicalizePassword`);function WF(e,t){if(t||e===``)return e;let n=new URL(`https://example.com`);return n.username=e,n.username}SF(WF,`canonicalizeUsername`);function GF(e,t,n){if(n||e===``)return e;if(t&&!RF.includes(t))return new URL(`${t}:${e}`).pathname;let r=e[0]==`/`;return e=new URL(r?e:`/-`+e,`https://example.com`).pathname,r||(e=e.substring(2,e.length)),e}SF(GF,`canonicalizePathname`);function KF(e,t,n){return JF(t)===e&&(e=``),n||e===``?e:eI(e)}SF(KF,`canonicalizePort`);function qF(e,t){return e=IF(e,`:`),t||e===``?e:YF(e)}SF(qF,`canonicalizeProtocol`);function JF(e){switch(e){case`ws`:case`http`:return`80`;case`wws`:case`https`:return`443`;case`ftp`:return`21`;default:return``}}SF(JF,`defaultPortForProtocol`);function YF(e){if(e===``)return e;if(/^[-+.A-Za-z0-9]*$/.test(e))return e.toLowerCase();throw TypeError(`Invalid protocol '${e}'.`)}SF(YF,`protocolEncodeCallback`);function XF(e){if(e===``)return e;let t=new URL(`https://example.com`);return t.username=e,t.username}SF(XF,`usernameEncodeCallback`);function ZF(e){if(e===``)return e;let t=new URL(`https://example.com`);return t.password=e,t.password}SF(ZF,`passwordEncodeCallback`);function QF(e){if(e===``)return e;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(e))throw TypeError(`Invalid hostname '${e}'`);let t=new URL(`https://example.com`);return t.hostname=e,t.hostname}SF(QF,`hostnameEncodeCallback`);function $F(e){if(e===``)return e;if(/[^0-9a-fA-F[\]:]/g.test(e))throw TypeError(`Invalid IPv6 hostname '${e}'`);return e.toLowerCase()}SF($F,`ipv6HostnameEncodeCallback`);function eI(e){if(e===``||/^[0-9]*$/.test(e)&&parseInt(e)<=65535)return e;throw TypeError(`Invalid port '${e}'.`)}SF(eI,`portEncodeCallback`);function tI(e){if(e===``)return e;let t=new URL(`https://example.com`);return t.pathname=e[0]===`/`?e:`/-`+e,e[0]===`/`?t.pathname:t.pathname.substring(2,t.pathname.length)}SF(tI,`standardURLPathnameEncodeCallback`);function nI(e){return e===``?e:new URL(`data:${e}`).pathname}SF(nI,`pathURLPathnameEncodeCallback`);function rI(e){if(e===``)return e;let t=new URL(`https://example.com`);return t.search=e,t.search.substring(1,t.search.length)}SF(rI,`searchEncodeCallback`);function iI(e){if(e===``)return e;let t=new URL(`https://example.com`);return t.hash=e,t.hash.substring(1,t.hash.length)}SF(iI,`hashEncodeCallback`);var aI=class{#e;#t=[];#n={};#r=0;#i=1;#a=0;#o=0;#s=0;#c=0;#l=!1;constructor(e){this.#e=e}get result(){return this.#n}parse(){for(this.#t=EF(this.#e,!0);this.#r<this.#t.length;this.#r+=this.#i){if(this.#i=1,this.#t[this.#r].type===`END`){if(this.#o===0){this.#f(),this.#C()?this.#u(9,1):this.#S()?this.#u(8,1):this.#u(7,0);continue}else if(this.#o===2){this.#p(5);continue}this.#u(10,0);break}if(this.#s>0)if(this.#T())--this.#s;else continue;if(this.#w()){this.#s+=1;continue}switch(this.#o){case 0:this.#g()&&this.#p(1);break;case 1:if(this.#g()){this.#k();let e=7,t=1;this.#_()?(e=2,t=3):this.#l&&(e=2),this.#u(e,t)}break;case 2:this.#v()?this.#p(3):(this.#x()||this.#S()||this.#C())&&this.#p(5);break;case 3:this.#y()?this.#u(4,1):this.#v()&&this.#u(5,1);break;case 4:this.#v()&&this.#u(5,1);break;case 5:this.#E()?this.#c+=1:this.#D()&&--this.#c,this.#b()&&!this.#c?this.#u(6,1):this.#x()?this.#u(7,0):this.#S()?this.#u(8,1):this.#C()&&this.#u(9,1);break;case 6:this.#x()?this.#u(7,0):this.#S()?this.#u(8,1):this.#C()&&this.#u(9,1);break;case 7:this.#S()?this.#u(8,1):this.#C()&&this.#u(9,1);break;case 8:this.#C()&&this.#u(9,1);break;case 9:break;case 10:break}}this.#n.hostname!==void 0&&this.#n.port===void 0&&(this.#n.port=``)}#u(e,t){switch(this.#o){case 0:break;case 1:this.#n.protocol=this.#O();break;case 2:break;case 3:this.#n.username=this.#O();break;case 4:this.#n.password=this.#O();break;case 5:this.#n.hostname=this.#O();break;case 6:this.#n.port=this.#O();break;case 7:this.#n.pathname=this.#O();break;case 8:this.#n.search=this.#O();break;case 9:this.#n.hash=this.#O();break;case 10:break}this.#o!==0&&e!==10&&([1,2,3,4].includes(this.#o)&&[6,7,8,9].includes(e)&&(this.#n.hostname??=``),[1,2,3,4,5,6].includes(this.#o)&&[8,9].includes(e)&&(this.#n.pathname??=this.#l?`/`:``),[1,2,3,4,5,6,7].includes(this.#o)&&e===9&&(this.#n.search??=``)),this.#d(e,t)}#d(e,t){this.#o=e,this.#a=this.#r+t,this.#r+=t,this.#i=0}#f(){this.#r=this.#a,this.#i=0}#p(e){this.#f(),this.#o=e}#m(e){return e<0&&(e=this.#t.length-e),e<this.#t.length?this.#t[e]:this.#t[this.#t.length-1]}#h(e,t){let n=this.#m(e);return n.value===t&&(n.type===`CHAR`||n.type===`ESCAPED_CHAR`||n.type===`INVALID_CHAR`)}#g(){return this.#h(this.#r,`:`)}#_(){return this.#h(this.#r+1,`/`)&&this.#h(this.#r+2,`/`)}#v(){return this.#h(this.#r,`@`)}#y(){return this.#h(this.#r,`:`)}#b(){return this.#h(this.#r,`:`)}#x(){return this.#h(this.#r,`/`)}#S(){if(this.#h(this.#r,`?`))return!0;if(this.#t[this.#r].value!==`?`)return!1;let e=this.#m(this.#r-1);return e.type!==`NAME`&&e.type!==`REGEX`&&e.type!==`CLOSE`&&e.type!==`ASTERISK`}#C(){return this.#h(this.#r,`#`)}#w(){return this.#t[this.#r].type==`OPEN`}#T(){return this.#t[this.#r].type==`CLOSE`}#E(){return this.#h(this.#r,`[`)}#D(){return this.#h(this.#r,`]`)}#O(){let e=this.#t[this.#r],t=this.#m(this.#a).index;return this.#e.substring(t,e.index)}#k(){let e={};Object.assign(e,NF),e.encodePart=YF;let t=AF(this.#O(),void 0,e);this.#l=zF(t)}};SF(aI,`Parser`);var oI=[`protocol`,`username`,`password`,`hostname`,`port`,`pathname`,`search`,`hash`],sI=`*`;function cI(e,t){if(typeof e!=`string`)throw TypeError(`parameter 1 is not of type 'string'.`);let n=new URL(e,t);return{protocol:n.protocol.substring(0,n.protocol.length-1),username:n.username,password:n.password,hostname:n.hostname,port:n.port,pathname:n.pathname,search:n.search===``?void 0:n.search.substring(1,n.search.length),hash:n.hash===``?void 0:n.hash.substring(1,n.hash.length)}}SF(cI,`extractValues`);function lI(e,t){return t?dI(e):e}SF(lI,`processBaseURLString`);function uI(e,t,n){let r;if(typeof t.baseURL==`string`)try{r=new URL(t.baseURL),t.protocol===void 0&&(e.protocol=lI(r.protocol.substring(0,r.protocol.length-1),n)),!n&&t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.username===void 0&&(e.username=lI(r.username,n)),!n&&t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.username===void 0&&t.password===void 0&&(e.password=lI(r.password,n)),t.protocol===void 0&&t.hostname===void 0&&(e.hostname=lI(r.hostname,n)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&(e.port=lI(r.port,n)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.pathname===void 0&&(e.pathname=lI(r.pathname,n)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.pathname===void 0&&t.search===void 0&&(e.search=lI(r.search.substring(1,r.search.length),n)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.pathname===void 0&&t.search===void 0&&t.hash===void 0&&(e.hash=lI(r.hash.substring(1,r.hash.length),n))}catch{throw TypeError(`invalid baseURL '${t.baseURL}'.`)}if(typeof t.protocol==`string`&&(e.protocol=qF(t.protocol,n)),typeof t.username==`string`&&(e.username=WF(t.username,n)),typeof t.password==`string`&&(e.password=UF(t.password,n)),typeof t.hostname==`string`&&(e.hostname=HF(t.hostname,n)),typeof t.port==`string`&&(e.port=KF(t.port,e.protocol,n)),typeof t.pathname==`string`){if(e.pathname=t.pathname,r&&!PF(e.pathname,n)){let t=r.pathname.lastIndexOf(`/`);t>=0&&(e.pathname=lI(r.pathname.substring(0,t+1),n)+e.pathname)}e.pathname=GF(e.pathname,e.protocol,n)}return typeof t.search==`string`&&(e.search=VF(t.search,n)),typeof t.hash==`string`&&(e.hash=BF(t.hash,n)),e}SF(uI,`applyInit`);function dI(e){return e.replace(/([+*?:{}()\\])/g,`\\$1`)}SF(dI,`escapePatternString`);function fI(e){return e.replace(/([.+*?^${}()[\]|/\\])/g,`\\$1`)}SF(fI,`escapeRegexpString`);function pI(e,t){t.delimiter??=`/#?`,t.prefixes??=`./`,t.sensitive??=!1,t.strict??=!1,t.end??=!0,t.start??=!0,t.endsWith=``;let n=`[^${fI(t.delimiter)}]+?`,r=/[$_\u200C\u200D\p{ID_Continue}]/u,i=``;for(let a=0;a<e.length;++a){let o=e[a];if(o.type===3){if(o.modifier===3){i+=dI(o.value);continue}i+=`{${dI(o.value)}}${jF(o.modifier)}`;continue}let s=o.hasCustomName(),c=!!o.suffix.length||!!o.prefix.length&&(o.prefix.length!==1||!t.prefixes.includes(o.prefix)),l=a>0?e[a-1]:null,u=a<e.length-1?e[a+1]:null;if(!c&&s&&o.type===1&&o.modifier===3&&u&&!u.prefix.length&&!u.suffix.length)if(u.type===3){let e=u.value.length>0?u.value[0]:``;c=r.test(e)}else c=!u.hasCustomName();if(!c&&!o.prefix.length&&l&&l.type===3){let e=l.value[l.value.length-1];c=t.prefixes.includes(e)}c&&(i+=`{`),i+=dI(o.prefix),s&&(i+=`:${o.name}`),o.type===2?i+=`(${o.value})`:o.type===1?s||(i+=`(${n})`):o.type===0&&(!s&&(!l||l.type===3||l.modifier!==3||c||o.prefix!==``)?i+=`*`:i+=`(.*)`),o.type===1&&s&&o.suffix.length&&r.test(o.suffix[0])&&(i+=`\\`),i+=dI(o.suffix),c&&(i+=`}`),o.modifier!==3&&(i+=jF(o.modifier))}return i}SF(pI,`partsToPattern`);var mI=class{#e;#t={};#n={};#r={};#i={};#a=!1;constructor(e={},t,n){try{let r;if(typeof t==`string`?r=t:n=t,typeof e==`string`){let t=new aI(e);if(t.parse(),e=t.result,r===void 0&&typeof e.protocol!=`string`)throw TypeError(`A base URL must be provided for a relative constructor string.`);e.baseURL=r}else{if(!e||typeof e!=`object`)throw TypeError(`parameter 1 is not of type 'string' and cannot convert to dictionary.`);if(r)throw TypeError(`parameter 1 is not of type 'string'.`)}typeof n>`u`&&(n={ignoreCase:!1});let i={ignoreCase:n.ignoreCase===!0},a={pathname:sI,protocol:sI,username:sI,password:sI,hostname:sI,port:sI,search:sI,hash:sI};this.#e=uI(a,e,!0),JF(this.#e.protocol)===this.#e.port&&(this.#e.port=``);let o;for(o of oI){if(!(o in this.#e))continue;let e={},t=this.#e[o];switch(this.#n[o]=[],o){case`protocol`:Object.assign(e,NF),e.encodePart=YF;break;case`username`:Object.assign(e,NF),e.encodePart=XF;break;case`password`:Object.assign(e,NF),e.encodePart=ZF;break;case`hostname`:Object.assign(e,die),LF(t)?e.encodePart=$F:e.encodePart=QF;break;case`port`:Object.assign(e,NF),e.encodePart=eI;break;case`pathname`:zF(this.#t.protocol)?(Object.assign(e,fie,i),e.encodePart=tI):(Object.assign(e,NF,i),e.encodePart=nI);break;case`search`:Object.assign(e,NF,i),e.encodePart=rI;break;case`hash`:Object.assign(e,NF,i),e.encodePart=iI;break}try{this.#i[o]=DF(t,e),this.#t[o]=MF(this.#i[o],this.#n[o],e),this.#r[o]=pI(this.#i[o],e),this.#a=this.#a||this.#i[o].some(e=>e.type===2)}catch{throw TypeError(`invalid ${o} pattern '${this.#e[o]}'.`)}}}catch(e){throw TypeError(`Failed to construct 'URLPattern': ${e.message}`)}}get[Symbol.toStringTag](){return`URLPattern`}test(e={},t){let n={pathname:``,protocol:``,username:``,password:``,hostname:``,port:``,search:``,hash:``};if(typeof e!=`string`&&t)throw TypeError(`parameter 1 is not of type 'string'.`);if(typeof e>`u`)return!1;try{n=typeof e==`object`?uI(n,e,!1):uI(n,cI(e,t),!1)}catch{return!1}let r;for(r of oI)if(!this.#t[r].exec(n[r]))return!1;return!0}exec(e={},t){let n={pathname:``,protocol:``,username:``,password:``,hostname:``,port:``,search:``,hash:``};if(typeof e!=`string`&&t)throw TypeError(`parameter 1 is not of type 'string'.`);if(typeof e>`u`)return;try{n=typeof e==`object`?uI(n,e,!1):uI(n,cI(e,t),!1)}catch{return null}let r={};t?r.inputs=[e,t]:r.inputs=[e];let i;for(i of oI){let e=this.#t[i].exec(n[i]);if(!e)return null;let t={};for(let[n,r]of this.#n[i].entries())(typeof r==`string`||typeof r==`number`)&&(t[r]=e[n+1]);r[i]={input:n[i]??``,groups:t}}return r}static compareComponent(e,t,n){let r=SF((e,t)=>{for(let n of[`type`,`modifier`,`prefix`,`value`,`suffix`]){if(e[n]<t[n])return-1;if(e[n]!==t[n])return 1}return 0},`comparePart`),i=new CF(3,``,``,``,``,3),a=new CF(0,``,``,``,``,3),o=SF((e,t)=>{let n=0;for(;n<Math.min(e.length,t.length);++n){let i=r(e[n],t[n]);if(i)return i}return e.length===t.length?0:r(e[n]??i,t[n]??i)},`comparePartList`);return!t.#r[e]&&!n.#r[e]?0:t.#r[e]&&!n.#r[e]?o(t.#i[e],[a]):!t.#r[e]&&n.#r[e]?o([a],n.#i[e]):o(t.#i[e],n.#i[e])}get protocol(){return this.#r.protocol}get username(){return this.#r.username}get password(){return this.#r.password}get hostname(){return this.#r.hostname}get port(){return this.#r.port}get pathname(){return this.#r.pathname}get search(){return this.#r.search}get hash(){return this.#r.hash}get hasRegExpGroups(){return this.#a}};SF(mI,`URLPattern`),globalThis.URLPattern||(globalThis.URLPattern=mI);function*pie(e){let t=null;for(let n of e)t!=null&&t.type===V.RemoveFromQueue&&n.type===V.AddToQueue&&t.loc===n.loc?t=null:(t!==null&&(yield t),t=n);t!==null&&(yield t)}function hI(e,t){return e.containerId?`${t} fragment ${e.containerId.slice(0,8)}`:e.pal>0?`${t} ${e.pal}`:t}function mie(e,t){let n=hI(e,t);if(e.startofcycle)return`${n} started cycle`;let r=e.containerIds?.length??0;return`${n} completed cycle${r>0?` from ${r} UUID fragment${r===1?``:`s`}`:``}`}var gI=G(`span`,{shouldForwardProp:e=>e.toString()[0]!==`$`})(({$type:e})=>{switch(e){case`machine`:return{color:`#1565C0`};case`loadStation`:return{color:`#795548`};case`pallet`:return{color:`#00695C`};case`queue`:return{color:`#6A1B9A`};case`inspectionNotSignaled`:return{color:`#4527A0`};case`inspectionSignaled`:return{color:`red`};case`closeoutFailed`:return{color:`red`}}});function hie(e,t){let n=ok(t.basketName);switch(e.type){case V.LoadUnloadCycle:return e.startofcycle?`Start `+e.result.charAt(0).toUpperCase()+e.result.substring(1).toLowerCase():`End `+e.result.charAt(0).toUpperCase()+e.result.substring(1).toLowerCase();case V.BasketLoadUnload:return e.program===`LOAD`?`${n} Load`:`${n} Unload`;case V.BasketCycle:return`${n} Cycle`;case V.BasketInLocation:return e.startofcycle?`Arrive`:`Depart`;case V.BasketIdentityHint:return`${n} Identity Hint`;case V.BasketContentSnapshot:return`${n} Content Snapshot`;case V.MachineCycle:return e.startofcycle?`Start Cycle`:`End Cycle`;case V.PartMark:return`Serial`;case V.OrderAssignment:return`Workorder`;case V.Inspection:case V.InspectionForce:return`Signal`;case V.PalletCycle:return`Pallet Cycle`;case V.WorkorderComment:return`Workorder`;case V.CloseOut:return`CloseOut`;case V.InspectionResult:return`Inspection`;case V.AddToQueue:return`Queue`;case V.RemoveFromQueue:return`Queue`;case V.PalletInStocker:return`Stocker`;case V.PalletOnRotaryInbound:return`Rotary`;case V.SignalQuarantine:return`Quarantine`;case V.SwapMaterialOnPallet:return`Swap Serial`;case V.InvalidateCycle:return`Invalidate Cycle`;case V.Rebooking:return`Rebooking`;case V.CancelRebooking:return`Cancel Rebooking`;default:return`Message`}}function _I(e){return e.details?.PalletCycleInvalidated===`1`}function vI(e){return e.length>1?e[0].numproc==1?`${e[0].part} x${e.length}`:`${e[0].part}-${Q.of(e).map(e=>e.proc).distinctAndSortBy(e=>e).toRArray().join(`&`)} x${e.length}`:e.length==1?e[0].numproc==1?e[0].part:`${e[0].part}-${e[0].proc}`:``}function yI(e){return e.length>1?`${e[0].part} x${e.length}`:e.length===1?e[0].part:``}function gie(e,t){let n=e.entry;switch(n.type){case V.LoadUnloadCycle:return(0,H.jsxs)(`span`,{children:[vI(n.material),` on`,` `,(0,H.jsxs)(gI,{$type:`pallet`,children:[`pallet `,n.pal]}),` at`,` `,(0,H.jsx)(gI,{$type:`loadStation`,children:ik(n.locnum,t.loadStationNames)})]});case V.BasketLoadUnload:{let e=ok(t.basketName);return(0,H.jsxs)(`span`,{children:[vI(n.material),` `,n.program===`LOAD`?`loaded onto`:`unloaded from`,` `,(0,H.jsx)(gI,{$type:`pallet`,children:hI(n,e)}),` at`,` `,(0,H.jsx)(gI,{$type:`loadStation`,children:ik(n.locnum,t.loadStationNames)})]})}case V.BasketCycle:return(0,H.jsx)(`span`,{children:mie(n,ok(t.basketName))});case V.BasketInLocation:{let e=ok(t.basketName);return n.startofcycle?(0,H.jsxs)(`span`,{children:[hI(n,e),` arrived at `,n.loc,n.locnum>0?` position ${n.locnum}`:``]}):(0,H.jsxs)(`span`,{children:[hI(n,e),` departed from `,n.loc,n.locnum>0?` position ${n.locnum}`:``]})}case V.BasketIdentityHint:{let e=ok(t.basketName);return(0,H.jsxs)(`span`,{children:[hI(n,e),` presently associated with `,e,` `,n.pal]})}case V.BasketContentSnapshot:return(0,H.jsxs)(`span`,{children:[hI(n,ok(t.basketName)),` contained `,vI(n.material)]});case V.MachineCycle:return(0,H.jsxs)(`span`,{children:[vI(n.material),` on`,` `,(0,H.jsxs)(gI,{$type:`pallet`,children:[`pallet `,n.pal]}),` at`,` `,(0,H.jsxs)(gI,{$type:`machine`,children:[n.loc,` `,n.locnum.toString()]}),n.program&&n.program!==``?(0,H.jsxs)(`span`,{children:[` with program `,n.program]}):void 0]});case V.PartMark:return(0,H.jsxs)(`span`,{children:[vI(n.material),` marked with `,n.result]});case V.OrderAssignment:return(0,H.jsxs)(`span`,{children:[vI(n.material),` assigned to workorder `,n.result]});case V.PalletCycle:return n.startofcycle?(0,H.jsxs)(`span`,{children:[`Pallet `,n.pal,` started route`]}):(0,H.jsxs)(`span`,{children:[`Pallet `,n.pal,` completed route`]});case V.Inspection:{let e=(n.details||{}).InspectionType||``;return n.result.toLowerCase()===`true`||n.result===`1`?(0,H.jsxs)(`span`,{children:[vI(n.material),` signaled for inspection`,` `,(0,H.jsx)(gI,{$type:`inspectionSignaled`,children:e})]}):(0,H.jsxs)(`span`,{children:[vI(n.material),` skipped inspection`,` `,(0,H.jsx)(gI,{$type:`inspectionNotSignaled`,children:e})]})}case V.InspectionForce:{let e=n.program;return n.result.toLowerCase()===`true`||n.result===`1`?(0,H.jsxs)(`span`,{children:[vI(n.material),` declared for inspection`,` `,(0,H.jsx)(gI,{$type:`inspectionSignaled`,children:e})]}):(0,H.jsxs)(`span`,{children:[vI(n.material),` passed over for inspection`,` `,(0,H.jsx)(gI,{$type:`inspectionNotSignaled`,children:e})]})}case V.WorkorderComment:return(0,H.jsxs)(`span`,{children:[`Workorder `,n.result,` Comment`]});case V.InspectionResult:return n.result.toLowerCase()===`false`?(0,H.jsxs)(gI,{$type:`inspectionSignaled`,children:[n.program,` Failed`]}):(0,H.jsxs)(gI,{$type:`inspectionSignaled`,children:[n.program,` Succeeded`]});case V.CloseOut:return n.result.toLowerCase()===`failed`?(0,H.jsxs)(gI,{$type:`closeoutFailed`,children:[n.program&&n.program!==``?n.program:`CloseOut`,` Failed`]}):(0,H.jsxs)(`span`,{children:[n.program&&n.program!==``?n.program:`CloseOut`,` Completed`]});case V.AddToQueue:switch(n.program){case`Unloaded`:return(0,H.jsxs)(`span`,{children:[yI(n.material),` unloaded into queue`,` `,(0,H.jsx)(gI,{$type:`queue`,children:n.loc})]});case`SetByOperator`:return(0,H.jsxs)(`span`,{children:[yI(n.material),` set manually into queue`,` `,(0,H.jsx)(gI,{$type:`queue`,children:n.loc})]});case`Quarantine`:return(0,H.jsxs)(`span`,{children:[yI(n.material),` quarantined into queue`,` `,(0,H.jsx)(gI,{$type:`queue`,children:n.loc})]});case`SwapMaterial`:return(0,H.jsxs)(`span`,{children:[yI(n.material),` swapped off pallet into queue`,` `,(0,H.jsx)(gI,{$type:`queue`,children:n.loc})]});case`MaterialMissingOnPallet`:return(0,H.jsxs)(`span`,{children:[yI(n.material),` removed from cell controller, added to queue`,` `,(0,H.jsx)(gI,{$type:`queue`,children:n.loc})]});default:return(0,H.jsxs)(`span`,{children:[yI(n.material),` added to queue`,` `,(0,H.jsx)(gI,{$type:`queue`,children:n.loc}),n.program&&n.program!==``?` (`+n.program+`)`:void 0]})}case V.RemoveFromQueue:return(0,H.jsxs)(`span`,{children:[yI(n.material),` removed from queue`,` `,(0,H.jsx)(gI,{$type:`queue`,children:n.loc})]});case V.PalletInStocker:return n.startofcycle?(0,H.jsxs)(`span`,{children:[(0,H.jsxs)(gI,{$type:`pallet`,children:[`Pallet `,n.pal]}),` arrived at stocker`,` `,n.locnum]}):(0,H.jsxs)(`span`,{children:[(0,H.jsxs)(gI,{$type:`pallet`,children:[`Pallet `,n.pal]}),` departed stocker`,` `,n.locnum]});case V.PalletOnRotaryInbound:return n.startofcycle?(0,H.jsxs)(`span`,{children:[(0,H.jsxs)(gI,{$type:`pallet`,children:[`Pallet `,n.pal]}),` arrived at`,` `,(0,H.jsxs)(gI,{$type:`machine`,children:[n.loc,` `,n.locnum.toString()]})]}):n.result==`RotateIntoWorktable`?(0,H.jsxs)(`span`,{children:[(0,H.jsxs)(gI,{$type:`pallet`,children:[`Pallet `,n.pal]}),` rotated into`,` `,(0,H.jsxs)(gI,{$type:`machine`,children:[n.loc,` `,n.locnum.toString()]}),` `,`worktable`]}):(0,H.jsxs)(`span`,{children:[(0,H.jsxs)(gI,{$type:`pallet`,children:[`Pallet `,n.pal]}),` left`,` `,(0,H.jsxs)(gI,{$type:`machine`,children:[n.loc,` `,n.locnum.toString()]})]});case V.SignalQuarantine:return(0,H.jsxs)(`span`,{children:[vI(n.material),` signaled for quarantine after unload`]});case V.SwapMaterialOnPallet:return(0,H.jsx)(`span`,{children:n.result});case V.InvalidateCycle:return(0,H.jsx)(`span`,{children:n.result});case V.Rebooking:return(0,H.jsxs)(`span`,{children:[`Rebooking requested with ID `,n.result]});case V.CancelRebooking:return(0,H.jsxs)(`span`,{children:[`Rebooking `,n.result,` canceled`]});default:return(0,H.jsx)(`span`,{children:n.result})}}function _ie(e){let t=[];if(e.details&&e.details.operator&&t.push({name:`Operator`,value:e.details.operator}),e.details&&e.details.note&&t.push({name:`Note`,value:e.details.note}),e.tooluse)for(let n of e.tooluse){let e=null;if(n.toolUseDuringCycle&&n.toolUseDuringCycle!==``&&(e=BO(n.toolUseDuringCycle).toFixed(1)+` minutes used during cycle.`,n.totalToolUseAtEndOfCycle&&n.configuredToolLife&&n.totalToolUseAtEndOfCycle!==``&&n.configuredToolLife!==``)){let t=zO(n.totalToolUseAtEndOfCycle),r=zO(n.configuredToolLife),i=t/r;e+=` Total use at end of cycle: ${(t/60).toFixed(1)}/${(r/60).toFixed(1)} minutes (${(i*100).toFixed(0)}%).`}if(n.toolUseCountDuringCycle&&n.toolUseCountDuringCycle>0&&(e=(e===null?``:` | `)+`${n.toolUseCountDuringCycle} use${n.toolUseCountDuringCycle>1?`s`:``} during cycle.`,n.totalToolUseCountAtEndOfCycle&&n.configuredToolLifeCount&&(e+=` Total use count at end of cycle: ${n.totalToolUseCountAtEndOfCycle}/${n.configuredToolLifeCount} (${(n.totalToolUseCountAtEndOfCycle/n.configuredToolLifeCount*100).toFixed(0)}%).`)),e!==null){let r=n.pocket>0?`${n.tool} [${n.pocket}]`:n.tool,i=n.toolSerialAtEndOfCycle??n.toolSerialAtStartOfCycle;i&&i!==``&&(r+=` (${i})`),t.push({name:r,value:e})}}return t}var vie=[V.AddToQueue,V.RemoveFromQueue,V.LoadUnloadCycle,V.BasketLoadUnload,V.MachineCycle],yie=G(Vw,{shouldForwardProp:e=>e.toString()[0]!==`$`})(({$highlightProc:e,$invalidCycle:t})=>({...e&&{backgroundColor:`#eeeeee`},...t&&{textDecoration:`line-through`}})),bie=(0,L.memo)(function(e){let t=_ie(e.entry),n=e.highlightProcsGreaterOrEqualTo,r=R(br);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(yie,{$highlightProc:n!==void 0&&e.entry.material.findIndex(e=>e.proc>=n)>=0&&vie.indexOf(e.entry.type)>=0,$invalidCycle:_I(e.entry),children:[(0,H.jsx)(Z,{size:`small`,children:e.entry.endUTC.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`2-digit`})}),(0,H.jsx)(Z,{size:`small`,children:e.entry.endUTC.toLocaleTimeString(void 0,{hour:`numeric`,minute:`2-digit`})}),(0,H.jsx)(Z,{size:`small`,children:hie(e.entry,r)}),(0,H.jsx)(Z,{size:`small`,children:gie(e,r)}),(0,H.jsx)(Z,{padding:`checkbox`,children:t.length>0?(0,H.jsx)(Um,{style:{transition:`all ease 200ms`,transform:e.entry.counter===e.detailLogCounter?`rotate(90deg)`:`none`},onClick:t=>{e.setDetail(e.entry.counter===e.detailLogCounter?null:e.entry.counter),t.stopPropagation()},size:`small`,children:(0,H.jsx)(mre,{fontSize:`inherit`})}):void 0})]}),t.length>0&&e.entry.counter===e.detailLogCounter?(0,H.jsx)(Vw,{children:(0,H.jsx)(Z,{colSpan:5,children:(0,H.jsx)(`ul`,{children:t.map((e,t)=>(0,H.jsxs)(`li`,{children:[e.name,`: `,e.value]},t))})})}):void 0]})}),bI=(0,L.memo)(function(e){let[t,n]=(0,L.useState)(null);return(0,H.jsxs)(jw,{children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:`Date`}),(0,H.jsx)(Z,{children:`Time`}),(0,H.jsx)(Z,{children:`Type`}),(0,H.jsx)(Z,{children:`Details`}),(0,H.jsx)(Z,{padding:`checkbox`,children:e.copyToClipboard?(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{onClick:()=>Jk(e.entries),style:{height:`25px`,paddingTop:0,paddingBottom:0},size:`large`,children:(0,H.jsx)(uT,{})})}):void 0})]})}),(0,H.jsx)(Pw,{children:Array.from(pie(e.entries)).map((r,i)=>(0,H.jsx)(bie,{entry:r,detailLogCounter:t,setDetail:n,highlightProcsGreaterOrEqualTo:e.highlightProcsGreaterOrEqualTo},i))})]})}),xI=P(null),SI=P(e=>e(xI),(e,t,n)=>{n===null?(t(xI,null),t(jI,[])):t(xI,n)}),CI=P(async e=>{let t=e(xI);if(t&&t.type===`Barcode`){if(Ht===void 0)return null;let n=e(KI),r=t.toQueue?[t.toQueue]:n.route===$.Station_LoadMonitor||n.route===$.Station_Queues?n.queues:null;return await Ht.parseBarcode(t.barcode,r)}else return null}),wI=P(async e=>(await e(CI))?.potentialNewMaterial??null),TI=P(async e=>{let t=e(xI);if(t===null)return null;switch(t.type){case`InProcMat`:return t.inproc;case`MatSummary`:return t.summary;case`MatDetails`:return t.details;case`LogMat`:return{materialID:t.logMat.id,partName:t.logMat.part,serial:t.logMat.serial,workorderId:t.logMat.workorder};case`Barcode`:{let t=await e(CI);return t?.existingMaterial&&t.existingMaterial.materialID>=0?t.existingMaterial:null}case`ManuallyEnteredSerial`:case`AddMatWithEnteredSerial`:return Wt===void 0?null:(await Wt.materialForSerial(t.serial))?.[0]??null}}),EI=OO(TI,e=>e??null);function DI(e){return OO(P(t=>t(e).then(e=>({state:`hasData`,data:e}),e=>({state:`hasError`,error:e}))),()=>({state:`loading`}))}var xie=DI(TI),OI=P(async e=>{let t=e(NO),n=e(xI);if(n===null)return null;if(n.type===`InProcMat`)return t.material.find(e=>e.materialID===n.inproc.materialID)??null;let r=(await e(TI))?.materialID??null;return r!==null&&r>=0?t.material.find(e=>e.materialID===r)??null:null}),kI=P(async e=>{let t=e(xI);if(t===null)return null;switch(t.type){case`InProcMat`:return t.inproc.serial??null;case`MatSummary`:return t.summary.serial??null;case`MatDetails`:return t.details.serial??null;case`LogMat`:return t.logMat.serial??null;case`Barcode`:{let t=await e(CI);return t?.existingMaterial?.serial??t?.potentialNewMaterial?.serial??null}case`ManuallyEnteredSerial`:case`AddMatWithEnteredSerial`:return t.serial}});OO(kI,e=>e??null);var Sie=DI(kI),AI=P(async e=>{let t=e(xI);if(t===null)return null;switch(t.type){case`InProcMat`:return t.inproc.workorderId??null;case`MatSummary`:return t.summary.workorderId??null;case`MatDetails`:return t.details.workorder??null;case`LogMat`:return t.logMat.workorder??null;case`Barcode`:{let t=await e(CI);return t?.existingMaterial?.workorder??t?.potentialNewMaterial?.workorder??null}case`ManuallyEnteredSerial`:case`AddMatWithEnteredSerial`:return null}}),jI=P([]),MI=OO(P(async(e,{signal:t})=>{let n=await e(TI);return n===null||Wt===void 0?[]:n.materialID>=0?await Wt.logForMaterial(n.materialID,t):n.serial&&n.serial!==``?await Wt.logForSerial(n.serial):[]}),e=>e??[]),Cie=OO(P(async(e,{signal:t})=>{let n=await e(kI);if(n===null||n===``)return[];let r=[];for(let e of qt)r.push.apply(await e.logForSerial(n,t));return r}),e=>e??[]),wie=P(e=>Q.of(e(MI)).concat(e(jI)).toRArray()),NI=P(e=>{let t=e(jI);return Q.of(e(MI)).concat(e(Cie)).sortBy(e=>e.endUTC.getTime(),e=>e.counter).concat(t).toRArray()}),PI=P(async e=>{let t=await e(TI);if(t===null)return null;let n=e(NI),r=Q.of(n).filter(e=>!_I(e)&&(e.type===V.LoadUnloadCycle||e.type===V.MachineCycle||e.type===V.AddToQueue)).flatMap(e=>e.material).filter(e=>e.id===t.materialID).maxBy(e=>e.proc);return r?{process:r.proc,totalNumProcesses:r.numproc}:null}),FI=P(e=>{let t=e(xI),n=e(NI);if(t===null)return{signaledInspections:[],completedInspections:[]};let r=new Set(t.type===`InProcMat`?t.inproc.signaledInspections:[]),i=new Set;return n.forEach(e=>{switch(e.type){case V.Inspection:if(e.result.toLowerCase()===`true`||e.result===`1`){let t=(e.details||{}).InspectionType;t&&r.add(t)}break;case V.InspectionForce:(e.result.toLowerCase()===`true`||e.result===`1`)&&r.add(e.program);break;case V.InspectionResult:i.add(e.program);break}}),{signaledInspections:Q.of(r).toSortedArray(e=>e),completedInspections:Q.of(i).toSortedArray(e=>e)}}),Tie=P(async e=>{let t=await e(TI);if(t===null||t.partName===``)return[];let n=e(NO)?.workorders??[];return Q.of(n).filter(e=>e.part===t.partName).toSortedArray(e=>e.dueDate.getTime(),e=>-e.priority)});function II(){let[e,t]=(0,L.useState)(!1),n=z(jI);return[(0,L.useCallback)(e=>{t(!0),Wt.setInspectionDecision(e.mat.materialID,e.inspType,1,e.inspect).then(e=>n(t=>[...t,e])).catch(console.log).finally(()=>t(!1))},[n]),e]}function Eie(){let[e,t]=(0,L.useState)(!1);return[(0,L.useCallback)(e=>{t(!0),Wt.recordInspectionCompleted(new Nt({materialID:e.mat.materialID,process:1,inspectionLocationNum:1,inspectionType:e.inspType,success:e.success,active:`PT0S`,elapsed:`PT0S`,extraData:e.operator?{operator:e.operator}:void 0})).catch(console.log).finally(()=>t(!1))},[]),e]}function LI(){let[e,t]=(0,L.useState)(!1);return[(0,L.useCallback)(e=>{t(!0),Wt.recordCloseoutCompleted(new Pt({materialID:e.mat.materialID,process:1,locationNum:1,closeoutType:``,active:`PT0S`,elapsed:`PT0S`,extraData:e.operator?{operator:e.operator}:void 0,failed:e.failed})).catch(console.log).finally(()=>t(!1))},[]),e]}function RI(){let[e,t]=(0,L.useState)(!1),n=z(jI);return[(0,L.useCallback)((e,r)=>{t(!0),Wt.setWorkorder(e.materialID,1,r).then(e=>n(t=>[...t,e])).catch(console.log).finally(()=>t(!1))},[n]),e]}function Die(){let[e,t]=(0,L.useState)(!1),n=z(jI);return[(0,L.useCallback)(e=>{t(!0),Wt.recordOperatorNotes(e.matId,e.process,e.operator,e.notes).then(e=>n(t=>[...t,e])).catch(console.log).finally(()=>t(!1))},[n]),e]}function zI(){let[e,t]=(0,L.useState)(!1),[n,r]=(0,L.useState)(!1);return[(0,L.useCallback)(e=>{t(!0),Ht.printLabel(e.materialId,e.proc).catch(console.log).finally(()=>{t(!1),r(!0)})},[]),e,n]}function Oie(){let[e,t]=(0,L.useState)(!1);return[(0,L.useCallback)(async(e,n)=>{t(!0);try{await Ut.removeMaterialFromAllQueues(e,n??void 0)}finally{t(!1)}},[]),e]}function kie(){let[e,t]=(0,L.useState)(!1);return[(0,L.useCallback)(async(e,n,r)=>{t(!0);try{await Ut.signalMaterialForQuarantine(e,n,r===``?void 0:r)}finally{t(!1)}},[]),e]}function Aie(){let[e,t]=(0,L.useState)(!1);return[(0,L.useCallback)(async(e,n,r)=>{t(!0);try{await Ut.quarantineQueuedMaterial(e,n,r===``?void 0:r)}finally{t(!1)}},[]),e]}function BI(){let[e,t]=(0,L.useState)(!1);return[(0,L.useCallback)(async e=>{t(!0);try{await Ut.setMaterialInQueue(e.materialId,e.operator,new At({queue:e.queue,position:e.queuePosition}))}finally{t(!1)}},[]),e]}function jie(){let[e,t]=(0,L.useState)(!1);return[(0,L.useCallback)(async e=>{t(!0);try{let t=await Ut.addUnprocessedMaterialToQueue(e.jobUnique,e.lastCompletedProcess,e.queue,e.queuePosition,e.operator,e.workorder,e.serial||``);if(t===void 0)throw Error(`No material returned`);return e.onNewMaterial?.(t),t}catch(t){throw e.onError?.(t),t}finally{t(!1)}},[]),e]}function VI(){let[e,t]=(0,L.useState)(!1);return[(0,L.useCallback)(async e=>{t(!0);try{let t=await Ut.addUnallocatedCastingToQueue(e.casting,e.queue,e.quantity,e.operator,e.workorder,[...e.serials||[]]);return e.onNewMaterial?.(t),t}catch(t){throw e.onError?.(t),t}finally{t(!1)}},[]),e]}var $=function(e){return e.ChooseMode=`/`,e.Station_LoadMonitor=`/station/loadunload/:num`,e.Station_InspectionMonitor=`/station/inspection`,e.Station_InspectionMonitorWithType=`/station/inspection/:type`,e.Station_Closeout=`/station/closeout`,e.Station_Queues=`/station/queues`,e.Station_Overview=`/station/overview`,e.Operations_Dashboard=`/operations`,e.Operations_LoadOutliers=`/operations/load-outliers`,e.Operations_LoadHours=`/operations/load-hours`,e.Operations_LoadCycles=`/operations/load-cycles`,e.Operations_MachineOutliers=`/operations/machine-outliers`,e.Operations_MachineHours=`/operations/machine-hours`,e.Operations_MachineCycles=`/operations/machine-cycles`,e.Operations_SystemOverview=`/operations/system-overview`,e.Operations_AllMaterial=`/operations/material`,e.Operations_RecentSchedules=`/operations/recent-schedules`,e.Operations_CurrentWorkorders=`/operations/current-workorders`,e.Operations_Production=`/operations/recent-production`,e.Operations_Tools=`/operations/tools`,e.Operations_Programs=`/operations/programs`,e.Operations_Quality=`/operations/quality`,e.Operations_Inspections=`/operations/inspections`,e.Operations_CloseoutReport=`/operations/closeout`,e.Operations_Rebookings=`/analysis/rebookings`,e.Operations_Parts=`/operations/parts`,e.Engineering_Cycles=`/engineering`,e.Engineering_Hours=`/engineering/hours`,e.Engineering_Outliers=`/engineering/outliers`,e.Quality_Dashboard=`/quality`,e.Quality_Paths=`/quality/paths`,e.Quality_Quarantine=`/quality/quarantine`,e.Tools_Dashboard=`/tools`,e.Tools_Programs=`/tools/programs`,e.Analysis_Buffers=`/analysis/buffers`,e.Analysis_StationOEE=`/analysis/station-oee`,e.Analysis_PartsCompleted=`/analysis/parts-completed`,e.Analysis_MachineCycles=`/analysis/machine-cycles`,e.Analysis_LoadCycles=`/analysis/load-cycles`,e.Analysis_PalletCycles=`/analysis/pallet-cycles`,e.Analysis_BasketCycles=`/analysis/basket-cycles`,e.Analysis_Schedules=`/analysis/schedules`,e.Analysis_Quality=`/analysis/quality`,e.Analysis_ToolReplacements=`/analysis/tool-replacements`,e.Analysis_CostPercents=`/analysis/cost-percents`,e.Analysis_CostPerPiece=`/analysis/cost`,e.Sales_Dashboard=`/sales`,e.Sales_ProjectedUsage=`/sales/projected-usage`,e.VerboseLogging=`/logging`,e.Client_Custom=`/client/:custom+`,e}({}),Mie=Q.ofObject($).map(([,e])=>[e,new URLPattern(e,location.origin)]).append([`/operations/recent-schedules`,new URLPattern(`/operations/completed`,location.origin)]).append([`/station/closeout`,new URLPattern(`/station/wash`,location.origin)]).toRArray();function HI(e){switch(e.route){case`/station/loadunload/:num`:if(e.queues.length>0||e.completed){let t=new URLSearchParams;for(let n of e.queues)t.append(`queue`,n);return e.completed&&t.append(`completed`,`t`),`/station/loadunload/${e.loadNum}?${t.toString()}`}else return`/station/loadunload/${e.loadNum}`;case`/station/inspection/:type`:return`/station/inspection/${encodeURIComponent(e.inspType)}`;case`/station/queues`:if(e.queues.length>0){let t=new URLSearchParams;for(let n of e.queues)t.append(`queue`,n);return`/station/queues?${t.toString()}`}else return`/station/queues`;case`/operations/current-workorders`:if(e.workorder){let t=new URLSearchParams;return t.append(`workorder`,e.workorder),`/operations/current-workorders?${t.toString()}`}else return`/operations/current-workorders`;case`/client/:custom+`:return`/client/`+e.custom.map(e=>encodeURIComponent(e)).join(`/`);default:return e.route}}function UI(e){for(let[t,n]of Mie){let r=n.exec(e.origin+e.pathname)?.pathname?.groups;if(r)switch(t){case`/station/loadunload/:num`:return{route:t,loadNum:parseInt(r.num??`1`),queues:e.searchParams.getAll(`queue`),completed:e.searchParams.has(`completed`)};case`/station/inspection/:type`:{let e=r.type;return e?{route:`/station/inspection/:type`,inspType:e}:{route:`/station/inspection`}}case`/station/queues`:return{route:`/station/queues`,queues:e.searchParams.getAll(`queue`)};case`/operations/current-workorders`:return{route:`/operations/current-workorders`,workorder:e.searchParams.get(`workorder`)??void 0};case`/client/:custom+`:return{route:`/client/:custom+`,custom:r?.custom?.split(`/`)?.map(e=>decodeURIComponent(e))??[]};default:return{route:t}}}return{route:`/`}}var WI=P(UI(new URL(location.href))),GI=P(!1),KI=P(e=>e(WI),(e,t,n)=>{let r=e(GI);t(WI,n),t(SI,null),r||history.pushState(null,``,HI(n))});function Nie({to:e,children:t}){let n=z(KI);return(0,L.createElement)(cb,{href:HI(e),onClick:t=>{t.preventDefault(),t.stopPropagation(),n(e)}},t)}function Pie(){let e=R(GI),t=z(WI);(0,L.useEffect)(()=>{if(e)return;function n(){t(UI(new URL(location.href)))}return addEventListener(`popstate`,n),()=>removeEventListener(`popstate`,n)},[e,t])}function qI(){return R(GI)}function JI(e){(0,L.useEffect)(()=>{document.title=e+` - FMS Insight`},[qI(),e])}function Fie(e){switch(e.route){case`/station/loadunload/:num`:case`/station/inspection`:case`/station/inspection/:type`:case`/station/closeout`:case`/station/queues`:case`/station/overview`:return`https://www.seedtactics.com/docs/fms-insight/client-station-monitor`;case`/operations`:case`/operations/load-outliers`:case`/operations/load-hours`:case`/operations/load-cycles`:case`/operations/system-overview`:case`/operations/material`:case`/operations/recent-schedules`:case`/operations/current-workorders`:case`/operations/closeout`:case`/operations/recent-production`:case`/analysis/rebookings`:case`/operations/parts`:return`https://www.seedtactics.com/docs/fms-insight/client-operations`;case`/operations/machine-outliers`:case`/operations/machine-hours`:case`/operations/machine-cycles`:return`https://www.seedtactics.com/docs/fms-insight/client-engineering`;case`/operations/quality`:case`/operations/inspections`:return`https://www.seedtactics.com/docs/fms-insight/client-quality`;case`/operations/tools`:case`/operations/programs`:return`https://www.seedtactics.com/docs/fms-insight/client-tools-programs`;case`/engineering`:case`/engineering/outliers`:case`/engineering/hours`:return`https://www.seedtactics.com/docs/fms-insight/client-engineering`;case`/quality`:case`/quality/paths`:case`/quality/quarantine`:return`https://www.seedtactics.com/docs/fms-insight/client-quality`;case`/tools`:case`/tools/programs`:return`https://www.seedtactics.com/docs/fms-insight/client-tools-programs`;case`/analysis/schedules`:case`/analysis/buffers`:case`/analysis/station-oee`:case`/analysis/parts-completed`:case`/analysis/machine-cycles`:case`/analysis/load-cycles`:case`/analysis/pallet-cycles`:case`/analysis/quality`:case`/analysis/cost-percents`:case`/analysis/tool-replacements`:case`/analysis/cost`:return`https://www.seedtactics.com/docs/fms-insight/client-efficiency`;case`/sales`:case`/sales/projected-usage`:return`https://www.seedtactics.com/docs/fms-insight/client-sales`;default:return`https://www.seedtactics.com/docs/fms-insight/client-launch`}}var YI=new Intl.NumberFormat(void 0,{style:`percent`,minimumFractionDigits:1});function Iie(){let e=new Date;return t=>{if(!t.simulatedProduction)return 0;let n=0;for(let r of t.simulatedProduction){if(r.timeUTC>e)break;n=r.quantity}return n}}var XI=(0,L.memo)(function(){let e=R(NO),t=Q.ofObject(e.jobs).sumBy(([,e])=>Q.of(e.completed??[]).sumBy(e=>Q.of(e).sumBy(e=>e))),n=Q.ofObject(e.jobs).flatMap(([,e])=>e.procsAndPaths).flatMap(e=>e.paths).sumBy(Iie()),r=Q.ofObject(e.jobs).sumBy(([,e])=>(e.cycles??0)*e.procsAndPaths.length);return(0,H.jsx)(J,{sx:{maxWidth:`60em`,ml:`auto`,mr:`auto`,pt:`1em`},children:(0,H.jsxs)(J,{sx:{display:`grid`,gridTemplateColumns:`auto 1fr auto`,gridColumnGap:`0.5em`,alignItems:`center`},children:[(0,H.jsx)(J,{sx:{gridRow:1,gridColumn:1},children:(0,H.jsxs)(q,{variant:`body2`,children:[`Completed Parts: `,t,`/`,r]})}),(0,H.jsx)(J,{sx:{gridRow:1,gridColumn:2},children:(0,H.jsx)(tb,{variant:`determinate`,value:t/r*100,color:`secondary`})}),(0,H.jsx)(J,{sx:{gridRow:1,gridColumn:3},children:(0,H.jsx)(q,{variant:`body2`,children:YI.format(t/r)})}),(0,H.jsx)(J,{sx:{gridRow:2,gridColumn:1},children:(0,H.jsxs)(q,{variant:`body2`,children:[`Simulated Parts: `,n,`/`,r]})}),(0,H.jsx)(J,{sx:{gridRow:2,gridColumn:2},children:(0,H.jsx)(tb,{variant:`determinate`,value:n/r*100,color:`secondary`})}),(0,H.jsx)(J,{sx:{gridRow:2,gridColumn:3},children:(0,H.jsx)(q,{variant:`body2`,children:YI.format(n/r)})})]})})});function Lie(){let{ref:e,width:t,height:n}=pA({refreshMode:`debounce`,refreshRate:100});return(0,H.jsxs)(`main`,{style:{height:`calc(100vh - 64px)`,display:`flex`,flexDirection:`column`},children:[(0,H.jsx)(`div`,{children:(0,H.jsx)(XI,{})}),(0,H.jsx)(`div`,{ref:e,style:{flexGrow:1,overflow:`hidden`,margin:`8px`},children:t&&n&&(0,H.jsx)(xF,{width:t,height:n})})]})}function Rie(){let{ref:e,width:t}=pA({refreshMode:`debounce`,refreshRate:100,handleHeight:!1});return(0,H.jsxs)(`main`,{style:{padding:`8px`},children:[(0,H.jsx)(XI,{}),(0,H.jsx)(`div`,{ref:e,style:{overflow:`hidden`},children:t&&(0,H.jsx)(xF,{width:t,height:500})})]})}function zie(){return JI(`Dashboard`),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(J,{sx:{display:{xs:`none`,md:`block`}},children:(0,H.jsx)(Lie,{})}),(0,H.jsx)(J,{sx:{display:{xs:`block`,md:`none`}},children:(0,H.jsx)(Rie,{})})]})}var ZI=P([]),QI=ZI,$I=P([]),Bie=$I;function*eL(e){for(let t of e)for(let e=0;e<t.procsAndPaths.length;e++){let n=t.procsAndPaths[e];for(let r=0;r<n.paths.length;r++){let i=n.paths[r],a=0;for(let e of i.stops)a+=BO(e.expectedCycleTime);let o=0;for(let n of i.simulatedProduction||[])yield{partName:t.partName,process:e+1,finalProcess:e===t.procsAndPaths.length-1,completeTime:n.timeUTC,quantity:n.quantity-o,expectedMachineMins:a},o=n.quantity}}}var Vie=P(null,(e,t,n)=>{t(ZI,e=>[...e,...eL(Object.values(n.jobs))])}),Hie=P(null,(e,t,{evt:n,now:r,expire:i})=>{if(n.newJobs){let e=n.newJobs.jobs;t(ZI,t=>{if(i){let n=LT(r,-30),i=Q.of(t).minBy(e=>e.completeTime.getTime());if((i===void 0||i.completeTime>=n)&&e.length===0)return t;t=t.filter(e=>e.completeTime>=n)}return[...t,...eL(e)]})}}),Uie=P(null,(e,t,n)=>{t($I,Array.from(eL(Object.values(n.jobs))))}),tL=P(iO.empty()),Wie=tL,nL=P(iO.empty()),Gie=nL;function rL(e){if(e.elapsed===``)return null;let t=zO(e.elapsed);if(t<=0)return null;switch(e.type){case V.RemoveFromQueue:return[e.counter,{buffer:{type:`Queue`,queue:e.loc},endTime:e.endUTC,elapsedSeconds:t,numMaterial:e.material.length}];case V.PalletInStocker:return!e.startofcycle&&e.result===`WaitForMachine`?[e.counter,{buffer:{type:`StockerWaitForMC`,stockerNum:e.locnum},endTime:e.endUTC,elapsedSeconds:t,numMaterial:e.material.length}]:e.startofcycle?null:[e.counter,{buffer:{type:`StockerWaitForUnload`,stockerNum:e.locnum},endTime:e.endUTC,elapsedSeconds:t,numMaterial:e.material.length}];case V.PalletOnRotaryInbound:return e.startofcycle?null:[e.counter,{buffer:{type:`Rotary`,machineGroup:e.loc,machineNum:e.locnum},endTime:e.endUTC,elapsedSeconds:t,numMaterial:e.material.length}];default:return null}}var Kie=P(null,(e,t,n)=>{t(tL,e=>e.union(Q.of(n).collect(rL).toHashMap(e=>e)))}),qie=P(null,(e,t,{evt:n,now:r,expire:i})=>{if(!n.logEntry)return;let a=rL(n.logEntry);a&&t(tL,e=>{if(i){let t=LT(r,-30);e=e.filter(e=>e.endTime>=t)}return e.set(a[0],a[1])})}),Jie=P(null,(e,t,n)=>{t(nL,Q.of(n).collect(rL).toHashMap(e=>e))}),Yie=P(null),iL=P(null,(e,t,n)=>{t(Yie,n)}),aL=function(e){return e[e.Triggered=0]=`Triggered`,e[e.Forced=1]=`Forced`,e[e.Completed=2]=`Completed`,e}({}),oL=class{constructor(e,t){this.part=e,this.inspType=t}compare(e){let t=this.part.localeCompare(e.part);return t===0?this.inspType.localeCompare(e.inspType):t}hash(){return yD(this.part,this.inspType)}toString(){return`{part: ${this.part}}, inspType: ${this.inspType}}`}},sL=P(iO.empty()),cL=sL,lL=P(iO.empty()),Xie=lL;function uL(e){return e.type!==V.Inspection&&e.type!==V.InspectionForce&&e.type!==V.InspectionResult?[]:e.material.map(t=>{if(e.type===V.Inspection){let n=JSON.parse((e.details||{}).ActualPath||`[]`),r=Array.isArray(n)?n:[],i=[];for(let e of r)i.push(Ne.fromJS(e));let a=(e.details||{}).InspectionType||``,o;return o=e.result.toLowerCase()===`true`||e.result===`1`,{key:new oL(t.part,a),entry:{cntr:e.counter,time:e.endUTC,materialID:t.id,serial:t.serial,workorder:t.workorder,result:{type:0,actualPath:i,toInspect:o},part:t.part,inspType:a}}}else if(e.type===V.InspectionForce){let n;return n=e.result.toLowerCase()===`true`||e.result===`1`,{key:new oL(t.part,e.program),entry:{cntr:e.counter,time:e.endUTC,materialID:t.id,serial:t.serial,workorder:t.workorder,result:{type:1,toInspect:n},part:t.part,inspType:e.program}}}else{let n;return n=e.result.toLowerCase()===`true`||e.result===`1`,{key:new oL(t.part,e.program),entry:{cntr:e.counter,time:e.endUTC,materialID:t.id,serial:t.serial,workorder:t.workorder,result:{type:2,success:n},part:t.part,inspType:e.program}}}})}var Zie=P(null,(e,t,n)=>{t(sL,e=>e.union(Q.of(n).flatMap(uL).toLookupMap(e=>e.key,e=>e.entry.cntr,e=>e.entry),(e,t)=>e.union(t)))}),Qie=P(null,(e,t,{evt:n,now:r,expire:i})=>{if(n.logEntry){let e=uL(n.logEntry);if(e.length===0)return;t(sL,t=>{if(i){let e=LT(r,-30);t=t.collectValues(t=>{let n=t.filter(t=>t.time>=e);return n.size===0?null:n})}return t.union(Q.of(e).toLookupMap(e=>e.key,e=>e.entry.cntr,e=>e.entry),(e,t)=>e.union(t))})}else if(n.editMaterialInLog){let e=n.editMaterialInLog.editedEvents;t(sL,t=>t.collectValues(t=>{for(let n of e){let e=n?.material[0],r=t.get(n.counter);if(r!==void 0&&e){let i={...r,materialID:e.id,serial:e.serial,workorder:e.workorder};t=t.set(n.counter,i)}}return t}))}}),$ie=P(null,(e,t,n)=>{t(lL,Q.of(n).flatMap(uL).toLookupMap(e=>e.key,e=>e.entry.cntr,e=>e.entry))}),dL=P({matsById:iO.empty(),matIdsForJob:iO.empty()}),fL=dL,pL=P({matsById:iO.empty(),matIdsForJob:iO.empty()}),mL=pL;function hL(e){return{materialID:e.materialID,jobUnique:e.jobUnique,partName:e.partName,startedProcess1:e.process>0,serial:e.serial,workorderId:e.workorderId,signaledInspections:e.signaledInspections,quarantineAfterUnload:e.quarantineAfterUnload}}function gL(e,t){let n=e.matsById,r=e.matIdsForJob;if(t.startofcycle||t.material.length===0)return e;for(let e of t.material){if(e.uniq&&e.uniq!==``){let t=r.get(e.uniq);t===void 0?r=r.set(e.uniq,YD.empty().add(e.id)):t.has(e.id)||(r=r.set(e.uniq,t.add(e.id)))}let i=n.get(e.id),a;switch(a=i===void 0?{materialID:e.id,jobUnique:e.uniq,partName:e.part,last_event:t.endUTC,startedProcess1:!1,numProcesses:e.numproc,unloaded_processes:{},signaledInspections:[],quarantineAfterUnload:null,completedInspections:{}}:{...i,last_event:t.endUTC},t.type){case V.PartMark:a={...a,serial:t.result};break;case V.OrderAssignment:a={...a,workorderId:t.result};break;case V.Inspection:if(t.result.toLowerCase()===`true`||t.result===`1`){let e=(t.details||{}).InspectionType;e&&(a={...a,signaledInspections:[...a.signaledInspections,e]})}break;case V.InspectionForce:if(t.result.toLowerCase()===`true`||t.result===`1`){let e=t.program;a={...a,signaledInspections:[...a.signaledInspections,e]}}break;case V.InspectionResult:{let e=t.result.toLowerCase()==`true`||t.result===`1`;a={...a,completedInspections:{...a.completedInspections,[t.program]:{time:t.endUTC,success:e}},completed_inspect_time:t.endUTC};break}case V.LoadUnloadCycle:t.result===`UNLOAD`?(a={...a,unloaded_processes:{...a.unloaded_processes,[e.proc]:t.endUTC},quarantineAfterUnload:!1,currently_quarantined:!1},a=e.proc===e.numproc?{...a,last_unload_time:t.endUTC,completed_last_proc_machining:!0}:{...a,last_unload_time:t.endUTC}):t.result===`LOAD`&&(a={...a,startedProcess1:!0,quarantineAfterUnload:!1,currently_quarantined:!1});break;case V.MachineCycle:a.currently_quarantined&&(a={...a,currently_quarantined:!1});break;case V.AddToQueue:t.program===`Quarantine`&&(a={...a,currently_quarantined:!0});break;case V.CloseOut:a={...a,closeout_completed:t.endUTC,closeout_failed:t.result===`Failed`};break;case V.SignalQuarantine:a={...a,quarantineAfterUnload:!0}}n=n.set(e.id,a)}return{matsById:n,matIdsForJob:r}}function _L(e,{matIdsForJob:t,matsById:n}){let r=n.valuesToLazySeq().filter(t=>t.last_event<e).toRSet(e=>e.materialID);return r.size>0&&(t=t.collectValues(e=>{let t=Q.of(r).fold(e,(e,t)=>e.delete(t));return t.size>0?t:null})),n=n.filter(t=>t.last_event>=e),{matIdsForJob:t,matsById:n}}function vL(e,t){let n=t.matIdsForJob,r=t.matsById.get(e.oldMaterialID)??null,i=t.matsById.get(e.newMaterialID)??null;if(r===null)return t;let a=r,o;if(o=i===null?{materialID:e.newMaterialID,jobUnique:a.jobUnique,partName:a.partName,last_event:a.last_event,numProcesses:a.numProcesses,startedProcess1:!0,unloaded_processes:{},signaledInspections:[],quarantineAfterUnload:null,completedInspections:{}}:i,a.jobUnique&&a.jobUnique!==``&&(!o.jobUnique||o.jobUnique===``)){let e=n.get(a.jobUnique);e!==void 0&&(n=n.set(a.jobUnique,e.delete(a.materialID).add(o.materialID))),o={...o,jobUnique:a.jobUnique},a={...a,jobUnique:``}}let s=a.unloaded_processes;a={...a,unloaded_processes:o.unloaded_processes},o={...o,unloaded_processes:s};for(let t of e.editedEvents){let n=t.material.find(t=>t.id===e.newMaterialID);switch(n&&(o={...o,serial:n.serial??o.serial,workorderId:n.workorder??o.workorderId}),t.type){case V.Inspection:case V.InspectionForce:{let e=t.program,n;n=t.result.toLowerCase()===`true`||t.result===`1`,n&&(a={...a,signaledInspections:Q.of(a.signaledInspections).filter(t=>t!==e).toRArray()},o={...o,signaledInspections:Q.of([...o.signaledInspections,e]).distinct().toSortedArray(e=>e)})}}}return{matsById:t.matsById.set(a.materialID,a).set(o.materialID,o),matIdsForJob:n}}var yL=P(null,(e,t,n)=>{t(dL,e=>n.reduce(gL,e))}),bL=P(null,(e,t,{evt:n,now:r,expire:i})=>{if(n.logEntry){let e=n.logEntry;t(dL,t=>{let n=gL(t,e);return n===t||!i?t:_L(LT(r,-30),n)})}else if(n.editMaterialInLog){let e=n.editMaterialInLog;t(dL,t=>vL(e,t))}}),xL=P(null,(e,t,n)=>{t(pL,n.reduce(gL,{matsById:iO.empty(),matIdsForJob:iO.empty()}))}),SL=P(new Set),CL=SL,wL=P(new Set),TL=wL,EL=P(new Set),DL=EL,OL=P(new Set),kL=OL,AL=P(null,(e,t,{evt:n})=>{n.newJobs?PL(t,n.newJobs.jobs):n.logEntry?IL(t,[n.logEntry]):n.newCurrentStatus&&FL(e,t,n.newCurrentStatus)}),jL=P(null,(e,t,n)=>{PL(t,Object.values(n.jobs))}),ML=P(null,(e,t,n)=>IL(t,n)),NL=P(null,FL);function PL(e,t){e(EL,e=>{let n=new Set;for(let r of t)for(let t of r.procsAndPaths[0].paths)t.casting&&t.casting!==``&&!e.has(t.casting)&&n.add(t.casting);return n.size===0?e:new Set([...e,...n])})}function FL(e,t,n){PL(t,Object.values(n.jobs));let r=e(SL),i=e(wL),a=new Set,o=new Set;for(let[e,t]of Q.ofObject(n.queues))t.role===lt.RawMaterial?r.has(e)||a.add(e):t.role===lt.InProcessTransfer&&(i.has(e)||o.add(e));a.size>0&&t(SL,new Set([...r,...a])),o.size>0&&t(wL,new Set([...i,...o]))}function IL(e,t){e(OL,e=>{let n=new Set;for(let r of t)switch(r.type){case V.Inspection:{let t=(r.details||{}).InspectionType;t&&!e.has(t)&&n.add(t)}break;case V.InspectionForce:case V.InspectionResult:{let t=r.program;e.has(t)||n.add(t)}break}return n.size===0?e:new Set([...e,...n])})}var LL=P(iO.empty()),RL=LL;function zL(e,t,n){if(e.tooluse===void 0||e.tooluse.length===0||e.type!==V.MachineCycle)return n;let r=e.material.length>0?t.get(VO.ofLogCycle(e)):void 0,i=BO(e.elapsed);if(r===void 0||KO(r,i))return n;let a=VO.ofLogCycle(e),o=Q.of(e.tooluse).groupBy(e=>e.tool).map(([e,t])=>({toolName:e,cycleUsageMinutes:Q.of(t).sumBy(e=>e.toolUseDuringCycle&&e.toolUseDuringCycle!==``?BO(e.toolUseDuringCycle):0),cycleUsageCnt:Q.of(t).sumBy(e=>e.toolUseCountDuringCycle??0),toolChangedDuringMiddleOfCycle:Q.of(t).some(e=>e.toolChangeOccurred??!1)})).toRArray();return o.length===0&&n.has(a)?n:n.modify(a,t=>{if(t){let n=t.recentCycles.slice(-4);return n.push({tools:o}),{machines:t.machines.add(rk(e.loc,e.locnum)),recentCycles:n}}else return{machines:QD.empty().add(rk(e.loc,e.locnum)),recentCycles:[{tools:o}]}})}var BL=P(null,(e,t,n)=>{let r=e(UO);t(LL,e=>n.reduce((e,t)=>zL(t,r,e),e))}),VL=P(null,(e,t,{evt:n})=>{if(n.logEntry){let r=n.logEntry,i=e(UO);t(LL,e=>zL(r,i,e))}}),HL=P(iO.empty()),UL=HL,WL=P(iO.empty()),GL=WL;function KL(e){return{cntr:e.counter,x:e.endUTC,y:BO(e.elapsed),active:BO(e.active),mats:e.material}}var qL=P(null,(e,t,n)=>{t(HL,e=>e.union(Q.of(n).filter(e=>!e.startofcycle&&e.type===V.PalletCycle&&e.pal!==0).toLookupMap(e=>e.pal,e=>e.counter,KL),(e,t)=>e.union(t)))}),JL=P(null,(e,t,{evt:n,now:r,expire:i})=>{if(n.logEntry&&!n.logEntry.startofcycle&&n.logEntry.type===V.PalletCycle&&n.logEntry.pal!==0){let e=n.logEntry;t(HL,t=>{if(i){let e=LT(r,-30);t=t.collectValues(t=>{let n=t.filter(t=>t.x>=e);return n.size>0?n:null})}return t.modify(e.pal,t=>(t??iO.empty()).set(e.counter,KL(e)))})}}),YL=P(null,(e,t,n)=>{t(WL,Q.of(n).filter(e=>!e.startofcycle&&e.type===V.PalletCycle&&e.pal!==0).toLookupMap(e=>e.pal,e=>e.counter,KL))}),XL=P(iO.empty()),ZL=XL,QL=P(e=>e(XL).size>0),$L=P(iO.empty()),eR=$L,tR=P(e=>e($L).size>0);function nR(e){return{cntr:e.counter,x:e.endUTC,y:BO(e.elapsed),active:BO(e.active),mats:e.material}}var rR=P(null,(e,t,n)=>{t(XL,e=>e.union(Q.of(n).filter(e=>!e.startofcycle&&e.type===V.BasketCycle&&e.pal!==0).toLookupMap(e=>e.pal,e=>e.counter,nR),(e,t)=>e.union(t)))}),iR=P(null,(e,t,{evt:n,now:r,expire:i})=>{if(n.logEntry&&!n.logEntry.startofcycle&&n.logEntry.type===V.BasketCycle&&n.logEntry.pal!==0){let e=n.logEntry;t(XL,t=>{if(i){let e=LT(r,-30);t=t.collectValues(t=>{let n=t.filter(t=>t.x>=e);return n.size>0?n:null})}return t.modify(e.pal,t=>(t??iO.empty()).set(e.counter,nR(e)))})}}),aR=P(null,(e,t,n)=>{t($L,Q.of(n).filter(e=>!e.startofcycle&&e.type===V.BasketCycle&&e.pal!==0).toLookupMap(e=>e.pal,e=>e.counter,nR))}),oR=class e{constructor(e,t){this.group=e,this.num=t}static ofLogCycle(t){return new e(t.loc,t.locnum)}hash(){return yD(this.group,this.num)}compare(e){return this.group===e.group?this.num-e.num:this.group.localeCompare(e.group)}toString(){return this.group+` #`+this.num.toString()}},sR={replacements:eO.empty(),recentUse:iO.empty()},cR=P(sR),lR=P(e=>e(cR).replacements),uR=P(sR),dR=P(e=>e(uR).replacements);function fR(e,t){let n=oR.ofLogCycle(t);return{replacements:e.replacements.alter(n,r=>{let i=[];for(let r of t.tooluse??[]){let t=r.toolUseDuringCycle!==null&&r.toolUseDuringCycle!==void 0?BO(r.toolUseDuringCycle):null,a=r.totalToolUseAtEndOfCycle!==null&&r.totalToolUseAtEndOfCycle!==void 0?BO(r.totalToolUseAtEndOfCycle):null,o=r.toolUseCountDuringCycle??null,s=r.totalToolUseCountAtEndOfCycle??null;if((t||o)&&t===a&&o===s){let t=e.recentUse.get(n)?.find(e=>e.tool===r.tool&&e.pocket===r.pocket);if(t){let e=t.totalToolUseAtEndOfCycle?BO(t.totalToolUseAtEndOfCycle):null;(e||t.totalToolUseCountAtEndOfCycle)&&i.push({tool:r.tool,pocket:r.pocket,type:`ReplaceBeforeCycleStart`,useAtReplacement:e,cntAtReplacement:t.totalToolUseCountAtEndOfCycle??null})}}else if(r.toolChangeOccurred&&(t&&r.configuredToolLife||o&&r.configuredToolLifeCount)){let e=r.configuredToolLife!==null&&r.configuredToolLife!==void 0?BO(r.configuredToolLife):null,n=r.configuredToolLifeCount??null;i.push({tool:r.tool,pocket:r.pocket,type:`ReplaceInCycle`,totalUseAtBeginningOfCycle:e!==null&&t!==null?e-t+(a??0):null,totalUseAtEndOfCycle:a,totalCntAtBeginningOfCycle:n!==null&&o!==null?n-o+(s??0):null,totalCntAtEndOfCycle:s})}}return i.length>0?(r??eO.empty()).set(t.counter,{time:t.endUTC,replacements:i}):r}),recentUse:t.tooluse?e.recentUse.set(n,t.tooluse):e.recentUse}}var pR=P(null,(e,t,n)=>{t(cR,e=>Q.of(n).filter(e=>e.type===V.MachineCycle&&!e.startofcycle&&!!e.tooluse&&e.tooluse.length>0).fold(e,fR))}),mR=P(null,(e,t,{evt:n,now:r,expire:i})=>{if(n.logEntry&&!n.logEntry.startofcycle&&n.logEntry.type===V.MachineCycle&&n.logEntry.tooluse&&n.logEntry.tooluse.length>0){let e=n.logEntry;t(cR,t=>{if(i){let e=LT(r,-30);t={replacements:t.replacements.collectValues(t=>{let n=t.filter(t=>t.time>=e);return n.size>0?n:null}),recentUse:t.recentUse}}return fR(t,e)})}}),hR=P(null,(e,t,n)=>{t(uR,Q.of(n).filter(e=>e.type===V.MachineCycle&&!e.startofcycle&&!!e.tooluse&&e.tooluse.length>0).fold(sR,fR))}),gR=P(null),_R=gR;function vR(e,t,n,r){let i=e(_R);(i===null||i.simId<n)&&t(gR,{simId:n,usage:r})}var yR=P(null,(e,t,n)=>{!n.mostRecentSimulationId||!n.mostRecentSimDayUsage||n.mostRecentSimDayUsage.length===0||vR(e,t,n.mostRecentSimulationId,n.mostRecentSimDayUsage)}),bR=P(null,(e,t,{evt:n})=>{n.newJobs&&n.newJobs.simDayUsage&&n.newJobs.simDayUsage.length>0&&vR(e,t,n.newJobs.scheduleId,n.newJobs.simDayUsage)}),xR=P(eO.empty()),SR=OO(P(async(e,{signal:t})=>{if(Ut===void 0)return eO.empty();let n=await Ut.unscheduledRebookings(t);return eO.build(n,e=>e.bookingId)}),e=>e??eO.empty()),CR=P(e=>{let t=e(xR),n=e(SR);return t.union(n,(e,t)=>e??t)}),wR=P(eO.empty()),TR=wR,ER=P(eO.empty()),DR=ER;function OR(e){let t=1;return e.details?.Quantity&&(t=parseInt(e.details.Quantity,10)),{bookingId:e.result,partName:e.program,quantity:t,timeUTC:e.endUTC,priority:e.locnum,notes:e.details?.Notes,workorder:e.details?.Workorder??e.material?.[0]?.workorder}}var kR=P(null,(e,t,n)=>{t(xR,e=>e.union(Q.of(n).filter(e=>e.type===V.Rebooking).toOrderedMap(e=>[e.result,OR(e)]))),t(wR,e=>e.union(Q.of(n).filter(e=>e.type===V.CancelRebooking).toOrderedMap(e=>[e.result,e.endUTC])))});function AR(e,t,n){e(ER,e=>(n&&(e=e.filter(e=>e.scheduledTime>=n)),e.union(t.flatMap(e=>(e.bookings??[]).map(t=>[t,{scheduledTime:e.routeStartUTC,jobUnique:e.unique}])).toOrderedMap(e=>e))))}var jR=P(null,(e,t,n)=>{AR(t,Q.ofObject(n.jobs).map(([,e])=>e))}),MR=P(null,(e,t,{evt:n,now:r,expire:i})=>{if(n.newJobs)AR(t,Q.of(n.newJobs.jobs),i?LT(r,-30):void 0);else if(n.logEntry){let e=n.logEntry;e.type===V.Rebooking?t(xR,t=>t.set(e.result,OR(e))):e.type===V.CancelRebooking&&t(wR,t=>t.set(e.result,e.endUTC))}});function NR(){let[e,t]=(0,L.useState)(!1);return[(0,L.useCallback)(e=>(t(!0),Wt.cancelRebooking(e).then(()=>{}).catch(console.log).finally(()=>t(!1))),[]),e]}function PR(){let[e,t]=(0,L.useState)(!1);return[(0,L.useCallback)(e=>(t(!0),Wt.requestRebooking(e.part,e.qty&&!isNaN(e.qty)?e.qty:1,e.workorder,e.priority!==void 0&&e.priority!==null&&!isNaN(e.priority)?e.priority:void 0,e.notes).then(()=>{}).catch(console.log).finally(()=>t(!1))),[]),e]}var FR=P(null),IR=FR,LR=P(null,(e,t,n)=>{if(n.evt.newCurrentStatus&&t(iL,n.evt.newCurrentStatus.customState??null),t(Hie,n),t(tA,n),t(mO,n),t(qie,n),t(Rre,n),t(bL,n),t(Qie,n),t(AL,n),t(VL,n),t(JL,n),t(iR,n),t(mR,n),t(Zre,n),t(MR,n),t(bR,n),n.evt.logEntry){let e=n.evt.logEntry.counter;t(FR,t=>t===null?t:Math.max(t,e))}}),RR=P(null,(e,t,n)=>{let r=fO(e(lO),n);t(eA,r),t(Vie,r),t(pO,r),t(jL,r),t(yR,r),t(jR,r)}),zR=P(null,(e,t,n)=>{t(Ure,n),t(Kie,n),t(Zie,n),t(yL,n),t(ML,n),t(BL,n),t(qL,n),t(rR,n),t(pR,n),t(Xre,n),t(kR,n);let r=Q.of(n).maxBy(e=>e.counter)?.counter??null;t(FR,e=>e===null?r:Math.max(e,r??-1))}),BR=P(null,(e,t,n)=>{t(LO,n),t(iL,n.customState??null),t(NL,n)}),VR=P(null,(e,t,n)=>{t(nA,n),t(Uie,n),t(hO,n)}),HR=P(null,(e,t,n)=>{t(Wre,n),t(Jie,n),t($ie,n),t(xL,n),t(YL,n),t(aR,n),t(hR,n),t(Qre,n)}),UR=P(`Last30`),WR=P(oE(new Date)),GR=P(e=>e(WR),(e,t,n)=>{t(UR,`SpecificMonth`),t(WR,n),e(qR)!==n&&!e(JR)&&QR(n,t)}),KR=P(e=>e(UR)===`Last30`?{type:`Last30`}:{type:`SpecificMonth`,month:e(WR)}),qR=P(null),JR=P(!1),YR=JR,XR=P(null),ZR=XR;function QR(e,t){t(JR,!0),t(XR,null);let n=RT(e,1),r=Ut.history(e,n).then(e=>t(VR,e)),i=Wt.get(e,n).then(e=>t(HR,e));Promise.all([r,i]).then(()=>t(qR,e)).catch(e=>t(XR,e.message??`Error`)).finally(()=>t(JR,!1))}function $R(){let e=z(UR);return()=>e(`Last30`)}function ez(){return z(WR)}function tz(e){return Gre(e)&&e.operation===`UNLOAD`}function nz(e){return Object.prototype.hasOwnProperty.call(e,`month`)}function rz(e,t,n,r){let i=nz(r)?r.month:r.thirtyDaysAgo,a=nz(r)?RT(r.month,1):LT(r.thirtyDaysAgo,31),o=0,s=new Map,c=0,l=new Map,u=e.filter(e=>e.endTime>=i&&e.endTime<=a&&!e.material.some(e=>t.has(e.part)));for(let e of u)if(tz(e)&&(o+=1),$O(e))c+=e.activeMinutes;else if(ek(e)){s.set(e.stationGroup,e.activeMinutes+(s.get(e.stationGroup)??0));let t=l.get(e.stationGroup);t?t.add(e.stationNumber):l.set(e.stationGroup,new Set([e.stationNumber]))}let d=Q.of(n).filter(([,e])=>{if(t.has(e.partName)||e.numProcesses===void 0)return!1;let n=e.unloaded_processes?.[e.numProcesses];return!!n&&n>=i&&n<=a}).toRMap(([,e])=>[e.partName,1],(e,t)=>e+t);return{parts:u.groupBy(e=>e.part).map(([e,t])=>({part:e,parts_completed:d.get(e)??0,machine:Q.of(t).filter(e=>ek(e)).buildOrderedMap(e=>e.stationGroup,(e,t)=>(e??0)+t.activeMinutes).mapValues((e,t)=>e/(s.get(t)??1)),labor:Q.of(t).filter(e=>$O(e)).sumBy(e=>e.activeMinutes/c),automation:o>0?t.reduce((e,t)=>tz(t)?e+1:e,0)/o:0})).toRArray(),machineQuantities:Q.of(l).toOrderedMap(([e,t])=>[e,t.size]),type:r}}function iz(e,t,n,r){let i=nz(e.type)?sE(e.type.month):30,a=n?n*i/365:0,o=e.machineQuantities.mapValues((e,n)=>(t[n]??0)*e*i/365);return{machineQuantities:e.machineQuantities,type:e.type,parts:e.parts.map(e=>({part:e.part,parts_completed:e.parts_completed,machine:e.machine.mapValues((t,n)=>e.parts_completed>0?t*(o.get(n)??0)/e.parts_completed:0),labor:e.parts_completed>0?e.labor*r/e.parts_completed:0,automation:e.parts_completed>0?e.automation*a/e.parts_completed:0}))}}function az(e){let t=`<table>
|
|
259
|
+
</table>`,t}function Jk(e){Ak(qk(e)).catch(console.error)}var Yk=P([]),Xk=Yk,Zk=P([]),Qk=Zk;function $k(e,t){return e.map(e=>({station:e.stationGroup+` #`+e.stationNum.toString(),stationLabel:ak(e.stationGroup,e.stationNum,t),start:e.startUTC,end:e.endUTC,plannedDown:e.planDown??!1,parts:e.parts?.map(e=>({uniq:e.jobUnique,proc:e.process,path:e.path}))}))}var eA=P(null,(e,t,n)=>{let r=e(br)?.loadStationNames;t(Yk,e=>e.concat($k(n.stationUse,r)))}),tA=P(null,(e,t,{evt:n,now:r,expire:i})=>{if(n.newJobs?.stationUse){let a=n.newJobs?.stationUse,o=e(br)?.loadStationNames;t(Yk,e=>{if(i){let t=LT(r,-30),n=Q.of(e).minBy(e=>e.end.getTime());if((n===void 0||n.start>=t)&&a.length===0)return e;e=e.filter(e=>e.start>=t)}return e.concat($k(a,o))})}}),nA=P(null,(e,t,n)=>{let r=e(br)?.loadStationNames;t(Zk,$k(n.stationUse,r))});function rA(e){let{target:t}=e;if(!(t instanceof SVGElement))return null;let n=t instanceof SVGSVGElement?t:t.ownerSVGElement;if(!n)return null;let r=n.getScreenCTM();if(!r)return null;let i=n.createSVGPoint();return`changedTouches`in e?(i.x=e.changedTouches[0].clientX,i.y=e.changedTouches[0].clientY):(i.x=e.clientX,i.y=e.clientY),i.matrixTransform(r.inverse())}var iA=`__bms_measure_text_element`;function aA(e,t){try{let n=document.getElementById(iA),r;if(n instanceof SVGTextElement)r=n;else{let e=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);e.setAttribute(`aria-hidden`,`true`),e.style.position=`absolute`,e.style.top=`-100%`,e.style.left=`-100%`,e.style.width=`0`,e.style.height=`0`,e.style.opacity=`0`;let n=document.createElementNS(`http://www.w3.org/2000/svg`,`text`);if(!(n instanceof SVGTextElement))return null;r=n,r.setAttribute(`id`,iA),t&&(r.style.fontSize=t.toString()),e.appendChild(r),document.body.appendChild(e)}return r.textContent=e,r.getComputedTextLength()}catch{return null}}function oA(e,t,{signal:n,edges:r}={}){let i,a=null,o=r!=null&&r.includes(`leading`),s=r==null||r.includes(`trailing`),c=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},l=()=>{s&&c(),p()},u=null,d=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,l()},t)},f=()=>{u!==null&&(clearTimeout(u),u=null)},p=()=>{f(),i=void 0,a=null},m=()=>{c()},h=function(...e){if(n?.aborted)return;i=this,a=e;let t=u==null;d(),o&&t&&c()};return h.schedule=d,h.cancel=p,h.flush=m,n?.addEventListener(`abort`,p,{once:!0}),h}function sA(e,t=0,n={}){typeof n!=`object`&&(n={});let{leading:r=!1,trailing:i=!0,maxWait:a}=n,o=[,,];r&&(o[0]=`leading`),i&&(o[1]=`trailing`);let s,c=null,l=oA(function(...t){s=e.apply(this,t),c=null},t,{edges:o}),u=function(...t){return a!=null&&(c===null&&(c=Date.now()),Date.now()-c>=a)?(s=e.apply(this,t),c=Date.now(),l.cancel(),l.schedule(),s):(l.apply(this,t),s)};return u.cancel=l.cancel,u.flush=()=>(l.flush(),s),u}function cA(e,t=0,n={}){let{leading:r=!0,trailing:i=!0}=n;return sA(e,t,{leading:r,maxWait:t,trailing:i})}var lA=(e,t,n,r)=>{switch(t){case`debounce`:return sA(e,n,r);case`throttle`:return cA(e,n,r);default:return e}},uA=e=>{let t=L.useRef(e);return L.useEffect(()=>{t.current=e}),L.useMemo(()=>((...e)=>t.current?.call(t,...e)),[])},dA=e=>{let[t,n]=L.useState(e?.current||null);return e&&setTimeout(()=>{e.current!==t&&n(e.current)},0),{refProxy:L.useMemo(()=>new Proxy(e=>{e!==t&&n(e)},{get(e,n){return n===`current`?t:e[n]},set(e,t,r){return t===`current`?n(r):e[t]=r,!0}}),[t]),refElement:t,setRefElement:n}},fA=(e,t)=>{let n=e.borderBoxSize?.[0],r=e.contentBoxSize?.[0];return t===`border-box`&&n?{width:n.inlineSize,height:n.blockSize}:t===`content-box`&&r?{width:r.inlineSize,height:r.blockSize}:{width:e.contentRect.width,height:e.contentRect.height}};function pA({skipOnMount:e=!1,refreshMode:t,refreshRate:n=1e3,refreshOptions:r,handleWidth:i=!0,handleHeight:a=!0,targetRef:o,observerOptions:s,onResize:c,disableRerender:l=!1}={}){let u=(0,L.useRef)(e),d=uA(c),[f,p]=(0,L.useState)({width:void 0,height:void 0}),m=(0,L.useRef)({width:void 0,height:void 0}),{refProxy:h,refElement:g}=dA(o),{box:_}=s||{},v=(0,L.useCallback)(e=>{if(!i&&!a)return;if(u.current){u.current=!1;return}let t=(e,t)=>i&&e.width!==t.width||a&&e.height!==t.height;e.forEach(e=>{let n=fA(e,_);l?t(m.current,n)&&(m.current.width=n.width,m.current.height=n.height,d?.({width:n.width,height:n.height,entry:e})):p(r=>t(r,n)?(d?.({width:n.width,height:n.height,entry:e}),n):r)})},[i,a,u,_,l]),y=(0,L.useCallback)(lA(v,t,n,r),[v,t,n,r]);return(0,L.useEffect)(()=>{let e;if(g)try{e=new window.ResizeObserver(y),e.observe(g,s)}catch(e){console.warn(`ResizeObserver not supported or failed to initialize:`,e)}else(f.width||f.height)&&(d?.({width:null,height:null,entry:null}),m.current.width=void 0,m.current.height=void 0,l||p({width:void 0,height:void 0}));return()=>{var t,n,r;(t=e?.disconnect)==null||t.call(e),(r=(n=y).cancel)==null||r.call(n)}},[y,g]),Object.assign({ref:h},l?m.current:f)}var mA=G(`div`)({backgroundColor:Lr[700],color:`white`,padding:`0.3rem 0.5rem`,borderRadius:`3px`,boxShadow:`0 1px 2px rgba(33, 33, 33, 0.2)`,pointerEvents:`none`});function hA({chartHeight:e,chartWidth:t,atom:n,TooltipContent:r}){let i=R(n),{ref:a,width:o,height:s}=pA({refreshMode:`debounce`,refreshRate:100});if(!i)return null;let c=i.left,l=i.top;return o!==void 0&&(c+10+o>t&&c+10>t/2?c=c-o-30:c+=10),s!==void 0&&(l+10+s>e&&l+10>e/2?l=l-s-10:l+=10),(0,H.jsx)(`div`,{style:{visibility:s!==void 0&&o!==void 0?`visible`:`hidden`,position:`absolute`,left:c,top:l,zIndex:10},children:(0,H.jsx)(mA,{ref:a,style:i?.zIndex?{zIndex:i.zIndex}:void 0,children:(0,H.jsx)(r,{tooltip:i})})})}function gA({chart:e,tooltipAtom:t,TooltipContent:n,sx:r,autoHeight:i}){let{ref:a,width:o,height:s}=pA({refreshMode:`debounce`,refreshRate:100});return(0,H.jsx)(J,{ref:a,sx:r,children:(0,H.jsxs)(J,{sx:{position:`relative`,overflow:`hidden`},children:[o&&(s||i)?e({width:o,height:s??0}):void 0,s&&o?(0,H.jsx)(hA,{chartHeight:s,chartWidth:o,atom:t,TooltipContent:n}):void 0]})})}function _A(e){return Q.ofObject(e.baskets??{}).collect(([,e])=>e.position.location===_t.LoadUnload||e.position.location===_t.LoadStationStaging?[e.basketId,{group:`L/U`,num:e.position.locationNum}]:null).toRMap(([e,t])=>[e,t])}function vA(e,t,n){return e.action.type===st.LoadingToBasket?n.get(e.action.loadToBasketId??0)??null:e.action.type===st.Loading?e.action.loadOntoPalletNum?t.get(e.action.loadOntoPalletNum)??null:e.action.loadFromBasketId?n.get(e.action.loadFromBasketId)??null:null:e.location.palletNum?t.get(e.location.palletNum)??null:e.location.basketId?n.get(e.location.basketId)??null:null}function yA(e,t,n,r){return Q.of(e.material).collect(e=>{if(e.action.type!==st.Machining||!e.location.palletNum)return null;let t=n.get(e.location.palletNum);return t?{mat:e,loc:t}:null}).groupBy(({loc:e})=>e.group,({loc:e})=>e.num).map(([[n,i],a])=>{let o=t.get(new VO(a[0].mat.partName,n,a[0].mat.action.program??``)),s=zO(a[0].mat.action.elapsedMachiningTime??`PT0S`),c=zO(a[0].mat.action.expectedRemainingMachiningTime??`PT0S`);return{station:ak(n,i,r),start:YT(e.timeOfCurrentStatusUTC,-s),expectedEnd:YT(e.timeOfCurrentStatusUTC,c),isOutlier:o?qO(o,s/60/a.length):!1,parts:[{part:a[0].mat.partName,oper:a[0].mat.action.program??``}]}})}function bA(e,t,n,r){let i=_A(e);return Q.of(e.material).collect(e=>{if(e.action.type===st.UnloadToCompletedMaterial||e.action.type===st.UnloadToInProcess){let t=vA(e,n,i);return t?{mat:e,material:[e],proc:e.process,path:e.path,loc:t}:null}else if(e.action.type===st.Loading||e.action.type===st.LoadingToBasket){let t=vA(e,n,i);return t?{mat:e,material:[e],proc:e.action.processAfterLoad??e.process,path:e.action.pathAfterLoad??e.path,loc:t}:null}return null}).map(t=>{let n=e.jobs[t.mat.jobUnique],r=n?.procsAndPaths?.[t.proc-1],i=n?.procsAndPaths?.[t.proc-1]?.paths?.[t.path-1];if(t.mat.action.type===st.Loading||t.mat.action.type===st.LoadingToBasket){let e=t.mat.action.type===st.Loading?i?.expectedLoadTime:r?.expectedBasketLoadTime??i?.expectedLoadTime;return{...t,expectedLoadSecs:zO(e??`PT0S`)}}else{let e=t.mat.location.palletNum!==null&&t.mat.location.palletNum!==void 0?i?.expectedUnloadTime:r?.expectedBasketUnloadTime??i?.expectedUnloadTime;return{...t,expectedLoadSecs:zO(e??`PT0S`)}}}).groupBy(({loc:e})=>e.group,({loc:e})=>e.num).map(([[n,i],a])=>{let o=XO(a,e=>BO(e.mat.action.elapsedLoadUnloadTime??`PT0S`),e=>e.expectedLoadSecs/60),s=!1,c=0;for(let{cycle:e,elapsedForSingleMaterialMinutes:r}of o){let i=t.get(new VO(e.mat.partName,n,e.mat.action.type===st.Loading||e.mat.action.type===st.LoadingToBasket?`LOAD-`+e.proc.toString():`UNLOAD-`+e.proc.toString()));i&&qO(i,r)&&(s=!0),e.expectedLoadSecs>0?c+=e.expectedLoadSecs:i?.expectedCycleMinutesForSingleMat&&(c+=i.expectedCycleMinutesForSingleMat*60)}let l=zO(a[0].mat.action.elapsedLoadUnloadTime??`PT0S`);return{station:ak(n,i,r),start:YT(e.timeOfCurrentStatusUTC,-l),expectedEnd:YT(e.timeOfCurrentStatusUTC,-l+c),isOutlier:s,parts:Q.of(a).distinctAndSortBy(e=>e.mat.partName,e=>e.proc,e=>e.mat.action.type===st.Loading||e.mat.action.type===st.LoadingToBasket?`LOAD`:`UNLOAD`).map(e=>({part:e.mat.partName+`-`+e.proc.toString(),oper:e.mat.action.type===st.Loading||e.mat.action.type===st.LoadingToBasket?`LOAD`:`UNLOAD`})).toRArray()}})}function xA(e,t,n){let r=Q.ofObject(e.pallets).buildHashMap(([,e])=>e.palletNum,(e,[,t])=>t.currentPalletLocation);return yA(e,t,r,n).concat(bA(e,t,r,n)).toRArray()}function SA({scale:e,width:t,tickOverride:n}){return(0,H.jsx)(`g`,{children:(n??e.ticks()).map((n,r)=>(0,H.jsx)(`line`,{x1:0,y1:e(n),x2:t,y2:e(n),stroke:`#eaf0f6`,strokeWidth:1},r))})}function CA({scale:e,height:t,tickOverride:n}){return(0,H.jsx)(`g`,{children:(n??e.ticks()).map((n,r)=>(0,H.jsx)(`line`,{x1:e(n),y1:0,x2:e(n),y2:t,stroke:`#eaf0f6`,strokeWidth:1},r))})}function wA({xScale:e,yScale:t,width:n,height:r,rowTickOverride:i,colTickOverride:a}){return(0,H.jsxs)(`g`,{children:[(0,H.jsx)(SA,{scale:t,width:n,tickOverride:i}),(0,H.jsx)(CA,{scale:e,height:r,tickOverride:a})]})}var TA=8;function EA(e,t){if(t)return t.map(t=>({tick:t,pos:e(t)??0}));if(`ticks`in e&&e.ticks)return e.ticks().map(t=>({tick:t,pos:e(t)??0}));if(`bandwidth`in e&&e.bandwidth){let t=e.bandwidth();return e.domain().map(n=>({tick:n,pos:(e(n)??0)+t/2}))}else return e.domain().map(t=>({tick:t,pos:e(t)??0}))}function DA({top:e,scale:t,label:n,fontSize:r,tickFormat:i,tickOverride:a}){r??=10,i??=`tickFormat`in t&&t.tickFormat?t.tickFormat():e=>String(e);let o=EA(t,a),s=t.range();return(0,H.jsxs)(`g`,{transform:`translate(0, ${e})`,children:[(0,H.jsx)(`line`,{x1:s[0],y1:0,x2:s[1],y2:0,stroke:`#222`,strokeWidth:1,shapeRendering:`crispEdges`}),o.map((e,t)=>(0,H.jsxs)(`g`,{transform:`translate(${e.pos}, 0)`,children:[(0,H.jsx)(`line`,{y1:TA,y2:0,stroke:`#222`,strokeWidth:1,shapeRendering:`crispEdges`}),(0,H.jsx)(`text`,{dy:13,textAnchor:`middle`,fontSize:r,fill:`#222`,dominantBaseline:`hanging`,children:i(e.tick)})]},t)),n?(0,H.jsx)(`text`,{x:(s[0]+s[1])/2,y:TA+r+20,textAnchor:`middle`,fontSize:r+2,fill:`#222`,children:n}):void 0]})}function OA({left:e,scale:t,label:n,fontSize:r,tickFormat:i,tickOverride:a}){r??=10,i??=`tickFormat`in t&&t.tickFormat?t.tickFormat():e=>String(e);let o=EA(t,a),s=t.range();return(0,H.jsxs)(`g`,{transform:`translate(${e}, 0)`,children:[(0,H.jsx)(`line`,{x1:0,y1:s[0],x2:0,y2:s[1],stroke:`#222`,strokeWidth:1,shapeRendering:`crispEdges`}),o.map((e,t)=>(0,H.jsxs)(`g`,{transform:`translate(0, ${e.pos})`,children:[(0,H.jsx)(`line`,{x1:-8,x2:0,y1:0,y2:0,stroke:`#222`,strokeWidth:1,shapeRendering:`crispEdges`}),(0,H.jsx)(`text`,{dx:-13,textAnchor:`end`,fontSize:r,fill:`#222`,dominantBaseline:`middle`,children:i(e.tick)})]},t)),n?(0,H.jsx)(`text`,{x:-(s[0]+s[1])/2,y:-8-r-20,textAnchor:`middle`,fontSize:r+2,fill:`#222`,transform:`rotate(-90)`,children:n}):void 0]})}function kA({top:e,scale:t,label:n,fontSize:r,tickFormat:i,tickOverride:a}){r??=10,i??=`tickFormat`in t&&t.tickFormat?t.tickFormat():e=>String(e);let o=EA(t,a),s=t.range();return(0,H.jsxs)(`g`,{transform:`translate(0, ${e})`,children:[(0,H.jsx)(`line`,{x1:s[0],y1:0,x2:s[1],y2:0,stroke:`#222`,strokeWidth:1,shapeRendering:`crispEdges`}),o.map((e,t)=>(0,H.jsxs)(`g`,{transform:`translate(${e.pos}, 0)`,children:[(0,H.jsx)(`line`,{y1:0,y2:-8,stroke:`#222`,strokeWidth:1,shapeRendering:`crispEdges`}),(0,H.jsx)(`text`,{dy:-13,textAnchor:`middle`,fontSize:r,fill:`#222`,children:i(e.tick)})]},t)),n?(0,H.jsx)(`text`,{x:(s[0]+s[1])/2,y:-8-r-20,textAnchor:`middle`,fontSize:r+2,fill:`#222`,children:n}):void 0]})}function AA(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function jA(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function MA(e){let t,n,r;e.length===2?(t=e===AA||e===jA?e:NA,n=e,r=e):(t=AA,n=(t,n)=>AA(e(t),n),r=(t,n)=>e(t)-n);function i(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<0?i=t+1:a=t}while(i<a)}return i}function a(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<=0?i=t+1:a=t}while(i<a)}return i}function o(e,t,n=0,a=e.length){let o=i(e,t,n,a-1);return o>n&&r(e[o-1],t)>-r(e[o],t)?o-1:o}return{left:i,center:o,right:a}}function NA(){return 0}function PA(e){return e===null?NaN:+e}var FA=MA(AA),IA=FA.right;FA.left,MA(PA).center;var LA=class extends Map{constructor(e,t=VA){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),e!=null)for(let[t,n]of e)this.set(t,n)}get(e){return super.get(RA(this,e))}has(e){return super.has(RA(this,e))}set(e,t){return super.set(zA(this,e),t)}delete(e){return super.delete(BA(this,e))}};function RA({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function zA({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function BA({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function VA(e){return typeof e==`object`&&e?e.valueOf():e}var HA=Math.sqrt(50),UA=Math.sqrt(10),WA=Math.sqrt(2);function GA(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=HA?10:a>=UA?5:a>=WA?2:1,s,c,l;return i<0?(l=10**-i/o,s=Math.round(e*l),c=Math.round(t*l),s/l<e&&++s,c/l>t&&--c,l=-l):(l=10**i*o,s=Math.round(e/l),c=Math.round(t/l),s*l<e&&++s,c*l>t&&--c),c<s&&.5<=n&&n<2?GA(e,t,n*2):[s,c,l]}function KA(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];let r=t<e,[i,a,o]=r?GA(t,e,n):GA(e,t,n);if(!(a>=i))return[];let s=a-i+1,c=Array(s);if(r)if(o<0)for(let e=0;e<s;++e)c[e]=(a-e)/-o;else for(let e=0;e<s;++e)c[e]=(a-e)*o;else if(o<0)for(let e=0;e<s;++e)c[e]=(i+e)/-o;else for(let e=0;e<s;++e)c[e]=(i+e)*o;return c}function qA(e,t,n){return t=+t,e=+e,n=+n,GA(e,t,n)[2]}function JA(e,t,n){t=+t,e=+e,n=+n;let r=t<e,i=r?qA(t,e,n):qA(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function YA(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++r<i;)a[r]=e+r*n;return a}function XA(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}var ZA=Symbol(`implicit`);function QA(){var e=new LA,t=[],n=[],r=ZA;function i(i){let a=e.get(i);if(a===void 0){if(r!==ZA)return r;e.set(i,a=t.push(i)-1)}return n[a%n.length]}return i.domain=function(n){if(!arguments.length)return t.slice();t=[],e=new LA;for(let r of n)e.has(r)||e.set(r,t.push(r)-1);return i},i.range=function(e){return arguments.length?(n=Array.from(e),i):n.slice()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return QA(t,n).unknown(r)},XA.apply(i,arguments),i}function $A(){var e=QA().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,a,o,s=!1,c=0,l=0,u=.5;delete e.unknown;function d(){var e=t().length,d=i<r,f=d?i:r,p=d?r:i;a=(p-f)/Math.max(1,e-c+l*2),s&&(a=Math.floor(a)),f+=(p-f-a*(e-c))*u,o=a*(1-c),s&&(f=Math.round(f),o=Math.round(o));var m=YA(e).map(function(e){return f+a*e});return n(d?m.reverse():m)}return e.domain=function(e){return arguments.length?(t(e),d()):t()},e.range=function(e){return arguments.length?([r,i]=e,r=+r,i=+i,d()):[r,i]},e.rangeRound=function(e){return[r,i]=e,r=+r,i=+i,s=!0,d()},e.bandwidth=function(){return o},e.step=function(){return a},e.round=function(e){return arguments.length?(s=!!e,d()):s},e.padding=function(e){return arguments.length?(c=Math.min(1,l=+e),d()):c},e.paddingInner=function(e){return arguments.length?(c=Math.min(1,e),d()):c},e.paddingOuter=function(e){return arguments.length?(l=+e,d()):l},e.align=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),d()):u},e.copy=function(){return $A(t(),[r,i]).round(s).paddingInner(c).paddingOuter(l).align(u)},XA.apply(d(),arguments)}function ej(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function tj(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function nj(){}var rj=.7,ij=1/rj,aj=`\\s*([+-]?\\d+)\\s*`,oj=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,sj=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,cj=/^#([0-9a-f]{3,8})$/,lj=RegExp(`^rgb\\(${aj},${aj},${aj}\\)$`),uj=RegExp(`^rgb\\(${sj},${sj},${sj}\\)$`),dj=RegExp(`^rgba\\(${aj},${aj},${aj},${oj}\\)$`),fj=RegExp(`^rgba\\(${sj},${sj},${sj},${oj}\\)$`),pj=RegExp(`^hsl\\(${oj},${sj},${sj}\\)$`),mj=RegExp(`^hsla\\(${oj},${sj},${sj},${oj}\\)$`),hj={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};ej(nj,bj,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:gj,formatHex:gj,formatHex8:_j,formatHsl:vj,formatRgb:yj,toString:yj});function gj(){return this.rgb().formatHex()}function _j(){return this.rgb().formatHex8()}function vj(){return Nj(this).formatHsl()}function yj(){return this.rgb().formatRgb()}function bj(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=cj.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?xj(t):n===3?new Tj(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Sj(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Sj(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=lj.exec(e))?new Tj(t[1],t[2],t[3],1):(t=uj.exec(e))?new Tj(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=dj.exec(e))?Sj(t[1],t[2],t[3],t[4]):(t=fj.exec(e))?Sj(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=pj.exec(e))?Mj(t[1],t[2]/100,t[3]/100,1):(t=mj.exec(e))?Mj(t[1],t[2]/100,t[3]/100,t[4]):hj.hasOwnProperty(e)?xj(hj[e]):e===`transparent`?new Tj(NaN,NaN,NaN,0):null}function xj(e){return new Tj(e>>16&255,e>>8&255,e&255,1)}function Sj(e,t,n,r){return r<=0&&(e=t=n=NaN),new Tj(e,t,n,r)}function Cj(e){return e instanceof nj||(e=bj(e)),e?(e=e.rgb(),new Tj(e.r,e.g,e.b,e.opacity)):new Tj}function wj(e,t,n,r){return arguments.length===1?Cj(e):new Tj(e,t,n,r??1)}function Tj(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}ej(Tj,wj,tj(nj,{brighter(e){return e=e==null?ij:ij**+e,new Tj(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?rj:rj**+e,new Tj(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Tj(Aj(this.r),Aj(this.g),Aj(this.b),kj(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ej,formatHex:Ej,formatHex8:Dj,formatRgb:Oj,toString:Oj}));function Ej(){return`#${jj(this.r)}${jj(this.g)}${jj(this.b)}`}function Dj(){return`#${jj(this.r)}${jj(this.g)}${jj(this.b)}${jj((isNaN(this.opacity)?1:this.opacity)*255)}`}function Oj(){let e=kj(this.opacity);return`${e===1?`rgb(`:`rgba(`}${Aj(this.r)}, ${Aj(this.g)}, ${Aj(this.b)}${e===1?`)`:`, ${e})`}`}function kj(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Aj(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function jj(e){return e=Aj(e),(e<16?`0`:``)+e.toString(16)}function Mj(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Fj(e,t,n,r)}function Nj(e){if(e instanceof Fj)return new Fj(e.h,e.s,e.l,e.opacity);if(e instanceof nj||(e=bj(e)),!e)return new Fj;if(e instanceof Fj)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new Fj(o,s,c,e.opacity)}function Pj(e,t,n,r){return arguments.length===1?Nj(e):new Fj(e,t,n,r??1)}function Fj(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}ej(Fj,Pj,tj(nj,{brighter(e){return e=e==null?ij:ij**+e,new Fj(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?rj:rj**+e,new Fj(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Tj(Rj(e>=240?e-240:e+120,i,r),Rj(e,i,r),Rj(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Fj(Ij(this.h),Lj(this.s),Lj(this.l),kj(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=kj(this.opacity);return`${e===1?`hsl(`:`hsla(`}${Ij(this.h)}, ${Lj(this.s)*100}%, ${Lj(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function Ij(e){return e=(e||0)%360,e<0?e+360:e}function Lj(e){return Math.max(0,Math.min(1,e||0))}function Rj(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var zj=e=>()=>e;function Bj(e,t){return function(n){return e+n*t}}function Vj(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function Hj(e){return(e=+e)==1?Uj:function(t,n){return n-t?Vj(t,n,e):zj(isNaN(t)?n:t)}}function Uj(e,t){var n=t-e;return n?Bj(e,n):zj(isNaN(e)?t:e)}var Wj=(function e(t){var n=Hj(t);function r(e,t){var r=n((e=wj(e)).r,(t=wj(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=Uj(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function Gj(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function Kj(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function qj(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o<r;++o)i[o]=nM(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function Jj(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Yj(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Xj(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=nM(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var Zj=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Qj=new RegExp(Zj.source,`g`);function $j(e){return function(){return e}}function eM(e){return function(t){return e(t)+``}}function tM(e,t){var n=Zj.lastIndex=Qj.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=Zj.exec(e))&&(i=Qj.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:Yj(r,i)})),n=Qj.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?eM(c[0].x):$j(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function nM(e,t){var n=typeof t,r;return t==null||n===`boolean`?zj(t):(n===`number`?Yj:n===`string`?(r=bj(t))?(t=r,Wj):tM:t instanceof bj?Wj:t instanceof Date?Jj:Kj(t)?Gj:Array.isArray(t)?qj:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?Xj:Yj)(e,t)}function rM(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function iM(e){return function(){return e}}function aM(e){return+e}var oM=[0,1];function sM(e){return e}function cM(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:iM(isNaN(t)?NaN:.5)}function lM(e,t){var n;return e>t&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function uM(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i<r?(r=cM(i,r),a=n(o,a)):(r=cM(r,i),a=n(a,o)),function(e){return a(r(e))}}function dM(e,t,n){var r=Math.min(e.length,t.length)-1,i=Array(r),a=Array(r),o=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<r;)i[o]=cM(e[o],e[o+1]),a[o]=n(t[o],t[o+1]);return function(t){var n=IA(e,t,1,r)-1;return a[n](i[n](t))}}function fM(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function pM(){var e=oM,t=oM,n=nM,r,i,a,o=sM,s,c,l;function u(){var n=Math.min(e.length,t.length);return o!==sM&&(o=lM(e[0],e[n-1])),s=n>2?dM:uM,c=l=null,d}function d(i){return i==null||isNaN(i=+i)?a:(c||=s(e.map(r),t,n))(r(o(i)))}return d.invert=function(n){return o(i((l||=s(t,e.map(r),Yj))(n)))},d.domain=function(t){return arguments.length?(e=Array.from(t,aM),u()):e.slice()},d.range=function(e){return arguments.length?(t=Array.from(e),u()):t.slice()},d.rangeRound=function(e){return t=Array.from(e),n=rM,u()},d.clamp=function(e){return arguments.length?(o=e?!0:sM,u()):o!==sM},d.interpolate=function(e){return arguments.length?(n=e,u()):n},d.unknown=function(e){return arguments.length?(a=e,d):a},function(e,t){return r=e,i=t,u()}}function mM(){return pM()(sM,sM)}function hM(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function gM(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf(`e`),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function _M(e){return e=gM(Math.abs(e)),e?e[1]:NaN}function vM(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}function yM(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var bM=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function xM(e){if(!(t=bM.exec(e)))throw Error(`invalid format: `+e);var t;return new SM({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}xM.prototype=SM.prototype;function SM(e){this.fill=e.fill===void 0?` `:e.fill+``,this.align=e.align===void 0?`>`:e.align+``,this.sign=e.sign===void 0?`-`:e.sign+``,this.symbol=e.symbol===void 0?``:e.symbol+``,this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?``:e.type+``}SM.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?`0`:``)+(this.width===void 0?``:Math.max(1,this.width|0))+(this.comma?`,`:``)+(this.precision===void 0?``:`.`+Math.max(0,this.precision|0))+(this.trim?`~`:``)+this.type};function CM(e){out:for(var t=e.length,n=1,r=-1,i;n<t;++n)switch(e[n]){case`.`:r=i=n;break;case`0`:r===0&&(r=n),i=n;break;default:if(!+e[n])break out;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var wM;function TM(e,t){var n=gM(e,t);if(!n)return wM=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(wM=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join(`0`):a>0?r.slice(0,a)+`.`+r.slice(a):`0.`+Array(1-a).join(`0`)+gM(e,Math.max(0,t+a-1))[0]}function EM(e,t){var n=gM(e,t);if(!n)return e+``;var r=n[0],i=n[1];return i<0?`0.`+Array(-i).join(`0`)+r:r.length>i+1?r.slice(0,i+1)+`.`+r.slice(i+1):r+Array(i-r.length+2).join(`0`)}var DM={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:hM,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>EM(e*100,t),r:EM,s:TM,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function OM(e){return e}var kM=Array.prototype.map,AM=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function jM(e){var t=e.grouping===void 0||e.thousands===void 0?OM:vM(kM.call(e.grouping,Number),e.thousands+``),n=e.currency===void 0?``:e.currency[0]+``,r=e.currency===void 0?``:e.currency[1]+``,i=e.decimal===void 0?`.`:e.decimal+``,a=e.numerals===void 0?OM:yM(kM.call(e.numerals,String)),o=e.percent===void 0?`%`:e.percent+``,s=e.minus===void 0?`−`:e.minus+``,c=e.nan===void 0?`NaN`:e.nan+``;function l(e,l){e=xM(e);var u=e.fill,d=e.align,f=e.sign,p=e.symbol,m=e.zero,h=e.width,g=e.comma,_=e.precision,v=e.trim,y=e.type;y===`n`?(g=!0,y=`g`):DM[y]||(_===void 0&&(_=12),v=!0,y=`g`),(m||u===`0`&&d===`=`)&&(m=!0,u=`0`,d=`=`);var b=(l&&l.prefix!==void 0?l.prefix:``)+(p===`$`?n:p===`#`&&/[boxX]/.test(y)?`0`+y.toLowerCase():``),x=(p===`$`?r:/[%p]/.test(y)?o:``)+(l&&l.suffix!==void 0?l.suffix:``),S=DM[y],C=/[defgprs%]/.test(y);_=_===void 0?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function w(e){var n=b,r=x,o,l,p;if(y===`c`)r=S(e)+r,e=``;else{e=+e;var w=e<0||1/e<0;if(e=isNaN(e)?c:S(Math.abs(e),_),v&&(e=CM(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&wM!==void 0?AM[8+wM/3]:``)+r+(w&&f===`(`?`)`:``),C){for(o=-1,l=e.length;++o<l;)if(p=e.charCodeAt(o),48>p||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var T=n.length+e.length+r.length,E=T<h?Array(h-T+1).join(u):``;switch(g&&m&&(e=t(E+e,E.length?h-r.length:1/0),E=``),d){case`<`:e=n+e+r+E;break;case`=`:e=n+E+e+r;break;case`^`:e=E.slice(0,T=E.length>>1)+n+e+r+E.slice(T);break;default:e=E+n+e+r;break}return a(e)}return w.toString=function(){return e+``},w}function u(e,t){var n=Math.max(-8,Math.min(8,Math.floor(_M(t)/3)))*3,r=10**-n,i=l((e=xM(e),e.type=`f`,e),{suffix:AM[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var MM,NM,PM;FM({thousands:`,`,grouping:[3],currency:[`$`,``]});function FM(e){return MM=jM(e),NM=MM.format,PM=MM.formatPrefix,MM}function IM(e){return Math.max(0,-_M(Math.abs(e)))}function LM(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(_M(t)/3)))*3-_M(Math.abs(e)))}function RM(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,_M(t)-_M(e))+1}function zM(e,t,n,r){var i=JA(e,t,n),a;switch(r=xM(r??`,f`),r.type){case`s`:var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=LM(i,o))&&(r.precision=a),PM(r,o);case``:case`e`:case`g`:case`p`:case`r`:r.precision==null&&!isNaN(a=RM(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type===`e`));break;case`f`:case`%`:r.precision==null&&!isNaN(a=IM(i))&&(r.precision=a-(r.type===`%`)*2);break}return NM(r)}function BM(e){var t=e.domain;return e.ticks=function(e){var n=t();return KA(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return zM(r[0],r[r.length-1],e??10,n)},e.nice=function(n){n??=10;var r=t(),i=0,a=r.length-1,o=r[i],s=r[a],c,l,u=10;for(s<o&&(l=o,o=s,s=l,l=i,i=a,a=l);u-->0;){if(l=qA(o,s,n),l===c)return r[i]=o,r[a]=s,t(r);if(l>0)o=Math.floor(o/l)*l,s=Math.ceil(s/l)*l;else if(l<0)o=Math.ceil(o*l)/l,s=Math.floor(s*l)/l;else break;c=l}return e},e}function VM(){var e=mM();return e.copy=function(){return fM(e,VM())},XA.apply(e,arguments),BM(e)}function HM(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],o;return a<i&&(o=n,n=r,r=o,o=i,i=a,a=o),e[n]=t.floor(i),e[r]=t.ceil(a),e}var UM=new Date,WM=new Date;function GM(e,t,n,r){function i(t){return e(t=arguments.length===0?new Date:new Date(+t)),t}return i.floor=t=>(e(t=new Date(+t)),t),i.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),i.round=e=>{let t=i(e),n=i.ceil(e);return e-t<n-e?t:n},i.offset=(e,n)=>(t(e=new Date(+e),n==null?1:Math.floor(n)),e),i.range=(n,r,a)=>{let o=[];if(n=i.ceil(n),a=a==null?1:Math.floor(a),!(n<r)||!(a>0))return o;let s;do o.push(s=new Date(+n)),t(n,a),e(n);while(s<n&&n<r);return o},i.filter=n=>GM(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}),n&&(i.count=(t,r)=>(UM.setTime(+t),WM.setTime(+r),e(UM),e(WM),Math.floor(n(UM,WM))),i.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?i.filter(r?t=>r(t)%e===0:t=>i.count(0,t)%e===0):i)),i}var KM=GM(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);KM.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?GM(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):KM),KM.range;var qM=1e3,JM=qM*60,YM=JM*60,XM=YM*24,ZM=XM*7,QM=XM*30,$M=XM*365,eN=GM(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*qM)},(e,t)=>(t-e)/qM,e=>e.getUTCSeconds());eN.range;var tN=GM(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*qM)},(e,t)=>{e.setTime(+e+t*JM)},(e,t)=>(t-e)/JM,e=>e.getMinutes());tN.range;var nN=GM(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*JM)},(e,t)=>(t-e)/JM,e=>e.getUTCMinutes());nN.range;var rN=GM(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*qM-e.getMinutes()*JM)},(e,t)=>{e.setTime(+e+t*YM)},(e,t)=>(t-e)/YM,e=>e.getHours());rN.range;var iN=GM(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*YM)},(e,t)=>(t-e)/YM,e=>e.getUTCHours());iN.range;var aN=GM(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*JM)/XM,e=>e.getDate()-1);aN.range;var oN=GM(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/XM,e=>e.getUTCDate()-1);oN.range;var sN=GM(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/XM,e=>Math.floor(e/XM));sN.range;function cN(e){return GM(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+t*7)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*JM)/ZM)}var lN=cN(0),uN=cN(1),dN=cN(2),fN=cN(3),pN=cN(4),mN=cN(5),hN=cN(6);lN.range,uN.range,dN.range,fN.range,pN.range,mN.range,hN.range;function gN(e){return GM(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t*7)},(e,t)=>(t-e)/ZM)}var _N=gN(0),vN=gN(1),yN=gN(2),bN=gN(3),xN=gN(4),SN=gN(5),CN=gN(6);_N.range,vN.range,yN.range,bN.range,xN.range,SN.range,CN.range;var wN=GM(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());wN.range;var TN=GM(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());TN.range;var EN=GM(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());EN.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:GM(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}),EN.range;var DN=GM(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());DN.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:GM(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}),DN.range;function ON(e,t,n,r,i,a){let o=[[eN,1,qM],[eN,5,5*qM],[eN,15,15*qM],[eN,30,30*qM],[a,1,JM],[a,5,5*JM],[a,15,15*JM],[a,30,30*JM],[i,1,YM],[i,3,3*YM],[i,6,6*YM],[i,12,12*YM],[r,1,XM],[r,2,2*XM],[n,1,ZM],[t,1,QM],[t,3,3*QM],[e,1,$M]];function s(e,t,n){let r=t<e;r&&([e,t]=[t,e]);let i=n&&typeof n.range==`function`?n:c(e,t,n),a=i?i.range(e,+t+1):[];return r?a.reverse():a}function c(t,n,r){let i=Math.abs(n-t)/r,a=MA(([,,e])=>e).right(o,i);if(a===o.length)return e.every(JA(t/$M,n/$M,r));if(a===0)return KM.every(Math.max(JA(t,n,r),1));let[s,c]=o[i/o[a-1][2]<o[a][2]/i?a-1:a];return s.every(c)}return[s,c]}var[nie,rie]=ON(DN,TN,_N,sN,iN,nN),[kN,AN]=ON(EN,wN,lN,aN,rN,tN);function jN(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function MN(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function NN(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function PN(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,a=e.days,o=e.shortDays,s=e.months,c=e.shortMonths,l=VN(i),u=HN(i),d=VN(a),f=HN(a),p=VN(o),m=HN(o),h=VN(s),g=HN(s),_=VN(c),v=HN(c),y={a:j,A:M,b:ne,B:re,c:null,d:lP,e:lP,f:mP,g:TP,G:DP,H:uP,I:dP,j:fP,L:pP,m:hP,M:gP,p:ie,q:ae,Q:XP,s:ZP,S:_P,u:vP,U:yP,V:xP,w:SP,W:CP,x:null,X:null,y:wP,Y:EP,Z:OP,"%":YP},b={a:N,A:oe,b:se,B:ce,c:null,d:kP,e:kP,f:PP,g:GP,G:qP,H:AP,I:jP,j:MP,L:NP,m:FP,M:IP,p:P,q:le,Q:XP,s:ZP,S:LP,u:RP,U:zP,V:VP,w:HP,W:UP,x:null,X:null,y:WP,Y:KP,Z:JP,"%":YP},x={a:E,A:D,b:O,B:ee,c:te,d:$N,e:$N,f:aP,g:YN,G:JN,H:tP,I:tP,j:eP,L:iP,m:QN,M:nP,p:T,q:ZN,Q:sP,s:cP,S:rP,u:WN,U:GN,V:KN,w:UN,W:qN,x:k,X:A,y:YN,Y:JN,Z:XN,"%":oP};y.x=S(n,y),y.X=S(r,y),y.c=S(t,y),b.x=S(n,b),b.X=S(r,b),b.c=S(t,b);function S(e,t){return function(n){var r=[],i=-1,a=0,o=e.length,s,c,l;for(n instanceof Date||(n=new Date(+n));++i<o;)e.charCodeAt(i)===37&&(r.push(e.slice(a,i)),(c=FN[s=e.charAt(++i)])==null?c=s===`e`?` `:`0`:s=e.charAt(++i),(l=t[s])&&(s=l(n,c)),r.push(s),a=i+1);return r.push(e.slice(a,i)),r.join(``)}}function C(e,t){return function(n){var r=NN(1900,void 0,1),i=w(r,e,n+=``,0),a,o;if(i!=n.length)return null;if(`Q`in r)return new Date(r.Q);if(`s`in r)return new Date(r.s*1e3+(`L`in r?r.L:0));if(t&&!(`Z`in r)&&(r.Z=0),`p`in r&&(r.H=r.H%12+r.p*12),r.m===void 0&&(r.m=`q`in r?r.q:0),`V`in r){if(r.V<1||r.V>53)return null;`w`in r||(r.w=1),`Z`in r?(a=MN(NN(r.y,0,1)),o=a.getUTCDay(),a=o>4||o===0?vN.ceil(a):vN(a),a=oN.offset(a,(r.V-1)*7),r.y=a.getUTCFullYear(),r.m=a.getUTCMonth(),r.d=a.getUTCDate()+(r.w+6)%7):(a=jN(NN(r.y,0,1)),o=a.getDay(),a=o>4||o===0?uN.ceil(a):uN(a),a=aN.offset(a,(r.V-1)*7),r.y=a.getFullYear(),r.m=a.getMonth(),r.d=a.getDate()+(r.w+6)%7)}else(`W`in r||`U`in r)&&(`w`in r||(r.w=`u`in r?r.u%7:+(`W`in r)),o=`Z`in r?MN(NN(r.y,0,1)).getUTCDay():jN(NN(r.y,0,1)).getDay(),r.m=0,r.d=`W`in r?(r.w+6)%7+r.W*7-(o+5)%7:r.w+r.U*7-(o+6)%7);return`Z`in r?(r.H+=r.Z/100|0,r.M+=r.Z%100,MN(r)):jN(r)}}function w(e,t,n,r){for(var i=0,a=t.length,o=n.length,s,c;i<a;){if(r>=o)return-1;if(s=t.charCodeAt(i++),s===37){if(s=t.charAt(i++),c=x[s in FN?t.charAt(i++):s],!c||(r=c(e,n,r))<0)return-1}else if(s!=n.charCodeAt(r++))return-1}return r}function T(e,t,n){var r=l.exec(t.slice(n));return r?(e.p=u.get(r[0].toLowerCase()),n+r[0].length):-1}function E(e,t,n){var r=p.exec(t.slice(n));return r?(e.w=m.get(r[0].toLowerCase()),n+r[0].length):-1}function D(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=f.get(r[0].toLowerCase()),n+r[0].length):-1}function O(e,t,n){var r=_.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1}function ee(e,t,n){var r=h.exec(t.slice(n));return r?(e.m=g.get(r[0].toLowerCase()),n+r[0].length):-1}function te(e,n,r){return w(e,t,n,r)}function k(e,t,r){return w(e,n,t,r)}function A(e,t,n){return w(e,r,t,n)}function j(e){return o[e.getDay()]}function M(e){return a[e.getDay()]}function ne(e){return c[e.getMonth()]}function re(e){return s[e.getMonth()]}function ie(e){return i[+(e.getHours()>=12)]}function ae(e){return 1+~~(e.getMonth()/3)}function N(e){return o[e.getUTCDay()]}function oe(e){return a[e.getUTCDay()]}function se(e){return c[e.getUTCMonth()]}function ce(e){return s[e.getUTCMonth()]}function P(e){return i[+(e.getUTCHours()>=12)]}function le(e){return 1+~~(e.getUTCMonth()/3)}return{format:function(e){var t=S(e+=``,y);return t.toString=function(){return e},t},parse:function(e){var t=C(e+=``,!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=S(e+=``,b);return t.toString=function(){return e},t},utcParse:function(e){var t=C(e+=``,!0);return t.toString=function(){return e},t}}}var FN={"-":``,_:` `,0:`0`},IN=/^\s*\d+/,LN=/^%/,RN=/[\\^$*+?|[\]().{}]/g;function zN(e,t,n){var r=e<0?`-`:``,i=(r?-e:e)+``,a=i.length;return r+(a<n?Array(n-a+1).join(t)+i:i)}function BN(e){return e.replace(RN,`\\$&`)}function VN(e){return RegExp(`^(?:`+e.map(BN).join(`|`)+`)`,`i`)}function HN(e){return new Map(e.map((e,t)=>[e.toLowerCase(),t]))}function UN(e,t,n){var r=IN.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function WN(e,t,n){var r=IN.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function GN(e,t,n){var r=IN.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function KN(e,t,n){var r=IN.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function qN(e,t,n){var r=IN.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function JN(e,t,n){var r=IN.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function YN(e,t,n){var r=IN.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function XN(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||`00`)),n+r[0].length):-1}function ZN(e,t,n){var r=IN.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function QN(e,t,n){var r=IN.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function $N(e,t,n){var r=IN.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function eP(e,t,n){var r=IN.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function tP(e,t,n){var r=IN.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function nP(e,t,n){var r=IN.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function rP(e,t,n){var r=IN.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function iP(e,t,n){var r=IN.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function aP(e,t,n){var r=IN.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function oP(e,t,n){var r=LN.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function sP(e,t,n){var r=IN.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function cP(e,t,n){var r=IN.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function lP(e,t){return zN(e.getDate(),t,2)}function uP(e,t){return zN(e.getHours(),t,2)}function dP(e,t){return zN(e.getHours()%12||12,t,2)}function fP(e,t){return zN(1+aN.count(EN(e),e),t,3)}function pP(e,t){return zN(e.getMilliseconds(),t,3)}function mP(e,t){return pP(e,t)+`000`}function hP(e,t){return zN(e.getMonth()+1,t,2)}function gP(e,t){return zN(e.getMinutes(),t,2)}function _P(e,t){return zN(e.getSeconds(),t,2)}function vP(e){var t=e.getDay();return t===0?7:t}function yP(e,t){return zN(lN.count(EN(e)-1,e),t,2)}function bP(e){var t=e.getDay();return t>=4||t===0?pN(e):pN.ceil(e)}function xP(e,t){return e=bP(e),zN(pN.count(EN(e),e)+(EN(e).getDay()===4),t,2)}function SP(e){return e.getDay()}function CP(e,t){return zN(uN.count(EN(e)-1,e),t,2)}function wP(e,t){return zN(e.getFullYear()%100,t,2)}function TP(e,t){return e=bP(e),zN(e.getFullYear()%100,t,2)}function EP(e,t){return zN(e.getFullYear()%1e4,t,4)}function DP(e,t){var n=e.getDay();return e=n>=4||n===0?pN(e):pN.ceil(e),zN(e.getFullYear()%1e4,t,4)}function OP(e){var t=e.getTimezoneOffset();return(t>0?`-`:(t*=-1,`+`))+zN(t/60|0,`0`,2)+zN(t%60,`0`,2)}function kP(e,t){return zN(e.getUTCDate(),t,2)}function AP(e,t){return zN(e.getUTCHours(),t,2)}function jP(e,t){return zN(e.getUTCHours()%12||12,t,2)}function MP(e,t){return zN(1+oN.count(DN(e),e),t,3)}function NP(e,t){return zN(e.getUTCMilliseconds(),t,3)}function PP(e,t){return NP(e,t)+`000`}function FP(e,t){return zN(e.getUTCMonth()+1,t,2)}function IP(e,t){return zN(e.getUTCMinutes(),t,2)}function LP(e,t){return zN(e.getUTCSeconds(),t,2)}function RP(e){var t=e.getUTCDay();return t===0?7:t}function zP(e,t){return zN(_N.count(DN(e)-1,e),t,2)}function BP(e){var t=e.getUTCDay();return t>=4||t===0?xN(e):xN.ceil(e)}function VP(e,t){return e=BP(e),zN(xN.count(DN(e),e)+(DN(e).getUTCDay()===4),t,2)}function HP(e){return e.getUTCDay()}function UP(e,t){return zN(vN.count(DN(e)-1,e),t,2)}function WP(e,t){return zN(e.getUTCFullYear()%100,t,2)}function GP(e,t){return e=BP(e),zN(e.getUTCFullYear()%100,t,2)}function KP(e,t){return zN(e.getUTCFullYear()%1e4,t,4)}function qP(e,t){var n=e.getUTCDay();return e=n>=4||n===0?xN(e):xN.ceil(e),zN(e.getUTCFullYear()%1e4,t,4)}function JP(){return`+0000`}function YP(){return`%`}function XP(e){return+e}function ZP(e){return Math.floor(e/1e3)}var QP,$P;eF({dateTime:`%x, %X`,date:`%-m/%-d/%Y`,time:`%-I:%M:%S %p`,periods:[`AM`,`PM`],days:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],shortDays:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],months:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],shortMonths:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`]});function eF(e){return QP=PN(e),$P=QP.format,QP.parse,QP.utcFormat,QP.utcParse,QP}function tF(e){return new Date(e)}function nF(e){return e instanceof Date?+e:+new Date(+e)}function rF(e,t,n,r,i,a,o,s,c,l){var u=mM(),d=u.invert,f=u.domain,p=l(`.%L`),m=l(`:%S`),h=l(`%I:%M`),g=l(`%I %p`),_=l(`%a %d`),v=l(`%b %d`),y=l(`%B`),b=l(`%Y`);function x(e){return(c(e)<e?p:s(e)<e?m:o(e)<e?h:a(e)<e?g:r(e)<e?i(e)<e?_:v:n(e)<e?y:b)(e)}return u.invert=function(e){return new Date(d(e))},u.domain=function(e){return arguments.length?f(Array.from(e,nF)):f().map(tF)},u.ticks=function(t){var n=f();return e(n[0],n[n.length-1],t??10)},u.tickFormat=function(e,t){return t==null?x:l(t)},u.nice=function(e){var n=f();return(!e||typeof e.range!=`function`)&&(e=t(n[0],n[n.length-1],e??10)),e?f(HM(n,e)):u},u.copy=function(){return fM(u,rF(e,t,n,r,i,a,o,s,c,l))},u}function iF(){return XA.apply(rF(kN,AN,EN,wN,lN,aN,rN,tN,eN,$P).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}var aF=Pr[200],oF=Pr[600],sF=Pr[900],cF=Ar[700],lF=Lr[400],uF=Lr[100];function dF(){let e=R(sO),t=R(Xk);return(0,L.useMemo)(()=>{let n=BT(new Date,-12);return Q.of(t).filter(e=>e.end>=n).sortBy(e=>+!!e.plannedDown).map(t=>({station:t.stationLabel,start:t.start,end:t.end,plannedDown:t.plannedDown,parts:Q.of(t.parts??[]).collect(t=>{let n=e.get(t.uniq);return n?n.partName+`-`+t.proc.toString():null}).distinctAndSortBy(e=>e).toRArray()})).toRArray()},[e,t])}var fF=P(null),pF=14,mF=20,hF=10,gF=2;function _F(e,t,n,r,i){let a=QD.build(e,e=>e.station).union(QD.build(t,e=>e.station)),o=(a.toAscLazySeq().map(e=>aA(e,pF)).maxBy(e=>e??0)??20)+30,s=Math.max(r-o-gF,5),c=Math.max(i-hF-mF,5),l=iF().domain([BT(n,-12),BT(n,8)]).range([0,s]),u=$A().domain(Array.from(a)).range([0,c]).padding(.3);return{xScale:l,yScale:u,actualPlannedScale:$A().domain([`actual`,`planned`]).range([0,u.bandwidth()]).padding(.1),marginLeft:o}}function vF({xScale:e,yScale:t}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(DA,{scale:e,top:t.range()[1]}),(0,H.jsx)(OA,{scale:t,left:e.range()[0],fontSize:pF}),(0,H.jsx)(CA,{scale:e,height:t.range()[1]-t.range()[0]})]})}function yF({cycles:e,xScale:t,yScale:n,actualPlannedScale:r,hideTooltipRef:i}){let a=r(`actual`)??0,o=z(fF);function s(e){return t=>{let n=rA(t);n&&(i.current!==null&&(clearTimeout(i.current),i.current=null),o({left:n.x,top:n.y,data:{kind:`actual`,cycle:e}}))}}let c=(0,L.useCallback)(()=>{i.current=setTimeout(()=>{o(null)},300)},[i,o]);return(0,H.jsx)(`g`,{children:e.map((e,i)=>e.endActive&&e.endActive<e.endOccupied?(0,H.jsxs)(`g`,{onMouseOver:s(e),onMouseLeave:c,children:[(0,H.jsx)(`rect`,{x:t(e.startTime),y:(n(e.station)??0)+a,width:t(e.endOccupied)-t(e.startTime),height:r.bandwidth(),fill:oF}),(0,H.jsx)(`rect`,{x:t(e.endActive),y:(n(e.station)??0)+a+r.bandwidth()/10,width:t(e.endOccupied)-t(e.endActive),height:r.bandwidth()*8/10,fill:e.outlier?cF:sF})]},i):(0,H.jsx)(`g`,{onMouseOver:s(e),onMouseLeave:c,children:(0,H.jsx)(`rect`,{x:t(e.startTime),y:(n(e.station)??0)+a,width:t(e.endOccupied)-t(e.startTime),height:r.bandwidth(),fill:oF})},i))})}function bF(e,t,n,r){return`M ${e} ${t} A ${n} ${r} 0 0 1 ${e} ${t+r}`}function iie({now:e,cycles:t,xScale:n,yScale:r,actualPlannedScale:i,hideTooltipRef:a}){let o=i(`actual`)??0,s=z(fF);function c(t){return n=>{let r=rA(n);r&&(a.current!==null&&(clearTimeout(a.current),a.current=null),s({left:r.x,top:r.y,data:{kind:`current`,cycle:t,now:e}}))}}let l=(0,L.useCallback)(()=>{a.current=setTimeout(()=>{s(null)},300)},[a,s]);return(0,H.jsx)(`g`,{children:t.map((t,a)=>(0,H.jsxs)(`g`,{onMouseOver:c(t),onMouseLeave:l,children:[(0,H.jsx)(`rect`,{x:n(t.start),y:(r(t.station)??0)+o,width:n(e)-n(t.start),height:i.bandwidth(),fill:oF}),t.expectedEnd<e?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`rect`,{x:n(t.expectedEnd),y:(r(t.station)??0)+o+i.bandwidth()/10,width:n(e)-n(t.expectedEnd),height:i.bandwidth()*8/10,fill:t.isOutlier?cF:sF}),(0,H.jsx)(`path`,{d:bF(n(e),(r(t.station)??0)+o,80,i.bandwidth()),fill:aF})]}):(0,H.jsx)(`rect`,{x:n(e),y:(r(t.station)??0)+o,width:n(t.expectedEnd)-n(e),height:i.bandwidth(),fill:aF})]},a))})}function aie({sim:e,xScale:t,yScale:n,actualPlannedScale:r,hideTooltipRef:i}){let a=r(`planned`)??0,o=z(fF);function s(e){return t=>{let n=rA(t);n&&(i.current!==null&&(clearTimeout(i.current),i.current=null),o({left:n.x,top:n.y,data:{kind:`sim`,cycle:e}}))}}let c=(0,L.useCallback)(()=>{i.current=setTimeout(()=>{o(null)},300)},[i,o]);return(0,H.jsx)(`g`,{children:e.map((e,i)=>(0,H.jsx)(`g`,{onMouseOver:s(e),onMouseLeave:c,children:(0,H.jsx)(`rect`,{x:t(e.start),y:(n(e.station)??0)+a,width:t(e.end)-t(e.start),height:r.bandwidth(),fill:e.plannedDown?uF:lF})},i))})}function oie({tooltip:e}){return(0,H.jsx)(RC,{children:e.data.kind===`actual`?(0,H.jsxs)(H.Fragment,{children:[e.data.cycle.outlier?(0,H.jsxs)(`div`,{children:[`Outlier Cycle for `,e.data.cycle.station]}):(0,H.jsx)(`div`,{children:e.data.cycle.station}),(0,H.jsxs)(`div`,{children:[`Start: `,e.data.cycle.startTime.toLocaleString()]}),(0,H.jsxs)(`div`,{children:[`End: `,e.data.cycle.endOccupied.toLocaleString()]}),e.data.cycle.endActive===void 0?void 0:(0,H.jsxs)(`div`,{children:[`Active Minutes:`,` `,rE(e.data.cycle.endActive,e.data.cycle.startTime)]}),(0,H.jsxs)(`div`,{children:[`Occupied Minutes:`,` `,rE(e.data.cycle.endOccupied,e.data.cycle.startTime)]}),e.data.cycle.parts.map((e,t)=>(0,H.jsxs)(`div`,{children:[`Part: `,e.part,` `,e.oper]},t))]}):e.data.kind===`sim`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{children:[`Simulation of `,e.data.cycle.station]}),e.data.cycle.parts.map((e,t)=>(0,H.jsxs)(`div`,{children:[`Part: `,e]},t)),(0,H.jsxs)(`div`,{children:[`Predicted Start: `,e.data.cycle.start.toLocaleString()]}),(0,H.jsxs)(`div`,{children:[`Predicted End: `,e.data.cycle.end.toLocaleString()]}),e.data.cycle.plannedDown?(0,H.jsx)(`div`,{children:`Planned Downtime`}):void 0]}):(0,H.jsxs)(H.Fragment,{children:[e.data.cycle.isOutlier?(0,H.jsxs)(`div`,{children:[`Current Outlier Cycle for `,e.data.cycle.station]}):(0,H.jsxs)(`div`,{children:[`Current `,e.data.cycle.station]}),(0,H.jsxs)(`div`,{children:[`Start: `,e.data.cycle.start.toLocaleString()]}),(0,H.jsxs)(`div`,{children:[`Expected End: `,e.data.cycle.expectedEnd.toLocaleString()]}),e.data.cycle.expectedEnd<e.data.now?(0,H.jsxs)(`div`,{children:[`Cycle Exceeding Expected By`,` `,rE(e.data.now,e.data.cycle.expectedEnd),` Minutes`]}):(0,H.jsxs)(`div`,{children:[`Expected Remaining Minutes:`,` `,rE(e.data.cycle.expectedEnd,e.data.now)]}),(0,H.jsxs)(`div`,{children:[`Occupied Minutes: `,rE(e.data.now,e.data.cycle.start)]}),e.data.cycle.parts.map((e,t)=>(0,H.jsxs)(`div`,{children:[`Part: `,e.part,` `,e.oper]},t))]})})}function sie({now:e,xScale:t,yScale:n}){let r=t(e);return(0,H.jsxs)(`g`,{children:[(0,H.jsx)(`line`,{x1:r,x2:r,y1:n.range()[0],y2:n.range()[1]+8,stroke:`black`}),(0,H.jsx)(`text`,{x:r,y:n.range()[1]+8+11,textAnchor:`middle`,fontSize:11,children:`Now`})]})}function xF({height:e,width:t}){let n=R(uk),r=R(UO),i=dF(),a=R(NO),o=R(br),s=(0,L.useMemo)(()=>{let e=BT(new Date,-12);return zk(n.valuesToLazySeq().filter(t=>t.endTime>=e))},[n]),c=(0,L.useMemo)(()=>xA(a,r,o.loadStationNames),[a,r,o.loadStationNames]),l=new Date,[,u]=(0,L.useState)(0),d=(0,L.useRef)(null);(0,L.useEffect)(()=>{d.current!==null&&clearTimeout(d.current),d.current=setTimeout(()=>{u(e=>e+1)},300*1e3)});let{xScale:f,yScale:p,actualPlannedScale:m,marginLeft:h}=_F(s,c,l,t,e),g=(0,L.useRef)(null);return e<=0||t<=0?null:(0,H.jsxs)(`div`,{style:{position:`relative`,overflow:`hidden`},children:[(0,H.jsx)(`svg`,{height:e,width:t,children:(0,H.jsxs)(`g`,{transform:`translate(${h}, ${hF})`,children:[(0,H.jsx)(`clipPath`,{id:`recent-cycle-clip-body`,children:(0,H.jsx)(`rect`,{x:0,y:0,width:t-gF-h,height:e-mF-hF})}),(0,H.jsx)(vF,{xScale:f,yScale:p}),(0,H.jsxs)(`g`,{clipPath:`url(#recent-cycle-clip-body)`,children:[(0,H.jsx)(yF,{cycles:s,xScale:f,yScale:p,hideTooltipRef:g,actualPlannedScale:m}),(0,H.jsx)(iie,{now:l,cycles:c,xScale:f,yScale:p,hideTooltipRef:g,actualPlannedScale:m}),(0,H.jsx)(aie,{sim:i,xScale:f,yScale:p,actualPlannedScale:m,hideTooltipRef:g})]}),(0,H.jsx)(sie,{now:l,xScale:f,yScale:p})]})}),(0,H.jsx)(hA,{chartHeight:e,chartWidth:t,atom:fF,TooltipContent:oie})]})}var cie=Object.defineProperty,SF=(e,t)=>cie(e,`name`,{value:t,configurable:!0}),CF=class{type=3;name=``;prefix=``;value=``;suffix=``;modifier=3;constructor(e,t,n,r,i,a){this.type=e,this.name=t,this.prefix=n,this.value=r,this.suffix=i,this.modifier=a}hasCustomName(){return this.name!==``&&typeof this.name!=`number`}};SF(CF,`Part`);var lie=/[$_\p{ID_Start}]/u,uie=/[$_\u200C\u200D\p{ID_Continue}]/u,wF=`.*`;function TF(e,t){return(t?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(e)}SF(TF,`isASCII`);function EF(e,t=!1){let n=[],r=0;for(;r<e.length;){let i=e[r],a=SF(function(i){if(!t)throw TypeError(i);n.push({type:`INVALID_CHAR`,index:r,value:e[r++]})},`ErrorOrInvalid`);if(i===`*`){n.push({type:`ASTERISK`,index:r,value:e[r++]});continue}if(i===`+`||i===`?`){n.push({type:`OTHER_MODIFIER`,index:r,value:e[r++]});continue}if(i===`\\`){n.push({type:`ESCAPED_CHAR`,index:r++,value:e[r++]});continue}if(i===`{`){n.push({type:`OPEN`,index:r,value:e[r++]});continue}if(i===`}`){n.push({type:`CLOSE`,index:r,value:e[r++]});continue}if(i===`:`){let t=``,i=r+1;for(;i<e.length;){let n=e.substr(i,1);if(i===r+1&&lie.test(n)||i!==r+1&&uie.test(n)){t+=e[i++];continue}break}if(!t){a(`Missing parameter name at ${r}`);continue}n.push({type:`NAME`,index:r,value:t}),r=i;continue}if(i===`(`){let t=1,i=``,o=r+1,s=!1;if(e[o]===`?`){a(`Pattern cannot start with "?" at ${o}`);continue}for(;o<e.length;){if(!TF(e[o],!1)){a(`Invalid character '${e[o]}' at ${o}.`),s=!0;break}if(e[o]===`\\`){i+=e[o++]+e[o++];continue}if(e[o]===`)`){if(t--,t===0){o++;break}}else if(e[o]===`(`&&(t++,e[o+1]!==`?`)){a(`Capturing groups are not allowed at ${o}`),s=!0;break}i+=e[o++]}if(s)continue;if(t){a(`Unbalanced pattern at ${r}`);continue}if(!i){a(`Missing pattern at ${r}`);continue}n.push({type:`REGEX`,index:r,value:i}),r=o;continue}n.push({type:`CHAR`,index:r,value:e[r++]})}return n.push({type:`END`,index:r,value:``}),n}SF(EF,`lexer`);function DF(e,t={}){let n=EF(e);t.delimiter??=`/#?`,t.prefixes??=`./`;let r=`[^${OF(t.delimiter)}]+?`,i=[],a=0,o=0,s=new Set,c=SF(e=>{if(o<n.length&&n[o].type===e)return n[o++].value},`tryConsume`),l=SF(()=>c(`OTHER_MODIFIER`)??c(`ASTERISK`),`tryConsumeModifier`),u=SF(e=>{let t=c(e);if(t!==void 0)return t;let{type:r,index:i}=n[o];throw TypeError(`Unexpected ${r} at ${i}, expected ${e}`)},`mustConsume`),d=SF(()=>{let e=``,t;for(;t=c(`CHAR`)??c(`ESCAPED_CHAR`);)e+=t;return e},`consumeText`),f=SF(e=>e,`DefaultEncodePart`),p=t.encodePart||f,m=``,h=SF(e=>{m+=e},`appendToPendingFixedValue`),g=SF(()=>{m.length&&(i.push(new CF(3,``,``,p(m),``,3)),m=``)},`maybeAddPartFromPendingFixedValue`),_=SF((e,t,n,o,c)=>{let l=3;switch(c){case`?`:l=1;break;case`*`:l=0;break;case`+`:l=2;break}if(!t&&!n&&l===3){h(e);return}if(g(),!t&&!n){if(!e)return;i.push(new CF(3,``,``,p(e),``,l));return}let u;u=n?n===`*`?wF:n:r;let d=2;u===r?(d=1,u=``):u===wF&&(d=0,u=``);let f;if(t?f=t:n&&(f=a++),s.has(f))throw TypeError(`Duplicate name '${f}'.`);s.add(f),i.push(new CF(d,f,p(e),u,p(o),l))},`addPart`);for(;o<n.length;){let e=c(`CHAR`),n=c(`NAME`),r=c(`REGEX`);if(!n&&!r&&(r=c(`ASTERISK`)),n||r){let i=e??``;t.prefixes.indexOf(i)===-1&&(h(i),i=``),g();let a=l();_(i,n,r,``,a);continue}let i=e??c(`ESCAPED_CHAR`);if(i){h(i);continue}if(c(`OPEN`)){let e=d(),t=c(`NAME`),n=c(`REGEX`);!t&&!n&&(n=c(`ASTERISK`));let r=d();u(`CLOSE`);let i=l();_(e,t,n,r,i);continue}g(),u(`END`)}return i}SF(DF,`parse`);function OF(e){return e.replace(/([.+*?^${}()[\]|/\\])/g,`\\$1`)}SF(OF,`escapeString`);function kF(e){return e&&e.ignoreCase?`ui`:`u`}SF(kF,`flags`);function AF(e,t,n){return MF(DF(e,n),t,n)}SF(AF,`stringToRegexp`);function jF(e){switch(e){case 0:return`*`;case 1:return`?`;case 2:return`+`;case 3:return``}}SF(jF,`modifierToString`);function MF(e,t,n={}){n.delimiter??=`/#?`,n.prefixes??=`./`,n.sensitive??=!1,n.strict??=!1,n.end??=!0,n.start??=!0,n.endsWith=``;let r=n.start?`^`:``;for(let i of e){if(i.type===3){i.modifier===3?r+=OF(i.value):r+=`(?:${OF(i.value)})${jF(i.modifier)}`;continue}t&&t.push(i.name);let e=`[^${OF(n.delimiter)}]+?`,a=i.value;if(i.type===1?a=e:i.type===0&&(a=wF),!i.prefix.length&&!i.suffix.length){i.modifier===3||i.modifier===1?r+=`(${a})${jF(i.modifier)}`:r+=`((?:${a})${jF(i.modifier)})`;continue}if(i.modifier===3||i.modifier===1){r+=`(?:${OF(i.prefix)}(${a})${OF(i.suffix)})`,r+=jF(i.modifier);continue}r+=`(?:${OF(i.prefix)}`,r+=`((?:${a})(?:`,r+=OF(i.suffix),r+=OF(i.prefix),r+=`(?:${a}))*)${OF(i.suffix)})`,i.modifier===0&&(r+=`?`)}let i=`[${OF(n.endsWith)}]|$`,a=`[${OF(n.delimiter)}]`;if(n.end)return n.strict||(r+=`${a}?`),n.endsWith.length?r+=`(?=${i})`:r+=`$`,new RegExp(r,kF(n));n.strict||(r+=`(?:${a}(?=${i}))?`);let o=!1;if(e.length){let t=e[e.length-1];t.type===3&&t.modifier===3&&(o=n.delimiter.indexOf(t)>-1)}return o||(r+=`(?=${a}|${i})`),new RegExp(r,kF(n))}SF(MF,`partsToRegexp`);var NF={delimiter:``,prefixes:``,sensitive:!0,strict:!0},die={delimiter:`.`,prefixes:``,sensitive:!0,strict:!0},fie={delimiter:`/`,prefixes:`/`,sensitive:!0,strict:!0};function PF(e,t){return e.length?e[0]===`/`?!0:!t||e.length<2?!1:(e[0]==`\\`||e[0]==`{`)&&e[1]==`/`:!1}SF(PF,`isAbsolutePathname`);function FF(e,t){return e.startsWith(t)?e.substring(t.length,e.length):e}SF(FF,`maybeStripPrefix`);function IF(e,t){return e.endsWith(t)?e.substr(0,e.length-t.length):e}SF(IF,`maybeStripSuffix`);function LF(e){return!e||e.length<2?!1:e[0]===`[`||(e[0]===`\\`||e[0]===`{`)&&e[1]===`[`}SF(LF,`treatAsIPv6Hostname`);var RF=[`ftp`,`file`,`http`,`https`,`ws`,`wss`];function zF(e){if(!e)return!0;for(let t of RF)if(e.test(t))return!0;return!1}SF(zF,`isSpecialScheme`);function BF(e,t){if(e=FF(e,`#`),t||e===``)return e;let n=new URL(`https://example.com`);return n.hash=e,n.hash?n.hash.substring(1,n.hash.length):``}SF(BF,`canonicalizeHash`);function VF(e,t){if(e=FF(e,`?`),t||e===``)return e;let n=new URL(`https://example.com`);return n.search=e,n.search?n.search.substring(1,n.search.length):``}SF(VF,`canonicalizeSearch`);function HF(e,t){return t||e===``?e:LF(e)?$F(e):QF(e)}SF(HF,`canonicalizeHostname`);function UF(e,t){if(t||e===``)return e;let n=new URL(`https://example.com`);return n.password=e,n.password}SF(UF,`canonicalizePassword`);function WF(e,t){if(t||e===``)return e;let n=new URL(`https://example.com`);return n.username=e,n.username}SF(WF,`canonicalizeUsername`);function GF(e,t,n){if(n||e===``)return e;if(t&&!RF.includes(t))return new URL(`${t}:${e}`).pathname;let r=e[0]==`/`;return e=new URL(r?e:`/-`+e,`https://example.com`).pathname,r||(e=e.substring(2,e.length)),e}SF(GF,`canonicalizePathname`);function KF(e,t,n){return JF(t)===e&&(e=``),n||e===``?e:eI(e)}SF(KF,`canonicalizePort`);function qF(e,t){return e=IF(e,`:`),t||e===``?e:YF(e)}SF(qF,`canonicalizeProtocol`);function JF(e){switch(e){case`ws`:case`http`:return`80`;case`wws`:case`https`:return`443`;case`ftp`:return`21`;default:return``}}SF(JF,`defaultPortForProtocol`);function YF(e){if(e===``)return e;if(/^[-+.A-Za-z0-9]*$/.test(e))return e.toLowerCase();throw TypeError(`Invalid protocol '${e}'.`)}SF(YF,`protocolEncodeCallback`);function XF(e){if(e===``)return e;let t=new URL(`https://example.com`);return t.username=e,t.username}SF(XF,`usernameEncodeCallback`);function ZF(e){if(e===``)return e;let t=new URL(`https://example.com`);return t.password=e,t.password}SF(ZF,`passwordEncodeCallback`);function QF(e){if(e===``)return e;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(e))throw TypeError(`Invalid hostname '${e}'`);let t=new URL(`https://example.com`);return t.hostname=e,t.hostname}SF(QF,`hostnameEncodeCallback`);function $F(e){if(e===``)return e;if(/[^0-9a-fA-F[\]:]/g.test(e))throw TypeError(`Invalid IPv6 hostname '${e}'`);return e.toLowerCase()}SF($F,`ipv6HostnameEncodeCallback`);function eI(e){if(e===``||/^[0-9]*$/.test(e)&&parseInt(e)<=65535)return e;throw TypeError(`Invalid port '${e}'.`)}SF(eI,`portEncodeCallback`);function tI(e){if(e===``)return e;let t=new URL(`https://example.com`);return t.pathname=e[0]===`/`?e:`/-`+e,e[0]===`/`?t.pathname:t.pathname.substring(2,t.pathname.length)}SF(tI,`standardURLPathnameEncodeCallback`);function nI(e){return e===``?e:new URL(`data:${e}`).pathname}SF(nI,`pathURLPathnameEncodeCallback`);function rI(e){if(e===``)return e;let t=new URL(`https://example.com`);return t.search=e,t.search.substring(1,t.search.length)}SF(rI,`searchEncodeCallback`);function iI(e){if(e===``)return e;let t=new URL(`https://example.com`);return t.hash=e,t.hash.substring(1,t.hash.length)}SF(iI,`hashEncodeCallback`);var aI=class{#e;#t=[];#n={};#r=0;#i=1;#a=0;#o=0;#s=0;#c=0;#l=!1;constructor(e){this.#e=e}get result(){return this.#n}parse(){for(this.#t=EF(this.#e,!0);this.#r<this.#t.length;this.#r+=this.#i){if(this.#i=1,this.#t[this.#r].type===`END`){if(this.#o===0){this.#f(),this.#C()?this.#u(9,1):this.#S()?this.#u(8,1):this.#u(7,0);continue}else if(this.#o===2){this.#p(5);continue}this.#u(10,0);break}if(this.#s>0)if(this.#T())--this.#s;else continue;if(this.#w()){this.#s+=1;continue}switch(this.#o){case 0:this.#g()&&this.#p(1);break;case 1:if(this.#g()){this.#k();let e=7,t=1;this.#_()?(e=2,t=3):this.#l&&(e=2),this.#u(e,t)}break;case 2:this.#v()?this.#p(3):(this.#x()||this.#S()||this.#C())&&this.#p(5);break;case 3:this.#y()?this.#u(4,1):this.#v()&&this.#u(5,1);break;case 4:this.#v()&&this.#u(5,1);break;case 5:this.#E()?this.#c+=1:this.#D()&&--this.#c,this.#b()&&!this.#c?this.#u(6,1):this.#x()?this.#u(7,0):this.#S()?this.#u(8,1):this.#C()&&this.#u(9,1);break;case 6:this.#x()?this.#u(7,0):this.#S()?this.#u(8,1):this.#C()&&this.#u(9,1);break;case 7:this.#S()?this.#u(8,1):this.#C()&&this.#u(9,1);break;case 8:this.#C()&&this.#u(9,1);break;case 9:break;case 10:break}}this.#n.hostname!==void 0&&this.#n.port===void 0&&(this.#n.port=``)}#u(e,t){switch(this.#o){case 0:break;case 1:this.#n.protocol=this.#O();break;case 2:break;case 3:this.#n.username=this.#O();break;case 4:this.#n.password=this.#O();break;case 5:this.#n.hostname=this.#O();break;case 6:this.#n.port=this.#O();break;case 7:this.#n.pathname=this.#O();break;case 8:this.#n.search=this.#O();break;case 9:this.#n.hash=this.#O();break;case 10:break}this.#o!==0&&e!==10&&([1,2,3,4].includes(this.#o)&&[6,7,8,9].includes(e)&&(this.#n.hostname??=``),[1,2,3,4,5,6].includes(this.#o)&&[8,9].includes(e)&&(this.#n.pathname??=this.#l?`/`:``),[1,2,3,4,5,6,7].includes(this.#o)&&e===9&&(this.#n.search??=``)),this.#d(e,t)}#d(e,t){this.#o=e,this.#a=this.#r+t,this.#r+=t,this.#i=0}#f(){this.#r=this.#a,this.#i=0}#p(e){this.#f(),this.#o=e}#m(e){return e<0&&(e=this.#t.length-e),e<this.#t.length?this.#t[e]:this.#t[this.#t.length-1]}#h(e,t){let n=this.#m(e);return n.value===t&&(n.type===`CHAR`||n.type===`ESCAPED_CHAR`||n.type===`INVALID_CHAR`)}#g(){return this.#h(this.#r,`:`)}#_(){return this.#h(this.#r+1,`/`)&&this.#h(this.#r+2,`/`)}#v(){return this.#h(this.#r,`@`)}#y(){return this.#h(this.#r,`:`)}#b(){return this.#h(this.#r,`:`)}#x(){return this.#h(this.#r,`/`)}#S(){if(this.#h(this.#r,`?`))return!0;if(this.#t[this.#r].value!==`?`)return!1;let e=this.#m(this.#r-1);return e.type!==`NAME`&&e.type!==`REGEX`&&e.type!==`CLOSE`&&e.type!==`ASTERISK`}#C(){return this.#h(this.#r,`#`)}#w(){return this.#t[this.#r].type==`OPEN`}#T(){return this.#t[this.#r].type==`CLOSE`}#E(){return this.#h(this.#r,`[`)}#D(){return this.#h(this.#r,`]`)}#O(){let e=this.#t[this.#r],t=this.#m(this.#a).index;return this.#e.substring(t,e.index)}#k(){let e={};Object.assign(e,NF),e.encodePart=YF;let t=AF(this.#O(),void 0,e);this.#l=zF(t)}};SF(aI,`Parser`);var oI=[`protocol`,`username`,`password`,`hostname`,`port`,`pathname`,`search`,`hash`],sI=`*`;function cI(e,t){if(typeof e!=`string`)throw TypeError(`parameter 1 is not of type 'string'.`);let n=new URL(e,t);return{protocol:n.protocol.substring(0,n.protocol.length-1),username:n.username,password:n.password,hostname:n.hostname,port:n.port,pathname:n.pathname,search:n.search===``?void 0:n.search.substring(1,n.search.length),hash:n.hash===``?void 0:n.hash.substring(1,n.hash.length)}}SF(cI,`extractValues`);function lI(e,t){return t?dI(e):e}SF(lI,`processBaseURLString`);function uI(e,t,n){let r;if(typeof t.baseURL==`string`)try{r=new URL(t.baseURL),t.protocol===void 0&&(e.protocol=lI(r.protocol.substring(0,r.protocol.length-1),n)),!n&&t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.username===void 0&&(e.username=lI(r.username,n)),!n&&t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.username===void 0&&t.password===void 0&&(e.password=lI(r.password,n)),t.protocol===void 0&&t.hostname===void 0&&(e.hostname=lI(r.hostname,n)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&(e.port=lI(r.port,n)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.pathname===void 0&&(e.pathname=lI(r.pathname,n)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.pathname===void 0&&t.search===void 0&&(e.search=lI(r.search.substring(1,r.search.length),n)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.pathname===void 0&&t.search===void 0&&t.hash===void 0&&(e.hash=lI(r.hash.substring(1,r.hash.length),n))}catch{throw TypeError(`invalid baseURL '${t.baseURL}'.`)}if(typeof t.protocol==`string`&&(e.protocol=qF(t.protocol,n)),typeof t.username==`string`&&(e.username=WF(t.username,n)),typeof t.password==`string`&&(e.password=UF(t.password,n)),typeof t.hostname==`string`&&(e.hostname=HF(t.hostname,n)),typeof t.port==`string`&&(e.port=KF(t.port,e.protocol,n)),typeof t.pathname==`string`){if(e.pathname=t.pathname,r&&!PF(e.pathname,n)){let t=r.pathname.lastIndexOf(`/`);t>=0&&(e.pathname=lI(r.pathname.substring(0,t+1),n)+e.pathname)}e.pathname=GF(e.pathname,e.protocol,n)}return typeof t.search==`string`&&(e.search=VF(t.search,n)),typeof t.hash==`string`&&(e.hash=BF(t.hash,n)),e}SF(uI,`applyInit`);function dI(e){return e.replace(/([+*?:{}()\\])/g,`\\$1`)}SF(dI,`escapePatternString`);function fI(e){return e.replace(/([.+*?^${}()[\]|/\\])/g,`\\$1`)}SF(fI,`escapeRegexpString`);function pI(e,t){t.delimiter??=`/#?`,t.prefixes??=`./`,t.sensitive??=!1,t.strict??=!1,t.end??=!0,t.start??=!0,t.endsWith=``;let n=`[^${fI(t.delimiter)}]+?`,r=/[$_\u200C\u200D\p{ID_Continue}]/u,i=``;for(let a=0;a<e.length;++a){let o=e[a];if(o.type===3){if(o.modifier===3){i+=dI(o.value);continue}i+=`{${dI(o.value)}}${jF(o.modifier)}`;continue}let s=o.hasCustomName(),c=!!o.suffix.length||!!o.prefix.length&&(o.prefix.length!==1||!t.prefixes.includes(o.prefix)),l=a>0?e[a-1]:null,u=a<e.length-1?e[a+1]:null;if(!c&&s&&o.type===1&&o.modifier===3&&u&&!u.prefix.length&&!u.suffix.length)if(u.type===3){let e=u.value.length>0?u.value[0]:``;c=r.test(e)}else c=!u.hasCustomName();if(!c&&!o.prefix.length&&l&&l.type===3){let e=l.value[l.value.length-1];c=t.prefixes.includes(e)}c&&(i+=`{`),i+=dI(o.prefix),s&&(i+=`:${o.name}`),o.type===2?i+=`(${o.value})`:o.type===1?s||(i+=`(${n})`):o.type===0&&(!s&&(!l||l.type===3||l.modifier!==3||c||o.prefix!==``)?i+=`*`:i+=`(.*)`),o.type===1&&s&&o.suffix.length&&r.test(o.suffix[0])&&(i+=`\\`),i+=dI(o.suffix),c&&(i+=`}`),o.modifier!==3&&(i+=jF(o.modifier))}return i}SF(pI,`partsToPattern`);var mI=class{#e;#t={};#n={};#r={};#i={};#a=!1;constructor(e={},t,n){try{let r;if(typeof t==`string`?r=t:n=t,typeof e==`string`){let t=new aI(e);if(t.parse(),e=t.result,r===void 0&&typeof e.protocol!=`string`)throw TypeError(`A base URL must be provided for a relative constructor string.`);e.baseURL=r}else{if(!e||typeof e!=`object`)throw TypeError(`parameter 1 is not of type 'string' and cannot convert to dictionary.`);if(r)throw TypeError(`parameter 1 is not of type 'string'.`)}typeof n>`u`&&(n={ignoreCase:!1});let i={ignoreCase:n.ignoreCase===!0},a={pathname:sI,protocol:sI,username:sI,password:sI,hostname:sI,port:sI,search:sI,hash:sI};this.#e=uI(a,e,!0),JF(this.#e.protocol)===this.#e.port&&(this.#e.port=``);let o;for(o of oI){if(!(o in this.#e))continue;let e={},t=this.#e[o];switch(this.#n[o]=[],o){case`protocol`:Object.assign(e,NF),e.encodePart=YF;break;case`username`:Object.assign(e,NF),e.encodePart=XF;break;case`password`:Object.assign(e,NF),e.encodePart=ZF;break;case`hostname`:Object.assign(e,die),LF(t)?e.encodePart=$F:e.encodePart=QF;break;case`port`:Object.assign(e,NF),e.encodePart=eI;break;case`pathname`:zF(this.#t.protocol)?(Object.assign(e,fie,i),e.encodePart=tI):(Object.assign(e,NF,i),e.encodePart=nI);break;case`search`:Object.assign(e,NF,i),e.encodePart=rI;break;case`hash`:Object.assign(e,NF,i),e.encodePart=iI;break}try{this.#i[o]=DF(t,e),this.#t[o]=MF(this.#i[o],this.#n[o],e),this.#r[o]=pI(this.#i[o],e),this.#a=this.#a||this.#i[o].some(e=>e.type===2)}catch{throw TypeError(`invalid ${o} pattern '${this.#e[o]}'.`)}}}catch(e){throw TypeError(`Failed to construct 'URLPattern': ${e.message}`)}}get[Symbol.toStringTag](){return`URLPattern`}test(e={},t){let n={pathname:``,protocol:``,username:``,password:``,hostname:``,port:``,search:``,hash:``};if(typeof e!=`string`&&t)throw TypeError(`parameter 1 is not of type 'string'.`);if(typeof e>`u`)return!1;try{n=typeof e==`object`?uI(n,e,!1):uI(n,cI(e,t),!1)}catch{return!1}let r;for(r of oI)if(!this.#t[r].exec(n[r]))return!1;return!0}exec(e={},t){let n={pathname:``,protocol:``,username:``,password:``,hostname:``,port:``,search:``,hash:``};if(typeof e!=`string`&&t)throw TypeError(`parameter 1 is not of type 'string'.`);if(typeof e>`u`)return;try{n=typeof e==`object`?uI(n,e,!1):uI(n,cI(e,t),!1)}catch{return null}let r={};t?r.inputs=[e,t]:r.inputs=[e];let i;for(i of oI){let e=this.#t[i].exec(n[i]);if(!e)return null;let t={};for(let[n,r]of this.#n[i].entries())(typeof r==`string`||typeof r==`number`)&&(t[r]=e[n+1]);r[i]={input:n[i]??``,groups:t}}return r}static compareComponent(e,t,n){let r=SF((e,t)=>{for(let n of[`type`,`modifier`,`prefix`,`value`,`suffix`]){if(e[n]<t[n])return-1;if(e[n]!==t[n])return 1}return 0},`comparePart`),i=new CF(3,``,``,``,``,3),a=new CF(0,``,``,``,``,3),o=SF((e,t)=>{let n=0;for(;n<Math.min(e.length,t.length);++n){let i=r(e[n],t[n]);if(i)return i}return e.length===t.length?0:r(e[n]??i,t[n]??i)},`comparePartList`);return!t.#r[e]&&!n.#r[e]?0:t.#r[e]&&!n.#r[e]?o(t.#i[e],[a]):!t.#r[e]&&n.#r[e]?o([a],n.#i[e]):o(t.#i[e],n.#i[e])}get protocol(){return this.#r.protocol}get username(){return this.#r.username}get password(){return this.#r.password}get hostname(){return this.#r.hostname}get port(){return this.#r.port}get pathname(){return this.#r.pathname}get search(){return this.#r.search}get hash(){return this.#r.hash}get hasRegExpGroups(){return this.#a}};SF(mI,`URLPattern`),globalThis.URLPattern||(globalThis.URLPattern=mI);function*pie(e){let t=null;for(let n of e)t!=null&&t.type===V.RemoveFromQueue&&n.type===V.AddToQueue&&t.loc===n.loc?t=null:(t!==null&&(yield t),t=n);t!==null&&(yield t)}function hI(e,t){return e.containerId?`${t} fragment ${e.containerId.slice(0,8)}`:e.pal>0?`${t} ${e.pal}`:t}function mie(e,t){let n=hI(e,t);if(e.startofcycle)return`${n} started cycle`;let r=e.containerIds?.length??0;return`${n} completed cycle${r>0?` from ${r} UUID fragment${r===1?``:`s`}`:``}`}var gI=G(`span`,{shouldForwardProp:e=>e.toString()[0]!==`$`})(({$type:e})=>{switch(e){case`machine`:return{color:`#1565C0`};case`loadStation`:return{color:`#795548`};case`pallet`:return{color:`#00695C`};case`queue`:return{color:`#6A1B9A`};case`inspectionNotSignaled`:return{color:`#4527A0`};case`inspectionSignaled`:return{color:`red`};case`closeoutFailed`:return{color:`red`}}});function hie(e,t){let n=ok(t.basketName);switch(e.type){case V.LoadUnloadCycle:return e.startofcycle?`Start `+e.result.charAt(0).toUpperCase()+e.result.substring(1).toLowerCase():`End `+e.result.charAt(0).toUpperCase()+e.result.substring(1).toLowerCase();case V.BasketLoadUnload:return e.program===`LOAD`?`${n} Load`:`${n} Unload`;case V.BasketCycle:return`${n} Cycle`;case V.BasketInLocation:return e.startofcycle?`Arrive`:`Depart`;case V.BasketIdentityHint:return`${n} Identity Hint`;case V.BasketContentSnapshot:return`${n} Content Snapshot`;case V.MachineCycle:return e.startofcycle?`Start Cycle`:`End Cycle`;case V.PartMark:return`Serial`;case V.OrderAssignment:return`Workorder`;case V.Inspection:case V.InspectionForce:return`Signal`;case V.PalletCycle:return`Pallet Cycle`;case V.WorkorderComment:return`Workorder`;case V.CloseOut:return`CloseOut`;case V.InspectionResult:return`Inspection`;case V.AddToQueue:return`Queue`;case V.RemoveFromQueue:return`Queue`;case V.PalletInStocker:return`Stocker`;case V.PalletOnRotaryInbound:return`Rotary`;case V.SignalQuarantine:return`Quarantine`;case V.SwapMaterialOnPallet:return`Swap Serial`;case V.InvalidateCycle:return`Invalidate Cycle`;case V.Rebooking:return`Rebooking`;case V.CancelRebooking:return`Cancel Rebooking`;default:return`Message`}}function _I(e){return e.details?.PalletCycleInvalidated===`1`}function vI(e){return e.length>1?e[0].numproc==1?`${e[0].part} x${e.length}`:`${e[0].part}-${Q.of(e).map(e=>e.proc).distinctAndSortBy(e=>e).toRArray().join(`&`)} x${e.length}`:e.length==1?e[0].numproc==1?e[0].part:`${e[0].part}-${e[0].proc}`:``}function yI(e){return e.length>1?`${e[0].part} x${e.length}`:e.length===1?e[0].part:``}function gie(e,t){let n=e.entry;switch(n.type){case V.LoadUnloadCycle:return(0,H.jsxs)(`span`,{children:[vI(n.material),` on`,` `,(0,H.jsxs)(gI,{$type:`pallet`,children:[`pallet `,n.pal]}),` at`,` `,(0,H.jsx)(gI,{$type:`loadStation`,children:ik(n.locnum,t.loadStationNames)})]});case V.BasketLoadUnload:{let e=ok(t.basketName);return(0,H.jsxs)(`span`,{children:[vI(n.material),` `,n.program===`LOAD`?`loaded onto`:`unloaded from`,` `,(0,H.jsx)(gI,{$type:`pallet`,children:hI(n,e)}),` at`,` `,(0,H.jsx)(gI,{$type:`loadStation`,children:ik(n.locnum,t.loadStationNames)})]})}case V.BasketCycle:return(0,H.jsx)(`span`,{children:mie(n,ok(t.basketName))});case V.BasketInLocation:{let e=ok(t.basketName);return n.startofcycle?(0,H.jsxs)(`span`,{children:[hI(n,e),` arrived at `,n.loc,n.locnum>0?` position ${n.locnum}`:``]}):(0,H.jsxs)(`span`,{children:[hI(n,e),` departed from `,n.loc,n.locnum>0?` position ${n.locnum}`:``]})}case V.BasketIdentityHint:{let e=ok(t.basketName);return(0,H.jsxs)(`span`,{children:[hI(n,e),` presently associated with `,e,` `,n.pal]})}case V.BasketContentSnapshot:return(0,H.jsxs)(`span`,{children:[hI(n,ok(t.basketName)),` contained `,vI(n.material)]});case V.MachineCycle:return(0,H.jsxs)(`span`,{children:[vI(n.material),` on`,` `,(0,H.jsxs)(gI,{$type:`pallet`,children:[`pallet `,n.pal]}),` at`,` `,(0,H.jsxs)(gI,{$type:`machine`,children:[n.loc,` `,n.locnum.toString()]}),n.program&&n.program!==``?(0,H.jsxs)(`span`,{children:[` with program `,n.program]}):void 0]});case V.PartMark:return(0,H.jsxs)(`span`,{children:[vI(n.material),` marked with `,n.result]});case V.OrderAssignment:return(0,H.jsxs)(`span`,{children:[vI(n.material),` assigned to workorder `,n.result]});case V.PalletCycle:return n.startofcycle?(0,H.jsxs)(`span`,{children:[`Pallet `,n.pal,` started route`]}):(0,H.jsxs)(`span`,{children:[`Pallet `,n.pal,` completed route`]});case V.Inspection:{let e=(n.details||{}).InspectionType||``;return n.result.toLowerCase()===`true`||n.result===`1`?(0,H.jsxs)(`span`,{children:[vI(n.material),` signaled for inspection`,` `,(0,H.jsx)(gI,{$type:`inspectionSignaled`,children:e})]}):(0,H.jsxs)(`span`,{children:[vI(n.material),` skipped inspection`,` `,(0,H.jsx)(gI,{$type:`inspectionNotSignaled`,children:e})]})}case V.InspectionForce:{let e=n.program;return n.result.toLowerCase()===`true`||n.result===`1`?(0,H.jsxs)(`span`,{children:[vI(n.material),` declared for inspection`,` `,(0,H.jsx)(gI,{$type:`inspectionSignaled`,children:e})]}):(0,H.jsxs)(`span`,{children:[vI(n.material),` passed over for inspection`,` `,(0,H.jsx)(gI,{$type:`inspectionNotSignaled`,children:e})]})}case V.WorkorderComment:return(0,H.jsxs)(`span`,{children:[`Workorder `,n.result,` Comment`]});case V.InspectionResult:return n.result.toLowerCase()===`false`?(0,H.jsxs)(gI,{$type:`inspectionSignaled`,children:[n.program,` Failed`]}):(0,H.jsxs)(gI,{$type:`inspectionSignaled`,children:[n.program,` Succeeded`]});case V.CloseOut:return n.result.toLowerCase()===`failed`?(0,H.jsxs)(gI,{$type:`closeoutFailed`,children:[n.program&&n.program!==``?n.program:`CloseOut`,` Failed`]}):(0,H.jsxs)(`span`,{children:[n.program&&n.program!==``?n.program:`CloseOut`,` Completed`]});case V.AddToQueue:switch(n.program){case`Unloaded`:return(0,H.jsxs)(`span`,{children:[yI(n.material),` unloaded into queue`,` `,(0,H.jsx)(gI,{$type:`queue`,children:n.loc})]});case`SetByOperator`:return(0,H.jsxs)(`span`,{children:[yI(n.material),` set manually into queue`,` `,(0,H.jsx)(gI,{$type:`queue`,children:n.loc})]});case`Quarantine`:return(0,H.jsxs)(`span`,{children:[yI(n.material),` quarantined into queue`,` `,(0,H.jsx)(gI,{$type:`queue`,children:n.loc})]});case`SwapMaterial`:return(0,H.jsxs)(`span`,{children:[yI(n.material),` swapped off pallet into queue`,` `,(0,H.jsx)(gI,{$type:`queue`,children:n.loc})]});case`MaterialMissingOnPallet`:return(0,H.jsxs)(`span`,{children:[yI(n.material),` removed from cell controller, added to queue`,` `,(0,H.jsx)(gI,{$type:`queue`,children:n.loc})]});default:return(0,H.jsxs)(`span`,{children:[yI(n.material),` added to queue`,` `,(0,H.jsx)(gI,{$type:`queue`,children:n.loc}),n.program&&n.program!==``?` (`+n.program+`)`:void 0]})}case V.RemoveFromQueue:return(0,H.jsxs)(`span`,{children:[yI(n.material),` removed from queue`,` `,(0,H.jsx)(gI,{$type:`queue`,children:n.loc})]});case V.PalletInStocker:return n.startofcycle?(0,H.jsxs)(`span`,{children:[(0,H.jsxs)(gI,{$type:`pallet`,children:[`Pallet `,n.pal]}),` arrived at stocker`,` `,n.locnum]}):(0,H.jsxs)(`span`,{children:[(0,H.jsxs)(gI,{$type:`pallet`,children:[`Pallet `,n.pal]}),` departed stocker`,` `,n.locnum]});case V.PalletOnRotaryInbound:return n.startofcycle?(0,H.jsxs)(`span`,{children:[(0,H.jsxs)(gI,{$type:`pallet`,children:[`Pallet `,n.pal]}),` arrived at`,` `,(0,H.jsxs)(gI,{$type:`machine`,children:[n.loc,` `,n.locnum.toString()]})]}):n.result==`RotateIntoWorktable`?(0,H.jsxs)(`span`,{children:[(0,H.jsxs)(gI,{$type:`pallet`,children:[`Pallet `,n.pal]}),` rotated into`,` `,(0,H.jsxs)(gI,{$type:`machine`,children:[n.loc,` `,n.locnum.toString()]}),` `,`worktable`]}):(0,H.jsxs)(`span`,{children:[(0,H.jsxs)(gI,{$type:`pallet`,children:[`Pallet `,n.pal]}),` left`,` `,(0,H.jsxs)(gI,{$type:`machine`,children:[n.loc,` `,n.locnum.toString()]})]});case V.SignalQuarantine:return(0,H.jsxs)(`span`,{children:[vI(n.material),` signaled for quarantine after unload`]});case V.SwapMaterialOnPallet:return(0,H.jsx)(`span`,{children:n.result});case V.InvalidateCycle:return(0,H.jsx)(`span`,{children:n.result});case V.Rebooking:return(0,H.jsxs)(`span`,{children:[`Rebooking requested with ID `,n.result]});case V.CancelRebooking:return(0,H.jsxs)(`span`,{children:[`Rebooking `,n.result,` canceled`]});default:return(0,H.jsx)(`span`,{children:n.result})}}function _ie(e){let t=[];if(e.details&&e.details.operator&&t.push({name:`Operator`,value:e.details.operator}),e.details&&e.details.note&&t.push({name:`Note`,value:e.details.note}),e.tooluse)for(let n of e.tooluse){let e=null;if(n.toolUseDuringCycle&&n.toolUseDuringCycle!==``&&(e=BO(n.toolUseDuringCycle).toFixed(1)+` minutes used during cycle.`,n.totalToolUseAtEndOfCycle&&n.configuredToolLife&&n.totalToolUseAtEndOfCycle!==``&&n.configuredToolLife!==``)){let t=zO(n.totalToolUseAtEndOfCycle),r=zO(n.configuredToolLife),i=t/r;e+=` Total use at end of cycle: ${(t/60).toFixed(1)}/${(r/60).toFixed(1)} minutes (${(i*100).toFixed(0)}%).`}if(n.toolUseCountDuringCycle&&n.toolUseCountDuringCycle>0&&(e=(e===null?``:` | `)+`${n.toolUseCountDuringCycle} use${n.toolUseCountDuringCycle>1?`s`:``} during cycle.`,n.totalToolUseCountAtEndOfCycle&&n.configuredToolLifeCount&&(e+=` Total use count at end of cycle: ${n.totalToolUseCountAtEndOfCycle}/${n.configuredToolLifeCount} (${(n.totalToolUseCountAtEndOfCycle/n.configuredToolLifeCount*100).toFixed(0)}%).`)),e!==null){let r=n.pocket>0?`${n.tool} [${n.pocket}]`:n.tool,i=n.toolSerialAtEndOfCycle??n.toolSerialAtStartOfCycle;i&&i!==``&&(r+=` (${i})`),t.push({name:r,value:e})}}return t}var vie=[V.AddToQueue,V.RemoveFromQueue,V.LoadUnloadCycle,V.BasketLoadUnload,V.MachineCycle],yie=G(Vw,{shouldForwardProp:e=>e.toString()[0]!==`$`})(({$highlightProc:e,$invalidCycle:t})=>({...e&&{backgroundColor:`#eeeeee`},...t&&{textDecoration:`line-through`}})),bie=(0,L.memo)(function(e){let t=_ie(e.entry),n=e.highlightProcsGreaterOrEqualTo,r=R(br);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(yie,{$highlightProc:n!==void 0&&e.entry.material.findIndex(e=>e.proc>=n)>=0&&vie.indexOf(e.entry.type)>=0,$invalidCycle:_I(e.entry),children:[(0,H.jsx)(Z,{size:`small`,children:e.entry.endUTC.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`2-digit`})}),(0,H.jsx)(Z,{size:`small`,children:e.entry.endUTC.toLocaleTimeString(void 0,{hour:`numeric`,minute:`2-digit`})}),(0,H.jsx)(Z,{size:`small`,children:hie(e.entry,r)}),(0,H.jsx)(Z,{size:`small`,children:gie(e,r)}),(0,H.jsx)(Z,{padding:`checkbox`,children:t.length>0?(0,H.jsx)(Um,{style:{transition:`all ease 200ms`,transform:e.entry.counter===e.detailLogCounter?`rotate(90deg)`:`none`},onClick:t=>{e.setDetail(e.entry.counter===e.detailLogCounter?null:e.entry.counter),t.stopPropagation()},size:`small`,children:(0,H.jsx)(mre,{fontSize:`inherit`})}):void 0})]}),t.length>0&&e.entry.counter===e.detailLogCounter?(0,H.jsx)(Vw,{children:(0,H.jsx)(Z,{colSpan:5,children:(0,H.jsx)(`ul`,{children:t.map((e,t)=>(0,H.jsxs)(`li`,{children:[e.name,`: `,e.value]},t))})})}):void 0]})}),bI=(0,L.memo)(function(e){let[t,n]=(0,L.useState)(null);return(0,H.jsxs)(jw,{children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:`Date`}),(0,H.jsx)(Z,{children:`Time`}),(0,H.jsx)(Z,{children:`Type`}),(0,H.jsx)(Z,{children:`Details`}),(0,H.jsx)(Z,{padding:`checkbox`,children:e.copyToClipboard?(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{onClick:()=>Jk(e.entries),style:{height:`25px`,paddingTop:0,paddingBottom:0},size:`large`,children:(0,H.jsx)(uT,{})})}):void 0})]})}),(0,H.jsx)(Pw,{children:Array.from(pie(e.entries)).map((r,i)=>(0,H.jsx)(bie,{entry:r,detailLogCounter:t,setDetail:n,highlightProcsGreaterOrEqualTo:e.highlightProcsGreaterOrEqualTo},i))})]})}),xI=P(null),SI=P(e=>e(xI),(e,t,n)=>{n===null?(t(xI,null),t(jI,[])):t(xI,n)}),CI=P(async e=>{let t=e(xI);if(t&&t.type===`Barcode`){if(Ht===void 0)return null;let n=e(KI),r=t.toQueue?[t.toQueue]:n.route===$.Station_LoadMonitor||n.route===$.Station_Queues?n.queues:null;return await Ht.parseBarcode(t.barcode,r)}else return null}),wI=P(async e=>(await e(CI))?.potentialNewMaterial??null),TI=P(async e=>{let t=e(xI);if(t===null)return null;switch(t.type){case`InProcMat`:return t.inproc;case`MatSummary`:return t.summary;case`MatDetails`:return t.details;case`LogMat`:return{materialID:t.logMat.id,partName:t.logMat.part,serial:t.logMat.serial,workorderId:t.logMat.workorder};case`Barcode`:{let t=await e(CI);return t?.existingMaterial&&t.existingMaterial.materialID>=0?t.existingMaterial:null}case`ManuallyEnteredSerial`:case`AddMatWithEnteredSerial`:return Wt===void 0?null:(await Wt.materialForSerial(t.serial))?.[0]??null}}),EI=OO(TI,e=>e??null);function DI(e){return OO(P(t=>t(e).then(e=>({state:`hasData`,data:e}),e=>({state:`hasError`,error:e}))),()=>({state:`loading`}))}var xie=DI(TI),OI=P(async e=>{let t=e(NO),n=e(xI);if(n===null)return null;if(n.type===`InProcMat`)return t.material.find(e=>e.materialID===n.inproc.materialID)??null;let r=(await e(TI))?.materialID??null;return r!==null&&r>=0?t.material.find(e=>e.materialID===r)??null:null}),kI=P(async e=>{let t=e(xI);if(t===null)return null;switch(t.type){case`InProcMat`:return t.inproc.serial??null;case`MatSummary`:return t.summary.serial??null;case`MatDetails`:return t.details.serial??null;case`LogMat`:return t.logMat.serial??null;case`Barcode`:{let t=await e(CI);return t?.existingMaterial?.serial??t?.potentialNewMaterial?.serial??null}case`ManuallyEnteredSerial`:case`AddMatWithEnteredSerial`:return t.serial}});OO(kI,e=>e??null);var Sie=DI(kI),AI=P(async e=>{let t=e(xI);if(t===null)return null;switch(t.type){case`InProcMat`:return t.inproc.workorderId??null;case`MatSummary`:return t.summary.workorderId??null;case`MatDetails`:return t.details.workorder??null;case`LogMat`:return t.logMat.workorder??null;case`Barcode`:{let t=await e(CI);return t?.existingMaterial?.workorder??t?.potentialNewMaterial?.workorder??null}case`ManuallyEnteredSerial`:case`AddMatWithEnteredSerial`:return null}}),jI=P([]),MI=OO(P(async(e,{signal:t})=>{let n=await e(TI);return n===null||Wt===void 0?[]:n.materialID>=0?await Wt.logForMaterial(n.materialID,t):n.serial&&n.serial!==``?await Wt.logForSerial(n.serial):[]}),e=>e??[]),Cie=OO(P(async(e,{signal:t})=>{let n=await e(kI);if(n===null||n===``)return[];let r=[];for(let e of qt)r.push.apply(await e.logForSerial(n,t));return r}),e=>e??[]),wie=P(e=>Q.of(e(MI)).concat(e(jI)).toRArray()),NI=P(e=>{let t=e(jI);return Q.of(e(MI)).concat(e(Cie)).sortBy(e=>e.endUTC.getTime(),e=>e.counter).concat(t).toRArray()}),PI=P(async e=>{let t=await e(TI);if(t===null)return null;let n=e(NI),r=Q.of(n).filter(e=>!_I(e)&&(e.type===V.LoadUnloadCycle||e.type===V.MachineCycle||e.type===V.AddToQueue)).flatMap(e=>e.material).filter(e=>e.id===t.materialID).maxBy(e=>e.proc);return r?{process:r.proc,totalNumProcesses:r.numproc}:null}),FI=P(e=>{let t=e(xI),n=e(NI);if(t===null)return{signaledInspections:[],completedInspections:[]};let r=new Set(t.type===`InProcMat`?t.inproc.signaledInspections:[]),i=new Set;return n.forEach(e=>{switch(e.type){case V.Inspection:if(e.result.toLowerCase()===`true`||e.result===`1`){let t=(e.details||{}).InspectionType;t&&r.add(t)}break;case V.InspectionForce:(e.result.toLowerCase()===`true`||e.result===`1`)&&r.add(e.program);break;case V.InspectionResult:i.add(e.program);break}}),{signaledInspections:Q.of(r).toSortedArray(e=>e),completedInspections:Q.of(i).toSortedArray(e=>e)}}),Tie=P(async e=>{let t=await e(TI);if(t===null||t.partName===``)return[];let n=e(NO)?.workorders??[];return Q.of(n).filter(e=>e.part===t.partName).toSortedArray(e=>e.dueDate.getTime(),e=>-e.priority)});function II(){let[e,t]=(0,L.useState)(!1),n=z(jI);return[(0,L.useCallback)(e=>{t(!0),Wt.setInspectionDecision(e.mat.materialID,e.inspType,1,e.inspect).then(e=>n(t=>[...t,e])).catch(console.log).finally(()=>t(!1))},[n]),e]}function Eie(){let[e,t]=(0,L.useState)(!1);return[(0,L.useCallback)(e=>{t(!0),Wt.recordInspectionCompleted(new Nt({materialID:e.mat.materialID,process:1,inspectionLocationNum:1,inspectionType:e.inspType,success:e.success,active:`PT0S`,elapsed:`PT0S`,extraData:e.operator?{operator:e.operator}:void 0})).catch(console.log).finally(()=>t(!1))},[]),e]}function LI(){let[e,t]=(0,L.useState)(!1);return[(0,L.useCallback)(e=>{t(!0),Wt.recordCloseoutCompleted(new Pt({materialID:e.mat.materialID,process:1,locationNum:1,closeoutType:``,active:`PT0S`,elapsed:`PT0S`,extraData:e.operator?{operator:e.operator}:void 0,failed:e.failed})).catch(console.log).finally(()=>t(!1))},[]),e]}function RI(){let[e,t]=(0,L.useState)(!1),n=z(jI);return[(0,L.useCallback)((e,r)=>{t(!0),Wt.setWorkorder(e.materialID,1,r).then(e=>n(t=>[...t,e])).catch(console.log).finally(()=>t(!1))},[n]),e]}function Die(){let[e,t]=(0,L.useState)(!1),n=z(jI);return[(0,L.useCallback)(e=>{t(!0),Wt.recordOperatorNotes(e.matId,e.process,e.operator,e.notes).then(e=>n(t=>[...t,e])).catch(console.log).finally(()=>t(!1))},[n]),e]}function zI(){let[e,t]=(0,L.useState)(!1),[n,r]=(0,L.useState)(!1);return[(0,L.useCallback)(e=>{t(!0),Ht.printLabel(e.materialId,e.proc).catch(console.log).finally(()=>{t(!1),r(!0)})},[]),e,n]}function Oie(){let[e,t]=(0,L.useState)(!1);return[(0,L.useCallback)(async(e,n)=>{t(!0);try{await Ut.removeMaterialFromAllQueues(e,n??void 0)}finally{t(!1)}},[]),e]}function kie(){let[e,t]=(0,L.useState)(!1);return[(0,L.useCallback)(async(e,n,r)=>{t(!0);try{await Ut.signalMaterialForQuarantine(e,n,r===``?void 0:r)}finally{t(!1)}},[]),e]}function Aie(){let[e,t]=(0,L.useState)(!1);return[(0,L.useCallback)(async(e,n,r)=>{t(!0);try{await Ut.quarantineQueuedMaterial(e,n,r===``?void 0:r)}finally{t(!1)}},[]),e]}function BI(){let[e,t]=(0,L.useState)(!1);return[(0,L.useCallback)(async e=>{t(!0);try{await Ut.setMaterialInQueue(e.materialId,e.operator,new At({queue:e.queue,position:e.queuePosition}))}finally{t(!1)}},[]),e]}function jie(){let[e,t]=(0,L.useState)(!1);return[(0,L.useCallback)(async e=>{t(!0);try{let t=await Ut.addUnprocessedMaterialToQueue(e.jobUnique,e.lastCompletedProcess,e.queue,e.queuePosition,e.operator,e.workorder,e.serial||``);if(t===void 0)throw Error(`No material returned`);return e.onNewMaterial?.(t),t}catch(t){throw e.onError?.(t),t}finally{t(!1)}},[]),e]}function VI(){let[e,t]=(0,L.useState)(!1);return[(0,L.useCallback)(async e=>{t(!0);try{let t=await Ut.addUnallocatedCastingToQueue(e.casting,e.queue,e.quantity,e.operator,e.workorder,[...e.serials||[]]);return e.onNewMaterial?.(t),t}catch(t){throw e.onError?.(t),t}finally{t(!1)}},[]),e]}var $=function(e){return e.ChooseMode=`/`,e.Station_LoadMonitor=`/station/loadunload/:num`,e.Station_InspectionMonitor=`/station/inspection`,e.Station_InspectionMonitorWithType=`/station/inspection/:type`,e.Station_Closeout=`/station/closeout`,e.Station_Queues=`/station/queues`,e.Station_Overview=`/station/overview`,e.Operations_Dashboard=`/operations`,e.Operations_LoadOutliers=`/operations/load-outliers`,e.Operations_LoadHours=`/operations/load-hours`,e.Operations_LoadCycles=`/operations/load-cycles`,e.Operations_MachineOutliers=`/operations/machine-outliers`,e.Operations_MachineHours=`/operations/machine-hours`,e.Operations_MachineCycles=`/operations/machine-cycles`,e.Operations_SystemOverview=`/operations/system-overview`,e.Operations_AllMaterial=`/operations/material`,e.Operations_RecentSchedules=`/operations/recent-schedules`,e.Operations_CurrentWorkorders=`/operations/current-workorders`,e.Operations_Production=`/operations/recent-production`,e.Operations_Tools=`/operations/tools`,e.Operations_Programs=`/operations/programs`,e.Operations_Quality=`/operations/quality`,e.Operations_Inspections=`/operations/inspections`,e.Operations_CloseoutReport=`/operations/closeout`,e.Operations_Rebookings=`/analysis/rebookings`,e.Operations_Parts=`/operations/parts`,e.Engineering_Cycles=`/engineering`,e.Engineering_Hours=`/engineering/hours`,e.Engineering_Outliers=`/engineering/outliers`,e.Quality_Dashboard=`/quality`,e.Quality_Paths=`/quality/paths`,e.Quality_Quarantine=`/quality/quarantine`,e.Tools_Dashboard=`/tools`,e.Tools_Programs=`/tools/programs`,e.Analysis_Buffers=`/analysis/buffers`,e.Analysis_StationOEE=`/analysis/station-oee`,e.Analysis_PartsCompleted=`/analysis/parts-completed`,e.Analysis_MachineCycles=`/analysis/machine-cycles`,e.Analysis_LoadCycles=`/analysis/load-cycles`,e.Analysis_PalletCycles=`/analysis/pallet-cycles`,e.Analysis_BasketCycles=`/analysis/basket-cycles`,e.Analysis_Schedules=`/analysis/schedules`,e.Analysis_Quality=`/analysis/quality`,e.Analysis_ToolReplacements=`/analysis/tool-replacements`,e.Analysis_CostPercents=`/analysis/cost-percents`,e.Analysis_CostPerPiece=`/analysis/cost`,e.Sales_Dashboard=`/sales`,e.Sales_ProjectedUsage=`/sales/projected-usage`,e.VerboseLogging=`/logging`,e.Client_Custom=`/client/:custom+`,e}({}),Mie=Q.ofObject($).map(([,e])=>[e,new URLPattern(e,location.origin)]).append([`/operations/recent-schedules`,new URLPattern(`/operations/completed`,location.origin)]).append([`/station/closeout`,new URLPattern(`/station/wash`,location.origin)]).toRArray();function HI(e){switch(e.route){case`/station/loadunload/:num`:if(e.queues.length>0||e.completed){let t=new URLSearchParams;for(let n of e.queues)t.append(`queue`,n);return e.completed&&t.append(`completed`,`t`),`/station/loadunload/${e.loadNum}?${t.toString()}`}else return`/station/loadunload/${e.loadNum}`;case`/station/inspection/:type`:return`/station/inspection/${encodeURIComponent(e.inspType)}`;case`/station/queues`:if(e.queues.length>0){let t=new URLSearchParams;for(let n of e.queues)t.append(`queue`,n);return`/station/queues?${t.toString()}`}else return`/station/queues`;case`/operations/current-workorders`:if(e.workorder){let t=new URLSearchParams;return t.append(`workorder`,e.workorder),`/operations/current-workorders?${t.toString()}`}else return`/operations/current-workorders`;case`/client/:custom+`:return`/client/`+e.custom.map(e=>encodeURIComponent(e)).join(`/`);default:return e.route}}function UI(e){for(let[t,n]of Mie){let r=n.exec(e.origin+e.pathname)?.pathname?.groups;if(r)switch(t){case`/station/loadunload/:num`:return{route:t,loadNum:parseInt(r.num??`1`),queues:e.searchParams.getAll(`queue`),completed:e.searchParams.has(`completed`)};case`/station/inspection/:type`:{let e=r.type;return e?{route:`/station/inspection/:type`,inspType:e}:{route:`/station/inspection`}}case`/station/queues`:return{route:`/station/queues`,queues:e.searchParams.getAll(`queue`)};case`/operations/current-workorders`:return{route:`/operations/current-workorders`,workorder:e.searchParams.get(`workorder`)??void 0};case`/client/:custom+`:return{route:`/client/:custom+`,custom:r?.custom?.split(`/`)?.map(e=>decodeURIComponent(e))??[]};default:return{route:t}}}return{route:`/`}}var WI=P(UI(new URL(location.href))),GI=P(!1),KI=P(e=>e(WI),(e,t,n)=>{let r=e(GI);t(WI,n),t(SI,null),r||history.pushState(null,``,HI(n))});function Nie({to:e,children:t}){let n=z(KI);return(0,L.createElement)(cb,{href:HI(e),onClick:t=>{t.preventDefault(),t.stopPropagation(),n(e)}},t)}function Pie(){let e=R(GI),t=z(WI);(0,L.useEffect)(()=>{if(e)return;function n(){t(UI(new URL(location.href)))}return addEventListener(`popstate`,n),()=>removeEventListener(`popstate`,n)},[e,t])}function qI(){return R(GI)}function JI(e){(0,L.useEffect)(()=>{document.title=e+` - FMS Insight`},[qI(),e])}function Fie(e){switch(e.route){case`/station/loadunload/:num`:case`/station/inspection`:case`/station/inspection/:type`:case`/station/closeout`:case`/station/queues`:case`/station/overview`:return`https://www.seedtactics.com/docs/fms-insight/client-station-monitor`;case`/operations`:case`/operations/load-outliers`:case`/operations/load-hours`:case`/operations/load-cycles`:case`/operations/system-overview`:case`/operations/material`:case`/operations/recent-schedules`:case`/operations/current-workorders`:case`/operations/closeout`:case`/operations/recent-production`:case`/analysis/rebookings`:case`/operations/parts`:return`https://www.seedtactics.com/docs/fms-insight/client-operations`;case`/operations/machine-outliers`:case`/operations/machine-hours`:case`/operations/machine-cycles`:return`https://www.seedtactics.com/docs/fms-insight/client-engineering`;case`/operations/quality`:case`/operations/inspections`:return`https://www.seedtactics.com/docs/fms-insight/client-quality`;case`/operations/tools`:case`/operations/programs`:return`https://www.seedtactics.com/docs/fms-insight/client-tools-programs`;case`/engineering`:case`/engineering/outliers`:case`/engineering/hours`:return`https://www.seedtactics.com/docs/fms-insight/client-engineering`;case`/quality`:case`/quality/paths`:case`/quality/quarantine`:return`https://www.seedtactics.com/docs/fms-insight/client-quality`;case`/tools`:case`/tools/programs`:return`https://www.seedtactics.com/docs/fms-insight/client-tools-programs`;case`/analysis/schedules`:case`/analysis/buffers`:case`/analysis/station-oee`:case`/analysis/parts-completed`:case`/analysis/machine-cycles`:case`/analysis/load-cycles`:case`/analysis/pallet-cycles`:case`/analysis/quality`:case`/analysis/cost-percents`:case`/analysis/tool-replacements`:case`/analysis/cost`:return`https://www.seedtactics.com/docs/fms-insight/client-efficiency`;case`/sales`:case`/sales/projected-usage`:return`https://www.seedtactics.com/docs/fms-insight/client-sales`;default:return`https://www.seedtactics.com/docs/fms-insight/client-launch`}}var YI=new Intl.NumberFormat(void 0,{style:`percent`,minimumFractionDigits:1});function Iie(){let e=new Date;return t=>{if(!t.simulatedProduction)return 0;let n=0;for(let r of t.simulatedProduction){if(r.timeUTC>e)break;n=r.quantity}return n}}var XI=(0,L.memo)(function(){let e=R(NO),t=Q.ofObject(e.jobs).sumBy(([,e])=>Q.of(e.completed??[]).sumBy(e=>Q.of(e).sumBy(e=>e))),n=Q.ofObject(e.jobs).flatMap(([,e])=>e.procsAndPaths).flatMap(e=>e.paths).sumBy(Iie()),r=Q.ofObject(e.jobs).sumBy(([,e])=>(e.cycles??0)*e.procsAndPaths.length);return(0,H.jsx)(J,{sx:{maxWidth:`60em`,ml:`auto`,mr:`auto`,pt:`1em`},children:(0,H.jsxs)(J,{sx:{display:`grid`,gridTemplateColumns:`auto 1fr auto`,gridColumnGap:`0.5em`,alignItems:`center`},children:[(0,H.jsx)(J,{sx:{gridRow:1,gridColumn:1},children:(0,H.jsxs)(q,{variant:`body2`,children:[`Completed Parts: `,t,`/`,r]})}),(0,H.jsx)(J,{sx:{gridRow:1,gridColumn:2},children:(0,H.jsx)(tb,{variant:`determinate`,value:t/r*100,color:`secondary`})}),(0,H.jsx)(J,{sx:{gridRow:1,gridColumn:3},children:(0,H.jsx)(q,{variant:`body2`,children:YI.format(t/r)})}),(0,H.jsx)(J,{sx:{gridRow:2,gridColumn:1},children:(0,H.jsxs)(q,{variant:`body2`,children:[`Simulated Parts: `,n,`/`,r]})}),(0,H.jsx)(J,{sx:{gridRow:2,gridColumn:2},children:(0,H.jsx)(tb,{variant:`determinate`,value:n/r*100,color:`secondary`})}),(0,H.jsx)(J,{sx:{gridRow:2,gridColumn:3},children:(0,H.jsx)(q,{variant:`body2`,children:YI.format(n/r)})})]})})});function Lie(){let{ref:e,width:t,height:n}=pA({refreshMode:`debounce`,refreshRate:100});return(0,H.jsxs)(`main`,{style:{height:`calc(100vh - 64px)`,display:`flex`,flexDirection:`column`},children:[(0,H.jsx)(`div`,{children:(0,H.jsx)(XI,{})}),(0,H.jsx)(`div`,{ref:e,style:{flexGrow:1,overflow:`hidden`,margin:`8px`},children:t&&n&&(0,H.jsx)(xF,{width:t,height:n})})]})}function Rie(){let{ref:e,width:t}=pA({refreshMode:`debounce`,refreshRate:100,handleHeight:!1});return(0,H.jsxs)(`main`,{style:{padding:`8px`},children:[(0,H.jsx)(XI,{}),(0,H.jsx)(`div`,{ref:e,style:{overflow:`hidden`},children:t&&(0,H.jsx)(xF,{width:t,height:500})})]})}function zie(){return JI(`Dashboard`),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(J,{sx:{display:{xs:`none`,md:`block`}},children:(0,H.jsx)(Lie,{})}),(0,H.jsx)(J,{sx:{display:{xs:`block`,md:`none`}},children:(0,H.jsx)(Rie,{})})]})}var ZI=P([]),QI=ZI,$I=P([]),Bie=$I;function*eL(e){for(let t of e)for(let e=0;e<t.procsAndPaths.length;e++){let n=t.procsAndPaths[e];for(let r=0;r<n.paths.length;r++){let i=n.paths[r],a=0;for(let e of i.stops)a+=BO(e.expectedCycleTime);let o=0;for(let n of i.simulatedProduction||[])yield{partName:t.partName,process:e+1,finalProcess:e===t.procsAndPaths.length-1,completeTime:n.timeUTC,quantity:n.quantity-o,expectedMachineMins:a},o=n.quantity}}}var Vie=P(null,(e,t,n)=>{t(ZI,e=>[...e,...eL(Object.values(n.jobs))])}),Hie=P(null,(e,t,{evt:n,now:r,expire:i})=>{if(n.newJobs){let e=n.newJobs.jobs;t(ZI,t=>{if(i){let n=LT(r,-30),i=Q.of(t).minBy(e=>e.completeTime.getTime());if((i===void 0||i.completeTime>=n)&&e.length===0)return t;t=t.filter(e=>e.completeTime>=n)}return[...t,...eL(e)]})}}),Uie=P(null,(e,t,n)=>{t($I,Array.from(eL(Object.values(n.jobs))))}),tL=P(iO.empty()),Wie=tL,nL=P(iO.empty()),Gie=nL;function rL(e){if(e.elapsed===``)return null;let t=zO(e.elapsed);if(t<=0)return null;switch(e.type){case V.RemoveFromQueue:return[e.counter,{buffer:{type:`Queue`,queue:e.loc},endTime:e.endUTC,elapsedSeconds:t,numMaterial:e.material.length}];case V.PalletInStocker:return!e.startofcycle&&e.result===`WaitForMachine`?[e.counter,{buffer:{type:`StockerWaitForMC`,stockerNum:e.locnum},endTime:e.endUTC,elapsedSeconds:t,numMaterial:e.material.length}]:e.startofcycle?null:[e.counter,{buffer:{type:`StockerWaitForUnload`,stockerNum:e.locnum},endTime:e.endUTC,elapsedSeconds:t,numMaterial:e.material.length}];case V.PalletOnRotaryInbound:return e.startofcycle?null:[e.counter,{buffer:{type:`Rotary`,machineGroup:e.loc,machineNum:e.locnum},endTime:e.endUTC,elapsedSeconds:t,numMaterial:e.material.length}];default:return null}}var Kie=P(null,(e,t,n)=>{t(tL,e=>e.union(Q.of(n).collect(rL).toHashMap(e=>e)))}),qie=P(null,(e,t,{evt:n,now:r,expire:i})=>{if(!n.logEntry)return;let a=rL(n.logEntry);a&&t(tL,e=>{if(i){let t=LT(r,-30);e=e.filter(e=>e.endTime>=t)}return e.set(a[0],a[1])})}),Jie=P(null,(e,t,n)=>{t(nL,Q.of(n).collect(rL).toHashMap(e=>e))}),Yie=P(null),iL=P(null,(e,t,n)=>{t(Yie,n)}),aL=function(e){return e[e.Triggered=0]=`Triggered`,e[e.Forced=1]=`Forced`,e[e.Completed=2]=`Completed`,e}({}),oL=class{constructor(e,t){this.part=e,this.inspType=t}compare(e){let t=this.part.localeCompare(e.part);return t===0?this.inspType.localeCompare(e.inspType):t}hash(){return yD(this.part,this.inspType)}toString(){return`{part: ${this.part}}, inspType: ${this.inspType}}`}},sL=P(iO.empty()),cL=sL,lL=P(iO.empty()),Xie=lL;function uL(e){return e.type!==V.Inspection&&e.type!==V.InspectionForce&&e.type!==V.InspectionResult?[]:e.material.map(t=>{if(e.type===V.Inspection){let n=JSON.parse((e.details||{}).ActualPath||`[]`),r=Array.isArray(n)?n:[],i=[];for(let e of r)i.push(Ne.fromJS(e));let a=(e.details||{}).InspectionType||``,o;return o=e.result.toLowerCase()===`true`||e.result===`1`,{key:new oL(t.part,a),entry:{cntr:e.counter,time:e.endUTC,materialID:t.id,serial:t.serial,workorder:t.workorder,result:{type:0,actualPath:i,toInspect:o},part:t.part,inspType:a}}}else if(e.type===V.InspectionForce){let n;return n=e.result.toLowerCase()===`true`||e.result===`1`,{key:new oL(t.part,e.program),entry:{cntr:e.counter,time:e.endUTC,materialID:t.id,serial:t.serial,workorder:t.workorder,result:{type:1,toInspect:n},part:t.part,inspType:e.program}}}else{let n;return n=e.result.toLowerCase()===`true`||e.result===`1`,{key:new oL(t.part,e.program),entry:{cntr:e.counter,time:e.endUTC,materialID:t.id,serial:t.serial,workorder:t.workorder,result:{type:2,success:n},part:t.part,inspType:e.program}}}})}var Zie=P(null,(e,t,n)=>{t(sL,e=>e.union(Q.of(n).flatMap(uL).toLookupMap(e=>e.key,e=>e.entry.cntr,e=>e.entry),(e,t)=>e.union(t)))}),Qie=P(null,(e,t,{evt:n,now:r,expire:i})=>{if(n.logEntry){let e=uL(n.logEntry);if(e.length===0)return;t(sL,t=>{if(i){let e=LT(r,-30);t=t.collectValues(t=>{let n=t.filter(t=>t.time>=e);return n.size===0?null:n})}return t.union(Q.of(e).toLookupMap(e=>e.key,e=>e.entry.cntr,e=>e.entry),(e,t)=>e.union(t))})}else if(n.editMaterialInLog){let e=n.editMaterialInLog.editedEvents;t(sL,t=>t.collectValues(t=>{for(let n of e){let e=n?.material[0],r=t.get(n.counter);if(r!==void 0&&e){let i={...r,materialID:e.id,serial:e.serial,workorder:e.workorder};t=t.set(n.counter,i)}}return t}))}}),$ie=P(null,(e,t,n)=>{t(lL,Q.of(n).flatMap(uL).toLookupMap(e=>e.key,e=>e.entry.cntr,e=>e.entry))}),dL=P({matsById:iO.empty(),matIdsForJob:iO.empty()}),fL=dL,pL=P({matsById:iO.empty(),matIdsForJob:iO.empty()}),mL=pL;function hL(e){return{materialID:e.materialID,jobUnique:e.jobUnique,partName:e.partName,startedProcess1:e.process>0,serial:e.serial,workorderId:e.workorderId,signaledInspections:e.signaledInspections,quarantineAfterUnload:e.quarantineAfterUnload}}function gL(e,t){let n=e.matsById,r=e.matIdsForJob;if(t.startofcycle||t.material.length===0)return e;for(let e of t.material){if(e.uniq&&e.uniq!==``){let t=r.get(e.uniq);t===void 0?r=r.set(e.uniq,YD.empty().add(e.id)):t.has(e.id)||(r=r.set(e.uniq,t.add(e.id)))}let i=n.get(e.id),a;switch(a=i===void 0?{materialID:e.id,jobUnique:e.uniq,partName:e.part,last_event:t.endUTC,startedProcess1:!1,numProcesses:e.numproc,unloaded_processes:{},signaledInspections:[],quarantineAfterUnload:null,completedInspections:{}}:{...i,last_event:t.endUTC},t.type){case V.PartMark:a={...a,serial:t.result};break;case V.OrderAssignment:a={...a,workorderId:t.result};break;case V.Inspection:if(t.result.toLowerCase()===`true`||t.result===`1`){let e=(t.details||{}).InspectionType;e&&(a={...a,signaledInspections:[...a.signaledInspections,e]})}break;case V.InspectionForce:if(t.result.toLowerCase()===`true`||t.result===`1`){let e=t.program;a={...a,signaledInspections:[...a.signaledInspections,e]}}break;case V.InspectionResult:{let e=t.result.toLowerCase()==`true`||t.result===`1`;a={...a,completedInspections:{...a.completedInspections,[t.program]:{time:t.endUTC,success:e}},completed_inspect_time:t.endUTC};break}case V.LoadUnloadCycle:t.result===`UNLOAD`?(a={...a,unloaded_processes:{...a.unloaded_processes,[e.proc]:t.endUTC},quarantineAfterUnload:!1,currently_quarantined:!1},a=e.proc===e.numproc?{...a,last_unload_time:t.endUTC,completed_last_proc_machining:!0}:{...a,last_unload_time:t.endUTC}):t.result===`LOAD`&&(a={...a,startedProcess1:!0,quarantineAfterUnload:!1,currently_quarantined:!1});break;case V.MachineCycle:a.currently_quarantined&&(a={...a,currently_quarantined:!1});break;case V.AddToQueue:t.program===`Quarantine`&&(a={...a,currently_quarantined:!0});break;case V.CloseOut:a={...a,closeout_completed:t.endUTC,closeout_failed:t.result===`Failed`};break;case V.SignalQuarantine:a={...a,quarantineAfterUnload:!0}}n=n.set(e.id,a)}return{matsById:n,matIdsForJob:r}}function _L(e,{matIdsForJob:t,matsById:n}){let r=n.valuesToLazySeq().filter(t=>t.last_event<e).toRSet(e=>e.materialID);return r.size>0&&(t=t.collectValues(e=>{let t=Q.of(r).fold(e,(e,t)=>e.delete(t));return t.size>0?t:null})),n=n.filter(t=>t.last_event>=e),{matIdsForJob:t,matsById:n}}function vL(e,t){let n=t.matIdsForJob,r=t.matsById.get(e.oldMaterialID)??null,i=t.matsById.get(e.newMaterialID)??null;if(r===null)return t;let a=r,o;if(o=i===null?{materialID:e.newMaterialID,jobUnique:a.jobUnique,partName:a.partName,last_event:a.last_event,numProcesses:a.numProcesses,startedProcess1:!0,unloaded_processes:{},signaledInspections:[],quarantineAfterUnload:null,completedInspections:{}}:i,a.jobUnique&&a.jobUnique!==``&&(!o.jobUnique||o.jobUnique===``)){let e=n.get(a.jobUnique);e!==void 0&&(n=n.set(a.jobUnique,e.delete(a.materialID).add(o.materialID))),o={...o,jobUnique:a.jobUnique},a={...a,jobUnique:``}}let s=a.unloaded_processes;a={...a,unloaded_processes:o.unloaded_processes},o={...o,unloaded_processes:s};for(let t of e.editedEvents){let n=t.material.find(t=>t.id===e.newMaterialID);switch(n&&(o={...o,serial:n.serial??o.serial,workorderId:n.workorder??o.workorderId}),t.type){case V.Inspection:case V.InspectionForce:{let e=t.program,n;n=t.result.toLowerCase()===`true`||t.result===`1`,n&&(a={...a,signaledInspections:Q.of(a.signaledInspections).filter(t=>t!==e).toRArray()},o={...o,signaledInspections:Q.of([...o.signaledInspections,e]).distinct().toSortedArray(e=>e)})}}}return{matsById:t.matsById.set(a.materialID,a).set(o.materialID,o),matIdsForJob:n}}var yL=P(null,(e,t,n)=>{t(dL,e=>n.reduce(gL,e))}),bL=P(null,(e,t,{evt:n,now:r,expire:i})=>{if(n.logEntry){let e=n.logEntry;t(dL,t=>{let n=gL(t,e);return n===t||!i?t:_L(LT(r,-30),n)})}else if(n.editMaterialInLog){let e=n.editMaterialInLog;t(dL,t=>vL(e,t))}}),xL=P(null,(e,t,n)=>{t(pL,n.reduce(gL,{matsById:iO.empty(),matIdsForJob:iO.empty()}))}),SL=P(new Set),CL=SL,wL=P(new Set),TL=wL,EL=P(new Set),DL=EL,OL=P(new Set),kL=OL,AL=P(null,(e,t,{evt:n})=>{n.newJobs?PL(t,n.newJobs.jobs):n.logEntry?IL(t,[n.logEntry]):n.newCurrentStatus&&FL(e,t,n.newCurrentStatus)}),jL=P(null,(e,t,n)=>{PL(t,Object.values(n.jobs))}),ML=P(null,(e,t,n)=>IL(t,n)),NL=P(null,FL);function PL(e,t){e(EL,e=>{let n=new Set;for(let r of t)for(let t of r.procsAndPaths[0].paths)t.casting&&t.casting!==``&&!e.has(t.casting)&&n.add(t.casting);return n.size===0?e:new Set([...e,...n])})}function FL(e,t,n){PL(t,Object.values(n.jobs));let r=e(SL),i=e(wL),a=new Set,o=new Set;for(let[e,t]of Q.ofObject(n.queues))t.role===lt.RawMaterial?r.has(e)||a.add(e):t.role===lt.InProcessTransfer&&(i.has(e)||o.add(e));a.size>0&&t(SL,new Set([...r,...a])),o.size>0&&t(wL,new Set([...i,...o]))}function IL(e,t){e(OL,e=>{let n=new Set;for(let r of t)switch(r.type){case V.Inspection:{let t=(r.details||{}).InspectionType;t&&!e.has(t)&&n.add(t)}break;case V.InspectionForce:case V.InspectionResult:{let t=r.program;e.has(t)||n.add(t)}break}return n.size===0?e:new Set([...e,...n])})}var LL=P(iO.empty()),RL=LL;function zL(e,t,n){if(e.tooluse===void 0||e.tooluse.length===0||e.type!==V.MachineCycle)return n;let r=e.material.length>0?t.get(VO.ofLogCycle(e)):void 0,i=BO(e.elapsed);if(r===void 0||KO(r,i))return n;let a=VO.ofLogCycle(e),o=Q.of(e.tooluse).groupBy(e=>e.tool).map(([e,t])=>({toolName:e,cycleUsageMinutes:Q.of(t).sumBy(e=>e.toolUseDuringCycle&&e.toolUseDuringCycle!==``?BO(e.toolUseDuringCycle):0),cycleUsageCnt:Q.of(t).sumBy(e=>e.toolUseCountDuringCycle??0),toolChangedDuringMiddleOfCycle:Q.of(t).some(e=>e.toolChangeOccurred??!1)})).toRArray();return o.length===0&&n.has(a)?n:n.modify(a,t=>{if(t){let n=t.recentCycles.slice(-4);return n.push({tools:o}),{machines:t.machines.add(rk(e.loc,e.locnum)),recentCycles:n}}else return{machines:QD.empty().add(rk(e.loc,e.locnum)),recentCycles:[{tools:o}]}})}var BL=P(null,(e,t,n)=>{let r=e(UO);t(LL,e=>n.reduce((e,t)=>zL(t,r,e),e))}),VL=P(null,(e,t,{evt:n})=>{if(n.logEntry){let r=n.logEntry,i=e(UO);t(LL,e=>zL(r,i,e))}}),HL=P(iO.empty()),UL=HL,WL=P(iO.empty()),GL=WL;function KL(e){return{cntr:e.counter,x:e.endUTC,y:BO(e.elapsed),active:BO(e.active),mats:e.material}}var qL=P(null,(e,t,n)=>{t(HL,e=>e.union(Q.of(n).filter(e=>!e.startofcycle&&e.type===V.PalletCycle&&e.pal!==0).toLookupMap(e=>e.pal,e=>e.counter,KL),(e,t)=>e.union(t)))}),JL=P(null,(e,t,{evt:n,now:r,expire:i})=>{if(n.logEntry&&!n.logEntry.startofcycle&&n.logEntry.type===V.PalletCycle&&n.logEntry.pal!==0){let e=n.logEntry;t(HL,t=>{if(i){let e=LT(r,-30);t=t.collectValues(t=>{let n=t.filter(t=>t.x>=e);return n.size>0?n:null})}return t.modify(e.pal,t=>(t??iO.empty()).set(e.counter,KL(e)))})}}),YL=P(null,(e,t,n)=>{t(WL,Q.of(n).filter(e=>!e.startofcycle&&e.type===V.PalletCycle&&e.pal!==0).toLookupMap(e=>e.pal,e=>e.counter,KL))}),XL=P(iO.empty()),ZL=XL,QL=P(e=>e(XL).size>0),$L=P(iO.empty()),eR=$L,tR=P(e=>e($L).size>0);function nR(e){return{cntr:e.counter,x:e.endUTC,y:BO(e.elapsed),active:BO(e.active),mats:e.material}}var rR=P(null,(e,t,n)=>{t(XL,e=>e.union(Q.of(n).filter(e=>!e.startofcycle&&e.type===V.BasketCycle&&e.pal!==0).toLookupMap(e=>e.pal,e=>e.counter,nR),(e,t)=>e.union(t)))}),iR=P(null,(e,t,{evt:n,now:r,expire:i})=>{if(n.logEntry&&!n.logEntry.startofcycle&&n.logEntry.type===V.BasketCycle&&n.logEntry.pal!==0){let e=n.logEntry;t(XL,t=>{if(i){let e=LT(r,-30);t=t.collectValues(t=>{let n=t.filter(t=>t.x>=e);return n.size>0?n:null})}return t.modify(e.pal,t=>(t??iO.empty()).set(e.counter,nR(e)))})}}),aR=P(null,(e,t,n)=>{t($L,Q.of(n).filter(e=>!e.startofcycle&&e.type===V.BasketCycle&&e.pal!==0).toLookupMap(e=>e.pal,e=>e.counter,nR))}),oR=class e{constructor(e,t){this.group=e,this.num=t}static ofLogCycle(t){return new e(t.loc,t.locnum)}hash(){return yD(this.group,this.num)}compare(e){return this.group===e.group?this.num-e.num:this.group.localeCompare(e.group)}toString(){return this.group+` #`+this.num.toString()}},sR={replacements:eO.empty(),recentUse:iO.empty()},cR=P(sR),lR=P(e=>e(cR).replacements),uR=P(sR),dR=P(e=>e(uR).replacements);function fR(e,t){let n=oR.ofLogCycle(t);return{replacements:e.replacements.alter(n,r=>{let i=[];for(let r of t.tooluse??[]){let t=r.toolUseDuringCycle!==null&&r.toolUseDuringCycle!==void 0?BO(r.toolUseDuringCycle):null,a=r.totalToolUseAtEndOfCycle!==null&&r.totalToolUseAtEndOfCycle!==void 0?BO(r.totalToolUseAtEndOfCycle):null,o=r.toolUseCountDuringCycle??null,s=r.totalToolUseCountAtEndOfCycle??null;if((t||o)&&t===a&&o===s){let t=e.recentUse.get(n)?.find(e=>e.tool===r.tool&&e.pocket===r.pocket);if(t){let e=t.totalToolUseAtEndOfCycle?BO(t.totalToolUseAtEndOfCycle):null;(e||t.totalToolUseCountAtEndOfCycle)&&i.push({tool:r.tool,pocket:r.pocket,type:`ReplaceBeforeCycleStart`,useAtReplacement:e,cntAtReplacement:t.totalToolUseCountAtEndOfCycle??null})}}else if(r.toolChangeOccurred&&(t&&r.configuredToolLife||o&&r.configuredToolLifeCount)){let e=r.configuredToolLife!==null&&r.configuredToolLife!==void 0?BO(r.configuredToolLife):null,n=r.configuredToolLifeCount??null;i.push({tool:r.tool,pocket:r.pocket,type:`ReplaceInCycle`,totalUseAtBeginningOfCycle:e!==null&&t!==null?e-t+(a??0):null,totalUseAtEndOfCycle:a,totalCntAtBeginningOfCycle:n!==null&&o!==null?n-o+(s??0):null,totalCntAtEndOfCycle:s})}}return i.length>0?(r??eO.empty()).set(t.counter,{time:t.endUTC,replacements:i}):r}),recentUse:t.tooluse?e.recentUse.set(n,t.tooluse):e.recentUse}}var pR=P(null,(e,t,n)=>{t(cR,e=>Q.of(n).filter(e=>e.type===V.MachineCycle&&!e.startofcycle&&!!e.tooluse&&e.tooluse.length>0).fold(e,fR))}),mR=P(null,(e,t,{evt:n,now:r,expire:i})=>{if(n.logEntry&&!n.logEntry.startofcycle&&n.logEntry.type===V.MachineCycle&&n.logEntry.tooluse&&n.logEntry.tooluse.length>0){let e=n.logEntry;t(cR,t=>{if(i){let e=LT(r,-30);t={replacements:t.replacements.collectValues(t=>{let n=t.filter(t=>t.time>=e);return n.size>0?n:null}),recentUse:t.recentUse}}return fR(t,e)})}}),hR=P(null,(e,t,n)=>{t(uR,Q.of(n).filter(e=>e.type===V.MachineCycle&&!e.startofcycle&&!!e.tooluse&&e.tooluse.length>0).fold(sR,fR))}),gR=P(null),_R=gR;function vR(e,t,n,r){let i=e(_R);(i===null||i.simId<n)&&t(gR,{simId:n,usage:r})}var yR=P(null,(e,t,n)=>{!n.mostRecentSimulationId||!n.mostRecentSimDayUsage||n.mostRecentSimDayUsage.length===0||vR(e,t,n.mostRecentSimulationId,n.mostRecentSimDayUsage)}),bR=P(null,(e,t,{evt:n})=>{n.newJobs&&n.newJobs.simDayUsage&&n.newJobs.simDayUsage.length>0&&vR(e,t,n.newJobs.scheduleId,n.newJobs.simDayUsage)}),xR=P(eO.empty()),SR=OO(P(async(e,{signal:t})=>Ut===void 0?eO.empty():CR(await Ut.unscheduledRebookings(t))),e=>e??eO.empty());function CR(e){return eO.build(e??[],e=>e.bookingId)}var wR=P(e=>{let t=e(xR),n=e(SR);return t.union(n,(e,t)=>e??t)}),TR=P(eO.empty()),ER=TR,DR=P(eO.empty()),OR=DR;function kR(e){let t=1;return e.details?.Quantity&&(t=parseInt(e.details.Quantity,10)),{bookingId:e.result,partName:e.program,quantity:t,timeUTC:e.endUTC,priority:e.locnum,notes:e.details?.Notes,workorder:e.details?.Workorder??e.material?.[0]?.workorder}}var AR=P(null,(e,t,n)=>{t(xR,e=>e.union(Q.of(n).filter(e=>e.type===V.Rebooking).toOrderedMap(e=>[e.result,kR(e)]))),t(TR,e=>e.union(Q.of(n).filter(e=>e.type===V.CancelRebooking).toOrderedMap(e=>[e.result,e.endUTC])))});function jR(e,t,n){e(DR,e=>(n&&(e=e.filter(e=>e.scheduledTime>=n)),e.union(t.flatMap(e=>(e.bookings??[]).map(t=>[t,{scheduledTime:e.routeStartUTC,jobUnique:e.unique}])).toOrderedMap(e=>e))))}var MR=P(null,(e,t,n)=>{jR(t,Q.ofObject(n.jobs).map(([,e])=>e))}),NR=P(null,(e,t,{evt:n,now:r,expire:i})=>{if(n.newJobs)jR(t,Q.of(n.newJobs.jobs),i?LT(r,-30):void 0);else if(n.logEntry){let e=n.logEntry;e.type===V.Rebooking?t(xR,t=>t.set(e.result,kR(e))):e.type===V.CancelRebooking&&t(TR,t=>t.set(e.result,e.endUTC))}});function PR(){let[e,t]=(0,L.useState)(!1);return[(0,L.useCallback)(e=>(t(!0),Wt.cancelRebooking(e).then(()=>{}).catch(console.log).finally(()=>t(!1))),[]),e]}function FR(){let[e,t]=(0,L.useState)(!1);return[(0,L.useCallback)(e=>(t(!0),Wt.requestRebooking(e.part,e.qty&&!isNaN(e.qty)?e.qty:1,e.workorder,e.priority!==void 0&&e.priority!==null&&!isNaN(e.priority)?e.priority:void 0,e.notes).then(()=>{}).catch(console.log).finally(()=>t(!1))),[]),e]}var IR=P(null),LR=IR,RR=P(null,(e,t,n)=>{if(n.evt.newCurrentStatus&&t(iL,n.evt.newCurrentStatus.customState??null),t(Hie,n),t(tA,n),t(mO,n),t(qie,n),t(Rre,n),t(bL,n),t(Qie,n),t(AL,n),t(VL,n),t(JL,n),t(iR,n),t(mR,n),t(Zre,n),t(NR,n),t(bR,n),n.evt.logEntry){let e=n.evt.logEntry.counter;t(IR,t=>t===null?t:Math.max(t,e))}}),zR=P(null,(e,t,n)=>{let r=fO(e(lO),n);t(eA,r),t(Vie,r),t(pO,r),t(jL,r),t(yR,r),t(MR,r)}),BR=P(null,(e,t,n)=>{t(Ure,n),t(Kie,n),t(Zie,n),t(yL,n),t(ML,n),t(BL,n),t(qL,n),t(rR,n),t(pR,n),t(Xre,n),t(AR,n);let r=Q.of(n).maxBy(e=>e.counter)?.counter??null;t(IR,e=>e===null?r:Math.max(e,r??-1))}),VR=P(null,(e,t,n)=>{t(LO,n),t(iL,n.customState??null),t(NL,n)}),HR=P(null,(e,t,n)=>{t(nA,n),t(Uie,n),t(hO,n)}),UR=P(null,(e,t,n)=>{t(Wre,n),t(Jie,n),t($ie,n),t(xL,n),t(YL,n),t(aR,n),t(hR,n),t(Qre,n)}),WR=P(`Last30`),GR=P(oE(new Date)),KR=P(e=>e(GR),(e,t,n)=>{t(WR,`SpecificMonth`),t(GR,n),e(JR)!==n&&!e(YR)&&$R(n,t)}),qR=P(e=>e(WR)===`Last30`?{type:`Last30`}:{type:`SpecificMonth`,month:e(GR)}),JR=P(null),YR=P(!1),XR=YR,ZR=P(null),QR=ZR;function $R(e,t){t(YR,!0),t(ZR,null);let n=RT(e,1),r=Ut.history(e,n).then(e=>t(HR,e)),i=Wt.get(e,n).then(e=>t(UR,e));Promise.all([r,i]).then(()=>t(JR,e)).catch(e=>t(ZR,e.message??`Error`)).finally(()=>t(YR,!1))}function ez(){let e=z(WR);return()=>e(`Last30`)}function tz(){return z(GR)}function nz(e){return Gre(e)&&e.operation===`UNLOAD`}function rz(e){return Object.prototype.hasOwnProperty.call(e,`month`)}function iz(e,t,n,r){let i=rz(r)?r.month:r.thirtyDaysAgo,a=rz(r)?RT(r.month,1):LT(r.thirtyDaysAgo,31),o=0,s=new Map,c=0,l=new Map,u=e.filter(e=>e.endTime>=i&&e.endTime<=a&&!e.material.some(e=>t.has(e.part)));for(let e of u)if(nz(e)&&(o+=1),$O(e))c+=e.activeMinutes;else if(ek(e)){s.set(e.stationGroup,e.activeMinutes+(s.get(e.stationGroup)??0));let t=l.get(e.stationGroup);t?t.add(e.stationNumber):l.set(e.stationGroup,new Set([e.stationNumber]))}let d=Q.of(n).filter(([,e])=>{if(t.has(e.partName)||e.numProcesses===void 0)return!1;let n=e.unloaded_processes?.[e.numProcesses];return!!n&&n>=i&&n<=a}).toRMap(([,e])=>[e.partName,1],(e,t)=>e+t);return{parts:u.groupBy(e=>e.part).map(([e,t])=>({part:e,parts_completed:d.get(e)??0,machine:Q.of(t).filter(e=>ek(e)).buildOrderedMap(e=>e.stationGroup,(e,t)=>(e??0)+t.activeMinutes).mapValues((e,t)=>e/(s.get(t)??1)),labor:Q.of(t).filter(e=>$O(e)).sumBy(e=>e.activeMinutes/c),automation:o>0?t.reduce((e,t)=>nz(t)?e+1:e,0)/o:0})).toRArray(),machineQuantities:Q.of(l).toOrderedMap(([e,t])=>[e,t.size]),type:r}}function az(e,t,n,r){let i=rz(e.type)?sE(e.type.month):30,a=n?n*i/365:0,o=e.machineQuantities.mapValues((e,n)=>(t[n]??0)*e*i/365);return{machineQuantities:e.machineQuantities,type:e.type,parts:e.parts.map(e=>({part:e.part,parts_completed:e.parts_completed,machine:e.machine.mapValues((t,n)=>e.parts_completed>0?t*(o.get(n)??0)/e.parts_completed:0),labor:e.parts_completed>0?e.labor*r/e.parts_completed:0,automation:e.parts_completed>0?e.automation*a/e.parts_completed:0}))}}function oz(e){let t=`<table>
|
|
260
260
|
<thead><tr>`;t+=`<th>Part</th>`,t+=`<th>Completed Quantity</th>`;for(let n of e.machineQuantities.keys())t+=`<th>`+n+` Cost %</th>`;t+=`<th>Labor Cost</th>`,t+=`<th>Automation Cost</th>`,t+=`</tr></thead>
|
|
261
261
|
<tbody>
|
|
262
262
|
`;let n=Q.of(e.parts).sortBy(e=>e.part),r=Intl.NumberFormat(void 0,{maximumFractionDigits:1});for(let i of n){t+=`<tr><td>`+i.part+`</td>`,t+=`<td>`+i.parts_completed.toString()+`</td>`;for(let n of e.machineQuantities.keys())t+=`<td>`+r.format(i.machine.get(n)??0)+`</td>`;t+=`<td>`+(i.parts_completed>0?r.format(i.labor):`0`)+`</td>`,t+=`<td>`+(i.parts_completed>0?r.format(i.automation):`0`)+`</td>`,t+=`</tr>
|
|
263
263
|
`}return t+=`</tbody>
|
|
264
|
-
</table>`,t}function
|
|
264
|
+
</table>`,t}function sz(e){Ak(oz(e))}function cz(e){let t=`<table>
|
|
265
265
|
<thead><tr>`;t+=`<th>Part</th>`,t+=`<th>Completed Quantity</th>`;for(let n of e.machineQuantities.keys())t+=`<th>`+n+` Cost %</th>`;t+=`<th>Labor Cost %</th>`,t+=`<th>Automation Cost %</th>`,t+=`</tr></thead>
|
|
266
266
|
<tbody>
|
|
267
267
|
`;let n=Q.of(e.parts).sortBy(e=>e.part),r=new Intl.NumberFormat(void 0,{style:`percent`,minimumFractionDigits:1,maximumFractionDigits:1});for(let i of n){t+=`<tr><td>`+i.part+`</td>`,t+=`<td>`+i.parts_completed.toString()+`</td>`;for(let n of e.machineQuantities.keys())t+=`<td>`+r.format(i.machine.get(n)??0)+`</td>`;t+=`<td>`+r.format(i.labor)+`</td>`,t+=`<td>`+r.format(i.automation)+`</td>`,t+=`</tr>
|
|
268
268
|
`}return t+=`</tbody>
|
|
269
|
-
</table>`,t}function cz(e){Ak(sz(e))}function lz(e,t,n){return parseInt(e.substr(t,n),16)}function uz(e){return e|=0,e<0?`00`:e<16?`0`+e.toString(16):e<256?e.toString(16):`ff`}function dz(e,t,n){return n=n<0?n+6:n>6?n-6:n,uz(255*(n<1?e+(t-e)*n:n<3?t:n<4?e+(t-e)*(4-n):e))}function fz(e){if(/^#[0-9a-f]{3,8}$/i.test(e)){let t,n=e.length;if(n<6){let n=e[1],r=e[2],i=e[3],a=e[4]||``;t=`#`+n+n+r+r+i+i+a+a}return(n==7||n>8)&&(t=e),t}}function pz(e,t,n){let r;if(t==0){let e=uz(n*255);r=e+e+e}else{let i=n<=.5?n*(t+1):n+t-n*t,a=n*2-i;r=dz(a,i,e*6+2)+dz(a,i,e*6)+dz(a,i,e*6-2)}return`#`+r}function mz(e,t,n){let r=[.55,.5,.5,.46,.6,.55,.55][e*6+.5|0];return n=n<.5?n*r*2:r+(n-.5)*(1-r)*2,pz(e,t,n)}var hz=typeof window<`u`?window:typeof self<`u`?self:typeof global<`u`?global:{},gz={V:`jdenticon_config`,n:`config`},_z={};function vz(e,t){let n=typeof e==`object`&&e||_z[gz.n]||hz[gz.V]||{},r=n.lightness||{},i=n.saturation||{},a=`color`in i?i.color:i,o=i.grayscale,s=n.backColor,c=n.padding;function l(e,t){let n=r[e];return n&&n.length>1||(n=t),function(e){return e=n[0]+e*(n[1]-n[0]),e<0?0:e>1?1:e}}function u(e){let t=n.hues,r;return t&&t.length>0&&(r=t[0|.999*e*t.length]),typeof r==`number`?(r/360%1+1)%1:e}return{W:u,o:typeof a==`number`?a:.5,D:typeof o==`number`?o:0,p:l(`color`,[.4,.8]),F:l(`grayscale`,[.3,.9]),G:fz(s),X:typeof e==`number`?e:typeof c==`number`?c:t}}var yz=class{constructor(e,t){this.x=e,this.y=t}},bz=class{constructor(e,t,n,r){this.q=e,this.t=t,this.H=n,this.Y=r}I(e,t,n,r){let i=this.q+this.H,a=this.t+this.H,o=this.Y;return o===1?new yz(i-t-(r||0),this.t+e):o===2?new yz(i-e-(n||0),a-t-(r||0)):o===3?new yz(this.q+t,a-e-(n||0)):new yz(this.q+e,this.t+t)}},xz=new bz(0,0,0,0),Sz=class{constructor(e){this.J=e,this.u=xz}g(e,t){let n=t?-2:2,r=[];for(let i=t?e.length-2:0;i<e.length&&i>=0;i+=n)r.push(this.u.I(e[i],e[i+1]));this.J.g(r)}h(e,t,n,r){let i=this.u.I(e,t,n,n);this.J.h(i,n,r)}i(e,t,n,r,i){this.g([e,t,e+n,t,e+n,t+r,e,t+r],i)}j(e,t,n,r,i,a){let o=[e+n,t,e+n,t+r,e,t+r,e,t];o.splice((i||0)%4*2,2),this.g(o,a)}K(e,t,n,r,i){this.g([e+n/2,t,e+n,t+r/2,e+n/2,t+r,e,t+r/2],i)}};function Cz(e,t,n,r){e%=14;let i,a,o,s,c,l;e?e==1?(o=0|n*.5,s=0|n*.8,t.j(n-o,0,o,s,2)):e==2?(o=0|n/3,t.i(o,o,n-o,n-o)):e==3?(c=n*.1,l=n<6?1:n<8?2:0|n*.25,c=c>1?0|c:c>.5?1:c,t.i(l,l,n-c-l,n-c-l)):e==4?(a=0|n*.15,o=0|n*.5,t.h(n-o-a,n-o-a,o)):e==5?(c=n*.1,l=c*4,l>3&&(l=0|l),t.i(0,0,n,n),t.g([l,l,n-c,l,l+(n-l-c)/2,n-c],!0)):e==6?t.g([0,0,n,0,n,n*.7,n*.4,n*.4,n*.7,n,0,n]):e==7?t.j(n/2,n/2,n/2,n/2,3):e==8?(t.i(0,0,n,n/2),t.i(0,n/2,n/2,n/2),t.j(n/2,n/2,n/2,n/2,1)):e==9?(c=n*.14,l=n<4?1:n<6?2:0|n*.35,c=n<8?c:0|c,t.i(0,0,n,n),t.i(l,l,n-l-c,n-l-c,!0)):e==10?(c=n*.12,l=c*3,t.i(0,0,n,n),t.h(l,l,n-c-l,!0)):e==11?t.j(n/2,n/2,n/2,n/2,3):e==12?(a=n*.25,t.i(0,0,n,n),t.K(a,a,n-a,n-a,!0)):!r&&(a=n*.4,o=n*1.2,t.h(a,a,o)):(i=n*.42,t.g([0,0,n,0,n,n-i*2,n-i,n,0,n]))}function wz(e,t,n){e%=4;let r;e?e==1?t.j(0,n/2,n,n/2,0):e==2?t.K(0,0,n,n):(r=n/6,t.h(r,r,n-2*r)):t.j(0,0,n,n,0)}function Tz(e,t){return e=t.W(e),[mz(e,t.D,t.F(0)),mz(e,t.o,t.p(.5)),mz(e,t.D,t.F(1)),mz(e,t.o,t.p(1)),mz(e,t.o,t.p(0))]}function Ez(e,t,n){let r=vz(n,.08);r.G&&e.m(r.G);let i=e.k,a=.5+i*r.X|0;i-=a*2;let o=new Sz(e),s=0|i/4,c=0|a+i/2-s*2,l=0|a+i/2-s*2;function u(n,r,i,a,u){let p=lz(t,i,1),m=a?lz(t,a,1):0;e.L(d[f[n]]);for(let e=0;e<u.length;e++)o.u=new bz(c+u[e][0]*s,l+u[e][1]*s,s,m++%4),r(p,o,s,e);e.M()}let d=Tz(lz(t,-7)/268435455,r),f=[],p;function m(e){if(e.indexOf(p)>=0){for(let t=0;t<e.length;t++)if(f.indexOf(e[t])>=0)return!0}}for(let e=0;e<3;e++)p=lz(t,8+e,1)%d.length,(m([0,4])||m([2,3]))&&(p=1),f.push(p);u(0,wz,2,3,[[1,0],[2,0],[2,3],[1,3],[0,1],[3,1],[3,2],[0,2]]),u(1,wz,4,5,[[0,0],[3,0],[3,3],[0,3]]),u(2,Cz,1,null,[[1,1],[2,1],[2,2],[1,2]]),e.finish()}function Dz(e){var t=0,n=0,r=encodeURI(e)+`%80`,i=[],a,o=[],s=1732584193,c=4023233417,l=~s,u=~c,d=3285377520,f=[s,c,l,u,d],p=0,m=``;function h(e,t){return e<<t|e>>>32-t}for(;t<r.length;n++)i[n>>2]=i[n>>2]|(r[t]==`%`?parseInt(r.substring(t+1,t+=3),16):r.charCodeAt(t++))<<(3-(n&3))*8;for(a=((n+7>>6)+1)*16,i[a-1]=n*8-8;p<a;p+=16){for(t=0;t<80;t++)n=h(s,5)+d+(t<20?(c&l^~c&u)+1518500249:t<40?(c^l^u)+1859775393:t<60?(c&l^c&u^l&u)+2400959708:(c^l^u)+3395469782)+(o[t]=t<16?i[p+t]|0:h(o[t-3]^o[t-8]^o[t-14]^o[t-16],1)),d=u,u=l,l=h(c,30),c=s,s=n;f[0]=s=f[0]+s|0,f[1]=c=f[1]+c|0,f[2]=l=f[2]+l|0,f[3]=u=f[3]+u|0,f[4]=d=f[4]+d|0}for(t=0;t<40;t++)m+=(f[t>>3]>>>(7-(t&7))*4&15).toString(16);return m}function Oz(e){return/^[0-9a-f]{11,}$/i.test(e)&&e}function kz(e){return Dz(e==null?``:``+e)}typeof document<`u`&&document.querySelectorAll.bind(document);function Az(e){return(e*10+.5|0)/10}var jz=class{constructor(){this.v=``}g(e){let t=``;for(let n=0;n<e.length;n++)t+=(n?`L`:`M`)+Az(e[n].x)+` `+Az(e[n].y);this.v+=t+`Z`}h(e,t,n){let r=+!n,i=Az(t/2),a=Az(t),o=`a`+i+`,`+i+` 0 1,`+r+` `;this.v+=`M`+Az(e.x)+` `+Az(e.y+t/2)+o+a+`,0`+o+-a+`,0`}},Mz=class{constructor(e){this.A,this.B={},this.O=e,this.k=e.k}m(e){let t=/^(#......)(..)?/.exec(e),n=t[2]?lz(t[2],0)/255:1;this.O.m(t[1],n)}L(e){this.A=this.B[e]||(this.B[e]=new jz)}M(){}g(e){this.A.g(e)}h(e,t,n){this.A.h(e,t,n)}finish(){let e=this.B;for(let t in e)e.hasOwnProperty(t)&&this.O.P(t,e[t].v)}},Nz={R:`http://www.w3.org/2000/svg`,S:`width`,T:`height`},Pz=class{constructor(e){this.k=e,this.C=`<svg xmlns="`+Nz.R+`" width="`+e+`" height="`+e+`" viewBox="0 0 `+e+` `+e+`">`}m(e,t){t&&(this.C+=`<rect width="100%" height="100%" fill="`+e+`" opacity="`+t.toFixed(2)+`"/>`)}P(e,t){this.C+=`<path fill="`+e+`" d="`+t+`"/>`}toString(){return this.C+`</svg>`}};function Fz(e,t,n){let r=new Pz(t);return Ez(new Mz(r),Oz(e)||kz(e),n),r.toString()}function Iz(e){let t=new Date(e);if(!Number.isNaN(t.valueOf()))return t;let n=String(e).match(/\d+/g);if(n==null||n.length<=2)return t;{let[e,t,...r]=n.map(e=>parseInt(e)),i=[e,t-1,...r];return new Date(Date.UTC(...i))}}var Lz=(e,t,n)=>{let r=e===1?t:t+`s`;return e+` `+r+` `+n};function Rz(){return Rz=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Rz.apply(null,arguments)}var zz=60,Bz=zz*60,Vz=Bz*24,Hz=Vz*7,Uz=Vz*30,Wz=Vz*365,Gz=()=>Date.now();function Kz({date:e,formatter:t,component:n=`time`,live:r=!0,minPeriod:i=0,maxPeriod:a=Hz,title:o,now:s=Gz,...c}){let[l,u]=(0,L.useState)(s());(0,L.useEffect)(()=>{if(!r)return;let t=(()=>{let t=Iz(e).valueOf();if(!t)return console.warn(`[react-timeago] Invalid Date provided`),0;let n=Math.round(Math.abs(l-t)/1e3),r=Math.min(Math.max(n<zz?1e3:n<Bz?1e3*zz:n<Vz?1e3*Bz:1e3*Hz,i*1e3),a*1e3);return r?setTimeout(()=>{u(s())},r):0})();return()=>{t&&clearTimeout(t)}},[e,r,a,i,s,l]),(0,L.useEffect)(()=>{u(s())},[e]);let d=n,f=Iz(e).valueOf();if(!f)return null;let p=Math.round(Math.abs(l-f)/1e3),m=f<l?`ago`:`from now`,[h,g]=p<zz?[Math.round(p),`second`]:p<Bz?[Math.round(p/zz),`minute`]:p<Vz?[Math.round(p/Bz),`hour`]:p<Hz?[Math.round(p/Vz),`day`]:p<Uz?[Math.round(p/Hz),`week`]:p<Wz?[Math.round(p/Uz),`month`]:[Math.round(p/Wz),`year`],_=o===void 0?typeof e==`string`?e:Iz(e).toISOString().substring(0,16).replace(`T`,` `):o,v=d===`time`?{...c,dateTime:Iz(e).toISOString()}:c,y=(e=e,t=t,n=n,r=f,i=Lz,a=a)=>Lz(e,t,n,r,i,a),b=t||Lz,x;try{x=b(h,g,m,f,y,s),x||=Lz(h,g,m,f,y,s)}catch(e){console.error(`[react-timeago] Formatter threw an error:`,e),x=Lz(h,g,m,f,y,s)}return L.createElement(d,Rz({},v,{title:_}),x)}function qz(){var e=[...arguments];return(0,L.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var Jz=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Yz(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function Xz(e){return`nodeType`in e}function Zz(e){return e?Yz(e)?e:Xz(e)?e.ownerDocument?.defaultView??window:window:window}function Qz(e){let{Document:t}=Zz(e);return e instanceof t}function $z(e){return!Yz(e)&&e instanceof Zz(e).HTMLElement}function eB(e){return e instanceof Zz(e).SVGElement}function tB(e){return e?Yz(e)?e.document:Xz(e)?Qz(e)?e:$z(e)||eB(e)?e.ownerDocument:document:document:document}var nB=Jz?L.useLayoutEffect:L.useEffect;function rB(e){let t=(0,L.useRef)(e);return nB(()=>{t.current=e}),(0,L.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function iB(){let e=(0,L.useRef)(null);return[(0,L.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,L.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function aB(e,t){t===void 0&&(t=[e]);let n=(0,L.useRef)(e);return nB(()=>{n.current!==e&&(n.current=e)},t),n}function oB(e,t){let n=(0,L.useRef)();return(0,L.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function sB(e){let t=rB(e),n=(0,L.useRef)(null);return[n,(0,L.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function cB(e){let t=(0,L.useRef)();return(0,L.useEffect)(()=>{t.current=e},[e]),t.current}var lB={};function uB(e,t){return(0,L.useMemo)(()=>{if(t)return t;let n=lB[e]==null?0:lB[e]+1;return lB[e]=n,e+`-`+n},[e,t])}function dB(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var fB=dB(1),pB=dB(-1);function mB(e){return`clientX`in e&&`clientY`in e}function hB(e){if(!e)return!1;let{KeyboardEvent:t}=Zz(e.target);return t&&e instanceof t}function gB(e){if(!e)return!1;let{TouchEvent:t}=Zz(e.target);return t&&e instanceof t}function _B(e){if(gB(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return mB(e)?{x:e.clientX,y:e.clientY}:null}var vB=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[vB.Translate.toString(e),vB.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),yB=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function bB(e){return e.matches(yB)?e:e.querySelector(yB)}var xB={display:`none`};function SB(e){let{id:t,value:n}=e;return L.createElement(`div`,{id:t,style:xB},n)}function CB(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return L.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function wB(){let[e,t]=(0,L.useState)(``);return{announce:(0,L.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var TB=(0,L.createContext)(null);function EB(e){let t=(0,L.useContext)(TB);(0,L.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function DB(){let[e]=(0,L.useState)(()=>new Set),t=(0,L.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,L.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var OB={draggable:`
|
|
269
|
+
</table>`,t}function lz(e){Ak(cz(e))}function uz(e,t,n){return parseInt(e.substr(t,n),16)}function dz(e){return e|=0,e<0?`00`:e<16?`0`+e.toString(16):e<256?e.toString(16):`ff`}function fz(e,t,n){return n=n<0?n+6:n>6?n-6:n,dz(255*(n<1?e+(t-e)*n:n<3?t:n<4?e+(t-e)*(4-n):e))}function pz(e){if(/^#[0-9a-f]{3,8}$/i.test(e)){let t,n=e.length;if(n<6){let n=e[1],r=e[2],i=e[3],a=e[4]||``;t=`#`+n+n+r+r+i+i+a+a}return(n==7||n>8)&&(t=e),t}}function mz(e,t,n){let r;if(t==0){let e=dz(n*255);r=e+e+e}else{let i=n<=.5?n*(t+1):n+t-n*t,a=n*2-i;r=fz(a,i,e*6+2)+fz(a,i,e*6)+fz(a,i,e*6-2)}return`#`+r}function hz(e,t,n){let r=[.55,.5,.5,.46,.6,.55,.55][e*6+.5|0];return n=n<.5?n*r*2:r+(n-.5)*(1-r)*2,mz(e,t,n)}var gz=typeof window<`u`?window:typeof self<`u`?self:typeof global<`u`?global:{},_z={V:`jdenticon_config`,n:`config`},vz={};function yz(e,t){let n=typeof e==`object`&&e||vz[_z.n]||gz[_z.V]||{},r=n.lightness||{},i=n.saturation||{},a=`color`in i?i.color:i,o=i.grayscale,s=n.backColor,c=n.padding;function l(e,t){let n=r[e];return n&&n.length>1||(n=t),function(e){return e=n[0]+e*(n[1]-n[0]),e<0?0:e>1?1:e}}function u(e){let t=n.hues,r;return t&&t.length>0&&(r=t[0|.999*e*t.length]),typeof r==`number`?(r/360%1+1)%1:e}return{W:u,o:typeof a==`number`?a:.5,D:typeof o==`number`?o:0,p:l(`color`,[.4,.8]),F:l(`grayscale`,[.3,.9]),G:pz(s),X:typeof e==`number`?e:typeof c==`number`?c:t}}var bz=class{constructor(e,t){this.x=e,this.y=t}},xz=class{constructor(e,t,n,r){this.q=e,this.t=t,this.H=n,this.Y=r}I(e,t,n,r){let i=this.q+this.H,a=this.t+this.H,o=this.Y;return o===1?new bz(i-t-(r||0),this.t+e):o===2?new bz(i-e-(n||0),a-t-(r||0)):o===3?new bz(this.q+t,a-e-(n||0)):new bz(this.q+e,this.t+t)}},Sz=new xz(0,0,0,0),Cz=class{constructor(e){this.J=e,this.u=Sz}g(e,t){let n=t?-2:2,r=[];for(let i=t?e.length-2:0;i<e.length&&i>=0;i+=n)r.push(this.u.I(e[i],e[i+1]));this.J.g(r)}h(e,t,n,r){let i=this.u.I(e,t,n,n);this.J.h(i,n,r)}i(e,t,n,r,i){this.g([e,t,e+n,t,e+n,t+r,e,t+r],i)}j(e,t,n,r,i,a){let o=[e+n,t,e+n,t+r,e,t+r,e,t];o.splice((i||0)%4*2,2),this.g(o,a)}K(e,t,n,r,i){this.g([e+n/2,t,e+n,t+r/2,e+n/2,t+r,e,t+r/2],i)}};function wz(e,t,n,r){e%=14;let i,a,o,s,c,l;e?e==1?(o=0|n*.5,s=0|n*.8,t.j(n-o,0,o,s,2)):e==2?(o=0|n/3,t.i(o,o,n-o,n-o)):e==3?(c=n*.1,l=n<6?1:n<8?2:0|n*.25,c=c>1?0|c:c>.5?1:c,t.i(l,l,n-c-l,n-c-l)):e==4?(a=0|n*.15,o=0|n*.5,t.h(n-o-a,n-o-a,o)):e==5?(c=n*.1,l=c*4,l>3&&(l=0|l),t.i(0,0,n,n),t.g([l,l,n-c,l,l+(n-l-c)/2,n-c],!0)):e==6?t.g([0,0,n,0,n,n*.7,n*.4,n*.4,n*.7,n,0,n]):e==7?t.j(n/2,n/2,n/2,n/2,3):e==8?(t.i(0,0,n,n/2),t.i(0,n/2,n/2,n/2),t.j(n/2,n/2,n/2,n/2,1)):e==9?(c=n*.14,l=n<4?1:n<6?2:0|n*.35,c=n<8?c:0|c,t.i(0,0,n,n),t.i(l,l,n-l-c,n-l-c,!0)):e==10?(c=n*.12,l=c*3,t.i(0,0,n,n),t.h(l,l,n-c-l,!0)):e==11?t.j(n/2,n/2,n/2,n/2,3):e==12?(a=n*.25,t.i(0,0,n,n),t.K(a,a,n-a,n-a,!0)):!r&&(a=n*.4,o=n*1.2,t.h(a,a,o)):(i=n*.42,t.g([0,0,n,0,n,n-i*2,n-i,n,0,n]))}function Tz(e,t,n){e%=4;let r;e?e==1?t.j(0,n/2,n,n/2,0):e==2?t.K(0,0,n,n):(r=n/6,t.h(r,r,n-2*r)):t.j(0,0,n,n,0)}function Ez(e,t){return e=t.W(e),[hz(e,t.D,t.F(0)),hz(e,t.o,t.p(.5)),hz(e,t.D,t.F(1)),hz(e,t.o,t.p(1)),hz(e,t.o,t.p(0))]}function Dz(e,t,n){let r=yz(n,.08);r.G&&e.m(r.G);let i=e.k,a=.5+i*r.X|0;i-=a*2;let o=new Cz(e),s=0|i/4,c=0|a+i/2-s*2,l=0|a+i/2-s*2;function u(n,r,i,a,u){let p=uz(t,i,1),m=a?uz(t,a,1):0;e.L(d[f[n]]);for(let e=0;e<u.length;e++)o.u=new xz(c+u[e][0]*s,l+u[e][1]*s,s,m++%4),r(p,o,s,e);e.M()}let d=Ez(uz(t,-7)/268435455,r),f=[],p;function m(e){if(e.indexOf(p)>=0){for(let t=0;t<e.length;t++)if(f.indexOf(e[t])>=0)return!0}}for(let e=0;e<3;e++)p=uz(t,8+e,1)%d.length,(m([0,4])||m([2,3]))&&(p=1),f.push(p);u(0,Tz,2,3,[[1,0],[2,0],[2,3],[1,3],[0,1],[3,1],[3,2],[0,2]]),u(1,Tz,4,5,[[0,0],[3,0],[3,3],[0,3]]),u(2,wz,1,null,[[1,1],[2,1],[2,2],[1,2]]),e.finish()}function Oz(e){var t=0,n=0,r=encodeURI(e)+`%80`,i=[],a,o=[],s=1732584193,c=4023233417,l=~s,u=~c,d=3285377520,f=[s,c,l,u,d],p=0,m=``;function h(e,t){return e<<t|e>>>32-t}for(;t<r.length;n++)i[n>>2]=i[n>>2]|(r[t]==`%`?parseInt(r.substring(t+1,t+=3),16):r.charCodeAt(t++))<<(3-(n&3))*8;for(a=((n+7>>6)+1)*16,i[a-1]=n*8-8;p<a;p+=16){for(t=0;t<80;t++)n=h(s,5)+d+(t<20?(c&l^~c&u)+1518500249:t<40?(c^l^u)+1859775393:t<60?(c&l^c&u^l&u)+2400959708:(c^l^u)+3395469782)+(o[t]=t<16?i[p+t]|0:h(o[t-3]^o[t-8]^o[t-14]^o[t-16],1)),d=u,u=l,l=h(c,30),c=s,s=n;f[0]=s=f[0]+s|0,f[1]=c=f[1]+c|0,f[2]=l=f[2]+l|0,f[3]=u=f[3]+u|0,f[4]=d=f[4]+d|0}for(t=0;t<40;t++)m+=(f[t>>3]>>>(7-(t&7))*4&15).toString(16);return m}function kz(e){return/^[0-9a-f]{11,}$/i.test(e)&&e}function Az(e){return Oz(e==null?``:``+e)}typeof document<`u`&&document.querySelectorAll.bind(document);function jz(e){return(e*10+.5|0)/10}var Mz=class{constructor(){this.v=``}g(e){let t=``;for(let n=0;n<e.length;n++)t+=(n?`L`:`M`)+jz(e[n].x)+` `+jz(e[n].y);this.v+=t+`Z`}h(e,t,n){let r=+!n,i=jz(t/2),a=jz(t),o=`a`+i+`,`+i+` 0 1,`+r+` `;this.v+=`M`+jz(e.x)+` `+jz(e.y+t/2)+o+a+`,0`+o+-a+`,0`}},Nz=class{constructor(e){this.A,this.B={},this.O=e,this.k=e.k}m(e){let t=/^(#......)(..)?/.exec(e),n=t[2]?uz(t[2],0)/255:1;this.O.m(t[1],n)}L(e){this.A=this.B[e]||(this.B[e]=new Mz)}M(){}g(e){this.A.g(e)}h(e,t,n){this.A.h(e,t,n)}finish(){let e=this.B;for(let t in e)e.hasOwnProperty(t)&&this.O.P(t,e[t].v)}},Pz={R:`http://www.w3.org/2000/svg`,S:`width`,T:`height`},Fz=class{constructor(e){this.k=e,this.C=`<svg xmlns="`+Pz.R+`" width="`+e+`" height="`+e+`" viewBox="0 0 `+e+` `+e+`">`}m(e,t){t&&(this.C+=`<rect width="100%" height="100%" fill="`+e+`" opacity="`+t.toFixed(2)+`"/>`)}P(e,t){this.C+=`<path fill="`+e+`" d="`+t+`"/>`}toString(){return this.C+`</svg>`}};function Iz(e,t,n){let r=new Fz(t);return Dz(new Nz(r),kz(e)||Az(e),n),r.toString()}function Lz(e){let t=new Date(e);if(!Number.isNaN(t.valueOf()))return t;let n=String(e).match(/\d+/g);if(n==null||n.length<=2)return t;{let[e,t,...r]=n.map(e=>parseInt(e)),i=[e,t-1,...r];return new Date(Date.UTC(...i))}}var Rz=(e,t,n)=>{let r=e===1?t:t+`s`;return e+` `+r+` `+n};function zz(){return zz=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},zz.apply(null,arguments)}var Bz=60,Vz=Bz*60,Hz=Vz*24,Uz=Hz*7,Wz=Hz*30,Gz=Hz*365,Kz=()=>Date.now();function qz({date:e,formatter:t,component:n=`time`,live:r=!0,minPeriod:i=0,maxPeriod:a=Uz,title:o,now:s=Kz,...c}){let[l,u]=(0,L.useState)(s());(0,L.useEffect)(()=>{if(!r)return;let t=(()=>{let t=Lz(e).valueOf();if(!t)return console.warn(`[react-timeago] Invalid Date provided`),0;let n=Math.round(Math.abs(l-t)/1e3),r=Math.min(Math.max(n<Bz?1e3:n<Vz?1e3*Bz:n<Hz?1e3*Vz:1e3*Uz,i*1e3),a*1e3);return r?setTimeout(()=>{u(s())},r):0})();return()=>{t&&clearTimeout(t)}},[e,r,a,i,s,l]),(0,L.useEffect)(()=>{u(s())},[e]);let d=n,f=Lz(e).valueOf();if(!f)return null;let p=Math.round(Math.abs(l-f)/1e3),m=f<l?`ago`:`from now`,[h,g]=p<Bz?[Math.round(p),`second`]:p<Vz?[Math.round(p/Bz),`minute`]:p<Hz?[Math.round(p/Vz),`hour`]:p<Uz?[Math.round(p/Hz),`day`]:p<Wz?[Math.round(p/Uz),`week`]:p<Gz?[Math.round(p/Wz),`month`]:[Math.round(p/Gz),`year`],_=o===void 0?typeof e==`string`?e:Lz(e).toISOString().substring(0,16).replace(`T`,` `):o,v=d===`time`?{...c,dateTime:Lz(e).toISOString()}:c,y=(e=e,t=t,n=n,r=f,i=Rz,a=a)=>Rz(e,t,n,r,i,a),b=t||Rz,x;try{x=b(h,g,m,f,y,s),x||=Rz(h,g,m,f,y,s)}catch(e){console.error(`[react-timeago] Formatter threw an error:`,e),x=Rz(h,g,m,f,y,s)}return L.createElement(d,zz({},v,{title:_}),x)}function Jz(){var e=[...arguments];return(0,L.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var Yz=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Xz(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function Zz(e){return`nodeType`in e}function Qz(e){return e?Xz(e)?e:Zz(e)?e.ownerDocument?.defaultView??window:window:window}function $z(e){let{Document:t}=Qz(e);return e instanceof t}function eB(e){return!Xz(e)&&e instanceof Qz(e).HTMLElement}function tB(e){return e instanceof Qz(e).SVGElement}function nB(e){return e?Xz(e)?e.document:Zz(e)?$z(e)?e:eB(e)||tB(e)?e.ownerDocument:document:document:document}var rB=Yz?L.useLayoutEffect:L.useEffect;function iB(e){let t=(0,L.useRef)(e);return rB(()=>{t.current=e}),(0,L.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function aB(){let e=(0,L.useRef)(null);return[(0,L.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,L.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function oB(e,t){t===void 0&&(t=[e]);let n=(0,L.useRef)(e);return rB(()=>{n.current!==e&&(n.current=e)},t),n}function sB(e,t){let n=(0,L.useRef)();return(0,L.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function cB(e){let t=iB(e),n=(0,L.useRef)(null);return[n,(0,L.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function lB(e){let t=(0,L.useRef)();return(0,L.useEffect)(()=>{t.current=e},[e]),t.current}var uB={};function dB(e,t){return(0,L.useMemo)(()=>{if(t)return t;let n=uB[e]==null?0:uB[e]+1;return uB[e]=n,e+`-`+n},[e,t])}function fB(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var pB=fB(1),mB=fB(-1);function hB(e){return`clientX`in e&&`clientY`in e}function gB(e){if(!e)return!1;let{KeyboardEvent:t}=Qz(e.target);return t&&e instanceof t}function _B(e){if(!e)return!1;let{TouchEvent:t}=Qz(e.target);return t&&e instanceof t}function vB(e){if(_B(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return hB(e)?{x:e.clientX,y:e.clientY}:null}var yB=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[yB.Translate.toString(e),yB.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),bB=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function xB(e){return e.matches(bB)?e:e.querySelector(bB)}var SB={display:`none`};function CB(e){let{id:t,value:n}=e;return L.createElement(`div`,{id:t,style:SB},n)}function wB(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return L.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function TB(){let[e,t]=(0,L.useState)(``);return{announce:(0,L.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var EB=(0,L.createContext)(null);function DB(e){let t=(0,L.useContext)(EB);(0,L.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function OB(){let[e]=(0,L.useState)(()=>new Set),t=(0,L.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,L.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var kB={draggable:`
|
|
270
270
|
To pick up a draggable item, press the space bar.
|
|
271
271
|
While dragging, use the arrow keys to move the item.
|
|
272
272
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
273
|
-
`},kB={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function AB(e){let{announcements:t=kB,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=OB}=e,{announce:a,announcement:o}=wB(),s=uB(`DndLiveRegion`),[c,l]=(0,L.useState)(!1);if((0,L.useEffect)(()=>{l(!0)},[]),EB((0,L.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=L.createElement(L.Fragment,null,L.createElement(SB,{id:r,value:i.draggable}),L.createElement(CB,{id:s,announcement:o}));return n?(0,$g.createPortal)(u,n):u}var jB;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(jB||={});function MB(){}function NB(e,t){return(0,L.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function PB(){var e=[...arguments];return(0,L.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var FB=Object.freeze({x:0,y:0});function IB(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function LB(e,t){let n=_B(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function RB(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function zB(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function BB(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function VB(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function HB(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var UB=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=HB(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=IB(HB(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(RB)},WB=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=BB(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=BB(r),o=i.reduce((e,t,r)=>e+IB(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(RB)};function GB(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var KB=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=GB(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(zB)};function qB(e,t){let{top:n,left:r,bottom:i,right:a}=t;return n<=e.y&&e.y<=i&&r<=e.x&&e.x<=a}var JB=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];let i=[];for(let e of t){let{id:t}=e,a=n.get(t);if(a&&qB(r,a)){let n=BB(a).reduce((e,t)=>e+IB(r,t),0),o=Number((n/4).toFixed(4));i.push({id:t,data:{droppableContainer:e,value:o}})}}return i.sort(RB)};function YB(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function XB(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:FB}function ZB(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var QB=ZB(1);function $B(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function eV(e,t,n){let r=$B(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var tV={ignoreTransform:!1};function nV(e,t){t===void 0&&(t=tV);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=Zz(e).getComputedStyle(e);t&&(n=eV(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function rV(e){return nV(e,{ignoreTransform:!0})}function iV(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function aV(e,t){return t===void 0&&(t=Zz(e).getComputedStyle(e)),t.position===`fixed`}function oV(e,t){t===void 0&&(t=Zz(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`&&n.test(r)})}function sV(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(Qz(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!$z(i)||eB(i)||n.includes(i))return n;let a=Zz(e).getComputedStyle(i);return i!==e&&oV(i,a)&&n.push(i),aV(i,a)?n:r(i.parentNode)}return e?r(e):n}function cV(e){let[t]=sV(e,1);return t??null}function lV(e){return!Jz||!e?null:Yz(e)?e:Xz(e)?Qz(e)||e===tB(e).scrollingElement?window:$z(e)?e:null:null}function uV(e){return Yz(e)?e.scrollX:e.scrollLeft}function dV(e){return Yz(e)?e.scrollY:e.scrollTop}function fV(e){return{x:uV(e),y:dV(e)}}var pV;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(pV||={});function mV(e){return!Jz||!e?!1:e===document.scrollingElement}function hV(e){let t={x:0,y:0},n=mV(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var gV={x:.2,y:.2};function _V(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=gV);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=hV(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=pV.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=pV.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=pV.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=pV.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function vV(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function yV(e){return e.reduce((e,t)=>fB(e,fV(t)),FB)}function bV(e){return e.reduce((e,t)=>e+uV(t),0)}function xV(e){return e.reduce((e,t)=>e+dV(t),0)}function SV(e,t){if(t===void 0&&(t=nV),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);cV(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var CV=[[`x`,[`left`,`right`],bV],[`y`,[`top`,`bottom`],xV]],wV=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=sV(t),r=yV(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of CV)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},TV=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function EV(e){let{EventTarget:t}=Zz(e);return e instanceof t?e:tB(e)}function DV(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t&&r>t.y}var OV;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(OV||={});function kV(e){e.preventDefault()}function AV(e){e.stopPropagation()}var jV;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(jV||={});var MV={start:[jV.Space,jV.Enter],cancel:[jV.Esc],end:[jV.Space,jV.Enter,jV.Tab]},NV=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case jV.Right:return{...n,x:n.x+25};case jV.Left:return{...n,x:n.x-25};case jV.Down:return{...n,y:n.y+25};case jV.Up:return{...n,y:n.y-25}}},PV=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new TV(tB(t)),this.windowListeners=new TV(Zz(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(OV.Resize,this.handleCancel),this.windowListeners.add(OV.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(OV.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&SV(n),t(FB)}handleKeyDown(e){if(hB(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=MV,coordinateGetter:a=NV,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:FB;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=pB(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=hV(n),p=vV(n),m={x:Math.min(i===jV.Right?p.right-p.width/2:p.right,Math.max(i===jV.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===jV.Down?p.bottom-p.height/2:p.bottom,Math.max(i===jV.Down?p.top:p.top+p.height/2,u.y))},h=i===jV.Right&&!s||i===jV.Left&&!c,g=i===jV.Down&&!l||i===jV.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===jV.Right&&e<=d.x||i===jV.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===jV.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===jV.Down&&e<=d.y||i===jV.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===jV.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,fB(pB(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};PV.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=MV,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function FV(e){return!!(e&&`distance`in e)}function IV(e){return!!(e&&`delay`in e)}var LV=class{constructor(e,t,n){n===void 0&&(n=EV(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=tB(i),this.documentListeners=new TV(this.document),this.listeners=new TV(n),this.windowListeners=new TV(Zz(i)),this.initialCoordinates=_B(r)??FB,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(OV.Resize,this.handleCancel),this.windowListeners.add(OV.DragStart,kV),this.windowListeners.add(OV.VisibilityChange,this.handleCancel),this.windowListeners.add(OV.ContextMenu,kV),this.documentListeners.add(OV.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(IV(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(FV(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(OV.Click,AV,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(OV.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=_B(e)??FB,s=pB(n,o);if(!t&&a){if(FV(a)){if(a.tolerance!=null&&DV(s,a.tolerance))return this.handleCancel();if(DV(s,a.distance))return this.handleStart()}if(IV(a)&&DV(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===jV.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},RV={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},zV=class extends LV{constructor(e){let{event:t}=e,n=tB(t.target);super(e,RV,n)}};zV.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var BV={move:{name:`mousemove`},end:{name:`mouseup`}},VV;(function(e){e[e.RightClick=2]=`RightClick`})(VV||={});var HV=class extends LV{constructor(e){super(e,BV,tB(e.event.target))}};HV.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===VV.RightClick?!1:(r?.({event:n}),!0)}}];var UV={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},WV=class extends LV{constructor(e){super(e,UV)}static setup(){return window.addEventListener(UV.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(UV.move.name,e)};function e(){}}};WV.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var GV;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(GV||={});var KV;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(KV||={});function qV(e){let{acceleration:t,activator:n=GV.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=KV.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=YV({delta:d,disabled:!a}),[m,h]=iB(),g=(0,L.useRef)({x:0,y:0}),_=(0,L.useRef)({x:0,y:0}),v=(0,L.useMemo)(()=>{switch(n){case GV.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case GV.DraggableRect:return i}},[n,i,c]),y=(0,L.useRef)(null),b=(0,L.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,L.useMemo)(()=>s===KV.TreeOrder?[...l].reverse():l,[s,l]);(0,L.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=l.indexOf(e),i=u[n];if(!i)continue;let{direction:a,speed:s}=_V(e,i,v,t,f);for(let e of[`x`,`y`])p[e][a[e]]||(s[e]=0,a[e]=0);if(s.x>0||s.y>0){h(),y.current=e,m(b,o),g.current=s,_.current=a;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var JV={x:{[pV.Backward]:!1,[pV.Forward]:!1},y:{[pV.Backward]:!1,[pV.Forward]:!1}};function YV(e){let{delta:t,disabled:n}=e,r=cB(t);return oB(e=>{if(n||!r||!e)return JV;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[pV.Backward]:e.x[pV.Backward]||i.x===-1,[pV.Forward]:e.x[pV.Forward]||i.x===1},y:{[pV.Backward]:e.y[pV.Backward]||i.y===-1,[pV.Forward]:e.y[pV.Forward]||i.y===1}}},[n,t,r])}function XV(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return oB(e=>t==null?null:r??e??null,[r,t])}function ZV(e,t){return(0,L.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var QV;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(QV||={});var $V;(function(e){e.Optimized=`optimized`})($V||={});var eH=new Map;function tH(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,L.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,L.useRef)(e),d=g(),f=aB(d),p=(0,L.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,L.useRef)(null),h=oB(t=>{if(d&&!n)return eH;if(!t||t===eH||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new wV(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,L.useEffect)(()=>{u.current=e},[e]),(0,L.useEffect)(()=>{d||p()},[n,d]),(0,L.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,L.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case QV.Always:return!1;case QV.BeforeDragging:return n;default:return!n}}}function nH(e,t){return oB(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function rH(e,t){return nH(e,t)}function iH(e){let{callback:t,disabled:n}=e,r=rB(t),i=(0,L.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,L.useEffect)(()=>()=>i?.disconnect(),[i]),i}function aH(e){let{callback:t,disabled:n}=e,r=rB(t),i=(0,L.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,L.useEffect)(()=>()=>i?.disconnect(),[i]),i}function oH(e){return new wV(nV(e),e)}function sH(e,t,n){t===void 0&&(t=oH);let[r,i]=(0,L.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=iH({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=aH({callback:a});return nB(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function cH(e){return XB(e,nH(e))}var lH=[];function uH(e){let t=(0,L.useRef)(e),n=oB(n=>e?n&&n!==lH&&e&&t.current&&e.parentNode===t.current.parentNode?n:sV(e):lH,[e]);return(0,L.useEffect)(()=>{t.current=e},[e]),n}function dH(e){let[t,n]=(0,L.useState)(null),r=(0,L.useRef)(e),i=(0,L.useCallback)(e=>{let t=lV(e.target);t&&n(e=>e?(e.set(t,fV(t)),new Map(e)):null)},[]);return(0,L.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=lV(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,fV(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{lV(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,L.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>fB(e,t),FB):yV(e):FB,[e,t])}function fH(e,t){t===void 0&&(t=[]);let n=(0,L.useRef)(null);return(0,L.useEffect)(()=>{n.current=null},t),(0,L.useEffect)(()=>{let t=e!==FB;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?pB(e,n.current):FB}function pH(e){(0,L.useEffect)(()=>{if(!Jz)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function mH(e,t){return(0,L.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function hH(e){return(0,L.useMemo)(()=>e?iV(e):null,[e])}var gH=[];function _H(e,t){t===void 0&&(t=nV);let[n]=e,r=hH(n?Zz(n):null),[i,a]=(0,L.useState)(gH);function o(){a(()=>e.length?e.map(e=>mV(e)?r:new wV(t(e),e)):gH)}let s=aH({callback:o});return nB(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function vH(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return $z(t)?t:e}function yH(e){let{measure:t}=e,[n,r]=(0,L.useState)(null),i=aH({callback:(0,L.useCallback)(e=>{for(let{target:n}of e)if($z(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=sB((0,L.useCallback)(e=>{let n=vH(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,L.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var bH=[{sensor:zV,options:{}},{sensor:PV,options:{}}],xH={current:{}},SH={draggable:{measure:rV},droppable:{measure:rV,strategy:QV.WhileDragging,frequency:$V.Optimized},dragOverlay:{measure:nV}},CH=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},wH={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new CH,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:MB},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:SH,measureDroppableContainers:MB,windowRect:null,measuringScheduled:!1},TH={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:MB,draggableNodes:new Map,over:null,measureDroppableContainers:MB},EH=(0,L.createContext)(TH),DH=(0,L.createContext)(wH);function OH(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new CH}}}function kH(e,t){switch(t.type){case jB.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case jB.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case jB.DragEnd:case jB.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case jB.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new CH(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case jB.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new CH(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case jB.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new CH(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function AH(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,L.useContext)(EH),a=cB(r),o=cB(n?.id);return(0,L.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!hB(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=bB(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function jH(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function MH(e){return(0,L.useMemo)(()=>({draggable:{...SH.draggable,...e?.draggable},droppable:{...SH.droppable,...e?.droppable},dragOverlay:{...SH.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function NH(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,L.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;nB(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=XB(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=cV(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var PH=(0,L.createContext)({...FB,scaleX:1,scaleY:1}),FH;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(FH||={});var IH=(0,L.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=bH,collisionDetection:o=KB,measuring:s,modifiers:c,...l}=e,[u,d]=(0,L.useReducer)(kH,void 0,OH),[f,p]=DB(),[m,h]=(0,L.useState)(FH.Uninitialized),g=m===FH.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,L.useRef)({initial:null,translated:null}),C=(0,L.useMemo)(()=>_==null?null:{id:_,data:x?.data??xH,rect:S},[_,x]),w=(0,L.useRef)(null),[T,E]=(0,L.useState)(null),[D,O]=(0,L.useState)(null),ee=aB(l,Object.values(l)),te=uB(`DndDescribedBy`,t),k=(0,L.useMemo)(()=>b.getEnabled(),[b]),A=MH(s),{droppableRects:j,measureDroppableContainers:M,measuringScheduled:ne}=tH(k,{dragging:g,dependencies:[y.x,y.y],config:A.droppable}),re=XV(v,_),ie=(0,L.useMemo)(()=>D?_B(D):null,[D]),ae=ke(),N=rH(re,A.draggable.measure);NH({activeNode:_==null?null:v.get(_),config:ae.layoutShiftCompensation,initialRect:N,measure:A.draggable.measure});let oe=sH(re,A.draggable.measure,N),se=sH(re?re.parentElement:null),ce=(0,L.useRef)({activatorEvent:null,active:null,activeNode:re,collisionRect:null,collisions:null,droppableRects:j,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),P=b.getNodeFor(ce.current.over?.id),le=yH({measure:A.dragOverlay.measure}),ue=le.nodeRef.current??re,F=g?le.rect??oe:null,I=!!(le.nodeRef.current&&le.rect),de=cH(I?null:oe),fe=hH(ue?Zz(ue):null),pe=uH(g?P??re:null),me=_H(pe),he=jH(c,{transform:{x:y.x-de.x,y:y.y-de.y,scaleX:1,scaleY:1},activatorEvent:D,active:C,activeNodeRect:oe,containerNodeRect:se,draggingNodeRect:F,over:ce.current.over,overlayNodeRect:le.rect,scrollableAncestors:pe,scrollableAncestorRects:me,windowRect:fe}),ge=ie?fB(ie,y):null,_e=dH(pe),ve=fH(_e),ye=fH(_e,[oe]),be=fB(he,ve),xe=F?QB(F,he):null,Se=C&&xe?o({active:C,collisionRect:xe,droppableRects:j,droppableContainers:k,pointerCoordinates:ge}):null,R=VB(Se,`id`),[z,B]=(0,L.useState)(null),Ce=YB(I?he:fB(he,ye),z?.rect??null,oe),we=(0,L.useRef)(null),Te=(0,L.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(w.current==null)return;let i=v.get(w.current);if(!i)return;let a=e.nativeEvent,o=new n({active:w.current,activeNode:i,event:a,options:r,context:ce,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=ee.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=ee.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=w.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=ee.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,$g.unstable_batchedUpdates)(()=>{r?.(i),h(FH.Initializing),d({type:jB.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),E(we.current),O(a)})},onMove(e){d({type:jB.DragMove,coordinates:e})},onEnd:s(jB.DragEnd),onCancel:s(jB.DragCancel)});we.current=o;function s(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=ce.current,o=null;if(t&&i){let{cancelDrop:s}=ee.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===jB.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=jB.DragCancel)}w.current=null,(0,$g.unstable_batchedUpdates)(()=>{d({type:e}),h(FH.Uninitialized),B(null),E(null),O(null),we.current=null;let t=e===jB.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=ee.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Ee=ZV(a,(0,L.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(w.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},w.current=r,Te(n,t))},[v,Te]));pH(a),nB(()=>{oe&&m===FH.Initializing&&h(FH.Initialized)},[oe,m]),(0,L.useEffect)(()=>{let{onDragMove:e}=ee.current,{active:t,activatorEvent:n,collisions:r,over:i}=ce.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:be.x,y:be.y},over:i};(0,$g.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[be.x,be.y]),(0,L.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=ce.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=ee.current,o=r.get(R),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,$g.unstable_batchedUpdates)(()=>{B(s),a?.(c),f({type:`onDragOver`,event:c})})},[R]),nB(()=>{ce.current={activatorEvent:D,active:C,activeNode:re,collisionRect:xe,collisions:Se,droppableRects:j,draggableNodes:v,draggingNode:ue,draggingNodeRect:F,droppableContainers:b,over:z,scrollableAncestors:pe,scrollAdjustedTranslate:be},S.current={initial:F,translated:xe}},[C,re,Se,xe,v,ue,F,j,b,z,pe,be]),qV({...ae,delta:y,draggingRect:xe,pointerCoordinates:ge,scrollableAncestors:pe,scrollableAncestorRects:me});let De=(0,L.useMemo)(()=>({active:C,activeNode:re,activeNodeRect:oe,activatorEvent:D,collisions:Se,containerNodeRect:se,dragOverlay:le,draggableNodes:v,droppableContainers:b,droppableRects:j,over:z,measureDroppableContainers:M,scrollableAncestors:pe,scrollableAncestorRects:me,measuringConfiguration:A,measuringScheduled:ne,windowRect:fe}),[C,re,oe,D,Se,se,le,v,b,j,z,M,pe,me,A,ne,fe]),Oe=(0,L.useMemo)(()=>({activatorEvent:D,activators:Ee,active:C,activeNodeRect:oe,ariaDescribedById:{draggable:te},dispatch:d,draggableNodes:v,over:z,measureDroppableContainers:M}),[D,Ee,C,oe,d,te,v,z,M]);return L.createElement(TB.Provider,{value:p},L.createElement(EH.Provider,{value:Oe},L.createElement(DH.Provider,{value:De},L.createElement(PH.Provider,{value:Ce},i)),L.createElement(AH,{disabled:n?.restoreFocus===!1})),L.createElement(AB,{...n,hiddenTextDescribedById:te}));function ke(){let e=T?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),LH=(0,L.createContext)(null),RH=`button`,zH=`Draggable`;function BH(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=uB(zH),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,L.useContext)(EH),{role:p=RH,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,L.useContext)(g?PH:LH),[v,y]=sB(),[b,x]=sB(),S=mH(o,t),C=aB(n);return nB(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:C}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,L.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===RH?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function VH(){return(0,L.useContext)(DH)}var HH=`Droppable`,UH={timeout:25};function WH(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=uB(HH),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,L.useContext)(EH),u=(0,L.useRef)({disabled:n}),d=(0,L.useRef)(!1),f=(0,L.useRef)(null),p=(0,L.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...UH,...i},_=aB(h??r),v=aH({callback:(0,L.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=sB((0,L.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=aB(t);return(0,L.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,L.useEffect)(()=>(s({type:jB.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:jB.UnregisterDroppable,key:a,id:r})),[r]),(0,L.useEffect)(()=>{n!==u.current.disabled&&(s({type:jB.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function GH(e){let{animation:t,children:n}=e,[r,i]=(0,L.useState)(null),[a,o]=(0,L.useState)(null),s=cB(n);return!n&&!r&&s&&i(s),nB(()=>{if(!a)return;let e=r?.key,n=r?.props.id;if(e==null||n==null){i(null);return}Promise.resolve(t(n,a)).then(()=>{i(null)})},[t,r,a]),L.createElement(L.Fragment,null,n,r?(0,L.cloneElement)(r,{ref:o}):null)}var KH={x:0,y:0,scaleX:1,scaleY:1};function qH(e){let{children:t}=e;return L.createElement(EH.Provider,{value:TH},L.createElement(PH.Provider,{value:KH},t))}var JH={position:`fixed`,touchAction:`none`},YH=e=>hB(e)?`transform 250ms ease`:void 0,XH=(0,L.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=YH}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...JH,width:s.width,height:s.height,top:s.top,left:s.left,transform:vB.Transform.toString(d),transformOrigin:i&&r?LB(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return L.createElement(n,{className:o,style:f,ref:t},a)}),ZH={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:vB.Transform.toString(t)},{transform:vB.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}})({styles:{active:{opacity:`0`}}})};function QH(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return rB((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=vH(a);if(!c)return;let{transform:l}=Zz(a).getComputedStyle(a),u=$B(l);if(!u)return;let d=typeof t==`function`?t:$H(t);return SV(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function $H(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...ZH,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var eU=0;function tU(e){return(0,L.useMemo)(()=>{if(e!=null)return eU++,eU},[e])}var nU=L.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:a,modifiers:o,wrapperElement:s=`div`,className:c,zIndex:l=999}=e,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggableNodes:m,droppableContainers:h,dragOverlay:g,over:_,measuringConfiguration:v,scrollableAncestors:y,scrollableAncestorRects:b,windowRect:x}=VH(),S=(0,L.useContext)(PH),C=tU(d?.id),w=jH(o,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:g.rect,over:_,overlayNodeRect:g.rect,scrollableAncestors:y,scrollableAncestorRects:b,transform:S,windowRect:x}),T=nH(f),E=QH({config:r,draggableNodes:m,droppableContainers:h,measuringConfiguration:v}),D=T?g.setRef:void 0;return L.createElement(qH,null,L.createElement(GH,{animation:E},d&&C?L.createElement(XH,{key:C,id:d.id,ref:D,as:s,activatorEvent:u,adjustScale:t,className:c,transition:a,rect:T,style:{zIndex:l,...i},transform:w},n):null))});function rU(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function iU(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function aU(e){return e!==null&&e>=0}function oU(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function sU(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var cU={scaleX:1,scaleY:1},lU=e=>{let{rects:t,activeNodeRect:n,activeIndex:r,overIndex:i,index:a}=e,o=t[r]??n;if(!o)return null;let s=uU(t,a,r);if(a===r){let e=t[i];return e?{x:r<i?e.left+e.width-(o.left+o.width):e.left-o.left,y:0,...cU}:null}return a>r&&a<=i?{x:-o.width-s,y:0,...cU}:a<r&&a>=i?{x:o.width+s,y:0,...cU}:{x:0,y:0,...cU}};function uU(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return!r||!i&&!a?0:n<t?i?r.left-(i.left+i.width):a.left-(r.left+r.width):a?a.left-(r.left+r.width):r.left-(i.left+i.width)}var dU=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=rU(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},fU={scaleX:1,scaleY:1},pU=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...fU}:null}let s=mU(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...fU}:r<t&&r>=a?{x:0,y:o.height+s,...fU}:{x:0,y:0,...fU}};function mU(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var hU=`Sortable`,gU=L.createContext({activeIndex:-1,containerId:hU,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:dU,disabled:{draggable:!1,droppable:!1}});function _U(e){let{children:t,id:n,items:r,strategy:i=dU,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=VH(),d=uB(hU,n),f=s.rect!==null,p=(0,L.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,L.useRef)(p),v=!oU(p,_.current),y=g!==-1&&h===-1||v,b=sU(a);nB(()=>{v&&m&&u(p)},[v,p,m,u]),(0,L.useEffect)(()=>{_.current=p},[p]);let x=(0,L.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:iU(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return L.createElement(gU.Provider,{value:x},t)}var vU=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return rU(n,r,i).indexOf(t)},yU=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},bU={duration:200,easing:`ease`},xU=`transform`,SU=vB.Transition.toString({property:xU,duration:0,easing:`linear`}),CU={roleDescription:`sortable`};function wU(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,L.useState)(null),s=(0,L.useRef)(n);return nB(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=nV(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,L.useEffect)(()=>{a&&o(null)},[a]),a}function TU(e){let{animateLayoutChanges:t=yU,attributes:n,disabled:r,data:i,getNewIndex:a=vU,id:o,strategy:s,resizeObserverConfig:c,transition:l=bU}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,L.useContext)(gU),y=EU(r,p),b=u.indexOf(o),x=(0,L.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,L.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:C,node:w,isOver:T,setNodeRef:E}=WH({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:D,activatorEvent:O,activeNodeRect:ee,attributes:te,setNodeRef:k,listeners:A,isDragging:j,over:M,setActivatorNodeRef:ne,transform:re}=BH({id:o,data:x,attributes:{...CU,...n},disabled:y.draggable}),ie=qz(E,k),ae=!!D,N=ae&&!m&&aU(f)&&aU(g),oe=!_&&j,se=N?(oe&&N?re:null)??(s??v)({rects:h,activeNodeRect:ee,activeIndex:f,overIndex:g,index:b}):null,ce=aU(f)&&aU(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,P=D?.id,le=(0,L.useRef)({activeId:P,items:u,newIndex:ce,containerId:d}),ue=u!==le.current.items,F=t({active:D,containerId:d,isDragging:j,isSorting:ae,id:o,index:b,items:u,newIndex:le.current.newIndex,previousItems:le.current.items,previousContainerId:le.current.containerId,transition:l,wasDragging:le.current.activeId!=null}),I=wU({disabled:!F,index:b,node:w,rect:C});return(0,L.useEffect)(()=>{ae&&le.current.newIndex!==ce&&(le.current.newIndex=ce),d!==le.current.containerId&&(le.current.containerId=d),u!==le.current.items&&(le.current.items=u)},[ae,ce,d,u]),(0,L.useEffect)(()=>{if(P===le.current.activeId)return;if(P!=null&&le.current.activeId==null){le.current.activeId=P;return}let e=setTimeout(()=>{le.current.activeId=P},50);return()=>clearTimeout(e)},[P]),{active:D,activeIndex:f,attributes:te,data:x,rect:C,index:b,newIndex:ce,items:u,isOver:T,isSorting:ae,isDragging:j,listeners:A,node:w,overIndex:g,over:M,setNodeRef:ie,setActivatorNodeRef:ne,setDroppableNodeRef:E,setDraggableNodeRef:k,transform:I??se,transition:de()};function de(){if(I||ue&&le.current.newIndex===b)return SU;if(!(oe&&!hB(O)||!l)&&(ae||F))return vB.Transition.toString({...l,property:xU})}}function EU(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function DU(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var OU=[jV.Down,jV.Right,jV.Up,jV.Left],kU=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(OU.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case jV.Down:r.top<a.top&&t.push(n);break;case jV.Up:r.top>a.top&&t.push(n);break;case jV.Left:r.left>a.left&&t.push(n);break;case jV.Right:r.left<a.left&&t.push(n);break}});let c=WB({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=VB(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=sV(c).some((e,t)=>s[t]!==e),i=AU(e,t),a=jU(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:pB(u,l)}}}};function AU(e,t){return!DU(e)||!DU(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function jU(e,t){return!DU(e)||!DU(t)||!AU(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var MU=(0,L.createContext)(null),NU={didCatch:!1,error:null},PU=class extends L.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=NU}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(...e){let{error:t}=this.state;t!==null&&(this.props.onReset?.({args:e,reason:`imperative-api`}),this.setState(NU))}componentDidCatch(e,t){this.props.onError?.(e,t)}componentDidUpdate(e,t){let{didCatch:n}=this.state,{resetKeys:r}=this.props;n&&t.error!==null&&FU(e.resetKeys,r)&&(this.props.onReset?.({next:r,prev:e.resetKeys,reason:`keys`}),this.setState(NU))}render(){let{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:i,error:a}=this.state,o=e;if(i){let e={error:a,resetErrorBoundary:this.resetErrorBoundary};if(typeof t==`function`)o=t(e);else if(n)o=(0,L.createElement)(n,e);else if(r!==void 0)o=r;else throw a}return(0,L.createElement)(MU.Provider,{value:{didCatch:i,error:a,resetErrorBoundary:this.resetErrorBoundary}},o)}};function FU(e=[],t=[]){return e.length!==t.length||e.some((e,n)=>!Object.is(e,t[n]))}function IU(e){return typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`?e.toString():JSON.stringify(e)??``}function LU(){return(0,H.jsxs)(`div`,{style:{textAlign:`center`,marginTop:`4em`},children:[(0,H.jsx)(Lm,{}),(0,H.jsx)(`p`,{children:`Loading`})]})}function RU({error:e}){return e===void 0?(0,H.jsx)(H.Fragment,{}):Bt.isApiException(e)?(0,H.jsx)(ov,{children:(0,H.jsxs)(uv,{children:[(0,H.jsx)(`h3`,{children:`FMS Insight Server Error`}),(0,H.jsx)(`p`,{children:e.response})]})}):e instanceof Error?(0,H.jsx)(ov,{children:(0,H.jsx)(uv,{children:e.message})}):(0,H.jsx)(ov,{children:(0,H.jsxs)(uv,{children:[(0,H.jsx)(`h3`,{children:`Unknown Error`}),(0,H.jsx)(`p`,{children:IU(e)})]})})}function zU(e){return(0,H.jsx)(PU,{FallbackComponent:RU,children:(0,H.jsx)(L.Suspense,{fallback:e.fallback??(0,H.jsx)(LU,{}),children:e.children})})}function BU(e){let t=e.action.loadCancellationId;return t!==void 0&&t.trim()!==``?t:null}function VU(e){switch(e.action.type){case st.Loading:case st.UnloadToInProcess:case st.UnloadToCompletedMaterial:case st.LoadingToBasket:return!0;default:return!1}}function HU(e){let t=BU(e);return t!==null||VU(e)?{kind:`ActiveLoadStationOperation`,cancellationId:t}:e.location.type===at.InQueue&&e.action.type===st.Waiting?{kind:`HumanControlledQueue`}:e.location.type===at.OnPallet||e.location.type===at.InBasket||e.action.type===st.Machining?{kind:`AutomationControlled`}:{kind:`AddToQueueProposal`}}function UU(e){return HU(e).kind===`ActiveLoadStationOperation`}function WU(e){if(e===null)return!1;let t=HU(e);return t.kind===`ActiveLoadStationOperation`&&t.cancellationId!==null}function GU(e){return e!==null&&HU(e).kind===`AutomationControlled`}function KU(e){return e!==null&&HU(e).kind===`HumanControlledQueue`}function qU(e){return KU(e)}function JU(e){return e===null||HU(e).kind===`AddToQueueProposal`}function YU(e){if(e===null)return!0;let t=HU(e);return t.kind===`AddToQueueProposal`||t.kind===`HumanControlledQueue`}var XU=class extends L.PureComponent{render(){let e=this.props.size||50,t=Fz(this.props.part,e);return(0,H.jsx)(`div`,{style:{width:e,height:e},dangerouslySetInnerHTML:{__html:t}})}},ZU=2,QU=Fa`
|
|
273
|
+
`},AB={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function jB(e){let{announcements:t=AB,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=kB}=e,{announce:a,announcement:o}=TB(),s=dB(`DndLiveRegion`),[c,l]=(0,L.useState)(!1);if((0,L.useEffect)(()=>{l(!0)},[]),DB((0,L.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=L.createElement(L.Fragment,null,L.createElement(CB,{id:r,value:i.draggable}),L.createElement(wB,{id:s,announcement:o}));return n?(0,$g.createPortal)(u,n):u}var MB;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(MB||={});function NB(){}function PB(e,t){return(0,L.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function FB(){var e=[...arguments];return(0,L.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var IB=Object.freeze({x:0,y:0});function LB(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function RB(e,t){let n=vB(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function zB(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function BB(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function VB(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function HB(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function UB(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var WB=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=UB(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=LB(UB(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(zB)},GB=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=VB(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=VB(r),o=i.reduce((e,t,r)=>e+LB(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(zB)};function KB(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var qB=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=KB(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(BB)};function JB(e,t){let{top:n,left:r,bottom:i,right:a}=t;return n<=e.y&&e.y<=i&&r<=e.x&&e.x<=a}var YB=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];let i=[];for(let e of t){let{id:t}=e,a=n.get(t);if(a&&JB(r,a)){let n=VB(a).reduce((e,t)=>e+LB(r,t),0),o=Number((n/4).toFixed(4));i.push({id:t,data:{droppableContainer:e,value:o}})}}return i.sort(zB)};function XB(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function ZB(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:IB}function QB(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var $B=QB(1);function eV(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function tV(e,t,n){let r=eV(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var nV={ignoreTransform:!1};function rV(e,t){t===void 0&&(t=nV);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=Qz(e).getComputedStyle(e);t&&(n=tV(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function iV(e){return rV(e,{ignoreTransform:!0})}function aV(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function oV(e,t){return t===void 0&&(t=Qz(e).getComputedStyle(e)),t.position===`fixed`}function sV(e,t){t===void 0&&(t=Qz(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`&&n.test(r)})}function cV(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if($z(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!eB(i)||tB(i)||n.includes(i))return n;let a=Qz(e).getComputedStyle(i);return i!==e&&sV(i,a)&&n.push(i),oV(i,a)?n:r(i.parentNode)}return e?r(e):n}function lV(e){let[t]=cV(e,1);return t??null}function uV(e){return!Yz||!e?null:Xz(e)?e:Zz(e)?$z(e)||e===nB(e).scrollingElement?window:eB(e)?e:null:null}function dV(e){return Xz(e)?e.scrollX:e.scrollLeft}function fV(e){return Xz(e)?e.scrollY:e.scrollTop}function pV(e){return{x:dV(e),y:fV(e)}}var mV;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(mV||={});function hV(e){return!Yz||!e?!1:e===document.scrollingElement}function gV(e){let t={x:0,y:0},n=hV(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var _V={x:.2,y:.2};function vV(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=_V);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=gV(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=mV.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=mV.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=mV.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=mV.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function yV(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function bV(e){return e.reduce((e,t)=>pB(e,pV(t)),IB)}function xV(e){return e.reduce((e,t)=>e+dV(t),0)}function SV(e){return e.reduce((e,t)=>e+fV(t),0)}function CV(e,t){if(t===void 0&&(t=rV),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);lV(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var wV=[[`x`,[`left`,`right`],xV],[`y`,[`top`,`bottom`],SV]],TV=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=cV(t),r=bV(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of wV)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},EV=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function DV(e){let{EventTarget:t}=Qz(e);return e instanceof t?e:nB(e)}function OV(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t&&r>t.y}var kV;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(kV||={});function AV(e){e.preventDefault()}function jV(e){e.stopPropagation()}var MV;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(MV||={});var NV={start:[MV.Space,MV.Enter],cancel:[MV.Esc],end:[MV.Space,MV.Enter,MV.Tab]},PV=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case MV.Right:return{...n,x:n.x+25};case MV.Left:return{...n,x:n.x-25};case MV.Down:return{...n,y:n.y+25};case MV.Up:return{...n,y:n.y-25}}},FV=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new EV(nB(t)),this.windowListeners=new EV(Qz(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(kV.Resize,this.handleCancel),this.windowListeners.add(kV.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(kV.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&CV(n),t(IB)}handleKeyDown(e){if(gB(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=NV,coordinateGetter:a=PV,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:IB;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=mB(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=gV(n),p=yV(n),m={x:Math.min(i===MV.Right?p.right-p.width/2:p.right,Math.max(i===MV.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===MV.Down?p.bottom-p.height/2:p.bottom,Math.max(i===MV.Down?p.top:p.top+p.height/2,u.y))},h=i===MV.Right&&!s||i===MV.Left&&!c,g=i===MV.Down&&!l||i===MV.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===MV.Right&&e<=d.x||i===MV.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===MV.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===MV.Down&&e<=d.y||i===MV.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===MV.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,pB(mB(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};FV.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=NV,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function IV(e){return!!(e&&`distance`in e)}function LV(e){return!!(e&&`delay`in e)}var RV=class{constructor(e,t,n){n===void 0&&(n=DV(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=nB(i),this.documentListeners=new EV(this.document),this.listeners=new EV(n),this.windowListeners=new EV(Qz(i)),this.initialCoordinates=vB(r)??IB,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(kV.Resize,this.handleCancel),this.windowListeners.add(kV.DragStart,AV),this.windowListeners.add(kV.VisibilityChange,this.handleCancel),this.windowListeners.add(kV.ContextMenu,AV),this.documentListeners.add(kV.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(LV(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(IV(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(kV.Click,jV,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(kV.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=vB(e)??IB,s=mB(n,o);if(!t&&a){if(IV(a)){if(a.tolerance!=null&&OV(s,a.tolerance))return this.handleCancel();if(OV(s,a.distance))return this.handleStart()}if(LV(a)&&OV(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===MV.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},zV={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},BV=class extends RV{constructor(e){let{event:t}=e,n=nB(t.target);super(e,zV,n)}};BV.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var VV={move:{name:`mousemove`},end:{name:`mouseup`}},HV;(function(e){e[e.RightClick=2]=`RightClick`})(HV||={});var UV=class extends RV{constructor(e){super(e,VV,nB(e.event.target))}};UV.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===HV.RightClick?!1:(r?.({event:n}),!0)}}];var WV={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},GV=class extends RV{constructor(e){super(e,WV)}static setup(){return window.addEventListener(WV.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(WV.move.name,e)};function e(){}}};GV.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var KV;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(KV||={});var qV;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(qV||={});function JV(e){let{acceleration:t,activator:n=KV.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=qV.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=XV({delta:d,disabled:!a}),[m,h]=aB(),g=(0,L.useRef)({x:0,y:0}),_=(0,L.useRef)({x:0,y:0}),v=(0,L.useMemo)(()=>{switch(n){case KV.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case KV.DraggableRect:return i}},[n,i,c]),y=(0,L.useRef)(null),b=(0,L.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,L.useMemo)(()=>s===qV.TreeOrder?[...l].reverse():l,[s,l]);(0,L.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=l.indexOf(e),i=u[n];if(!i)continue;let{direction:a,speed:s}=vV(e,i,v,t,f);for(let e of[`x`,`y`])p[e][a[e]]||(s[e]=0,a[e]=0);if(s.x>0||s.y>0){h(),y.current=e,m(b,o),g.current=s,_.current=a;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var YV={x:{[mV.Backward]:!1,[mV.Forward]:!1},y:{[mV.Backward]:!1,[mV.Forward]:!1}};function XV(e){let{delta:t,disabled:n}=e,r=lB(t);return sB(e=>{if(n||!r||!e)return YV;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[mV.Backward]:e.x[mV.Backward]||i.x===-1,[mV.Forward]:e.x[mV.Forward]||i.x===1},y:{[mV.Backward]:e.y[mV.Backward]||i.y===-1,[mV.Forward]:e.y[mV.Forward]||i.y===1}}},[n,t,r])}function ZV(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return sB(e=>t==null?null:r??e??null,[r,t])}function QV(e,t){return(0,L.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var $V;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})($V||={});var eH;(function(e){e.Optimized=`optimized`})(eH||={});var tH=new Map;function nH(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,L.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,L.useRef)(e),d=g(),f=oB(d),p=(0,L.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,L.useRef)(null),h=sB(t=>{if(d&&!n)return tH;if(!t||t===tH||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new TV(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,L.useEffect)(()=>{u.current=e},[e]),(0,L.useEffect)(()=>{d||p()},[n,d]),(0,L.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,L.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case $V.Always:return!1;case $V.BeforeDragging:return n;default:return!n}}}function rH(e,t){return sB(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function iH(e,t){return rH(e,t)}function aH(e){let{callback:t,disabled:n}=e,r=iB(t),i=(0,L.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,L.useEffect)(()=>()=>i?.disconnect(),[i]),i}function oH(e){let{callback:t,disabled:n}=e,r=iB(t),i=(0,L.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,L.useEffect)(()=>()=>i?.disconnect(),[i]),i}function sH(e){return new TV(rV(e),e)}function cH(e,t,n){t===void 0&&(t=sH);let[r,i]=(0,L.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=aH({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=oH({callback:a});return rB(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function lH(e){return ZB(e,rH(e))}var uH=[];function dH(e){let t=(0,L.useRef)(e),n=sB(n=>e?n&&n!==uH&&e&&t.current&&e.parentNode===t.current.parentNode?n:cV(e):uH,[e]);return(0,L.useEffect)(()=>{t.current=e},[e]),n}function fH(e){let[t,n]=(0,L.useState)(null),r=(0,L.useRef)(e),i=(0,L.useCallback)(e=>{let t=uV(e.target);t&&n(e=>e?(e.set(t,pV(t)),new Map(e)):null)},[]);return(0,L.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=uV(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,pV(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{uV(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,L.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>pB(e,t),IB):bV(e):IB,[e,t])}function pH(e,t){t===void 0&&(t=[]);let n=(0,L.useRef)(null);return(0,L.useEffect)(()=>{n.current=null},t),(0,L.useEffect)(()=>{let t=e!==IB;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?mB(e,n.current):IB}function mH(e){(0,L.useEffect)(()=>{if(!Yz)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function hH(e,t){return(0,L.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function gH(e){return(0,L.useMemo)(()=>e?aV(e):null,[e])}var _H=[];function vH(e,t){t===void 0&&(t=rV);let[n]=e,r=gH(n?Qz(n):null),[i,a]=(0,L.useState)(_H);function o(){a(()=>e.length?e.map(e=>hV(e)?r:new TV(t(e),e)):_H)}let s=oH({callback:o});return rB(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function yH(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return eB(t)?t:e}function bH(e){let{measure:t}=e,[n,r]=(0,L.useState)(null),i=oH({callback:(0,L.useCallback)(e=>{for(let{target:n}of e)if(eB(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=cB((0,L.useCallback)(e=>{let n=yH(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,L.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var xH=[{sensor:BV,options:{}},{sensor:FV,options:{}}],SH={current:{}},CH={draggable:{measure:iV},droppable:{measure:iV,strategy:$V.WhileDragging,frequency:eH.Optimized},dragOverlay:{measure:rV}},wH=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},TH={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new wH,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:NB},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:CH,measureDroppableContainers:NB,windowRect:null,measuringScheduled:!1},EH={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:NB,draggableNodes:new Map,over:null,measureDroppableContainers:NB},DH=(0,L.createContext)(EH),OH=(0,L.createContext)(TH);function kH(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new wH}}}function AH(e,t){switch(t.type){case MB.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case MB.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case MB.DragEnd:case MB.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case MB.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new wH(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case MB.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new wH(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case MB.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new wH(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function jH(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,L.useContext)(DH),a=lB(r),o=lB(n?.id);return(0,L.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!gB(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=xB(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function MH(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function NH(e){return(0,L.useMemo)(()=>({draggable:{...CH.draggable,...e?.draggable},droppable:{...CH.droppable,...e?.droppable},dragOverlay:{...CH.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function PH(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,L.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;rB(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=ZB(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=lV(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var FH=(0,L.createContext)({...IB,scaleX:1,scaleY:1}),IH;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(IH||={});var LH=(0,L.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=xH,collisionDetection:o=qB,measuring:s,modifiers:c,...l}=e,[u,d]=(0,L.useReducer)(AH,void 0,kH),[f,p]=OB(),[m,h]=(0,L.useState)(IH.Uninitialized),g=m===IH.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,L.useRef)({initial:null,translated:null}),C=(0,L.useMemo)(()=>_==null?null:{id:_,data:x?.data??SH,rect:S},[_,x]),w=(0,L.useRef)(null),[T,E]=(0,L.useState)(null),[D,O]=(0,L.useState)(null),ee=oB(l,Object.values(l)),te=dB(`DndDescribedBy`,t),k=(0,L.useMemo)(()=>b.getEnabled(),[b]),A=NH(s),{droppableRects:j,measureDroppableContainers:M,measuringScheduled:ne}=nH(k,{dragging:g,dependencies:[y.x,y.y],config:A.droppable}),re=ZV(v,_),ie=(0,L.useMemo)(()=>D?vB(D):null,[D]),ae=ke(),N=iH(re,A.draggable.measure);PH({activeNode:_==null?null:v.get(_),config:ae.layoutShiftCompensation,initialRect:N,measure:A.draggable.measure});let oe=cH(re,A.draggable.measure,N),se=cH(re?re.parentElement:null),ce=(0,L.useRef)({activatorEvent:null,active:null,activeNode:re,collisionRect:null,collisions:null,droppableRects:j,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),P=b.getNodeFor(ce.current.over?.id),le=bH({measure:A.dragOverlay.measure}),ue=le.nodeRef.current??re,F=g?le.rect??oe:null,I=!!(le.nodeRef.current&&le.rect),de=lH(I?null:oe),fe=gH(ue?Qz(ue):null),pe=dH(g?P??re:null),me=vH(pe),he=MH(c,{transform:{x:y.x-de.x,y:y.y-de.y,scaleX:1,scaleY:1},activatorEvent:D,active:C,activeNodeRect:oe,containerNodeRect:se,draggingNodeRect:F,over:ce.current.over,overlayNodeRect:le.rect,scrollableAncestors:pe,scrollableAncestorRects:me,windowRect:fe}),ge=ie?pB(ie,y):null,_e=fH(pe),ve=pH(_e),ye=pH(_e,[oe]),be=pB(he,ve),xe=F?$B(F,he):null,Se=C&&xe?o({active:C,collisionRect:xe,droppableRects:j,droppableContainers:k,pointerCoordinates:ge}):null,R=HB(Se,`id`),[z,B]=(0,L.useState)(null),Ce=XB(I?he:pB(he,ye),z?.rect??null,oe),we=(0,L.useRef)(null),Te=(0,L.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(w.current==null)return;let i=v.get(w.current);if(!i)return;let a=e.nativeEvent,o=new n({active:w.current,activeNode:i,event:a,options:r,context:ce,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=ee.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=ee.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=w.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=ee.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,$g.unstable_batchedUpdates)(()=>{r?.(i),h(IH.Initializing),d({type:MB.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),E(we.current),O(a)})},onMove(e){d({type:MB.DragMove,coordinates:e})},onEnd:s(MB.DragEnd),onCancel:s(MB.DragCancel)});we.current=o;function s(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=ce.current,o=null;if(t&&i){let{cancelDrop:s}=ee.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===MB.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=MB.DragCancel)}w.current=null,(0,$g.unstable_batchedUpdates)(()=>{d({type:e}),h(IH.Uninitialized),B(null),E(null),O(null),we.current=null;let t=e===MB.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=ee.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Ee=QV(a,(0,L.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(w.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},w.current=r,Te(n,t))},[v,Te]));mH(a),rB(()=>{oe&&m===IH.Initializing&&h(IH.Initialized)},[oe,m]),(0,L.useEffect)(()=>{let{onDragMove:e}=ee.current,{active:t,activatorEvent:n,collisions:r,over:i}=ce.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:be.x,y:be.y},over:i};(0,$g.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[be.x,be.y]),(0,L.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=ce.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=ee.current,o=r.get(R),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,$g.unstable_batchedUpdates)(()=>{B(s),a?.(c),f({type:`onDragOver`,event:c})})},[R]),rB(()=>{ce.current={activatorEvent:D,active:C,activeNode:re,collisionRect:xe,collisions:Se,droppableRects:j,draggableNodes:v,draggingNode:ue,draggingNodeRect:F,droppableContainers:b,over:z,scrollableAncestors:pe,scrollAdjustedTranslate:be},S.current={initial:F,translated:xe}},[C,re,Se,xe,v,ue,F,j,b,z,pe,be]),JV({...ae,delta:y,draggingRect:xe,pointerCoordinates:ge,scrollableAncestors:pe,scrollableAncestorRects:me});let De=(0,L.useMemo)(()=>({active:C,activeNode:re,activeNodeRect:oe,activatorEvent:D,collisions:Se,containerNodeRect:se,dragOverlay:le,draggableNodes:v,droppableContainers:b,droppableRects:j,over:z,measureDroppableContainers:M,scrollableAncestors:pe,scrollableAncestorRects:me,measuringConfiguration:A,measuringScheduled:ne,windowRect:fe}),[C,re,oe,D,Se,se,le,v,b,j,z,M,pe,me,A,ne,fe]),Oe=(0,L.useMemo)(()=>({activatorEvent:D,activators:Ee,active:C,activeNodeRect:oe,ariaDescribedById:{draggable:te},dispatch:d,draggableNodes:v,over:z,measureDroppableContainers:M}),[D,Ee,C,oe,d,te,v,z,M]);return L.createElement(EB.Provider,{value:p},L.createElement(DH.Provider,{value:Oe},L.createElement(OH.Provider,{value:De},L.createElement(FH.Provider,{value:Ce},i)),L.createElement(jH,{disabled:n?.restoreFocus===!1})),L.createElement(jB,{...n,hiddenTextDescribedById:te}));function ke(){let e=T?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),RH=(0,L.createContext)(null),zH=`button`,BH=`Draggable`;function VH(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=dB(BH),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,L.useContext)(DH),{role:p=zH,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,L.useContext)(g?FH:RH),[v,y]=cB(),[b,x]=cB(),S=hH(o,t),C=oB(n);return rB(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:C}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,L.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===zH?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function HH(){return(0,L.useContext)(OH)}var UH=`Droppable`,WH={timeout:25};function GH(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=dB(UH),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,L.useContext)(DH),u=(0,L.useRef)({disabled:n}),d=(0,L.useRef)(!1),f=(0,L.useRef)(null),p=(0,L.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...WH,...i},_=oB(h??r),v=oH({callback:(0,L.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=cB((0,L.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=oB(t);return(0,L.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,L.useEffect)(()=>(s({type:MB.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:MB.UnregisterDroppable,key:a,id:r})),[r]),(0,L.useEffect)(()=>{n!==u.current.disabled&&(s({type:MB.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function KH(e){let{animation:t,children:n}=e,[r,i]=(0,L.useState)(null),[a,o]=(0,L.useState)(null),s=lB(n);return!n&&!r&&s&&i(s),rB(()=>{if(!a)return;let e=r?.key,n=r?.props.id;if(e==null||n==null){i(null);return}Promise.resolve(t(n,a)).then(()=>{i(null)})},[t,r,a]),L.createElement(L.Fragment,null,n,r?(0,L.cloneElement)(r,{ref:o}):null)}var qH={x:0,y:0,scaleX:1,scaleY:1};function JH(e){let{children:t}=e;return L.createElement(DH.Provider,{value:EH},L.createElement(FH.Provider,{value:qH},t))}var YH={position:`fixed`,touchAction:`none`},XH=e=>gB(e)?`transform 250ms ease`:void 0,ZH=(0,L.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=XH}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...YH,width:s.width,height:s.height,top:s.top,left:s.left,transform:yB.Transform.toString(d),transformOrigin:i&&r?RB(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return L.createElement(n,{className:o,style:f,ref:t},a)}),QH={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:yB.Transform.toString(t)},{transform:yB.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}})({styles:{active:{opacity:`0`}}})};function $H(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return iB((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=yH(a);if(!c)return;let{transform:l}=Qz(a).getComputedStyle(a),u=eV(l);if(!u)return;let d=typeof t==`function`?t:eU(t);return CV(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function eU(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...QH,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var tU=0;function nU(e){return(0,L.useMemo)(()=>{if(e!=null)return tU++,tU},[e])}var rU=L.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:a,modifiers:o,wrapperElement:s=`div`,className:c,zIndex:l=999}=e,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggableNodes:m,droppableContainers:h,dragOverlay:g,over:_,measuringConfiguration:v,scrollableAncestors:y,scrollableAncestorRects:b,windowRect:x}=HH(),S=(0,L.useContext)(FH),C=nU(d?.id),w=MH(o,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:g.rect,over:_,overlayNodeRect:g.rect,scrollableAncestors:y,scrollableAncestorRects:b,transform:S,windowRect:x}),T=rH(f),E=$H({config:r,draggableNodes:m,droppableContainers:h,measuringConfiguration:v}),D=T?g.setRef:void 0;return L.createElement(JH,null,L.createElement(KH,{animation:E},d&&C?L.createElement(ZH,{key:C,id:d.id,ref:D,as:s,activatorEvent:u,adjustScale:t,className:c,transition:a,rect:T,style:{zIndex:l,...i},transform:w},n):null))});function iU(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function aU(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function oU(e){return e!==null&&e>=0}function sU(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function cU(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var lU={scaleX:1,scaleY:1},uU=e=>{let{rects:t,activeNodeRect:n,activeIndex:r,overIndex:i,index:a}=e,o=t[r]??n;if(!o)return null;let s=dU(t,a,r);if(a===r){let e=t[i];return e?{x:r<i?e.left+e.width-(o.left+o.width):e.left-o.left,y:0,...lU}:null}return a>r&&a<=i?{x:-o.width-s,y:0,...lU}:a<r&&a>=i?{x:o.width+s,y:0,...lU}:{x:0,y:0,...lU}};function dU(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return!r||!i&&!a?0:n<t?i?r.left-(i.left+i.width):a.left-(r.left+r.width):a?a.left-(r.left+r.width):r.left-(i.left+i.width)}var fU=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=iU(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},pU={scaleX:1,scaleY:1},mU=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...pU}:null}let s=hU(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...pU}:r<t&&r>=a?{x:0,y:o.height+s,...pU}:{x:0,y:0,...pU}};function hU(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var gU=`Sortable`,_U=L.createContext({activeIndex:-1,containerId:gU,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:fU,disabled:{draggable:!1,droppable:!1}});function vU(e){let{children:t,id:n,items:r,strategy:i=fU,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=HH(),d=dB(gU,n),f=s.rect!==null,p=(0,L.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,L.useRef)(p),v=!sU(p,_.current),y=g!==-1&&h===-1||v,b=cU(a);rB(()=>{v&&m&&u(p)},[v,p,m,u]),(0,L.useEffect)(()=>{_.current=p},[p]);let x=(0,L.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:aU(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return L.createElement(_U.Provider,{value:x},t)}var yU=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return iU(n,r,i).indexOf(t)},bU=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},xU={duration:200,easing:`ease`},SU=`transform`,CU=yB.Transition.toString({property:SU,duration:0,easing:`linear`}),wU={roleDescription:`sortable`};function TU(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,L.useState)(null),s=(0,L.useRef)(n);return rB(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=rV(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,L.useEffect)(()=>{a&&o(null)},[a]),a}function EU(e){let{animateLayoutChanges:t=bU,attributes:n,disabled:r,data:i,getNewIndex:a=yU,id:o,strategy:s,resizeObserverConfig:c,transition:l=xU}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,L.useContext)(_U),y=DU(r,p),b=u.indexOf(o),x=(0,L.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,L.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:C,node:w,isOver:T,setNodeRef:E}=GH({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:D,activatorEvent:O,activeNodeRect:ee,attributes:te,setNodeRef:k,listeners:A,isDragging:j,over:M,setActivatorNodeRef:ne,transform:re}=VH({id:o,data:x,attributes:{...wU,...n},disabled:y.draggable}),ie=Jz(E,k),ae=!!D,N=ae&&!m&&oU(f)&&oU(g),oe=!_&&j,se=N?(oe&&N?re:null)??(s??v)({rects:h,activeNodeRect:ee,activeIndex:f,overIndex:g,index:b}):null,ce=oU(f)&&oU(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,P=D?.id,le=(0,L.useRef)({activeId:P,items:u,newIndex:ce,containerId:d}),ue=u!==le.current.items,F=t({active:D,containerId:d,isDragging:j,isSorting:ae,id:o,index:b,items:u,newIndex:le.current.newIndex,previousItems:le.current.items,previousContainerId:le.current.containerId,transition:l,wasDragging:le.current.activeId!=null}),I=TU({disabled:!F,index:b,node:w,rect:C});return(0,L.useEffect)(()=>{ae&&le.current.newIndex!==ce&&(le.current.newIndex=ce),d!==le.current.containerId&&(le.current.containerId=d),u!==le.current.items&&(le.current.items=u)},[ae,ce,d,u]),(0,L.useEffect)(()=>{if(P===le.current.activeId)return;if(P!=null&&le.current.activeId==null){le.current.activeId=P;return}let e=setTimeout(()=>{le.current.activeId=P},50);return()=>clearTimeout(e)},[P]),{active:D,activeIndex:f,attributes:te,data:x,rect:C,index:b,newIndex:ce,items:u,isOver:T,isSorting:ae,isDragging:j,listeners:A,node:w,overIndex:g,over:M,setNodeRef:ie,setActivatorNodeRef:ne,setDroppableNodeRef:E,setDraggableNodeRef:k,transform:I??se,transition:de()};function de(){if(I||ue&&le.current.newIndex===b)return CU;if(!(oe&&!gB(O)||!l)&&(ae||F))return yB.Transition.toString({...l,property:SU})}}function DU(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function OU(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var kU=[MV.Down,MV.Right,MV.Up,MV.Left],AU=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(kU.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case MV.Down:r.top<a.top&&t.push(n);break;case MV.Up:r.top>a.top&&t.push(n);break;case MV.Left:r.left>a.left&&t.push(n);break;case MV.Right:r.left<a.left&&t.push(n);break}});let c=GB({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=HB(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=cV(c).some((e,t)=>s[t]!==e),i=jU(e,t),a=MU(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:mB(u,l)}}}};function jU(e,t){return!OU(e)||!OU(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function MU(e,t){return!OU(e)||!OU(t)||!jU(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var NU=(0,L.createContext)(null),PU={didCatch:!1,error:null},FU=class extends L.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=PU}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(...e){let{error:t}=this.state;t!==null&&(this.props.onReset?.({args:e,reason:`imperative-api`}),this.setState(PU))}componentDidCatch(e,t){this.props.onError?.(e,t)}componentDidUpdate(e,t){let{didCatch:n}=this.state,{resetKeys:r}=this.props;n&&t.error!==null&&IU(e.resetKeys,r)&&(this.props.onReset?.({next:r,prev:e.resetKeys,reason:`keys`}),this.setState(PU))}render(){let{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:i,error:a}=this.state,o=e;if(i){let e={error:a,resetErrorBoundary:this.resetErrorBoundary};if(typeof t==`function`)o=t(e);else if(n)o=(0,L.createElement)(n,e);else if(r!==void 0)o=r;else throw a}return(0,L.createElement)(NU.Provider,{value:{didCatch:i,error:a,resetErrorBoundary:this.resetErrorBoundary}},o)}};function IU(e=[],t=[]){return e.length!==t.length||e.some((e,n)=>!Object.is(e,t[n]))}function LU(e){return typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`?e.toString():JSON.stringify(e)??``}function RU(){return(0,H.jsxs)(`div`,{style:{textAlign:`center`,marginTop:`4em`},children:[(0,H.jsx)(Lm,{}),(0,H.jsx)(`p`,{children:`Loading`})]})}function zU({error:e}){return e===void 0?(0,H.jsx)(H.Fragment,{}):Bt.isApiException(e)?(0,H.jsx)(ov,{children:(0,H.jsxs)(uv,{children:[(0,H.jsx)(`h3`,{children:`FMS Insight Server Error`}),(0,H.jsx)(`p`,{children:e.response})]})}):e instanceof Error?(0,H.jsx)(ov,{children:(0,H.jsx)(uv,{children:e.message})}):(0,H.jsx)(ov,{children:(0,H.jsxs)(uv,{children:[(0,H.jsx)(`h3`,{children:`Unknown Error`}),(0,H.jsx)(`p`,{children:LU(e)})]})})}function BU(e){return(0,H.jsx)(FU,{FallbackComponent:zU,children:(0,H.jsx)(L.Suspense,{fallback:e.fallback??(0,H.jsx)(RU,{}),children:e.children})})}function VU(e){let t=e.action.loadCancellationId;return t!==void 0&&t.trim()!==``?t:null}function HU(e){switch(e.action.type){case st.Loading:case st.UnloadToInProcess:case st.UnloadToCompletedMaterial:case st.LoadingToBasket:return!0;default:return!1}}function UU(e){let t=VU(e);return t!==null||HU(e)?{kind:`ActiveLoadStationOperation`,cancellationId:t}:e.location.type===at.InQueue&&e.action.type===st.Waiting?{kind:`HumanControlledQueue`}:e.location.type===at.OnPallet||e.location.type===at.InBasket||e.action.type===st.Machining?{kind:`AutomationControlled`}:{kind:`AddToQueueProposal`}}function WU(e){return UU(e).kind===`ActiveLoadStationOperation`}function GU(e){if(e===null)return!1;let t=UU(e);return t.kind===`ActiveLoadStationOperation`&&t.cancellationId!==null}function KU(e){return e!==null&&UU(e).kind===`AutomationControlled`}function qU(e){return e!==null&&UU(e).kind===`HumanControlledQueue`}function JU(e){return qU(e)}function YU(e){return e===null||UU(e).kind===`AddToQueueProposal`}function XU(e){if(e===null)return!0;let t=UU(e);return t.kind===`AddToQueueProposal`||t.kind===`HumanControlledQueue`}var ZU=class extends L.PureComponent{render(){let e=this.props.size||50,t=Iz(this.props.part,e);return(0,H.jsx)(`div`,{style:{width:e,height:e},dangerouslySetInnerHTML:{__html:t}})}},QU=2,$U=Fa`
|
|
274
274
|
from, to { transform: translate(0, 0) }
|
|
275
|
-
10% { transform: translate(${
|
|
275
|
+
10% { transform: translate(${QU}px, 0) }
|
|
276
276
|
20% { transform: translate(0, 0) }
|
|
277
|
-
30% { transform: translate(${
|
|
277
|
+
30% { transform: translate(${QU}px, 0) }
|
|
278
278
|
40% { transform: translate(0, 0) }
|
|
279
|
-
50% { transform: translate(${
|
|
279
|
+
50% { transform: translate(${QU}px, 0) }
|
|
280
280
|
60% { transform: translate(0, 0) }
|
|
281
|
-
`,$U=`${QU} 1s ease-in-out infinite`;function eW(e){return`animationName`in e}function tW(e){let t=e.currentTarget.getAnimations().find(e=>eW(e)&&e.animationName===QU.name);if(t&&typeof t.startTime==`number`)t.startTime-=t.startTime%1e3;else if(t&&typeof t.startTime==`object`&&t.startTime instanceof CSSNumericValue){let e=t.startTime.to(`ms`).value;t.startTime=CSS.ms(e-e%1e3)}}var nW=G(`div`,{shouldForwardProp:e=>e!==`fsize`})(({fsize:e,theme:t})=>{if(!e)return{fontSize:`1.25rem`,fontWeight:`500`};switch(e){case`normal`:return{fontSize:`1rem`,fontWeight:`500`,[t.breakpoints.up(`md`)]:{fontSize:`1.25rem`},[t.breakpoints.up(`lg`)]:{fontSize:`1.5rem`}};case`large`:return{fontSize:`1.5rem`,fontWeight:`500`,[t.breakpoints.up(`lg`)]:{fontSize:`1.75rem`},[t.breakpoints.up(`xl`)]:{fontSize:`2rem`}};case`x-large`:return{fontSize:`1.5rem`,fontWeight:`500`,[t.breakpoints.up(`md`)]:{fontSize:`1.75rem`},[t.breakpoints.up(`lg`)]:{fontSize:`2.75rem`},[t.breakpoints.up(`xl`)]:{fontSize:`3.75rem`}}}}),rW=G(`div`,{shouldForwardProp:e=>e!==`fsize`})(({fsize:e,theme:t})=>{if(!e)return{fontSize:`0.75rem`,fontWeight:`500`};switch(e){case`normal`:return{fontSize:`0.75rem`,fontWeight:`500`,[t.breakpoints.up(`md`)]:{fontSize:`1rem`}};case`large`:return{fontSize:`1rem`,fontWeight:`500`,[t.breakpoints.up(`lg`)]:{fontSize:`1.5rem`},[t.breakpoints.up(`xl`)]:{fontSize:`1.75rem`}};case`x-large`:return{fontSize:`1rem`,fontWeight:`500`,[t.breakpoints.up(`md`)]:{fontSize:`1.5rem`},[t.breakpoints.up(`lg`)]:{fontSize:`2.5rem`},[t.breakpoints.up(`xl`)]:{fontSize:`3.5rem`}}}});function iW({mat:e,displayActionForSinglePallet:t,fsize:n}){let r=R(NO),i=ok(R(br).basketName);switch(e.action.type){case st.Loading:if(e.action.loadFromBasketId){if(e.action.loadOntoPalletNum===null||e.action.loadOntoPalletNum===void 0)return(0,H.jsxs)(rW,{fsize:n,children:[`Load into `,i,` `,e.action.loadFromBasketId]});if(t===void 0)return(0,H.jsxs)(rW,{fsize:n,children:[`Load from `,i,` `,e.action.loadFromBasketId,` to pal`,` `,e.action.loadOntoPalletNum??``]});if(t===e.action.loadOntoPalletNum){let t=e.action.loadOntoFace??0,a=e.action.loadOntoPalletNum?r.pallets[e.action.loadOntoPalletNum]?.faceNames?.[t-1]:null;return(0,H.jsxs)(rW,{fsize:n,children:[`Load from `,i,` `,e.action.loadFromBasketId,` to`,` `,a??`face ${t}`]})}else return null}switch(e.location.type){case at.OnPallet:if(t===void 0||t===e.location.palletNum){if(e.action.loadOntoFace===void 0||e.action.loadOntoFace===e.location.face)return e.action.processAfterLoad&&e.action.processAfterLoad!==e.process?(0,H.jsxs)(rW,{fsize:n,children:[`Reclamp material to process # `,e.action.processAfterLoad]}):null;{let t=e.action.loadOntoFace??0,i=e.location.palletNum?r.pallets[e.location.palletNum]?.faceNames?.[t-1]:null;return(0,H.jsxs)(rW,{fsize:n,children:[`Transfer to `,i??`face ${t}`]})}}else return null;default:{let i=e.action.loadOntoFace??0,a=e.action.loadOntoPalletNum?r.pallets[e.action.loadOntoPalletNum]?.faceNames?.[i-1]:null;return t===void 0?(0,H.jsxs)(rW,{fsize:n,children:[`Load to `,a??`face ${i}`,` of pal `,e.action.loadOntoPalletNum??``]}):t===e.action.loadOntoPalletNum?(0,H.jsxs)(rW,{fsize:n,children:[`Load to `,a??`face ${i}`]}):null}}case st.LoadingToBasket:return(0,H.jsxs)(rW,{fsize:n,children:[`Load into `,i,` `,e.action.loadToBasketId??``,e.action.loadToBasketSlot===void 0?``:` slot ${e.action.loadToBasketSlot}`]});case st.UnloadToInProcess:case st.UnloadToCompletedMaterial:return e.action.unloadToBasketId?(0,H.jsxs)(rW,{fsize:n,children:[`Unload to `,i,` `,e.action.unloadToBasketId,e.action.unloadToBasketSlot===void 0?``:` slot ${e.action.unloadToBasketSlot}`]}):e.action.unloadIntoQueue?(0,H.jsxs)(rW,{fsize:n,children:[`Unload into queue `,e.action.unloadIntoQueue]}):e.action.type===st.UnloadToCompletedMaterial&&e.location.type===at.InBasket?(0,H.jsxs)(rW,{fsize:n,children:[`Unload from `,i,` `,e.location.basketId,` to completed material`]}):e.location.type===at.InBasket?(0,H.jsxs)(rW,{fsize:n,children:[`Unload from `,i,` `,e.location.basketId]}):(0,H.jsx)(rW,{fsize:n,children:`Unload from pallet`});case st.Waiting:if(e.location.type===at.InQueue&&e.jobUnique&&e.jobUnique!==``)return(0,H.jsxs)(rW,{fsize:n,children:[`Waiting; next process is #`,e.process+1]});if(e.location.type===at.InBasket)return(0,H.jsxs)(rW,{fsize:n,children:[`In `,i,` `,e.location.basketId]});if(e.location.type===at.OnPallet&&(e.lastCompletedMachiningRouteStopIndex===null||e.lastCompletedMachiningRouteStopIndex===void 0))return(0,H.jsx)(rW,{fsize:n,children:`Waiting for machining`});break;case st.Machining:return(0,H.jsxs)(rW,{fsize:n,children:[`Machining program `,e.action.program??``]})}return null}function aW({mat:e}){let t=null;return e.signaledInspections.length>0&&(t=`Inspect: `+e.signaledInspections.join(`, `)),e.quarantineAfterUnload&&(t===null?t=`Material will quarantine after unload`:t+=`; Material will quarantine after unload`),t===null?null:(0,H.jsx)(X,{title:t,children:(0,H.jsx)(DT,{})})}function oW({fsize:e,mat:t}){let n=R(NO).jobs[t.jobUnique],r=t.path;if((t.action.type===st.Loading||t.action.type===st.LoadingToBasket)&&t.action.pathAfterLoad&&(r=t.action.pathAfterLoad),!n)return null;let i=n.procsAndPaths?.[0]?.paths?.[r-1];return i&&i.casting&&i.casting!==``?(0,H.jsx)(rW,{fsize:e,children:i.casting}):null}function sW({fsize:e,uniq:t}){let n=R(NO).jobs[t],r=R(CR);if(n&&n.bookings&&n.bookings.length>0){let t=r.get(n.bookings[0]);if(t&&t.notes&&t.notes!==``)return(0,H.jsx)(rW,{fsize:e,style:{textOverflow:`ellipsis`,overflow:`hidden`,whiteSpace:`nowrap`,maxWidth:`10em`},children:t.notes})}return null}function cW(){let e=R(NO),t=R(AI);if(!t)return null;let n=e.workorders?.find(e=>e.workorderId===t)?.comments??[];return(0,H.jsxs)(`div`,{style:{marginTop:`1em`,marginLeft:`1em`},children:[(0,H.jsxs)(`p`,{children:[`Workorder: `,t]}),(0,H.jsx)(`ul`,{children:n.map((e,t)=>(0,H.jsx)(`li`,{children:e.comment},t))})]})}var lW=(0,L.forwardRef)(function(e,t){let n=z(SI),r=e.mat.completedInspections||{},i;return e.focusInspectionType&&r[e.focusInspectionType]?i=(0,H.jsxs)(rW,{fsize:e.fsize,children:[(0,H.jsx)(`span`,{children:`Inspection completed `}),(0,H.jsx)(Kz,{date:r[e.focusInspectionType].time})]}):e.focusInspectionType&&e.mat.last_unload_time?i=(0,H.jsxs)(rW,{fsize:e.fsize,children:[(0,H.jsx)(`span`,{children:`Unloaded `}),(0,H.jsx)(Kz,{date:e.mat.last_unload_time})]}):e.mat.closeout_completed&&(i=(0,H.jsxs)(rW,{fsize:e.fsize,children:[(0,H.jsxs)(`span`,{children:[e.mat.closeout_failed?`Failed `:``,`Closed Out `]}),(0,H.jsx)(Kz,{date:e.mat.closeout_completed})]})),(0,H.jsxs)(Up,{ref:t,elevation:4,sx:{display:`flex`,minWidth:`10em`,padding:`8px`,margin:e.isDragOverlay?void 0:`8px`,opacity:e.isActiveDrag?.2:1,animation:e.shake?$U:void 0,"&:hover":{animationPlayState:`paused`}},onAnimationIteration:tW,...e.dragRootProps,children:[e.showDragHandle?(0,H.jsx)(`div`,{ref:e.setDragHandleRef,role:`button`,tabIndex:0,style:{display:`flex`,flexDirection:`column`,justifyContent:`center`,cursor:e.isDragOverlay?`grabbing`:`grab`,touchAction:`none`},...e.dragHandleProps,children:(0,H.jsx)(yre,{fontSize:`large`,color:`action`})}):void 0,(0,H.jsx)(bm,{focusRipple:!0,sx:{width:`100%`},onClick:()=>n(e.inProcMat?{type:`InProcMat`,inproc:e.inProcMat}:{type:`MatSummary`,summary:e.mat}),children:(0,H.jsxs)(J,{sx:{display:`flex`,textAlign:`left`,alignItems:`center`,width:`100%`},children:[(0,H.jsx)(XU,{part:e.mat.partName}),(0,H.jsxs)(J,{sx:{marginLeft:`8px`,flexGrow:1},children:[(0,H.jsx)(nW,{fsize:e.fsize,children:e.mat.partName}),e.displayJob?(0,H.jsx)(rW,{fsize:e.fsize,children:e.mat.jobUnique&&e.mat.jobUnique!==``?`Assigned to `+e.mat.jobUnique:`Unassigned material`}):void 0,!e.hideEmptySerial||e.mat.serial?(0,H.jsxs)(rW,{fsize:e.fsize,children:[`Serial: `,e.mat.serial?e.mat.serial:`none`]}):void 0,e.mat.workorderId===void 0||e.mat.workorderId===``||e.mat.workorderId===e.mat.serial?void 0:(0,H.jsxs)(rW,{fsize:e.fsize,children:[`Workorder: `,e.mat.workorderId]}),e.mat.jobUnique!==void 0&&e.showRawMaterial&&e.inProcMat&&e.inProcMat.process===0?(0,H.jsx)(oW,{fsize:e.fsize,mat:e.inProcMat}):void 0,e.showJobComment&&e.mat.jobUnique&&e.mat.jobUnique!==``?(0,H.jsx)(sW,{fsize:e.fsize,uniq:e.mat.jobUnique}):void 0,e.inProcMat?(0,H.jsx)(iW,{mat:e.inProcMat,displayActionForSinglePallet:e.displayActionForSinglePallet,fsize:e.fsize}):void 0,e.inProcMat?.problem?(0,H.jsx)(rW,{fsize:e.fsize,children:(0,H.jsxs)(q,{variant:`body2`,color:`error`,sx:{fontWeight:`bold`},children:[`⚠ `,e.inProcMat.problem]})}):void 0,i]}),(0,H.jsxs)(J,{sx:{marginLeft:`4px`,display:`flex`,flexDirection:`column`,justifyContent:`space-between`,alignItems:`flex-end`,alignSelf:`start`},children:[e.mat.serial&&e.mat.serial.length>=1&&!e.hideAvatar?(0,H.jsx)(`div`,{children:(0,H.jsx)(D_,{style:{width:`30px`,height:`30px`},children:e.mat.serial.slice(-1)})}):void 0,e.hideWarningIcon?void 0:(0,H.jsx)(`div`,{children:(0,H.jsx)(aW,{mat:e.mat})})]})]})})]})}),uW=(0,L.memo)(lW),dW=(0,L.memo)(function(e){return(0,H.jsx)(lW,{mat:hL(e.mat),inProcMat:e.mat,displayActionForSinglePallet:e.displayActionForSinglePallet,fsize:e.fsize,hideAvatar:e.hideAvatar,displayJob:e.displayJob,showDragHandle:e.showHandle,hideEmptySerial:e.hideEmptySerial,showRawMaterial:e.showRawMaterial,showJobComment:e.showJobComment,shake:e.shake})}),fW=(0,L.memo)(function(e){let t={mat:e.mat},{active:n,isDragging:r,attributes:i,listeners:a,setNodeRef:o,setActivatorNodeRef:s,transform:c,transition:l}=TU({id:e.mat.materialID,data:t}),u={...a};for(let[e,t]of Object.entries(i))e.startsWith(`aria`)&&(u[e]=t);let d={transform:c?`translate3d(${Math.round(c.x)}px, ${Math.round(c.y)}px, 0)`:void 0,transition:n===null?void 0:l};return(0,H.jsx)(lW,{ref:o,dragRootProps:{style:d},showDragHandle:!0,dragHandleProps:u,setDragHandleRef:s,isActiveDrag:r,mat:hL(e.mat),inProcMat:e.mat,displayActionForSinglePallet:e.displayActionForSinglePallet,hideAvatar:e.hideAvatar,displayJob:e.displayJob,hideEmptySerial:e.hideEmptySerial,fsize:e.fsize,shake:n?void 0:e.shake,showRawMaterial:e.showRawMaterial})});function pW(e){return(0,H.jsx)(lW,{mat:hL(e.mat),inProcMat:e.mat,displayActionForSinglePallet:e.displayActionForSinglePallet,showDragHandle:!0,hideAvatar:e.hideAvatar,displayJob:e.displayJob,fsize:e.fsize,hideEmptySerial:e.hideEmptySerial,isDragOverlay:!0})}var mW=(0,L.memo)(function(e){return(0,H.jsx)(Up,{elevation:4,sx:{display:`flex`,minWidth:`10em`,padding:`8px`,margin:`8px`},children:(0,H.jsx)(W_,{badgeContent:e.material.length<2?0:e.material.length,color:`secondary`,children:(0,H.jsx)(bm,{focusRipple:!0,onClick:()=>e.onOpen(),children:(0,H.jsxs)(J,{sx:{display:`flex`,textAlign:`left`},children:[(0,H.jsx)(XU,{part:e.partOrCasting}),(0,H.jsxs)(J,{sx:{marginLeft:`8px`,flexGrow:1},children:[(0,H.jsx)(q,{variant:`h6`,children:e.partOrCasting}),(0,H.jsx)(rW,{fsize:e.fsize,children:e.assignedJobUnique&&e.assignedJobUnique!==``?`Assigned to `+e.assignedJobUnique:`Unassigned material`})]}),e.material.length>0&&e.material[0].serial&&e.material[0].serial.length>=1?(0,H.jsx)(`div`,{children:(0,H.jsx)(D_,{style:{width:`30px`,height:`30px`},children:e.material[0].serial.slice(-1)})}):void 0]})})})})}),hW=(0,L.memo)(function({partName:e,serial:t,subtitle:n,notes:r}){let i;return i=e===``?t??`Material`:t==null||t===``?r?`Add note for `+e:e:r?`Add note for `+t:e+` - `+t,(0,H.jsxs)(J,{sx:{display:`flex`,textAlign:`left`},children:[e===``?(0,H.jsx)(bT,{}):(0,H.jsx)(XU,{part:e}),(0,H.jsxs)(J,{sx:{marginLeft:`8px`,flexGrow:1},children:[(0,H.jsx)(q,{variant:`h6`,children:i}),n?(0,H.jsx)(q,{variant:`caption`,children:n}):void 0]})]})});function gW({notes:e}){let t=R(SI),n=R(xie),r=R(Sie),i=``,a=null;switch(t?.type){case`InProcMat`:i=t.inproc.partName,a=t.inproc.serial;break;case`MatSummary`:i=t.summary.partName,a=t.summary.serial;break;case`MatDetails`:i=t.details.partName,a=t.details.serial;break;case`LogMat`:i=t.logMat.part,a=t.logMat.serial;break;case`Barcode`:a=t.barcode;break;case`ManuallyEnteredSerial`:case`AddMatWithEnteredSerial`:a=t.serial;break}return n.state===`hasData`&&n.data!==null&&(i=n.data.partName,a=n.data.serial??a),r.state===`hasData`&&r.data&&(a=r.data),(0,H.jsx)(hW,{notes:e,partName:i,serial:a})}function _W(){let e=R(FI);function t(t){return e.completedInspections.includes(t)?`black`:`red`}return e.signaledInspections.length===0?(0,H.jsx)(`small`,{children:`Inspections: none`}):(0,H.jsxs)(`small`,{children:[`Inspections:`,` `,e.signaledInspections.map((e,n)=>(0,H.jsxs)(`span`,{children:[n===0?``:`, `,(0,H.jsx)(`span`,{style:{color:t(e)},children:e})]},n))]})}function vW({highlightProcsGreaterOrEqualTo:e}){return(0,H.jsx)(bI,{entries:R(NI),copyToClipboard:!0,highlightProcsGreaterOrEqualTo:e})}function yW(){let e=R(OI),t=R(NO).jobs,n=R(CR),r=e?t[e.jobUnique]:null;if(r&&r.bookings&&r.bookings.length>0){let e=n.get(r.bookings[0]);if(e&&e.notes&&e.notes!==``)return(0,H.jsx)(q,{variant:`caption`,sx:{width:`100%`,textWrap:`wrap`},children:e.notes})}return null}function bW(){let e=R(OI);if(e===null)return null;if(e.quarantineAfterUnload)return(0,H.jsx)(q,{variant:`caption`,component:`p`,children:`Quarantine requested`});let t=HU(e);return t.kind!==`ActiveLoadStationOperation`||t.cancellationId!==null?null:(0,H.jsx)(q,{variant:`caption`,component:`p`,children:`This material is part of the current load/unload operation. Complete the operation or cancel it at the machine control before making other changes.`})}var xW=(0,L.memo)(function({highlightProcsGreaterOrEqualTo:e}){let t=R(SI),n=R(TI),r=R(wI);return t===null?null:n===null?t.type===`AddMatWithEnteredSerial`||t.type===`ManuallyEnteredSerial`?(0,H.jsxs)(`div`,{style:{marginLeft:`1em`},children:[`Material with serial `,t.serial,` not found.`]}):t.type===`Barcode`?r?(0,H.jsxs)(`div`,{style:{marginLeft:`1em`},children:[`Material with barcode `,t.barcode,` does not yet exist in the cell.`]}):(0,H.jsxs)(`div`,{style:{marginLeft:`1em`},children:[`Material with barcode `,t.barcode,` not found.`]}):(0,H.jsx)(`div`,{style:{marginLeft:`1em`},children:`Material not found.`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{style:{marginLeft:`1em`},children:[(0,H.jsx)(bW,{}),(0,H.jsx)(`div`,{children:(0,H.jsxs)(`small`,{children:[`Workorder: `,n?.workorderId??`none`]})}),(0,H.jsx)(`div`,{children:(0,H.jsx)(zU,{fallback:(0,H.jsxs)(`small`,{children:[`Inspections: `,(0,H.jsx)(Lm,{size:`10`})]}),children:(0,H.jsx)(_W,{})})}),(0,H.jsx)(`div`,{children:(0,H.jsx)(zU,{fallback:(0,H.jsx)(`div`,{}),children:(0,H.jsx)(yW,{})})})]}),(0,H.jsx)(zU,{fallback:(0,H.jsx)(Lm,{}),children:(0,H.jsx)(vW,{highlightProcsGreaterOrEqualTo:e})})]})});function SW(e){let[t,n]=(0,L.useState)(``),r=R(jO),[i]=Die(),a=R(TI);return a===null?null:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(uy,{children:(0,H.jsx)(Kw,{sx:{mt:`5px`},multiline:!0,label:`Note`,autoFocus:!0,variant:`outlined`,value:t,onChange:e=>n(e.target.value)})}),(0,H.jsxs)(ly,{children:[(0,H.jsx)(Y,{onClick:()=>{i({matId:a.materialID,process:0,operator:r,notes:t}),e.setNotesOpen(!1),n(``)},disabled:t===``,color:`secondary`,children:`Save`}),(0,H.jsx)(Y,{onClick:()=>{e.setNotesOpen(!1),n(``)},color:`secondary`,children:`Cancel`})]})]})}function CW(){let e=R(SI);if(e===null)return null;let t;switch(e.type){case`Barcode`:t=`Loading material with barcode `+e.barcode+`...`;break;case`AddMatWithEnteredSerial`:case`ManuallyEnteredSerial`:t=`Loading material with serial `+e.serial+`...`;break;default:t=`Loading material...`;break}return(0,H.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`},children:[(0,H.jsx)(Lm,{}),(0,H.jsx)(`div`,{style:{marginTop:`1em`},children:t})]})}function wW({setNotesOpen:e}){let t=R(TI);return t===null||t.materialID<0?null:(0,H.jsx)(Y,{onClick:()=>e(!0),color:`primary`,children:`Add Note`})}var TW=(0,L.memo)(function(e){let[t,n]=(0,L.useState)(!1),[r,i]=B(SI);function a(){i(null),e.onClose&&e.onClose()}let o,s;return r&&(o=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(dy,{children:(0,H.jsx)(gW,{})}),(0,H.jsx)(uy,{children:(0,H.jsxs)(zU,{fallback:(0,H.jsx)(CW,{}),children:[(0,H.jsx)(xW,{highlightProcsGreaterOrEqualTo:e.highlightProcsGreaterOrEqualTo}),(0,H.jsx)(zU,{fallback:(0,H.jsx)(Lm,{}),children:e.extraDialogElements})]})}),(0,H.jsxs)(ly,{children:[r&&(e.buttons||e.allowNote)?(0,H.jsx)(PU,{fallback:(0,H.jsx)(`div`,{}),children:(0,H.jsxs)(L.Suspense,{fallback:(0,H.jsx)(`div`,{}),children:[r&&e.allowNote?(0,H.jsx)(wW,{setNotesOpen:n}):void 0,e.buttons]})}):null,(0,H.jsx)(Y,{onClick:a,color:`secondary`,children:`Close`})]})]}),e.allowNote&&(s=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(dy,{children:(0,H.jsx)(gW,{notes:!0})}),(0,H.jsxs)(zU,{fallback:(0,H.jsx)(uy,{children:(0,H.jsx)(Lm,{})}),children:[(0,H.jsx)(SW,{setNotesOpen:n}),`;`]})]}))),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(cy,{open:r!==null,onClose:a,maxWidth:`lg`,children:o}),e.allowNote?(0,H.jsx)(cy,{open:t,onClose:()=>n(!1),maxWidth:`md`,children:s}):void 0]})}),EW=SO(`MachineCostPerYear`,{}),DW=SO(`AutomationCostPerYear`,null),OW=SO(`Last30LaborCost`,null),kW=aO(e=>SO(`PerMonthLabor-`+e.getFullYear().toString()+`-`+e.getMonth().toString(),null)),AW=P(e=>e(e(KR).type===`Last30`?sO:dO).valuesToLazySeq().filter(e=>e.procsAndPaths.length===1&&e.procsAndPaths[0].paths.length===1&&e.procsAndPaths[0].paths[0].stops.length===1&&zO(e.procsAndPaths[0].paths[0].stops[0].expectedCycleTime)===0).toHashSet(e=>e.partName)),jW=P(e=>{let t=e(KR),n=e(t.type===`Last30`?uk:pk),r=e(t.type===`Last30`?fL:mL),i=e(AW),a=LT(cE(),-30),o=t.type===`Last30`?null:t.month;return rz(n.valuesToLazySeq(),i,r.matsById,o?{month:o}:{thirtyDaysAgo:a})}),MW=P(e=>{let t=e(KR),n=e(EW),r=e(DW),i=e(t.type===`Last30`?OW:kW(t.month));return iz(e(jW),n,r,i??0)});function NW(){let[e,t]=(0,L.useState)(null),[n,r]=B(DW);return(0,H.jsx)(Kw,{id:`auotmation-cost-year`,type:`number`,label:`Cost for automated handling system per year`,style:{marginTop:`1.5em`},variant:`outlined`,value:e===null?n??``:isNaN(e)?``:e,onChange:e=>t(parseFloat(e.target.value)),onBlur:()=>{e!=null&&r(isNaN(e)?null:e),t(null)},slotProps:{htmlInput:{min:0}}})}function PW(){let e=R(KR),t=e.type===`Last30`?null:e.month,[n,r]=(0,L.useState)(null),[i,a]=B(t===null?OW:kW(t));return(0,H.jsx)(Kw,{type:`number`,label:`Total labor cost for `+(t===null?`last 30 days`:t.toLocaleDateString(void 0,{month:`long`,year:`numeric`})),variant:`outlined`,value:n===null?i??``:isNaN(n)?``:n,onChange:e=>r(parseFloat(e.target.value)),onBlur:()=>{n!=null&&a(isNaN(n)?null:n),r(null)},slotProps:{htmlInput:{min:0}}})}function FW(e){let[t,n]=(0,L.useState)(null),[r,i]=B(EW);return(0,H.jsx)(Kw,{type:`number`,variant:`outlined`,label:`Cost for `+e.machineGroup+` per station per year`,style:{marginTop:`1.5em`},value:t===null?r[e.machineGroup]??``:isNaN(t)?``:t,onChange:e=>n(parseFloat(e.target.value)),onBlur:()=>{if(t!=null){let n={...r};isNaN(t)?delete n[e.machineGroup]:n[e.machineGroup]=t,i(n)}n(null)},slotProps:{htmlInput:{min:0}}})}function IW(){let e=R(MW);return(0,H.jsx)(H.Fragment,{children:e.machineQuantities.keysToAscLazySeq().map((t,n)=>(0,H.jsx)(FW,{machineQuantities:e.machineQuantities,machineGroup:t},n))})}var LW=Intl.NumberFormat(void 0,{minimumFractionDigits:1,maximumFractionDigits:1}),RW=new Intl.NumberFormat(void 0,{style:`percent`,minimumFractionDigits:1,maximumFractionDigits:1});function zW(){JI(`Cost Percentages`);let e=R(jW);return(0,H.jsxs)(J,{sx:{paddingLeft:`24px`,paddingRight:`24px`,paddingTop:`10px`},children:[(0,H.jsxs)(J,{component:`nav`,sx:{display:`flex`,minHeight:`2.5em`,alignItems:`center`,maxWidth:`calc(100vw - 24px - 24px)`},children:[(0,H.jsx)(q,{variant:`subtitle1`,children:`Part Cost Percentage Breakdown`}),(0,H.jsx)(J,{sx:{flexGrow:1}}),(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{style:{height:`25px`,paddingTop:0,paddingBottom:0},onClick:()=>cz(e),size:`large`,children:(0,H.jsx)(uT,{})})})]}),(0,H.jsx)(`main`,{children:(0,H.jsxs)(jw,{stickyHeader:!0,children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:`Part`}),(0,H.jsx)(Z,{align:`right`,children:`Completed Quantity`}),e.machineQuantities.keysToAscLazySeq().map(e=>(0,H.jsxs)(Z,{align:`right`,children:[e,` Cost %`]},e)),(0,H.jsx)(Z,{align:`right`,children:`Labor Cost %`}),(0,H.jsx)(Z,{align:`right`,children:`Automation Cost %`})]})}),(0,H.jsx)(Pw,{children:Q.of(e.parts).sortBy(e=>e.part).map((t,n)=>(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:(0,H.jsxs)(J,{sx:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(J,{sx:{mr:`0.2em`},children:(0,H.jsx)(XU,{part:t.part,size:25})}),(0,H.jsx)(`div`,{children:(0,H.jsx)(q,{variant:`body2`,component:`span`,sx:{display:`block`},children:t.part})})]})}),(0,H.jsx)(Z,{align:`right`,children:t.parts_completed}),e.machineQuantities.keysToAscLazySeq().map(e=>(0,H.jsx)(Z,{align:`right`,children:RW.format(t.machine.get(e)??0)},e)),(0,H.jsx)(Z,{align:`right`,children:RW.format(t.labor)}),(0,H.jsx)(Z,{align:`right`,children:RW.format(t.automation)})]},n))})]})})]})}function BW(){let e=R(MW);return(0,H.jsxs)(jw,{stickyHeader:!0,children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:`Part`}),(0,H.jsx)(Z,{align:`right`,children:`Completed Quantity`}),e.machineQuantities.keysToAscLazySeq().map(e=>(0,H.jsxs)(Z,{align:`right`,children:[e,` Cost`]},e)),(0,H.jsx)(Z,{align:`right`,children:`Labor Cost`}),(0,H.jsx)(Z,{align:`right`,children:`Automation Cost`}),(0,H.jsxs)(Z,{align:`right`,children:[(0,H.jsx)(`span`,{children:`Total`}),(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{style:{height:`25px`,paddingTop:0,paddingBottom:0},onClick:()=>oz(e),size:`large`,children:(0,H.jsx)(uT,{})})})]})]})}),(0,H.jsx)(Pw,{children:Q.of(e.parts).sortBy(e=>e.part).map((t,n)=>(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:(0,H.jsxs)(J,{sx:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(J,{sx:{mr:`0.2em`},children:(0,H.jsx)(XU,{part:t.part,size:25})}),(0,H.jsx)(`div`,{children:(0,H.jsx)(q,{variant:`body2`,component:`span`,sx:{display:`block`},children:t.part})})]})}),(0,H.jsx)(Z,{align:`right`,children:t.parts_completed}),e.machineQuantities.keysToAscLazySeq().map(e=>(0,H.jsx)(Z,{align:`right`,children:LW.format(t.machine.get(e)??0)},e)),(0,H.jsx)(Z,{align:`right`,children:LW.format(t.labor)}),(0,H.jsx)(Z,{align:`right`,children:LW.format(t.automation)}),(0,H.jsx)(Z,{align:`right`,children:LW.format(t.machine.valuesToAscLazySeq().sumBy(e=>e)+t.labor+t.automation)})]},n))})]})}var VW=(0,L.memo)(function(){return JI(`Cost Per Piece`),(0,H.jsx)(J,{component:`main`,sx:{paddingLeft:`24px`,paddingRight:`24px`,paddingTop:`20px`},children:(0,H.jsxs)(RC,{direction:`column`,spacing:4,children:[(0,H.jsxs)(RC,{direction:`column`,spacing:2,children:[(0,H.jsx)(PW,{}),(0,H.jsx)(NW,{}),(0,H.jsx)(IW,{})]}),(0,H.jsx)(BW,{})]})})}),HW=[{type:`Subheader`,caption:`Shop Floor`},{type:`Link`,route:{route:$.Station_LoadMonitor,loadNum:1,queues:[],completed:!1},icon:(0,H.jsx)(_re,{}),label:`Load Station`},{type:`Link`,route:{route:$.Station_Queues,queues:[]},icon:(0,H.jsx)(oT,{}),label:`Queue Management`},{type:`Link`,route:{route:$.Station_InspectionMonitor},icon:(0,H.jsx)(Tre,{}),label:`Inspection Stand`},{type:`Link`,route:{route:$.Station_Closeout},icon:(0,H.jsx)(_T,{}),label:`Close Out`},{type:`Link`,route:{route:$.Tools_Dashboard},icon:(0,H.jsx)(Zw,{}),label:`Tool Management`},{type:`Link`,route:{route:$.Station_Overview},icon:(0,H.jsx)(ure,{}),label:`System Overview`},{type:`Subheader`,caption:`Daily Monitoring`},{type:`Link`,route:{route:$.Operations_Dashboard},icon:(0,H.jsx)(xT,{}),label:`Operation Management`},{type:`Link`,route:{route:$.Engineering_Cycles},icon:(0,H.jsx)(Ore,{}),label:`Engineering`},{type:`Link`,route:{route:$.Quality_Dashboard},icon:(0,H.jsx)(Pre,{}),label:`Quality Analysis`},{type:`Link`,route:{route:$.Sales_Dashboard},icon:(0,H.jsx)(Are,{}),label:`Sales`},{type:`Subheader`,caption:`Monthly Review`},{type:`Link`,route:{route:$.Analysis_Buffers},icon:(0,H.jsx)(Ere,{}),label:`Flexibility Analysis`}];function UW(e){let t=(0,H.jsx)(Up,{children:(0,H.jsx)(pb,{component:`nav`,dense:!0,children:(e.modes??HW).map((t,n)=>t.type===`Subheader`?(0,H.jsx)(m_,{children:t.caption},n):(0,H.jsx)(Db,{children:(0,H.jsxs)(vb,{onClick:()=>e.setRoute(t.route),children:[(0,H.jsx)(Mb,{children:t.icon}),(0,H.jsx)(Lb,{children:t.label})]})},n))})});return(0,H.jsx)(`main`,{style:{display:`flex`,justifyContent:`center`},children:(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{style:{textAlign:`center`},children:[(0,H.jsx)(q,{variant:`h4`,style:{marginTop:`2em`},children:`Select user and computer location`}),(0,H.jsxs)(q,{variant:`caption`,style:{marginBottom:`2em`,maxWidth:`30em`,marginLeft:`auto`,marginRight:`auto`},children:[`We recommend that after selecting one of the following modes, you bookmark the page and visit it directly.`,(0,H.jsx)(`a`,{href:`https://fms-insight.seedtactics.com/docs/client-dashboard.html`,children:`Learn More`})]})]}),t]})})}var WW=[[`All`,`*`,`*`,` `,0,`All`],[`AllReadable`,`*`,`r`,` `,0,`All Readable`],[`AllCreatable`,`*`,`w`,` `,0,`All Creatable`],[`AllLinear`,`*`,`l`,` `,0,`All Linear`],[`AllMatrix`,`*`,`m`,` `,0,`All Matrix`],[`AllGS1`,`*`,`G`,` `,0,`All GS1`],[`AllRetail`,`*`,`R`,` `,0,`All Retail`],[`AllIndustrial`,`*`,`I`,` `,0,`All Industrial`],[`Codabar`,`F`,` `,`lrw `,18,`Codabar`],[`Code39`,`A`,` `,`lrw I`,8,`Code 39`],[`Code39Std`,`A`,`s`,`lrw I`,8,`Code 39 Standard`],[`Code39Ext`,`A`,`e`,`lr I`,9,`Code 39 Extended`],[`Code32`,`A`,`2`,`lr I`,129,`Code 32`],[`PZN`,`A`,`p`,`lr I`,52,`Pharmazentralnummer`],[`Code93`,`G`,` `,`lrw I`,25,`Code 93`],[`Code128`,`C`,` `,`lrwGI`,20,`Code 128`],[`ITF`,`I`,` `,`lrw I`,3,`ITF`],[`ITF14`,`I`,`4`,`lr I`,89,`ITF-14`],[`DataBar`,`e`,` `,`lr GR`,29,`DataBar`],[`DataBarOmni`,`e`,`o`,`lr GR`,29,`DataBar Omni`],[`DataBarStk`,`e`,`s`,`lr GR`,79,`DataBar Stacked`],[`DataBarStkOmni`,`e`,`O`,`lr GR`,80,`DataBar Stacked Omni`],[`DataBarLtd`,`e`,`l`,`lr GR`,30,`DataBar Limited`],[`DataBarExp`,`e`,`e`,`lr GR`,31,`DataBar Expanded`],[`DataBarExpStk`,`e`,`E`,`lr GR`,81,`DataBar Expanded Stacked`],[`EANUPC`,`E`,` `,`lr R`,15,`EAN/UPC`],[`EAN13`,`E`,`1`,`lrw R`,15,`EAN-13`],[`EAN8`,`E`,`8`,`lrw R`,10,`EAN-8`],[`EAN5`,`E`,`5`,`l R`,12,`EAN-5`],[`EAN2`,`E`,`2`,`l R`,11,`EAN-2`],[`ISBN`,`E`,`i`,`lr R`,69,`ISBN`],[`UPCA`,`E`,`a`,`lrw R`,34,`UPC-A`],[`UPCE`,`E`,`e`,`lrw R`,37,`UPC-E`],[`Telepen`,`B`,` `,`lr I`,32,`Telepen`],[`TelepenAlpha`,`B`,`0`,`lr I`,32,`Telepen Alpha`],[`TelepenNumeric`,`B`,`1`,`lr I`,87,`Telepen Numeric`],[`OtherBarcode`,`X`,` `,` r `,0,`Other barcode`],[`DXFilmEdge`,`X`,`x`,`lr `,147,`DX Film Edge`],[`PDF417`,`L`,` `,`mrw `,55,`PDF417`],[`CompactPDF417`,`L`,`c`,`mr `,56,`Compact PDF417`],[`MicroPDF417`,`L`,`m`,`mr `,84,`MicroPDF417`],[`Aztec`,`z`,` `,`mr G `,92,`Aztec`],[`AztecCode`,`z`,`c`,`mrwG `,92,`Aztec Code`],[`AztecRune`,`z`,`r`,`mr `,128,`Aztec Rune`],[`QRCode`,`Q`,` `,`mrwG `,58,`QR Code`],[`QRCodeModel1`,`Q`,`1`,`mr `,0,`QR Code Model 1`],[`QRCodeModel2`,`Q`,`2`,`mr `,58,`QR Code Model 2`],[`MicroQRCode`,`Q`,`m`,`mr `,97,`Micro QR Code`],[`RMQRCode`,`Q`,`r`,`mr G `,145,`rMQR Code`],[`DataMatrix`,`d`,` `,`mrwG `,71,`Data Matrix`],[`MaxiCode`,`U`,` `,`mr `,57,`MaxiCode`]],GW={DataBarExpanded:`DataBarExp`,DataBarLimited:`DataBarLtd`,"Linear-Codes":`AllLinear`,"Matrix-Codes":`AllMatrix`,Any:`All`,rMQRCode:`RMQRCode`};WW.map(e=>e[5]),WW.filter(e=>e[1]===`*`).map(e=>e[0]),WW.filter(e=>e[1]!==`*`).map(e=>e[0]),WW.filter(e=>e[2]===` `).map(e=>e[0]),WW.filter(e=>e[3][0]===`l`).map(e=>e[0]),WW.filter(e=>e[3][0]===`m`).map(e=>e[0]),WW.filter(e=>e[3][1]===`r`).map(e=>e[0]),WW.filter(e=>e[3][2]===`w`||e[4]!==0).map(e=>e[0]),WW.filter(e=>e[3][3]===`G`).map(e=>e[0]),WW.filter(e=>e[3][4]===`R`).map(e=>e[0]),WW.filter(e=>e[3][4]===`I`).map(e=>e[0]);function KW(e){return GW[e]??e}function qW(e){return e.map(KW).join(`,`)}var JW=[`LocalAverage`,`GlobalHistogram`,`FixedThreshold`,`BoolCast`];function YW(e){return JW.indexOf(e)}var XW=`Unknown.ASCII.ISO8859_1.ISO8859_2.ISO8859_3.ISO8859_4.ISO8859_5.ISO8859_6.ISO8859_7.ISO8859_8.ISO8859_9.ISO8859_10.ISO8859_11.ISO8859_13.ISO8859_14.ISO8859_15.ISO8859_16.Cp437.Cp1250.Cp1251.Cp1252.Cp1256.Shift_JIS.Big5.GB2312.GB18030.EUC_JP.EUC_KR.UTF16BE.UTF8.UTF16LE.UTF32BE.UTF32LE.BINARY`.split(`.`);function ZW(e){return e===`UnicodeBig`?XW.indexOf(`UTF16BE`):XW.indexOf(e)}var QW=[`Text`,`Binary`,`Mixed`,`GS1`,`ISO15434`,`UnknownECI`];function $W(e){return QW[e]}var eG=[`Ignore`,`Read`,`Require`];function tG(e){return eG.indexOf(e)}var nG=[`Plain`,`ECI`,`HRI`,`Escaped`,`Hex`,`HexECI`];function rG(e){return nG.indexOf(e)}var iG={formats:[],tryHarder:!0,tryRotate:!0,tryInvert:!0,tryDownscale:!0,tryDenoise:!1,binarizer:`LocalAverage`,isPure:!1,downscaleFactor:3,downscaleThreshold:500,minLineCount:2,maxNumberOfSymbols:255,validateOptionalChecksum:!1,returnErrors:!1,eanAddOnSymbol:`Ignore`,textMode:`HRI`,characterSet:`Unknown`,tryCode39ExtendedMode:!0};function aG(e){var t;return{...e,formats:qW(e.formats),binarizer:YW(e.binarizer),eanAddOnSymbol:tG(e.eanAddOnSymbol),textMode:rG(e.textMode),characterSet:ZW(e.characterSet),tryCode39ExtendedMode:(t=e.tryCode39ExtendedMode)==null||t}}function oG(e){return{...e,format:e.format,symbology:e.symbology,contentType:$W(e.contentType)}}var sG={format:`QRCode`,readerInit:!1,forceSquareDataMatrix:!1,ecLevel:``,scale:1,sizeHint:0,rotate:0,invert:!1,withHRT:!1,withQuietZones:!0,addHRT:!1,addQuietZones:!0,options:``},cG={locateFile:(e,t)=>{let n=e.match(/_(.+?)\.wasm$/);return n?`https://fastly.jsdelivr.net/npm/zxing-wasm@3.1.1/dist/${n[1]}/${e}`:t+e}},lG=new WeakMap;function uG(e,t){return Object.is(e,t)||Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>Object.hasOwn(t,n)&&e[n]===t[n])}function dG(e,{overrides:t,equalityFn:n=uG,fireImmediately:r=!1}={}){let[i,a]=lG.get(e)??[cG],o=t??i,s;if(r){if(a&&(s=n(i,o)))return a;let t=e({...o});return lG.set(e,[o,t]),t}(s??n(i,o))||lG.set(e,[o])}function fG(e){let t=e.byteLength>>2,n=new Uint8Array(t);for(let r=0;r<t;r++){let t=r<<2;n[r]=306*e[t]+601*e[t+1]+117*e[t+2]+512>>10}return n}async function pG(e,t,n=iG){let r={...iG,...n},i=await dG(e,{fireImmediately:!0}),a,o;if(`width`in t&&`height`in t&&`data`in t){let{data:e,width:n,height:s}=t,c=fG(e),l=c.byteLength;if(o=i._malloc(l),!o)throw Error(`Failed to allocate ${l} bytes in WASM memory`);try{i.HEAPU8.set(c,o),a=i.readBarcodesFromPixmap(o,n,s,aG(r))}finally{i._free(o)}}else{let e,n;if(`buffer`in t)[e,n]=[t.byteLength,t];else if(`byteLength`in t)[e,n]=[t.byteLength,new Uint8Array(t)];else if(`size`in t)[e,n]=[t.size,new Uint8Array(await t.arrayBuffer())];else throw TypeError(`Invalid input type`);if(o=i._malloc(e),!o)throw Error(`Failed to allocate ${e} bytes in WASM memory`);try{i.HEAPU8.set(n,o),a=i.readBarcodesFromImage(o,e,aG(r))}finally{i._free(o)}}let s=[];for(let e=0;e<a.size();++e)s.push(oG(a.get(e)));return s}({...iG}),[...iG.formats],{...sG};async function mG(e={}){var t,n,r,i=e,a=!!globalThis.window,o=typeof Bun<`u`,s=!!globalThis.WorkerGlobalScope;!((n=globalThis.process)==null||(n=n.versions)==null)&&n.node&&((r=globalThis.process)==null||r.type);var c=`./this.program`,l,u=``;function d(e){return i.locateFile?i.locateFile(e,u):u+e}var f,p;if(a||s||o){try{u=new URL(`.`,l).href}catch{}s&&(p=e=>{var t=new XMLHttpRequest;return t.open(`GET`,e,!1),t.responseType=`arraybuffer`,t.send(null),new Uint8Array(t.response)}),f=async e=>{var t=await fetch(e,{credentials:`same-origin`});if(t.ok)return t.arrayBuffer();throw Error(t.status+` : `+t.url)}}console.log.bind(console);var m=console.error.bind(console),h,g=!1,_,v,y=!1;function b(){var e=tr.buffer;ne=new Int8Array(e),j=new Int16Array(e),i.HEAPU8=oe=new Uint8Array(e),ae=new Uint16Array(e),M=new Int32Array(e),N=new Uint32Array(e),re=new Float32Array(e),ie=new Float64Array(e)}function x(){if(i.preRun)for(typeof i.preRun==`function`&&(i.preRun=[i.preRun]);i.preRun.length;)ue(i.preRun.shift());se(le)}function S(){y=!0,Wr.ya()}function C(){if(i.postRun)for(typeof i.postRun==`function`&&(i.postRun=[i.postRun]);i.postRun.length;)P(i.postRun.shift());se(ce)}function w(e){var t,n;(t=i.onAbort)==null||t.call(i,e),e=`Aborted(`+e+`)`,m(e),g=!0,e+=`. Build with -sASSERTIONS for more info.`;var r=new WebAssembly.RuntimeError(e);throw(n=v)==null||n(r),r}var T;function E(){return d(`zxing_reader.wasm`)}function D(e){if(e==T&&h)return new Uint8Array(h);if(p)return p(e);throw`both async and sync fetching of the wasm failed`}async function O(e){if(!h)try{var t=await f(e);return new Uint8Array(t)}catch{}return D(e)}async function ee(e,t){try{var n=await O(e);return await WebAssembly.instantiate(n,t)}catch(e){m(`failed to asynchronously prepare wasm: ${e}`),w(e)}}async function te(e,t,n){if(!e&&WebAssembly.instantiateStreaming)try{var r=fetch(t,{credentials:`same-origin`});return await WebAssembly.instantiateStreaming(r,n)}catch(e){m(`wasm streaming compile failed: ${e}`),m(`falling back to ArrayBuffer instantiation`)}return ee(t,n)}function k(){return{a:ir}}async function A(){function e(e,t){return Wr=e.exports,rr(Wr),b(),Wr}function t(t){return e(t.instance)}var n=k();return i.instantiateWasm?new Promise((t,r)=>{i.instantiateWasm(n,(n,r)=>{t(e(n,r))})}):(T??=E(),t(await te(h,T,n)))}var j,M,ne,re,ie,ae,N,oe,se=e=>{for(;e.length>0;)e.shift()(i)},ce=[],P=e=>ce.push(e),le=[],ue=e=>le.push(e),F=e=>qn(e),I=()=>Jn(),de=[],fe=0,pe=e=>{var t=new he(e);return t.get_caught()||(t.set_caught(!0),fe--),t.set_rethrown(!1),de.push(t),Wn(e)},me=0,L=()=>{Gn(0,0);var e=de.pop();Yn(e.excPtr),me=0};class he{constructor(e){this.excPtr=e,this.ptr=e-24}set_type(e){N[this.ptr+4>>2]=e}get_type(){return N[this.ptr+4>>2]}set_destructor(e){N[this.ptr+8>>2]=e}get_destructor(){return N[this.ptr+8>>2]}set_caught(e){e=+!!e,ne[this.ptr+12]=e}get_caught(){return ne[this.ptr+12]!=0}set_rethrown(e){e=+!!e,ne[this.ptr+13]=e}get_rethrown(){return ne[this.ptr+13]!=0}init(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)}set_adjusted_ptr(e){N[this.ptr+16>>2]=e}get_adjusted_ptr(){return N[this.ptr+16>>2]}}var ge=e=>Kn(e),_e=e=>{var t=me;if(!t)return ge(0),0;var n=new he(t);n.set_adjusted_ptr(t);var r=n.get_type();if(!r)return ge(0),t;for(var i of e){if(i===0||i===r)break;var a=n.ptr+16;if(Zn(i,r,a))return ge(i),t}return ge(r),t},ve=()=>_e([]),ye=e=>_e([e]),be=(e,t)=>_e([e,t]),xe=()=>{var e=de.pop();e||w(`no exception to throw`);var t=e.excPtr;throw e.get_rethrown()||(de.push(e),e.set_rethrown(!0),e.set_caught(!1),fe++),Xn(t),me=t,me},Se=(e,t,n)=>{throw new he(e).init(t,n),Xn(e),me=e,fe++,me},R=()=>fe,z=e=>{throw me||=e,me},B=()=>w(``),Ce={},we=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Te(e){return this.fromWireType(N[e>>2])}var Ee={},De={},Oe={},ke=class extends Error{constructor(e){super(e),this.name=`InternalError`}},Ae=e=>{throw new ke(e)},je=(e,t,n)=>{e.forEach(e=>Oe[e]=t);function r(t){var r=n(t);r.length!==e.length&&Ae(`Mismatched type converter count`);for(var i=0;i<e.length;++i)Le(e[i],r[i])}var i=Array(t.length),a=[],o=0;{let e=t;for(let t=0;t<e.length;++t){let n=e[t];De.hasOwnProperty(n)?i[t]=De[n]:(a.push(n),Ee.hasOwnProperty(n)||(Ee[n]=[]),Ee[n].push(()=>{i[t]=De[n],++o,o===a.length&&r(i)}))}}a.length===0&&r(i)},V=e=>{var t=Ce[e];delete Ce[e];var n=t.rawConstructor,r=t.rawDestructor,i=t.fields,a=i.map(e=>e.getterReturnType).concat(i.map(e=>e.setterArgumentType));je([e],a,e=>{var a={};{let t=i;for(let n=0;n<t.length;++n){let r=t[n],o=e[n],s=r.getter,c=r.getterContext,l=e[n+i.length],u=r.setter,d=r.setterContext;a[r.fieldName]={read:e=>o.fromWireType(s(c,e)),write:(e,t)=>{var n=[];u(d,e,l.toWireType(n,t)),we(n)},optional:o.optional}}}return[{name:t.name,fromWireType:e=>{var t={};for(var n in a)t[n]=a[n].read(e);return r(e),t},toWireType:(e,t)=>{for(var i in a)if(!(i in t)&&!a[i].optional)throw TypeError(`Missing field: "${i}"`);var o=n();for(i in a)a[i].write(o,t[i]);return e!==null&&e.push(r,o),o},readValueFromPointer:Te,destructorFunction:r}]})},Me=(e,t,n,r,i)=>{},Ne=e=>{for(var t=``;;){var n=oe[e++];if(!n)return t;t+=String.fromCharCode(n)}},Pe=class extends Error{constructor(e){super(e),this.name=`BindingError`}},Fe=e=>{throw new Pe(e)};function Ie(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=t.name;if(e||Fe(`type "${r}" must have a positive integer typeid pointer`),De.hasOwnProperty(e)){if(n.ignoreDuplicateRegistrations)return;Fe(`Cannot register type '${r}' twice`)}if(De[e]=t,delete Oe[e],Ee.hasOwnProperty(e)){var i=Ee[e];delete Ee[e],i.forEach(e=>e())}}function Le(e,t){return Ie(e,t,arguments.length>2&&arguments[2]!==void 0?arguments[2]:{})}var Re=(e,t,n,r)=>{t=Ne(t),Le(e,{name:t,fromWireType:function(e){return!!e},toWireType:function(e,t){return t?n:r},readValueFromPointer:function(e){return this.fromWireType(oe[e])},destructorFunction:null})},ze=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),Be=e=>{function t(e){return e.$$.ptrType.registeredClass.name}Fe(t(e)+` instance already deleted`)},Ve=!1,He=e=>{},Ue=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},We=e=>{--e.count.value,e.count.value===0&&Ue(e)},Ge=e=>globalThis.FinalizationRegistry?(Ve=new FinalizationRegistry(e=>{We(e.$$)}),Ge=e=>{var t=e.$$;if(t.smartPtr){var n={$$:t};Ve.register(e,n,e)}return e},He=e=>Ve.unregister(e),Ge(e)):(Ge=e=>e,e),Ke=[],qe=()=>{for(;Ke.length;){var e=Ke.pop();e.$$.deleteScheduled=!1,e.delete()}},Je,Ye=()=>{let e=Xe.prototype;Object.assign(e,{isAliasOf(e){if(!(this instanceof Xe)||!(e instanceof Xe))return!1;var t=this.$$.ptrType.registeredClass,n=this.$$.ptr;e.$$=e.$$;for(var r=e.$$.ptrType.registeredClass,i=e.$$.ptr;t.baseClass;)n=t.upcast(n),t=t.baseClass;for(;r.baseClass;)i=r.upcast(i),r=r.baseClass;return t===r&&n===i},clone(){if(this.$$.ptr||Be(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=Ge(Object.create(Object.getPrototypeOf(this),{$$:{value:ze(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||Be(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Fe(`Object already scheduled for deletion`),He(this),We(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Be(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Fe(`Object already scheduled for deletion`),Ke.push(this),Ke.length===1&&Je&&Je(qe),this.$$.deleteScheduled=!0,this}});let t=Symbol.dispose;t&&(e[t]=e.delete)};function Xe(){}var Ze=(e,t)=>Object.defineProperty(t,"name",{value:e}),Qe={},$e=(e,t,n)=>{if(e[t].overloadTable===void 0){var r=e[t];e[t]=function(){var r=[...arguments];return e[t].overloadTable.hasOwnProperty(r.length)||Fe(`Function '${n}' called with an invalid number of arguments (${r.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[r.length].apply(this,r)},e[t].overloadTable=[],e[t].overloadTable[r.argCount]=r}},et=(e,t,n)=>{i.hasOwnProperty(e)?((n===void 0||i[e].overloadTable!==void 0&&i[e].overloadTable[n]!==void 0)&&Fe(`Cannot register public name '${e}' twice`),$e(i,e,e),i[e].overloadTable.hasOwnProperty(n)&&Fe(`Cannot register multiple overloads of a function with the same number of arguments (${n})!`),i[e].overloadTable[n]=t):(i[e]=t,i[e].argCount=n)},tt=48,nt=57,rt=e=>{e=e.replace(/[^a-zA-Z0-9_]/g,`$`);var t=e.charCodeAt(0);return t>=tt&&t<=nt?`_${e}`:e};function it(e,t,n,r,i,a,o,s){this.name=e,this.constructor=t,this.instancePrototype=n,this.rawDestructor=r,this.baseClass=i,this.getActualType=a,this.upcast=o,this.downcast=s,this.pureVirtualFunctions=[]}var at=(e,t,n)=>{for(;t!==n;)t.upcast||Fe(`Expected null or instance of ${n.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e},ot=e=>{if(e===null)return`null`;var t=typeof e;return t===`object`||t===`array`||t===`function`?e.toString():``+e};function st(e,t){if(t===null)return this.isReference&&Fe(`null is not a valid ${this.name}`),0;t.$$||Fe(`Cannot pass "${ot(t)}" as a ${this.name}`),t.$$.ptr||Fe(`Cannot pass deleted object as a pointer of type ${this.name}`);var n=t.$$.ptrType.registeredClass;return at(t.$$.ptr,n,this.registeredClass)}function ct(e,t){var n;if(t===null)return this.isReference&&Fe(`null is not a valid ${this.name}`),this.isSmartPointer?(n=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,n),n):0;(!t||!t.$$)&&Fe(`Cannot pass "${ot(t)}" as a ${this.name}`),t.$$.ptr||Fe(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&Fe(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;if(n=at(t.$$.ptr,r,this.registeredClass),this.isSmartPointer)switch(t.$$.smartPtr===void 0&&Fe(`Passing raw pointer to smart pointer is illegal`),this.sharingPolicy){case 0:t.$$.smartPtrType===this?n=t.$$.smartPtr:Fe(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:n=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)n=t.$$.smartPtr;else{var i=t.clone();n=this.rawShare(n,zt.toHandle(()=>i.delete())),e!==null&&e.push(this.rawDestructor,n)}break;default:Fe(`Unsupported sharing policy`)}return n}function lt(e,t){if(t===null)return this.isReference&&Fe(`null is not a valid ${this.name}`),0;t.$$||Fe(`Cannot pass "${ot(t)}" as a ${this.name}`),t.$$.ptr||Fe(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&Fe(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var n=t.$$.ptrType.registeredClass;return at(t.$$.ptr,n,this.registeredClass)}var ut=(e,t,n)=>{if(t===n)return e;if(n.baseClass===void 0)return null;var r=ut(e,t,n.baseClass);return r===null?null:n.downcast(r)},dt={},ft=(e,t)=>{for(t===void 0&&Fe(`ptr should not be undefined`);e.baseClass;)t=e.upcast(t),e=e.baseClass;return t},pt=(e,t)=>(t=ft(e,t),dt[t]),mt=(e,t)=>((!t.ptrType||!t.ptr)&&Ae(`makeClassHandle requires ptr and ptrType`),!!t.smartPtrType!=!!t.smartPtr&&Ae(`Both smartPtrType and smartPtr must be specified`),t.count={value:1},Ge(Object.create(e,{$$:{value:t,writable:!0}})));function ht(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var n=pt(this.registeredClass,t);if(n!==void 0){if(n.$$.count.value===0)return n.$$.ptr=t,n.$$.smartPtr=e,n.clone();var r=n.clone();return this.destructor(e),r}function i(){return this.isSmartPointer?mt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):mt(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var a=Qe[this.registeredClass.getActualType(t)];if(!a)return i.call(this);var o=this.isConst?a.constPointerType:a.pointerType,s=ut(t,this.registeredClass,o.registeredClass);return s===null?i.call(this):this.isSmartPointer?mt(o.registeredClass.instancePrototype,{ptrType:o,ptr:s,smartPtrType:this,smartPtr:e}):mt(o.registeredClass.instancePrototype,{ptrType:o,ptr:s})}var gt=()=>{Object.assign(_t.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){var t;(t=this.rawDestructor)==null||t.call(this,e)},readValueFromPointer:Te,fromWireType:ht})};function _t(e,t,n,r,i,a,o,s,c,l,u){this.name=e,this.registeredClass=t,this.isReference=n,this.isConst=r,this.isSmartPointer=i,this.pointeeType=a,this.sharingPolicy=o,this.rawGetPointee=s,this.rawConstructor=c,this.rawShare=l,this.rawDestructor=u,!i&&t.baseClass===void 0?r?(this.toWireType=st,this.destructorFunction=null):(this.toWireType=lt,this.destructorFunction=null):this.toWireType=ct}var vt=(e,t,n)=>{i.hasOwnProperty(e)||Ae(`Replacing nonexistent public symbol`),i[e].overloadTable!==void 0&&n!==void 0?i[e].overloadTable[n]=t:(i[e]=t,i[e].argCount=n)},yt={},bt=(e,t,n)=>{e=e.replace(/p/g,`i`);var r=yt[e];return r(t,...n)},xt=[],St=e=>{var t=xt[e];return t||(xt[e]=t=nr.get(e)),t},Ct=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];if(arguments.length>3&&arguments[3]!==void 0&&arguments[3],e.includes(`j`))return bt(e,t,n);var r=St(t)(...n);function i(e){return e}return i(r)},wt=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0&&arguments[2];return function(){return Ct(e,t,[...arguments],n)}},Tt=function(e,t){arguments.length>2&&arguments[2]!==void 0&&arguments[2],e=Ne(e);function n(){return e.includes(`j`)?wt(e,t):St(t)}var r=n();return typeof r!=`function`&&Fe(`unknown function pointer with signature ${e}: ${t}`),r};class Et extends Error{}var Dt=e=>{var t=Vn(e),n=Ne(t);return Hn(t),n},Ot=(e,t)=>{var n=[],r={};function i(e){if(!r[e]&&!De[e]){if(Oe[e]){Oe[e].forEach(i);return}n.push(e),r[e]=!0}}throw t.forEach(i),new Et(`${e}: `+n.map(Dt).join([`, `]))},kt=(e,t,n,r,i,a,o,s,c,l,u,d,f)=>{u=Ne(u),a=Tt(i,a),s&&=Tt(o,s),l&&=Tt(c,l),f=Tt(d,f);var p=rt(u);et(p,function(){Ot(`Cannot construct ${u} due to unbound types`,[r])}),je([e,t,n],r?[r]:[],t=>{t=t[0];var n,i;r?(n=t.registeredClass,i=n.instancePrototype):i=Xe.prototype;var o=Ze(u,function(){if(Object.getPrototypeOf(this)!==c)throw new Pe(`Use 'new' to construct ${u}`);if(d.constructor_body===void 0)throw new Pe(`${u} has no accessible constructor`);var e=[...arguments],t=d.constructor_body[e.length];if(t===void 0)throw new Pe(`Tried to invoke ctor of ${u} with invalid number of parameters (${e.length}) - expected (${Object.keys(d.constructor_body).toString()}) parameters instead!`);return t.apply(this,e)}),c=Object.create(i,{constructor:{value:o}});o.prototype=c;var d=new it(u,o,c,f,n,a,s,l);if(d.baseClass){var m;(m=d.baseClass).__derivedClasses??(m.__derivedClasses=[]),d.baseClass.__derivedClasses.push(d)}var h=new _t(u,d,!0,!1,!1),g=new _t(u+`*`,d,!1,!1,!1),_=new _t(u+` const*`,d,!1,!0,!1);return Qe[e]={pointerType:g,constPointerType:_},vt(p,o),[h,g,_]})},At=(e,t)=>{for(var n=[],r=0;r<e;r++)n.push(N[t+r*4>>2]);return n};function jt(e){for(var t=1;t<e.length;++t)if(e[t]!==null&&e[t].destructorFunction===void 0)return!0;return!1}function Mt(e,t,n,r,i,a){var o=t.length;o<2&&Fe(`argTypes array size mismatch! Must at least get return value and 'this' types!`);var s=t[1]!==null&&n!==null,c=jt(t),l=!t[0].isVoid,u=o-2,d=Array(u),f=[],p=[];return Ze(e,function(){p.length=0;var e;f.length=s?2:1,f[0]=i,s&&(e=t[1].toWireType(p,this),f[1]=e);for(var n=0;n<u;++n)d[n]=t[n+2].toWireType(p,n<0||arguments.length<=n?void 0:arguments[n]),f.push(d[n]);var a=r(...f);function o(n){if(c)we(p);else for(var r=s?1:2;r<t.length;r++){var i=r===1?e:d[r-2];t[r].destructorFunction!==null&&t[r].destructorFunction(i)}if(l)return t[0].fromWireType(n)}return o(a)})}var Nt=(e,t,n,r,i,a)=>{var o=At(t,n);i=Tt(r,i),je([],[e],e=>{e=e[0];var n=`constructor ${e.name}`;if(e.registeredClass.constructor_body===void 0&&(e.registeredClass.constructor_body=[]),e.registeredClass.constructor_body[t-1]!==void 0)throw new Pe(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{Ot(`Cannot construct ${e.name} due to unbound types`,o)},je([],o,r=>(r.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Mt(n,r,null,i,a),[])),[]})},Pt=e=>{e=e.trim();let t=e.indexOf(`(`);return t===-1?e:e.slice(0,t)},Ft=(e,t,n,r,i,a,o,s,c,l)=>{var u=At(n,r);t=Ne(t),t=Pt(t),a=Tt(i,a,c),je([],[e],e=>{e=e[0];var r=`${e.name}.${t}`;t.startsWith(`@@`)&&(t=Symbol[t.substring(2)]),s&&e.registeredClass.pureVirtualFunctions.push(t);function i(){Ot(`Cannot call ${r} due to unbound types`,u)}var l=e.registeredClass.instancePrototype,d=l[t];return d===void 0||d.overloadTable===void 0&&d.className!==e.name&&d.argCount===n-2?(i.argCount=n-2,i.className=e.name,l[t]=i):($e(l,t,r),l[t].overloadTable[n-2]=i),je([],u,i=>{var s=Mt(r,i,e,a,o,c);return l[t].overloadTable===void 0?(s.argCount=n-2,l[t]=s):l[t].overloadTable[n-2]=s,[]}),[]})},It=[],Lt=[0,1,,1,null,1,!0,1,!1,1],Rt=e=>{e>9&&--Lt[e+1]===0&&(Lt[e]=void 0,It.push(e))},zt={toValue:e=>(e||Fe(`Cannot use deleted val. handle = ${e}`),Lt[e]),toHandle:e=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{let t=It.pop()||Lt.length;return Lt[t]=e,Lt[t+1]=1,t}}}},Bt={name:`emscripten::val`,fromWireType:e=>{var t=zt.toValue(e);return Rt(e),t},toWireType:(e,t)=>zt.toHandle(t),readValueFromPointer:Te,destructorFunction:null},Vt=e=>Le(e,Bt),Ht=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(re[e>>2])};case 8:return function(e){return this.fromWireType(ie[e>>3])};default:throw TypeError(`invalid float width (${t}): ${e}`)}},Ut=(e,t,n)=>{t=Ne(t),Le(e,{name:t,fromWireType:e=>e,toWireType:(e,t)=>t,readValueFromPointer:Ht(t,n),destructorFunction:null})},Wt=(e,t,n,r,i,a,o,s)=>{var c=At(t,n);e=Ne(e),e=Pt(e),i=Tt(r,i,o),et(e,function(){Ot(`Cannot call ${e} due to unbound types`,c)},t-1),je([],c,n=>{var r=[n[0],null].concat(n.slice(1));return vt(e,Mt(e,r,null,i,a,o),t-1),[]})},Gt=(e,t,n)=>{switch(t){case 1:return n?e=>ne[e]:e=>oe[e];case 2:return n?e=>j[e>>1]:e=>ae[e>>1];case 4:return n?e=>M[e>>2]:e=>N[e>>2];default:throw TypeError(`invalid integer width (${t}): ${e}`)}},Kt=(e,t,n,r,i)=>{t=Ne(t);let a=r===0,o=e=>e;if(a){var s=32-8*n;o=e=>e<<s>>>s,i=o(i)}Le(e,{name:t,fromWireType:o,toWireType:(e,t)=>t,readValueFromPointer:Gt(t,n,r!==0),destructorFunction:null})},qt=(e,t,n)=>{let r=(e,t)=>{let n=0;return{next(){if(n>=e)return{done:!0};let r=n;return n++,{value:t(r),done:!1}},[Symbol.iterator](){return this}}};e[Symbol.iterator]||(e[Symbol.iterator]=function(){return r(this[t](),e=>this[n](e))})},Jt=(e,t,n,r)=>{n=Ne(n),r=Ne(r),je([],[e,t],e=>{let t=e[0];return qt(t.registeredClass.instancePrototype,n,r),[]})},Yt=(e,t,n)=>{var r=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function i(e){var t=N[e>>2],n=N[e+4>>2];return new r(ne.buffer,n,t)}n=Ne(n),Le(e,{name:n,fromWireType:i,readValueFromPointer:i},{ignoreDuplicateRegistrations:!0})},Xt=Object.assign({optional:!0},Bt),Zt=(e,t)=>{Le(e,Xt)},Qt=(e,t,n,r)=>{if(!(r>0))return 0;for(var i=n,a=n+r-1,o=0;o<e.length;++o){var s=e.codePointAt(o);if(s<=127){if(n>=a)break;t[n++]=s}else if(s<=2047){if(n+1>=a)break;t[n++]=192|s>>6,t[n++]=128|s&63}else if(s<=65535){if(n+2>=a)break;t[n++]=224|s>>12,t[n++]=128|s>>6&63,t[n++]=128|s&63}else{if(n+3>=a)break;t[n++]=240|s>>18,t[n++]=128|s>>12&63,t[n++]=128|s>>6&63,t[n++]=128|s&63,o++}}return t[n]=0,n-i},$t=(e,t,n)=>Qt(e,oe,t,n),en=e=>{for(var t=0,n=0;n<e.length;++n){var r=e.charCodeAt(n);r<=127?t++:r<=2047?t+=2:r>=55296&&r<=57343?(t+=4,++n):t+=3}return t},tn=globalThis.TextDecoder&&new TextDecoder,nn=(e,t,n,r)=>{var i=t+n;if(r)return i;for(;e[t]&&!(t>=i);)++t;return t},rn=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;var i=nn(e,t,n,r);if(i-t>16&&e.buffer&&tn)return tn.decode(e.subarray(t,i));for(var a=``;t<i;){var o=e[t++];if(!(o&128)){a+=String.fromCharCode(o);continue}var s=e[t++]&63;if((o&224)==192){a+=String.fromCharCode((o&31)<<6|s);continue}var c=e[t++]&63;if(o=(o&240)==224?(o&15)<<12|s<<6|c:(o&7)<<18|s<<12|c<<6|e[t++]&63,o<65536)a+=String.fromCharCode(o);else{var l=o-65536;a+=String.fromCharCode(55296|l>>10,56320|l&1023)}}return a},an=(e,t,n)=>e?rn(oe,e,t,n):``,on=(e,t)=>{t=Ne(t);var n=!0;Le(e,{name:t,fromWireType(e){var t=N[e>>2],r=e+4,i;if(n)i=an(r,t,!0);else{i=``;for(var a=0;a<t;++a)i+=String.fromCharCode(oe[r+a])}return Hn(e),i},toWireType(e,t){t instanceof ArrayBuffer&&(t=new Uint8Array(t));var r,i=typeof t==`string`;i||ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT==1||Fe(`Cannot pass non-string to std::string`),r=n&&i?en(t):t.length;var a=Un(4+r+1),o=a+4;if(N[a>>2]=r,i)if(n)$t(t,o,r+1);else for(var s=0;s<r;++s){var c=t.charCodeAt(s);c>255&&(Hn(a),Fe(`String has UTF-16 code units that do not fit in 8 bits`)),oe[o+s]=c}else oe.set(t,o);return e!==null&&e.push(Hn,a),a},readValueFromPointer:Te,destructorFunction(e){Hn(e)}})},sn=globalThis.TextDecoder?new TextDecoder(`utf-16le`):void 0,cn=(e,t,n)=>{var r=e>>1,i=nn(ae,r,t/2,n);if(i-r>16&&sn)return sn.decode(ae.subarray(r,i));for(var a=``,o=r;o<i;++o){var s=ae[o];a+=String.fromCharCode(s)}return a},ln=(e,t,n)=>{if(n??=2147483647,n<2)return 0;n-=2;for(var r=t,i=n<e.length*2?n/2:e.length,a=0;a<i;++a){var o=e.charCodeAt(a);j[t>>1]=o,t+=2}return j[t>>1]=0,t-r},un=e=>e.length*2,dn=(e,t,n)=>{for(var r=``,i=e>>2,a=0;!(a>=t/4);a++){var o=N[i+a];if(!o&&!n)break;r+=String.fromCodePoint(o)}return r},fn=(e,t,n)=>{if(n??=2147483647,n<4)return 0;for(var r=t,i=r+n-4,a=0;a<e.length;++a){var o=e.codePointAt(a);if(o>65535&&a++,M[t>>2]=o,t+=4,t+4>i)break}return M[t>>2]=0,t-r},pn=e=>{for(var t=0,n=0;n<e.length;++n)e.codePointAt(n)>65535&&n++,t+=4;return t},mn=(e,t,n)=>{n=Ne(n);var r,i,a;t===2?(r=cn,i=ln,a=un):(r=dn,i=fn,a=pn),Le(e,{name:n,fromWireType:e=>{var n=N[e>>2],i=r(e+4,n*t,!0);return Hn(e),i},toWireType:(e,r)=>{typeof r!=`string`&&Fe(`Cannot pass non-string to C++ string type ${n}`);var o=a(r),s=Un(4+o+t);return N[s>>2]=o/t,i(r,s+4,o+t),e!==null&&e.push(Hn,s),s},readValueFromPointer:Te,destructorFunction(e){Hn(e)}})},hn=(e,t,n,r,i,a)=>{Ce[e]={name:Ne(t),rawConstructor:Tt(n,r),rawDestructor:Tt(i,a),fields:[]}},gn=(e,t,n,r,i,a,o,s,c,l)=>{Ce[e].fields.push({fieldName:Ne(t),getterReturnType:n,getter:Tt(r,i),getterContext:a,setterArgumentType:o,setter:Tt(s,c),setterContext:l})},_n=(e,t)=>{t=Ne(t),Le(e,{isVoid:!0,name:t,fromWireType:()=>void 0,toWireType:(e,t)=>void 0})},vn=[],yn=e=>{var t=vn.length;return vn.push(e),t},bn=(e,t)=>{var n=De[e];return n===void 0&&Fe(`${t} has unknown type ${Dt(e)}`),n},xn=(e,t)=>{for(var n=Array(e),r=0;r<e;++r)n[r]=bn(N[t+r*4>>2],`parameter ${r}`);return n},Sn=(e,t,n)=>{var r=[],i=e(r,n);return r.length&&(N[t>>2]=zt.toHandle(r)),i},Cn={},wn=e=>{var t=Cn[e];return t===void 0?Ne(e):t},Tn=(e,t,n)=>{var[r,...i]=xn(e,t),a=r.toWireType.bind(r),o=i.map(e=>e.readValueFromPointer.bind(e));e--;var s=Array(e);return yn(Ze(`methodCaller<(${i.map(e=>e.name)}) => ${r.name}>`,(t,r,i,c)=>{for(var l=0,u=0;u<e;++u)s[u]=o[u](c+l),l+=8;var d;switch(n){case 0:d=zt.toValue(t).apply(null,s);break;case 2:d=Reflect.construct(zt.toValue(t),s);break;case 3:d=s[0];break;case 1:d=zt.toValue(t)[wn(r)](...s);break}return Sn(a,i,d)}))},En=e=>e?(e=wn(e),zt.toHandle(globalThis[e])):zt.toHandle(globalThis),Dn=e=>{e>9&&(Lt[e+1]+=1)},On=(e,t,n,r,i)=>vn[e](t,n,r,i),kn=e=>{we(zt.toValue(e)),Rt(e)},An=(e,t,n,r)=>{var i=new Date().getFullYear(),a=new Date(i,0,1),o=new Date(i,6,1),s=a.getTimezoneOffset(),c=o.getTimezoneOffset(),l=Math.max(s,c);N[e>>2]=l*60,M[t>>2]=Number(s!=c);var u=e=>{var t=e>=0?`-`:`+`,n=Math.abs(e);return`UTC${t}${String(Math.floor(n/60)).padStart(2,`0`)}${String(n%60).padStart(2,`0`)}`},d=u(s),f=u(c);c<s?($t(d,n,17),$t(f,r,17)):($t(d,r,17),$t(f,n,17))},jn=()=>2147483648,Mn=(e,t)=>Math.ceil(e/t)*t,Nn=e=>{var t=(e-tr.buffer.byteLength+65535)/65536|0;try{return tr.grow(t),b(),1}catch{}},Pn=e=>{var t=oe.length;e>>>=0;var n=jn();if(e>n)return!1;for(var r=1;r<=4;r*=2){var i=t*(1+.2/r);if(i=Math.min(i,e+100663296),Nn(Math.min(n,Mn(Math.max(e,i),65536))))return!0}return!1},Fn={},In=()=>c||`./this.program`,Ln=()=>{if(!Ln.strings){var e={USER:`web_user`,LOGNAME:`web_user`,PATH:`/`,PWD:`/`,HOME:`/home/web_user`,LANG:(globalThis.navigator?.language??`C`).replace(`-`,`_`)+`.UTF-8`,_:In()};for(var t in Fn)Fn[t]===void 0?delete e[t]:e[t]=Fn[t];var n=[];for(var t in e)n.push(`${t}=${e[t]}`);Ln.strings=n}return Ln.strings},Rn=(e,t)=>{var n=0,r=0;for(var i of Ln()){var a=t+n;N[e+r>>2]=a,n+=$t(i,a,1/0)+1,r+=4}return 0},zn=(e,t)=>{var n=Ln();N[e>>2]=n.length;var r=0;for(var i of n)r+=en(i)+1;return N[t>>2]=r,0},Bn=e=>e;if(Ye(),gt(),i.noExitRuntime&&i.noExitRuntime,i.print&&i.print,i.printErr&&(m=i.printErr),i.wasmBinary&&(h=i.wasmBinary),i.arguments&&i.arguments,i.thisProgram&&(c=i.thisProgram),i.preInit)for(typeof i.preInit==`function`&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.shift()();var Vn,Hn,Un,Wn,Gn,Kn,qn,Jn,Yn,Xn,Zn,Qn,$n,er,tr,nr;function rr(e){Vn=e.za,Hn=i._free=e.Aa,Un=i._malloc=e.Ca,Wn=e.Da,Gn=e.Ea,Kn=e.Fa,qn=e.Ga,Jn=e.Ha,Yn=e.Ia,Xn=e.Ja,Zn=e.Ka,yt.viijii=e.La,Qn=yt.viijjijjjjjj=e.Ma,$n=yt.iiijj=e.Na,er=yt.jiiii=e.Oa,yt.iiiiij=e.Pa,yt.iiiiijj=e.Qa,yt.iiiiiijj=e.Ra,tr=e.xa,nr=e.Ba}var ir={q:pe,x:L,a:ve,i:ye,m:be,S:xe,p:Se,fa:R,d:z,ba:B,ua:V,aa:Me,oa:Re,sa:kt,ra:Nt,H:Ft,ma:Vt,X:Ut,Y:Wt,A:Kt,qa:Jt,u:Yt,ta:Zt,na:on,T:mn,I:hn,va:gn,pa:_n,O:Tn,wa:Rt,F:En,U:Dn,N:On,ha:kn,ca:An,ga:Pn,da:Rn,ea:zn,ka:Tr,M:Or,B:Pr,P:fr,V:Ir,s:Lr,b:sr,C:Dr,ia:Mr,c:lr,Q:Nr,h:dr,j:vr,r:yr,R:Er,t:xr,G:Sr,D:Cr,K:Rr,_:Vr,Z:Hr,f:pr,l:ar,e:cr,W:kr,g:ur,L:Fr,k:or,ja:Ar,o:br,y:hr,v:wr,E:_r,w:jr,n:mr,J:zr,la:gr,$:Br,z:Bn};function ar(e,t){var n=I();try{St(e)(t)}catch(e){if(F(n),e!==e+0)throw e;Gn(1,0)}}function or(e,t,n,r,i){var a=I();try{St(e)(t,n,r,i)}catch(e){if(F(a),e!==e+0)throw e;Gn(1,0)}}function sr(e,t){var n=I();try{return St(e)(t)}catch(e){if(F(n),e!==e+0)throw e;Gn(1,0)}}function cr(e,t,n){var r=I();try{St(e)(t,n)}catch(e){if(F(r),e!==e+0)throw e;Gn(1,0)}}function lr(e,t,n){var r=I();try{return St(e)(t,n)}catch(e){if(F(r),e!==e+0)throw e;Gn(1,0)}}function ur(e,t,n,r){var i=I();try{St(e)(t,n,r)}catch(e){if(F(i),e!==e+0)throw e;Gn(1,0)}}function dr(e,t,n,r){var i=I();try{return St(e)(t,n,r)}catch(e){if(F(i),e!==e+0)throw e;Gn(1,0)}}function fr(e,t,n,r,i,a){var o=I();try{return St(e)(t,n,r,i,a)}catch(e){if(F(o),e!==e+0)throw e;Gn(1,0)}}function pr(e){var t=I();try{St(e)()}catch(e){if(F(t),e!==e+0)throw e;Gn(1,0)}}function mr(e,t,n,r,i,a,o,s,c,l,u){var d=I();try{St(e)(t,n,r,i,a,o,s,c,l,u)}catch(e){if(F(d),e!==e+0)throw e;Gn(1,0)}}function hr(e,t,n,r,i,a,o){var s=I();try{St(e)(t,n,r,i,a,o)}catch(e){if(F(s),e!==e+0)throw e;Gn(1,0)}}function gr(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g){var _=I();try{St(e)(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g)}catch(e){if(F(_),e!==e+0)throw e;Gn(1,0)}}function _r(e,t,n,r,i,a,o,s,c){var l=I();try{St(e)(t,n,r,i,a,o,s,c)}catch(e){if(F(l),e!==e+0)throw e;Gn(1,0)}}function vr(e,t,n,r,i){var a=I();try{return St(e)(t,n,r,i)}catch(e){if(F(a),e!==e+0)throw e;Gn(1,0)}}function yr(e,t,n,r,i,a){var o=I();try{return St(e)(t,n,r,i,a)}catch(e){if(F(o),e!==e+0)throw e;Gn(1,0)}}function br(e,t,n,r,i,a){var o=I();try{St(e)(t,n,r,i,a)}catch(e){if(F(o),e!==e+0)throw e;Gn(1,0)}}function xr(e,t,n,r,i,a,o){var s=I();try{return St(e)(t,n,r,i,a,o)}catch(e){if(F(s),e!==e+0)throw e;Gn(1,0)}}function Sr(e,t,n,r,i,a,o,s){var c=I();try{return St(e)(t,n,r,i,a,o,s)}catch(e){if(F(c),e!==e+0)throw e;Gn(1,0)}}function Cr(e,t,n,r,i,a,o,s,c){var l=I();try{return St(e)(t,n,r,i,a,o,s,c)}catch(e){if(F(l),e!==e+0)throw e;Gn(1,0)}}function wr(e,t,n,r,i,a,o,s){var c=I();try{St(e)(t,n,r,i,a,o,s)}catch(e){if(F(c),e!==e+0)throw e;Gn(1,0)}}function Tr(e,t,n){var r=I();try{return St(e)(t,n)}catch(e){if(F(r),e!==e+0)throw e;Gn(1,0)}}function Er(e,t,n,r,i,a,o){var s=I();try{return St(e)(t,n,r,i,a,o)}catch(e){if(F(s),e!==e+0)throw e;Gn(1,0)}}function Dr(e,t,n,r){var i=I();try{return St(e)(t,n,r)}catch(e){if(F(i),e!==e+0)throw e;Gn(1,0)}}function Or(e,t,n,r){var i=I();try{return St(e)(t,n,r)}catch(e){if(F(i),e!==e+0)throw e;Gn(1,0)}}function kr(e,t,n,r,i,a,o,s,c){var l=I();try{St(e)(t,n,r,i,a,o,s,c)}catch(e){if(F(l),e!==e+0)throw e;Gn(1,0)}}function Ar(e,t,n,r,i,a,o,s){var c=I();try{St(e)(t,n,r,i,a,o,s)}catch(e){if(F(c),e!==e+0)throw e;Gn(1,0)}}function jr(e,t,n,r,i,a,o,s,c,l){var u=I();try{St(e)(t,n,r,i,a,o,s,c,l)}catch(e){if(F(u),e!==e+0)throw e;Gn(1,0)}}function Mr(e,t,n){var r=I();try{return St(e)(t,n)}catch(e){if(F(r),e!==e+0)throw e;Gn(1,0)}}function Nr(e,t,n,r,i){var a=I();try{return St(e)(t,n,r,i)}catch(e){if(F(a),e!==e+0)throw e;Gn(1,0)}}function Pr(e,t,n,r,i,a){var o=I();try{return St(e)(t,n,r,i,a)}catch(e){if(F(o),e!==e+0)throw e;Gn(1,0)}}function Fr(e,t,n,r,i,a,o){var s=I();try{St(e)(t,n,r,i,a,o)}catch(e){if(F(s),e!==e+0)throw e;Gn(1,0)}}function Ir(e,t,n,r){var i=I();try{return St(e)(t,n,r)}catch(e){if(F(i),e!==e+0)throw e;Gn(1,0)}}function Lr(e){var t=I();try{return St(e)()}catch(e){if(F(t),e!==e+0)throw e;Gn(1,0)}}function Rr(e,t,n,r,i,a,o,s,c,l,u,d){var f=I();try{return St(e)(t,n,r,i,a,o,s,c,l,u,d)}catch(e){if(F(f),e!==e+0)throw e;Gn(1,0)}}function zr(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){var g=I();try{St(e)(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h)}catch(e){if(F(g),e!==e+0)throw e;Gn(1,0)}}function Br(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y){var b=I();try{Qn(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y)}catch(e){if(F(b),e!==e+0)throw e;Gn(1,0)}}function Vr(e,t,n,r,i,a,o){var s=I();try{return $n(e,t,n,r,i,a,o)}catch(e){if(F(s),e!==e+0)throw e;Gn(1,0)}}function Hr(e,t,n,r,i){var a=I();try{return er(e,t,n,r,i)}catch(e){if(F(a),e!==e+0)throw e;Gn(1,0)}}function Ur(){x();function e(){var e,t;i.calledRun=!0,!g&&(S(),(e=_)==null||e(i),(t=i.onRuntimeInitialized)==null||t.call(i),C())}i.setStatus?(i.setStatus(`Running...`),setTimeout(()=>{setTimeout(()=>i.setStatus(``),1),e()},1)):e()}var Wr=await A();return Ur(),t=y?i:new Promise((e,t)=>{_=e,v=t}),t}function hG(e){return dG(mG,e)}async function gG(e,t){return pG(mG,e,t)}var _G=[[`aztec`,`Aztec`],[`aztec_code`,`AztecCode`],[`aztec_rune`,`AztecRune`],[`code_128`,`Code128`],[`code_39`,`Code39`],[`code_39_standard`,`Code39Std`],[`code_39_extended`,`Code39Ext`],[`code_32`,`Code32`],[`pzn`,`PZN`],[`code_93`,`Code93`],[`codabar`,`Codabar`],[`databar`,`DataBar`],[`databar_omni`,`DataBarOmni`],[`databar_stacked`,`DataBarStk`],[`databar_stacked_omni`,`DataBarStkOmni`],[`databar_expanded`,`DataBarExp`],[`databar_expanded_stacked`,`DataBarExpStk`],[`databar_limited`,`DataBarLtd`],[`data_matrix`,`DataMatrix`],[`dx_film_edge`,`DXFilmEdge`],[`ean_13`,`EAN13`],[`ean_upc`,`EANUPC`],[`isbn`,`ISBN`],[`ean_8`,`EAN8`],[`itf`,`ITF`],[`itf_14`,`ITF14`],[`maxi_code`,`MaxiCode`],[`micro_qr_code`,`MicroQRCode`],[`pdf417`,`PDF417`],[`compact_pdf417`,`CompactPDF417`],[`micro_pdf417`,`MicroPDF417`],[`qr_code`,`QRCode`],[`qr_code_model_1`,`QRCodeModel1`],[`qr_code_model_2`,`QRCodeModel2`],[`rm_qr_code`,`RMQRCode`],[`upc_a`,`UPCA`],[`upc_e`,`UPCE`],[`telepen`,`Telepen`],[`telepen_alpha`,`TelepenAlpha`],[`telepen_numeric`,`TelepenNumeric`],[`other_barcode`,`OtherBarcode`],[`linear_codes`,`AllLinear`],[`matrix_codes`,`AllMatrix`],[`gs1_codes`,`AllGS1`],[`retail_codes`,`AllRetail`],[`industrial_codes`,`AllIndustrial`],[`any`,`All`]],vG=[..._G,[`unknown`]].map(e=>e[0]),yG=new Map(_G);function bG(e){for(let[t,n]of yG)if(e===n)return t;return`unknown`}function xG(e){if(SG(e))return{width:e.naturalWidth,height:e.naturalHeight};if(CG(e))return{width:e.width.baseVal.value,height:e.height.baseVal.value};if(wG(e))return{width:e.videoWidth,height:e.videoHeight};if(EG(e))return{width:e.width,height:e.height};if(OG(e))return{width:e.displayWidth,height:e.displayHeight};if(TG(e)||DG(e))return{width:e.width,height:e.height};throw TypeError(`The provided value is not of type '(Blob or HTMLCanvasElement or HTMLImageElement or HTMLVideoElement or ImageBitmap or ImageData or OffscreenCanvas or SVGImageElement or VideoFrame)'.`)}function SG(e){try{var t;return e instanceof(e==null||(t=e.ownerDocument)==null||(t=t.defaultView)==null?void 0:t.HTMLImageElement)}catch{return!1}}function CG(e){try{var t;return e instanceof(e==null||(t=e.ownerDocument)==null||(t=t.defaultView)==null?void 0:t.SVGImageElement)}catch{return!1}}function wG(e){try{var t;return e instanceof(e==null||(t=e.ownerDocument)==null||(t=t.defaultView)==null?void 0:t.HTMLVideoElement)}catch{return!1}}function TG(e){try{var t;return e instanceof(e==null||(t=e.ownerDocument)==null||(t=t.defaultView)==null?void 0:t.HTMLCanvasElement)}catch{return!1}}function EG(e){try{return e instanceof ImageBitmap||Object.prototype.toString.call(e)===`[object ImageBitmap]`}catch{return!1}}function DG(e){try{return e instanceof OffscreenCanvas||Object.prototype.toString.call(e)===`[object OffscreenCanvas]`}catch{return!1}}function OG(e){try{return e instanceof VideoFrame||Object.prototype.toString.call(e)===`[object VideoFrame]`}catch{return!1}}function kG(e){try{return e instanceof Blob||Object.prototype.toString.call(e)===`[object Blob]`}catch{return!1}}function AG(e){try{return e instanceof ImageData||Object.prototype.toString.call(e)===`[object ImageData]`}catch{return!1}}function jG(e,t){try{let n=new OffscreenCanvas(e,t);if(n.getContext(`2d`)instanceof OffscreenCanvasRenderingContext2D)return n;throw void 0}catch{let n=document.createElement(`canvas`);return n.width=e,n.height=t,n}}async function MG(e){if(SG(e)&&!await IG(e))throw new DOMException(`Failed to load or decode HTMLImageElement.`,`InvalidStateError`);if(CG(e)&&!await LG(e))throw new DOMException(`Failed to load or decode SVGImageElement.`,`InvalidStateError`);if(OG(e)&&RG(e))throw new DOMException(`VideoFrame is closed.`,`InvalidStateError`);if(wG(e)&&(e.readyState===0||e.readyState===1))throw new DOMException(`Invalid element or state.`,`InvalidStateError`);if(EG(e)&&BG(e))throw new DOMException(`The image source is detached.`,`InvalidStateError`);let{width:t,height:n}=xG(e);if(t===0||n===0)return null;let r=jG(t,n).getContext(`2d`);r.drawImage(e,0,0);try{return r.getImageData(0,0,t,n)}catch{throw new DOMException(`Source would taint origin.`,`SecurityError`)}}async function NG(e){let t;try{t=await createImageBitmap(e)}catch{try{if(globalThis.Image){t=new Image;let n=``;try{n=URL.createObjectURL(e),t.src=n,await t.decode()}finally{URL.revokeObjectURL(n)}}else return e}catch{throw new DOMException(`Failed to load or decode Blob.`,`InvalidStateError`)}}return await MG(t)}function PG(e){let{width:t,height:n}=e;if(t===0||n===0)return null;let r=e.getContext(`2d`);try{return r.getImageData(0,0,t,n)}catch{throw new DOMException(`Source would taint origin.`,`SecurityError`)}}async function FG(e){if(kG(e))return await NG(e);if(AG(e)){if(zG(e))throw new DOMException(`The image data has been detached.`,`InvalidStateError`);return e}return TG(e)||DG(e)?PG(e):await MG(e)}async function IG(e){try{return await e.decode(),!0}catch{return!1}}async function LG(e){try{return await e.decode?.call(e),!0}catch{return!1}}function RG(e){return e.format===null}function zG(e){return e.data.buffer.byteLength===0}function BG(e){return e.width===0&&e.height===0}function VG(e,t){return HG(e)?new DOMException(`${t}: ${e.message}`,e.name):UG(e)?new e.constructor(`${t}: ${e.message}`):Error(`${t}: ${e}`)}function HG(e){return e instanceof DOMException||Object.prototype.toString.call(e)===`[object DOMException]`}function UG(e){return e instanceof Error||Object.prototype.toString.call(e)===`[object Error]`}function WG(e,t){if(t.has(e))throw TypeError(`Cannot initialize the same private elements twice on an object`)}function GG(e,t,n){WG(e,t),t.set(e,n)}function KG(e,t,n){if(typeof e==`function`?e===t:e.has(t))return arguments.length<3?t:n;throw TypeError(`Private element is not present on this object`)}function qG(e,t,n){return e.set(KG(e,t),n),n}function JG(e,t){return e.get(KG(e,t))}var YG=new WeakMap,XG=class{constructor(e={}){GG(this,YG,void 0);try{var t;let n=e==null||(t=e.formats)==null?void 0:t.filter(e=>e!==`unknown`);if(n?.length===0)throw TypeError(`Hint option provided, but is empty.`);for(let e of n??[])if(!yG.has(e))throw TypeError(`Failed to read the 'formats' property from 'BarcodeDetectorOptions': The provided value '${e}' is not a valid enum value of type BarcodeFormat.`);qG(YG,this,n??[]),hG({fireImmediately:!0}).catch(()=>{})}catch(e){throw VG(e,`Failed to construct 'BarcodeDetector'`)}}static async getSupportedFormats(){return vG.filter(e=>e!==`unknown`)}async detect(e){try{let t=await FG(e);if(t===null)return[];let n,r={textMode:`Plain`,formats:JG(YG,this).map(e=>yG.get(e))};try{n=await gG(t,r)}catch(e){throw console.error(e),new DOMException(`Barcode detection service unavailable.`,`NotSupportedError`)}return n.map(e=>{let{topLeft:{x:t,y:n},topRight:{x:r,y:i},bottomLeft:{x:a,y:o},bottomRight:{x:s,y:c}}=e.position,l=Math.min(t,r,a,s),u=Math.min(n,i,o,c),d=Math.max(t,r,a,s),f=Math.max(n,i,o,c);return{boundingBox:new DOMRectReadOnly(l,u,d-l,f-u),rawValue:e.text,format:bG(e.format),cornerPoints:[{x:t,y:n},{x:r,y:i},{x:s,y:c},{x:a,y:o}]}})}catch(e){throw VG(e,`Failed to execute 'detect' on 'BarcodeDetector'`)}}},ZG=!0,QG=!0;function $G(e,t,n){let r=e.match(t);return r&&r.length>=n&&parseFloat(r[n],10)}function eK(e,t,n){if(!e.RTCPeerConnection)return;if(!Object.getOwnPropertyDescriptor(EventTarget.prototype,`addEventListener`).writable){rK(`Unable to polyfill events`);return}let r=e.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return i.apply(this,arguments);let a=e=>{let t=n(e);t&&(r.handleEvent?r.handleEvent(t):r(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(r,a),i.apply(this,[e,a])};let a=r.removeEventListener;r.removeEventListener=function(e,n){if(e!==t||!this._eventMap||!this._eventMap[t]||!this._eventMap[t].has(n))return a.apply(this,arguments);let r=this._eventMap[t].get(n);return this._eventMap[t].delete(n),this._eventMap[t].size===0&&delete this._eventMap[t],Object.keys(this._eventMap).length===0&&delete this._eventMap,a.apply(this,[e,r])},Object.defineProperty(r,`on`+t,{get(){return this[`_on`+t]},set(e){this[`_on`+t]&&(this.removeEventListener(t,this[`_on`+t]),delete this[`_on`+t]),e&&this.addEventListener(t,this[`_on`+t]=e)},enumerable:!0,configurable:!0})}function tK(e){return typeof e==`boolean`?(ZG=e,e?`adapter.js logging disabled`:`adapter.js logging enabled`):Error(`Argument type: `+typeof e+`. Please use a boolean.`)}function nK(e){return typeof e==`boolean`?(QG=!e,`adapter.js deprecation warnings `+(e?`disabled`:`enabled`)):Error(`Argument type: `+typeof e+`. Please use a boolean.`)}function rK(){if(typeof window==`object`){if(ZG)return;typeof console<`u`&&typeof console.log==`function`&&console.log.apply(console,arguments)}}function iK(e,t){QG&&console.warn(e+` is deprecated, please use `+t+` instead.`)}function aK(e){let t={browser:null,version:null};if(e===void 0||!e.navigator||!e.navigator.userAgent)return t.browser=`Not a browser.`,t;let{navigator:n}=e;if(n.userAgentData&&n.userAgentData.brands){let e=n.userAgentData.brands.find(e=>e.brand===`Chromium`);if(e){let t=parseInt(e.version,10);if(t>=90)return{browser:`chrome`,version:t}}}if(n.mozGetUserMedia)t.browser=`firefox`,t.version=parseInt($G(n.userAgent,/Firefox\/(\d+)\./,1));else if(n.webkitGetUserMedia||e.isSecureContext===!1&&e.webkitRTCPeerConnection)t.browser=`chrome`,t.version=parseInt($G(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2))||null;else if(e.RTCPeerConnection&&n.userAgent.match(/AppleWebKit\/(\d+)\./))t.browser=`safari`,t.version=parseInt($G(n.userAgent,/AppleWebKit\/(\d+)\./,1)),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&`currentDirection`in e.RTCRtpTransceiver.prototype,t._safariVersion=$G(n.userAgent,/Version\/(\d+(\.?\d+))/,1);else return t.browser=`Not a supported browser.`,t;return t}function oK(e){return Object.prototype.toString.call(e)===`[object Object]`}function sK(e){return oK(e)?Object.keys(e).reduce(function(t,n){let r=oK(e[n]),i=r?sK(e[n]):e[n],a=r&&!Object.keys(i).length;return i===void 0||a?t:Object.assign(t,{[n]:i})},{}):e}function cK(e,t,n){!t||n.has(t.id)||(n.set(t.id,t),Object.keys(t).forEach(r=>{r.endsWith(`Id`)?cK(e,e.get(t[r]),n):r.endsWith(`Ids`)&&t[r].forEach(t=>{cK(e,e.get(t),n)})}))}function lK(e,t,n){let r=n?`outbound-rtp`:`inbound-rtp`,i=new Map;if(t===null)return i;let a=[];return e.forEach(e=>{e.type===`track`&&e.trackIdentifier===t.id&&a.push(e)}),a.forEach(t=>{e.forEach(n=>{n.type===r&&n.trackId===t.id&&cK(e,n,i)})}),i}var uK=rK;function dK(e,t){if(t.version>=64)return;let n=e&&e.navigator;if(!n.mediaDevices)return;let r=function(e){if(typeof e!=`object`||e.mandatory||e.optional)return e;let t={};return Object.keys(e).forEach(n=>{if(n===`require`||n===`advanced`||n===`mediaSource`)return;let r=typeof e[n]==`object`?e[n]:{ideal:e[n]};r.exact!==void 0&&typeof r.exact==`number`&&(r.min=r.max=r.exact);let i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):t===`deviceId`?`sourceId`:t};if(r.ideal!==void 0){t.optional=t.optional||[];let e={};typeof r.ideal==`number`?(e[i(`min`,n)]=r.ideal,t.optional.push(e),e={},e[i(`max`,n)]=r.ideal,t.optional.push(e)):(e[i(``,n)]=r.ideal,t.optional.push(e))}r.exact!==void 0&&typeof r.exact!=`number`?(t.mandatory=t.mandatory||{},t.mandatory[i(``,n)]=r.exact):[`min`,`max`].forEach(e=>{r[e]!==void 0&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,n)]=r[e])})}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if(e=JSON.parse(JSON.stringify(e)),e&&typeof e.audio==`object`){let t=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])};e=JSON.parse(JSON.stringify(e)),t(e.audio,`autoGainControl`,`googAutoGainControl`),t(e.audio,`noiseSuppression`,`googNoiseSuppression`),e.audio=r(e.audio)}if(e&&typeof e.video==`object`){let a=e.video.facingMode;a&&=typeof a==`object`?a:{ideal:a};let o=t.version<66;if(a&&(a.exact===`user`||a.exact===`environment`||a.ideal===`user`||a.ideal===`environment`)&&!(n.mediaDevices.getSupportedConstraints&&n.mediaDevices.getSupportedConstraints().facingMode&&!o)){delete e.video.facingMode;let t;if(a.exact===`environment`||a.ideal===`environment`?t=[`back`,`rear`]:(a.exact===`user`||a.ideal===`user`)&&(t=[`front`]),t)return n.mediaDevices.enumerateDevices().then(n=>{n=n.filter(e=>e.kind===`videoinput`);let o=n.find(e=>t.some(t=>e.label.toLowerCase().includes(t)));return!o&&n.length&&t.includes(`back`)&&(o=n[n.length-1]),o&&(e.video.deviceId=a.exact?{exact:o.deviceId}:{ideal:o.deviceId}),e.video=r(e.video),uK(`chrome: `+JSON.stringify(e)),i(e)})}e.video=r(e.video)}return uK(`chrome: `+JSON.stringify(e)),i(e)},a=function(e){return t.version>=64?e:{name:{PermissionDeniedError:`NotAllowedError`,PermissionDismissedError:`NotAllowedError`,InvalidStateError:`NotAllowedError`,DevicesNotFoundError:`NotFoundError`,ConstraintNotSatisfiedError:`OverconstrainedError`,TrackStartError:`NotReadableError`,MediaDeviceFailedDueToShutdown:`NotAllowedError`,MediaDeviceKillSwitchOn:`NotAllowedError`,TabCaptureError:`AbortError`,ScreenCaptureError:`AbortError`,DeviceCaptureError:`AbortError`}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&`: `)+this.message}}};if(n.getUserMedia=function(e,t,r){i(e,e=>{n.webkitGetUserMedia(e,t,e=>{r&&r(a(e))})})}.bind(n),n.mediaDevices.getUserMedia){let e=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(t){return i(t,t=>e(t).then(e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach(e=>{e.stop()}),new DOMException(``,`NotFoundError`);return e},e=>Promise.reject(a(e))))}}}var fK=s({fixNegotiationNeeded:()=>bK,shimAddTrackRemoveTrack:()=>vK,shimAddTrackRemoveTrackWithNative:()=>_K,shimGetSendersWithDtmf:()=>hK,shimGetUserMedia:()=>dK,shimMediaStream:()=>pK,shimOnTrack:()=>mK,shimPeerConnection:()=>yK,shimSenderReceiverGetStats:()=>gK});function pK(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function mK(e,t){if(!(t.version>102))if(typeof e==`object`&&e.RTCPeerConnection&&!(`ontrack`in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener(`track`,this._ontrack),this.addEventListener(`track`,this._ontrack=e)},enumerable:!0,configurable:!0});let t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener(`addtrack`,n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.track.id):{track:n.track};let i=new Event(`track`);i.track=n.track,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)}),t.stream.getTracks().forEach(n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.id):{track:n};let i=new Event(`track`);i.track=n,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)})},this.addEventListener(`addstream`,this._ontrackpoly)),t.apply(this,arguments)}}else eK(e,`track`,e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function hK(e){if(typeof e==`object`&&e.RTCPeerConnection&&!(`getSenders`in e.RTCPeerConnection.prototype)&&`createDTMFSender`in e.RTCPeerConnection.prototype){let t=function(e,t){return{track:t,get dtmf(){return this._dtmf===void 0&&(t.kind===`audio`?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};let n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){let i=n.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};let r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){r.apply(this,arguments);let t=this._senders.indexOf(e);t!==-1&&this._senders.splice(t,1)}}let n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach(e=>{this._senders.push(t(this,e))})};let r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach(e=>{let t=this._senders.find(t=>t.track===e);t&&this._senders.splice(this._senders.indexOf(t),1)})}}else if(typeof e==`object`&&e.RTCPeerConnection&&`getSenders`in e.RTCPeerConnection.prototype&&`createDTMFSender`in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!(`dtmf`in e.RTCRtpSender.prototype)){let t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind===`audio`?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function gK(e,t){if(t.version>=67||!(typeof e==`object`&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!(`getStats`in e.RTCRtpSender.prototype)){let t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});let n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){let e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){let e=this;return this._pc.getStats().then(t=>lK(t,e.track,!0))}}if(!(`getStats`in e.RTCRtpReceiver.prototype)){let t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),eK(e,`track`,e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){let e=this;return this._pc.getStats().then(t=>lK(t,e.track,!1))}}if(!(`getStats`in e.RTCRtpSender.prototype&&`getStats`in e.RTCRtpReceiver.prototype))return;let n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){let e=arguments[0],t,n,r;return this.getSenders().forEach(n=>{n.track===e&&(t?r=!0:t=n)}),this.getReceivers().forEach(t=>(t.track===e&&(n?r=!0:n=t),t.track===e)),r||t&&n?Promise.reject(new DOMException(`There are more than one sender or receiver for the track.`,`InvalidAccessError`)):t?t.getStats():n?n.getStats():Promise.reject(new DOMException(`There is no sender or receiver for the track.`,`InvalidAccessError`))}return n.apply(this,arguments)}}function _K(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(e=>this._shimmedLocalStreams[e][0])};let t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){if(!n)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};let r=t.apply(this,arguments);return this._shimmedLocalStreams[n.id]?this._shimmedLocalStreams[n.id].indexOf(r)===-1&&this._shimmedLocalStreams[n.id].push(r):this._shimmedLocalStreams[n.id]=[n,r],r};let n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException(`Track already exists.`,`InvalidAccessError`)});let t=this.getSenders();n.apply(this,arguments);let r=this.getSenders().filter(e=>t.indexOf(e)===-1);this._shimmedLocalStreams[e.id]=[e].concat(r)};let r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],r.apply(this,arguments)};let i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach(t=>{let n=this._shimmedLocalStreams[t].indexOf(e);n!==-1&&this._shimmedLocalStreams[t].splice(n,1),this._shimmedLocalStreams[t].length===1&&delete this._shimmedLocalStreams[t]}),i.apply(this,arguments)}}function vK(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return _K(e);let n=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){let e=n.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map(e=>this._reverseStreams[e.id])};let r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException(`Track already exists.`,`InvalidAccessError`)}),!this._reverseStreams[t.id]){let n=new e.MediaStream(t.getTracks());this._streams[t.id]=n,this._reverseStreams[n.id]=t,t=n}r.apply(this,[t])};let i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,n){if(this.signalingState===`closed`)throw new DOMException(`The RTCPeerConnection's signalingState is 'closed'.`,`InvalidStateError`);let r=[].slice.call(arguments,1);if(r.length!==1||!r[0].getTracks().find(e=>e===t))throw new DOMException(`The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.`,`NotSupportedError`);if(this.getSenders().find(e=>e.track===t))throw new DOMException(`Track already exists.`,`InvalidAccessError`);this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};let i=this._streams[n.id];if(i)i.addTrack(t),Promise.resolve().then(()=>{this.dispatchEvent(new Event(`negotiationneeded`))});else{let r=new e.MediaStream([t]);this._streams[n.id]=r,this._reverseStreams[r.id]=n,this.addStream(r)}return this.getSenders().find(e=>e.track===t)};function a(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{let r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(i.id,`g`),r.id)}),new RTCSessionDescription({type:t.type,sdp:n})}function o(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{let r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(r.id,`g`),i.id)}),new RTCSessionDescription({type:t.type,sdp:n})}[`createOffer`,`createAnswer`].forEach(function(t){let n=e.RTCPeerConnection.prototype[t],r={[t](){let e=arguments;return arguments.length&&typeof arguments[0]==`function`?n.apply(this,[t=>{let n=a(this,t);e[0].apply(null,[n])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):n.apply(this,arguments).then(e=>a(this,e))}};e.RTCPeerConnection.prototype[t]=r[t]});let s=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type||(arguments[0]=o(this,arguments[0])),s.apply(this,arguments)};let c=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,`localDescription`);Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){let e=c.get.apply(this);return e.type===``?e:a(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if(this.signalingState===`closed`)throw new DOMException(`The RTCPeerConnection's signalingState is 'closed'.`,`InvalidStateError`);if(!e._pc)throw new DOMException(`Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.`,`TypeError`);if(e._pc!==this)throw new DOMException(`Sender was not created by this connection.`,`InvalidAccessError`);this._streams=this._streams||{};let t;Object.keys(this._streams).forEach(n=>{this._streams[n].getTracks().find(t=>e.track===t)&&(t=this._streams[n])}),t&&(t.getTracks().length===1?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event(`negotiationneeded`)))}}function yK(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&[`setLocalDescription`,`setRemoteDescription`,`addIceCandidate`].forEach(function(t){let n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new(t===`addIceCandidate`?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]})}function bK(e,t){t.version>102||eK(e,`negotiationneeded`,e=>{let n=e.target;if(!((t.version<72||n.getConfiguration&&n.getConfiguration().sdpSemantics===`plan-b`)&&n.signalingState!==`stable`))return e})}function xK(e,t){let n=e&&e.navigator;if(!n.mediaDevices)return;let r=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,r){iK(`navigator.getUserMedia`,`navigator.mediaDevices.getUserMedia`),n.mediaDevices.getUserMedia(e).then(t,r)},!(t.version>55&&`autoGainControl`in n.mediaDevices.getSupportedConstraints())){let e=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])},t=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(n){return typeof n==`object`&&typeof n.audio==`object`&&(n=JSON.parse(JSON.stringify(n)),e(n.audio,`autoGainControl`,`mozAutoGainControl`),e(n.audio,`noiseSuppression`,`mozNoiseSuppression`)),t(n)},r&&r.prototype.getSettings){let t=r.prototype.getSettings;r.prototype.getSettings=function(){let n=t.apply(this,arguments);return e(n,`mozAutoGainControl`,`autoGainControl`),e(n,`mozNoiseSuppression`,`noiseSuppression`),n}}if(r&&r.prototype.applyConstraints){let t=r.prototype.applyConstraints;r.prototype.applyConstraints=function(n){return this.kind===`audio`&&typeof n==`object`&&(n=JSON.parse(JSON.stringify(n)),e(n,`autoGainControl`,`mozAutoGainControl`),e(n,`noiseSuppression`,`mozNoiseSuppression`)),t.apply(this,[n])}}}}function SK(e,t){e.navigator.mediaDevices&&(e.navigator.mediaDevices&&`getDisplayMedia`in e.navigator.mediaDevices||(e.navigator.mediaDevices.getDisplayMedia=function(n){if(!(n&&n.video)){let e=new DOMException(`getDisplayMedia without video constraints is undefined`);return e.name=`NotFoundError`,e.code=8,Promise.reject(e)}return n.video===!0?n.video={mediaSource:t}:n.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(n)}))}var CK=s({shimAddTransceiver:()=>jK,shimCreateAnswer:()=>PK,shimCreateOffer:()=>NK,shimGetDisplayMedia:()=>SK,shimGetParameters:()=>MK,shimGetStats:()=>EK,shimGetUserMedia:()=>xK,shimOnTrack:()=>wK,shimPeerConnection:()=>TK,shimRTCDataChannel:()=>AK,shimReceiverGetStats:()=>OK,shimRemoveStream:()=>kK,shimSenderGetStats:()=>DK});function wK(e){typeof e==`object`&&e.RTCTrackEvent&&`receiver`in e.RTCTrackEvent.prototype&&!(`transceiver`in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function TK(e,t){typeof e!=`object`||!(e.RTCPeerConnection||e.mozRTCPeerConnection)||(!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&[`setLocalDescription`,`setRemoteDescription`,`addIceCandidate`].forEach(function(t){let n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new(t===`addIceCandidate`?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]}))}function EK(e,t){if(typeof e!=`object`||!(e.RTCPeerConnection||e.mozRTCPeerConnection)||t.version>=151)return;let n={inboundrtp:`inbound-rtp`,outboundrtp:`outbound-rtp`,candidatepair:`candidate-pair`,localcandidate:`local-candidate`,remotecandidate:`remote-candidate`},r=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){let[e,i,a]=arguments;return this.signalingState===`closed`?Promise.resolve(new Map):r.apply(this,[e||null]).then(e=>{if(t.version<53&&!i)try{e.forEach(e=>{e.type=n[e.type]||e.type})}catch(t){if(t.name!==`TypeError`)throw t;e.forEach((t,r)=>{e.set(r,Object.assign({},t,{type:n[t.type]||t.type}))})}return e}).then(i,a)}}function DK(e){if(!(typeof e==`object`&&e.RTCPeerConnection&&e.RTCRtpSender)||e.RTCRtpSender&&`getStats`in e.RTCRtpSender.prototype)return;let t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});let n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){let e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function OK(e){if(!(typeof e==`object`&&e.RTCPeerConnection&&e.RTCRtpSender)||e.RTCRtpSender&&`getStats`in e.RTCRtpReceiver.prototype)return;let t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),eK(e,`track`,e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function kK(e){!e.RTCPeerConnection||`removeStream`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){iK(`removeStream`,`removeTrack`),this.getSenders().forEach(t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)})})}function AK(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function jK(e,t){if(!(typeof e==`object`&&e.RTCPeerConnection)||t.version>=110)return;let n=e.RTCPeerConnection.prototype.addTransceiver;n&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let e=arguments[1]&&arguments[1].sendEncodings;e===void 0&&(e=[]),e=[...e];let t=e.length>0;t&&e.forEach(e=>{if(`rid`in e&&!/^[a-z0-9]{0,16}$/i.test(e.rid))throw TypeError(`Invalid RID value provided.`);if(`scaleResolutionDownBy`in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw RangeError(`scale_resolution_down_by must be >= 1.0`);if(`maxFramerate`in e&&!(parseFloat(e.maxFramerate)>=0))throw RangeError(`max_framerate must be >= 0.0`)});let r=n.apply(this,arguments);if(t){let{sender:t}=r,n=t.getParameters();(!(`encodings`in n)||n.encodings.length===1&&Object.keys(n.encodings[0]).length===0)&&(n.encodings=e,t.sendEncodings=e,this.setParametersPromises.push(t.setParameters(n).then(()=>{delete t.sendEncodings}).catch(()=>{delete t.sendEncodings})))}return r})}function MK(e,t){if(!(typeof e==`object`&&e.RTCRtpSender)||t.version>=110)return;let n=e.RTCRtpSender.prototype.getParameters;n&&(e.RTCRtpSender.prototype.getParameters=function(){let e=n.apply(this,arguments);return`encodings`in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function NK(e,t){if(!(typeof e==`object`&&e.RTCPeerConnection)||t.version>=110)return;let n=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>n.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):n.apply(this,arguments)}}function PK(e,t){if(!(typeof e==`object`&&e.RTCPeerConnection)||t.version>=110)return;let n=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>n.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):n.apply(this,arguments)}}var FK=s({shimAudioContext:()=>WK,shimCallbacksAPI:()=>RK,shimConstraints:()=>BK,shimCreateOfferLegacy:()=>UK,shimGetUserMedia:()=>zK,shimLocalStreamsAPI:()=>IK,shimRTCIceServerUrls:()=>VK,shimRemoteStreamsAPI:()=>LK,shimTrackEventTransceiver:()=>HK});function IK(e){if(!(typeof e!=`object`||!e.RTCPeerConnection)){if(`getLocalStreams`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||=[],this._localStreams}),!(`addStream`in e.RTCPeerConnection.prototype)){let t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||=[],this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach(n=>t.call(this,n,e)),e.getVideoTracks().forEach(n=>t.call(this,n,e))},e.RTCPeerConnection.prototype.addTrack=function(e,...n){return n&&n.forEach(e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]}),t.apply(this,arguments)}}`removeStream`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||=[];let t=this._localStreams.indexOf(e);if(t===-1)return;this._localStreams.splice(t,1);let n=e.getTracks();this.getSenders().forEach(e=>{n.includes(e.track)&&this.removeTrack(e)})})}}function LK(e){if(!(typeof e!=`object`||!e.RTCPeerConnection)&&(`getRemoteStreams`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!(`onaddstream`in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener(`addstream`,this._onaddstream),this.removeEventListener(`track`,this._onaddstreampoly)),this.addEventListener(`addstream`,this._onaddstream=e),this.addEventListener(`track`,this._onaddstreampoly=e=>{e.streams.forEach(e=>{if(this._remoteStreams||=[],this._remoteStreams.includes(e))return;this._remoteStreams.push(e);let t=new Event(`addstream`);t.stream=e,this.dispatchEvent(t)})})}});let t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){let e=this;return this._onaddstreampoly||this.addEventListener(`track`,this._onaddstreampoly=function(t){t.streams.forEach(t=>{if(e._remoteStreams||=[],e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);let n=new Event(`addstream`);n.stream=t,e.dispatchEvent(n)})}),t.apply(e,arguments)}}}function RK(e){if(typeof e!=`object`||!e.RTCPeerConnection)return;let t=e.RTCPeerConnection.prototype,n=t.createOffer,r=t.createAnswer,i=t.setLocalDescription,a=t.setRemoteDescription,o=t.addIceCandidate;t.createOffer=function(e,t){let r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){let n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i};let s=function(e,t,n){let r=i.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r};t.setLocalDescription=s,s=function(e,t,n){let r=a.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.setRemoteDescription=s,s=function(e,t,n){let r=o.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.addIceCandidate=s}function zK(e){let t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){let e=t.mediaDevices,n=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>n(BK(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,n,r){t.mediaDevices.getUserMedia(e).then(n,r)}.bind(t))}function BK(e){return e&&e.video!==void 0?Object.assign({},e,{video:sK(e.video)}):e}function VK(e){if(!e.RTCPeerConnection)return;let t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,n){if(e&&e.iceServers){let t=[];for(let n=0;n<e.iceServers.length;n++){let r=e.iceServers[n];r.urls===void 0&&r.url?(iK(`RTCIceServer.url`,`RTCIceServer.urls`),r=JSON.parse(JSON.stringify(r)),r.urls=r.url,delete r.url,t.push(r)):t.push(e.iceServers[n])}e.iceServers=t}return new t(e,n)},e.RTCPeerConnection.prototype=t.prototype,`generateCertificate`in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get(){return t.generateCertificate}})}function HK(e){typeof e==`object`&&e.RTCTrackEvent&&`receiver`in e.RTCTrackEvent.prototype&&!(`transceiver`in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function UK(e){let t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){e.offerToReceiveAudio!==void 0&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);let t=this.getTransceivers().find(e=>e.receiver.track.kind===`audio`);e.offerToReceiveAudio===!1&&t?t.direction===`sendrecv`?t.setDirection?t.setDirection(`sendonly`):t.direction=`sendonly`:t.direction===`recvonly`&&(t.setDirection?t.setDirection(`inactive`):t.direction=`inactive`):e.offerToReceiveAudio===!0&&!t&&this.addTransceiver(`audio`,{direction:`recvonly`}),e.offerToReceiveVideo!==void 0&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);let n=this.getTransceivers().find(e=>e.receiver.track.kind===`video`);e.offerToReceiveVideo===!1&&n?n.direction===`sendrecv`?n.setDirection?n.setDirection(`sendonly`):n.direction=`sendonly`:n.direction===`recvonly`&&(n.setDirection?n.setDirection(`inactive`):n.direction=`inactive`):e.offerToReceiveVideo===!0&&!n&&this.addTransceiver(`video`,{direction:`recvonly`})}return t.apply(this,arguments)}}function WK(e){typeof e!=`object`||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var GK=o(((e,t)=>{var n={};n.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)},n.localCName=n.generateIdentifier(),n.splitLines=function(e){return e.trim().split(`
|
|
281
|
+
`,eW=`${$U} 1s ease-in-out infinite`;function tW(e){return`animationName`in e}function nW(e){let t=e.currentTarget.getAnimations().find(e=>tW(e)&&e.animationName===$U.name);if(t&&typeof t.startTime==`number`)t.startTime-=t.startTime%1e3;else if(t&&typeof t.startTime==`object`&&t.startTime instanceof CSSNumericValue){let e=t.startTime.to(`ms`).value;t.startTime=CSS.ms(e-e%1e3)}}var rW=G(`div`,{shouldForwardProp:e=>e!==`fsize`})(({fsize:e,theme:t})=>{if(!e)return{fontSize:`1.25rem`,fontWeight:`500`};switch(e){case`normal`:return{fontSize:`1rem`,fontWeight:`500`,[t.breakpoints.up(`md`)]:{fontSize:`1.25rem`},[t.breakpoints.up(`lg`)]:{fontSize:`1.5rem`}};case`large`:return{fontSize:`1.5rem`,fontWeight:`500`,[t.breakpoints.up(`lg`)]:{fontSize:`1.75rem`},[t.breakpoints.up(`xl`)]:{fontSize:`2rem`}};case`x-large`:return{fontSize:`1.5rem`,fontWeight:`500`,[t.breakpoints.up(`md`)]:{fontSize:`1.75rem`},[t.breakpoints.up(`lg`)]:{fontSize:`2.75rem`},[t.breakpoints.up(`xl`)]:{fontSize:`3.75rem`}}}}),iW=G(`div`,{shouldForwardProp:e=>e!==`fsize`})(({fsize:e,theme:t})=>{if(!e)return{fontSize:`0.75rem`,fontWeight:`500`};switch(e){case`normal`:return{fontSize:`0.75rem`,fontWeight:`500`,[t.breakpoints.up(`md`)]:{fontSize:`1rem`}};case`large`:return{fontSize:`1rem`,fontWeight:`500`,[t.breakpoints.up(`lg`)]:{fontSize:`1.5rem`},[t.breakpoints.up(`xl`)]:{fontSize:`1.75rem`}};case`x-large`:return{fontSize:`1rem`,fontWeight:`500`,[t.breakpoints.up(`md`)]:{fontSize:`1.5rem`},[t.breakpoints.up(`lg`)]:{fontSize:`2.5rem`},[t.breakpoints.up(`xl`)]:{fontSize:`3.5rem`}}}});function aW({mat:e,displayActionForSinglePallet:t,fsize:n}){let r=R(NO),i=ok(R(br).basketName);switch(e.action.type){case st.Loading:if(e.action.loadFromBasketId){if(e.action.loadOntoPalletNum===null||e.action.loadOntoPalletNum===void 0)return(0,H.jsxs)(iW,{fsize:n,children:[`Load into `,i,` `,e.action.loadFromBasketId]});if(t===void 0)return(0,H.jsxs)(iW,{fsize:n,children:[`Load from `,i,` `,e.action.loadFromBasketId,` to pal`,` `,e.action.loadOntoPalletNum??``]});if(t===e.action.loadOntoPalletNum){let t=e.action.loadOntoFace??0,a=e.action.loadOntoPalletNum?r.pallets[e.action.loadOntoPalletNum]?.faceNames?.[t-1]:null;return(0,H.jsxs)(iW,{fsize:n,children:[`Load from `,i,` `,e.action.loadFromBasketId,` to`,` `,a??`face ${t}`]})}else return null}switch(e.location.type){case at.OnPallet:if(t===void 0||t===e.location.palletNum){if(e.action.loadOntoFace===void 0||e.action.loadOntoFace===e.location.face)return e.action.processAfterLoad&&e.action.processAfterLoad!==e.process?(0,H.jsxs)(iW,{fsize:n,children:[`Reclamp material to process # `,e.action.processAfterLoad]}):null;{let t=e.action.loadOntoFace??0,i=e.location.palletNum?r.pallets[e.location.palletNum]?.faceNames?.[t-1]:null;return(0,H.jsxs)(iW,{fsize:n,children:[`Transfer to `,i??`face ${t}`]})}}else return null;default:{let i=e.action.loadOntoFace??0,a=e.action.loadOntoPalletNum?r.pallets[e.action.loadOntoPalletNum]?.faceNames?.[i-1]:null;return t===void 0?(0,H.jsxs)(iW,{fsize:n,children:[`Load to `,a??`face ${i}`,` of pal `,e.action.loadOntoPalletNum??``]}):t===e.action.loadOntoPalletNum?(0,H.jsxs)(iW,{fsize:n,children:[`Load to `,a??`face ${i}`]}):null}}case st.LoadingToBasket:return(0,H.jsxs)(iW,{fsize:n,children:[`Load into `,i,` `,e.action.loadToBasketId??``,e.action.loadToBasketSlot===void 0?``:` slot ${e.action.loadToBasketSlot}`]});case st.UnloadToInProcess:case st.UnloadToCompletedMaterial:return e.action.unloadToBasketId?(0,H.jsxs)(iW,{fsize:n,children:[`Unload to `,i,` `,e.action.unloadToBasketId,e.action.unloadToBasketSlot===void 0?``:` slot ${e.action.unloadToBasketSlot}`]}):e.action.unloadIntoQueue?(0,H.jsxs)(iW,{fsize:n,children:[`Unload into queue `,e.action.unloadIntoQueue]}):e.action.type===st.UnloadToCompletedMaterial&&e.location.type===at.InBasket?(0,H.jsxs)(iW,{fsize:n,children:[`Unload from `,i,` `,e.location.basketId,` to completed material`]}):e.location.type===at.InBasket?(0,H.jsxs)(iW,{fsize:n,children:[`Unload from `,i,` `,e.location.basketId]}):(0,H.jsx)(iW,{fsize:n,children:`Unload from pallet`});case st.Waiting:if(e.location.type===at.InQueue&&e.jobUnique&&e.jobUnique!==``)return(0,H.jsxs)(iW,{fsize:n,children:[`Waiting; next process is #`,e.process+1]});if(e.location.type===at.InBasket)return(0,H.jsxs)(iW,{fsize:n,children:[`In `,i,` `,e.location.basketId]});if(e.location.type===at.OnPallet&&(e.lastCompletedMachiningRouteStopIndex===null||e.lastCompletedMachiningRouteStopIndex===void 0))return(0,H.jsx)(iW,{fsize:n,children:`Waiting for machining`});break;case st.Machining:return(0,H.jsxs)(iW,{fsize:n,children:[`Machining program `,e.action.program??``]})}return null}function oW({mat:e}){let t=null;return e.signaledInspections.length>0&&(t=`Inspect: `+e.signaledInspections.join(`, `)),e.quarantineAfterUnload&&(t===null?t=`Material will quarantine after unload`:t+=`; Material will quarantine after unload`),t===null?null:(0,H.jsx)(X,{title:t,children:(0,H.jsx)(DT,{})})}function sW({fsize:e,mat:t}){let n=R(NO).jobs[t.jobUnique],r=t.path;if((t.action.type===st.Loading||t.action.type===st.LoadingToBasket)&&t.action.pathAfterLoad&&(r=t.action.pathAfterLoad),!n)return null;let i=n.procsAndPaths?.[0]?.paths?.[r-1];return i&&i.casting&&i.casting!==``?(0,H.jsx)(iW,{fsize:e,children:i.casting}):null}function cW({fsize:e,uniq:t}){let n=R(NO).jobs[t],r=R(wR);if(n&&n.bookings&&n.bookings.length>0){let t=r.get(n.bookings[0]);if(t&&t.notes&&t.notes!==``)return(0,H.jsx)(iW,{fsize:e,style:{textOverflow:`ellipsis`,overflow:`hidden`,whiteSpace:`nowrap`,maxWidth:`10em`},children:t.notes})}return null}function lW(){let e=R(NO),t=R(AI);if(!t)return null;let n=e.workorders?.find(e=>e.workorderId===t)?.comments??[];return(0,H.jsxs)(`div`,{style:{marginTop:`1em`,marginLeft:`1em`},children:[(0,H.jsxs)(`p`,{children:[`Workorder: `,t]}),(0,H.jsx)(`ul`,{children:n.map((e,t)=>(0,H.jsx)(`li`,{children:e.comment},t))})]})}var uW=(0,L.forwardRef)(function(e,t){let n=z(SI),r=e.mat.completedInspections||{},i;return e.focusInspectionType&&r[e.focusInspectionType]?i=(0,H.jsxs)(iW,{fsize:e.fsize,children:[(0,H.jsx)(`span`,{children:`Inspection completed `}),(0,H.jsx)(qz,{date:r[e.focusInspectionType].time})]}):e.focusInspectionType&&e.mat.last_unload_time?i=(0,H.jsxs)(iW,{fsize:e.fsize,children:[(0,H.jsx)(`span`,{children:`Unloaded `}),(0,H.jsx)(qz,{date:e.mat.last_unload_time})]}):e.mat.closeout_completed&&(i=(0,H.jsxs)(iW,{fsize:e.fsize,children:[(0,H.jsxs)(`span`,{children:[e.mat.closeout_failed?`Failed `:``,`Closed Out `]}),(0,H.jsx)(qz,{date:e.mat.closeout_completed})]})),(0,H.jsxs)(Up,{ref:t,elevation:4,sx:{display:`flex`,minWidth:`10em`,padding:`8px`,margin:e.isDragOverlay?void 0:`8px`,opacity:e.isActiveDrag?.2:1,animation:e.shake?eW:void 0,"&:hover":{animationPlayState:`paused`}},onAnimationIteration:nW,...e.dragRootProps,children:[e.showDragHandle?(0,H.jsx)(`div`,{ref:e.setDragHandleRef,role:`button`,tabIndex:0,style:{display:`flex`,flexDirection:`column`,justifyContent:`center`,cursor:e.isDragOverlay?`grabbing`:`grab`,touchAction:`none`},...e.dragHandleProps,children:(0,H.jsx)(yre,{fontSize:`large`,color:`action`})}):void 0,(0,H.jsx)(bm,{focusRipple:!0,sx:{width:`100%`},onClick:()=>n(e.inProcMat?{type:`InProcMat`,inproc:e.inProcMat}:{type:`MatSummary`,summary:e.mat}),children:(0,H.jsxs)(J,{sx:{display:`flex`,textAlign:`left`,alignItems:`center`,width:`100%`},children:[(0,H.jsx)(ZU,{part:e.mat.partName}),(0,H.jsxs)(J,{sx:{marginLeft:`8px`,flexGrow:1,minWidth:0},children:[(0,H.jsx)(rW,{fsize:e.fsize,children:e.mat.partName}),e.displayJob?(0,H.jsx)(iW,{fsize:e.fsize,children:e.mat.jobUnique&&e.mat.jobUnique!==``?`Assigned to `+e.mat.jobUnique:`Unassigned material`}):void 0,!e.hideEmptySerial||e.mat.serial?(0,H.jsxs)(iW,{fsize:e.fsize,children:[`Serial: `,e.mat.serial?e.mat.serial:`none`]}):void 0,e.mat.workorderId===void 0||e.mat.workorderId===``||e.mat.workorderId===e.mat.serial?void 0:(0,H.jsxs)(iW,{fsize:e.fsize,children:[`Workorder: `,e.mat.workorderId]}),e.mat.jobUnique!==void 0&&e.showRawMaterial&&e.inProcMat&&e.inProcMat.process===0?(0,H.jsx)(sW,{fsize:e.fsize,mat:e.inProcMat}):void 0,e.showJobComment&&e.mat.jobUnique&&e.mat.jobUnique!==``?(0,H.jsx)(cW,{fsize:e.fsize,uniq:e.mat.jobUnique}):void 0,e.inProcMat?(0,H.jsx)(aW,{mat:e.inProcMat,displayActionForSinglePallet:e.displayActionForSinglePallet,fsize:e.fsize}):void 0,e.inProcMat?.problem?(0,H.jsx)(iW,{fsize:e.fsize,children:(0,H.jsxs)(q,{variant:`body2`,color:`error`,sx:{fontWeight:`bold`},children:[`⚠ `,e.inProcMat.problem]})}):void 0,i]}),(0,H.jsxs)(J,{sx:{marginLeft:`4px`,display:`flex`,flexDirection:`column`,justifyContent:`space-between`,alignItems:`flex-end`,alignSelf:`start`,flexShrink:0},children:[e.mat.serial&&e.mat.serial.length>=1&&!e.hideAvatar?(0,H.jsx)(`div`,{children:(0,H.jsx)(D_,{style:{width:`30px`,height:`30px`},children:e.mat.serial.slice(-1)})}):void 0,e.hideWarningIcon?void 0:(0,H.jsx)(`div`,{children:(0,H.jsx)(oW,{mat:e.mat})})]})]})})]})}),dW=(0,L.memo)(uW),fW=(0,L.memo)(function(e){return(0,H.jsx)(uW,{mat:hL(e.mat),inProcMat:e.mat,displayActionForSinglePallet:e.displayActionForSinglePallet,fsize:e.fsize,hideAvatar:e.hideAvatar,displayJob:e.displayJob,showDragHandle:e.showHandle,hideEmptySerial:e.hideEmptySerial,showRawMaterial:e.showRawMaterial,showJobComment:e.showJobComment,shake:e.shake})}),pW=(0,L.memo)(function(e){let t={mat:e.mat},{active:n,isDragging:r,attributes:i,listeners:a,setNodeRef:o,setActivatorNodeRef:s,transform:c,transition:l}=EU({id:e.mat.materialID,data:t}),u={...a};for(let[e,t]of Object.entries(i))e.startsWith(`aria`)&&(u[e]=t);let d={transform:c?`translate3d(${Math.round(c.x)}px, ${Math.round(c.y)}px, 0)`:void 0,transition:n===null?void 0:l};return(0,H.jsx)(uW,{ref:o,dragRootProps:{style:d},showDragHandle:!0,dragHandleProps:u,setDragHandleRef:s,isActiveDrag:r,mat:hL(e.mat),inProcMat:e.mat,displayActionForSinglePallet:e.displayActionForSinglePallet,hideAvatar:e.hideAvatar,displayJob:e.displayJob,hideEmptySerial:e.hideEmptySerial,fsize:e.fsize,shake:n?void 0:e.shake,showRawMaterial:e.showRawMaterial})});function mW(e){return(0,H.jsx)(uW,{mat:hL(e.mat),inProcMat:e.mat,displayActionForSinglePallet:e.displayActionForSinglePallet,showDragHandle:!0,hideAvatar:e.hideAvatar,displayJob:e.displayJob,fsize:e.fsize,hideEmptySerial:e.hideEmptySerial,isDragOverlay:!0})}var hW=(0,L.memo)(function(e){return(0,H.jsx)(Up,{elevation:4,sx:{display:`flex`,minWidth:`10em`,padding:`8px`,margin:`8px`},children:(0,H.jsx)(W_,{badgeContent:e.material.length<2?0:e.material.length,color:`secondary`,children:(0,H.jsx)(bm,{focusRipple:!0,onClick:()=>e.onOpen(),children:(0,H.jsxs)(J,{sx:{display:`flex`,textAlign:`left`},children:[(0,H.jsx)(ZU,{part:e.partOrCasting}),(0,H.jsxs)(J,{sx:{marginLeft:`8px`,flexGrow:1},children:[(0,H.jsx)(q,{variant:`h6`,children:e.partOrCasting}),(0,H.jsx)(iW,{fsize:e.fsize,children:e.assignedJobUnique&&e.assignedJobUnique!==``?`Assigned to `+e.assignedJobUnique:`Unassigned material`})]}),e.material.length>0&&e.material[0].serial&&e.material[0].serial.length>=1?(0,H.jsx)(`div`,{children:(0,H.jsx)(D_,{style:{width:`30px`,height:`30px`},children:e.material[0].serial.slice(-1)})}):void 0]})})})})}),gW=(0,L.memo)(function({partName:e,serial:t,subtitle:n,notes:r}){let i;return i=e===``?t??`Material`:t==null||t===``?r?`Add note for `+e:e:r?`Add note for `+t:e+` - `+t,(0,H.jsxs)(J,{sx:{display:`flex`,textAlign:`left`},children:[e===``?(0,H.jsx)(bT,{}):(0,H.jsx)(ZU,{part:e}),(0,H.jsxs)(J,{sx:{marginLeft:`8px`,flexGrow:1},children:[(0,H.jsx)(q,{variant:`h6`,children:i}),n?(0,H.jsx)(q,{variant:`caption`,children:n}):void 0]})]})});function _W({notes:e}){let t=R(SI),n=R(xie),r=R(Sie),i=``,a=null;switch(t?.type){case`InProcMat`:i=t.inproc.partName,a=t.inproc.serial;break;case`MatSummary`:i=t.summary.partName,a=t.summary.serial;break;case`MatDetails`:i=t.details.partName,a=t.details.serial;break;case`LogMat`:i=t.logMat.part,a=t.logMat.serial;break;case`Barcode`:a=t.barcode;break;case`ManuallyEnteredSerial`:case`AddMatWithEnteredSerial`:a=t.serial;break}return n.state===`hasData`&&n.data!==null&&(i=n.data.partName,a=n.data.serial??a),r.state===`hasData`&&r.data&&(a=r.data),(0,H.jsx)(gW,{notes:e,partName:i,serial:a})}function vW(){let e=R(FI);function t(t){return e.completedInspections.includes(t)?`black`:`red`}return e.signaledInspections.length===0?(0,H.jsx)(`small`,{children:`Inspections: none`}):(0,H.jsxs)(`small`,{children:[`Inspections:`,` `,e.signaledInspections.map((e,n)=>(0,H.jsxs)(`span`,{children:[n===0?``:`, `,(0,H.jsx)(`span`,{style:{color:t(e)},children:e})]},n))]})}function yW({highlightProcsGreaterOrEqualTo:e}){return(0,H.jsx)(bI,{entries:R(NI),copyToClipboard:!0,highlightProcsGreaterOrEqualTo:e})}function bW(){let e=R(OI),t=R(NO).jobs,n=R(wR),r=e?t[e.jobUnique]:null;if(r&&r.bookings&&r.bookings.length>0){let e=n.get(r.bookings[0]);if(e&&e.notes&&e.notes!==``)return(0,H.jsx)(q,{variant:`caption`,sx:{width:`100%`,textWrap:`wrap`},children:e.notes})}return null}function xW(){let e=R(OI);if(e===null)return null;if(e.quarantineAfterUnload)return(0,H.jsx)(q,{variant:`caption`,component:`p`,children:`Quarantine requested`});let t=UU(e);return t.kind!==`ActiveLoadStationOperation`||t.cancellationId!==null?null:(0,H.jsx)(q,{variant:`caption`,component:`p`,children:`This material is part of the current load/unload operation. Complete the operation or cancel it at the machine control before making other changes.`})}var SW=(0,L.memo)(function({highlightProcsGreaterOrEqualTo:e}){let t=R(SI),n=R(TI),r=R(wI);return t===null?null:n===null?t.type===`AddMatWithEnteredSerial`||t.type===`ManuallyEnteredSerial`?(0,H.jsxs)(`div`,{style:{marginLeft:`1em`},children:[`Material with serial `,t.serial,` not found.`]}):t.type===`Barcode`?r?(0,H.jsxs)(`div`,{style:{marginLeft:`1em`},children:[`Material with barcode `,t.barcode,` does not yet exist in the cell.`]}):(0,H.jsxs)(`div`,{style:{marginLeft:`1em`},children:[`Material with barcode `,t.barcode,` not found.`]}):(0,H.jsx)(`div`,{style:{marginLeft:`1em`},children:`Material not found.`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{style:{marginLeft:`1em`},children:[(0,H.jsx)(xW,{}),(0,H.jsx)(`div`,{children:(0,H.jsxs)(`small`,{children:[`Workorder: `,n?.workorderId??`none`]})}),(0,H.jsx)(`div`,{children:(0,H.jsx)(BU,{fallback:(0,H.jsxs)(`small`,{children:[`Inspections: `,(0,H.jsx)(Lm,{size:`10`})]}),children:(0,H.jsx)(vW,{})})}),(0,H.jsx)(`div`,{children:(0,H.jsx)(BU,{fallback:(0,H.jsx)(`div`,{}),children:(0,H.jsx)(bW,{})})})]}),(0,H.jsx)(BU,{fallback:(0,H.jsx)(Lm,{}),children:(0,H.jsx)(yW,{highlightProcsGreaterOrEqualTo:e})})]})});function CW(e){let[t,n]=(0,L.useState)(``),r=R(jO),[i]=Die(),a=R(TI);return a===null?null:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(uy,{children:(0,H.jsx)(Kw,{sx:{mt:`5px`},multiline:!0,label:`Note`,autoFocus:!0,variant:`outlined`,value:t,onChange:e=>n(e.target.value)})}),(0,H.jsxs)(ly,{children:[(0,H.jsx)(Y,{onClick:()=>{i({matId:a.materialID,process:0,operator:r,notes:t}),e.setNotesOpen(!1),n(``)},disabled:t===``,color:`secondary`,children:`Save`}),(0,H.jsx)(Y,{onClick:()=>{e.setNotesOpen(!1),n(``)},color:`secondary`,children:`Cancel`})]})]})}function wW(){let e=R(SI);if(e===null)return null;let t;switch(e.type){case`Barcode`:t=`Loading material with barcode `+e.barcode+`...`;break;case`AddMatWithEnteredSerial`:case`ManuallyEnteredSerial`:t=`Loading material with serial `+e.serial+`...`;break;default:t=`Loading material...`;break}return(0,H.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`},children:[(0,H.jsx)(Lm,{}),(0,H.jsx)(`div`,{style:{marginTop:`1em`},children:t})]})}function TW({setNotesOpen:e}){let t=R(TI);return t===null||t.materialID<0?null:(0,H.jsx)(Y,{onClick:()=>e(!0),color:`primary`,children:`Add Note`})}var EW=(0,L.memo)(function(e){let[t,n]=(0,L.useState)(!1),[r,i]=B(SI);function a(){i(null),e.onClose&&e.onClose()}let o,s;return r&&(o=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(dy,{children:(0,H.jsx)(_W,{})}),(0,H.jsx)(uy,{children:(0,H.jsxs)(BU,{fallback:(0,H.jsx)(wW,{}),children:[(0,H.jsx)(SW,{highlightProcsGreaterOrEqualTo:e.highlightProcsGreaterOrEqualTo}),(0,H.jsx)(BU,{fallback:(0,H.jsx)(Lm,{}),children:e.extraDialogElements})]})}),(0,H.jsxs)(ly,{children:[r&&(e.buttons||e.allowNote)?(0,H.jsx)(FU,{fallback:(0,H.jsx)(`div`,{}),children:(0,H.jsxs)(L.Suspense,{fallback:(0,H.jsx)(`div`,{}),children:[r&&e.allowNote?(0,H.jsx)(TW,{setNotesOpen:n}):void 0,e.buttons]})}):null,(0,H.jsx)(Y,{onClick:a,color:`secondary`,children:`Close`})]})]}),e.allowNote&&(s=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(dy,{children:(0,H.jsx)(_W,{notes:!0})}),(0,H.jsxs)(BU,{fallback:(0,H.jsx)(uy,{children:(0,H.jsx)(Lm,{})}),children:[(0,H.jsx)(CW,{setNotesOpen:n}),`;`]})]}))),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(cy,{open:r!==null,onClose:a,maxWidth:`lg`,children:o}),e.allowNote?(0,H.jsx)(cy,{open:t,onClose:()=>n(!1),maxWidth:`md`,children:s}):void 0]})}),DW=SO(`MachineCostPerYear`,{}),OW=SO(`AutomationCostPerYear`,null),kW=SO(`Last30LaborCost`,null),AW=aO(e=>SO(`PerMonthLabor-`+e.getFullYear().toString()+`-`+e.getMonth().toString(),null)),jW=P(e=>e(e(qR).type===`Last30`?sO:dO).valuesToLazySeq().filter(e=>e.procsAndPaths.length===1&&e.procsAndPaths[0].paths.length===1&&e.procsAndPaths[0].paths[0].stops.length===1&&zO(e.procsAndPaths[0].paths[0].stops[0].expectedCycleTime)===0).toHashSet(e=>e.partName)),MW=P(e=>{let t=e(qR),n=e(t.type===`Last30`?uk:pk),r=e(t.type===`Last30`?fL:mL),i=e(jW),a=LT(cE(),-30),o=t.type===`Last30`?null:t.month;return iz(n.valuesToLazySeq(),i,r.matsById,o?{month:o}:{thirtyDaysAgo:a})}),NW=P(e=>{let t=e(qR),n=e(DW),r=e(OW),i=e(t.type===`Last30`?kW:AW(t.month));return az(e(MW),n,r,i??0)});function PW(){let[e,t]=(0,L.useState)(null),[n,r]=B(OW);return(0,H.jsx)(Kw,{id:`auotmation-cost-year`,type:`number`,label:`Cost for automated handling system per year`,style:{marginTop:`1.5em`},variant:`outlined`,value:e===null?n??``:isNaN(e)?``:e,onChange:e=>t(parseFloat(e.target.value)),onBlur:()=>{e!=null&&r(isNaN(e)?null:e),t(null)},slotProps:{htmlInput:{min:0}}})}function FW(){let e=R(qR),t=e.type===`Last30`?null:e.month,[n,r]=(0,L.useState)(null),[i,a]=B(t===null?kW:AW(t));return(0,H.jsx)(Kw,{type:`number`,label:`Total labor cost for `+(t===null?`last 30 days`:t.toLocaleDateString(void 0,{month:`long`,year:`numeric`})),variant:`outlined`,value:n===null?i??``:isNaN(n)?``:n,onChange:e=>r(parseFloat(e.target.value)),onBlur:()=>{n!=null&&a(isNaN(n)?null:n),r(null)},slotProps:{htmlInput:{min:0}}})}function IW(e){let[t,n]=(0,L.useState)(null),[r,i]=B(DW);return(0,H.jsx)(Kw,{type:`number`,variant:`outlined`,label:`Cost for `+e.machineGroup+` per station per year`,style:{marginTop:`1.5em`},value:t===null?r[e.machineGroup]??``:isNaN(t)?``:t,onChange:e=>n(parseFloat(e.target.value)),onBlur:()=>{if(t!=null){let n={...r};isNaN(t)?delete n[e.machineGroup]:n[e.machineGroup]=t,i(n)}n(null)},slotProps:{htmlInput:{min:0}}})}function LW(){let e=R(NW);return(0,H.jsx)(H.Fragment,{children:e.machineQuantities.keysToAscLazySeq().map((t,n)=>(0,H.jsx)(IW,{machineQuantities:e.machineQuantities,machineGroup:t},n))})}var RW=Intl.NumberFormat(void 0,{minimumFractionDigits:1,maximumFractionDigits:1}),zW=new Intl.NumberFormat(void 0,{style:`percent`,minimumFractionDigits:1,maximumFractionDigits:1});function BW(){JI(`Cost Percentages`);let e=R(MW);return(0,H.jsxs)(J,{sx:{paddingLeft:`24px`,paddingRight:`24px`,paddingTop:`10px`},children:[(0,H.jsxs)(J,{component:`nav`,sx:{display:`flex`,minHeight:`2.5em`,alignItems:`center`,maxWidth:`calc(100vw - 24px - 24px)`},children:[(0,H.jsx)(q,{variant:`subtitle1`,children:`Part Cost Percentage Breakdown`}),(0,H.jsx)(J,{sx:{flexGrow:1}}),(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{style:{height:`25px`,paddingTop:0,paddingBottom:0},onClick:()=>lz(e),size:`large`,children:(0,H.jsx)(uT,{})})})]}),(0,H.jsx)(`main`,{children:(0,H.jsxs)(jw,{stickyHeader:!0,children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:`Part`}),(0,H.jsx)(Z,{align:`right`,children:`Completed Quantity`}),e.machineQuantities.keysToAscLazySeq().map(e=>(0,H.jsxs)(Z,{align:`right`,children:[e,` Cost %`]},e)),(0,H.jsx)(Z,{align:`right`,children:`Labor Cost %`}),(0,H.jsx)(Z,{align:`right`,children:`Automation Cost %`})]})}),(0,H.jsx)(Pw,{children:Q.of(e.parts).sortBy(e=>e.part).map((t,n)=>(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:(0,H.jsxs)(J,{sx:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(J,{sx:{mr:`0.2em`},children:(0,H.jsx)(ZU,{part:t.part,size:25})}),(0,H.jsx)(`div`,{children:(0,H.jsx)(q,{variant:`body2`,component:`span`,sx:{display:`block`},children:t.part})})]})}),(0,H.jsx)(Z,{align:`right`,children:t.parts_completed}),e.machineQuantities.keysToAscLazySeq().map(e=>(0,H.jsx)(Z,{align:`right`,children:zW.format(t.machine.get(e)??0)},e)),(0,H.jsx)(Z,{align:`right`,children:zW.format(t.labor)}),(0,H.jsx)(Z,{align:`right`,children:zW.format(t.automation)})]},n))})]})})]})}function VW(){let e=R(NW);return(0,H.jsxs)(jw,{stickyHeader:!0,children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:`Part`}),(0,H.jsx)(Z,{align:`right`,children:`Completed Quantity`}),e.machineQuantities.keysToAscLazySeq().map(e=>(0,H.jsxs)(Z,{align:`right`,children:[e,` Cost`]},e)),(0,H.jsx)(Z,{align:`right`,children:`Labor Cost`}),(0,H.jsx)(Z,{align:`right`,children:`Automation Cost`}),(0,H.jsxs)(Z,{align:`right`,children:[(0,H.jsx)(`span`,{children:`Total`}),(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{style:{height:`25px`,paddingTop:0,paddingBottom:0},onClick:()=>sz(e),size:`large`,children:(0,H.jsx)(uT,{})})})]})]})}),(0,H.jsx)(Pw,{children:Q.of(e.parts).sortBy(e=>e.part).map((t,n)=>(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:(0,H.jsxs)(J,{sx:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(J,{sx:{mr:`0.2em`},children:(0,H.jsx)(ZU,{part:t.part,size:25})}),(0,H.jsx)(`div`,{children:(0,H.jsx)(q,{variant:`body2`,component:`span`,sx:{display:`block`},children:t.part})})]})}),(0,H.jsx)(Z,{align:`right`,children:t.parts_completed}),e.machineQuantities.keysToAscLazySeq().map(e=>(0,H.jsx)(Z,{align:`right`,children:RW.format(t.machine.get(e)??0)},e)),(0,H.jsx)(Z,{align:`right`,children:RW.format(t.labor)}),(0,H.jsx)(Z,{align:`right`,children:RW.format(t.automation)}),(0,H.jsx)(Z,{align:`right`,children:RW.format(t.machine.valuesToAscLazySeq().sumBy(e=>e)+t.labor+t.automation)})]},n))})]})}var HW=(0,L.memo)(function(){return JI(`Cost Per Piece`),(0,H.jsx)(J,{component:`main`,sx:{paddingLeft:`24px`,paddingRight:`24px`,paddingTop:`20px`},children:(0,H.jsxs)(RC,{direction:`column`,spacing:4,children:[(0,H.jsxs)(RC,{direction:`column`,spacing:2,children:[(0,H.jsx)(FW,{}),(0,H.jsx)(PW,{}),(0,H.jsx)(LW,{})]}),(0,H.jsx)(VW,{})]})})}),UW=[{type:`Subheader`,caption:`Shop Floor`},{type:`Link`,route:{route:$.Station_LoadMonitor,loadNum:1,queues:[],completed:!1},icon:(0,H.jsx)(_re,{}),label:`Load Station`},{type:`Link`,route:{route:$.Station_Queues,queues:[]},icon:(0,H.jsx)(oT,{}),label:`Queue Management`},{type:`Link`,route:{route:$.Station_InspectionMonitor},icon:(0,H.jsx)(Tre,{}),label:`Inspection Stand`},{type:`Link`,route:{route:$.Station_Closeout},icon:(0,H.jsx)(_T,{}),label:`Close Out`},{type:`Link`,route:{route:$.Tools_Dashboard},icon:(0,H.jsx)(Zw,{}),label:`Tool Management`},{type:`Link`,route:{route:$.Station_Overview},icon:(0,H.jsx)(ure,{}),label:`System Overview`},{type:`Subheader`,caption:`Daily Monitoring`},{type:`Link`,route:{route:$.Operations_Dashboard},icon:(0,H.jsx)(xT,{}),label:`Operation Management`},{type:`Link`,route:{route:$.Engineering_Cycles},icon:(0,H.jsx)(Ore,{}),label:`Engineering`},{type:`Link`,route:{route:$.Quality_Dashboard},icon:(0,H.jsx)(Pre,{}),label:`Quality Analysis`},{type:`Link`,route:{route:$.Sales_Dashboard},icon:(0,H.jsx)(Are,{}),label:`Sales`},{type:`Subheader`,caption:`Monthly Review`},{type:`Link`,route:{route:$.Analysis_Buffers},icon:(0,H.jsx)(Ere,{}),label:`Flexibility Analysis`}];function WW(e){let t=(0,H.jsx)(Up,{children:(0,H.jsx)(pb,{component:`nav`,dense:!0,children:(e.modes??UW).map((t,n)=>t.type===`Subheader`?(0,H.jsx)(m_,{children:t.caption},n):(0,H.jsx)(Db,{children:(0,H.jsxs)(vb,{onClick:()=>e.setRoute(t.route),children:[(0,H.jsx)(Mb,{children:t.icon}),(0,H.jsx)(Lb,{children:t.label})]})},n))})});return(0,H.jsx)(`main`,{style:{display:`flex`,justifyContent:`center`},children:(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{style:{textAlign:`center`},children:[(0,H.jsx)(q,{variant:`h4`,style:{marginTop:`2em`},children:`Select user and computer location`}),(0,H.jsxs)(q,{variant:`caption`,style:{marginBottom:`2em`,maxWidth:`30em`,marginLeft:`auto`,marginRight:`auto`},children:[`We recommend that after selecting one of the following modes, you bookmark the page and visit it directly.`,(0,H.jsx)(`a`,{href:`https://fms-insight.seedtactics.com/docs/client-dashboard.html`,children:`Learn More`})]})]}),t]})})}var GW=[[`All`,`*`,`*`,` `,0,`All`],[`AllReadable`,`*`,`r`,` `,0,`All Readable`],[`AllCreatable`,`*`,`w`,` `,0,`All Creatable`],[`AllLinear`,`*`,`l`,` `,0,`All Linear`],[`AllMatrix`,`*`,`m`,` `,0,`All Matrix`],[`AllGS1`,`*`,`G`,` `,0,`All GS1`],[`AllRetail`,`*`,`R`,` `,0,`All Retail`],[`AllIndustrial`,`*`,`I`,` `,0,`All Industrial`],[`Codabar`,`F`,` `,`lrw `,18,`Codabar`],[`Code39`,`A`,` `,`lrw I`,8,`Code 39`],[`Code39Std`,`A`,`s`,`lrw I`,8,`Code 39 Standard`],[`Code39Ext`,`A`,`e`,`lr I`,9,`Code 39 Extended`],[`Code32`,`A`,`2`,`lr I`,129,`Code 32`],[`PZN`,`A`,`p`,`lr I`,52,`Pharmazentralnummer`],[`Code93`,`G`,` `,`lrw I`,25,`Code 93`],[`Code128`,`C`,` `,`lrwGI`,20,`Code 128`],[`ITF`,`I`,` `,`lrw I`,3,`ITF`],[`ITF14`,`I`,`4`,`lr I`,89,`ITF-14`],[`DataBar`,`e`,` `,`lr GR`,29,`DataBar`],[`DataBarOmni`,`e`,`o`,`lr GR`,29,`DataBar Omni`],[`DataBarStk`,`e`,`s`,`lr GR`,79,`DataBar Stacked`],[`DataBarStkOmni`,`e`,`O`,`lr GR`,80,`DataBar Stacked Omni`],[`DataBarLtd`,`e`,`l`,`lr GR`,30,`DataBar Limited`],[`DataBarExp`,`e`,`e`,`lr GR`,31,`DataBar Expanded`],[`DataBarExpStk`,`e`,`E`,`lr GR`,81,`DataBar Expanded Stacked`],[`EANUPC`,`E`,` `,`lr R`,15,`EAN/UPC`],[`EAN13`,`E`,`1`,`lrw R`,15,`EAN-13`],[`EAN8`,`E`,`8`,`lrw R`,10,`EAN-8`],[`EAN5`,`E`,`5`,`l R`,12,`EAN-5`],[`EAN2`,`E`,`2`,`l R`,11,`EAN-2`],[`ISBN`,`E`,`i`,`lr R`,69,`ISBN`],[`UPCA`,`E`,`a`,`lrw R`,34,`UPC-A`],[`UPCE`,`E`,`e`,`lrw R`,37,`UPC-E`],[`Telepen`,`B`,` `,`lr I`,32,`Telepen`],[`TelepenAlpha`,`B`,`0`,`lr I`,32,`Telepen Alpha`],[`TelepenNumeric`,`B`,`1`,`lr I`,87,`Telepen Numeric`],[`OtherBarcode`,`X`,` `,` r `,0,`Other barcode`],[`DXFilmEdge`,`X`,`x`,`lr `,147,`DX Film Edge`],[`PDF417`,`L`,` `,`mrw `,55,`PDF417`],[`CompactPDF417`,`L`,`c`,`mr `,56,`Compact PDF417`],[`MicroPDF417`,`L`,`m`,`mr `,84,`MicroPDF417`],[`Aztec`,`z`,` `,`mr G `,92,`Aztec`],[`AztecCode`,`z`,`c`,`mrwG `,92,`Aztec Code`],[`AztecRune`,`z`,`r`,`mr `,128,`Aztec Rune`],[`QRCode`,`Q`,` `,`mrwG `,58,`QR Code`],[`QRCodeModel1`,`Q`,`1`,`mr `,0,`QR Code Model 1`],[`QRCodeModel2`,`Q`,`2`,`mr `,58,`QR Code Model 2`],[`MicroQRCode`,`Q`,`m`,`mr `,97,`Micro QR Code`],[`RMQRCode`,`Q`,`r`,`mr G `,145,`rMQR Code`],[`DataMatrix`,`d`,` `,`mrwG `,71,`Data Matrix`],[`MaxiCode`,`U`,` `,`mr `,57,`MaxiCode`]],KW={DataBarExpanded:`DataBarExp`,DataBarLimited:`DataBarLtd`,"Linear-Codes":`AllLinear`,"Matrix-Codes":`AllMatrix`,Any:`All`,rMQRCode:`RMQRCode`};GW.map(e=>e[5]),GW.filter(e=>e[1]===`*`).map(e=>e[0]),GW.filter(e=>e[1]!==`*`).map(e=>e[0]),GW.filter(e=>e[2]===` `).map(e=>e[0]),GW.filter(e=>e[3][0]===`l`).map(e=>e[0]),GW.filter(e=>e[3][0]===`m`).map(e=>e[0]),GW.filter(e=>e[3][1]===`r`).map(e=>e[0]),GW.filter(e=>e[3][2]===`w`||e[4]!==0).map(e=>e[0]),GW.filter(e=>e[3][3]===`G`).map(e=>e[0]),GW.filter(e=>e[3][4]===`R`).map(e=>e[0]),GW.filter(e=>e[3][4]===`I`).map(e=>e[0]);function qW(e){return KW[e]??e}function JW(e){return e.map(qW).join(`,`)}var YW=[`LocalAverage`,`GlobalHistogram`,`FixedThreshold`,`BoolCast`];function XW(e){return YW.indexOf(e)}var ZW=`Unknown.ASCII.ISO8859_1.ISO8859_2.ISO8859_3.ISO8859_4.ISO8859_5.ISO8859_6.ISO8859_7.ISO8859_8.ISO8859_9.ISO8859_10.ISO8859_11.ISO8859_13.ISO8859_14.ISO8859_15.ISO8859_16.Cp437.Cp1250.Cp1251.Cp1252.Cp1256.Shift_JIS.Big5.GB2312.GB18030.EUC_JP.EUC_KR.UTF16BE.UTF8.UTF16LE.UTF32BE.UTF32LE.BINARY`.split(`.`);function QW(e){return e===`UnicodeBig`?ZW.indexOf(`UTF16BE`):ZW.indexOf(e)}var $W=[`Text`,`Binary`,`Mixed`,`GS1`,`ISO15434`,`UnknownECI`];function eG(e){return $W[e]}var tG=[`Ignore`,`Read`,`Require`];function nG(e){return tG.indexOf(e)}var rG=[`Plain`,`ECI`,`HRI`,`Escaped`,`Hex`,`HexECI`];function iG(e){return rG.indexOf(e)}var aG={formats:[],tryHarder:!0,tryRotate:!0,tryInvert:!0,tryDownscale:!0,tryDenoise:!1,binarizer:`LocalAverage`,isPure:!1,downscaleFactor:3,downscaleThreshold:500,minLineCount:2,maxNumberOfSymbols:255,validateOptionalChecksum:!1,returnErrors:!1,eanAddOnSymbol:`Ignore`,textMode:`HRI`,characterSet:`Unknown`,tryCode39ExtendedMode:!0};function oG(e){var t;return{...e,formats:JW(e.formats),binarizer:XW(e.binarizer),eanAddOnSymbol:nG(e.eanAddOnSymbol),textMode:iG(e.textMode),characterSet:QW(e.characterSet),tryCode39ExtendedMode:(t=e.tryCode39ExtendedMode)==null||t}}function sG(e){return{...e,format:e.format,symbology:e.symbology,contentType:eG(e.contentType)}}var cG={format:`QRCode`,readerInit:!1,forceSquareDataMatrix:!1,ecLevel:``,scale:1,sizeHint:0,rotate:0,invert:!1,withHRT:!1,withQuietZones:!0,addHRT:!1,addQuietZones:!0,options:``},lG={locateFile:(e,t)=>{let n=e.match(/_(.+?)\.wasm$/);return n?`https://fastly.jsdelivr.net/npm/zxing-wasm@3.1.1/dist/${n[1]}/${e}`:t+e}},uG=new WeakMap;function dG(e,t){return Object.is(e,t)||Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>Object.hasOwn(t,n)&&e[n]===t[n])}function fG(e,{overrides:t,equalityFn:n=dG,fireImmediately:r=!1}={}){let[i,a]=uG.get(e)??[lG],o=t??i,s;if(r){if(a&&(s=n(i,o)))return a;let t=e({...o});return uG.set(e,[o,t]),t}(s??n(i,o))||uG.set(e,[o])}function pG(e){let t=e.byteLength>>2,n=new Uint8Array(t);for(let r=0;r<t;r++){let t=r<<2;n[r]=306*e[t]+601*e[t+1]+117*e[t+2]+512>>10}return n}async function mG(e,t,n=aG){let r={...aG,...n},i=await fG(e,{fireImmediately:!0}),a,o;if(`width`in t&&`height`in t&&`data`in t){let{data:e,width:n,height:s}=t,c=pG(e),l=c.byteLength;if(o=i._malloc(l),!o)throw Error(`Failed to allocate ${l} bytes in WASM memory`);try{i.HEAPU8.set(c,o),a=i.readBarcodesFromPixmap(o,n,s,oG(r))}finally{i._free(o)}}else{let e,n;if(`buffer`in t)[e,n]=[t.byteLength,t];else if(`byteLength`in t)[e,n]=[t.byteLength,new Uint8Array(t)];else if(`size`in t)[e,n]=[t.size,new Uint8Array(await t.arrayBuffer())];else throw TypeError(`Invalid input type`);if(o=i._malloc(e),!o)throw Error(`Failed to allocate ${e} bytes in WASM memory`);try{i.HEAPU8.set(n,o),a=i.readBarcodesFromImage(o,e,oG(r))}finally{i._free(o)}}let s=[];for(let e=0;e<a.size();++e)s.push(sG(a.get(e)));return s}({...aG}),[...aG.formats],{...cG};async function hG(e={}){var t,n,r,i=e,a=!!globalThis.window,o=typeof Bun<`u`,s=!!globalThis.WorkerGlobalScope;!((n=globalThis.process)==null||(n=n.versions)==null)&&n.node&&((r=globalThis.process)==null||r.type);var c=`./this.program`,l,u=``;function d(e){return i.locateFile?i.locateFile(e,u):u+e}var f,p;if(a||s||o){try{u=new URL(`.`,l).href}catch{}s&&(p=e=>{var t=new XMLHttpRequest;return t.open(`GET`,e,!1),t.responseType=`arraybuffer`,t.send(null),new Uint8Array(t.response)}),f=async e=>{var t=await fetch(e,{credentials:`same-origin`});if(t.ok)return t.arrayBuffer();throw Error(t.status+` : `+t.url)}}console.log.bind(console);var m=console.error.bind(console),h,g=!1,_,v,y=!1;function b(){var e=tr.buffer;ne=new Int8Array(e),j=new Int16Array(e),i.HEAPU8=oe=new Uint8Array(e),ae=new Uint16Array(e),M=new Int32Array(e),N=new Uint32Array(e),re=new Float32Array(e),ie=new Float64Array(e)}function x(){if(i.preRun)for(typeof i.preRun==`function`&&(i.preRun=[i.preRun]);i.preRun.length;)ue(i.preRun.shift());se(le)}function S(){y=!0,Wr.ya()}function C(){if(i.postRun)for(typeof i.postRun==`function`&&(i.postRun=[i.postRun]);i.postRun.length;)P(i.postRun.shift());se(ce)}function w(e){var t,n;(t=i.onAbort)==null||t.call(i,e),e=`Aborted(`+e+`)`,m(e),g=!0,e+=`. Build with -sASSERTIONS for more info.`;var r=new WebAssembly.RuntimeError(e);throw(n=v)==null||n(r),r}var T;function E(){return d(`zxing_reader.wasm`)}function D(e){if(e==T&&h)return new Uint8Array(h);if(p)return p(e);throw`both async and sync fetching of the wasm failed`}async function O(e){if(!h)try{var t=await f(e);return new Uint8Array(t)}catch{}return D(e)}async function ee(e,t){try{var n=await O(e);return await WebAssembly.instantiate(n,t)}catch(e){m(`failed to asynchronously prepare wasm: ${e}`),w(e)}}async function te(e,t,n){if(!e&&WebAssembly.instantiateStreaming)try{var r=fetch(t,{credentials:`same-origin`});return await WebAssembly.instantiateStreaming(r,n)}catch(e){m(`wasm streaming compile failed: ${e}`),m(`falling back to ArrayBuffer instantiation`)}return ee(t,n)}function k(){return{a:ir}}async function A(){function e(e,t){return Wr=e.exports,rr(Wr),b(),Wr}function t(t){return e(t.instance)}var n=k();return i.instantiateWasm?new Promise((t,r)=>{i.instantiateWasm(n,(n,r)=>{t(e(n,r))})}):(T??=E(),t(await te(h,T,n)))}var j,M,ne,re,ie,ae,N,oe,se=e=>{for(;e.length>0;)e.shift()(i)},ce=[],P=e=>ce.push(e),le=[],ue=e=>le.push(e),F=e=>qn(e),I=()=>Jn(),de=[],fe=0,pe=e=>{var t=new he(e);return t.get_caught()||(t.set_caught(!0),fe--),t.set_rethrown(!1),de.push(t),Wn(e)},me=0,L=()=>{Gn(0,0);var e=de.pop();Yn(e.excPtr),me=0};class he{constructor(e){this.excPtr=e,this.ptr=e-24}set_type(e){N[this.ptr+4>>2]=e}get_type(){return N[this.ptr+4>>2]}set_destructor(e){N[this.ptr+8>>2]=e}get_destructor(){return N[this.ptr+8>>2]}set_caught(e){e=+!!e,ne[this.ptr+12]=e}get_caught(){return ne[this.ptr+12]!=0}set_rethrown(e){e=+!!e,ne[this.ptr+13]=e}get_rethrown(){return ne[this.ptr+13]!=0}init(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)}set_adjusted_ptr(e){N[this.ptr+16>>2]=e}get_adjusted_ptr(){return N[this.ptr+16>>2]}}var ge=e=>Kn(e),_e=e=>{var t=me;if(!t)return ge(0),0;var n=new he(t);n.set_adjusted_ptr(t);var r=n.get_type();if(!r)return ge(0),t;for(var i of e){if(i===0||i===r)break;var a=n.ptr+16;if(Zn(i,r,a))return ge(i),t}return ge(r),t},ve=()=>_e([]),ye=e=>_e([e]),be=(e,t)=>_e([e,t]),xe=()=>{var e=de.pop();e||w(`no exception to throw`);var t=e.excPtr;throw e.get_rethrown()||(de.push(e),e.set_rethrown(!0),e.set_caught(!1),fe++),Xn(t),me=t,me},Se=(e,t,n)=>{throw new he(e).init(t,n),Xn(e),me=e,fe++,me},R=()=>fe,z=e=>{throw me||=e,me},B=()=>w(``),Ce={},we=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Te(e){return this.fromWireType(N[e>>2])}var Ee={},De={},Oe={},ke=class extends Error{constructor(e){super(e),this.name=`InternalError`}},Ae=e=>{throw new ke(e)},je=(e,t,n)=>{e.forEach(e=>Oe[e]=t);function r(t){var r=n(t);r.length!==e.length&&Ae(`Mismatched type converter count`);for(var i=0;i<e.length;++i)Le(e[i],r[i])}var i=Array(t.length),a=[],o=0;{let e=t;for(let t=0;t<e.length;++t){let n=e[t];De.hasOwnProperty(n)?i[t]=De[n]:(a.push(n),Ee.hasOwnProperty(n)||(Ee[n]=[]),Ee[n].push(()=>{i[t]=De[n],++o,o===a.length&&r(i)}))}}a.length===0&&r(i)},V=e=>{var t=Ce[e];delete Ce[e];var n=t.rawConstructor,r=t.rawDestructor,i=t.fields,a=i.map(e=>e.getterReturnType).concat(i.map(e=>e.setterArgumentType));je([e],a,e=>{var a={};{let t=i;for(let n=0;n<t.length;++n){let r=t[n],o=e[n],s=r.getter,c=r.getterContext,l=e[n+i.length],u=r.setter,d=r.setterContext;a[r.fieldName]={read:e=>o.fromWireType(s(c,e)),write:(e,t)=>{var n=[];u(d,e,l.toWireType(n,t)),we(n)},optional:o.optional}}}return[{name:t.name,fromWireType:e=>{var t={};for(var n in a)t[n]=a[n].read(e);return r(e),t},toWireType:(e,t)=>{for(var i in a)if(!(i in t)&&!a[i].optional)throw TypeError(`Missing field: "${i}"`);var o=n();for(i in a)a[i].write(o,t[i]);return e!==null&&e.push(r,o),o},readValueFromPointer:Te,destructorFunction:r}]})},Me=(e,t,n,r,i)=>{},Ne=e=>{for(var t=``;;){var n=oe[e++];if(!n)return t;t+=String.fromCharCode(n)}},Pe=class extends Error{constructor(e){super(e),this.name=`BindingError`}},Fe=e=>{throw new Pe(e)};function Ie(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=t.name;if(e||Fe(`type "${r}" must have a positive integer typeid pointer`),De.hasOwnProperty(e)){if(n.ignoreDuplicateRegistrations)return;Fe(`Cannot register type '${r}' twice`)}if(De[e]=t,delete Oe[e],Ee.hasOwnProperty(e)){var i=Ee[e];delete Ee[e],i.forEach(e=>e())}}function Le(e,t){return Ie(e,t,arguments.length>2&&arguments[2]!==void 0?arguments[2]:{})}var Re=(e,t,n,r)=>{t=Ne(t),Le(e,{name:t,fromWireType:function(e){return!!e},toWireType:function(e,t){return t?n:r},readValueFromPointer:function(e){return this.fromWireType(oe[e])},destructorFunction:null})},ze=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),Be=e=>{function t(e){return e.$$.ptrType.registeredClass.name}Fe(t(e)+` instance already deleted`)},Ve=!1,He=e=>{},Ue=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},We=e=>{--e.count.value,e.count.value===0&&Ue(e)},Ge=e=>globalThis.FinalizationRegistry?(Ve=new FinalizationRegistry(e=>{We(e.$$)}),Ge=e=>{var t=e.$$;if(t.smartPtr){var n={$$:t};Ve.register(e,n,e)}return e},He=e=>Ve.unregister(e),Ge(e)):(Ge=e=>e,e),Ke=[],qe=()=>{for(;Ke.length;){var e=Ke.pop();e.$$.deleteScheduled=!1,e.delete()}},Je,Ye=()=>{let e=Xe.prototype;Object.assign(e,{isAliasOf(e){if(!(this instanceof Xe)||!(e instanceof Xe))return!1;var t=this.$$.ptrType.registeredClass,n=this.$$.ptr;e.$$=e.$$;for(var r=e.$$.ptrType.registeredClass,i=e.$$.ptr;t.baseClass;)n=t.upcast(n),t=t.baseClass;for(;r.baseClass;)i=r.upcast(i),r=r.baseClass;return t===r&&n===i},clone(){if(this.$$.ptr||Be(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=Ge(Object.create(Object.getPrototypeOf(this),{$$:{value:ze(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||Be(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Fe(`Object already scheduled for deletion`),He(this),We(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Be(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Fe(`Object already scheduled for deletion`),Ke.push(this),Ke.length===1&&Je&&Je(qe),this.$$.deleteScheduled=!0,this}});let t=Symbol.dispose;t&&(e[t]=e.delete)};function Xe(){}var Ze=(e,t)=>Object.defineProperty(t,"name",{value:e}),Qe={},$e=(e,t,n)=>{if(e[t].overloadTable===void 0){var r=e[t];e[t]=function(){var r=[...arguments];return e[t].overloadTable.hasOwnProperty(r.length)||Fe(`Function '${n}' called with an invalid number of arguments (${r.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[r.length].apply(this,r)},e[t].overloadTable=[],e[t].overloadTable[r.argCount]=r}},et=(e,t,n)=>{i.hasOwnProperty(e)?((n===void 0||i[e].overloadTable!==void 0&&i[e].overloadTable[n]!==void 0)&&Fe(`Cannot register public name '${e}' twice`),$e(i,e,e),i[e].overloadTable.hasOwnProperty(n)&&Fe(`Cannot register multiple overloads of a function with the same number of arguments (${n})!`),i[e].overloadTable[n]=t):(i[e]=t,i[e].argCount=n)},tt=48,nt=57,rt=e=>{e=e.replace(/[^a-zA-Z0-9_]/g,`$`);var t=e.charCodeAt(0);return t>=tt&&t<=nt?`_${e}`:e};function it(e,t,n,r,i,a,o,s){this.name=e,this.constructor=t,this.instancePrototype=n,this.rawDestructor=r,this.baseClass=i,this.getActualType=a,this.upcast=o,this.downcast=s,this.pureVirtualFunctions=[]}var at=(e,t,n)=>{for(;t!==n;)t.upcast||Fe(`Expected null or instance of ${n.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e},ot=e=>{if(e===null)return`null`;var t=typeof e;return t===`object`||t===`array`||t===`function`?e.toString():``+e};function st(e,t){if(t===null)return this.isReference&&Fe(`null is not a valid ${this.name}`),0;t.$$||Fe(`Cannot pass "${ot(t)}" as a ${this.name}`),t.$$.ptr||Fe(`Cannot pass deleted object as a pointer of type ${this.name}`);var n=t.$$.ptrType.registeredClass;return at(t.$$.ptr,n,this.registeredClass)}function ct(e,t){var n;if(t===null)return this.isReference&&Fe(`null is not a valid ${this.name}`),this.isSmartPointer?(n=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,n),n):0;(!t||!t.$$)&&Fe(`Cannot pass "${ot(t)}" as a ${this.name}`),t.$$.ptr||Fe(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&Fe(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;if(n=at(t.$$.ptr,r,this.registeredClass),this.isSmartPointer)switch(t.$$.smartPtr===void 0&&Fe(`Passing raw pointer to smart pointer is illegal`),this.sharingPolicy){case 0:t.$$.smartPtrType===this?n=t.$$.smartPtr:Fe(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:n=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)n=t.$$.smartPtr;else{var i=t.clone();n=this.rawShare(n,zt.toHandle(()=>i.delete())),e!==null&&e.push(this.rawDestructor,n)}break;default:Fe(`Unsupported sharing policy`)}return n}function lt(e,t){if(t===null)return this.isReference&&Fe(`null is not a valid ${this.name}`),0;t.$$||Fe(`Cannot pass "${ot(t)}" as a ${this.name}`),t.$$.ptr||Fe(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&Fe(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var n=t.$$.ptrType.registeredClass;return at(t.$$.ptr,n,this.registeredClass)}var ut=(e,t,n)=>{if(t===n)return e;if(n.baseClass===void 0)return null;var r=ut(e,t,n.baseClass);return r===null?null:n.downcast(r)},dt={},ft=(e,t)=>{for(t===void 0&&Fe(`ptr should not be undefined`);e.baseClass;)t=e.upcast(t),e=e.baseClass;return t},pt=(e,t)=>(t=ft(e,t),dt[t]),mt=(e,t)=>((!t.ptrType||!t.ptr)&&Ae(`makeClassHandle requires ptr and ptrType`),!!t.smartPtrType!=!!t.smartPtr&&Ae(`Both smartPtrType and smartPtr must be specified`),t.count={value:1},Ge(Object.create(e,{$$:{value:t,writable:!0}})));function ht(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var n=pt(this.registeredClass,t);if(n!==void 0){if(n.$$.count.value===0)return n.$$.ptr=t,n.$$.smartPtr=e,n.clone();var r=n.clone();return this.destructor(e),r}function i(){return this.isSmartPointer?mt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):mt(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var a=Qe[this.registeredClass.getActualType(t)];if(!a)return i.call(this);var o=this.isConst?a.constPointerType:a.pointerType,s=ut(t,this.registeredClass,o.registeredClass);return s===null?i.call(this):this.isSmartPointer?mt(o.registeredClass.instancePrototype,{ptrType:o,ptr:s,smartPtrType:this,smartPtr:e}):mt(o.registeredClass.instancePrototype,{ptrType:o,ptr:s})}var gt=()=>{Object.assign(_t.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){var t;(t=this.rawDestructor)==null||t.call(this,e)},readValueFromPointer:Te,fromWireType:ht})};function _t(e,t,n,r,i,a,o,s,c,l,u){this.name=e,this.registeredClass=t,this.isReference=n,this.isConst=r,this.isSmartPointer=i,this.pointeeType=a,this.sharingPolicy=o,this.rawGetPointee=s,this.rawConstructor=c,this.rawShare=l,this.rawDestructor=u,!i&&t.baseClass===void 0?r?(this.toWireType=st,this.destructorFunction=null):(this.toWireType=lt,this.destructorFunction=null):this.toWireType=ct}var vt=(e,t,n)=>{i.hasOwnProperty(e)||Ae(`Replacing nonexistent public symbol`),i[e].overloadTable!==void 0&&n!==void 0?i[e].overloadTable[n]=t:(i[e]=t,i[e].argCount=n)},yt={},bt=(e,t,n)=>{e=e.replace(/p/g,`i`);var r=yt[e];return r(t,...n)},xt=[],St=e=>{var t=xt[e];return t||(xt[e]=t=nr.get(e)),t},Ct=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];if(arguments.length>3&&arguments[3]!==void 0&&arguments[3],e.includes(`j`))return bt(e,t,n);var r=St(t)(...n);function i(e){return e}return i(r)},wt=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0&&arguments[2];return function(){return Ct(e,t,[...arguments],n)}},Tt=function(e,t){arguments.length>2&&arguments[2]!==void 0&&arguments[2],e=Ne(e);function n(){return e.includes(`j`)?wt(e,t):St(t)}var r=n();return typeof r!=`function`&&Fe(`unknown function pointer with signature ${e}: ${t}`),r};class Et extends Error{}var Dt=e=>{var t=Vn(e),n=Ne(t);return Hn(t),n},Ot=(e,t)=>{var n=[],r={};function i(e){if(!r[e]&&!De[e]){if(Oe[e]){Oe[e].forEach(i);return}n.push(e),r[e]=!0}}throw t.forEach(i),new Et(`${e}: `+n.map(Dt).join([`, `]))},kt=(e,t,n,r,i,a,o,s,c,l,u,d,f)=>{u=Ne(u),a=Tt(i,a),s&&=Tt(o,s),l&&=Tt(c,l),f=Tt(d,f);var p=rt(u);et(p,function(){Ot(`Cannot construct ${u} due to unbound types`,[r])}),je([e,t,n],r?[r]:[],t=>{t=t[0];var n,i;r?(n=t.registeredClass,i=n.instancePrototype):i=Xe.prototype;var o=Ze(u,function(){if(Object.getPrototypeOf(this)!==c)throw new Pe(`Use 'new' to construct ${u}`);if(d.constructor_body===void 0)throw new Pe(`${u} has no accessible constructor`);var e=[...arguments],t=d.constructor_body[e.length];if(t===void 0)throw new Pe(`Tried to invoke ctor of ${u} with invalid number of parameters (${e.length}) - expected (${Object.keys(d.constructor_body).toString()}) parameters instead!`);return t.apply(this,e)}),c=Object.create(i,{constructor:{value:o}});o.prototype=c;var d=new it(u,o,c,f,n,a,s,l);if(d.baseClass){var m;(m=d.baseClass).__derivedClasses??(m.__derivedClasses=[]),d.baseClass.__derivedClasses.push(d)}var h=new _t(u,d,!0,!1,!1),g=new _t(u+`*`,d,!1,!1,!1),_=new _t(u+` const*`,d,!1,!0,!1);return Qe[e]={pointerType:g,constPointerType:_},vt(p,o),[h,g,_]})},At=(e,t)=>{for(var n=[],r=0;r<e;r++)n.push(N[t+r*4>>2]);return n};function jt(e){for(var t=1;t<e.length;++t)if(e[t]!==null&&e[t].destructorFunction===void 0)return!0;return!1}function Mt(e,t,n,r,i,a){var o=t.length;o<2&&Fe(`argTypes array size mismatch! Must at least get return value and 'this' types!`);var s=t[1]!==null&&n!==null,c=jt(t),l=!t[0].isVoid,u=o-2,d=Array(u),f=[],p=[];return Ze(e,function(){p.length=0;var e;f.length=s?2:1,f[0]=i,s&&(e=t[1].toWireType(p,this),f[1]=e);for(var n=0;n<u;++n)d[n]=t[n+2].toWireType(p,n<0||arguments.length<=n?void 0:arguments[n]),f.push(d[n]);var a=r(...f);function o(n){if(c)we(p);else for(var r=s?1:2;r<t.length;r++){var i=r===1?e:d[r-2];t[r].destructorFunction!==null&&t[r].destructorFunction(i)}if(l)return t[0].fromWireType(n)}return o(a)})}var Nt=(e,t,n,r,i,a)=>{var o=At(t,n);i=Tt(r,i),je([],[e],e=>{e=e[0];var n=`constructor ${e.name}`;if(e.registeredClass.constructor_body===void 0&&(e.registeredClass.constructor_body=[]),e.registeredClass.constructor_body[t-1]!==void 0)throw new Pe(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{Ot(`Cannot construct ${e.name} due to unbound types`,o)},je([],o,r=>(r.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Mt(n,r,null,i,a),[])),[]})},Pt=e=>{e=e.trim();let t=e.indexOf(`(`);return t===-1?e:e.slice(0,t)},Ft=(e,t,n,r,i,a,o,s,c,l)=>{var u=At(n,r);t=Ne(t),t=Pt(t),a=Tt(i,a,c),je([],[e],e=>{e=e[0];var r=`${e.name}.${t}`;t.startsWith(`@@`)&&(t=Symbol[t.substring(2)]),s&&e.registeredClass.pureVirtualFunctions.push(t);function i(){Ot(`Cannot call ${r} due to unbound types`,u)}var l=e.registeredClass.instancePrototype,d=l[t];return d===void 0||d.overloadTable===void 0&&d.className!==e.name&&d.argCount===n-2?(i.argCount=n-2,i.className=e.name,l[t]=i):($e(l,t,r),l[t].overloadTable[n-2]=i),je([],u,i=>{var s=Mt(r,i,e,a,o,c);return l[t].overloadTable===void 0?(s.argCount=n-2,l[t]=s):l[t].overloadTable[n-2]=s,[]}),[]})},It=[],Lt=[0,1,,1,null,1,!0,1,!1,1],Rt=e=>{e>9&&--Lt[e+1]===0&&(Lt[e]=void 0,It.push(e))},zt={toValue:e=>(e||Fe(`Cannot use deleted val. handle = ${e}`),Lt[e]),toHandle:e=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{let t=It.pop()||Lt.length;return Lt[t]=e,Lt[t+1]=1,t}}}},Bt={name:`emscripten::val`,fromWireType:e=>{var t=zt.toValue(e);return Rt(e),t},toWireType:(e,t)=>zt.toHandle(t),readValueFromPointer:Te,destructorFunction:null},Vt=e=>Le(e,Bt),Ht=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(re[e>>2])};case 8:return function(e){return this.fromWireType(ie[e>>3])};default:throw TypeError(`invalid float width (${t}): ${e}`)}},Ut=(e,t,n)=>{t=Ne(t),Le(e,{name:t,fromWireType:e=>e,toWireType:(e,t)=>t,readValueFromPointer:Ht(t,n),destructorFunction:null})},Wt=(e,t,n,r,i,a,o,s)=>{var c=At(t,n);e=Ne(e),e=Pt(e),i=Tt(r,i,o),et(e,function(){Ot(`Cannot call ${e} due to unbound types`,c)},t-1),je([],c,n=>{var r=[n[0],null].concat(n.slice(1));return vt(e,Mt(e,r,null,i,a,o),t-1),[]})},Gt=(e,t,n)=>{switch(t){case 1:return n?e=>ne[e]:e=>oe[e];case 2:return n?e=>j[e>>1]:e=>ae[e>>1];case 4:return n?e=>M[e>>2]:e=>N[e>>2];default:throw TypeError(`invalid integer width (${t}): ${e}`)}},Kt=(e,t,n,r,i)=>{t=Ne(t);let a=r===0,o=e=>e;if(a){var s=32-8*n;o=e=>e<<s>>>s,i=o(i)}Le(e,{name:t,fromWireType:o,toWireType:(e,t)=>t,readValueFromPointer:Gt(t,n,r!==0),destructorFunction:null})},qt=(e,t,n)=>{let r=(e,t)=>{let n=0;return{next(){if(n>=e)return{done:!0};let r=n;return n++,{value:t(r),done:!1}},[Symbol.iterator](){return this}}};e[Symbol.iterator]||(e[Symbol.iterator]=function(){return r(this[t](),e=>this[n](e))})},Jt=(e,t,n,r)=>{n=Ne(n),r=Ne(r),je([],[e,t],e=>{let t=e[0];return qt(t.registeredClass.instancePrototype,n,r),[]})},Yt=(e,t,n)=>{var r=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function i(e){var t=N[e>>2],n=N[e+4>>2];return new r(ne.buffer,n,t)}n=Ne(n),Le(e,{name:n,fromWireType:i,readValueFromPointer:i},{ignoreDuplicateRegistrations:!0})},Xt=Object.assign({optional:!0},Bt),Zt=(e,t)=>{Le(e,Xt)},Qt=(e,t,n,r)=>{if(!(r>0))return 0;for(var i=n,a=n+r-1,o=0;o<e.length;++o){var s=e.codePointAt(o);if(s<=127){if(n>=a)break;t[n++]=s}else if(s<=2047){if(n+1>=a)break;t[n++]=192|s>>6,t[n++]=128|s&63}else if(s<=65535){if(n+2>=a)break;t[n++]=224|s>>12,t[n++]=128|s>>6&63,t[n++]=128|s&63}else{if(n+3>=a)break;t[n++]=240|s>>18,t[n++]=128|s>>12&63,t[n++]=128|s>>6&63,t[n++]=128|s&63,o++}}return t[n]=0,n-i},$t=(e,t,n)=>Qt(e,oe,t,n),en=e=>{for(var t=0,n=0;n<e.length;++n){var r=e.charCodeAt(n);r<=127?t++:r<=2047?t+=2:r>=55296&&r<=57343?(t+=4,++n):t+=3}return t},tn=globalThis.TextDecoder&&new TextDecoder,nn=(e,t,n,r)=>{var i=t+n;if(r)return i;for(;e[t]&&!(t>=i);)++t;return t},rn=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;var i=nn(e,t,n,r);if(i-t>16&&e.buffer&&tn)return tn.decode(e.subarray(t,i));for(var a=``;t<i;){var o=e[t++];if(!(o&128)){a+=String.fromCharCode(o);continue}var s=e[t++]&63;if((o&224)==192){a+=String.fromCharCode((o&31)<<6|s);continue}var c=e[t++]&63;if(o=(o&240)==224?(o&15)<<12|s<<6|c:(o&7)<<18|s<<12|c<<6|e[t++]&63,o<65536)a+=String.fromCharCode(o);else{var l=o-65536;a+=String.fromCharCode(55296|l>>10,56320|l&1023)}}return a},an=(e,t,n)=>e?rn(oe,e,t,n):``,on=(e,t)=>{t=Ne(t);var n=!0;Le(e,{name:t,fromWireType(e){var t=N[e>>2],r=e+4,i;if(n)i=an(r,t,!0);else{i=``;for(var a=0;a<t;++a)i+=String.fromCharCode(oe[r+a])}return Hn(e),i},toWireType(e,t){t instanceof ArrayBuffer&&(t=new Uint8Array(t));var r,i=typeof t==`string`;i||ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT==1||Fe(`Cannot pass non-string to std::string`),r=n&&i?en(t):t.length;var a=Un(4+r+1),o=a+4;if(N[a>>2]=r,i)if(n)$t(t,o,r+1);else for(var s=0;s<r;++s){var c=t.charCodeAt(s);c>255&&(Hn(a),Fe(`String has UTF-16 code units that do not fit in 8 bits`)),oe[o+s]=c}else oe.set(t,o);return e!==null&&e.push(Hn,a),a},readValueFromPointer:Te,destructorFunction(e){Hn(e)}})},sn=globalThis.TextDecoder?new TextDecoder(`utf-16le`):void 0,cn=(e,t,n)=>{var r=e>>1,i=nn(ae,r,t/2,n);if(i-r>16&&sn)return sn.decode(ae.subarray(r,i));for(var a=``,o=r;o<i;++o){var s=ae[o];a+=String.fromCharCode(s)}return a},ln=(e,t,n)=>{if(n??=2147483647,n<2)return 0;n-=2;for(var r=t,i=n<e.length*2?n/2:e.length,a=0;a<i;++a){var o=e.charCodeAt(a);j[t>>1]=o,t+=2}return j[t>>1]=0,t-r},un=e=>e.length*2,dn=(e,t,n)=>{for(var r=``,i=e>>2,a=0;!(a>=t/4);a++){var o=N[i+a];if(!o&&!n)break;r+=String.fromCodePoint(o)}return r},fn=(e,t,n)=>{if(n??=2147483647,n<4)return 0;for(var r=t,i=r+n-4,a=0;a<e.length;++a){var o=e.codePointAt(a);if(o>65535&&a++,M[t>>2]=o,t+=4,t+4>i)break}return M[t>>2]=0,t-r},pn=e=>{for(var t=0,n=0;n<e.length;++n)e.codePointAt(n)>65535&&n++,t+=4;return t},mn=(e,t,n)=>{n=Ne(n);var r,i,a;t===2?(r=cn,i=ln,a=un):(r=dn,i=fn,a=pn),Le(e,{name:n,fromWireType:e=>{var n=N[e>>2],i=r(e+4,n*t,!0);return Hn(e),i},toWireType:(e,r)=>{typeof r!=`string`&&Fe(`Cannot pass non-string to C++ string type ${n}`);var o=a(r),s=Un(4+o+t);return N[s>>2]=o/t,i(r,s+4,o+t),e!==null&&e.push(Hn,s),s},readValueFromPointer:Te,destructorFunction(e){Hn(e)}})},hn=(e,t,n,r,i,a)=>{Ce[e]={name:Ne(t),rawConstructor:Tt(n,r),rawDestructor:Tt(i,a),fields:[]}},gn=(e,t,n,r,i,a,o,s,c,l)=>{Ce[e].fields.push({fieldName:Ne(t),getterReturnType:n,getter:Tt(r,i),getterContext:a,setterArgumentType:o,setter:Tt(s,c),setterContext:l})},_n=(e,t)=>{t=Ne(t),Le(e,{isVoid:!0,name:t,fromWireType:()=>void 0,toWireType:(e,t)=>void 0})},vn=[],yn=e=>{var t=vn.length;return vn.push(e),t},bn=(e,t)=>{var n=De[e];return n===void 0&&Fe(`${t} has unknown type ${Dt(e)}`),n},xn=(e,t)=>{for(var n=Array(e),r=0;r<e;++r)n[r]=bn(N[t+r*4>>2],`parameter ${r}`);return n},Sn=(e,t,n)=>{var r=[],i=e(r,n);return r.length&&(N[t>>2]=zt.toHandle(r)),i},Cn={},wn=e=>{var t=Cn[e];return t===void 0?Ne(e):t},Tn=(e,t,n)=>{var[r,...i]=xn(e,t),a=r.toWireType.bind(r),o=i.map(e=>e.readValueFromPointer.bind(e));e--;var s=Array(e);return yn(Ze(`methodCaller<(${i.map(e=>e.name)}) => ${r.name}>`,(t,r,i,c)=>{for(var l=0,u=0;u<e;++u)s[u]=o[u](c+l),l+=8;var d;switch(n){case 0:d=zt.toValue(t).apply(null,s);break;case 2:d=Reflect.construct(zt.toValue(t),s);break;case 3:d=s[0];break;case 1:d=zt.toValue(t)[wn(r)](...s);break}return Sn(a,i,d)}))},En=e=>e?(e=wn(e),zt.toHandle(globalThis[e])):zt.toHandle(globalThis),Dn=e=>{e>9&&(Lt[e+1]+=1)},On=(e,t,n,r,i)=>vn[e](t,n,r,i),kn=e=>{we(zt.toValue(e)),Rt(e)},An=(e,t,n,r)=>{var i=new Date().getFullYear(),a=new Date(i,0,1),o=new Date(i,6,1),s=a.getTimezoneOffset(),c=o.getTimezoneOffset(),l=Math.max(s,c);N[e>>2]=l*60,M[t>>2]=Number(s!=c);var u=e=>{var t=e>=0?`-`:`+`,n=Math.abs(e);return`UTC${t}${String(Math.floor(n/60)).padStart(2,`0`)}${String(n%60).padStart(2,`0`)}`},d=u(s),f=u(c);c<s?($t(d,n,17),$t(f,r,17)):($t(d,r,17),$t(f,n,17))},jn=()=>2147483648,Mn=(e,t)=>Math.ceil(e/t)*t,Nn=e=>{var t=(e-tr.buffer.byteLength+65535)/65536|0;try{return tr.grow(t),b(),1}catch{}},Pn=e=>{var t=oe.length;e>>>=0;var n=jn();if(e>n)return!1;for(var r=1;r<=4;r*=2){var i=t*(1+.2/r);if(i=Math.min(i,e+100663296),Nn(Math.min(n,Mn(Math.max(e,i),65536))))return!0}return!1},Fn={},In=()=>c||`./this.program`,Ln=()=>{if(!Ln.strings){var e={USER:`web_user`,LOGNAME:`web_user`,PATH:`/`,PWD:`/`,HOME:`/home/web_user`,LANG:(globalThis.navigator?.language??`C`).replace(`-`,`_`)+`.UTF-8`,_:In()};for(var t in Fn)Fn[t]===void 0?delete e[t]:e[t]=Fn[t];var n=[];for(var t in e)n.push(`${t}=${e[t]}`);Ln.strings=n}return Ln.strings},Rn=(e,t)=>{var n=0,r=0;for(var i of Ln()){var a=t+n;N[e+r>>2]=a,n+=$t(i,a,1/0)+1,r+=4}return 0},zn=(e,t)=>{var n=Ln();N[e>>2]=n.length;var r=0;for(var i of n)r+=en(i)+1;return N[t>>2]=r,0},Bn=e=>e;if(Ye(),gt(),i.noExitRuntime&&i.noExitRuntime,i.print&&i.print,i.printErr&&(m=i.printErr),i.wasmBinary&&(h=i.wasmBinary),i.arguments&&i.arguments,i.thisProgram&&(c=i.thisProgram),i.preInit)for(typeof i.preInit==`function`&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.shift()();var Vn,Hn,Un,Wn,Gn,Kn,qn,Jn,Yn,Xn,Zn,Qn,$n,er,tr,nr;function rr(e){Vn=e.za,Hn=i._free=e.Aa,Un=i._malloc=e.Ca,Wn=e.Da,Gn=e.Ea,Kn=e.Fa,qn=e.Ga,Jn=e.Ha,Yn=e.Ia,Xn=e.Ja,Zn=e.Ka,yt.viijii=e.La,Qn=yt.viijjijjjjjj=e.Ma,$n=yt.iiijj=e.Na,er=yt.jiiii=e.Oa,yt.iiiiij=e.Pa,yt.iiiiijj=e.Qa,yt.iiiiiijj=e.Ra,tr=e.xa,nr=e.Ba}var ir={q:pe,x:L,a:ve,i:ye,m:be,S:xe,p:Se,fa:R,d:z,ba:B,ua:V,aa:Me,oa:Re,sa:kt,ra:Nt,H:Ft,ma:Vt,X:Ut,Y:Wt,A:Kt,qa:Jt,u:Yt,ta:Zt,na:on,T:mn,I:hn,va:gn,pa:_n,O:Tn,wa:Rt,F:En,U:Dn,N:On,ha:kn,ca:An,ga:Pn,da:Rn,ea:zn,ka:Tr,M:Or,B:Pr,P:fr,V:Ir,s:Lr,b:sr,C:Dr,ia:Mr,c:lr,Q:Nr,h:dr,j:vr,r:yr,R:Er,t:xr,G:Sr,D:Cr,K:Rr,_:Vr,Z:Hr,f:pr,l:ar,e:cr,W:kr,g:ur,L:Fr,k:or,ja:Ar,o:br,y:hr,v:wr,E:_r,w:jr,n:mr,J:zr,la:gr,$:Br,z:Bn};function ar(e,t){var n=I();try{St(e)(t)}catch(e){if(F(n),e!==e+0)throw e;Gn(1,0)}}function or(e,t,n,r,i){var a=I();try{St(e)(t,n,r,i)}catch(e){if(F(a),e!==e+0)throw e;Gn(1,0)}}function sr(e,t){var n=I();try{return St(e)(t)}catch(e){if(F(n),e!==e+0)throw e;Gn(1,0)}}function cr(e,t,n){var r=I();try{St(e)(t,n)}catch(e){if(F(r),e!==e+0)throw e;Gn(1,0)}}function lr(e,t,n){var r=I();try{return St(e)(t,n)}catch(e){if(F(r),e!==e+0)throw e;Gn(1,0)}}function ur(e,t,n,r){var i=I();try{St(e)(t,n,r)}catch(e){if(F(i),e!==e+0)throw e;Gn(1,0)}}function dr(e,t,n,r){var i=I();try{return St(e)(t,n,r)}catch(e){if(F(i),e!==e+0)throw e;Gn(1,0)}}function fr(e,t,n,r,i,a){var o=I();try{return St(e)(t,n,r,i,a)}catch(e){if(F(o),e!==e+0)throw e;Gn(1,0)}}function pr(e){var t=I();try{St(e)()}catch(e){if(F(t),e!==e+0)throw e;Gn(1,0)}}function mr(e,t,n,r,i,a,o,s,c,l,u){var d=I();try{St(e)(t,n,r,i,a,o,s,c,l,u)}catch(e){if(F(d),e!==e+0)throw e;Gn(1,0)}}function hr(e,t,n,r,i,a,o){var s=I();try{St(e)(t,n,r,i,a,o)}catch(e){if(F(s),e!==e+0)throw e;Gn(1,0)}}function gr(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g){var _=I();try{St(e)(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g)}catch(e){if(F(_),e!==e+0)throw e;Gn(1,0)}}function _r(e,t,n,r,i,a,o,s,c){var l=I();try{St(e)(t,n,r,i,a,o,s,c)}catch(e){if(F(l),e!==e+0)throw e;Gn(1,0)}}function vr(e,t,n,r,i){var a=I();try{return St(e)(t,n,r,i)}catch(e){if(F(a),e!==e+0)throw e;Gn(1,0)}}function yr(e,t,n,r,i,a){var o=I();try{return St(e)(t,n,r,i,a)}catch(e){if(F(o),e!==e+0)throw e;Gn(1,0)}}function br(e,t,n,r,i,a){var o=I();try{St(e)(t,n,r,i,a)}catch(e){if(F(o),e!==e+0)throw e;Gn(1,0)}}function xr(e,t,n,r,i,a,o){var s=I();try{return St(e)(t,n,r,i,a,o)}catch(e){if(F(s),e!==e+0)throw e;Gn(1,0)}}function Sr(e,t,n,r,i,a,o,s){var c=I();try{return St(e)(t,n,r,i,a,o,s)}catch(e){if(F(c),e!==e+0)throw e;Gn(1,0)}}function Cr(e,t,n,r,i,a,o,s,c){var l=I();try{return St(e)(t,n,r,i,a,o,s,c)}catch(e){if(F(l),e!==e+0)throw e;Gn(1,0)}}function wr(e,t,n,r,i,a,o,s){var c=I();try{St(e)(t,n,r,i,a,o,s)}catch(e){if(F(c),e!==e+0)throw e;Gn(1,0)}}function Tr(e,t,n){var r=I();try{return St(e)(t,n)}catch(e){if(F(r),e!==e+0)throw e;Gn(1,0)}}function Er(e,t,n,r,i,a,o){var s=I();try{return St(e)(t,n,r,i,a,o)}catch(e){if(F(s),e!==e+0)throw e;Gn(1,0)}}function Dr(e,t,n,r){var i=I();try{return St(e)(t,n,r)}catch(e){if(F(i),e!==e+0)throw e;Gn(1,0)}}function Or(e,t,n,r){var i=I();try{return St(e)(t,n,r)}catch(e){if(F(i),e!==e+0)throw e;Gn(1,0)}}function kr(e,t,n,r,i,a,o,s,c){var l=I();try{St(e)(t,n,r,i,a,o,s,c)}catch(e){if(F(l),e!==e+0)throw e;Gn(1,0)}}function Ar(e,t,n,r,i,a,o,s){var c=I();try{St(e)(t,n,r,i,a,o,s)}catch(e){if(F(c),e!==e+0)throw e;Gn(1,0)}}function jr(e,t,n,r,i,a,o,s,c,l){var u=I();try{St(e)(t,n,r,i,a,o,s,c,l)}catch(e){if(F(u),e!==e+0)throw e;Gn(1,0)}}function Mr(e,t,n){var r=I();try{return St(e)(t,n)}catch(e){if(F(r),e!==e+0)throw e;Gn(1,0)}}function Nr(e,t,n,r,i){var a=I();try{return St(e)(t,n,r,i)}catch(e){if(F(a),e!==e+0)throw e;Gn(1,0)}}function Pr(e,t,n,r,i,a){var o=I();try{return St(e)(t,n,r,i,a)}catch(e){if(F(o),e!==e+0)throw e;Gn(1,0)}}function Fr(e,t,n,r,i,a,o){var s=I();try{St(e)(t,n,r,i,a,o)}catch(e){if(F(s),e!==e+0)throw e;Gn(1,0)}}function Ir(e,t,n,r){var i=I();try{return St(e)(t,n,r)}catch(e){if(F(i),e!==e+0)throw e;Gn(1,0)}}function Lr(e){var t=I();try{return St(e)()}catch(e){if(F(t),e!==e+0)throw e;Gn(1,0)}}function Rr(e,t,n,r,i,a,o,s,c,l,u,d){var f=I();try{return St(e)(t,n,r,i,a,o,s,c,l,u,d)}catch(e){if(F(f),e!==e+0)throw e;Gn(1,0)}}function zr(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){var g=I();try{St(e)(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h)}catch(e){if(F(g),e!==e+0)throw e;Gn(1,0)}}function Br(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y){var b=I();try{Qn(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y)}catch(e){if(F(b),e!==e+0)throw e;Gn(1,0)}}function Vr(e,t,n,r,i,a,o){var s=I();try{return $n(e,t,n,r,i,a,o)}catch(e){if(F(s),e!==e+0)throw e;Gn(1,0)}}function Hr(e,t,n,r,i){var a=I();try{return er(e,t,n,r,i)}catch(e){if(F(a),e!==e+0)throw e;Gn(1,0)}}function Ur(){x();function e(){var e,t;i.calledRun=!0,!g&&(S(),(e=_)==null||e(i),(t=i.onRuntimeInitialized)==null||t.call(i),C())}i.setStatus?(i.setStatus(`Running...`),setTimeout(()=>{setTimeout(()=>i.setStatus(``),1),e()},1)):e()}var Wr=await A();return Ur(),t=y?i:new Promise((e,t)=>{_=e,v=t}),t}function gG(e){return fG(hG,e)}async function _G(e,t){return mG(hG,e,t)}var vG=[[`aztec`,`Aztec`],[`aztec_code`,`AztecCode`],[`aztec_rune`,`AztecRune`],[`code_128`,`Code128`],[`code_39`,`Code39`],[`code_39_standard`,`Code39Std`],[`code_39_extended`,`Code39Ext`],[`code_32`,`Code32`],[`pzn`,`PZN`],[`code_93`,`Code93`],[`codabar`,`Codabar`],[`databar`,`DataBar`],[`databar_omni`,`DataBarOmni`],[`databar_stacked`,`DataBarStk`],[`databar_stacked_omni`,`DataBarStkOmni`],[`databar_expanded`,`DataBarExp`],[`databar_expanded_stacked`,`DataBarExpStk`],[`databar_limited`,`DataBarLtd`],[`data_matrix`,`DataMatrix`],[`dx_film_edge`,`DXFilmEdge`],[`ean_13`,`EAN13`],[`ean_upc`,`EANUPC`],[`isbn`,`ISBN`],[`ean_8`,`EAN8`],[`itf`,`ITF`],[`itf_14`,`ITF14`],[`maxi_code`,`MaxiCode`],[`micro_qr_code`,`MicroQRCode`],[`pdf417`,`PDF417`],[`compact_pdf417`,`CompactPDF417`],[`micro_pdf417`,`MicroPDF417`],[`qr_code`,`QRCode`],[`qr_code_model_1`,`QRCodeModel1`],[`qr_code_model_2`,`QRCodeModel2`],[`rm_qr_code`,`RMQRCode`],[`upc_a`,`UPCA`],[`upc_e`,`UPCE`],[`telepen`,`Telepen`],[`telepen_alpha`,`TelepenAlpha`],[`telepen_numeric`,`TelepenNumeric`],[`other_barcode`,`OtherBarcode`],[`linear_codes`,`AllLinear`],[`matrix_codes`,`AllMatrix`],[`gs1_codes`,`AllGS1`],[`retail_codes`,`AllRetail`],[`industrial_codes`,`AllIndustrial`],[`any`,`All`]],yG=[...vG,[`unknown`]].map(e=>e[0]),bG=new Map(vG);function xG(e){for(let[t,n]of bG)if(e===n)return t;return`unknown`}function SG(e){if(CG(e))return{width:e.naturalWidth,height:e.naturalHeight};if(wG(e))return{width:e.width.baseVal.value,height:e.height.baseVal.value};if(TG(e))return{width:e.videoWidth,height:e.videoHeight};if(DG(e))return{width:e.width,height:e.height};if(kG(e))return{width:e.displayWidth,height:e.displayHeight};if(EG(e)||OG(e))return{width:e.width,height:e.height};throw TypeError(`The provided value is not of type '(Blob or HTMLCanvasElement or HTMLImageElement or HTMLVideoElement or ImageBitmap or ImageData or OffscreenCanvas or SVGImageElement or VideoFrame)'.`)}function CG(e){try{var t;return e instanceof(e==null||(t=e.ownerDocument)==null||(t=t.defaultView)==null?void 0:t.HTMLImageElement)}catch{return!1}}function wG(e){try{var t;return e instanceof(e==null||(t=e.ownerDocument)==null||(t=t.defaultView)==null?void 0:t.SVGImageElement)}catch{return!1}}function TG(e){try{var t;return e instanceof(e==null||(t=e.ownerDocument)==null||(t=t.defaultView)==null?void 0:t.HTMLVideoElement)}catch{return!1}}function EG(e){try{var t;return e instanceof(e==null||(t=e.ownerDocument)==null||(t=t.defaultView)==null?void 0:t.HTMLCanvasElement)}catch{return!1}}function DG(e){try{return e instanceof ImageBitmap||Object.prototype.toString.call(e)===`[object ImageBitmap]`}catch{return!1}}function OG(e){try{return e instanceof OffscreenCanvas||Object.prototype.toString.call(e)===`[object OffscreenCanvas]`}catch{return!1}}function kG(e){try{return e instanceof VideoFrame||Object.prototype.toString.call(e)===`[object VideoFrame]`}catch{return!1}}function AG(e){try{return e instanceof Blob||Object.prototype.toString.call(e)===`[object Blob]`}catch{return!1}}function jG(e){try{return e instanceof ImageData||Object.prototype.toString.call(e)===`[object ImageData]`}catch{return!1}}function MG(e,t){try{let n=new OffscreenCanvas(e,t);if(n.getContext(`2d`)instanceof OffscreenCanvasRenderingContext2D)return n;throw void 0}catch{let n=document.createElement(`canvas`);return n.width=e,n.height=t,n}}async function NG(e){if(CG(e)&&!await LG(e))throw new DOMException(`Failed to load or decode HTMLImageElement.`,`InvalidStateError`);if(wG(e)&&!await RG(e))throw new DOMException(`Failed to load or decode SVGImageElement.`,`InvalidStateError`);if(kG(e)&&zG(e))throw new DOMException(`VideoFrame is closed.`,`InvalidStateError`);if(TG(e)&&(e.readyState===0||e.readyState===1))throw new DOMException(`Invalid element or state.`,`InvalidStateError`);if(DG(e)&&VG(e))throw new DOMException(`The image source is detached.`,`InvalidStateError`);let{width:t,height:n}=SG(e);if(t===0||n===0)return null;let r=MG(t,n).getContext(`2d`);r.drawImage(e,0,0);try{return r.getImageData(0,0,t,n)}catch{throw new DOMException(`Source would taint origin.`,`SecurityError`)}}async function PG(e){let t;try{t=await createImageBitmap(e)}catch{try{if(globalThis.Image){t=new Image;let n=``;try{n=URL.createObjectURL(e),t.src=n,await t.decode()}finally{URL.revokeObjectURL(n)}}else return e}catch{throw new DOMException(`Failed to load or decode Blob.`,`InvalidStateError`)}}return await NG(t)}function FG(e){let{width:t,height:n}=e;if(t===0||n===0)return null;let r=e.getContext(`2d`);try{return r.getImageData(0,0,t,n)}catch{throw new DOMException(`Source would taint origin.`,`SecurityError`)}}async function IG(e){if(AG(e))return await PG(e);if(jG(e)){if(BG(e))throw new DOMException(`The image data has been detached.`,`InvalidStateError`);return e}return EG(e)||OG(e)?FG(e):await NG(e)}async function LG(e){try{return await e.decode(),!0}catch{return!1}}async function RG(e){try{return await e.decode?.call(e),!0}catch{return!1}}function zG(e){return e.format===null}function BG(e){return e.data.buffer.byteLength===0}function VG(e){return e.width===0&&e.height===0}function HG(e,t){return UG(e)?new DOMException(`${t}: ${e.message}`,e.name):WG(e)?new e.constructor(`${t}: ${e.message}`):Error(`${t}: ${e}`)}function UG(e){return e instanceof DOMException||Object.prototype.toString.call(e)===`[object DOMException]`}function WG(e){return e instanceof Error||Object.prototype.toString.call(e)===`[object Error]`}function GG(e,t){if(t.has(e))throw TypeError(`Cannot initialize the same private elements twice on an object`)}function KG(e,t,n){GG(e,t),t.set(e,n)}function qG(e,t,n){if(typeof e==`function`?e===t:e.has(t))return arguments.length<3?t:n;throw TypeError(`Private element is not present on this object`)}function JG(e,t,n){return e.set(qG(e,t),n),n}function YG(e,t){return e.get(qG(e,t))}var XG=new WeakMap,ZG=class{constructor(e={}){KG(this,XG,void 0);try{var t;let n=e==null||(t=e.formats)==null?void 0:t.filter(e=>e!==`unknown`);if(n?.length===0)throw TypeError(`Hint option provided, but is empty.`);for(let e of n??[])if(!bG.has(e))throw TypeError(`Failed to read the 'formats' property from 'BarcodeDetectorOptions': The provided value '${e}' is not a valid enum value of type BarcodeFormat.`);JG(XG,this,n??[]),gG({fireImmediately:!0}).catch(()=>{})}catch(e){throw HG(e,`Failed to construct 'BarcodeDetector'`)}}static async getSupportedFormats(){return yG.filter(e=>e!==`unknown`)}async detect(e){try{let t=await IG(e);if(t===null)return[];let n,r={textMode:`Plain`,formats:YG(XG,this).map(e=>bG.get(e))};try{n=await _G(t,r)}catch(e){throw console.error(e),new DOMException(`Barcode detection service unavailable.`,`NotSupportedError`)}return n.map(e=>{let{topLeft:{x:t,y:n},topRight:{x:r,y:i},bottomLeft:{x:a,y:o},bottomRight:{x:s,y:c}}=e.position,l=Math.min(t,r,a,s),u=Math.min(n,i,o,c),d=Math.max(t,r,a,s),f=Math.max(n,i,o,c);return{boundingBox:new DOMRectReadOnly(l,u,d-l,f-u),rawValue:e.text,format:xG(e.format),cornerPoints:[{x:t,y:n},{x:r,y:i},{x:s,y:c},{x:a,y:o}]}})}catch(e){throw HG(e,`Failed to execute 'detect' on 'BarcodeDetector'`)}}},QG=!0,$G=!0;function eK(e,t,n){let r=e.match(t);return r&&r.length>=n&&parseFloat(r[n],10)}function tK(e,t,n){if(!e.RTCPeerConnection)return;if(!Object.getOwnPropertyDescriptor(EventTarget.prototype,`addEventListener`).writable){iK(`Unable to polyfill events`);return}let r=e.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return i.apply(this,arguments);let a=e=>{let t=n(e);t&&(r.handleEvent?r.handleEvent(t):r(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(r,a),i.apply(this,[e,a])};let a=r.removeEventListener;r.removeEventListener=function(e,n){if(e!==t||!this._eventMap||!this._eventMap[t]||!this._eventMap[t].has(n))return a.apply(this,arguments);let r=this._eventMap[t].get(n);return this._eventMap[t].delete(n),this._eventMap[t].size===0&&delete this._eventMap[t],Object.keys(this._eventMap).length===0&&delete this._eventMap,a.apply(this,[e,r])},Object.defineProperty(r,`on`+t,{get(){return this[`_on`+t]},set(e){this[`_on`+t]&&(this.removeEventListener(t,this[`_on`+t]),delete this[`_on`+t]),e&&this.addEventListener(t,this[`_on`+t]=e)},enumerable:!0,configurable:!0})}function nK(e){return typeof e==`boolean`?(QG=e,e?`adapter.js logging disabled`:`adapter.js logging enabled`):Error(`Argument type: `+typeof e+`. Please use a boolean.`)}function rK(e){return typeof e==`boolean`?($G=!e,`adapter.js deprecation warnings `+(e?`disabled`:`enabled`)):Error(`Argument type: `+typeof e+`. Please use a boolean.`)}function iK(){if(typeof window==`object`){if(QG)return;typeof console<`u`&&typeof console.log==`function`&&console.log.apply(console,arguments)}}function aK(e,t){$G&&console.warn(e+` is deprecated, please use `+t+` instead.`)}function oK(e){let t={browser:null,version:null};if(e===void 0||!e.navigator||!e.navigator.userAgent)return t.browser=`Not a browser.`,t;let{navigator:n}=e;if(n.userAgentData&&n.userAgentData.brands){let e=n.userAgentData.brands.find(e=>e.brand===`Chromium`);if(e){let t=parseInt(e.version,10);if(t>=90)return{browser:`chrome`,version:t}}}if(n.mozGetUserMedia)t.browser=`firefox`,t.version=parseInt(eK(n.userAgent,/Firefox\/(\d+)\./,1));else if(n.webkitGetUserMedia||e.isSecureContext===!1&&e.webkitRTCPeerConnection)t.browser=`chrome`,t.version=parseInt(eK(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2))||null;else if(e.RTCPeerConnection&&n.userAgent.match(/AppleWebKit\/(\d+)\./))t.browser=`safari`,t.version=parseInt(eK(n.userAgent,/AppleWebKit\/(\d+)\./,1)),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&`currentDirection`in e.RTCRtpTransceiver.prototype,t._safariVersion=eK(n.userAgent,/Version\/(\d+(\.?\d+))/,1);else return t.browser=`Not a supported browser.`,t;return t}function sK(e){return Object.prototype.toString.call(e)===`[object Object]`}function cK(e){return sK(e)?Object.keys(e).reduce(function(t,n){let r=sK(e[n]),i=r?cK(e[n]):e[n],a=r&&!Object.keys(i).length;return i===void 0||a?t:Object.assign(t,{[n]:i})},{}):e}function lK(e,t,n){!t||n.has(t.id)||(n.set(t.id,t),Object.keys(t).forEach(r=>{r.endsWith(`Id`)?lK(e,e.get(t[r]),n):r.endsWith(`Ids`)&&t[r].forEach(t=>{lK(e,e.get(t),n)})}))}function uK(e,t,n){let r=n?`outbound-rtp`:`inbound-rtp`,i=new Map;if(t===null)return i;let a=[];return e.forEach(e=>{e.type===`track`&&e.trackIdentifier===t.id&&a.push(e)}),a.forEach(t=>{e.forEach(n=>{n.type===r&&n.trackId===t.id&&lK(e,n,i)})}),i}var dK=iK;function fK(e,t){if(t.version>=64)return;let n=e&&e.navigator;if(!n.mediaDevices)return;let r=function(e){if(typeof e!=`object`||e.mandatory||e.optional)return e;let t={};return Object.keys(e).forEach(n=>{if(n===`require`||n===`advanced`||n===`mediaSource`)return;let r=typeof e[n]==`object`?e[n]:{ideal:e[n]};r.exact!==void 0&&typeof r.exact==`number`&&(r.min=r.max=r.exact);let i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):t===`deviceId`?`sourceId`:t};if(r.ideal!==void 0){t.optional=t.optional||[];let e={};typeof r.ideal==`number`?(e[i(`min`,n)]=r.ideal,t.optional.push(e),e={},e[i(`max`,n)]=r.ideal,t.optional.push(e)):(e[i(``,n)]=r.ideal,t.optional.push(e))}r.exact!==void 0&&typeof r.exact!=`number`?(t.mandatory=t.mandatory||{},t.mandatory[i(``,n)]=r.exact):[`min`,`max`].forEach(e=>{r[e]!==void 0&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,n)]=r[e])})}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if(e=JSON.parse(JSON.stringify(e)),e&&typeof e.audio==`object`){let t=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])};e=JSON.parse(JSON.stringify(e)),t(e.audio,`autoGainControl`,`googAutoGainControl`),t(e.audio,`noiseSuppression`,`googNoiseSuppression`),e.audio=r(e.audio)}if(e&&typeof e.video==`object`){let a=e.video.facingMode;a&&=typeof a==`object`?a:{ideal:a};let o=t.version<66;if(a&&(a.exact===`user`||a.exact===`environment`||a.ideal===`user`||a.ideal===`environment`)&&!(n.mediaDevices.getSupportedConstraints&&n.mediaDevices.getSupportedConstraints().facingMode&&!o)){delete e.video.facingMode;let t;if(a.exact===`environment`||a.ideal===`environment`?t=[`back`,`rear`]:(a.exact===`user`||a.ideal===`user`)&&(t=[`front`]),t)return n.mediaDevices.enumerateDevices().then(n=>{n=n.filter(e=>e.kind===`videoinput`);let o=n.find(e=>t.some(t=>e.label.toLowerCase().includes(t)));return!o&&n.length&&t.includes(`back`)&&(o=n[n.length-1]),o&&(e.video.deviceId=a.exact?{exact:o.deviceId}:{ideal:o.deviceId}),e.video=r(e.video),dK(`chrome: `+JSON.stringify(e)),i(e)})}e.video=r(e.video)}return dK(`chrome: `+JSON.stringify(e)),i(e)},a=function(e){return t.version>=64?e:{name:{PermissionDeniedError:`NotAllowedError`,PermissionDismissedError:`NotAllowedError`,InvalidStateError:`NotAllowedError`,DevicesNotFoundError:`NotFoundError`,ConstraintNotSatisfiedError:`OverconstrainedError`,TrackStartError:`NotReadableError`,MediaDeviceFailedDueToShutdown:`NotAllowedError`,MediaDeviceKillSwitchOn:`NotAllowedError`,TabCaptureError:`AbortError`,ScreenCaptureError:`AbortError`,DeviceCaptureError:`AbortError`}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&`: `)+this.message}}};if(n.getUserMedia=function(e,t,r){i(e,e=>{n.webkitGetUserMedia(e,t,e=>{r&&r(a(e))})})}.bind(n),n.mediaDevices.getUserMedia){let e=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(t){return i(t,t=>e(t).then(e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach(e=>{e.stop()}),new DOMException(``,`NotFoundError`);return e},e=>Promise.reject(a(e))))}}}var pK=s({fixNegotiationNeeded:()=>xK,shimAddTrackRemoveTrack:()=>yK,shimAddTrackRemoveTrackWithNative:()=>vK,shimGetSendersWithDtmf:()=>gK,shimGetUserMedia:()=>fK,shimMediaStream:()=>mK,shimOnTrack:()=>hK,shimPeerConnection:()=>bK,shimSenderReceiverGetStats:()=>_K});function mK(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function hK(e,t){if(!(t.version>102))if(typeof e==`object`&&e.RTCPeerConnection&&!(`ontrack`in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener(`track`,this._ontrack),this.addEventListener(`track`,this._ontrack=e)},enumerable:!0,configurable:!0});let t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener(`addtrack`,n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.track.id):{track:n.track};let i=new Event(`track`);i.track=n.track,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)}),t.stream.getTracks().forEach(n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.id):{track:n};let i=new Event(`track`);i.track=n,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)})},this.addEventListener(`addstream`,this._ontrackpoly)),t.apply(this,arguments)}}else tK(e,`track`,e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function gK(e){if(typeof e==`object`&&e.RTCPeerConnection&&!(`getSenders`in e.RTCPeerConnection.prototype)&&`createDTMFSender`in e.RTCPeerConnection.prototype){let t=function(e,t){return{track:t,get dtmf(){return this._dtmf===void 0&&(t.kind===`audio`?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};let n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){let i=n.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};let r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){r.apply(this,arguments);let t=this._senders.indexOf(e);t!==-1&&this._senders.splice(t,1)}}let n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach(e=>{this._senders.push(t(this,e))})};let r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach(e=>{let t=this._senders.find(t=>t.track===e);t&&this._senders.splice(this._senders.indexOf(t),1)})}}else if(typeof e==`object`&&e.RTCPeerConnection&&`getSenders`in e.RTCPeerConnection.prototype&&`createDTMFSender`in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!(`dtmf`in e.RTCRtpSender.prototype)){let t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind===`audio`?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function _K(e,t){if(t.version>=67||!(typeof e==`object`&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!(`getStats`in e.RTCRtpSender.prototype)){let t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});let n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){let e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){let e=this;return this._pc.getStats().then(t=>uK(t,e.track,!0))}}if(!(`getStats`in e.RTCRtpReceiver.prototype)){let t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),tK(e,`track`,e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){let e=this;return this._pc.getStats().then(t=>uK(t,e.track,!1))}}if(!(`getStats`in e.RTCRtpSender.prototype&&`getStats`in e.RTCRtpReceiver.prototype))return;let n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){let e=arguments[0],t,n,r;return this.getSenders().forEach(n=>{n.track===e&&(t?r=!0:t=n)}),this.getReceivers().forEach(t=>(t.track===e&&(n?r=!0:n=t),t.track===e)),r||t&&n?Promise.reject(new DOMException(`There are more than one sender or receiver for the track.`,`InvalidAccessError`)):t?t.getStats():n?n.getStats():Promise.reject(new DOMException(`There is no sender or receiver for the track.`,`InvalidAccessError`))}return n.apply(this,arguments)}}function vK(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(e=>this._shimmedLocalStreams[e][0])};let t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){if(!n)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};let r=t.apply(this,arguments);return this._shimmedLocalStreams[n.id]?this._shimmedLocalStreams[n.id].indexOf(r)===-1&&this._shimmedLocalStreams[n.id].push(r):this._shimmedLocalStreams[n.id]=[n,r],r};let n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException(`Track already exists.`,`InvalidAccessError`)});let t=this.getSenders();n.apply(this,arguments);let r=this.getSenders().filter(e=>t.indexOf(e)===-1);this._shimmedLocalStreams[e.id]=[e].concat(r)};let r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],r.apply(this,arguments)};let i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach(t=>{let n=this._shimmedLocalStreams[t].indexOf(e);n!==-1&&this._shimmedLocalStreams[t].splice(n,1),this._shimmedLocalStreams[t].length===1&&delete this._shimmedLocalStreams[t]}),i.apply(this,arguments)}}function yK(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return vK(e);let n=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){let e=n.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map(e=>this._reverseStreams[e.id])};let r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException(`Track already exists.`,`InvalidAccessError`)}),!this._reverseStreams[t.id]){let n=new e.MediaStream(t.getTracks());this._streams[t.id]=n,this._reverseStreams[n.id]=t,t=n}r.apply(this,[t])};let i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,n){if(this.signalingState===`closed`)throw new DOMException(`The RTCPeerConnection's signalingState is 'closed'.`,`InvalidStateError`);let r=[].slice.call(arguments,1);if(r.length!==1||!r[0].getTracks().find(e=>e===t))throw new DOMException(`The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.`,`NotSupportedError`);if(this.getSenders().find(e=>e.track===t))throw new DOMException(`Track already exists.`,`InvalidAccessError`);this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};let i=this._streams[n.id];if(i)i.addTrack(t),Promise.resolve().then(()=>{this.dispatchEvent(new Event(`negotiationneeded`))});else{let r=new e.MediaStream([t]);this._streams[n.id]=r,this._reverseStreams[r.id]=n,this.addStream(r)}return this.getSenders().find(e=>e.track===t)};function a(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{let r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(i.id,`g`),r.id)}),new RTCSessionDescription({type:t.type,sdp:n})}function o(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{let r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(r.id,`g`),i.id)}),new RTCSessionDescription({type:t.type,sdp:n})}[`createOffer`,`createAnswer`].forEach(function(t){let n=e.RTCPeerConnection.prototype[t],r={[t](){let e=arguments;return arguments.length&&typeof arguments[0]==`function`?n.apply(this,[t=>{let n=a(this,t);e[0].apply(null,[n])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):n.apply(this,arguments).then(e=>a(this,e))}};e.RTCPeerConnection.prototype[t]=r[t]});let s=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type||(arguments[0]=o(this,arguments[0])),s.apply(this,arguments)};let c=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,`localDescription`);Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){let e=c.get.apply(this);return e.type===``?e:a(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if(this.signalingState===`closed`)throw new DOMException(`The RTCPeerConnection's signalingState is 'closed'.`,`InvalidStateError`);if(!e._pc)throw new DOMException(`Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.`,`TypeError`);if(e._pc!==this)throw new DOMException(`Sender was not created by this connection.`,`InvalidAccessError`);this._streams=this._streams||{};let t;Object.keys(this._streams).forEach(n=>{this._streams[n].getTracks().find(t=>e.track===t)&&(t=this._streams[n])}),t&&(t.getTracks().length===1?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event(`negotiationneeded`)))}}function bK(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&[`setLocalDescription`,`setRemoteDescription`,`addIceCandidate`].forEach(function(t){let n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new(t===`addIceCandidate`?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]})}function xK(e,t){t.version>102||tK(e,`negotiationneeded`,e=>{let n=e.target;if(!((t.version<72||n.getConfiguration&&n.getConfiguration().sdpSemantics===`plan-b`)&&n.signalingState!==`stable`))return e})}function SK(e,t){let n=e&&e.navigator;if(!n.mediaDevices)return;let r=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,r){aK(`navigator.getUserMedia`,`navigator.mediaDevices.getUserMedia`),n.mediaDevices.getUserMedia(e).then(t,r)},!(t.version>55&&`autoGainControl`in n.mediaDevices.getSupportedConstraints())){let e=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])},t=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(n){return typeof n==`object`&&typeof n.audio==`object`&&(n=JSON.parse(JSON.stringify(n)),e(n.audio,`autoGainControl`,`mozAutoGainControl`),e(n.audio,`noiseSuppression`,`mozNoiseSuppression`)),t(n)},r&&r.prototype.getSettings){let t=r.prototype.getSettings;r.prototype.getSettings=function(){let n=t.apply(this,arguments);return e(n,`mozAutoGainControl`,`autoGainControl`),e(n,`mozNoiseSuppression`,`noiseSuppression`),n}}if(r&&r.prototype.applyConstraints){let t=r.prototype.applyConstraints;r.prototype.applyConstraints=function(n){return this.kind===`audio`&&typeof n==`object`&&(n=JSON.parse(JSON.stringify(n)),e(n,`autoGainControl`,`mozAutoGainControl`),e(n,`noiseSuppression`,`mozNoiseSuppression`)),t.apply(this,[n])}}}}function CK(e,t){e.navigator.mediaDevices&&(e.navigator.mediaDevices&&`getDisplayMedia`in e.navigator.mediaDevices||(e.navigator.mediaDevices.getDisplayMedia=function(n){if(!(n&&n.video)){let e=new DOMException(`getDisplayMedia without video constraints is undefined`);return e.name=`NotFoundError`,e.code=8,Promise.reject(e)}return n.video===!0?n.video={mediaSource:t}:n.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(n)}))}var wK=s({shimAddTransceiver:()=>MK,shimCreateAnswer:()=>FK,shimCreateOffer:()=>PK,shimGetDisplayMedia:()=>CK,shimGetParameters:()=>NK,shimGetStats:()=>DK,shimGetUserMedia:()=>SK,shimOnTrack:()=>TK,shimPeerConnection:()=>EK,shimRTCDataChannel:()=>jK,shimReceiverGetStats:()=>kK,shimRemoveStream:()=>AK,shimSenderGetStats:()=>OK});function TK(e){typeof e==`object`&&e.RTCTrackEvent&&`receiver`in e.RTCTrackEvent.prototype&&!(`transceiver`in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function EK(e,t){typeof e!=`object`||!(e.RTCPeerConnection||e.mozRTCPeerConnection)||(!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&[`setLocalDescription`,`setRemoteDescription`,`addIceCandidate`].forEach(function(t){let n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new(t===`addIceCandidate`?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]}))}function DK(e,t){if(typeof e!=`object`||!(e.RTCPeerConnection||e.mozRTCPeerConnection)||t.version>=151)return;let n={inboundrtp:`inbound-rtp`,outboundrtp:`outbound-rtp`,candidatepair:`candidate-pair`,localcandidate:`local-candidate`,remotecandidate:`remote-candidate`},r=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){let[e,i,a]=arguments;return this.signalingState===`closed`?Promise.resolve(new Map):r.apply(this,[e||null]).then(e=>{if(t.version<53&&!i)try{e.forEach(e=>{e.type=n[e.type]||e.type})}catch(t){if(t.name!==`TypeError`)throw t;e.forEach((t,r)=>{e.set(r,Object.assign({},t,{type:n[t.type]||t.type}))})}return e}).then(i,a)}}function OK(e){if(!(typeof e==`object`&&e.RTCPeerConnection&&e.RTCRtpSender)||e.RTCRtpSender&&`getStats`in e.RTCRtpSender.prototype)return;let t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});let n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){let e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function kK(e){if(!(typeof e==`object`&&e.RTCPeerConnection&&e.RTCRtpSender)||e.RTCRtpSender&&`getStats`in e.RTCRtpReceiver.prototype)return;let t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){let e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),tK(e,`track`,e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function AK(e){!e.RTCPeerConnection||`removeStream`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){aK(`removeStream`,`removeTrack`),this.getSenders().forEach(t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)})})}function jK(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function MK(e,t){if(!(typeof e==`object`&&e.RTCPeerConnection)||t.version>=110)return;let n=e.RTCPeerConnection.prototype.addTransceiver;n&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let e=arguments[1]&&arguments[1].sendEncodings;e===void 0&&(e=[]),e=[...e];let t=e.length>0;t&&e.forEach(e=>{if(`rid`in e&&!/^[a-z0-9]{0,16}$/i.test(e.rid))throw TypeError(`Invalid RID value provided.`);if(`scaleResolutionDownBy`in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw RangeError(`scale_resolution_down_by must be >= 1.0`);if(`maxFramerate`in e&&!(parseFloat(e.maxFramerate)>=0))throw RangeError(`max_framerate must be >= 0.0`)});let r=n.apply(this,arguments);if(t){let{sender:t}=r,n=t.getParameters();(!(`encodings`in n)||n.encodings.length===1&&Object.keys(n.encodings[0]).length===0)&&(n.encodings=e,t.sendEncodings=e,this.setParametersPromises.push(t.setParameters(n).then(()=>{delete t.sendEncodings}).catch(()=>{delete t.sendEncodings})))}return r})}function NK(e,t){if(!(typeof e==`object`&&e.RTCRtpSender)||t.version>=110)return;let n=e.RTCRtpSender.prototype.getParameters;n&&(e.RTCRtpSender.prototype.getParameters=function(){let e=n.apply(this,arguments);return`encodings`in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function PK(e,t){if(!(typeof e==`object`&&e.RTCPeerConnection)||t.version>=110)return;let n=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>n.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):n.apply(this,arguments)}}function FK(e,t){if(!(typeof e==`object`&&e.RTCPeerConnection)||t.version>=110)return;let n=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>n.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):n.apply(this,arguments)}}var IK=s({shimAudioContext:()=>GK,shimCallbacksAPI:()=>zK,shimConstraints:()=>VK,shimCreateOfferLegacy:()=>WK,shimGetUserMedia:()=>BK,shimLocalStreamsAPI:()=>LK,shimRTCIceServerUrls:()=>HK,shimRemoteStreamsAPI:()=>RK,shimTrackEventTransceiver:()=>UK});function LK(e){if(!(typeof e!=`object`||!e.RTCPeerConnection)){if(`getLocalStreams`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||=[],this._localStreams}),!(`addStream`in e.RTCPeerConnection.prototype)){let t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||=[],this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach(n=>t.call(this,n,e)),e.getVideoTracks().forEach(n=>t.call(this,n,e))},e.RTCPeerConnection.prototype.addTrack=function(e,...n){return n&&n.forEach(e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]}),t.apply(this,arguments)}}`removeStream`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||=[];let t=this._localStreams.indexOf(e);if(t===-1)return;this._localStreams.splice(t,1);let n=e.getTracks();this.getSenders().forEach(e=>{n.includes(e.track)&&this.removeTrack(e)})})}}function RK(e){if(!(typeof e!=`object`||!e.RTCPeerConnection)&&(`getRemoteStreams`in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!(`onaddstream`in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener(`addstream`,this._onaddstream),this.removeEventListener(`track`,this._onaddstreampoly)),this.addEventListener(`addstream`,this._onaddstream=e),this.addEventListener(`track`,this._onaddstreampoly=e=>{e.streams.forEach(e=>{if(this._remoteStreams||=[],this._remoteStreams.includes(e))return;this._remoteStreams.push(e);let t=new Event(`addstream`);t.stream=e,this.dispatchEvent(t)})})}});let t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){let e=this;return this._onaddstreampoly||this.addEventListener(`track`,this._onaddstreampoly=function(t){t.streams.forEach(t=>{if(e._remoteStreams||=[],e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);let n=new Event(`addstream`);n.stream=t,e.dispatchEvent(n)})}),t.apply(e,arguments)}}}function zK(e){if(typeof e!=`object`||!e.RTCPeerConnection)return;let t=e.RTCPeerConnection.prototype,n=t.createOffer,r=t.createAnswer,i=t.setLocalDescription,a=t.setRemoteDescription,o=t.addIceCandidate;t.createOffer=function(e,t){let r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){let n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i};let s=function(e,t,n){let r=i.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r};t.setLocalDescription=s,s=function(e,t,n){let r=a.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.setRemoteDescription=s,s=function(e,t,n){let r=o.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.addIceCandidate=s}function BK(e){let t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){let e=t.mediaDevices,n=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>n(VK(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,n,r){t.mediaDevices.getUserMedia(e).then(n,r)}.bind(t))}function VK(e){return e&&e.video!==void 0?Object.assign({},e,{video:cK(e.video)}):e}function HK(e){if(!e.RTCPeerConnection)return;let t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,n){if(e&&e.iceServers){let t=[];for(let n=0;n<e.iceServers.length;n++){let r=e.iceServers[n];r.urls===void 0&&r.url?(aK(`RTCIceServer.url`,`RTCIceServer.urls`),r=JSON.parse(JSON.stringify(r)),r.urls=r.url,delete r.url,t.push(r)):t.push(e.iceServers[n])}e.iceServers=t}return new t(e,n)},e.RTCPeerConnection.prototype=t.prototype,`generateCertificate`in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get(){return t.generateCertificate}})}function UK(e){typeof e==`object`&&e.RTCTrackEvent&&`receiver`in e.RTCTrackEvent.prototype&&!(`transceiver`in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function WK(e){let t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){e.offerToReceiveAudio!==void 0&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);let t=this.getTransceivers().find(e=>e.receiver.track.kind===`audio`);e.offerToReceiveAudio===!1&&t?t.direction===`sendrecv`?t.setDirection?t.setDirection(`sendonly`):t.direction=`sendonly`:t.direction===`recvonly`&&(t.setDirection?t.setDirection(`inactive`):t.direction=`inactive`):e.offerToReceiveAudio===!0&&!t&&this.addTransceiver(`audio`,{direction:`recvonly`}),e.offerToReceiveVideo!==void 0&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);let n=this.getTransceivers().find(e=>e.receiver.track.kind===`video`);e.offerToReceiveVideo===!1&&n?n.direction===`sendrecv`?n.setDirection?n.setDirection(`sendonly`):n.direction=`sendonly`:n.direction===`recvonly`&&(n.setDirection?n.setDirection(`inactive`):n.direction=`inactive`):e.offerToReceiveVideo===!0&&!n&&this.addTransceiver(`video`,{direction:`recvonly`})}return t.apply(this,arguments)}}function GK(e){typeof e!=`object`||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var KK=o(((e,t)=>{var n={};n.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)},n.localCName=n.generateIdentifier(),n.splitLines=function(e){return e.trim().split(`
|
|
282
282
|
`).map(e=>e.trim())},n.splitSections=function(e){return e.split(`
|
|
283
283
|
m=`).map((e,t)=>(t>0?`m=`+e:e).trim()+`\r
|
|
284
284
|
`)},n.getDescription=function(e){let t=n.splitSections(e);return t&&t[0]},n.getMediaSections=function(e){let t=n.splitSections(e);return t.shift(),t},n.matchPrefix=function(e,t){return n.splitLines(e).filter(e=>e.indexOf(t)===0)},n.parseCandidate=function(e){let t;t=e.indexOf(`a=candidate:`)===0?e.substring(12).split(` `):e.substring(10).split(` `);let n={foundation:t[0],component:{1:`rtp`,2:`rtcp`}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]};for(let e=8;e<t.length;e+=2)switch(t[e]){case`raddr`:n.relatedAddress=t[e+1];break;case`rport`:n.relatedPort=parseInt(t[e+1],10);break;case`tcptype`:n.tcpType=t[e+1];break;case`ufrag`:n.ufrag=t[e+1],n.usernameFragment=t[e+1];break;default:n[t[e]]===void 0&&(n[t[e]]=t[e+1]);break}return n},n.writeCandidate=function(e){let t=[];t.push(e.foundation);let n=e.component;n===`rtp`?t.push(1):n===`rtcp`?t.push(2):t.push(n),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);let r=e.type;return t.push(`typ`),t.push(r),r!==`host`&&e.relatedAddress&&e.relatedPort!==void 0&&(t.push(`raddr`),t.push(e.relatedAddress),t.push(`rport`),t.push(e.relatedPort)),e.tcpType&&e.protocol.toLowerCase()===`tcp`&&(t.push(`tcptype`),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push(`ufrag`),t.push(e.usernameFragment||e.ufrag)),`candidate:`+t.join(` `)},n.parseIceOptions=function(e){return e.substring(14).split(` `)},n.parseRtpMap=function(e){let t=e.substring(9).split(` `),n={payloadType:parseInt(t.shift(),10)};return t=t[0].split(`/`),n.name=t[0],n.clockRate=parseInt(t[1],10),n.channels=t.length===3?parseInt(t[2],10):1,n.numChannels=n.channels,n},n.writeRtpMap=function(e){let t=e.payloadType;e.preferredPayloadType!==void 0&&(t=e.preferredPayloadType);let n=e.channels||e.numChannels||1;return`a=rtpmap:`+t+` `+e.name+`/`+e.clockRate+(n===1?``:`/`+n)+`\r
|
|
@@ -309,15 +309,15 @@ a=ice-pwd:`+e.password+`\r
|
|
|
309
309
|
o=`+(r||`thisisadapterortc`)+` `+i+` `+a+` IN IP4 127.0.0.1\r
|
|
310
310
|
s=-\r
|
|
311
311
|
t=0 0\r
|
|
312
|
-
`},n.getDirection=function(e,t){let r=n.splitLines(e);for(let e=0;e<r.length;e++)switch(r[e]){case`a=sendrecv`:case`a=sendonly`:case`a=recvonly`:case`a=inactive`:return r[e].substring(2);default:}return t?n.getDirection(t):`sendrecv`},n.getKind=function(e){return n.splitLines(e)[0].split(` `)[0].substring(2)},n.isRejected=function(e){return e.split(` `,2)[1]===`0`},n.parseMLine=function(e){let t=n.splitLines(e)[0].substring(2).split(` `);return{kind:t[0],port:parseInt(t[1],10),protocol:t[2],fmt:t.slice(3).join(` `)}},n.parseOLine=function(e){let t=n.matchPrefix(e,`o=`)[0].substring(2).split(` `);return{username:t[0],sessionId:t[1],sessionVersion:parseInt(t[2],10),netType:t[3],addressType:t[4],address:t[5]}},n.isValidSDP=function(e){if(typeof e!=`string`||e.length===0)return!1;let t=n.splitLines(e);for(let e=0;e<t.length;e++)if(t[e].length<2||t[e].charAt(1)!==`=`)return!1;return!0},typeof t==`object`&&(t.exports=n)})),
|
|
312
|
+
`},n.getDirection=function(e,t){let r=n.splitLines(e);for(let e=0;e<r.length;e++)switch(r[e]){case`a=sendrecv`:case`a=sendonly`:case`a=recvonly`:case`a=inactive`:return r[e].substring(2);default:}return t?n.getDirection(t):`sendrecv`},n.getKind=function(e){return n.splitLines(e)[0].split(` `)[0].substring(2)},n.isRejected=function(e){return e.split(` `,2)[1]===`0`},n.parseMLine=function(e){let t=n.splitLines(e)[0].substring(2).split(` `);return{kind:t[0],port:parseInt(t[1],10),protocol:t[2],fmt:t.slice(3).join(` `)}},n.parseOLine=function(e){let t=n.matchPrefix(e,`o=`)[0].substring(2).split(` `);return{username:t[0],sessionId:t[1],sessionVersion:parseInt(t[2],10),netType:t[3],addressType:t[4],address:t[5]}},n.isValidSDP=function(e){if(typeof e!=`string`||e.length===0)return!1;let t=n.splitLines(e);for(let e=0;e<t.length;e++)if(t[e].length<2||t[e].charAt(1)!==`=`)return!1;return!0},typeof t==`object`&&(t.exports=n)})),qK=s({removeExtmapAllowMixed:()=>eq,shimAddIceCandidateNullOrEmpty:()=>tq,shimConnectionState:()=>$K,shimMaxMessageSize:()=>ZK,shimParameterlessSetLocalDescription:()=>nq,shimRTCIceCandidate:()=>YK,shimRTCIceCandidateRelayProtocol:()=>XK,shimSendThrowTypeError:()=>QK}),JK=l(KK());function YK(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&`foundation`in e.RTCIceCandidate.prototype)return;let t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if(typeof e==`object`&&e.candidate&&e.candidate.indexOf(`a=`)===0&&(e=JSON.parse(JSON.stringify(e)),e.candidate=e.candidate.substring(2)),e.candidate&&e.candidate.length){let n=new t(e),r=JK.default.parseCandidate(e.candidate);for(let e in r)e in n||Object.defineProperty(n,e,{value:r[e]});return n.toJSON=function(){return{candidate:n.candidate,sdpMid:n.sdpMid,sdpMLineIndex:n.sdpMLineIndex,usernameFragment:n.usernameFragment}},n}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,tK(e,`icecandidate`,t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:`false`}),t))}function XK(e){!e.RTCIceCandidate||e.RTCIceCandidate&&`relayProtocol`in e.RTCIceCandidate.prototype||tK(e,`icecandidate`,e=>{if(e.candidate){let t=JK.default.parseCandidate(e.candidate.candidate);t.type===`relay`&&(e.candidate.relayProtocol={0:`tls`,1:`tcp`,2:`udp`}[t.priority>>24])}return e})}function ZK(e,t){if(!e.RTCPeerConnection||t.browser===`chrome`&&t.version>102||t.browser===`firefox`&&t.version>=113)return;`sctp`in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return this._sctp===void 0?null:this._sctp}});let n=function(e){if(!e||!e.sdp)return!1;let t=JK.default.splitSections(e.sdp);return t.shift(),t.some(e=>{let t=JK.default.parseMLine(e);return t&&t.kind===`application`&&t.protocol.indexOf(`SCTP`)!==-1})},r=function(e){let t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(t===null||t.length<2)return-1;let n=parseInt(t[1],10);return n===n?n:-1},i=function(e){let n=65536;return t.browser===`firefox`&&(n=t.version<57?e===-1?16384:2147483637:t.version<60?t.version===57?65535:65536:2147483637),n},a=function(e,n){let r=65536;t.browser===`firefox`&&t.version===57&&(r=65535);let i=JK.default.matchPrefix(e.sdp,`a=max-message-size:`);return i.length>0?r=parseInt(i[0].substring(19),10):t.browser===`firefox`&&n!==-1&&(r=2147483637),r},o=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,t.browser===`chrome`&&t.version>=76){let{sdpSemantics:e}=this.getConfiguration();e===`plan-b`&&Object.defineProperty(this,"sctp",{get(){return this._sctp===void 0?null:this._sctp},enumerable:!0,configurable:!0})}if(n(arguments[0])){let e=r(arguments[0]),t=i(e),n=a(arguments[0],e),o;o=t===0&&n===0?1/0:t===0||n===0?Math.max(t,n):Math.min(t,n);let s={};Object.defineProperty(s,"maxMessageSize",{get(){return o}}),this._sctp=s}return o.apply(this,arguments)}}function QK(e,t){if(!(e.RTCPeerConnection&&`createDataChannel`in e.RTCPeerConnection.prototype)||t.browser===`chrome`&&t.version>=149||t.browser===`firefox`&&t.version>60)return;function n(e,t){let n=e.send;e.send=function(){let r=arguments[0],i=r.length||r.size||r.byteLength;if(e.readyState===`open`&&t.sctp&&i>t.sctp.maxMessageSize)throw TypeError(`Message too large (can send a maximum of `+t.sctp.maxMessageSize+` bytes)`);return n.apply(e,arguments)}}let r=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){let e=r.apply(this,arguments);return n(e,this),e},tK(e,`datachannel`,e=>(n(e.channel,e.target),e))}function $K(e){if(!e.RTCPeerConnection||`connectionState`in e.RTCPeerConnection.prototype)return;let t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:`connected`,checking:`connecting`}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener(`connectionstatechange`,this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener(`connectionstatechange`,this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),[`setLocalDescription`,`setRemoteDescription`].forEach(e=>{let n=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{let t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;let n=new Event(`connectionstatechange`,e);t.dispatchEvent(n)}return e},this.addEventListener(`iceconnectionstatechange`,this._connectionstatechangepoly)),n.apply(this,arguments)}})}function eq(e,t){if(!e.RTCPeerConnection||t.browser===`chrome`&&t.version>=71||t.browser===`safari`&&t._safariVersion>=13.1)return;let n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&t.sdp.indexOf(`
|
|
313
313
|
a=extmap-allow-mixed`)!==-1){let n=t.sdp.split(`
|
|
314
314
|
`).filter(e=>e.trim()!==`a=extmap-allow-mixed`).join(`
|
|
315
|
-
`);e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:n}):t.sdp=n}return n.apply(this,arguments)}}function eq(e,t){if(!(e.RTCPeerConnection&&e.RTCPeerConnection.prototype))return;let n=e.RTCPeerConnection.prototype.addIceCandidate;!n||n.length===0||(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(t.browser===`chrome`&&t.version<78||t.browser===`firefox`&&t.version<68||t.browser===`safari`)&&arguments[0]&&arguments[0].candidate===``?Promise.resolve():n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function tq(e,t){if(!(e.RTCPeerConnection&&e.RTCPeerConnection.prototype))return;let n=e.RTCPeerConnection.prototype.setLocalDescription;!n||n.length===0||(e.RTCPeerConnection.prototype.setLocalDescription=function(){let e=arguments[0]||{};if(typeof e!=`object`||e.type&&e.sdp)return n.apply(this,arguments);if(e={type:e.type,sdp:e.sdp},!e.type)switch(this.signalingState){case`stable`:case`have-local-offer`:case`have-remote-pranswer`:e.type=`offer`;break;default:e.type=`answer`;break}return e.sdp||e.type!==`offer`&&e.type!==`answer`?n.apply(this,[e]):(e.type===`offer`?this.createOffer:this.createAnswer).apply(this).then(e=>n.apply(this,[e]))})}function nq({window:e}={},t={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){let n=rK,r=aK(e),i={browserDetails:r,commonShim:KK,extractVersion:$G,disableLog:tK,disableWarnings:nK,sdp:qK};switch(r.browser){case`chrome`:if(!fK||!yK||!t.shimChrome)return n(`Chrome shim is not included in this adapter release.`),i;if(r.version===null)return n(`Chrome shim can not determine version, not shimming.`),i;n(`adapter.js shimming chrome.`),i.browserShim=fK,eq(e,r),tq(e,r),dK(e,r),pK(e,r),yK(e,r),mK(e,r),vK(e,r),hK(e,r),gK(e,r),bK(e,r),JK(e,r),YK(e,r),QK(e,r),XK(e,r),ZK(e,r),$K(e,r);break;case`firefox`:if(!CK||!TK||!t.shimFirefox)return n(`Firefox shim is not included in this adapter release.`),i;n(`adapter.js shimming firefox.`),i.browserShim=CK,eq(e,r),tq(e,r),xK(e,r),TK(e,r),EK(e,r),wK(e,r),kK(e,r),DK(e,r),OK(e,r),AK(e,r),jK(e,r),MK(e,r),NK(e,r),PK(e,r),JK(e,r),QK(e,r),XK(e,r),ZK(e,r);break;case`safari`:if(!FK||!t.shimSafari)return n(`Safari shim is not included in this adapter release.`),i;n(`adapter.js shimming safari.`),i.browserShim=FK,eq(e,r),tq(e,r),VK(e,r),UK(e,r),RK(e,r),IK(e,r),LK(e,r),HK(e,r),zK(e,r),WK(e,r),JK(e,r),YK(e,r),XK(e,r),ZK(e,r),$K(e,r);break;default:n(`Unsupported browser!`);break}return i}nq({window:typeof window>`u`?void 0:window}),typeof window<`u`&&`BarcodeDetector`in window;var rq=3e3,iq=500;function aq(e={}){let{startTimeoutMs:t=rq,settleDelayMs:n=iq}=e,r=(0,L.useRef)(Promise.resolve({type:`stop`,data:{}})),i=(0,L.useRef)(null),a=(0,L.useRef)(null),[o,s]=(0,L.useState)({}),[c,l]=(0,L.useState)({}),u=(0,L.useCallback)(async(e,r)=>{if(!window.isSecureContext)throw Error(`camera access is only permitted in secure context. Use HTTPS or localhost rather than HTTP.`);if(navigator?.mediaDevices?.getUserMedia===void 0)throw Error(`this browser has no Stream API support`);let o=await navigator.mediaDevices.getUserMedia({audio:!1,video:r});e.srcObject=o;let c;try{await Promise.race([e.play(),new Promise((e,n)=>{c=setTimeout(()=>n(Error(`Loading camera stream timed out after ${t} ms.`)),t)})])}finally{c!==void 0&&clearTimeout(c)}n>0&&await new Promise(e=>setTimeout(e,n));let[u]=o.getVideoTracks();return l(u.getSettings()),s(u.getCapabilities?.()??{}),i.current=o,a.current=u,{type:`start`,data:{videoEl:e,stream:o,constraints:r}}},[t,n]),d=(0,L.useCallback)(async(e,t)=>{e.srcObject=null,e.removeAttribute(`src`),e.load();for(let e of t.getTracks())t.removeTrack(e),e.stop();return i.current=null,a.current=null,l({}),{type:`stop`,data:{}}},[]),f=(0,L.useCallback)(async(e,{constraints:t,restart:n=!1})=>{let i=null;r.current=r.current.then(r=>{if(r.type===`start`){let{data:{videoEl:i,stream:a,constraints:o}}=r;return!n&&e===i&&t===o?r:d(i,a).then(()=>u(e,t))}return u(e,t)}).catch(e=>(i=e,{type:`stop`,data:{}}));let a=await r.current;if(i)throw i;if(a.type===`stop`)throw Error(`Something went wrong with the camera task queue (start task).`)},[u,d]),p=(0,L.useCallback)(async()=>{if(r.current=r.current.then(e=>{if(e.type===`stop`)return e;let{data:{videoEl:t,stream:n}}=e;return d(t,n)}),(await r.current).type===`start`)throw Error(`Something went wrong with the camera task queue (stop task).`)},[d]),m=(0,L.useCallback)(async e=>{let t=null;if(r.current=r.current.then(async n=>{let r=a.current;if(!r||n.type!==`start`)return t=Error(`No active video track found.`),n;try{e.advanced?.[0]?.zoom&&r.getCapabilities().torch&&(await r.applyConstraints({advanced:[{torch:!1}]}),l(r.getSettings())),await r.applyConstraints(e),s(r.getCapabilities()),l(r.getSettings())}catch(e){t=e}return n}),await r.current,t)throw t},[]),h=(0,L.useCallback)(async()=>{try{await r.current}catch{}},[]);return(0,L.useEffect)(()=>()=>{p()},[p]),{capabilities:o,settings:c,startCamera:f,stopCamera:p,updateConstraints:m,flush:h,getStream:()=>i.current}}var oq=`data:audio/mp3;base64,//PkZAAhghE0AKToAJra/n0FQygAAAGIkYJgmCYXBMAAGCTJz3zhCEM//z//1hz//8MMMMN08ssV6e5DDWIQreAgCvFKy8bXgIKMkUDDBgzJwIBtkRMQAocxIFdxghQGKDoEziAzQxOBOdH92i/iGi+zDCAEIX46a73HrSybZw1x3JZjXp7dSNy/P68rjcbt7p7fakMP5LVMyzCaj1pjvejYYAIDgDGzECjEAk1Jl3559HIon8hzlfPVTCvGJZzfcKSxXfyMWM88//9VKSxXdtnb9vomOuuRyiWVYbf+X8zp6fKGHIdycuWMMMMMMKSnp+6wsYc/9f/7z7rPPWHN556p6fP8MMMP///PPP/7+GHK9PT6p7f/unldP2np7YeHjweiYA4GLNAgAiI7u57n5//oc5/yfk6znOcPhwOBwggHCMpA4HA4KEyHOc5znO+hPIc5//+fqJh8XQPh90JU5xQinOf//87/zvP+ggAYuhCKHxdA+Hxd0EA4KKHA4ciB3kOXfXB/gmf8p/B96lAMKAgAADU+BujARHgwdisgHMfAUHAiceBg4ASBgZBiBIBH4ZaHOJsLhf8R+HYEciIgYSwj/+Bi7EqBh+AcBn5P6Bh4TuBmrAMBiZH7gaLEWgew//PkZFMlyek60MpYAShzqqZhm6gCUWeEUWAewEWYGN4X4GDEPwGE8S4GDoOIGAYKgIQOkz//gGARAUB+CwGxTwMAACAEgyAwdAlAxKhzAxXiZ///AxcEwAwJjDAziCAAwQgdAwRgdAsJQDAmAcGzYDwAhZIAKAcIQB4GT9TQMJ9/4Gi1Fv/AcAYUqKBAwGgNAwVBAAwGhwAwdBlAxFg1AwlgzAwNBuAkJQDBgEEDEqGECgChFgBgL//CIswYYH//+HKCpk4K0C9AaKKCAOBeMcR4X9C44BwABCgGAsGYCgTwHAcAwXAiAwSAQV///CJP9lwMBQAwAAAWGo5lVLCcaeneVhJAVGai3//ioaUEf//gaTAYGCj8BnEwfrIqDcsIQb/vmhU/8fAs0G8YGGwKST8Igj4GCATipksVzY8p//90FWJwh45AkX//4fCF9wMEgkL3uQc+gbGJ8t4MBAMBP/hEXf9FRuWBcAfIFjYzQdoLCBwh7IWVlxaX/w8oMCP/+EQT5poGB1Ir90DhiV6af/jFYBpT2BgoQyyt2M0ToBdEaZyzt8nTo3xdNDCTSd//o6F06CjooxRr4jVF/0bOKD6OMUNDRxiMUVFR0FFQPhGXRjDpr4MAEA4wIQUhYOIw//PkZE4nrg08sOx4ACQ0CopD2aAAlwTTBxQeMcwd8w8gZTAgABXwGABOkzpI0wAQAExnWfP4x8ZjKunWdZ1o1Qe6lFGKCNULORQCELAAPnRUf/GIx/0FHGfo3SdZ0qP2cukXKLlRtBKFgAQwCkwJgFRYBEEATmDsLSY2QiQYCEnEra+UZo6F1aKMRr6GhoaP/+j//ov+i+hjLqBgMkYoqChoo1GqCjoY06TpRqjjLOYzRRmMuizmgdKhdF8kjTAAAPMCwGswzglgwAJfzqxmioKH/////////////+ijLOAwFmN0f/////////Q///8ZjP/9DGYyFwIDBeB3MA4AlBWidKM5spykAUAQOCakK+udGqN8VDYjTRuN//0bVX//6Kio4xQFv//nf//kKOoAEIB6SY6hcxenp85///4/DEPf/84Xvl4vF4dwtxfEJgCYQHMSgKCROp4+fn////L4tQf0unz89OecLxeL0ul09y6enzp4dIhKAQFA5hKfLu1nU7/Wr71rRKJUBQSUVt////l08GUPVWgAAYAeNKsxbQNAAhQx3/oKGMM6dZ1Yy6sajMbfKio7lNcv0sScZ47lNcw32ekVFMP9fp/f+mklI6at6u/dBMQuW6y+C5BcgwAA//PkZEomGg1HYGe0riWsCqbEwiY0BJFJMxrCcxGgQ2VK8xxCF1wsABgQBBgQBAYAFCkYCgALkK4fJ00E5ctJN1Uxy5au3XoGcM4dSN0EYZwzhW0WCh1PZwzhnFFQxtnbO2d0Kt6CdXbruggkTEX5Rs4TEQUVsdVXaCcuWXIBQUGmwmgoAGcJiM4dSioHQdBnEY+hjcbov//jcb/43G43G/jCRibfxugdBnDqULO2duvQumztncbo4xGKKNxugooxGIxQULoOgFgUMTA/jbrxiMDmETL+eLhcPThzOeeOZfL5fIcBYuXD/OHv8t//LJFxjxQYHHKDGFkZMtlmKM0RgQfbVtxFIHbQBDRuzRguEI1c9XZ/rWmrZfVU3Oc/9utNNygRQkCoHlAYstNN6DJ1IINpoINppv+WG/+g2mmnUmmmpBAoJIJhnwB5xkymn606Df/t000xhU03UXC5Ol8uFyXy+Xy/l8v5w4cLk4XAvwAYUvl/QL5fTdlKZkEEEEGumaKaX00zIOemf6CH///ywI3LKpiQ2Ef4xYWMSDyI0XwzikpL0ajVHZ3j9DGIjeuXcNfjn96/S/TUz/X/vX////5K/r+v7Jn+LlAoGZOIQIwMKBQM/yppKYURmhGZkR2b//PkZE0mHg1HEG8wyiD7mlwAyDU8nJHi5htakZmZGNiRcpkJhBmUmZYQcM1VDEEBggNDV/ASEZRYKFZIhkXKLlKmk7IVTKmZNJ5KhiqVUqpX+k7+qlVKyV/ZIqZDFDWTJlFyi5TJpKhiXKBQyZzIS5JhBoayV/AQWVpGWkcYTV5O/rIVSv8/0nkr+v6/vyR/X9f1/ZN8kf5/n99/n+f5/lTKmf9/mRP8yFUqpWSv4yJUqpX9kj/MmZNJ5K/z/P9J5P/v6yFUz/CEoywgUMqZkz/FssECIsVq0aPRrRRatFFFykQZJ2Ukl///5KjmksOaA7ALROJLDnEsLbq3GTMVrwb/0dGzmM0DlfBlHQOmrdR0MYi92TX6b/cmDHLclyUVYO/4O8sFTKFTKFf8yhUyhUyhXzKlDKlCsr/+ZUoVlSsr/+ZQqZUoZUoceMfcoZUoZUoVlfOPGcmDHKcpynKg9yXJcr3JclyXJclyYO+DXJclyfgxFZVb3KcqD/g2MxzsY72L9LubPR0dCyf5K5NNd+Tv9GXRdV0XJclyfcl/n+k8kf6SX/iVynvXf///4Mg/1OkxguYzmM5jMcLHMxwwGhgNCwXMLAcwMXTLi1MD7w7tmTdBvMmE0xQFzCwHMDAd//PkZGMpigkmAGOUvCfTgcgAuC+ITswMFzC4oMLhYMByn0xvU+p9Tr0xUxf/0xv///1PBYDhgNTFTFTGTGTGTGTGTGTGTGC4GTFMDAcLAdMVMVMULAcMBpgYDhcDGFwsYXFBikLGFwMGA4MBxgcDKfTEMUoAx2BisD+mKp5Tv1OkxkxkxkxkxkxkxkxlO0xVPJi/6nv////U7CwHTFTFTGTGTGTGU+p71PpjJipihYDpipi/6n1Ov//C4GC4GTGTGTGTFU8WBSZdLhWB//yKlotyLZFiLf8tyyRUipFSKkVGRBZQMiWC3yx//wxUGKsSvDFQGHUAL3QMsHDFIYpCYy2Bmagy6BjLgy6Bh3od58DCLAizBgRb+EQiyEQiwGBFuDAi3/////20QqSBJf/qcumv/////wMZdGXAYMu1gYy6MuBEZdBgy4BjLgy6BjLgy6BjLgy6BjLQy6DBlz2cJDLgRGXAMZdGXAYMuhMZcCIy6sJGaoGMuppwNRl3WBjLgy63wiEWAwIt/+EQi0IhFsDCLAi0GBFkGBFgMJCqaqYAgAYIhBBvwf7kwcqRq7V3IctacvlN6NxqgooxRRuNRiijEZjMGRuMvz9FGozQ+1X2qe1T1S//+VhaWAtKwtML//PkZEIkbgcaAHc1xCJrjeAAtfuUAtLAWf///mWePH95ZFgsyssvM88+jzO6K+z7OM48sH+WDiweZx5YOK+zxWLGJWsa6xadAv02fTZLSpsFpvLSga0tMgWgUgWmwgUmyWl8tMgWWmLSoFJsoFlpSwsmyBg4HhEdgwHAYPBwGDgeBg8HwMHg4DB4PBgOAwcOwMHLwDn5lAwcDgiDgYDwMHA/4MB3//+EQeDAdwiDwYLPhEWQYLODBYERZBgt8Ii34GLBaB5pfAZ0FvEAQ/UfwxULlx+IXx+8f5CELH8fxKhAIDFoHBEDRc3////gwHgaRXgMHYMB2EU/gwZ/gYbw3gY3QbgYNgbgYiAbgwN3/+EQbBEG4MBuDAbAwG4RBtAwbg2////+B9B6F//////////hEdD//////////8DRahEQGCInMNg3LBElgNjDciCwG/lgNiwGxWG///mG4bf/+WA3Kw3KyIMNw2Kw3MNg3MNg3MNiIMiQ2OK0xMiA3KyJLAEZgRARmBEDEYFwBBgEgEeomowol5YAJKwCDAIAJ8sAE+gGBgCJYAQUZ/13LubMu5dyiYOAhKwEFGf9AOoz/g4CFAIol/lgAjysAgsAElYBP////lgJksBM//lgRUxF//PkZGApggsIAHt2wiNLoggAqCz8RFSwIqYioipkjEjHCCSN/+WJg5iYOYmPK5krmTmZk5mZ8sTJYmf8yJiNiIisi/ywRmRkZkZGZGRmRERkREZERGRERkREZERGxEf///hETIMEyBiZEyBiZEzwiJgDEwU4DV2gQGFOBgmP8GAiAwRAiBgIgYCIGAi/4MBHAwRgjAwRgjwMEQIgMcgY8DBGCMDBGCMDEyJn///+BiYQIBlObj4eYLIwsjAOBGFkYBoEQ84eULIw88LIA88PKHnw8sPKFkeHlANAiAaFUDAiMYPIHmDzBZBhZB///8GBOA1sH/Awni7AwnhPCITwYE/CKzBgt8Ig8GA4Ig6EQdww4Yb+F1sIgtwYCwGAsAwWAsBgLAYCwDBYCwDBaHUDF+VEDKgC2BgtBaDAWgYLQW////gYLAWQMFgLAMFoLcGAt////4RMABmBSj4NgwMOGHBsHhdcLrwbB4XXC6+F14YcLrww4Ng8MOGHBsHww4Ng8AUC4AoMQMC4fgw3wutV4QIsAgFYIBWCCVgHeVgHeWABCwAIVgH+YBwB5aRAstKgV6Ba1oMg9avtUVN/qdLWciD/cqD3Jg6DFPuTB/////lYAn//mC8C+YLwL5gvgvGC//PkZFEpLgMKYXt2xB5LogAArbdc+C8VgvlYL/mC8C+YLwL5YBfMNgNkwXixDWoHPMc4VUxVA2TBeDZPYXzXl815fK14sLxYXvK1//NeXzXl815fMtdDLSw3UsMtLCstMtLDLSwsFhWWlgt//8sFhW6f/////+WF7zXl8sL5ry+Vrxry+WF/wMLwX4MC+EQv/AwvBfAxsjYAyqpKA0lpLAwvBfBgXv///4RA2DANAYGgNgYGgNgYGwN+EQvf/BgXwYF//8DC+F4Dd6NgGBf4AgFwbB0MMF1wuuDYMBsGwusDYOBsHA2Dvg2DQuuDYOhdcMMF14YYDGYDEGwfhhgbB0MN///4RBaEQWgZByoYRWYMFvwiDsGwaF1gbB34GDwdC64XW/w1aKxDVgatir4YcLrQbBwNg7////////////+ESfgZPyff/////////4MFmBvvMAERZ8CC5adNj02E2S0qbCBSBZaYtN///oFlpU2QMXIFAYuQK9AtAo7IxLTpsIFJs/5aZRxQawaxGfIg9CsrI+PUqkWdOHp7ODsOl6cOHZ4dsulfLI9/8BAAgMBACsBLACVgBjoAWAE5OTM6WDAR0zodMdHCsJLASWAjzCQgsBJhASWAjysI8wkJMICU//PkZFkeqgcaYDd1th6DogAAqCuIxQwtDA5MdMULgyY6YqnXqdep5TpMdMVRNRL/UT9AN6jCiSjKAZRNRhAMomgFQDfCIJwYCQiCAiCMGAkGAgDBJUA3eVAMEgj////8SrDFIYqh5g8kPMHkDzB5OFkYeYPJ+HlDzB5+AYVQDibCyIPLLEZIsjIliWS0WywWyyWuWCyWJaLZbLJYDHgLAItFvy3///4eYPKBlQTh5QYEODBb//hhoNg7/C62DYPFUKwKsVgNWBq8VkVcVkVUVYrH//hGff/8Iz8GT7//////wiX4ML3gwvgwvf4ML3gZeqoHVGyBl4vgZfL2F1oNg4Lrg2DcLrg2DQw0Lrhh8Lr4YcMNBsGhdcGBcMOGGAFGAGMQsF1guuGG4XXV/4uQXOLmF1kL/8lCXkuSk4O8/FzHzuP0hIucf/CIFAMCgFPgYFAKAwCgGBQCgGHYO4GBVM4GgQI4RCMEQKQOtQjUI1CNcI14MqDKwDIAGQDzh5wsjDyw8uHmDzYeUPN+DEYRRhFEIowYgDQgIhWDApgwKAwKQYFAYFQMKkYDOxHAzsRgMKBUGBX/h5v+Hm4ecPNh5A8wBwjhZHhZAHlDzBZAFkAeQPKHnCyILIAsih5QsgDz//PkZLQgIgsMAFp1xCGLogAAA2rkB5w8oeYLIQ8kPMHkCyGHnAMKoGmAgFkUPMHmDYAtfHPHNkr/JYl8c8lCWHPHMkqSo5onMAkBDnfJX//8IgDBgBhEdAaxSQMHUGAEIgAV4risCcipBOMVRVBO////hEvAxsAwvf////8MPDDww4XWC64XXDDww4YcMPC6wYb/wYGgiGwMplMDYhTCIaCIaBga/////8GA+EQdgYPB4MB4GDwdhEH8Ig8Ig8GA6EQcEQf8DBxlBjoAweDuFwgCQXiL//iLiKCKCL4XCiKRFwEgoRT4iqpMQU1FMy4xMDCqqqqqqqr////xuDd8fv/DVwrArEIg6EQdhEHAYPBwMB+ERYBi0WAwWAZ0FoGLYOB+JfgZ0FoGdBaDBYbn+WHm9xW7/Nzzc83PLDzc8reWlA7S0oHamx//6BflpU2C0qbBaf/8yk/ysn+VkMhTKQrKVk8yE8rIVkKyYsAn/5WC+YICmCApWCGTkxtKMcVWlgFMEBTBAX////0C0C0C/////////LTFpvTZLTlpv/0Ci0xaYtOgWmymyWkAxcWmTZTYTY8tMmygUWmLTIFpsFpv9NnywLmLCx2RgWmQKTZ98UjnzZ1/++D4M6/////3//PkZOgjIg8IAFcbxCaTogAAoCuIzfJ8vfJ8Wcs5fBnD5//++L5f////////6nCKv//+o0o0FUYwqDNGCwgUMKC0VVGkVv//4Yf8LrxVCriqDVoasDVuKsNWw1bisBqwVkVkVX//gy/4YYMMGGhhgwwNg4LrhdcLrAYWGAA0zBsH4Ng3C6/////4MAoGBQIDAKBgUCAwCgYEAsDAoEAwKBAYBYMAoGBQIBgUCYGBQIBgUCwiBAYBYMAoRAgRAoGBBMBooCAYFAkIgTEUxFv/EWxFxFhFoi0LhQuFiLCL/EWqTEFNRTMuMTAwqqqq//////8TWJriV/hERAwRgYiEYGIhGBmIRgYiEYMEQMEcDMSiA1GYwMR+UDMTkA7KIgMRGIGGM0SIrRGjRlhEV4jxov8rR/5YRFhEdQSViCsR5iRJWIKxPlgQYgSViSsR5WJMQJLC78IiKERF4REeERGEREERHwMRGOBmIRhERhERAwRAYiEQGIhGBmIRAajkgG5TEEREDBHwYIwYI4REXCIV/4MCmDArgwKAYUO/gYVCkGBUGBTgYUCsGBUIhUDCoUCIVBgVBgVBgUhEKQMKhUDCoUBgVAwoFAYFcGBQDI6oA5+qQiFAMjBUGBXCyEPIFkOH//PkZPMj6gr6AFdVwifkBdwAoC2Ilh5/8PPh5Qsih5IeUA0TAZrE8PP////wMRiIIqID8piAxEIwMxCMDEQjCIj//BiIDRo8Iogii/4MKwYVhEoESkDEiIGJEgYlfBgmDBIMEAYgSBiBIREAwSERH/8I7wPfuCO4I7v/8GBvAw3Bv/////gwN34RBuBg2BuBg2BuBg2BuEQbhEG+EQbAwG4MBtwiDaDAbhEGwMBuDAbAwG4GDYG8DBsDcDBuNwDRWDcIg2AwbA34RBv///CINvCINgMRIN/////wiG4DDeG+TEFNRTMuMTAwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq/zB4OLAP8rBxWDisHlYOKxb5WLTFgsMWiw18LDOnjPxZoxadDOgsLAtLAbKymVhsrDZWG/LAb8w2GywGysNlgNFgNGFwuBQuWnTZLToFFpisLJsFp0Cy0voFAQLFZkMCAQwIBCsC/5WBCwBCwBCwBCsCeVgUwIBCwBDEwEMCAQrAhgUClgCFgTlgCGJgJ5gQTGJwKWAKYFApgQTGBQL5kY0HMjQYnAhWJvKwIWAIVgQrApYAhWBPBgECIEBgE/8IgXhECQiBAMCkcDEwEwMCAQGAQIhoIhsGBsIhvgwN//PkZN4irgr2AAOVqiUThegAnCtMgwNwiG/8IhuDA1hENhENgYbKYHb2IBhoNhENAwN////8IhsDKZS////8IhuBhspgc0KQRDWEQ3///CNf4GAIMDAwgAwAAwhAwAwYAIgwiHBgAMAYGAAGHv///CIBqBqESDEIgRYGoGHBiDEIgGoGgMAYgxgwgxCIETwYFYMCoMCuDApBgU8DCoU//gY3G//wYFOBhUKBEKQYFfBgV8IhSEQoBkYK8IhT/wMKhXBgUCIU4RCoRCvgYVCsDCp3A1SqAYFAiFP////gY3G1TEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVgwCAwCBEC///////8IgUIgWEQIBgUCAwTQMCAQDAoEhECAYFIwGaRMBotWAasdwH/KqBmhFgaKI4GRgKVpjCBTCBPMJHNMFMIFKwnlgJ5hUxhUwGWlpAMuMuWLTFpvQKQLQKLTIFJsoFIFFZb/8woQwoT///MIF8rC+WAphAphAppgpYClgsmwBC6bHoFFpUCi0wGXFguWCwFLgUsgX6BZaVNj0Ci03//+EQKEQKEQLCIFAxMBcDAgFAwIBQYBODAKBgUCAYEAuDAKBgUCAYFAgRAngwCgwCwiBIRAmE//PkZN4iogj2AFdVxiUrhewAhOkwQIBgQ0gbOI4GRhOBiYCgYEAv////CIFAyMBQYBf///CIF8IgUDAgFBgEAwIRwMCCcDEwFAwIBf///CIEQGMDGEXCKBpCIDCEQDCAsYInDFQMMAuYSoTQMVfBlf//+DKfBgAiGDAQMIMIgCIQYADAEGAgwP////8ItgNu2/8DAAAiABgHhECBgQGEQARA8GAeEQIMABECEQIMAwYBBgCDAARA4GAAgYACDAARAwiAgwDhED4RABEBCIGBgDoH2dgZwCBgAP//BhX/+DCiTEFNRTMuMTAwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqF1ww////////hdeGGDDBhwjeF102E2fTYAowMLjE0zTDfyyMYjEDJTwMLSwFi0/gQLoFIFpsegWmyBQsWlQL9ApNgtIWn8tMgX6BaBX+WmQL9Nn02f9NktIgUgWmwWl9Avy06bCBSbJaUtImyWkQKLTIFgYWoFFpAKFwMLzZgwAwvLTIFlpU2fQLQK///4Yf4YaF1sLrg2DAuuDYNDDQw4NgwLrhh4XXC64Ng3C60MNwbB4XWC64YcMODYPCJYDlMQBlwRLg2DOF1v/////PkZM0eKgz0AE+UuCnLFfAAk3Fsg2DAYX/ww//4YaGGDDhdbDDACFwMuXA2DADlygusDYOBsGhhv//wNU/CKQusF1oXX+F1wuuGGC6wXWDDBdbC6wXXhHv//4AHIFgC0BZAA4Ba4FkADwFsC3AtQAOcC0BYAtgAcAA9+BYAsgW4FvgWOABwC1oq+it4RT0VVG0VFGkVywo1/RWU4U59TlFb1GvRX////QK9Nj/9AtNn02fTY9NhNlAr/QK//TYTZLSJsIFemx///oF/5aZNj02U2C0yBaBfoFAS6bKBfoFVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVQiA8GAO/4RAf//////wYA4GAO+EQHAwB4GDoB4GA4HQRB0BhlDIBpEAcBgPDIBgPAeDAHIFAYuLTpspsJsFpi0haRApAtAstIYKClgF/ysF/ysE/ysF//LAJ6plTlYC1ZUypmqtWVK1VqyplSFgBaqqcwAAVIqcrEBAAKmMBERCQhwD5iICIQEyABMAABBVGXF4gIA4DLAAWAEQgLVSsBaq1ZUv+YKClgELAJ////5YBP//LAL5WC+Vgn+WAX/LT+gW//PkZMIhLgrsAFt1yiD7FiB6A9qwmwViybCbCbCBSBabCBSBabPpsegWmwWn9ApApApNgCGBmEwWlLSpsf////hEHgYOB3////4GDkiBxMHhEdgYOB4GDwcBg4HW23gooFYHd/+BnAz8O8Vv//FaBm4rBWh38es2zbAtD1m2PVBqBrBqBrAF7AF3/5el84MkuHTgyy+dL0dRnEajMIyOn8RsZ5HGG/kbIpHIkYUiD0y2WctlZaWSwrKx6FZbxnL54ul04eLhw9Ol84dl86cOHT3Ipb5Z8qKpVx6/j0EkLctVTEFNRTMuMTAwgWQLQAHgLf/////4Fn+EQESEcIgInCIRW9TkrCzH0YIjjWtI+YeCD0woLCBQwsKRWUaRVCBZFZRtRtFRTlTlThRtAr0C0C//02E2fTZQK/0Ck2f9TlFRTlTlFT/9TlFVFRFb/9ThThynIQbWkAREue5S11rKdlkDEVABh61ExYPU+tOD4MQgcn4iwigivxFRFoXDcRQLhoiwioXCeAkFBcNiL8RURQBIKEVEWiLBcKIqIpEXC4QReIoIpCIKAQMxFAFAsIuIr/4YYLr//ww4XWBgwC64XX/hhgw3hhwuv8MNhhguvhdcAUYgaYTAAoWDDg2DQbBg//PkZPYe6gzuADd1uDKsBhBAe89cYYdGjtDT2hDmlD2leaOv9oX0OX/0NNLplNf8ewakNWGrTfTRpphNJtfaeh7T1/tStdtTpqN532lpX/1/kmQ5eaf2hoaV9paGleJAvd0rer2pWu1ar2vk56vVrV5Hj1Nop+/lfv5Zpkem5kX/2vtata2rq783nbvtbW6VjW6a2rq13+rO6VysV58K7tbp0ru6Vrtqa1a67tr6sau1ulYrnfa2v927Vrt21NSuN5X927/D4diAQANh4gEIfxB+IQG/D/4gDw/iGIRD+HRATEFNRTMuMTAwqqqqqqqqqqqqqqqqqiIEK/ititFX///8VcVuK38VsVhXBOQTpq/qm8QCAcBmIxgdfFZCHECpxFBFAuFEUC4cLhsRTEVEUDVoDQD+KrFYirFX+KwKoVgVUVUVeKwGrhWRWBViqFYDV4rMViKyGroauBg/A0YThVgNAEVQqw1fisis4quKxxWYrAatxWIqoqg1dFYxVxWIrAavAaAArIrAqoqhWYrIqvxWMVYrARCADhcKoVYavDVgqhV4qorIrHFWKuKxFViscVUVYasAaAfFY/4YcMNhdfwuuGGC64YfDDA2DwusANygbBwAxhAECwNg8MOF1hD4//PkZOkc4g7yBjd1sDNkDhgqYwtcYoUyiQ0NCkxQ0NCQkSIbGKIyRGEo5mUaNEhGKEHMmaGhI0UokORvMmZmZSZSiMZQkRnKKZkzRoSNCQpQ0NEZoaNFJkhh3KOUJEhIcoSJCQkIzlDlEjMDMyMpQ0JCQzNCRGaNCRISEZoZihoaIwlEHKNGiMzFEjRmSIwlHMyZmcyiGyMxRyhIkIxRSZokSEYGBkiRojAPESNGjQxvKHMmMoSKTJCQkIwlFKLDYWGhoZhYWAAUGBsAwsMDYUAcK4XDPhQVwwLAH/DfgHC6TEFNRaqqBgjwYI//wYI/8GCL///+DBFhERgwRcIiPAzGYgMRKIDcskBgjAxEIwYI4GiRwNEjhFH4MRwYjA0aOEUf8Io/BiLgxGEUYRRQij/BiKDEYMR+DBGBiMRQiIgYIwiIwYIgiIgMRGIDUSjhEReEREBiIRAwR/wYI/8IiP4MEcGCIIiOERH8GCIIiMIiIIiODBHBgjBgjwiIoREcIiOEREDBFCKiAxHJcIiMGCMGCLwYI8IiPhERgwRAwRAYjEUIiIGCP/AxGIgiIsGCL//4REYMEXhERBERhExhExAzyAZiEWDBGERGeKsVsVRVFcVwTnFcVxVgnYqipFUV//PkZPkcfgzeAFaVxDgUBgAgatvIYrgnYqgnQJyK4riqK4rwTsVor4rQAjABAgnQritFSKoqQTsE5C1haxfF7F4XQtULSFqC1i4LwWkXIWkXRdF+LwqAnME4iqCdwToVuK+HAERWAkAlgJB0OB3Doc8OYc8VCsVgIB3DuHAERUAkAkHMOBwOAIisO4dwEAEAEg6AkAl4CeHA4AkKhXioBIOiv8OB3F+LgWkXxeF8XouxcF0XBeF8XBdF8XhdAdouC8AEsXYWsXOKsVBU/FaKmK/FTxXFbFUVPiv/8VfxXitVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVAXX/8MN/wwwYf//DDBh4Yf/+DYODDfCIFAwKBQiaANFgUDAgFAwIBcADwFuBY/At8C1wLfgAdAtwLGBawLcC3AsgWeBYwLX4XW8LrBhgiFgMlhYLrhh4XWhdb8MOGGhdcMP4YaF1gw8LrwuvhhoYYLrYXWDDBdcGwfC60MN/ww8GwZ4XXC64GZQsF1wbBnDD4XXg2DcLrBdaDYPhhgusF1uGGC64YfhhoNg0LrQwwYcMNC62F1/g2DYXW4XXC6+GH8DTIW4YeB/wR/wjwR+DP/y06bJaRAtAtAtAs//PkZNwY2grqBFW1xDhTRegABLBstL6BRaVAstN5aYtN/psIFf5aQtIgWgUWk8tImyWkQL9Avy0qbKbKbJaf02f/0CkCy05adAsC3K7+mx5aVAv0C/TZ8tOmymwB2pspsFpPLSlpy0qbCBSBXlpk2E2E2C0paUtP6Bfpslp0CkCy0ibJaZAosWQLLTJsemwgUmz6BZaYtOgUWmLTpsJsoFJslpPLT+mwmz//6Bfpsf6BSBSbCBXoFeWk9NhNhAr0Cy0/+WnTZ8tJ/oFf6bP+myWn//8tMmz/lpf//////8sPTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVBgJwiCYMBP//gwE//////wiCAMEgkIggIqIDKpUCIIgwE8IzA4j+EYhGAZMIyDJA5gGRhGcIyDIhEQiIGAgwIRDwiAGAAwYMHBghGAZMGRCMhGYRgGRA5gIyDIwZPBk/wZIRmEY/gyOBxIMgIzCMgcTgwRBgjwYJBgngwTwYJhEQBiBGERMIrwOouAxAgGCQYIhERhEQDBGDBAREgwTCIgGCQYJgwSDBHwiI4MEAwSBiRHCIkGCYGJEQiI/Bgn4REYREeBiBIH6XhERhETwogoy04mpZibFmJuWYmx8n//PkZN4ZrgrkAFZUyDcjofgAA9qc0HafZ8HwNrjaG3xtjaDtJwTo+D55Ow7fxNRNSyLPlqJsAr/lmA/FmWYm5acTQVgTkVQTnBOQTgVxVBOBVFWK4J3FUE7gBABOwToVQTsVhUFcVRXBOhUBORWiuKkVYrCqK+KoqgnQrAnEV+K8E7FQE5xWBOQToVQTsVRW8V4qRUFYVgTsVhXioKgrCqKwqAnYqCtBOhUioK+CcisK8VRUFSKnirFQVBVFcE6FcVoJwKoqCrFXFUE7gnAqiuCcQTsE7xU8VP8VYrgnYrCuTEFNRTMuMTAwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqn3/l/J/8vHL5f/BhwCETgGpIDOATgEIOFoDcHzgEIDgC+pG7eve1S/6tat7rXupDXSStWoIpGS4TSMQNIySMwpIyAaRkkZ8GJGdBtbwYkZ63tCKRkoIpGWDEjLCKRmEkjOvsEUjJOsIpGa6bOrgxIzsEkjIGJGYUkZVKCKRmqoDkgEjMJJGSYMSMAikZJ3qhp0dq9ru3X1I36FujPbXuxwKbr//waABfg0AC6DUDUDXBqBoAmQawJiGrhqDUGoN//PkZL8USgKcAAblrroTgfQAbhtQAag1QawaYNIAuQa12Lv9si7F2NnXa2Vsi7i/DZl2tlL9l+vL8tlUTUTUTUYQDIBlGUAyifqJKJqJ+p5Mf/U7TETEU7CxkxVO1PKdqeU8u4vq2ddnrsbM2Zs/tl9s67V2NlbIu5sgaA1Q14ExAmAaA0BrDVDXhpgTPDQGuBMA0gTKGgCYgTHDQGrDUGgNcNQaw1hoAmcNIaRIAtALVEgC1gteI8FpBaBIAtcRwkAWgFpBaILVBaIkAWgRwjhIiPEeDXwa/4NUGr+DRwaKBgX/8IhP//wiF8GBMGBP/wYEhEKEQmEQuDAoGFTAwLgwLhG/4MvCM8GSDJCNwZQOXg2DwbB8MPDDhhuGGBsHhh8Lrf4MCQYFCIUGJgiE8GBQMIFhELDDhdaGHhdYGwaGGDDhhuDYMBsHg2D8MMGHBsH8GwYDYMhEKEQgMCeDAsIhAiFBgQIhAYFhEKDAkGBMIhYGEC4GFCBELgYUKDAuEQsGBQMKEwiEBgUGBcIhQYFwYFAwgWDAoRC8GBAYE4RCgwKEQvhEJgYUIBhQkIhAiECIUGBIMC4RCgwJCIUGBAiFgaYLwiEA5cGXCNhGBGwZAw4Ng0MPBkqNqcoqorlh//PkZP8cygrkAFI0wjo7lfAAjhq4SnPor//psoFemygWmwWm/0C0Ci05adApNn/TZQLU5RU9FRFVFdTn1OFG1Gywv/UbUa9Ff0VoFgCwBbAtQLUCzAtgAchHAN8ImAbgBvwDd4RwjQDeAN8I0ImEQEQAbwRgiQjBHhHAN0A3vgG6Ab/CIhEgG5AN6EQESAbmEYI4RABvYRoRABuYRgDehEQiAiIRABvcA3QiQDfwjwDfCICPCJCJCJ4RwiYRwjBEwDehEYRgDfCNCOEQEQEcI+BagAd4FrAscCxAswLfwLAFgC1wLNVMQU1FMy4xMDBVVVVVVVVVBlBkwO3wZAZMIz//////+DJwO0IwI0DsA7cGUI34Rn4RgMuEZgywZQjAZP/hGAcmDKEYDIB28GQGQGXhGgcgRoMgRoHYBywZAZYMmBygyQYFCIUDChQYE4MCgaYJ/gwKEQsGBAiEBgXAwgQLrhdcGwcGHBsGA2Dgw4YYGwZC6/hdYMMF14YcLrYYcMPDDhdYGweF1oYb4MCwYEwYEgwJBgTCIQGBIRC/BgQDCBcIhAMKFhEKDAsGBQYFAwgTgwKDAoMCQiEgwIBhAnCIUGBQiFwiEBicIhAiFhEIgIoBooGieDPA+4GeDPCP//PkZOobXgrkAEY0jjazieQgBKKIBGgyBGhGhGgyAdoMmEaDIB2gyhGwZYMsI0GSDIEaDKB2QOWEaDKB2hGgygcoHYBygdkDtgygcngyAyhG4MgMgRgRmDJCNBkA7QjAZIRoRoMuByhGgyAyAyhGwZYHKByAcgMgRoHIEbCNCNA7fCNA7AZAO0GSEYEaDLA7cDthGgyAyAyQjAOwGUIyDKEYEaEYEYEaEbA5AZQZAZAZIMgRkGXBlBkCMgyAyQZYMngcmEb8GUGQIyDIBywZAZOEZhGBGwO2EbwjcI3hGYMqTEFNRTMuMTAwqqqqqqqqqqqqqqqqqqqqquDqz8GMDQIvBj///+DGDEGAMAifBj8IuEThFCIEQGPCLwiQYBFCKESDCETBhhGAZGEZ4MjgcSEY4GoRQigxCIEQGPCKBiBrgxwiBEwMIRAY4MQNMIkImDEGIRYMIRYRAYhFBjwYwNQYgwBgBh4GAMQiwYgxA0gahFBgBjgYBFhFhFCKEWBgEWEUGEIgMQYQMYRAMQigxhFBh4GkIgRIRYRAY4RIMQYgYhFA18IoMQYQihFhEgwhFCIDEGIRQieBiEUIoRQYhEwYDAFwGrBog0waAaQawacGsGiDQp9MZMVT3piJjJjK//PkZOYZBgjoaUJQ0DprofQgbhq0dep71PqeU69TpMdMVT6n1OlPKdJjpiKdFZkxlPKdJiJj+mKp/0xFPBoAmYaw0BpwJhDSBMQ1BqAmIEzDSGgNXDRDRhp+GsNMNAEyAmYagJkBMA1BpDXAmECZhoDXhqAmYawJjgTICZBrDSGsNAExDVDQGqGgNHDWBMIaQ0BrAmcCYgTHAmIEzDWGgNYaOBMw0BqDSBMYaA04aA1hqwJhw0ATKGqBM8NYEz4aQJkGoNMNIag1+GsCY+BMQJlDVw0cCYfDXw1ho4aQ0gTCTEFNRTMuMTAwqqoD37wjuhHf/////hGf////hHf/gycEZwRn4MnYMncIzsGTwOdOA507A507hGeEZ8GTuDJ4Rn4HPn4Mn4RnhGcDJwM3YM3gzdBm6DNwR3QjvA927Bm//Bm7Bm/Bm8GbgZvBm4GboR3gzeEd+DN8GbvBm6EZ+Bzp4Mn4HOnBGfA588IzsDnTgZPCM8Iz+EZ/CM4DnTgOdPBk8Iz4RJwGTidBi7AycTgiT4RJ8GE6ESdhEngZPJwGTieDCcESfwYToMJ3AycTwiTsDJ5OhEnwibwYb+ETdwibwibvCJuwYb/4RN/Btf/jYGyNv8bHLUtSzE0/LQBW//PkZPQcHgjQAFKVrjfDmgAge1eMLITcshNy1LX8si0LUTQtCyLQTUteWQmvLItSz4mgmnTJops0umEymDSPsnR9HwfB8k7Pvn0fAvwtcLXF/F+L4vQtQWuFoC0BaReF7AeBfwtcXBdF4XheFwXAtAui9C1haRdi6LwvirgnUE6FcVBVisKgrCvioK+KoqiqAhh3AQFXhwVYrFYCWHMOioVAI4dFWHPDgCAdDgdDmHcBIBEO+HRWAiKsBMO4dFQCAdATw6HBWHBWAgHBUHMOf/gICsOCoV4qw7+KxWHA6KhVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVC11Fz1+NP+/Xkqpr9OfuhQ6lZNWf+XsZc/si+KNoOj/Ntai9j7IISgZAklTqQhjToNTeQoreRdaSDODWvYAVFaWWkQmVuZPP8bRUzq896vc+XS6mm5gnnW7JLnV4z9N5XnW4k86x+uyHyxnWkmdborzraff2SvOtvljOtjd/5XRW8MivOsry/K3gUzrFPS1eFTOttTsul1+lLGdbV3c53h51mdbK7xPOr1SpnWlM63kedZnV4XPK86onnW7myrnWTmRTOqascoabXd/L+yuzS95dv1efjhl92ntYyTuIb6wuWRZFmWRa//PkZOcb/gqMACDf1LTLofggA9qc/gKRZiblqWYm3E24moSQnR9BJj6JwfBaFqWZZFoWvLUshNPxNuWn6bTZHgozRTSaNAY5oGjFQVgTkE6FUVorioK8VBXBO8VRUioAhxVioK4qAnIrYrCqKsVRVBORXBORVFcVcVwTgVBUBORUisK4rCoKwrxXFYE4FYVATjFcVhX4rcVBVFQV4rxVFSKwqCpFcV+K8VhXFYV4qivFUE4FaCdivBORUBOfBOgToE6FUVYqisKgqCtxWFbFQVxXisKgqRU4qioKuKwqCvxVBkH/4Mgf4Rg4RgfgxZBizhFYEVuDFvhFbBi3CKyEVsGLf/4MgAxaDFoGsWYMWgaxYBrFngxaDFnCKwIrAYswNas+DFgRWYGtWYMWBFZgxbgaxbgxZCKwGLIRWgxZCK2EVmDFmDFgMW4GtW8IrAYtBi3Bi0GLAYsCK0IrQit4MWeEVgRW+DFsI9cDW9AYtgxZhFaBrVgMWgxaDFvCKwIrIGtWhFaBrFuEVvBi3hFZA1i0IrYMWYMWAxaEVkGLAisCKzBizCK0DWrIRg+EYIRgQjABkHwODABkDhGDwODBgyAEYIRoRvww4YcKILYKILfhRg5htjY4OQbQ2hNAH8su//PkZP8cRgjWAFAUYjwDofQAi9pcJry1E1LUsuWvE2E0LQTcB+E2LMTctQFEEcWnFYVwTkAI4rRWFYE6BOhWwToBBAQgnIrisETANwIiAb/COEQEbgG+EcA38A3wjhGCMEeEaEeKoJwK4J2KoARBVBOIJ1FWKoJ0CcCuCdRWFcV4rioK4rAnYJ2K0V8VYr8E4xWFUVBVFQE6FXBORWFSKorxVFcVwToE5wTvBOoqwToVIJziuKwJxAQgnUVBUgnAqQCaCdxWirFaKwrRWFcE7FfFeK4rgnIrAnYrCoKoqgnAqCrip4qgnCr/////8Iu8BjvP4Ry5/8Izggc4Zw4RnD/hGcP8GThBk4eDJwgycIMnDwjOD4MnBA3eu9hF3kGO8gx3vBjvAN3jvMGO8CLvAY72DHeAbvXe+DHehF3kGO8gbvHeBF3oG713gG713vgx3oMd5BjvAi7wGO9A3eu8BjvMDd470Iu9wN3jvQY7wGO9wN3jvIRd4Bu9d6Bu9d6DHeAbvHewi7yEXecGO9BjvQN3rvIG7zykGO9A3eO9CLvYMd6EXegx3gG7x3kDd470Dd472DHewY7yDHeAKomwmhZFkAof8tCy4m5aCbcTUswFYsy0/LQTX9NBqBgJgYaY//PkZPcaTdCuAFgWlkI0DfQAe9r8Jxz6CShr8++JsArgjxNBNC0LQsyyLMsgRxallyyLIsi0LUTUtS0AVwFPia8si0LMTXiacsxNizLMTYTcsi1LMsy0E2LUsuJqJvxNyy/E1LMteWgm4mpZlkJuWRZFmWnLQTfgncVATkVcVQTsVIqQToVxWFeK4rwTmATCsCcAnQJyKoriqKwrxWiqKoqwToVRWBORWBOBVFSKgq4qAnAqAnArRVgnIJ3FYVQAgCriqK4qYqivBOsVoJwKgJ3FYVBWFfBOIqCoCcivipxUFSCd4qRV4rCvFaCc/BOhW8VxWFUVhX4r1eX/+DHgaYMOEX/CJgwwYQY8GODH/wYf4RAiQiAxCKBj4GAMYRQiwYcGEGMIoMfhECIBgEXAwCJhEA1BjhF+BhCIDEGARYGoRAYgxCLwYeESEUGMDEIoGAMAiAwBiBrCJ8GMGGEWEUGIRYMAYAxCKBiBgBqDDA1wiBEBiDAIsGIMANANMIoMAYhEBh4GMGMGARfAxBj8GAMANYRAYBFAwCIBhgYhEwNQMYGIRAMAiwNYRQi4RQYwYgahEBiBqBgESEUIqa6Z6bTBpGkmUwmkwaZpJlNCkifmkaaaBymgm0wmRPxSDTTa//PkZOYYTgboZUAQIkCEFgAAe898YTZpJtMJhNilphNdMJhMGgmemDSNJNmkaX6aNJN9MJhMc0E2mzSNJMpg0umU2mDS5oJlNJtNJnpg0DSTBoml0wmzTE8TRpGgm00mkzzRNNMJg0jQTSb/NFNdNGl02KTzRTfTPTSbTKZNLphNJpNmgmUymkwaaaTKZ/TSYTBoJr/ifptMpr9MJlNptMpg0kymumEwmf+mEwmOmkymTT5ppv80eaHTCYTHTSaNBNJtN80/0yaBoJo0k2aPTPNA0OaSaTJoplMJv9MgBAB4MBUGwbwVwUBkFAYDAU4NBoMBqhAELk//h/y1/vz6/6zMnEglwqnIsVSHBzAMMIqXiLgxS8ucoLCKl7VwipeupwYpeAxS8Z22hSl4U+qE1L2goKUva1GUJqXqwkpeAxS81IQpS8smBqXql6E1LyEVLxdEJqXoSUvAmpeJhFS8rpH3CKl6EVLxPWFKXgDUvVL1LCal4kuDFL2EVLxFlPClLyEVL2FKXhdwYpeswGpeqXkGKXqLAxS8wYpeqWk8KUvATUvQYpehJS9Bil6yoUpegipeZT2x1vN5NR2X3KrRuXjFmaS0AUCyE1BHflmWZacTYsvy05ZgAIs+WQCqJoWZ//PkZOwZ+gaYBgbm6EQMAfQAe9r8ZCbiaFkWv5ZibialoArlryyDtCSnyfR8hrE7PpNmiaIxDTGKafTJalqJoJoWQm4mnLUtSzE1LUsxNyy4mpZlqJpy14mgD8WpagKvLIEcJuWnLItBNhNhNxNgH8tSyLMTflmA/iaCaFqJqWf4mxZFmCdCvFWKwqivgnQJzFfwToAIwqgnOKgqCoK4J2KwqisKwJwKwqCqKgJwK4rYqirgnIJ2K8VhVwTmKorYrioK4JwKwrRWFQE5FUE6BOwTgV4qYqiuCdAnYqAnMVBVFUVATkVBVirioKoqCviuK8VwTjxWFfivFUVxXBOcVuKvFaKoqiuCdeEW3Bjb/gxvhFvCLYGN8GNwi3CLf8DbtuEW//CM7+DG+EW+DG8DbNgi3CLfA2zYItwY3gbZuDG8GT/Bk+DJ+DJ/hGdCM+EZwMnQZP8GT8GToRngc6dBk4IzwZOBk8GTvhGdBk+DG8Dbt8DbtgY2CLbBjYGNwi2A2zYDbN4RbhFtA2zcDbNwNu3CLaEW4RbeEW2DG8DbNwY3BjYDbNgY3A2zYItwi3CLbgbdvA27YGN/CLaDG4RbgxsDG4Rb8ItsI7oR3cGb00m0wmTT6aTZoJgUpMc0kwaa//PkZNcYqeLUAAAUHjw8DgQAe88cYTXTXNBpXiQdfLVpLJoaCSJs0TQNAbRpJpDWleaGlDmlfQ9fQ7tBZoa0IeOw3Ccq44TcHgrufDVzQNA0Om0wmDTNE0EymkymumU2mU0aSY6ZE8NFMmiaaYNDptMGn+aJpdNptNps0OmU0J50wNtMGmmEz/zQTJpppNplMJlM9M8FAYCoKAAApgqDIMACwAQbBsAMGQAQaCkGg0GgyCkGeCgNABwAAUgrwA+CoAQNAeHCAOAeAyIQHBwgDg4QYDAGgMEEOEAeA0Q4DxAHh0PEMGYMBsFQYDPgoDMGQV4NBqryAZfhGfwjMDl4Rv/wjcGT/4R/CPBH//hH4H3gzv4M7A+/gzoR4GdBnAf+DPBnwj4M7BnwivA1QIpCKcIpgaqDFgaqBogMWBqgGqgxQinA0XBi8IqEUCKBFcD7/CPwj0I+DPA/8GfBnQZ8I+EeCPwZ4R6EfhGcI0GSDIDJCNCMBkgdsIwGQDkBk4HIEZgy4RoHZwZQjcDtCMgcoRgRoRgHKDJBl4RgHIDKDIEYEaEZgyYMoRsIwGQGQIwGUGUI3A5AZMI2EaDLBlwjQZQjAjAZQoqIqqN+pypx/qNIqoqqNKNKcqchwGrCAPqN//PkZOsaCgjiBUZRnkhEBfAgw9tw+iu1RUqp2qNUNalOVG1GkV/U58sLU48sLLCiwFU4hAYA+qQQgasVhVIYQNWKwmAKpvasNoHIDm4OQHIDlGwNgbH4D+JuWQm4mhZFoJsWgm4I4TcbA2xtA5ODnGyNoHJ+NgHKDl/LMBXLUtS04mvLQteAqCaCbFoWQmha8bQ2Acg2ht8bI2RsjaGyNrjYGwNvjbByja/GxFYE4ipBOIrwTiK4J2KuK8BAK4rAnAJwKkE4FYE7FUVgEIqgIRVBO4qRXFQVBVBOMVwCcE5itBOoqAnQqCpBOIrxVBOoJ0KwJxgnQrCuKsVBXioCcCqCdAnYJyKsVYqipBOgjwiAj/8InhH4RMIkIioAC4RiJCMRP////CNk//Blkv4M6F8I9C/8GWT/8I2SwjZOEbJQZZIGWShGyYMsnwj0P///CPQ/hGyQRsn8I2SCNkgOyVkoMsnhGyQMslCNkoMsl4MsnhGyXCNk4MsmEbJ/wZZP8I2SA7JWTgyyQMiKDIieEYiAcRIihGIkIxFwZEUIxEA4iREgcRYihGIoHESIkDiJEUIxFwjEQIxEwZEWDIihGIoRiKEYiHcYJRIr9kzDmO5cIaApXE/NA0TTTKZGym/0//PkZMQWjdCsAwAWCsQ8Cfwoe89cyaXTKZACgKxsmybQFQCyPQPUbRtA9x6QAoegHKmRtClpk0RSkwaCYE/GyaaZ6ZFJTaaTCbTabTBomgmk2mxS0x0waSaTI2gcgOcT0T5MiedM9M9NCfCeGgNhMJlNJoT1MdNJhMjaNPptNGkmhtpnmgmv+KQmRSE0aaY6ZTKZTRoJg0U0aBopg0emU1/xPzTTaa5o80DRTZoJs0TRNEUhMikJs0P0x0wmkwmUymkwaKb5pppNJg0OaInhpGgmeaSbTBp9N/ptNJo0DTNAbOCkGAwGABgA4NgwAAAMAPBgAQKAyDAZgoCkFINAABWAEDAUBTAABgMBTgqACDcGAAQYDAUqLUlVt///+Bj4MIRcGH/hE//hEwY/wi8GPBj8GH8IgRcIv4RYMQi+DAIsIsIn8GHCLCJCJ/BhBgBpgwwifhFhEhF/gwCIDAGIMIMAMQYBFhFBgDH4GAMQiQNAYAwwYBECIAMIAMAAiHBgAMIAiAIg4MABgABhADAhEAGAARCBhCEQhEIMABh6EQAwIMABgCEQwMAQYD4MDCIcGACIQiHwYGDAhEOEQ4MAENB8hJD7PsnXJ0fZ98+D6LItQR3PgnZHmgPYYRopk0xj//PkZMkU/gLsKkITrkL0CfzIetvgJtNdNGkmkwCPLITf8s+WpaFmApAjgFUsyz49jSTCaGMmkyaRZlkJsWpaiagKBZlmWomh8c+CdcnROj4Pk+Akh9E6DsJ0fJ8c+OTs+idk4J2Tg+j7Pr8nB9nwfAa59k7598+D74Sk+eEkFQdDmKsOhwBEVYCeAiAmAiHcBEV4CYCIWmCHF6FqC0haRcF4XYvxfF2LwvC+FqC0xcC0C/FwLSFoF0XBfi7C0xei8LwvcLQLoWoXheC0BaIWoXBdiNiMY6cZ8RkZxnjqOojAz4zx0HUdBGozjoMw6iMjpxdi+L4uC5F/xd/haIui/bZ/+DGBp4RYMQYgw8Ivgw/CJ4RfBh/hECKBgEUGODH8InhFwY4GoMcIgRIMcInCIBrBhCIESESBp+DEGARfhEA1gxBjBj4RAYQYgxgYwiYRcIgMAiAwBjCJgYAawYYRQMQMAYhFgagYhEA0AxA1A1CJBhBgEXwMQNAihFhFAxwYAwgaYMPCJA1hEBiBrwYQiwYwiBFwYhFgxgawihFCLA0gYAwCKESBoBpCJ4MIRcGOEVB9ALR8BJj7/PonB9HyEoJwfZ9E4Dt5OeTnlqJtxNAH7nwfHPonJ8E759E6PoJI//PkZOAWKgjoZUAQYka0Ffgge9VcfZOCdE7J0To+Cc8JWTo+D7J0EqPoO0+T5PsJSfJ9n0TkJUfJOeTknPPo+z6J2Ts+ycE759/k7Pg+z5J2TonBOeTkJUTg+T5DtJ0Tvk5Pjk5DXPg+idH2HYfR9E6PgnR9k5JyfZ9cnR9cNYJSfROidE6Ps+Cdn0fB8E6DtPs+CdHwfH5OAlR8nyfB98+SdE4J0ff5OidH2TknfPkJMfYSg+Cd8+D6PsnP/JwTk++fYSQO0+D5J0fZ8HwTjn2AWDgdAL8ApALQCkO8GACwMgyAVBiAVhzwY4BeDIMgFMOh0ArDgc4BeAV4cgFsOhz/wP225HGw7wCsO4M8AqHP/+DEGQ7/8OgzgFoM4Bf4MhwO4BT4cDmHcGfDnw78GcVhUFTFXFeKoqYJ3isKuKkVgTsVoqCsKwrCoKsVQTqKorYWoXhfxeF/xdi58XOL4WmLnFYVQToE4FXiuK0VwTnFQVRVFcVhU4JzFfDgdhzBnDuHfALgyDAMQZBgGQCgBUAoDAMh3BkAsDMGcGAYgxBn+HAC0ArwCwMAS5adAry0yBSBfoFBVaKqKwVUVrRXUa9FUOEqVUjV3ySPLkvkzlNlNn02E2S06pvVKWACECpW//PkZN8VDgj+zymq5krb1ewAxJvkqe1XysDVFSqlVIo2o0ispyFVoqKNIrKcqNKcKcFhSjaKiKyKhYWiv6nCnCKijajSnPorKNKcKcqcIrqNoqKNqcKNoqKNKNqNKcIqKN//orf6BSbKbKBSBXlp0CvQKTYTZ/0C/LTxFxFoigioigCLC4cRYRWItEXC4cRcI0IoFwwXCiKwjQXC8LhRFcRcRQRSFwoikRcLhxFRFguHiKRF8E7FYVhVBOgCYVRUACKKgqgE0E6ACJFYVoJ0CcgnQrAnMVwTgE6ioKoRwDdhHhG4RARgDcCMEaEYIiAbwRIRuESEcIwRwiYRwjQjBEgWoFuBa4FngWkIQQigwhEwigx/CL/4RfCKEQGP/wYiEUwYHwYGDAwYAGA4RCEQBEGB0rCNcGU4RrBlcIsGGDCESBiEWDCBhCIEWBiDAGHCKEUGEGEGMIgMAiwigxCIDADQGIRfCIEQDXgYYRfBgBoESEXwY/CJCKEQIsGIRODEGIRQYgw8IgRYMMGAGGDEDGDAIoMcDQIkGMGGBrgwCKDAIsIkDUDWDGDDA1hE4RQMQYgwBhhFBhBh4MAMYRMIoRAiAxBjhF4mhZFpxNBNy0LQTUTXhKglR9FqWpaAP5Zi//PkZNYXkgTkGEJwlkXcDfQAe9r8bCa/k5JwTriacsizBHE6CSH1w7efHLPgjuJqWnLITYTX8tRNAH/ialqJuJuWZaFkCO4m5aE7J2TonB8E559nyEnJyfB8FmJrxNxNhNS1E3LT8sxNC0E0LTlqJuWQm3E15ZiaFqWRZiaCagP5aCblkKoqCsCdioKoqwToE6FcVwAhRWBOIrCpFbgnEVRVFUVIJ2K4rAnIqioKgrcV4riuK0E4FcVQTsVxUBOoJ3FUE7itFYE7FYVRXFUVwTkVoqAnYJxBO4rReF4XYWsLWLoui4LwuC9AdsLQL0LQA9C8Lgvi6LguBahfFwXAtIvQQ4vCqKwrxX/8E5xXit4JwKzBnwj+DF+F1guvBiQYkDRIR8I/gz8Gd4R/wYsGLBi8I8DPBneDPBnwZ/8I8DP8I8B/0Gd+DPA+8I/+Ef+DOgzvwj4R/hHoM+Ee4M4D74M+Ef/A/7gfcDPBn4R7BnfCPgz4M7Bngf8DPwjwR6B/3CPwj0Gfgz+EfBnhH8GfwioRQGIBqgRUDVAYoGiBFcIoBqoMWEUA1UDRYRUIqEUA1WBooGiAaqBogRUGJwigM8I/gz+DOCPwj/Bnwj3BnBHgZ4M4I+DOhHhNCz5aiaCb//PkZM0YugrgAAASBEUEBfQAe9rclmWompZ8shNyzLMsy1LMBUAfhNxNicBJCcE5J0JpyyLMTcBVLXloCO5aCagKACiAqflqWYmvE3E3BHlmArFnxNRNC1LUBS5aFoWhZFmWR8k5CTnxz4PonZ8E5Pg+j4LUshNQH4TYtSzLMshNBNhNSyAViyE0FQE4FYVoJ0CcRUgnYqisKoJxFWAhiuKgrCtFUE7FQE5iqKgqRVFWKorwTsVxVFYE7FTFTBOxVgnAqRXBOPisK4BOK0VoriuK0E5BOxUivFcE5FYE5FQVBXFQE6FQVBVFYVxWioCcCoLovi4LoWiL0LSL+LouBaIvBahdi6LoWgEMFoC1hacXxdC14uipiqKn8VPFbiqKsVb//Bm/+EXgx4RdhFb///hE1/8GLP//CKwIrQjoGa/wPewZqEdYM1wZqDNAetgzWEd8GagzYM2DN4M1wjoI7Bm+DNhHcD3rA9awZuEdwZvCOwjsGaA964M1A978I7hHQR0DNge98I6hHYR1wZrBmwPWgPWwZsI7wjqB63COvgzQR3BmwZsGaget8D3rCOgZoGa4R1gzYM0EdwZsI6CO+DN4R1wZsD3oGaBmwjqEdAzXCO/4R0DNAzYR0WgI8TQT//PkZL4XFgTcAE6Tekf8EfQAe9t8YTXiagKwCsJuWXLMTUtC1LMTT8TYTUJP+fAdomomoD8JuWoCgWoI7iaFkJqJqfZ8hrk4CSE5Pk+Cdk5PgnBOT7JwTg+uWZaiaCbcsgFAsy0LPlmJsWYmom5ZFmWpaibiaAjy15ZFkWQm5Zll+JsJqJvy1E0CThJz65OQlJ8H2TknZOT759k6J3z4PgTQTcsy0LITflmWfLUsiyLITYTcTT8syzLQsi0LMEcWZa8tSyE1LTibibFqWYI/8shNCyE1LQsy1LUTUBTLLloWXLUsiyLUtBN+JqJvy1E05Z8TcsxNeWn/LTnxydHwfZ9n1ydk4PsnHJyfR9E4JwTgnB8k4588nB9cnR8c+D7PjxV4q4r8VsVgTgE4/itFShX/xV4rirxVFWKoq4qfxX8E6xVxUBOYrCtwTvwTj/xV8E5/irBOsVuKwqRXFTFQVorCrFf/xWioKwrCtioCcxUFUVAToE4FUVxWFQVhUBO4rgnUVIJyKkVgToE4ipFUVoq4qisKsE64qCoCdxUFUVxXFUE78VxWFQV4qiuKgqiuK4CCK2KoqirBOATsE4FWK4qxVFUVhVFYE4gnIriuCcQTiK4rCoCdCtirBORUiqK2//PkZLAWsgzuADQNNkZj/fjIe9r8K/FXFUVwSE5aiaAKgmhaFpxNQkp8n3z5PsJOGsffLQsyyE1LItS1E1Af+CPLMTUTfibFmJoWQmxanzydHwTsnASknBaCalqWom5ZcsxNyc8nASsnHDt59BrhJgkpOicBKg7D7JyfZ8E5Pk+Cd8EeWXE0LQsiyLQtSyLIsi0LUTYsy0E3LITQshNiyLUsiy4I78shNy0LMVcE6ipgnArRVgncE4wTsVIrCqCcCtBOYrwTgE7iuKwqCoKwrcE7BOQTqKgqiqFpBEC1gPYD3F0X4WoLTF0Xxei6FqC0BaAtQWgXxdwtWFqC0haBW/FQVRUBOBUFcE6ioCcAnEVRX4rYrxWFUVBViuLsXgtAuC6FoBDBaYvi7F8XxexdF8XhcFyI//gx//CJBhgxhEwY/+EXwYgx8ImDH8GPhE8GPhEwigwhFwNQNQNfhE+DGDAGHCIBrhEhEBh4RQMAY/gYBFBhhEAxCIDCEUDEDHBiEUIoRQY+DCBp4McGEIgGgMcGIGMGIGIGgRQYgxCKBiBjBgDGESDADWBgEUDEIuDADWBpBiEUDEDDgYgwBgDEDQDUGIGgRAYQYAxCKBhCKEThEBgBiEUGIRQMQiQiwNAY//PkZKwWNgjoZUAQREakFfQAe9t8YMfwi4GBaFoJsWpaFlyyBHctCzE25ZiaFoAocsy1E24Sk+idk6LMTYTYTQsyyLUtCyLQTUswFYJMGuTg+CdHwErPotAFAsuJtxNCz4m4mvBHiafloWZZ8YppBqzTNI0jTNBMpg0jTTZZFqWfE3Af/xNf+WomhZ8suWZZCb8tC1LQtS14m/LQtBNhNOfR8hKCc8nHJ2EqCUE5CSHxydk6Pg+D7Ps+Sdk6LUTQTcTcTctSz4mwmha8TXlmJvyy5ZiaFl+WpZFoWZa8TQshNCz4mhalmJsWfLQsuWRactBNRNC1E1LLlly0E2PgJWfR8h2H2fJOSdnx+fXPs+T5PgNbnzz6Po+T7JwTk+z4PonROglJ84qCvxXxUirFX4q4qeCd1f8InCI/4R/CP//4RMI/CMEYI4RAR8I8IjCJ4REI/gG8ESEfCOERCP4R/+EaERCPCNCNCI4BvQjYRMHINobIOfjZBzDZG3xtja42gcw2PwcvG2Nng5+NgbY2wcn42htDYGwNrjYGwNsbX42vxscbI2gc3Bzg5Qcg2uNvjaGwNgbI2+Dl4OUbI2Qc42RsjbBy//g5eAboR4RwjQDeCP+EcI8IwBuwjwjBEBEA//PkZKoZMgrqADXt9EV8FfQAe9scG+EThEBGCMESESEbhEQjwjwjwjBHCIwiQDcCNCI/hHE0/LQBSLITf/lqWoSvk7LT8BWLMtRNAk58E7Po+CyLQTcsyyLUsi0Afi1LUTUTUtBNS05aFkWpZHzwkoSgnB9HwfQSsTYsizLQtRNRNgFf/8NcJWEmAWCdn0To+T4CUHyGtxNiyLT/lmJqJqJqWgmpZFqJsWgmwmwmwmv5ZiaibiactBNv/yyLTiaFkWZagKgCmJqWQmgmom3E0LTibAKfE0LLiuKgrYqipBO4JzFUE5BORXBOhVioKwqRWBOYJyKkE6BOIrYqCqCcxVxVFUV8E4FSCdcVgAgCuKkLTBDC6CHi+LwuRfha4uC+FpF8XQtAWgB2wtAWoXBchaBfwtQWnFSCdxVxXFUVhUFYV4rgnOK3wTiKir//1eDCsf//7/+wOYd///ei/f6lmiqGXpyOlCSRm+yP3UtDhFIzqBhwCFHAGFHABYGcAnAAMOAAYcAAw4BYKOAIROANgicAQYcABE4AAzgE4B+1wmcAwYcAK+sDOADgFLCJwAlWBnABwABnABwDWraETgEDOADgDBiRkgoJpGaP+64RSMoRSMGBiRkkwMSMlq7AxIy4//PkZJUYEgieBFw3fkL8FgAied8AROAAicA8DOATgAGHAAROAFwM4BOAGBhwADDgAGHANQUcAgicAYROAfgw4AIkbPNNNpo0TSNBNJgUs0l7lomEwmRSOaRp80zQFK4nvTInnTEGgwGwAwYmOmkyaInppJpMJg0k1+KUaaaTCb42U0mBsGiaSaNNNpo0OaKZNE0jTTSY5oGmaZpJrphM9MGkmDQTCZBzpg0OKR+mBtdMJobfTSbTfG2KSaBpGgaZomiaBomn02mOmkwmjSNPpjmmaKZNA0zSNFNCeClJkT40DTTCY5oJk0kyaJpdMppMdMdN80TR6ZTXTfNJNmimumem+aKZTKaTaaTRops0kwaZppk0+aSa6ZTKYTfTfTPTHTKa5omgmEyaJo9NmkaRp/pnmmaf6aNNMplMplMdMpv8TxMJlNplNJn9MdM1OM6hWa/EjiRiRiO/xIcSP+GgCZQ1+GvDRDV//4aP///4I8EwTwTBLwS/4AHgnBHBHgiwR4JgAgS4IwAYPA8ADg+AAAAFwfB4L4WADC2AGAGFwsFwuD2FgAcAPC+F/B8L4X/B7B4L4WwuD+AGDwXACAAC2D2AEFgfCwAAAAXB8LhcLeDwXCwPYPA+ACACD+AH4XwA//PkZJMVIgb2ejVLxkBMEgTIe898vwv4X/ACB/C4WwtgBg/gA4PA9gBeFhLRTXTRomkmP0yJ6J+mPy0NA0OvibNDQmfzTNNMjaFKNATxMiemiaRoGkmE2mkwmTRTHNBMGiaCZTSZTZomh0PaV9fX2hoX14kzSmOaCY5pJr80U0aPTfNFMps0jSNJMmiaSaTKb6aTKYNLphMpg0eaJoGkJ8aBoppMppMJg00xzTTabNFNJpNJpNpnpg0DT6bTRoppoJMWrSh/690NQ5paV5D2le/LND2hoQxDF/rzR1/r/aWhfaWleQxfXmheaevNDS0tLQ0ryGoch/X15D+vLy+0oc0ry/19DUOXuvIc0oav9oXkNX1/r3X18QCGHQGQHB8PiAPAaHgPDsBgcH+Hqv//+DJ0GNuEW4MbQY2wZO4Rn///4R34R3Qjv//8Gbv//8GbgZuwZvCO4GbsD37+Ed3A586DJ4Rn8DnToRn8GTsGT8GToRn4HOngyf4HOnBGeDJ0IzgjOCM8DnTwjOgydwOdP4RnYMncDbtwY2A27cItgNs3CLeDGwMbwY3CLaEWwRbQi3A27eDG0GN4G2bBFvA2zcItgY3A27YGN4G2bAxtA58/gc6eDJwHOnAyfCM7A588//PkZLMYngTSAFAUhEYcDfggw9V8DnzwOdOBk8IzuEZ4MnAyfgychsy7F3oE13Nl9sy7myrsL6qqOU5anCqkHqNDI3KVUTEU8GNU7U6gxyHKchyVV/Xa2Zspfds3rubK2VsjZmztk9djZi/TZV2NnXYu0vsm0yaBoDZNEbA2k0aKZNjmwbH/Nvm2bRtGyBVArD1G0bQPUevg9h6/+PRzZNkCrzZNgesegesermyPQPXzbHpNvm0PQPUPSbJs82TaHqAtj082h6DaNn8eo2DbHrHpNjj1m1zYHqNo2jYNnmwbPNgek2ja5sj0D1m0bJs80xtJlMdMCeps0U0meaaa6b5p/mmmU3zRTfNFN/pgHPzQNPmkaaaTXTKbTRoJk0zS6b/NBNdNJlNGj02aH6Z4IgAEEYJ4I+CMEQJcEUEXBOpHDX/w1Q0Q1Q1cNWGvw0Q0/hp/AmIaA0cCYhow0w1/w0hoDRhpw1w1BrgTLDXw1BrhrDQGgNQEzAmOGuGiGgNfgTHDQGoCZw1w0BrDWBMIEzDVDTDUGgNfAFwGjBrg1A1YNcGsAXAaQaABcBqg1g1QagaINYaoEyw1Bow1YaA1hoDSBMw1gTICYQJkGrDQGoNGGmGsNcNQawJkGuBM4aIa//PkZKAYngTsATQNQkKMFgDifh7AYagJkGsCZ+GkNWGiGsNAaYaOGgCYgTENQaw0Yaw1Q1Q0/hqw1BkAfmkaCb6ZTCY6bNBNLwmqGA5fzSTCb/lgwXOmMmMmTQ5pmkmUwmkymfzRTaZFJ6aNM002NrppMpg0kwKQmE2m0yKUaKaE95o9MJj9N9NJk0UymOaSaE/TabNNNmmmk2mU2aHTKZTCaNDjaTJoGimkyNvpk0TRTHTf6bTRopg001+mU0aXNBMjYNA0k2mjR5pfps0U100mUz0ym02mDRTHTaaTRpplMc0kz0ySA000mDSTKbNI002mzQTHTaYTf//NA0zQTBodNJk0UyKSaaZNJMprmkaP5oGmKUmEymUyaCbTHNBMJlN80DRNBMmkm/00mUwaZpprplNpvmiaJo80+aSa//TaY/6ZaH//wY4ReEX4RIMfwiAxBh/BhCJ/+ESDDwYcIn+EQIoMAiQYAw8IsGIGGETBj4MP4MQiAxhEAwAxAxBjBiEUIgMIMcDCDAGIMcGMDEGGBgEUDTwNfAx4MAiwiQYgwBgEUIgMIRAiQYhFwYAwBhA1CKDEIoGoGgMQi4MeDADGEQIkIgGMDCDAIoMAiQiAYwYYMQNQigwCJBiDEGAR//PkZJwV+gzoZUAQRkZsCfQAe9tcQYgx8GEGIMQiwMAY4MANAMcIoMSyE1E1/LMTUtCz5OD5PkJJz5Pk+uA/FqWRaib8TUTUTQtC05alqWYm4momgI8TYsxNCzE3LUtQFEsgFM+z6J0fB8nz+TsNcnB9BK+Tk+g7CdhJT6LTiaFqWYI7lqWoCvy05ZlnxNy0/LUshNBNvwR4moCj+Wv5ZlkJqWpalkCOE1E1LQsiyLITUBULLlqWZZlmJsWhZcsi1/4CiWpalkJqJuWvLXlkJsJpyy4mwm5ZlmJuWXLUTQteWgmgmwCsJoWfE3LMsiyLP8TTlkJuAolqJryzE1LTibCbloJuWhZFoWYmxZ8TcXIvxeC0i+FrF0B2i4L8LSL4uBaIDyCHF8XRfF6FqgiwtIuYWoXIrYqAncVvxVip8VIqCvUxPqtFbFf/4q/8V/8V/iririr8VATjxXipxWgnYq+KwqfFTFQVoq+KsVBW8VhUisKuK0VRXivFYE4FTBOhVFcVRV4riuCdCuCdCtwTiCcCqCcgnYqxWFcVIJwKsVxWisK8VxVgnArYqRWFeK0V4qgnQrgnYrfBOoqAnAq4J0CciqKviuK3BOoJyKsE4FUVoqisK2KwrAnArgBAFSK4//PkZJ0VagjyJgGtbkOkFfwAbh4AqRViuK4J0KgrCrFUVxVjOEeDQgjlcT4T40xtjaNI0uaI2QciGNJIl4kJZtCGIaSckIm6GL3TQ2zRTY2UwmjSNE0fxS02aY2BsJs0/+mzSE8TQpHTKZTaaG0aQpApZp/mmm+aHTfTCZGwNgUk0E0aRp/ilJlNJgT5MmkJ9zQNA0TQTH6ZG2mk0mk0mk3zQTKY/G3zQTHTabTBpGgmU0aKaTJpJpNJtMphNjYTfNE0emkymE2mEyaCbNBNfmkaJpdNJnpg0k0mDTTCbTaZTBp80k2aCbTfNE00yaCb6bTZoplMmmaKZTKaTJpmiaHTXNJNdMDbTab6Y6Z6ZNNMJhMJhN9NJrmim02m0ymU300aPTSa6Y//5pJpNdN/9NppxWxU4Jx/xWxU/xU4qcV/ipiuKwqxWFbioK/8VIqivFTwTkVgTkVor4JxFXxX8VcVxUFQE4FaCcwTvBOIqwToVuKwqCtFUVYqxXxWFeK0E7FQVYrwTnwTsV4rCqCcfFaCcRVFQE5gnAr4JyK4r4Jz4J0Koqip4rCvisKoJ3xWBOME7iuKgriuKgrAnAqgnArxXiqCcgnYJzFQVQTmAEIVYrwToAIYrwTiKkVQTkE5//PkZK4XGgzsADQNAkIcCfwAe898FXFTFYVxXxUFQVkzzS5oilg5TTTY2kyaJpJtNGgJ8aKaTQ2k2aCaNI0eaSYNJM/tKHEiQxfJG09MmgaSYTRppg0TRNNMJlMptMCfppNprmiaA2jQNLmmaRppk0jRFLNP9NJhMGmaQpZpJhNCkGkmE0J+mxSk0m0x02mjRTKbTCZ42EwaQpJpptNprmgaRpmim00J4mzSNM0kymkyKWmE0muaKYGwNjmgafTPNE0U0mUwJ7+mem01+J8mhSk2mjRTSb6aTCbNBM9MpjpjppMpk0E2mE2mE2mjSTfTaZ6YNFMcT1MpnprptNmim0wmE100aSaTRo9MGjzTTHTaaTfTSaNLpoFMAAFYNBQGwAvwAYM4NgqqkjaAN3d3d3etERNK5CZ/3Ctf8AaiAc/u7vaIn/+8XPv//+GDKv8W1/+AC8K4Yw+94xe940jgceOBwOcRaxGwH4EuNIjBfxazB8HhkwVjIAII/vDkjG/wAcJPeF5e98hNgSYLWMFvhZ73pX06aoehpmh01hMJtM9K3TKY9E10x+memvlIpZM9MUTCbShbUrtM+n5ophNZuXK+0wmemumMCemkmvc0Uwm/lJJlLe5oJZI0SyW6R0mE//PkZLcXlgrzECFvrEmMEfgAfh7k2aORpbTYUo9SBNsekGYNVKgqg6hrUXK4Q42DOwPWbILEzBSumEgkWJPU8S72G5wUuGDwguEKa1Q0UykS3Bn7FJNgg5qoEgpsGabBtGabZt7NrKCNgLYes1idmabBtm2bZsBRm0PQbF9mwPSPUBbMwzB6QojYM42ePTzbMwzR6TaNs1eBVNv81yDUJ2QYhJtD0m0PVe+x6T2M8HsbFwsh6B6D7HpugT2uZhO6HqZhmE7ISZhhkFNcghtmybBnnsD1Ho49ZtG2bZs5PVBc2EEepCaEHNjj1EJHq5smabZtmwbNEEPR+bJse9z2PY2T1SN0rdNJq6yXI06COvNJj9MGmkkGmUj7pI0TToNGlEsNEnCW10ymi5FtNFKpvps0kz0uW3aaTF00mTSzdNJu0KFYz1KjaGAhyoQCFGM//zFARgIUZ/oZpdCttay6M5drW1joSj6Ekk1b7J7R7aoQNlPrWBKLTTzOsGT5yYxLrtHTy2iUxEkES0HIBVD066VjGj31odPkkSjJtbWs6OIjKmlXHR9K5MTv5pdZolE10kk2lly74TFx5KTXeTGLrS6ExiucvJSSDUdXZm3NLn1rtYBCUEoRj77WOhCPc+g5//PkZJ8XPgzoAABMTrz8BfQyY9ONGxJULutaa1TE5LHxWEo+XecmMa3p0kqBCR6qOFaFUGpNJIIjqVi0ylBqJIkiSJIkmJj605EkSRJPetWAyVacmodBUVhGfrAZPF0AUrgRLNiqDU4VHo8h6HRObJJNdqlRBMFT0qdNE0WZhmay2tCuOY6oieWieianCnVSbzjd7SGhrLi6eUSeLcZTWqdML5PM50uOGJms9VqtYU6hrgrm4V0frUzTvYsiegR2FOkqUxSKdVCpmRCSkIAUZ4VPhqEKgFDU2VhUiIhUaIg0RAkTBYEjYBUbBMuCJgLAkCUBUinABgBE3/9EQqFRM0s0qzktk9ZFqqFC6RULE11JVDkd8Y1vVFOx9oUIpZ8Vnq5klkxBTUUzLjEwMKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq`,sq={NotAllowedError:`permission-denied`,PermissionDeniedError:`permission-denied`,NotFoundError:`no-camera`,DevicesNotFoundError:`no-camera`,NotReadableError:`in-use`,TrackStartError:`in-use`,OverconstrainedError:`overconstrained`,ConstraintNotSatisfiedError:`overconstrained`,AbortError:`aborted`,SecurityError:`security`,TypeError:`type-error`};function cq(e){if(e instanceof DOMException||e instanceof Error){let t=e.name??``,n=e.message??String(e);return n.includes(`secure context`)?{kind:`insecure-context`,message:n,cause:e}:n.includes(`Stream API`)?{kind:`unsupported`,message:n,cause:e}:{kind:sq[t]??`unknown`,message:n,cause:e}}return{kind:`unknown`,message:typeof e==`string`?e:`Unknown scanner error`,cause:e}}var lq=[];function uq(e){let{videoElementRef:t,onScan:n,onFound:r,onError:i,retryDelay:a=100,scanDelay:o=0,formats:s=lq,allowMultiple:c=!1,sound:l=!0}=e,u=(0,L.useMemo)(()=>[...s].sort().join(`|`),[s]),d=(0,L.useRef)(null),f=(0,L.useRef)(null),p=(0,L.useRef)(null);typeof window<`u`&&d.current===null&&(d.current=new XG({formats:s})),(0,L.useEffect)(()=>{typeof window>`u`||(d.current=new XG({formats:s}))},[u]),(0,L.useEffect)(()=>{if(typeof window>`u`||!l){f.current=null;return}return f.current=new Audio(typeof l==`string`?l:oq),()=>{f.current?.pause(),f.current=null}},[l]);let m=(0,L.useCallback)(e=>async s=>{let u=d.current;if(t.current===null||t.current.readyState<=1||u===null)return;let{lastScan:h,contentBefore:g,lastScanHadContent:_}=e;if(s-h<a){p.current=window.requestAnimationFrame(m(e));return}let v;try{v=await u.detect(t.current)}catch(e){i?.(cq(e));return}let y=v.some(e=>!g.has(e.rawValue)),b=v.length>0,x=e.lastOnScan,S=s-x>=o;(y||c&&b&&S)&&(l&&f.current?.paused&&f.current.play().catch(e=>console.error(`Error playing the sound`,e)),x=s,n(v)),(b||_)&&r(v);let C=y?new Set(v.map(e=>e.rawValue)):g,w={lastScan:s,lastOnScan:x,lastScanHadContent:b,contentBefore:C};p.current=window.requestAnimationFrame(m(w))},[n,r,i,a,c,o,l]);return{startScanning:(0,L.useCallback)(()=>{if(typeof window>`u`)return;let e=performance.now(),t={lastScan:e,lastOnScan:e,contentBefore:new Set,lastScanHadContent:!1};p.current=window.requestAnimationFrame(m(t))},[m]),stopScanning:(0,L.useCallback)(()=>{p.current!==null&&(window.cancelAnimationFrame(p.current),p.current=null)},[])}}var dq={finder:!0,torch:!0,tracker:void 0,onOff:!1,zoom:!1},fq={facingMode:`environment`,width:{min:640,ideal:720,max:1920},height:{min:640,ideal:720,max:1080}},pq={container:{width:`100%`,height:`100%`,position:`relative`,display:`flex`,alignItems:`center`,justifyContent:`center`,overflow:`hidden`,aspectRatio:`1/1`},video:{width:`100%`,height:`100%`,objectFit:`cover`,overflow:`hidden`}},mq=e=>e instanceof Date,hq=e=>e==null,gq=e=>typeof e==`object`,_q=e=>!hq(e)&&!Array.isArray(e)&&gq(e)&&!mq(e),vq=e=>hq(e)||!gq(e);function yq(e,t){if(vq(e)||vq(t))return e===t;if(mq(e)&&mq(t))return e.getTime()===t.getTime();if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!yq(e[n],t[n]))return!1;return!0}if(!_q(e)||!_q(t))return!1;let n=e,r=t,i=Object.keys(n),a=Object.keys(r);if(i.length!==a.length)return!1;let o=new Set(a);for(let e of i){if(!o.has(e))return!1;if(e===`ref`)continue;let t=n[e],i=r[e],a=_q(t)&&_q(i),s=Array.isArray(t)&&Array.isArray(i),c=mq(t)&&mq(i);if(a||s||c){if(!yq(t,i))return!1}else if(t!==i)return!1}return!0}function bq(e){let{disabled:t=!1,className:n,style:r}=e;return(0,H.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,className:n,style:{stroke:t?`grey`:`yellow`,fill:`none`,strokeLinejoin:`round`,strokeLinecap:`round`,strokeWidth:1.5,...r},width:`28px`,height:`28px`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,H.jsx)(`path`,{d:`M3 3L6.00007 6.00007M21 21L19.8455 19.8221M9.74194 4.06811C9.83646 4.04279 9.93334 4.02428 10.0319 4.01299C10.1453 4 10.2683 4 10.5141 4H13.5327C13.7786 4 13.9015 4 14.015 4.01299C14.6068 4.08078 15.1375 4.40882 15.4628 4.90782C15.5252 5.00345 15.5802 5.11345 15.6901 5.33333C15.7451 5.44329 15.7726 5.49827 15.8037 5.54609C15.9664 5.79559 16.2318 5.95961 16.5277 5.9935C16.5844 6 16.6459 6 16.7688 6H17.8234C18.9435 6 19.5036 6 19.9314 6.21799C20.3077 6.40973 20.6137 6.71569 20.8055 7.09202C21.0234 7.51984 21.0234 8.0799 21.0234 9.2V15.3496M19.8455 19.8221C19.4278 20 18.8702 20 17.8234 20H6.22344C5.10333 20 4.54328 20 4.11546 19.782C3.73913 19.5903 3.43317 19.2843 3.24142 18.908C3.02344 18.4802 3.02344 17.9201 3.02344 16.8V9.2C3.02344 8.0799 3.02344 7.51984 3.24142 7.09202C3.43317 6.71569 3.73913 6.40973 4.11546 6.21799C4.51385 6.015 5.0269 6.00103 6.00007 6.00007M19.8455 19.8221L14.5619 14.5619M14.5619 14.5619C14.0349 15.4243 13.0847 16 12 16C10.3431 16 9 14.6569 9 13C9 11.9153 9.57566 10.9651 10.4381 10.4381M14.5619 14.5619L10.4381 10.4381M10.4381 10.4381L6.00007 6.00007`})})}function xq(e){let{disabled:t=!1,className:n,style:r}=e;return(0,H.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,className:n,style:{stroke:t?`grey`:`yellow`,fill:`none`,strokeLinejoin:`round`,strokeLinecap:`round`,strokeWidth:1.5,...r},width:`28px`,height:`28px`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,H.jsx)(`path`,{d:`M12 16C13.6569 16 15 14.6569 15 13C15 11.3431 13.6569 10 12 10C10.3431 10 9 11.3431 9 13C9 14.6569 10.3431 16 12 16Z`}),(0,H.jsx)(`path`,{d:`M3 16.8V9.2C3 8.0799 3 7.51984 3.21799 7.09202C3.40973 6.71569 3.71569 6.40973 4.09202 6.21799C4.51984 6 5.0799 6 6.2 6H7.25464C7.37758 6 7.43905 6 7.49576 5.9935C7.79166 5.95961 8.05705 5.79559 8.21969 5.54609C8.25086 5.49827 8.27836 5.44328 8.33333 5.33333C8.44329 5.11342 8.49827 5.00346 8.56062 4.90782C8.8859 4.40882 9.41668 4.08078 10.0085 4.01299C10.1219 4 10.2448 4 10.4907 4H13.5093C13.7552 4 13.8781 4 13.9915 4.01299C14.5833 4.08078 15.1141 4.40882 15.4394 4.90782C15.5017 5.00345 15.5567 5.11345 15.6667 5.33333C15.7216 5.44329 15.7491 5.49827 15.7803 5.54609C15.943 5.79559 16.2083 5.95961 16.5042 5.9935C16.561 6 16.6224 6 16.7454 6H17.8C18.9201 6 19.4802 6 19.908 6.21799C20.2843 6.40973 20.5903 6.71569 20.782 7.09202C21 7.51984 21 8.0799 21 9.2V16.8C21 17.9201 21 18.4802 20.782 18.908C20.5903 19.2843 20.2843 19.5903 19.908 19.782C19.4802 20 18.9201 20 17.8 20H6.2C5.0799 20 4.51984 20 4.09202 19.782C3.71569 19.5903 3.40973 19.2843 3.21799 18.908C3 18.4802 3 17.9201 3 16.8Z`})]})}var Sq={bottom:85,right:8,position:`absolute`,zIndex:2,background:`transparent`,border:0,padding:4,margin:0,display:`inline-flex`,alignItems:`center`,justifyContent:`center`};function Cq(e){let{scanning:t,startScanning:n,stopScanning:r}=e,[i,a]=(0,L.useState)(!1),o=(0,L.useRef)(null);(0,L.useEffect)(()=>()=>{o.current!==null&&clearTimeout(o.current)},[]);function s(){i||(a(!0),t?r():n(),o.current!==null&&clearTimeout(o.current),o.current=setTimeout(()=>{a(!1),o.current=null},1e3))}return(0,H.jsx)(`button`,{type:`button`,"aria-label":t?`Turn camera off`:`Turn camera on`,"aria-pressed":t,disabled:i,onClick:s,style:{...Sq,cursor:i?`default`:`pointer`},children:t?(0,H.jsx)(bq,{disabled:i}):(0,H.jsx)(xq,{disabled:i})})}function wq(e){let{className:t,style:n}=e;return(0,H.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,width:`30px`,height:`30px`,viewBox:`0 0 24 24`,className:t,style:n,xmlns:`http://www.w3.org/2000/svg`,children:(0,H.jsx)(`path`,{strokeWidth:.2,stroke:`yellow`,fill:`yellow`,d:`M14.516 15.158l.714.714-4.595 6.14-.75-.364L12.337 13H6.978L8.22 8.861l.803.803L8.322 12h3.036l1.793 1.792-1.475 5.16zm5.984 4.05L4.793 3.5l.707-.707 3.492 3.492L10.278 2h7.972l-5.025 7h7.149l-3.71 4.957 4.543 4.543zM12.707 10l3.243 3.243L18.376 10zM9.795 7.088l2.079 2.079L16.3 3h-5.278z`})})}function Tq(e){let{className:t,style:n}=e;return(0,H.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,width:`30px`,height:`30px`,viewBox:`0 0 24 24`,className:t,style:n,xmlns:`http://www.w3.org/2000/svg`,children:(0,H.jsx)(`path`,{strokeWidth:.2,stroke:`yellow`,fill:`yellow`,d:`M13.225 9l5.025-7h-7.972l-3.3 11h5.359l-2.452 8.648.75.364L20.374 9zm.438 3H8.322l2.7-9H16.3l-5.025 7h7.101l-6.7 8.953z`})})}var Eq={bottom:35,right:8,position:`absolute`,zIndex:2,background:`transparent`,border:0,padding:4,margin:0,cursor:`pointer`,display:`inline-flex`,alignItems:`center`,justifyContent:`center`};function Dq(e){let{status:t,scanning:n,torchToggle:r}=e;return n?(0,H.jsx)(`button`,{type:`button`,"aria-label":t?`Turn flashlight off`:`Turn flashlight on`,"aria-pressed":t,onClick:()=>r(!t),style:Eq,children:t?(0,H.jsx)(wq,{}):(0,H.jsx)(Tq,{})}):null}function Oq(e){let{className:t,disabled:n=!1,style:r}=e;return(0,H.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,width:`30px`,height:`30px`,viewBox:`0 0 24 24`,className:t,style:{stroke:n?`grey`:`yellow`,fill:n?`grey`:`yellow`,...r},xmlns:`http://www.w3.org/2000/svg`,children:(0,H.jsx)(`path`,{strokeWidth:.3,d:`M16.279,17.039c-1.396,1.209 -3.216,1.941 -5.206,1.941c-4.393,0 -7.96,-3.567 -7.96,-7.96c-0,-4.393 3.567,-7.96 7.96,-7.96c4.393,0 7.96,3.567 7.96,7.96c-0,2.044 -0.772,3.909 -2.04,5.319l0.165,0.165c1.194,1.194 2.388,2.388 3.583,3.582c0.455,0.456 -0.252,1.163 -0.707,0.708l-3.755,-3.755Zm1.754,-6.019c-0,-3.841 -3.119,-6.96 -6.96,-6.96c-3.842,0 -6.96,3.119 -6.96,6.96c-0,3.841 3.118,6.96 6.96,6.96c3.841,0 6.96,-3.119 6.96,-6.96Zm-7.46,0.5l-1.5,0c-0.645,0 -0.643,-1 -0,-1l1.5,0l-0,-1.5c-0,-0.645 1,-0.643 1,0l-0,1.5l1.5,0c0.645,0 0.643,1 -0,1l-1.5,0l-0,1.5c-0,0.645 -1,0.643 -1,0l-0,-1.5Z`})})}function kq(e){let{className:t,disabled:n=!1,style:r}=e;return(0,H.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,width:`30px`,height:`30px`,viewBox:`0 0 24 24`,className:t,style:{stroke:n?`grey`:`yellow`,fill:n?`grey`:`yellow`,...r},xmlns:`http://www.w3.org/2000/svg`,children:(0,H.jsx)(`path`,{strokeWidth:.3,d:`M16.279,17.039c-1.396,1.209 -3.216,1.941 -5.206,1.941c-4.393,0 -7.96,-3.567 -7.96,-7.96c-0,-4.393 3.567,-7.96 7.96,-7.96c4.393,0 7.96,3.567 7.96,7.96c-0,2.044 -0.772,3.909 -2.04,5.319l0.165,0.165c1.194,1.194 2.388,2.388 3.583,3.582c0.455,0.456 -0.252,1.163 -0.707,0.708l-3.755,-3.755Zm1.754,-6.019c-0,-3.841 -3.119,-6.96 -6.96,-6.96c-3.842,0 -6.96,3.119 -6.96,6.96c-0,3.841 3.118,6.96 6.96,6.96c3.841,0 6.96,-3.119 6.96,-6.96Zm-4.96,-0.5c0.645,0 0.643,1 -0,1l-4,0c-0.645,0 -0.643,-1 -0,-1l4,0Z`})})}var Aq={bottom:130,right:8,position:`absolute`,zIndex:2,background:`transparent`,border:0,padding:4,margin:0,cursor:`pointer`,display:`inline-flex`,alignItems:`center`,justifyContent:`center`},jq={...Aq,bottom:180};function Mq(e){let{scanning:t,capabilities:n,onZoom:r,value:i}=e;if(!t)return null;let a=n.step>0?n.step:1;function o(){r(Math.min(i+a,n.max))}function s(){r(Math.max(i-a,n.min))}let c=i<=n.min,l=i>=n.max;return(0,H.jsxs)(L.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,"aria-label":`Zoom out`,disabled:c,onClick:s,style:{...Aq,cursor:c?`default`:`pointer`},children:(0,H.jsx)(kq,{disabled:c})}),(0,H.jsx)(`button`,{type:`button`,"aria-label":`Zoom in`,disabled:l,onClick:o,style:{...jq,cursor:l?`default`:`pointer`},children:(0,H.jsx)(Oq,{disabled:l})})]})}var Nq={fullContainer:{width:`100%`,height:`100%`,position:`relative`,display:`flex`,alignItems:`center`,justifyContent:`center`,overflow:`hidden`},innerContainer:{width:`100%`,height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,position:`relative`},overlay:{position:`absolute`,top:0,right:0,bottom:0,left:0,pointerEvents:`none`,display:`flex`,alignItems:`center`,justifyContent:`center`},borderBox:{position:`relative`,width:`70%`,aspectRatio:`1 / 1`,border:`2px dashed rgba(239, 68, 68, 0.4)`,borderRadius:`0.5rem`},cornerTopLeft:{position:`absolute`,width:`15%`,height:`15%`,border:`4px solid #ef4444`,top:0,left:0,borderBottomColor:`transparent`,borderRightColor:`transparent`,borderTopLeftRadius:`0.5rem`},cornerTopRight:{position:`absolute`,width:`15%`,height:`15%`,border:`4px solid #ef4444`,top:0,right:0,borderBottomColor:`transparent`,borderLeftColor:`transparent`,borderTopRightRadius:`0.5rem`},cornerBottomLeft:{position:`absolute`,width:`15%`,height:`15%`,border:`4px solid #ef4444`,bottom:0,left:0,borderTopColor:`transparent`,borderRightColor:`transparent`,borderBottomLeftRadius:`0.5rem`},cornerBottomRight:{position:`absolute`,width:`15%`,height:`15%`,border:`4px solid #ef4444`,bottom:0,right:0,borderTopColor:`transparent`,borderLeftColor:`transparent`,borderBottomRightRadius:`0.5rem`}};function Pq(e){let{scanning:t,capabilities:n,onOff:r,torch:i,zoom:a,startScanning:o,stopScanning:s}=e;return(0,H.jsx)(`div`,{style:Nq.fullContainer,children:(0,H.jsxs)(`div`,{style:Nq.innerContainer,children:[(0,H.jsx)(`div`,{style:Nq.overlay,children:(0,H.jsxs)(`div`,{style:Nq.borderBox,children:[(0,H.jsx)(`div`,{style:Nq.cornerTopLeft}),(0,H.jsx)(`div`,{style:Nq.cornerTopRight}),(0,H.jsx)(`div`,{style:Nq.cornerBottomLeft}),(0,H.jsx)(`div`,{style:Nq.cornerBottomRight})]})}),r&&(0,H.jsx)(Cq,{scanning:t,startScanning:o,stopScanning:s}),i&&n.torch&&(0,H.jsx)(Dq,{scanning:t,status:i.status,torchToggle:i.toggle}),a&&n.zoom&&(0,H.jsx)(Mq,{scanning:t,capabilities:n.zoom,value:a.value,onZoom:a.onChange})]})})}var Fq={position:`absolute`,width:`100%`,height:`100%`},Iq={position:`absolute`,width:`100%`,height:`100%`},Lq={position:`absolute`,width:`100%`,height:`100%`};function Rq(e){if(e===null)return;let t=e.getContext(`2d`);t!==null&&t.clearRect(0,0,e.width,e.height)}function zq(e,t,n,r){if(n===null||t===null)return;if(e.length===0||r===void 0){Rq(n);return}let i=t.offsetWidth,a=t.offsetHeight,o=t.videoWidth,s=t.videoHeight;if(o===0||s===0){Rq(n);return}let c=Math.max(i/o,a/s),l=o*c,u=s*c,d=l/o,f=u/s,p=(i-l)/2,m=(a-u)/2,h=({x:e,y:t})=>({x:Math.floor(e*d),y:Math.floor(t*f)}),g=({x:e,y:t})=>({x:Math.floor(e+p),y:Math.floor(t+m)}),_=e.map(e=>{let{boundingBox:t,cornerPoints:n}=e,{x:r,y:i}=g(h({x:t.x,y:t.y})),{x:a,y:o}=h({x:t.width,y:t.height});return{...e,cornerPoints:n.map(e=>g(h(e))),boundingBox:DOMRectReadOnly.fromRect({x:r,y:i,width:a,height:o})}});n.width=i,n.height=a;let v=n.getContext(`2d`);v!==null&&r(_,v)}var Bq=(0,L.forwardRef)(function(e,t){let{onScan:n,constraints:r,formats:i=[`any`],paused:a=!1,components:o,tracker:s,children:c,styles:l,classNames:u,allowMultiple:d,scanDelay:f,retryDelay:p,onError:m,sound:h,startTimeoutMs:g,settleDelayMs:_}=e,v=(0,L.useRef)(null),y=(0,L.useRef)(null),b=(0,L.useRef)(null),x=(0,L.useMemo)(()=>{let e={...fq,...r};return r?.deviceId&&delete e.facingMode,e},[r]),S=(0,L.useMemo)(()=>({...dq,...o}),[o]),C=s??S.tracker,[w,T]=(0,L.useState)(!1),[E,D]=(0,L.useState)(!1),[O,ee]=(0,L.useState)(x),te=aq({startTimeoutMs:g,settleDelayMs:_}),k=(0,L.useRef)(te),A=(0,L.useRef)(n),j=(0,L.useRef)(m),M=(0,L.useRef)(C);(0,L.useEffect)(()=>{k.current=te},[te]),(0,L.useEffect)(()=>{A.current=n},[n]),(0,L.useEffect)(()=>{j.current=m},[m]),(0,L.useEffect)(()=>{M.current=C},[C]);let ne=(0,L.useCallback)(e=>{A.current?.(e)},[]),re=(0,L.useCallback)(e=>{j.current?.(e)},[]),{startScanning:ie,stopScanning:ae}=uq({videoElementRef:v,onScan:ne,onFound:(0,L.useCallback)(e=>{zq(e,v.current,b.current,M.current)},[]),onError:re,formats:i,retryDelay:p??(C===void 0?500:33),scanDelay:f,allowMultiple:d,sound:h});(0,L.useEffect)(()=>(T(!0),()=>{T(!1)}),[]),(0,L.useEffect)(()=>{yq(x,O)||ee(x)},[x,O]);let N=(0,L.useMemo)(()=>({constraints:O,shouldStream:w&&!a}),[O,w,a]),oe=(0,L.useCallback)(async()=>{let e=v.current,t=y.current;if(e===null||t===null)return;let n=t.getContext(`2d`);if(n!==null)try{N.shouldStream?(await k.current.stopCamera(),D(!1),await k.current.startCamera(e,{constraints:N.constraints}),D(!0)):(e.videoWidth>0&&e.videoHeight>0&&(t.width=e.videoWidth,t.height=e.videoHeight,n.drawImage(e,0,0,e.videoWidth,e.videoHeight)),await k.current.stopCamera(),D(!1))}catch(e){D(!1),j.current?.(cq(e))}},[N]);(0,L.useEffect)(()=>{oe()},[oe]);let se=(0,L.useMemo)(()=>N.shouldStream&&E,[N.shouldStream,E]);(0,L.useEffect)(()=>(se&&(Rq(y.current),Rq(b.current),ie()),()=>{ae()}),[se,ie,ae]),(0,L.useImperativeHandle)(t,()=>({getVideoElement:()=>v.current,getStream:()=>k.current.getStream()}),[]);let ce=(0,L.useMemo)(()=>({...pq.container,...l?.container}),[l?.container]),P=(0,L.useMemo)(()=>({...pq.video,...l?.video,visibility:a?`hidden`:`visible`}),[l?.video,a]),le=(0,L.useMemo)(()=>({...Iq,display:a?`block`:`none`}),[a]);return(0,H.jsxs)(`div`,{style:ce,className:u?.container,children:[(0,H.jsx)(`video`,{ref:v,style:P,className:u?.video,autoPlay:!0,muted:!0,playsInline:!0}),(0,H.jsx)(`canvas`,{ref:y,style:le}),(0,H.jsx)(`canvas`,{ref:b,style:Lq}),(0,H.jsxs)(`div`,{style:Fq,children:[S.finder&&(0,H.jsx)(Pq,{scanning:E,capabilities:te.capabilities,onOff:S.onOff,zoom:S.zoom&&te.settings.zoom?{value:te.settings.zoom,onChange:async e=>{try{await te.updateConstraints({...O,advanced:[{zoom:e}]})}catch(e){j.current?.(cq(e))}}}:void 0,torch:S.torch?{status:te.settings.torch??!1,toggle:async e=>{try{await te.updateConstraints({...O,advanced:[{torch:e}]})}catch(e){j.current?.(cq(e))}}}:void 0,startScanning:async()=>await oe(),stopScanning:async()=>{try{await te.stopCamera(),Rq(b.current),D(!1)}catch(e){j.current?.(cq(e))}}}),c]})]})}),Vq=(0,L.memo)(function(){let e=z(SI);return(0,L.useEffect)(()=>{let t,n=!1,r=``,i=null;function a(){r=``,n=!1}function o(){r=``,n=!0,t=window.setTimeout(a,3*1e3)}function s(){t&&=(clearTimeout(t),void 0),n=!1,e({type:`Barcode`,barcode:r,toQueue:null})}function c(e){e.key===`!`?i=Date.now():e.code===`F1`&&!n||e.key===`*`&&!n&&i!==null&&Date.now()-i<1e3?(o(),e.stopPropagation(),e.preventDefault()):n&&e.code===`Enter`?(s(),e.stopPropagation(),e.preventDefault()):n&&e.key&&e.key.length===1&&/[a-zA-Z0-9-|_,;]/.test(e.key)&&(r+=e.key,e.stopPropagation(),e.preventDefault())}return document.addEventListener(`keydown`,c,{capture:!0}),()=>document.removeEventListener(`keydown`,c)},[e]),null}),Hq=(0,L.memo)(function(){let[e,t]=(0,L.useState)(!1),n=z(SI),[r,i]=(0,L.useState)(``);if(window.location.protocol!==`https:`)return null;function a(e){e.length>0&&e[0].rawValue!==null&&e[0].rawValue!==``&&(n({type:`Barcode`,barcode:e[0].rawValue,toQueue:null}),t(!1),i(``))}function o(){r!==``&&n({type:`Barcode`,barcode:r,toQueue:null}),t(!1),i(``)}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(cy,{open:e,onClose:()=>t(!1),children:[(0,H.jsx)(dy,{children:`Scan a QR Code`}),(0,H.jsxs)(uy,{children:[(0,H.jsx)(J,{sx:{width:`15em`,height:`15em`},children:e?(0,H.jsx)(Bq,{onScan:a}):void 0}),(0,H.jsx)(J,{sx:{marginTop:`1em`},children:(0,H.jsx)(Kw,{label:`Manual Entry`,value:r,variant:`outlined`,fullWidth:!0,onKeyDown:e=>{e.key===`Enter`&&o()},onChange:e=>i(e.target.value)})})]}),(0,H.jsxs)(ly,{children:[r===``?void 0:(0,H.jsx)(Y,{onClick:o,children:`Submit`}),(0,H.jsx)(Y,{onClick:()=>t(!1),children:`Cancel`})]})]}),(0,H.jsx)(X,{title:`Scan QR Code`,children:(0,H.jsx)(Um,{onClick:()=>t(!0),size:`large`,children:(0,H.jsx)(fre,{})})})]})}),Uq=P(null),Wq=(0,L.memo)(function(){let[e,t]=B(Uq),[n,r]=(0,L.useState)(``),i=z(SI);function a(n){e!==null&&n.length>0&&n[0].rawValue!==null&&n[0].rawValue!==``&&(i({type:`Barcode`,barcode:n[0].rawValue,toQueue:e}),t(null),r(``))}function o(){n!==``&&e!==null&&i({type:`Barcode`,barcode:n,toQueue:e}),t(null),r(``)}return(0,H.jsxs)(cy,{open:e!==null,onClose:()=>t(null),maxWidth:`md`,children:[(0,H.jsxs)(dy,{children:[`Scan a Barcode To Add To `,e]}),(0,H.jsxs)(uy,{children:[window.location.protocol===`https:`?(0,H.jsx)(J,{sx:{width:`15em`,height:`15em`},children:e===null?void 0:(0,H.jsx)(Bq,{onScan:a})}):void 0,(0,H.jsx)(J,{sx:{marginTop:`1em`},children:(0,H.jsx)(Kw,{label:`Manual Entry`,value:n,variant:`outlined`,fullWidth:!0,onKeyDown:e=>{e.key===`Enter`&&o()},onChange:e=>r(e.target.value)})})]}),(0,H.jsxs)(ly,{children:[n===``?void 0:(0,H.jsx)(Y,{onClick:o,children:`Submit`}),(0,H.jsx)(Y,{onClick:()=>t(null),children:`Cancel`})]})]})});function Gq(e,t,n,r){let i=Q.of(t).flatMap(([e,t])=>Q.ofObject(t.unloaded_processes??{}).map(([n,r])=>({matId:e,proc:parseInt(n),uniq:t.jobUnique}))).toLookupMap(e=>e.uniq,e=>e.proc,()=>1,(e,t)=>e+t),a=new Map;if(r)for(let[e,t]of Q.ofObject(r.jobs)){let n=Q.of(t.procsAndPaths[0]?.paths??[]).collect(e=>e.casting===``?null:e.casting).head();a.set(e,{partName:t.partName,comment:t.comment,routeStartTime:t.routeStartUTC,historicJob:null,inProcJob:t,casting:n??``,scheduledQty:t.cycles??0,decrementedQty:Q.of(t.decrements||[]).sumBy(e=>e.quantity),completedQty:Q.of(t.completed?.[t.completed?.length-1]??[]).sumBy(e=>e),inProcessQty:0,remainingQty:t.remainingToStart??0,darkRow:!1})}for(let[t,r]of n){let n=a.get(t);if(n)n.historicJob=r;else if(!e||r.routeStartUTC>=e.start&&r.routeStartUTC<=e.end){let e=Q.of(r.procsAndPaths[0]?.paths??[]).collect(e=>e.casting===``?null:e.casting).head();a.set(t,{partName:r.partName,comment:r.comment,routeStartTime:r.routeStartUTC,historicJob:r,inProcJob:null,casting:e??``,scheduledQty:r.cycles??0,decrementedQty:Q.of(r.decrements||[]).sumBy(e=>e.quantity),completedQty:i.get(t)?.get(r.procsAndPaths.length)??0,inProcessQty:0,darkRow:!1,remainingQty:0})}}if(r){for(let e of r.material)if(e.jobUnique){let t=a.get(e.jobUnique);t&&(t.inProcessQty+=1)}}let o=Q.of(a.values()).toSortedArray({desc:e=>e.routeStartTime.getTime()},e=>e.partName),s=null,c=!0;for(let e of o)s!=(e.historicJob?.scheduleId??e.inProcJob?.scheduleId??null)&&(c=!c,s=e.historicJob?.scheduleId??e.inProcJob?.scheduleId??null),e.darkRow=c;return o}function Kq(e,t){let n=`<table>
|
|
315
|
+
`);e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:n}):t.sdp=n}return n.apply(this,arguments)}}function tq(e,t){if(!(e.RTCPeerConnection&&e.RTCPeerConnection.prototype))return;let n=e.RTCPeerConnection.prototype.addIceCandidate;!n||n.length===0||(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(t.browser===`chrome`&&t.version<78||t.browser===`firefox`&&t.version<68||t.browser===`safari`)&&arguments[0]&&arguments[0].candidate===``?Promise.resolve():n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function nq(e,t){if(!(e.RTCPeerConnection&&e.RTCPeerConnection.prototype))return;let n=e.RTCPeerConnection.prototype.setLocalDescription;!n||n.length===0||(e.RTCPeerConnection.prototype.setLocalDescription=function(){let e=arguments[0]||{};if(typeof e!=`object`||e.type&&e.sdp)return n.apply(this,arguments);if(e={type:e.type,sdp:e.sdp},!e.type)switch(this.signalingState){case`stable`:case`have-local-offer`:case`have-remote-pranswer`:e.type=`offer`;break;default:e.type=`answer`;break}return e.sdp||e.type!==`offer`&&e.type!==`answer`?n.apply(this,[e]):(e.type===`offer`?this.createOffer:this.createAnswer).apply(this).then(e=>n.apply(this,[e]))})}function rq({window:e}={},t={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){let n=iK,r=oK(e),i={browserDetails:r,commonShim:qK,extractVersion:eK,disableLog:nK,disableWarnings:rK,sdp:JK};switch(r.browser){case`chrome`:if(!pK||!bK||!t.shimChrome)return n(`Chrome shim is not included in this adapter release.`),i;if(r.version===null)return n(`Chrome shim can not determine version, not shimming.`),i;n(`adapter.js shimming chrome.`),i.browserShim=pK,tq(e,r),nq(e,r),fK(e,r),mK(e,r),bK(e,r),hK(e,r),yK(e,r),gK(e,r),_K(e,r),xK(e,r),YK(e,r),XK(e,r),$K(e,r),ZK(e,r),QK(e,r),eq(e,r);break;case`firefox`:if(!wK||!EK||!t.shimFirefox)return n(`Firefox shim is not included in this adapter release.`),i;n(`adapter.js shimming firefox.`),i.browserShim=wK,tq(e,r),nq(e,r),SK(e,r),EK(e,r),DK(e,r),TK(e,r),AK(e,r),OK(e,r),kK(e,r),jK(e,r),MK(e,r),NK(e,r),PK(e,r),FK(e,r),YK(e,r),$K(e,r),ZK(e,r),QK(e,r);break;case`safari`:if(!IK||!t.shimSafari)return n(`Safari shim is not included in this adapter release.`),i;n(`adapter.js shimming safari.`),i.browserShim=IK,tq(e,r),nq(e,r),HK(e,r),WK(e,r),zK(e,r),LK(e,r),RK(e,r),UK(e,r),BK(e,r),GK(e,r),YK(e,r),XK(e,r),ZK(e,r),QK(e,r),eq(e,r);break;default:n(`Unsupported browser!`);break}return i}rq({window:typeof window>`u`?void 0:window}),typeof window<`u`&&`BarcodeDetector`in window;var iq=3e3,aq=500;function oq(e={}){let{startTimeoutMs:t=iq,settleDelayMs:n=aq}=e,r=(0,L.useRef)(Promise.resolve({type:`stop`,data:{}})),i=(0,L.useRef)(null),a=(0,L.useRef)(null),[o,s]=(0,L.useState)({}),[c,l]=(0,L.useState)({}),u=(0,L.useCallback)(async(e,r)=>{if(!window.isSecureContext)throw Error(`camera access is only permitted in secure context. Use HTTPS or localhost rather than HTTP.`);if(navigator?.mediaDevices?.getUserMedia===void 0)throw Error(`this browser has no Stream API support`);let o=await navigator.mediaDevices.getUserMedia({audio:!1,video:r});e.srcObject=o;let c;try{await Promise.race([e.play(),new Promise((e,n)=>{c=setTimeout(()=>n(Error(`Loading camera stream timed out after ${t} ms.`)),t)})])}finally{c!==void 0&&clearTimeout(c)}n>0&&await new Promise(e=>setTimeout(e,n));let[u]=o.getVideoTracks();return l(u.getSettings()),s(u.getCapabilities?.()??{}),i.current=o,a.current=u,{type:`start`,data:{videoEl:e,stream:o,constraints:r}}},[t,n]),d=(0,L.useCallback)(async(e,t)=>{e.srcObject=null,e.removeAttribute(`src`),e.load();for(let e of t.getTracks())t.removeTrack(e),e.stop();return i.current=null,a.current=null,l({}),{type:`stop`,data:{}}},[]),f=(0,L.useCallback)(async(e,{constraints:t,restart:n=!1})=>{let i=null;r.current=r.current.then(r=>{if(r.type===`start`){let{data:{videoEl:i,stream:a,constraints:o}}=r;return!n&&e===i&&t===o?r:d(i,a).then(()=>u(e,t))}return u(e,t)}).catch(e=>(i=e,{type:`stop`,data:{}}));let a=await r.current;if(i)throw i;if(a.type===`stop`)throw Error(`Something went wrong with the camera task queue (start task).`)},[u,d]),p=(0,L.useCallback)(async()=>{if(r.current=r.current.then(e=>{if(e.type===`stop`)return e;let{data:{videoEl:t,stream:n}}=e;return d(t,n)}),(await r.current).type===`start`)throw Error(`Something went wrong with the camera task queue (stop task).`)},[d]),m=(0,L.useCallback)(async e=>{let t=null;if(r.current=r.current.then(async n=>{let r=a.current;if(!r||n.type!==`start`)return t=Error(`No active video track found.`),n;try{e.advanced?.[0]?.zoom&&r.getCapabilities().torch&&(await r.applyConstraints({advanced:[{torch:!1}]}),l(r.getSettings())),await r.applyConstraints(e),s(r.getCapabilities()),l(r.getSettings())}catch(e){t=e}return n}),await r.current,t)throw t},[]),h=(0,L.useCallback)(async()=>{try{await r.current}catch{}},[]);return(0,L.useEffect)(()=>()=>{p()},[p]),{capabilities:o,settings:c,startCamera:f,stopCamera:p,updateConstraints:m,flush:h,getStream:()=>i.current}}var sq=`data:audio/mp3;base64,//PkZAAhghE0AKToAJra/n0FQygAAAGIkYJgmCYXBMAAGCTJz3zhCEM//z//1hz//8MMMMN08ssV6e5DDWIQreAgCvFKy8bXgIKMkUDDBgzJwIBtkRMQAocxIFdxghQGKDoEziAzQxOBOdH92i/iGi+zDCAEIX46a73HrSybZw1x3JZjXp7dSNy/P68rjcbt7p7fakMP5LVMyzCaj1pjvejYYAIDgDGzECjEAk1Jl3559HIon8hzlfPVTCvGJZzfcKSxXfyMWM88//9VKSxXdtnb9vomOuuRyiWVYbf+X8zp6fKGHIdycuWMMMMMMKSnp+6wsYc/9f/7z7rPPWHN556p6fP8MMMP///PPP/7+GHK9PT6p7f/unldP2np7YeHjweiYA4GLNAgAiI7u57n5//oc5/yfk6znOcPhwOBwggHCMpA4HA4KEyHOc5znO+hPIc5//+fqJh8XQPh90JU5xQinOf//87/zvP+ggAYuhCKHxdA+Hxd0EA4KKHA4ciB3kOXfXB/gmf8p/B96lAMKAgAADU+BujARHgwdisgHMfAUHAiceBg4ASBgZBiBIBH4ZaHOJsLhf8R+HYEciIgYSwj/+Bi7EqBh+AcBn5P6Bh4TuBmrAMBiZH7gaLEWgew//PkZFMlyek60MpYAShzqqZhm6gCUWeEUWAewEWYGN4X4GDEPwGE8S4GDoOIGAYKgIQOkz//gGARAUB+CwGxTwMAACAEgyAwdAlAxKhzAxXiZ///AxcEwAwJjDAziCAAwQgdAwRgdAsJQDAmAcGzYDwAhZIAKAcIQB4GT9TQMJ9/4Gi1Fv/AcAYUqKBAwGgNAwVBAAwGhwAwdBlAxFg1AwlgzAwNBuAkJQDBgEEDEqGECgChFgBgL//CIswYYH//+HKCpk4K0C9AaKKCAOBeMcR4X9C44BwABCgGAsGYCgTwHAcAwXAiAwSAQV///CJP9lwMBQAwAAAWGo5lVLCcaeneVhJAVGai3//ioaUEf//gaTAYGCj8BnEwfrIqDcsIQb/vmhU/8fAs0G8YGGwKST8Igj4GCATipksVzY8p//90FWJwh45AkX//4fCF9wMEgkL3uQc+gbGJ8t4MBAMBP/hEXf9FRuWBcAfIFjYzQdoLCBwh7IWVlxaX/w8oMCP/+EQT5poGB1Ir90DhiV6af/jFYBpT2BgoQyyt2M0ToBdEaZyzt8nTo3xdNDCTSd//o6F06CjooxRr4jVF/0bOKD6OMUNDRxiMUVFR0FFQPhGXRjDpr4MAEA4wIQUhYOIw//PkZE4nrg08sOx4ACQ0CopD2aAAlwTTBxQeMcwd8w8gZTAgABXwGABOkzpI0wAQAExnWfP4x8ZjKunWdZ1o1Qe6lFGKCNULORQCELAAPnRUf/GIx/0FHGfo3SdZ0qP2cukXKLlRtBKFgAQwCkwJgFRYBEEATmDsLSY2QiQYCEnEra+UZo6F1aKMRr6GhoaP/+j//ov+i+hjLqBgMkYoqChoo1GqCjoY06TpRqjjLOYzRRmMuizmgdKhdF8kjTAAAPMCwGswzglgwAJfzqxmioKH/////////////+ijLOAwFmN0f/////////Q///8ZjP/9DGYyFwIDBeB3MA4AlBWidKM5spykAUAQOCakK+udGqN8VDYjTRuN//0bVX//6Kio4xQFv//nf//kKOoAEIB6SY6hcxenp85///4/DEPf/84Xvl4vF4dwtxfEJgCYQHMSgKCROp4+fn////L4tQf0unz89OecLxeL0ul09y6enzp4dIhKAQFA5hKfLu1nU7/Wr71rRKJUBQSUVt////l08GUPVWgAAYAeNKsxbQNAAhQx3/oKGMM6dZ1Yy6sajMbfKio7lNcv0sScZ47lNcw32ekVFMP9fp/f+mklI6at6u/dBMQuW6y+C5BcgwAA//PkZEomGg1HYGe0riWsCqbEwiY0BJFJMxrCcxGgQ2VK8xxCF1wsABgQBBgQBAYAFCkYCgALkK4fJ00E5ctJN1Uxy5au3XoGcM4dSN0EYZwzhW0WCh1PZwzhnFFQxtnbO2d0Kt6CdXbruggkTEX5Rs4TEQUVsdVXaCcuWXIBQUGmwmgoAGcJiM4dSioHQdBnEY+hjcbov//jcb/43G43G/jCRibfxugdBnDqULO2duvQumztncbo4xGKKNxugooxGIxQULoOgFgUMTA/jbrxiMDmETL+eLhcPThzOeeOZfL5fIcBYuXD/OHv8t//LJFxjxQYHHKDGFkZMtlmKM0RgQfbVtxFIHbQBDRuzRguEI1c9XZ/rWmrZfVU3Oc/9utNNygRQkCoHlAYstNN6DJ1IINpoINppv+WG/+g2mmnUmmmpBAoJIJhnwB5xkymn606Df/t000xhU03UXC5Ol8uFyXy+Xy/l8v5w4cLk4XAvwAYUvl/QL5fTdlKZkEEEEGumaKaX00zIOemf6CH///ywI3LKpiQ2Ef4xYWMSDyI0XwzikpL0ajVHZ3j9DGIjeuXcNfjn96/S/TUz/X/vX////5K/r+v7Jn+LlAoGZOIQIwMKBQM/yppKYURmhGZkR2b//PkZE0mHg1HEG8wyiD7mlwAyDU8nJHi5htakZmZGNiRcpkJhBmUmZYQcM1VDEEBggNDV/ASEZRYKFZIhkXKLlKmk7IVTKmZNJ5KhiqVUqpX+k7+qlVKyV/ZIqZDFDWTJlFyi5TJpKhiXKBQyZzIS5JhBoayV/AQWVpGWkcYTV5O/rIVSv8/0nkr+v6/vyR/X9f1/ZN8kf5/n99/n+f5/lTKmf9/mRP8yFUqpWSv4yJUqpX9kj/MmZNJ5K/z/P9J5P/v6yFUz/CEoywgUMqZkz/FssECIsVq0aPRrRRatFFFykQZJ2Ukl///5KjmksOaA7ALROJLDnEsLbq3GTMVrwb/0dGzmM0DlfBlHQOmrdR0MYi92TX6b/cmDHLclyUVYO/4O8sFTKFTKFf8yhUyhUyhXzKlDKlCsr/+ZUoVlSsr/+ZQqZUoZUoceMfcoZUoZUoVlfOPGcmDHKcpynKg9yXJcr3JclyXJclyYO+DXJclyfgxFZVb3KcqD/g2MxzsY72L9LubPR0dCyf5K5NNd+Tv9GXRdV0XJclyfcl/n+k8kf6SX/iVynvXf///4Mg/1OkxguYzmM5jMcLHMxwwGhgNCwXMLAcwMXTLi1MD7w7tmTdBvMmE0xQFzCwHMDAd//PkZGMpigkmAGOUvCfTgcgAuC+ITswMFzC4oMLhYMByn0xvU+p9Tr0xUxf/0xv///1PBYDhgNTFTFTGTGTGTGTGTGTGTGC4GTFMDAcLAdMVMVMULAcMBpgYDhcDGFwsYXFBikLGFwMGA4MBxgcDKfTEMUoAx2BisD+mKp5Tv1OkxkxkxkxkxkxkxkxlO0xVPJi/6nv////U7CwHTFTFTGTGTGTGU+p71PpjJipihYDpipi/6n1Ov//C4GC4GTGTGTGTFU8WBSZdLhWB//yKlotyLZFiLf8tyyRUipFSKkVGRBZQMiWC3yx//wxUGKsSvDFQGHUAL3QMsHDFIYpCYy2Bmagy6BjLgy6Bh3od58DCLAizBgRb+EQiyEQiwGBFuDAi3/////20QqSBJf/qcumv/////wMZdGXAYMu1gYy6MuBEZdBgy4BjLgy6BjLgy6BjLgy6BjLQy6DBlz2cJDLgRGXAMZdGXAYMuhMZcCIy6sJGaoGMuppwNRl3WBjLgy63wiEWAwIt/+EQi0IhFsDCLAi0GBFkGBFgMJCqaqYAgAYIhBBvwf7kwcqRq7V3IctacvlN6NxqgooxRRuNRiijEZjMGRuMvz9FGozQ+1X2qe1T1S//+VhaWAtKwtML//PkZEIkbgcaAHc1xCJrjeAAtfuUAtLAWf///mWePH95ZFgsyssvM88+jzO6K+z7OM48sH+WDiweZx5YOK+zxWLGJWsa6xadAv02fTZLSpsFpvLSga0tMgWgUgWmwgUmyWl8tMgWWmLSoFJsoFlpSwsmyBg4HhEdgwHAYPBwGDgeBg8HwMHg4DB4PBgOAwcOwMHLwDn5lAwcDgiDgYDwMHA/4MB3//+EQeDAdwiDwYLPhEWQYLODBYERZBgt8Ii34GLBaB5pfAZ0FvEAQ/UfwxULlx+IXx+8f5CELH8fxKhAIDFoHBEDRc3////gwHgaRXgMHYMB2EU/gwZ/gYbw3gY3QbgYNgbgYiAbgwN3/+EQbBEG4MBuDAbAwG4RBtAwbg2////+B9B6F//////////hEdD//////////8DRahEQGCInMNg3LBElgNjDciCwG/lgNiwGxWG///mG4bf/+WA3Kw3KyIMNw2Kw3MNg3MNg3MNiIMiQ2OK0xMiA3KyJLAEZgRARmBEDEYFwBBgEgEeomowol5YAJKwCDAIAJ8sAE+gGBgCJYAQUZ/13LubMu5dyiYOAhKwEFGf9AOoz/g4CFAIol/lgAjysAgsAElYBP////lgJksBM//lgRUxF//PkZGApggsIAHt2wiNLoggAqCz8RFSwIqYioipkjEjHCCSN/+WJg5iYOYmPK5krmTmZk5mZ8sTJYmf8yJiNiIisi/ywRmRkZkZGZGRmRERkREZERGRERkREZERGxEf///hETIMEyBiZEyBiZEzwiJgDEwU4DV2gQGFOBgmP8GAiAwRAiBgIgYCIGAi/4MBHAwRgjAwRgjwMEQIgMcgY8DBGCMDBGCMDEyJn///+BiYQIBlObj4eYLIwsjAOBGFkYBoEQ84eULIw88LIA88PKHnw8sPKFkeHlANAiAaFUDAiMYPIHmDzBZBhZB///8GBOA1sH/Awni7AwnhPCITwYE/CKzBgt8Ig8GA4Ig6EQdww4Yb+F1sIgtwYCwGAsAwWAsBgLAYCwDBYCwDBaHUDF+VEDKgC2BgtBaDAWgYLQW////gYLAWQMFgLAMFoLcGAt////4RMABmBSj4NgwMOGHBsHhdcLrwbB4XXC6+F14YcLrww4Ng8MOGHBsHww4Ng8AUC4AoMQMC4fgw3wutV4QIsAgFYIBWCCVgHeVgHeWABCwAIVgH+YBwB5aRAstKgV6Ba1oMg9avtUVN/qdLWciD/cqD3Jg6DFPuTB/////lYAn//mC8C+YLwL5gvgvGC//PkZFEpLgMKYXt2xB5LogAArbdc+C8VgvlYL/mC8C+YLwL5YBfMNgNkwXixDWoHPMc4VUxVA2TBeDZPYXzXl815fK14sLxYXvK1//NeXzXl815fMtdDLSw3UsMtLCstMtLDLSwsFhWWlgt//8sFhW6f/////+WF7zXl8sL5ry+Vrxry+WF/wMLwX4MC+EQv/AwvBfAxsjYAyqpKA0lpLAwvBfBgXv///4RA2DANAYGgNgYGgNgYGwN+EQvf/BgXwYF//8DC+F4Dd6NgGBf4AgFwbB0MMF1wuuDYMBsGwusDYOBsHA2Dvg2DQuuDYOhdcMMF14YYDGYDEGwfhhgbB0MN///4RBaEQWgZByoYRWYMFvwiDsGwaF1gbB34GDwdC64XW/w1aKxDVgatir4YcLrQbBwNg7////////////+ESfgZPyff/////////4MFmBvvMAERZ8CC5adNj02E2S0qbCBSBZaYtN///oFlpU2QMXIFAYuQK9AtAo7IxLTpsIFJs/5aZRxQawaxGfIg9CsrI+PUqkWdOHp7ODsOl6cOHZ4dsulfLI9/8BAAgMBACsBLACVgBjoAWAE5OTM6WDAR0zodMdHCsJLASWAjzCQgsBJhASWAjysI8wkJMICU//PkZFkeqgcaYDd1th6DogAAqCuIxQwtDA5MdMULgyY6YqnXqdep5TpMdMVRNRL/UT9AN6jCiSjKAZRNRhAMomgFQDfCIJwYCQiCAiCMGAkGAgDBJUA3eVAMEgj////8SrDFIYqh5g8kPMHkDzB5OFkYeYPJ+HlDzB5+AYVQDibCyIPLLEZIsjIliWS0WywWyyWuWCyWJaLZbLJYDHgLAItFvy3///4eYPKBlQTh5QYEODBb//hhoNg7/C62DYPFUKwKsVgNWBq8VkVcVkVUVYrH//hGff/8Iz8GT7//////wiX4ML3gwvgwvf4ML3gZeqoHVGyBl4vgZfL2F1oNg4Lrg2DcLrg2DQw0Lrhh8Lr4YcMNBsGhdcGBcMOGGAFGAGMQsF1guuGG4XXV/4uQXOLmF1kL/8lCXkuSk4O8/FzHzuP0hIucf/CIFAMCgFPgYFAKAwCgGBQCgGHYO4GBVM4GgQI4RCMEQKQOtQjUI1CNcI14MqDKwDIAGQDzh5wsjDyw8uHmDzYeUPN+DEYRRhFEIowYgDQgIhWDApgwKAwKQYFAYFQMKkYDOxHAzsRgMKBUGBX/h5v+Hm4ecPNh5A8wBwjhZHhZAHlDzBZAFkAeQPKHnCyILIAsih5QsgDz//PkZLQgIgsMAFp1xCGLogAAA2rkB5w8oeYLIQ8kPMHkCyGHnAMKoGmAgFkUPMHmDYAtfHPHNkr/JYl8c8lCWHPHMkqSo5onMAkBDnfJX//8IgDBgBhEdAaxSQMHUGAEIgAV4risCcipBOMVRVBO////hEvAxsAwvf////8MPDDww4XWC64XXDDww4YcMPC6wYb/wYGgiGwMplMDYhTCIaCIaBga/////8GA+EQdgYPB4MB4GDwdhEH8Ig8Ig8GA6EQcEQf8DBxlBjoAweDuFwgCQXiL//iLiKCKCL4XCiKRFwEgoRT4iqpMQU1FMy4xMDCqqqqqqqr////xuDd8fv/DVwrArEIg6EQdhEHAYPBwMB+ERYBi0WAwWAZ0FoGLYOB+JfgZ0FoGdBaDBYbn+WHm9xW7/Nzzc83PLDzc8reWlA7S0oHamx//6BflpU2C0qbBaf/8yk/ysn+VkMhTKQrKVk8yE8rIVkKyYsAn/5WC+YICmCApWCGTkxtKMcVWlgFMEBTBAX////0C0C0C/////////LTFpvTZLTlpv/0Ci0xaYtOgWmymyWkAxcWmTZTYTY8tMmygUWmLTIFpsFpv9NnywLmLCx2RgWmQKTZ98UjnzZ1/++D4M6/////3//PkZOgjIg8IAFcbxCaTogAAoCuIzfJ8vfJ8Wcs5fBnD5//++L5f////////6nCKv//+o0o0FUYwqDNGCwgUMKC0VVGkVv//4Yf8LrxVCriqDVoasDVuKsNWw1bisBqwVkVkVX//gy/4YYMMGGhhgwwNg4LrhdcLrAYWGAA0zBsH4Ng3C6/////4MAoGBQIDAKBgUCAwCgYEAsDAoEAwKBAYBYMAoGBQIBgUCYGBQIBgUCwiBAYBYMAoRAgRAoGBBMBooCAYFAkIgTEUxFv/EWxFxFhFoi0LhQuFiLCL/EWqTEFNRTMuMTAwqqqq//////8TWJriV/hERAwRgYiEYGIhGBmIRgYiEYMEQMEcDMSiA1GYwMR+UDMTkA7KIgMRGIGGM0SIrRGjRlhEV4jxov8rR/5YRFhEdQSViCsR5iRJWIKxPlgQYgSViSsR5WJMQJLC78IiKERF4REeERGEREERHwMRGOBmIRhERhERAwRAYiEQGIhGBmIRAajkgG5TEEREDBHwYIwYI4REXCIV/4MCmDArgwKAYUO/gYVCkGBUGBTgYUCsGBUIhUDCoUCIVBgVBgVBgUhEKQMKhUDCoUBgVAwoFAYFcGBQDI6oA5+qQiFAMjBUGBXCyEPIFkOH//PkZPMj6gr6AFdVwifkBdwAoC2Ilh5/8PPh5Qsih5IeUA0TAZrE8PP////wMRiIIqID8piAxEIwMxCMDEQjCIj//BiIDRo8Iogii/4MKwYVhEoESkDEiIGJEgYlfBgmDBIMEAYgSBiBIREAwSERH/8I7wPfuCO4I7v/8GBvAw3Bv/////gwN34RBuBg2BuBg2BuBg2BuEQbhEG+EQbAwG4MBtwiDaDAbhEGwMBuDAbAwG4GDYG8DBsDcDBuNwDRWDcIg2AwbA34RBv///CINvCINgMRIN/////wiG4DDeG+TEFNRTMuMTAwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq/zB4OLAP8rBxWDisHlYOKxb5WLTFgsMWiw18LDOnjPxZoxadDOgsLAtLAbKymVhsrDZWG/LAb8w2GywGysNlgNFgNGFwuBQuWnTZLToFFpisLJsFp0Cy0voFAQLFZkMCAQwIBCsC/5WBCwBCwBCwBCsCeVgUwIBCwBDEwEMCAQrAhgUClgCFgTlgCGJgJ5gQTGJwKWAKYFApgQTGBQL5kY0HMjQYnAhWJvKwIWAIVgQrApYAhWBPBgECIEBgE/8IgXhECQiBAMCkcDEwEwMCAQGAQIhoIhsGBsIhvgwN//PkZN4irgr2AAOVqiUThegAnCtMgwNwiG/8IhuDA1hENhENgYbKYHb2IBhoNhENAwN////8IhsDKZS////8IhuBhspgc0KQRDWEQ3///CNf4GAIMDAwgAwAAwhAwAwYAIgwiHBgAMAYGAAGHv///CIBqBqESDEIgRYGoGHBiDEIgGoGgMAYgxgwgxCIETwYFYMCoMCuDApBgU8DCoU//gY3G//wYFOBhUKBEKQYFfBgV8IhSEQoBkYK8IhT/wMKhXBgUCIU4RCoRCvgYVCsDCp3A1SqAYFAiFP////gY3G1TEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVgwCAwCBEC///////8IgUIgWEQIBgUCAwTQMCAQDAoEhECAYFIwGaRMBotWAasdwH/KqBmhFgaKI4GRgKVpjCBTCBPMJHNMFMIFKwnlgJ5hUxhUwGWlpAMuMuWLTFpvQKQLQKLTIFJsoFIFFZb/8woQwoT///MIF8rC+WAphAphAppgpYClgsmwBC6bHoFFpUCi0wGXFguWCwFLgUsgX6BZaVNj0Ci03//+EQKEQKEQLCIFAxMBcDAgFAwIBQYBODAKBgUCAYEAuDAKBgUCAYFAgRAngwCgwCwiBIRAmE//PkZN4iogj2AFdVxiUrhewAhOkwQIBgQ0gbOI4GRhOBiYCgYEAv////CIFAyMBQYBf///CIF8IgUDAgFBgEAwIRwMCCcDEwFAwIBf///CIEQGMDGEXCKBpCIDCEQDCAsYInDFQMMAuYSoTQMVfBlf//+DKfBgAiGDAQMIMIgCIQYADAEGAgwP////8ItgNu2/8DAAAiABgHhECBgQGEQARA8GAeEQIMABECEQIMAwYBBgCDAARA4GAAgYACDAARAwiAgwDhED4RABEBCIGBgDoH2dgZwCBgAP//BhX/+DCiTEFNRTMuMTAwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqF1ww////////hdeGGDDBhwjeF102E2fTYAowMLjE0zTDfyyMYjEDJTwMLSwFi0/gQLoFIFpsegWmyBQsWlQL9ApNgtIWn8tMgX6BaBX+WmQL9Nn02f9NktIgUgWmwWl9Avy06bCBSbJaUtImyWkQKLTIFgYWoFFpAKFwMLzZgwAwvLTIFlpU2fQLQK///4Yf4YaF1sLrg2DAuuDYNDDQw4NgwLrhh4XXC64Ng3C60MNwbB4XWC64YcMODYPCJYDlMQBlwRLg2DOF1v/////PkZM0eKgz0AE+UuCnLFfAAk3Fsg2DAYX/ww//4YaGGDDhdbDDACFwMuXA2DADlygusDYOBsGhhv//wNU/CKQusF1oXX+F1wuuGGC6wXWDDBdbC6wXXhHv//4AHIFgC0BZAA4Ba4FkADwFsC3AtQAOcC0BYAtgAcAA9+BYAsgW4FvgWOABwC1oq+it4RT0VVG0VFGkVywo1/RWU4U59TlFb1GvRX////QK9Nj/9AtNn02fTY9NhNlAr/QK//TYTZLSJsIFemx///oF/5aZNj02U2C0yBaBfoFAS6bKBfoFVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVQiA8GAO/4RAf//////wYA4GAO+EQHAwB4GDoB4GA4HQRB0BhlDIBpEAcBgPDIBgPAeDAHIFAYuLTpspsJsFpi0haRApAtAstIYKClgF/ysF/ysE/ysF//LAJ6plTlYC1ZUypmqtWVK1VqyplSFgBaqqcwAAVIqcrEBAAKmMBERCQhwD5iICIQEyABMAABBVGXF4gIA4DLAAWAEQgLVSsBaq1ZUv+YKClgELAJ////5YBP//LAL5WC+Vgn+WAX/LT+gW//PkZMIhLgrsAFt1yiD7FiB6A9qwmwViybCbCbCBSBabCBSBabPpsegWmwWn9ApApApNgCGBmEwWlLSpsf////hEHgYOB3////4GDkiBxMHhEdgYOB4GDwcBg4HW23gooFYHd/+BnAz8O8Vv//FaBm4rBWh38es2zbAtD1m2PVBqBrBqBrAF7AF3/5el84MkuHTgyy+dL0dRnEajMIyOn8RsZ5HGG/kbIpHIkYUiD0y2WctlZaWSwrKx6FZbxnL54ul04eLhw9Ol84dl86cOHT3Ipb5Z8qKpVx6/j0EkLctVTEFNRTMuMTAwgWQLQAHgLf/////4Fn+EQESEcIgInCIRW9TkrCzH0YIjjWtI+YeCD0woLCBQwsKRWUaRVCBZFZRtRtFRTlTlThRtAr0C0C//02E2fTZQK/0Ck2f9TlFRTlTlFT/9TlFVFRFb/9ThThynIQbWkAREue5S11rKdlkDEVABh61ExYPU+tOD4MQgcn4iwigivxFRFoXDcRQLhoiwioXCeAkFBcNiL8RURQBIKEVEWiLBcKIqIpEXC4QReIoIpCIKAQMxFAFAsIuIr/4YYLr//ww4XWBgwC64XX/hhgw3hhwuv8MNhhguvhdcAUYgaYTAAoWDDg2DQbBg//PkZPYe6gzuADd1uDKsBhBAe89cYYdGjtDT2hDmlD2leaOv9oX0OX/0NNLplNf8ewakNWGrTfTRpphNJtfaeh7T1/tStdtTpqN532lpX/1/kmQ5eaf2hoaV9paGleJAvd0rer2pWu1ar2vk56vVrV5Hj1Nop+/lfv5Zpkem5kX/2vtata2rq783nbvtbW6VjW6a2rq13+rO6VysV58K7tbp0ru6Vrtqa1a67tr6sau1ulYrnfa2v927Vrt21NSuN5X927/D4diAQANh4gEIfxB+IQG/D/4gDw/iGIRD+HRATEFNRTMuMTAwqqqqqqqqqqqqqqqqqiIEK/ititFX///8VcVuK38VsVhXBOQTpq/qm8QCAcBmIxgdfFZCHECpxFBFAuFEUC4cLhsRTEVEUDVoDQD+KrFYirFX+KwKoVgVUVUVeKwGrhWRWBViqFYDV4rMViKyGroauBg/A0YThVgNAEVQqw1fisis4quKxxWYrAatxWIqoqg1dFYxVxWIrAavAaAArIrAqoqhWYrIqvxWMVYrARCADhcKoVYavDVgqhV4qorIrHFWKuKxFViscVUVYasAaAfFY/4YcMNhdfwuuGGC64YfDDA2DwusANygbBwAxhAECwNg8MOF1hD4//PkZOkc4g7yBjd1sDNkDhgqYwtcYoUyiQ0NCkxQ0NCQkSIbGKIyRGEo5mUaNEhGKEHMmaGhI0UokORvMmZmZSZSiMZQkRnKKZkzRoSNCQpQ0NEZoaNFJkhh3KOUJEhIcoSJCQkIzlDlEjMDMyMpQ0JCQzNCRGaNCRISEZoZihoaIwlEHKNGiMzFEjRmSIwlHMyZmcyiGyMxRyhIkIxRSZokSEYGBkiRojAPESNGjQxvKHMmMoSKTJCQkIwlFKLDYWGhoZhYWAAUGBsAwsMDYUAcK4XDPhQVwwLAH/DfgHC6TEFNRaqqBgjwYI//wYI/8GCL///+DBFhERgwRcIiPAzGYgMRKIDcskBgjAxEIwYI4GiRwNEjhFH4MRwYjA0aOEUf8Io/BiLgxGEUYRRQij/BiKDEYMR+DBGBiMRQiIgYIwiIwYIgiIgMRGIDUSjhEReEREBiIRAwR/wYI/8IiP4MEcGCIIiOERH8GCIIiMIiIIiODBHBgjBgjwiIoREcIiOEREDBFCKiAxHJcIiMGCMGCLwYI8IiPhERgwRAwRAYjEUIiIGCP/AxGIgiIsGCL//4REYMEXhERBERhExhExAzyAZiEWDBGERGeKsVsVRVFcVwTnFcVxVgnYqipFUV//PkZPkcfgzeAFaVxDgUBgAgatvIYrgnYqgnQJyK4riqK4rwTsVor4rQAjABAgnQritFSKoqQTsE5C1haxfF7F4XQtULSFqC1i4LwWkXIWkXRdF+LwqAnME4iqCdwToVuK+HAERWAkAlgJB0OB3Doc8OYc8VCsVgIB3DuHAERUAkAkHMOBwOAIisO4dwEAEAEg6AkAl4CeHA4AkKhXioBIOiv8OB3F+LgWkXxeF8XouxcF0XBeF8XBdF8XhdAdouC8AEsXYWsXOKsVBU/FaKmK/FTxXFbFUVPiv/8VfxXitVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVAXX/8MN/wwwYf//DDBh4Yf/+DYODDfCIFAwKBQiaANFgUDAgFAwIBcADwFuBY/At8C1wLfgAdAtwLGBawLcC3AsgWeBYwLX4XW8LrBhgiFgMlhYLrhh4XWhdb8MOGGhdcMP4YaF1gw8LrwuvhhoYYLrYXWDDBdcGwfC60MN/ww8GwZ4XXC64GZQsF1wbBnDD4XXg2DcLrBdaDYPhhgusF1uGGC64YfhhoNg0LrQwwYcMNC62F1/g2DYXW4XXC6+GH8DTIW4YeB/wR/wjwR+DP/y06bJaRAtAtAtAs//PkZNwY2grqBFW1xDhTRegABLBstL6BRaVAstN5aYtN/psIFf5aQtIgWgUWk8tImyWkQL9Avy0qbKbKbJaf02f/0CkCy05adAsC3K7+mx5aVAv0C/TZ8tOmymwB2pspsFpPLSlpy0qbCBSBXlpk2E2E2C0paUtP6Bfpslp0CkCy0ibJaZAosWQLLTJsemwgUmz6BZaYtOgUWmLTpsJsoFJslpPLT+mwmz//6Bfpsf6BSBSbCBXoFeWk9NhNhAr0Cy0/+WnTZ8tJ/oFf6bP+myWn//8tMmz/lpf//////8sPTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVBgJwiCYMBP//gwE//////wiCAMEgkIggIqIDKpUCIIgwE8IzA4j+EYhGAZMIyDJA5gGRhGcIyDIhEQiIGAgwIRDwiAGAAwYMHBghGAZMGRCMhGYRgGRA5gIyDIwZPBk/wZIRmEY/gyOBxIMgIzCMgcTgwRBgjwYJBgngwTwYJhEQBiBGERMIrwOouAxAgGCQYIhERhEQDBGDBAREgwTCIgGCQYJgwSDBHwiI4MEAwSBiRHCIkGCYGJEQiI/Bgn4REYREeBiBIH6XhERhETwogoy04mpZibFmJuWYmx8n//PkZN4ZrgrkAFZUyDcjofgAA9qc0HafZ8HwNrjaG3xtjaDtJwTo+D55Ow7fxNRNSyLPlqJsAr/lmA/FmWYm5acTQVgTkVQTnBOQTgVxVBOBVFWK4J3FUE7gBABOwToVQTsVhUFcVRXBOhUBORWiuKkVYrCqK+KoqgnQrAnEV+K8E7FQE5xWBOQToVQTsVRW8V4qRUFYVgTsVhXioKgrCqKwqAnYqCtBOhUioK+CcisK8VRUFSKnirFQVBVFcE6FcVoJwKoqCrFXFUE7gnAqiuCcQTsE7xU8VP8VYrgnYrCuTEFNRTMuMTAwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqn3/l/J/8vHL5f/BhwCETgGpIDOATgEIOFoDcHzgEIDgC+pG7eve1S/6tat7rXupDXSStWoIpGS4TSMQNIySMwpIyAaRkkZ8GJGdBtbwYkZ63tCKRkoIpGWDEjLCKRmEkjOvsEUjJOsIpGa6bOrgxIzsEkjIGJGYUkZVKCKRmqoDkgEjMJJGSYMSMAikZJ3qhp0dq9ru3X1I36FujPbXuxwKbr//waABfg0AC6DUDUDXBqBoAmQawJiGrhqDUGoN//PkZL8USgKcAAblrroTgfQAbhtQAag1QawaYNIAuQa12Lv9si7F2NnXa2Vsi7i/DZl2tlL9l+vL8tlUTUTUTUYQDIBlGUAyifqJKJqJ+p5Mf/U7TETEU7CxkxVO1PKdqeU8u4vq2ddnrsbM2Zs/tl9s67V2NlbIu5sgaA1Q14ExAmAaA0BrDVDXhpgTPDQGuBMA0gTKGgCYgTHDQGrDUGgNcNQaw1hoAmcNIaRIAtALVEgC1gteI8FpBaBIAtcRwkAWgFpBaILVBaIkAWgRwjhIiPEeDXwa/4NUGr+DRwaKBgX/8IhP//wiF8GBMGBP/wYEhEKEQmEQuDAoGFTAwLgwLhG/4MvCM8GSDJCNwZQOXg2DwbB8MPDDhhuGGBsHhh8Lrf4MCQYFCIUGJgiE8GBQMIFhELDDhdaGHhdYGwaGGDDhhuDYMBsHg2D8MMGHBsH8GwYDYMhEKEQgMCeDAsIhAiFBgQIhAYFhEKDAkGBMIhYGEC4GFCBELgYUKDAuEQsGBQMKEwiEBgUGBcIhQYFwYFAwgWDAoRC8GBAYE4RCgwKEQvhEJgYUIBhQkIhAiECIUGBIMC4RCgwJCIUGBAiFgaYLwiEA5cGXCNhGBGwZAw4Ng0MPBkqNqcoqorlh//PkZP8cygrkAFI0wjo7lfAAjhq4SnPor//psoFemygWmwWm/0C0Ci05adApNn/TZQLU5RU9FRFVFdTn1OFG1Gywv/UbUa9Ff0VoFgCwBbAtQLUCzAtgAchHAN8ImAbgBvwDd4RwjQDeAN8I0ImEQEQAbwRgiQjBHhHAN0A3vgG6Ab/CIhEgG5AN6EQESAbmEYI4RABvYRoRABuYRgDehEQiAiIRABvcA3QiQDfwjwDfCICPCJCJCJ4RwiYRwjBEwDehEYRgDfCNCOEQEQEcI+BagAd4FrAscCxAswLfwLAFgC1wLNVMQU1FMy4xMDBVVVVVVVVVBlBkwO3wZAZMIz//////+DJwO0IwI0DsA7cGUI34Rn4RgMuEZgywZQjAZP/hGAcmDKEYDIB28GQGQGXhGgcgRoMgRoHYBywZAZYMmBygyQYFCIUDChQYE4MCgaYJ/gwKEQsGBAiEBgXAwgQLrhdcGwcGHBsGA2Dgw4YYGwZC6/hdYMMF14YcLrYYcMPDDhdYGweF1oYb4MCwYEwYEgwJBgTCIQGBIRC/BgQDCBcIhAMKFhEKDAsGBQYFAwgTgwKDAoMCQiEgwIBhAnCIUGBQiFwiEBicIhAiFhEIgIoBooGieDPA+4GeDPCP//PkZOobXgrkAEY0jjazieQgBKKIBGgyBGhGhGgyAdoMmEaDIB2gyhGwZYMsI0GSDIEaDKB2QOWEaDKB2hGgygcoHYBygdkDtgygcngyAyhG4MgMgRgRmDJCNBkA7QjAZIRoRoMuByhGgyAyAyhGwZYHKByAcgMgRoHIEbCNCNA7fCNA7AZAO0GSEYEaDLA7cDthGgyAyAyQjAOwGUIyDKEYEaEYEYEaEbA5AZQZAZAZIMgRkGXBlBkCMgyAyQZYMngcmEb8GUGQIyDIBywZAZOEZhGBGwO2EbwjcI3hGYMqTEFNRTMuMTAwqqqqqqqqqqqqqqqqqqqqquDqz8GMDQIvBj///+DGDEGAMAifBj8IuEThFCIEQGPCLwiQYBFCKESDCETBhhGAZGEZ4MjgcSEY4GoRQigxCIEQGPCKBiBrgxwiBEwMIRAY4MQNMIkImDEGIRYMIRYRAYhFBjwYwNQYgwBgBh4GAMQiwYgxA0gahFBgBjgYBFhFhFCKEWBgEWEUGEIgMQYQMYRAMQigxhFBh4GkIgRIRYRAY4RIMQYgYhFA18IoMQYQihFhEgwhFCIDEGIRQieBiEUIoRQYhEwYDAFwGrBog0waAaQawacGsGiDQp9MZMVT3piJjJjK//PkZOYZBgjoaUJQ0DprofQgbhq0dep71PqeU69TpMdMVT6n1OlPKdJjpiKdFZkxlPKdJiJj+mKp/0xFPBoAmYaw0BpwJhDSBMQ1BqAmIEzDSGgNXDRDRhp+GsNMNAEyAmYagJkBMA1BpDXAmECZhoDXhqAmYawJjgTICZBrDSGsNAExDVDQGqGgNHDWBMIaQ0BrAmcCYgTHAmIEzDWGgNYaOBMw0BqDSBMYaA04aA1hqwJhw0ATKGqBM8NYEz4aQJkGoNMNIag1+GsCY+BMQJlDVw0cCYfDXw1ho4aQ0gTCTEFNRTMuMTAwqqoD37wjuhHf/////hGf////hHf/gycEZwRn4MnYMncIzsGTwOdOA507A507hGeEZ8GTuDJ4Rn4HPn4Mn4RnhGcDJwM3YM3gzdBm6DNwR3QjvA927Bm//Bm7Bm/Bm8GbgZvBm4GboR3gzeEd+DN8GbvBm6EZ+Bzp4Mn4HOnBGfA588IzsDnTgZPCM8Iz+EZ/CM4DnTgOdPBk8Iz4RJwGTidBi7AycTgiT4RJ8GE6ESdhEngZPJwGTieDCcESfwYToMJ3AycTwiTsDJ5OhEnwibwYb+ETdwibwibvCJuwYb/4RN/Btf/jYGyNv8bHLUtSzE0/LQBW//PkZPQcHgjQAFKVrjfDmgAge1eMLITcshNy1LX8si0LUTQtCyLQTUteWQmvLItSz4mgmnTJops0umEymDSPsnR9HwfB8k7Pvn0fAvwtcLXF/F+L4vQtQWuFoC0BaReF7AeBfwtcXBdF4XheFwXAtAui9C1haRdi6LwvirgnUE6FcVBVisKgrCvioK+KoqiqAhh3AQFXhwVYrFYCWHMOioVAI4dFWHPDgCAdDgdDmHcBIBEO+HRWAiKsBMO4dFQCAdATw6HBWHBWAgHBUHMOf/gICsOCoV4qw7+KxWHA6KhVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVC11Fz1+NP+/Xkqpr9OfuhQ6lZNWf+XsZc/si+KNoOj/Ntai9j7IISgZAklTqQhjToNTeQoreRdaSDODWvYAVFaWWkQmVuZPP8bRUzq896vc+XS6mm5gnnW7JLnV4z9N5XnW4k86x+uyHyxnWkmdborzraff2SvOtvljOtjd/5XRW8MivOsry/K3gUzrFPS1eFTOttTsul1+lLGdbV3c53h51mdbK7xPOr1SpnWlM63kedZnV4XPK86onnW7myrnWTmRTOqascoabXd/L+yuzS95dv1efjhl92ntYyTuIb6wuWRZFmWRa//PkZOcb/gqMACDf1LTLofggA9qc/gKRZiblqWYm3E24moSQnR9BJj6JwfBaFqWZZFoWvLUshNPxNuWn6bTZHgozRTSaNAY5oGjFQVgTkE6FUVorioK8VBXBO8VRUioAhxVioK4qAnIrYrCqKsVRVBORXBORVFcVcVwTgVBUBORUisK4rCoKwrxXFYE4FYVATjFcVhX4rcVBVFQV4rxVFSKwqCpFcV+K8VhXFYV4qivFUE4FaCdivBORUBOfBOgToE6FUVYqisKgqCtxWFbFQVxXisKgqRU4qioKuKwqCvxVBkH/4Mgf4Rg4RgfgxZBizhFYEVuDFvhFbBi3CKyEVsGLf/4MgAxaDFoGsWYMWgaxYBrFngxaDFnCKwIrAYswNas+DFgRWYGtWYMWBFZgxbgaxbgxZCKwGLIRWgxZCK2EVmDFmDFgMW4GtW8IrAYtBi3Bi0GLAYsCK0IrQit4MWeEVgRW+DFsI9cDW9AYtgxZhFaBrVgMWgxaDFvCKwIrIGtWhFaBrFuEVvBi3hFZA1i0IrYMWYMWAxaEVkGLAisCKzBizCK0DWrIRg+EYIRgQjABkHwODABkDhGDwODBgyAEYIRoRvww4YcKILYKILfhRg5htjY4OQbQ2hNAH8su//PkZP8cRgjWAFAUYjwDofQAi9pcJry1E1LUsuWvE2E0LQTcB+E2LMTctQFEEcWnFYVwTkAI4rRWFYE6BOhWwToBBAQgnIrisETANwIiAb/COEQEbgG+EcA38A3wjhGCMEeEaEeKoJwK4J2KoARBVBOIJ1FWKoJ0CcCuCdRWFcV4rioK4rAnYJ2K0V8VYr8E4xWFUVBVFQE6FXBORWFSKorxVFcVwToE5wTvBOoqwToVIJziuKwJxAQgnUVBUgnAqQCaCdxWirFaKwrRWFcE7FfFeK4rgnIrAnYrCoKoqgnAqCrip4qgnCr/////8Iu8BjvP4Ry5/8Izggc4Zw4RnD/hGcP8GThBk4eDJwgycIMnDwjOD4MnBA3eu9hF3kGO8gx3vBjvAN3jvMGO8CLvAY72DHeAbvXe+DHehF3kGO8gbvHeBF3oG713gG713vgx3oMd5BjvAi7wGO9A3eu8BjvMDd470Iu9wN3jvQY7wGO9wN3jvIRd4Bu9d6Bu9d6DHeAbvHewi7yEXecGO9BjvQN3rvIG7zykGO9A3eO9CLvYMd6EXegx3gG7x3kDd470Dd472DHewY7yDHeAKomwmhZFkAof8tCy4m5aCbcTUswFYsy0/LQTX9NBqBgJgYaY//PkZPcaTdCuAFgWlkI0DfQAe9r8Jxz6CShr8++JsArgjxNBNC0LQsyyLMsgRxallyyLIsi0LUTUtS0AVwFPia8si0LMTXiacsxNizLMTYTcsi1LMsy0E2LUsuJqJvxNyy/E1LMteWgm4mpZlkJuWRZFmWnLQTfgncVATkVcVQTsVIqQToVxWFeK4rwTmATCsCcAnQJyKoriqKwrxWiqKoqwToVRWBORWBOBVFSKgq4qAnAqAnArRVgnIJ3FYVQAgCriqK4qYqivBOsVoJwKgJ3FYVBWFfBOIqCoCcivipxUFSCd4qRV4rCvFaCc/BOhW8VxWFUVhX4r1eX/+DHgaYMOEX/CJgwwYQY8GODH/wYf4RAiQiAxCKBj4GAMYRQiwYcGEGMIoMfhECIBgEXAwCJhEA1BjhF+BhCIDEGARYGoRAYgxCLwYeESEUGMDEIoGAMAiAwBiBrCJ8GMGGEWEUGIRYMAYAxCKBiBgBqDDA1wiBEBiDAIsGIMANANMIoMAYhEBh4GMGMGARfAxBj8GAMANYRAYBFAwCIBhgYhEwNQMYGIRAMAiwNYRQi4RQYwYgahEBiBqBgESEUIqa6Z6bTBpGkmUwmkwaZpJlNCkifmkaaaBymgm0wmRPxSDTTa//PkZOYYTgboZUAQIkCEFgAAe898YTZpJtMJhNilphNdMJhMGgmemDSNJNmkaX6aNJN9MJhMc0E2mzSNJMpg0umU2mDS5oJlNJtNJnpg0DSTBoml0wmzTE8TRpGgm00mkzzRNNMJg0jQTSb/NFNdNGl02KTzRTfTPTSbTKZNLphNJpNmgmUymkwaaaTKZ/TSYTBoJr/ifptMpr9MJlNptMpg0kymumEwmf+mEwmOmkymTT5ppv80eaHTCYTHTSaNBNJtN80/0yaBoJo0k2aPTPNA0OaSaTJoplMJv9MgBAB4MBUGwbwVwUBkFAYDAU4NBoMBqhAELk//h/y1/vz6/6zMnEglwqnIsVSHBzAMMIqXiLgxS8ucoLCKl7VwipeupwYpeAxS8Z22hSl4U+qE1L2goKUva1GUJqXqwkpeAxS81IQpS8smBqXql6E1LyEVLxdEJqXoSUvAmpeJhFS8rpH3CKl6EVLxPWFKXgDUvVL1LCal4kuDFL2EVLxFlPClLyEVL2FKXhdwYpeswGpeqXkGKXqLAxS8wYpeqWk8KUvATUvQYpehJS9Bil6yoUpegipeZT2x1vN5NR2X3KrRuXjFmaS0AUCyE1BHflmWZacTYsvy05ZgAIs+WQCqJoWZ//PkZOwZ+gaYBgbm6EQMAfQAe9r8ZCbiaFkWv5ZibialoArlryyDtCSnyfR8hrE7PpNmiaIxDTGKafTJalqJoJoWQm4mnLUtSzE1LUsxNyy4mpZlqJpy14mgD8WpagKvLIEcJuWnLItBNhNhNxNgH8tSyLMTflmA/iaCaFqJqWf4mxZFmCdCvFWKwqivgnQJzFfwToAIwqgnOKgqCoK4J2KwqisKwJwKwqCqKgJwK4rYqirgnIJ2K8VhVwTmKorYrioK4JwKwrRWFQE5FUE6BOwTgV4qYqiuCdAnYqAnMVBVFUVATkVBVirioKoqCviuK8VwTjxWFfivFUVxXBOcVuKvFaKoqiuCdeEW3Bjb/gxvhFvCLYGN8GNwi3CLf8DbtuEW//CM7+DG+EW+DG8DbNgi3CLfA2zYItwY3gbZuDG8GT/Bk+DJ+DJ/hGdCM+EZwMnQZP8GT8GToRngc6dBk4IzwZOBk8GTvhGdBk+DG8Dbt8DbtgY2CLbBjYGNwi2A2zYDbN4RbhFtA2zcDbNwNu3CLaEW4RbeEW2DG8DbNwY3BjYDbNgY3A2zYItwi3CLbgbdvA27YGN/CLaDG4RbgxsDG4Rb8ItsI7oR3cGb00m0wmTT6aTZoJgUpMc0kwaa//PkZNcYqeLUAAAUHjw8DgQAe88cYTXTXNBpXiQdfLVpLJoaCSJs0TQNAbRpJpDWleaGlDmlfQ9fQ7tBZoa0IeOw3Ccq44TcHgrufDVzQNA0Om0wmDTNE0EymkymumU2mU0aSY6ZE8NFMmiaaYNDptMGn+aJpdNptNps0OmU0J50wNtMGmmEz/zQTJpppNplMJlM9M8FAYCoKAAApgqDIMACwAQbBsAMGQAQaCkGg0GgyCkGeCgNABwAAUgrwA+CoAQNAeHCAOAeAyIQHBwgDg4QYDAGgMEEOEAeA0Q4DxAHh0PEMGYMBsFQYDPgoDMGQV4NBqryAZfhGfwjMDl4Rv/wjcGT/4R/CPBH//hH4H3gzv4M7A+/gzoR4GdBnAf+DPBnwj4M7BnwivA1QIpCKcIpgaqDFgaqBogMWBqgGqgxQinA0XBi8IqEUCKBFcD7/CPwj0I+DPA/8GfBnQZ8I+EeCPwZ4R6EfhGcI0GSDIDJCNCMBkgdsIwGQDkBk4HIEZgy4RoHZwZQjcDtCMgcoRgRoRgHKDJBl4RgHIDKDIEYEaEZgyYMoRsIwGQGQIwGUGUI3A5AZMI2EaDLBlwjQZQjAjAZQoqIqqN+pypx/qNIqoqqNKNKcqchwGrCAPqN//PkZOsaCgjiBUZRnkhEBfAgw9tw+iu1RUqp2qNUNalOVG1GkV/U58sLU48sLLCiwFU4hAYA+qQQgasVhVIYQNWKwmAKpvasNoHIDm4OQHIDlGwNgbH4D+JuWQm4mhZFoJsWgm4I4TcbA2xtA5ODnGyNoHJ+NgHKDl/LMBXLUtS04mvLQteAqCaCbFoWQmha8bQ2Acg2ht8bI2RsjaGyNrjYGwNvjbByja/GxFYE4ipBOIrwTiK4J2KuK8BAK4rAnAJwKkE4FYE7FUVgEIqgIRVBO4qRXFQVBVBOMVwCcE5itBOoqAnQqCpBOIrxVBOoJ0KwJxgnQrCuKsVBXioCcCqCdAnYJyKsVYqipBOgjwiAj/8InhH4RMIkIioAC4RiJCMRP////CNk//Blkv4M6F8I9C/8GWT/8I2SwjZOEbJQZZIGWShGyYMsnwj0P///CPQ/hGyQRsn8I2SCNkgOyVkoMsnhGyQMslCNkoMsl4MsnhGyXCNk4MsmEbJ/wZZP8I2SA7JWTgyyQMiKDIieEYiAcRIihGIkIxFwZEUIxEA4iREgcRYihGIoHESIkDiJEUIxFwjEQIxEwZEWDIihGIoRiKEYiHcYJRIr9kzDmO5cIaApXE/NA0TTTKZGym/0//PkZMQWjdCsAwAWCsQ8Cfwoe89cyaXTKZACgKxsmybQFQCyPQPUbRtA9x6QAoegHKmRtClpk0RSkwaCYE/GyaaZ6ZFJTaaTCbTabTBomgmk2mxS0x0waSaTI2gcgOcT0T5MiedM9M9NCfCeGgNhMJlNJoT1MdNJhMjaNPptNGkmhtpnmgmv+KQmRSE0aaY6ZTKZTRoJg0U0aBopg0emU1/xPzTTaa5o80DRTZoJs0TRNEUhMikJs0P0x0wmkwmUymkwaKb5pppNJg0OaInhpGgmeaSbTBp9N/ptNJo0DTNAbOCkGAwGABgA4NgwAAAMAPBgAQKAyDAZgoCkFINAABWAEDAUBTAABgMBTgqACDcGAAQYDAUqLUlVt///+Bj4MIRcGH/hE//hEwY/wi8GPBj8GH8IgRcIv4RYMQi+DAIsIsIn8GHCLCJCJ/BhBgBpgwwifhFhEhF/gwCIDAGIMIMAMQYBFhFBgDH4GAMQiQNAYAwwYBECIAMIAMAAiHBgAMIAiAIg4MABgABhADAhEAGAARCBhCEQhEIMABh6EQAwIMABgCEQwMAQYD4MDCIcGACIQiHwYGDAhEOEQ4MAENB8hJD7PsnXJ0fZ98+D6LItQR3PgnZHmgPYYRopk0xj//PkZMkU/gLsKkITrkL0CfzIetvgJtNdNGkmkwCPLITf8s+WpaFmApAjgFUsyz49jSTCaGMmkyaRZlkJsWpaiagKBZlmWomh8c+CdcnROj4Pk+Akh9E6DsJ0fJ8c+OTs+idk4J2Tg+j7Pr8nB9nwfAa59k7598+D74Sk+eEkFQdDmKsOhwBEVYCeAiAmAiHcBEV4CYCIWmCHF6FqC0haRcF4XYvxfF2LwvC+FqC0xcC0C/FwLSFoF0XBfi7C0xei8LwvcLQLoWoXheC0BaIWoXBdiNiMY6cZ8RkZxnjqOojAz4zx0HUdBGozjoMw6iMjpxdi+L4uC5F/xd/haIui/bZ/+DGBp4RYMQYgw8Ivgw/CJ4RfBh/hECKBgEUGODH8InhFwY4GoMcIgRIMcInCIBrBhCIESESBp+DEGARfhEA1gxBjBj4RAYQYgxgYwiYRcIgMAiAwBjCJgYAawYYRQMQMAYhFgagYhEA0AxA1A1CJBhBgEXwMQNAihFhFAxwYAwgaYMPCJA1hEBiBrwYQiwYwiBFwYhFgxgawihFCLA0gYAwCKESBoBpCJ4MIRcGOEVB9ALR8BJj7/PonB9HyEoJwfZ9E4Dt5OeTnlqJtxNAH7nwfHPonJ8E759E6PoJI//PkZOAWKgjoZUAQYka0Ffgge9VcfZOCdE7J0To+Cc8JWTo+D7J0EqPoO0+T5PsJSfJ9n0TkJUfJOeTknPPo+z6J2Ts+ycE759/k7Pg+z5J2TonBOeTkJUTg+T5DtJ0Tvk5Pjk5DXPg+idH2HYfR9E6PgnR9k5JyfZ9cnR9cNYJSfROidE6Ps+Cdn0fB8E6DtPs+CdHwfH5OAlR8nyfB98+SdE4J0ff5OidH2TknfPkJMfYSg+Cd8+D6PsnP/JwTk++fYSQO0+D5J0fZ8HwTjn2AWDgdAL8ApALQCkO8GACwMgyAVBiAVhzwY4BeDIMgFMOh0ArDgc4BeAV4cgFsOhz/wP225HGw7wCsO4M8AqHP/+DEGQ7/8OgzgFoM4Bf4MhwO4BT4cDmHcGfDnw78GcVhUFTFXFeKoqYJ3isKuKkVgTsVoqCsKwrCoKsVQTqKorYWoXhfxeF/xdi58XOL4WmLnFYVQToE4FXiuK0VwTnFQVRVFcVhU4JzFfDgdhzBnDuHfALgyDAMQZBgGQCgBUAoDAMh3BkAsDMGcGAYgxBn+HAC0ArwCwMAS5adAry0yBSBfoFBVaKqKwVUVrRXUa9FUOEqVUjV3ySPLkvkzlNlNn02E2S06pvVKWACECpW//PkZN8VDgj+zymq5krb1ewAxJvkqe1XysDVFSqlVIo2o0ispyFVoqKNIrKcqNKcKcFhSjaKiKyKhYWiv6nCnCKijajSnPorKNKcKcqcIrqNoqKNqcKNoqKNKNqNKcIqKN//orf6BSbKbKBSBXlp0CvQKTYTZ/0C/LTxFxFoigioigCLC4cRYRWItEXC4cRcI0IoFwwXCiKwjQXC8LhRFcRcRQRSFwoikRcLhxFRFguHiKRF8E7FYVhVBOgCYVRUACKKgqgE0E6ACJFYVoJ0CcgnQrAnMVwTgE6ioKoRwDdhHhG4RARgDcCMEaEYIiAbwRIRuESEcIwRwiYRwjQjBEgWoFuBa4FngWkIQQigwhEwigx/CL/4RfCKEQGP/wYiEUwYHwYGDAwYAGA4RCEQBEGB0rCNcGU4RrBlcIsGGDCESBiEWDCBhCIEWBiDAGHCKEUGEGEGMIgMAiwigxCIDADQGIRfCIEQDXgYYRfBgBoESEXwY/CJCKEQIsGIRODEGIRQYgw8IgRYMMGAGGDEDGDAIoMcDQIkGMGGBrgwCKDAIsIkDUDWDGDDA1hE4RQMQYgwBhhFBhBh4MAMYRMIoRAiAxBjhF4mhZFpxNBNy0LQTUTXhKglR9FqWpaAP5Zi//PkZNYXkgTkGEJwlkXcDfQAe9r8bCa/k5JwTriacsizBHE6CSH1w7efHLPgjuJqWnLITYTX8tRNAH/ialqJuJuWZaFkCO4m5aE7J2TonB8E559nyEnJyfB8FmJrxNxNhNS1E3LT8sxNC0E0LTlqJuWQm3E15ZiaFqWRZiaCagP5aCblkKoqCsCdioKoqwToE6FcVwAhRWBOIrCpFbgnEVRVFUVIJ2K4rAnIqioKgrcV4riuK0E4FcVQTsVxUBOoJ3FUE7itFYE7FYVRXFUVwTkVoqAnYJxBO4rReF4XYWsLWLoui4LwuC9AdsLQL0LQA9C8Lgvi6LguBahfFwXAtIvQQ4vCqKwrxX/8E5xXit4JwKzBnwj+DF+F1guvBiQYkDRIR8I/gz8Gd4R/wYsGLBi8I8DPBneDPBnwZ/8I8DP8I8B/0Gd+DPA+8I/+Ef+DOgzvwj4R/hHoM+Ee4M4D74M+Ef/A/7gfcDPBn4R7BnfCPgz4M7Bngf8DPwjwR6B/3CPwj0Gfgz+EfBnhH8GfwioRQGIBqgRUDVAYoGiBFcIoBqoMWEUA1UDRYRUIqEUA1WBooGiAaqBogRUGJwigM8I/gz+DOCPwj/Bnwj3BnBHgZ4M4I+DOhHhNCz5aiaCb//PkZM0YugrgAAASBEUEBfQAe9rclmWompZ8shNyzLMsy1LMBUAfhNxNicBJCcE5J0JpyyLMTcBVLXloCO5aCagKACiAqflqWYmvE3E3BHlmArFnxNRNC1LUBS5aFoWhZFmWR8k5CTnxz4PonZ8E5Pg+j4LUshNQH4TYtSzLMshNBNhNSyAViyE0FQE4FYVoJ0CcRUgnYqisKoJxFWAhiuKgrCtFUE7FQE5iqKgqRVFWKorwTsVxVFYE7FTFTBOxVgnAqRXBOPisK4BOK0VoriuK0E5BOxUivFcE5FYE5FQVBXFQE6FQVBVFYVxWioCcCoLovi4LoWiL0LSL+LouBaIvBahdi6LoWgEMFoC1hacXxdC14uipiqKn8VPFbiqKsVb//Bm/+EXgx4RdhFb///hE1/8GLP//CKwIrQjoGa/wPewZqEdYM1wZqDNAetgzWEd8GagzYM2DN4M1wjoI7Bm+DNhHcD3rA9awZuEdwZvCOwjsGaA964M1A978I7hHQR0DNge98I6hHYR1wZrBmwPWgPWwZsI7wjqB63COvgzQR3BmwZsGaget8D3rCOgZoGa4R1gzYM0EdwZsI6CO+DN4R1wZsD3oGaBmwjqEdAzXCO/4R0DNAzYR0WgI8TQT//PkZL4XFgTcAE6Tekf8EfQAe9t8YTXiagKwCsJuWXLMTUtC1LMTT8TYTUJP+fAdomomoD8JuWoCgWoI7iaFkJqJqfZ8hrk4CSE5Pk+Cdk5PgnBOT7JwTg+uWZaiaCbcsgFAsy0LPlmJsWYmom5ZFmWpaibiaAjy15ZFkWQm5Zll+JsJqJvy1E0CThJz65OQlJ8H2TknZOT759k6J3z4PgTQTcsy0LITflmWfLUsiyLITYTcTT8syzLQsi0LMEcWZa8tSyE1LTibibFqWYI/8shNCyE1LQsy1LUTUBTLLloWXLUsiyLUtBN+JqJvy1E05Z8TcsxNeWn/LTnxydHwfZ9n1ydk4PsnHJyfR9E4JwTgnB8k4588nB9cnR8c+D7PjxV4q4r8VsVgTgE4/itFShX/xV4rirxVFWKoq4qfxX8E6xVxUBOYrCtwTvwTj/xV8E5/irBOsVuKwqRXFTFQVorCrFf/xWioKwrCtioCcxUFUVAToE4FUVxWFQVhUBO4rgnUVIJyKkVgToE4ipFUVoq4qisKsE64qCoCdxUFUVxXFUE78VxWFQV4qiuKgqiuK4CCK2KoqirBOATsE4FWK4qxVFUVhVFYE4gnIriuCcQTiK4rCoCdCtirBORUiqK2//PkZLAWsgzuADQNNkZj/fjIe9r8K/FXFUVwSE5aiaAKgmhaFpxNQkp8n3z5PsJOGsffLQsyyE1LItS1E1Af+CPLMTUTfibFmJoWQmxanzydHwTsnASknBaCalqWom5ZcsxNyc8nASsnHDt59BrhJgkpOicBKg7D7JyfZ8E5Pk+Cd8EeWXE0LQsiyLQtSyLIsi0LUTYsy0E3LITQshNiyLUsiy4I78shNy0LMVcE6ipgnArRVgncE4wTsVIrCqCcCtBOYrwTgE7iuKwqCoKwrcE7BOQTqKgqiqFpBEC1gPYD3F0X4WoLTF0Xxei6FqC0BaAtQWgXxdwtWFqC0haBW/FQVRUBOBUFcE6ioCcAnEVRX4rYrxWFUVBViuLsXgtAuC6FoBDBaYvi7F8XxexdF8XhcFyI//gx//CJBhgxhEwY/+EXwYgx8ImDH8GPhE8GPhEwigwhFwNQNQNfhE+DGDAGHCIBrhEhEBh4RQMAY/gYBFBhhEAxCIDCEUDEDHBiEUIoRQY+DCBp4McGEIgGgMcGIGMGIGIGgRQYgxCKBiBjBgDGESDADWBgEUDEIuDADWBpBiEUDEDDgYgwBgDEDQDUGIGgRAYQYAxCKBhCKEThEBgBiEUGIRQMQiQiwNAY//PkZKwWNgjoZUAQREakFfQAe9t8YMfwi4GBaFoJsWpaFlyyBHctCzE25ZiaFoAocsy1E24Sk+idk6LMTYTYTQsyyLUtCyLQTUswFYJMGuTg+CdHwErPotAFAsuJtxNCz4m4mvBHiafloWZZ8YppBqzTNI0jTNBMpg0jTTZZFqWfE3Af/xNf+WomhZ8suWZZCb8tC1LQtS14m/LQtBNhNOfR8hKCc8nHJ2EqCUE5CSHxydk6Pg+D7Ps+Sdk6LUTQTcTcTctSz4mwmha8TXlmJvyy5ZiaFl+WpZFoWZa8TQshNCz4mhalmJsWfLQsuWRactBNRNC1E1LLlly0E2PgJWfR8h2H2fJOSdnx+fXPs+T5PgNbnzz6Po+T7JwTk+z4PonROglJ84qCvxXxUirFX4q4qeCd1f8InCI/4R/CP//4RMI/CMEYI4RAR8I8IjCJ4REI/gG8ESEfCOERCP4R/+EaERCPCNCNCI4BvQjYRMHINobIOfjZBzDZG3xtja42gcw2PwcvG2Nng5+NgbY2wcn42htDYGwNrjYGwNsbX42vxscbI2gc3Bzg5Qcg2uNvjaGwNgbI2+Dl4OUbI2Qc42RsjbBy//g5eAboR4RwjQDeCP+EcI8IwBuwjwjBEBEA//PkZKoZMgrqADXt9EV8FfQAe9scG+EThEBGCMESESEbhEQjwjwjwjBHCIwiQDcCNCI/hHE0/LQBSLITf/lqWoSvk7LT8BWLMtRNAk58E7Po+CyLQTcsyyLUsi0Afi1LUTUTUtBNS05aFkWpZHzwkoSgnB9HwfQSsTYsizLQtRNRNgFf/8NcJWEmAWCdn0To+T4CUHyGtxNiyLT/lmJqJqJqWgmpZFqJsWgmwmwmwmv5ZiaibiactBNv/yyLTiaFkWZagKgCmJqWQmgmom3E0LTibAKfE0LLiuKgrYqipBO4JzFUE5BORXBOhVioKwqRWBOYJyKkE6BOIrYqCqCcxVxVFUV8E4FSCdcVgAgCuKkLTBDC6CHi+LwuRfha4uC+FpF8XQtAWgB2wtAWoXBchaBfwtQWnFSCdxVxXFUVhUFYV4rgnOK3wTiKir//1eDCsf//7/+wOYd///ei/f6lmiqGXpyOlCSRm+yP3UtDhFIzqBhwCFHAGFHABYGcAnAAMOAAYcAAw4BYKOAIROANgicAQYcABE4AAzgE4B+1wmcAwYcAK+sDOADgFLCJwAlWBnABwABnABwDWraETgEDOADgDBiRkgoJpGaP+64RSMoRSMGBiRkkwMSMlq7AxIy4//PkZJUYEgieBFw3fkL8FgAied8AROAAicA8DOATgAGHAAROAFwM4BOAGBhwADDgAGHANQUcAgicAYROAfgw4AIkbPNNNpo0TSNBNJgUs0l7lomEwmRSOaRp80zQFK4nvTInnTEGgwGwAwYmOmkyaInppJpMJg0k1+KUaaaTCb42U0mBsGiaSaNNNpo0OaKZNE0jTTSY5oGmaZpJrphM9MGkmDQTCZBzpg0OKR+mBtdMJobfTSbTfG2KSaBpGgaZomiaBomn02mOmkwmjSNPpjmmaKZNA0zSNFNCeClJkT40DTTCY5oJk0kyaJpdMppMdMdN80TR6ZTXTfNJNmimumem+aKZTKaTaaTRops0kwaZppk0+aSa6ZTKYTfTfTPTHTKa5omgmEyaJo9NmkaRp/pnmmaf6aNNMplMplMdMpv8TxMJlNplNJn9MdM1OM6hWa/EjiRiRiO/xIcSP+GgCZQ1+GvDRDV//4aP///4I8EwTwTBLwS/4AHgnBHBHgiwR4JgAgS4IwAYPA8ADg+AAAAFwfB4L4WADC2AGAGFwsFwuD2FgAcAPC+F/B8L4X/B7B4L4WwuD+AGDwXACAAC2D2AEFgfCwAAAAXB8LhcLeDwXCwPYPA+ACACD+AH4XwA//PkZJMVIgb2ejVLxkBMEgTIe898vwv4X/ACB/C4WwtgBg/gA4PA9gBeFhLRTXTRomkmP0yJ6J+mPy0NA0OvibNDQmfzTNNMjaFKNATxMiemiaRoGkmE2mkwmTRTHNBMGiaCZTSZTZomh0PaV9fX2hoX14kzSmOaCY5pJr80U0aPTfNFMps0jSNJMmiaSaTKb6aTKYNLphMpg0eaJoGkJ8aBoppMppMJg00xzTTabNFNJpNJpNpnpg0DT6bTRoppoJMWrSh/690NQ5paV5D2le/LND2hoQxDF/rzR1/r/aWhfaWleQxfXmheaevNDS0tLQ0ryGoch/X15D+vLy+0oc0ry/19DUOXuvIc0oav9oXkNX1/r3X18QCGHQGQHB8PiAPAaHgPDsBgcH+Hqv//+DJ0GNuEW4MbQY2wZO4Rn///4R34R3Qjv//8Gbv//8GbgZuwZvCO4GbsD37+Ed3A586DJ4Rn8DnToRn8GTsGT8GToRn4HOngyf4HOnBGeDJ0IzgjOCM8DnTwjOgydwOdP4RnYMncDbtwY2A27cItgNs3CLeDGwMbwY3CLaEWwRbQi3A27eDG0GN4G2bBFvA2zcItgY3A27YGN4G2bAxtA58/gc6eDJwHOnAyfCM7A588//PkZLMYngTSAFAUhEYcDfggw9V8DnzwOdOBk8IzuEZ4MnAyfgychsy7F3oE13Nl9sy7myrsL6qqOU5anCqkHqNDI3KVUTEU8GNU7U6gxyHKchyVV/Xa2Zspfds3rubK2VsjZmztk9djZi/TZV2NnXYu0vsm0yaBoDZNEbA2k0aKZNjmwbH/Nvm2bRtGyBVArD1G0bQPUevg9h6/+PRzZNkCrzZNgesegesermyPQPXzbHpNvm0PQPUPSbJs82TaHqAtj082h6DaNn8eo2DbHrHpNjj1m1zYHqNo2jYNnmwbPNgek2ja5sj0D1m0bJs80xtJlMdMCeps0U0meaaa6b5p/mmmU3zRTfNFN/pgHPzQNPmkaaaTXTKbTRoJk0zS6b/NBNdNJlNGj02aH6Z4IgAEEYJ4I+CMEQJcEUEXBOpHDX/w1Q0Q1Q1cNWGvw0Q0/hp/AmIaA0cCYhow0w1/w0hoDRhpw1w1BrgTLDXw1BrhrDQGgNQEzAmOGuGiGgNfgTHDQGoCZw1w0BrDWBMIEzDVDTDUGgNfAFwGjBrg1A1YNcGsAXAaQaABcBqg1g1QagaINYaoEyw1Bow1YaA1hoDSBMw1gTICYQJkGrDQGoNGGmGsNcNQawJkGuBM4aIa//PkZKAYngTsATQNQkKMFgDifh7AYagJkGsCZ+GkNWGiGsNAaYaOGgCYgTENQaw0Yaw1Q1Q0/hqw1BkAfmkaCb6ZTCY6bNBNLwmqGA5fzSTCb/lgwXOmMmMmTQ5pmkmUwmkymfzRTaZFJ6aNM002NrppMpg0kwKQmE2m0yKUaKaE95o9MJj9N9NJk0UymOaSaE/TabNNNmmmk2mU2aHTKZTCaNDjaTJoGimkyNvpk0TRTHTf6bTRopg001+mU0aXNBMjYNA0k2mjR5pfps0U100mUz0ym02mDRTHTaaTRpplMc0kz0ySA000mDSTKbNI002mzQTHTaYTf//NA0zQTBodNJk0UyKSaaZNJMprmkaP5oGmKUmEymUyaCbTHNBMJlN80DRNBMmkm/00mUwaZpprplNpvmiaJo80+aSa//TaY/6ZaH//wY4ReEX4RIMfwiAxBh/BhCJ/+ESDDwYcIn+EQIoMAiQYAw8IsGIGGETBj4MP4MQiAxhEAwAxAxBjBiEUIgMIMcDCDAGIMcGMDEGGBgEUDTwNfAx4MAiwiQYgwBgEUIgMIRAiQYhFwYAwBhA1CKDEIoGoGgMQi4MeDADGEQIkIgGMDCDAIoMAiQiAYwYYMQNQigwCJBiDEGAR//PkZJwV+gzoZUAQRkZsCfQAe9tcQYgx8GEGIMQiwMAY4MANAMcIoMSyE1E1/LMTUtCz5OD5PkJJz5Pk+uA/FqWRaib8TUTUTQtC05alqWYm4momgI8TYsxNCzE3LUtQFEsgFM+z6J0fB8nz+TsNcnB9BK+Tk+g7CdhJT6LTiaFqWYI7lqWoCvy05ZlnxNy0/LUshNBNvwR4moCj+Wv5ZlkJqWpalkCOE1E1LQsiyLITUBULLlqWZZlmJsWhZcsi1/4CiWpalkJqJuWvLXlkJsJpyy4mwm5ZlmJuWXLUTQteWgmgmwCsJoWfE3LMsiyLP8TTlkJuAolqJryzE1LTibCbloJuWhZFoWYmxZ8TcXIvxeC0i+FrF0B2i4L8LSL4uBaIDyCHF8XRfF6FqgiwtIuYWoXIrYqAncVvxVip8VIqCvUxPqtFbFf/4q/8V/8V/iririr8VATjxXipxWgnYq+KwqfFTFQVoq+KsVBW8VhUisKuK0VRXivFYE4FTBOhVFcVRV4riuCdCuCdCtwTiCcCqCcgnYqxWFcVIJwKsVxWisK8VxVgnArYqRWFeK0V4qgnQrgnYrfBOoqAnAq4J0CciqKviuK3BOoJyKsE4FUVoqisK2KwrAnArgBAFSK4//PkZJ0VagjyJgGtbkOkFfwAbh4AqRViuK4J0KgrCrFUVxVjOEeDQgjlcT4T40xtjaNI0uaI2QciGNJIl4kJZtCGIaSckIm6GL3TQ2zRTY2UwmjSNE0fxS02aY2BsJs0/+mzSE8TQpHTKZTaaG0aQpApZp/mmm+aHTfTCZGwNgUk0E0aRp/ilJlNJgT5MmkJ9zQNA0TQTH6ZG2mk0mk0mk3zQTKY/G3zQTHTabTBpGgmU0aKaTJpJpNJtMphNjYTfNE0emkymE2mEyaCbNBNfmkaJpdNJnpg0k0mDTTCbTaZTBp80k2aCbTfNE00yaCb6bTZoplMmmaKZTKaTJpmiaHTXNJNdMDbTab6Y6Z6ZNNMJhMJhN9NJrmim02m0ymU300aPTSa6Y//5pJpNdN/9NppxWxU4Jx/xWxU/xU4qcV/ipiuKwqxWFbioK/8VIqivFTwTkVgTkVor4JxFXxX8VcVxUFQE4FaCcwTvBOIqwToVuKwqCtFUVYqxXxWFeK0E7FQVYrwTnwTsV4rCqCcfFaCcRVFQE5gnAr4JyK4r4Jz4J0Koqip4rCvisKoJ3xWBOME7iuKgriuKgrAnAqgnArxXiqCcgnYJzFQVQTmAEIVYrwToAIYrwTiKkVQTkE5//PkZK4XGgzsADQNAkIcCfwAe898FXFTFYVxXxUFQVkzzS5oilg5TTTY2kyaJpJtNGgJ8aKaTQ2k2aCaNI0eaSYNJM/tKHEiQxfJG09MmgaSYTRppg0TRNNMJlMptMCfppNprmiaA2jQNLmmaRppk0jRFLNP9NJhMGmaQpZpJhNCkGkmE0J+mxSk0m0x02mjRTKbTCZ42EwaQpJpptNprmgaRpmim00J4mzSNM0kymkyKWmE0muaKYGwNjmgafTPNE0U0mUwJ7+mem01+J8mhSk2mjRTSb6aTCbNBM9MpjpjppMpk0E2mE2mE2mjSTfTaZ6YNFMcT1MpnprptNmim0wmE100aSaTRo9MGjzTTHTaaTfTSaNLpoFMAAFYNBQGwAvwAYM4NgqqkjaAN3d3d3etERNK5CZ/3Ctf8AaiAc/u7vaIn/+8XPv//+GDKv8W1/+AC8K4Yw+94xe940jgceOBwOcRaxGwH4EuNIjBfxazB8HhkwVjIAII/vDkjG/wAcJPeF5e98hNgSYLWMFvhZ73pX06aoehpmh01hMJtM9K3TKY9E10x+memvlIpZM9MUTCbShbUrtM+n5ophNZuXK+0wmemumMCemkmvc0Uwm/lJJlLe5oJZI0SyW6R0mE//PkZLcXlgrzECFvrEmMEfgAfh7k2aORpbTYUo9SBNsekGYNVKgqg6hrUXK4Q42DOwPWbILEzBSumEgkWJPU8S72G5wUuGDwguEKa1Q0UykS3Bn7FJNgg5qoEgpsGabBtGabZt7NrKCNgLYes1idmabBtm2bZsBRm0PQbF9mwPSPUBbMwzB6QojYM42ePTzbMwzR6TaNs1eBVNv81yDUJ2QYhJtD0m0PVe+x6T2M8HsbFwsh6B6D7HpugT2uZhO6HqZhmE7ISZhhkFNcghtmybBnnsD1Ho49ZtG2bZs5PVBc2EEepCaEHNjj1EJHq5smabZtmwbNEEPR+bJse9z2PY2T1SN0rdNJq6yXI06COvNJj9MGmkkGmUj7pI0TToNGlEsNEnCW10ymi5FtNFKpvps0kz0uW3aaTF00mTSzdNJu0KFYz1KjaGAhyoQCFGM//zFARgIUZ/oZpdCttay6M5drW1joSj6Ekk1b7J7R7aoQNlPrWBKLTTzOsGT5yYxLrtHTy2iUxEkES0HIBVD066VjGj31odPkkSjJtbWs6OIjKmlXHR9K5MTv5pdZolE10kk2lly74TFx5KTXeTGLrS6ExiucvJSSDUdXZm3NLn1rtYBCUEoRj77WOhCPc+g5//PkZJ8XPgzoAABMTrz8BfQyY9ONGxJULutaa1TE5LHxWEo+XecmMa3p0kqBCR6qOFaFUGpNJIIjqVi0ylBqJIkiSJIkmJj605EkSRJPetWAyVacmodBUVhGfrAZPF0AUrgRLNiqDU4VHo8h6HRObJJNdqlRBMFT0qdNE0WZhmay2tCuOY6oieWieianCnVSbzjd7SGhrLi6eUSeLcZTWqdML5PM50uOGJms9VqtYU6hrgrm4V0frUzTvYsiegR2FOkqUxSKdVCpmRCSkIAUZ4VPhqEKgFDU2VhUiIhUaIg0RAkTBYEjYBUbBMuCJgLAkCUBUinABgBE3/9EQqFRM0s0qzktk9ZFqqFC6RULE11JVDkd8Y1vVFOx9oUIpZ8Vnq5klkxBTUUzLjEwMKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq`,cq={NotAllowedError:`permission-denied`,PermissionDeniedError:`permission-denied`,NotFoundError:`no-camera`,DevicesNotFoundError:`no-camera`,NotReadableError:`in-use`,TrackStartError:`in-use`,OverconstrainedError:`overconstrained`,ConstraintNotSatisfiedError:`overconstrained`,AbortError:`aborted`,SecurityError:`security`,TypeError:`type-error`};function lq(e){if(e instanceof DOMException||e instanceof Error){let t=e.name??``,n=e.message??String(e);return n.includes(`secure context`)?{kind:`insecure-context`,message:n,cause:e}:n.includes(`Stream API`)?{kind:`unsupported`,message:n,cause:e}:{kind:cq[t]??`unknown`,message:n,cause:e}}return{kind:`unknown`,message:typeof e==`string`?e:`Unknown scanner error`,cause:e}}var uq=[];function dq(e){let{videoElementRef:t,onScan:n,onFound:r,onError:i,retryDelay:a=100,scanDelay:o=0,formats:s=uq,allowMultiple:c=!1,sound:l=!0}=e,u=(0,L.useMemo)(()=>[...s].sort().join(`|`),[s]),d=(0,L.useRef)(null),f=(0,L.useRef)(null),p=(0,L.useRef)(null);typeof window<`u`&&d.current===null&&(d.current=new ZG({formats:s})),(0,L.useEffect)(()=>{typeof window>`u`||(d.current=new ZG({formats:s}))},[u]),(0,L.useEffect)(()=>{if(typeof window>`u`||!l){f.current=null;return}return f.current=new Audio(typeof l==`string`?l:sq),()=>{f.current?.pause(),f.current=null}},[l]);let m=(0,L.useCallback)(e=>async s=>{let u=d.current;if(t.current===null||t.current.readyState<=1||u===null)return;let{lastScan:h,contentBefore:g,lastScanHadContent:_}=e;if(s-h<a){p.current=window.requestAnimationFrame(m(e));return}let v;try{v=await u.detect(t.current)}catch(e){i?.(lq(e));return}let y=v.some(e=>!g.has(e.rawValue)),b=v.length>0,x=e.lastOnScan,S=s-x>=o;(y||c&&b&&S)&&(l&&f.current?.paused&&f.current.play().catch(e=>console.error(`Error playing the sound`,e)),x=s,n(v)),(b||_)&&r(v);let C=y?new Set(v.map(e=>e.rawValue)):g,w={lastScan:s,lastOnScan:x,lastScanHadContent:b,contentBefore:C};p.current=window.requestAnimationFrame(m(w))},[n,r,i,a,c,o,l]);return{startScanning:(0,L.useCallback)(()=>{if(typeof window>`u`)return;let e=performance.now(),t={lastScan:e,lastOnScan:e,contentBefore:new Set,lastScanHadContent:!1};p.current=window.requestAnimationFrame(m(t))},[m]),stopScanning:(0,L.useCallback)(()=>{p.current!==null&&(window.cancelAnimationFrame(p.current),p.current=null)},[])}}var fq={finder:!0,torch:!0,tracker:void 0,onOff:!1,zoom:!1},pq={facingMode:`environment`,width:{min:640,ideal:720,max:1920},height:{min:640,ideal:720,max:1080}},mq={container:{width:`100%`,height:`100%`,position:`relative`,display:`flex`,alignItems:`center`,justifyContent:`center`,overflow:`hidden`,aspectRatio:`1/1`},video:{width:`100%`,height:`100%`,objectFit:`cover`,overflow:`hidden`}},hq=e=>e instanceof Date,gq=e=>e==null,_q=e=>typeof e==`object`,vq=e=>!gq(e)&&!Array.isArray(e)&&_q(e)&&!hq(e),yq=e=>gq(e)||!_q(e);function bq(e,t){if(yq(e)||yq(t))return e===t;if(hq(e)&&hq(t))return e.getTime()===t.getTime();if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!bq(e[n],t[n]))return!1;return!0}if(!vq(e)||!vq(t))return!1;let n=e,r=t,i=Object.keys(n),a=Object.keys(r);if(i.length!==a.length)return!1;let o=new Set(a);for(let e of i){if(!o.has(e))return!1;if(e===`ref`)continue;let t=n[e],i=r[e],a=vq(t)&&vq(i),s=Array.isArray(t)&&Array.isArray(i),c=hq(t)&&hq(i);if(a||s||c){if(!bq(t,i))return!1}else if(t!==i)return!1}return!0}function xq(e){let{disabled:t=!1,className:n,style:r}=e;return(0,H.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,className:n,style:{stroke:t?`grey`:`yellow`,fill:`none`,strokeLinejoin:`round`,strokeLinecap:`round`,strokeWidth:1.5,...r},width:`28px`,height:`28px`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,H.jsx)(`path`,{d:`M3 3L6.00007 6.00007M21 21L19.8455 19.8221M9.74194 4.06811C9.83646 4.04279 9.93334 4.02428 10.0319 4.01299C10.1453 4 10.2683 4 10.5141 4H13.5327C13.7786 4 13.9015 4 14.015 4.01299C14.6068 4.08078 15.1375 4.40882 15.4628 4.90782C15.5252 5.00345 15.5802 5.11345 15.6901 5.33333C15.7451 5.44329 15.7726 5.49827 15.8037 5.54609C15.9664 5.79559 16.2318 5.95961 16.5277 5.9935C16.5844 6 16.6459 6 16.7688 6H17.8234C18.9435 6 19.5036 6 19.9314 6.21799C20.3077 6.40973 20.6137 6.71569 20.8055 7.09202C21.0234 7.51984 21.0234 8.0799 21.0234 9.2V15.3496M19.8455 19.8221C19.4278 20 18.8702 20 17.8234 20H6.22344C5.10333 20 4.54328 20 4.11546 19.782C3.73913 19.5903 3.43317 19.2843 3.24142 18.908C3.02344 18.4802 3.02344 17.9201 3.02344 16.8V9.2C3.02344 8.0799 3.02344 7.51984 3.24142 7.09202C3.43317 6.71569 3.73913 6.40973 4.11546 6.21799C4.51385 6.015 5.0269 6.00103 6.00007 6.00007M19.8455 19.8221L14.5619 14.5619M14.5619 14.5619C14.0349 15.4243 13.0847 16 12 16C10.3431 16 9 14.6569 9 13C9 11.9153 9.57566 10.9651 10.4381 10.4381M14.5619 14.5619L10.4381 10.4381M10.4381 10.4381L6.00007 6.00007`})})}function Sq(e){let{disabled:t=!1,className:n,style:r}=e;return(0,H.jsxs)(`svg`,{"aria-hidden":`true`,focusable:`false`,className:n,style:{stroke:t?`grey`:`yellow`,fill:`none`,strokeLinejoin:`round`,strokeLinecap:`round`,strokeWidth:1.5,...r},width:`28px`,height:`28px`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,H.jsx)(`path`,{d:`M12 16C13.6569 16 15 14.6569 15 13C15 11.3431 13.6569 10 12 10C10.3431 10 9 11.3431 9 13C9 14.6569 10.3431 16 12 16Z`}),(0,H.jsx)(`path`,{d:`M3 16.8V9.2C3 8.0799 3 7.51984 3.21799 7.09202C3.40973 6.71569 3.71569 6.40973 4.09202 6.21799C4.51984 6 5.0799 6 6.2 6H7.25464C7.37758 6 7.43905 6 7.49576 5.9935C7.79166 5.95961 8.05705 5.79559 8.21969 5.54609C8.25086 5.49827 8.27836 5.44328 8.33333 5.33333C8.44329 5.11342 8.49827 5.00346 8.56062 4.90782C8.8859 4.40882 9.41668 4.08078 10.0085 4.01299C10.1219 4 10.2448 4 10.4907 4H13.5093C13.7552 4 13.8781 4 13.9915 4.01299C14.5833 4.08078 15.1141 4.40882 15.4394 4.90782C15.5017 5.00345 15.5567 5.11345 15.6667 5.33333C15.7216 5.44329 15.7491 5.49827 15.7803 5.54609C15.943 5.79559 16.2083 5.95961 16.5042 5.9935C16.561 6 16.6224 6 16.7454 6H17.8C18.9201 6 19.4802 6 19.908 6.21799C20.2843 6.40973 20.5903 6.71569 20.782 7.09202C21 7.51984 21 8.0799 21 9.2V16.8C21 17.9201 21 18.4802 20.782 18.908C20.5903 19.2843 20.2843 19.5903 19.908 19.782C19.4802 20 18.9201 20 17.8 20H6.2C5.0799 20 4.51984 20 4.09202 19.782C3.71569 19.5903 3.40973 19.2843 3.21799 18.908C3 18.4802 3 17.9201 3 16.8Z`})]})}var Cq={bottom:85,right:8,position:`absolute`,zIndex:2,background:`transparent`,border:0,padding:4,margin:0,display:`inline-flex`,alignItems:`center`,justifyContent:`center`};function wq(e){let{scanning:t,startScanning:n,stopScanning:r}=e,[i,a]=(0,L.useState)(!1),o=(0,L.useRef)(null);(0,L.useEffect)(()=>()=>{o.current!==null&&clearTimeout(o.current)},[]);function s(){i||(a(!0),t?r():n(),o.current!==null&&clearTimeout(o.current),o.current=setTimeout(()=>{a(!1),o.current=null},1e3))}return(0,H.jsx)(`button`,{type:`button`,"aria-label":t?`Turn camera off`:`Turn camera on`,"aria-pressed":t,disabled:i,onClick:s,style:{...Cq,cursor:i?`default`:`pointer`},children:t?(0,H.jsx)(xq,{disabled:i}):(0,H.jsx)(Sq,{disabled:i})})}function Tq(e){let{className:t,style:n}=e;return(0,H.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,width:`30px`,height:`30px`,viewBox:`0 0 24 24`,className:t,style:n,xmlns:`http://www.w3.org/2000/svg`,children:(0,H.jsx)(`path`,{strokeWidth:.2,stroke:`yellow`,fill:`yellow`,d:`M14.516 15.158l.714.714-4.595 6.14-.75-.364L12.337 13H6.978L8.22 8.861l.803.803L8.322 12h3.036l1.793 1.792-1.475 5.16zm5.984 4.05L4.793 3.5l.707-.707 3.492 3.492L10.278 2h7.972l-5.025 7h7.149l-3.71 4.957 4.543 4.543zM12.707 10l3.243 3.243L18.376 10zM9.795 7.088l2.079 2.079L16.3 3h-5.278z`})})}function Eq(e){let{className:t,style:n}=e;return(0,H.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,width:`30px`,height:`30px`,viewBox:`0 0 24 24`,className:t,style:n,xmlns:`http://www.w3.org/2000/svg`,children:(0,H.jsx)(`path`,{strokeWidth:.2,stroke:`yellow`,fill:`yellow`,d:`M13.225 9l5.025-7h-7.972l-3.3 11h5.359l-2.452 8.648.75.364L20.374 9zm.438 3H8.322l2.7-9H16.3l-5.025 7h7.101l-6.7 8.953z`})})}var Dq={bottom:35,right:8,position:`absolute`,zIndex:2,background:`transparent`,border:0,padding:4,margin:0,cursor:`pointer`,display:`inline-flex`,alignItems:`center`,justifyContent:`center`};function Oq(e){let{status:t,scanning:n,torchToggle:r}=e;return n?(0,H.jsx)(`button`,{type:`button`,"aria-label":t?`Turn flashlight off`:`Turn flashlight on`,"aria-pressed":t,onClick:()=>r(!t),style:Dq,children:t?(0,H.jsx)(Tq,{}):(0,H.jsx)(Eq,{})}):null}function kq(e){let{className:t,disabled:n=!1,style:r}=e;return(0,H.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,width:`30px`,height:`30px`,viewBox:`0 0 24 24`,className:t,style:{stroke:n?`grey`:`yellow`,fill:n?`grey`:`yellow`,...r},xmlns:`http://www.w3.org/2000/svg`,children:(0,H.jsx)(`path`,{strokeWidth:.3,d:`M16.279,17.039c-1.396,1.209 -3.216,1.941 -5.206,1.941c-4.393,0 -7.96,-3.567 -7.96,-7.96c-0,-4.393 3.567,-7.96 7.96,-7.96c4.393,0 7.96,3.567 7.96,7.96c-0,2.044 -0.772,3.909 -2.04,5.319l0.165,0.165c1.194,1.194 2.388,2.388 3.583,3.582c0.455,0.456 -0.252,1.163 -0.707,0.708l-3.755,-3.755Zm1.754,-6.019c-0,-3.841 -3.119,-6.96 -6.96,-6.96c-3.842,0 -6.96,3.119 -6.96,6.96c-0,3.841 3.118,6.96 6.96,6.96c3.841,0 6.96,-3.119 6.96,-6.96Zm-7.46,0.5l-1.5,0c-0.645,0 -0.643,-1 -0,-1l1.5,0l-0,-1.5c-0,-0.645 1,-0.643 1,0l-0,1.5l1.5,0c0.645,0 0.643,1 -0,1l-1.5,0l-0,1.5c-0,0.645 -1,0.643 -1,0l-0,-1.5Z`})})}function Aq(e){let{className:t,disabled:n=!1,style:r}=e;return(0,H.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,width:`30px`,height:`30px`,viewBox:`0 0 24 24`,className:t,style:{stroke:n?`grey`:`yellow`,fill:n?`grey`:`yellow`,...r},xmlns:`http://www.w3.org/2000/svg`,children:(0,H.jsx)(`path`,{strokeWidth:.3,d:`M16.279,17.039c-1.396,1.209 -3.216,1.941 -5.206,1.941c-4.393,0 -7.96,-3.567 -7.96,-7.96c-0,-4.393 3.567,-7.96 7.96,-7.96c4.393,0 7.96,3.567 7.96,7.96c-0,2.044 -0.772,3.909 -2.04,5.319l0.165,0.165c1.194,1.194 2.388,2.388 3.583,3.582c0.455,0.456 -0.252,1.163 -0.707,0.708l-3.755,-3.755Zm1.754,-6.019c-0,-3.841 -3.119,-6.96 -6.96,-6.96c-3.842,0 -6.96,3.119 -6.96,6.96c-0,3.841 3.118,6.96 6.96,6.96c3.841,0 6.96,-3.119 6.96,-6.96Zm-4.96,-0.5c0.645,0 0.643,1 -0,1l-4,0c-0.645,0 -0.643,-1 -0,-1l4,0Z`})})}var jq={bottom:130,right:8,position:`absolute`,zIndex:2,background:`transparent`,border:0,padding:4,margin:0,cursor:`pointer`,display:`inline-flex`,alignItems:`center`,justifyContent:`center`},Mq={...jq,bottom:180};function Nq(e){let{scanning:t,capabilities:n,onZoom:r,value:i}=e;if(!t)return null;let a=n.step>0?n.step:1;function o(){r(Math.min(i+a,n.max))}function s(){r(Math.max(i-a,n.min))}let c=i<=n.min,l=i>=n.max;return(0,H.jsxs)(L.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,"aria-label":`Zoom out`,disabled:c,onClick:s,style:{...jq,cursor:c?`default`:`pointer`},children:(0,H.jsx)(Aq,{disabled:c})}),(0,H.jsx)(`button`,{type:`button`,"aria-label":`Zoom in`,disabled:l,onClick:o,style:{...Mq,cursor:l?`default`:`pointer`},children:(0,H.jsx)(kq,{disabled:l})})]})}var Pq={fullContainer:{width:`100%`,height:`100%`,position:`relative`,display:`flex`,alignItems:`center`,justifyContent:`center`,overflow:`hidden`},innerContainer:{width:`100%`,height:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,position:`relative`},overlay:{position:`absolute`,top:0,right:0,bottom:0,left:0,pointerEvents:`none`,display:`flex`,alignItems:`center`,justifyContent:`center`},borderBox:{position:`relative`,width:`70%`,aspectRatio:`1 / 1`,border:`2px dashed rgba(239, 68, 68, 0.4)`,borderRadius:`0.5rem`},cornerTopLeft:{position:`absolute`,width:`15%`,height:`15%`,border:`4px solid #ef4444`,top:0,left:0,borderBottomColor:`transparent`,borderRightColor:`transparent`,borderTopLeftRadius:`0.5rem`},cornerTopRight:{position:`absolute`,width:`15%`,height:`15%`,border:`4px solid #ef4444`,top:0,right:0,borderBottomColor:`transparent`,borderLeftColor:`transparent`,borderTopRightRadius:`0.5rem`},cornerBottomLeft:{position:`absolute`,width:`15%`,height:`15%`,border:`4px solid #ef4444`,bottom:0,left:0,borderTopColor:`transparent`,borderRightColor:`transparent`,borderBottomLeftRadius:`0.5rem`},cornerBottomRight:{position:`absolute`,width:`15%`,height:`15%`,border:`4px solid #ef4444`,bottom:0,right:0,borderTopColor:`transparent`,borderLeftColor:`transparent`,borderBottomRightRadius:`0.5rem`}};function Fq(e){let{scanning:t,capabilities:n,onOff:r,torch:i,zoom:a,startScanning:o,stopScanning:s}=e;return(0,H.jsx)(`div`,{style:Pq.fullContainer,children:(0,H.jsxs)(`div`,{style:Pq.innerContainer,children:[(0,H.jsx)(`div`,{style:Pq.overlay,children:(0,H.jsxs)(`div`,{style:Pq.borderBox,children:[(0,H.jsx)(`div`,{style:Pq.cornerTopLeft}),(0,H.jsx)(`div`,{style:Pq.cornerTopRight}),(0,H.jsx)(`div`,{style:Pq.cornerBottomLeft}),(0,H.jsx)(`div`,{style:Pq.cornerBottomRight})]})}),r&&(0,H.jsx)(wq,{scanning:t,startScanning:o,stopScanning:s}),i&&n.torch&&(0,H.jsx)(Oq,{scanning:t,status:i.status,torchToggle:i.toggle}),a&&n.zoom&&(0,H.jsx)(Nq,{scanning:t,capabilities:n.zoom,value:a.value,onZoom:a.onChange})]})})}var Iq={position:`absolute`,width:`100%`,height:`100%`},Lq={position:`absolute`,width:`100%`,height:`100%`},Rq={position:`absolute`,width:`100%`,height:`100%`};function zq(e){if(e===null)return;let t=e.getContext(`2d`);t!==null&&t.clearRect(0,0,e.width,e.height)}function Bq(e,t,n,r){if(n===null||t===null)return;if(e.length===0||r===void 0){zq(n);return}let i=t.offsetWidth,a=t.offsetHeight,o=t.videoWidth,s=t.videoHeight;if(o===0||s===0){zq(n);return}let c=Math.max(i/o,a/s),l=o*c,u=s*c,d=l/o,f=u/s,p=(i-l)/2,m=(a-u)/2,h=({x:e,y:t})=>({x:Math.floor(e*d),y:Math.floor(t*f)}),g=({x:e,y:t})=>({x:Math.floor(e+p),y:Math.floor(t+m)}),_=e.map(e=>{let{boundingBox:t,cornerPoints:n}=e,{x:r,y:i}=g(h({x:t.x,y:t.y})),{x:a,y:o}=h({x:t.width,y:t.height});return{...e,cornerPoints:n.map(e=>g(h(e))),boundingBox:DOMRectReadOnly.fromRect({x:r,y:i,width:a,height:o})}});n.width=i,n.height=a;let v=n.getContext(`2d`);v!==null&&r(_,v)}var Vq=(0,L.forwardRef)(function(e,t){let{onScan:n,constraints:r,formats:i=[`any`],paused:a=!1,components:o,tracker:s,children:c,styles:l,classNames:u,allowMultiple:d,scanDelay:f,retryDelay:p,onError:m,sound:h,startTimeoutMs:g,settleDelayMs:_}=e,v=(0,L.useRef)(null),y=(0,L.useRef)(null),b=(0,L.useRef)(null),x=(0,L.useMemo)(()=>{let e={...pq,...r};return r?.deviceId&&delete e.facingMode,e},[r]),S=(0,L.useMemo)(()=>({...fq,...o}),[o]),C=s??S.tracker,[w,T]=(0,L.useState)(!1),[E,D]=(0,L.useState)(!1),[O,ee]=(0,L.useState)(x),te=oq({startTimeoutMs:g,settleDelayMs:_}),k=(0,L.useRef)(te),A=(0,L.useRef)(n),j=(0,L.useRef)(m),M=(0,L.useRef)(C);(0,L.useEffect)(()=>{k.current=te},[te]),(0,L.useEffect)(()=>{A.current=n},[n]),(0,L.useEffect)(()=>{j.current=m},[m]),(0,L.useEffect)(()=>{M.current=C},[C]);let ne=(0,L.useCallback)(e=>{A.current?.(e)},[]),re=(0,L.useCallback)(e=>{j.current?.(e)},[]),{startScanning:ie,stopScanning:ae}=dq({videoElementRef:v,onScan:ne,onFound:(0,L.useCallback)(e=>{Bq(e,v.current,b.current,M.current)},[]),onError:re,formats:i,retryDelay:p??(C===void 0?500:33),scanDelay:f,allowMultiple:d,sound:h});(0,L.useEffect)(()=>(T(!0),()=>{T(!1)}),[]),(0,L.useEffect)(()=>{bq(x,O)||ee(x)},[x,O]);let N=(0,L.useMemo)(()=>({constraints:O,shouldStream:w&&!a}),[O,w,a]),oe=(0,L.useCallback)(async()=>{let e=v.current,t=y.current;if(e===null||t===null)return;let n=t.getContext(`2d`);if(n!==null)try{N.shouldStream?(await k.current.stopCamera(),D(!1),await k.current.startCamera(e,{constraints:N.constraints}),D(!0)):(e.videoWidth>0&&e.videoHeight>0&&(t.width=e.videoWidth,t.height=e.videoHeight,n.drawImage(e,0,0,e.videoWidth,e.videoHeight)),await k.current.stopCamera(),D(!1))}catch(e){D(!1),j.current?.(lq(e))}},[N]);(0,L.useEffect)(()=>{oe()},[oe]);let se=(0,L.useMemo)(()=>N.shouldStream&&E,[N.shouldStream,E]);(0,L.useEffect)(()=>(se&&(zq(y.current),zq(b.current),ie()),()=>{ae()}),[se,ie,ae]),(0,L.useImperativeHandle)(t,()=>({getVideoElement:()=>v.current,getStream:()=>k.current.getStream()}),[]);let ce=(0,L.useMemo)(()=>({...mq.container,...l?.container}),[l?.container]),P=(0,L.useMemo)(()=>({...mq.video,...l?.video,visibility:a?`hidden`:`visible`}),[l?.video,a]),le=(0,L.useMemo)(()=>({...Lq,display:a?`block`:`none`}),[a]);return(0,H.jsxs)(`div`,{style:ce,className:u?.container,children:[(0,H.jsx)(`video`,{ref:v,style:P,className:u?.video,autoPlay:!0,muted:!0,playsInline:!0}),(0,H.jsx)(`canvas`,{ref:y,style:le}),(0,H.jsx)(`canvas`,{ref:b,style:Rq}),(0,H.jsxs)(`div`,{style:Iq,children:[S.finder&&(0,H.jsx)(Fq,{scanning:E,capabilities:te.capabilities,onOff:S.onOff,zoom:S.zoom&&te.settings.zoom?{value:te.settings.zoom,onChange:async e=>{try{await te.updateConstraints({...O,advanced:[{zoom:e}]})}catch(e){j.current?.(lq(e))}}}:void 0,torch:S.torch?{status:te.settings.torch??!1,toggle:async e=>{try{await te.updateConstraints({...O,advanced:[{torch:e}]})}catch(e){j.current?.(lq(e))}}}:void 0,startScanning:async()=>await oe(),stopScanning:async()=>{try{await te.stopCamera(),zq(b.current),D(!1)}catch(e){j.current?.(lq(e))}}}),c]})]})}),Hq=(0,L.memo)(function(){let e=z(SI);return(0,L.useEffect)(()=>{let t,n=!1,r=``,i=null;function a(){r=``,n=!1}function o(){r=``,n=!0,t=window.setTimeout(a,3*1e3)}function s(){t&&=(clearTimeout(t),void 0),n=!1,e({type:`Barcode`,barcode:r,toQueue:null})}function c(e){e.key===`!`?i=Date.now():e.code===`F1`&&!n||e.key===`*`&&!n&&i!==null&&Date.now()-i<1e3?(o(),e.stopPropagation(),e.preventDefault()):n&&e.code===`Enter`?(s(),e.stopPropagation(),e.preventDefault()):n&&e.key&&e.key.length===1&&/[a-zA-Z0-9-|_,;]/.test(e.key)&&(r+=e.key,e.stopPropagation(),e.preventDefault())}return document.addEventListener(`keydown`,c,{capture:!0}),()=>document.removeEventListener(`keydown`,c)},[e]),null}),Uq=(0,L.memo)(function(){let[e,t]=(0,L.useState)(!1),n=z(SI),[r,i]=(0,L.useState)(``);if(window.location.protocol!==`https:`)return null;function a(e){e.length>0&&e[0].rawValue!==null&&e[0].rawValue!==``&&(n({type:`Barcode`,barcode:e[0].rawValue,toQueue:null}),t(!1),i(``))}function o(){r!==``&&n({type:`Barcode`,barcode:r,toQueue:null}),t(!1),i(``)}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(cy,{open:e,onClose:()=>t(!1),children:[(0,H.jsx)(dy,{children:`Scan a QR Code`}),(0,H.jsxs)(uy,{children:[(0,H.jsx)(J,{sx:{width:`15em`,height:`15em`},children:e?(0,H.jsx)(Vq,{onScan:a}):void 0}),(0,H.jsx)(J,{sx:{marginTop:`1em`},children:(0,H.jsx)(Kw,{label:`Manual Entry`,value:r,variant:`outlined`,fullWidth:!0,onKeyDown:e=>{e.key===`Enter`&&o()},onChange:e=>i(e.target.value)})})]}),(0,H.jsxs)(ly,{children:[r===``?void 0:(0,H.jsx)(Y,{onClick:o,children:`Submit`}),(0,H.jsx)(Y,{onClick:()=>t(!1),children:`Cancel`})]})]}),(0,H.jsx)(X,{title:`Scan QR Code`,children:(0,H.jsx)(Um,{onClick:()=>t(!0),size:`large`,children:(0,H.jsx)(fre,{})})})]})}),Wq=P(null),Gq=(0,L.memo)(function(){let[e,t]=B(Wq),[n,r]=(0,L.useState)(``),i=z(SI);function a(n){e!==null&&n.length>0&&n[0].rawValue!==null&&n[0].rawValue!==``&&(i({type:`Barcode`,barcode:n[0].rawValue,toQueue:e}),t(null),r(``))}function o(){n!==``&&e!==null&&i({type:`Barcode`,barcode:n,toQueue:e}),t(null),r(``)}return(0,H.jsxs)(cy,{open:e!==null,onClose:()=>t(null),maxWidth:`md`,children:[(0,H.jsxs)(dy,{children:[`Scan a Barcode To Add To `,e]}),(0,H.jsxs)(uy,{children:[window.location.protocol===`https:`?(0,H.jsx)(J,{sx:{width:`15em`,height:`15em`},children:e===null?void 0:(0,H.jsx)(Vq,{onScan:a})}):void 0,(0,H.jsx)(J,{sx:{marginTop:`1em`},children:(0,H.jsx)(Kw,{label:`Manual Entry`,value:n,variant:`outlined`,fullWidth:!0,onKeyDown:e=>{e.key===`Enter`&&o()},onChange:e=>r(e.target.value)})})]}),(0,H.jsxs)(ly,{children:[n===``?void 0:(0,H.jsx)(Y,{onClick:o,children:`Submit`}),(0,H.jsx)(Y,{onClick:()=>t(null),children:`Cancel`})]})]})});function Kq(e,t,n,r){let i=Q.of(t).flatMap(([e,t])=>Q.ofObject(t.unloaded_processes??{}).map(([n,r])=>({matId:e,proc:parseInt(n),uniq:t.jobUnique}))).toLookupMap(e=>e.uniq,e=>e.proc,()=>1,(e,t)=>e+t),a=new Map;if(r)for(let[e,t]of Q.ofObject(r.jobs)){let n=Q.of(t.procsAndPaths[0]?.paths??[]).collect(e=>e.casting===``?null:e.casting).head();a.set(e,{partName:t.partName,comment:t.comment,routeStartTime:t.routeStartUTC,historicJob:null,inProcJob:t,casting:n??``,scheduledQty:t.cycles??0,decrementedQty:Q.of(t.decrements||[]).sumBy(e=>e.quantity),completedQty:Q.of(t.completed?.[t.completed?.length-1]??[]).sumBy(e=>e),inProcessQty:0,remainingQty:t.remainingToStart??0,darkRow:!1})}for(let[t,r]of n){let n=a.get(t);if(n)n.historicJob=r;else if(!e||r.routeStartUTC>=e.start&&r.routeStartUTC<=e.end){let e=Q.of(r.procsAndPaths[0]?.paths??[]).collect(e=>e.casting===``?null:e.casting).head();a.set(t,{partName:r.partName,comment:r.comment,routeStartTime:r.routeStartUTC,historicJob:r,inProcJob:null,casting:e??``,scheduledQty:r.cycles??0,decrementedQty:Q.of(r.decrements||[]).sumBy(e=>e.quantity),completedQty:i.get(t)?.get(r.procsAndPaths.length)??0,inProcessQty:0,darkRow:!1,remainingQty:0})}}if(r){for(let e of r.material)if(e.jobUnique){let t=a.get(e.jobUnique);t&&(t.inProcessQty+=1)}}let o=Q.of(a.values()).toSortedArray({desc:e=>e.routeStartTime.getTime()},e=>e.partName),s=null,c=!0;for(let e of o)s!=(e.historicJob?.scheduleId??e.inProcJob?.scheduleId??null)&&(c=!c,s=e.historicJob?.scheduleId??e.inProcJob?.scheduleId??null),e.darkRow=c;return o}function qq(e,t){let n=`<table>
|
|
316
316
|
<thead><tr>`;n+=`<th>Date</th>`,n+=`<th>Part</th>`,t&&(n+=`<th>Material</th>`),n+=`<th>Note</th>`,n+=`<th>Scheduled</th>`,n+=`<th>Removed</th>`,n+=`<th>Completed</th>`,n+=`<th>In Process</th>`,n+=`</tr></thead>
|
|
317
317
|
<tbody>
|
|
318
318
|
`;for(let r of e)n+=`<tr><td>`+r.routeStartTime.toString()+`</td>`,n+=`<td>`+r.partName+`</td>`,t&&(n+=`<td>`+(r.casting??r.partName)+`</td>`),n+=`<td>`+(r.comment??``)+`</td>`,n+=`<td>`+r.scheduledQty.toFixed(0)+`</td>`,n+=`<td>`+r.decrementedQty.toFixed(0)+`</td>`,n+=`<td>`+r.completedQty.toFixed(0)+`</td>`,n+=`<td>`+r.inProcessQty.toFixed(0)+`</td>`,n+=`</tr>
|
|
319
319
|
`;return n+=`</tbody>
|
|
320
|
-
</table>`,n}function qq(e,t){Ak(Kq(e,t))}var Jq=SO(`fmsinsight.hide-nonloading-loadstation`,!1);function Yq(e){return`${e.palletNums&&e.palletNums.length>1?`Pallets `+e.palletNums.map(e=>e.toString()).join(`,`):e.palletNums&&e.palletNums.length==1?`Pallet `+e.palletNums[0].toString():`Pallet`}; ${e.stops.map(e=>e.stationGroup+`#`+(e.stationNums??[]).join(`,`)).join(`->`)}`}function Xq(e,t,n){let r=Q.ofObject(e.jobs).filter(([,e])=>e.procsAndPaths[0].paths.some(e=>e.casting===n)).toHashSet(([,e])=>e.partName),i=e.workorders?.find(e=>e.workorderId===t&&(e.part===n||r.has(e.part)));return i?`Started: ${i.material?.length??0}; Planned: ${i.plannedQuantity}`:null}function Zq(e,t,n){let r=t?.workorder;return Q.of(t?.possibleCastingsByQueue?.[n]??[]).map(t=>({casting:t,message:r?Xq(e,r,t):null})).toSortedArray(e=>e.casting)}function Qq(e,t,n,r){return Q.of(n?.possibleJobsByQueue?.[r]??[]).groupBy(e=>e.jobUnique).collect(([n,r])=>{let i=e.jobs[n]??t.get(n);return{jobUnique:n,job:i??null,workorder:Q.of(r).collect(e=>e.workorder).head()??null,machinedProcs:r.map(e=>({lastProc:e.lastCompletedProcess,details:i?.procsAndPaths[e.lastCompletedProcess].paths.map(Yq).join(` | `)??``}))}}).toSortedArray(e=>e.job?.partName??e.jobUnique)}function $q(e){let t=R(sO),n=R(NO),r=R(wI),i=R(CL);return(0,L.useMemo)(()=>r===null||e===null?{castings:[],jobs:[]}:{castings:i.has(e)?Zq(n,r,e):[],jobs:Qq(n,t,r,e)},[n,t,e,r,i])}function eJ(e,t){return t.jobUnique===e&&t.location.type===at.InQueue&&t.action.type!==st.Loading&&t.action.type!==st.LoadingToBasket&&t.process===0}function tJ(e,t){return t.partName===e&&t.location.type===at.InQueue&&t.action.type!==st.Loading&&t.action.type!==st.LoadingToBasket&&t.process===0&&!t.jobUnique}function nJ(e,t,n){return Q.ofObject(e).filter(([,e])=>e.remainingToStart===void 0||e.remainingToStart>0).collect(([,e])=>{let r=(e.procsAndPaths?.[0]?.paths??[]).filter(e=>e.inputQueue===n);if(r.length===0)return null;let i=Q.of(r).collect(e=>e.casting&&e.casting!==``?e.casting:void 0).head()??e.partName;return{job:e,startingTime:Q.of(r).map(e=>e.simulatedStartingUTC).minBy(e=>e),rawMatName:i,remainingToStart:e.remainingToStart??0,assignedRaw:Q.of(t).filter(t=>eJ(e.unique,t)).length(),availableUnassigned:Q.of(t).filter(e=>tJ(i,e)).length()}}).toSortedArray(e=>{let t=Q.of(e.job.precedence?.[0]??[]).minBy(e=>e);return!t||t<0?2**53-1:t})}function rJ(e,t,n,r){let i=[],a=[...e];a.sort((e,t)=>e.localeCompare(t));for(let e of a)if(n.has(e)){let n=eO.empty(),r=new Map;for(let i of t.material)if(i.location.type===at.InQueue&&i.location.currentQueue===e&&i.location.queuePosition!==void 0)if(i.serial&&i.serial!==``||i.action.type!==st.Waiting)n=n.set(i.location.queuePosition,i);else{let e=r.get(i.partName);e||(e=new Map,r.set(i.partName,e));let t=i.jobUnique||null,n=e.get(t);n?n.push(i):e.set(t,[i])}let a=[];for(let[e,t]of r)for(let[n,r]of t)a.push({partOrCasting:e,assignedJobUnique:n,material:r});a.sort((e,t)=>{let n=e.partOrCasting.localeCompare(t.partOrCasting);return n===0?(e.assignedJobUnique||``).localeCompare(t.assignedJobUnique||``):n}),i.push({label:e,free:!1,rawMaterialQueue:!0,inProcQueue:!1,material:[...n.values()],groupedRawMat:a})}else i.push({label:e,free:!1,rawMaterialQueue:!1,inProcQueue:r.has(e),material:Q.of(t.material).filter(t=>t.location.type===at.InQueue&&t.location.currentQueue===e&&t.location.queuePosition!==void 0).toSortedArray(e=>e.location.queuePosition??0)});return i}async function iJ(e){let t=[];for(let n of Q.of(e).chunk(15))t.push(...await Wt.logForMaterials(n.map(e=>e.materialID)));t.sort((e,t)=>e.endUTC.getTime()-t.endUTC.getTime());let n=[];for(let e=0;e<t.length;e++){let r=t[e];if(r.type===V.AddToQueue||r.type===V.RemoveFromQueue){let i=[...r.material];for(;e+1<t.length&&t[e+1].type===r.type&&aE(t[e+1].endUTC,r.endUTC)<10;)i.push(...t[e+1].material),e+=1;i.length===r.material.length?n.push(r):n.push({...r,material:i})}else n.push(t[e])}return n}function aJ(e){return e.toLocaleString(void 0,{month:`short`,day:`numeric`,year:`numeric`,hour:`numeric`,minute:`2-digit`})}function oJ(e){let t=e.job.completed?.[e.procIdx]?.[e.pathIdx];return t===void 0?null:(0,H.jsxs)(`div`,{children:[`Completed: `,t]})}function sJ(e){let t=R(br),n=e=>e.map(e=>ik(e,t.loadStationNames)).join(`, `);return(0,H.jsx)(`div`,{children:(0,H.jsxs)(`dl`,{children:[(0,H.jsx)(`dt`,{children:`Job ID`}),(0,H.jsx)(`dd`,{children:e.job.unique}),(0,H.jsx)(`dt`,{children:`Time`}),(0,H.jsxs)(`dd`,{children:[aJ(e.job.routeStartUTC),` to `,aJ(e.job.routeEndUTC)]}),e.job.cycles?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{children:`Quantity`}),(0,H.jsx)(`dd`,{children:e.job.cycles})]}):void 0,e.job.comment!==void 0&&e.job.comment!==``?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{children:`Comment`}),(0,H.jsx)(`dd`,{children:e.job.comment})]}):void 0,e.job.assignedWorkorders&&e.job.assignedWorkorders.length>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{children:`Workorders`}),(0,H.jsx)(`dd`,{children:e.job.assignedWorkorders.join(`, `)})]}):void 0,e.job.procsAndPaths.map((t,r)=>(0,H.jsx)(L.Fragment,{children:t.paths.map((i,a)=>(0,H.jsxs)(L.Fragment,{children:[(0,H.jsxs)(`dt`,{children:[`Process `,r+1,t.paths.length>1?`, Path `+(a+1).toString():void 0]}),(0,H.jsxs)(`dd`,{children:[(0,H.jsx)(oJ,{job:e.job,procIdx:r,pathIdx:a}),(0,H.jsxs)(`div`,{children:[`Estimated Start: `,aJ(i.simulatedStartingUTC)]}),(0,H.jsxs)(`div`,{children:[`Pallets: `,(i.palletNums??[]).map(e=>e.toString()).join(`,`)]}),i.fixture?(0,H.jsxs)(`div`,{children:[`Fixture: `,i.fixture,` `,i.face===void 0?void 0:`, Face: `+i.face.toString()]}):void 0,i.inputQueue?(0,H.jsxs)(`div`,{children:[`Input Queue: `,i.inputQueue]}):void 0,i.casting?(0,H.jsxs)(`div`,{children:[`Raw Material: `,i.casting]}):void 0,t.basketLoadStations&&t.basketLoadStations.length>0&&t.expectedBasketLoadTime?(0,H.jsxs)(`div`,{children:[`Basket Load Stations: `,n(t.basketLoadStations),` |`,` `,BO(t.expectedBasketLoadTime).toFixed(1),` mins`,i.partsPerPallet>1?` per piece`:``]}):void 0,(0,H.jsxs)(`div`,{children:[`Load Stations: `,n(i.load),` |`,` `,BO(i.expectedLoadTime).toFixed(1),` mins`,i.partsPerPallet>1?` per piece`:``]}),i.stops.map((e,t)=>(0,H.jsx)(L.Fragment,{children:(0,H.jsxs)(`div`,{children:[e.stationGroup,`: `,(e.stationNums??[]).join(`,`),` | Program:`,` `,e.program,e.programRevision?` rev`+e.programRevision.toString():void 0,` `,`|`,` `,(BO(e.expectedCycleTime)/i.partsPerPallet).toFixed(1),` `,`mins`,i.partsPerPallet>1?` per piece`:``]})},t)),(0,H.jsxs)(`div`,{children:[`Unload Stations: `,n(i.unload),` |`,` `,BO(i.expectedUnloadTime).toFixed(1),` mins`,i.partsPerPallet>1?` per piece`:``]}),t.basketUnloadStations&&t.basketUnloadStations.length>0&&t.expectedBasketUnloadTime?(0,H.jsxs)(`div`,{children:[`Basket Unload Stations: `,n(t.basketUnloadStations),` |`,` `,BO(t.expectedBasketUnloadTime).toFixed(1),` mins`,i.partsPerPallet>1?` per piece`:``]}):void 0,i.outputQueue?(0,H.jsxs)(`div`,{children:[`Output Queue: `,i.outputQueue]}):void 0,i.inspections&&i.inspections.length>0?(0,H.jsxs)(`div`,{children:[`Inspections: `,i.inspections.map(e=>e.inspectionType).join(`,`)]}):void 0]})]},a))},r))]})})}function cJ(e){let t=ok(R(br).basketName);return e.inProcMat!==null&&e.inProcMat.location.type===at.OnPallet?(0,H.jsxs)(`span`,{children:[`On pallet `,e.inProcMat.location.palletNum??``]}):e.inProcMat!==null&&e.inProcMat.location.type===at.InQueue?(0,H.jsxs)(`span`,{children:[`In queue `,e.inProcMat.location.currentQueue??``]}):e.inProcMat!==null&&e.inProcMat.location.type===at.InBasket?(0,H.jsxs)(`span`,{children:[`In `,t,` `,e.inProcMat.location.basketId??``]}):e.matSummary?.completed_last_proc_machining?(0,H.jsx)(`span`,{children:`Completed`}):e.matSummary!==null&&!e.matSummary.startedProcess1?(0,H.jsx)(`span`,{children:`Not yet started`}):(0,H.jsx)(`span`,{})}function lJ(e){let t=R(NO).material,n=z(SI),r=Q.of(e.matIdsForJob.get(e.unique)??YD.empty()).collect(t=>e.matsFromEvents.get(t)).toRArray();if(r===null||r.length===0)return(0,H.jsx)(`div`,{});let i=Q.of(t).toHashMap(e=>[e.materialID,e],(e,t)=>e),a=Q.of(r).some(e=>e.workorderId!==void 0&&e.workorderId!==``&&e.workorderId!==e.serial);return(0,H.jsx)(`div`,{children:(0,H.jsxs)(jw,{size:`small`,style:{width:e.fullWidth?`100%`:`auto`},children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[a?(0,H.jsx)(Z,{children:`Workorder`}):void 0,(0,H.jsx)(Z,{children:`Serial`}),(0,H.jsx)(Z,{children:`Status`}),(0,H.jsx)(Z,{padding:`checkbox`})]})}),(0,H.jsx)(Pw,{children:r.map(t=>(0,H.jsxs)(Vw,{children:[a?(0,H.jsx)(Z,{children:t.workorderId??``}):void 0,(0,H.jsx)(Z,{children:t.serial??``}),(0,H.jsx)(Z,{children:(0,H.jsx)(cJ,{matSummary:e.matsFromEvents.get(t.materialID)??null,inProcMat:i.get(t.materialID)??null})}),(0,H.jsx)(Z,{padding:`checkbox`,children:(0,H.jsx)(Um,{onClick:()=>n({type:`MatSummary`,summary:t}),size:`large`,children:(0,H.jsx)(gT,{fontSize:`inherit`})})})]},t.materialID))})]})})}function uJ(e){let t=R(KR),n=R(e.checkAnalysisMonth&&t.type===`SpecificMonth`?mL:fL);return(0,H.jsx)(`div`,{style:{display:`flex`,justifyContent:`space-evenly`},children:e.job===null?void 0:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(sJ,{job:e.job}),(0,H.jsx)(lJ,{unique:e.job.unique,fullWidth:!1,matsFromEvents:n.matsById,matIdsForJob:n.matIdsForJob})]})})}function dJ(e){return typeof e==`object`&&!!e&&`mat`in e}function fJ(e){return typeof e==`number`?e:null}var pJ=(0,L.memo)(function(e){let[t,n]=(0,L.useState)(void 0),[r]=BI(),i=z(RO),a=R(jO),o=(0,L.useMemo)(()=>e.matIds.slice(),[e.matIds]);return(0,H.jsx)(IH,{sensors:PB(NB(zV),NB(PV,{coordinateGetter:kU})),collisionDetection:UB,onDragStart:({active:e})=>n(dJ(e.data.current)?e.data.current.mat:void 0),onDragCancel:()=>n(void 0),onDragEnd:({active:t,over:o})=>{let s=fJ(t.id),c=o?fJ(o.id):null;if(o&&t.id!==o.id&&s!==null&&c!==null){let t=e.matIds.indexOf(c);r({materialId:s,queue:e.queueName,queuePosition:t,operator:a}).catch(console.error),i({queue:e.queueName,matId:s,newIdx:t})}n(void 0)},children:(0,H.jsxs)(_U,{items:o,strategy:e.direction===`vertical`?pU:dU,children:[e.children,(0,H.jsx)(nU,{children:t===void 0?void 0:e.renderDragOverlay(t)})]})})}),mJ=`printWindow`;function hJ(e){let t=document.createElement(`iframe`);return t.width=`${document.documentElement.clientWidth}px`,t.height=`${document.documentElement.clientHeight}px`,t.style.position=`absolute`,t.style.top=`-${document.documentElement.clientHeight+100}px`,t.style.left=`-${document.documentElement.clientWidth+100}px`,t.id=mJ,t.srcdoc=`<!DOCTYPE html>`,e&&(e.allow&&(t.allow=e.allow),e.referrerPolicy!==void 0&&(t.referrerPolicy=e.referrerPolicy),e.sandbox!==void 0&&(t.sandbox=e.sandbox)),t}function gJ({level:e=`error`,messages:t,suppressErrors:n=!1}){n||(e===`error`?console.error(t):e===`warning`?console.warn(t):console.debug(t))}function _J(e,t){if(t||!e){let e=document.getElementById(mJ);e&&document.body.removeChild(e)}}function vJ(e){return e instanceof Error?e:Error(`Unknown Error`)}function yJ(e,t){let{documentTitle:n,onAfterPrint:r,onPrintError:i,preserveAfterPrint:a,print:o,suppressErrors:s}=t;setTimeout(()=>{if(e.contentWindow){let t=function(){r?.(),_J(a)};if(e.contentWindow.focus(),o)o(e).then(t).catch(e=>{i?i(`print`,vJ(e)):gJ({messages:["An error was thrown by the specified `print` function"],suppressErrors:s})});else{if(e.contentWindow.print){let t=e.contentDocument?.title??``,r=e.ownerDocument.title,i=typeof n==`function`?n():n;i&&(e.ownerDocument.title=i,e.contentDocument&&(e.contentDocument.title=i)),e.contentWindow.print(),i&&(e.ownerDocument.title=r,e.contentDocument&&(e.contentDocument.title=t))}else gJ({messages:["Printing for this browser is not currently possible: the browser does not have a `print` method available for iframes."],suppressErrors:s});bJ()?setTimeout(t,500):t()}}else gJ({messages:["Printing failed because the `contentWindow` of the print iframe did not load. This is possibly an error with `react-to-print`. Please file an issue: https://github.com/MatthewHerbst/react-to-print/issues/"],suppressErrors:s})},500)}function bJ(){return[/Android/i,/webOS/i,/iPhone/i,/iPad/i,/iPod/i,/BlackBerry/i,/Windows Phone/i].some(e=>(navigator.userAgent??navigator.vendor??(`opera`in window&&window.opera)).match(e))}function xJ(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,null),r=n.nextNode();for(;r;)t.push(r),r=n.nextNode();return t}function SJ(e,t,n){let r=xJ(e),i=xJ(t);if(r.length!==i.length){gJ({messages:["When cloning shadow root content, source and target elements have different size. `onBeforePrint` likely resolved too early.",e,t],suppressErrors:n});return}for(let e=0;e<r.length;e++){let t=r[e],a=i[e],o=t.shadowRoot;if(o!==null){let e=a.attachShadow({mode:o.mode});e.innerHTML=o.innerHTML,SJ(o,e,n)}}}var CJ=`
|
|
320
|
+
</table>`,n}function Jq(e,t){Ak(qq(e,t))}var Yq=SO(`fmsinsight.hide-nonloading-loadstation`,!1);function Xq(e){return`${e.palletNums&&e.palletNums.length>1?`Pallets `+e.palletNums.map(e=>e.toString()).join(`,`):e.palletNums&&e.palletNums.length==1?`Pallet `+e.palletNums[0].toString():`Pallet`}; ${e.stops.map(e=>e.stationGroup+`#`+(e.stationNums??[]).join(`,`)).join(`->`)}`}function Zq(e,t,n){let r=Q.ofObject(e.jobs).filter(([,e])=>e.procsAndPaths[0].paths.some(e=>e.casting===n)).toHashSet(([,e])=>e.partName),i=e.workorders?.find(e=>e.workorderId===t&&(e.part===n||r.has(e.part)));return i?`Started: ${i.material?.length??0}; Planned: ${i.plannedQuantity}`:null}function Qq(e,t,n){let r=t?.workorder;return Q.of(t?.possibleCastingsByQueue?.[n]??[]).map(t=>({casting:t,message:r?Zq(e,r,t):null})).toSortedArray(e=>e.casting)}function $q(e,t,n,r){return Q.of(n?.possibleJobsByQueue?.[r]??[]).groupBy(e=>e.jobUnique).collect(([n,r])=>{let i=e.jobs[n]??t.get(n);return{jobUnique:n,job:i??null,workorder:Q.of(r).collect(e=>e.workorder).head()??null,machinedProcs:r.map(e=>({lastProc:e.lastCompletedProcess,details:i?.procsAndPaths[e.lastCompletedProcess].paths.map(Xq).join(` | `)??``}))}}).toSortedArray(e=>e.job?.partName??e.jobUnique)}function eJ(e){let t=R(sO),n=R(NO),r=R(wI),i=R(CL);return(0,L.useMemo)(()=>r===null||e===null?{castings:[],jobs:[]}:{castings:i.has(e)?Qq(n,r,e):[],jobs:$q(n,t,r,e)},[n,t,e,r,i])}function tJ(e,t){return t.jobUnique===e&&t.location.type===at.InQueue&&t.action.type!==st.Loading&&t.action.type!==st.LoadingToBasket&&t.process===0}function nJ(e,t){return t.partName===e&&t.location.type===at.InQueue&&t.action.type!==st.Loading&&t.action.type!==st.LoadingToBasket&&t.process===0&&!t.jobUnique}function rJ(e,t,n){return Q.ofObject(e).filter(([,e])=>e.remainingToStart===void 0||e.remainingToStart>0).collect(([,e])=>{let r=(e.procsAndPaths?.[0]?.paths??[]).filter(e=>e.inputQueue===n);if(r.length===0)return null;let i=Q.of(r).collect(e=>e.casting&&e.casting!==``?e.casting:void 0).head()??e.partName;return{job:e,startingTime:Q.of(r).map(e=>e.simulatedStartingUTC).minBy(e=>e),rawMatName:i,remainingToStart:e.remainingToStart??0,assignedRaw:Q.of(t).filter(t=>tJ(e.unique,t)).length(),availableUnassigned:Q.of(t).filter(e=>nJ(i,e)).length()}}).toSortedArray(e=>{let t=Q.of(e.job.precedence?.[0]??[]).minBy(e=>e);return!t||t<0?2**53-1:t})}function iJ(e,t,n,r){let i=[],a=[...e];a.sort((e,t)=>e.localeCompare(t));for(let e of a)if(n.has(e)){let n=eO.empty(),r=new Map;for(let i of t.material)if(i.location.type===at.InQueue&&i.location.currentQueue===e&&i.location.queuePosition!==void 0)if(i.serial&&i.serial!==``||i.action.type!==st.Waiting)n=n.set(i.location.queuePosition,i);else{let e=r.get(i.partName);e||(e=new Map,r.set(i.partName,e));let t=i.jobUnique||null,n=e.get(t);n?n.push(i):e.set(t,[i])}let a=[];for(let[e,t]of r)for(let[n,r]of t)a.push({partOrCasting:e,assignedJobUnique:n,material:r});a.sort((e,t)=>{let n=e.partOrCasting.localeCompare(t.partOrCasting);return n===0?(e.assignedJobUnique||``).localeCompare(t.assignedJobUnique||``):n}),i.push({label:e,free:!1,rawMaterialQueue:!0,inProcQueue:!1,material:[...n.values()],groupedRawMat:a})}else i.push({label:e,free:!1,rawMaterialQueue:!1,inProcQueue:r.has(e),material:Q.of(t.material).filter(t=>t.location.type===at.InQueue&&t.location.currentQueue===e&&t.location.queuePosition!==void 0).toSortedArray(e=>e.location.queuePosition??0)});return i}async function aJ(e){let t=[];for(let n of Q.of(e).chunk(15))t.push(...await Wt.logForMaterials(n.map(e=>e.materialID)));t.sort((e,t)=>e.endUTC.getTime()-t.endUTC.getTime());let n=[];for(let e=0;e<t.length;e++){let r=t[e];if(r.type===V.AddToQueue||r.type===V.RemoveFromQueue){let i=[...r.material];for(;e+1<t.length&&t[e+1].type===r.type&&aE(t[e+1].endUTC,r.endUTC)<10;)i.push(...t[e+1].material),e+=1;i.length===r.material.length?n.push(r):n.push({...r,material:i})}else n.push(t[e])}return n}function oJ(e){return e.toLocaleString(void 0,{month:`short`,day:`numeric`,year:`numeric`,hour:`numeric`,minute:`2-digit`})}function sJ(e){let t=e.job.completed?.[e.procIdx]?.[e.pathIdx];return t===void 0?null:(0,H.jsxs)(`div`,{children:[`Completed: `,t]})}function cJ(e){let t=R(br),n=e=>e.map(e=>ik(e,t.loadStationNames)).join(`, `);return(0,H.jsx)(`div`,{children:(0,H.jsxs)(`dl`,{children:[(0,H.jsx)(`dt`,{children:`Job ID`}),(0,H.jsx)(`dd`,{children:e.job.unique}),(0,H.jsx)(`dt`,{children:`Time`}),(0,H.jsxs)(`dd`,{children:[oJ(e.job.routeStartUTC),` to `,oJ(e.job.routeEndUTC)]}),e.job.cycles?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{children:`Quantity`}),(0,H.jsx)(`dd`,{children:e.job.cycles})]}):void 0,e.job.comment!==void 0&&e.job.comment!==``?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{children:`Comment`}),(0,H.jsx)(`dd`,{children:e.job.comment})]}):void 0,e.job.assignedWorkorders&&e.job.assignedWorkorders.length>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{children:`Workorders`}),(0,H.jsx)(`dd`,{children:e.job.assignedWorkorders.join(`, `)})]}):void 0,e.job.procsAndPaths.map((t,r)=>(0,H.jsx)(L.Fragment,{children:t.paths.map((i,a)=>(0,H.jsxs)(L.Fragment,{children:[(0,H.jsxs)(`dt`,{children:[`Process `,r+1,t.paths.length>1?`, Path `+(a+1).toString():void 0]}),(0,H.jsxs)(`dd`,{children:[(0,H.jsx)(sJ,{job:e.job,procIdx:r,pathIdx:a}),(0,H.jsxs)(`div`,{children:[`Estimated Start: `,oJ(i.simulatedStartingUTC)]}),(0,H.jsxs)(`div`,{children:[`Pallets: `,(i.palletNums??[]).map(e=>e.toString()).join(`,`)]}),i.fixture?(0,H.jsxs)(`div`,{children:[`Fixture: `,i.fixture,` `,i.face===void 0?void 0:`, Face: `+i.face.toString()]}):void 0,i.inputQueue?(0,H.jsxs)(`div`,{children:[`Input Queue: `,i.inputQueue]}):void 0,i.casting?(0,H.jsxs)(`div`,{children:[`Raw Material: `,i.casting]}):void 0,t.basketLoadStations&&t.basketLoadStations.length>0&&t.expectedBasketLoadTime?(0,H.jsxs)(`div`,{children:[`Basket Load Stations: `,n(t.basketLoadStations),` |`,` `,BO(t.expectedBasketLoadTime).toFixed(1),` mins`,i.partsPerPallet>1?` per piece`:``]}):void 0,(0,H.jsxs)(`div`,{children:[`Load Stations: `,n(i.load),` |`,` `,BO(i.expectedLoadTime).toFixed(1),` mins`,i.partsPerPallet>1?` per piece`:``]}),i.stops.map((e,t)=>(0,H.jsx)(L.Fragment,{children:(0,H.jsxs)(`div`,{children:[e.stationGroup,`: `,(e.stationNums??[]).join(`,`),` | Program:`,` `,e.program,e.programRevision?` rev`+e.programRevision.toString():void 0,` `,`|`,` `,(BO(e.expectedCycleTime)/i.partsPerPallet).toFixed(1),` `,`mins`,i.partsPerPallet>1?` per piece`:``]})},t)),(0,H.jsxs)(`div`,{children:[`Unload Stations: `,n(i.unload),` |`,` `,BO(i.expectedUnloadTime).toFixed(1),` mins`,i.partsPerPallet>1?` per piece`:``]}),t.basketUnloadStations&&t.basketUnloadStations.length>0&&t.expectedBasketUnloadTime?(0,H.jsxs)(`div`,{children:[`Basket Unload Stations: `,n(t.basketUnloadStations),` |`,` `,BO(t.expectedBasketUnloadTime).toFixed(1),` mins`,i.partsPerPallet>1?` per piece`:``]}):void 0,i.outputQueue?(0,H.jsxs)(`div`,{children:[`Output Queue: `,i.outputQueue]}):void 0,i.inspections&&i.inspections.length>0?(0,H.jsxs)(`div`,{children:[`Inspections: `,i.inspections.map(e=>e.inspectionType).join(`,`)]}):void 0]})]},a))},r))]})})}function lJ(e){let t=ok(R(br).basketName);return e.inProcMat!==null&&e.inProcMat.location.type===at.OnPallet?(0,H.jsxs)(`span`,{children:[`On pallet `,e.inProcMat.location.palletNum??``]}):e.inProcMat!==null&&e.inProcMat.location.type===at.InQueue?(0,H.jsxs)(`span`,{children:[`In queue `,e.inProcMat.location.currentQueue??``]}):e.inProcMat!==null&&e.inProcMat.location.type===at.InBasket?(0,H.jsxs)(`span`,{children:[`In `,t,` `,e.inProcMat.location.basketId??``]}):e.matSummary?.completed_last_proc_machining?(0,H.jsx)(`span`,{children:`Completed`}):e.matSummary!==null&&!e.matSummary.startedProcess1?(0,H.jsx)(`span`,{children:`Not yet started`}):(0,H.jsx)(`span`,{})}function uJ(e){let t=R(NO).material,n=z(SI),r=Q.of(e.matIdsForJob.get(e.unique)??YD.empty()).collect(t=>e.matsFromEvents.get(t)).toRArray();if(r===null||r.length===0)return(0,H.jsx)(`div`,{});let i=Q.of(t).toHashMap(e=>[e.materialID,e],(e,t)=>e),a=Q.of(r).some(e=>e.workorderId!==void 0&&e.workorderId!==``&&e.workorderId!==e.serial);return(0,H.jsx)(`div`,{children:(0,H.jsxs)(jw,{size:`small`,style:{width:e.fullWidth?`100%`:`auto`},children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[a?(0,H.jsx)(Z,{children:`Workorder`}):void 0,(0,H.jsx)(Z,{children:`Serial`}),(0,H.jsx)(Z,{children:`Status`}),(0,H.jsx)(Z,{padding:`checkbox`})]})}),(0,H.jsx)(Pw,{children:r.map(t=>(0,H.jsxs)(Vw,{children:[a?(0,H.jsx)(Z,{children:t.workorderId??``}):void 0,(0,H.jsx)(Z,{children:t.serial??``}),(0,H.jsx)(Z,{children:(0,H.jsx)(lJ,{matSummary:e.matsFromEvents.get(t.materialID)??null,inProcMat:i.get(t.materialID)??null})}),(0,H.jsx)(Z,{padding:`checkbox`,children:(0,H.jsx)(Um,{onClick:()=>n({type:`MatSummary`,summary:t}),size:`large`,children:(0,H.jsx)(gT,{fontSize:`inherit`})})})]},t.materialID))})]})})}function dJ(e){let t=R(qR),n=R(e.checkAnalysisMonth&&t.type===`SpecificMonth`?mL:fL);return(0,H.jsx)(`div`,{style:{display:`flex`,justifyContent:`space-evenly`},children:e.job===null?void 0:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(cJ,{job:e.job}),(0,H.jsx)(uJ,{unique:e.job.unique,fullWidth:!1,matsFromEvents:n.matsById,matIdsForJob:n.matIdsForJob})]})})}function fJ(e){return typeof e==`object`&&!!e&&`mat`in e}function pJ(e){return typeof e==`number`?e:null}var mJ=(0,L.memo)(function(e){let[t,n]=(0,L.useState)(void 0),[r]=BI(),i=z(RO),a=R(jO),o=(0,L.useMemo)(()=>e.matIds.slice(),[e.matIds]);return(0,H.jsx)(LH,{sensors:FB(PB(BV),PB(FV,{coordinateGetter:AU})),collisionDetection:WB,onDragStart:({active:e})=>n(fJ(e.data.current)?e.data.current.mat:void 0),onDragCancel:()=>n(void 0),onDragEnd:({active:t,over:o})=>{let s=pJ(t.id),c=o?pJ(o.id):null;if(o&&t.id!==o.id&&s!==null&&c!==null){let t=e.matIds.indexOf(c);r({materialId:s,queue:e.queueName,queuePosition:t,operator:a}).catch(console.error),i({queue:e.queueName,matId:s,newIdx:t})}n(void 0)},children:(0,H.jsxs)(vU,{items:o,strategy:e.direction===`vertical`?mU:fU,children:[e.children,(0,H.jsx)(rU,{children:t===void 0?void 0:e.renderDragOverlay(t)})]})})}),hJ=`printWindow`;function gJ(e){let t=document.createElement(`iframe`);return t.width=`${document.documentElement.clientWidth}px`,t.height=`${document.documentElement.clientHeight}px`,t.style.position=`absolute`,t.style.top=`-${document.documentElement.clientHeight+100}px`,t.style.left=`-${document.documentElement.clientWidth+100}px`,t.id=hJ,t.srcdoc=`<!DOCTYPE html>`,e&&(e.allow&&(t.allow=e.allow),e.referrerPolicy!==void 0&&(t.referrerPolicy=e.referrerPolicy),e.sandbox!==void 0&&(t.sandbox=e.sandbox)),t}function _J({level:e=`error`,messages:t,suppressErrors:n=!1}){n||(e===`error`?console.error(t):e===`warning`?console.warn(t):console.debug(t))}function vJ(e,t){if(t||!e){let e=document.getElementById(hJ);e&&document.body.removeChild(e)}}function yJ(e){return e instanceof Error?e:Error(`Unknown Error`)}function bJ(e,t){let{documentTitle:n,onAfterPrint:r,onPrintError:i,preserveAfterPrint:a,print:o,suppressErrors:s}=t;setTimeout(()=>{if(e.contentWindow){let t=function(){r?.(),vJ(a)};if(e.contentWindow.focus(),o)o(e).then(t).catch(e=>{i?i(`print`,yJ(e)):_J({messages:["An error was thrown by the specified `print` function"],suppressErrors:s})});else{if(e.contentWindow.print){let t=e.contentDocument?.title??``,r=e.ownerDocument.title,i=typeof n==`function`?n():n;i&&(e.ownerDocument.title=i,e.contentDocument&&(e.contentDocument.title=i)),e.contentWindow.print(),i&&(e.ownerDocument.title=r,e.contentDocument&&(e.contentDocument.title=t))}else _J({messages:["Printing for this browser is not currently possible: the browser does not have a `print` method available for iframes."],suppressErrors:s});xJ()?setTimeout(t,500):t()}}else _J({messages:["Printing failed because the `contentWindow` of the print iframe did not load. This is possibly an error with `react-to-print`. Please file an issue: https://github.com/MatthewHerbst/react-to-print/issues/"],suppressErrors:s})},500)}function xJ(){return[/Android/i,/webOS/i,/iPhone/i,/iPad/i,/iPod/i,/BlackBerry/i,/Windows Phone/i].some(e=>(navigator.userAgent??navigator.vendor??(`opera`in window&&window.opera)).match(e))}function SJ(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,null),r=n.nextNode();for(;r;)t.push(r),r=n.nextNode();return t}function CJ(e,t,n){let r=SJ(e),i=SJ(t);if(r.length!==i.length){_J({messages:["When cloning shadow root content, source and target elements have different size. `onBeforePrint` likely resolved too early.",e,t],suppressErrors:n});return}for(let e=0;e<r.length;e++){let t=r[e],a=i[e],o=t.shadowRoot;if(o!==null){let e=a.attachShadow({mode:o.mode});e.innerHTML=o.innerHTML,CJ(o,e,n)}}}var wJ=`
|
|
321
321
|
@page {
|
|
322
322
|
/* Remove browser default header (title) and footer (url) */
|
|
323
323
|
margin: 0;
|
|
@@ -330,59 +330,59 @@ a=extmap-allow-mixed`)!==-1){let n=t.sdp.split(`
|
|
|
330
330
|
-webkit-print-color-adjust: exact; /* Chrome/Safari/Edge/Opera */
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
|
-
`;function
|
|
334
|
-
`)}catch(e){gJ({messages:["A stylesheet could not be accessed. This is likely due to the stylesheet having cross-origin imports, and many browsers block script access to cross-origin stylesheets. See https://github.com/MatthewHerbst/react-to-print/issues/429 for details. You may be able to load the sheet by both marking the stylesheet with the cross `crossorigin` attribute, and setting the `Access-Control-Allow-Origin` header on the server serving the stylesheet. Alternatively, host the stylesheet on your domain to avoid this issue entirely.",n,`Original error: ${vJ(e).message}`],level:`warning`})}e.setAttribute(`id`,`react-to-print-${t}`),p&&e.setAttribute(`nonce`,p),e.appendChild(y.createTextNode(i)),y.head.appendChild(e)}}else if(n.getAttribute(`href`))if(n.hasAttribute(`disabled`))gJ({messages:["`react-to-print` encountered a <link> tag with a `disabled` attribute and will ignore it. Note that the `disabled` attribute is deprecated, and some browsers ignore it. You should stop using it. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-disabled. The <link> is:",n],level:`warning`}),v(n);else{let e=y.createElement(n.tagName);for(let t=0,r=n.attributes.length;t<r;++t){let r=n.attributes[t];r&&e.setAttribute(r.nodeName,r.nodeValue??``)}e.onload=()=>{v(e)},e.onerror=(t,n,r,i,a)=>{v(e,[`Failed to load`,e,`Error:`,a])},p&&e.setAttribute(`nonce`,p),y.head.appendChild(e)}else gJ({messages:["`react-to-print` encountered a <link> tag with an empty `href` attribute. In addition to being invalid HTML, this can cause problems in many browsers, and so the <link> was not loaded. The <link> is:",n],level:`warning`}),v(n)}}}s===0&&yJ(e,n)}function TJ(e,t,n){e.onload=()=>{wJ(e,t,n)},document.body.appendChild(e)}function EJ({contentRef:e,optionalContent:t,suppressErrors:n}){if(t&&typeof t==`function`)return e&&gJ({level:`warning`,messages:['"react-to-print" received a `contentRef` option and an optional-content param passed to its callback. The `contentRef` option will be ignored.']}),t();if(e)return e.current;gJ({messages:['"react-to-print" did not receive a `contentRef` option or a optional-content param pass to its callback.'],suppressErrors:n})}function DJ(e,t){let{contentRef:n,fonts:r,ignoreGlobalStyles:i,suppressErrors:a}=t,o=EJ({contentRef:n,optionalContent:e,suppressErrors:a});if(!o)return;let s=o.cloneNode(!0),c=document.querySelectorAll(`link[rel~='stylesheet'], link[as='style']`),l=s.querySelectorAll(`img`),u=s.querySelectorAll(`video`),d=r?r.length:0;return{contentNode:o,clonedContentNode:s,clonedImgNodes:l,clonedVideoNodes:u,numResourcesToLoad:(i?0:c.length)+l.length+u.length+d,originalCanvasNodes:o.querySelectorAll(`canvas`)}}function OJ({bodyClass:e,contentRef:t,copyShadowRoots:n,documentTitle:r,fonts:i,ignoreGlobalStyles:a,nonce:o,onAfterPrint:s,onBeforePrint:c,onPrintError:l,pageStyle:u,preserveAfterPrint:d,print:f,printIframeProps:p,suppressErrors:m}){return(0,L.useCallback)(h=>{_J(d,!0);function g(){let c={bodyClass:e,contentRef:t,copyShadowRoots:n,documentTitle:r,fonts:i,ignoreGlobalStyles:a,nonce:o,onAfterPrint:s,onPrintError:l,pageStyle:u,preserveAfterPrint:d,print:f,suppressErrors:m},g=hJ(p),_=DJ(h,c);if(!_){gJ({messages:[`There is nothing to print`],suppressErrors:m});return}TJ(g,_,c)}c?c().then(()=>{g()}).catch(e=>{l?.(`onBeforePrint`,vJ(e))}):g()},[e,t,n,r,i,a,o,s,c,l,u,d,p,f,m])}var kJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}e.default=function e(n,r){t(this,e),this.data=n,this.text=r.text||n,this.options=r}})),AJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CODE39=void 0;var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=r(kJ());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(e){o(n,e);function n(e,t){return i(this,n),e=e.toUpperCase(),t.mod43&&(e+=f(m(e))),a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,t))}return t(n,[{key:`encode`,value:function(){for(var e=u(`*`),t=0;t<this.data.length;t++)e+=u(this.data[t])+`0`;return e+=u(`*`),{data:e,text:this.text}}},{key:`valid`,value:function(){return this.data.search(/^[0-9A-Z\-\.\ \$\/\+\%]+$/)!==-1}}]),n}(n.default),c=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%*`.split(``),l=[20957,29783,23639,30485,20951,29813,23669,20855,29789,23645,29975,23831,30533,22295,30149,24005,21623,29981,23837,22301,30023,23879,30545,22343,30161,24017,21959,30065,23921,22385,29015,18263,29141,17879,29045,18293,17783,29021,18269,17477,17489,17681,20753,35770];function u(e){return d(p(e))}function d(e){return l[e].toString(2)}function f(e){return c[e]}function p(e){return c.indexOf(e)}function m(e){for(var t=0,n=0;n<e.length;n++)t+=p(e[n]);return t%=43,t}e.CODE39=s})),jJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t;function n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var r=e.SET_A=0,i=e.SET_B=1,a=e.SET_C=2;e.SHIFT=98;var o=e.START_A=103,s=e.START_B=104,c=e.START_C=105;e.MODULO=103,e.STOP=106,e.FNC1=207,e.SET_BY_CODE=(t={},n(t,o,r),n(t,s,i),n(t,c,a),t),e.SWAP={101:r,100:i,99:a},e.A_START_CHAR=`Ð`,e.B_START_CHAR=`Ñ`,e.C_START_CHAR=`Ò`,e.A_CHARS=`[\0-_È-Ï]`,e.B_CHARS=`[ -È-Ï]`,e.C_CHARS=`(Ï*[0-9]{2}Ï*)`,e.BARS=[11011001100,11001101100,11001100110,10010011e3,10010001100,10001001100,10011001e3,10011000100,10001100100,11001001e3,11001000100,11000100100,10110011100,10011011100,10011001110,10111001100,10011101100,10011100110,11001110010,11001011100,11001001110,11011100100,11001110100,11101101110,11101001100,11100101100,11100100110,11101100100,11100110100,11100110010,11011011e3,11011000110,11000110110,10100011e3,10001011e3,10001000110,10110001e3,10001101e3,10001100010,11010001e3,11000101e3,11000100010,10110111e3,10110001110,10001101110,10111011e3,10111000110,10001110110,11101110110,11010001110,11000101110,11011101e3,11011100010,11011101110,11101011e3,11101000110,11100010110,11101101e3,11101100010,11100011010,11101111010,11001000010,11110001010,1010011e4,10100001100,1001011e4,10010000110,10000101100,10000100110,1011001e4,10110000100,1001101e4,10011000010,10000110100,10000110010,11000010010,1100101e4,11110111010,11000010100,10001111010,10100111100,10010111100,10010011110,10111100100,10011110100,10011110010,11110100100,11110010100,11110010010,11011011110,11011110110,11110110110,10101111e3,10100011110,10001011110,10111101e3,10111100010,11110101e3,11110100010,10111011110,10111101110,11101011110,11110101110,11010000100,1101001e4,11010011100,1100011101011]})),MJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=i(kJ()),r=jJ();function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function o(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function s(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){s(n,e);function n(e,t){a(this,n);var r=o(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.substring(1),t));return r.bytes=e.split(``).map(function(e){return e.charCodeAt(0)}),r}return t(n,[{key:`valid`,value:function(){return/^[\x00-\x7F\xC8-\xD3]+$/.test(this.data)}},{key:`encode`,value:function(){var e=this.bytes,t=e.shift()-105,i=r.SET_BY_CODE[t];if(i===void 0)throw RangeError(`The encoding does not start with a start character.`);this.shouldEncodeAsEan128()===!0&&e.unshift(r.FNC1);var a=n.next(e,1,i);return{text:this.text===this.data?this.text.replace(/[^\x20-\x7E]/g,``):this.text,data:n.getBar(t)+a.result+n.getBar((a.checksum+t)%r.MODULO)+n.getBar(r.STOP)}}},{key:`shouldEncodeAsEan128`,value:function(){var e=this.options.ean128||!1;return typeof e==`string`&&(e=e.toLowerCase()===`true`),e}}],[{key:`getBar`,value:function(e){return r.BARS[e]?r.BARS[e].toString():``}},{key:`correctIndex`,value:function(e,t){if(t===r.SET_A){var n=e.shift();return n<32?n+64:n-32}else if(t===r.SET_B)return e.shift()-32;else return(e.shift()-48)*10+e.shift()-48}},{key:`next`,value:function(e,t,i){if(!e.length)return{result:``,checksum:0};var a=void 0,o=void 0;if(e[0]>=200){o=e.shift()-105;var s=r.SWAP[o];s===void 0?((i===r.SET_A||i===r.SET_B)&&o===r.SHIFT&&(e[0]=i===r.SET_A?e[0]>95?e[0]-96:e[0]:e[0]<32?e[0]+96:e[0]),a=n.next(e,t+1,i)):a=n.next(e,t+1,s)}else o=n.correctIndex(e,i),a=n.next(e,t+1,i);var c=n.getBar(o),l=o*t;return{result:c+a.result,checksum:l+a.checksum}}}]),n}(n.default)})),NJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=jJ(),n=function(e){return e.match(RegExp(`^`+t.A_CHARS+`*`))[0].length},r=function(e){return e.match(RegExp(`^`+t.B_CHARS+`*`))[0].length},i=function(e){return e.match(RegExp(`^`+t.C_CHARS+`*`))[0]};function a(e,n){var r=n?t.A_CHARS:t.B_CHARS,i=e.match(RegExp(`^(`+r+`+?)(([0-9]{2}){2,})([^0-9]|$)`));if(i)return i[1]+`Ì`+o(e.substring(i[1].length));var s=e.match(RegExp(`^`+r+`+`))[0];return s.length===e.length?e:s+String.fromCharCode(n?205:206)+a(e.substring(s.length),!n)}function o(e){var t=i(e),o=t.length;if(o===e.length)return e;e=e.substring(o);var s=n(e)>=r(e);return t+String.fromCharCode(s?206:205)+a(e,s)}e.default=function(e){var s=void 0;if(i(e).length>=2)s=t.C_START_CHAR+o(e);else{var c=n(e)>r(e);s=(c?t.A_START_CHAR:t.B_START_CHAR)+a(e,c)}return s.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,function(e,t){return`Ë`+t})}})),PJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=r(MJ()),n=r(NJ());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){o(t,e);function t(e,r){if(i(this,t),/^[\x00-\x7F\xC8-\xD3]+$/.test(e))var o=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,(0,n.default)(e),r));else var o=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));return a(o)}return t}(t.default)})),FJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=i(MJ()),r=jJ();function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function o(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function s(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){s(n,e);function n(e,t){return a(this,n),o(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,r.A_START_CHAR+e,t))}return t(n,[{key:`valid`,value:function(){return RegExp(`^`+r.A_CHARS+`+$`).test(this.data)}}]),n}(n.default)})),IJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=i(MJ()),r=jJ();function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function o(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function s(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){s(n,e);function n(e,t){return a(this,n),o(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,r.B_START_CHAR+e,t))}return t(n,[{key:`valid`,value:function(){return RegExp(`^`+r.B_CHARS+`+$`).test(this.data)}}]),n}(n.default)})),LJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=i(MJ()),r=jJ();function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function o(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function s(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){s(n,e);function n(e,t){return a(this,n),o(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,r.C_START_CHAR+e,t))}return t(n,[{key:`valid`,value:function(){return RegExp(`^`+r.C_CHARS+`+$`).test(this.data)}}]),n}(n.default)})),RJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CODE128C=e.CODE128B=e.CODE128A=e.CODE128=void 0;var t=a(PJ()),n=a(FJ()),r=a(IJ()),i=a(LJ());function a(e){return e&&e.__esModule?e:{default:e}}e.CODE128=t.default,e.CODE128A=n.default,e.CODE128B=r.default,e.CODE128C=i.default})),zJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SIDE_BIN=`101`,e.MIDDLE_BIN=`01010`,e.BINARIES={L:[`0001101`,`0011001`,`0010011`,`0111101`,`0100011`,`0110001`,`0101111`,`0111011`,`0110111`,`0001011`],G:[`0100111`,`0110011`,`0011011`,`0100001`,`0011101`,`0111001`,`0000101`,`0010001`,`0001001`,`0010111`],R:[`1110010`,`1100110`,`1101100`,`1000010`,`1011100`,`1001110`,`1010000`,`1000100`,`1001000`,`1110100`],O:[`0001101`,`0011001`,`0010011`,`0111101`,`0100011`,`0110001`,`0101111`,`0111011`,`0110111`,`0001011`],E:[`0100111`,`0110011`,`0011011`,`0100001`,`0011101`,`0111001`,`0000101`,`0010001`,`0001001`,`0010111`]},e.EAN2_STRUCTURE=[`LL`,`LG`,`GL`,`GG`],e.EAN5_STRUCTURE=[`GGLLL`,`GLGLL`,`GLLGL`,`GLLLG`,`LGGLL`,`LLGGL`,`LLLGG`,`LGLGL`,`LGLLG`,`LLGLG`],e.EAN13_STRUCTURE=[`LLLLLL`,`LLGLGG`,`LLGGLG`,`LLGGGL`,`LGLLGG`,`LGGLLG`,`LGGGLL`,`LGLGLG`,`LGLGGL`,`LGGLGL`]})),BJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=zJ();e.default=function(e,n,r){var i=e.split(``).map(function(e,r){return t.BINARIES[n[r]]}).map(function(t,n){return t?t[e[n]]:``});if(r){var a=e.length-1;i=i.map(function(e,t){return t<a?e+r:e})}return i.join(``)}})),VJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=zJ(),r=a(BJ()),i=a(kJ());function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function s(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function c(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){c(i,e);function i(e,t){o(this,i);var n=s(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e,t));return n.fontSize=!t.flat&&t.fontSize>t.width*10?t.width*10:t.fontSize,n.guardHeight=t.height+n.fontSize/2+t.textMargin,n}return t(i,[{key:`encode`,value:function(){return this.options.flat?this.encodeFlat():this.encodeGuarded()}},{key:`leftText`,value:function(e,t){return this.text.substr(e,t)}},{key:`leftEncode`,value:function(e,t){return(0,r.default)(e,t)}},{key:`rightText`,value:function(e,t){return this.text.substr(e,t)}},{key:`rightEncode`,value:function(e,t){return(0,r.default)(e,t)}},{key:`encodeGuarded`,value:function(){var e={fontSize:this.fontSize},t={height:this.guardHeight};return[{data:n.SIDE_BIN,options:t},{data:this.leftEncode(),text:this.leftText(),options:e},{data:n.MIDDLE_BIN,options:t},{data:this.rightEncode(),text:this.rightText(),options:e},{data:n.SIDE_BIN,options:t}]}},{key:`encodeFlat`,value:function(){return{data:[n.SIDE_BIN,this.leftEncode(),n.MIDDLE_BIN,this.rightEncode(),n.SIDE_BIN].join(``),text:this.text}}}]),i}(i.default)})),HJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=function e(t,n,r){t===null&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(i===void 0){var a=Object.getPrototypeOf(t);return a===null?void 0:e(a,n,r)}else if(`value`in i)return i.value;else{var o=i.get;return o===void 0?void 0:o.call(r)}},r=zJ(),i=a(VJ());function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function s(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function c(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l=function(e){return(10-e.substr(0,12).split(``).map(function(e){return+e}).reduce(function(e,t,n){return n%2?e+t*3:e+t},0)%10)%10};e.default=function(e){c(i,e);function i(e,t){o(this,i),e.search(/^[0-9]{12}$/)!==-1&&(e+=l(e));var n=s(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e,t));return n.lastChar=t.lastChar,n}return t(i,[{key:`valid`,value:function(){return this.data.search(/^[0-9]{13}$/)!==-1&&+this.data[12]===l(this.data)}},{key:`leftText`,value:function(){return n(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),`leftText`,this).call(this,1,6)}},{key:`leftEncode`,value:function(){var e=this.data.substr(1,6),t=r.EAN13_STRUCTURE[this.data[0]];return n(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),`leftEncode`,this).call(this,e,t)}},{key:`rightText`,value:function(){return n(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),`rightText`,this).call(this,7,6)}},{key:`rightEncode`,value:function(){var e=this.data.substr(7,6);return n(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),`rightEncode`,this).call(this,e,`RRRRRR`)}},{key:`encodeGuarded`,value:function(){var e=n(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),`encodeGuarded`,this).call(this);return this.options.displayValue&&(e.unshift({data:`000000000000`,text:this.text.substr(0,1),options:{textAlign:`left`,fontSize:this.fontSize}}),this.options.lastChar&&(e.push({data:`00`}),e.push({data:`00000`,text:this.options.lastChar,options:{fontSize:this.fontSize}}))),e}}]),i}(i.default)})),UJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=function e(t,n,r){t===null&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(i===void 0){var a=Object.getPrototypeOf(t);return a===null?void 0:e(a,n,r)}else if(`value`in i)return i.value;else{var o=i.get;return o===void 0?void 0:o.call(r)}},r=i(VJ());function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function o(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function s(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var c=function(e){return(10-e.substr(0,7).split(``).map(function(e){return+e}).reduce(function(e,t,n){return n%2?e+t:e+t*3},0)%10)%10};e.default=function(e){s(r,e);function r(e,t){return a(this,r),e.search(/^[0-9]{7}$/)!==-1&&(e+=c(e)),o(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,e,t))}return t(r,[{key:`valid`,value:function(){return this.data.search(/^[0-9]{8}$/)!==-1&&+this.data[7]===c(this.data)}},{key:`leftText`,value:function(){return n(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),`leftText`,this).call(this,0,4)}},{key:`leftEncode`,value:function(){var e=this.data.substr(0,4);return n(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),`leftEncode`,this).call(this,e,`LLLL`)}},{key:`rightText`,value:function(){return n(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),`rightText`,this).call(this,4,4)}},{key:`rightEncode`,value:function(){var e=this.data.substr(4,4);return n(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),`rightEncode`,this).call(this,e,`RRRR`)}}]),r}(r.default)})),WJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=zJ(),r=a(BJ()),i=a(kJ());function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function s(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function c(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l=function(e){return e.split(``).map(function(e){return+e}).reduce(function(e,t,n){return n%2?e+t*9:e+t*3},0)%10};e.default=function(e){c(i,e);function i(e,t){return o(this,i),s(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e,t))}return t(i,[{key:`valid`,value:function(){return this.data.search(/^[0-9]{5}$/)!==-1}},{key:`encode`,value:function(){var e=n.EAN5_STRUCTURE[l(this.data)];return{data:`1011`+(0,r.default)(this.data,e,`01`),text:this.text}}}]),i}(i.default)})),GJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=zJ(),r=a(BJ()),i=a(kJ());function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function s(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function c(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){c(i,e);function i(e,t){return o(this,i),s(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e,t))}return t(i,[{key:`valid`,value:function(){return this.data.search(/^[0-9]{2}$/)!==-1}},{key:`encode`,value:function(){var e=n.EAN2_STRUCTURE[parseInt(this.data)%4];return{data:`1011`+(0,r.default)(this.data,e,`01`),text:this.text}}}]),i}(i.default)})),KJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();e.checksum=l;var n=i(BJ()),r=i(kJ());function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function o(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function s(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var c=function(e){s(r,e);function r(e,t){a(this,r),e.search(/^[0-9]{11}$/)!==-1&&(e+=l(e));var n=o(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,e,t));return n.displayValue=t.displayValue,t.fontSize>t.width*10?n.fontSize=t.width*10:n.fontSize=t.fontSize,n.guardHeight=t.height+n.fontSize/2+t.textMargin,n}return t(r,[{key:`valid`,value:function(){return this.data.search(/^[0-9]{12}$/)!==-1&&this.data[11]==l(this.data)}},{key:`encode`,value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:`flatEncoding`,value:function(){var e=``;return e+=`101`,e+=(0,n.default)(this.data.substr(0,6),`LLLLLL`),e+=`01010`,e+=(0,n.default)(this.data.substr(6,6),`RRRRRR`),e+=`101`,{data:e,text:this.text}}},{key:`guardedEncoding`,value:function(){var e=[];return this.displayValue&&e.push({data:`00000000`,text:this.text.substr(0,1),options:{textAlign:`left`,fontSize:this.fontSize}}),e.push({data:`101`+(0,n.default)(this.data[0],`L`),options:{height:this.guardHeight}}),e.push({data:(0,n.default)(this.data.substr(1,5),`LLLLL`),text:this.text.substr(1,5),options:{fontSize:this.fontSize}}),e.push({data:`01010`,options:{height:this.guardHeight}}),e.push({data:(0,n.default)(this.data.substr(6,5),`RRRRR`),text:this.text.substr(6,5),options:{fontSize:this.fontSize}}),e.push({data:(0,n.default)(this.data[11],`R`)+`101`,options:{height:this.guardHeight}}),this.displayValue&&e.push({data:`00000000`,text:this.text.substr(11,1),options:{textAlign:`right`,fontSize:this.fontSize}}),e}}]),r}(r.default);function l(e){var t=0,n;for(n=1;n<11;n+=2)t+=parseInt(e[n]);for(n=0;n<11;n+=2)t+=parseInt(e[n])*3;return(10-t%10)%10}e.default=c})),qJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=a(BJ()),r=a(kJ()),i=KJ();function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function s(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function c(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l=[`XX00000XXX`,`XX10000XXX`,`XX20000XXX`,`XXX00000XX`,`XXXX00000X`,`XXXXX00005`,`XXXXX00006`,`XXXXX00007`,`XXXXX00008`,`XXXXX00009`],u=[[`EEEOOO`,`OOOEEE`],[`EEOEOO`,`OOEOEE`],[`EEOOEO`,`OOEEOE`],[`EEOOOE`,`OOEEEO`],[`EOEEOO`,`OEOOEE`],[`EOOEEO`,`OEEOOE`],[`EOOOEE`,`OEEEOO`],[`EOEOEO`,`OEOEOE`],[`EOEOOE`,`OEOEEO`],[`EOOEOE`,`OEEOEO`]],d=function(e){c(r,e);function r(e,t){o(this,r);var n=s(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,e,t));if(n.isValid=!1,e.search(/^[0-9]{6}$/)!==-1)n.middleDigits=e,n.upcA=f(e,`0`),n.text=t.text||``+n.upcA[0]+e+n.upcA[n.upcA.length-1],n.isValid=!0;else if(e.search(/^[01][0-9]{7}$/)!==-1)if(n.middleDigits=e.substring(1,e.length-1),n.upcA=f(n.middleDigits,e[0]),n.upcA[n.upcA.length-1]===e[e.length-1])n.isValid=!0;else return s(n);else return s(n);return n.displayValue=t.displayValue,t.fontSize>t.width*10?n.fontSize=t.width*10:n.fontSize=t.fontSize,n.guardHeight=t.height+n.fontSize/2+t.textMargin,n}return t(r,[{key:`valid`,value:function(){return this.isValid}},{key:`encode`,value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:`flatEncoding`,value:function(){var e=``;return e+=`101`,e+=this.encodeMiddleDigits(),e+=`010101`,{data:e,text:this.text}}},{key:`guardedEncoding`,value:function(){var e=[];return this.displayValue&&e.push({data:`00000000`,text:this.text[0],options:{textAlign:`left`,fontSize:this.fontSize}}),e.push({data:`101`,options:{height:this.guardHeight}}),e.push({data:this.encodeMiddleDigits(),text:this.text.substring(1,7),options:{fontSize:this.fontSize}}),e.push({data:`010101`,options:{height:this.guardHeight}}),this.displayValue&&e.push({data:`00000000`,text:this.text[7],options:{textAlign:`right`,fontSize:this.fontSize}}),e}},{key:`encodeMiddleDigits`,value:function(){var e=this.upcA[0],t=this.upcA[this.upcA.length-1],r=u[parseInt(t)][parseInt(e)];return(0,n.default)(this.middleDigits,r)}}]),r}(r.default);function f(e,t){for(var n=l[parseInt(e[e.length-1])],r=``,a=0,o=0;o<n.length;o++){var s=n[o];s===`X`?r+=e[a++]:r+=s}return r=``+t+r,``+r+(0,i.checksum)(r)}e.default=d})),JJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.UPCE=e.UPC=e.EAN2=e.EAN5=e.EAN8=e.EAN13=void 0;var t=s(HJ()),n=s(UJ()),r=s(WJ()),i=s(GJ()),a=s(KJ()),o=s(qJ());function s(e){return e&&e.__esModule?e:{default:e}}e.EAN13=t.default,e.EAN8=n.default,e.EAN5=r.default,e.EAN2=i.default,e.UPC=a.default,e.UPCE=o.default})),YJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.START_BIN=`1010`,e.END_BIN=`11101`,e.BINARIES=[`00110`,`10001`,`01001`,`11000`,`00101`,`10100`,`01100`,`00011`,`10010`,`01010`]})),XJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=YJ(),r=i(kJ());function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function o(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function s(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){s(r,e);function r(){return a(this,r),o(this,(r.__proto__||Object.getPrototypeOf(r)).apply(this,arguments))}return t(r,[{key:`valid`,value:function(){return this.data.search(/^([0-9]{2})+$/)!==-1}},{key:`encode`,value:function(){var e=this,t=this.data.match(/.{2}/g).map(function(t){return e.encodePair(t)}).join(``);return{data:n.START_BIN+t+n.END_BIN,text:this.text}}},{key:`encodePair`,value:function(e){var t=n.BINARIES[e[1]];return n.BINARIES[e[0]].split(``).map(function(e,n){return(e===`1`?`111`:`1`)+(t[n]===`1`?`000`:`0`)}).join(``)}}]),r}(r.default)})),ZJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=r(XJ());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(e){var t=e.substr(0,13).split(``).map(function(e){return parseInt(e,10)}).reduce(function(e,t,n){return e+t*(3-n%2*2)},0);return Math.ceil(t/10)*10-t};e.default=function(e){o(n,e);function n(e,t){return i(this,n),e.search(/^[0-9]{13}$/)!==-1&&(e+=s(e)),a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,t))}return t(n,[{key:`valid`,value:function(){return this.data.search(/^[0-9]{14}$/)!==-1&&+this.data[13]===s(this.data)}}]),n}(n.default)})),QJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ITF14=e.ITF=void 0;var t=r(XJ()),n=r(ZJ());function r(e){return e&&e.__esModule?e:{default:e}}e.ITF=t.default,e.ITF14=n.default})),$J=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=r(kJ());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(e){o(n,e);function n(e,t){return i(this,n),a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,t))}return t(n,[{key:`encode`,value:function(){for(var e=`110`,t=0;t<this.data.length;t++){var n=parseInt(this.data[t]).toString(2);n=c(n,4-n.length);for(var r=0;r<n.length;r++)e+=n[r]==`0`?`100`:`110`}return e+=`1001`,{data:e,text:this.text}}},{key:`valid`,value:function(){return this.data.search(/^[0-9]+$/)!==-1}}]),n}(n.default);function c(e,t){for(var n=0;n<t;n++)e=`0`+e;return e}e.default=s})),eY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.mod10=t,e.mod11=n;function t(e){for(var t=0,n=0;n<e.length;n++){var r=parseInt(e[n]);(n+e.length)%2==0?t+=r:t+=r*2%10+Math.floor(r*2/10)}return(10-t%10)%10}function n(e){for(var t=0,n=[2,3,4,5,6,7],r=0;r<e.length;r++){var i=parseInt(e[e.length-1-r]);t+=n[r%n.length]*i}return(11-t%11)%11}})),tY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=r($J()),n=eY();function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){o(t,e);function t(e,r){return i(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e+(0,n.mod10)(e),r))}return t}(t.default)})),nY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=r($J()),n=eY();function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){o(t,e);function t(e,r){return i(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e+(0,n.mod11)(e),r))}return t}(t.default)})),rY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=r($J()),n=eY();function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){o(t,e);function t(e,r){return i(this,t),e+=(0,n.mod10)(e),e+=(0,n.mod10)(e),a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r))}return t}(t.default)})),iY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=r($J()),n=eY();function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){o(t,e);function t(e,r){return i(this,t),e+=(0,n.mod11)(e),e+=(0,n.mod10)(e),a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r))}return t}(t.default)})),aY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MSI1110=e.MSI1010=e.MSI11=e.MSI10=e.MSI=void 0;var t=o($J()),n=o(tY()),r=o(nY()),i=o(rY()),a=o(iY());function o(e){return e&&e.__esModule?e:{default:e}}e.MSI=t.default,e.MSI10=n.default,e.MSI11=r.default,e.MSI1010=i.default,e.MSI1110=a.default})),oY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.pharmacode=void 0;var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=r(kJ());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.pharmacode=function(e){o(n,e);function n(e,t){i(this,n);var r=a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,t));return r.number=parseInt(e,10),r}return t(n,[{key:`encode`,value:function(){for(var e=this.number,t=``;!isNaN(e)&&e!=0;)e%2==0?(t=`11100`+t,e=(e-2)/2):(t=`100`+t,e=(e-1)/2);return t=t.slice(0,-2),{data:t,text:this.text}}},{key:`valid`,value:function(){return this.number>=3&&this.number<=131070}}]),n}(n.default)})),sY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.codabar=void 0;var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=r(kJ());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.codabar=function(e){o(n,e);function n(e,t){i(this,n),e.search(/^[0-9\-\$\:\.\+\/]+$/)===0&&(e=`A`+e+`A`);var r=a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.toUpperCase(),t));return r.text=r.options.text||r.text.replace(/[A-D]/g,``),r}return t(n,[{key:`valid`,value:function(){return this.data.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/)!==-1}},{key:`encode`,value:function(){for(var e=[],t=this.getEncodings(),n=0;n<this.data.length;n++)e.push(t[this.data.charAt(n)]),n!==this.data.length-1&&e.push(`0`);return{text:this.text,data:e.join(``)}}},{key:`getEncodings`,value:function(){return{0:`101010011`,1:`101011001`,2:`101001011`,3:`110010101`,4:`101101001`,5:`110101001`,6:`100101011`,7:`100101101`,8:`100110101`,9:`110100101`,"-":`101001101`,$:`101100101`,":":`1101011011`,"/":`1101101011`,".":`1101101101`,"+":`1011011011`,A:`1011001001`,B:`1001001011`,C:`1010010011`,D:`1010011001`}}}]),n}(n.default)})),cY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SYMBOLS=`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,-,., ,$,/,+,%,($),(%),(/),(+),ÿ`.split(`,`),e.BINARIES=`100010100.101001000.101000100.101000010.100101000.100100100.100100010.101010000.100010010.100001010.110101000.110100100.110100010.110010100.110010010.110001010.101101000.101100100.101100010.100110100.100011010.101011000.101001100.101000110.100101100.100010110.110110100.110110010.110101100.110100110.110010110.110011010.101101100.101100110.100110110.100111010.100101110.111010100.111010010.111001010.101101110.101110110.110101110.100100110.111011010.111010110.100110010.101011110`.split(`.`),e.MULTI_SYMBOLS={"\0":[`(%)`,`U`],"":[`($)`,`A`],"":[`($)`,`B`],"":[`($)`,`C`],"":[`($)`,`D`],"":[`($)`,`E`],"":[`($)`,`F`],"\x07":[`($)`,`G`],"\b":[`($)`,`H`]," ":[`($)`,`I`],"\n":[`($)`,`J`],"\v":[`($)`,`K`],"\f":[`($)`,`L`],"\r":[`($)`,`M`],"":[`($)`,`N`],"":[`($)`,`O`],"":[`($)`,`P`],"":[`($)`,`Q`],"":[`($)`,`R`],"":[`($)`,`S`],"":[`($)`,`T`],"":[`($)`,`U`],"":[`($)`,`V`],"":[`($)`,`W`],"":[`($)`,`X`],"":[`($)`,`Y`],"":[`($)`,`Z`],"\x1B":[`(%)`,`A`],"":[`(%)`,`B`],"":[`(%)`,`C`],"":[`(%)`,`D`],"":[`(%)`,`E`],"!":[`(/)`,`A`],'"':[`(/)`,`B`],"#":[`(/)`,`C`],"&":[`(/)`,`F`],"'":[`(/)`,`G`],"(":[`(/)`,`H`],")":[`(/)`,`I`],"*":[`(/)`,`J`],",":[`(/)`,`L`],":":[`(/)`,`Z`],";":[`(%)`,`F`],"<":[`(%)`,`G`],"=":[`(%)`,`H`],">":[`(%)`,`I`],"?":[`(%)`,`J`],"@":[`(%)`,`V`],"[":[`(%)`,`K`],"\\":[`(%)`,`L`],"]":[`(%)`,`M`],"^":[`(%)`,`N`],_:[`(%)`,`O`],"`":[`(%)`,`W`],a:[`(+)`,`A`],b:[`(+)`,`B`],c:[`(+)`,`C`],d:[`(+)`,`D`],e:[`(+)`,`E`],f:[`(+)`,`F`],g:[`(+)`,`G`],h:[`(+)`,`H`],i:[`(+)`,`I`],j:[`(+)`,`J`],k:[`(+)`,`K`],l:[`(+)`,`L`],m:[`(+)`,`M`],n:[`(+)`,`N`],o:[`(+)`,`O`],p:[`(+)`,`P`],q:[`(+)`,`Q`],r:[`(+)`,`R`],s:[`(+)`,`S`],t:[`(+)`,`T`],u:[`(+)`,`U`],v:[`(+)`,`V`],w:[`(+)`,`W`],x:[`(+)`,`X`],y:[`(+)`,`Y`],z:[`(+)`,`Z`],"{":[`(%)`,`P`],"|":[`(%)`,`Q`],"}":[`(%)`,`R`],"~":[`(%)`,`S`],"":[`(%)`,`T`]}})),lY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=cY(),r=i(kJ());function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function o(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function s(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){s(r,e);function r(e,t){return a(this,r),o(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,e,t))}return t(r,[{key:`valid`,value:function(){return/^[0-9A-Z\-. $/+%]+$/.test(this.data)}},{key:`encode`,value:function(){var e=this.data.split(``).flatMap(function(e){return n.MULTI_SYMBOLS[e]||e}),t=e.map(function(e){return r.getEncoding(e)}).join(``),i=r.checksum(e,20),a=r.checksum(e.concat(i),15);return{text:this.text,data:r.getEncoding(`ÿ`)+t+r.getEncoding(i)+r.getEncoding(a)+r.getEncoding(`ÿ`)+`1`}}}],[{key:`getEncoding`,value:function(e){return n.BINARIES[r.symbolValue(e)]}},{key:`getSymbol`,value:function(e){return n.SYMBOLS[e]}},{key:`symbolValue`,value:function(e){return n.SYMBOLS.indexOf(e)}},{key:`checksum`,value:function(e,t){var n=e.slice().reverse().reduce(function(e,n,i){var a=i%t+1;return e+r.symbolValue(n)*a},0);return r.getSymbol(n%47)}}]),r}(r.default)})),uY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=r(lY());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){o(n,e);function n(e,t){return i(this,n),a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,t))}return t(n,[{key:`valid`,value:function(){return/^[\x00-\x7f]+$/.test(this.data)}}]),n}(n.default)})),dY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CODE93FullASCII=e.CODE93=void 0;var t=r(lY()),n=r(uY());function r(e){return e&&e.__esModule?e:{default:e}}e.CODE93=t.default,e.CODE93FullASCII=n.default})),fY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.GenericBarcode=void 0;var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=r(kJ());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.GenericBarcode=function(e){o(n,e);function n(e,t){return i(this,n),a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,t))}return t(n,[{key:`encode`,value:function(){return{data:`10101010101010101010101010101010101010101`,text:this.text}}},{key:`valid`,value:function(){return!0}}]),n}(n.default)})),pY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=AJ(),n=RJ(),r=JJ(),i=QJ(),a=aY(),o=oY(),s=sY(),c=dY(),l=fY();e.default={CODE39:t.CODE39,CODE128:n.CODE128,CODE128A:n.CODE128A,CODE128B:n.CODE128B,CODE128C:n.CODE128C,EAN13:r.EAN13,EAN8:r.EAN8,EAN5:r.EAN5,EAN2:r.EAN2,UPC:r.UPC,UPCE:r.UPCE,ITF14:i.ITF14,ITF:i.ITF,MSI:a.MSI,MSI10:a.MSI10,MSI11:a.MSI11,MSI1010:a.MSI1010,MSI1110:a.MSI1110,pharmacode:o.pharmacode,codabar:s.codabar,CODE93:c.CODE93,CODE93FullASCII:c.CODE93FullASCII,GenericBarcode:l.GenericBarcode}})),mY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};e.default=function(e,n){return t({},e,n)}})),hY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=t;function t(e){var t=[];function n(e){if(Array.isArray(e))for(var r=0;r<e.length;r++)n(e[r]);else e.text=e.text||``,e.data=e.data||``,t.push(e)}return n(e),t}})),gY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=t;function t(e){return e.marginTop=e.marginTop||e.margin,e.marginBottom=e.marginBottom||e.margin,e.marginRight=e.marginRight||e.margin,e.marginLeft=e.marginLeft||e.margin,e}})),_Y=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=t;function t(e){var t=[`width`,`height`,`textMargin`,`fontSize`,`margin`,`marginTop`,`marginBottom`,`marginLeft`,`marginRight`];for(var n in t)t.hasOwnProperty(n)&&(n=t[n],typeof e[n]==`string`&&(e[n]=parseInt(e[n],10)));return typeof e.displayValue==`string`&&(e.displayValue=e.displayValue!=`false`),e}})),vY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={width:2,height:100,format:`auto`,displayValue:!0,fontOptions:``,font:`monospace`,text:void 0,textAlign:`center`,textPosition:`bottom`,textMargin:2,fontSize:20,background:`#ffffff`,lineColor:`#000000`,margin:10,marginTop:void 0,marginBottom:void 0,marginLeft:void 0,marginRight:void 0,valid:function(){}}})),yY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=r(_Y()),n=r(vY());function r(e){return e&&e.__esModule?e:{default:e}}function i(e){var r={};for(var i in n.default)n.default.hasOwnProperty(i)&&(e.hasAttribute(`jsbarcode-`+i.toLowerCase())&&(r[i]=e.getAttribute(`jsbarcode-`+i.toLowerCase())),e.hasAttribute(`data-`+i.toLowerCase())&&(r[i]=e.getAttribute(`data-`+i.toLowerCase())));return r.value=e.getAttribute(`jsbarcode-value`)||e.getAttribute(`data-value`),r=(0,t.default)(r),r}e.default=i})),bY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getTotalWidthOfEncodings=e.calculateEncodingAttributes=e.getBarcodePadding=e.getEncodingHeight=e.getMaximumHeightOfEncodings=void 0;var t=n(mY());function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){return t.height+(t.displayValue&&e.text.length>0?t.fontSize+t.textMargin:0)+t.marginTop+t.marginBottom}function i(e,t,n){if(n.displayValue&&t<e){if(n.textAlign==`center`)return Math.floor((e-t)/2);if(n.textAlign==`left`)return 0;if(n.textAlign==`right`)return Math.floor(e-t)}return 0}function a(e,n,a){for(var o=0;o<e.length;o++){var s=e[o],l=(0,t.default)(n,s.options),u=l.displayValue?c(s.text,l,a):0,d=s.data.length*l.width;s.width=Math.ceil(Math.max(u,d)),s.height=r(s,l),s.barcodePadding=i(u,d,l)}}function o(e){for(var t=0,n=0;n<e.length;n++)t+=e[n].width;return t}function s(e){for(var t=0,n=0;n<e.length;n++)e[n].height>t&&(t=e[n].height);return t}function c(e,t,n){var r;if(n)r=n;else if(typeof document<`u`)r=document.createElement(`canvas`).getContext(`2d`);else return 0;r.font=t.fontOptions+` `+t.fontSize+`px `+t.font;var i=r.measureText(e);return i?i.width:0}e.getMaximumHeightOfEncodings=s,e.getEncodingHeight=r,e.getBarcodePadding=i,e.calculateEncodingAttributes=a,e.getTotalWidthOfEncodings=o})),xY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=i(mY()),r=bY();function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}e.default=function(){function e(t,n,r){a(this,e),this.canvas=t,this.encodings=n,this.options=r}return t(e,[{key:`render`,value:function(){if(!this.canvas.getContext)throw Error(`The browser does not support canvas.`);this.prepareCanvas();for(var e=0;e<this.encodings.length;e++){var t=(0,n.default)(this.options,this.encodings[e].options);this.drawCanvasBarcode(t,this.encodings[e]),this.drawCanvasText(t,this.encodings[e]),this.moveCanvasDrawing(this.encodings[e])}this.restoreCanvas()}},{key:`prepareCanvas`,value:function(){var e=this.canvas.getContext(`2d`);e.save(),(0,r.calculateEncodingAttributes)(this.encodings,this.options,e);var t=(0,r.getTotalWidthOfEncodings)(this.encodings),n=(0,r.getMaximumHeightOfEncodings)(this.encodings);this.canvas.width=t+this.options.marginLeft+this.options.marginRight,this.canvas.height=n,e.clearRect(0,0,this.canvas.width,this.canvas.height),this.options.background&&(e.fillStyle=this.options.background,e.fillRect(0,0,this.canvas.width,this.canvas.height)),e.translate(this.options.marginLeft,0)}},{key:`drawCanvasBarcode`,value:function(e,t){var n=this.canvas.getContext(`2d`),r=t.data,i=e.textPosition==`top`?e.marginTop+e.fontSize+e.textMargin:e.marginTop;n.fillStyle=e.lineColor;for(var a=0;a<r.length;a++){var o=a*e.width+t.barcodePadding;r[a]===`1`?n.fillRect(o,i,e.width,e.height):r[a]&&n.fillRect(o,i,e.width,e.height*r[a])}}},{key:`drawCanvasText`,value:function(e,t){var n=this.canvas.getContext(`2d`),r=e.fontOptions+` `+e.fontSize+`px `+e.font;if(e.displayValue){var i,a=e.textPosition==`top`?e.marginTop+e.fontSize-e.textMargin:e.height+e.textMargin+e.marginTop+e.fontSize;n.font=r,e.textAlign==`left`||t.barcodePadding>0?(i=0,n.textAlign=`left`):e.textAlign==`right`?(i=t.width-1,n.textAlign=`right`):(i=t.width/2,n.textAlign=`center`),n.fillText(t.text,i,a)}}},{key:`moveCanvasDrawing`,value:function(e){this.canvas.getContext(`2d`).translate(e.width,0)}},{key:`restoreCanvas`,value:function(){this.canvas.getContext(`2d`).restore()}}]),e}()})),SY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=i(mY()),r=bY();function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}var o=`http://www.w3.org/2000/svg`;e.default=function(){function e(t,n,r){a(this,e),this.svg=t,this.encodings=n,this.options=r,this.document=r.xmlDocument||document}return t(e,[{key:`render`,value:function(){var e=this.options.marginLeft;this.prepareSVG();for(var t=0;t<this.encodings.length;t++){var r=this.encodings[t],i=(0,n.default)(this.options,r.options),a=this.createGroup(e,i.marginTop,this.svg);this.setGroupOptions(a,i),this.drawSvgBarcode(a,i,r),this.drawSVGText(a,i,r),e+=r.width}}},{key:`prepareSVG`,value:function(){for(;this.svg.firstChild;)this.svg.removeChild(this.svg.firstChild);(0,r.calculateEncodingAttributes)(this.encodings,this.options);var e=(0,r.getTotalWidthOfEncodings)(this.encodings),t=(0,r.getMaximumHeightOfEncodings)(this.encodings),n=e+this.options.marginLeft+this.options.marginRight;this.setSvgAttributes(n,t),this.options.background&&this.drawRect(0,0,n,t,this.svg).setAttribute(`fill`,this.options.background)}},{key:`drawSvgBarcode`,value:function(e,t,n){for(var r=n.data,i=t.textPosition==`top`?t.fontSize+t.textMargin:0,a=0,o=0,s=0;s<r.length;s++)o=s*t.width+n.barcodePadding,r[s]===`1`?a++:a>0&&(this.drawRect(o-t.width*a,i,t.width*a,t.height,e),a=0);a>0&&this.drawRect(o-t.width*(a-1),i,t.width*a,t.height,e)}},{key:`drawSVGText`,value:function(e,t,n){var r=this.document.createElementNS(o,`text`);if(t.displayValue){var i,a;r.setAttribute(`font-family`,t.font),r.setAttribute(`font-size`,t.fontSize),t.fontOptions.includes(`bold`)&&r.setAttribute(`font-weight`,`bold`),t.fontOptions.includes(`italic`)&&r.setAttribute(`font-style`,`italic`),a=t.textPosition==`top`?t.fontSize-t.textMargin:t.height+t.textMargin+t.fontSize,t.textAlign==`left`||n.barcodePadding>0?(i=0,r.setAttribute(`text-anchor`,`start`)):t.textAlign==`right`?(i=n.width-1,r.setAttribute(`text-anchor`,`end`)):(i=n.width/2,r.setAttribute(`text-anchor`,`middle`)),r.setAttribute(`x`,i),r.setAttribute(`y`,a),r.appendChild(this.document.createTextNode(n.text)),e.appendChild(r)}}},{key:`setSvgAttributes`,value:function(e,t){var n=this.svg;n.setAttribute(`width`,e+`px`),n.setAttribute(`height`,t+`px`),n.setAttribute(`x`,`0px`),n.setAttribute(`y`,`0px`),n.setAttribute(`viewBox`,`0 0 `+e+` `+t),n.setAttribute(`xmlns`,o),n.setAttribute(`version`,`1.1`)}},{key:`createGroup`,value:function(e,t,n){var r=this.document.createElementNS(o,`g`);return r.setAttribute(`transform`,`translate(`+e+`, `+t+`)`),n.appendChild(r),r}},{key:`setGroupOptions`,value:function(e,t){e.setAttribute(`fill`,t.lineColor)}},{key:`drawRect`,value:function(e,t,n,r,i){var a=this.document.createElementNS(o,`rect`);return a.setAttribute(`x`,e),a.setAttribute(`y`,t),a.setAttribute(`width`,n),a.setAttribute(`height`,r),i.appendChild(a),a}}]),e}()})),CY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function n(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}e.default=function(){function e(t,r,i){n(this,e),this.object=t,this.encodings=r,this.options=i}return t(e,[{key:`render`,value:function(){this.object.encodings=this.encodings}}]),e}()})),wY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=i(xY()),n=i(SY()),r=i(CY());function i(e){return e&&e.__esModule?e:{default:e}}e.default={CanvasRenderer:t.default,SVGRenderer:n.default,ObjectRenderer:r.default}})),TY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function n(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function r(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(e){r(i,e);function i(e,r){t(this,i);var a=n(this,(i.__proto__||Object.getPrototypeOf(i)).call(this));return a.name=`InvalidInputException`,a.symbology=e,a.input=r,a.message=`"`+a.input+`" is not a valid input for `+a.symbology,a}return i}(Error),a=function(e){r(i,e);function i(){t(this,i);var e=n(this,(i.__proto__||Object.getPrototypeOf(i)).call(this));return e.name=`InvalidElementException`,e.message=`Not supported type to render on`,e}return i}(Error),o=function(e){r(i,e);function i(){t(this,i);var e=n(this,(i.__proto__||Object.getPrototypeOf(i)).call(this));return e.name=`NoElementException`,e.message=`No element to render on.`,e}return i}(Error);e.InvalidInputException=i,e.InvalidElementException=a,e.NoElementException=o})),EY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},n=a(yY()),r=a(wY()),i=TY();function a(e){return e&&e.__esModule?e:{default:e}}function o(e){if(typeof e==`string`)return s(e);if(Array.isArray(e)){for(var a=[],l=0;l<e.length;l++)a.push(o(e[l]));return a}else if(typeof HTMLCanvasElement<`u`&&e instanceof HTMLImageElement)return c(e);else if(e&&e.nodeName&&e.nodeName.toLowerCase()===`svg`||typeof SVGElement<`u`&&e instanceof SVGElement)return{element:e,options:(0,n.default)(e),renderer:r.default.SVGRenderer};else if(typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement)return{element:e,options:(0,n.default)(e),renderer:r.default.CanvasRenderer};else if(e&&e.getContext)return{element:e,renderer:r.default.CanvasRenderer};else if(e&&(e===void 0?`undefined`:t(e))===`object`&&!e.nodeName)return{element:e,renderer:r.default.ObjectRenderer};else throw new i.InvalidElementException}function s(e){var t=document.querySelectorAll(e);if(t.length!==0){for(var n=[],r=0;r<t.length;r++)n.push(o(t[r]));return n}}function c(e){var t=document.createElement(`canvas`);return{element:t,options:(0,n.default)(e),renderer:r.default.CanvasRenderer,afterRender:function(){e.setAttribute(`src`,t.toDataURL())}}}e.default=o})),DY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function n(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}e.default=function(){function e(t){n(this,e),this.api=t}return t(e,[{key:`handleCatch`,value:function(e){if(e.name===`InvalidInputException`)if(this.api._options.valid!==this.api._defaults.valid)this.api._options.valid(!1);else throw e.message;else throw e;this.api.render=function(){}}},{key:`wrapBarcodeCall`,value:function(e){try{var t=e.apply(void 0,arguments);return this.api._options.valid(!0),t}catch(e){return this.handleCatch(e),this.api}}}]),e}()})),OY=l(o(((e,t)=>{var n=d(pY()),r=d(mY()),i=d(hY()),a=d(gY()),o=d(EY()),s=d(_Y()),c=d(DY()),l=TY(),u=d(vY());function d(e){return e&&e.__esModule?e:{default:e}}var f=function(){},p=function(e,t,n){var r=new f;if(e===void 0)throw Error(`No element to render on was provided.`);return r._renderProperties=(0,o.default)(e),r._encodings=[],r._options=u.default,r._errorHandler=new c.default(r),t!==void 0&&(n||={},n.format||=_(),r.options(n)[n.format](t,n).render()),r};for(var m in p.getModule=function(e){return n.default[e]},n.default)n.default.hasOwnProperty(m)&&h(n.default,m);function h(e,t){f.prototype[t]=f.prototype[t.toUpperCase()]=f.prototype[t.toLowerCase()]=function(n,i){var a=this;return a._errorHandler.wrapBarcodeCall(function(){i.text=i.text===void 0?void 0:``+i.text;var o=(0,r.default)(a._options,i);o=(0,s.default)(o);var c=e[t],l=g(n,c,o);return a._encodings.push(l),a})}}function g(e,t,n){e=``+e;var a=new t(e,n);if(!a.valid())throw new l.InvalidInputException(a.constructor.name,e);var o=a.encode();o=(0,i.default)(o);for(var s=0;s<o.length;s++)o[s].options=(0,r.default)(n,o[s].options);return o}function _(){return n.default.CODE128?`CODE128`:Object.keys(n.default)[0]}f.prototype.options=function(e){return this._options=(0,r.default)(this._options,e),this},f.prototype.blank=function(e){var t=Array(e+1).join(`0`);return this._encodings.push({data:t}),this},f.prototype.init=function(){if(this._renderProperties){Array.isArray(this._renderProperties)||(this._renderProperties=[this._renderProperties]);var e;for(var t in this._renderProperties){e=this._renderProperties[t];var i=(0,r.default)(this._options,e.options);i.format==`auto`&&(i.format=_()),this._errorHandler.wrapBarcodeCall(function(){var t=i.value,r=n.default[i.format.toUpperCase()],a=g(t,r,i);v(e,a,i)})}}},f.prototype.render=function(){if(!this._renderProperties)throw new l.NoElementException;if(Array.isArray(this._renderProperties))for(var e=0;e<this._renderProperties.length;e++)v(this._renderProperties[e],this._encodings,this._options);else v(this._renderProperties,this._encodings,this._options);return this},f.prototype._defaults=u.default;function v(e,t,n){t=(0,i.default)(t);for(var o=0;o<t.length;o++)t[o].options=(0,r.default)(n,t[o].options),(0,a.default)(t[o].options);(0,a.default)(n);var s=e.renderer;new s(e.element,t,n).render(),e.afterRender&&e.afterRender()}typeof window<`u`&&(window.JsBarcode=p),typeof jQuery<`u`&&(jQuery.fn.JsBarcode=function(e,t){var n=[];return jQuery(this).each(function(){n.push(this)}),p(n,e,t)}),t.exports=p}))(),1);function kY(e){let t=(0,L.useRef)(null),n=(0,L.useCallback)(n=>{n&&(0,OY.default)(n,e.text,{format:`CODE128`}),t.current=n},[e.text]);return(0,L.useEffect)(()=>{t.current&&(0,OY.default)(t.current,e.text,{format:`CODE128`,fontSize:30})},[e.text]),(0,H.jsx)(`svg`,{ref:n})}function AY(e){return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{style:{marginTop:`4em`,display:`flex`,justifyContent:`center`},children:(0,H.jsx)(`h2`,{children:`SeedTactic: FMS Insight`})}),(0,H.jsx)(`div`,{style:{display:`flex`,justifyContent:`center`},children:(0,H.jsx)(`p`,{style:{fontSize:`x-large`},children:new Date().toLocaleString(void 0,{weekday:`long`,month:`long`,day:`numeric`,year:`numeric`,hour:`numeric`,minute:`2-digit`,second:`2-digit`})})}),(0,H.jsxs)(`div`,{style:{marginTop:`2em`,display:`flex`,justifyContent:`space-around`},children:[(0,H.jsx)(kY,{text:e.materialName??e.partName}),e.count>=2?(0,H.jsx)(kY,{text:e.count.toString()}):void 0]}),e.serial1&&e.serial1!==``?(0,H.jsxs)(`div`,{style:{marginTop:`2em`,display:`flex`,justifyContent:`space-around`},children:[(0,H.jsx)(kY,{text:e.serial1}),e.serial2&&e.serial2!==``?(0,H.jsx)(kY,{text:e.serial2||``}):void 0]}):void 0,(0,H.jsx)(`div`,{style:{marginTop:`2em`,marginLeft:`4em`,marginRight:`4em`,marginBottom:`9em`},children:e.uniq===null||e.uniq===``?(0,H.jsx)(`p`,{style:{fontSize:`x-large`},children:`Not currently assigned to any jobs`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{style:{fontSize:`x-large`},children:`Assigned To`}),(0,H.jsxs)(`div`,{style:{marginTop:`1em`,marginLeft:`2em`,display:`flex`,alignItems:`center`},children:[(0,H.jsx)(kY,{text:e.partName}),(0,H.jsxs)(`h3`,{style:{marginLeft:`4em`},children:[`assigned to `,e.uniq,e.jobCycles&&e.jobCycles>0?` (`+e.jobCycles.toString()+` scheduled)`:``]})]})]})}),e.note?(0,H.jsx)(`div`,{style:{marginBottom:`2em`},children:(0,H.jsx)(`p`,{style:{fontSize:`xxx-large`,textAlign:`center`},children:e.note})}):void 0,(0,H.jsx)(`div`,{style:{display:`flex`,justifyContent:`center`},children:e.operator?(0,H.jsx)(`p`,{style:{fontSize:`x-large`},children:e.operator}):void 0})]})}function jY(e){let t=R(NO).jobs,n=(0,L.useMemo)(()=>Q.of(e.material||[]).filter(e=>e.jobUnique!==null&&e.jobUnique!==void 0&&e.jobUnique!==``).groupBy(e=>e.jobUnique).map(([e,n])=>[e,{cycles:t[e]?.cycles??0,length:n.length,part:n[0]?.partName??``,comment:t[e]?.comment,serial1:n[0]?.serial,serial2:n[n.length-1]?.serial}]).toSortedArray(([e,t])=>t.part),[e.material,t]);return!e.material||e.material.length===0?(0,H.jsx)(`div`,{}):n.length===0?(0,H.jsx)(AY,{partName:e.material[0].partName,materialName:e.materialName,count:e.material.length,uniq:null,note:null,operator:e.operator,serial1:e.material[0].serial,serial2:e.material[e.material.length-1]?.serial}):(0,H.jsx)(`div`,{children:n.map(([t,r],i)=>(0,H.jsxs)(L.Fragment,{children:[(0,H.jsx)(AY,{partName:r.part,materialName:e.materialName,count:r.length,uniq:t,jobCycles:r.cycles,note:r.comment,operator:e.operator,serial1:r.serial1,serial2:r.serial2}),i<n.length-1?(0,H.jsx)(`div`,{style:{pageBreakAfter:`always`}}):void 0]},i))})}function MY(e){let t=(0,L.useMemo)(()=>Q.of(e.material||[]).filter(e=>e.jobUnique!==null&&e.jobUnique!==void 0&&e.jobUnique!==``).groupBy(e=>e.jobUnique).map(([e,t])=>[e,{length:t.length,part:t[0]?.partName??``}]).toSortedArray(([e,t])=>t.part),[e.material]),n=R(NO).jobs,r=(0,L.useMemo)(()=>Q.of(e.material||[]).collect(e=>e.jobUnique?n[e.jobUnique]?.comment:void 0).distinct().toSortedArray(e=>e),[e.material,n]);return!e.material||e.material.length===0?(0,H.jsx)(`div`,{}):(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{style:{marginTop:`4em`,display:`flex`,justifyContent:`center`},children:(0,H.jsx)(`h2`,{children:`SeedTactic: FMS Insight`})}),(0,H.jsx)(`div`,{style:{display:`flex`,justifyContent:`center`},children:(0,H.jsx)(`p`,{style:{fontSize:`x-large`},children:new Date().toLocaleString(void 0,{weekday:`long`,month:`long`,day:`numeric`,year:`numeric`,hour:`numeric`,minute:`2-digit`,second:`2-digit`})})}),(0,H.jsxs)(`div`,{style:{marginTop:`2em`,display:`flex`,justifyContent:`space-around`},children:[(0,H.jsx)(kY,{text:e.materialName??e.material[0].partName}),e.material.length>=2?(0,H.jsx)(kY,{text:e.material.length.toString()}):void 0]}),e.material[0].serial&&e.material[0].serial!==``?(0,H.jsxs)(`div`,{style:{marginTop:`2em`,display:`flex`,justifyContent:`space-around`},children:[(0,H.jsx)(kY,{text:e.material[0].serial}),e.material.length>=2&&e.material[e.material.length-1].serial&&e.material[e.material.length-1].serial!==``?(0,H.jsx)(kY,{text:e.material[e.material.length-1].serial||``}):void 0]}):void 0,(0,H.jsx)(`div`,{style:{marginTop:`2em`,marginLeft:`4em`,marginRight:`4em`,marginBottom:`9em`},children:t.length===0?(0,H.jsx)(`p`,{style:{fontSize:`x-large`},children:`Not currently assigned to any jobs`}):e.materialName?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{style:{fontSize:`x-large`},children:`Assigned To`}),t.map(([e,t],n)=>(0,H.jsxs)(`div`,{style:{marginTop:`1em`,marginLeft:`2em`,display:`flex`,alignItems:`center`},children:[(0,H.jsx)(kY,{text:t.part}),(0,H.jsxs)(`h3`,{style:{marginLeft:`4em`},children:[`x`,t.length]}),(0,H.jsxs)(`h3`,{style:{marginLeft:`4em`},children:[`assigned to `,e]})]},n))]}):t.length===1?(0,H.jsx)(`div`,{style:{marginTop:`1em`,display:`flex`,justifyContent:`space-around`},children:(0,H.jsxs)(`p`,{style:{fontSize:`x-large`},children:[(0,H.jsxs)(`span`,{children:[`Assigned to `,t[0][0]]}),t[0][1].length>1?(0,H.jsxs)(`span`,{style:{marginLeft:`1em`},children:[`x`,t[0][1].length]}):void 0]})}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{style:{fontSize:`x-large`},children:`Assigned To`}),t.map(([e,t],n)=>(0,H.jsxs)(`h3`,{style:{marginTop:`1em`,marginLeft:`2em`},children:[(0,H.jsx)(`span`,{children:e}),t.length>1?(0,H.jsxs)(`span`,{style:{marginLeft:`1em`},children:[`x`,t.length]}):void 0]},n))]})}),r.length>0?(0,H.jsx)(`div`,{style:{marginBottom:`2em`},children:r.map((e,t)=>(0,H.jsx)(`p`,{style:{fontSize:`xxx-large`,textAlign:`center`},children:e},t))}):void 0,(0,H.jsx)(`div`,{style:{display:`flex`,justifyContent:`center`},children:e.operator?(0,H.jsx)(`p`,{style:{fontSize:`x-large`},children:e.operator}):void 0})]})}function NY(e){return e.oneJobPerPage?(0,H.jsx)(jY,{...e}):(0,H.jsx)(MY,{...e})}function PY({mat:e,materialName:t,operator:n}){let r=(0,L.useRef)(null),i=OJ({contentRef:r,ignoreGlobalStyles:!0});return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Y,{color:`primary`,onClick:()=>i(),children:`Print Label`}),(0,H.jsx)(`div`,{style:{display:`none`},children:(0,H.jsx)(`div`,{ref:r,children:(0,H.jsx)(NY,{materialName:t,material:Array.isArray(e)?e:[e],oneJobPerPage:!1,operator:n})})})]})}function FY(){let e=R(br),t=R(TI),n=R(OI),[r,i,a]=zI();return!e.usingLabelPrinterForSerials||t===null||t.materialID<0?null:e.useClientPrinterForLabels?n===null?null:(0,H.jsx)(PY,{mat:n}):(0,H.jsx)(Y,{color:`primary`,disabled:i||a,onClick:()=>r({materialId:t.materialID,proc:n?.process??0}),children:a?`Printed`:`Print Label`})}var IY=P(null),LY=P(null);function RY(){let[e,t]=B(LY),n=R(NO),r=(0,L.useRef)(null),i=(0,L.useRef)(!1),a=OJ({contentRef:r,onAfterPrint:()=>t(null),ignoreGlobalStyles:!0}),o=e?n.material.filter(t=>e.materialIds.has(t.materialID)):null;return o?.length!==e?.materialIds.size&&(o=null),(0,L.useEffect)(()=>{if(e===null){i.current&&=!1;return}i.current||o===null||(a(),i.current=!0)},[e,o,i,a]),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(cy,{open:e!==null,children:[(0,H.jsx)(dy,{children:`Waiting for Material Assignment`}),(0,H.jsx)(uy,{children:o===null?e===null?(0,H.jsx)(`div`,{}):(0,H.jsxs)(RC,{direction:`column`,spacing:2,sx:{mt:`0.5em`,mb:`0.5em`},children:[(0,H.jsx)(Lm,{color:`secondary`}),(0,H.jsx)(`div`,{children:`Waiting for material assignment. This could take a while if a download is currently in progress.`})]}):(0,H.jsx)(`div`,{children:`Printing...`})}),(0,H.jsx)(ly,{children:(0,H.jsx)(Y,{color:`primary`,onClick:()=>t(null),children:`Cancel`})})]}),(0,H.jsx)(`div`,{style:{display:`none`},children:(0,H.jsx)(`div`,{ref:r,children:(0,H.jsx)(NY,{materialName:e?.selectedCasting,material:o,operator:e?.operator,oneJobPerPage:!0})})})]})}function zY({casting:e,queue:t}){let n=R(NO),r=(0,L.useMemo)(()=>nJ(n.jobs,n.material,t).filter(t=>t.rawMatName===e),[n.jobs,n.material,e,t]);return r.length===0?null:(0,H.jsxs)(jw,{size:`small`,children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:`Job`}),(0,H.jsx)(Z,{align:`right`,children:`Plan`}),(0,H.jsx)(Z,{align:`right`,children:`Remaining`}),(0,H.jsx)(Z,{align:`right`,children:`Assigned`}),(0,H.jsx)(Z,{align:`right`,children:`Required`}),(0,H.jsx)(Z,{align:`right`,children:`Available`})]})}),(0,H.jsxs)(Pw,{children:[r.map((e,t)=>(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:e.job.unique}),(0,H.jsx)(Z,{align:`right`,children:e.job.cycles}),(0,H.jsx)(Z,{align:`right`,children:e.remainingToStart}),(0,H.jsx)(Z,{align:`right`,children:e.assignedRaw}),(0,H.jsx)(Z,{align:`right`,children:Math.max(e.remainingToStart-e.assignedRaw,0)}),(0,H.jsx)(Z,{align:`right`,children:e.availableUnassigned})]},t)),r.length>=2?(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:`Total`}),(0,H.jsx)(Z,{align:`right`,children:Q.of(r).sumBy(e=>e.job.cycles)}),(0,H.jsx)(Z,{align:`right`,children:Q.of(r).sumBy(e=>e.remainingToStart)}),(0,H.jsx)(Z,{align:`right`,children:Q.of(r).sumBy(e=>e.assignedRaw)}),(0,H.jsx)(Z,{align:`right`,children:Q.of(r).sumBy(e=>Math.max(e.remainingToStart-e.assignedRaw,0))}),(0,H.jsx)(Z,{align:`right`,children:Q.of(r).sumBy(e=>e.availableUnassigned)})]}):void 0]})]})}var BY=(0,L.memo)(function(){let[e,t]=B(IY),n=R(jO),r=R(br),i=r.usingLabelPrinterForSerials&&r.useClientPrinterForLabels,[a]=VI(),o=z(LY),[s,c]=(0,L.useState)(null),[l,u]=(0,L.useState)(null),[d,f]=(0,L.useState)(null),[p,m]=(0,L.useState)(!1),h=R(NO),g=R(DL),_=(0,L.useMemo)(()=>Q.ofObject(h.jobs).flatMap(([,e])=>e.procsAndPaths[0].paths).filter(e=>e.casting!==void 0&&e.casting!==``).map(e=>({casting:e.casting??``,cnt:1})).concat(Q.of(g).map(e=>({casting:e,cnt:0}))).buildOrderedMap(e=>e.casting,(e,t)=>e===void 0?t.cnt:e+t.cnt).toAscLazySeq(),[h.jobs,g]);function v(){t(null),c(null),f(null),m(!1),u(null)}function y(){e!==null&&s!==null&&l!==null&&!isNaN(l)&&l>0&&a({casting:s,quantity:l,queue:e,workorder:null,operator:r.requireOperatorNamePromptWhenAddingMaterial?d:n}).catch(console.log),v()}function b(){e!==null&&s!==null&&l!==null&&!isNaN(l)&&(m(!0),a({casting:s,quantity:l,queue:e,operator:n,workorder:null,onNewMaterial:e=>{o({selectedCasting:s,operator:r.requireOperatorNamePromptWhenAddingMaterial?d:n,materialIds:new Set(e.map(e=>e.materialID))}),v()},onError:()=>{v()}}).catch(()=>{}))}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(cy,{open:e!==null,onClose:()=>v(),maxWidth:`md`,children:[(0,H.jsx)(dy,{children:`Add Raw Material`}),(0,H.jsx)(uy,{children:(0,H.jsxs)(RC,{direction:`column`,spacing:2,sx:{mt:`0.5em`},children:[(0,H.jsx)(Kw,{style:{minWidth:`15em`},value:s||``,onChange:e=>c(e.target.value),select:!0,fullWidth:!0,label:`Raw Material`,slotProps:{select:{renderValue:s===null?void 0:()=>(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(`div`,{style:{marginRight:`0.5em`},children:(0,H.jsx)(XU,{part:s,size:25})}),(0,H.jsx)(`div`,{children:s})]})}},children:_.map(([e,t],n)=>(0,H.jsxs)(Hx,{value:e,children:[(0,H.jsx)(Mb,{children:(0,H.jsx)(XU,{part:e})}),(0,H.jsx)(Lb,{primary:e,slotProps:{primary:{variant:`h4`}},secondary:t===0?`Not used by any current jobs`:`Used by ${t} current job${t>1?`s`:``}`})]},n))}),(0,H.jsx)(Kw,{fullWidth:!0,type:`number`,label:`Quantity`,disabled:s===null,slotProps:{htmlInput:{min:`1`}},value:l===null||isNaN(l)||l<=0?``:l,onChange:e=>u(parseInt(e.target.value))}),r.requireOperatorNamePromptWhenAddingMaterial?(0,H.jsx)(Kw,{fullWidth:!0,label:`Operator`,value:d||``,onChange:e=>f(e.target.value)}):void 0,s!==null&&e!==null?(0,H.jsx)(zY,{casting:s,queue:e}):void 0]})}),(0,H.jsxs)(ly,{children:[i?(0,H.jsxs)(Y,{color:`primary`,disabled:p||s===null||l===null||isNaN(l)||r.requireOperatorNamePromptWhenAddingMaterial&&(d===null||d===``),onClick:b,children:[p?(0,H.jsx)(Lm,{size:10}):void 0,`Add `,l!==null&&!isNaN(l)?l.toString()+` `:``,`to`,` `,e]}):(0,H.jsxs)(Y,{color:`primary`,disabled:s===null||l===null||isNaN(l)||r.requireOperatorNamePromptWhenAddingMaterial&&(d===null||d===``),onClick:y,children:[`Add `,l!==null&&!isNaN(l)?l.toString()+` `:``,`to`,` `,e]}),(0,H.jsx)(Y,{color:`primary`,disabled:p&&i,onClick:v,children:`Cancel`})]})]}),(0,H.jsx)(RY,{})]})}),VY=(0,L.memo)(function(e){let t=R(br),n=R(NO).jobs,[r,i]=zI(),[a,o]=(0,L.useState)(!1),[s,c]=(0,L.useState)([]),[l,u]=(0,L.useState)(!1),[d,f]=(0,L.useState)(NaN),[p,m]=(0,L.useState)(void 0);(0,L.useEffect)(()=>{if(e.material===null)return;let t=!0;return o(!0),iJ(e.material).then(e=>{if(t){c(e);let t;for(let n of e)n.type===V.AddToQueue&&n.details?.operator!==void 0&&(t=n.details.operator);m(t)}}).catch(console.error).finally(()=>o(!1)),()=>{t=!1}},[e.material]);let h=(0,L.useMemo)(()=>{if(!e.material||e.material.length===0)return;let t=e.material[0].jobUnique;if(!(!t||t===``||!n[t]))return Q.of(n[t].procsAndPaths[0].paths).filter(e=>e.casting!==void 0&&e.casting!==``).head()?.casting},[e.material,n]);function g(){e.closeDialog(),u(!1),f(NaN),o(!1),c([])}function _(){l?isNaN(d)||(o(!0),Ut.bulkRemoveMaterialFromQueues(e.operator,Q.of(e.material||[]).take(d).map(e=>e.materialID).toRArray()).catch(console.error).finally(g)):u(!0)}let v=e.material?.[0];return(0,H.jsxs)(cy,{open:e.material!==null,onClose:g,maxWidth:`md`,children:[(0,H.jsx)(dy,{children:v&&e.material&&e.material.length>0?(0,H.jsx)(hW,{partName:v.partName,subtitle:e.material.length.toString()+(v.jobUnique&&v.jobUnique!==``?` assigned to `+v.jobUnique:` unassigned`)}):`Material`}),(0,H.jsxs)(uy,{children:[a?(0,H.jsx)(Lm,{color:`secondary`}):(0,H.jsx)(bI,{entries:s,copyToClipboard:!0}),l&&e.material?(0,H.jsx)(`div`,{style:{marginTop:`1em`},children:(0,H.jsx)(Kw,{type:`number`,variant:`outlined`,fullWidth:!0,label:`Quantity to Remove`,slotProps:{htmlInput:{min:`1`,max:e.material.length.toString()}},value:isNaN(d)?``:d,onChange:e=>f(parseInt(e.target.value))})}):void 0]}),(0,H.jsxs)(ly,{children:[e.material&&e.material.length>0&&t.usingLabelPrinterForSerials?t.useClientPrinterForLabels?(0,H.jsx)(PY,{mat:e.material||[],materialName:h,operator:p}):(0,H.jsx)(Y,{color:`primary`,disabled:i,onClick:()=>e.material&&e.material.length>0?r({materialId:e.material[0].materialID,proc:0}):void 0,children:`Print Label`}):void 0,(0,H.jsx)(Y,{color:`primary`,onClick:_,disabled:a||l&&isNaN(d),children:a&&l?`Removing...`:l&&!isNaN(d)?`Remove ${d} material`:`Remove Material`}),(0,H.jsx)(Y,{color:`primary`,onClick:g,children:`Close`})]})]})}),HY=(0,L.memo)(function(){let[e,t]=(0,L.useState)(null),[n,r]=(0,L.useState)(!1),i=z(SI);function a(){r(!1),t(null)}function o(){e&&e!==``&&(i({type:`ManuallyEnteredSerial`,serial:e}),a())}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{title:`Enter Serial`,children:(0,H.jsx)(Um,{onClick:()=>r(!0),size:`large`,children:(0,H.jsx)(bT,{})})}),(0,H.jsxs)(cy,{open:n,onClose:a,maxWidth:`md`,children:[(0,H.jsx)(dy,{children:`Enter a part's serial`}),(0,H.jsx)(uy,{children:(0,H.jsx)(`div`,{style:{minWidth:`20em`},children:(0,H.jsx)(Kw,{sx:{mt:`5px`},label:e===null||e===``?`Serial`:`Serial (press enter)`,value:e??``,fullWidth:!0,autoFocus:!0,onChange:e=>t(e.target.value),onKeyDown:t=>{t.key===`Enter`&&e&&e!==``&&(t.preventDefault(),o())}})})}),(0,H.jsxs)(ly,{children:[(0,H.jsx)(Y,{onClick:o,disabled:e===null||e===``,color:`secondary`,children:`Open`}),(0,H.jsx)(Y,{onClick:a,color:`secondary`,children:`Cancel`})]})]})]})}),UY=P(null),WY=(0,L.memo)(function(){let[e,t]=B(UY),n=z(SI),[r,i]=(0,L.useState)(void 0);function a(){r&&r!==``&&e!==null&&(n({type:`AddMatWithEnteredSerial`,serial:r,toQueue:e}),t(null),i(void 0))}function o(){t(null),i(void 0)}return(0,H.jsxs)(cy,{open:e!==null,onClose:o,maxWidth:`md`,children:[(0,H.jsxs)(dy,{children:[`Lookup Material To Add To `,e]}),(0,H.jsx)(uy,{children:(0,H.jsx)(Kw,{label:`Serial`,style:{marginTop:`0.5em`},autoFocus:!0,fullWidth:!0,value:r||``,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&r&&r!==``&&(e.preventDefault(),a())}})}),(0,H.jsxs)(ly,{children:[(0,H.jsx)(Y,{onClick:a,color:`secondary`,children:`Lookup Serial`}),(0,H.jsx)(Y,{onClick:o,color:`primary`,children:`Cancel`})]})]})});function GY(e){let t=R(TI),n=R(OI),r=R(wI);return!(!YU(n)||n?.location.type===at.InQueue&&n.location.currentQueue!==void 0&&e.includes(n.location.currentQueue)||t===null&&!r)}var KY=G(aT,{shouldForwardProp:e=>e.toString()[0]!==`$`})(({theme:e,$expandedOpen:t})=>({transform:t?`rotate(0deg)`:`rotate(-90deg)`,transition:e.transitions.create(`transform`,{duration:e.transitions.duration.shortest})}));function qY({newMaterialTy:e,setNewMaterialTy:t,castings:n,indent:r}){return(0,H.jsx)(pb,{sx:r?e=>({pl:e.spacing(4)}):void 0,children:n.map(n=>(0,H.jsx)(Db,{children:(0,H.jsxs)(vb,{selected:e?.kind===`RawMat`&&e?.rawMatName===n.casting,onClick:()=>t({kind:`RawMat`,rawMatName:n.casting}),children:[(0,H.jsx)(Mb,{children:(0,H.jsx)(XU,{part:n.casting})}),(0,H.jsx)(Lb,{primary:n.casting,secondary:n.message??void 0,slotProps:{primary:{variant:`h4`}}})]})},n.casting))})}function JY({newMaterialTy:e,setNewMaterialTy:t,curCollapse:n,setCurCollapse:r,indent:i,jobs:a}){return(0,H.jsx)(pb,{sx:i?e=>({pl:e.spacing(4)}):void 0,children:a.map((a,o)=>a.machinedProcs.length===1?(0,H.jsx)(`div`,{children:(0,H.jsx)(Db,{children:(0,H.jsxs)(vb,{alignItems:`flex-start`,selected:e?.kind===`JobAndProc`&&e?.jobUnique===a.jobUnique&&e?.last_proc===a.machinedProcs[0].lastProc,onClick:()=>t({kind:`JobAndProc`,jobUnique:a.jobUnique,last_proc:a.machinedProcs[0].lastProc,workorder:a.workorder}),children:[a.job?(0,H.jsx)(Mb,{children:(0,H.jsx)(XU,{part:a.job.partName})}):void 0,(0,H.jsx)(Lb,{primary:(a.job?.partName??``)+` (`+a.jobUnique+`)`,slotProps:{primary:{variant:`h4`}},secondary:(0,H.jsxs)(q,{variant:`body2`,children:[a.machinedProcs[0].lastProc===0?`Raw Material`:`Last machined process `+a.machinedProcs[0].lastProc.toString(),`, `,a.job?.routeStartUTC.toLocaleDateString()??``,`,`,` `,a.machinedProcs[0].details]})})]})})},o):(0,H.jsxs)(L.Fragment,{children:[(0,H.jsx)(Db,{children:(0,H.jsxs)(vb,{onClick:()=>{e&&t(null),r(n&&n.kind===`Job`&&n.unique===a.jobUnique?null:{kind:`Job`,unique:a.jobUnique})},children:[(0,H.jsx)(Mb,{children:(0,H.jsx)(KY,{$expandedOpen:n!==null&&n.kind===`Job`&&n.unique===a.jobUnique})}),a.job?(0,H.jsx)(Mb,{children:(0,H.jsx)(XU,{part:a.job.partName})}):void 0,(0,H.jsx)(Lb,{primary:(a.job?.partName??``)+` (`+a.jobUnique+`)`,slotProps:{primary:{variant:`h4`}},secondary:a.job?.routeStartUTC.toLocaleDateString()})]})}),(0,H.jsx)(zp,{in:n!==null&&n.kind===`Job`&&n.unique===a.jobUnique,timeout:`auto`,children:a.machinedProcs.map((n,r)=>(0,H.jsx)(`div`,{children:(0,H.jsx)(Db,{sx:e=>({pl:e.spacing(i?8:4)}),children:(0,H.jsx)(vb,{selected:e?.kind===`JobAndProc`&&e?.jobUnique===a.jobUnique&&e?.last_proc===n.lastProc,onClick:()=>t({kind:`JobAndProc`,jobUnique:a.jobUnique,last_proc:n.lastProc,workorder:a.workorder}),children:(0,H.jsx)(Lb,{primary:n.lastProc===0?`Raw Material`:`Last machined process `+n.lastProc.toString(),secondary:n.details})})})},r))})]},o))})}function YY({newMaterialTy:e,options:t,setNewMaterialTy:n,curCollapse:r,setCurCollapse:i}){return(0,H.jsxs)(pb,{children:[(0,H.jsx)(Db,{children:(0,H.jsxs)(vb,{onClick:()=>{e&&n(null),i(r&&r.kind===`RawMat`?null:{kind:`RawMat`})},children:[(0,H.jsx)(Mb,{children:(0,H.jsx)(KY,{$expandedOpen:r!==null&&r.kind===`RawMat`})}),(0,H.jsx)(Lb,{primary:`Raw Material`})]})}),(0,H.jsx)(zp,{in:r!==null&&r.kind===`RawMat`,timeout:`auto`,children:(0,H.jsx)(qY,{castings:t.castings,newMaterialTy:e,setNewMaterialTy:n,indent:!0})}),(0,H.jsx)(Db,{children:(0,H.jsxs)(vb,{onClick:()=>{e&&n(null),i(r&&(r.kind===`AllJobs`||r.kind===`Job`)?null:{kind:`AllJobs`})},children:[(0,H.jsx)(Mb,{children:(0,H.jsx)(KY,{$expandedOpen:r!==null&&(r.kind===`AllJobs`||r.kind===`Job`)})}),(0,H.jsx)(Lb,{primary:`Specify Job`})]})}),(0,H.jsx)(zp,{in:r!==null&&(r.kind===`AllJobs`||r.kind===`Job`),timeout:`auto`,children:(0,H.jsx)(JY,{newMaterialTy:e,jobs:t.jobs,setNewMaterialTy:n,curCollapse:r,setCurCollapse:i,indent:!0})})]})}function XY({newMaterialTy:e,setNewMaterialTy:t,toQueue:n}){let r=R(kI),i=R(TI),[a,o]=(0,L.useState)(null),s=$q(n);return i||r===null||n===null?null:s.castings.length===0&&s.jobs.length===0?(0,H.jsxs)(`div`,{children:[`No jobs are currently scheduled for `,n]}):s.jobs.length===0?(0,H.jsx)(qY,{newMaterialTy:e,setNewMaterialTy:t,castings:s.castings}):s.castings.length===0?(0,H.jsx)(JY,{jobs:s.jobs,newMaterialTy:e,setNewMaterialTy:t,curCollapse:a,setCurCollapse:o}):(0,H.jsx)(YY,{options:s,newMaterialTy:e,setNewMaterialTy:t,curCollapse:a,setCurCollapse:o})}function ZY({selectedQueue:e,setSelectedQueue:t,queueNames:n}){let r=(0,L.useRef)(null);return(0,L.useEffect)(()=>{r.current?.scrollIntoView({behavior:`smooth`,block:`end`})},[r]),(0,H.jsxs)(`div`,{ref:r,children:[(0,H.jsx)(`p`,{children:`Select a queue`}),(0,H.jsx)(pb,{children:n.map((n,r)=>(0,H.jsx)(vb,{selected:n===e,onClick:()=>t(n),children:n},r))})]})}function QY({enteredOperator:e,setEnteredOperator:t}){return R(br).requireOperatorNamePromptWhenAddingMaterial?(0,H.jsx)(`div`,{style:{marginLeft:`1em`},children:(0,H.jsx)(Kw,{fullWidth:!0,label:`Operator`,value:e||``,required:!0,onChange:e=>t(e.target.value)})}):null}function $Y({st:e,queueNames:t,setState:n}){return GY(t)?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(cW,{}),t.length>1?(0,H.jsx)(ZY,{selectedQueue:e.toQueue,setSelectedQueue:t=>{n({toQueue:t,newMaterialTy:null,enteredOperator:e.enteredOperator})},queueNames:t}):void 0,(0,H.jsx)(XY,{newMaterialTy:e.newMaterialTy,toQueue:t.length>1?e.toQueue:t[0]??null,setNewMaterialTy:t=>n({...e,newMaterialTy:t})}),(0,H.jsx)(QY,{enteredOperator:e.enteredOperator,setEnteredOperator:t=>n({...e,enteredOperator:t})})]}):null}function eX({st:{enteredOperator:e,newMaterialTy:t,toQueue:n},queueNames:r,onClose:i}){let a=R(br),o=R(jO),s=z(SI),c=R(kI),l=R(AI),u=R(TI),d=R(OI),f=R(PI),[p,m]=BI(),[h,g]=jie(),[_,v]=VI(),[y,b]=(0,L.useState)(null);if(!GY(r))return null;n===null&&r.length===1&&(n=r[0]);let x=``;if(u!==null){if(f&&f.process>=f.totalNumProcesses)return null;x=` To Run Process `+((f?.process??0)+1).toString()}else t?.kind===`JobAndProc`&&t?.last_proc!==void 0&&(x=` To Run Process `+(t.last_proc+1).toString()),t?.kind===`RawMat`&&t?.rawMatName&&(x=` As `+t.rawMatName);let S=``;!u&&c&&c!==``&&(S=` With Serial `+c);let C=d?.location.currentQueue??null;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{title:n===null?`Select a queue to add the material to`:a.requireOperatorNamePromptWhenAddingMaterial&&(e===null||e===``)?`Please enter an operator name`:``,children:(0,H.jsx)(`span`,{children:(0,H.jsx)(Y,{color:`primary`,disabled:n===null||m||g||v||u===null&&t===null||a.requireOperatorNamePromptWhenAddingMaterial&&(e===null||e===``),onClick:async()=>{b(null);try{u?await p({materialId:u.materialID,queue:n??``,queuePosition:-1,operator:e??o}):t&&t.kind===`JobAndProc`&&t.jobUnique?await h({jobUnique:t.jobUnique,lastCompletedProcess:t.last_proc,serial:c??void 0,workorder:l??t?.workorder,queue:n??``,queuePosition:-1,operator:e??o}):t&&t.kind===`RawMat`&&t.rawMatName&&await _({casting:t.rawMatName,quantity:1,queue:n??``,serials:c?[c]:void 0,workorder:l,operator:e??o}),s(null),i()}catch(e){b(Bt.isApiException(e)?e.response:e instanceof Error?e.message:String(e))}},children:n===null?`Add to Queue`:(0,H.jsxs)(`span`,{children:[C===null?`Add To`:`Move From ${C} To`,` `,n,S,x]})})})}),y?(0,H.jsx)(`p`,{role:`alert`,children:y}):null]})}function tX(e,t){let n=t.jobs[e.jobUnique];if(!n)return!1;let r=n.procsAndPaths[e.process-1]?.paths[e.path-1];return r?e.process===n.procsAndPaths.length||!!r.outputQueue:!1}function nX(){let e=R(br),t=R(OI),n=R(NO);if(t===null||t.materialID<0||UU(t)||t.quarantineAfterUnload)return null;let r=e.quarantineQueue?.length?e.quarantineQueue:null,i=Q.ofObject(n.jobs).flatMap(([e,t])=>t.procsAndPaths).flatMap(e=>e.paths).flatMap(e=>{let t=[];return e.inputQueue!==void 0&&t.push(e.inputQueue),e.outputQueue!==void 0&&t.push(e.outputQueue),t}).concat(Q.ofObject(n.queues).filter(([,e])=>e.role===lt.RawMaterial||e.role===lt.InProcessTransfer).map(([e,t])=>e)).toRSet(e=>e),a=Q.ofObject(n.queues).filter(([e,t])=>!i.has(e)).toRSet(([e,t])=>e);if(t.location.type===at.InQueue&&t.location.currentQueue&&a.has(t.location.currentQueue))return{type:`Remove`,material:t,quarantineQueueDestination:null,canRemoveFromQueues:!1};let o=null;switch(t.location.type){case at.OnPallet:case at.InBasket:if(!GU(t)||!tX(t,n))return null;o=`SignalForScrap`;break;case at.InQueue:if(!KU(t)||t.location.currentQueue===void 0||a.has(t.location.currentQueue))return null;o=`Scrap`;break;case at.Free:return null}return o?{type:o,material:t,quarantineQueueDestination:r,canRemoveFromQueues:t.location.type===at.InQueue&&t.location.currentQueue!==void 0&&!a.has(t.location.currentQueue)&&qU(t)}:null}function rX({material:e,removeFromQueues:t,removing:n}){let[r,i]=(0,L.useState)(!1),[a,o]=(0,L.useState)(null),s=z(SI);async function c(){o(null);try{await t(),i(!1),s({type:`MatSummary`,summary:{materialID:e.materialID,partName:e.partName,serial:e.serial}})}catch(e){o(Bt.isApiException(e)?e.response:e instanceof Error?e.message:String(e))}}function l(){o(null),i(!0)}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{title:`Remove from the current queue so it can be rescanned`,children:(0,H.jsx)(Y,{color:`primary`,disabled:n,onClick:l,children:`Remove from Queue`})}),(0,H.jsxs)(cy,{open:r,onClose:()=>i(!1),children:[(0,H.jsx)(dy,{children:`Remove Material from Queue`}),(0,H.jsxs)(uy,{children:[(0,H.jsx)(`p`,{children:`Remove this material from its current queue. Its production history will remain available. You can scan it again to correct its history or assignment and then add it back to a queue.`}),a?(0,H.jsx)(`p`,{role:`alert`,children:a}):null]}),(0,H.jsxs)(ly,{children:[(0,H.jsx)(Y,{color:`primary`,disabled:n,onClick:c,children:`Remove from Queue`}),(0,H.jsx)(Y,{color:`secondary`,disabled:n,onClick:()=>i(!1),children:`Cancel`})]})]})]})}function iX({onClose:e,ignoreOperator:t}){let[n,r]=(0,L.useState)(!1),[i,a]=(0,L.useState)(``),[o,s]=(0,L.useState)(null),[c,l]=(0,L.useState)(!1),[u,d]=(0,L.useState)(null),f=nX(),[p,m]=Oie(),[h,g]=kie(),[_,v]=Aie(),y=R(jO),b=t?null:y,x=z(SI),S=f===null?null:{material:f.material,materialId:f.material.materialID,operation:f.type===`SignalForScrap`?`DeferredQuarantine`:f.type===`Scrap`?`DirectQuarantine`:`RemoveFromSystem`,destination:f.quarantineQueueDestination,operator:b},C=u??S;function w(){S!==null&&(s(null),a(``),d(S),r(!0))}function T(){c||(r(!1),d(null))}if(C===null)return null;let E,D;switch(C.operation){case`RemoveFromSystem`:E=`Remove from system`,D=`Remove`;break;case`DirectQuarantine`:E=C.destination?`Move to ${C.destination}`:`Remove from queue and treat as scrap`,D=C.destination?`Quarantine`:`Scrap`;break;case`DeferredQuarantine`:E=C.destination?`The current automated operation will continue. When the material leaves automation control, move it to ${C.destination}`:`The current automated operation will continue. When the material leaves automation control, remove it from normal production flow as scrap`,D=C.destination?`Quarantine`:`Scrap`;break}async function O(){if(u!==null){l(!0),s(null);try{switch(u.operation){case`DeferredQuarantine`:await h(u.materialId,u.operator,i);break;case`DirectQuarantine`:await _(u.materialId,u.operator,i);break;case`RemoveFromSystem`:await p(u.materialId,u.operator);break}r(!1),d(null),a(``),u.operation===`RemoveFromSystem`?x({type:`MatSummary`,summary:{materialID:u.materialId,partName:u.material.partName,serial:u.material.serial}}):(x(null),e?.())}catch(e){s(Bt.isApiException(e)?e.response:e instanceof Error?e.message:String(e))}finally{l(!1)}}}let ee=c||(C.operation===`DeferredQuarantine`?g:C.operation===`DirectQuarantine`?v:m),te=f?.canRemoveFromQueues===!0?()=>p(f.material.materialID,b):null;return(0,H.jsxs)(H.Fragment,{children:[f?(0,H.jsx)(X,{title:E,children:(0,H.jsx)(Y,{color:`primary`,disabled:ee,onClick:w,children:D})}):null,te&&f?(0,H.jsx)(rX,{material:f.material,removeFromQueues:te,removing:m}):null,(0,H.jsxs)(cy,{open:n&&u!==null,onClose:T,children:[(0,H.jsx)(dy,{children:`Quarantine Material`}),(0,H.jsxs)(uy,{children:[(0,H.jsx)(`p`,{children:E}),(0,H.jsx)(Kw,{label:`Reason`,value:i,onChange:e=>a(e.target.value),fullWidth:!0,autoFocus:!0,multiline:!0}),o?(0,H.jsx)(`p`,{role:`alert`,children:o}):null]}),(0,H.jsxs)(ly,{children:[(0,H.jsx)(Y,{color:`primary`,disabled:ee,onClick:O,children:D}),(0,H.jsx)(Y,{color:`secondary`,disabled:ee,onClick:T,children:`Cancel`})]})]})]})}function aX({onClose:e,ignoreOperator:t=!1}){let n=R(OI),r=R(NO),i=R(jO),a=z(SI),[o,s]=(0,L.useState)(!1),[c,l]=(0,L.useState)(``),[u,d]=(0,L.useState)(!1),[f,p]=(0,L.useState)(null),[m,h]=(0,L.useState)(null),g=n?.action.loadCancellationId??null,_=n===null||g===null||!WU(n)?null:{material:n,cancellationId:g,group:Q.of(r.material).filter(e=>e.action.loadCancellationId===g).toRArray()};if(_===null&&m===null)return null;async function v(){if(m!==null){d(!0),p(null);try{await Ut.cancelLoad(m.material.materialID,t?null:i,new jt({expectedLoadCancellationId:m.cancellationId,reason:c||void 0})),a(null),e?.()}catch(e){p(Bt.isApiException(e)?e.response:e instanceof Error?e.message:String(e))}finally{d(!1)}}}return(0,H.jsxs)(H.Fragment,{children:[_?(0,H.jsx)(X,{title:`Cancel the displayed load instruction`,children:(0,H.jsx)(Y,{color:`primary`,disabled:u,onClick:()=>{h(_),l(``),p(null),s(!0)},children:`Cancel Load`})}):null,(0,H.jsxs)(cy,{open:o&&m!==null,onClose:()=>s(!1),children:[(0,H.jsx)(dy,{children:`Cancel Load`}),(0,H.jsxs)(uy,{children:[(0,H.jsx)(`p`,{children:`The displayed load instruction will be cancelled and recalculated for:`}),(0,H.jsx)(`ul`,{children:m?.group.map(e=>(0,H.jsx)(`li`,{children:e.serial||`Material ID ${e.materialID}`},e.materialID))}),(0,H.jsx)(Kw,{label:`Reason (optional)`,value:c,onChange:e=>l(e.target.value),fullWidth:!0,multiline:!0}),f?(0,H.jsx)(`p`,{role:`alert`,children:f}):null]}),(0,H.jsxs)(ly,{children:[(0,H.jsx)(Y,{color:`primary`,disabled:u,onClick:v,children:`Cancel Load`}),(0,H.jsx)(Y,{color:`secondary`,disabled:u,onClick:()=>s(!1),children:`Keep Load`})]})]})]})}var oX=Q.of([V.AddToQueue,V.RemoveFromQueue,V.LoadUnloadCycle,V.MachineCycle,V.BasketLoadUnload,V.BasketCycle]).toRSet(e=>e);function sX(e,t,n){let r=iO.empty();for(let i of e)if(!(!oX.has(i.type)||_I(i)||!i.material.some(e=>e.id===t&&(n===null||e.proc>=n))))for(let e of i.material)r=r.set(e.id,e.serial??null);return r}function cX(e){let t=R(PI),n=R(wI),r=R(NO),i=R(sO),a=Object.values(n?.possibleCastingsByQueue??{}).flatMap(e=>e),o=Object.values(n?.possibleJobsByQueue??{}).flatMap(e=>e).filter(e=>e.lastCompletedProcess===0).map(e=>({jobUnique:e.jobUnique,job:r.jobs[e.jobUnique]??i.get(e.jobUnique)??null})),s=t!==null&&t.process>=1,c=a.length>0||o.length>0,l=e.st?.changeRawMat!==null&&e.st?.changeRawMat!==void 0&&a.includes(e.st.changeRawMat),u=e.st?.changeJobUnique!==null&&e.st?.changeJobUnique!==void 0&&o.some(t=>t.jobUnique===e.st?.changeJobUnique);function d(t){e.setState({updating:!1,error:null,process:t.startsWith(`proc`)?parseInt(t.substring(4)):1,changeRawMat:t.startsWith(`rawMat`)?t.substring(6):null,changeJobUnique:t.startsWith(`job`)?t.substring(3):null})}return(0,H.jsx)(Kw,{value:l?`rawMat`+e.st.changeRawMat:u?`job`+e.st.changeJobUnique:e.st?.process&&s?`proc`+e.st.process.toString():``,select:!0,onChange:e=>d(e.target.value),variant:`outlined`,label:e.st?.changeRawMat?`Change Raw Material`:e.st?.changeJobUnique?`Change Assigned Job`:e.st?.process||!c?`Invalidate Process`:s?``:`Change Assignment`,children:[s&&c?[(0,H.jsx)(m_,{children:`Invalidate Selected Process`},`procheader`)]:[],s?[(0,H.jsxs)(Hx,{value:`proc`+t.process.toString(),children:[`Invalidate Process `,t.process]},t.process),...t.process>1?[(0,H.jsx)(Hx,{value:`proc1`,children:`Invalidate All Processes`},`all`)]:[]]:[],s&&c?[(0,H.jsx)(m_,{children:`Change Material Type`},`matheader`)]:[],c?[...a.map(e=>(0,H.jsxs)(Hx,{value:`rawMat`+e,children:[`Invalidate Everything and Change to `,e]},`rawMat`+e)),...o.map(({jobUnique:e,job:t})=>(0,H.jsxs)(Hx,{value:`job`+e,children:[t?(0,H.jsx)(Mb,{children:(0,H.jsx)(XU,{part:t.partName})}):void 0,(0,H.jsx)(Lb,{primary:`Invalidate Everything and Change to Job `+e,secondary:t?.partName})]},`job`+e))]:[]]})}function lX(e){let t=R(TI),n=R(wie),r=R(NO),i=e.st!==null&&t!==null,a=(0,L.useRef)(null);if((0,L.useEffect)(()=>{a.current?.scrollIntoView({behavior:`smooth`,block:`end`})},[a,i]),!i)return(0,H.jsx)(`div`,{});let o=e.st.process!==null||e.st.changeRawMat!==null||e.st.changeJobUnique!==null,s=e.st.changeRawMat!==null||e.st.changeJobUnique!==null?null:e.st.process,c=[...o?sX(n,t.materialID,s):iO.empty()].map(([e,t])=>({materialId:e,serial:t,queued:r.material.find(t=>t.materialID===e)?.location.type===at.InQueue}));return(0,H.jsx)(J,{ref:a,sx:{display:`flex`,flexDirection:`column`,alignItems:`center`,marginTop:`1em`},children:(0,H.jsxs)(RC,{spacing:2,children:[(0,H.jsx)(`p`,{style:{maxWidth:`35em`},children:`Invalidating removes whole recorded cycle events from active material reconstruction while retaining them in the event log.`}),(0,H.jsx)(cX,{st:e.st,setState:e.setState}),c.length>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{children:`All material recorded on these events will be affected:`}),(0,H.jsx)(`ul`,{children:c.map(e=>(0,H.jsxs)(`li`,{children:[e.serial||`Material ID ${e.materialId}`,e.queued?` (currently in a queue)`:``]},e.materialId))})]}):null,e.st.error?(0,H.jsx)(`p`,{role:`alert`,children:e.st.error}):null]})})}function uX(e){let t=R(br),n=R(TI),r=R(OI),i=R(PI),a=R(wI),o=z(SI),s=R(jO);if(e.loadStation&&!t.allowInvalidateMaterialAtLoadStation||!e.loadStation&&!t.allowInvalidateMaterialOnQueuesPage||n===null||!JU(r)||!(a!==null&&(!Q.ofObject(a.possibleCastingsByQueue??{}).isEmpty()||!Q.ofObject(a.possibleJobsByQueue??{}).isEmpty()))&&(i===null||i.process<1))return null;e.ignoreOperator&&(s=null);function c(){e.setState({process:null,updating:!1,error:null,changeRawMat:null,changeJobUnique:null})}function l(){n&&(e.st?.process||e.st?.changeRawMat||e.st?.changeJobUnique)&&(e.setState({...e.st,updating:!0}),Ut.invalidatePalletCycle(n.materialID,s,e.st?.changeRawMat,e.st?.changeJobUnique,e.st?.process??0).then(t=>{t?(o({type:`MatDetails`,details:t}),e.setState(null)):(o(null),e.onClose())}).catch(t=>{e.setState({...e.st,updating:!1,error:Bt.isApiException(t)?t.response:t instanceof Error?t.message:String(t)})}))}return(0,H.jsxs)(H.Fragment,{children:[e.st===null?(0,H.jsx)(Y,{color:`primary`,onClick:c,children:`Invalidate Cycle`}):void 0,e.st===null?void 0:(0,H.jsx)(Y,{color:`primary`,onClick:l,disabled:e.st.updating||e.st.process===null&&e.st.changeRawMat===null&&e.st.changeJobUnique===null,children:e.st.changeJobUnique===null?e.st.changeRawMat===null?e.st.process===null?`Invalidate Cycle`:e.st.process===1?i&&i.process>1?`Invalidate All Processes`:`Invalidate Process 1`:`Invalidate Process `+e.st.process.toString():`Invalidate Everything and Change to `+e.st.changeRawMat:`Invalidate Everything and Change to Job `+e.st.changeJobUnique})]})}function dX(e){return e==null||e==``}function fX(e,t){return n=>{if(dX(n.serial)||n.location.type===at.OnPallet||n.process!==e.process-1)return!1;if(dX(n.jobUnique)){if(dX(n.partName)||n.partName!==e.partName&&(!t||!Q.of(t.procsAndPaths).flatMap(e=>e.paths).some(e=>e.casting===n.partName)))return!1}else if(n.jobUnique!==e.jobUnique||n.path!==e.path)return!1;return!0}}function pX(e){let t=R(NO),n=R(OI);if(n===null||e.st===null)return(0,H.jsx)(`div`,{});let r=t.jobs[n.jobUnique],i=t.material.filter(fX(n,r));return i.length===0?(0,H.jsx)(`p`,{style:{margin:`2em`},children:`No material with the same job is available for swapping. You must edit the pallet using the cell controller software to remove the material from the pallet. Insight will automatically refresh once the cell controller software is updated.`}):(0,H.jsxs)(`div`,{style:{margin:`2em`},children:[(0,H.jsx)(`p`,{children:`Swap serial on pallet with material from the same job.`}),(0,H.jsx)(`p`,{children:`If material on the pallet is from a different job, you cannot use this screen. Instead, the material must first be removed from the pallet using the cell controller software. Insight will automatically refresh when this occurs.`}),(0,H.jsx)(Kw,{value:e.st?.selectedMatToSwap?.serial??``,select:!0,onChange:t=>e.st&&e.setState({...e.st,selectedMatToSwap:i.find(e=>e.serial===t.target.value)??null}),style:{width:`20em`},variant:`outlined`,label:`Select serial to swap with `+(n.serial??``),children:i.map(e=>(0,H.jsx)(Hx,{value:e.serial,children:e.serial},e.materialID))})]})}function mX(e){let t=R(br),n=R(OI),r=z(SI),i=R(jO);if(!t.allowSwapSerialAtLoadStation||(e.ignoreOperator&&(i=null),!n||n.location.type!==at.OnPallet||UU(n)))return null;function a(){n&&e.st&&e.st.selectedMatToSwap&&n.location.type===at.OnPallet&&(e.setState({selectedMatToSwap:e.st.selectedMatToSwap,updating:!0}),Ut.swapMaterialOnPallet(n.materialID,i,{pallet:n.location.palletNum??0,materialIDToSetOnPallet:e.st.selectedMatToSwap.materialID}).catch(console.log).finally(()=>{r(null),e.onClose()}))}return(0,H.jsxs)(H.Fragment,{children:[e.st===null?(0,H.jsx)(Y,{color:`primary`,onClick:()=>e.setState({selectedMatToSwap:null,updating:!1}),children:`Swap Serial`}):void 0,e.st===null?void 0:(0,H.jsx)(Y,{color:`primary`,onClick:a,disabled:e.st.selectedMatToSwap===null||e.st.updating,children:e.st.selectedMatToSwap===null?`Swap Serial`:`Swap with `+(e.st.selectedMatToSwap.serial??``)})]})}var hX=G(Vw,{shouldForwardProp:e=>e.toString()[0]!==`$`})(({$noBorderBottom:e,$highlightedRow:t,$noncompletedRow:n})=>({...e&&{"& > *":{borderBottom:`unset`}},backgroundColor:t?`#FF8A65`:n?`#E0E0E0`:void 0})),gX=[/\bhold\b/,/\bmissing\b/,/\bwait\b/,/\bwaiting\b/,/\bnone\b/];function _X(e){let t=e.comment;return!t||t===``?!1:Q.of(gX).some(e=>e.test(t))}function vX(e){let t=(R(br).allowEditJobPlanQuantityFromQueuesPage??null)!=null,[n,r]=(0,L.useState)(!1),i=e.job,a=_X(i.job);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(hX,{$noBorderBottom:!0,$highlightedRow:a,$noncompletedRow:i.remainingToStart-i.assignedRaw>0,children:[(0,H.jsx)(Z,{children:(0,H.jsxs)(J,{sx:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(J,{sx:{mr:`0.2em`},children:(0,H.jsx)(XU,{part:i.job.partName,size:25})}),(0,H.jsx)(`div`,{children:(0,H.jsx)(q,{variant:`body2`,component:`span`,sx:{display:`block`},children:i.job.unique})})]})}),(0,H.jsx)(Z,{children:i.startingTime?i.startingTime.toLocaleString():``}),(0,H.jsx)(Z,{children:i.rawMatName===i.job.partName?i.rawMatName:(0,H.jsxs)(J,{sx:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(J,{sx:{mr:`0.2em`},children:(0,H.jsx)(XU,{part:i.rawMatName,size:25})}),(0,H.jsx)(q,{variant:`body2`,sx:{display:`block`},children:i.rawMatName})]})}),(0,H.jsxs)(Z,{children:[i.job.comment,(0,H.jsx)(X,{title:`Edit`,children:(0,H.jsx)(Um,{size:`small`,onClick:()=>e.editNote(i.job),children:(0,H.jsx)(rT,{})})})]}),(0,H.jsxs)(Z,{align:`right`,children:[i.job.cycles??0,t?(0,H.jsx)(X,{title:`Edit`,children:(0,H.jsx)(Um,{size:`small`,onClick:()=>e.editQty(i),children:(0,H.jsx)(rT,{})})}):void 0]}),(0,H.jsx)(Z,{align:`right`,children:i.remainingToStart}),(0,H.jsx)(Z,{align:`right`,children:i.assignedRaw}),(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(X,{title:i.remainingToStart>0||i.assignedRaw>0?`${i.remainingToStart} - ${i.assignedRaw}`:``,children:(0,H.jsx)(`span`,{children:Math.max(i.remainingToStart-i.assignedRaw,0)})})}),(0,H.jsx)(Z,{align:`right`,children:i.availableUnassigned}),(0,H.jsx)(Z,{children:(0,H.jsx)(X,{title:`Show Details`,children:(0,H.jsx)(Um,{size:`small`,onClick:()=>r(!n),children:n?(0,H.jsx)(mT,{}):(0,H.jsx)(dT,{})})})})]}),(0,H.jsx)(hX,{$highlightedRow:a,$noncompletedRow:i.remainingToStart-i.assignedRaw>0,children:(0,H.jsx)(Z,{sx:{pb:`0`,pt:`0`},colSpan:10,children:(0,H.jsx)(zp,{in:n,timeout:`auto`,unmountOnExit:!0,children:(0,H.jsx)(uJ,{job:i.job,checkAnalysisMonth:!1})})})})]})}function yX(e){let t=R(NO),n=(0,L.useMemo)(()=>nJ(t.jobs,t.material,e.queue),[t,e.queue]);return n.length===0?null:(0,H.jsxs)(jw,{size:`small`,children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:`Job`}),(0,H.jsx)(Z,{children:`Starting Time`}),(0,H.jsx)(Z,{children:`Material`}),(0,H.jsx)(Z,{children:`Note`}),(0,H.jsx)(Z,{align:`right`,children:`Planned Quantity`}),(0,H.jsx)(Z,{align:`right`,children:`Remaining To Start`}),(0,H.jsx)(Z,{align:`right`,children:`Assigned Raw Material`}),(0,H.jsx)(Z,{align:`right`,children:`Required`}),(0,H.jsx)(Z,{align:`right`,children:`Available Unassigned`}),(0,H.jsx)(Z,{})]})}),(0,H.jsx)(Pw,{children:n.map((t,n)=>(0,H.jsx)(vX,{job:t,editNote:e.editNote,editQty:e.editQty},n))})]})}var bX=(0,L.memo)(function({workorder:e,inProc:t}){let n=z(wX);return(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:e.workorderId}),(0,H.jsx)(Z,{children:(0,H.jsxs)(J,{sx:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(J,{sx:{mr:`0.2em`},children:(0,H.jsx)(XU,{part:e.part,size:25})}),(0,H.jsx)(q,{variant:`body2`,sx:{display:`block`},children:e.part})]})}),(0,H.jsxs)(Z,{children:[e.comments&&e.comments.length>0?e.comments[e.comments.length-1].comment:``,(0,H.jsx)(X,{title:`Edit`,children:(0,H.jsx)(Um,{size:`small`,onClick:()=>n(e),children:(0,H.jsx)(rT,{})})})]}),(0,H.jsx)(Z,{children:e.dueDate.toLocaleDateString()}),(0,H.jsx)(Z,{children:e.priority}),(0,H.jsx)(Z,{children:e.plannedQuantity}),(0,H.jsx)(Z,{children:e.completedQuantity}),(0,H.jsx)(Z,{children:t}),(0,H.jsx)(Z,{children:Math.max(0,e.plannedQuantity-e.completedQuantity-t)})]})}),xX=(0,L.memo)(function(){let e=R(NO);if(!e.workorders||e.workorders.length===0)return null;let t=Q.of(e.workorders).sortBy(e=>e.dueDate.getTime(),e=>e.priority),n=Q.of(e.material).filter(e=>!!e.workorderId&&e.workorderId!==``).toLookupMap(e=>e.workorderId??``,e=>e.partName,()=>1,(e,t)=>e+t);return(0,H.jsxs)(jw,{size:`small`,children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:`Workorder`}),(0,H.jsx)(Z,{children:`Part`}),(0,H.jsx)(Z,{children:`Comment`}),(0,H.jsx)(Z,{children:`Due Date`}),(0,H.jsx)(Z,{children:`Priority`}),(0,H.jsx)(Z,{children:`Planned Qty`}),(0,H.jsx)(Z,{children:`Completed Qty`}),(0,H.jsx)(Z,{children:`In Process`}),(0,H.jsx)(Z,{children:`Remaining To Assign`})]})}),(0,H.jsx)(Pw,{children:t.map(e=>(0,H.jsx)(bX,{workorder:e,inProc:n.get(e.workorderId)?.get(e.part)??0},`${e.workorderId}-${e.part}`))})]})}),SX=(0,L.memo)(function(e){let[t,n]=(0,L.useState)(null),r=z(FO);function i(){e.closeDialog(),n(null)}function a(){t===null||e.job===null||t===e.job.comment||(r(e.job.unique,t),i())}return(0,H.jsx)(cy,{open:e.job!==null,onClose:i,children:e.job===null?void 0:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(dy,{children:(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(`div`,{children:(0,H.jsx)(XU,{part:e.job.partName,size:40})}),(0,H.jsxs)(`div`,{style:{marginLeft:`1em`,flexGrow:1},children:[`Edit Note For `,e.job.unique]})]})}),(0,H.jsx)(uy,{children:(0,H.jsx)(Kw,{variant:`outlined`,fullWidth:!0,autoFocus:!0,value:t===null?e.job.comment||``:t,onChange:e=>n(e.target.value),onKeyDown:e=>{e.keyCode===13&&t!==null&&(a(),e.preventDefault())}})}),(0,H.jsxs)(ly,{children:[(0,H.jsx)(Y,{color:`primary`,disabled:t===null,onClick:a,children:`Save Note`}),(0,H.jsx)(Y,{color:`primary`,onClick:i,children:`Cancel`})]})]})})}),CX=(0,L.memo)(function(e){let[t,n]=(0,L.useState)(!1),[r,i]=(0,L.useState)(null),a=R(br).allowEditJobPlanQuantityFromQueuesPage??null;function o(){t||(e.closeDialog(),i(null))}async function s(){if(!(a===null||e.job===null||r==null||isNaN(r))){n(!0);try{await fetch(a,{method:`PUT`,headers:new Headers({"Content-Type":`application/json`}),body:JSON.stringify({Unique:e.job.job.unique,Quantity:r})}),e.closeDialog(),i(null)}finally{n(!1)}}}return(0,H.jsx)(cy,{open:a!=null&&e.job!==null,onClose:o,children:e.job===null?void 0:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(dy,{children:(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(`div`,{children:(0,H.jsx)(XU,{part:e.job.job.partName,size:40})}),(0,H.jsxs)(`div`,{style:{marginLeft:`1em`,flexGrow:1},children:[`Edit Planned Quantity For `,e.job.job.unique]})]})}),(0,H.jsxs)(uy,{children:[(0,H.jsxs)(`p`,{children:[e.job.job.cycles,` currently planned, `,e.job.remainingToStart,` remaining to start`]}),(0,H.jsx)(Kw,{variant:`outlined`,fullWidth:!0,autoFocus:!0,type:`number`,value:r===null?``:r,onChange:e=>i(parseInt(e.target.value)),slotProps:{htmlInput:{style:{textAlign:`right`},min:(e.job.job.cycles??0)-e.job.remainingToStart}}})]}),(0,H.jsxs)(ly,{children:[(0,H.jsxs)(Y,{color:`primary`,disabled:t||r===null||isNaN(r),onClick:()=>void s(),children:[t?(0,H.jsx)(Lm,{size:10}):void 0,`Set Quantity`]}),(0,H.jsx)(Y,{color:`primary`,disabled:t,onClick:o,children:`Cancel`})]})]})})}),wX=P(null);function TX(){let[e,t]=B(wX),[n,r]=(0,L.useState)(null),i=z(IO);function a(){t(null),r(null)}function o(){e&&n&&n!==``&&i({workorder:e.workorderId,comment:n}),a()}return(0,H.jsx)(cy,{open:e!==null,onClose:a,children:e===null?void 0:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(dy,{children:(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(`div`,{children:(0,H.jsx)(XU,{part:e.part,size:40})}),(0,H.jsxs)(`div`,{style:{marginLeft:`1em`,flexGrow:1},children:[`Add Comment For `,e.workorderId]})]})}),(0,H.jsxs)(uy,{children:[(0,H.jsx)(`ul`,{children:(e.comments??[]).map((e,t)=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(q,{variant:`body1`,children:[e.timeUTC.toLocaleString(),`: `,e.comment]})},t))}),(0,H.jsx)(Kw,{variant:`outlined`,sx:{mt:`1em`},fullWidth:!0,autoFocus:!0,value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&n!==null&&n!==``&&(o(),e.preventDefault())}})]}),(0,H.jsxs)(ly,{children:[(0,H.jsx)(Y,{color:`primary`,onClick:o,children:`Save Comment`}),(0,H.jsx)(Y,{color:`primary`,onClick:a,children:`Cancel`})]})]})})}var EX=(0,L.memo)(function(e){let t=R(br),n=z(IY),r=z(UY),i=z(Uq);if(!t.addToQueueButton||t.addToQueueButton===Oe.DoNotShow)return null;function a(){switch(t.addToQueueButton){case Oe.DoNotShow:return;case Oe.AddBulkUnassigned:e.rawMatQueue?n(e.label):r(e.label);break;case Oe.LookupExistingSerial:r(e.label);return;case Oe.ManualBarcodeScan:i(e.label);return}}return e.rawMatQueue?(0,H.jsx)(X,{title:`Add Raw Material`,children:(0,H.jsx)(hy,{color:`secondary`,onClick:a,size:`large`,style:{marginBottom:`-30px`,zIndex:1},children:(0,H.jsx)(Yw,{})})}):e.inProcQueue?(0,H.jsx)(X,{title:`Add Material`,children:(0,H.jsx)(hy,{color:`secondary`,onClick:a,size:`medium`,style:{marginBottom:`-30px`,zIndex:1},children:(0,H.jsx)(sre,{fontSize:`inherit`})})}):null});function DX(e){let t=R(SI);return t&&t.type===`AddMatWithEnteredSerial`||t&&t.type===`Barcode`&&t.toQueue?e.includes(t.toQueue)?[t.toQueue]:[]:e}var OX=(0,L.memo)(function({queueNames:e}){let[t,n]=(0,L.useState)({toQueue:null,enteredOperator:null,newMaterialTy:null}),[r,i]=(0,L.useState)(null),a=(0,L.useCallback)(()=>{n({toQueue:null,enteredOperator:null,newMaterialTy:null}),i(null)},[]);return e=DX(e),(0,H.jsx)(TW,{allowNote:!0,onClose:a,highlightProcsGreaterOrEqualTo:r?.process??void 0,extraDialogElements:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(lX,{st:r,setState:i}),(0,H.jsx)($Y,{queueNames:e,st:t,setState:n})]}),buttons:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(FY,{}),(0,H.jsx)(iX,{onClose:a}),(0,H.jsx)(aX,{onClose:a}),(0,H.jsx)(uX,{onClose:a,st:r,setState:i}),(0,H.jsx)(eX,{st:t,queueNames:e,onClose:a})]})})}),kX=e=>{let t=R(jO),n=R(NO),r=R(CL),i=R(TL),a=(0,L.useMemo)(()=>rJ(e.queues,n,r,i),[n,e.queues,r,i]),o=!Q.ofObject(n.jobs).isEmpty(),[s,c]=(0,L.useState)(null),l=(0,L.useCallback)(()=>c(null),[]),[u,d]=(0,L.useState)(null),f=(0,L.useCallback)(()=>d(null),[]),[p,m]=(0,L.useState)(null),h=(0,L.useCallback)(()=>m(null),[]);return(0,H.jsxs)(J,{sx:{padding:`8px`,width:`100%`},children:[a.map((e,t)=>(0,H.jsx)(`div`,{style:t<a.length-1?{borderBottom:`1px solid black`}:void 0,children:(0,H.jsx)(pJ,{matIds:e.material.map(e=>e.materialID),direction:`rect`,queueName:e.label,renderDragOverlay:t=>(0,H.jsx)(pW,{mat:t,hideEmptySerial:!0,displayJob:o&&e.rawMaterialQueue,fsize:`normal`}),children:(0,H.jsxs)(J,{sx:{minHeight:`134px`},children:[(0,H.jsxs)(J,{sx:{display:`flex`,margin:`4px`},children:[(0,H.jsx)(q,{variant:`h4`,sx:{flexGrow:1},children:e.label}),e.free?void 0:(0,H.jsx)(EX,{label:e.label,rawMatQueue:e.rawMaterialQueue,inProcQueue:e.inProcQueue})]}),(0,H.jsxs)(J,{sx:{justifyContent:`flex-start`,display:`flex`,flexWrap:`wrap`},children:[e.material.map((t,n)=>(0,H.jsx)(fW,{mat:t,hideEmptySerial:!0,fsize:`normal`,displayJob:o&&e.rawMaterialQueue},n)),e.groupedRawMat&&e.groupedRawMat.length>0?e.groupedRawMat.map((n,r)=>n.material.length===1?(0,H.jsx)(dW,{mat:n.material[0],hideEmptySerial:!0,fsize:`normal`,displayJob:o&&e.rawMaterialQueue},r):(0,H.jsx)(mW,{partOrCasting:n.partOrCasting,assignedJobUnique:n.assignedJobUnique,material:n.material,fsize:`normal`,onOpen:()=>m(n.material)},t)):void 0,e.rawMaterialQueue?o?(0,H.jsx)(yX,{queue:e.label,editNote:c,editQty:d}):(0,H.jsx)(xX,{}):void 0]})]})})},t)),(0,H.jsx)(OX,{queueNames:e.queues}),(0,H.jsx)(WY,{}),(0,H.jsx)(Wq,{}),(0,H.jsx)(BY,{}),(0,H.jsx)(SX,{job:s,closeDialog:l}),(0,H.jsx)(CX,{job:u,closeDialog:f}),(0,H.jsx)(TX,{}),(0,H.jsx)(VY,{material:p,closeDialog:h,operator:t})]})};function AX(e){return JI(`Queues`),(0,H.jsx)(J,{component:`main`,sx:{backgroundColor:`#F8F8F8`,minHeight:{xs:`calc(100vh - 64px - 32px)`,sm:`calc(100vh - 64px - 40px)`,md:`calc(100vh - 64px)`}},children:(0,H.jsx)(kX,{...e})})}var jX=G(Vw,{shouldForwardProp:e=>e.toString()[0]!==`$`})(e=>({"& > *":{borderBottom:`unset`},...e.$darkRow&&{backgroundColor:`#F5F5F5`}})),MX=G(Vw,{shouldForwardProp:e=>e.toString()[0]!==`$`})(e=>({...e.$darkRow&&{backgroundColor:`#F5F5F5`}}));function NX(e){let[t,n]=(0,L.useState)(!1),r=10;e.showMaterial&&(r+=1);let i=e.job;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(jX,{$darkRow:e.showDarkRow&&i.darkRow,children:[(0,H.jsx)(Z,{children:i.routeStartTime.toLocaleString()}),(0,H.jsx)(Z,{children:(0,H.jsxs)(J,{sx:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(J,{sx:{mr:`0.2em`},children:(0,H.jsx)(XU,{part:i.partName,size:25})}),(0,H.jsx)(`div`,{children:(0,H.jsx)(q,{variant:`body2`,component:`span`,sx:{display:`block`},children:i.partName})})]})}),e.showMaterial?(0,H.jsx)(Z,{children:i.casting?(0,H.jsxs)(J,{sx:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(J,{sx:{mr:`0.2em`},children:(0,H.jsx)(XU,{part:i.casting,size:25})}),(0,H.jsx)(q,{variant:`body2`,sx:{display:`block`},children:i.casting})]}):void 0}):void 0,(0,H.jsxs)(Z,{children:[i.comment,(0,H.jsx)(X,{title:`Edit`,children:(0,H.jsx)(Um,{size:`small`,onClick:()=>e.setCurEditNoteJob(i),children:(0,H.jsx)(rT,{})})})]}),(0,H.jsx)(Z,{children:i.inProcJob===null?`Archived`:`Active`}),(0,H.jsx)(Z,{align:`right`,children:i.scheduledQty}),(0,H.jsx)(Z,{align:`right`,sx:{backgroundColor:i.decrementedQty>0?`#FF8A65`:void 0},children:i.decrementedQty}),(0,H.jsx)(Z,{align:`right`,children:i.completedQty}),(0,H.jsx)(Z,{align:`right`,children:i.inProcessQty}),(0,H.jsx)(Z,{align:`right`,children:i.remainingQty}),(0,H.jsx)(Z,{children:(0,H.jsx)(X,{title:`Show Details`,children:(0,H.jsx)(Um,{size:`small`,onClick:()=>n(!t),children:t?(0,H.jsx)(mT,{}):(0,H.jsx)(dT,{})})})})]}),(0,H.jsx)(MX,{$darkRow:e.showDarkRow&&i.darkRow,children:(0,H.jsx)(Z,{sx:{pb:`0`,pt:`0`},colSpan:r,children:(0,H.jsx)(zp,{in:t,timeout:`auto`,unmountOnExit:!0,children:(0,H.jsx)(uJ,{job:i.inProcJob?i.inProcJob:i.historicJob,checkAnalysisMonth:!1})})})})]})}function PX(e,t,n,r){let i;switch(t){case 0:i=e=>e.routeStartTime.getTime();break;case 1:i=e=>e.partName;break;case 2:i=e=>e.casting;break;case 3:i=e=>e.comment??null;break;case 4:i=e=>e.scheduledQty;break;case 5:i=e=>e.decrementedQty;break;case 6:i=e=>e.completedQty;break;case 7:i=e=>e.inProcessQty;break;case 8:i=e=>e.remainingQty;break}return(r?Q.of(e):Q.of(e).filter(e=>e.inProcJob!==null)).toSortedArray(n===`asc`?{asc:i}:{desc:i})}function FX(e){return(0,H.jsx)(X,{title:`Sort`,enterDelay:300,children:(0,H.jsx)(Z,{align:e.align,sortDirection:e.sortBy===e.col&&e.order,children:(0,H.jsx)(Uw,{active:e.sortBy===e.col,direction:e.order,onClick:()=>{e.col===e.sortBy?e.setOrder(e.order===`asc`?`desc`:`asc`):(e.setSortBy(e.col),e.setOrder(`asc`))},children:e.children})})})}var IX=(0,L.memo)(function(e){let t={sortBy:e.sortBy,setSortBy:e.setSortBy,order:e.order,setOrder:e.setOrder};return(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(FX,{align:`left`,col:0,...t,children:`Date`}),(0,H.jsx)(FX,{align:`left`,col:1,...t,children:`Part`}),e.showMaterial?(0,H.jsx)(FX,{align:`left`,col:2,...t,children:`Material`}):void 0,(0,H.jsx)(FX,{align:`left`,col:3,...t,children:`Note`}),(0,H.jsxs)(Z,{align:`left`,children:[`Active`,(0,H.jsx)(X,{title:e.showArchived?`Hide Archived`:`Show Archived`,children:(0,H.jsx)(Um,{size:`small`,onClick:t=>{e.setShowArchived(e=>!e),t.stopPropagation()},children:e.showArchived?(0,H.jsx)(TT,{}):(0,H.jsx)(ET,{})})})]}),(0,H.jsx)(FX,{align:`right`,col:4,...t,children:`Scheduled`}),(0,H.jsx)(FX,{align:`right`,col:5,...t,children:`Removed`}),(0,H.jsx)(FX,{align:`right`,col:6,...t,children:`Completed`}),(0,H.jsx)(FX,{align:`right`,col:7,...t,children:`In Process`}),(0,H.jsx)(FX,{align:`right`,col:8,...t,children:`Remaining To Run`}),(0,H.jsx)(Z,{children:(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{style:{height:`25px`,paddingTop:0,paddingBottom:0},onClick:()=>qq(e.jobs,e.showMaterial),size:`large`,children:(0,H.jsx)(uT,{})})})})]})})}),LX=(0,L.memo)(function(){let[e,t]=(0,L.useState)(null),[n,r]=(0,L.useState)(0),[i,a]=(0,L.useState)(`desc`),[o,s]=(0,L.useState)(!0),c=R(fL),l=R(sO),u=R(NO),d=(0,L.useMemo)(()=>{for(let[,e]of l)for(let t of e.procsAndPaths[0]?.paths??[])if(t.casting!==null&&t.casting!==void 0&&t.casting!==``)return!0;return!1},[l]),f=(0,L.useMemo)(()=>Gq({start:LT(cE(),-6),end:LT(cE(),1)},c.matsById,l,u),[c.matsById,l,u]),p=(0,L.useMemo)(()=>PX(f,n,i,o),[f,n,i,o]);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(jw,{stickyHeader:!0,children:[(0,H.jsx)(IX,{jobs:f,showMaterial:d,sortBy:n,setSortBy:r,order:i,setOrder:a,showArchived:o,setShowArchived:s}),(0,H.jsx)(Pw,{children:p.map((e,r)=>(0,H.jsx)(NX,{job:e,showDarkRow:n===0,showMaterial:d,setCurEditNoteJob:t},e.inProcJob?.unique??e.historicJob?.unique??r))})]}),(0,H.jsx)(SX,{job:e?.historicJob??null,closeDialog:()=>t(null)})]})});function RX(){return JI(`Scheduled Jobs`),(0,H.jsx)(`main`,{style:{padding:`24px`},children:(0,H.jsx)(LX,{})})}var zX=`__FMS_INSIGHT_LOAD_STATION_BIN__`,BX=`__FMS_INSIGHT_PALLETS_BIN__`,VX=`__FMS_INSIGHT_ACTIVE_QUEUE_BIN__`,HX=`__FMS_INSIGHT_BASKETS_BIN__`,UX=SO(`material-bins`,[]);function WX(e,t,n){let r=Array.from(e),[i]=r.splice(t,1);return r.splice(n,0,i),r}function GX(e,t,n){let r=e.get(t);r?r.push(n):e.set(t,[n])}var KX=function(e){return e.LoadStations=`Bin_LoadStations`,e.Pallets=`Bin_Pallets`,e.ActiveQueues=`Bin_ActiveQueues`,e.Baskets=`Bin_Baskets`,e.QuarantineQueues=`Bin_Quarantine`,e}({});function qX(e){let t;return t=e.position.locationTitle&&e.position.locationTitle.length>0?e.position.locationTitle:e.position.location+` `+e.position.locationNum.toString(),e.position.zone&&(t+=`-${e.position.zone}`),t}function JX(e,t){let n=new Map,r=new Map,i=new Map,a=new Map,o=Q.ofObject(e.pallets).toRMap(([,e])=>[e.palletNum,e.palletNum.toString()+` (`+e.currentPalletLocation.group+` #`+e.currentPalletLocation.num.toString()+`)`]);for(let t of e.material)switch(t.location.type){case at.InQueue:if(t.action.type===st.Loading){let r=e.pallets[t.action.loadOntoPalletNum??0];if(r&&r.currentPalletLocation.loc===nt.LoadUnload){let e=r.currentPalletLocation.num;GX(n,e,t)}else GX(i,t.location.currentQueue||`Queue`,t)}else GX(i,t.location.currentQueue||`Queue`,t);break;case at.OnPallet:if(t.location.palletNum){let i=e.pallets[t.location.palletNum];i.currentPalletLocation.loc===nt.LoadUnload?GX(n,i.currentPalletLocation.num,t):GX(r,o.get(t.location.palletNum)??``,t)}else GX(r,`Pallet`,t);break;case at.Free:switch(t.action.type){case st.Loading:{let r=e.pallets[t.action.loadOntoPalletNum??0]?.currentPalletLocation.num;GX(n,r,t);break}case st.LoadingToBasket:{let r=e.baskets?.[t.action.loadToBasketId??0];r?.position.location===_t.LoadUnload?GX(n,r.position.locationNum,t):GX(i,`Free Material`,t);break}default:GX(i,`Free Material`,t);break}break;case at.InBasket:t.location.basketId!==void 0&&GX(a,t.location.basketId,t);break}let s=Q.ofObject(e.jobs).flatMap(([e,t])=>t.procsAndPaths).flatMap(e=>e.paths).flatMap(e=>{let t=[];return e.inputQueue!==void 0&&t.push(e.inputQueue),e.outputQueue!==void 0&&t.push(e.outputQueue),t}).concat(Q.ofObject(e.queues).filter(([,e])=>e.role===lt.RawMaterial||e.role===lt.InProcessTransfer).map(([e,t])=>e)).toRSet(e=>e),c=Q.ofObject(e.queues).filter(([e,t])=>!s.has(e)).toRSet(([e,t])=>e),l=t.filter(e=>e===`__FMS_INSIGHT_LOAD_STATION_BIN__`||e===`__FMS_INSIGHT_PALLETS_BIN__`||e===`__FMS_INSIGHT_ACTIVE_QUEUE_BIN__`||e===`__FMS_INSIGHT_BASKETS_BIN__`||c.has(e));l.indexOf(`__FMS_INSIGHT_ACTIVE_QUEUE_BIN__`)<0&&l.unshift(VX),a.size>0&&l.indexOf(`__FMS_INSIGHT_BASKETS_BIN__`)<0&&l.unshift(HX),l.indexOf(`__FMS_INSIGHT_PALLETS_BIN__`)<0&&l.unshift(BX),l.indexOf(`__FMS_INSIGHT_LOAD_STATION_BIN__`)<0&&l.unshift(zX);for(let e of Q.of(c).sortBy(e=>e))l.indexOf(e)<0&&l.push(e);return l.map(t=>{if(t===`__FMS_INSIGHT_LOAD_STATION_BIN__`)return{type:`Bin_LoadStations`,binId:zX,byLul:n};if(t===`__FMS_INSIGHT_PALLETS_BIN__`)return{type:`Bin_Pallets`,binId:BX,byPallet:r};if(t===`__FMS_INSIGHT_ACTIVE_QUEUE_BIN__`)return{type:`Bin_ActiveQueues`,binId:VX,byQueue:Q.of(s).toRMap(e=>{let t=i.get(e)??[];return t.sort((e,t)=>(e.location.queuePosition??0)-(t.location.queuePosition??0)),[e,t]},(e,t)=>e.concat(t))};if(t===`__FMS_INSIGHT_BASKETS_BIN__`)return{type:`Bin_Baskets`,binId:HX,byBasket:new Map(a),basketLocations:Q.ofObject(e.baskets??{}).collect(([e,t])=>parseInt(e)>0?[parseInt(e),qX(t)]:null).toRMap(e=>e)};{let e=t,n=i.get(e)??[];return n.sort((e,t)=>(e.location.queuePosition??0)-(t.location.queuePosition??0)),{type:`Bin_Quarantine`,binId:e,queueName:e,material:n}}})}function YX(e,t,n,r){return e.map(e=>{switch(e.type){case`Bin_Quarantine`:if(e.queueName===n){let n=e.material.filter(e=>e.materialID!==t.materialID);return n.splice(r,0,t),{...e,material:n}}else return{...e,material:e.material.filter(e=>e.materialID!==t.materialID)};default:return e}})}function XX(e,t){for(let n of t)switch(n.type){case`Bin_Quarantine`:for(let t=0;t<n.material.length;t++)if(n.material[t].materialID===e)return{bin:n,idx:t};break;default:break}return null}function ZX(e,t){for(let n of t)if(n.type===`Bin_Quarantine`&&n.queueName===e)return{bin:n,idx:0};return null}var QX=(0,L.forwardRef)(function(e,t){return(0,H.jsxs)(J,{sx:{margin:e.isDragOverlay?void 0:`0.75em`,opacity:e.isActiveDrag?.2:1,border:`1px solid black`,padding:`4px`},ref:t,...e.dragRootProps,children:[(0,H.jsx)(J,{role:`button`,tabIndex:0,sx:{cursor:e.isDragOverlay?`grabbing`:`grab`},...e.dragHandleProps,children:(0,H.jsx)(q,{variant:`h4`,children:e.label})}),(0,H.jsx)(J,{sx:{display:`flex`,flexDirection:`column`,flexWrap:`nowrap`,width:`18em`,minHeight:`20em`},children:e.children})]})});function $X(e){let t={type:`container`,bin:e.bin},{active:n,isDragging:r,attributes:i,listeners:a,setNodeRef:o,setActivatorNodeRef:s,transform:c,transition:l}=TU({id:e.binId,data:t}),u={...a};for(let[e,t]of Object.entries(i))e.startsWith(`aria`)&&(u[e]=t);let d={transform:c?`translate3d(${Math.round(c.x)}px, ${Math.round(c.y)}px, 0)`:void 0,transition:n===null?void 0:l};return(0,H.jsx)(QX,{ref:o,dragRootProps:{style:d},dragHandleProps:u,setDragHandleRef:s,isActiveDrag:r,...e})}var eZ=(0,L.memo)(function(e){return e.isDragOverlay?(0,H.jsx)(QX,{binId:e.binId,label:e.queue,isDragOverlay:!0,children:e.material.map(e=>(0,H.jsx)(dW,{mat:e,hideAvatar:!0,showHandle:!0},e.materialID))}):(0,H.jsx)($X,{binId:e.binId,label:e.queue,bin:e.bin,children:(0,H.jsx)(_U,{items:e.material.map(e=>e.materialID),strategy:pU,children:e.material.map(e=>(0,H.jsx)(fW,{mat:e,hideAvatar:!0},e.materialID))})})});function tZ(e,t){return e-t}function nZ(e){return`Pallet `+e}function rZ(e,t){let n=parseInt(e),r=parseInt(t);return isNaN(n)||isNaN(r)?e.localeCompare(t):n-r}function iZ(e){return e}function aZ(e,t){return e.localeCompare(t)}function oZ(e,t){return e-t}var sZ=class extends L.PureComponent{render(){return(0,H.jsx)(this.props.isDragOverlay?QX:$X,{label:this.props.name,binId:this.props.binId,bin:this.props.bin,isDragOverlay:this.props.isDragOverlay,children:Q.of(this.props.material).sortWith(([e,t],[n,r])=>this.props.compareLabel(e,n)).map(([e,t],n)=>(0,H.jsxs)(`div`,{children:[(0,H.jsx)(q,{variant:`caption`,children:this.props.renderLabel(e)}),t.map((e,t)=>(0,H.jsx)(dW,{mat:e,hideAvatar:!0},t))]},n))})}};function cZ({matBin:e,isDragOverlay:t}){let n=R(br),r=ok(n.basketName);switch(e.type){case KX.LoadStations:return(0,H.jsx)(sZ,{name:`Load Stations`,binId:e.binId,renderLabel:e=>ik(e,n.loadStationNames),compareLabel:tZ,material:e.byLul,bin:e,isDragOverlay:t});case KX.Pallets:return(0,H.jsx)(sZ,{name:`Pallets`,binId:e.binId,renderLabel:nZ,compareLabel:rZ,material:e.byPallet,bin:e,isDragOverlay:t});case KX.ActiveQueues:return(0,H.jsx)(sZ,{name:`Queues`,binId:e.binId,renderLabel:iZ,compareLabel:aZ,material:e.byQueue,bin:e,isDragOverlay:t});case KX.Baskets:return(0,H.jsx)(sZ,{name:r+`s`,binId:e.binId,renderLabel:t=>r+` `+t.toString()+(typeof t==`number`&&e.basketLocations.get(t)?` (${e.basketLocations.get(t)})`:``),compareLabel:oZ,material:e.byBasket,bin:e,isDragOverlay:t});case KX.QuarantineQueues:return(0,H.jsx)(eZ,{binId:e.binId,queue:e.queueName,material:e.material,bin:e,isDragOverlay:t})}}var lZ=(0,L.memo)(function(){let[e,t]=(0,L.useState)(null),[n,r]=(0,L.useState)(null);function i(){t(null),r(null)}return(0,H.jsx)(TW,{onClose:i,allowNote:!0,highlightProcsGreaterOrEqualTo:n?.process??void 0,extraDialogElements:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(pX,{st:e,setState:t}),n===null?null:(0,H.jsx)(lX,{st:n,setState:r})]}),buttons:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(iX,{onClose:i,ignoreOperator:!0}),(0,H.jsx)(aX,{onClose:i,ignoreOperator:!0}),(0,H.jsx)(mX,{st:e,setState:t,onClose:i,ignoreOperator:!0}),(0,H.jsx)(uX,{st:n,setState:r,onClose:i,ignoreOperator:!0})]})})});function uZ(e){return(0,L.useCallback)(t=>{if(typeof t.active.id==`string`)return UB({...t,droppableContainers:t.droppableContainers.filter(e=>typeof e.id==`string`)});let n=JB(t),r=VB(n.length>0?n:KB(t),`id`);if(r!=null){if(typeof r==`string`){let n=ZX(r,e);n&&n.bin.material.length>0&&(r=UB({...t,droppableContainers:t.droppableContainers.filter(e=>e.id!==r&&n.bin.material.findIndex(t=>t.materialID===e.id)>=0)})[0]?.id)}return[{id:r}]}return[]},[e])}function dZ(e){JI(`All Material`);let t=R(NO),[n,r]=B(UX),[i]=BI(),a=z(RO),[o,s]=(0,L.useState)(null),c=(0,L.useMemo)(()=>{let e=JX(t,n);return o&&o.type===`material`&&o.curOverBinId!==null?YX(e,o.mat,o.curOverBinId,o.initialIdx):e},[t,n,o]),l=e.displaySystemBins?c:c.filter(e=>e.type===KX.QuarantineQueues);return(0,H.jsxs)(IH,{collisionDetection:uZ(c),measuring:{droppable:{strategy:QV.Always}},onDragStart:({active:e})=>{typeof e.id==`string`&&typeof e.data.current==`object`&&e.data.current!==null&&`bin`in e.data.current?s({type:`column`,bin:e.data.current.bin}):typeof e.data.current==`object`&&e.data.current!==null&&`mat`in e.data.current&&s({type:`material`,mat:e.data.current.mat,curOverBinId:null,initialIdx:0})},onDragOver:({over:e})=>{if(!e||o===null||o.type===`column`)return;let t=typeof e.id==`string`?ZX(e.id,c):XX(e.id,c);t&&t.bin.binId!==o.curOverBinId&&s({...o,curOverBinId:t.bin.binId,initialIdx:t.idx})},onDragEnd:({over:e})=>{if(o!==null){if(!e){s(null);return}if(o.type===`column`)typeof e.id==`number`?console.log(`Invalid, collision should never allow a column drag to be over a material`):r(WX(l.map(e=>e.binId),l.findIndex(e=>e.binId===o.bin.binId),l.findIndex(t=>t.binId===e.id)));else{let t=typeof e.id==`string`?ZX(e.id,c):XX(e.id,c);t&&(i({materialId:o.mat.materialID,queue:t.bin.queueName,queuePosition:t.idx,operator:null}).catch(console.error),a({queue:t.bin.queueName,matId:o.mat.materialID,newIdx:t.idx}))}s(null)}},onDragCancel:()=>s(null),children:[(0,H.jsx)(_U,{items:l.map(e=>e.binId),strategy:lU,children:(0,H.jsx)(J,{component:`main`,sx:{display:`flex`,flexWrap:`nowrap`,backgroundColor:`#F8F8F8`,minHeight:{xs:`calc(100vh - 64px - 48px)`,md:`calc(100vh - 64px)`}},children:l.map(e=>(0,H.jsx)(cZ,{matBin:e},e.binId))})}),(0,H.jsx)(nU,{children:o?.type===`material`?(0,H.jsx)(pW,{mat:o.mat,hideAvatar:!0}):o?.type===`column`?(0,H.jsx)(cZ,{matBin:o.bin,isDragOverlay:!0}):void 0}),(0,H.jsx)(lZ,{})]})}function fZ(e){let t=[];for(let n of e)for(let e of n.stops)t.push(`P${n.pallet},M${e.stationNum}`);return t.join(` -> `)}function pZ(e,t,n){let r=Q.of(e).collect(e=>e.result.type===aL.Completed&&!e.result.success?e.materialID:null).toRSet(e=>e);return Q.of(e).collect(e=>{if(t&&(e.time<t.start||e.time>t.end))return null;switch(e.result.type){case aL.Triggered:return{time:e.time,materialID:e.materialID,partName:e.part,serial:e.serial,workorder:e.workorder,toInspect:e.result.toInspect,path:fZ(e.result.actualPath),failed:r.has(e.materialID)};default:return null}}).buildHashMap(e=>e.path,(e,t)=>{let n=e??[];return n.push(t),n}).mapValues(e=>({material:Q.of(e).toSortedArray(n,e=>e.time.getTime()),failedCnt:e.reduce((e,t)=>e+ +!!t.failed,0)}))}function mZ(e,t,n){return Q.of(e).collect(e=>e.time<t||e.time>n?null:e.result.type===aL.Completed&&!e.result.success?{time:e.time,materialID:e.materialID,serial:e.serial,workorder:e.workorder,inspType:e.inspType,part:e.part}:null).toSortedArray(e=>e.time.getTime())}function hZ(e){for(let t of e)if(t.type===V.Inspection){let e=JSON.parse((t.details||{}).ActualPath||`[]`);if(!Array.isArray(e))continue;let n=[];for(let t of e)typeof t==`object`&&t&&n.push(Ne.fromJS(t));if(n.length>0)return n}return[]}function gZ(e,t,n){let r=`<table>
|
|
333
|
+
`;function TJ(e,t,n){let{contentNode:r,clonedContentNode:i,clonedImgNodes:a,clonedVideoNodes:o,numResourcesToLoad:s,originalCanvasNodes:c}=t,{bodyClass:l,fonts:u,ignoreGlobalStyles:d,pageStyle:f,nonce:p,suppressErrors:m,copyShadowRoots:h}=n,g=[],_=[];function v(t,r){if(g.includes(t)){_J({level:`debug`,messages:[`Tried to mark a resource that has already been handled`,t],suppressErrors:m});return}r?(_J({messages:[`"react-to-print" was unable to load a resource but will continue attempting to print the page`,...r],suppressErrors:m}),_.push(t)):g.push(t),g.length+_.length===s&&bJ(e,n)}e.onload=null;let y=e.contentDocument??e.contentWindow?.document;if(y){let t=y.body.appendChild(i);h&&CJ(r,t,!!m),u&&(e.contentDocument?.fonts&&e.contentWindow?.FontFace?u.forEach(t=>{let n=new FontFace(t.family,t.source,{weight:t.weight,style:t.style});e.contentDocument.fonts.add(n),n.loaded.then(()=>{v(n)}).catch(e=>{v(n,[`Failed loading the font:`,n,`Load error:`,yJ(e)])})}):(u.forEach(e=>{v(e)}),_J({messages:[`"react-to-print" is not able to load custom fonts because the browser does not support the FontFace API but will continue attempting to print the page`],suppressErrors:m})));let n=f??wJ,s=y.createElement(`style`);p&&(s.setAttribute(`nonce`,p),y.head.setAttribute(`nonce`,p)),s.appendChild(y.createTextNode(n)),y.head.appendChild(s),l&&y.body.classList.add(...l.split(` `));let g=y.querySelectorAll(`canvas`);for(let e=0;e<c.length;++e){let t=c[e],n=g[e];if(n===void 0){_J({messages:["A canvas element could not be copied for printing, has it loaded? `onBeforePrint` likely resolved too early.",t],suppressErrors:m});continue}let r=n.getContext(`2d`);r&&r.drawImage(t,0,0)}for(let e=0;e<a.length;e++){let t=a[e],n=t.getAttribute(`src`);if(!n)v(t,[`Found an <img> tag with an empty "src" attribute. This prevents pre-loading it.`,t]);else{let e=new Image;e.onload=()=>{v(t)},e.onerror=(e,n,r,i,a)=>{v(t,[`Error loading <img>`,t,`Error`,a])},e.src=n}}for(let e=0;e<o.length;e++){let t=o[e];t.preload=`auto`;let n=t.getAttribute(`poster`);if(n){let e=new Image;e.onload=()=>{v(t)},e.onerror=(e,r,i,a,o)=>{v(t,[`Error loading video poster`,n,`for video`,t,`Error:`,o])},e.src=n}else t.readyState>=2?v(t):t.src?(t.onloadeddata=()=>{v(t)},t.onerror=(e,n,r,i,a)=>{v(t,[`Error loading video`,t,`Error`,a])},t.onstalled=()=>{v(t,[`Loading video stalled, skipping`,t])}):v(t,["Error loading video, `src` is empty",t])}let _=`select`,b=r.querySelectorAll(_),x=y.querySelectorAll(_);for(let e=0;e<b.length;e++)x[e].value=b[e].value;if(!d){let e=document.querySelectorAll(`style, link[rel~='stylesheet'], link[as='style']`);for(let t=0,n=e.length;t<n;++t){let n=e[t];if(n.tagName.toLowerCase()===`style`){let e=y.createElement(n.tagName),r=n.sheet;if(r){let i=``;try{let e=r.cssRules.length;for(let t=0;t<e;++t)typeof r.cssRules[t].cssText==`string`&&(i+=`${r.cssRules[t].cssText}\r
|
|
334
|
+
`)}catch(e){_J({messages:["A stylesheet could not be accessed. This is likely due to the stylesheet having cross-origin imports, and many browsers block script access to cross-origin stylesheets. See https://github.com/MatthewHerbst/react-to-print/issues/429 for details. You may be able to load the sheet by both marking the stylesheet with the cross `crossorigin` attribute, and setting the `Access-Control-Allow-Origin` header on the server serving the stylesheet. Alternatively, host the stylesheet on your domain to avoid this issue entirely.",n,`Original error: ${yJ(e).message}`],level:`warning`})}e.setAttribute(`id`,`react-to-print-${t}`),p&&e.setAttribute(`nonce`,p),e.appendChild(y.createTextNode(i)),y.head.appendChild(e)}}else if(n.getAttribute(`href`))if(n.hasAttribute(`disabled`))_J({messages:["`react-to-print` encountered a <link> tag with a `disabled` attribute and will ignore it. Note that the `disabled` attribute is deprecated, and some browsers ignore it. You should stop using it. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-disabled. The <link> is:",n],level:`warning`}),v(n);else{let e=y.createElement(n.tagName);for(let t=0,r=n.attributes.length;t<r;++t){let r=n.attributes[t];r&&e.setAttribute(r.nodeName,r.nodeValue??``)}e.onload=()=>{v(e)},e.onerror=(t,n,r,i,a)=>{v(e,[`Failed to load`,e,`Error:`,a])},p&&e.setAttribute(`nonce`,p),y.head.appendChild(e)}else _J({messages:["`react-to-print` encountered a <link> tag with an empty `href` attribute. In addition to being invalid HTML, this can cause problems in many browsers, and so the <link> was not loaded. The <link> is:",n],level:`warning`}),v(n)}}}s===0&&bJ(e,n)}function EJ(e,t,n){e.onload=()=>{TJ(e,t,n)},document.body.appendChild(e)}function DJ({contentRef:e,optionalContent:t,suppressErrors:n}){if(t&&typeof t==`function`)return e&&_J({level:`warning`,messages:['"react-to-print" received a `contentRef` option and an optional-content param passed to its callback. The `contentRef` option will be ignored.']}),t();if(e)return e.current;_J({messages:['"react-to-print" did not receive a `contentRef` option or a optional-content param pass to its callback.'],suppressErrors:n})}function OJ(e,t){let{contentRef:n,fonts:r,ignoreGlobalStyles:i,suppressErrors:a}=t,o=DJ({contentRef:n,optionalContent:e,suppressErrors:a});if(!o)return;let s=o.cloneNode(!0),c=document.querySelectorAll(`link[rel~='stylesheet'], link[as='style']`),l=s.querySelectorAll(`img`),u=s.querySelectorAll(`video`),d=r?r.length:0;return{contentNode:o,clonedContentNode:s,clonedImgNodes:l,clonedVideoNodes:u,numResourcesToLoad:(i?0:c.length)+l.length+u.length+d,originalCanvasNodes:o.querySelectorAll(`canvas`)}}function kJ({bodyClass:e,contentRef:t,copyShadowRoots:n,documentTitle:r,fonts:i,ignoreGlobalStyles:a,nonce:o,onAfterPrint:s,onBeforePrint:c,onPrintError:l,pageStyle:u,preserveAfterPrint:d,print:f,printIframeProps:p,suppressErrors:m}){return(0,L.useCallback)(h=>{vJ(d,!0);function g(){let c={bodyClass:e,contentRef:t,copyShadowRoots:n,documentTitle:r,fonts:i,ignoreGlobalStyles:a,nonce:o,onAfterPrint:s,onPrintError:l,pageStyle:u,preserveAfterPrint:d,print:f,suppressErrors:m},g=gJ(p),_=OJ(h,c);if(!_){_J({messages:[`There is nothing to print`],suppressErrors:m});return}EJ(g,_,c)}c?c().then(()=>{g()}).catch(e=>{l?.(`onBeforePrint`,yJ(e))}):g()},[e,t,n,r,i,a,o,s,c,l,u,d,p,f,m])}var AJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}e.default=function e(n,r){t(this,e),this.data=n,this.text=r.text||n,this.options=r}})),jJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CODE39=void 0;var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=r(AJ());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(e){o(n,e);function n(e,t){return i(this,n),e=e.toUpperCase(),t.mod43&&(e+=f(m(e))),a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,t))}return t(n,[{key:`encode`,value:function(){for(var e=u(`*`),t=0;t<this.data.length;t++)e+=u(this.data[t])+`0`;return e+=u(`*`),{data:e,text:this.text}}},{key:`valid`,value:function(){return this.data.search(/^[0-9A-Z\-\.\ \$\/\+\%]+$/)!==-1}}]),n}(n.default),c=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%*`.split(``),l=[20957,29783,23639,30485,20951,29813,23669,20855,29789,23645,29975,23831,30533,22295,30149,24005,21623,29981,23837,22301,30023,23879,30545,22343,30161,24017,21959,30065,23921,22385,29015,18263,29141,17879,29045,18293,17783,29021,18269,17477,17489,17681,20753,35770];function u(e){return d(p(e))}function d(e){return l[e].toString(2)}function f(e){return c[e]}function p(e){return c.indexOf(e)}function m(e){for(var t=0,n=0;n<e.length;n++)t+=p(e[n]);return t%=43,t}e.CODE39=s})),MJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t;function n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var r=e.SET_A=0,i=e.SET_B=1,a=e.SET_C=2;e.SHIFT=98;var o=e.START_A=103,s=e.START_B=104,c=e.START_C=105;e.MODULO=103,e.STOP=106,e.FNC1=207,e.SET_BY_CODE=(t={},n(t,o,r),n(t,s,i),n(t,c,a),t),e.SWAP={101:r,100:i,99:a},e.A_START_CHAR=`Ð`,e.B_START_CHAR=`Ñ`,e.C_START_CHAR=`Ò`,e.A_CHARS=`[\0-_È-Ï]`,e.B_CHARS=`[ -È-Ï]`,e.C_CHARS=`(Ï*[0-9]{2}Ï*)`,e.BARS=[11011001100,11001101100,11001100110,10010011e3,10010001100,10001001100,10011001e3,10011000100,10001100100,11001001e3,11001000100,11000100100,10110011100,10011011100,10011001110,10111001100,10011101100,10011100110,11001110010,11001011100,11001001110,11011100100,11001110100,11101101110,11101001100,11100101100,11100100110,11101100100,11100110100,11100110010,11011011e3,11011000110,11000110110,10100011e3,10001011e3,10001000110,10110001e3,10001101e3,10001100010,11010001e3,11000101e3,11000100010,10110111e3,10110001110,10001101110,10111011e3,10111000110,10001110110,11101110110,11010001110,11000101110,11011101e3,11011100010,11011101110,11101011e3,11101000110,11100010110,11101101e3,11101100010,11100011010,11101111010,11001000010,11110001010,1010011e4,10100001100,1001011e4,10010000110,10000101100,10000100110,1011001e4,10110000100,1001101e4,10011000010,10000110100,10000110010,11000010010,1100101e4,11110111010,11000010100,10001111010,10100111100,10010111100,10010011110,10111100100,10011110100,10011110010,11110100100,11110010100,11110010010,11011011110,11011110110,11110110110,10101111e3,10100011110,10001011110,10111101e3,10111100010,11110101e3,11110100010,10111011110,10111101110,11101011110,11110101110,11010000100,1101001e4,11010011100,1100011101011]})),NJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=i(AJ()),r=MJ();function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function o(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function s(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){s(n,e);function n(e,t){a(this,n);var r=o(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.substring(1),t));return r.bytes=e.split(``).map(function(e){return e.charCodeAt(0)}),r}return t(n,[{key:`valid`,value:function(){return/^[\x00-\x7F\xC8-\xD3]+$/.test(this.data)}},{key:`encode`,value:function(){var e=this.bytes,t=e.shift()-105,i=r.SET_BY_CODE[t];if(i===void 0)throw RangeError(`The encoding does not start with a start character.`);this.shouldEncodeAsEan128()===!0&&e.unshift(r.FNC1);var a=n.next(e,1,i);return{text:this.text===this.data?this.text.replace(/[^\x20-\x7E]/g,``):this.text,data:n.getBar(t)+a.result+n.getBar((a.checksum+t)%r.MODULO)+n.getBar(r.STOP)}}},{key:`shouldEncodeAsEan128`,value:function(){var e=this.options.ean128||!1;return typeof e==`string`&&(e=e.toLowerCase()===`true`),e}}],[{key:`getBar`,value:function(e){return r.BARS[e]?r.BARS[e].toString():``}},{key:`correctIndex`,value:function(e,t){if(t===r.SET_A){var n=e.shift();return n<32?n+64:n-32}else if(t===r.SET_B)return e.shift()-32;else return(e.shift()-48)*10+e.shift()-48}},{key:`next`,value:function(e,t,i){if(!e.length)return{result:``,checksum:0};var a=void 0,o=void 0;if(e[0]>=200){o=e.shift()-105;var s=r.SWAP[o];s===void 0?((i===r.SET_A||i===r.SET_B)&&o===r.SHIFT&&(e[0]=i===r.SET_A?e[0]>95?e[0]-96:e[0]:e[0]<32?e[0]+96:e[0]),a=n.next(e,t+1,i)):a=n.next(e,t+1,s)}else o=n.correctIndex(e,i),a=n.next(e,t+1,i);var c=n.getBar(o),l=o*t;return{result:c+a.result,checksum:l+a.checksum}}}]),n}(n.default)})),PJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=MJ(),n=function(e){return e.match(RegExp(`^`+t.A_CHARS+`*`))[0].length},r=function(e){return e.match(RegExp(`^`+t.B_CHARS+`*`))[0].length},i=function(e){return e.match(RegExp(`^`+t.C_CHARS+`*`))[0]};function a(e,n){var r=n?t.A_CHARS:t.B_CHARS,i=e.match(RegExp(`^(`+r+`+?)(([0-9]{2}){2,})([^0-9]|$)`));if(i)return i[1]+`Ì`+o(e.substring(i[1].length));var s=e.match(RegExp(`^`+r+`+`))[0];return s.length===e.length?e:s+String.fromCharCode(n?205:206)+a(e.substring(s.length),!n)}function o(e){var t=i(e),o=t.length;if(o===e.length)return e;e=e.substring(o);var s=n(e)>=r(e);return t+String.fromCharCode(s?206:205)+a(e,s)}e.default=function(e){var s=void 0;if(i(e).length>=2)s=t.C_START_CHAR+o(e);else{var c=n(e)>r(e);s=(c?t.A_START_CHAR:t.B_START_CHAR)+a(e,c)}return s.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,function(e,t){return`Ë`+t})}})),FJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=r(NJ()),n=r(PJ());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){o(t,e);function t(e,r){if(i(this,t),/^[\x00-\x7F\xC8-\xD3]+$/.test(e))var o=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,(0,n.default)(e),r));else var o=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));return a(o)}return t}(t.default)})),IJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=i(NJ()),r=MJ();function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function o(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function s(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){s(n,e);function n(e,t){return a(this,n),o(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,r.A_START_CHAR+e,t))}return t(n,[{key:`valid`,value:function(){return RegExp(`^`+r.A_CHARS+`+$`).test(this.data)}}]),n}(n.default)})),LJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=i(NJ()),r=MJ();function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function o(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function s(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){s(n,e);function n(e,t){return a(this,n),o(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,r.B_START_CHAR+e,t))}return t(n,[{key:`valid`,value:function(){return RegExp(`^`+r.B_CHARS+`+$`).test(this.data)}}]),n}(n.default)})),RJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=i(NJ()),r=MJ();function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function o(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function s(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){s(n,e);function n(e,t){return a(this,n),o(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,r.C_START_CHAR+e,t))}return t(n,[{key:`valid`,value:function(){return RegExp(`^`+r.C_CHARS+`+$`).test(this.data)}}]),n}(n.default)})),zJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CODE128C=e.CODE128B=e.CODE128A=e.CODE128=void 0;var t=a(FJ()),n=a(IJ()),r=a(LJ()),i=a(RJ());function a(e){return e&&e.__esModule?e:{default:e}}e.CODE128=t.default,e.CODE128A=n.default,e.CODE128B=r.default,e.CODE128C=i.default})),BJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SIDE_BIN=`101`,e.MIDDLE_BIN=`01010`,e.BINARIES={L:[`0001101`,`0011001`,`0010011`,`0111101`,`0100011`,`0110001`,`0101111`,`0111011`,`0110111`,`0001011`],G:[`0100111`,`0110011`,`0011011`,`0100001`,`0011101`,`0111001`,`0000101`,`0010001`,`0001001`,`0010111`],R:[`1110010`,`1100110`,`1101100`,`1000010`,`1011100`,`1001110`,`1010000`,`1000100`,`1001000`,`1110100`],O:[`0001101`,`0011001`,`0010011`,`0111101`,`0100011`,`0110001`,`0101111`,`0111011`,`0110111`,`0001011`],E:[`0100111`,`0110011`,`0011011`,`0100001`,`0011101`,`0111001`,`0000101`,`0010001`,`0001001`,`0010111`]},e.EAN2_STRUCTURE=[`LL`,`LG`,`GL`,`GG`],e.EAN5_STRUCTURE=[`GGLLL`,`GLGLL`,`GLLGL`,`GLLLG`,`LGGLL`,`LLGGL`,`LLLGG`,`LGLGL`,`LGLLG`,`LLGLG`],e.EAN13_STRUCTURE=[`LLLLLL`,`LLGLGG`,`LLGGLG`,`LLGGGL`,`LGLLGG`,`LGGLLG`,`LGGGLL`,`LGLGLG`,`LGLGGL`,`LGGLGL`]})),VJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=BJ();e.default=function(e,n,r){var i=e.split(``).map(function(e,r){return t.BINARIES[n[r]]}).map(function(t,n){return t?t[e[n]]:``});if(r){var a=e.length-1;i=i.map(function(e,t){return t<a?e+r:e})}return i.join(``)}})),HJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=BJ(),r=a(VJ()),i=a(AJ());function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function s(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function c(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){c(i,e);function i(e,t){o(this,i);var n=s(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e,t));return n.fontSize=!t.flat&&t.fontSize>t.width*10?t.width*10:t.fontSize,n.guardHeight=t.height+n.fontSize/2+t.textMargin,n}return t(i,[{key:`encode`,value:function(){return this.options.flat?this.encodeFlat():this.encodeGuarded()}},{key:`leftText`,value:function(e,t){return this.text.substr(e,t)}},{key:`leftEncode`,value:function(e,t){return(0,r.default)(e,t)}},{key:`rightText`,value:function(e,t){return this.text.substr(e,t)}},{key:`rightEncode`,value:function(e,t){return(0,r.default)(e,t)}},{key:`encodeGuarded`,value:function(){var e={fontSize:this.fontSize},t={height:this.guardHeight};return[{data:n.SIDE_BIN,options:t},{data:this.leftEncode(),text:this.leftText(),options:e},{data:n.MIDDLE_BIN,options:t},{data:this.rightEncode(),text:this.rightText(),options:e},{data:n.SIDE_BIN,options:t}]}},{key:`encodeFlat`,value:function(){return{data:[n.SIDE_BIN,this.leftEncode(),n.MIDDLE_BIN,this.rightEncode(),n.SIDE_BIN].join(``),text:this.text}}}]),i}(i.default)})),UJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=function e(t,n,r){t===null&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(i===void 0){var a=Object.getPrototypeOf(t);return a===null?void 0:e(a,n,r)}else if(`value`in i)return i.value;else{var o=i.get;return o===void 0?void 0:o.call(r)}},r=BJ(),i=a(HJ());function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function s(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function c(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l=function(e){return(10-e.substr(0,12).split(``).map(function(e){return+e}).reduce(function(e,t,n){return n%2?e+t*3:e+t},0)%10)%10};e.default=function(e){c(i,e);function i(e,t){o(this,i),e.search(/^[0-9]{12}$/)!==-1&&(e+=l(e));var n=s(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e,t));return n.lastChar=t.lastChar,n}return t(i,[{key:`valid`,value:function(){return this.data.search(/^[0-9]{13}$/)!==-1&&+this.data[12]===l(this.data)}},{key:`leftText`,value:function(){return n(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),`leftText`,this).call(this,1,6)}},{key:`leftEncode`,value:function(){var e=this.data.substr(1,6),t=r.EAN13_STRUCTURE[this.data[0]];return n(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),`leftEncode`,this).call(this,e,t)}},{key:`rightText`,value:function(){return n(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),`rightText`,this).call(this,7,6)}},{key:`rightEncode`,value:function(){var e=this.data.substr(7,6);return n(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),`rightEncode`,this).call(this,e,`RRRRRR`)}},{key:`encodeGuarded`,value:function(){var e=n(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),`encodeGuarded`,this).call(this);return this.options.displayValue&&(e.unshift({data:`000000000000`,text:this.text.substr(0,1),options:{textAlign:`left`,fontSize:this.fontSize}}),this.options.lastChar&&(e.push({data:`00`}),e.push({data:`00000`,text:this.options.lastChar,options:{fontSize:this.fontSize}}))),e}}]),i}(i.default)})),WJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=function e(t,n,r){t===null&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(i===void 0){var a=Object.getPrototypeOf(t);return a===null?void 0:e(a,n,r)}else if(`value`in i)return i.value;else{var o=i.get;return o===void 0?void 0:o.call(r)}},r=i(HJ());function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function o(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function s(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var c=function(e){return(10-e.substr(0,7).split(``).map(function(e){return+e}).reduce(function(e,t,n){return n%2?e+t:e+t*3},0)%10)%10};e.default=function(e){s(r,e);function r(e,t){return a(this,r),e.search(/^[0-9]{7}$/)!==-1&&(e+=c(e)),o(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,e,t))}return t(r,[{key:`valid`,value:function(){return this.data.search(/^[0-9]{8}$/)!==-1&&+this.data[7]===c(this.data)}},{key:`leftText`,value:function(){return n(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),`leftText`,this).call(this,0,4)}},{key:`leftEncode`,value:function(){var e=this.data.substr(0,4);return n(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),`leftEncode`,this).call(this,e,`LLLL`)}},{key:`rightText`,value:function(){return n(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),`rightText`,this).call(this,4,4)}},{key:`rightEncode`,value:function(){var e=this.data.substr(4,4);return n(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),`rightEncode`,this).call(this,e,`RRRR`)}}]),r}(r.default)})),GJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=BJ(),r=a(VJ()),i=a(AJ());function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function s(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function c(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l=function(e){return e.split(``).map(function(e){return+e}).reduce(function(e,t,n){return n%2?e+t*9:e+t*3},0)%10};e.default=function(e){c(i,e);function i(e,t){return o(this,i),s(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e,t))}return t(i,[{key:`valid`,value:function(){return this.data.search(/^[0-9]{5}$/)!==-1}},{key:`encode`,value:function(){var e=n.EAN5_STRUCTURE[l(this.data)];return{data:`1011`+(0,r.default)(this.data,e,`01`),text:this.text}}}]),i}(i.default)})),KJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=BJ(),r=a(VJ()),i=a(AJ());function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function s(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function c(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){c(i,e);function i(e,t){return o(this,i),s(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e,t))}return t(i,[{key:`valid`,value:function(){return this.data.search(/^[0-9]{2}$/)!==-1}},{key:`encode`,value:function(){var e=n.EAN2_STRUCTURE[parseInt(this.data)%4];return{data:`1011`+(0,r.default)(this.data,e,`01`),text:this.text}}}]),i}(i.default)})),qJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();e.checksum=l;var n=i(VJ()),r=i(AJ());function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function o(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function s(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var c=function(e){s(r,e);function r(e,t){a(this,r),e.search(/^[0-9]{11}$/)!==-1&&(e+=l(e));var n=o(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,e,t));return n.displayValue=t.displayValue,t.fontSize>t.width*10?n.fontSize=t.width*10:n.fontSize=t.fontSize,n.guardHeight=t.height+n.fontSize/2+t.textMargin,n}return t(r,[{key:`valid`,value:function(){return this.data.search(/^[0-9]{12}$/)!==-1&&this.data[11]==l(this.data)}},{key:`encode`,value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:`flatEncoding`,value:function(){var e=``;return e+=`101`,e+=(0,n.default)(this.data.substr(0,6),`LLLLLL`),e+=`01010`,e+=(0,n.default)(this.data.substr(6,6),`RRRRRR`),e+=`101`,{data:e,text:this.text}}},{key:`guardedEncoding`,value:function(){var e=[];return this.displayValue&&e.push({data:`00000000`,text:this.text.substr(0,1),options:{textAlign:`left`,fontSize:this.fontSize}}),e.push({data:`101`+(0,n.default)(this.data[0],`L`),options:{height:this.guardHeight}}),e.push({data:(0,n.default)(this.data.substr(1,5),`LLLLL`),text:this.text.substr(1,5),options:{fontSize:this.fontSize}}),e.push({data:`01010`,options:{height:this.guardHeight}}),e.push({data:(0,n.default)(this.data.substr(6,5),`RRRRR`),text:this.text.substr(6,5),options:{fontSize:this.fontSize}}),e.push({data:(0,n.default)(this.data[11],`R`)+`101`,options:{height:this.guardHeight}}),this.displayValue&&e.push({data:`00000000`,text:this.text.substr(11,1),options:{textAlign:`right`,fontSize:this.fontSize}}),e}}]),r}(r.default);function l(e){var t=0,n;for(n=1;n<11;n+=2)t+=parseInt(e[n]);for(n=0;n<11;n+=2)t+=parseInt(e[n])*3;return(10-t%10)%10}e.default=c})),JJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=a(VJ()),r=a(AJ()),i=qJ();function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function s(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function c(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var l=[`XX00000XXX`,`XX10000XXX`,`XX20000XXX`,`XXX00000XX`,`XXXX00000X`,`XXXXX00005`,`XXXXX00006`,`XXXXX00007`,`XXXXX00008`,`XXXXX00009`],u=[[`EEEOOO`,`OOOEEE`],[`EEOEOO`,`OOEOEE`],[`EEOOEO`,`OOEEOE`],[`EEOOOE`,`OOEEEO`],[`EOEEOO`,`OEOOEE`],[`EOOEEO`,`OEEOOE`],[`EOOOEE`,`OEEEOO`],[`EOEOEO`,`OEOEOE`],[`EOEOOE`,`OEOEEO`],[`EOOEOE`,`OEEOEO`]],d=function(e){c(r,e);function r(e,t){o(this,r);var n=s(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,e,t));if(n.isValid=!1,e.search(/^[0-9]{6}$/)!==-1)n.middleDigits=e,n.upcA=f(e,`0`),n.text=t.text||``+n.upcA[0]+e+n.upcA[n.upcA.length-1],n.isValid=!0;else if(e.search(/^[01][0-9]{7}$/)!==-1)if(n.middleDigits=e.substring(1,e.length-1),n.upcA=f(n.middleDigits,e[0]),n.upcA[n.upcA.length-1]===e[e.length-1])n.isValid=!0;else return s(n);else return s(n);return n.displayValue=t.displayValue,t.fontSize>t.width*10?n.fontSize=t.width*10:n.fontSize=t.fontSize,n.guardHeight=t.height+n.fontSize/2+t.textMargin,n}return t(r,[{key:`valid`,value:function(){return this.isValid}},{key:`encode`,value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:`flatEncoding`,value:function(){var e=``;return e+=`101`,e+=this.encodeMiddleDigits(),e+=`010101`,{data:e,text:this.text}}},{key:`guardedEncoding`,value:function(){var e=[];return this.displayValue&&e.push({data:`00000000`,text:this.text[0],options:{textAlign:`left`,fontSize:this.fontSize}}),e.push({data:`101`,options:{height:this.guardHeight}}),e.push({data:this.encodeMiddleDigits(),text:this.text.substring(1,7),options:{fontSize:this.fontSize}}),e.push({data:`010101`,options:{height:this.guardHeight}}),this.displayValue&&e.push({data:`00000000`,text:this.text[7],options:{textAlign:`right`,fontSize:this.fontSize}}),e}},{key:`encodeMiddleDigits`,value:function(){var e=this.upcA[0],t=this.upcA[this.upcA.length-1],r=u[parseInt(t)][parseInt(e)];return(0,n.default)(this.middleDigits,r)}}]),r}(r.default);function f(e,t){for(var n=l[parseInt(e[e.length-1])],r=``,a=0,o=0;o<n.length;o++){var s=n[o];s===`X`?r+=e[a++]:r+=s}return r=``+t+r,``+r+(0,i.checksum)(r)}e.default=d})),YJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.UPCE=e.UPC=e.EAN2=e.EAN5=e.EAN8=e.EAN13=void 0;var t=s(UJ()),n=s(WJ()),r=s(GJ()),i=s(KJ()),a=s(qJ()),o=s(JJ());function s(e){return e&&e.__esModule?e:{default:e}}e.EAN13=t.default,e.EAN8=n.default,e.EAN5=r.default,e.EAN2=i.default,e.UPC=a.default,e.UPCE=o.default})),XJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.START_BIN=`1010`,e.END_BIN=`11101`,e.BINARIES=[`00110`,`10001`,`01001`,`11000`,`00101`,`10100`,`01100`,`00011`,`10010`,`01010`]})),ZJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=XJ(),r=i(AJ());function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function o(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function s(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){s(r,e);function r(){return a(this,r),o(this,(r.__proto__||Object.getPrototypeOf(r)).apply(this,arguments))}return t(r,[{key:`valid`,value:function(){return this.data.search(/^([0-9]{2})+$/)!==-1}},{key:`encode`,value:function(){var e=this,t=this.data.match(/.{2}/g).map(function(t){return e.encodePair(t)}).join(``);return{data:n.START_BIN+t+n.END_BIN,text:this.text}}},{key:`encodePair`,value:function(e){var t=n.BINARIES[e[1]];return n.BINARIES[e[0]].split(``).map(function(e,n){return(e===`1`?`111`:`1`)+(t[n]===`1`?`000`:`0`)}).join(``)}}]),r}(r.default)})),QJ=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=r(ZJ());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(e){var t=e.substr(0,13).split(``).map(function(e){return parseInt(e,10)}).reduce(function(e,t,n){return e+t*(3-n%2*2)},0);return Math.ceil(t/10)*10-t};e.default=function(e){o(n,e);function n(e,t){return i(this,n),e.search(/^[0-9]{13}$/)!==-1&&(e+=s(e)),a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,t))}return t(n,[{key:`valid`,value:function(){return this.data.search(/^[0-9]{14}$/)!==-1&&+this.data[13]===s(this.data)}}]),n}(n.default)})),$J=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ITF14=e.ITF=void 0;var t=r(ZJ()),n=r(QJ());function r(e){return e&&e.__esModule?e:{default:e}}e.ITF=t.default,e.ITF14=n.default})),eY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=r(AJ());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(e){o(n,e);function n(e,t){return i(this,n),a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,t))}return t(n,[{key:`encode`,value:function(){for(var e=`110`,t=0;t<this.data.length;t++){var n=parseInt(this.data[t]).toString(2);n=c(n,4-n.length);for(var r=0;r<n.length;r++)e+=n[r]==`0`?`100`:`110`}return e+=`1001`,{data:e,text:this.text}}},{key:`valid`,value:function(){return this.data.search(/^[0-9]+$/)!==-1}}]),n}(n.default);function c(e,t){for(var n=0;n<t;n++)e=`0`+e;return e}e.default=s})),tY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.mod10=t,e.mod11=n;function t(e){for(var t=0,n=0;n<e.length;n++){var r=parseInt(e[n]);(n+e.length)%2==0?t+=r:t+=r*2%10+Math.floor(r*2/10)}return(10-t%10)%10}function n(e){for(var t=0,n=[2,3,4,5,6,7],r=0;r<e.length;r++){var i=parseInt(e[e.length-1-r]);t+=n[r%n.length]*i}return(11-t%11)%11}})),nY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=r(eY()),n=tY();function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){o(t,e);function t(e,r){return i(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e+(0,n.mod10)(e),r))}return t}(t.default)})),rY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=r(eY()),n=tY();function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){o(t,e);function t(e,r){return i(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e+(0,n.mod11)(e),r))}return t}(t.default)})),iY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=r(eY()),n=tY();function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){o(t,e);function t(e,r){return i(this,t),e+=(0,n.mod10)(e),e+=(0,n.mod10)(e),a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r))}return t}(t.default)})),aY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=r(eY()),n=tY();function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){o(t,e);function t(e,r){return i(this,t),e+=(0,n.mod11)(e),e+=(0,n.mod10)(e),a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r))}return t}(t.default)})),oY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MSI1110=e.MSI1010=e.MSI11=e.MSI10=e.MSI=void 0;var t=o(eY()),n=o(nY()),r=o(rY()),i=o(iY()),a=o(aY());function o(e){return e&&e.__esModule?e:{default:e}}e.MSI=t.default,e.MSI10=n.default,e.MSI11=r.default,e.MSI1010=i.default,e.MSI1110=a.default})),sY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.pharmacode=void 0;var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=r(AJ());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.pharmacode=function(e){o(n,e);function n(e,t){i(this,n);var r=a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,t));return r.number=parseInt(e,10),r}return t(n,[{key:`encode`,value:function(){for(var e=this.number,t=``;!isNaN(e)&&e!=0;)e%2==0?(t=`11100`+t,e=(e-2)/2):(t=`100`+t,e=(e-1)/2);return t=t.slice(0,-2),{data:t,text:this.text}}},{key:`valid`,value:function(){return this.number>=3&&this.number<=131070}}]),n}(n.default)})),cY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.codabar=void 0;var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=r(AJ());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.codabar=function(e){o(n,e);function n(e,t){i(this,n),e.search(/^[0-9\-\$\:\.\+\/]+$/)===0&&(e=`A`+e+`A`);var r=a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e.toUpperCase(),t));return r.text=r.options.text||r.text.replace(/[A-D]/g,``),r}return t(n,[{key:`valid`,value:function(){return this.data.search(/^[A-D][0-9\-\$\:\.\+\/]+[A-D]$/)!==-1}},{key:`encode`,value:function(){for(var e=[],t=this.getEncodings(),n=0;n<this.data.length;n++)e.push(t[this.data.charAt(n)]),n!==this.data.length-1&&e.push(`0`);return{text:this.text,data:e.join(``)}}},{key:`getEncodings`,value:function(){return{0:`101010011`,1:`101011001`,2:`101001011`,3:`110010101`,4:`101101001`,5:`110101001`,6:`100101011`,7:`100101101`,8:`100110101`,9:`110100101`,"-":`101001101`,$:`101100101`,":":`1101011011`,"/":`1101101011`,".":`1101101101`,"+":`1011011011`,A:`1011001001`,B:`1001001011`,C:`1010010011`,D:`1010011001`}}}]),n}(n.default)})),lY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SYMBOLS=`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,-,., ,$,/,+,%,($),(%),(/),(+),ÿ`.split(`,`),e.BINARIES=`100010100.101001000.101000100.101000010.100101000.100100100.100100010.101010000.100010010.100001010.110101000.110100100.110100010.110010100.110010010.110001010.101101000.101100100.101100010.100110100.100011010.101011000.101001100.101000110.100101100.100010110.110110100.110110010.110101100.110100110.110010110.110011010.101101100.101100110.100110110.100111010.100101110.111010100.111010010.111001010.101101110.101110110.110101110.100100110.111011010.111010110.100110010.101011110`.split(`.`),e.MULTI_SYMBOLS={"\0":[`(%)`,`U`],"":[`($)`,`A`],"":[`($)`,`B`],"":[`($)`,`C`],"":[`($)`,`D`],"":[`($)`,`E`],"":[`($)`,`F`],"\x07":[`($)`,`G`],"\b":[`($)`,`H`]," ":[`($)`,`I`],"\n":[`($)`,`J`],"\v":[`($)`,`K`],"\f":[`($)`,`L`],"\r":[`($)`,`M`],"":[`($)`,`N`],"":[`($)`,`O`],"":[`($)`,`P`],"":[`($)`,`Q`],"":[`($)`,`R`],"":[`($)`,`S`],"":[`($)`,`T`],"":[`($)`,`U`],"":[`($)`,`V`],"":[`($)`,`W`],"":[`($)`,`X`],"":[`($)`,`Y`],"":[`($)`,`Z`],"\x1B":[`(%)`,`A`],"":[`(%)`,`B`],"":[`(%)`,`C`],"":[`(%)`,`D`],"":[`(%)`,`E`],"!":[`(/)`,`A`],'"':[`(/)`,`B`],"#":[`(/)`,`C`],"&":[`(/)`,`F`],"'":[`(/)`,`G`],"(":[`(/)`,`H`],")":[`(/)`,`I`],"*":[`(/)`,`J`],",":[`(/)`,`L`],":":[`(/)`,`Z`],";":[`(%)`,`F`],"<":[`(%)`,`G`],"=":[`(%)`,`H`],">":[`(%)`,`I`],"?":[`(%)`,`J`],"@":[`(%)`,`V`],"[":[`(%)`,`K`],"\\":[`(%)`,`L`],"]":[`(%)`,`M`],"^":[`(%)`,`N`],_:[`(%)`,`O`],"`":[`(%)`,`W`],a:[`(+)`,`A`],b:[`(+)`,`B`],c:[`(+)`,`C`],d:[`(+)`,`D`],e:[`(+)`,`E`],f:[`(+)`,`F`],g:[`(+)`,`G`],h:[`(+)`,`H`],i:[`(+)`,`I`],j:[`(+)`,`J`],k:[`(+)`,`K`],l:[`(+)`,`L`],m:[`(+)`,`M`],n:[`(+)`,`N`],o:[`(+)`,`O`],p:[`(+)`,`P`],q:[`(+)`,`Q`],r:[`(+)`,`R`],s:[`(+)`,`S`],t:[`(+)`,`T`],u:[`(+)`,`U`],v:[`(+)`,`V`],w:[`(+)`,`W`],x:[`(+)`,`X`],y:[`(+)`,`Y`],z:[`(+)`,`Z`],"{":[`(%)`,`P`],"|":[`(%)`,`Q`],"}":[`(%)`,`R`],"~":[`(%)`,`S`],"":[`(%)`,`T`]}})),uY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=lY(),r=i(AJ());function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function o(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function s(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){s(r,e);function r(e,t){return a(this,r),o(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,e,t))}return t(r,[{key:`valid`,value:function(){return/^[0-9A-Z\-. $/+%]+$/.test(this.data)}},{key:`encode`,value:function(){var e=this.data.split(``).flatMap(function(e){return n.MULTI_SYMBOLS[e]||e}),t=e.map(function(e){return r.getEncoding(e)}).join(``),i=r.checksum(e,20),a=r.checksum(e.concat(i),15);return{text:this.text,data:r.getEncoding(`ÿ`)+t+r.getEncoding(i)+r.getEncoding(a)+r.getEncoding(`ÿ`)+`1`}}}],[{key:`getEncoding`,value:function(e){return n.BINARIES[r.symbolValue(e)]}},{key:`getSymbol`,value:function(e){return n.SYMBOLS[e]}},{key:`symbolValue`,value:function(e){return n.SYMBOLS.indexOf(e)}},{key:`checksum`,value:function(e,t){var n=e.slice().reverse().reduce(function(e,n,i){var a=i%t+1;return e+r.symbolValue(n)*a},0);return r.getSymbol(n%47)}}]),r}(r.default)})),dY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=r(uY());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.default=function(e){o(n,e);function n(e,t){return i(this,n),a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,t))}return t(n,[{key:`valid`,value:function(){return/^[\x00-\x7f]+$/.test(this.data)}}]),n}(n.default)})),fY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CODE93FullASCII=e.CODE93=void 0;var t=r(uY()),n=r(dY());function r(e){return e&&e.__esModule?e:{default:e}}e.CODE93=t.default,e.CODE93FullASCII=n.default})),pY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.GenericBarcode=void 0;var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=r(AJ());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function a(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}e.GenericBarcode=function(e){o(n,e);function n(e,t){return i(this,n),a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,t))}return t(n,[{key:`encode`,value:function(){return{data:`10101010101010101010101010101010101010101`,text:this.text}}},{key:`valid`,value:function(){return!0}}]),n}(n.default)})),mY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=jJ(),n=zJ(),r=YJ(),i=$J(),a=oY(),o=sY(),s=cY(),c=fY(),l=pY();e.default={CODE39:t.CODE39,CODE128:n.CODE128,CODE128A:n.CODE128A,CODE128B:n.CODE128B,CODE128C:n.CODE128C,EAN13:r.EAN13,EAN8:r.EAN8,EAN5:r.EAN5,EAN2:r.EAN2,UPC:r.UPC,UPCE:r.UPCE,ITF14:i.ITF14,ITF:i.ITF,MSI:a.MSI,MSI10:a.MSI10,MSI11:a.MSI11,MSI1010:a.MSI1010,MSI1110:a.MSI1110,pharmacode:o.pharmacode,codabar:s.codabar,CODE93:c.CODE93,CODE93FullASCII:c.CODE93FullASCII,GenericBarcode:l.GenericBarcode}})),hY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};e.default=function(e,n){return t({},e,n)}})),gY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=t;function t(e){var t=[];function n(e){if(Array.isArray(e))for(var r=0;r<e.length;r++)n(e[r]);else e.text=e.text||``,e.data=e.data||``,t.push(e)}return n(e),t}})),_Y=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=t;function t(e){return e.marginTop=e.marginTop||e.margin,e.marginBottom=e.marginBottom||e.margin,e.marginRight=e.marginRight||e.margin,e.marginLeft=e.marginLeft||e.margin,e}})),vY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=t;function t(e){var t=[`width`,`height`,`textMargin`,`fontSize`,`margin`,`marginTop`,`marginBottom`,`marginLeft`,`marginRight`];for(var n in t)t.hasOwnProperty(n)&&(n=t[n],typeof e[n]==`string`&&(e[n]=parseInt(e[n],10)));return typeof e.displayValue==`string`&&(e.displayValue=e.displayValue!=`false`),e}})),yY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={width:2,height:100,format:`auto`,displayValue:!0,fontOptions:``,font:`monospace`,text:void 0,textAlign:`center`,textPosition:`bottom`,textMargin:2,fontSize:20,background:`#ffffff`,lineColor:`#000000`,margin:10,marginTop:void 0,marginBottom:void 0,marginLeft:void 0,marginRight:void 0,valid:function(){}}})),bY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=r(vY()),n=r(yY());function r(e){return e&&e.__esModule?e:{default:e}}function i(e){var r={};for(var i in n.default)n.default.hasOwnProperty(i)&&(e.hasAttribute(`jsbarcode-`+i.toLowerCase())&&(r[i]=e.getAttribute(`jsbarcode-`+i.toLowerCase())),e.hasAttribute(`data-`+i.toLowerCase())&&(r[i]=e.getAttribute(`data-`+i.toLowerCase())));return r.value=e.getAttribute(`jsbarcode-value`)||e.getAttribute(`data-value`),r=(0,t.default)(r),r}e.default=i})),xY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getTotalWidthOfEncodings=e.calculateEncodingAttributes=e.getBarcodePadding=e.getEncodingHeight=e.getMaximumHeightOfEncodings=void 0;var t=n(hY());function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){return t.height+(t.displayValue&&e.text.length>0?t.fontSize+t.textMargin:0)+t.marginTop+t.marginBottom}function i(e,t,n){if(n.displayValue&&t<e){if(n.textAlign==`center`)return Math.floor((e-t)/2);if(n.textAlign==`left`)return 0;if(n.textAlign==`right`)return Math.floor(e-t)}return 0}function a(e,n,a){for(var o=0;o<e.length;o++){var s=e[o],l=(0,t.default)(n,s.options),u=l.displayValue?c(s.text,l,a):0,d=s.data.length*l.width;s.width=Math.ceil(Math.max(u,d)),s.height=r(s,l),s.barcodePadding=i(u,d,l)}}function o(e){for(var t=0,n=0;n<e.length;n++)t+=e[n].width;return t}function s(e){for(var t=0,n=0;n<e.length;n++)e[n].height>t&&(t=e[n].height);return t}function c(e,t,n){var r;if(n)r=n;else if(typeof document<`u`)r=document.createElement(`canvas`).getContext(`2d`);else return 0;r.font=t.fontOptions+` `+t.fontSize+`px `+t.font;var i=r.measureText(e);return i?i.width:0}e.getMaximumHeightOfEncodings=s,e.getEncodingHeight=r,e.getBarcodePadding=i,e.calculateEncodingAttributes=a,e.getTotalWidthOfEncodings=o})),SY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=i(hY()),r=xY();function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}e.default=function(){function e(t,n,r){a(this,e),this.canvas=t,this.encodings=n,this.options=r}return t(e,[{key:`render`,value:function(){if(!this.canvas.getContext)throw Error(`The browser does not support canvas.`);this.prepareCanvas();for(var e=0;e<this.encodings.length;e++){var t=(0,n.default)(this.options,this.encodings[e].options);this.drawCanvasBarcode(t,this.encodings[e]),this.drawCanvasText(t,this.encodings[e]),this.moveCanvasDrawing(this.encodings[e])}this.restoreCanvas()}},{key:`prepareCanvas`,value:function(){var e=this.canvas.getContext(`2d`);e.save(),(0,r.calculateEncodingAttributes)(this.encodings,this.options,e);var t=(0,r.getTotalWidthOfEncodings)(this.encodings),n=(0,r.getMaximumHeightOfEncodings)(this.encodings);this.canvas.width=t+this.options.marginLeft+this.options.marginRight,this.canvas.height=n,e.clearRect(0,0,this.canvas.width,this.canvas.height),this.options.background&&(e.fillStyle=this.options.background,e.fillRect(0,0,this.canvas.width,this.canvas.height)),e.translate(this.options.marginLeft,0)}},{key:`drawCanvasBarcode`,value:function(e,t){var n=this.canvas.getContext(`2d`),r=t.data,i=e.textPosition==`top`?e.marginTop+e.fontSize+e.textMargin:e.marginTop;n.fillStyle=e.lineColor;for(var a=0;a<r.length;a++){var o=a*e.width+t.barcodePadding;r[a]===`1`?n.fillRect(o,i,e.width,e.height):r[a]&&n.fillRect(o,i,e.width,e.height*r[a])}}},{key:`drawCanvasText`,value:function(e,t){var n=this.canvas.getContext(`2d`),r=e.fontOptions+` `+e.fontSize+`px `+e.font;if(e.displayValue){var i,a=e.textPosition==`top`?e.marginTop+e.fontSize-e.textMargin:e.height+e.textMargin+e.marginTop+e.fontSize;n.font=r,e.textAlign==`left`||t.barcodePadding>0?(i=0,n.textAlign=`left`):e.textAlign==`right`?(i=t.width-1,n.textAlign=`right`):(i=t.width/2,n.textAlign=`center`),n.fillText(t.text,i,a)}}},{key:`moveCanvasDrawing`,value:function(e){this.canvas.getContext(`2d`).translate(e.width,0)}},{key:`restoreCanvas`,value:function(){this.canvas.getContext(`2d`).restore()}}]),e}()})),CY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n=i(hY()),r=xY();function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}var o=`http://www.w3.org/2000/svg`;e.default=function(){function e(t,n,r){a(this,e),this.svg=t,this.encodings=n,this.options=r,this.document=r.xmlDocument||document}return t(e,[{key:`render`,value:function(){var e=this.options.marginLeft;this.prepareSVG();for(var t=0;t<this.encodings.length;t++){var r=this.encodings[t],i=(0,n.default)(this.options,r.options),a=this.createGroup(e,i.marginTop,this.svg);this.setGroupOptions(a,i),this.drawSvgBarcode(a,i,r),this.drawSVGText(a,i,r),e+=r.width}}},{key:`prepareSVG`,value:function(){for(;this.svg.firstChild;)this.svg.removeChild(this.svg.firstChild);(0,r.calculateEncodingAttributes)(this.encodings,this.options);var e=(0,r.getTotalWidthOfEncodings)(this.encodings),t=(0,r.getMaximumHeightOfEncodings)(this.encodings),n=e+this.options.marginLeft+this.options.marginRight;this.setSvgAttributes(n,t),this.options.background&&this.drawRect(0,0,n,t,this.svg).setAttribute(`fill`,this.options.background)}},{key:`drawSvgBarcode`,value:function(e,t,n){for(var r=n.data,i=t.textPosition==`top`?t.fontSize+t.textMargin:0,a=0,o=0,s=0;s<r.length;s++)o=s*t.width+n.barcodePadding,r[s]===`1`?a++:a>0&&(this.drawRect(o-t.width*a,i,t.width*a,t.height,e),a=0);a>0&&this.drawRect(o-t.width*(a-1),i,t.width*a,t.height,e)}},{key:`drawSVGText`,value:function(e,t,n){var r=this.document.createElementNS(o,`text`);if(t.displayValue){var i,a;r.setAttribute(`font-family`,t.font),r.setAttribute(`font-size`,t.fontSize),t.fontOptions.includes(`bold`)&&r.setAttribute(`font-weight`,`bold`),t.fontOptions.includes(`italic`)&&r.setAttribute(`font-style`,`italic`),a=t.textPosition==`top`?t.fontSize-t.textMargin:t.height+t.textMargin+t.fontSize,t.textAlign==`left`||n.barcodePadding>0?(i=0,r.setAttribute(`text-anchor`,`start`)):t.textAlign==`right`?(i=n.width-1,r.setAttribute(`text-anchor`,`end`)):(i=n.width/2,r.setAttribute(`text-anchor`,`middle`)),r.setAttribute(`x`,i),r.setAttribute(`y`,a),r.appendChild(this.document.createTextNode(n.text)),e.appendChild(r)}}},{key:`setSvgAttributes`,value:function(e,t){var n=this.svg;n.setAttribute(`width`,e+`px`),n.setAttribute(`height`,t+`px`),n.setAttribute(`x`,`0px`),n.setAttribute(`y`,`0px`),n.setAttribute(`viewBox`,`0 0 `+e+` `+t),n.setAttribute(`xmlns`,o),n.setAttribute(`version`,`1.1`)}},{key:`createGroup`,value:function(e,t,n){var r=this.document.createElementNS(o,`g`);return r.setAttribute(`transform`,`translate(`+e+`, `+t+`)`),n.appendChild(r),r}},{key:`setGroupOptions`,value:function(e,t){e.setAttribute(`fill`,t.lineColor)}},{key:`drawRect`,value:function(e,t,n,r,i){var a=this.document.createElementNS(o,`rect`);return a.setAttribute(`x`,e),a.setAttribute(`y`,t),a.setAttribute(`width`,n),a.setAttribute(`height`,r),i.appendChild(a),a}}]),e}()})),wY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function n(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}e.default=function(){function e(t,r,i){n(this,e),this.object=t,this.encodings=r,this.options=i}return t(e,[{key:`render`,value:function(){this.object.encodings=this.encodings}}]),e}()})),TY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=i(SY()),n=i(CY()),r=i(wY());function i(e){return e&&e.__esModule?e:{default:e}}e.default={CanvasRenderer:t.default,SVGRenderer:n.default,ObjectRenderer:r.default}})),EY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function n(e,t){if(!e)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return t&&(typeof t==`object`||typeof t==`function`)?t:e}function r(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function, not `+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=function(e){r(i,e);function i(e,r){t(this,i);var a=n(this,(i.__proto__||Object.getPrototypeOf(i)).call(this));return a.name=`InvalidInputException`,a.symbology=e,a.input=r,a.message=`"`+a.input+`" is not a valid input for `+a.symbology,a}return i}(Error),a=function(e){r(i,e);function i(){t(this,i);var e=n(this,(i.__proto__||Object.getPrototypeOf(i)).call(this));return e.name=`InvalidElementException`,e.message=`Not supported type to render on`,e}return i}(Error),o=function(e){r(i,e);function i(){t(this,i);var e=n(this,(i.__proto__||Object.getPrototypeOf(i)).call(this));return e.name=`NoElementException`,e.message=`No element to render on.`,e}return i}(Error);e.InvalidInputException=i,e.InvalidElementException=a,e.NoElementException=o})),DY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},n=a(bY()),r=a(TY()),i=EY();function a(e){return e&&e.__esModule?e:{default:e}}function o(e){if(typeof e==`string`)return s(e);if(Array.isArray(e)){for(var a=[],l=0;l<e.length;l++)a.push(o(e[l]));return a}else if(typeof HTMLCanvasElement<`u`&&e instanceof HTMLImageElement)return c(e);else if(e&&e.nodeName&&e.nodeName.toLowerCase()===`svg`||typeof SVGElement<`u`&&e instanceof SVGElement)return{element:e,options:(0,n.default)(e),renderer:r.default.SVGRenderer};else if(typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement)return{element:e,options:(0,n.default)(e),renderer:r.default.CanvasRenderer};else if(e&&e.getContext)return{element:e,renderer:r.default.CanvasRenderer};else if(e&&(e===void 0?`undefined`:t(e))===`object`&&!e.nodeName)return{element:e,renderer:r.default.ObjectRenderer};else throw new i.InvalidElementException}function s(e){var t=document.querySelectorAll(e);if(t.length!==0){for(var n=[],r=0;r<t.length;r++)n.push(o(t[r]));return n}}function c(e){var t=document.createElement(`canvas`);return{element:t,options:(0,n.default)(e),renderer:r.default.CanvasRenderer,afterRender:function(){e.setAttribute(`src`,t.toDataURL())}}}e.default=o})),OY=o((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function n(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}e.default=function(){function e(t){n(this,e),this.api=t}return t(e,[{key:`handleCatch`,value:function(e){if(e.name===`InvalidInputException`)if(this.api._options.valid!==this.api._defaults.valid)this.api._options.valid(!1);else throw e.message;else throw e;this.api.render=function(){}}},{key:`wrapBarcodeCall`,value:function(e){try{var t=e.apply(void 0,arguments);return this.api._options.valid(!0),t}catch(e){return this.handleCatch(e),this.api}}}]),e}()})),kY=l(o(((e,t)=>{var n=d(mY()),r=d(hY()),i=d(gY()),a=d(_Y()),o=d(DY()),s=d(vY()),c=d(OY()),l=EY(),u=d(yY());function d(e){return e&&e.__esModule?e:{default:e}}var f=function(){},p=function(e,t,n){var r=new f;if(e===void 0)throw Error(`No element to render on was provided.`);return r._renderProperties=(0,o.default)(e),r._encodings=[],r._options=u.default,r._errorHandler=new c.default(r),t!==void 0&&(n||={},n.format||=_(),r.options(n)[n.format](t,n).render()),r};for(var m in p.getModule=function(e){return n.default[e]},n.default)n.default.hasOwnProperty(m)&&h(n.default,m);function h(e,t){f.prototype[t]=f.prototype[t.toUpperCase()]=f.prototype[t.toLowerCase()]=function(n,i){var a=this;return a._errorHandler.wrapBarcodeCall(function(){i.text=i.text===void 0?void 0:``+i.text;var o=(0,r.default)(a._options,i);o=(0,s.default)(o);var c=e[t],l=g(n,c,o);return a._encodings.push(l),a})}}function g(e,t,n){e=``+e;var a=new t(e,n);if(!a.valid())throw new l.InvalidInputException(a.constructor.name,e);var o=a.encode();o=(0,i.default)(o);for(var s=0;s<o.length;s++)o[s].options=(0,r.default)(n,o[s].options);return o}function _(){return n.default.CODE128?`CODE128`:Object.keys(n.default)[0]}f.prototype.options=function(e){return this._options=(0,r.default)(this._options,e),this},f.prototype.blank=function(e){var t=Array(e+1).join(`0`);return this._encodings.push({data:t}),this},f.prototype.init=function(){if(this._renderProperties){Array.isArray(this._renderProperties)||(this._renderProperties=[this._renderProperties]);var e;for(var t in this._renderProperties){e=this._renderProperties[t];var i=(0,r.default)(this._options,e.options);i.format==`auto`&&(i.format=_()),this._errorHandler.wrapBarcodeCall(function(){var t=i.value,r=n.default[i.format.toUpperCase()],a=g(t,r,i);v(e,a,i)})}}},f.prototype.render=function(){if(!this._renderProperties)throw new l.NoElementException;if(Array.isArray(this._renderProperties))for(var e=0;e<this._renderProperties.length;e++)v(this._renderProperties[e],this._encodings,this._options);else v(this._renderProperties,this._encodings,this._options);return this},f.prototype._defaults=u.default;function v(e,t,n){t=(0,i.default)(t);for(var o=0;o<t.length;o++)t[o].options=(0,r.default)(n,t[o].options),(0,a.default)(t[o].options);(0,a.default)(n);var s=e.renderer;new s(e.element,t,n).render(),e.afterRender&&e.afterRender()}typeof window<`u`&&(window.JsBarcode=p),typeof jQuery<`u`&&(jQuery.fn.JsBarcode=function(e,t){var n=[];return jQuery(this).each(function(){n.push(this)}),p(n,e,t)}),t.exports=p}))(),1);function AY(e){let t=(0,L.useRef)(null),n=(0,L.useCallback)(n=>{n&&(0,kY.default)(n,e.text,{format:`CODE128`}),t.current=n},[e.text]);return(0,L.useEffect)(()=>{t.current&&(0,kY.default)(t.current,e.text,{format:`CODE128`,fontSize:30})},[e.text]),(0,H.jsx)(`svg`,{ref:n})}function jY(e){return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{style:{marginTop:`4em`,display:`flex`,justifyContent:`center`},children:(0,H.jsx)(`h2`,{children:`SeedTactic: FMS Insight`})}),(0,H.jsx)(`div`,{style:{display:`flex`,justifyContent:`center`},children:(0,H.jsx)(`p`,{style:{fontSize:`x-large`},children:new Date().toLocaleString(void 0,{weekday:`long`,month:`long`,day:`numeric`,year:`numeric`,hour:`numeric`,minute:`2-digit`,second:`2-digit`})})}),(0,H.jsxs)(`div`,{style:{marginTop:`2em`,display:`flex`,justifyContent:`space-around`},children:[(0,H.jsx)(AY,{text:e.materialName??e.partName}),e.count>=2?(0,H.jsx)(AY,{text:e.count.toString()}):void 0]}),e.serial1&&e.serial1!==``?(0,H.jsxs)(`div`,{style:{marginTop:`2em`,display:`flex`,justifyContent:`space-around`},children:[(0,H.jsx)(AY,{text:e.serial1}),e.serial2&&e.serial2!==``?(0,H.jsx)(AY,{text:e.serial2||``}):void 0]}):void 0,(0,H.jsx)(`div`,{style:{marginTop:`2em`,marginLeft:`4em`,marginRight:`4em`,marginBottom:`9em`},children:e.uniq===null||e.uniq===``?(0,H.jsx)(`p`,{style:{fontSize:`x-large`},children:`Not currently assigned to any jobs`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{style:{fontSize:`x-large`},children:`Assigned To`}),(0,H.jsxs)(`div`,{style:{marginTop:`1em`,marginLeft:`2em`,display:`flex`,alignItems:`center`},children:[(0,H.jsx)(AY,{text:e.partName}),(0,H.jsxs)(`h3`,{style:{marginLeft:`4em`},children:[`assigned to `,e.uniq,e.jobCycles&&e.jobCycles>0?` (`+e.jobCycles.toString()+` scheduled)`:``]})]})]})}),e.note?(0,H.jsx)(`div`,{style:{marginBottom:`2em`},children:(0,H.jsx)(`p`,{style:{fontSize:`xxx-large`,textAlign:`center`},children:e.note})}):void 0,(0,H.jsx)(`div`,{style:{display:`flex`,justifyContent:`center`},children:e.operator?(0,H.jsx)(`p`,{style:{fontSize:`x-large`},children:e.operator}):void 0})]})}function MY(e){let t=R(NO).jobs,n=(0,L.useMemo)(()=>Q.of(e.material||[]).filter(e=>e.jobUnique!==null&&e.jobUnique!==void 0&&e.jobUnique!==``).groupBy(e=>e.jobUnique).map(([e,n])=>[e,{cycles:t[e]?.cycles??0,length:n.length,part:n[0]?.partName??``,comment:t[e]?.comment,serial1:n[0]?.serial,serial2:n[n.length-1]?.serial}]).toSortedArray(([e,t])=>t.part),[e.material,t]);return!e.material||e.material.length===0?(0,H.jsx)(`div`,{}):n.length===0?(0,H.jsx)(jY,{partName:e.material[0].partName,materialName:e.materialName,count:e.material.length,uniq:null,note:null,operator:e.operator,serial1:e.material[0].serial,serial2:e.material[e.material.length-1]?.serial}):(0,H.jsx)(`div`,{children:n.map(([t,r],i)=>(0,H.jsxs)(L.Fragment,{children:[(0,H.jsx)(jY,{partName:r.part,materialName:e.materialName,count:r.length,uniq:t,jobCycles:r.cycles,note:r.comment,operator:e.operator,serial1:r.serial1,serial2:r.serial2}),i<n.length-1?(0,H.jsx)(`div`,{style:{pageBreakAfter:`always`}}):void 0]},i))})}function NY(e){let t=(0,L.useMemo)(()=>Q.of(e.material||[]).filter(e=>e.jobUnique!==null&&e.jobUnique!==void 0&&e.jobUnique!==``).groupBy(e=>e.jobUnique).map(([e,t])=>[e,{length:t.length,part:t[0]?.partName??``}]).toSortedArray(([e,t])=>t.part),[e.material]),n=R(NO).jobs,r=(0,L.useMemo)(()=>Q.of(e.material||[]).collect(e=>e.jobUnique?n[e.jobUnique]?.comment:void 0).distinct().toSortedArray(e=>e),[e.material,n]);return!e.material||e.material.length===0?(0,H.jsx)(`div`,{}):(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{style:{marginTop:`4em`,display:`flex`,justifyContent:`center`},children:(0,H.jsx)(`h2`,{children:`SeedTactic: FMS Insight`})}),(0,H.jsx)(`div`,{style:{display:`flex`,justifyContent:`center`},children:(0,H.jsx)(`p`,{style:{fontSize:`x-large`},children:new Date().toLocaleString(void 0,{weekday:`long`,month:`long`,day:`numeric`,year:`numeric`,hour:`numeric`,minute:`2-digit`,second:`2-digit`})})}),(0,H.jsxs)(`div`,{style:{marginTop:`2em`,display:`flex`,justifyContent:`space-around`},children:[(0,H.jsx)(AY,{text:e.materialName??e.material[0].partName}),e.material.length>=2?(0,H.jsx)(AY,{text:e.material.length.toString()}):void 0]}),e.material[0].serial&&e.material[0].serial!==``?(0,H.jsxs)(`div`,{style:{marginTop:`2em`,display:`flex`,justifyContent:`space-around`},children:[(0,H.jsx)(AY,{text:e.material[0].serial}),e.material.length>=2&&e.material[e.material.length-1].serial&&e.material[e.material.length-1].serial!==``?(0,H.jsx)(AY,{text:e.material[e.material.length-1].serial||``}):void 0]}):void 0,(0,H.jsx)(`div`,{style:{marginTop:`2em`,marginLeft:`4em`,marginRight:`4em`,marginBottom:`9em`},children:t.length===0?(0,H.jsx)(`p`,{style:{fontSize:`x-large`},children:`Not currently assigned to any jobs`}):e.materialName?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{style:{fontSize:`x-large`},children:`Assigned To`}),t.map(([e,t],n)=>(0,H.jsxs)(`div`,{style:{marginTop:`1em`,marginLeft:`2em`,display:`flex`,alignItems:`center`},children:[(0,H.jsx)(AY,{text:t.part}),(0,H.jsxs)(`h3`,{style:{marginLeft:`4em`},children:[`x`,t.length]}),(0,H.jsxs)(`h3`,{style:{marginLeft:`4em`},children:[`assigned to `,e]})]},n))]}):t.length===1?(0,H.jsx)(`div`,{style:{marginTop:`1em`,display:`flex`,justifyContent:`space-around`},children:(0,H.jsxs)(`p`,{style:{fontSize:`x-large`},children:[(0,H.jsxs)(`span`,{children:[`Assigned to `,t[0][0]]}),t[0][1].length>1?(0,H.jsxs)(`span`,{style:{marginLeft:`1em`},children:[`x`,t[0][1].length]}):void 0]})}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{style:{fontSize:`x-large`},children:`Assigned To`}),t.map(([e,t],n)=>(0,H.jsxs)(`h3`,{style:{marginTop:`1em`,marginLeft:`2em`},children:[(0,H.jsx)(`span`,{children:e}),t.length>1?(0,H.jsxs)(`span`,{style:{marginLeft:`1em`},children:[`x`,t.length]}):void 0]},n))]})}),r.length>0?(0,H.jsx)(`div`,{style:{marginBottom:`2em`},children:r.map((e,t)=>(0,H.jsx)(`p`,{style:{fontSize:`xxx-large`,textAlign:`center`},children:e},t))}):void 0,(0,H.jsx)(`div`,{style:{display:`flex`,justifyContent:`center`},children:e.operator?(0,H.jsx)(`p`,{style:{fontSize:`x-large`},children:e.operator}):void 0})]})}function PY(e){return e.oneJobPerPage?(0,H.jsx)(MY,{...e}):(0,H.jsx)(NY,{...e})}function FY({mat:e,materialName:t,operator:n}){let r=(0,L.useRef)(null),i=kJ({contentRef:r,ignoreGlobalStyles:!0});return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Y,{color:`primary`,onClick:()=>i(),children:`Print Label`}),(0,H.jsx)(`div`,{style:{display:`none`},children:(0,H.jsx)(`div`,{ref:r,children:(0,H.jsx)(PY,{materialName:t,material:Array.isArray(e)?e:[e],oneJobPerPage:!1,operator:n})})})]})}function IY(){let e=R(br),t=R(TI),n=R(OI),[r,i,a]=zI();return!e.usingLabelPrinterForSerials||t===null||t.materialID<0?null:e.useClientPrinterForLabels?n===null?null:(0,H.jsx)(FY,{mat:n}):(0,H.jsx)(Y,{color:`primary`,disabled:i||a,onClick:()=>r({materialId:t.materialID,proc:n?.process??0}),children:a?`Printed`:`Print Label`})}var LY=P(null),RY=P(null);function zY(){let[e,t]=B(RY),n=R(NO),r=(0,L.useRef)(null),i=(0,L.useRef)(!1),a=kJ({contentRef:r,onAfterPrint:()=>t(null),ignoreGlobalStyles:!0}),o=e?n.material.filter(t=>e.materialIds.has(t.materialID)):null;return o?.length!==e?.materialIds.size&&(o=null),(0,L.useEffect)(()=>{if(e===null){i.current&&=!1;return}i.current||o===null||(a(),i.current=!0)},[e,o,i,a]),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(cy,{open:e!==null,children:[(0,H.jsx)(dy,{children:`Waiting for Material Assignment`}),(0,H.jsx)(uy,{children:o===null?e===null?(0,H.jsx)(`div`,{}):(0,H.jsxs)(RC,{direction:`column`,spacing:2,sx:{mt:`0.5em`,mb:`0.5em`},children:[(0,H.jsx)(Lm,{color:`secondary`}),(0,H.jsx)(`div`,{children:`Waiting for material assignment. This could take a while if a download is currently in progress.`})]}):(0,H.jsx)(`div`,{children:`Printing...`})}),(0,H.jsx)(ly,{children:(0,H.jsx)(Y,{color:`primary`,onClick:()=>t(null),children:`Cancel`})})]}),(0,H.jsx)(`div`,{style:{display:`none`},children:(0,H.jsx)(`div`,{ref:r,children:(0,H.jsx)(PY,{materialName:e?.selectedCasting,material:o,operator:e?.operator,oneJobPerPage:!0})})})]})}function BY({casting:e,queue:t}){let n=R(NO),r=(0,L.useMemo)(()=>rJ(n.jobs,n.material,t).filter(t=>t.rawMatName===e),[n.jobs,n.material,e,t]);return r.length===0?null:(0,H.jsxs)(jw,{size:`small`,children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:`Job`}),(0,H.jsx)(Z,{align:`right`,children:`Plan`}),(0,H.jsx)(Z,{align:`right`,children:`Remaining`}),(0,H.jsx)(Z,{align:`right`,children:`Assigned`}),(0,H.jsx)(Z,{align:`right`,children:`Required`}),(0,H.jsx)(Z,{align:`right`,children:`Available`})]})}),(0,H.jsxs)(Pw,{children:[r.map((e,t)=>(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:e.job.unique}),(0,H.jsx)(Z,{align:`right`,children:e.job.cycles}),(0,H.jsx)(Z,{align:`right`,children:e.remainingToStart}),(0,H.jsx)(Z,{align:`right`,children:e.assignedRaw}),(0,H.jsx)(Z,{align:`right`,children:Math.max(e.remainingToStart-e.assignedRaw,0)}),(0,H.jsx)(Z,{align:`right`,children:e.availableUnassigned})]},t)),r.length>=2?(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:`Total`}),(0,H.jsx)(Z,{align:`right`,children:Q.of(r).sumBy(e=>e.job.cycles)}),(0,H.jsx)(Z,{align:`right`,children:Q.of(r).sumBy(e=>e.remainingToStart)}),(0,H.jsx)(Z,{align:`right`,children:Q.of(r).sumBy(e=>e.assignedRaw)}),(0,H.jsx)(Z,{align:`right`,children:Q.of(r).sumBy(e=>Math.max(e.remainingToStart-e.assignedRaw,0))}),(0,H.jsx)(Z,{align:`right`,children:Q.of(r).sumBy(e=>e.availableUnassigned)})]}):void 0]})]})}var VY=(0,L.memo)(function(){let[e,t]=B(LY),n=R(jO),r=R(br),i=r.usingLabelPrinterForSerials&&r.useClientPrinterForLabels,[a]=VI(),o=z(RY),[s,c]=(0,L.useState)(null),[l,u]=(0,L.useState)(null),[d,f]=(0,L.useState)(null),[p,m]=(0,L.useState)(!1),h=R(NO),g=R(DL),_=(0,L.useMemo)(()=>Q.ofObject(h.jobs).flatMap(([,e])=>e.procsAndPaths[0].paths).filter(e=>e.casting!==void 0&&e.casting!==``).map(e=>({casting:e.casting??``,cnt:1})).concat(Q.of(g).map(e=>({casting:e,cnt:0}))).buildOrderedMap(e=>e.casting,(e,t)=>e===void 0?t.cnt:e+t.cnt).toAscLazySeq(),[h.jobs,g]);function v(){t(null),c(null),f(null),m(!1),u(null)}function y(){e!==null&&s!==null&&l!==null&&!isNaN(l)&&l>0&&a({casting:s,quantity:l,queue:e,workorder:null,operator:r.requireOperatorNamePromptWhenAddingMaterial?d:n}).catch(console.log),v()}function b(){e!==null&&s!==null&&l!==null&&!isNaN(l)&&(m(!0),a({casting:s,quantity:l,queue:e,operator:n,workorder:null,onNewMaterial:e=>{o({selectedCasting:s,operator:r.requireOperatorNamePromptWhenAddingMaterial?d:n,materialIds:new Set(e.map(e=>e.materialID))}),v()},onError:()=>{v()}}).catch(()=>{}))}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(cy,{open:e!==null,onClose:()=>v(),maxWidth:`md`,children:[(0,H.jsx)(dy,{children:`Add Raw Material`}),(0,H.jsx)(uy,{children:(0,H.jsxs)(RC,{direction:`column`,spacing:2,sx:{mt:`0.5em`},children:[(0,H.jsx)(Kw,{style:{minWidth:`15em`},value:s||``,onChange:e=>c(e.target.value),select:!0,fullWidth:!0,label:`Raw Material`,slotProps:{select:{renderValue:s===null?void 0:()=>(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(`div`,{style:{marginRight:`0.5em`},children:(0,H.jsx)(ZU,{part:s,size:25})}),(0,H.jsx)(`div`,{children:s})]})}},children:_.map(([e,t],n)=>(0,H.jsxs)(Hx,{value:e,children:[(0,H.jsx)(Mb,{children:(0,H.jsx)(ZU,{part:e})}),(0,H.jsx)(Lb,{primary:e,slotProps:{primary:{variant:`h4`}},secondary:t===0?`Not used by any current jobs`:`Used by ${t} current job${t>1?`s`:``}`})]},n))}),(0,H.jsx)(Kw,{fullWidth:!0,type:`number`,label:`Quantity`,disabled:s===null,slotProps:{htmlInput:{min:`1`}},value:l===null||isNaN(l)||l<=0?``:l,onChange:e=>u(parseInt(e.target.value))}),r.requireOperatorNamePromptWhenAddingMaterial?(0,H.jsx)(Kw,{fullWidth:!0,label:`Operator`,value:d||``,onChange:e=>f(e.target.value)}):void 0,s!==null&&e!==null?(0,H.jsx)(BY,{casting:s,queue:e}):void 0]})}),(0,H.jsxs)(ly,{children:[i?(0,H.jsxs)(Y,{color:`primary`,disabled:p||s===null||l===null||isNaN(l)||r.requireOperatorNamePromptWhenAddingMaterial&&(d===null||d===``),onClick:b,children:[p?(0,H.jsx)(Lm,{size:10}):void 0,`Add `,l!==null&&!isNaN(l)?l.toString()+` `:``,`to`,` `,e]}):(0,H.jsxs)(Y,{color:`primary`,disabled:s===null||l===null||isNaN(l)||r.requireOperatorNamePromptWhenAddingMaterial&&(d===null||d===``),onClick:y,children:[`Add `,l!==null&&!isNaN(l)?l.toString()+` `:``,`to`,` `,e]}),(0,H.jsx)(Y,{color:`primary`,disabled:p&&i,onClick:v,children:`Cancel`})]})]}),(0,H.jsx)(zY,{})]})}),HY=(0,L.memo)(function(e){let t=R(br),n=R(NO).jobs,[r,i]=zI(),[a,o]=(0,L.useState)(!1),[s,c]=(0,L.useState)([]),[l,u]=(0,L.useState)(!1),[d,f]=(0,L.useState)(NaN),[p,m]=(0,L.useState)(void 0);(0,L.useEffect)(()=>{if(e.material===null)return;let t=!0;return o(!0),aJ(e.material).then(e=>{if(t){c(e);let t;for(let n of e)n.type===V.AddToQueue&&n.details?.operator!==void 0&&(t=n.details.operator);m(t)}}).catch(console.error).finally(()=>o(!1)),()=>{t=!1}},[e.material]);let h=(0,L.useMemo)(()=>{if(!e.material||e.material.length===0)return;let t=e.material[0].jobUnique;if(!(!t||t===``||!n[t]))return Q.of(n[t].procsAndPaths[0].paths).filter(e=>e.casting!==void 0&&e.casting!==``).head()?.casting},[e.material,n]);function g(){e.closeDialog(),u(!1),f(NaN),o(!1),c([])}function _(){l?isNaN(d)||(o(!0),Ut.bulkRemoveMaterialFromQueues(e.operator,Q.of(e.material||[]).take(d).map(e=>e.materialID).toRArray()).catch(console.error).finally(g)):u(!0)}let v=e.material?.[0];return(0,H.jsxs)(cy,{open:e.material!==null,onClose:g,maxWidth:`md`,children:[(0,H.jsx)(dy,{children:v&&e.material&&e.material.length>0?(0,H.jsx)(gW,{partName:v.partName,subtitle:e.material.length.toString()+(v.jobUnique&&v.jobUnique!==``?` assigned to `+v.jobUnique:` unassigned`)}):`Material`}),(0,H.jsxs)(uy,{children:[a?(0,H.jsx)(Lm,{color:`secondary`}):(0,H.jsx)(bI,{entries:s,copyToClipboard:!0}),l&&e.material?(0,H.jsx)(`div`,{style:{marginTop:`1em`},children:(0,H.jsx)(Kw,{type:`number`,variant:`outlined`,fullWidth:!0,label:`Quantity to Remove`,slotProps:{htmlInput:{min:`1`,max:e.material.length.toString()}},value:isNaN(d)?``:d,onChange:e=>f(parseInt(e.target.value))})}):void 0]}),(0,H.jsxs)(ly,{children:[e.material&&e.material.length>0&&t.usingLabelPrinterForSerials?t.useClientPrinterForLabels?(0,H.jsx)(FY,{mat:e.material||[],materialName:h,operator:p}):(0,H.jsx)(Y,{color:`primary`,disabled:i,onClick:()=>e.material&&e.material.length>0?r({materialId:e.material[0].materialID,proc:0}):void 0,children:`Print Label`}):void 0,(0,H.jsx)(Y,{color:`primary`,onClick:_,disabled:a||l&&isNaN(d),children:a&&l?`Removing...`:l&&!isNaN(d)?`Remove ${d} material`:`Remove Material`}),(0,H.jsx)(Y,{color:`primary`,onClick:g,children:`Close`})]})]})}),UY=(0,L.memo)(function(){let[e,t]=(0,L.useState)(null),[n,r]=(0,L.useState)(!1),i=z(SI);function a(){r(!1),t(null)}function o(){e&&e!==``&&(i({type:`ManuallyEnteredSerial`,serial:e}),a())}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{title:`Enter Serial`,children:(0,H.jsx)(Um,{onClick:()=>r(!0),size:`large`,children:(0,H.jsx)(bT,{})})}),(0,H.jsxs)(cy,{open:n,onClose:a,maxWidth:`md`,children:[(0,H.jsx)(dy,{children:`Enter a part's serial`}),(0,H.jsx)(uy,{children:(0,H.jsx)(`div`,{style:{minWidth:`20em`},children:(0,H.jsx)(Kw,{sx:{mt:`5px`},label:e===null||e===``?`Serial`:`Serial (press enter)`,value:e??``,fullWidth:!0,autoFocus:!0,onChange:e=>t(e.target.value),onKeyDown:t=>{t.key===`Enter`&&e&&e!==``&&(t.preventDefault(),o())}})})}),(0,H.jsxs)(ly,{children:[(0,H.jsx)(Y,{onClick:o,disabled:e===null||e===``,color:`secondary`,children:`Open`}),(0,H.jsx)(Y,{onClick:a,color:`secondary`,children:`Cancel`})]})]})]})}),WY=P(null),GY=(0,L.memo)(function(){let[e,t]=B(WY),n=z(SI),[r,i]=(0,L.useState)(void 0);function a(){r&&r!==``&&e!==null&&(n({type:`AddMatWithEnteredSerial`,serial:r,toQueue:e}),t(null),i(void 0))}function o(){t(null),i(void 0)}return(0,H.jsxs)(cy,{open:e!==null,onClose:o,maxWidth:`md`,children:[(0,H.jsxs)(dy,{children:[`Lookup Material To Add To `,e]}),(0,H.jsx)(uy,{children:(0,H.jsx)(Kw,{label:`Serial`,style:{marginTop:`0.5em`},autoFocus:!0,fullWidth:!0,value:r||``,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&r&&r!==``&&(e.preventDefault(),a())}})}),(0,H.jsxs)(ly,{children:[(0,H.jsx)(Y,{onClick:a,color:`secondary`,children:`Lookup Serial`}),(0,H.jsx)(Y,{onClick:o,color:`primary`,children:`Cancel`})]})]})});function KY(e){let t=R(TI),n=R(OI),r=R(wI);return!(!XU(n)||n?.location.type===at.InQueue&&n.location.currentQueue!==void 0&&e.includes(n.location.currentQueue)||t===null&&!r)}var qY=G(aT,{shouldForwardProp:e=>e.toString()[0]!==`$`})(({theme:e,$expandedOpen:t})=>({transform:t?`rotate(0deg)`:`rotate(-90deg)`,transition:e.transitions.create(`transform`,{duration:e.transitions.duration.shortest})}));function JY({newMaterialTy:e,setNewMaterialTy:t,castings:n,indent:r}){return(0,H.jsx)(pb,{sx:r?e=>({pl:e.spacing(4)}):void 0,children:n.map(n=>(0,H.jsx)(Db,{children:(0,H.jsxs)(vb,{selected:e?.kind===`RawMat`&&e?.rawMatName===n.casting,onClick:()=>t({kind:`RawMat`,rawMatName:n.casting}),children:[(0,H.jsx)(Mb,{children:(0,H.jsx)(ZU,{part:n.casting})}),(0,H.jsx)(Lb,{primary:n.casting,secondary:n.message??void 0,slotProps:{primary:{variant:`h4`}}})]})},n.casting))})}function YY({newMaterialTy:e,setNewMaterialTy:t,curCollapse:n,setCurCollapse:r,indent:i,jobs:a}){return(0,H.jsx)(pb,{sx:i?e=>({pl:e.spacing(4)}):void 0,children:a.map((a,o)=>a.machinedProcs.length===1?(0,H.jsx)(`div`,{children:(0,H.jsx)(Db,{children:(0,H.jsxs)(vb,{alignItems:`flex-start`,selected:e?.kind===`JobAndProc`&&e?.jobUnique===a.jobUnique&&e?.last_proc===a.machinedProcs[0].lastProc,onClick:()=>t({kind:`JobAndProc`,jobUnique:a.jobUnique,last_proc:a.machinedProcs[0].lastProc,workorder:a.workorder}),children:[a.job?(0,H.jsx)(Mb,{children:(0,H.jsx)(ZU,{part:a.job.partName})}):void 0,(0,H.jsx)(Lb,{primary:(a.job?.partName??``)+` (`+a.jobUnique+`)`,slotProps:{primary:{variant:`h4`}},secondary:(0,H.jsxs)(q,{variant:`body2`,children:[a.machinedProcs[0].lastProc===0?`Raw Material`:`Last machined process `+a.machinedProcs[0].lastProc.toString(),`, `,a.job?.routeStartUTC.toLocaleDateString()??``,`,`,` `,a.machinedProcs[0].details]})})]})})},o):(0,H.jsxs)(L.Fragment,{children:[(0,H.jsx)(Db,{children:(0,H.jsxs)(vb,{onClick:()=>{e&&t(null),r(n&&n.kind===`Job`&&n.unique===a.jobUnique?null:{kind:`Job`,unique:a.jobUnique})},children:[(0,H.jsx)(Mb,{children:(0,H.jsx)(qY,{$expandedOpen:n!==null&&n.kind===`Job`&&n.unique===a.jobUnique})}),a.job?(0,H.jsx)(Mb,{children:(0,H.jsx)(ZU,{part:a.job.partName})}):void 0,(0,H.jsx)(Lb,{primary:(a.job?.partName??``)+` (`+a.jobUnique+`)`,slotProps:{primary:{variant:`h4`}},secondary:a.job?.routeStartUTC.toLocaleDateString()})]})}),(0,H.jsx)(zp,{in:n!==null&&n.kind===`Job`&&n.unique===a.jobUnique,timeout:`auto`,children:a.machinedProcs.map((n,r)=>(0,H.jsx)(`div`,{children:(0,H.jsx)(Db,{sx:e=>({pl:e.spacing(i?8:4)}),children:(0,H.jsx)(vb,{selected:e?.kind===`JobAndProc`&&e?.jobUnique===a.jobUnique&&e?.last_proc===n.lastProc,onClick:()=>t({kind:`JobAndProc`,jobUnique:a.jobUnique,last_proc:n.lastProc,workorder:a.workorder}),children:(0,H.jsx)(Lb,{primary:n.lastProc===0?`Raw Material`:`Last machined process `+n.lastProc.toString(),secondary:n.details})})})},r))})]},o))})}function XY({newMaterialTy:e,options:t,setNewMaterialTy:n,curCollapse:r,setCurCollapse:i}){return(0,H.jsxs)(pb,{children:[(0,H.jsx)(Db,{children:(0,H.jsxs)(vb,{onClick:()=>{e&&n(null),i(r&&r.kind===`RawMat`?null:{kind:`RawMat`})},children:[(0,H.jsx)(Mb,{children:(0,H.jsx)(qY,{$expandedOpen:r!==null&&r.kind===`RawMat`})}),(0,H.jsx)(Lb,{primary:`Raw Material`})]})}),(0,H.jsx)(zp,{in:r!==null&&r.kind===`RawMat`,timeout:`auto`,children:(0,H.jsx)(JY,{castings:t.castings,newMaterialTy:e,setNewMaterialTy:n,indent:!0})}),(0,H.jsx)(Db,{children:(0,H.jsxs)(vb,{onClick:()=>{e&&n(null),i(r&&(r.kind===`AllJobs`||r.kind===`Job`)?null:{kind:`AllJobs`})},children:[(0,H.jsx)(Mb,{children:(0,H.jsx)(qY,{$expandedOpen:r!==null&&(r.kind===`AllJobs`||r.kind===`Job`)})}),(0,H.jsx)(Lb,{primary:`Specify Job`})]})}),(0,H.jsx)(zp,{in:r!==null&&(r.kind===`AllJobs`||r.kind===`Job`),timeout:`auto`,children:(0,H.jsx)(YY,{newMaterialTy:e,jobs:t.jobs,setNewMaterialTy:n,curCollapse:r,setCurCollapse:i,indent:!0})})]})}function ZY({newMaterialTy:e,setNewMaterialTy:t,toQueue:n}){let r=R(kI),i=R(TI),[a,o]=(0,L.useState)(null),s=eJ(n);return i||r===null||n===null?null:s.castings.length===0&&s.jobs.length===0?(0,H.jsxs)(`div`,{children:[`No jobs are currently scheduled for `,n]}):s.jobs.length===0?(0,H.jsx)(JY,{newMaterialTy:e,setNewMaterialTy:t,castings:s.castings}):s.castings.length===0?(0,H.jsx)(YY,{jobs:s.jobs,newMaterialTy:e,setNewMaterialTy:t,curCollapse:a,setCurCollapse:o}):(0,H.jsx)(XY,{options:s,newMaterialTy:e,setNewMaterialTy:t,curCollapse:a,setCurCollapse:o})}function QY({selectedQueue:e,setSelectedQueue:t,queueNames:n}){let r=(0,L.useRef)(null);return(0,L.useEffect)(()=>{r.current?.scrollIntoView({behavior:`smooth`,block:`end`})},[r]),(0,H.jsxs)(`div`,{ref:r,children:[(0,H.jsx)(`p`,{children:`Select a queue`}),(0,H.jsx)(pb,{children:n.map((n,r)=>(0,H.jsx)(vb,{selected:n===e,onClick:()=>t(n),children:n},r))})]})}function $Y({enteredOperator:e,setEnteredOperator:t}){return R(br).requireOperatorNamePromptWhenAddingMaterial?(0,H.jsx)(`div`,{style:{marginLeft:`1em`},children:(0,H.jsx)(Kw,{fullWidth:!0,label:`Operator`,value:e||``,required:!0,onChange:e=>t(e.target.value)})}):null}function eX({st:e,queueNames:t,setState:n}){return KY(t)?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(lW,{}),t.length>1?(0,H.jsx)(QY,{selectedQueue:e.toQueue,setSelectedQueue:t=>{n({toQueue:t,newMaterialTy:null,enteredOperator:e.enteredOperator})},queueNames:t}):void 0,(0,H.jsx)(ZY,{newMaterialTy:e.newMaterialTy,toQueue:t.length>1?e.toQueue:t[0]??null,setNewMaterialTy:t=>n({...e,newMaterialTy:t})}),(0,H.jsx)($Y,{enteredOperator:e.enteredOperator,setEnteredOperator:t=>n({...e,enteredOperator:t})})]}):null}function tX({st:{enteredOperator:e,newMaterialTy:t,toQueue:n},queueNames:r,onClose:i}){let a=R(br),o=R(jO),s=z(SI),c=R(kI),l=R(AI),u=R(TI),d=R(OI),f=R(PI),[p,m]=BI(),[h,g]=jie(),[_,v]=VI(),[y,b]=(0,L.useState)(null);if(!KY(r))return null;n===null&&r.length===1&&(n=r[0]);let x=``;if(u!==null){if(f&&f.process>=f.totalNumProcesses)return null;x=` To Run Process `+((f?.process??0)+1).toString()}else t?.kind===`JobAndProc`&&t?.last_proc!==void 0&&(x=` To Run Process `+(t.last_proc+1).toString()),t?.kind===`RawMat`&&t?.rawMatName&&(x=` As `+t.rawMatName);let S=``;!u&&c&&c!==``&&(S=` With Serial `+c);let C=d?.location.currentQueue??null;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{title:n===null?`Select a queue to add the material to`:a.requireOperatorNamePromptWhenAddingMaterial&&(e===null||e===``)?`Please enter an operator name`:``,children:(0,H.jsx)(`span`,{children:(0,H.jsx)(Y,{color:`primary`,disabled:n===null||m||g||v||u===null&&t===null||a.requireOperatorNamePromptWhenAddingMaterial&&(e===null||e===``),onClick:async()=>{b(null);try{u?await p({materialId:u.materialID,queue:n??``,queuePosition:-1,operator:e??o}):t&&t.kind===`JobAndProc`&&t.jobUnique?await h({jobUnique:t.jobUnique,lastCompletedProcess:t.last_proc,serial:c??void 0,workorder:l??t?.workorder,queue:n??``,queuePosition:-1,operator:e??o}):t&&t.kind===`RawMat`&&t.rawMatName&&await _({casting:t.rawMatName,quantity:1,queue:n??``,serials:c?[c]:void 0,workorder:l,operator:e??o}),s(null),i()}catch(e){b(Bt.isApiException(e)?e.response:e instanceof Error?e.message:String(e))}},children:n===null?`Add to Queue`:(0,H.jsxs)(`span`,{children:[C===null?`Add To`:`Move From ${C} To`,` `,n,S,x]})})})}),y?(0,H.jsx)(`p`,{role:`alert`,children:y}):null]})}function nX(e,t){let n=t.jobs[e.jobUnique];if(!n)return!1;let r=n.procsAndPaths[e.process-1]?.paths[e.path-1];return r?e.process===n.procsAndPaths.length||!!r.outputQueue:!1}function rX(){let e=R(br),t=R(OI),n=R(NO);if(t===null||t.materialID<0||WU(t)||t.quarantineAfterUnload)return null;let r=e.quarantineQueue?.length?e.quarantineQueue:null,i=Q.ofObject(n.jobs).flatMap(([e,t])=>t.procsAndPaths).flatMap(e=>e.paths).flatMap(e=>{let t=[];return e.inputQueue!==void 0&&t.push(e.inputQueue),e.outputQueue!==void 0&&t.push(e.outputQueue),t}).concat(Q.ofObject(n.queues).filter(([,e])=>e.role===lt.RawMaterial||e.role===lt.InProcessTransfer).map(([e,t])=>e)).toRSet(e=>e),a=Q.ofObject(n.queues).filter(([e,t])=>!i.has(e)).toRSet(([e,t])=>e);if(t.location.type===at.InQueue&&t.location.currentQueue&&a.has(t.location.currentQueue))return{type:`Remove`,material:t,quarantineQueueDestination:null,canRemoveFromQueues:!1};let o=null;switch(t.location.type){case at.OnPallet:case at.InBasket:if(!KU(t)||!nX(t,n))return null;o=`SignalForScrap`;break;case at.InQueue:if(!qU(t)||t.location.currentQueue===void 0||a.has(t.location.currentQueue))return null;o=`Scrap`;break;case at.Free:return null}return o?{type:o,material:t,quarantineQueueDestination:r,canRemoveFromQueues:t.location.type===at.InQueue&&t.location.currentQueue!==void 0&&!a.has(t.location.currentQueue)&&JU(t)}:null}function iX({material:e,removeFromQueues:t,removing:n}){let[r,i]=(0,L.useState)(!1),[a,o]=(0,L.useState)(null),s=z(SI);async function c(){o(null);try{await t(),i(!1),s({type:`MatSummary`,summary:{materialID:e.materialID,partName:e.partName,serial:e.serial}})}catch(e){o(Bt.isApiException(e)?e.response:e instanceof Error?e.message:String(e))}}function l(){o(null),i(!0)}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{title:`Remove from the current queue so it can be rescanned`,children:(0,H.jsx)(Y,{color:`primary`,disabled:n,onClick:l,children:`Remove from Queue`})}),(0,H.jsxs)(cy,{open:r,onClose:()=>i(!1),children:[(0,H.jsx)(dy,{children:`Remove Material from Queue`}),(0,H.jsxs)(uy,{children:[(0,H.jsx)(`p`,{children:`Remove this material from its current queue. Its production history will remain available. You can scan it again to correct its history or assignment and then add it back to a queue.`}),a?(0,H.jsx)(`p`,{role:`alert`,children:a}):null]}),(0,H.jsxs)(ly,{children:[(0,H.jsx)(Y,{color:`primary`,disabled:n,onClick:c,children:`Remove from Queue`}),(0,H.jsx)(Y,{color:`secondary`,disabled:n,onClick:()=>i(!1),children:`Cancel`})]})]})]})}function aX({onClose:e,ignoreOperator:t}){let[n,r]=(0,L.useState)(!1),[i,a]=(0,L.useState)(``),[o,s]=(0,L.useState)(null),[c,l]=(0,L.useState)(!1),[u,d]=(0,L.useState)(null),f=rX(),[p,m]=Oie(),[h,g]=kie(),[_,v]=Aie(),y=R(jO),b=t?null:y,x=z(SI),S=f===null?null:{material:f.material,materialId:f.material.materialID,operation:f.type===`SignalForScrap`?`DeferredQuarantine`:f.type===`Scrap`?`DirectQuarantine`:`RemoveFromSystem`,destination:f.quarantineQueueDestination,operator:b},C=u??S;function w(){S!==null&&(s(null),a(``),d(S),r(!0))}function T(){c||(r(!1),d(null))}if(C===null)return null;let E,D;switch(C.operation){case`RemoveFromSystem`:E=`Remove from system`,D=`Remove`;break;case`DirectQuarantine`:E=C.destination?`Move to ${C.destination}`:`Remove from queue and treat as scrap`,D=C.destination?`Quarantine`:`Scrap`;break;case`DeferredQuarantine`:E=C.destination?`The current automated operation will continue. When the material leaves automation control, move it to ${C.destination}`:`The current automated operation will continue. When the material leaves automation control, remove it from normal production flow as scrap`,D=C.destination?`Quarantine`:`Scrap`;break}async function O(){if(u!==null){l(!0),s(null);try{switch(u.operation){case`DeferredQuarantine`:await h(u.materialId,u.operator,i);break;case`DirectQuarantine`:await _(u.materialId,u.operator,i);break;case`RemoveFromSystem`:await p(u.materialId,u.operator);break}r(!1),d(null),a(``),u.operation===`RemoveFromSystem`?x({type:`MatSummary`,summary:{materialID:u.materialId,partName:u.material.partName,serial:u.material.serial}}):(x(null),e?.())}catch(e){s(Bt.isApiException(e)?e.response:e instanceof Error?e.message:String(e))}finally{l(!1)}}}let ee=c||(C.operation===`DeferredQuarantine`?g:C.operation===`DirectQuarantine`?v:m),te=f?.canRemoveFromQueues===!0?()=>p(f.material.materialID,b):null;return(0,H.jsxs)(H.Fragment,{children:[f?(0,H.jsx)(X,{title:E,children:(0,H.jsx)(Y,{color:`primary`,disabled:ee,onClick:w,children:D})}):null,te&&f?(0,H.jsx)(iX,{material:f.material,removeFromQueues:te,removing:m}):null,(0,H.jsxs)(cy,{open:n&&u!==null,onClose:T,children:[(0,H.jsx)(dy,{children:`Quarantine Material`}),(0,H.jsxs)(uy,{children:[(0,H.jsx)(`p`,{children:E}),(0,H.jsx)(Kw,{label:`Reason`,value:i,onChange:e=>a(e.target.value),fullWidth:!0,autoFocus:!0,multiline:!0}),o?(0,H.jsx)(`p`,{role:`alert`,children:o}):null]}),(0,H.jsxs)(ly,{children:[(0,H.jsx)(Y,{color:`primary`,disabled:ee,onClick:O,children:D}),(0,H.jsx)(Y,{color:`secondary`,disabled:ee,onClick:T,children:`Cancel`})]})]})]})}function oX({onClose:e,ignoreOperator:t=!1}){let n=R(OI),r=R(NO),i=R(jO),a=z(SI),[o,s]=(0,L.useState)(!1),[c,l]=(0,L.useState)(``),[u,d]=(0,L.useState)(!1),[f,p]=(0,L.useState)(null),[m,h]=(0,L.useState)(null),g=n?.action.loadCancellationId??null,_=n===null||g===null||!GU(n)?null:{material:n,cancellationId:g,group:Q.of(r.material).filter(e=>e.action.loadCancellationId===g).toRArray()};if(_===null&&m===null)return null;async function v(){if(m!==null){d(!0),p(null);try{await Ut.cancelLoad(m.material.materialID,t?null:i,new jt({expectedLoadCancellationId:m.cancellationId,reason:c||void 0})),a(null),e?.()}catch(e){p(Bt.isApiException(e)?e.response:e instanceof Error?e.message:String(e))}finally{d(!1)}}}return(0,H.jsxs)(H.Fragment,{children:[_?(0,H.jsx)(X,{title:`Cancel the displayed load instruction`,children:(0,H.jsx)(Y,{color:`primary`,disabled:u,onClick:()=>{h(_),l(``),p(null),s(!0)},children:`Cancel Load`})}):null,(0,H.jsxs)(cy,{open:o&&m!==null,onClose:()=>s(!1),children:[(0,H.jsx)(dy,{children:`Cancel Load`}),(0,H.jsxs)(uy,{children:[(0,H.jsx)(`p`,{children:`The displayed load instruction will be cancelled and recalculated for:`}),(0,H.jsx)(`ul`,{children:m?.group.map(e=>(0,H.jsx)(`li`,{children:e.serial||`Material ID ${e.materialID}`},e.materialID))}),(0,H.jsx)(Kw,{label:`Reason (optional)`,value:c,onChange:e=>l(e.target.value),fullWidth:!0,multiline:!0}),f?(0,H.jsx)(`p`,{role:`alert`,children:f}):null]}),(0,H.jsxs)(ly,{children:[(0,H.jsx)(Y,{color:`primary`,disabled:u,onClick:v,children:`Cancel Load`}),(0,H.jsx)(Y,{color:`secondary`,disabled:u,onClick:()=>s(!1),children:`Keep Load`})]})]})]})}var sX=Q.of([V.AddToQueue,V.RemoveFromQueue,V.LoadUnloadCycle,V.MachineCycle,V.BasketLoadUnload,V.BasketCycle]).toRSet(e=>e);function cX(e,t,n){let r=iO.empty();for(let i of e)if(!(!sX.has(i.type)||_I(i)||!i.material.some(e=>e.id===t&&(n===null||e.proc>=n))))for(let e of i.material)r=r.set(e.id,e.serial??null);return r}function lX(e){let t=R(PI),n=R(wI),r=R(NO),i=R(sO),a=Object.values(n?.possibleCastingsByQueue??{}).flatMap(e=>e),o=Object.values(n?.possibleJobsByQueue??{}).flatMap(e=>e).filter(e=>e.lastCompletedProcess===0).map(e=>({jobUnique:e.jobUnique,job:r.jobs[e.jobUnique]??i.get(e.jobUnique)??null})),s=t!==null&&t.process>=1,c=a.length>0||o.length>0,l=e.st?.changeRawMat!==null&&e.st?.changeRawMat!==void 0&&a.includes(e.st.changeRawMat),u=e.st?.changeJobUnique!==null&&e.st?.changeJobUnique!==void 0&&o.some(t=>t.jobUnique===e.st?.changeJobUnique);function d(t){e.setState({updating:!1,error:null,process:t.startsWith(`proc`)?parseInt(t.substring(4)):1,changeRawMat:t.startsWith(`rawMat`)?t.substring(6):null,changeJobUnique:t.startsWith(`job`)?t.substring(3):null})}return(0,H.jsx)(Kw,{value:l?`rawMat`+e.st.changeRawMat:u?`job`+e.st.changeJobUnique:e.st?.process&&s?`proc`+e.st.process.toString():``,select:!0,onChange:e=>d(e.target.value),variant:`outlined`,label:e.st?.changeRawMat?`Change Raw Material`:e.st?.changeJobUnique?`Change Assigned Job`:e.st?.process||!c?`Invalidate Process`:s?``:`Change Assignment`,children:[s&&c?[(0,H.jsx)(m_,{children:`Invalidate Selected Process`},`procheader`)]:[],s?[(0,H.jsxs)(Hx,{value:`proc`+t.process.toString(),children:[`Invalidate Process `,t.process]},t.process),...t.process>1?[(0,H.jsx)(Hx,{value:`proc1`,children:`Invalidate All Processes`},`all`)]:[]]:[],s&&c?[(0,H.jsx)(m_,{children:`Change Material Type`},`matheader`)]:[],c?[...a.map(e=>(0,H.jsxs)(Hx,{value:`rawMat`+e,children:[`Invalidate Everything and Change to `,e]},`rawMat`+e)),...o.map(({jobUnique:e,job:t})=>(0,H.jsxs)(Hx,{value:`job`+e,children:[t?(0,H.jsx)(Mb,{children:(0,H.jsx)(ZU,{part:t.partName})}):void 0,(0,H.jsx)(Lb,{primary:`Invalidate Everything and Change to Job `+e,secondary:t?.partName})]},`job`+e))]:[]]})}function uX(e){let t=R(TI),n=R(wie),r=R(NO),i=e.st!==null&&t!==null,a=(0,L.useRef)(null);if((0,L.useEffect)(()=>{a.current?.scrollIntoView({behavior:`smooth`,block:`end`})},[a,i]),!i)return(0,H.jsx)(`div`,{});let o=e.st.process!==null||e.st.changeRawMat!==null||e.st.changeJobUnique!==null,s=e.st.changeRawMat!==null||e.st.changeJobUnique!==null?null:e.st.process,c=[...o?cX(n,t.materialID,s):iO.empty()].map(([e,t])=>({materialId:e,serial:t,queued:r.material.find(t=>t.materialID===e)?.location.type===at.InQueue}));return(0,H.jsx)(J,{ref:a,sx:{display:`flex`,flexDirection:`column`,alignItems:`center`,marginTop:`1em`},children:(0,H.jsxs)(RC,{spacing:2,children:[(0,H.jsx)(`p`,{style:{maxWidth:`35em`},children:`Invalidating removes whole recorded cycle events from active material reconstruction while retaining them in the event log.`}),(0,H.jsx)(lX,{st:e.st,setState:e.setState}),c.length>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{children:`All material recorded on these events will be affected:`}),(0,H.jsx)(`ul`,{children:c.map(e=>(0,H.jsxs)(`li`,{children:[e.serial||`Material ID ${e.materialId}`,e.queued?` (currently in a queue)`:``]},e.materialId))})]}):null,e.st.error?(0,H.jsx)(`p`,{role:`alert`,children:e.st.error}):null]})})}function dX(e){let t=R(br),n=R(TI),r=R(OI),i=R(PI),a=R(wI),o=z(SI),s=R(jO);if(e.loadStation&&!t.allowInvalidateMaterialAtLoadStation||!e.loadStation&&!t.allowInvalidateMaterialOnQueuesPage||n===null||!YU(r)||!(a!==null&&(!Q.ofObject(a.possibleCastingsByQueue??{}).isEmpty()||!Q.ofObject(a.possibleJobsByQueue??{}).isEmpty()))&&(i===null||i.process<1))return null;e.ignoreOperator&&(s=null);function c(){e.setState({process:null,updating:!1,error:null,changeRawMat:null,changeJobUnique:null})}function l(){n&&(e.st?.process||e.st?.changeRawMat||e.st?.changeJobUnique)&&(e.setState({...e.st,updating:!0}),Ut.invalidatePalletCycle(n.materialID,s,e.st?.changeRawMat,e.st?.changeJobUnique,e.st?.process??0).then(t=>{t?(o({type:`MatDetails`,details:t}),e.setState(null)):(o(null),e.onClose())}).catch(t=>{e.setState({...e.st,updating:!1,error:Bt.isApiException(t)?t.response:t instanceof Error?t.message:String(t)})}))}return(0,H.jsxs)(H.Fragment,{children:[e.st===null?(0,H.jsx)(Y,{color:`primary`,onClick:c,children:`Invalidate Cycle`}):void 0,e.st===null?void 0:(0,H.jsx)(Y,{color:`primary`,onClick:l,disabled:e.st.updating||e.st.process===null&&e.st.changeRawMat===null&&e.st.changeJobUnique===null,children:e.st.changeJobUnique===null?e.st.changeRawMat===null?e.st.process===null?`Invalidate Cycle`:e.st.process===1?i&&i.process>1?`Invalidate All Processes`:`Invalidate Process 1`:`Invalidate Process `+e.st.process.toString():`Invalidate Everything and Change to `+e.st.changeRawMat:`Invalidate Everything and Change to Job `+e.st.changeJobUnique})]})}function fX(e){return e==null||e==``}function pX(e,t){return n=>{if(fX(n.serial)||n.location.type===at.OnPallet||n.process!==e.process-1)return!1;if(fX(n.jobUnique)){if(fX(n.partName)||n.partName!==e.partName&&(!t||!Q.of(t.procsAndPaths).flatMap(e=>e.paths).some(e=>e.casting===n.partName)))return!1}else if(n.jobUnique!==e.jobUnique||n.path!==e.path)return!1;return!0}}function mX(e){let t=R(NO),n=R(OI);if(n===null||e.st===null)return(0,H.jsx)(`div`,{});let r=t.jobs[n.jobUnique],i=t.material.filter(pX(n,r));return i.length===0?(0,H.jsx)(`p`,{style:{margin:`2em`},children:`No material with the same job is available for swapping. You must edit the pallet using the cell controller software to remove the material from the pallet. Insight will automatically refresh once the cell controller software is updated.`}):(0,H.jsxs)(`div`,{style:{margin:`2em`},children:[(0,H.jsx)(`p`,{children:`Swap serial on pallet with material from the same job.`}),(0,H.jsx)(`p`,{children:`If material on the pallet is from a different job, you cannot use this screen. Instead, the material must first be removed from the pallet using the cell controller software. Insight will automatically refresh when this occurs.`}),(0,H.jsx)(Kw,{value:e.st?.selectedMatToSwap?.serial??``,select:!0,onChange:t=>e.st&&e.setState({...e.st,selectedMatToSwap:i.find(e=>e.serial===t.target.value)??null}),style:{width:`20em`},variant:`outlined`,label:`Select serial to swap with `+(n.serial??``),children:i.map(e=>(0,H.jsx)(Hx,{value:e.serial,children:e.serial},e.materialID))})]})}function hX(e){let t=R(br),n=R(OI),r=z(SI),i=R(jO);if(!t.allowSwapSerialAtLoadStation||(e.ignoreOperator&&(i=null),!n||n.location.type!==at.OnPallet||WU(n)))return null;function a(){n&&e.st&&e.st.selectedMatToSwap&&n.location.type===at.OnPallet&&(e.setState({selectedMatToSwap:e.st.selectedMatToSwap,updating:!0}),Ut.swapMaterialOnPallet(n.materialID,i,{pallet:n.location.palletNum??0,materialIDToSetOnPallet:e.st.selectedMatToSwap.materialID}).catch(console.log).finally(()=>{r(null),e.onClose()}))}return(0,H.jsxs)(H.Fragment,{children:[e.st===null?(0,H.jsx)(Y,{color:`primary`,onClick:()=>e.setState({selectedMatToSwap:null,updating:!1}),children:`Swap Serial`}):void 0,e.st===null?void 0:(0,H.jsx)(Y,{color:`primary`,onClick:a,disabled:e.st.selectedMatToSwap===null||e.st.updating,children:e.st.selectedMatToSwap===null?`Swap Serial`:`Swap with `+(e.st.selectedMatToSwap.serial??``)})]})}var gX=G(Vw,{shouldForwardProp:e=>e.toString()[0]!==`$`})(({$noBorderBottom:e,$highlightedRow:t,$noncompletedRow:n})=>({...e&&{"& > *":{borderBottom:`unset`}},backgroundColor:t?`#FF8A65`:n?`#E0E0E0`:void 0})),_X=[/\bhold\b/,/\bmissing\b/,/\bwait\b/,/\bwaiting\b/,/\bnone\b/];function vX(e){let t=e.comment;return!t||t===``?!1:Q.of(_X).some(e=>e.test(t))}function yX(e){let t=(R(br).allowEditJobPlanQuantityFromQueuesPage??null)!=null,[n,r]=(0,L.useState)(!1),i=e.job,a=vX(i.job);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(gX,{$noBorderBottom:!0,$highlightedRow:a,$noncompletedRow:i.remainingToStart-i.assignedRaw>0,children:[(0,H.jsx)(Z,{children:(0,H.jsxs)(J,{sx:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(J,{sx:{mr:`0.2em`},children:(0,H.jsx)(ZU,{part:i.job.partName,size:25})}),(0,H.jsx)(`div`,{children:(0,H.jsx)(q,{variant:`body2`,component:`span`,sx:{display:`block`},children:i.job.unique})})]})}),(0,H.jsx)(Z,{children:i.startingTime?i.startingTime.toLocaleString():``}),(0,H.jsx)(Z,{children:i.rawMatName===i.job.partName?i.rawMatName:(0,H.jsxs)(J,{sx:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(J,{sx:{mr:`0.2em`},children:(0,H.jsx)(ZU,{part:i.rawMatName,size:25})}),(0,H.jsx)(q,{variant:`body2`,sx:{display:`block`},children:i.rawMatName})]})}),(0,H.jsxs)(Z,{children:[i.job.comment,(0,H.jsx)(X,{title:`Edit`,children:(0,H.jsx)(Um,{size:`small`,onClick:()=>e.editNote(i.job),children:(0,H.jsx)(rT,{})})})]}),(0,H.jsxs)(Z,{align:`right`,children:[i.job.cycles??0,t?(0,H.jsx)(X,{title:`Edit`,children:(0,H.jsx)(Um,{size:`small`,onClick:()=>e.editQty(i),children:(0,H.jsx)(rT,{})})}):void 0]}),(0,H.jsx)(Z,{align:`right`,children:i.remainingToStart}),(0,H.jsx)(Z,{align:`right`,children:i.assignedRaw}),(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(X,{title:i.remainingToStart>0||i.assignedRaw>0?`${i.remainingToStart} - ${i.assignedRaw}`:``,children:(0,H.jsx)(`span`,{children:Math.max(i.remainingToStart-i.assignedRaw,0)})})}),(0,H.jsx)(Z,{align:`right`,children:i.availableUnassigned}),(0,H.jsx)(Z,{children:(0,H.jsx)(X,{title:`Show Details`,children:(0,H.jsx)(Um,{size:`small`,onClick:()=>r(!n),children:n?(0,H.jsx)(mT,{}):(0,H.jsx)(dT,{})})})})]}),(0,H.jsx)(gX,{$highlightedRow:a,$noncompletedRow:i.remainingToStart-i.assignedRaw>0,children:(0,H.jsx)(Z,{sx:{pb:`0`,pt:`0`},colSpan:10,children:(0,H.jsx)(zp,{in:n,timeout:`auto`,unmountOnExit:!0,children:(0,H.jsx)(dJ,{job:i.job,checkAnalysisMonth:!1})})})})]})}function bX(e){let t=R(NO),n=(0,L.useMemo)(()=>rJ(t.jobs,t.material,e.queue),[t,e.queue]);return n.length===0?null:(0,H.jsxs)(jw,{size:`small`,children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:`Job`}),(0,H.jsx)(Z,{children:`Starting Time`}),(0,H.jsx)(Z,{children:`Material`}),(0,H.jsx)(Z,{children:`Note`}),(0,H.jsx)(Z,{align:`right`,children:`Planned Quantity`}),(0,H.jsx)(Z,{align:`right`,children:`Remaining To Start`}),(0,H.jsx)(Z,{align:`right`,children:`Assigned Raw Material`}),(0,H.jsx)(Z,{align:`right`,children:`Required`}),(0,H.jsx)(Z,{align:`right`,children:`Available Unassigned`}),(0,H.jsx)(Z,{})]})}),(0,H.jsx)(Pw,{children:n.map((t,n)=>(0,H.jsx)(yX,{job:t,editNote:e.editNote,editQty:e.editQty},n))})]})}var xX=(0,L.memo)(function({workorder:e,inProc:t}){let n=z(TX);return(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:e.workorderId}),(0,H.jsx)(Z,{children:(0,H.jsxs)(J,{sx:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(J,{sx:{mr:`0.2em`},children:(0,H.jsx)(ZU,{part:e.part,size:25})}),(0,H.jsx)(q,{variant:`body2`,sx:{display:`block`},children:e.part})]})}),(0,H.jsxs)(Z,{children:[e.comments&&e.comments.length>0?e.comments[e.comments.length-1].comment:``,(0,H.jsx)(X,{title:`Edit`,children:(0,H.jsx)(Um,{size:`small`,onClick:()=>n(e),children:(0,H.jsx)(rT,{})})})]}),(0,H.jsx)(Z,{children:e.dueDate.toLocaleDateString()}),(0,H.jsx)(Z,{children:e.priority}),(0,H.jsx)(Z,{children:e.plannedQuantity}),(0,H.jsx)(Z,{children:e.completedQuantity}),(0,H.jsx)(Z,{children:t}),(0,H.jsx)(Z,{children:Math.max(0,e.plannedQuantity-e.completedQuantity-t)})]})}),SX=(0,L.memo)(function(){let e=R(NO);if(!e.workorders||e.workorders.length===0)return null;let t=Q.of(e.workorders).sortBy(e=>e.dueDate.getTime(),e=>e.priority),n=Q.of(e.material).filter(e=>!!e.workorderId&&e.workorderId!==``).toLookupMap(e=>e.workorderId??``,e=>e.partName,()=>1,(e,t)=>e+t);return(0,H.jsxs)(jw,{size:`small`,children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:`Workorder`}),(0,H.jsx)(Z,{children:`Part`}),(0,H.jsx)(Z,{children:`Comment`}),(0,H.jsx)(Z,{children:`Due Date`}),(0,H.jsx)(Z,{children:`Priority`}),(0,H.jsx)(Z,{children:`Planned Qty`}),(0,H.jsx)(Z,{children:`Completed Qty`}),(0,H.jsx)(Z,{children:`In Process`}),(0,H.jsx)(Z,{children:`Remaining To Assign`})]})}),(0,H.jsx)(Pw,{children:t.map(e=>(0,H.jsx)(xX,{workorder:e,inProc:n.get(e.workorderId)?.get(e.part)??0},`${e.workorderId}-${e.part}`))})]})}),CX=(0,L.memo)(function(e){let[t,n]=(0,L.useState)(null),r=z(FO);function i(){e.closeDialog(),n(null)}function a(){t===null||e.job===null||t===e.job.comment||(r(e.job.unique,t),i())}return(0,H.jsx)(cy,{open:e.job!==null,onClose:i,children:e.job===null?void 0:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(dy,{children:(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(`div`,{children:(0,H.jsx)(ZU,{part:e.job.partName,size:40})}),(0,H.jsxs)(`div`,{style:{marginLeft:`1em`,flexGrow:1},children:[`Edit Note For `,e.job.unique]})]})}),(0,H.jsx)(uy,{children:(0,H.jsx)(Kw,{variant:`outlined`,fullWidth:!0,autoFocus:!0,value:t===null?e.job.comment||``:t,onChange:e=>n(e.target.value),onKeyDown:e=>{e.keyCode===13&&t!==null&&(a(),e.preventDefault())}})}),(0,H.jsxs)(ly,{children:[(0,H.jsx)(Y,{color:`primary`,disabled:t===null,onClick:a,children:`Save Note`}),(0,H.jsx)(Y,{color:`primary`,onClick:i,children:`Cancel`})]})]})})}),wX=(0,L.memo)(function(e){let[t,n]=(0,L.useState)(!1),[r,i]=(0,L.useState)(null),a=R(br).allowEditJobPlanQuantityFromQueuesPage??null;function o(){t||(e.closeDialog(),i(null))}async function s(){if(!(a===null||e.job===null||r==null||isNaN(r))){n(!0);try{await fetch(a,{method:`PUT`,headers:new Headers({"Content-Type":`application/json`}),body:JSON.stringify({Unique:e.job.job.unique,Quantity:r})}),e.closeDialog(),i(null)}finally{n(!1)}}}return(0,H.jsx)(cy,{open:a!=null&&e.job!==null,onClose:o,children:e.job===null?void 0:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(dy,{children:(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(`div`,{children:(0,H.jsx)(ZU,{part:e.job.job.partName,size:40})}),(0,H.jsxs)(`div`,{style:{marginLeft:`1em`,flexGrow:1},children:[`Edit Planned Quantity For `,e.job.job.unique]})]})}),(0,H.jsxs)(uy,{children:[(0,H.jsxs)(`p`,{children:[e.job.job.cycles,` currently planned, `,e.job.remainingToStart,` remaining to start`]}),(0,H.jsx)(Kw,{variant:`outlined`,fullWidth:!0,autoFocus:!0,type:`number`,value:r===null?``:r,onChange:e=>i(parseInt(e.target.value)),slotProps:{htmlInput:{style:{textAlign:`right`},min:(e.job.job.cycles??0)-e.job.remainingToStart}}})]}),(0,H.jsxs)(ly,{children:[(0,H.jsxs)(Y,{color:`primary`,disabled:t||r===null||isNaN(r),onClick:()=>void s(),children:[t?(0,H.jsx)(Lm,{size:10}):void 0,`Set Quantity`]}),(0,H.jsx)(Y,{color:`primary`,disabled:t,onClick:o,children:`Cancel`})]})]})})}),TX=P(null);function EX(){let[e,t]=B(TX),[n,r]=(0,L.useState)(null),i=z(IO);function a(){t(null),r(null)}function o(){e&&n&&n!==``&&i({workorder:e.workorderId,comment:n}),a()}return(0,H.jsx)(cy,{open:e!==null,onClose:a,children:e===null?void 0:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(dy,{children:(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(`div`,{children:(0,H.jsx)(ZU,{part:e.part,size:40})}),(0,H.jsxs)(`div`,{style:{marginLeft:`1em`,flexGrow:1},children:[`Add Comment For `,e.workorderId]})]})}),(0,H.jsxs)(uy,{children:[(0,H.jsx)(`ul`,{children:(e.comments??[]).map((e,t)=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(q,{variant:`body1`,children:[e.timeUTC.toLocaleString(),`: `,e.comment]})},t))}),(0,H.jsx)(Kw,{variant:`outlined`,sx:{mt:`1em`},fullWidth:!0,autoFocus:!0,value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&n!==null&&n!==``&&(o(),e.preventDefault())}})]}),(0,H.jsxs)(ly,{children:[(0,H.jsx)(Y,{color:`primary`,onClick:o,children:`Save Comment`}),(0,H.jsx)(Y,{color:`primary`,onClick:a,children:`Cancel`})]})]})})}var DX=(0,L.memo)(function(e){let t=R(br),n=z(LY),r=z(WY),i=z(Wq);if(!t.addToQueueButton||t.addToQueueButton===Oe.DoNotShow)return null;function a(){switch(t.addToQueueButton){case Oe.DoNotShow:return;case Oe.AddBulkUnassigned:e.rawMatQueue?n(e.label):r(e.label);break;case Oe.LookupExistingSerial:r(e.label);return;case Oe.ManualBarcodeScan:i(e.label);return}}return e.rawMatQueue?(0,H.jsx)(X,{title:`Add Raw Material`,children:(0,H.jsx)(hy,{color:`secondary`,onClick:a,size:`large`,style:{marginBottom:`-30px`,zIndex:1},children:(0,H.jsx)(Yw,{})})}):e.inProcQueue?(0,H.jsx)(X,{title:`Add Material`,children:(0,H.jsx)(hy,{color:`secondary`,onClick:a,size:`medium`,style:{marginBottom:`-30px`,zIndex:1},children:(0,H.jsx)(sre,{fontSize:`inherit`})})}):null});function OX(e){let t=R(SI);return t&&t.type===`AddMatWithEnteredSerial`||t&&t.type===`Barcode`&&t.toQueue?e.includes(t.toQueue)?[t.toQueue]:[]:e}var kX=(0,L.memo)(function({queueNames:e}){let[t,n]=(0,L.useState)({toQueue:null,enteredOperator:null,newMaterialTy:null}),[r,i]=(0,L.useState)(null),a=(0,L.useCallback)(()=>{n({toQueue:null,enteredOperator:null,newMaterialTy:null}),i(null)},[]);return e=OX(e),(0,H.jsx)(EW,{allowNote:!0,onClose:a,highlightProcsGreaterOrEqualTo:r?.process??void 0,extraDialogElements:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(uX,{st:r,setState:i}),(0,H.jsx)(eX,{queueNames:e,st:t,setState:n})]}),buttons:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(IY,{}),(0,H.jsx)(aX,{onClose:a}),(0,H.jsx)(oX,{onClose:a}),(0,H.jsx)(dX,{onClose:a,st:r,setState:i}),(0,H.jsx)(tX,{st:t,queueNames:e,onClose:a})]})})}),AX=e=>{let t=R(jO),n=R(NO),r=R(CL),i=R(TL),a=(0,L.useMemo)(()=>iJ(e.queues,n,r,i),[n,e.queues,r,i]),o=!Q.ofObject(n.jobs).isEmpty(),[s,c]=(0,L.useState)(null),l=(0,L.useCallback)(()=>c(null),[]),[u,d]=(0,L.useState)(null),f=(0,L.useCallback)(()=>d(null),[]),[p,m]=(0,L.useState)(null),h=(0,L.useCallback)(()=>m(null),[]);return(0,H.jsxs)(J,{sx:{padding:`8px`,width:`100%`},children:[a.map((e,t)=>(0,H.jsx)(`div`,{style:t<a.length-1?{borderBottom:`1px solid black`}:void 0,children:(0,H.jsx)(mJ,{matIds:e.material.map(e=>e.materialID),direction:`rect`,queueName:e.label,renderDragOverlay:t=>(0,H.jsx)(mW,{mat:t,hideEmptySerial:!0,displayJob:o&&e.rawMaterialQueue,fsize:`normal`}),children:(0,H.jsxs)(J,{sx:{minHeight:`134px`},children:[(0,H.jsxs)(J,{sx:{display:`flex`,margin:`4px`},children:[(0,H.jsx)(q,{variant:`h4`,sx:{flexGrow:1},children:e.label}),e.free?void 0:(0,H.jsx)(DX,{label:e.label,rawMatQueue:e.rawMaterialQueue,inProcQueue:e.inProcQueue})]}),(0,H.jsxs)(J,{sx:{justifyContent:`flex-start`,display:`flex`,flexWrap:`wrap`},children:[e.material.map((t,n)=>(0,H.jsx)(pW,{mat:t,hideEmptySerial:!0,fsize:`normal`,displayJob:o&&e.rawMaterialQueue},n)),e.groupedRawMat&&e.groupedRawMat.length>0?e.groupedRawMat.map((n,r)=>n.material.length===1?(0,H.jsx)(fW,{mat:n.material[0],hideEmptySerial:!0,fsize:`normal`,displayJob:o&&e.rawMaterialQueue},r):(0,H.jsx)(hW,{partOrCasting:n.partOrCasting,assignedJobUnique:n.assignedJobUnique,material:n.material,fsize:`normal`,onOpen:()=>m(n.material)},t)):void 0,e.rawMaterialQueue?o?(0,H.jsx)(bX,{queue:e.label,editNote:c,editQty:d}):(0,H.jsx)(SX,{}):void 0]})]})})},t)),(0,H.jsx)(kX,{queueNames:e.queues}),(0,H.jsx)(GY,{}),(0,H.jsx)(Gq,{}),(0,H.jsx)(VY,{}),(0,H.jsx)(CX,{job:s,closeDialog:l}),(0,H.jsx)(wX,{job:u,closeDialog:f}),(0,H.jsx)(EX,{}),(0,H.jsx)(HY,{material:p,closeDialog:h,operator:t})]})};function jX(e){return JI(`Queues`),(0,H.jsx)(J,{component:`main`,sx:{backgroundColor:`#F8F8F8`,minHeight:{xs:`calc(100vh - 64px - 32px)`,sm:`calc(100vh - 64px - 40px)`,md:`calc(100vh - 64px)`}},children:(0,H.jsx)(AX,{...e})})}var MX=G(Vw,{shouldForwardProp:e=>e.toString()[0]!==`$`})(e=>({"& > *":{borderBottom:`unset`},...e.$darkRow&&{backgroundColor:`#F5F5F5`}})),NX=G(Vw,{shouldForwardProp:e=>e.toString()[0]!==`$`})(e=>({...e.$darkRow&&{backgroundColor:`#F5F5F5`}}));function PX(e){let[t,n]=(0,L.useState)(!1),r=10;e.showMaterial&&(r+=1);let i=e.job;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(MX,{$darkRow:e.showDarkRow&&i.darkRow,children:[(0,H.jsx)(Z,{children:i.routeStartTime.toLocaleString()}),(0,H.jsx)(Z,{children:(0,H.jsxs)(J,{sx:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(J,{sx:{mr:`0.2em`},children:(0,H.jsx)(ZU,{part:i.partName,size:25})}),(0,H.jsx)(`div`,{children:(0,H.jsx)(q,{variant:`body2`,component:`span`,sx:{display:`block`},children:i.partName})})]})}),e.showMaterial?(0,H.jsx)(Z,{children:i.casting?(0,H.jsxs)(J,{sx:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(J,{sx:{mr:`0.2em`},children:(0,H.jsx)(ZU,{part:i.casting,size:25})}),(0,H.jsx)(q,{variant:`body2`,sx:{display:`block`},children:i.casting})]}):void 0}):void 0,(0,H.jsxs)(Z,{children:[i.comment,(0,H.jsx)(X,{title:`Edit`,children:(0,H.jsx)(Um,{size:`small`,onClick:()=>e.setCurEditNoteJob(i),children:(0,H.jsx)(rT,{})})})]}),(0,H.jsx)(Z,{children:i.inProcJob===null?`Archived`:`Active`}),(0,H.jsx)(Z,{align:`right`,children:i.scheduledQty}),(0,H.jsx)(Z,{align:`right`,sx:{backgroundColor:i.decrementedQty>0?`#FF8A65`:void 0},children:i.decrementedQty}),(0,H.jsx)(Z,{align:`right`,children:i.completedQty}),(0,H.jsx)(Z,{align:`right`,children:i.inProcessQty}),(0,H.jsx)(Z,{align:`right`,children:i.remainingQty}),(0,H.jsx)(Z,{children:(0,H.jsx)(X,{title:`Show Details`,children:(0,H.jsx)(Um,{size:`small`,onClick:()=>n(!t),children:t?(0,H.jsx)(mT,{}):(0,H.jsx)(dT,{})})})})]}),(0,H.jsx)(NX,{$darkRow:e.showDarkRow&&i.darkRow,children:(0,H.jsx)(Z,{sx:{pb:`0`,pt:`0`},colSpan:r,children:(0,H.jsx)(zp,{in:t,timeout:`auto`,unmountOnExit:!0,children:(0,H.jsx)(dJ,{job:i.inProcJob?i.inProcJob:i.historicJob,checkAnalysisMonth:!1})})})})]})}function FX(e,t,n,r){let i;switch(t){case 0:i=e=>e.routeStartTime.getTime();break;case 1:i=e=>e.partName;break;case 2:i=e=>e.casting;break;case 3:i=e=>e.comment??null;break;case 4:i=e=>e.scheduledQty;break;case 5:i=e=>e.decrementedQty;break;case 6:i=e=>e.completedQty;break;case 7:i=e=>e.inProcessQty;break;case 8:i=e=>e.remainingQty;break}return(r?Q.of(e):Q.of(e).filter(e=>e.inProcJob!==null)).toSortedArray(n===`asc`?{asc:i}:{desc:i})}function IX(e){return(0,H.jsx)(X,{title:`Sort`,enterDelay:300,children:(0,H.jsx)(Z,{align:e.align,sortDirection:e.sortBy===e.col&&e.order,children:(0,H.jsx)(Uw,{active:e.sortBy===e.col,direction:e.order,onClick:()=>{e.col===e.sortBy?e.setOrder(e.order===`asc`?`desc`:`asc`):(e.setSortBy(e.col),e.setOrder(`asc`))},children:e.children})})})}var LX=(0,L.memo)(function(e){let t={sortBy:e.sortBy,setSortBy:e.setSortBy,order:e.order,setOrder:e.setOrder};return(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(IX,{align:`left`,col:0,...t,children:`Date`}),(0,H.jsx)(IX,{align:`left`,col:1,...t,children:`Part`}),e.showMaterial?(0,H.jsx)(IX,{align:`left`,col:2,...t,children:`Material`}):void 0,(0,H.jsx)(IX,{align:`left`,col:3,...t,children:`Note`}),(0,H.jsxs)(Z,{align:`left`,children:[`Active`,(0,H.jsx)(X,{title:e.showArchived?`Hide Archived`:`Show Archived`,children:(0,H.jsx)(Um,{size:`small`,onClick:t=>{e.setShowArchived(e=>!e),t.stopPropagation()},children:e.showArchived?(0,H.jsx)(TT,{}):(0,H.jsx)(ET,{})})})]}),(0,H.jsx)(IX,{align:`right`,col:4,...t,children:`Scheduled`}),(0,H.jsx)(IX,{align:`right`,col:5,...t,children:`Removed`}),(0,H.jsx)(IX,{align:`right`,col:6,...t,children:`Completed`}),(0,H.jsx)(IX,{align:`right`,col:7,...t,children:`In Process`}),(0,H.jsx)(IX,{align:`right`,col:8,...t,children:`Remaining To Run`}),(0,H.jsx)(Z,{children:(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{style:{height:`25px`,paddingTop:0,paddingBottom:0},onClick:()=>Jq(e.jobs,e.showMaterial),size:`large`,children:(0,H.jsx)(uT,{})})})})]})})}),RX=(0,L.memo)(function(){let[e,t]=(0,L.useState)(null),[n,r]=(0,L.useState)(0),[i,a]=(0,L.useState)(`desc`),[o,s]=(0,L.useState)(!0),c=R(fL),l=R(sO),u=R(NO),d=(0,L.useMemo)(()=>{for(let[,e]of l)for(let t of e.procsAndPaths[0]?.paths??[])if(t.casting!==null&&t.casting!==void 0&&t.casting!==``)return!0;return!1},[l]),f=(0,L.useMemo)(()=>Kq({start:LT(cE(),-6),end:LT(cE(),1)},c.matsById,l,u),[c.matsById,l,u]),p=(0,L.useMemo)(()=>FX(f,n,i,o),[f,n,i,o]);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(jw,{stickyHeader:!0,children:[(0,H.jsx)(LX,{jobs:f,showMaterial:d,sortBy:n,setSortBy:r,order:i,setOrder:a,showArchived:o,setShowArchived:s}),(0,H.jsx)(Pw,{children:p.map((e,r)=>(0,H.jsx)(PX,{job:e,showDarkRow:n===0,showMaterial:d,setCurEditNoteJob:t},e.inProcJob?.unique??e.historicJob?.unique??r))})]}),(0,H.jsx)(CX,{job:e?.historicJob??null,closeDialog:()=>t(null)})]})});function zX(){return JI(`Scheduled Jobs`),(0,H.jsx)(`main`,{style:{padding:`24px`},children:(0,H.jsx)(RX,{})})}var BX=`__FMS_INSIGHT_LOAD_STATION_BIN__`,VX=`__FMS_INSIGHT_PALLETS_BIN__`,HX=`__FMS_INSIGHT_ACTIVE_QUEUE_BIN__`,UX=`__FMS_INSIGHT_BASKETS_BIN__`,WX=SO(`material-bins`,[]);function GX(e,t,n){let r=Array.from(e),[i]=r.splice(t,1);return r.splice(n,0,i),r}function KX(e,t,n){let r=e.get(t);r?r.push(n):e.set(t,[n])}var qX=function(e){return e.LoadStations=`Bin_LoadStations`,e.Pallets=`Bin_Pallets`,e.ActiveQueues=`Bin_ActiveQueues`,e.Baskets=`Bin_Baskets`,e.QuarantineQueues=`Bin_Quarantine`,e}({});function JX(e){let t;return t=e.position.locationTitle&&e.position.locationTitle.length>0?e.position.locationTitle:e.position.location+` `+e.position.locationNum.toString(),e.position.zone&&(t+=`-${e.position.zone}`),t}function YX(e,t){let n=new Map,r=new Map,i=new Map,a=new Map,o=Q.ofObject(e.pallets).toRMap(([,e])=>[e.palletNum,e.palletNum.toString()+` (`+e.currentPalletLocation.group+` #`+e.currentPalletLocation.num.toString()+`)`]);for(let t of e.material)switch(t.location.type){case at.InQueue:if(t.action.type===st.Loading){let r=e.pallets[t.action.loadOntoPalletNum??0];if(r&&r.currentPalletLocation.loc===nt.LoadUnload){let e=r.currentPalletLocation.num;KX(n,e,t)}else KX(i,t.location.currentQueue||`Queue`,t)}else KX(i,t.location.currentQueue||`Queue`,t);break;case at.OnPallet:if(t.location.palletNum){let i=e.pallets[t.location.palletNum];i.currentPalletLocation.loc===nt.LoadUnload?KX(n,i.currentPalletLocation.num,t):KX(r,o.get(t.location.palletNum)??``,t)}else KX(r,`Pallet`,t);break;case at.Free:switch(t.action.type){case st.Loading:{let r=e.pallets[t.action.loadOntoPalletNum??0]?.currentPalletLocation.num;KX(n,r,t);break}case st.LoadingToBasket:{let r=e.baskets?.[t.action.loadToBasketId??0];r?.position.location===_t.LoadUnload?KX(n,r.position.locationNum,t):KX(i,`Free Material`,t);break}default:KX(i,`Free Material`,t);break}break;case at.InBasket:t.location.basketId!==void 0&&KX(a,t.location.basketId,t);break}let s=Q.ofObject(e.jobs).flatMap(([e,t])=>t.procsAndPaths).flatMap(e=>e.paths).flatMap(e=>{let t=[];return e.inputQueue!==void 0&&t.push(e.inputQueue),e.outputQueue!==void 0&&t.push(e.outputQueue),t}).concat(Q.ofObject(e.queues).filter(([,e])=>e.role===lt.RawMaterial||e.role===lt.InProcessTransfer).map(([e,t])=>e)).toRSet(e=>e),c=Q.ofObject(e.queues).filter(([e,t])=>!s.has(e)).toRSet(([e,t])=>e),l=t.filter(e=>e===`__FMS_INSIGHT_LOAD_STATION_BIN__`||e===`__FMS_INSIGHT_PALLETS_BIN__`||e===`__FMS_INSIGHT_ACTIVE_QUEUE_BIN__`||e===`__FMS_INSIGHT_BASKETS_BIN__`||c.has(e));l.indexOf(`__FMS_INSIGHT_ACTIVE_QUEUE_BIN__`)<0&&l.unshift(HX),a.size>0&&l.indexOf(`__FMS_INSIGHT_BASKETS_BIN__`)<0&&l.unshift(UX),l.indexOf(`__FMS_INSIGHT_PALLETS_BIN__`)<0&&l.unshift(VX),l.indexOf(`__FMS_INSIGHT_LOAD_STATION_BIN__`)<0&&l.unshift(BX);for(let e of Q.of(c).sortBy(e=>e))l.indexOf(e)<0&&l.push(e);return l.map(t=>{if(t===`__FMS_INSIGHT_LOAD_STATION_BIN__`)return{type:`Bin_LoadStations`,binId:BX,byLul:n};if(t===`__FMS_INSIGHT_PALLETS_BIN__`)return{type:`Bin_Pallets`,binId:VX,byPallet:r};if(t===`__FMS_INSIGHT_ACTIVE_QUEUE_BIN__`)return{type:`Bin_ActiveQueues`,binId:HX,byQueue:Q.of(s).toRMap(e=>{let t=i.get(e)??[];return t.sort((e,t)=>(e.location.queuePosition??0)-(t.location.queuePosition??0)),[e,t]},(e,t)=>e.concat(t))};if(t===`__FMS_INSIGHT_BASKETS_BIN__`)return{type:`Bin_Baskets`,binId:UX,byBasket:new Map(a),basketLocations:Q.ofObject(e.baskets??{}).collect(([e,t])=>parseInt(e)>0?[parseInt(e),JX(t)]:null).toRMap(e=>e)};{let e=t,n=i.get(e)??[];return n.sort((e,t)=>(e.location.queuePosition??0)-(t.location.queuePosition??0)),{type:`Bin_Quarantine`,binId:e,queueName:e,material:n}}})}function XX(e,t,n,r){return e.map(e=>{switch(e.type){case`Bin_Quarantine`:if(e.queueName===n){let n=e.material.filter(e=>e.materialID!==t.materialID);return n.splice(r,0,t),{...e,material:n}}else return{...e,material:e.material.filter(e=>e.materialID!==t.materialID)};default:return e}})}function ZX(e,t){for(let n of t)switch(n.type){case`Bin_Quarantine`:for(let t=0;t<n.material.length;t++)if(n.material[t].materialID===e)return{bin:n,idx:t};break;default:break}return null}function QX(e,t){for(let n of t)if(n.type===`Bin_Quarantine`&&n.queueName===e)return{bin:n,idx:0};return null}var $X=(0,L.forwardRef)(function(e,t){return(0,H.jsxs)(J,{sx:{margin:e.isDragOverlay?void 0:`0.75em`,opacity:e.isActiveDrag?.2:1,border:`1px solid black`,padding:`4px`},ref:t,...e.dragRootProps,children:[(0,H.jsx)(J,{role:`button`,tabIndex:0,sx:{cursor:e.isDragOverlay?`grabbing`:`grab`},...e.dragHandleProps,children:(0,H.jsx)(q,{variant:`h4`,children:e.label})}),(0,H.jsx)(J,{sx:{display:`flex`,flexDirection:`column`,flexWrap:`nowrap`,width:`18em`,minHeight:`20em`},children:e.children})]})});function eZ(e){let t={type:`container`,bin:e.bin},{active:n,isDragging:r,attributes:i,listeners:a,setNodeRef:o,setActivatorNodeRef:s,transform:c,transition:l}=EU({id:e.binId,data:t}),u={...a};for(let[e,t]of Object.entries(i))e.startsWith(`aria`)&&(u[e]=t);let d={transform:c?`translate3d(${Math.round(c.x)}px, ${Math.round(c.y)}px, 0)`:void 0,transition:n===null?void 0:l};return(0,H.jsx)($X,{ref:o,dragRootProps:{style:d},dragHandleProps:u,setDragHandleRef:s,isActiveDrag:r,...e})}var tZ=(0,L.memo)(function(e){return e.isDragOverlay?(0,H.jsx)($X,{binId:e.binId,label:e.queue,isDragOverlay:!0,children:e.material.map(e=>(0,H.jsx)(fW,{mat:e,hideAvatar:!0,showHandle:!0},e.materialID))}):(0,H.jsx)(eZ,{binId:e.binId,label:e.queue,bin:e.bin,children:(0,H.jsx)(vU,{items:e.material.map(e=>e.materialID),strategy:mU,children:e.material.map(e=>(0,H.jsx)(pW,{mat:e,hideAvatar:!0},e.materialID))})})});function nZ(e,t){return e-t}function rZ(e){return`Pallet `+e}function iZ(e,t){let n=parseInt(e),r=parseInt(t);return isNaN(n)||isNaN(r)?e.localeCompare(t):n-r}function aZ(e){return e}function oZ(e,t){return e.localeCompare(t)}function sZ(e,t){return e-t}var cZ=class extends L.PureComponent{render(){return(0,H.jsx)(this.props.isDragOverlay?$X:eZ,{label:this.props.name,binId:this.props.binId,bin:this.props.bin,isDragOverlay:this.props.isDragOverlay,children:Q.of(this.props.material).sortWith(([e,t],[n,r])=>this.props.compareLabel(e,n)).map(([e,t],n)=>(0,H.jsxs)(`div`,{children:[(0,H.jsx)(q,{variant:`caption`,children:this.props.renderLabel(e)}),t.map((e,t)=>(0,H.jsx)(fW,{mat:e,hideAvatar:!0},t))]},n))})}};function lZ({matBin:e,isDragOverlay:t}){let n=R(br),r=ok(n.basketName);switch(e.type){case qX.LoadStations:return(0,H.jsx)(cZ,{name:`Load Stations`,binId:e.binId,renderLabel:e=>ik(e,n.loadStationNames),compareLabel:nZ,material:e.byLul,bin:e,isDragOverlay:t});case qX.Pallets:return(0,H.jsx)(cZ,{name:`Pallets`,binId:e.binId,renderLabel:rZ,compareLabel:iZ,material:e.byPallet,bin:e,isDragOverlay:t});case qX.ActiveQueues:return(0,H.jsx)(cZ,{name:`Queues`,binId:e.binId,renderLabel:aZ,compareLabel:oZ,material:e.byQueue,bin:e,isDragOverlay:t});case qX.Baskets:return(0,H.jsx)(cZ,{name:r+`s`,binId:e.binId,renderLabel:t=>r+` `+t.toString()+(typeof t==`number`&&e.basketLocations.get(t)?` (${e.basketLocations.get(t)})`:``),compareLabel:sZ,material:e.byBasket,bin:e,isDragOverlay:t});case qX.QuarantineQueues:return(0,H.jsx)(tZ,{binId:e.binId,queue:e.queueName,material:e.material,bin:e,isDragOverlay:t})}}var uZ=(0,L.memo)(function(){let[e,t]=(0,L.useState)(null),[n,r]=(0,L.useState)(null);function i(){t(null),r(null)}return(0,H.jsx)(EW,{onClose:i,allowNote:!0,highlightProcsGreaterOrEqualTo:n?.process??void 0,extraDialogElements:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(mX,{st:e,setState:t}),n===null?null:(0,H.jsx)(uX,{st:n,setState:r})]}),buttons:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(aX,{onClose:i,ignoreOperator:!0}),(0,H.jsx)(oX,{onClose:i,ignoreOperator:!0}),(0,H.jsx)(hX,{st:e,setState:t,onClose:i,ignoreOperator:!0}),(0,H.jsx)(dX,{st:n,setState:r,onClose:i,ignoreOperator:!0})]})})});function dZ(e){return(0,L.useCallback)(t=>{if(typeof t.active.id==`string`)return WB({...t,droppableContainers:t.droppableContainers.filter(e=>typeof e.id==`string`)});let n=YB(t),r=HB(n.length>0?n:qB(t),`id`);if(r!=null){if(typeof r==`string`){let n=QX(r,e);n&&n.bin.material.length>0&&(r=WB({...t,droppableContainers:t.droppableContainers.filter(e=>e.id!==r&&n.bin.material.findIndex(t=>t.materialID===e.id)>=0)})[0]?.id)}return[{id:r}]}return[]},[e])}function fZ(e){JI(`All Material`);let t=R(NO),[n,r]=B(WX),[i]=BI(),a=z(RO),[o,s]=(0,L.useState)(null),c=(0,L.useMemo)(()=>{let e=YX(t,n);return o&&o.type===`material`&&o.curOverBinId!==null?XX(e,o.mat,o.curOverBinId,o.initialIdx):e},[t,n,o]),l=e.displaySystemBins?c:c.filter(e=>e.type===qX.QuarantineQueues);return(0,H.jsxs)(LH,{collisionDetection:dZ(c),measuring:{droppable:{strategy:$V.Always}},onDragStart:({active:e})=>{typeof e.id==`string`&&typeof e.data.current==`object`&&e.data.current!==null&&`bin`in e.data.current?s({type:`column`,bin:e.data.current.bin}):typeof e.data.current==`object`&&e.data.current!==null&&`mat`in e.data.current&&s({type:`material`,mat:e.data.current.mat,curOverBinId:null,initialIdx:0})},onDragOver:({over:e})=>{if(!e||o===null||o.type===`column`)return;let t=typeof e.id==`string`?QX(e.id,c):ZX(e.id,c);t&&t.bin.binId!==o.curOverBinId&&s({...o,curOverBinId:t.bin.binId,initialIdx:t.idx})},onDragEnd:({over:e})=>{if(o!==null){if(!e){s(null);return}if(o.type===`column`)typeof e.id==`number`?console.log(`Invalid, collision should never allow a column drag to be over a material`):r(GX(l.map(e=>e.binId),l.findIndex(e=>e.binId===o.bin.binId),l.findIndex(t=>t.binId===e.id)));else{let t=typeof e.id==`string`?QX(e.id,c):ZX(e.id,c);t&&(i({materialId:o.mat.materialID,queue:t.bin.queueName,queuePosition:t.idx,operator:null}).catch(console.error),a({queue:t.bin.queueName,matId:o.mat.materialID,newIdx:t.idx}))}s(null)}},onDragCancel:()=>s(null),children:[(0,H.jsx)(vU,{items:l.map(e=>e.binId),strategy:uU,children:(0,H.jsx)(J,{component:`main`,sx:{display:`flex`,flexWrap:`nowrap`,backgroundColor:`#F8F8F8`,minHeight:{xs:`calc(100vh - 64px - 48px)`,md:`calc(100vh - 64px)`}},children:l.map(e=>(0,H.jsx)(lZ,{matBin:e},e.binId))})}),(0,H.jsx)(rU,{children:o?.type===`material`?(0,H.jsx)(mW,{mat:o.mat,hideAvatar:!0}):o?.type===`column`?(0,H.jsx)(lZ,{matBin:o.bin,isDragOverlay:!0}):void 0}),(0,H.jsx)(uZ,{})]})}function pZ(e){let t=[];for(let n of e)for(let e of n.stops)t.push(`P${n.pallet},M${e.stationNum}`);return t.join(` -> `)}function mZ(e,t,n){let r=Q.of(e).collect(e=>e.result.type===aL.Completed&&!e.result.success?e.materialID:null).toRSet(e=>e);return Q.of(e).collect(e=>{if(t&&(e.time<t.start||e.time>t.end))return null;switch(e.result.type){case aL.Triggered:return{time:e.time,materialID:e.materialID,partName:e.part,serial:e.serial,workorder:e.workorder,toInspect:e.result.toInspect,path:pZ(e.result.actualPath),failed:r.has(e.materialID)};default:return null}}).buildHashMap(e=>e.path,(e,t)=>{let n=e??[];return n.push(t),n}).mapValues(e=>({material:Q.of(e).toSortedArray(n,e=>e.time.getTime()),failedCnt:e.reduce((e,t)=>e+ +!!t.failed,0)}))}function hZ(e,t,n){return Q.of(e).collect(e=>e.time<t||e.time>n?null:e.result.type===aL.Completed&&!e.result.success?{time:e.time,materialID:e.materialID,serial:e.serial,workorder:e.workorder,inspType:e.inspType,part:e.part}:null).toSortedArray(e=>e.time.getTime())}function gZ(e){for(let t of e)if(t.type===V.Inspection){let e=JSON.parse((t.details||{}).ActualPath||`[]`);if(!Array.isArray(e))continue;let n=[];for(let t of e)typeof t==`object`&&t&&n.push(Ne.fromJS(t));if(n.length>0)return n}return[]}function _Z(e,t,n){let r=`<table>
|
|
335
335
|
<thead><tr>`;r+=`<th>Path</th><th>Date</th><th>Part</th><th>Inspection</th>`,r+=`<th>Serial</th><th>Workorder</th><th>Inspected</th><th>Failed</th>`,r+=`</tr></thead>
|
|
336
336
|
<tbody>
|
|
337
|
-
`;let i=
|
|
337
|
+
`;let i=mZ(n,void 0,{asc:e=>e.time.getTime()}),a=Q.of(i.keys()).toSortedArray(e=>e);for(let n of a){let a=i.get(n);if(a)for(let i of a.material)r+=`<tr>`,r+=`<td>`+n+`</td>`,r+=`<td>`+i.time.toLocaleString(void 0,{month:`short`,day:`numeric`,year:`numeric`,hour:`numeric`,minute:`2-digit`})+`</td>`,r+=`<td>`+e+`</td>`,r+=`<td>`+t+`</td>`,r+=`<td>`+(i.serial||``)+`</td>`,r+=`<td>`+(i.workorder||``)+`</td>`,r+=`<td>`+(i.toInspect?`inspected`:``)+`</td>`,r+=`<td>`+(i.failed?`failed`:``)+`</td>`,r+=`</tr>
|
|
338
338
|
`}return r+=`</tbody>
|
|
339
|
-
</table>`,r}function
|
|
339
|
+
</table>`,r}function vZ(e,t,n){Ak(_Z(e,t,n))}function yZ(e){let t=`<table>
|
|
340
340
|
<thead><tr>`;t+=`<th>Date</th><th>Part</th><th>Inspection</th><th>Serial</th><th>Workorder</th>`,t+=`</tr></thead>
|
|
341
341
|
<tbody>
|
|
342
342
|
`;for(let n of Q.of(e).sortBy({desc:e=>e.time.getTime()}))t+=`<tr>`,t+=`<td>`+n.time.toLocaleString()+`</td>`,t+=`<td>`+n.part+`</td>`,t+=`<td>`+n.inspType+`</td>`,t+=`<td>`+(n.serial||``)+`</td>`,t+=`<td>`+(n.workorder||``)+`</td>`,t+=`</tr>
|
|
343
343
|
`;return t+=`</tbody>
|
|
344
|
-
</table>`,t}function yZ(e){Ak(vZ(e))}function bZ(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n<t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n<i||n===void 0&&i>=i)&&(n=i)}return n}function xZ(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n>t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function SZ(e,t){let n=0;if(t===void 0)for(let t of e)(t=+t)&&(n+=t);else{let r=-1;for(let i of e)(i=+t(i,++r,e))&&(n+=i)}return n}function CZ(e,t){return e.sourceLinks.length?e.depth:t-1}function wZ(e){return function(){return e}}function TZ(e,t){return DZ(e.source,t.source)||e.index-t.index}function EZ(e,t){return DZ(e.target,t.target)||e.index-t.index}function DZ(e,t){return e.y0-t.y0}function OZ(e){return e.value}function kZ(e){return e.index}function AZ(e){return e.nodes}function jZ(e){return e.links}function MZ(e,t){let n=e.get(t);if(!n)throw Error(`missing: `+t);return n}function NZ({nodes:e}){for(let t of e){let e=t.y0,n=e;for(let n of t.sourceLinks)n.y0=e+n.width/2,e+=n.width;for(let e of t.targetLinks)e.y1=n+e.width/2,n+=e.width}}function PZ(){let e=0,t=0,n=1,r=1,i=24,a=8,o,s=kZ,c=CZ,l,u,d=AZ,f=jZ,p=6;function m(){let e={nodes:d.apply(null,arguments),links:f.apply(null,arguments)};return h(e),g(e),_(e),v(e),x(e),NZ(e),e}m.update=function(e){return NZ(e),e},m.nodeId=function(e){return arguments.length?(s=typeof e==`function`?e:wZ(e),m):s},m.nodeAlign=function(e){return arguments.length?(c=typeof e==`function`?e:wZ(e),m):c},m.nodeSort=function(e){return arguments.length?(l=e,m):l},m.nodeWidth=function(e){return arguments.length?(i=+e,m):i},m.nodePadding=function(e){return arguments.length?(a=o=+e,m):a},m.nodes=function(e){return arguments.length?(d=typeof e==`function`?e:wZ(e),m):d},m.links=function(e){return arguments.length?(f=typeof e==`function`?e:wZ(e),m):f},m.linkSort=function(e){return arguments.length?(u=e,m):u},m.size=function(i){return arguments.length?(e=t=0,n=+i[0],r=+i[1],m):[n-e,r-t]},m.extent=function(i){return arguments.length?(e=+i[0][0],n=+i[1][0],t=+i[0][1],r=+i[1][1],m):[[e,t],[n,r]]},m.iterations=function(e){return arguments.length?(p=+e,m):p};function h({nodes:e,links:t}){for(let[t,n]of e.entries())n.index=t,n.sourceLinks=[],n.targetLinks=[];let n=new Map(e.map((t,n)=>[s(t,n,e),t]));for(let[e,r]of t.entries()){r.index=e;let{source:t,target:i}=r;typeof t!=`object`&&(t=r.source=MZ(n,t)),typeof i!=`object`&&(i=r.target=MZ(n,i)),t.sourceLinks.push(r),i.targetLinks.push(r)}if(u!=null)for(let{sourceLinks:t,targetLinks:n}of e)t.sort(u),n.sort(u)}function g({nodes:e}){for(let t of e)t.value=t.fixedValue===void 0?Math.max(SZ(t.sourceLinks,OZ),SZ(t.targetLinks,OZ)):t.fixedValue}function _({nodes:e}){let t=e.length,n=new Set(e),r=new Set,i=0;for(;n.size;){for(let e of n){e.depth=i;for(let{target:t}of e.sourceLinks)r.add(t)}if(++i>t)throw Error(`circular link`);n=r,r=new Set}}function v({nodes:e}){let t=e.length,n=new Set(e),r=new Set,i=0;for(;n.size;){for(let e of n){e.height=i;for(let{source:t}of e.targetLinks)r.add(t)}if(++i>t)throw Error(`circular link`);n=r,r=new Set}}function y({nodes:t}){let r=bZ(t,e=>e.depth)+1,a=(n-e-i)/(r-1),o=Array(r);for(let n of t){let t=Math.max(0,Math.min(r-1,Math.floor(c.call(null,n,r))));n.layer=t,n.x0=e+t*a,n.x1=n.x0+i,o[t]?o[t].push(n):o[t]=[n]}if(l)for(let e of o)e.sort(l);return o}function b(e){let n=xZ(e,e=>(r-t-(e.length-1)*o)/SZ(e,OZ));for(let i of e){let e=t;for(let t of i){t.y0=e,t.y1=e+t.value*n,e=t.y1+o;for(let e of t.sourceLinks)e.width=e.value*n}e=(r-e+o)/(i.length+1);for(let t=0;t<i.length;++t){let n=i[t];n.y0+=e*(t+1),n.y1+=e*(t+1)}O(i)}}function x(e){let n=y(e);o=Math.min(a,(r-t)/(bZ(n,e=>e.length)-1)),b(n);for(let e=0;e<p;++e){let t=.99**e,r=Math.max(1-t,(e+1)/p);C(n,t,r),S(n,t,r)}}function S(e,t,n){for(let r=1,i=e.length;r<i;++r){let i=e[r];for(let e of i){let n=0,r=0;for(let{source:t,value:i}of e.targetLinks){let a=i*(e.layer-t.layer);n+=ee(t,e)*a,r+=a}if(!(r>0))continue;let i=(n/r-e.y0)*t;e.y0+=i,e.y1+=i,D(e)}l===void 0&&i.sort(DZ),w(i,n)}}function C(e,t,n){for(let r=e.length-2;r>=0;--r){let i=e[r];for(let e of i){let n=0,r=0;for(let{target:t,value:i}of e.sourceLinks){let a=i*(t.layer-e.layer);n+=te(e,t)*a,r+=a}if(!(r>0))continue;let i=(n/r-e.y0)*t;e.y0+=i,e.y1+=i,D(e)}l===void 0&&i.sort(DZ),w(i,n)}}function w(e,n){let i=e.length>>1,a=e[i];E(e,a.y0-o,i-1,n),T(e,a.y1+o,i+1,n),E(e,r,e.length-1,n),T(e,t,0,n)}function T(e,t,n,r){for(;n<e.length;++n){let i=e[n],a=(t-i.y0)*r;a>1e-6&&(i.y0+=a,i.y1+=a),t=i.y1+o}}function E(e,t,n,r){for(;n>=0;--n){let i=e[n],a=(i.y1-t)*r;a>1e-6&&(i.y0-=a,i.y1-=a),t=i.y0-o}}function D({sourceLinks:e,targetLinks:t}){if(u===void 0){for(let{source:{sourceLinks:e}}of t)e.sort(EZ);for(let{target:{targetLinks:t}}of e)t.sort(TZ)}}function O(e){if(u===void 0)for(let{sourceLinks:t,targetLinks:n}of e)t.sort(EZ),n.sort(TZ)}function ee(e,t){let n=e.y0-(e.sourceLinks.length-1)*o/2;for(let{target:r,width:i}of e.sourceLinks){if(r===t)break;n+=i+o}for(let{source:r,width:i}of t.targetLinks){if(r===e)break;n-=i}return n}function te(e,t){let n=t.y0-(t.targetLinks.length-1)*o/2;for(let{source:r,width:i}of t.targetLinks){if(r===e)break;n+=i+o}for(let{target:r,width:i}of e.sourceLinks){if(r===t)break;n-=i}return n}return m}var FZ=Math.PI,IZ=2*FZ,LZ=1e-6,RZ=IZ-LZ;function zZ(){this._x0=this._y0=this._x1=this._y1=null,this._=``}function BZ(){return new zZ}zZ.prototype=BZ.prototype={constructor:zZ,moveTo:function(e,t){this._+=`M`+(this._x0=this._x1=+e)+`,`+(this._y0=this._y1=+t)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+=`Z`)},lineTo:function(e,t){this._+=`L`+(this._x1=+e)+`,`+(this._y1=+t)},quadraticCurveTo:function(e,t,n,r){this._+=`Q`+ +e+`,`+ +t+`,`+(this._x1=+n)+`,`+(this._y1=+r)},bezierCurveTo:function(e,t,n,r,i,a){this._+=`C`+ +e+`,`+ +t+`,`+ +n+`,`+ +r+`,`+(this._x1=+i)+`,`+(this._y1=+a)},arcTo:function(e,t,n,r,i){e=+e,t=+t,n=+n,r=+r,i=+i;var a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(i<0)throw Error(`negative radius: `+i);if(this._x1===null)this._+=`M`+(this._x1=e)+`,`+(this._y1=t);else if(d>LZ)if(!(Math.abs(u*s-c*l)>LZ)||!i)this._+=`L`+(this._x1=e)+`,`+(this._y1=t);else{var f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((FZ-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>LZ&&(this._+=`L`+(e+y*l)+`,`+(t+y*u)),this._+=`A`+i+`,`+i+`,0,0,`+ +(u*f>l*p)+`,`+(this._x1=e+b*s)+`,`+(this._y1=t+b*c)}},arc:function(e,t,n,r,i,a){e=+e,t=+t,n=+n,a=!!a;var o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;if(n<0)throw Error(`negative radius: `+n);this._x1===null?this._+=`M`+c+`,`+l:(Math.abs(this._x1-c)>LZ||Math.abs(this._y1-l)>LZ)&&(this._+=`L`+c+`,`+l),n&&(d<0&&(d=d%IZ+IZ),d>RZ?this._+=`A`+n+`,`+n+`,0,1,`+u+`,`+(e-o)+`,`+(t-s)+`A`+n+`,`+n+`,0,1,`+u+`,`+(this._x1=c)+`,`+(this._y1=l):d>LZ&&(this._+=`A`+n+`,`+n+`,0,`+ +(d>=FZ)+`,`+u+`,`+(this._x1=e+n*Math.cos(i))+`,`+(this._y1=t+n*Math.sin(i))))},rect:function(e,t,n,r){this._+=`M`+(this._x0=this._x1=+e)+`,`+(this._y0=this._y1=+t)+`h`+ +n+`v`+ +r+`h`+-n+`Z`},toString:function(){return this._}};function VZ(e){return function(){return e}}function HZ(e){return e[0]}function UZ(e){return e[1]}var WZ=Array.prototype.slice;function GZ(e){return e.source}function KZ(e){return e.target}function qZ(e){var t=GZ,n=KZ,r=HZ,i=UZ,a=null;function o(){var o,s=WZ.call(arguments),c=t.apply(this,s),l=n.apply(this,s);if(a||=o=BZ(),e(a,+r.apply(this,(s[0]=c,s)),+i.apply(this,s),+r.apply(this,(s[0]=l,s)),+i.apply(this,s)),o)return a=null,o+``||null}return o.source=function(e){return arguments.length?(t=e,o):t},o.target=function(e){return arguments.length?(n=e,o):n},o.x=function(e){return arguments.length?(r=typeof e==`function`?e:VZ(+e),o):r},o.y=function(e){return arguments.length?(i=typeof e==`function`?e:VZ(+e),o):i},o.context=function(e){return arguments.length?(a=e??null,o):a},o}function JZ(e,t,n,r,i){e.moveTo(t,n),e.bezierCurveTo(t=(t+r)/2,n,t,i,r,i)}function YZ(){return qZ(JZ)}function XZ(e){return[e.source.x1,e.y0]}function ZZ(e){return[e.target.x0,e.y1]}function QZ(){return YZ().source(XZ).target(ZZ)}var $Z=class{constructor(e,t){this.unique=e,this.name=t}compare(e){let t=this.unique.localeCompare(e.unique);return t===0?this.name.localeCompare(e.name):t}hash(){return yD(this.unique,this.name)}toString(){return`{unique: ${this.unique}}, name: ${this.name}}`}},eQ=class{constructor(e,t){this.from=e,this.to=t}compare(e){let t=this.from.compare(e.from);return t===0?this.to.compare(e.to):t}hash(){return yD(this.from,this.to)}toString(){return`{from: ${this.from.toString()}}, to: ${this.to.toString()}}`}};function tQ(e,t,n){let r=``,i=new $Z(``,`raw`),a=[];for(let t of e)for(let e of t.stops){let n=`P`+t.pallet+`,M`+e.stationNum.toString();r+=`->`+n;let o=new $Z(r,n);a.push(new eQ(i,o)),i=o}return t&&n!==void 0?n?a.push(new eQ(i,new $Z(`@@success`,`success`))):a.push(new eQ(i,new $Z(`@@failed`,`failed`))):a.push(new eQ(i,new $Z(`@@uninspected`,`uninspected`))),a}function nQ(e){let t=Q.of(e).filter(e=>e.result.type===aL.Completed).toRMap(e=>[e.materialID,e.result.type===aL.Completed&&e.result.success]),n=Q.of(e).flatMap(e=>e.result.type===aL.Triggered?tQ(e.result.actualPath,e.result.toInspect,t.get(e.materialID)??!1):[]),r=n.flatMap(e=>[e.from,e.to]).distinctBy(e=>e).map((e,t)=>({idx:t,node:e})),i=r.map(e=>({unique:e.node.unique,name:e.node.name})).toMutableArray(),a=r.toHashMap(e=>[e.node,e.idx],(e,t)=>e);return{nodes:i,links:n.toHashMap(e=>[e,1],(e,t)=>e+t).toLazySeq().map(([e,t])=>({source:a.get(e.from),target:a.get(e.to),value:t})).toMutableArray()}}var rQ=(e,t,n,r)=>{if(n===`length`||n===`prototype`||n===`arguments`||n===`caller`)return;let i=Object.getOwnPropertyDescriptor(e,n),a=Object.getOwnPropertyDescriptor(t,n);!iQ(i,a)&&r||Object.defineProperty(e,n,a)},iQ=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},aQ=(e,t)=>{let n=Object.getPrototypeOf(t);n!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,n)},oQ=(e,t)=>`/* Wrapped ${e}*/\n${t}`,sQ=Object.getOwnPropertyDescriptor(Function.prototype,`toString`),cQ=Object.getOwnPropertyDescriptor(Function.prototype.toString,`name`),lQ=(e,t,n)=>{let r=n===``?``:`with ${n.trim()}() `,i=oQ.bind(null,r,t.toString());Object.defineProperty(i,"name",cQ);let{writable:a,enumerable:o,configurable:s}=sQ;Object.defineProperty(e,"toString",{value:i,writable:a,enumerable:o,configurable:s})};function uQ(e,t,{ignoreNonConfigurable:n=!1}={}){let{name:r}=e;for(let r of Reflect.ownKeys(t))rQ(e,t,r,n);return aQ(e,t),lQ(e,t,r),e}var dQ=2147483647,fQ=new WeakMap,pQ=new WeakMap,mQ=new WeakMap;function hQ(e,t){let n=e.get(t);if(n){if(n.maxAge<=Date.now()){e.delete(t);return}return n}}function gQ(e,{cacheKey:t,cache:n=new Map,maxAge:r}={}){if(r===0)return e;if(typeof r==`number`&&Number.isFinite(r)){if(r>dQ)throw TypeError(`The \`maxAge\` option cannot exceed ${dQ}.`);if(r<0)throw TypeError("The `maxAge` option should not be a negative number.")}let i=function(...a){let o=t?t(a):a[0],s=hQ(n,o);if(s)return s.data;let c=e.apply(this,a),l=typeof r==`function`?r(...a):r;if(l!==void 0&&l!==1/0){if(!Number.isFinite(l))throw TypeError("The `maxAge` function must return a finite number, `0`, or `Infinity`.");if(l<=0)return c;if(l>dQ)throw TypeError(`The \`maxAge\` function result cannot exceed ${dQ}.`)}if(n.set(o,{data:c,maxAge:l===void 0||l===1/0?1/0:Date.now()+l}),l!==void 0&&l!==1/0){let e=setTimeout(()=>{n.delete(o),pQ.get(i)?.delete(e)},l);e.unref?.();let t=pQ.get(i)??new Set;t.add(e),pQ.set(i,t)}return c};return uQ(i,e,{ignoreNonConfigurable:!0}),fQ.set(i,n),mQ.set(i,t??(e=>e[0])),i}function _Q(e){return typeof e==`string`}function vQ(e,t,n){return n.indexOf(e)===t}function yQ(e){return e.toLowerCase()===e}function bQ(e){return e.indexOf(`,`)===-1?e:e.split(`,`)}function xQ(e){if(!e)return e;if(e===`C`||e===`posix`||e===`POSIX`)return`en-US`;if(e.indexOf(`.`)!==-1){var t=e.split(`.`)[0],n=t===void 0?``:t;return xQ(n)}if(e.indexOf(`@`)!==-1){var r=e.split(`@`)[0],n=r===void 0?``:r;return xQ(n)}if(e.indexOf(`-`)===-1||!yQ(e))return e;var i=e.split(`-`),a=i[0],o=i[1];return`${a}-${(o===void 0?``:o).toUpperCase()}`}function SQ(e){var t=e===void 0?{}:e,n=t.useFallbackLocale,r=n===void 0||n,i=t.fallbackLocale,a=i===void 0?`en-US`:i,o=[];if(typeof navigator<`u`){for(var s=navigator.languages||[],c=[],l=0,u=s;l<u.length;l++){var d=u[l];c=c.concat(bQ(d))}var f=navigator.language,p=f&&bQ(f);o=o.concat(c,p)}return r&&o.push(a),o.filter(_Q).map(xQ).filter(vQ)}var CQ=gQ(SQ,{cacheKey:JSON.stringify});function wQ(e){return CQ(e)[0]||null}var TQ=gQ(wQ,{cacheKey:JSON.stringify}),EQ=new Map;function DQ(e){return function(t,n){let r=t||TQ();EQ.has(r)||EQ.set(r,new Map);let i=EQ.get(r);if(!i.has(e)){let t=new Intl.DateTimeFormat(r||void 0,e);i.set(e,t.format.bind(t))}return i.get(e)(n)}}function OQ(e){let t=new Date(e);return new Date(t.setHours(12))}function kQ(e){return(t,n)=>DQ(e)(t,OQ(n))}var AQ={day:`numeric`},jQ={day:`numeric`,month:`long`,year:`numeric`},MQ={month:`long`},NQ={month:`long`,year:`numeric`},PQ={weekday:`short`},FQ={weekday:`long`},IQ={year:`numeric`},LQ=kQ(AQ),RQ=kQ(jQ),zQ=kQ(MQ),BQ=kQ(NQ),VQ=kQ(PQ),HQ=kQ(FQ),UQ=kQ(IQ);function WQ(e,t,n){return function(r,i=n){return t(e(r)+i)}}function GQ(e){return function(t){return new Date(e(t).getTime()-1)}}function KQ(e,t){return function(n){return[e(n),t(n)]}}function qQ(e){if(e instanceof Date)return e.getFullYear();if(typeof e==`number`)return e;let t=Number.parseInt(e,10);if(typeof e==`string`&&!Number.isNaN(t))return t;throw Error(`Failed to get year from date: ${e}.`)}function JQ(e){if(e instanceof Date)return e.getMonth();throw Error(`Failed to get month from date: ${e}.`)}function YQ(e){if(e instanceof Date)return e.getDate();throw Error(`Failed to get year from date: ${e}.`)}function XQ(e){let t=qQ(e),n=t+(-t+1)%100,r=new Date;return r.setFullYear(n,0,1),r.setHours(0,0,0,0),r}var ZQ=WQ(qQ,XQ,-100),QQ=WQ(qQ,XQ,100),$Q=GQ(QQ),e$=WQ(qQ,$Q,-100),t$=KQ(XQ,$Q);function n$(e){let t=qQ(e),n=t+(-t+1)%10,r=new Date;return r.setFullYear(n,0,1),r.setHours(0,0,0,0),r}var r$=WQ(qQ,n$,-10),i$=WQ(qQ,n$,10),a$=GQ(i$),o$=WQ(qQ,a$,-10),s$=KQ(n$,a$);function c$(e){let t=qQ(e),n=new Date;return n.setFullYear(t,0,1),n.setHours(0,0,0,0),n}var l$=WQ(qQ,c$,-1),u$=WQ(qQ,c$,1),d$=GQ(u$),f$=WQ(qQ,d$,-1),p$=KQ(c$,d$);function m$(e,t){return function(n,r=t){let i=qQ(n),a=JQ(n)+r,o=new Date;return o.setFullYear(i,a,1),o.setHours(0,0,0,0),e(o)}}function h$(e){let t=qQ(e),n=JQ(e),r=new Date;return r.setFullYear(t,n,1),r.setHours(0,0,0,0),r}var g$=m$(h$,-1),_$=m$(h$,1),v$=GQ(_$),y$=m$(v$,-1),b$=KQ(h$,v$);function x$(e,t){return function(n,r=t){let i=qQ(n),a=JQ(n),o=YQ(n)+r,s=new Date;return s.setFullYear(i,a,o),s.setHours(0,0,0,0),e(s)}}function S$(e){let t=qQ(e),n=JQ(e),r=YQ(e),i=new Date;return i.setFullYear(t,n,r),i.setHours(0,0,0,0),i}var C$=GQ(x$(S$,1)),w$=KQ(S$,C$);function T$(e){return YQ(v$(e))}var E$={GREGORY:`gregory`,HEBREW:`hebrew`,ISLAMIC:`islamic`,ISO_8601:`iso8601`},D$={gregory:[`en-CA`,`en-US`,`es-AR`,`es-BO`,`es-CL`,`es-CO`,`es-CR`,`es-DO`,`es-EC`,`es-GT`,`es-HN`,`es-MX`,`es-NI`,`es-PA`,`es-PE`,`es-PR`,`es-SV`,`es-VE`,`pt-BR`],hebrew:[`he`,`he-IL`],islamic:[`ar`,`ar-AE`,`ar-BH`,`ar-DZ`,`ar-EG`,`ar-IQ`,`ar-JO`,`ar-KW`,`ar-LY`,`ar-OM`,`ar-QA`,`ar-SA`,`ar-SD`,`ar-SY`,`ar-YE`,`dv`,`dv-MV`,`ps`,`ps-AR`]},O$=[0,1,2,3,4,5,6],k$=O$[0],A$=O$[5],j$=O$[6];function M$(e,t=E$.ISO_8601){let n=e.getDay();switch(t){case E$.ISO_8601:return(n+6)%7;case E$.ISLAMIC:return(n+1)%7;case E$.HEBREW:case E$.GREGORY:return n;default:throw Error(`Unsupported calendar type.`)}}function N$(e){return qQ(XQ(e))}function P$(e){return qQ(n$(e))}function F$(e,t=E$.ISO_8601){let n=qQ(e),r=JQ(e),i=e.getDate()-M$(e,t);return new Date(n,r,i)}function I$(e,t=E$.ISO_8601){let n=t===E$.GREGORY?E$.GREGORY:E$.ISO_8601,r=F$(e,t),i=qQ(e)+1,a,o;do a=new Date(i,0,n===E$.ISO_8601?4:1),o=F$(a,t),--i;while(e<o);return Math.round((r.getTime()-o.getTime())/(864e5*7))+1}function L$(e,t){switch(e){case`century`:return XQ(t);case`decade`:return n$(t);case`year`:return c$(t);case`month`:return h$(t);case`day`:return S$(t);default:throw Error(`Invalid rangeType: ${e}`)}}function R$(e,t){switch(e){case`century`:return ZQ(t);case`decade`:return r$(t);case`year`:return l$(t);case`month`:return g$(t);default:throw Error(`Invalid rangeType: ${e}`)}}function z$(e,t){switch(e){case`century`:return QQ(t);case`decade`:return i$(t);case`year`:return u$(t);case`month`:return _$(t);default:throw Error(`Invalid rangeType: ${e}`)}}function B$(e,t){switch(e){case`decade`:return r$(t,-100);case`year`:return l$(t,-10);case`month`:return g$(t,-12);default:throw Error(`Invalid rangeType: ${e}`)}}function V$(e,t){switch(e){case`decade`:return i$(t,100);case`year`:return u$(t,10);case`month`:return _$(t,12);default:throw Error(`Invalid rangeType: ${e}`)}}function H$(e,t){switch(e){case`century`:return $Q(t);case`decade`:return a$(t);case`year`:return d$(t);case`month`:return v$(t);case`day`:return C$(t);default:throw Error(`Invalid rangeType: ${e}`)}}function U$(e,t){switch(e){case`century`:return e$(t);case`decade`:return o$(t);case`year`:return f$(t);case`month`:return y$(t);default:throw Error(`Invalid rangeType: ${e}`)}}function W$(e,t){switch(e){case`decade`:return o$(t,-100);case`year`:return f$(t,-10);case`month`:return y$(t,-12);default:throw Error(`Invalid rangeType: ${e}`)}}function G$(e,t){switch(e){case`century`:return t$(t);case`decade`:return s$(t);case`year`:return p$(t);case`month`:return b$(t);case`day`:return w$(t);default:throw Error(`Invalid rangeType: ${e}`)}}function K$(e,t,n){let r=[t,n].sort((e,t)=>e.getTime()-t.getTime());return[L$(e,r[0]),H$(e,r[1])]}function q$(e,t,n){return n.map(n=>(t||UQ)(e,n)).join(` – `)}function J$(e,t,n){return q$(e,t,t$(n))}function Y$(e,t,n){return q$(e,t,s$(n))}function X$(e){return e.getDay()===new Date().getDay()}function Z$(e,t=E$.ISO_8601){let n=e.getDay();switch(t){case E$.ISLAMIC:case E$.HEBREW:return n===A$||n===j$;case E$.ISO_8601:case E$.GREGORY:return n===j$||n===k$;default:throw Error(`Unsupported calendar type.`)}}var Q$=`react-calendar__navigation`;function $$({activeStartDate:e,drillUp:t,formatMonthYear:n=BQ,formatYear:r=UQ,locale:i,maxDate:a,minDate:o,navigationAriaLabel:s=``,navigationAriaLive:c,navigationLabel:l,next2AriaLabel:u=``,next2Label:d=`»`,nextAriaLabel:f=``,nextLabel:p=`›`,prev2AriaLabel:m=``,prev2Label:h=`«`,prevAriaLabel:g=``,prevLabel:_=`‹`,setActiveStartDate:v,showDoubleView:y,view:b,views:x}){let S=x.indexOf(b)>0,C=b!==`century`,w=R$(b,e),T=C?B$(b,e):void 0,E=z$(b,e),D=C?V$(b,e):void 0,O=(()=>{if(w.getFullYear()<0)return!0;let t=U$(b,e);return o&&o>=t})(),ee=C&&(()=>{if(T.getFullYear()<0)return!0;let t=W$(b,e);return o&&o>=t})(),te=a&&a<E,k=C&&a&&a<D;function A(){v(w,`prev`)}function j(){v(T,`prev2`)}function M(){v(E,`next`)}function ne(){v(D,`next2`)}function re(e){let t=(()=>{switch(b){case`century`:return J$(i,r,e);case`decade`:return Y$(i,r,e);case`year`:return r(i,e);case`month`:return n(i,e);default:throw Error(`Invalid view: ${b}.`)}})();return l?l({date:e,label:t,locale:i||TQ()||void 0,view:b}):t}function ie(){let n=`${Q$}__label`;return(0,H.jsxs)(`button`,{"aria-label":s,"aria-live":c,className:n,disabled:!S,onClick:t,style:{flexGrow:1},type:`button`,children:[(0,H.jsx)(`span`,{className:`${n}__labelText ${n}__labelText--from`,children:re(e)}),y?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`${n}__divider`,children:` – `}),(0,H.jsx)(`span`,{className:`${n}__labelText ${n}__labelText--to`,children:re(E)})]}):null]})}return(0,H.jsxs)(`div`,{className:Q$,children:[h!==null&&C?(0,H.jsx)(`button`,{"aria-label":m,className:`${Q$}__arrow ${Q$}__prev2-button`,disabled:ee,onClick:j,type:`button`,children:h}):null,_!==null&&(0,H.jsx)(`button`,{"aria-label":g,className:`${Q$}__arrow ${Q$}__prev-button`,disabled:O,onClick:A,type:`button`,children:_}),ie(),p!==null&&(0,H.jsx)(`button`,{"aria-label":f,className:`${Q$}__arrow ${Q$}__next-button`,disabled:te,onClick:M,type:`button`,children:p}),d!==null&&C?(0,H.jsx)(`button`,{"aria-label":u,className:`${Q$}__arrow ${Q$}__next2-button`,disabled:k,onClick:ne,type:`button`,children:d}):null]})}function e1(e){return`${e}%`}function t1({children:e,className:t,count:n,direction:r,offset:i,style:a,wrap:o,...s}){return(0,H.jsx)(`div`,{className:t,style:{display:`flex`,flexDirection:r,flexWrap:o?`wrap`:`nowrap`,...a},...s,children:L.Children.map(e,(e,t)=>{let r=i&&t===0?e1(100*i/n):null;return(0,L.cloneElement)(e,{...e.props,style:{flexBasis:e1(100/n),flexShrink:0,flexGrow:0,overflow:`hidden`,marginLeft:r,marginInlineStart:r,marginInlineEnd:0}})})})}function n1(e,t,n){return t&&t>e?t:n&&n<e?n:e}function r1(e,t){return t[0]<=e&&t[1]>=e}function i1(e,t){return e[0]<=t[0]&&e[1]>=t[1]}function a1(e,t){return r1(e[0],t)||r1(e[1],t)}function o1(e,t,n){let r=a1(t,e),i=[];if(r){i.push(n);let r=r1(e[0],t),a=r1(e[1],t);r&&i.push(`${n}Start`),a&&i.push(`${n}End`),r&&a&&i.push(`${n}BothEnds`)}return i}function s1(e){return Array.isArray(e)?e[0]!==null&&e[1]!==null:e!==null}function c1(e){if(!e)throw Error(`args is required`);let{value:t,date:n,hover:r}=e,i=`react-calendar__tile`,a=[i];if(!n)return a;let o=new Date,s=(()=>{if(Array.isArray(n))return n;let{dateType:t}=e;if(!t)throw Error(`dateType is required when date is not an array of two dates`);return G$(t,n)})();if(r1(o,s)&&a.push(`${i}--now`),!t||!s1(t))return a;let c=(()=>{if(Array.isArray(t))return t;let{valueType:n}=e;if(!n)throw Error(`valueType is required when value is not an array of two dates`);return G$(n,t)})();i1(c,s)?a.push(`${i}--active`):a1(c,s)&&a.push(`${i}--hasActive`);let l=o1(c,s,`${i}--range`);if(a.push(...l),r&&(Array.isArray(t)?t:[t]).length===1){let e=o1(r>c[0]?[c[0],r]:[r,c[0]],s,`${i}--hover`);a.push(...e)}return a}function l1({className:e,count:t=3,dateTransform:n,dateType:r,end:i,hover:a,offset:o,renderTile:s,start:c,step:l=1,value:u,valueType:d}){let f=[];for(let e=c;e<=i;e+=l){let t=n(e);f.push(s({classes:c1({date:t,dateType:r,hover:a,value:u,valueType:d}),date:t}))}return(0,H.jsx)(t1,{className:e,count:t,offset:o,wrap:!0,children:f})}function u1(e){let{activeStartDate:t,children:n,classes:r,date:i,formatAbbr:a,locale:o,maxDate:s,maxDateTransform:c,minDate:l,minDateTransform:u,onClick:d,onMouseOver:f,style:p,tileClassName:m,tileContent:h,tileDisabled:g,view:_}=e,v=(0,L.useMemo)(()=>typeof m==`function`?m({activeStartDate:t,date:i,view:_}):m,[t,i,m,_]),y=(0,L.useMemo)(()=>typeof h==`function`?h({activeStartDate:t,date:i,view:_}):h,[t,i,h,_]);return(0,H.jsxs)(`button`,{className:U(r,v),disabled:l&&u(l)>i||s&&c(s)<i||g?.({activeStartDate:t,date:i,view:_}),onClick:d?e=>d(i,e):void 0,onFocus:f?()=>f(i):void 0,onMouseOver:f?()=>f(i):void 0,style:p,type:`button`,children:[a?(0,H.jsx)(`abbr`,{"aria-label":a(o,i),children:n}):n,y]})}var d1=`react-calendar__century-view__decades__decade`;function f1({classes:e=[],currentCentury:t,formatYear:n=UQ,...r}){let{date:i,locale:a}=r,o=[];return e&&o.push(...e),o.push(d1),XQ(i).getFullYear()!==t&&o.push(`${d1}--neighboringCentury`),(0,H.jsx)(u1,{...r,classes:o,maxDateTransform:a$,minDateTransform:n$,view:`century`,children:Y$(a,n,i)})}function p1(e){let{activeStartDate:t,hover:n,showNeighboringCentury:r,value:i,valueType:a,...o}=e,s=N$(t);return(0,H.jsx)(l1,{className:`react-calendar__century-view__decades`,dateTransform:n$,dateType:`decade`,end:s+(r?119:99),hover:n,renderTile:({date:e,...n})=>(0,H.jsx)(f1,{...o,...n,activeStartDate:t,currentCentury:s,date:e},e.getTime()),start:s,step:10,value:i,valueType:a})}function m1(e){function t(){return(0,H.jsx)(p1,{...e})}return(0,H.jsx)(`div`,{className:`react-calendar__century-view`,children:t()})}var h1=`react-calendar__decade-view__years__year`;function g1({classes:e=[],currentDecade:t,formatYear:n=UQ,...r}){let{date:i,locale:a}=r,o=[];return e&&o.push(...e),o.push(h1),n$(i).getFullYear()!==t&&o.push(`${h1}--neighboringDecade`),(0,H.jsx)(u1,{...r,classes:o,maxDateTransform:d$,minDateTransform:c$,view:`decade`,children:n(a,i)})}function _1(e){let{activeStartDate:t,hover:n,showNeighboringDecade:r,value:i,valueType:a,...o}=e,s=P$(t);return(0,H.jsx)(l1,{className:`react-calendar__decade-view__years`,dateTransform:c$,dateType:`year`,end:s+(r?11:9),hover:n,renderTile:({date:e,...n})=>(0,H.jsx)(g1,{...o,...n,activeStartDate:t,currentDecade:s,date:e},e.getTime()),start:s,value:i,valueType:a})}function v1(e){function t(){return(0,H.jsx)(_1,{...e})}return(0,H.jsx)(`div`,{className:`react-calendar__decade-view`,children:t()})}var y1=`react-calendar__month-view__days__day`;function b1({calendarType:e,classes:t=[],currentMonthIndex:n,formatDay:r=LQ,formatLongDate:i=RQ,...a}){let{date:o,locale:s}=a,c=[];return t&&c.push(...t),c.push(y1),Z$(o,e)&&c.push(`${y1}--weekend`),o.getMonth()!==n&&c.push(`${y1}--neighboringMonth`),(0,H.jsx)(u1,{...a,classes:c,formatAbbr:i,maxDateTransform:C$,minDateTransform:S$,view:`month`,children:r(s,o)})}function x1(e){let{activeStartDate:t,calendarType:n,hover:r,showFixedNumberOfWeeks:i,showNeighboringMonth:a,value:o,valueType:s,...c}=e,l=qQ(t),u=JQ(t),d=i||a,f=M$(t,n),p=d?0:f,m=(d?-f:0)+1;return(0,H.jsx)(l1,{className:`react-calendar__month-view__days`,count:7,dateTransform:e=>{let t=new Date;return t.setFullYear(l,u,e),S$(t)},dateType:`day`,hover:r,end:(()=>{if(i)return m+42-1;let e=T$(t);if(a){let t=new Date;return t.setFullYear(l,u,e),t.setHours(0,0,0,0),e+(7-M$(t,n)-1)}return e})(),renderTile:({date:e,...r})=>(0,H.jsx)(b1,{...c,...r,activeStartDate:t,calendarType:n,currentMonthIndex:u,date:e},e.getTime()),offset:p,start:m,value:o,valueType:s})}var S1=`react-calendar__month-view__weekdays`,C1=`${S1}__weekday`;function w1(e){let{calendarType:t,formatShortWeekday:n=VQ,formatWeekday:r=HQ,locale:i,onMouseLeave:a}=e,o=h$(new Date),s=qQ(o),c=JQ(o),l=[];for(let e=1;e<=7;e+=1){let a=new Date(s,c,e-M$(o,t)),u=r(i,a);l.push((0,H.jsx)(`div`,{className:U(C1,X$(a)&&`${C1}--current`,Z$(a,t)&&`${C1}--weekend`),children:(0,H.jsx)(`abbr`,{"aria-label":u,title:u,children:n(i,a).replace(`.`,``)})},e))}return(0,H.jsx)(t1,{className:S1,count:7,onFocus:a,onMouseOver:a,children:l})}var T1=`react-calendar__tile`;function E1(e){let{onClickWeekNumber:t,weekNumber:n}=e,r=(0,H.jsx)(`span`,{children:n});if(t){let{date:t,onClickWeekNumber:n,weekNumber:i,...a}=e;return(0,H.jsx)(`button`,{...a,className:T1,onClick:e=>n(i,t,e),type:`button`,children:r})}else{let{date:t,onClickWeekNumber:n,weekNumber:i,...a}=e;return(0,H.jsx)(`div`,{...a,className:T1,children:r})}}function D1(e){let{activeStartDate:t,calendarType:n,onClickWeekNumber:r,onMouseLeave:i,showFixedNumberOfWeeks:a}=e,o=(()=>{if(a)return 6;let e=T$(t)-(7-M$(t,n));return 1+Math.ceil(e/7)})(),s=(()=>{let e=qQ(t),r=JQ(t),i=YQ(t),a=[];for(let t=0;t<o;t+=1)a.push(F$(new Date(e,r,i+t*7),n));return a})();return(0,H.jsx)(t1,{className:`react-calendar__month-view__weekNumbers`,count:o,direction:`column`,onFocus:i,onMouseOver:i,style:{flexBasis:`calc(100% * (1 / 8)`,flexShrink:0},children:s.map(e=>I$(e,n)).map((e,t)=>{let n=s[t];if(!n)throw Error(`date is not defined`);return(0,H.jsx)(E1,{date:n,onClickWeekNumber:r,weekNumber:e},e)})})}function O1(e){if(e){for(let[t,n]of Object.entries(D$))if(n.includes(e))return t}return E$.ISO_8601}function k1(e){let{activeStartDate:t,locale:n,onMouseLeave:r,showFixedNumberOfWeeks:i}=e,{calendarType:a=O1(n),formatShortWeekday:o,formatWeekday:s,onClickWeekNumber:c,showWeekNumbers:l,...u}=e;function d(){return(0,H.jsx)(w1,{calendarType:a,formatShortWeekday:o,formatWeekday:s,locale:n,onMouseLeave:r})}function f(){return l?(0,H.jsx)(D1,{activeStartDate:t,calendarType:a,onClickWeekNumber:c,onMouseLeave:r,showFixedNumberOfWeeks:i}):null}function p(){return(0,H.jsx)(x1,{calendarType:a,...u})}let m=`react-calendar__month-view`;return(0,H.jsx)(`div`,{className:U(m,l?`${m}--weekNumbers`:``),children:(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-end`},children:[f(),(0,H.jsxs)(`div`,{style:{flexGrow:1,width:`100%`},children:[d(),p()]})]})})}var A1=`react-calendar__year-view__months__month`;function j1({classes:e=[],formatMonth:t=zQ,formatMonthYear:n=BQ,...r}){let{date:i,locale:a}=r;return(0,H.jsx)(u1,{...r,classes:[...e,A1],formatAbbr:n,maxDateTransform:v$,minDateTransform:h$,view:`year`,children:t(a,i)})}function M1(e){let{activeStartDate:t,hover:n,value:r,valueType:i,...a}=e,o=qQ(t);return(0,H.jsx)(l1,{className:`react-calendar__year-view__months`,dateTransform:e=>{let t=new Date;return t.setFullYear(o,e,1),h$(t)},dateType:`month`,end:11,hover:n,renderTile:({date:e,...n})=>(0,H.jsx)(j1,{...a,...n,activeStartDate:t,date:e},e.getTime()),start:0,value:r,valueType:i})}function N1(e){function t(){return(0,H.jsx)(M1,{...e})}return(0,H.jsx)(`div`,{className:`react-calendar__year-view`,children:t()})}var P1=`react-calendar`,F1=[`century`,`decade`,`year`,`month`],I1=[`decade`,`year`,`month`,`day`],L1=new Date;L1.setFullYear(1,0,1),L1.setHours(0,0,0,0);var R1=new Date(864e13);function z1(e){return e instanceof Date?e:new Date(e)}function B1(e,t){return F1.slice(F1.indexOf(e),F1.indexOf(t)+1)}function V1(e,t,n){return B1(t,n).indexOf(e)!==-1}function H1(e,t,n){return e&&V1(e,t,n)?e:n}function U1(e){return I1[F1.indexOf(e)]}function W1(e,t){let n=Array.isArray(e)?e[t]:e;if(!n)return null;let r=z1(n);if(Number.isNaN(r.getTime()))throw Error(`Invalid date: ${e}`);return r}function G1({value:e,minDate:t,maxDate:n,maxDetail:r},i){let a=W1(e,i);if(!a)return null;let o=U1(r);return n1((()=>{switch(i){case 0:return L$(o,a);case 1:return H$(o,a);default:throw Error(`Invalid index value: ${i}`)}})(),t,n)}var K1=e=>G1(e,0),q1=e=>G1(e,1),J1=e=>[K1,q1].map(t=>t(e));function Y1({maxDate:e,maxDetail:t,minDate:n,minDetail:r,value:i,view:a}){return L$(H1(a,r,t),K1({value:i,minDate:n,maxDate:e,maxDetail:t})||new Date)}function X1({activeStartDate:e,defaultActiveStartDate:t,defaultValue:n,defaultView:r,maxDate:i,maxDetail:a,minDate:o,minDetail:s,value:c,view:l}){let u=H1(l,s,a),d=e||t;return d?L$(u,d):Y1({maxDate:i,maxDetail:a,minDate:o,minDetail:s,value:c||n,view:l||r})}function Z1(e){return e&&(!Array.isArray(e)||e.length===1)}function Q1(e,t){return e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime()}var $1=(0,L.forwardRef)(function(e,t){let{activeStartDate:n,allowPartialRange:r,calendarType:i,className:a,"data-testid":o,defaultActiveStartDate:s,defaultValue:c,defaultView:l,formatDay:u,formatLongDate:d,formatMonth:f,formatMonthYear:p,formatShortWeekday:m,formatWeekday:h,formatYear:g,goToRangeStartOnSelect:_=!0,inputRef:v,locale:y,maxDate:b=R1,maxDetail:x=`month`,minDate:S=L1,minDetail:C=`century`,navigationAriaLabel:w,navigationAriaLive:T,navigationLabel:E,next2AriaLabel:D,next2Label:O,nextAriaLabel:ee,nextLabel:te,onActiveStartDateChange:k,onChange:A,onClickDay:j,onClickDecade:M,onClickMonth:ne,onClickWeekNumber:re,onClickYear:ie,onDrillDown:ae,onDrillUp:N,onViewChange:oe,prev2AriaLabel:se,prev2Label:ce,prevAriaLabel:P,prevLabel:le,returnValue:ue=`start`,selectRange:F,showDoubleView:I,showFixedNumberOfWeeks:de,showNavigation:fe=!0,showNeighboringCentury:pe,showNeighboringDecade:me,showNeighboringMonth:he=!0,showWeekNumbers:ge,tileClassName:_e,tileContent:ve,tileDisabled:ye,value:be,view:xe}=e,[Se,R]=(0,L.useState)(s),[z,B]=(0,L.useState)(null),[Ce,we]=(0,L.useState)(Array.isArray(c)?c.map(e=>e===null?null:z1(e)):c==null?null:z1(c)),[Te,Ee]=(0,L.useState)(l),De=n||Se||X1({activeStartDate:n,defaultActiveStartDate:s,defaultValue:c,defaultView:l,maxDate:b,maxDetail:x,minDate:S,minDetail:C,value:be,view:xe}),Oe=(()=>{let e=F&&Z1(Ce)||be===void 0?Ce:be;return e?Array.isArray(e)?e.map(e=>e===null?null:z1(e)):e===null?null:z1(e):null})(),ke=U1(x),Ae=H1(xe||Te,C,x),je=B1(C,x),V=F?z:null,Me=je.indexOf(Ae)<je.length-1,Ne=je.indexOf(Ae)>0,Pe=(0,L.useCallback)(e=>(()=>{switch(ue){case`start`:return K1;case`end`:return q1;case`range`:return J1;default:throw Error(`Invalid returnValue.`)}})()({maxDate:b,maxDetail:x,minDate:S,value:e}),[b,x,S,ue]),Fe=(0,L.useCallback)((e,t)=>{R(e);let n={action:t,activeStartDate:e,value:Oe,view:Ae};k&&!Q1(De,e)&&k(n)},[De,k,Oe,Ae]),Ie=(0,L.useCallback)((e,t)=>{let n=(()=>{switch(Ae){case`century`:return M;case`decade`:return ie;case`year`:return ne;case`month`:return j;default:throw Error(`Invalid view: ${Ae}.`)}})();n&&n(e,t)},[j,M,ne,ie,Ae]),Le=(0,L.useCallback)((e,t)=>{if(!Me)return;Ie(e,t);let n=je[je.indexOf(Ae)+1];if(!n)throw Error(`Attempted to drill down from the lowest view.`);R(e),Ee(n);let r={action:`drillDown`,activeStartDate:e,value:Oe,view:n};k&&!Q1(De,e)&&k(r),oe&&Ae!==n&&oe(r),ae&&ae(r)},[De,Me,k,Ie,ae,oe,Oe,Ae,je]),Re=(0,L.useCallback)(()=>{if(!Ne)return;let e=je[je.indexOf(Ae)-1];if(!e)throw Error(`Attempted to drill up from the highest view.`);let t=L$(e,De);R(t),Ee(e);let n={action:`drillUp`,activeStartDate:t,value:Oe,view:e};k&&!Q1(De,t)&&k(n),oe&&Ae!==e&&oe(n),N&&N(n)},[De,Ne,k,N,oe,Oe,Ae,je]),ze=(0,L.useCallback)((e,t)=>{let n=Oe;Ie(e,t);let i=F&&!Z1(n),a;if(F)if(i)a=L$(ke,e);else{if(!n)throw Error(`previousValue is required`);if(Array.isArray(n))throw Error(`previousValue must not be an array`);a=K$(ke,n,e)}else a=Pe(e);let o=!F||i||_?Y1({maxDate:b,maxDetail:x,minDate:S,minDetail:C,value:a,view:Ae}):null;t.persist(),R(o),we(a);let s={action:`onChange`,activeStartDate:o,value:a,view:Ae};if(k&&!Q1(De,o)&&k(s),A)if(F){if(!Z1(a))A(a||null,t);else if(r){if(Array.isArray(a))throw Error(`value must not be an array`);A([a||null,null],t)}}else A(a||null,t)},[De,r,Pe,_,b,x,S,C,k,A,Ie,F,Oe,ke,Ae]);function Be(e){B(e)}function Ve(){B(null)}(0,L.useImperativeHandle)(t,()=>({activeStartDate:De,drillDown:Le,drillUp:Re,onChange:ze,setActiveStartDate:Fe,value:Oe,view:Ae}),[De,Le,Re,ze,Fe,Oe,Ae]);function He(e){let t={activeStartDate:e?z$(Ae,De):L$(Ae,De),hover:V,locale:y,maxDate:b,minDate:S,onClick:Me?Le:ze,onMouseOver:F?Be:void 0,tileClassName:_e,tileContent:ve,tileDisabled:ye,value:Oe,valueType:ke};switch(Ae){case`century`:return(0,H.jsx)(m1,{formatYear:g,showNeighboringCentury:pe,...t});case`decade`:return(0,H.jsx)(v1,{formatYear:g,showNeighboringDecade:me,...t});case`year`:return(0,H.jsx)(N1,{formatMonth:f,formatMonthYear:p,...t});case`month`:return(0,H.jsx)(k1,{calendarType:i,formatDay:u,formatLongDate:d,formatShortWeekday:m,formatWeekday:h,onClickWeekNumber:re,onMouseLeave:F?Ve:void 0,showFixedNumberOfWeeks:de===void 0?I:de,showNeighboringMonth:he,showWeekNumbers:ge,...t});default:throw Error(`Invalid view: ${Ae}.`)}}function Ue(){return fe?(0,H.jsx)($$,{activeStartDate:De,drillUp:Re,formatMonthYear:p,formatYear:g,locale:y,maxDate:b,minDate:S,navigationAriaLabel:w,navigationAriaLive:T,navigationLabel:E,next2AriaLabel:D,next2Label:O,nextAriaLabel:ee,nextLabel:te,prev2AriaLabel:se,prev2Label:ce,prevAriaLabel:P,prevLabel:le,setActiveStartDate:Fe,showDoubleView:I,view:Ae,views:je}):null}return(0,H.jsxs)(`div`,{className:U(P1,F&&(Array.isArray(Oe)?Oe:[Oe]).length===1&&`${P1}--selectRange`,I&&`${P1}--doubleView`,a),"data-testid":o,ref:v,children:[Ue(),(0,H.jsxs)(`div`,{className:`${P1}__viewContainer`,onBlur:F?Ve:void 0,onMouseLeave:F?Ve:void 0,children:[He(),I?He(!0):null]})]})}),e0=G(Z,{shouldForwardProp:e=>e!==`expand`})(({expand:e})=>({width:e?`100%`:void 0}));function t0({open:e}){let t=z(e);return(0,H.jsx)(X,{title:`Filter`,enterDelay:300,children:(0,H.jsx)(Um,{onClick:()=>t(!0),size:`small`,children:(0,H.jsx)(Sre,{})})})}function n0(e){let t=e.copyToClipboardRows;return(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[e.columns.map(t=>(0,H.jsxs)(e0,{align:t.numeric?`right`:`left`,expand:t.expanded,sortDirection:e.sort.orderBy===t.id&&e.sort.order,children:[(0,H.jsx)(X,{title:`Sort`,placement:t.numeric?`bottom-end`:`bottom-start`,enterDelay:300,children:(0,H.jsx)(Uw,{active:e.sort.orderBy===t.id,direction:e.sort.order,onClick:()=>e.sort.handleRequestSort(t.id),children:t.label})}),t.openFilterDialog?(0,H.jsx)(t0,{open:t.openFilterDialog}):void 0]},t.id)),e.showDetailsCol?(0,H.jsx)(e0,{padding:`checkbox`,children:t?(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{style:{height:`25px`,paddingTop:0,paddingBottom:0},onClick:()=>p0(e.columns,t),size:`large`,children:(0,H.jsx)(uT,{})})}):void 0}):void 0]})})}var r0=new Intl.DateTimeFormat([],{year:`numeric`,month:`short`,day:`numeric`}),i0=new Intl.DateTimeFormat([],{year:`numeric`,month:`long`}),a0=G($1)(({theme:e})=>({width:`350px`,"& .react-calendar__month-view__weekdays":{textAlign:`center`,textTransform:`uppercase`,fontWeight:`bold`},"& .react-calendar__tile":{textAlign:`center`,padding:`.75em .5em`,margin:0,border:0,background:`none`,outline:`none`,cursor:`pointer`,"&:hover":{backgroundColor:`rgb(230, 230, 230)`},"&--active":{backgroundColor:e.palette.primary.light,"&:hover":{backgroundColor:e.palette.primary.dark}}},"&.react-calendar--selectRange .react-calendar__tile--hover":{backgroundColor:`rgb(230, 230, 230)`}}));function o0(e){let[t,n]=(0,L.useState)(!1),r=e.zoom.current_date_zoom?e.zoom.current_date_zoom.start:e.zoom.default_date_range[0],i=LT(e.zoom.current_date_zoom?e.zoom.current_date_zoom.end:e.zoom.default_date_range[1],-1);function a(t){e.zoom.set_date_zoom_range({start:t[0],end:LT(t[1],1)}),n(!1)}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`span`,{children:[r0.format(e.zoom.current_date_zoom?.start??e.zoom.default_date_range[0]),` `,`- `,r0.format(e.zoom.current_date_zoom?.end??e.zoom.default_date_range[1])]}),(0,H.jsx)(X,{title:`Zoom To Date Range`,children:(0,H.jsx)(Um,{onClick:()=>n(!0),size:`large`,children:(0,H.jsx)(OT,{})})}),(0,H.jsx)(X,{title:`Reset Date Range`,children:(0,H.jsx)(Um,{onClick:()=>e.zoom.set_date_zoom_range(void 0),size:`large`,children:(0,H.jsx)(kT,{})})}),(0,H.jsxs)(cy,{open:t,onClose:()=>n(!1),children:[(0,H.jsxs)(dy,{children:[`Select Date Range `,i0.format(e.zoom.default_date_range[0])]}),(0,H.jsx)(uy,{children:(0,H.jsx)(a0,{minDate:e.zoom.default_date_range[0],maxDate:e.zoom.default_date_range[1],calendarType:`gregory`,selectRange:!0,showNavigation:!1,showNeighboringMonth:!1,value:[r,i],onChange:e=>{Array.isArray(e)&&e[0]instanceof Date&&e[1]instanceof Date&&a([e[0],e[1]])}})}),(0,H.jsx)(ly,{children:(0,H.jsx)(Y,{onClick:()=>n(!1),children:`Close`})})]})]})}var s0=(0,L.memo)(function({zoom:e,tpage:t,count:n}){let r;return e&&e.type===`Last30Days`?r=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{title:`Last 24 hours`,children:(0,H.jsx)(Y,{onClick:()=>e.set_days_back(1),style:{color:`rgba(0, 0, 0, 0.54)`},children:`24h`})}),(0,H.jsx)(X,{title:`Last 2 days`,children:(0,H.jsx)(Y,{onClick:()=>e.set_days_back(2),style:{color:`rgba(0, 0, 0, 0.54)`},children:`2d`})}),(0,H.jsx)(X,{title:`Last 3 days`,children:(0,H.jsx)(Y,{onClick:()=>e.set_days_back(3),style:{color:`rgba(0, 0, 0, 0.54)`},children:`3d`})}),(0,H.jsx)(X,{title:`Last 4 days`,children:(0,H.jsx)(Y,{onClick:()=>e.set_days_back(4),style:{color:`rgba(0, 0, 0, 0.54)`},children:`4d`})}),(0,H.jsx)(X,{title:`Last 5 days`,children:(0,H.jsx)(Y,{onClick:()=>e.set_days_back(5),style:{color:`rgba(0, 0, 0, 0.54)`},children:`5d`})}),(0,H.jsx)(X,{title:`Last 6 days`,children:(0,H.jsx)(Y,{onClick:()=>e.set_days_back(6),style:{color:`rgba(0, 0, 0, 0.54)`},children:`6d`})}),(0,H.jsx)(X,{title:`Last 1 week`,children:(0,H.jsx)(Y,{onClick:()=>e.set_days_back(7),style:{color:`rgba(0, 0, 0, 0.54)`},children:`1w`})}),(0,H.jsx)(X,{title:`Last 2 weeks`,children:(0,H.jsx)(Y,{onClick:()=>e.set_days_back(14),style:{color:`rgba(0, 0, 0, 0.54)`},children:`2w`})}),(0,H.jsx)(X,{title:`Last 3 weeks`,children:(0,H.jsx)(Y,{onClick:()=>e.set_days_back(21),style:{color:`rgba(0, 0, 0, 0.54)`},children:`3w`})}),(0,H.jsx)(X,{title:`Last 30 days`,children:(0,H.jsx)(Y,{onClick:()=>e.set_days_back(null),style:{color:`rgba(0, 0, 0, 0.54)`},children:`30d`})})]}):e&&e.type===`ZoomIntoRange`?r=(0,H.jsx)(o0,{zoom:e}):e&&e.type===`ExtendDays`&&(r=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{title:`Extend 1 day previous`,children:(0,H.jsx)(Um,{onClick:()=>e.extend(-1),size:`large`,children:(0,H.jsx)(CT,{})})}),(0,H.jsx)(q,{variant:`caption`,children:e.curStart.toLocaleDateString()+` to `+e.curEnd.toLocaleDateString()}),(0,H.jsx)(X,{title:`Extend 1 day`,children:(0,H.jsx)(Um,{onClick:()=>e.extend(1),size:`large`,children:(0,H.jsx)(ST,{})})})]})),(0,H.jsxs)(Rw,{children:[(0,H.jsx)(q,{color:`textSecondary`,variant:`caption`,children:`Rows per page:`}),(0,H.jsx)(YS,{style:{marginLeft:8,marginRight:`1em`},value:t.rowsPerPage,SelectDisplayProps:{style:{color:`rgba(0, 0, 0, 0.54)`}},input:(0,H.jsx)(ff,{}),onChange:e=>{t.setRowsPerPage(e.target.value);let r=Math.ceil(n/e.target.value)-1;t.page>r&&t.setPage(r)},children:[10,15,20,50].map(e=>(0,H.jsx)(Hx,{value:e,children:e},e))}),(0,H.jsx)(q,{color:`textSecondary`,variant:`caption`,children:`${n===0?0:t.page*t.rowsPerPage+1}-${Math.min(n,(t.page+1)*t.rowsPerPage)} of ${n}`}),(0,H.jsx)(Um,{onClick:()=>t.setPage(0),disabled:t.page===0,"aria-label":`First Page`,size:`large`,children:(0,H.jsx)(sT,{})}),(0,H.jsx)(Um,{onClick:()=>t.setPage(t.page-1),disabled:t.page===0,"aria-label":`Previous Page`,size:`large`,children:(0,H.jsx)(fT,{})}),(0,H.jsx)(Um,{onClick:()=>t.setPage(t.page+1),disabled:t.page>=Math.ceil(n/t.rowsPerPage)-1,"aria-label":`Next Page`,size:`large`,children:(0,H.jsx)(pT,{})}),(0,H.jsx)(Um,{onClick:()=>t.setPage(Math.max(0,Math.ceil(n/t.rowsPerPage)-1)),disabled:t.page>=Math.ceil(n/t.rowsPerPage)-1,"aria-label":`Last Page`,size:`large`,children:(0,H.jsx)(hT,{})}),e?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{style:{flexGrow:1}}),r]}):void 0]})}),c0=class extends L.PureComponent{render(){let e=this.props.onClickDetails,t=[...this.props.pageData],n=this.props.rowsPerPage===void 0?0:Math.max(0,this.props.rowsPerPage-t.length);return(0,H.jsxs)(Pw,{children:[t.map((t,n)=>(0,H.jsxs)(Vw,{children:[this.props.columns.map(e=>(0,H.jsx)(e0,{align:e.numeric?`right`:`left`,expand:e.expanded,children:e.Cell?(0,H.jsx)(e.Cell,{row:t}):e.getDisplay(t)},e.id)),e?(0,H.jsx)(e0,{padding:`checkbox`,children:(0,H.jsx)(Um,{onClick:n=>e(n,t),size:`large`,children:(0,H.jsx)(gT,{})})}):void 0]},n)),n>0?(0,H.jsx)(Vw,{style:{height:53*n},children:(0,H.jsx)(Z,{colSpan:this.props.columns.length+ +!!this.props.onClickDetails,style:{textAlign:`center`},children:t.length===0?this.props.emptyMessage:void 0})}):void 0]})}};function l0(e){let[t,n]=(0,L.useState)(void 0);return(0,L.useMemo)(()=>{let r;return r=e.type===`Last30`?{type:`Last30Days`,set_days_back:e=>{if(e){let t=new Date;n({start:LT(t,-e),end:BT(t,1)})}else n(void 0)}}:{type:`ZoomIntoRange`,default_date_range:[e.month,RT(e.month,1)],current_date_zoom:t,set_date_zoom_range:n},{zoom:r,zoomRange:t}},[e,t,n])}function u0(){let[e,t]=(0,L.useState)(0),[n,r]=(0,L.useState)(10);return(0,L.useMemo)(()=>({page:e,setPage:t,rowsPerPage:n,setRowsPerPage:r}),[e,t,n,r])}function d0(e,t,n){let[r,i]=(0,L.useState)(e),[a,o]=(0,L.useState)(n??`asc`);return(0,L.useMemo)(()=>{function e(e){r===e?o(a===`asc`?`desc`:`asc`):(i(e),o(`asc`))}let n={asc:t[0].getForSort??t[0].getDisplay};for(let e of t)e.id===r&&a===`asc`?n={asc:e.getForSort??e.getDisplay}:e.id===r&&(n={desc:e.getForSort??e.getDisplay});return{orderBy:r,order:a,sortOn:n,handleRequestSort:e}},[r,i,a,o,t])}function f0(e,t){let n=`<table>
|
|
344
|
+
</table>`,t}function bZ(e){Ak(yZ(e))}function xZ(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n<t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n<i||n===void 0&&i>=i)&&(n=i)}return n}function SZ(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n>t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function CZ(e,t){let n=0;if(t===void 0)for(let t of e)(t=+t)&&(n+=t);else{let r=-1;for(let i of e)(i=+t(i,++r,e))&&(n+=i)}return n}function wZ(e,t){return e.sourceLinks.length?e.depth:t-1}function TZ(e){return function(){return e}}function EZ(e,t){return OZ(e.source,t.source)||e.index-t.index}function DZ(e,t){return OZ(e.target,t.target)||e.index-t.index}function OZ(e,t){return e.y0-t.y0}function kZ(e){return e.value}function AZ(e){return e.index}function jZ(e){return e.nodes}function MZ(e){return e.links}function NZ(e,t){let n=e.get(t);if(!n)throw Error(`missing: `+t);return n}function PZ({nodes:e}){for(let t of e){let e=t.y0,n=e;for(let n of t.sourceLinks)n.y0=e+n.width/2,e+=n.width;for(let e of t.targetLinks)e.y1=n+e.width/2,n+=e.width}}function FZ(){let e=0,t=0,n=1,r=1,i=24,a=8,o,s=AZ,c=wZ,l,u,d=jZ,f=MZ,p=6;function m(){let e={nodes:d.apply(null,arguments),links:f.apply(null,arguments)};return h(e),g(e),_(e),v(e),x(e),PZ(e),e}m.update=function(e){return PZ(e),e},m.nodeId=function(e){return arguments.length?(s=typeof e==`function`?e:TZ(e),m):s},m.nodeAlign=function(e){return arguments.length?(c=typeof e==`function`?e:TZ(e),m):c},m.nodeSort=function(e){return arguments.length?(l=e,m):l},m.nodeWidth=function(e){return arguments.length?(i=+e,m):i},m.nodePadding=function(e){return arguments.length?(a=o=+e,m):a},m.nodes=function(e){return arguments.length?(d=typeof e==`function`?e:TZ(e),m):d},m.links=function(e){return arguments.length?(f=typeof e==`function`?e:TZ(e),m):f},m.linkSort=function(e){return arguments.length?(u=e,m):u},m.size=function(i){return arguments.length?(e=t=0,n=+i[0],r=+i[1],m):[n-e,r-t]},m.extent=function(i){return arguments.length?(e=+i[0][0],n=+i[1][0],t=+i[0][1],r=+i[1][1],m):[[e,t],[n,r]]},m.iterations=function(e){return arguments.length?(p=+e,m):p};function h({nodes:e,links:t}){for(let[t,n]of e.entries())n.index=t,n.sourceLinks=[],n.targetLinks=[];let n=new Map(e.map((t,n)=>[s(t,n,e),t]));for(let[e,r]of t.entries()){r.index=e;let{source:t,target:i}=r;typeof t!=`object`&&(t=r.source=NZ(n,t)),typeof i!=`object`&&(i=r.target=NZ(n,i)),t.sourceLinks.push(r),i.targetLinks.push(r)}if(u!=null)for(let{sourceLinks:t,targetLinks:n}of e)t.sort(u),n.sort(u)}function g({nodes:e}){for(let t of e)t.value=t.fixedValue===void 0?Math.max(CZ(t.sourceLinks,kZ),CZ(t.targetLinks,kZ)):t.fixedValue}function _({nodes:e}){let t=e.length,n=new Set(e),r=new Set,i=0;for(;n.size;){for(let e of n){e.depth=i;for(let{target:t}of e.sourceLinks)r.add(t)}if(++i>t)throw Error(`circular link`);n=r,r=new Set}}function v({nodes:e}){let t=e.length,n=new Set(e),r=new Set,i=0;for(;n.size;){for(let e of n){e.height=i;for(let{source:t}of e.targetLinks)r.add(t)}if(++i>t)throw Error(`circular link`);n=r,r=new Set}}function y({nodes:t}){let r=xZ(t,e=>e.depth)+1,a=(n-e-i)/(r-1),o=Array(r);for(let n of t){let t=Math.max(0,Math.min(r-1,Math.floor(c.call(null,n,r))));n.layer=t,n.x0=e+t*a,n.x1=n.x0+i,o[t]?o[t].push(n):o[t]=[n]}if(l)for(let e of o)e.sort(l);return o}function b(e){let n=SZ(e,e=>(r-t-(e.length-1)*o)/CZ(e,kZ));for(let i of e){let e=t;for(let t of i){t.y0=e,t.y1=e+t.value*n,e=t.y1+o;for(let e of t.sourceLinks)e.width=e.value*n}e=(r-e+o)/(i.length+1);for(let t=0;t<i.length;++t){let n=i[t];n.y0+=e*(t+1),n.y1+=e*(t+1)}O(i)}}function x(e){let n=y(e);o=Math.min(a,(r-t)/(xZ(n,e=>e.length)-1)),b(n);for(let e=0;e<p;++e){let t=.99**e,r=Math.max(1-t,(e+1)/p);C(n,t,r),S(n,t,r)}}function S(e,t,n){for(let r=1,i=e.length;r<i;++r){let i=e[r];for(let e of i){let n=0,r=0;for(let{source:t,value:i}of e.targetLinks){let a=i*(e.layer-t.layer);n+=ee(t,e)*a,r+=a}if(!(r>0))continue;let i=(n/r-e.y0)*t;e.y0+=i,e.y1+=i,D(e)}l===void 0&&i.sort(OZ),w(i,n)}}function C(e,t,n){for(let r=e.length-2;r>=0;--r){let i=e[r];for(let e of i){let n=0,r=0;for(let{target:t,value:i}of e.sourceLinks){let a=i*(t.layer-e.layer);n+=te(e,t)*a,r+=a}if(!(r>0))continue;let i=(n/r-e.y0)*t;e.y0+=i,e.y1+=i,D(e)}l===void 0&&i.sort(OZ),w(i,n)}}function w(e,n){let i=e.length>>1,a=e[i];E(e,a.y0-o,i-1,n),T(e,a.y1+o,i+1,n),E(e,r,e.length-1,n),T(e,t,0,n)}function T(e,t,n,r){for(;n<e.length;++n){let i=e[n],a=(t-i.y0)*r;a>1e-6&&(i.y0+=a,i.y1+=a),t=i.y1+o}}function E(e,t,n,r){for(;n>=0;--n){let i=e[n],a=(i.y1-t)*r;a>1e-6&&(i.y0-=a,i.y1-=a),t=i.y0-o}}function D({sourceLinks:e,targetLinks:t}){if(u===void 0){for(let{source:{sourceLinks:e}}of t)e.sort(DZ);for(let{target:{targetLinks:t}}of e)t.sort(EZ)}}function O(e){if(u===void 0)for(let{sourceLinks:t,targetLinks:n}of e)t.sort(DZ),n.sort(EZ)}function ee(e,t){let n=e.y0-(e.sourceLinks.length-1)*o/2;for(let{target:r,width:i}of e.sourceLinks){if(r===t)break;n+=i+o}for(let{source:r,width:i}of t.targetLinks){if(r===e)break;n-=i}return n}function te(e,t){let n=t.y0-(t.targetLinks.length-1)*o/2;for(let{source:r,width:i}of t.targetLinks){if(r===e)break;n+=i+o}for(let{target:r,width:i}of e.sourceLinks){if(r===t)break;n-=i}return n}return m}var IZ=Math.PI,LZ=2*IZ,RZ=1e-6,zZ=LZ-RZ;function BZ(){this._x0=this._y0=this._x1=this._y1=null,this._=``}function VZ(){return new BZ}BZ.prototype=VZ.prototype={constructor:BZ,moveTo:function(e,t){this._+=`M`+(this._x0=this._x1=+e)+`,`+(this._y0=this._y1=+t)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+=`Z`)},lineTo:function(e,t){this._+=`L`+(this._x1=+e)+`,`+(this._y1=+t)},quadraticCurveTo:function(e,t,n,r){this._+=`Q`+ +e+`,`+ +t+`,`+(this._x1=+n)+`,`+(this._y1=+r)},bezierCurveTo:function(e,t,n,r,i,a){this._+=`C`+ +e+`,`+ +t+`,`+ +n+`,`+ +r+`,`+(this._x1=+i)+`,`+(this._y1=+a)},arcTo:function(e,t,n,r,i){e=+e,t=+t,n=+n,r=+r,i=+i;var a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(i<0)throw Error(`negative radius: `+i);if(this._x1===null)this._+=`M`+(this._x1=e)+`,`+(this._y1=t);else if(d>RZ)if(!(Math.abs(u*s-c*l)>RZ)||!i)this._+=`L`+(this._x1=e)+`,`+(this._y1=t);else{var f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((IZ-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>RZ&&(this._+=`L`+(e+y*l)+`,`+(t+y*u)),this._+=`A`+i+`,`+i+`,0,0,`+ +(u*f>l*p)+`,`+(this._x1=e+b*s)+`,`+(this._y1=t+b*c)}},arc:function(e,t,n,r,i,a){e=+e,t=+t,n=+n,a=!!a;var o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;if(n<0)throw Error(`negative radius: `+n);this._x1===null?this._+=`M`+c+`,`+l:(Math.abs(this._x1-c)>RZ||Math.abs(this._y1-l)>RZ)&&(this._+=`L`+c+`,`+l),n&&(d<0&&(d=d%LZ+LZ),d>zZ?this._+=`A`+n+`,`+n+`,0,1,`+u+`,`+(e-o)+`,`+(t-s)+`A`+n+`,`+n+`,0,1,`+u+`,`+(this._x1=c)+`,`+(this._y1=l):d>RZ&&(this._+=`A`+n+`,`+n+`,0,`+ +(d>=IZ)+`,`+u+`,`+(this._x1=e+n*Math.cos(i))+`,`+(this._y1=t+n*Math.sin(i))))},rect:function(e,t,n,r){this._+=`M`+(this._x0=this._x1=+e)+`,`+(this._y0=this._y1=+t)+`h`+ +n+`v`+ +r+`h`+-n+`Z`},toString:function(){return this._}};function HZ(e){return function(){return e}}function UZ(e){return e[0]}function WZ(e){return e[1]}var GZ=Array.prototype.slice;function KZ(e){return e.source}function qZ(e){return e.target}function JZ(e){var t=KZ,n=qZ,r=UZ,i=WZ,a=null;function o(){var o,s=GZ.call(arguments),c=t.apply(this,s),l=n.apply(this,s);if(a||=o=VZ(),e(a,+r.apply(this,(s[0]=c,s)),+i.apply(this,s),+r.apply(this,(s[0]=l,s)),+i.apply(this,s)),o)return a=null,o+``||null}return o.source=function(e){return arguments.length?(t=e,o):t},o.target=function(e){return arguments.length?(n=e,o):n},o.x=function(e){return arguments.length?(r=typeof e==`function`?e:HZ(+e),o):r},o.y=function(e){return arguments.length?(i=typeof e==`function`?e:HZ(+e),o):i},o.context=function(e){return arguments.length?(a=e??null,o):a},o}function YZ(e,t,n,r,i){e.moveTo(t,n),e.bezierCurveTo(t=(t+r)/2,n,t,i,r,i)}function XZ(){return JZ(YZ)}function ZZ(e){return[e.source.x1,e.y0]}function QZ(e){return[e.target.x0,e.y1]}function $Z(){return XZ().source(ZZ).target(QZ)}var eQ=class{constructor(e,t){this.unique=e,this.name=t}compare(e){let t=this.unique.localeCompare(e.unique);return t===0?this.name.localeCompare(e.name):t}hash(){return yD(this.unique,this.name)}toString(){return`{unique: ${this.unique}}, name: ${this.name}}`}},tQ=class{constructor(e,t){this.from=e,this.to=t}compare(e){let t=this.from.compare(e.from);return t===0?this.to.compare(e.to):t}hash(){return yD(this.from,this.to)}toString(){return`{from: ${this.from.toString()}}, to: ${this.to.toString()}}`}};function nQ(e,t,n){let r=``,i=new eQ(``,`raw`),a=[];for(let t of e)for(let e of t.stops){let n=`P`+t.pallet+`,M`+e.stationNum.toString();r+=`->`+n;let o=new eQ(r,n);a.push(new tQ(i,o)),i=o}return t&&n!==void 0?n?a.push(new tQ(i,new eQ(`@@success`,`success`))):a.push(new tQ(i,new eQ(`@@failed`,`failed`))):a.push(new tQ(i,new eQ(`@@uninspected`,`uninspected`))),a}function rQ(e){let t=Q.of(e).filter(e=>e.result.type===aL.Completed).toRMap(e=>[e.materialID,e.result.type===aL.Completed&&e.result.success]),n=Q.of(e).flatMap(e=>e.result.type===aL.Triggered?nQ(e.result.actualPath,e.result.toInspect,t.get(e.materialID)??!1):[]),r=n.flatMap(e=>[e.from,e.to]).distinctBy(e=>e).map((e,t)=>({idx:t,node:e})),i=r.map(e=>({unique:e.node.unique,name:e.node.name})).toMutableArray(),a=r.toHashMap(e=>[e.node,e.idx],(e,t)=>e);return{nodes:i,links:n.toHashMap(e=>[e,1],(e,t)=>e+t).toLazySeq().map(([e,t])=>({source:a.get(e.from),target:a.get(e.to),value:t})).toMutableArray()}}var iQ=(e,t,n,r)=>{if(n===`length`||n===`prototype`||n===`arguments`||n===`caller`)return;let i=Object.getOwnPropertyDescriptor(e,n),a=Object.getOwnPropertyDescriptor(t,n);!aQ(i,a)&&r||Object.defineProperty(e,n,a)},aQ=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},oQ=(e,t)=>{let n=Object.getPrototypeOf(t);n!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,n)},sQ=(e,t)=>`/* Wrapped ${e}*/\n${t}`,cQ=Object.getOwnPropertyDescriptor(Function.prototype,`toString`),lQ=Object.getOwnPropertyDescriptor(Function.prototype.toString,`name`),uQ=(e,t,n)=>{let r=n===``?``:`with ${n.trim()}() `,i=sQ.bind(null,r,t.toString());Object.defineProperty(i,"name",lQ);let{writable:a,enumerable:o,configurable:s}=cQ;Object.defineProperty(e,"toString",{value:i,writable:a,enumerable:o,configurable:s})};function dQ(e,t,{ignoreNonConfigurable:n=!1}={}){let{name:r}=e;for(let r of Reflect.ownKeys(t))iQ(e,t,r,n);return oQ(e,t),uQ(e,t,r),e}var fQ=2147483647,pQ=new WeakMap,mQ=new WeakMap,hQ=new WeakMap;function gQ(e,t){let n=e.get(t);if(n){if(n.maxAge<=Date.now()){e.delete(t);return}return n}}function _Q(e,{cacheKey:t,cache:n=new Map,maxAge:r}={}){if(r===0)return e;if(typeof r==`number`&&Number.isFinite(r)){if(r>fQ)throw TypeError(`The \`maxAge\` option cannot exceed ${fQ}.`);if(r<0)throw TypeError("The `maxAge` option should not be a negative number.")}let i=function(...a){let o=t?t(a):a[0],s=gQ(n,o);if(s)return s.data;let c=e.apply(this,a),l=typeof r==`function`?r(...a):r;if(l!==void 0&&l!==1/0){if(!Number.isFinite(l))throw TypeError("The `maxAge` function must return a finite number, `0`, or `Infinity`.");if(l<=0)return c;if(l>fQ)throw TypeError(`The \`maxAge\` function result cannot exceed ${fQ}.`)}if(n.set(o,{data:c,maxAge:l===void 0||l===1/0?1/0:Date.now()+l}),l!==void 0&&l!==1/0){let e=setTimeout(()=>{n.delete(o),mQ.get(i)?.delete(e)},l);e.unref?.();let t=mQ.get(i)??new Set;t.add(e),mQ.set(i,t)}return c};return dQ(i,e,{ignoreNonConfigurable:!0}),pQ.set(i,n),hQ.set(i,t??(e=>e[0])),i}function vQ(e){return typeof e==`string`}function yQ(e,t,n){return n.indexOf(e)===t}function bQ(e){return e.toLowerCase()===e}function xQ(e){return e.indexOf(`,`)===-1?e:e.split(`,`)}function SQ(e){if(!e)return e;if(e===`C`||e===`posix`||e===`POSIX`)return`en-US`;if(e.indexOf(`.`)!==-1){var t=e.split(`.`)[0],n=t===void 0?``:t;return SQ(n)}if(e.indexOf(`@`)!==-1){var r=e.split(`@`)[0],n=r===void 0?``:r;return SQ(n)}if(e.indexOf(`-`)===-1||!bQ(e))return e;var i=e.split(`-`),a=i[0],o=i[1];return`${a}-${(o===void 0?``:o).toUpperCase()}`}function CQ(e){var t=e===void 0?{}:e,n=t.useFallbackLocale,r=n===void 0||n,i=t.fallbackLocale,a=i===void 0?`en-US`:i,o=[];if(typeof navigator<`u`){for(var s=navigator.languages||[],c=[],l=0,u=s;l<u.length;l++){var d=u[l];c=c.concat(xQ(d))}var f=navigator.language,p=f&&xQ(f);o=o.concat(c,p)}return r&&o.push(a),o.filter(vQ).map(SQ).filter(yQ)}var wQ=_Q(CQ,{cacheKey:JSON.stringify});function TQ(e){return wQ(e)[0]||null}var EQ=_Q(TQ,{cacheKey:JSON.stringify}),DQ=new Map;function OQ(e){return function(t,n){let r=t||EQ();DQ.has(r)||DQ.set(r,new Map);let i=DQ.get(r);if(!i.has(e)){let t=new Intl.DateTimeFormat(r||void 0,e);i.set(e,t.format.bind(t))}return i.get(e)(n)}}function kQ(e){let t=new Date(e);return new Date(t.setHours(12))}function AQ(e){return(t,n)=>OQ(e)(t,kQ(n))}var jQ={day:`numeric`},MQ={day:`numeric`,month:`long`,year:`numeric`},NQ={month:`long`},PQ={month:`long`,year:`numeric`},FQ={weekday:`short`},IQ={weekday:`long`},LQ={year:`numeric`},RQ=AQ(jQ),zQ=AQ(MQ),BQ=AQ(NQ),VQ=AQ(PQ),HQ=AQ(FQ),UQ=AQ(IQ),WQ=AQ(LQ);function GQ(e,t,n){return function(r,i=n){return t(e(r)+i)}}function KQ(e){return function(t){return new Date(e(t).getTime()-1)}}function qQ(e,t){return function(n){return[e(n),t(n)]}}function JQ(e){if(e instanceof Date)return e.getFullYear();if(typeof e==`number`)return e;let t=Number.parseInt(e,10);if(typeof e==`string`&&!Number.isNaN(t))return t;throw Error(`Failed to get year from date: ${e}.`)}function YQ(e){if(e instanceof Date)return e.getMonth();throw Error(`Failed to get month from date: ${e}.`)}function XQ(e){if(e instanceof Date)return e.getDate();throw Error(`Failed to get year from date: ${e}.`)}function ZQ(e){let t=JQ(e),n=t+(-t+1)%100,r=new Date;return r.setFullYear(n,0,1),r.setHours(0,0,0,0),r}var QQ=GQ(JQ,ZQ,-100),$Q=GQ(JQ,ZQ,100),e$=KQ($Q),t$=GQ(JQ,e$,-100),n$=qQ(ZQ,e$);function r$(e){let t=JQ(e),n=t+(-t+1)%10,r=new Date;return r.setFullYear(n,0,1),r.setHours(0,0,0,0),r}var i$=GQ(JQ,r$,-10),a$=GQ(JQ,r$,10),o$=KQ(a$),s$=GQ(JQ,o$,-10),c$=qQ(r$,o$);function l$(e){let t=JQ(e),n=new Date;return n.setFullYear(t,0,1),n.setHours(0,0,0,0),n}var u$=GQ(JQ,l$,-1),d$=GQ(JQ,l$,1),f$=KQ(d$),p$=GQ(JQ,f$,-1),m$=qQ(l$,f$);function h$(e,t){return function(n,r=t){let i=JQ(n),a=YQ(n)+r,o=new Date;return o.setFullYear(i,a,1),o.setHours(0,0,0,0),e(o)}}function g$(e){let t=JQ(e),n=YQ(e),r=new Date;return r.setFullYear(t,n,1),r.setHours(0,0,0,0),r}var _$=h$(g$,-1),v$=h$(g$,1),y$=KQ(v$),b$=h$(y$,-1),x$=qQ(g$,y$);function S$(e,t){return function(n,r=t){let i=JQ(n),a=YQ(n),o=XQ(n)+r,s=new Date;return s.setFullYear(i,a,o),s.setHours(0,0,0,0),e(s)}}function C$(e){let t=JQ(e),n=YQ(e),r=XQ(e),i=new Date;return i.setFullYear(t,n,r),i.setHours(0,0,0,0),i}var w$=KQ(S$(C$,1)),T$=qQ(C$,w$);function E$(e){return XQ(y$(e))}var D$={GREGORY:`gregory`,HEBREW:`hebrew`,ISLAMIC:`islamic`,ISO_8601:`iso8601`},O$={gregory:[`en-CA`,`en-US`,`es-AR`,`es-BO`,`es-CL`,`es-CO`,`es-CR`,`es-DO`,`es-EC`,`es-GT`,`es-HN`,`es-MX`,`es-NI`,`es-PA`,`es-PE`,`es-PR`,`es-SV`,`es-VE`,`pt-BR`],hebrew:[`he`,`he-IL`],islamic:[`ar`,`ar-AE`,`ar-BH`,`ar-DZ`,`ar-EG`,`ar-IQ`,`ar-JO`,`ar-KW`,`ar-LY`,`ar-OM`,`ar-QA`,`ar-SA`,`ar-SD`,`ar-SY`,`ar-YE`,`dv`,`dv-MV`,`ps`,`ps-AR`]},k$=[0,1,2,3,4,5,6],A$=k$[0],j$=k$[5],M$=k$[6];function N$(e,t=D$.ISO_8601){let n=e.getDay();switch(t){case D$.ISO_8601:return(n+6)%7;case D$.ISLAMIC:return(n+1)%7;case D$.HEBREW:case D$.GREGORY:return n;default:throw Error(`Unsupported calendar type.`)}}function P$(e){return JQ(ZQ(e))}function F$(e){return JQ(r$(e))}function I$(e,t=D$.ISO_8601){let n=JQ(e),r=YQ(e),i=e.getDate()-N$(e,t);return new Date(n,r,i)}function L$(e,t=D$.ISO_8601){let n=t===D$.GREGORY?D$.GREGORY:D$.ISO_8601,r=I$(e,t),i=JQ(e)+1,a,o;do a=new Date(i,0,n===D$.ISO_8601?4:1),o=I$(a,t),--i;while(e<o);return Math.round((r.getTime()-o.getTime())/(864e5*7))+1}function R$(e,t){switch(e){case`century`:return ZQ(t);case`decade`:return r$(t);case`year`:return l$(t);case`month`:return g$(t);case`day`:return C$(t);default:throw Error(`Invalid rangeType: ${e}`)}}function z$(e,t){switch(e){case`century`:return QQ(t);case`decade`:return i$(t);case`year`:return u$(t);case`month`:return _$(t);default:throw Error(`Invalid rangeType: ${e}`)}}function B$(e,t){switch(e){case`century`:return $Q(t);case`decade`:return a$(t);case`year`:return d$(t);case`month`:return v$(t);default:throw Error(`Invalid rangeType: ${e}`)}}function V$(e,t){switch(e){case`decade`:return i$(t,-100);case`year`:return u$(t,-10);case`month`:return _$(t,-12);default:throw Error(`Invalid rangeType: ${e}`)}}function H$(e,t){switch(e){case`decade`:return a$(t,100);case`year`:return d$(t,10);case`month`:return v$(t,12);default:throw Error(`Invalid rangeType: ${e}`)}}function U$(e,t){switch(e){case`century`:return e$(t);case`decade`:return o$(t);case`year`:return f$(t);case`month`:return y$(t);case`day`:return w$(t);default:throw Error(`Invalid rangeType: ${e}`)}}function W$(e,t){switch(e){case`century`:return t$(t);case`decade`:return s$(t);case`year`:return p$(t);case`month`:return b$(t);default:throw Error(`Invalid rangeType: ${e}`)}}function G$(e,t){switch(e){case`decade`:return s$(t,-100);case`year`:return p$(t,-10);case`month`:return b$(t,-12);default:throw Error(`Invalid rangeType: ${e}`)}}function K$(e,t){switch(e){case`century`:return n$(t);case`decade`:return c$(t);case`year`:return m$(t);case`month`:return x$(t);case`day`:return T$(t);default:throw Error(`Invalid rangeType: ${e}`)}}function q$(e,t,n){let r=[t,n].sort((e,t)=>e.getTime()-t.getTime());return[R$(e,r[0]),U$(e,r[1])]}function J$(e,t,n){return n.map(n=>(t||WQ)(e,n)).join(` – `)}function Y$(e,t,n){return J$(e,t,n$(n))}function X$(e,t,n){return J$(e,t,c$(n))}function Z$(e){return e.getDay()===new Date().getDay()}function Q$(e,t=D$.ISO_8601){let n=e.getDay();switch(t){case D$.ISLAMIC:case D$.HEBREW:return n===j$||n===M$;case D$.ISO_8601:case D$.GREGORY:return n===M$||n===A$;default:throw Error(`Unsupported calendar type.`)}}var $$=`react-calendar__navigation`;function e1({activeStartDate:e,drillUp:t,formatMonthYear:n=VQ,formatYear:r=WQ,locale:i,maxDate:a,minDate:o,navigationAriaLabel:s=``,navigationAriaLive:c,navigationLabel:l,next2AriaLabel:u=``,next2Label:d=`»`,nextAriaLabel:f=``,nextLabel:p=`›`,prev2AriaLabel:m=``,prev2Label:h=`«`,prevAriaLabel:g=``,prevLabel:_=`‹`,setActiveStartDate:v,showDoubleView:y,view:b,views:x}){let S=x.indexOf(b)>0,C=b!==`century`,w=z$(b,e),T=C?V$(b,e):void 0,E=B$(b,e),D=C?H$(b,e):void 0,O=(()=>{if(w.getFullYear()<0)return!0;let t=W$(b,e);return o&&o>=t})(),ee=C&&(()=>{if(T.getFullYear()<0)return!0;let t=G$(b,e);return o&&o>=t})(),te=a&&a<E,k=C&&a&&a<D;function A(){v(w,`prev`)}function j(){v(T,`prev2`)}function M(){v(E,`next`)}function ne(){v(D,`next2`)}function re(e){let t=(()=>{switch(b){case`century`:return Y$(i,r,e);case`decade`:return X$(i,r,e);case`year`:return r(i,e);case`month`:return n(i,e);default:throw Error(`Invalid view: ${b}.`)}})();return l?l({date:e,label:t,locale:i||EQ()||void 0,view:b}):t}function ie(){let n=`${$$}__label`;return(0,H.jsxs)(`button`,{"aria-label":s,"aria-live":c,className:n,disabled:!S,onClick:t,style:{flexGrow:1},type:`button`,children:[(0,H.jsx)(`span`,{className:`${n}__labelText ${n}__labelText--from`,children:re(e)}),y?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`${n}__divider`,children:` – `}),(0,H.jsx)(`span`,{className:`${n}__labelText ${n}__labelText--to`,children:re(E)})]}):null]})}return(0,H.jsxs)(`div`,{className:$$,children:[h!==null&&C?(0,H.jsx)(`button`,{"aria-label":m,className:`${$$}__arrow ${$$}__prev2-button`,disabled:ee,onClick:j,type:`button`,children:h}):null,_!==null&&(0,H.jsx)(`button`,{"aria-label":g,className:`${$$}__arrow ${$$}__prev-button`,disabled:O,onClick:A,type:`button`,children:_}),ie(),p!==null&&(0,H.jsx)(`button`,{"aria-label":f,className:`${$$}__arrow ${$$}__next-button`,disabled:te,onClick:M,type:`button`,children:p}),d!==null&&C?(0,H.jsx)(`button`,{"aria-label":u,className:`${$$}__arrow ${$$}__next2-button`,disabled:k,onClick:ne,type:`button`,children:d}):null]})}function t1(e){return`${e}%`}function n1({children:e,className:t,count:n,direction:r,offset:i,style:a,wrap:o,...s}){return(0,H.jsx)(`div`,{className:t,style:{display:`flex`,flexDirection:r,flexWrap:o?`wrap`:`nowrap`,...a},...s,children:L.Children.map(e,(e,t)=>{let r=i&&t===0?t1(100*i/n):null;return(0,L.cloneElement)(e,{...e.props,style:{flexBasis:t1(100/n),flexShrink:0,flexGrow:0,overflow:`hidden`,marginLeft:r,marginInlineStart:r,marginInlineEnd:0}})})})}function r1(e,t,n){return t&&t>e?t:n&&n<e?n:e}function i1(e,t){return t[0]<=e&&t[1]>=e}function a1(e,t){return e[0]<=t[0]&&e[1]>=t[1]}function o1(e,t){return i1(e[0],t)||i1(e[1],t)}function s1(e,t,n){let r=o1(t,e),i=[];if(r){i.push(n);let r=i1(e[0],t),a=i1(e[1],t);r&&i.push(`${n}Start`),a&&i.push(`${n}End`),r&&a&&i.push(`${n}BothEnds`)}return i}function c1(e){return Array.isArray(e)?e[0]!==null&&e[1]!==null:e!==null}function l1(e){if(!e)throw Error(`args is required`);let{value:t,date:n,hover:r}=e,i=`react-calendar__tile`,a=[i];if(!n)return a;let o=new Date,s=(()=>{if(Array.isArray(n))return n;let{dateType:t}=e;if(!t)throw Error(`dateType is required when date is not an array of two dates`);return K$(t,n)})();if(i1(o,s)&&a.push(`${i}--now`),!t||!c1(t))return a;let c=(()=>{if(Array.isArray(t))return t;let{valueType:n}=e;if(!n)throw Error(`valueType is required when value is not an array of two dates`);return K$(n,t)})();a1(c,s)?a.push(`${i}--active`):o1(c,s)&&a.push(`${i}--hasActive`);let l=s1(c,s,`${i}--range`);if(a.push(...l),r&&(Array.isArray(t)?t:[t]).length===1){let e=s1(r>c[0]?[c[0],r]:[r,c[0]],s,`${i}--hover`);a.push(...e)}return a}function u1({className:e,count:t=3,dateTransform:n,dateType:r,end:i,hover:a,offset:o,renderTile:s,start:c,step:l=1,value:u,valueType:d}){let f=[];for(let e=c;e<=i;e+=l){let t=n(e);f.push(s({classes:l1({date:t,dateType:r,hover:a,value:u,valueType:d}),date:t}))}return(0,H.jsx)(n1,{className:e,count:t,offset:o,wrap:!0,children:f})}function d1(e){let{activeStartDate:t,children:n,classes:r,date:i,formatAbbr:a,locale:o,maxDate:s,maxDateTransform:c,minDate:l,minDateTransform:u,onClick:d,onMouseOver:f,style:p,tileClassName:m,tileContent:h,tileDisabled:g,view:_}=e,v=(0,L.useMemo)(()=>typeof m==`function`?m({activeStartDate:t,date:i,view:_}):m,[t,i,m,_]),y=(0,L.useMemo)(()=>typeof h==`function`?h({activeStartDate:t,date:i,view:_}):h,[t,i,h,_]);return(0,H.jsxs)(`button`,{className:U(r,v),disabled:l&&u(l)>i||s&&c(s)<i||g?.({activeStartDate:t,date:i,view:_}),onClick:d?e=>d(i,e):void 0,onFocus:f?()=>f(i):void 0,onMouseOver:f?()=>f(i):void 0,style:p,type:`button`,children:[a?(0,H.jsx)(`abbr`,{"aria-label":a(o,i),children:n}):n,y]})}var f1=`react-calendar__century-view__decades__decade`;function p1({classes:e=[],currentCentury:t,formatYear:n=WQ,...r}){let{date:i,locale:a}=r,o=[];return e&&o.push(...e),o.push(f1),ZQ(i).getFullYear()!==t&&o.push(`${f1}--neighboringCentury`),(0,H.jsx)(d1,{...r,classes:o,maxDateTransform:o$,minDateTransform:r$,view:`century`,children:X$(a,n,i)})}function m1(e){let{activeStartDate:t,hover:n,showNeighboringCentury:r,value:i,valueType:a,...o}=e,s=P$(t);return(0,H.jsx)(u1,{className:`react-calendar__century-view__decades`,dateTransform:r$,dateType:`decade`,end:s+(r?119:99),hover:n,renderTile:({date:e,...n})=>(0,H.jsx)(p1,{...o,...n,activeStartDate:t,currentCentury:s,date:e},e.getTime()),start:s,step:10,value:i,valueType:a})}function h1(e){function t(){return(0,H.jsx)(m1,{...e})}return(0,H.jsx)(`div`,{className:`react-calendar__century-view`,children:t()})}var g1=`react-calendar__decade-view__years__year`;function _1({classes:e=[],currentDecade:t,formatYear:n=WQ,...r}){let{date:i,locale:a}=r,o=[];return e&&o.push(...e),o.push(g1),r$(i).getFullYear()!==t&&o.push(`${g1}--neighboringDecade`),(0,H.jsx)(d1,{...r,classes:o,maxDateTransform:f$,minDateTransform:l$,view:`decade`,children:n(a,i)})}function v1(e){let{activeStartDate:t,hover:n,showNeighboringDecade:r,value:i,valueType:a,...o}=e,s=F$(t);return(0,H.jsx)(u1,{className:`react-calendar__decade-view__years`,dateTransform:l$,dateType:`year`,end:s+(r?11:9),hover:n,renderTile:({date:e,...n})=>(0,H.jsx)(_1,{...o,...n,activeStartDate:t,currentDecade:s,date:e},e.getTime()),start:s,value:i,valueType:a})}function y1(e){function t(){return(0,H.jsx)(v1,{...e})}return(0,H.jsx)(`div`,{className:`react-calendar__decade-view`,children:t()})}var b1=`react-calendar__month-view__days__day`;function x1({calendarType:e,classes:t=[],currentMonthIndex:n,formatDay:r=RQ,formatLongDate:i=zQ,...a}){let{date:o,locale:s}=a,c=[];return t&&c.push(...t),c.push(b1),Q$(o,e)&&c.push(`${b1}--weekend`),o.getMonth()!==n&&c.push(`${b1}--neighboringMonth`),(0,H.jsx)(d1,{...a,classes:c,formatAbbr:i,maxDateTransform:w$,minDateTransform:C$,view:`month`,children:r(s,o)})}function S1(e){let{activeStartDate:t,calendarType:n,hover:r,showFixedNumberOfWeeks:i,showNeighboringMonth:a,value:o,valueType:s,...c}=e,l=JQ(t),u=YQ(t),d=i||a,f=N$(t,n),p=d?0:f,m=(d?-f:0)+1;return(0,H.jsx)(u1,{className:`react-calendar__month-view__days`,count:7,dateTransform:e=>{let t=new Date;return t.setFullYear(l,u,e),C$(t)},dateType:`day`,hover:r,end:(()=>{if(i)return m+42-1;let e=E$(t);if(a){let t=new Date;return t.setFullYear(l,u,e),t.setHours(0,0,0,0),e+(7-N$(t,n)-1)}return e})(),renderTile:({date:e,...r})=>(0,H.jsx)(x1,{...c,...r,activeStartDate:t,calendarType:n,currentMonthIndex:u,date:e},e.getTime()),offset:p,start:m,value:o,valueType:s})}var C1=`react-calendar__month-view__weekdays`,w1=`${C1}__weekday`;function T1(e){let{calendarType:t,formatShortWeekday:n=HQ,formatWeekday:r=UQ,locale:i,onMouseLeave:a}=e,o=g$(new Date),s=JQ(o),c=YQ(o),l=[];for(let e=1;e<=7;e+=1){let a=new Date(s,c,e-N$(o,t)),u=r(i,a);l.push((0,H.jsx)(`div`,{className:U(w1,Z$(a)&&`${w1}--current`,Q$(a,t)&&`${w1}--weekend`),children:(0,H.jsx)(`abbr`,{"aria-label":u,title:u,children:n(i,a).replace(`.`,``)})},e))}return(0,H.jsx)(n1,{className:C1,count:7,onFocus:a,onMouseOver:a,children:l})}var E1=`react-calendar__tile`;function D1(e){let{onClickWeekNumber:t,weekNumber:n}=e,r=(0,H.jsx)(`span`,{children:n});if(t){let{date:t,onClickWeekNumber:n,weekNumber:i,...a}=e;return(0,H.jsx)(`button`,{...a,className:E1,onClick:e=>n(i,t,e),type:`button`,children:r})}else{let{date:t,onClickWeekNumber:n,weekNumber:i,...a}=e;return(0,H.jsx)(`div`,{...a,className:E1,children:r})}}function O1(e){let{activeStartDate:t,calendarType:n,onClickWeekNumber:r,onMouseLeave:i,showFixedNumberOfWeeks:a}=e,o=(()=>{if(a)return 6;let e=E$(t)-(7-N$(t,n));return 1+Math.ceil(e/7)})(),s=(()=>{let e=JQ(t),r=YQ(t),i=XQ(t),a=[];for(let t=0;t<o;t+=1)a.push(I$(new Date(e,r,i+t*7),n));return a})();return(0,H.jsx)(n1,{className:`react-calendar__month-view__weekNumbers`,count:o,direction:`column`,onFocus:i,onMouseOver:i,style:{flexBasis:`calc(100% * (1 / 8)`,flexShrink:0},children:s.map(e=>L$(e,n)).map((e,t)=>{let n=s[t];if(!n)throw Error(`date is not defined`);return(0,H.jsx)(D1,{date:n,onClickWeekNumber:r,weekNumber:e},e)})})}function k1(e){if(e){for(let[t,n]of Object.entries(O$))if(n.includes(e))return t}return D$.ISO_8601}function A1(e){let{activeStartDate:t,locale:n,onMouseLeave:r,showFixedNumberOfWeeks:i}=e,{calendarType:a=k1(n),formatShortWeekday:o,formatWeekday:s,onClickWeekNumber:c,showWeekNumbers:l,...u}=e;function d(){return(0,H.jsx)(T1,{calendarType:a,formatShortWeekday:o,formatWeekday:s,locale:n,onMouseLeave:r})}function f(){return l?(0,H.jsx)(O1,{activeStartDate:t,calendarType:a,onClickWeekNumber:c,onMouseLeave:r,showFixedNumberOfWeeks:i}):null}function p(){return(0,H.jsx)(S1,{calendarType:a,...u})}let m=`react-calendar__month-view`;return(0,H.jsx)(`div`,{className:U(m,l?`${m}--weekNumbers`:``),children:(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-end`},children:[f(),(0,H.jsxs)(`div`,{style:{flexGrow:1,width:`100%`},children:[d(),p()]})]})})}var j1=`react-calendar__year-view__months__month`;function M1({classes:e=[],formatMonth:t=BQ,formatMonthYear:n=VQ,...r}){let{date:i,locale:a}=r;return(0,H.jsx)(d1,{...r,classes:[...e,j1],formatAbbr:n,maxDateTransform:y$,minDateTransform:g$,view:`year`,children:t(a,i)})}function N1(e){let{activeStartDate:t,hover:n,value:r,valueType:i,...a}=e,o=JQ(t);return(0,H.jsx)(u1,{className:`react-calendar__year-view__months`,dateTransform:e=>{let t=new Date;return t.setFullYear(o,e,1),g$(t)},dateType:`month`,end:11,hover:n,renderTile:({date:e,...n})=>(0,H.jsx)(M1,{...a,...n,activeStartDate:t,date:e},e.getTime()),start:0,value:r,valueType:i})}function P1(e){function t(){return(0,H.jsx)(N1,{...e})}return(0,H.jsx)(`div`,{className:`react-calendar__year-view`,children:t()})}var F1=`react-calendar`,I1=[`century`,`decade`,`year`,`month`],L1=[`decade`,`year`,`month`,`day`],R1=new Date;R1.setFullYear(1,0,1),R1.setHours(0,0,0,0);var z1=new Date(864e13);function B1(e){return e instanceof Date?e:new Date(e)}function V1(e,t){return I1.slice(I1.indexOf(e),I1.indexOf(t)+1)}function H1(e,t,n){return V1(t,n).indexOf(e)!==-1}function U1(e,t,n){return e&&H1(e,t,n)?e:n}function W1(e){return L1[I1.indexOf(e)]}function G1(e,t){let n=Array.isArray(e)?e[t]:e;if(!n)return null;let r=B1(n);if(Number.isNaN(r.getTime()))throw Error(`Invalid date: ${e}`);return r}function K1({value:e,minDate:t,maxDate:n,maxDetail:r},i){let a=G1(e,i);if(!a)return null;let o=W1(r);return r1((()=>{switch(i){case 0:return R$(o,a);case 1:return U$(o,a);default:throw Error(`Invalid index value: ${i}`)}})(),t,n)}var q1=e=>K1(e,0),J1=e=>K1(e,1),Y1=e=>[q1,J1].map(t=>t(e));function X1({maxDate:e,maxDetail:t,minDate:n,minDetail:r,value:i,view:a}){return R$(U1(a,r,t),q1({value:i,minDate:n,maxDate:e,maxDetail:t})||new Date)}function Z1({activeStartDate:e,defaultActiveStartDate:t,defaultValue:n,defaultView:r,maxDate:i,maxDetail:a,minDate:o,minDetail:s,value:c,view:l}){let u=U1(l,s,a),d=e||t;return d?R$(u,d):X1({maxDate:i,maxDetail:a,minDate:o,minDetail:s,value:c||n,view:l||r})}function Q1(e){return e&&(!Array.isArray(e)||e.length===1)}function $1(e,t){return e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime()}var e0=(0,L.forwardRef)(function(e,t){let{activeStartDate:n,allowPartialRange:r,calendarType:i,className:a,"data-testid":o,defaultActiveStartDate:s,defaultValue:c,defaultView:l,formatDay:u,formatLongDate:d,formatMonth:f,formatMonthYear:p,formatShortWeekday:m,formatWeekday:h,formatYear:g,goToRangeStartOnSelect:_=!0,inputRef:v,locale:y,maxDate:b=z1,maxDetail:x=`month`,minDate:S=R1,minDetail:C=`century`,navigationAriaLabel:w,navigationAriaLive:T,navigationLabel:E,next2AriaLabel:D,next2Label:O,nextAriaLabel:ee,nextLabel:te,onActiveStartDateChange:k,onChange:A,onClickDay:j,onClickDecade:M,onClickMonth:ne,onClickWeekNumber:re,onClickYear:ie,onDrillDown:ae,onDrillUp:N,onViewChange:oe,prev2AriaLabel:se,prev2Label:ce,prevAriaLabel:P,prevLabel:le,returnValue:ue=`start`,selectRange:F,showDoubleView:I,showFixedNumberOfWeeks:de,showNavigation:fe=!0,showNeighboringCentury:pe,showNeighboringDecade:me,showNeighboringMonth:he=!0,showWeekNumbers:ge,tileClassName:_e,tileContent:ve,tileDisabled:ye,value:be,view:xe}=e,[Se,R]=(0,L.useState)(s),[z,B]=(0,L.useState)(null),[Ce,we]=(0,L.useState)(Array.isArray(c)?c.map(e=>e===null?null:B1(e)):c==null?null:B1(c)),[Te,Ee]=(0,L.useState)(l),De=n||Se||Z1({activeStartDate:n,defaultActiveStartDate:s,defaultValue:c,defaultView:l,maxDate:b,maxDetail:x,minDate:S,minDetail:C,value:be,view:xe}),Oe=(()=>{let e=F&&Q1(Ce)||be===void 0?Ce:be;return e?Array.isArray(e)?e.map(e=>e===null?null:B1(e)):e===null?null:B1(e):null})(),ke=W1(x),Ae=U1(xe||Te,C,x),je=V1(C,x),V=F?z:null,Me=je.indexOf(Ae)<je.length-1,Ne=je.indexOf(Ae)>0,Pe=(0,L.useCallback)(e=>(()=>{switch(ue){case`start`:return q1;case`end`:return J1;case`range`:return Y1;default:throw Error(`Invalid returnValue.`)}})()({maxDate:b,maxDetail:x,minDate:S,value:e}),[b,x,S,ue]),Fe=(0,L.useCallback)((e,t)=>{R(e);let n={action:t,activeStartDate:e,value:Oe,view:Ae};k&&!$1(De,e)&&k(n)},[De,k,Oe,Ae]),Ie=(0,L.useCallback)((e,t)=>{let n=(()=>{switch(Ae){case`century`:return M;case`decade`:return ie;case`year`:return ne;case`month`:return j;default:throw Error(`Invalid view: ${Ae}.`)}})();n&&n(e,t)},[j,M,ne,ie,Ae]),Le=(0,L.useCallback)((e,t)=>{if(!Me)return;Ie(e,t);let n=je[je.indexOf(Ae)+1];if(!n)throw Error(`Attempted to drill down from the lowest view.`);R(e),Ee(n);let r={action:`drillDown`,activeStartDate:e,value:Oe,view:n};k&&!$1(De,e)&&k(r),oe&&Ae!==n&&oe(r),ae&&ae(r)},[De,Me,k,Ie,ae,oe,Oe,Ae,je]),Re=(0,L.useCallback)(()=>{if(!Ne)return;let e=je[je.indexOf(Ae)-1];if(!e)throw Error(`Attempted to drill up from the highest view.`);let t=R$(e,De);R(t),Ee(e);let n={action:`drillUp`,activeStartDate:t,value:Oe,view:e};k&&!$1(De,t)&&k(n),oe&&Ae!==e&&oe(n),N&&N(n)},[De,Ne,k,N,oe,Oe,Ae,je]),ze=(0,L.useCallback)((e,t)=>{let n=Oe;Ie(e,t);let i=F&&!Q1(n),a;if(F)if(i)a=R$(ke,e);else{if(!n)throw Error(`previousValue is required`);if(Array.isArray(n))throw Error(`previousValue must not be an array`);a=q$(ke,n,e)}else a=Pe(e);let o=!F||i||_?X1({maxDate:b,maxDetail:x,minDate:S,minDetail:C,value:a,view:Ae}):null;t.persist(),R(o),we(a);let s={action:`onChange`,activeStartDate:o,value:a,view:Ae};if(k&&!$1(De,o)&&k(s),A)if(F){if(!Q1(a))A(a||null,t);else if(r){if(Array.isArray(a))throw Error(`value must not be an array`);A([a||null,null],t)}}else A(a||null,t)},[De,r,Pe,_,b,x,S,C,k,A,Ie,F,Oe,ke,Ae]);function Be(e){B(e)}function Ve(){B(null)}(0,L.useImperativeHandle)(t,()=>({activeStartDate:De,drillDown:Le,drillUp:Re,onChange:ze,setActiveStartDate:Fe,value:Oe,view:Ae}),[De,Le,Re,ze,Fe,Oe,Ae]);function He(e){let t={activeStartDate:e?B$(Ae,De):R$(Ae,De),hover:V,locale:y,maxDate:b,minDate:S,onClick:Me?Le:ze,onMouseOver:F?Be:void 0,tileClassName:_e,tileContent:ve,tileDisabled:ye,value:Oe,valueType:ke};switch(Ae){case`century`:return(0,H.jsx)(h1,{formatYear:g,showNeighboringCentury:pe,...t});case`decade`:return(0,H.jsx)(y1,{formatYear:g,showNeighboringDecade:me,...t});case`year`:return(0,H.jsx)(P1,{formatMonth:f,formatMonthYear:p,...t});case`month`:return(0,H.jsx)(A1,{calendarType:i,formatDay:u,formatLongDate:d,formatShortWeekday:m,formatWeekday:h,onClickWeekNumber:re,onMouseLeave:F?Ve:void 0,showFixedNumberOfWeeks:de===void 0?I:de,showNeighboringMonth:he,showWeekNumbers:ge,...t});default:throw Error(`Invalid view: ${Ae}.`)}}function Ue(){return fe?(0,H.jsx)(e1,{activeStartDate:De,drillUp:Re,formatMonthYear:p,formatYear:g,locale:y,maxDate:b,minDate:S,navigationAriaLabel:w,navigationAriaLive:T,navigationLabel:E,next2AriaLabel:D,next2Label:O,nextAriaLabel:ee,nextLabel:te,prev2AriaLabel:se,prev2Label:ce,prevAriaLabel:P,prevLabel:le,setActiveStartDate:Fe,showDoubleView:I,view:Ae,views:je}):null}return(0,H.jsxs)(`div`,{className:U(F1,F&&(Array.isArray(Oe)?Oe:[Oe]).length===1&&`${F1}--selectRange`,I&&`${F1}--doubleView`,a),"data-testid":o,ref:v,children:[Ue(),(0,H.jsxs)(`div`,{className:`${F1}__viewContainer`,onBlur:F?Ve:void 0,onMouseLeave:F?Ve:void 0,children:[He(),I?He(!0):null]})]})}),t0=G(Z,{shouldForwardProp:e=>e!==`expand`})(({expand:e})=>({width:e?`100%`:void 0}));function n0({open:e}){let t=z(e);return(0,H.jsx)(X,{title:`Filter`,enterDelay:300,children:(0,H.jsx)(Um,{onClick:()=>t(!0),size:`small`,children:(0,H.jsx)(Sre,{})})})}function r0(e){let t=e.copyToClipboardRows;return(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[e.columns.map(t=>(0,H.jsxs)(t0,{align:t.numeric?`right`:`left`,expand:t.expanded,sortDirection:e.sort.orderBy===t.id&&e.sort.order,children:[(0,H.jsx)(X,{title:`Sort`,placement:t.numeric?`bottom-end`:`bottom-start`,enterDelay:300,children:(0,H.jsx)(Uw,{active:e.sort.orderBy===t.id,direction:e.sort.order,onClick:()=>e.sort.handleRequestSort(t.id),children:t.label})}),t.openFilterDialog?(0,H.jsx)(n0,{open:t.openFilterDialog}):void 0]},t.id)),e.showDetailsCol?(0,H.jsx)(t0,{padding:`checkbox`,children:t?(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{style:{height:`25px`,paddingTop:0,paddingBottom:0},onClick:()=>m0(e.columns,t),size:`large`,children:(0,H.jsx)(uT,{})})}):void 0}):void 0]})})}var i0=new Intl.DateTimeFormat([],{year:`numeric`,month:`short`,day:`numeric`}),a0=new Intl.DateTimeFormat([],{year:`numeric`,month:`long`}),o0=G(e0)(({theme:e})=>({width:`350px`,"& .react-calendar__month-view__weekdays":{textAlign:`center`,textTransform:`uppercase`,fontWeight:`bold`},"& .react-calendar__tile":{textAlign:`center`,padding:`.75em .5em`,margin:0,border:0,background:`none`,outline:`none`,cursor:`pointer`,"&:hover":{backgroundColor:`rgb(230, 230, 230)`},"&--active":{backgroundColor:e.palette.primary.light,"&:hover":{backgroundColor:e.palette.primary.dark}}},"&.react-calendar--selectRange .react-calendar__tile--hover":{backgroundColor:`rgb(230, 230, 230)`}}));function s0(e){let[t,n]=(0,L.useState)(!1),r=e.zoom.current_date_zoom?e.zoom.current_date_zoom.start:e.zoom.default_date_range[0],i=LT(e.zoom.current_date_zoom?e.zoom.current_date_zoom.end:e.zoom.default_date_range[1],-1);function a(t){e.zoom.set_date_zoom_range({start:t[0],end:LT(t[1],1)}),n(!1)}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`span`,{children:[i0.format(e.zoom.current_date_zoom?.start??e.zoom.default_date_range[0]),` `,`- `,i0.format(e.zoom.current_date_zoom?.end??e.zoom.default_date_range[1])]}),(0,H.jsx)(X,{title:`Zoom To Date Range`,children:(0,H.jsx)(Um,{onClick:()=>n(!0),size:`large`,children:(0,H.jsx)(OT,{})})}),(0,H.jsx)(X,{title:`Reset Date Range`,children:(0,H.jsx)(Um,{onClick:()=>e.zoom.set_date_zoom_range(void 0),size:`large`,children:(0,H.jsx)(kT,{})})}),(0,H.jsxs)(cy,{open:t,onClose:()=>n(!1),children:[(0,H.jsxs)(dy,{children:[`Select Date Range `,a0.format(e.zoom.default_date_range[0])]}),(0,H.jsx)(uy,{children:(0,H.jsx)(o0,{minDate:e.zoom.default_date_range[0],maxDate:e.zoom.default_date_range[1],calendarType:`gregory`,selectRange:!0,showNavigation:!1,showNeighboringMonth:!1,value:[r,i],onChange:e=>{Array.isArray(e)&&e[0]instanceof Date&&e[1]instanceof Date&&a([e[0],e[1]])}})}),(0,H.jsx)(ly,{children:(0,H.jsx)(Y,{onClick:()=>n(!1),children:`Close`})})]})]})}var c0=(0,L.memo)(function({zoom:e,tpage:t,count:n}){let r;return e&&e.type===`Last30Days`?r=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{title:`Last 24 hours`,children:(0,H.jsx)(Y,{onClick:()=>e.set_days_back(1),style:{color:`rgba(0, 0, 0, 0.54)`},children:`24h`})}),(0,H.jsx)(X,{title:`Last 2 days`,children:(0,H.jsx)(Y,{onClick:()=>e.set_days_back(2),style:{color:`rgba(0, 0, 0, 0.54)`},children:`2d`})}),(0,H.jsx)(X,{title:`Last 3 days`,children:(0,H.jsx)(Y,{onClick:()=>e.set_days_back(3),style:{color:`rgba(0, 0, 0, 0.54)`},children:`3d`})}),(0,H.jsx)(X,{title:`Last 4 days`,children:(0,H.jsx)(Y,{onClick:()=>e.set_days_back(4),style:{color:`rgba(0, 0, 0, 0.54)`},children:`4d`})}),(0,H.jsx)(X,{title:`Last 5 days`,children:(0,H.jsx)(Y,{onClick:()=>e.set_days_back(5),style:{color:`rgba(0, 0, 0, 0.54)`},children:`5d`})}),(0,H.jsx)(X,{title:`Last 6 days`,children:(0,H.jsx)(Y,{onClick:()=>e.set_days_back(6),style:{color:`rgba(0, 0, 0, 0.54)`},children:`6d`})}),(0,H.jsx)(X,{title:`Last 1 week`,children:(0,H.jsx)(Y,{onClick:()=>e.set_days_back(7),style:{color:`rgba(0, 0, 0, 0.54)`},children:`1w`})}),(0,H.jsx)(X,{title:`Last 2 weeks`,children:(0,H.jsx)(Y,{onClick:()=>e.set_days_back(14),style:{color:`rgba(0, 0, 0, 0.54)`},children:`2w`})}),(0,H.jsx)(X,{title:`Last 3 weeks`,children:(0,H.jsx)(Y,{onClick:()=>e.set_days_back(21),style:{color:`rgba(0, 0, 0, 0.54)`},children:`3w`})}),(0,H.jsx)(X,{title:`Last 30 days`,children:(0,H.jsx)(Y,{onClick:()=>e.set_days_back(null),style:{color:`rgba(0, 0, 0, 0.54)`},children:`30d`})})]}):e&&e.type===`ZoomIntoRange`?r=(0,H.jsx)(s0,{zoom:e}):e&&e.type===`ExtendDays`&&(r=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{title:`Extend 1 day previous`,children:(0,H.jsx)(Um,{onClick:()=>e.extend(-1),size:`large`,children:(0,H.jsx)(CT,{})})}),(0,H.jsx)(q,{variant:`caption`,children:e.curStart.toLocaleDateString()+` to `+e.curEnd.toLocaleDateString()}),(0,H.jsx)(X,{title:`Extend 1 day`,children:(0,H.jsx)(Um,{onClick:()=>e.extend(1),size:`large`,children:(0,H.jsx)(ST,{})})})]})),(0,H.jsxs)(Rw,{children:[(0,H.jsx)(q,{color:`textSecondary`,variant:`caption`,children:`Rows per page:`}),(0,H.jsx)(YS,{style:{marginLeft:8,marginRight:`1em`},value:t.rowsPerPage,SelectDisplayProps:{style:{color:`rgba(0, 0, 0, 0.54)`}},input:(0,H.jsx)(ff,{}),onChange:e=>{t.setRowsPerPage(e.target.value);let r=Math.ceil(n/e.target.value)-1;t.page>r&&t.setPage(r)},children:[10,15,20,50].map(e=>(0,H.jsx)(Hx,{value:e,children:e},e))}),(0,H.jsx)(q,{color:`textSecondary`,variant:`caption`,children:`${n===0?0:t.page*t.rowsPerPage+1}-${Math.min(n,(t.page+1)*t.rowsPerPage)} of ${n}`}),(0,H.jsx)(Um,{onClick:()=>t.setPage(0),disabled:t.page===0,"aria-label":`First Page`,size:`large`,children:(0,H.jsx)(sT,{})}),(0,H.jsx)(Um,{onClick:()=>t.setPage(t.page-1),disabled:t.page===0,"aria-label":`Previous Page`,size:`large`,children:(0,H.jsx)(fT,{})}),(0,H.jsx)(Um,{onClick:()=>t.setPage(t.page+1),disabled:t.page>=Math.ceil(n/t.rowsPerPage)-1,"aria-label":`Next Page`,size:`large`,children:(0,H.jsx)(pT,{})}),(0,H.jsx)(Um,{onClick:()=>t.setPage(Math.max(0,Math.ceil(n/t.rowsPerPage)-1)),disabled:t.page>=Math.ceil(n/t.rowsPerPage)-1,"aria-label":`Last Page`,size:`large`,children:(0,H.jsx)(hT,{})}),e?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{style:{flexGrow:1}}),r]}):void 0]})}),l0=class extends L.PureComponent{render(){let e=this.props.onClickDetails,t=[...this.props.pageData],n=this.props.rowsPerPage===void 0?0:Math.max(0,this.props.rowsPerPage-t.length);return(0,H.jsxs)(Pw,{children:[t.map((t,n)=>(0,H.jsxs)(Vw,{children:[this.props.columns.map(e=>(0,H.jsx)(t0,{align:e.numeric?`right`:`left`,expand:e.expanded,children:e.Cell?(0,H.jsx)(e.Cell,{row:t}):e.getDisplay(t)},e.id)),e?(0,H.jsx)(t0,{padding:`checkbox`,children:(0,H.jsx)(Um,{onClick:n=>e(n,t),size:`large`,children:(0,H.jsx)(gT,{})})}):void 0]},n)),n>0?(0,H.jsx)(Vw,{style:{height:53*n},children:(0,H.jsx)(Z,{colSpan:this.props.columns.length+ +!!this.props.onClickDetails,style:{textAlign:`center`},children:t.length===0?this.props.emptyMessage:void 0})}):void 0]})}};function u0(e){let[t,n]=(0,L.useState)(void 0);return(0,L.useMemo)(()=>{let r;return r=e.type===`Last30`?{type:`Last30Days`,set_days_back:e=>{if(e){let t=new Date;n({start:LT(t,-e),end:BT(t,1)})}else n(void 0)}}:{type:`ZoomIntoRange`,default_date_range:[e.month,RT(e.month,1)],current_date_zoom:t,set_date_zoom_range:n},{zoom:r,zoomRange:t}},[e,t,n])}function d0(){let[e,t]=(0,L.useState)(0),[n,r]=(0,L.useState)(10);return(0,L.useMemo)(()=>({page:e,setPage:t,rowsPerPage:n,setRowsPerPage:r}),[e,t,n,r])}function f0(e,t,n){let[r,i]=(0,L.useState)(e),[a,o]=(0,L.useState)(n??`asc`);return(0,L.useMemo)(()=>{function e(e){r===e?o(a===`asc`?`desc`:`asc`):(i(e),o(`asc`))}let n={asc:t[0].getForSort??t[0].getDisplay};for(let e of t)e.id===r&&a===`asc`?n={asc:e.getForSort??e.getDisplay}:e.id===r&&(n={desc:e.getForSort??e.getDisplay});return{orderBy:r,order:a,sortOn:n,handleRequestSort:e}},[r,i,a,o,t])}function p0(e,t){let n=`<table>
|
|
345
345
|
<thead><tr>`;for(let t of e)t.ignoreDuringExport||(n+=`<th>`+t.label+`</th>`);n+=`</tr></thead>
|
|
346
346
|
<tbody>
|
|
347
347
|
`;for(let r of t){n+=`<tr>`;for(let t of e)if(!t.ignoreDuringExport){let e=t.getForExport?t.getForExport(r):t.getDisplay(r);n+=`<td>`+e+`</td>`}n+=`</tr>
|
|
348
348
|
`}return n+=`</tbody>
|
|
349
|
-
</table>`,n}function p0(e,t){Ak(f0(e,t))}var m0=[{id:0,numeric:!1,label:`Date`,getDisplay:e=>e.time.toLocaleString(),getForSort:e=>e.time.getTime()},{id:1,numeric:!1,label:`Serial`,getDisplay:e=>e.serial||``},{id:2,numeric:!1,label:`Workorder`,getDisplay:e=>e.workorder||``},{id:3,numeric:!1,label:`Inspected`,getDisplay:e=>e.toInspect?`inspected`:``},{id:4,numeric:!1,label:`Failed`,getDisplay:e=>e.failed?`failed`:``}];function h0(e,t,n){let[r,i]=(0,L.useState)(void 0),a;return e&&e===`Last30Days`?a={type:`Last30Days`,set_days_back:e=>{if(e){let t=new Date;i({start:LT(t,-e),end:BT(t,1)})}else i(void 0)}}:e&&e===`ZoomIntoRange`?a={type:`ZoomIntoRange`,default_date_range:n,current_date_zoom:r,set_date_zoom_range:i}:e&&t&&e===`ExtendDays`&&(a={type:`ExtendDays`,curStart:n[0],curEnd:n[1],extend:t}),{zoom:a,zoomRange:r}}var g0=(0,L.memo)(function(e){let t=z(SI),n=d0(0,m0),[r,i]=(0,L.useState)(iO.empty()),[a,o]=(0,L.useState)(10),[s,c]=(0,L.useState)(void 0),l=h0(e.zoomType,e.extendDateRange,e.default_date_range),u=pZ(e.points,l.zoomRange,n.sortOn);return(0,H.jsx)(`div`,{style:{width:`100%`,marginTop:`1em`},children:Q.of(u).toSortedArray(([e])=>e).map(([u,d])=>{let f=Math.min(r.get(u)??0,Math.ceil(d.material.length/a));return(0,H.jsxs)(iee,{expanded:u===s,onChange:(e,t)=>c(t?u:void 0),children:[(0,H.jsxs)(pee,{expandIcon:(0,H.jsx)(aT,{}),children:[(0,H.jsx)(q,{variant:`h6`,style:{flexBasis:`33.33%`,flexShrink:0},children:u}),(0,H.jsxs)(q,{variant:`caption`,children:[d.material.length,` total parts, `,d.failedCnt,` failed`]})]}),(0,H.jsx)(cee,{children:(0,H.jsxs)(`div`,{style:{width:`100%`},children:[(0,H.jsxs)(jw,{children:[(0,H.jsx)(n0,{columns:m0,sort:n,showDetailsCol:!0}),(0,H.jsx)(c0,{columns:m0,pageData:Q.of(d.material).drop(f*a).take(a),rowsPerPage:a,onClickDetails:e.hideOpenDetailColumn?void 0:(e,n)=>t({type:`MatSummary`,summary:{materialID:n.materialID,partName:n.partName,serial:n.serial,workorderId:n.workorder}})})]}),(0,H.jsx)(s0,{tpage:{page:f,rowsPerPage:a,setPage:e=>i(r.set(u,e)),setRowsPerPage:o},count:d.material.length,zoom:l.zoom})]})})]},u)})})}),_0=20,v0=20,y0=120,b0=20;function x0({link:e,path:t,strokeWidth:n,setTooltip:r}){let[i,a]=(0,L.useState)(!1);if(t===null)return null;function o(t){let n=rA(t);n!==null&&(r({left:n.x,top:n.y,data:e}),a(!0))}function s(){a(!1),r(null)}return(0,H.jsx)(`path`,{d:t,stroke:i?Pr[600]:Pr[300],strokeWidth:n,opacity:.2,fill:`none`,onMouseMove:o,onMouseLeave:s})}function S0({node:e}){return e.x1===void 0||e.x0===void 0||e.y1===void 0||e.y0===void 0?null:(0,H.jsxs)(`g`,{transform:`translate(${e.x0}, ${e.y0})`,children:[(0,H.jsx)(`rect`,{width:e.x1-e.x0,height:e.y1-e.y0,fill:Pr[800],opacity:.8,stroke:`none`}),(0,H.jsx)(`text`,{x:18,y:(e.y1-e.y0)/2,children:e.name})]})}var C0=(0,L.memo)(function({data:e,setTooltip:t,parentHeight:n,parentWidth:r}){let{nodes:i,links:a}=(0,L.useMemo)(()=>{let t=nQ(e);if(t.nodes.length===0)return{nodes:[],links:[]};let i=PZ().nodeWidth(10).nodePadding(10).nodeAlign(CZ).extent([[_0,v0],[r-y0,n-b0-v0]])({nodes:t.nodes,links:t.links});return{nodes:i.nodes,links:i.links.flatMap(e=>typeof e.source==`object`&&typeof e.target==`object`&&e.width!==void 0?[{...e,source:e.source,target:e.target,width:e.width}]:[])}},[e,r,n]),o=QZ();return(0,H.jsxs)(`svg`,{width:r,height:n,children:[(0,H.jsx)(`g`,{children:i.map((e,t)=>(0,H.jsx)(S0,{node:e},t))}),(0,H.jsx)(`g`,{children:a.map((e,n)=>(0,H.jsx)(x0,{link:e,path:o(e),strokeWidth:Math.max(e.width??1,1),setTooltip:t},n))})]})});function w0({tooltip:e}){return e===null?null:(0,H.jsxs)(`div`,{children:[e.data.source.name,` ➞ `,e.data.target.name,`: `,e.data.value,` parts`]})}var T0=(0,L.memo)(function({data:e}){let t=(0,L.useMemo)(()=>P(null),[]),n=z(t);return(0,H.jsx)(`div`,{style:{position:`relative`},children:(0,H.jsx)(gA,{sx:{height:{xs:`calc(100vh - 230px)`,md:`calc(100vh - 182px)`,xl:`calc(100vh - 130px)`},width:`100%`},chart:({height:t,width:r})=>(0,H.jsx)(C0,{data:e,setTooltip:n,parentHeight:t,parentWidth:r}),tooltipAtom:t,TooltipContent:w0})})}),E0=vO(e=>e(GI)?`aaa`:void 0),D0=vO(e=>e(GI)?`CMM`:void 0),O0=P(!1);function k0(e){let[t,n]=B(E0),[r,i]=B(D0),[a,o]=B(O0),s,c=e.restrictToPart||t;c&&r&&(s=e.inspectionlogs.get(new oL(c,r))?.valuesToLazySeq()??[]);let l=e.inspectionlogs.keysToLazySeq().map(e=>e.part).distinct().toSortedArray(e=>e),u=e.inspectionlogs.keysToLazySeq().map(e=>e.inspType).distinct().toSortedArray(e=>e);return(0,H.jsxs)(J,{sx:{paddingLeft:`24px`,paddingRight:`24px`,paddingTop:`10px`},children:[(0,H.jsxs)(J,{component:`nav`,sx:{display:`flex`,minHeight:`2.5em`,alignItems:`center`,maxWidth:`calc(100vw - 24px - 24px)`},children:[e.subtitle?(0,H.jsx)(q,{variant:`subtitle1`,children:e.subtitle}):void 0,(0,H.jsx)(J,{sx:{flexGrow:1}}),e.onlyTable?void 0:(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,value:a?`table`:`sankey`,onChange:e=>o(e.target.value===`table`),children:[(0,H.jsx)(Hx,{value:`sankey`,children:`Sankey`},`sankey`),(0,H.jsx)(Hx,{value:`table`,children:`Table`},`table`)]})}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{name:`inspection-sankey-select-type`,autoWidth:!0,displayEmpty:!0,style:{marginRight:`1em`,marginLeft:`1em`},value:r||``,onChange:e=>i(e.target.value),children:[r?void 0:(0,H.jsx)(Hx,{value:``,children:(0,H.jsx)(`em`,{children:`Select Inspection Type`})},0),u.map(e=>(0,H.jsx)(Hx,{value:e,children:e},e))]})}),e.restrictToPart===void 0?(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{name:`inspection-sankey-select-part`,autoWidth:!0,displayEmpty:!0,value:c||``,onChange:e=>n(e.target.value),children:[c?void 0:(0,H.jsx)(Hx,{value:``,children:(0,H.jsx)(`em`,{children:`Select Part`})},0),l.map(e=>(0,H.jsx)(Hx,{value:e,children:(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(XU,{part:e,size:30}),(0,H.jsx)(`span`,{style:{marginRight:`1em`},children:e})]})},e))]})}):void 0,s?(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{onClick:()=>s?_Z(c||``,r||``,s):void 0,style:{height:`25px`,paddingTop:0,paddingBottom:0},size:`large`,children:(0,H.jsx)(uT,{})})}):void 0]}),(0,H.jsx)(`main`,{children:s?a||e.onlyTable?(0,H.jsx)(g0,{zoomType:e.zoomType,points:s,default_date_range:e.default_date_range,extendDateRange:e.extendDateRange,hideOpenDetailColumn:e.hideOpenDetailColumn}):(0,H.jsx)(T0,{data:s}):void 0})]})}var A0=P(null),j0=OO(P(async(e,{signal:t})=>{let n=e(A0);if(n==null||Wt===void 0)return iO.empty();let r=await Wt.get(n.curStart,n.curEnd,t);return Q.of(r).flatMap(uL).filter(e=>e.key.part===n.part).toLookupMap(e=>e.key,e=>e.entry.cntr,e=>e.entry)}),e=>e??iO.empty()),M0=OO(P(async e=>{let t=e(A0);if(t==null)return iO.empty();let n=[];for(let e of qt)n.push(await e.get(t.curStart,t.curEnd));return Q.of(n).flatMap(e=>e).flatMap(uL).filter(e=>e.key.part===t.part).toLookupMap(e=>e.key,e=>e.entry.cntr,e=>e.entry)}),e=>e??iO.empty()),N0=P(e=>iO.union((e,t)=>e.union(t),e(j0),e(M0)));function P0(e){return t=>t===null?null:e<0?{curStart:LT(t.curStart,e),curEnd:t.curEnd,part:t.part}:{curStart:t.curStart,curEnd:LT(t.curEnd,e),part:t.part}}var F0=[{id:0,numeric:!1,label:`Date`,getDisplay:e=>e.time.toLocaleString(),getForSort:e=>e.time.getTime()},{id:1,numeric:!1,label:`Part`,getDisplay:e=>e.part},{id:2,numeric:!1,label:`Inspection`,getDisplay:e=>e.inspType},{id:3,numeric:!1,label:`Serial`,getDisplay:e=>e.serial||``},{id:4,numeric:!1,label:`Workorder`,getDisplay:e=>e.workorder||``}];function I0(e){let t=qI(),n=d0(0,F0),r=u0(),i=z(SI),a=Math.min(r.page,Math.ceil(e.failed.length/r.rowsPerPage)),o=Q.of(e.failed).sortBy(n.sortOn);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(jw,{children:[(0,H.jsx)(n0,{columns:F0,sort:n,showDetailsCol:!t}),(0,H.jsx)(c0,{columns:F0,pageData:o.drop(a*r.rowsPerPage).take(r.rowsPerPage),rowsPerPage:r.rowsPerPage,onClickDetails:t?void 0:(e,t)=>{i({type:`MatSummary`,summary:{materialID:t.materialID,partName:t.part,serial:t.serial,workorderId:t.workorder}})}})]}),(0,H.jsx)(s0,{tpage:{...r,page:a},count:e.failed.length})]})}function L0(){let e=R(cL),t=(0,L.useMemo)(()=>{let t=cE();return mZ(Q.of(e).flatMap(([e,t])=>t.valuesToLazySeq()),LT(t,-4),LT(t,1))},[e]);return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(J,{component:`nav`,sx:{display:`flex`,minHeight:`2.5em`,alignItems:`center`,maxWidth:`calc(100vw - 24px - 24px)`},children:[(0,H.jsx)(q,{variant:`subtitle1`,children:`Inspections marked as failed in the last 5 days`}),(0,H.jsx)(J,{sx:{flexGrow:1}}),(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{style:{height:`25px`,paddingTop:0,paddingBottom:0},onClick:()=>yZ(t),size:`large`,children:(0,H.jsx)(uT,{})})})]}),(0,H.jsx)(I0,{failed:t})]})}function R0(){let e=qI(),t=z(SI),[n,r]=(0,L.useState)(e?`00000000i9`:``),[i,a]=(0,L.useState)(!1),[o,s]=(0,L.useState)(null);function c(){n&&n!==``&&(a(!0),s(null),Wt.materialForSerial(n).then(e=>{let i=Q.of(e).maxBy(e=>e.materialID);i?(t({type:`MatDetails`,details:i}),r(``),s(null)):s(`No material found with serial `+n)}).catch(e=>{Bt.isApiException(e)?s(e.response):e instanceof Error?s(e.message):s(e)}).finally(()=>a(!1)))}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(RC,{direction:`row`,spacing:2,sx:{alignItems:`center`,marginLeft:`auto`,marginRight:`auto`},children:[(0,H.jsx)(`div`,{children:(0,H.jsx)(Kw,{label:n===``?`Serial`:`Serial (press enter)`,value:n,onChange:e=>r(e.target.value),onKeyPress:e=>{e.key===`Enter`&&n!==``&&(e.preventDefault(),c())}})}),(0,H.jsx)(`div`,{children:(0,H.jsx)(Y,{variant:`contained`,color:`secondary`,disabled:n===``||i,onClick:c,children:i?(0,H.jsxs)(RC,{direction:`row`,spacing:2,children:[(0,H.jsx)(Lm,{}),` Searching`]}):(0,H.jsx)(H.Fragment,{children:`Lookup`})})})]}),o&&o!==``?(0,H.jsx)(`div`,{children:o}):void 0]})}function z0(e){let t=e[0];if(t===void 0)return cE();let n=t.endUTC;for(let t of e)t.type===V.MachineCycle&&(n=t.endUTC);return n}function B0(){let e=R(EI),t=R(NI);return e?(0,H.jsx)(hW,{partName:e.partName,serial:e.serial,subtitle:`Path `+fZ(hZ(t))+` at `+z0(t).toLocaleString()}):(0,H.jsx)(`div`,{children:`Serial Details`})}function V0({setStep:e}){let t=R(EI),n=R(NI),r=z(A0),i=z(SI);return(0,H.jsxs)(RC,{direction:`row`,spacing:2,sx:{mt:`2em`},children:[t?(0,H.jsx)(Y,{variant:`contained`,color:`secondary`,onClick:()=>{let i=z0(n);r({part:t?.partName??``,curStart:KT(LT(i,-5)),curEnd:iE(LT(i,5))}),e(2)},children:`Lookup Similar Paths`}):void 0,(0,H.jsx)(Y,{variant:`contained`,style:{marginLeft:`2em`},onClick:()=>{i(null),r(null),e(0)},children:`Reset`})]})}function H0(e){let t=R(TI),n=R(NI),[r,i]=B(A0),a=R(N0),o=z(SI);if(t===null)return null;function s(e){i(P0(e))}return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(k0,{inspectionlogs:a,restrictToPart:t.partName,subtitle:`Paths for `+t.partName+` around `+z0(n).toLocaleString(),default_date_range:r?[r.curStart,r.curEnd]:[],zoomType:r?`ExtendDays`:void 0,extendDateRange:s,hideOpenDetailColumn:!0,onlyTable:!0}),(0,H.jsx)(Y,{variant:`contained`,style:{marginTop:`2em`},onClick:()=>{o(null),i(null),e.setStep(0)},children:`Reset`})]})}function U0(){let[e,t]=(0,L.useState)(0),n=R(SI),r=e;return r===0&&n&&(r=1),(0,H.jsxs)(RC,{direction:`column`,spacing:2,children:[(0,H.jsxs)(Tw,{activeStep:r,orientation:`horizontal`,children:[(0,H.jsx)(GC,{children:(0,H.jsx)(cw,{children:`Select Material`})}),(0,H.jsx)(GC,{children:(0,H.jsx)(cw,{children:(0,H.jsx)(B0,{})})}),(0,H.jsx)(GC,{children:(0,H.jsx)(cw,{children:`Lookup similar paths`})})]}),r===0?(0,H.jsxs)(RC,{direction:`column`,spacing:4,children:[(0,H.jsx)(q,{children:`Enter a serial number, scan a barcode, or click on a material in the table below to see details.`}),(0,H.jsx)(R0,{}),(0,H.jsx)(L0,{})]}):r===1?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(zU,{fallback:(0,H.jsx)(CW,{}),children:(0,H.jsx)(xW,{})}),(0,H.jsx)(V0,{setStep:t})]}):r===2?(0,H.jsx)(zU,{children:(0,H.jsx)(H0,{setStep:t})}):void 0]})}function W0(){return JI(`Quality Material`),(0,H.jsx)(`main`,{style:{padding:`24px`},children:(0,H.jsx)(U0,{})})}var G0=(0,L.memo)(function(){JI(`Paths`);let e=R(cL);return(0,H.jsx)(k0,{inspectionlogs:(0,L.useMemo)(()=>{let t=cE(),n=LT(t,-6),r=LT(t,1);return e.collectValues(e=>{let t=e.filter(e=>e.time>=n&&e.time<=r);return t.size===0?null:t})},[e]),default_date_range:[LT(cE(),-6),LT(cE(),1)],subtitle:`Paths from the last 7 days`})}),K0=P(!1);function q0(e){let t=``;return e.comments&&e.comments.length>0&&(t=`; `+e.comments[e.comments.length-1].comment),`Due ${e.dueDate.toLocaleDateString()}; Completed ${e.completedQuantity} of ${e.plannedQuantity}${t}`}function J0({work:e}){return e.plannedQuantity<=e.completedQuantity?(0,H.jsx)($w,{}):(0,H.jsx)(xT,{})}function Y0(){let[e,t]=(0,L.useState)(null),n=R(TI),[r]=RI(),i=z(K0);return(0,H.jsx)(Kw,{sx:{mt:`5px`},label:e===null||e===``?`Workorder`:`Workorder (press enter)`,value:e??``,onChange:e=>t(e.target.value),onKeyPress:t=>{t.key===`Enter`&&n&&e&&e!==``&&(t.preventDefault(),r(n,e),i(!1))}})}function X0(){let e=R(TI),t=R(Tie),n=z(K0),[r]=RI();return(0,H.jsx)(pb,{children:(t??[]).map(t=>(0,H.jsx)(Db,{children:(0,H.jsxs)(vb,{onClick:()=>{e&&r(e,t.workorderId),n(!1)},children:[(0,H.jsx)(Mb,{children:(0,H.jsx)(J0,{work:t})}),(0,H.jsx)(Lb,{primary:t.workorderId,secondary:q0(t)})]})},t.workorderId))})}var Z0=(0,L.memo)(function(){let[e,t]=B(K0),n;return n=e?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(dy,{children:`Select Workorder`}),(0,H.jsx)(uy,{children:(0,H.jsxs)(zU,{children:[(0,H.jsx)(Y0,{}),(0,H.jsx)(X0,{})]})}),(0,H.jsx)(ly,{children:(0,H.jsx)(Y,{onClick:()=>t(!1),color:`primary`,children:`Cancel`})})]}):(0,H.jsx)(`p`,{children:`None`}),(0,H.jsx)(cy,{open:e,onClose:()=>t(!1),maxWidth:`md`,children:n})}),Q0=P(!1);function $0(){let[e,t]=(0,L.useState)(null),n=R(TI),[r]=II(),i=z(Q0);return(0,H.jsx)(Kw,{sx:{mt:`5px`},label:e===``||e===null?`Inspection Type`:`Inspection Type (press enter)`,value:e??``,onChange:e=>t(e.target.value),onKeyPress:t=>{t.key===`Enter`&&n&&e&&e!==``&&(t.preventDefault(),r({mat:n,inspType:e,inspect:!0}),i(!1))}})}function e2(){let e=R(TI),[t]=II(),n=R(kL),r=Q.of(n).sortBy(e=>e),i=z(Q0);return e===null?null:(0,H.jsx)(pb,{children:r.map(n=>(0,H.jsx)(Db,{children:(0,H.jsxs)(vb,{onClick:()=>{t({mat:e,inspType:n,inspect:!0}),i(!1)},children:[(0,H.jsx)(Mb,{children:(0,H.jsx)(bT,{})}),(0,H.jsx)(Lb,{primary:n})]})},n))})}function t2(){let e=z(Q0),t=R(OI);return t===null||t.materialID<0?null:(0,H.jsx)(Y,{color:`primary`,onClick:()=>e(!0),children:`Signal Inspection`})}var n2=(0,L.memo)(function(){let[e,t]=B(Q0),n;return n=e?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(dy,{children:`Select Inspection Type`}),(0,H.jsx)(uy,{children:(0,H.jsxs)(zU,{children:[(0,H.jsx)($0,{}),(0,H.jsx)(e2,{})]})}),(0,H.jsx)(ly,{children:(0,H.jsx)(Y,{onClick:()=>t(!1),color:`primary`,children:`Cancel`})})]}):(0,H.jsx)(`p`,{children:`None`}),(0,H.jsx)(cy,{open:e,onClose:()=>t(!1),maxWidth:`md`,children:n})}),r2=function(e){return e[e.Material=0]=`Material`,e[e.FreeMaterialZone=1]=`FreeMaterialZone`,e[e.CompletedCollapsedMaterialZone=2]=`CompletedCollapsedMaterialZone`,e[e.CompletedExpandedMaterialZone=3]=`CompletedExpandedMaterialZone`,e[e.PalletFaceZone=4]=`PalletFaceZone`,e[e.QueueZone=5]=`QueueZone`,e[e.BasketZone=6]=`BasketZone`,e}({});function i2(e){switch(e.type){case 0:return`Material-`+(e.identifier??(e.material?.materialID??-1).toString());case 1:return`FreeMaterialZone`;case 2:return`CompletedCollapsedMaterialZone`;case 3:return`CompletedExpandedMaterialZone`;case 4:return`PalletFaceZone-`+e.face.toString();case 5:return`QueueZone-`+e.queue;case 6:return`BasketZone-`+e.basketId.toString()}}function a2(e){switch(e.type){case 0:return[e.type,e.material,e.identifier];case 1:case 2:case 3:return[e.type,null];case 4:return[e.type,e.face];case 5:return[e.type,e.queue];case 6:return[e.type,e.basketId]}}function o2(e){let t,n,r=new Map,i=new Map,a=new Map,o=[];for(let s of e.values())switch(s.type){case 1:t=s.elem;break;case 2:case 3:n=s.elem;break;case 4:r.set(s.face,s.elem);break;case 5:i.set(s.queue,s.elem);break;case 6:a.set(s.basketId,s.elem);break;case 0:s.material&&o.push([s.elem,s.material]);break}return{freeMaterial:t,completedMaterial:n,faces:r,queues:i,baskets:a,material:o}}function s2(e,t){if(!e)return[];let n=o2(t);if(!n.completedMaterial)return[];let r=[],i=new Map,a=new Map,o=new Map,s=0;for(let[t,c]of Q.of(n.material).sortBy(([e])=>e.left,([e])=>e.top))switch(c.action.type){case st.UnloadToCompletedMaterial:case st.UnloadToInProcess:if(c.action.unloadToBasketId){let i=n.baskets.get(c.action.unloadToBasketId),a=o.get(c.action.unloadToBasketId)??0;o.set(c.action.unloadToBasketId,a+1),r.push({fromX:t.left,fromY:t.top+t.height/2,toX:i===void 0?e.left+2:i.right-5,toY:i===void 0?t.top+t.height/2:i.top+20*(a+1),curveDirection:1})}else if(c.action.type===st.UnloadToCompletedMaterial&&(!c.action.unloadIntoQueue||c.action.unloadIntoQueue===``))r.push({fromX:t.right,fromY:t.top+t.height/2,toY:t.top+t.height/2,toX:n.completedMaterial?n.completedMaterial.left+2:e.right-10,curveDirection:1});else{let i,o;c.action.unloadIntoQueue?(i=n.queues.get(c.action.unloadIntoQueue),o=a.get(c.action.unloadIntoQueue)??0,a.set(c.action.unloadIntoQueue,o+1)):(i=n.freeMaterial,o=s,s+=1),r.push({fromX:t.left,fromY:t.top+t.height/2,toX:i===void 0?e.left+2:i.right-5,toY:i===void 0?t.top+t.height/2:i.top+20*(o+1),curveDirection:1})}break;case st.Loading:if(c.action.loadFromBasketId&&c.action.loadOntoFace){let e=n.faces.get(c.action.loadOntoFace);if(e!==void 0){let n=i.get(c.action.loadOntoFace)??0;i.set(c.action.loadOntoFace,n+1),r.push({fromX:t.right,fromY:t.top+t.height/2,toX:e.left+20,toY:e.top+50+20*n,curveDirection:-1})}}else if(c.action.loadFromBasketId){let i=n.baskets.get(c.action.loadFromBasketId),a=o.get(c.action.loadFromBasketId)??0;o.set(c.action.loadFromBasketId,a+1),r.push({fromX:t.right,fromY:t.top+t.height/2,toX:i===void 0?e.right-10:i.left+20,toY:i===void 0?t.top+t.height/2:i.top+50+20*a,curveDirection:-1})}else if(c.action.loadOntoFace)if(c.location.type===at.OnPallet)if(c.location.palletNum===c.action.loadOntoPalletNum&&c.location.face===c.action.loadOntoFace)r.push({fromX:t.right,fromY:t.top+t.height*3/4,toX:t.left+t.width*7/8,toY:t.bottom,curveDirection:-1});else{let e=n.faces.get(c.action.loadOntoFace);e&&(c.action.loadOntoFace<(c.location.face??0)?r.push({fromX:t.left,fromY:t.top+t.height/2,toX:t.left,toY:e.bottom+20,curveDirection:-1}):r.push({fromX:t.left,fromY:t.top+t.height/2,toX:t.left,toY:e.top-20,curveDirection:1}))}else{let e=n.faces.get(c.action.loadOntoFace);if(e!==void 0){let n=i.get(c.action.loadOntoFace)??0;i.set(c.action.loadOntoFace,n+1),r.push({fromX:t.right,fromY:t.top+t.height/2,toX:e.left+20,toY:e.top+50+20*n,curveDirection:-1})}}break;case st.LoadingToBasket:{let i=c.action.loadToBasketId;if(i===void 0)break;let a=n.baskets.get(i),s=o.get(i)??0;o.set(i,s+1),r.push({fromX:t.right,fromY:t.top+t.height/2,toX:a===void 0?e.right-10:a.left+20,toY:a===void 0?t.top+t.height/2:a.top+50+20*s,curveDirection:-1});break}}return r.map(t=>({fromX:t.fromX-e.left,fromY:t.fromY-e.top,toX:t.toX-e.left,toY:t.toY-e.top,curveDirection:t.curveDirection}))}function c2(e){let t=e.getBoundingClientRect();return{left:t.left+window.scrollX,top:t.top+window.scrollY,width:t.width,height:t.height,bottom:t.bottom+window.scrollY,right:t.right+window.scrollX}}function l2(e){let t=(e.fromX+e.toX)/2,n=(e.fromY+e.toY)/2,r=Math.atan2(e.toY-e.fromY,e.toX-e.fromX)+Math.PI*e.curveDirection/2,i=t+50*Math.cos(r),a=n+50*Math.sin(r);return`M${e.fromX},${e.fromY} Q ${i} ${a} ${e.toX} ${e.toY}`}var u2=(0,L.memo)(function({container:e,arrowsWithRefs:t}){let[,n]=(0,L.useState)({height:window.innerHeight,width:window.innerWidth});return(0,L.useEffect)(()=>{function e(){n({height:window.innerHeight,width:window.innerWidth})}return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[n]),(0,H.jsx)(`g`,{children:s2(e.current?c2(e.current):null,t.collectValues(e=>e.elem.current?{...e,elem:c2(e.elem.current)}:null)).map((e,t)=>(0,H.jsx)(`path`,{style:{fill:`none`,stroke:`rgba(0,0,0,0.15)`,strokeWidth:2},d:l2(e),markerEnd:`url(#arrow)`},t))})}),d2=(0,L.createContext)(void 0),f2=(0,L.memo)(function({children:e,hideArrows:t,whiteBackground:n}){let r=(0,L.useRef)(null),[i,a]=(0,L.useState)(iO.empty()),o=(0,L.useMemo)(()=>({registerNode(e,t,n){a(t&&n?r=>r.set(e,{...t,elem:n}):t=>t.delete(e))}}),[a]);return(0,H.jsxs)(`div`,{style:{position:`relative`},children:[(0,H.jsxs)(`svg`,{style:{position:`absolute`,pointerEvents:`none`,width:`100%`,height:`100%`,top:0,right:0,zIndex:-1,backgroundColor:n?`white`:`#F8F8F8`},children:[(0,H.jsx)(`defs`,{children:(0,H.jsx)(`marker`,{id:`arrow`,markerWidth:6,markerHeight:10,refX:`0`,refY:`3`,orient:`auto`,markerUnits:`strokeWidth`,children:(0,H.jsx)(`path`,{d:`M0,0 L0,6 L5,3 z`,fill:`rgba(0,0,0,0.15)`})})}),t?void 0:(0,H.jsx)(u2,{container:r,arrowsWithRefs:i})]}),(0,H.jsx)(`div`,{ref:r,children:(0,H.jsx)(d2.Provider,{value:o,children:e})})]})});function p2(e){let t=(0,L.useContext)(d2);if(!t)throw Error(`useMoveMaterialArrowRef must be used within a MoveMaterialArrowContainer`);let n=(0,L.useRef)(null);return(0,L.useEffect)(()=>{let r=i2(e);return t.registerNode(r,e,n),()=>{t.registerNode(r,null,null)}},[t,...a2(e)]),n}function m2({kind:e,children:t}){return(0,H.jsx)(`div`,{ref:p2(e),"data-move-material-identifier":i2(e),children:t})}var h2=45,g2=55;function _2(){let e=R(NO),t=R(sO),n=R(br),r=Q.of(e.material).filter(e=>e.location.type===at.OnPallet||e.action.type===st.Loading).toRLookup(e=>e.location.palletNum??e.action.loadOntoPalletNum??0),i=Q.of(e.material).filter(e=>e.location.type===at.InBasket&&e.location.basketId!==null&&e.location.basketId!==void 0||e.action.type===st.LoadingToBasket&&e.action.loadToBasketId!==null&&e.action.loadToBasketId!==void 0).toRLookup(e=>e.location.basketId??e.action.loadToBasketId??0),a=Q.ofObject(e.pallets).filter(([e,t])=>t.currentPalletLocation.loc===nt.LoadUnload).toOrderedMap(([e,t])=>[t.currentPalletLocation.num,{lulNum:t.currentPalletLocation.num,pal:{pallet:t,mats:r.get(t.palletNum)??[]},basket:null,staging:[],sources:[]}]),o=Q.ofObject(e.pallets).filter(([,e])=>e.currentPalletLocation.loc===nt.Machine||e.currentPalletLocation.loc===nt.MachineQueue).map(([e,t])=>t).groupBy(e=>e.currentPalletLocation.group,e=>e.currentPalletLocation.num).toLookupOrderedMap(([[e,t],n])=>e,([[e,t],n])=>t,([[t,n],i])=>{let a=i.find(e=>e.currentPalletLocation.loc===nt.Machine),o=a?r.get(a.palletNum)??[]:null,s=i.find(e=>e.currentPalletLocation.loc===nt.MachineQueue),c=s?r.get(s.palletNum)??[]:null,l=!0,u=c?.[0];if(u&&u.lastCompletedMachiningRouteStopIndex!==null&&u.lastCompletedMachiningRouteStopIndex!==void 0){let r=e.jobs[u.jobUnique]?.procsAndPaths?.[u.process-1]?.paths?.[u.path-1]?.stops?.[u.lastCompletedMachiningRouteStopIndex];r.stationGroup===t&&r.stationNums.includes(n)&&(l=!1)}return l?{name:t+` `+n.toString(),inbound:s?{pallet:s,mats:c??[]}:null,worktable:a?{pallet:a,mats:o??[]}:null,outbound:null}:{name:t+` `+n.toString(),inbound:null,worktable:a?{pallet:a,mats:o??[]}:null,outbound:s?{pallet:s,mats:c??[]}:null}}),s=Q.ofObject(e.pallets).filter(([e,t])=>t.currentPalletLocation.loc===nt.Buffer||t.currentPalletLocation.loc===nt.Cart).collect(([e,t])=>{let n=r.get(t.palletNum);return!n||n.length===0?null:{pallet:t,mats:n}}).toOrderedMap(e=>[e.pallet.palletNum,e]),c=1,l=1,u=LT(new Date,-7),d=t.valuesToLazySeq().filter(e=>e.routeEndUTC>u).concat(Q.ofObject(e.jobs).map(([e,t])=>t)).flatMap(e=>e.procsAndPaths).toRArray();for(let e of d)for(let t of(e.basketLoadStations??[]).concat(e.basketUnloadStations??[]))c=Math.max(c,t);let f=Q.of(d).flatMap(e=>e.paths);for(let e of f){for(let t of e.load.concat(e.unload))c=Math.max(c,t);e.face&&(l=Math.max(l,e.face));for(let t of e.stops)o=o.alter(t.stationGroup,e=>{e??=eO.empty();for(let n of t.stationNums)e=e.alter(n,e=>e||{name:t.stationGroup+` `+n.toString(),inbound:null,worktable:null,outbound:null});return e})}for(let e=1;e<=c;e++)a=a.alter(e,t=>t||{lulNum:e,pal:null,basket:null,staging:[],sources:[]});for(let t of Object.values(e.pallets))l=Math.max(l,t.numFaces);for(let t of e.material)t.location.face!==null&&t.location.face!==void 0&&(l=Math.max(l,t.location.face));let p=eO.empty();if(e.machineLocations&&e.machineLocations.length>0)for(let t of e.machineLocations){o=o.alter(t.machineGroup,e=>{if(!e||t.machineNum===void 0)return e;let n=e.delete(t.machineNum);if(n.size!==0)return n});for(let n of t.possibleLoadStations){let r;a=a.alter(n,e=>{r=e});let i=Q.of(r?.pal?.mats??[]).toLookup(n=>{if(n.action.type===st.Machining)return`Machining`;if(n.action.type!==st.Waiting)return`Loading`;if(n.lastCompletedMachiningRouteStopIndex!==null&&n.lastCompletedMachiningRouteStopIndex!==void 0){let r=e.jobs[n.jobUnique]?.procsAndPaths?.[n.process-1]?.paths?.[n.path-1]?.stops?.[n.lastCompletedMachiningRouteStopIndex];if(!r||r.stationGroup===t.machineGroup&&r.stationNums.includes(t.machineNum))return`Loading`}return`Ready`}),o={lulNum:n,machineMoving:t.moving,machineCurrentlyAtLoad:n===t.currentLoadStation?{group:t.machineGroup,num:t.machineNum}:null,readyMats:i.get(`Ready`)??[],machiningMats:i.get(`Machining`)??[],loadingMats:i.get(`Loading`)??[]};p=p.set(n,o)}}let m=new Map,h=new Map,g=new Map,_=0,v=0;for(let t of Q.ofObject(e.baskets??{}).map(([e,t])=>t).sortBy(e=>e.basketId)){let e={basket:t,mats:i.get(t.basketId)??[]};switch(t.position.location){case _t.Storage:e.mats.length>0?v+=1:_+=1;break;case _t.LoadUnload:case _t.LoadStationStaging:{let n=t.position.locationNum;if(n===null){g.set(t.basketId,e);break}let r=t.position.location===_t.LoadUnload?h:m,i=r.get(n)??[];i.push(e),r.set(n,i);break}case _t.InTransit:g.set(t.basketId,e);break}}let y=0,b=0;return a=a.mapValues(e=>{let t=new Map,r=Q.of(e.pal?.mats??e.basket?.mats??[]).filter(e=>e.location.type!==at.OnPallet).toRArray();for(let e of r){if(e.location.type===at.Free){let n=`free`,r=t.get(n)??{label:`To Load`,mats:[]};r.mats.push(e),t.set(n,r);continue}if(e.action.loadFromBasketId!==null&&e.action.loadFromBasketId!==void 0){let r=`basket:${e.action.loadFromBasketId}`,i=t.get(r)??{label:`From ${ok(n.basketName)} ${e.action.loadFromBasketId}`,mats:[]};i.mats.push(e),t.set(r,i);continue}if(e.location.type===at.InQueue&&e.location.currentQueue){let n=`queue:${e.location.currentQueue}`,r=t.get(n)??{label:`From ${e.location.currentQueue}`,mats:[]};r.mats.push(e),t.set(n,r)}}let i=Q.of(h.get(e.lulNum)??[]).sortBy(e=>e.basket.position.locationNum).toRArray();for(let e of i.slice(1))g.set(e.basket.basketId,e);let a=new Set(Q.of(e.pal?.mats??[]).collect(e=>e.action.loadFromBasketId??null).toRArray()),o=Q.of(m.get(e.lulNum)??[]).filter(e=>!a.has(e.basket.basketId)).sortBy(e=>e.basket.position.locationNum).toRArray();y=Math.max(y,o.length);let s=Q.of(t).map(([e,t])=>({key:e,label:t.label,mats:t.mats})).sortBy(e=>e.label).toRArray();return b=Math.max(b,s.length),{...e,basket:i[0]??null,staging:o,sources:s}}),{machines:o.mapValues(e=>e.valuesToAscLazySeq().toRArray()),loads:a.valuesToAscLazySeq().toRArray(),stockerPals:s.valuesToAscLazySeq().toRArray(),floatingBaskets:Q.of(g.values()).toRArray(),storageBaskets:_+v>0?{empty:_,filled:v}:null,machineAtLoad:p.valuesToAscLazySeq().toRArray(),maxNumFacesOnPallet:l,maxNumStagingRows:y,maxNumSourceRows:b}}function v2({mats:e}){let[t,n]=(0,L.useState)(!1),r=(0,L.useRef)(null),i=(0,L.useRef)(null),[a,o]=(0,L.useState)(!1),s=z(SI),c=R(NO);function l(){r.current!==null&&(clearTimeout(r.current),r.current=null),n(!0)}function u(){r.current=setTimeout(()=>{n(!1),r.current=null},200)}function d(){e.length===1?s({type:`MatDetails`,details:e[0]}):o(!0)}function f(e,t){return t==null?null:(e!=null&&e!=null?c.pallets[e]?.faceNames?.[t-1]:null)??`Face: `+t.toString()}return(0,H.jsxs)(J,{sx:{width:h2,height:h2,overflow:`visible`},children:[(0,H.jsx)(Up,{elevation:4,onPointerEnter:l,onPointerLeave:u,sx:{position:`relative`,zIndex:t?10:0,width:`max-content`,height:`max-content`},children:(0,H.jsx)(W_,{badgeContent:e.length>1?e.length:0,color:`secondary`,children:(0,H.jsx)(bm,{focusRipple:!0,onClick:d,ref:i,children:(0,H.jsx)(zp,{orientation:`horizontal`,in:t,collapsedSize:h2,children:(0,H.jsxs)(J,{sx:{display:`flex`},children:[(0,H.jsx)(XU,{part:e[0].partName,size:h2}),(0,H.jsx)(J,{sx:{marginLeft:`10px`,marginRight:`10px`,whiteSpace:`nowrap`,textAlign:`left`},children:(0,H.jsx)(zp,{in:t,collapsedSize:h2,children:(0,H.jsxs)(RC,{direction:`column`,sx:{marginBottom:`0.2em`},children:[(0,H.jsxs)(q,{variant:`h6`,children:[e[0].partName,`-`,e[0].process]}),(0,H.jsx)(`div`,{children:(0,H.jsx)(`small`,{children:f(e[0].location.palletNum,e[0].location.face)??f(e[0].action.loadOntoPalletNum,e[0].action.loadOntoFace)})}),Q.of(e).collect(e=>e.serial?(0,H.jsx)(`div`,{children:(0,H.jsxs)(`small`,{children:[`Serial: `,e.serial]})},e.materialID):void 0),(0,H.jsx)(`div`,{children:(0,H.jsx)(iW,{mat:e[0]})})]})})})]})})})})}),(0,H.jsx)(Rx,{anchorEl:i.current,open:a,onClose:()=>o(!1),anchorOrigin:{vertical:`top`,horizontal:`left`},children:Q.of(e).map((e,t)=>(0,H.jsx)(Hx,{onClick:()=>{o(!1),s({type:`MatDetails`,details:e})},children:e.serial&&e.serial!==``?e.serial:(t+1).toString()},e.materialID))})]})}function y2({maxNumFaces:e,mats:t,loadingOntoPallet:n,noFilter:r,showExpanded:i}){if(i&&e===1)return(0,H.jsx)(J,{sx:{display:`flex`,flexDirection:`column`,flexWrap:`wrap`},children:t.map(e=>(0,H.jsx)(dW,{mat:e},e.materialID))});{let i=n?Q.of(t).filter(e=>r||e.location.type!==at.OnPallet).orderedGroupBy(e=>e.action.loadOntoFace??1):Q.of(t).filter(e=>r||e.location.type===at.OnPallet).orderedGroupBy(e=>e.action.type===st.Loading?e.action.loadOntoFace??1:e.location.face??1);return(0,H.jsx)(J,{sx:{display:`grid`,gridTemplateRows:`${h2}px`,gridTemplateColumns:`repeat(${e}, ${h2}px)`,columnGap:`5px`,height:`100%`,alignContent:`center`,justifyContent:`center`},children:i.map(([e,t])=>(0,H.jsx)(J,{sx:{gridColumn:e,gridRow:1},children:(0,H.jsx)(v2,{mats:t})},e))})}}function b2({mats:e}){let t=Q.of(e).orderedGroupBy(e=>e.location.basketSlot??0);return(0,H.jsx)(J,{sx:{display:`flex`,flexWrap:`wrap`,justifyContent:`flex-start`,alignItems:`flex-start`,gap:`5px`,minHeight:`${h2}px`,paddingLeft:`5px`,paddingRight:`5px`,height:`100%`,alignContent:`center`},children:t.map(([e,t])=>(0,H.jsx)(J,{children:(0,H.jsx)(v2,{mats:t})},e))})}function x2({mats:e,maxNumFaces:t}){return(0,H.jsx)(J,{sx:{minHeight:`${g2}px`,display:`flex`,alignItems:`center`,justifyContent:`flex-start`,paddingLeft:`5px`,gap:`5px`,paddingRight:`5px`},children:(0,H.jsx)(y2,{mats:e,maxNumFaces:t,loadingOntoPallet:!0})})}function S2(e,t){let n=h2*e+5*(e+1);return t?`60px ${Math.max(n,100)}px`:`${Math.max(n,100)}px`}function C2(e){e=Math.round(e);let t=Math.abs(e)%60,n=Math.floor(Math.abs(e)/60),r=n%60,i=Math.floor(n/60);return i>0?`${e<0?`-`:``}${i}:${r.toString().padStart(2,`0`)}:${t.toString().padStart(2,`0`)}`:`${e<0?`-`:``}${r}:${t.toString().padStart(2,`0`)}`}function w2(e){let t=e?.find(e=>e.action.type===st.Machining),n=t?.action?.elapsedMachiningTime,r=t?.action.expectedRemainingMachiningTime,i=R(NO).timeOfCurrentStatusUTC,a=R(PO),o=null;r&&(o=zO(r)-(a-Math.floor(i.getTime()/1e3)));let s=null;return n&&(s=zO(n)+(a-Math.floor(i.getTime()/1e3))),o!==null&&s!==null?[!0,`${C2(s)} / ${C2(o)}`,o<0?-1:s/(s+o)*100]:o===null?s===null?[!!t,`Idle`,null]:[!0,C2(s),null]:[!0,` / `+C2(o),o<0?-1:null]}function T2({machine:e}){let[t,n,r]=w2(e.worktable?.mats);return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(q,{variant:`h5`,children:e.name}),(0,H.jsx)(q,{variant:`subtitle1`,children:n}),t?r===null?(0,H.jsx)(tb,{}):r<0?(0,H.jsx)(tb,{color:`error`}):(0,H.jsx)(tb,{variant:`determinate`,value:r}):void 0]})}function E2({maxNumFaces:e,machine:t}){return(0,H.jsxs)(J,{sx:{display:`grid`,border:`1px solid black`,margin:`5px`,gridTemplateRows:`auto ${g2}px ${g2}px ${g2}px`,gridTemplateColumns:S2(e,!0),gridTemplateAreas:`"machname machname" "inboundpal inboundmat" "worktablepal worktablemat" "outboundpal outboundmat"`},children:[(0,H.jsx)(J,{sx:{gridArea:`machname`,padding:`0.2em`,borderBottom:`1px solid black`},children:(0,H.jsx)(T2,{machine:t})}),(0,H.jsx)(J,{sx:{gridArea:`inboundpal`,borderRight:`1px solid black`,borderBottom:`1px solid black`,padding:`2px`},children:(0,H.jsxs)(RC,{children:[(0,H.jsx)(q,{variant:`body1`,sx:{textAlign:`center`},children:`In`}),t.inbound?(0,H.jsx)(q,{variant:`h6`,sx:{textAlign:`center`},children:t.inbound.pallet.palletNum}):void 0]})}),(0,H.jsx)(J,{sx:{gridArea:`inboundmat`,borderBottom:`1px solid black`},children:t.inbound?(0,H.jsx)(y2,{mats:t.inbound.mats,maxNumFaces:e}):void 0}),(0,H.jsx)(J,{sx:{gridArea:`worktablepal`,borderRight:`1px solid black`,borderBottom:`1px solid black`,padding:`2px`},children:(0,H.jsxs)(RC,{children:[(0,H.jsx)(q,{variant:`body1`,sx:{textAlign:`center`},children:`Work`}),t.worktable?(0,H.jsx)(q,{variant:`h6`,sx:{textAlign:`center`},children:t.worktable.pallet.palletNum}):void 0]})}),(0,H.jsx)(J,{sx:{gridArea:`worktablemat`,borderBottom:`1px solid black`},children:t.worktable?(0,H.jsx)(y2,{mats:t.worktable.mats,maxNumFaces:e}):void 0}),(0,H.jsx)(J,{sx:{gridArea:`outboundpal`,borderRight:`1px solid black`,padding:`2px`},children:(0,H.jsxs)(RC,{children:[(0,H.jsx)(q,{variant:`body1`,sx:{textAlign:`center`},children:`Out`}),t.outbound?(0,H.jsx)(q,{variant:`h6`,sx:{textAlign:`center`},children:t.outbound.pallet.palletNum}):void 0]})}),(0,H.jsx)(J,{sx:{gridArea:`outboundmat`},children:t.outbound?(0,H.jsx)(y2,{mats:t.outbound.mats,maxNumFaces:e}):void 0})]})}function D2(e){let t=(e?.find(e=>e.action.type===st.Loading||e.action.type===st.LoadingToBasket||e.action.type===st.UnloadToCompletedMaterial||e.action.type===st.UnloadToInProcess))?.action?.elapsedLoadUnloadTime,n=R(NO).timeOfCurrentStatusUTC,r=R(PO),i=null;return t&&(i=zO(t)+(r-Math.floor(n.getTime()/1e3))),i===null?`Idle`:C2(i)}function O2({load:e}){let t=D2(e.pal?.mats??e.basket?.mats),n=R(br);return(0,H.jsxs)(J,{sx:{display:`flex`,justifyContent:`space-between`,alignItems:`baseline`},children:[(0,H.jsx)(q,{variant:`h5`,children:ik(e.lulNum,n.loadStationNames)}),(0,H.jsx)(q,{variant:`body1`,children:t})]})}function k2({maxNumFaces:e,maxNumStagingRows:t,maxNumSourceRows:n,load:r}){let i=ok(R(br).basketName),a=r.pal?`Pallet`:r.basket?i:null,o=r.pal?r.pal.pallet.palletNum.toString():r.basket?r.basket.basket.basketId.toString():null,s=Math.max(1,n),c=Math.max(1,t),l=Array.from({length:s},(e,t)=>`"source${t} sourcemat${t}"`),u=Array.from({length:c},(e,t)=>`"stage${t} stagemat${t}"`),d=[`"lulname lulname"`,...l,`"current currentmat"`,...u].join(` `);return(0,H.jsxs)(J,{sx:{display:`grid`,border:`1px solid black`,margin:`5px`,gridTemplateRows:`auto repeat(${s+1+c}, ${g2}px)`,gridTemplateColumns:S2(e,!0),gridTemplateAreas:d},children:[(0,H.jsx)(J,{sx:{gridArea:`lulname`,padding:`0.2em`,borderBottom:`1px solid black`},children:(0,H.jsx)(O2,{load:r})}),Array.from({length:s},(t,n)=>{let i=r.sources[n]??null;return(0,H.jsxs)(L.Fragment,{children:[(0,H.jsx)(J,{sx:{gridArea:`source${n}`,borderRight:`1px solid black`,borderBottom:`1px solid black`,padding:`2px`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:i?(0,H.jsx)(q,{variant:`body2`,sx:{textAlign:`center`},children:i.label}):void 0}),(0,H.jsx)(J,{sx:{gridArea:`sourcemat${n}`,borderBottom:`1px solid black`,display:`flex`,flexDirection:`column`,justifyContent:`center`},children:i?(0,H.jsx)(x2,{mats:i.mats,maxNumFaces:e}):void 0})]},`source-${n}`)}),(0,H.jsx)(J,{sx:{gridArea:`current`,borderRight:`1px solid black`,borderBottom:`1px solid black`,padding:`2px`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,H.jsxs)(RC,{children:[a?(0,H.jsx)(q,{variant:`body1`,sx:{textAlign:`center`},children:a}):void 0,o?(0,H.jsx)(q,{variant:`h6`,sx:{textAlign:`center`},children:o}):void 0]})}),(0,H.jsxs)(J,{sx:{gridArea:`currentmat`,display:`flex`,flexDirection:`column`,justifyContent:`center`,borderBottom:`1px solid black`},children:[r.pal?(0,H.jsx)(y2,{mats:r.pal.mats,maxNumFaces:e}):void 0,!r.pal&&r.basket?(0,H.jsx)(b2,{mats:r.basket.mats}):void 0]}),Array.from({length:c},(e,t)=>{let n=r.staging[t]??null,a=t===c-1;return(0,H.jsxs)(L.Fragment,{children:[(0,H.jsx)(J,{sx:{gridArea:`stage${t}`,borderRight:`1px solid black`,...a?{}:{borderBottom:`1px solid black`},padding:`2px`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:n?(0,H.jsxs)(q,{variant:`body2`,sx:{textAlign:`center`},children:[`Staging `,i,` `,n.basket.basketId]}):void 0}),(0,H.jsx)(J,{sx:{gridArea:`stagemat${t}`,...a?{}:{borderBottom:`1px solid black`},display:`flex`,flexDirection:`column`,justifyContent:`center`},children:n?(0,H.jsx)(b2,{mats:n.mats}):void 0})]},`stage-${t}`)})]})}function A2({status:e}){let t=D2(e.loadingMats),[n,r,i]=w2(e.machiningMats);return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(q,{variant:`h5`,children:[`Station `,e.lulNum]}),e.machineCurrentlyAtLoad?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(q,{variant:`h5`,children:[e.machineCurrentlyAtLoad.group,` `,e.machineCurrentlyAtLoad.num]}),(0,H.jsx)(q,{variant:`subtitle1`,children:r===`Idle`?t:r}),n?i===null?(0,H.jsx)(tb,{}):i<0?(0,H.jsx)(tb,{color:`error`}):(0,H.jsx)(tb,{variant:`determinate`,value:i}):void 0]}):(0,H.jsxs)(H.Fragment,{children:[e.machineMoving?(0,H.jsx)(q,{variant:`subtitle2`,children:`Machine Moving`}):void 0,(0,H.jsxs)(q,{variant:`subtitle1`,children:[`Loading `,t]})]})]})}function j2({maxNumFaces:e,status:t}){return(0,H.jsxs)(J,{sx:{display:`grid`,border:`1px solid black`,margin:`5px`,gridTemplateRows:`minmax(104px, max-content) repeat(3, ${e>1?g2.toString()+`px`:`minmax(110px, max-content)`})`,gridTemplateColumns:e===1?`60px minmax(230px, max-content)`:S2(e,!0),gridTemplateAreas:`"name name" "ready readymat" "machining machiningmat" "loadstation loadstationmat"`},children:[(0,H.jsx)(J,{sx:{gridArea:`name`,padding:`0.2em`,borderBottom:`1px solid black`},children:(0,H.jsx)(A2,{status:t})}),(0,H.jsx)(J,{sx:{gridArea:`ready`,borderRight:`1px solid black`,borderBottom:`1px solid black`,padding:`2px`},children:(0,H.jsx)(q,{variant:`body1`,sx:{textAlign:`center`},children:`Ready`})}),(0,H.jsx)(J,{sx:{gridArea:`readymat`,borderBottom:`1px solid black`,display:`flex`,flexDirection:`column`,justifyContent:`center`},children:(0,H.jsx)(y2,{mats:t.readyMats,maxNumFaces:e,showExpanded:!0})}),(0,H.jsx)(J,{sx:{gridArea:`machining`,borderRight:`1px solid black`,borderBottom:`1px solid black`,padding:`2px`},children:(0,H.jsx)(q,{variant:`body1`,sx:{textAlign:`center`},children:`Work`})}),(0,H.jsx)(J,{sx:{gridArea:`machiningmat`,borderBottom:`1px solid black`,display:`flex`,flexDirection:`column`,justifyContent:`center`},children:(0,H.jsx)(y2,{mats:t.machiningMats,maxNumFaces:e,showExpanded:!0})}),(0,H.jsx)(J,{sx:{gridArea:`loadstation`,borderRight:`1px solid black`,padding:`2px`},children:(0,H.jsxs)(RC,{children:[(0,H.jsx)(q,{variant:`body1`,sx:{textAlign:`center`},children:`Load`}),(0,H.jsx)(q,{variant:`body1`,sx:{textAlign:`center`},children:`Station`})]})}),(0,H.jsx)(J,{sx:{gridArea:`loadstationmat`,display:`flex`,flexDirection:`column`,justifyContent:`center`},children:(0,H.jsx)(y2,{mats:t.loadingMats,maxNumFaces:e,showExpanded:!0,noFilter:!0})})]})}function M2({maxNumFaces:e,pallet:t}){return(0,H.jsxs)(J,{sx:{display:`grid`,border:`1px solid black`,margin:`5px`,gridTemplateRows:`auto ${g2}px`,gridTemplateColumns:S2(e,!1),gridTemplateAreas:`"palname" "palmat"`},children:[(0,H.jsxs)(q,{variant:`h5`,sx:{gridArea:`palname`,padding:`0.2em`,borderBottom:`1px solid black`},children:[`Pallet `,t.pallet.palletNum]}),(0,H.jsx)(J,{sx:{gridArea:`palmat`},children:(0,H.jsx)(y2,{mats:t.mats,maxNumFaces:e})})]})}function N2({basket:e}){let t=ok(R(br).basketName);return(0,H.jsxs)(J,{sx:{display:`grid`,border:`1px solid black`,margin:`5px`,gridTemplateRows:`auto ${g2}px`,gridTemplateColumns:`minmax(120px, max-content)`,gridTemplateAreas:`"basketname" "basketmat"`},children:[(0,H.jsxs)(q,{variant:`h5`,sx:{gridArea:`basketname`,padding:`0.2em`,borderBottom:`1px solid black`},children:[t,` `,e.basket.basketId]}),(0,H.jsx)(J,{sx:{gridArea:`basketmat`},children:(0,H.jsx)(b2,{mats:e.mats})})]})}function P2({empty:e,filled:t}){return(0,H.jsxs)(J,{sx:{display:`grid`,border:`1px solid black`,margin:`5px`,padding:`0.5em 1em`,alignContent:`center`,minWidth:`170px`},children:[(0,H.jsxs)(q,{variant:`h5`,children:[ok(R(br).basketName),` Storage`]}),(0,H.jsxs)(q,{variant:`body1`,children:[`Empty: `,e]}),(0,H.jsxs)(q,{variant:`body1`,children:[`Filled: `,t]})]})}var F2=(0,L.memo)(function({overview:e}){return(0,H.jsxs)(`div`,{children:[e.machines.toAscLazySeq().map(([t,n])=>(0,H.jsx)(J,{sx:{display:`flex`,flexWrap:`wrap`,justifyContent:`space-evenly`},children:n.map(t=>(0,H.jsx)(E2,{machine:t,maxNumFaces:e.maxNumFacesOnPallet},t.name))},t)),e.loads.length>0?(0,H.jsx)(J,{sx:{display:`flex`,flexWrap:`wrap`,justifyContent:`space-evenly`},children:e.loads.map(t=>(0,H.jsx)(k2,{load:t,maxNumFaces:e.maxNumFacesOnPallet,maxNumStagingRows:e.maxNumStagingRows,maxNumSourceRows:e.maxNumSourceRows},t.lulNum))}):void 0,e.machineAtLoad.length>0?(0,H.jsx)(J,{sx:{display:`flex`,flexWrap:`wrap`,justifyContent:`space-evenly`},children:e.machineAtLoad.map(t=>(0,H.jsx)(j2,{status:t,maxNumFaces:e.maxNumFacesOnPallet},t.lulNum))}):void 0,e.stockerPals.length>0||e.floatingBaskets.length>0||e.storageBaskets?(0,H.jsxs)(J,{sx:{display:`flex`,flexWrap:`wrap`,justifyContent:`space-evenly`},children:[e.stockerPals.map(t=>(0,H.jsx)(M2,{pallet:t,maxNumFaces:e.maxNumFacesOnPallet},t.pallet.palletNum)),e.floatingBaskets.map(e=>(0,H.jsx)(N2,{basket:e},e.basket.basketId)),e.storageBaskets?(0,H.jsx)(P2,{empty:e.storageBaskets.empty,filled:e.storageBaskets.filled}):void 0]}):void 0]})}),I2=(0,L.memo)(function({ignoreOperator:e}){let[t,n]=(0,L.useState)(null),[r,i]=(0,L.useState)(null);function a(){n(null),i(null)}return(0,H.jsx)(TW,{onClose:a,allowNote:!0,highlightProcsGreaterOrEqualTo:r?.process??void 0,extraDialogElements:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(pX,{st:t,setState:n}),r===null?null:(0,H.jsx)(lX,{st:r,setState:i})]}),buttons:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(iX,{ignoreOperator:e}),(0,H.jsx)(aX,{onClose:a,ignoreOperator:e}),(0,H.jsx)(t2,{}),(0,H.jsx)(mX,{st:t,setState:n,onClose:a,ignoreOperator:e}),(0,H.jsx)(uX,{st:r,setState:i,onClose:a,ignoreOperator:e})]})})});function L2({ignoreOperator:e,whiteBackground:t}){JI(`System Overview`);let n=_2();return(0,H.jsxs)(`main`,{style:{padding:`10px`,minHeight:`calc(100vh - 64px)`,backgroundColor:t?`white`:`#F8F8F8`},children:[(0,H.jsx)(F2,{overview:n}),(0,H.jsx)(I2,{ignoreOperator:e}),(0,H.jsx)(n2,{})]})}var R2=30;function z2({machine:e}){let t=Od(),[,,n]=w2(e.worktable?.mats);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`rect`,{x:3,y:3,width:24,height:24,stroke:`black`}),`;`,(0,H.jsx)(`rect`,{x:3,y:3,width:24,height:8,fill:e.inbound===null?`white`:t.palette.secondary.main}),(0,H.jsx)(`rect`,{x:3,y:11,width:24,height:8,fill:e.worktable===null?`white`:n!=null&&n<0?t.palette.error.main:t.palette.secondary.main}),(0,H.jsx)(`rect`,{x:3,y:19,width:24,height:8,fill:e.outbound===null?`white`:t.palette.secondary.main})]})}function B2({load:e}){let t=Od();return(0,H.jsx)(`polygon`,{points:`3,27 27,27 15,3`,fill:e.pal===null&&e.basket===null&&e.staging.length===0?`white`:t.palette.secondary.main,stroke:`black`})}function V2({status:e}){let t=Od(),[,,n]=w2(e.machiningMats);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`rect`,{x:3,y:3,width:24,height:24,stroke:`black`}),`;`,(0,H.jsx)(`rect`,{x:3,y:3,width:24,height:8,fill:e.readyMats.length===0?`white`:t.palette.secondary.main}),(0,H.jsx)(`rect`,{x:3,y:11,width:24,height:8,fill:e.machiningMats.length===0?`white`:n!=null&&n<0?t.palette.error.main:t.palette.secondary.main}),(0,H.jsx)(`rect`,{x:3,y:19,width:24,height:8,fill:e.loadingMats.length===0?`white`:t.palette.secondary.main})]})}var H2=(0,L.memo)(function({overview:e}){let t=e.machines.toAscLazySeq().sumBy(([,e])=>e.length);return(0,H.jsx)(J,{sx:{height:`1.5em`,"&:hover":{backgroundColor:`primary.light`}},children:(0,H.jsxs)(`svg`,{viewBox:`0 0 ${(t+e.loads.length+e.machineAtLoad.length)*R2} ${R2}`,preserveAspectRatio:`none`,width:`140px`,height:`1.5em`,children:[(0,H.jsx)(`g`,{children:e.machines.toAscLazySeq().flatMap(([,e])=>e).map((e,t)=>(0,H.jsx)(`g`,{transform:`translate(${t*R2})`,children:(0,H.jsx)(z2,{machine:e})},e.name))}),(0,H.jsx)(`g`,{transform:`translate(${t*R2})`,children:e.loads.map((e,t)=>(0,H.jsx)(`g`,{transform:`translate(${t*R2})`,children:(0,H.jsx)(B2,{load:e})},e.lulNum))}),(0,H.jsx)(`g`,{transform:`translate(${(t+e.loads.length)*R2})`,children:e.machineAtLoad.map((e,t)=>(0,H.jsx)(`g`,{transform:`translate(${t*R2})`,children:(0,H.jsx)(V2,{status:e})},e.lulNum))})]})})}),U2=(0,L.memo)(function({full:e}){let[t,n]=(0,L.useState)(!1),r=_2();return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Y,{onClick:()=>n(!0),children:(0,H.jsx)(H2,{overview:r})}),(0,H.jsxs)(cy,{open:t,onClose:()=>n(!1),maxWidth:`xl`,fullScreen:e,children:[e?(0,H.jsx)(dh,{sx:{position:`relative`},children:(0,H.jsxs)(Rw,{children:[(0,H.jsx)(Um,{edge:`start`,color:`inherit`,onClick:()=>n(!1),"aria-label":`close`,children:(0,H.jsx)(hre,{})}),(0,H.jsx)(q,{sx:{ml:2,flex:1},variant:`h6`,component:`div`,children:`System Overview`})]})}):void 0,(0,H.jsx)(uy,{children:(0,H.jsx)(J,{sx:{paddingBottom:`2em`,paddingLeft:`5em`,paddingRight:`5em`},children:(0,H.jsx)(F2,{overview:r})})})]})]})});function W2(e){return Number.isInteger(e)&&(e??0)>0}function G2(e){return typeof e==`string`&&e.trim()!==``}function K2(e,t){if(e.location.type===at.InBasket&&e.location.basketId===t&&(e.action.type===st.UnloadToInProcess||e.action.type===st.UnloadToCompletedMaterial))return W2(e.location.basketSlot)?{type:`valid`,workId:e.action.workId}:{type:`invalid`};if(e.action.type===st.LoadingToBasket){if(!W2(e.action.loadToBasketId))return{type:`invalid`};if(e.action.loadToBasketId!==t)return;let n=e.location.type===at.InBasket&&e.location.basketId===t&&e.location.basketSlot===e.action.loadToBasketSlot;return!W2(e.action.loadToBasketSlot)||!n&&e.location.type!==at.Free&&(e.location.type!==at.InQueue||!G2(e.location.currentQueue))?{type:`invalid`}:{type:`valid`,workId:e.action.workId}}}function q2(e,t){let n=Q.of(e).collect(e=>K2(e,t)).toRArray();if(n.some(e=>e.type===`invalid`))return{type:`inconsistent`};let r=n.filter(e=>e.type===`valid`);if(r.length===0)return{type:`none`};let i=r.filter(e=>G2(e.workId)),a=Q.of(i).toHashSet(({workId:e})=>e);return i.length!==r.length||a.size!==1?{type:`inconsistent`}:{type:`confirmable`,work:{workId:i[0].workId}}}function J2(e){return e.location.type===at.InBasket&&e.location.basketId===e.action.loadToBasketId&&e.location.basketSlot===e.action.loadToBasketSlot?`Unload, re-plate, and reload this slot`:e.location.type===at.InQueue&&e.location.currentQueue?`Load from ${e.location.currentQueue}`:`Load from raw material`}function Y2({material:e,fsize:t}){return e.map(e=>(0,H.jsx)(m2,{kind:{type:r2.Material,material:e},children:(0,H.jsx)(dW,{mat:e,fsize:t})},e.materialID))}function X2({stationNumber:e,basket:t,material:n,fsize:r,submitCommand:i}){let[a,o]=(0,L.useState)(),s=(0,L.useMemo)(()=>q2(n,t.basketId),[t.basketId,n]),c=s.type===`confirmable`?s.work:void 0,l=a!==void 0&&a.workId===c?.workId?a.state:`idle`,u=(0,L.useMemo)(()=>Q.of(n).filter(e=>e.location.type===at.InBasket&&e.location.basketId===t.basketId&&e.location.basketSlot!==void 0).groupBy(e=>e.location.basketSlot??0).toHashMap(e=>e),[t.basketId,n]),d=(0,L.useMemo)(()=>Q.of(n).filter(e=>e.action.type===st.LoadingToBasket&&e.action.loadToBasketId===t.basketId&&e.action.loadToBasketSlot!==void 0).groupBy(e=>e.action.loadToBasketSlot??0).toHashMap(e=>e),[t.basketId,n]),f=(0,L.useMemo)(()=>Q.of(t.emptySlots??[]).concat(t.unknownSlots??[]).concat(u.keysToLazySeq()).concat(d.keysToLazySeq()).distinctBy(e=>e).toSortedArray(e=>e),[t.emptySlots,t.unknownSlots,u,d]);async function p(){if(c===void 0||i===void 0)return;let t=c.workId;o({workId:t,state:`submitting`});try{let n=await i(e,{workId:t});o(e=>e?.workId===t?{workId:t,state:n}:e)}catch{o(e=>e?.workId===t?{workId:t,state:`error`}:e)}}let m=l===`submitting`||l===`accepted`||l===`conflict`;return(0,H.jsxs)(RC,{spacing:2,sx:{mt:2},children:[(0,H.jsx)(q,{variant:`h6`,children:`Basket slots`}),(0,H.jsx)(J,{sx:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(15em, 1fr))`,gap:2},children:f.map(e=>{let n=u.get(e)??[],i=d.get(e)??[],a=t.unknownSlots?.includes(e)===!0;return(0,H.jsx)(ov,{"data-testid":`basket-load-station-slot-${e}`,variant:`outlined`,children:(0,H.jsxs)(uv,{children:[(0,H.jsxs)(q,{variant:`h6`,children:[`Slot `,e]}),n.length>0?(0,H.jsx)(Y2,{material:n,fsize:r}):(0,H.jsx)(q,{color:a?`warning.main`:`text.secondary`,children:a?`Unknown`:`Empty`}),i.map((e,t)=>(0,H.jsxs)(J,{sx:{mt:1},children:[(0,H.jsx)(q,{children:J2(e)}),(0,H.jsxs)(q,{variant:`body2`,color:`text.secondary`,children:[e.partName,` · Process `,e.action.processAfterLoad??e.process]})]},`${e.jobUnique}-${e.process}-${t}`))]})},e)})}),c&&i?(0,H.jsx)(J,{sx:{display:`flex`,justifyContent:`flex-end`},children:(0,H.jsx)(Y,{variant:`contained`,disabled:m,onClick:()=>void p(),children:`Confirm`})}):c?(0,H.jsx)(th,{severity:`warning`,children:`Basket work confirmation is not configured.`}):s.type===`inconsistent`?(0,H.jsx)(th,{severity:`warning`,children:`Basket work is inconsistent. Wait for refreshed material actions before confirming.`}):null,l===`accepted`?(0,H.jsx)(th,{severity:`success`,children:`Confirmation accepted. Waiting for refreshed work.`}):l===`conflict`?(0,H.jsx)(th,{severity:`warning`,children:`Basket work changed before confirmation. Review the refreshed slots and try again.`}):l===`error`?(0,H.jsx)(th,{severity:`error`,children:`Unable to confirm basket work. No work was assumed complete.`}):null]})}function Z2(e){return encodeURIComponent(e.toString())}function Q2(e){switch(e.kind){case`queue`:return`load-station-queue-${Z2(e.label)}`;case`baskets`:return`load-station-baskets`;case`free`:return`load-station-material`}}function $2(e,t,n){switch(e.action.type){case st.Loading:return t!==void 0&&e.action.loadOntoPalletNum===t.palletNum||n!==void 0&&e.action.loadFromBasketId===n.basketId;case st.LoadingToBasket:return n!==void 0&&e.action.loadToBasketId===n.basketId;default:return!1}}function e4(e,t,n,r){let i,a,o=new Set;if(e>=0){for(let t of Object.values(n.pallets))if(t.currentPalletLocation.loc===nt.LoadUnload&&t.currentPalletLocation.num===e){i=t;break}for(let t of Object.values(n.baskets??{}))t.position.locationNum===e&&(t.position.location===_t.LoadUnload?a=t:t.position.location===_t.LoadStationStaging&&o.add(t.basketId))}let s=new Set(t);if(i!==void 0)for(let e of n.material)e.action.type===st.Loading&&e.action.loadOntoPalletNum===i.palletNum&&e.location.type===at.InQueue&&e.location.currentQueue&&s.add(e.location.currentQueue),e.action.type===st.Loading&&e.action.loadOntoPalletNum===i.palletNum&&e.action.loadFromBasketId&&o.add(e.action.loadFromBasketId),(e.action.type===st.UnloadToInProcess||e.action.type===st.UnloadToCompletedMaterial)&&e.action.unloadToBasketId&&e.location.type===at.OnPallet&&e.location.palletNum===i.palletNum&&o.add(e.action.unloadToBasketId),(e.action.type===st.UnloadToInProcess||e.action.type===st.UnloadToCompletedMaterial)&&e.action.unloadIntoQueue&&e.location.type===at.OnPallet&&e.location.palletNum===i.palletNum&&s.add(e.action.unloadIntoQueue);else if(a!==void 0)for(let e of n.material)e.location.type===at.InBasket&&e.location.basketId===a.basketId&&(e.action.type===st.UnloadToInProcess||e.action.type===st.UnloadToCompletedMaterial)&&e.action.unloadIntoQueue&&s.add(e.action.unloadIntoQueue),e.location.type===at.InQueue&&e.location.currentQueue&&$2(e,void 0,a)&&s.add(e.location.currentQueue);let c=new Map(Q.of(s).map(e=>[e,{mats:[],hiddenCnt:0}])),l=new Map(Q.of(o).map(e=>[e,{mats:[],hiddenCnt:0}])),u=[],d=eO.empty(),f=null;if(i)for(let e=1;e<=i.numFaces;e++)d=d.set(e,[]);else a&&(d=d.set(1,[]));for(let e of n.material){if(i?(e.action.type===st.Loading&&e.action.loadOntoPalletNum===i.palletNum&&(e.action.elapsedLoadUnloadTime&&(f=e.action.elapsedLoadUnloadTime),e.action.loadOntoFace&&!d.has(e.action.loadOntoFace)&&(d=d.set(e.action.loadOntoFace,[])),e.location.type===at.Free&&u.push(e)),e.location.type===at.OnPallet&&e.location.palletNum===i.palletNum&&((e.action.type===st.UnloadToCompletedMaterial||e.action.type===st.UnloadToInProcess)&&e.action.elapsedLoadUnloadTime&&(f=e.action.elapsedLoadUnloadTime),d=d.alter(e.location.face??1,t=>t?(t.push(e),t):[e]))):a&&($2(e,i,a)&&e.action.elapsedLoadUnloadTime&&(f=e.action.elapsedLoadUnloadTime),e.action.type===st.LoadingToBasket&&e.action.loadToBasketId===a.basketId&&e.location.type===at.Free&&u.push(e),e.location.type===at.InBasket&&e.location.basketId===a.basketId&&((e.action.type===st.UnloadToCompletedMaterial||e.action.type===st.UnloadToInProcess)&&e.action.elapsedLoadUnloadTime&&(f=e.action.elapsedLoadUnloadTime),d=d.alter(1,t=>t?(t.push(e),t):[e]))),e.location.type===at.InQueue&&e.location.currentQueue&&c.has(e.location.currentQueue)){let t=c.get(e.location.currentQueue);r&&!$2(e,i,a)?t===void 0?c.set(e.location.currentQueue,{mats:[],hiddenCnt:1}):t.hiddenCnt+=1:t===void 0?c.set(e.location.currentQueue,{mats:[e],hiddenCnt:0}):t.mats.push(e)}if(e.location.type===at.InBasket&&e.location.basketId&&l.has(e.location.basketId)){let t=l.get(e.location.basketId);r&&!$2(e,i,a)?t===void 0?l.set(e.location.basketId,{mats:[],hiddenCnt:1}):t.hiddenCnt+=1:t===void 0?l.set(e.location.basketId,{mats:[e],hiddenCnt:0}):t.mats.push(e)}}c.forEach(e=>e.mats.sort(ME(e=>e.location.queuePosition??0))),l.forEach(e=>e.mats.sort(ME(e=>e.location.basketSlot??0)));let p=u.length+d.valuesToAscLazySeq().sumBy(e=>e.length);return{pallet:i,activeBasket:a,allMaterial:n.material,face:d,freeLoadingMaterial:u,queues:c,baskets:l,elapsedLoadingTime:f,fsize:p<=2?`x-large`:p<=6?`large`:`normal`}}function t4({loadData:e}){let t=qI(),n=R(jO),r=(0,L.useMemo)(()=>{let t=e.pallet;return t?Q.of(e.face.values()).append(e.freeLoadingMaterial).concat(Q.of(e.queues).collect(([e,t])=>t.mats)).flatMap(e=>e).collect(e=>e.action.type===st.Loading&&e.action.loadOntoPalletNum===t.palletNum&&e.location.type===at.OnPallet&&e.location.palletNum===t.palletNum?$t(e.partName,`unload`,e.materialID,t.palletNum,e.process,n):e.action.type===st.Loading&&e.action.loadOntoPalletNum===t.palletNum?$t(e.partName,`load`,e.materialID,t.palletNum,e.action.processAfterLoad??e.process,n):e.location.type===at.OnPallet&&e.location.palletNum===t.palletNum&&(e.action.type===st.UnloadToCompletedMaterial||e.action.type===st.UnloadToInProcess)?$t(e.partName,`unload`,e.materialID,t.palletNum,e.process,n):null).toRArray():[]},[e,n]);if(r.length===0||t)return(0,H.jsx)(`div`,{});function i(){for(let e of r)window.open(e,`_blank`)}return(0,H.jsx)(J,{sx:{position:`fixed`,bottom:`5px`,right:`5px`},children:(0,H.jsx)(X,{title:`Open All Instructions`,children:(0,H.jsx)(hy,{onClick:i,color:`secondary`,children:(0,H.jsx)(Cre,{})})})})}function n4({elapsedLoadTime:e}){let t=R(NO).timeOfCurrentStatusUTC,n=R(PO);return e?(0,H.jsx)(`span`,{children:C2(zO(e)+(n-Math.floor(t.getTime()/1e3)))}):null}function r4({data:e,faceNum:t,loadNum:n,submitBasketLoadStationCommand:r}){let i=e.face.get(t),a=ok(R(br).basketName);return i?e.activeBasket&&!e.pallet?(0,H.jsxs)(`div`,{"data-testid":`load-station-active-basket`,children:[t===1?(0,H.jsxs)(J,{sx:{display:`grid`,gridTemplateColumns:`1fr auto`},children:[(0,H.jsxs)(q,{variant:`h4`,children:[a,` `,e.activeBasket.basketId]}),(0,H.jsx)(J,{sx:{justifySelf:`flex-end`},children:(0,H.jsx)(n4,{elapsedLoadTime:e.elapsedLoadingTime})})]}):null,(0,H.jsx)(J,{sx:{ml:`4em`,mr:`4em`},children:(0,H.jsx)(m2,{kind:{type:r2.BasketZone,basketId:e.activeBasket.basketId},children:(0,H.jsx)(X2,{stationNumber:n,basket:e.activeBasket,material:e.allMaterial,fsize:e.fsize,submitCommand:r})})})]}):e.pallet?(0,H.jsxs)(`div`,{"data-testid":`load-station-pallet-face-${t}`,children:[t===1?(0,H.jsxs)(J,{sx:{display:`grid`,gridTemplateColumns:e.pallet.numFaces>1?`1fr 1fr 1fr`:`1fr 1fr`},children:[(0,H.jsxs)(q,{variant:`h4`,children:[`Pallet `,e.pallet.palletNum]}),e.pallet.numFaces>1?(0,H.jsx)(q,{variant:`h6`,sx:{justifySelf:`center`},children:e.pallet.faceNames?.[t-1]??`Face 1`}):void 0,(0,H.jsx)(J,{sx:{justifySelf:`flex-end`},children:(0,H.jsx)(n4,{elapsedLoadTime:e.elapsedLoadingTime})})]}):e.pallet.numFaces>1?(0,H.jsx)(J,{sx:{display:`flex`,justifyContent:`center`},children:(0,H.jsx)(q,{variant:`h6`,children:e.pallet.faceNames?.[t-1]??`Face ${t}`})}):void 0,(0,H.jsx)(J,{sx:{ml:`4em`,mr:`4em`},children:(0,H.jsx)(m2,{kind:{type:r2.PalletFaceZone,face:t},children:(0,H.jsx)(J,{sx:{display:`flex`,flexWrap:`wrap`,justifyContent:`space-around`},children:i.map((t,n)=>(0,H.jsx)(m2,{kind:{type:r2.Material,material:t},children:(0,H.jsx)(dW,{mat:t,fsize:e.fsize})},n))})})})]}):null:null}function i4({data:e,mat:t}){return(0,H.jsxs)(`div`,{children:[t.label===``?null:(0,H.jsx)(q,{variant:`h4`,children:t.label}),t.material.mats.map((n,r)=>(0,H.jsx)(m2,{kind:{type:r2.Material,material:n,identifier:n.materialID<0?`raw-${t.isFree?`free`:`queue`}-${t.label}-${r}`:void 0},children:t.isFree||t.sortable===!1?(0,H.jsx)(dW,{mat:n,displayActionForSinglePallet:e.pallet?e.pallet.palletNum:0,fsize:e.fsize,showRawMaterial:!0,showJobComment:!0}):(0,H.jsx)(fW,{mat:n,displayActionForSinglePallet:e.pallet?e.pallet.palletNum:0,shake:n.action.type===st.Loading&&n.action.loadOntoPalletNum===e.pallet?.palletNum,fsize:n.action.type===st.Loading&&n.action.loadOntoPalletNum===e.pallet?.palletNum?e.fsize:void 0,showRawMaterial:!0,showJobComment:!0})},r)),t.material.hiddenCnt>0?(0,H.jsxs)(q,{variant:`body2`,color:`textSecondary`,sx:{textAlign:`center`,mt:`0.5em`},children:[`+`,t.material.hiddenCnt,` hidden`]}):null]})}function a4({data:e,label:t,baskets:n}){return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(q,{variant:`h4`,children:t}),n.map((t,n)=>(0,H.jsxs)(J,{"data-testid":`load-station-basket-${Z2(t.basketId)}`,sx:{mt:n===0?`0.5em`:`1.5em`,pt:n===0?void 0:`1em`},children:[(0,H.jsx)(q,{variant:`h6`,sx:{mb:`0.5em`},children:t.label}),(0,H.jsx)(m2,{kind:{type:r2.BasketZone,basketId:t.basketId},children:(0,H.jsx)(i4,{data:e,mat:{label:``,material:t.material,isFree:!1,sortable:!1}})})]},t.basketId))]})}function o4({data:e,region:t}){switch(t.kind){case`free`:return(0,H.jsx)(m2,{kind:{type:r2.FreeMaterialZone},children:(0,H.jsx)(i4,{data:e,mat:{label:t.label,material:t.material,isFree:!0,sortable:!1}})});case`queue`:return(0,H.jsx)(m2,{kind:{type:r2.QueueZone,queue:t.label},children:(0,H.jsx)(pJ,{matIds:t.material.mats.map(e=>e.materialID),direction:`vertical`,queueName:t.label,renderDragOverlay:t=>(0,H.jsx)(pW,{mat:t,displayActionForSinglePallet:e.pallet?e.pallet.palletNum:0,fsize:t.action.type===st.Loading&&t.action.loadOntoPalletNum===e.pallet?.palletNum?e.fsize:void 0}),children:(0,H.jsx)(i4,{data:e,mat:{label:t.label,material:t.material,isFree:!1,sortable:!0}})})});case`baskets`:return(0,H.jsx)(a4,{data:e,label:t.label,baskets:t.baskets})}}function s4(){let e=R(fL);return(0,H.jsx)(`div`,{children:(0,L.useMemo)(()=>{let t=BT(new Date,-5);return e.matsById.valuesToLazySeq().filter(e=>e.completed_last_proc_machining===!0&&e.last_unload_time!==void 0&&e.last_unload_time>=t).toSortedArray({desc:e=>e.last_unload_time?.getTime()??0})},[e]).map((e,t)=>(0,H.jsx)(uW,{mat:e},t))})}var c4=(0,L.memo)(function({fillViewPort:e,showMaterial:t}){let n=p2({type:t?r2.CompletedExpandedMaterialZone:r2.CompletedCollapsedMaterialZone});return t&&e?(0,H.jsxs)(J,{ref:n,sx:{padding:`8px`,display:`flex`,flexDirection:`column`,height:`100%`},children:[(0,H.jsx)(q,{variant:`h4`,children:`Completed`}),(0,H.jsx)(J,{sx:{position:`relative`,flexGrow:1},children:(0,H.jsx)(J,{sx:{position:`absolute`,top:`0`,left:`0`,right:`0`,bottom:`0`,overflow:`auto`},children:(0,H.jsx)(s4,{})})})]}):t?(0,H.jsxs)(J,{ref:n,sx:{padding:`8px`},children:[(0,H.jsx)(q,{variant:`h4`,children:`Completed`}),(0,H.jsx)(s4,{})]}):(0,H.jsx)(J,{ref:n,sx:{display:`flex`,justifyContent:e?`flex-end`:void 0,padding:`8px`},children:(0,H.jsx)(q,{variant:`h4`,sx:{margin:`4px`,...e?{textOrientation:`mixed`,writingMode:`vertical-rl`}:{}},children:`Completed`})})});function l4({pallet:e}){let t=R(OI),n=R(jO),r=qI();if(t===null)return null;let i;if(t.action.type===st.Loading&&t.action.loadOntoPalletNum===e?i=`load`:(t.action.type===st.UnloadToInProcess||t.action.type===st.UnloadToCompletedMaterial)&&t.location.type===at.OnPallet&&t.location.palletNum===e&&(i=`unload`),i===void 0)return null;let a=$t(t.partName,i,t.materialID,e,t.action.type===st.Loading?t.action.processAfterLoad??t.process:t.process,n);return r?(0,H.jsx)(Y,{color:`primary`,children:`Instructions`}):(0,H.jsx)(Y,{href:a,target:`bms-instructions`,color:`primary`,children:`Instructions`})}function u4({queues:e,onClose:t,toQueue:n,showAddToQueue:r,setShowAddToQueue:i}){let a=z(SI),o=R(PI),s=R(TI),c=R(OI),l=R(jO),[u,d]=BI(),[f,p]=(0,L.useState)(null);return!s||!YU(c)||e.length===0||c?.location.type===at.InQueue&&c?.location.currentQueue&&e.includes(c?.location.currentQueue)?null:r?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(Y,{color:`primary`,disabled:n===null||d,onClick:async()=>{p(null);try{await u({materialId:s.materialID,queue:n??``,queuePosition:-1,operator:l}),a(null),t()}catch(e){p(Bt.isApiException(e)?e.response:e instanceof Error?e.message:String(e))}},children:[`Add To `,n??`Queue`,` `,o?` To Run Process ${o.process+1}`:``]}),f?(0,H.jsx)(q,{role:`alert`,children:f}):null]}):(0,H.jsx)(Y,{color:`primary`,onClick:()=>i(!0),children:`Add To Queue`})}function d4(){let e=R(br),t=z(K0),n=R(TI);return!e.allowChangeWorkorderAtLoadStation||n===null||n.materialID<0?null:(0,H.jsx)(Y,{color:`primary`,onClick:()=>t(!0),children:`Assign Workorder`})}var f4=(0,L.memo)(function(e){let[t,n]=(0,L.useState)(null),[r,i]=(0,L.useState)(null),[a,o]=(0,L.useState)(!1),[s,c]=(0,L.useState)(null),l=(0,L.useCallback)(function(){n(null),i(null),o(!1),c(null)},[n,i]);return(0,H.jsx)(TW,{onClose:l,allowNote:!0,highlightProcsGreaterOrEqualTo:r?.process??void 0,extraDialogElements:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(pX,{st:t,setState:n}),r===null?null:(0,H.jsx)(lX,{st:r,setState:i}),a?(0,H.jsx)(ZY,{selectedQueue:s,setSelectedQueue:c,queueNames:e.queues}):void 0]}),buttons:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(l4,{pallet:e.pallet}),(0,H.jsx)(FY,{}),(0,H.jsx)(iX,{}),(0,H.jsx)(aX,{onClose:l}),(0,H.jsx)(t2,{}),(0,H.jsx)(u4,{toQueue:s,queues:e.queues,onClose:l,showAddToQueue:a,setShowAddToQueue:o}),(0,H.jsx)(mX,{st:t,setState:n,onClose:l}),(0,H.jsx)(uX,{st:r,setState:i,onClose:l,loadStation:!0}),(0,H.jsx)(d4,{})]})})});function p4({numMatCols:e,maxNumFaces:t,horizontal:n,showMatInCompleted:r}){let i=``,a=``;if(t<=0&&(t=1),n){let n=``;for(let t=0;t<e;t++)a+=`minmax(16em, max-content) `,n+=`mat${t} `;a+=`1fr `,r?a+=`minmax(16em, max-content)`:a+=` 4.5em`;let o=`minmax(calc((100vh - 64px) / ${t}), max-content)`;for(let e=0;e<t;e++){let r=e===t-1?`1fr`:o;i+=`"${n} palface${e} completed" ${r}\n`}}else{a=`1fr`;for(let e=0;e<t;e++)i+=`"palface${e}" minmax(134px, max-content)\n`;for(let t=0;t<e;t++)i+=`"mat${t}" minmax(134px, max-content)\n`;i+=`"completed" minmax(134px, max-content)
|
|
350
|
-
`}return`${i} / ${a}`}function m4(e){let t=ok(R(br).basketName),n=t.endsWith(`s`)?t:`${t}s`,r=R(NO),i=R(Jq),a=(0,L.useMemo)(()=>e4(e.loadNum,e.queues,r,i),[r,e.loadNum,e.queues,i]),o=[...Q.of(a.queues).sortBy(([e,t])=>e).map(([e,t])=>({kind:`queue`,label:e,material:t})).toRArray()];if(a.baskets.size>0){let e=Q.of(a.baskets).filter(([e,t])=>e!==a.activeBasket?.basketId).sortBy(([e,t])=>e).map(([e,n])=>({basketId:e,label:`${t} ${e}`,material:n})).toRArray();e.length>0&&o.push({kind:`baskets`,label:n,baskets:e})}(a.queues.size===0&&a.baskets.size===0||a.freeLoadingMaterial.length>0)&&o.push({kind:`free`,label:`Material`,material:{mats:a.freeLoadingMaterial,hiddenCnt:0}});let s=o.length+ +!!e.completed,c=Jw(s<=1?`(min-width: 720px)`:s===2?`(min-width: 1030px)`:`(min-width: 1320px)`),l=p4({numMatCols:o.length,maxNumFaces:a.face.size,horizontal:c,showMatInCompleted:e.completed});return(0,H.jsx)(f2,{hideArrows:!c,whiteBackground:e.whiteBackground,children:(0,H.jsxs)(J,{component:`main`,sx:{width:`100%`,display:`grid`,gridTemplate:l,minHeight:{xs:`calc(100vh - 64px - 32px)`,sm:`calc(100vh - 64px - 40px)`,md:`calc(100vh - 64px)`},padding:c?void 0:`8px`},children:[o.map((e,t)=>(0,H.jsx)(J,{"data-testid":Q2(e),sx:{gridArea:`mat${t}`,padding:`8px`,borderRight:c?`1px solid black`:void 0,borderBottom:c?void 0:`1px solid black`},children:(0,H.jsx)(o4,{data:a,region:e})},t)),a.face.keysToAscLazySeq().map((t,n)=>(0,H.jsx)(J,{sx:{marginLeft:`15px`,gridArea:`palface${n}`,padding:`8px`,borderTop:a.pallet&&n!==0?`1px solid black`:void 0},children:(0,H.jsx)(r4,{data:a,faceNum:t,loadNum:e.loadNum,submitBasketLoadStationCommand:e.submitBasketLoadStationCommand})},t)),(0,H.jsx)(J,{"data-testid":`load-station-completed`,sx:{borderLeft:c?`1px solid black`:void 0,borderTop:c?void 0:`1px solid black`,gridArea:`completed`},children:(0,H.jsx)(c4,{fillViewPort:c,showMaterial:e.completed})}),(0,H.jsx)(t4,{loadData:a}),(0,H.jsx)(Z0,{}),(0,H.jsx)(n2,{}),(0,H.jsx)(f4,{pallet:a.pallet?.palletNum??null,queues:e.queues})]})})}function h4(e){let t=R(br);return JI(ik(e.loadNum,t.loadStationNames)),(0,H.jsx)(m4,{...e})}function g4(e){let t=qI(),n=R(jO),r=R(TI),i=R(PI)?.process,[a,o]=Eie(),s=z(SI);if(r===null)return null;function c(t){r&&(a({mat:r,inspType:e.inspection_type,success:t,operator:n}),s(null))}let l=$t(r.partName,e.inspection_type,r.materialID,null,i,n);return(0,H.jsxs)(H.Fragment,{children:[r.partName===``?void 0:t?(0,H.jsx)(Y,{color:`primary`,children:`Instructions`}):(0,H.jsx)(Y,{href:l,target:`bms-instructions`,color:`primary`,children:`Instructions`}),(0,H.jsx)(iX,{}),(0,H.jsx)(aX,{}),(0,H.jsxs)(Y,{color:`primary`,disabled:o,onClick:()=>c(!0),children:[`Mark `,e.inspection_type,` Success`]}),(0,H.jsxs)(Y,{color:`primary`,disabled:o,onClick:()=>c(!1),children:[`Mark `,e.inspection_type,` Failed`]})]})}function _4({focusInspectionType:e}){let t=R(FI);return t===null||e||t.signaledInspections.length===1?null:(0,H.jsx)(H.Fragment,{children:t.signaledInspections.map(e=>(0,H.jsx)(ly,{children:(0,H.jsx)(g4,{inspection_type:e})},e))})}function v4({focusInspectionType:e}){let t=R(FI),n;if(e)n=e;else if(t&&t.signaledInspections.length===1)n=t.signaledInspections[0];else return null;return(0,H.jsx)(g4,{inspection_type:n})}var y4=(0,L.memo)(function(e){return(0,H.jsx)(TW,{allowNote:!0,extraDialogElements:(0,H.jsx)(_4,{focusInspectionType:e.focusInspectionType}),buttons:(0,H.jsx)(v4,{focusInspectionType:e.focusInspectionType})})});function b4({focusInspectionType:e,forceSingleColumn:t}){let n=R(fL),r=(0,L.useMemo)(()=>S4(n.matsById,e),[n,e]);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(J,{sx:{display:t?void 0:{md:`flex`}},children:[(0,H.jsxs)(J,{sx:{padding:`8px`,minHeight:t?void 0:{md:`calc(100vh - 64px)`},width:t?`100%`:{md:`50vw`},borderRight:t?void 0:{md:`1px solid black`},borderBottom:t?`1px solid black`:{sm:`1px solid black`,md:`none`}},children:[(0,H.jsx)(q,{variant:`h4`,children:`Parts to Inspect`}),(0,H.jsx)(J,{sx:{display:`flex`,justifyContent:`flex-start`,flexWrap:`wrap`},children:r.waiting_to_inspect.map((t,n)=>(0,H.jsx)(uW,{mat:t,focusInspectionType:e,hideWarningIcon:!0},n))})]}),(0,H.jsxs)(J,{sx:{padding:`8px`,width:t?`100%`:{md:`50vw`}},children:[(0,H.jsx)(q,{variant:`h4`,children:`Recently Inspected`}),(0,H.jsx)(J,{sx:{display:`flex`,justifyContent:`flex-start`,flexWrap:`wrap`},children:r.inspect_completed.map((t,n)=>(0,H.jsx)(uW,{mat:t,focusInspectionType:e,hideWarningIcon:!0},n))})]})]}),(0,H.jsx)(y4,{focusInspectionType:e})]})}function x4(e){let t=e.completedInspections;return t===void 0?e.signaledInspections.length===0:Q.of(e.signaledInspections).every(e=>e in t)}function S4(e,t){let n=LT(new Date,-7),r=LT(new Date,-1),i=Array.from(t===null?e.valuesToLazySeq().filter(e=>e.last_unload_time!==void 0&&e.last_unload_time>=n&&e.signaledInspections.length>0&&!x4(e)):e.valuesToLazySeq().filter(e=>e.last_unload_time!==void 0&&e.last_unload_time>=n&&e.signaledInspections.includes(t)&&(e.completedInspections||{})[t]===void 0));i.sort((e,t)=>e.last_unload_time&&t.last_unload_time?t.last_unload_time.getTime()-e.last_unload_time.getTime():0);let a=Array.from(t===null?e.valuesToLazySeq().filter(e=>e.completed_inspect_time!==void 0&&e.completed_inspect_time>=r&&e.signaledInspections.length>0&&x4(e)):e.valuesToLazySeq().filter(e=>e.completed_inspect_time!==void 0&&e.completed_inspect_time>=r&&e.signaledInspections.includes(t)&&(e.completedInspections||{})[t]!==void 0));return a.sort((e,t)=>e.completed_inspect_time&&t.completed_inspect_time?t.completed_inspect_time.getTime()-e.completed_inspect_time.getTime():0),{waiting_to_inspect:i,inspect_completed:a}}function C4(e){return JI(e.focusInspectionType&&e.focusInspectionType!==``?`Inspection ${e.focusInspectionType}`:`Inspection`),(0,H.jsx)(J,{component:`main`,sx:{backgroundColor:`#F8F8F8`,minHeight:{sm:`calc(100vh - 64px - 40px)`,md:`calc(100vh - 64px)`}},children:(0,H.jsx)(b4,{...e})})}function w4(){let e=R(br),t=R(TI),[n,r]=LI(),i=R(jO),[a,o]=B(SI);if(t===null)return null;let s=e.requireScanAtCloseout,c=e.requireWorkorderBeforeAllowCloseoutComplete,l;s?a!==null&&(a.type===`Barcode`||a.type===`ManuallyEnteredSerial`)||(l=`Scan Required`):c&&(t.workorderId===void 0||t.workorderId===``)&&(l=`No workorder assigned`);function u(e){t!==null&&(n({mat:t,operator:i,failed:e}),o(null))}return l?(0,H.jsx)(X,{title:l,placement:`top`,children:(0,H.jsx)(`div`,{children:(0,H.jsx)(Y,{color:`primary`,disabled:!0,children:`Close Out`})})}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Y,{color:`primary`,disabled:r,onClick:()=>u(!0),children:`Fail Close Out`}),(0,H.jsx)(Y,{color:`primary`,disabled:r,onClick:()=>u(!1),children:`Pass Close Out`})]})}function T4(){let e=qI(),t=R(TI),n=R(jO),r=R(PI)?.process;if(t===null||t.partName===``)return null;let i=$t(t.partName,`closeout`,t.materialID,null,r,n);return e?(0,H.jsx)(Y,{color:`primary`,children:`Instructions`}):(0,H.jsx)(Y,{href:i,target:`bms-instructions`,color:`primary`,children:`Instructions`})}function E4(){let e=z(K0);return R(TI)===null?null:(0,H.jsx)(Y,{color:`primary`,onClick:()=>e(!0),children:`Assign Workorder`})}var D4=(0,L.memo)(function(){return(0,H.jsx)(TW,{allowNote:!0,buttons:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(T4,{}),(0,H.jsx)(iX,{}),(0,H.jsx)(aX,{}),(0,H.jsx)(E4,{}),(0,H.jsx)(w4,{})]})})}),O4=P(new Date);O4.onMount=e=>{e(new Date);let t=setInterval(()=>{e(new Date)},1e3*60);return()=>clearInterval(t)};function k4({forceSingleColumn:e}){let t=R(fL),n=R(O4),r=(0,L.useMemo)(()=>{let e=BT(n,-48),r=BT(n,-2),i=[],a=[];for(let n of t.matsById.values())n.completed_last_proc_machining===!0&&n.last_unload_time&&n.last_unload_time>=e&&(n.closeout_completed===void 0?i.push(n):n.closeout_completed>=r&&a.push(n));return i.sort((e,t)=>e.last_unload_time&&t.last_unload_time?e.last_unload_time.getTime()-t.last_unload_time.getTime():0),a.sort((e,t)=>e.last_unload_time&&t.last_unload_time?t.last_unload_time.getTime()-e.last_unload_time.getTime():0),{uncompleted:i,closed:a}},[t,n]);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(J,{sx:{display:e?void 0:{md:`flex`}},children:[(0,H.jsxs)(J,{sx:{padding:`8px`,minHeight:e?void 0:{md:`calc(100vh - 64px)`},width:e?`100%`:{md:`50vw`},borderRight:e?void 0:{md:`1px solid black`},borderBottom:e?`1px solid black`:{sm:`1px solid black`,md:`none`}},children:[(0,H.jsx)(q,{variant:`h4`,children:`Recently Completed`}),(0,H.jsx)(J,{sx:{display:`flex`,justifyContent:`flex-start`,flexWrap:`wrap`},children:r.uncompleted.map((e,t)=>(0,H.jsx)(uW,{mat:e},t))})]}),(0,H.jsxs)(J,{sx:{padding:`8px`,width:e?`100%`:{md:`50vw`}},children:[(0,H.jsx)(q,{variant:`h4`,children:`Recently Closed Out`}),(0,H.jsx)(J,{sx:{display:`flex`,justifyContent:`flex-start`,flexWrap:`wrap`},children:r.closed.map((e,t)=>(0,H.jsx)(uW,{mat:e},t))})]})]}),(0,H.jsx)(Z0,{}),(0,H.jsx)(D4,{})]})}function A4(){return JI(`Close Out`),(0,H.jsx)(J,{component:`main`,sx:{backgroundColor:`#F8F8F8`,minHeight:{sm:`calc(100vh - 64px - 40px)`,md:`calc(100vh - 64px)`}},children:(0,H.jsx)(k4,{})})}function j4(e,t){return e.mapValues(e=>{let n=Q.of(e.recentCycles).flatMap(e=>e.tools).filter(e=>!e.toolChangedDuringMiddleOfCycle).groupBy(e=>e.toolName).map(([e,t])=>({toolName:e,cycleUsageMinutes:Q.of(t).sumBy(e=>e.cycleUsageMinutes)/t.length,cycleUsageCnt:Q.of(t).sumBy(e=>e.cycleUsageCnt)/t.length,toolChangedDuringMiddleOfCycle:!1})).toMutableArray();return t&&n.sort((e,t)=>e.toolName.localeCompare(t.toolName)),{tools:n}})}var M4=class{constructor(e,t){this.statGroup=e,this.operation=t}compare(e){let t=this.statGroup.localeCompare(e.statGroup);return t===0?this.operation.localeCompare(e.operation):t}hash(){return yD(this.statGroup,this.operation)}toString(){return`{statGroup: ${this.statGroup}, operation: ${this.operation}}`}};function N4(e,t){let n=0,r=0;for(let i of Q.of(e).filter(e=>e.machines.has(t)??!1))n+=i.quantity*(i.scheduledUseMinutes/i.scheduledUseCnt),r+=i.quantity;return r===0?0:n/r}function P4(e,t,n){let r=iO.empty();for(let[t,n]of Q.ofObject(e.jobs)){let i=n.cycles??0;for(let a=0;a<n.procsAndPaths.length;a++){let o=0,s=iO.empty();for(let r=0;r<n.procsAndPaths[a].paths.length;r++){o+=n.completed?.[a]?.[r]??0;let i=n.procsAndPaths[a].paths[r];for(let n=0;n<i.stops.length;n+=1){let o=i.stops[n],c=Q.of(e.material).filter(e=>e.jobUnique===t&&e.process==a+1&&e.path===r+1&&(e.action.type===st.UnloadToCompletedMaterial||e.action.type===st.UnloadToInProcess||e.lastCompletedMachiningRouteStopIndex!==void 0&&e.lastCompletedMachiningRouteStopIndex>n)).length();o.program!==void 0&&o.program!==``&&(s=s.modify(new M4(o.stationGroup,o.program),e=>(e??0)+c))}}for(let[e,t]of s)r=r.modify(new VO(n.partName,e.statGroup,e.operation),e=>(e??0)+i-o-t)}}let i=Q.of(j4(n,!1)).flatMap(([e,t])=>{let i=window.bmsToolReportOverridePartQuantity??r.get(e);return i!==void 0&&i>0?t.tools.map(t=>({toolName:t.toolName,part:{partAndProg:e,quantity:i,scheduledUseMinutes:t.cycleUsageMinutes,scheduledUseCnt:t.cycleUsageCnt===0?1:t.cycleUsageCnt,machines:n.get(e)?.machines??QD.empty()}})):[]}).sortBy(e=>e.part.partAndProg.part,e=>e.part.partAndProg.operation).toLookup(e=>e.toolName,e=>e.part);return Q.of(t).orderedGroupBy(e=>e.toolName).map(([e,t])=>{let n=!1;return{toolName:e,machines:Q.of(t).sortBy(e=>e.machineGroupName,e=>e.machineNum,e=>e.pocket).map(t=>{let r=t.currentUse!==null&&t.currentUse!==void 0&&t.currentUse!==``?BO(t.currentUse):null,a=t.totalLifeTime!==null&&t.totalLifeTime!==void 0&&t.totalLifeTime!==``?BO(t.totalLifeTime):null,o=rk(t.machineGroupName,t.machineNum),s=t.currentUseCount??null,c=t.totalLifeCount??null;if(s===null&&c===null){let t=N4(i.get(e)??[],o);t>0&&(n=!0,s=r===null?null:r/t,c=a===null?null:a/t)}return{machineName:o,pocket:t.pocket,serial:t.serial,currentUseMinutes:r,lifetimeMinutes:a,remainingMinutes:r!==null&&a!==null?Math.max(0,a-r):null,currentUseCnt:s??null,lifetimeCnt:c??null,remainingCnt:s!==null&&c!==null?Math.max(0,c-s):null}}).toRArray(),parts:i.get(e)??[],estimatedToolCounts:n}}).toRArray()}var F4=P(null),I4=P(e=>e(F4)?.time??null,async(e,t,n)=>{t(F4,{tools:await Gt.getToolsInMachines(),time:n})}),L4=P(e=>{let t=e(F4);return t===null?[]:Q.of(t.tools).toOrderedSet(e=>rk(e.machineGroupName,e.machineNum)).toAscLazySeq().toRArray()}),R4=P(e=>{let t=e(F4);if(t===null)return null;let n=e(NO),r=e(RL);return P4(n,t.tools,r)}),z4=P(e=>{let t=e(R4);return t?Q.of(t).flatMap(e=>e.machines).some(e=>e.serial!=null&&e.serial!==``):!1}),B4=P(e=>{let t=e(R4);return t?Q.of(t).some(e=>e.estimatedToolCounts):!1});function V4(e){let t=Q.of(e).flatMap(e=>e.machines).some(e=>e.currentUseMinutes!=null),n=Q.of(e).flatMap(e=>e.machines).some(e=>e.currentUseCnt!=null),r=`<table>
|
|
349
|
+
</table>`,n}function m0(e,t){Ak(p0(e,t))}var h0=[{id:0,numeric:!1,label:`Date`,getDisplay:e=>e.time.toLocaleString(),getForSort:e=>e.time.getTime()},{id:1,numeric:!1,label:`Serial`,getDisplay:e=>e.serial||``},{id:2,numeric:!1,label:`Workorder`,getDisplay:e=>e.workorder||``},{id:3,numeric:!1,label:`Inspected`,getDisplay:e=>e.toInspect?`inspected`:``},{id:4,numeric:!1,label:`Failed`,getDisplay:e=>e.failed?`failed`:``}];function g0(e,t,n){let[r,i]=(0,L.useState)(void 0),a;return e&&e===`Last30Days`?a={type:`Last30Days`,set_days_back:e=>{if(e){let t=new Date;i({start:LT(t,-e),end:BT(t,1)})}else i(void 0)}}:e&&e===`ZoomIntoRange`?a={type:`ZoomIntoRange`,default_date_range:n,current_date_zoom:r,set_date_zoom_range:i}:e&&t&&e===`ExtendDays`&&(a={type:`ExtendDays`,curStart:n[0],curEnd:n[1],extend:t}),{zoom:a,zoomRange:r}}var _0=(0,L.memo)(function(e){let t=z(SI),n=f0(0,h0),[r,i]=(0,L.useState)(iO.empty()),[a,o]=(0,L.useState)(10),[s,c]=(0,L.useState)(void 0),l=g0(e.zoomType,e.extendDateRange,e.default_date_range),u=mZ(e.points,l.zoomRange,n.sortOn);return(0,H.jsx)(`div`,{style:{width:`100%`,marginTop:`1em`},children:Q.of(u).toSortedArray(([e])=>e).map(([u,d])=>{let f=Math.min(r.get(u)??0,Math.ceil(d.material.length/a));return(0,H.jsxs)(iee,{expanded:u===s,onChange:(e,t)=>c(t?u:void 0),children:[(0,H.jsxs)(pee,{expandIcon:(0,H.jsx)(aT,{}),children:[(0,H.jsx)(q,{variant:`h6`,style:{flexBasis:`33.33%`,flexShrink:0},children:u}),(0,H.jsxs)(q,{variant:`caption`,children:[d.material.length,` total parts, `,d.failedCnt,` failed`]})]}),(0,H.jsx)(cee,{children:(0,H.jsxs)(`div`,{style:{width:`100%`},children:[(0,H.jsxs)(jw,{children:[(0,H.jsx)(r0,{columns:h0,sort:n,showDetailsCol:!0}),(0,H.jsx)(l0,{columns:h0,pageData:Q.of(d.material).drop(f*a).take(a),rowsPerPage:a,onClickDetails:e.hideOpenDetailColumn?void 0:(e,n)=>t({type:`MatSummary`,summary:{materialID:n.materialID,partName:n.partName,serial:n.serial,workorderId:n.workorder}})})]}),(0,H.jsx)(c0,{tpage:{page:f,rowsPerPage:a,setPage:e=>i(r.set(u,e)),setRowsPerPage:o},count:d.material.length,zoom:l.zoom})]})})]},u)})})}),v0=20,y0=20,b0=120,x0=20;function S0({link:e,path:t,strokeWidth:n,setTooltip:r}){let[i,a]=(0,L.useState)(!1);if(t===null)return null;function o(t){let n=rA(t);n!==null&&(r({left:n.x,top:n.y,data:e}),a(!0))}function s(){a(!1),r(null)}return(0,H.jsx)(`path`,{d:t,stroke:i?Pr[600]:Pr[300],strokeWidth:n,opacity:.2,fill:`none`,onMouseMove:o,onMouseLeave:s})}function C0({node:e}){return e.x1===void 0||e.x0===void 0||e.y1===void 0||e.y0===void 0?null:(0,H.jsxs)(`g`,{transform:`translate(${e.x0}, ${e.y0})`,children:[(0,H.jsx)(`rect`,{width:e.x1-e.x0,height:e.y1-e.y0,fill:Pr[800],opacity:.8,stroke:`none`}),(0,H.jsx)(`text`,{x:18,y:(e.y1-e.y0)/2,children:e.name})]})}var w0=(0,L.memo)(function({data:e,setTooltip:t,parentHeight:n,parentWidth:r}){let{nodes:i,links:a}=(0,L.useMemo)(()=>{let t=rQ(e);if(t.nodes.length===0)return{nodes:[],links:[]};let i=FZ().nodeWidth(10).nodePadding(10).nodeAlign(wZ).extent([[v0,y0],[r-b0,n-x0-y0]])({nodes:t.nodes,links:t.links});return{nodes:i.nodes,links:i.links.flatMap(e=>typeof e.source==`object`&&typeof e.target==`object`&&e.width!==void 0?[{...e,source:e.source,target:e.target,width:e.width}]:[])}},[e,r,n]),o=$Z();return(0,H.jsxs)(`svg`,{width:r,height:n,children:[(0,H.jsx)(`g`,{children:i.map((e,t)=>(0,H.jsx)(C0,{node:e},t))}),(0,H.jsx)(`g`,{children:a.map((e,n)=>(0,H.jsx)(S0,{link:e,path:o(e),strokeWidth:Math.max(e.width??1,1),setTooltip:t},n))})]})});function T0({tooltip:e}){return e===null?null:(0,H.jsxs)(`div`,{children:[e.data.source.name,` ➞ `,e.data.target.name,`: `,e.data.value,` parts`]})}var E0=(0,L.memo)(function({data:e}){let t=(0,L.useMemo)(()=>P(null),[]),n=z(t);return(0,H.jsx)(`div`,{style:{position:`relative`},children:(0,H.jsx)(gA,{sx:{height:{xs:`calc(100vh - 230px)`,md:`calc(100vh - 182px)`,xl:`calc(100vh - 130px)`},width:`100%`},chart:({height:t,width:r})=>(0,H.jsx)(w0,{data:e,setTooltip:n,parentHeight:t,parentWidth:r}),tooltipAtom:t,TooltipContent:T0})})}),D0=vO(e=>e(GI)?`aaa`:void 0),O0=vO(e=>e(GI)?`CMM`:void 0),k0=P(!1);function A0(e){let[t,n]=B(D0),[r,i]=B(O0),[a,o]=B(k0),s,c=e.restrictToPart||t;c&&r&&(s=e.inspectionlogs.get(new oL(c,r))?.valuesToLazySeq()??[]);let l=e.inspectionlogs.keysToLazySeq().map(e=>e.part).distinct().toSortedArray(e=>e),u=e.inspectionlogs.keysToLazySeq().map(e=>e.inspType).distinct().toSortedArray(e=>e);return(0,H.jsxs)(J,{sx:{paddingLeft:`24px`,paddingRight:`24px`,paddingTop:`10px`},children:[(0,H.jsxs)(J,{component:`nav`,sx:{display:`flex`,minHeight:`2.5em`,alignItems:`center`,maxWidth:`calc(100vw - 24px - 24px)`},children:[e.subtitle?(0,H.jsx)(q,{variant:`subtitle1`,children:e.subtitle}):void 0,(0,H.jsx)(J,{sx:{flexGrow:1}}),e.onlyTable?void 0:(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,value:a?`table`:`sankey`,onChange:e=>o(e.target.value===`table`),children:[(0,H.jsx)(Hx,{value:`sankey`,children:`Sankey`},`sankey`),(0,H.jsx)(Hx,{value:`table`,children:`Table`},`table`)]})}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{name:`inspection-sankey-select-type`,autoWidth:!0,displayEmpty:!0,style:{marginRight:`1em`,marginLeft:`1em`},value:r||``,onChange:e=>i(e.target.value),children:[r?void 0:(0,H.jsx)(Hx,{value:``,children:(0,H.jsx)(`em`,{children:`Select Inspection Type`})},0),u.map(e=>(0,H.jsx)(Hx,{value:e,children:e},e))]})}),e.restrictToPart===void 0?(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{name:`inspection-sankey-select-part`,autoWidth:!0,displayEmpty:!0,value:c||``,onChange:e=>n(e.target.value),children:[c?void 0:(0,H.jsx)(Hx,{value:``,children:(0,H.jsx)(`em`,{children:`Select Part`})},0),l.map(e=>(0,H.jsx)(Hx,{value:e,children:(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(ZU,{part:e,size:30}),(0,H.jsx)(`span`,{style:{marginRight:`1em`},children:e})]})},e))]})}):void 0,s?(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{onClick:()=>s?vZ(c||``,r||``,s):void 0,style:{height:`25px`,paddingTop:0,paddingBottom:0},size:`large`,children:(0,H.jsx)(uT,{})})}):void 0]}),(0,H.jsx)(`main`,{children:s?a||e.onlyTable?(0,H.jsx)(_0,{zoomType:e.zoomType,points:s,default_date_range:e.default_date_range,extendDateRange:e.extendDateRange,hideOpenDetailColumn:e.hideOpenDetailColumn}):(0,H.jsx)(E0,{data:s}):void 0})]})}var j0=P(null),M0=OO(P(async(e,{signal:t})=>{let n=e(j0);if(n==null||Wt===void 0)return iO.empty();let r=await Wt.get(n.curStart,n.curEnd,t);return Q.of(r).flatMap(uL).filter(e=>e.key.part===n.part).toLookupMap(e=>e.key,e=>e.entry.cntr,e=>e.entry)}),e=>e??iO.empty()),N0=OO(P(async e=>{let t=e(j0);if(t==null)return iO.empty();let n=[];for(let e of qt)n.push(await e.get(t.curStart,t.curEnd));return Q.of(n).flatMap(e=>e).flatMap(uL).filter(e=>e.key.part===t.part).toLookupMap(e=>e.key,e=>e.entry.cntr,e=>e.entry)}),e=>e??iO.empty()),P0=P(e=>iO.union((e,t)=>e.union(t),e(M0),e(N0)));function F0(e){return t=>t===null?null:e<0?{curStart:LT(t.curStart,e),curEnd:t.curEnd,part:t.part}:{curStart:t.curStart,curEnd:LT(t.curEnd,e),part:t.part}}var I0=[{id:0,numeric:!1,label:`Date`,getDisplay:e=>e.time.toLocaleString(),getForSort:e=>e.time.getTime()},{id:1,numeric:!1,label:`Part`,getDisplay:e=>e.part},{id:2,numeric:!1,label:`Inspection`,getDisplay:e=>e.inspType},{id:3,numeric:!1,label:`Serial`,getDisplay:e=>e.serial||``},{id:4,numeric:!1,label:`Workorder`,getDisplay:e=>e.workorder||``}];function L0(e){let t=qI(),n=f0(0,I0),r=d0(),i=z(SI),a=Math.min(r.page,Math.ceil(e.failed.length/r.rowsPerPage)),o=Q.of(e.failed).sortBy(n.sortOn);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(jw,{children:[(0,H.jsx)(r0,{columns:I0,sort:n,showDetailsCol:!t}),(0,H.jsx)(l0,{columns:I0,pageData:o.drop(a*r.rowsPerPage).take(r.rowsPerPage),rowsPerPage:r.rowsPerPage,onClickDetails:t?void 0:(e,t)=>{i({type:`MatSummary`,summary:{materialID:t.materialID,partName:t.part,serial:t.serial,workorderId:t.workorder}})}})]}),(0,H.jsx)(c0,{tpage:{...r,page:a},count:e.failed.length})]})}function R0(){let e=R(cL),t=(0,L.useMemo)(()=>{let t=cE();return hZ(Q.of(e).flatMap(([e,t])=>t.valuesToLazySeq()),LT(t,-4),LT(t,1))},[e]);return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(J,{component:`nav`,sx:{display:`flex`,minHeight:`2.5em`,alignItems:`center`,maxWidth:`calc(100vw - 24px - 24px)`},children:[(0,H.jsx)(q,{variant:`subtitle1`,children:`Inspections marked as failed in the last 5 days`}),(0,H.jsx)(J,{sx:{flexGrow:1}}),(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{style:{height:`25px`,paddingTop:0,paddingBottom:0},onClick:()=>bZ(t),size:`large`,children:(0,H.jsx)(uT,{})})})]}),(0,H.jsx)(L0,{failed:t})]})}function z0(){let e=qI(),t=z(SI),[n,r]=(0,L.useState)(e?`00000000i9`:``),[i,a]=(0,L.useState)(!1),[o,s]=(0,L.useState)(null);function c(){n&&n!==``&&(a(!0),s(null),Wt.materialForSerial(n).then(e=>{let i=Q.of(e).maxBy(e=>e.materialID);i?(t({type:`MatDetails`,details:i}),r(``),s(null)):s(`No material found with serial `+n)}).catch(e=>{Bt.isApiException(e)?s(e.response):e instanceof Error?s(e.message):s(e)}).finally(()=>a(!1)))}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(RC,{direction:`row`,spacing:2,sx:{alignItems:`center`,marginLeft:`auto`,marginRight:`auto`},children:[(0,H.jsx)(`div`,{children:(0,H.jsx)(Kw,{label:n===``?`Serial`:`Serial (press enter)`,value:n,onChange:e=>r(e.target.value),onKeyPress:e=>{e.key===`Enter`&&n!==``&&(e.preventDefault(),c())}})}),(0,H.jsx)(`div`,{children:(0,H.jsx)(Y,{variant:`contained`,color:`secondary`,disabled:n===``||i,onClick:c,children:i?(0,H.jsxs)(RC,{direction:`row`,spacing:2,children:[(0,H.jsx)(Lm,{}),` Searching`]}):(0,H.jsx)(H.Fragment,{children:`Lookup`})})})]}),o&&o!==``?(0,H.jsx)(`div`,{children:o}):void 0]})}function B0(e){let t=e[0];if(t===void 0)return cE();let n=t.endUTC;for(let t of e)t.type===V.MachineCycle&&(n=t.endUTC);return n}function V0(){let e=R(EI),t=R(NI);return e?(0,H.jsx)(gW,{partName:e.partName,serial:e.serial,subtitle:`Path `+pZ(gZ(t))+` at `+B0(t).toLocaleString()}):(0,H.jsx)(`div`,{children:`Serial Details`})}function H0({setStep:e}){let t=R(EI),n=R(NI),r=z(j0),i=z(SI);return(0,H.jsxs)(RC,{direction:`row`,spacing:2,sx:{mt:`2em`},children:[t?(0,H.jsx)(Y,{variant:`contained`,color:`secondary`,onClick:()=>{let i=B0(n);r({part:t?.partName??``,curStart:KT(LT(i,-5)),curEnd:iE(LT(i,5))}),e(2)},children:`Lookup Similar Paths`}):void 0,(0,H.jsx)(Y,{variant:`contained`,style:{marginLeft:`2em`},onClick:()=>{i(null),r(null),e(0)},children:`Reset`})]})}function U0(e){let t=R(TI),n=R(NI),[r,i]=B(j0),a=R(P0),o=z(SI);if(t===null)return null;function s(e){i(F0(e))}return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(A0,{inspectionlogs:a,restrictToPart:t.partName,subtitle:`Paths for `+t.partName+` around `+B0(n).toLocaleString(),default_date_range:r?[r.curStart,r.curEnd]:[],zoomType:r?`ExtendDays`:void 0,extendDateRange:s,hideOpenDetailColumn:!0,onlyTable:!0}),(0,H.jsx)(Y,{variant:`contained`,style:{marginTop:`2em`},onClick:()=>{o(null),i(null),e.setStep(0)},children:`Reset`})]})}function W0(){let[e,t]=(0,L.useState)(0),n=R(SI),r=e;return r===0&&n&&(r=1),(0,H.jsxs)(RC,{direction:`column`,spacing:2,children:[(0,H.jsxs)(Tw,{activeStep:r,orientation:`horizontal`,children:[(0,H.jsx)(GC,{children:(0,H.jsx)(cw,{children:`Select Material`})}),(0,H.jsx)(GC,{children:(0,H.jsx)(cw,{children:(0,H.jsx)(V0,{})})}),(0,H.jsx)(GC,{children:(0,H.jsx)(cw,{children:`Lookup similar paths`})})]}),r===0?(0,H.jsxs)(RC,{direction:`column`,spacing:4,children:[(0,H.jsx)(q,{children:`Enter a serial number, scan a barcode, or click on a material in the table below to see details.`}),(0,H.jsx)(z0,{}),(0,H.jsx)(R0,{})]}):r===1?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(BU,{fallback:(0,H.jsx)(wW,{}),children:(0,H.jsx)(SW,{})}),(0,H.jsx)(H0,{setStep:t})]}):r===2?(0,H.jsx)(BU,{children:(0,H.jsx)(U0,{setStep:t})}):void 0]})}function G0(){return JI(`Quality Material`),(0,H.jsx)(`main`,{style:{padding:`24px`},children:(0,H.jsx)(W0,{})})}var K0=(0,L.memo)(function(){JI(`Paths`);let e=R(cL);return(0,H.jsx)(A0,{inspectionlogs:(0,L.useMemo)(()=>{let t=cE(),n=LT(t,-6),r=LT(t,1);return e.collectValues(e=>{let t=e.filter(e=>e.time>=n&&e.time<=r);return t.size===0?null:t})},[e]),default_date_range:[LT(cE(),-6),LT(cE(),1)],subtitle:`Paths from the last 7 days`})}),q0=P(!1);function J0(e){let t=``;return e.comments&&e.comments.length>0&&(t=`; `+e.comments[e.comments.length-1].comment),`Due ${e.dueDate.toLocaleDateString()}; Completed ${e.completedQuantity} of ${e.plannedQuantity}${t}`}function Y0({work:e}){return e.plannedQuantity<=e.completedQuantity?(0,H.jsx)($w,{}):(0,H.jsx)(xT,{})}function X0(){let[e,t]=(0,L.useState)(null),n=R(TI),[r]=RI(),i=z(q0);return(0,H.jsx)(Kw,{sx:{mt:`5px`},label:e===null||e===``?`Workorder`:`Workorder (press enter)`,value:e??``,onChange:e=>t(e.target.value),onKeyPress:t=>{t.key===`Enter`&&n&&e&&e!==``&&(t.preventDefault(),r(n,e),i(!1))}})}function eae(){let e=R(TI),t=R(Tie),n=z(q0),[r]=RI();return(0,H.jsx)(pb,{children:(t??[]).map(t=>(0,H.jsx)(Db,{children:(0,H.jsxs)(vb,{onClick:()=>{e&&r(e,t.workorderId),n(!1)},children:[(0,H.jsx)(Mb,{children:(0,H.jsx)(Y0,{work:t})}),(0,H.jsx)(Lb,{primary:t.workorderId,secondary:J0(t)})]})},t.workorderId))})}var Z0=(0,L.memo)(function(){let[e,t]=B(q0),n;return n=e?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(dy,{children:`Select Workorder`}),(0,H.jsx)(uy,{children:(0,H.jsxs)(BU,{children:[(0,H.jsx)(X0,{}),(0,H.jsx)(eae,{})]})}),(0,H.jsx)(ly,{children:(0,H.jsx)(Y,{onClick:()=>t(!1),color:`primary`,children:`Cancel`})})]}):(0,H.jsx)(`p`,{children:`None`}),(0,H.jsx)(cy,{open:e,onClose:()=>t(!1),maxWidth:`md`,children:n})}),Q0=P(!1);function $0(){let[e,t]=(0,L.useState)(null),n=R(TI),[r]=II(),i=z(Q0);return(0,H.jsx)(Kw,{sx:{mt:`5px`},label:e===``||e===null?`Inspection Type`:`Inspection Type (press enter)`,value:e??``,onChange:e=>t(e.target.value),onKeyPress:t=>{t.key===`Enter`&&n&&e&&e!==``&&(t.preventDefault(),r({mat:n,inspType:e,inspect:!0}),i(!1))}})}function e2(){let e=R(TI),[t]=II(),n=R(kL),r=Q.of(n).sortBy(e=>e),i=z(Q0);return e===null?null:(0,H.jsx)(pb,{children:r.map(n=>(0,H.jsx)(Db,{children:(0,H.jsxs)(vb,{onClick:()=>{t({mat:e,inspType:n,inspect:!0}),i(!1)},children:[(0,H.jsx)(Mb,{children:(0,H.jsx)(bT,{})}),(0,H.jsx)(Lb,{primary:n})]})},n))})}function t2(){let e=z(Q0),t=R(OI);return t===null||t.materialID<0?null:(0,H.jsx)(Y,{color:`primary`,onClick:()=>e(!0),children:`Signal Inspection`})}var n2=(0,L.memo)(function(){let[e,t]=B(Q0),n;return n=e?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(dy,{children:`Select Inspection Type`}),(0,H.jsx)(uy,{children:(0,H.jsxs)(BU,{children:[(0,H.jsx)($0,{}),(0,H.jsx)(e2,{})]})}),(0,H.jsx)(ly,{children:(0,H.jsx)(Y,{onClick:()=>t(!1),color:`primary`,children:`Cancel`})})]}):(0,H.jsx)(`p`,{children:`None`}),(0,H.jsx)(cy,{open:e,onClose:()=>t(!1),maxWidth:`md`,children:n})}),r2=function(e){return e[e.Material=0]=`Material`,e[e.FreeMaterialZone=1]=`FreeMaterialZone`,e[e.CompletedCollapsedMaterialZone=2]=`CompletedCollapsedMaterialZone`,e[e.CompletedExpandedMaterialZone=3]=`CompletedExpandedMaterialZone`,e[e.PalletFaceZone=4]=`PalletFaceZone`,e[e.QueueZone=5]=`QueueZone`,e[e.BasketZone=6]=`BasketZone`,e[e.BasketSlotZone=7]=`BasketSlotZone`,e}({});function i2(e){switch(e.type){case 0:return`Material-`+(e.identifier??(e.material?.materialID??-1).toString());case 1:return`FreeMaterialZone`;case 2:return`CompletedCollapsedMaterialZone`;case 3:return`CompletedExpandedMaterialZone`;case 4:return`PalletFaceZone-`+e.face.toString();case 5:return`QueueZone-`+e.queue;case 6:return`BasketZone-`+e.basketId.toString();case 7:return`BasketSlotZone-${e.basketId}-${e.slot}`}}function a2(e){switch(e.type){case 0:return[e.type,e.material,e.identifier];case 1:case 2:case 3:return[e.type,null];case 4:return[e.type,e.face];case 5:return[e.type,e.queue];case 6:return[e.type,e.basketId];case 7:return[e.type,e.basketId,e.slot]}}function o2(e){let t,n,r=new Map,i=new Map,a=new Map,o=new Map,s=[];for(let c of e.values())switch(c.type){case 1:t=c.elem;break;case 2:case 3:n=c.elem;break;case 4:r.set(c.face,c.elem);break;case 5:i.set(c.queue,c.elem);break;case 6:a.set(c.basketId,c.elem);break;case 7:o.set(`${c.basketId}:${c.slot}`,c.elem);break;case 0:c.material&&s.push([c.elem,c.material]);break}return{freeMaterial:t,completedMaterial:n,faces:r,queues:i,baskets:a,basketSlots:o,material:s}}function s2(e,t){if(!e)return[];let n=o2(t);if(!n.completedMaterial)return[];let r=[],i=new Map,a=new Map,o=new Map,s=0;for(let[t,c]of Q.of(n.material).sortBy(([e])=>e.left,([e])=>e.top))switch(c.action.type){case st.UnloadToCompletedMaterial:case st.UnloadToInProcess:if(c.action.unloadToBasketId){let i=n.baskets.get(c.action.unloadToBasketId),a=o.get(c.action.unloadToBasketId)??0;o.set(c.action.unloadToBasketId,a+1),r.push({fromX:t.left,fromY:t.top+t.height/2,toX:i===void 0?e.left+2:i.right-5,toY:i===void 0?t.top+t.height/2:i.top+20*(a+1),curveDirection:1})}else if(c.action.type===st.UnloadToCompletedMaterial&&(!c.action.unloadIntoQueue||c.action.unloadIntoQueue===``))r.push({fromX:t.right,fromY:t.top+t.height/2,toY:t.top+t.height/2,toX:n.completedMaterial?n.completedMaterial.left+2:e.right-10,curveDirection:1});else{let i,o;c.action.unloadIntoQueue?(i=n.queues.get(c.action.unloadIntoQueue),o=a.get(c.action.unloadIntoQueue)??0,a.set(c.action.unloadIntoQueue,o+1)):(i=n.freeMaterial,o=s,s+=1),r.push({fromX:t.left,fromY:t.top+t.height/2,toX:i===void 0?e.left+2:i.right-5,toY:i===void 0?t.top+t.height/2:i.top+20*(o+1),curveDirection:1})}break;case st.Loading:if(c.action.loadFromBasketId&&c.action.loadOntoFace){let e=n.faces.get(c.action.loadOntoFace);if(e!==void 0){let n=i.get(c.action.loadOntoFace)??0;i.set(c.action.loadOntoFace,n+1),r.push({fromX:t.right,fromY:t.top+t.height/2,toX:e.left+20,toY:e.top+50+20*n,curveDirection:-1})}}else if(c.action.loadFromBasketId){let i=n.baskets.get(c.action.loadFromBasketId),a=o.get(c.action.loadFromBasketId)??0;o.set(c.action.loadFromBasketId,a+1),r.push({fromX:t.right,fromY:t.top+t.height/2,toX:i===void 0?e.right-10:i.left+20,toY:i===void 0?t.top+t.height/2:i.top+50+20*a,curveDirection:-1})}else if(c.action.loadOntoFace)if(c.location.type===at.OnPallet)if(c.location.palletNum===c.action.loadOntoPalletNum&&c.location.face===c.action.loadOntoFace)r.push({fromX:t.right,fromY:t.top+t.height*3/4,toX:t.left+t.width*7/8,toY:t.bottom,curveDirection:-1});else{let e=n.faces.get(c.action.loadOntoFace);e&&(c.action.loadOntoFace<(c.location.face??0)?r.push({fromX:t.left,fromY:t.top+t.height/2,toX:t.left,toY:e.bottom+20,curveDirection:-1}):r.push({fromX:t.left,fromY:t.top+t.height/2,toX:t.left,toY:e.top-20,curveDirection:1}))}else{let e=n.faces.get(c.action.loadOntoFace);if(e!==void 0){let n=i.get(c.action.loadOntoFace)??0;i.set(c.action.loadOntoFace,n+1),r.push({fromX:t.right,fromY:t.top+t.height/2,toX:e.left+20,toY:e.top+50+20*n,curveDirection:-1})}}break;case st.LoadingToBasket:{let i=c.action.loadToBasketId;if(i===void 0)break;let a=c.action.loadToBasketSlot===void 0?n.baskets.get(i):n.basketSlots.get(`${i}:${c.action.loadToBasketSlot}`)??n.baskets.get(i),s=o.get(i)??0;o.set(i,s+1),r.push({fromX:t.right,fromY:t.top+t.height/2,toX:a===void 0?e.right-10:a.left+20,toY:a===void 0?t.top+t.height/2:a.top+50+20*s,curveDirection:-1});break}}return r.map(t=>({fromX:t.fromX-e.left,fromY:t.fromY-e.top,toX:t.toX-e.left,toY:t.toY-e.top,curveDirection:t.curveDirection}))}function c2(e){let t=e.getBoundingClientRect();return{left:t.left+window.scrollX,top:t.top+window.scrollY,width:t.width,height:t.height,bottom:t.bottom+window.scrollY,right:t.right+window.scrollX}}function l2(e){let t=(e.fromX+e.toX)/2,n=(e.fromY+e.toY)/2,r=Math.atan2(e.toY-e.fromY,e.toX-e.fromX)+Math.PI*e.curveDirection/2,i=t+50*Math.cos(r),a=n+50*Math.sin(r);return`M${e.fromX},${e.fromY} Q ${i} ${a} ${e.toX} ${e.toY}`}var u2=(0,L.memo)(function({container:e,arrowsWithRefs:t}){let[,n]=(0,L.useState)({height:window.innerHeight,width:window.innerWidth});return(0,L.useEffect)(()=>{function e(){n({height:window.innerHeight,width:window.innerWidth})}return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[n]),(0,H.jsx)(`g`,{children:s2(e.current?c2(e.current):null,t.collectValues(e=>e.elem.current?{...e,elem:c2(e.elem.current)}:null)).map((e,t)=>(0,H.jsx)(`path`,{style:{fill:`none`,stroke:`rgba(0,0,0,0.15)`,strokeWidth:2},d:l2(e),markerEnd:`url(#arrow)`},t))})}),d2=(0,L.createContext)(void 0),f2=(0,L.memo)(function({children:e,hideArrows:t,whiteBackground:n}){let r=(0,L.useRef)(null),[i,a]=(0,L.useState)(iO.empty()),o=(0,L.useMemo)(()=>({registerNode(e,t,n){a(t&&n?r=>r.set(e,{...t,elem:n}):t=>t.delete(e))}}),[a]);return(0,H.jsxs)(`div`,{style:{position:`relative`},children:[(0,H.jsxs)(`svg`,{style:{position:`absolute`,pointerEvents:`none`,width:`100%`,height:`100%`,top:0,right:0,zIndex:-1,backgroundColor:n?`white`:`#F8F8F8`},children:[(0,H.jsx)(`defs`,{children:(0,H.jsx)(`marker`,{id:`arrow`,markerWidth:6,markerHeight:10,refX:`0`,refY:`3`,orient:`auto`,markerUnits:`strokeWidth`,children:(0,H.jsx)(`path`,{d:`M0,0 L0,6 L5,3 z`,fill:`rgba(0,0,0,0.15)`})})}),t?void 0:(0,H.jsx)(u2,{container:r,arrowsWithRefs:i})]}),(0,H.jsx)(`div`,{ref:r,children:(0,H.jsx)(d2.Provider,{value:o,children:e})})]})});function p2(e){let t=(0,L.useContext)(d2);if(!t)throw Error(`useMoveMaterialArrowRef must be used within a MoveMaterialArrowContainer`);let n=(0,L.useRef)(null);return(0,L.useEffect)(()=>{let r=i2(e);return t.registerNode(r,e,n),()=>{t.registerNode(r,null,null)}},[t,...a2(e)]),n}function m2({kind:e,children:t}){return(0,H.jsx)(`div`,{ref:p2(e),"data-move-material-identifier":i2(e),children:t})}var h2=45,g2=55;function _2(){let e=R(NO),t=R(sO),n=R(br),r=Q.of(e.material).filter(e=>e.location.type===at.OnPallet||e.action.type===st.Loading).toRLookup(e=>e.location.palletNum??e.action.loadOntoPalletNum??0),i=Q.of(e.material).filter(e=>e.location.type===at.InBasket&&e.location.basketId!==null&&e.location.basketId!==void 0||e.action.type===st.LoadingToBasket&&e.action.loadToBasketId!==null&&e.action.loadToBasketId!==void 0).toRLookup(e=>e.location.basketId??e.action.loadToBasketId??0),a=Q.ofObject(e.pallets).filter(([e,t])=>t.currentPalletLocation.loc===nt.LoadUnload).toOrderedMap(([e,t])=>[t.currentPalletLocation.num,{lulNum:t.currentPalletLocation.num,pal:{pallet:t,mats:r.get(t.palletNum)??[]},basket:null,staging:[],sources:[]}]),o=Q.ofObject(e.pallets).filter(([,e])=>e.currentPalletLocation.loc===nt.Machine||e.currentPalletLocation.loc===nt.MachineQueue).map(([e,t])=>t).groupBy(e=>e.currentPalletLocation.group,e=>e.currentPalletLocation.num).toLookupOrderedMap(([[e,t],n])=>e,([[e,t],n])=>t,([[t,n],i])=>{let a=i.find(e=>e.currentPalletLocation.loc===nt.Machine),o=a?r.get(a.palletNum)??[]:null,s=i.find(e=>e.currentPalletLocation.loc===nt.MachineQueue),c=s?r.get(s.palletNum)??[]:null,l=!0,u=c?.[0];if(u&&u.lastCompletedMachiningRouteStopIndex!==null&&u.lastCompletedMachiningRouteStopIndex!==void 0){let r=e.jobs[u.jobUnique]?.procsAndPaths?.[u.process-1]?.paths?.[u.path-1]?.stops?.[u.lastCompletedMachiningRouteStopIndex];r.stationGroup===t&&r.stationNums.includes(n)&&(l=!1)}return l?{name:t+` `+n.toString(),inbound:s?{pallet:s,mats:c??[]}:null,worktable:a?{pallet:a,mats:o??[]}:null,outbound:null}:{name:t+` `+n.toString(),inbound:null,worktable:a?{pallet:a,mats:o??[]}:null,outbound:s?{pallet:s,mats:c??[]}:null}}),s=Q.ofObject(e.pallets).filter(([e,t])=>t.currentPalletLocation.loc===nt.Buffer||t.currentPalletLocation.loc===nt.Cart).collect(([e,t])=>{let n=r.get(t.palletNum);return!n||n.length===0?null:{pallet:t,mats:n}}).toOrderedMap(e=>[e.pallet.palletNum,e]),c=1,l=1,u=LT(new Date,-7),d=t.valuesToLazySeq().filter(e=>e.routeEndUTC>u).concat(Q.ofObject(e.jobs).map(([e,t])=>t)).flatMap(e=>e.procsAndPaths).toRArray();for(let e of d)for(let t of(e.basketLoadStations??[]).concat(e.basketUnloadStations??[]))c=Math.max(c,t);let f=Q.of(d).flatMap(e=>e.paths);for(let e of f){for(let t of e.load.concat(e.unload))c=Math.max(c,t);e.face&&(l=Math.max(l,e.face));for(let t of e.stops)o=o.alter(t.stationGroup,e=>{e??=eO.empty();for(let n of t.stationNums)e=e.alter(n,e=>e||{name:t.stationGroup+` `+n.toString(),inbound:null,worktable:null,outbound:null});return e})}for(let e=1;e<=c;e++)a=a.alter(e,t=>t||{lulNum:e,pal:null,basket:null,staging:[],sources:[]});for(let t of Object.values(e.pallets))l=Math.max(l,t.numFaces);for(let t of e.material)t.location.face!==null&&t.location.face!==void 0&&(l=Math.max(l,t.location.face));let p=eO.empty();if(e.machineLocations&&e.machineLocations.length>0)for(let t of e.machineLocations){o=o.alter(t.machineGroup,e=>{if(!e||t.machineNum===void 0)return e;let n=e.delete(t.machineNum);if(n.size!==0)return n});for(let n of t.possibleLoadStations){let r;a=a.alter(n,e=>{r=e});let i=Q.of(r?.pal?.mats??[]).toLookup(n=>{if(n.action.type===st.Machining)return`Machining`;if(n.action.type!==st.Waiting)return`Loading`;if(n.lastCompletedMachiningRouteStopIndex!==null&&n.lastCompletedMachiningRouteStopIndex!==void 0){let r=e.jobs[n.jobUnique]?.procsAndPaths?.[n.process-1]?.paths?.[n.path-1]?.stops?.[n.lastCompletedMachiningRouteStopIndex];if(!r||r.stationGroup===t.machineGroup&&r.stationNums.includes(t.machineNum))return`Loading`}return`Ready`}),o={lulNum:n,machineMoving:t.moving,machineCurrentlyAtLoad:n===t.currentLoadStation?{group:t.machineGroup,num:t.machineNum}:null,readyMats:i.get(`Ready`)??[],machiningMats:i.get(`Machining`)??[],loadingMats:i.get(`Loading`)??[]};p=p.set(n,o)}}let m=new Map,h=new Map,g=new Map,_=0,v=0;for(let t of Q.ofObject(e.baskets??{}).map(([e,t])=>t).sortBy(e=>e.basketId)){let e={basket:t,mats:i.get(t.basketId)??[]};switch(t.position.location){case _t.Storage:e.mats.length>0?v+=1:_+=1;break;case _t.LoadUnload:case _t.LoadStationStaging:{let n=t.position.locationNum;if(n===null){g.set(t.basketId,e);break}let r=t.position.location===_t.LoadUnload?h:m,i=r.get(n)??[];i.push(e),r.set(n,i);break}case _t.InTransit:g.set(t.basketId,e);break}}let y=0,b=0;return a=a.mapValues(e=>{let t=new Map,r=Q.of(e.pal?.mats??e.basket?.mats??[]).filter(e=>e.location.type!==at.OnPallet).toRArray();for(let e of r){if(e.location.type===at.Free){let n=`free`,r=t.get(n)??{label:`To Load`,mats:[]};r.mats.push(e),t.set(n,r);continue}if(e.action.loadFromBasketId!==null&&e.action.loadFromBasketId!==void 0){let r=`basket:${e.action.loadFromBasketId}`,i=t.get(r)??{label:`From ${ok(n.basketName)} ${e.action.loadFromBasketId}`,mats:[]};i.mats.push(e),t.set(r,i);continue}if(e.location.type===at.InQueue&&e.location.currentQueue){let n=`queue:${e.location.currentQueue}`,r=t.get(n)??{label:`From ${e.location.currentQueue}`,mats:[]};r.mats.push(e),t.set(n,r)}}let i=Q.of(h.get(e.lulNum)??[]).sortBy(e=>e.basket.position.locationNum).toRArray();for(let e of i.slice(1))g.set(e.basket.basketId,e);let a=new Set(Q.of(e.pal?.mats??[]).collect(e=>e.action.loadFromBasketId??null).toRArray()),o=Q.of(m.get(e.lulNum)??[]).filter(e=>!a.has(e.basket.basketId)).sortBy(e=>e.basket.position.locationNum).toRArray();y=Math.max(y,o.length);let s=Q.of(t).map(([e,t])=>({key:e,label:t.label,mats:t.mats})).sortBy(e=>e.label).toRArray();return b=Math.max(b,s.length),{...e,basket:i[0]??null,staging:o,sources:s}}),{machines:o.mapValues(e=>e.valuesToAscLazySeq().toRArray()),loads:a.valuesToAscLazySeq().toRArray(),stockerPals:s.valuesToAscLazySeq().toRArray(),floatingBaskets:Q.of(g.values()).toRArray(),storageBaskets:_+v>0?{empty:_,filled:v}:null,machineAtLoad:p.valuesToAscLazySeq().toRArray(),maxNumFacesOnPallet:l,maxNumStagingRows:y,maxNumSourceRows:b}}function v2({mats:e}){let[t,n]=(0,L.useState)(!1),r=(0,L.useRef)(null),i=(0,L.useRef)(null),[a,o]=(0,L.useState)(!1),s=z(SI),c=R(NO);function l(){r.current!==null&&(clearTimeout(r.current),r.current=null),n(!0)}function u(){r.current=setTimeout(()=>{n(!1),r.current=null},200)}function d(){e.length===1?s({type:`MatDetails`,details:e[0]}):o(!0)}function f(e,t){return t==null?null:(e!=null&&e!=null?c.pallets[e]?.faceNames?.[t-1]:null)??`Face: `+t.toString()}return(0,H.jsxs)(J,{sx:{width:h2,height:h2,overflow:`visible`},children:[(0,H.jsx)(Up,{elevation:4,onPointerEnter:l,onPointerLeave:u,sx:{position:`relative`,zIndex:t?10:0,width:`max-content`,height:`max-content`},children:(0,H.jsx)(W_,{badgeContent:e.length>1?e.length:0,color:`secondary`,children:(0,H.jsx)(bm,{focusRipple:!0,onClick:d,ref:i,children:(0,H.jsx)(zp,{orientation:`horizontal`,in:t,collapsedSize:h2,children:(0,H.jsxs)(J,{sx:{display:`flex`},children:[(0,H.jsx)(ZU,{part:e[0].partName,size:h2}),(0,H.jsx)(J,{sx:{marginLeft:`10px`,marginRight:`10px`,whiteSpace:`nowrap`,textAlign:`left`},children:(0,H.jsx)(zp,{in:t,collapsedSize:h2,children:(0,H.jsxs)(RC,{direction:`column`,sx:{marginBottom:`0.2em`},children:[(0,H.jsxs)(q,{variant:`h6`,children:[e[0].partName,`-`,e[0].process]}),(0,H.jsx)(`div`,{children:(0,H.jsx)(`small`,{children:f(e[0].location.palletNum,e[0].location.face)??f(e[0].action.loadOntoPalletNum,e[0].action.loadOntoFace)})}),Q.of(e).collect(e=>e.serial?(0,H.jsx)(`div`,{children:(0,H.jsxs)(`small`,{children:[`Serial: `,e.serial]})},e.materialID):void 0),(0,H.jsx)(`div`,{children:(0,H.jsx)(aW,{mat:e[0]})})]})})})]})})})})}),(0,H.jsx)(Rx,{anchorEl:i.current,open:a,onClose:()=>o(!1),anchorOrigin:{vertical:`top`,horizontal:`left`},children:Q.of(e).map((e,t)=>(0,H.jsx)(Hx,{onClick:()=>{o(!1),s({type:`MatDetails`,details:e})},children:e.serial&&e.serial!==``?e.serial:(t+1).toString()},e.materialID))})]})}function y2({maxNumFaces:e,mats:t,loadingOntoPallet:n,noFilter:r,showExpanded:i}){if(i&&e===1)return(0,H.jsx)(J,{sx:{display:`flex`,flexDirection:`column`,flexWrap:`wrap`},children:t.map(e=>(0,H.jsx)(fW,{mat:e},e.materialID))});{let i=n?Q.of(t).filter(e=>r||e.location.type!==at.OnPallet).orderedGroupBy(e=>e.action.loadOntoFace??1):Q.of(t).filter(e=>r||e.location.type===at.OnPallet).orderedGroupBy(e=>e.action.type===st.Loading?e.action.loadOntoFace??1:e.location.face??1);return(0,H.jsx)(J,{sx:{display:`grid`,gridTemplateRows:`${h2}px`,gridTemplateColumns:`repeat(${e}, ${h2}px)`,columnGap:`5px`,height:`100%`,alignContent:`center`,justifyContent:`center`},children:i.map(([e,t])=>(0,H.jsx)(J,{sx:{gridColumn:e,gridRow:1},children:(0,H.jsx)(v2,{mats:t})},e))})}}function b2({mats:e}){let t=Q.of(e).orderedGroupBy(e=>e.location.basketSlot??0);return(0,H.jsx)(J,{sx:{display:`flex`,flexWrap:`wrap`,justifyContent:`flex-start`,alignItems:`flex-start`,gap:`5px`,minHeight:`${h2}px`,paddingLeft:`5px`,paddingRight:`5px`,height:`100%`,alignContent:`center`},children:t.map(([e,t])=>(0,H.jsx)(J,{children:(0,H.jsx)(v2,{mats:t})},e))})}function x2({mats:e,maxNumFaces:t}){return(0,H.jsx)(J,{sx:{minHeight:`${g2}px`,display:`flex`,alignItems:`center`,justifyContent:`flex-start`,paddingLeft:`5px`,gap:`5px`,paddingRight:`5px`},children:(0,H.jsx)(y2,{mats:e,maxNumFaces:t,loadingOntoPallet:!0})})}function S2(e,t){let n=h2*e+5*(e+1);return t?`60px ${Math.max(n,100)}px`:`${Math.max(n,100)}px`}function C2(e){e=Math.round(e);let t=Math.abs(e)%60,n=Math.floor(Math.abs(e)/60),r=n%60,i=Math.floor(n/60);return i>0?`${e<0?`-`:``}${i}:${r.toString().padStart(2,`0`)}:${t.toString().padStart(2,`0`)}`:`${e<0?`-`:``}${r}:${t.toString().padStart(2,`0`)}`}function w2(e){let t=e?.find(e=>e.action.type===st.Machining),n=t?.action?.elapsedMachiningTime,r=t?.action.expectedRemainingMachiningTime,i=R(NO).timeOfCurrentStatusUTC,a=R(PO),o=null;r&&(o=zO(r)-(a-Math.floor(i.getTime()/1e3)));let s=null;return n&&(s=zO(n)+(a-Math.floor(i.getTime()/1e3))),o!==null&&s!==null?[!0,`${C2(s)} / ${C2(o)}`,o<0?-1:s/(s+o)*100]:o===null?s===null?[!!t,`Idle`,null]:[!0,C2(s),null]:[!0,` / `+C2(o),o<0?-1:null]}function T2({machine:e}){let[t,n,r]=w2(e.worktable?.mats);return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(q,{variant:`h5`,children:e.name}),(0,H.jsx)(q,{variant:`subtitle1`,children:n}),t?r===null?(0,H.jsx)(tb,{}):r<0?(0,H.jsx)(tb,{color:`error`}):(0,H.jsx)(tb,{variant:`determinate`,value:r}):void 0]})}function E2({maxNumFaces:e,machine:t}){return(0,H.jsxs)(J,{sx:{display:`grid`,border:`1px solid black`,margin:`5px`,gridTemplateRows:`auto ${g2}px ${g2}px ${g2}px`,gridTemplateColumns:S2(e,!0),gridTemplateAreas:`"machname machname" "inboundpal inboundmat" "worktablepal worktablemat" "outboundpal outboundmat"`},children:[(0,H.jsx)(J,{sx:{gridArea:`machname`,padding:`0.2em`,borderBottom:`1px solid black`},children:(0,H.jsx)(T2,{machine:t})}),(0,H.jsx)(J,{sx:{gridArea:`inboundpal`,borderRight:`1px solid black`,borderBottom:`1px solid black`,padding:`2px`},children:(0,H.jsxs)(RC,{children:[(0,H.jsx)(q,{variant:`body1`,sx:{textAlign:`center`},children:`In`}),t.inbound?(0,H.jsx)(q,{variant:`h6`,sx:{textAlign:`center`},children:t.inbound.pallet.palletNum}):void 0]})}),(0,H.jsx)(J,{sx:{gridArea:`inboundmat`,borderBottom:`1px solid black`},children:t.inbound?(0,H.jsx)(y2,{mats:t.inbound.mats,maxNumFaces:e}):void 0}),(0,H.jsx)(J,{sx:{gridArea:`worktablepal`,borderRight:`1px solid black`,borderBottom:`1px solid black`,padding:`2px`},children:(0,H.jsxs)(RC,{children:[(0,H.jsx)(q,{variant:`body1`,sx:{textAlign:`center`},children:`Work`}),t.worktable?(0,H.jsx)(q,{variant:`h6`,sx:{textAlign:`center`},children:t.worktable.pallet.palletNum}):void 0]})}),(0,H.jsx)(J,{sx:{gridArea:`worktablemat`,borderBottom:`1px solid black`},children:t.worktable?(0,H.jsx)(y2,{mats:t.worktable.mats,maxNumFaces:e}):void 0}),(0,H.jsx)(J,{sx:{gridArea:`outboundpal`,borderRight:`1px solid black`,padding:`2px`},children:(0,H.jsxs)(RC,{children:[(0,H.jsx)(q,{variant:`body1`,sx:{textAlign:`center`},children:`Out`}),t.outbound?(0,H.jsx)(q,{variant:`h6`,sx:{textAlign:`center`},children:t.outbound.pallet.palletNum}):void 0]})}),(0,H.jsx)(J,{sx:{gridArea:`outboundmat`},children:t.outbound?(0,H.jsx)(y2,{mats:t.outbound.mats,maxNumFaces:e}):void 0})]})}function D2(e){let t=(e?.find(e=>e.action.type===st.Loading||e.action.type===st.LoadingToBasket||e.action.type===st.UnloadToCompletedMaterial||e.action.type===st.UnloadToInProcess))?.action?.elapsedLoadUnloadTime,n=R(NO).timeOfCurrentStatusUTC,r=R(PO),i=null;return t&&(i=zO(t)+(r-Math.floor(n.getTime()/1e3))),i===null?`Idle`:C2(i)}function O2({load:e}){let t=D2(e.pal?.mats??e.basket?.mats),n=R(br);return(0,H.jsxs)(J,{sx:{display:`flex`,justifyContent:`space-between`,alignItems:`baseline`},children:[(0,H.jsx)(q,{variant:`h5`,children:ik(e.lulNum,n.loadStationNames)}),(0,H.jsx)(q,{variant:`body1`,children:t})]})}function k2({maxNumFaces:e,maxNumStagingRows:t,maxNumSourceRows:n,load:r}){let i=ok(R(br).basketName),a=r.pal?`Pallet`:r.basket?i:null,o=r.pal?r.pal.pallet.palletNum.toString():r.basket?r.basket.basket.basketId.toString():null,s=Math.max(1,n),c=Math.max(1,t),l=Array.from({length:s},(e,t)=>`"source${t} sourcemat${t}"`),u=Array.from({length:c},(e,t)=>`"stage${t} stagemat${t}"`),d=[`"lulname lulname"`,...l,`"current currentmat"`,...u].join(` `);return(0,H.jsxs)(J,{sx:{display:`grid`,border:`1px solid black`,margin:`5px`,gridTemplateRows:`auto repeat(${s+1+c}, ${g2}px)`,gridTemplateColumns:S2(e,!0),gridTemplateAreas:d},children:[(0,H.jsx)(J,{sx:{gridArea:`lulname`,padding:`0.2em`,borderBottom:`1px solid black`},children:(0,H.jsx)(O2,{load:r})}),Array.from({length:s},(t,n)=>{let i=r.sources[n]??null;return(0,H.jsxs)(L.Fragment,{children:[(0,H.jsx)(J,{sx:{gridArea:`source${n}`,borderRight:`1px solid black`,borderBottom:`1px solid black`,padding:`2px`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:i?(0,H.jsx)(q,{variant:`body2`,sx:{textAlign:`center`},children:i.label}):void 0}),(0,H.jsx)(J,{sx:{gridArea:`sourcemat${n}`,borderBottom:`1px solid black`,display:`flex`,flexDirection:`column`,justifyContent:`center`},children:i?(0,H.jsx)(x2,{mats:i.mats,maxNumFaces:e}):void 0})]},`source-${n}`)}),(0,H.jsx)(J,{sx:{gridArea:`current`,borderRight:`1px solid black`,borderBottom:`1px solid black`,padding:`2px`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,H.jsxs)(RC,{children:[a?(0,H.jsx)(q,{variant:`body1`,sx:{textAlign:`center`},children:a}):void 0,o?(0,H.jsx)(q,{variant:`h6`,sx:{textAlign:`center`},children:o}):void 0]})}),(0,H.jsxs)(J,{sx:{gridArea:`currentmat`,display:`flex`,flexDirection:`column`,justifyContent:`center`,borderBottom:`1px solid black`},children:[r.pal?(0,H.jsx)(y2,{mats:r.pal.mats,maxNumFaces:e}):void 0,!r.pal&&r.basket?(0,H.jsx)(b2,{mats:r.basket.mats}):void 0]}),Array.from({length:c},(e,t)=>{let n=r.staging[t]??null,a=t===c-1;return(0,H.jsxs)(L.Fragment,{children:[(0,H.jsx)(J,{sx:{gridArea:`stage${t}`,borderRight:`1px solid black`,...a?{}:{borderBottom:`1px solid black`},padding:`2px`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:n?(0,H.jsxs)(q,{variant:`body2`,sx:{textAlign:`center`},children:[`Staging `,i,` `,n.basket.basketId]}):void 0}),(0,H.jsx)(J,{sx:{gridArea:`stagemat${t}`,...a?{}:{borderBottom:`1px solid black`},display:`flex`,flexDirection:`column`,justifyContent:`center`},children:n?(0,H.jsx)(b2,{mats:n.mats}):void 0})]},`stage-${t}`)})]})}function A2({status:e}){let t=D2(e.loadingMats),[n,r,i]=w2(e.machiningMats);return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(q,{variant:`h5`,children:[`Station `,e.lulNum]}),e.machineCurrentlyAtLoad?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(q,{variant:`h5`,children:[e.machineCurrentlyAtLoad.group,` `,e.machineCurrentlyAtLoad.num]}),(0,H.jsx)(q,{variant:`subtitle1`,children:r===`Idle`?t:r}),n?i===null?(0,H.jsx)(tb,{}):i<0?(0,H.jsx)(tb,{color:`error`}):(0,H.jsx)(tb,{variant:`determinate`,value:i}):void 0]}):(0,H.jsxs)(H.Fragment,{children:[e.machineMoving?(0,H.jsx)(q,{variant:`subtitle2`,children:`Machine Moving`}):void 0,(0,H.jsxs)(q,{variant:`subtitle1`,children:[`Loading `,t]})]})]})}function j2({maxNumFaces:e,status:t}){return(0,H.jsxs)(J,{sx:{display:`grid`,border:`1px solid black`,margin:`5px`,gridTemplateRows:`minmax(104px, max-content) repeat(3, ${e>1?g2.toString()+`px`:`minmax(110px, max-content)`})`,gridTemplateColumns:e===1?`60px minmax(230px, max-content)`:S2(e,!0),gridTemplateAreas:`"name name" "ready readymat" "machining machiningmat" "loadstation loadstationmat"`},children:[(0,H.jsx)(J,{sx:{gridArea:`name`,padding:`0.2em`,borderBottom:`1px solid black`},children:(0,H.jsx)(A2,{status:t})}),(0,H.jsx)(J,{sx:{gridArea:`ready`,borderRight:`1px solid black`,borderBottom:`1px solid black`,padding:`2px`},children:(0,H.jsx)(q,{variant:`body1`,sx:{textAlign:`center`},children:`Ready`})}),(0,H.jsx)(J,{sx:{gridArea:`readymat`,borderBottom:`1px solid black`,display:`flex`,flexDirection:`column`,justifyContent:`center`},children:(0,H.jsx)(y2,{mats:t.readyMats,maxNumFaces:e,showExpanded:!0})}),(0,H.jsx)(J,{sx:{gridArea:`machining`,borderRight:`1px solid black`,borderBottom:`1px solid black`,padding:`2px`},children:(0,H.jsx)(q,{variant:`body1`,sx:{textAlign:`center`},children:`Work`})}),(0,H.jsx)(J,{sx:{gridArea:`machiningmat`,borderBottom:`1px solid black`,display:`flex`,flexDirection:`column`,justifyContent:`center`},children:(0,H.jsx)(y2,{mats:t.machiningMats,maxNumFaces:e,showExpanded:!0})}),(0,H.jsx)(J,{sx:{gridArea:`loadstation`,borderRight:`1px solid black`,padding:`2px`},children:(0,H.jsxs)(RC,{children:[(0,H.jsx)(q,{variant:`body1`,sx:{textAlign:`center`},children:`Load`}),(0,H.jsx)(q,{variant:`body1`,sx:{textAlign:`center`},children:`Station`})]})}),(0,H.jsx)(J,{sx:{gridArea:`loadstationmat`,display:`flex`,flexDirection:`column`,justifyContent:`center`},children:(0,H.jsx)(y2,{mats:t.loadingMats,maxNumFaces:e,showExpanded:!0,noFilter:!0})})]})}function M2({maxNumFaces:e,pallet:t}){return(0,H.jsxs)(J,{sx:{display:`grid`,border:`1px solid black`,margin:`5px`,gridTemplateRows:`auto ${g2}px`,gridTemplateColumns:S2(e,!1),gridTemplateAreas:`"palname" "palmat"`},children:[(0,H.jsxs)(q,{variant:`h5`,sx:{gridArea:`palname`,padding:`0.2em`,borderBottom:`1px solid black`},children:[`Pallet `,t.pallet.palletNum]}),(0,H.jsx)(J,{sx:{gridArea:`palmat`},children:(0,H.jsx)(y2,{mats:t.mats,maxNumFaces:e})})]})}function N2({basket:e}){let t=ok(R(br).basketName);return(0,H.jsxs)(J,{sx:{display:`grid`,border:`1px solid black`,margin:`5px`,gridTemplateRows:`auto ${g2}px`,gridTemplateColumns:`minmax(120px, max-content)`,gridTemplateAreas:`"basketname" "basketmat"`},children:[(0,H.jsxs)(q,{variant:`h5`,sx:{gridArea:`basketname`,padding:`0.2em`,borderBottom:`1px solid black`},children:[t,` `,e.basket.basketId]}),(0,H.jsx)(J,{sx:{gridArea:`basketmat`},children:(0,H.jsx)(b2,{mats:e.mats})})]})}function P2({empty:e,filled:t}){return(0,H.jsxs)(J,{sx:{display:`grid`,border:`1px solid black`,margin:`5px`,padding:`0.5em 1em`,alignContent:`center`,minWidth:`170px`},children:[(0,H.jsxs)(q,{variant:`h5`,children:[ok(R(br).basketName),` Storage`]}),(0,H.jsxs)(q,{variant:`body1`,children:[`Empty: `,e]}),(0,H.jsxs)(q,{variant:`body1`,children:[`Filled: `,t]})]})}var F2=(0,L.memo)(function({overview:e}){return(0,H.jsxs)(`div`,{children:[e.machines.toAscLazySeq().map(([t,n])=>(0,H.jsx)(J,{sx:{display:`flex`,flexWrap:`wrap`,justifyContent:`space-evenly`},children:n.map(t=>(0,H.jsx)(E2,{machine:t,maxNumFaces:e.maxNumFacesOnPallet},t.name))},t)),e.loads.length>0?(0,H.jsx)(J,{sx:{display:`flex`,flexWrap:`wrap`,justifyContent:`space-evenly`},children:e.loads.map(t=>(0,H.jsx)(k2,{load:t,maxNumFaces:e.maxNumFacesOnPallet,maxNumStagingRows:e.maxNumStagingRows,maxNumSourceRows:e.maxNumSourceRows},t.lulNum))}):void 0,e.machineAtLoad.length>0?(0,H.jsx)(J,{sx:{display:`flex`,flexWrap:`wrap`,justifyContent:`space-evenly`},children:e.machineAtLoad.map(t=>(0,H.jsx)(j2,{status:t,maxNumFaces:e.maxNumFacesOnPallet},t.lulNum))}):void 0,e.stockerPals.length>0||e.floatingBaskets.length>0||e.storageBaskets?(0,H.jsxs)(J,{sx:{display:`flex`,flexWrap:`wrap`,justifyContent:`space-evenly`},children:[e.stockerPals.map(t=>(0,H.jsx)(M2,{pallet:t,maxNumFaces:e.maxNumFacesOnPallet},t.pallet.palletNum)),e.floatingBaskets.map(e=>(0,H.jsx)(N2,{basket:e},e.basket.basketId)),e.storageBaskets?(0,H.jsx)(P2,{empty:e.storageBaskets.empty,filled:e.storageBaskets.filled}):void 0]}):void 0]})}),I2=(0,L.memo)(function({ignoreOperator:e}){let[t,n]=(0,L.useState)(null),[r,i]=(0,L.useState)(null);function a(){n(null),i(null)}return(0,H.jsx)(EW,{onClose:a,allowNote:!0,highlightProcsGreaterOrEqualTo:r?.process??void 0,extraDialogElements:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(mX,{st:t,setState:n}),r===null?null:(0,H.jsx)(uX,{st:r,setState:i})]}),buttons:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(aX,{ignoreOperator:e}),(0,H.jsx)(oX,{onClose:a,ignoreOperator:e}),(0,H.jsx)(t2,{}),(0,H.jsx)(hX,{st:t,setState:n,onClose:a,ignoreOperator:e}),(0,H.jsx)(dX,{st:r,setState:i,onClose:a,ignoreOperator:e})]})})});function L2({ignoreOperator:e,whiteBackground:t}){JI(`System Overview`);let n=_2();return(0,H.jsxs)(`main`,{style:{padding:`10px`,minHeight:`calc(100vh - 64px)`,backgroundColor:t?`white`:`#F8F8F8`},children:[(0,H.jsx)(F2,{overview:n}),(0,H.jsx)(I2,{ignoreOperator:e}),(0,H.jsx)(n2,{})]})}var R2=30;function z2({machine:e}){let t=Od(),[,,n]=w2(e.worktable?.mats);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`rect`,{x:3,y:3,width:24,height:24,stroke:`black`}),`;`,(0,H.jsx)(`rect`,{x:3,y:3,width:24,height:8,fill:e.inbound===null?`white`:t.palette.secondary.main}),(0,H.jsx)(`rect`,{x:3,y:11,width:24,height:8,fill:e.worktable===null?`white`:n!=null&&n<0?t.palette.error.main:t.palette.secondary.main}),(0,H.jsx)(`rect`,{x:3,y:19,width:24,height:8,fill:e.outbound===null?`white`:t.palette.secondary.main})]})}function B2({load:e}){let t=Od();return(0,H.jsx)(`polygon`,{points:`3,27 27,27 15,3`,fill:e.pal===null&&e.basket===null&&e.staging.length===0?`white`:t.palette.secondary.main,stroke:`black`})}function V2({status:e}){let t=Od(),[,,n]=w2(e.machiningMats);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`rect`,{x:3,y:3,width:24,height:24,stroke:`black`}),`;`,(0,H.jsx)(`rect`,{x:3,y:3,width:24,height:8,fill:e.readyMats.length===0?`white`:t.palette.secondary.main}),(0,H.jsx)(`rect`,{x:3,y:11,width:24,height:8,fill:e.machiningMats.length===0?`white`:n!=null&&n<0?t.palette.error.main:t.palette.secondary.main}),(0,H.jsx)(`rect`,{x:3,y:19,width:24,height:8,fill:e.loadingMats.length===0?`white`:t.palette.secondary.main})]})}var H2=(0,L.memo)(function({overview:e}){let t=e.machines.toAscLazySeq().sumBy(([,e])=>e.length);return(0,H.jsx)(J,{sx:{height:`1.5em`,"&:hover":{backgroundColor:`primary.light`}},children:(0,H.jsxs)(`svg`,{viewBox:`0 0 ${(t+e.loads.length+e.machineAtLoad.length)*R2} ${R2}`,preserveAspectRatio:`none`,width:`140px`,height:`1.5em`,children:[(0,H.jsx)(`g`,{children:e.machines.toAscLazySeq().flatMap(([,e])=>e).map((e,t)=>(0,H.jsx)(`g`,{transform:`translate(${t*R2})`,children:(0,H.jsx)(z2,{machine:e})},e.name))}),(0,H.jsx)(`g`,{transform:`translate(${t*R2})`,children:e.loads.map((e,t)=>(0,H.jsx)(`g`,{transform:`translate(${t*R2})`,children:(0,H.jsx)(B2,{load:e})},e.lulNum))}),(0,H.jsx)(`g`,{transform:`translate(${(t+e.loads.length)*R2})`,children:e.machineAtLoad.map((e,t)=>(0,H.jsx)(`g`,{transform:`translate(${t*R2})`,children:(0,H.jsx)(V2,{status:e})},e.lulNum))})]})})}),U2=(0,L.memo)(function({full:e}){let[t,n]=(0,L.useState)(!1),r=_2();return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Y,{onClick:()=>n(!0),children:(0,H.jsx)(H2,{overview:r})}),(0,H.jsxs)(cy,{open:t,onClose:()=>n(!1),maxWidth:`xl`,fullScreen:e,children:[e?(0,H.jsx)(dh,{sx:{position:`relative`},children:(0,H.jsxs)(Rw,{children:[(0,H.jsx)(Um,{edge:`start`,color:`inherit`,onClick:()=>n(!1),"aria-label":`close`,children:(0,H.jsx)(hre,{})}),(0,H.jsx)(q,{sx:{ml:2,flex:1},variant:`h6`,component:`div`,children:`System Overview`})]})}):void 0,(0,H.jsx)(uy,{children:(0,H.jsx)(J,{sx:{paddingBottom:`2em`,paddingLeft:`5em`,paddingRight:`5em`},children:(0,H.jsx)(F2,{overview:r})})})]})]})});function W2(e){return Number.isInteger(e)&&(e??0)>0}function G2(e){return typeof e==`string`&&e.trim()!==``}function K2(e,t){if(e.location.type===at.InBasket&&e.location.basketId===t&&(e.action.type===st.UnloadToInProcess||e.action.type===st.UnloadToCompletedMaterial))return W2(e.location.basketSlot)?{type:`valid`,workId:e.action.workId}:{type:`invalid`};if(e.action.type===st.LoadingToBasket){if(!W2(e.action.loadToBasketId))return{type:`invalid`};if(e.action.loadToBasketId!==t)return;let n=e.location.type===at.InBasket&&e.location.basketId===t&&e.location.basketSlot===e.action.loadToBasketSlot;return!W2(e.action.loadToBasketSlot)||!n&&e.location.type!==at.Free&&(e.location.type!==at.InQueue||!G2(e.location.currentQueue))?{type:`invalid`}:{type:`valid`,workId:e.action.workId}}}function q2(e,t){let n=Q.of(e).collect(e=>K2(e,t)).toRArray();if(n.some(e=>e.type===`invalid`))return{type:`inconsistent`};let r=n.filter(e=>e.type===`valid`);if(r.length===0)return{type:`none`};let i=r.filter(e=>G2(e.workId)),a=Q.of(i).toHashSet(({workId:e})=>e);return i.length!==r.length||a.size!==1?{type:`inconsistent`}:{type:`confirmable`,work:{workId:i[0].workId}}}function J2(e){return e.location.type===at.InBasket&&e.location.basketId===e.action.loadToBasketId&&e.location.basketSlot===e.action.loadToBasketSlot?`Unload, re-plate, and reload this slot`:e.location.type===at.InQueue&&e.location.currentQueue?`Load from ${e.location.currentQueue}`:`Load from raw material`}function Y2({material:e,fsize:t}){return e.map(e=>(0,H.jsx)(m2,{kind:{type:r2.Material,material:e},children:(0,H.jsx)(fW,{mat:e,fsize:t})},e.materialID))}function X2({stationNumber:e,basket:t,material:n,fsize:r,submitCommand:i}){let[a,o]=(0,L.useState)(),s=(0,L.useMemo)(()=>q2(n,t.basketId),[t.basketId,n]),c=s.type===`confirmable`?s.work:void 0,l=a!==void 0&&a.workId===c?.workId?a.state:`idle`,u=(0,L.useMemo)(()=>Q.of(n).filter(e=>e.location.type===at.InBasket&&e.location.basketId===t.basketId&&e.location.basketSlot!==void 0).groupBy(e=>e.location.basketSlot??0).toHashMap(e=>e),[t.basketId,n]),d=(0,L.useMemo)(()=>Q.of(n).filter(e=>e.action.type===st.LoadingToBasket&&e.action.loadToBasketId===t.basketId&&e.action.loadToBasketSlot!==void 0).groupBy(e=>e.action.loadToBasketSlot??0).toHashMap(e=>e),[t.basketId,n]),f=(0,L.useMemo)(()=>Q.of(t.emptySlots??[]).concat(t.unknownSlots??[]).concat(u.keysToLazySeq()).concat(d.keysToLazySeq()).distinctBy(e=>e).toSortedArray(e=>e),[t.emptySlots,t.unknownSlots,u,d]);async function p(){if(c===void 0||i===void 0)return;let t=c.workId;o({workId:t,state:`submitting`});try{let n=await i(e,{workId:t});o(e=>e?.workId===t?{workId:t,state:n}:e)}catch{o(e=>e?.workId===t?{workId:t,state:`error`}:e)}}let m=l===`submitting`||l===`accepted`||l===`conflict`;return(0,H.jsxs)(RC,{spacing:2,sx:{mt:2},children:[(0,H.jsx)(q,{variant:`h6`,children:`Basket slots`}),(0,H.jsx)(J,{sx:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(15em, 1fr))`,gap:2},children:f.map(e=>{let n=u.get(e)??[],i=d.get(e)??[],a=t.unknownSlots?.includes(e)===!0;return(0,H.jsx)(m2,{kind:{type:r2.BasketSlotZone,basketId:t.basketId,slot:e},children:(0,H.jsxs)(J,{component:`section`,"data-testid":`basket-load-station-slot-${e}`,sx:{border:`1px solid`,borderColor:`text.primary`,p:2},children:[(0,H.jsxs)(q,{variant:`h6`,children:[`Slot `,e]}),n.length>0?(0,H.jsx)(Y2,{material:n,fsize:r}):(0,H.jsx)(q,{color:a?`warning.main`:`text.secondary`,children:a?`Unknown`:`Empty`}),i.map((e,t)=>(0,H.jsxs)(J,{sx:{mt:1},children:[(0,H.jsx)(q,{children:J2(e)}),(0,H.jsxs)(q,{variant:`body2`,color:`text.secondary`,children:[e.partName,` · Process `,e.action.processAfterLoad??e.process]})]},`${e.jobUnique}-${e.process}-${t}`))]})},e)})}),c&&i?(0,H.jsx)(J,{sx:{display:`flex`,justifyContent:`flex-end`},children:(0,H.jsx)(Y,{variant:`contained`,disabled:m,onClick:()=>void p(),children:`Confirm`})}):c?(0,H.jsx)(th,{severity:`warning`,children:`Basket work confirmation is not configured.`}):s.type===`inconsistent`?(0,H.jsx)(th,{severity:`warning`,children:`Basket work is inconsistent. Wait for refreshed material actions before confirming.`}):null,l===`accepted`?(0,H.jsx)(th,{severity:`success`,children:`Confirmation accepted. Waiting for refreshed work.`}):l===`conflict`?(0,H.jsx)(th,{severity:`warning`,children:`Basket work changed before confirmation. Review the refreshed slots and try again.`}):l===`error`?(0,H.jsx)(th,{severity:`error`,children:`Unable to confirm basket work. No work was assumed complete.`}):null]})}function Z2(e){return encodeURIComponent(e.toString())}function Q2(e){switch(e.kind){case`queue`:return`load-station-queue-${Z2(e.label)}`;case`baskets`:return`load-station-baskets`;case`free`:return`load-station-material`}}function $2(e,t,n){switch(e.action.type){case st.Loading:return t!==void 0&&e.action.loadOntoPalletNum===t.palletNum||n!==void 0&&e.action.loadFromBasketId===n.basketId;case st.LoadingToBasket:return n!==void 0&&e.action.loadToBasketId===n.basketId;default:return!1}}function e4(e,t,n,r){let i,a,o=new Set;if(e>=0){for(let t of Object.values(n.pallets))if(t.currentPalletLocation.loc===nt.LoadUnload&&t.currentPalletLocation.num===e){i=t;break}for(let t of Object.values(n.baskets??{}))t.position.locationNum===e&&(t.position.location===_t.LoadUnload?a=t:t.position.location===_t.LoadStationStaging&&o.add(t.basketId))}let s=new Set(t);if(i!==void 0)for(let e of n.material)e.action.type===st.Loading&&e.action.loadOntoPalletNum===i.palletNum&&e.location.type===at.InQueue&&e.location.currentQueue&&s.add(e.location.currentQueue),e.action.type===st.Loading&&e.action.loadOntoPalletNum===i.palletNum&&e.action.loadFromBasketId&&o.add(e.action.loadFromBasketId),(e.action.type===st.UnloadToInProcess||e.action.type===st.UnloadToCompletedMaterial)&&e.action.unloadToBasketId&&e.location.type===at.OnPallet&&e.location.palletNum===i.palletNum&&o.add(e.action.unloadToBasketId),(e.action.type===st.UnloadToInProcess||e.action.type===st.UnloadToCompletedMaterial)&&e.action.unloadIntoQueue&&e.location.type===at.OnPallet&&e.location.palletNum===i.palletNum&&s.add(e.action.unloadIntoQueue);else if(a!==void 0)for(let e of n.material)e.location.type===at.InBasket&&e.location.basketId===a.basketId&&(e.action.type===st.UnloadToInProcess||e.action.type===st.UnloadToCompletedMaterial)&&e.action.unloadIntoQueue&&s.add(e.action.unloadIntoQueue),e.location.type===at.InQueue&&e.location.currentQueue&&$2(e,void 0,a)&&s.add(e.location.currentQueue);let c=new Map(Q.of(s).map(e=>[e,{mats:[],hiddenCnt:0}])),l=new Map(Q.of(o).map(e=>[e,{mats:[],hiddenCnt:0}])),u=[],d=eO.empty(),f=null;if(i)for(let e=1;e<=i.numFaces;e++)d=d.set(e,[]);else a&&(d=d.set(1,[]));for(let e of n.material){if(i?(e.action.type===st.Loading&&e.action.loadOntoPalletNum===i.palletNum&&(e.action.elapsedLoadUnloadTime&&(f=e.action.elapsedLoadUnloadTime),e.action.loadOntoFace&&!d.has(e.action.loadOntoFace)&&(d=d.set(e.action.loadOntoFace,[])),e.location.type===at.Free&&u.push(e)),e.location.type===at.OnPallet&&e.location.palletNum===i.palletNum&&((e.action.type===st.UnloadToCompletedMaterial||e.action.type===st.UnloadToInProcess)&&e.action.elapsedLoadUnloadTime&&(f=e.action.elapsedLoadUnloadTime),d=d.alter(e.location.face??1,t=>t?(t.push(e),t):[e]))):a&&($2(e,i,a)&&e.action.elapsedLoadUnloadTime&&(f=e.action.elapsedLoadUnloadTime),e.action.type===st.LoadingToBasket&&e.action.loadToBasketId===a.basketId&&e.location.type===at.Free&&u.push(e),e.location.type===at.InBasket&&e.location.basketId===a.basketId&&((e.action.type===st.UnloadToCompletedMaterial||e.action.type===st.UnloadToInProcess)&&e.action.elapsedLoadUnloadTime&&(f=e.action.elapsedLoadUnloadTime),d=d.alter(1,t=>t?(t.push(e),t):[e]))),e.location.type===at.InQueue&&e.location.currentQueue&&c.has(e.location.currentQueue)){let t=c.get(e.location.currentQueue);r&&!$2(e,i,a)?t===void 0?c.set(e.location.currentQueue,{mats:[],hiddenCnt:1}):t.hiddenCnt+=1:t===void 0?c.set(e.location.currentQueue,{mats:[e],hiddenCnt:0}):t.mats.push(e)}if(e.location.type===at.InBasket&&e.location.basketId&&l.has(e.location.basketId)){let t=l.get(e.location.basketId);r&&!$2(e,i,a)?t===void 0?l.set(e.location.basketId,{mats:[],hiddenCnt:1}):t.hiddenCnt+=1:t===void 0?l.set(e.location.basketId,{mats:[e],hiddenCnt:0}):t.mats.push(e)}}c.forEach(e=>e.mats.sort(ME(e=>e.location.queuePosition??0))),l.forEach(e=>e.mats.sort(ME(e=>e.location.basketSlot??0)));let p=u.length+d.valuesToAscLazySeq().sumBy(e=>e.length),m=a?Q.of(a.emptySlots??[]).concat(a.unknownSlots??[]).concat(Q.of(n.material).collect(e=>e.location.type===at.InBasket&&e.location.basketId===a.basketId?e.location.basketSlot:void 0)).concat(Q.of(n.material).collect(e=>e.action.type===st.LoadingToBasket&&e.action.loadToBasketId===a.basketId?e.action.loadToBasketSlot:void 0)).distinctBy(e=>e).toRArray().length:0,h=Math.max(p,m);return{pallet:i,activeBasket:a,allMaterial:n.material,face:d,freeLoadingMaterial:u,queues:c,baskets:l,elapsedLoadingTime:f,fsize:h<=2?`x-large`:h<=6?`large`:`normal`}}function t4({loadData:e}){let t=qI(),n=R(jO),r=(0,L.useMemo)(()=>{let t=e.pallet;return t?Q.of(e.face.values()).append(e.freeLoadingMaterial).concat(Q.of(e.queues).collect(([e,t])=>t.mats)).flatMap(e=>e).collect(e=>e.action.type===st.Loading&&e.action.loadOntoPalletNum===t.palletNum&&e.location.type===at.OnPallet&&e.location.palletNum===t.palletNum?$t(e.partName,`unload`,e.materialID,t.palletNum,e.process,n):e.action.type===st.Loading&&e.action.loadOntoPalletNum===t.palletNum?$t(e.partName,`load`,e.materialID,t.palletNum,e.action.processAfterLoad??e.process,n):e.location.type===at.OnPallet&&e.location.palletNum===t.palletNum&&(e.action.type===st.UnloadToCompletedMaterial||e.action.type===st.UnloadToInProcess)?$t(e.partName,`unload`,e.materialID,t.palletNum,e.process,n):null).toRArray():[]},[e,n]);if(r.length===0||t)return(0,H.jsx)(`div`,{});function i(){for(let e of r)window.open(e,`_blank`)}return(0,H.jsx)(J,{sx:{position:`fixed`,bottom:`5px`,right:`5px`},children:(0,H.jsx)(X,{title:`Open All Instructions`,children:(0,H.jsx)(hy,{onClick:i,color:`secondary`,children:(0,H.jsx)(Cre,{})})})})}function n4({elapsedLoadTime:e}){let t=R(NO).timeOfCurrentStatusUTC,n=R(PO);return e?(0,H.jsx)(`span`,{children:C2(zO(e)+(n-Math.floor(t.getTime()/1e3)))}):null}function r4({data:e,faceNum:t,loadNum:n,submitBasketLoadStationCommand:r}){let i=e.face.get(t),a=ok(R(br).basketName);return i?e.activeBasket&&!e.pallet?(0,H.jsxs)(`div`,{"data-testid":`load-station-active-basket`,children:[t===1?(0,H.jsxs)(J,{sx:{display:`grid`,gridTemplateColumns:`1fr auto`},children:[(0,H.jsxs)(q,{variant:`h4`,children:[a,` `,e.activeBasket.basketId]}),(0,H.jsx)(J,{sx:{justifySelf:`flex-end`},children:(0,H.jsx)(n4,{elapsedLoadTime:e.elapsedLoadingTime})})]}):null,(0,H.jsx)(J,{sx:{ml:`4em`,mr:`4em`},children:(0,H.jsx)(m2,{kind:{type:r2.BasketZone,basketId:e.activeBasket.basketId},children:(0,H.jsx)(X2,{stationNumber:n,basket:e.activeBasket,material:e.allMaterial,fsize:e.fsize,submitCommand:r})})})]}):e.pallet?(0,H.jsxs)(`div`,{"data-testid":`load-station-pallet-face-${t}`,children:[t===1?(0,H.jsxs)(J,{sx:{display:`grid`,gridTemplateColumns:e.pallet.numFaces>1?`1fr 1fr 1fr`:`1fr 1fr`},children:[(0,H.jsxs)(q,{variant:`h4`,children:[`Pallet `,e.pallet.palletNum]}),e.pallet.numFaces>1?(0,H.jsx)(q,{variant:`h6`,sx:{justifySelf:`center`},children:e.pallet.faceNames?.[t-1]??`Face 1`}):void 0,(0,H.jsx)(J,{sx:{justifySelf:`flex-end`},children:(0,H.jsx)(n4,{elapsedLoadTime:e.elapsedLoadingTime})})]}):e.pallet.numFaces>1?(0,H.jsx)(J,{sx:{display:`flex`,justifyContent:`center`},children:(0,H.jsx)(q,{variant:`h6`,children:e.pallet.faceNames?.[t-1]??`Face ${t}`})}):void 0,(0,H.jsx)(J,{sx:{ml:`4em`,mr:`4em`},children:(0,H.jsx)(m2,{kind:{type:r2.PalletFaceZone,face:t},children:(0,H.jsx)(J,{sx:{display:`flex`,flexWrap:`wrap`,justifyContent:`space-around`},children:i.map((t,n)=>(0,H.jsx)(m2,{kind:{type:r2.Material,material:t},children:(0,H.jsx)(fW,{mat:t,fsize:e.fsize})},n))})})})]}):null:null}function i4({data:e,mat:t}){return(0,H.jsxs)(`div`,{children:[t.label===``?null:(0,H.jsx)(q,{variant:`h4`,children:t.label}),t.material.mats.map((n,r)=>(0,H.jsx)(m2,{kind:{type:r2.Material,material:n,identifier:n.materialID<0?`raw-${t.isFree?`free`:`queue`}-${t.label}-${r}`:void 0},children:t.isFree||t.sortable===!1?(0,H.jsx)(fW,{mat:n,displayActionForSinglePallet:e.pallet?e.pallet.palletNum:0,fsize:e.fsize,showRawMaterial:!0,showJobComment:!0}):(0,H.jsx)(pW,{mat:n,displayActionForSinglePallet:e.pallet?e.pallet.palletNum:0,shake:n.action.type===st.Loading&&n.action.loadOntoPalletNum===e.pallet?.palletNum,fsize:n.action.type===st.Loading&&n.action.loadOntoPalletNum===e.pallet?.palletNum?e.fsize:void 0,showRawMaterial:!0,showJobComment:!0})},r)),t.material.hiddenCnt>0?(0,H.jsxs)(q,{variant:`body2`,color:`textSecondary`,sx:{textAlign:`center`,mt:`0.5em`},children:[`+`,t.material.hiddenCnt,` hidden`]}):null]})}function a4({data:e,label:t,baskets:n}){return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(q,{variant:`h4`,children:t}),n.map((t,n)=>(0,H.jsxs)(J,{"data-testid":`load-station-basket-${Z2(t.basketId)}`,sx:{mt:n===0?`0.5em`:`1.5em`,pt:n===0?void 0:`1em`},children:[(0,H.jsx)(q,{variant:`h6`,sx:{mb:`0.5em`},children:t.label}),(0,H.jsx)(m2,{kind:{type:r2.BasketZone,basketId:t.basketId},children:(0,H.jsx)(i4,{data:e,mat:{label:``,material:t.material,isFree:!1,sortable:!1}})})]},t.basketId))]})}function o4({data:e,region:t}){switch(t.kind){case`free`:return(0,H.jsx)(m2,{kind:{type:r2.FreeMaterialZone},children:(0,H.jsx)(i4,{data:e,mat:{label:t.label,material:t.material,isFree:!0,sortable:!1}})});case`queue`:return(0,H.jsx)(m2,{kind:{type:r2.QueueZone,queue:t.label},children:(0,H.jsx)(mJ,{matIds:t.material.mats.map(e=>e.materialID),direction:`vertical`,queueName:t.label,renderDragOverlay:t=>(0,H.jsx)(mW,{mat:t,displayActionForSinglePallet:e.pallet?e.pallet.palletNum:0,fsize:t.action.type===st.Loading&&t.action.loadOntoPalletNum===e.pallet?.palletNum?e.fsize:void 0}),children:(0,H.jsx)(i4,{data:e,mat:{label:t.label,material:t.material,isFree:!1,sortable:!0}})})});case`baskets`:return(0,H.jsx)(a4,{data:e,label:t.label,baskets:t.baskets})}}function s4(){let e=R(fL);return(0,H.jsx)(`div`,{children:(0,L.useMemo)(()=>{let t=BT(new Date,-5);return e.matsById.valuesToLazySeq().filter(e=>e.completed_last_proc_machining===!0&&e.last_unload_time!==void 0&&e.last_unload_time>=t).toSortedArray({desc:e=>e.last_unload_time?.getTime()??0})},[e]).map((e,t)=>(0,H.jsx)(dW,{mat:e},t))})}var c4=(0,L.memo)(function({fillViewPort:e,showMaterial:t}){let n=p2({type:t?r2.CompletedExpandedMaterialZone:r2.CompletedCollapsedMaterialZone});return t&&e?(0,H.jsxs)(J,{ref:n,sx:{padding:`8px`,display:`flex`,flexDirection:`column`,height:`100%`},children:[(0,H.jsx)(q,{variant:`h4`,children:`Completed`}),(0,H.jsx)(J,{sx:{position:`relative`,flexGrow:1},children:(0,H.jsx)(J,{sx:{position:`absolute`,top:`0`,left:`0`,right:`0`,bottom:`0`,overflow:`auto`},children:(0,H.jsx)(s4,{})})})]}):t?(0,H.jsxs)(J,{ref:n,sx:{padding:`8px`},children:[(0,H.jsx)(q,{variant:`h4`,children:`Completed`}),(0,H.jsx)(s4,{})]}):(0,H.jsx)(J,{ref:n,sx:{display:`flex`,justifyContent:e?`flex-end`:void 0,padding:`8px`},children:(0,H.jsx)(q,{variant:`h4`,sx:{margin:`4px`,...e?{textOrientation:`mixed`,writingMode:`vertical-rl`}:{}},children:`Completed`})})});function l4({pallet:e}){let t=R(OI),n=R(jO),r=qI();if(t===null)return null;let i;if(t.action.type===st.Loading&&t.action.loadOntoPalletNum===e?i=`load`:(t.action.type===st.UnloadToInProcess||t.action.type===st.UnloadToCompletedMaterial)&&t.location.type===at.OnPallet&&t.location.palletNum===e&&(i=`unload`),i===void 0)return null;let a=$t(t.partName,i,t.materialID,e,t.action.type===st.Loading?t.action.processAfterLoad??t.process:t.process,n);return r?(0,H.jsx)(Y,{color:`primary`,children:`Instructions`}):(0,H.jsx)(Y,{href:a,target:`bms-instructions`,color:`primary`,children:`Instructions`})}function u4({queues:e,onClose:t,toQueue:n,showAddToQueue:r,setShowAddToQueue:i}){let a=z(SI),o=R(PI),s=R(TI),c=R(OI),l=R(jO),[u,d]=BI(),[f,p]=(0,L.useState)(null);return!s||!XU(c)||e.length===0||c?.location.type===at.InQueue&&c?.location.currentQueue&&e.includes(c?.location.currentQueue)?null:r?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(Y,{color:`primary`,disabled:n===null||d,onClick:async()=>{p(null);try{await u({materialId:s.materialID,queue:n??``,queuePosition:-1,operator:l}),a(null),t()}catch(e){p(Bt.isApiException(e)?e.response:e instanceof Error?e.message:String(e))}},children:[`Add To `,n??`Queue`,` `,o?` To Run Process ${o.process+1}`:``]}),f?(0,H.jsx)(q,{role:`alert`,children:f}):null]}):(0,H.jsx)(Y,{color:`primary`,onClick:()=>i(!0),children:`Add To Queue`})}function d4(){let e=R(br),t=z(q0),n=R(TI);return!e.allowChangeWorkorderAtLoadStation||n===null||n.materialID<0?null:(0,H.jsx)(Y,{color:`primary`,onClick:()=>t(!0),children:`Assign Workorder`})}var f4=(0,L.memo)(function(e){let[t,n]=(0,L.useState)(null),[r,i]=(0,L.useState)(null),[a,o]=(0,L.useState)(!1),[s,c]=(0,L.useState)(null),l=(0,L.useCallback)(function(){n(null),i(null),o(!1),c(null)},[n,i]);return(0,H.jsx)(EW,{onClose:l,allowNote:!0,highlightProcsGreaterOrEqualTo:r?.process??void 0,extraDialogElements:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(mX,{st:t,setState:n}),r===null?null:(0,H.jsx)(uX,{st:r,setState:i}),a?(0,H.jsx)(QY,{selectedQueue:s,setSelectedQueue:c,queueNames:e.queues}):void 0]}),buttons:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(l4,{pallet:e.pallet}),(0,H.jsx)(IY,{}),(0,H.jsx)(aX,{}),(0,H.jsx)(oX,{onClose:l}),(0,H.jsx)(t2,{}),(0,H.jsx)(u4,{toQueue:s,queues:e.queues,onClose:l,showAddToQueue:a,setShowAddToQueue:o}),(0,H.jsx)(hX,{st:t,setState:n,onClose:l}),(0,H.jsx)(dX,{st:r,setState:i,onClose:l,loadStation:!0}),(0,H.jsx)(d4,{})]})})});function p4({numMatCols:e,maxNumFaces:t,horizontal:n,showMatInCompleted:r}){let i=``,a=``;if(t<=0&&(t=1),n){let n=``;for(let t=0;t<e;t++)a+=`minmax(16em, max-content) `,n+=`mat${t} `;a+=`1fr `,r?a+=`minmax(16em, max-content)`:a+=` 4.5em`;let o=`minmax(calc((100vh - 64px) / ${t}), max-content)`;for(let e=0;e<t;e++){let r=e===t-1?`1fr`:o;i+=`"${n} palface${e} completed" ${r}\n`}}else{a=`1fr`;for(let e=0;e<t;e++)i+=`"palface${e}" minmax(134px, max-content)\n`;for(let t=0;t<e;t++)i+=`"mat${t}" minmax(134px, max-content)\n`;i+=`"completed" minmax(134px, max-content)
|
|
350
|
+
`}return`${i} / ${a}`}function m4(e){let t=ok(R(br).basketName),n=t.endsWith(`s`)?t:`${t}s`,r=R(NO),i=R(Yq),a=(0,L.useMemo)(()=>e4(e.loadNum,e.queues,r,i),[r,e.loadNum,e.queues,i]),o=[...Q.of(a.queues).sortBy(([e,t])=>e).map(([e,t])=>({kind:`queue`,label:e,material:t})).toRArray()];if(a.baskets.size>0){let e=Q.of(a.baskets).filter(([e,t])=>e!==a.activeBasket?.basketId).sortBy(([e,t])=>e).map(([e,n])=>({basketId:e,label:`${t} ${e}`,material:n})).toRArray();e.length>0&&o.push({kind:`baskets`,label:n,baskets:e})}(a.queues.size===0&&a.baskets.size===0||a.freeLoadingMaterial.length>0)&&o.push({kind:`free`,label:`Material`,material:{mats:a.freeLoadingMaterial,hiddenCnt:0}});let s=o.length+ +!!e.completed,c=Jw(s<=1?`(min-width: 720px)`:s===2?`(min-width: 1030px)`:`(min-width: 1320px)`),l=p4({numMatCols:o.length,maxNumFaces:a.face.size,horizontal:c,showMatInCompleted:e.completed});return(0,H.jsx)(f2,{hideArrows:!c,whiteBackground:e.whiteBackground,children:(0,H.jsxs)(J,{component:`main`,sx:{width:`100%`,display:`grid`,gridTemplate:l,minHeight:{xs:`calc(100vh - 64px - 32px)`,sm:`calc(100vh - 64px - 40px)`,md:`calc(100vh - 64px)`},padding:c?void 0:`8px`},children:[o.map((e,t)=>(0,H.jsx)(J,{"data-testid":Q2(e),sx:{gridArea:`mat${t}`,padding:`8px`,borderRight:c?`1px solid black`:void 0,borderBottom:c?void 0:`1px solid black`},children:(0,H.jsx)(o4,{data:a,region:e})},t)),a.face.keysToAscLazySeq().map((t,n)=>(0,H.jsx)(J,{sx:{marginLeft:`15px`,gridArea:`palface${n}`,padding:`8px`,borderTop:a.pallet&&n!==0?`1px solid black`:void 0},children:(0,H.jsx)(r4,{data:a,faceNum:t,loadNum:e.loadNum,submitBasketLoadStationCommand:e.submitBasketLoadStationCommand})},t)),(0,H.jsx)(J,{"data-testid":`load-station-completed`,sx:{borderLeft:c?`1px solid black`:void 0,borderTop:c?void 0:`1px solid black`,gridArea:`completed`},children:(0,H.jsx)(c4,{fillViewPort:c,showMaterial:e.completed})}),(0,H.jsx)(t4,{loadData:a}),(0,H.jsx)(Z0,{}),(0,H.jsx)(n2,{}),(0,H.jsx)(f4,{pallet:a.pallet?.palletNum??null,queues:e.queues})]})})}function h4(e){let t=R(br);return JI(ik(e.loadNum,t.loadStationNames)),(0,H.jsx)(m4,{...e})}function g4(e){let t=qI(),n=R(jO),r=R(TI),i=R(PI)?.process,[a,o]=Eie(),s=z(SI);if(r===null)return null;function c(t){r&&(a({mat:r,inspType:e.inspection_type,success:t,operator:n}),s(null))}let l=$t(r.partName,e.inspection_type,r.materialID,null,i,n);return(0,H.jsxs)(H.Fragment,{children:[r.partName===``?void 0:t?(0,H.jsx)(Y,{color:`primary`,children:`Instructions`}):(0,H.jsx)(Y,{href:l,target:`bms-instructions`,color:`primary`,children:`Instructions`}),(0,H.jsx)(aX,{}),(0,H.jsx)(oX,{}),(0,H.jsxs)(Y,{color:`primary`,disabled:o,onClick:()=>c(!0),children:[`Mark `,e.inspection_type,` Success`]}),(0,H.jsxs)(Y,{color:`primary`,disabled:o,onClick:()=>c(!1),children:[`Mark `,e.inspection_type,` Failed`]})]})}function _4({focusInspectionType:e}){let t=R(FI);return t===null||e||t.signaledInspections.length===1?null:(0,H.jsx)(H.Fragment,{children:t.signaledInspections.map(e=>(0,H.jsx)(ly,{children:(0,H.jsx)(g4,{inspection_type:e})},e))})}function v4({focusInspectionType:e}){let t=R(FI),n;if(e)n=e;else if(t&&t.signaledInspections.length===1)n=t.signaledInspections[0];else return null;return(0,H.jsx)(g4,{inspection_type:n})}var y4=(0,L.memo)(function(e){return(0,H.jsx)(EW,{allowNote:!0,extraDialogElements:(0,H.jsx)(_4,{focusInspectionType:e.focusInspectionType}),buttons:(0,H.jsx)(v4,{focusInspectionType:e.focusInspectionType})})});function b4({focusInspectionType:e,forceSingleColumn:t}){let n=R(fL),r=(0,L.useMemo)(()=>S4(n.matsById,e),[n,e]);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(J,{sx:{display:t?void 0:{md:`flex`}},children:[(0,H.jsxs)(J,{sx:{padding:`8px`,minHeight:t?void 0:{md:`calc(100vh - 64px)`},width:t?`100%`:{md:`50vw`},borderRight:t?void 0:{md:`1px solid black`},borderBottom:t?`1px solid black`:{sm:`1px solid black`,md:`none`}},children:[(0,H.jsx)(q,{variant:`h4`,children:`Parts to Inspect`}),(0,H.jsx)(J,{sx:{display:`flex`,justifyContent:`flex-start`,flexWrap:`wrap`},children:r.waiting_to_inspect.map((t,n)=>(0,H.jsx)(dW,{mat:t,focusInspectionType:e,hideWarningIcon:!0},n))})]}),(0,H.jsxs)(J,{sx:{padding:`8px`,width:t?`100%`:{md:`50vw`}},children:[(0,H.jsx)(q,{variant:`h4`,children:`Recently Inspected`}),(0,H.jsx)(J,{sx:{display:`flex`,justifyContent:`flex-start`,flexWrap:`wrap`},children:r.inspect_completed.map((t,n)=>(0,H.jsx)(dW,{mat:t,focusInspectionType:e,hideWarningIcon:!0},n))})]})]}),(0,H.jsx)(y4,{focusInspectionType:e})]})}function x4(e){let t=e.completedInspections;return t===void 0?e.signaledInspections.length===0:Q.of(e.signaledInspections).every(e=>e in t)}function S4(e,t){let n=LT(new Date,-7),r=LT(new Date,-1),i=Array.from(t===null?e.valuesToLazySeq().filter(e=>e.last_unload_time!==void 0&&e.last_unload_time>=n&&e.signaledInspections.length>0&&!x4(e)):e.valuesToLazySeq().filter(e=>e.last_unload_time!==void 0&&e.last_unload_time>=n&&e.signaledInspections.includes(t)&&(e.completedInspections||{})[t]===void 0));i.sort((e,t)=>e.last_unload_time&&t.last_unload_time?t.last_unload_time.getTime()-e.last_unload_time.getTime():0);let a=Array.from(t===null?e.valuesToLazySeq().filter(e=>e.completed_inspect_time!==void 0&&e.completed_inspect_time>=r&&e.signaledInspections.length>0&&x4(e)):e.valuesToLazySeq().filter(e=>e.completed_inspect_time!==void 0&&e.completed_inspect_time>=r&&e.signaledInspections.includes(t)&&(e.completedInspections||{})[t]!==void 0));return a.sort((e,t)=>e.completed_inspect_time&&t.completed_inspect_time?t.completed_inspect_time.getTime()-e.completed_inspect_time.getTime():0),{waiting_to_inspect:i,inspect_completed:a}}function C4(e){return JI(e.focusInspectionType&&e.focusInspectionType!==``?`Inspection ${e.focusInspectionType}`:`Inspection`),(0,H.jsx)(J,{component:`main`,sx:{backgroundColor:`#F8F8F8`,minHeight:{sm:`calc(100vh - 64px - 40px)`,md:`calc(100vh - 64px)`}},children:(0,H.jsx)(b4,{...e})})}function w4(){let e=R(br),t=R(TI),[n,r]=LI(),i=R(jO),[a,o]=B(SI);if(t===null)return null;let s=e.requireScanAtCloseout,c=e.requireWorkorderBeforeAllowCloseoutComplete,l;s?a!==null&&(a.type===`Barcode`||a.type===`ManuallyEnteredSerial`)||(l=`Scan Required`):c&&(t.workorderId===void 0||t.workorderId===``)&&(l=`No workorder assigned`);function u(e){t!==null&&(n({mat:t,operator:i,failed:e}),o(null))}return l?(0,H.jsx)(X,{title:l,placement:`top`,children:(0,H.jsx)(`div`,{children:(0,H.jsx)(Y,{color:`primary`,disabled:!0,children:`Close Out`})})}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Y,{color:`primary`,disabled:r,onClick:()=>u(!0),children:`Fail Close Out`}),(0,H.jsx)(Y,{color:`primary`,disabled:r,onClick:()=>u(!1),children:`Pass Close Out`})]})}function T4(){let e=qI(),t=R(TI),n=R(jO),r=R(PI)?.process;if(t===null||t.partName===``)return null;let i=$t(t.partName,`closeout`,t.materialID,null,r,n);return e?(0,H.jsx)(Y,{color:`primary`,children:`Instructions`}):(0,H.jsx)(Y,{href:i,target:`bms-instructions`,color:`primary`,children:`Instructions`})}function E4(){let e=z(q0);return R(TI)===null?null:(0,H.jsx)(Y,{color:`primary`,onClick:()=>e(!0),children:`Assign Workorder`})}var D4=(0,L.memo)(function(){return(0,H.jsx)(EW,{allowNote:!0,buttons:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(T4,{}),(0,H.jsx)(aX,{}),(0,H.jsx)(oX,{}),(0,H.jsx)(E4,{}),(0,H.jsx)(w4,{})]})})}),O4=P(new Date);O4.onMount=e=>{e(new Date);let t=setInterval(()=>{e(new Date)},1e3*60);return()=>clearInterval(t)};function k4({forceSingleColumn:e}){let t=R(fL),n=R(O4),r=(0,L.useMemo)(()=>{let e=BT(n,-48),r=BT(n,-2),i=[],a=[];for(let n of t.matsById.values())n.completed_last_proc_machining===!0&&n.last_unload_time&&n.last_unload_time>=e&&(n.closeout_completed===void 0?i.push(n):n.closeout_completed>=r&&a.push(n));return i.sort((e,t)=>e.last_unload_time&&t.last_unload_time?e.last_unload_time.getTime()-t.last_unload_time.getTime():0),a.sort((e,t)=>e.last_unload_time&&t.last_unload_time?t.last_unload_time.getTime()-e.last_unload_time.getTime():0),{uncompleted:i,closed:a}},[t,n]);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(J,{sx:{display:e?void 0:{md:`flex`}},children:[(0,H.jsxs)(J,{sx:{padding:`8px`,minHeight:e?void 0:{md:`calc(100vh - 64px)`},width:e?`100%`:{md:`50vw`},borderRight:e?void 0:{md:`1px solid black`},borderBottom:e?`1px solid black`:{sm:`1px solid black`,md:`none`}},children:[(0,H.jsx)(q,{variant:`h4`,children:`Recently Completed`}),(0,H.jsx)(J,{sx:{display:`flex`,justifyContent:`flex-start`,flexWrap:`wrap`},children:r.uncompleted.map((e,t)=>(0,H.jsx)(dW,{mat:e},t))})]}),(0,H.jsxs)(J,{sx:{padding:`8px`,width:e?`100%`:{md:`50vw`}},children:[(0,H.jsx)(q,{variant:`h4`,children:`Recently Closed Out`}),(0,H.jsx)(J,{sx:{display:`flex`,justifyContent:`flex-start`,flexWrap:`wrap`},children:r.closed.map((e,t)=>(0,H.jsx)(dW,{mat:e},t))})]})]}),(0,H.jsx)(Z0,{}),(0,H.jsx)(D4,{})]})}function A4(){return JI(`Close Out`),(0,H.jsx)(J,{component:`main`,sx:{backgroundColor:`#F8F8F8`,minHeight:{sm:`calc(100vh - 64px - 40px)`,md:`calc(100vh - 64px)`}},children:(0,H.jsx)(k4,{})})}function j4(e,t){return e.mapValues(e=>{let n=Q.of(e.recentCycles).flatMap(e=>e.tools).filter(e=>!e.toolChangedDuringMiddleOfCycle).groupBy(e=>e.toolName).map(([e,t])=>({toolName:e,cycleUsageMinutes:Q.of(t).sumBy(e=>e.cycleUsageMinutes)/t.length,cycleUsageCnt:Q.of(t).sumBy(e=>e.cycleUsageCnt)/t.length,toolChangedDuringMiddleOfCycle:!1})).toMutableArray();return t&&n.sort((e,t)=>e.toolName.localeCompare(t.toolName)),{tools:n}})}var M4=class{constructor(e,t){this.statGroup=e,this.operation=t}compare(e){let t=this.statGroup.localeCompare(e.statGroup);return t===0?this.operation.localeCompare(e.operation):t}hash(){return yD(this.statGroup,this.operation)}toString(){return`{statGroup: ${this.statGroup}, operation: ${this.operation}}`}};function N4(e,t){let n=0,r=0;for(let i of Q.of(e).filter(e=>e.machines.has(t)??!1))n+=i.quantity*(i.scheduledUseMinutes/i.scheduledUseCnt),r+=i.quantity;return r===0?0:n/r}function P4(e,t,n){let r=iO.empty();for(let[t,n]of Q.ofObject(e.jobs)){let i=n.cycles??0;for(let a=0;a<n.procsAndPaths.length;a++){let o=0,s=iO.empty();for(let r=0;r<n.procsAndPaths[a].paths.length;r++){o+=n.completed?.[a]?.[r]??0;let i=n.procsAndPaths[a].paths[r];for(let n=0;n<i.stops.length;n+=1){let o=i.stops[n],c=Q.of(e.material).filter(e=>e.jobUnique===t&&e.process==a+1&&e.path===r+1&&(e.action.type===st.UnloadToCompletedMaterial||e.action.type===st.UnloadToInProcess||e.lastCompletedMachiningRouteStopIndex!==void 0&&e.lastCompletedMachiningRouteStopIndex>n)).length();o.program!==void 0&&o.program!==``&&(s=s.modify(new M4(o.stationGroup,o.program),e=>(e??0)+c))}}for(let[e,t]of s)r=r.modify(new VO(n.partName,e.statGroup,e.operation),e=>(e??0)+i-o-t)}}let i=Q.of(j4(n,!1)).flatMap(([e,t])=>{let i=window.bmsToolReportOverridePartQuantity??r.get(e);return i!==void 0&&i>0?t.tools.map(t=>({toolName:t.toolName,part:{partAndProg:e,quantity:i,scheduledUseMinutes:t.cycleUsageMinutes,scheduledUseCnt:t.cycleUsageCnt===0?1:t.cycleUsageCnt,machines:n.get(e)?.machines??QD.empty()}})):[]}).sortBy(e=>e.part.partAndProg.part,e=>e.part.partAndProg.operation).toLookup(e=>e.toolName,e=>e.part);return Q.of(t).orderedGroupBy(e=>e.toolName).map(([e,t])=>{let n=!1;return{toolName:e,machines:Q.of(t).sortBy(e=>e.machineGroupName,e=>e.machineNum,e=>e.pocket).map(t=>{let r=t.currentUse!==null&&t.currentUse!==void 0&&t.currentUse!==``?BO(t.currentUse):null,a=t.totalLifeTime!==null&&t.totalLifeTime!==void 0&&t.totalLifeTime!==``?BO(t.totalLifeTime):null,o=rk(t.machineGroupName,t.machineNum),s=t.currentUseCount??null,c=t.totalLifeCount??null;if(s===null&&c===null){let t=N4(i.get(e)??[],o);t>0&&(n=!0,s=r===null?null:r/t,c=a===null?null:a/t)}return{machineName:o,pocket:t.pocket,serial:t.serial,currentUseMinutes:r,lifetimeMinutes:a,remainingMinutes:r!==null&&a!==null?Math.max(0,a-r):null,currentUseCnt:s??null,lifetimeCnt:c??null,remainingCnt:s!==null&&c!==null?Math.max(0,c-s):null}}).toRArray(),parts:i.get(e)??[],estimatedToolCounts:n}}).toRArray()}var F4=P(null),I4=P(e=>e(F4)?.time??null,async(e,t,n)=>{t(F4,{tools:await Gt.getToolsInMachines(),time:n})}),L4=P(e=>{let t=e(F4);return t===null?[]:Q.of(t.tools).toOrderedSet(e=>rk(e.machineGroupName,e.machineNum)).toAscLazySeq().toRArray()}),R4=P(e=>{let t=e(F4);if(t===null)return null;let n=e(NO),r=e(RL);return P4(n,t.tools,r)}),z4=P(e=>{let t=e(R4);return t?Q.of(t).flatMap(e=>e.machines).some(e=>e.serial!=null&&e.serial!==``):!1}),B4=P(e=>{let t=e(R4);return t?Q.of(t).some(e=>e.estimatedToolCounts):!1});function V4(e){let t=Q.of(e).flatMap(e=>e.machines).some(e=>e.currentUseMinutes!=null),n=Q.of(e).flatMap(e=>e.machines).some(e=>e.currentUseCnt!=null),r=`<table>
|
|
351
351
|
<thead><tr>`;r+=`<th>Tool</th><th>Machine</th><th>Pocket</th>`,t&&(r+=`<th>Scheduled Use (min)</th><th>Current Use (min)</th><th>Lifetime (min)</th><th>Remaining Life (min)</th>`),n&&(r+=`<th>Scheduled Use (cnt)</th><th>Current Use (cnt)</th><th>Lifetime (cnt)</th><th>Remaining Life (cnt)</th>`),r+=`</tr></thead>
|
|
352
352
|
<tbody>
|
|
353
353
|
`;for(let i of e)for(let e of i.machines){if(r+=`<tr><td>${i.toolName}</td><td>${e.machineName}</td><td>${e.pocket}</td>`,t){let t=Q.of(i.parts).sumBy(e=>e.scheduledUseMinutes*e.quantity);r+=`<td>`+t.toFixed(1)+`</td>`,r+=`<td>`+(e.currentUseMinutes?e.currentUseMinutes.toFixed(1):``)+`</td>`,r+=`<td>`+(e.lifetimeMinutes?e.lifetimeMinutes.toFixed(1):``)+`</td>`,r+=`<td>`+(e.remainingMinutes?e.remainingMinutes.toFixed(1):``)+`</td>`}if(n){let t=Q.of(i.parts).sumBy(e=>e.scheduledUseCnt*e.quantity);r+=`<td>`+t.toFixed(1)+`</td>`,r+=`<td>`+(e.currentUseCnt?e.currentUseCnt.toFixed(1):``)+`</td>`,r+=`<td>`+(e.lifetimeCnt?e.lifetimeCnt.toFixed(1):``)+`</td>`,r+=`<td>`+(e.remainingCnt?e.remainingCnt.toFixed(1):``)+`</td>`}r+=`</tr>
|
|
354
|
-
`}return r+=`</tbody></table>`,r}function H4(){let e=ge();return(0,L.useCallback)(()=>{let t=e.get(R4);t&&Ak(V4(t))},[e])}function U4(e,t,n,r,i){let a=j4(e,!0),o=e.keysToLazySeq().toRMap(e=>[e.operation,e],(e,t)=>t),s=Q.of(r);i!=null&&(s=s.filter(e=>i.has(e.programName)));let c=n?.valuesToLazySeq().flatMap(e=>Q.of(e.procsAndPaths).flatMap(e=>e.paths).flatMap(t=>Q.of(t.stops).collect(n=>{let r=BO(n.expectedCycleTime);return n.program&&r>0?{program:n.program,plannedMins:r/t.partsPerPallet,start:e.routeStartUTC}:null}))).toOrderedMap(e=>[e.program,e],(e,t)=>e.start>t.start?e:t),l=s.map(e=>{let n=o.get(e.programName);return{programName:e.programName,cellControllerProgramName:e.cellControllerProgramName,comment:e.comment??null,revision:e.revision??null,partName:n?.part??null,statisticalCycleTime:n?t.get(n)??null:null,toolUse:n?a.get(n)??null:null,plannedMins:c?.get(e.programName)?.plannedMins??null}}).toRArray();return{time:new Date,programs:l,hasRevisions:l.some(e=>e.revision!==null),cellNameDifferentFromProgName:l.some(e=>e.cellControllerProgramName!==e.programName)}}var W4=P(`AllPrograms`),G4=P(null),K4=P(e=>e(G4)?.time??null,async(e,t,n)=>{t(G4,{progs:await Gt.getProgramsInCellController(),time:n})}),q4=P(e=>{if(e(K4)===null)return null;let t=e(W4),n=null;if(t===`ActivePrograms`){let t=e(NO);n=new Set(Q.ofObject(t.jobs).flatMap(([,e])=>e.procsAndPaths).flatMap(e=>e.paths).flatMap(e=>e.stops).filter(e=>e.program!==null&&e.program!==void 0&&e.program!==``).map(e=>e.program??``))}let r=e(G4);return r===null?null:U4(e(RL),e(UO),e(sO),r.progs,n)}),J4=P(null),Y4=P(async e=>{let t=e(J4);return t===null?``:t.revision===null?await Gt.getLatestProgramRevisionContent(t.programName):await Gt.getProgramRevisionContent(t.programName,t.revision)}),X4=P(null),Z4=new Intl.NumberFormat(`en-US`,{minimumFractionDigits:0,maximumFractionDigits:1}),Q4=G(Vw,{shouldForwardProp:e=>e.toString()[0]!==`$`})(({theme:e,$noBorderBottom:t,$highlightedRow:n,$noticeRow:r})=>({...t&&{"& > *":{borderBottom:`unset`}},[e.breakpoints.up(`lg`)]:{"& td:not(:last-child), & th:not(:last-child)":{whiteSpace:`nowrap`},"& td:last-child, & th:last-child":{width:`100%`}},backgroundColor:n?`#BDBDBD`:r?`#E0E0E0`:void 0})),$4=G(Vw,{shouldForwardProp:e=>e.toString()[0]!==`$`})(({$borderBottom:e})=>({...e&&{"&:not(:last-child)":{borderBottom:`2px solid black`}}})),e3=G(`span`)({fontSize:`x-large`,fontWeight:`lighter`});function t3({min:e,cnt:t,showZero:n,extraMin:r,extraCnt:i}){e??=0,t??=0;let a=r?(0,H.jsx)(X,{title:r,children:(0,H.jsxs)(`span`,{children:[e.toFixed(1),` min`]})}):e.toFixed(1)+` min`,o=i?(0,H.jsx)(X,{title:i,children:(0,H.jsxs)(`span`,{children:[Z4.format(t),` cnt`]})}):Z4.format(t)+` cnt`;return e===0&&t===0?n?`0`:``:e>0&&t===0?a:e===0&&t>0?o:(0,H.jsxs)(`span`,{children:[a,` `,(0,H.jsx)(e3,{children:`|`}),` `,o]})}function n3({tool:e,machine:t}){let n=t?Q.of(e.parts).filter(e=>e.machines.has(t)):Q.of(e.parts);return(0,H.jsxs)(jw,{size:`small`,sx:{width:`auto`,ml:`10em`,mb:`1em`},children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:`Part`}),(0,H.jsx)(Z,{children:`Program`}),t?void 0:(0,H.jsx)(Z,{children:`Machines`}),(0,H.jsx)(Z,{align:`right`,children:`Quantity`}),(0,H.jsx)(Z,{align:`right`,children:`Use/Cycle (min)`}),(0,H.jsx)(Z,{align:`right`,children:`Use/Cycle (cnt)`})]})}),(0,H.jsx)(Pw,{children:n.isEmpty()?(0,H.jsx)(Vw,{children:(0,H.jsx)(Z,{colSpan:5,children:`No programs use this machine`})}):n.map((e,n)=>(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:(0,H.jsxs)(J,{sx:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(XU,{part:e.partAndProg.part,size:20}),(0,H.jsx)(`span`,{children:e.partAndProg.part})]})}),(0,H.jsx)(Z,{children:e.partAndProg.operation}),t?void 0:(0,H.jsx)(Z,{children:e.machines.foldl((e,t)=>(e.length>0?e+`, `:``)+t,``)}),(0,H.jsx)(Z,{align:`right`,children:e.quantity}),(0,H.jsx)(Z,{align:`right`,children:e.scheduledUseMinutes>0?e.scheduledUseMinutes.toFixed(1):``}),(0,H.jsx)(Z,{align:`right`,children:e.scheduledUseCnt>0?Z4.format(e.scheduledUseCnt):``})]},n))})]})}function r3({machines:e}){let t=R(z4),n=Q.of(e).toLookupOrderedMap(e=>e.machineName,e=>e.pocket),r=n.size>1&&n.valuesToAscLazySeq().some(e=>e.size>1);return(0,H.jsxs)(jw,{size:`small`,sx:{width:`auto`,ml:`10em`,mb:`1em`},children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:`Machine`}),(0,H.jsx)(Z,{align:`right`,children:`Pocket`}),t?(0,H.jsx)(Z,{children:`Serial`}):void 0,(0,H.jsx)(Z,{align:`right`,children:`Current Use `}),(0,H.jsx)(Z,{align:`right`,children:`Lifetime `}),(0,H.jsx)(Z,{align:`right`,children:`Remaining Use `})]})}),(0,H.jsxs)(Pw,{children:[n.toAscLazySeq().map(([e,i])=>(0,H.jsxs)(L.Fragment,{children:[i.valuesToAscLazySeq().map((e,n)=>(0,H.jsxs)($4,{$borderBottom:r&&i.size===1,children:[(0,H.jsx)(Z,{children:e.machineName}),(0,H.jsx)(Z,{align:`right`,children:e.pocket}),t?(0,H.jsx)(Z,{children:e.serial??``}):void 0,(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(t3,{min:e.currentUseMinutes,cnt:e.currentUseCnt})}),(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(t3,{min:e.lifetimeMinutes,cnt:e.lifetimeCnt})}),(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(t3,{min:e.remainingMinutes,cnt:e.remainingCnt,showZero:!0})})]},n)),n.size>1&&i.size>1?(0,H.jsxs)($4,{$borderBottom:!0,children:[(0,H.jsx)(Z,{colSpan:t?4:3}),(0,H.jsx)(Z,{children:`Subtotal`}),(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(t3,{min:i.valuesToAscLazySeq().sumBy(e=>e.remainingMinutes??0),cnt:i.valuesToAscLazySeq().sumBy(e=>e.remainingCnt??0)})})]}):void 0]},e)),(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{colSpan:t?4:3}),(0,H.jsx)(Z,{children:`Total`}),(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(t3,{min:Q.of(e).sumBy(e=>e.remainingMinutes??0),cnt:Q.of(e).sumBy(e=>e.remainingCnt??0)})})]})]})]})}function i3(){let e=R(B4);return(0,H.jsxs)(Q4,{children:[(0,H.jsx)(Z,{}),(0,H.jsx)(Z,{children:`Tool`}),(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(X,{title:`Expected use for all currently scheduled parts.`+(e?` Counts are estimates.`:``),children:(0,H.jsx)(`span`,{children:`Scheduled Use`})})}),(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(X,{title:`Remaining use summed over all machines which have a scheduled part.`+(e?` Counts are estimates.`:``),children:(0,H.jsx)(`span`,{children:`Total Remaining Use`})})}),(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(X,{title:`Machine with the least remaining use.`+(e?` Counts are estimates.`:``),children:(0,H.jsx)(`span`,{children:`Smallest Remaining Use`})})}),(0,H.jsx)(Z,{})]})}function a3({tool:e}){let[t,n]=(0,L.useState)(!1),r=Q.of(e.machines).filter(t=>e.parts.some(e=>e.machines.has(t.machineName))),i=Q.of(e.parts).sumBy(e=>e.scheduledUseMinutes*e.quantity),a=Q.of(e.parts).sumBy(e=>e.scheduledUseCnt*e.quantity),o=r.sumBy(e=>e.remainingMinutes??0),s=r.sumBy(e=>e.remainingCnt??0),c=r.groupBy(e=>e.machineName).map(([e,t])=>({mach:e,remainMin:Q.of(t).sumBy(e=>e.remainingMinutes??0)})).minBy(({remainMin:e})=>e),l=r.groupBy(e=>e.machineName).map(([e,t])=>({mach:e,remainCnt:Q.of(t).sumBy(e=>e.remainingCnt??0)})).minBy(({remainCnt:e})=>e);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(Q4,{$noBorderBottom:!0,$highlightedRow:i>o||a>s,$noticeRow:i<=o&&a<=s&&(c&&i>c.remainMin||l&&a>l.remainCnt),children:[(0,H.jsx)(Z,{children:(0,H.jsx)(Um,{size:`small`,onClick:()=>n(!t),children:t?(0,H.jsx)(mT,{}):(0,H.jsx)(dT,{})})}),(0,H.jsx)(Z,{children:e.toolName}),(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(t3,{min:i,cnt:a})}),(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(t3,{min:o,cnt:s})}),(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(t3,{min:c?.remainMin,cnt:l?.remainCnt,showZero:!0,extraMin:c?.mach,extraCnt:l?.mach})}),(0,H.jsx)(Z,{})]}),(0,H.jsx)(Vw,{children:(0,H.jsx)(Z,{sx:{pb:`0`,pt:`0`},colSpan:6,children:(0,H.jsx)(zp,{in:t,timeout:`auto`,unmountOnExit:!0,children:(0,H.jsxs)(J,{sx:{display:`flex`,flexWrap:`wrap`,justifyContent:`space-around`,ml:`1em`,mr:`1em`},children:[(0,H.jsx)(`div`,{children:(0,H.jsx)(r3,{machines:e.machines})}),e.parts.length===0?void 0:(0,H.jsx)(`div`,{children:(0,H.jsx)(n3,{tool:e})})]})})})})]})}function o3({machine:e}){let t=R(B4),n=R(z4);return(0,H.jsxs)(Q4,{children:[(0,H.jsx)(Z,{}),(0,H.jsxs)(Z,{children:[`Tool In `,e]}),(0,H.jsx)(Z,{align:`right`,children:`Pocket`}),n?(0,H.jsx)(Z,{children:`Serial`}):void 0,(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(X,{title:`Expected use for all currently scheduled parts.`+(t?` Counts are estimates.`:``),children:(0,H.jsx)(`span`,{children:`Scheduled Use`})})}),(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(X,{title:`Current recorded usage of this tool.`+(t?` Counts are estimates.`:``),children:(0,H.jsx)(`span`,{children:`Current Use`})})}),(0,H.jsxs)(Z,{align:`right`,children:[(0,H.jsx)(X,{title:`Current configured lifetime of this tool.`+(t?` Counts are estimates.`:``),children:(0,H.jsx)(`span`,{children:`Lifetime`})}),` `]}),(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(X,{title:`Lifetime minus current use.`+(t?` Counts are estimates.`:``),children:(0,H.jsx)(`span`,{children:`Remaining Use`})})}),(0,H.jsx)(Z,{})]})}function s3({report:e,pocket:t}){let[n,r]=(0,L.useState)(!1),i=R(z4),a=i?9:8,o=Q.of(e.parts).filter(e=>e.machines.has(t.machineName)).sumBy(e=>e.scheduledUseMinutes*e.quantity),s=Q.of(e.parts).filter(e=>e.machines.has(t.machineName)).sumBy(e=>e.scheduledUseCnt*e.quantity);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(Q4,{$noBorderBottom:!0,children:[(0,H.jsx)(Z,{children:(0,H.jsx)(Um,{size:`small`,onClick:()=>r(!n),children:n?(0,H.jsx)(mT,{}):(0,H.jsx)(dT,{})})}),(0,H.jsx)(Z,{children:e.toolName}),(0,H.jsx)(Z,{align:`right`,children:t.pocket}),i?(0,H.jsx)(Z,{children:t.serial??``}):void 0,(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(t3,{min:o,cnt:s})}),(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(t3,{min:t.currentUseMinutes,cnt:t.currentUseCnt})}),(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(t3,{min:t.lifetimeMinutes,cnt:t.lifetimeCnt})}),(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(t3,{min:t.remainingMinutes,cnt:t.remainingCnt})}),(0,H.jsx)(Z,{})]}),(0,H.jsx)(Vw,{children:(0,H.jsx)(Z,{sx:{pb:`0`,pt:`0`},colSpan:a,children:(0,H.jsx)(zp,{in:n,timeout:`auto`,unmountOnExit:!0,children:(0,H.jsx)(n3,{tool:e,machine:t.machineName})})})})]})}var c3=`__Insight__FilterAnyMachine__`,l3=P(null);function u3(){let e=R(l3),t=R(R4);return t===null?(0,H.jsx)(`div`,{}):(0,H.jsxs)(jw,{stickyHeader:!0,children:[(0,H.jsx)(Lw,{children:e===null?(0,H.jsx)(i3,{}):(0,H.jsx)(o3,{machine:e})}),(0,H.jsx)(Pw,{children:t.map(t=>e===null?(0,H.jsx)(a3,{tool:t},t.toolName):(0,H.jsx)(L.Fragment,{children:t.machines.filter(t=>t.machineName===e).map(e=>(0,H.jsx)(s3,{report:t,pocket:e},e.pocket))},t.toolName))})]})}function d3(){let[e,t]=B(l3),[n,r]=B(I4),[i,a]=(0,L.useState)(!1),o=R(L4),s=H4(),c=qI();function l(){a(!0),r(new Date).catch(console.log).finally(()=>a(!1))}return c?(0,H.jsx)(`div`,{}):n===null?(0,H.jsx)(`main`,{style:{margin:`2em`,display:`flex`,justifyContent:`center`},children:(0,H.jsx)(hy,{color:`secondary`,size:`large`,variant:`extended`,style:{margin:`2em`},onClick:l,disabled:i,children:(0,H.jsxs)(H.Fragment,{children:[i?(0,H.jsx)(Lm,{size:10,style:{marginRight:`1em`}}):(0,H.jsx)(vT,{fontSize:`inherit`,style:{marginRight:`1em`}}),`Load Tools`]})})}):(0,H.jsxs)(J,{component:`nav`,sx:{display:`flex`,minHeight:`2.5em`,alignItems:`center`,maxWidth:`calc(100vw - 24px - 24px)`},children:[(0,H.jsx)(X,{title:`Refresh Tools`,children:(0,H.jsx)(`div`,{children:(0,H.jsx)(Um,{onClick:l,disabled:i,size:`small`,children:i?(0,H.jsx)(Lm,{size:10}):(0,H.jsx)(vT,{fontSize:`inherit`})})})}),(0,H.jsxs)(`span`,{style:{marginLeft:`1em`},children:[`Tools from `,(0,H.jsx)(Kz,{date:n})]}),(0,H.jsx)(`div`,{style:{flexGrow:`1`}}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,displayEmpty:!0,value:e??c3,style:{marginLeft:`1em`},onChange:e=>{e.target.value===c3?t(null):t(e.target.value)},children:[(0,H.jsx)(Hx,{value:c3,children:(0,H.jsx)(`em`,{children:`All Machines`})}),o.map(e=>(0,H.jsx)(Hx,{value:e,children:(0,H.jsx)(`div`,{style:{display:`flex`,alignItems:`center`},children:(0,H.jsx)(`span`,{style:{marginRight:`1em`},children:e})})},e))]})}),(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{style:{height:`25px`,paddingTop:0,paddingBottom:0},onClick:s,size:`large`,children:(0,H.jsx)(uT,{})})})]})}function f3(){return JI(`Tool Report`),(0,H.jsxs)(J,{sx:{paddingLeft:`24px`,paddingRight:`24px`,paddingTop:`10px`},children:[(0,H.jsx)(d3,{}),(0,H.jsx)(`main`,{children:(0,H.jsx)(zU,{children:(0,H.jsx)(u3,{})})})]})}var p3=G(Vw)(()=>({"& > *":{borderBottom:`unset`}}));function m3(e){if(e.length===0)return``;let t=e.lastIndexOf(`\\`);return t>=0&&t<e.length-2?e.substr(t+1):e}var h3=new Intl.NumberFormat(`en-US`,{maximumFractionDigits:2});function g3(e){let[t,n]=(0,L.useState)(!1),r=z(J4),i=z(X4),a=8+ +!!e.showCellCtrlCol+ +!!e.showRevCol,o=e.program.toolUse!==null&&e.program.toolUse.tools.length>0&&Q.of(e.program.toolUse.tools).some(e=>e.cycleUsageMinutes>0),s=e.program.toolUse!==null&&e.program.toolUse.tools.length>0&&Q.of(e.program.toolUse.tools).some(e=>e.cycleUsageCnt>0);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(p3,{children:[(0,H.jsx)(Z,{children:e.program.toolUse===null||e.program.toolUse.tools.length===0?void 0:(0,H.jsx)(Um,{size:`small`,onClick:()=>n(!t),children:t?(0,H.jsx)(mT,{}):(0,H.jsx)(dT,{})})}),(0,H.jsx)(Z,{children:m3(e.program.programName)}),e.showCellCtrlCol?(0,H.jsx)(Z,{children:e.program.cellControllerProgramName}):void 0,(0,H.jsx)(Z,{children:e.program.partName===null?void 0:(0,H.jsxs)(J,{sx:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(XU,{part:e.program.partName,size:20}),(0,H.jsx)(`span`,{children:e.program.partName})]})}),(0,H.jsx)(Z,{children:e.program.comment??``}),e.showRevCol?(0,H.jsx)(Z,{children:e.program.revision===null?``:e.program.revision.toFixed()}):void 0,(0,H.jsx)(Z,{align:`right`,children:e.program.statisticalCycleTime===null?``:e.program.statisticalCycleTime.medianMinutesForSingleMat.toFixed(2)}),(0,H.jsx)(Z,{align:`right`,children:e.program.statisticalCycleTime===null?``:e.program.statisticalCycleTime.MAD_aboveMinutes.toFixed(2)}),(0,H.jsx)(Z,{align:`right`,children:e.program.statisticalCycleTime===null?``:e.program.statisticalCycleTime.MAD_belowMinutes.toFixed(2)}),(0,H.jsx)(Z,{align:`right`,children:e.program.plannedMins===null?``:h3.format(e.program.plannedMins)}),(0,H.jsxs)(Z,{children:[(0,H.jsx)(X,{title:`Load Program Content`,children:(0,H.jsx)(Um,{size:`small`,onClick:()=>r(e.program),children:(0,H.jsx)(tT,{})})}),e.program.revision===null?void 0:(0,H.jsx)(X,{title:`Revision History`,children:(0,H.jsx)(Um,{size:`small`,onClick:()=>i(e.program),children:(0,H.jsx)(wre,{})})})]})]}),(0,H.jsx)(Vw,{children:(0,H.jsx)(Z,{sx:{pb:`0`,pt:`0`},colSpan:a,children:(0,H.jsx)(zp,{in:t,timeout:`auto`,unmountOnExit:!0,children:(0,H.jsx)(J,{sx:{mr:`1em`,ml:`3em`},children:e.program.toolUse===null||e.program.toolUse.tools.length===0?void 0:(0,H.jsxs)(jw,{size:`small`,sx:{width:`auto`,ml:`10em`,mr:`1em`},children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:`Tool`}),o?(0,H.jsx)(Z,{align:`right`,children:`Estimated Usage (min)`}):void 0,s?(0,H.jsx)(Z,{align:`right`,children:`Estimated Usage (count)`}):void 0]})}),(0,H.jsx)(Pw,{children:Q.of(e.program.toolUse.tools).map((e,t)=>(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:e.toolName}),o?(0,H.jsx)(Z,{align:`right`,children:e.cycleUsageMinutes===0?``:e.cycleUsageMinutes.toFixed(1)}):void 0,s?(0,H.jsx)(Z,{align:`right`,children:e.cycleUsageCnt===0?``:e.cycleUsageCnt.toFixed(1)}):void 0]},t))})]})})})})})]})}function _3(){let e=R(q4),[t,n]=(0,L.useState)(`ProgramName`),[r,i]=(0,L.useState)(`asc`);if(e===null)return(0,H.jsx)(`div`,{});let a=Q.of(e.programs).sortWith((e,n)=>{let i=0;switch(t){case`ProgramName`:i=m3(e.programName).localeCompare(m3(n.programName));break;case`CellProgName`:i=e.cellControllerProgramName.localeCompare(n.cellControllerProgramName);break;case`Comment`:i=e.comment===null&&n.comment===null?0:e.comment===null?1:n.comment===null?-1:e.comment.localeCompare(n.comment);break;case`Revision`:i=e.revision===null&&n.revision===null?0:e.revision===null?1:n.revision===null?-1:e.revision-n.revision;break;case`PartName`:i=e.partName===null&&n.partName===null?0:e.partName===null?1:n.partName===null?-1:e.partName.localeCompare(n.partName);break;case`MedianTime`:i=e.statisticalCycleTime===null&&n.statisticalCycleTime===null?0:e.statisticalCycleTime===null?1:n.statisticalCycleTime===null?-1:e.statisticalCycleTime.medianMinutesForSingleMat-n.statisticalCycleTime.medianMinutesForSingleMat;break;case`DeviationAbove`:i=e.statisticalCycleTime===null&&n.statisticalCycleTime===null?0:e.statisticalCycleTime===null?1:n.statisticalCycleTime===null?-1:e.statisticalCycleTime.MAD_aboveMinutes-n.statisticalCycleTime.MAD_aboveMinutes;break;case`DeviationBelow`:i=e.statisticalCycleTime===null&&n.statisticalCycleTime===null?0:e.statisticalCycleTime===null?1:n.statisticalCycleTime===null?-1:e.statisticalCycleTime.MAD_belowMinutes-n.statisticalCycleTime.MAD_belowMinutes;break;case`Planned`:i=e.plannedMins===null&&n.plannedMins===null?0:e.plannedMins===null?1:n.plannedMins===null?-1:e.plannedMins-n.plannedMins;break}return i===0?0:i<0&&r===`asc`||i>0&&r===`desc`?-1:1});function o(e){e===t?i(r===`asc`?`desc`:`asc`):n(e)}return(0,H.jsxs)(jw,{stickyHeader:!0,children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{}),(0,H.jsx)(Z,{sortDirection:t===`ProgramName`&&r,children:(0,H.jsx)(Uw,{active:t===`ProgramName`,direction:r,onClick:()=>o(`ProgramName`),children:`Program Name`})}),e.cellNameDifferentFromProgName?(0,H.jsx)(Z,{sortDirection:t===`CellProgName`&&r,children:(0,H.jsx)(Uw,{active:t===`CellProgName`,direction:r,onClick:()=>o(`CellProgName`),children:`Cell Controller Program`})}):void 0,(0,H.jsx)(Z,{sortDirection:t===`PartName`&&r,children:(0,H.jsx)(Uw,{active:t===`PartName`,direction:r,onClick:()=>o(`PartName`),children:`Part`})}),(0,H.jsx)(Z,{sortDirection:t===`Comment`&&r,children:(0,H.jsx)(Uw,{active:t===`Comment`,direction:r,onClick:()=>o(`Comment`),children:`Comment`})}),e.hasRevisions?(0,H.jsx)(Z,{sortDirection:t===`Revision`&&r,children:(0,H.jsx)(Uw,{active:t===`Revision`,direction:r,onClick:()=>o(`Revision`),children:`Revision`})}):void 0,(0,H.jsx)(Z,{sortDirection:t===`MedianTime`&&r,align:`right`,children:(0,H.jsx)(Uw,{active:t===`MedianTime`,direction:r,onClick:()=>o(`MedianTime`),children:`Median Time / Material (min)`})}),(0,H.jsx)(Z,{sortDirection:t===`DeviationAbove`&&r,align:`right`,children:(0,H.jsx)(Uw,{active:t===`DeviationAbove`,direction:r,onClick:()=>o(`DeviationAbove`),children:`Deviation Above Median`})}),(0,H.jsx)(Z,{sortDirection:t===`DeviationBelow`&&r,align:`right`,children:(0,H.jsx)(Uw,{active:t===`DeviationBelow`,direction:r,onClick:()=>o(`DeviationBelow`),children:`Deviation Below Median`})}),(0,H.jsx)(Z,{sortDirection:t===`Planned`&&r,align:`right`,children:(0,H.jsx)(Uw,{active:t===`Planned`,direction:r,onClick:()=>o(`Planned`),children:`Planned Time (min)`})}),(0,H.jsx)(Z,{})]})}),(0,H.jsx)(Pw,{children:Q.of(a).map((t,n)=>(0,H.jsx)(g3,{program:t,showCellCtrlCol:e.cellNameDifferentFromProgName,showRevCol:e.hasRevisions},n))})]})}function v3(){let e=R(Y4),[t,n]=(0,L.useState)(null),r=(0,L.useMemo)(()=>new Worker(new URL(`/assets/ProgramHighlight-DPTeZ8Si.js`,``+import.meta.url),{type:`module`}),[]);return(0,L.useEffect)(()=>{let e=e=>n(e),t=t=>e(t.data);return r.addEventListener(`message`,t),()=>{e=()=>null,r.removeEventListener(`message`,t),r.terminate(),n(null)}},[r]),(0,L.useEffect)(()=>{e&&e!==``&&r.postMessage(e,[])},[e,r]),(0,H.jsx)(`pre`,{children:t===null?(0,H.jsx)(`code`,{className:`gcode`,children:e}):(0,H.jsx)(`code`,{className:`gcode`,dangerouslySetInnerHTML:{__html:t}})})}function y3(){let[e,t]=B(J4),n=R(X4);return(0,H.jsxs)(cy,{open:e!==null&&n===null,onClose:()=>t(null),maxWidth:`lg`,children:[(0,H.jsx)(dy,{children:e?.partName?(0,H.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,alignItems:`center`},children:[(0,H.jsx)(XU,{part:e.partName}),(0,H.jsxs)(`div`,{style:{marginLeft:`10px`,marginRight:`3em`},children:[e?.programName??`Program`,` `,e?.revision?` rev`+e.revision.toFixed():``,` `,(0,H.jsxs)(q,{variant:`subtitle1`,component:`span`,children:[`(`,e.partName,`)`]})]})]}):(0,H.jsxs)(H.Fragment,{children:[e?.programName??`Program`,` `,e?.revision?` rev`+e.revision.toFixed():``]})}),(0,H.jsx)(uy,{children:e===null||n!==null?(0,H.jsx)(`div`,{}):(0,H.jsx)(zU,{children:(0,H.jsx)(v3,{})})}),(0,H.jsx)(ly,{children:(0,H.jsx)(Y,{onClick:()=>t(null),children:`Close`})})]})}var b3=10;function x3(e){let t=R(X4),n=z(J4);return(0,H.jsxs)(jw,{children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:`Revision`}),(0,H.jsx)(Z,{children:`Comment`}),(0,H.jsx)(Z,{children:`Cell Controller Program`}),(0,H.jsx)(Z,{})]})}),(0,H.jsx)(Pw,{children:e.loading?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Vw,{children:(0,H.jsx)(Z,{colSpan:4,children:(0,H.jsx)(Lm,{})})}),Q.ofRange(0,b3-1).map(e=>(0,H.jsx)(Vw,{children:(0,H.jsx)(Z,{colSpan:4})},e))]}):Q.of(e.revisions).drop(e.page*b3).take(b3).map(e=>(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:e.revision}),(0,H.jsx)(Z,{children:e.comment??``}),(0,H.jsx)(Z,{children:e.cellControllerProgramName??``}),(0,H.jsx)(Z,{children:(0,H.jsx)(X,{title:`Load Program Content`,children:(0,H.jsx)(Um,{size:`small`,onClick:()=>n({...e,partName:t?.partName??null}),children:(0,H.jsx)(tT,{})})})})]},e.revision))})]})}function S3(){let[e,t]=B(X4),[n,r]=B(J4),[i,a]=(0,L.useState)(null),[o,s]=(0,L.useState)({page:0,hasMore:!1}),[c,l]=(0,L.useState)(0),[u,d]=(0,L.useState)(!1),[f,p]=(0,L.useState)(null);(0,L.useEffect)(()=>{e===null?(a(null),l(0),s({page:0,hasMore:!1})):e!==null&&i===null&&(d(!0),p(null),Gt.getProgramRevisionsInDescendingOrderOfRevision(e.programName,b3,void 0).then(e=>{a(e),s({page:0,hasMore:e.length===b3})}).catch(p).finally(()=>d(!1)))},[e,i]);function m(){if(c<o.page)l(c+1);else if(o.hasMore&&e!==null&&i!==null&&i.length>0){d(!0),p(null);let t=i[i.length-1];Gt.getProgramRevisionsInDescendingOrderOfRevision(e.programName,b3,t?t.revision-1:void 0).then(e=>{a(t=>t===null?e:t.concat(e)),s({page:c+1,hasMore:e.length===b3}),l(c+1)}).catch(p).finally(()=>d(!1))}}return(0,H.jsxs)(cy,{open:e!==null,onClose:()=>t(null),maxWidth:`lg`,children:[(0,H.jsx)(dy,{children:e?.partName?(0,H.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,alignItems:`center`},children:[(0,H.jsx)(XU,{part:e.partName}),(0,H.jsxs)(`div`,{style:{marginLeft:`10px`,marginRight:`3em`},children:[e.programName??`Program`,` `,(0,H.jsxs)(q,{variant:`subtitle1`,component:`span`,children:[`(`,e.partName,`)`]})]})]}):(0,H.jsx)(H.Fragment,{children:e?.programName??`Program`})}),(0,H.jsxs)(uy,{children:[f===null?void 0:(0,H.jsx)(ov,{children:(0,H.jsx)(uv,{children:typeof f==`string`?f:f.message})}),n===null?i===null?u?(0,H.jsx)(Lm,{}):void 0:(0,H.jsx)(x3,{page:c,revisions:i,loading:u}):(0,H.jsx)(zU,{children:(0,H.jsx)(v3,{})})]}),(0,H.jsx)(ly,{children:(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,width:`100%`},children:[n===null?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{title:`Latest Revisions`,children:(0,H.jsx)(`span`,{children:(0,H.jsx)(Um,{onClick:()=>l(0),disabled:u||c===0,size:`large`,children:(0,H.jsx)(sT,{})})})}),(0,H.jsx)(X,{title:`Previous Page`,children:(0,H.jsx)(`span`,{children:(0,H.jsx)(Um,{onClick:()=>l(c-1),disabled:u||c===0,size:`large`,children:(0,H.jsx)(fT,{})})})}),(0,H.jsx)(X,{title:`Next Page`,children:(0,H.jsx)(`span`,{children:(0,H.jsx)(Um,{onClick:()=>m(),disabled:u||c===o.page&&!o.hasMore,size:`large`,children:(0,H.jsx)(pT,{})})})})]}):void 0,(0,H.jsx)(`div`,{style:{flexGrow:1}}),n===null?void 0:(0,H.jsx)(Y,{onClick:()=>r(null),children:`Back to History`}),(0,H.jsx)(Y,{onClick:()=>t(null),children:`Close`})]})})]})}function C3(){let[e,t]=B(K4),[n,r]=(0,L.useState)(!1),i=qI(),[a,o]=B(W4);function s(){r(!0),t(new Date).catch(console.log).finally(()=>r(!1))}return i?(0,H.jsx)(`div`,{}):e===null?(0,H.jsx)(`main`,{style:{margin:`2em`,display:`flex`,justifyContent:`center`},children:(0,H.jsx)(hy,{color:`secondary`,size:`large`,variant:`extended`,style:{margin:`2em`},onClick:s,disabled:n,children:(0,H.jsxs)(H.Fragment,{children:[n?(0,H.jsx)(Lm,{size:10,style:{marginRight:`1em`}}):(0,H.jsx)(vT,{fontSize:`inherit`,style:{marginRight:`1em`}}),`Load Programs`]})})}):(0,H.jsxs)(J,{component:`nav`,sx:{display:`flex`,minHeight:`2.5em`,alignItems:`center`,maxWidth:`calc(100vw - 24px - 24px)`},children:[(0,H.jsx)(X,{title:`Refresh Programs`,children:(0,H.jsx)(`div`,{children:(0,H.jsx)(Um,{onClick:s,disabled:n,size:`small`,children:n?(0,H.jsx)(Lm,{size:10}):(0,H.jsx)(vT,{fontSize:`inherit`})})})}),(0,H.jsxs)(`span`,{style:{marginLeft:`1em`},children:[`Programs from `,(0,H.jsx)(Kz,{date:e})]}),(0,H.jsx)(`div`,{style:{flexGrow:1}}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,value:a,onChange:e=>o(e.target.value),children:[(0,H.jsx)(Hx,{value:`AllPrograms`,children:`All Programs`},`AllPrograms`),(0,H.jsx)(Hx,{value:`ActivePrograms`,children:`Active Programs`},`ActivePrograms`)]})})]})}function w3(){return JI(`Programs`),(0,H.jsxs)(J,{sx:{paddingLeft:`24px`,paddingRight:`24px`,paddingTop:`10px`},children:[(0,H.jsx)(C3,{}),(0,H.jsx)(`main`,{children:(0,H.jsx)(zU,{children:(0,H.jsx)(_3,{})})}),(0,H.jsx)(y3,{}),(0,H.jsx)(S3,{})]})}var T3=P(!1),E3=T3,D3=P(null),O3=D3;function k3(e){let t=new Date,n=LT(t,-30),r=Ut.currentStatus().then(t=>e(BR,t)),i=Ut.recent(n,[]).then(t=>e(RR,t)),a=Wt.get(n,t).then(t=>e(zR,t));Promise.all([r,i,a]).catch(t=>e(D3,t.message??`Error`)).finally(()=>e(T3,!1))}function A3(e,t,n){let r=new Date,i=Ut.currentStatus().then(e=>n(BR,e)),a=Ut.recent(LT(r,-30),t?Array.from(t):[]).then(e=>n(RR,e)),o=Wt.recent(e,void 0).then(e=>n(zR,e));Promise.all([i,a,o]).catch(e=>n(D3,e.message??`Error`)).finally(()=>n(T3,!1))}var j3=class{constructor(e){this.userCalledClose=!1,this.reconnectAttempts=0,this.url=e,this.connect()}close(){this.userCalledClose=!0,this.ws?.close()}connect(){if(this.userCalledClose)return;this.ws=new WebSocket(this.url);let e=this.ws,t=setTimeout(()=>{e.close()},2e3);e.addEventListener(`open`,()=>{clearTimeout(t),this.reconnectAttempts=0,this.handleOpen?.()}),e.addEventListener(`close`,()=>{if(clearTimeout(t),this.ws=void 0,this.userCalledClose)return;this.handleReconnecting?.();let e=Math.min(1e3*1.5**this.reconnectAttempts,3e4);setTimeout(()=>{this.reconnectAttempts++,this.connect()},e)}),e.addEventListener(`message`,e=>{this.handleMessage?.(e)})}},M3=P(null,(e,t)=>{let n=e(IR),r=e(lO);t(T3,!0),t(D3,null),n==null?k3(t):A3(n,r,t)}),N3=P(null,(e,t,n)=>{t(LR,{evt:ke.fromJS(JSON.parse(n.data)),now:new Date,expire:!0})});function P3(){let e=z(M3),t=z(T3),n=(0,L.useCallback)(()=>t(!0),[t]),r=z(N3),i=R(br),a=(0,L.useRef)(null);return(0,L.useEffect)(()=>{if(a.current)return;let t=i.user??null,o=window.location,s;if(o.protocol===`backup:`)return;s=o.protocol===`https:`?`wss:`:`ws:`,s+=`//`+o.host+`/api/v1/events`,t&&(s+=`?token=`+encodeURIComponent(t.access_token));let c=new j3(s);return c.handleOpen=e,c.handleReconnecting=n,c.handleMessage=r,a.current=c,()=>{a.current&&=(a.current.close(),null)}},[i,r,e,n]),null}var F3=[{id:0,label:`Date`,numeric:!1,getDisplay:e=>e.routeStartTime.toLocaleString(),getForSort:e=>e.routeStartTime.getTime(),getForExport:e=>e.routeStartTime.toISOString()},{id:1,label:`Part`,numeric:!1,getDisplay:e=>e.partName},{id:2,label:`Scheduled`,numeric:!0,getDisplay:e=>e.scheduledQty.toString(),getForSort:e=>e.scheduledQty},{id:3,label:`Removed`,numeric:!0,getDisplay:e=>e.decrementedQty.toString(),getForSort:e=>e.decrementedQty},{id:4,label:`Completed`,numeric:!0,getDisplay:e=>e.completedQty.toString()}];function I3({job:e}){let[t,n]=(0,L.useState)(!1);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(jX,{children:[F3.map(t=>(0,H.jsx)(Z,{align:t.numeric?`right`:`left`,children:t.id===1?(0,H.jsxs)(J,{sx:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(J,{sx:{mr:`0.2em`},children:(0,H.jsx)(XU,{part:e.partName,size:25})}),(0,H.jsx)(`div`,{children:e.partName})]}):t.getDisplay(e)},t.id)),(0,H.jsx)(Z,{children:(0,H.jsx)(X,{title:`Show Details`,children:(0,H.jsx)(Um,{size:`small`,onClick:()=>n(!t),children:t?(0,H.jsx)(mT,{}):(0,H.jsx)(dT,{})})})})]}),(0,H.jsx)(MX,{children:(0,H.jsx)(Z,{sx:{pb:`0`,pt:`0`},colSpan:F3.length+1,children:(0,H.jsx)(zp,{in:t,timeout:`auto`,unmountOnExit:!0,children:(0,H.jsx)(uJ,{job:e.inProcJob?e.inProcJob:e.historicJob,checkAnalysisMonth:!0})})})})]})}function L3(){let e=R(KR),t=u0(),n=l0(e),r=d0(0,F3),i=R(e.type===`Last30`?fL:mL),a=R(e.type===`Last30`?sO:dO),o=(0,L.useMemo)(()=>Gq(n.zoomRange,i.matsById,a,null),[n,i.matsById,a]),s=(0,L.useMemo)(()=>Q.of(o).sortBy(r.sortOn).drop(t.page*t.rowsPerPage).take(t.rowsPerPage),[o,r,t]);return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(jw,{stickyHeader:!0,children:[(0,H.jsx)(n0,{columns:F3,sort:r,showDetailsCol:!0,copyToClipboardRows:o}),(0,H.jsx)(Pw,{children:s.map((e,t)=>(0,H.jsx)(I3,{job:e},e.historicJob?.unique??e.inProcJob?.unique??t))})]}),(0,H.jsx)(s0,{tpage:t,zoom:n.zoom,count:o.length})]})}function R3(){return JI(`Scheduled Jobs`),(0,H.jsx)(H.Fragment,{children:(0,H.jsx)(`main`,{style:{padding:`24px`},children:(0,H.jsx)(L3,{})})})}function z3(){JI(`Quality`);let e=R(KR);return(0,H.jsx)(k0,{subtitle:`Inspection decisions grouped by path`,inspectionlogs:R(e.type===`Last30`?cL:Xie),zoomType:e.type===`Last30`?`Last30Days`:`ZoomIntoRange`,default_date_range:e.type===`Last30`?[LT(cE(),-29),LT(cE(),1)]:[e.month,RT(e.month,1)]})}var B3={display:`flex`,backgroundColor:`#E0E0E0`,paddingLeft:`24px`,paddingRight:`24px`,paddingBottom:`4px`,height:`2.5em`,alignItems:`flex-end`},V3={display:`flex`,alignSelf:`center`,alignItems:`flex-end`},H3=`@@all_inspection_display@@`,U3=`@@recent_completed_material@@`;function W3(e){return typeof e==`string`?e.split(`,`):e}function G3(){let[e,t]=B(Jq);return(0,H.jsx)(vy,{control:(0,H.jsx)(wv,{size:`small`,checked:e,onChange:e=>t(e.target.checked)}),label:`Hide Non-Loading Material`,sx:{pl:2,pr:2}})}function K3(){let[e,t]=B(KI),n=R(kL),r=Q.of(Object.keys(R(NO).queues)).toSortedArray(e=>e),i=R(br),a=Jw(Od().breakpoints.down(`md`));function o(n){let r=parseFloat(n);!isNaN(r)&&isFinite(r)&&(e.route===$.Station_LoadMonitor?t({route:$.Station_LoadMonitor,loadNum:r,queues:e.queues,completed:e.completed}):t({route:$.Station_LoadMonitor,loadNum:r,queues:[],completed:!1}))}function s(e){t(e===H3?{route:$.Station_InspectionMonitor}:{route:$.Station_InspectionMonitorWithType,inspType:e})}function c(n){let r=n.includes(U3);n=n.filter(e=>e!==U3).slice(0,2),e.route===$.Station_LoadMonitor?t({route:$.Station_LoadMonitor,loadNum:e.loadNum,queues:n,completed:r}):t({route:$.Station_LoadMonitor,loadNum:1,queues:n,completed:r})}function l(e){t({route:$.Station_Queues,queues:e})}let u=`LoadUnload`,d=1,f=null,p=[];switch(e.route){case $.Station_LoadMonitor:u=`LoadUnload`,d=e.loadNum,p=e.queues,e.completed&&(p=p.concat(U3));break;case $.Station_InspectionMonitor:u=`Inspection`,f=``;break;case $.Station_InspectionMonitorWithType:u=`Inspection`,f=e.inspType;break;case $.Station_Queues:u=`Queues`,p=e.queues;break;case $.Station_Closeout:u=`CloseOut`;break;default:u=`AllMaterial`;break}return(0,H.jsxs)(J,{component:`nav`,sx:a?B3:V3,children:[u===`LoadUnload`?i.loadStationNames&&Object.keys(i.loadStationNames).length>0?(0,H.jsx)(YS,{value:d,onChange:e=>o(e.target.value.toString()),variant:`standard`,style:{marginLeft:`1em`,minWidth:`8em`},children:Q.of(Object.entries(i.loadStationNames)).sortBy(([e])=>parseInt(e)).map(([e,t])=>(0,H.jsx)(Hx,{value:parseInt(e),children:t},e))},`loadnumselect`):(0,H.jsx)(ky,{type:`number`,placeholder:`Load Station Number`,value:d,onChange:e=>o(e.target.value),style:{width:`3em`,marginLeft:`1em`}},`loadnumselect`):void 0,u===`Inspection`?(0,H.jsxs)(YS,{value:f||H3,onChange:e=>s(e.target.value),variant:`standard`,style:{marginLeft:`1em`},children:[(0,H.jsx)(Hx,{value:H3,children:(0,H.jsx)(`em`,{children:`All`})},H3),Q.of(n).sortBy(e=>e).map(e=>(0,H.jsx)(Hx,{value:e,children:e},e))]},`inspselect`):void 0,u===`LoadUnload`?(0,H.jsxs)(_y,{style:{marginLeft:`1em`},children:[p.length===0?(0,H.jsx)(`label`,{style:{position:`absolute`,top:`10px`,left:0,color:`rgba(0,0,0,0.54)`,fontSize:`0.9rem`},children:`Display queue(s)`}):void 0,(0,H.jsxs)(YS,{multiple:!0,displayEmpty:!0,variant:`standard`,value:p,inputProps:{id:`queueselect`},style:{minWidth:`10em`,marginTop:`0`},onChange:e=>c(W3(e.target.value)),children:[r.map((e,t)=>(0,H.jsx)(Hx,{value:e,children:e},t)),(0,H.jsx)(Hx,{value:U3,children:(0,H.jsx)(`i`,{children:`Completed`})}),(0,H.jsx)(py,{}),(0,H.jsx)(G3,{})]})]}):void 0,u===`Queues`?(0,H.jsxs)(_y,{style:{marginLeft:`1em`,minWidth:`10em`},children:[p.length===0?(0,H.jsx)(`label`,{style:{position:`absolute`,top:`10px`,left:0,color:`rgba(0,0,0,0.54)`,fontSize:`0.9rem`},children:`Select queue(s)`}):void 0,(0,H.jsx)(YS,{multiple:!0,displayEmpty:!0,variant:`standard`,value:p,inputProps:{id:`queueselect`},style:{marginTop:`0`},onChange:e=>l(W3(e.target.value)),children:r.map((e,t)=>(0,H.jsx)(Hx,{value:e,children:e},t))})]}):void 0]})}function q3(){let e=Jw(Od().breakpoints.down(`md`));return(0,H.jsx)(J,{sx:{display:`flex`,alignItems:`center`,height:`100%`,bgcolor:e?`#E0E0E0`:void 0},children:(0,H.jsx)(U2,{full:e})})}var J3=SO(`shift-starts`,[[1,360],[2,840],[3,1320]]),Y3=P(e=>new Map(e(J3)),(e,t,n)=>{let r=new Map(e(J3));n(r),t(J3,Array.from(r.entries()))});function X3(e){let t=R(Y3);return(0,L.useMemo)(()=>{let n=[];for(let e=1;e<=3;e++){let r=t.get(e);r!==void 0&&(n.length>=1&&n[n.length-1]>=r||n.push(r))}if(n.length===0)return[{start:e,end:LT(e,1)}];let r=JT(LT(e,1),n[0]),i=[];for(let t=0;t<n.length;t++)i.push({start:JT(e,n[t]),end:t===n.length-1?r:JT(e,n[t+1])});return i},[t,e])}function Z3(e){let[t,n]=e.split(`:`);return parseInt(t,10)*60+parseInt(n,10)}function Q3(e){let t=Math.floor(e/60),n=e%60;return`${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}`}function $3(e,t){let n=t.get(e);if(n===void 0)return!1;if(e===1){let e=t.get(2)??t.get(3);return e!==void 0&&e<=n}else if(e===2){let e=t.get(1),r=t.get(3);return e!==void 0&&e>=n||r!==void 0&&r<=n}else if(e===3){let e=t.get(2)??t.get(1);return e!==void 0&&e>=n}else return!1}function e6({shiftNum:e}){let[t,n]=B(Y3),r=t.get(e);return(0,H.jsx)(Kw,{type:`time`,label:`Shift ${e} Start`,error:$3(e,t),value:r===void 0?``:Q3(r),onChange:t=>{let r=t.target.value;n(r===``?t=>t.delete(e):t=>t.set(e,Z3(r)))},variant:`standard`,size:`small`,slotProps:{inputLabel:{shrink:!0},input:e===1?void 0:{endAdornment:(0,H.jsx)(X,{title:`Clear/Disable Shift`,children:(0,H.jsx)(bm,{sx:{mb:`4px`},onClick:()=>n(t=>t.delete(e)),children:(0,H.jsx)(eT,{fontSize:`small`})})})}}})}function t6(){return(0,H.jsxs)(RC,{direction:`row`,spacing:2,children:[(0,H.jsx)(e6,{shiftNum:1}),(0,H.jsx)(e6,{shiftNum:2}),(0,H.jsx)(e6,{shiftNum:3})]})}function n6(e,t){return n=>{let r=e(n);for(let e=0;e<t.length;e++){let i=t[e];if(r>=i.start&&r<i.end)return{val:n,shift:e}}return null}}function eae(e,t){return Q.of(e).filter(e=>e.finalProcess).collect(n6(e=>e.completeTime,t)).toLookupOrderedMap(e=>e.val.partName,e=>e.shift,e=>e.val.quantity,(e,t)=>e+t)}function tae(e,t){return e.valuesToLazySeq().filter(e=>$O(e)&&e.operation===`UNLOAD`&&Q.of(e.material).some(e=>e.proc===e.numproc)).collect(n6(e=>e.endTime,t)).toLookupOrderedMap(e=>e.val.part,e=>e.shift,e=>Q.of(e.val.material).sumBy(e=>+(e.proc===e.numproc)),(e,t)=>e+t)}function nae(e){let t=R(uk),n=R(QI),r=X3(e);return(0,L.useMemo)(()=>{let e=eae(n,r),i=tae(t,r);return e.mapValues(e=>({planned:e})).adjust(i,(e,t)=>e?{...e,completed:t}:{completed:t}).toAscLazySeq().map(([e,{planned:t,completed:n}])=>({part:e,planned:t??eO.empty(),completed:n??eO.empty()})).toRArray()},[t,n,r])}var rae=new Intl.DateTimeFormat(void 0,{weekday:`long`,month:`long`,day:`numeric`,year:`numeric`});function iae({row:e}){return(0,H.jsxs)(RC,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[(0,H.jsx)(XU,{part:e.part,size:25}),(0,H.jsx)(`span`,{children:e.part})]})}function aae(e){let t=X3(e).length;return(0,L.useMemo)(()=>{let e=[{id:0,numeric:!1,label:`Part`,getDisplay:e=>e.part,getForTotal:()=>0,Cell:iae},{id:1,numeric:!0,label:`Shift 1 Planned`,getDisplay:e=>e.planned.get(0)?.toString()??``,getForSort:e=>e.planned.get(0)??0,getForTotal:e=>e.planned.get(0)??0},{id:4,numeric:!0,label:`Shift 1 Completed`,getDisplay:e=>e.completed.get(0)?.toString()??``,getForSort:e=>e.completed.get(0)??0,getForTotal:e=>e.completed.get(0)??0}];return t>=2&&(e.push({id:2,numeric:!0,label:`Shift 2 Planned`,getDisplay:e=>e.planned.get(1)?.toString()??``,getForSort:e=>e.planned.get(1)??0,getForTotal:e=>e.planned.get(1)??0}),e.push({id:5,numeric:!0,label:`Shift 2 Completed`,getDisplay:e=>e.completed.get(1)?.toString()??``,getForSort:e=>e.completed.get(1)??0,getForTotal:e=>e.completed.get(1)??0})),t===3&&(e.push({id:3,numeric:!0,label:`Shift 3 Planned`,getDisplay:e=>e.planned.get(2)?.toString()??``,getForSort:e=>e.planned.get(2)??0,getForTotal:e=>e.planned.get(2)??0}),e.push({id:6,numeric:!0,label:`Shift 3 Completed`,getDisplay:e=>e.completed.get(2)?.toString()??``,getForSort:e=>e.completed.get(2)??0,getForTotal:e=>e.completed.get(2)??0})),e},[t])}function oae({columns:e,rows:t}){return(0,H.jsx)(Vw,{children:e.map(e=>(0,H.jsx)(Z,{align:e.numeric?`right`:`left`,children:e.id===0?`Total`:Q.of(t).sumBy(e.getForTotal)},e.id))})}var sae=(0,L.memo)(function({columns:e,rows:t}){let n=d0(0,e);return(0,H.jsx)(J,{sx:{overflowX:`auto`},children:(0,H.jsxs)(jw,{stickyHeader:!0,children:[(0,H.jsx)(n0,{columns:e,sort:n,showDetailsCol:!1}),(0,H.jsx)(c0,{columns:e,pageData:Q.of(t).toSortedArray(n.sortOn,e=>e.part)}),(0,H.jsx)(mne,{children:(0,H.jsx)(oae,{columns:e,rows:t})})]})})});function cae({day:e,setDay:t}){let n=cE();return(0,H.jsxs)(RC,{direction:`row`,spacing:2,sx:{alignItems:`center`},children:[(0,H.jsx)(X,{title:`Previous Day`,children:(0,H.jsx)(`div`,{children:(0,H.jsx)(Um,{disabled:e<=LT(n,-28),onClick:()=>t(e=>LT(e,-1)),children:(0,H.jsx)(CT,{})})})}),(0,H.jsx)(q,{sx:{minWidth:`14em`,textAlign:`center`},children:rae.format(e)}),(0,H.jsx)(X,{title:`Next Day`,children:(0,H.jsx)(`div`,{children:(0,H.jsx)(Um,{disabled:e>=n,onClick:()=>t(e=>LT(e,1)),children:(0,H.jsx)(ST,{})})})})]})}var lae=`"shifts day export" auto / 1fr 1fr 1fr`,uae=`"shifts export" auto
|
|
355
|
-
"day day" auto / 1fr auto`,dae=function({day:e,setDay:t,columns:n,rows:r}){return(0,H.jsxs)(J,{component:`nav`,sx:{display:`grid`,gridTemplate:{md:lae,xs:uae},minHeight:`2.5em`,alignItems:`center`,maxWidth:`calc(100vw - 24px - 24px)`},children:[(0,H.jsx)(J,{sx:{gridArea:`shifts`,justifySelf:`flex-start`},children:(0,H.jsx)(t6,{})}),(0,H.jsx)(J,{sx:{gridArea:`day`,justifySelf:`center`},children:(0,H.jsx)(cae,{day:e,setDay:t})}),(0,H.jsx)(J,{sx:{gridArea:`export`,justifySelf:`flex-end`},children:(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{onClick:()=>p0(n,r),children:(0,H.jsx)(uT,{})})})})]})};function fae(){JI(`Recent Completed Parts`);let[e,t]=(0,L.useState)(cE),n=aae(e),r=nae(e);return(0,H.jsxs)(J,{sx:{paddingLeft:`24px`,paddingRight:`24px`,paddingTop:`10px`},children:[(0,H.jsx)(dae,{day:e,setDay:t,rows:r,columns:n}),(0,H.jsx)(`main`,{children:(0,H.jsx)(sae,{rows:r,columns:n})})]})}function pae(){let[e,t]=(0,L.useState)(!1);function n(){t(!0),Ht.enableVerboseLoggingForFiveMinutes(),setTimeout(()=>t(!1),300*1e3)}return(0,H.jsx)(`main`,{style:{marginTop:`4em`},children:(0,H.jsxs)(`div`,{style:{maxWidth:`50em`,marginLeft:`auto`,marginRight:`auto`,textAlign:`center`},children:[(0,H.jsx)(`p`,{style:{marginBottom:`1em`},children:`Verbose logging generates a large amount of additional data in the FMS Insight Server debug log file.`}),(0,H.jsx)(Y,{disabled:e,onClick:n,variant:`contained`,children:e?(0,H.jsx)(`span`,{children:`Verbose Logging is Enabled`}):(0,H.jsx)(`span`,{children:`Enable Verbose Logging For 5 minutes`})})]})})}function mae(){return(0,H.jsxs)(`svg`,{width:`30px`,height:`30px`,viewBox:`0 0 170 170`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,H.jsxs)(`defs`,{children:[(0,H.jsx)(`path`,{id:`t`,d:`m307.5 125v77.5h-40c6.92-6.52 11.25-10.6 12.98-12.23 10.65-10.04 13.56-25.81 7.21-38.99-1.7-3.5-5.92-12.26-12.69-26.28z`}),(0,H.jsx)(`path`,{id:`ag`,d:`m273.88 120.52c-0.13 0.28-4.87 3.3-11.17 0.5-6.3-2.81-11.99-9.96-11.67-10.67 0.32-0.72 9.44-1.27 15.74 1.53 6.3 2.81 7.23 8.35 7.1 8.64z`}),(0,H.jsx)(`path`,{id:`m`,d:`m259 102.25c-0.13 0.29-4.2 3.61-9.02 1.46-4.81-2.14-8.75-8.51-8.43-9.23 0.31-0.71 7.69-2.05 12.5 0.1 4.82 2.14 5.07 7.39 4.95 7.67z`}),(0,H.jsx)(`path`,{id:`x`,d:`m282.79 114.2c-0.2 0.24-5.59 1.84-10.87-2.59-5.29-4.44-8.78-12.88-8.28-13.48 0.5-0.59 9.42 1.38 14.7 5.82 5.29 4.43 4.65 10.02 4.45 10.25z`}),(0,H.jsx)(`path`,{id:`k`,d:`m268.39 125.43c-0.12-0.28-4.33-3.54-9.45-1.26s-9.41 8.81-9.1 9.52c0.32 0.71 8.05 1.89 13.17-0.39s5.51-7.58 5.38-7.87z`}),(0,H.jsx)(`path`,{id:`ae`,d:`m243.83 111.58c0 0.31-2.61 5-8.43 5s-12.65-4.22-12.65-5 6.83-5 12.65-5 8.43 4.69 8.43 5z`}),(0,H.jsx)(`path`,{id:`l`,d:`m304.24 109.88c-0.31 0.04-5.38-2.38-6.34-9.21s2.09-15.44 2.86-15.55 6.08 7.33 7.04 14.16-3.25 10.55-3.56 10.6z`}),(0,H.jsx)(`path`,{id:`u`,d:`m306.79 80.57c-0.31 0.05-5.31-1.83-6.1-7.47-0.79-5.63 2.45-12.84 3.23-12.95 0.77-0.11 5.88 5.92 6.67 11.56s-3.49 8.82-3.8 8.86z`}),(0,H.jsx)(`path`,{id:`a`,d:`m306.13 58.04c-0.31 0.05-5.23-1.3-5.86-5.74-0.62-4.43 2.83-10.24 3.6-10.34 0.77-0.11 5.68 4.51 6.31 8.95 0.62 4.44-3.74 7.09-4.05 7.13z`}),(0,H.jsx)(`path`,{id:`f`,d:`m295.52 118.45c-0.29 0.13-6.1-1.39-9.5-9.02-3.39-7.64-3.53-18.31-2.82-18.63 0.72-0.32 8.56 6.93 11.96 14.56s0.64 12.97 0.36 13.09z`}),(0,H.jsx)(`path`,{id:`b`,d:`m272.35 90.11c-0.26 0.19-5.76 0.58-9.58-4.67-3.82-5.26-4.88-13.9-4.25-14.36s8.52 3.23 12.34 8.48 1.74 10.37 1.49 10.55z`}),(0,H.jsx)(`path`,{id:`s`,d:`m289.97 85.66c-0.28 0.13-5.97-0.97-9.17-7.84-3.21-6.87-3.15-16.73-2.44-17.06s8.3 5.96 11.5 12.83 0.4 11.94 0.11 12.07z`}),(0,H.jsx)(`path`,{id:`n`,d:`m270.16 65.57c-0.28 0.14-5.38 0.38-7.35-3.65-1.96-4.03-0.48-10.62 0.22-10.96s6.8 2.54 8.77 6.58c1.97 4.03-1.36 7.9-1.64 8.03z`}),(0,H.jsx)(`path`,{id:`ah`,d:`m250 80c-0.17 0.26-4.4 3.11-8.12 0.69s-5.79-8.79-5.37-9.45c0.43-0.65 7.1-1.35 10.82 1.06 3.72 2.42 2.84 7.44 2.67 7.7z`}),(0,H.jsx)(`path`,{id:`y`,d:`m236.47 96.58c-0.11 0.29-3.72 3.89-7.83 2.23-4.12-1.66-7.37-7.53-7.07-8.25 0.29-0.72 6.7-2.68 10.81-1.02 4.12 1.66 4.21 6.75 4.09 7.04z`}),(0,H.jsx)(`path`,{id:`aa`,d:`m290.52 56.48c-0.28 0.14-5.35 0.58-7.44-3.33-2.08-3.92-0.8-10.5-0.11-10.87s6.86 2.25 8.94 6.17c2.09 3.92-1.12 7.88-1.39 8.03z`}),(0,H.jsx)(`path`,{id:`af`,d:`m274.18 138.46c-0.16-0.26-5.28-2.6-11.13 1.06s-10.48 11.53-10.07 12.19 9.52-0.05 15.37-3.71 6-9.27 5.83-9.54z`}),(0,H.jsx)(`path`,{id:`z`,d:`m247.89 137.78c0.11 0.29-0.65 5.6-6.08 7.69-5.43 2.08-13.32 0.59-13.6-0.14s4.58-7.11 10.01-9.2c5.44-2.08 9.56 1.36 9.67 1.65z`}),(0,H.jsx)(`path`,{id:`h`,d:`m235.06 125.39c0.1 0.3-0.26 5.38-4.46 6.83-4.19 1.44-10.49-0.85-10.75-1.59-0.25-0.74 3.3-6.42 7.5-7.87 4.19-1.44 7.61 2.34 7.71 2.63z`}),(0,H.jsx)(`path`,{id:`ab`,d:`m317.14 85.63c0.28 0.13 5.97-0.98 9.17-7.85 3.21-6.87 3.14-16.72 2.44-17.05-0.71-0.33-8.3 5.95-11.5 12.82-3.21 6.87-0.4 11.94-0.11 12.08z`}),(0,H.jsx)(`path`,{id:`ac`,d:`m299.61 124.96v77.5h40c-6.93-6.52-11.25-10.6-12.99-12.23-10.64-10.03-13.56-25.81-7.2-38.99 1.69-3.5 5.92-12.26 12.69-26.28z`}),(0,H.jsx)(`path`,{id:`c`,d:`m348.11 102.22c0.13 0.28 4.2 3.6 9.01 1.46 4.82-2.15 8.76-8.52 8.44-9.23-0.32-0.72-7.69-2.05-12.5 0.09-4.82 2.14-5.08 7.39-4.95 7.68z`}),(0,H.jsx)(`path`,{id:`p`,d:`m324.32 114.17c0.2 0.24 5.59 1.83 10.87-2.6 5.29-4.43 8.78-12.87 8.28-13.47s-9.42 1.38-14.71 5.81c-5.28 4.43-4.64 10.02-4.44 10.26z`}),(0,H.jsx)(`path`,{id:`o`,d:`m338.71 125.4c0.13-0.29 4.34-3.55 9.46-1.27s9.41 8.81 9.09 9.52c-0.31 0.72-8.04 1.9-13.16-0.38s-5.51-7.59-5.39-7.87z`}),(0,H.jsx)(`path`,{id:`j`,d:`m363.28 111.54c0 0.32 2.61 5 8.43 5s12.65-4.21 12.65-5c0-0.78-6.83-5-12.65-5s-8.43 4.69-8.43 5z`}),(0,H.jsx)(`path`,{id:`w`,d:`m311.59 118.42c0.29 0.12 6.1-1.4 9.49-9.03 3.4-7.63 3.54-18.31 2.82-18.63-0.71-0.32-8.55 6.93-11.95 14.56s-0.64 12.97-0.36 13.1z`}),(0,H.jsx)(`path`,{id:`i`,d:`m334.76 90.08c0.25 0.18 5.76 0.57 9.58-4.68 3.81-5.25 4.88-13.9 4.25-14.36s-8.53 3.23-12.34 8.48c-3.82 5.26-1.74 10.37-1.49 10.56z`}),(0,H.jsx)(`path`,{id:`r`,d:`m333.23 120.48c0.12 0.29 4.86 3.31 11.17 0.5 6.3-2.81 11.98-9.96 11.67-10.67-0.32-0.71-9.44-1.27-15.74 1.53-6.3 2.81-7.23 8.35-7.1 8.64z`}),(0,H.jsx)(`path`,{id:`ad`,d:`m336.95 65.54c0.28 0.13 5.38 0.38 7.35-3.66 1.96-4.03 0.48-10.61-0.22-10.96-0.7-0.34-6.81 2.55-8.77 6.58-1.97 4.03 1.36 7.9 1.64 8.04z`}),(0,H.jsx)(`path`,{id:`ai`,d:`m357.11 79.96c0.17 0.27 4.39 3.11 8.12 0.69 3.72-2.41 5.79-8.79 5.36-9.44-0.42-0.66-7.09-1.36-10.81 1.06-3.72 2.41-2.84 7.43-2.67 7.69z`}),(0,H.jsx)(`path`,{id:`d`,d:`m370.63 96.55c0.12 0.29 3.73 3.89 7.84 2.22 4.11-1.66 7.37-7.52 7.07-8.25-0.29-0.72-6.7-2.68-10.82-1.02-4.11 1.66-4.2 6.76-4.09 7.05z`}),(0,H.jsx)(`path`,{id:`q`,d:`m316.59 56.44c0.28 0.15 5.35 0.59 7.43-3.33 2.09-3.92 0.81-10.5 0.12-10.87-0.69-0.36-6.86 2.26-8.95 6.17-2.08 3.92 1.12 7.88 1.4 8.03z`}),(0,H.jsx)(`path`,{id:`v`,d:`m332.93 138.42c0.16-0.26 5.28-2.59 11.13 1.06 5.85 3.66 10.48 11.53 10.07 12.19-0.42 0.66-9.52-0.05-15.37-3.71-5.85-3.65-6-9.27-5.83-9.54z`}),(0,H.jsx)(`path`,{id:`g`,d:`m359.22 137.74c-0.11 0.29 0.65 5.61 6.08 7.69 5.43 2.09 13.32 0.59 13.6-0.13 0.28-0.73-4.59-7.12-10.02-9.21-5.43-2.08-9.55 1.36-9.66 1.65z`}),(0,H.jsx)(`path`,{id:`e`,d:`m372.05 125.36c-0.1 0.29 0.26 5.37 4.45 6.82 4.2 1.44 10.5-0.85 10.75-1.59 0.26-0.74-3.29-6.42-7.49-7.87-4.2-1.44-7.61 2.34-7.71 2.64z`})]}),(0,H.jsx)(`g`,{transform:`translate(-219.32 -33)`,visibility:`inherit`,children:(0,H.jsxs)(`g`,{visibility:`inherit`,children:[(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#t`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#t`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#ag`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#ag`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#m`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#m`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#x`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#x`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#k`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#k`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#ae`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#ae`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#l`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#l`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#u`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#u`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#a`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#a`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#f`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#f`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#b`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#b`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#s`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#s`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#n`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#n`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#ah`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#y`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#y`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#aa`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#aa`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#af`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#af`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#z`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#z`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#h`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#h`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#ab`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#ab`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#ac`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#ac`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#c`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#c`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#p`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#p`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#o`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#o`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#j`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#j`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#w`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#w`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#i`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#i`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#r`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#r`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#ad`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#ad`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#ai`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#d`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#d`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#q`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#q`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#v`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#v`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#g`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#g`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#e`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#e`})]})})]})}var r6=`__FMS_INSIGHT_NEW_OPERATOR__`,hae=(0,L.memo)(function(){let e=R(br),[t,n]=B(jO),[r,i]=B(AO),[a,o]=(0,L.useState)(!1),[s,c]=(0,L.useState)(``);function l(e){e.target.value===r6?o(!0):n(e.target.value)}function u(e){i(t=>t.filter(t=>t!==e))}function d(){s!==``&&(i(e=>[...e.filter(e=>e!==s),s]),n(s),c(``),o(!1))}return e.user?(0,H.jsx)(`div`,{children:e.user.profile.name||e.user.profile.sub}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(YS,{value:t||``,onChange:l,variant:`standard`,renderValue:e=>e,children:[Q.of(r).sortBy(e=>e).map((e,t)=>(0,H.jsxs)(Hx,{value:e,children:[(0,H.jsx)(Lb,{primary:e}),(0,H.jsx)(Sb,{children:(0,H.jsx)(Um,{edge:`end`,onClick:()=>u(e),size:`large`,children:(0,H.jsx)(gre,{})})})]},t)),(0,H.jsx)(Hx,{value:r6,children:(0,H.jsx)(`em`,{children:`Create New Operator`})},`new`)]}),(0,H.jsxs)(cy,{open:a,onClose:()=>{o(!1),c(``)},children:[(0,H.jsx)(dy,{children:`Create New Operator`}),(0,H.jsx)(uy,{children:(0,H.jsx)(Kw,{value:s,onChange:e=>c(e.target.value),label:`New Name`,variant:`outlined`,autoFocus:!0,sx:{mt:`0.5em`},onKeyUp:e=>{e.keyCode===13&&d()}})}),(0,H.jsxs)(ly,{children:[(0,H.jsxs)(Y,{disabled:s===``,onClick:d,children:[`Create `,s]}),(0,H.jsx)(Y,{onClick:()=>{c(``),o(!1)},children:`Cancel`})]})]})]})}),gae=(0,L.memo)(function(){let e=R(E3),t=R(YR),n=R(O3),r=R(ZR),[i,a]=(0,L.useState)(!1);return(0,H.jsxs)(H.Fragment,{children:[n!=null||r!=null?(0,H.jsx)(X,{title:`Error`,children:(0,H.jsx)(Um,{onClick:()=>a(!0),size:`large`,children:(0,H.jsx)(bre,{})})}):void 0,e||t?(0,H.jsx)(X,{title:`Loading`,children:(0,H.jsx)(Lm,{"data-testid":`loading-icon`,color:`secondary`})}):void 0,(0,H.jsxs)(cy,{open:i,onClose:()=>a(!1),children:[(0,H.jsx)(dy,{children:`Error`}),(0,H.jsxs)(uy,{children:[n===null?void 0:(0,H.jsx)(`p`,{children:n}),r===null?void 0:(0,H.jsx)(`p`,{children:r})]}),(0,H.jsx)(ly,{children:(0,H.jsx)(Y,{onClick:()=>a(!1),children:`Close`})})]})]})}),_ae=(0,L.memo)(function(){let e=R(br)?.customStationMonitorDialogUrl,[t,n]=(0,L.useState)(!1);if(!e)return null;let r=e.split(`/`),i=r[r.length-1];return i=i[0].toUpperCase()+i.substr(1),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{title:i,children:(0,H.jsx)(Um,{onClick:()=>n(!0),size:`large`,children:(0,H.jsx)(Nre,{})})}),(0,H.jsxs)(cy,{open:t,onClose:()=>n(!1),fullWidth:!0,maxWidth:`md`,children:[(0,H.jsx)(dy,{children:i}),(0,H.jsx)(uy,{children:(0,H.jsx)(`iframe`,{width:`100%`,src:e,sandbox:`allow-scripts`,style:{border:0,height:`calc(100vh - 250px)`}})}),(0,H.jsx)(ly,{children:(0,H.jsx)(Y,{color:`primary`,onClick:()=>n(!1),children:`Close`})})]})]})});function vae({d:e}){let t=$T(e,cE());return t>7?null:t>=0?(0,H.jsxs)(q,{variant:`subtitle1`,children:[`License expires on `,e.toDateString()]}):(0,H.jsxs)(q,{variant:`h6`,children:[`License expired on `,e.toDateString()]})}function i6(){let e=R(br),t=``;return t=e.name?(e.name||``)+` `+(e.version||``):`SeedTactic FMS Insight`,(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{title:t,children:(0,H.jsx)(`div`,{children:(0,H.jsx)(mae,{})})}),(0,H.jsx)(q,{variant:`h6`,style:{marginLeft:`1em`,marginRight:`2em`},children:`Insight`}),e?.licenseExpires?(0,H.jsx)(vae,{d:e.licenseExpires}):void 0]})}function yae(){let e=R(NO).alarms,t=e&&e.length>0;return(0,H.jsx)(X,{title:t?e.join(`. `):`No Alarms`,children:(0,H.jsx)(W_,{badgeContent:t?e.length:0,children:(0,H.jsx)(kre,{color:t?`error`:void 0})})})}function bae(){return(0,H.jsx)(X,{title:`Help`,children:(0,H.jsx)(Um,{"aria-label":`Help`,href:Fie(R(KI)),target:`_help`,size:`large`,children:(0,H.jsx)(cT,{})})})}function xae(){return(0,H.jsx)(X,{title:`Logout`,children:(0,H.jsx)(Um,{"aria-label":`Logout`,onClick:Sr,size:`large`,children:(0,H.jsx)(xre,{})})})}function a6({showAlarms:e,showLogout:t,showSearch:n}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(gae,{}),(0,H.jsx)(_ae,{}),n?(0,H.jsx)(Hq,{}):void 0,n?(0,H.jsx)(HY,{}):void 0,(0,H.jsx)(bae,{}),t?(0,H.jsx)(xae,{}):void 0,e?(0,H.jsx)(yae,{}):void 0]})}function Sae({menuNavs:e}){let t=R(br),[n,r]=B(KI),[i,a]=(0,L.useTransition)();return(0,H.jsx)(_y,{size:`small`,children:(0,H.jsx)(YS,{value:n.route,sx:{width:`16.5em`},onChange:t=>a(()=>{let n=e.find(e=>`separator`in e?!1:e.route.route===t.target.value);!n||`separator`in n||r(n.route)}),renderValue:()=>{let r=e.find(e=>`separator`in e?!1:e.route.route===n.route);return!r||`separator`in r?null:(0,H.jsxs)(J,{sx:{display:`flex`,alignItems:`center`},children:[r.icon,(0,H.jsxs)(q,{variant:`h6`,style:{marginLeft:`1em`},children:[typeof r.name==`string`?r.name:r.name(t),i?`...`:``]})]})},children:e.map((e,n)=>`separator`in e?(0,H.jsx)(m_,{children:e.separator},e.separator):e.hidden?.(t)?void 0:(0,H.jsxs)(Hx,{value:e.route.route,children:[(0,H.jsx)(Mb,{children:e.icon}),(0,H.jsx)(Lb,{primary:typeof e.name==`string`?e.name:e.name(t)})]},n))})})}function Cae({showAlarms:e,showLogout:t,showSearch:n,showOperator:r,Nav1:i,Nav2:a,menuNavs:o}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(dh,{position:`static`,sx:{display:{xs:`none`,md:`block`}},children:(0,H.jsx)(Rw,{children:(0,H.jsxs)(J,{sx:{display:`grid`,gridTemplateColumns:a?`1fr auto 1fr`:`minmax(200px, 1fr) auto`,width:`100vw`,gridTemplateAreas:a?`"nav navCenter tools"`:`"nav tools"`},children:[(0,H.jsxs)(J,{sx:{gridArea:`nav`,display:`flex`,alignItems:`center`},children:[(0,H.jsx)(i6,{}),i?(0,H.jsx)(i,{}):void 0]}),a?(0,H.jsx)(J,{sx:{gridArea:`navCenter`},children:(0,H.jsx)(a,{})}):void 0,(0,H.jsxs)(J,{sx:{gridArea:`tools`,display:`flex`,alignItems:`center`,justifyContent:`flex-end`},children:[r?(0,H.jsx)(hae,{}):void 0,(0,H.jsx)(a6,{showAlarms:e,showLogout:t,showSearch:n})]})]})})}),(0,H.jsxs)(dh,{position:`static`,sx:{display:{xs:`block`,md:`none`}},children:[(0,H.jsxs)(Rw,{children:[(0,H.jsx)(i6,{}),(0,H.jsx)(`div`,{style:{flexGrow:1}}),(0,H.jsx)(a6,{showAlarms:e,showLogout:t,showSearch:n})]}),(0,H.jsxs)(J,{sx:{display:`grid`,gridTemplateColumns:`minmax(200px, 1fr) auto`},children:[(0,H.jsx)(J,{sx:{gridColumn:`1`},children:i?(0,H.jsx)(i,{}):void 0}),(0,H.jsx)(J,{sx:{gridColumn:`2`},children:a?(0,H.jsx)(a,{}):void 0})]})]}),o&&o.length>0?(0,H.jsx)(Up,{elevation:4,square:!0,component:`nav`,sx:{display:{xs:`block`,xl:`none`},padding:`2px`},children:(0,H.jsx)(Sae,{menuNavs:o})}):void 0]})}function wae({menuItems:e}){let t=R(br),[n,r]=B(KI),[i,a]=(0,L.useTransition)();return!e||e.length===0?null:(0,H.jsx)(Up,{elevation:3,square:!0,sx:{flexShrink:0,display:{xs:`none`,xl:`block`},minHeight:`calc(100vh - 64px)`,zIndex:1},children:(0,H.jsx)(pb,{dense:!0,children:e?.map((e,o)=>`separator`in e?(0,H.jsx)(m_,{children:e.separator},e.separator):e.hidden?.(t)?void 0:(0,H.jsx)(Db,{children:(0,H.jsxs)(vb,{selected:n.route===e.route.route,onClick:()=>a(()=>r(e.route)),children:[(0,H.jsx)(Mb,{children:e.icon}),(0,H.jsx)(Lb,{primary:typeof e.name==`string`?e.name:e.name(t),sx:i?e=>({color:e.palette.grey[700]}):void 0})]})},o))})})}function Tae(e,t,n){return[{id:0,numeric:!1,label:`Date`,getDisplay:e=>e.endTime.toLocaleString(),getForSort:e=>e.endTime.getTime()},{id:1,numeric:!1,label:`Part`,getDisplay:e=>e.part+`-`+Q.of(e.material).map(e=>e.proc).distinctAndSortBy(e=>e).toRArray().join(`:`)},{id:2,numeric:!1,label:`Station`,getDisplay:e=>ak(e.stationGroup,e.stationNumber,t)},{id:6,numeric:!1,label:`Operation`,getDisplay:e=>e.operation},{id:3,numeric:!1,label:`Carrier`,getDisplay:e=>sk(e,n),getForSort:e=>qre(e)},{id:4,numeric:!1,label:`Serial`,getDisplay:e=>e.material.filter(e=>e.serial).map(e=>e.serial).join(`, `)},{id:5,numeric:!1,label:`Workorder`,getDisplay:e=>e.material.filter(e=>e.workorder).map(e=>e.workorder).join(`, `)},{id:7,numeric:!1,label:`Inspection`,getDisplay:t=>Bk(t,e),getForSort:t=>Q.of(t.material).collect(t=>e.get(t.id)).flatMap(e=>e.signaledInspections).distinct().toSortedArray(e=>e).join(`,`)},{id:8,numeric:!0,label:`Elapsed Min`,getDisplay:e=>(e.elapsedMinsPerMaterial*e.material.length).toFixed(1)},{id:9,numeric:!0,label:`Target Min`,getDisplay:e=>e.activeMinutes.toFixed(1)},{id:10,numeric:!0,label:`Median Elapsed Min`,getDisplay:e=>e.medianCycleMinutes.toFixed(1)},{id:11,numeric:!0,label:`Median Deviation`,getDisplay:e=>e.MAD_aboveMinutes.toFixed(1)}]}function Eae(e,t,n,r,i){let a;for(let e of t)e.id===r&&(a=e.getForSort||e.getDisplay);a===void 0&&(a=t[0].getForSort||t[0].getDisplay);let o=a,s=Q.of(e.values()).flatMap(e=>e);return(n?s.filter(e=>e.endTime>=n.start&&e.endTime<=n.end):s).toSortedArray(i===`desc`?{desc:o}:{asc:o},i===`desc`?{desc:e=>e.endTime.getTime()}:{asc:e=>e.endTime.getTime()})}function Dae(e){let t,n=e.set_date_zoom_range;return n&&(t=e.period.type===`Last30`?{type:`Last30Days`,set_days_back:e=>{if(e){let t=new Date;n({zoom:{start:LT(t,-e),end:BT(t,1)}})}else n({zoom:void 0})}}:{type:`ZoomIntoRange`,default_date_range:[e.period.month,RT(e.period.month,1)],current_date_zoom:e.current_date_zoom,set_date_zoom_range:e=>n({zoom:e})}),{zoom:t,zoomRange:e.current_date_zoom}}var o6=(0,L.memo)(function(e){let t=R(br),n=Tae(e.matsById,t.loadStationNames,ok(t.basketName)),r=d0(0,n),i=u0(),a=Dae(e),[o,s]=(0,L.useState)(null),c=z(SI),l=Eae(e.points,n,e.current_date_zoom,r.orderBy,r.order),u=l.length,d=l.slice(i.page*i.rowsPerPage,(i.page+1)*i.rowsPerPage),f=n.filter(t=>!(!e.showWorkorderAndInspect&&t.id===5||!e.showWorkorderAndInspect&&t.id===7||e.hideMedian&&t.id===10||e.hideMedian&&t.id===11));return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(jw,{children:[(0,H.jsx)(n0,{columns:f,sort:r,showDetailsCol:!0}),(0,H.jsx)(c0,{columns:f,pageData:d,rowsPerPage:i.rowsPerPage,onClickDetails:(e,t)=>{t.material.length!==0&&(t.material.length===1?c({type:`LogMat`,logMat:t.material[0]}):s({anchorEl:e.currentTarget,material:t.material}))},emptyMessage:e.emptyMessage})]}),(0,H.jsx)(s0,{zoom:a.zoom,tpage:i,count:u}),(0,H.jsx)(Rx,{anchorEl:o?.anchorEl,keepMounted:!0,open:o!==null,onClose:()=>s(null),children:o?.material.map((e,t)=>(0,H.jsx)(Hx,{onClick:()=>{c({type:`LogMat`,logMat:e}),s(null)},children:e.serial||`Material`},t))})]})});function s6({outlierTy:e}){JI(e===`machine`?`Machine Outliers`:`L/U Outliers`);let t=R(fL),n=R(br),r=cE(),i=R(uk),a=(0,L.useMemo)(()=>{let t=cE(),n=LT(t,-4),r=LT(t,1);return{seriesLabel:`Part`,data:i.valuesToLazySeq().filter(t=>t.isOutlier&&t.endTime>=n&&t.endTime<r&&$O(t)===(e===`labor`)).toRLookup(e=>e.part+`-`+e.material[0].proc.toString())}},[e,i]);return(0,H.jsxs)(J,{sx:{paddingLeft:`24px`,paddingRight:`24px`,paddingTop:`10px`},children:[(0,H.jsxs)(J,{component:`nav`,sx:{display:`flex`,minHeight:`2.5em`,alignItems:`center`,maxWidth:`calc(100vw - 24px - 24px)`},children:[(0,H.jsxs)(q,{variant:`subtitle1`,children:[e===`labor`?`Load/Unload`:`Machine`,` cycles from the past 5 days statistically outside expected range`]}),(0,H.jsx)(J,{sx:{flexGrow:1}}),(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{style:{height:`25px`,paddingTop:0,paddingBottom:0},onClick:()=>Hk(a,t.matsById,void 0,void 0,n.loadStationNames,n.basketName),size:`large`,children:(0,H.jsx)(uT,{})})})]}),(0,H.jsx)(`main`,{children:(0,H.jsx)(o6,{points:a.data,matsById:t.matsById,current_date_zoom:{start:LT(r,-4),end:LT(r,1)},set_date_zoom_range:void 0,period:{type:`Last30`},showWorkorderAndInspect:!1,defaultSortDesc:!0})})]})}var c6=class e{constructor(e,t){this.day=e,this.station=t}compare(e){let t=this.day.getTime()-e.day.getTime();return t===0?this.station.localeCompare(e.station):t}hash(){return yD(this.day,this.station)}toString(){return`{day: ${this.day.toISOString()}}, station: ${this.station}}`}adjustDay(t){return new e(t(this.day),this.station)}};function l6(e,t,n){let r=KT(e),i=KT(t);if(r.getTime()===i.getTime())return[{day:r,value:n}];{let a=[],o=t.getTime()-e.getTime();for(let s=r;s<=i;s=LT(s,1)){let r=ZT([s,e]),i=(QT([LT(s,1),t]).getTime()-r.getTime())/o;a.push({day:s,value:n*i})}return a}}function u6(e,t){return YO(Q.of(e),e=>e.stationLabel,e=>e.endTime).flatMap(([e,n])=>n.flatMap(e=>{let n=Q.of(e).sumBy(e=>e.elapsedMinsPerMaterial*e.material.length),r=YT(e[0].endTime,-n*60),i=Q.of(e).sumBy(e=>t(e));return l6(r,e[0].endTime,i)}).map(t=>({...t,statNameAndNum:e}))).buildHashMap(e=>new c6(e.day,e.statNameAndNum),(e,t)=>t.value+(e??0))}function d6(e){return u6(e,e=>e.activeMinutes)}function Oae(e){return u6(e,e=>e.elapsedMinsPerMaterial*e.material.length)}function f6(e){let t=[];for(let n of e)if(t.length===0)t.push(n);else{let e=t[t.length-1];n.start<=e.end?t[t.length-1]={start:e.start,end:ZT([e.end,n.end])}:t.push(n)}return t}function p6(e){return Q.of(e).filter(e=>e.plannedDown).toLookupOrderedMap(e=>e.stationLabel,e=>e.start).toAscLazySeq().flatMap(([e,t])=>f6(t.valuesToAscLazySeq()).flatMap(t=>l6(t.start,t.end,rE(t.end,t.start)).map(t=>({...t,station:e})))).toHashMap(e=>[new c6(e.day,e.station),e.value],(e,t)=>e+t)}function m6(e){let t=Q.of(e).filter(e=>e.plannedDown).toLookupOrderedMap(e=>e.stationLabel,e=>e.start).mapValues(e=>f6(e.valuesToAscLazySeq()));return Q.of(e).filter(e=>!e.plannedDown).toLookupOrderedMap(e=>e.stationLabel,e=>e.start).toAscLazySeq().flatMap(([e,n])=>{let r=f6(n.valuesToAscLazySeq()),i=t.get(e)??[];for(let e=0,t=0;t<r.length;)if(e<i.length&&i[e].end<=r[t].start)e++;else if(e<i.length&&i[e].start<r[t].end){let n=r[t].start,a=r[t].end,o=i[e].start,s=i[e].end;o<=n&&s>=a?r.splice(t,1):o<=n?(r[t]={start:s,end:a},e+=1):s>=a?(r[t]={start:n,end:o},t+=1):(r[t]={start:n,end:o},r.splice(t+1,0,{start:s,end:a}),e++,t++)}else t++;return r.flatMap(t=>l6(t.start,t.end,rE(t.end,t.start)).map(t=>({...t,station:e})))}).toHashMap(e=>[new c6(e.day,e.station),e.value],(e,t)=>e+t)}function kae(e,t,n,r,i){let a=d6(Q.of(r).filter(r=>n===`labor`===$O(r)&&r.endTime>=e&&r.endTime<=t)),o=Q.of(i).filter(r=>n===`labor`===r.station.startsWith(`L/U`)&&r.end>=e&&r.start<=t),s=p6(o),c=m6(o),l=[],u=a.keysToLazySeq().concat(c.keysToLazySeq()).map(e=>e.station).distinct().toSortedArray(e=>e);for(let n of u){let r=[];for(let i=e;i<t;i=LT(i,1)){let e=new c6(i,n),t=a.get(e),o=c.get(e),l=s.get(e)??0;r.push({x:i.toLocaleDateString(),y:(t??0)/60,plannedHours:(o??0)/60,actualOee:l<1440?(t??0)/(1440-l):0,plannedOee:l<1440?(o??0)/(1440-l):0,station:n,day:i})}l.push({station:n,points:r})}return l}var h6=class{constructor(e,t){this.x=e,this.y=t}compare(e){let t=this.x-e.x;return t===0?this.y.localeCompare(e.y):t}hash(){return yD(this.x,this.y)}toString(){return`{x: ${new Date(this.x).toISOString()}, y: ${this.y}}`}};function Aae(e,t){let n=Q.of(t).toHashMap(e=>[new h6(e.x.getTime(),e.y),e],(e,t)=>t),r=Q.of(t).map(e=>e.x.getTime()).distinct().toSortedArray(e=>e),i=Q.of(t).map(e=>e.y).distinct().toSortedArray(e=>e),a=`<table>
|
|
354
|
+
`}return r+=`</tbody></table>`,r}function H4(){let e=ge();return(0,L.useCallback)(()=>{let t=e.get(R4);t&&Ak(V4(t))},[e])}function U4(e,t,n,r,i){let a=j4(e,!0),o=e.keysToLazySeq().toRMap(e=>[e.operation,e],(e,t)=>t),s=Q.of(r);i!=null&&(s=s.filter(e=>i.has(e.programName)));let c=n?.valuesToLazySeq().flatMap(e=>Q.of(e.procsAndPaths).flatMap(e=>e.paths).flatMap(t=>Q.of(t.stops).collect(n=>{let r=BO(n.expectedCycleTime);return n.program&&r>0?{program:n.program,plannedMins:r/t.partsPerPallet,start:e.routeStartUTC}:null}))).toOrderedMap(e=>[e.program,e],(e,t)=>e.start>t.start?e:t),l=s.map(e=>{let n=o.get(e.programName);return{programName:e.programName,cellControllerProgramName:e.cellControllerProgramName,comment:e.comment??null,revision:e.revision??null,partName:n?.part??null,statisticalCycleTime:n?t.get(n)??null:null,toolUse:n?a.get(n)??null:null,plannedMins:c?.get(e.programName)?.plannedMins??null}}).toRArray();return{time:new Date,programs:l,hasRevisions:l.some(e=>e.revision!==null),cellNameDifferentFromProgName:l.some(e=>e.cellControllerProgramName!==e.programName)}}var W4=P(`AllPrograms`),G4=P(null),K4=P(e=>e(G4)?.time??null,async(e,t,n)=>{t(G4,{progs:await Gt.getProgramsInCellController(),time:n})}),q4=P(e=>{if(e(K4)===null)return null;let t=e(W4),n=null;if(t===`ActivePrograms`){let t=e(NO);n=new Set(Q.ofObject(t.jobs).flatMap(([,e])=>e.procsAndPaths).flatMap(e=>e.paths).flatMap(e=>e.stops).filter(e=>e.program!==null&&e.program!==void 0&&e.program!==``).map(e=>e.program??``))}let r=e(G4);return r===null?null:U4(e(RL),e(UO),e(sO),r.progs,n)}),J4=P(null),Y4=P(async e=>{let t=e(J4);return t===null?``:t.revision===null?await Gt.getLatestProgramRevisionContent(t.programName):await Gt.getProgramRevisionContent(t.programName,t.revision)}),X4=P(null),Z4=new Intl.NumberFormat(`en-US`,{minimumFractionDigits:0,maximumFractionDigits:1}),Q4=G(Vw,{shouldForwardProp:e=>e.toString()[0]!==`$`})(({theme:e,$noBorderBottom:t,$highlightedRow:n,$noticeRow:r})=>({...t&&{"& > *":{borderBottom:`unset`}},[e.breakpoints.up(`lg`)]:{"& td:not(:last-child), & th:not(:last-child)":{whiteSpace:`nowrap`},"& td:last-child, & th:last-child":{width:`100%`}},backgroundColor:n?`#BDBDBD`:r?`#E0E0E0`:void 0})),$4=G(Vw,{shouldForwardProp:e=>e.toString()[0]!==`$`})(({$borderBottom:e})=>({...e&&{"&:not(:last-child)":{borderBottom:`2px solid black`}}})),e3=G(`span`)({fontSize:`x-large`,fontWeight:`lighter`});function t3({min:e,cnt:t,showZero:n,extraMin:r,extraCnt:i}){e??=0,t??=0;let a=r?(0,H.jsx)(X,{title:r,children:(0,H.jsxs)(`span`,{children:[e.toFixed(1),` min`]})}):e.toFixed(1)+` min`,o=i?(0,H.jsx)(X,{title:i,children:(0,H.jsxs)(`span`,{children:[Z4.format(t),` cnt`]})}):Z4.format(t)+` cnt`;return e===0&&t===0?n?`0`:``:e>0&&t===0?a:e===0&&t>0?o:(0,H.jsxs)(`span`,{children:[a,` `,(0,H.jsx)(e3,{children:`|`}),` `,o]})}function n3({tool:e,machine:t}){let n=t?Q.of(e.parts).filter(e=>e.machines.has(t)):Q.of(e.parts);return(0,H.jsxs)(jw,{size:`small`,sx:{width:`auto`,ml:`10em`,mb:`1em`},children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:`Part`}),(0,H.jsx)(Z,{children:`Program`}),t?void 0:(0,H.jsx)(Z,{children:`Machines`}),(0,H.jsx)(Z,{align:`right`,children:`Quantity`}),(0,H.jsx)(Z,{align:`right`,children:`Use/Cycle (min)`}),(0,H.jsx)(Z,{align:`right`,children:`Use/Cycle (cnt)`})]})}),(0,H.jsx)(Pw,{children:n.isEmpty()?(0,H.jsx)(Vw,{children:(0,H.jsx)(Z,{colSpan:5,children:`No programs use this machine`})}):n.map((e,n)=>(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:(0,H.jsxs)(J,{sx:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(ZU,{part:e.partAndProg.part,size:20}),(0,H.jsx)(`span`,{children:e.partAndProg.part})]})}),(0,H.jsx)(Z,{children:e.partAndProg.operation}),t?void 0:(0,H.jsx)(Z,{children:e.machines.foldl((e,t)=>(e.length>0?e+`, `:``)+t,``)}),(0,H.jsx)(Z,{align:`right`,children:e.quantity}),(0,H.jsx)(Z,{align:`right`,children:e.scheduledUseMinutes>0?e.scheduledUseMinutes.toFixed(1):``}),(0,H.jsx)(Z,{align:`right`,children:e.scheduledUseCnt>0?Z4.format(e.scheduledUseCnt):``})]},n))})]})}function r3({machines:e}){let t=R(z4),n=Q.of(e).toLookupOrderedMap(e=>e.machineName,e=>e.pocket),r=n.size>1&&n.valuesToAscLazySeq().some(e=>e.size>1);return(0,H.jsxs)(jw,{size:`small`,sx:{width:`auto`,ml:`10em`,mb:`1em`},children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:`Machine`}),(0,H.jsx)(Z,{align:`right`,children:`Pocket`}),t?(0,H.jsx)(Z,{children:`Serial`}):void 0,(0,H.jsx)(Z,{align:`right`,children:`Current Use `}),(0,H.jsx)(Z,{align:`right`,children:`Lifetime `}),(0,H.jsx)(Z,{align:`right`,children:`Remaining Use `})]})}),(0,H.jsxs)(Pw,{children:[n.toAscLazySeq().map(([e,i])=>(0,H.jsxs)(L.Fragment,{children:[i.valuesToAscLazySeq().map((e,n)=>(0,H.jsxs)($4,{$borderBottom:r&&i.size===1,children:[(0,H.jsx)(Z,{children:e.machineName}),(0,H.jsx)(Z,{align:`right`,children:e.pocket}),t?(0,H.jsx)(Z,{children:e.serial??``}):void 0,(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(t3,{min:e.currentUseMinutes,cnt:e.currentUseCnt})}),(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(t3,{min:e.lifetimeMinutes,cnt:e.lifetimeCnt})}),(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(t3,{min:e.remainingMinutes,cnt:e.remainingCnt,showZero:!0})})]},n)),n.size>1&&i.size>1?(0,H.jsxs)($4,{$borderBottom:!0,children:[(0,H.jsx)(Z,{colSpan:t?4:3}),(0,H.jsx)(Z,{children:`Subtotal`}),(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(t3,{min:i.valuesToAscLazySeq().sumBy(e=>e.remainingMinutes??0),cnt:i.valuesToAscLazySeq().sumBy(e=>e.remainingCnt??0)})})]}):void 0]},e)),(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{colSpan:t?4:3}),(0,H.jsx)(Z,{children:`Total`}),(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(t3,{min:Q.of(e).sumBy(e=>e.remainingMinutes??0),cnt:Q.of(e).sumBy(e=>e.remainingCnt??0)})})]})]})]})}function i3(){let e=R(B4);return(0,H.jsxs)(Q4,{children:[(0,H.jsx)(Z,{}),(0,H.jsx)(Z,{children:`Tool`}),(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(X,{title:`Expected use for all currently scheduled parts.`+(e?` Counts are estimates.`:``),children:(0,H.jsx)(`span`,{children:`Scheduled Use`})})}),(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(X,{title:`Remaining use summed over all machines which have a scheduled part.`+(e?` Counts are estimates.`:``),children:(0,H.jsx)(`span`,{children:`Total Remaining Use`})})}),(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(X,{title:`Machine with the least remaining use.`+(e?` Counts are estimates.`:``),children:(0,H.jsx)(`span`,{children:`Smallest Remaining Use`})})}),(0,H.jsx)(Z,{})]})}function a3({tool:e}){let[t,n]=(0,L.useState)(!1),r=Q.of(e.machines).filter(t=>e.parts.some(e=>e.machines.has(t.machineName))),i=Q.of(e.parts).sumBy(e=>e.scheduledUseMinutes*e.quantity),a=Q.of(e.parts).sumBy(e=>e.scheduledUseCnt*e.quantity),o=r.sumBy(e=>e.remainingMinutes??0),s=r.sumBy(e=>e.remainingCnt??0),c=r.groupBy(e=>e.machineName).map(([e,t])=>({mach:e,remainMin:Q.of(t).sumBy(e=>e.remainingMinutes??0)})).minBy(({remainMin:e})=>e),l=r.groupBy(e=>e.machineName).map(([e,t])=>({mach:e,remainCnt:Q.of(t).sumBy(e=>e.remainingCnt??0)})).minBy(({remainCnt:e})=>e);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(Q4,{$noBorderBottom:!0,$highlightedRow:i>o||a>s,$noticeRow:i<=o&&a<=s&&(c&&i>c.remainMin||l&&a>l.remainCnt),children:[(0,H.jsx)(Z,{children:(0,H.jsx)(Um,{size:`small`,onClick:()=>n(!t),children:t?(0,H.jsx)(mT,{}):(0,H.jsx)(dT,{})})}),(0,H.jsx)(Z,{children:e.toolName}),(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(t3,{min:i,cnt:a})}),(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(t3,{min:o,cnt:s})}),(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(t3,{min:c?.remainMin,cnt:l?.remainCnt,showZero:!0,extraMin:c?.mach,extraCnt:l?.mach})}),(0,H.jsx)(Z,{})]}),(0,H.jsx)(Vw,{children:(0,H.jsx)(Z,{sx:{pb:`0`,pt:`0`},colSpan:6,children:(0,H.jsx)(zp,{in:t,timeout:`auto`,unmountOnExit:!0,children:(0,H.jsxs)(J,{sx:{display:`flex`,flexWrap:`wrap`,justifyContent:`space-around`,ml:`1em`,mr:`1em`},children:[(0,H.jsx)(`div`,{children:(0,H.jsx)(r3,{machines:e.machines})}),e.parts.length===0?void 0:(0,H.jsx)(`div`,{children:(0,H.jsx)(n3,{tool:e})})]})})})})]})}function o3({machine:e}){let t=R(B4),n=R(z4);return(0,H.jsxs)(Q4,{children:[(0,H.jsx)(Z,{}),(0,H.jsxs)(Z,{children:[`Tool In `,e]}),(0,H.jsx)(Z,{align:`right`,children:`Pocket`}),n?(0,H.jsx)(Z,{children:`Serial`}):void 0,(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(X,{title:`Expected use for all currently scheduled parts.`+(t?` Counts are estimates.`:``),children:(0,H.jsx)(`span`,{children:`Scheduled Use`})})}),(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(X,{title:`Current recorded usage of this tool.`+(t?` Counts are estimates.`:``),children:(0,H.jsx)(`span`,{children:`Current Use`})})}),(0,H.jsxs)(Z,{align:`right`,children:[(0,H.jsx)(X,{title:`Current configured lifetime of this tool.`+(t?` Counts are estimates.`:``),children:(0,H.jsx)(`span`,{children:`Lifetime`})}),` `]}),(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(X,{title:`Lifetime minus current use.`+(t?` Counts are estimates.`:``),children:(0,H.jsx)(`span`,{children:`Remaining Use`})})}),(0,H.jsx)(Z,{})]})}function s3({report:e,pocket:t}){let[n,r]=(0,L.useState)(!1),i=R(z4),a=i?9:8,o=Q.of(e.parts).filter(e=>e.machines.has(t.machineName)).sumBy(e=>e.scheduledUseMinutes*e.quantity),s=Q.of(e.parts).filter(e=>e.machines.has(t.machineName)).sumBy(e=>e.scheduledUseCnt*e.quantity);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(Q4,{$noBorderBottom:!0,children:[(0,H.jsx)(Z,{children:(0,H.jsx)(Um,{size:`small`,onClick:()=>r(!n),children:n?(0,H.jsx)(mT,{}):(0,H.jsx)(dT,{})})}),(0,H.jsx)(Z,{children:e.toolName}),(0,H.jsx)(Z,{align:`right`,children:t.pocket}),i?(0,H.jsx)(Z,{children:t.serial??``}):void 0,(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(t3,{min:o,cnt:s})}),(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(t3,{min:t.currentUseMinutes,cnt:t.currentUseCnt})}),(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(t3,{min:t.lifetimeMinutes,cnt:t.lifetimeCnt})}),(0,H.jsx)(Z,{align:`right`,children:(0,H.jsx)(t3,{min:t.remainingMinutes,cnt:t.remainingCnt})}),(0,H.jsx)(Z,{})]}),(0,H.jsx)(Vw,{children:(0,H.jsx)(Z,{sx:{pb:`0`,pt:`0`},colSpan:a,children:(0,H.jsx)(zp,{in:n,timeout:`auto`,unmountOnExit:!0,children:(0,H.jsx)(n3,{tool:e,machine:t.machineName})})})})]})}var c3=`__Insight__FilterAnyMachine__`,l3=P(null);function u3(){let e=R(l3),t=R(R4);return t===null?(0,H.jsx)(`div`,{}):(0,H.jsxs)(jw,{stickyHeader:!0,children:[(0,H.jsx)(Lw,{children:e===null?(0,H.jsx)(i3,{}):(0,H.jsx)(o3,{machine:e})}),(0,H.jsx)(Pw,{children:t.map(t=>e===null?(0,H.jsx)(a3,{tool:t},t.toolName):(0,H.jsx)(L.Fragment,{children:t.machines.filter(t=>t.machineName===e).map(e=>(0,H.jsx)(s3,{report:t,pocket:e},e.pocket))},t.toolName))})]})}function d3(){let[e,t]=B(l3),[n,r]=B(I4),[i,a]=(0,L.useState)(!1),o=R(L4),s=H4(),c=qI();function l(){a(!0),r(new Date).catch(console.log).finally(()=>a(!1))}return c?(0,H.jsx)(`div`,{}):n===null?(0,H.jsx)(`main`,{style:{margin:`2em`,display:`flex`,justifyContent:`center`},children:(0,H.jsx)(hy,{color:`secondary`,size:`large`,variant:`extended`,style:{margin:`2em`},onClick:l,disabled:i,children:(0,H.jsxs)(H.Fragment,{children:[i?(0,H.jsx)(Lm,{size:10,style:{marginRight:`1em`}}):(0,H.jsx)(vT,{fontSize:`inherit`,style:{marginRight:`1em`}}),`Load Tools`]})})}):(0,H.jsxs)(J,{component:`nav`,sx:{display:`flex`,minHeight:`2.5em`,alignItems:`center`,maxWidth:`calc(100vw - 24px - 24px)`},children:[(0,H.jsx)(X,{title:`Refresh Tools`,children:(0,H.jsx)(`div`,{children:(0,H.jsx)(Um,{onClick:l,disabled:i,size:`small`,children:i?(0,H.jsx)(Lm,{size:10}):(0,H.jsx)(vT,{fontSize:`inherit`})})})}),(0,H.jsxs)(`span`,{style:{marginLeft:`1em`},children:[`Tools from `,(0,H.jsx)(qz,{date:n})]}),(0,H.jsx)(`div`,{style:{flexGrow:`1`}}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,displayEmpty:!0,value:e??c3,style:{marginLeft:`1em`},onChange:e=>{e.target.value===c3?t(null):t(e.target.value)},children:[(0,H.jsx)(Hx,{value:c3,children:(0,H.jsx)(`em`,{children:`All Machines`})}),o.map(e=>(0,H.jsx)(Hx,{value:e,children:(0,H.jsx)(`div`,{style:{display:`flex`,alignItems:`center`},children:(0,H.jsx)(`span`,{style:{marginRight:`1em`},children:e})})},e))]})}),(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{style:{height:`25px`,paddingTop:0,paddingBottom:0},onClick:s,size:`large`,children:(0,H.jsx)(uT,{})})})]})}function f3(){return JI(`Tool Report`),(0,H.jsxs)(J,{sx:{paddingLeft:`24px`,paddingRight:`24px`,paddingTop:`10px`},children:[(0,H.jsx)(d3,{}),(0,H.jsx)(`main`,{children:(0,H.jsx)(BU,{children:(0,H.jsx)(u3,{})})})]})}var p3=G(Vw)(()=>({"& > *":{borderBottom:`unset`}}));function m3(e){if(e.length===0)return``;let t=e.lastIndexOf(`\\`);return t>=0&&t<e.length-2?e.substr(t+1):e}var h3=new Intl.NumberFormat(`en-US`,{maximumFractionDigits:2});function g3(e){let[t,n]=(0,L.useState)(!1),r=z(J4),i=z(X4),a=8+ +!!e.showCellCtrlCol+ +!!e.showRevCol,o=e.program.toolUse!==null&&e.program.toolUse.tools.length>0&&Q.of(e.program.toolUse.tools).some(e=>e.cycleUsageMinutes>0),s=e.program.toolUse!==null&&e.program.toolUse.tools.length>0&&Q.of(e.program.toolUse.tools).some(e=>e.cycleUsageCnt>0);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(p3,{children:[(0,H.jsx)(Z,{children:e.program.toolUse===null||e.program.toolUse.tools.length===0?void 0:(0,H.jsx)(Um,{size:`small`,onClick:()=>n(!t),children:t?(0,H.jsx)(mT,{}):(0,H.jsx)(dT,{})})}),(0,H.jsx)(Z,{children:m3(e.program.programName)}),e.showCellCtrlCol?(0,H.jsx)(Z,{children:e.program.cellControllerProgramName}):void 0,(0,H.jsx)(Z,{children:e.program.partName===null?void 0:(0,H.jsxs)(J,{sx:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(ZU,{part:e.program.partName,size:20}),(0,H.jsx)(`span`,{children:e.program.partName})]})}),(0,H.jsx)(Z,{children:e.program.comment??``}),e.showRevCol?(0,H.jsx)(Z,{children:e.program.revision===null?``:e.program.revision.toFixed()}):void 0,(0,H.jsx)(Z,{align:`right`,children:e.program.statisticalCycleTime===null?``:e.program.statisticalCycleTime.medianMinutesForSingleMat.toFixed(2)}),(0,H.jsx)(Z,{align:`right`,children:e.program.statisticalCycleTime===null?``:e.program.statisticalCycleTime.MAD_aboveMinutes.toFixed(2)}),(0,H.jsx)(Z,{align:`right`,children:e.program.statisticalCycleTime===null?``:e.program.statisticalCycleTime.MAD_belowMinutes.toFixed(2)}),(0,H.jsx)(Z,{align:`right`,children:e.program.plannedMins===null?``:h3.format(e.program.plannedMins)}),(0,H.jsxs)(Z,{children:[(0,H.jsx)(X,{title:`Load Program Content`,children:(0,H.jsx)(Um,{size:`small`,onClick:()=>r(e.program),children:(0,H.jsx)(tT,{})})}),e.program.revision===null?void 0:(0,H.jsx)(X,{title:`Revision History`,children:(0,H.jsx)(Um,{size:`small`,onClick:()=>i(e.program),children:(0,H.jsx)(wre,{})})})]})]}),(0,H.jsx)(Vw,{children:(0,H.jsx)(Z,{sx:{pb:`0`,pt:`0`},colSpan:a,children:(0,H.jsx)(zp,{in:t,timeout:`auto`,unmountOnExit:!0,children:(0,H.jsx)(J,{sx:{mr:`1em`,ml:`3em`},children:e.program.toolUse===null||e.program.toolUse.tools.length===0?void 0:(0,H.jsxs)(jw,{size:`small`,sx:{width:`auto`,ml:`10em`,mr:`1em`},children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:`Tool`}),o?(0,H.jsx)(Z,{align:`right`,children:`Estimated Usage (min)`}):void 0,s?(0,H.jsx)(Z,{align:`right`,children:`Estimated Usage (count)`}):void 0]})}),(0,H.jsx)(Pw,{children:Q.of(e.program.toolUse.tools).map((e,t)=>(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:e.toolName}),o?(0,H.jsx)(Z,{align:`right`,children:e.cycleUsageMinutes===0?``:e.cycleUsageMinutes.toFixed(1)}):void 0,s?(0,H.jsx)(Z,{align:`right`,children:e.cycleUsageCnt===0?``:e.cycleUsageCnt.toFixed(1)}):void 0]},t))})]})})})})})]})}function _3(){let e=R(q4),[t,n]=(0,L.useState)(`ProgramName`),[r,i]=(0,L.useState)(`asc`);if(e===null)return(0,H.jsx)(`div`,{});let a=Q.of(e.programs).sortWith((e,n)=>{let i=0;switch(t){case`ProgramName`:i=m3(e.programName).localeCompare(m3(n.programName));break;case`CellProgName`:i=e.cellControllerProgramName.localeCompare(n.cellControllerProgramName);break;case`Comment`:i=e.comment===null&&n.comment===null?0:e.comment===null?1:n.comment===null?-1:e.comment.localeCompare(n.comment);break;case`Revision`:i=e.revision===null&&n.revision===null?0:e.revision===null?1:n.revision===null?-1:e.revision-n.revision;break;case`PartName`:i=e.partName===null&&n.partName===null?0:e.partName===null?1:n.partName===null?-1:e.partName.localeCompare(n.partName);break;case`MedianTime`:i=e.statisticalCycleTime===null&&n.statisticalCycleTime===null?0:e.statisticalCycleTime===null?1:n.statisticalCycleTime===null?-1:e.statisticalCycleTime.medianMinutesForSingleMat-n.statisticalCycleTime.medianMinutesForSingleMat;break;case`DeviationAbove`:i=e.statisticalCycleTime===null&&n.statisticalCycleTime===null?0:e.statisticalCycleTime===null?1:n.statisticalCycleTime===null?-1:e.statisticalCycleTime.MAD_aboveMinutes-n.statisticalCycleTime.MAD_aboveMinutes;break;case`DeviationBelow`:i=e.statisticalCycleTime===null&&n.statisticalCycleTime===null?0:e.statisticalCycleTime===null?1:n.statisticalCycleTime===null?-1:e.statisticalCycleTime.MAD_belowMinutes-n.statisticalCycleTime.MAD_belowMinutes;break;case`Planned`:i=e.plannedMins===null&&n.plannedMins===null?0:e.plannedMins===null?1:n.plannedMins===null?-1:e.plannedMins-n.plannedMins;break}return i===0?0:i<0&&r===`asc`||i>0&&r===`desc`?-1:1});function o(e){e===t?i(r===`asc`?`desc`:`asc`):n(e)}return(0,H.jsxs)(jw,{stickyHeader:!0,children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{}),(0,H.jsx)(Z,{sortDirection:t===`ProgramName`&&r,children:(0,H.jsx)(Uw,{active:t===`ProgramName`,direction:r,onClick:()=>o(`ProgramName`),children:`Program Name`})}),e.cellNameDifferentFromProgName?(0,H.jsx)(Z,{sortDirection:t===`CellProgName`&&r,children:(0,H.jsx)(Uw,{active:t===`CellProgName`,direction:r,onClick:()=>o(`CellProgName`),children:`Cell Controller Program`})}):void 0,(0,H.jsx)(Z,{sortDirection:t===`PartName`&&r,children:(0,H.jsx)(Uw,{active:t===`PartName`,direction:r,onClick:()=>o(`PartName`),children:`Part`})}),(0,H.jsx)(Z,{sortDirection:t===`Comment`&&r,children:(0,H.jsx)(Uw,{active:t===`Comment`,direction:r,onClick:()=>o(`Comment`),children:`Comment`})}),e.hasRevisions?(0,H.jsx)(Z,{sortDirection:t===`Revision`&&r,children:(0,H.jsx)(Uw,{active:t===`Revision`,direction:r,onClick:()=>o(`Revision`),children:`Revision`})}):void 0,(0,H.jsx)(Z,{sortDirection:t===`MedianTime`&&r,align:`right`,children:(0,H.jsx)(Uw,{active:t===`MedianTime`,direction:r,onClick:()=>o(`MedianTime`),children:`Median Time / Material (min)`})}),(0,H.jsx)(Z,{sortDirection:t===`DeviationAbove`&&r,align:`right`,children:(0,H.jsx)(Uw,{active:t===`DeviationAbove`,direction:r,onClick:()=>o(`DeviationAbove`),children:`Deviation Above Median`})}),(0,H.jsx)(Z,{sortDirection:t===`DeviationBelow`&&r,align:`right`,children:(0,H.jsx)(Uw,{active:t===`DeviationBelow`,direction:r,onClick:()=>o(`DeviationBelow`),children:`Deviation Below Median`})}),(0,H.jsx)(Z,{sortDirection:t===`Planned`&&r,align:`right`,children:(0,H.jsx)(Uw,{active:t===`Planned`,direction:r,onClick:()=>o(`Planned`),children:`Planned Time (min)`})}),(0,H.jsx)(Z,{})]})}),(0,H.jsx)(Pw,{children:Q.of(a).map((t,n)=>(0,H.jsx)(g3,{program:t,showCellCtrlCol:e.cellNameDifferentFromProgName,showRevCol:e.hasRevisions},n))})]})}function v3(){let e=R(Y4),[t,n]=(0,L.useState)(null),r=(0,L.useMemo)(()=>new Worker(new URL(`/assets/ProgramHighlight-DPTeZ8Si.js`,``+import.meta.url),{type:`module`}),[]);return(0,L.useEffect)(()=>{let e=e=>n(e),t=t=>e(t.data);return r.addEventListener(`message`,t),()=>{e=()=>null,r.removeEventListener(`message`,t),r.terminate(),n(null)}},[r]),(0,L.useEffect)(()=>{e&&e!==``&&r.postMessage(e,[])},[e,r]),(0,H.jsx)(`pre`,{children:t===null?(0,H.jsx)(`code`,{className:`gcode`,children:e}):(0,H.jsx)(`code`,{className:`gcode`,dangerouslySetInnerHTML:{__html:t}})})}function y3(){let[e,t]=B(J4),n=R(X4);return(0,H.jsxs)(cy,{open:e!==null&&n===null,onClose:()=>t(null),maxWidth:`lg`,children:[(0,H.jsx)(dy,{children:e?.partName?(0,H.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,alignItems:`center`},children:[(0,H.jsx)(ZU,{part:e.partName}),(0,H.jsxs)(`div`,{style:{marginLeft:`10px`,marginRight:`3em`},children:[e?.programName??`Program`,` `,e?.revision?` rev`+e.revision.toFixed():``,` `,(0,H.jsxs)(q,{variant:`subtitle1`,component:`span`,children:[`(`,e.partName,`)`]})]})]}):(0,H.jsxs)(H.Fragment,{children:[e?.programName??`Program`,` `,e?.revision?` rev`+e.revision.toFixed():``]})}),(0,H.jsx)(uy,{children:e===null||n!==null?(0,H.jsx)(`div`,{}):(0,H.jsx)(BU,{children:(0,H.jsx)(v3,{})})}),(0,H.jsx)(ly,{children:(0,H.jsx)(Y,{onClick:()=>t(null),children:`Close`})})]})}var b3=10;function x3(e){let t=R(X4),n=z(J4);return(0,H.jsxs)(jw,{children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:`Revision`}),(0,H.jsx)(Z,{children:`Comment`}),(0,H.jsx)(Z,{children:`Cell Controller Program`}),(0,H.jsx)(Z,{})]})}),(0,H.jsx)(Pw,{children:e.loading?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Vw,{children:(0,H.jsx)(Z,{colSpan:4,children:(0,H.jsx)(Lm,{})})}),Q.ofRange(0,b3-1).map(e=>(0,H.jsx)(Vw,{children:(0,H.jsx)(Z,{colSpan:4})},e))]}):Q.of(e.revisions).drop(e.page*b3).take(b3).map(e=>(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:e.revision}),(0,H.jsx)(Z,{children:e.comment??``}),(0,H.jsx)(Z,{children:e.cellControllerProgramName??``}),(0,H.jsx)(Z,{children:(0,H.jsx)(X,{title:`Load Program Content`,children:(0,H.jsx)(Um,{size:`small`,onClick:()=>n({...e,partName:t?.partName??null}),children:(0,H.jsx)(tT,{})})})})]},e.revision))})]})}function S3(){let[e,t]=B(X4),[n,r]=B(J4),[i,a]=(0,L.useState)(null),[o,s]=(0,L.useState)({page:0,hasMore:!1}),[c,l]=(0,L.useState)(0),[u,d]=(0,L.useState)(!1),[f,p]=(0,L.useState)(null);(0,L.useEffect)(()=>{e===null?(a(null),l(0),s({page:0,hasMore:!1})):e!==null&&i===null&&(d(!0),p(null),Gt.getProgramRevisionsInDescendingOrderOfRevision(e.programName,b3,void 0).then(e=>{a(e),s({page:0,hasMore:e.length===b3})}).catch(p).finally(()=>d(!1)))},[e,i]);function m(){if(c<o.page)l(c+1);else if(o.hasMore&&e!==null&&i!==null&&i.length>0){d(!0),p(null);let t=i[i.length-1];Gt.getProgramRevisionsInDescendingOrderOfRevision(e.programName,b3,t?t.revision-1:void 0).then(e=>{a(t=>t===null?e:t.concat(e)),s({page:c+1,hasMore:e.length===b3}),l(c+1)}).catch(p).finally(()=>d(!1))}}return(0,H.jsxs)(cy,{open:e!==null,onClose:()=>t(null),maxWidth:`lg`,children:[(0,H.jsx)(dy,{children:e?.partName?(0,H.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,alignItems:`center`},children:[(0,H.jsx)(ZU,{part:e.partName}),(0,H.jsxs)(`div`,{style:{marginLeft:`10px`,marginRight:`3em`},children:[e.programName??`Program`,` `,(0,H.jsxs)(q,{variant:`subtitle1`,component:`span`,children:[`(`,e.partName,`)`]})]})]}):(0,H.jsx)(H.Fragment,{children:e?.programName??`Program`})}),(0,H.jsxs)(uy,{children:[f===null?void 0:(0,H.jsx)(ov,{children:(0,H.jsx)(uv,{children:typeof f==`string`?f:f.message})}),n===null?i===null?u?(0,H.jsx)(Lm,{}):void 0:(0,H.jsx)(x3,{page:c,revisions:i,loading:u}):(0,H.jsx)(BU,{children:(0,H.jsx)(v3,{})})]}),(0,H.jsx)(ly,{children:(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,width:`100%`},children:[n===null?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{title:`Latest Revisions`,children:(0,H.jsx)(`span`,{children:(0,H.jsx)(Um,{onClick:()=>l(0),disabled:u||c===0,size:`large`,children:(0,H.jsx)(sT,{})})})}),(0,H.jsx)(X,{title:`Previous Page`,children:(0,H.jsx)(`span`,{children:(0,H.jsx)(Um,{onClick:()=>l(c-1),disabled:u||c===0,size:`large`,children:(0,H.jsx)(fT,{})})})}),(0,H.jsx)(X,{title:`Next Page`,children:(0,H.jsx)(`span`,{children:(0,H.jsx)(Um,{onClick:()=>m(),disabled:u||c===o.page&&!o.hasMore,size:`large`,children:(0,H.jsx)(pT,{})})})})]}):void 0,(0,H.jsx)(`div`,{style:{flexGrow:1}}),n===null?void 0:(0,H.jsx)(Y,{onClick:()=>r(null),children:`Back to History`}),(0,H.jsx)(Y,{onClick:()=>t(null),children:`Close`})]})})]})}function C3(){let[e,t]=B(K4),[n,r]=(0,L.useState)(!1),i=qI(),[a,o]=B(W4);function s(){r(!0),t(new Date).catch(console.log).finally(()=>r(!1))}return i?(0,H.jsx)(`div`,{}):e===null?(0,H.jsx)(`main`,{style:{margin:`2em`,display:`flex`,justifyContent:`center`},children:(0,H.jsx)(hy,{color:`secondary`,size:`large`,variant:`extended`,style:{margin:`2em`},onClick:s,disabled:n,children:(0,H.jsxs)(H.Fragment,{children:[n?(0,H.jsx)(Lm,{size:10,style:{marginRight:`1em`}}):(0,H.jsx)(vT,{fontSize:`inherit`,style:{marginRight:`1em`}}),`Load Programs`]})})}):(0,H.jsxs)(J,{component:`nav`,sx:{display:`flex`,minHeight:`2.5em`,alignItems:`center`,maxWidth:`calc(100vw - 24px - 24px)`},children:[(0,H.jsx)(X,{title:`Refresh Programs`,children:(0,H.jsx)(`div`,{children:(0,H.jsx)(Um,{onClick:s,disabled:n,size:`small`,children:n?(0,H.jsx)(Lm,{size:10}):(0,H.jsx)(vT,{fontSize:`inherit`})})})}),(0,H.jsxs)(`span`,{style:{marginLeft:`1em`},children:[`Programs from `,(0,H.jsx)(qz,{date:e})]}),(0,H.jsx)(`div`,{style:{flexGrow:1}}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,value:a,onChange:e=>o(e.target.value),children:[(0,H.jsx)(Hx,{value:`AllPrograms`,children:`All Programs`},`AllPrograms`),(0,H.jsx)(Hx,{value:`ActivePrograms`,children:`Active Programs`},`ActivePrograms`)]})})]})}function w3(){return JI(`Programs`),(0,H.jsxs)(J,{sx:{paddingLeft:`24px`,paddingRight:`24px`,paddingTop:`10px`},children:[(0,H.jsx)(C3,{}),(0,H.jsx)(`main`,{children:(0,H.jsx)(BU,{children:(0,H.jsx)(_3,{})})}),(0,H.jsx)(y3,{}),(0,H.jsx)(S3,{})]})}var T3=P(!1),E3=T3,D3=P(null),O3=D3;function k3(e){let t=new Date,n=LT(t,-30),r=Ut.currentStatus().then(t=>e(VR,t)),i=Ut.recent(n,[]).then(t=>e(zR,t)),a=Wt.get(n,t).then(t=>e(BR,t));Promise.all([r,i,a]).catch(t=>e(D3,t.message??`Error`)).finally(()=>e(T3,!1))}function A3(e,t,n){let r=new Date,i=Ut.currentStatus().then(e=>n(VR,e)),a=Ut.recent(LT(r,-30),t?Array.from(t):[]).then(e=>n(zR,e)),o=Wt.recent(e,void 0).then(e=>n(BR,e));Promise.all([i,a,o]).catch(e=>n(D3,e.message??`Error`)).finally(()=>n(T3,!1))}var j3=class{constructor(e){this.userCalledClose=!1,this.reconnectAttempts=0,this.url=e,this.connect()}close(){this.userCalledClose=!0,this.ws?.close()}connect(){if(this.userCalledClose)return;this.ws=new WebSocket(this.url);let e=this.ws,t=setTimeout(()=>{e.close()},2e3);e.addEventListener(`open`,()=>{clearTimeout(t),this.reconnectAttempts=0,this.handleOpen?.()}),e.addEventListener(`close`,()=>{if(clearTimeout(t),this.ws=void 0,this.userCalledClose)return;this.handleReconnecting?.();let e=Math.min(1e3*1.5**this.reconnectAttempts,3e4);setTimeout(()=>{this.reconnectAttempts++,this.connect()},e)}),e.addEventListener(`message`,e=>{this.handleMessage?.(e)})}},M3=P(null,(e,t)=>{let n=e(LR),r=e(lO);t(T3,!0),t(D3,null),n==null?k3(t):A3(n,r,t)}),N3=P(null,(e,t,n)=>{t(RR,{evt:ke.fromJS(JSON.parse(n.data)),now:new Date,expire:!0})});function P3(){let e=z(M3),t=z(T3),n=(0,L.useCallback)(()=>t(!0),[t]),r=z(N3),i=R(br),a=(0,L.useRef)(null);return(0,L.useEffect)(()=>{if(a.current)return;let t=i.user??null,o=window.location,s;if(o.protocol===`backup:`)return;s=o.protocol===`https:`?`wss:`:`ws:`,s+=`//`+o.host+`/api/v1/events`,t&&(s+=`?token=`+encodeURIComponent(t.access_token));let c=new j3(s);return c.handleOpen=e,c.handleReconnecting=n,c.handleMessage=r,a.current=c,()=>{a.current&&=(a.current.close(),null)}},[i,r,e,n]),null}var F3=[{id:0,label:`Date`,numeric:!1,getDisplay:e=>e.routeStartTime.toLocaleString(),getForSort:e=>e.routeStartTime.getTime(),getForExport:e=>e.routeStartTime.toISOString()},{id:1,label:`Part`,numeric:!1,getDisplay:e=>e.partName},{id:2,label:`Scheduled`,numeric:!0,getDisplay:e=>e.scheduledQty.toString(),getForSort:e=>e.scheduledQty},{id:3,label:`Removed`,numeric:!0,getDisplay:e=>e.decrementedQty.toString(),getForSort:e=>e.decrementedQty},{id:4,label:`Completed`,numeric:!0,getDisplay:e=>e.completedQty.toString()}];function I3({job:e}){let[t,n]=(0,L.useState)(!1);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(MX,{children:[F3.map(t=>(0,H.jsx)(Z,{align:t.numeric?`right`:`left`,children:t.id===1?(0,H.jsxs)(J,{sx:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(J,{sx:{mr:`0.2em`},children:(0,H.jsx)(ZU,{part:e.partName,size:25})}),(0,H.jsx)(`div`,{children:e.partName})]}):t.getDisplay(e)},t.id)),(0,H.jsx)(Z,{children:(0,H.jsx)(X,{title:`Show Details`,children:(0,H.jsx)(Um,{size:`small`,onClick:()=>n(!t),children:t?(0,H.jsx)(mT,{}):(0,H.jsx)(dT,{})})})})]}),(0,H.jsx)(NX,{children:(0,H.jsx)(Z,{sx:{pb:`0`,pt:`0`},colSpan:F3.length+1,children:(0,H.jsx)(zp,{in:t,timeout:`auto`,unmountOnExit:!0,children:(0,H.jsx)(dJ,{job:e.inProcJob?e.inProcJob:e.historicJob,checkAnalysisMonth:!0})})})})]})}function L3(){let e=R(qR),t=d0(),n=u0(e),r=f0(0,F3),i=R(e.type===`Last30`?fL:mL),a=R(e.type===`Last30`?sO:dO),o=(0,L.useMemo)(()=>Kq(n.zoomRange,i.matsById,a,null),[n,i.matsById,a]),s=(0,L.useMemo)(()=>Q.of(o).sortBy(r.sortOn).drop(t.page*t.rowsPerPage).take(t.rowsPerPage),[o,r,t]);return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(jw,{stickyHeader:!0,children:[(0,H.jsx)(r0,{columns:F3,sort:r,showDetailsCol:!0,copyToClipboardRows:o}),(0,H.jsx)(Pw,{children:s.map((e,t)=>(0,H.jsx)(I3,{job:e},e.historicJob?.unique??e.inProcJob?.unique??t))})]}),(0,H.jsx)(c0,{tpage:t,zoom:n.zoom,count:o.length})]})}function R3(){return JI(`Scheduled Jobs`),(0,H.jsx)(H.Fragment,{children:(0,H.jsx)(`main`,{style:{padding:`24px`},children:(0,H.jsx)(L3,{})})})}function z3(){JI(`Quality`);let e=R(qR);return(0,H.jsx)(A0,{subtitle:`Inspection decisions grouped by path`,inspectionlogs:R(e.type===`Last30`?cL:Xie),zoomType:e.type===`Last30`?`Last30Days`:`ZoomIntoRange`,default_date_range:e.type===`Last30`?[LT(cE(),-29),LT(cE(),1)]:[e.month,RT(e.month,1)]})}var B3={display:`flex`,backgroundColor:`#E0E0E0`,paddingLeft:`24px`,paddingRight:`24px`,paddingBottom:`4px`,height:`2.5em`,alignItems:`flex-end`},V3={display:`flex`,alignSelf:`center`,alignItems:`flex-end`},H3=`@@all_inspection_display@@`,U3=`@@recent_completed_material@@`;function W3(e){return typeof e==`string`?e.split(`,`):e}function G3(){let[e,t]=B(Yq);return(0,H.jsx)(vy,{control:(0,H.jsx)(wv,{size:`small`,checked:e,onChange:e=>t(e.target.checked)}),label:`Hide Non-Loading Material`,sx:{pl:2,pr:2}})}function K3(){let[e,t]=B(KI),n=R(kL),r=Q.of(Object.keys(R(NO).queues)).toSortedArray(e=>e),i=R(br),a=Jw(Od().breakpoints.down(`md`));function o(n){let r=parseFloat(n);!isNaN(r)&&isFinite(r)&&(e.route===$.Station_LoadMonitor?t({route:$.Station_LoadMonitor,loadNum:r,queues:e.queues,completed:e.completed}):t({route:$.Station_LoadMonitor,loadNum:r,queues:[],completed:!1}))}function s(e){t(e===H3?{route:$.Station_InspectionMonitor}:{route:$.Station_InspectionMonitorWithType,inspType:e})}function c(n){let r=n.includes(U3);n=n.filter(e=>e!==U3).slice(0,2),e.route===$.Station_LoadMonitor?t({route:$.Station_LoadMonitor,loadNum:e.loadNum,queues:n,completed:r}):t({route:$.Station_LoadMonitor,loadNum:1,queues:n,completed:r})}function l(e){t({route:$.Station_Queues,queues:e})}let u=`LoadUnload`,d=1,f=null,p=[];switch(e.route){case $.Station_LoadMonitor:u=`LoadUnload`,d=e.loadNum,p=e.queues,e.completed&&(p=p.concat(U3));break;case $.Station_InspectionMonitor:u=`Inspection`,f=``;break;case $.Station_InspectionMonitorWithType:u=`Inspection`,f=e.inspType;break;case $.Station_Queues:u=`Queues`,p=e.queues;break;case $.Station_Closeout:u=`CloseOut`;break;default:u=`AllMaterial`;break}return(0,H.jsxs)(J,{component:`nav`,sx:a?B3:V3,children:[u===`LoadUnload`?i.loadStationNames&&Object.keys(i.loadStationNames).length>0?(0,H.jsx)(YS,{value:d,onChange:e=>o(e.target.value.toString()),variant:`standard`,style:{marginLeft:`1em`,minWidth:`8em`},children:Q.of(Object.entries(i.loadStationNames)).sortBy(([e])=>parseInt(e)).map(([e,t])=>(0,H.jsx)(Hx,{value:parseInt(e),children:t},e))},`loadnumselect`):(0,H.jsx)(ky,{type:`number`,placeholder:`Load Station Number`,value:d,onChange:e=>o(e.target.value),style:{width:`3em`,marginLeft:`1em`}},`loadnumselect`):void 0,u===`Inspection`?(0,H.jsxs)(YS,{value:f||H3,onChange:e=>s(e.target.value),variant:`standard`,style:{marginLeft:`1em`},children:[(0,H.jsx)(Hx,{value:H3,children:(0,H.jsx)(`em`,{children:`All`})},H3),Q.of(n).sortBy(e=>e).map(e=>(0,H.jsx)(Hx,{value:e,children:e},e))]},`inspselect`):void 0,u===`LoadUnload`?(0,H.jsxs)(_y,{style:{marginLeft:`1em`},children:[p.length===0?(0,H.jsx)(`label`,{style:{position:`absolute`,top:`10px`,left:0,color:`rgba(0,0,0,0.54)`,fontSize:`0.9rem`},children:`Display queue(s)`}):void 0,(0,H.jsxs)(YS,{multiple:!0,displayEmpty:!0,variant:`standard`,value:p,inputProps:{id:`queueselect`},style:{minWidth:`10em`,marginTop:`0`},onChange:e=>c(W3(e.target.value)),children:[r.map((e,t)=>(0,H.jsx)(Hx,{value:e,children:e},t)),(0,H.jsx)(Hx,{value:U3,children:(0,H.jsx)(`i`,{children:`Completed`})}),(0,H.jsx)(py,{}),(0,H.jsx)(G3,{})]})]}):void 0,u===`Queues`?(0,H.jsxs)(_y,{style:{marginLeft:`1em`,minWidth:`10em`},children:[p.length===0?(0,H.jsx)(`label`,{style:{position:`absolute`,top:`10px`,left:0,color:`rgba(0,0,0,0.54)`,fontSize:`0.9rem`},children:`Select queue(s)`}):void 0,(0,H.jsx)(YS,{multiple:!0,displayEmpty:!0,variant:`standard`,value:p,inputProps:{id:`queueselect`},style:{marginTop:`0`},onChange:e=>l(W3(e.target.value)),children:r.map((e,t)=>(0,H.jsx)(Hx,{value:e,children:e},t))})]}):void 0]})}function q3(){let e=Jw(Od().breakpoints.down(`md`));return(0,H.jsx)(J,{sx:{display:`flex`,alignItems:`center`,height:`100%`,bgcolor:e?`#E0E0E0`:void 0},children:(0,H.jsx)(U2,{full:e})})}var J3=SO(`shift-starts`,[[1,360],[2,840],[3,1320]]),Y3=P(e=>new Map(e(J3)),(e,t,n)=>{let r=new Map(e(J3));n(r),t(J3,Array.from(r.entries()))});function X3(e){let t=R(Y3);return(0,L.useMemo)(()=>{let n=[];for(let e=1;e<=3;e++){let r=t.get(e);r!==void 0&&(n.length>=1&&n[n.length-1]>=r||n.push(r))}if(n.length===0)return[{start:e,end:LT(e,1)}];let r=JT(LT(e,1),n[0]),i=[];for(let t=0;t<n.length;t++)i.push({start:JT(e,n[t]),end:t===n.length-1?r:JT(e,n[t+1])});return i},[t,e])}function Z3(e){let[t,n]=e.split(`:`);return parseInt(t,10)*60+parseInt(n,10)}function Q3(e){let t=Math.floor(e/60),n=e%60;return`${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}`}function $3(e,t){let n=t.get(e);if(n===void 0)return!1;if(e===1){let e=t.get(2)??t.get(3);return e!==void 0&&e<=n}else if(e===2){let e=t.get(1),r=t.get(3);return e!==void 0&&e>=n||r!==void 0&&r<=n}else if(e===3){let e=t.get(2)??t.get(1);return e!==void 0&&e>=n}else return!1}function e6({shiftNum:e}){let[t,n]=B(Y3),r=t.get(e);return(0,H.jsx)(Kw,{type:`time`,label:`Shift ${e} Start`,error:$3(e,t),value:r===void 0?``:Q3(r),onChange:t=>{let r=t.target.value;n(r===``?t=>t.delete(e):t=>t.set(e,Z3(r)))},variant:`standard`,size:`small`,slotProps:{inputLabel:{shrink:!0},input:e===1?void 0:{endAdornment:(0,H.jsx)(X,{title:`Clear/Disable Shift`,children:(0,H.jsx)(bm,{sx:{mb:`4px`},onClick:()=>n(t=>t.delete(e)),children:(0,H.jsx)(eT,{fontSize:`small`})})})}}})}function t6(){return(0,H.jsxs)(RC,{direction:`row`,spacing:2,children:[(0,H.jsx)(e6,{shiftNum:1}),(0,H.jsx)(e6,{shiftNum:2}),(0,H.jsx)(e6,{shiftNum:3})]})}function n6(e,t){return n=>{let r=e(n);for(let e=0;e<t.length;e++){let i=t[e];if(r>=i.start&&r<i.end)return{val:n,shift:e}}return null}}function tae(e,t){return Q.of(e).filter(e=>e.finalProcess).collect(n6(e=>e.completeTime,t)).toLookupOrderedMap(e=>e.val.partName,e=>e.shift,e=>e.val.quantity,(e,t)=>e+t)}function nae(e,t){return e.valuesToLazySeq().filter(e=>$O(e)&&e.operation===`UNLOAD`&&Q.of(e.material).some(e=>e.proc===e.numproc)).collect(n6(e=>e.endTime,t)).toLookupOrderedMap(e=>e.val.part,e=>e.shift,e=>Q.of(e.val.material).sumBy(e=>+(e.proc===e.numproc)),(e,t)=>e+t)}function rae(e){let t=R(uk),n=R(QI),r=X3(e);return(0,L.useMemo)(()=>{let e=tae(n,r),i=nae(t,r);return e.mapValues(e=>({planned:e})).adjust(i,(e,t)=>e?{...e,completed:t}:{completed:t}).toAscLazySeq().map(([e,{planned:t,completed:n}])=>({part:e,planned:t??eO.empty(),completed:n??eO.empty()})).toRArray()},[t,n,r])}var iae=new Intl.DateTimeFormat(void 0,{weekday:`long`,month:`long`,day:`numeric`,year:`numeric`});function aae({row:e}){return(0,H.jsxs)(RC,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[(0,H.jsx)(ZU,{part:e.part,size:25}),(0,H.jsx)(`span`,{children:e.part})]})}function oae(e){let t=X3(e).length;return(0,L.useMemo)(()=>{let e=[{id:0,numeric:!1,label:`Part`,getDisplay:e=>e.part,getForTotal:()=>0,Cell:aae},{id:1,numeric:!0,label:`Shift 1 Planned`,getDisplay:e=>e.planned.get(0)?.toString()??``,getForSort:e=>e.planned.get(0)??0,getForTotal:e=>e.planned.get(0)??0},{id:4,numeric:!0,label:`Shift 1 Completed`,getDisplay:e=>e.completed.get(0)?.toString()??``,getForSort:e=>e.completed.get(0)??0,getForTotal:e=>e.completed.get(0)??0}];return t>=2&&(e.push({id:2,numeric:!0,label:`Shift 2 Planned`,getDisplay:e=>e.planned.get(1)?.toString()??``,getForSort:e=>e.planned.get(1)??0,getForTotal:e=>e.planned.get(1)??0}),e.push({id:5,numeric:!0,label:`Shift 2 Completed`,getDisplay:e=>e.completed.get(1)?.toString()??``,getForSort:e=>e.completed.get(1)??0,getForTotal:e=>e.completed.get(1)??0})),t===3&&(e.push({id:3,numeric:!0,label:`Shift 3 Planned`,getDisplay:e=>e.planned.get(2)?.toString()??``,getForSort:e=>e.planned.get(2)??0,getForTotal:e=>e.planned.get(2)??0}),e.push({id:6,numeric:!0,label:`Shift 3 Completed`,getDisplay:e=>e.completed.get(2)?.toString()??``,getForSort:e=>e.completed.get(2)??0,getForTotal:e=>e.completed.get(2)??0})),e},[t])}function sae({columns:e,rows:t}){return(0,H.jsx)(Vw,{children:e.map(e=>(0,H.jsx)(Z,{align:e.numeric?`right`:`left`,children:e.id===0?`Total`:Q.of(t).sumBy(e.getForTotal)},e.id))})}var cae=(0,L.memo)(function({columns:e,rows:t}){let n=f0(0,e);return(0,H.jsx)(J,{sx:{overflowX:`auto`},children:(0,H.jsxs)(jw,{stickyHeader:!0,children:[(0,H.jsx)(r0,{columns:e,sort:n,showDetailsCol:!1}),(0,H.jsx)(l0,{columns:e,pageData:Q.of(t).toSortedArray(n.sortOn,e=>e.part)}),(0,H.jsx)(mne,{children:(0,H.jsx)(sae,{columns:e,rows:t})})]})})});function lae({day:e,setDay:t}){let n=cE();return(0,H.jsxs)(RC,{direction:`row`,spacing:2,sx:{alignItems:`center`},children:[(0,H.jsx)(X,{title:`Previous Day`,children:(0,H.jsx)(`div`,{children:(0,H.jsx)(Um,{disabled:e<=LT(n,-28),onClick:()=>t(e=>LT(e,-1)),children:(0,H.jsx)(CT,{})})})}),(0,H.jsx)(q,{sx:{minWidth:`14em`,textAlign:`center`},children:iae.format(e)}),(0,H.jsx)(X,{title:`Next Day`,children:(0,H.jsx)(`div`,{children:(0,H.jsx)(Um,{disabled:e>=n,onClick:()=>t(e=>LT(e,1)),children:(0,H.jsx)(ST,{})})})})]})}var uae=`"shifts day export" auto / 1fr 1fr 1fr`,dae=`"shifts export" auto
|
|
355
|
+
"day day" auto / 1fr auto`,fae=function({day:e,setDay:t,columns:n,rows:r}){return(0,H.jsxs)(J,{component:`nav`,sx:{display:`grid`,gridTemplate:{md:uae,xs:dae},minHeight:`2.5em`,alignItems:`center`,maxWidth:`calc(100vw - 24px - 24px)`},children:[(0,H.jsx)(J,{sx:{gridArea:`shifts`,justifySelf:`flex-start`},children:(0,H.jsx)(t6,{})}),(0,H.jsx)(J,{sx:{gridArea:`day`,justifySelf:`center`},children:(0,H.jsx)(lae,{day:e,setDay:t})}),(0,H.jsx)(J,{sx:{gridArea:`export`,justifySelf:`flex-end`},children:(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{onClick:()=>m0(n,r),children:(0,H.jsx)(uT,{})})})})]})};function pae(){JI(`Recent Completed Parts`);let[e,t]=(0,L.useState)(cE),n=oae(e),r=rae(e);return(0,H.jsxs)(J,{sx:{paddingLeft:`24px`,paddingRight:`24px`,paddingTop:`10px`},children:[(0,H.jsx)(fae,{day:e,setDay:t,rows:r,columns:n}),(0,H.jsx)(`main`,{children:(0,H.jsx)(cae,{rows:r,columns:n})})]})}function mae(){let[e,t]=(0,L.useState)(!1);function n(){t(!0),Ht.enableVerboseLoggingForFiveMinutes(),setTimeout(()=>t(!1),300*1e3)}return(0,H.jsx)(`main`,{style:{marginTop:`4em`},children:(0,H.jsxs)(`div`,{style:{maxWidth:`50em`,marginLeft:`auto`,marginRight:`auto`,textAlign:`center`},children:[(0,H.jsx)(`p`,{style:{marginBottom:`1em`},children:`Verbose logging generates a large amount of additional data in the FMS Insight Server debug log file.`}),(0,H.jsx)(Y,{disabled:e,onClick:n,variant:`contained`,children:e?(0,H.jsx)(`span`,{children:`Verbose Logging is Enabled`}):(0,H.jsx)(`span`,{children:`Enable Verbose Logging For 5 minutes`})})]})})}function hae(){return(0,H.jsxs)(`svg`,{width:`30px`,height:`30px`,viewBox:`0 0 170 170`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,H.jsxs)(`defs`,{children:[(0,H.jsx)(`path`,{id:`t`,d:`m307.5 125v77.5h-40c6.92-6.52 11.25-10.6 12.98-12.23 10.65-10.04 13.56-25.81 7.21-38.99-1.7-3.5-5.92-12.26-12.69-26.28z`}),(0,H.jsx)(`path`,{id:`ag`,d:`m273.88 120.52c-0.13 0.28-4.87 3.3-11.17 0.5-6.3-2.81-11.99-9.96-11.67-10.67 0.32-0.72 9.44-1.27 15.74 1.53 6.3 2.81 7.23 8.35 7.1 8.64z`}),(0,H.jsx)(`path`,{id:`m`,d:`m259 102.25c-0.13 0.29-4.2 3.61-9.02 1.46-4.81-2.14-8.75-8.51-8.43-9.23 0.31-0.71 7.69-2.05 12.5 0.1 4.82 2.14 5.07 7.39 4.95 7.67z`}),(0,H.jsx)(`path`,{id:`x`,d:`m282.79 114.2c-0.2 0.24-5.59 1.84-10.87-2.59-5.29-4.44-8.78-12.88-8.28-13.48 0.5-0.59 9.42 1.38 14.7 5.82 5.29 4.43 4.65 10.02 4.45 10.25z`}),(0,H.jsx)(`path`,{id:`k`,d:`m268.39 125.43c-0.12-0.28-4.33-3.54-9.45-1.26s-9.41 8.81-9.1 9.52c0.32 0.71 8.05 1.89 13.17-0.39s5.51-7.58 5.38-7.87z`}),(0,H.jsx)(`path`,{id:`ae`,d:`m243.83 111.58c0 0.31-2.61 5-8.43 5s-12.65-4.22-12.65-5 6.83-5 12.65-5 8.43 4.69 8.43 5z`}),(0,H.jsx)(`path`,{id:`l`,d:`m304.24 109.88c-0.31 0.04-5.38-2.38-6.34-9.21s2.09-15.44 2.86-15.55 6.08 7.33 7.04 14.16-3.25 10.55-3.56 10.6z`}),(0,H.jsx)(`path`,{id:`u`,d:`m306.79 80.57c-0.31 0.05-5.31-1.83-6.1-7.47-0.79-5.63 2.45-12.84 3.23-12.95 0.77-0.11 5.88 5.92 6.67 11.56s-3.49 8.82-3.8 8.86z`}),(0,H.jsx)(`path`,{id:`a`,d:`m306.13 58.04c-0.31 0.05-5.23-1.3-5.86-5.74-0.62-4.43 2.83-10.24 3.6-10.34 0.77-0.11 5.68 4.51 6.31 8.95 0.62 4.44-3.74 7.09-4.05 7.13z`}),(0,H.jsx)(`path`,{id:`f`,d:`m295.52 118.45c-0.29 0.13-6.1-1.39-9.5-9.02-3.39-7.64-3.53-18.31-2.82-18.63 0.72-0.32 8.56 6.93 11.96 14.56s0.64 12.97 0.36 13.09z`}),(0,H.jsx)(`path`,{id:`b`,d:`m272.35 90.11c-0.26 0.19-5.76 0.58-9.58-4.67-3.82-5.26-4.88-13.9-4.25-14.36s8.52 3.23 12.34 8.48 1.74 10.37 1.49 10.55z`}),(0,H.jsx)(`path`,{id:`s`,d:`m289.97 85.66c-0.28 0.13-5.97-0.97-9.17-7.84-3.21-6.87-3.15-16.73-2.44-17.06s8.3 5.96 11.5 12.83 0.4 11.94 0.11 12.07z`}),(0,H.jsx)(`path`,{id:`n`,d:`m270.16 65.57c-0.28 0.14-5.38 0.38-7.35-3.65-1.96-4.03-0.48-10.62 0.22-10.96s6.8 2.54 8.77 6.58c1.97 4.03-1.36 7.9-1.64 8.03z`}),(0,H.jsx)(`path`,{id:`ah`,d:`m250 80c-0.17 0.26-4.4 3.11-8.12 0.69s-5.79-8.79-5.37-9.45c0.43-0.65 7.1-1.35 10.82 1.06 3.72 2.42 2.84 7.44 2.67 7.7z`}),(0,H.jsx)(`path`,{id:`y`,d:`m236.47 96.58c-0.11 0.29-3.72 3.89-7.83 2.23-4.12-1.66-7.37-7.53-7.07-8.25 0.29-0.72 6.7-2.68 10.81-1.02 4.12 1.66 4.21 6.75 4.09 7.04z`}),(0,H.jsx)(`path`,{id:`aa`,d:`m290.52 56.48c-0.28 0.14-5.35 0.58-7.44-3.33-2.08-3.92-0.8-10.5-0.11-10.87s6.86 2.25 8.94 6.17c2.09 3.92-1.12 7.88-1.39 8.03z`}),(0,H.jsx)(`path`,{id:`af`,d:`m274.18 138.46c-0.16-0.26-5.28-2.6-11.13 1.06s-10.48 11.53-10.07 12.19 9.52-0.05 15.37-3.71 6-9.27 5.83-9.54z`}),(0,H.jsx)(`path`,{id:`z`,d:`m247.89 137.78c0.11 0.29-0.65 5.6-6.08 7.69-5.43 2.08-13.32 0.59-13.6-0.14s4.58-7.11 10.01-9.2c5.44-2.08 9.56 1.36 9.67 1.65z`}),(0,H.jsx)(`path`,{id:`h`,d:`m235.06 125.39c0.1 0.3-0.26 5.38-4.46 6.83-4.19 1.44-10.49-0.85-10.75-1.59-0.25-0.74 3.3-6.42 7.5-7.87 4.19-1.44 7.61 2.34 7.71 2.63z`}),(0,H.jsx)(`path`,{id:`ab`,d:`m317.14 85.63c0.28 0.13 5.97-0.98 9.17-7.85 3.21-6.87 3.14-16.72 2.44-17.05-0.71-0.33-8.3 5.95-11.5 12.82-3.21 6.87-0.4 11.94-0.11 12.08z`}),(0,H.jsx)(`path`,{id:`ac`,d:`m299.61 124.96v77.5h40c-6.93-6.52-11.25-10.6-12.99-12.23-10.64-10.03-13.56-25.81-7.2-38.99 1.69-3.5 5.92-12.26 12.69-26.28z`}),(0,H.jsx)(`path`,{id:`c`,d:`m348.11 102.22c0.13 0.28 4.2 3.6 9.01 1.46 4.82-2.15 8.76-8.52 8.44-9.23-0.32-0.72-7.69-2.05-12.5 0.09-4.82 2.14-5.08 7.39-4.95 7.68z`}),(0,H.jsx)(`path`,{id:`p`,d:`m324.32 114.17c0.2 0.24 5.59 1.83 10.87-2.6 5.29-4.43 8.78-12.87 8.28-13.47s-9.42 1.38-14.71 5.81c-5.28 4.43-4.64 10.02-4.44 10.26z`}),(0,H.jsx)(`path`,{id:`o`,d:`m338.71 125.4c0.13-0.29 4.34-3.55 9.46-1.27s9.41 8.81 9.09 9.52c-0.31 0.72-8.04 1.9-13.16-0.38s-5.51-7.59-5.39-7.87z`}),(0,H.jsx)(`path`,{id:`j`,d:`m363.28 111.54c0 0.32 2.61 5 8.43 5s12.65-4.21 12.65-5c0-0.78-6.83-5-12.65-5s-8.43 4.69-8.43 5z`}),(0,H.jsx)(`path`,{id:`w`,d:`m311.59 118.42c0.29 0.12 6.1-1.4 9.49-9.03 3.4-7.63 3.54-18.31 2.82-18.63-0.71-0.32-8.55 6.93-11.95 14.56s-0.64 12.97-0.36 13.1z`}),(0,H.jsx)(`path`,{id:`i`,d:`m334.76 90.08c0.25 0.18 5.76 0.57 9.58-4.68 3.81-5.25 4.88-13.9 4.25-14.36s-8.53 3.23-12.34 8.48c-3.82 5.26-1.74 10.37-1.49 10.56z`}),(0,H.jsx)(`path`,{id:`r`,d:`m333.23 120.48c0.12 0.29 4.86 3.31 11.17 0.5 6.3-2.81 11.98-9.96 11.67-10.67-0.32-0.71-9.44-1.27-15.74 1.53-6.3 2.81-7.23 8.35-7.1 8.64z`}),(0,H.jsx)(`path`,{id:`ad`,d:`m336.95 65.54c0.28 0.13 5.38 0.38 7.35-3.66 1.96-4.03 0.48-10.61-0.22-10.96-0.7-0.34-6.81 2.55-8.77 6.58-1.97 4.03 1.36 7.9 1.64 8.04z`}),(0,H.jsx)(`path`,{id:`ai`,d:`m357.11 79.96c0.17 0.27 4.39 3.11 8.12 0.69 3.72-2.41 5.79-8.79 5.36-9.44-0.42-0.66-7.09-1.36-10.81 1.06-3.72 2.41-2.84 7.43-2.67 7.69z`}),(0,H.jsx)(`path`,{id:`d`,d:`m370.63 96.55c0.12 0.29 3.73 3.89 7.84 2.22 4.11-1.66 7.37-7.52 7.07-8.25-0.29-0.72-6.7-2.68-10.82-1.02-4.11 1.66-4.2 6.76-4.09 7.05z`}),(0,H.jsx)(`path`,{id:`q`,d:`m316.59 56.44c0.28 0.15 5.35 0.59 7.43-3.33 2.09-3.92 0.81-10.5 0.12-10.87-0.69-0.36-6.86 2.26-8.95 6.17-2.08 3.92 1.12 7.88 1.4 8.03z`}),(0,H.jsx)(`path`,{id:`v`,d:`m332.93 138.42c0.16-0.26 5.28-2.59 11.13 1.06 5.85 3.66 10.48 11.53 10.07 12.19-0.42 0.66-9.52-0.05-15.37-3.71-5.85-3.65-6-9.27-5.83-9.54z`}),(0,H.jsx)(`path`,{id:`g`,d:`m359.22 137.74c-0.11 0.29 0.65 5.61 6.08 7.69 5.43 2.09 13.32 0.59 13.6-0.13 0.28-0.73-4.59-7.12-10.02-9.21-5.43-2.08-9.55 1.36-9.66 1.65z`}),(0,H.jsx)(`path`,{id:`e`,d:`m372.05 125.36c-0.1 0.29 0.26 5.37 4.45 6.82 4.2 1.44 10.5-0.85 10.75-1.59 0.26-0.74-3.29-6.42-7.49-7.87-4.2-1.44-7.61 2.34-7.71 2.64z`})]}),(0,H.jsx)(`g`,{transform:`translate(-219.32 -33)`,visibility:`inherit`,children:(0,H.jsxs)(`g`,{visibility:`inherit`,children:[(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#t`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#t`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#ag`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#ag`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#m`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#m`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#x`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#x`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#k`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#k`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#ae`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#ae`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#l`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#l`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#u`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#u`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#a`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#a`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#f`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#f`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#b`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#b`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#s`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#s`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#n`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#n`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#ah`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#y`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#y`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#aa`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#aa`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#af`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#af`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#z`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#z`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#h`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#h`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#ab`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#ab`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#ac`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#ac`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#c`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#c`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#p`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#p`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#o`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#o`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#j`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#j`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#w`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#w`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#i`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#i`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#r`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#r`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#ad`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#ad`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#ai`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#d`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#d`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#q`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#q`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#v`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#v`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#g`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#g`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fill:`#DBA72E`,href:`#e`}),(0,H.jsx)(`use`,{width:`100%`,height:`100%`,fillOpacity:`0`,stroke:`#DBA72E`,href:`#e`})]})})]})}var r6=`__FMS_INSIGHT_NEW_OPERATOR__`,gae=(0,L.memo)(function(){let e=R(br),[t,n]=B(jO),[r,i]=B(AO),[a,o]=(0,L.useState)(!1),[s,c]=(0,L.useState)(``);function l(e){e.target.value===r6?o(!0):n(e.target.value)}function u(e){i(t=>t.filter(t=>t!==e))}function d(){s!==``&&(i(e=>[...e.filter(e=>e!==s),s]),n(s),c(``),o(!1))}return e.user?(0,H.jsx)(`div`,{children:e.user.profile.name||e.user.profile.sub}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(YS,{value:t||``,onChange:l,variant:`standard`,renderValue:e=>e,children:[Q.of(r).sortBy(e=>e).map((e,t)=>(0,H.jsxs)(Hx,{value:e,children:[(0,H.jsx)(Lb,{primary:e}),(0,H.jsx)(Sb,{children:(0,H.jsx)(Um,{edge:`end`,onClick:()=>u(e),size:`large`,children:(0,H.jsx)(gre,{})})})]},t)),(0,H.jsx)(Hx,{value:r6,children:(0,H.jsx)(`em`,{children:`Create New Operator`})},`new`)]}),(0,H.jsxs)(cy,{open:a,onClose:()=>{o(!1),c(``)},children:[(0,H.jsx)(dy,{children:`Create New Operator`}),(0,H.jsx)(uy,{children:(0,H.jsx)(Kw,{value:s,onChange:e=>c(e.target.value),label:`New Name`,variant:`outlined`,autoFocus:!0,sx:{mt:`0.5em`},onKeyUp:e=>{e.keyCode===13&&d()}})}),(0,H.jsxs)(ly,{children:[(0,H.jsxs)(Y,{disabled:s===``,onClick:d,children:[`Create `,s]}),(0,H.jsx)(Y,{onClick:()=>{c(``),o(!1)},children:`Cancel`})]})]})]})}),_ae=(0,L.memo)(function(){let e=R(E3),t=R(XR),n=R(O3),r=R(QR),[i,a]=(0,L.useState)(!1);return(0,H.jsxs)(H.Fragment,{children:[n!=null||r!=null?(0,H.jsx)(X,{title:`Error`,children:(0,H.jsx)(Um,{onClick:()=>a(!0),size:`large`,children:(0,H.jsx)(bre,{})})}):void 0,e||t?(0,H.jsx)(X,{title:`Loading`,children:(0,H.jsx)(Lm,{"data-testid":`loading-icon`,color:`secondary`})}):void 0,(0,H.jsxs)(cy,{open:i,onClose:()=>a(!1),children:[(0,H.jsx)(dy,{children:`Error`}),(0,H.jsxs)(uy,{children:[n===null?void 0:(0,H.jsx)(`p`,{children:n}),r===null?void 0:(0,H.jsx)(`p`,{children:r})]}),(0,H.jsx)(ly,{children:(0,H.jsx)(Y,{onClick:()=>a(!1),children:`Close`})})]})]})}),vae=(0,L.memo)(function(){let e=R(br)?.customStationMonitorDialogUrl,[t,n]=(0,L.useState)(!1);if(!e)return null;let r=e.split(`/`),i=r[r.length-1];return i=i[0].toUpperCase()+i.substr(1),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{title:i,children:(0,H.jsx)(Um,{onClick:()=>n(!0),size:`large`,children:(0,H.jsx)(Nre,{})})}),(0,H.jsxs)(cy,{open:t,onClose:()=>n(!1),fullWidth:!0,maxWidth:`md`,children:[(0,H.jsx)(dy,{children:i}),(0,H.jsx)(uy,{children:(0,H.jsx)(`iframe`,{width:`100%`,src:e,sandbox:`allow-scripts`,style:{border:0,height:`calc(100vh - 250px)`}})}),(0,H.jsx)(ly,{children:(0,H.jsx)(Y,{color:`primary`,onClick:()=>n(!1),children:`Close`})})]})]})});function yae({d:e}){let t=$T(e,cE());return t>7?null:t>=0?(0,H.jsxs)(q,{variant:`subtitle1`,children:[`License expires on `,e.toDateString()]}):(0,H.jsxs)(q,{variant:`h6`,children:[`License expired on `,e.toDateString()]})}function i6(){let e=R(br),t=``;return t=e.name?(e.name||``)+` `+(e.version||``):`SeedTactic FMS Insight`,(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{title:t,children:(0,H.jsx)(`div`,{children:(0,H.jsx)(hae,{})})}),(0,H.jsx)(q,{variant:`h6`,style:{marginLeft:`1em`,marginRight:`2em`},children:`Insight`}),e?.licenseExpires?(0,H.jsx)(yae,{d:e.licenseExpires}):void 0]})}function bae(){let e=R(NO).alarms,t=e&&e.length>0;return(0,H.jsx)(X,{title:t?e.join(`. `):`No Alarms`,children:(0,H.jsx)(W_,{badgeContent:t?e.length:0,children:(0,H.jsx)(kre,{color:t?`error`:void 0})})})}function xae(){return(0,H.jsx)(X,{title:`Help`,children:(0,H.jsx)(Um,{"aria-label":`Help`,href:Fie(R(KI)),target:`_help`,size:`large`,children:(0,H.jsx)(cT,{})})})}function Sae(){return(0,H.jsx)(X,{title:`Logout`,children:(0,H.jsx)(Um,{"aria-label":`Logout`,onClick:Sr,size:`large`,children:(0,H.jsx)(xre,{})})})}function a6({showAlarms:e,showLogout:t,showSearch:n}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(_ae,{}),(0,H.jsx)(vae,{}),n?(0,H.jsx)(Uq,{}):void 0,n?(0,H.jsx)(UY,{}):void 0,(0,H.jsx)(xae,{}),t?(0,H.jsx)(Sae,{}):void 0,e?(0,H.jsx)(bae,{}):void 0]})}function Cae({menuNavs:e}){let t=R(br),[n,r]=B(KI),[i,a]=(0,L.useTransition)();return(0,H.jsx)(_y,{size:`small`,children:(0,H.jsx)(YS,{value:n.route,sx:{width:`16.5em`},onChange:t=>a(()=>{let n=e.find(e=>`separator`in e?!1:e.route.route===t.target.value);!n||`separator`in n||r(n.route)}),renderValue:()=>{let r=e.find(e=>`separator`in e?!1:e.route.route===n.route);return!r||`separator`in r?null:(0,H.jsxs)(J,{sx:{display:`flex`,alignItems:`center`},children:[r.icon,(0,H.jsxs)(q,{variant:`h6`,style:{marginLeft:`1em`},children:[typeof r.name==`string`?r.name:r.name(t),i?`...`:``]})]})},children:e.map((e,n)=>`separator`in e?(0,H.jsx)(m_,{children:e.separator},e.separator):e.hidden?.(t)?void 0:(0,H.jsxs)(Hx,{value:e.route.route,children:[(0,H.jsx)(Mb,{children:e.icon}),(0,H.jsx)(Lb,{primary:typeof e.name==`string`?e.name:e.name(t)})]},n))})})}function wae({showAlarms:e,showLogout:t,showSearch:n,showOperator:r,Nav1:i,Nav2:a,menuNavs:o}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(dh,{position:`static`,sx:{display:{xs:`none`,md:`block`}},children:(0,H.jsx)(Rw,{children:(0,H.jsxs)(J,{sx:{display:`grid`,gridTemplateColumns:a?`1fr auto 1fr`:`minmax(200px, 1fr) auto`,width:`100vw`,gridTemplateAreas:a?`"nav navCenter tools"`:`"nav tools"`},children:[(0,H.jsxs)(J,{sx:{gridArea:`nav`,display:`flex`,alignItems:`center`},children:[(0,H.jsx)(i6,{}),i?(0,H.jsx)(i,{}):void 0]}),a?(0,H.jsx)(J,{sx:{gridArea:`navCenter`},children:(0,H.jsx)(a,{})}):void 0,(0,H.jsxs)(J,{sx:{gridArea:`tools`,display:`flex`,alignItems:`center`,justifyContent:`flex-end`},children:[r?(0,H.jsx)(gae,{}):void 0,(0,H.jsx)(a6,{showAlarms:e,showLogout:t,showSearch:n})]})]})})}),(0,H.jsxs)(dh,{position:`static`,sx:{display:{xs:`block`,md:`none`}},children:[(0,H.jsxs)(Rw,{children:[(0,H.jsx)(i6,{}),(0,H.jsx)(`div`,{style:{flexGrow:1}}),(0,H.jsx)(a6,{showAlarms:e,showLogout:t,showSearch:n})]}),(0,H.jsxs)(J,{sx:{display:`grid`,gridTemplateColumns:`minmax(200px, 1fr) auto`},children:[(0,H.jsx)(J,{sx:{gridColumn:`1`},children:i?(0,H.jsx)(i,{}):void 0}),(0,H.jsx)(J,{sx:{gridColumn:`2`},children:a?(0,H.jsx)(a,{}):void 0})]})]}),o&&o.length>0?(0,H.jsx)(Up,{elevation:4,square:!0,component:`nav`,sx:{display:{xs:`block`,xl:`none`},padding:`2px`},children:(0,H.jsx)(Cae,{menuNavs:o})}):void 0]})}function Tae({menuItems:e}){let t=R(br),[n,r]=B(KI),[i,a]=(0,L.useTransition)();return!e||e.length===0?null:(0,H.jsx)(Up,{elevation:3,square:!0,sx:{flexShrink:0,display:{xs:`none`,xl:`block`},minHeight:`calc(100vh - 64px)`,zIndex:1},children:(0,H.jsx)(pb,{dense:!0,children:e?.map((e,o)=>`separator`in e?(0,H.jsx)(m_,{children:e.separator},e.separator):e.hidden?.(t)?void 0:(0,H.jsx)(Db,{children:(0,H.jsxs)(vb,{selected:n.route===e.route.route,onClick:()=>a(()=>r(e.route)),children:[(0,H.jsx)(Mb,{children:e.icon}),(0,H.jsx)(Lb,{primary:typeof e.name==`string`?e.name:e.name(t),sx:i?e=>({color:e.palette.grey[700]}):void 0})]})},o))})})}function Eae(e,t,n){return[{id:0,numeric:!1,label:`Date`,getDisplay:e=>e.endTime.toLocaleString(),getForSort:e=>e.endTime.getTime()},{id:1,numeric:!1,label:`Part`,getDisplay:e=>e.part+`-`+Q.of(e.material).map(e=>e.proc).distinctAndSortBy(e=>e).toRArray().join(`:`)},{id:2,numeric:!1,label:`Station`,getDisplay:e=>ak(e.stationGroup,e.stationNumber,t)},{id:6,numeric:!1,label:`Operation`,getDisplay:e=>e.operation},{id:3,numeric:!1,label:`Carrier`,getDisplay:e=>sk(e,n),getForSort:e=>qre(e)},{id:4,numeric:!1,label:`Serial`,getDisplay:e=>e.material.filter(e=>e.serial).map(e=>e.serial).join(`, `)},{id:5,numeric:!1,label:`Workorder`,getDisplay:e=>e.material.filter(e=>e.workorder).map(e=>e.workorder).join(`, `)},{id:7,numeric:!1,label:`Inspection`,getDisplay:t=>Bk(t,e),getForSort:t=>Q.of(t.material).collect(t=>e.get(t.id)).flatMap(e=>e.signaledInspections).distinct().toSortedArray(e=>e).join(`,`)},{id:8,numeric:!0,label:`Elapsed Min`,getDisplay:e=>(e.elapsedMinsPerMaterial*e.material.length).toFixed(1)},{id:9,numeric:!0,label:`Target Min`,getDisplay:e=>e.activeMinutes.toFixed(1)},{id:10,numeric:!0,label:`Median Elapsed Min`,getDisplay:e=>e.medianCycleMinutes.toFixed(1)},{id:11,numeric:!0,label:`Median Deviation`,getDisplay:e=>e.MAD_aboveMinutes.toFixed(1)}]}function Dae(e,t,n,r,i){let a;for(let e of t)e.id===r&&(a=e.getForSort||e.getDisplay);a===void 0&&(a=t[0].getForSort||t[0].getDisplay);let o=a,s=Q.of(e.values()).flatMap(e=>e);return(n?s.filter(e=>e.endTime>=n.start&&e.endTime<=n.end):s).toSortedArray(i===`desc`?{desc:o}:{asc:o},i===`desc`?{desc:e=>e.endTime.getTime()}:{asc:e=>e.endTime.getTime()})}function Oae(e){let t,n=e.set_date_zoom_range;return n&&(t=e.period.type===`Last30`?{type:`Last30Days`,set_days_back:e=>{if(e){let t=new Date;n({zoom:{start:LT(t,-e),end:BT(t,1)}})}else n({zoom:void 0})}}:{type:`ZoomIntoRange`,default_date_range:[e.period.month,RT(e.period.month,1)],current_date_zoom:e.current_date_zoom,set_date_zoom_range:e=>n({zoom:e})}),{zoom:t,zoomRange:e.current_date_zoom}}var o6=(0,L.memo)(function(e){let t=R(br),n=Eae(e.matsById,t.loadStationNames,ok(t.basketName)),r=f0(0,n),i=d0(),a=Oae(e),[o,s]=(0,L.useState)(null),c=z(SI),l=Dae(e.points,n,e.current_date_zoom,r.orderBy,r.order),u=l.length,d=l.slice(i.page*i.rowsPerPage,(i.page+1)*i.rowsPerPage),f=n.filter(t=>!(!e.showWorkorderAndInspect&&t.id===5||!e.showWorkorderAndInspect&&t.id===7||e.hideMedian&&t.id===10||e.hideMedian&&t.id===11));return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(jw,{children:[(0,H.jsx)(r0,{columns:f,sort:r,showDetailsCol:!0}),(0,H.jsx)(l0,{columns:f,pageData:d,rowsPerPage:i.rowsPerPage,onClickDetails:(e,t)=>{t.material.length!==0&&(t.material.length===1?c({type:`LogMat`,logMat:t.material[0]}):s({anchorEl:e.currentTarget,material:t.material}))},emptyMessage:e.emptyMessage})]}),(0,H.jsx)(c0,{zoom:a.zoom,tpage:i,count:u}),(0,H.jsx)(Rx,{anchorEl:o?.anchorEl,keepMounted:!0,open:o!==null,onClose:()=>s(null),children:o?.material.map((e,t)=>(0,H.jsx)(Hx,{onClick:()=>{c({type:`LogMat`,logMat:e}),s(null)},children:e.serial||`Material`},t))})]})});function s6({outlierTy:e}){JI(e===`machine`?`Machine Outliers`:`L/U Outliers`);let t=R(fL),n=R(br),r=cE(),i=R(uk),a=(0,L.useMemo)(()=>{let t=cE(),n=LT(t,-4),r=LT(t,1);return{seriesLabel:`Part`,data:i.valuesToLazySeq().filter(t=>t.isOutlier&&t.endTime>=n&&t.endTime<r&&$O(t)===(e===`labor`)).toRLookup(e=>e.part+`-`+e.material[0].proc.toString())}},[e,i]);return(0,H.jsxs)(J,{sx:{paddingLeft:`24px`,paddingRight:`24px`,paddingTop:`10px`},children:[(0,H.jsxs)(J,{component:`nav`,sx:{display:`flex`,minHeight:`2.5em`,alignItems:`center`,maxWidth:`calc(100vw - 24px - 24px)`},children:[(0,H.jsxs)(q,{variant:`subtitle1`,children:[e===`labor`?`Load/Unload`:`Machine`,` cycles from the past 5 days statistically outside expected range`]}),(0,H.jsx)(J,{sx:{flexGrow:1}}),(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{style:{height:`25px`,paddingTop:0,paddingBottom:0},onClick:()=>Hk(a,t.matsById,void 0,void 0,n.loadStationNames,n.basketName),size:`large`,children:(0,H.jsx)(uT,{})})})]}),(0,H.jsx)(`main`,{children:(0,H.jsx)(o6,{points:a.data,matsById:t.matsById,current_date_zoom:{start:LT(r,-4),end:LT(r,1)},set_date_zoom_range:void 0,period:{type:`Last30`},showWorkorderAndInspect:!1,defaultSortDesc:!0})})]})}var c6=class e{constructor(e,t){this.day=e,this.station=t}compare(e){let t=this.day.getTime()-e.day.getTime();return t===0?this.station.localeCompare(e.station):t}hash(){return yD(this.day,this.station)}toString(){return`{day: ${this.day.toISOString()}}, station: ${this.station}}`}adjustDay(t){return new e(t(this.day),this.station)}};function l6(e,t,n){let r=KT(e),i=KT(t);if(r.getTime()===i.getTime())return[{day:r,value:n}];{let a=[],o=t.getTime()-e.getTime();for(let s=r;s<=i;s=LT(s,1)){let r=ZT([s,e]),i=(QT([LT(s,1),t]).getTime()-r.getTime())/o;a.push({day:s,value:n*i})}return a}}function u6(e,t){return YO(Q.of(e),e=>e.stationLabel,e=>e.endTime).flatMap(([e,n])=>n.flatMap(e=>{let n=Q.of(e).sumBy(e=>e.elapsedMinsPerMaterial*e.material.length),r=YT(e[0].endTime,-n*60),i=Q.of(e).sumBy(e=>t(e));return l6(r,e[0].endTime,i)}).map(t=>({...t,statNameAndNum:e}))).buildHashMap(e=>new c6(e.day,e.statNameAndNum),(e,t)=>t.value+(e??0))}function d6(e){return u6(e,e=>e.activeMinutes)}function kae(e){return u6(e,e=>e.elapsedMinsPerMaterial*e.material.length)}function f6(e){let t=[];for(let n of e)if(t.length===0)t.push(n);else{let e=t[t.length-1];n.start<=e.end?t[t.length-1]={start:e.start,end:ZT([e.end,n.end])}:t.push(n)}return t}function p6(e){return Q.of(e).filter(e=>e.plannedDown).toLookupOrderedMap(e=>e.stationLabel,e=>e.start).toAscLazySeq().flatMap(([e,t])=>f6(t.valuesToAscLazySeq()).flatMap(t=>l6(t.start,t.end,rE(t.end,t.start)).map(t=>({...t,station:e})))).toHashMap(e=>[new c6(e.day,e.station),e.value],(e,t)=>e+t)}function m6(e){let t=Q.of(e).filter(e=>e.plannedDown).toLookupOrderedMap(e=>e.stationLabel,e=>e.start).mapValues(e=>f6(e.valuesToAscLazySeq()));return Q.of(e).filter(e=>!e.plannedDown).toLookupOrderedMap(e=>e.stationLabel,e=>e.start).toAscLazySeq().flatMap(([e,n])=>{let r=f6(n.valuesToAscLazySeq()),i=t.get(e)??[];for(let e=0,t=0;t<r.length;)if(e<i.length&&i[e].end<=r[t].start)e++;else if(e<i.length&&i[e].start<r[t].end){let n=r[t].start,a=r[t].end,o=i[e].start,s=i[e].end;o<=n&&s>=a?r.splice(t,1):o<=n?(r[t]={start:s,end:a},e+=1):s>=a?(r[t]={start:n,end:o},t+=1):(r[t]={start:n,end:o},r.splice(t+1,0,{start:s,end:a}),e++,t++)}else t++;return r.flatMap(t=>l6(t.start,t.end,rE(t.end,t.start)).map(t=>({...t,station:e})))}).toHashMap(e=>[new c6(e.day,e.station),e.value],(e,t)=>e+t)}function Aae(e,t,n,r,i){let a=d6(Q.of(r).filter(r=>n===`labor`===$O(r)&&r.endTime>=e&&r.endTime<=t)),o=Q.of(i).filter(r=>n===`labor`===r.station.startsWith(`L/U`)&&r.end>=e&&r.start<=t),s=p6(o),c=m6(o),l=[],u=a.keysToLazySeq().concat(c.keysToLazySeq()).map(e=>e.station).distinct().toSortedArray(e=>e);for(let n of u){let r=[];for(let i=e;i<t;i=LT(i,1)){let e=new c6(i,n),t=a.get(e),o=c.get(e),l=s.get(e)??0;r.push({x:i.toLocaleDateString(),y:(t??0)/60,plannedHours:(o??0)/60,actualOee:l<1440?(t??0)/(1440-l):0,plannedOee:l<1440?(o??0)/(1440-l):0,station:n,day:i})}l.push({station:n,points:r})}return l}var h6=class{constructor(e,t){this.x=e,this.y=t}compare(e){let t=this.x-e.x;return t===0?this.y.localeCompare(e.y):t}hash(){return yD(this.x,this.y)}toString(){return`{x: ${new Date(this.x).toISOString()}, y: ${this.y}}`}};function jae(e,t){let n=Q.of(t).toHashMap(e=>[new h6(e.x.getTime(),e.y),e],(e,t)=>t),r=Q.of(t).map(e=>e.x.getTime()).distinct().toSortedArray(e=>e),i=Q.of(t).map(e=>e.y).distinct().toSortedArray(e=>e),a=`<table>
|
|
356
356
|
<thead><tr><th>`+e+`</th>`;for(let e of r)a+=`<th>`+new Date(e).toDateString()+`</th>`;a+=`</tr></thead>
|
|
357
357
|
<tbody>
|
|
358
358
|
`;for(let e of i){a+=`<tr><th>`+e+`</th>`;for(let t of r){let r=n.get(new h6(t,e));r===void 0?a+=`<td></td>`:a+=`<td>`+r.label+`</td>`}a+=`</tr>
|
|
359
359
|
`}return a+=`</tbody>
|
|
360
|
-
</table>`,a}function
|
|
360
|
+
</table>`,a}function Mae(e,t){Ak(jae(e,t))}function Nae(e){let t=`<table>
|
|
361
361
|
<thead><tr>`;t+=`<th>Day</th><th>Station</th><th>Actual Hours</th><th>Planned Hours</th>`,t+=`</tr></thead>
|
|
362
362
|
<tbody>
|
|
363
363
|
`;for(let n of e)for(let e of n.points)t+=`<tr>`,t+=`<td>`+e.day.toLocaleDateString()+`</td>`,t+=`<td>`+e.station+`</td>`,t+=`<td>`+e.y.toFixed(1)+`</td>`,t+=`<td>`+e.plannedHours.toFixed(1)+`</td>`,t+=`</tr>
|
|
364
364
|
`;return t+=`</tbody>
|
|
365
|
-
</table>`,t}function Nae(e){Ak(Mae(e))}var g6=[[`4477aa`],[`4477aa`,`cc6677`],[`4477aa`,`ddcc77`,`cc6677`],[`4477aa`,`117733`,`ddcc77`,`cc6677`],[`332288`,`88ccee`,`117733`,`ddcc77`,`cc6677`],[`332288`,`88ccee`,`117733`,`ddcc77`,`cc6677`,`aa4499`],[`332288`,`88ccee`,`44aa99`,`117733`,`ddcc77`,`cc6677`,`aa4499`],[`332288`,`88ccee`,`44aa99`,`117733`,`999933`,`ddcc77`,`cc6677`,`aa4499`],[`332288`,`88ccee`,`44aa99`,`117733`,`999933`,`ddcc77`,`cc6677`,`882255`,`aa4499`],[`332288`,`88ccee`,`44aa99`,`117733`,`999933`,`ddcc77`,`661100`,`cc6677`,`882255`,`aa4499`],[`332288`,`6699cc`,`88ccee`,`44aa99`,`117733`,`999933`,`ddcc77`,`661100`,`cc6677`,`882255`,`aa4499`],[`332288`,`6699cc`,`88ccee`,`44aa99`,`117733`,`999933`,`ddcc77`,`661100`,`cc6677`,`aa4466`,`882255`,`aa4499`]],_6=`ff0029.377eb8.66a61e.984ea3.00d2d5.ff7f00.af8d00.7f80cd.b3e900.c42e60.a65628.f781bf.8dd3c7.bebada.fb8072.80b1d3.fdb462.fccde5.bc80bd.ffed6f.c4eaff.cf8c00.1b9e77.d95f02.e7298a.e6ab02.a6761d.0097ff.00d067.000000.252525.525252.737373.969696.bdbdbd.f43600.4ba93b.5779bb.927acc.97ee3f.bf3947.9f5b00.f48758.8caed6.f2b94f.eff26e.e43872.d9b100.9d7a00.698cff.d9d9d9.00d27e.d06800.009f82.c49200.cbe8ff.fecddf.c27eb6.8cd2ce.c4b8d9.f883b0.a49100.f48800.27d0df.a04a9b`.split(`.`);function v6(e,t){return t<=g6.length?`#`+g6[t-1][e]:`#`+_6[e%_6.length]}var y6=v6(0,2),b6=v6(1,2),x6=50,Pae=30,S6=10,C6=10;function Fae({width:e,height:t,points:n,setTooltip:r}){let i=t-S6-Pae,a=(0,L.useMemo)(()=>VM().domain([0,24]).range([i,0]),[i]),o=(0,L.useMemo)(()=>$A().domain(Q.of(n).map(e=>e.x).distinct()).range([0,e-x6-C6]).padding(.1),[n,e]),s=(0,L.useMemo)(()=>$A().domain([`Actual`,`Planned`]).range([0,o.bandwidth()]).padding(.05),[o]);return(0,H.jsx)(`svg`,{width:e,height:t,children:(0,H.jsxs)(`g`,{transform:`translate(${x6},${S6})`,children:[(0,H.jsx)(DA,{scale:o,top:i}),(0,H.jsx)(OA,{scale:a,left:0,label:`Hours`}),(0,H.jsx)(SA,{scale:a,width:e-x6-C6}),n.map((e,t)=>(0,H.jsxs)(`g`,{transform:`translate(${o(e.x)},0)`,children:[(0,H.jsx)(`rect`,{x:s(`Actual`),y:a(e.y),width:s.bandwidth(),height:i-a(e.y),fill:y6,onMouseEnter:t=>{let n=rA(t);r({left:n?.x??0,top:n?.y??0,datum:e})},onMouseLeave:()=>r(null)}),(0,H.jsx)(`rect`,{x:s(`Planned`),y:a(e.plannedHours),width:s.bandwidth(),height:i-a(e.plannedHours),fill:b6,onMouseEnter:t=>{let n=rA(t);r({left:n?.x??0,top:n?.y??0,datum:e})},onMouseLeave:()=>r(null)})]},t))]})})}function Iae({station:e}){return(0,H.jsxs)(`div`,{style:{marginTop:`1em`,display:`flex`,flexWrap:`wrap`,justifyContent:`space-evenly`},children:[(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(`div`,{style:{width:`14px`,height:`14px`,backgroundColor:y6}}),(0,H.jsxs)(`div`,{style:{marginLeft:`1em`},children:[e,` Actual`]})]}),(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(`div`,{style:{width:`14px`,height:`14px`,backgroundColor:b6}}),(0,H.jsxs)(`div`,{style:{marginLeft:`1em`},children:[e,` Planned`]})]})]})}function Lae({tooltip:e}){return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{children:e.datum.x}),(0,H.jsxs)(`div`,{children:[`Actual Hours: `,e.datum.y?.toFixed(1)]}),(0,H.jsxs)(`div`,{children:[`Planned Hours: `,e.datum?.plannedHours?.toFixed(1)]})]})}function Rae({series:e}){let t=(0,L.useMemo)(()=>P(null),[]),n=z(t);return(0,H.jsxs)(yy,{size:{xs:12,md:6},onMouseLeave:()=>n(null),children:[(0,H.jsx)(gA,{sx:{height:`calc(100vh / 2 - 200px)`},chart:({width:t,height:r})=>(0,H.jsx)(Fae,{width:t,height:r,points:e.points,setTooltip:n}),tooltipAtom:t,TooltipContent:Lae}),(0,H.jsx)(Iae,{station:e.station})]})}function zae({points:e}){return(0,H.jsx)(yy,{container:!0,children:e.map((e,t)=>(0,H.jsx)(Rae,{series:e},t))})}var w6=[{id:0,numeric:!1,label:`Date`,getDisplay:e=>e.x,getForSort:e=>e.day.getTime()},{id:1,numeric:!1,label:`Station`,getDisplay:e=>e.station},{id:2,numeric:!0,label:`Actual Hours`,getDisplay:e=>e.y.toFixed(1),getForSort:e=>e.y},{id:3,numeric:!0,label:`Actual OEE`,getDisplay:e=>(e.actualOee*100).toFixed(0)+`%`,getForSort:e=>e.actualOee},{id:4,numeric:!0,label:`Planned Hours`,getDisplay:e=>e.plannedHours.toFixed(1),getForSort:e=>e.plannedHours},{id:5,numeric:!0,label:`Planned OEE`,getDisplay:e=>(e.plannedOee*100).toFixed(0)+`%`,getForSort:e=>e.plannedOee}];function Bae(e,t){return Q.of(e).flatMap(e=>e.points).toSortedArray(t)}var Vae=(0,L.memo)(function({points:e}){let t=d0(0,w6);return(0,H.jsxs)(jw,{children:[(0,H.jsx)(n0,{columns:w6,sort:t,showDetailsCol:!1}),(0,H.jsx)(c0,{columns:w6,pageData:Bae(e,t.sortOn)})]})}),Hae=P(!0),Uae=P(!0);function T6({ty:e}){JI(e===`labor`?`L/U OEE`:`Machine OEE`);let[t,n]=B(e===`labor`?Hae:Uae),r=LT(cE(),-6),i=LT(cE(),1),a=R(uk),o=R(Xk),s=(0,L.useMemo)(()=>kae(r,i,e,a.valuesToLazySeq(),o),[r,i,e,a,o]);return(0,H.jsxs)(J,{sx:{paddingLeft:`24px`,paddingRight:`24px`,paddingTop:`10px`},children:[(0,H.jsxs)(J,{component:`nav`,sx:{display:`flex`,minHeight:`2.5em`,alignItems:`center`,maxWidth:`calc(100vw - 24px - 24px)`},children:[(0,H.jsxs)(q,{variant:`subtitle1`,children:[e===`labor`?`Load/Unload`:`Machine`,` OEE: comparing flexplan hours between actual and simulated production`]}),(0,H.jsx)(J,{sx:{flexGrow:1}}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,value:t?`chart`:`table`,onChange:e=>n(e.target.value===`chart`),children:[(0,H.jsx)(Hx,{value:`chart`,children:`Chart`},`chart`),(0,H.jsx)(Hx,{value:`table`,children:`Table`},`table`)]})}),(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{style:{height:`25px`,paddingTop:0,paddingBottom:0},onClick:()=>Nae(s),size:`large`,children:(0,H.jsx)(uT,{})})})]}),(0,H.jsx)(`main`,{children:t?(0,H.jsx)(zae,{points:s}):(0,H.jsx)(Vae,{points:s})})]})}var E6=Object.defineProperty,Wae=(e,t)=>{let n={};for(var r in e)E6(n,r,{get:e[r],enumerable:!0});return t||E6(n,Symbol.toStringTag,{value:`Module`}),n},D6=U6(),O6=e=>z6(e,D6),k6=U6();O6.write=e=>z6(e,k6);var A6=U6();O6.onStart=e=>z6(e,A6);var j6=U6();O6.onFrame=e=>z6(e,j6);var M6=U6();O6.onFinish=e=>z6(e,M6);var N6=[];O6.setTimeout=(e,t)=>{let n=O6.now()+t,r=()=>{let e=N6.findIndex(e=>e.cancel==r);~e&&N6.splice(e,1),L6-=+!!~e},i={time:n,handler:e,cancel:r};return N6.splice(P6(n),0,i),L6+=1,B6(),i};var P6=e=>~(~N6.findIndex(t=>t.time>e)||~N6.length);O6.cancel=e=>{A6.delete(e),j6.delete(e),M6.delete(e),D6.delete(e),k6.delete(e)},O6.sync=e=>{R6=!0,O6.batchedUpdates(e),R6=!1},O6.throttle=e=>{let t;function n(){try{e(...t)}finally{t=null}}function r(...e){t=e,O6.onStart(n)}return r.handler=e,r.cancel=()=>{A6.delete(n),t=null},r};var F6=typeof window<`u`?window.requestAnimationFrame:()=>{};O6.use=e=>F6=e,O6.now=typeof performance<`u`?()=>performance.now():Date.now,O6.batchedUpdates=e=>e(),O6.catch=console.error,O6.frameLoop=`always`,O6.onDemand=()=>{},O6.advance=()=>{O6.frameLoop===`demand`?H6():console.warn(`Cannot call the manual advancement of rafz whilst frameLoop is not set as demand`)};var I6=-1,L6=0,R6=!1;function z6(e,t){R6?(t.delete(e),e(0)):(t.add(e),B6(),O6.frameLoop===`demand`&&O6.onDemand())}function B6(){I6<0&&(I6=0,O6.frameLoop!==`demand`&&F6(V6))}function Gae(){I6=-1}function V6(){~I6&&(F6(V6),O6.batchedUpdates(H6))}function H6(){let e=I6;I6=O6.now();let t=P6(I6);if(t&&(W6(N6.splice(0,t),e=>e.handler()),L6-=t),!L6){Gae();return}A6.flush(),D6.flush(e?Math.min(64,I6-e):16.667),j6.flush(),k6.flush(),M6.flush(),O6.frameLoop===`demand`&&L6>0&&O6.onDemand()}function U6(){let e=new Set,t=e;return{add(n){L6+=+(t==e&&!e.has(n)),e.add(n)},delete(n){return L6-=t==e&&e.has(n)?1:0,e.delete(n)},flush(n){t.size&&(e=new Set,L6-=t.size,W6(t,t=>t(n)&&e.add(t)),L6+=e.size,t=e)}}}function W6(e,t){e.forEach(e=>{try{t(e)}catch(e){O6.catch(e)}})}function G6(){}var Kae=(e,t,n)=>Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0}),K6={arr:Array.isArray,obj:e=>!!e&&e.constructor.name===`Object`,fun:(e=>typeof e==`function`),str:e=>typeof e==`string`,num:e=>typeof e==`number`,und:e=>e===void 0};function q6(e,t){if(K6.arr(e)){if(!K6.arr(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return e===t}var J6=(e,t)=>e.forEach(t);function Y6(e,t,n){if(K6.arr(e)){for(let r=0;r<e.length;r++)t.call(n,e[r],`${r}`);return}for(let r in e)e.hasOwnProperty(r)&&t.call(n,e[r],r)}var X6=e=>K6.und(e)?[]:K6.arr(e)?e:[e];function Z6(e,t){if(e.size){let n=Array.from(e);e.clear(),J6(n,t)}}var Q6=(e,...t)=>Z6(e,e=>e(...t)),$6=()=>typeof window>`u`||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),e8=Wae({assign:()=>qae,colors:()=>r8,createStringInterpolator:()=>t8,skipAnimation:()=>i8,to:()=>n8,willAdvance:()=>a8}),t8,n8,r8=null,i8=!1,a8=G6,qae=e=>{e.to&&(n8=e.to),e.now&&(O6.now=e.now),e.colors!==void 0&&(r8=e.colors),e.skipAnimation!=null&&(i8=e.skipAnimation),e.createStringInterpolator&&(t8=e.createStringInterpolator),e.requestAnimationFrame&&O6.use(e.requestAnimationFrame),e.batchedUpdates&&(O6.batchedUpdates=e.batchedUpdates),e.willAdvance&&(a8=e.willAdvance),e.frameLoop&&(O6.frameLoop=e.frameLoop),e.onDemand&&(O6.onDemand=e.onDemand)},o8=new Set,s8=[],c8=[],l8=0,u8={get idle(){return!o8.size&&!s8.length},start(e){l8>e.priority?(o8.add(e),O6.onStart(Jae)):(d8(e),O6(p8))},advance:p8,sort(e){if(l8)O6.onFrame(()=>u8.sort(e));else{let t=s8.indexOf(e);~t&&(s8.splice(t,1),f8(e))}},clear(){s8=[],o8.clear()}};function Jae(){o8.forEach(d8),o8.clear(),O6(p8)}function d8(e){s8.includes(e)||f8(e)}function f8(e){s8.splice(Yae(s8,t=>t.priority>e.priority),0,e)}function p8(e){let t=c8;for(let n=0;n<s8.length;n++){let r=s8[n];l8=r.priority,r.idle||(a8(r),r.advance(e),r.idle||t.push(r))}return l8=0,c8=s8,c8.length=0,s8=t,s8.length>0}function Yae(e,t){let n=e.findIndex(t);return n<0?e.length:n}var Xae=(e,t,n)=>Math.min(Math.max(n,e),t),Zae={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199},m8=`[-+]?\\d*\\.?\\d+`,h8=`[-+]?\\d*\\.?\\d+%`;function g8(...e){return`\\(\\s*(`+e.join(`)\\s*,\\s*(`)+`)\\s*\\)`}var Qae=RegExp(`rgb`+g8(m8,m8,m8)),$ae=RegExp(`rgba`+g8(m8,m8,m8,m8)),eoe=RegExp(`hsl`+g8(m8,h8,h8)),toe=RegExp(`hsla`+g8(m8,h8,h8,m8)),noe=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,roe=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,ioe=/^#([0-9a-fA-F]{6})$/,aoe=/^#([0-9a-fA-F]{8})$/;function ooe(e){let t;return typeof e==`number`?e>>>0===e&&e>=0&&e<=4294967295?e:null:(t=ioe.exec(e))?parseInt(t[1]+`ff`,16)>>>0:r8&&r8[e]!==void 0?r8[e]:(t=Qae.exec(e))?(y8(t[1])<<24|y8(t[2])<<16|y8(t[3])<<8|255)>>>0:(t=$ae.exec(e))?(y8(t[1])<<24|y8(t[2])<<16|y8(t[3])<<8|x8(t[4]))>>>0:(t=noe.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+`ff`,16)>>>0:(t=aoe.exec(e))?parseInt(t[1],16)>>>0:(t=roe.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4],16)>>>0:(t=eoe.exec(e))?(v8(b8(t[1]),S8(t[2]),S8(t[3]))|255)>>>0:(t=toe.exec(e))?(v8(b8(t[1]),S8(t[2]),S8(t[3]))|x8(t[4]))>>>0:null}function _8(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function v8(e,t,n){let r=n<.5?n*(1+t):n+t-n*t,i=2*n-r,a=_8(i,r,e+1/3),o=_8(i,r,e),s=_8(i,r,e-1/3);return Math.round(a*255)<<24|Math.round(o*255)<<16|Math.round(s*255)<<8}function y8(e){let t=parseInt(e,10);return t<0?0:t>255?255:t}function b8(e){return(parseFloat(e)%360+360)%360/360}function x8(e){let t=parseFloat(e);return t<0?0:t>1?255:Math.round(t*255)}function S8(e){let t=parseFloat(e);return t<0?0:t>100?1:t/100}function C8(e){let t=ooe(e);return t===null?e:(t||=0,`rgba(${(t&4278190080)>>>24}, ${(t&16711680)>>>16}, ${(t&65280)>>>8}, ${(t&255)/255})`)}var w8=(e,t,n)=>{if(K6.fun(e))return e;if(K6.arr(e))return w8({range:e,output:t,extrapolate:n});if(K6.str(e.output[0]))return t8(e);let r=e,i=r.output,a=r.range||[0,1],o=r.extrapolateLeft||r.extrapolate||`extend`,s=r.extrapolateRight||r.extrapolate||`extend`,c=r.easing||(e=>e);return e=>{let t=coe(e,a);return soe(e,a[t],a[t+1],i[t],i[t+1],c,o,s,r.map)}};function soe(e,t,n,r,i,a,o,s,c){let l=c?c(e):e;if(l<t){if(o===`identity`)return l;o===`clamp`&&(l=t)}if(l>n){if(s===`identity`)return l;s===`clamp`&&(l=n)}return r===i?r:t===n?e<=t?r:i:(t===-1/0?l=-l:n===1/0?l-=t:l=(l-t)/(n-t),l=a(l),r===-1/0?l=-l:i===1/0?l+=r:l=l*(i-r)+r,l)}function coe(e,t){for(var n=1;n<t.length-1&&!(t[n]>=e);++n);return n-1}var loe=(e,t=`end`)=>n=>{n=t===`end`?Math.min(n,.999):Math.max(n,.001);let r=n*e;return Xae(0,1,(t===`end`?Math.floor(r):Math.ceil(r))/e)},T8=1.70158,E8=T8*1.525,D8=2.70158,O8=2*Math.PI/3,k8=2*Math.PI/4.5,A8=e=>{let t=7.5625,n=2.75;return e<1/n?t*e*e:e<2/n?t*(e-=1.5/n)*e+.75:e<2.5/n?t*(e-=2.25/n)*e+.9375:t*(e-=2.625/n)*e+.984375},uoe={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>1-(1-e)*(1-e),easeInOutQuad:e=>e<.5?2*e*e:1-(-2*e+2)**2/2,easeInCubic:e=>e*e*e,easeOutCubic:e=>1-(1-e)**3,easeInOutCubic:e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2,easeInQuart:e=>e*e*e*e,easeOutQuart:e=>1-(1-e)**4,easeInOutQuart:e=>e<.5?8*e*e*e*e:1-(-2*e+2)**4/2,easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>1-(1-e)**5,easeInOutQuint:e=>e<.5?16*e*e*e*e*e:1-(-2*e+2)**5/2,easeInSine:e=>1-Math.cos(e*Math.PI/2),easeOutSine:e=>Math.sin(e*Math.PI/2),easeInOutSine:e=>-(Math.cos(Math.PI*e)-1)/2,easeInExpo:e=>e===0?0:2**(10*e-10),easeOutExpo:e=>e===1?1:1-2**(-10*e),easeInOutExpo:e=>e===0?0:e===1?1:e<.5?2**(20*e-10)/2:(2-2**(-20*e+10))/2,easeInCirc:e=>1-Math.sqrt(1-e**2),easeOutCirc:e=>Math.sqrt(1-(e-1)**2),easeInOutCirc:e=>e<.5?(1-Math.sqrt(1-(2*e)**2))/2:(Math.sqrt(1-(-2*e+2)**2)+1)/2,easeInBack:e=>D8*e*e*e-T8*e*e,easeOutBack:e=>1+D8*(e-1)**3+T8*(e-1)**2,easeInOutBack:e=>e<.5?(2*e)**2*(3.5949095*2*e-E8)/2:((2*e-2)**2*(3.5949095*(e*2-2)+E8)+2)/2,easeInElastic:e=>e===0?0:e===1?1:-(2**(10*e-10))*Math.sin((e*10-10.75)*O8),easeOutElastic:e=>e===0?0:e===1?1:2**(-10*e)*Math.sin((e*10-.75)*O8)+1,easeInOutElastic:e=>e===0?0:e===1?1:e<.5?-(2**(20*e-10)*Math.sin((20*e-11.125)*k8))/2:2**(-20*e+10)*Math.sin((20*e-11.125)*k8)/2+1,easeInBounce:e=>1-A8(1-e),easeOutBounce:A8,easeInOutBounce:e=>e<.5?(1-A8(1-2*e))/2:(1+A8(2*e-1))/2,steps:loe},j8=Symbol.for(`FluidValue.get`),M8=Symbol.for(`FluidValue.observers`),N8=e=>!!(e&&e[j8]),P8=e=>e&&e[j8]?e[j8]():e,F8=e=>e[M8]||null;function doe(e,t){e.eventObserved?e.eventObserved(t):e(t)}function I8(e,t){let n=e[M8];n&&n.forEach(e=>{doe(e,t)})}var L8=class{constructor(e){if(!e&&!(e=this.get))throw Error(`Unknown getter`);foe(this,e)}},foe=(e,t)=>B8(e,j8,t);function R8(e,t){if(e[j8]){let n=e[M8];n||B8(e,M8,n=new Set),n.has(t)||(n.add(t),e.observerAdded&&e.observerAdded(n.size,t))}return t}function z8(e,t){let n=e[M8];if(n&&n.has(t)){let r=n.size-1;r?n.delete(t):e[M8]=null,e.observerRemoved&&e.observerRemoved(r,t)}}var B8=(e,t,n)=>Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0}),V8=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,poe=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,H8=RegExp(`(${V8.source})(%|[a-z]+)`,`i`),moe=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,U8=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/,W8=e=>{let[t,n]=hoe(e);if(!t||$6())return e;let r=window.getComputedStyle(document.documentElement).getPropertyValue(t);return r?r.trim():n&&n.startsWith(`--`)?window.getComputedStyle(document.documentElement).getPropertyValue(n)||e:n&&U8.test(n)?W8(n):n||e},hoe=e=>{let t=U8.exec(e);if(!t)return[,];let[,n,r]=t;return[n,r]},G8,goe=(e,t,n,r,i)=>`rgba(${Math.round(t)}, ${Math.round(n)}, ${Math.round(r)}, ${i})`,K8=e=>e.match(V8)??[],q8=e=>{G8||=r8?RegExp(`(${Object.keys(r8).join(`|`)})(?!\\w)`,`g`):/^\b$/;let t=e.output.map(e=>P8(e).replace(U8,W8).replace(poe,C8).replace(G8,C8)),n=t.map(e=>K8(e).map(Number)),r=n[0].map((e,t)=>n.map(e=>{if(!(t in e))throw Error(`The arity of each "output" value must be equal`);return e[t]})).map(t=>w8({...e,output:t})),i=e.range||[0,1],a=t.map(e=>K8(e)),o=a[0].map((e,t)=>{let n=a.map(e=>{let n=e[t],r=n.indexOf(`.`);return r===-1?0:n.length-r-1});return n.every(e=>e===n[0])&&n[0]>0?n[0]:null});return e=>{let n=i.indexOf(e);if(n!==-1)return t[n];let a=!H8.test(t[0])&&t.find(e=>H8.test(e))?.replace(V8,``),s=0;return t[0].replace(V8,()=>{let t=s++,n=r[t](e),i=o[t];return`${i==null?n:n.toFixed(i)}${a||``}`}).replace(moe,goe)}},J8=`react-spring: `,Y8=e=>{let t=e,n=!1;if(typeof t!=`function`)throw TypeError(`${J8}once requires a function parameter`);return(...e)=>{n||=(t(...e),!0)}},_oe=Y8(console.warn);function voe(){_oe(`${J8}The "interpolate" function is deprecated in v9 (use "to" instead)`)}var yoe=Y8(console.warn);function boe(){yoe(`${J8}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`)}function X8(e){return K6.str(e)&&(e[0]==`#`||/\d/.test(e)||!$6()&&U8.test(e)||e in(r8||{}))}var Z8=$6()?L.useEffect:L.useLayoutEffect,xoe=()=>{let e=(0,L.useRef)(!1);return Z8(()=>(e.current=!0,()=>{e.current=!1}),[]),e};function Q8(){let e=(0,L.useState)()[1],t=xoe();return()=>{t.current&&e(Math.random())}}var $8=e=>(0,L.useEffect)(e,Soe),Soe=[];function e5(e){let t=(0,L.useRef)(void 0);return(0,L.useEffect)(()=>{t.current=e}),t.current}var t5=Symbol.for(`Animated:node`),Coe=e=>!!e&&e[t5]===e,n5=e=>e&&e[t5],r5=(e,t)=>Kae(e,t5,t),i5=e=>e&&e[t5]&&e[t5].getPayload(),a5=class{constructor(){r5(this,this)}getPayload(){return this.payload||[]}},o5=class e extends a5{constructor(e){super(),this._value=e,this.done=!0,this.durationProgress=0,K6.num(this._value)&&(this.lastPosition=this._value)}static create(t){return new e(t)}getPayload(){return[this]}getValue(){return this._value}setValue(e,t){return K6.num(e)&&(this.lastPosition=e,t&&(e=Math.round(e/t)*t,this.done&&(this.lastPosition=e))),this._value===e?!1:(this._value=e,!0)}reset(){let{done:e}=this;this.done=!1,K6.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,e&&(this.lastVelocity=null),this.v0=null)}},s5=class e extends o5{constructor(e){super(0),this._string=null,this._toString=w8({output:[e,e]})}static create(t){return new e(t)}getValue(){return this._string??=this._toString(this._value)}setValue(e){if(K6.str(e)){if(e==this._string)return!1;this._string=e,this._value=1}else if(super.setValue(e))this._string=null;else return!1;return!0}reset(e){e&&(this._toString=w8({output:[this.getValue(),e]})),this._value=0,super.reset()}},c5={dependencies:null},l5=class extends a5{constructor(e){super(),this.source=e,this.setValue(e)}getValue(e){let t={};return Y6(this.source,(n,r)=>{Coe(n)?t[r]=n.getValue(e):N8(n)?t[r]=P8(n):e||(t[r]=n)}),t}setValue(e){this.source=e,this.payload=this._makePayload(e)}reset(){this.payload&&J6(this.payload,e=>e.reset())}_makePayload(e){if(e){let t=new Set;return Y6(e,this._addToPayload,t),Array.from(t)}}_addToPayload(e){c5.dependencies&&N8(e)&&c5.dependencies.add(e);let t=i5(e);t&&J6(t,e=>this.add(e))}},woe=class e extends l5{constructor(e){super(e)}static create(t){return new e(t)}getValue(){return this.source.map(e=>e.getValue())}setValue(e){let t=this.getPayload();return e.length==t.length?t.map((t,n)=>t.setValue(e[n])).some(Boolean):(super.setValue(e.map(Toe)),!0)}};function Toe(e){return(X8(e)?s5:o5).create(e)}function u5(e){let t=n5(e);return t?t.constructor:K6.arr(e)?woe:X8(e)?s5:o5}var d5=(e,t)=>{let n=!K6.fun(e)||e.prototype&&e.prototype.isReactComponent;return(0,L.forwardRef)((r,i)=>{let a=(0,L.useRef)(null),o=n&&(0,L.useCallback)(e=>{a.current=Ooe(i,e)},[i]),[s,c]=Doe(r,t),l=Q8(),u=()=>{let e=a.current;n&&!e||(e?t.applyAnimatedValues(e,s.getValue(!0)):!1)===!1&&l()},d=new Eoe(u,c),f=(0,L.useRef)(void 0);Z8(()=>(f.current=d,J6(c,e=>R8(e,d)),()=>{f.current&&(J6(f.current.deps,e=>z8(e,f.current)),O6.cancel(f.current.update))})),(0,L.useEffect)(u,[]),$8(()=>()=>{let e=f.current;J6(e.deps,t=>z8(t,e))});let p=t.getComponentProps(s.getValue());return L.createElement(e,{...p,ref:o})})},Eoe=class{constructor(e,t){this.update=e,this.deps=t}eventObserved(e){e.type==`change`&&O6.write(this.update)}};function Doe(e,t){let n=new Set;return c5.dependencies=n,e.style&&(e={...e,style:t.createAnimatedStyle(e.style)}),e=new l5(e),c5.dependencies=null,[e,n]}function Ooe(e,t){return e&&(K6.fun(e)?e(t):e.current=t),t}var f5=Symbol.for(`AnimatedComponent`),p5=new WeakMap,koe=(e,{applyAnimatedValues:t=()=>!1,createAnimatedStyle:n=e=>new l5(e),getComponentProps:r=e=>e}={})=>{let i={applyAnimatedValues:t,createAnimatedStyle:n,getComponentProps:r},a=e=>{let t=m5(e)||`Anonymous`;if(K6.str(e))e=a[e]||(a[e]=d5(e,i));else{let t=e[f5]??p5.get(e);if(!t){t=d5(e,i);try{e[f5]=t}catch{}p5.set(e,t)}e=t}return e.displayName=`Animated(${t})`,e};return Y6(e,(t,n)=>{K6.arr(e)&&(n=m5(t)),a[n]=a(t)}),{animated:a}},m5=e=>K6.str(e)?e:e&&K6.str(e.displayName)?e.displayName:K6.fun(e)&&e.name||null;function h5(e,...t){return K6.fun(e)?e(...t):e}var g5=(e,t)=>e===!0||!!(t&&e&&(K6.fun(e)?e(t):X6(e).includes(t))),_5=(e,t)=>K6.obj(e)?t&&e[t]:e,v5=(e,t)=>e.default===!0?e[t]:e.default?e.default[t]:void 0,Aoe=e=>e,y5=(e,t=Aoe)=>{let n=joe;e.default&&e.default!==!0&&(e=e.default,n=Object.keys(e));let r={};for(let i of n){let n=t(e[i],i);K6.und(n)||(r[i]=n)}return r},joe=[`config`,`onProps`,`onStart`,`onChange`,`onPause`,`onResume`,`onRest`],Moe={config:1,from:1,to:1,ref:1,loop:1,reset:1,pause:1,cancel:1,reverse:1,immediate:1,default:1,delay:1,onProps:1,onStart:1,onChange:1,onPause:1,onResume:1,onRest:1,onResolve:1,items:1,trail:1,sort:1,expires:1,initial:1,enter:1,update:1,leave:1,children:1,onDestroyed:1,keys:1,callId:1,parentId:1};function Noe(e){let t={},n=0;if(Y6(e,(e,r)=>{Moe[r]||(t[r]=e,n++)}),n)return t}function b5(e){let t=Noe(e);if(t){let n={to:t};return Y6(e,(e,r)=>r in t||(n[r]=e)),n}return{...e}}function x5(e){let t=P8(e);return K6.arr(t)?t.map(x5):X8(t)?e8.createStringInterpolator({range:[0,1],output:[t,t]})(1):t}function Poe(e){for(let t in e)return!0;return!1}function S5(e){return K6.fun(e)||K6.arr(e)&&K6.obj(e[0])}function Foe(e,t){e.ref?.delete(e),t?.delete(e)}function Ioe(e,t){t&&e.ref!==t&&(e.ref?.delete(e),t.add(e),e.ref=t)}var C5={...{default:{tension:170,friction:26},gentle:{tension:120,friction:14},wobbly:{tension:180,friction:12},stiff:{tension:210,friction:20},slow:{tension:280,friction:60},molasses:{tension:280,friction:120}}.default,mass:1,damping:1,easing:uoe.linear,clamp:!1},Loe=class{constructor(){this.velocity=0,Object.assign(this,C5)}};function Roe(e,t,n){n&&(n={...n},w5(n,t),t={...n,...t}),w5(e,t),Object.assign(e,t);for(let t in C5)e[t]??(e[t]=C5[t]);let{frequency:r,damping:i}=e,{mass:a}=e;return K6.und(r)||(r<.01&&(r=.01),i<0&&(i=0),e.tension=(2*Math.PI/r)**2*a,e.friction=4*Math.PI*i*a/r),e}function w5(e,t){if(!K6.und(t.decay))e.duration=void 0;else{let n=!K6.und(t.tension)||!K6.und(t.friction);(n||!K6.und(t.frequency)||!K6.und(t.damping)||!K6.und(t.mass))&&(e.duration=void 0,e.decay=void 0),n&&(e.frequency=void 0)}}var T5=[],zoe=class{constructor(){this.changed=!1,this.values=T5,this.toValues=null,this.fromValues=T5,this.config=new Loe,this.immediate=!1}};function E5(e,{key:t,props:n,defaultProps:r,state:i,actions:a}){return new Promise((o,s)=>{let c,l,u=g5(n.cancel??r?.cancel,t);if(u)p();else{K6.und(n.pause)||(i.paused=g5(n.pause,t));let e=r?.pause;e!==!0&&(e=i.paused||g5(e,t)),c=h5(n.delay||0,t),e?(i.resumeQueue.add(f),a.pause()):(a.resume(),f())}function d(){i.resumeQueue.add(f),i.timeouts.delete(l),l.cancel(),c=l.time-O6.now()}function f(){c>0&&!e8.skipAnimation?(i.delayed=!0,l=O6.setTimeout(p,c),i.pauseQueue.add(d),i.timeouts.add(l)):p()}function p(){i.delayed&&=!1,i.pauseQueue.delete(d),i.timeouts.delete(l),e<=(i.cancelId||0)&&(u=!0);try{a.start({...n,callId:e,cancel:u},o)}catch(e){s(e)}}})}var D5=(e,t)=>t.length==1?t[0]:t.some(e=>e.cancelled)?A5(e.get()):t.every(e=>e.noop)?O5(e.get()):k5(e.get(),t.every(e=>e.finished)),O5=e=>({value:e,noop:!0,finished:!0,cancelled:!1}),k5=(e,t,n=!1)=>({value:e,finished:t,cancelled:n}),A5=e=>({value:e,cancelled:!0,finished:!1});function j5(e,t,n,r){let{callId:i,parentId:a,onRest:o}=t,{asyncTo:s,promise:c}=n;return!a&&e===s&&!t.reset?c:n.promise=(async()=>{n.asyncId=i,n.asyncTo=e;let l=y5(t,(e,t)=>t===`onRest`?void 0:e),u,d,f=new Promise((e,t)=>(u=e,d=t)),p=e=>{let t=i<=(n.cancelId||0)&&A5(r)||i!==n.asyncId&&k5(r,!1);if(t)throw e.result=t,d(e),e},m=0,h=(e,t)=>{let a=new N5,o=new P5;return(async()=>{p(a);let s=K6.obj(e)?{...e}:{...t,to:e};if(s.parentId=i,Y6(l,(e,t)=>{K6.und(s[t])&&(s[t]=e)}),e8.skipAnimation){if(++m>1024)throw M5(n),o.result=k5(r,!1),d(o),o;return s.immediate=!0,await r.start(s)}let c=await r.start(s);return p(a),n.paused&&await new Promise(e=>{n.resumeQueue.add(e)}),c})()},g;try{let t;t=K6.arr(e)?(async e=>{for(let t of e)await h(t)})(e):Promise.resolve(e(h,r.stop.bind(r))),await Promise.all([t.then(u),f]),g=k5(r.get(),!0,!1)}catch(e){if(e instanceof N5)g=e.result;else if(e instanceof P5)g=e.result;else throw e}finally{i==n.asyncId&&(n.asyncId=a,n.asyncTo=a?s:void 0,n.promise=a?c:void 0)}return K6.fun(o)&&O6.batchedUpdates(()=>{o(g,r,r.item)}),g})()}function M5(e,t){Z6(e.timeouts,e=>e.cancel()),e.pauseQueue.clear(),e.resumeQueue.clear(),e.asyncId=e.asyncTo=e.promise=void 0,t&&(e.cancelId=t)}var N5=class extends Error{constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise.")}},P5=class extends Error{constructor(){super(`SkipAnimationSignal`)}},F5=e=>e instanceof I5,Boe=1,I5=class extends L8{constructor(...e){super(...e),this.id=Boe++,this._priority=0}get priority(){return this._priority}set priority(e){this._priority!=e&&(this._priority=e,this._onPriorityChange(e))}get(){let e=n5(this);return e&&e.getValue()}to(...e){return e8.to(this,e)}interpolate(...e){return voe(),e8.to(this,e)}toJSON(){return this.get()}observerAdded(e){e==1&&this._attach()}observerRemoved(e){e==0&&this._detach()}_attach(){}_detach(){}_onChange(e,t=!1){I8(this,{type:`change`,parent:this,value:e,idle:t})}_onPriorityChange(e){this.idle||u8.sort(this),I8(this,{type:`priority`,parent:this,priority:e})}},L5=Symbol.for(`SpringPhase`),Voe=1,Hoe=2,R5=4,z5=e=>(e[L5]&Voe)>0,B5=e=>(e[L5]&Hoe)>0,V5=e=>(e[L5]&R5)>0,H5=(e,t)=>t?e[L5]|=3:e[L5]&=-3,U5=(e,t)=>t?e[L5]|=R5:e[L5]&=-5,Uoe=class extends I5{constructor(e,t){if(super(),this.animation=new zoe,this.defaultProps={},this._state={paused:!1,delayed:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._pendingCalls=new Set,this._lastCallId=0,this._lastToId=0,this._memoizedDuration=0,!K6.und(e)||!K6.und(t)){let n=K6.obj(e)?{...e}:{...t,from:e};K6.und(n.default)&&(n.default=!0),this.start(n)}}get idle(){return!(B5(this)||this._state.asyncTo)||V5(this)}get goal(){return P8(this.animation.to)}get velocity(){let e=n5(this);return e instanceof o5?e.lastVelocity||0:e.getPayload().map(e=>e.lastVelocity||0)}get hasAnimated(){return z5(this)}get isAnimating(){return B5(this)}get isPaused(){return V5(this)}get isDelayed(){return this._state.delayed}advance(e){let t=!0,n=!1,r=this.animation,{toValues:i}=r,{config:a}=r,o=i5(r.to);!o&&N8(r.to)&&(i=X6(P8(r.to))),r.values.forEach((s,c)=>{if(s.done)return;let l=s.constructor==s5?1:o?o[c].lastPosition:i[c],u=r.immediate,d=l;if(!u){if(d=s.lastPosition,a.tension<=0){s.done=!0;return}let t=s.elapsedTime+=e,n=r.fromValues[c],i=s.v0==null?s.v0=K6.arr(a.velocity)?a.velocity[c]:a.velocity:s.v0,o,f=a.precision||(n==l?.005:Math.max(Math.max(Math.abs(l),Math.abs(n),1)*2**-52,Math.min(1,Math.abs(l-n)*.001)));if(!K6.und(a.duration)){let r=1;a.duration>0&&(this._memoizedDuration!==a.duration&&(this._memoizedDuration=a.duration,s.durationProgress>0&&(s.elapsedTime=a.duration*s.durationProgress,t=s.elapsedTime+=e)),r=(a.progress||0)+t/this._memoizedDuration,r=r>1?1:r<0?0:r,s.durationProgress=r),d=n+a.easing(r)*(l-n),o=(d-s.lastPosition)/e,u=r==1}else if(a.decay){let e=a.decay===!0?.998:a.decay,r=Math.exp(-(1-e)*t);d=n+i/(1-e)*(1-r),u=Math.abs(s.lastPosition-d)<=f,o=i*r}else{o=s.lastVelocity==null?i:s.lastVelocity;let t=a.restVelocity||f/10,r=a.clamp?0:a.bounce,c=!K6.und(r),p=n==l?s.v0>0:n<l,m,h=!1,g=Math.ceil(e/1);for(let e=0;e<g&&(m=Math.abs(o)>t,!(!m&&(u=Math.abs(l-d)<=f,u)));++e){c&&(h=d==l||d>l==p,h&&(o=-o*r,d=l));let e=(-a.tension*1e-6*(d-l)+-a.friction*.001*o)/a.mass;o+=e*1,d+=o*1}}s.lastVelocity=o,Number.isNaN(d)&&(console.warn(`Got NaN while animating:`,this),u=!0)}o&&!o[c].done&&(u=!1),u?s.done=!0:t=!1,s.setValue(d,a.round)&&(n=!0)});let s=n5(this),c=s.getValue();if(t){let e=P8(r.to);(c!==e||n)&&!a.decay?(s.setValue(e),this._onChange(e)):n&&a.decay&&this._onChange(c),this._stop()}else n&&this._onChange(c)}set(e){return O6.batchedUpdates(()=>{this._stop(),this._focus(e),this._set(e)}),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(B5(this)){let{to:e,config:t}=this.animation;O6.batchedUpdates(()=>{this._onStart(),t.decay||this._set(e,!1),this._stop()})}return this}update(e){return(this.queue||=[]).push(e),this}start(e,t){let n;return K6.und(e)?(n=this.queue||[],this.queue=[]):n=[K6.obj(e)?e:{...t,to:e}],Promise.all(n.map(e=>this._update(e))).then(e=>D5(this,e))}stop(e){let{to:t}=this.animation;return K6.und(t)||this._focus(this.get()),M5(this._state,e&&this._lastCallId),O6.batchedUpdates(()=>this._stop(t,e)),this}reset(){this._update({reset:!0})}eventObserved(e){e.type==`change`?this._start():e.type==`priority`&&(this.priority=e.priority+1)}_prepareNode(e){let t=this.key||``,{to:n,from:r}=e;n=K6.obj(n)?n[t]:n,(n==null||S5(n))&&(n=void 0),r=K6.obj(r)?r[t]:r,r??=void 0;let i={to:n,from:r};return z5(this)||(e.reverse&&([n,r]=[r,n]),r=P8(r),K6.und(r)?n5(this)||this._set(n):this._set(r)),i}_update({...e},t){let{key:n,defaultProps:r}=this;e.default&&Object.assign(r,y5(e,(e,t)=>/^on/.test(t)?_5(e,n):e)),J5(this,e,`onProps`),Y5(this,`onProps`,e,this);let i=this._prepareNode(e);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");let a=this._state;return E5(++this._lastCallId,{key:n,props:e,defaultProps:r,state:a,actions:{pause:()=>{V5(this)||(U5(this,!0),Q6(a.pauseQueue),Y5(this,`onPause`,k5(this,W5(this,this.animation.to)),this))},resume:()=>{V5(this)&&(U5(this,!1),B5(this)&&this._resume(),Q6(a.resumeQueue),Y5(this,`onResume`,k5(this,W5(this,this.animation.to)),this))},start:this._merge.bind(this,i)}}).then(n=>{if(e.loop&&n.finished&&!(t&&n.noop)){let t=G5(e);if(t)return this._update(t,!0)}return n})}_merge(e,t,n){if(t.cancel)return this.stop(!0),n(A5(this));let r=!K6.und(e.to),i=!K6.und(e.from);if(r||i)if(t.callId>this._lastToId)this._lastToId=t.callId;else return n(A5(this));let{key:a,defaultProps:o,animation:s}=this,{to:c,from:l}=s,{to:u=c,from:d=l}=e;i&&!r&&(!t.default||K6.und(u))&&(u=d),t.reverse&&([u,d]=[d,u]);let f=!q6(d,l);f&&(s.from=d),d=P8(d);let p=!q6(u,c);p&&this._focus(u);let m=S5(t.to),{config:h}=s,{decay:g,velocity:_}=h;(r||i)&&!h.decay&&(h.velocity=0),t.config&&!m&&Roe(h,h5(t.config,a),t.config===o.config?void 0:h5(o.config,a));let v=n5(this);if(!v||K6.und(u))return n(k5(this,!0));let y=K6.und(t.reset)?i&&!t.default:!K6.und(d)&&g5(t.reset,a),b=y?d:this.get(),x=x5(u),S=K6.num(x)||K6.arr(x)||X8(x),C=!m&&(!S||g5(o.immediate||t.immediate,a));if(p){let e=u5(u);if(e!==v.constructor)if(C)v=this._set(x);else throw Error(`Cannot animate between ${v.constructor.name} and ${e.name}, as the "to" prop suggests`)}let w=v.constructor,T=N8(u),E=!1;if(!T){let e=y||!z5(this)&&f;(p||e)&&(E=q6(x5(b),x),T=!E),(!q6(s.immediate,C)&&!C||!q6(h.decay,g)||!q6(h.velocity,_))&&(T=!0)}if(E&&B5(this)&&(s.changed&&!y?T=!0:T||this._stop(c)),!m&&((T||N8(c))&&(s.values=v.getPayload(),s.toValues=N8(u)?null:w==s5?[1]:X6(x)),s.immediate!=C&&(s.immediate=C,!C&&!y&&this._set(c)),T)){let{onRest:e}=s;J6(Goe,e=>J5(this,t,e));let r=k5(this,W5(this,c));Q6(this._pendingCalls,r),this._pendingCalls.add(n),s.changed&&O6.batchedUpdates(()=>{s.changed=!y,e?.(r,this),y?h5(o.onRest,r):s.onStart?.(r,this)})}y&&this._set(b),m?n(j5(t.to,t,this._state,this)):T?this._start():B5(this)&&!p?this._pendingCalls.add(n):n(O5(b))}_focus(e){let t=this.animation;e!==t.to&&(F8(this)&&this._detach(),t.to=e,F8(this)&&this._attach())}_attach(){let e=0,{to:t}=this.animation;N8(t)&&(R8(t,this),F5(t)&&(e=t.priority+1)),this.priority=e}_detach(){let{to:e}=this.animation;N8(e)&&z8(e,this)}_set(e,t=!0){let n=P8(e);if(!K6.und(n)){let e=n5(this);if(!e||!q6(n,e.getValue())){let r=u5(n);!e||e.constructor!=r?r5(this,r.create(n)):e.setValue(n),e&&O6.batchedUpdates(()=>{this._onChange(n,t)})}}return n5(this)}_onStart(){let e=this.animation;e.changed||(e.changed=!0,Y5(this,`onStart`,k5(this,W5(this,e.to)),this))}_onChange(e,t){let n=k5(e,!1);t||(this._onStart(),h5(this.animation.onChange,n,this)),h5(this.defaultProps.onChange,n,this),super._onChange(e,t)}_start(){let e=this.animation;n5(this).reset(P8(e.to)),e.immediate||(e.fromValues=e.values.map(e=>e.lastPosition)),B5(this)||(H5(this,!0),V5(this)||this._resume())}_resume(){e8.skipAnimation?this.finish():u8.start(this)}_stop(e,t){if(B5(this)){H5(this,!1);let n=this.animation;J6(n.values,e=>{e.done=!0}),n.toValues&&(n.onChange=n.onPause=n.onResume=void 0),I8(this,{type:`idle`,parent:this});let r=t?A5(this.get()):k5(this.get(),W5(this,e??n.to));Q6(this._pendingCalls,r),n.changed=!1,Y5(this,`onRest`,r,this)}}};function W5(e,t){let n=x5(t);return q6(x5(e.get()),n)}function G5(e,t=e.loop,n=e.to){let r=h5(t);if(r){let i=r!==!0&&b5(r),a=(i||e).reverse,o=!i||i.reset;return K5({...e,loop:t,default:!1,pause:void 0,to:!a||S5(n)?n:void 0,from:o?e.from:void 0,reset:o,...i})}}function K5(e){let{to:t,from:n}=e=b5(e),r=new Set;return K6.obj(t)&&q5(t,r),K6.obj(n)&&q5(n,r),e.keys=r.size?Array.from(r):null,e}function Woe(e){let t=K5(e);return K6.und(t.default)&&(t.default=y5(t)),t}function q5(e,t){Y6(e,(e,n)=>e!=null&&t.add(n))}var Goe=[`onStart`,`onRest`,`onChange`,`onPause`,`onResume`];function J5(e,t,n){e.animation[n]=t[n]===v5(t,n)?void 0:_5(t[n],e.key)}function Y5(e,t,...n){e.animation[t]?.(...n),e.defaultProps[t]?.(...n)}var Koe=[`onStart`,`onChange`,`onRest`],qoe=1,Joe=class{constructor(e,t){this.id=qoe++,this.springs={},this.queue=[],this._lastAsyncId=0,this._lastLoopId=0,this._active=new Set,this._changed=new Set,this._started=!1,this._state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._events={onStart:new Map,onChange:new Map,onRest:new Map},this._onFrame=this._onFrame.bind(this),t&&(this._flush=t),e&&this.start({default:!0,...e})}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every(e=>e.idle&&!e.isDelayed&&!e.isPaused)}get item(){return this._item}set item(e){this._item=e}get(){let e={};return this.each((t,n)=>e[n]=t.get()),e}set(e){for(let t in e){let n=e[t];K6.und(n)||this.springs[t].set(n)}}update(e){return e&&this.queue.push(K5(e)),this}start(e){let{queue:t}=this;return e?t=X6(e).map(K5):this.queue=[],this._flush?this._flush(this,t):(n7(this,t),X5(this,t))}stop(e,t){if(e!==!!e&&(t=e),t){let n=this.springs;J6(X6(t),t=>n[t].stop(!!e))}else M5(this._state,this._lastAsyncId),this.each(t=>t.stop(!!e));return this}pause(e){if(K6.und(e))this.start({pause:!0});else{let t=this.springs;J6(X6(e),e=>t[e].pause())}return this}resume(e){if(K6.und(e))this.start({pause:!1});else{let t=this.springs;J6(X6(e),e=>t[e].resume())}return this}each(e){Y6(this.springs,e)}onLoopReset(e){let t=this._onLoopReset??=new Set;return t.add(e),()=>{t.delete(e)}}_onFrame(){let{onStart:e,onChange:t,onRest:n}=this._events,r=this._active.size>0,i=this._changed.size>0;(r&&!this._started||i&&!this._started)&&(this._started=!0,Z6(e,([e,t])=>{t.value=this.get(),e(t,this,this._item)}));let a=!r&&this._started,o=i||a&&n.size?this.get():null;i&&t.size&&Z6(t,([e,t])=>{t.value=o,e(t,this,this._item)}),a&&(this._started=!1,Z6(n,([e,t])=>{t.value=o,e(t,this,this._item)}))}eventObserved(e){if(e.type==`change`)this._changed.add(e.parent),e.idle||this._active.add(e.parent);else if(e.type==`idle`)this._active.delete(e.parent);else return;O6.onFrame(this._onFrame)}};function X5(e,t){return Promise.all(t.map(t=>Z5(e,t))).then(t=>D5(e,t))}async function Z5(e,t,n){let{keys:r,to:i,from:a,loop:o,onRest:s,onResolve:c}=t,l=K6.obj(t.default)&&t.default;o&&(t.loop=!1);let u=t,d=!n&&!u.parentId&&`loop`in t?++e._lastLoopId:n?u.loopId:e._lastLoopId;i===!1&&(t.to=null),a===!1&&(t.from=null);let f=K6.arr(i)||K6.fun(i)?i:void 0;f?(t.to=void 0,t.onRest=void 0,l&&(l.onRest=void 0)):J6(Koe,n=>{let r=t[n];if(K6.fun(r)){let i=e._events[n];t[n]=(({finished:e,cancelled:t})=>{let n=i.get(r);n?(e||(n.finished=!1),t&&(n.cancelled=!0)):i.set(r,{value:null,finished:e||!1,cancelled:t||!1})}),l&&(l[n]=t[n])}});let p=e._state;t.pause===!p.paused?(p.paused=t.pause,Q6(t.pause?p.pauseQueue:p.resumeQueue)):p.paused&&(t.pause=!0);let m=(r||Object.keys(e.springs)).map(n=>e.springs[n].start(t)),h=t.cancel===!0||v5(t,`cancel`)===!0;(f||h&&p.asyncId)&&m.push(E5(++e._lastAsyncId,{props:t,state:p,actions:{pause:G6,resume:G6,start(t,n){h?(M5(p,e._lastAsyncId),n(A5(e))):(t.onRest=s,n(j5(f,t,p,e)))}}})),p.paused&&await new Promise(e=>{p.resumeQueue.add(e)});let g=D5(e,await Promise.all(m));if(o&&g.finished&&!(n&&g.noop)&&d===e._lastLoopId){let n=G5(t,o,i);if(n)return n.loopId=d,e._onLoopReset?.forEach(e=>e()),n7(e,[n]),Z5(e,n,!0)}return c&&O6.batchedUpdates(()=>c(g,e,e.item)),g}function Q5(e,t){let n={...e.springs};return t&&J6(X6(t),e=>{K6.und(e.keys)&&(e=K5(e)),K6.obj(e.to)||(e={...e,to:void 0}),t7(n,e,e=>e7(e))}),$5(e,n),n}function $5(e,t){Y6(t,(t,n)=>{e.springs[n]||(e.springs[n]=t,R8(t,e))})}function e7(e,t){let n=new Uoe;return n.key=e,t&&R8(n,t),n}function t7(e,t,n){t.keys&&J6(t.keys,r=>{(e[r]||(e[r]=n(r)))._prepareNode(t)})}function n7(e,t){J6(t,t=>{t7(e.springs,t,t=>e7(t,e))})}var Yoe=L.createContext({pause:!1,immediate:!1}),Xoe=()=>{let e=[],t=function(t){boe();let r=[];return J6(e,(e,i)=>{if(K6.und(t))r.push(e.start());else{let a=n(t,e,i);a&&r.push(e.start(a))}}),r};t.current=e,t.add=function(t){e.includes(t)||e.push(t)},t.delete=function(t){let n=e.indexOf(t);~n&&e.splice(n,1)},t.pause=function(){return J6(e,e=>e.pause(...arguments)),this},t.resume=function(){return J6(e,e=>e.resume(...arguments)),this},t.set=function(t){J6(e,(e,n)=>{let r=K6.fun(t)?t(n,e):t;r&&e.set(r)})},t.start=function(t){let n=[];return J6(e,(e,r)=>{if(K6.und(t))n.push(e.start());else{let i=this._getProps(t,e,r);i&&n.push(e.start(i))}}),n},t.stop=function(){return J6(e,e=>e.stop(...arguments)),this},t.update=function(t){return J6(e,(e,n)=>e.update(this._getProps(t,e,n))),this};let n=function(e,t,n){return K6.fun(e)?e(n,t):e};return t._getProps=n,t};function r7(e,t,n){let r=K6.fun(t)&&t;r&&!n&&(n=[]);let i=(0,L.useMemo)(()=>r||arguments.length==3?Xoe():void 0,[]),a=(0,L.useRef)(0),o=Q8(),s=(0,L.useMemo)(()=>({ctrls:[],queue:[],flush(e,t){let n=Q5(e,t);return a.current>0&&!s.queue.length&&!Object.keys(n).some(t=>!e.springs[t])?X5(e,t):new Promise(r=>{$5(e,n),s.queue.push(()=>{r(X5(e,t))}),o()})}}),[]),c=(0,L.useRef)([...s.ctrls]),l=(0,L.useRef)([]),u=(0,L.useRef)([]);u.current=[];let d=e5(e)||0;(0,L.useMemo)(()=>{J6(c.current.slice(e,d),e=>{Foe(e,i),e.stop(!0)}),c.current.length=e,f(d,e)},[e]),(0,L.useMemo)(()=>{f(0,Math.min(d,e))},n);function f(e,n){for(let i=e;i<n;i++){let e=c.current[i]||(c.current[i]=new Joe(null,s.flush)),n=r?r(i,e):t[i];n&&(l.current[i]=Woe(n))}}let p=c.current.map((e,t)=>Q5(e,l.current[t])),m=(0,L.useContext)(Yoe),h=m!==e5(m)&&Poe(m);Z8(()=>{a.current++,s.ctrls=c.current;let{queue:e}=s;e.length&&(s.queue=[],J6(e,e=>e()));let t=l.current.length>0?l.current:u.current;J6(c.current,(e,n)=>{i?.add(e),h&&e.start({default:m});let r=t[n];r&&(Ioe(e,r.ref),e.ref?e.queue.push({...r,default:K6.obj(r.default)?{...r.default}:r.default}):e.start(r))}),l.current.length>0&&(u.current=l.current),l.current=[]}),$8(()=>()=>{J6(s.ctrls,e=>e.stop(!0))});let g=p.map(e=>({...e}));return i?[g,i]:g}function i7(e,t){let n=K6.fun(e),[[r],i]=r7(1,n?e:[e],n?t||[]:t);return n||arguments.length==2?[r,i]:r}var Zoe=class extends I5{constructor(e,t){super(),this.source=e,this.idle=!0,this._active=new Set,this.calc=w8(...t);let n=this._get(),r=u5(n);r5(this,r.create(n))}advance(e){let t=this._get();q6(t,this.get())||(n5(this).setValue(t),this._onChange(t,this.idle)),!this.idle&&a7(this._active)&&o7(this)}_get(){let e=K6.arr(this.source)?this.source.map(P8):X6(P8(this.source));return this.calc(...e)}_start(){this.idle&&!a7(this._active)&&(this.idle=!1,J6(i5(this),e=>{e.done=!1}),e8.skipAnimation?(O6.batchedUpdates(()=>this.advance()),o7(this)):u8.start(this))}_attach(){let e=1;J6(X6(this.source),t=>{N8(t)&&R8(t,this),F5(t)&&(t.idle||this._active.add(t),e=Math.max(e,t.priority+1))}),this.priority=e,this._start()}_detach(){J6(X6(this.source),e=>{N8(e)&&z8(e,this)}),this._active.clear(),o7(this)}eventObserved(e){e.type==`change`?e.idle?this.advance():(this._active.add(e.parent),this._start()):e.type==`idle`?this._active.delete(e.parent):e.type==`priority`&&(this.priority=X6(this.source).reduce((e,t)=>Math.max(e,(F5(t)?t.priority:0)+1),0))}};function Qoe(e){return e.idle!==!1}function a7(e){return!e.size||Array.from(e).every(Qoe)}function o7(e){e.idle||(e.idle=!0,J6(i5(e),e=>{e.done=!0}),I8(e,{type:`idle`,parent:e}))}e8.assign({createStringInterpolator:q8,to:(e,t)=>new Zoe(e,t)}),u8.advance;var s7=/^--/;function $oe(e,t){return t==null||typeof t==`boolean`||t===``?``:typeof t==`number`&&t!==0&&!s7.test(e)&&!(l7.hasOwnProperty(e)&&l7[e])?t+`px`:(``+t).trim()}var c7={};function ese(e,t){if(!e.nodeType||!e.setAttribute||!e.removeAttribute)return!1;let n=e.nodeName===`filter`||e.parentNode&&e.parentNode.nodeName===`filter`,{className:r,style:i,children:a,scrollTop:o,scrollLeft:s,viewBox:c,...l}=t,u=Object.values(l),d=Object.keys(l).map(t=>n||e.hasAttribute(t)?t:c7[t]||(c7[t]=t.replace(/([A-Z])/g,e=>`-`+e.toLowerCase())));t.hasOwnProperty(`children`)&&(e.textContent=a);for(let t in i)if(i.hasOwnProperty(t)){let n=$oe(t,i[t]);s7.test(t)?e.style.setProperty(t,n):e.style[t]=n}d.forEach((t,n)=>{let r=u[n];r===void 0?e.removeAttribute(t):e.setAttribute(t,r)}),t.hasOwnProperty(`className`)&&(r===void 0?e.removeAttribute(`class`):e.className=r),o!==void 0&&(e.scrollTop=o),s!==void 0&&(e.scrollLeft=s),t.hasOwnProperty(`viewBox`)&&(c===void 0?e.removeAttribute(`viewBox`):e.setAttribute(`viewBox`,c))}var l7={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},tse=(e,t)=>e+t.charAt(0).toUpperCase()+t.substring(1),nse=[`Webkit`,`Ms`,`Moz`,`O`];l7=Object.keys(l7).reduce((e,t)=>(nse.forEach(n=>e[tse(n,t)]=e[t]),e),l7);var rse=/^(matrix3d|matrix|translate3d|translate[XYZ]?|scale3d|scale[XYZ]?|rotate3d|rotate[XYZ]?|skew[XY]?)$/,ise=/^(translate)/,ase=/^(rotate|skew)/,u7=(e,t)=>K6.num(e)&&e!==0?e+t:e,d7=(e,t)=>K6.arr(e)?e.every(e=>d7(e,t)):K6.num(e)?e===t:parseFloat(e)===t,ose=class extends l5{constructor({x:e,y:t,z:n,...r}){let i=[],a=[];(e||t||n)&&(i.push([e||0,t||0,n||0]),a.push(e=>[`translate3d(${e.map(e=>u7(e,`px`)).join(`,`)})`,d7(e,0)])),Y6(r,(e,t)=>{if(t===`transform`)i.push([e||``]),a.push(e=>[e,e===``]);else if(rse.test(t)){if(delete r[t],K6.und(e))return;let n=ise.test(t)?`px`:ase.test(t)?`deg`:``;i.push(X6(e)),a.push(t===`rotate3d`?([e,t,r,i])=>[`rotate3d(${e},${t},${r},${u7(i,n)})`,d7(i,0)]:e=>[`${t}(${e.map(e=>u7(e,n)).join(`,`)})`,d7(e,+!!t.startsWith(`scale`))])}}),i.length&&(r.transform=new sse(i,a)),super(r)}},sse=class extends L8{constructor(e,t){super(),this.inputs=e,this.transforms=t,this._value=null}get(){return this._value||=this._get()}_get(){let e=``,t=!0;return J6(this.inputs,(n,r)=>{let i=P8(n[0]),[a,o]=this.transforms[r](K6.arr(i)?i:n.map(P8));e+=` `+a,t&&=o}),t?`none`:e}observerAdded(e){e==1&&J6(this.inputs,e=>J6(e,e=>N8(e)&&R8(e,this)))}observerRemoved(e){e==0&&J6(this.inputs,e=>J6(e,e=>N8(e)&&z8(e,this)))}eventObserved(e){e.type==`change`&&(this._value=null),I8(this,e)}},cse=`a.abbr.address.area.article.aside.audio.b.base.bdi.bdo.big.blockquote.body.br.button.canvas.caption.cite.code.col.colgroup.data.datalist.dd.del.details.dfn.dialog.div.dl.dt.em.embed.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.iframe.img.input.ins.kbd.keygen.label.legend.li.link.main.map.mark.menu.menuitem.meta.meter.nav.noscript.object.ol.optgroup.option.output.p.param.picture.pre.progress.q.rp.rt.ruby.s.samp.script.section.select.small.source.span.strong.style.sub.summary.sup.table.tbody.td.textarea.tfoot.th.thead.time.title.tr.track.u.ul.var.video.wbr.circle.clipPath.defs.ellipse.foreignObject.g.image.line.linearGradient.mask.path.pattern.polygon.polyline.radialGradient.rect.stop.svg.text.tspan`.split(`.`);e8.assign({batchedUpdates:$g.unstable_batchedUpdates,createStringInterpolator:q8,colors:Zae});var f7=koe(cse,{applyAnimatedValues:ese,createAnimatedStyle:e=>new ose(e),getComponentProps:({scrollTop:e,scrollLeft:t,...n})=>n}).animated;function lse({points:e,stats:t,partCntPerPoint:n}){return{series:(0,L.useMemo)(()=>Q.of(e).toSortedArray(([e])=>e).map(([t,n],r)=>({name:t,color:v6(r,e.size),points:n??[]})),[e]),median:(0,L.useMemo)(()=>t?{low:(n??1)*(t.medianMinutesForSingleMat-t.MAD_belowMinutes),high:(n??1)*(t.medianMinutesForSingleMat+t.MAD_aboveMinutes)}:null,[t,n])}}var p7=50,use=30,m7=10,dse=2;function fse({points:e,yZoom:t,default_date_range:n,current_date_zoom:r,containerWidth:i,containerHeight:a}){let o=i===0?400:i,s=a===0?400:a,c=o-p7-dse,l=s-m7-use,u=(0,L.useMemo)(()=>r?rF().domain([r.start,r.end]).range([0,c]):rF().domain([n[0],n[1]]).range([0,c]),[r,n,c]),d=(0,L.useMemo)(()=>{if(e.size===0)return 60;let t=Q.of(e).flatMap(([,e])=>e.map(e=>e.y)).maxBy(e=>e)??1;return Math.ceil(t/5)*5},[e]);return{height:s,width:o,xScale:u,yScale:(0,L.useMemo)(()=>t?VM().domain([t.y_low,t.y_high]).range([l,0]):VM().domain([0,d]).range([l,0]),[l,t,d])}}var pse=(0,L.memo)(function({xScale:e,yScale:t}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(DA,{scale:e,top:t.range()[0]}),(0,H.jsx)(OA,{scale:t,left:e.range()[0],label:`Minutes`}),(0,H.jsx)(wA,{width:e.range()[1]-e.range()[0],height:t.range()[0]-t.range()[1],xScale:e,yScale:t})]})}),h7=(0,L.memo)(function(e){let[t,n]=(0,L.useState)(),[r,i]=(0,L.useState)(),[a,o]=(0,L.useState)(!1);function s(){o(!1),n(void 0),i(void 0)}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Um,{size:`small`,onClick:()=>o(!0),children:(0,H.jsx)(OT,{fontSize:`inherit`})}),(0,H.jsxs)(cy,{open:a,onClose:s,children:[(0,H.jsxs)(uy,{children:[(0,H.jsx)(`div`,{style:{marginBottom:`1em`},children:(0,H.jsx)(Kw,{type:`number`,label:`Y Low`,value:t===void 0?e.yZoom?.y_low??``:isNaN(t)?``:t,onChange:e=>n(parseFloat(e.target.value)),onBlur:()=>{t&&e.setZoom(e=>e?{...e,y_low:t}:{y_low:t,y_high:60})}})}),(0,H.jsx)(`div`,{style:{marginBottom:`1em`},children:(0,H.jsx)(Kw,{type:`number`,label:`Y High`,value:r===void 0?e.yZoom?.y_high??``:isNaN(r)?``:r,onChange:e=>i(parseFloat(e.target.value)),onBlur:()=>{r&&e.setZoom(e=>e?{...e,y_high:r}:{y_low:0,y_high:r})}})})]}),(0,H.jsx)(ly,{children:(0,H.jsx)(Y,{onClick:s,children:`Close`})})]})]})}),mse=(0,L.memo)(function({median:e,plannedMinutes:t,xScale:n,yScale:r}){let i=i7({to:{x:n.range()[0],y:e?r(e.high):r.range()[0],width:n.range()[1]-n.range()[0],height:e?r(e.low)-r(e.high):0},from:{x:n.range()[0],y:r.range()[0],width:n.range()[1]-n.range()[0],height:0}}),a=i7({to:{y:t?r(t):r.range()[0]},from:{y:r.range()[0]}});return(0,H.jsxs)(`g`,{children:[e?(0,H.jsx)(f7.rect,{x:i.x,y:i.y,width:i.width,height:i.height,fill:Lr[700],opacity:.2,pointerEvents:`none`}):void 0,t?(0,H.jsx)(f7.line,{stroke:`black`,x1:n.range()[0],x2:n.range()[1],y1:a.y,y2:a.y}):void 0]})}),hse=(0,L.memo)(function({seriesName:e,points:t,color:n,xScale:r,yScale:i,showTooltip:a}){let o=(0,L.useCallback)(n=>{let r=rA(n);if(r===null)return;let i=n.currentTarget.dataset.idx;i!==void 0&&a({left:r.x,top:r.y,pt:t[parseInt(i)],seriesName:e})},[a,t,e]);return(0,H.jsx)(`g`,{children:r7(t.length,t.map(e=>({from:{x:r(e.x),y:i.range()[0]+15},to:{x:r(e.x),y:i(e.y)}}))).map((e,t)=>(0,H.jsx)(f7.circle,{className:`bms-cycle-chart-pt`,fill:n,r:5,cx:e.x,cy:e.y,"data-idx":t,onClick:o},t))})}),gse=(0,L.memo)(function({series:e,xScale:t,yScale:n,showTooltip:r,disabledSeries:i}){return(0,H.jsx)(`g`,{children:e.filter(e=>!i.has(e.name)).map(e=>(0,H.jsx)(hse,{points:e.points,seriesName:e.name,color:e.color,xScale:t,yScale:n,showTooltip:r},e.name))})}),_se=(0,L.memo)(function({series:e,disabledSeries:t,adjustDisabled:n}){return(0,H.jsx)(`div`,{style:{marginTop:`1em`,display:`flex`,flexWrap:`wrap`,justifyContent:`space-around`},children:e.map(e=>(0,H.jsx)(qw,{selected:!t.has(e.name),value:e,onChange:()=>n(t=>t.has(e.name)?t.delete(e.name):t.add(e.name)),children:(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(`div`,{style:{width:`14px`,height:`14px`,backgroundColor:e.color}}),(0,H.jsx)(`div`,{style:{marginLeft:`1em`},children:e.name})]})},e.name))})}),vse=G(`g`,{shouldForwardProp:e=>e.toString()[0]!==`$`})(({$noPtrEvents:e})=>e?{"& .bms-cycle-chart-pt":{pointerevents:`none`}}:void 0),yse=(0,L.memo)(function({setYZoom:e,setXZoom:t,setTooltip:n,xScale:r,yScale:i,highlightStart:a,setHighlightStart:o}){let[s,c]=(0,L.useState)(null),l=(0,L.useCallback)(e=>{let t=rA(e);t!==null&&(c(null),o({x:t.x-p7,y:t.y-m7,nowMS:Date.now()}),n(null))},[o,n]),u=(0,L.useCallback)(e=>{let t=rA(e);t!==null&&c({x:t.x-p7,y:t.y-m7})},[c]),d=(0,L.useCallback)(n=>{if(a!==null){if(Date.now()-a.nowMS>500){let o=rA(n);if(o!==null){let n=r.invert(a.x),s=r.invert(o.x-p7),c=i.invert(a.y),l=i.invert(o.y-m7);e(c<l?{y_low:c,y_high:l}:{y_low:l,y_high:c}),t?.({zoom:n.getTime()<s.getTime()?{start:n,end:s}:{start:s,end:n}})}}o(null),c(null)}},[a,o,c,t,e,r,i]);return(0,H.jsxs)(`g`,{children:[(0,H.jsx)(`rect`,{x:0,y:0,width:r.range()[1],height:i.range()[0],fill:`transparent`,onPointerDown:l,onPointerMove:a===null?void 0:u,onPointerUp:a===null?void 0:d}),a!==null&&s!==null?(0,H.jsx)(`rect`,{x:Math.min(a.x,s.x),y:Math.min(a.y,s.y),width:Math.abs(a.x-s.x),height:Math.abs(a.y-s.y),color:`red`,pointerEvents:`none`,opacity:.3}):void 0]})}),bse=(0,L.memo)(function({set_date_zoom_range:e,current_date_zoom:t,yZoom:n,setYZoom:r,median:i}){return(0,H.jsxs)(`div`,{children:[e&&(t||n)?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Y,{size:`small`,onClick:()=>{e?.({zoom:void 0}),r(null)},children:`Reset Zoom`}),(0,H.jsx)(h7,{yZoom:n,setZoom:r})]}):void 0,e&&!t&&!n?(0,H.jsxs)(`span`,{style:{color:`#6b6b76`},children:[`Zoom via mouse drag`,i?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{children:` or `}),(0,H.jsx)(Y,{size:`small`,onClick:()=>{let e=i.high,t=i.low,n=.2*(e-t);r({y_low:t-n,y_high:e+n})},children:`Zoom To Inliers`})]}):void 0,(0,H.jsx)(h7,{yZoom:n,setZoom:r})]}):void 0]})}),xse=(0,L.memo)(function({tooltip:e,extraTooltip:t,seriesLabel:n}){return e===null?null:(0,H.jsxs)(RC,{direction:`column`,spacing:.6,children:[(0,H.jsxs)(`div`,{children:[`Time:`,` `,e.pt.x.toLocaleString(void 0,{month:`short`,day:`numeric`,year:`numeric`,hour:`numeric`,minute:`2-digit`})]}),(0,H.jsxs)(`div`,{children:[n,`: `,e.seriesName]}),(0,H.jsxs)(`div`,{children:[`Cycle Time: `,e.pt.y.toFixed(1),` minutes`]}),t?t(e.pt).map((e,t)=>(0,H.jsxs)(`div`,{children:[e.title,`:`,` `,e.link?(0,H.jsx)(`a`,{style:{color:`white`,pointerEvents:`auto`,cursor:`pointer`,borderBottom:`1px solid`},onClick:e.link,children:e.value}):(0,H.jsx)(`span`,{children:`e.value`})]},t)):void 0]})});function Sse(e){let{width:t,height:n,xScale:r,yScale:i}=fse({points:e.points,yZoom:e.yZoom,setYZoom:e.setYZoom,default_date_range:e.default_date_range,current_date_zoom:e.current_date_zoom,set_date_zoom_range:e.set_date_zoom_range,containerWidth:e.containerWidth,containerHeight:e.containerHeight});return(0,H.jsx)(`svg`,{width:t,height:n,children:(0,H.jsxs)(`g`,{transform:`translate(${p7}, ${m7})`,children:[(0,H.jsx)(pse,{xScale:r,yScale:i}),(0,H.jsx)(mse,{median:e.median,plannedMinutes:e.plannedTimeMinutes,xScale:r,yScale:i}),(0,H.jsx)(yse,{setYZoom:e.setYZoom,setXZoom:e.set_date_zoom_range,xScale:r,setTooltip:e.showTooltip,yScale:i,highlightStart:e.highlightStart,setHighlightStart:e.setHighlightStart}),(0,H.jsx)(vse,{$noPtrEvents:e.highlightStart!==null,children:(0,H.jsx)(gse,{series:e.series,disabledSeries:e.disabledSeries,xScale:r,yScale:i,showTooltip:e.showTooltip})})]})})}var g7=(0,L.memo)(function(e){let t=(0,L.useMemo)(()=>P(null),[]),n=z(t),[r,i]=(0,L.useState)(YD.empty()),[a,o]=(0,L.useState)(null),{series:s,median:c}=lse({points:e.points,stats:e.stats,partCntPerPoint:e.partCntPerPoint});return(0,H.jsxs)(`div`,{onPointerLeave:(0,L.useCallback)(()=>{n(null),o(null)},[n,o]),children:[(0,H.jsx)(gA,{sx:{height:{xs:`calc(100vh - 320px)`,md:`calc(100vh - 280px)`,xl:`calc(100vh - 220px)`}},tooltipAtom:t,TooltipContent:({tooltip:t})=>(0,H.jsx)(xse,{tooltip:t,seriesLabel:e.series_label,extraTooltip:e.extra_tooltip}),chart:({width:t,height:i})=>(0,H.jsx)(Sse,{...e,containerHeight:i,containerWidth:t,series:s,median:c,yZoom:e.yZoom,setYZoom:e.setYZoom,highlightStart:a,setHighlightStart:o,showTooltip:n,disabledSeries:r})}),(0,H.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`},children:[(0,H.jsx)(`div`,{style:{color:`#6b6b76`},children:`Click on a point for details`}),(0,H.jsx)(`div`,{style:{flexGrow:1}}),(0,H.jsx)(bse,{set_date_zoom_range:e.set_date_zoom_range,current_date_zoom:e.current_date_zoom,yZoom:e.yZoom,setYZoom:e.setYZoom,median:c})]}),(0,H.jsx)(_se,{series:s,disabledSeries:r,adjustDisabled:i})]})});function Cse(e){return`operations`in e&&(e.operations===void 0||Array.isArray(e.operations))}var wse=P(!0),Tse=P(!0),Ese=P(void 0),Dse=P(void 0),Ose=P(void 0),kse=P(`Any`),Ase=P(void 0),jse=P(void 0),Mse=P({}),Nse=P({}),Pse=P(null),Fse=P(null);function _7({ty:e}){JI(e===`labor`?`L/U Cycles`:`Machine Cycles`);let t=z(SI),n=(0,L.useCallback)(function(e){if(!Cse(e))return[];let n=[];if(e.operations)for(let r of e.operations)n.push({title:(r.mat.serial?r.mat.serial:`Material`)+` `+r.operation,value:`Open Card`,link:()=>t({type:`LogMat`,logMat:r.mat})});else if(`material`in e&&Array.isArray(e.material))for(let r of e.material)n.push({title:r.serial?r.serial:`Material`,value:`Open Card`,link:()=>t({type:`LogMat`,logMat:r})});return n},[t]),[r,i]=B(e===`labor`?wse:Tse),[a,o]=B(e===`labor`?Mse:Nse),[s,c]=B(e===`labor`?Ese:Dse),[l,u]=B(Ose),[d,f]=B(kse),[p,m]=B(e===`labor`?Ase:jse),[h,g]=B(e===`labor`?Pse:Fse),_=R(br),v=ok(_.basketName),y=R(dk),b=jk(d,e!==`labor`||y),x=R(UO),S=[LT(cE(),-4),LT(cE(),1)],C=R(uk),w=R(fL),T=(0,L.useMemo)(()=>{let t=cE();return l?Ik(C.valuesToLazySeq(),{zoom:{start:LT(t,-4),end:LT(t,1)},partAndProc:s,pallet:p,operation:l,carrierKind:b}):e===`labor`&&r?Lk(C.valuesToLazySeq(),{zoom:{start:LT(t,-4),end:LT(t,1)},partAndProc:s,pallet:p,carrierKind:b}):Ik(C.valuesToLazySeq(),{zoom:{start:LT(t,-4),end:LT(t,1)},partAndProc:s,pallet:p,station:e===`labor`?Pk:Nk,carrierKind:b})},[C,e,s,p,l,r,b]),E=s?l??(T.allMachineOperations.length===1?T.allMachineOperations[0]:void 0):void 0,D=(0,L.useMemo)(()=>{if(E&&e===`machine`)return Rk(T,!1)},[T,e,E]);return(0,H.jsxs)(J,{sx:{paddingLeft:`24px`,paddingRight:`24px`,paddingTop:`10px`},children:[(0,H.jsxs)(J,{component:`nav`,sx:{display:`flex`,minHeight:`2.5em`,alignItems:`center`,maxWidth:`calc(100vw - 24px - 24px)`},children:[(0,H.jsxs)(q,{variant:`subtitle1`,children:[`Recent `,e===`labor`?`Load/Unload Occupancy`:`Machine Cycles`]}),(0,H.jsx)(J,{sx:{flexGrow:1}}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{name:`Station-Cycles-chart-or-table-select`,autoWidth:!0,value:r?`graph`:`table`,onChange:e=>i(e.target.value===`graph`),children:[(0,H.jsx)(Hx,{value:`graph`,children:`Graph`},`graph`),(0,H.jsx)(Hx,{value:`table`,children:`Table`},`table`)]})}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,displayEmpty:!0,value:s?T.allPartAndProcNames.findIndex(e=>s.part===e.part&&s.proc===e.proc):-1,style:{marginLeft:`1em`},onChange:e=>{c(e.target.value===-1?void 0:T.allPartAndProcNames[e.target.value]),u(void 0)},children:[(0,H.jsx)(Hx,{value:-1,children:(0,H.jsx)(`em`,{children:`Any Part`})},0),T.allPartAndProcNames.map((e,t)=>(0,H.jsx)(Hx,{value:t,children:(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(XU,{part:e.part,size:20}),(0,H.jsxs)(`span`,{style:{marginRight:`1em`},children:[e.part,`-`,e.proc]})]})},t))]})}),e===`machine`?(0,H.jsx)(_y,{size:`small`,children:(0,H.jsx)(YS,{name:`Station-Cycles-cycle-chart-station-select`,autoWidth:!0,displayEmpty:!0,value:E?T.allMachineOperations.findIndex(e=>E.compare(e)===0):-1,style:{marginLeft:`1em`},onChange:e=>u(T.allMachineOperations[e.target.value]),children:[...T.allMachineOperations.length===1?[]:[(0,H.jsx)(Hx,{value:-1,children:(0,H.jsx)(`em`,{children:`Any Operation`})},-1)],...T.allMachineOperations.map((e,t)=>(0,H.jsxs)(Hx,{value:t,children:[e.statGroup,` `,e.operation]},t))]})}):void 0,e===`labor`&&y?(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,displayEmpty:!0,value:b,style:{marginLeft:`1em`},onChange:e=>{let t=e.target.value;f(t),t===`Basket`&&m(void 0)},children:[(0,H.jsx)(Hx,{value:`Any`,children:(0,H.jsx)(`em`,{children:`Any Carrier`})}),(0,H.jsx)(Hx,{value:`Pallet`,children:`Pallet`}),(0,H.jsx)(Hx,{value:`Basket`,children:v})]})}):void 0,e!==`labor`||b!==`Basket`?(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{name:`Station-Cycles-cycle-chart-station-pallet`,autoWidth:!0,displayEmpty:!0,value:p||``,style:{marginLeft:`1em`},onChange:e=>m(e.target.value===``?void 0:e.target.value),children:[(0,H.jsx)(Hx,{value:``,children:(0,H.jsx)(`em`,{children:`Any Pallet`})},0),T.allPalletNames.map(e=>(0,H.jsx)(Hx,{value:e,children:(0,H.jsx)(`div`,{style:{display:`flex`,alignItems:`center`},children:(0,H.jsx)(`span`,{style:{marginRight:`1em`},children:e})})},e))]})}):void 0,(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{onClick:()=>Hk(T,w.matsById,void 0,e===`labor`,_.loadStationNames,v),style:{height:`25px`,paddingTop:0,paddingBottom:0},size:`large`,children:(0,H.jsx)(uT,{})})})]}),(0,H.jsx)(`main`,{children:r?(0,H.jsx)(g7,{points:T.data,series_label:T.seriesLabel,default_date_range:S,extra_tooltip:n,current_date_zoom:a.zoom,set_date_zoom_range:o,yZoom:h,setYZoom:g,stats:E&&e===`machine`?x.get(E):void 0,partCntPerPoint:E?Q.of(T.data).head()?.[1]?.[0]?.material?.length:void 0,plannedTimeMinutes:D}):(0,H.jsx)(o6,{points:T.data,matsById:w.matsById,period:{type:`Last30`},current_date_zoom:void 0,set_date_zoom_range:void 0,showWorkorderAndInspect:!0,hideMedian:e===`labor`})})]})}var Ise=Q.ofRange(0,12,1).map(e=>new Date(2019,e,1)).chunk(3).toRArray(),Lse=(0,L.memo)(function(e){let[t,n]=(0,L.useState)(!1),[r,i]=(0,L.useState)(void 0);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ky,{type:`text`,value:(r||e.curMonth).toLocaleDateString(void 0,{month:`long`,year:`numeric`}),readOnly:!0,endAdornment:(0,H.jsx)(Iy,{position:`end`,children:(0,H.jsx)(Um,{"aria-label":`Open month select`,"data-testid":`open-month-select`,onClick:()=>{i(oE(e.curMonth)),n(!0)},size:`large`,children:(0,H.jsx)(lre,{})})})}),(0,H.jsx)(cy,{open:t,onClose:()=>{n(!1),i(void 0)},children:(0,H.jsxs)(uy,{children:[(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(Um,{"data-testid":`select-month-dialog-previous-year`,onClick:()=>i(XT(r||e.curMonth,-1)),size:`large`,children:(0,H.jsx)(fT,{})}),(0,H.jsx)(`div`,{style:{flexGrow:1},children:(0,H.jsx)(q,{variant:`h5`,align:`center`,"data-testid":`select-month-dialog-current-year`,children:(r||e.curMonth).toLocaleDateString(void 0,{year:`numeric`})})}),(0,H.jsx)(Um,{onClick:()=>i(XT(r||e.curMonth,1)),size:`large`,children:(0,H.jsx)(pT,{})})]}),(0,H.jsx)(`div`,{"data-testid":`select-month-dialog-choose-month`,children:Ise.map((t,a)=>(0,H.jsx)(`div`,{style:a>0?{marginTop:`1.2em`}:void 0,children:t.map((t,a)=>(0,H.jsx)(Y,{color:`primary`,style:a>0?{marginLeft:`1.2em`}:void 0,onClick:()=>{e.onSelectMonth(new Date((r||e.curMonth).getFullYear(),t.getMonth(),1)),i(void 0),n(!1)},children:t.toLocaleDateString(void 0,{month:`short`})},a))},a))})]})})]})}),v7=(0,L.memo)(function(){let e=R(KR),[t,n]=B(GR),r=ez(),i=$R();return(0,H.jsxs)(RC,{component:`nav`,direction:`row`,spacing:3,sx:{paddingLeft:`24px`,paddingRight:`24px`,alignItems:`center`},children:[(0,H.jsx)(vy,{control:(0,H.jsx)(_S,{checked:e.type===`Last30`,color:`secondary`,onChange:(e,t)=>t?i():null}),label:`Last 30 days`}),(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(vy,{control:(0,H.jsx)(_S,{checked:e.type===`SpecificMonth`,color:`secondary`,onChange:(e,r)=>r?n(t):null}),label:`Select Month`}),(0,H.jsx)(Lse,{curMonth:t,onSelectMonth:t=>{e.type===`SpecificMonth`?n(t):r(t)}})]})]})});function y7(e){return function(){return e}}var b7=Math.PI;b7/2,2*b7;var x7=Math.PI,S7=2*x7,C7=1e-6,Rse=S7-C7;function w7(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function zse(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return w7;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}var T7=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._=``,this._append=e==null?w7:zse(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e=+e,t=+t,n=+n,r=+r,i=+i,i<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(this._x1===null)this._append`M${this._x1=e},${this._y1=t}`;else if(d>C7)if(!(Math.abs(u*s-c*l)>C7)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((x7-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>C7&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>C7||Math.abs(this._y1-l)>C7)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%S7+S7),d>Rse?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>C7&&this._append`A${n},${n},0,${+(d>=x7)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};function Bse(){return new T7}Bse.prototype=T7.prototype;function Vse(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new T7(t)}Array.prototype.slice;function Hse(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function E7(e){this._context=e}E7.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Use(e){return new E7(e)}function Wse(e){return e[0]}function Gse(e){return e[1]}function Kse(e,t){var n=y7(!0),r=null,i=Use,a=null,o=Vse(s);e=typeof e==`function`?e:e===void 0?Wse:y7(e),t=typeof t==`function`?t:t===void 0?Gse:y7(t);function s(s){var c,l=(s=Hse(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c<l&&n(u=s[c],c,s))===d&&((d=!d)?a.lineStart():a.lineEnd()),d&&a.point(+e(u,c,s),+t(u,c,s));if(f)return a=null,f+``||null}return s.x=function(t){return arguments.length?(e=typeof t==`function`?t:y7(+t),s):e},s.y=function(e){return arguments.length?(t=typeof e==`function`?e:y7(+e),s):t},s.defined=function(e){return arguments.length?(n=typeof e==`function`?e:y7(!!e),s):n},s.curve=function(e){return arguments.length?(i=e,r!=null&&(a=i(r)),s):i},s.context=function(e){return arguments.length?(e==null?r=a=null:a=i(r=e),s):r},s}function D7(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function O7(e,t){this._context=e,this._k=(1-t)/6}O7.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:D7(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:D7(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},(function e(t){function n(e){return new O7(e,t)}return n.tension=function(t){return e(+t)},n})(0);function qse(e,t,n){var r=e._x1,i=e._y1,a=e._x2,o=e._y2;if(e._l01_a>1e-12){var s=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,c=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*s-e._x0*e._l12_2a+e._x2*e._l01_2a)/c,i=(i*s-e._y0*e._l12_2a+e._y2*e._l01_2a)/c}if(e._l23_a>1e-12){var l=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,u=3*e._l23_a*(e._l23_a+e._l12_a);a=(a*l+e._x1*e._l23_2a-t*e._l12_2a)/u,o=(o*l+e._y1*e._l23_2a-n*e._l12_2a)/u}e._context.bezierCurveTo(r,i,a,o,e._x2,e._y2)}function k7(e,t){this._context=e,this._alpha=t}k7.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=(n*n+r*r)**+this._alpha)}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:qse(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var Jse=(function e(t){function n(e){return t?new k7(e,t):new O7(e,0)}return n.alpha=function(t){return e(+t)},n})(.5);function Yse(e){switch(e.type){case`Queue`:return e.queue;case`Rotary`:return`Rotary `+e.machineGroup+` #`+e.machineNum.toString();case`StockerWaitForMC`:return`Stocker[Waiting For Machining]`;case`StockerWaitForUnload`:return`Stocker[Waiting For Unload]`}}var A7=150;function Xse(e,t,n){let r=Math.max(t.x.getTime()-e,n.endTime.getTime()-n.elapsedSeconds*1e3),i=Math.min(t.x.getTime()+e,n.endTime.getTime());t.y+=(i-r)/(2*e)*n.numMaterial}function Zse(e,t,n,r){let i=new Date(e.getTime()+n),a=new Date(t.getTime()-n),o=(a.getTime()-i.getTime())/(A7-1),s=[];for(let e=0;e<A7-1;e++)s.push({x:new Date(i.getTime()+e*o),y:0});s.push({x:a,y:0});for(let e of r){let t=Math.max(0,Math.ceil((e.endTime.getTime()-e.elapsedSeconds*1e3-n-i.getTime())/o)),r=Math.min(A7-1,Math.floor((e.endTime.getTime()+n-i.getTime())/o));for(let i=t;i<=r;i++)Xse(n,s[i],e)}return s}function Qse(e,t,n,r,i){let a=n*60*60*1e3;return Q.of(i).filter(e=>e.buffer.type!==`Queue`||!r.has(e.buffer.queue)).groupBy(e=>Yse(e.buffer)).map(([n,r])=>({label:n,points:Zse(e,t,a,r)})).toSortedArray(e=>e.label)}function j7(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 $se(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?j7(Object(n),!0).forEach(function(t){ece(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j7(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function M7(e){"@babel/helpers - typeof";return M7=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},M7(e)}function ece(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function N7(){return N7=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},N7.apply(this,arguments)}function tce(e,t){if(e){if(typeof e==`string`)return P7(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return P7(e,t)}}function P7(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function F7(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=tce(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
366
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,s=e},f:function(){try{!a&&n.return!=null&&n.return()}finally{if(o)throw s}}}}function nce(e,t){var n=[],r=[];function i(e,t){if(e.length===1)n.push(e[0]),r.push(e[0]);else{for(var a=Array(e.length-1),o=0;o<a.length;o++)o===0&&n.push(e[0]),o===a.length-1&&r.push(e[o+1]),a[o]=[(1-t)*e[o][0]+t*e[o+1][0],(1-t)*e[o][1]+t*e[o+1][1]];i(a,t)}}return e.length&&i(e,t),{left:n,right:r.reverse()}}function rce(e){var t={};return e.length===4&&(t.x2=e[2][0],t.y2=e[2][1]),e.length>=3&&(t.x1=e[1][0],t.y1=e[1][1]),t.x=e[e.length-1][0],t.y=e[e.length-1][1],e.length===4?t.type=`C`:e.length===3?t.type=`Q`:t.type=`L`,t}function ice(e,t){t||=2;for(var n=[],r=e,i=1/t,a=0;a<t-1;a++){var o=i/(1-i*a),s=nce(r,o);n.push(s.left),r=s.right}return n.push(r),n}function ace(e,t,n){var r=[[e.x,e.y]];return t.x1!=null&&r.push([t.x1,t.y1]),t.x2!=null&&r.push([t.x2,t.y2]),r.push([t.x,t.y]),ice(r,n).map(rce)}var oce=/[MLCSTQAHVZmlcstqahv]|-?[\d.e+-]+/g,I7={M:[`x`,`y`],L:[`x`,`y`],H:[`x`],V:[`y`],C:[`x1`,`y1`,`x2`,`y2`,`x`,`y`],S:[`x2`,`y2`,`x`,`y`],Q:[`x1`,`y1`,`x`,`y`],T:[`x`,`y`],A:[`rx`,`ry`,`xAxisRotation`,`largeArcFlag`,`sweepFlag`,`x`,`y`],Z:[]};Object.keys(I7).forEach(function(e){I7[e.toLowerCase()]=I7[e]});function L7(e,t){for(var n=Array(e),r=0;r<e;r++)n[r]=t;return n}function sce(e){return`${e.type}${I7[e.type].map(function(t){return e[t]}).join(`,`)}`}function cce(e,t){var n={x1:`x`,y1:`y`,x2:`x`,y2:`y`},r=[`xAxisRotation`,`largeArcFlag`,`sweepFlag`];if(e.type!==t.type&&t.type.toUpperCase()!==`M`){var i={};Object.keys(t).forEach(function(a){var o=t[a],s=e[a];s===void 0&&(r.includes(a)?s=o:(s===void 0&&n[a]&&(s=e[n[a]]),s===void 0&&(s=0))),i[a]=s}),i.type=t.type,e=i}return e}function lce(e,t,n){var r=[];if(t.type===`L`||t.type===`Q`||t.type===`C`)r=r.concat(ace(e,t,n));else{var i=N7({},e);i.type===`M`&&(i.type=`L`),r=r.concat(L7(n-1).map(function(){return i})),r.push(t)}return r}function R7(e,t,n){var r=e.length-1,i=t.length-1,a=r/i,o=L7(i).reduce(function(t,r,i){var o=Math.floor(a*i);if(n&&o<e.length-1&&n(e[o],e[o+1])){var s=a*i%1<.5;t[o]&&(s?o>0?--o:o<e.length-1&&(o+=1):o<e.length-1?o+=1:o>0&&--o)}return t[o]=(t[o]||0)+1,t},[]).reduce(function(t,n,r){if(r===e.length-1){var i=L7(n,N7({},e[e.length-1]));return i[0].type===`M`&&i.forEach(function(e){e.type=`L`}),t.concat(i)}return t.concat(lce(e[r],e[r+1],n))},[]);return o.unshift(e[0]),o}function z7(e){for(var t=(e||``).match(oce)||[],n=[],r,i,a=0;a<t.length;++a)if(r=I7[t[a]],r){i={type:t[a]};for(var o=0;o<r.length;++o)i[r[o]]=+t[a+o+1];a+=r.length,n.push(i)}return n}function uce(e,t,n){var r=e==null?[]:e.slice(),i=t==null?[]:t.slice(),a=M7(n)===`object`?n:{excludeSegment:n,snapEndsToInput:!0},o=a.excludeSegment,s=a.snapEndsToInput;if(!r.length&&!i.length)return function(){return[]};var c=(r.length===0||r[r.length-1].type===`Z`)&&(i.length===0||i[i.length-1].type===`Z`);r.length>0&&r[r.length-1].type===`Z`&&r.pop(),i.length>0&&i[i.length-1].type===`Z`&&i.pop(),r.length?i.length||i.push(r[0]):r.push(i[0]),Math.abs(i.length-r.length)!==0&&(i.length>r.length?r=R7(r,i,o):i.length<r.length&&(i=R7(i,r,o))),r=r.map(function(e,t){return cce(e,i[t])});var l=r.map(function(e){return $se({},e)});return c&&(l.push({type:`Z`}),r.push({type:`Z`})),function(e){if(e===1&&s)return t??[];if(e===0)return r;for(var n=0;n<l.length;++n){var a=r[n],o=i[n],c=l[n],u=F7(I7[c.type]),d;try{for(u.s();!(d=u.n()).done;){var f=d.value;c[f]=(1-e)*a[f]+e*o[f],(f===`largeArcFlag`||f===`sweepFlag`)&&(c[f]=Math.round(c[f]))}}catch(e){u.e(e)}finally{u.f()}}return l}}function dce(e,t,n){var r=z7(e),i=z7(t),a=M7(n)===`object`?n:{excludeSegment:n,snapEndsToInput:!0},o=a.excludeSegment,s=a.snapEndsToInput;if(!r.length&&!i.length)return function(){return``};var c=uce(r,i,{excludeSegment:o,snapEndsToInput:s});return function(e){if(e===1&&s)return t??``;var n=c(e),r=``,i=F7(n),a;try{for(i.s();!(a=i.n()).done;){var o=a.value;r+=sce(o)}}catch(e){i.e(e)}finally{i.f()}return r}}var fce=(0,L.memo)(function({series:e,xScale:t,yScale:n,color:r}){let i=Kse().curve(Jse).x(e=>t(e.x)).y(e=>n(e.y))(e.points)??``,a=(0,L.useRef)(i),o=(0,L.useCallback)(Zf(e=>{a.current=e},50),[]),s=dce(a.current,i);o(i);let{t:c}=i7({from:{t:0},to:{t:1},reset:!0,delay:0});return(0,H.jsx)(f7.path,{d:c.to(s),stroke:r,strokeWidth:2,strokeLinecap:`round`,fill:`transparent`})}),B7=60,pce=50,V7=20,H7=20;function mce({width:e,height:t,series:n,disabled:r}){let[i,a]=(0,L.useMemo)(()=>{let e=null,t=null;for(let r of n)for(let n of r.points)(e===null||n.x<e)&&(e=n.x),(t===null||n.x>t)&&(t=n.x);return[e??new Date,t??new Date]},[n]),o=(0,L.useMemo)(()=>rF().range([0,e-B7-H7]).domain([i,a]),[e,i,a]),s=t-pce-V7,c=(0,L.useMemo)(()=>VM().domain([0,Q.of(n).flatMap(e=>e.points).map(e=>e.y).maxBy(e=>e)??1]).range([s,0]),[n,s]);return(0,H.jsx)(`svg`,{width:e,height:t,children:(0,H.jsxs)(`g`,{transform:`translate(${B7},${V7})`,children:[(0,H.jsx)(DA,{scale:o,top:s}),(0,H.jsx)(OA,{scale:c,left:0,label:`Buffer Size`}),(0,H.jsx)(wA,{xScale:o,yScale:c,width:e-B7-H7,height:s}),n.map((e,t)=>r.has(e.label)?void 0:(0,H.jsx)(fce,{series:e,xScale:o,yScale:c,color:v6(t,n.length)},e.label))]})})}var hce=(0,L.memo)(function(e){let t=R(KR),n=t.type===`Last30`?[LT(cE(),-29),LT(cE(),1)]:[t.month,RT(t.month,1)],r=R(t.type===`Last30`?Wie:Gie),i=R(CL),[a,o]=(0,L.useState)(YD.empty()),s=n[0],c=n[1],l=(0,L.useMemo)(()=>Qse(s,c,e.movingAverageDistanceInHours,i,r.valuesToLazySeq()),[s,c,r,e.movingAverageDistanceInHours,i]),{width:u,height:d,ref:f}=pA({refreshMode:`debounce`,refreshRate:100});return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(J,{ref:f,sx:{height:{xs:`calc(100vh - 350px)`,md:`calc(100vh - 285px)`,xl:`calc(100vh - 220px)`},overflow:`hidden`},children:u&&d&&u>0&&d>0&&(0,H.jsx)(mce,{width:u,height:d,series:l,disabled:a})}),(0,H.jsx)(`div`,{style:{marginTop:`1em`,display:`flex`,flexWrap:`wrap`,justifyContent:`space-around`},children:l.map((e,t)=>(0,H.jsx)(qw,{selected:!a.has(e.label),value:e.label,onChange:()=>o(t=>t.has(e.label)?t.delete(e.label):t.add(e.label)),children:(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(`div`,{style:{width:`14px`,height:`14px`,backgroundColor:v6(t,l.length)}}),(0,H.jsx)(`div`,{style:{marginLeft:`1em`},children:e.label})]})},e.label))})]})}),gce=EC;function _ce(){JI(`Buffer Occupancy`);let[e,t]=(0,L.useState)(12);return(0,H.jsxs)(J,{sx:{paddingLeft:`24px`,paddingRight:`24px`,paddingTop:`10px`},children:[(0,H.jsxs)(J,{component:`nav`,sx:{display:`flex`,minHeight:`2.5em`,alignItems:`center`,maxWidth:`calc(100vw - 24px - 24px)`},children:[(0,H.jsx)(q,{variant:`subtitle1`,children:`Average material occupancy of rotary tables and stocker positions over time`}),(0,H.jsx)(J,{sx:{flexGrow:1}}),(0,H.jsx)(`span`,{style:{fontSize:`small`,marginRight:`1em`},children:`Moving Average Window: `}),(0,H.jsx)(gce,{style:{width:`10em`},min:1,max:36,steps:.2,valueLabelDisplay:`off`,value:e,onChange:(e,n)=>t(n)})]}),(0,H.jsx)(`main`,{children:(0,H.jsx)(hce,{movingAverageDistanceInHours:e})})]})}function vce(e,t){return e.some(e=>e===t)}var yce=20,U7=10,bce=2,W7=`#E8F5E9`,G7=`#1B5E20`;function xce({yType:e,dateRange:t,containerWidth:n,points:r}){let i=n==null||n===0?400:n,a=(0,L.useMemo)(()=>Q.of(r).map(e=>e.y).distinct().map(aA).maxBy(e=>e??0)??20,[r])+5,o=i-a-bce,s=t[0],c=t[1],l=(0,L.useMemo)(()=>{let e=[];if(c<s)e.push(s);else{let t=s;for(;t<c;)e.push(t),t=LT(t,1)}return $A().domain(e).range([0,o]).align(0).padding(.05)},[s,c,o]),{yScale:u,height:d,colorScale:f}=(0,L.useMemo)(()=>{let t=new Set;for(let e of r)t.add(e.y);let n=60*t.size,i=n+U7+yce,a=$A().domain(Q.of(t).toSortedArray(e=>e)).range([0,n]).align(0).padding(.05),o;if(e===`Station`)o=VM().domain([0,1]).range([W7,G7]);else{let e=Q.of(r).maxBy(e=>e.color)?.color??1;o=VM().domain([0,e]).range([W7,G7])}return{yScale:a,height:i,colorScale:o}},[r,e]);return{height:d,width:i,xScale:l,yScale:u,colorScale:f,marginLeft:a}}var Sce=(0,L.memo)(function({xScale:e,yScale:t}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(DA,{scale:e,top:t.range()[1],tickFormat:e=>e.toLocaleDateString(void 0,{month:`short`,day:`numeric`})}),(0,H.jsx)(OA,{scale:t,left:e.range()[0]})]})}),Cce=(0,L.memo)(function({points:e,xScale:t,yScale:n,colorScale:r,setTooltip:i}){let a=(0,L.useRef)(null),o=(0,L.useCallback)(t=>{let n=rA(t);if(n===null)return;a.current!==null&&(clearTimeout(a.current),a.current=null);let r=t.currentTarget.dataset.idx;if(r===void 0)return;let o=e[parseInt(r)];i({left:n.x,top:n.y,data:o})},[e,i]),s=(0,L.useCallback)(()=>{a.current===null&&(a.current=window.setTimeout(()=>{a.current=null,i(null)},100))},[i]);return(0,H.jsx)(`g`,{children:e.map((e,i)=>(0,H.jsx)(`rect`,{"data-idx":i,x:t(e.x)??0,width:t.bandwidth(),y:n(e.y)??0,height:n.bandwidth(),rx:6,fill:r(e.color),onPointerEnter:o,onPointerLeave:s},i))})}),wce=(0,L.memo)(function({yType:e,seriesLabel:t,tooltip:n}){return n===null?null:(0,H.jsxs)(RC,{direction:`column`,spacing:.6,children:[(0,H.jsxs)(`div`,{children:[e,`: `,n.data.y]}),(0,H.jsxs)(`div`,{children:[`Day: `,n.data.x.toDateString()]}),(0,H.jsxs)(`div`,{children:[t,`: `,n.data.label]})]})});function Tce(e){let{width:t,height:n,xScale:r,yScale:i,colorScale:a,marginLeft:o}=xce({yType:e.y_title,points:e.points,dateRange:e.dateRange,containerWidth:e.parentWidth});return(0,H.jsx)(`svg`,{width:t,height:n,children:(0,H.jsxs)(`g`,{transform:`translate(${o}, ${U7})`,children:[(0,H.jsx)(Cce,{points:e.points,xScale:r,yScale:i,colorScale:a,setTooltip:e.setTooltip}),(0,H.jsx)(Sce,{xScale:r,yScale:i,colorScale:a})]})})}function Ece(e){let t=e.setSelected;return(0,H.jsxs)(J,{component:`nav`,sx:{display:`flex`,minHeight:`2.5em`,alignItems:`center`,maxWidth:`calc(100vw - 24px - 24px)`},children:[(0,H.jsx)(q,{variant:`subtitle1`,children:e.label}),(0,H.jsx)(J,{sx:{flexGrow:1}}),t?(0,H.jsx)(_y,{size:`small`,children:(0,H.jsx)(YS,{autoWidth:!0,displayEmpty:!0,value:e.cur_selected,onChange:n=>{vce(e.options,n.target.value)&&t(n.target.value)},children:e.options.map((e,t)=>(0,H.jsx)(Hx,{value:e,children:e},t))})}):void 0,(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{onClick:e.onExport,style:{height:`25px`,paddingTop:0,paddingBottom:0},size:`large`,children:(0,H.jsx)(uT,{})})})]})}function K7(e){let t=(0,L.useMemo)(()=>P(null),[]),n=z(t),r=(0,L.useCallback)(()=>{n(null)},[n]);return(0,H.jsxs)(J,{sx:{paddingLeft:`24px`,paddingRight:`24px`,paddingTop:`10px`},children:[(0,H.jsx)(Ece,{label:e.label,setSelected:e.setSelected,cur_selected:e.cur_selected,onExport:e.onExport,options:e.options}),(0,H.jsx)(`main`,{onPointerLeave:r,children:(0,H.jsx)(gA,{sx:{width:`100%`},tooltipAtom:t,autoHeight:!0,chart:({width:t})=>(0,H.jsx)(Tce,{points:e.points,y_title:e.y_title,dateRange:e.dateRange,parentWidth:t,setTooltip:n}),TooltipContent:({tooltip:t})=>(0,H.jsx)(wce,{yType:e.y_title,seriesLabel:e.label_title,tooltip:t})})})]})}var q7=class e{constructor(e,t){this.day=e,this.part=t}compare(e){let t=this.day.getTime()-e.day.getTime();return t===0?this.part.localeCompare(e.part):t}hash(){return yD(this.day,this.part)}toString(){return`{day: ${this.day.toISOString()}}, part: ${this.part}}`}adjustDay(t){return new e(t(this.day),this.part)}},J7=class{constructor(e,t){this.matId=e,this.proc=t}compare(e){let t=this.matId-e.matId;return t===0?this.proc-e.proc:t}hash(){return yD(this.matId,this.proc)}toString(){return this.matId.toString()+`-`+this.proc.toString()}};function Dce(e,t,n,r){let i=Q.of(e).filter(e=>e.endTime>=n&&e.endTime<=r&&ek(e)&&e.activeMinutes>0&&e.material.length>0).flatMap(e=>e.material.map(t=>({matId:t.id,proc:t.proc,active:e.activeMinutes/e.material.length}))).toHashMap(e=>[new J7(e.matId,e.proc),e.active],(e,t)=>e+t);return Q.of(t).flatMap(([e,t])=>Q.ofObject(t.unloaded_processes??{}).filter(([e,t])=>t>=n&&t<=r).map(([n,r])=>({day:KT(r),part:t.partName+`-`+n,value:{count:1,activeMachineMins:i.get(new J7(e,parseInt(n)))??0}}))).toHashMap(e=>[new q7(e.day,e.part),e.value],(e,t)=>({count:e.count+t.count,activeMachineMins:e.activeMachineMins+t.activeMachineMins}))}function Oce(e){return Q.of(e).toHashMap(e=>[new q7(KT(e.completeTime),e.partName+`-`+e.process.toString()),{count:e.quantity,activeMachineMins:e.expectedMachineMins}],(e,t)=>({count:e.count+t.count,activeMachineMins:e.activeMachineMins+t.activeMachineMins}))}var Y7=class{constructor(e,t){this.x=e,this.y=t}compare(e){let t=this.x-e.x;return t===0?this.y.localeCompare(e.y):t}hash(){return yD(this.x,this.y)}toString(){return`{x: ${new Date(this.x).toISOString()}, y: ${this.y}}`}};function kce(e){let t=Q.of(e).toHashMap(e=>[new Y7(e.x.getTime(),e.y),e],(e,t)=>t),n=Q.of(e).map(e=>e.x.getTime()).distinct().toSortedArray(e=>e),r=Q.of(e).aggregate(e=>e.y,e=>e.activeMachineMins/e.count,(e,t)=>isNaN(e)?t:e).sortBy(([e,t])=>e),i=`<table>
|
|
365
|
+
</table>`,t}function Pae(e){Ak(Nae(e))}var g6=[[`4477aa`],[`4477aa`,`cc6677`],[`4477aa`,`ddcc77`,`cc6677`],[`4477aa`,`117733`,`ddcc77`,`cc6677`],[`332288`,`88ccee`,`117733`,`ddcc77`,`cc6677`],[`332288`,`88ccee`,`117733`,`ddcc77`,`cc6677`,`aa4499`],[`332288`,`88ccee`,`44aa99`,`117733`,`ddcc77`,`cc6677`,`aa4499`],[`332288`,`88ccee`,`44aa99`,`117733`,`999933`,`ddcc77`,`cc6677`,`aa4499`],[`332288`,`88ccee`,`44aa99`,`117733`,`999933`,`ddcc77`,`cc6677`,`882255`,`aa4499`],[`332288`,`88ccee`,`44aa99`,`117733`,`999933`,`ddcc77`,`661100`,`cc6677`,`882255`,`aa4499`],[`332288`,`6699cc`,`88ccee`,`44aa99`,`117733`,`999933`,`ddcc77`,`661100`,`cc6677`,`882255`,`aa4499`],[`332288`,`6699cc`,`88ccee`,`44aa99`,`117733`,`999933`,`ddcc77`,`661100`,`cc6677`,`aa4466`,`882255`,`aa4499`]],_6=`ff0029.377eb8.66a61e.984ea3.00d2d5.ff7f00.af8d00.7f80cd.b3e900.c42e60.a65628.f781bf.8dd3c7.bebada.fb8072.80b1d3.fdb462.fccde5.bc80bd.ffed6f.c4eaff.cf8c00.1b9e77.d95f02.e7298a.e6ab02.a6761d.0097ff.00d067.000000.252525.525252.737373.969696.bdbdbd.f43600.4ba93b.5779bb.927acc.97ee3f.bf3947.9f5b00.f48758.8caed6.f2b94f.eff26e.e43872.d9b100.9d7a00.698cff.d9d9d9.00d27e.d06800.009f82.c49200.cbe8ff.fecddf.c27eb6.8cd2ce.c4b8d9.f883b0.a49100.f48800.27d0df.a04a9b`.split(`.`);function v6(e,t){return t<=g6.length?`#`+g6[t-1][e]:`#`+_6[e%_6.length]}var y6=v6(0,2),b6=v6(1,2),x6=50,Fae=30,S6=10,C6=10;function Iae({width:e,height:t,points:n,setTooltip:r}){let i=t-S6-Fae,a=(0,L.useMemo)(()=>VM().domain([0,24]).range([i,0]),[i]),o=(0,L.useMemo)(()=>$A().domain(Q.of(n).map(e=>e.x).distinct()).range([0,e-x6-C6]).padding(.1),[n,e]),s=(0,L.useMemo)(()=>$A().domain([`Actual`,`Planned`]).range([0,o.bandwidth()]).padding(.05),[o]);return(0,H.jsx)(`svg`,{width:e,height:t,children:(0,H.jsxs)(`g`,{transform:`translate(${x6},${S6})`,children:[(0,H.jsx)(DA,{scale:o,top:i}),(0,H.jsx)(OA,{scale:a,left:0,label:`Hours`}),(0,H.jsx)(SA,{scale:a,width:e-x6-C6}),n.map((e,t)=>(0,H.jsxs)(`g`,{transform:`translate(${o(e.x)},0)`,children:[(0,H.jsx)(`rect`,{x:s(`Actual`),y:a(e.y),width:s.bandwidth(),height:i-a(e.y),fill:y6,onMouseEnter:t=>{let n=rA(t);r({left:n?.x??0,top:n?.y??0,datum:e})},onMouseLeave:()=>r(null)}),(0,H.jsx)(`rect`,{x:s(`Planned`),y:a(e.plannedHours),width:s.bandwidth(),height:i-a(e.plannedHours),fill:b6,onMouseEnter:t=>{let n=rA(t);r({left:n?.x??0,top:n?.y??0,datum:e})},onMouseLeave:()=>r(null)})]},t))]})})}function Lae({station:e}){return(0,H.jsxs)(`div`,{style:{marginTop:`1em`,display:`flex`,flexWrap:`wrap`,justifyContent:`space-evenly`},children:[(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(`div`,{style:{width:`14px`,height:`14px`,backgroundColor:y6}}),(0,H.jsxs)(`div`,{style:{marginLeft:`1em`},children:[e,` Actual`]})]}),(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(`div`,{style:{width:`14px`,height:`14px`,backgroundColor:b6}}),(0,H.jsxs)(`div`,{style:{marginLeft:`1em`},children:[e,` Planned`]})]})]})}function Rae({tooltip:e}){return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{children:e.datum.x}),(0,H.jsxs)(`div`,{children:[`Actual Hours: `,e.datum.y?.toFixed(1)]}),(0,H.jsxs)(`div`,{children:[`Planned Hours: `,e.datum?.plannedHours?.toFixed(1)]})]})}function zae({series:e}){let t=(0,L.useMemo)(()=>P(null),[]),n=z(t);return(0,H.jsxs)(yy,{size:{xs:12,md:6},onMouseLeave:()=>n(null),children:[(0,H.jsx)(gA,{sx:{height:`calc(100vh / 2 - 200px)`},chart:({width:t,height:r})=>(0,H.jsx)(Iae,{width:t,height:r,points:e.points,setTooltip:n}),tooltipAtom:t,TooltipContent:Rae}),(0,H.jsx)(Lae,{station:e.station})]})}function Bae({points:e}){return(0,H.jsx)(yy,{container:!0,children:e.map((e,t)=>(0,H.jsx)(zae,{series:e},t))})}var w6=[{id:0,numeric:!1,label:`Date`,getDisplay:e=>e.x,getForSort:e=>e.day.getTime()},{id:1,numeric:!1,label:`Station`,getDisplay:e=>e.station},{id:2,numeric:!0,label:`Actual Hours`,getDisplay:e=>e.y.toFixed(1),getForSort:e=>e.y},{id:3,numeric:!0,label:`Actual OEE`,getDisplay:e=>(e.actualOee*100).toFixed(0)+`%`,getForSort:e=>e.actualOee},{id:4,numeric:!0,label:`Planned Hours`,getDisplay:e=>e.plannedHours.toFixed(1),getForSort:e=>e.plannedHours},{id:5,numeric:!0,label:`Planned OEE`,getDisplay:e=>(e.plannedOee*100).toFixed(0)+`%`,getForSort:e=>e.plannedOee}];function Vae(e,t){return Q.of(e).flatMap(e=>e.points).toSortedArray(t)}var Hae=(0,L.memo)(function({points:e}){let t=f0(0,w6);return(0,H.jsxs)(jw,{children:[(0,H.jsx)(r0,{columns:w6,sort:t,showDetailsCol:!1}),(0,H.jsx)(l0,{columns:w6,pageData:Vae(e,t.sortOn)})]})}),Uae=P(!0),Wae=P(!0);function T6({ty:e}){JI(e===`labor`?`L/U OEE`:`Machine OEE`);let[t,n]=B(e===`labor`?Uae:Wae),r=LT(cE(),-6),i=LT(cE(),1),a=R(uk),o=R(Xk),s=(0,L.useMemo)(()=>Aae(r,i,e,a.valuesToLazySeq(),o),[r,i,e,a,o]);return(0,H.jsxs)(J,{sx:{paddingLeft:`24px`,paddingRight:`24px`,paddingTop:`10px`},children:[(0,H.jsxs)(J,{component:`nav`,sx:{display:`flex`,minHeight:`2.5em`,alignItems:`center`,maxWidth:`calc(100vw - 24px - 24px)`},children:[(0,H.jsxs)(q,{variant:`subtitle1`,children:[e===`labor`?`Load/Unload`:`Machine`,` OEE: comparing flexplan hours between actual and simulated production`]}),(0,H.jsx)(J,{sx:{flexGrow:1}}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,value:t?`chart`:`table`,onChange:e=>n(e.target.value===`chart`),children:[(0,H.jsx)(Hx,{value:`chart`,children:`Chart`},`chart`),(0,H.jsx)(Hx,{value:`table`,children:`Table`},`table`)]})}),(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{style:{height:`25px`,paddingTop:0,paddingBottom:0},onClick:()=>Pae(s),size:`large`,children:(0,H.jsx)(uT,{})})})]}),(0,H.jsx)(`main`,{children:t?(0,H.jsx)(Bae,{points:s}):(0,H.jsx)(Hae,{points:s})})]})}var E6=Object.defineProperty,Gae=(e,t)=>{let n={};for(var r in e)E6(n,r,{get:e[r],enumerable:!0});return t||E6(n,Symbol.toStringTag,{value:`Module`}),n},D6=U6(),O6=e=>z6(e,D6),k6=U6();O6.write=e=>z6(e,k6);var A6=U6();O6.onStart=e=>z6(e,A6);var j6=U6();O6.onFrame=e=>z6(e,j6);var M6=U6();O6.onFinish=e=>z6(e,M6);var N6=[];O6.setTimeout=(e,t)=>{let n=O6.now()+t,r=()=>{let e=N6.findIndex(e=>e.cancel==r);~e&&N6.splice(e,1),L6-=+!!~e},i={time:n,handler:e,cancel:r};return N6.splice(P6(n),0,i),L6+=1,B6(),i};var P6=e=>~(~N6.findIndex(t=>t.time>e)||~N6.length);O6.cancel=e=>{A6.delete(e),j6.delete(e),M6.delete(e),D6.delete(e),k6.delete(e)},O6.sync=e=>{R6=!0,O6.batchedUpdates(e),R6=!1},O6.throttle=e=>{let t;function n(){try{e(...t)}finally{t=null}}function r(...e){t=e,O6.onStart(n)}return r.handler=e,r.cancel=()=>{A6.delete(n),t=null},r};var F6=typeof window<`u`?window.requestAnimationFrame:()=>{};O6.use=e=>F6=e,O6.now=typeof performance<`u`?()=>performance.now():Date.now,O6.batchedUpdates=e=>e(),O6.catch=console.error,O6.frameLoop=`always`,O6.onDemand=()=>{},O6.advance=()=>{O6.frameLoop===`demand`?H6():console.warn(`Cannot call the manual advancement of rafz whilst frameLoop is not set as demand`)};var I6=-1,L6=0,R6=!1;function z6(e,t){R6?(t.delete(e),e(0)):(t.add(e),B6(),O6.frameLoop===`demand`&&O6.onDemand())}function B6(){I6<0&&(I6=0,O6.frameLoop!==`demand`&&F6(V6))}function Kae(){I6=-1}function V6(){~I6&&(F6(V6),O6.batchedUpdates(H6))}function H6(){let e=I6;I6=O6.now();let t=P6(I6);if(t&&(W6(N6.splice(0,t),e=>e.handler()),L6-=t),!L6){Kae();return}A6.flush(),D6.flush(e?Math.min(64,I6-e):16.667),j6.flush(),k6.flush(),M6.flush(),O6.frameLoop===`demand`&&L6>0&&O6.onDemand()}function U6(){let e=new Set,t=e;return{add(n){L6+=+(t==e&&!e.has(n)),e.add(n)},delete(n){return L6-=t==e&&e.has(n)?1:0,e.delete(n)},flush(n){t.size&&(e=new Set,L6-=t.size,W6(t,t=>t(n)&&e.add(t)),L6+=e.size,t=e)}}}function W6(e,t){e.forEach(e=>{try{t(e)}catch(e){O6.catch(e)}})}function G6(){}var qae=(e,t,n)=>Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0}),K6={arr:Array.isArray,obj:e=>!!e&&e.constructor.name===`Object`,fun:(e=>typeof e==`function`),str:e=>typeof e==`string`,num:e=>typeof e==`number`,und:e=>e===void 0};function q6(e,t){if(K6.arr(e)){if(!K6.arr(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return e===t}var J6=(e,t)=>e.forEach(t);function Y6(e,t,n){if(K6.arr(e)){for(let r=0;r<e.length;r++)t.call(n,e[r],`${r}`);return}for(let r in e)e.hasOwnProperty(r)&&t.call(n,e[r],r)}var X6=e=>K6.und(e)?[]:K6.arr(e)?e:[e];function Z6(e,t){if(e.size){let n=Array.from(e);e.clear(),J6(n,t)}}var Q6=(e,...t)=>Z6(e,e=>e(...t)),$6=()=>typeof window>`u`||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),e8=Gae({assign:()=>Jae,colors:()=>r8,createStringInterpolator:()=>t8,skipAnimation:()=>i8,to:()=>n8,willAdvance:()=>a8}),t8,n8,r8=null,i8=!1,a8=G6,Jae=e=>{e.to&&(n8=e.to),e.now&&(O6.now=e.now),e.colors!==void 0&&(r8=e.colors),e.skipAnimation!=null&&(i8=e.skipAnimation),e.createStringInterpolator&&(t8=e.createStringInterpolator),e.requestAnimationFrame&&O6.use(e.requestAnimationFrame),e.batchedUpdates&&(O6.batchedUpdates=e.batchedUpdates),e.willAdvance&&(a8=e.willAdvance),e.frameLoop&&(O6.frameLoop=e.frameLoop),e.onDemand&&(O6.onDemand=e.onDemand)},o8=new Set,s8=[],c8=[],l8=0,u8={get idle(){return!o8.size&&!s8.length},start(e){l8>e.priority?(o8.add(e),O6.onStart(Yae)):(d8(e),O6(p8))},advance:p8,sort(e){if(l8)O6.onFrame(()=>u8.sort(e));else{let t=s8.indexOf(e);~t&&(s8.splice(t,1),f8(e))}},clear(){s8=[],o8.clear()}};function Yae(){o8.forEach(d8),o8.clear(),O6(p8)}function d8(e){s8.includes(e)||f8(e)}function f8(e){s8.splice(Xae(s8,t=>t.priority>e.priority),0,e)}function p8(e){let t=c8;for(let n=0;n<s8.length;n++){let r=s8[n];l8=r.priority,r.idle||(a8(r),r.advance(e),r.idle||t.push(r))}return l8=0,c8=s8,c8.length=0,s8=t,s8.length>0}function Xae(e,t){let n=e.findIndex(t);return n<0?e.length:n}var Zae=(e,t,n)=>Math.min(Math.max(n,e),t),Qae={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199},m8=`[-+]?\\d*\\.?\\d+`,h8=`[-+]?\\d*\\.?\\d+%`;function g8(...e){return`\\(\\s*(`+e.join(`)\\s*,\\s*(`)+`)\\s*\\)`}var $ae=RegExp(`rgb`+g8(m8,m8,m8)),eoe=RegExp(`rgba`+g8(m8,m8,m8,m8)),toe=RegExp(`hsl`+g8(m8,h8,h8)),noe=RegExp(`hsla`+g8(m8,h8,h8,m8)),roe=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,ioe=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,aoe=/^#([0-9a-fA-F]{6})$/,ooe=/^#([0-9a-fA-F]{8})$/;function soe(e){let t;return typeof e==`number`?e>>>0===e&&e>=0&&e<=4294967295?e:null:(t=aoe.exec(e))?parseInt(t[1]+`ff`,16)>>>0:r8&&r8[e]!==void 0?r8[e]:(t=$ae.exec(e))?(y8(t[1])<<24|y8(t[2])<<16|y8(t[3])<<8|255)>>>0:(t=eoe.exec(e))?(y8(t[1])<<24|y8(t[2])<<16|y8(t[3])<<8|x8(t[4]))>>>0:(t=roe.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+`ff`,16)>>>0:(t=ooe.exec(e))?parseInt(t[1],16)>>>0:(t=ioe.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4],16)>>>0:(t=toe.exec(e))?(v8(b8(t[1]),S8(t[2]),S8(t[3]))|255)>>>0:(t=noe.exec(e))?(v8(b8(t[1]),S8(t[2]),S8(t[3]))|x8(t[4]))>>>0:null}function _8(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function v8(e,t,n){let r=n<.5?n*(1+t):n+t-n*t,i=2*n-r,a=_8(i,r,e+1/3),o=_8(i,r,e),s=_8(i,r,e-1/3);return Math.round(a*255)<<24|Math.round(o*255)<<16|Math.round(s*255)<<8}function y8(e){let t=parseInt(e,10);return t<0?0:t>255?255:t}function b8(e){return(parseFloat(e)%360+360)%360/360}function x8(e){let t=parseFloat(e);return t<0?0:t>1?255:Math.round(t*255)}function S8(e){let t=parseFloat(e);return t<0?0:t>100?1:t/100}function C8(e){let t=soe(e);return t===null?e:(t||=0,`rgba(${(t&4278190080)>>>24}, ${(t&16711680)>>>16}, ${(t&65280)>>>8}, ${(t&255)/255})`)}var w8=(e,t,n)=>{if(K6.fun(e))return e;if(K6.arr(e))return w8({range:e,output:t,extrapolate:n});if(K6.str(e.output[0]))return t8(e);let r=e,i=r.output,a=r.range||[0,1],o=r.extrapolateLeft||r.extrapolate||`extend`,s=r.extrapolateRight||r.extrapolate||`extend`,c=r.easing||(e=>e);return e=>{let t=loe(e,a);return coe(e,a[t],a[t+1],i[t],i[t+1],c,o,s,r.map)}};function coe(e,t,n,r,i,a,o,s,c){let l=c?c(e):e;if(l<t){if(o===`identity`)return l;o===`clamp`&&(l=t)}if(l>n){if(s===`identity`)return l;s===`clamp`&&(l=n)}return r===i?r:t===n?e<=t?r:i:(t===-1/0?l=-l:n===1/0?l-=t:l=(l-t)/(n-t),l=a(l),r===-1/0?l=-l:i===1/0?l+=r:l=l*(i-r)+r,l)}function loe(e,t){for(var n=1;n<t.length-1&&!(t[n]>=e);++n);return n-1}var uoe=(e,t=`end`)=>n=>{n=t===`end`?Math.min(n,.999):Math.max(n,.001);let r=n*e;return Zae(0,1,(t===`end`?Math.floor(r):Math.ceil(r))/e)},T8=1.70158,E8=T8*1.525,D8=2.70158,O8=2*Math.PI/3,k8=2*Math.PI/4.5,A8=e=>{let t=7.5625,n=2.75;return e<1/n?t*e*e:e<2/n?t*(e-=1.5/n)*e+.75:e<2.5/n?t*(e-=2.25/n)*e+.9375:t*(e-=2.625/n)*e+.984375},doe={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>1-(1-e)*(1-e),easeInOutQuad:e=>e<.5?2*e*e:1-(-2*e+2)**2/2,easeInCubic:e=>e*e*e,easeOutCubic:e=>1-(1-e)**3,easeInOutCubic:e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2,easeInQuart:e=>e*e*e*e,easeOutQuart:e=>1-(1-e)**4,easeInOutQuart:e=>e<.5?8*e*e*e*e:1-(-2*e+2)**4/2,easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>1-(1-e)**5,easeInOutQuint:e=>e<.5?16*e*e*e*e*e:1-(-2*e+2)**5/2,easeInSine:e=>1-Math.cos(e*Math.PI/2),easeOutSine:e=>Math.sin(e*Math.PI/2),easeInOutSine:e=>-(Math.cos(Math.PI*e)-1)/2,easeInExpo:e=>e===0?0:2**(10*e-10),easeOutExpo:e=>e===1?1:1-2**(-10*e),easeInOutExpo:e=>e===0?0:e===1?1:e<.5?2**(20*e-10)/2:(2-2**(-20*e+10))/2,easeInCirc:e=>1-Math.sqrt(1-e**2),easeOutCirc:e=>Math.sqrt(1-(e-1)**2),easeInOutCirc:e=>e<.5?(1-Math.sqrt(1-(2*e)**2))/2:(Math.sqrt(1-(-2*e+2)**2)+1)/2,easeInBack:e=>D8*e*e*e-T8*e*e,easeOutBack:e=>1+D8*(e-1)**3+T8*(e-1)**2,easeInOutBack:e=>e<.5?(2*e)**2*(3.5949095*2*e-E8)/2:((2*e-2)**2*(3.5949095*(e*2-2)+E8)+2)/2,easeInElastic:e=>e===0?0:e===1?1:-(2**(10*e-10))*Math.sin((e*10-10.75)*O8),easeOutElastic:e=>e===0?0:e===1?1:2**(-10*e)*Math.sin((e*10-.75)*O8)+1,easeInOutElastic:e=>e===0?0:e===1?1:e<.5?-(2**(20*e-10)*Math.sin((20*e-11.125)*k8))/2:2**(-20*e+10)*Math.sin((20*e-11.125)*k8)/2+1,easeInBounce:e=>1-A8(1-e),easeOutBounce:A8,easeInOutBounce:e=>e<.5?(1-A8(1-2*e))/2:(1+A8(2*e-1))/2,steps:uoe},j8=Symbol.for(`FluidValue.get`),M8=Symbol.for(`FluidValue.observers`),N8=e=>!!(e&&e[j8]),P8=e=>e&&e[j8]?e[j8]():e,F8=e=>e[M8]||null;function foe(e,t){e.eventObserved?e.eventObserved(t):e(t)}function I8(e,t){let n=e[M8];n&&n.forEach(e=>{foe(e,t)})}var L8=class{constructor(e){if(!e&&!(e=this.get))throw Error(`Unknown getter`);poe(this,e)}},poe=(e,t)=>B8(e,j8,t);function R8(e,t){if(e[j8]){let n=e[M8];n||B8(e,M8,n=new Set),n.has(t)||(n.add(t),e.observerAdded&&e.observerAdded(n.size,t))}return t}function z8(e,t){let n=e[M8];if(n&&n.has(t)){let r=n.size-1;r?n.delete(t):e[M8]=null,e.observerRemoved&&e.observerRemoved(r,t)}}var B8=(e,t,n)=>Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0}),V8=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,moe=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,H8=RegExp(`(${V8.source})(%|[a-z]+)`,`i`),hoe=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,U8=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/,W8=e=>{let[t,n]=goe(e);if(!t||$6())return e;let r=window.getComputedStyle(document.documentElement).getPropertyValue(t);return r?r.trim():n&&n.startsWith(`--`)?window.getComputedStyle(document.documentElement).getPropertyValue(n)||e:n&&U8.test(n)?W8(n):n||e},goe=e=>{let t=U8.exec(e);if(!t)return[,];let[,n,r]=t;return[n,r]},G8,_oe=(e,t,n,r,i)=>`rgba(${Math.round(t)}, ${Math.round(n)}, ${Math.round(r)}, ${i})`,K8=e=>e.match(V8)??[],q8=e=>{G8||=r8?RegExp(`(${Object.keys(r8).join(`|`)})(?!\\w)`,`g`):/^\b$/;let t=e.output.map(e=>P8(e).replace(U8,W8).replace(moe,C8).replace(G8,C8)),n=t.map(e=>K8(e).map(Number)),r=n[0].map((e,t)=>n.map(e=>{if(!(t in e))throw Error(`The arity of each "output" value must be equal`);return e[t]})).map(t=>w8({...e,output:t})),i=e.range||[0,1],a=t.map(e=>K8(e)),o=a[0].map((e,t)=>{let n=a.map(e=>{let n=e[t],r=n.indexOf(`.`);return r===-1?0:n.length-r-1});return n.every(e=>e===n[0])&&n[0]>0?n[0]:null});return e=>{let n=i.indexOf(e);if(n!==-1)return t[n];let a=!H8.test(t[0])&&t.find(e=>H8.test(e))?.replace(V8,``),s=0;return t[0].replace(V8,()=>{let t=s++,n=r[t](e),i=o[t];return`${i==null?n:n.toFixed(i)}${a||``}`}).replace(hoe,_oe)}},J8=`react-spring: `,Y8=e=>{let t=e,n=!1;if(typeof t!=`function`)throw TypeError(`${J8}once requires a function parameter`);return(...e)=>{n||=(t(...e),!0)}},voe=Y8(console.warn);function yoe(){voe(`${J8}The "interpolate" function is deprecated in v9 (use "to" instead)`)}var boe=Y8(console.warn);function xoe(){boe(`${J8}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`)}function X8(e){return K6.str(e)&&(e[0]==`#`||/\d/.test(e)||!$6()&&U8.test(e)||e in(r8||{}))}var Z8=$6()?L.useEffect:L.useLayoutEffect,Soe=()=>{let e=(0,L.useRef)(!1);return Z8(()=>(e.current=!0,()=>{e.current=!1}),[]),e};function Q8(){let e=(0,L.useState)()[1],t=Soe();return()=>{t.current&&e(Math.random())}}var $8=e=>(0,L.useEffect)(e,Coe),Coe=[];function e5(e){let t=(0,L.useRef)(void 0);return(0,L.useEffect)(()=>{t.current=e}),t.current}var t5=Symbol.for(`Animated:node`),woe=e=>!!e&&e[t5]===e,n5=e=>e&&e[t5],r5=(e,t)=>qae(e,t5,t),i5=e=>e&&e[t5]&&e[t5].getPayload(),a5=class{constructor(){r5(this,this)}getPayload(){return this.payload||[]}},o5=class e extends a5{constructor(e){super(),this._value=e,this.done=!0,this.durationProgress=0,K6.num(this._value)&&(this.lastPosition=this._value)}static create(t){return new e(t)}getPayload(){return[this]}getValue(){return this._value}setValue(e,t){return K6.num(e)&&(this.lastPosition=e,t&&(e=Math.round(e/t)*t,this.done&&(this.lastPosition=e))),this._value===e?!1:(this._value=e,!0)}reset(){let{done:e}=this;this.done=!1,K6.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,e&&(this.lastVelocity=null),this.v0=null)}},s5=class e extends o5{constructor(e){super(0),this._string=null,this._toString=w8({output:[e,e]})}static create(t){return new e(t)}getValue(){return this._string??=this._toString(this._value)}setValue(e){if(K6.str(e)){if(e==this._string)return!1;this._string=e,this._value=1}else if(super.setValue(e))this._string=null;else return!1;return!0}reset(e){e&&(this._toString=w8({output:[this.getValue(),e]})),this._value=0,super.reset()}},c5={dependencies:null},l5=class extends a5{constructor(e){super(),this.source=e,this.setValue(e)}getValue(e){let t={};return Y6(this.source,(n,r)=>{woe(n)?t[r]=n.getValue(e):N8(n)?t[r]=P8(n):e||(t[r]=n)}),t}setValue(e){this.source=e,this.payload=this._makePayload(e)}reset(){this.payload&&J6(this.payload,e=>e.reset())}_makePayload(e){if(e){let t=new Set;return Y6(e,this._addToPayload,t),Array.from(t)}}_addToPayload(e){c5.dependencies&&N8(e)&&c5.dependencies.add(e);let t=i5(e);t&&J6(t,e=>this.add(e))}},Toe=class e extends l5{constructor(e){super(e)}static create(t){return new e(t)}getValue(){return this.source.map(e=>e.getValue())}setValue(e){let t=this.getPayload();return e.length==t.length?t.map((t,n)=>t.setValue(e[n])).some(Boolean):(super.setValue(e.map(Eoe)),!0)}};function Eoe(e){return(X8(e)?s5:o5).create(e)}function u5(e){let t=n5(e);return t?t.constructor:K6.arr(e)?Toe:X8(e)?s5:o5}var d5=(e,t)=>{let n=!K6.fun(e)||e.prototype&&e.prototype.isReactComponent;return(0,L.forwardRef)((r,i)=>{let a=(0,L.useRef)(null),o=n&&(0,L.useCallback)(e=>{a.current=koe(i,e)},[i]),[s,c]=Ooe(r,t),l=Q8(),u=()=>{let e=a.current;n&&!e||(e?t.applyAnimatedValues(e,s.getValue(!0)):!1)===!1&&l()},d=new Doe(u,c),f=(0,L.useRef)(void 0);Z8(()=>(f.current=d,J6(c,e=>R8(e,d)),()=>{f.current&&(J6(f.current.deps,e=>z8(e,f.current)),O6.cancel(f.current.update))})),(0,L.useEffect)(u,[]),$8(()=>()=>{let e=f.current;J6(e.deps,t=>z8(t,e))});let p=t.getComponentProps(s.getValue());return L.createElement(e,{...p,ref:o})})},Doe=class{constructor(e,t){this.update=e,this.deps=t}eventObserved(e){e.type==`change`&&O6.write(this.update)}};function Ooe(e,t){let n=new Set;return c5.dependencies=n,e.style&&(e={...e,style:t.createAnimatedStyle(e.style)}),e=new l5(e),c5.dependencies=null,[e,n]}function koe(e,t){return e&&(K6.fun(e)?e(t):e.current=t),t}var f5=Symbol.for(`AnimatedComponent`),p5=new WeakMap,Aoe=(e,{applyAnimatedValues:t=()=>!1,createAnimatedStyle:n=e=>new l5(e),getComponentProps:r=e=>e}={})=>{let i={applyAnimatedValues:t,createAnimatedStyle:n,getComponentProps:r},a=e=>{let t=m5(e)||`Anonymous`;if(K6.str(e))e=a[e]||(a[e]=d5(e,i));else{let t=e[f5]??p5.get(e);if(!t){t=d5(e,i);try{e[f5]=t}catch{}p5.set(e,t)}e=t}return e.displayName=`Animated(${t})`,e};return Y6(e,(t,n)=>{K6.arr(e)&&(n=m5(t)),a[n]=a(t)}),{animated:a}},m5=e=>K6.str(e)?e:e&&K6.str(e.displayName)?e.displayName:K6.fun(e)&&e.name||null;function h5(e,...t){return K6.fun(e)?e(...t):e}var g5=(e,t)=>e===!0||!!(t&&e&&(K6.fun(e)?e(t):X6(e).includes(t))),_5=(e,t)=>K6.obj(e)?t&&e[t]:e,v5=(e,t)=>e.default===!0?e[t]:e.default?e.default[t]:void 0,joe=e=>e,y5=(e,t=joe)=>{let n=Moe;e.default&&e.default!==!0&&(e=e.default,n=Object.keys(e));let r={};for(let i of n){let n=t(e[i],i);K6.und(n)||(r[i]=n)}return r},Moe=[`config`,`onProps`,`onStart`,`onChange`,`onPause`,`onResume`,`onRest`],Noe={config:1,from:1,to:1,ref:1,loop:1,reset:1,pause:1,cancel:1,reverse:1,immediate:1,default:1,delay:1,onProps:1,onStart:1,onChange:1,onPause:1,onResume:1,onRest:1,onResolve:1,items:1,trail:1,sort:1,expires:1,initial:1,enter:1,update:1,leave:1,children:1,onDestroyed:1,keys:1,callId:1,parentId:1};function Poe(e){let t={},n=0;if(Y6(e,(e,r)=>{Noe[r]||(t[r]=e,n++)}),n)return t}function b5(e){let t=Poe(e);if(t){let n={to:t};return Y6(e,(e,r)=>r in t||(n[r]=e)),n}return{...e}}function x5(e){let t=P8(e);return K6.arr(t)?t.map(x5):X8(t)?e8.createStringInterpolator({range:[0,1],output:[t,t]})(1):t}function Foe(e){for(let t in e)return!0;return!1}function S5(e){return K6.fun(e)||K6.arr(e)&&K6.obj(e[0])}function Ioe(e,t){e.ref?.delete(e),t?.delete(e)}function Loe(e,t){t&&e.ref!==t&&(e.ref?.delete(e),t.add(e),e.ref=t)}var C5={...{default:{tension:170,friction:26},gentle:{tension:120,friction:14},wobbly:{tension:180,friction:12},stiff:{tension:210,friction:20},slow:{tension:280,friction:60},molasses:{tension:280,friction:120}}.default,mass:1,damping:1,easing:doe.linear,clamp:!1},Roe=class{constructor(){this.velocity=0,Object.assign(this,C5)}};function zoe(e,t,n){n&&(n={...n},w5(n,t),t={...n,...t}),w5(e,t),Object.assign(e,t);for(let t in C5)e[t]??(e[t]=C5[t]);let{frequency:r,damping:i}=e,{mass:a}=e;return K6.und(r)||(r<.01&&(r=.01),i<0&&(i=0),e.tension=(2*Math.PI/r)**2*a,e.friction=4*Math.PI*i*a/r),e}function w5(e,t){if(!K6.und(t.decay))e.duration=void 0;else{let n=!K6.und(t.tension)||!K6.und(t.friction);(n||!K6.und(t.frequency)||!K6.und(t.damping)||!K6.und(t.mass))&&(e.duration=void 0,e.decay=void 0),n&&(e.frequency=void 0)}}var T5=[],Boe=class{constructor(){this.changed=!1,this.values=T5,this.toValues=null,this.fromValues=T5,this.config=new Roe,this.immediate=!1}};function E5(e,{key:t,props:n,defaultProps:r,state:i,actions:a}){return new Promise((o,s)=>{let c,l,u=g5(n.cancel??r?.cancel,t);if(u)p();else{K6.und(n.pause)||(i.paused=g5(n.pause,t));let e=r?.pause;e!==!0&&(e=i.paused||g5(e,t)),c=h5(n.delay||0,t),e?(i.resumeQueue.add(f),a.pause()):(a.resume(),f())}function d(){i.resumeQueue.add(f),i.timeouts.delete(l),l.cancel(),c=l.time-O6.now()}function f(){c>0&&!e8.skipAnimation?(i.delayed=!0,l=O6.setTimeout(p,c),i.pauseQueue.add(d),i.timeouts.add(l)):p()}function p(){i.delayed&&=!1,i.pauseQueue.delete(d),i.timeouts.delete(l),e<=(i.cancelId||0)&&(u=!0);try{a.start({...n,callId:e,cancel:u},o)}catch(e){s(e)}}})}var D5=(e,t)=>t.length==1?t[0]:t.some(e=>e.cancelled)?A5(e.get()):t.every(e=>e.noop)?O5(e.get()):k5(e.get(),t.every(e=>e.finished)),O5=e=>({value:e,noop:!0,finished:!0,cancelled:!1}),k5=(e,t,n=!1)=>({value:e,finished:t,cancelled:n}),A5=e=>({value:e,cancelled:!0,finished:!1});function j5(e,t,n,r){let{callId:i,parentId:a,onRest:o}=t,{asyncTo:s,promise:c}=n;return!a&&e===s&&!t.reset?c:n.promise=(async()=>{n.asyncId=i,n.asyncTo=e;let l=y5(t,(e,t)=>t===`onRest`?void 0:e),u,d,f=new Promise((e,t)=>(u=e,d=t)),p=e=>{let t=i<=(n.cancelId||0)&&A5(r)||i!==n.asyncId&&k5(r,!1);if(t)throw e.result=t,d(e),e},m=0,h=(e,t)=>{let a=new N5,o=new P5;return(async()=>{p(a);let s=K6.obj(e)?{...e}:{...t,to:e};if(s.parentId=i,Y6(l,(e,t)=>{K6.und(s[t])&&(s[t]=e)}),e8.skipAnimation){if(++m>1024)throw M5(n),o.result=k5(r,!1),d(o),o;return s.immediate=!0,await r.start(s)}let c=await r.start(s);return p(a),n.paused&&await new Promise(e=>{n.resumeQueue.add(e)}),c})()},g;try{let t;t=K6.arr(e)?(async e=>{for(let t of e)await h(t)})(e):Promise.resolve(e(h,r.stop.bind(r))),await Promise.all([t.then(u),f]),g=k5(r.get(),!0,!1)}catch(e){if(e instanceof N5)g=e.result;else if(e instanceof P5)g=e.result;else throw e}finally{i==n.asyncId&&(n.asyncId=a,n.asyncTo=a?s:void 0,n.promise=a?c:void 0)}return K6.fun(o)&&O6.batchedUpdates(()=>{o(g,r,r.item)}),g})()}function M5(e,t){Z6(e.timeouts,e=>e.cancel()),e.pauseQueue.clear(),e.resumeQueue.clear(),e.asyncId=e.asyncTo=e.promise=void 0,t&&(e.cancelId=t)}var N5=class extends Error{constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise.")}},P5=class extends Error{constructor(){super(`SkipAnimationSignal`)}},F5=e=>e instanceof I5,Voe=1,I5=class extends L8{constructor(...e){super(...e),this.id=Voe++,this._priority=0}get priority(){return this._priority}set priority(e){this._priority!=e&&(this._priority=e,this._onPriorityChange(e))}get(){let e=n5(this);return e&&e.getValue()}to(...e){return e8.to(this,e)}interpolate(...e){return yoe(),e8.to(this,e)}toJSON(){return this.get()}observerAdded(e){e==1&&this._attach()}observerRemoved(e){e==0&&this._detach()}_attach(){}_detach(){}_onChange(e,t=!1){I8(this,{type:`change`,parent:this,value:e,idle:t})}_onPriorityChange(e){this.idle||u8.sort(this),I8(this,{type:`priority`,parent:this,priority:e})}},L5=Symbol.for(`SpringPhase`),Hoe=1,Uoe=2,R5=4,z5=e=>(e[L5]&Hoe)>0,B5=e=>(e[L5]&Uoe)>0,V5=e=>(e[L5]&R5)>0,H5=(e,t)=>t?e[L5]|=3:e[L5]&=-3,U5=(e,t)=>t?e[L5]|=R5:e[L5]&=-5,Woe=class extends I5{constructor(e,t){if(super(),this.animation=new Boe,this.defaultProps={},this._state={paused:!1,delayed:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._pendingCalls=new Set,this._lastCallId=0,this._lastToId=0,this._memoizedDuration=0,!K6.und(e)||!K6.und(t)){let n=K6.obj(e)?{...e}:{...t,from:e};K6.und(n.default)&&(n.default=!0),this.start(n)}}get idle(){return!(B5(this)||this._state.asyncTo)||V5(this)}get goal(){return P8(this.animation.to)}get velocity(){let e=n5(this);return e instanceof o5?e.lastVelocity||0:e.getPayload().map(e=>e.lastVelocity||0)}get hasAnimated(){return z5(this)}get isAnimating(){return B5(this)}get isPaused(){return V5(this)}get isDelayed(){return this._state.delayed}advance(e){let t=!0,n=!1,r=this.animation,{toValues:i}=r,{config:a}=r,o=i5(r.to);!o&&N8(r.to)&&(i=X6(P8(r.to))),r.values.forEach((s,c)=>{if(s.done)return;let l=s.constructor==s5?1:o?o[c].lastPosition:i[c],u=r.immediate,d=l;if(!u){if(d=s.lastPosition,a.tension<=0){s.done=!0;return}let t=s.elapsedTime+=e,n=r.fromValues[c],i=s.v0==null?s.v0=K6.arr(a.velocity)?a.velocity[c]:a.velocity:s.v0,o,f=a.precision||(n==l?.005:Math.max(Math.max(Math.abs(l),Math.abs(n),1)*2**-52,Math.min(1,Math.abs(l-n)*.001)));if(!K6.und(a.duration)){let r=1;a.duration>0&&(this._memoizedDuration!==a.duration&&(this._memoizedDuration=a.duration,s.durationProgress>0&&(s.elapsedTime=a.duration*s.durationProgress,t=s.elapsedTime+=e)),r=(a.progress||0)+t/this._memoizedDuration,r=r>1?1:r<0?0:r,s.durationProgress=r),d=n+a.easing(r)*(l-n),o=(d-s.lastPosition)/e,u=r==1}else if(a.decay){let e=a.decay===!0?.998:a.decay,r=Math.exp(-(1-e)*t);d=n+i/(1-e)*(1-r),u=Math.abs(s.lastPosition-d)<=f,o=i*r}else{o=s.lastVelocity==null?i:s.lastVelocity;let t=a.restVelocity||f/10,r=a.clamp?0:a.bounce,c=!K6.und(r),p=n==l?s.v0>0:n<l,m,h=!1,g=Math.ceil(e/1);for(let e=0;e<g&&(m=Math.abs(o)>t,!(!m&&(u=Math.abs(l-d)<=f,u)));++e){c&&(h=d==l||d>l==p,h&&(o=-o*r,d=l));let e=(-a.tension*1e-6*(d-l)+-a.friction*.001*o)/a.mass;o+=e*1,d+=o*1}}s.lastVelocity=o,Number.isNaN(d)&&(console.warn(`Got NaN while animating:`,this),u=!0)}o&&!o[c].done&&(u=!1),u?s.done=!0:t=!1,s.setValue(d,a.round)&&(n=!0)});let s=n5(this),c=s.getValue();if(t){let e=P8(r.to);(c!==e||n)&&!a.decay?(s.setValue(e),this._onChange(e)):n&&a.decay&&this._onChange(c),this._stop()}else n&&this._onChange(c)}set(e){return O6.batchedUpdates(()=>{this._stop(),this._focus(e),this._set(e)}),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(B5(this)){let{to:e,config:t}=this.animation;O6.batchedUpdates(()=>{this._onStart(),t.decay||this._set(e,!1),this._stop()})}return this}update(e){return(this.queue||=[]).push(e),this}start(e,t){let n;return K6.und(e)?(n=this.queue||[],this.queue=[]):n=[K6.obj(e)?e:{...t,to:e}],Promise.all(n.map(e=>this._update(e))).then(e=>D5(this,e))}stop(e){let{to:t}=this.animation;return K6.und(t)||this._focus(this.get()),M5(this._state,e&&this._lastCallId),O6.batchedUpdates(()=>this._stop(t,e)),this}reset(){this._update({reset:!0})}eventObserved(e){e.type==`change`?this._start():e.type==`priority`&&(this.priority=e.priority+1)}_prepareNode(e){let t=this.key||``,{to:n,from:r}=e;n=K6.obj(n)?n[t]:n,(n==null||S5(n))&&(n=void 0),r=K6.obj(r)?r[t]:r,r??=void 0;let i={to:n,from:r};return z5(this)||(e.reverse&&([n,r]=[r,n]),r=P8(r),K6.und(r)?n5(this)||this._set(n):this._set(r)),i}_update({...e},t){let{key:n,defaultProps:r}=this;e.default&&Object.assign(r,y5(e,(e,t)=>/^on/.test(t)?_5(e,n):e)),J5(this,e,`onProps`),Y5(this,`onProps`,e,this);let i=this._prepareNode(e);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");let a=this._state;return E5(++this._lastCallId,{key:n,props:e,defaultProps:r,state:a,actions:{pause:()=>{V5(this)||(U5(this,!0),Q6(a.pauseQueue),Y5(this,`onPause`,k5(this,W5(this,this.animation.to)),this))},resume:()=>{V5(this)&&(U5(this,!1),B5(this)&&this._resume(),Q6(a.resumeQueue),Y5(this,`onResume`,k5(this,W5(this,this.animation.to)),this))},start:this._merge.bind(this,i)}}).then(n=>{if(e.loop&&n.finished&&!(t&&n.noop)){let t=G5(e);if(t)return this._update(t,!0)}return n})}_merge(e,t,n){if(t.cancel)return this.stop(!0),n(A5(this));let r=!K6.und(e.to),i=!K6.und(e.from);if(r||i)if(t.callId>this._lastToId)this._lastToId=t.callId;else return n(A5(this));let{key:a,defaultProps:o,animation:s}=this,{to:c,from:l}=s,{to:u=c,from:d=l}=e;i&&!r&&(!t.default||K6.und(u))&&(u=d),t.reverse&&([u,d]=[d,u]);let f=!q6(d,l);f&&(s.from=d),d=P8(d);let p=!q6(u,c);p&&this._focus(u);let m=S5(t.to),{config:h}=s,{decay:g,velocity:_}=h;(r||i)&&!h.decay&&(h.velocity=0),t.config&&!m&&zoe(h,h5(t.config,a),t.config===o.config?void 0:h5(o.config,a));let v=n5(this);if(!v||K6.und(u))return n(k5(this,!0));let y=K6.und(t.reset)?i&&!t.default:!K6.und(d)&&g5(t.reset,a),b=y?d:this.get(),x=x5(u),S=K6.num(x)||K6.arr(x)||X8(x),C=!m&&(!S||g5(o.immediate||t.immediate,a));if(p){let e=u5(u);if(e!==v.constructor)if(C)v=this._set(x);else throw Error(`Cannot animate between ${v.constructor.name} and ${e.name}, as the "to" prop suggests`)}let w=v.constructor,T=N8(u),E=!1;if(!T){let e=y||!z5(this)&&f;(p||e)&&(E=q6(x5(b),x),T=!E),(!q6(s.immediate,C)&&!C||!q6(h.decay,g)||!q6(h.velocity,_))&&(T=!0)}if(E&&B5(this)&&(s.changed&&!y?T=!0:T||this._stop(c)),!m&&((T||N8(c))&&(s.values=v.getPayload(),s.toValues=N8(u)?null:w==s5?[1]:X6(x)),s.immediate!=C&&(s.immediate=C,!C&&!y&&this._set(c)),T)){let{onRest:e}=s;J6(Koe,e=>J5(this,t,e));let r=k5(this,W5(this,c));Q6(this._pendingCalls,r),this._pendingCalls.add(n),s.changed&&O6.batchedUpdates(()=>{s.changed=!y,e?.(r,this),y?h5(o.onRest,r):s.onStart?.(r,this)})}y&&this._set(b),m?n(j5(t.to,t,this._state,this)):T?this._start():B5(this)&&!p?this._pendingCalls.add(n):n(O5(b))}_focus(e){let t=this.animation;e!==t.to&&(F8(this)&&this._detach(),t.to=e,F8(this)&&this._attach())}_attach(){let e=0,{to:t}=this.animation;N8(t)&&(R8(t,this),F5(t)&&(e=t.priority+1)),this.priority=e}_detach(){let{to:e}=this.animation;N8(e)&&z8(e,this)}_set(e,t=!0){let n=P8(e);if(!K6.und(n)){let e=n5(this);if(!e||!q6(n,e.getValue())){let r=u5(n);!e||e.constructor!=r?r5(this,r.create(n)):e.setValue(n),e&&O6.batchedUpdates(()=>{this._onChange(n,t)})}}return n5(this)}_onStart(){let e=this.animation;e.changed||(e.changed=!0,Y5(this,`onStart`,k5(this,W5(this,e.to)),this))}_onChange(e,t){let n=k5(e,!1);t||(this._onStart(),h5(this.animation.onChange,n,this)),h5(this.defaultProps.onChange,n,this),super._onChange(e,t)}_start(){let e=this.animation;n5(this).reset(P8(e.to)),e.immediate||(e.fromValues=e.values.map(e=>e.lastPosition)),B5(this)||(H5(this,!0),V5(this)||this._resume())}_resume(){e8.skipAnimation?this.finish():u8.start(this)}_stop(e,t){if(B5(this)){H5(this,!1);let n=this.animation;J6(n.values,e=>{e.done=!0}),n.toValues&&(n.onChange=n.onPause=n.onResume=void 0),I8(this,{type:`idle`,parent:this});let r=t?A5(this.get()):k5(this.get(),W5(this,e??n.to));Q6(this._pendingCalls,r),n.changed=!1,Y5(this,`onRest`,r,this)}}};function W5(e,t){let n=x5(t);return q6(x5(e.get()),n)}function G5(e,t=e.loop,n=e.to){let r=h5(t);if(r){let i=r!==!0&&b5(r),a=(i||e).reverse,o=!i||i.reset;return K5({...e,loop:t,default:!1,pause:void 0,to:!a||S5(n)?n:void 0,from:o?e.from:void 0,reset:o,...i})}}function K5(e){let{to:t,from:n}=e=b5(e),r=new Set;return K6.obj(t)&&q5(t,r),K6.obj(n)&&q5(n,r),e.keys=r.size?Array.from(r):null,e}function Goe(e){let t=K5(e);return K6.und(t.default)&&(t.default=y5(t)),t}function q5(e,t){Y6(e,(e,n)=>e!=null&&t.add(n))}var Koe=[`onStart`,`onRest`,`onChange`,`onPause`,`onResume`];function J5(e,t,n){e.animation[n]=t[n]===v5(t,n)?void 0:_5(t[n],e.key)}function Y5(e,t,...n){e.animation[t]?.(...n),e.defaultProps[t]?.(...n)}var qoe=[`onStart`,`onChange`,`onRest`],Joe=1,Yoe=class{constructor(e,t){this.id=Joe++,this.springs={},this.queue=[],this._lastAsyncId=0,this._lastLoopId=0,this._active=new Set,this._changed=new Set,this._started=!1,this._state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._events={onStart:new Map,onChange:new Map,onRest:new Map},this._onFrame=this._onFrame.bind(this),t&&(this._flush=t),e&&this.start({default:!0,...e})}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every(e=>e.idle&&!e.isDelayed&&!e.isPaused)}get item(){return this._item}set item(e){this._item=e}get(){let e={};return this.each((t,n)=>e[n]=t.get()),e}set(e){for(let t in e){let n=e[t];K6.und(n)||this.springs[t].set(n)}}update(e){return e&&this.queue.push(K5(e)),this}start(e){let{queue:t}=this;return e?t=X6(e).map(K5):this.queue=[],this._flush?this._flush(this,t):(n7(this,t),X5(this,t))}stop(e,t){if(e!==!!e&&(t=e),t){let n=this.springs;J6(X6(t),t=>n[t].stop(!!e))}else M5(this._state,this._lastAsyncId),this.each(t=>t.stop(!!e));return this}pause(e){if(K6.und(e))this.start({pause:!0});else{let t=this.springs;J6(X6(e),e=>t[e].pause())}return this}resume(e){if(K6.und(e))this.start({pause:!1});else{let t=this.springs;J6(X6(e),e=>t[e].resume())}return this}each(e){Y6(this.springs,e)}onLoopReset(e){let t=this._onLoopReset??=new Set;return t.add(e),()=>{t.delete(e)}}_onFrame(){let{onStart:e,onChange:t,onRest:n}=this._events,r=this._active.size>0,i=this._changed.size>0;(r&&!this._started||i&&!this._started)&&(this._started=!0,Z6(e,([e,t])=>{t.value=this.get(),e(t,this,this._item)}));let a=!r&&this._started,o=i||a&&n.size?this.get():null;i&&t.size&&Z6(t,([e,t])=>{t.value=o,e(t,this,this._item)}),a&&(this._started=!1,Z6(n,([e,t])=>{t.value=o,e(t,this,this._item)}))}eventObserved(e){if(e.type==`change`)this._changed.add(e.parent),e.idle||this._active.add(e.parent);else if(e.type==`idle`)this._active.delete(e.parent);else return;O6.onFrame(this._onFrame)}};function X5(e,t){return Promise.all(t.map(t=>Z5(e,t))).then(t=>D5(e,t))}async function Z5(e,t,n){let{keys:r,to:i,from:a,loop:o,onRest:s,onResolve:c}=t,l=K6.obj(t.default)&&t.default;o&&(t.loop=!1);let u=t,d=!n&&!u.parentId&&`loop`in t?++e._lastLoopId:n?u.loopId:e._lastLoopId;i===!1&&(t.to=null),a===!1&&(t.from=null);let f=K6.arr(i)||K6.fun(i)?i:void 0;f?(t.to=void 0,t.onRest=void 0,l&&(l.onRest=void 0)):J6(qoe,n=>{let r=t[n];if(K6.fun(r)){let i=e._events[n];t[n]=(({finished:e,cancelled:t})=>{let n=i.get(r);n?(e||(n.finished=!1),t&&(n.cancelled=!0)):i.set(r,{value:null,finished:e||!1,cancelled:t||!1})}),l&&(l[n]=t[n])}});let p=e._state;t.pause===!p.paused?(p.paused=t.pause,Q6(t.pause?p.pauseQueue:p.resumeQueue)):p.paused&&(t.pause=!0);let m=(r||Object.keys(e.springs)).map(n=>e.springs[n].start(t)),h=t.cancel===!0||v5(t,`cancel`)===!0;(f||h&&p.asyncId)&&m.push(E5(++e._lastAsyncId,{props:t,state:p,actions:{pause:G6,resume:G6,start(t,n){h?(M5(p,e._lastAsyncId),n(A5(e))):(t.onRest=s,n(j5(f,t,p,e)))}}})),p.paused&&await new Promise(e=>{p.resumeQueue.add(e)});let g=D5(e,await Promise.all(m));if(o&&g.finished&&!(n&&g.noop)&&d===e._lastLoopId){let n=G5(t,o,i);if(n)return n.loopId=d,e._onLoopReset?.forEach(e=>e()),n7(e,[n]),Z5(e,n,!0)}return c&&O6.batchedUpdates(()=>c(g,e,e.item)),g}function Q5(e,t){let n={...e.springs};return t&&J6(X6(t),e=>{K6.und(e.keys)&&(e=K5(e)),K6.obj(e.to)||(e={...e,to:void 0}),t7(n,e,e=>e7(e))}),$5(e,n),n}function $5(e,t){Y6(t,(t,n)=>{e.springs[n]||(e.springs[n]=t,R8(t,e))})}function e7(e,t){let n=new Woe;return n.key=e,t&&R8(n,t),n}function t7(e,t,n){t.keys&&J6(t.keys,r=>{(e[r]||(e[r]=n(r)))._prepareNode(t)})}function n7(e,t){J6(t,t=>{t7(e.springs,t,t=>e7(t,e))})}var Xoe=L.createContext({pause:!1,immediate:!1}),Zoe=()=>{let e=[],t=function(t){xoe();let r=[];return J6(e,(e,i)=>{if(K6.und(t))r.push(e.start());else{let a=n(t,e,i);a&&r.push(e.start(a))}}),r};t.current=e,t.add=function(t){e.includes(t)||e.push(t)},t.delete=function(t){let n=e.indexOf(t);~n&&e.splice(n,1)},t.pause=function(){return J6(e,e=>e.pause(...arguments)),this},t.resume=function(){return J6(e,e=>e.resume(...arguments)),this},t.set=function(t){J6(e,(e,n)=>{let r=K6.fun(t)?t(n,e):t;r&&e.set(r)})},t.start=function(t){let n=[];return J6(e,(e,r)=>{if(K6.und(t))n.push(e.start());else{let i=this._getProps(t,e,r);i&&n.push(e.start(i))}}),n},t.stop=function(){return J6(e,e=>e.stop(...arguments)),this},t.update=function(t){return J6(e,(e,n)=>e.update(this._getProps(t,e,n))),this};let n=function(e,t,n){return K6.fun(e)?e(n,t):e};return t._getProps=n,t};function r7(e,t,n){let r=K6.fun(t)&&t;r&&!n&&(n=[]);let i=(0,L.useMemo)(()=>r||arguments.length==3?Zoe():void 0,[]),a=(0,L.useRef)(0),o=Q8(),s=(0,L.useMemo)(()=>({ctrls:[],queue:[],flush(e,t){let n=Q5(e,t);return a.current>0&&!s.queue.length&&!Object.keys(n).some(t=>!e.springs[t])?X5(e,t):new Promise(r=>{$5(e,n),s.queue.push(()=>{r(X5(e,t))}),o()})}}),[]),c=(0,L.useRef)([...s.ctrls]),l=(0,L.useRef)([]),u=(0,L.useRef)([]);u.current=[];let d=e5(e)||0;(0,L.useMemo)(()=>{J6(c.current.slice(e,d),e=>{Ioe(e,i),e.stop(!0)}),c.current.length=e,f(d,e)},[e]),(0,L.useMemo)(()=>{f(0,Math.min(d,e))},n);function f(e,n){for(let i=e;i<n;i++){let e=c.current[i]||(c.current[i]=new Yoe(null,s.flush)),n=r?r(i,e):t[i];n&&(l.current[i]=Goe(n))}}let p=c.current.map((e,t)=>Q5(e,l.current[t])),m=(0,L.useContext)(Xoe),h=m!==e5(m)&&Foe(m);Z8(()=>{a.current++,s.ctrls=c.current;let{queue:e}=s;e.length&&(s.queue=[],J6(e,e=>e()));let t=l.current.length>0?l.current:u.current;J6(c.current,(e,n)=>{i?.add(e),h&&e.start({default:m});let r=t[n];r&&(Loe(e,r.ref),e.ref?e.queue.push({...r,default:K6.obj(r.default)?{...r.default}:r.default}):e.start(r))}),l.current.length>0&&(u.current=l.current),l.current=[]}),$8(()=>()=>{J6(s.ctrls,e=>e.stop(!0))});let g=p.map(e=>({...e}));return i?[g,i]:g}function i7(e,t){let n=K6.fun(e),[[r],i]=r7(1,n?e:[e],n?t||[]:t);return n||arguments.length==2?[r,i]:r}var Qoe=class extends I5{constructor(e,t){super(),this.source=e,this.idle=!0,this._active=new Set,this.calc=w8(...t);let n=this._get(),r=u5(n);r5(this,r.create(n))}advance(e){let t=this._get();q6(t,this.get())||(n5(this).setValue(t),this._onChange(t,this.idle)),!this.idle&&a7(this._active)&&o7(this)}_get(){let e=K6.arr(this.source)?this.source.map(P8):X6(P8(this.source));return this.calc(...e)}_start(){this.idle&&!a7(this._active)&&(this.idle=!1,J6(i5(this),e=>{e.done=!1}),e8.skipAnimation?(O6.batchedUpdates(()=>this.advance()),o7(this)):u8.start(this))}_attach(){let e=1;J6(X6(this.source),t=>{N8(t)&&R8(t,this),F5(t)&&(t.idle||this._active.add(t),e=Math.max(e,t.priority+1))}),this.priority=e,this._start()}_detach(){J6(X6(this.source),e=>{N8(e)&&z8(e,this)}),this._active.clear(),o7(this)}eventObserved(e){e.type==`change`?e.idle?this.advance():(this._active.add(e.parent),this._start()):e.type==`idle`?this._active.delete(e.parent):e.type==`priority`&&(this.priority=X6(this.source).reduce((e,t)=>Math.max(e,(F5(t)?t.priority:0)+1),0))}};function $oe(e){return e.idle!==!1}function a7(e){return!e.size||Array.from(e).every($oe)}function o7(e){e.idle||(e.idle=!0,J6(i5(e),e=>{e.done=!0}),I8(e,{type:`idle`,parent:e}))}e8.assign({createStringInterpolator:q8,to:(e,t)=>new Qoe(e,t)}),u8.advance;var s7=/^--/;function ese(e,t){return t==null||typeof t==`boolean`||t===``?``:typeof t==`number`&&t!==0&&!s7.test(e)&&!(l7.hasOwnProperty(e)&&l7[e])?t+`px`:(``+t).trim()}var c7={};function tse(e,t){if(!e.nodeType||!e.setAttribute||!e.removeAttribute)return!1;let n=e.nodeName===`filter`||e.parentNode&&e.parentNode.nodeName===`filter`,{className:r,style:i,children:a,scrollTop:o,scrollLeft:s,viewBox:c,...l}=t,u=Object.values(l),d=Object.keys(l).map(t=>n||e.hasAttribute(t)?t:c7[t]||(c7[t]=t.replace(/([A-Z])/g,e=>`-`+e.toLowerCase())));t.hasOwnProperty(`children`)&&(e.textContent=a);for(let t in i)if(i.hasOwnProperty(t)){let n=ese(t,i[t]);s7.test(t)?e.style.setProperty(t,n):e.style[t]=n}d.forEach((t,n)=>{let r=u[n];r===void 0?e.removeAttribute(t):e.setAttribute(t,r)}),t.hasOwnProperty(`className`)&&(r===void 0?e.removeAttribute(`class`):e.className=r),o!==void 0&&(e.scrollTop=o),s!==void 0&&(e.scrollLeft=s),t.hasOwnProperty(`viewBox`)&&(c===void 0?e.removeAttribute(`viewBox`):e.setAttribute(`viewBox`,c))}var l7={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},nse=(e,t)=>e+t.charAt(0).toUpperCase()+t.substring(1),rse=[`Webkit`,`Ms`,`Moz`,`O`];l7=Object.keys(l7).reduce((e,t)=>(rse.forEach(n=>e[nse(n,t)]=e[t]),e),l7);var ise=/^(matrix3d|matrix|translate3d|translate[XYZ]?|scale3d|scale[XYZ]?|rotate3d|rotate[XYZ]?|skew[XY]?)$/,ase=/^(translate)/,ose=/^(rotate|skew)/,u7=(e,t)=>K6.num(e)&&e!==0?e+t:e,d7=(e,t)=>K6.arr(e)?e.every(e=>d7(e,t)):K6.num(e)?e===t:parseFloat(e)===t,sse=class extends l5{constructor({x:e,y:t,z:n,...r}){let i=[],a=[];(e||t||n)&&(i.push([e||0,t||0,n||0]),a.push(e=>[`translate3d(${e.map(e=>u7(e,`px`)).join(`,`)})`,d7(e,0)])),Y6(r,(e,t)=>{if(t===`transform`)i.push([e||``]),a.push(e=>[e,e===``]);else if(ise.test(t)){if(delete r[t],K6.und(e))return;let n=ase.test(t)?`px`:ose.test(t)?`deg`:``;i.push(X6(e)),a.push(t===`rotate3d`?([e,t,r,i])=>[`rotate3d(${e},${t},${r},${u7(i,n)})`,d7(i,0)]:e=>[`${t}(${e.map(e=>u7(e,n)).join(`,`)})`,d7(e,+!!t.startsWith(`scale`))])}}),i.length&&(r.transform=new cse(i,a)),super(r)}},cse=class extends L8{constructor(e,t){super(),this.inputs=e,this.transforms=t,this._value=null}get(){return this._value||=this._get()}_get(){let e=``,t=!0;return J6(this.inputs,(n,r)=>{let i=P8(n[0]),[a,o]=this.transforms[r](K6.arr(i)?i:n.map(P8));e+=` `+a,t&&=o}),t?`none`:e}observerAdded(e){e==1&&J6(this.inputs,e=>J6(e,e=>N8(e)&&R8(e,this)))}observerRemoved(e){e==0&&J6(this.inputs,e=>J6(e,e=>N8(e)&&z8(e,this)))}eventObserved(e){e.type==`change`&&(this._value=null),I8(this,e)}},lse=`a.abbr.address.area.article.aside.audio.b.base.bdi.bdo.big.blockquote.body.br.button.canvas.caption.cite.code.col.colgroup.data.datalist.dd.del.details.dfn.dialog.div.dl.dt.em.embed.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.iframe.img.input.ins.kbd.keygen.label.legend.li.link.main.map.mark.menu.menuitem.meta.meter.nav.noscript.object.ol.optgroup.option.output.p.param.picture.pre.progress.q.rp.rt.ruby.s.samp.script.section.select.small.source.span.strong.style.sub.summary.sup.table.tbody.td.textarea.tfoot.th.thead.time.title.tr.track.u.ul.var.video.wbr.circle.clipPath.defs.ellipse.foreignObject.g.image.line.linearGradient.mask.path.pattern.polygon.polyline.radialGradient.rect.stop.svg.text.tspan`.split(`.`);e8.assign({batchedUpdates:$g.unstable_batchedUpdates,createStringInterpolator:q8,colors:Qae});var f7=Aoe(lse,{applyAnimatedValues:tse,createAnimatedStyle:e=>new sse(e),getComponentProps:({scrollTop:e,scrollLeft:t,...n})=>n}).animated;function use({points:e,stats:t,partCntPerPoint:n}){return{series:(0,L.useMemo)(()=>Q.of(e).toSortedArray(([e])=>e).map(([t,n],r)=>({name:t,color:v6(r,e.size),points:n??[]})),[e]),median:(0,L.useMemo)(()=>t?{low:(n??1)*(t.medianMinutesForSingleMat-t.MAD_belowMinutes),high:(n??1)*(t.medianMinutesForSingleMat+t.MAD_aboveMinutes)}:null,[t,n])}}var p7=50,dse=30,m7=10,fse=2;function pse({points:e,yZoom:t,default_date_range:n,current_date_zoom:r,containerWidth:i,containerHeight:a}){let o=i===0?400:i,s=a===0?400:a,c=o-p7-fse,l=s-m7-dse,u=(0,L.useMemo)(()=>r?iF().domain([r.start,r.end]).range([0,c]):iF().domain([n[0],n[1]]).range([0,c]),[r,n,c]),d=(0,L.useMemo)(()=>{if(e.size===0)return 60;let t=Q.of(e).flatMap(([,e])=>e.map(e=>e.y)).maxBy(e=>e)??1;return Math.ceil(t/5)*5},[e]);return{height:s,width:o,xScale:u,yScale:(0,L.useMemo)(()=>t?VM().domain([t.y_low,t.y_high]).range([l,0]):VM().domain([0,d]).range([l,0]),[l,t,d])}}var mse=(0,L.memo)(function({xScale:e,yScale:t}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(DA,{scale:e,top:t.range()[0]}),(0,H.jsx)(OA,{scale:t,left:e.range()[0],label:`Minutes`}),(0,H.jsx)(wA,{width:e.range()[1]-e.range()[0],height:t.range()[0]-t.range()[1],xScale:e,yScale:t})]})}),h7=(0,L.memo)(function(e){let[t,n]=(0,L.useState)(),[r,i]=(0,L.useState)(),[a,o]=(0,L.useState)(!1);function s(){o(!1),n(void 0),i(void 0)}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Um,{size:`small`,onClick:()=>o(!0),children:(0,H.jsx)(OT,{fontSize:`inherit`})}),(0,H.jsxs)(cy,{open:a,onClose:s,children:[(0,H.jsxs)(uy,{children:[(0,H.jsx)(`div`,{style:{marginBottom:`1em`},children:(0,H.jsx)(Kw,{type:`number`,label:`Y Low`,value:t===void 0?e.yZoom?.y_low??``:isNaN(t)?``:t,onChange:e=>n(parseFloat(e.target.value)),onBlur:()=>{t&&e.setZoom(e=>e?{...e,y_low:t}:{y_low:t,y_high:60})}})}),(0,H.jsx)(`div`,{style:{marginBottom:`1em`},children:(0,H.jsx)(Kw,{type:`number`,label:`Y High`,value:r===void 0?e.yZoom?.y_high??``:isNaN(r)?``:r,onChange:e=>i(parseFloat(e.target.value)),onBlur:()=>{r&&e.setZoom(e=>e?{...e,y_high:r}:{y_low:0,y_high:r})}})})]}),(0,H.jsx)(ly,{children:(0,H.jsx)(Y,{onClick:s,children:`Close`})})]})]})}),hse=(0,L.memo)(function({median:e,plannedMinutes:t,xScale:n,yScale:r}){let i=i7({to:{x:n.range()[0],y:e?r(e.high):r.range()[0],width:n.range()[1]-n.range()[0],height:e?r(e.low)-r(e.high):0},from:{x:n.range()[0],y:r.range()[0],width:n.range()[1]-n.range()[0],height:0}}),a=i7({to:{y:t?r(t):r.range()[0]},from:{y:r.range()[0]}});return(0,H.jsxs)(`g`,{children:[e?(0,H.jsx)(f7.rect,{x:i.x,y:i.y,width:i.width,height:i.height,fill:Lr[700],opacity:.2,pointerEvents:`none`}):void 0,t?(0,H.jsx)(f7.line,{stroke:`black`,x1:n.range()[0],x2:n.range()[1],y1:a.y,y2:a.y}):void 0]})}),gse=(0,L.memo)(function({seriesName:e,points:t,color:n,xScale:r,yScale:i,showTooltip:a}){let o=(0,L.useCallback)(n=>{let r=rA(n);if(r===null)return;let i=n.currentTarget.dataset.idx;i!==void 0&&a({left:r.x,top:r.y,pt:t[parseInt(i)],seriesName:e})},[a,t,e]);return(0,H.jsx)(`g`,{children:r7(t.length,t.map(e=>({from:{x:r(e.x),y:i.range()[0]+15},to:{x:r(e.x),y:i(e.y)}}))).map((e,t)=>(0,H.jsx)(f7.circle,{className:`bms-cycle-chart-pt`,fill:n,r:5,cx:e.x,cy:e.y,"data-idx":t,onClick:o},t))})}),_se=(0,L.memo)(function({series:e,xScale:t,yScale:n,showTooltip:r,disabledSeries:i}){return(0,H.jsx)(`g`,{children:e.filter(e=>!i.has(e.name)).map(e=>(0,H.jsx)(gse,{points:e.points,seriesName:e.name,color:e.color,xScale:t,yScale:n,showTooltip:r},e.name))})}),vse=(0,L.memo)(function({series:e,disabledSeries:t,adjustDisabled:n}){return(0,H.jsx)(`div`,{style:{marginTop:`1em`,display:`flex`,flexWrap:`wrap`,justifyContent:`space-around`},children:e.map(e=>(0,H.jsx)(qw,{selected:!t.has(e.name),value:e,onChange:()=>n(t=>t.has(e.name)?t.delete(e.name):t.add(e.name)),children:(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(`div`,{style:{width:`14px`,height:`14px`,backgroundColor:e.color}}),(0,H.jsx)(`div`,{style:{marginLeft:`1em`},children:e.name})]})},e.name))})}),yse=G(`g`,{shouldForwardProp:e=>e.toString()[0]!==`$`})(({$noPtrEvents:e})=>e?{"& .bms-cycle-chart-pt":{pointerevents:`none`}}:void 0),bse=(0,L.memo)(function({setYZoom:e,setXZoom:t,setTooltip:n,xScale:r,yScale:i,highlightStart:a,setHighlightStart:o}){let[s,c]=(0,L.useState)(null),l=(0,L.useCallback)(e=>{let t=rA(e);t!==null&&(c(null),o({x:t.x-p7,y:t.y-m7,nowMS:Date.now()}),n(null))},[o,n]),u=(0,L.useCallback)(e=>{let t=rA(e);t!==null&&c({x:t.x-p7,y:t.y-m7})},[c]),d=(0,L.useCallback)(n=>{if(a!==null){if(Date.now()-a.nowMS>500){let o=rA(n);if(o!==null){let n=r.invert(a.x),s=r.invert(o.x-p7),c=i.invert(a.y),l=i.invert(o.y-m7);e(c<l?{y_low:c,y_high:l}:{y_low:l,y_high:c}),t?.({zoom:n.getTime()<s.getTime()?{start:n,end:s}:{start:s,end:n}})}}o(null),c(null)}},[a,o,c,t,e,r,i]);return(0,H.jsxs)(`g`,{children:[(0,H.jsx)(`rect`,{x:0,y:0,width:r.range()[1],height:i.range()[0],fill:`transparent`,onPointerDown:l,onPointerMove:a===null?void 0:u,onPointerUp:a===null?void 0:d}),a!==null&&s!==null?(0,H.jsx)(`rect`,{x:Math.min(a.x,s.x),y:Math.min(a.y,s.y),width:Math.abs(a.x-s.x),height:Math.abs(a.y-s.y),color:`red`,pointerEvents:`none`,opacity:.3}):void 0]})}),xse=(0,L.memo)(function({set_date_zoom_range:e,current_date_zoom:t,yZoom:n,setYZoom:r,median:i}){return(0,H.jsxs)(`div`,{children:[e&&(t||n)?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Y,{size:`small`,onClick:()=>{e?.({zoom:void 0}),r(null)},children:`Reset Zoom`}),(0,H.jsx)(h7,{yZoom:n,setZoom:r})]}):void 0,e&&!t&&!n?(0,H.jsxs)(`span`,{style:{color:`#6b6b76`},children:[`Zoom via mouse drag`,i?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{children:` or `}),(0,H.jsx)(Y,{size:`small`,onClick:()=>{let e=i.high,t=i.low,n=.2*(e-t);r({y_low:t-n,y_high:e+n})},children:`Zoom To Inliers`})]}):void 0,(0,H.jsx)(h7,{yZoom:n,setZoom:r})]}):void 0]})}),Sse=(0,L.memo)(function({tooltip:e,extraTooltip:t,seriesLabel:n}){return e===null?null:(0,H.jsxs)(RC,{direction:`column`,spacing:.6,children:[(0,H.jsxs)(`div`,{children:[`Time:`,` `,e.pt.x.toLocaleString(void 0,{month:`short`,day:`numeric`,year:`numeric`,hour:`numeric`,minute:`2-digit`})]}),(0,H.jsxs)(`div`,{children:[n,`: `,e.seriesName]}),(0,H.jsxs)(`div`,{children:[`Cycle Time: `,e.pt.y.toFixed(1),` minutes`]}),t?t(e.pt).map((e,t)=>(0,H.jsxs)(`div`,{children:[e.title,`:`,` `,e.link?(0,H.jsx)(`a`,{style:{color:`white`,pointerEvents:`auto`,cursor:`pointer`,borderBottom:`1px solid`},onClick:e.link,children:e.value}):(0,H.jsx)(`span`,{children:`e.value`})]},t)):void 0]})});function Cse(e){let{width:t,height:n,xScale:r,yScale:i}=pse({points:e.points,yZoom:e.yZoom,setYZoom:e.setYZoom,default_date_range:e.default_date_range,current_date_zoom:e.current_date_zoom,set_date_zoom_range:e.set_date_zoom_range,containerWidth:e.containerWidth,containerHeight:e.containerHeight});return(0,H.jsx)(`svg`,{width:t,height:n,children:(0,H.jsxs)(`g`,{transform:`translate(${p7}, ${m7})`,children:[(0,H.jsx)(mse,{xScale:r,yScale:i}),(0,H.jsx)(hse,{median:e.median,plannedMinutes:e.plannedTimeMinutes,xScale:r,yScale:i}),(0,H.jsx)(bse,{setYZoom:e.setYZoom,setXZoom:e.set_date_zoom_range,xScale:r,setTooltip:e.showTooltip,yScale:i,highlightStart:e.highlightStart,setHighlightStart:e.setHighlightStart}),(0,H.jsx)(yse,{$noPtrEvents:e.highlightStart!==null,children:(0,H.jsx)(_se,{series:e.series,disabledSeries:e.disabledSeries,xScale:r,yScale:i,showTooltip:e.showTooltip})})]})})}var g7=(0,L.memo)(function(e){let t=(0,L.useMemo)(()=>P(null),[]),n=z(t),[r,i]=(0,L.useState)(YD.empty()),[a,o]=(0,L.useState)(null),{series:s,median:c}=use({points:e.points,stats:e.stats,partCntPerPoint:e.partCntPerPoint});return(0,H.jsxs)(`div`,{onPointerLeave:(0,L.useCallback)(()=>{n(null),o(null)},[n,o]),children:[(0,H.jsx)(gA,{sx:{height:{xs:`calc(100vh - 320px)`,md:`calc(100vh - 280px)`,xl:`calc(100vh - 220px)`}},tooltipAtom:t,TooltipContent:({tooltip:t})=>(0,H.jsx)(Sse,{tooltip:t,seriesLabel:e.series_label,extraTooltip:e.extra_tooltip}),chart:({width:t,height:i})=>(0,H.jsx)(Cse,{...e,containerHeight:i,containerWidth:t,series:s,median:c,yZoom:e.yZoom,setYZoom:e.setYZoom,highlightStart:a,setHighlightStart:o,showTooltip:n,disabledSeries:r})}),(0,H.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`},children:[(0,H.jsx)(`div`,{style:{color:`#6b6b76`},children:`Click on a point for details`}),(0,H.jsx)(`div`,{style:{flexGrow:1}}),(0,H.jsx)(xse,{set_date_zoom_range:e.set_date_zoom_range,current_date_zoom:e.current_date_zoom,yZoom:e.yZoom,setYZoom:e.setYZoom,median:c})]}),(0,H.jsx)(vse,{series:s,disabledSeries:r,adjustDisabled:i})]})});function wse(e){return`operations`in e&&(e.operations===void 0||Array.isArray(e.operations))}var Tse=P(!0),Ese=P(!0),Dse=P(void 0),Ose=P(void 0),kse=P(void 0),Ase=P(`Any`),jse=P(void 0),Mse=P(void 0),Nse=P({}),Pse=P({}),Fse=P(null),Ise=P(null);function _7({ty:e}){JI(e===`labor`?`L/U Cycles`:`Machine Cycles`);let t=z(SI),n=(0,L.useCallback)(function(e){if(!wse(e))return[];let n=[];if(e.operations)for(let r of e.operations)n.push({title:(r.mat.serial?r.mat.serial:`Material`)+` `+r.operation,value:`Open Card`,link:()=>t({type:`LogMat`,logMat:r.mat})});else if(`material`in e&&Array.isArray(e.material))for(let r of e.material)n.push({title:r.serial?r.serial:`Material`,value:`Open Card`,link:()=>t({type:`LogMat`,logMat:r})});return n},[t]),[r,i]=B(e===`labor`?Tse:Ese),[a,o]=B(e===`labor`?Nse:Pse),[s,c]=B(e===`labor`?Dse:Ose),[l,u]=B(kse),[d,f]=B(Ase),[p,m]=B(e===`labor`?jse:Mse),[h,g]=B(e===`labor`?Fse:Ise),_=R(br),v=ok(_.basketName),y=R(dk),b=jk(d,e!==`labor`||y),x=R(UO),S=[LT(cE(),-4),LT(cE(),1)],C=R(uk),w=R(fL),T=(0,L.useMemo)(()=>{let t=cE();return l?Ik(C.valuesToLazySeq(),{zoom:{start:LT(t,-4),end:LT(t,1)},partAndProc:s,pallet:p,operation:l,carrierKind:b}):e===`labor`&&r?Lk(C.valuesToLazySeq(),{zoom:{start:LT(t,-4),end:LT(t,1)},partAndProc:s,pallet:p,carrierKind:b}):Ik(C.valuesToLazySeq(),{zoom:{start:LT(t,-4),end:LT(t,1)},partAndProc:s,pallet:p,station:e===`labor`?Pk:Nk,carrierKind:b})},[C,e,s,p,l,r,b]),E=s?l??(T.allMachineOperations.length===1?T.allMachineOperations[0]:void 0):void 0,D=(0,L.useMemo)(()=>{if(E&&e===`machine`)return Rk(T,!1)},[T,e,E]);return(0,H.jsxs)(J,{sx:{paddingLeft:`24px`,paddingRight:`24px`,paddingTop:`10px`},children:[(0,H.jsxs)(J,{component:`nav`,sx:{display:`flex`,minHeight:`2.5em`,alignItems:`center`,maxWidth:`calc(100vw - 24px - 24px)`},children:[(0,H.jsxs)(q,{variant:`subtitle1`,children:[`Recent `,e===`labor`?`Load/Unload Occupancy`:`Machine Cycles`]}),(0,H.jsx)(J,{sx:{flexGrow:1}}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{name:`Station-Cycles-chart-or-table-select`,autoWidth:!0,value:r?`graph`:`table`,onChange:e=>i(e.target.value===`graph`),children:[(0,H.jsx)(Hx,{value:`graph`,children:`Graph`},`graph`),(0,H.jsx)(Hx,{value:`table`,children:`Table`},`table`)]})}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,displayEmpty:!0,value:s?T.allPartAndProcNames.findIndex(e=>s.part===e.part&&s.proc===e.proc):-1,style:{marginLeft:`1em`},onChange:e=>{c(e.target.value===-1?void 0:T.allPartAndProcNames[e.target.value]),u(void 0)},children:[(0,H.jsx)(Hx,{value:-1,children:(0,H.jsx)(`em`,{children:`Any Part`})},0),T.allPartAndProcNames.map((e,t)=>(0,H.jsx)(Hx,{value:t,children:(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(ZU,{part:e.part,size:20}),(0,H.jsxs)(`span`,{style:{marginRight:`1em`},children:[e.part,`-`,e.proc]})]})},t))]})}),e===`machine`?(0,H.jsx)(_y,{size:`small`,children:(0,H.jsx)(YS,{name:`Station-Cycles-cycle-chart-station-select`,autoWidth:!0,displayEmpty:!0,value:E?T.allMachineOperations.findIndex(e=>E.compare(e)===0):-1,style:{marginLeft:`1em`},onChange:e=>u(T.allMachineOperations[e.target.value]),children:[...T.allMachineOperations.length===1?[]:[(0,H.jsx)(Hx,{value:-1,children:(0,H.jsx)(`em`,{children:`Any Operation`})},-1)],...T.allMachineOperations.map((e,t)=>(0,H.jsxs)(Hx,{value:t,children:[e.statGroup,` `,e.operation]},t))]})}):void 0,e===`labor`&&y?(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,displayEmpty:!0,value:b,style:{marginLeft:`1em`},onChange:e=>{let t=e.target.value;f(t),t===`Basket`&&m(void 0)},children:[(0,H.jsx)(Hx,{value:`Any`,children:(0,H.jsx)(`em`,{children:`Any Carrier`})}),(0,H.jsx)(Hx,{value:`Pallet`,children:`Pallet`}),(0,H.jsx)(Hx,{value:`Basket`,children:v})]})}):void 0,e!==`labor`||b!==`Basket`?(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{name:`Station-Cycles-cycle-chart-station-pallet`,autoWidth:!0,displayEmpty:!0,value:p||``,style:{marginLeft:`1em`},onChange:e=>m(e.target.value===``?void 0:e.target.value),children:[(0,H.jsx)(Hx,{value:``,children:(0,H.jsx)(`em`,{children:`Any Pallet`})},0),T.allPalletNames.map(e=>(0,H.jsx)(Hx,{value:e,children:(0,H.jsx)(`div`,{style:{display:`flex`,alignItems:`center`},children:(0,H.jsx)(`span`,{style:{marginRight:`1em`},children:e})})},e))]})}):void 0,(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{onClick:()=>Hk(T,w.matsById,void 0,e===`labor`,_.loadStationNames,v),style:{height:`25px`,paddingTop:0,paddingBottom:0},size:`large`,children:(0,H.jsx)(uT,{})})})]}),(0,H.jsx)(`main`,{children:r?(0,H.jsx)(g7,{points:T.data,series_label:T.seriesLabel,default_date_range:S,extra_tooltip:n,current_date_zoom:a.zoom,set_date_zoom_range:o,yZoom:h,setYZoom:g,stats:E&&e===`machine`?x.get(E):void 0,partCntPerPoint:E?Q.of(T.data).head()?.[1]?.[0]?.material?.length:void 0,plannedTimeMinutes:D}):(0,H.jsx)(o6,{points:T.data,matsById:w.matsById,period:{type:`Last30`},current_date_zoom:void 0,set_date_zoom_range:void 0,showWorkorderAndInspect:!0,hideMedian:e===`labor`})})]})}var Lse=Q.ofRange(0,12,1).map(e=>new Date(2019,e,1)).chunk(3).toRArray(),Rse=(0,L.memo)(function(e){let[t,n]=(0,L.useState)(!1),[r,i]=(0,L.useState)(void 0);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ky,{type:`text`,value:(r||e.curMonth).toLocaleDateString(void 0,{month:`long`,year:`numeric`}),readOnly:!0,endAdornment:(0,H.jsx)(Iy,{position:`end`,children:(0,H.jsx)(Um,{"aria-label":`Open month select`,"data-testid":`open-month-select`,onClick:()=>{i(oE(e.curMonth)),n(!0)},size:`large`,children:(0,H.jsx)(lre,{})})})}),(0,H.jsx)(cy,{open:t,onClose:()=>{n(!1),i(void 0)},children:(0,H.jsxs)(uy,{children:[(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(Um,{"data-testid":`select-month-dialog-previous-year`,onClick:()=>i(XT(r||e.curMonth,-1)),size:`large`,children:(0,H.jsx)(fT,{})}),(0,H.jsx)(`div`,{style:{flexGrow:1},children:(0,H.jsx)(q,{variant:`h5`,align:`center`,"data-testid":`select-month-dialog-current-year`,children:(r||e.curMonth).toLocaleDateString(void 0,{year:`numeric`})})}),(0,H.jsx)(Um,{onClick:()=>i(XT(r||e.curMonth,1)),size:`large`,children:(0,H.jsx)(pT,{})})]}),(0,H.jsx)(`div`,{"data-testid":`select-month-dialog-choose-month`,children:Lse.map((t,a)=>(0,H.jsx)(`div`,{style:a>0?{marginTop:`1.2em`}:void 0,children:t.map((t,a)=>(0,H.jsx)(Y,{color:`primary`,style:a>0?{marginLeft:`1.2em`}:void 0,onClick:()=>{e.onSelectMonth(new Date((r||e.curMonth).getFullYear(),t.getMonth(),1)),i(void 0),n(!1)},children:t.toLocaleDateString(void 0,{month:`short`})},a))},a))})]})})]})}),v7=(0,L.memo)(function(){let e=R(qR),[t,n]=B(KR),r=tz(),i=ez();return(0,H.jsxs)(RC,{component:`nav`,direction:`row`,spacing:3,sx:{paddingLeft:`24px`,paddingRight:`24px`,alignItems:`center`},children:[(0,H.jsx)(vy,{control:(0,H.jsx)(_S,{checked:e.type===`Last30`,color:`secondary`,onChange:(e,t)=>t?i():null}),label:`Last 30 days`}),(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(vy,{control:(0,H.jsx)(_S,{checked:e.type===`SpecificMonth`,color:`secondary`,onChange:(e,r)=>r?n(t):null}),label:`Select Month`}),(0,H.jsx)(Rse,{curMonth:t,onSelectMonth:t=>{e.type===`SpecificMonth`?n(t):r(t)}})]})]})});function y7(e){return function(){return e}}var b7=Math.PI;b7/2,2*b7;var x7=Math.PI,S7=2*x7,C7=1e-6,zse=S7-C7;function w7(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function Bse(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return w7;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}var T7=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._=``,this._append=e==null?w7:Bse(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e=+e,t=+t,n=+n,r=+r,i=+i,i<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(this._x1===null)this._append`M${this._x1=e},${this._y1=t}`;else if(d>C7)if(!(Math.abs(u*s-c*l)>C7)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((x7-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>C7&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>C7||Math.abs(this._y1-l)>C7)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%S7+S7),d>zse?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>C7&&this._append`A${n},${n},0,${+(d>=x7)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};function Vse(){return new T7}Vse.prototype=T7.prototype;function Hse(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new T7(t)}Array.prototype.slice;function Use(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function E7(e){this._context=e}E7.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Wse(e){return new E7(e)}function Gse(e){return e[0]}function Kse(e){return e[1]}function qse(e,t){var n=y7(!0),r=null,i=Wse,a=null,o=Hse(s);e=typeof e==`function`?e:e===void 0?Gse:y7(e),t=typeof t==`function`?t:t===void 0?Kse:y7(t);function s(s){var c,l=(s=Use(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c<l&&n(u=s[c],c,s))===d&&((d=!d)?a.lineStart():a.lineEnd()),d&&a.point(+e(u,c,s),+t(u,c,s));if(f)return a=null,f+``||null}return s.x=function(t){return arguments.length?(e=typeof t==`function`?t:y7(+t),s):e},s.y=function(e){return arguments.length?(t=typeof e==`function`?e:y7(+e),s):t},s.defined=function(e){return arguments.length?(n=typeof e==`function`?e:y7(!!e),s):n},s.curve=function(e){return arguments.length?(i=e,r!=null&&(a=i(r)),s):i},s.context=function(e){return arguments.length?(e==null?r=a=null:a=i(r=e),s):r},s}function D7(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function O7(e,t){this._context=e,this._k=(1-t)/6}O7.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:D7(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:D7(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}},(function e(t){function n(e){return new O7(e,t)}return n.tension=function(t){return e(+t)},n})(0);function Jse(e,t,n){var r=e._x1,i=e._y1,a=e._x2,o=e._y2;if(e._l01_a>1e-12){var s=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,c=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*s-e._x0*e._l12_2a+e._x2*e._l01_2a)/c,i=(i*s-e._y0*e._l12_2a+e._y2*e._l01_2a)/c}if(e._l23_a>1e-12){var l=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,u=3*e._l23_a*(e._l23_a+e._l12_a);a=(a*l+e._x1*e._l23_2a-t*e._l12_2a)/u,o=(o*l+e._y1*e._l23_2a-n*e._l12_2a)/u}e._context.bezierCurveTo(r,i,a,o,e._x2,e._y2)}function k7(e,t){this._context=e,this._alpha=t}k7.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=(n*n+r*r)**+this._alpha)}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:Jse(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var Yse=(function e(t){function n(e){return t?new k7(e,t):new O7(e,0)}return n.alpha=function(t){return e(+t)},n})(.5);function Xse(e){switch(e.type){case`Queue`:return e.queue;case`Rotary`:return`Rotary `+e.machineGroup+` #`+e.machineNum.toString();case`StockerWaitForMC`:return`Stocker[Waiting For Machining]`;case`StockerWaitForUnload`:return`Stocker[Waiting For Unload]`}}var A7=150;function Zse(e,t,n){let r=Math.max(t.x.getTime()-e,n.endTime.getTime()-n.elapsedSeconds*1e3),i=Math.min(t.x.getTime()+e,n.endTime.getTime());t.y+=(i-r)/(2*e)*n.numMaterial}function Qse(e,t,n,r){let i=new Date(e.getTime()+n),a=new Date(t.getTime()-n),o=(a.getTime()-i.getTime())/(A7-1),s=[];for(let e=0;e<A7-1;e++)s.push({x:new Date(i.getTime()+e*o),y:0});s.push({x:a,y:0});for(let e of r){let t=Math.max(0,Math.ceil((e.endTime.getTime()-e.elapsedSeconds*1e3-n-i.getTime())/o)),r=Math.min(A7-1,Math.floor((e.endTime.getTime()+n-i.getTime())/o));for(let i=t;i<=r;i++)Zse(n,s[i],e)}return s}function $se(e,t,n,r,i){let a=n*60*60*1e3;return Q.of(i).filter(e=>e.buffer.type!==`Queue`||!r.has(e.buffer.queue)).groupBy(e=>Xse(e.buffer)).map(([n,r])=>({label:n,points:Qse(e,t,a,r)})).toSortedArray(e=>e.label)}function j7(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 ece(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?j7(Object(n),!0).forEach(function(t){tce(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j7(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function M7(e){"@babel/helpers - typeof";return M7=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},M7(e)}function tce(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function N7(){return N7=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},N7.apply(this,arguments)}function nce(e,t){if(e){if(typeof e==`string`)return P7(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return P7(e,t)}}function P7(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function F7(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=nce(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
366
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,s=e},f:function(){try{!a&&n.return!=null&&n.return()}finally{if(o)throw s}}}}function rce(e,t){var n=[],r=[];function i(e,t){if(e.length===1)n.push(e[0]),r.push(e[0]);else{for(var a=Array(e.length-1),o=0;o<a.length;o++)o===0&&n.push(e[0]),o===a.length-1&&r.push(e[o+1]),a[o]=[(1-t)*e[o][0]+t*e[o+1][0],(1-t)*e[o][1]+t*e[o+1][1]];i(a,t)}}return e.length&&i(e,t),{left:n,right:r.reverse()}}function ice(e){var t={};return e.length===4&&(t.x2=e[2][0],t.y2=e[2][1]),e.length>=3&&(t.x1=e[1][0],t.y1=e[1][1]),t.x=e[e.length-1][0],t.y=e[e.length-1][1],e.length===4?t.type=`C`:e.length===3?t.type=`Q`:t.type=`L`,t}function ace(e,t){t||=2;for(var n=[],r=e,i=1/t,a=0;a<t-1;a++){var o=i/(1-i*a),s=rce(r,o);n.push(s.left),r=s.right}return n.push(r),n}function oce(e,t,n){var r=[[e.x,e.y]];return t.x1!=null&&r.push([t.x1,t.y1]),t.x2!=null&&r.push([t.x2,t.y2]),r.push([t.x,t.y]),ace(r,n).map(ice)}var sce=/[MLCSTQAHVZmlcstqahv]|-?[\d.e+-]+/g,I7={M:[`x`,`y`],L:[`x`,`y`],H:[`x`],V:[`y`],C:[`x1`,`y1`,`x2`,`y2`,`x`,`y`],S:[`x2`,`y2`,`x`,`y`],Q:[`x1`,`y1`,`x`,`y`],T:[`x`,`y`],A:[`rx`,`ry`,`xAxisRotation`,`largeArcFlag`,`sweepFlag`,`x`,`y`],Z:[]};Object.keys(I7).forEach(function(e){I7[e.toLowerCase()]=I7[e]});function L7(e,t){for(var n=Array(e),r=0;r<e;r++)n[r]=t;return n}function cce(e){return`${e.type}${I7[e.type].map(function(t){return e[t]}).join(`,`)}`}function lce(e,t){var n={x1:`x`,y1:`y`,x2:`x`,y2:`y`},r=[`xAxisRotation`,`largeArcFlag`,`sweepFlag`];if(e.type!==t.type&&t.type.toUpperCase()!==`M`){var i={};Object.keys(t).forEach(function(a){var o=t[a],s=e[a];s===void 0&&(r.includes(a)?s=o:(s===void 0&&n[a]&&(s=e[n[a]]),s===void 0&&(s=0))),i[a]=s}),i.type=t.type,e=i}return e}function uce(e,t,n){var r=[];if(t.type===`L`||t.type===`Q`||t.type===`C`)r=r.concat(oce(e,t,n));else{var i=N7({},e);i.type===`M`&&(i.type=`L`),r=r.concat(L7(n-1).map(function(){return i})),r.push(t)}return r}function R7(e,t,n){var r=e.length-1,i=t.length-1,a=r/i,o=L7(i).reduce(function(t,r,i){var o=Math.floor(a*i);if(n&&o<e.length-1&&n(e[o],e[o+1])){var s=a*i%1<.5;t[o]&&(s?o>0?--o:o<e.length-1&&(o+=1):o<e.length-1?o+=1:o>0&&--o)}return t[o]=(t[o]||0)+1,t},[]).reduce(function(t,n,r){if(r===e.length-1){var i=L7(n,N7({},e[e.length-1]));return i[0].type===`M`&&i.forEach(function(e){e.type=`L`}),t.concat(i)}return t.concat(uce(e[r],e[r+1],n))},[]);return o.unshift(e[0]),o}function z7(e){for(var t=(e||``).match(sce)||[],n=[],r,i,a=0;a<t.length;++a)if(r=I7[t[a]],r){i={type:t[a]};for(var o=0;o<r.length;++o)i[r[o]]=+t[a+o+1];a+=r.length,n.push(i)}return n}function dce(e,t,n){var r=e==null?[]:e.slice(),i=t==null?[]:t.slice(),a=M7(n)===`object`?n:{excludeSegment:n,snapEndsToInput:!0},o=a.excludeSegment,s=a.snapEndsToInput;if(!r.length&&!i.length)return function(){return[]};var c=(r.length===0||r[r.length-1].type===`Z`)&&(i.length===0||i[i.length-1].type===`Z`);r.length>0&&r[r.length-1].type===`Z`&&r.pop(),i.length>0&&i[i.length-1].type===`Z`&&i.pop(),r.length?i.length||i.push(r[0]):r.push(i[0]),Math.abs(i.length-r.length)!==0&&(i.length>r.length?r=R7(r,i,o):i.length<r.length&&(i=R7(i,r,o))),r=r.map(function(e,t){return lce(e,i[t])});var l=r.map(function(e){return ece({},e)});return c&&(l.push({type:`Z`}),r.push({type:`Z`})),function(e){if(e===1&&s)return t??[];if(e===0)return r;for(var n=0;n<l.length;++n){var a=r[n],o=i[n],c=l[n],u=F7(I7[c.type]),d;try{for(u.s();!(d=u.n()).done;){var f=d.value;c[f]=(1-e)*a[f]+e*o[f],(f===`largeArcFlag`||f===`sweepFlag`)&&(c[f]=Math.round(c[f]))}}catch(e){u.e(e)}finally{u.f()}}return l}}function fce(e,t,n){var r=z7(e),i=z7(t),a=M7(n)===`object`?n:{excludeSegment:n,snapEndsToInput:!0},o=a.excludeSegment,s=a.snapEndsToInput;if(!r.length&&!i.length)return function(){return``};var c=dce(r,i,{excludeSegment:o,snapEndsToInput:s});return function(e){if(e===1&&s)return t??``;var n=c(e),r=``,i=F7(n),a;try{for(i.s();!(a=i.n()).done;){var o=a.value;r+=cce(o)}}catch(e){i.e(e)}finally{i.f()}return r}}var pce=(0,L.memo)(function({series:e,xScale:t,yScale:n,color:r}){let i=qse().curve(Yse).x(e=>t(e.x)).y(e=>n(e.y))(e.points)??``,a=(0,L.useRef)(i),o=(0,L.useCallback)(Zf(e=>{a.current=e},50),[]),s=fce(a.current,i);o(i);let{t:c}=i7({from:{t:0},to:{t:1},reset:!0,delay:0});return(0,H.jsx)(f7.path,{d:c.to(s),stroke:r,strokeWidth:2,strokeLinecap:`round`,fill:`transparent`})}),B7=60,mce=50,V7=20,H7=20;function hce({width:e,height:t,series:n,disabled:r}){let[i,a]=(0,L.useMemo)(()=>{let e=null,t=null;for(let r of n)for(let n of r.points)(e===null||n.x<e)&&(e=n.x),(t===null||n.x>t)&&(t=n.x);return[e??new Date,t??new Date]},[n]),o=(0,L.useMemo)(()=>iF().range([0,e-B7-H7]).domain([i,a]),[e,i,a]),s=t-mce-V7,c=(0,L.useMemo)(()=>VM().domain([0,Q.of(n).flatMap(e=>e.points).map(e=>e.y).maxBy(e=>e)??1]).range([s,0]),[n,s]);return(0,H.jsx)(`svg`,{width:e,height:t,children:(0,H.jsxs)(`g`,{transform:`translate(${B7},${V7})`,children:[(0,H.jsx)(DA,{scale:o,top:s}),(0,H.jsx)(OA,{scale:c,left:0,label:`Buffer Size`}),(0,H.jsx)(wA,{xScale:o,yScale:c,width:e-B7-H7,height:s}),n.map((e,t)=>r.has(e.label)?void 0:(0,H.jsx)(pce,{series:e,xScale:o,yScale:c,color:v6(t,n.length)},e.label))]})})}var gce=(0,L.memo)(function(e){let t=R(qR),n=t.type===`Last30`?[LT(cE(),-29),LT(cE(),1)]:[t.month,RT(t.month,1)],r=R(t.type===`Last30`?Wie:Gie),i=R(CL),[a,o]=(0,L.useState)(YD.empty()),s=n[0],c=n[1],l=(0,L.useMemo)(()=>$se(s,c,e.movingAverageDistanceInHours,i,r.valuesToLazySeq()),[s,c,r,e.movingAverageDistanceInHours,i]),{width:u,height:d,ref:f}=pA({refreshMode:`debounce`,refreshRate:100});return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(J,{ref:f,sx:{height:{xs:`calc(100vh - 350px)`,md:`calc(100vh - 285px)`,xl:`calc(100vh - 220px)`},overflow:`hidden`},children:u&&d&&u>0&&d>0&&(0,H.jsx)(hce,{width:u,height:d,series:l,disabled:a})}),(0,H.jsx)(`div`,{style:{marginTop:`1em`,display:`flex`,flexWrap:`wrap`,justifyContent:`space-around`},children:l.map((e,t)=>(0,H.jsx)(qw,{selected:!a.has(e.label),value:e.label,onChange:()=>o(t=>t.has(e.label)?t.delete(e.label):t.add(e.label)),children:(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(`div`,{style:{width:`14px`,height:`14px`,backgroundColor:v6(t,l.length)}}),(0,H.jsx)(`div`,{style:{marginLeft:`1em`},children:e.label})]})},e.label))})]})}),_ce=EC;function vce(){JI(`Buffer Occupancy`);let[e,t]=(0,L.useState)(12);return(0,H.jsxs)(J,{sx:{paddingLeft:`24px`,paddingRight:`24px`,paddingTop:`10px`},children:[(0,H.jsxs)(J,{component:`nav`,sx:{display:`flex`,minHeight:`2.5em`,alignItems:`center`,maxWidth:`calc(100vw - 24px - 24px)`},children:[(0,H.jsx)(q,{variant:`subtitle1`,children:`Average material occupancy of rotary tables and stocker positions over time`}),(0,H.jsx)(J,{sx:{flexGrow:1}}),(0,H.jsx)(`span`,{style:{fontSize:`small`,marginRight:`1em`},children:`Moving Average Window: `}),(0,H.jsx)(_ce,{style:{width:`10em`},min:1,max:36,steps:.2,valueLabelDisplay:`off`,value:e,onChange:(e,n)=>t(n)})]}),(0,H.jsx)(`main`,{children:(0,H.jsx)(gce,{movingAverageDistanceInHours:e})})]})}function yce(e,t){return e.some(e=>e===t)}var bce=20,U7=10,xce=2,W7=`#E8F5E9`,G7=`#1B5E20`;function Sce({yType:e,dateRange:t,containerWidth:n,points:r}){let i=n==null||n===0?400:n,a=(0,L.useMemo)(()=>Q.of(r).map(e=>e.y).distinct().map(aA).maxBy(e=>e??0)??20,[r])+5,o=i-a-xce,s=t[0],c=t[1],l=(0,L.useMemo)(()=>{let e=[];if(c<s)e.push(s);else{let t=s;for(;t<c;)e.push(t),t=LT(t,1)}return $A().domain(e).range([0,o]).align(0).padding(.05)},[s,c,o]),{yScale:u,height:d,colorScale:f}=(0,L.useMemo)(()=>{let t=new Set;for(let e of r)t.add(e.y);let n=60*t.size,i=n+U7+bce,a=$A().domain(Q.of(t).toSortedArray(e=>e)).range([0,n]).align(0).padding(.05),o;if(e===`Station`)o=VM().domain([0,1]).range([W7,G7]);else{let e=Q.of(r).maxBy(e=>e.color)?.color??1;o=VM().domain([0,e]).range([W7,G7])}return{yScale:a,height:i,colorScale:o}},[r,e]);return{height:d,width:i,xScale:l,yScale:u,colorScale:f,marginLeft:a}}var Cce=(0,L.memo)(function({xScale:e,yScale:t}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(DA,{scale:e,top:t.range()[1],tickFormat:e=>e.toLocaleDateString(void 0,{month:`short`,day:`numeric`})}),(0,H.jsx)(OA,{scale:t,left:e.range()[0]})]})}),wce=(0,L.memo)(function({points:e,xScale:t,yScale:n,colorScale:r,setTooltip:i}){let a=(0,L.useRef)(null),o=(0,L.useCallback)(t=>{let n=rA(t);if(n===null)return;a.current!==null&&(clearTimeout(a.current),a.current=null);let r=t.currentTarget.dataset.idx;if(r===void 0)return;let o=e[parseInt(r)];i({left:n.x,top:n.y,data:o})},[e,i]),s=(0,L.useCallback)(()=>{a.current===null&&(a.current=window.setTimeout(()=>{a.current=null,i(null)},100))},[i]);return(0,H.jsx)(`g`,{children:e.map((e,i)=>(0,H.jsx)(`rect`,{"data-idx":i,x:t(e.x)??0,width:t.bandwidth(),y:n(e.y)??0,height:n.bandwidth(),rx:6,fill:r(e.color),onPointerEnter:o,onPointerLeave:s},i))})}),Tce=(0,L.memo)(function({yType:e,seriesLabel:t,tooltip:n}){return n===null?null:(0,H.jsxs)(RC,{direction:`column`,spacing:.6,children:[(0,H.jsxs)(`div`,{children:[e,`: `,n.data.y]}),(0,H.jsxs)(`div`,{children:[`Day: `,n.data.x.toDateString()]}),(0,H.jsxs)(`div`,{children:[t,`: `,n.data.label]})]})});function Ece(e){let{width:t,height:n,xScale:r,yScale:i,colorScale:a,marginLeft:o}=Sce({yType:e.y_title,points:e.points,dateRange:e.dateRange,containerWidth:e.parentWidth});return(0,H.jsx)(`svg`,{width:t,height:n,children:(0,H.jsxs)(`g`,{transform:`translate(${o}, ${U7})`,children:[(0,H.jsx)(wce,{points:e.points,xScale:r,yScale:i,colorScale:a,setTooltip:e.setTooltip}),(0,H.jsx)(Cce,{xScale:r,yScale:i,colorScale:a})]})})}function Dce(e){let t=e.setSelected;return(0,H.jsxs)(J,{component:`nav`,sx:{display:`flex`,minHeight:`2.5em`,alignItems:`center`,maxWidth:`calc(100vw - 24px - 24px)`},children:[(0,H.jsx)(q,{variant:`subtitle1`,children:e.label}),(0,H.jsx)(J,{sx:{flexGrow:1}}),t?(0,H.jsx)(_y,{size:`small`,children:(0,H.jsx)(YS,{autoWidth:!0,displayEmpty:!0,value:e.cur_selected,onChange:n=>{yce(e.options,n.target.value)&&t(n.target.value)},children:e.options.map((e,t)=>(0,H.jsx)(Hx,{value:e,children:e},t))})}):void 0,(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{onClick:e.onExport,style:{height:`25px`,paddingTop:0,paddingBottom:0},size:`large`,children:(0,H.jsx)(uT,{})})})]})}function K7(e){let t=(0,L.useMemo)(()=>P(null),[]),n=z(t),r=(0,L.useCallback)(()=>{n(null)},[n]);return(0,H.jsxs)(J,{sx:{paddingLeft:`24px`,paddingRight:`24px`,paddingTop:`10px`},children:[(0,H.jsx)(Dce,{label:e.label,setSelected:e.setSelected,cur_selected:e.cur_selected,onExport:e.onExport,options:e.options}),(0,H.jsx)(`main`,{onPointerLeave:r,children:(0,H.jsx)(gA,{sx:{width:`100%`},tooltipAtom:t,autoHeight:!0,chart:({width:t})=>(0,H.jsx)(Ece,{points:e.points,y_title:e.y_title,dateRange:e.dateRange,parentWidth:t,setTooltip:n}),TooltipContent:({tooltip:t})=>(0,H.jsx)(Tce,{yType:e.y_title,seriesLabel:e.label_title,tooltip:t})})})]})}var q7=class e{constructor(e,t){this.day=e,this.part=t}compare(e){let t=this.day.getTime()-e.day.getTime();return t===0?this.part.localeCompare(e.part):t}hash(){return yD(this.day,this.part)}toString(){return`{day: ${this.day.toISOString()}}, part: ${this.part}}`}adjustDay(t){return new e(t(this.day),this.part)}},J7=class{constructor(e,t){this.matId=e,this.proc=t}compare(e){let t=this.matId-e.matId;return t===0?this.proc-e.proc:t}hash(){return yD(this.matId,this.proc)}toString(){return this.matId.toString()+`-`+this.proc.toString()}};function Oce(e,t,n,r){let i=Q.of(e).filter(e=>e.endTime>=n&&e.endTime<=r&&ek(e)&&e.activeMinutes>0&&e.material.length>0).flatMap(e=>e.material.map(t=>({matId:t.id,proc:t.proc,active:e.activeMinutes/e.material.length}))).toHashMap(e=>[new J7(e.matId,e.proc),e.active],(e,t)=>e+t);return Q.of(t).flatMap(([e,t])=>Q.ofObject(t.unloaded_processes??{}).filter(([e,t])=>t>=n&&t<=r).map(([n,r])=>({day:KT(r),part:t.partName+`-`+n,value:{count:1,activeMachineMins:i.get(new J7(e,parseInt(n)))??0}}))).toHashMap(e=>[new q7(e.day,e.part),e.value],(e,t)=>({count:e.count+t.count,activeMachineMins:e.activeMachineMins+t.activeMachineMins}))}function kce(e){return Q.of(e).toHashMap(e=>[new q7(KT(e.completeTime),e.partName+`-`+e.process.toString()),{count:e.quantity,activeMachineMins:e.expectedMachineMins}],(e,t)=>({count:e.count+t.count,activeMachineMins:e.activeMachineMins+t.activeMachineMins}))}var Y7=class{constructor(e,t){this.x=e,this.y=t}compare(e){let t=this.x-e.x;return t===0?this.y.localeCompare(e.y):t}hash(){return yD(this.x,this.y)}toString(){return`{x: ${new Date(this.x).toISOString()}, y: ${this.y}}`}};function Ace(e){let t=Q.of(e).toHashMap(e=>[new Y7(e.x.getTime(),e.y),e],(e,t)=>t),n=Q.of(e).map(e=>e.x.getTime()).distinct().toSortedArray(e=>e),r=Q.of(e).aggregate(e=>e.y,e=>e.activeMachineMins/e.count,(e,t)=>isNaN(e)?t:e).sortBy(([e,t])=>e),i=`<table>
|
|
367
367
|
<thead><tr><th>Part</th><th>Expected Cycle Mins</th>`;for(let e of n)i+=`<th>`+new Date(e).toDateString()+` Completed</th>`,i+=`<th>`+new Date(e).toDateString()+` Std. Hours</th>`;i+=`</tr></thead>
|
|
368
368
|
<tbody>
|
|
369
369
|
`;for(let[e,a]of r){i+=`<tr><th>`+e+`</th><th>`+a.toFixed(1)+`</th>`;for(let r of n){let n=t.get(new Y7(r,e));n===void 0?(i+=`<td></td>`,i+=`<td></td>`):(i+=`<td>`+n.count.toFixed(0)+`</td>`,i+=`<td>`+(n.activeMachineMins/60).toFixed(1)+`</td>`)}i+=`</tr>
|
|
370
370
|
`}return i+=`</tbody>
|
|
371
|
-
</table>`,i}function Ace(e){Ak(kce(e))}function jce(e,t){return Q.of(e).map(([e,n])=>{let r=t.get(e)??0,i=r<1440?Math.max(n/(1440-r),0):0;return{x:e.day,y:e.station,color:Math.min(i,1),label:r<1440?(i*100).toFixed(1)+`%`:`Planned Downtime`}}).toSortedArray(e=>e.x.getTime(),{desc:e=>e.y})}var Mce=P(`Standard OEE`);function Nce(){JI(`Station OEE`);let[e,t]=B(Mce),n=R(KR),r=n.type===`Last30`?[LT(cE(),-29),LT(cE(),1)]:[n.month,RT(n.month,1)],i=R(n.type===`Last30`?uk:pk),a=R(n.type===`Last30`?Xk:Qk),o=(0,L.useMemo)(()=>{let t=p6(a);return jce(e===`Standard OEE`?d6(i.valuesToLazySeq()):e===`Occupied`?Oae(i.valuesToLazySeq()):m6(a),t)},[e,i,a]);return(0,H.jsx)(K7,{label:`Station Usage Per Day`,y_title:`Station`,label_title:e===`Occupied`?`Occupied`:`OEE`,dateRange:r,cur_selected:e,options:[`Standard OEE`,`Occupied`,`Planned OEE`],setSelected:t,points:o,onExport:()=>jae(`Station`,o)})}var Pce=P(`Completed`);function Fce(e,t,n,r){let i=Dce(e,t,n,r);return Q.of(i).map(([e,t])=>({x:e.day,y:e.part,color:t.activeMachineMins,label:t.count.toFixed(0)+` (`+(t.activeMachineMins/60).toFixed(1)+` hours)`,count:t.count,activeMachineMins:t.activeMachineMins})).toSortedArray(e=>e.x.getTime(),{desc:e=>e.y})}function Ice(e){let t=Oce(e);return Q.of(t).map(([e,t])=>({x:e.day,y:e.part,color:t.activeMachineMins,label:t.count.toFixed(0)+` (`+(t.activeMachineMins/60).toFixed(1)+` hours)`,count:t.count,activeMachineMins:t.activeMachineMins})).toSortedArray(e=>e.x.getTime(),{desc:e=>e.y})}function Lce(){JI(`Part Production`);let[e,t]=B(Pce),n=R(KR),r=n.type===`Last30`?[LT(cE(),-29),LT(cE(),1)]:[n.month,RT(n.month,1)],i=R(n.type===`Last30`?uk:pk),a=R(n.type===`Last30`?QI:Bie),o=R(n.type===`Last30`?fL:mL),s=(0,L.useMemo)(()=>{if(e===`Completed`){let e=cE(),t=n.type===`Last30`?LT(e,-30):n.month,r=n.type===`Last30`?LT(e,1):RT(n.month,1);return Fce(i.valuesToLazySeq(),o.matsById,t,r)}else return Ice(a)},[e,i,o,a,n]);return(0,H.jsx)(K7,{label:`Part Production Per Day`,y_title:`Part`,label_title:e,dateRange:r,cur_selected:e,options:[`Completed`,`Planned`],setSelected:t,points:s,onExport:()=>Ace(s)})}var X7=new Intl.DateTimeFormat(void 0,{weekday:`short`,month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`});function Rce(e){return`material`in e&&Array.isArray(e.material)}function zce(e){return`operations`in e&&(e.operations===void 0||Array.isArray(e.operations))}function Z7({range:e}){let t=R(KR);if(!e)return null;let n=`start`in e?e.start:e[0],r=`end`in e?e.end:e[1];return t.type===`SpecificMonth`?n.toDateString()+` to `+r.toDateString():X7.format(n)+` to `+X7.format(r)}var Bce=P(!0),Vce=vO(e=>e(GI)?{part:`aaa`,proc:2}:void 0),Hce=P(Nk),Uce=P(void 0),Wce=P(void 0),Q7=P(void 0),$7=P(eO.empty()),Gce=P(e=>{let t=e(KR);return t.type===`Last30`?e(Q7):e($7).get(t.month)},(e,t,n)=>{let r=e(KR);r.type===`Last30`?t(Q7,n):t($7,e=>e.alter(r.month,()=>n))}),Kce=P(null);function qce(){JI(`Machine Cycles`);let e=z(SI),t=(0,L.useCallback)(function(t){if(!Rce(t))return[];let n=[];for(let r of t.material)n.push({title:r.serial?r.serial:`Material`,value:`Open Card`,link:()=>e({type:`LogMat`,logMat:r})});return n},[e]),n=R(KR),r=R(n.type===`Last30`?UO:GO),i=R(n.type===`Last30`?fL:mL),[a,o]=B(Bce),[s,c]=B(Vce),[l,u]=B(Hce),[d,f]=B(Uce),[p,m]=B(Wce),[h,g]=B(Gce),[_,v]=B(Kce),y=n.type===`Last30`?[LT(cE(),-29),LT(cE(),1)]:[n.month,RT(n.month,1)],b=R(n.type===`Last30`?uk:pk),x=(0,L.useMemo)(()=>s?d?Ik(b.valuesToLazySeq(),{partAndProc:s,pallet:p,operation:d}):Ik(b.valuesToLazySeq(),{partAndProc:s,pallet:p,station:Nk}):p||l!==`@@@_FMSInsight_FilterAnyMachineKey_@@@`?Ik(b.valuesToLazySeq(),{pallet:p,station:l}):Fk(b.valuesToLazySeq()),[s,p,l,d,b]),S=s?d??(x.allMachineOperations.length===1?x.allMachineOperations[0]:void 0):void 0,C=(0,L.useMemo)(()=>{if(S)return Rk(x,!1)},[x,S]);return(0,H.jsxs)(J,{sx:{paddingLeft:`24px`,paddingRight:`24px`,paddingTop:`10px`},children:[(0,H.jsxs)(J,{component:`nav`,sx:{display:`flex`,minHeight:`2.5em`,alignItems:`center`,maxWidth:`calc(100vw - 24px - 24px)`},children:[(0,H.jsxs)(q,{variant:`subtitle1`,children:[`Machine Cycles for `,(0,H.jsx)(Z7,{range:h??y})]}),(0,H.jsx)(J,{sx:{flexGrow:1}}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,value:a?`graph`:`table`,onChange:e=>o(e.target.value===`graph`),children:[(0,H.jsx)(Hx,{value:`graph`,children:`Graph`},`graph`),(0,H.jsx)(Hx,{value:`table`,children:`Table`},`table`)]})}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,displayEmpty:!0,value:s?x.allPartAndProcNames.findIndex(e=>s.part===e.part&&s.proc===e.proc):-1,style:{marginLeft:`1em`},onChange:e=>{c(e.target.value===-1?void 0:x.allPartAndProcNames[e.target.value]),f(void 0)},children:[(0,H.jsx)(Hx,{value:-1,children:(0,H.jsx)(`em`,{children:`Any Part`})},0),x.allPartAndProcNames.map((e,t)=>(0,H.jsx)(Hx,{value:t,children:(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(XU,{part:e.part,size:20}),(0,H.jsxs)(`span`,{style:{marginRight:`1em`},children:[e.part,`-`,e.proc]})]})},t))]})}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsx)(YS,{autoWidth:!0,displayEmpty:!0,value:s?S?x.allMachineOperations.findIndex(e=>S.compare(e)===0):-1:l,style:{marginLeft:`1em`},onChange:e=>{if(s){let t=typeof e.target.value==`number`?e.target.value:Number.parseInt(e.target.value,10);Number.isNaN(t)||f(t===-1?void 0:x.allMachineOperations[t])}else typeof e.target.value==`string`&&u(e.target.value)},children:s?[...x.allMachineOperations.length===1?[]:[(0,H.jsx)(Hx,{value:-1,children:(0,H.jsx)(`em`,{children:`Any Operation`})},-1)],...x.allMachineOperations.map((e,t)=>(0,H.jsxs)(Hx,{value:t,children:[e.statGroup,` `,e.operation]},t))]:[(0,H.jsx)(Hx,{value:Nk,children:(0,H.jsx)(`em`,{children:`Any Machine`})},-1),x.allMachineNames.map(e=>(0,H.jsx)(Hx,{value:e,children:(0,H.jsx)(`div`,{style:{display:`flex`,alignItems:`center`},children:(0,H.jsx)(`span`,{style:{marginRight:`1em`},children:e})})},e))]})}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,displayEmpty:!0,value:p||``,style:{marginLeft:`1em`},onChange:e=>m(e.target.value===``?void 0:e.target.value),children:[(0,H.jsx)(Hx,{value:``,children:(0,H.jsx)(`em`,{children:`Any Pallet`})},0),x.allPalletNames.map(e=>(0,H.jsx)(Hx,{value:e,children:(0,H.jsx)(`div`,{style:{display:`flex`,alignItems:`center`},children:(0,H.jsx)(`span`,{style:{marginRight:`1em`},children:e})})},e))]})}),x.data.size>0?(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{onClick:()=>Hk(x,i.matsById,h),style:{height:`25px`,paddingTop:0,paddingBottom:0},size:`large`,children:(0,H.jsx)(uT,{})})}):void 0]}),(0,H.jsx)(`main`,{children:a?(0,H.jsx)(g7,{points:x.data,series_label:x.seriesLabel,default_date_range:y,extra_tooltip:t,current_date_zoom:h,set_date_zoom_range:e=>g(e.zoom),yZoom:_,setYZoom:v,stats:S?r.get(S):void 0,partCntPerPoint:S?Q.of(x.data).head()?.[1]?.[0]?.material?.length:void 0,plannedTimeMinutes:C}):(0,H.jsx)(o6,{points:x.data,matsById:i.matsById,period:n,current_date_zoom:h,set_date_zoom_range:e=>g(e.zoom),showWorkorderAndInspect:!0,emptyMessage:s||p||d?`No Cycles`:`Select part, station, or pallet to see cycles.`})})]})}var Jce=P(!0),Yce=vO(e=>e(GI)?{part:`aaa`,proc:2}:void 0),Xce=vO(e=>e(GI)?`LoadOp`:`LULOccupancy`),Zce=P(Pk),Qce=P(`Any`),$ce=P(void 0),e9=P(void 0),t9=P(eO.empty()),ele=P(e=>{let t=e(KR);return t.type===`Last30`?e(e9):e(t9).get(t.month)},(e,t,n)=>{let r=e(KR);r.type===`Last30`?t(e9,n):t(t9,e=>e.alter(r.month,()=>n))}),tle=P(null);function nle(){JI(`L/U Cycles`);let e=z(SI),t=(0,L.useCallback)(function(t){if(!zce(t))return[];let n=[];if(t.operations)for(let r of t.operations)n.push({title:(r.mat.serial?r.mat.serial:`Material`)+` `+r.operation,value:`Open Card`,link:()=>e({type:`LogMat`,logMat:r.mat})});return n},[e]),n=R(KR),[r,i]=B(Jce),[a,o]=B(Yce),[s,c]=B(Xce),[l,u]=B(Zce),[d,f]=B(Qce),[p,m]=B($ce),[h,g]=B(ele),[_,v]=B(tle),y=R(br),b=ok(y.basketName),x=R(n.type===`Last30`?dk:Jre),S=jk(d,x),C=(0,L.useMemo)(()=>a&&s===`LoadOp`?new VO(a.part,`L/U`,`LOAD-${a.proc}`):a&&s===`UnloadOp`?new VO(a.part,`L/U`,`UNLOAD-${a.proc}`):null,[a,s]),w=n.type===`Last30`?[LT(cE(),-29),LT(cE(),1)]:[n.month,RT(n.month,1)],T=R(n.type===`Last30`?uk:pk),E=R(n.type===`Last30`?fL:mL),D=R(n.type===`Last30`?UO:GO),O=(0,L.useMemo)(()=>a||p||l!==`@@@_FMSInsigt_FilterAnyLoadKey_@@@`||S!==`Any`?C?Ik(T.valuesToLazySeq(),{operation:C,pallet:p,station:l,carrierKind:S}):r?Lk(T.valuesToLazySeq(),{partAndProc:a,pallet:p,station:l,carrierKind:S}):Ik(T.valuesToLazySeq(),{partAndProc:a,pallet:p,station:l,carrierKind:S}):Fk(T.valuesToLazySeq()),[a,p,C,l,T,r,S]),ee=(0,L.useMemo)(()=>{if(s===`LoadOp`||s===`UnloadOp`)return Rk(O,!0)},[O,s]);return(0,H.jsxs)(J,{sx:{paddingLeft:`24px`,paddingRight:`24px`,paddingTop:`10px`},children:[(0,H.jsxs)(J,{component:`nav`,sx:{display:`flex`,minHeight:`2.5em`,alignItems:`center`,maxWidth:`calc(100vw - 24px - 24px)`},children:[(0,H.jsxs)(q,{variant:`subtitle1`,children:[`Load/Unload Cycles for `,(0,H.jsx)(Z7,{range:h??w})]}),(0,H.jsx)(J,{sx:{flexGrow:1}}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,value:r?`graph`:`table`,onChange:e=>i(e.target.value===`graph`),children:[(0,H.jsx)(Hx,{value:`graph`,children:`Graph`},`graph`),(0,H.jsx)(Hx,{value:`table`,children:`Table`},`table`)]})}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,displayEmpty:!0,value:a?O.allPartAndProcNames.findIndex(e=>a.part===e.part&&a.proc===e.proc):-1,style:{marginLeft:`1em`},onChange:e=>{e.target.value===-1?(o(void 0),c(`LULOccupancy`)):o(e.target.value===-1?void 0:O.allPartAndProcNames[e.target.value])},children:[(0,H.jsx)(Hx,{value:-1,children:(0,H.jsx)(`em`,{children:`Any Part`})},0),O.allPartAndProcNames.map((e,t)=>(0,H.jsx)(Hx,{value:t,children:(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(XU,{part:e.part,size:20}),(0,H.jsxs)(`span`,{style:{marginRight:`1em`},children:[e.part,`-`,e.proc]})]})},t))]})}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,displayEmpty:!0,value:s,style:{marginLeft:`1em`},onChange:e=>c(e.target.value),children:[(0,H.jsx)(Hx,{value:`LULOccupancy`,children:`L/U Occupancy`}),a?(0,H.jsx)(Hx,{value:`LoadOp`,children:`Load Operation (estimated)`}):void 0,a?(0,H.jsx)(Hx,{value:`UnloadOp`,children:`Unload Operation (estimated)`}):void 0]})}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,displayEmpty:!0,value:l,style:{marginLeft:`1em`},onChange:e=>{u(e.target.value)},children:[(0,H.jsx)(Hx,{value:Pk,children:(0,H.jsx)(`em`,{children:`Any Station`})},-1),O.allLoadStationNames.map(e=>(0,H.jsx)(Hx,{value:e,children:(0,H.jsx)(`div`,{style:{display:`flex`,alignItems:`center`},children:(0,H.jsx)(`span`,{style:{marginRight:`1em`},children:e})})},e))]})}),x?(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,displayEmpty:!0,value:S,style:{marginLeft:`1em`},onChange:e=>{let t=e.target.value;f(t),t===`Basket`&&m(void 0)},children:[(0,H.jsx)(Hx,{value:`Any`,children:(0,H.jsx)(`em`,{children:`Any Carrier`})}),(0,H.jsx)(Hx,{value:`Pallet`,children:`Pallet`}),(0,H.jsx)(Hx,{value:`Basket`,children:b})]})}):void 0,S===`Basket`?void 0:(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,displayEmpty:!0,value:p||``,style:{marginLeft:`1em`},onChange:e=>m(e.target.value===``?void 0:e.target.value),children:[(0,H.jsx)(Hx,{value:``,children:(0,H.jsx)(`em`,{children:`Any Pallet`})},0),O.allPalletNames.map(e=>(0,H.jsx)(Hx,{value:e,children:(0,H.jsx)(`div`,{style:{display:`flex`,alignItems:`center`},children:(0,H.jsx)(`span`,{style:{marginRight:`1em`},children:e})})},e))]})}),O.data.size>0?(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{onClick:()=>Hk(O,E.matsById,h,s===`LULOccupancy`,y.loadStationNames,b),style:{height:`25px`,paddingTop:0,paddingBottom:0},size:`large`,children:(0,H.jsx)(uT,{})})}):void 0]}),(0,H.jsx)(`main`,{children:r?(0,H.jsx)(g7,{points:O.data,series_label:O.seriesLabel,default_date_range:w,extra_tooltip:t,current_date_zoom:h,set_date_zoom_range:e=>g(e.zoom),yZoom:_,setYZoom:v,stats:C?D.get(C):void 0,plannedTimeMinutes:ee}):(0,H.jsx)(o6,{points:O.data,matsById:E.matsById,period:n,current_date_zoom:h,set_date_zoom_range:e=>g(e.zoom),showWorkorderAndInspect:!0,hideMedian:s===`LULOccupancy`,emptyMessage:a||p?`No Cycles`:`Select part, operation, or pallet to see cycles.`})})]})}var n9=vO(e=>e(GI)?3:void 0),r9=P(void 0),rle=P(void 0),ile=P(null);function ale(e){return`mats`in e&&Array.isArray(e.mats)}var ole=P(e=>{let t=e(n9),n=e(r9);if(!t&&!n)return new Map;let r=e(e(KR).type===`Last30`?UL:GL);if(t){let e=r.get(t)?.valuesToLazySeq()??Q.of([]);return n&&(e=e.filter(e=>e.mats.some(e=>e.part===n.part&&e.proc===n.proc))),new Map([[t.toString(),Array.from(e)]])}else if(n)return Q.of(r).collect(([e,t])=>{let r=t.valuesToLazySeq().filter(e=>e.mats.some(e=>e.part===n.part&&e.proc===n.proc)).toRArray();return r.length>0?[e,r]:null}).toRMap(([e,t])=>[e.toString(),t]);else return new Map}),sle=P(e=>{let t=e(e(KR).type===`Last30`?UL:GL);return Q.of(t).flatMap(([,e])=>e).flatMap(([,e])=>e.mats).distinctAndSortBy(e=>e.part,e=>e.proc).map(e=>({part:e.part,proc:e.proc})).toRArray()});function cle(){JI(`Pallet Cycles`);let[e,t]=B(n9),[n,r]=B(r9),[i,a]=B(rle),[o,s]=B(ile),c=R(KR),l=c.type===`Last30`?[LT(cE(),-29),LT(cE(),1)]:[c.month,RT(c.month,1)],u=R(c.type===`Last30`?UL:GL),d=R(ole),f=R(sle),p=z(SI),m=(0,L.useCallback)(function(e){return ale(e)?e.mats.map(e=>({title:e.part+`-`+e.proc,value:e.serial??``,link:e.serial?()=>p({type:`LogMat`,logMat:e}):void 0})):[]},[p]);return(0,H.jsxs)(J,{sx:{paddingLeft:`24px`,paddingRight:`24px`,paddingTop:`10px`},children:[(0,H.jsxs)(J,{component:`nav`,sx:{display:`flex`,minHeight:`2.5em`,alignItems:`center`,maxWidth:`calc(100vw - 24px - 24px)`},children:[(0,H.jsx)(q,{variant:`subtitle1`,children:`Pallet Cycles`}),(0,H.jsx)(J,{sx:{flexGrow:1}}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,displayEmpty:!0,value:e??-1,onChange:e=>t(e.target.value===-1?void 0:e.target.value),children:[(0,H.jsx)(Hx,{value:-1,children:(0,H.jsx)(`em`,{children:`Any Pallet`})},0),u.keysToLazySeq().sortBy(e=>e).map(e=>(0,H.jsx)(Hx,{value:e,children:(0,H.jsx)(`div`,{style:{display:`flex`,alignItems:`center`},children:(0,H.jsx)(`span`,{style:{marginRight:`1em`},children:e})})},e))]})}),f.length>0?(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,displayEmpty:!0,value:n?f.findIndex(e=>n.part===e.part&&n.proc===e.proc):-1,style:{marginLeft:`1em`},onChange:e=>{r(e.target.value===-1?void 0:f[e.target.value])},children:[(0,H.jsx)(Hx,{value:-1,children:(0,H.jsx)(`em`,{children:`Any Part`})},0),f.map((e,t)=>(0,H.jsx)(Hx,{value:t,children:(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(XU,{part:e.part,size:20}),(0,H.jsxs)(`span`,{style:{marginRight:`1em`},children:[e.part,`-`,e.proc]})]})},t))]})}):void 0,(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{onClick:()=>Wk(u),style:{height:`25px`,paddingTop:0,paddingBottom:0},size:`large`,children:(0,H.jsx)(uT,{})})})]}),(0,H.jsx)(`main`,{children:(0,H.jsx)(g7,{points:d,series_label:`Pallet`,default_date_range:l,current_date_zoom:i,set_date_zoom_range:e=>a(e.zoom),yZoom:o,setYZoom:s,extra_tooltip:m})})]})}var i9=P(void 0),a9=P(void 0),lle=P(void 0);function ule(e){return`mats`in e&&Array.isArray(e.mats)}var dle=P(null),fle=P(e=>{let t=e(i9),n=e(a9);if(!t&&!n)return new Map;let r=e(e(KR).type===`Last30`?ZL:eR);if(t){let e=r.get(t)?.valuesToLazySeq()??Q.of([]);return n&&(e=e.filter(e=>e.mats.some(e=>e.part===n.part&&e.proc===n.proc))),new Map([[t.toString(),Array.from(e)]])}else if(n)return Q.of(r).collect(([e,t])=>{let r=t.valuesToLazySeq().filter(e=>e.mats.some(e=>e.part===n.part&&e.proc===n.proc)).toRArray();return r.length>0?[e,r]:null}).toRMap(([e,t])=>[e.toString(),t]);else return new Map}),ple=P(e=>{let t=e(e(KR).type===`Last30`?ZL:eR);return Q.of(t).flatMap(([,e])=>e).flatMap(([,e])=>e.mats).distinctAndSortBy(e=>e.part,e=>e.proc).map(e=>({part:e.part,proc:e.proc})).toRArray()});function mle(){let e=ok(R(br).basketName);JI(`${e} Cycles`);let[t,n]=B(i9),[r,i]=B(a9),[a,o]=B(lle),[s,c]=B(dle),l=R(KR),u=l.type===`Last30`?[LT(cE(),-29),LT(cE(),1)]:[l.month,RT(l.month,1)],d=R(l.type===`Last30`?ZL:eR),f=R(fle),p=R(ple),m=z(SI),h=(0,L.useCallback)(function(e){return ule(e)?e.mats.map(e=>({title:e.part+`-`+e.proc,value:e.serial??``,link:e.serial?()=>m({type:`LogMat`,logMat:e}):void 0})):[]},[m]);return(0,H.jsxs)(J,{sx:{paddingLeft:`24px`,paddingRight:`24px`,paddingTop:`10px`},children:[(0,H.jsxs)(J,{component:`nav`,sx:{display:`flex`,minHeight:`2.5em`,alignItems:`center`,maxWidth:`calc(100vw - 24px - 24px)`},children:[(0,H.jsxs)(q,{variant:`subtitle1`,children:[e,` Cycles`]}),(0,H.jsx)(J,{sx:{flexGrow:1}}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,displayEmpty:!0,value:t??-1,onChange:e=>n(e.target.value===-1?void 0:e.target.value),children:[(0,H.jsx)(Hx,{value:-1,children:(0,H.jsxs)(`em`,{children:[`Any `,e]})},0),d.keysToLazySeq().sortBy(e=>e).map(e=>(0,H.jsx)(Hx,{value:e,children:(0,H.jsx)(`div`,{style:{display:`flex`,alignItems:`center`},children:(0,H.jsx)(`span`,{style:{marginRight:`1em`},children:e})})},e))]})}),p.length>0?(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,displayEmpty:!0,value:r?p.findIndex(e=>r.part===e.part&&r.proc===e.proc):-1,style:{marginLeft:`1em`},onChange:e=>{i(e.target.value===-1?void 0:p[e.target.value])},children:[(0,H.jsx)(Hx,{value:-1,children:(0,H.jsx)(`em`,{children:`Any Part`})},0),p.map((e,t)=>(0,H.jsx)(Hx,{value:t,children:(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(XU,{part:e.part,size:20}),(0,H.jsxs)(`span`,{style:{marginRight:`1em`},children:[e.part,`-`,e.proc]})]})},t))]})}):void 0,(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{onClick:()=>Wk(d,e),style:{height:`25px`,paddingTop:0,paddingBottom:0},size:`large`,children:(0,H.jsx)(uT,{})})})]}),(0,H.jsx)(`main`,{children:(0,H.jsx)(g7,{points:f,series_label:e,default_date_range:u,current_date_zoom:a,set_date_zoom_range:e=>o(e.zoom),yZoom:s,setYZoom:c,extra_tooltip:h})})]})}function o9(e,t,n){let r=e?.zoomRange;return n?(t.get(n)??eO.empty()).valuesToAscLazySeq().transform(e=>r?e.filter(e=>e.time>=r.start&&e.time<=r.end):e).flatMap(e=>e.replacements.map(t=>({...t,station:n,time:e.time}))):t.toAscLazySeq().flatMap(([e,t])=>t.valuesToAscLazySeq().transform(e=>r?e.filter(e=>e.time>=r.start&&e.time<=r.end):e).flatMap(t=>t.replacements.map(n=>({...n,station:e,time:t.time}))))}function s9(e,t,n,r){return o9(e,t,n).groupBy(e=>e.tool).map(([e,t])=>{let n=0,r=null,i=0,a=null;for(let e of t){let t=e.type===`ReplaceBeforeCycleStart`?e.useAtReplacement:e.totalUseAtBeginningOfCycle;t&&(r===null||t>r)&&(r=t),t&&(n+=t);let o=e.type===`ReplaceBeforeCycleStart`?e.cntAtReplacement:e.totalCntAtBeginningOfCycle;o&&(a===null||o>a)&&(a=o),o&&(i+=o)}return{tool:e,numReplacements:t.length,totalUseOfAllReplacements:n,totalCntOfAllReplacements:i,maxY:r??a??1,yAxisType:r===null?`Count`:`Time`,replacements:t}}).toSortedArray(r)}function hle(e,t){let n=e.maxY/2;return t.type===`ReplaceBeforeCycleStart`?e.yAxisType===`Time`?t.useAtReplacement??n:t.cntAtReplacement??n:e.yAxisType===`Time`?t.totalUseAtBeginningOfCycle??n:t.totalCntAtBeginningOfCycle??n}var c9=Intl.NumberFormat(void 0,{maximumFractionDigits:1}),l9=(0,L.createContext)({start:new Date,end:new Date});function gle({tooltip:e}){return(0,H.jsxs)(RC,{spacing:.5,children:[(0,H.jsxs)(`div`,{children:[`Tool: `,e.r.tool]}),(0,H.jsxs)(`div`,{children:[`Pocket: `,e.r.pocket]}),(0,H.jsxs)(`div`,{children:[`Time: `,e.r.time.toLocaleString()]}),(0,H.jsxs)(`div`,{children:[`Station: `,e.r.station.group,` #`,e.r.station.num]}),e.r.type===`ReplaceBeforeCycleStart`?(0,H.jsxs)(H.Fragment,{children:[e.r.useAtReplacement===null?void 0:(0,H.jsxs)(`div`,{children:[`Minutes at replacement: `,c9.format(e.r.useAtReplacement)]}),e.r.cntAtReplacement===null?void 0:(0,H.jsxs)(`div`,{children:[`Count at replacement: `,c9.format(e.r.cntAtReplacement)]})]}):(0,H.jsxs)(H.Fragment,{children:[e.r.totalUseAtBeginningOfCycle===null?void 0:(0,H.jsxs)(`div`,{children:[`Minutes at beginning of cycle:`,` `,c9.format(e.r.totalUseAtBeginningOfCycle)]}),e.r.totalUseAtEndOfCycle===null?void 0:(0,H.jsxs)(`div`,{children:[`Minutes at end of cycle: `,c9.format(e.r.totalUseAtEndOfCycle)]}),e.r.totalCntAtBeginningOfCycle===null?void 0:(0,H.jsxs)(`div`,{children:[`Count at beginning of cycle:`,` `,c9.format(e.r.totalCntAtBeginningOfCycle)]}),e.r.totalCntAtEndOfCycle===null?void 0:(0,H.jsxs)(`div`,{children:[`Count at end of cycle: `,c9.format(e.r.totalCntAtEndOfCycle)]})]})]})}function _le({row:e,tooltip:t,timeScale:n,yScale:r}){let[i,a]=B(t);return(0,H.jsx)(`g`,{children:e.replacements.map((t,o)=>(0,H.jsx)(`circle`,{cx:n(t.time),cy:r(hle(e,t)),r:t===i?.r?4:2,onMouseEnter:e=>a({top:0,left:rA(e)?.x??0,r:t}),fill:`black`},o))})}var u9=[{id:0,numeric:!1,label:`Tool`,getDisplay:e=>e.tool},{id:1,numeric:!0,label:`Num Replacements`,getDisplay:e=>e.numReplacements.toString(),getForSort:e=>e.numReplacements},{id:2,numeric:!0,label:`Avg Use (min) at Replacement`,getDisplay:e=>c9.format(e.totalUseOfAllReplacements/e.numReplacements),getForSort:e=>e.totalUseOfAllReplacements/e.numReplacements},{id:3,numeric:!0,label:`Avg Use (count) at Replacement`,getDisplay:e=>c9.format(e.totalCntOfAllReplacements/e.numReplacements),getForSort:e=>e.totalCntOfAllReplacements/e.numReplacements},{id:4,numeric:!1,ignoreDuringExport:!0,label:`All Replacements`,getDisplay:()=>``,expanded:!0,Cell:(0,L.memo)(function({row:e}){let t=(0,L.useContext)(l9),n=(0,L.useMemo)(()=>P(null),[]),r=z(n),{ref:i,width:a}=pA({refreshMode:`debounce`,refreshRate:100,handleHeight:!1}),o=rF().domain([t.start,t.end]).range([0,a??1e3]),s=VM().domain([0,e.maxY]).range([33,3]),c=e.numReplacements===0?null:s(e.totalUseOfAllReplacements/e.numReplacements);return(0,H.jsxs)(`div`,{ref:i,style:{position:`relative`,width:`100%`,height:`35px`},children:[(0,H.jsxs)(`svg`,{height:`35`,width:a??1e3,onMouseLeave:()=>r(null),children:[c===null?void 0:(0,H.jsx)(`line`,{x1:`0`,y1:c,x2:a??1e3,y2:c,stroke:`red`,strokeWidth:.5}),(0,H.jsx)(_le,{row:e,tooltip:n,timeScale:o,yScale:s})]}),(0,H.jsx)(hA,{atom:n,TooltipContent:gle,chartHeight:35,chartWidth:a??1e3})]})})}],vle=(0,L.memo)(function(e){let t=R(KR),n=u0(),r=l0(t),i=d0(0,u9),a=R(t.type===`Last30`?lR:dR),o=(0,L.useMemo)(()=>s9(r,a,e.station,i.sortOn),[r,a,e.station,i]),s=n?o.slice(n.page*n.rowsPerPage,(n.page+1)*n.rowsPerPage):o,c=r?.zoomRange??(t.type===`Last30`?{start:LT(cE(),-29),end:LT(cE(),1)}:{start:t.month,end:RT(t.month,1)});return(0,H.jsx)(`div`,{children:(0,H.jsxs)(l9.Provider,{value:c,children:[(0,H.jsxs)(jw,{children:[(0,H.jsx)(n0,{columns:u9,sort:i,showDetailsCol:!1}),(0,H.jsx)(c0,{columns:u9,pageData:s,rowsPerPage:n.rowsPerPage})]}),(0,H.jsx)(s0,{tpage:n,zoom:r.zoom,count:o.length})]})})}),d9=[{id:0,numeric:!1,label:`Date`,getDisplay:e=>e.time.toLocaleString(),getForSort:e=>e.time.getTime(),getForExport:e=>e.time.toISOString()},{id:1,numeric:!1,label:`Machine`,getDisplay:e=>e.station.group+` #`+e.station.num.toString(),getForSort:e=>e.station},{id:2,numeric:!1,label:`Tool`,getDisplay:e=>e.tool},{id:3,numeric:!0,label:`Pocket`,getDisplay:e=>e.pocket===-1?``:e.pocket.toString(),getForSort:e=>e.pocket},{id:4,numeric:!1,label:`Type`,getDisplay:e=>e.type===`ReplaceBeforeCycleStart`?`Between Cycles`:`During Cycle`},{id:5,numeric:!0,label:`Use At Replacement / Start of Cycle (min)`,getDisplay:e=>{let t=e.type===`ReplaceBeforeCycleStart`?e.useAtReplacement:e.totalUseAtBeginningOfCycle;return t==null?``:c9.format(t)},getForSort:e=>e.type===`ReplaceBeforeCycleStart`?e.useAtReplacement:e.totalUseAtBeginningOfCycle},{id:6,numeric:!0,label:`Use At End of Cycle (min)`,getDisplay:e=>{if(e.type===`ReplaceBeforeCycleStart`)return``;let t=e.totalUseAtEndOfCycle;return t==null?``:c9.format(t)},getForSort:e=>e.type===`ReplaceBeforeCycleStart`?0:e.totalUseAtEndOfCycle},{id:7,numeric:!0,label:`Use At Replacement / Start of Cycle (count)`,getDisplay:e=>{let t=e.type===`ReplaceBeforeCycleStart`?e.cntAtReplacement:e.totalCntAtBeginningOfCycle;return t==null?``:c9.format(t)},getForSort:e=>e.type===`ReplaceBeforeCycleStart`?e.cntAtReplacement:e.totalCntAtBeginningOfCycle},{id:8,numeric:!0,label:`Use At End of Cycle (count)`,getDisplay:e=>{if(e.type===`ReplaceBeforeCycleStart`)return``;let t=e.totalCntAtEndOfCycle;return t==null?``:c9.format(t)},getForSort:e=>e.type===`ReplaceBeforeCycleStart`?0:e.totalCntAtEndOfCycle}],yle=(0,L.memo)(function(e){let t=R(KR),n=u0(),r=l0(t),i=d0(0,d9),a=R(t.type===`Last30`?lR:dR),o=(0,L.useMemo)(()=>o9(r,a,e.station).toSortedArray(i.sortOn),[i,r,a,e.station]),s=n?o.slice(n.page*n.rowsPerPage,(n.page+1)*n.rowsPerPage):o;return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(jw,{children:[(0,H.jsx)(n0,{columns:d9,sort:i,showDetailsCol:!1}),(0,H.jsx)(c0,{columns:d9,pageData:s})]}),(0,H.jsx)(s0,{tpage:n,zoom:r.zoom,count:o.length})]})});function ble(e,t){t===`summary`?p0(u9,s9(void 0,e,void 0,e=>e.tool)):p0(d9,o9(void 0,e,void 0).toSortedArray(e=>e.tool,e=>e.time))}var xle=(0,L.memo)(function(e){let t=R(R(KR).type===`Last30`?lR:dR),n=Array.from(t.keys());return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,value:e.station===null?-1:n.indexOf(e.station),style:{marginLeft:`1em`},onChange:t=>{let r=t.target.value;r===-1?e.setSelectedStation(null):e.setSelectedStation(n[r])},children:[(0,H.jsx)(Hx,{value:-1,children:(0,H.jsx)(`em`,{children:`Any Machine`})}),n.map((e,t)=>(0,H.jsx)(Hx,{value:t,children:(0,H.jsx)(`div`,{style:{display:`flex`,alignItems:`center`},children:(0,H.jsxs)(`span`,{style:{marginRight:`1em`},children:[e.group,` #`,e.num]})})},t))]})}),(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{onClick:()=>ble(t,e.displayType),style:{height:`25px`,paddingTop:0,paddingBottom:0},size:`large`,children:(0,H.jsx)(uT,{})})})]})}),Sle=P(null),Cle=P(`summary`),wle=(0,L.memo)(function(){JI(`Tool Replacements`);let[e,t]=B(Sle),[n,r]=B(Cle);return(0,H.jsxs)(J,{sx:{paddingLeft:`24px`,paddingRight:`24px`,paddingTop:`10px`},children:[(0,H.jsxs)(J,{component:`nav`,sx:{display:`flex`,minHeight:`2.5em`,alignItems:`center`,maxWidth:`calc(100vw - 24px - 24px)`},children:[(0,H.jsx)(q,{variant:`subtitle1`,children:`Tool Replacements`}),(0,H.jsx)(J,{sx:{flexGrow:1}}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,value:n,style:{marginLeft:`1em`},onChange:e=>r(e.target.value),children:[(0,H.jsx)(Hx,{value:`summary`,children:`Summary`}),(0,H.jsx)(Hx,{value:`details`,children:`Details`})]})}),(0,H.jsx)(xle,{station:e,setSelectedStation:t,displayType:n})]}),(0,H.jsx)(`main`,{children:n===`summary`?(0,H.jsx)(vle,{station:e}):(0,H.jsx)(yle,{station:e})})]})}),f9=P(null),Tle=150,p9=40,m9=10,h9=20,g9=10,_9=80;function v9(e){return`${e.workorderId}-${e.part}`}function y9(e){return e?new Date(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()):null}function Ele(e){let t=e.map(v9),n=Q.of(e).flatMap(e=>{let t=y9(e.simulatedFilled);return[y9(e.simulatedStart),t?LT(t,2):null]}).collect(e=>e),r=n.minBy(e=>e)??new Date,i=n.maxBy(e=>e)??LT(new Date,7),a=Math.max($T(i,r)*50,30),o=Math.max(t.length*_9,_9);return{xScale:rF().domain([r,i]).range([0,a]),yScale:$A().domain(t).range([0,o])}}function Dle({tooltip:e}){return(0,H.jsxs)(RC,{children:[(0,H.jsxs)(`div`,{children:[`Workorder: `,e.data.workorderId]}),(0,H.jsxs)(`div`,{children:[`Part: `,e.data.part]}),(0,H.jsxs)(`div`,{children:[`Due Date: `,e.data.dueDate.toLocaleDateString()]}),(0,H.jsxs)(`div`,{children:[`Priority: `,e.data.priority]}),(0,H.jsxs)(`div`,{children:[`Planned Quantity: `,e.data.plannedQuantity]}),(0,H.jsxs)(`div`,{children:[`Completed Quantity: `,e.data.completedQuantity]}),(0,H.jsxs)(`div`,{children:[`Projected Start: `,y9(e.data.simulatedStart)?.toLocaleDateString()]}),(0,H.jsxs)(`div`,{children:[`Projected Filled: `,y9(e.data.simulatedFilled)?.toLocaleDateString()]})]})}function Ole({workorders:e}){return(0,H.jsx)(`div`,{children:e.map(e=>(0,H.jsxs)(RC,{direction:`column`,sx:{height:_9,alignItems:`flex-end`,paddingRight:`10px`,justifyContent:`center`},children:[(0,H.jsx)(J,{children:e.workorderId}),(0,H.jsxs)(J,{sx:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(XU,{part:e.part,size:18}),(0,H.jsx)(J,{sx:{ml:`3px`},children:e.part})]})]},v9(e)))})}function kle({xScale:e,yScale:t}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(kA,{scale:e,top:0}),(0,H.jsx)(CA,{scale:e,height:t.range()[1]-t.range()[0]})]})}function Ale({workorders:e,xScale:t,yScale:n}){let r=z(f9),i=(0,L.useRef)(null);function a(e){return t=>{let n=rA(t);n&&(i.current!==null&&(clearTimeout(i.current),i.current=null),r({left:n.x,top:n.y,data:e}))}}let o=(0,L.useCallback)(()=>{i.current=setTimeout(()=>{r(null)},300)},[i,r]);return(0,H.jsx)(`g`,{children:e.map(e=>{let r=v9(e);return(0,H.jsx)(`g`,{onMouseOver:a(e),onMouseLeave:o,children:e.simulatedStart&&e.simulatedFilled?(0,H.jsx)(`rect`,{x:t(y9(e.simulatedStart)),y:(n(r)??0)+20,width:t(LT(y9(e.simulatedFilled),1))-t(y9(e.simulatedStart)),height:_9-40,fill:Pr[600]}):void 0},r)})})}function jle(){let e=R(NO),t=(0,L.useMemo)(()=>Q.of(e.workorders??[]).toSortedArray(e=>e.simulatedFilled?.getTime()??null,e=>e.simulatedStart?.getTime()??null,e=>e.workorderId,e=>e.part),[e.workorders]),{xScale:n,yScale:r}=Ele(t);return(0,H.jsxs)(J,{sx:{display:`flex`},children:[(0,H.jsx)(J,{sx:{height:r.range()[1]+p9+m9,width:Tle,paddingTop:`${p9}px`},children:(0,H.jsx)(Ole,{workorders:t})}),(0,H.jsxs)(J,{sx:{flexGrow:1,width:0,position:`relative`},children:[(0,H.jsx)(`div`,{style:{overflowX:`visible`},children:(0,H.jsx)(`svg`,{height:r.range()[1]+p9+m9,width:n.range()[1]+g9+h9,children:(0,H.jsxs)(`g`,{transform:`translate(${h9}, ${p9})`,children:[(0,H.jsx)(kle,{yScale:r,xScale:n}),(0,H.jsx)(Ale,{workorders:t,xScale:n,yScale:r})]})})}),(0,H.jsx)(hA,{atom:f9,TooltipContent:Dle,chartHeight:r.range()[1]+p9+m9,chartWidth:n.range()[1]+g9+h9})]})]})}var b9=P(e=>{let t=e(KI);return t.route===$.Operations_CurrentWorkorders?t.workorder??null:null},(e,t,n)=>{e(KI).route===$.Operations_CurrentWorkorders&&(n===``&&(n=null),t(KI,{route:$.Operations_CurrentWorkorders,workorder:n??void 0}))}),Mle=SO(`recentSearchedWorkorders`,[]),Nle=P(async(e,{signal:t})=>{let n=e(b9);return n===null?null:await Wt.getActiveWorkorder(n,t)??[]}),Ple=G(Vw)({"& > *":{borderBottom:`unset !important`}}),x9=new Intl.NumberFormat(void 0,{maximumFractionDigits:1}),Fle=(0,L.memo)(function({workorder:e}){let t=z(SI),n=z(E9),r=Q.ofObject(e.activeStationTime??{}).concat(Q.ofObject(e.elapsedStationTime??{})).map(([e])=>e).distinctAndSortBy(e=>e);function i(n){t({type:`MatSummary`,summary:{materialID:n.materialID,partName:e.part,serial:n.serial,workorderId:e.workorderId}})}return(0,H.jsxs)(RC,{direction:`row`,sx:{flexWrap:`wrap`,justifyContent:`space-around`,ml:`1em`,mr:`1em`},children:[(0,H.jsx)(`div`,{children:(0,H.jsxs)(jw,{size:`small`,stickyHeader:!0,children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:`Serial`}),(0,H.jsx)(Z,{children:`Quarantine?`}),(0,H.jsx)(Z,{sx:{whiteSpace:`nowrap`},children:`Inspect Failed?`}),(0,H.jsx)(Z,{sx:{whiteSpace:`nowrap`},children:`Close Out`}),(0,H.jsx)(Z,{padding:`checkbox`})]})}),(0,H.jsx)(Pw,{children:(e.material??[]).map(e=>(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:e.serial??``}),(0,H.jsx)(Z,{sx:{textAlign:`center`},padding:`checkbox`,children:e.quarantined?(0,H.jsx)(yT,{fontSize:`inherit`}):``}),(0,H.jsx)(Z,{sx:{textAlign:`center`},padding:`checkbox`,children:e.inspectionFailed?(0,H.jsx)(iT,{fontSize:`inherit`}):``}),(0,H.jsx)(Z,{sx:{textAlign:`center`},padding:`checkbox`,children:e.closeout===mt.None?``:e.closeout===mt.ClosedOut?(0,H.jsx)($w,{fontSize:`inherit`}):(0,H.jsx)(iT,{fontSize:`inherit`})}),(0,H.jsx)(Z,{padding:`checkbox`,children:(0,H.jsx)(Um,{onClick:()=>i(e),size:`large`,children:(0,H.jsx)(gT,{fontSize:`inherit`})})})]},e.materialID))})]})}),(0,H.jsx)(`div`,{children:(0,H.jsxs)(jw,{size:`small`,children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:`Station`}),(0,H.jsx)(Z,{children:`Active Minutes`}),(0,H.jsx)(Z,{children:`Elapsed Minutes`})]})}),(0,H.jsx)(Pw,{children:r.map(t=>(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:t}),(0,H.jsx)(Z,{children:x9.format(BO(e.activeStationTime?.[t]??0))}),(0,H.jsx)(Z,{children:x9.format(BO(e.elapsedStationTime?.[t]??0))})]},t))})]})}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(jw,{size:`small`,children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:`Time`}),(0,H.jsx)(Z,{children:`Comment`})]})}),(0,H.jsx)(Pw,{children:(e.comments??[]).map((e,t)=>(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:e.timeUTC.toLocaleString(void 0,{year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`})}),(0,H.jsx)(Z,{children:e.comment})]},t))})]}),(0,H.jsx)(Y,{sx:{mt:`0.5em`},onClick:()=>n(e),children:`Add Comment`})]})]})});function S9(e){return e?new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())).toLocaleDateString():``}function C9(e){return e.closeout===mt.ClosedOut?!1:e.quarantined||e.inspectionFailed||e.closeout===mt.CloseOutFailed}function Ile({workorder:e,showSim:t}){let[n,r]=(0,L.useState)(!1),i=t?10:8;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(Ple,{children:[(0,H.jsx)(Z,{children:e.workorderId}),(0,H.jsx)(Z,{children:(0,H.jsxs)(J,{sx:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(J,{sx:{mr:`0.2em`},children:(0,H.jsx)(XU,{part:e.part,size:25})}),(0,H.jsx)(`div`,{children:(0,H.jsx)(q,{variant:`body2`,component:`span`,sx:{display:`block`},children:e.part})})]})}),(0,H.jsx)(Z,{children:e.dueDate===null?``:e.dueDate.toLocaleDateString()}),(0,H.jsx)(Z,{align:`right`,children:e.priority}),(0,H.jsx)(Z,{align:`right`,children:e.plannedQuantity}),(0,H.jsx)(Z,{align:`right`,children:e.material?.length??0}),(0,H.jsx)(Z,{align:`right`,children:e.material?.filter(C9).length??0}),(0,H.jsx)(Z,{align:`right`,children:e.completedQuantity}),t?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Z,{align:`right`,children:S9(e.simulatedStart)}),(0,H.jsx)(Z,{align:`right`,children:S9(e.simulatedFilled)})]}):void 0,(0,H.jsx)(Z,{children:(0,H.jsx)(X,{title:`Show Details`,children:(0,H.jsx)(Um,{size:`small`,onClick:()=>r(!n),children:n?(0,H.jsx)(mT,{}):(0,H.jsx)(dT,{})})})})]}),(0,H.jsx)(Vw,{children:(0,H.jsx)(Z,{sx:{pb:`0`,pt:`0`},colSpan:i,children:(0,H.jsx)(zp,{in:n,timeout:`auto`,unmountOnExit:!0,children:(0,H.jsx)(Fle,{workorder:e})})})})]})}function Lle(e,t,n){let r;switch(t){case 0:r=e=>e.workorderId;break;case 1:r=e=>e.part;break;case 2:r=e=>e.plannedQuantity;break;case 3:r=e=>e.dueDate.getTime();break;case 4:r=e=>e.priority;break;case 5:r=e=>e.completedQuantity;break;case 7:r=e=>e.material?.filter(C9).length??0;break;case 6:r=e=>e.material?.length??0;break;case 8:r=e=>e.simulatedStart?.getTime()??null;break;case 9:r=e=>e.simulatedFilled?.getTime()??null;break}return Q.of(e).toSortedArray(n===`asc`?{asc:r}:{desc:r})}function Rle({sortBy:e,order:t,showSim:n}){let r=R(NO),i=R(Nle),a=(0,L.useMemo)(()=>Lle(i??r.workorders??[],e,t),[r.workorders,e,t,i]);return i&&i.length===0?(0,H.jsx)(Vw,{children:(0,H.jsx)(Z,{colSpan:n?10:8,children:`No workorders found`})}):(0,H.jsx)(H.Fragment,{children:a.map(e=>(0,H.jsx)(Ile,{workorder:e,showSim:n},`${e.workorderId}-${e.part}`))})}function zle(e,t){let n=`<table>
|
|
371
|
+
</table>`,i}function jce(e){Ak(Ace(e))}function Mce(e,t){return Q.of(e).map(([e,n])=>{let r=t.get(e)??0,i=r<1440?Math.max(n/(1440-r),0):0;return{x:e.day,y:e.station,color:Math.min(i,1),label:r<1440?(i*100).toFixed(1)+`%`:`Planned Downtime`}}).toSortedArray(e=>e.x.getTime(),{desc:e=>e.y})}var Nce=P(`Standard OEE`);function Pce(){JI(`Station OEE`);let[e,t]=B(Nce),n=R(qR),r=n.type===`Last30`?[LT(cE(),-29),LT(cE(),1)]:[n.month,RT(n.month,1)],i=R(n.type===`Last30`?uk:pk),a=R(n.type===`Last30`?Xk:Qk),o=(0,L.useMemo)(()=>{let t=p6(a);return Mce(e===`Standard OEE`?d6(i.valuesToLazySeq()):e===`Occupied`?kae(i.valuesToLazySeq()):m6(a),t)},[e,i,a]);return(0,H.jsx)(K7,{label:`Station Usage Per Day`,y_title:`Station`,label_title:e===`Occupied`?`Occupied`:`OEE`,dateRange:r,cur_selected:e,options:[`Standard OEE`,`Occupied`,`Planned OEE`],setSelected:t,points:o,onExport:()=>Mae(`Station`,o)})}var Fce=P(`Completed`);function Ice(e,t,n,r){let i=Oce(e,t,n,r);return Q.of(i).map(([e,t])=>({x:e.day,y:e.part,color:t.activeMachineMins,label:t.count.toFixed(0)+` (`+(t.activeMachineMins/60).toFixed(1)+` hours)`,count:t.count,activeMachineMins:t.activeMachineMins})).toSortedArray(e=>e.x.getTime(),{desc:e=>e.y})}function Lce(e){let t=kce(e);return Q.of(t).map(([e,t])=>({x:e.day,y:e.part,color:t.activeMachineMins,label:t.count.toFixed(0)+` (`+(t.activeMachineMins/60).toFixed(1)+` hours)`,count:t.count,activeMachineMins:t.activeMachineMins})).toSortedArray(e=>e.x.getTime(),{desc:e=>e.y})}function Rce(){JI(`Part Production`);let[e,t]=B(Fce),n=R(qR),r=n.type===`Last30`?[LT(cE(),-29),LT(cE(),1)]:[n.month,RT(n.month,1)],i=R(n.type===`Last30`?uk:pk),a=R(n.type===`Last30`?QI:Bie),o=R(n.type===`Last30`?fL:mL),s=(0,L.useMemo)(()=>{if(e===`Completed`){let e=cE(),t=n.type===`Last30`?LT(e,-30):n.month,r=n.type===`Last30`?LT(e,1):RT(n.month,1);return Ice(i.valuesToLazySeq(),o.matsById,t,r)}else return Lce(a)},[e,i,o,a,n]);return(0,H.jsx)(K7,{label:`Part Production Per Day`,y_title:`Part`,label_title:e,dateRange:r,cur_selected:e,options:[`Completed`,`Planned`],setSelected:t,points:s,onExport:()=>jce(s)})}var X7=new Intl.DateTimeFormat(void 0,{weekday:`short`,month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`});function zce(e){return`material`in e&&Array.isArray(e.material)}function Bce(e){return`operations`in e&&(e.operations===void 0||Array.isArray(e.operations))}function Z7({range:e}){let t=R(qR);if(!e)return null;let n=`start`in e?e.start:e[0],r=`end`in e?e.end:e[1];return t.type===`SpecificMonth`?n.toDateString()+` to `+r.toDateString():X7.format(n)+` to `+X7.format(r)}var Vce=P(!0),Hce=vO(e=>e(GI)?{part:`aaa`,proc:2}:void 0),Uce=P(Nk),Wce=P(void 0),Gce=P(void 0),Q7=P(void 0),$7=P(eO.empty()),Kce=P(e=>{let t=e(qR);return t.type===`Last30`?e(Q7):e($7).get(t.month)},(e,t,n)=>{let r=e(qR);r.type===`Last30`?t(Q7,n):t($7,e=>e.alter(r.month,()=>n))}),qce=P(null);function Jce(){JI(`Machine Cycles`);let e=z(SI),t=(0,L.useCallback)(function(t){if(!zce(t))return[];let n=[];for(let r of t.material)n.push({title:r.serial?r.serial:`Material`,value:`Open Card`,link:()=>e({type:`LogMat`,logMat:r})});return n},[e]),n=R(qR),r=R(n.type===`Last30`?UO:GO),i=R(n.type===`Last30`?fL:mL),[a,o]=B(Vce),[s,c]=B(Hce),[l,u]=B(Uce),[d,f]=B(Wce),[p,m]=B(Gce),[h,g]=B(Kce),[_,v]=B(qce),y=n.type===`Last30`?[LT(cE(),-29),LT(cE(),1)]:[n.month,RT(n.month,1)],b=R(n.type===`Last30`?uk:pk),x=(0,L.useMemo)(()=>s?d?Ik(b.valuesToLazySeq(),{partAndProc:s,pallet:p,operation:d}):Ik(b.valuesToLazySeq(),{partAndProc:s,pallet:p,station:Nk}):p||l!==`@@@_FMSInsight_FilterAnyMachineKey_@@@`?Ik(b.valuesToLazySeq(),{pallet:p,station:l}):Fk(b.valuesToLazySeq()),[s,p,l,d,b]),S=s?d??(x.allMachineOperations.length===1?x.allMachineOperations[0]:void 0):void 0,C=(0,L.useMemo)(()=>{if(S)return Rk(x,!1)},[x,S]);return(0,H.jsxs)(J,{sx:{paddingLeft:`24px`,paddingRight:`24px`,paddingTop:`10px`},children:[(0,H.jsxs)(J,{component:`nav`,sx:{display:`flex`,minHeight:`2.5em`,alignItems:`center`,maxWidth:`calc(100vw - 24px - 24px)`},children:[(0,H.jsxs)(q,{variant:`subtitle1`,children:[`Machine Cycles for `,(0,H.jsx)(Z7,{range:h??y})]}),(0,H.jsx)(J,{sx:{flexGrow:1}}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,value:a?`graph`:`table`,onChange:e=>o(e.target.value===`graph`),children:[(0,H.jsx)(Hx,{value:`graph`,children:`Graph`},`graph`),(0,H.jsx)(Hx,{value:`table`,children:`Table`},`table`)]})}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,displayEmpty:!0,value:s?x.allPartAndProcNames.findIndex(e=>s.part===e.part&&s.proc===e.proc):-1,style:{marginLeft:`1em`},onChange:e=>{c(e.target.value===-1?void 0:x.allPartAndProcNames[e.target.value]),f(void 0)},children:[(0,H.jsx)(Hx,{value:-1,children:(0,H.jsx)(`em`,{children:`Any Part`})},0),x.allPartAndProcNames.map((e,t)=>(0,H.jsx)(Hx,{value:t,children:(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(ZU,{part:e.part,size:20}),(0,H.jsxs)(`span`,{style:{marginRight:`1em`},children:[e.part,`-`,e.proc]})]})},t))]})}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsx)(YS,{autoWidth:!0,displayEmpty:!0,value:s?S?x.allMachineOperations.findIndex(e=>S.compare(e)===0):-1:l,style:{marginLeft:`1em`},onChange:e=>{if(s){let t=typeof e.target.value==`number`?e.target.value:Number.parseInt(e.target.value,10);Number.isNaN(t)||f(t===-1?void 0:x.allMachineOperations[t])}else typeof e.target.value==`string`&&u(e.target.value)},children:s?[...x.allMachineOperations.length===1?[]:[(0,H.jsx)(Hx,{value:-1,children:(0,H.jsx)(`em`,{children:`Any Operation`})},-1)],...x.allMachineOperations.map((e,t)=>(0,H.jsxs)(Hx,{value:t,children:[e.statGroup,` `,e.operation]},t))]:[(0,H.jsx)(Hx,{value:Nk,children:(0,H.jsx)(`em`,{children:`Any Machine`})},-1),x.allMachineNames.map(e=>(0,H.jsx)(Hx,{value:e,children:(0,H.jsx)(`div`,{style:{display:`flex`,alignItems:`center`},children:(0,H.jsx)(`span`,{style:{marginRight:`1em`},children:e})})},e))]})}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,displayEmpty:!0,value:p||``,style:{marginLeft:`1em`},onChange:e=>m(e.target.value===``?void 0:e.target.value),children:[(0,H.jsx)(Hx,{value:``,children:(0,H.jsx)(`em`,{children:`Any Pallet`})},0),x.allPalletNames.map(e=>(0,H.jsx)(Hx,{value:e,children:(0,H.jsx)(`div`,{style:{display:`flex`,alignItems:`center`},children:(0,H.jsx)(`span`,{style:{marginRight:`1em`},children:e})})},e))]})}),x.data.size>0?(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{onClick:()=>Hk(x,i.matsById,h),style:{height:`25px`,paddingTop:0,paddingBottom:0},size:`large`,children:(0,H.jsx)(uT,{})})}):void 0]}),(0,H.jsx)(`main`,{children:a?(0,H.jsx)(g7,{points:x.data,series_label:x.seriesLabel,default_date_range:y,extra_tooltip:t,current_date_zoom:h,set_date_zoom_range:e=>g(e.zoom),yZoom:_,setYZoom:v,stats:S?r.get(S):void 0,partCntPerPoint:S?Q.of(x.data).head()?.[1]?.[0]?.material?.length:void 0,plannedTimeMinutes:C}):(0,H.jsx)(o6,{points:x.data,matsById:i.matsById,period:n,current_date_zoom:h,set_date_zoom_range:e=>g(e.zoom),showWorkorderAndInspect:!0,emptyMessage:s||p||d?`No Cycles`:`Select part, station, or pallet to see cycles.`})})]})}var Yce=P(!0),Xce=vO(e=>e(GI)?{part:`aaa`,proc:2}:void 0),Zce=vO(e=>e(GI)?`LoadOp`:`LULOccupancy`),Qce=P(Pk),$ce=P(`Any`),ele=P(void 0),e9=P(void 0),t9=P(eO.empty()),tle=P(e=>{let t=e(qR);return t.type===`Last30`?e(e9):e(t9).get(t.month)},(e,t,n)=>{let r=e(qR);r.type===`Last30`?t(e9,n):t(t9,e=>e.alter(r.month,()=>n))}),nle=P(null);function rle(){JI(`L/U Cycles`);let e=z(SI),t=(0,L.useCallback)(function(t){if(!Bce(t))return[];let n=[];if(t.operations)for(let r of t.operations)n.push({title:(r.mat.serial?r.mat.serial:`Material`)+` `+r.operation,value:`Open Card`,link:()=>e({type:`LogMat`,logMat:r.mat})});return n},[e]),n=R(qR),[r,i]=B(Yce),[a,o]=B(Xce),[s,c]=B(Zce),[l,u]=B(Qce),[d,f]=B($ce),[p,m]=B(ele),[h,g]=B(tle),[_,v]=B(nle),y=R(br),b=ok(y.basketName),x=R(n.type===`Last30`?dk:Jre),S=jk(d,x),C=(0,L.useMemo)(()=>a&&s===`LoadOp`?new VO(a.part,`L/U`,`LOAD-${a.proc}`):a&&s===`UnloadOp`?new VO(a.part,`L/U`,`UNLOAD-${a.proc}`):null,[a,s]),w=n.type===`Last30`?[LT(cE(),-29),LT(cE(),1)]:[n.month,RT(n.month,1)],T=R(n.type===`Last30`?uk:pk),E=R(n.type===`Last30`?fL:mL),D=R(n.type===`Last30`?UO:GO),O=(0,L.useMemo)(()=>a||p||l!==`@@@_FMSInsigt_FilterAnyLoadKey_@@@`||S!==`Any`?C?Ik(T.valuesToLazySeq(),{operation:C,pallet:p,station:l,carrierKind:S}):r?Lk(T.valuesToLazySeq(),{partAndProc:a,pallet:p,station:l,carrierKind:S}):Ik(T.valuesToLazySeq(),{partAndProc:a,pallet:p,station:l,carrierKind:S}):Fk(T.valuesToLazySeq()),[a,p,C,l,T,r,S]),ee=(0,L.useMemo)(()=>{if(s===`LoadOp`||s===`UnloadOp`)return Rk(O,!0)},[O,s]);return(0,H.jsxs)(J,{sx:{paddingLeft:`24px`,paddingRight:`24px`,paddingTop:`10px`},children:[(0,H.jsxs)(J,{component:`nav`,sx:{display:`flex`,minHeight:`2.5em`,alignItems:`center`,maxWidth:`calc(100vw - 24px - 24px)`},children:[(0,H.jsxs)(q,{variant:`subtitle1`,children:[`Load/Unload Cycles for `,(0,H.jsx)(Z7,{range:h??w})]}),(0,H.jsx)(J,{sx:{flexGrow:1}}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,value:r?`graph`:`table`,onChange:e=>i(e.target.value===`graph`),children:[(0,H.jsx)(Hx,{value:`graph`,children:`Graph`},`graph`),(0,H.jsx)(Hx,{value:`table`,children:`Table`},`table`)]})}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,displayEmpty:!0,value:a?O.allPartAndProcNames.findIndex(e=>a.part===e.part&&a.proc===e.proc):-1,style:{marginLeft:`1em`},onChange:e=>{e.target.value===-1?(o(void 0),c(`LULOccupancy`)):o(e.target.value===-1?void 0:O.allPartAndProcNames[e.target.value])},children:[(0,H.jsx)(Hx,{value:-1,children:(0,H.jsx)(`em`,{children:`Any Part`})},0),O.allPartAndProcNames.map((e,t)=>(0,H.jsx)(Hx,{value:t,children:(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(ZU,{part:e.part,size:20}),(0,H.jsxs)(`span`,{style:{marginRight:`1em`},children:[e.part,`-`,e.proc]})]})},t))]})}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,displayEmpty:!0,value:s,style:{marginLeft:`1em`},onChange:e=>c(e.target.value),children:[(0,H.jsx)(Hx,{value:`LULOccupancy`,children:`L/U Occupancy`}),a?(0,H.jsx)(Hx,{value:`LoadOp`,children:`Load Operation (estimated)`}):void 0,a?(0,H.jsx)(Hx,{value:`UnloadOp`,children:`Unload Operation (estimated)`}):void 0]})}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,displayEmpty:!0,value:l,style:{marginLeft:`1em`},onChange:e=>{u(e.target.value)},children:[(0,H.jsx)(Hx,{value:Pk,children:(0,H.jsx)(`em`,{children:`Any Station`})},-1),O.allLoadStationNames.map(e=>(0,H.jsx)(Hx,{value:e,children:(0,H.jsx)(`div`,{style:{display:`flex`,alignItems:`center`},children:(0,H.jsx)(`span`,{style:{marginRight:`1em`},children:e})})},e))]})}),x?(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,displayEmpty:!0,value:S,style:{marginLeft:`1em`},onChange:e=>{let t=e.target.value;f(t),t===`Basket`&&m(void 0)},children:[(0,H.jsx)(Hx,{value:`Any`,children:(0,H.jsx)(`em`,{children:`Any Carrier`})}),(0,H.jsx)(Hx,{value:`Pallet`,children:`Pallet`}),(0,H.jsx)(Hx,{value:`Basket`,children:b})]})}):void 0,S===`Basket`?void 0:(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,displayEmpty:!0,value:p||``,style:{marginLeft:`1em`},onChange:e=>m(e.target.value===``?void 0:e.target.value),children:[(0,H.jsx)(Hx,{value:``,children:(0,H.jsx)(`em`,{children:`Any Pallet`})},0),O.allPalletNames.map(e=>(0,H.jsx)(Hx,{value:e,children:(0,H.jsx)(`div`,{style:{display:`flex`,alignItems:`center`},children:(0,H.jsx)(`span`,{style:{marginRight:`1em`},children:e})})},e))]})}),O.data.size>0?(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{onClick:()=>Hk(O,E.matsById,h,s===`LULOccupancy`,y.loadStationNames,b),style:{height:`25px`,paddingTop:0,paddingBottom:0},size:`large`,children:(0,H.jsx)(uT,{})})}):void 0]}),(0,H.jsx)(`main`,{children:r?(0,H.jsx)(g7,{points:O.data,series_label:O.seriesLabel,default_date_range:w,extra_tooltip:t,current_date_zoom:h,set_date_zoom_range:e=>g(e.zoom),yZoom:_,setYZoom:v,stats:C?D.get(C):void 0,plannedTimeMinutes:ee}):(0,H.jsx)(o6,{points:O.data,matsById:E.matsById,period:n,current_date_zoom:h,set_date_zoom_range:e=>g(e.zoom),showWorkorderAndInspect:!0,hideMedian:s===`LULOccupancy`,emptyMessage:a||p?`No Cycles`:`Select part, operation, or pallet to see cycles.`})})]})}var n9=vO(e=>e(GI)?3:void 0),r9=P(void 0),ile=P(void 0),ale=P(null);function ole(e){return`mats`in e&&Array.isArray(e.mats)}var sle=P(e=>{let t=e(n9),n=e(r9);if(!t&&!n)return new Map;let r=e(e(qR).type===`Last30`?UL:GL);if(t){let e=r.get(t)?.valuesToLazySeq()??Q.of([]);return n&&(e=e.filter(e=>e.mats.some(e=>e.part===n.part&&e.proc===n.proc))),new Map([[t.toString(),Array.from(e)]])}else if(n)return Q.of(r).collect(([e,t])=>{let r=t.valuesToLazySeq().filter(e=>e.mats.some(e=>e.part===n.part&&e.proc===n.proc)).toRArray();return r.length>0?[e,r]:null}).toRMap(([e,t])=>[e.toString(),t]);else return new Map}),cle=P(e=>{let t=e(e(qR).type===`Last30`?UL:GL);return Q.of(t).flatMap(([,e])=>e).flatMap(([,e])=>e.mats).distinctAndSortBy(e=>e.part,e=>e.proc).map(e=>({part:e.part,proc:e.proc})).toRArray()});function lle(){JI(`Pallet Cycles`);let[e,t]=B(n9),[n,r]=B(r9),[i,a]=B(ile),[o,s]=B(ale),c=R(qR),l=c.type===`Last30`?[LT(cE(),-29),LT(cE(),1)]:[c.month,RT(c.month,1)],u=R(c.type===`Last30`?UL:GL),d=R(sle),f=R(cle),p=z(SI),m=(0,L.useCallback)(function(e){return ole(e)?e.mats.map(e=>({title:e.part+`-`+e.proc,value:e.serial??``,link:e.serial?()=>p({type:`LogMat`,logMat:e}):void 0})):[]},[p]);return(0,H.jsxs)(J,{sx:{paddingLeft:`24px`,paddingRight:`24px`,paddingTop:`10px`},children:[(0,H.jsxs)(J,{component:`nav`,sx:{display:`flex`,minHeight:`2.5em`,alignItems:`center`,maxWidth:`calc(100vw - 24px - 24px)`},children:[(0,H.jsx)(q,{variant:`subtitle1`,children:`Pallet Cycles`}),(0,H.jsx)(J,{sx:{flexGrow:1}}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,displayEmpty:!0,value:e??-1,onChange:e=>t(e.target.value===-1?void 0:e.target.value),children:[(0,H.jsx)(Hx,{value:-1,children:(0,H.jsx)(`em`,{children:`Any Pallet`})},0),u.keysToLazySeq().sortBy(e=>e).map(e=>(0,H.jsx)(Hx,{value:e,children:(0,H.jsx)(`div`,{style:{display:`flex`,alignItems:`center`},children:(0,H.jsx)(`span`,{style:{marginRight:`1em`},children:e})})},e))]})}),f.length>0?(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,displayEmpty:!0,value:n?f.findIndex(e=>n.part===e.part&&n.proc===e.proc):-1,style:{marginLeft:`1em`},onChange:e=>{r(e.target.value===-1?void 0:f[e.target.value])},children:[(0,H.jsx)(Hx,{value:-1,children:(0,H.jsx)(`em`,{children:`Any Part`})},0),f.map((e,t)=>(0,H.jsx)(Hx,{value:t,children:(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(ZU,{part:e.part,size:20}),(0,H.jsxs)(`span`,{style:{marginRight:`1em`},children:[e.part,`-`,e.proc]})]})},t))]})}):void 0,(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{onClick:()=>Wk(u),style:{height:`25px`,paddingTop:0,paddingBottom:0},size:`large`,children:(0,H.jsx)(uT,{})})})]}),(0,H.jsx)(`main`,{children:(0,H.jsx)(g7,{points:d,series_label:`Pallet`,default_date_range:l,current_date_zoom:i,set_date_zoom_range:e=>a(e.zoom),yZoom:o,setYZoom:s,extra_tooltip:m})})]})}var i9=P(void 0),a9=P(void 0),ule=P(void 0);function dle(e){return`mats`in e&&Array.isArray(e.mats)}var fle=P(null),ple=P(e=>{let t=e(i9),n=e(a9);if(!t&&!n)return new Map;let r=e(e(qR).type===`Last30`?ZL:eR);if(t){let e=r.get(t)?.valuesToLazySeq()??Q.of([]);return n&&(e=e.filter(e=>e.mats.some(e=>e.part===n.part&&e.proc===n.proc))),new Map([[t.toString(),Array.from(e)]])}else if(n)return Q.of(r).collect(([e,t])=>{let r=t.valuesToLazySeq().filter(e=>e.mats.some(e=>e.part===n.part&&e.proc===n.proc)).toRArray();return r.length>0?[e,r]:null}).toRMap(([e,t])=>[e.toString(),t]);else return new Map}),mle=P(e=>{let t=e(e(qR).type===`Last30`?ZL:eR);return Q.of(t).flatMap(([,e])=>e).flatMap(([,e])=>e.mats).distinctAndSortBy(e=>e.part,e=>e.proc).map(e=>({part:e.part,proc:e.proc})).toRArray()});function hle(){let e=ok(R(br).basketName);JI(`${e} Cycles`);let[t,n]=B(i9),[r,i]=B(a9),[a,o]=B(ule),[s,c]=B(fle),l=R(qR),u=l.type===`Last30`?[LT(cE(),-29),LT(cE(),1)]:[l.month,RT(l.month,1)],d=R(l.type===`Last30`?ZL:eR),f=R(ple),p=R(mle),m=z(SI),h=(0,L.useCallback)(function(e){return dle(e)?e.mats.map(e=>({title:e.part+`-`+e.proc,value:e.serial??``,link:e.serial?()=>m({type:`LogMat`,logMat:e}):void 0})):[]},[m]);return(0,H.jsxs)(J,{sx:{paddingLeft:`24px`,paddingRight:`24px`,paddingTop:`10px`},children:[(0,H.jsxs)(J,{component:`nav`,sx:{display:`flex`,minHeight:`2.5em`,alignItems:`center`,maxWidth:`calc(100vw - 24px - 24px)`},children:[(0,H.jsxs)(q,{variant:`subtitle1`,children:[e,` Cycles`]}),(0,H.jsx)(J,{sx:{flexGrow:1}}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,displayEmpty:!0,value:t??-1,onChange:e=>n(e.target.value===-1?void 0:e.target.value),children:[(0,H.jsx)(Hx,{value:-1,children:(0,H.jsxs)(`em`,{children:[`Any `,e]})},0),d.keysToLazySeq().sortBy(e=>e).map(e=>(0,H.jsx)(Hx,{value:e,children:(0,H.jsx)(`div`,{style:{display:`flex`,alignItems:`center`},children:(0,H.jsx)(`span`,{style:{marginRight:`1em`},children:e})})},e))]})}),p.length>0?(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,displayEmpty:!0,value:r?p.findIndex(e=>r.part===e.part&&r.proc===e.proc):-1,style:{marginLeft:`1em`},onChange:e=>{i(e.target.value===-1?void 0:p[e.target.value])},children:[(0,H.jsx)(Hx,{value:-1,children:(0,H.jsx)(`em`,{children:`Any Part`})},0),p.map((e,t)=>(0,H.jsx)(Hx,{value:t,children:(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(ZU,{part:e.part,size:20}),(0,H.jsxs)(`span`,{style:{marginRight:`1em`},children:[e.part,`-`,e.proc]})]})},t))]})}):void 0,(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{onClick:()=>Wk(d,e),style:{height:`25px`,paddingTop:0,paddingBottom:0},size:`large`,children:(0,H.jsx)(uT,{})})})]}),(0,H.jsx)(`main`,{children:(0,H.jsx)(g7,{points:f,series_label:e,default_date_range:u,current_date_zoom:a,set_date_zoom_range:e=>o(e.zoom),yZoom:s,setYZoom:c,extra_tooltip:h})})]})}function o9(e,t,n){let r=e?.zoomRange;return n?(t.get(n)??eO.empty()).valuesToAscLazySeq().transform(e=>r?e.filter(e=>e.time>=r.start&&e.time<=r.end):e).flatMap(e=>e.replacements.map(t=>({...t,station:n,time:e.time}))):t.toAscLazySeq().flatMap(([e,t])=>t.valuesToAscLazySeq().transform(e=>r?e.filter(e=>e.time>=r.start&&e.time<=r.end):e).flatMap(t=>t.replacements.map(n=>({...n,station:e,time:t.time}))))}function s9(e,t,n,r){return o9(e,t,n).groupBy(e=>e.tool).map(([e,t])=>{let n=0,r=null,i=0,a=null;for(let e of t){let t=e.type===`ReplaceBeforeCycleStart`?e.useAtReplacement:e.totalUseAtBeginningOfCycle;t&&(r===null||t>r)&&(r=t),t&&(n+=t);let o=e.type===`ReplaceBeforeCycleStart`?e.cntAtReplacement:e.totalCntAtBeginningOfCycle;o&&(a===null||o>a)&&(a=o),o&&(i+=o)}return{tool:e,numReplacements:t.length,totalUseOfAllReplacements:n,totalCntOfAllReplacements:i,maxY:r??a??1,yAxisType:r===null?`Count`:`Time`,replacements:t}}).toSortedArray(r)}function gle(e,t){let n=e.maxY/2;return t.type===`ReplaceBeforeCycleStart`?e.yAxisType===`Time`?t.useAtReplacement??n:t.cntAtReplacement??n:e.yAxisType===`Time`?t.totalUseAtBeginningOfCycle??n:t.totalCntAtBeginningOfCycle??n}var c9=Intl.NumberFormat(void 0,{maximumFractionDigits:1}),l9=(0,L.createContext)({start:new Date,end:new Date});function _le({tooltip:e}){return(0,H.jsxs)(RC,{spacing:.5,children:[(0,H.jsxs)(`div`,{children:[`Tool: `,e.r.tool]}),(0,H.jsxs)(`div`,{children:[`Pocket: `,e.r.pocket]}),(0,H.jsxs)(`div`,{children:[`Time: `,e.r.time.toLocaleString()]}),(0,H.jsxs)(`div`,{children:[`Station: `,e.r.station.group,` #`,e.r.station.num]}),e.r.type===`ReplaceBeforeCycleStart`?(0,H.jsxs)(H.Fragment,{children:[e.r.useAtReplacement===null?void 0:(0,H.jsxs)(`div`,{children:[`Minutes at replacement: `,c9.format(e.r.useAtReplacement)]}),e.r.cntAtReplacement===null?void 0:(0,H.jsxs)(`div`,{children:[`Count at replacement: `,c9.format(e.r.cntAtReplacement)]})]}):(0,H.jsxs)(H.Fragment,{children:[e.r.totalUseAtBeginningOfCycle===null?void 0:(0,H.jsxs)(`div`,{children:[`Minutes at beginning of cycle:`,` `,c9.format(e.r.totalUseAtBeginningOfCycle)]}),e.r.totalUseAtEndOfCycle===null?void 0:(0,H.jsxs)(`div`,{children:[`Minutes at end of cycle: `,c9.format(e.r.totalUseAtEndOfCycle)]}),e.r.totalCntAtBeginningOfCycle===null?void 0:(0,H.jsxs)(`div`,{children:[`Count at beginning of cycle:`,` `,c9.format(e.r.totalCntAtBeginningOfCycle)]}),e.r.totalCntAtEndOfCycle===null?void 0:(0,H.jsxs)(`div`,{children:[`Count at end of cycle: `,c9.format(e.r.totalCntAtEndOfCycle)]})]})]})}function vle({row:e,tooltip:t,timeScale:n,yScale:r}){let[i,a]=B(t);return(0,H.jsx)(`g`,{children:e.replacements.map((t,o)=>(0,H.jsx)(`circle`,{cx:n(t.time),cy:r(gle(e,t)),r:t===i?.r?4:2,onMouseEnter:e=>a({top:0,left:rA(e)?.x??0,r:t}),fill:`black`},o))})}var u9=[{id:0,numeric:!1,label:`Tool`,getDisplay:e=>e.tool},{id:1,numeric:!0,label:`Num Replacements`,getDisplay:e=>e.numReplacements.toString(),getForSort:e=>e.numReplacements},{id:2,numeric:!0,label:`Avg Use (min) at Replacement`,getDisplay:e=>c9.format(e.totalUseOfAllReplacements/e.numReplacements),getForSort:e=>e.totalUseOfAllReplacements/e.numReplacements},{id:3,numeric:!0,label:`Avg Use (count) at Replacement`,getDisplay:e=>c9.format(e.totalCntOfAllReplacements/e.numReplacements),getForSort:e=>e.totalCntOfAllReplacements/e.numReplacements},{id:4,numeric:!1,ignoreDuringExport:!0,label:`All Replacements`,getDisplay:()=>``,expanded:!0,Cell:(0,L.memo)(function({row:e}){let t=(0,L.useContext)(l9),n=(0,L.useMemo)(()=>P(null),[]),r=z(n),{ref:i,width:a}=pA({refreshMode:`debounce`,refreshRate:100,handleHeight:!1}),o=iF().domain([t.start,t.end]).range([0,a??1e3]),s=VM().domain([0,e.maxY]).range([33,3]),c=e.numReplacements===0?null:s(e.totalUseOfAllReplacements/e.numReplacements);return(0,H.jsxs)(`div`,{ref:i,style:{position:`relative`,width:`100%`,height:`35px`},children:[(0,H.jsxs)(`svg`,{height:`35`,width:a??1e3,onMouseLeave:()=>r(null),children:[c===null?void 0:(0,H.jsx)(`line`,{x1:`0`,y1:c,x2:a??1e3,y2:c,stroke:`red`,strokeWidth:.5}),(0,H.jsx)(vle,{row:e,tooltip:n,timeScale:o,yScale:s})]}),(0,H.jsx)(hA,{atom:n,TooltipContent:_le,chartHeight:35,chartWidth:a??1e3})]})})}],yle=(0,L.memo)(function(e){let t=R(qR),n=d0(),r=u0(t),i=f0(0,u9),a=R(t.type===`Last30`?lR:dR),o=(0,L.useMemo)(()=>s9(r,a,e.station,i.sortOn),[r,a,e.station,i]),s=n?o.slice(n.page*n.rowsPerPage,(n.page+1)*n.rowsPerPage):o,c=r?.zoomRange??(t.type===`Last30`?{start:LT(cE(),-29),end:LT(cE(),1)}:{start:t.month,end:RT(t.month,1)});return(0,H.jsx)(`div`,{children:(0,H.jsxs)(l9.Provider,{value:c,children:[(0,H.jsxs)(jw,{children:[(0,H.jsx)(r0,{columns:u9,sort:i,showDetailsCol:!1}),(0,H.jsx)(l0,{columns:u9,pageData:s,rowsPerPage:n.rowsPerPage})]}),(0,H.jsx)(c0,{tpage:n,zoom:r.zoom,count:o.length})]})})}),d9=[{id:0,numeric:!1,label:`Date`,getDisplay:e=>e.time.toLocaleString(),getForSort:e=>e.time.getTime(),getForExport:e=>e.time.toISOString()},{id:1,numeric:!1,label:`Machine`,getDisplay:e=>e.station.group+` #`+e.station.num.toString(),getForSort:e=>e.station},{id:2,numeric:!1,label:`Tool`,getDisplay:e=>e.tool},{id:3,numeric:!0,label:`Pocket`,getDisplay:e=>e.pocket===-1?``:e.pocket.toString(),getForSort:e=>e.pocket},{id:4,numeric:!1,label:`Type`,getDisplay:e=>e.type===`ReplaceBeforeCycleStart`?`Between Cycles`:`During Cycle`},{id:5,numeric:!0,label:`Use At Replacement / Start of Cycle (min)`,getDisplay:e=>{let t=e.type===`ReplaceBeforeCycleStart`?e.useAtReplacement:e.totalUseAtBeginningOfCycle;return t==null?``:c9.format(t)},getForSort:e=>e.type===`ReplaceBeforeCycleStart`?e.useAtReplacement:e.totalUseAtBeginningOfCycle},{id:6,numeric:!0,label:`Use At End of Cycle (min)`,getDisplay:e=>{if(e.type===`ReplaceBeforeCycleStart`)return``;let t=e.totalUseAtEndOfCycle;return t==null?``:c9.format(t)},getForSort:e=>e.type===`ReplaceBeforeCycleStart`?0:e.totalUseAtEndOfCycle},{id:7,numeric:!0,label:`Use At Replacement / Start of Cycle (count)`,getDisplay:e=>{let t=e.type===`ReplaceBeforeCycleStart`?e.cntAtReplacement:e.totalCntAtBeginningOfCycle;return t==null?``:c9.format(t)},getForSort:e=>e.type===`ReplaceBeforeCycleStart`?e.cntAtReplacement:e.totalCntAtBeginningOfCycle},{id:8,numeric:!0,label:`Use At End of Cycle (count)`,getDisplay:e=>{if(e.type===`ReplaceBeforeCycleStart`)return``;let t=e.totalCntAtEndOfCycle;return t==null?``:c9.format(t)},getForSort:e=>e.type===`ReplaceBeforeCycleStart`?0:e.totalCntAtEndOfCycle}],ble=(0,L.memo)(function(e){let t=R(qR),n=d0(),r=u0(t),i=f0(0,d9),a=R(t.type===`Last30`?lR:dR),o=(0,L.useMemo)(()=>o9(r,a,e.station).toSortedArray(i.sortOn),[i,r,a,e.station]),s=n?o.slice(n.page*n.rowsPerPage,(n.page+1)*n.rowsPerPage):o;return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(jw,{children:[(0,H.jsx)(r0,{columns:d9,sort:i,showDetailsCol:!1}),(0,H.jsx)(l0,{columns:d9,pageData:s})]}),(0,H.jsx)(c0,{tpage:n,zoom:r.zoom,count:o.length})]})});function xle(e,t){t===`summary`?m0(u9,s9(void 0,e,void 0,e=>e.tool)):m0(d9,o9(void 0,e,void 0).toSortedArray(e=>e.tool,e=>e.time))}var Sle=(0,L.memo)(function(e){let t=R(R(qR).type===`Last30`?lR:dR),n=Array.from(t.keys());return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,value:e.station===null?-1:n.indexOf(e.station),style:{marginLeft:`1em`},onChange:t=>{let r=t.target.value;r===-1?e.setSelectedStation(null):e.setSelectedStation(n[r])},children:[(0,H.jsx)(Hx,{value:-1,children:(0,H.jsx)(`em`,{children:`Any Machine`})}),n.map((e,t)=>(0,H.jsx)(Hx,{value:t,children:(0,H.jsx)(`div`,{style:{display:`flex`,alignItems:`center`},children:(0,H.jsxs)(`span`,{style:{marginRight:`1em`},children:[e.group,` #`,e.num]})})},t))]})}),(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{onClick:()=>xle(t,e.displayType),style:{height:`25px`,paddingTop:0,paddingBottom:0},size:`large`,children:(0,H.jsx)(uT,{})})})]})}),Cle=P(null),wle=P(`summary`),Tle=(0,L.memo)(function(){JI(`Tool Replacements`);let[e,t]=B(Cle),[n,r]=B(wle);return(0,H.jsxs)(J,{sx:{paddingLeft:`24px`,paddingRight:`24px`,paddingTop:`10px`},children:[(0,H.jsxs)(J,{component:`nav`,sx:{display:`flex`,minHeight:`2.5em`,alignItems:`center`,maxWidth:`calc(100vw - 24px - 24px)`},children:[(0,H.jsx)(q,{variant:`subtitle1`,children:`Tool Replacements`}),(0,H.jsx)(J,{sx:{flexGrow:1}}),(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{autoWidth:!0,value:n,style:{marginLeft:`1em`},onChange:e=>r(e.target.value),children:[(0,H.jsx)(Hx,{value:`summary`,children:`Summary`}),(0,H.jsx)(Hx,{value:`details`,children:`Details`})]})}),(0,H.jsx)(Sle,{station:e,setSelectedStation:t,displayType:n})]}),(0,H.jsx)(`main`,{children:n===`summary`?(0,H.jsx)(yle,{station:e}):(0,H.jsx)(ble,{station:e})})]})}),f9=P(null),Ele=150,p9=40,m9=10,h9=20,g9=10,_9=80;function v9(e){return`${e.workorderId}-${e.part}`}function y9(e){return e?new Date(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()):null}function Dle(e){let t=e.map(v9),n=Q.of(e).flatMap(e=>{let t=y9(e.simulatedFilled);return[y9(e.simulatedStart),t?LT(t,2):null]}).collect(e=>e),r=n.minBy(e=>e)??new Date,i=n.maxBy(e=>e)??LT(new Date,7),a=Math.max($T(i,r)*50,30),o=Math.max(t.length*_9,_9);return{xScale:iF().domain([r,i]).range([0,a]),yScale:$A().domain(t).range([0,o])}}function Ole({tooltip:e}){return(0,H.jsxs)(RC,{children:[(0,H.jsxs)(`div`,{children:[`Workorder: `,e.data.workorderId]}),(0,H.jsxs)(`div`,{children:[`Part: `,e.data.part]}),(0,H.jsxs)(`div`,{children:[`Due Date: `,e.data.dueDate.toLocaleDateString()]}),(0,H.jsxs)(`div`,{children:[`Priority: `,e.data.priority]}),(0,H.jsxs)(`div`,{children:[`Planned Quantity: `,e.data.plannedQuantity]}),(0,H.jsxs)(`div`,{children:[`Completed Quantity: `,e.data.completedQuantity]}),(0,H.jsxs)(`div`,{children:[`Projected Start: `,y9(e.data.simulatedStart)?.toLocaleDateString()]}),(0,H.jsxs)(`div`,{children:[`Projected Filled: `,y9(e.data.simulatedFilled)?.toLocaleDateString()]})]})}function kle({workorders:e}){return(0,H.jsx)(`div`,{children:e.map(e=>(0,H.jsxs)(RC,{direction:`column`,sx:{height:_9,alignItems:`flex-end`,paddingRight:`10px`,justifyContent:`center`},children:[(0,H.jsx)(J,{children:e.workorderId}),(0,H.jsxs)(J,{sx:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(ZU,{part:e.part,size:18}),(0,H.jsx)(J,{sx:{ml:`3px`},children:e.part})]})]},v9(e)))})}function Ale({xScale:e,yScale:t}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(kA,{scale:e,top:0}),(0,H.jsx)(CA,{scale:e,height:t.range()[1]-t.range()[0]})]})}function jle({workorders:e,xScale:t,yScale:n}){let r=z(f9),i=(0,L.useRef)(null);function a(e){return t=>{let n=rA(t);n&&(i.current!==null&&(clearTimeout(i.current),i.current=null),r({left:n.x,top:n.y,data:e}))}}let o=(0,L.useCallback)(()=>{i.current=setTimeout(()=>{r(null)},300)},[i,r]);return(0,H.jsx)(`g`,{children:e.map(e=>{let r=v9(e);return(0,H.jsx)(`g`,{onMouseOver:a(e),onMouseLeave:o,children:e.simulatedStart&&e.simulatedFilled?(0,H.jsx)(`rect`,{x:t(y9(e.simulatedStart)),y:(n(r)??0)+20,width:t(LT(y9(e.simulatedFilled),1))-t(y9(e.simulatedStart)),height:_9-40,fill:Pr[600]}):void 0},r)})})}function Mle(){let e=R(NO),t=(0,L.useMemo)(()=>Q.of(e.workorders??[]).toSortedArray(e=>e.simulatedFilled?.getTime()??null,e=>e.simulatedStart?.getTime()??null,e=>e.workorderId,e=>e.part),[e.workorders]),{xScale:n,yScale:r}=Dle(t);return(0,H.jsxs)(J,{sx:{display:`flex`},children:[(0,H.jsx)(J,{sx:{height:r.range()[1]+p9+m9,width:Ele,paddingTop:`${p9}px`},children:(0,H.jsx)(kle,{workorders:t})}),(0,H.jsxs)(J,{sx:{flexGrow:1,width:0,position:`relative`},children:[(0,H.jsx)(`div`,{style:{overflowX:`visible`},children:(0,H.jsx)(`svg`,{height:r.range()[1]+p9+m9,width:n.range()[1]+g9+h9,children:(0,H.jsxs)(`g`,{transform:`translate(${h9}, ${p9})`,children:[(0,H.jsx)(Ale,{yScale:r,xScale:n}),(0,H.jsx)(jle,{workorders:t,xScale:n,yScale:r})]})})}),(0,H.jsx)(hA,{atom:f9,TooltipContent:Ole,chartHeight:r.range()[1]+p9+m9,chartWidth:n.range()[1]+g9+h9})]})]})}var b9=P(e=>{let t=e(KI);return t.route===$.Operations_CurrentWorkorders?t.workorder??null:null},(e,t,n)=>{e(KI).route===$.Operations_CurrentWorkorders&&(n===``&&(n=null),t(KI,{route:$.Operations_CurrentWorkorders,workorder:n??void 0}))}),Nle=SO(`recentSearchedWorkorders`,[]),Ple=P(async(e,{signal:t})=>{let n=e(b9);return n===null?null:await Wt.getActiveWorkorder(n,t)??[]}),Fle=G(Vw)({"& > *":{borderBottom:`unset !important`}}),x9=new Intl.NumberFormat(void 0,{maximumFractionDigits:1}),Ile=(0,L.memo)(function({workorder:e}){let t=z(SI),n=z(E9),r=Q.ofObject(e.activeStationTime??{}).concat(Q.ofObject(e.elapsedStationTime??{})).map(([e])=>e).distinctAndSortBy(e=>e);function i(n){t({type:`MatSummary`,summary:{materialID:n.materialID,partName:e.part,serial:n.serial,workorderId:e.workorderId}})}return(0,H.jsxs)(RC,{direction:`row`,sx:{flexWrap:`wrap`,justifyContent:`space-around`,ml:`1em`,mr:`1em`},children:[(0,H.jsx)(`div`,{children:(0,H.jsxs)(jw,{size:`small`,stickyHeader:!0,children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:`Serial`}),(0,H.jsx)(Z,{children:`Quarantine?`}),(0,H.jsx)(Z,{sx:{whiteSpace:`nowrap`},children:`Inspect Failed?`}),(0,H.jsx)(Z,{sx:{whiteSpace:`nowrap`},children:`Close Out`}),(0,H.jsx)(Z,{padding:`checkbox`})]})}),(0,H.jsx)(Pw,{children:(e.material??[]).map(e=>(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:e.serial??``}),(0,H.jsx)(Z,{sx:{textAlign:`center`},padding:`checkbox`,children:e.quarantined?(0,H.jsx)(yT,{fontSize:`inherit`}):``}),(0,H.jsx)(Z,{sx:{textAlign:`center`},padding:`checkbox`,children:e.inspectionFailed?(0,H.jsx)(iT,{fontSize:`inherit`}):``}),(0,H.jsx)(Z,{sx:{textAlign:`center`},padding:`checkbox`,children:e.closeout===mt.None?``:e.closeout===mt.ClosedOut?(0,H.jsx)($w,{fontSize:`inherit`}):(0,H.jsx)(iT,{fontSize:`inherit`})}),(0,H.jsx)(Z,{padding:`checkbox`,children:(0,H.jsx)(Um,{onClick:()=>i(e),size:`large`,children:(0,H.jsx)(gT,{fontSize:`inherit`})})})]},e.materialID))})]})}),(0,H.jsx)(`div`,{children:(0,H.jsxs)(jw,{size:`small`,children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:`Station`}),(0,H.jsx)(Z,{children:`Active Minutes`}),(0,H.jsx)(Z,{children:`Elapsed Minutes`})]})}),(0,H.jsx)(Pw,{children:r.map(t=>(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:t}),(0,H.jsx)(Z,{children:x9.format(BO(e.activeStationTime?.[t]??0))}),(0,H.jsx)(Z,{children:x9.format(BO(e.elapsedStationTime?.[t]??0))})]},t))})]})}),(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(jw,{size:`small`,children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:`Time`}),(0,H.jsx)(Z,{children:`Comment`})]})}),(0,H.jsx)(Pw,{children:(e.comments??[]).map((e,t)=>(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:e.timeUTC.toLocaleString(void 0,{year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`})}),(0,H.jsx)(Z,{children:e.comment})]},t))})]}),(0,H.jsx)(Y,{sx:{mt:`0.5em`},onClick:()=>n(e),children:`Add Comment`})]})]})});function S9(e){return e?new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())).toLocaleDateString():``}function C9(e){return e.closeout===mt.ClosedOut?!1:e.quarantined||e.inspectionFailed||e.closeout===mt.CloseOutFailed}function Lle({workorder:e,showSim:t}){let[n,r]=(0,L.useState)(!1),i=t?10:8;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(Fle,{children:[(0,H.jsx)(Z,{children:e.workorderId}),(0,H.jsx)(Z,{children:(0,H.jsxs)(J,{sx:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(J,{sx:{mr:`0.2em`},children:(0,H.jsx)(ZU,{part:e.part,size:25})}),(0,H.jsx)(`div`,{children:(0,H.jsx)(q,{variant:`body2`,component:`span`,sx:{display:`block`},children:e.part})})]})}),(0,H.jsx)(Z,{children:e.dueDate===null?``:e.dueDate.toLocaleDateString()}),(0,H.jsx)(Z,{align:`right`,children:e.priority}),(0,H.jsx)(Z,{align:`right`,children:e.plannedQuantity}),(0,H.jsx)(Z,{align:`right`,children:e.material?.length??0}),(0,H.jsx)(Z,{align:`right`,children:e.material?.filter(C9).length??0}),(0,H.jsx)(Z,{align:`right`,children:e.completedQuantity}),t?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Z,{align:`right`,children:S9(e.simulatedStart)}),(0,H.jsx)(Z,{align:`right`,children:S9(e.simulatedFilled)})]}):void 0,(0,H.jsx)(Z,{children:(0,H.jsx)(X,{title:`Show Details`,children:(0,H.jsx)(Um,{size:`small`,onClick:()=>r(!n),children:n?(0,H.jsx)(mT,{}):(0,H.jsx)(dT,{})})})})]}),(0,H.jsx)(Vw,{children:(0,H.jsx)(Z,{sx:{pb:`0`,pt:`0`},colSpan:i,children:(0,H.jsx)(zp,{in:n,timeout:`auto`,unmountOnExit:!0,children:(0,H.jsx)(Ile,{workorder:e})})})})]})}function Rle(e,t,n){let r;switch(t){case 0:r=e=>e.workorderId;break;case 1:r=e=>e.part;break;case 2:r=e=>e.plannedQuantity;break;case 3:r=e=>e.dueDate.getTime();break;case 4:r=e=>e.priority;break;case 5:r=e=>e.completedQuantity;break;case 7:r=e=>e.material?.filter(C9).length??0;break;case 6:r=e=>e.material?.length??0;break;case 8:r=e=>e.simulatedStart?.getTime()??null;break;case 9:r=e=>e.simulatedFilled?.getTime()??null;break}return Q.of(e).toSortedArray(n===`asc`?{asc:r}:{desc:r})}function zle({sortBy:e,order:t,showSim:n}){let r=R(NO),i=R(Ple),a=(0,L.useMemo)(()=>Rle(i??r.workorders??[],e,t),[r.workorders,e,t,i]);return i&&i.length===0?(0,H.jsx)(Vw,{children:(0,H.jsx)(Z,{colSpan:n?10:8,children:`No workorders found`})}):(0,H.jsx)(H.Fragment,{children:a.map(e=>(0,H.jsx)(Lle,{workorder:e,showSim:n},`${e.workorderId}-${e.part}`))})}function Ble(e,t){let n=`<table>
|
|
372
372
|
<thead><tr>`;n+=`<th>Workorder</th>`,n+=`<th>Part</th>`,n+=`<th>Due Date</th>`,n+=`<th>Priority</th>`,n+=`<th>Planned Qty</th>`,n+=`<th>Completed Qty</th>`,t&&(n+=`<th>Simulated Start</th>`,n+=`<th>Simulated Filled</th>`),n+=`<th>Serials</th>`,n+=`<th>Active Time (mins)</th>`,n+=`<th>Elapsed Time (mins)</th>`,n+=`</tr></thead>
|
|
373
373
|
<tbody>
|
|
374
374
|
`;for(let r of e)n+=`<tr>`,n+=`<td>${r.workorderId}</td>`,n+=`<td>${r.part}</td>`,n+=`<td>${r.dueDate===null?``:r.dueDate.toLocaleDateString()}</td>`,n+=`<td>${r.priority}</td>`,n+=`<td>${r.plannedQuantity}</td>`,n+=`<td>${r.completedQuantity}</td>`,t&&(n+=`<td>${S9(r.simulatedStart)}</td>`,n+=`<td>${S9(r.simulatedFilled)}</td>`),n+=`<td>${(r.material??[]).map(e=>e.serial??``).join(`;`)}</td>`,n+=`<td>${Q.ofObject(r.activeStationTime??{}).map(([e,t])=>`${e}: ${BO(t)}`).toRArray().join(`;`)}</td>`,n+=`<td>${Q.ofObject(r.elapsedStationTime??{}).map(([e,t])=>`${e}: ${BO(t)}`).toRArray().join(`;`)}</td>`,n+=`</tr>
|
|
375
375
|
`;n+=`</tbody></table>
|
|
376
|
-
`,Ak(n)}function w9(e){return(0,H.jsxs)(Z,{align:e.align,sortDirection:e.sortBy===e.col&&e.order,children:[(0,H.jsx)(X,{title:`Sort`,enterDelay:300,children:(0,H.jsx)(Uw,{active:e.sortBy===e.col,direction:e.order,onClick:()=>{e.col===e.sortBy?e.setOrder(e.order===`asc`?`desc`:`asc`):(e.setSortBy(e.col),e.setOrder(`asc`))},children:e.children})}),e.extraIcon]})}var T9=P(`table`),
|
|
376
|
+
`,Ak(n)}function w9(e){return(0,H.jsxs)(Z,{align:e.align,sortDirection:e.sortBy===e.col&&e.order,children:[(0,H.jsx)(X,{title:`Sort`,enterDelay:300,children:(0,H.jsx)(Uw,{active:e.sortBy===e.col,direction:e.order,onClick:()=>{e.col===e.sortBy?e.setOrder(e.order===`asc`?`desc`:`asc`):(e.setSortBy(e.col),e.setOrder(`asc`))},children:e.children})}),e.extraIcon]})}var T9=P(`table`),Vle=(0,L.memo)(function({showSim:e}){let[t,n]=B(T9);return(0,H.jsxs)(RC,{direction:`row`,spacing:2,sx:{justifyContent:`flex-end`,alignItems:`center`},children:[e?(0,H.jsxs)(RC,{direction:`row`,spacing:2,sx:{alignItems:`center`,flexGrow:1},children:[(0,H.jsx)(DT,{fontSize:`small`}),(0,H.jsx)(q,{variant:`caption`,children:`Projected dates are estimates`})]}):void 0,(0,H.jsx)(_y,{size:`small`,children:(0,H.jsxs)(YS,{variant:`outlined`,value:t,onChange:e=>n(e.target.value),children:[(0,H.jsx)(Hx,{value:`table`,children:`Table`}),(0,H.jsx)(Hx,{value:`gantt`,children:`Gantt`})]})})]})}),Hle=Fa`
|
|
377
377
|
0% {
|
|
378
378
|
transform: rotate(0deg);
|
|
379
379
|
}
|
|
380
380
|
100% {
|
|
381
381
|
transform: rotate(360deg);
|
|
382
382
|
}
|
|
383
|
-
`,Hle=G(Dre)(()=>({animation:`${Vle} 1.5s linear infinite`}));function Ule(){let[e,t]=(0,L.useState)(!1),[n,r]=(0,L.useTransition)(),[i,a]=B(b9),[o,s]=(0,L.useState)(null),[c,l]=B(Mle);function u(e){e!==null&&e!==``&&(r(()=>{a(e)}),t(!1),s(null),l(t=>{let n=t.filter(t=>t!==e);return n.unshift(e),n.slice(0,5)}))}return(0,H.jsxs)(H.Fragment,{children:[n?(0,H.jsx)(X,{title:`Searching.... Click to cancel`,children:(0,H.jsx)(Um,{size:`small`,onClick:()=>a(null),children:(0,H.jsx)(Hle,{fontSize:`inherit`})})}):i?(0,H.jsx)(X,{title:`Clear Search`,children:(0,H.jsx)(Um,{size:`small`,onClick:()=>a(null),children:(0,H.jsx)(eT,{fontSize:`inherit`})})}):(0,H.jsx)(X,{title:`Search`,children:(0,H.jsx)(Um,{size:`small`,onClick:e=>{t(!0),e.currentTarget.blur()},children:(0,H.jsx)(bT,{fontSize:`inherit`})})}),(0,H.jsxs)(cy,{open:e,onClose:()=>t(!1),children:[(0,H.jsx)(dy,{children:`Search Workorder`}),(0,H.jsxs)(uy,{children:[(0,H.jsx)(Kw,{variant:`outlined`,fullWidth:!0,autoFocus:!0,sx:{mt:`0.5em`,minWidth:`15em`},label:`Workorder ID`,value:o??``,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(u(o),e.preventDefault())}}),c.length>0?(0,H.jsx)(H.Fragment,{children:(0,H.jsx)(pb,{dense:!0,sx:{mt:`1em`},subheader:(0,H.jsx)(m_,{children:`Previous Searches`}),children:c.map(e=>(0,H.jsx)(Db,{onClick:()=>u(e),children:(0,H.jsx)(vb,{children:(0,H.jsx)(Lb,{primary:e})})},e))})}):void 0]}),(0,H.jsxs)(ly,{children:[(0,H.jsx)(Y,{color:`primary`,onClick:()=>u(o),children:`Search`}),(0,H.jsx)(Y,{color:`secondary`,onClick:()=>t(!1),children:`Cancel`})]})]})]})}var Wle=(0,L.memo)(function(e){let t={sortBy:e.sortBy,setSortBy:e.setSortBy,order:e.order,setOrder:e.setOrder};return(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(w9,{align:`left`,col:0,...t,extraIcon:e.disableSearch?void 0:(0,H.jsx)(Ule,{}),children:`Workorder`}),(0,H.jsx)(w9,{align:`left`,col:1,...t,children:`Part`}),(0,H.jsx)(w9,{align:`left`,col:3,...t,children:`Due Date`}),(0,H.jsx)(w9,{align:`right`,col:4,...t,children:`Priority`}),(0,H.jsx)(w9,{align:`right`,col:2,...t,children:`Planned Quantity`}),(0,H.jsx)(w9,{align:`right`,col:6,...t,children:`Started Quantity`}),(0,H.jsx)(w9,{align:`right`,col:7,...t,children:`Abnormal Quantity`}),(0,H.jsx)(w9,{align:`right`,col:5,...t,children:`Completed Quantity`}),e.showSim?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(w9,{align:`right`,col:8,...t,children:`Projected Start`}),(0,H.jsx)(w9,{align:`right`,col:9,...t,children:`Projected Filled`})]}):void 0,(0,H.jsx)(Z,{children:(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{style:{height:`25px`,paddingTop:0,paddingBottom:0},size:`large`,onClick:()=>zle(e.workorders,e.showSim),children:(0,H.jsx)(uT,{})})})})]})})}),E9=P(null);function Gle(){let[e,t]=B(E9),[n,r]=(0,L.useState)(null),i=z(IO);function a(){t(null),r(null)}function o(){e&&n&&n!==``&&i({workorder:e.workorderId,comment:n}),a()}return(0,H.jsx)(cy,{open:e!==null,onClose:a,children:e===null?void 0:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(dy,{children:(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(`div`,{children:(0,H.jsx)(XU,{part:e.part,size:40})}),(0,H.jsxs)(`div`,{style:{marginLeft:`1em`,flexGrow:1},children:[`Add Comment For `,e.workorderId]})]})}),(0,H.jsx)(uy,{children:(0,H.jsx)(Kw,{variant:`outlined`,sx:{mt:`1em`},fullWidth:!0,autoFocus:!0,value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&n!==null&&n!==``&&(o(),e.preventDefault())}})}),(0,H.jsxs)(ly,{children:[(0,H.jsx)(Y,{color:`primary`,onClick:o,children:`Save Comment`}),(0,H.jsx)(Y,{color:`primary`,onClick:a,children:`Cancel`})]})]})})}function Kle(){let[e,t]=B(b9);return(0,H.jsx)(Vw,{children:(0,H.jsx)(Z,{colSpan:10,children:(0,H.jsxs)(RC,{direction:`column`,sx:{mt:`3em`,flex:`flex`,alignItems:`center`,width:`100%`},children:[(0,H.jsxs)(RC,{direction:`row`,spacing:`3`,children:[(0,H.jsx)(Lm,{}),e&&e!==``?(0,H.jsxs)(q,{variant:`h6`,children:[`Searching for workorder `,e]}):(0,H.jsx)(q,{variant:`h6`,children:`Searching`})]}),(0,H.jsx)(Y,{onClick:()=>t(null),children:`Cancel`})]})})})}function qle({showSim:e,disableSearch:t}){let[n,r]=(0,L.useState)(0),[i,a]=(0,L.useState)(`asc`),o=R(NO);return(0,H.jsxs)(jw,{stickyHeader:!0,children:[(0,H.jsx)(Wle,{workorders:o?.workorders??[],sortBy:n,setSortBy:r,showSim:e,order:i,setOrder:a,disableSearch:t}),(0,H.jsx)(Pw,{children:(0,H.jsx)(L.Suspense,{fallback:(0,H.jsx)(Kle,{}),children:(0,H.jsx)(Rle,{sortBy:n,order:i,showSim:e})})})]})}function Jle(){let e=z(K0),t=R(TI),[n,r]=LI(),i=z(SI);if(t===null||t.materialID<0)return null;function a(e){t!==null&&(n({mat:t,operator:`Manager`,failed:e}),i(null))}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Y,{color:`primary`,disabled:r,onClick:()=>a(!0),children:`Fail CloseOut`}),(0,H.jsx)(Y,{color:`primary`,disabled:r,onClick:()=>a(!1),children:`Pass CloseOut`}),(0,H.jsx)(Y,{color:`primary`,onClick:()=>e(!0),children:`Change Workorder`})]})}var Yle=(0,L.memo)(function(){return(0,H.jsx)(TW,{buttons:(0,H.jsx)(Jle,{})})}),D9=(0,L.memo)(function({disableSearch:e}){JI(`Workorders`);let t=R(NO),n=R(T9),r=(0,L.useMemo)(()=>t.workorders?.some(e=>!!e.simulatedStart||!!e.simulatedFilled)??!1,[t.workorders]);return(0,H.jsxs)(J,{component:`main`,sx:{padding:`24px`},children:[r?(0,H.jsx)(Ble,{showSim:r}):void 0,n===`table`?(0,H.jsx)(qle,{showSim:r,disableSearch:e}):(0,H.jsx)(jle,{}),(0,H.jsx)(Gle,{}),(0,H.jsx)(Yle,{}),(0,H.jsx)(Z0,{})]})}),Xle=Pr[50],Zle=Pr[600],Qle=Lr[100],O9=`3em`,$le=`calc(${O9} * 7)`,eue=P(e=>{let t=e(_R);return t===null?null:Q.of(t.usage).toLookupOrderedMap(e=>e.machineGroup,e=>new Date(e.day.getUTCFullYear(),e.day.getUTCMonth(),e.day.getUTCDate()))}),tue=P(e=>{let t=e(_R);return t===null?QD.empty():QD.build(t.usage,e=>e.machineGroup)}),nue=P(e=>{let t=e(_R);return t===null?QD.empty():QD.build(t.usage,e=>new Date(e.day.getUTCFullYear(),e.day.getUTCMonth(),1))}),rue=P(e=>{let t=e(_R);return t===null?0:Q.of(t.usage).map(e=>Math.ceil(e.usage)).maxBy(e=>e)??1}),iue=P(e=>{let t=e(_R);return t===null?[null,null]:[Q.of(t.usage).map(e=>new Date(e.day.getUTCFullYear(),e.day.getUTCMonth(),e.day.getUTCDate())).minBy(e=>e)??null,Q.of(t.usage).map(e=>new Date(e.day.getUTCFullYear(),e.day.getUTCMonth(),e.day.getUTCDate())).maxBy(e=>e)??null]});function aue({date:e,dayColor:t,tooltip:n}){let r=new Date(e.getFullYear(),e.getMonth(),1).getDay(),i=new Date(e.getFullYear(),e.getMonth()+1,0).getDate();return(0,H.jsxs)(J,{sx:{width:$le},children:[(0,H.jsx)(q,{variant:`h6`,sx:{textAlign:`center`},children:e.toLocaleString(`default`,{month:`long`,year:`numeric`})}),(0,H.jsxs)(J,{sx:{display:`flex`,flexWrap:`wrap`},children:[Q.ofRange(0,r).map((e,t)=>(0,H.jsx)(J,{sx:{height:O9,width:O9}},t)),Q.ofRange(1,i+1).map((r,i)=>(0,H.jsx)(`div`,{style:{width:O9,height:O9,cursor:`default`,backgroundColor:t(new Date(e.getFullYear(),e.getMonth(),r))},children:(0,H.jsx)(X,{title:n(new Date(e.getFullYear(),e.getMonth(),r)),children:(0,H.jsx)(J,{sx:{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100%`},children:r})})},i))]})]})}function oue(){return(0,H.jsxs)(RC,{direction:`row`,spacing:2,sx:{alignItems:`center`},children:[(0,H.jsx)(DT,{fontSize:`small`}),(0,H.jsx)(q,{variant:`caption`,children:`Projected dates are estimates`})]})}function sue({group:e,month:t}){let n=R(eue),[r,i]=R(iue),a=R(rue),o=(0,L.useMemo)(()=>{let t=VM().domain([0,a]).range([Xle,Zle]);return a=>{if(i&&a>i||r&&a<r)return`white`;let o=n?.get(e)?.get(a);return o?t(o.usage):Qle}},[n,a,r,i,e]);function s(t){let a=n?.get(e)?.get(t);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{children:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}),i&&t>i?(0,H.jsx)(`div`,{children:`Not Simulated`}):r&&t<r?(0,H.jsx)(`div`,{}):a?(0,H.jsxs)(`div`,{children:[`Usage: `,a.usage.toFixed(2)]}):(0,H.jsx)(`div`,{children:`Downtime`})]})}return(0,H.jsx)(aue,{date:t,dayColor:o,tooltip:s})}function cue(){JI(`Projected Machine Usage`);let e=R(tue),t=R(nue);return(0,H.jsx)(J,{component:`main`,sx:{padding:`24px`},children:(0,H.jsxs)(RC,{direction:`column`,spacing:5,children:[(0,H.jsx)(oue,{}),e.toAscLazySeq().map(e=>(0,H.jsxs)(`div`,{children:[(0,H.jsx)(q,{variant:`h4`,children:e}),(0,H.jsx)(J,{sx:{display:`flex`,flexWrap:`wrap`,columnGap:`50px`},children:t.toAscLazySeq().map(t=>(0,H.jsx)(sue,{group:e,month:t},t.getTime()))})]},e))]})})}function lue(){let e=z(K0),t=R(TI),[n,r]=LI(),i=z(SI);if(t===null||t.materialID<0)return null;function a(e){t!==null&&(n({mat:t,operator:`Manager`,failed:e}),i(null))}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Y,{color:`primary`,disabled:r,onClick:()=>a(!0),children:`Fail CloseOut`}),(0,H.jsx)(Y,{color:`primary`,disabled:r,onClick:()=>a(!1),children:`Pass CloseOut`}),(0,H.jsx)(Y,{color:`primary`,onClick:()=>e(!0),children:`Change Workorder`})]})}var uue=(0,L.memo)(function(){return(0,H.jsx)(TW,{buttons:(0,H.jsx)(lue,{})})}),due=new Intl.DateTimeFormat(void 0,{weekday:`long`,month:`long`,day:`numeric`,year:`numeric`});function fue({day:e,setDay:t}){let n=cE();return(0,H.jsxs)(RC,{direction:`row`,spacing:2,sx:{alignItems:`center`},children:[(0,H.jsx)(X,{title:`Previous Day`,children:(0,H.jsx)(`div`,{children:(0,H.jsx)(Um,{disabled:e<=LT(n,-28),onClick:()=>t(e=>LT(e,-1)),children:(0,H.jsx)(CT,{})})})}),(0,H.jsx)(q,{sx:{minWidth:`14em`,textAlign:`center`},children:due.format(e)}),(0,H.jsx)(X,{title:`Next Day`,children:(0,H.jsx)(`div`,{children:(0,H.jsx)(Um,{disabled:e>=n,onClick:()=>t(e=>LT(e,1)),children:(0,H.jsx)(ST,{})})})})]})}function pue(e,t,n){let r;switch(t){case 0:r=e=>e.last_unload_time??null;break;case 2:r=e=>e.partName;break;case 1:r=e=>e.serial??null;break;case 3:r=e=>e.workorderId??null;break;case 4:r=e=>e.closeout_failed??null;break;case 5:r=e=>e.closeout_completed??null}return Q.of(e).toSortedArray(n===`asc`?{asc:r}:{desc:r},{asc:e=>e.last_unload_time??null})}function mue({sortBy:e,setSortBy:t,sortOrder:n,setSortOrder:r}){function i(i){i===e?r(n===`asc`?`desc`:`asc`):(t(i),r(`asc`))}return(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{sortDirection:e===0&&n,children:(0,H.jsx)(Uw,{active:e===0,direction:n,onClick:()=>i(0),children:`Completed Time`})}),(0,H.jsx)(Z,{sortDirection:e===1&&n,children:(0,H.jsx)(Uw,{active:e===1,direction:n,onClick:()=>i(1),children:`Serial`})}),(0,H.jsx)(Z,{sortDirection:e===2&&n,children:(0,H.jsx)(Uw,{active:e===2,direction:n,onClick:()=>i(2),children:`Part`})}),(0,H.jsx)(Z,{sortDirection:e===3&&n,children:(0,H.jsx)(Uw,{active:e===3,direction:n,onClick:()=>i(3),children:`Workorder`})}),(0,H.jsx)(Z,{sortDirection:e===4&&n,children:(0,H.jsx)(Uw,{active:e===4,direction:n,onClick:()=>i(4),children:`Closeout`})}),(0,H.jsx)(Z,{sortDirection:e===5&&n,children:(0,H.jsx)(Uw,{active:e===5,direction:n,onClick:()=>i(5),children:`Closeout Time`})}),(0,H.jsx)(Z,{})]})}var hue=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`numeric`,second:`numeric`}),gue=new Intl.DateTimeFormat(void 0,{year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`}),_ue=(0,L.memo)(function({mat:e}){let t=z(SI);return(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:e.last_unload_time?hue.format(e.last_unload_time):``}),(0,H.jsx)(Z,{children:e.serial}),(0,H.jsx)(Z,{children:(0,H.jsxs)(RC,{direction:`row`,spacing:`2`,sx:{alignItems:`center`},children:[(0,H.jsx)(XU,{part:e.partName,size:25}),(0,H.jsx)(q,{variant:`body2`,children:e.partName})]})}),(0,H.jsx)(Z,{children:e.workorderId}),(0,H.jsx)(Z,{children:e.closeout_completed===null||e.closeout_completed===void 0?``:e.closeout_failed?(0,H.jsx)(iT,{fontSize:`inherit`}):(0,H.jsx)($w,{fontSize:`inherit`})}),(0,H.jsx)(Z,{children:e.closeout_completed?gue.format(e.closeout_completed):``}),(0,H.jsx)(Z,{padding:`checkbox`,children:e.serial!==null&&e.serial!==``?(0,H.jsx)(Um,{onClick:()=>{e.serial&&t({type:`ManuallyEnteredSerial`,serial:e.serial})},size:`large`,children:(0,H.jsx)(gT,{fontSize:`inherit`})}):void 0})]})});function vue({day:e}){let t=R(fL),n=(0,L.useMemo)(()=>{let n=LT(e,1),r=[];for(let i of t.matsById.values())i.completed_last_proc_machining===!0&&i.last_unload_time&&i.last_unload_time>=e&&i.last_unload_time<n&&r.push(i);return r},[t,e]),[r,i]=(0,L.useState)(0),[a,o]=(0,L.useState)(`asc`),s=(0,L.useMemo)(()=>pue(n,r,a),[n,r,a]);return(0,H.jsxs)(jw,{stickyHeader:!0,children:[(0,H.jsx)(Lw,{children:(0,H.jsx)(mue,{sortBy:r,setSortBy:i,sortOrder:a,setSortOrder:o})}),(0,H.jsx)(Pw,{children:s.map(e=>(0,H.jsx)(_ue,{mat:e},e.materialID))})]})}function yue(){JI(`Close Out`);let[e,t]=(0,L.useState)(cE());return(0,H.jsxs)(J,{sx:{padding:`24px`},children:[(0,H.jsx)(J,{component:`nav`,sx:{display:`flex`,justifyContent:`center`},children:(0,H.jsx)(fue,{day:e,setDay:t})}),(0,H.jsx)(`main`,{children:(0,H.jsx)(vue,{day:e})}),(0,H.jsx)(Z0,{}),(0,H.jsx)(uue,{})]})}var k9=P(!1),A9=P(!1),j9=P(!1),M9=[{id:0,numeric:!1,label:`ID`,getDisplay:e=>e.bookingId,Cell:({row:e})=>e.canceled?(0,H.jsx)(q,{sx:{textDecoration:`line-through`,fontSize:`inherit`},children:e.bookingId}):e.bookingId},{id:1,numeric:!1,label:`Part`,getDisplay:e=>e.partName,Cell:({row:e})=>(0,H.jsxs)(RC,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[(0,H.jsx)(XU,{part:e.partName,size:25}),e.partName]})},{id:2,numeric:!0,label:`Quantity`,getDisplay:e=>e.quantity.toString(),getForSort:e=>e.quantity},{id:3,numeric:!1,label:`Request Time`,getDisplay:e=>e.timeUTC.toLocaleString(),getForSort:e=>e.timeUTC.getTime()},{id:4,numeric:!1,label:`Priority`,getDisplay:e=>e.priority?e.priority.toString():``,getForSort:e=>e.priority??0},{id:5,numeric:!1,label:`Workorder`,getDisplay:e=>e.workorder??``},{id:6,numeric:!1,label:`Canceled`,getDisplay:e=>e.canceled?.toLocaleString()??``,getForSort:e=>e.canceled?.getTime()??0,openFilterDialog:k9},{id:7,numeric:!1,label:`Scheduled Job`,getDisplay:e=>e.job??``,openFilterDialog:k9},{id:8,numeric:!1,label:`Scheduled Time`,getDisplay:e=>e.schTime?e.schTime.toLocaleString():``,getForSort:e=>e.schTime?e.schTime.getTime():0}],bue=(0,L.memo)(function({setRebookingToShow:e}){let t=d0(3,M9,`desc`),n=u0(),r=R(CR),i=R(TR),a=R(DR),o=R(A9),s=R(j9),c=(0,L.useMemo)(()=>r.adjust(a,(e,t)=>e?{...e,job:t?.jobUnique,schTime:t?.scheduledTime}:void 0).adjust(i,(e,t)=>e?{...e,canceled:t}:void 0).valuesToAscLazySeq().transform(e=>o?e.filter(e=>!e.job):e).transform(e=>s?e.filter(e=>!e.canceled):e).toSortedArray(t.sortOn),[t.sortOn,r,i,a,o,s]);return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(jw,{children:[(0,H.jsx)(n0,{columns:M9,sort:t,showDetailsCol:!0,copyToClipboardRows:c}),(0,H.jsx)(c0,{columns:M9,pageData:c,rowsPerPage:n.rowsPerPage,onClickDetails:(t,n)=>e(n)})]}),(0,H.jsx)(s0,{tpage:n,count:c.length})]})}),N9=new Intl.DateTimeFormat(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`numeric`,minute:`numeric`}),xue=(0,L.memo)(function({rebooking:e,close:t}){let[n,r]=NR();function i(){e&&n(e.bookingId).then(()=>t(void 0)).catch(console.log)}return(0,H.jsxs)(cy,{open:e!==void 0,onClose:()=>t(void 0),children:[(0,H.jsx)(dy,{children:e?.canceled?(0,H.jsx)(q,{sx:{textDecoration:`line-through`},children:e?.bookingId}):e?.bookingId}),(0,H.jsx)(uy,{children:(0,H.jsxs)(RC,{direction:`column`,spacing:1,children:[e?.canceled&&(0,H.jsxs)(q,{variant:`h5`,children:[`Canceled at `,N9.format(e.canceled)]}),(0,H.jsxs)(RC,{direction:`row`,spacing:1,children:[(0,H.jsx)(`span`,{children:`Part:`}),e?.partName&&(0,H.jsx)(XU,{part:e?.partName,size:25}),(0,H.jsx)(`span`,{children:e?.partName})]}),(0,H.jsxs)(q,{children:[`Quantity: `,e?.quantity]}),(0,H.jsxs)(q,{children:[`Request Time: `,N9.format(e?.timeUTC)]}),(0,H.jsxs)(q,{children:[`Priority: `,e?.priority]}),e?.workorder&&(0,H.jsxs)(q,{children:[`Workorder: `,e?.workorder]}),(0,H.jsxs)(q,{children:[`Note: `,e?.notes]}),e?.job&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(py,{}),(0,H.jsxs)(q,{children:[`Scheduled Job: `,e?.job]}),(0,H.jsxs)(q,{children:[`Scheduled Time: `,e?.schTime?.toLocaleString()]})]})]})}),(0,H.jsxs)(ly,{children:[!e?.canceled&&!e?.job&&(0,H.jsxs)(Y,{onClick:i,color:`secondary`,disabled:r,children:[r?(0,H.jsx)(Lm,{size:24}):void 0,`Cancel Rebooking Request`]}),(0,H.jsx)(Y,{onClick:()=>t(void 0),children:`Close`})]})]})}),Sue=P(e=>Q.ofObject(e(NO).jobs).map(([e,t])=>t.partName).concat(e(sO).valuesToLazySeq().map(e=>e.partName)).distinctAndSortBy(e=>e).toRArray()),Cue=(0,L.memo)(function(){let[e,t]=(0,L.useState)(!1),[n,r]=(0,L.useState)({part:``}),i=R(Sue),[a,o]=PR(),s=n.part!==``&&!!n.qty&&!isNaN(n.qty);function c(){t(!1),r({part:``})}function l(){s&&a(n).then(c).catch(console.log)}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(cy,{open:e,onClose:c,children:[(0,H.jsx)(dy,{children:`Create New`}),(0,H.jsx)(uy,{children:(0,H.jsxs)(RC,{direction:`column`,spacing:2,sx:{mt:`0.5em`,minWidth:`25em`},children:[(0,H.jsx)(nte,{freeSolo:!0,selectOnFocus:!0,clearOnBlur:!0,handleHomeEndKeys:!0,disableClearable:!0,options:i,value:n.part,onChange:(e,t)=>r(e=>({...e,part:t})),renderInput:e=>(0,H.jsx)(Kw,{...e,label:`Part Name`,slotProps:{input:{...e.slotProps.input,startAdornment:(0,H.jsxs)(H.Fragment,{children:[n.part===``?void 0:(0,H.jsx)(Iy,{position:`start`,children:(0,H.jsx)(XU,{part:n.part,size:25})}),e.slotProps.input?.startAdornment]})}}}),renderOption:(e,t)=>(0,H.jsx)(`li`,{...e,children:(0,H.jsxs)(RC,{direction:`row`,spacing:`1`,sx:{alignItems:`center`},children:[(0,H.jsx)(XU,{part:t,size:25}),t]})}),filterOptions:(e,t)=>{let n=e.filter(e=>e.toLowerCase().includes(t.inputValue.toLowerCase()));return n.length===0&&t.inputValue!==``?[t.inputValue]:n}}),(0,H.jsx)(Kw,{label:`Quantity`,type:`number`,value:n.qty&&!isNaN(n.qty)?n.qty:``,onChange:e=>r(t=>({...t,qty:parseInt(e.target.value)}))}),(0,H.jsx)(Kw,{label:`Priority (optional)`,type:`number`,value:n.priority&&!isNaN(n.priority)?n.priority:``,onChange:e=>r(t=>({...t,priority:parseInt(e.target.value)}))}),(0,H.jsx)(Kw,{label:`Workorder (optional)`,value:n.workorder??``,onChange:e=>r(t=>({...t,workorder:e.target.value}))}),(0,H.jsx)(Kw,{label:`Notes (optional)`,multiline:!0,minRows:2,value:n.notes??``,onChange:e=>r(t=>({...t,notes:e.target.value}))})]})}),(0,H.jsxs)(ly,{children:[(0,H.jsxs)(Y,{color:`secondary`,onClick:l,disabled:!s||o,children:[o?(0,H.jsx)(Lm,{size:24}):void 0,`Create`]}),(0,H.jsx)(Y,{onClick:c,children:`Cancel`})]})]}),(0,H.jsx)(X,{title:`Add Rebooking`,children:(0,H.jsx)(hy,{onClick:()=>t(!0),sx:{position:`fixed`,bottom:`24px`,right:`24px`},color:`primary`,children:(0,H.jsx)(Yw,{})})})]})}),wue=(0,L.memo)(function(){let[e,t]=B(k9),[n,r]=B(A9),[i,a]=B(j9);return(0,H.jsxs)(cy,{open:e,onClose:()=>t(!1),children:[(0,H.jsx)(dy,{children:`Filter`}),(0,H.jsx)(uy,{children:(0,H.jsxs)(RC,{direction:`column`,spacing:2,children:[(0,H.jsx)(vy,{control:(0,H.jsx)(wv,{checked:n,onChange:e=>r(e.target.checked)}),label:`Hide scheduled`}),(0,H.jsx)(vy,{control:(0,H.jsx)(wv,{checked:i,onChange:e=>a(e.target.checked)}),label:`Hide canceled`})]})}),(0,H.jsx)(ly,{children:(0,H.jsx)(Y,{onClick:()=>t(!1),children:`Close`})})]})});function Tue(){JI(R(br).supportsRebookings??`Rebookings`);let[e,t]=(0,L.useState)(void 0);return(0,H.jsxs)(J,{component:`main`,sx:{padding:`24px`},children:[(0,H.jsx)(bue,{setRebookingToShow:t}),(0,H.jsx)(xue,{rebooking:e,close:t}),(0,H.jsx)(Cue,{}),(0,H.jsx)(wue,{})]})}var P9=P(Math.floor(Date.now()/6e4));P9.onMount=e=>{let t=setInterval(()=>{e(Math.floor(Date.now()/6e4))},6e4);return()=>clearInterval(t)};var F9=SO(`charts_last30WeekdayStartIdx`,0),I9=SO(`charts_last30WeekdayStartMinuteOffset`,360),L9=aO(e=>P(t=>{let n=t(F9),r=t(I9),i=new Date(t(P9)*6e4),a=JT(KT(i),r),o=JT(UT(i,{weekStartsOn:n}),r);switch(e){case`StartOfToday`:return a;case`StartOfYesterday`:return LT(a,-1);case`StartOfWeek`:return o;case`StartOfLastWeek`:return LT(o,-7);case`Last30`:return LT(i,-30)}})),R9=aO(e=>P(t=>{if(e===`Now`)return null;let n=t(F9),r=t(I9),i=new Date(t(P9)*6e4);switch(e){case`EndOfYesterday`:return JT(KT(i),r);case`EndOfLastWeek`:return JT(UT(i,{weekStartsOn:n}),r)}}));function Eue(e){let t=SO(`charts_${e}_start`,`StartOfWeek`),n=SO(`charts_${e}_end`,`Now`);return P(e=>{let r=e(t),i=e(n);return{startType:r,endType:i,startDate:r instanceof Date?r:e(L9(r)),endDate:i instanceof Date?i:e(R9(i))}},(e,r,i)=>{`start`in i&&r(t,i.start),`end`in i&&r(n,i.end)})}function Due(e){return e.closeout_completed===void 0?!!(Q.ofObject(e.completedInspections??{}).some(([,e])=>!e.success)||e.currently_quarantined):e.closeout_failed!==!1}var z9=Eue(`part-summary`),Oue=P(e=>{let t=e(fL),n=e(uk),r=e(z9),i=n.valuesToLazySeq().filter(e=>(r.startDate===null||e.endTime>=r.startDate)&&(r.endDate===null||e.endTime<=r.endDate)).toLookupOrderedMap(e=>e.part,e=>e.stationGroup,e=>({isLoadUnload:$O(e),elapsed:e.elapsedMinsPerMaterial*e.material.length,active:e.activeMinutes,medianElapsed:e.medianCycleMinutes}),(e,t)=>({isLoadUnload:e.isLoadUnload||t.isLoadUnload,elapsed:e.elapsed+t.elapsed,active:e.active+t.active,medianElapsed:e.medianElapsed+t.medianElapsed}));return t.matsById.valuesToLazySeq().filter(e=>!!(e.numProcesses&&e.unloaded_processes?.[e.numProcesses]&&(r.startDate===null||e.unloaded_processes[e.numProcesses]>=r.startDate)&&(r.endDate===null||e.unloaded_processes[e.numProcesses]<=r.endDate))).toOrderedLookup(e=>e.partName).mapValues((e,t)=>({part:t,completedQty:e.length,abnormalQty:Q.of(e).sumBy(e=>+!!Due(e)),mats:e,stationMins:eO.empty(),workorders:Q.of(e).toOrderedSet(e=>e.workorderId??``).delete(``)})).adjust(i,(e,t,n)=>e?{...e,stationMins:t}:{part:n,completedQty:0,abnormalQty:0,mats:[],stationMins:t,workorders:QD.empty()}).valuesToAscLazySeq().toRArray()});function kue(e){return e===`CustomDate`||e===`StartOfToday`||e===`StartOfYesterday`||e===`StartOfWeek`||e===`StartOfLastWeek`||e===`Last30`}function Aue(e){return e===`CustomDate`||e===`Now`||e===`EndOfYesterday`||e===`EndOfLastWeek`}function jue(e){switch(e){case`0`:return 0;case`1`:return 1;case`2`:return 2;case`3`:return 3;case`4`:return 4;case`5`:return 5;case`6`:return 6;default:return null}}function B9({label:e,date:t}){return(0,H.jsxs)(J,{children:[(0,H.jsx)(q,{children:e}),t?(0,H.jsxs)(q,{variant:`subtitle2`,children:[`(`,t.toLocaleString(),`)`]}):void 0]})}function V9({date:e,setDate:t,enabled:n}){let r=R(L9(`Last30`));return(0,H.jsx)(Kw,{type:`datetime-local`,value:e?new Date(e.getTime()-e.getTimezoneOffset()*6e4).toISOString().slice(0,16):``,onChange:e=>t(new Date(e.target.value)),disabled:!n,label:`Custom Date`,slotProps:{inputLabel:{shrink:!0},htmlInput:{min:new Date(r.getTime()-r.getTimezoneOffset()*6e4).toISOString().slice(0,16)}}})}function Mue({chartAtom:e}){let[t,n]=B(e),r=R(I9),[i,a]=(0,L.useState)(t.startType instanceof Date?t.startType:JT(cE(),r));function o(e){n(e===`CustomDate`?{start:i??new Date}:{start:e})}function s(e){a(e),n({start:e})}let c=R(L9(`StartOfToday`)),l=R(L9(`StartOfYesterday`)),u=R(L9(`StartOfWeek`)),d=R(L9(`StartOfLastWeek`)),f=R(L9(`Last30`));return(0,H.jsxs)(J,{children:[(0,H.jsx)(q,{variant:`h6`,children:`Range Start`}),(0,H.jsx)(bS,{value:t.startType instanceof Date?`CustomDate`:t.startType,onChange:e=>{kue(e.target.value)&&o(e.target.value)},children:(0,H.jsxs)(RC,{direction:`column`,spacing:2,children:[(0,H.jsxs)(RC,{direction:`row`,sx:{alignItems:`center`,minHeight:`3em`},children:[(0,H.jsx)(_S,{value:`StartOfToday`}),(0,H.jsx)(B9,{label:`Start of Today`,date:c})]}),(0,H.jsxs)(RC,{direction:`row`,sx:{alignItems:`center`,minHeight:`3em`},children:[(0,H.jsx)(_S,{value:`StartOfYesterday`}),(0,H.jsx)(B9,{label:`Start of Yesterday`,date:l})]}),(0,H.jsxs)(RC,{direction:`row`,sx:{alignItems:`center`,minHeight:`3em`},children:[(0,H.jsx)(_S,{value:`StartOfWeek`}),(0,H.jsx)(B9,{label:`Start of This Week`,date:u})]}),(0,H.jsxs)(RC,{direction:`row`,sx:{alignItems:`center`,minHeight:`3em`},children:[(0,H.jsx)(_S,{value:`StartOfLastWeek`}),(0,H.jsx)(B9,{label:`Start of Last Week`,date:d})]}),(0,H.jsxs)(RC,{direction:`row`,sx:{alignItems:`center`,minHeight:`3em`},children:[(0,H.jsx)(_S,{value:`Last30`}),(0,H.jsx)(B9,{label:`Last 30 Days`,date:f})]}),(0,H.jsxs)(RC,{direction:`row`,sx:{alignItems:`center`,minHeight:`3em`},children:[(0,H.jsx)(_S,{value:`CustomDate`}),(0,H.jsx)(V9,{enabled:t.startType instanceof Date,date:i,setDate:s})]})]})})]})}function Nue({chartAtom:e}){let[t,n]=B(e),r=R(I9),[i,a]=(0,L.useState)(t.endType instanceof Date?t.endType:JT(cE(),r));function o(e){n(e===`CustomDate`?{end:i??new Date}:{end:e})}function s(e){a(e),n({end:e})}let c=R(R9(`EndOfYesterday`)),l=R(R9(`EndOfLastWeek`));return(0,H.jsxs)(J,{children:[(0,H.jsx)(q,{variant:`h6`,children:`Range End`}),(0,H.jsx)(bS,{value:t.endType instanceof Date?`CustomDate`:t.endType,onChange:e=>{Aue(e.target.value)&&o(e.target.value)},children:(0,H.jsxs)(RC,{direction:`column`,spacing:2,children:[(0,H.jsxs)(RC,{direction:`row`,sx:{alignItems:`center`,minHeight:`3em`},children:[(0,H.jsx)(_S,{value:`Now`}),(0,H.jsx)(q,{children:`Now`})]}),(0,H.jsxs)(RC,{direction:`row`,sx:{alignItems:`center`,minHeight:`3em`},children:[(0,H.jsx)(_S,{value:`EndOfYesterday`}),(0,H.jsx)(B9,{label:`End of Yesterday`,date:c})]}),(0,H.jsx)(J,{sx:{height:`3em`}}),(0,H.jsxs)(RC,{direction:`row`,sx:{alignItems:`center`,minHeight:`3em`},children:[(0,H.jsx)(_S,{value:`EndOfLastWeek`}),(0,H.jsx)(B9,{label:`End of Last Week`,date:l})]}),(0,H.jsx)(J,{sx:{height:`3em`}}),(0,H.jsxs)(RC,{direction:`row`,sx:{alignItems:`center`,minHeight:`3em`},children:[(0,H.jsx)(_S,{value:`CustomDate`}),(0,H.jsx)(V9,{enabled:t.endType instanceof Date,date:i,setDate:s})]})]})})]})}function Pue(e){let t=Math.floor(e/60),n=e%60;return`${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}`}function Fue({chartAtom:e,open:t,setOpen:n}){let[r,i]=B(F9),[a,o]=B(I9);return(0,H.jsxs)(cy,{open:t,onClose:()=>n(!1),maxWidth:`md`,children:[(0,H.jsx)(uy,{children:(0,H.jsxs)(RC,{direction:`column`,spacing:2,divider:(0,H.jsx)(py,{orientation:`horizontal`,flexItem:!0}),children:[(0,H.jsxs)(RC,{direction:`row`,spacing:2,divider:(0,H.jsx)(py,{orientation:`vertical`,flexItem:!0}),children:[(0,H.jsx)(Mue,{chartAtom:e}),(0,H.jsx)(Nue,{chartAtom:e})]}),(0,H.jsxs)(RC,{direction:`row`,sx:{justifyContent:`space-around`},children:[(0,H.jsxs)(Kw,{select:!0,label:`First Day Of Week`,sx:{minWidth:`10em`},value:r,onChange:e=>{let t=jue(e.target.value);t!==null&&i(t)},children:[(0,H.jsx)(Hx,{value:0,children:`Sunday`}),(0,H.jsx)(Hx,{value:1,children:`Monday`}),(0,H.jsx)(Hx,{value:2,children:`Tuesday`}),(0,H.jsx)(Hx,{value:3,children:`Wednesday`}),(0,H.jsx)(Hx,{value:4,children:`Thursday`}),(0,H.jsx)(Hx,{value:5,children:`Friday`}),(0,H.jsx)(Hx,{value:6,children:`Saturday`})]}),(0,H.jsx)(Kw,{type:`time`,label:`Day Start Time`,sx:{minWidth:`10em`},value:Pue(a),onChange:e=>{let t=e.target.value;if(t===``)o(0);else{let[e,n]=t.split(`:`).map(Number);o(e*60+n)}}})]})]})}),(0,H.jsx)(ly,{children:(0,H.jsx)(Y,{onClick:()=>n(!1),children:`Close`})})]})}function Iue(e,t){if(e instanceof Date)return e.toLocaleString();switch(e){case`StartOfToday`:return`Start of Today${t?` (${t.toLocaleString()})`:``}`;case`StartOfYesterday`:return`Start of Yesterday${t?` (${t.toLocaleString()})`:``}`;case`StartOfWeek`:return`Start of This Week${t?` (${t.toLocaleString()})`:``}`;case`StartOfLastWeek`:return`Start of Last Week${t?` (${t.toLocaleString()})`:``}`;case`Last30`:return`Last 30 Days${t?` (${t.toLocaleString()})`:``}`}}function Lue(e,t){if(e instanceof Date)return e.toLocaleString();switch(e){case`Now`:return`Now`;case`EndOfYesterday`:return`End of Yesterday${t?` (${t.toLocaleString()})`:``}`;case`EndOfLastWeek`:return`End of Last Week${t?` (${t.toLocaleString()})`:``}`}}var Rue=(0,L.memo)(function({chartAtom:e}){let t=R(e),[n,r]=(0,L.useState)(!1);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(RC,{direction:`row`,spacing:2,sx:{alignItems:`center`},children:[(0,H.jsxs)(q,{variant:`body2`,color:`textSecondary`,children:[`Range: `,Iue(t.startType,t.startDate),` -`,` `,Lue(t.endType,t.endDate)]}),(0,H.jsx)(X,{title:`Edit Range`,children:(0,H.jsx)(Um,{onClick:()=>r(!0),children:(0,H.jsx)(rT,{})})})]}),(0,H.jsx)(Fue,{open:n,setOpen:r,chartAtom:e})]})}),H9=new Intl.NumberFormat(void 0,{maximumFractionDigits:1});function zue(e,t,n){let r;switch(t){case`PartName`:r=e=>e.part;break;case`CompletedQty`:r=e=>e.completedQty;break;case`AbnormalQty`:r=e=>e.abnormalQty;break;case`Workorders`:r=e=>e.workorders.lookupMin()?.[0]??null;break;case`Elapsed`:r=e=>e.stationMins.toAscLazySeq().filter(([e,t])=>!t.isLoadUnload).sumBy(([,e])=>e.elapsed);break;case`Active`:r=e=>e.stationMins.toAscLazySeq().filter(([e,t])=>!t.isLoadUnload).sumBy(([e,t])=>t.active);break;case`Median`:r=e=>e.stationMins.toAscLazySeq().filter(([e,t])=>!t.isLoadUnload).sumBy(([e,t])=>t.medianElapsed);break}let i=[...e];return i.sort(ME(n===`asc`?{asc:r}:{desc:r})),i}var Bue=new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`});function Vue(e,t,n){let r;switch(t){case`Serial`:r=e=>e.serial??null;break;case`CompletedDate`:r=e=>e.last_unload_time??null;break;case`Workorder`:r=e=>e.workorderId??null;break;case`Quarantined`:r=e=>e.currently_quarantined??null;break;case`InspectFailed`:r=e=>Q.ofObject(e.completedInspections??{}).some(([,e])=>!e.success)?-1:0;break;case`CloseOut`:r=e=>e.closeout_failed===void 0?1:e.closeout_failed?-1:0;break}let i=[...e];return i.sort(ME(n===`asc`?{asc:r}:{desc:r})),i}function U9(e){return(0,H.jsxs)(Z,{align:e.align,sortDirection:e.sortBy===e.col&&e.order,sx:e.noWhitespaceWrap?{whiteSpace:`nowrap`}:void 0,children:[(0,H.jsx)(X,{title:`Sort`,enterDelay:300,children:(0,H.jsx)(Uw,{active:e.sortBy===e.col,direction:e.order,onClick:()=>{e.col===e.sortBy?e.setOrder(e.order===`asc`?`desc`:`asc`):(e.setSortBy(e.col),e.setOrder(`asc`))},children:e.children})}),e.extraIcon]})}var W9=(0,L.memo)(function({workorderId:e}){return!e||e===``?(0,H.jsx)(`span`,{}):(0,H.jsx)(Nie,{to:{route:$.Operations_CurrentWorkorders,workorder:e},children:e})});function Hue({material:e}){let t=z(SI),[n,r]=(0,L.useState)(`Serial`),[i,a]=(0,L.useState)(`asc`),o=(0,L.useMemo)(()=>Vue(e,n,i),[e,n,i]),s={sortBy:n,setSortBy:r,order:i,setOrder:a},[c,l]=(0,L.useState)(10),[u,d]=(0,L.useState)(0),f=o.slice(u*c,(u+1)*c);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(jw,{size:`small`,children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(U9,{col:`Serial`,...s,children:`Serial`}),(0,H.jsx)(U9,{col:`CompletedDate`,...s,children:`Completed`}),(0,H.jsx)(U9,{col:`Workorder`,...s,children:`Workorder`}),(0,H.jsx)(U9,{col:`Quarantined`,...s,children:`Quarantine?`}),(0,H.jsx)(U9,{col:`InspectFailed`,noWhitespaceWrap:!0,...s,children:`Inspect Failed?`}),(0,H.jsx)(U9,{col:`CloseOut`,noWhitespaceWrap:!0,...s,children:`Close Out`}),(0,H.jsx)(Z,{padding:`checkbox`})]})}),(0,H.jsxs)(Pw,{children:[f.map(e=>(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:e.serial??``}),(0,H.jsx)(Z,{children:e.last_unload_time?Bue.format(e.last_unload_time):``}),(0,H.jsx)(Z,{children:(0,H.jsx)(W9,{workorderId:e.workorderId})}),(0,H.jsx)(Z,{sx:{textAlign:`center`},padding:`checkbox`,children:e.currently_quarantined?(0,H.jsx)(yT,{fontSize:`inherit`}):``}),(0,H.jsx)(Z,{sx:{textAlign:`center`},padding:`checkbox`,children:Q.ofObject(e.completedInspections??{}).some(([,e])=>!e.success)?(0,H.jsx)(iT,{fontSize:`inherit`}):``}),(0,H.jsx)(Z,{sx:{textAlign:`center`},padding:`checkbox`,children:e.closeout_completed===void 0?``:e.closeout_failed===!1?(0,H.jsx)($w,{fontSize:`inherit`}):(0,H.jsx)(iT,{fontSize:`inherit`})}),(0,H.jsx)(Z,{padding:`checkbox`,children:(0,H.jsx)(Um,{onClick:()=>t({type:`MatSummary`,summary:e}),size:`large`,children:(0,H.jsx)(gT,{fontSize:`inherit`})})})]},e.materialID)),Q.ofRange(0,c-f.length).map(e=>(0,H.jsx)(Vw,{children:(0,H.jsx)(Z,{colSpan:7,children:`\xA0`})},e))]})]}),(0,H.jsxs)(Rw,{variant:`dense`,sx:{mb:`0.5em`},children:[(0,H.jsx)(q,{color:`textSecondary`,variant:`caption`,children:`Rows per page:`}),(0,H.jsx)(YS,{style:{marginLeft:8,marginRight:`1em`},value:c,SelectDisplayProps:{style:{color:`rgba(0, 0, 0, 0.54)`}},input:(0,H.jsx)(ff,{}),onChange:t=>{let n=t.target.value;l(n);let r=Math.ceil(e.length/n)-1;u>r&&d(r)},children:[10,15,20,50].map(e=>(0,H.jsx)(Hx,{value:e,children:e},e))}),(0,H.jsx)(q,{color:`textSecondary`,variant:`caption`,children:`${e.length===0?0:u*c+1}-${Math.min(e.length,(u+1)*c)} of ${e.length}`}),(0,H.jsx)(Um,{onClick:()=>d(0),disabled:u===0,"aria-label":`First Page`,size:`large`,children:(0,H.jsx)(sT,{})}),(0,H.jsx)(Um,{onClick:()=>d(u-1),disabled:u===0,"aria-label":`Previous Page`,size:`large`,children:(0,H.jsx)(fT,{})}),(0,H.jsx)(Um,{onClick:()=>d(u+1),disabled:u>=Math.ceil(e.length/c)-1,"aria-label":`Next Page`,size:`large`,children:(0,H.jsx)(pT,{})}),(0,H.jsx)(Um,{onClick:()=>d(Math.max(0,Math.ceil(e.length/c)-1)),disabled:u>=Math.ceil(e.length/c)-1,"aria-label":`Last Page`,size:`large`,children:(0,H.jsx)(hT,{})})]})]})}var Uue=(0,L.memo)(function({part:e}){return(0,H.jsxs)(RC,{direction:`row`,sx:{flexWrap:`wrap`,justifyContent:`space-around`,ml:`1em`,mr:`1em`},children:[(0,H.jsx)(J,{sx:{width:`60em`,overflow:`auto`},children:(0,H.jsx)(Hue,{material:e.mats})}),(0,H.jsx)(J,{sx:{width:`40em`,overflow:`auto`},children:(0,H.jsxs)(jw,{size:`small`,children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:`Station`}),(0,H.jsx)(Z,{children:`Active Hours`}),(0,H.jsx)(Z,{children:`Elapsed Hours`}),(0,H.jsx)(Z,{children:`Total Median Hours`})]})}),(0,H.jsx)(Pw,{children:e.stationMins.toAscLazySeq().map(([e,t])=>(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:e}),(0,H.jsx)(Z,{children:H9.format(t.active/60)}),(0,H.jsx)(Z,{children:H9.format(t.elapsed/60)}),(0,H.jsx)(Z,{children:H9.format(t.medianElapsed/60)})]},e))})]})})]})}),Wue=G(Vw)({"& > *":{borderBottom:`unset !important`}}),Gue=(0,L.memo)(function({part:e}){let[t,n]=(0,L.useState)(!1);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(Wue,{children:[(0,H.jsx)(Z,{children:(0,H.jsxs)(J,{sx:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(J,{sx:{mr:`0.2em`},children:(0,H.jsx)(XU,{part:e.part,size:25})}),(0,H.jsx)(`div`,{children:(0,H.jsx)(q,{variant:`body2`,component:`span`,sx:{display:`block`},children:e.part})})]})}),(0,H.jsx)(Z,{align:`right`,children:e.completedQty}),(0,H.jsx)(Z,{align:`right`,children:e.abnormalQty}),(0,H.jsx)(Z,{align:`right`,children:H9.format(e.stationMins.toAscLazySeq().filter(([e,t])=>!t.isLoadUnload).sumBy(([e,t])=>t.active)/60)}),(0,H.jsx)(Z,{align:`right`,children:H9.format(e.stationMins.toAscLazySeq().filter(([e,t])=>!t.isLoadUnload).sumBy(([,e])=>e.elapsed)/60)}),(0,H.jsx)(Z,{align:`right`,children:H9.format(e.stationMins.toAscLazySeq().filter(([e,t])=>!t.isLoadUnload).sumBy(([,e])=>e.medianElapsed)/60)}),(0,H.jsx)(Z,{align:`left`,children:e.workorders.size<=1?(0,H.jsx)(W9,{workorderId:e.workorders.lookupMin()??null}):e.workorders.size===2?(0,H.jsxs)(`span`,{children:[(0,H.jsx)(W9,{workorderId:e.workorders.lookupMin()}),` &`,` `,(0,H.jsx)(W9,{workorderId:e.workorders.lookupMax()})]}):`${e.workorders.size} workorders`}),(0,H.jsx)(Z,{children:(0,H.jsx)(X,{title:`Show Details`,children:(0,H.jsx)(Um,{size:`small`,onClick:()=>n(!t),children:t?(0,H.jsx)(mT,{}):(0,H.jsx)(dT,{})})})})]}),(0,H.jsx)(Vw,{children:(0,H.jsx)(Z,{sx:{pb:`0`,pt:`0`},colSpan:7,children:(0,H.jsx)(zp,{in:t,timeout:`auto`,unmountOnExit:!0,children:(0,H.jsx)(Uue,{part:e})})})})]})});function Kue({partsAtom:e}){let t=R(e);return(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{style:{height:`25px`,paddingTop:0,paddingBottom:0},size:`large`,onClick:()=>ede(t),children:(0,H.jsx)(uT,{})})})}function que(){return(0,H.jsx)(X,{title:`Total Median Hours are calculated by taking the median cycle time (excluding outliers) and adding up for each piece of material.`,children:(0,H.jsx)(`span`,{style:{verticalAlign:`middle`,marginLeft:`0.5em`,fontSize:16},children:(0,H.jsx)(cT,{fontSize:`inherit`})})})}function G9(){return(0,H.jsx)(X,{title:`The entire cycle time is credited at the time the cycle completes, so it may be that a day has more than 24 hours of credited time for example.`,children:(0,H.jsx)(`span`,{style:{verticalAlign:`middle`,marginLeft:`0.5em`,fontSize:16},children:(0,H.jsx)(cT,{fontSize:`inherit`})})})}function Jue(){return(0,H.jsx)(X,{title:`An abnormal part is one which was quarantined, had a failed inspection, or was explicitly marked as failing closeout. A successful closeout overrides this and will never be an abnormal part.`,children:(0,H.jsx)(`span`,{style:{verticalAlign:`middle`,marginLeft:`0.5em`,fontSize:16},children:(0,H.jsx)(cT,{fontSize:`inherit`})})})}var Yue=(0,L.memo)(function({partsAtom:e,order:t,setOrder:n,sortBy:r,setSortBy:i}){let a={sortBy:r,setSortBy:i,order:t,setOrder:n};return(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(U9,{align:`left`,col:`PartName`,...a,children:`Part`}),(0,H.jsx)(U9,{align:`right`,col:`CompletedQty`,...a,children:`Completed Quantity`}),(0,H.jsx)(U9,{align:`right`,col:`AbnormalQty`,...a,extraIcon:(0,H.jsx)(Jue,{}),children:`Abnormal Quantity`}),(0,H.jsx)(U9,{align:`right`,col:`Active`,...a,extraIcon:(0,H.jsx)(G9,{}),children:`Active Hours`}),(0,H.jsx)(U9,{align:`right`,col:`Elapsed`,...a,extraIcon:(0,H.jsx)(G9,{}),children:`Elapsed Hours`}),(0,H.jsx)(U9,{align:`right`,col:`Median`,...a,extraIcon:(0,H.jsx)(que,{}),children:`Total Median Hours`}),(0,H.jsx)(U9,{align:`left`,col:`Workorders`,...a,children:`Workorders`}),(0,H.jsx)(Z,{children:(0,H.jsx)(Kue,{partsAtom:e})})]})})}),Xue=(0,L.memo)(function({partsAtom:e}){let t=R(e),[n,r]=(0,L.useState)(`PartName`),[i,a]=(0,L.useState)(`asc`),o=zue(t,n,i);return(0,H.jsxs)(jw,{stickyHeader:!0,children:[(0,H.jsx)(Yue,{partsAtom:e,sortBy:n,setSortBy:r,order:i,setOrder:a}),(0,H.jsx)(Pw,{children:o.map(e=>(0,H.jsx)(Gue,{part:e},e.part))})]})});function Zue(){let e=z(K0),t=R(TI),[n,r]=LI(),i=z(SI);if(t===null||t.materialID<0)return null;function a(e){t!==null&&(n({mat:t,operator:`Manager`,failed:e}),i(null))}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Y,{color:`primary`,disabled:r,onClick:()=>a(!0),children:`Fail CloseOut`}),(0,H.jsx)(Y,{color:`primary`,disabled:r,onClick:()=>a(!1),children:`Pass CloseOut`}),(0,H.jsx)(Y,{color:`primary`,onClick:()=>e(!0),children:`Change Workorder`})]})}var Que=(0,L.memo)(function(){return(0,H.jsx)(TW,{buttons:(0,H.jsx)(Zue,{})})});function $ue(){return JI(`Completed Parts`),(0,H.jsxs)(J,{component:`main`,sx:{padding:`24px`},children:[(0,H.jsxs)(RC,{direction:`row`,spacing:2,sx:{alignItems:`center`,justifyContent:`space-between`},children:[(0,H.jsx)(`span`,{children:`Completed Parts`}),(0,H.jsx)(Rue,{chartAtom:z9})]}),(0,H.jsx)(Xue,{partsAtom:Oue}),(0,H.jsx)(Que,{}),(0,H.jsx)(Z0,{})]})}function ede(e){let t=`<table>
|
|
383
|
+
`,Ule=G(Dre)(()=>({animation:`${Hle} 1.5s linear infinite`}));function Wle(){let[e,t]=(0,L.useState)(!1),[n,r]=(0,L.useTransition)(),[i,a]=B(b9),[o,s]=(0,L.useState)(null),[c,l]=B(Nle);function u(e){e!==null&&e!==``&&(r(()=>{a(e)}),t(!1),s(null),l(t=>{let n=t.filter(t=>t!==e);return n.unshift(e),n.slice(0,5)}))}return(0,H.jsxs)(H.Fragment,{children:[n?(0,H.jsx)(X,{title:`Searching.... Click to cancel`,children:(0,H.jsx)(Um,{size:`small`,onClick:()=>a(null),children:(0,H.jsx)(Ule,{fontSize:`inherit`})})}):i?(0,H.jsx)(X,{title:`Clear Search`,children:(0,H.jsx)(Um,{size:`small`,onClick:()=>a(null),children:(0,H.jsx)(eT,{fontSize:`inherit`})})}):(0,H.jsx)(X,{title:`Search`,children:(0,H.jsx)(Um,{size:`small`,onClick:e=>{t(!0),e.currentTarget.blur()},children:(0,H.jsx)(bT,{fontSize:`inherit`})})}),(0,H.jsxs)(cy,{open:e,onClose:()=>t(!1),children:[(0,H.jsx)(dy,{children:`Search Workorder`}),(0,H.jsxs)(uy,{children:[(0,H.jsx)(Kw,{variant:`outlined`,fullWidth:!0,autoFocus:!0,sx:{mt:`0.5em`,minWidth:`15em`},label:`Workorder ID`,value:o??``,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(u(o),e.preventDefault())}}),c.length>0?(0,H.jsx)(H.Fragment,{children:(0,H.jsx)(pb,{dense:!0,sx:{mt:`1em`},subheader:(0,H.jsx)(m_,{children:`Previous Searches`}),children:c.map(e=>(0,H.jsx)(Db,{onClick:()=>u(e),children:(0,H.jsx)(vb,{children:(0,H.jsx)(Lb,{primary:e})})},e))})}):void 0]}),(0,H.jsxs)(ly,{children:[(0,H.jsx)(Y,{color:`primary`,onClick:()=>u(o),children:`Search`}),(0,H.jsx)(Y,{color:`secondary`,onClick:()=>t(!1),children:`Cancel`})]})]})]})}var Gle=(0,L.memo)(function(e){let t={sortBy:e.sortBy,setSortBy:e.setSortBy,order:e.order,setOrder:e.setOrder};return(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(w9,{align:`left`,col:0,...t,extraIcon:e.disableSearch?void 0:(0,H.jsx)(Wle,{}),children:`Workorder`}),(0,H.jsx)(w9,{align:`left`,col:1,...t,children:`Part`}),(0,H.jsx)(w9,{align:`left`,col:3,...t,children:`Due Date`}),(0,H.jsx)(w9,{align:`right`,col:4,...t,children:`Priority`}),(0,H.jsx)(w9,{align:`right`,col:2,...t,children:`Planned Quantity`}),(0,H.jsx)(w9,{align:`right`,col:6,...t,children:`Started Quantity`}),(0,H.jsx)(w9,{align:`right`,col:7,...t,children:`Abnormal Quantity`}),(0,H.jsx)(w9,{align:`right`,col:5,...t,children:`Completed Quantity`}),e.showSim?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(w9,{align:`right`,col:8,...t,children:`Projected Start`}),(0,H.jsx)(w9,{align:`right`,col:9,...t,children:`Projected Filled`})]}):void 0,(0,H.jsx)(Z,{children:(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{style:{height:`25px`,paddingTop:0,paddingBottom:0},size:`large`,onClick:()=>Ble(e.workorders,e.showSim),children:(0,H.jsx)(uT,{})})})})]})})}),E9=P(null);function Kle(){let[e,t]=B(E9),[n,r]=(0,L.useState)(null),i=z(IO);function a(){t(null),r(null)}function o(){e&&n&&n!==``&&i({workorder:e.workorderId,comment:n}),a()}return(0,H.jsx)(cy,{open:e!==null,onClose:a,children:e===null?void 0:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(dy,{children:(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(`div`,{children:(0,H.jsx)(ZU,{part:e.part,size:40})}),(0,H.jsxs)(`div`,{style:{marginLeft:`1em`,flexGrow:1},children:[`Add Comment For `,e.workorderId]})]})}),(0,H.jsx)(uy,{children:(0,H.jsx)(Kw,{variant:`outlined`,sx:{mt:`1em`},fullWidth:!0,autoFocus:!0,value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&n!==null&&n!==``&&(o(),e.preventDefault())}})}),(0,H.jsxs)(ly,{children:[(0,H.jsx)(Y,{color:`primary`,onClick:o,children:`Save Comment`}),(0,H.jsx)(Y,{color:`primary`,onClick:a,children:`Cancel`})]})]})})}function qle(){let[e,t]=B(b9);return(0,H.jsx)(Vw,{children:(0,H.jsx)(Z,{colSpan:10,children:(0,H.jsxs)(RC,{direction:`column`,sx:{mt:`3em`,flex:`flex`,alignItems:`center`,width:`100%`},children:[(0,H.jsxs)(RC,{direction:`row`,spacing:`3`,children:[(0,H.jsx)(Lm,{}),e&&e!==``?(0,H.jsxs)(q,{variant:`h6`,children:[`Searching for workorder `,e]}):(0,H.jsx)(q,{variant:`h6`,children:`Searching`})]}),(0,H.jsx)(Y,{onClick:()=>t(null),children:`Cancel`})]})})})}function Jle({showSim:e,disableSearch:t}){let[n,r]=(0,L.useState)(0),[i,a]=(0,L.useState)(`asc`),o=R(NO);return(0,H.jsxs)(jw,{stickyHeader:!0,children:[(0,H.jsx)(Gle,{workorders:o?.workorders??[],sortBy:n,setSortBy:r,showSim:e,order:i,setOrder:a,disableSearch:t}),(0,H.jsx)(Pw,{children:(0,H.jsx)(L.Suspense,{fallback:(0,H.jsx)(qle,{}),children:(0,H.jsx)(zle,{sortBy:n,order:i,showSim:e})})})]})}function Yle(){let e=z(q0),t=R(TI),[n,r]=LI(),i=z(SI);if(t===null||t.materialID<0)return null;function a(e){t!==null&&(n({mat:t,operator:`Manager`,failed:e}),i(null))}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Y,{color:`primary`,disabled:r,onClick:()=>a(!0),children:`Fail CloseOut`}),(0,H.jsx)(Y,{color:`primary`,disabled:r,onClick:()=>a(!1),children:`Pass CloseOut`}),(0,H.jsx)(Y,{color:`primary`,onClick:()=>e(!0),children:`Change Workorder`})]})}var Xle=(0,L.memo)(function(){return(0,H.jsx)(EW,{buttons:(0,H.jsx)(Yle,{})})}),D9=(0,L.memo)(function({disableSearch:e}){JI(`Workorders`);let t=R(NO),n=R(T9),r=(0,L.useMemo)(()=>t.workorders?.some(e=>!!e.simulatedStart||!!e.simulatedFilled)??!1,[t.workorders]);return(0,H.jsxs)(J,{component:`main`,sx:{padding:`24px`},children:[r?(0,H.jsx)(Vle,{showSim:r}):void 0,n===`table`?(0,H.jsx)(Jle,{showSim:r,disableSearch:e}):(0,H.jsx)(Mle,{}),(0,H.jsx)(Kle,{}),(0,H.jsx)(Xle,{}),(0,H.jsx)(Z0,{})]})}),Zle=Pr[50],Qle=Pr[600],$le=Lr[100],O9=`3em`,eue=`calc(${O9} * 7)`,tue=P(e=>{let t=e(_R);return t===null?null:Q.of(t.usage).toLookupOrderedMap(e=>e.machineGroup,e=>new Date(e.day.getUTCFullYear(),e.day.getUTCMonth(),e.day.getUTCDate()))}),nue=P(e=>{let t=e(_R);return t===null?QD.empty():QD.build(t.usage,e=>e.machineGroup)}),rue=P(e=>{let t=e(_R);return t===null?QD.empty():QD.build(t.usage,e=>new Date(e.day.getUTCFullYear(),e.day.getUTCMonth(),1))}),iue=P(e=>{let t=e(_R);return t===null?0:Q.of(t.usage).map(e=>Math.ceil(e.usage)).maxBy(e=>e)??1}),aue=P(e=>{let t=e(_R);return t===null?[null,null]:[Q.of(t.usage).map(e=>new Date(e.day.getUTCFullYear(),e.day.getUTCMonth(),e.day.getUTCDate())).minBy(e=>e)??null,Q.of(t.usage).map(e=>new Date(e.day.getUTCFullYear(),e.day.getUTCMonth(),e.day.getUTCDate())).maxBy(e=>e)??null]});function oue({date:e,dayColor:t,tooltip:n}){let r=new Date(e.getFullYear(),e.getMonth(),1).getDay(),i=new Date(e.getFullYear(),e.getMonth()+1,0).getDate();return(0,H.jsxs)(J,{sx:{width:eue},children:[(0,H.jsx)(q,{variant:`h6`,sx:{textAlign:`center`},children:e.toLocaleString(`default`,{month:`long`,year:`numeric`})}),(0,H.jsxs)(J,{sx:{display:`flex`,flexWrap:`wrap`},children:[Q.ofRange(0,r).map((e,t)=>(0,H.jsx)(J,{sx:{height:O9,width:O9}},t)),Q.ofRange(1,i+1).map((r,i)=>(0,H.jsx)(`div`,{style:{width:O9,height:O9,cursor:`default`,backgroundColor:t(new Date(e.getFullYear(),e.getMonth(),r))},children:(0,H.jsx)(X,{title:n(new Date(e.getFullYear(),e.getMonth(),r)),children:(0,H.jsx)(J,{sx:{display:`flex`,justifyContent:`center`,alignItems:`center`,height:`100%`},children:r})})},i))]})]})}function sue(){return(0,H.jsxs)(RC,{direction:`row`,spacing:2,sx:{alignItems:`center`},children:[(0,H.jsx)(DT,{fontSize:`small`}),(0,H.jsx)(q,{variant:`caption`,children:`Projected dates are estimates`})]})}function cue({group:e,month:t}){let n=R(tue),[r,i]=R(aue),a=R(iue),o=(0,L.useMemo)(()=>{let t=VM().domain([0,a]).range([Zle,Qle]);return a=>{if(i&&a>i||r&&a<r)return`white`;let o=n?.get(e)?.get(a);return o?t(o.usage):$le}},[n,a,r,i,e]);function s(t){let a=n?.get(e)?.get(t);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{children:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}),i&&t>i?(0,H.jsx)(`div`,{children:`Not Simulated`}):r&&t<r?(0,H.jsx)(`div`,{}):a?(0,H.jsxs)(`div`,{children:[`Usage: `,a.usage.toFixed(2)]}):(0,H.jsx)(`div`,{children:`Downtime`})]})}return(0,H.jsx)(oue,{date:t,dayColor:o,tooltip:s})}function lue(){JI(`Projected Machine Usage`);let e=R(nue),t=R(rue);return(0,H.jsx)(J,{component:`main`,sx:{padding:`24px`},children:(0,H.jsxs)(RC,{direction:`column`,spacing:5,children:[(0,H.jsx)(sue,{}),e.toAscLazySeq().map(e=>(0,H.jsxs)(`div`,{children:[(0,H.jsx)(q,{variant:`h4`,children:e}),(0,H.jsx)(J,{sx:{display:`flex`,flexWrap:`wrap`,columnGap:`50px`},children:t.toAscLazySeq().map(t=>(0,H.jsx)(cue,{group:e,month:t},t.getTime()))})]},e))]})})}function uue(){let e=z(q0),t=R(TI),[n,r]=LI(),i=z(SI);if(t===null||t.materialID<0)return null;function a(e){t!==null&&(n({mat:t,operator:`Manager`,failed:e}),i(null))}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Y,{color:`primary`,disabled:r,onClick:()=>a(!0),children:`Fail CloseOut`}),(0,H.jsx)(Y,{color:`primary`,disabled:r,onClick:()=>a(!1),children:`Pass CloseOut`}),(0,H.jsx)(Y,{color:`primary`,onClick:()=>e(!0),children:`Change Workorder`})]})}var due=(0,L.memo)(function(){return(0,H.jsx)(EW,{buttons:(0,H.jsx)(uue,{})})}),fue=new Intl.DateTimeFormat(void 0,{weekday:`long`,month:`long`,day:`numeric`,year:`numeric`});function pue({day:e,setDay:t}){let n=cE();return(0,H.jsxs)(RC,{direction:`row`,spacing:2,sx:{alignItems:`center`},children:[(0,H.jsx)(X,{title:`Previous Day`,children:(0,H.jsx)(`div`,{children:(0,H.jsx)(Um,{disabled:e<=LT(n,-28),onClick:()=>t(e=>LT(e,-1)),children:(0,H.jsx)(CT,{})})})}),(0,H.jsx)(q,{sx:{minWidth:`14em`,textAlign:`center`},children:fue.format(e)}),(0,H.jsx)(X,{title:`Next Day`,children:(0,H.jsx)(`div`,{children:(0,H.jsx)(Um,{disabled:e>=n,onClick:()=>t(e=>LT(e,1)),children:(0,H.jsx)(ST,{})})})})]})}function mue(e,t,n){let r;switch(t){case 0:r=e=>e.last_unload_time??null;break;case 2:r=e=>e.partName;break;case 1:r=e=>e.serial??null;break;case 3:r=e=>e.workorderId??null;break;case 4:r=e=>e.closeout_failed??null;break;case 5:r=e=>e.closeout_completed??null}return Q.of(e).toSortedArray(n===`asc`?{asc:r}:{desc:r},{asc:e=>e.last_unload_time??null})}function hue({sortBy:e,setSortBy:t,sortOrder:n,setSortOrder:r}){function i(i){i===e?r(n===`asc`?`desc`:`asc`):(t(i),r(`asc`))}return(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{sortDirection:e===0&&n,children:(0,H.jsx)(Uw,{active:e===0,direction:n,onClick:()=>i(0),children:`Completed Time`})}),(0,H.jsx)(Z,{sortDirection:e===1&&n,children:(0,H.jsx)(Uw,{active:e===1,direction:n,onClick:()=>i(1),children:`Serial`})}),(0,H.jsx)(Z,{sortDirection:e===2&&n,children:(0,H.jsx)(Uw,{active:e===2,direction:n,onClick:()=>i(2),children:`Part`})}),(0,H.jsx)(Z,{sortDirection:e===3&&n,children:(0,H.jsx)(Uw,{active:e===3,direction:n,onClick:()=>i(3),children:`Workorder`})}),(0,H.jsx)(Z,{sortDirection:e===4&&n,children:(0,H.jsx)(Uw,{active:e===4,direction:n,onClick:()=>i(4),children:`Closeout`})}),(0,H.jsx)(Z,{sortDirection:e===5&&n,children:(0,H.jsx)(Uw,{active:e===5,direction:n,onClick:()=>i(5),children:`Closeout Time`})}),(0,H.jsx)(Z,{})]})}var gue=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`numeric`,second:`numeric`}),_ue=new Intl.DateTimeFormat(void 0,{year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`}),vue=(0,L.memo)(function({mat:e}){let t=z(SI);return(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:e.last_unload_time?gue.format(e.last_unload_time):``}),(0,H.jsx)(Z,{children:e.serial}),(0,H.jsx)(Z,{children:(0,H.jsxs)(RC,{direction:`row`,spacing:`2`,sx:{alignItems:`center`},children:[(0,H.jsx)(ZU,{part:e.partName,size:25}),(0,H.jsx)(q,{variant:`body2`,children:e.partName})]})}),(0,H.jsx)(Z,{children:e.workorderId}),(0,H.jsx)(Z,{children:e.closeout_completed===null||e.closeout_completed===void 0?``:e.closeout_failed?(0,H.jsx)(iT,{fontSize:`inherit`}):(0,H.jsx)($w,{fontSize:`inherit`})}),(0,H.jsx)(Z,{children:e.closeout_completed?_ue.format(e.closeout_completed):``}),(0,H.jsx)(Z,{padding:`checkbox`,children:e.serial!==null&&e.serial!==``?(0,H.jsx)(Um,{onClick:()=>{e.serial&&t({type:`ManuallyEnteredSerial`,serial:e.serial})},size:`large`,children:(0,H.jsx)(gT,{fontSize:`inherit`})}):void 0})]})});function yue({day:e}){let t=R(fL),n=(0,L.useMemo)(()=>{let n=LT(e,1),r=[];for(let i of t.matsById.values())i.completed_last_proc_machining===!0&&i.last_unload_time&&i.last_unload_time>=e&&i.last_unload_time<n&&r.push(i);return r},[t,e]),[r,i]=(0,L.useState)(0),[a,o]=(0,L.useState)(`asc`),s=(0,L.useMemo)(()=>mue(n,r,a),[n,r,a]);return(0,H.jsxs)(jw,{stickyHeader:!0,children:[(0,H.jsx)(Lw,{children:(0,H.jsx)(hue,{sortBy:r,setSortBy:i,sortOrder:a,setSortOrder:o})}),(0,H.jsx)(Pw,{children:s.map(e=>(0,H.jsx)(vue,{mat:e},e.materialID))})]})}function bue(){JI(`Close Out`);let[e,t]=(0,L.useState)(cE());return(0,H.jsxs)(J,{sx:{padding:`24px`},children:[(0,H.jsx)(J,{component:`nav`,sx:{display:`flex`,justifyContent:`center`},children:(0,H.jsx)(pue,{day:e,setDay:t})}),(0,H.jsx)(`main`,{children:(0,H.jsx)(yue,{day:e})}),(0,H.jsx)(Z0,{}),(0,H.jsx)(due,{})]})}var k9=P(!1),A9=P(!1),j9=P(!1),M9=[{id:0,numeric:!1,label:`ID`,getDisplay:e=>e.bookingId,Cell:({row:e})=>e.canceled?(0,H.jsx)(q,{sx:{textDecoration:`line-through`,fontSize:`inherit`},children:e.bookingId}):e.bookingId},{id:1,numeric:!1,label:`Part`,getDisplay:e=>e.partName,Cell:({row:e})=>(0,H.jsxs)(RC,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[(0,H.jsx)(ZU,{part:e.partName,size:25}),e.partName]})},{id:2,numeric:!0,label:`Quantity`,getDisplay:e=>e.quantity.toString(),getForSort:e=>e.quantity},{id:3,numeric:!1,label:`Request Time`,getDisplay:e=>e.timeUTC.toLocaleString(),getForSort:e=>e.timeUTC.getTime()},{id:4,numeric:!1,label:`Priority`,getDisplay:e=>e.priority?e.priority.toString():``,getForSort:e=>e.priority??0},{id:5,numeric:!1,label:`Workorder`,getDisplay:e=>e.workorder??``},{id:6,numeric:!1,label:`Canceled`,getDisplay:e=>e.canceled?.toLocaleString()??``,getForSort:e=>e.canceled?.getTime()??0,openFilterDialog:k9},{id:7,numeric:!1,label:`Scheduled Job`,getDisplay:e=>e.job??``,openFilterDialog:k9},{id:8,numeric:!1,label:`Scheduled Time`,getDisplay:e=>e.schTime?e.schTime.toLocaleString():``,getForSort:e=>e.schTime?e.schTime.getTime():0}],xue=(0,L.memo)(function({setRebookingToShow:e}){let t=f0(3,M9,`desc`),n=d0(),r=R(wR),i=R(ER),a=R(OR),o=R(A9),s=R(j9),c=(0,L.useMemo)(()=>r.adjust(a,(e,t)=>e?{...e,job:t?.jobUnique,schTime:t?.scheduledTime}:void 0).adjust(i,(e,t)=>e?{...e,canceled:t}:void 0).valuesToAscLazySeq().transform(e=>o?e.filter(e=>!e.job):e).transform(e=>s?e.filter(e=>!e.canceled):e).toSortedArray(t.sortOn),[t.sortOn,r,i,a,o,s]);return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(jw,{children:[(0,H.jsx)(r0,{columns:M9,sort:t,showDetailsCol:!0,copyToClipboardRows:c}),(0,H.jsx)(l0,{columns:M9,pageData:c,rowsPerPage:n.rowsPerPage,onClickDetails:(t,n)=>e(n)})]}),(0,H.jsx)(c0,{tpage:n,count:c.length})]})}),N9=new Intl.DateTimeFormat(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`numeric`,minute:`numeric`}),Sue=(0,L.memo)(function({rebooking:e,close:t}){let[n,r]=PR();function i(){e&&n(e.bookingId).then(()=>t(void 0)).catch(console.log)}return(0,H.jsxs)(cy,{open:e!==void 0,onClose:()=>t(void 0),children:[(0,H.jsx)(dy,{children:e?.canceled?(0,H.jsx)(q,{sx:{textDecoration:`line-through`},children:e?.bookingId}):e?.bookingId}),(0,H.jsx)(uy,{children:(0,H.jsxs)(RC,{direction:`column`,spacing:1,children:[e?.canceled&&(0,H.jsxs)(q,{variant:`h5`,children:[`Canceled at `,N9.format(e.canceled)]}),(0,H.jsxs)(RC,{direction:`row`,spacing:1,children:[(0,H.jsx)(`span`,{children:`Part:`}),e?.partName&&(0,H.jsx)(ZU,{part:e?.partName,size:25}),(0,H.jsx)(`span`,{children:e?.partName})]}),(0,H.jsxs)(q,{children:[`Quantity: `,e?.quantity]}),(0,H.jsxs)(q,{children:[`Request Time: `,N9.format(e?.timeUTC)]}),(0,H.jsxs)(q,{children:[`Priority: `,e?.priority]}),e?.workorder&&(0,H.jsxs)(q,{children:[`Workorder: `,e?.workorder]}),(0,H.jsxs)(q,{children:[`Note: `,e?.notes]}),e?.job&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(py,{}),(0,H.jsxs)(q,{children:[`Scheduled Job: `,e?.job]}),(0,H.jsxs)(q,{children:[`Scheduled Time: `,e?.schTime?.toLocaleString()]})]})]})}),(0,H.jsxs)(ly,{children:[!e?.canceled&&!e?.job&&(0,H.jsxs)(Y,{onClick:i,color:`secondary`,disabled:r,children:[r?(0,H.jsx)(Lm,{size:24}):void 0,`Cancel Rebooking Request`]}),(0,H.jsx)(Y,{onClick:()=>t(void 0),children:`Close`})]})]})}),Cue=P(e=>Q.ofObject(e(NO).jobs).map(([e,t])=>t.partName).concat(e(sO).valuesToLazySeq().map(e=>e.partName)).distinctAndSortBy(e=>e).toRArray()),wue=(0,L.memo)(function(){let[e,t]=(0,L.useState)(!1),[n,r]=(0,L.useState)({part:``}),i=R(Cue),[a,o]=FR(),s=n.part!==``&&!!n.qty&&!isNaN(n.qty);function c(){t(!1),r({part:``})}function l(){s&&a(n).then(c).catch(console.log)}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(cy,{open:e,onClose:c,children:[(0,H.jsx)(dy,{children:`Create New`}),(0,H.jsx)(uy,{children:(0,H.jsxs)(RC,{direction:`column`,spacing:2,sx:{mt:`0.5em`,minWidth:`25em`},children:[(0,H.jsx)(nte,{freeSolo:!0,selectOnFocus:!0,clearOnBlur:!0,handleHomeEndKeys:!0,disableClearable:!0,options:i,value:n.part,onChange:(e,t)=>r(e=>({...e,part:t})),renderInput:e=>(0,H.jsx)(Kw,{...e,label:`Part Name`,slotProps:{input:{...e.slotProps.input,startAdornment:(0,H.jsxs)(H.Fragment,{children:[n.part===``?void 0:(0,H.jsx)(Iy,{position:`start`,children:(0,H.jsx)(ZU,{part:n.part,size:25})}),e.slotProps.input?.startAdornment]})}}}),renderOption:(e,t)=>(0,H.jsx)(`li`,{...e,children:(0,H.jsxs)(RC,{direction:`row`,spacing:`1`,sx:{alignItems:`center`},children:[(0,H.jsx)(ZU,{part:t,size:25}),t]})}),filterOptions:(e,t)=>{let n=e.filter(e=>e.toLowerCase().includes(t.inputValue.toLowerCase()));return n.length===0&&t.inputValue!==``?[t.inputValue]:n}}),(0,H.jsx)(Kw,{label:`Quantity`,type:`number`,value:n.qty&&!isNaN(n.qty)?n.qty:``,onChange:e=>r(t=>({...t,qty:parseInt(e.target.value)}))}),(0,H.jsx)(Kw,{label:`Priority (optional)`,type:`number`,value:n.priority&&!isNaN(n.priority)?n.priority:``,onChange:e=>r(t=>({...t,priority:parseInt(e.target.value)}))}),(0,H.jsx)(Kw,{label:`Workorder (optional)`,value:n.workorder??``,onChange:e=>r(t=>({...t,workorder:e.target.value}))}),(0,H.jsx)(Kw,{label:`Notes (optional)`,multiline:!0,minRows:2,value:n.notes??``,onChange:e=>r(t=>({...t,notes:e.target.value}))})]})}),(0,H.jsxs)(ly,{children:[(0,H.jsxs)(Y,{color:`secondary`,onClick:l,disabled:!s||o,children:[o?(0,H.jsx)(Lm,{size:24}):void 0,`Create`]}),(0,H.jsx)(Y,{onClick:c,children:`Cancel`})]})]}),(0,H.jsx)(X,{title:`Add Rebooking`,children:(0,H.jsx)(hy,{onClick:()=>t(!0),sx:{position:`fixed`,bottom:`24px`,right:`24px`},color:`primary`,children:(0,H.jsx)(Yw,{})})})]})}),Tue=(0,L.memo)(function(){let[e,t]=B(k9),[n,r]=B(A9),[i,a]=B(j9);return(0,H.jsxs)(cy,{open:e,onClose:()=>t(!1),children:[(0,H.jsx)(dy,{children:`Filter`}),(0,H.jsx)(uy,{children:(0,H.jsxs)(RC,{direction:`column`,spacing:2,children:[(0,H.jsx)(vy,{control:(0,H.jsx)(wv,{checked:n,onChange:e=>r(e.target.checked)}),label:`Hide scheduled`}),(0,H.jsx)(vy,{control:(0,H.jsx)(wv,{checked:i,onChange:e=>a(e.target.checked)}),label:`Hide canceled`})]})}),(0,H.jsx)(ly,{children:(0,H.jsx)(Y,{onClick:()=>t(!1),children:`Close`})})]})});function Eue(){JI(R(br).supportsRebookings??`Rebookings`);let[e,t]=(0,L.useState)(void 0);return(0,H.jsxs)(J,{component:`main`,sx:{padding:`24px`},children:[(0,H.jsx)(xue,{setRebookingToShow:t}),(0,H.jsx)(Sue,{rebooking:e,close:t}),(0,H.jsx)(wue,{}),(0,H.jsx)(Tue,{})]})}var P9=P(Math.floor(Date.now()/6e4));P9.onMount=e=>{let t=setInterval(()=>{e(Math.floor(Date.now()/6e4))},6e4);return()=>clearInterval(t)};var F9=SO(`charts_last30WeekdayStartIdx`,0),I9=SO(`charts_last30WeekdayStartMinuteOffset`,360),L9=aO(e=>P(t=>{let n=t(F9),r=t(I9),i=new Date(t(P9)*6e4),a=JT(KT(i),r),o=JT(UT(i,{weekStartsOn:n}),r);switch(e){case`StartOfToday`:return a;case`StartOfYesterday`:return LT(a,-1);case`StartOfWeek`:return o;case`StartOfLastWeek`:return LT(o,-7);case`Last30`:return LT(i,-30)}})),R9=aO(e=>P(t=>{if(e===`Now`)return null;let n=t(F9),r=t(I9),i=new Date(t(P9)*6e4);switch(e){case`EndOfYesterday`:return JT(KT(i),r);case`EndOfLastWeek`:return JT(UT(i,{weekStartsOn:n}),r)}}));function Due(e){let t=SO(`charts_${e}_start`,`StartOfWeek`),n=SO(`charts_${e}_end`,`Now`);return P(e=>{let r=e(t),i=e(n);return{startType:r,endType:i,startDate:r instanceof Date?r:e(L9(r)),endDate:i instanceof Date?i:e(R9(i))}},(e,r,i)=>{`start`in i&&r(t,i.start),`end`in i&&r(n,i.end)})}function Oue(e){return e.closeout_completed===void 0?!!(Q.ofObject(e.completedInspections??{}).some(([,e])=>!e.success)||e.currently_quarantined):e.closeout_failed!==!1}var z9=Due(`part-summary`),kue=P(e=>{let t=e(fL),n=e(uk),r=e(z9),i=n.valuesToLazySeq().filter(e=>(r.startDate===null||e.endTime>=r.startDate)&&(r.endDate===null||e.endTime<=r.endDate)).toLookupOrderedMap(e=>e.part,e=>e.stationGroup,e=>({isLoadUnload:$O(e),elapsed:e.elapsedMinsPerMaterial*e.material.length,active:e.activeMinutes,medianElapsed:e.medianCycleMinutes}),(e,t)=>({isLoadUnload:e.isLoadUnload||t.isLoadUnload,elapsed:e.elapsed+t.elapsed,active:e.active+t.active,medianElapsed:e.medianElapsed+t.medianElapsed}));return t.matsById.valuesToLazySeq().filter(e=>!!(e.numProcesses&&e.unloaded_processes?.[e.numProcesses]&&(r.startDate===null||e.unloaded_processes[e.numProcesses]>=r.startDate)&&(r.endDate===null||e.unloaded_processes[e.numProcesses]<=r.endDate))).toOrderedLookup(e=>e.partName).mapValues((e,t)=>({part:t,completedQty:e.length,abnormalQty:Q.of(e).sumBy(e=>+!!Oue(e)),mats:e,stationMins:eO.empty(),workorders:Q.of(e).toOrderedSet(e=>e.workorderId??``).delete(``)})).adjust(i,(e,t,n)=>e?{...e,stationMins:t}:{part:n,completedQty:0,abnormalQty:0,mats:[],stationMins:t,workorders:QD.empty()}).valuesToAscLazySeq().toRArray()});function Aue(e){return e===`CustomDate`||e===`StartOfToday`||e===`StartOfYesterday`||e===`StartOfWeek`||e===`StartOfLastWeek`||e===`Last30`}function jue(e){return e===`CustomDate`||e===`Now`||e===`EndOfYesterday`||e===`EndOfLastWeek`}function Mue(e){switch(e){case`0`:return 0;case`1`:return 1;case`2`:return 2;case`3`:return 3;case`4`:return 4;case`5`:return 5;case`6`:return 6;default:return null}}function B9({label:e,date:t}){return(0,H.jsxs)(J,{children:[(0,H.jsx)(q,{children:e}),t?(0,H.jsxs)(q,{variant:`subtitle2`,children:[`(`,t.toLocaleString(),`)`]}):void 0]})}function V9({date:e,setDate:t,enabled:n}){let r=R(L9(`Last30`));return(0,H.jsx)(Kw,{type:`datetime-local`,value:e?new Date(e.getTime()-e.getTimezoneOffset()*6e4).toISOString().slice(0,16):``,onChange:e=>t(new Date(e.target.value)),disabled:!n,label:`Custom Date`,slotProps:{inputLabel:{shrink:!0},htmlInput:{min:new Date(r.getTime()-r.getTimezoneOffset()*6e4).toISOString().slice(0,16)}}})}function Nue({chartAtom:e}){let[t,n]=B(e),r=R(I9),[i,a]=(0,L.useState)(t.startType instanceof Date?t.startType:JT(cE(),r));function o(e){n(e===`CustomDate`?{start:i??new Date}:{start:e})}function s(e){a(e),n({start:e})}let c=R(L9(`StartOfToday`)),l=R(L9(`StartOfYesterday`)),u=R(L9(`StartOfWeek`)),d=R(L9(`StartOfLastWeek`)),f=R(L9(`Last30`));return(0,H.jsxs)(J,{children:[(0,H.jsx)(q,{variant:`h6`,children:`Range Start`}),(0,H.jsx)(bS,{value:t.startType instanceof Date?`CustomDate`:t.startType,onChange:e=>{Aue(e.target.value)&&o(e.target.value)},children:(0,H.jsxs)(RC,{direction:`column`,spacing:2,children:[(0,H.jsxs)(RC,{direction:`row`,sx:{alignItems:`center`,minHeight:`3em`},children:[(0,H.jsx)(_S,{value:`StartOfToday`}),(0,H.jsx)(B9,{label:`Start of Today`,date:c})]}),(0,H.jsxs)(RC,{direction:`row`,sx:{alignItems:`center`,minHeight:`3em`},children:[(0,H.jsx)(_S,{value:`StartOfYesterday`}),(0,H.jsx)(B9,{label:`Start of Yesterday`,date:l})]}),(0,H.jsxs)(RC,{direction:`row`,sx:{alignItems:`center`,minHeight:`3em`},children:[(0,H.jsx)(_S,{value:`StartOfWeek`}),(0,H.jsx)(B9,{label:`Start of This Week`,date:u})]}),(0,H.jsxs)(RC,{direction:`row`,sx:{alignItems:`center`,minHeight:`3em`},children:[(0,H.jsx)(_S,{value:`StartOfLastWeek`}),(0,H.jsx)(B9,{label:`Start of Last Week`,date:d})]}),(0,H.jsxs)(RC,{direction:`row`,sx:{alignItems:`center`,minHeight:`3em`},children:[(0,H.jsx)(_S,{value:`Last30`}),(0,H.jsx)(B9,{label:`Last 30 Days`,date:f})]}),(0,H.jsxs)(RC,{direction:`row`,sx:{alignItems:`center`,minHeight:`3em`},children:[(0,H.jsx)(_S,{value:`CustomDate`}),(0,H.jsx)(V9,{enabled:t.startType instanceof Date,date:i,setDate:s})]})]})})]})}function Pue({chartAtom:e}){let[t,n]=B(e),r=R(I9),[i,a]=(0,L.useState)(t.endType instanceof Date?t.endType:JT(cE(),r));function o(e){n(e===`CustomDate`?{end:i??new Date}:{end:e})}function s(e){a(e),n({end:e})}let c=R(R9(`EndOfYesterday`)),l=R(R9(`EndOfLastWeek`));return(0,H.jsxs)(J,{children:[(0,H.jsx)(q,{variant:`h6`,children:`Range End`}),(0,H.jsx)(bS,{value:t.endType instanceof Date?`CustomDate`:t.endType,onChange:e=>{jue(e.target.value)&&o(e.target.value)},children:(0,H.jsxs)(RC,{direction:`column`,spacing:2,children:[(0,H.jsxs)(RC,{direction:`row`,sx:{alignItems:`center`,minHeight:`3em`},children:[(0,H.jsx)(_S,{value:`Now`}),(0,H.jsx)(q,{children:`Now`})]}),(0,H.jsxs)(RC,{direction:`row`,sx:{alignItems:`center`,minHeight:`3em`},children:[(0,H.jsx)(_S,{value:`EndOfYesterday`}),(0,H.jsx)(B9,{label:`End of Yesterday`,date:c})]}),(0,H.jsx)(J,{sx:{height:`3em`}}),(0,H.jsxs)(RC,{direction:`row`,sx:{alignItems:`center`,minHeight:`3em`},children:[(0,H.jsx)(_S,{value:`EndOfLastWeek`}),(0,H.jsx)(B9,{label:`End of Last Week`,date:l})]}),(0,H.jsx)(J,{sx:{height:`3em`}}),(0,H.jsxs)(RC,{direction:`row`,sx:{alignItems:`center`,minHeight:`3em`},children:[(0,H.jsx)(_S,{value:`CustomDate`}),(0,H.jsx)(V9,{enabled:t.endType instanceof Date,date:i,setDate:s})]})]})})]})}function Fue(e){let t=Math.floor(e/60),n=e%60;return`${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}`}function Iue({chartAtom:e,open:t,setOpen:n}){let[r,i]=B(F9),[a,o]=B(I9);return(0,H.jsxs)(cy,{open:t,onClose:()=>n(!1),maxWidth:`md`,children:[(0,H.jsx)(uy,{children:(0,H.jsxs)(RC,{direction:`column`,spacing:2,divider:(0,H.jsx)(py,{orientation:`horizontal`,flexItem:!0}),children:[(0,H.jsxs)(RC,{direction:`row`,spacing:2,divider:(0,H.jsx)(py,{orientation:`vertical`,flexItem:!0}),children:[(0,H.jsx)(Nue,{chartAtom:e}),(0,H.jsx)(Pue,{chartAtom:e})]}),(0,H.jsxs)(RC,{direction:`row`,sx:{justifyContent:`space-around`},children:[(0,H.jsxs)(Kw,{select:!0,label:`First Day Of Week`,sx:{minWidth:`10em`},value:r,onChange:e=>{let t=Mue(e.target.value);t!==null&&i(t)},children:[(0,H.jsx)(Hx,{value:0,children:`Sunday`}),(0,H.jsx)(Hx,{value:1,children:`Monday`}),(0,H.jsx)(Hx,{value:2,children:`Tuesday`}),(0,H.jsx)(Hx,{value:3,children:`Wednesday`}),(0,H.jsx)(Hx,{value:4,children:`Thursday`}),(0,H.jsx)(Hx,{value:5,children:`Friday`}),(0,H.jsx)(Hx,{value:6,children:`Saturday`})]}),(0,H.jsx)(Kw,{type:`time`,label:`Day Start Time`,sx:{minWidth:`10em`},value:Fue(a),onChange:e=>{let t=e.target.value;if(t===``)o(0);else{let[e,n]=t.split(`:`).map(Number);o(e*60+n)}}})]})]})}),(0,H.jsx)(ly,{children:(0,H.jsx)(Y,{onClick:()=>n(!1),children:`Close`})})]})}function Lue(e,t){if(e instanceof Date)return e.toLocaleString();switch(e){case`StartOfToday`:return`Start of Today${t?` (${t.toLocaleString()})`:``}`;case`StartOfYesterday`:return`Start of Yesterday${t?` (${t.toLocaleString()})`:``}`;case`StartOfWeek`:return`Start of This Week${t?` (${t.toLocaleString()})`:``}`;case`StartOfLastWeek`:return`Start of Last Week${t?` (${t.toLocaleString()})`:``}`;case`Last30`:return`Last 30 Days${t?` (${t.toLocaleString()})`:``}`}}function Rue(e,t){if(e instanceof Date)return e.toLocaleString();switch(e){case`Now`:return`Now`;case`EndOfYesterday`:return`End of Yesterday${t?` (${t.toLocaleString()})`:``}`;case`EndOfLastWeek`:return`End of Last Week${t?` (${t.toLocaleString()})`:``}`}}var zue=(0,L.memo)(function({chartAtom:e}){let t=R(e),[n,r]=(0,L.useState)(!1);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(RC,{direction:`row`,spacing:2,sx:{alignItems:`center`},children:[(0,H.jsxs)(q,{variant:`body2`,color:`textSecondary`,children:[`Range: `,Lue(t.startType,t.startDate),` -`,` `,Rue(t.endType,t.endDate)]}),(0,H.jsx)(X,{title:`Edit Range`,children:(0,H.jsx)(Um,{onClick:()=>r(!0),children:(0,H.jsx)(rT,{})})})]}),(0,H.jsx)(Iue,{open:n,setOpen:r,chartAtom:e})]})}),H9=new Intl.NumberFormat(void 0,{maximumFractionDigits:1});function Bue(e,t,n){let r;switch(t){case`PartName`:r=e=>e.part;break;case`CompletedQty`:r=e=>e.completedQty;break;case`AbnormalQty`:r=e=>e.abnormalQty;break;case`Workorders`:r=e=>e.workorders.lookupMin()?.[0]??null;break;case`Elapsed`:r=e=>e.stationMins.toAscLazySeq().filter(([e,t])=>!t.isLoadUnload).sumBy(([,e])=>e.elapsed);break;case`Active`:r=e=>e.stationMins.toAscLazySeq().filter(([e,t])=>!t.isLoadUnload).sumBy(([e,t])=>t.active);break;case`Median`:r=e=>e.stationMins.toAscLazySeq().filter(([e,t])=>!t.isLoadUnload).sumBy(([e,t])=>t.medianElapsed);break}let i=[...e];return i.sort(ME(n===`asc`?{asc:r}:{desc:r})),i}var Vue=new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`});function Hue(e,t,n){let r;switch(t){case`Serial`:r=e=>e.serial??null;break;case`CompletedDate`:r=e=>e.last_unload_time??null;break;case`Workorder`:r=e=>e.workorderId??null;break;case`Quarantined`:r=e=>e.currently_quarantined??null;break;case`InspectFailed`:r=e=>Q.ofObject(e.completedInspections??{}).some(([,e])=>!e.success)?-1:0;break;case`CloseOut`:r=e=>e.closeout_failed===void 0?1:e.closeout_failed?-1:0;break}let i=[...e];return i.sort(ME(n===`asc`?{asc:r}:{desc:r})),i}function U9(e){return(0,H.jsxs)(Z,{align:e.align,sortDirection:e.sortBy===e.col&&e.order,sx:e.noWhitespaceWrap?{whiteSpace:`nowrap`}:void 0,children:[(0,H.jsx)(X,{title:`Sort`,enterDelay:300,children:(0,H.jsx)(Uw,{active:e.sortBy===e.col,direction:e.order,onClick:()=>{e.col===e.sortBy?e.setOrder(e.order===`asc`?`desc`:`asc`):(e.setSortBy(e.col),e.setOrder(`asc`))},children:e.children})}),e.extraIcon]})}var W9=(0,L.memo)(function({workorderId:e}){return!e||e===``?(0,H.jsx)(`span`,{}):(0,H.jsx)(Nie,{to:{route:$.Operations_CurrentWorkorders,workorder:e},children:e})});function Uue({material:e}){let t=z(SI),[n,r]=(0,L.useState)(`Serial`),[i,a]=(0,L.useState)(`asc`),o=(0,L.useMemo)(()=>Hue(e,n,i),[e,n,i]),s={sortBy:n,setSortBy:r,order:i,setOrder:a},[c,l]=(0,L.useState)(10),[u,d]=(0,L.useState)(0),f=o.slice(u*c,(u+1)*c);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(jw,{size:`small`,children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(U9,{col:`Serial`,...s,children:`Serial`}),(0,H.jsx)(U9,{col:`CompletedDate`,...s,children:`Completed`}),(0,H.jsx)(U9,{col:`Workorder`,...s,children:`Workorder`}),(0,H.jsx)(U9,{col:`Quarantined`,...s,children:`Quarantine?`}),(0,H.jsx)(U9,{col:`InspectFailed`,noWhitespaceWrap:!0,...s,children:`Inspect Failed?`}),(0,H.jsx)(U9,{col:`CloseOut`,noWhitespaceWrap:!0,...s,children:`Close Out`}),(0,H.jsx)(Z,{padding:`checkbox`})]})}),(0,H.jsxs)(Pw,{children:[f.map(e=>(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:e.serial??``}),(0,H.jsx)(Z,{children:e.last_unload_time?Vue.format(e.last_unload_time):``}),(0,H.jsx)(Z,{children:(0,H.jsx)(W9,{workorderId:e.workorderId})}),(0,H.jsx)(Z,{sx:{textAlign:`center`},padding:`checkbox`,children:e.currently_quarantined?(0,H.jsx)(yT,{fontSize:`inherit`}):``}),(0,H.jsx)(Z,{sx:{textAlign:`center`},padding:`checkbox`,children:Q.ofObject(e.completedInspections??{}).some(([,e])=>!e.success)?(0,H.jsx)(iT,{fontSize:`inherit`}):``}),(0,H.jsx)(Z,{sx:{textAlign:`center`},padding:`checkbox`,children:e.closeout_completed===void 0?``:e.closeout_failed===!1?(0,H.jsx)($w,{fontSize:`inherit`}):(0,H.jsx)(iT,{fontSize:`inherit`})}),(0,H.jsx)(Z,{padding:`checkbox`,children:(0,H.jsx)(Um,{onClick:()=>t({type:`MatSummary`,summary:e}),size:`large`,children:(0,H.jsx)(gT,{fontSize:`inherit`})})})]},e.materialID)),Q.ofRange(0,c-f.length).map(e=>(0,H.jsx)(Vw,{children:(0,H.jsx)(Z,{colSpan:7,children:`\xA0`})},e))]})]}),(0,H.jsxs)(Rw,{variant:`dense`,sx:{mb:`0.5em`},children:[(0,H.jsx)(q,{color:`textSecondary`,variant:`caption`,children:`Rows per page:`}),(0,H.jsx)(YS,{style:{marginLeft:8,marginRight:`1em`},value:c,SelectDisplayProps:{style:{color:`rgba(0, 0, 0, 0.54)`}},input:(0,H.jsx)(ff,{}),onChange:t=>{let n=t.target.value;l(n);let r=Math.ceil(e.length/n)-1;u>r&&d(r)},children:[10,15,20,50].map(e=>(0,H.jsx)(Hx,{value:e,children:e},e))}),(0,H.jsx)(q,{color:`textSecondary`,variant:`caption`,children:`${e.length===0?0:u*c+1}-${Math.min(e.length,(u+1)*c)} of ${e.length}`}),(0,H.jsx)(Um,{onClick:()=>d(0),disabled:u===0,"aria-label":`First Page`,size:`large`,children:(0,H.jsx)(sT,{})}),(0,H.jsx)(Um,{onClick:()=>d(u-1),disabled:u===0,"aria-label":`Previous Page`,size:`large`,children:(0,H.jsx)(fT,{})}),(0,H.jsx)(Um,{onClick:()=>d(u+1),disabled:u>=Math.ceil(e.length/c)-1,"aria-label":`Next Page`,size:`large`,children:(0,H.jsx)(pT,{})}),(0,H.jsx)(Um,{onClick:()=>d(Math.max(0,Math.ceil(e.length/c)-1)),disabled:u>=Math.ceil(e.length/c)-1,"aria-label":`Last Page`,size:`large`,children:(0,H.jsx)(hT,{})})]})]})}var Wue=(0,L.memo)(function({part:e}){return(0,H.jsxs)(RC,{direction:`row`,sx:{flexWrap:`wrap`,justifyContent:`space-around`,ml:`1em`,mr:`1em`},children:[(0,H.jsx)(J,{sx:{width:`60em`,overflow:`auto`},children:(0,H.jsx)(Uue,{material:e.mats})}),(0,H.jsx)(J,{sx:{width:`40em`,overflow:`auto`},children:(0,H.jsxs)(jw,{size:`small`,children:[(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:`Station`}),(0,H.jsx)(Z,{children:`Active Hours`}),(0,H.jsx)(Z,{children:`Elapsed Hours`}),(0,H.jsx)(Z,{children:`Total Median Hours`})]})}),(0,H.jsx)(Pw,{children:e.stationMins.toAscLazySeq().map(([e,t])=>(0,H.jsxs)(Vw,{children:[(0,H.jsx)(Z,{children:e}),(0,H.jsx)(Z,{children:H9.format(t.active/60)}),(0,H.jsx)(Z,{children:H9.format(t.elapsed/60)}),(0,H.jsx)(Z,{children:H9.format(t.medianElapsed/60)})]},e))})]})})]})}),Gue=G(Vw)({"& > *":{borderBottom:`unset !important`}}),Kue=(0,L.memo)(function({part:e}){let[t,n]=(0,L.useState)(!1);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(Gue,{children:[(0,H.jsx)(Z,{children:(0,H.jsxs)(J,{sx:{display:`flex`,alignItems:`center`},children:[(0,H.jsx)(J,{sx:{mr:`0.2em`},children:(0,H.jsx)(ZU,{part:e.part,size:25})}),(0,H.jsx)(`div`,{children:(0,H.jsx)(q,{variant:`body2`,component:`span`,sx:{display:`block`},children:e.part})})]})}),(0,H.jsx)(Z,{align:`right`,children:e.completedQty}),(0,H.jsx)(Z,{align:`right`,children:e.abnormalQty}),(0,H.jsx)(Z,{align:`right`,children:H9.format(e.stationMins.toAscLazySeq().filter(([e,t])=>!t.isLoadUnload).sumBy(([e,t])=>t.active)/60)}),(0,H.jsx)(Z,{align:`right`,children:H9.format(e.stationMins.toAscLazySeq().filter(([e,t])=>!t.isLoadUnload).sumBy(([,e])=>e.elapsed)/60)}),(0,H.jsx)(Z,{align:`right`,children:H9.format(e.stationMins.toAscLazySeq().filter(([e,t])=>!t.isLoadUnload).sumBy(([,e])=>e.medianElapsed)/60)}),(0,H.jsx)(Z,{align:`left`,children:e.workorders.size<=1?(0,H.jsx)(W9,{workorderId:e.workorders.lookupMin()??null}):e.workorders.size===2?(0,H.jsxs)(`span`,{children:[(0,H.jsx)(W9,{workorderId:e.workorders.lookupMin()}),` &`,` `,(0,H.jsx)(W9,{workorderId:e.workorders.lookupMax()})]}):`${e.workorders.size} workorders`}),(0,H.jsx)(Z,{children:(0,H.jsx)(X,{title:`Show Details`,children:(0,H.jsx)(Um,{size:`small`,onClick:()=>n(!t),children:t?(0,H.jsx)(mT,{}):(0,H.jsx)(dT,{})})})})]}),(0,H.jsx)(Vw,{children:(0,H.jsx)(Z,{sx:{pb:`0`,pt:`0`},colSpan:7,children:(0,H.jsx)(zp,{in:t,timeout:`auto`,unmountOnExit:!0,children:(0,H.jsx)(Wue,{part:e})})})})]})});function que({partsAtom:e}){let t=R(e);return(0,H.jsx)(X,{title:`Copy to Clipboard`,children:(0,H.jsx)(Um,{style:{height:`25px`,paddingTop:0,paddingBottom:0},size:`large`,onClick:()=>tde(t),children:(0,H.jsx)(uT,{})})})}function Jue(){return(0,H.jsx)(X,{title:`Total Median Hours are calculated by taking the median cycle time (excluding outliers) and adding up for each piece of material.`,children:(0,H.jsx)(`span`,{style:{verticalAlign:`middle`,marginLeft:`0.5em`,fontSize:16},children:(0,H.jsx)(cT,{fontSize:`inherit`})})})}function G9(){return(0,H.jsx)(X,{title:`The entire cycle time is credited at the time the cycle completes, so it may be that a day has more than 24 hours of credited time for example.`,children:(0,H.jsx)(`span`,{style:{verticalAlign:`middle`,marginLeft:`0.5em`,fontSize:16},children:(0,H.jsx)(cT,{fontSize:`inherit`})})})}function Yue(){return(0,H.jsx)(X,{title:`An abnormal part is one which was quarantined, had a failed inspection, or was explicitly marked as failing closeout. A successful closeout overrides this and will never be an abnormal part.`,children:(0,H.jsx)(`span`,{style:{verticalAlign:`middle`,marginLeft:`0.5em`,fontSize:16},children:(0,H.jsx)(cT,{fontSize:`inherit`})})})}var Xue=(0,L.memo)(function({partsAtom:e,order:t,setOrder:n,sortBy:r,setSortBy:i}){let a={sortBy:r,setSortBy:i,order:t,setOrder:n};return(0,H.jsx)(Lw,{children:(0,H.jsxs)(Vw,{children:[(0,H.jsx)(U9,{align:`left`,col:`PartName`,...a,children:`Part`}),(0,H.jsx)(U9,{align:`right`,col:`CompletedQty`,...a,children:`Completed Quantity`}),(0,H.jsx)(U9,{align:`right`,col:`AbnormalQty`,...a,extraIcon:(0,H.jsx)(Yue,{}),children:`Abnormal Quantity`}),(0,H.jsx)(U9,{align:`right`,col:`Active`,...a,extraIcon:(0,H.jsx)(G9,{}),children:`Active Hours`}),(0,H.jsx)(U9,{align:`right`,col:`Elapsed`,...a,extraIcon:(0,H.jsx)(G9,{}),children:`Elapsed Hours`}),(0,H.jsx)(U9,{align:`right`,col:`Median`,...a,extraIcon:(0,H.jsx)(Jue,{}),children:`Total Median Hours`}),(0,H.jsx)(U9,{align:`left`,col:`Workorders`,...a,children:`Workorders`}),(0,H.jsx)(Z,{children:(0,H.jsx)(que,{partsAtom:e})})]})})}),Zue=(0,L.memo)(function({partsAtom:e}){let t=R(e),[n,r]=(0,L.useState)(`PartName`),[i,a]=(0,L.useState)(`asc`),o=Bue(t,n,i);return(0,H.jsxs)(jw,{stickyHeader:!0,children:[(0,H.jsx)(Xue,{partsAtom:e,sortBy:n,setSortBy:r,order:i,setOrder:a}),(0,H.jsx)(Pw,{children:o.map(e=>(0,H.jsx)(Kue,{part:e},e.part))})]})});function Que(){let e=z(q0),t=R(TI),[n,r]=LI(),i=z(SI);if(t===null||t.materialID<0)return null;function a(e){t!==null&&(n({mat:t,operator:`Manager`,failed:e}),i(null))}return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Y,{color:`primary`,disabled:r,onClick:()=>a(!0),children:`Fail CloseOut`}),(0,H.jsx)(Y,{color:`primary`,disabled:r,onClick:()=>a(!1),children:`Pass CloseOut`}),(0,H.jsx)(Y,{color:`primary`,onClick:()=>e(!0),children:`Change Workorder`})]})}var $ue=(0,L.memo)(function(){return(0,H.jsx)(EW,{buttons:(0,H.jsx)(Que,{})})});function ede(){return JI(`Completed Parts`),(0,H.jsxs)(J,{component:`main`,sx:{padding:`24px`},children:[(0,H.jsxs)(RC,{direction:`row`,spacing:2,sx:{alignItems:`center`,justifyContent:`space-between`},children:[(0,H.jsx)(`span`,{children:`Completed Parts`}),(0,H.jsx)(zue,{chartAtom:z9})]}),(0,H.jsx)(Zue,{partsAtom:kue}),(0,H.jsx)($ue,{}),(0,H.jsx)(Z0,{})]})}function tde(e){let t=`<table>
|
|
384
384
|
<thead><tr>`;t+=`<th>Part</th>`,t+=`<th>Completed Qty</th>`,t+=`<th>Abnormal Qty</th>`,t+=`<th>Workorders</th>`,t+=`<th>Active Machine Time (mins)</th>`,t+=`<th>Elapsed Machine Time (mins)</th>`,t+=`<th>Total Median Machine Time (mins)</th>`,t+=`<th>Active L/U Time (mins)</th>`,t+=`<th>Elapsed L/U Time (mins)</th>`,t+=`<th>Total Median L/U Time (mins)</th>`,t+=`</tr></thead>
|
|
385
385
|
<tbody>
|
|
386
386
|
`;for(let n of e){t+=`<tr>`,t+=`<td>${n.part}</td>`,t+=`<td>${n.completedQty}</td>`,t+=`<td>${n.abnormalQty}</td>`,t+=`<td>${n.workorders.toAscLazySeq().toRArray().join(`;`)}</td>`;for(let e of[!1,!0]){let r=n.stationMins.toAscLazySeq().filter(([t,n])=>n.isLoadUnload===e).toRArray();r.length===0?t+=`<td>0</td><td>0</td><td>0</td>`:r.length===1?(t+=`<td>${r[0][1].active}</td>`,t+=`<td>${r[0][1].elapsed}</td>`,t+=`<td>${r[0][1].medianElapsed}</td>`):(t+=`<td>${r.map(([e,t])=>`${e}: ${t.active}`).join(`;`)}</td>`,t+=`<td>${r.map(([e,t])=>`${e}: ${t.elapsed}`).join(`;`)}</td>`,t+=`<td>${r.map(([e,t])=>`${e}: ${t.medianElapsed}`).join(`;`)}</td>`)}t+=`</tr>
|
|
387
387
|
`}t+=`</tbody></table>
|
|
388
|
-
`,Ak(t,{format:`text/html`})}var K9=`bms-operations-reports-tab`,q9=[{separator:`Load/Unload`},{name:`L/U Outliers`,route:{route:$.Operations_LoadOutliers},icon:(0,H.jsx)(Xw,{})},{name:`L/U Hours`,route:{route:$.Operations_LoadHours},icon:(0,H.jsx)(lT,{})},{name:`L/U Cycles`,route:{route:$.Operations_LoadCycles},icon:(0,H.jsx)(wT,{})},{separator:`Machines`},{name:`MC Outliers`,route:{route:$.Operations_MachineOutliers},icon:(0,H.jsx)(Xw,{})},{name:`MC Hours`,route:{route:$.Operations_MachineHours},icon:(0,H.jsx)(lT,{})},{name:`MC Cycles`,route:{route:$.Operations_MachineCycles},icon:(0,H.jsx)(wT,{})},{name:`Tools`,route:{route:$.Operations_Tools},icon:(0,H.jsx)(nT,{})},{name:`Programs`,route:{route:$.Operations_Programs},icon:(0,H.jsx)(jre,{})},{separator:`Material`},{name:`Quality`,route:{route:$.Operations_Quality},icon:(0,H.jsx)(Zw,{})},{name:`Inspections`,route:{route:$.Operations_Inspections},icon:(0,H.jsx)(ore,{})},{name:`Close Out`,route:{route:$.Operations_CloseoutReport},icon:(0,H.jsx)(_T,{})},{separator:`Cell`},{name:`Schedules`,route:{route:$.Operations_RecentSchedules},icon:(0,H.jsx)(Qw,{})},{name:`Workorders`,route:{route:$.Operations_CurrentWorkorders},icon:(0,H.jsx)(oT,{})},{name:`Production`,route:{route:$.Operations_Production},icon:(0,H.jsx)(pre,{})},{name:`Part Summary`,route:{route:$.Operations_Parts},icon:(0,H.jsx)(Fre,{})},{name:e=>e.supportsRebookings??`Rebooking`,route:{route:$.Operations_Rebookings},icon:(0,H.jsx)(Mre,{}),hidden:e=>e.supportsRebookings===null||e.supportsRebookings===``}];function
|
|
388
|
+
`,Ak(t,{format:`text/html`})}var K9=`bms-operations-reports-tab`,q9=[{separator:`Load/Unload`},{name:`L/U Outliers`,route:{route:$.Operations_LoadOutliers},icon:(0,H.jsx)(Xw,{})},{name:`L/U Hours`,route:{route:$.Operations_LoadHours},icon:(0,H.jsx)(lT,{})},{name:`L/U Cycles`,route:{route:$.Operations_LoadCycles},icon:(0,H.jsx)(wT,{})},{separator:`Machines`},{name:`MC Outliers`,route:{route:$.Operations_MachineOutliers},icon:(0,H.jsx)(Xw,{})},{name:`MC Hours`,route:{route:$.Operations_MachineHours},icon:(0,H.jsx)(lT,{})},{name:`MC Cycles`,route:{route:$.Operations_MachineCycles},icon:(0,H.jsx)(wT,{})},{name:`Tools`,route:{route:$.Operations_Tools},icon:(0,H.jsx)(nT,{})},{name:`Programs`,route:{route:$.Operations_Programs},icon:(0,H.jsx)(jre,{})},{separator:`Material`},{name:`Quality`,route:{route:$.Operations_Quality},icon:(0,H.jsx)(Zw,{})},{name:`Inspections`,route:{route:$.Operations_Inspections},icon:(0,H.jsx)(ore,{})},{name:`Close Out`,route:{route:$.Operations_CloseoutReport},icon:(0,H.jsx)(_T,{})},{separator:`Cell`},{name:`Schedules`,route:{route:$.Operations_RecentSchedules},icon:(0,H.jsx)(Qw,{})},{name:`Workorders`,route:{route:$.Operations_CurrentWorkorders},icon:(0,H.jsx)(oT,{})},{name:`Production`,route:{route:$.Operations_Production},icon:(0,H.jsx)(pre,{})},{name:`Part Summary`,route:{route:$.Operations_Parts},icon:(0,H.jsx)(Fre,{})},{name:e=>e.supportsRebookings??`Rebooking`,route:{route:$.Operations_Rebookings},icon:(0,H.jsx)(Mre,{}),hidden:e=>e.supportsRebookings===null||e.supportsRebookings===``}];function nde(e){return[{separator:`Efficiency`},{name:`Buffers`,route:{route:$.Analysis_Buffers},icon:(0,H.jsx)(vre,{})},{name:`Station OEE`,route:{route:$.Analysis_StationOEE},icon:(0,H.jsx)(lT,{})},{name:`Completed Parts`,route:{route:$.Analysis_PartsCompleted},icon:(0,H.jsx)(oT,{})},{separator:`Cycles`},{name:`Machine Cycles`,route:{route:$.Analysis_MachineCycles},icon:(0,H.jsx)(wT,{})},{name:`L/U Cycles`,route:{route:$.Analysis_LoadCycles},icon:(0,H.jsx)(are,{})},{name:`Pallet Cycles`,route:{route:$.Analysis_PalletCycles},icon:(0,H.jsx)(xT,{})},{name:e=>ok(e.basketName)+` Cycles`,route:{route:$.Analysis_BasketCycles},icon:(0,H.jsx)(xT,{}),hidden:()=>!e},{separator:`Cell`},{name:`Quality`,route:{route:$.Analysis_Quality},icon:(0,H.jsx)(Zw,{})},{name:`Tool Replacements`,route:{route:$.Analysis_ToolReplacements},icon:(0,H.jsx)(nT,{})},{name:`Schedules`,route:{route:$.Analysis_Schedules},icon:(0,H.jsx)(Qw,{})},{separator:`Costs`},{name:`Percentages`,route:{route:$.Analysis_CostPercents},icon:(0,H.jsx)(dre,{})},{name:`Cost/Piece`,route:{route:$.Analysis_CostPerPiece},icon:(0,H.jsx)(cre,{})}]}function rde(e){return typeof e==`string`&&Object.values($).includes(e)}function ide(e){return rde(e)&&e!==$.Client_Custom&&e!==$.Operations_CurrentWorkorders&&e!==$.Station_InspectionMonitorWithType&&e!==$.Station_LoadMonitor&&e!==$.Station_Queues}function ade(e){return{route:e}}function J9({children:e}){let[t,n]=B(KI),r=Jw(Od().breakpoints.down(`md`)),[,i]=(0,L.useTransition)(),a=q9.some(e=>`separator`in e?!1:e.route.route===t.route);return(0,H.jsx)(Jne,{variant:r&&(!Array.isArray(e)||e.length<5)?`fullWidth`:`scrollable`,value:a?K9:t.route,onChange:(e,t)=>i(()=>{t===K9?n({route:$.Operations_MachineCycles}):ide(t)&&n(ade(t))}),textColor:`inherit`,scrollButtons:!0,allowScrollButtonsMobile:!0,indicatorColor:`secondary`,children:e})}function Y9(){return(0,H.jsxs)(J9,{children:[(0,H.jsx)(Ow,{label:`Operations`,value:$.Operations_Dashboard}),(0,H.jsx)(Ow,{label:`Cell`,value:$.Operations_SystemOverview}),(0,H.jsx)(Ow,{label:`Material`,value:$.Operations_AllMaterial}),(0,H.jsx)(Ow,{label:`Reports`,value:K9})]})}function X9(){return(0,H.jsxs)(J9,{children:[(0,H.jsx)(Ow,{label:`Material`,value:$.Quality_Dashboard}),(0,H.jsx)(Ow,{label:`Paths`,value:$.Quality_Paths}),(0,H.jsx)(Ow,{label:`Quarantine Material`,value:$.Quality_Quarantine})]})}function Z9(){return(0,H.jsxs)(J9,{children:[(0,H.jsx)(Ow,{label:`Tools`,value:$.Tools_Dashboard}),(0,H.jsx)(Ow,{label:`Programs`,value:$.Tools_Programs})]})}function Q9(){return(0,H.jsxs)(J9,{children:[(0,H.jsx)(Ow,{label:`Cycles`,value:$.Engineering_Cycles}),(0,H.jsx)(Ow,{label:`Hours`,value:$.Engineering_Hours}),(0,H.jsx)(Ow,{label:`Outliers`,value:$.Engineering_Outliers})]})}function $9(){return R(_R)===null?null:(0,H.jsxs)(J9,{children:[(0,H.jsx)(Ow,{label:`Workorders`,value:$.Sales_Dashboard}),(0,H.jsx)(Ow,{label:`Projections`,value:$.Sales_ProjectedUsage})]})}var ode=(0,L.memo)(function(e){Pie();let t=R(br),n=R(QL),r=R(tR),[i,a]=B(KI),o=nde(n||r),s=t.user!==null&&t.user!==void 0,c,l,u,d,f=!0,p=!0,m=!1,h=!0;if(vr(t)&&!t.user)c=(0,H.jsxs)(`div`,{style:{textAlign:`center`,marginTop:`4em`},children:[(0,H.jsx)(`h3`,{children:`Please Login`}),(0,H.jsx)(Y,{variant:`contained`,color:`primary`,onClick:()=>xr(t),children:`Login`})]}),f=!1,p=!1;else switch(i.route){case $.Station_LoadMonitor:c=(0,H.jsx)(h4,{loadNum:i.loadNum,queues:i.queues,completed:i.completed,submitBasketLoadStationCommand:e.submitBasketLoadStationCommand}),l=K3,u=q3,m=!0,h=!1;break;case $.Station_InspectionMonitor:c=(0,H.jsx)(C4,{focusInspectionType:null}),l=K3,u=q3,m=!0,h=!1;break;case $.Station_InspectionMonitorWithType:c=(0,H.jsx)(C4,{focusInspectionType:i.inspType}),l=K3,u=q3,m=!0,h=!1;break;case $.Station_Closeout:c=(0,H.jsx)(A4,{}),l=K3,u=q3,m=!0,h=!1;break;case $.Station_Queues:c=(0,H.jsx)(jX,{queues:i.queues}),l=K3,u=q3,m=!0,h=!1;break;case $.Station_Overview:c=(0,H.jsx)(L2,{}),h=!1;break;case $.Analysis_Quality:c=(0,H.jsx)(z3,{}),l=v7,d=o,f=!1;break;case $.Analysis_ToolReplacements:c=(0,H.jsx)(Tle,{}),l=v7,d=o,f=!1;break;case $.Analysis_Schedules:c=(0,H.jsx)(R3,{}),l=v7,d=o,f=!1;break;case $.Analysis_Buffers:c=(0,H.jsx)(vce,{}),l=v7,d=o,f=!1;break;case $.Analysis_StationOEE:c=(0,H.jsx)(Pce,{}),l=v7,d=o,f=!1;break;case $.Analysis_PartsCompleted:c=(0,H.jsx)(Rce,{}),l=v7,d=o,f=!1;break;case $.Analysis_MachineCycles:c=(0,H.jsx)(Jce,{}),l=v7,d=o,f=!1;break;case $.Analysis_LoadCycles:c=(0,H.jsx)(rle,{}),l=v7,d=o,f=!1;break;case $.Analysis_PalletCycles:c=(0,H.jsx)(lle,{}),l=v7,d=o,f=!1;break;case $.Analysis_BasketCycles:c=(0,H.jsx)(hle,{}),l=v7,d=o,f=!1;break;case $.Analysis_CostPercents:c=(0,H.jsx)(BW,{}),l=v7,d=o,f=!1;break;case $.Analysis_CostPerPiece:c=(0,H.jsx)(HW,{}),l=v7,d=o,f=!1;break;case $.Operations_Dashboard:c=(0,H.jsx)(zie,{}),l=Y9;break;case $.Operations_SystemOverview:c=(0,H.jsx)(L2,{ignoreOperator:!0}),l=Y9,h=!1;break;case $.Operations_AllMaterial:c=(0,H.jsx)(fZ,{displaySystemBins:!0}),l=Y9,h=!1;break;case $.Operations_LoadOutliers:c=(0,H.jsx)(s6,{outlierTy:`labor`}),l=Y9,d=q9;break;case $.Operations_LoadHours:c=(0,H.jsx)(T6,{ty:`labor`}),l=Y9,d=q9;break;case $.Operations_LoadCycles:c=(0,H.jsx)(_7,{ty:`labor`}),l=Y9,d=q9;break;case $.Operations_MachineOutliers:c=(0,H.jsx)(s6,{outlierTy:`machine`}),l=Y9,d=q9;break;case $.Operations_MachineHours:c=(0,H.jsx)(T6,{ty:`machine`}),l=Y9,d=q9;break;case $.Operations_MachineCycles:c=(0,H.jsx)(_7,{ty:`machine`}),l=Y9,d=q9;break;case $.Operations_RecentSchedules:c=(0,H.jsx)(zX,{}),l=Y9,d=q9;break;case $.Operations_CurrentWorkorders:c=(0,H.jsx)(D9,{}),l=Y9,d=q9,h=!1;break;case $.Operations_Production:c=(0,H.jsx)(pae,{}),l=Y9,d=q9;break;case $.Operations_Quality:c=(0,H.jsx)(G0,{}),l=Y9,d=q9,h=!1;break;case $.Operations_Inspections:c=(0,H.jsx)(K0,{}),l=Y9,d=q9;break;case $.Operations_CloseoutReport:c=(0,H.jsx)(bue,{}),l=Y9,d=q9,h=!1;break;case $.Operations_Tools:c=(0,H.jsx)(f3,{}),l=Y9,d=q9;break;case $.Operations_Programs:c=(0,H.jsx)(w3,{}),l=Y9,d=q9;break;case $.Operations_Rebookings:c=(0,H.jsx)(Eue,{}),l=Y9,d=q9;break;case $.Operations_Parts:c=(0,H.jsx)(ede,{}),l=Y9,d=q9,h=!1;break;case $.Engineering_Cycles:c=(0,H.jsx)(_7,{ty:`machine`}),f=!1,l=Q9;break;case $.Engineering_Hours:c=(0,H.jsx)(T6,{ty:`machine`}),f=!1,l=Q9;break;case $.Engineering_Outliers:c=(0,H.jsx)(s6,{outlierTy:`machine`}),f=!1,l=Q9;break;case $.Quality_Dashboard:c=(0,H.jsx)(G0,{}),l=X9,f=!1,h=!1;break;case $.Quality_Paths:c=(0,H.jsx)(K0,{}),l=X9,f=!1;break;case $.Quality_Quarantine:c=(0,H.jsx)(fZ,{displaySystemBins:!1}),l=X9,f=!1,h=!1;break;case $.Tools_Dashboard:c=(0,H.jsx)(f3,{}),l=Z9;break;case $.Tools_Programs:c=(0,H.jsx)(w3,{}),l=Z9;break;case $.Sales_Dashboard:c=(0,H.jsx)(D9,{disableSearch:!0}),l=$9,f=!1;break;case $.Sales_ProjectedUsage:c=(0,H.jsx)(lue,{}),l=$9,f=!1;break;case $.VerboseLogging:c=(0,H.jsx)(mae,{}),p=!1,f=!1;break;case $.Client_Custom:{let n=e.renderCustomPage?.(i.custom);l=n?.nav,c=n?.page??(0,H.jsx)(WW,{setRoute:a,modes:e.chooseModes?.(t)}),f=!1;break}case $.ChooseMode:default:c=(0,H.jsx)(WW,{setRoute:a,modes:e.chooseModes?.(t)}),p=!1,f=!1}return(0,H.jsxs)(`div`,{id:`App`,children:[(0,H.jsx)(wae,{showAlarms:f,showSearch:p,showLogout:s,showOperator:m,Nav1:l,Nav2:u,menuNavs:d}),(0,H.jsxs)(`div`,{style:{display:`flex`},children:[(0,H.jsx)(Tae,{menuItems:d}),(0,H.jsx)(`div`,{style:{flexGrow:1},children:c})]}),h?(0,H.jsx)(EW,{}):void 0,(0,H.jsx)(P3,{}),(0,H.jsx)(Hq,{})]})});function sde(e,t,n){let r=od({palette:{primary:Pr,secondary:Ir}});(0,ire.createRoot)(t).render((0,H.jsxs)(Uf,{theme:r,children:[(0,H.jsx)(Mv,{}),(0,H.jsx)(L.StrictMode,{children:(0,H.jsx)(_e,{store:n,children:(0,H.jsx)(ode,{...e})})})]}))}async function cde(e={},t){let n=t??document.getElementById(`root`);if(!n)throw Error(`Unable to start FMS Insight: no root element was provided or found`);Yt();let r=I();r.set(br,await yr()),sde(e,n,r)}async function lde(){await cde({})}lde().catch(e=>{console.log(e);let t=`Error loading Insight`;e instanceof Bt&&(t=`Error loading Insight: `+e.message+` `+e.response);let n=document.createElement(`p`);n.textContent=t,(document.getElementById(`loading`)??document.body).appendChild(n)});
|