1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[21907],{21907:function(e,l,a){a.r(l),a.d(l,{default:function(){return S}});var s=a(57437),n=a(79984),i=a(2265),t=a(62869),o=a(95186),r=a(26815),d=a(81103),c=a(83459),u=a(91351),p=a(29501),m=a(13590),v=a(80982),h=a(18146),g=a(8846);let x=u.Ry({title:u.Z_({required_error:"This field is required"}).trim().min(1,"This field is required"),version:u.Km(["1.0.0"]).default("1.0.0"),configs:u.IX(u.Ry({channel:u.Rx({required_error:"This field is required",invalid_type_error:"This field is required"}).min(1,"Invalid value"),action:u.Km(["on","off","toggle"]),time:u.Rx({required_error:"This field is required",invalid_type_error:"This field is required"}).min(0,"Invalid value"),brightness:u.Rx({required_error:"This field is required",invalid_type_error:"This field is required"}).min(0,"Invalid value").max(100,"Invalid value"),pattern:u.Rx({required_error:"This field is required",invalid_type_error:"This field is required"}).min(0,"Invalid value")})).min(1,"Please add at least one configuration")});var f=e=>{var l,a,u,f,j;let{onPrev:b,onNext:_}=e,N=(0,n.f)(),y=(0,g.Nw)(e=>e.addAction),w=(0,g.Nw)(e=>e.updateAction),k=(0,g.Nw)(e=>e.actionDevices),q=(0,g.Nw)(e=>e.currentEditAction),{handleSubmit:C,formState:{errors:T},control:I,setValue:z,watch:S,register:Z,getValues:R,reset:A}=(0,p.cI)({resolver:(0,m.F)(x),defaultValues:{title:null!==(j=null!=N?N:null==q?void 0:q.title)&&void 0!==j?j:"",version:"1.0.0",configs:(null==q?void 0:null===(l=q.data.strobe_channels)||void 0===l?void 0:l.length)?q.data.strobe_channels.map(e=>({channel:e.channel,action:e.action,time:e.time,brightness:e.duty_cycle,pattern:e.pattern})):[{channel:1,action:"on",time:1,brightness:50,pattern:1}]}}),{fields:E,append:Q,remove:V,update:D}=(0,p.Dq)({name:"configs",control:I});return(0,i.useEffect)(()=>{if(q){var e;null===(e=q.data.strobe_channels)||void 0===e||e.forEach((e,l)=>{D(l,{channel:e.channel,action:e.action,time:e.time,brightness:e.duty_cycle,pattern:e.pattern})})}},[q,D]),console.log(T),(0,s.jsxs)("div",{className:"relative h-full",children:[(0,s.jsxs)("div",{className:"flex flex-col overflow-y-scroll",style:{height:"calc(100% - 70px)"},children:[(0,s.jsx)("p",{className:"text-xl font-bold capitalize",children:"Strobe Configuration"}),(0,s.jsx)("p",{className:"mt-2 text-default-400",children:"Activate Strobe Configuration"}),(0,s.jsxs)("div",{className:"mt-5 grid grid-cols-12 bg-default-50 p-5",children:[(0,s.jsxs)("div",{className:"col-span-12 sm:col-span-12 md:col-span-6 lg:col-span-4",children:[(0,s.jsxs)(r._,{children:["Name",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,s.jsx)(o.II,{type:"text",placeholder:"Enter name",className:"rounded-none border-2",size:"lg",disabled:null!==N,...Z("title")}),(0,s.jsx)(h.Z,{message:null===(a=T.title)||void 0===a?void 0:a.message})]}),(0,s.jsx)("div",{className:"col-span-12 sm:col-span-12 md:col-span-6 lg:col-span-4"})]}),E.map((e,l)=>{var a,n,i,u,m,v,g,x,f,j;return(0,s.jsxs)("div",{className:"mt-5 grid grid-cols-12 gap-4 bg-default-50 p-5",children:[(0,s.jsxs)("div",{className:"col-span-12 sm:col-span-12 md:col-span-6 lg:col-span-2",children:[(0,s.jsxs)(r._,{children:["Channel",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,s.jsx)(p.Qr,{render:e=>{let{field:l}=e;return(0,s.jsx)(o.II,{type:"number",placeholder:"Enter Channel (e.g. 3, 4, etc..)",className:"rounded-none border-2 capitalize",size:"lg",...l,onChange:e=>{l.onChange(e.target.valueAsNumber)}})},name:"configs.".concat(l,".channel"),control:I}),T.configs&&(0,s.jsx)(h.Z,{message:null===(n=T.configs[l])||void 0===n?void 0:null===(a=n.channel)||void 0===a?void 0:a.message})]}),(0,s.jsxs)("div",{className:"col-span-12 sm:col-span-12 md:col-span-6 lg:col-span-3",children:[(0,s.jsxs)(r._,{children:["Action",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,s.jsx)(p.Qr,{render:e=>{let{field:l}=e;return(0,s.jsxs)("select",{className:"w-full rounded-none border-2 bg-white p-2 text-gray-700",...l,children:[(0,s.jsx)("option",{value:"",disabled:!0,children:"Select Action"}),(0,s.jsx)("option",{value:"on",children:"On"}),(0,s.jsx)("option",{value:"off",children:"Off"}),(0,s.jsx)("option",{value:"toggle",children:"Toggle"})]})},name:"configs.".concat(l,".action"),control:I}),T.configs&&(0,s.jsx)(h.Z,{message:null===(u=T.configs[l])||void 0===u?void 0:null===(i=u.action)||void 0===i?void 0:i.message})]}),(0,s.jsxs)("div",{className:"col-span-12 sm:col-span-12 md:col-span-6 lg:col-span-2",children:[(0,s.jsxs)(r._,{children:["Time ",(0,s.jsx)("span",{className:"italic",children:"(millisecond)"}),(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,s.jsx)(p.Qr,{render:e=>{let{field:l}=e;return(0,s.jsx)(o.II,{type:"number",placeholder:"Enter time (e.g. 3, 4, etc..)",className:"rounded-none border-2 capitalize",size:"lg",...l,onChange:e=>{l.onChange(e.target.valueAsNumber)}})},name:"configs.".concat(l,".time"),control:I}),(0,s.jsx)("p",{className:"text-xs italic text-default-500",children:"1000 milliseconds = 1 second"}),T.configs&&(0,s.jsx)(h.Z,{message:null===(v=T.configs[l])||void 0===v?void 0:null===(m=v.time)||void 0===m?void 0:m.message})]}),(0,s.jsxs)("div",{className:"col-span-12 sm:col-span-12 md:col-span-6 lg:col-span-2",children:[(0,s.jsxs)(r._,{children:["Brightness",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,s.jsx)(p.Qr,{render:e=>{let{field:l}=e;return(0,s.jsx)(o.II,{type:"number",placeholder:"Enter brightness (e.g. 3, 4, etc..)",className:"rounded-none border-2 capitalize",size:"lg",...l,onChange:e=>{l.onChange(e.target.valueAsNumber)}})},name:"configs.".concat(l,".brightness"),control:I}),T.configs&&(0,s.jsx)(h.Z,{message:null===(x=T.configs[l])||void 0===x?void 0:null===(g=x.brightness)||void 0===g?void 0:g.message})]}),(0,s.jsxs)("div",{className:"col-span-12 sm:col-span-12 md:col-span-6 lg:col-span-2",children:[(0,s.jsxs)(r._,{children:["Pattern",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,s.jsx)(p.Qr,{render:e=>{let{field:l}=e;return(0,s.jsx)(o.II,{type:"number",placeholder:"Enter Pattern (e.g. 3, 4, etc..)",className:"rounded-none border-2 capitalize",size:"lg",...l,onChange:e=>{l.onChange(e.target.valueAsNumber)}})},name:"configs.".concat(l,".pattern"),control:I}),T.configs&&(0,s.jsx)(h.Z,{message:null===(j=T.configs[l])||void 0===j?void 0:null===(f=j.pattern)||void 0===f?void 0:f.message})]}),(0,s.jsx)("div",{className:"col-span-12 pt-5 sm:col-span-12 md:col-span-6 lg:col-span-1",children:(0,s.jsxs)(d.u,{children:[(0,s.jsx)(d.aJ,{asChild:!0,children:(0,s.jsx)(t.z,{size:"xs",className:"h-8 w-8 !p-1",color:"primary",variant:"soft",onClick:()=>
1V(l),children:(0,s.jsx)(c.JO,{icon:"iconamoon:trash-duotone",className:"h-4 w-4 text-primary"})})}),(0,s.jsx)(d._v,{color:"secondary",children:(0,s.jsx)("p",{children:"Delete Configuration"})})]})})]},e.id)}),(0,s.jsx)(h.Z,{message:null===(f=T.configs)||void 0===f?void 0:null===(u=f.root)||void 0===u?void 0:u.message}),(0,s.jsx)("div",{className:"mt-5 w-full cursor-pointer border p-4 text-center",onClick:()=>{Q({channel:1,action:"on",time:1,brightness:50,pattern:1})},children:(0,s.jsx)("p",{className:"text-xl text-default-400",children:"Add Configuration"})})]}),(0,s.jsxs)("div",{className:"absolute bottom-0 flex w-full justify-between border-t bg-white py-3",children:[(0,s.jsx)(t.z,{color:"secondary",onClick:()=>{b&&b()},children:"Back"}),(0,s.jsx)(t.z,{onClick:C(e=>{if(_){let l=k[0],a=e.configs.map(e=>({channel:e.channel,action:e.action,time:e.time,pattern:e.pattern,duty_cycle:e.brightness}));q?w({id:q.id,version:"1.0.0",type:"strobe",title:e.title,data:{device:l,strobe_channels:a,recipientType:"device"},actions:[]}):y({id:(0,v.DO)(),version:"1.0.0",type:"strobe",title:e.title,data:{device:l,strobe_channels:a,recipientType:"device"},actions:[]}),A(),_()}}),variant:"soft",children:"Save"})]})]})},j=a(14145),b=a(98793),_=a(65613),N=a(27195),y=a(64119),w=a(97271),k=a(99227),q=a(94508),C=a(20911);let T=u.Ry({title:u.Z_({required_error:"This field is required"}).trim().min(1,"This field is required"),action:u.Km(["show","clear"]).default("show"),repeat_type:u.Km(["none","quantity","time"]).default("none"),repeat_value:k.y.requiredNumberWithMin().default(0),version:u.Km(["2.0.0"]).default("2.0.0"),configs:u.IX(u.Ry({task:u.Km(["on","off","toggle","ramp"]),ramp_time:u.Rx({required_error:"This field is required",invalid_type_error:"This field is required"}).min(0,"Invalid value"),color:k.y.requiredString(),brightness:u.Rx({required_error:"This field is required",invalid_type_error:"This field is required"}).min(0,"Invalid value").max(100,"Invalid value"),delay_after:k.y.requiredNumberWithMin(0),channel:k.y.requiredString()}))}).superRefine((e,l)=>{if("clear"!==e.action&&("quantity"===e.repeat_type&&e.repeat_value>0?(e.repeat_value<2&&l.addIssue({message:"Value must be at least 2",code:b.NL.custom,path:["repeat_value"]}),e.repeat_value>100&&l.addIssue({message:"Value must not exceed 100",code:b.NL.custom,path:["repeat_value"]})):"time"===e.repeat_type&&e.repeat_value>0&&(e.repeat_value<1&&l.addIssue({message:"Value must be at least 1",code:b.NL.custom,path:["repeat_value"]}),e.repeat_value>300&&l.addIssue({message:"Value must not exceed 300 seconds",code:b.NL.custom,path:["repeat_value"]})),e.configs.length<1&&l.addIssue({message:"Please add at least one configuration",code:b.NL.custom,path:["configs"]})),"show"===e.action){let a=!1;for(let s=0;s<e.configs.length;s++){let n=e.configs[s];"on"===n.task?a=!0:"off"!==n.task||a||l.addIssue({message:"An 'on' task must be defined before an 'off' task.",code:b.NL.custom,path:["configs"]})}}}),I=e=>{var l,a,n,i,r,u,m,v,g,x,f,j;let{index:b,config:_,errors:y,control:w,remove:k,watch:q,channelOptions:C}=e,T=q("configs.".concat(b,".task")),I=q("configs.".concat(b,".channel"));return(0,s.jsxs)("div",{className:"mt-5 grid grid-cols-12 gap-4 bg-default-50 p-5",children:[(0,s.jsxs)("div",{className:"col-span-12 sm:col-span-12 md:col-span-6 lg:col-span-1",children:[(0,s.jsx)(N.Z,{name:"Task",isRequired:!0,tooltipText:"Specifies the strobe task."}),(0,s.jsx)(p.Qr,{render:e=>{let{field:l}=e;return(0,s.jsxs)("select",{className:"w-full rounded-none border-2 bg-white p-2 text-gray-700",...l,children:[(0,s.jsx)("option",{value:"",disabled:!0,children:"Select Action"}),(0,s.jsx)("option",{value:"on",children:"On"}),(0,s.jsx)("option",{value:"off",children:"Off"}),(0,s.jsx)("option",{value:"toggle",children:"Toggle"}),(0,s.jsx)("option",{value:"ramp",children:"Ramp"})]})},name:"configs.".concat(b,".task"),control:w}),y.configs&&(0,s.jsx)(h.Z,{message:null===(a=y.configs[b])||void 0===a?void 0:null===(l=a.task)||void 0===l?void 0:l.message})]}),(0,s.jsxs)("div",{className:"col-span-12 sm:col-span-12 md:col-span-6 lg:col-span-2",children:[(0,s.jsx)(N.Z,{name:"Ramp Time",tooltipText:"Specifies the time in milliseconds for the ramp task."}),(0,s.jsx)(p.Qr,{render:e=>{let{field:l}=e;return(0,s.jsx)(o.II,{type:"number",placeholder:"Enter time (e.g. 3, 4, etc..)",className:"rounded-none border-2 capitalize",size:"lg",...l,onChange:e=>{l.onChange(e.target.valueAsNumber)}})},name:"configs.".concat(b,".ramp_time"),control:w}),y.configs&&(0,s.jsx)(h.Z,{message:null===(i=y.configs[b])||void 0===i?void 0:null===(n=i.ramp_time)||void 0===n?void 0:n.message})]}),(0,s.jsxs)("div",{className:"col-span-12 sm:col-span-12 md:col-span-6 lg:col-span-2",children:[(0,s.jsx)(N.Z,{name:"Color",isRequired:!0}),(0,s.jsx)(p.Qr,{render:e=>{let{field:l}=e;return(0,s.jsx)(o.II,{type:"color",className:"rounded-none border-2",size:"lg",disabled:"off"==T||"buzzer"==I,...l,value:"off"!=T?l.value:"#ffffff"})},name:"configs.".concat(b,".color"),control:w}),y.configs&&(0,s.jsx)(h.Z,{message:null===(u=y.configs[b])||void 0===u?void 0:null===(r=u.brightness)||void 0===r?void 0:r.message})]}),(0,s.jsxs)("div",{className:"col-span-12 sm:col-span-12 md:col-span-6 lg:col-span-2",children:[(0,s.jsx)(N.Z,{name:"Brightness",tooltipText:"Specifies the brightness level"}),(0,s.jsx)(p.Qr,{render:e=>{let{field:l}=e;return(0,s.jsx)(o.II,{type:"number",placeholder:"Enter brightness (0-100)",className:"rounded-none border-2 capitalize",size:"lg",disabled:"off"==T||"buzzer"==I,...l,onChange:e=>{l.onChange(e.target.valueAsNumber)}})},name:"configs.".concat(b,".brightness"),control:w}),y.configs&&(0,s.jsx)(h.Z,{message:null===(v=y.configs[b])||void 0===v?void 0:null===(m=v.brightness)||void 0===m?void 0:m.message})]}),(0,s.jsxs)("div",{className:"col-span-12 sm:col-span-12 md:col-span-6 lg:col-span-2",children:[(0,s.jsx)(N.Z,{name:"Delay After",tooltipText:"Specifies the delay in milliseconds after the strobe task."}),(0,s.jsx)(p.Qr,{render:e=>{let{field:l}=e;return(0,s.jsx)(o.II,{type:"number",step:"0.1",className:"rounded-none border-2 capitalize",size:"lg",...l,onChange:e=>{l.onChange(e.target.valueAsNumber)}})},name:"configs.".concat(b,".delay_after"),control:w}),y.configs&&(0,s.jsx)(h.Z,{message:null===(x=y.configs[b])||void 0===x?void 0:null===(g=x.delay_after)||void 0===g?void 0:g.message})]}),(0,s.jsxs)("div",{className:"col-span-12 sm:col-span-12 md:col-span-6 lg:col-span-2",children:[(0,s.jsx)(N.Z,{name:"Channel",isRequired:!0}),(0,s.jsx)(p.Qr,{render:e=>{let{field:l}=e;return(0,s.jsxs)("select",{className:"w-full rounded-none border-2 bg-white p-2 text-gray-700",...l,children:[(0,s.jsx)("option",{value:"",disabled:!0,children:"Select Channel"}),C.map(e=>(0,s.jsx)("option",{value:e.value,children:e.name},e.value))]})},name:"configs.".concat(b,".channel"),control:w}),y.configs&&(0,s.jsx)(h.Z,{message:null===(j=y.configs[b])||void 0===j?void 0:null===(f=j.channel)||void 0===f?void 0:f.message})]}),(0,s.jsx)("div",{className:"col-span-12 pt-5 sm:col-span-12 md:col-span-6 lg:col-span-1",children:(0,s.jsxs)(d.u,{children:[(0,s.jsx)(d.aJ,{asChild:!0,children:(0,s.jsx)(t.z,{size:"xs",className:"h-8 w-8 !p-1",color:"primary",variant:"soft",onClick:()=>
1k(b),children:(0,s.jsx)(c.JO,{icon:"iconamoon:trash-duotone",className:"h-4 w-4 text-primary"})})}),(0,s.jsx)(d._v,{color:"secondary",children:(0,s.jsx)("p",{children:"Delete Configuration"})})]})})]},_.id)};var z=e=>{var l,a,r,d,u,x,f,b,k,z,S,Z,R,A,E,Q,V,D,P,O,F,K,L,M,J,B,X;let{onPrev:G,onNext:W}=e,H=(0,n.f)(),U=(0,g.Nw)(e=>e.addAction),Y=(0,g.Nw)(e=>e.updateAction),$=(0,g.Nw)(e=>e.actionDevices),ee=(0,g.Nw)(e=>e.currentEditAction),el=(0,g.Nw)(e=>e.currentActionDeviceType),ea=(0,g.Nw)(e=>e.actionGroups),es=(0,g.Nw)(e=>e.currentDeviceType),en=(0,g.Nw)(e=>e.locationId),ei=(0,w.H3)("output",es,en,null!=en),et=(0,w.n0)(es,en,null!=en);console.log("actionGroups",ea,null===(l=et.data)||void 0===l?void 0:l.data),console.log("actionGroups",(0,y.Pp)(null!==(Q=null===(a=ei.data)||void 0===a?void 0:a.data)&&void 0!==Q?Q:[],$,"strobe"),(0,y.Qe)(null!==(V=null===(r=et.data)||void 0===r?void 0:r.data)&&void 0!==V?V:[],ea,"strobe"));let eo=[{name:"Default",value:"default"},{name:"White",value:"white"},...(0,y.Pp)(null!==(D=null===(d=ei.data)||void 0===d?void 0:d.data)&&void 0!==D?D:[],$,"wallbox")||(0,y.Qe)(null!==(P=null===(u=et.data)||void 0===u?void 0:u.data)&&void 0!==P?P:[],ea,"wallbox")?[{name:"Shield left strobe",value:"shield-strobe-left"},{name:"Shield right strobe",value:"shield-strobe-right"},{name:"Shield left backlight",value:"shield-backlight-left"},{name:"Shield right backlight",value:"shield-backlight-right"},{name:"Shield logo light",value:"shield-logo"},{name:"Shield button light",value:"shield-button"},{name:"Shield left and right strobe",value:"shield-strobe"},{name:"Shield left and right backlight",value:"shield-backlight"}]:[],...(0,y.Pp)(null!==(O=null===(x=ei.data)||void 0===x?void 0:x.data)&&void 0!==O?O:[],$,"strobe")||(0,y.Qe)(null!==(F=null===(f=et.data)||void 0===f?void 0:f.data)&&void 0!==F?F:[],ea,"strobe")?[{name:"Strobe buzzer",value:"buzzer"}]:[]],{handleSubmit:er,formState:{errors:ed},control:ec,setValue:eu,watch:ep,register:em,getValues:ev,reset:eh}=(0,p.cI)({resolver:(0,m.F)(T),defaultValues:{title:null!==(K=null!=H?H:null==ee?void 0:ee.title)&&void 0!==K?K:"",action:null!==(L=null==ee?void 0:null===(b=ee.data)||void 0===b?void 0:b.action)&&void 0!==L?L:"show",repeat_type:null!==(M=null==ee?void 0:ee.data.repeat_type)&&void 0!==M?M:"none",repeat_value:(null==ee?void 0:ee.data.repeat_type)==="quantity"&&(null!==(J=null==ee?void 0:ee.data.repeat_value)&&void 0!==J?J:0)>0?(null!==(B=null==ee?void 0:ee.data.repeat_value)&&void 0!==B?B:0)+1:null!==(X=null==ee?void 0:ee.data.repeat_value)&&void 0!==X?X:0,configs:(null==ee?void 0:null===(k=ee.data.instructions)||void 0===k?void 0:k.length)?ee.data.instructions.map(e=>({task:e.task,ramp_time:e.ramp_time,color:e.color,brightness:e.brightness,delay_after:e.delay_after,channel:e.channel})):[{task:"on",ramp_time:0,color:"#0000FF",brightness:50,delay_after:100,channel:"default"}]}}),eg=ep("repeat_type"),ex=ep("repeat_value");ep("configs");let ef="clear"===ep("action"),{fields:ej,append:eb,remove:e_,update:eN}=(0,p.Dq)({name:"configs",control:ec}),ey=[{value:"1-time",label:"Run 1 Time",tooltip:"Run once",valueTooltip:"Flash the strobe once"},{value:"x-times",label:"Run X Times",tooltip:"Run multiple times",valueTooltip:"Number of times to flash the strobe (Min: 2, Max: 100)"},{value:"x-seconds",label:"Run for X Seconds",tooltip:"Run for certain time",valueTooltip:"Duration in seconds to flash the strobe (Min: 1, Max: 300)"},{value:"until-stopped",label:"Run Until Stopped",tooltip:"Run until stopped",valueTooltip:"Flash the strobe until it is stopped"}],ew="none"===eg?ey.find(e=>"1-time"===e.value):"quantity"===eg?0===ex?ey.find(e=>"until-stopped"===e.value):ey.find(e=>"x-times"===e.value):"time"===eg?0===ex?ey.find(e=>"until-stopped"===e.value):ey.find(e=>"x-seconds"===e.value):ey.find(e=>"1-time"===e.value),ek=e=>{switch(e){case"1-time":eu("repeat_type","none",{shouldValidate:!0}),eu("repeat_value",0,{shouldValidate:!0});break;case"x-times":eu("repeat_type","quantity",{shouldValidate:!0}),eu("repeat_value",2,{shouldValidate:!0});break;case"x-seconds":eu("repeat_type","time",{shouldValidate:!0}),eu("repeat_value",1,{shouldValidate:!0});break;case"until-stopped":eu("repeat_type","quantity",{shouldValidate:!0}),eu("repeat_value",0,{shouldValidate:!0})}};return(0,i.useEffect)(()=>
1{if(ee){var e;null===(e=ee.data.instructions)||void 0===e||e.forEach((e,l)=>{eN(l,{task:e.task,ramp_time:e.ramp_time,color:e.color,brightness:e.brightness,delay_after:e.delay_after,channel:e.channel})})}},[ee,eN]),console.log(ed),(0,s.jsxs)("div",{className:"relative h-full",children:[(0,s.jsxs)("div",{className:"flex flex-col overflow-y-scroll",style:{height:"calc(100% - 70px)"},children:[(0,s.jsx)("p",{className:"text-xl font-bold capitalize",children:"Strobe Configuration"}),(0,s.jsx)("p",{className:"mt-2 text-default-400",children:"Activate Strobe Configuration"}),(0,s.jsxs)("div",{className:"mt-5 grid grid-cols-12 gap-2 bg-default-50 p-5",children:[(0,s.jsxs)("div",{className:"col-span-12 sm:col-span-12 md:col-span-6 lg:col-span-3",children:[(0,s.jsx)(N.Z,{name:"Title",isRequired:!0}),(0,s.jsx)(o.II,{type:"text",placeholder:"Enter name",className:"rounded-none border-2",size:"lg",disabled:null!==H,...em("title")}),(0,s.jsx)(h.Z,{message:null===(z=ed.title)||void 0===z?void 0:z.message})]}),(0,s.jsxs)("div",{className:"col-span-12 sm:col-span-12 md:col-span-6 lg:col-span-3",children:[(0,s.jsx)(N.Z,{name:"Action",isRequired:!0,tooltipText:"Specifies the audio action to be performed."}),(0,s.jsx)(p.Qr,{render:e=>{let{field:l}=e;return(0,s.jsxs)("select",{className:"w-full rounded-none border-2 bg-white p-2 text-gray-700",...l,children:[(0,s.jsx)("option",{value:"",disabled:!0,children:"Select Action"}),(0,s.jsx)("option",{value:"show",children:"Show"}),(0,s.jsx)("option",{value:"clear",children:"Clear"})]})},name:"action",control:ec}),(0,s.jsx)(h.Z,{message:null===(S=ed.action)||void 0===S?void 0:S.message})]}),!ef&&(0,s.jsxs)("div",{className:"col-span-12 sm:col-span-12 md:col-span-6 lg:col-span-3",children:[(0,s.jsx)(N.Z,{name:"Type",isRequired:!0,tooltipText:(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{children:"Specifies the method of repeating the instructions."}),(0,s.jsx)("ul",{className:"list-disc pl-5",children:ey.map(e=>(0,s.jsxs)("li",{children:[(0,s.jsxs)("strong",{children:[e.label,":"]})," ",e.tooltip]},e.value))})]})}),(0,s.jsx)(p.Qr,{render:e=>{let{field:l}=e;return(0,s.jsx)(j.ZP,{isSearchable:!0,options:ey,value:ey.find(e=>e.value===(null==ew?void 0:ew.value))||null,onChange:e=>{e&&ek(e.value)}})},name:"repeat_type",control:ec}),(0,s.jsx)(h.Z,{message:null===(Z=ed.repeat_type)||void 0===Z?void 0:Z.message})]}),!ef&&(0,s.jsxs)("div",{className:"col-span-12 sm:col-span-12 md:col-span-6 lg:col-span-3",children:[(0,s.jsx)(N.Z,{name:"Value",isRequired:!0,contentClassName:"max-w-[320px] mr-16",tooltipText:(0,s.jsx)("div",{children:(null==ew?void 0:ew.valueTooltip)&&(0,s.jsx)("p",{children:ew.valueTooltip})})}),(0,s.jsx)(o.II,{type:"number",className:"rounded-none border-2 capitalize",disabled:(0,q.Hi)(null==ew?void 0:ew.value,["1-time","until-stopped"]),size:"lg",min:(null==ew?void 0:ew.value)==="x-times"?2:(null==ew?void 0:ew.value)==="x-seconds"?1:0,max:(null==ew?void 0:ew.value)==="x-times"?100:(null==ew?void 0:ew.value)==="x-seconds"?300:void 0,...em("repeat_value",{valueAsNumber:!0})}),(0,s.jsx)(h.Z,{message:null===(R=ed.repeat_value)||void 0===R?void 0:R.message})]})]}),!ef&&(0,s.jsx)(_.bZ,{color:"info",className:"mt-2 block",variant:"soft",children:(0,s.jsxs)("div",{className:"flex flex-row items-center gap-4",children:[(0,s.jsx)("div",{className:"flex items-center justify-center",children:(0,s.jsx)(c.JO,{icon:"duo-icons:info",className:"h-6 w-6"})}),(0,s.jsx)("div",{className:"flex flex-col gap-1",children:(0,s.jsx)("p",{children:"All the times below are in milliseconds. 1000 milliseconds = 1 second"})})]})}),!ef&&(0,s.jsxs)(s.Fragment,{children:[" ",ej.map((e,l)=>(0,s.jsx)(I,{config:e,index:l,remove:e_,errors:ed,control:ec,watch:ep,channelOptions:eo},e.id)),(0,s.jsx)(h.Z,{message:null===(E=ed.configs)||void 0===E?void 0:null===(A=E.root)||void 0===A?void 0:A.message}),(0,s.jsx)("div",{className:"mt-5 w-full cursor-pointer border p-4 text-center",onClick:()=>{ej.length<20?eb({task:"on",ramp_time:0,color:"#0000FF",brightness:50,delay_after:100,channel:"default"}):(0,C.C)("error","You have exceeded the maximum allowed commands (20).")},children:(0,s.jsxs)("p",{className:"text-xl text-default-400",children:["Add Configuration (",ej.length," / 20)"]})})]})]}),(0,s.jsxs)("div",{className:"absolute bottom-0 flex w-full justify-between border-t bg-white py-3",children:[(0,s.jsx)(t.z,{color:"secondary",onClick:()=>{G&&G()},children:"Back"}),(0,s.jsx)(t.z,{onClick:er(e=>{if("none"!=e.repeat_type&&0==e.repeat_value){let l=!1;
1if(e.configs.forEach(e=>{e.delay_after>=100&&(l=!0)}),!l){(0,C.C)("error","Please add at least 100ms delay to one of the instructions.");return}}if(W){let l=e.configs.map(e=>({task:e.task,ramp_time:e.ramp_time,color:e.color,brightness:e.brightness,delay_after:e.delay_after,channel:e.channel})),a="quantity"===e.repeat_type&&e.repeat_value>0?e.repeat_value-1:e.repeat_value,s=eo.map(e=>e.value),n=l.map(e=>{let l=(0,q.e9)(e.channel,s);return{...e,channel:l?"default":e.channel}});ee?Y({id:ee.id,version:"2.0.0",device:$.length>1?$:$[0],groups:ea,recipientType:el,action:"strobe",title:e.title,data:{action:e.action,repeat_type:e.repeat_type,repeat_value:a,instructions:n},actions:[]}):U({id:(0,v.DO)(),version:"2.0.0",device:$.length>1?$:$[0],groups:ea,recipientType:el,action:"strobe",title:e.title,data:{action:e.action,repeat_type:e.repeat_type,repeat_value:a,instructions:n},actions:[]}),eh(),W()}}),variant:"soft",children:"Save"})]})]})},S=e=>{let{onPrev:l,onNext:a}=e;return 2==(0,g.Nw)(e=>e.renderVersion)()?(0,s.jsx)(z,{onNext:a,onPrev:l}):(0,s.jsx)(f,{onNext:a,onPrev:l})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.