iobroker.fullcalendar 3.3.1 → 3.4.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/README.md +18 -5
- package/admin/assets/{index-BF-xuLMY.js → index-ALPvpEpk.js} +1 -1
- package/admin/tab_m.html +1 -1
- package/admin/webcomponents/fullcalendar.js +263 -0
- package/admin/webcomponents/fullcalendar.json +347 -0
- package/build/main.js +82 -0
- package/build/main.js.map +1 -1
- package/io-package.json +17 -14
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -37,6 +37,17 @@ How to use:
|
|
|
37
37
|
- Click the record button and wait 24 hours or 7 days till simulation stops to record events
|
|
38
38
|
- Now you can replay the simulation by clicking on the play button. Additionally, you can define the time when the simulation should be started.
|
|
39
39
|
|
|
40
|
+
## Web components
|
|
41
|
+
Besides the vis-2 widget, the adapter brings the calendar as a web component for every host of
|
|
42
|
+
[ioBroker web components](https://github.com/ioBroker/web-components), e.g. Aura or devices: `<iob-fullcalendar>`
|
|
43
|
+
(`admin/webcomponents/fullcalendar.js`, described by `fullcalendar.json` in `common.webComponents`).
|
|
44
|
+
|
|
45
|
+
It shows the events of an instance - or of one of its calendars - as month, week, day or list and, unless it is read only,
|
|
46
|
+
creates, moves, resizes, edits and deletes them like the widget, in the dialog of the host. It reads and writes the
|
|
47
|
+
events through the instance (`sendTo` with `getEventObjects`, `setEventObject`, `deleteEventObject`), so the instance must be running.
|
|
48
|
+
|
|
49
|
+
Build it with `npm run build-wc` (part of `npm run build`).
|
|
50
|
+
|
|
40
51
|
## Agenda states
|
|
41
52
|
The adapter writes what is planned into states, e.g. to ask a chat or voice assistant about it or to show it in a visualization:
|
|
42
53
|
|
|
@@ -85,6 +96,9 @@ sendTo('fullcalendar.0', 'deleteEvent', { name: 'Birthday Anna' }, res => log(JS
|
|
|
85
96
|
| `listEvents` | optional `from`, `to` (default now … 7 days, or `days`), `calendar`, `max` | `{events: [execution, …]}` |
|
|
86
97
|
| `getCalendars` | – | `{calendars: [{id, name, enabled}, …]}` |
|
|
87
98
|
| `enableCalendar` | `calendar` (name or ID), `enabled` (`true`/`false`) | `{id, enabled}` |
|
|
99
|
+
| `getEventObjects` | optional `calendar` (`<namespace>.Calendars.<id>`) | `{events: [object, …]}`: the schedule objects, for the web component |
|
|
100
|
+
| `setEventObject` | `event` (a schedule object of this instance) | `{result: "ok"}` |
|
|
101
|
+
| `deleteEventObject` | `id` | `{result: "ok"}` |
|
|
88
102
|
| `getCommands` | – | `{commands: [{command, params, answer}, …]}` |
|
|
89
103
|
|
|
90
104
|
Parameters of `addEvent`:
|
|
@@ -120,6 +134,10 @@ Errors come back as `{error}`, an unknown command answers with the list of the c
|
|
|
120
134
|
### **WORK IN PROGRESS**
|
|
121
135
|
-->
|
|
122
136
|
## Changelog
|
|
137
|
+
### 3.4.0 (2026-11-09)
|
|
138
|
+
* (bluefox) Added the web component `<iob-fullcalendar>` for Aura, devices and other hosts of web components (`common.webComponents`)
|
|
139
|
+
* (bluefox) Added the messages `getEventObjects`, `setEventObject` and `deleteEventObject` for the web component
|
|
140
|
+
|
|
123
141
|
### 3.3.1 (2026-10-29)
|
|
124
142
|
* (@GermanBluefox) Added the admin >= 7.6.17 dependency, the translated name of the admin tab and the uk translations (#557)
|
|
125
143
|
* (@GermanBluefox) The adapter timers (`this.setTimeout`/`this.setInterval`) are used instead of the plain ones (#557)
|
|
@@ -144,11 +162,6 @@ Errors come back as `{error}`, an unknown command answers with the list of the c
|
|
|
144
162
|
### 3.1.1 (2026-10-29)
|
|
145
163
|
* (GermanBluefox) Fixed display of recurring events after DST change (#448)
|
|
146
164
|
|
|
147
|
-
### 3.1.0 (2026-10-28)
|
|
148
|
-
* (bluefox) Added agenda states `events.list/today/tomorrow/next/count/lastChanged`
|
|
149
|
-
* (bluefox) Added the messages `addEvent`, `deleteEvent`, `listEvents`, `getEvents` and `getCalendars`, e.g. for voice assistants
|
|
150
|
-
* (bluefox) A one-shot event in the past is no longer marked as disabled in memory
|
|
151
|
-
|
|
152
165
|
[Older changelogs can be found there](CHANGELOG_OLD.md)
|
|
153
166
|
|
|
154
167
|
## License
|
|
@@ -785,4 +785,4 @@ Arguments: `+Array.prototype.slice.call(i).join(``)+`
|
|
|
785
785
|
color: inherit;
|
|
786
786
|
}
|
|
787
787
|
}
|
|
788
|
-
`}),(0,V.jsx)(ng,{children:Y.t(`Edit simulation`)}),(0,V.jsxs)(Yh,{children:[(0,V.jsxs)(`div`,{style:m5.field,children:[(0,V.jsx)($b,{label:Y.t(`Name`),value:t.common.name||``,onChange:e=>{let r=JSON.parse(JSON.stringify(t));r.common.name=e.target.value,n(r)},variant:`standard`}),(0,V.jsxs)(Cg,{variant:`standard`,children:[(0,V.jsx)(n_,{children:Y.t(`Interval`)}),(0,V.jsx)(By,{value:t.native.interval||``,onChange:e=>{let r=JSON.parse(JSON.stringify(t));r.native.interval=e.target.value,n(r)},variant:`standard`,children:[`day`,`week`].map(e=>(0,V.jsx)(Qv,{value:e,children:Y.t(e)},e))})]})]}),(0,V.jsx)(`div`,{style:m5.field,children:(0,V.jsx)(zC,{label:Y.t(`Default color`),value:t.common.color,onChange:e=>{let r=JSON.parse(JSON.stringify(t));r.common.color=e,n(r)}})}),(0,V.jsxs)(`h4`,{style:m5.headers,children:[Y.t(`States`),(0,V.jsx)(lb,{title:Y.t(`Add states for recording`),slotProps:{popper:{sx:m5.tooltip}},children:(0,V.jsx)(Pd,{style:!l.length&&t?.native?.record?.states?.length?m5.blink:void 0,size:`small`,onClick:()=>o(!0),color:`primary`,children:(0,V.jsx)(tx,{})})})]}),(0,V.jsx)(`div`,{children:t.native.record?.states.map((e,r)=>v(e,()=>{let e=JSON.parse(JSON.stringify(t));e.native.record.states.splice(r,1),n(e)}))}),(0,V.jsxs)(`h4`,{style:m5.headers,children:[Y.t(`Categories`),(0,V.jsx)(lb,{title:Y.t(`Add overlap of categories for recording`),slotProps:{popper:{sx:m5.tooltip}},children:(0,V.jsx)(Pd,{style:!l.length&&t?.native?.record?.states?.length?m5.blink:void 0,size:`small`,onClick:()=>c(!0),color:`primary`,children:(0,V.jsx)(tx,{})})})]}),(0,V.jsx)(`div`,{children:t.native.record?.enums.map((e,r)=>{let i=e.map(e=>(0,V.jsx)(LE,{value:d[e]||e,lang:Y.getLanguage()},e)),a=1,o=i.reduce((e,t)=>[e,(0,V.jsx)(`span`,{children:`+`},a++),t],null);return(0,V.jsx)(am,{onClick:()=>c(r),onDelete:()=>{let e=JSON.parse(JSON.stringify(t));e.native.record.enums.splice(r,1),n(e)},label:o,sx:{"& .MuiChip-label":m5.chipLabel},style:m5.chip},r)})}),(0,V.jsx)(`h4`,{style:{marginBottom:-0},children:Y.t(`Recorded states`)}),(0,V.jsxs)(`div`,{children:[h&&(0,V.jsx)(v_,{}),Object.keys(p).map(e=>v(e))]})]}),(0,V.jsxs)(Uh,{children:[(0,V.jsx)(Lm,{variant:`contained`,color:`secondary`,startIcon:(0,V.jsx)(_x,{}),onClick:()=>i(!0),children:Y.t(`Delete`)}),(0,V.jsx)(Lm,{disabled:y,onClick:async()=>{let n=JSON.parse(JSON.stringify(t));n.native.interval!==e.simulation.native.interval&&n.native.interval===`day`&&(console.log(n),n.native.events.forEach(e=>{console.log(e.native.cron);let t=ZH(e.native.cron);console.log(t),t.dows=[0,1,2,3,4,5,6],e.native.cron=$H(t),console.log(e.native.cron)})),await e.socket.setObject(t._id,n),e.onClose()},variant:`contained`,color:`primary`,startIcon:(0,V.jsx)(Ux,{}),children:Y.t(`Save`)}),(0,V.jsx)(Lm,{onClick:e.onClose,variant:`contained`,color:`grey`,startIcon:(0,V.jsx)(cx,{}),children:y?Y.t(`ra_Close`):Y.t(`ra_Cancel`)})]}),r&&(0,V.jsx)(AS,{fullWidth:!1,title:Y.t(`Delete simulation`),text:Y.t(`Simulation will be deleted. Confirm?`),ok:Y.t(`ra_Delete`),onClose:async n=>{n&&(await e.onDelete(t._id),e.onClose()),i(!1)}}),a&&(0,V.jsx)(RE,{imagePrefix:`../..`,multiSelect:!0,theme:e.theme,selected:t.native.record.states,onOk:e=>{let r=JSON.parse(JSON.stringify(t));r.native.record=r.native.record||{enums:[],states:[]},r.native.record.states=r.native.record.states||[],r.native.record.states=Array.isArray(e)?e:[e],n(r),o(!1)},onClose:()=>o(!1),socket:e.socket}),s===!1?null:(0,V.jsx)(p5,{socket:e.socket,enumsObjects:d,selectedEnums:typeof s==`number`?t.native.record.enums[s]:[],exceptions:t.native.record.enumsExceptions||[],onSelect:(e,r)=>{let i=JSON.parse(JSON.stringify(t));i.native.record=i.native.record||{enums:[],states:[]},i.native.record.enums=i.native.record.enums||[],i.native.record.enumsExceptions=r||[],typeof s==`number`?i.native.record.enums[s]=e:i.native.record.enums.push(e),n(i),c(!1)},onClose:()=>c(!1)})]})},g5={Y:`year`,YY:`year`,YYYY:{sectionType:`year`,contentType:`digit`,maxLength:4},M:{sectionType:`month`,contentType:`digit`,maxLength:2},MM:`month`,MMM:{sectionType:`month`,contentType:`letter`},MMMM:{sectionType:`month`,contentType:`letter`},D:{sectionType:`day`,contentType:`digit`,maxLength:2},DD:`day`,Do:{sectionType:`day`,contentType:`digit-with-letter`},E:{sectionType:`weekDay`,contentType:`digit`,maxLength:1},e:{sectionType:`weekDay`,contentType:`digit`,maxLength:1},d:{sectionType:`weekDay`,contentType:`digit`,maxLength:1},dd:{sectionType:`weekDay`,contentType:`letter`},ddd:{sectionType:`weekDay`,contentType:`letter`},dddd:{sectionType:`weekDay`,contentType:`letter`},A:`meridiem`,a:`meridiem`,H:{sectionType:`hours`,contentType:`digit`,maxLength:2},HH:`hours`,h:{sectionType:`hours`,contentType:`digit`,maxLength:2},hh:`hours`,k:{sectionType:`hours`,contentType:`digit`,maxLength:2},kk:`hours`,m:{sectionType:`minutes`,contentType:`digit`,maxLength:2},mm:`minutes`,s:{sectionType:`seconds`,contentType:`digit`,maxLength:2},ss:`seconds`},_5={year:`YYYY`,month:`MMMM`,monthShort:`MMM`,dayOfMonth:`D`,dayOfMonthFull:`Do`,weekday:`dddd`,weekdayShort:`ddd`,hours24h:`HH`,hours12h:`hh`,meridiem:`A`,minutes:`mm`,seconds:`ss`,fullDate:`ll`,keyboardDate:`L`,shortDate:`MMM D`,normalDate:`D MMMM`,normalDateWithWeekday:`ddd, MMM D`,fullTime12h:`hh:mm A`,fullTime24h:`HH:mm`,keyboardDateTime12h:`L hh:mm A`,keyboardDateTime24h:`L HH:mm`};function v5(){throw Error(BX(140))}var y5=class{isMUIAdapter=!0;isTimezoneCompatible=!0;lib=`moment`;escapedCharacters={start:`[`,end:`]`};formatTokenMap=g5;constructor({locale:e,formats:t,instance:n}={}){this.moment=n||dU,this.locale=e,this.formats=b({},_5,t)}setLocaleToValue=e=>{let t=this.getCurrentLocaleCode();return t===e.locale()?e:e.locale(t)};hasTimezonePlugin=()=>this.moment.tz!==void 0;createSystemDate=e=>{let t=this.moment(e).local();return this.locale===void 0?t:t.locale(this.locale)};createUTCDate=e=>{let t=this.moment.utc(e);return this.locale===void 0?t:t.locale(this.locale)};createTZDate=(e,t)=>{this.hasTimezonePlugin()||v5();let n=t==="default"?this.moment(e):this.moment.tz(e,t);return this.locale===void 0?n:n.locale(this.locale)};date=(e,t=`default`)=>e===null?null:t===`UTC`?this.createUTCDate(e):t===`system`||t==="default"&&!this.hasTimezonePlugin()?this.createSystemDate(e):this.createTZDate(e,t);getInvalidDate=()=>this.moment(new Date(`Invalid Date`));getTimezone=e=>{let t=e._z?.name,n=e.isUTC()?`UTC`:`system`;return t??this.moment.defaultZone?.name??n};setTimezone=(e,t)=>{if(this.getTimezone(e)===t)return e;if(t===`UTC`)return e.clone().utc();if(t===`system`)return e.clone().local();if(!this.hasTimezonePlugin())return t!=="default"&&v5(),e;let n=t==="default"?this.moment.defaultZone?.name??`system`:t;if(n===`system`)return e.clone().local();let r=e.clone();return r.tz(n),r};toJsDate=e=>e.toDate();parse=(e,t)=>e===``?null:this.locale?this.moment(e,t,this.locale,!0):this.moment(e,t,!0);getCurrentLocaleCode=()=>this.locale||dU.locale();is12HourCycleInCurrentLocale=()=>/A|a/.test(dU.localeData(this.getCurrentLocaleCode()).longDateFormat(`LT`));expandFormat=e=>e.match(/(\[[^[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})|./g).map(e=>{let t=e[0];return t===`L`||t===`;`?dU.localeData(this.getCurrentLocaleCode()).longDateFormat(e):e}).join(``);isValid=e=>e!=null&&e.isValid();format=(e,t)=>this.formatByString(e,this.formats[t]);formatByString=(e,t)=>{let n=e.clone();return n.locale(this.getCurrentLocaleCode()),n.format(t)};formatNumber=e=>e;isEqual=(e,t)=>e===null&&t===null?!0:e===null||t===null?!1:e.isSame(t);isSameYear=(e,t)=>e.isSame(t,`year`);isSameMonth=(e,t)=>e.isSame(t,`month`);isSameDay=(e,t)=>e.isSame(t,`day`);isSameHour=(e,t)=>e.isSame(t,`hour`);isAfter=(e,t)=>e.isAfter(t);isAfterYear=(e,t)=>e.isAfter(t,`year`);isAfterDay=(e,t)=>e.isAfter(t,`day`);isBefore=(e,t)=>e.isBefore(t);isBeforeYear=(e,t)=>e.isBefore(t,`year`);isBeforeDay=(e,t)=>e.isBefore(t,`day`);isWithinRange=(e,[t,n])=>e.isBetween(t,n,null,`[]`);startOfYear=e=>e.clone().startOf(`year`);startOfMonth=e=>e.clone().startOf(`month`);startOfWeek=e=>this.setLocaleToValue(e.clone()).startOf(`week`);startOfDay=e=>e.clone().startOf(`day`);endOfYear=e=>e.clone().endOf(`year`);endOfMonth=e=>e.clone().endOf(`month`);endOfWeek=e=>this.setLocaleToValue(e.clone()).endOf(`week`);endOfDay=e=>e.clone().endOf(`day`);addYears=(e,t)=>t<0?e.clone().subtract(Math.abs(t),`years`):e.clone().add(t,`years`);addMonths=(e,t)=>t<0?e.clone().subtract(Math.abs(t),`months`):e.clone().add(t,`months`);addWeeks=(e,t)=>t<0?e.clone().subtract(Math.abs(t),`weeks`):e.clone().add(t,`weeks`);addDays=(e,t)=>t<0?e.clone().subtract(Math.abs(t),`days`):e.clone().add(t,`days`);addHours=(e,t)=>t<0?e.clone().subtract(Math.abs(t),`hours`):e.clone().add(t,`hours`);addMinutes=(e,t)=>t<0?e.clone().subtract(Math.abs(t),`minutes`):e.clone().add(t,`minutes`);addSeconds=(e,t)=>t<0?e.clone().subtract(Math.abs(t),`seconds`):e.clone().add(t,`seconds`);getYear=e=>e.get(`year`);getMonth=e=>e.get(`month`);getDate=e=>e.get(`date`);getHours=e=>e.get(`hours`);getMinutes=e=>e.get(`minutes`);getSeconds=e=>e.get(`seconds`);getMilliseconds=e=>e.get(`milliseconds`);setYear=(e,t)=>e.clone().year(t);setMonth=(e,t)=>e.clone().month(t);setDate=(e,t)=>e.clone().date(t);setHours=(e,t)=>e.clone().hours(t);setMinutes=(e,t)=>e.clone().minutes(t);setSeconds=(e,t)=>e.clone().seconds(t);setMilliseconds=(e,t)=>e.clone().milliseconds(t);getDaysInMonth=e=>e.daysInMonth();getWeekArray=e=>{let t=this.startOfWeek(this.startOfMonth(e)),n=this.endOfWeek(this.endOfMonth(e)),r=0,i=t,a=i.get(`dayOfYear`),o=[];for(;i.isBefore(n);){let e=Math.floor(r/7);o[e]=o[e]||[],o[e].push(i);let t=a;i=this.addDays(i,1),a=i.get(`dayOfYear`),t===a&&(i=i.add(12,`h`).startOf(`day`)),r+=1}return o};getWeekNumber=e=>e.week();getDayOfWeek=e=>e.day()+1;getYearRange([e,t]){let n=this.startOfYear(e),r=this.endOfYear(t),i=[],a=n;for(;this.isBefore(a,r);)i.push(a),a=this.addYears(a,1);return i}},b5={field:{"& .MuiFormControl-root":{width:`100%`},display:`flex`,alignItems:`end`,gap:`20px`},tableCell:{textAlign:`center`}},x5=e=>{let[t,n]=(0,B.useState)({start:null,end:null,dow:[0,1,2,3,4,5,6]});return dU.locale(Y.getLanguage()),(0,V.jsxs)(zh,{open:!0,onClose:e.onClose,children:[(0,V.jsx)(ng,{children:Y.t(`Play simulation`)}),(0,V.jsxs)(Yh,{children:[(0,V.jsxs)(qX,{dateAdapter:y5,children:[(0,V.jsxs)(Tm,{component:`div`,sx:b5.field,style:{width:`100%`,marginBottom:20,marginTop:10},children:[(0,V.jsx)(M8,{label:`Start`,sx:e=>({borderBottom:`1px solid ${e.palette.text.primary}`,"& fieldset":{display:`none`},"& input":{padding:`${e.spacing(1.5)} 0 4px 0`},"& .MuiInputAdornment-root":{marginLeft:0,marginTop:1},"& label":{transform:`translate(0px, -9px) scale(0.75)`},"&.MuiTextField-root":{width:`100%`}}),value:t.start,onChange:e=>n({...t,start:e})}),t.start&&(0,V.jsx)(Pd,{onClick:()=>n({...t,start:null}),children:(0,V.jsx)(_x,{})})]}),(0,V.jsxs)(Tm,{component:`div`,sx:b5.field,style:{width:`100%`,marginBottom:30},children:[(0,V.jsx)(M8,{label:`End`,sx:e=>({borderBottom:`1px solid ${e.palette.text.primary}`,"& fieldset":{display:`none`},"& input":{padding:`${e.spacing(1.5)} 0 4px 0`},"& .MuiInputAdornment-root":{marginLeft:0,marginTop:1},"& label":{transform:`translate(0px, -9px) scale(0.75)`}}),value:t.end,onChange:e=>n({...t,end:e})}),t.end&&(0,V.jsx)(Pd,{onClick:()=>n({...t,end:null}),children:(0,V.jsx)(_x,{})})]})]}),(0,V.jsx)(`div`,{children:(0,V.jsxs)(`table`,{children:[(0,V.jsx)(`thead`,{children:(0,V.jsx)(`tr`,{children:[0,1,2,3,4,5,6].map(e=>(0,V.jsx)(`td`,{style:b5.tableCell,children:dU().day(e).format(`ddd`)},e))})}),(0,V.jsx)(`tbody`,{children:(0,V.jsx)(`tr`,{children:[0,1,2,3,4,5,6].map(r=>(0,V.jsx)(`td`,{children:(0,V.jsx)(Zm,{"aria-label":`play simulation`,checked:t.dow.includes(r),disabled:e.readOnly,onChange:e=>{e.target.checked?n({...t,dow:[...t.dow,r]}):n({...t,dow:t.dow.filter(e=>e!==r)})},size:`small`})},r))})})]})})]}),(0,V.jsxs)(Uh,{children:[(0,V.jsx)(Lm,{onClick:()=>{e.playSimulation(e.simulation._id,t),e.onClose()},variant:`contained`,color:`primary`,startIcon:(0,V.jsx)(Ix,{}),children:Y.t(`Play`)}),(0,V.jsx)(Lm,{onClick:e.onClose,variant:`contained`,color:`grey`,startIcon:(0,V.jsx)(cx,{}),children:Y.t(`Cancel`)})]})]})},S5={panel:e=>({height:`100%`,display:`flex`,flexDirection:`column`,borderRadius:0,borderRight:`1px solid ${e.palette.divider}`,overflow:`hidden`}),modeTabs:{flexShrink:0,minHeight:42,"& .MuiTab-root":{minHeight:42,minWidth:0,flex:1,padding:`0 8px`}},header:e=>({flexShrink:0,display:`flex`,alignItems:`center`,gap:1,minHeight:44,padding:`6px 6px 6px 12px`,borderBottom:`1px solid ${e.palette.divider}`}),headerTitle:e=>({flexGrow:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,fontSize:11,fontWeight:600,letterSpacing:`0.08em`,textTransform:`uppercase`,color:e.palette.text.secondary}),addButton:e=>({flexShrink:0,width:28,height:28,color:e.palette.primary.contrastText||`#fff`,backgroundColor:e.palette.primary.main,"&:hover":{color:e.palette.primary.contrastText||`#fff`,backgroundColor:e.palette.primary.dark},"& .MuiSvgIcon-root":{fontSize:18}}),alert:e=>({display:`flex`,flexShrink:0,color:e.palette.error.main,"& .MuiSvgIcon-root":{fontSize:18}}),list:{flex:1,overflowY:`auto`,overflowX:`hidden`,padding:`6px`},item:e=>({gap:1,minHeight:34,paddingTop:`3px`,paddingBottom:`3px`,paddingLeft:`8px`,paddingRight:`4px`,marginBottom:`2px`,"& .actions":{opacity:0,transition:`opacity 0.15s ease-in-out`},"&:hover .actions, &.Mui-focusVisible .actions, &.Mui-selected .actions":{opacity:1},"&.Mui-selected .MuiIconButton-root":{color:`inherit`},"&.Mui-selected .count":{backgroundColor:`rgba(255, 255, 255, 0.22)`,color:`inherit`},...e.name?.startsWith(`modern`)?void 0:{"&.Mui-selected":{backgroundColor:e.palette.primary.main,color:e.palette.primary.contrastText,"&:hover":{backgroundColor:e.palette.primary.dark}}}}),itemText:{margin:0,overflow:`hidden`},swatch:{flexShrink:0,width:10,height:10,borderRadius:`3px`,boxShadow:`inset 0 0 0 1px rgba(0, 0, 0, 0.25)`},icon:{flexShrink:0,width:16,height:16},actions:{display:`flex`,alignItems:`center`,flexShrink:0,"& .MuiIconButton-root":{padding:`4px`},"& .MuiSvgIcon-root":{fontSize:18}},count:e=>({flexShrink:0,minWidth:20,height:18,padding:`0 5px`,borderRadius:`9px`,fontSize:10,fontWeight:600,lineHeight:`18px`,textAlign:`center`,backgroundColor:Ti(e.palette.text.primary,.08),color:e.palette.text.secondary}),tooltip:{pointerEvents:`none`}};function C5(e){return(0,V.jsxs)(vu,{sx:[S5.panel,{width:e.width??`100%`}],children:[(0,V.jsxs)(Jb,{value:+!!e.isSimulations,onChange:e.onChangeMode,variant:`fullWidth`,sx:S5.modeTabs,children:[(0,V.jsx)(Sb,{title:Y.t(`Calendars`),icon:(0,V.jsx)(ox,{})}),(0,V.jsx)(Sb,{title:Y.t(`Simulations`),icon:(0,V.jsx)(Lx,{})})]}),(0,V.jsxs)(Tm,{sx:S5.header,children:[(0,V.jsx)(Tm,{component:`div`,sx:S5.headerTitle,children:e.title}),e.alive===!1&&(0,V.jsx)(lb,{title:Y.t(`Instance inactive`),slotProps:{popper:{sx:S5.tooltip}},children:(0,V.jsx)(Tm,{component:`span`,sx:S5.alert,children:(0,V.jsx)(Vx,{})})}),(0,V.jsx)(lb,{title:e.addTitle,slotProps:{popper:{sx:S5.tooltip}},children:(0,V.jsx)(Pd,{size:`small`,sx:S5.addButton,onClick:e.onAdd,children:(0,V.jsx)(tx,{})})})]}),(0,V.jsx)(C_,{dense:!0,disablePadding:!0,sx:S5.list,children:e.children})]})}function w5(e){return(0,V.jsxs)(O_,{selected:e.selected,onClick:e.onClick,sx:S5.item,children:[e.icon?(0,V.jsx)(Cw,{src:e.icon,style:S5.icon}):e.color?(0,V.jsx)(Tm,{component:`span`,sx:S5.swatch,style:{backgroundColor:e.color}}):null,(0,V.jsx)(q_,{sx:S5.itemText,title:e.name,primary:e.name,slotProps:{primary:{noWrap:!0,sx:{fontSize:13,fontWeight:e.selected?600:400,opacity:e.inactive?.5:1}}}}),e.actions?(0,V.jsx)(Tm,{component:`span`,className:`actions`,sx:S5.actions,children:e.actions}):null,e.status?(0,V.jsx)(Tm,{component:`span`,sx:S5.actions,children:e.status}):null,e.count===void 0?null:(0,V.jsx)(lb,{title:Y.t(`Events`),slotProps:{popper:{sx:S5.tooltip}},children:(0,V.jsx)(Tm,{component:`span`,className:`count`,sx:S5.count,children:e.count})})]})}var T5=260,E5={container:{display:`flex`,width:`100%`,flex:1},toCalendar:{paddingLeft:20},simulations:e=>({backgroundColor:Ti(e.palette.primary.main,e.palette.mode===`dark`?.04:.05)}),tooltip:{pointerEvents:`none`}},D5=e=>{let[t,n]=(0,B.useState)([]),[r,i]=(0,B.useState)({}),[a,o]=(0,B.useState)(window.localStorage.getItem(`fullcalendar.selectedSimulation`)||null),[s,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)(!1),[d,f]=(0,B.useState)(null),[p,m]=(0,B.useState)(null),h=(e,t)=>{t&&i(n=>({...n,[e]:t.val}))},g=(e,t)=>{n(n=>{let r=JSON.parse(JSON.stringify(n)),i=r.findIndex(t=>t._id===e);if(i===-1){if(!t)return n;r.push(t)}else t?r[i]=t:r.splice(i,1);return r})},_=async()=>{let r=await e.socket.getObjectViewSystem(`state`,`fullcalendar.${e.instance}.Simulations.`,`fullcalendar.${e.instance}.Simulations.\u9999`),s={};for(let t in r)s[t]=(await e.socket.getState(t))?.val;let c=Object.values(r);c.sort((e,t)=>e.common.name.localeCompare(t.common.name)),n(c),(!a||t.length&&!t.find(e=>e._id===a))&&o(t[0]?._id||null),i(s),e.socket.subscribeObject(`fullcalendar.${e.instance}.Simulations.*`,g),e.socket.subscribeState(`fullcalendar.${e.instance}.Simulations.*`,h)};(0,B.useEffect)(()=>(_().catch(()=>{}),()=>{e.socket.unsubscribeObject(`fullcalendar.${e.instance}.Simulations.*`,g),e.socket.unsubscribeState(`fullcalendar.${e.instance}.Simulations.*`,h)}),[]),(0,B.useEffect)(()=>{(!a||t.length&&!t.find(e=>e._id===a))&&o(t[0]?._id||null)},[t]);let v=async(t,n)=>{n||=await e.socket.getObject(t),n.native.record=n.native.record||{},n.native.record.start=Date.now(),n.native.record.end=n.native.interval===`day`?new Date(Date.now()+864e5):new Date(Date.now()+6048e5),await e.socket.setObject(t,n),e.socket.setState(t,`record`)},y=async(t,n)=>{let r=await e.socket.getObject(t);r.native.play=n,await e.socket.setObject(t,r),e.socket.setState(t,`play`)},b=(0,V.jsx)(`div`,{style:E5.toCalendar,children:(0,V.jsx)(lb,{title:Y.t(`You can export events to static calender`),slotProps:{popper:{sx:E5.tooltip}},children:(0,V.jsx)(Lm,{variant:`contained`,onClick:async()=>{let n=`fullcalendar.${e.instance}.Calendars.Calendar-${sU()}`;await e.socket.setObject(n,{type:`folder`,common:{name:`NewCalendar`},native:{}});let r=t.find(e=>e._id===a).native.events;for(let t of r){let r=JSON.parse(JSON.stringify(t));r.id=`${n}.event-${sU()}`,e.socket.setObject(r.id,r)}e.updateCalendars(),e.changeCalendarType(),e.setCalendarPrefix(n)},children:Y.t(`To calendar`)})})}),x=(a&&t.find(e=>e._id===a)?a:t[0]?._id)||``;return(0,V.jsxs)(Tm,{component:`div`,style:E5.container,sx:E5.simulations,children:[(0,V.jsxs)(`div`,{children:[d&&(0,V.jsx)(h5,{socket:e.socket,simulation:t.find(e=>e._id===d),onClose:()=>f(null),theme:e.theme,onDelete:async n=>{try{if(a===n){let e=t.find(e=>e._id!==n);o(e?._id||null)}await e.socket.delObject(n)}catch(e){window.alert(`Cannot delete simulation: ${e}`)}}}),p&&(0,V.jsx)(x5,{playSimulation:y,simulation:t.find(e=>e._id===p),onClose:()=>m(null)}),s&&(0,V.jsxs)(zh,{open:!0,maxWidth:`md`,onClose:(e,t)=>{t!==`backdropClick`&&t!==`escapeKeyDown`&&c(!1)},children:[(0,V.jsx)(ng,{id:`confirmation-dialog-title`,children:Y.t(`Start recording`)}),(0,V.jsx)(Yh,{children:(0,V.jsx)($h,{children:Y.t(`Do you want to delete previously recorded events?`)})}),(0,V.jsxs)(Uh,{children:[(0,V.jsx)(Lm,{variant:`contained`,onClick:async()=>{let t=await e.socket.getObject(s);t.native.events=[],await v(t._id,t),c(!1)},style:{backgroundColor:`red`,color:`white`},autoFocus:!0,startIcon:(0,V.jsx)(_x,{}),children:Y.t(`Delete events`)}),(0,V.jsx)(Lm,{variant:`contained`,onClick:async()=>{await v(s),c(!1)},color:`grey`,startIcon:(0,V.jsx)(lx,{}),children:Y.t(`Keep events`)})]})]}),l!==!1&&(0,V.jsx)(AS,{fullWidth:!1,title:Y.t(`Stop recording`),text:Y.t(`Do you want to stop recording? You cannot restart it again.`),ok:Y.t(`Stop`),onClose:t=>{t&&e.socket.setState(l,`stop`),u(!1)}}),(0,V.jsx)(C5,{isSimulations:!0,onChangeMode:e.changeCalendarType,title:Y.t(`Simulations`),addTitle:Y.t(`Create new simulation`),alive:e.alive,width:T5,onAdd:async()=>{let n=`fullcalendar.${e.instance}.Simulations.${sU()}`;await e.socket.setObject(n,{common:{name:Y.t(`Simulation %s`,t.length+1),role:`state`,type:`string`,states:[`stop`,`record`,`play`,`pause`],color:`#3A87AD`},native:{events:[],interval:`day`,record:{states:[],enums:[],start:null,end:null}},type:`state`}),await e.socket.setState(n,`stop`),window.localStorage.setItem(`fullcalendar.selectedSimulation`,n),setTimeout(()=>{o(n),f(n)},300)},children:t.map(t=>(0,V.jsx)(w5,{name:t.common.name||t._id,color:t.common.color,icon:t.common.icon,count:t.native.events?.length||0,selected:t._id===x,onClick:()=>{window.localStorage.setItem(`fullcalendar.selectedSimulation`,t._id),o(t._id)},actions:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(lb,{title:Y.t(`Edit name and settings`),slotProps:{popper:{sx:E5.tooltip}},children:(0,V.jsx)(Pd,{onClick:e=>{e.stopPropagation(),f(t._id)},size:`small`,children:(0,V.jsx)(bx,{})})}),r[t._id]===`stop`&&(0,V.jsx)(lb,{title:Y.t(`Start recording`),slotProps:{popper:{sx:E5.tooltip}},children:(0,V.jsx)(`span`,{children:(0,V.jsx)(Pd,{onClick:async e=>{e.stopPropagation(),t.native.events.length?c(t._id):await v(t._id)},size:`small`,children:(0,V.jsx)(Ex,{})})})}),r[t._id]===`stop`&&t.native.events.length>0&&(0,V.jsx)(lb,{title:Y.t(`Start playing`),slotProps:{popper:{sx:E5.tooltip}},children:(0,V.jsx)(`span`,{children:(0,V.jsx)(Pd,{onClick:e=>{e.stopPropagation(),m(t._id)},size:`small`,children:(0,V.jsx)(Fx,{})})})})]}),status:(0,V.jsxs)(V.Fragment,{children:[(r[t._id]===`record`||r[t._id]===`pause`)&&(0,V.jsx)(lb,{title:Y.t(`Stop recording. Recording till %s`,dU(t.native.record.end).format(`DD.MM.YYYY HH:mm:ss`)),slotProps:{popper:{sx:E5.tooltip}},children:(0,V.jsx)(`span`,{style:{opacity:r[t._id]===`pause`?.5:1},children:(0,V.jsx)(Pd,{disabled:r[t._id]===`pause`,onClick:e=>{e.stopPropagation(),u(t._id)},size:`small`,children:(0,V.jsx)(qx,{style:{color:`red`}})})})}),r[t._id]===`play`&&(0,V.jsx)(lb,{title:Y.t(`Stop playing`),slotProps:{popper:{sx:E5.tooltip}},children:(0,V.jsx)(`span`,{children:(0,V.jsx)(Pd,{onClick:n=>{n.stopPropagation(),e.socket.setState(t._id,`stop`)},size:`small`,children:(0,V.jsx)(qx,{style:{color:`green`}})})})}),r[t._id]===`record`&&(0,V.jsx)(lb,{title:Y.t(`Pause recording`),slotProps:{popper:{sx:E5.tooltip}},children:(0,V.jsx)(`span`,{children:(0,V.jsx)(Pd,{onClick:n=>{n.stopPropagation(),e.socket.setState(t._id,`pause`)},size:`small`,children:(0,V.jsx)(Nx,{})})})}),r[t._id]===`pause`&&(0,V.jsx)(lb,{title:Y.t(`Resume recording. Recording till %s`,dU(t.native.record.end).format(`DD.MM.YYYY HH:mm:ss`)),slotProps:{popper:{sx:E5.tooltip}},children:(0,V.jsx)(`span`,{children:(0,V.jsx)(Pd,{onClick:n=>{n.stopPropagation(),e.socket.setState(t._id,`record`)},size:`small`,children:(0,V.jsx)(Nx,{style:{color:`yellow`}})})})})]})},t._id))})]}),a&&(0,V.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,flex:1},children:(0,V.jsx)(d5,{systemConfig:e.systemConfig,socket:e.socket,isSimulation:!0,calendarPrefix:a,simulationId:a,simulation:t.find(e=>e._id===a),simulations:t,theme:e.theme,readOnly:r[a]===`play`,simulationState:r[a],button:b},a)})]})},O5={field:{display:`flex`,alignItems:`end`,gap:20},hint:{fontSize:12,fontStyle:`italic`}},k5=e=>{let[t,n]=(0,B.useState)(e.calendar),[r,i]=(0,B.useState)(!1);return t?(0,V.jsxs)(zh,{open:!0,onClose:e.onClose,children:[(0,V.jsx)(ng,{children:Y.t(`Edit calendar`)}),(0,V.jsxs)(Yh,{children:[(0,V.jsx)(`div`,{style:O5.field,children:(0,V.jsx)($b,{label:Y.t(`Name`),value:t.common.name||``,onChange:e=>{let r=JSON.parse(JSON.stringify(t));r.common.name=e.target.value,n(r)},variant:`standard`})}),(0,V.jsx)(`div`,{style:O5.field,children:(0,V.jsx)(Dg,{control:(0,V.jsx)(Zm,{checked:t.common.enabled!==!1,onChange:e=>{let r=JSON.parse(JSON.stringify(t));r.common.enabled=e.target.checked,n(r)}}),label:(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{children:Y.t(`Active`)}),(0,V.jsx)(`div`,{style:O5.hint,children:Y.t(`Inactive calendars do not execute their events`)})]})})})]}),(0,V.jsxs)(Uh,{children:[(0,V.jsx)(Lm,{variant:`contained`,color:`secondary`,startIcon:(0,V.jsx)(_x,{}),onClick:()=>i(!0),children:Y.t(`Delete`)}),(0,V.jsx)(Lm,{disabled:!t||!e.calendar||!t.common.name||t.common.name===e.calendar.common.name&&t.common.enabled!==!1==(e.calendar.common.enabled!==!1),onClick:async()=>{await e.socket.setObject(t._id,t),await e.updateCalendars(),e.onClose()},variant:`contained`,color:`primary`,startIcon:(0,V.jsx)(Ux,{}),children:Y.t(`Save`)}),(0,V.jsx)(Lm,{onClick:e.onClose,variant:`contained`,color:`grey`,startIcon:(0,V.jsx)(cx,{}),children:Y.t(`Cancel`)})]}),r&&(0,V.jsx)(AS,{fullWidth:!1,title:Y.t(`Delete calendar`),text:Y.t(`Calendar will be deleted. Confirm?`),ok:Y.t(`Delete`),onClose:async n=>{if(n){try{let n=Object.keys(await e.socket.getObjectViewCustom(`schedule`,`schedule`,`${t._id}.`,`${t._id}.\u9999`));await e.socket.delObject(t._id),await Promise.all(n.map(t=>e.socket.delObject(t))),e.calendarPrefix===t._id&&e.setCalendarPrefix(`fullcalendar.${e.instance}`),await e.updateCalendars()}catch(e){window.alert(`Cannot delete calendar: ${e}`)}e.onClose()}i(!1)}})]}):null},A5={column:{width:`100%`,display:`flex`,flexDirection:`column`,alignItems:`start`,height:`100%`},calendars:{height:`100%`},container:{display:`flex`,width:`100%`,flex:1},tooltip:{pointerEvents:`none`}},j5=e=>{let[t,n]=(0,B.useState)(window.localStorage.getItem(`fullcalendar.calendar`)||`fullcalendar.${e.instance}`),[r,i]=(0,B.useState)(null),[a,o]=(0,B.useState)([]),[s,c]=(0,B.useState)(window.localStorage.getItem(`fullcalendar.tab`)===`1`),[l,u]=(0,B.useState)(!1),[d,f]=(0,B.useState)(window.localStorage.getItem(`fullcalendar.splitSizes`)?JSON.parse(window.localStorage.getItem(`fullcalendar.splitSizes`)):[15,85]),p=async()=>{let r=await e.socket.getObjectViewSystem(`folder`,`fullcalendar.${e.instance}.Calendars.`,`fullcalendar.${e.instance}.Calendars.\u9999`);o(Object.values(r)),Object.keys(r).includes(t)||(window.localStorage.removeItem(`fullcalendar.calendar`),n(`fullcalendar.${e.instance}`))},m=async t=>{let n=JSON.parse(JSON.stringify(t));n.common.enabled=t.common.enabled===!1,await e.socket.setObject(n._id,n),await p()},h=()=>c(e=>(window.localStorage.setItem(`fullcalendar.tab`,e?`0`:`1`),!e));return(0,B.useEffect)(()=>{let t=(e,t)=>{let n=t&&t.val||!1;u(!!n)};return p().catch(e=>console.error(e)),e.socket.subscribeState(`system.adapter.fullcalendar.${e.instance}.alive`,t).catch(e=>console.error(e)),e.socket.getState(`system.adapter.fullcalendar.${e.instance}.alive`).then(e=>u(!!(e&&e.val))).catch(e=>console.error(e)),()=>{e.socket.unsubscribeState(`system.adapter.fullcalendar.${e.instance}.alive`,t)}},[]),(0,V.jsxs)(`div`,{style:A5.column,children:[s?(0,V.jsx)(D5,{systemConfig:e.systemConfig,socket:e.socket,theme:e.theme,instance:e.instance,updateCalendars:p,changeCalendarType:h,setCalendarPrefix:n,alive:l}):(0,V.jsx)(`div`,{style:A5.container,children:(0,V.jsxs)(dD,{direction:oD.Horizontal,initialSizes:d,minWidths:[195,500],onResizeFinished:(e,t)=>{f(t),window.localStorage.setItem(`fullcalendar.splitSizes`,JSON.stringify(t))},gutterTheme:e.themeType===`dark`?sD.Dark:sD.Light,gutterClassName:e.themeType===`dark`?`Dark visGutter`:`Light visGutter`,children:[(0,V.jsx)(`div`,{style:A5.calendars,children:(0,V.jsxs)(C5,{isSimulations:!1,onChangeMode:h,title:Y.t(`Calendars`),addTitle:Y.t(`Add new calendar`),alive:l,onAdd:async()=>{let t=`fullcalendar.${e.instance}.Calendars.Calendar-${sU()}`;await e.socket.setObject(t,{type:`folder`,common:{name:`NewCalendar`},native:{}}),await p(),n(t),window.localStorage.setItem(`fullcalendar.calendar`,t),setTimeout(()=>i(t),300)},children:[(0,V.jsx)(w5,{name:Y.t(`Default`),selected:!a.find(e=>e._id===t),onClick:()=>{let t=`fullcalendar.${e.instance}`;window.localStorage.setItem(`fullcalendar.calendar`,t),n(t)}}),a.map(e=>(0,V.jsx)(w5,{name:e.common.name,color:e.common.color,icon:e.common.icon,selected:e._id===t,inactive:e.common.enabled===!1,onClick:()=>{window.localStorage.setItem(`fullcalendar.calendar`,e._id),n(e._id)},status:e.common.enabled===!1?(0,V.jsx)(lb,{title:Y.t(`Calendar is inactive. Click to activate`),slotProps:{popper:{sx:A5.tooltip}},children:(0,V.jsx)(Pd,{size:`small`,onClick:t=>{t.stopPropagation(),m(e)},children:(0,V.jsx)(wx,{})})}):null,actions:(0,V.jsxs)(V.Fragment,{children:[e.common.enabled===!1?null:(0,V.jsx)(lb,{title:Y.t(`Deactivate calendar`),slotProps:{popper:{sx:A5.tooltip}},children:(0,V.jsx)(Pd,{size:`small`,onClick:t=>{t.stopPropagation(),m(e)},children:(0,V.jsx)(Cx,{})})}),(0,V.jsx)(lb,{title:Y.t(`Edit name or delete calendar`),slotProps:{popper:{sx:A5.tooltip}},children:(0,V.jsx)(Pd,{size:`small`,onClick:t=>{i(e._id),t.stopPropagation()},children:(0,V.jsx)(bx,{})})})]})},e._id))]})}),(0,V.jsx)(d5,{systemConfig:e.systemConfig,socket:e.socket,theme:e.theme,calendarPrefix:t},t)]})}),r?(0,V.jsx)(k5,{onClose:()=>i(null),calendarPrefix:t,setCalendarPrefix:n,calendar:a.find(e=>e._id===r),socket:e.socket,instance:e.instance,updateCalendars:p}):null]})},M5=class extends HS{constructor(e){let t={...e};t.translations={en:zE,de:BE,ru:VE,pt:HE,nl:UE,fr:WE,it:GE,es:KE,pl:qE,uk:JE,"zh-cn":YE},t.sentryDSN=window.sentryDSN,window.location.port,window.socketUrl&&window.socketUrl.startsWith(`:`)&&(window.socketUrl=`${window.location.protocol}//${window.location.hostname}${window.socketUrl}`),super(e,t)}render(){return this.state.loaded?(0,V.jsx)(Kt,{injectFirst:!0,children:(0,V.jsx)(qc,{theme:this.state.theme,children:(0,V.jsx)(`div`,{style:{overflow:`auto`,height:`100%`},id:`rootDiv`,children:(0,V.jsx)(j5,{systemConfig:this._systemConfig,socket:this.socket,theme:this.state.theme,instance:this.instance,alive:!!this.state.alive,themeType:this.state.themeType})})})}):(0,V.jsx)(Kt,{injectFirst:!0,children:(0,V.jsx)(qc,{theme:this.state.theme,children:(0,V.jsx)(pS,{themeType:this.state.themeType})})})}};window.location.hostname===`localhost`||window.location.hostname===`[::1]`||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/);function N5(){`serviceWorker`in navigator&&navigator.serviceWorker.ready.then(e=>{e.unregister()})}var P5={name:`fullcalendar-admin`,version:`3.3.1`,private:!0,dependencies:{"@emotion/react":`^11.14.0`,"@emotion/styled":`^11.14.1`,"@devbookhq/splitter":`^1.4.2`,"@fullcalendar/core":`^6.1.22`,"@fullcalendar/daygrid":`^6.1.22`,"@fullcalendar/interaction":`^6.1.22`,"@fullcalendar/list":`^6.1.22`,"@fullcalendar/react":`^6.1.22`,"@fullcalendar/rrule":`^6.1.22`,"@fullcalendar/timegrid":`^6.1.22`,"@iobroker/gui-components":`^10.3.14`,"@iobroker/type-detector":`^6.2.0`,"@material-icons/svg":`^1.0.33`,"@mui/icons-material":`^9.5.0`,"@mui/material":`^9.5.0`,"@mui/system":`^9.5.0`,"@mui/x-date-pickers":`^9.16.0`,"@sentry/browser":`^11.10.0`,"@vitejs/plugin-react":`^6.1.2`,dayjs:`^1.11.23`,moment:`^2.31.0`,react:`^19.3.1`,"react-ace":`^15.0.0`,"react-dnd":`^16.0.1`,"react-dnd-html5-backend":`^16.0.1`,"react-dnd-preview":`^9.0.0`,"react-dnd-touch-backend":`^16.0.1`,"react-dom":`^19.3.1`,"react-dropzone":`^20.1.4`,"react-icons":`^5.7.0`,rrule:`^2.8.1`,suncalc2:`^1.8.1`,vite:`^8.3.5`},scripts:{start:`vite --host`,build:`vite build`,lint:`eslint -c eslint.config.mjs`,"check-ts":`tsc --noEmit --checkJS false`,tsc:`tsc --project tsconfig.json`},eslintConfig:{extends:`react-app`},homepage:`.`,browserslist:[`>0.2%`,`not dead`,`not ie <= 11`,`not op_mini all`]},F5=e=>{let t=cl(e);return t&&(t.palette.text.danger={color:`#dd5325`},t.palette.text.success={color:`#73b6a8`},t)},I5=ES.getThemeName();window.adapterName=`fullcalendar`,console.log(`iobroker.${window.adapterName}@${P5.version} using theme "${I5}"`);function L5(e,t,n){let r=(e||``).split(` `).map(e=>e.trim()).filter(e=>e),i=r.indexOf(n);return i!==-1&&r.splice(i,1),!r.includes(t)&&r.push(t),r.join(` `)}var R5=()=>{let[e,t]=(0,B.useState)(I5),n=F5(e),r=()=>n,i=n.palette.mode;return(0,B.useEffect)(()=>{i===`dark`?window.document.body.className=L5(window.document.body.className,`body-dark`,`body-light`):window.document.body.className=L5(window.document.body.className,`body-light`,`body-dark`)},[i]),(0,V.jsx)(Kt,{injectFirst:!0,children:(0,V.jsx)(qc,{theme:r(),children:(0,V.jsx)(M5,{onThemeChange:e=>t(e)})})})};function z5(){let e=document.getElementById(`root`);(0,Jc.createRoot)(e).render((0,V.jsx)(R5,{}))}z5(),N5();
|
|
788
|
+
`}),(0,V.jsx)(ng,{children:Y.t(`Edit simulation`)}),(0,V.jsxs)(Yh,{children:[(0,V.jsxs)(`div`,{style:m5.field,children:[(0,V.jsx)($b,{label:Y.t(`Name`),value:t.common.name||``,onChange:e=>{let r=JSON.parse(JSON.stringify(t));r.common.name=e.target.value,n(r)},variant:`standard`}),(0,V.jsxs)(Cg,{variant:`standard`,children:[(0,V.jsx)(n_,{children:Y.t(`Interval`)}),(0,V.jsx)(By,{value:t.native.interval||``,onChange:e=>{let r=JSON.parse(JSON.stringify(t));r.native.interval=e.target.value,n(r)},variant:`standard`,children:[`day`,`week`].map(e=>(0,V.jsx)(Qv,{value:e,children:Y.t(e)},e))})]})]}),(0,V.jsx)(`div`,{style:m5.field,children:(0,V.jsx)(zC,{label:Y.t(`Default color`),value:t.common.color,onChange:e=>{let r=JSON.parse(JSON.stringify(t));r.common.color=e,n(r)}})}),(0,V.jsxs)(`h4`,{style:m5.headers,children:[Y.t(`States`),(0,V.jsx)(lb,{title:Y.t(`Add states for recording`),slotProps:{popper:{sx:m5.tooltip}},children:(0,V.jsx)(Pd,{style:!l.length&&t?.native?.record?.states?.length?m5.blink:void 0,size:`small`,onClick:()=>o(!0),color:`primary`,children:(0,V.jsx)(tx,{})})})]}),(0,V.jsx)(`div`,{children:t.native.record?.states.map((e,r)=>v(e,()=>{let e=JSON.parse(JSON.stringify(t));e.native.record.states.splice(r,1),n(e)}))}),(0,V.jsxs)(`h4`,{style:m5.headers,children:[Y.t(`Categories`),(0,V.jsx)(lb,{title:Y.t(`Add overlap of categories for recording`),slotProps:{popper:{sx:m5.tooltip}},children:(0,V.jsx)(Pd,{style:!l.length&&t?.native?.record?.states?.length?m5.blink:void 0,size:`small`,onClick:()=>c(!0),color:`primary`,children:(0,V.jsx)(tx,{})})})]}),(0,V.jsx)(`div`,{children:t.native.record?.enums.map((e,r)=>{let i=e.map(e=>(0,V.jsx)(LE,{value:d[e]||e,lang:Y.getLanguage()},e)),a=1,o=i.reduce((e,t)=>[e,(0,V.jsx)(`span`,{children:`+`},a++),t],null);return(0,V.jsx)(am,{onClick:()=>c(r),onDelete:()=>{let e=JSON.parse(JSON.stringify(t));e.native.record.enums.splice(r,1),n(e)},label:o,sx:{"& .MuiChip-label":m5.chipLabel},style:m5.chip},r)})}),(0,V.jsx)(`h4`,{style:{marginBottom:-0},children:Y.t(`Recorded states`)}),(0,V.jsxs)(`div`,{children:[h&&(0,V.jsx)(v_,{}),Object.keys(p).map(e=>v(e))]})]}),(0,V.jsxs)(Uh,{children:[(0,V.jsx)(Lm,{variant:`contained`,color:`secondary`,startIcon:(0,V.jsx)(_x,{}),onClick:()=>i(!0),children:Y.t(`Delete`)}),(0,V.jsx)(Lm,{disabled:y,onClick:async()=>{let n=JSON.parse(JSON.stringify(t));n.native.interval!==e.simulation.native.interval&&n.native.interval===`day`&&(console.log(n),n.native.events.forEach(e=>{console.log(e.native.cron);let t=ZH(e.native.cron);console.log(t),t.dows=[0,1,2,3,4,5,6],e.native.cron=$H(t),console.log(e.native.cron)})),await e.socket.setObject(t._id,n),e.onClose()},variant:`contained`,color:`primary`,startIcon:(0,V.jsx)(Ux,{}),children:Y.t(`Save`)}),(0,V.jsx)(Lm,{onClick:e.onClose,variant:`contained`,color:`grey`,startIcon:(0,V.jsx)(cx,{}),children:y?Y.t(`ra_Close`):Y.t(`ra_Cancel`)})]}),r&&(0,V.jsx)(AS,{fullWidth:!1,title:Y.t(`Delete simulation`),text:Y.t(`Simulation will be deleted. Confirm?`),ok:Y.t(`ra_Delete`),onClose:async n=>{n&&(await e.onDelete(t._id),e.onClose()),i(!1)}}),a&&(0,V.jsx)(RE,{imagePrefix:`../..`,multiSelect:!0,theme:e.theme,selected:t.native.record.states,onOk:e=>{let r=JSON.parse(JSON.stringify(t));r.native.record=r.native.record||{enums:[],states:[]},r.native.record.states=r.native.record.states||[],r.native.record.states=Array.isArray(e)?e:[e],n(r),o(!1)},onClose:()=>o(!1),socket:e.socket}),s===!1?null:(0,V.jsx)(p5,{socket:e.socket,enumsObjects:d,selectedEnums:typeof s==`number`?t.native.record.enums[s]:[],exceptions:t.native.record.enumsExceptions||[],onSelect:(e,r)=>{let i=JSON.parse(JSON.stringify(t));i.native.record=i.native.record||{enums:[],states:[]},i.native.record.enums=i.native.record.enums||[],i.native.record.enumsExceptions=r||[],typeof s==`number`?i.native.record.enums[s]=e:i.native.record.enums.push(e),n(i),c(!1)},onClose:()=>c(!1)})]})},g5={Y:`year`,YY:`year`,YYYY:{sectionType:`year`,contentType:`digit`,maxLength:4},M:{sectionType:`month`,contentType:`digit`,maxLength:2},MM:`month`,MMM:{sectionType:`month`,contentType:`letter`},MMMM:{sectionType:`month`,contentType:`letter`},D:{sectionType:`day`,contentType:`digit`,maxLength:2},DD:`day`,Do:{sectionType:`day`,contentType:`digit-with-letter`},E:{sectionType:`weekDay`,contentType:`digit`,maxLength:1},e:{sectionType:`weekDay`,contentType:`digit`,maxLength:1},d:{sectionType:`weekDay`,contentType:`digit`,maxLength:1},dd:{sectionType:`weekDay`,contentType:`letter`},ddd:{sectionType:`weekDay`,contentType:`letter`},dddd:{sectionType:`weekDay`,contentType:`letter`},A:`meridiem`,a:`meridiem`,H:{sectionType:`hours`,contentType:`digit`,maxLength:2},HH:`hours`,h:{sectionType:`hours`,contentType:`digit`,maxLength:2},hh:`hours`,k:{sectionType:`hours`,contentType:`digit`,maxLength:2},kk:`hours`,m:{sectionType:`minutes`,contentType:`digit`,maxLength:2},mm:`minutes`,s:{sectionType:`seconds`,contentType:`digit`,maxLength:2},ss:`seconds`},_5={year:`YYYY`,month:`MMMM`,monthShort:`MMM`,dayOfMonth:`D`,dayOfMonthFull:`Do`,weekday:`dddd`,weekdayShort:`ddd`,hours24h:`HH`,hours12h:`hh`,meridiem:`A`,minutes:`mm`,seconds:`ss`,fullDate:`ll`,keyboardDate:`L`,shortDate:`MMM D`,normalDate:`D MMMM`,normalDateWithWeekday:`ddd, MMM D`,fullTime12h:`hh:mm A`,fullTime24h:`HH:mm`,keyboardDateTime12h:`L hh:mm A`,keyboardDateTime24h:`L HH:mm`};function v5(){throw Error(BX(140))}var y5=class{isMUIAdapter=!0;isTimezoneCompatible=!0;lib=`moment`;escapedCharacters={start:`[`,end:`]`};formatTokenMap=g5;constructor({locale:e,formats:t,instance:n}={}){this.moment=n||dU,this.locale=e,this.formats=b({},_5,t)}setLocaleToValue=e=>{let t=this.getCurrentLocaleCode();return t===e.locale()?e:e.locale(t)};hasTimezonePlugin=()=>this.moment.tz!==void 0;createSystemDate=e=>{let t=this.moment(e).local();return this.locale===void 0?t:t.locale(this.locale)};createUTCDate=e=>{let t=this.moment.utc(e);return this.locale===void 0?t:t.locale(this.locale)};createTZDate=(e,t)=>{this.hasTimezonePlugin()||v5();let n=t==="default"?this.moment(e):this.moment.tz(e,t);return this.locale===void 0?n:n.locale(this.locale)};date=(e,t=`default`)=>e===null?null:t===`UTC`?this.createUTCDate(e):t===`system`||t==="default"&&!this.hasTimezonePlugin()?this.createSystemDate(e):this.createTZDate(e,t);getInvalidDate=()=>this.moment(new Date(`Invalid Date`));getTimezone=e=>{let t=e._z?.name,n=e.isUTC()?`UTC`:`system`;return t??this.moment.defaultZone?.name??n};setTimezone=(e,t)=>{if(this.getTimezone(e)===t)return e;if(t===`UTC`)return e.clone().utc();if(t===`system`)return e.clone().local();if(!this.hasTimezonePlugin())return t!=="default"&&v5(),e;let n=t==="default"?this.moment.defaultZone?.name??`system`:t;if(n===`system`)return e.clone().local();let r=e.clone();return r.tz(n),r};toJsDate=e=>e.toDate();parse=(e,t)=>e===``?null:this.locale?this.moment(e,t,this.locale,!0):this.moment(e,t,!0);getCurrentLocaleCode=()=>this.locale||dU.locale();is12HourCycleInCurrentLocale=()=>/A|a/.test(dU.localeData(this.getCurrentLocaleCode()).longDateFormat(`LT`));expandFormat=e=>e.match(/(\[[^[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})|./g).map(e=>{let t=e[0];return t===`L`||t===`;`?dU.localeData(this.getCurrentLocaleCode()).longDateFormat(e):e}).join(``);isValid=e=>e!=null&&e.isValid();format=(e,t)=>this.formatByString(e,this.formats[t]);formatByString=(e,t)=>{let n=e.clone();return n.locale(this.getCurrentLocaleCode()),n.format(t)};formatNumber=e=>e;isEqual=(e,t)=>e===null&&t===null?!0:e===null||t===null?!1:e.isSame(t);isSameYear=(e,t)=>e.isSame(t,`year`);isSameMonth=(e,t)=>e.isSame(t,`month`);isSameDay=(e,t)=>e.isSame(t,`day`);isSameHour=(e,t)=>e.isSame(t,`hour`);isAfter=(e,t)=>e.isAfter(t);isAfterYear=(e,t)=>e.isAfter(t,`year`);isAfterDay=(e,t)=>e.isAfter(t,`day`);isBefore=(e,t)=>e.isBefore(t);isBeforeYear=(e,t)=>e.isBefore(t,`year`);isBeforeDay=(e,t)=>e.isBefore(t,`day`);isWithinRange=(e,[t,n])=>e.isBetween(t,n,null,`[]`);startOfYear=e=>e.clone().startOf(`year`);startOfMonth=e=>e.clone().startOf(`month`);startOfWeek=e=>this.setLocaleToValue(e.clone()).startOf(`week`);startOfDay=e=>e.clone().startOf(`day`);endOfYear=e=>e.clone().endOf(`year`);endOfMonth=e=>e.clone().endOf(`month`);endOfWeek=e=>this.setLocaleToValue(e.clone()).endOf(`week`);endOfDay=e=>e.clone().endOf(`day`);addYears=(e,t)=>t<0?e.clone().subtract(Math.abs(t),`years`):e.clone().add(t,`years`);addMonths=(e,t)=>t<0?e.clone().subtract(Math.abs(t),`months`):e.clone().add(t,`months`);addWeeks=(e,t)=>t<0?e.clone().subtract(Math.abs(t),`weeks`):e.clone().add(t,`weeks`);addDays=(e,t)=>t<0?e.clone().subtract(Math.abs(t),`days`):e.clone().add(t,`days`);addHours=(e,t)=>t<0?e.clone().subtract(Math.abs(t),`hours`):e.clone().add(t,`hours`);addMinutes=(e,t)=>t<0?e.clone().subtract(Math.abs(t),`minutes`):e.clone().add(t,`minutes`);addSeconds=(e,t)=>t<0?e.clone().subtract(Math.abs(t),`seconds`):e.clone().add(t,`seconds`);getYear=e=>e.get(`year`);getMonth=e=>e.get(`month`);getDate=e=>e.get(`date`);getHours=e=>e.get(`hours`);getMinutes=e=>e.get(`minutes`);getSeconds=e=>e.get(`seconds`);getMilliseconds=e=>e.get(`milliseconds`);setYear=(e,t)=>e.clone().year(t);setMonth=(e,t)=>e.clone().month(t);setDate=(e,t)=>e.clone().date(t);setHours=(e,t)=>e.clone().hours(t);setMinutes=(e,t)=>e.clone().minutes(t);setSeconds=(e,t)=>e.clone().seconds(t);setMilliseconds=(e,t)=>e.clone().milliseconds(t);getDaysInMonth=e=>e.daysInMonth();getWeekArray=e=>{let t=this.startOfWeek(this.startOfMonth(e)),n=this.endOfWeek(this.endOfMonth(e)),r=0,i=t,a=i.get(`dayOfYear`),o=[];for(;i.isBefore(n);){let e=Math.floor(r/7);o[e]=o[e]||[],o[e].push(i);let t=a;i=this.addDays(i,1),a=i.get(`dayOfYear`),t===a&&(i=i.add(12,`h`).startOf(`day`)),r+=1}return o};getWeekNumber=e=>e.week();getDayOfWeek=e=>e.day()+1;getYearRange([e,t]){let n=this.startOfYear(e),r=this.endOfYear(t),i=[],a=n;for(;this.isBefore(a,r);)i.push(a),a=this.addYears(a,1);return i}},b5={field:{"& .MuiFormControl-root":{width:`100%`},display:`flex`,alignItems:`end`,gap:`20px`},tableCell:{textAlign:`center`}},x5=e=>{let[t,n]=(0,B.useState)({start:null,end:null,dow:[0,1,2,3,4,5,6]});return dU.locale(Y.getLanguage()),(0,V.jsxs)(zh,{open:!0,onClose:e.onClose,children:[(0,V.jsx)(ng,{children:Y.t(`Play simulation`)}),(0,V.jsxs)(Yh,{children:[(0,V.jsxs)(qX,{dateAdapter:y5,children:[(0,V.jsxs)(Tm,{component:`div`,sx:b5.field,style:{width:`100%`,marginBottom:20,marginTop:10},children:[(0,V.jsx)(M8,{label:`Start`,sx:e=>({borderBottom:`1px solid ${e.palette.text.primary}`,"& fieldset":{display:`none`},"& input":{padding:`${e.spacing(1.5)} 0 4px 0`},"& .MuiInputAdornment-root":{marginLeft:0,marginTop:1},"& label":{transform:`translate(0px, -9px) scale(0.75)`},"&.MuiTextField-root":{width:`100%`}}),value:t.start,onChange:e=>n({...t,start:e})}),t.start&&(0,V.jsx)(Pd,{onClick:()=>n({...t,start:null}),children:(0,V.jsx)(_x,{})})]}),(0,V.jsxs)(Tm,{component:`div`,sx:b5.field,style:{width:`100%`,marginBottom:30},children:[(0,V.jsx)(M8,{label:`End`,sx:e=>({borderBottom:`1px solid ${e.palette.text.primary}`,"& fieldset":{display:`none`},"& input":{padding:`${e.spacing(1.5)} 0 4px 0`},"& .MuiInputAdornment-root":{marginLeft:0,marginTop:1},"& label":{transform:`translate(0px, -9px) scale(0.75)`}}),value:t.end,onChange:e=>n({...t,end:e})}),t.end&&(0,V.jsx)(Pd,{onClick:()=>n({...t,end:null}),children:(0,V.jsx)(_x,{})})]})]}),(0,V.jsx)(`div`,{children:(0,V.jsxs)(`table`,{children:[(0,V.jsx)(`thead`,{children:(0,V.jsx)(`tr`,{children:[0,1,2,3,4,5,6].map(e=>(0,V.jsx)(`td`,{style:b5.tableCell,children:dU().day(e).format(`ddd`)},e))})}),(0,V.jsx)(`tbody`,{children:(0,V.jsx)(`tr`,{children:[0,1,2,3,4,5,6].map(r=>(0,V.jsx)(`td`,{children:(0,V.jsx)(Zm,{"aria-label":`play simulation`,checked:t.dow.includes(r),disabled:e.readOnly,onChange:e=>{e.target.checked?n({...t,dow:[...t.dow,r]}):n({...t,dow:t.dow.filter(e=>e!==r)})},size:`small`})},r))})})]})})]}),(0,V.jsxs)(Uh,{children:[(0,V.jsx)(Lm,{onClick:()=>{e.playSimulation(e.simulation._id,t),e.onClose()},variant:`contained`,color:`primary`,startIcon:(0,V.jsx)(Ix,{}),children:Y.t(`Play`)}),(0,V.jsx)(Lm,{onClick:e.onClose,variant:`contained`,color:`grey`,startIcon:(0,V.jsx)(cx,{}),children:Y.t(`Cancel`)})]})]})},S5={panel:e=>({height:`100%`,display:`flex`,flexDirection:`column`,borderRadius:0,borderRight:`1px solid ${e.palette.divider}`,overflow:`hidden`}),modeTabs:{flexShrink:0,minHeight:42,"& .MuiTab-root":{minHeight:42,minWidth:0,flex:1,padding:`0 8px`}},header:e=>({flexShrink:0,display:`flex`,alignItems:`center`,gap:1,minHeight:44,padding:`6px 6px 6px 12px`,borderBottom:`1px solid ${e.palette.divider}`}),headerTitle:e=>({flexGrow:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,fontSize:11,fontWeight:600,letterSpacing:`0.08em`,textTransform:`uppercase`,color:e.palette.text.secondary}),addButton:e=>({flexShrink:0,width:28,height:28,color:e.palette.primary.contrastText||`#fff`,backgroundColor:e.palette.primary.main,"&:hover":{color:e.palette.primary.contrastText||`#fff`,backgroundColor:e.palette.primary.dark},"& .MuiSvgIcon-root":{fontSize:18}}),alert:e=>({display:`flex`,flexShrink:0,color:e.palette.error.main,"& .MuiSvgIcon-root":{fontSize:18}}),list:{flex:1,overflowY:`auto`,overflowX:`hidden`,padding:`6px`},item:e=>({gap:1,minHeight:34,paddingTop:`3px`,paddingBottom:`3px`,paddingLeft:`8px`,paddingRight:`4px`,marginBottom:`2px`,"& .actions":{opacity:0,transition:`opacity 0.15s ease-in-out`},"&:hover .actions, &.Mui-focusVisible .actions, &.Mui-selected .actions":{opacity:1},"&.Mui-selected .MuiIconButton-root":{color:`inherit`},"&.Mui-selected .count":{backgroundColor:`rgba(255, 255, 255, 0.22)`,color:`inherit`},...e.name?.startsWith(`modern`)?void 0:{"&.Mui-selected":{backgroundColor:e.palette.primary.main,color:e.palette.primary.contrastText,"&:hover":{backgroundColor:e.palette.primary.dark}}}}),itemText:{margin:0,overflow:`hidden`},swatch:{flexShrink:0,width:10,height:10,borderRadius:`3px`,boxShadow:`inset 0 0 0 1px rgba(0, 0, 0, 0.25)`},icon:{flexShrink:0,width:16,height:16},actions:{display:`flex`,alignItems:`center`,flexShrink:0,"& .MuiIconButton-root":{padding:`4px`},"& .MuiSvgIcon-root":{fontSize:18}},count:e=>({flexShrink:0,minWidth:20,height:18,padding:`0 5px`,borderRadius:`9px`,fontSize:10,fontWeight:600,lineHeight:`18px`,textAlign:`center`,backgroundColor:Ti(e.palette.text.primary,.08),color:e.palette.text.secondary}),tooltip:{pointerEvents:`none`}};function C5(e){return(0,V.jsxs)(vu,{sx:[S5.panel,{width:e.width??`100%`}],children:[(0,V.jsxs)(Jb,{value:+!!e.isSimulations,onChange:e.onChangeMode,variant:`fullWidth`,sx:S5.modeTabs,children:[(0,V.jsx)(Sb,{title:Y.t(`Calendars`),icon:(0,V.jsx)(ox,{})}),(0,V.jsx)(Sb,{title:Y.t(`Simulations`),icon:(0,V.jsx)(Lx,{})})]}),(0,V.jsxs)(Tm,{sx:S5.header,children:[(0,V.jsx)(Tm,{component:`div`,sx:S5.headerTitle,children:e.title}),e.alive===!1&&(0,V.jsx)(lb,{title:Y.t(`Instance inactive`),slotProps:{popper:{sx:S5.tooltip}},children:(0,V.jsx)(Tm,{component:`span`,sx:S5.alert,children:(0,V.jsx)(Vx,{})})}),(0,V.jsx)(lb,{title:e.addTitle,slotProps:{popper:{sx:S5.tooltip}},children:(0,V.jsx)(Pd,{size:`small`,sx:S5.addButton,onClick:e.onAdd,children:(0,V.jsx)(tx,{})})})]}),(0,V.jsx)(C_,{dense:!0,disablePadding:!0,sx:S5.list,children:e.children})]})}function w5(e){return(0,V.jsxs)(O_,{selected:e.selected,onClick:e.onClick,sx:S5.item,children:[e.icon?(0,V.jsx)(Cw,{src:e.icon,style:S5.icon}):e.color?(0,V.jsx)(Tm,{component:`span`,sx:S5.swatch,style:{backgroundColor:e.color}}):null,(0,V.jsx)(q_,{sx:S5.itemText,title:e.name,primary:e.name,slotProps:{primary:{noWrap:!0,sx:{fontSize:13,fontWeight:e.selected?600:400,opacity:e.inactive?.5:1}}}}),e.actions?(0,V.jsx)(Tm,{component:`span`,className:`actions`,sx:S5.actions,children:e.actions}):null,e.status?(0,V.jsx)(Tm,{component:`span`,sx:S5.actions,children:e.status}):null,e.count===void 0?null:(0,V.jsx)(lb,{title:Y.t(`Events`),slotProps:{popper:{sx:S5.tooltip}},children:(0,V.jsx)(Tm,{component:`span`,className:`count`,sx:S5.count,children:e.count})})]})}var T5=260,E5={container:{display:`flex`,width:`100%`,flex:1},toCalendar:{paddingLeft:20},simulations:e=>({backgroundColor:Ti(e.palette.primary.main,e.palette.mode===`dark`?.04:.05)}),tooltip:{pointerEvents:`none`}},D5=e=>{let[t,n]=(0,B.useState)([]),[r,i]=(0,B.useState)({}),[a,o]=(0,B.useState)(window.localStorage.getItem(`fullcalendar.selectedSimulation`)||null),[s,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)(!1),[d,f]=(0,B.useState)(null),[p,m]=(0,B.useState)(null),h=(e,t)=>{t&&i(n=>({...n,[e]:t.val}))},g=(e,t)=>{n(n=>{let r=JSON.parse(JSON.stringify(n)),i=r.findIndex(t=>t._id===e);if(i===-1){if(!t)return n;r.push(t)}else t?r[i]=t:r.splice(i,1);return r})},_=async()=>{let r=await e.socket.getObjectViewSystem(`state`,`fullcalendar.${e.instance}.Simulations.`,`fullcalendar.${e.instance}.Simulations.\u9999`),s={};for(let t in r)s[t]=(await e.socket.getState(t))?.val;let c=Object.values(r);c.sort((e,t)=>e.common.name.localeCompare(t.common.name)),n(c),(!a||t.length&&!t.find(e=>e._id===a))&&o(t[0]?._id||null),i(s),e.socket.subscribeObject(`fullcalendar.${e.instance}.Simulations.*`,g),e.socket.subscribeState(`fullcalendar.${e.instance}.Simulations.*`,h)};(0,B.useEffect)(()=>(_().catch(()=>{}),()=>{e.socket.unsubscribeObject(`fullcalendar.${e.instance}.Simulations.*`,g),e.socket.unsubscribeState(`fullcalendar.${e.instance}.Simulations.*`,h)}),[]),(0,B.useEffect)(()=>{(!a||t.length&&!t.find(e=>e._id===a))&&o(t[0]?._id||null)},[t]);let v=async(t,n)=>{n||=await e.socket.getObject(t),n.native.record=n.native.record||{},n.native.record.start=Date.now(),n.native.record.end=n.native.interval===`day`?new Date(Date.now()+864e5):new Date(Date.now()+6048e5),await e.socket.setObject(t,n),e.socket.setState(t,`record`)},y=async(t,n)=>{let r=await e.socket.getObject(t);r.native.play=n,await e.socket.setObject(t,r),e.socket.setState(t,`play`)},b=(0,V.jsx)(`div`,{style:E5.toCalendar,children:(0,V.jsx)(lb,{title:Y.t(`You can export events to static calender`),slotProps:{popper:{sx:E5.tooltip}},children:(0,V.jsx)(Lm,{variant:`contained`,onClick:async()=>{let n=`fullcalendar.${e.instance}.Calendars.Calendar-${sU()}`;await e.socket.setObject(n,{type:`folder`,common:{name:`NewCalendar`},native:{}});let r=t.find(e=>e._id===a).native.events;for(let t of r){let r=JSON.parse(JSON.stringify(t));r.id=`${n}.event-${sU()}`,e.socket.setObject(r.id,r)}e.updateCalendars(),e.changeCalendarType(),e.setCalendarPrefix(n)},children:Y.t(`To calendar`)})})}),x=(a&&t.find(e=>e._id===a)?a:t[0]?._id)||``;return(0,V.jsxs)(Tm,{component:`div`,style:E5.container,sx:E5.simulations,children:[(0,V.jsxs)(`div`,{children:[d&&(0,V.jsx)(h5,{socket:e.socket,simulation:t.find(e=>e._id===d),onClose:()=>f(null),theme:e.theme,onDelete:async n=>{try{if(a===n){let e=t.find(e=>e._id!==n);o(e?._id||null)}await e.socket.delObject(n)}catch(e){window.alert(`Cannot delete simulation: ${e}`)}}}),p&&(0,V.jsx)(x5,{playSimulation:y,simulation:t.find(e=>e._id===p),onClose:()=>m(null)}),s&&(0,V.jsxs)(zh,{open:!0,maxWidth:`md`,onClose:(e,t)=>{t!==`backdropClick`&&t!==`escapeKeyDown`&&c(!1)},children:[(0,V.jsx)(ng,{id:`confirmation-dialog-title`,children:Y.t(`Start recording`)}),(0,V.jsx)(Yh,{children:(0,V.jsx)($h,{children:Y.t(`Do you want to delete previously recorded events?`)})}),(0,V.jsxs)(Uh,{children:[(0,V.jsx)(Lm,{variant:`contained`,onClick:async()=>{let t=await e.socket.getObject(s);t.native.events=[],await v(t._id,t),c(!1)},style:{backgroundColor:`red`,color:`white`},autoFocus:!0,startIcon:(0,V.jsx)(_x,{}),children:Y.t(`Delete events`)}),(0,V.jsx)(Lm,{variant:`contained`,onClick:async()=>{await v(s),c(!1)},color:`grey`,startIcon:(0,V.jsx)(lx,{}),children:Y.t(`Keep events`)})]})]}),l!==!1&&(0,V.jsx)(AS,{fullWidth:!1,title:Y.t(`Stop recording`),text:Y.t(`Do you want to stop recording? You cannot restart it again.`),ok:Y.t(`Stop`),onClose:t=>{t&&e.socket.setState(l,`stop`),u(!1)}}),(0,V.jsx)(C5,{isSimulations:!0,onChangeMode:e.changeCalendarType,title:Y.t(`Simulations`),addTitle:Y.t(`Create new simulation`),alive:e.alive,width:T5,onAdd:async()=>{let n=`fullcalendar.${e.instance}.Simulations.${sU()}`;await e.socket.setObject(n,{common:{name:Y.t(`Simulation %s`,t.length+1),role:`state`,type:`string`,states:[`stop`,`record`,`play`,`pause`],color:`#3A87AD`},native:{events:[],interval:`day`,record:{states:[],enums:[],start:null,end:null}},type:`state`}),await e.socket.setState(n,`stop`),window.localStorage.setItem(`fullcalendar.selectedSimulation`,n),setTimeout(()=>{o(n),f(n)},300)},children:t.map(t=>(0,V.jsx)(w5,{name:t.common.name||t._id,color:t.common.color,icon:t.common.icon,count:t.native.events?.length||0,selected:t._id===x,onClick:()=>{window.localStorage.setItem(`fullcalendar.selectedSimulation`,t._id),o(t._id)},actions:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(lb,{title:Y.t(`Edit name and settings`),slotProps:{popper:{sx:E5.tooltip}},children:(0,V.jsx)(Pd,{onClick:e=>{e.stopPropagation(),f(t._id)},size:`small`,children:(0,V.jsx)(bx,{})})}),r[t._id]===`stop`&&(0,V.jsx)(lb,{title:Y.t(`Start recording`),slotProps:{popper:{sx:E5.tooltip}},children:(0,V.jsx)(`span`,{children:(0,V.jsx)(Pd,{onClick:async e=>{e.stopPropagation(),t.native.events.length?c(t._id):await v(t._id)},size:`small`,children:(0,V.jsx)(Ex,{})})})}),r[t._id]===`stop`&&t.native.events.length>0&&(0,V.jsx)(lb,{title:Y.t(`Start playing`),slotProps:{popper:{sx:E5.tooltip}},children:(0,V.jsx)(`span`,{children:(0,V.jsx)(Pd,{onClick:e=>{e.stopPropagation(),m(t._id)},size:`small`,children:(0,V.jsx)(Fx,{})})})})]}),status:(0,V.jsxs)(V.Fragment,{children:[(r[t._id]===`record`||r[t._id]===`pause`)&&(0,V.jsx)(lb,{title:Y.t(`Stop recording. Recording till %s`,dU(t.native.record.end).format(`DD.MM.YYYY HH:mm:ss`)),slotProps:{popper:{sx:E5.tooltip}},children:(0,V.jsx)(`span`,{style:{opacity:r[t._id]===`pause`?.5:1},children:(0,V.jsx)(Pd,{disabled:r[t._id]===`pause`,onClick:e=>{e.stopPropagation(),u(t._id)},size:`small`,children:(0,V.jsx)(qx,{style:{color:`red`}})})})}),r[t._id]===`play`&&(0,V.jsx)(lb,{title:Y.t(`Stop playing`),slotProps:{popper:{sx:E5.tooltip}},children:(0,V.jsx)(`span`,{children:(0,V.jsx)(Pd,{onClick:n=>{n.stopPropagation(),e.socket.setState(t._id,`stop`)},size:`small`,children:(0,V.jsx)(qx,{style:{color:`green`}})})})}),r[t._id]===`record`&&(0,V.jsx)(lb,{title:Y.t(`Pause recording`),slotProps:{popper:{sx:E5.tooltip}},children:(0,V.jsx)(`span`,{children:(0,V.jsx)(Pd,{onClick:n=>{n.stopPropagation(),e.socket.setState(t._id,`pause`)},size:`small`,children:(0,V.jsx)(Nx,{})})})}),r[t._id]===`pause`&&(0,V.jsx)(lb,{title:Y.t(`Resume recording. Recording till %s`,dU(t.native.record.end).format(`DD.MM.YYYY HH:mm:ss`)),slotProps:{popper:{sx:E5.tooltip}},children:(0,V.jsx)(`span`,{children:(0,V.jsx)(Pd,{onClick:n=>{n.stopPropagation(),e.socket.setState(t._id,`record`)},size:`small`,children:(0,V.jsx)(Nx,{style:{color:`yellow`}})})})})]})},t._id))})]}),a&&(0,V.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,flex:1},children:(0,V.jsx)(d5,{systemConfig:e.systemConfig,socket:e.socket,isSimulation:!0,calendarPrefix:a,simulationId:a,simulation:t.find(e=>e._id===a),simulations:t,theme:e.theme,readOnly:r[a]===`play`,simulationState:r[a],button:b},a)})]})},O5={field:{display:`flex`,alignItems:`end`,gap:20},hint:{fontSize:12,fontStyle:`italic`}},k5=e=>{let[t,n]=(0,B.useState)(e.calendar),[r,i]=(0,B.useState)(!1);return t?(0,V.jsxs)(zh,{open:!0,onClose:e.onClose,children:[(0,V.jsx)(ng,{children:Y.t(`Edit calendar`)}),(0,V.jsxs)(Yh,{children:[(0,V.jsx)(`div`,{style:O5.field,children:(0,V.jsx)($b,{label:Y.t(`Name`),value:t.common.name||``,onChange:e=>{let r=JSON.parse(JSON.stringify(t));r.common.name=e.target.value,n(r)},variant:`standard`})}),(0,V.jsx)(`div`,{style:O5.field,children:(0,V.jsx)(Dg,{control:(0,V.jsx)(Zm,{checked:t.common.enabled!==!1,onChange:e=>{let r=JSON.parse(JSON.stringify(t));r.common.enabled=e.target.checked,n(r)}}),label:(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{children:Y.t(`Active`)}),(0,V.jsx)(`div`,{style:O5.hint,children:Y.t(`Inactive calendars do not execute their events`)})]})})})]}),(0,V.jsxs)(Uh,{children:[(0,V.jsx)(Lm,{variant:`contained`,color:`secondary`,startIcon:(0,V.jsx)(_x,{}),onClick:()=>i(!0),children:Y.t(`Delete`)}),(0,V.jsx)(Lm,{disabled:!t||!e.calendar||!t.common.name||t.common.name===e.calendar.common.name&&t.common.enabled!==!1==(e.calendar.common.enabled!==!1),onClick:async()=>{await e.socket.setObject(t._id,t),await e.updateCalendars(),e.onClose()},variant:`contained`,color:`primary`,startIcon:(0,V.jsx)(Ux,{}),children:Y.t(`Save`)}),(0,V.jsx)(Lm,{onClick:e.onClose,variant:`contained`,color:`grey`,startIcon:(0,V.jsx)(cx,{}),children:Y.t(`Cancel`)})]}),r&&(0,V.jsx)(AS,{fullWidth:!1,title:Y.t(`Delete calendar`),text:Y.t(`Calendar will be deleted. Confirm?`),ok:Y.t(`Delete`),onClose:async n=>{if(n){try{let n=Object.keys(await e.socket.getObjectViewCustom(`schedule`,`schedule`,`${t._id}.`,`${t._id}.\u9999`));await e.socket.delObject(t._id),await Promise.all(n.map(t=>e.socket.delObject(t))),e.calendarPrefix===t._id&&e.setCalendarPrefix(`fullcalendar.${e.instance}`),await e.updateCalendars()}catch(e){window.alert(`Cannot delete calendar: ${e}`)}e.onClose()}i(!1)}})]}):null},A5={column:{width:`100%`,display:`flex`,flexDirection:`column`,alignItems:`start`,height:`100%`},calendars:{height:`100%`},container:{display:`flex`,width:`100%`,flex:1},tooltip:{pointerEvents:`none`}},j5=e=>{let[t,n]=(0,B.useState)(window.localStorage.getItem(`fullcalendar.calendar`)||`fullcalendar.${e.instance}`),[r,i]=(0,B.useState)(null),[a,o]=(0,B.useState)([]),[s,c]=(0,B.useState)(window.localStorage.getItem(`fullcalendar.tab`)===`1`),[l,u]=(0,B.useState)(!1),[d,f]=(0,B.useState)(window.localStorage.getItem(`fullcalendar.splitSizes`)?JSON.parse(window.localStorage.getItem(`fullcalendar.splitSizes`)):[15,85]),p=async()=>{let r=await e.socket.getObjectViewSystem(`folder`,`fullcalendar.${e.instance}.Calendars.`,`fullcalendar.${e.instance}.Calendars.\u9999`);o(Object.values(r)),Object.keys(r).includes(t)||(window.localStorage.removeItem(`fullcalendar.calendar`),n(`fullcalendar.${e.instance}`))},m=async t=>{let n=JSON.parse(JSON.stringify(t));n.common.enabled=t.common.enabled===!1,await e.socket.setObject(n._id,n),await p()},h=()=>c(e=>(window.localStorage.setItem(`fullcalendar.tab`,e?`0`:`1`),!e));return(0,B.useEffect)(()=>{let t=(e,t)=>{let n=t&&t.val||!1;u(!!n)};return p().catch(e=>console.error(e)),e.socket.subscribeState(`system.adapter.fullcalendar.${e.instance}.alive`,t).catch(e=>console.error(e)),e.socket.getState(`system.adapter.fullcalendar.${e.instance}.alive`).then(e=>u(!!(e&&e.val))).catch(e=>console.error(e)),()=>{e.socket.unsubscribeState(`system.adapter.fullcalendar.${e.instance}.alive`,t)}},[]),(0,V.jsxs)(`div`,{style:A5.column,children:[s?(0,V.jsx)(D5,{systemConfig:e.systemConfig,socket:e.socket,theme:e.theme,instance:e.instance,updateCalendars:p,changeCalendarType:h,setCalendarPrefix:n,alive:l}):(0,V.jsx)(`div`,{style:A5.container,children:(0,V.jsxs)(dD,{direction:oD.Horizontal,initialSizes:d,minWidths:[195,500],onResizeFinished:(e,t)=>{f(t),window.localStorage.setItem(`fullcalendar.splitSizes`,JSON.stringify(t))},gutterTheme:e.themeType===`dark`?sD.Dark:sD.Light,gutterClassName:e.themeType===`dark`?`Dark visGutter`:`Light visGutter`,children:[(0,V.jsx)(`div`,{style:A5.calendars,children:(0,V.jsxs)(C5,{isSimulations:!1,onChangeMode:h,title:Y.t(`Calendars`),addTitle:Y.t(`Add new calendar`),alive:l,onAdd:async()=>{let t=`fullcalendar.${e.instance}.Calendars.Calendar-${sU()}`;await e.socket.setObject(t,{type:`folder`,common:{name:`NewCalendar`},native:{}}),await p(),n(t),window.localStorage.setItem(`fullcalendar.calendar`,t),setTimeout(()=>i(t),300)},children:[(0,V.jsx)(w5,{name:Y.t(`Default`),selected:!a.find(e=>e._id===t),onClick:()=>{let t=`fullcalendar.${e.instance}`;window.localStorage.setItem(`fullcalendar.calendar`,t),n(t)}}),a.map(e=>(0,V.jsx)(w5,{name:e.common.name,color:e.common.color,icon:e.common.icon,selected:e._id===t,inactive:e.common.enabled===!1,onClick:()=>{window.localStorage.setItem(`fullcalendar.calendar`,e._id),n(e._id)},status:e.common.enabled===!1?(0,V.jsx)(lb,{title:Y.t(`Calendar is inactive. Click to activate`),slotProps:{popper:{sx:A5.tooltip}},children:(0,V.jsx)(Pd,{size:`small`,onClick:t=>{t.stopPropagation(),m(e)},children:(0,V.jsx)(wx,{})})}):null,actions:(0,V.jsxs)(V.Fragment,{children:[e.common.enabled===!1?null:(0,V.jsx)(lb,{title:Y.t(`Deactivate calendar`),slotProps:{popper:{sx:A5.tooltip}},children:(0,V.jsx)(Pd,{size:`small`,onClick:t=>{t.stopPropagation(),m(e)},children:(0,V.jsx)(Cx,{})})}),(0,V.jsx)(lb,{title:Y.t(`Edit name or delete calendar`),slotProps:{popper:{sx:A5.tooltip}},children:(0,V.jsx)(Pd,{size:`small`,onClick:t=>{i(e._id),t.stopPropagation()},children:(0,V.jsx)(bx,{})})})]})},e._id))]})}),(0,V.jsx)(d5,{systemConfig:e.systemConfig,socket:e.socket,theme:e.theme,calendarPrefix:t},t)]})}),r?(0,V.jsx)(k5,{onClose:()=>i(null),calendarPrefix:t,setCalendarPrefix:n,calendar:a.find(e=>e._id===r),socket:e.socket,instance:e.instance,updateCalendars:p}):null]})},M5=class extends HS{constructor(e){let t={...e};t.translations={en:zE,de:BE,ru:VE,pt:HE,nl:UE,fr:WE,it:GE,es:KE,pl:qE,uk:JE,"zh-cn":YE},t.sentryDSN=window.sentryDSN,window.location.port,window.socketUrl&&window.socketUrl.startsWith(`:`)&&(window.socketUrl=`${window.location.protocol}//${window.location.hostname}${window.socketUrl}`),super(e,t)}render(){return this.state.loaded?(0,V.jsx)(Kt,{injectFirst:!0,children:(0,V.jsx)(qc,{theme:this.state.theme,children:(0,V.jsx)(`div`,{style:{overflow:`auto`,height:`100%`},id:`rootDiv`,children:(0,V.jsx)(j5,{systemConfig:this._systemConfig,socket:this.socket,theme:this.state.theme,instance:this.instance,alive:!!this.state.alive,themeType:this.state.themeType})})})}):(0,V.jsx)(Kt,{injectFirst:!0,children:(0,V.jsx)(qc,{theme:this.state.theme,children:(0,V.jsx)(pS,{themeType:this.state.themeType})})})}};window.location.hostname===`localhost`||window.location.hostname===`[::1]`||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/);function N5(){`serviceWorker`in navigator&&navigator.serviceWorker.ready.then(e=>{e.unregister()})}var P5={name:`fullcalendar-admin`,version:`3.4.0`,private:!0,dependencies:{"@emotion/react":`^11.14.0`,"@emotion/styled":`^11.14.1`,"@devbookhq/splitter":`^1.4.2`,"@fullcalendar/core":`^6.1.22`,"@fullcalendar/daygrid":`^6.1.22`,"@fullcalendar/interaction":`^6.1.22`,"@fullcalendar/list":`^6.1.22`,"@fullcalendar/react":`^6.1.22`,"@fullcalendar/rrule":`^6.1.22`,"@fullcalendar/timegrid":`^6.1.22`,"@iobroker/gui-components":`^10.3.14`,"@iobroker/type-detector":`^6.2.0`,"@material-icons/svg":`^1.0.33`,"@mui/icons-material":`^9.5.0`,"@mui/material":`^9.5.0`,"@mui/system":`^9.5.0`,"@mui/x-date-pickers":`^9.16.0`,"@sentry/browser":`^11.10.0`,"@vitejs/plugin-react":`^6.1.2`,dayjs:`^1.11.23`,moment:`^2.31.0`,react:`^19.3.1`,"react-ace":`^15.0.0`,"react-dnd":`^16.0.1`,"react-dnd-html5-backend":`^16.0.1`,"react-dnd-preview":`^9.0.0`,"react-dnd-touch-backend":`^16.0.1`,"react-dom":`^19.3.1`,"react-dropzone":`^20.1.4`,"react-icons":`^5.7.0`,rrule:`^2.8.1`,suncalc2:`^1.8.1`,vite:`^8.3.5`},scripts:{start:`vite --host`,build:`vite build`,lint:`eslint -c eslint.config.mjs`,"check-ts":`tsc --noEmit --checkJS false`,tsc:`tsc --project tsconfig.json`},eslintConfig:{extends:`react-app`},homepage:`.`,browserslist:[`>0.2%`,`not dead`,`not ie <= 11`,`not op_mini all`]},F5=e=>{let t=cl(e);return t&&(t.palette.text.danger={color:`#dd5325`},t.palette.text.success={color:`#73b6a8`},t)},I5=ES.getThemeName();window.adapterName=`fullcalendar`,console.log(`iobroker.${window.adapterName}@${P5.version} using theme "${I5}"`);function L5(e,t,n){let r=(e||``).split(` `).map(e=>e.trim()).filter(e=>e),i=r.indexOf(n);return i!==-1&&r.splice(i,1),!r.includes(t)&&r.push(t),r.join(` `)}var R5=()=>{let[e,t]=(0,B.useState)(I5),n=F5(e),r=()=>n,i=n.palette.mode;return(0,B.useEffect)(()=>{i===`dark`?window.document.body.className=L5(window.document.body.className,`body-dark`,`body-light`):window.document.body.className=L5(window.document.body.className,`body-light`,`body-dark`)},[i]),(0,V.jsx)(Kt,{injectFirst:!0,children:(0,V.jsx)(qc,{theme:r(),children:(0,V.jsx)(M5,{onThemeChange:e=>t(e)})})})};function z5(){let e=document.getElementById(`root`);(0,Jc.createRoot)(e).render((0,V.jsx)(R5,{}))}z5(),N5();
|
package/admin/tab_m.html
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
document.head.appendChild(script);
|
|
44
44
|
</script>
|
|
45
45
|
<!--script type="text/javascript" src="../../socket.io/socket.io.js"></script-->
|
|
46
|
-
<script type="module" crossorigin src="./assets/index-
|
|
46
|
+
<script type="module" crossorigin src="./assets/index-ALPvpEpk.js"></script>
|
|
47
47
|
<link rel="stylesheet" crossorigin href="./assets/index-gxlVzAAs.css">
|
|
48
48
|
</head>
|
|
49
49
|
<body>
|