@esrf/daiquiri-lib 2.3.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react-bootstrap"),h=require("react"),D=require("lodash"),sn=require("classnames"),rn=require("lodash/debounce"),an=require("semver");require("react-bootstrap-typeahead/css/Typeahead.css");require("react-bootstrap-typeahead/css/Typeahead.bs5.css");const L=require("react-bootstrap-typeahead"),cn=require("js-quantities"),ln=require("debug"),X=n=>n&&typeof n=="object"&&"default"in n?n:{default:n},dn=X(h),k=X(sn),un=X(rn),fn=X(an),pn=X(cn),Se=X(ln);function Ge(n){const{hardware:t}=n,{online:o,locked:s=null}=t,r=o?(s!==null?"LOCKED":t.properties.state)||"UNKNOWN":"OFFLINE",c={READY:"success",OFFLINE:"warning",MOVING:"warning",DISABLED:"secondary",UNKNOWN:"danger",ERROR:"danger",FAILED:"danger",LOCKED:"warning"}[r]||"success";return e.jsx(i.Badge,{bg:c,children:r})}function Be(n){const{hardware:t}=n;return e.jsx(Ge,{hardware:t})}function Ve(n){const{hardware:t,options:o}=n;function s(){return t.name?t.name:t.id}function r(){return o.overrideName!==void 0?o.overrideName:t.alias?t.alias:t.name?t.name:t.id}function a(){if(o.overrideName!==void 0)return`Real name: ${s()}`;if(t.alias)return`Real name: ${t.name}`}const c=r(),l=a();return e.jsx("span",{title:l,children:c})}function Le(n){const{hardware:t,options:o={}}=n;function s(){const r=o.property;if(r===void 0)return"property is not set";if(r===null)return"property is null";let a=t;for(const c of r.split("/"))if(a=a[c],a===void 0)return`property '${r}' not found`;return`${a}`}return e.jsx(e.Fragment,{children:s()})}function mn(n){const{activeMessage:t="Online",inactiveMessage:o="Offline",message:s="This device is"}=n;return e.jsx("div",{className:`dot-indicator small bg-${n.online?"success":"danger"}`,title:`${s} ${n.online?t:o}`})}function y(n){const{name:t,icon:o}=n;return e.jsxs("div",{className:"icon",title:t,children:[e.jsx("i",{className:`fa ${o}`}),e.jsx(mn,{...n})]})}function v(n){const{headerMode:t,hardware:o}=n;function s(){return o.alias?o.alias:o.name?o.name:o.id}const r=s();switch(t){case"front":return e.jsx("div",{className:"hw-component",children:e.jsxs("div",{className:"hw-single",children:[n.widgetIcon,e.jsx("div",{className:"name",children:r}),e.jsx("div",{className:"d-inline-block",children:n.widgetContent})]})});case"none":return e.jsx("div",{className:"hw-component",children:e.jsx("div",{className:"hw-single",children:n.widgetContent})});case"state":return n.widgetState;default:return e.jsxs("div",{className:"hw-component",children:[e.jsxs("div",{className:"hw-head",children:[n.widgetIcon,e.jsx("div",{className:"name",children:e.jsx(i.Form.Label,{htmlFor:o.id,children:r})}),n.widgetState,n.hardware.errors&&n.hardware.errors.length>0&&e.jsx(i.OverlayTrigger,{trigger:"click",placement:"bottom",rootClose:!0,overlay:e.jsxs(i.Popover,{id:n.hardware.id,style:{maxWidth:500},children:[e.jsx(i.Popover.Header,{children:"Device Errors"}),e.jsxs(i.Popover.Body,{children:["There were errors with properties on this device:",e.jsx("ul",{children:n.hardware.errors.map(a=>e.jsxs("li",{children:[a.property,":",e.jsxs("span",{className:"stack-trace",children:[a.traceback,e.jsx("br",{}),a.exception]})]}))})]})]}),children:e.jsx(i.Button,{variant:"danger",size:"sm",children:e.jsx("i",{className:"fa fa-exclamation-triangle"})})})]}),e.jsx("div",{className:"hw-content",children:n.widgetContent})]})}}function hn(n){const t=n.online?"READY":"OFFLINE";return e.jsx(i.Badge,{bg:t==="READY"?"success":"warning",children:t})}function Ue(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Optic",icon:"fa-cog",online:t.online}),r=e.jsx(hn,{...t});function a(){const d=o.property;if(d===void 0)return"property is not set";if(d===null)return"property is null";let p=t;for(const m of d.split("/"))if(p=p[m],p===void 0)return`property '${d}' not found`;return`${p}`}function c(){const d=o.unit;if(!d)return null;if(!d.includes("properties"))return d;let p=n;for(const m of d.split("/"))if(p=p[m],p===void 0)return null;return`${p}`}const l=c(),f=e.jsxs(i.InputGroup,{children:[e.jsx(i.Form.Control,{value:a(),readOnly:!0}),l&&e.jsx(i.InputGroup.Text,{children:l})]}),u=n.options.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:f,headerMode:u})}const xn={state:Be,name:Ve,info:Le,property:Ue},gn=xn,jn={callables:[],id:"test_object",name:"test_object",online:!0,properties:{number:345,option:"one",state:"1",string:"asbkjdsah"},protocol:"bliss",require_staff:!1,type:"test"},wn={$ref:"#/definitions/HWTestSchema",$schema:"http://json-schema.org/draft-07/schema#",asyncValidate:!1,cache:!0,definitions:{HWTestSchema:{additionalProperties:!1,properties:{callables:{$ref:"#/definitions/HardwareSchema",type:"object"},id:{title:"id",type:"string"},name:{title:"name",type:"string"},online:{title:"online",type:"boolean"},properties:{$ref:"#/definitions/TestPropertiesSchema",type:"object"},protocol:{title:"protocol",type:"string"},require_staff:{title:"require_staff",type:"boolean"},type:{title:"type",type:"string"}},type:"object"},HardwareSchema:{additionalProperties:!1,cache:!0,properties:{},type:"object"},TestPropertiesSchema:{additionalProperties:!1,cache:!0,properties:{number:{format:"integer",title:"number",type:"number"},option:{enum:["one","two","three"],enumNames:[],title:"option",type:"string"},state:{enum:["ON","OFF","UNKNOWN","ERROR"],enumNames:[],readOnly:!0,title:"state",type:"string"},string:{title:"string",type:"string"}},type:"object"}},save_presets:!1},yn={response:jn,schema:wn},vn={default:yn};function F(n){const t={display:"inline-block",minWidth:""};return n.minWidth&&(t.minWidth=`${n.minWidth}em`),e.jsx("div",{style:t,children:e.jsx(i.Badge,{bg:n.variant,title:n.description,children:n.state})})}function He(n){const{states:t,variants:o={},descriptions:s={},minWidth:r}=n,a=t[0]??"";if(t.length===0)return e.jsx(F,{state:"NoState",variant:"fatal",description:"The device no not expose any state",minWidth:r});if(t.length===1)return e.jsx(F,{state:a,variant:o[a]??"fatal",description:s[a],minWidth:r});const c={display:"inline-block",minWidth:r?`${r}em`:""};function l(f){return e.jsx(i.Tooltip,{id:"device-state",...f,children:t.map((u,d)=>{const p=s[u],m=u.startsWith("_")?u.slice(1):u;return e.jsxs(i.Row,{className:"gx-0",children:[e.jsx(i.Col,{sm:"3",className:"text-end",children:e.jsx(i.Badge,{className:"text-right",bg:o[u]??"fatal",children:m})}),e.jsx(i.Col,{sm:"9",className:"text-start lh-1 my-auto ps-1",children:p})]})})})}return e.jsx("div",{style:c,children:e.jsx(i.OverlayTrigger,{placement:"top",delay:{show:250,hide:400},overlay:l,children:e.jsxs("span",{className:"text-nowrap",children:[e.jsx(i.Badge,{className:"rounded-end-0",bg:o[a]??"fatal",children:a}),e.jsxs(i.Badge,{className:"rounded-start-0",bg:"secondary",children:["+",t.length-1]})]})})})}const Nn=Object.freeze(Object.defineProperty({__proto__:null,HardwareMultiState:He,HardwareState:F},Symbol.toStringTag,{value:"Module"}));function me(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={ON:"danger",OFF:"success",MOVING_ON:"warning",MOVING_OFF:"warning",UNKNOWN:"fatal",OFFLINE:"warning"},r=s[o]||s.UNKNOWN;return e.jsx(F,{state:o,minWidth:6,variant:r})}function bn(n){const{hardware:t}=n;return e.jsx(me,{hardware:t})}function _n(n){var l;const{hardware:t,options:o,disabled:s}=n,r=((l=t.properties)==null?void 0:l.state)??"OFFLINE",a=r==="ON",c=r==="OFF";return e.jsx("div",{style:{display:"grid",gridTemplateRows:"min-content min-content",gridTemplateColumns:"min-content auto",gridGap:"1px"},children:e.jsxs(i.ButtonGroup,{className:"mx-auto",style:{width:"12em"},children:[e.jsx(i.Button,{onClick:()=>{t.actions.call("on")},disabled:a||s,style:{width:"5em"},children:e.jsx("span",{className:"text-nowrap",children:"On"})}),e.jsx(i.Button,{onClick:()=>{t.actions.call("off")},disabled:c||s,style:{width:"5em"},children:e.jsx("span",{className:"text-nowrap",children:"Off"})})]})})}function qe(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Air bearing",icon:"fa-hand-point-right",online:t.online}),r=e.jsx(me,{hardware:t});function a(){return e.jsx(_n,{...n})}const c=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a(),headerMode:c})}function R(n){const{value:t,variant:o,style:s,className:r,title:a}=n,c=o?`badge-${o} bg-${o} text-bg-${o} border-${o}`:"border-light";return e.jsx(i.Form.Control,{className:`${c} ${r} bg-secondary`,style:s,value:t,title:a,readOnly:!0})}function De(n){return e.jsx(i.Button,{variant:n.isActive?"primary":n.wasActivated?"warning":"secondary",onClick:n.onClick,disabled:n.disabled||n.wasActivated,title:n.title,children:e.jsxs(i.Row,{className:"gx-0",children:[e.jsx("i",{className:`col-sm-4 justify-content-center align-self-center ${n.icon}`}),e.jsx(i.Col,{sm:"8",children:n.children})]})})}function $n(n){var d;const{hardware:t,options:o={},disabled:s}=n;function r(){t.actions.call("on")}function a(){t.actions.call("off")}const c=((d=t.properties)==null?void 0:d.state)??"UNKNOWN",l=c==="MOVING_ON"||c==="MOVING_OFF",f=c==="MOVING_ON",u=c==="MOVING_OFF";return e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{variant:"secondary",disabled:s||l}),e.jsx(i.Dropdown.Menu,{popperConfig:{strategy:"fixed"},children:e.jsxs(i.Container,{children:[e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center",children:"Actions"})}),e.jsx(i.Row,{children:e.jsx(i.Col,{children:e.jsxs(i.ButtonGroup,{children:[e.jsxs(De,{icon:"fa fa-arrow-up",wasActivated:f,onClick:()=>{r()},disabled:s||l,title:"Turn on the air bearing",children:["Turn",e.jsx("br",{}),"on"]}),e.jsxs(De,{icon:"fa fa-arrow-down",wasActivated:u,onClick:()=>{a()},disabled:s||l,title:"Turn off the air bearing",children:["Turn",e.jsx("br",{}),"off"]})]})})})]})})]})}function Sn(n){const{hardware:t,options:o,disabled:s}=n,{state:r}=t.properties??"OFFLINE",c={ON:"danger",OFF:"success",MOVING_ON:"warning",MOVING_OFF:"warning",UNKNOWN:"fatal",OFFLINE:"warning"}[r]??"fatal";return e.jsxs(i.InputGroup,{className:"d-flex flex-nowrap",children:[e.jsx(R,{variant:c,className:"text-center",style:{minWidth:"10em"},value:r}),e.jsx($n,{...n})]})}function ze(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Air bearing",icon:"fa-hand-point-right",online:t.online}),r=e.jsx(me,{hardware:t});function a(){return e.jsx(Sn,{...n})}const c=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a(),headerMode:c})}const Cn={default:qe,protected:ze,state:bn},On=Cn,In=["on","off","sync_hard"],Mn="airbearing",Tn="airbearing",Fn=!0,Dn={state:"ON"},An="bliss",Rn=!1,En="airbearing",kn={callables:In,id:Mn,name:Tn,online:Fn,properties:Dn,protocol:An,require_staff:Rn,type:En},Pn={default:kn};async function A(n){await new Promise(t=>{setTimeout(t,n)})}function U(n){const{name:t,alias:o=null,type:s,setProperty:r,call:a,properties:c,useHardwareContext:l=()=>null}=n,f=l(),u=h.useMemo(()=>{var g,w;const m={setProperty:r,call:a};return(w=f==null?void 0:(g=f.actions).updateHardwareChangeActions)==null||w.call(g,t,m),m},[]),d={id:t,name:t,alias:o,online:!0,properties:c,type:s,actions:u,user_tags:[],locked:null},p=h.useRef(null);return h.useEffect(()=>{(p.current===null||!D.isEqual(p.current,d))&&(p.current=d,f==null||f.actions.updateHardware(t,d))},[t,d]),e.jsx(e.Fragment,{})}function Gn(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=h.useState("ON");async function c(u,d){if(u==="on"){a("MOVING_ON"),await A(2e3),a("ON");return}if(u==="off"){a("MOVING_OFF"),await A(2e3),a("OFF");return}console.log("AirBearingSimulator: Unsupported call",u,d)}async function l(u,d){console.log("AirBearingSimulator: Unsupported setProperty",u,d)}const f={state:r};return e.jsx(U,{name:t,alias:o,type:"tomoflatmotion",call:c,setProperty:l,properties:f,useHardwareContext:s})}function Bn(n){const t={24:"Y",21:"Z",18:"E",15:"P",12:"T",9:"G",6:"M",3:"k","-3":"m","-6":"µ","-9":"n","-12":"p","-15":"f","-18":"a","-21":"z","-24":"y"},o=Math.log(n)/Math.log(1e3),s=!Number.isInteger(o),r=3*Math.ceil(o-(s?1:0)),a=r===0?"":t[r];return{scalar:n*10**-r,prefix:a,multiplier:10**-r}}function Vn(n){return n.charAt(0).toUpperCase()+n.slice(1)}function We(n){if(n<60)return`${Math.round(n)} sec`;const t=Math.round(n/60),o=t%60,s=Math.floor(t/60);return s?`${s} hr ${o} min`:`${o} min`}function Ln(n){return n>0?(662607004e-42*299792458/(n*1e-10)/160218e-24*.001).toFixed(4):0}function Un(n,t){return Number.parseFloat(n.toFixed(t))}const Hn=Object.freeze(Object.defineProperty({__proto__:null,formatEng:Bn,round:Un,toEnergy:Ln,toHoursMins:We,ucfirst:Vn},Symbol.toStringTag,{value:"Module"}));function qn(n){const{hardware:t}=n;function o(){t.actions.call("reset")}const s={"Front End":"feitlk",Experimental:"expitlk",PSS:"pssitlk"},r={Current:`${t.properties.current.toFixed(1)} mA`,Mode:t.properties.mode,Refill:We(t.properties.refill),Message:e.jsx("pre",{children:t.properties.message})};function a(c){if(!(c in t.properties))return"UNKNOWN";const l=t.properties[c];return!l||typeof l!="string"?"UNKNOWN":l}return e.jsx(i.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"popid",children:[e.jsxs(i.Popover.Header,{children:[t.name," Details"]}),e.jsxs(i.Popover.Body,{children:[e.jsx("h6",{children:"Status"}),e.jsx("pre",{children:t.properties.status}),e.jsx("h6",{children:"Interlocks"}),e.jsx(i.Container,{children:D.map(s,(c,l)=>e.jsxs(i.Row,{children:[e.jsxs(i.Col,{children:[l,":"]}),e.jsx(i.Col,{children:e.jsx(i.Badge,{bg:a(c)==="ON"?"success":"danger",children:a(c)})})]},l))}),e.jsx("h6",{children:"Ring Status"}),e.jsx(i.Container,{children:D.map(r,(c,l)=>e.jsxs(i.Row,{children:[e.jsxs(i.Col,{children:[l,":"]}),e.jsx(i.Col,{children:c})]},l))}),e.jsx("div",{className:"d-grid gap-2",children:e.jsx(i.Button,{disabled:n.disabled,onClick:o,children:"Reset"})})]})]}),children:e.jsx(i.Button,{className:"flex-grow-0",title:"Shutter Details",children:e.jsx("i",{className:"fa fa-ellipsis-h"})})})}function Ye(n){const{hardware:t,options:o={}}=n;function s(){t.actions.call(t.properties.frontend==="FE open"?"close":"open")}return e.jsxs("div",{className:"hw-component",children:[e.jsxs("div",{className:"hw-head",children:[e.jsx(y,{name:"Frontend",icon:"fam-hardware-frontend",online:t.online}),e.jsx("div",{className:"name",children:t.name}),e.jsx(i.Badge,{bg:t.properties.state==="OPEN"||t.properties.state==="RUNNING"?"success":"danger",children:t.properties.state})]}),e.jsx("div",{className:"hw-content",children:e.jsxs(i.ButtonGroup,{className:"d-flex",children:[e.jsx(i.Button,{variant:t.properties.frontend==="FE open"?"danger":"success",onClick:s,disabled:n.disabled,children:t.properties.frontend==="FE open"?"Close":"Open"}),e.jsx(qn,{...n})]})})]})}const zn={default:Ye},Wn=zn,Yn=["open","close","reset"],Kn="fe",Qn="fe",Xn=!0,Jn={current:196.58051532652968,expitlk:"ON",feitlk:"ON",frontend:"FE open",pssitlk:"ON",refill:2287,state:"RUNNING",mode:"USM",message:"USM until 18:00",status:`State : The Front End is open with automatic opening mode on
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react-bootstrap"),h=require("react"),D=require("lodash"),cn=require("classnames"),ln=require("lodash/debounce"),dn=require("semver");require("react-bootstrap-typeahead/css/Typeahead.css");require("react-bootstrap-typeahead/css/Typeahead.bs5.css");const L=require("react-bootstrap-typeahead"),un=require("js-quantities"),fn=require("debug"),X=n=>n&&typeof n=="object"&&"default"in n?n:{default:n},pn=X(h),P=X(cn),mn=X(ln),hn=X(dn),xn=X(un),Se=X(fn);function Be(n){var l;const{hardware:t}=n,{online:o,locked:s=null}=t,r=o?(s!==null?"LOCKED":(l=t.properties)==null?void 0:l.state)||"UNKNOWN":"OFFLINE",c={READY:"success",OFFLINE:"secondary",MOVING:"warning",DISABLED:"secondary",UNKNOWN:"danger",ERROR:"danger",FAILED:"danger",LOCKED:"warning"}[r]||"success";return e.jsx(i.Badge,{bg:c,children:r})}function Ve(n){const{hardware:t}=n;return e.jsx(Be,{hardware:t})}function Le(n){const{hardware:t,options:o}=n;function s(){return t.name?t.name:t.id}function r(){return o.overrideName!==void 0?o.overrideName:t.alias?t.alias:t.name?t.name:t.id}function a(){if(o.overrideName!==void 0)return`Real name: ${s()}`;if(t.alias)return`Real name: ${t.name}`}const c=r(),l=a();return e.jsx("span",{title:l,children:c})}function Ue(n){const{hardware:t,options:o={}}=n;function s(){const r=o.property;if(r===void 0)return"property is not set";if(r===null)return"property is null";let a=t;for(const c of r.split("/"))if(a=a[c],a===void 0)return`property '${r}' not found`;return`${a}`}return e.jsx(e.Fragment,{children:s()})}function gn(n){const{activeMessage:t="Online",inactiveMessage:o="Offline",message:s="This device is"}=n;return e.jsx("div",{className:`dot-indicator small bg-${n.online?"success":"danger"}`,title:`${s} ${n.online?t:o}`})}function y(n){const{name:t,icon:o}=n;return e.jsxs("div",{className:"icon",title:t,children:[e.jsx("i",{className:`fa ${o}`}),e.jsx(gn,{...n})]})}function v(n){const{headerMode:t,hardware:o}=n;function s(){return o.alias?o.alias:o.name?o.name:o.id}const r=s();switch(t){case"front":return e.jsx("div",{className:"hw-component",children:e.jsxs("div",{className:"hw-single",children:[n.widgetIcon,e.jsx("div",{className:"name",children:r}),e.jsx("div",{className:"d-inline-block",children:n.widgetContent})]})});case"none":return e.jsx("div",{className:"hw-component",children:e.jsx("div",{className:"hw-single",children:n.widgetContent})});case"state":return n.widgetState;default:return e.jsxs("div",{className:"hw-component",children:[e.jsxs("div",{className:"hw-head",children:[n.widgetIcon,e.jsx("div",{className:"name",children:e.jsx(i.Form.Label,{htmlFor:o.id,children:r})}),n.widgetState,n.hardware.errors&&n.hardware.errors.length>0&&e.jsx(i.OverlayTrigger,{trigger:"click",placement:"bottom",rootClose:!0,overlay:e.jsxs(i.Popover,{id:n.hardware.id,style:{maxWidth:500},children:[e.jsx(i.Popover.Header,{children:"Device Errors"}),e.jsxs(i.Popover.Body,{children:["There were errors with properties on this device:",e.jsx("ul",{children:n.hardware.errors.map(a=>e.jsxs("li",{children:[a.property,":",e.jsxs("span",{className:"stack-trace",children:[a.traceback,e.jsx("br",{}),a.exception]})]}))})]})]}),children:e.jsx(i.Button,{variant:"danger",size:"sm",children:e.jsx("i",{className:"fa fa-exclamation-triangle"})})})]}),e.jsx("div",{className:"hw-content",children:n.widgetContent})]})}}function A(n){const{value:t,variant:o,style:s,className:r,title:a}=n,c=o?`badge-${o} bg-${o} text-bg-${o} border-${o}`:"border-light";return e.jsx(i.Form.Control,{className:`${c} ${r} bg-secondary`,style:s,value:t,title:a,readOnly:!0})}function jn(n){const t=n.online?"READY":"OFFLINE";return e.jsx(i.Badge,{bg:t==="READY"?"success":"warning",children:t})}function He(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Optic",icon:"fa-cog",online:t.online}),r=e.jsx(jn,{...t});function a(){const d=o.property;if(d===void 0)return"property is not set";if(d===null)return"property is null";let p=t;for(const m of d.split("/"))if(p=p[m],p===void 0)return`property '${d}' not found`;return`${p}`}function c(){const d=o.unit;if(!d)return null;if(!d.includes("properties"))return d;let p=n;for(const m of d.split("/"))if(p=p[m],p===void 0)return null;return`${p}`}const l=c(),f=e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(A,{value:a()}),l&&e.jsx(i.InputGroup.Text,{children:l})]}),u=n.options.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:f,headerMode:u})}const wn={state:Ve,name:Le,info:Ue,property:He},yn=wn,vn={callables:[],id:"test_object",name:"test_object",online:!0,properties:{number:345,option:"one",state:"1",string:"asbkjdsah"},protocol:"bliss",require_staff:!1,type:"test"},Nn={$ref:"#/definitions/HWTestSchema",$schema:"http://json-schema.org/draft-07/schema#",asyncValidate:!1,cache:!0,definitions:{HWTestSchema:{additionalProperties:!1,properties:{callables:{$ref:"#/definitions/HardwareSchema",type:"object"},id:{title:"id",type:"string"},name:{title:"name",type:"string"},online:{title:"online",type:"boolean"},properties:{$ref:"#/definitions/TestPropertiesSchema",type:"object"},protocol:{title:"protocol",type:"string"},require_staff:{title:"require_staff",type:"boolean"},type:{title:"type",type:"string"}},type:"object"},HardwareSchema:{additionalProperties:!1,cache:!0,properties:{},type:"object"},TestPropertiesSchema:{additionalProperties:!1,cache:!0,properties:{number:{format:"integer",title:"number",type:"number"},option:{enum:["one","two","three"],enumNames:[],title:"option",type:"string"},state:{enum:["ON","OFF","UNKNOWN","ERROR"],enumNames:[],readOnly:!0,title:"state",type:"string"},string:{title:"string",type:"string"}},type:"object"}},save_presets:!1},bn={response:vn,schema:Nn},_n={default:bn};function F(n){const t={display:"inline-block",minWidth:""};return n.minWidth&&(t.minWidth=`${n.minWidth}em`),e.jsx("div",{style:t,children:e.jsx(i.Badge,{bg:n.variant,title:n.description,children:n.state})})}function qe(n){const{states:t,variants:o={},descriptions:s={},minWidth:r}=n,a=t[0]??"";if(t.length===0)return e.jsx(F,{state:"NoState",variant:"fatal",description:"The device no not expose any state",minWidth:r});if(t.length===1)return e.jsx(F,{state:a,variant:o[a]??"fatal",description:s[a],minWidth:r});const c={display:"inline-block",minWidth:r?`${r}em`:""};function l(f){return e.jsx(i.Tooltip,{id:"device-state",...f,children:t.map((u,d)=>{const p=s[u],m=u.startsWith("_")?u.slice(1):u;return e.jsxs(i.Row,{className:"gx-0",children:[e.jsx(i.Col,{sm:"3",className:"text-end",children:e.jsx(i.Badge,{className:"text-right",bg:o[u]??"fatal",children:m})}),e.jsx(i.Col,{sm:"9",className:"text-start lh-1 my-auto ps-1",children:p})]})})})}return e.jsx("div",{style:c,children:e.jsx(i.OverlayTrigger,{placement:"top",delay:{show:250,hide:400},overlay:l,children:e.jsxs("span",{className:"text-nowrap",children:[e.jsx(i.Badge,{className:"rounded-end-0",bg:o[a]??"fatal",children:a}),e.jsxs(i.Badge,{className:"rounded-start-0",bg:"secondary",children:["+",t.length-1]})]})})})}const $n=Object.freeze(Object.defineProperty({__proto__:null,HardwareMultiState:qe,HardwareState:F},Symbol.toStringTag,{value:"Module"}));function he(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={ON:"danger",OFF:"success",MOVING_ON:"warning",MOVING_OFF:"warning",UNKNOWN:"fatal",OFFLINE:"warning"},r=s[o]||s.UNKNOWN;return e.jsx(F,{state:o,minWidth:6,variant:r})}function Sn(n){const{hardware:t}=n;return e.jsx(he,{hardware:t})}function Cn(n){var l;const{hardware:t,options:o,disabled:s}=n,r=((l=t.properties)==null?void 0:l.state)??"OFFLINE",a=r==="ON",c=r==="OFF";return e.jsx("div",{style:{display:"grid",gridTemplateRows:"min-content min-content",gridTemplateColumns:"min-content auto",gridGap:"1px"},children:e.jsxs(i.ButtonGroup,{className:"mx-auto",style:{width:"12em"},children:[e.jsx(i.Button,{onClick:()=>{t.actions.call("on")},disabled:a||s,style:{width:"5em"},children:e.jsx("span",{className:"text-nowrap",children:"On"})}),e.jsx(i.Button,{onClick:()=>{t.actions.call("off")},disabled:c||s,style:{width:"5em"},children:e.jsx("span",{className:"text-nowrap",children:"Off"})})]})})}function ze(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Air bearing",icon:"fa-hand-point-right",online:t.online}),r=e.jsx(he,{hardware:t});function a(){return e.jsx(Cn,{...n})}const c=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a(),headerMode:c})}function Ae(n){return e.jsx(i.Button,{variant:n.isActive?"primary":n.wasActivated?"warning":"secondary",onClick:n.onClick,disabled:n.disabled||n.wasActivated,title:n.title,children:e.jsxs(i.Row,{className:"gx-0",children:[e.jsx("i",{className:`col-sm-4 justify-content-center align-self-center ${n.icon}`}),e.jsx(i.Col,{sm:"8",children:n.children})]})})}function On(n){var d;const{hardware:t,options:o={},disabled:s}=n;function r(){t.actions.call("on")}function a(){t.actions.call("off")}const c=((d=t.properties)==null?void 0:d.state)??"UNKNOWN",l=c==="MOVING_ON"||c==="MOVING_OFF",f=c==="MOVING_ON",u=c==="MOVING_OFF";return e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{variant:"secondary",disabled:s||l}),e.jsx(i.Dropdown.Menu,{popperConfig:{strategy:"fixed"},children:e.jsxs(i.Container,{children:[e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center",children:"Actions"})}),e.jsx(i.Row,{children:e.jsx(i.Col,{children:e.jsxs(i.ButtonGroup,{children:[e.jsxs(Ae,{icon:"fa fa-arrow-up",wasActivated:f,onClick:()=>{r()},disabled:s||l,title:"Turn on the air bearing",children:["Turn",e.jsx("br",{}),"on"]}),e.jsxs(Ae,{icon:"fa fa-arrow-down",wasActivated:u,onClick:()=>{a()},disabled:s||l,title:"Turn off the air bearing",children:["Turn",e.jsx("br",{}),"off"]})]})})})]})})]})}function In(n){const{hardware:t,options:o,disabled:s}=n,{state:r}=t.properties??"OFFLINE",c={ON:"danger",OFF:"success",MOVING_ON:"warning",MOVING_OFF:"warning",UNKNOWN:"fatal",OFFLINE:"warning"}[r]??"fatal";return e.jsxs(i.InputGroup,{className:"d-flex flex-nowrap",children:[e.jsx(A,{variant:c,className:"text-center",style:{minWidth:"10em"},value:r}),e.jsx(On,{...n})]})}function We(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Air bearing",icon:"fa-hand-point-right",online:t.online}),r=e.jsx(he,{hardware:t});function a(){return e.jsx(In,{...n})}const c=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a(),headerMode:c})}const Mn={default:ze,protected:We,state:Sn},Tn=Mn,Fn=["on","off","sync_hard"],Dn="airbearing",An="airbearing",Rn=!0,En={state:"ON"},kn="bliss",Pn=!1,Gn="airbearing",Bn={callables:Fn,id:Dn,name:An,online:Rn,properties:En,protocol:kn,require_staff:Pn,type:Gn},Vn={default:Bn};async function R(n){await new Promise(t=>{setTimeout(t,n)})}function U(n){const{name:t,alias:o=null,type:s,setProperty:r,call:a,properties:c,useHardwareContext:l=()=>null}=n,f=l(),u=h.useMemo(()=>{var g,w;const m={setProperty:r,call:a};return(w=f==null?void 0:(g=f.actions).updateHardwareChangeActions)==null||w.call(g,t,m),m},[]),d={id:t,name:t,alias:o,online:!0,properties:c,type:s,actions:u,user_tags:[],locked:null},p=h.useRef(null);return h.useEffect(()=>{(p.current===null||!D.isEqual(p.current,d))&&(p.current=d,f==null||f.actions.updateHardware(t,d))},[t,d]),e.jsx(e.Fragment,{})}function Ln(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=h.useState("ON");async function c(u,d){if(u==="on"){a("MOVING_ON"),await R(2e3),a("ON");return}if(u==="off"){a("MOVING_OFF"),await R(2e3),a("OFF");return}console.log("AirBearingSimulator: Unsupported call",u,d)}async function l(u,d){console.log("AirBearingSimulator: Unsupported setProperty",u,d)}const f={state:r};return e.jsx(U,{name:t,alias:o,type:"tomoflatmotion",call:c,setProperty:l,properties:f,useHardwareContext:s})}function Un(n){const t={24:"Y",21:"Z",18:"E",15:"P",12:"T",9:"G",6:"M",3:"k","-3":"m","-6":"µ","-9":"n","-12":"p","-15":"f","-18":"a","-21":"z","-24":"y"},o=Math.log(n)/Math.log(1e3),s=!Number.isInteger(o),r=3*Math.ceil(o-(s?1:0)),a=r===0?"":t[r];return{scalar:n*10**-r,prefix:a,multiplier:10**-r}}function Hn(n){return n.charAt(0).toUpperCase()+n.slice(1)}function Ye(n){if(n<60)return`${Math.round(n)} sec`;const t=Math.round(n/60),o=t%60,s=Math.floor(t/60);return s?`${s} hr ${o} min`:`${o} min`}function qn(n){return n>0?(662607004e-42*299792458/(n*1e-10)/160218e-24*.001).toFixed(4):0}function zn(n,t){return Number.parseFloat(n.toFixed(t))}const Wn=Object.freeze(Object.defineProperty({__proto__:null,formatEng:Un,round:zn,toEnergy:qn,toHoursMins:Ye,ucfirst:Hn},Symbol.toStringTag,{value:"Module"}));function Yn(n){const{hardware:t}=n;function o(){t.actions.call("reset")}const s={"Front End":"feitlk",Experimental:"expitlk",PSS:"pssitlk"},r={Current:`${t.properties.current.toFixed(1)} mA`,Mode:t.properties.mode,Refill:Ye(t.properties.refill),Message:e.jsx("pre",{children:t.properties.message})};function a(c){if(!(c in t.properties))return"UNKNOWN";const l=t.properties[c];return!l||typeof l!="string"?"UNKNOWN":l}return e.jsx(i.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"popid",children:[e.jsxs(i.Popover.Header,{children:[t.name," Details"]}),e.jsxs(i.Popover.Body,{children:[e.jsx("h6",{children:"Status"}),e.jsx("pre",{children:t.properties.status}),e.jsx("h6",{children:"Interlocks"}),e.jsx(i.Container,{children:D.map(s,(c,l)=>e.jsxs(i.Row,{children:[e.jsxs(i.Col,{children:[l,":"]}),e.jsx(i.Col,{children:e.jsx(i.Badge,{bg:a(c)==="ON"?"success":"danger",children:a(c)})})]},l))}),e.jsx("h6",{children:"Ring Status"}),e.jsx(i.Container,{children:D.map(r,(c,l)=>e.jsxs(i.Row,{children:[e.jsxs(i.Col,{children:[l,":"]}),e.jsx(i.Col,{children:c})]},l))}),e.jsx("div",{className:"d-grid gap-2",children:e.jsx(i.Button,{disabled:n.disabled,onClick:o,children:"Reset"})})]})]}),children:e.jsx(i.Button,{className:"flex-grow-0",title:"Shutter Details",children:e.jsx("i",{className:"fa fa-ellipsis-h"})})})}function Ke(n){const{hardware:t,options:o={}}=n;function s(){t.actions.call(t.properties.frontend==="FE open"?"close":"open")}return e.jsxs("div",{className:"hw-component",children:[e.jsxs("div",{className:"hw-head",children:[e.jsx(y,{name:"Frontend",icon:"fam-hardware-frontend",online:t.online}),e.jsx("div",{className:"name",children:t.name}),e.jsx(i.Badge,{bg:t.properties.state==="OPEN"||t.properties.state==="RUNNING"?"success":"danger",children:t.properties.state})]}),e.jsx("div",{className:"hw-content",children:e.jsxs(i.ButtonGroup,{className:"d-flex",children:[e.jsx(i.Button,{variant:t.properties.frontend==="FE open"?"danger":"success",onClick:s,disabled:n.disabled,children:t.properties.frontend==="FE open"?"Close":"Open"}),e.jsx(Yn,{...n})]})})]})}const Kn={default:Ke},Qn=Kn,Xn=["open","close","reset"],Jn="fe",Zn="fe",eo=!0,to={current:196.58051532652968,expitlk:"ON",feitlk:"ON",frontend:"FE open",pssitlk:"ON",refill:2287,state:"RUNNING",mode:"USM",message:"USM until 18:00",status:`State : The Front End is open with automatic opening mode on
2
2
  Mode : Beam Delivery
3
3
  Automatic : Automatic opening active
4
4
  Type : UHV
@@ -7,7 +7,7 @@ Module 1 Gate Valve 1: Open
7
7
  Module 1 Gate Valve 2: Open
8
8
  Module 2 Gate Valve 1: Open
9
9
 
10
- `},Zn="tango",eo=!0,to="frontend",no={callables:Yn,id:Kn,name:Qn,online:Xn,properties:Jn,protocol:Zn,require_staff:eo,type:to},oo={default:no};function so(n){const{hardware:t}=n,o=()=>{t.actions.call(t.properties.state==="ON"?"off":"on")};return e.jsx(i.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"popid",children:[e.jsxs(i.Popover.Header,{children:[t.name," Details"]}),e.jsxs(i.Popover.Body,{children:[e.jsx("h6",{children:"Status"}),e.jsx("pre",{children:t.properties.status}),e.jsx("div",{className:"d-grid gap-2",children:e.jsx(i.Button,{disabled:n.disabled,onClick:o,children:t.properties.state==="ON"?"Off":"On"})})]})]}),children:e.jsx(i.Button,{title:"Gauge Details",children:e.jsx("i",{className:"fa fa-ellipsis-h"})})})}function Ke(n){const{hardware:t,options:o={}}=n;return e.jsxs("div",{className:"hw-component",children:[e.jsxs("div",{className:"hw-head",children:[e.jsx(y,{name:"Gauge",icon:"fam-hardware-gauge",online:t.online}),e.jsx("div",{className:"name",children:t.name}),e.jsx(i.Badge,{bg:t.properties.state==="ON"?"success":"danger",children:t.properties.state})]}),e.jsx("div",{className:"hw-content",children:e.jsxs(i.InputGroup,{children:[e.jsx(i.Form.Control,{value:t.properties.pressure.toExponential(o.precision||3),disabled:!0}),(t.properties.unit||o.unit)&&e.jsx(i.InputGroup.Text,{children:t.properties.unit||o.unit}),e.jsx(so,{...n})]})})]})}const ro={default:Ke},io=ro,ao=["off","on"],co="pir121",lo="pir121",uo=!0,fo={pressure:.0007999999797903001,state:"ON",status:`
10
+ `},no="tango",oo=!0,so="frontend",ro={callables:Xn,id:Jn,name:Zn,online:eo,properties:to,protocol:no,require_staff:oo,type:so},io={default:ro};function ao(n){const{hardware:t}=n,o=()=>{t.actions.call(t.properties.state==="ON"?"off":"on")};return e.jsx(i.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"popid",children:[e.jsxs(i.Popover.Header,{children:[t.name," Details"]}),e.jsxs(i.Popover.Body,{children:[e.jsx("h6",{children:"Status"}),e.jsx("pre",{children:t.properties.status}),e.jsx("div",{className:"d-grid gap-2",children:e.jsx(i.Button,{disabled:n.disabled,onClick:o,children:t.properties.state==="ON"?"Off":"On"})})]})]}),children:e.jsx(i.Button,{title:"Gauge Details",children:e.jsx("i",{className:"fa fa-ellipsis-h"})})})}function Qe(n){const{hardware:t,options:o={}}=n;return e.jsxs("div",{className:"hw-component",children:[e.jsxs("div",{className:"hw-head",children:[e.jsx(y,{name:"Gauge",icon:"fam-hardware-gauge",online:t.online}),e.jsx("div",{className:"name",children:t.name}),e.jsx(i.Badge,{bg:t.properties.state==="ON"?"success":"danger",children:t.properties.state})]}),e.jsx("div",{className:"hw-content",children:e.jsxs(i.InputGroup,{children:[e.jsx(i.Form.Control,{value:t.properties.pressure.toExponential(o.precision||3),disabled:!0}),(t.properties.unit||o.unit)&&e.jsx(i.InputGroup.Text,{children:t.properties.unit||o.unit}),e.jsx(ao,{...n})]})})]})}const co={default:Qe},lo=co,uo=["off","on"],fo="pir121",po="pir121",mo=!0,ho={pressure:.0007999999797903001,state:"ON",status:`
11
11
  Gauge is underrange - Channel B2 (4)
12
12
  Rel. | Lower | Upper | SA | State
13
13
  1 | 1.0e-6| 3.0e-6| 1 | ON
@@ -17,7 +17,7 @@ Rel. | Lower | Upper | SA | State
17
17
  A | 4.0e-3| 1.0e-5| 6 | ON
18
18
  B | 4.0e-3| 1.0e-5| 8 | ON
19
19
 
20
- HDB Storage OK`},po="tango",mo=!0,ho="gauge",xo={callables:ao,id:co,name:lo,online:uo,properties:fo,protocol:po,require_staff:mo,type:ho},go=["off","on"],jo="pen121",wo="pen121",yo=!0,vo={pressure:13999999737279722e-23,state:"ON",status:`Gauge is ON - Channel B1 (3)
20
+ HDB Storage OK`},xo="tango",go=!0,jo="gauge",wo={callables:uo,id:fo,name:po,online:mo,properties:ho,protocol:xo,require_staff:go,type:jo},yo=["off","on"],vo="pen121",No="pen121",bo=!0,_o={pressure:13999999737279722e-23,state:"ON",status:`Gauge is ON - Channel B1 (3)
21
21
  Rel. | Lower | Upper | SA | State
22
22
  1 | 1.0e-6| 3.0e-6| 1 | ON
23
23
  2 | 4.0e-3| 6.0e-3| 2 | ON
@@ -25,13 +25,13 @@ Rel. | Lower | Upper | SA | State
25
25
  4 | 4.0e-3| 6.0e-3| 4 | ON
26
26
  A | 4.0e-3| 1.0e-5| 6 | ON
27
27
  B | 4.0e-3| 1.0e-5| 8 | ON
28
- `},No="tango",bo=!0,_o="gauge",$o={callables:go,id:jo,name:wo,online:yo,properties:vo,protocol:No,require_staff:bo,type:_o},So={default:xo,default2:$o},Co=h.forwardRef((n,t)=>{const o=h.useRef(null),s=h.useRef(),[r,a]=h.useState(n.step),[c,l]=h.useState(!1),f=$=>{const q=t;if(o.current===null)return;let J=Number.parseFloat(q.current.value);if(o.current.value.startsWith("*")){const Z=Number.parseFloat(o.current.value.replace("*",""));J=$?J*Z:J/Z}else{const Z=Number.parseFloat(o.current.value);J+=$?Z:-Z}q.current.value=`${J}`,n.onStep&&n.onStep({target:q.current})},{onStep:u,step:d,overlay:p,incIcon:m,decIcon:g,swapIncDec:w,onKeyDown:x,onBlur:j,horizontalArrows:N,largeArrows:M,disabled:T,stepOnly:b,..._}=n,S=$=>{$.key==="ArrowUp"?($.preventDefault(),l(!0),f(!0)):$.key==="ArrowDown"?($.preventDefault(),l(!0),f(!1)):x&&x($)};c&&(s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{var $;($=t==null?void 0:t.current)==null||$.focus()},100)),h.useEffect(()=>()=>{s.current&&clearTimeout(s.current)},[]);const C=()=>{s.current&&clearTimeout(s.current),l(!1),j&&j()};if(!n.step)return e.jsx(i.Form.Control,{ref:t,type:"number",step:"any",onKeyDown:S,onBlur:C,disabled:T,onClick:$=>{$.stopPropagation()},..._});const G=D.map(n.steps||[n.step],$=>e.jsx("option",{value:$,children:$},$)),B=m||g;return e.jsx("div",{className:k.default("numeric-step",{"numeric-step-large":M,"numeric-step-horizontal":N}),children:e.jsxs(i.InputGroup,{children:[e.jsx(i.Form.Control,{onKeyDown:S,onBlur:C,ref:t,type:"number",step:"any",disabled:T||b,..._}),e.jsxs(e.Fragment,{children:[p,!p&&e.jsxs(i.InputGroup.Text,{className:`d-flex flex-column ${B?"inc-dec":""}`,children:[e.jsx(i.Form.Control,{ref:o,as:"select",className:"step-size",defaultValue:r,disabled:T,onChange:$=>a(Number.parseFloat($.target.value)),children:G}),n.unit&&e.jsx("div",{children:n.unit}),!m&&!g&&e.jsxs(e.Fragment,{children:[e.jsx(i.Button,{className:"step step-up",disabled:n.disabled,onClick:$=>f(!0)}),e.jsx(i.Button,{className:"step step-down",disabled:n.disabled,onClick:$=>f(!1)})]})]}),g&&w&&e.jsx(i.Button,{disabled:n.disabled,onClick:$=>f(!1),children:e.jsx("i",{className:`fa fa-fw fa-${g}`})}),m&&e.jsx(i.Button,{disabled:n.disabled,onClick:$=>f(!0),children:e.jsx("i",{className:`fa fa-fw fa-${m}`})}),g&&!w&&e.jsx(i.Button,{disabled:n.disabled,onClick:$=>f(!1),children:e.jsx("i",{className:`fa fa-fw fa-${g}`})})]})]})})}),Qe=Co;function he(n){const t=h.useRef(null),[o,s]=h.useState(!1),[r,a]=h.useState(!1);h.useEffect(()=>{t.current&&(n.hardwareValue===null?t.current.value="":n.precision!==void 0?t.current.value=n.hardwareValue.toFixed(n.precision):t.current.value=n.hardwareValue.toString(),s(!1))},[n.hardwareValue]);function c(p){let m=p;n.precision!==void 0&&(m=Number.parseFloat(m).toFixed(n.precision)),t!=null&&t.current&&(t.current.value=m)}function l(){o&&setTimeout(()=>{c(n.hardwareValue),s(!1)},3e3)}function f(p){n.hardwareValue!==null&&s(p.target.value!==n.hardwareValue.toString())}function u(p){s(!1);const m=n.onMoveRequested(p.target.value);m&&m.catch(()=>{a(!0),setTimeout(()=>{c(n.hardwareValue),a(!1)},2e3)})}function d(p){switch(p.key){case"Enter":{s(!1);const m=Number.parseFloat(p.target.value),g=n.onMoveRequested(m);g&&g.catch(()=>{a(!0),setTimeout(()=>{c(n.hardwareValue),a(!1)},2e3)})}p.preventDefault(),p.stopPropagation();break;case"Esc":case"Escape":o&&(a(!1),s(!1),c(n.hardwareValue)),p.target.blur(),p.preventDefault(),p.stopPropagation();break}}return e.jsx(Qe,{id:n.id,className:k.default({"form-control-edited":o,"form-control-error":r,"hw-moving":n.hardwareIsMoving}),type:n.readOnly?"text":"number",ref:t,precision:n.precision,onChange:f,onBlur:l,onStep:u,onKeyDown:d,disabled:n.hardwareIsDisabled||n.readOnly||!n.hardwareIsReady,stepOnly:n.stepOnly,step:n.step,steps:n.steps,incIcon:n.incIcon,decIcon:n.decIcon,swapIncDec:n.swapIncDec,horizontalArrows:n.horizontalArrows,largeArrows:n.largeArrows,overlay:n.hardwareIsMoving&&!n.hardwareIsDisabled?e.jsx(i.Button,{variant:"danger",onClick:n.onAbortRequested,children:e.jsx("i",{className:"fa fa-times"})}):null})}function Xe(n){const{hardware:t,options:o={},disabled:s}=n;function r(u){return t.actions.setProperty("power",u)}function a(u){return t.actions.call(u?"on":"off")}const c=t.properties.state,l=e.jsx(y,{name:"Laser",icon:"fam-hardware-laser",online:t.online}),f=e.jsx(F,{state:c,minWidth:6,variant:c==="ON"?"success":"warning"});return e.jsx(v,{hardware:t,widgetIcon:l,widgetState:f,widgetContent:e.jsxs(i.InputGroup,{children:[e.jsx(he,{id:t.id,hardwareValue:t.properties.power,hardwareIsDisabled:!1,hardwareIsReady:!0,hardwareIsMoving:c==="MOVING",onMoveRequested:r,onAbortRequested:()=>null,precision:1,readOnly:!1,step:o.step,steps:o.steps,incIcon:void 0,decIcon:void 0,swapIncDec:void 0}),e.jsx(i.Button,{size:"sm",style:{fontSize:"0.6rem",padding:"0.05rem 0.6rem",marginTop:"0.1rem"},onClick:()=>{a(t.properties.state!=="ON")},children:e.jsx("i",{className:t.properties.state==="ON"?"fa fa-toggle-on":"fa fa-toggle-off"})})]})})}const Oo={default:Xe},Io=Oo,Mo=[],To="yag1",Fo="yag1",Do=!0,Ao={power:5,state:"ON"},Ro="bliss",Eo=!1,ko="laser",Po={callables:Mo,id:To,name:Fo,online:Do,properties:Ao,protocol:Ro,require_staff:Eo,type:ko},Go={default:Po};function Bo(n){var o;const{hardware:t}=n;return e.jsx(i.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"laserheating_overlay",children:[e.jsxs(i.Popover.Header,{children:[t.name," details"]}),e.jsx(i.Popover.Body,{children:e.jsxs(i.Container,{children:[e.jsxs(i.Row,{children:[e.jsx(i.Col,{children:"Background Mode"}),e.jsx(i.Col,{children:t.properties.background_mode})]}),e.jsxs(i.Row,{children:[e.jsx(i.Col,{children:"Calibration"}),e.jsx(i.Col,{children:t.properties.current_calibration})]}),e.jsxs(i.Row,{children:[e.jsx(i.Col,{children:"Fit Wavelength"}),e.jsxs(i.Col,{children:[(o=t.properties.fit_wavelength)==null?void 0:o.join(" - ")," ",e.jsx("span",{children:"nm"})]})]})]})})]}),children:e.jsx(i.Button,{children:e.jsx("i",{className:"fa fa-ellipsis-h"})})})}function Je(n){const{hardware:t,options:o={},disabled:s}=n,[r,a]=h.useState(!1);function c(p){return p<=0?Promise.reject(new Error("exposure_time must be > 0")):t.actions.setProperty("exposure_time",p)}function l(){a(!0);const p=t.actions.call("measure");return p!==void 0&&(console.log("pending"),p.then(()=>{a(!1)}).catch(m=>{a(!1)})),p}const f=t.properties.state,u=e.jsx(y,{name:"Laser Heating",icon:"fa-fire",online:t.online}),d=e.jsx(F,{state:f,minWidth:6,variant:f==="READY"?"success":"warning"});return e.jsx(v,{hardware:t,widgetIcon:u,widgetState:d,widgetContent:e.jsxs(i.InputGroup,{children:[e.jsx(he,{id:t.id,hardwareValue:t.properties.exposure_time,hardwareIsReady:!0,hardwareIsDisabled:n.disabled,hardwareIsMoving:!1,onMoveRequested:c,onAbortRequested:()=>null,precision:1,readOnly:!1,step:o.exposureStep,steps:o.exposureSteps,incIcon:void 0,decIcon:void 0,swapIncDec:void 0}),e.jsx(i.InputGroup.Text,{children:"s"}),e.jsx(i.Button,{size:"sm",disabled:n.disabled||r,onClick:()=>{l()},children:r?e.jsx("i",{className:"fa fa-spinner fa-spin"}):e.jsxs(e.Fragment,{children:[e.jsx("i",{className:"fa fa-play me-1"}),"Measure"]})}),e.jsx(Bo,{hardware:t,disabled:n.disabled})]})})}const Vo={default:Je},Lo=Vo,Uo=[],Ho="laserheating",qo="laserheating",zo=!0,Wo={exposure_time:.5,state:"ON",background_mode:"READY",fit_wavelength:[500,650],current_calibration:"/path/to/file"},Yo="bliss",Ko=!1,Qo="laserheating",Xo={callables:Uo,id:Ho,name:qo,online:zo,properties:Wo,protocol:Yo,require_staff:Ko,type:Qo},Jo={default:Xo};function Ze(n){const t=h.useRef(null),{hardware:o,options:s={}}=n;function r(c){o.actions.setProperty("intensity",c)}const a=h.useCallback(un.default(r,100),[]);return e.jsxs("div",{className:"hw-component",children:[e.jsxs("div",{className:"hw-head",children:[e.jsx(y,{name:"Light",icon:"fa-lightbulb-o",online:o.online}),e.jsx("div",{className:"name",children:o.name}),e.jsx(i.Badge,{bg:o.properties.state==="ON"?"success":"danger",children:o.properties.state})]}),e.jsxs("div",{className:"hw-content",children:[e.jsx(i.Form.Control,{ref:t,disabled:n.disabled,type:"range",min:"0",max:"100",onChange:c=>a(Number.parseFloat(c.target.value)),defaultValue:o.properties.intensity}),e.jsxs("div",{children:[e.jsx(i.Button,{disabled:o.properties.intensity===0,size:"sm",style:{fontSize:"0.6rem",padding:"0.05rem 0.6rem",marginTop:"0.1rem"},onClick:()=>a(0),children:e.jsx("i",{className:"fa fa-power-off"})}),e.jsxs("span",{className:"float-end",children:[o.properties.intensity," %"]})]})]})]})}const Zo={default:Ze},es=Zo,ts=[],ns="light_vlm",os="light_vlm",ss=!0,rs={intensity:0,state:"ON",temperature:23.2},is="bliss",as=!1,cs="light",ls={callables:ts,id:ns,name:os,online:ss,properties:rs,protocol:is,require_staff:as,type:cs},ds={default:ls};function H(n){const{hardware:t}=n,{online:o,locked:s=null}=t,r=t.properties.state??"UNKNOWN";console.log(r);const a=o?(r==="ACQUIRING"?r:s!==null?"LOCKED":r)||"UNKNOWN":"OFFLINE",c={UNKNOWN:"critical",ACQUIRING:"warning",READY:"success",OFFLINE:"secondary",LOCKED:"warning"},l=c[a]??c.UNKNOWN;return e.jsx(F,{state:a,minWidth:6,variant:l})}function us(n){const{hardware:t}=n;return e.jsx(H,{hardware:t})}function Ae(n){const{hardware:t,options:o={}}=n;return e.jsx(i.Stack,{className:"bg-light rounded-2 ps-2 p-1",direction:"horizontal",children:e.jsx("div",{children:t.name})})}function et(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(H,{hardware:t}),a=o.header||"top";return a==="none"?e.jsx(Ae,{...n}):e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:e.jsx(Ae,{...n}),headerMode:a})}function Re(n){const{hardware:t,options:o={}}=n,[s,r]=t.properties.size??["?","?"];return e.jsxs(i.Stack,{className:"bg-light rounded-2 ps-2 p-1",direction:"horizontal",children:[e.jsxs("div",{children:[s," × ",r]}),e.jsx("div",{className:"ms-auto",children:e.jsx("small",{children:e.jsx("small",{children:"px"})})})]})}function tt(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(H,{hardware:t}),a=o.header??"top";return a==="none"?e.jsx(Re,{...n}):e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:e.jsx(Re,{...n}),headerMode:a})}function z(n){const[t,o]=h.useState(!1);return e.jsxs(i.Button,{variant:n.isActive?"primary":t?"warning":"secondary",onClick:()=>{o(!0),n.onAction().finally(()=>{o(!1)})},disabled:n.disabled||t,title:n.title,className:"text-nowrap",children:[n.icon&&e.jsx("i",{className:`col-sm-4 justify-content-center align-self-center ${n.icon}`}),n.children]})}function fs(n){const{hardware:t,options:o={},disabled:s}=n,{actions:r,properties:a}=t,{rotation:c,flip:[l,f]}=a;return e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{variant:"secondary",disabled:s}),e.jsx(i.Dropdown.Menu,{align:"end",popperConfig:{strategy:"fixed"},children:e.jsxs(i.Container,{children:[e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center",children:"Rotation"})}),e.jsx(i.Row,{children:e.jsx(i.Col,{children:e.jsxs(i.ButtonGroup,{children:[e.jsx(z,{isActive:c===0,onAction:()=>r.setProperty("rotation",0),disabled:s,title:"Disable rotation transformation",children:"None"}),e.jsxs(z,{isActive:c===90,onAction:()=>r.setProperty("rotation",90),disabled:s,title:"Disable rotation transformation",children:["90 ",e.jsx("i",{className:"fa fa-fw fa-arrow-rotate-right"})]}),e.jsxs(z,{isActive:c===180,onAction:()=>r.setProperty("rotation",180),disabled:s,title:"Disable rotation transformation",children:["180 ",e.jsx("i",{className:"fa fa-fw fa-arrow-rotate-right"})]}),e.jsxs(z,{isActive:c===270,onAction:()=>r.setProperty("rotation",270),disabled:s,title:"Disable rotation transformation",children:["270 ",e.jsx("i",{className:"fa fa-fw fa-arrow-rotate-right"})]})]})})}),e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center",children:"Flip"})}),e.jsxs(i.Row,{className:"gx-0",children:[e.jsx(i.Col,{xs:6,children:e.jsxs(i.ButtonGroup,{children:[e.jsxs(z,{isActive:l,onAction:()=>r.setProperty("flip",[!0,f]),disabled:s,title:"Enable horizontal flip transformation",children:["Horiz ",e.jsx("i",{className:"fa fa-fw fa-left-right"})]}),e.jsx(z,{isActive:!l,onAction:()=>r.setProperty("flip",[!1,f]),disabled:s,title:"Disable horizontal flip transformation",children:"No"})]})}),e.jsx(i.Col,{xs:6,children:e.jsxs(i.ButtonGroup,{children:[e.jsxs(z,{isActive:f,onAction:()=>r.setProperty("flip",[l,!0]),disabled:s,title:"Enable vertical flip transformation",children:["Vert ",e.jsx("i",{className:"fa fa-fw fa-up-down"})]}),e.jsx(z,{isActive:!f,onAction:()=>r.setProperty("flip",[l,!1]),disabled:s,title:"Disable vertical flip transformation",children:"No"})]})})]})]})})]})}function ps(n){const{hardware:t,options:o={}}=n,{properties:s}=t,[r,a]=s.flip,c=s.rotation??0,l=!r&&!a&&c===0;return e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsxs(i.InputGroup.Text,{children:[r&&e.jsxs(i.Badge,{style:{fontSize:"130%"},className:"me-1",children:["Flip",e.jsx("i",{className:"fa fa-fw fa-left-right"})]}),a&&e.jsxs(i.Badge,{style:{fontSize:"130%"},className:"me-1",children:["Flip",e.jsx("i",{className:"fa fa-fw fa-up-down"})]}),c!==0&&e.jsxs(i.Badge,{style:{fontSize:"130%"},className:"me-1",children:["Rot ",c.toFixed(0),e.jsx("i",{className:"fa fa-fw fa-arrow-rotate-right"})]}),l&&e.jsx(i.Badge,{bg:"secondary",style:{fontSize:"130%"},title:"No transformation",children:"None"})]}),!o.readonly&&e.jsx(fs,{...n})]})}function nt(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(H,{hardware:t}),a=e.jsx(e.Fragment,{children:e.jsx(ps,{...n})}),c=o.header??"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const ot="4.2em";function ms(n){const{hardware:t}=n,{properties:o}=t,s=o.state==="READY",r=n.disabled||!t.online||!s,a=o.binning_mode??"SUM";function c(l){const{binningMode:f,selectedMode:u,title:d}=l,m=f===u?"fa fa-fw fa-dot-circle-o":"fa fa-fw fa-circle-o";return e.jsxs(i.Dropdown.Item,{disabled:r,onClick:()=>{t.actions.setProperty("binning_mode",f)},title:d,children:[e.jsx("i",{className:m})," "," ",e.jsx(i.Badge,{style:{minWidth:ot},children:f})]},f)}return e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{disabled:r,variant:"secondary"}),e.jsxs(i.Dropdown.Menu,{align:"end",popperConfig:{strategy:"fixed"},children:[e.jsx(c,{binningMode:"SUM",selectedMode:a,title:"Merge binned pixel with SUM operation"}),e.jsx(c,{binningMode:"MEAN",selectedMode:a,title:"Merge binned pixel with MEAN operation"})]})]})}function hs(n){const{hardware:t,options:o,disabled:s}=n,{properties:r}=t,[a,c]=r.binning,l=a===c?a:0,f=r.binning_mode??"SUM";function u(m){t.actions.setProperty("binning",[m,m])}const d=$s(t),p=o.readonly??!1;return e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(i.InputGroup.Text,{title:"Binning applied to the detector",children:e.jsx("i",{className:"fa fa-fw fa-ruler-combined fa-2x"})}),e.jsx(R,{value:`${r.binning[0]} × ${r.binning[1]}`}),!p&&e.jsxs(e.Fragment,{children:[e.jsx(i.Button,{variant:l===1?"primary":"secondary",onClick:()=>{u(1)},disabled:s,children:"1"}),e.jsx(i.Button,{variant:l===2?"primary":"secondary",onClick:()=>{u(2)},disabled:s,children:"2"}),e.jsx(i.Button,{variant:l===3?"primary":"secondary",onClick:()=>{u(3)},disabled:s,children:"3"}),e.jsx(i.Button,{variant:l===4?"primary":"secondary",onClick:()=>{u(4)},disabled:s,children:"4"})]}),e.jsx(i.InputGroup.Text,{title:"Binning applied to the detector",children:e.jsx(i.Badge,{style:{fontSize:"130%",minWidth:ot},title:`Detector setup with binning ${f}`,children:f})}),!p&&d&&e.jsx(ms,{...n})]})}function st(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(H,{hardware:t}),a=e.jsx(e.Fragment,{children:e.jsx(hs,{...n})}),c=o.header??"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function xs(n){const{hardware:t}=n,{properties:o}=t;return e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(i.InputGroup.Text,{title:"Rotation applied to the detector",children:e.jsx("i",{className:"fa fa-fw fa-crop-simple fa-2x"})}),e.jsx(i.Form.Control,{value:`${o.roi[0]}`,readOnly:!0}),e.jsx(i.Form.Control,{value:`${o.roi[1]}`,readOnly:!0}),e.jsx(i.Form.Control,{value:`${o.roi[2]}`,readOnly:!0}),e.jsx(i.Form.Control,{value:`${o.roi[3]}`,readOnly:!0}),e.jsx(i.InputGroup.Text,{children:"px"})]})}function rt(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(H,{hardware:t}),a=e.jsx(e.Fragment,{children:e.jsx(xs,{hardware:t})}),c=o.header??"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function gs(n){const{hardware:t}=n,{properties:o}=t,s=o.static,[r,a]=(s==null?void 0:s.image_max_dim)??["?","?"];return e.jsxs(i.InputGroup,{children:[e.jsx(i.InputGroup.Text,{title:"Max size of the detector",children:"Max size"}),e.jsx(i.Form.Control,{value:`${r} × ${a}`,readOnly:!0}),e.jsx(i.InputGroup.Text,{children:"px"})]})}function js(n){const{hardware:t}=n,{properties:o}=t,s=o.static;return e.jsxs(i.InputGroup,{children:[e.jsx(i.InputGroup.Text,{title:"Version of the Lima server (lima-core)",children:"Lima version"}),e.jsx(i.Form.Control,{value:`${s==null?void 0:s.lima_version}`,readOnly:!0})]})}function ws(n){const{hardware:t}=n,{properties:o}=t,s=o.static;return e.jsxs(i.InputGroup,{children:[e.jsx(i.InputGroup.Text,{title:"Model of the detector",children:"Type/model"}),e.jsx(i.Form.Control,{value:`${s==null?void 0:s.camera_type}`,readOnly:!0}),e.jsx(i.Form.Control,{value:`${s==null?void 0:s.camera_model}`,readOnly:!0})]})}function it(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(H,{hardware:t}),a=e.jsxs(e.Fragment,{children:[e.jsx(ws,{hardware:t}),e.jsx(gs,{hardware:t}),e.jsx(js,{hardware:t})]}),c=o.header??"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function ys(n){var _;const{hardware:t,disabled:o}=n,{properties:s}=t,r=((_=s.static)==null?void 0:_.image_max_dim)??[0,0],a=s.roi,c=s.binning??[1,1],l=r[0]/c[0],f=r[1]/c[1];function u(){return f>l?1/f:1/l}const d=u(),[p,m]=[100*l*d,100*f*d];function g(){const[S,C,G,B]=a;return[100*S/l,100*C/f,100*G/l,100*B/f]}function w(){const[S,C,G,B]=a;return[100*(S+G*.5)/l,100*(C+B*.5)/f]}const[x,j,N,M]=g(),[T,b]=w();return e.jsx("div",{style:{backgroundColor:"#AAAAAA",width:"10em",height:"10em"},children:e.jsxs("div",{className:"position-relative",title:`Detector ${t.id}`,style:{backgroundColor:"#FFFFFF",border:"2px solid black",width:`${p}%`,height:`${m}%`},children:[e.jsx("div",{title:"ROI location",className:"position-absolute",style:{backgroundColor:"#FFFFFF",border:"2px dotted black",left:`${x}%`,top:`${j}%`,width:`${N}%`,height:`${M}%`}}),e.jsxs("span",{className:"position-absolute",style:{left:`${T}%`,top:`${b}%`,transform:"translate(-50%, -50%)"},children:[a[2],"×",a[3]]})]})})}function at(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(H,{hardware:t}),a=e.jsx(e.Fragment,{children:e.jsx(ys,{...n})}),c=o.header??"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const W={};function vs(n){n.useHardware&&(W.useHardware&&console.warn("useHardware hook was already registered"),W.useHardware=n.useHardware),n.useHardwareChangeActions&&(W.useHardwareChangeActions&&console.warn("useHardwareChangeActions hook was already registered"),W.useHardwareChangeActions=n.useHardwareChangeActions)}function P(n){if(!W.useHardware)throw new Error("No `useHardware` hook registered");return W.useHardware(n)}function ee(n){if(!W.useHardwareChangeActions)throw new Error("No `useHardwareChangeActions` hook registered");return W.useHardwareChangeActions(n)}function xe(n){return n.type==="lima"}function Ns(n){const t=P(n);return t===null||!xe(t)?null:t}function ct(n,t){const o=Math.ceil(n/t),s=n/o;return[o,s]}const bs={default:et,size:tt,transformation:nt,binning:st,imageroi:rt,description:it,shape:at,state:us},_s=bs;function $s(n){var t;return n.properties.binning_mode!==void 0&&fn.default.gte(((t=n.properties.static)==null?void 0:t.lima_version)??"0.0.0","1.10.4")}const Ss="lima_cam",Cs="lima_cam",Os="bliss",Is="lima",Ms=!0,Ts=!1,Fs={static:{lima_version:"1.9.23",lima_type:"Frelon",camera_type:"Frelon",camera_model:"SPB8x2 CcdFT2k-F16",camera_pixelsize:[16e-6,16e-6],image_max_dim:[1920,1920]},acc_max_expo_time:1,binning:[1,1],flip:[!1,!1],pixel_size:[1e3,1e3],raw_roi:[0,0,128,128],roi:[0,0,128,128],rotation:0,size:[128,128],state:"READY"},Ds={id:Ss,name:Cs,protocol:Os,type:Is,online:Ms,require_staff:Ts,properties:Fs},As="lima_cam",Rs="lima_cam",Es="bliss",ks="lima",Ps=!0,Gs=!1,Bs={static:{lima_version:"1.9.23",lima_type:"Frelon",camera_type:"Frelon",camera_model:"SPB8x2 CcdFT2k-F16",camera_pixelsize:[16e-6,16e-6],image_max_dim:[1920,1920]},acc_max_expo_time:1,binning:[1,1],flip:[!0,!1],pixel_size:[1e3,1e3],raw_roi:[0,0,128,128],roi:[0,0,128,128],rotation:0,size:[128,128],state:"READY"},Vs={id:As,name:Rs,protocol:Es,type:ks,online:Ps,require_staff:Gs,properties:Bs},Ls="lima_cam",Us="lima_cam",Hs="bliss",qs="lima",zs=!0,Ws=!1,Ys={static:{lima_version:"1.9.23",lima_type:"Frelon",camera_type:"Frelon",camera_model:"SPB8x2 CcdFT2k-F16",camera_pixelsize:[16e-6,16e-6],image_max_dim:[1920,1920]},acc_max_expo_time:1,binning:[1,1],flip:[!1,!1],pixel_size:[1e3,1e3],raw_roi:[0,0,128,128],roi:[0,0,128,128],rotation:180,size:[128,128],state:"READY"},Ks={id:Ls,name:Us,protocol:Hs,type:qs,online:zs,require_staff:Ws,properties:Ys},Qs="lima_cam",Xs="lima_cam",Js="bliss",Zs="lima",er=!0,tr=!1,nr={static:{lima_version:"1.9.23",lima_type:"Frelon",camera_type:"Frelon",camera_model:"SPB8x2 CcdFT2k-F16",camera_pixelsize:[16e-6,16e-6],image_max_dim:[1920,1920]},acc_max_expo_time:1,binning:[1,1],flip:[!1,!1],pixel_size:[1e3,1e3],raw_roi:[0,710,1920,500],roi:[0,710,1920,500],rotation:0,size:[1920,1920],state:"READY"},or={id:Qs,name:Xs,protocol:Js,type:Zs,online:er,require_staff:tr,properties:nr},sr="lima_cam",rr="lima_cam",ir="bliss",ar="lima",cr=!0,lr=!1,dr={static:{lima_version:"1.9.23",lima_type:"Frelon",camera_type:"Frelon",camera_model:"SPB8x2 CcdFT2k-F16",camera_pixelsize:[16e-6,16e-6],image_max_dim:[5e3,2e3]},acc_max_expo_time:1,binning:[1,1],flip:[!1,!1],pixel_size:[1e3,1e3],raw_roi:[0,0,5e3,2e3],roi:[0,0,5e3,2e3],rotation:0,size:[5e3,2e3],state:"READY"},ur={id:sr,name:rr,protocol:ir,type:ar,online:cr,require_staff:lr,properties:dr},fr={default:Ds,flip:Vs,rot:Ks,roicenter:or,squaredetector:ur};function pr(n){const{name:t,alias:o,useHardwareContext:s}=n,r=[1920,1920],a=[16e-6,16e-6],[c,l]=h.useState({static:{lima_version:"1.9.23",lima_type:"Frelon",camera_type:"Frelon",camera_model:"SPB8x2 CcdFT2k-F16",camera_pixelsize:a,image_max_dim:r},acc_max_expo_time:1,binning:[1,1],flip:[!1,!1],pixel_size:a,raw_roi:[0,0,...r],roi:[0,0,...r],rotation:0,size:r,state:"READY"});async function f(x,j){console.log("LimaSimulator: Unsupported call",x,j)}function u(x,j){const N=[Math.round(a[0]*j[0]),Math.round(a[1]*j[1])],M=[Math.round(r[0]/j[0]),Math.round(r[1]/j[1])];return{...x,binning:j,pixel_size:N,roi:[0,0,...M],size:M}}function d(x,j){return{...x,binning_mode:j}}function p(x,j){return{...x,rotation:j}}function m(x,j){return{...x,flip:[j,x.flip[1]]}}function g(x,j){return{...x,flip:[x.flip[0],j]}}async function w(x,j){if(x==="binning"){l(N=>u(N,j));return}if(x==="binning_mode"){l(N=>d(N,j));return}if(x==="rotation"){l(N=>p(N,j));return}if(x==="flip_x"){l(N=>m(N,j));return}if(x==="flip_y"){l(N=>g(N,j));return}console.log("LimaSimulator: Unsupported setProperty",x,j)}return e.jsx(U,{name:t,alias:o,type:"lima",call:f,setProperty:w,properties:c,useHardwareContext:s})}function mr(n,t){const{inputRef:o,referenceElementRef:s,onAddSelection:r,onRemoveSelection:a,...c}=n,l=h.useRef(),f=()=>{setTimeout(()=>{const p=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value").set;p&&p.call(l.current,""),l.current&&l.current.dispatchEvent(new Event("input",{bubbles:!0}))},500)},u=()=>{r&&r(t.results).then(()=>{f()})},d=()=>{const p=t.text?[...t.selected].filter(m=>m.toLowerCase().indexOf(t.text.toLowerCase())!==-1):[...t.selected];a&&a(p).then(()=>{f()})};return e.jsxs(i.InputGroup,{children:[e.jsx(L.Hint,{children:e.jsx(i.Form.Control,{style:{width:"100%"},...c,ref:p=>{l.current=p,o(p),s(p)},placeholder:`${t.selected.length} enabled`})}),e.jsx(i.Button,{disabled:n.disabled||t.results.length===0,onClick:u,children:e.jsx("i",{className:"fa fa-plus"})}),e.jsx(i.Button,{disabled:n.disabled,onClick:d,children:e.jsx("i",{className:"fa fa-minus"})})]})}function hr(n){return function(t){function o(s,r,a){return t(s,r,a,n)}return o.displayName=`WithExtraProps(${t.displayName||t.name||"Component"})`,o}}function xr(n,t,o,s){const a=[...o.selected].filter(f=>f.toLowerCase().indexOf(o.text.toLowerCase())!==-1).sort().map(f=>e.jsx("a",{href:"#",className:"dropdown-item",onClick:()=>o.onRemove(f),children:e.jsx(L.Highlighter,{search:o.text,children:f})},f)),l=[...o.results].sort().map((f,u)=>e.jsx(L.MenuItem,{option:f,position:u,children:e.jsx(L.Highlighter,{search:o.text,children:f})},f));return e.jsxs(L.Menu,{...t,style:{...t.style,width:350},children:[s.pending&&e.jsx(L.Menu.Header,{children:"Loading..."}),!s.pending&&e.jsxs(e.Fragment,{children:[e.jsx(L.Menu.Header,{children:"Enabled"}),a,a.length===0&&e.jsx("span",{className:"dropdown-item disabled",children:"No items enabled"}),e.jsx(L.Menu.Header,{children:"Available"}),l,l.length===0&&e.jsx("span",{className:"dropdown-item disabled",children:"No items available"})]})]})}function lt(n){const{hardware:t}=n,{disabled:o=!1}=n,s=t.properties.available.filter(f=>!t.properties.disabled.includes(f));function r(f){const u=f.filter(p=>!s.includes(p)),d=s.filter(p=>!f.includes(p));u.length>0&&u.forEach(p=>{t.actions.call("enable",p)}),d.length>0&&d.forEach(p=>{t.actions.call("disable",p)})}function a(f){const u=[];return f.forEach(d=>{const p=t.actions.call("enable",d);u.push(p)}),Promise.all(u)}function c(f){const u=[];return f.forEach(d=>{const p=t.actions.call("disable",d);u.push(p)}),Promise.all(u)}function l(){return t.actions.call("set_active")}return e.jsxs("div",{className:"hw-component",children:[e.jsxs("div",{className:"hw-head",children:[e.jsx(y,{name:"Measurement Group",icon:"fa-list-ol",online:!0}),e.jsx("div",{className:"name",children:t.name}),e.jsx(i.OverlayTrigger,{placement:"top",overlay:e.jsx(i.Tooltip,{id:"active",children:"Activate this measurement group"}),children:e.jsx(i.Button,{size:"sm",disabled:o,onClick:()=>void l(),className:"float-right ml-1",children:e.jsx("i",{className:"fa fa-power-off"})})})]}),e.jsx("div",{className:"hw-content",children:e.jsx(L.Typeahead,{disabled:o,id:`typeahead_mg_${t.name}`,multiple:!0,flip:!0,positionFixed:!0,renderInput:mr,renderMenu:hr({name:t.id})(xr),onChange:r,inputProps:{onAddSelection:a,onRemoveSelection:c},selected:s,options:t.properties.available,selectHint:(f,u)=>u.key==="Enter"||f})})]})}const gr={default:lt},jr=gr,wr=[],yr="mg",vr="mg",Nr=!0,br={available:["lima:image","diode1","diode2","machinfo:current","machinfo:srcurrent"],disabled:["machinfo:current"]},_r="bliss",$r=!1,Sr="measurementgroup",Cr={callables:wr,id:yr,name:vr,online:Nr,properties:br,protocol:_r,require_staff:$r,type:Sr},Or={default:Cr};function Ir(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=h.useState({available:["lima:image","diode1","diode2","machinfo:current","machinfo:srcurrent"],disabled:["machinfo:current"]});async function c(d){a(p=>{const{disabled:m}=p;return{...p,disabled:m.filter(g=>g!==d)}})}async function l(d){a(p=>{const{disabled:m}=p;return{...p,disabled:m.includes(d)?m:[...m,d]}})}async function f(d,p){if(d==="enable"){await c(p);return}if(d==="disable"){await l(p);return}d!=="set_active"&&console.log("MeasurementGroupSimulator: Unsupported call",d,p)}async function u(d,p){console.log("MeasurementGroupSimulator: Unsupported setProperty",d,p)}return e.jsx(U,{name:t,alias:o,type:"measurementgroup",call:f,setProperty:u,properties:r,useHardwareContext:s})}const be={description:"Unknown state is exposed",variant:"fatal",priority:100},ce={OFFLINE:{description:"Axis is offline",variant:"secondary",priority:0},MOVING:{description:"Axis is moving",variant:"warning",priority:10},FAULT:{description:"Axis is in fault",variant:"danger",priority:20},LOCKED:{description:"Axis is locked",variant:"warning",priority:25},OFF:{description:"Power is off",variant:"secondary",priority:30},DISABLED:{description:"Axis is disabled",variant:"warning",priority:40},LOWLIMIT:{description:"Low limit is reached",variant:"warning",priority:50},HIGHLIMIT:{description:"High limit is reached",variant:"warning",priority:51},HOME:{description:"Home signal active",variant:"info",priority:52},READY:{description:"Ready to handle request",variant:"success",priority:60},NOT_READY:{description:"Not ready",variant:"warning",priority:100},UNKNOWN:be};function ge(n){const{hardware:t}=n,{locked:o=null}=t,{state:s=["UNKNOWN"]}=t.properties,[r,a]=h.useMemo(()=>{if(!t.online)return[["OFFLINE"],void 0];function c(p,m){const g=ce[p]??be,w=ce[m]??be;return g.priority-w.priority}const l=[...s,...o!==null?["LOCKED"]:[],...s.length===0?["NOT_READY"]:[]];l.sort(c);function f(p){const m=p.split(":",2);return m.length===1?[p,void 0]:m}const u={};return[l.map(p=>{if(p.startsWith("_")){const m=f(p);return m[1]!==void 0&&(u[m[0]]=m[1]),m[0]}return p==="LOCKED"?u[p]=`Locked by ${o}`:u[p]=ce[p].description??"",p}),u]},[s,t.online,o]);return e.jsx(He,{states:r,descriptions:a,minWidth:6,variants:Object.fromEntries(Object.entries(ce).map(([c,l])=>[c,l.variant]))})}function Mr(n){const{hardware:t}=n;return e.jsx(ge,{hardware:t})}function ne(n){const t=h.useRef(null),[o,s]=h.useState(!1),[r,a]=h.useState(!1);function c(d){return n.precision!==void 0?Number.parseFloat(d).toFixed(n.precision):d}h.useEffect(()=>{var d;t.current&&(t.current.value=c((d=n.hardwareValue)==null?void 0:d.toString()),s(!1))},[n.hardwareValue,n.precision]);function l(d){const p=c(d);t!=null&&t.current&&(t.current.value=p)}function f(d){switch(d.key){case"Enter":{s(!1);const p=Number.parseFloat(d.target.value),m=n.onMoveRequested(p);m&&m.catch(()=>{a(!0),setTimeout(()=>{l(n.hardwareValue),a(!1)},2e3)}),d.preventDefault(),d.stopPropagation();break}case"Esc":case"Escape":o&&(a(!1),s(!1),l(n.hardwareValue)),d.target.blur(),d.preventDefault(),d.stopPropagation();break}}function u(d){s(d.target.value!==n.hardwareValue.toString())}return e.jsx(i.Form.Control,{className:k.default({"form-control-edited":o,"form-control-error":r,"hw-moving":n.hardwareIsMoving}),type:"number",ref:t,onChange:u,onKeyDown:f,disabled:n.readOnly||n.hardwareIsMoving||n.hardwareIsDisabled,step:n.step,onClick:d=>{d.stopPropagation()}})}function Tr(n){var r,a;const{states:t}=n;function o(c){return n.hardware.actions.setProperty("velocity",c)}function s(c){return n.hardware.actions.setProperty("acceleration",c)}return e.jsx(i.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"popid",children:[e.jsxs(i.Popover.Header,{children:[n.hardware.name," details"]}),e.jsxs(i.Popover.Body,{children:[e.jsxs(i.Form.Group,{children:[e.jsx(i.Form.Label,{children:"Velocity"}),e.jsx(ne,{hardwareValue:((r=n.hardware.properties)==null?void 0:r.velocity)??0,onMoveRequested:o,hardwareIsDisabled:n.disabled,hardwareIsReady:t.READY,hardwareIsMoving:t.MOVING,readOnly:n.readOnly})]}),e.jsxs(i.Form.Group,{children:[e.jsx(i.Form.Label,{children:"Acceleration"}),e.jsx(ne,{hardwareValue:((a=n.hardware.properties)==null?void 0:a.acceleration)??0,onMoveRequested:s,hardwareIsDisabled:n.disabled,hardwareIsReady:t.READY,hardwareIsMoving:t.MOVING,readOnly:n.readOnly})]})]})]}),children:e.jsx(i.Button,{children:e.jsx("i",{className:"fa fa-ellipsis-h"})})})}function Q(n){const{hardware:t,options:o={}}=n,{properties:s,user_tags:r}=t;function a(){t.actions.call("stop")}function c(p){return t.actions.call("move",p)}const l=Ce(s.state,r),f=e.jsx(y,{name:"Motor",icon:"fam-hardware-motor",online:t.online}),u=e.jsx(ge,{hardware:t}),d=n.options?n.options.header:"top";return e.jsx(v,{hardware:t,widgetIcon:f,widgetState:u,widgetContent:e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(he,{id:t.id,hardwareValue:(s==null?void 0:s.position)??null,hardwareIsDisabled:n.disabled,hardwareIsReady:l.READY??!1,hardwareIsMoving:l.MOVING??!1,onMoveRequested:c,onAbortRequested:a,precision:o.precision??s.display_digits??void 0,readOnly:o.readOnly,stepOnly:o.stepOnly,step:o.step,steps:o.steps,incIcon:o.incicon,decIcon:o.decicon,swapIncDec:o.swapincdec,horizontalArrows:o.horizontalarrows,largeArrows:o.largearrows}),s.unit&&e.jsx(i.InputGroup.Text,{children:s.unit}),!l.MOVING&&o.extended&&e.jsx(Tr,{hardware:t,disabled:n.disabled,readOnly:o.readOnly,states:l}),l.MOVING&&!n.disabled&&!o.step&&e.jsx(i.Button,{variant:"danger",onClick:a,children:e.jsx("i",{className:"fa fa-times"})})]}),headerMode:d})}function Ee(n){const{hardware:t,options:o={}}=n,s=Ce(t.properties.state,t.user_tags);function r(a){if(a===null)return"∅";const c=o.precision??t.properties.display_digits??void 0;return c!==void 0?a.toFixed(c):`${a}`}return e.jsxs(i.Stack,{className:"bg-light rounded-2 ps-2 p-1",direction:"horizontal",children:[e.jsx("div",{className:k.default({"hw-moving":s.MOVING}),children:r(t.properties.position)}),t.properties.unit&&e.jsx("div",{className:"ms-auto",children:e.jsx("small",{children:e.jsx("small",{children:t.properties.unit})})})]})}function dt(n){const{hardware:t}=n,o=e.jsx(y,{name:"Motor",icon:"fam-hardware-motor",online:t.online}),s=e.jsx(ge,{hardware:t}),r=n.options?n.options.header:"top";return r==="none"?e.jsx(Ee,{...n}):e.jsx(v,{hardware:t,widgetIcon:o,widgetState:s,widgetContent:e.jsx(Ee,{...n}),headerMode:r})}function Ce(n,t=[]){return h.useMemo(()=>{const o=t.includes("auto_ready"),s=t.includes("auto_on");if(n===void 0)return{UNKNOWN:!0};if((n==null?void 0:n.length)===0)return o?{READY:!0}:{NOT_READY:!0};const r=n.reduce((a,c)=>(a[c]=!0,a),{});return r.READY===void 0&&s&&r.OFF&&(r.READY=!0),r},[n,t])}function ut(n){return n.type==="motor"}function E(n){const t=P(n);return t===null||!ut(t)?null:t}const Fr={default:Q,text:dt,state:Mr},Dr=Fr,Ar=["move","stop","wait","rmove"],Rr="omega",Er="omega 123",kr=!0,Pr={offset:0,sign:1,acceleration:300,limits:[-999999999,999999999],position:235.165400001,state:["READY"],tolerance:1e-4,unit:"um",velocity:1e3,display_digits:4},Gr="bliss",Br=!1,Vr="motor",Lr=[],Ur={callables:Ar,id:Rr,name:Er,online:kr,properties:Pr,protocol:Gr,require_staff:Br,type:Vr,user_tags:Lr},Hr=["move","stop","wait","rmove"],qr="omega",zr="omega 123",Wr=!0,Yr={offset:0,sign:1,acceleration:300,limits:[-10,190],position:100,state:["READY"],tolerance:1e-4,unit:"um",velocity:1e3},Kr="bliss",Qr=!1,Xr="motor",Jr=[],Zr={callables:Hr,id:qr,name:zr,online:Wr,properties:Yr,protocol:Kr,require_staff:Qr,type:Xr,user_tags:Jr},ei=["move","wait","stop","rmove"],ti="omega",ni="omega 123",oi=!0,si={acceleration:null,limits:[null,null],offset:null,position:235.1654,sign:null,state:["UNKNOWN"],target:null,tolerance:1e-4,unit:"deg",velocity:null},ri="bliss",ii=!1,ai="motor",ci=[],li={callables:ei,id:ti,name:ni,online:oi,properties:si,protocol:ri,require_staff:ii,type:ai,user_tags:ci},di=["move","wait","stop","rmove"],ui="omega",fi="omega 123",pi=!0,mi={acceleration:null,limits:[null,null],offset:null,position:235.1654,sign:null,state:[],target:null,tolerance:1e-4,unit:"deg",velocity:null},hi="bliss",xi=!1,gi="motor",ji=[],wi={callables:di,id:ui,name:fi,online:pi,properties:mi,protocol:hi,require_staff:xi,type:gi,user_tags:ji},yi=["move","wait","stop","rmove"],vi="omega",Ni="omega 123",bi=!1,_i={},$i="bliss",Si=!1,Ci="motor",Oi=[],Ii={callables:yi,id:vi,name:Ni,online:bi,properties:_i,protocol:$i,require_staff:Si,type:Ci,user_tags:Oi},Mi=["move","wait","stop","rmove"],Ti="omega",Fi="omega 123",Di=!0,Ai={acceleration:null,limits:[null,null],offset:null,position:235.1654,sign:null,state:["OFF"],target:null,tolerance:1e-4,unit:"deg",velocity:null},Ri="bliss",Ei=!1,ki="motor",Pi=[],Gi={callables:Mi,id:Ti,name:Fi,online:Di,properties:Ai,protocol:Ri,require_staff:Ei,type:ki,user_tags:Pi},Bi={default:Ur,halfMotor:Zr,unknownMotor:li,notReadyMotor:wi,disconnectedMotor:Ii,powerOffMotor:Gi};function Vi(n,t){return{id:n,name:n,type:"motor",properties:{position:t,unit:"mm",limits:[-100,100]},online:!0}}function Li(n){const{name:t="omega",minLimit:o=-999999999,maxLimit:s=999999999,initialPosition:r=0,initialVelocity:a=1e3,useHardwareContext:c=()=>null}=n,[l,f]=h.useState(r),[u,d]=h.useState(["READY"]),[p,m]=h.useState(null),g=h.useRef(Date.now()),w=c(),x=()=>{const _=Date.now(),S=(_-g.current)/1e3;let C;if(g.current=_,p!==null&&p!==l){let G,B;const $=S*a;if($>Math.abs(l-p))C=p,G=["READY"],B=null;else{const q=p>l?1:-1;C=l+q*$,G=["MOVING"],B=p}f(C),d(G),m(B)}},j=h.useCallback((_,S)=>{if(_==="stop")return m(null),d(["READY"]),Promise.resolve();if(_==="move"){const C=Number.parseFloat(S);return m(Number.isNaN(C)?null:C),Promise.resolve()}return console.log("MotorSimulator: Unsupported call",_,S),Promise.resolve()},[]),N=h.useCallback((_,S)=>(console.log("MotorSimulator: Unsupported setProperty",_,S),Promise.resolve()),[]);h.useEffect(()=>{const _=setInterval(()=>{x()},500);return()=>clearInterval(_)});const M=h.useMemo(()=>{var S,C;const _={setProperty:N,call:j};return(C=w==null?void 0:(S=w.actions).updateHardwareChangeActions)==null||C.call(S,t,_),_},[]),T={id:t,name:t,alias:null,online:!0,properties:{acceleration:300,limits:[o,s],position:l,offset:0,sign:1,state:u,tolerance:1e-4,unit:"mm",velocity:a,target:p,display_digits:3},type:"motor",actions:M,user_tags:[],locked:null},b=h.useRef(null);return h.useEffect(()=>{b.current!==null&&D.isEqual(b.current,T)||(b.current=T,w==null||w.actions.updateHardware(t,T))},[t,T]),e.jsx(e.Fragment,{})}function ft(n){const{hardware:t,options:o={}}=n,s=h.useRef(null);h.useEffect(()=>{if(!s.current){console.error("selectionRef ref is unset");return}s.current.value=t.properties.position},[t.properties.position]);function r(l){if(console.debug("change",l),!s||!s.current){console.error("selection ref is unset");return}t.actions.call("move",s.current.value)}function a(l){t.actions.call("stop")}const c=D.map(t.properties.positions,l=>e.jsx("option",{title:l.description,children:l.position},l.position));return e.jsxs("div",{className:"hw-component",children:[e.jsxs("div",{className:"hw-head",children:[e.jsx(y,{name:"Multiposition",icon:"fam-hardware-multiposition",online:t.online}),e.jsx("div",{className:"name",children:t.name}),e.jsx(i.Badge,{bg:t.properties.state==="READY"?"success":"warning",children:t.properties.state})]}),e.jsx("div",{className:"hw-content",children:e.jsxs(i.InputGroup,{children:[e.jsxs(i.Form.Control,{className:"custom-select",as:"select",ref:s,disabled:n.disabled,defaultValue:t.properties.position,children:[e.jsx("option",{disabled:!0,children:"unknown"}),c]}),t.properties.state!=="MOVING"&&e.jsx(i.Button,{onClick:r,disabled:n.disabled,children:"Move"}),t.properties.state==="MOVING"&&!n.disabled&&e.jsx(i.Button,{variant:"danger",onClick:a,children:e.jsx("i",{className:"fa fa-times"})})]})})]})}function Ui(n){const{hardware:t}=n,{properties:o}=t,s=o.state==="READY",r=n.disabled||!t.online||!s,a=o.position;function c(f){t.actions.call("move",f)}function l(f){const u=f.position,p=u===a?"fa fa-fw fa-dot-circle-o":"fa fa-fw fa-circle-o";return e.jsxs(i.Dropdown.Item,{disabled:r,onClick:()=>{c(u)},title:f.description,children:[e.jsx("i",{className:p}),"  ",u]},u)}return e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{disabled:r,variant:"secondary"}),e.jsx(i.Dropdown.Menu,{align:"end",popperConfig:{strategy:"fixed"},children:o.positions.map(f=>l(f))})]})}function Hi(n){var p,m;const{hardware:t,options:o={}}=n,s=((p=t.properties)==null?void 0:p.state)==="MOVING";function r(g){t.actions.call("stop")}const a=e.jsx(y,{name:"Multiposition",icon:"fam-hardware-multiposition",online:t.online}),c=e.jsx(Ge,{hardware:t}),l=s?"Moving":null,f=(m=t.properties)==null?void 0:m.position;function u(){return e.jsxs(i.InputGroup,{children:[e.jsx(R,{className:k.default({"hw-moving":s}),value:l??f??"Unknown"}),!s&&!n.disabled&&e.jsx(Ui,{...n}),s&&!n.disabled&&e.jsx(i.Button,{variant:"danger",onClick:r,children:e.jsx("i",{className:"fa fa-fw fa-times"})})]})}const d=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:a,widgetState:c,widgetContent:u(),headerMode:d})}const qi={default:ft,default2:Hi},zi=qi,Wi=["move","stop"],Yi="beamstop",Ki="beamstop",Qi=!0,Xi={position:"OUT",positions:[{description:"Beamstop position IN the beam",position:"IN",target:[{destination:2.5,tolerance:.01},{destination:1,tolerance:.2}]},{description:"Beamstop position OUT of the beam",position:"OUT",target:[{destination:3.5,tolerance:.01},{destination:2,tolerance:.2}]}],state:"READY"},Ji="bliss",Zi=!1,ea="multiposition",ta={callables:Wi,id:Yi,name:Ki,online:Qi,properties:Xi,protocol:Ji,require_staff:Zi,type:ea},na={default:ta};function oa(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=h.useState("empty"),[c,l]=h.useState("READY");async function f(p,m){if(p==="move"){l("MOVING"),a("unknown"),await A(2e3),l("READY"),a(m);return}if(p==="stop"){a("unknown"),await A(2e3);return}console.log("MultipositionSimulator: Unsupported call",p,m)}async function u(p,m){console.log("MultipositionSimulator: Unsupported setProperty",p,m)}const d={position:r,state:c,positions:[{position:"empty",description:"No filter",target:[]},{position:"gold2",description:"Gold filter 2mm",target:[]},{position:"silver3",description:"Silver filter 3mm",target:[]}]};return e.jsx(U,{name:t,alias:o,type:"multiposition",call:f,setProperty:u,properties:d,useHardwareContext:s})}function Oe(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={READY:"success",MOVING:"warning",INVALID:"danger",UNKNOWN:"danger",DISABLED:"secondary",OFFLINE:"warning"},r=s[o]||s.UNKNOWN;return e.jsx(F,{state:o,minWidth:6,variant:r})}function sa(n){const{hardware:t}=n;return e.jsx(Oe,{hardware:t})}function ra(n){const{hardware:t,options:o={}}=n,{properties:s}=t,{state:r}=s,a=r==="MOVING",c=r==="READY",l=a?s.target_magnification||0:s.magnification||0,u=[...s.available_magnifications??[]];u.sort((w,x)=>w>x?1:x>w?-1:0);const d=n.disabled||!t.online||!c,p=o.digits||2;function m(w){t.actions?t.actions.call("move",w):console.error("Change request was triggered with:",w)}function g(w,x){const N=l===x?"fa fa-fw fa-dot-circle-o":"fa fa-fw fa-circle-o";return e.jsxs(i.Dropdown.Item,{disabled:d,onClick:()=>{m(x)},children:[e.jsx("i",{className:N}),"  × ",x]},`id${w}`)}return e.jsxs(e.Fragment,{children:[e.jsx(R,{value:l.toFixed(p),className:k.default({"hw-moving":a})}),e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{disabled:!c,variant:"secondary"}),e.jsx(i.Dropdown.Menu,{popperConfig:{strategy:"fixed"},children:u.map((w,x)=>g(x,w))})]})]})}function ia(n){const{hardware:t,options:o={}}=n,s=t.properties.magnification||0,r=o.digits||2,a=!!o.allowtuning;return e.jsxs(e.Fragment,{children:[e.jsx(R,{value:s.toFixed(r)}),a&&e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{variant:"secondary"}),e.jsx(i.Dropdown.Menu,{popperConfig:{strategy:"fixed"},children:e.jsxs(i.InputGroup,{children:[e.jsx(i.InputGroup.Text,{children:"×"}),e.jsx(pt,{...n})]})})]})]})}function pt(n){const{hardware:t,options:o={}}=n,s=t.properties.magnification||0,{state:r}=t.properties,a=r==="READY",c=n.disabled||!t.online||!a,[l,f]=t.properties.magnification_range||[null,null],u=h.useRef(null),d=h.useRef(null),[p,m]=h.useState(!1),g=o.digits||2;function w(b){t.actions?n.mode==="move"?t.actions.call("move",b):t.actions.setProperty("magnification",b):console.error("Change request was triggered with:",b)}function x(b){if(!u||!u.current){console.log("formRef not yet defined");return}if(b.key==="Enter"){m(!1);const{value:_}=u.current,S=Number.parseFloat(_);if(l!==null&&S<l||f!==null&&S>f)return;w(S)}else b.key==="Escape"?(u.current.value=s.toFixed(g),d.current&&(d.current.value=s.toString()),m(!1)):console.log(b.key)}function j(b){b!==s&&!p&&m(!0),b===s&&p&&m(!1)}function N(b){if(!u||!u.current){console.error("formRef is not set");return}const _=Number.parseFloat(u.current.value);j(_),d.current&&(d.current.value=_.toString())}function M(b){if(!u||!u.current){console.error("formRef is not set");return}if(!d||!d.current){console.error("rangeRef is not set");return}const _=Number.parseFloat(d.current.value);j(_),u.current.value=_.toFixed(g)}function T(){if(!d||!d.current){console.error("rangeRef is not set");return}const b=Number.parseFloat(d.current.value);w(b)}return h.useEffect(()=>{if(!u||!u.current){console.error("formRef is not set");return}p||(u.current.value=s.toFixed(g)),d.current&&(d.current.value=s.toString())},[g,p,s]),e.jsxs(e.Fragment,{children:[e.jsx(i.Form.Control,{className:p?"form-control-edited":"",type:"number",ref:u,defaultValue:s.toFixed(g),onChange:N,disabled:c,step:10**-g,onKeyDown:x}),l!==null&&f!==null&&e.jsx(i.Form.Control,{ref:d,disabled:c,type:"range",min:l,max:f,step:10**-g,onChange:M,onMouseUp:T,defaultValue:s})]})}function aa(n){const{hardware:t,options:o={}}=n,{properties:s}=t,r=s.state==="MOVING",a=s.state==="READY",c=r?s.target_magnification||0:s.magnification||0,l=n.options.digits||2;return e.jsxs(e.Fragment,{children:[e.jsx(R,{value:c.toFixed(l),className:k.default({"hw-moving":r})}),e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{disabled:!a,variant:"secondary"}),e.jsx(i.Dropdown.Menu,{popperConfig:{strategy:"fixed"},children:e.jsxs(i.InputGroup,{children:[e.jsx(i.InputGroup.Text,{children:"×"}),e.jsx(pt,{...n,mode:"move"})]})})]})]})}function ca(n){return e.jsx(i.Form.Control,{className:"border-light",type:"text",disabled:!0,defaultValue:"Missing"})}function mt(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Optic",icon:"fam-hardware-optic",online:t.online}),r=e.jsx(Oe,{hardware:t});function a(){function l(){return t.online?t.properties.available_magnifications?ra:t.properties.magnification_range?aa:ia:ca}const f=l();return e.jsxs(i.InputGroup,{children:[e.jsx(i.InputGroup.Text,{className:"border-light",children:"×"}),e.jsx(f,{...n})]})}const c=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a(),headerMode:c})}function la(n){return n.type==="optic"}const da={default:mt,state:sa},ua=da,fa=["magnification","reset","open"],pa="optic",ma="optic",ha=!0,xa={state:"READY",magnification:10,target_magnification:null,available_magnifications:[5,7.5,10],magnification_range:null},ga="bliss",ja=!1,wa="optic",le={callables:fa,id:pa,name:ma,online:ha,properties:xa,protocol:ga,require_staff:ja,type:wa},ya={default:le,fixed:le,off:le,range:le};function va(n){const{name:t,alias:o,kind:s,useHardwareContext:r}=n;function a(){return s==="fixed"?{available_magnifications:null,magnification_range:null}:s==="range"?{available_magnifications:null,magnification_range:[5,10]}:s==="multi"?{available_magnifications:[5,7.5,10],magnification_range:null}:{available_magnifications:null,magnification_range:null}}const[c,l]=h.useState({state:"READY",magnification:10,target_magnification:null,...a()});async function f(p){let m=c.magnification;l(x=>({...x,state:"MOVING",target_magnification:p})),await A(100);const g=.2*(m<p?1:-1);function w(x){l(j=>({...j,magnification:x}))}for(;Math.abs(p-m)>=Math.abs(g)*1.01;)m+=g,w(m),await A(100);l(x=>({...x,state:"READY",magnification:p,target_magnification:null}))}async function u(p,m){if(p==="move"){await f(m);return}console.log("OpticSimulator: Unsupported call",p,m)}async function d(p,m){if(p==="magnification"){l(g=>({...g,magnifications:m}));return}console.log("OpticSimulator: Unsupported setProperty",p,m)}return e.jsx(U,{name:t,alias:o,type:"optic",call:u,setProperty:d,properties:c,useHardwareContext:r})}function ie(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={STANDBY:"success",DISABLED:"secondary",OFFLINE:"secondary",RUNNING:"warning",ABORTING:"warning",AWAITING_USER_INPUT:"warning",UNKNOWN:"fatal"},r=s[o]||s.UNKNOWN;return e.jsx(F,{state:o,minWidth:6,variant:r})}function Na(n){const{hardware:t}=n;return e.jsx(ie,{hardware:t})}function ba(n){const{hardware:t}=n,o=n.disabled||!t.online,s=t.properties.state==="AWAITING_USER_INPUT",r=t.properties.state==="ABORTING",a=t.properties.state==="RUNNING"||s||r;function c(f){t.actions.call("start")}function l(f){t.actions.call("abort")}return e.jsxs(i.ButtonGroup,{size:"lg",className:"w-100",children:[e.jsx(i.Button,{onClick:c,disabled:o||a,variant:"primary",children:"Start"}),e.jsx(i.Button,{onClick:l,disabled:o||!a,variant:"primary",children:"Abort"})]})}function _e(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Procedure",icon:"fa-cog",online:t.online}),r=e.jsx(ie,{hardware:t}),a=e.jsx(i.Container,{children:e.jsx(ba,{hardware:t,disabled:!n.operator})}),c=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function _a(n){const{hardware:t}=n,o=t.properties.state==="AWAITING_USER_INPUT",s=t.properties.state==="ABORTING",r=t.properties.state==="RUNNING";return s?e.jsxs(i.Badge,{bg:"warning",children:[e.jsx("i",{className:"fa-solid fa-heart-crack fa-beat"})," ABORTING"]}):r?e.jsxs(i.Badge,{bg:"info",children:[e.jsx("i",{className:"fa-solid fa-heart fa-beat"})," RUNNING"]}):o?e.jsxs(i.Badge,{bg:"warning",title:"A user input is expected",children:[e.jsx("i",{className:"fa-solid fa-user fa-beat"})," AWAITING INPUT"]}):e.jsx($a,{hardware:t})}function $a(n){const{hardware:t}=n,{previous_run_state:o,previous_run_exception:s}=t.properties,r={NONE:["secondary",null],ABORTED:["warning","fa-heart-crack"],FAILED:["danger",null],SUCCESSED:["success",null],UNKNOWN:["danger",null]},a=r[o]||r.UNKNOWN,[c,l]=a;return e.jsxs(i.Badge,{bg:c,title:s??void 0,children:[l&&e.jsxs(e.Fragment,{children:[e.jsx("i",{className:`fa-solid ${l}`})," "]}),o]})}function ht(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Procedure",icon:"fa-cog",online:t.online}),r=e.jsx(ie,{hardware:t}),a=e.jsx(i.Container,{children:e.jsx("div",{children:e.jsx("h3",{children:e.jsx(_a,{hardware:t})})})}),c=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Sa(n){const{hardware:t}=n,o=n.disabled||!t.online,s=t.properties.state==="AWAITING_USER_INPUT";function r(a){t.actions.call("validate")}return e.jsx(i.ButtonGroup,{size:"lg",className:"w-100",children:e.jsx(i.Button,{onClick:r,disabled:o||!s,variant:"primary",children:"Validate"})})}function xt(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Procedure",icon:"fa-cog",online:t.online}),r=e.jsx(ie,{hardware:t}),a=e.jsx(i.Container,{children:e.jsx(Sa,{hardware:t,disabled:!n.operator})}),c=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const Ca={default:_e,manage:_e,execution:ht,validate:xt,state:Na},Oa=Ca,Ia=["start","abort","clear","validate"],Ma="procedure",Ta="procedure",Fa="procedure",Da="bliss",Aa=!1,Ra=!0,Ea={state:"STANDBY",previous_run_state:"NONE",previous_run_exception:null,parameters:{my_number:10,my_string:"foo",my_null:null,my_boolean:!0,my_dict:{a:10,b:"10",c:!0},my_list:[10,"10",!0],"my_scan_1.11":{__type__:"scan",node:"demo_session:tmp:scans:inhouse:id002405:sample:sample_0002:_1_flat images 1",mmh3:3852826388},"my_scan_2.0":{__type__:"scan",key:"esrf:scan:01J1QDB370S2V8WF7FX2Y9H29V",mmh3:3852826389},my_quantity:{__type__:"quantity",scalar:20,unit:"mm"},my_nan:{__type__:"nan"},my_posinf:{__type__:"posinf"},my_neginf:{__type__:"neginf"},my_obj:{__type__:"hardware",name:"roby"}}},ka={callables:Ia,type:Ma,id:Ta,name:Fa,protocol:Da,require_staff:Aa,online:Ra,properties:Ea},Pa={standby:ka};function je(n){const{hardware:t}=n;function o(){if(!t.online)return"OFFLINE";const a=t.properties.state;return n.useReadyState&&(a==="OPEN"||a==="CLOSED")?"READY":a}const s=o();function r(){switch(s){case"READY":return"success";case"OPEN":return"success";case"CLOSED":return"danger";case"DISABLED":return"secondary";case"MOVING":case"STANDBY":case"OFFLINE":return"warning";case"FAULT":return"fatal";default:return"fatal"}}return e.jsx(F,{state:s,minWidth:6,variant:r()})}function Ga(n){const{hardware:t}=n;return e.jsx(je,{hardware:t,useReadyState:!0})}function Ba(n){const{hardware:t}=n;function o(){t.actions.call("reset")}return e.jsx(i.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"popid",children:[e.jsxs(i.Popover.Header,{children:[t.name," Details"]}),e.jsxs(i.Popover.Body,{children:[e.jsx("h6",{children:"Status"}),e.jsx("pre",{children:t.properties.status}),e.jsx("div",{className:"d-grid gap-2",children:e.jsx(i.Button,{onClick:o,disabled:n.disabled,children:"Reset"})})]})]}),children:e.jsx(i.Button,{className:"flex-grow-0",title:"Shutter Details",children:e.jsx("i",{className:"fa fa-ellipsis-h"})})})}function gt(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Shutter",icon:"fam-hardware-shutter",online:t.online}),r=e.jsx(je,{hardware:t});function a(){return t.properties?t.properties.state:"UNKNOWN"}function c(x){return x==="OPEN"?["Close","close"]:x==="CLOSED"?["Open","open"]:x==="DISABLED"||x==="STANDBY"||x==="FAULT"?["Closed",""]:x==="MOVING"?["...",""]:["Unknown",""]}const l=a(),[f,u]=c(l),p={OPEN:"danger",CLOSED:"success",MOVING:"warning",DISABLED:"secondary",STANDBY:"danger",FAULT:"fatal",UNKNOWN:"warning"}[l]||"danger";function m(){t.actions.call(u)}const g=e.jsxs(i.ButtonGroup,{className:"d-flex flex-nowrap",children:[e.jsx(i.Button,{variant:p,onClick:m,disabled:n.disabled||u==="",children:f}),o.extended&&e.jsx(Ba,{...n})]}),w=n.options.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:g,headerMode:w})}function Va(n){var f;const{hardware:t,options:o={}}=n;function s(){t.actions.call("open")}function r(){t.actions.call("close")}const a=((f=t.properties)==null?void 0:f.state)??"UNKNOWN",c=a==="MOVING",l=a==="DISABLED"||c;return e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{variant:"secondary",disabled:n.disabled||l}),e.jsx(i.Dropdown.Menu,{popperConfig:{strategy:"fixed"},children:e.jsxs(i.Container,{children:[e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center",children:"Actions"})}),e.jsx(i.Row,{children:e.jsx(i.Col,{children:e.jsxs(i.ButtonGroup,{children:[e.jsx(i.Button,{variant:c?"warning":"secondary",onClick:()=>{s()},disabled:n.disabled||l,title:"Open the shutter",children:"Open"}),e.jsx(i.Button,{variant:c?"warning":"secondary",onClick:()=>{r()},disabled:n.disabled||l,title:"Close the shutter",children:"Close"})]})})})]})})]})}function jt(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Shutter",icon:"fam-hardware-shutter",online:t.online}),r=e.jsx(je,{hardware:t,useReadyState:!0});function a(){return t.properties?t.properties.state:"UNKNOWN"}function c(x){return x==="OPEN"||x==="CLOSED"?x:x==="DISABLED"||x==="STANDBY"||x==="FAULT"?"CLOSED":x==="MOVING"?"...":"UNKNOWN"}function l(x){return x.charAt(0).toUpperCase()+x.slice(1).toLowerCase()}const f=a(),u=c(f),p={OPEN:"success",CLOSED:"danger",MOVING:"warning",DISABLED:"secondary",STANDBY:"success",FAULT:"fatal",UNKNOWN:"fatal"}[f],m=l(u),g=e.jsxs(i.InputGroup,{className:"d-flex flex-nowrap",children:[e.jsx(R,{variant:p,className:"text-center",style:{minWidth:"10em"},value:m}),e.jsx(Va,{...n})]}),w=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:g,headerMode:w})}const La={default:gt,protected:jt,state:Ga},Ua=La,Ha=["reset","open","close","toggle"],qa="abs1",za="abs1",Wa=!0,Ya={closed_text:"",open_text:"",state:"OPEN",status:`Pneumatic Beam Shutter is open
29
- `,valid:!0},Ka="tango",Qa=!0,Xa="shutter",Ja={callables:Ha,id:qa,name:za,online:Wa,properties:Ya,protocol:Ka,require_staff:Qa,type:Xa},Za={default:Ja};function ec(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=h.useState("OPEN");async function c(u,d){if(u==="open"){a("MOVING"),await A(2e3),a("OPEN");return}if(u==="close"){a("MOVING"),await A(2e3),a("CLOSED");return}console.log("ShutterSimulator: Unsupported call",u,d)}async function l(u,d){console.log("ShutterSimulator: Unsupported setProperty",u,d)}const f={state:r,closed_text:"",open_text:"",status:`Shutter is ${r}`,valid:!0};return e.jsx(U,{name:t,alias:o,type:"shutter",call:c,setProperty:l,properties:f,useHardwareContext:s})}function tc(n){const{properties:t}=n,o=t.vgap.slice(9),s=E(o),r=t.hgap.slice(9),a=E(r),c=t.voffset.slice(9),l=E(c),f=t.hoffset.slice(9),u=E(f);return h.useMemo(()=>{var d,p,m,g;return{vgap:((d=s==null?void 0:s.properties)==null?void 0:d.state)??null,hgap:((p=a==null?void 0:a.properties)==null?void 0:p.state)??null,voffset:((m=l==null?void 0:l.properties)==null?void 0:m.state)??null,hoffset:((g=u==null?void 0:u.properties)==null?void 0:g.state)??null}},[s,a,l,u])}function Ie(n){const{hardware:t}=n,o=tc(t),[s,r,a]=h.useMemo(()=>{if(o.vgap===null&&o.hgap===null&&o.voffset===null&&o.hoffset===null)return["OFFLINE","secondary","No motor online"];const c=new Set([...o.vgap??[],...o.hgap??[],...o.voffset??[],...o.hoffset??[]]);return c.has("MOVING")?["MOVING","warning","A motor is moving"]:c.has("OFF")?["OFF","secondary","A motor is off"]:["READY","success","The slit is ready"]},[o]);return e.jsx(F,{state:s,description:a,variant:r,minWidth:6})}function nc(n){const{hardware:t}=n;return e.jsx(Ie,{hardware:t})}function oc(n){const{properties:t}=n,o=t.vgap.slice(9),s=E(o),r=ee(o),a=t.hgap.slice(9),c=E(a),l=ee(a),f=t.voffset.slice(9),u=E(f),d=ee(f),p=t.hoffset.slice(9),m=E(p),g=ee(p);function w(x,j){return x===null?null:{...x,actions:j}}return{vgap:w(s,r),hgap:w(c,l),voffset:w(u,d),hoffset:w(m,g)}}function sc(n){const{hardware:t,schema:o,operator:s,disabled:r,resolved:a}=n;return e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{variant:"secondary"}),e.jsx(i.Dropdown.Menu,{align:"end",popperConfig:{strategy:"fixed"},children:e.jsxs(i.Container,{children:[e.jsxs(i.Row,{className:"flex-nowrap",children:[e.jsx(i.Col,{sm:1,className:"d-flex",children:e.jsx("i",{className:"fa fa-fw fa-square",title:"Gap",style:{alignSelf:"center"}})}),e.jsx(i.Col,{sm:5,children:a.hgap&&e.jsx(Q,{hardware:a.hgap,options:{header:"none"},schema:o,disabled:r,operator:s})}),e.jsx(i.Col,{sm:1,className:"d-flex",children:e.jsx("span",{style:{alignSelf:"center"},children:"×"})}),e.jsx(i.Col,{sm:5,children:a.vgap&&e.jsx(Q,{hardware:a.vgap,options:{header:"none"},schema:o,disabled:r,operator:s})})]}),e.jsxs(i.Row,{className:"flex-nowrap",children:[e.jsx(i.Col,{sm:1,className:"d-flex",children:e.jsx("i",{className:"fa fa-fw fa-arrows-up-down-left-right ",title:"Offset",style:{alignSelf:"center"}})}),e.jsx(i.Col,{sm:5,children:a.hoffset&&e.jsx(Q,{hardware:a.hoffset,options:{header:"none"},schema:o,disabled:r,operator:s})}),e.jsx(i.Col,{sm:1,className:"d-flex",children:e.jsx("span",{style:{alignSelf:"center"},children:";"})}),e.jsx(i.Col,{sm:5,children:a.voffset&&e.jsx(Q,{hardware:a.voffset,options:{header:"none"},schema:o,disabled:r,operator:s})})]})]})})]})}function rc(n){const{hardware:t,options:o={}}=n,s=oc(t),{readonly:r=!1}=o;function a(m){var x,j;const g=((x=m==null?void 0:m.properties)==null?void 0:x.position)??null;if(g===null)return"∅";const w=o.precision??((j=m==null?void 0:m.properties)==null?void 0:j.display_digits)??void 0;return w!==void 0?g.toFixed(w):`${g}`}const[c,l,f,u,d,p]=h.useMemo(()=>{var b,_,S,C,G,B,$,q;const m=`${a(s.hgap)} × ${a(s.vgap)}`,g=((b=s.hgap)==null?void 0:b.properties.unit)??((_=s.vgap)==null?void 0:_.properties.unit)??"?",x=new Set([...((S=s.hgap)==null?void 0:S.properties.state)??[],...((C=s.vgap)==null?void 0:C.properties.state)??[]]).has("MOVING"),j=`${a(s.hoffset)} ; ${a(s.voffset)}`,N=((G=s.hoffset)==null?void 0:G.properties.unit)??((B=s.voffset)==null?void 0:B.properties.unit)??"?",T=new Set([...(($=s.hoffset)==null?void 0:$.properties.state)??[],...((q=s.voffset)==null?void 0:q.properties.state)??[]]).has("MOVING");return[m,g,x,j,N,T]},[s.hgap,s.hoffset,s.vgap,s.voffset]);return e.jsxs(i.InputGroup,{className:"w-100 flex-nowrap",children:[e.jsx(i.InputGroup.Text,{title:"Gap (horizontal and vertical)",children:e.jsx("i",{className:"fa fa-fw fa-square fa-2x"})}),e.jsx(R,{value:c,title:"Gap",className:k.default({"hw-moving":f})}),e.jsx(i.InputGroup.Text,{children:l}),e.jsx(i.InputGroup.Text,{title:"Offset (horizontal and vertical)",children:e.jsx("i",{className:"fa fa-fw fa-arrows-up-down-left-right fa-2x"})}),e.jsx(R,{value:u,title:"Offset",className:k.default({"hw-moving":p})}),e.jsx(i.InputGroup.Text,{children:d}),!r&&e.jsx(sc,{...n,resolved:s})]})}function wt(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Slit",icon:"fam-hardware-motor",online:t.online}),r=e.jsx(Ie,{hardware:t}),a=e.jsx(rc,{...n}),c=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const ic={default:wt,state:nc},ac=ic,cc="s1",lc="s1",dc=!0,uc={vgap:"hardware:s1vg",voffset:"hardware:s1vo",hgap:"hardware:s1hg",hoffset:"hardware:s1ho"},fc="slit",pc={id:cc,name:lc,online:dc,properties:uc,type:fc},mc="s1",hc="s1",xc=!0,gc={vgap:"hardware:",voffset:"hardware:",hgap:"hardware:s1hg",hoffset:"hardware:s1ho"},jc="slit",wc={id:mc,name:hc,online:xc,properties:gc,type:jc},yc="s1",vc="s1",Nc=!0,bc={vgap:"hardware:s1vg",voffset:"hardware:s1vo",hgap:"hardware:",hoffset:"hardware:"},_c="slit",$c={id:yc,name:vc,online:Nc,properties:bc,type:_c},Sc={default:pc,horizontal:wc,vertical:$c};function Cc(n){const{hardware:t}=n,o=()=>{t.actions.call(t.properties.state==="ON"?"off":"on")},s={Voltage:`${t.properties.voltage.toFixed(0)} V`,Current:`${(t.properties.current*1e3).toFixed(2)} mA`};return e.jsx(i.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"popid",children:[e.jsxs(i.Popover.Header,{children:[t.name," Details"]}),e.jsxs(i.Popover.Body,{children:[e.jsx("h6",{children:"Status"}),e.jsx("pre",{children:t.properties.status}),e.jsx("h6",{children:"Properties"}),e.jsx(i.Container,{children:D.map(s,(r,a)=>e.jsxs(i.Row,{children:[e.jsxs(i.Col,{children:[a,":"]}),e.jsx(i.Col,{children:r})]},a))}),e.jsx("div",{className:"d-grid gap-2",children:e.jsx(i.Button,{disabled:n.disabled,onClick:o,variant:t.properties.state==="ON"?"danger":"success",children:t.properties.state==="ON"?"Off":"On"})})]})]}),children:e.jsx(i.Button,{title:"Pump Details",children:e.jsx("i",{className:"fa fa-ellipsis-h"})})})}function yt(n){const{hardware:t,options:o={}}=n;return e.jsxs("div",{className:"hw-component",children:[e.jsxs("div",{className:"hw-head",children:[e.jsx(y,{name:"Pump",icon:"fam-hardware-pump",online:t.online}),e.jsx("div",{className:"name",children:t.name}),e.jsx(i.Badge,{bg:t.properties.state==="ON"?"success":"danger",children:t.properties.state})]}),e.jsx("div",{className:"hw-content",children:e.jsxs(i.InputGroup,{children:[e.jsx(i.Form.Control,{value:t.properties.pressure.toExponential(o.precision||3),disabled:!0}),(t.properties.unit||o.unit)&&e.jsx(i.InputGroup.Text,{children:t.properties.unit||o.unit}),e.jsx(Cc,{...n})]})})]})}const Oc={default:yt},Ic=Oc,Mc=["off","on"],Tc="ip121",Fc="ip121",Dc=!0,Ac={current:.0003000000142492354,pressure:26000000730164174e-23,state:"ON",status:`Pump is ON
28
+ `},$o="tango",So=!0,Co="gauge",Oo={callables:yo,id:vo,name:No,online:bo,properties:_o,protocol:$o,require_staff:So,type:Co},Io={default:wo,default2:Oo},Mo=h.forwardRef((n,t)=>{const o=h.useRef(null),s=h.useRef(),[r,a]=h.useState(n.step),[c,l]=h.useState(!1),f=$=>{const q=t;if(o.current===null)return;let Z=Number.parseFloat(q.current.value);if(o.current.value.startsWith("*")){const ee=Number.parseFloat(o.current.value.replace("*",""));Z=$?Z*ee:Z/ee}else{const ee=Number.parseFloat(o.current.value);Z+=$?ee:-ee}q.current.value=`${Z}`,n.onStep&&n.onStep({target:q.current})},{onStep:u,step:d,overlay:p,incIcon:m,decIcon:g,swapIncDec:w,onKeyDown:x,onBlur:j,horizontalArrows:N,largeArrows:I,disabled:M,stepOnly:b,..._}=n,S=$=>{$.key==="ArrowUp"?($.preventDefault(),l(!0),f(!0)):$.key==="ArrowDown"?($.preventDefault(),l(!0),f(!1)):x&&x($)};c&&(s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{var $;($=t==null?void 0:t.current)==null||$.focus()},100)),h.useEffect(()=>()=>{s.current&&clearTimeout(s.current)},[]);const C=()=>{s.current&&clearTimeout(s.current),l(!1),j&&j()};if(!n.step)return e.jsx(i.Form.Control,{ref:t,type:"number",step:"any",onKeyDown:S,onBlur:C,disabled:M,onClick:$=>{$.stopPropagation()},..._});const G=D.map(n.steps||[n.step],$=>e.jsx("option",{value:$,children:$},$)),B=m||g;return e.jsx("div",{className:P.default("numeric-step",{"numeric-step-large":I,"numeric-step-horizontal":N}),children:e.jsxs(i.InputGroup,{children:[e.jsx(i.Form.Control,{onKeyDown:S,onBlur:C,ref:t,type:"number",step:"any",disabled:M||b,..._}),e.jsxs(e.Fragment,{children:[p,!p&&e.jsxs(i.InputGroup.Text,{className:`d-flex flex-column ${B?"inc-dec":""}`,children:[e.jsx(i.Form.Control,{ref:o,as:"select",className:"step-size",defaultValue:r,disabled:M,onChange:$=>a(Number.parseFloat($.target.value)),children:G}),n.unit&&e.jsx("div",{children:n.unit}),!m&&!g&&e.jsxs(e.Fragment,{children:[e.jsx(i.Button,{className:"step step-up",disabled:n.disabled,onClick:$=>f(!0)}),e.jsx(i.Button,{className:"step step-down",disabled:n.disabled,onClick:$=>f(!1)})]})]}),g&&w&&e.jsx(i.Button,{disabled:n.disabled,onClick:$=>f(!1),children:e.jsx("i",{className:`fa fa-fw fa-${g}`})}),m&&e.jsx(i.Button,{disabled:n.disabled,onClick:$=>f(!0),children:e.jsx("i",{className:`fa fa-fw fa-${m}`})}),g&&!w&&e.jsx(i.Button,{disabled:n.disabled,onClick:$=>f(!1),children:e.jsx("i",{className:`fa fa-fw fa-${g}`})})]})]})})}),Xe=Mo;function xe(n){const t=h.useRef(null),[o,s]=h.useState(!1),[r,a]=h.useState(!1);h.useEffect(()=>{t.current&&(n.hardwareValue===null?t.current.value="":n.precision!==void 0?t.current.value=n.hardwareValue.toFixed(n.precision):t.current.value=n.hardwareValue.toString(),s(!1))},[n.hardwareValue]);function c(p){let m=p;n.precision!==void 0&&(m=Number.parseFloat(m).toFixed(n.precision)),t!=null&&t.current&&(t.current.value=m)}function l(){o&&setTimeout(()=>{c(n.hardwareValue),s(!1)},3e3)}function f(p){n.hardwareValue!==null&&s(p.target.value!==n.hardwareValue.toString())}function u(p){s(!1);const m=n.onMoveRequested(p.target.value);m&&m.catch(()=>{a(!0),setTimeout(()=>{c(n.hardwareValue),a(!1)},2e3)})}function d(p){switch(p.key){case"Enter":{s(!1);const m=Number.parseFloat(p.target.value),g=n.onMoveRequested(m);g&&g.catch(()=>{a(!0),setTimeout(()=>{c(n.hardwareValue),a(!1)},2e3)})}p.preventDefault(),p.stopPropagation();break;case"Esc":case"Escape":o&&(a(!1),s(!1),c(n.hardwareValue)),p.target.blur(),p.preventDefault(),p.stopPropagation();break}}return e.jsx(Xe,{id:n.id,className:P.default({"form-control-edited":o,"form-control-error":r,"hw-moving":n.hardwareIsMoving}),type:n.readOnly?"text":"number",ref:t,precision:n.precision,onChange:f,onBlur:l,onStep:u,onKeyDown:d,disabled:n.hardwareIsDisabled||n.readOnly||!n.hardwareIsReady,stepOnly:n.stepOnly,step:n.step,steps:n.steps,incIcon:n.incIcon,decIcon:n.decIcon,swapIncDec:n.swapIncDec,horizontalArrows:n.horizontalArrows,largeArrows:n.largeArrows,overlay:n.hardwareIsMoving&&!n.hardwareIsDisabled?e.jsx(i.Button,{variant:"danger",onClick:n.onAbortRequested,children:e.jsx("i",{className:"fa fa-times"})}):null})}function Je(n){const{hardware:t,options:o={},disabled:s}=n;function r(u){return t.actions.setProperty("power",u)}function a(u){return t.actions.call(u?"on":"off")}const c=t.properties.state,l=e.jsx(y,{name:"Laser",icon:"fam-hardware-laser",online:t.online}),f=e.jsx(F,{state:c,minWidth:6,variant:c==="ON"?"success":"warning"});return e.jsx(v,{hardware:t,widgetIcon:l,widgetState:f,widgetContent:e.jsxs(i.InputGroup,{children:[e.jsx(xe,{id:t.id,hardwareValue:t.properties.power,hardwareIsDisabled:!1,hardwareIsReady:!0,hardwareIsMoving:c==="MOVING",onMoveRequested:r,onAbortRequested:()=>null,precision:1,readOnly:!1,step:o.step,steps:o.steps,incIcon:void 0,decIcon:void 0,swapIncDec:void 0}),e.jsx(i.Button,{size:"sm",style:{fontSize:"0.6rem",padding:"0.05rem 0.6rem",marginTop:"0.1rem"},onClick:()=>{a(t.properties.state!=="ON")},children:e.jsx("i",{className:t.properties.state==="ON"?"fa fa-toggle-on":"fa fa-toggle-off"})})]})})}const To={default:Je},Fo=To,Do=[],Ao="yag1",Ro="yag1",Eo=!0,ko={power:5,state:"ON"},Po="bliss",Go=!1,Bo="laser",Vo={callables:Do,id:Ao,name:Ro,online:Eo,properties:ko,protocol:Po,require_staff:Go,type:Bo},Lo={default:Vo};function Uo(n){var o;const{hardware:t}=n;return e.jsx(i.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"laserheating_overlay",children:[e.jsxs(i.Popover.Header,{children:[t.name," details"]}),e.jsx(i.Popover.Body,{children:e.jsxs(i.Container,{children:[e.jsxs(i.Row,{children:[e.jsx(i.Col,{children:"Background Mode"}),e.jsx(i.Col,{children:t.properties.background_mode})]}),e.jsxs(i.Row,{children:[e.jsx(i.Col,{children:"Calibration"}),e.jsx(i.Col,{children:t.properties.current_calibration})]}),e.jsxs(i.Row,{children:[e.jsx(i.Col,{children:"Fit Wavelength"}),e.jsxs(i.Col,{children:[(o=t.properties.fit_wavelength)==null?void 0:o.join(" - ")," ",e.jsx("span",{children:"nm"})]})]})]})})]}),children:e.jsx(i.Button,{children:e.jsx("i",{className:"fa fa-ellipsis-h"})})})}function Ze(n){const{hardware:t,options:o={},disabled:s}=n,[r,a]=h.useState(!1);function c(p){return p<=0?Promise.reject(new Error("exposure_time must be > 0")):t.actions.setProperty("exposure_time",p)}function l(){a(!0);const p=t.actions.call("measure");return p!==void 0&&(console.log("pending"),p.then(()=>{a(!1)}).catch(m=>{a(!1)})),p}const f=t.properties.state,u=e.jsx(y,{name:"Laser Heating",icon:"fa-fire",online:t.online}),d=e.jsx(F,{state:f,minWidth:6,variant:f==="READY"?"success":"warning"});return e.jsx(v,{hardware:t,widgetIcon:u,widgetState:d,widgetContent:e.jsxs(i.InputGroup,{children:[e.jsx(xe,{id:t.id,hardwareValue:t.properties.exposure_time,hardwareIsReady:!0,hardwareIsDisabled:n.disabled,hardwareIsMoving:!1,onMoveRequested:c,onAbortRequested:()=>null,precision:1,readOnly:!1,step:o.exposureStep,steps:o.exposureSteps,incIcon:void 0,decIcon:void 0,swapIncDec:void 0}),e.jsx(i.InputGroup.Text,{children:"s"}),e.jsx(i.Button,{size:"sm",disabled:n.disabled||r,onClick:()=>{l()},children:r?e.jsx("i",{className:"fa fa-spinner fa-spin"}):e.jsxs(e.Fragment,{children:[e.jsx("i",{className:"fa fa-play me-1"}),"Measure"]})}),e.jsx(Uo,{hardware:t,disabled:n.disabled})]})})}const Ho={default:Ze},qo=Ho,zo=[],Wo="laserheating",Yo="laserheating",Ko=!0,Qo={exposure_time:.5,state:"ON",background_mode:"READY",fit_wavelength:[500,650],current_calibration:"/path/to/file"},Xo="bliss",Jo=!1,Zo="laserheating",es={callables:zo,id:Wo,name:Yo,online:Ko,properties:Qo,protocol:Xo,require_staff:Jo,type:Zo},ts={default:es};function et(n){const t=h.useRef(null),{hardware:o,options:s={}}=n;function r(c){o.actions.setProperty("intensity",c)}const a=h.useCallback(mn.default(r,100),[]);return e.jsxs("div",{className:"hw-component",children:[e.jsxs("div",{className:"hw-head",children:[e.jsx(y,{name:"Light",icon:"fa-lightbulb-o",online:o.online}),e.jsx("div",{className:"name",children:o.name}),e.jsx(i.Badge,{bg:o.properties.state==="ON"?"success":"danger",children:o.properties.state})]}),e.jsxs("div",{className:"hw-content",children:[e.jsx(i.Form.Control,{ref:t,disabled:n.disabled,type:"range",min:"0",max:"100",onChange:c=>a(Number.parseFloat(c.target.value)),defaultValue:o.properties.intensity}),e.jsxs("div",{children:[e.jsx(i.Button,{disabled:o.properties.intensity===0,size:"sm",style:{fontSize:"0.6rem",padding:"0.05rem 0.6rem",marginTop:"0.1rem"},onClick:()=>a(0),children:e.jsx("i",{className:"fa fa-power-off"})}),e.jsxs("span",{className:"float-end",children:[o.properties.intensity," %"]})]})]})]})}const ns={default:et},os=ns,ss=[],rs="light_vlm",is="light_vlm",as=!0,cs={intensity:0,state:"ON",temperature:23.2},ls="bliss",ds=!1,us="light",fs={callables:ss,id:rs,name:is,online:as,properties:cs,protocol:ls,require_staff:ds,type:us},ps={default:fs};function H(n){const{hardware:t}=n,{online:o,locked:s=null}=t,r=t.properties.state??"UNKNOWN";console.log(r);const a=o?(r==="ACQUIRING"?r:s!==null?"LOCKED":r)||"UNKNOWN":"OFFLINE",c={UNKNOWN:"critical",ACQUIRING:"warning",READY:"success",OFFLINE:"secondary",LOCKED:"warning"},l=c[a]??c.UNKNOWN;return e.jsx(F,{state:a,minWidth:6,variant:l})}function ms(n){const{hardware:t}=n;return e.jsx(H,{hardware:t})}function Re(n){const{hardware:t,options:o={}}=n;return e.jsx(i.Stack,{className:"bg-light rounded-2 ps-2 p-1",direction:"horizontal",children:e.jsx("div",{children:t.name})})}function tt(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(H,{hardware:t}),a=o.header||"top";return a==="none"?e.jsx(Re,{...n}):e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:e.jsx(Re,{...n}),headerMode:a})}function Ee(n){const{hardware:t,options:o={}}=n,[s,r]=t.properties.size??["?","?"];return e.jsxs(i.Stack,{className:"bg-light rounded-2 ps-2 p-1",direction:"horizontal",children:[e.jsxs("div",{children:[s," × ",r]}),e.jsx("div",{className:"ms-auto",children:e.jsx("small",{children:e.jsx("small",{children:"px"})})})]})}function nt(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(H,{hardware:t}),a=o.header??"top";return a==="none"?e.jsx(Ee,{...n}):e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:e.jsx(Ee,{...n}),headerMode:a})}function z(n){const[t,o]=h.useState(!1);return e.jsxs(i.Button,{variant:n.isActive?"primary":t?"warning":"secondary",onClick:()=>{o(!0),n.onAction().finally(()=>{o(!1)})},disabled:n.disabled||t,title:n.title,className:"text-nowrap",children:[n.icon&&e.jsx("i",{className:`col-sm-4 justify-content-center align-self-center ${n.icon}`}),n.children]})}function hs(n){const{hardware:t,options:o={},disabled:s}=n,{actions:r,properties:a}=t,{rotation:c,flip:[l,f]}=a;return e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{variant:"secondary",disabled:s}),e.jsx(i.Dropdown.Menu,{align:"end",popperConfig:{strategy:"fixed"},children:e.jsxs(i.Container,{children:[e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center",children:"Rotation"})}),e.jsx(i.Row,{children:e.jsx(i.Col,{children:e.jsxs(i.ButtonGroup,{children:[e.jsx(z,{isActive:c===0,onAction:()=>r.setProperty("rotation",0),disabled:s,title:"Disable rotation transformation",children:"None"}),e.jsxs(z,{isActive:c===90,onAction:()=>r.setProperty("rotation",90),disabled:s,title:"Disable rotation transformation",children:["90 ",e.jsx("i",{className:"fa fa-fw fa-arrow-rotate-right"})]}),e.jsxs(z,{isActive:c===180,onAction:()=>r.setProperty("rotation",180),disabled:s,title:"Disable rotation transformation",children:["180 ",e.jsx("i",{className:"fa fa-fw fa-arrow-rotate-right"})]}),e.jsxs(z,{isActive:c===270,onAction:()=>r.setProperty("rotation",270),disabled:s,title:"Disable rotation transformation",children:["270 ",e.jsx("i",{className:"fa fa-fw fa-arrow-rotate-right"})]})]})})}),e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center",children:"Flip"})}),e.jsxs(i.Row,{className:"gx-0",children:[e.jsx(i.Col,{xs:6,children:e.jsxs(i.ButtonGroup,{children:[e.jsxs(z,{isActive:l,onAction:()=>r.setProperty("flip",[!0,f]),disabled:s,title:"Enable horizontal flip transformation",children:["Horiz ",e.jsx("i",{className:"fa fa-fw fa-left-right"})]}),e.jsx(z,{isActive:!l,onAction:()=>r.setProperty("flip",[!1,f]),disabled:s,title:"Disable horizontal flip transformation",children:"No"})]})}),e.jsx(i.Col,{xs:6,children:e.jsxs(i.ButtonGroup,{children:[e.jsxs(z,{isActive:f,onAction:()=>r.setProperty("flip",[l,!0]),disabled:s,title:"Enable vertical flip transformation",children:["Vert ",e.jsx("i",{className:"fa fa-fw fa-up-down"})]}),e.jsx(z,{isActive:!f,onAction:()=>r.setProperty("flip",[l,!1]),disabled:s,title:"Disable vertical flip transformation",children:"No"})]})})]})]})})]})}function xs(n){const{hardware:t,options:o={}}=n,{properties:s}=t,[r,a]=s.flip,c=s.rotation??0,l=!r&&!a&&c===0;return e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsxs(i.InputGroup.Text,{children:[r&&e.jsxs(i.Badge,{style:{fontSize:"130%"},className:"me-1",children:["Flip",e.jsx("i",{className:"fa fa-fw fa-left-right"})]}),a&&e.jsxs(i.Badge,{style:{fontSize:"130%"},className:"me-1",children:["Flip",e.jsx("i",{className:"fa fa-fw fa-up-down"})]}),c!==0&&e.jsxs(i.Badge,{style:{fontSize:"130%"},className:"me-1",children:["Rot ",c.toFixed(0),e.jsx("i",{className:"fa fa-fw fa-arrow-rotate-right"})]}),l&&e.jsx(i.Badge,{bg:"secondary",style:{fontSize:"130%"},title:"No transformation",children:"None"})]}),!o.readonly&&e.jsx(hs,{...n})]})}function ot(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(H,{hardware:t}),a=e.jsx(e.Fragment,{children:e.jsx(xs,{...n})}),c=o.header??"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const st="4.2em";function gs(n){const{hardware:t}=n,{properties:o}=t,s=o.state==="READY",r=n.disabled||!t.online||!s,a=o.binning_mode??"SUM";function c(l){const{binningMode:f,selectedMode:u,title:d}=l,m=f===u?"fa fa-fw fa-dot-circle-o":"fa fa-fw fa-circle-o";return e.jsxs(i.Dropdown.Item,{disabled:r,onClick:()=>{t.actions.setProperty("binning_mode",f)},title:d,children:[e.jsx("i",{className:m})," "," ",e.jsx(i.Badge,{style:{minWidth:st},children:f})]},f)}return e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{disabled:r,variant:"secondary"}),e.jsxs(i.Dropdown.Menu,{align:"end",popperConfig:{strategy:"fixed"},children:[e.jsx(c,{binningMode:"SUM",selectedMode:a,title:"Merge binned pixel with SUM operation"}),e.jsx(c,{binningMode:"MEAN",selectedMode:a,title:"Merge binned pixel with MEAN operation"})]})]})}function js(n){const{hardware:t,options:o,disabled:s}=n,{properties:r}=t,[a,c]=r.binning,l=a===c?a:0,f=r.binning_mode??"SUM";function u(m){t.actions.setProperty("binning",[m,m])}const d=Os(t),p=o.readonly??!1;return e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(i.InputGroup.Text,{title:"Binning applied to the detector",children:e.jsx("i",{className:"fa fa-fw fa-ruler-combined fa-2x"})}),e.jsx(A,{value:`${r.binning[0]} × ${r.binning[1]}`}),!p&&e.jsxs(e.Fragment,{children:[e.jsx(i.Button,{variant:l===1?"primary":"secondary",onClick:()=>{u(1)},disabled:s,children:"1"}),e.jsx(i.Button,{variant:l===2?"primary":"secondary",onClick:()=>{u(2)},disabled:s,children:"2"}),e.jsx(i.Button,{variant:l===3?"primary":"secondary",onClick:()=>{u(3)},disabled:s,children:"3"}),e.jsx(i.Button,{variant:l===4?"primary":"secondary",onClick:()=>{u(4)},disabled:s,children:"4"})]}),e.jsx(i.InputGroup.Text,{title:"Binning applied to the detector",children:e.jsx(i.Badge,{style:{fontSize:"130%",minWidth:st},title:`Detector setup with binning ${f}`,children:f})}),!p&&d&&e.jsx(gs,{...n})]})}function rt(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(H,{hardware:t}),a=e.jsx(e.Fragment,{children:e.jsx(js,{...n})}),c=o.header??"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function ws(n){const{hardware:t}=n,{properties:o}=t;return e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(i.InputGroup.Text,{title:"Rotation applied to the detector",children:e.jsx("i",{className:"fa fa-fw fa-crop-simple fa-2x"})}),e.jsx(i.Form.Control,{value:`${o.roi[0]}`,readOnly:!0}),e.jsx(i.Form.Control,{value:`${o.roi[1]}`,readOnly:!0}),e.jsx(i.Form.Control,{value:`${o.roi[2]}`,readOnly:!0}),e.jsx(i.Form.Control,{value:`${o.roi[3]}`,readOnly:!0}),e.jsx(i.InputGroup.Text,{children:"px"})]})}function it(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(H,{hardware:t}),a=e.jsx(e.Fragment,{children:e.jsx(ws,{hardware:t})}),c=o.header??"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function ys(n){const{hardware:t}=n,{properties:o}=t,s=o.static,[r,a]=(s==null?void 0:s.image_max_dim)??["?","?"];return e.jsxs(i.InputGroup,{children:[e.jsx(i.InputGroup.Text,{title:"Max size of the detector",children:"Max size"}),e.jsx(i.Form.Control,{value:`${r} × ${a}`,readOnly:!0}),e.jsx(i.InputGroup.Text,{children:"px"})]})}function vs(n){const{hardware:t}=n,{properties:o}=t,s=o.static;return e.jsxs(i.InputGroup,{children:[e.jsx(i.InputGroup.Text,{title:"Version of the Lima server (lima-core)",children:"Lima version"}),e.jsx(i.Form.Control,{value:`${s==null?void 0:s.lima_version}`,readOnly:!0})]})}function Ns(n){const{hardware:t}=n,{properties:o}=t,s=o.static;return e.jsxs(i.InputGroup,{children:[e.jsx(i.InputGroup.Text,{title:"Model of the detector",children:"Type/model"}),e.jsx(i.Form.Control,{value:`${s==null?void 0:s.camera_type}`,readOnly:!0}),e.jsx(i.Form.Control,{value:`${s==null?void 0:s.camera_model}`,readOnly:!0})]})}function at(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(H,{hardware:t}),a=e.jsxs(e.Fragment,{children:[e.jsx(Ns,{hardware:t}),e.jsx(ys,{hardware:t}),e.jsx(vs,{hardware:t})]}),c=o.header??"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function bs(n){var _;const{hardware:t,disabled:o}=n,{properties:s}=t,r=((_=s.static)==null?void 0:_.image_max_dim)??[0,0],a=s.roi,c=s.binning??[1,1],l=r[0]/c[0],f=r[1]/c[1];function u(){return f>l?1/f:1/l}const d=u(),[p,m]=[100*l*d,100*f*d];function g(){const[S,C,G,B]=a;return[100*S/l,100*C/f,100*G/l,100*B/f]}function w(){const[S,C,G,B]=a;return[100*(S+G*.5)/l,100*(C+B*.5)/f]}const[x,j,N,I]=g(),[M,b]=w();return e.jsx("div",{style:{backgroundColor:"#AAAAAA",width:"10em",height:"10em"},children:e.jsxs("div",{className:"position-relative",title:`Detector ${t.id}`,style:{backgroundColor:"#FFFFFF",border:"2px solid black",width:`${p}%`,height:`${m}%`},children:[e.jsx("div",{title:"ROI location",className:"position-absolute",style:{backgroundColor:"#FFFFFF",border:"2px dotted black",left:`${x}%`,top:`${j}%`,width:`${N}%`,height:`${I}%`}}),e.jsxs("span",{className:"position-absolute",style:{left:`${M}%`,top:`${b}%`,transform:"translate(-50%, -50%)"},children:[a[2],"×",a[3]]})]})})}function ct(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Lima",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(H,{hardware:t}),a=e.jsx(e.Fragment,{children:e.jsx(bs,{...n})}),c=o.header??"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const W={};function _s(n){n.useHardware&&(W.useHardware&&console.warn("useHardware hook was already registered"),W.useHardware=n.useHardware),n.useHardwareChangeActions&&(W.useHardwareChangeActions&&console.warn("useHardwareChangeActions hook was already registered"),W.useHardwareChangeActions=n.useHardwareChangeActions)}function E(n){if(!W.useHardware)throw new Error("No `useHardware` hook registered");return W.useHardware(n)}function te(n){if(!W.useHardwareChangeActions)throw new Error("No `useHardwareChangeActions` hook registered");return W.useHardwareChangeActions(n)}function ge(n){return n.type==="lima"}function $s(n){const t=E(n);return t===null||!ge(t)?null:t}function lt(n,t){const o=Math.ceil(n/t),s=n/o;return[o,s]}const Ss={default:tt,size:nt,transformation:ot,binning:rt,imageroi:it,description:at,shape:ct,state:ms},Cs=Ss;function Os(n){var t;return n.properties.binning_mode!==void 0&&hn.default.gte(((t=n.properties.static)==null?void 0:t.lima_version)??"0.0.0","1.10.4")}const Is="lima_cam",Ms="lima_cam",Ts="bliss",Fs="lima",Ds=!0,As=!1,Rs={static:{lima_version:"1.9.23",lima_type:"Frelon",camera_type:"Frelon",camera_model:"SPB8x2 CcdFT2k-F16",camera_pixelsize:[16e-6,16e-6],image_max_dim:[1920,1920]},acc_max_expo_time:1,binning:[1,1],flip:[!1,!1],pixel_size:[1e3,1e3],raw_roi:[0,0,128,128],roi:[0,0,128,128],rotation:0,size:[128,128],state:"READY"},Es={id:Is,name:Ms,protocol:Ts,type:Fs,online:Ds,require_staff:As,properties:Rs},ks="lima_cam",Ps="lima_cam",Gs="bliss",Bs="lima",Vs=!0,Ls=!1,Us={static:{lima_version:"1.9.23",lima_type:"Frelon",camera_type:"Frelon",camera_model:"SPB8x2 CcdFT2k-F16",camera_pixelsize:[16e-6,16e-6],image_max_dim:[1920,1920]},acc_max_expo_time:1,binning:[1,1],flip:[!0,!1],pixel_size:[1e3,1e3],raw_roi:[0,0,128,128],roi:[0,0,128,128],rotation:0,size:[128,128],state:"READY"},Hs={id:ks,name:Ps,protocol:Gs,type:Bs,online:Vs,require_staff:Ls,properties:Us},qs="lima_cam",zs="lima_cam",Ws="bliss",Ys="lima",Ks=!0,Qs=!1,Xs={static:{lima_version:"1.9.23",lima_type:"Frelon",camera_type:"Frelon",camera_model:"SPB8x2 CcdFT2k-F16",camera_pixelsize:[16e-6,16e-6],image_max_dim:[1920,1920]},acc_max_expo_time:1,binning:[1,1],flip:[!1,!1],pixel_size:[1e3,1e3],raw_roi:[0,0,128,128],roi:[0,0,128,128],rotation:180,size:[128,128],state:"READY"},Js={id:qs,name:zs,protocol:Ws,type:Ys,online:Ks,require_staff:Qs,properties:Xs},Zs="lima_cam",er="lima_cam",tr="bliss",nr="lima",or=!0,sr=!1,rr={static:{lima_version:"1.9.23",lima_type:"Frelon",camera_type:"Frelon",camera_model:"SPB8x2 CcdFT2k-F16",camera_pixelsize:[16e-6,16e-6],image_max_dim:[1920,1920]},acc_max_expo_time:1,binning:[1,1],flip:[!1,!1],pixel_size:[1e3,1e3],raw_roi:[0,710,1920,500],roi:[0,710,1920,500],rotation:0,size:[1920,1920],state:"READY"},ir={id:Zs,name:er,protocol:tr,type:nr,online:or,require_staff:sr,properties:rr},ar="lima_cam",cr="lima_cam",lr="bliss",dr="lima",ur=!0,fr=!1,pr={static:{lima_version:"1.9.23",lima_type:"Frelon",camera_type:"Frelon",camera_model:"SPB8x2 CcdFT2k-F16",camera_pixelsize:[16e-6,16e-6],image_max_dim:[5e3,2e3]},acc_max_expo_time:1,binning:[1,1],flip:[!1,!1],pixel_size:[1e3,1e3],raw_roi:[0,0,5e3,2e3],roi:[0,0,5e3,2e3],rotation:0,size:[5e3,2e3],state:"READY"},mr={id:ar,name:cr,protocol:lr,type:dr,online:ur,require_staff:fr,properties:pr},hr={default:Es,flip:Hs,rot:Js,roicenter:ir,squaredetector:mr};function xr(n){const{name:t,alias:o,useHardwareContext:s}=n,r=[1920,1920],a=[16e-6,16e-6],[c,l]=h.useState({static:{lima_version:"1.9.23",lima_type:"Frelon",camera_type:"Frelon",camera_model:"SPB8x2 CcdFT2k-F16",camera_pixelsize:a,image_max_dim:r},acc_max_expo_time:1,binning:[1,1],flip:[!1,!1],pixel_size:a,raw_roi:[0,0,...r],roi:[0,0,...r],rotation:0,size:r,state:"READY"});async function f(x,j){console.log("LimaSimulator: Unsupported call",x,j)}function u(x,j){const N=[Math.round(a[0]*j[0]),Math.round(a[1]*j[1])],I=[Math.round(r[0]/j[0]),Math.round(r[1]/j[1])];return{...x,binning:j,pixel_size:N,roi:[0,0,...I],size:I}}function d(x,j){return{...x,binning_mode:j}}function p(x,j){return{...x,rotation:j}}function m(x,j){return{...x,flip:[j,x.flip[1]]}}function g(x,j){return{...x,flip:[x.flip[0],j]}}async function w(x,j){if(x==="binning"){l(N=>u(N,j));return}if(x==="binning_mode"){l(N=>d(N,j));return}if(x==="rotation"){l(N=>p(N,j));return}if(x==="flip_x"){l(N=>m(N,j));return}if(x==="flip_y"){l(N=>g(N,j));return}console.log("LimaSimulator: Unsupported setProperty",x,j)}return e.jsx(U,{name:t,alias:o,type:"lima",call:f,setProperty:w,properties:c,useHardwareContext:s})}function gr(n,t){const{inputRef:o,referenceElementRef:s,onAddSelection:r,onRemoveSelection:a,...c}=n,l=h.useRef(),f=()=>{setTimeout(()=>{const p=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value").set;p&&p.call(l.current,""),l.current&&l.current.dispatchEvent(new Event("input",{bubbles:!0}))},500)},u=()=>{r&&r(t.results).then(()=>{f()})},d=()=>{const p=t.text?[...t.selected].filter(m=>m.toLowerCase().indexOf(t.text.toLowerCase())!==-1):[...t.selected];a&&a(p).then(()=>{f()})};return e.jsxs(i.InputGroup,{children:[e.jsx(L.Hint,{children:e.jsx(i.Form.Control,{style:{width:"100%"},...c,ref:p=>{l.current=p,o(p),s(p)},placeholder:`${t.selected.length} enabled`})}),e.jsx(i.Button,{disabled:n.disabled||t.results.length===0,onClick:u,children:e.jsx("i",{className:"fa fa-plus"})}),e.jsx(i.Button,{disabled:n.disabled,onClick:d,children:e.jsx("i",{className:"fa fa-minus"})})]})}function jr(n){return function(t){function o(s,r,a){return t(s,r,a,n)}return o.displayName=`WithExtraProps(${t.displayName||t.name||"Component"})`,o}}function wr(n,t,o,s){const a=[...o.selected].filter(f=>f.toLowerCase().indexOf(o.text.toLowerCase())!==-1).sort().map(f=>e.jsx("a",{href:"#",className:"dropdown-item",onClick:()=>o.onRemove(f),children:e.jsx(L.Highlighter,{search:o.text,children:f})},f)),l=[...o.results].sort().map((f,u)=>e.jsx(L.MenuItem,{option:f,position:u,children:e.jsx(L.Highlighter,{search:o.text,children:f})},f));return e.jsxs(L.Menu,{...t,style:{...t.style,width:350},children:[s.pending&&e.jsx(L.Menu.Header,{children:"Loading..."}),!s.pending&&e.jsxs(e.Fragment,{children:[e.jsx(L.Menu.Header,{children:"Enabled"}),a,a.length===0&&e.jsx("span",{className:"dropdown-item disabled",children:"No items enabled"}),e.jsx(L.Menu.Header,{children:"Available"}),l,l.length===0&&e.jsx("span",{className:"dropdown-item disabled",children:"No items available"})]})]})}function yr(n){const{hardware:t,disabled:o=!1}=n,{online:s}=t;if(!s)return e.jsx(i.Alert,{children:"Offline"});const r=t.properties.available.filter(f=>!t.properties.disabled.includes(f));function a(f){const u=f.filter(p=>!r.includes(p)),d=r.filter(p=>!f.includes(p));u.length>0&&u.forEach(p=>{t.actions.call("enable",p)}),d.length>0&&d.forEach(p=>{t.actions.call("disable",p)})}function c(f){const u=[];return f.forEach(d=>{const p=t.actions.call("enable",d);u.push(p)}),Promise.all(u)}function l(f){const u=[];return f.forEach(d=>{const p=t.actions.call("disable",d);u.push(p)}),Promise.all(u)}return e.jsx(L.Typeahead,{disabled:o,id:`typeahead_mg_${t.name}`,multiple:!0,flip:!0,positionFixed:!0,renderInput:gr,renderMenu:jr({name:t.id})(wr),onChange:a,inputProps:{onAddSelection:c,onRemoveSelection:l},selected:r,options:t.properties.available,selectHint:(f,u)=>u.key==="Enter"||f})}function dt(n){const{hardware:t,options:o,disabled:s=!1}=n;function r(){return t.actions.call("set_active")}const a=o.header??"top",c=e.jsx(y,{name:"Measurement Group",icon:"fa-list-ol",online:!0}),l=e.jsx(e.Fragment,{children:e.jsx(i.OverlayTrigger,{placement:"top",overlay:e.jsx(i.Tooltip,{id:"active",children:"Activate this measurement group"}),children:e.jsx(i.Button,{size:"sm",disabled:s,onClick:()=>void r(),className:"float-right ml-1",children:e.jsx("i",{className:"fa fa-power-off"})})})}),f=e.jsx(yr,{...n});return e.jsx(v,{hardware:t,widgetIcon:c,widgetState:l,widgetContent:f,headerMode:a})}const vr={default:dt},Nr=vr,br=[],_r="mg",$r="mg",Sr=!0,Cr={available:["lima:image","diode1","diode2","machinfo:current","machinfo:srcurrent"],disabled:["machinfo:current"]},Or="bliss",Ir=!1,Mr="measurementgroup",Tr={callables:br,id:_r,name:$r,online:Sr,properties:Cr,protocol:Or,require_staff:Ir,type:Mr},Fr={default:Tr};function Dr(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=h.useState({available:["lima:image","diode1","diode2","machinfo:current","machinfo:srcurrent"],disabled:["machinfo:current"]});async function c(d){a(p=>{const{disabled:m}=p;return{...p,disabled:m.filter(g=>g!==d)}})}async function l(d){a(p=>{const{disabled:m}=p;return{...p,disabled:m.includes(d)?m:[...m,d]}})}async function f(d,p){if(d==="enable"){await c(p);return}if(d==="disable"){await l(p);return}d!=="set_active"&&console.log("MeasurementGroupSimulator: Unsupported call",d,p)}async function u(d,p){console.log("MeasurementGroupSimulator: Unsupported setProperty",d,p)}return e.jsx(U,{name:t,alias:o,type:"measurementgroup",call:f,setProperty:u,properties:r,useHardwareContext:s})}const _e={description:"Unknown state is exposed",variant:"fatal",priority:100},ce={OFFLINE:{description:"Axis is offline",variant:"secondary",priority:0},MOVING:{description:"Axis is moving",variant:"warning",priority:10},FAULT:{description:"Axis is in fault",variant:"danger",priority:20},LOCKED:{description:"Axis is locked",variant:"warning",priority:25},OFF:{description:"Power is off",variant:"secondary",priority:30},DISABLED:{description:"Axis is disabled",variant:"warning",priority:40},LOWLIMIT:{description:"Low limit is reached",variant:"warning",priority:50},HIGHLIMIT:{description:"High limit is reached",variant:"warning",priority:51},HOME:{description:"Home signal active",variant:"info",priority:52},READY:{description:"Ready to handle request",variant:"success",priority:60},NOT_READY:{description:"Not ready",variant:"warning",priority:100},UNKNOWN:_e};function je(n){const{hardware:t}=n,{locked:o=null}=t,{state:s=["UNKNOWN"]}=t.properties,[r,a]=h.useMemo(()=>{if(!t.online)return[["OFFLINE"],void 0];function c(p,m){const g=ce[p]??_e,w=ce[m]??_e;return g.priority-w.priority}const l=[...s,...o!==null?["LOCKED"]:[],...s.length===0?["NOT_READY"]:[]];l.sort(c);function f(p){const m=p.split(":",2);return m.length===1?[p,void 0]:m}const u={};return[l.map(p=>{if(p.startsWith("_")){const m=f(p);return m[1]!==void 0&&(u[m[0]]=m[1]),m[0]}return p==="LOCKED"?u[p]=`Locked by ${o}`:u[p]=ce[p].description??"",p}),u]},[s,t.online,o]);return e.jsx(qe,{states:r,descriptions:a,minWidth:6,variants:Object.fromEntries(Object.entries(ce).map(([c,l])=>[c,l.variant]))})}function Ar(n){const{hardware:t}=n;return e.jsx(je,{hardware:t})}function oe(n){const t=h.useRef(null),[o,s]=h.useState(!1),[r,a]=h.useState(!1);function c(d){return n.precision!==void 0?Number.parseFloat(d).toFixed(n.precision):d}h.useEffect(()=>{var d;t.current&&(t.current.value=c((d=n.hardwareValue)==null?void 0:d.toString()),s(!1))},[n.hardwareValue,n.precision]);function l(d){const p=c(d);t!=null&&t.current&&(t.current.value=p)}function f(d){switch(d.key){case"Enter":{s(!1);const p=Number.parseFloat(d.target.value),m=n.onMoveRequested(p);m&&m.catch(()=>{a(!0),setTimeout(()=>{l(n.hardwareValue),a(!1)},2e3)}),d.preventDefault(),d.stopPropagation();break}case"Esc":case"Escape":o&&(a(!1),s(!1),l(n.hardwareValue)),d.target.blur(),d.preventDefault(),d.stopPropagation();break}}function u(d){s(d.target.value!==n.hardwareValue.toString())}return e.jsx(i.Form.Control,{className:P.default({"form-control-edited":o,"form-control-error":r,"hw-moving":n.hardwareIsMoving}),type:"number",ref:t,onChange:u,onKeyDown:f,disabled:n.readOnly||n.hardwareIsMoving||n.hardwareIsDisabled,step:n.step,onClick:d=>{d.stopPropagation()}})}function Rr(n){const{states:t,hardware:o}=n,{properties:s}=o;function r(c){return o.actions.setProperty("velocity",c)}function a(c){return o.actions.setProperty("acceleration",c)}return e.jsx(i.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"popid",children:[e.jsxs(i.Popover.Header,{children:[o.name," details"]}),e.jsxs(i.Popover.Body,{children:[e.jsxs(i.Form.Group,{children:[e.jsx(i.Form.Label,{children:"Velocity"}),e.jsx(oe,{hardwareValue:(s==null?void 0:s.velocity)??0,onMoveRequested:r,hardwareIsDisabled:n.disabled,hardwareIsReady:t.READY,hardwareIsMoving:t.MOVING,readOnly:n.readOnly})]}),e.jsxs(i.Form.Group,{children:[e.jsx(i.Form.Label,{children:"Acceleration"}),e.jsx(oe,{hardwareValue:(s==null?void 0:s.acceleration)??0,onMoveRequested:a,hardwareIsDisabled:n.disabled,hardwareIsReady:t.READY,hardwareIsMoving:t.MOVING,readOnly:n.readOnly})]})]})]}),children:e.jsx(i.Button,{children:e.jsx("i",{className:"fa fa-ellipsis-h"})})})}function Q(n){const{hardware:t,options:o={}}=n,{properties:s,user_tags:r}=t;function a(){t.actions.call("stop")}function c(p){return t.actions.call("move",p)}const l=Ce(s.state,r),f=e.jsx(y,{name:"Motor",icon:"fam-hardware-motor",online:t.online}),u=e.jsx(je,{hardware:t}),d=n.options?n.options.header:"top";return e.jsx(v,{hardware:t,widgetIcon:f,widgetState:u,widgetContent:e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(xe,{id:t.id,hardwareValue:(s==null?void 0:s.position)??null,hardwareIsDisabled:n.disabled,hardwareIsReady:l.READY??!1,hardwareIsMoving:l.MOVING??!1,onMoveRequested:c,onAbortRequested:a,precision:o.precision??s.display_digits??void 0,readOnly:o.readOnly,stepOnly:o.stepOnly,step:o.step,steps:o.steps,incIcon:o.incicon,decIcon:o.decicon,swapIncDec:o.swapincdec,horizontalArrows:o.horizontalarrows,largeArrows:o.largearrows}),s.unit&&e.jsx(i.InputGroup.Text,{children:s.unit}),!l.MOVING&&o.extended&&e.jsx(Rr,{hardware:t,disabled:n.disabled,readOnly:o.readOnly,states:l}),l.MOVING&&!n.disabled&&!o.step&&e.jsx(i.Button,{variant:"danger",onClick:a,children:e.jsx("i",{className:"fa fa-times"})})]}),headerMode:d})}function ke(n){const{hardware:t,options:o={}}=n,s=Ce(t.properties.state,t.user_tags);function r(a){if(a===null)return"∅";const c=o.precision??t.properties.display_digits??void 0;return c!==void 0?a.toFixed(c):`${a}`}return e.jsxs(i.Stack,{className:"bg-light rounded-2 ps-2 p-1",direction:"horizontal",children:[e.jsx("div",{className:P.default({"hw-moving":s.MOVING}),children:r(t.properties.position)}),t.properties.unit&&e.jsx("div",{className:"ms-auto",children:e.jsx("small",{children:e.jsx("small",{children:t.properties.unit})})})]})}function ut(n){const{hardware:t}=n,o=e.jsx(y,{name:"Motor",icon:"fam-hardware-motor",online:t.online}),s=e.jsx(je,{hardware:t}),r=n.options?n.options.header:"top";return r==="none"?e.jsx(ke,{...n}):e.jsx(v,{hardware:t,widgetIcon:o,widgetState:s,widgetContent:e.jsx(ke,{...n}),headerMode:r})}function Ce(n,t=[]){return h.useMemo(()=>{const o=t.includes("auto_ready"),s=t.includes("auto_on");if(n===void 0)return{UNKNOWN:!0};if((n==null?void 0:n.length)===0)return o?{READY:!0}:{NOT_READY:!0};const r=n.reduce((a,c)=>(a[c]=!0,a),{});return r.READY===void 0&&s&&r.OFF&&(r.READY=!0),r},[n,t])}function ft(n){return n.type==="motor"}function k(n){const t=E(n);return t===null||!ft(t)?null:t}const Er={default:Q,text:ut,state:Ar},kr=Er,Pr=["move","stop","wait","rmove"],Gr="omega",Br="omega 123",Vr=!0,Lr={offset:0,sign:1,acceleration:300,limits:[-999999999,999999999],position:235.165400001,state:["READY"],tolerance:1e-4,unit:"um",velocity:1e3,display_digits:4},Ur="bliss",Hr=!1,qr="motor",zr=[],Wr={callables:Pr,id:Gr,name:Br,online:Vr,properties:Lr,protocol:Ur,require_staff:Hr,type:qr,user_tags:zr},Yr=["move","stop","wait","rmove"],Kr="omega",Qr="omega 123",Xr=!0,Jr={offset:0,sign:1,acceleration:300,limits:[-10,190],position:100,state:["READY"],tolerance:1e-4,unit:"um",velocity:1e3},Zr="bliss",ei=!1,ti="motor",ni=[],oi={callables:Yr,id:Kr,name:Qr,online:Xr,properties:Jr,protocol:Zr,require_staff:ei,type:ti,user_tags:ni},si=["move","wait","stop","rmove"],ri="omega",ii="omega 123",ai=!0,ci={acceleration:null,limits:[null,null],offset:null,position:235.1654,sign:null,state:["UNKNOWN"],target:null,tolerance:1e-4,unit:"deg",velocity:null},li="bliss",di=!1,ui="motor",fi=[],pi={callables:si,id:ri,name:ii,online:ai,properties:ci,protocol:li,require_staff:di,type:ui,user_tags:fi},mi=["move","wait","stop","rmove"],hi="omega",xi="omega 123",gi=!0,ji={acceleration:null,limits:[null,null],offset:null,position:235.1654,sign:null,state:[],target:null,tolerance:1e-4,unit:"deg",velocity:null},wi="bliss",yi=!1,vi="motor",Ni=[],bi={callables:mi,id:hi,name:xi,online:gi,properties:ji,protocol:wi,require_staff:yi,type:vi,user_tags:Ni},_i=["move","wait","stop","rmove"],$i="omega",Si="omega 123",Ci=!1,Oi={},Ii="bliss",Mi=!1,Ti="motor",Fi=[],Di={callables:_i,id:$i,name:Si,online:Ci,properties:Oi,protocol:Ii,require_staff:Mi,type:Ti,user_tags:Fi},Ai=["move","wait","stop","rmove"],Ri="omega",Ei="omega 123",ki=!0,Pi={acceleration:null,limits:[null,null],offset:null,position:235.1654,sign:null,state:["OFF"],target:null,tolerance:1e-4,unit:"deg",velocity:null},Gi="bliss",Bi=!1,Vi="motor",Li=[],Ui={callables:Ai,id:Ri,name:Ei,online:ki,properties:Pi,protocol:Gi,require_staff:Bi,type:Vi,user_tags:Li},Hi={default:Wr,halfMotor:oi,unknownMotor:pi,notReadyMotor:bi,disconnectedMotor:Di,powerOffMotor:Ui};function qi(n,t){return{id:n,name:n,type:"motor",properties:{position:t,unit:"mm",limits:[-100,100]},online:!0}}function zi(n){const{name:t="omega",minLimit:o=-999999999,maxLimit:s=999999999,initialPosition:r=0,initialVelocity:a=1e3,useHardwareContext:c=()=>null}=n,[l,f]=h.useState(r),[u,d]=h.useState(["READY"]),[p,m]=h.useState(null),g=h.useRef(Date.now()),w=c(),x=()=>{const _=Date.now(),S=(_-g.current)/1e3;let C;if(g.current=_,p!==null&&p!==l){let G,B;const $=S*a;if($>Math.abs(l-p))C=p,G=["READY"],B=null;else{const q=p>l?1:-1;C=l+q*$,G=["MOVING"],B=p}f(C),d(G),m(B)}},j=h.useCallback((_,S)=>{if(_==="stop")return m(null),d(["READY"]),Promise.resolve();if(_==="move"){const C=Number.parseFloat(S);return m(Number.isNaN(C)?null:C),Promise.resolve()}return console.log("MotorSimulator: Unsupported call",_,S),Promise.resolve()},[]),N=h.useCallback((_,S)=>(console.log("MotorSimulator: Unsupported setProperty",_,S),Promise.resolve()),[]);h.useEffect(()=>{const _=setInterval(()=>{x()},500);return()=>clearInterval(_)});const I=h.useMemo(()=>{var S,C;const _={setProperty:N,call:j};return(C=w==null?void 0:(S=w.actions).updateHardwareChangeActions)==null||C.call(S,t,_),_},[]),M={id:t,name:t,alias:null,online:!0,properties:{acceleration:300,limits:[o,s],position:l,offset:0,sign:1,state:u,tolerance:1e-4,unit:"mm",velocity:a,target:p,display_digits:3},type:"motor",actions:I,user_tags:[],locked:null},b=h.useRef(null);return h.useEffect(()=>{b.current!==null&&D.isEqual(b.current,M)||(b.current=M,w==null||w.actions.updateHardware(t,M))},[t,M]),e.jsx(e.Fragment,{})}function pt(n){const{hardware:t,options:o={}}=n,s=h.useRef(null);h.useEffect(()=>{if(!s.current){console.error("selectionRef ref is unset");return}s.current.value=t.properties.position},[t.properties.position]);function r(l){if(console.debug("change",l),!s||!s.current){console.error("selection ref is unset");return}t.actions.call("move",s.current.value)}function a(l){t.actions.call("stop")}const c=D.map(t.properties.positions,l=>e.jsx("option",{title:l.description,children:l.position},l.position));return e.jsxs("div",{className:"hw-component",children:[e.jsxs("div",{className:"hw-head",children:[e.jsx(y,{name:"Multiposition",icon:"fam-hardware-multiposition",online:t.online}),e.jsx("div",{className:"name",children:t.name}),e.jsx(i.Badge,{bg:t.properties.state==="READY"?"success":"warning",children:t.properties.state})]}),e.jsx("div",{className:"hw-content",children:e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsxs(i.Form.Control,{className:"custom-select",as:"select",ref:s,disabled:n.disabled,defaultValue:t.properties.position,children:[e.jsx("option",{disabled:!0,children:"unknown"}),c]}),t.properties.state!=="MOVING"&&e.jsx(i.Button,{onClick:r,disabled:n.disabled,children:"Move"}),t.properties.state==="MOVING"&&!n.disabled&&e.jsx(i.Button,{variant:"danger",onClick:a,children:e.jsx("i",{className:"fa fa-times"})})]})})]})}function Wi(n){const{hardware:t}=n,{properties:o}=t,s=o.state==="READY",r=n.disabled||!t.online||!s,a=o.position;function c(f){t.actions.call("move",f)}function l(f){const u=f.position,p=u===a?"fa fa-fw fa-dot-circle-o":"fa fa-fw fa-circle-o";return e.jsxs(i.Dropdown.Item,{disabled:r,onClick:()=>{c(u)},title:f.description,children:[e.jsx("i",{className:p}),"  ",u]},u)}return e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{disabled:r,variant:"secondary"}),e.jsx(i.Dropdown.Menu,{align:"end",popperConfig:{strategy:"fixed"},children:o.positions.map(f=>l(f))})]})}function Yi(n){var p,m;const{hardware:t,options:o={}}=n,s=((p=t.properties)==null?void 0:p.state)==="MOVING";function r(g){t.actions.call("stop")}const a=e.jsx(y,{name:"Multiposition",icon:"fam-hardware-multiposition",online:t.online}),c=e.jsx(Be,{hardware:t}),l=s?"Moving":null,f=(m=t.properties)==null?void 0:m.position;function u(){return e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(A,{className:P.default({"hw-moving":s}),value:l??f??"Unknown"}),!s&&!n.disabled&&e.jsx(Wi,{...n}),s&&!n.disabled&&e.jsx(i.Button,{variant:"danger",onClick:r,children:e.jsx("i",{className:"fa fa-fw fa-times"})})]})}const d=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:a,widgetState:c,widgetContent:u(),headerMode:d})}const Ki={default:pt,default2:Yi},Qi=Ki,Xi=["move","stop"],Ji="beamstop",Zi="beamstop",ea=!0,ta={position:"OUT",positions:[{description:"Beamstop position IN the beam",position:"IN",target:[{destination:2.5,tolerance:.01},{destination:1,tolerance:.2}]},{description:"Beamstop position OUT of the beam",position:"OUT",target:[{destination:3.5,tolerance:.01},{destination:2,tolerance:.2}]}],state:"READY"},na="bliss",oa=!1,sa="multiposition",ra={callables:Xi,id:Ji,name:Zi,online:ea,properties:ta,protocol:na,require_staff:oa,type:sa},ia={default:ra};function aa(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=h.useState("empty"),[c,l]=h.useState("READY");async function f(p,m){if(p==="move"){l("MOVING"),a("unknown"),await R(2e3),l("READY"),a(m);return}if(p==="stop"){a("unknown"),await R(2e3);return}console.log("MultipositionSimulator: Unsupported call",p,m)}async function u(p,m){console.log("MultipositionSimulator: Unsupported setProperty",p,m)}const d={position:r,state:c,positions:[{position:"empty",description:"No filter",target:[]},{position:"gold2",description:"Gold filter 2mm",target:[]},{position:"silver3",description:"Silver filter 3mm",target:[]}]};return e.jsx(U,{name:t,alias:o,type:"multiposition",call:f,setProperty:u,properties:d,useHardwareContext:s})}function Oe(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={READY:"success",MOVING:"warning",INVALID:"danger",UNKNOWN:"danger",DISABLED:"secondary",OFFLINE:"warning"},r=s[o]||s.UNKNOWN;return e.jsx(F,{state:o,minWidth:6,variant:r})}function ca(n){const{hardware:t}=n;return e.jsx(Oe,{hardware:t})}function la(n){const{hardware:t,options:o={}}=n,{properties:s}=t,{state:r}=s,a=r==="MOVING",c=r==="READY",l=a?s.target_magnification||0:s.magnification||0,u=[...s.available_magnifications??[]];u.sort((w,x)=>w>x?1:x>w?-1:0);const d=n.disabled||!t.online||!c,p=o.digits||2;function m(w){t.actions?t.actions.call("move",w):console.error("Change request was triggered with:",w)}function g(w,x){const N=l===x?"fa fa-fw fa-dot-circle-o":"fa fa-fw fa-circle-o";return e.jsxs(i.Dropdown.Item,{disabled:d,onClick:()=>{m(x)},children:[e.jsx("i",{className:N}),"  × ",x]},`id${w}`)}return e.jsxs(e.Fragment,{children:[e.jsx(A,{value:l.toFixed(p),className:P.default({"hw-moving":a})}),e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{disabled:!c,variant:"secondary"}),e.jsx(i.Dropdown.Menu,{popperConfig:{strategy:"fixed"},children:u.map((w,x)=>g(x,w))})]})]})}function da(n){const{hardware:t,options:o={}}=n,s=t.properties.magnification||0,r=o.digits||2,a=!!o.allowtuning;return e.jsxs(e.Fragment,{children:[e.jsx(A,{value:s.toFixed(r)}),a&&e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{variant:"secondary"}),e.jsx(i.Dropdown.Menu,{popperConfig:{strategy:"fixed"},children:e.jsxs(i.InputGroup,{children:[e.jsx(i.InputGroup.Text,{children:"×"}),e.jsx(mt,{...n})]})})]})]})}function mt(n){const{hardware:t,options:o={}}=n,s=t.properties.magnification||0,{state:r}=t.properties,a=r==="READY",c=n.disabled||!t.online||!a,[l,f]=t.properties.magnification_range||[null,null],u=h.useRef(null),d=h.useRef(null),[p,m]=h.useState(!1),g=o.digits||2;function w(b){t.actions?n.mode==="move"?t.actions.call("move",b):t.actions.setProperty("magnification",b):console.error("Change request was triggered with:",b)}function x(b){if(!u||!u.current){console.log("formRef not yet defined");return}if(b.key==="Enter"){m(!1);const{value:_}=u.current,S=Number.parseFloat(_);if(l!==null&&S<l||f!==null&&S>f)return;w(S)}else b.key==="Escape"?(u.current.value=s.toFixed(g),d.current&&(d.current.value=s.toString()),m(!1)):console.log(b.key)}function j(b){b!==s&&!p&&m(!0),b===s&&p&&m(!1)}function N(b){if(!u||!u.current){console.error("formRef is not set");return}const _=Number.parseFloat(u.current.value);j(_),d.current&&(d.current.value=_.toString())}function I(b){if(!u||!u.current){console.error("formRef is not set");return}if(!d||!d.current){console.error("rangeRef is not set");return}const _=Number.parseFloat(d.current.value);j(_),u.current.value=_.toFixed(g)}function M(){if(!d||!d.current){console.error("rangeRef is not set");return}const b=Number.parseFloat(d.current.value);w(b)}return h.useEffect(()=>{if(!u||!u.current){console.error("formRef is not set");return}p||(u.current.value=s.toFixed(g)),d.current&&(d.current.value=s.toString())},[g,p,s]),e.jsxs(e.Fragment,{children:[e.jsx(i.Form.Control,{className:p?"form-control-edited":"",type:"number",ref:u,defaultValue:s.toFixed(g),onChange:N,disabled:c,step:10**-g,onKeyDown:x}),l!==null&&f!==null&&e.jsx(i.Form.Control,{ref:d,disabled:c,type:"range",min:l,max:f,step:10**-g,onChange:I,onMouseUp:M,defaultValue:s})]})}function ua(n){const{hardware:t,options:o={}}=n,{properties:s}=t,r=s.state==="MOVING",a=s.state==="READY",c=r?s.target_magnification||0:s.magnification||0,l=n.options.digits||2;return e.jsxs(e.Fragment,{children:[e.jsx(A,{value:c.toFixed(l),className:P.default({"hw-moving":r})}),e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{disabled:!a,variant:"secondary"}),e.jsx(i.Dropdown.Menu,{popperConfig:{strategy:"fixed"},children:e.jsxs(i.InputGroup,{children:[e.jsx(i.InputGroup.Text,{children:"×"}),e.jsx(mt,{...n,mode:"move"})]})})]})]})}function fa(n){return e.jsx(i.Form.Control,{className:"border-light",type:"text",disabled:!0,defaultValue:"Missing"})}function ht(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Optic",icon:"fam-hardware-optic",online:t.online}),r=e.jsx(Oe,{hardware:t});function a(){function l(){return t.online?t.properties.available_magnifications?la:t.properties.magnification_range?ua:da:fa}const f=l();return e.jsxs(i.InputGroup,{children:[e.jsx(i.InputGroup.Text,{className:"border-light",children:"×"}),e.jsx(f,{...n})]})}const c=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a(),headerMode:c})}function pa(n){return n.type==="optic"}const ma={default:ht,state:ca},ha=ma,xa=["magnification","reset","open"],ga="optic",ja="optic",wa=!0,ya={state:"READY",magnification:10,target_magnification:null,available_magnifications:[5,7.5,10],magnification_range:null},va="bliss",Na=!1,ba="optic",le={callables:xa,id:ga,name:ja,online:wa,properties:ya,protocol:va,require_staff:Na,type:ba},_a={default:le,fixed:le,off:le,range:le};function $a(n){const{name:t,alias:o,kind:s,useHardwareContext:r}=n;function a(){return s==="fixed"?{available_magnifications:null,magnification_range:null}:s==="range"?{available_magnifications:null,magnification_range:[5,10]}:s==="multi"?{available_magnifications:[5,7.5,10],magnification_range:null}:{available_magnifications:null,magnification_range:null}}const[c,l]=h.useState({state:"READY",magnification:10,target_magnification:null,...a()});async function f(p){let m=c.magnification;l(x=>({...x,state:"MOVING",target_magnification:p})),await R(100);const g=.2*(m<p?1:-1);function w(x){l(j=>({...j,magnification:x}))}for(;Math.abs(p-m)>=Math.abs(g)*1.01;)m+=g,w(m),await R(100);l(x=>({...x,state:"READY",magnification:p,target_magnification:null}))}async function u(p,m){if(p==="move"){await f(m);return}console.log("OpticSimulator: Unsupported call",p,m)}async function d(p,m){if(p==="magnification"){l(g=>({...g,magnifications:m}));return}console.log("OpticSimulator: Unsupported setProperty",p,m)}return e.jsx(U,{name:t,alias:o,type:"optic",call:u,setProperty:d,properties:c,useHardwareContext:r})}function ae(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={STANDBY:"success",DISABLED:"secondary",OFFLINE:"secondary",RUNNING:"warning",ABORTING:"warning",AWAITING_USER_INPUT:"warning",UNKNOWN:"fatal"},r=s[o]||s.UNKNOWN;return e.jsx(F,{state:o,minWidth:6,variant:r})}function Sa(n){const{hardware:t}=n;return e.jsx(ae,{hardware:t})}function Ca(n){const{hardware:t}=n,o=n.disabled||!t.online,s=t.properties.state==="AWAITING_USER_INPUT",r=t.properties.state==="ABORTING",a=t.properties.state==="RUNNING"||s||r;function c(f){t.actions.call("start")}function l(f){t.actions.call("abort")}return e.jsxs(i.ButtonGroup,{size:"lg",className:"w-100",children:[e.jsx(i.Button,{onClick:c,disabled:o||a,variant:"primary",children:"Start"}),e.jsx(i.Button,{onClick:l,disabled:o||!a,variant:"primary",children:"Abort"})]})}function $e(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Procedure",icon:"fa-cog",online:t.online}),r=e.jsx(ae,{hardware:t}),a=e.jsx(i.Container,{children:e.jsx(Ca,{hardware:t,disabled:!n.operator})}),c=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Oa(n){const{hardware:t}=n,o=t.properties.state==="AWAITING_USER_INPUT",s=t.properties.state==="ABORTING",r=t.properties.state==="RUNNING";return s?e.jsxs(i.Badge,{bg:"warning",children:[e.jsx("i",{className:"fa-solid fa-heart-crack fa-beat"})," ABORTING"]}):r?e.jsxs(i.Badge,{bg:"info",children:[e.jsx("i",{className:"fa-solid fa-heart fa-beat"})," RUNNING"]}):o?e.jsxs(i.Badge,{bg:"warning",title:"A user input is expected",children:[e.jsx("i",{className:"fa-solid fa-user fa-beat"})," AWAITING INPUT"]}):e.jsx(Ia,{hardware:t})}function Ia(n){const{hardware:t}=n,{previous_run_state:o,previous_run_exception:s}=t.properties,r={NONE:["secondary",null],ABORTED:["warning","fa-heart-crack"],FAILED:["danger",null],SUCCESSED:["success",null],UNKNOWN:["danger",null]},a=r[o]||r.UNKNOWN,[c,l]=a;return e.jsxs(i.Badge,{bg:c,title:s??void 0,children:[l&&e.jsxs(e.Fragment,{children:[e.jsx("i",{className:`fa-solid ${l}`})," "]}),o]})}function xt(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Procedure",icon:"fa-cog",online:t.online}),r=e.jsx(ae,{hardware:t}),a=e.jsx(i.Container,{children:e.jsx("div",{children:e.jsx("h3",{children:e.jsx(Oa,{hardware:t})})})}),c=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Ma(n){const{hardware:t}=n,o=n.disabled||!t.online,s=t.properties.state==="AWAITING_USER_INPUT";function r(a){t.actions.call("validate")}return e.jsx(i.ButtonGroup,{size:"lg",className:"w-100",children:e.jsx(i.Button,{onClick:r,disabled:o||!s,variant:"primary",children:"Validate"})})}function gt(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Procedure",icon:"fa-cog",online:t.online}),r=e.jsx(ae,{hardware:t}),a=e.jsx(i.Container,{children:e.jsx(Ma,{hardware:t,disabled:!n.operator})}),c=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const Ta={default:$e,manage:$e,execution:xt,validate:gt,state:Sa},Fa=Ta;function jt(n){return n.type==="procedure"}function Da(n){const t=E(n);return t===null||!jt(t)?null:t}const Aa=["start","abort","clear","validate"],Ra="procedure",Ea="procedure",ka="procedure",Pa="bliss",Ga=!1,Ba=!0,Va={state:"STANDBY",previous_run_state:"NONE",previous_run_exception:null,parameters:{my_number:10,my_string:"foo",my_null:null,my_boolean:!0,my_dict:{a:10,b:"10",c:!0},my_list:[10,"10",!0],"my_scan_1.11":{__type__:"scan",node:"demo_session:tmp:scans:inhouse:id002405:sample:sample_0002:_1_flat images 1",mmh3:3852826388},"my_scan_2.0":{__type__:"scan",key:"esrf:scan:01J1QDB370S2V8WF7FX2Y9H29V",mmh3:3852826389},my_quantity:{__type__:"quantity",scalar:20,unit:"mm"},my_nan:{__type__:"nan"},my_posinf:{__type__:"posinf"},my_neginf:{__type__:"neginf"},my_obj:{__type__:"hardware",name:"roby"}}},La={callables:Aa,type:Ra,id:Ea,name:ka,protocol:Pa,require_staff:Ga,online:Ba,properties:Va},Ua={standby:La};function we(n){const{hardware:t}=n;function o(){if(!t.online)return"OFFLINE";const a=t.properties.state;return n.useReadyState&&(a==="OPEN"||a==="CLOSED")?"READY":a}const s=o();function r(){switch(s){case"READY":return"success";case"OPEN":return"success";case"CLOSED":return"danger";case"DISABLED":return"secondary";case"MOVING":case"STANDBY":case"OFFLINE":return"warning";case"FAULT":return"fatal";default:return"fatal"}}return e.jsx(F,{state:s,minWidth:6,variant:r()})}function Ha(n){const{hardware:t}=n;return e.jsx(we,{hardware:t,useReadyState:!0})}function qa(n){const{hardware:t}=n;function o(){t.actions.call("reset")}return e.jsx(i.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"popid",children:[e.jsxs(i.Popover.Header,{children:[t.name," Details"]}),e.jsxs(i.Popover.Body,{children:[e.jsx("h6",{children:"Status"}),e.jsx("pre",{children:t.properties.status}),e.jsx("div",{className:"d-grid gap-2",children:e.jsx(i.Button,{onClick:o,disabled:n.disabled,children:"Reset"})})]})]}),children:e.jsx(i.Button,{className:"flex-grow-0",title:"Shutter Details",children:e.jsx("i",{className:"fa fa-ellipsis-h"})})})}function wt(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Shutter",icon:"fam-hardware-shutter",online:t.online}),r=e.jsx(we,{hardware:t});function a(){return t.properties?t.properties.state:"UNKNOWN"}function c(x){return x==="OPEN"?["Close","close"]:x==="CLOSED"?["Open","open"]:x==="DISABLED"||x==="STANDBY"||x==="FAULT"?["Closed",""]:x==="MOVING"?["...",""]:["Unknown",""]}const l=a(),[f,u]=c(l),p={OPEN:"danger",CLOSED:"success",MOVING:"warning",DISABLED:"secondary",STANDBY:"danger",FAULT:"fatal",UNKNOWN:"warning"}[l]||"danger";function m(){t.actions.call(u)}const g=e.jsxs(i.ButtonGroup,{className:"d-flex flex-nowrap",children:[e.jsx(i.Button,{variant:p,onClick:m,disabled:n.disabled||u==="",children:f}),o.extended&&e.jsx(qa,{...n})]}),w=n.options.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:g,headerMode:w})}function za(n){var f;const{hardware:t,options:o={}}=n;function s(){t.actions.call("open")}function r(){t.actions.call("close")}const a=((f=t.properties)==null?void 0:f.state)??"UNKNOWN",c=a==="MOVING",l=a==="DISABLED"||c;return e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{variant:"secondary",disabled:n.disabled||l}),e.jsx(i.Dropdown.Menu,{popperConfig:{strategy:"fixed"},children:e.jsxs(i.Container,{children:[e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center",children:"Actions"})}),e.jsx(i.Row,{children:e.jsx(i.Col,{children:e.jsxs(i.ButtonGroup,{children:[e.jsx(i.Button,{variant:c?"warning":"secondary",onClick:()=>{s()},disabled:n.disabled||l,title:"Open the shutter",children:"Open"}),e.jsx(i.Button,{variant:c?"warning":"secondary",onClick:()=>{r()},disabled:n.disabled||l,title:"Close the shutter",children:"Close"})]})})})]})})]})}function yt(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Shutter",icon:"fam-hardware-shutter",online:t.online}),r=e.jsx(we,{hardware:t,useReadyState:!0});function a(){return t.properties?t.properties.state:"UNKNOWN"}function c(x){return x==="OPEN"||x==="CLOSED"?x:x==="DISABLED"||x==="STANDBY"||x==="FAULT"?"CLOSED":x==="MOVING"?"...":"UNKNOWN"}function l(x){return x.charAt(0).toUpperCase()+x.slice(1).toLowerCase()}const f=a(),u=c(f),p={OPEN:"success",CLOSED:"danger",MOVING:"warning",DISABLED:"secondary",STANDBY:"success",FAULT:"fatal",UNKNOWN:"fatal"}[f],m=l(u),g=e.jsxs(i.InputGroup,{className:"d-flex flex-nowrap",children:[e.jsx(A,{variant:p,className:"text-center",style:{minWidth:"10em"},value:m}),e.jsx(za,{...n})]}),w=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:g,headerMode:w})}const Wa={default:wt,protected:yt,state:Ha},Ya=Wa,Ka=["reset","open","close","toggle"],Qa="abs1",Xa="abs1",Ja=!0,Za={closed_text:"",open_text:"",state:"OPEN",status:`Pneumatic Beam Shutter is open
29
+ `,valid:!0},ec="tango",tc=!0,nc="shutter",oc={callables:Ka,id:Qa,name:Xa,online:Ja,properties:Za,protocol:ec,require_staff:tc,type:nc},sc={default:oc};function rc(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=h.useState("OPEN");async function c(u,d){if(u==="open"){a("MOVING"),await R(2e3),a("OPEN");return}if(u==="close"){a("MOVING"),await R(2e3),a("CLOSED");return}console.log("ShutterSimulator: Unsupported call",u,d)}async function l(u,d){console.log("ShutterSimulator: Unsupported setProperty",u,d)}const f={state:r,closed_text:"",open_text:"",status:`Shutter is ${r}`,valid:!0};return e.jsx(U,{name:t,alias:o,type:"shutter",call:c,setProperty:l,properties:f,useHardwareContext:s})}function ic(n){var d,p,m,g;const{properties:t}=n,o=(d=t.vgap)==null?void 0:d.slice(9),s=k(o),r=(p=t.hgap)==null?void 0:p.slice(9),a=k(r),c=(m=t.voffset)==null?void 0:m.slice(9),l=k(c),f=(g=t.hoffset)==null?void 0:g.slice(9),u=k(f);return h.useMemo(()=>{var w,x,j,N;return{vgap:((w=s==null?void 0:s.properties)==null?void 0:w.state)??null,hgap:((x=a==null?void 0:a.properties)==null?void 0:x.state)??null,voffset:((j=l==null?void 0:l.properties)==null?void 0:j.state)??null,hoffset:((N=u==null?void 0:u.properties)==null?void 0:N.state)??null}},[s,a,l,u])}function Ie(n){const{hardware:t}=n,o=ic(t),[s,r,a]=h.useMemo(()=>{if(!t.online)return["OFFLINE","secondary","No motor online"];if(o.vgap===null&&o.hgap===null&&o.voffset===null&&o.hoffset===null)return["OFFLINE","secondary","No motor online"];const c=new Set([...o.vgap??[],...o.hgap??[],...o.voffset??[],...o.hoffset??[]]);return c.has("MOVING")?["MOVING","warning","A motor is moving"]:c.has("OFF")?["OFF","secondary","A motor is off"]:["READY","success","The slit is ready"]},[t.online,o]);return e.jsx(F,{state:s,description:a,variant:r,minWidth:6})}function ac(n){const{hardware:t}=n;return e.jsx(Ie,{hardware:t})}function cc(n){var x,j,N,I;const{properties:t}=n,o=(x=t.vgap)==null?void 0:x.slice(9),s=k(o),r=te(o),a=(j=t.hgap)==null?void 0:j.slice(9),c=k(a),l=te(a),f=(N=t.voffset)==null?void 0:N.slice(9),u=k(f),d=te(f),p=(I=t.hoffset)==null?void 0:I.slice(9),m=k(p),g=te(p);function w(M,b){return M===null?null:{...M,actions:b}}return{vgap:w(s,r),hgap:w(c,l),voffset:w(u,d),hoffset:w(m,g)}}function lc(n){const{hardware:t,schema:o,operator:s,disabled:r,resolved:a}=n;return e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{variant:"secondary"}),e.jsx(i.Dropdown.Menu,{align:"end",popperConfig:{strategy:"fixed"},children:e.jsxs(i.Container,{children:[e.jsxs(i.Row,{className:"flex-nowrap",children:[e.jsx(i.Col,{sm:1,className:"d-flex",children:e.jsx("i",{className:"fa fa-fw fa-square",title:"Gap",style:{alignSelf:"center"}})}),e.jsx(i.Col,{sm:5,children:a.hgap&&e.jsx(Q,{hardware:a.hgap,options:{header:"none"},schema:o,disabled:r,operator:s})}),e.jsx(i.Col,{sm:1,className:"d-flex",children:e.jsx("span",{style:{alignSelf:"center"},children:"×"})}),e.jsx(i.Col,{sm:5,children:a.vgap&&e.jsx(Q,{hardware:a.vgap,options:{header:"none"},schema:o,disabled:r,operator:s})})]}),e.jsxs(i.Row,{className:"flex-nowrap",children:[e.jsx(i.Col,{sm:1,className:"d-flex",children:e.jsx("i",{className:"fa fa-fw fa-arrows-up-down-left-right ",title:"Offset",style:{alignSelf:"center"}})}),e.jsx(i.Col,{sm:5,children:a.hoffset&&e.jsx(Q,{hardware:a.hoffset,options:{header:"none"},schema:o,disabled:r,operator:s})}),e.jsx(i.Col,{sm:1,className:"d-flex",children:e.jsx("span",{style:{alignSelf:"center"},children:";"})}),e.jsx(i.Col,{sm:5,children:a.voffset&&e.jsx(Q,{hardware:a.voffset,options:{header:"none"},schema:o,disabled:r,operator:s})})]})]})})]})}function dc(n){const{hardware:t,options:o={}}=n,s=cc(t),{readonly:r=!1}=o;function a(m){var x,j;const g=((x=m==null?void 0:m.properties)==null?void 0:x.position)??null;if(g===null)return"∅";const w=o.precision??((j=m==null?void 0:m.properties)==null?void 0:j.display_digits)??void 0;return w!==void 0?g.toFixed(w):`${g}`}const[c,l,f,u,d,p]=h.useMemo(()=>{var b,_,S,C,G,B,$,q;const m=`${a(s.hgap)} × ${a(s.vgap)}`,g=((b=s.hgap)==null?void 0:b.properties.unit)??((_=s.vgap)==null?void 0:_.properties.unit)??"?",x=new Set([...((S=s.hgap)==null?void 0:S.properties.state)??[],...((C=s.vgap)==null?void 0:C.properties.state)??[]]).has("MOVING"),j=`${a(s.hoffset)} ; ${a(s.voffset)}`,N=((G=s.hoffset)==null?void 0:G.properties.unit)??((B=s.voffset)==null?void 0:B.properties.unit)??"?",M=new Set([...(($=s.hoffset)==null?void 0:$.properties.state)??[],...((q=s.voffset)==null?void 0:q.properties.state)??[]]).has("MOVING");return[m,g,x,j,N,M]},[s.hgap,s.hoffset,s.vgap,s.voffset]);return e.jsxs(i.InputGroup,{className:"w-100 flex-nowrap",children:[e.jsx(i.InputGroup.Text,{title:"Gap (horizontal and vertical)",children:e.jsx("i",{className:"fa fa-fw fa-square fa-2x"})}),e.jsx(A,{value:c,title:"Gap",className:P.default({"hw-moving":f})}),e.jsx(i.InputGroup.Text,{children:l}),e.jsx(i.InputGroup.Text,{title:"Offset (horizontal and vertical)",children:e.jsx("i",{className:"fa fa-fw fa-arrows-up-down-left-right fa-2x"})}),e.jsx(A,{value:u,title:"Offset",className:P.default({"hw-moving":p})}),e.jsx(i.InputGroup.Text,{children:d}),!r&&e.jsx(lc,{...n,resolved:s})]})}function vt(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Slit",icon:"fam-hardware-motor",online:t.online}),r=e.jsx(Ie,{hardware:t}),a=e.jsx(dc,{...n}),c=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const uc={default:vt,state:ac},fc=uc,pc="s1",mc="s1",hc=!0,xc={vgap:"hardware:s1vg",voffset:"hardware:s1vo",hgap:"hardware:s1hg",hoffset:"hardware:s1ho"},gc="slit",jc={id:pc,name:mc,online:hc,properties:xc,type:gc},wc="s1",yc="s1",vc=!0,Nc={vgap:"hardware:",voffset:"hardware:",hgap:"hardware:s1hg",hoffset:"hardware:s1ho"},bc="slit",_c={id:wc,name:yc,online:vc,properties:Nc,type:bc},$c="s1",Sc="s1",Cc=!0,Oc={vgap:"hardware:s1vg",voffset:"hardware:s1vo",hgap:"hardware:",hoffset:"hardware:"},Ic="slit",Mc={id:$c,name:Sc,online:Cc,properties:Oc,type:Ic},Tc={default:jc,horizontal:_c,vertical:Mc};function Fc(n){const{hardware:t}=n,o=()=>{t.actions.call(t.properties.state==="ON"?"off":"on")},s={Voltage:`${t.properties.voltage.toFixed(0)} V`,Current:`${(t.properties.current*1e3).toFixed(2)} mA`};return e.jsx(i.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"popid",children:[e.jsxs(i.Popover.Header,{children:[t.name," Details"]}),e.jsxs(i.Popover.Body,{children:[e.jsx("h6",{children:"Status"}),e.jsx("pre",{children:t.properties.status}),e.jsx("h6",{children:"Properties"}),e.jsx(i.Container,{children:D.map(s,(r,a)=>e.jsxs(i.Row,{children:[e.jsxs(i.Col,{children:[a,":"]}),e.jsx(i.Col,{children:r})]},a))}),e.jsx("div",{className:"d-grid gap-2",children:e.jsx(i.Button,{disabled:n.disabled,onClick:o,variant:t.properties.state==="ON"?"danger":"success",children:t.properties.state==="ON"?"Off":"On"})})]})]}),children:e.jsx(i.Button,{title:"Pump Details",children:e.jsx("i",{className:"fa fa-ellipsis-h"})})})}function Nt(n){const{hardware:t,options:o={}}=n;return e.jsxs("div",{className:"hw-component",children:[e.jsxs("div",{className:"hw-head",children:[e.jsx(y,{name:"Pump",icon:"fam-hardware-pump",online:t.online}),e.jsx("div",{className:"name",children:t.name}),e.jsx(i.Badge,{bg:t.properties.state==="ON"?"success":"danger",children:t.properties.state})]}),e.jsx("div",{className:"hw-content",children:e.jsxs(i.InputGroup,{children:[e.jsx(i.Form.Control,{value:t.properties.pressure.toExponential(o.precision||3),disabled:!0}),(t.properties.unit||o.unit)&&e.jsx(i.InputGroup.Text,{children:t.properties.unit||o.unit}),e.jsx(Fc,{...n})]})})]})}const Dc={default:Nt},Ac=Dc,Rc=["off","on"],Ec="ip121",kc="ip121",Pc=!0,Gc={current:.0003000000142492354,pressure:26000000730164174e-23,state:"ON",status:`Pump is ON
30
30
  Modes: Step/Protect
31
31
  ID21/v-var-ctrl/121 - Serial line OK
32
32
  Pump size: 75-55-40 SC/T
33
- `,voltage:6998},Rc="tango",Ec=!0,kc="pump",Pc={callables:Mc,id:Tc,name:Fc,online:Dc,properties:Ac,protocol:Rc,require_staff:Ec,type:kc},Gc={default:Pc};function Me(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={RETRACTED:"success",IN_TOUCH:"warning",MOVING_IN:"warning",MOVING_OUT:"warning",UNKNOWN:"danger",OFFLINE:"warning"},r=s[o]||s.UNKNOWN;return e.jsx(F,{state:o,minWidth:6,variant:r})}function Bc(n){const{hardware:t}=n;return e.jsx(Me,{hardware:t})}function Vc(n){const{className:t,hardware:o,options:s={}}=n,{state:r}=o.properties??"OFFLINE",c=!(r==="IN_TOUCH")||n.disabled;function l(f){const{distance:u}=f,[d,p]=h.useState(!1);return e.jsx(i.Button,{variant:"secondary",onClick:()=>{p(!0),o.actions.call("push",u).finally(()=>{p(!1)})},disabled:c,children:e.jsxs("span",{className:"text-nowrap",children:[e.jsx("i",{className:d?"fa-solid fa-fw fa-cog fa-spin":"fa fa-fw fa-arrow-left"})," ",u]})})}return e.jsxs("div",{className:t,style:{display:"grid",gridTemplateRows:"min-content min-content min-content",gridTemplateColumns:"min-content min-content min-content",gridGap:"1px"},children:[e.jsx(l,{distance:5}),e.jsx(l,{distance:.5}),e.jsx(l,{distance:.05}),e.jsx(l,{distance:2}),e.jsx(l,{distance:.2}),e.jsx(l,{distance:.02}),e.jsx(l,{distance:1}),e.jsx(l,{distance:.1}),e.jsx(l,{distance:.01})]})}function Lc(n){const{hardware:t,options:o,disabled:s}=n,{state:r}=t.properties??"OFFLINE",a=r==="RETRACTED",c=r==="IN_TOUCH",[l,f]=h.useState(!1),[u,d]=h.useState(!1),p=a?"ms-auto":c?"ms-0":"mx-auto";return e.jsxs("div",{style:{display:"grid",gridTemplateRows:"min-content min-content",gridTemplateColumns:"min-content auto",gridGap:"1px"},children:[e.jsx("i",{className:`${c?"fas fa-dizzy":"fa fa-smile"} fa-3x my-auto`}),e.jsx(Vc,{className:p,...n}),e.jsx("span",{}),e.jsxs(i.ButtonGroup,{className:"mx-auto",style:{width:"12em"},children:[e.jsx(i.Button,{onClick:()=>{f(!0),t.actions.call("move_in").finally(()=>{f(!1)})},disabled:c||s||l||u,style:{width:"5em"},children:e.jsxs("span",{className:"text-nowrap",children:[e.jsx("i",{className:l?"fa-solid fa-fw fa-cog fa-spin":"fa fa-fw fa-arrow-left"})," ","In"]})}),e.jsx(i.Button,{onClick:()=>{d(!0),t.actions.call("move_out").finally(()=>{d(!1)})},disabled:a||s||l||u,style:{width:"5em"},children:e.jsxs("span",{className:"text-nowrap",children:["Out"," ",e.jsx("i",{className:u?"fa-solid fa-fw fa-cog fa-spin":"fa fa-fw fa-arrow-right"})]})})]})]})}function vt(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Pusher",icon:"fa-hand-point-right",online:t.online}),r=e.jsx(Me,{hardware:t});function a(){return e.jsx(Lc,{...n})}const c=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a(),headerMode:c})}const Uc={default:vt,state:Bc},Hc=Uc,qc=["move_in","move_out","push","sync_hard"],zc="pusher",Wc="pusher",Yc=!0,Kc={state:"RETRACTED"},Qc="bliss",Xc=!1,Jc="pusher",Zc={callables:qc,id:zc,name:Wc,online:Yc,properties:Kc,protocol:Qc,require_staff:Xc,type:Jc},el={default:Zc};function tl(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=h.useState("RETRACTED");async function c(u,d){if(u==="move_in"){a("MOVING_IN"),await A(2e3),a("IN_TOUCH");return}if(u==="move_out"){a("MOVING_OUT"),await A(2e3),a("RETRACTED");return}if(u==="push"){await A(100);return}console.log("PusherSimulator: Unsupported call",u,d)}async function l(u,d){console.log("PusherSimulator: Unsupported setProperty",u,d)}const f={state:r};return e.jsx(U,{name:t,alias:o,type:"pusher",call:c,setProperty:l,properties:f,useHardwareContext:s})}function we(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={STOPPED:"danger",STARTING:"warning",RUNNING:"success",BACKOFF:"warning",STOPPING:"warning",EXITED:"secondary",FATAL:"fatal",UNKNOWN:"fatal",OFFLINE:"secondary"},r=s[o]||s.UNKNOWN;return e.jsx(F,{state:o,minWidth:6,variant:r})}function nl(n){const{hardware:t}=n;return e.jsx(we,{hardware:t})}function Nt(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Shutter",icon:"fa-cog",online:t.online}),r=e.jsx(we,{hardware:t});function a(){t.actions.call("start")}function c(){t.actions.call("restart")}function l(){t.actions.call("stop")}function f(){return t.properties?t.properties.state:"UNKNOWN"}function u(b){return b.charAt(0).toUpperCase()+b.slice(1).toLowerCase()}const d=f(),p=u(d),g={STOPPED:"danger",STARTING:"warning",RUNNING:"success",BACKOFF:"warning",STOPPING:"warning",EXITED:"secondary",FATAL:"fatal",UNKNOWN:"secondary",OFFLINE:"secondary"}[d]||"danger";function w(){const b=d==="RUNNING"||d==="STARTING";return{icon:b?"fa fa-refresh fa-wp":"fa fa-play fa-wp",variant:n.disabled?"":"success",callback:d==="RUNNING"?c:a,disabled:n.disabled,title:n.operator?b?"Restart the service":"Start the serStaticTextInputvice":"You dont have the control to the session"}}function x(){const b=d==="RUNNING"||d==="STARTING";return{icon:"fa fa-stop fa-wp",variant:n.disabled?"":b?"danger":"secondary",callback:l,disabled:n.disabled,title:n.operator?"Stop the service":"You dont have the control to the session"}}const j=w(),N=x(),M=e.jsxs(i.InputGroup,{className:"d-flex flex-nowrap",children:[e.jsx(R,{variant:g,className:"text-center",style:{minWidth:"8em"},value:p}),e.jsx(i.Button,{style:{width:"2.5em"},variant:"light",className:`px-0 text-${j.variant}`,onClick:j.callback,disabled:j.disabled,title:j.title,children:e.jsx("i",{className:`${j.icon}`})}),e.jsx(i.Button,{style:{width:"2.5em"},variant:"light",className:`px-0 text-${N.variant}`,onClick:N.callback,disabled:N.disabled,title:N.title,children:e.jsx("i",{className:`${N.icon}`})})]}),T=n.options.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:M,headerMode:T})}function ol(n){var f;const{hardware:t,options:o={}}=n;function s(){t.actions.call("start")}function r(){t.actions.call("restart")}function a(){t.actions.call("stop")}const c=((f=t.properties)==null?void 0:f.state)??"UNKNOWN",l=c==="STOPPING"||c==="STARTING";return e.jsx(i.OverlayTrigger,{trigger:"click",rootClose:!0,placement:o.dropDirection==="up"?"top":"bottom",overlay:e.jsx(i.Popover,{id:"service-protected-overlay",children:e.jsxs(i.Popover.Body,{children:[e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center",children:"Actions"})}),e.jsx(i.Row,{children:e.jsxs(i.Col,{children:[c==="RUNNING"&&e.jsxs(i.Button,{className:"me-1 text-success border-secondary",variant:"light",onClick:()=>{r()},disabled:n.disabled,title:"Restart the service",children:[e.jsx("i",{className:"fa fa-refresh fa-wp me-1"}),"Restart"]}),c!=="RUNNING"&&e.jsxs(i.Button,{className:"me-1 text-success border-secondary",variant:"light",onClick:()=>{s()},disabled:n.disabled,title:"Start the service",children:[e.jsx("i",{className:"fa fa-play fa-wp me-1"}),"Start"]}),e.jsxs(i.Button,{className:`text-${c!=="STOPPED"?"danger":"primary"} border-secondary`,variant:"light",onClick:()=>{a()},disabled:n.disabled,title:"Stop the service",children:[e.jsx("i",{className:"fa fa-stop fa-wp me-1"}),"Stop"]})]})})]})}),children:e.jsx(i.Button,{disabled:n.disabled||l,children:e.jsx("i",{className:`fa fa-caret-${o.dropDirection==="up"?"up":"down"}`})})})}function bt(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Shutter",icon:"fa-cog",online:t.online}),r=e.jsx(we,{hardware:t});function a(){return t.properties?t.properties.state:"UNKNOWN"}function c(g){return g.charAt(0).toUpperCase()+g.slice(1).toLowerCase()}const l=a(),u={STOPPED:"danger",STARTING:"warning",RUNNING:"success",BACKOFF:"warning",STOPPING:"warning",EXITED:"secondary",FATAL:"fatal",UNKNOWN:"fatal",OFFLINE:"secondary"}[l],d=c(l),p=e.jsxs(i.InputGroup,{className:"d-flex flex-nowrap",children:[e.jsx(R,{variant:u,style:{minWidth:"10em"},value:d,className:"text-center"}),e.jsx(ol,{...n})]}),m=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:p,headerMode:m})}const sl={default:Nt,protected:bt,state:nl},rl=sl,il=["start","stop","restart"],al="service1",cl="service1",ll=!0,dl={state:"RUNNING"},ul="multivisor",fl=!0,pl="service",ml={callables:il,id:al,name:cl,online:ll,properties:dl,protocol:ul,require_staff:fl,type:pl},hl={default:ml};function ye(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={UNKNOWN:"danger",READY:"success"},r=s[o]||s.UNKNOWN;return e.jsx(F,{state:o,minWidth:6,variant:r})}function xl(n){const{hardware:t}=n;return e.jsx(ye,{hardware:t})}function gl(n){const{motion:t}=n,s=t.axisRef.slice(9),r=E(s),a=(r==null?void 0:r.alias)??(r==null?void 0:r.name)??(r==null?void 0:r.id)??s;return e.jsx("div",{className:"my-auto",children:a})}function jl(n){const{motion:t,actions:o,disabled:s}=n,r=t.axisRef;function a(){o.call("update_axis",{axis_ref:r})}return e.jsx(i.Button,{variant:"danger",onClick:a,disabled:s,children:e.jsx("i",{className:"fa fa-trash"})})}function wl(n){const{motion:t,actions:o,axisRef:s,disabled:r}=n,a=h.useMemo(()=>{for(const d of t)if(d.axisRef===s)return!0;return!1},[t,s]),c=s.slice(9),l=E(c),f=(l==null?void 0:l.alias)??(l==null?void 0:l.name)??(l==null?void 0:l.id)??c;function u(){o.call("update_axis",{axis_ref:s,relative_position:0})}return e.jsx(i.Button,{className:"ms-1",variant:a?"primary":"secondary",onClick:()=>{a||u()},title:a?"This axis is already part of the motion":"Use this axis in the motion",disabled:r,children:f})}function yl(n){var x;const{motion:t,actions:o}=n,s=t.axisRef,r=t.absolute_position??t.relative_position??0,a=s.slice(9),c=E(a),l=n.disabled||!(c!=null&&c.online),f=h.useRef(null),[u,d]=h.useState(!1),p=3,m=((x=c==null?void 0:c.properties)==null?void 0:x.unit)??"";function g(j){if(!f||!f.current)console.log("formRef not yet defined");else if(j.key==="Enter"){d(!1);const N=Number.parseFloat(f.current.value);o.call("update_axis",{axis_ref:s,absolute_position:t.absolute_position!==null?N:null,relative_position:t.relative_position!==null?N:null})}else j.key==="Escape"?(f.current.value=r.toFixed(p),d(!1)):console.log(j.key)}function w(j){const{value:N}=j.target;if(N===void 0)return;const M=Number.parseFloat(N);M!==r&&!u&&d(!0),M===r&&u&&d(!1)}return h.useEffect(()=>{!f||!f.current?console.log("formRef not yet defined"):u||(f.current.value=r.toFixed(p))},[u,r]),e.jsxs(i.InputGroup,{className:"w-100",children:[e.jsx(i.Form.Control,{className:u?"form-control-edited":"",type:"number",ref:f,defaultValue:r.toFixed(p),onChange:w,disabled:l,onKeyDown:g}),e.jsx(i.InputGroup.Text,{children:m})]})}function vl(n){const{actions:t,motion:o,disabled:s}=n;function r(){t.call("update_axis",{axis_ref:o.axisRef,absolute_position:o.absolute_position??o.relative_position})}function a(){t.call("update_axis",{axis_ref:o.axisRef,relative_position:o.absolute_position??o.relative_position})}return e.jsxs(i.ButtonGroup,{children:[e.jsx(i.Button,{onClick:r,variant:o.absolute_position!==null?"primary":"secondary",disabled:s,children:"Abs"}),e.jsx(i.Button,{onClick:a,variant:o.relative_position!==null?"primary":"secondary",disabled:s,children:"Rel"})]})}function _t(n){const{hardware:t,options:o={},disabled:s}=n,{properties:r}=t,a=e.jsx(y,{name:"TomoFlatMotion",icon:"fam-hardware-camera",online:t.online}),c=e.jsx(ye,{hardware:t}),l=e.jsxs(i.Container,{children:[e.jsxs(i.Row,{className:"mt-1",children:[e.jsx(i.Col,{xs:3,children:"Move in parallel"}),e.jsx(i.Col,{xs:9,children:r.move_in_parallel?"true":"false"})]}),e.jsxs(i.Row,{className:"mt-1",children:[e.jsx(i.Col,{xs:3,children:"Switch power on/off"}),e.jsx(i.Col,{xs:9,children:r.power_onoff?"true":"false"})]}),e.jsxs(i.Row,{className:"mt-1",children:[e.jsx(i.Col,{xs:3,children:"Settle time"}),e.jsxs(i.Col,{xs:9,children:[r.settle_time.toFixed(2)," ",e.jsx("span",{title:"seconds",children:"s"})]})]}),e.jsxs(i.Row,{className:"mt-1",children:[e.jsx(i.Col,{xs:3,children:"Available axes"}),e.jsx(i.Col,{xs:9,children:r.available_axes.map(u=>e.jsx(wl,{axisRef:u,motion:r.motion,actions:t.actions,disabled:s},u))})]}),e.jsxs(i.Row,{className:"mt-1",children:[e.jsx(i.Col,{xs:3,children:"Actual motion"}),e.jsx(i.Col,{xs:9,children:e.jsxs("div",{style:{display:"grid",gridGap:5,gridTemplateColumns:"min-content min-content auto min-content"},children:[e.jsx("div",{children:"Axis"}),e.jsx("div",{children:"Kind"}),e.jsx("div",{children:"Displacement"}),e.jsx("div",{}),r.motion.map((u,d)=>e.jsxs(h.Fragment,{children:[e.jsx(gl,{motion:u}),e.jsx(vl,{motion:u,actions:t.actions,disabled:s}),e.jsx(yl,{motion:u,actions:t.actions,disabled:s}),e.jsx(jl,{motion:u,actions:t.actions,disabled:s})]},`motion${d}`))]})})]})]}),f=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:a,widgetState:c,widgetContent:l,headerMode:f})}function Nl(n){var b;const{motion:t,actions:o}=n,s=t.axisRef,r=t.absolute_position??t.relative_position??0,a=s.slice(9),c=E(a),l=n.disabled||!(c!=null&&c.online),f=h.useRef(null),[u,d]=h.useState(!1),p=3,m=((b=c==null?void 0:c.properties)==null?void 0:b.unit)??"",g=(c==null?void 0:c.alias)??(c==null?void 0:c.name)??(c==null?void 0:c.id)??"none";function w(_){if(!f||!f.current)console.log("formRef not yet defined");else if(_.key==="Enter"){d(!1);const S=Number.parseFloat(f.current.value);o.call("update_axis",{axis_ref:s,absolute_position:t.absolute_position!==null?S:null,relative_position:t.relative_position!==null?S:null})}else _.key==="Escape"?(f.current.value=r.toFixed(p),d(!1)):console.log(_.key)}function x(_){const{value:S}=_.target;if(S===void 0)return;const C=Number.parseFloat(S);C!==r&&!u&&d(!0),C===r&&u&&d(!1)}h.useEffect(()=>{!f||!f.current?console.log("formRef not yet defined"):u||(f.current.value=r.toFixed(p))},[u,r]);function j(){return t.absolute_position!==null?["ABS","warning","Absolute displacement"]:t.relative_position!==null?["REL","none","Relative displacement"]:["ERR","danger","Unknown motion kind"]}const[N,M,T]=j();return e.jsxs(i.InputGroup,{className:"w-100 flex-nowrap",children:[e.jsx(i.InputGroup.Text,{title:"Displacement to apply on this axis to take a flat",style:{width:"5em"},children:g}),e.jsx(i.InputGroup.Text,{className:`bg-${M}`,title:T,style:{width:"3em"},children:N}),e.jsx(i.Form.Control,{className:u?"form-control-edited":"",type:"number",ref:f,defaultValue:r.toFixed(p),onChange:x,disabled:l,onKeyDown:w}),e.jsx(i.InputGroup.Text,{children:m})]})}function $t(n){const{hardware:t,options:o={},disabled:s}=n,{properties:r}=t,a=e.jsx(y,{name:"TomoFlatMotion",icon:"fam-hardware-camera",online:t.online}),c=e.jsx(ye,{hardware:t}),l=e.jsxs(e.Fragment,{children:[r.motion.length===0&&e.jsx(i.Alert,{variant:"danger",className:"mb-0",children:"No flat motion defined"}),r.motion.length>0&&e.jsx(i.Stack,{direction:"vertical",children:r.motion.map((u,d)=>e.jsx(Nl,{actions:t.actions,motion:u,disabled:s},u.axisRef))})]}),f=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:a,widgetState:c,widgetContent:l,headerMode:f})}const bl={default:_t,small:$t,state:xl},_l=bl;function St(n){return n.type==="tomoflatmotion"}function $l(n){const t=P(n);return t===null||!St(t)?null:t}const Sl="tomoflatmotion",Cl="tomoflatmotion",Ol=!0,Il={state:"READY",settle_time:2,power_onoff:!1,move_in_parallel:!0,available_axes:["hardware:sy","hardware:sy2"],motion:[{axisRef:"hardware:sy",absolute_position:null,relative_position:1}]},Ml="bliss",Tl=!1,Fl="tomoflatmotion",Dl={id:Sl,name:Cl,online:Ol,properties:Il,protocol:Ml,require_staff:Tl,type:Fl},Al=["move","stop","wait","rmove"],Rl="sy",El="sy",kl=!0,Pl={offset:0,sign:1,acceleration:300,limits:[-999999999,999999999],position:235.165400001,state:["READY"],tolerance:1e-4,unit:"um",velocity:1e3,display_digits:4},Gl="bliss",Bl=!1,Vl="motor",Ll=[],Ul={callables:Al,id:Rl,name:El,online:kl,properties:Pl,protocol:Gl,require_staff:Bl,type:Vl,user_tags:Ll},Hl=["move","stop","wait","rmove"],ql="sy2",zl="sy2",Wl=!0,Yl={offset:0,sign:1,acceleration:300,limits:[-999999999,999999999],position:235.165400001,state:["READY"],tolerance:1e-4,unit:"um",velocity:1e3,display_digits:4},Kl="bliss",Ql=!1,Xl="motor",Jl=[],Zl={callables:Hl,id:ql,name:zl,online:Wl,properties:Yl,protocol:Kl,require_staff:Ql,type:Xl,user_tags:Jl},ed={default:Dl,sy:Ul,sy2:Zl};function td(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=h.useState({state:"READY",settle_time:2,power_onoff:!1,move_in_parallel:!0,available_axes:["hardware:sy","hardware:sy2"],motion:[{axisRef:"hardware:sy",absolute_position:null,relative_position:1}]});function c(u,d){const p=[];let m=!1;return u.motion.forEach(g=>{if(g.axisRef===d.axis_ref){if(m=!0,d.relative_position===void 0&&d.absolute_position===void 0)return;p.push({axisRef:d.axis_ref,relative_position:d.relative_position??null,absolute_position:d.absolute_position??null});return}p.push(g)}),m||p.push({axisRef:d.axis_ref,relative_position:d.relative_position??null,absolute_position:d.absolute_position??null}),{...u,motion:p}}async function l(u,d){if(u==="update_axis"){a(p=>c(p,d));return}console.log("TomoFlatMotionSimulator: Unsupported call",u,d)}async function f(u,d){console.log("TomoFlatMotionSimulator: Unsupported setProperty",u,d)}return e.jsx(U,{name:t,alias:o,type:"tomoflatmotion",call:l,setProperty:f,properties:r,useHardwareContext:s})}function Ct(n){const{hardware:t,options:o={},disabled:s}=n,{actions:r}=t,a=e.jsx(y,{name:"TomoReferencePositionSchema",icon:"fam-hardware-motor",online:t.online});function c(){r.call("move_to_reference")}const l=e.jsx(e.Fragment,{}),f=e.jsx(i.Button,{className:"w-100",onClick:()=>{c()},disabled:s,children:"Back to parking position"}),u=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:a,widgetState:l,widgetContent:f,headerMode:u})}function nd(n){return n.type==="tomoreferenceposition"}const od={default:Ct},sd=od;function ve(n){const{hardware:t}=n,{online:o,locked:s=null}=t,r=o?(s!==null?"LOCKED":t.properties.state)||"UNKNOWN":"OFFLINE",a={UNKNOWN:"danger",READY:"success",OFFLINE:"secondary",INVALID:"danger",MOUNTING:"warning",UNMOUNTING:"warning",LOCKED:"warning"},c=a[r]||a.UNKNOWN;return e.jsx(F,{state:r,minWidth:6,variant:c})}function rd(n){const{hardware:t}=n;return e.jsx(ve,{hardware:t})}function id(n){const{hardware:t,options:o={}}=n;function s(a){return t.actions?t.actions.setProperty("sample_pixel_size_mode",a):console.error("Change request was triggered with:",a),null}const r=t.properties.sample_pixel_size_mode;return e.jsx(i.Dropdown,{style:n.style,children:e.jsxs(i.ButtonGroup,{children:[e.jsx(i.Button,{variant:r==="USER"?"primary":"secondary",onClick:()=>{s("USER")},disabled:n.disabled,title:"Use a fixed pixel size defined by the user",children:"USER"}),e.jsx(i.Button,{variant:r==="AUTO"?"primary":"secondary",onClick:()=>{s("AUTO")},disabled:n.disabled,title:"Compute the pixel size automatically based on the beamline geometry",children:"AUTO"})]})})}function ad(n){const{hardware:t,options:o={}}=n,s=t.properties.user_sample_pixel_size||0,{state:r}=t.properties,a=r==="READY";function c(l){return t.actions?t.actions.setProperty("user_sample_pixel_size",l):console.error("Change request was triggered with:",l),null}return e.jsx(ne,{hardwareValue:s,onMoveRequested:c,hardwareIsDisabled:!1,hardwareIsReady:a,hardwareIsMoving:!1,readOnly:t.properties.sample_pixel_size_mode!=="USER"})}function cd(n){const{hardware:t,options:o={}}=n;return t.properties.state,e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{disabled:n.disabled,variant:"secondary"}),e.jsx(i.Dropdown.Menu,{popperConfig:{strategy:"fixed"},children:e.jsxs(i.Container,{children:[e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center",children:"Mode"})}),e.jsx(i.Row,{children:e.jsx(i.Col,{children:e.jsx(id,{...n,style:{width:"100%"}})})}),e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center mt-1",children:"User pixel size"})}),e.jsx(i.Row,{children:e.jsx(i.Col,{children:e.jsxs(i.InputGroup,{children:[e.jsx(ad,{...n}),e.jsx(i.InputGroup.Text,{children:"um"})]})})})]})})]})}function ld(n,t,o){return h.useMemo(()=>{function s(c){return c==="um"?"μm":c}function r(c){return c.toFixed(2).replace(/\.?0+$/,"")}if(n==null)return["∅",""];if(t===o)return[r(n),s(o)];const a=pn.default(n,t);return[r(a.to(o).scalar),s(o)]},[n,t,o])}function Ot(n){const{hardware:t,options:o={}}=n,s=o.display_unit??"um",r=e.jsx(y,{name:"TomoDetector",icon:"fa-cog",online:t.online}),a=e.jsx(ve,{hardware:t}),[c,l]=ld(t.properties.sample_pixel_size,"um",s),f=e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(i.InputGroup.Text,{className:"justify-content-center",style:{minWidth:"4em"},children:t.properties.sample_pixel_size_mode}),e.jsx(R,{value:c,title:`${t.properties.sample_pixel_size} um`}),e.jsx(i.InputGroup.Text,{children:l}),e.jsx(cd,{...n})]}),u=n.options?n.options.header:"top";return e.jsx(v,{hardware:t,widgetIcon:r,widgetState:a,widgetContent:f,headerMode:u})}function dd(n){const{hardware:t,options:o={}}=n;function s(a){return t.actions?t.actions.setProperty("acq_mode",a):console.error("Change request was triggered with:",a),null}const r=t.properties.acq_mode;return e.jsx(i.Dropdown,{style:n.style,children:e.jsxs(i.ButtonGroup,{children:[e.jsx(i.Button,{variant:r==="SINGLE"?"primary":"secondary",onClick:()=>{s("SINGLE")},disabled:n.disabled,title:"Do acquisition in a single shot",children:"SINGLE"}),e.jsx(i.Button,{variant:r==="ACCUMULATION"?"primary":"secondary",onClick:()=>{s("ACCUMULATION")},disabled:n.disabled,title:"Do acqisition in multiple sub frame with accumulation",children:"ACCU"})]})})}function ud(n){const{hardware:t,actions:o}=n,s=t.properties.acc_max_expo_time||0,{state:r}=t.properties,a=r==="READY";function c(l){return o.setProperty("acc_max_expo_time",l),null}return e.jsx(ne,{hardwareValue:s,onMoveRequested:c,hardwareIsDisabled:!1,hardwareIsReady:a,hardwareIsMoving:!1,readOnly:t.properties.state!=="READY"})}function fd(n){const t=P(n);return t!==null&&xe(t)?t:null}function pd(n){var c;const{hardware:t}=n,{properties:o}=t,s=((c=o.detector)==null?void 0:c.slice(9))??"",r=fd(s),a=ee(s);return e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{disabled:n.disabled,variant:"secondary"}),e.jsx(i.Dropdown.Menu,{popperConfig:{strategy:"fixed"},children:e.jsxs(i.Container,{children:[e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center",children:"Acquisition mode"})}),e.jsx(i.Row,{children:e.jsx(i.Col,{children:e.jsx(dd,{...n,style:{width:"100%"}})})}),e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center mt-1",children:"Max sub frame exposition"})}),e.jsx(i.Row,{children:e.jsx(i.Col,{children:r&&e.jsxs(i.InputGroup,{children:[e.jsx(ud,{hardware:r,actions:a}),e.jsx(i.InputGroup.Text,{children:"um"})]})})})]})})]})}function It(n){const{hardware:t}=n,o=e.jsx(y,{name:"TomoDetector",icon:"fa-cog",online:t.online}),s=e.jsx(ve,{hardware:t}),r=e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(R,{value:t.properties.acq_mode}),e.jsx(pd,{...n})]}),a=n.options?n.options.header:"top";return e.jsx(v,{hardware:t,widgetIcon:o,widgetState:s,widgetContent:r,headerMode:a})}const md={samplepixelsize:Ot,acquisitionmode:It,state:rd},hd=md;function Te(n){return n.type==="tomodetector"}function xd(n){const t=P(n);return t===null||!Te(t)?null:t}const gd="tomodetector",jd="tomodetector",wd=!0,yd={state:"READY",actual_size:[1024,1024],sample_pixel_size_mode:"AUTO",user_sample_pixel_size:50,sample_pixel_size:48},vd="bliss",Nd=!1,bd="tomodetector",_d={id:gd,name:jd,online:wd,properties:yd,protocol:vd,require_staff:Nd,type:bd},$d={default:_d};function Fe(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={READY:"success",MOUNTING:"warning",UNMOUNTING:"warning",UNKNOWN:"fatal",OFFLINE:"warning"},r=s[o]||s.UNKNOWN;return e.jsx(F,{state:o,minWidth:6,variant:r})}function Sd(n){const{hardware:t}=n;return e.jsx(Fe,{hardware:t})}function te(n){return!n||!n.startsWith("hardware:")?null:n.slice(9)}function Cd(n){const{hardware:t}=n,{properties:o}=t,{detectors:s}=o,r=te(o.active_detector),a=te(o.target_detector),c=o.state==="READY",l=n.disabled||!t.online||!c;function f(d){t.actions?t.actions.call("mount",d):console.error("Change request was triggered with:",d)}function u(d){const p=te(d),g=p===(a||r)?"fa fa-fw fa-dot-circle-o":"fa fa-fw fa-circle-o";return e.jsxs(i.Dropdown.Item,{disabled:l,onClick:()=>{f(p)},children:[e.jsx("i",{className:g}),"  ",p]},d)}return e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{disabled:l,variant:"secondary"}),e.jsx(i.Dropdown.Menu,{popperConfig:{strategy:"fixed"},children:s.map(d=>u(d))})]})}function Mt(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Optic",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(Fe,{hardware:t}),{properties:a}=t,c=a.state==="MOUNTING",l=te(a.active_detector),f=te(a.target_detector);function u(){return e.jsxs(i.InputGroup,{children:[e.jsx(R,{className:k.default({"hw-moving":c}),value:f||l||"No detector"}),e.jsx(Cd,{...n})]})}const d=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:u(),headerMode:d})}const Od={default:Mt,state:Sd},Id=Od;function Tt(n){return n.type==="tomodetectors"}function Md(n){const t=P(n);return t===null||!Tt(t)?null:t}const Td="tomodetectors",Fd="tomodetectors",Dd=!0,Ad={state:"READY",active_detector:"hardware:limadetector1",detectors:["hardware:limadetector1","hardware:limadetector2","hardware:limadetector3"]},Rd="bliss",Ed=!1,kd="optic",Pd={id:Td,name:Fd,online:Dd,properties:Ad,protocol:Rd,require_staff:Ed,type:kd},Gd={default:Pd};function K(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={READY:"success",BLOCKED:"secondary",ACQUIRING:"warning",UNKNOWN:"fatal"},r=s[o]||s.UNKNOWN;return e.jsx(F,{state:o,minWidth:6,variant:r})}function Bd(n){const{hardware:t}=n;return e.jsx(K,{hardware:t})}function Vd(n){const{hardware:t}=n,o=t.properties.update_on_move,s=n.disabled||!t.online;function r(c){t.actions.setProperty("update_on_move",!1)}function a(c){t.actions.setProperty("update_on_move",!0)}return e.jsxs(i.ButtonGroup,{className:"me-2",children:[e.jsx(i.InputGroup.Text,{children:"Update mode"}),e.jsx(i.Button,{onClick:a,disabled:s,variant:o?"primary":"secondary",children:"Auto"}),e.jsx(i.Button,{onClick:r,disabled:s,variant:o?"secondary":"primary",children:"Off"})]})}function Ld(n){const{hardware:t}=n,o=t.properties.exposure_time??0,s=n.disabled||!t.online,r=h.useRef(null),[a,c]=h.useState(!1),l=2;function f(d){!r||!r.current?console.log("formRef not yet defined"):d.key==="Enter"?(c(!1),t.actions.setProperty("exposure_time",Number.parseFloat(r.current.value))):d.key==="Escape"&&(r.current.value=o.toFixed(l),c(!1))}function u(d){const{value:p}=d.target;if(p===void 0)return;const m=Number.parseFloat(p);m!==o&&!a&&c(!0),m===o&&a&&c(!1)}return h.useEffect(()=>{!r||!r.current?console.log("formRef not yet defined"):a||(r.current.value=o.toFixed(l))},[a,o]),e.jsxs(i.InputGroup,{className:"me-2",children:[e.jsx(i.InputGroup.Text,{children:"Exposure time"}),e.jsx(i.Form.Control,{className:a?"form-control-edited":"",type:"number",ref:r,defaultValue:o.toFixed(l),onChange:u,disabled:s,onKeyDown:f}),e.jsx(i.InputGroup.Text,{children:"s"})]})}function Ud(n){const{hardware:t}=n,o=n.disabled||!t.online;function s(c){t.actions.call("take_proj")}function r(c){t.actions.call("take_dark")}function a(c){t.actions.call("take_flat")}return e.jsxs(i.ButtonGroup,{size:"lg",className:"me-2",children:[e.jsx(i.InputGroup.Text,{children:"Take"}),e.jsx(i.Button,{onClick:s,disabled:o,variant:"primary",children:"Proj"}),e.jsx(i.Button,{onClick:a,disabled:o,variant:"primary",children:"Flat"}),e.jsx(i.Button,{onClick:r,disabled:o,variant:"primary",children:"Dark"})]})}function Ft(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"TomoImaging",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(K,{hardware:t}),a=e.jsxs(i.Container,{children:[e.jsx(i.Row,{className:"mt-1",children:e.jsx(i.Col,{children:e.jsx(Vd,{hardware:t,disabled:n.disabled})})}),e.jsx(i.Row,{className:"mt-1",children:e.jsx(i.Col,{children:e.jsx(Ld,{hardware:t,disabled:n.disabled})})}),e.jsx(i.Row,{className:"mt-1",children:e.jsx(i.Col,{children:e.jsx(Ud,{hardware:t,disabled:n.disabled})})})]}),c=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Hd(n){const{hardware:t}=n,o=t.properties.exposure_time??0,s=n.disabled||!t.online,r=h.useRef(null),[a,c]=h.useState(!1),l=3;function f(d){!r||!r.current?console.log("formRef not yet defined"):d.key==="Enter"?(c(!1),t.actions.setProperty("exposure_time",Number.parseFloat(r.current.value))):d.key==="Escape"?(r.current.value=o.toFixed(l),c(!1)):console.log(d.key)}function u(d){const{value:p}=d.target;if(p===void 0)return;const m=Number.parseFloat(p);m!==o&&!a&&c(!0),m===o&&a&&c(!1)}return h.useEffect(()=>{!r||!r.current?console.log("formRef not yet defined"):a||(r.current.value=o.toFixed(l))},[a,o]),e.jsxs(i.InputGroup,{className:"w-100",children:[e.jsx(i.Form.Control,{className:a?"form-control-edited":"",type:"number",ref:r,defaultValue:o.toFixed(l),onChange:u,disabled:s,onKeyDown:f}),e.jsx(i.InputGroup.Text,{children:"s"})]})}function qd(n){const{exposureTime:t}=n,o=P("ACTIVE_TOMOCONFIG.ref.detectors.active_detector.detector"),s=P("ACTIVE_TOMOCONFIG.ref.detectors.active_detector");if(o===null||s===null)return e.jsx(e.Fragment,{});if(!xe(o)||!Te(s))return e.jsx(e.Fragment,{});const r=o.properties.acc_max_expo_time,a=s.properties.acq_mode;if(!r||a!=="ACCUMULATION")return e.jsx(e.Fragment,{});const[c,l]=ct(t,r);return e.jsxs("div",{className:"text-center",title:"Decompisiton of the accumulation",children:[c," × ",l.toFixed(3)]})}function Dt(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"TomoImaging",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(K,{hardware:t}),a=e.jsxs(e.Fragment,{children:[e.jsx(Hd,{hardware:t,disabled:n.disabled}),e.jsx(qd,{exposureTime:t.properties.exposure_time})]}),c=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function zd(n){const{hardware:t}=n,o=t.properties.settle_time||0,s=n.disabled||!t.online,r=h.useRef(null),[a,c]=h.useState(!1),l=3;function f(d){!r||!r.current?console.log("formRef not yet defined"):d.key==="Enter"?(c(!1),t.actions.setProperty("settle_time",Number.parseFloat(r.current.value))):d.key==="Escape"?(r.current.value=o.toFixed(l),c(!1)):console.log(d.key)}function u(d){const{value:p}=d.target;if(p===void 0)return;const m=Number.parseFloat(p);m!==o&&!a&&c(!0),m===o&&a&&c(!1)}return h.useEffect(()=>{!r||!r.current?console.log("formRef not yet defined"):a||(r.current.value=o.toFixed(l))},[a,o]),e.jsxs(i.InputGroup,{className:"w-100",children:[e.jsx(i.Form.Control,{className:a?"form-control-edited":"",type:"number",ref:r,defaultValue:o.toFixed(l),onChange:u,disabled:s,onKeyDown:f}),e.jsx(i.InputGroup.Text,{children:"s"})]})}function At(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"TomoImaging",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(K,{hardware:t}),a=e.jsx(zd,{hardware:t,disabled:n.disabled}),c=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Ne(n){const{text:t,processing:o,disabled:s,onClick:r,title:a}=n;return e.jsxs(i.Button,{onClick:r,disabled:s,variant:"primary",className:k.default({"ps-4":!o,"pe-4":!o}),title:a,children:[o&&e.jsx("i",{className:"fa-solid fa-cog fa-spin me-1"}),t]})}function Wd(n){const{hardware:t}=n,[o,s]=h.useState(!1),[r,a]=h.useState(!1),[c,l]=h.useState(!1),f=n.disabled||!t.online||o||r||c;function u(m){l(!0),t.actions.call("take_proj").finally(()=>{l(!1)})}function d(m){s(!0),t.actions.call("take_dark").finally(()=>{s(!1)})}function p(m){a(!0),t.actions.call("take_flat").finally(()=>{a(!1)})}return e.jsxs(i.ButtonGroup,{size:"lg",className:"w-100",children:[e.jsx(Ne,{onClick:u,disabled:f,processing:c,text:"Proj",title:"Take a projection"}),e.jsx(Ne,{onClick:p,disabled:f,processing:r,text:"Flat",title:"Take a flat"}),e.jsx(Ne,{onClick:d,disabled:f,processing:o,text:"Dark",title:"Take a dark"})]})}function Rt(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"TomoImaging",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(K,{hardware:t}),a=e.jsx(Wd,{hardware:t,disabled:n.disabled}),c=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Yd(n){const{hardware:t}=n,o=t.properties.update_on_move,s=n.disabled||!t.online;function r(c){t.actions.setProperty("update_on_move",!1)}function a(c){t.actions.setProperty("update_on_move",!0)}return e.jsxs(i.ButtonGroup,{className:"w-100",children:[e.jsx(i.Button,{onClick:a,disabled:s,variant:o?"primary":"secondary",children:"Auto"}),e.jsx(i.Button,{onClick:r,disabled:s,variant:o?"secondary":"primary",children:"Off"})]})}function Et(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"TomoImaging",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(K,{hardware:t}),a=e.jsx(Yd,{hardware:t,disabled:n.disabled}),c=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const Kd={default:Ft,exposuretime:Dt,settletime:At,actions:Rt,updatemode:Et,state:Bd},Qd=Kd,Xd="tomoimaging",Jd="tomoimaging",Zd=!0,eu={state:"READY",update_on_move:!1,exposure_time:1},tu="bliss",nu=!1,ou="optic",su={id:Xd,name:Jd,online:Zd,properties:eu,protocol:tu,require_staff:nu,type:ou},ru={default:su};function iu(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=h.useState({state:"READY",update_on_move:!0,exposure_time:1,settle_time:0});function c(u){a(d=>({...d,state:u}))}async function l(u,d){if(u==="take_dark"){c("ACQUIRING"),await A(2e3),c("READY");return}if(u==="take_flat"){c("ACQUIRING"),await A(2e3),c("READY");return}if(u==="take_proj"){c("ACQUIRING"),await A(2e3),c("READY");return}console.log("TomoImagingSimulator: Unsupported call",u,d)}async function f(u,d){a(p=>({...p,[u]:d}))}return e.jsx(U,{name:t,alias:o,type:"tomoimaging",call:l,setProperty:f,properties:r,useHardwareContext:s})}const au={},cu=au;function kt(n){return n.type==="tomosamplestage"}function lu(n){const t=P(n);return t===null||!kt(t)?null:t}function du(n){const{hardware:t}=n,o=t.properties.latency_time||0,s=n.disabled||!t.online,r=h.useRef(null),[a,c]=h.useState(!1),l=3;function f(d){!r||!r.current?console.log("formRef not yet defined"):d.key==="Enter"?(c(!1),t.actions.setProperty("latency_time",r.current.value)):d.key==="Escape"?(r.current.value=o.toFixed(l),c(!1)):console.log(d.key)}function u(d){const{value:p}=d.target;if(p===void 0)return;const m=Number.parseFloat(p);m!==o&&!a&&c(!0),m===o&&a&&c(!1)}return h.useEffect(()=>{!r||!r.current?console.log("formRef not yet defined"):a||(r.current.value=o.toFixed(l))},[a,o]),e.jsxs(i.InputGroup,{className:"w-100",children:[e.jsx(i.Form.Control,{className:a?"form-control-edited":"",type:"number",ref:r,defaultValue:o.toFixed(l),onChange:u,disabled:s,onKeyDown:f}),e.jsx(i.InputGroup.Text,{children:"s"})]})}function Pt(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"TomoImaging",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(e.Fragment,{}),a=e.jsx(du,{hardware:t,disabled:n.disabled}),c=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const uu={latencytime:Pt},fu=uu;function Gt(n){return n.type==="tomoconfig"}function pu(n){const t=P(n);return t===null||!Gt(t)?null:t}function Bt(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={READY:"success",MOVING:"warning",STABILIZING:"warning",INVALID:"danger",INVALID_DETECTOR_BINNING_CHANGED:"danger",INVALID_DETECTOR_DISTANCE_CHANGED:"danger",INVALID_DETECTOR_CHANGED:"danger"},r=s[o]||s.UNKNOWN;return e.jsx(F,{state:o,minWidth:6,variant:r})}function mu(n){const{hardware:t}=n;return e.jsx(Bt,{hardware:t})}const hu={state:mu},xu=hu;function Vt(n){return n.type==="tomoholo"}function gu(n){const t=P(n);return t===null||!Vt(t)?null:t}function ju(n){const{hardware:t}=n,o=()=>{t.actions.call("reset")};return e.jsx(i.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"popover",children:[e.jsxs(i.Popover.Header,{children:[t.name," Details"]}),e.jsxs(i.Popover.Body,{children:[e.jsx("h6",{children:"Status"}),e.jsx("pre",{children:t.properties.status}),e.jsx("div",{className:"d-grid gap-2",children:e.jsx(i.Button,{disabled:n.disabled,onClick:o,children:"Reset"})})]})]}),children:e.jsx(i.Button,{className:"flex-grow-0",title:"Valve Details",children:e.jsx("i",{className:"fa fa-ellipsis-h"})})})}function Lt(n){const{hardware:t,options:o={}}=n,s=()=>{t.actions.call(t.properties.state==="OPEN"?"close":"open")};return e.jsxs("div",{className:"hw-component",children:[e.jsxs("div",{className:"hw-head",children:[e.jsx(y,{name:"Valve",icon:"fam-hardware-valve",online:t.online}),e.jsx("div",{className:"name",children:t.name}),e.jsx(i.Badge,{bg:t.properties.state==="OPEN"||t.properties.state==="RUNNING"?"success":"danger",children:t.properties.state})]}),e.jsx("div",{className:"hw-content",children:e.jsxs(i.ButtonGroup,{className:"d-flex",children:[e.jsx(i.Button,{variant:t.properties.state==="OPEN"?"danger":"success",onClick:s,disabled:n.disabled,children:t.properties.state==="OPEN"?"Close":"Open"}),e.jsx(ju,{...n})]})})]})}const wu={default:Lt},yu=wu,vu=["close","reset","open"],Nu="rv12",bu="rv12",_u=!0,$u={state:"CLOSED",status:`Pneumatic is closed
34
- `},Su="tango",Cu=!1,Ou="valve",Iu={callables:vu,id:Nu,name:bu,online:_u,properties:$u,protocol:Su,require_staff:Cu,type:Ou},Mu={default:Iu},Tu=Se.default("daiquiri.components.hardware.NoObject");function Fu(n){if(n.options.emptyifnone)return Tu('Component id:"%s" name:"%s" not displayed cause setup with emptyifnone.',n.id,n.name),e.jsx(e.Fragment,{});const t=e.jsx(y,{name:"NoObject",icon:"fam-hardware-any",online:!1}),o=e.jsx(e.Fragment,{}),s=e.jsx("span",{title:`Object '${n.name}' is missing`,children:"Missing"}),r=n.options?n.options.header:"top",a={id:n.id,name:n.name??"",alias:null,user_tags:[],online:!1,locked:null,properties:{},type:""};return e.jsx(v,{hardware:a,widgetIcon:t,widgetState:o,widgetContent:s,headerMode:r})}function Du(n){const t=e.jsx(y,{name:"NoObject",icon:"fam-hardware-any",online:!1}),o=e.jsx(e.Fragment,{}),s=e.jsx("span",{title:`Object '${n.name}' is loading`,children:e.jsx("i",{className:"fa-solid fa-spinner fa-spin-pulse"})}),r=n.options?n.options.header:"top",a={id:n.id,name:n.name??"",alias:null,user_tags:[],online:!1,locked:null,properties:{},type:""};return e.jsx(v,{hardware:a,widgetIcon:t,widgetState:o,widgetContent:s,headerMode:r})}const Au=Se.default("daiquiri.components.hardware.MissingObject");function Ru(n){if(n.options.emptyifnone)return Au('Component id:"%s" name:"%s" not displayed cause setup with emptyifnone.',n.id,n.name),e.jsx(e.Fragment,{});const t=e.jsx(y,{name:"NoObject",icon:"fam-hardware-any",online:!1}),o=e.jsx(e.Fragment,{}),s=e.jsx("span",{title:`Object '${n.name}' is missing`,children:"Missing"}),r=n.options?n.options.header:"top",a={id:n.id,name:n.name??"",alias:null,user_tags:[],online:!1,locked:null,properties:{},type:""};return e.jsx(v,{hardware:a,widgetIcon:t,widgetState:o,widgetContent:s,headerMode:r})}function Eu(n){const{properties:t={}}=n,{message:o="Unknown error"}=t,s=e.jsx(y,{name:"NoObject",icon:"fam-hardware-any",online:!1}),r=e.jsx(e.Fragment,{}),a=e.jsx(i.OverlayTrigger,{trigger:["focus","hover"],placement:"bottom",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"error",style:{maxWidth:500},children:[e.jsx(i.Popover.Header,{children:"Error"}),e.jsx(i.Popover.Body,{children:e.jsx("ul",{children:e.jsx("li",{children:o})})})]}),children:e.jsxs(i.Button,{variant:"danger",size:"sm",className:"w-100",children:[e.jsx("i",{className:"fa fa-exclamation-triangle"})," Error"]})}),c=n.options?n.options.header:"top",l={id:n.id,name:n.name??"",alias:null,user_tags:[],online:!1,locked:null,properties:{},type:""};return e.jsx(v,{hardware:l,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const ku=Se.default("daiquiri.components.hardware.MissingComponentObject");function Pu(n){const{options:t}=n,{variant:o="default"}=t;if(t.emptyifnone)return ku('Component id:"%s" name:"%s" not displayed cause setup with emptyifnone.',n.id,n.name),e.jsx(e.Fragment,{});const s=e.jsx(y,{name:"NoObject",icon:"fam-hardware-any",online:!1}),r=e.jsx(e.Fragment,{}),a=e.jsx(i.OverlayTrigger,{trigger:["focus","hover"],placement:"bottom",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"error",style:{maxWidth:500},children:[e.jsx(i.Popover.Header,{children:"Error"}),e.jsx(i.Popover.Body,{children:e.jsx("ul",{children:e.jsxs("li",{children:["No component available for object id '",n.name,"' (type '",n.type,"' and/or variant '",o,"' are not registred)"]})})})]}),children:e.jsxs(i.Button,{variant:"danger",size:"sm",className:"w-100",children:[e.jsx("i",{className:"fa fa-exclamation-triangle"})," Error"]})}),c=t?t.header:"top",l={id:n.id,name:n.name??"",alias:null,user_tags:[],online:!1,locked:null,properties:{},type:""};return e.jsx(v,{hardware:l,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Gu(n){if(n.options.emptyifnone)return e.jsx(e.Fragment,{});const t=e.jsx(y,{name:"NoObject",icon:"fam-hardware-any",online:!1}),o=e.jsx(e.Fragment,{}),s=e.jsx(e.Fragment,{}),r=n.options?n.options.header:"top",a={id:n.id,name:n.name??"",alias:null,user_tags:[],online:!1,locked:null,properties:{},type:""};return e.jsx(v,{hardware:a,widgetIcon:t,widgetState:o,widgetContent:s,headerMode:r})}function Ut(n){const[t,o]=h.useState({}),s=h.useRef(null);return h.useEffect(()=>{if(s.current){const r=s.current;o({width:r.clientWidth,height:r.clientHeight})}},[]),e.jsx("div",{ref:s,style:{width:"100%",height:"100%"},className:n.className,children:t.width>0&&e.jsx("div",{className:"full-sizer",style:{width:`${t.width}px`,height:`${t.height}px`,overflow:"scroll"},children:n.children})})}function Bu(n){return e.jsx("div",{className:"panel-header",style:n.style,children:n.children})}function Vu(n){return e.jsx("div",{className:`panel-contents ${n.className}`,style:n.style,children:n.children})}function O(n){const t=n.scroll?Ut:h.Fragment;return e.jsx("div",{className:`panel ${n.className??""}`,style:n.style,children:e.jsx(t,{children:n.children})})}O.Header=Bu;O.Contents=Vu;const de={};function Ht(n,t){de[n]=t}function V(n,t,o=!0){if(!n)return e.jsx(e.Fragment,{});const{type:s}=n,r=s&&s in de?de[s]:de.component;return e.jsx(r,{yamlNode:n,panel:o},t)}function Lu({children:n,key:t,panel:o,options:s}){return o?e.jsx(O,{style:s.style,scroll:s.scroll,children:e.jsx(O.Contents,{children:n})},t):e.jsx(e.Fragment,{children:h.Children.map(n,r=>h.isValidElement(r)?h.cloneElement(r,{key:t,...r.props}):void 0)})}function qt(n,t){const{_parentNode:o,_indexFromParent:s,...r}=t;if(n&&Object.keys(r).length>0)throw new ue(n,Object.keys(r))}class Y extends Error{constructor(t,o){super(t),this.yamlNode=o}}class ue extends Y{constructor(t,o){super(`Unexpected keys: ${o.join(", ")}`,t),this.keys=o}}class oe extends Y{constructor(t,o){super(`Keys ${o.join(", ")} are missing`,t),this.keys=o}}class I extends Y{constructor(t,o,s){super(`Key ${o} error: ${s}`,t),this.key=o,this.keyMessage=s}}function Uu(n){let t=n;for(;t._parentNode;)t=t._parentNode;return t}function Hu(n){const t=[];let o=n;for(;o;)t.push({node:o,indexFromParent:o._indexFromParent}),o=o._parentNode;return t.reverse(),t}function zt(n,t=null,o=null){if(n._parentNode)throw new Error("Attribute _parentNode was already defined by the yml layout.");const s={...n,_parentNode:t,_indexFromParent:o};if(n.children){const r=[...n.children];Object.freeze(r),s.children=r.map((a,c)=>zt(a,s,c))}return Object.freeze(s),s}function qu(n,t,o){if(n&&o===void 0)throw new oe(n,[t])}function Wt(n,t,o){if(typeof o!="string")throw new I(n,t,"A string is expected")}function zu(n,t,o){if(typeof o!="boolean")throw new I(n,t,"A boolean is expected")}function Wu(n,t,o){if(typeof o!="number")throw new I(n,t,"A number is expected")}function fe(n,t,o){if(o!==void 0&&typeof o!="boolean")throw new I(n,t,"An optional boolean is expected")}function se(n,t,o){if(o!==void 0&&typeof o!="string")throw new I(n,t,"An optional string is expected")}function Yu(n,t,o){if(!Array.isArray(o))throw new I(n,t,"A list of string is expected");o.forEach(s=>{if(typeof s!="string")throw new I(n,t,"A list of string is expected")})}function Ku(n,t,o){if(o!==void 0&&typeof o!="string"){if(!Array.isArray(o))throw new I(n,t,"An optional string or list of string is expected");o.forEach(s=>{if(typeof s!="string")throw new I(n,t,"An optional string or list of string is expected")})}}function Qu(n,t,o){if(o!==void 0){if(!Array.isArray(o))throw new I(n,t,"An optional list of string is expected");o.forEach(s=>{if(typeof s!="string")throw new I(n,t,"A optional list of string is expected")})}}function pe(n,t,o){if(o!==void 0&&typeof o!="number")throw new I(n,t,"An optional number is expected")}function Xu(n,t,o){if(o!==void 0){if(!Array.isArray(o))throw new I(n,t,"An optional list of numbers is expected");o.forEach(s=>{if(typeof s!="number")throw new I(n,t,"An optional list of numbers is expected")})}}function ae(n,t){const{_parentNode:o,_indexFromParent:s,...r}=t;if(n&&Object.keys(r).length>0)throw new ue(n,Object.keys(r))}function Ju(n,t,o){if(o!=="last"&&typeof o!="number")throw new I(n,t,'"last" or a number is expected')}function Zu(n,t,o){if(o!==void 0&&o!=="h5web"&&o!=="plotly")throw new I(n,t,'"h5web" or "plotly" string is expected')}const ef=Object.freeze(Object.defineProperty({__proto__:null,assertBoolean:zu,assertDataCollectionId:Ju,assertKeyExpected:qu,assertNoUnknownKeys:ae,assertNumber:Wu,assertOptionalBackend:Zu,assertOptionalBoolean:fe,assertOptionalNumber:pe,assertOptionalNumberList:Xu,assertOptionalString:se,assertOptionalStringList:Qu,assertOptionalStringOrStringList:Ku,assertString:Wt,assertStringList:Yu},Symbol.toStringTag,{value:"Module"}));function Yt(n){const{providers:t={},yamlNode:o,message:s,...r}=n;return se(o,"message",s),ae(o,r),e.jsx(i.Alert,{variant:"warning",className:"mb-0",children:s??"TODO"})}function Kt(n){return e.jsx(e.Fragment,{})}const tf=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),nf=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));function Qt(n){var t;return e.jsxs(i.Alert,{variant:"danger",children:[n.message,e.jsx("br",{}),e.jsx("pre",{children:(t=n.error)==null?void 0:t.stack})]})}function of(n){const{error:t}=n;if(!(t instanceof Y))return e.jsx(e.Fragment,{});function o(a,c=3){const l=Hu(a.yamlNode),f=[];let u="";for(let d=1;d<l.length;d++){const{node:p,indexFromParent:m}=l[d];f.push(`${u}children:`),u+=" ".repeat(c),m===1?f.push(`${u}- type: ...`):(m??0>1)&&f.push(`${u}...`,`${u}...`,`${u}# children number ${m??0+1}`),f.push(`${u}- type: ${p.type}`),u+=" ".repeat(2)}return a instanceof ue?a.keys.forEach(d=>{f.push(`${u}${d}: ... ${" ".repeat(50-u.length-d.length)}<-- unexpected key`)}):a instanceof oe?a.keys.forEach(d=>{f.push(`${u}???: ${" ".repeat(50-u.length-d.length)}<-- key **${d}** is expected`)}):a instanceof I&&f.push(`${u}${a.key}: ${" ".repeat(50-u.length-a.key.length)}<-- ${a.keyMessage}`),f.join(`
35
- `)}const r=Uu(t.yamlNode).name;if(t instanceof ue){const a=t.keys.length===1?"key":"keys";return e.jsxs(i.Alert,{variant:"danger",children:["Unexpected ",a," ",t.keys.map((c,l)=>e.jsxs(e.Fragment,{children:[l!==0&&", ",e.jsx("b",{children:c})]}))," ","from the layout name ",e.jsx("b",{children:r}),".",e.jsx("br",{}),e.jsx("pre",{className:"mt-3",children:o(t)}),e.jsx("br",{})]})}if(t instanceof oe){const a=t.keys.length===1?"Key":"Keys";return e.jsxs(i.Alert,{variant:"danger",children:["Expected ",a," ",t.keys.map((c,l)=>e.jsxs(e.Fragment,{children:[l!==0&&", ",e.jsx("b",{children:c})]}))," ","from the layout name ",e.jsx("b",{children:r}),".",e.jsx("br",{}),e.jsx("pre",{className:"mt-3",children:o(t)}),e.jsx("br",{})]})}return t instanceof I?e.jsxs(i.Alert,{variant:"danger",children:["Error on key ",e.jsx("b",{children:t.key})," from the layout name ",e.jsx("b",{children:r}),".",e.jsx("br",{}),e.jsx("pre",{className:"mt-3",children:o(t)}),e.jsx("br",{})]}):e.jsx(Qt,{...n})}const ke={hasError:!1,message:"",error:void 0};class Xt extends h.Component{constructor(t){super(t),this.reload=()=>{window.location.reload()},this.state=ke}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){var o,s;if(t instanceof Y||!this.props.unhandledComponentDidCatch){this.setState({hasError:!0,message:t.message,error:t});return}(s=(o=this.props).unhandledComponentDidCatch)==null||s.call(o,t,r=>{this.setState({hasError:!0,message:t.message,error:t,...r})})}componentDidUpdate(t,o){this.state.hasError&&o.error!==void 0&&t.resetKey!==this.props.resetKey&&this.setState(ke)}render(){if(this.state.hasError){const{UnhandledErrorComponent:t}=this.props,{hasError:o,...s}=this.state;return e.jsxs(i.Container,{className:"mt-2",children:[e.jsx("h4",{children:"Something went wrong"}),this.state.error instanceof Y&&e.jsx(of,{message:this.state.message,error:this.state.error}),!(this.state.error instanceof Y)&&e.jsx(e.Fragment,{children:t?e.jsx(t,{...s}):e.jsx(Qt,{message:this.state.message,error:this.state.error})}),e.jsxs("p",{children:["This error has been logged. Please"," ",e.jsxs(i.Button,{size:"sm",onClick:this.reload,children:[e.jsx("i",{className:"fa fa-refresh"})," Reload"]})," ","the application"]})]})}return this.props.children}}function sf({yamlNode:n,panel:t}){const{type:o,style:s,children:r,...a}=n;return ae(n,a),e.jsx(i.Row,{className:"ymllayout-row gx-0",style:s,children:D.map(r,(c,l)=>V(c,l,t))})}function rf({yamlNode:n,panel:t}){const{type:o,style:s,xs:r,children:a,...c}=n;return ae(n,c),pe(n,"xs",r),e.jsx(i.Col,{className:k.default("yamymllayout-col",{col:!!r}),style:s,xs:r,children:D.map(n.children,(l,f)=>V(l,f,t))})}const re={};function af(n,t){re[n]=t}function cf(n,t){if(t===void 0)throw new oe(n,["id"]);if(typeof t.id!="string")throw new I(n,"id","A string is expected")}function lf(n,t,o){if(o!==void 0){if(!Array.isArray(o))throw new I(n,t,"A option list is expected");o.forEach((s,r)=>{try{cf(n,s)}catch{throw new I(n,t,`The hardware description ${r} is wrong`)}})}}function df(n){const{providers:t={},yamlNode:o,ids:s,groupid:r,even:a,nowrap:c,...l}=n;if(lf(o,"ids",s),se(o,"groupid",r),fe(o,"even",a),fe(o,"nowrap",c),ae(o,l),!re.HardwareGroup)return e.jsx(i.Alert,{variant:"warning",children:"No `HardwareGroup` component registered"});const f=re.HardwareGroup;return e.jsx(f,{providers:t,ids:s,groupid:r,nowrap:c||!1,even:a||!1})}function uf(n){const{providers:t={},yamlNode:o,id:s,variant:r,header:a,width:c,colWidth:l,emptyifnone:f,...u}=n;Wt(o,"id",s),se(o,"variant",r),se(o,"header",a),pe(o,"width",c),pe(o,"colWidth",l),fe(o,"emptyifnone",f);const d={variant:r,header:a,width:c,colWidth:l,emptyifnone:f,...u};if(!re.HardwareGroup)return e.jsx(i.Alert,{variant:"warning",children:"No `Hardware` component registered"});const p=re.Hardware;return e.jsx(p,{providers:t,id:s,options:d})}const $e={hardwaregroup:df,hardware:uf,todo:Yt,none:Kt};function Jt(n,t){$e[n]=t}function ff(n){Object.entries(n).forEach(([t,o])=>Jt(t,o))}function pf(n){const{yamlNode:t,panel:o}=n,{type:s,style:r,scroll:a,title:c,...l}=t;if(!(s in $e))return e.jsx(O,{children:e.jsx(O.Contents,{children:e.jsxs(i.Alert,{variant:"warning",children:['Unknown component "',s,'"']})})});const f=$e[t.type];return o?e.jsx(O,{style:r,scroll:a,children:e.jsxs(h.Suspense,{fallback:e.jsx("p",{children:"Loading..."}),children:[c&&e.jsx(O.Header,{children:c}),e.jsx(O.Contents,{children:e.jsx(f,{...l,yamlNode:t})})]})}):e.jsx(h.Suspense,{fallback:e.jsx("p",{children:"Loading..."}),children:e.jsx(f,{...l,yamlNode:t})})}function mf({yamlNode:n,panel:t}){const o=n.options||{};return e.jsx(i.Container,{className:"ymllayout-container",...o,children:D.map(n.children,(s,r)=>V(s,r,t))})}function hf(n){const{yamlNode:t}=n,o=t.options||{},s={};return o.centerContent&&(s.margin="auto"),e.jsxs(O,{className:"ymllayout-panel",...o,children:[t.title&&e.jsx(O.Header,{children:t.title}),e.jsx(O.Contents,{style:s,children:D.map(t.children,(r,a)=>V(r,a,!1))})]})}const xf=()=>Math.random().toString(36).slice(2,15)+Math.random().toString(36).slice(2,15);function gf({yamlNode:n,panel:t}){const o=[];return D.each(n.children,(s,r)=>{o.push(e.jsx(i.Tab,{eventKey:xf(),title:s.title,children:V(s,0,!1)},r))}),t?e.jsxs(O,{className:"ymllayout-tabs",children:[n.title&&e.jsx(O.Header,{children:n.title}),e.jsx(O.Contents,{children:e.jsx(i.Tabs,{mountOnEnter:!0,children:o})})]}):e.jsx(i.Tabs,{children:o})}function jf(n){const{node:t}=n,{type:o,title:s,...r}=t;return qt(t,r),e.jsx("div",{className:"ymllayout-form-header",style:{gridColumn:"1 / 3"},children:e.jsx("h3",{children:s})})}function wf(n){const{node:t,state:o,row:s}=n,{title:r}=t;function a(){if(t.id)return t.id}function c(){if(r!==void 0)return r;if(t.type==="hardware"){const f=a(),u={_parentNode:t._parentNode,_indexFromParent:t._indexFromParent,type:"hardware",id:f,variant:"name",emptyifnone:!0};return V(u,"a",!1)}return""}const l=c();return e.jsxs("div",{style:{textAlign:"center"},children:[e.jsx("h5",{style:{margin:"0px",whiteSpace:"nowrap"},children:l}),o&&e.jsx("div",{style:{position:"relative",top:-5},children:o})]})}function yf(n){const{node:t,row:o}=n,{titlealign:s,title:r,stateinheader:a=!1,variant:c,id:l,...f}=t;let u,d;if(f.type==="hardware")if(u={...f,id:l,variant:c},a){const p={...f,id:l,variant:"state",emptyifnone:!0};d=V(p,"k",!1)}else d=null;else u=f,d=null;return e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{gridColumn:1,alignSelf:s??"center"},children:e.jsx(wf,{node:t,state:d,row:o})}),e.jsx("div",{style:{gridColumn:2,alignSelf:"center"},children:V(u,"k",!1)})]})}function vf(n){const{yamlNode:t,panel:o}=n,{type:s,children:r,options:a={},title:c,...l}=t;return qt(t,l),e.jsxs(O,{className:"ymllayout-form",...a,children:[t.title&&e.jsx(O.Header,{children:t.title}),e.jsx(O.Contents,{className:"full-sizer",style:{overflow:"auto"},children:e.jsx("div",{style:{display:"grid",gridTemplateColumns:"min-content auto"},children:D.map(r,(f,u)=>f.type==="formheader"?e.jsx(jf,{node:f,row:u},u):f.type==="none"?e.jsx(dn.default.Fragment,{},u):e.jsx(yf,{node:f,row:u},u))})})]})}function Nf(n){const{yamlNode:t,panel:o}=n;return e.jsxs("div",{className:"ymllayout-grid",style:{gridTemplateColumns:t.columns,gridTemplateRows:t.rows},children:[D.map(t.children,(s,r)=>{const{columnSpan:a=1,rowSpan:c=1,...l}=s,f=a>1?`span ${a}`:void 0,u=c>1?`span ${c}`:void 0;return e.jsx("div",{className:"ymllayout-grid-cell",style:{gridColumn:f,gridRow:u},children:V(l,r,o)},r)})," "]})}function bf({yamlNode:n,panel:t}){const o=n.options||{};return e.jsx(Lu,{panel:t,options:o,children:e.jsx("div",{children:n.label})})}const Zt={row:sf,col:rf,container:mf,component:pf,panel:hf,tabs:gf,form:vf,grid:Nf,label:bf};Object.entries(Zt).forEach(([n,t])=>{Ht(n,t)});function _f(n){var o;const t=h.useMemo(()=>zt(n.layout),[n.layout]);return t.error?e.jsx("div",{className:`${n.className??""} ymllayout-main`,"data-testid":n.testid,children:e.jsxs(O,{children:[e.jsx(O.Header,{children:"Layout Error"}),e.jsxs(O.Contents,{children:[e.jsxs("p",{children:["File: ",t.name]}),e.jsx(i.Alert,{variant:"warning",children:e.jsx("pre",{className:"mb-0",children:t.error})})]})]})}):e.jsx("div",{className:`${n.className??""} ymllayout-main`,"data-testid":n.testid,children:e.jsx(Xt,{resetKey:t,unhandledComponentDidCatch:n.unhandledComponentDidCatch,UnhandledErrorComponent:n.UnhandledErrorComponent,children:(o=t.children)==null?void 0:o.map((s,r)=>V(s,r))})})}const $f=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),en=(n,t,o)=>{const s={">":(r,a)=>r>a,"<":(r,a)=>r<a,">=":(r,a)=>r>=a,"<=":(r,a)=>r<=a,"==":(r,a)=>r===a,"!=":(r,a)=>r!==a,in:(r,a)=>a.indexOf(r)>-1};if(n in s)return s[n](t,o)};function tn(n,t,o){const s=n.split(t);return o?[s.slice(0,-o).join(t)].concat(s.slice(-o)):s}function Pe(n){const t=n!==void 0?tn(n,".",1):[null,""],o=P(t[0]);if(o&&o.properties&&t[1]!==null)return Array.isArray(o.properties[t[1]])?o.properties[t[1]][0]:o.properties[t[1]]}function Sf(n){const t=n!==void 0&&!n.includes("."),o=n!==void 0?tn(n,".",1):[null,""],s=P(o[0]);if(t)return n;if(s&&s.properties&&o[1]!==null)return`${s.properties[o[1]]}`}function nn(n){const{monitor:t}=n;let o=Pe(t.value)??"-";const s=Sf(t.unit),r=Pe(t.overlay),a=Number.parseFloat(`${o}`);Number.isNaN(a)||String(a).length>5&&(o=a.toPrecision(5));let c;if(t.comparator&&t.comparison&&(c=en(t.comparator,o,t.comparison)?"valid":"invalid"),Number.isNaN(a)||s!==void 0&&(o=`${o} ${s}`),r){const l=`${r}`;return e.jsx(i.OverlayTrigger,{placement:"bottom",overlay:e.jsx(i.Tooltip,{id:"tooltipid",className:"monitor-panel-tooltip",children:l.includes(`
36
- `)?e.jsx("pre",{children:l}):l}),children:e.jsxs(i.Col,{className:"monitor-panel-item",children:[e.jsx("h1",{children:t.name}),e.jsx("div",{className:c,children:`${o}`})]})},t.name)}return e.jsxs(i.Col,{className:"monitor-panel-item",children:[e.jsx("h1",{children:t.name}),e.jsx("div",{className:c,children:`${o}`})]},t.name)}const on={hardware:nn};function Cf(n,t){on[n]=t}function Of(n){return e.jsxs(i.Col,{className:"monitor-panel-item bg-fatal",title:`Error from yaml configuration: ${n.message}`,children:[e.jsx("h1",{children:n.monitor.name}),e.jsx("div",{children:"Parsing error"})]})}function If(n){const t=D.map(n.monitors,(o,s)=>{const r=o.type??"hardware",a=on[r];return a===void 0?e.jsx(Of,{monitor:o,message:`Type ${r} unsupported`},`m${s}`):e.jsx(a,{monitor:o},`m${s}`)});return e.jsx("div",{className:k.default({"ms-auto":n.margin==="start"},"me-auto","monitor-panel",{"monitor-panel-light":n.bg==="light"}),children:e.jsx(i.Container,{fluid:!0,children:e.jsx(i.Row,{className:"flex-nowrap",children:t})})})}function Mf(n){return e.jsx(i.Col,{className:"monitor-panel-item",children:n.children})}exports.AirBearing=qe;exports.AirBearingMocks=Pn;exports.AirBearingProtected=ze;exports.AirBearingSimulator=Gn;exports.AirBearingState=me;exports.AirBearingVariants=On;exports.BaseInfo=Le;exports.BaseMocks=vn;exports.BaseName=Ve;exports.BaseProperty=Ue;exports.BaseState=Be;exports.BaseVariants=gn;exports.ErrorObject=Eu;exports.Formatting=Hn;exports.Frontend=Ye;exports.FrontendMocks=oo;exports.FrontendVariants=Wn;exports.FullSizer=Ut;exports.Gauge=Ke;exports.GaugeMocks=So;exports.GaugeVariants=io;exports.HWObject=$f;exports.HardwareInputNumber=ne;exports.HardwareNumericStep=he;exports.HardwareSchema=nf;exports.HardwareState=Nn;exports.HardwareTemplate=v;exports.HardwareTypes=tf;exports.KeyError=I;exports.Laser=Xe;exports.LaserHeating=Je;exports.LaserHeatingMocks=Jo;exports.LaserHeatingVariants=Lo;exports.LaserMocks=Go;exports.LaserVariants=Io;exports.Light=Ze;exports.LightMocks=ds;exports.LightVariants=es;exports.LimaBinning=st;exports.LimaDefault=et;exports.LimaDescription=it;exports.LimaImageRoi=rt;exports.LimaMocks=fr;exports.LimaShape=at;exports.LimaSimulator=pr;exports.LimaSize=tt;exports.LimaState=H;exports.LimaTransformation=nt;exports.LimaVariants=_s;exports.LoadingObject=Du;exports.MeasurementGroupDefault=lt;exports.MeasurementGroupMocks=Or;exports.MeasurementGroupSimulator=Ir;exports.MeasurementGroupVariants=jr;exports.MissingComponentObject=Pu;exports.MissingKeysError=oe;exports.MissingObject=Ru;exports.MonitorHardware=nn;exports.MonitorPanel=If;exports.MonitorPanelItem=Mf;exports.MotorDefault=Q;exports.MotorMocks=Bi;exports.MotorSimulator=Li;exports.MotorState=ge;exports.MotorText=dt;exports.MotorVariants=Dr;exports.Multiposition=ft;exports.MultipositionMocks=na;exports.MultipositionSimulator=oa;exports.MultipositionVariants=zi;exports.NoObject=Fu;exports.None=Kt;exports.NullObject=Gu;exports.NumericStep=Qe;exports.OpticDefault=mt;exports.OpticMocks=ya;exports.OpticSimulator=va;exports.OpticState=Oe;exports.OpticVariants=ua;exports.Panel=O;exports.ProcedureExecution=ht;exports.ProcedureManage=_e;exports.ProcedureMocks=Pa;exports.ProcedureState=ie;exports.ProcedureValidate=xt;exports.ProcedureVariants=Oa;exports.PumpDefault=yt;exports.PumpMocks=Gc;exports.PumpVariants=Ic;exports.PusherDefault=vt;exports.PusherMocks=el;exports.PusherSimulator=tl;exports.PusherState=Me;exports.PusherVariants=Hc;exports.ServiceDefault=Nt;exports.ServiceMocks=hl;exports.ServiceProtected=bt;exports.ServiceState=we;exports.ServiceVariants=rl;exports.ShutterDefault=gt;exports.ShutterMocks=Za;exports.ShutterProtected=jt;exports.ShutterSimulator=ec;exports.ShutterState=je;exports.ShutterVariants=Ua;exports.SlitDefault=wt;exports.SlitMocks=Sc;exports.SlitState=Ie;exports.SlitVariants=ac;exports.Todo=Yt;exports.TomoConfigLatencyTime=Pt;exports.TomoConfigVariants=fu;exports.TomoDetectorAcquisitionMode=It;exports.TomoDetectorMocks=$d;exports.TomoDetectorSamplePixelSize=Ot;exports.TomoDetectorState=ve;exports.TomoDetectorVariants=hd;exports.TomoDetectorsDefault=Mt;exports.TomoDetectorsMocks=Gd;exports.TomoDetectorsState=Fe;exports.TomoDetectorsVariants=Id;exports.TomoFlatMotionDefault=_t;exports.TomoFlatMotionMocks=ed;exports.TomoFlatMotionSimulator=td;exports.TomoFlatMotionSmall=$t;exports.TomoFlatMotionState=ye;exports.TomoFlatMotionVariants=_l;exports.TomoHoloState=Bt;exports.TomoHoloVariants=xu;exports.TomoImagingActions=Rt;exports.TomoImagingDefault=Ft;exports.TomoImagingExposureTime=Dt;exports.TomoImagingMocks=ru;exports.TomoImagingSettleTime=At;exports.TomoImagingSimulator=iu;exports.TomoImagingState=K;exports.TomoImagingUpdateMode=Et;exports.TomoImagingVariants=Qd;exports.TomoReferencePositionDefault=Ct;exports.TomoReferencePositionVariants=sd;exports.TomoSampleStageVariants=cu;exports.TypeIcon=y;exports.ValveDefault=Lt;exports.ValveMocks=Mu;exports.ValveVariants=yu;exports.YAMLErrorBoundary=Xt;exports.YAMLLayout=_f;exports.YamlAsserts=ef;exports.createMotorMock=Vi;exports.dynamicOp=en;exports.isLimaHardware=xe;exports.isMotorHardware=ut;exports.isOpticHardware=la;exports.isTomoConfigHardware=Gt;exports.isTomoDetectorHardware=Te;exports.isTomoDetectorsHardware=Tt;exports.isTomoFlatMotionHardware=St;exports.isTomoHoloHardware=Vt;exports.isTomoReferencePositionHardware=nd;exports.isTomoSampleStageHardware=kt;exports.limaGuessSubframes=ct;exports.registerHardwareComponent=af;exports.registerMonitorComponent=Cf;exports.registerRuntimeHook=vs;exports.registerYamlComponent=Jt;exports.registerYamlComponents=ff;exports.registerYamlType=Ht;exports.renderYamlNode=V;exports.useLimaHardware=Ns;exports.useMotorHardware=E;exports.useMotorStates=Ce;exports.useTomoConfigHardware=pu;exports.useTomoDetectorHardware=xd;exports.useTomoDetectorsHardware=Md;exports.useTomoFlatMotionHardware=$l;exports.useTomoHoloHardware=gu;exports.useTomoSampleStageHardware=lu;exports.yamlMap=Zt;
33
+ `,voltage:6998},Bc="tango",Vc=!0,Lc="pump",Uc={callables:Rc,id:Ec,name:kc,online:Pc,properties:Gc,protocol:Bc,require_staff:Vc,type:Lc},Hc={default:Uc};function Me(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={RETRACTED:"success",IN_TOUCH:"warning",MOVING_IN:"warning",MOVING_OUT:"warning",UNKNOWN:"danger",OFFLINE:"warning"},r=s[o]||s.UNKNOWN;return e.jsx(F,{state:o,minWidth:6,variant:r})}function qc(n){const{hardware:t}=n;return e.jsx(Me,{hardware:t})}function zc(n){const{className:t,hardware:o,options:s={}}=n,{state:r}=o.properties??"OFFLINE",c=!(r==="IN_TOUCH")||n.disabled;function l(f){const{distance:u}=f,[d,p]=h.useState(!1);return e.jsx(i.Button,{variant:"secondary",onClick:()=>{p(!0),o.actions.call("push",u).finally(()=>{p(!1)})},disabled:c,children:e.jsxs("span",{className:"text-nowrap",children:[e.jsx("i",{className:d?"fa-solid fa-fw fa-cog fa-spin":"fa fa-fw fa-arrow-left"})," ",u]})})}return e.jsxs("div",{className:t,style:{display:"grid",gridTemplateRows:"min-content min-content min-content",gridTemplateColumns:"min-content min-content min-content",gridGap:"1px"},children:[e.jsx(l,{distance:5}),e.jsx(l,{distance:.5}),e.jsx(l,{distance:.05}),e.jsx(l,{distance:2}),e.jsx(l,{distance:.2}),e.jsx(l,{distance:.02}),e.jsx(l,{distance:1}),e.jsx(l,{distance:.1}),e.jsx(l,{distance:.01})]})}function Wc(n){const{hardware:t,options:o,disabled:s}=n,{state:r}=t.properties??"OFFLINE",a=r==="RETRACTED",c=r==="IN_TOUCH",[l,f]=h.useState(!1),[u,d]=h.useState(!1),p=a?"ms-auto":c?"ms-0":"mx-auto";return e.jsxs("div",{style:{display:"grid",gridTemplateRows:"min-content min-content",gridTemplateColumns:"min-content auto",gridGap:"1px"},children:[e.jsx("i",{className:`${c?"fas fa-dizzy":"fa fa-smile"} fa-3x my-auto`}),e.jsx(zc,{className:p,...n}),e.jsx("span",{}),e.jsxs(i.ButtonGroup,{className:"mx-auto",style:{width:"12em"},children:[e.jsx(i.Button,{onClick:()=>{f(!0),t.actions.call("move_in").finally(()=>{f(!1)})},disabled:c||s||l||u,style:{width:"5em"},children:e.jsxs("span",{className:"text-nowrap",children:[e.jsx("i",{className:l?"fa-solid fa-fw fa-cog fa-spin":"fa fa-fw fa-arrow-left"})," ","In"]})}),e.jsx(i.Button,{onClick:()=>{d(!0),t.actions.call("move_out").finally(()=>{d(!1)})},disabled:a||s||l||u,style:{width:"5em"},children:e.jsxs("span",{className:"text-nowrap",children:["Out"," ",e.jsx("i",{className:u?"fa-solid fa-fw fa-cog fa-spin":"fa fa-fw fa-arrow-right"})]})})]})]})}function bt(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Pusher",icon:"fa-hand-point-right",online:t.online}),r=e.jsx(Me,{hardware:t});function a(){return e.jsx(Wc,{...n})}const c=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a(),headerMode:c})}const Yc={default:bt,state:qc},Kc=Yc,Qc=["move_in","move_out","push","sync_hard"],Xc="pusher",Jc="pusher",Zc=!0,el={state:"RETRACTED"},tl="bliss",nl=!1,ol="pusher",sl={callables:Qc,id:Xc,name:Jc,online:Zc,properties:el,protocol:tl,require_staff:nl,type:ol},rl={default:sl};function il(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=h.useState("RETRACTED");async function c(u,d){if(u==="move_in"){a("MOVING_IN"),await R(2e3),a("IN_TOUCH");return}if(u==="move_out"){a("MOVING_OUT"),await R(2e3),a("RETRACTED");return}if(u==="push"){await R(100);return}console.log("PusherSimulator: Unsupported call",u,d)}async function l(u,d){console.log("PusherSimulator: Unsupported setProperty",u,d)}const f={state:r};return e.jsx(U,{name:t,alias:o,type:"pusher",call:c,setProperty:l,properties:f,useHardwareContext:s})}function ye(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={STOPPED:"danger",STARTING:"warning",RUNNING:"success",BACKOFF:"warning",STOPPING:"warning",EXITED:"secondary",FATAL:"fatal",UNKNOWN:"fatal",OFFLINE:"secondary"},r=s[o]||s.UNKNOWN;return e.jsx(F,{state:o,minWidth:6,variant:r})}function al(n){const{hardware:t}=n;return e.jsx(ye,{hardware:t})}function _t(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Shutter",icon:"fa-cog",online:t.online}),r=e.jsx(ye,{hardware:t});function a(){t.actions.call("start")}function c(){t.actions.call("restart")}function l(){t.actions.call("stop")}function f(){return t.properties?t.properties.state:"UNKNOWN"}function u(b){return b.charAt(0).toUpperCase()+b.slice(1).toLowerCase()}const d=f(),p=u(d),g={STOPPED:"danger",STARTING:"warning",RUNNING:"success",BACKOFF:"warning",STOPPING:"warning",EXITED:"secondary",FATAL:"fatal",UNKNOWN:"secondary",OFFLINE:"secondary"}[d]||"danger";function w(){const b=d==="RUNNING"||d==="STARTING";return{icon:b?"fa fa-refresh fa-wp":"fa fa-play fa-wp",variant:n.disabled?"":"success",callback:d==="RUNNING"?c:a,disabled:n.disabled,title:n.operator?b?"Restart the service":"Start the serStaticTextInputvice":"You dont have the control to the session"}}function x(){const b=d==="RUNNING"||d==="STARTING";return{icon:"fa fa-stop fa-wp",variant:n.disabled?"":b?"danger":"secondary",callback:l,disabled:n.disabled,title:n.operator?"Stop the service":"You dont have the control to the session"}}const j=w(),N=x(),I=e.jsxs(i.InputGroup,{className:"d-flex flex-nowrap",children:[e.jsx(A,{variant:g,className:"text-center",style:{minWidth:"8em"},value:p}),e.jsx(i.Button,{style:{width:"2.5em"},variant:"light",className:`px-0 text-${j.variant}`,onClick:j.callback,disabled:j.disabled,title:j.title,children:e.jsx("i",{className:`${j.icon}`})}),e.jsx(i.Button,{style:{width:"2.5em"},variant:"light",className:`px-0 text-${N.variant}`,onClick:N.callback,disabled:N.disabled,title:N.title,children:e.jsx("i",{className:`${N.icon}`})})]}),M=n.options.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:I,headerMode:M})}function cl(n){var f;const{hardware:t,options:o={}}=n;function s(){t.actions.call("start")}function r(){t.actions.call("restart")}function a(){t.actions.call("stop")}const c=((f=t.properties)==null?void 0:f.state)??"UNKNOWN",l=c==="STOPPING"||c==="STARTING";return e.jsx(i.OverlayTrigger,{trigger:"click",rootClose:!0,placement:o.dropDirection==="up"?"top":"bottom",overlay:e.jsx(i.Popover,{id:"service-protected-overlay",children:e.jsxs(i.Popover.Body,{children:[e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center",children:"Actions"})}),e.jsx(i.Row,{children:e.jsxs(i.Col,{children:[c==="RUNNING"&&e.jsxs(i.Button,{className:"me-1 text-success border-secondary",variant:"light",onClick:()=>{r()},disabled:n.disabled,title:"Restart the service",children:[e.jsx("i",{className:"fa fa-refresh fa-wp me-1"}),"Restart"]}),c!=="RUNNING"&&e.jsxs(i.Button,{className:"me-1 text-success border-secondary",variant:"light",onClick:()=>{s()},disabled:n.disabled,title:"Start the service",children:[e.jsx("i",{className:"fa fa-play fa-wp me-1"}),"Start"]}),e.jsxs(i.Button,{className:`text-${c!=="STOPPED"?"danger":"primary"} border-secondary`,variant:"light",onClick:()=>{a()},disabled:n.disabled,title:"Stop the service",children:[e.jsx("i",{className:"fa fa-stop fa-wp me-1"}),"Stop"]})]})})]})}),children:e.jsx(i.Button,{disabled:n.disabled||l,children:e.jsx("i",{className:`fa fa-caret-${o.dropDirection==="up"?"up":"down"}`})})})}function $t(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Shutter",icon:"fa-cog",online:t.online}),r=e.jsx(ye,{hardware:t});function a(){return t.properties?t.properties.state:"UNKNOWN"}function c(g){return g.charAt(0).toUpperCase()+g.slice(1).toLowerCase()}const l=a(),u={STOPPED:"danger",STARTING:"warning",RUNNING:"success",BACKOFF:"warning",STOPPING:"warning",EXITED:"secondary",FATAL:"fatal",UNKNOWN:"fatal",OFFLINE:"secondary"}[l],d=c(l),p=e.jsxs(i.InputGroup,{className:"d-flex flex-nowrap",children:[e.jsx(A,{variant:u,style:{minWidth:"10em"},value:d,className:"text-center"}),e.jsx(cl,{...n})]}),m=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:p,headerMode:m})}const ll={default:_t,protected:$t,state:al},dl=ll,ul=["start","stop","restart"],fl="service1",pl="service1",ml=!0,hl={state:"RUNNING"},xl="multivisor",gl=!0,jl="service",wl={callables:ul,id:fl,name:pl,online:ml,properties:hl,protocol:xl,require_staff:gl,type:jl},yl={default:wl};function ve(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={UNKNOWN:"danger",READY:"success"},r=s[o]||s.UNKNOWN;return e.jsx(F,{state:o,minWidth:6,variant:r})}function vl(n){const{hardware:t}=n;return e.jsx(ve,{hardware:t})}function Nl(n){const{motion:t}=n,s=t.axisRef.slice(9),r=k(s),a=(r==null?void 0:r.alias)??(r==null?void 0:r.name)??(r==null?void 0:r.id)??s;return e.jsx("div",{className:"my-auto",children:a})}function bl(n){const{motion:t,actions:o,disabled:s}=n,r=t.axisRef;function a(){o.call("update_axis",{axis_ref:r})}return e.jsx(i.Button,{variant:"danger",onClick:a,disabled:s,children:e.jsx("i",{className:"fa fa-trash"})})}function _l(n){const{motion:t,actions:o,axisRef:s,disabled:r}=n,a=h.useMemo(()=>{for(const d of t)if(d.axisRef===s)return!0;return!1},[t,s]),c=s.slice(9),l=k(c),f=(l==null?void 0:l.alias)??(l==null?void 0:l.name)??(l==null?void 0:l.id)??c;function u(){o.call("update_axis",{axis_ref:s,relative_position:0})}return e.jsx(i.Button,{className:"ms-1",variant:a?"primary":"secondary",onClick:()=>{a||u()},title:a?"This axis is already part of the motion":"Use this axis in the motion",disabled:r,children:f})}function $l(n){var x;const{motion:t,actions:o}=n,s=t.axisRef,r=t.absolute_position??t.relative_position??0,a=s.slice(9),c=k(a),l=n.disabled||!(c!=null&&c.online),f=h.useRef(null),[u,d]=h.useState(!1),p=3,m=((x=c==null?void 0:c.properties)==null?void 0:x.unit)??"";function g(j){if(!f||!f.current)console.log("formRef not yet defined");else if(j.key==="Enter"){d(!1);const N=Number.parseFloat(f.current.value);o.call("update_axis",{axis_ref:s,absolute_position:t.absolute_position!==null?N:null,relative_position:t.relative_position!==null?N:null})}else j.key==="Escape"?(f.current.value=r.toFixed(p),d(!1)):console.log(j.key)}function w(j){const{value:N}=j.target;if(N===void 0)return;const I=Number.parseFloat(N);I!==r&&!u&&d(!0),I===r&&u&&d(!1)}return h.useEffect(()=>{!f||!f.current?console.log("formRef not yet defined"):u||(f.current.value=r.toFixed(p))},[u,r]),e.jsxs(i.InputGroup,{className:"w-100",children:[e.jsx(i.Form.Control,{className:u?"form-control-edited":"",type:"number",ref:f,defaultValue:r.toFixed(p),onChange:w,disabled:l,onKeyDown:g}),e.jsx(i.InputGroup.Text,{children:m})]})}function Sl(n){const{actions:t,motion:o,disabled:s}=n;function r(){t.call("update_axis",{axis_ref:o.axisRef,absolute_position:o.absolute_position??o.relative_position})}function a(){t.call("update_axis",{axis_ref:o.axisRef,relative_position:o.absolute_position??o.relative_position})}return e.jsxs(i.ButtonGroup,{children:[e.jsx(i.Button,{onClick:r,variant:o.absolute_position!==null?"primary":"secondary",disabled:s,children:"Abs"}),e.jsx(i.Button,{onClick:a,variant:o.relative_position!==null?"primary":"secondary",disabled:s,children:"Rel"})]})}function St(n){const{hardware:t,options:o={},disabled:s}=n,{properties:r}=t,a=e.jsx(y,{name:"TomoFlatMotion",icon:"fam-hardware-camera",online:t.online}),c=e.jsx(ve,{hardware:t}),l=e.jsxs(i.Container,{children:[e.jsxs(i.Row,{className:"mt-1",children:[e.jsx(i.Col,{xs:3,children:"Move in parallel"}),e.jsx(i.Col,{xs:9,children:r.move_in_parallel?"true":"false"})]}),e.jsxs(i.Row,{className:"mt-1",children:[e.jsx(i.Col,{xs:3,children:"Switch power on/off"}),e.jsx(i.Col,{xs:9,children:r.power_onoff?"true":"false"})]}),e.jsxs(i.Row,{className:"mt-1",children:[e.jsx(i.Col,{xs:3,children:"Settle time"}),e.jsxs(i.Col,{xs:9,children:[r.settle_time.toFixed(2)," ",e.jsx("span",{title:"seconds",children:"s"})]})]}),e.jsxs(i.Row,{className:"mt-1",children:[e.jsx(i.Col,{xs:3,children:"Available axes"}),e.jsx(i.Col,{xs:9,children:r.available_axes.map(u=>e.jsx(_l,{axisRef:u,motion:r.motion,actions:t.actions,disabled:s},u))})]}),e.jsxs(i.Row,{className:"mt-1",children:[e.jsx(i.Col,{xs:3,children:"Actual motion"}),e.jsx(i.Col,{xs:9,children:e.jsxs("div",{style:{display:"grid",gridGap:5,gridTemplateColumns:"min-content min-content auto min-content"},children:[e.jsx("div",{children:"Axis"}),e.jsx("div",{children:"Kind"}),e.jsx("div",{children:"Displacement"}),e.jsx("div",{}),r.motion.map((u,d)=>e.jsxs(h.Fragment,{children:[e.jsx(Nl,{motion:u}),e.jsx(Sl,{motion:u,actions:t.actions,disabled:s}),e.jsx($l,{motion:u,actions:t.actions,disabled:s}),e.jsx(bl,{motion:u,actions:t.actions,disabled:s})]},`motion${d}`))]})})]})]}),f=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:a,widgetState:c,widgetContent:l,headerMode:f})}function Cl(n){var b;const{motion:t,actions:o}=n,s=t.axisRef,r=t.absolute_position??t.relative_position??0,a=s.slice(9),c=k(a),l=n.disabled||!(c!=null&&c.online),f=h.useRef(null),[u,d]=h.useState(!1),p=3,m=((b=c==null?void 0:c.properties)==null?void 0:b.unit)??"",g=(c==null?void 0:c.alias)??(c==null?void 0:c.name)??(c==null?void 0:c.id)??"none";function w(_){if(!f||!f.current)console.log("formRef not yet defined");else if(_.key==="Enter"){d(!1);const S=Number.parseFloat(f.current.value);o.call("update_axis",{axis_ref:s,absolute_position:t.absolute_position!==null?S:null,relative_position:t.relative_position!==null?S:null})}else _.key==="Escape"?(f.current.value=r.toFixed(p),d(!1)):console.log(_.key)}function x(_){const{value:S}=_.target;if(S===void 0)return;const C=Number.parseFloat(S);C!==r&&!u&&d(!0),C===r&&u&&d(!1)}h.useEffect(()=>{!f||!f.current?console.log("formRef not yet defined"):u||(f.current.value=r.toFixed(p))},[u,r]);function j(){return t.absolute_position!==null?["ABS","warning","Absolute displacement"]:t.relative_position!==null?["REL","none","Relative displacement"]:["ERR","danger","Unknown motion kind"]}const[N,I,M]=j();return e.jsxs(i.InputGroup,{className:"w-100 flex-nowrap",children:[e.jsx(i.InputGroup.Text,{title:"Displacement to apply on this axis to take a flat",style:{width:"5em"},children:g}),e.jsx(i.InputGroup.Text,{className:`bg-${I}`,title:M,style:{width:"3em"},children:N}),e.jsx(i.Form.Control,{className:u?"form-control-edited":"",type:"number",ref:f,defaultValue:r.toFixed(p),onChange:x,disabled:l,onKeyDown:w}),e.jsx(i.InputGroup.Text,{children:m})]})}function Ct(n){const{hardware:t,options:o={},disabled:s}=n,{properties:r}=t,a=e.jsx(y,{name:"TomoFlatMotion",icon:"fam-hardware-camera",online:t.online}),c=e.jsx(ve,{hardware:t}),l=e.jsxs(e.Fragment,{children:[r.motion.length===0&&e.jsx(i.Alert,{variant:"danger",className:"mb-0",children:"No flat motion defined"}),r.motion.length>0&&e.jsx(i.Stack,{direction:"vertical",children:r.motion.map((u,d)=>e.jsx(Cl,{actions:t.actions,motion:u,disabled:s},u.axisRef))})]}),f=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:a,widgetState:c,widgetContent:l,headerMode:f})}const Ol={default:St,small:Ct,state:vl},Il=Ol;function Ot(n){return n.type==="tomoflatmotion"}function Ml(n){const t=E(n);return t===null||!Ot(t)?null:t}const Tl="tomoflatmotion",Fl="tomoflatmotion",Dl=!0,Al={state:"READY",settle_time:2,power_onoff:!1,move_in_parallel:!0,available_axes:["hardware:sy","hardware:sy2"],motion:[{axisRef:"hardware:sy",absolute_position:null,relative_position:1}]},Rl="bliss",El=!1,kl="tomoflatmotion",Pl={id:Tl,name:Fl,online:Dl,properties:Al,protocol:Rl,require_staff:El,type:kl},Gl=["move","stop","wait","rmove"],Bl="sy",Vl="sy",Ll=!0,Ul={offset:0,sign:1,acceleration:300,limits:[-999999999,999999999],position:235.165400001,state:["READY"],tolerance:1e-4,unit:"um",velocity:1e3,display_digits:4},Hl="bliss",ql=!1,zl="motor",Wl=[],Yl={callables:Gl,id:Bl,name:Vl,online:Ll,properties:Ul,protocol:Hl,require_staff:ql,type:zl,user_tags:Wl},Kl=["move","stop","wait","rmove"],Ql="sy2",Xl="sy2",Jl=!0,Zl={offset:0,sign:1,acceleration:300,limits:[-999999999,999999999],position:235.165400001,state:["READY"],tolerance:1e-4,unit:"um",velocity:1e3,display_digits:4},ed="bliss",td=!1,nd="motor",od=[],sd={callables:Kl,id:Ql,name:Xl,online:Jl,properties:Zl,protocol:ed,require_staff:td,type:nd,user_tags:od},rd={default:Pl,sy:Yl,sy2:sd};function id(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=h.useState({state:"READY",settle_time:2,power_onoff:!1,move_in_parallel:!0,available_axes:["hardware:sy","hardware:sy2"],motion:[{axisRef:"hardware:sy",absolute_position:null,relative_position:1}]});function c(u,d){const p=[];let m=!1;return u.motion.forEach(g=>{if(g.axisRef===d.axis_ref){if(m=!0,d.relative_position===void 0&&d.absolute_position===void 0)return;p.push({axisRef:d.axis_ref,relative_position:d.relative_position??null,absolute_position:d.absolute_position??null});return}p.push(g)}),m||p.push({axisRef:d.axis_ref,relative_position:d.relative_position??null,absolute_position:d.absolute_position??null}),{...u,motion:p}}async function l(u,d){if(u==="update_axis"){a(p=>c(p,d));return}console.log("TomoFlatMotionSimulator: Unsupported call",u,d)}async function f(u,d){console.log("TomoFlatMotionSimulator: Unsupported setProperty",u,d)}return e.jsx(U,{name:t,alias:o,type:"tomoflatmotion",call:l,setProperty:f,properties:r,useHardwareContext:s})}function It(n){const{hardware:t,options:o={},disabled:s}=n,{actions:r}=t,a=e.jsx(y,{name:"TomoReferencePositionSchema",icon:"fam-hardware-motor",online:t.online});function c(){r.call("move_to_reference")}const l=e.jsx(e.Fragment,{}),f=e.jsx(i.Button,{className:"w-100",onClick:()=>{c()},disabled:s,children:"Back to parking position"}),u=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:a,widgetState:l,widgetContent:f,headerMode:u})}function ad(n){return n.type==="tomoreferenceposition"}const cd={default:It},ld=cd;function Ne(n){const{hardware:t}=n,{online:o,locked:s=null}=t,r=o?(s!==null?"LOCKED":t.properties.state)||"UNKNOWN":"OFFLINE",a={UNKNOWN:"danger",READY:"success",OFFLINE:"secondary",INVALID:"danger",MOUNTING:"warning",UNMOUNTING:"warning",LOCKED:"warning"},c=a[r]||a.UNKNOWN;return e.jsx(F,{state:r,minWidth:6,variant:c})}function dd(n){const{hardware:t}=n;return e.jsx(Ne,{hardware:t})}function ud(n){const{hardware:t,options:o={}}=n;function s(a){return t.actions?t.actions.setProperty("sample_pixel_size_mode",a):console.error("Change request was triggered with:",a),null}const r=t.properties.sample_pixel_size_mode;return e.jsx(i.Dropdown,{style:n.style,children:e.jsxs(i.ButtonGroup,{children:[e.jsx(i.Button,{variant:r==="USER"?"primary":"secondary",onClick:()=>{s("USER")},disabled:n.disabled,title:"Use a fixed pixel size defined by the user",children:"USER"}),e.jsx(i.Button,{variant:r==="AUTO"?"primary":"secondary",onClick:()=>{s("AUTO")},disabled:n.disabled,title:"Compute the pixel size automatically based on the beamline geometry",children:"AUTO"})]})})}function fd(n){const{hardware:t,options:o={}}=n,s=t.properties.user_sample_pixel_size||0,{state:r}=t.properties,a=r==="READY";function c(l){return t.actions?t.actions.setProperty("user_sample_pixel_size",l):console.error("Change request was triggered with:",l),null}return e.jsx(oe,{hardwareValue:s,onMoveRequested:c,hardwareIsDisabled:!1,hardwareIsReady:a,hardwareIsMoving:!1,readOnly:t.properties.sample_pixel_size_mode!=="USER"})}function pd(n){const{hardware:t,options:o={}}=n;return t.properties.state,e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{disabled:n.disabled,variant:"secondary"}),e.jsx(i.Dropdown.Menu,{popperConfig:{strategy:"fixed"},children:e.jsxs(i.Container,{children:[e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center",children:"Mode"})}),e.jsx(i.Row,{children:e.jsx(i.Col,{children:e.jsx(ud,{...n,style:{width:"100%"}})})}),e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center mt-1",children:"User pixel size"})}),e.jsx(i.Row,{children:e.jsx(i.Col,{children:e.jsxs(i.InputGroup,{children:[e.jsx(fd,{...n}),e.jsx(i.InputGroup.Text,{children:"um"})]})})})]})})]})}function md(n,t,o){return h.useMemo(()=>{function s(c){return c==="um"?"μm":c}function r(c){return c.toFixed(2).replace(/\.?0+$/,"")}if(n==null)return["∅",""];if(t===o)return[r(n),s(o)];const a=xn.default(n,t);return[r(a.to(o).scalar),s(o)]},[n,t,o])}function Mt(n){const{hardware:t,options:o={}}=n,s=o.display_unit??"um",r=e.jsx(y,{name:"TomoDetector",icon:"fa-cog",online:t.online}),a=e.jsx(Ne,{hardware:t}),[c,l]=md(t.properties.sample_pixel_size,"um",s),f=e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(i.InputGroup.Text,{className:"justify-content-center",style:{minWidth:"4em"},children:t.properties.sample_pixel_size_mode}),e.jsx(A,{value:c,title:`${t.properties.sample_pixel_size} um`}),e.jsx(i.InputGroup.Text,{children:l}),e.jsx(pd,{...n})]}),u=n.options?n.options.header:"top";return e.jsx(v,{hardware:t,widgetIcon:r,widgetState:a,widgetContent:f,headerMode:u})}function hd(n){const{hardware:t,options:o={}}=n;function s(a){return t.actions?t.actions.setProperty("acq_mode",a):console.error("Change request was triggered with:",a),null}const r=t.properties.acq_mode;return e.jsx(i.Dropdown,{style:n.style,children:e.jsxs(i.ButtonGroup,{children:[e.jsx(i.Button,{variant:r==="SINGLE"?"primary":"secondary",onClick:()=>{s("SINGLE")},disabled:n.disabled,title:"Do acquisition in a single shot",children:"SINGLE"}),e.jsx(i.Button,{variant:r==="ACCUMULATION"?"primary":"secondary",onClick:()=>{s("ACCUMULATION")},disabled:n.disabled,title:"Do acqisition in multiple sub frame with accumulation",children:"ACCU"})]})})}function xd(n){const{hardware:t,actions:o}=n,s=t.properties.acc_max_expo_time||0,{state:r}=t.properties,a=r==="READY";function c(l){return o.setProperty("acc_max_expo_time",l),null}return e.jsx(oe,{hardwareValue:s,onMoveRequested:c,hardwareIsDisabled:!1,hardwareIsReady:a,hardwareIsMoving:!1,readOnly:t.properties.state!=="READY"})}function gd(n){const t=E(n);return t!==null&&ge(t)?t:null}function jd(n){var c;const{hardware:t}=n,{properties:o}=t,s=((c=o.detector)==null?void 0:c.slice(9))??"",r=gd(s),a=te(s);return e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{disabled:n.disabled,variant:"secondary"}),e.jsx(i.Dropdown.Menu,{popperConfig:{strategy:"fixed"},children:e.jsxs(i.Container,{children:[e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center",children:"Acquisition mode"})}),e.jsx(i.Row,{children:e.jsx(i.Col,{children:e.jsx(hd,{...n,style:{width:"100%"}})})}),e.jsx(i.Row,{children:e.jsx(i.Col,{className:"text-center mt-1",children:"Max sub frame exposition"})}),e.jsx(i.Row,{children:e.jsx(i.Col,{children:r&&e.jsxs(i.InputGroup,{children:[e.jsx(xd,{hardware:r,actions:a}),e.jsx(i.InputGroup.Text,{children:"um"})]})})})]})})]})}function Tt(n){const{hardware:t}=n,o=e.jsx(y,{name:"TomoDetector",icon:"fa-cog",online:t.online}),s=e.jsx(Ne,{hardware:t}),r=e.jsxs(i.InputGroup,{className:"flex-nowrap",children:[e.jsx(A,{value:t.properties.acq_mode}),e.jsx(jd,{...n})]}),a=n.options?n.options.header:"top";return e.jsx(v,{hardware:t,widgetIcon:o,widgetState:s,widgetContent:r,headerMode:a})}const wd={samplepixelsize:Mt,acquisitionmode:Tt,state:dd},yd=wd;function Te(n){return n.type==="tomodetector"}function vd(n){const t=E(n);return t===null||!Te(t)?null:t}const Nd="tomodetector",bd="tomodetector",_d=!0,$d={state:"READY",actual_size:[1024,1024],sample_pixel_size_mode:"AUTO",user_sample_pixel_size:50,sample_pixel_size:48},Sd="bliss",Cd=!1,Od="tomodetector",Id={id:Nd,name:bd,online:_d,properties:$d,protocol:Sd,require_staff:Cd,type:Od},Md={default:Id};function Fe(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={READY:"success",MOUNTING:"warning",UNMOUNTING:"warning",UNKNOWN:"fatal",OFFLINE:"warning"},r=s[o]||s.UNKNOWN;return e.jsx(F,{state:o,minWidth:6,variant:r})}function Td(n){const{hardware:t}=n;return e.jsx(Fe,{hardware:t})}function ne(n){return!n||!n.startsWith("hardware:")?null:n.slice(9)}function Fd(n){const{hardware:t}=n,{properties:o}=t,{detectors:s}=o,r=ne(o.active_detector),a=ne(o.target_detector),c=o.state==="READY",l=n.disabled||!t.online||!c;function f(d){t.actions?t.actions.call("mount",d):console.error("Change request was triggered with:",d)}function u(d){const p=ne(d),g=p===(a||r)?"fa fa-fw fa-dot-circle-o":"fa fa-fw fa-circle-o";return e.jsxs(i.Dropdown.Item,{disabled:l,onClick:()=>{f(p)},children:[e.jsx("i",{className:g}),"  ",p]},d)}return e.jsxs(i.Dropdown,{children:[e.jsx(i.Dropdown.Toggle,{disabled:l,variant:"secondary"}),e.jsx(i.Dropdown.Menu,{popperConfig:{strategy:"fixed"},children:s.map(d=>u(d))})]})}function Ft(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"Optic",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(Fe,{hardware:t}),{properties:a}=t,c=a.state==="MOUNTING",l=ne(a.active_detector),f=ne(a.target_detector);function u(){return e.jsxs(i.InputGroup,{children:[e.jsx(A,{className:P.default({"hw-moving":c}),value:f||l||"No detector"}),e.jsx(Fd,{...n})]})}const d=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:u(),headerMode:d})}const Dd={default:Ft,state:Td},Ad=Dd;function Dt(n){return n.type==="tomodetectors"}function Rd(n){const t=E(n);return t===null||!Dt(t)?null:t}const Ed="tomodetectors",kd="tomodetectors",Pd=!0,Gd={state:"READY",active_detector:"hardware:limadetector1",detectors:["hardware:limadetector1","hardware:limadetector2","hardware:limadetector3"]},Bd="bliss",Vd=!1,Ld="optic",Ud={id:Ed,name:kd,online:Pd,properties:Gd,protocol:Bd,require_staff:Vd,type:Ld},Hd={default:Ud};function K(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={READY:"success",BLOCKED:"secondary",ACQUIRING:"warning",UNKNOWN:"fatal"},r=s[o]||s.UNKNOWN;return e.jsx(F,{state:o,minWidth:6,variant:r})}function qd(n){const{hardware:t}=n;return e.jsx(K,{hardware:t})}function zd(n){const{hardware:t}=n,o=t.properties.update_on_move,s=n.disabled||!t.online;function r(c){t.actions.setProperty("update_on_move",!1)}function a(c){t.actions.setProperty("update_on_move",!0)}return e.jsxs(i.ButtonGroup,{className:"me-2",children:[e.jsx(i.InputGroup.Text,{children:"Update mode"}),e.jsx(i.Button,{onClick:a,disabled:s,variant:o?"primary":"secondary",children:"Auto"}),e.jsx(i.Button,{onClick:r,disabled:s,variant:o?"secondary":"primary",children:"Off"})]})}function Wd(n){const{hardware:t}=n,o=t.properties.exposure_time??0,s=n.disabled||!t.online,r=h.useRef(null),[a,c]=h.useState(!1),l=2;function f(d){!r||!r.current?console.log("formRef not yet defined"):d.key==="Enter"?(c(!1),t.actions.setProperty("exposure_time",Number.parseFloat(r.current.value))):d.key==="Escape"&&(r.current.value=o.toFixed(l),c(!1))}function u(d){const{value:p}=d.target;if(p===void 0)return;const m=Number.parseFloat(p);m!==o&&!a&&c(!0),m===o&&a&&c(!1)}return h.useEffect(()=>{!r||!r.current?console.log("formRef not yet defined"):a||(r.current.value=o.toFixed(l))},[a,o]),e.jsxs(i.InputGroup,{className:"me-2",children:[e.jsx(i.InputGroup.Text,{children:"Exposure time"}),e.jsx(i.Form.Control,{className:a?"form-control-edited":"",type:"number",ref:r,defaultValue:o.toFixed(l),onChange:u,disabled:s,onKeyDown:f}),e.jsx(i.InputGroup.Text,{children:"s"})]})}function Yd(n){const{hardware:t}=n,o=n.disabled||!t.online;function s(c){t.actions.call("take_proj")}function r(c){t.actions.call("take_dark")}function a(c){t.actions.call("take_flat")}return e.jsxs(i.ButtonGroup,{size:"lg",className:"me-2",children:[e.jsx(i.InputGroup.Text,{children:"Take"}),e.jsx(i.Button,{onClick:s,disabled:o,variant:"primary",children:"Proj"}),e.jsx(i.Button,{onClick:a,disabled:o,variant:"primary",children:"Flat"}),e.jsx(i.Button,{onClick:r,disabled:o,variant:"primary",children:"Dark"})]})}function At(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"TomoImaging",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(K,{hardware:t}),a=e.jsxs(i.Container,{children:[e.jsx(i.Row,{className:"mt-1",children:e.jsx(i.Col,{children:e.jsx(zd,{hardware:t,disabled:n.disabled})})}),e.jsx(i.Row,{className:"mt-1",children:e.jsx(i.Col,{children:e.jsx(Wd,{hardware:t,disabled:n.disabled})})}),e.jsx(i.Row,{className:"mt-1",children:e.jsx(i.Col,{children:e.jsx(Yd,{hardware:t,disabled:n.disabled})})})]}),c=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Kd(n){const{hardware:t}=n,o=t.properties.exposure_time??0,s=n.disabled||!t.online,r=h.useRef(null),[a,c]=h.useState(!1),l=3;function f(d){!r||!r.current?console.log("formRef not yet defined"):d.key==="Enter"?(c(!1),t.actions.setProperty("exposure_time",Number.parseFloat(r.current.value))):d.key==="Escape"?(r.current.value=o.toFixed(l),c(!1)):console.log(d.key)}function u(d){const{value:p}=d.target;if(p===void 0)return;const m=Number.parseFloat(p);m!==o&&!a&&c(!0),m===o&&a&&c(!1)}return h.useEffect(()=>{!r||!r.current?console.log("formRef not yet defined"):a||(r.current.value=o.toFixed(l))},[a,o]),e.jsxs(i.InputGroup,{className:"w-100",children:[e.jsx(i.Form.Control,{className:a?"form-control-edited":"",type:"number",ref:r,defaultValue:o.toFixed(l),onChange:u,disabled:s,onKeyDown:f}),e.jsx(i.InputGroup.Text,{children:"s"})]})}function Qd(n){const{exposureTime:t}=n,o=E("ACTIVE_TOMOCONFIG.ref.detectors.active_detector.detector"),s=E("ACTIVE_TOMOCONFIG.ref.detectors.active_detector");if(o===null||s===null)return e.jsx(e.Fragment,{});if(!ge(o)||!Te(s))return e.jsx(e.Fragment,{});const r=o.properties.acc_max_expo_time,a=s.properties.acq_mode;if(!r||a!=="ACCUMULATION")return e.jsx(e.Fragment,{});const[c,l]=lt(t,r);return e.jsxs("div",{className:"text-center",title:"Decompisiton of the accumulation",children:[c," × ",l.toFixed(3)]})}function Rt(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"TomoImaging",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(K,{hardware:t}),a=e.jsxs(e.Fragment,{children:[e.jsx(Kd,{hardware:t,disabled:n.disabled}),e.jsx(Qd,{exposureTime:t.properties.exposure_time})]}),c=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Xd(n){const{hardware:t}=n,o=t.properties.settle_time||0,s=n.disabled||!t.online,r=h.useRef(null),[a,c]=h.useState(!1),l=3;function f(d){!r||!r.current?console.log("formRef not yet defined"):d.key==="Enter"?(c(!1),t.actions.setProperty("settle_time",Number.parseFloat(r.current.value))):d.key==="Escape"?(r.current.value=o.toFixed(l),c(!1)):console.log(d.key)}function u(d){const{value:p}=d.target;if(p===void 0)return;const m=Number.parseFloat(p);m!==o&&!a&&c(!0),m===o&&a&&c(!1)}return h.useEffect(()=>{!r||!r.current?console.log("formRef not yet defined"):a||(r.current.value=o.toFixed(l))},[a,o]),e.jsxs(i.InputGroup,{className:"w-100",children:[e.jsx(i.Form.Control,{className:a?"form-control-edited":"",type:"number",ref:r,defaultValue:o.toFixed(l),onChange:u,disabled:s,onKeyDown:f}),e.jsx(i.InputGroup.Text,{children:"s"})]})}function Et(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"TomoImaging",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(K,{hardware:t}),a=e.jsx(Xd,{hardware:t,disabled:n.disabled}),c=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function be(n){const{text:t,processing:o,disabled:s,onClick:r,title:a}=n;return e.jsxs(i.Button,{onClick:r,disabled:s,variant:"primary",className:P.default({"ps-4":!o,"pe-4":!o}),title:a,children:[o&&e.jsx("i",{className:"fa-solid fa-cog fa-spin me-1"}),t]})}function Jd(n){const{hardware:t}=n,[o,s]=h.useState(!1),[r,a]=h.useState(!1),[c,l]=h.useState(!1),f=n.disabled||!t.online||o||r||c;function u(m){l(!0),t.actions.call("take_proj").finally(()=>{l(!1)})}function d(m){s(!0),t.actions.call("take_dark").finally(()=>{s(!1)})}function p(m){a(!0),t.actions.call("take_flat").finally(()=>{a(!1)})}return e.jsxs(i.ButtonGroup,{size:"lg",className:"w-100",children:[e.jsx(be,{onClick:u,disabled:f,processing:c,text:"Proj",title:"Take a projection"}),e.jsx(be,{onClick:p,disabled:f,processing:r,text:"Flat",title:"Take a flat"}),e.jsx(be,{onClick:d,disabled:f,processing:o,text:"Dark",title:"Take a dark"})]})}function kt(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"TomoImaging",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(K,{hardware:t}),a=e.jsx(Jd,{hardware:t,disabled:n.disabled}),c=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Zd(n){const{hardware:t}=n,o=t.properties.update_on_move,s=n.disabled||!t.online;function r(c){t.actions.setProperty("update_on_move",!1)}function a(c){t.actions.setProperty("update_on_move",!0)}return e.jsxs(i.ButtonGroup,{className:"w-100",children:[e.jsx(i.Button,{onClick:a,disabled:s,variant:o?"primary":"secondary",children:"Auto"}),e.jsx(i.Button,{onClick:r,disabled:s,variant:o?"secondary":"primary",children:"Off"})]})}function Pt(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"TomoImaging",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(K,{hardware:t}),a=e.jsx(Zd,{hardware:t,disabled:n.disabled}),c=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const eu={default:At,exposuretime:Rt,settletime:Et,actions:kt,updatemode:Pt,state:qd},tu=eu,nu="tomoimaging",ou="tomoimaging",su=!0,ru={state:"READY",update_on_move:!1,exposure_time:1},iu="bliss",au=!1,cu="optic",lu={id:nu,name:ou,online:su,properties:ru,protocol:iu,require_staff:au,type:cu},du={default:lu};function uu(n){const{name:t,alias:o,useHardwareContext:s}=n,[r,a]=h.useState({state:"READY",update_on_move:!0,exposure_time:1,settle_time:0});function c(u){a(d=>({...d,state:u}))}async function l(u,d){if(u==="take_dark"){c("ACQUIRING"),await R(2e3),c("READY");return}if(u==="take_flat"){c("ACQUIRING"),await R(2e3),c("READY");return}if(u==="take_proj"){c("ACQUIRING"),await R(2e3),c("READY");return}console.log("TomoImagingSimulator: Unsupported call",u,d)}async function f(u,d){a(p=>({...p,[u]:d}))}return e.jsx(U,{name:t,alias:o,type:"tomoimaging",call:l,setProperty:f,properties:r,useHardwareContext:s})}const fu={},pu=fu;function Gt(n){return n.type==="tomosamplestage"}function mu(n){const t=E(n);return t===null||!Gt(t)?null:t}function hu(n){const{hardware:t}=n,o=t.properties.latency_time||0,s=n.disabled||!t.online,r=h.useRef(null),[a,c]=h.useState(!1),l=3;function f(d){!r||!r.current?console.log("formRef not yet defined"):d.key==="Enter"?(c(!1),t.actions.setProperty("latency_time",r.current.value)):d.key==="Escape"?(r.current.value=o.toFixed(l),c(!1)):console.log(d.key)}function u(d){const{value:p}=d.target;if(p===void 0)return;const m=Number.parseFloat(p);m!==o&&!a&&c(!0),m===o&&a&&c(!1)}return h.useEffect(()=>{!r||!r.current?console.log("formRef not yet defined"):a||(r.current.value=o.toFixed(l))},[a,o]),e.jsxs(i.InputGroup,{className:"w-100",children:[e.jsx(i.Form.Control,{className:a?"form-control-edited":"",type:"number",ref:r,defaultValue:o.toFixed(l),onChange:u,disabled:s,onKeyDown:f}),e.jsx(i.InputGroup.Text,{children:"s"})]})}function Bt(n){const{hardware:t,options:o={}}=n,s=e.jsx(y,{name:"TomoImaging",icon:"fam-hardware-camera",online:t.online}),r=e.jsx(e.Fragment,{}),a=e.jsx(hu,{hardware:t,disabled:n.disabled}),c=o.header||"top";return e.jsx(v,{hardware:t,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const xu={latencytime:Bt},gu=xu;function Vt(n){return n.type==="tomoconfig"}function ju(n){const t=E(n);return t===null||!Vt(t)?null:t}function Lt(n){const{hardware:t}=n,o=t.online?t.properties.state:"OFFLINE",s={READY:"success",MOVING:"warning",STABILIZING:"warning",INVALID:"danger",INVALID_DETECTOR_BINNING_CHANGED:"danger",INVALID_DETECTOR_DISTANCE_CHANGED:"danger",INVALID_DETECTOR_CHANGED:"danger"},r=s[o]||s.UNKNOWN;return e.jsx(F,{state:o,minWidth:6,variant:r})}function wu(n){const{hardware:t}=n;return e.jsx(Lt,{hardware:t})}const yu={state:wu},vu=yu;function Ut(n){return n.type==="tomoholo"}function Nu(n){const t=E(n);return t===null||!Ut(t)?null:t}function bu(n){const{hardware:t}=n,o=()=>{t.actions.call("reset")};return e.jsx(i.OverlayTrigger,{trigger:"click",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"popover",children:[e.jsxs(i.Popover.Header,{children:[t.name," Details"]}),e.jsxs(i.Popover.Body,{children:[e.jsx("h6",{children:"Status"}),e.jsx("pre",{children:t.properties.status}),e.jsx("div",{className:"d-grid gap-2",children:e.jsx(i.Button,{disabled:n.disabled,onClick:o,children:"Reset"})})]})]}),children:e.jsx(i.Button,{className:"flex-grow-0",title:"Valve Details",children:e.jsx("i",{className:"fa fa-ellipsis-h"})})})}function Ht(n){const{hardware:t,options:o={}}=n,s=()=>{t.actions.call(t.properties.state==="OPEN"?"close":"open")};return e.jsxs("div",{className:"hw-component",children:[e.jsxs("div",{className:"hw-head",children:[e.jsx(y,{name:"Valve",icon:"fam-hardware-valve",online:t.online}),e.jsx("div",{className:"name",children:t.name}),e.jsx(i.Badge,{bg:t.properties.state==="OPEN"||t.properties.state==="RUNNING"?"success":"danger",children:t.properties.state})]}),e.jsx("div",{className:"hw-content",children:e.jsxs(i.ButtonGroup,{className:"d-flex",children:[e.jsx(i.Button,{variant:t.properties.state==="OPEN"?"danger":"success",onClick:s,disabled:n.disabled,children:t.properties.state==="OPEN"?"Close":"Open"}),e.jsx(bu,{...n})]})})]})}const _u={default:Ht},$u=_u,Su=["close","reset","open"],Cu="rv12",Ou="rv12",Iu=!0,Mu={state:"CLOSED",status:`Pneumatic is closed
34
+ `},Tu="tango",Fu=!1,Du="valve",Au={callables:Su,id:Cu,name:Ou,online:Iu,properties:Mu,protocol:Tu,require_staff:Fu,type:Du},Ru={default:Au},Eu=Se.default("daiquiri.components.hardware.NoObject");function ku(n){if(n.options.emptyifnone)return Eu('Component id:"%s" name:"%s" not displayed cause setup with emptyifnone.',n.id,n.name),e.jsx(e.Fragment,{});const t=e.jsx(y,{name:"NoObject",icon:"fam-hardware-any",online:!1}),o=e.jsx(e.Fragment,{}),s=e.jsx("span",{title:`Object '${n.name}' is missing`,children:"Missing"}),r=n.options?n.options.header:"top",a={id:n.id,name:n.name??"",alias:null,user_tags:[],online:!1,locked:null,properties:{},type:""};return e.jsx(v,{hardware:a,widgetIcon:t,widgetState:o,widgetContent:s,headerMode:r})}function Pu(n){const t=e.jsx(y,{name:"NoObject",icon:"fam-hardware-any",online:!1}),o=e.jsx(e.Fragment,{}),s=e.jsx("span",{title:`Object '${n.name}' is loading`,children:e.jsx("i",{className:"fa-solid fa-spinner fa-spin-pulse"})}),r=n.options?n.options.header:"top",a={id:n.id,name:n.name??"",alias:null,user_tags:[],online:!1,locked:null,properties:{},type:""};return e.jsx(v,{hardware:a,widgetIcon:t,widgetState:o,widgetContent:s,headerMode:r})}const Gu=Se.default("daiquiri.components.hardware.MissingObject");function Bu(n){if(n.options.emptyifnone)return Gu('Component id:"%s" name:"%s" not displayed cause setup with emptyifnone.',n.id,n.name),e.jsx(e.Fragment,{});const t=e.jsx(y,{name:"NoObject",icon:"fam-hardware-any",online:!1}),o=e.jsx(e.Fragment,{}),s=e.jsx("span",{title:`Object '${n.name}' is missing`,children:"Missing"}),r=n.options?n.options.header:"top",a={id:n.id,name:n.name??"",alias:null,user_tags:[],online:!1,locked:null,properties:{},type:""};return e.jsx(v,{hardware:a,widgetIcon:t,widgetState:o,widgetContent:s,headerMode:r})}function Vu(n){const{properties:t={}}=n,{message:o="Unknown error"}=t,s=e.jsx(y,{name:"NoObject",icon:"fam-hardware-any",online:!1}),r=e.jsx(e.Fragment,{}),a=e.jsx(i.OverlayTrigger,{trigger:["focus","hover"],placement:"bottom",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"error",style:{maxWidth:500},children:[e.jsx(i.Popover.Header,{children:"Error"}),e.jsx(i.Popover.Body,{children:e.jsx("ul",{children:e.jsx("li",{children:o})})})]}),children:e.jsxs(i.Button,{variant:"danger",size:"sm",className:"w-100",children:[e.jsx("i",{className:"fa fa-exclamation-triangle"})," Error"]})}),c=n.options?n.options.header:"top",l={id:n.id,name:n.name??"",alias:null,user_tags:[],online:!1,locked:null,properties:{},type:""};return e.jsx(v,{hardware:l,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}const Lu=Se.default("daiquiri.components.hardware.MissingComponentObject");function Uu(n){const{options:t}=n,{variant:o="default"}=t;if(t.emptyifnone)return Lu('Component id:"%s" name:"%s" not displayed cause setup with emptyifnone.',n.id,n.name),e.jsx(e.Fragment,{});const s=e.jsx(y,{name:"NoObject",icon:"fam-hardware-any",online:!1}),r=e.jsx(e.Fragment,{}),a=e.jsx(i.OverlayTrigger,{trigger:["focus","hover"],placement:"bottom",rootClose:!0,overlay:e.jsxs(i.Popover,{id:"error",style:{maxWidth:500},children:[e.jsx(i.Popover.Header,{children:"Error"}),e.jsx(i.Popover.Body,{children:e.jsx("ul",{children:e.jsxs("li",{children:["No component available for object id '",n.name,"' (type '",n.type,"' and/or variant '",o,"' are not registred)"]})})})]}),children:e.jsxs(i.Button,{variant:"danger",size:"sm",className:"w-100",children:[e.jsx("i",{className:"fa fa-exclamation-triangle"})," Error"]})}),c=t?t.header:"top",l={id:n.id,name:n.name??"",alias:null,user_tags:[],online:!1,locked:null,properties:{},type:""};return e.jsx(v,{hardware:l,widgetIcon:s,widgetState:r,widgetContent:a,headerMode:c})}function Hu(n){if(n.options.emptyifnone)return e.jsx(e.Fragment,{});const t=e.jsx(y,{name:"NoObject",icon:"fam-hardware-any",online:!1}),o=e.jsx(e.Fragment,{}),s=e.jsx(e.Fragment,{children:"No object"}),r=n.options?n.options.header:"top",a={id:n.id,name:n.name??"",alias:null,user_tags:[],online:!1,locked:null,properties:{},type:""};return e.jsx(v,{hardware:a,widgetIcon:t,widgetState:o,widgetContent:s,headerMode:r})}function qt(n){const[t,o]=h.useState({}),s=h.useRef(null);return h.useEffect(()=>{if(s.current){const r=s.current;o({width:r.clientWidth,height:r.clientHeight})}},[]),e.jsx("div",{ref:s,style:{width:"100%",height:"100%"},className:n.className,children:t.width>0&&e.jsx("div",{className:"full-sizer",style:{width:`${t.width}px`,height:`${t.height}px`,overflow:"scroll"},children:n.children})})}function qu(n){return e.jsx("div",{className:"panel-header",style:n.style,children:n.children})}function zu(n){return e.jsx("div",{className:`panel-contents ${n.className}`,style:n.style,children:n.children})}function T(n){const t=n.scroll?qt:h.Fragment;return e.jsx("div",{className:`panel ${n.className??""}`,style:n.style,children:e.jsx(t,{children:n.children})})}T.Header=qu;T.Contents=zu;const de={};function zt(n,t){de[n]=t}function V(n,t,o=!0){if(!n)return e.jsx(e.Fragment,{});const{type:s}=n,r=s&&s in de?de[s]:de.component;return e.jsx(r,{yamlNode:n,panel:o},t)}function Wt(n,t){const{_parentNode:o,_indexFromParent:s,...r}=t;if(n&&Object.keys(r).length>0)throw new ue(n,Object.keys(r))}class Y extends Error{constructor(t,o){super(t),this.yamlNode=o}}class ue extends Y{constructor(t,o){super(`Unexpected keys: ${o.join(", ")}`,t),this.keys=o}}class se extends Y{constructor(t,o){super(`Keys ${o.join(", ")} are missing`,t),this.keys=o}}class O extends Y{constructor(t,o,s){super(`Key ${o} error: ${s}`,t),this.key=o,this.keyMessage=s}}function Wu(n){let t=n;for(;t._parentNode;)t=t._parentNode;return t}function Yu(n){const t=[];let o=n;for(;o;)t.push({node:o,indexFromParent:o._indexFromParent}),o=o._parentNode;return t.reverse(),t}function Yt(n,t=null,o=null){if(n._parentNode)throw new Error("Attribute _parentNode was already defined by the yml layout.");const s={...n,_parentNode:t,_indexFromParent:o};if(n.children){const r=[...n.children];Object.freeze(r),s.children=r.map((a,c)=>Yt(a,s,c))}return Object.freeze(s),s}function Ku(n,t,o){if(n&&o===void 0)throw new se(n,[t])}function De(n,t,o){if(typeof o!="string")throw new O(n,t,"A string is expected")}function Qu(n,t,o){if(typeof o!="boolean")throw new O(n,t,"A boolean is expected")}function Xu(n,t,o){if(typeof o!="number")throw new O(n,t,"A number is expected")}function fe(n,t,o){if(o!==void 0&&typeof o!="boolean")throw new O(n,t,"An optional boolean is expected")}function re(n,t,o){if(o!==void 0&&typeof o!="string")throw new O(n,t,"An optional string is expected")}function Ju(n,t,o){if(!Array.isArray(o))throw new O(n,t,"A list of string is expected");o.forEach(s=>{if(typeof s!="string")throw new O(n,t,"A list of string is expected")})}function Zu(n,t,o){if(o!==void 0&&typeof o!="string"){if(!Array.isArray(o))throw new O(n,t,"An optional string or list of string is expected");o.forEach(s=>{if(typeof s!="string")throw new O(n,t,"An optional string or list of string is expected")})}}function ef(n,t,o){if(o!==void 0){if(!Array.isArray(o))throw new O(n,t,"An optional list of string is expected");o.forEach(s=>{if(typeof s!="string")throw new O(n,t,"A optional list of string is expected")})}}function pe(n,t,o){if(o!==void 0&&typeof o!="number")throw new O(n,t,"An optional number is expected")}function tf(n,t,o){if(o!==void 0){if(!Array.isArray(o))throw new O(n,t,"An optional list of numbers is expected");o.forEach(s=>{if(typeof s!="number")throw new O(n,t,"An optional list of numbers is expected")})}}function J(n,t){const{_parentNode:o,_indexFromParent:s,...r}=t;if(n&&Object.keys(r).length>0)throw new ue(n,Object.keys(r))}function nf(n,t,o){if(o!=="last"&&typeof o!="number")throw new O(n,t,'"last" or a number is expected')}function of(n,t,o){if(o!==void 0&&o!=="h5web"&&o!=="plotly")throw new O(n,t,'"h5web" or "plotly" string is expected')}const sf=Object.freeze(Object.defineProperty({__proto__:null,assertBoolean:Qu,assertDataCollectionId:nf,assertKeyExpected:Ku,assertNoUnknownKeys:J,assertNumber:Xu,assertOptionalBackend:of,assertOptionalBoolean:fe,assertOptionalNumber:pe,assertOptionalNumberList:tf,assertOptionalString:re,assertOptionalStringList:ef,assertOptionalStringOrStringList:Zu,assertString:De,assertStringList:Ju},Symbol.toStringTag,{value:"Module"}));function Kt(n){const{providers:t={},yamlNode:o,message:s,...r}=n;return re(o,"message",s),J(o,r),e.jsx(i.Alert,{variant:"warning",className:"mb-0",children:s??"TODO"})}function Qt(n){return e.jsx(e.Fragment,{})}const rf=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),af=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));function Xt(n){var t;return e.jsxs(i.Alert,{variant:"danger",children:[n.message,e.jsx("br",{}),e.jsx("pre",{children:(t=n.error)==null?void 0:t.stack})]})}function cf(n){const{error:t}=n;if(!(t instanceof Y))return e.jsx(e.Fragment,{});function o(a,c=3){const l=Yu(a.yamlNode),f=[];let u="";for(let d=1;d<l.length;d++){const{node:p,indexFromParent:m}=l[d];f.push(`${u}children:`),u+=" ".repeat(c),m===1?f.push(`${u}- type: ...`):(m??0>1)&&f.push(`${u}...`,`${u}...`,`${u}# children number ${m??0+1}`),f.push(`${u}- type: ${p.type}`),u+=" ".repeat(2)}return a instanceof ue?a.keys.forEach(d=>{f.push(`${u}${d}: ... ${" ".repeat(50-u.length-d.length)}<-- unexpected key`)}):a instanceof se?a.keys.forEach(d=>{f.push(`${u}???: ${" ".repeat(50-u.length-d.length)}<-- key **${d}** is expected`)}):a instanceof O&&f.push(`${u}${a.key}: ${" ".repeat(50-u.length-a.key.length)}<-- ${a.keyMessage}`),f.join(`
35
+ `)}const r=Wu(t.yamlNode).name;if(t instanceof ue){const a=t.keys.length===1?"key":"keys";return e.jsxs(i.Alert,{variant:"danger",children:["Unexpected ",a," ",t.keys.map((c,l)=>e.jsxs(e.Fragment,{children:[l!==0&&", ",e.jsx("b",{children:c})]}))," ","from the layout name ",e.jsx("b",{children:r}),".",e.jsx("br",{}),e.jsx("pre",{className:"mt-3",children:o(t)}),e.jsx("br",{})]})}if(t instanceof se){const a=t.keys.length===1?"Key":"Keys";return e.jsxs(i.Alert,{variant:"danger",children:["Expected ",a," ",t.keys.map((c,l)=>e.jsxs(e.Fragment,{children:[l!==0&&", ",e.jsx("b",{children:c})]}))," ","from the layout name ",e.jsx("b",{children:r}),".",e.jsx("br",{}),e.jsx("pre",{className:"mt-3",children:o(t)}),e.jsx("br",{})]})}return t instanceof O?e.jsxs(i.Alert,{variant:"danger",children:["Error on key ",e.jsx("b",{children:t.key})," from the layout name ",e.jsx("b",{children:r}),".",e.jsx("br",{}),e.jsx("pre",{className:"mt-3",children:o(t)}),e.jsx("br",{})]}):e.jsx(Xt,{...n})}const Pe={hasError:!1,message:"",error:void 0};class Jt extends h.Component{constructor(t){super(t),this.reload=()=>{window.location.reload()},this.state=Pe}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){var o,s;if(t instanceof Y||!this.props.unhandledComponentDidCatch){this.setState({hasError:!0,message:t.message,error:t});return}(s=(o=this.props).unhandledComponentDidCatch)==null||s.call(o,t,r=>{this.setState({hasError:!0,message:t.message,error:t,...r})})}componentDidUpdate(t,o){this.state.hasError&&o.error!==void 0&&t.resetKey!==this.props.resetKey&&this.setState(Pe)}render(){if(this.state.hasError){const{UnhandledErrorComponent:t}=this.props,{hasError:o,...s}=this.state;return e.jsxs(i.Container,{className:"mt-2",children:[e.jsx("h4",{children:"Something went wrong"}),this.state.error instanceof Y&&e.jsx(cf,{message:this.state.message,error:this.state.error}),!(this.state.error instanceof Y)&&e.jsx(e.Fragment,{children:t?e.jsx(t,{...s}):e.jsx(Xt,{message:this.state.message,error:this.state.error})}),e.jsxs("p",{children:["This error has been logged. Please"," ",e.jsxs(i.Button,{size:"sm",onClick:this.reload,children:[e.jsx("i",{className:"fa fa-refresh"})," Reload"]})," ","the application"]})]})}return this.props.children}}function lf({yamlNode:n,panel:t}){const{type:o,style:s,children:r,...a}=n;return J(n,a),e.jsx(i.Row,{className:"ymllayout-row gx-0",style:s,children:D.map(r,(c,l)=>V(c,l,t))})}function df({yamlNode:n,panel:t}){const{type:o,style:s,xs:r,children:a,...c}=n;return J(n,c),pe(n,"xs",r),e.jsx(i.Col,{className:P.default("yamymllayout-col",{col:!!r}),style:s,xs:r,children:D.map(n.children,(l,f)=>V(l,f,t))})}const ie={};function uf(n,t){ie[n]=t}function ff(n,t){if(t===void 0)throw new se(n,["id"]);if(typeof t.id!="string")throw new O(n,"id","A string is expected")}function pf(n,t,o){if(o!==void 0){if(!Array.isArray(o))throw new O(n,t,"A option list is expected");o.forEach((s,r)=>{try{ff(n,s)}catch{throw new O(n,t,`The hardware description ${r} is wrong`)}})}}function mf(n){const{providers:t={},yamlNode:o,ids:s,groupid:r,even:a,nowrap:c,...l}=n;if(pf(o,"ids",s),re(o,"groupid",r),fe(o,"even",a),fe(o,"nowrap",c),J(o,l),!ie.HardwareGroup)return e.jsx(i.Alert,{variant:"warning",children:"No `HardwareGroup` component registered"});const f=ie.HardwareGroup;return e.jsx(f,{providers:t,ids:s,groupid:r,nowrap:c||!1,even:a||!1})}function hf(n){const{providers:t={},yamlNode:o,id:s,variant:r,header:a,width:c,colWidth:l,emptyifnone:f,...u}=n;De(o,"id",s),re(o,"variant",r),re(o,"header",a),pe(o,"width",c),pe(o,"colWidth",l),fe(o,"emptyifnone",f);const d={variant:r,header:a,width:c,colWidth:l,emptyifnone:f,...u};if(!ie.Hardware)return e.jsx(i.Alert,{variant:"warning",children:"No `Hardware` component registered"});const p=ie.Hardware;return e.jsx(p,{providers:t,id:s,options:d})}function xf(n){const{providers:t={},yamlNode:o,label:s,...r}=n;return De(o,"label",s),J(o,r),e.jsx("div",{children:s})}const me={hardwaregroup:mf,hardware:hf,todo:Kt,none:Qt,label:xf};function Zt(n,t){me[n]=t}function gf(n){Object.entries(n).forEach(([t,o])=>Zt(t,o))}function jf(n){const{yamlNode:t,panel:o}=n,{type:s,style:r,scroll:a,title:c,...l}=t;if(!(s in me))return e.jsx(T,{children:e.jsx(T.Contents,{children:e.jsxs(i.Alert,{variant:"warning",children:['Unknown component "',s,'"']})})});const f=me[t.type];return o?e.jsx(T,{style:r,scroll:a,children:e.jsxs(h.Suspense,{fallback:e.jsx("p",{children:"Loading..."}),children:[c&&e.jsx(T.Header,{children:c}),e.jsx(T.Contents,{children:e.jsx(f,{...l,yamlNode:t})})]})}):e.jsx(h.Suspense,{fallback:e.jsx("p",{children:"Loading..."}),children:e.jsx(f,{...l,yamlNode:t})})}function wf({yamlNode:n,panel:t}){const o=n.options||{};return e.jsx(i.Container,{className:"ymllayout-container",...o,children:D.map(n.children,(s,r)=>V(s,r,t))})}function yf(n){const{yamlNode:t}=n,o=t.options||{},s={};return o.centerContent&&(s.margin="auto"),e.jsxs(T,{className:"ymllayout-panel",...o,children:[t.title&&e.jsx(T.Header,{children:t.title}),e.jsx(T.Contents,{style:s,children:D.map(t.children,(r,a)=>V(r,a,!1))})]})}const vf=()=>Math.random().toString(36).slice(2,15)+Math.random().toString(36).slice(2,15);function Nf({yamlNode:n,panel:t}){const o=[];return D.each(n.children,(s,r)=>{o.push(e.jsx(i.Tab,{eventKey:vf(),title:s.title,children:V(s,0,!1)},r))}),t?e.jsxs(T,{className:"ymllayout-tabs",children:[n.title&&e.jsx(T.Header,{children:n.title}),e.jsx(T.Contents,{children:e.jsx(i.Tabs,{mountOnEnter:!0,children:o})})]}):e.jsx(i.Tabs,{children:o})}function bf(n){const{node:t}=n,{type:o,title:s,...r}=t;return Wt(t,r),e.jsx("div",{className:"ymllayout-form-header",style:{gridColumn:"1 / 3"},children:e.jsx("h3",{children:s})})}function _f(n){const{node:t,state:o,row:s}=n,{title:r}=t;function a(){if(t.id)return t.id}function c(){if(r!==void 0)return r;if(t.type==="hardware"){const f=a(),u={_parentNode:t._parentNode,_indexFromParent:t._indexFromParent,type:"hardware",id:f,variant:"name",emptyifnone:!0};return V(u,"a",!1)}return""}const l=c();return e.jsxs("div",{style:{textAlign:"center"},children:[e.jsx("h5",{style:{margin:"0px",whiteSpace:"nowrap"},children:l}),o&&e.jsx("div",{style:{position:"relative",top:-5},children:o})]})}function $f(n){const{node:t,row:o}=n,{titlealign:s,title:r,stateinheader:a=!1,variant:c,id:l,...f}=t;let u,d;if(f.type==="hardware")if(u={...f,id:l,variant:c},a){const p={...f,id:l,variant:"state",emptyifnone:!0};d=V(p,"k",!1)}else d=null;else u=f,d=null;return e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{gridColumn:1,alignSelf:s??"center"},children:e.jsx(_f,{node:t,state:d,row:o})}),e.jsx("div",{style:{gridColumn:2,alignSelf:"center"},children:V(u,"k",!1)})]})}function Sf(n){const{yamlNode:t,panel:o}=n,{type:s,children:r,options:a={},title:c,...l}=t;return Wt(t,l),e.jsxs(T,{className:"ymllayout-form",...a,children:[t.title&&e.jsx(T.Header,{children:t.title}),e.jsx(T.Contents,{className:"full-sizer",style:{overflow:"auto"},children:e.jsx("div",{style:{display:"grid",gridTemplateColumns:"min-content auto"},children:D.map(r,(f,u)=>f.type==="formheader"?e.jsx(bf,{node:f,row:u},u):f.type==="none"?e.jsx(pn.default.Fragment,{},u):e.jsx($f,{node:f,row:u},u))})})]})}function Cf(n){const{yamlNode:t,panel:o}=n;return e.jsxs("div",{className:"ymllayout-grid",style:{gridTemplateColumns:t.columns,gridTemplateRows:t.rows},children:[D.map(t.children,(s,r)=>{const{columnSpan:a=1,rowSpan:c=1,...l}=s,f=a>1?`span ${a}`:void 0,u=c>1?`span ${c}`:void 0;return e.jsx("div",{className:"ymllayout-grid-cell",style:{gridColumn:f,gridRow:u},children:V(l,r,o)},r)})," "]})}const en={row:lf,col:df,container:wf,panel:yf,tabs:Nf,form:Sf,grid:Cf},tn={...en,component:jf};Object.entries(tn).forEach(([n,t])=>{zt(n,t)});function Of(n){var o;const t=h.useMemo(()=>Yt(n.layout),[n.layout]);return t.error?e.jsx("div",{className:`${n.className??""} ymllayout-main`,"data-testid":n.testid,children:e.jsxs(T,{children:[e.jsx(T.Header,{children:"Layout Error"}),e.jsxs(T.Contents,{children:[e.jsxs("p",{children:["File: ",t.name]}),e.jsx(i.Alert,{variant:"warning",children:e.jsx("pre",{className:"mb-0",children:t.error})})]})]})}):e.jsx("div",{className:`${n.className??""} ymllayout-main`,"data-testid":n.testid,children:e.jsx(Jt,{resetKey:t,unhandledComponentDidCatch:n.unhandledComponentDidCatch,UnhandledErrorComponent:n.UnhandledErrorComponent,children:(o=t.children)==null?void 0:o.map((s,r)=>V(s,r))})})}const If=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),nn=(n,t,o)=>{const s={">":(r,a)=>r>a,"<":(r,a)=>r<a,">=":(r,a)=>r>=a,"<=":(r,a)=>r<=a,"==":(r,a)=>r===a,"!=":(r,a)=>r!==a,in:(r,a)=>a.indexOf(r)>-1};if(n in s)return s[n](t,o)};function on(n,t,o){const s=n.split(t);return o?[s.slice(0,-o).join(t)].concat(s.slice(-o)):s}function sn(n){return n===null?null:n.startsWith("$")?(console.log(n.slice(1)),n.slice(1)):n}function Ge(n){const t=n!==void 0?on(n,".",1):[null,""],o=E(sn(t[0]));if(!o||!o.properties)return;const s=t[1];if(s===null)return;const r=o.properties[s];return Array.isArray(r)?r[0]:r}function Mf(n){const t=n!==void 0&&!n.includes("."),o=n!==void 0?on(n,".",1):[null,""],s=E(sn(o[0]));if(t)return n;if(s&&s.properties&&o[1]!==null)return`${s.properties[o[1]]}`}function rn(n){const{monitor:t}=n;let o=Ge(t.value)??"-";const s=Mf(t.unit),r=Ge(t.overlay),a=Number.parseFloat(`${o}`);Number.isNaN(a)||String(a).length>5&&(o=a.toPrecision(5));let c;if(t.comparator&&t.comparison&&(c=nn(t.comparator,o,t.comparison)?"valid":"invalid"),Number.isNaN(a)||s!==void 0&&(o=`${o} ${s}`),r){const l=`${r}`;return e.jsx(i.OverlayTrigger,{placement:"bottom",overlay:e.jsx(i.Tooltip,{id:"tooltipid",className:"monitor-panel-tooltip",children:l.includes(`
36
+ `)?e.jsx("pre",{children:l}):l}),children:e.jsxs(i.Col,{className:"monitor-panel-item",children:[e.jsx("h1",{children:t.name}),e.jsx("div",{className:c,children:`${o}`})]})},t.name)}return e.jsxs(i.Col,{className:"monitor-panel-item",children:[e.jsx("h1",{children:t.name}),e.jsx("div",{className:c,children:`${o}`})]},t.name)}const an={hardware:rn};function Tf(n,t){an[n]=t}function Ff(n){return e.jsxs(i.Col,{className:"monitor-panel-item bg-fatal",title:`Error from yaml configuration: ${n.message}`,children:[e.jsx("h1",{children:n.monitor.name}),e.jsx("div",{children:"Parsing error"})]})}function Df(n){const t=D.map(n.monitors,(o,s)=>{const r=o.type??"hardware",a=an[r];return a===void 0?e.jsx(Ff,{monitor:o,message:`Type ${r} unsupported`},`m${s}`):e.jsx(a,{monitor:o},`m${s}`)});return e.jsx("div",{className:P.default({"ms-auto":n.margin==="start"},"me-auto","monitor-panel",{"monitor-panel-light":n.bg==="light"}),children:e.jsx(i.Container,{fluid:!0,children:e.jsx(i.Row,{className:"flex-nowrap",children:t})})})}function Af(n){return e.jsx(i.Col,{className:"monitor-panel-item",children:n.children})}exports.AirBearing=ze;exports.AirBearingMocks=Vn;exports.AirBearingProtected=We;exports.AirBearingSimulator=Ln;exports.AirBearingState=he;exports.AirBearingVariants=Tn;exports.BaseInfo=Ue;exports.BaseMocks=_n;exports.BaseName=Le;exports.BaseProperty=He;exports.BaseState=Ve;exports.BaseVariants=yn;exports.ErrorObject=Vu;exports.Formatting=Wn;exports.Frontend=Ke;exports.FrontendMocks=io;exports.FrontendVariants=Qn;exports.FullSizer=qt;exports.Gauge=Qe;exports.GaugeMocks=Io;exports.GaugeVariants=lo;exports.HWObject=If;exports.HardwareInputNumber=oe;exports.HardwareNumericStep=xe;exports.HardwareSchema=af;exports.HardwareState=$n;exports.HardwareTemplate=v;exports.HardwareTypes=rf;exports.KeyError=O;exports.Laser=Je;exports.LaserHeating=Ze;exports.LaserHeatingMocks=ts;exports.LaserHeatingVariants=qo;exports.LaserMocks=Lo;exports.LaserVariants=Fo;exports.Light=et;exports.LightMocks=ps;exports.LightVariants=os;exports.LimaBinning=rt;exports.LimaDefault=tt;exports.LimaDescription=at;exports.LimaImageRoi=it;exports.LimaMocks=hr;exports.LimaShape=ct;exports.LimaSimulator=xr;exports.LimaSize=nt;exports.LimaState=H;exports.LimaTransformation=ot;exports.LimaVariants=Cs;exports.LoadingObject=Pu;exports.MeasurementGroupDefault=dt;exports.MeasurementGroupMocks=Fr;exports.MeasurementGroupSimulator=Dr;exports.MeasurementGroupVariants=Nr;exports.MissingComponentObject=Uu;exports.MissingKeysError=se;exports.MissingObject=Bu;exports.MonitorHardware=rn;exports.MonitorPanel=Df;exports.MonitorPanelItem=Af;exports.MotorDefault=Q;exports.MotorMocks=Hi;exports.MotorSimulator=zi;exports.MotorState=je;exports.MotorText=ut;exports.MotorVariants=kr;exports.Multiposition=pt;exports.MultipositionMocks=ia;exports.MultipositionSimulator=aa;exports.MultipositionVariants=Qi;exports.NoObject=ku;exports.None=Qt;exports.NullObject=Hu;exports.NumericStep=Xe;exports.OpticDefault=ht;exports.OpticMocks=_a;exports.OpticSimulator=$a;exports.OpticState=Oe;exports.OpticVariants=ha;exports.Panel=T;exports.ProcedureExecution=xt;exports.ProcedureManage=$e;exports.ProcedureMocks=Ua;exports.ProcedureState=ae;exports.ProcedureValidate=gt;exports.ProcedureVariants=Fa;exports.PumpDefault=Nt;exports.PumpMocks=Hc;exports.PumpVariants=Ac;exports.PusherDefault=bt;exports.PusherMocks=rl;exports.PusherSimulator=il;exports.PusherState=Me;exports.PusherVariants=Kc;exports.ServiceDefault=_t;exports.ServiceMocks=yl;exports.ServiceProtected=$t;exports.ServiceState=ye;exports.ServiceVariants=dl;exports.ShutterDefault=wt;exports.ShutterMocks=sc;exports.ShutterProtected=yt;exports.ShutterSimulator=rc;exports.ShutterState=we;exports.ShutterVariants=Ya;exports.SlitDefault=vt;exports.SlitMocks=Tc;exports.SlitState=Ie;exports.SlitVariants=fc;exports.Todo=Kt;exports.TomoConfigLatencyTime=Bt;exports.TomoConfigVariants=gu;exports.TomoDetectorAcquisitionMode=Tt;exports.TomoDetectorMocks=Md;exports.TomoDetectorSamplePixelSize=Mt;exports.TomoDetectorState=Ne;exports.TomoDetectorVariants=yd;exports.TomoDetectorsDefault=Ft;exports.TomoDetectorsMocks=Hd;exports.TomoDetectorsState=Fe;exports.TomoDetectorsVariants=Ad;exports.TomoFlatMotionDefault=St;exports.TomoFlatMotionMocks=rd;exports.TomoFlatMotionSimulator=id;exports.TomoFlatMotionSmall=Ct;exports.TomoFlatMotionState=ve;exports.TomoFlatMotionVariants=Il;exports.TomoHoloState=Lt;exports.TomoHoloVariants=vu;exports.TomoImagingActions=kt;exports.TomoImagingDefault=At;exports.TomoImagingExposureTime=Rt;exports.TomoImagingMocks=du;exports.TomoImagingSettleTime=Et;exports.TomoImagingSimulator=uu;exports.TomoImagingState=K;exports.TomoImagingUpdateMode=Pt;exports.TomoImagingVariants=tu;exports.TomoReferencePositionDefault=It;exports.TomoReferencePositionVariants=ld;exports.TomoSampleStageVariants=pu;exports.TypeIcon=y;exports.ValveDefault=Ht;exports.ValveMocks=Ru;exports.ValveVariants=$u;exports.YAMLErrorBoundary=Jt;exports.YAMLLayout=Of;exports.YamlAsserts=sf;exports.componentMap=me;exports.createMotorMock=qi;exports.dynamicOp=nn;exports.isLimaHardware=ge;exports.isMotorHardware=ft;exports.isOpticHardware=pa;exports.isProcedureHardware=jt;exports.isTomoConfigHardware=Vt;exports.isTomoDetectorHardware=Te;exports.isTomoDetectorsHardware=Dt;exports.isTomoFlatMotionHardware=Ot;exports.isTomoHoloHardware=Ut;exports.isTomoReferencePositionHardware=ad;exports.isTomoSampleStageHardware=Gt;exports.limaGuessSubframes=lt;exports.registerHardwareComponent=uf;exports.registerMonitorComponent=Tf;exports.registerRuntimeHook=_s;exports.registerYamlComponent=Zt;exports.registerYamlComponents=gf;exports.registerYamlType=zt;exports.renderYamlNode=V;exports.useLimaHardware=$s;exports.useMotorHardware=k;exports.useMotorStates=Ce;exports.useProcedureHardware=Da;exports.useTomoConfigHardware=ju;exports.useTomoDetectorHardware=vd;exports.useTomoDetectorsHardware=Rd;exports.useTomoFlatMotionHardware=Ml;exports.useTomoHoloHardware=Nu;exports.useTomoSampleStageHardware=mu;exports.yamlContainers=en;exports.yamlMap=tn;
37
37
  //# sourceMappingURL=index.js.map