iobroker.javascript 10.2.2 → 10.2.3
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 +1 -1
- package/admin/assets/{AiChatPanel-C5vTuhiL.js → AiChatPanel-DsQB1Hb5.js} +2 -2
- package/admin/assets/{Debugger-DnrhfguX.js → Debugger-CcDNCkmw.js} +1 -1
- package/admin/assets/{RulesEditor-u3ppR2Xl.js → RulesEditor-B6YQNZfq.js} +1 -1
- package/admin/assets/{ScriptEditor-COwzdxKl.js → ScriptEditor-BkuL2lZ1.js} +1 -1
- package/admin/assets/{ScriptEditorVanillaMonaco-C0biTTli.js → ScriptEditorVanillaMonaco-DYNr4-5w.js} +2 -2
- package/admin/assets/aiPromptBuilder-db3Z4xhV.js +1 -0
- package/admin/assets/{blocks_action-CycTOoDY.js → blocks_action-EYzXGRHi.js} +1 -1
- package/admin/assets/{blocks_convert-BUmTT450.js → blocks_convert-BewF036e.js} +1 -1
- package/admin/assets/{blocks_logic-BP_rkFPu.js → blocks_logic-BEcVdiZ4.js} +1 -1
- package/admin/assets/{blocks_number-DZPdNWcv.js → blocks_number-Cp7J-juL.js} +1 -1
- package/admin/assets/{blocks_object-CUKKvXdl.js → blocks_object-CCe0acSu.js} +1 -1
- package/admin/assets/{blocks_procedures-D3LiaeLD.js → blocks_procedures-BzFeWYcX.js} +1 -1
- package/admin/assets/{blocks_sendto-BWmeOFOr.js → blocks_sendto-EBwcaHpm.js} +1 -1
- package/admin/assets/{blocks_switch-B17LJ99U.js → blocks_switch-CjohzLLS.js} +1 -1
- package/admin/assets/{blocks_system-DdvuotD5.js → blocks_system-D9V3f3Vv.js} +1 -1
- package/admin/assets/{blocks_text-D35PPiiy.js → blocks_text-CnEbzx6V.js} +1 -1
- package/admin/assets/{blocks_time-CuI_GrE0.js → blocks_time-B5OcgKMo.js} +1 -1
- package/admin/assets/{blocks_timeout-tbB0KBqO.js → blocks_timeout-ONu3mIX3.js} +1 -1
- package/admin/assets/{blocks_trigger-Bw3qbQRd.js → blocks_trigger-3DujkROX.js} +1 -1
- package/admin/assets/{helpers-D5PdK4BS.js → helpers-BiP5KGR8.js} +1 -1
- package/admin/assets/{index-PLY-IJik.js → index-CRX4LAhD.js} +5 -5
- package/admin/assets/{mf-entry-bootstrap-0-f35ca6a1.js → mf-entry-bootstrap-0-4b82aeb4.js} +1 -1
- package/admin/mf-stats.json +1 -1
- package/admin/tab.html +2 -2
- package/io-package.json +14 -14
- package/package.json +1 -1
- package/admin/assets/aiPromptBuilder-4yeoONDF.js +0 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./vite-preload-helper-CaC3yEL3.js";import{$n as t,An as n,Bn as r,Bt as i,Cn as a,Dn as o,En as s,Ht as c,Lt as l,Qn as u,Un as d,Ut as f,Vt as p,Xt as m,Zt as h,_r as g,br as _,bt as v,fr as y,hr as b,kn as x,mn as S,p as C,pn as w,ut as T,vt as E,wr as D,xn as ee,yn as O,yr as k,yt as A,zt as j}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__113183188387379__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-D-gi6Mty.js";import{S as M,g as te,h as N,m as P,s as F}from"./index-PLY-IJik.js";import{a as I,c as L,d as R,f as z,h as B,i as V,l as H,m as U,n as W,o as G,p as K,r as ne,s as q,t as J,u as Y}from"./AiChatService-Bsp_rhVx.js";var X=r(u(`path`,{d:`M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m5 11h-4v4h-2v-4H7v-2h4V7h2v4h4z`}),`AddCircleOutlined`),re=r(u(`path`,{d:`M21.99 4c0-1.1-.89-2-1.99-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h14l4 4zM17 11h-4v4h-2v-4H7V9h4V5h2v4h4z`}),`AddComment`),ie=r(u(`path`,{d:`M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10h5v-2h-5c-4.34 0-8-3.66-8-8s3.66-8 8-8 8 3.66 8 8v1.43c0 .79-.71 1.57-1.5 1.57s-1.5-.78-1.5-1.57V12c0-2.76-2.24-5-5-5s-5 2.24-5 5 2.24 5 5 5c1.38 0 2.64-.56 3.54-1.47.65.89 1.77 1.47 2.96 1.47 1.97 0 3.5-1.6 3.5-3.57V12c0-5.52-4.48-10-10-10m0 13c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3`}),`AlternateEmail`),ae=r(u(`path`,{d:`M9.01 14H2v2h7.01v3L13 15l-3.99-4zm5.98-1v-3H22V8h-7.01V5L11 9z`}),`CompareArrows`),oe=r(u(`path`,{d:`M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4m0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4`}),`Person`),se=r(u(`path`,{d:`M3 10h11v2H3zm0-4h11v2H3zm0 8h7v2H3zm17.59-2.07-4.25 4.24-2.12-2.12-1.41 1.41L16.34 19 22 13.34z`}),`PlaylistAddCheck`),ce=r(u(`path`,{d:`M20 9V7c0-1.1-.9-2-2-2h-3c0-1.66-1.34-3-3-3S9 3.34 9 5H6c-1.1 0-2 .9-2 2v2c-1.66 0-3 1.34-3 3s1.34 3 3 3v4c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-4c1.66 0 3-1.34 3-3s-1.34-3-3-3M7.5 11.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5S9.83 13 9 13s-1.5-.67-1.5-1.5M16 17H8v-2h8zm-1-4c-.83 0-1.5-.67-1.5-1.5S14.17 10 15 10s1.5.67 1.5 1.5S15.83 13 15 13`}),`SmartToy`);D();var le=[{type:`function`,function:{name:`search_datapoints`,description:`Search ALL ioBroker objects by ID, name, or role — includes states, channels, devices, folders, enums (rooms/functions), adapters, instances, scripts, meta, etc. Returns matching IDs with object type, name, role, unit, and a hasChildren hint for containers. IMPORTANT: Aliases and physical device groupings are usually CHANNELS containing multiple state children (e.g. a motion sensor is often a channel alias.0.Floor.Room.MotionSensor with states ACTUAL, BATTERY, STATE under it). If a channel/device/folder matches your query, call get_object_info on its ID to list its state children. Role-based queries work too: "sensor.motion", "switch.light", "value.temperature".`,parameters:{type:`object`,properties:{query:{type:`string`,description:`Search pattern (case-insensitive substring) - matches against object ID, name, and role. Examples: "bewegungsmelder", "temperature", "sensor.motion", "alias.0", "küche", "zigbee2mqtt.0.lamp".`},max_results:{type:`number`,description:`Maximum number of results to return (default: 20).`},object_type:{type:`string`,description:`Optional filter by object type: "state", "channel", "device", "folder", "enum", "adapter", "instance", "script", "meta", etc. Omit to search every type.`}},required:[`query`]}}},{type:`function`,function:{name:`get_state_value`,description:`Get the current value of an ioBroker state/datapoint. Returns value, timestamp, and acknowledgment flag.`,parameters:{type:`object`,properties:{id:{type:`string`,description:`The full state ID, e.g. "zigbee2mqtt.0.sensor.temperature"`}},required:[`id`]}}},{type:`function`,function:{name:`get_object_info`,description:`Get detailed info about ANY ioBroker object + its full parent hierarchy + direct children. Works for every object type: state, channel, device, folder, adapter, instance, enum, meta, script. Returns: the object itself, parent chain (all non-state ancestors up to the adapter), and — if the object is a container (channel/device/folder/enum/instance/adapter/meta) — the list of direct children with their types, names, roles and units. Use this to navigate the object tree: start from a channel found by search_datapoints, read its children to see the actual state IDs underneath.`,parameters:{type:`object`,properties:{id:{type:`string`,description:`The full object ID, e.g. "zigbee2mqtt.0.0x1234.state", "alias.0.Room.MotionSensor", or "enum.rooms.kitchen".`}},required:[`id`]}}},{type:`function`,function:{name:`search_scripts`,description:`Search through all ioBroker JavaScript/Blockly/Rules scripts. Can search by script name/path OR by content (e.g. find all scripts that use a specific datapoint ID). Returns matching script names, paths, and matching lines.`,parameters:{type:`object`,properties:{query:{type:`string`,description:`Search term - matches against script name, path, AND source code content. Examples: "carport", "zigbee2mqtt.0.lamp.state", "telegram"`},max_results:{type:`number`,description:`Maximum number of scripts to return (default: 10)`}},required:[`query`]}}},{type:`function`,function:{name:`read_script`,description:`Read the full source code of a specific ioBroker script by its ID or path. Use search_scripts first to find the script ID, then read_script to see its complete code.`,parameters:{type:`object`,properties:{id:{type:`string`,description:`The script ID (e.g. "script.js.common.Licht.Carport") or path (e.g. "common/Licht/Carport")`}},required:[`id`]}}},{type:`function`,function:{name:`list_scripts`,description:`List ALL available ioBroker scripts with their names, paths, types (JavaScript/Blockly/TypeScript), and enabled status. Use this to get an overview of all scripts before searching or reading specific ones.`,parameters:{type:`object`,properties:{}}}},{type:`function`,function:{name:`run_script`,description:"Execute a JavaScript or TypeScript snippet in the live ioBroker javascript engine and get back everything it logged. The code runs with the full script API (log, console.*, setState, getState, on, schedule, $, exec, httpGet, …) in VERBOSE mode, so internal operations (setState/getState/subscribe/…) are logged too — ideal for diagnosing behaviour or inspecting values. The snippet runs for a short window and is then automatically STOPPED and fully cleaned up (timers, subscriptions, schedules removed); it does NOT create a persistent script. Use `log(...)` or `console.log(...)` in the code to surface the values you want to inspect. WARNING: side effects are real (e.g. setState changes actual devices) — prefer read-only diagnostics unless the user explicitly asked to change something.",parameters:{type:`object`,properties:{source:{type:`string`,description:`The JavaScript (or TypeScript) source to execute. Log the values you want to inspect via log(...) / console.log(...). Top-level await is supported.`},engineType:{type:`string`,description:`Optional. "TypeScript/ts" to run the code as TypeScript. Defaults to JavaScript.`},timeout:{type:`number`,description:`Optional. Milliseconds to keep the script alive to collect asynchronous logs before it is stopped (default 5000, max 60000). Increase when waiting for timers, subscriptions or HTTP responses.`},logLevel:{type:`string`,description:`Optional minimum severity to return: silly, debug, info, warn, error. Default silly (everything).`}},required:[`source`]}}},{type:`function`,function:{name:`get_editor_selection`,description:`Read what the user has currently selected in the script editor. Returns the selected text and its line/column range, or a message if nothing is selected. Use this when the user refers to "this", "das hier", "the selection", or asks about a specific piece of code they highlighted.`,parameters:{type:`object`,properties:{}}}},{type:`function`,function:{name:`get_editor_content`,description:`Read the full current content of the script editor (may differ from the initial script version if the user has made edits). Use this when you need the live editor state rather than the saved script.`,parameters:{type:`object`,properties:{}}}},{type:`function`,function:{name:`get_cursor_position`,description:`Read the current cursor position (line and column, 1-based) in the script editor.`,parameters:{type:`object`,properties:{}}}},{type:`function`,function:{name:`highlight_text_in_editor`,description:`Search for a literal text in the script editor and select + scroll to it. Returns how many occurrences were found. Use this to draw the user's attention to a specific snippet you are discussing.`,parameters:{type:`object`,properties:{text:{type:`string`,description:`Exact substring to search for (case-sensitive).`}},required:[`text`]}}},{type:`function`,function:{name:`highlight_line_range`,description:`Select and scroll to a range of lines in the editor. Both line numbers are 1-based and inclusive. Use this to show the user which block of code you are referring to.`,parameters:{type:`object`,properties:{start_line:{type:`number`,description:`First line (1-based, inclusive).`},end_line:{type:`number`,description:`Last line (1-based, inclusive).`}},required:[`start_line`,`end_line`]}}},{type:`function`,function:{name:`go_to_line`,description:`Move the cursor to a specific line (and optional column) and scroll that line into view. Use this to navigate the user to a relevant spot.`,parameters:{type:`object`,properties:{line:{type:`number`,description:`1-based line number.`},column:{type:`number`,description:`1-based column (optional, default 1).`}},required:[`line`]}}},{type:`function`,function:{name:`insert_text_at_cursor`,description:`Insert text at the current cursor position in the editor (or replace the current selection if one exists). Use sparingly — prefer returning code in a fenced markdown block so the user can review and smart-apply it. Only use direct insertion when the user explicitly asked you to write something into the editor.`,parameters:{type:`object`,properties:{text:{type:`string`,description:`Text to insert.`}},required:[`text`]}}},{type:`function`,function:{name:`replace_selection`,description:`Replace the currently selected text in the editor with new text. Fails if nothing is selected. Use this to refactor or rewrite a specific highlighted snippet.`,parameters:{type:`object`,properties:{text:{type:`string`,description:`Replacement text.`}},required:[`text`]}}},{type:`function`,function:{name:`get_diagnostics`,description:`Read all active Monaco diagnostics (errors, warnings, info, hints) from the current editor model — this is what shows up as red/yellow squiggles. Use this to find syntax errors, unused variables, missing types, or other editor-reported issues the user might be asking about.`,parameters:{type:`object`,properties:{}}}},{type:`function`,function:{name:`get_document_symbols`,description:`Get the document outline of the current script: all top-level functions, classes, constants, and variables with their line numbers. Use this to understand the structure of a long script or to find where a specific function is defined.`,parameters:{type:`object`,properties:{}}}}];function Z(e){return e&&typeof e==`object`?e.en||e.de||``:e||``}function ue(e,t,n){let r=(n||``).toLowerCase();if(!r)return!1;if(e.toLowerCase().includes(r))return!0;let i=t==null?void 0:t.common;if(!i)return!1;let a=Z(i.name).toLowerCase();if(a&&a.includes(r))return!0;let o=(i.role||``).toLowerCase();return!!(o&&o.includes(r))}async function de(e,t,n=20,r){let i=await I(e),a=r==null?void 0:r.toLowerCase(),o=[],s=Object.keys(i),c=new Set;for(let e of s){let t=e.lastIndexOf(`.`);t>0&&c.add(e.substring(0,t))}for(let e of s){let r=i[e],s=r==null?void 0:r.type;if(!s||a&&s!==a||!ue(e,r,t))continue;let l=r.common,u={id:e,type:s,name:Z(l==null?void 0:l.name)};if(l!=null&&l.role&&(u.role=l.role),s===`state`?(u.stateType=(l==null?void 0:l.type)||``,l!=null&&l.unit&&(u.unit=l.unit)):c.has(e)&&(u.hasChildren=!0),o.push(u),o.length>=n)break}return o.length===0?JSON.stringify({message:`No objects found matching "${t}". Hint: try a role like "sensor.motion" or a partial path.`}):JSON.stringify(o)}async function fe(e,t){try{let n=await e.getState(t);return JSON.stringify(n?{val:n.val,ts:n.ts?new Date(n.ts).toISOString():null,ack:n.ack,from:n.from}:{error:`State '${t}' not found`})}catch{return JSON.stringify({error:`Failed to read state '${t}'`})}}var pe=new Set([`channel`,`device`,`folder`,`adapter`,`instance`,`enum`,`meta`]),me=50;async function he(e,t){try{let r=await e.getObject(t);if(!r)return JSON.stringify({error:`Object '${t}' not found`});let i={id:r._id,type:r.type,common:r.common},a=t.split(`.`),o=[];for(let t=a.length-1;t>=2;t--){let r=a.slice(0,t).join(`.`);try{let t=await e.getObject(r);if(t&&t.type!==`state`){var n;o.push({id:t._id,type:t.type,name:Z((n=t.common)==null?void 0:n.name),common:t.common})}}catch{}}if(o.length>0&&(i.parents=o),pe.has(r.type)){let n=await I(e),r=[],a=`${t}.`,o=!1;for(let e of Object.keys(n))if(e.startsWith(a)&&!e.substring(a.length).includes(`.`)){let t=n[e],i=t==null?void 0:t.common,a={id:e,name:Z(i==null?void 0:i.name),type:(t==null?void 0:t.type)||``};if(i!=null&&i.role&&(a.role=i.role),(t==null?void 0:t.type)===`state`&&i!=null&&i.unit&&(a.unit=i.unit),r.push(a),r.length>=me){o=!0;break}}r.length>0&&(i.children=r,o&&(i.childrenTruncated=!0,i.childrenHint=`Only the first ${me} children are shown. Use search_datapoints with a more specific query or the object_type filter to narrow down.`))}return JSON.stringify(i)}catch{return JSON.stringify({error:`Failed to read object '${t}'`})}}function ge(e){return N(e)||e}function _e(e,t,n=10){let r=t.toLowerCase(),i=[];for(let t of e){let e=t.id.toLowerCase(),a=t.name.toLowerCase(),o=t.id.replace(/^script\.js\./,``).replace(/\./g,`/`),s=t.engineType===`Blockly`||t.engineType===`Rules`,c=e.includes(r)||a.includes(r),l=s?ge(t.source):t.source,u=l.toLowerCase().includes(r);if(c||u){let e={id:t.id,path:o,name:t.name,type:s?`Blockly`:t.engineType.includes(`TypeScript`)?`TypeScript`:`JavaScript`,enabled:t.enabled};if(u){let t=l.split(`
|
|
1
|
+
import{t as e}from"./vite-preload-helper-CaC3yEL3.js";import{$n as t,An as n,Bn as r,Bt as i,Cn as a,Dn as o,En as s,Ht as c,Lt as l,Qn as u,Un as d,Ut as f,Vt as p,Xt as m,Zt as h,_r as g,br as _,bt as v,fr as y,hr as b,kn as x,mn as S,p as C,pn as w,ut as T,vt as E,wr as D,xn as ee,yn as O,yr as k,yt as A,zt as j}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__113183188387379__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-D-gi6Mty.js";import{S as M,g as te,h as N,m as P,s as F}from"./index-CRX4LAhD.js";import{a as I,c as L,d as R,f as z,h as B,i as V,l as H,m as U,n as W,o as G,p as K,r as ne,s as q,t as J,u as Y}from"./AiChatService-Bsp_rhVx.js";var X=r(u(`path`,{d:`M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m5 11h-4v4h-2v-4H7v-2h4V7h2v4h4z`}),`AddCircleOutlined`),re=r(u(`path`,{d:`M21.99 4c0-1.1-.89-2-1.99-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h14l4 4zM17 11h-4v4h-2v-4H7V9h4V5h2v4h4z`}),`AddComment`),ie=r(u(`path`,{d:`M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10h5v-2h-5c-4.34 0-8-3.66-8-8s3.66-8 8-8 8 3.66 8 8v1.43c0 .79-.71 1.57-1.5 1.57s-1.5-.78-1.5-1.57V12c0-2.76-2.24-5-5-5s-5 2.24-5 5 2.24 5 5 5c1.38 0 2.64-.56 3.54-1.47.65.89 1.77 1.47 2.96 1.47 1.97 0 3.5-1.6 3.5-3.57V12c0-5.52-4.48-10-10-10m0 13c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3`}),`AlternateEmail`),ae=r(u(`path`,{d:`M9.01 14H2v2h7.01v3L13 15l-3.99-4zm5.98-1v-3H22V8h-7.01V5L11 9z`}),`CompareArrows`),oe=r(u(`path`,{d:`M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4m0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4`}),`Person`),se=r(u(`path`,{d:`M3 10h11v2H3zm0-4h11v2H3zm0 8h7v2H3zm17.59-2.07-4.25 4.24-2.12-2.12-1.41 1.41L16.34 19 22 13.34z`}),`PlaylistAddCheck`),ce=r(u(`path`,{d:`M20 9V7c0-1.1-.9-2-2-2h-3c0-1.66-1.34-3-3-3S9 3.34 9 5H6c-1.1 0-2 .9-2 2v2c-1.66 0-3 1.34-3 3s1.34 3 3 3v4c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-4c1.66 0 3-1.34 3-3s-1.34-3-3-3M7.5 11.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5S9.83 13 9 13s-1.5-.67-1.5-1.5M16 17H8v-2h8zm-1-4c-.83 0-1.5-.67-1.5-1.5S14.17 10 15 10s1.5.67 1.5 1.5S15.83 13 15 13`}),`SmartToy`);D();var le=[{type:`function`,function:{name:`search_datapoints`,description:`Search ALL ioBroker objects by ID, name, or role — includes states, channels, devices, folders, enums (rooms/functions), adapters, instances, scripts, meta, etc. Returns matching IDs with object type, name, role, unit, and a hasChildren hint for containers. IMPORTANT: Aliases and physical device groupings are usually CHANNELS containing multiple state children (e.g. a motion sensor is often a channel alias.0.Floor.Room.MotionSensor with states ACTUAL, BATTERY, STATE under it). If a channel/device/folder matches your query, call get_object_info on its ID to list its state children. Role-based queries work too: "sensor.motion", "switch.light", "value.temperature".`,parameters:{type:`object`,properties:{query:{type:`string`,description:`Search pattern (case-insensitive substring) - matches against object ID, name, and role. Examples: "bewegungsmelder", "temperature", "sensor.motion", "alias.0", "küche", "zigbee2mqtt.0.lamp".`},max_results:{type:`number`,description:`Maximum number of results to return (default: 20).`},object_type:{type:`string`,description:`Optional filter by object type: "state", "channel", "device", "folder", "enum", "adapter", "instance", "script", "meta", etc. Omit to search every type.`}},required:[`query`]}}},{type:`function`,function:{name:`get_state_value`,description:`Get the current value of an ioBroker state/datapoint. Returns value, timestamp, and acknowledgment flag.`,parameters:{type:`object`,properties:{id:{type:`string`,description:`The full state ID, e.g. "zigbee2mqtt.0.sensor.temperature"`}},required:[`id`]}}},{type:`function`,function:{name:`get_object_info`,description:`Get detailed info about ANY ioBroker object + its full parent hierarchy + direct children. Works for every object type: state, channel, device, folder, adapter, instance, enum, meta, script. Returns: the object itself, parent chain (all non-state ancestors up to the adapter), and — if the object is a container (channel/device/folder/enum/instance/adapter/meta) — the list of direct children with their types, names, roles and units. Use this to navigate the object tree: start from a channel found by search_datapoints, read its children to see the actual state IDs underneath.`,parameters:{type:`object`,properties:{id:{type:`string`,description:`The full object ID, e.g. "zigbee2mqtt.0.0x1234.state", "alias.0.Room.MotionSensor", or "enum.rooms.kitchen".`}},required:[`id`]}}},{type:`function`,function:{name:`search_scripts`,description:`Search through all ioBroker JavaScript/Blockly/Rules scripts. Can search by script name/path OR by content (e.g. find all scripts that use a specific datapoint ID). Returns matching script names, paths, and matching lines.`,parameters:{type:`object`,properties:{query:{type:`string`,description:`Search term - matches against script name, path, AND source code content. Examples: "carport", "zigbee2mqtt.0.lamp.state", "telegram"`},max_results:{type:`number`,description:`Maximum number of scripts to return (default: 10)`}},required:[`query`]}}},{type:`function`,function:{name:`read_script`,description:`Read the full source code of a specific ioBroker script by its ID or path. Use search_scripts first to find the script ID, then read_script to see its complete code.`,parameters:{type:`object`,properties:{id:{type:`string`,description:`The script ID (e.g. "script.js.common.Licht.Carport") or path (e.g. "common/Licht/Carport")`}},required:[`id`]}}},{type:`function`,function:{name:`list_scripts`,description:`List ALL available ioBroker scripts with their names, paths, types (JavaScript/Blockly/TypeScript), and enabled status. Use this to get an overview of all scripts before searching or reading specific ones.`,parameters:{type:`object`,properties:{}}}},{type:`function`,function:{name:`run_script`,description:"Execute a JavaScript or TypeScript snippet in the live ioBroker javascript engine and get back everything it logged. The code runs with the full script API (log, console.*, setState, getState, on, schedule, $, exec, httpGet, …) in VERBOSE mode, so internal operations (setState/getState/subscribe/…) are logged too — ideal for diagnosing behaviour or inspecting values. The snippet runs for a short window and is then automatically STOPPED and fully cleaned up (timers, subscriptions, schedules removed); it does NOT create a persistent script. Use `log(...)` or `console.log(...)` in the code to surface the values you want to inspect. WARNING: side effects are real (e.g. setState changes actual devices) — prefer read-only diagnostics unless the user explicitly asked to change something.",parameters:{type:`object`,properties:{source:{type:`string`,description:`The JavaScript (or TypeScript) source to execute. Log the values you want to inspect via log(...) / console.log(...). Top-level await is supported.`},engineType:{type:`string`,description:`Optional. "TypeScript/ts" to run the code as TypeScript. Defaults to JavaScript.`},timeout:{type:`number`,description:`Optional. Milliseconds to keep the script alive to collect asynchronous logs before it is stopped (default 5000, max 60000). Increase when waiting for timers, subscriptions or HTTP responses.`},logLevel:{type:`string`,description:`Optional minimum severity to return: silly, debug, info, warn, error. Default silly (everything).`}},required:[`source`]}}},{type:`function`,function:{name:`get_editor_selection`,description:`Read what the user has currently selected in the script editor. Returns the selected text and its line/column range, or a message if nothing is selected. Use this when the user refers to "this", "das hier", "the selection", or asks about a specific piece of code they highlighted.`,parameters:{type:`object`,properties:{}}}},{type:`function`,function:{name:`get_editor_content`,description:`Read the full current content of the script editor (may differ from the initial script version if the user has made edits). Use this when you need the live editor state rather than the saved script.`,parameters:{type:`object`,properties:{}}}},{type:`function`,function:{name:`get_cursor_position`,description:`Read the current cursor position (line and column, 1-based) in the script editor.`,parameters:{type:`object`,properties:{}}}},{type:`function`,function:{name:`highlight_text_in_editor`,description:`Search for a literal text in the script editor and select + scroll to it. Returns how many occurrences were found. Use this to draw the user's attention to a specific snippet you are discussing.`,parameters:{type:`object`,properties:{text:{type:`string`,description:`Exact substring to search for (case-sensitive).`}},required:[`text`]}}},{type:`function`,function:{name:`highlight_line_range`,description:`Select and scroll to a range of lines in the editor. Both line numbers are 1-based and inclusive. Use this to show the user which block of code you are referring to.`,parameters:{type:`object`,properties:{start_line:{type:`number`,description:`First line (1-based, inclusive).`},end_line:{type:`number`,description:`Last line (1-based, inclusive).`}},required:[`start_line`,`end_line`]}}},{type:`function`,function:{name:`go_to_line`,description:`Move the cursor to a specific line (and optional column) and scroll that line into view. Use this to navigate the user to a relevant spot.`,parameters:{type:`object`,properties:{line:{type:`number`,description:`1-based line number.`},column:{type:`number`,description:`1-based column (optional, default 1).`}},required:[`line`]}}},{type:`function`,function:{name:`insert_text_at_cursor`,description:`Insert text at the current cursor position in the editor (or replace the current selection if one exists). Use sparingly — prefer returning code in a fenced markdown block so the user can review and smart-apply it. Only use direct insertion when the user explicitly asked you to write something into the editor.`,parameters:{type:`object`,properties:{text:{type:`string`,description:`Text to insert.`}},required:[`text`]}}},{type:`function`,function:{name:`replace_selection`,description:`Replace the currently selected text in the editor with new text. Fails if nothing is selected. Use this to refactor or rewrite a specific highlighted snippet.`,parameters:{type:`object`,properties:{text:{type:`string`,description:`Replacement text.`}},required:[`text`]}}},{type:`function`,function:{name:`get_diagnostics`,description:`Read all active Monaco diagnostics (errors, warnings, info, hints) from the current editor model — this is what shows up as red/yellow squiggles. Use this to find syntax errors, unused variables, missing types, or other editor-reported issues the user might be asking about.`,parameters:{type:`object`,properties:{}}}},{type:`function`,function:{name:`get_document_symbols`,description:`Get the document outline of the current script: all top-level functions, classes, constants, and variables with their line numbers. Use this to understand the structure of a long script or to find where a specific function is defined.`,parameters:{type:`object`,properties:{}}}}];function Z(e){return e&&typeof e==`object`?e.en||e.de||``:e||``}function ue(e,t,n){let r=(n||``).toLowerCase();if(!r)return!1;if(e.toLowerCase().includes(r))return!0;let i=t==null?void 0:t.common;if(!i)return!1;let a=Z(i.name).toLowerCase();if(a&&a.includes(r))return!0;let o=(i.role||``).toLowerCase();return!!(o&&o.includes(r))}async function de(e,t,n=20,r){let i=await I(e),a=r==null?void 0:r.toLowerCase(),o=[],s=Object.keys(i),c=new Set;for(let e of s){let t=e.lastIndexOf(`.`);t>0&&c.add(e.substring(0,t))}for(let e of s){let r=i[e],s=r==null?void 0:r.type;if(!s||a&&s!==a||!ue(e,r,t))continue;let l=r.common,u={id:e,type:s,name:Z(l==null?void 0:l.name)};if(l!=null&&l.role&&(u.role=l.role),s===`state`?(u.stateType=(l==null?void 0:l.type)||``,l!=null&&l.unit&&(u.unit=l.unit)):c.has(e)&&(u.hasChildren=!0),o.push(u),o.length>=n)break}return o.length===0?JSON.stringify({message:`No objects found matching "${t}". Hint: try a role like "sensor.motion" or a partial path.`}):JSON.stringify(o)}async function fe(e,t){try{let n=await e.getState(t);return JSON.stringify(n?{val:n.val,ts:n.ts?new Date(n.ts).toISOString():null,ack:n.ack,from:n.from}:{error:`State '${t}' not found`})}catch{return JSON.stringify({error:`Failed to read state '${t}'`})}}var pe=new Set([`channel`,`device`,`folder`,`adapter`,`instance`,`enum`,`meta`]),me=50;async function he(e,t){try{let r=await e.getObject(t);if(!r)return JSON.stringify({error:`Object '${t}' not found`});let i={id:r._id,type:r.type,common:r.common},a=t.split(`.`),o=[];for(let t=a.length-1;t>=2;t--){let r=a.slice(0,t).join(`.`);try{let t=await e.getObject(r);if(t&&t.type!==`state`){var n;o.push({id:t._id,type:t.type,name:Z((n=t.common)==null?void 0:n.name),common:t.common})}}catch{}}if(o.length>0&&(i.parents=o),pe.has(r.type)){let n=await I(e),r=[],a=`${t}.`,o=!1;for(let e of Object.keys(n))if(e.startsWith(a)&&!e.substring(a.length).includes(`.`)){let t=n[e],i=t==null?void 0:t.common,a={id:e,name:Z(i==null?void 0:i.name),type:(t==null?void 0:t.type)||``};if(i!=null&&i.role&&(a.role=i.role),(t==null?void 0:t.type)===`state`&&i!=null&&i.unit&&(a.unit=i.unit),r.push(a),r.length>=me){o=!0;break}}r.length>0&&(i.children=r,o&&(i.childrenTruncated=!0,i.childrenHint=`Only the first ${me} children are shown. Use search_datapoints with a more specific query or the object_type filter to narrow down.`))}return JSON.stringify(i)}catch{return JSON.stringify({error:`Failed to read object '${t}'`})}}function ge(e){return N(e)||e}function _e(e,t,n=10){let r=t.toLowerCase(),i=[];for(let t of e){let e=t.id.toLowerCase(),a=t.name.toLowerCase(),o=t.id.replace(/^script\.js\./,``).replace(/\./g,`/`),s=t.engineType===`Blockly`||t.engineType===`Rules`,c=e.includes(r)||a.includes(r),l=s?ge(t.source):t.source,u=l.toLowerCase().includes(r);if(c||u){let e={id:t.id,path:o,name:t.name,type:s?`Blockly`:t.engineType.includes(`TypeScript`)?`TypeScript`:`JavaScript`,enabled:t.enabled};if(u){let t=l.split(`
|
|
2
2
|
`),n=[];for(let e=0;e<t.length&&!(t[e].toLowerCase().includes(r)&&(n.push({line:e+1,text:t[e].trim()}),n.length>=5));e++);n.length>0&&(e.matchingLines=n)}if(i.push(e),i.length>=n)break}}return i.length===0?JSON.stringify({message:`No scripts found matching "${t}"`}):JSON.stringify(i)}function ve(e,t){let n=t.replace(/\//g,`.`).toLowerCase(),r=e.find(e=>{let t=e.id.toLowerCase();return t===n||t===`script.js.${n}`||t.endsWith(`.${n}`)});if(!r)return JSON.stringify({error:`Script '${t}' not found. Use search_scripts to find available scripts.`});let i=r.engineType===`Blockly`||r.engineType===`Rules`,a=i?ge(r.source):r.source,o=r.id.replace(/^script\.js\./,``).replace(/\./g,`/`);return JSON.stringify({id:r.id,path:o,name:r.name,type:i?`Blockly`:r.engineType.includes(`TypeScript`)?`TypeScript`:`JavaScript`,enabled:r.enabled,source:a})}function ye(e){let t=e.map(e=>({id:e.id,path:e.id.replace(/^script\.js\./,``).replace(/\./g,`/`),name:e.name,type:e.engineType===`Blockly`||e.engineType===`Rules`?`Blockly`:e.engineType.includes(`TypeScript`)?`TypeScript`:`JavaScript`,enabled:e.enabled}));return JSON.stringify(t)}function Q(){return JSON.stringify({error:`Editor is not available. This tool requires the script editor to be open.`})}async function be(e,t,n){if(!t)return JSON.stringify({error:`No running javascript instance found to execute the script.`});let r=n.source;if(!r||typeof r!=`string`)return JSON.stringify({error:`No source code provided.`});try{var i;let a=await e.sendTo(t,`execute`,{source:r,engineType:n.engineType,timeout:n.timeout,logLevel:n.logLevel});return!a||a.ok===!1?JSON.stringify({error:(a==null?void 0:a.error)||`Execution failed`,logs:(a==null?void 0:a.logs)||[]}):JSON.stringify({engineType:a.engineType,runtime:a.runtime,truncated:a.truncated||!1,logCount:((i=a.logs)==null?void 0:i.length)||0,logs:a.logs||[],output:a.output||``})}catch(e){return JSON.stringify({error:`Failed to execute script: ${e instanceof Error?e.message:String(e)}`})}}async function xe(e,t,n,r,i){let a;try{a=JSON.parse(t.function.arguments)}catch{return JSON.stringify({error:`Invalid arguments: ${t.function.arguments}`})}switch(t.function.name){case`search_datapoints`:return de(e,a.query,a.max_results||20,a.object_type);case`get_state_value`:return fe(e,a.id);case`get_object_info`:return he(e,a.id);case`search_scripts`:return _e(n||[],a.query,a.max_results||10);case`read_script`:return ve(n||[],a.id);case`list_scripts`:return ye(n||[]);case`run_script`:return be(e,i,a);case`get_editor_selection`:{if(!(r!=null&&r.getSelection))return Q();let e=r.getSelection();return JSON.stringify(e||{message:`No text is currently selected in the editor.`})}case`get_editor_content`:return r!=null&&r.getContent?JSON.stringify({content:r.getContent()}):Q();case`get_cursor_position`:{if(!(r!=null&&r.getCursorPosition))return Q();let e=r.getCursorPosition();return JSON.stringify(e||{message:`Editor has no cursor position (not focused).`})}case`highlight_text_in_editor`:{if(!(r!=null&&r.highlightText))return Q();let e=r.highlightText(a.text);return JSON.stringify({matches:e,message:e===0?`Text "${a.text}" was not found in the editor.`:`Highlighted ${e} occurrence(s) of "${a.text}".`})}case`highlight_line_range`:{if(!(r!=null&&r.highlightLineRange))return Q();let e=r.highlightLineRange(a.start_line,a.end_line);return JSON.stringify({success:e,message:e?`Selected lines ${a.start_line}-${a.end_line}.`:`Could not select the requested line range.`})}case`go_to_line`:{if(!(r!=null&&r.goToLine))return Q();let e=r.goToLine(a.line,a.column);return JSON.stringify({success:e,message:e?`Cursor moved to line ${a.line}.`:`Could not move the cursor.`})}case`insert_text_at_cursor`:{if(!(r!=null&&r.insertTextAtCursor))return Q();let e=r.insertTextAtCursor(a.text);return JSON.stringify({success:e,message:e?`Text inserted at cursor.`:`Editor rejected the insertion.`})}case`replace_selection`:{if(!(r!=null&&r.replaceSelection))return Q();let e=r.replaceSelection(a.text);return JSON.stringify({success:e,message:e?`Selection replaced.`:`No text was selected to replace.`})}case`get_diagnostics`:{if(!(r!=null&&r.getDiagnostics))return Q();let e=r.getDiagnostics();return JSON.stringify({count:e.length,diagnostics:e})}case`get_document_symbols`:{if(!(r!=null&&r.getSymbols))return Q();let e=await r.getSymbols();return JSON.stringify({count:e.length,symbols:e})}default:return JSON.stringify({error:`Unknown tool: ${t.function.name}`})}}var Se=0;function Ce(){return`msg_${Date.now()}_${++Se}`}function we(t){let{socket:n,runningInstances:r,currentCode:i,currentLanguage:a,allScripts:o,editorApi:s,currentScriptId:c}=t,l=y((e,t,n)=>e===`none`||!n?null:{range:t,scriptId:c||``,scriptVersion:(i||``).length,kind:e,originalText:n},[c,i]),[u,d]=_(()=>{try{let e=window.localStorage.getItem(`Editor.aiChatMessages`);return e?JSON.parse(e):[]}catch{return[]}}),f=y(e=>{d(t=>{let n=typeof e==`function`?e(t):e,r=n.length>100?n.slice(-100):n;try{window.localStorage.setItem(`Editor.aiChatMessages`,JSON.stringify(r))}catch{try{let e=r.slice(-20);window.localStorage.setItem(`Editor.aiChatMessages`,JSON.stringify(e))}catch{}}return r})},[]),[p,m]=_(!1),[h,g]=_(null),[v,x]=_(window.localStorage.getItem(`Editor.aiChatMode`)||`agent`),S=y(e=>{x(e),window.localStorage.setItem(`Editor.aiChatMode`,e)},[]),[w,T]=_(null),[E,D]=_(window.localStorage.getItem(`openai-model`)||``),[ee,O]=_([]),[A,j]=_({}),[M,N]=_(!0),[F,I]=_(null),W=k(null),J=k(null),X=k(null),re=k(null),ie=y(e=>{D(e),K(e,A[e])},[A]),ae=y(async()=>{N(!0),I(null);try{let e=await R(n,r);if(O(e.models),j(e.providerMap),e.models.length>0){let t=z().model,n=t&&e.models.includes(t)?t:e.models[0];D(n),K(n,e.providerMap[n])}e.errors.length>0&&I(e.errors.join(`; `))}catch(e){I(String(e))}N(!1)},[n,r]);b(()=>{ae()},[ae]);let oe=y(e=>{let t=!1,n=!1,r=[],i=!1,a=/@([\w/äöüÄÖÜß-]+)/g,s;for(;(s=a.exec(e))!==null;){let e=s[1].toLowerCase();if(e===`alle`||e===`all`)t=!0;else if(e===`geräte`||e===`devices`||e===`geraete`)n=!0;else if(i=!0,o&&o.length>0){let e=s[1].replace(/\//g,`.`).toLowerCase(),t=e.split(`.`),n=o.find(n=>{let r=n.id.toLowerCase(),i=r.replace(/^script\.js\./,``);if(i===e||i.endsWith(`.${e}`)||r===`script.js.${e}`)return!0;let a=0;for(let e of t){let t=i.indexOf(e,a);if(t===-1)return!1;a=t+e.length}return!0});if(n)r.push(n.id);else for(let e of t){if(e.length<3)continue;let t=o.filter(t=>t.id.toLowerCase().includes(`.${e}`)||t.name.toLowerCase().includes(e));for(let e of t)r.includes(e.id)||r.push(e.id)}}}return i&&r.length===0&&(t=!0),{cleanMessage:e.replace(/@[\w/äöüÄÖÜß]+\s*/g,``).trim(),mentionedScriptIds:r,includeAll:t,includeDevices:n}},[o]),se=y(async(e,t,s)=>{re.current||=await H(),W.current||=await G(n,r);let c=Y(),l=a===`blockly`,u=e||s.length>0,d=`You are an AI assistant for ioBroker JavaScript adapter scripting. Help the user write, debug, and understand ioBroker scripts. Write comments in ${c}. Use the ioBroker JavaScript API correctly.
|
|
3
3
|
|
|
4
4
|
ioBroker object hierarchy: adapter.instance.device.channel.state
|
|
@@ -15,7 +15,7 @@ ${re.current}`;if(l&&(d+="\n\nThe user is working in the Blockly visual editor.
|
|
|
15
15
|
`)}`)}t.length>0&&(O+=`\n\n[Automatic analysis results]\n${t.join(`
|
|
16
16
|
|
|
17
17
|
`)}`)}}let k=[...D,...u.filter(e=>e.role!==`system`).map(e=>({role:e.role,content:e.content})),{role:`user`,content:O}],j=v===`agent`;try{let e=[...k];for(let r=0;r<5;r++){let i=await U(n,a,{messages:e,model:E,provider:t,baseUrl:ee,...j?{tools:le}:{}});if(i.error){if(j&&r===0&&i.error.toLowerCase().includes(`tool`)){let r=await U(n,a,{messages:e,model:E,provider:t,baseUrl:ee});if(r.error)T(r.error),f(e=>e.slice(0,-1));else{let e=B(r.content||``);f(t=>{let n=[...t],r=n[n.length-1];return(r==null?void 0:r.role)===`assistant`&&(n[n.length-1]={...r,content:e}),n})}break}T(i.error),f(e=>e.slice(0,-1));break}let c=i.tool_calls;if((!c||c.length===0)&&j&&i.content){let e=i.content.trim();try{let t=JSON.parse(e);t.name&&t.arguments&&(c=[{id:`text_tool_${Date.now()}`,type:`function`,function:{name:t.name,arguments:JSON.stringify(t.arguments)}}])}catch{}}if(!c||c.length===0){let e=B(i.content||``);f(t=>{let n=[...t],r=n[n.length-1];return(r==null?void 0:r.role)===`assistant`&&(n[n.length-1]={...r,content:e}),n});break}i.tool_calls=c;let l=i.tool_calls.map(e=>{let t={};try{t=JSON.parse(e.function.arguments)}catch{}switch(e.function.name){case`search_datapoints`:return`🔍 ${C.t(`Searching datapoints`)}: "${String(t.query||``)}"`;case`get_state_value`:return`📊 ${C.t(`Reading value`)}: ${String(t.id||``)}`;case`get_object_info`:return`📋 ${C.t(`Loading object info`)}: ${String(t.id||``)}`;case`search_scripts`:return`🔍 ${C.t(`Searching scripts`)}: "${String(t.query||``)}"`;case`read_script`:return`📖 ${C.t(`Reading script`)}: ${String(t.id||``)}`;case`list_scripts`:return`📂 ${C.t(`Loading script list`)}`;default:return`⚙️ ${e.function.name}`}});f(e=>{let t=[...e],n=t[t.length-1];return(n==null?void 0:n.role)===`assistant`&&(t[t.length-1]={...n,content:l.join(`
|
|
18
|
-
`)}),t}),e.push({role:`assistant`,content:i.content||``,tool_calls:i.tool_calls});for(let t of i.tool_calls){let r=await xe(n,t,o,s,a);e.push({role:`tool`,tool_call_id:t.id,content:r})}}}catch(e){T(String(e)),f(e=>e.slice(0,-1))}m(!1)},[E,A,u,p,n,r,se,oe,o,v,ce,f,l,s]),ue=y(()=>{f([]),T(null),m(!1),g(null),ne(),window.localStorage.removeItem(`Editor.aiChatHistory`)},[f]),de=y(async(e,t)=>{let i=A[E];if(!i)return`Error: ${C.t(`Please select a valid model`)}`;let o=W.current||await G(n,r);if(W.current=o,!o)return`Error: ${C.t(`No API keys configured`)}`;let s=Object.keys(r)[0];if(!s)return`Error: ${C.t(`No running javascript instance found`)}`;let c=i===`custom`&&o.gptBaseUrl||``,l=a||`javascript`,u=`You are an assistant for writing ioBroker ${l} scripts. The user will ask a question about a snippet of their code. Match your answer to the question: \n- If they ask for an explanation, description, or "what does this do?", reply with clear prose (a few sentences). Do NOT repeat the code unchanged. \n- If they explicitly ask for a change, refactor, fix, or rewrite, reply with a single fenced \`\`\`${l===`blockly`?`xml`:l}\`\`\` code block containing the full replacement for the selection. You may add one short sentence before or after the block. \n- If they ask something ambiguous or meta (e.g. "is this correct?"), reply in prose first and only include code if proposing a change. \nioBroker globals available in scripts: on, setState, getState, schedule, sendTo, log, createState, setStateDelayed, existsState, httpGet, httpPost.`,d=t?`Code from my editor:\n\n\`\`\`${l===`blockly`?`xml`:l}\n${t}\n\`\`\`\n\n${e}`:e;try{let e=await U(n,s,{messages:[{role:`system`,content:u},{role:`user`,content:d}],model:E,provider:i,baseUrl:c});return e.error?`Error: ${e.error}`:e.content||``}catch(e){return`Error: ${e.message||String(e)}`}},[E,A,r,n,a]);return{messages:u,isLoading:p,error:w,model:E,availableModels:ee,modelProviderMap:A,modelsLoading:M,modelsError:F,lastContextInfo:h,mode:v,setMode:S,setModel:ie,sendMessage:Z,triggerAiAction:y(t=>{t.range&&t.code?J.current=l(t.kind||`codelens`,t.range,t.code):J.current=null,e(async()=>{let{buildActionPrompt:e}=await import(`./aiPromptBuilder-
|
|
18
|
+
`)}),t}),e.push({role:`assistant`,content:i.content||``,tool_calls:i.tool_calls});for(let t of i.tool_calls){let r=await xe(n,t,o,s,a);e.push({role:`tool`,tool_call_id:t.id,content:r})}}}catch(e){T(String(e)),f(e=>e.slice(0,-1))}m(!1)},[E,A,u,p,n,r,se,oe,o,v,ce,f,l,s]),ue=y(()=>{f([]),T(null),m(!1),g(null),ne(),window.localStorage.removeItem(`Editor.aiChatHistory`)},[f]),de=y(async(e,t)=>{let i=A[E];if(!i)return`Error: ${C.t(`Please select a valid model`)}`;let o=W.current||await G(n,r);if(W.current=o,!o)return`Error: ${C.t(`No API keys configured`)}`;let s=Object.keys(r)[0];if(!s)return`Error: ${C.t(`No running javascript instance found`)}`;let c=i===`custom`&&o.gptBaseUrl||``,l=a||`javascript`,u=`You are an assistant for writing ioBroker ${l} scripts. The user will ask a question about a snippet of their code. Match your answer to the question: \n- If they ask for an explanation, description, or "what does this do?", reply with clear prose (a few sentences). Do NOT repeat the code unchanged. \n- If they explicitly ask for a change, refactor, fix, or rewrite, reply with a single fenced \`\`\`${l===`blockly`?`xml`:l}\`\`\` code block containing the full replacement for the selection. You may add one short sentence before or after the block. \n- If they ask something ambiguous or meta (e.g. "is this correct?"), reply in prose first and only include code if proposing a change. \nioBroker globals available in scripts: on, setState, getState, schedule, sendTo, log, createState, setStateDelayed, existsState, httpGet, httpPost.`,d=t?`Code from my editor:\n\n\`\`\`${l===`blockly`?`xml`:l}\n${t}\n\`\`\`\n\n${e}`:e;try{let e=await U(n,s,{messages:[{role:`system`,content:u},{role:`user`,content:d}],model:E,provider:i,baseUrl:c});return e.error?`Error: ${e.error}`:e.content||``}catch(e){return`Error: ${e.message||String(e)}`}},[E,A,r,n,a]);return{messages:u,isLoading:p,error:w,model:E,availableModels:ee,modelProviderMap:A,modelsLoading:M,modelsError:F,lastContextInfo:h,mode:v,setMode:S,setModel:ie,sendMessage:Z,triggerAiAction:y(t=>{t.range&&t.code?J.current=l(t.kind||`codelens`,t.range,t.code):J.current=null,e(async()=>{let{buildActionPrompt:e}=await import(`./aiPromptBuilder-db3Z4xhV.js`);return{buildActionPrompt:e}},[],import.meta.url).then(({buildActionPrompt:e})=>{let n=e({action:t.action,code:t.code,language:a||`javascript`,diagnostic:t.diagnostic,question:t.question,rangeLabel:t.rangeLabel});n?Z(n):J.current=null}).catch(()=>{J.current=null,T(C.t(`Failed to build AI action prompt`))})},[Z,a,l]),askInline:de,clearChat:ue,retryLoadModels:ae}}D();var Te=({code:e,language:n,themeType:r,onInsertCode:i,onShowDiff:a,sourceRange:o})=>{let s=k(null);b(()=>{var t;let i=window.monaco;if(!s.current||!(i!=null&&(t=i.editor)!=null&&t.colorize))return;let a=n===`ts`||n===`typescript`?`typescript`:n||`javascript`;i.editor.colorize(e,a,{theme:r===`dark`?`vs-dark`:`vs`}).then(e=>{s.current&&(s.current.innerHTML=e)})},[e,n,r]);let c=y(()=>{navigator.clipboard.writeText(e)},[e]);return t(p,{sx:{position:`relative`,my:1,borderRadius:1,overflow:`hidden`,border:`1px solid`,borderColor:`divider`},children:[t(p,{sx:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,px:1,py:.5,bgcolor:`action.hover`,borderBottom:`1px solid`,borderColor:`divider`},children:[u(p,{sx:{fontSize:`0.75rem`,color:`text.secondary`,textTransform:`uppercase`},children:n||`javascript`}),t(p,{children:[u(j,{title:C.t(`Copy`),children:u(S,{size:`small`,onClick:c,children:u(E,{sx:{fontSize:16}})})}),i&&u(j,{title:C.t(`Insert into editor`),children:u(S,{size:`small`,onClick:()=>i(e),children:u(X,{sx:{fontSize:16}})})}),a&&u(j,{title:C.t(`Show as diff`),children:u(S,{size:`small`,onClick:()=>a(e,o),children:u(ae,{sx:{fontSize:16}})})})]})]}),u(`pre`,{ref:s,style:{margin:0,padding:`8px 12px`,overflow:`auto`,maxHeight:400,fontSize:`13px`,fontFamily:`'Cascadia Code', 'Fira Code', 'Consolas', monospace`,backgroundColor:r===`dark`?`#1e1e1e`:`#f8f8f8`,color:r===`dark`?`#d4d4d4`:`#333`},children:e})]})};D();var Ee=({xml:e})=>{let t=d(),n=k(null),r=k(null),[i,a]=_(60),o=k(!1);return b(()=>{o.current&&(o.current=!1,requestAnimationFrame(()=>{let e=window.Blockly,t=r.current;e&&t&&(e.svgResize(t),t.scrollCenter())}))},[i]),b(()=>{let i=window.Blockly;if(i&&n.current){r.current&&=(r.current.dispose(),null);try{let s=i.inject(n.current,{readOnly:!0,toolbox:null,trashcan:!1,zoom:{controls:!1,wheel:!1,startScale:1},move:{scrollbars:!1,drag:!1,wheel:!1},sounds:!1,renderer:`thrasos`,theme:F(t),media:`google-blockly/media/`});r.current=s;let c=e.trim();c.startsWith(`<xml`)||(c=`<xml xmlns="https://developers.google.com/blockly/xml">${c}</xml>`);let l=i.utils.xml.textToDom(c),u=10,d=Array.from(l.querySelectorAll(`:scope > block`));for(let e of d)e.setAttribute(`x`,`10`),e.setAttribute(`y`,String(u)),u+=200;i.Xml.domToWorkspace(l,s);let f=s.getTopBlocks(!1);if(f.length>1){let e=10;for(let t of f){let n=t.getRelativeToSurfaceXY();t.moveBy(10-n.x,e-n.y),e+=t.getHeightWidth().height+20}}let p=s.getBlocksBoundingBox();if(p){let e=p.bottom-p.top+20,t=Math.max(60,Math.ceil(e));o.current=!0,a(t)}}catch{}return()=>{r.current&&=(r.current.dispose(),null)}}},[e,t]),u(p,{ref:n,sx:{width:`100%`,height:i,minHeight:60,borderRadius:1,overflow:`hidden`,border:`1px solid`,borderColor:`divider`}})};D();function De(e){let t=[],n=/```(\w*)\n?([\s\S]*?)```/g,r=0,i;for(;(i=n.exec(e))!==null;){if(i.index>r){let n=e.substring(r,i.index).trim();n&&t.push({type:`text`,content:n})}t.push({type:`code`,content:i[2].trim(),language:i[1]||`javascript`}),r=i.index+i[0].length}if(r<e.length){let n=e.substring(r).trim();n&&t.push({type:`text`,content:n})}return t.length===0&&t.push({type:`text`,content:e}),t}function $(e){let t=[],n=/(\*\*(.+?)\*\*|\*(.+?)\*|`(.+?)`)/g,r=0,i,a=0;for(;(i=n.exec(e))!==null;)i.index>r&&t.push(e.substring(r,i.index)),i[2]?t.push(u(`strong`,{children:i[2]},a++)):i[3]?t.push(u(`em`,{children:i[3]},a++)):i[4]&&t.push(u(`code`,{className:`ai-chat-inline-code`,style:{padding:`2px 6px`,borderRadius:4,fontSize:`0.85em`,fontFamily:`'Cascadia Code', 'Fira Code', 'Consolas', monospace`},children:i[4]},a++)),r=i.index+i[0].length;return r<e.length&&t.push(e.substring(r)),t}function Oe(e){return e.trim().startsWith(`|`)&&e.trim().endsWith(`|`)}function ke(e){return/^\|[\s:]*-+[\s:|-]*\|$/.test(e.trim())}function Ae(e,n,r){let i=n.palette.mode===`dark`,a=e=>e.trim().replace(/^\||\|$/g,``).split(`|`).map(e=>e.trim()),o=a(e[0]),s=e.slice(2).map(a);return u(p,{sx:{overflowX:`auto`,my:1},children:t(`table`,{style:{borderCollapse:`collapse`,width:`100%`,fontSize:`0.8rem`,color:n.palette.text.primary},children:[u(`thead`,{children:u(`tr`,{children:o.map((e,t)=>u(`th`,{style:{border:`1px solid ${n.palette.divider}`,padding:`6px 10px`,backgroundColor:i?n.palette.grey[800]:n.palette.grey[100],color:n.palette.text.primary,fontWeight:600,textAlign:`left`},children:$(e)},t))})}),u(`tbody`,{children:s.map((e,t)=>u(`tr`,{style:{backgroundColor:t%2==1?i?n.palette.grey[900]:n.palette.grey[50]:void 0},children:e.map((e,t)=>u(`td`,{style:{border:`1px solid ${n.palette.divider}`,padding:`6px 10px`,color:n.palette.text.primary},children:$(e)},t))},t))})]})},r)}function je(e,t){let n=e.split(`
|
|
19
19
|
`),r=[],i=0,a=0;for(;a<n.length;){let e=n[a].trim();if(e===``){a++;continue}if(/^(-{3,}|\*{3,}|_{3,})$/.test(e)){r.push(u(`hr`,{style:{border:`none`,borderTop:`1px solid ${t.palette.divider}`,margin:`8px 0`}},i++)),a++;continue}let o=e.match(/^(#{1,4})\s+(.+)$/);if(o){let e=o[1].length;r.push(u(`div`,{style:{fontWeight:600,fontSize:[`1.2em`,`1.1em`,`1em`,`0.95em`][e-1],margin:`8px 0 4px`},children:$(o[2])},i++)),a++;continue}if(Oe(e)&&a+1<n.length&&ke(n[a+1].trim())&&a+2<n.length){let e=[n[a],n[a+1]],o=a+2;for(;o<n.length&&Oe(n[o]);)e.push(n[o]),o++;r.push(Ae(e,t,i++)),a=o;continue}if(/^[-*+]\s/.test(e)){let e=[];for(;a<n.length&&/^\s*[-*+]\s/.test(n[a]);)e.push(n[a].replace(/^\s*[-*+]\s/,``).trim()),a++;r.push(u(`ul`,{style:{margin:`4px 0`,paddingLeft:20},children:e.map((e,t)=>u(`li`,{children:$(e)},t))},i++));continue}if(/^\d+[.)]\s/.test(e)){let e=[];for(;a<n.length&&/^\s*\d+[.)]\s/.test(n[a]);)e.push(n[a].replace(/^\s*\d+[.)]\s/,``).trim()),a++;r.push(u(`ol`,{style:{margin:`4px 0`,paddingLeft:20},children:e.map((e,t)=>u(`li`,{children:$(e)},t))},i++));continue}r.push(u(`div`,{children:$(e)},i++)),a++}return r}var Me=({message:e,themeType:r,currentLanguage:i,onInsertCode:a,onShowDiff:o,onApplyCode:s})=>{let l=e.role===`user`,d=c(),m=l?r===`dark`?d.palette.primary.dark:d.palette.primary.main:r===`dark`?d.palette.secondary.dark:d.palette.secondary.main,h=d.palette.getContrastText(m),_=g(()=>De(e.content),[e.content]),v=(e,t)=>!!(e===`xml`||e===`blockly`||i===`blockly`&&t&&/<block\s+type=/.test(t));return t(p,{sx:{display:`flex`,gap:1,px:1.5,py:1,mx:.75,my:.5,bgcolor:l?r===`dark`?`rgba(144, 202, 249, 0.10)`:`rgba(25, 118, 210, 0.07)`:r===`dark`?`rgba(206, 147, 216, 0.10)`:`rgba(156, 39, 176, 0.06)`,borderRadius:1.5,borderLeft:`3px solid`,borderLeftColor:m,transition:`background-color 120ms`,"&:hover":{bgcolor:l?r===`dark`?`rgba(144, 202, 249, 0.16)`:`rgba(25, 118, 210, 0.12)`:r===`dark`?`rgba(206, 147, 216, 0.16)`:`rgba(156, 39, 176, 0.10)`}},children:[u(n,{sx:{width:28,height:28,bgcolor:m,color:h,flexShrink:0,mt:.5},children:u(l?oe:ce,{sx:{fontSize:18}})}),u(p,{sx:{flex:1,minWidth:0,fontSize:`0.875rem`,lineHeight:1.6},children:_.map((n,i)=>n.type===`code`?v(n.language,n.content)?t(p,{sx:{my:1},children:[u(Ee,{xml:n.content}),t(p,{sx:{display:`flex`,gap:.5,mt:.5},children:[s&&u(f,{size:`small`,variant:`contained`,color:`primary`,startIcon:u(se,{sx:{fontSize:14}}),onClick:()=>s(n.content),sx:{textTransform:`none`,fontSize:`0.75rem`},children:C.t(`Apply blocks`)}),a&&u(f,{size:`small`,variant:`outlined`,startIcon:u(X,{sx:{fontSize:14}}),onClick:()=>a(n.content),sx:{textTransform:`none`,fontSize:`0.75rem`},children:C.t(`Insert blocks`)})]})]},i):u(Te,{code:n.content,language:n.language||`javascript`,themeType:r,onInsertCode:a,onShowDiff:o,sourceRange:e.sourceRange||null},i):u(p,{sx:{wordBreak:`break-word`,color:d.palette.text.primary},children:je(n.content,d)},i))})]})};function Ne(e){let t=(e||``).toLowerCase();return t.includes(`blockly`)||t.includes(`rules`)?`blockly`:t.includes(`typescript`)?`typescript`:`javascript`}function Pe(e,t){return`\`\`\`${t===`blockly`?`xml`:t}\n${e}\n\`\`\``}function Fe(e){let t=(e.code||``).trim(),n=Ne(e.language),r=e.rangeLabel?` (${e.rangeLabel})`:``;switch(e.action){case`explain`:return t?[`Please explain what this ioBroker ${n} code does${r}.`,`Focus on: which datapoints it reads/writes, which triggers fire it, and any side-effects.`,``,Pe(t,n)].join(`
|
|
20
20
|
`):null;case`refactor`:return t?[`Refactor this ioBroker ${n} code${r} to be cleaner and more idiomatic.`,`Preserve behavior exactly. Keep ioBroker APIs (on, setState, getState, schedule, sendTo, log).`,`Return the full refactored block inside a \`\`\`${n===`blockly`?`xml`:n}\`\`\` code block so it can be smart-applied.`,``,Pe(t,n)].join(`
|
|
21
21
|
`):null;case`comment`:return t?[`Add clear, concise inline comments to this ioBroker ${n} code${r}.`,`Only add comments where they add real value (non-obvious logic, tricky edge cases, business rules).`,`Do not over-comment trivial lines. Return the commented version in a code block.`,``,Pe(t,n)].join(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,o as t,t as n}from"./rolldown-runtime-C0FnF6B9.js";import{$ as r,$n as i,C as a,Cn as o,Cr as s,F as c,Ft as l,I as u,It as d,L as f,N as p,Ot as m,Qn as h,Rt as g,T as _,U as v,Vt as y,W as b,X as x,_ as S,en as C,gn as w,hn as T,in as E,j as D,mn as O,nr as k,p as A,q as j,vn as ee,w as M,wr as N,x as P,xn as F,yn as I,zn as L}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__113183188387379__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-D-gi6Mty.js";import{t as R}from"./Error-Ch2nx5uC.js";import{T as z,w as B}from"./index-
|
|
1
|
+
import{a as e,o as t,t as n}from"./rolldown-runtime-C0FnF6B9.js";import{$ as r,$n as i,C as a,Cn as o,Cr as s,F as c,Ft as l,I as u,It as d,L as f,N as p,Ot as m,Qn as h,Rt as g,T as _,U as v,Vt as y,W as b,X as x,_ as S,en as C,gn as w,hn as T,in as E,j as D,mn as O,nr as k,p as A,q as j,vn as ee,w as M,wr as N,x as P,xn as F,yn as I,zn as L}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__113183188387379__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-D-gi6Mty.js";import{t as R}from"./Error-Ch2nx5uC.js";import{T as z,w as B}from"./index-CRX4LAhD.js";import{t as V}from"./ScriptEditorVanillaMonaco-DYNr4-5w.js";N();var H={editorDiv:{height:`100%`,width:`100%`,overflow:`hidden`,position:`relative`}},U=class extends k.Component{constructor(e){super(e),this.state={lines:(this.props.script||``).split(/\r\n|\n/)}}render(){return h(`div`,{style:H.editorDiv,children:h(V,{triggerPrettier:1,name:this.props.scriptName,adapterName:this.props.adapterName,readOnly:!0,code:this.props.script||``,isDark:this.props.themeType===`dark`,socket:this.props.socket,runningInstances:this.props.runningInstances,language:`javascript`,breakpoints:this.props.breakpoints,location:this.props.paused?this.props.location:null,onToggleBreakpoint:e=>this.props.onToggleBreakpoint(e)},`scriptEditor2`)},`scriptEditorDiv2`)}};N();var W=34,G={logBox:{width:`100%`,height:`100%`,position:`relative`,overflow:`hidden`},logBoxInner:e=>({display:`inline-block`,color:e.palette.mode===`dark`?`white`:`black`,width:`calc(100% - ${W}px)`,height:`100%`,overflow:`auto`,position:`relative`,verticalAlign:`top`}),info:e=>({background:e.palette.mode===`dark`?`darkgrey`:`lightgrey`,color:(e.palette.mode,`black`)}),error:e=>({background:`#FF0000`,color:e.palette.mode===`dark`?`black`:`white`}),warn:e=>({background:`#FF8000`,color:e.palette.mode===`dark`?`black`:`white`}),debug:e=>({background:`gray`,opacity:.8,color:e.palette.mode===`dark`?`black`:`white`}),silly:e=>({background:`gray`,opacity:.6,color:e.palette.mode===`dark`?`black`:`white`}),table:{fontFamily:`monospace`,width:`100%`},toolbox:{width:W,height:`100%`,boxShadow:`2px 0px 4px -1px rgba(0, 0, 0, 0.2), 4px 0px 5px 0px rgba(0, 0, 0, 0.14), 1px 0px 10px 0px rgba(0, 0, 0, 0.12)`,display:`inline-block`,verticalAlign:`top`,overflow:`hidden`},trTime:{width:90},trSeverity:{width:40,fontWeight:`bold`},iconButtons:{width:32,height:32,padding:4}};function te(e){let t,n=e.getHours();return n<10&&(n=`0${n.toString()}`),t=`${n}:`,n=e.getMinutes(),n<10&&(n=`0${n.toString()}`),t+=`${n}:`,n=e.getSeconds(),n<10&&(n=`0${n.toString()}`),t+=`${n}.`,n=e.getMilliseconds(),n<10?n=`00${n.toString()}`:n<100&&(n=`0${n.toString()}`),t+=n,t}var ne=class e extends k.Component{constructor(e){super(e),L(this,`messagesEnd`,void 0),this.state={goBottom:!0},this.messagesEnd=k.createRef()}static generateLine(e){return i(y,{component:`tr`,sx:G[e.severity],children:[h(`td`,{style:G.trTime,children:te(new Date(e.ts))}),h(`td`,{style:G.trSeverity,children:e.severity}),h(`td`,{children:e.text})]},`tr_${e.ts}_${e.text.substring(e.text.length-10,e.text.length)}`)}renderLogList(t){return t!=null&&t.length?i(y,{sx:G.logBoxInner,children:[h(`table`,{style:G.table,children:h(`tbody`,{children:t.map(t=>e.generateLine(t))})},`logTable`),h(`div`,{ref:this.messagesEnd,style:{float:`left`,clear:`both`}},`logScrollPoint`)]},`logList`):h(y,{sx:G.logBoxInner,style:{paddingLeft:10},children:A.t(`Log outputs`)},`logList`)}onCopy(){S.copyToClipboard(this.props.console.join(`
|
|
2
2
|
`))}scrollToBottom(){var e;(e=this.messagesEnd)==null||(e=e.current)==null||e.scrollIntoView({behavior:`smooth`})}componentDidUpdate(){this.state.goBottom&&this.scrollToBottom()}render(){let e=this.props.console;return i(`div`,{style:G.logBox,children:[i(`div`,{style:G.toolbox,children:[h(O,{style:G.iconButtons,onClick:()=>this.setState({goBottom:!this.state.goBottom}),color:this.state.goBottom?`secondary`:void 0,size:`medium`,children:h(x,{})}),e!=null&&e.length?h(O,{style:G.iconButtons,onClick:()=>this.props.onClearAllLogs(),size:`medium`,children:h(f,{})}):null,e!=null&&e.length?h(O,{style:G.iconButtons,onClick:()=>this.onCopy(),size:`medium`,children:h(c,{})}):null]},`toolbox`),this.renderLogList(e)]})}},K=n(((t,n)=>{(function(r,i){typeof t==`object`&&typeof n==`object`?n.exports=i((N(),e(s))):typeof define==`function`&&define.amd?define([`react`],i):typeof t==`object`?t.reactJsonView=i((N(),e(s))):r.reactJsonView=i(r.React)})(t,(function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){typeof Symbol<`u`&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:`Module`}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t||4&t&&typeof e==`object`&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&typeof e!=`string`)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,`a`,t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p=``,n(n.s=48)}([function(t,n){t.exports=e},function(e,t){var n=e.exports={version:`2.6.12`};typeof __e==`number`&&(__e=n)},function(e,t,n){var r=n(26)(`wks`),i=n(17),a=n(3).Symbol,o=typeof a==`function`;(e.exports=function(e){return r[e]||(r[e]=o&&a[e]||(o?a:i)(`Symbol.`+e))}).store=r},function(e,t){var n=e.exports=typeof window<`u`&&window.Math==Math?window:typeof self<`u`&&self.Math==Math?self:Function(`return this`)();typeof __g==`number`&&(__g=n)},function(e,t,n){e.exports=!n(8)((function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7}))},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(7),i=n(16);e.exports=n(4)?function(e,t,n){return r.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){var r=n(10),i=n(35),a=n(23),o=Object.defineProperty;t.f=n(4)?Object.defineProperty:function(e,t,n){if(r(e),t=a(t,!0),r(n),i)try{return o(e,t,n)}catch{}if(`get`in n||`set`in n)throw TypeError(`Accessors not supported!`);return`value`in n&&(e[t]=n.value),e}},function(e,t){e.exports=function(e){try{return!!e()}catch{return!0}}},function(e,t,n){var r=n(40),i=n(22);e.exports=function(e){return r(i(e))}},function(e,t,n){var r=n(11);e.exports=function(e){if(!r(e))throw TypeError(e+` is not an object!`);return e}},function(e,t){e.exports=function(e){return typeof e==`object`?e!==null:typeof e==`function`}},function(e,t){e.exports={}},function(e,t,n){var r=n(39),i=n(27);e.exports=Object.keys||function(e){return r(e,i)}},function(e,t){e.exports=!0},function(e,t,n){var r=n(3),i=n(1),a=n(53),o=n(6),s=n(5),c=function(e,t,n){var l,u,d,f=e&c.F,p=e&c.G,m=e&c.S,h=e&c.P,g=e&c.B,_=e&c.W,v=p?i:i[t]||(i[t]={}),y=v.prototype,b=p?r:m?r[t]:(r[t]||{}).prototype;for(l in p&&(n=t),n)(u=!f&&b&&b[l]!==void 0)&&s(v,l)||(d=u?b[l]:n[l],v[l]=p&&typeof b[l]!=`function`?n[l]:g&&u?a(d,r):_&&b[l]==d?function(e){var t=function(t,n,r){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,r)}return e.apply(this,arguments)};return t.prototype=e.prototype,t}(d):h&&typeof d==`function`?a(Function.call,d):d,h&&((v.virtual||={})[l]=d,e&c.R&&y&&!y[l]&&o(y,l,d)))};c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,c.U=64,c.R=128,e.exports=c},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return`Symbol(${e===void 0?``:e})_${(++n+r).toString(36)}`}},function(e,t,n){var r=n(22);e.exports=function(e){return Object(r(e))}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,n){var r=n(52)(!0);n(34)(String,`String`,(function(e){this._t=String(e),this._i=0}),(function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})}))},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t){e.exports=function(e){if(e==null)throw TypeError(`Can't call method on `+e);return e}},function(e,t,n){var r=n(11);e.exports=function(e,t){if(!r(e))return e;var n,i;if(t&&typeof(n=e.toString)==`function`&&!r(i=n.call(e))||typeof(n=e.valueOf)==`function`&&!r(i=n.call(e))||!t&&typeof(n=e.toString)==`function`&&!r(i=n.call(e)))return i;throw TypeError(`Can't convert object to primitive value`)}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var r=n(26)(`keys`),i=n(17);e.exports=function(e){return r[e]||(r[e]=i(e))}},function(e,t,n){var r=n(1),i=n(3),a=i[`__core-js_shared__`]||={};(e.exports=function(e,t){return a[e]||(a[e]=t===void 0?{}:t)})(`versions`,[]).push({version:r.version,mode:n(14)?`pure`:`global`,copyright:`© 2020 Denis Pushkarev (zloirock.ru)`})},function(e,t){e.exports=`constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf`.split(`,`)},function(e,t,n){var r=n(7).f,i=n(5),a=n(2)(`toStringTag`);e.exports=function(e,t,n){e&&!i(e=n?e:e.prototype,a)&&r(e,a,{configurable:!0,value:t})}},function(e,t,n){n(62);for(var r=n(3),i=n(6),a=n(12),o=n(2)(`toStringTag`),s=`CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList`.split(`,`),c=0;c<s.length;c++){var l=s[c],u=r[l],d=u&&u.prototype;d&&!d[o]&&i(d,o,l),a[l]=a.Array}},function(e,t,n){t.f=n(2)},function(e,t,n){var r=n(3),i=n(1),a=n(14),o=n(30),s=n(7).f;e.exports=function(e){var t=i.Symbol||=a?{}:r.Symbol||{};e.charAt(0)==`_`||e in t||s(t,e,{value:o.f(e)})}},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t){e.exports=function(e,t,n){return Math.min(Math.max(e,t),n)}},function(e,t,n){var r=n(14),i=n(15),a=n(37),o=n(6),s=n(12),c=n(55),l=n(28),u=n(61),d=n(2)(`iterator`),f=!([].keys&&`next`in[].keys()),p=function(){return this};e.exports=function(e,t,n,m,h,g,_){c(n,t,m);var v,y,b,x=function(e){if(!f&&e in T)return T[e];switch(e){case`keys`:case`values`:return function(){return new n(this,e)}}return function(){return new n(this,e)}},S=t+` Iterator`,C=h==`values`,w=!1,T=e.prototype,E=T[d]||T[`@@iterator`]||h&&T[h],D=E||x(h),O=h?C?x(`entries`):D:void 0,k=t==`Array`&&T.entries||E;if(k&&(b=u(k.call(new e)))!==Object.prototype&&b.next&&(l(b,S,!0),r||typeof b[d]==`function`||o(b,d,p)),C&&E&&E.name!==`values`&&(w=!0,D=function(){return E.call(this)}),r&&!_||!f&&!w&&T[d]||o(T,d,D),s[t]=D,s[S]=p,h){if(v={values:C?D:x(`values`),keys:g?D:x(`keys`),entries:O},_)for(y in v)y in T||a(T,y,v[y]);else i(i.P+i.F*(f||w),t,v)}return v}},function(e,t,n){e.exports=!n(4)&&!n(8)((function(){return Object.defineProperty(n(36)(`div`),"a",{get:function(){return 7}}).a!=7}))},function(e,t,n){var r=n(11),i=n(3).document,a=r(i)&&r(i.createElement);e.exports=function(e){return a?i.createElement(e):{}}},function(e,t,n){e.exports=n(6)},function(e,t,n){var r=n(10),i=n(56),a=n(27),o=n(25)(`IE_PROTO`),s=function(){},c=function(){var e,t=n(36)(`iframe`),r=a.length;for(t.style.display=`none`,n(60).appendChild(t),t.src=`javascript:`,(e=t.contentWindow.document).open(),e.write(`<script>document.F=Object<\/script>`),e.close(),c=e.F;r--;)delete c.prototype[a[r]];return c()};e.exports=Object.create||function(e,t){var n;return e===null?n=c():(s.prototype=r(e),n=new s,s.prototype=null,n[o]=e),t===void 0?n:i(n,t)}},function(e,t,n){var r=n(5),i=n(9),a=n(57)(!1),o=n(25)(`IE_PROTO`);e.exports=function(e,t){var n,s=i(e),c=0,l=[];for(n in s)n!=o&&r(s,n)&&l.push(n);for(;t.length>c;)r(s,n=t[c++])&&(~a(l,n)||l.push(n));return l}},function(e,t,n){var r=n(24);e.exports=Object(`z`).propertyIsEnumerable(0)?Object:function(e){return r(e)==`String`?e.split(``):Object(e)}},function(e,t,n){var r=n(39),i=n(27).concat(`length`,`prototype`);t.f=Object.getOwnPropertyNames||function(e){return r(e,i)}},function(e,t,n){var r=n(24),i=n(2)(`toStringTag`),a=r(function(){return arguments}())==`Arguments`;e.exports=function(e){var t,n,o;return e===void 0?`Undefined`:e===null?`Null`:typeof(n=function(e,t){try{return e[t]}catch{}}(t=Object(e),i))==`string`?n:a?r(t):(o=r(t))==`Object`&&typeof t.callee==`function`?`Arguments`:o}},function(e,t){var n=function(){return this}();try{n||=Function(`return this`)()}catch{typeof window==`object`&&(n=window)}e.exports=n},function(e,t){var n=/-?\d+(\.\d+)?%?/g;e.exports=function(e){return e.match(n)}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.getBase16Theme=t.createStyling=t.invertTheme=void 0;var r=p(n(49)),i=p(n(76)),a=p(n(81)),o=p(n(89)),s=p(n(93)),c=function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(94)),l=p(n(132)),u=p(n(133)),d=p(n(138)),f=n(139);function p(e){return e&&e.__esModule?e:{default:e}}var m=c.default,h=(0,o.default)(m),g=(0,d.default)(u.default,f.rgb2yuv,(function(e){var t,n=(0,a.default)(e,3),r=n[0],i=n[1],o=n[2];return[(t=r,t<.25?1:t<.5?.9-t:1.1-t),i,o]}),f.yuv2rgb,l.default),_=function(e){return function(t){return{className:[t.className,e.className].filter(Boolean).join(` `),style:(0,i.default)({},t.style||{},e.style||{})}}},v=function(e,t){var n=(0,o.default)(t);for(var a in e)n.indexOf(a)===-1&&n.push(a);return n.reduce((function(n,a){return n[a]=function(e,t){if(e===void 0)return t;if(t===void 0)return e;var n=e===void 0?`undefined`:(0,r.default)(e),a=t===void 0?`undefined`:(0,r.default)(t);switch(n){case`string`:switch(a){case`string`:return[t,e].filter(Boolean).join(` `);case`object`:return _({className:e,style:t});case`function`:return function(n){var r=[...arguments].slice(1);return _({className:e})(t.apply(void 0,[n].concat(r)))}}case`object`:switch(a){case`string`:return _({className:t,style:e});case`object`:return(0,i.default)({},t,e);case`function`:return function(n){var r=[...arguments].slice(1);return _({style:e})(t.apply(void 0,[n].concat(r)))}}case`function`:switch(a){case`string`:return function(n){var r=[...arguments].slice(1);return e.apply(void 0,[_(n)({className:t})].concat(r))};case`object`:return function(n){var r=[...arguments].slice(1);return e.apply(void 0,[_(n)({style:t})].concat(r))};case`function`:return function(n){var r=[...arguments].slice(1);return e.apply(void 0,[t.apply(void 0,[n].concat(r))].concat(r))}}}}(e[a],t[a]),n}),{})},y=function(e,t){var n=[...arguments].slice(2);if(t===null)return e;Array.isArray(t)||(t=[t]);var a=t.map((function(t){return e[t]})).filter(Boolean).reduce((function(e,t){return typeof t==`string`?e.className=[e.className,t].filter(Boolean).join(` `):(t===void 0?`undefined`:(0,r.default)(t))===`object`?e.style=(0,i.default)({},e.style,t):typeof t==`function`&&(e=(0,i.default)({},e,t.apply(void 0,[e].concat(n)))),e}),{className:``,style:{}});return a.className||delete a.className,(0,o.default)(a.style).length===0&&delete a.style,a},b=t.invertTheme=function(e){return(0,o.default)(e).reduce((function(t,n){return t[n]=/^base/.test(n)?g(e[n]):n===`scheme`?e[n]+`:inverted`:e[n],t}),{})},x=(t.createStyling=(0,s.default)((function(e){var t=[...arguments].slice(3),n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=n.defaultBase16,c=a===void 0?m:a,l=n.base16Themes,u=x(r,l===void 0?null:l);u&&(r=(0,i.default)({},u,r));var d=h.reduce((function(e,t){return e[t]=r[t]||c[t],e}),{}),f=v((0,o.default)(r).reduce((function(e,t){return h.indexOf(t)===-1&&(e[t]=r[t]),e}),{}),e(d));return(0,s.default)(y,2).apply(void 0,[f].concat(t))}),3),t.getBase16Theme=function(e,t){if(e&&e.extend&&(e=e.extend),typeof e==`string`){var n=e.split(`:`),r=(0,a.default)(n,2),i=r[0],o=r[1];e=(t||{})[i]||c[i],o===`inverted`&&(e=b(e))}return e&&e.hasOwnProperty(`base00`)?e:void 0})},function(e,t,n){var r,i=typeof Reflect==`object`?Reflect:null,a=i&&typeof i.apply==`function`?i.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};r=i&&typeof i.ownKeys==`function`?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise((function(n,r){function i(){a!==void 0&&e.removeListener(`error`,a),n([].slice.call(arguments))}var a;t!==`error`&&(a=function(n){e.removeListener(t,i),r(n)},e.once(`error`,a)),e.once(t,i)}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}function u(e){return e._maxListeners===void 0?s.defaultMaxListeners:e._maxListeners}function d(e,t,n,r){var i,a,o,s;if(l(n),(a=e._events)===void 0?(a=e._events=Object.create(null),e._eventsCount=0):(a.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),a=e._events),o=a[t]),o===void 0)o=a[t]=n,++e._eventsCount;else if(typeof o==`function`?o=a[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),(i=u(e))>0&&o.length>i&&!o.warned){o.warned=!0;var c=Error(`Possible EventEmitter memory leak detected. `+o.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);c.name=`MaxListenersExceededWarning`,c.emitter=e,c.type=t,c.count=o.length,s=c,console&&console.warn&&console.warn(s)}return e}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}function m(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?function(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):g(i,i.length)}function h(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}function g(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);c=e}}),s.init=function(){this._events!==void 0&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r=e===`error`,i=this._events;if(i!==void 0)r&&=i.error===void 0;else if(!r)return!1;if(r){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=i[e];if(c===void 0)return!1;if(typeof c==`function`)a(c,this,t);else{var l=c.length,u=g(c,l);for(n=0;n<l;++n)a(u[n],this,t)}return!0},s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)},s.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,a,o;if(l(t),(r=this._events)===void 0||(n=r[e])===void 0)return this;if(n===t||n.listener===t)--this._eventsCount==0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n,r;if((n=this._events)===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i,a=Object.keys(n);for(r=0;r<a.length;++r)(i=a[r])!==`removeListener`&&this.removeAllListeners(i);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(typeof(t=n[e])==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},s.prototype.listeners=function(e){return m(this,e,!0)},s.prototype.rawListeners=function(e){return m(this,e,!1)},s.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h,s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){e.exports.Dispatcher=n(140)},function(e,t,n){e.exports=n(142)},function(e,t,n){t.__esModule=!0;var r=o(n(50)),i=o(n(65)),a=typeof i.default==`function`&&typeof r.default==`symbol`?function(e){return typeof e}:function(e){return e&&typeof i.default==`function`&&e.constructor===i.default&&e!==i.default.prototype?`symbol`:typeof e};function o(e){return e&&e.__esModule?e:{default:e}}t.default=typeof i.default==`function`&&a(r.default)===`symbol`?function(e){return e===void 0?`undefined`:a(e)}:function(e){return e&&typeof i.default==`function`&&e.constructor===i.default&&e!==i.default.prototype?`symbol`:e===void 0?`undefined`:a(e)}},function(e,t,n){e.exports={default:n(51),__esModule:!0}},function(e,t,n){n(20),n(29),e.exports=n(30).f(`iterator`)},function(e,t,n){var r=n(21),i=n(22);e.exports=function(e){return function(t,n){var a,o,s=String(i(t)),c=r(n),l=s.length;return c<0||c>=l?e?``:void 0:(a=s.charCodeAt(c))<55296||a>56319||c+1===l||(o=s.charCodeAt(c+1))<56320||o>57343?e?s.charAt(c):a:e?s.slice(c,c+2):o-56320+(a-55296<<10)+65536}}},function(e,t,n){var r=n(54);e.exports=function(e,t,n){if(r(e),t===void 0)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}}},function(e,t){e.exports=function(e){if(typeof e!=`function`)throw TypeError(e+` is not a function!`);return e}},function(e,t,n){var r=n(38),i=n(16),a=n(28),o={};n(6)(o,n(2)(`iterator`),(function(){return this})),e.exports=function(e,t,n){e.prototype=r(o,{next:i(1,n)}),a(e,t+` Iterator`)}},function(e,t,n){var r=n(7),i=n(10),a=n(13);e.exports=n(4)?Object.defineProperties:function(e,t){i(e);for(var n,o=a(t),s=o.length,c=0;s>c;)r.f(e,n=o[c++],t[n]);return e}},function(e,t,n){var r=n(9),i=n(58),a=n(59);e.exports=function(e){return function(t,n,o){var s,c=r(t),l=i(c.length),u=a(o,l);if(e&&n!=n){for(;l>u;)if((s=c[u++])!=s)return!0}else for(;l>u;u++)if((e||u in c)&&c[u]===n)return e||u||0;return!e&&-1}}},function(e,t,n){var r=n(21),i=Math.min;e.exports=function(e){return e>0?i(r(e),9007199254740991):0}},function(e,t,n){var r=n(21),i=Math.max,a=Math.min;e.exports=function(e,t){return(e=r(e))<0?i(e+t,0):a(e,t)}},function(e,t,n){var r=n(3).document;e.exports=r&&r.documentElement},function(e,t,n){var r=n(5),i=n(18),a=n(25)(`IE_PROTO`),o=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=i(e),r(e,a)?e[a]:typeof e.constructor==`function`&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?o:null}},function(e,t,n){var r=n(63),i=n(64),a=n(12),o=n(9);e.exports=n(34)(Array,`Array`,(function(e,t){this._t=o(e),this._i=0,this._k=t}),(function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,i(1)):i(0,t==`keys`?n:t==`values`?e[n]:[n,e[n]])}),`values`),a.Arguments=a.Array,r(`keys`),r(`values`),r(`entries`)},function(e,t){e.exports=function(){}},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,n){e.exports={default:n(66),__esModule:!0}},function(e,t,n){n(67),n(73),n(74),n(75),e.exports=n(1).Symbol},function(e,t,n){var r=n(3),i=n(5),a=n(4),o=n(15),s=n(37),c=n(68).KEY,l=n(8),u=n(26),d=n(28),f=n(17),p=n(2),m=n(30),h=n(31),g=n(69),_=n(70),v=n(10),y=n(11),b=n(18),x=n(9),S=n(23),C=n(16),w=n(38),T=n(71),E=n(72),D=n(32),O=n(7),k=n(13),A=E.f,j=O.f,ee=T.f,M=r.Symbol,N=r.JSON,P=N&&N.stringify,F=p(`_hidden`),I=p(`toPrimitive`),L={}.propertyIsEnumerable,R=u(`symbol-registry`),z=u(`symbols`),B=u(`op-symbols`),V=Object.prototype,H=typeof M==`function`&&!!D.f,U=r.QObject,W=!U||!U.prototype||!U.prototype.findChild,G=a&&l((function(){return w(j({},`a`,{get:function(){return j(this,`a`,{value:7}).a}})).a!=7}))?function(e,t,n){var r=A(V,t);r&&delete V[t],j(e,t,n),r&&e!==V&&j(V,t,r)}:j,te=function(e){var t=z[e]=w(M.prototype);return t._k=e,t},ne=H&&typeof M.iterator==`symbol`?function(e){return typeof e==`symbol`}:function(e){return e instanceof M},K=function(e,t,n){return e===V&&K(B,t,n),v(e),t=S(t,!0),v(n),i(z,t)?(n.enumerable?(i(e,F)&&e[F][t]&&(e[F][t]=!1),n=w(n,{enumerable:C(0,!1)})):(i(e,F)||j(e,F,C(1,{})),e[F][t]=!0),G(e,t,n)):j(e,t,n)},re=function(e,t){v(e);for(var n,r=g(t=x(t)),i=0,a=r.length;a>i;)K(e,n=r[i++],t[n]);return e},q=function(e){var t=L.call(this,e=S(e,!0));return!(this===V&&i(z,e)&&!i(B,e))&&(!(t||!i(this,e)||!i(z,e)||i(this,F)&&this[F][e])||t)},J=function(e,t){if(e=x(e),t=S(t,!0),e!==V||!i(z,t)||i(B,t)){var n=A(e,t);return!n||!i(z,t)||i(e,F)&&e[F][t]||(n.enumerable=!0),n}},Y=function(e){for(var t,n=ee(x(e)),r=[],a=0;n.length>a;)i(z,t=n[a++])||t==F||t==c||r.push(t);return r},X=function(e){for(var t,n=e===V,r=ee(n?B:x(e)),a=[],o=0;r.length>o;)!i(z,t=r[o++])||n&&!i(V,t)||a.push(z[t]);return a};H||(s((M=function(){if(this instanceof M)throw TypeError(`Symbol is not a constructor!`);var e=f(arguments.length>0?arguments[0]:void 0),t=function(n){this===V&&t.call(B,n),i(this,F)&&i(this[F],e)&&(this[F][e]=!1),G(this,e,C(1,n))};return a&&W&&G(V,e,{configurable:!0,set:t}),te(e)}).prototype,`toString`,(function(){return this._k})),E.f=J,O.f=K,n(41).f=T.f=Y,n(19).f=q,D.f=X,a&&!n(14)&&s(V,`propertyIsEnumerable`,q,!0),m.f=function(e){return te(p(e))}),o(o.G+o.W+o.F*!H,{Symbol:M});for(var ie=`hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables`.split(`,`),Z=0;ie.length>Z;)p(ie[Z++]);for(var ae=k(p.store),oe=0;ae.length>oe;)h(ae[oe++]);o(o.S+o.F*!H,`Symbol`,{for:function(e){return i(R,e+=``)?R[e]:R[e]=M(e)},keyFor:function(e){if(!ne(e))throw TypeError(e+` is not a symbol!`);for(var t in R)if(R[t]===e)return t},useSetter:function(){W=!0},useSimple:function(){W=!1}}),o(o.S+o.F*!H,`Object`,{create:function(e,t){return t===void 0?w(e):re(w(e),t)},defineProperty:K,defineProperties:re,getOwnPropertyDescriptor:J,getOwnPropertyNames:Y,getOwnPropertySymbols:X});var se=l((function(){D.f(1)}));o(o.S+o.F*se,`Object`,{getOwnPropertySymbols:function(e){return D.f(b(e))}}),N&&o(o.S+o.F*(!H||l((function(){var e=M();return P([e])!=`[null]`||P({a:e})!=`{}`||P(Object(e))!=`{}`}))),`JSON`,{stringify:function(e){for(var t,n,r=[e],i=1;arguments.length>i;)r.push(arguments[i++]);if(n=t=r[1],(y(t)||e!==void 0)&&!ne(e))return _(t)||(t=function(e,t){if(typeof n==`function`&&(t=n.call(this,e,t)),!ne(t))return t}),r[1]=t,P.apply(N,r)}}),M.prototype[I]||n(6)(M.prototype,I,M.prototype.valueOf),d(M,`Symbol`),d(Math,`Math`,!0),d(r.JSON,`JSON`,!0)},function(e,t,n){var r=n(17)(`meta`),i=n(11),a=n(5),o=n(7).f,s=0,c=Object.isExtensible||function(){return!0},l=!n(8)((function(){return c(Object.preventExtensions({}))})),u=function(e){o(e,r,{value:{i:`O`+ ++s,w:{}}})},d=e.exports={KEY:r,NEED:!1,fastKey:function(e,t){if(!i(e))return typeof e==`symbol`?e:(typeof e==`string`?`S`:`P`)+e;if(!a(e,r)){if(!c(e))return`F`;if(!t)return`E`;u(e)}return e[r].i},getWeak:function(e,t){if(!a(e,r)){if(!c(e))return!0;if(!t)return!1;u(e)}return e[r].w},onFreeze:function(e){return l&&d.NEED&&c(e)&&!a(e,r)&&u(e),e}}},function(e,t,n){var r=n(13),i=n(32),a=n(19);e.exports=function(e){var t=r(e),n=i.f;if(n)for(var o,s=n(e),c=a.f,l=0;s.length>l;)c.call(e,o=s[l++])&&t.push(o);return t}},function(e,t,n){var r=n(24);e.exports=Array.isArray||function(e){return r(e)==`Array`}},function(e,t,n){var r=n(9),i=n(41).f,a={}.toString,o=typeof window==`object`&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return o&&a.call(e)==`[object Window]`?function(e){try{return i(e)}catch{return o.slice()}}(e):i(r(e))}},function(e,t,n){var r=n(19),i=n(16),a=n(9),o=n(23),s=n(5),c=n(35),l=Object.getOwnPropertyDescriptor;t.f=n(4)?l:function(e,t){if(e=a(e),t=o(t,!0),c)try{return l(e,t)}catch{}if(s(e,t))return i(!r.f.call(e,t),e[t])}},function(e,t){},function(e,t,n){n(31)(`asyncIterator`)},function(e,t,n){n(31)(`observable`)},function(e,t,n){t.__esModule=!0;var r;t.default=((r=n(77))&&r.__esModule?r:{default:r}).default||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}},function(e,t,n){e.exports={default:n(78),__esModule:!0}},function(e,t,n){n(79),e.exports=n(1).Object.assign},function(e,t,n){var r=n(15);r(r.S+r.F,`Object`,{assign:n(80)})},function(e,t,n){var r=n(4),i=n(13),a=n(32),o=n(19),s=n(18),c=n(40),l=Object.assign;e.exports=!l||n(8)((function(){var e={},t={},n=Symbol(),r=`abcdefghijklmnopqrst`;return e[n]=7,r.split(``).forEach((function(e){t[e]=e})),l({},e)[n]!=7||Object.keys(l({},t)).join(``)!=r}))?function(e,t){for(var n=s(e),l=arguments.length,u=1,d=a.f,f=o.f;l>u;)for(var p,m=c(arguments[u++]),h=d?i(m).concat(d(m)):i(m),g=h.length,_=0;g>_;)p=h[_++],r&&!f.call(m,p)||(n[p]=m[p]);return n}:l},function(e,t,n){t.__esModule=!0;var r=a(n(82)),i=a(n(85));function a(e){return e&&e.__esModule?e:{default:e}}t.default=function(e,t){if(Array.isArray(e))return e;if((0,r.default)(Object(e)))return function(e,t){var n=[],r=!0,a=!1,o=void 0;try{for(var s,c=(0,i.default)(e);!(r=(s=c.next()).done)&&(n.push(s.value),!t||n.length!==t);r=!0);}catch(e){a=!0,o=e}finally{try{!r&&c.return&&c.return()}finally{if(a)throw o}}return n}(e,t);throw TypeError(`Invalid attempt to destructure non-iterable instance`)}},function(e,t,n){e.exports={default:n(83),__esModule:!0}},function(e,t,n){n(29),n(20),e.exports=n(84)},function(e,t,n){var r=n(42),i=n(2)(`iterator`),a=n(12);e.exports=n(1).isIterable=function(e){var t=Object(e);return t[i]!==void 0||`@@iterator`in t||a.hasOwnProperty(r(t))}},function(e,t,n){e.exports={default:n(86),__esModule:!0}},function(e,t,n){n(29),n(20),e.exports=n(87)},function(e,t,n){var r=n(10),i=n(88);e.exports=n(1).getIterator=function(e){var t=i(e);if(typeof t!=`function`)throw TypeError(e+` is not iterable!`);return r(t.call(e))}},function(e,t,n){var r=n(42),i=n(2)(`iterator`),a=n(12);e.exports=n(1).getIteratorMethod=function(e){if(e!=null)return e[i]||e[`@@iterator`]||a[r(e)]}},function(e,t,n){e.exports={default:n(90),__esModule:!0}},function(e,t,n){n(91),e.exports=n(1).Object.keys},function(e,t,n){var r=n(18),i=n(13);n(92)(`keys`,(function(){return function(e){return i(r(e))}}))},function(e,t,n){var r=n(15),i=n(1),a=n(8);e.exports=function(e,t){var n=(i.Object||{})[e]||Object[e],o={};o[e]=t(n),r(r.S+r.F*a((function(){n(1)})),`Object`,o)}},function(e,t,n){(function(t){var n=[[`ary`,128],[`bind`,1],[`bindKey`,2],[`curry`,8],[`curryRight`,16],[`flip`,512],[`partial`,32],[`partialRight`,64],[`rearg`,256]],r=/^\s+|\s+$/g,i=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,a=/\{\n\/\* \[wrapped with (.+)\] \*/,o=/,? & /,s=/^[-+]0x[0-9a-f]+$/i,c=/^0b[01]+$/i,l=/^\[object .+?Constructor\]$/,u=/^0o[0-7]+$/i,d=/^(?:0|[1-9]\d*)$/,f=parseInt,p=typeof t==`object`&&t&&t.Object===Object&&t,m=typeof self==`object`&&self&&self.Object===Object&&self,h=p||m||Function(`return this`)();function g(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function _(e,t){return!!(e&&e.length)&&function(e,t,n){if(t!=t)return function(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}(e,v,n);for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}(e,t,0)>-1}function v(e){return e!=e}function y(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&r++;return r}function b(e,t){for(var n=-1,r=e.length,i=0,a=[];++n<r;){var o=e[n];o!==t&&o!==`__lodash_placeholder__`||(e[n]=`__lodash_placeholder__`,a[i++]=n)}return a}var x,S,C,w=Function.prototype,T=Object.prototype,E=h[`__core-js_shared__`],D=(x=/[^.]+$/.exec(E&&E.keys&&E.keys.IE_PROTO||``))?`Symbol(src)_1.`+x:``,O=w.toString,k=T.hasOwnProperty,A=T.toString,j=RegExp(`^`+O.call(k).replace(/[\\^$.*+?()[\]{}|]/g,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`),ee=Object.create,M=Math.max,N=Math.min,P=(S=W(Object,`defineProperty`),(C=W.name)&&C.length>2?S:void 0);function F(e){return Y(e)?ee(e):{}}function I(e){return!(!Y(e)||function(e){return!!D&&D in e}(e))&&(function(e){var t=Y(e)?A.call(e):``;return t==`[object Function]`||t==`[object GeneratorFunction]`}(e)||function(e){var t=!1;if(e!=null&&typeof e.toString!=`function`)try{t=!!(e+``)}catch{}return t}(e)?j:l).test(function(e){if(e!=null){try{return O.call(e)}catch{}try{return e+``}catch{}}return``}(e))}function L(e,t,n,r){for(var i=-1,a=e.length,o=n.length,s=-1,c=t.length,l=M(a-o,0),u=Array(c+l),d=!r;++s<c;)u[s]=t[s];for(;++i<o;)(d||i<a)&&(u[n[i]]=e[i]);for(;l--;)u[s++]=e[i++];return u}function R(e,t,n,r){for(var i=-1,a=e.length,o=-1,s=n.length,c=-1,l=t.length,u=M(a-s,0),d=Array(u+l),f=!r;++i<u;)d[i]=e[i];for(var p=i;++c<l;)d[p+c]=t[c];for(;++o<s;)(f||i<a)&&(d[p+n[o]]=e[i++]);return d}function z(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=F(e.prototype),r=e.apply(n,t);return Y(r)?r:n}}function B(e,t,n,r,i,a,o,s,c,l){var u=128&t,d=1&t,f=2&t,p=24&t,m=512&t,g=f?void 0:z(e);return function _(){for(var v=arguments.length,x=Array(v),S=v;S--;)x[S]=arguments[S];if(p)var C=U(_),w=y(x,C);if(r&&(x=L(x,r,i,p)),a&&(x=R(x,a,o,p)),v-=w,p&&v<l){var T=b(x,C);return V(e,t,B,_.placeholder,n,x,T,s,c,l-v)}var E=d?n:this,D=f?E[e]:e;return v=x.length,s?x=K(x,s):m&&v>1&&x.reverse(),u&&c<v&&(x.length=c),this&&this!==h&&this instanceof _&&(D=g||z(D)),D.apply(E,x)}}function V(e,t,n,r,i,a,o,s,c,l){var u=8&t;t|=u?32:64,4&(t&=~(u?64:32))||(t&=-4);var d=n(e,t,i,u?a:void 0,u?o:void 0,u?void 0:a,u?void 0:o,s,c,l);return d.placeholder=r,re(d,e,t)}function H(e,t,n,r,i,a,o,s){var c=2&t;if(!c&&typeof e!=`function`)throw TypeError(`Expected a function`);var l=r?r.length:0;if(l||(t&=-97,r=i=void 0),o=o===void 0?o:M(ie(o),0),s=s===void 0?s:ie(s),l-=i?i.length:0,64&t){var u=r,d=i;r=i=void 0}var f=[e,t,n,r,i,u,d,a,o,s];if(e=f[0],t=f[1],n=f[2],r=f[3],i=f[4],!(s=f[9]=f[9]==null?c?0:e.length:M(f[9]-l,0))&&24&t&&(t&=-25),t&&t!=1)p=t==8||t==16?function(e,t,n){var r=z(e);return function i(){for(var a=arguments.length,o=Array(a),s=a,c=U(i);s--;)o[s]=arguments[s];var l=a<3&&o[0]!==c&&o[a-1]!==c?[]:b(o,c);return(a-=l.length)<n?V(e,t,B,i.placeholder,void 0,o,l,void 0,void 0,n-a):g(this&&this!==h&&this instanceof i?r:e,this,o)}}(e,t,s):t!=32&&t!=33||i.length?B.apply(void 0,f):function(e,t,n,r){var i=1&t,a=z(e);return function t(){for(var o=-1,s=arguments.length,c=-1,l=r.length,u=Array(l+s),d=this&&this!==h&&this instanceof t?a:e;++c<l;)u[c]=r[c];for(;s--;)u[c++]=arguments[++o];return g(d,i?n:this,u)}}(e,t,n,r);else var p=function(e,t,n){var r=1&t,i=z(e);return function t(){return(this&&this!==h&&this instanceof t?i:e).apply(r?n:this,arguments)}}(e,t,n);return re(p,e,t)}function U(e){return e.placeholder}function W(e,t){var n=function(e,t){return e==null?void 0:e[t]}(e,t);return I(n)?n:void 0}function G(e){var t=e.match(a);return t?t[1].split(o):[]}function te(e,t){var n=t.length,r=n-1;return t[r]=(n>1?`& `:``)+t[r],t=t.join(n>2?`, `:` `),e.replace(i,`{
|
|
3
3
|
/* [wrapped with `+t+`] */
|
|
4
4
|
`)}function ne(e,t){return!!(t??=9007199254740991)&&(typeof e==`number`||d.test(e))&&e>-1&&e%1==0&&e<t}function K(e,t){for(var n=e.length,r=N(t.length,n),i=function(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}(e);r--;){var a=t[r];e[r]=ne(a,n)?i[a]:void 0}return e}var re=P?function(e,t,n){var r,i=t+``;return P(e,`toString`,{configurable:!0,enumerable:!1,value:(r=te(i,q(G(i),n)),function(){return r})})}:function(e){return e};function q(e,t){return function(e,t){for(var n=-1,r=e?e.length:0;++n<r&&!1!==t(e[n],n,e););}(n,(function(n){var r=`_.`+n[0];t&n[1]&&!_(e,r)&&e.push(r)})),e.sort()}function J(e,t,n){var r=H(e,8,void 0,void 0,void 0,void 0,void 0,t=n?void 0:t);return r.placeholder=J.placeholder,r}function Y(e){var t=typeof e;return!!e&&(t==`object`||t==`function`)}function X(e){return e?(e=function(e){if(typeof e==`number`)return e;if(function(e){return typeof e==`symbol`||function(e){return!!e&&typeof e==`object`}(e)&&A.call(e)==`[object Symbol]`}(e))return NaN;if(Y(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=Y(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=e.replace(r,``);var n=c.test(e);return n||u.test(e)?f(e.slice(2),n?2:8):s.test(e)?NaN:+e}(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:e===0?e:0}function ie(e){var t=X(e),n=t%1;return t==t?n?t-n:t:0}J.placeholder={},e.exports=J}).call(this,n(43))},function(e,t,n){function r(e){return e&&e.__esModule?e.default:e}t.__esModule=!0,t.threezerotwofour=r(n(95)),t.apathy=r(n(96)),t.ashes=r(n(97)),t.atelierDune=r(n(98)),t.atelierForest=r(n(99)),t.atelierHeath=r(n(100)),t.atelierLakeside=r(n(101)),t.atelierSeaside=r(n(102)),t.bespin=r(n(103)),t.brewer=r(n(104)),t.bright=r(n(105)),t.chalk=r(n(106)),t.codeschool=r(n(107)),t.colors=r(n(108)),t.default=r(n(109)),t.eighties=r(n(110)),t.embers=r(n(111)),t.flat=r(n(112)),t.google=r(n(113)),t.grayscale=r(n(114)),t.greenscreen=r(n(115)),t.harmonic=r(n(116)),t.hopscotch=r(n(117)),t.isotope=r(n(118)),t.marrakesh=r(n(119)),t.mocha=r(n(120)),t.monokai=r(n(121)),t.ocean=r(n(122)),t.paraiso=r(n(123)),t.pop=r(n(124)),t.railscasts=r(n(125)),t.shapeshifter=r(n(126)),t.solarized=r(n(127)),t.summerfruit=r(n(128)),t.tomorrow=r(n(129)),t.tube=r(n(130)),t.twilight=r(n(131))},function(e,t,n){t.__esModule=!0,t.default={scheme:`threezerotwofour`,author:`jan t. sott (http://github.com/idleberg)`,base00:`#090300`,base01:`#3a3432`,base02:`#4a4543`,base03:`#5c5855`,base04:`#807d7c`,base05:`#a5a2a2`,base06:`#d6d5d4`,base07:`#f7f7f7`,base08:`#db2d20`,base09:`#e8bbd0`,base0A:`#fded02`,base0B:`#01a252`,base0C:`#b5e4f4`,base0D:`#01a0e4`,base0E:`#a16a94`,base0F:`#cdab53`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`apathy`,author:`jannik siebert (https://github.com/janniks)`,base00:`#031A16`,base01:`#0B342D`,base02:`#184E45`,base03:`#2B685E`,base04:`#5F9C92`,base05:`#81B5AC`,base06:`#A7CEC8`,base07:`#D2E7E4`,base08:`#3E9688`,base09:`#3E7996`,base0A:`#3E4C96`,base0B:`#883E96`,base0C:`#963E4C`,base0D:`#96883E`,base0E:`#4C963E`,base0F:`#3E965B`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`ashes`,author:`jannik siebert (https://github.com/janniks)`,base00:`#1C2023`,base01:`#393F45`,base02:`#565E65`,base03:`#747C84`,base04:`#ADB3BA`,base05:`#C7CCD1`,base06:`#DFE2E5`,base07:`#F3F4F5`,base08:`#C7AE95`,base09:`#C7C795`,base0A:`#AEC795`,base0B:`#95C7AE`,base0C:`#95AEC7`,base0D:`#AE95C7`,base0E:`#C795AE`,base0F:`#C79595`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`atelier dune`,author:`bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/dune)`,base00:`#20201d`,base01:`#292824`,base02:`#6e6b5e`,base03:`#7d7a68`,base04:`#999580`,base05:`#a6a28c`,base06:`#e8e4cf`,base07:`#fefbec`,base08:`#d73737`,base09:`#b65611`,base0A:`#cfb017`,base0B:`#60ac39`,base0C:`#1fad83`,base0D:`#6684e1`,base0E:`#b854d4`,base0F:`#d43552`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`atelier forest`,author:`bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/forest)`,base00:`#1b1918`,base01:`#2c2421`,base02:`#68615e`,base03:`#766e6b`,base04:`#9c9491`,base05:`#a8a19f`,base06:`#e6e2e0`,base07:`#f1efee`,base08:`#f22c40`,base09:`#df5320`,base0A:`#d5911a`,base0B:`#5ab738`,base0C:`#00ad9c`,base0D:`#407ee7`,base0E:`#6666ea`,base0F:`#c33ff3`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`atelier heath`,author:`bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/heath)`,base00:`#1b181b`,base01:`#292329`,base02:`#695d69`,base03:`#776977`,base04:`#9e8f9e`,base05:`#ab9bab`,base06:`#d8cad8`,base07:`#f7f3f7`,base08:`#ca402b`,base09:`#a65926`,base0A:`#bb8a35`,base0B:`#379a37`,base0C:`#159393`,base0D:`#516aec`,base0E:`#7b59c0`,base0F:`#cc33cc`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`atelier lakeside`,author:`bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/lakeside/)`,base00:`#161b1d`,base01:`#1f292e`,base02:`#516d7b`,base03:`#5a7b8c`,base04:`#7195a8`,base05:`#7ea2b4`,base06:`#c1e4f6`,base07:`#ebf8ff`,base08:`#d22d72`,base09:`#935c25`,base0A:`#8a8a0f`,base0B:`#568c3b`,base0C:`#2d8f6f`,base0D:`#257fad`,base0E:`#5d5db1`,base0F:`#b72dd2`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`atelier seaside`,author:`bram de haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/seaside/)`,base00:`#131513`,base01:`#242924`,base02:`#5e6e5e`,base03:`#687d68`,base04:`#809980`,base05:`#8ca68c`,base06:`#cfe8cf`,base07:`#f0fff0`,base08:`#e6193c`,base09:`#87711d`,base0A:`#c3c322`,base0B:`#29a329`,base0C:`#1999b3`,base0D:`#3d62f5`,base0E:`#ad2bee`,base0F:`#e619c3`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`bespin`,author:`jan t. sott`,base00:`#28211c`,base01:`#36312e`,base02:`#5e5d5c`,base03:`#666666`,base04:`#797977`,base05:`#8a8986`,base06:`#9d9b97`,base07:`#baae9e`,base08:`#cf6a4c`,base09:`#cf7d34`,base0A:`#f9ee98`,base0B:`#54be0d`,base0C:`#afc4db`,base0D:`#5ea6ea`,base0E:`#9b859d`,base0F:`#937121`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`brewer`,author:`timothée poisot (http://github.com/tpoisot)`,base00:`#0c0d0e`,base01:`#2e2f30`,base02:`#515253`,base03:`#737475`,base04:`#959697`,base05:`#b7b8b9`,base06:`#dadbdc`,base07:`#fcfdfe`,base08:`#e31a1c`,base09:`#e6550d`,base0A:`#dca060`,base0B:`#31a354`,base0C:`#80b1d3`,base0D:`#3182bd`,base0E:`#756bb1`,base0F:`#b15928`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`bright`,author:`chris kempson (http://chriskempson.com)`,base00:`#000000`,base01:`#303030`,base02:`#505050`,base03:`#b0b0b0`,base04:`#d0d0d0`,base05:`#e0e0e0`,base06:`#f5f5f5`,base07:`#ffffff`,base08:`#fb0120`,base09:`#fc6d24`,base0A:`#fda331`,base0B:`#a1c659`,base0C:`#76c7b7`,base0D:`#6fb3d2`,base0E:`#d381c3`,base0F:`#be643c`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`chalk`,author:`chris kempson (http://chriskempson.com)`,base00:`#151515`,base01:`#202020`,base02:`#303030`,base03:`#505050`,base04:`#b0b0b0`,base05:`#d0d0d0`,base06:`#e0e0e0`,base07:`#f5f5f5`,base08:`#fb9fb1`,base09:`#eda987`,base0A:`#ddb26f`,base0B:`#acc267`,base0C:`#12cfc0`,base0D:`#6fc2ef`,base0E:`#e1a3ee`,base0F:`#deaf8f`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`codeschool`,author:`brettof86`,base00:`#232c31`,base01:`#1c3657`,base02:`#2a343a`,base03:`#3f4944`,base04:`#84898c`,base05:`#9ea7a6`,base06:`#a7cfa3`,base07:`#b5d8f6`,base08:`#2a5491`,base09:`#43820d`,base0A:`#a03b1e`,base0B:`#237986`,base0C:`#b02f30`,base0D:`#484d79`,base0E:`#c59820`,base0F:`#c98344`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`colors`,author:`mrmrs (http://clrs.cc)`,base00:`#111111`,base01:`#333333`,base02:`#555555`,base03:`#777777`,base04:`#999999`,base05:`#bbbbbb`,base06:`#dddddd`,base07:`#ffffff`,base08:`#ff4136`,base09:`#ff851b`,base0A:`#ffdc00`,base0B:`#2ecc40`,base0C:`#7fdbff`,base0D:`#0074d9`,base0E:`#b10dc9`,base0F:`#85144b`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`default`,author:`chris kempson (http://chriskempson.com)`,base00:`#181818`,base01:`#282828`,base02:`#383838`,base03:`#585858`,base04:`#b8b8b8`,base05:`#d8d8d8`,base06:`#e8e8e8`,base07:`#f8f8f8`,base08:`#ab4642`,base09:`#dc9656`,base0A:`#f7ca88`,base0B:`#a1b56c`,base0C:`#86c1b9`,base0D:`#7cafc2`,base0E:`#ba8baf`,base0F:`#a16946`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`eighties`,author:`chris kempson (http://chriskempson.com)`,base00:`#2d2d2d`,base01:`#393939`,base02:`#515151`,base03:`#747369`,base04:`#a09f93`,base05:`#d3d0c8`,base06:`#e8e6df`,base07:`#f2f0ec`,base08:`#f2777a`,base09:`#f99157`,base0A:`#ffcc66`,base0B:`#99cc99`,base0C:`#66cccc`,base0D:`#6699cc`,base0E:`#cc99cc`,base0F:`#d27b53`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`embers`,author:`jannik siebert (https://github.com/janniks)`,base00:`#16130F`,base01:`#2C2620`,base02:`#433B32`,base03:`#5A5047`,base04:`#8A8075`,base05:`#A39A90`,base06:`#BEB6AE`,base07:`#DBD6D1`,base08:`#826D57`,base09:`#828257`,base0A:`#6D8257`,base0B:`#57826D`,base0C:`#576D82`,base0D:`#6D5782`,base0E:`#82576D`,base0F:`#825757`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`flat`,author:`chris kempson (http://chriskempson.com)`,base00:`#2C3E50`,base01:`#34495E`,base02:`#7F8C8D`,base03:`#95A5A6`,base04:`#BDC3C7`,base05:`#e0e0e0`,base06:`#f5f5f5`,base07:`#ECF0F1`,base08:`#E74C3C`,base09:`#E67E22`,base0A:`#F1C40F`,base0B:`#2ECC71`,base0C:`#1ABC9C`,base0D:`#3498DB`,base0E:`#9B59B6`,base0F:`#be643c`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`google`,author:`seth wright (http://sethawright.com)`,base00:`#1d1f21`,base01:`#282a2e`,base02:`#373b41`,base03:`#969896`,base04:`#b4b7b4`,base05:`#c5c8c6`,base06:`#e0e0e0`,base07:`#ffffff`,base08:`#CC342B`,base09:`#F96A38`,base0A:`#FBA922`,base0B:`#198844`,base0C:`#3971ED`,base0D:`#3971ED`,base0E:`#A36AC7`,base0F:`#3971ED`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`grayscale`,author:`alexandre gavioli (https://github.com/alexx2/)`,base00:`#101010`,base01:`#252525`,base02:`#464646`,base03:`#525252`,base04:`#ababab`,base05:`#b9b9b9`,base06:`#e3e3e3`,base07:`#f7f7f7`,base08:`#7c7c7c`,base09:`#999999`,base0A:`#a0a0a0`,base0B:`#8e8e8e`,base0C:`#868686`,base0D:`#686868`,base0E:`#747474`,base0F:`#5e5e5e`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`green screen`,author:`chris kempson (http://chriskempson.com)`,base00:`#001100`,base01:`#003300`,base02:`#005500`,base03:`#007700`,base04:`#009900`,base05:`#00bb00`,base06:`#00dd00`,base07:`#00ff00`,base08:`#007700`,base09:`#009900`,base0A:`#007700`,base0B:`#00bb00`,base0C:`#005500`,base0D:`#009900`,base0E:`#00bb00`,base0F:`#005500`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`harmonic16`,author:`jannik siebert (https://github.com/janniks)`,base00:`#0b1c2c`,base01:`#223b54`,base02:`#405c79`,base03:`#627e99`,base04:`#aabcce`,base05:`#cbd6e2`,base06:`#e5ebf1`,base07:`#f7f9fb`,base08:`#bf8b56`,base09:`#bfbf56`,base0A:`#8bbf56`,base0B:`#56bf8b`,base0C:`#568bbf`,base0D:`#8b56bf`,base0E:`#bf568b`,base0F:`#bf5656`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`hopscotch`,author:`jan t. sott`,base00:`#322931`,base01:`#433b42`,base02:`#5c545b`,base03:`#797379`,base04:`#989498`,base05:`#b9b5b8`,base06:`#d5d3d5`,base07:`#ffffff`,base08:`#dd464c`,base09:`#fd8b19`,base0A:`#fdcc59`,base0B:`#8fc13e`,base0C:`#149b93`,base0D:`#1290bf`,base0E:`#c85e7c`,base0F:`#b33508`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`isotope`,author:`jan t. sott`,base00:`#000000`,base01:`#404040`,base02:`#606060`,base03:`#808080`,base04:`#c0c0c0`,base05:`#d0d0d0`,base06:`#e0e0e0`,base07:`#ffffff`,base08:`#ff0000`,base09:`#ff9900`,base0A:`#ff0099`,base0B:`#33ff00`,base0C:`#00ffff`,base0D:`#0066ff`,base0E:`#cc00ff`,base0F:`#3300ff`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`marrakesh`,author:`alexandre gavioli (http://github.com/alexx2/)`,base00:`#201602`,base01:`#302e00`,base02:`#5f5b17`,base03:`#6c6823`,base04:`#86813b`,base05:`#948e48`,base06:`#ccc37a`,base07:`#faf0a5`,base08:`#c35359`,base09:`#b36144`,base0A:`#a88339`,base0B:`#18974e`,base0C:`#75a738`,base0D:`#477ca1`,base0E:`#8868b3`,base0F:`#b3588e`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`mocha`,author:`chris kempson (http://chriskempson.com)`,base00:`#3B3228`,base01:`#534636`,base02:`#645240`,base03:`#7e705a`,base04:`#b8afad`,base05:`#d0c8c6`,base06:`#e9e1dd`,base07:`#f5eeeb`,base08:`#cb6077`,base09:`#d28b71`,base0A:`#f4bc87`,base0B:`#beb55b`,base0C:`#7bbda4`,base0D:`#8ab3b5`,base0E:`#a89bb9`,base0F:`#bb9584`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`monokai`,author:`wimer hazenberg (http://www.monokai.nl)`,base00:`#272822`,base01:`#383830`,base02:`#49483e`,base03:`#75715e`,base04:`#a59f85`,base05:`#f8f8f2`,base06:`#f5f4f1`,base07:`#f9f8f5`,base08:`#f92672`,base09:`#fd971f`,base0A:`#f4bf75`,base0B:`#a6e22e`,base0C:`#a1efe4`,base0D:`#66d9ef`,base0E:`#ae81ff`,base0F:`#cc6633`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`ocean`,author:`chris kempson (http://chriskempson.com)`,base00:`#2b303b`,base01:`#343d46`,base02:`#4f5b66`,base03:`#65737e`,base04:`#a7adba`,base05:`#c0c5ce`,base06:`#dfe1e8`,base07:`#eff1f5`,base08:`#bf616a`,base09:`#d08770`,base0A:`#ebcb8b`,base0B:`#a3be8c`,base0C:`#96b5b4`,base0D:`#8fa1b3`,base0E:`#b48ead`,base0F:`#ab7967`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`paraiso`,author:`jan t. sott`,base00:`#2f1e2e`,base01:`#41323f`,base02:`#4f424c`,base03:`#776e71`,base04:`#8d8687`,base05:`#a39e9b`,base06:`#b9b6b0`,base07:`#e7e9db`,base08:`#ef6155`,base09:`#f99b15`,base0A:`#fec418`,base0B:`#48b685`,base0C:`#5bc4bf`,base0D:`#06b6ef`,base0E:`#815ba4`,base0F:`#e96ba8`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`pop`,author:`chris kempson (http://chriskempson.com)`,base00:`#000000`,base01:`#202020`,base02:`#303030`,base03:`#505050`,base04:`#b0b0b0`,base05:`#d0d0d0`,base06:`#e0e0e0`,base07:`#ffffff`,base08:`#eb008a`,base09:`#f29333`,base0A:`#f8ca12`,base0B:`#37b349`,base0C:`#00aabb`,base0D:`#0e5a94`,base0E:`#b31e8d`,base0F:`#7a2d00`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`railscasts`,author:`ryan bates (http://railscasts.com)`,base00:`#2b2b2b`,base01:`#272935`,base02:`#3a4055`,base03:`#5a647e`,base04:`#d4cfc9`,base05:`#e6e1dc`,base06:`#f4f1ed`,base07:`#f9f7f3`,base08:`#da4939`,base09:`#cc7833`,base0A:`#ffc66d`,base0B:`#a5c261`,base0C:`#519f50`,base0D:`#6d9cbe`,base0E:`#b6b3eb`,base0F:`#bc9458`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`shapeshifter`,author:`tyler benziger (http://tybenz.com)`,base00:`#000000`,base01:`#040404`,base02:`#102015`,base03:`#343434`,base04:`#555555`,base05:`#ababab`,base06:`#e0e0e0`,base07:`#f9f9f9`,base08:`#e92f2f`,base09:`#e09448`,base0A:`#dddd13`,base0B:`#0ed839`,base0C:`#23edda`,base0D:`#3b48e3`,base0E:`#f996e2`,base0F:`#69542d`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`solarized`,author:`ethan schoonover (http://ethanschoonover.com/solarized)`,base00:`#002b36`,base01:`#073642`,base02:`#586e75`,base03:`#657b83`,base04:`#839496`,base05:`#93a1a1`,base06:`#eee8d5`,base07:`#fdf6e3`,base08:`#dc322f`,base09:`#cb4b16`,base0A:`#b58900`,base0B:`#859900`,base0C:`#2aa198`,base0D:`#268bd2`,base0E:`#6c71c4`,base0F:`#d33682`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`summerfruit`,author:`christopher corley (http://cscorley.github.io/)`,base00:`#151515`,base01:`#202020`,base02:`#303030`,base03:`#505050`,base04:`#B0B0B0`,base05:`#D0D0D0`,base06:`#E0E0E0`,base07:`#FFFFFF`,base08:`#FF0086`,base09:`#FD8900`,base0A:`#ABA800`,base0B:`#00C918`,base0C:`#1faaaa`,base0D:`#3777E6`,base0E:`#AD00A1`,base0F:`#cc6633`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`tomorrow`,author:`chris kempson (http://chriskempson.com)`,base00:`#1d1f21`,base01:`#282a2e`,base02:`#373b41`,base03:`#969896`,base04:`#b4b7b4`,base05:`#c5c8c6`,base06:`#e0e0e0`,base07:`#ffffff`,base08:`#cc6666`,base09:`#de935f`,base0A:`#f0c674`,base0B:`#b5bd68`,base0C:`#8abeb7`,base0D:`#81a2be`,base0E:`#b294bb`,base0F:`#a3685a`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`london tube`,author:`jan t. sott`,base00:`#231f20`,base01:`#1c3f95`,base02:`#5a5758`,base03:`#737171`,base04:`#959ca1`,base05:`#d9d8d8`,base06:`#e7e7e8`,base07:`#ffffff`,base08:`#ee2e24`,base09:`#f386a1`,base0A:`#ffd204`,base0B:`#00853e`,base0C:`#85cebc`,base0D:`#009ddc`,base0E:`#98005d`,base0F:`#b06110`},e.exports=t.default},function(e,t,n){t.__esModule=!0,t.default={scheme:`twilight`,author:`david hart (http://hart-dev.com)`,base00:`#1e1e1e`,base01:`#323537`,base02:`#464b50`,base03:`#5f5a60`,base04:`#838184`,base05:`#a7a7a7`,base06:`#c3c3c3`,base07:`#ffffff`,base08:`#cf6a4c`,base09:`#cda869`,base0A:`#f9ee98`,base0B:`#8f9d6a`,base0C:`#afc4db`,base0D:`#7587a6`,base0E:`#9b859d`,base0F:`#9b703f`},e.exports=t.default},function(e,t,n){var r=n(33);function i(e){var t=Math.round(r(e,0,255)).toString(16);return t.length==1?`0`+t:t}e.exports=function(e){var t=e.length===4?i(255*e[3]):``;return`#`+i(e[0])+i(e[1])+i(e[2])+t}},function(e,t,n){var r=n(134),i=n(135),a=n(136),o=n(137),s={"#":i,hsl:function(e){var t=r(e),n=o(t);return t.length===4&&n.push(t[3]),n},rgb:a};function c(e){for(var t in s)if(e.indexOf(t)===0)return s[t](e)}c.rgb=a,c.hsl=r,c.hex=i,e.exports=c},function(e,t,n){var r=n(44),i=n(33);function a(e,t){switch(e=parseFloat(e),t){case 0:return i(e,0,360);case 1:case 2:return i(e,0,100);case 3:return i(e,0,1)}}e.exports=function(e){return r(e).map(a)}},function(e,t){e.exports=function(e){e.length!==4&&e.length!==5||(e=function(e){for(var t=`#`,n=1;n<e.length;n++){var r=e.charAt(n);t+=r+r}return t}(e));var t=[parseInt(e.substring(1,3),16),parseInt(e.substring(3,5),16),parseInt(e.substring(5,7),16)];if(e.length===9){var n=parseFloat((parseInt(e.substring(7,9),16)/255).toFixed(2));t.push(n)}return t}},function(e,t,n){var r=n(44),i=n(33);function a(e,t){return t<3?e.indexOf(`%`)==-1?i(parseInt(e,10),0,255):Math.round(255*i(parseInt(e,10),0,100)/100):i(parseFloat(e),0,1)}e.exports=function(e){return r(e).map(a)}},function(e,t){e.exports=function(e){var t,n,r,i,a,o=e[0]/360,s=e[1]/100,c=e[2]/100;if(s==0)return[a=255*c,a,a];t=2*c-(n=c<.5?c*(1+s):c+s-c*s),i=[0,0,0];for(var l=0;l<3;l++)(r=o+1/3*-(l-1))<0&&r++,r>1&&r--,a=6*r<1?t+6*(n-t)*r:2*r<1?n:3*r<2?t+(n-t)*(2/3-r)*6:t,i[l]=255*a;return i}},function(e,t,n){(function(t){var n=typeof t==`object`&&t&&t.Object===Object&&t,r=typeof self==`object`&&self&&self.Object===Object&&self,i=n||r||Function(`return this`)();function a(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function o(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var s=Object.prototype,c=s.hasOwnProperty,l=s.toString,u=i.Symbol,d=s.propertyIsEnumerable,f=u?u.isConcatSpreadable:void 0,p=Math.max;function m(e){return h(e)||function(e){return function(e){return function(e){return!!e&&typeof e==`object`}(e)&&function(e){return e!=null&&function(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=9007199254740991}(e.length)&&!function(e){var t=function(e){var t=typeof e;return!!e&&(t==`object`||t==`function`)}(e)?l.call(e):``;return t==`[object Function]`||t==`[object GeneratorFunction]`}(e)}(e)}(e)&&c.call(e,`callee`)&&(!d.call(e,`callee`)||l.call(e)==`[object Arguments]`)}(e)||!!(f&&e&&e[f])}var h=Array.isArray,g,_,v;e.exports=(_=function(e){var t=(e=function e(t,n,r,i,a){var s=-1,c=t.length;for(r||=m,a||=[];++s<c;){var l=t[s];n>0&&r(l)?n>1?e(l,n-1,r,i,a):o(a,l):i||(a[a.length]=l)}return a}(e,1)).length,n=t;for(g&&e.reverse();n--;)if(typeof e[n]!=`function`)throw TypeError(`Expected a function`);return function(){for(var n=0,r=t?e[n].apply(this,arguments):arguments[0];++n<t;)r=e[n].call(this,r);return r}},v=p(v===void 0?_.length-1:v,0),function(){for(var e=arguments,t=-1,n=p(e.length-v,0),r=Array(n);++t<n;)r[t]=e[v+t];t=-1;for(var i=Array(v+1);++t<v;)i[t]=e[t];return i[v]=r,a(_,this,i)})}).call(this,n(43))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.yuv2rgb=function(e){var t,n,r,i=e[0],a=e[1],o=e[2];return t=1*i+0*a+1.13983*o,n=1*i+-.39465*a+-.5806*o,r=1*i+2.02311*a+0*o,t=Math.min(Math.max(0,t),1),n=Math.min(Math.max(0,n),1),r=Math.min(Math.max(0,r),1),[255*t,255*n,255*r]},t.rgb2yuv=function(e){var t=e[0]/255,n=e[1]/255,r=e[2]/255;return[.299*t+.587*n+.114*r,-.14713*t+-.28886*n+.436*r,.615*t+-.51499*n+-.10001*r]}},function(e,t,n){function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var i=n(141);e.exports=function(){function e(){r(this,`_callbacks`,void 0),r(this,`_isDispatching`,void 0),r(this,`_isHandled`,void 0),r(this,`_isPending`,void 0),r(this,`_lastID`,void 0),r(this,`_pendingPayload`,void 0),this._callbacks={},this._isDispatching=!1,this._isHandled={},this._isPending={},this._lastID=1}var t=e.prototype;return t.register=function(e){var t=`ID_`+this._lastID++;return this._callbacks[t]=e,t},t.unregister=function(e){this._callbacks[e]||i(!1),delete this._callbacks[e]},t.waitFor=function(e){this._isDispatching||i(!1);for(var t=0;t<e.length;t++){var n=e[t];this._isPending[n]?this._isHandled[n]||i(!1):(this._callbacks[n]||i(!1),this._invokeCallback(n))}},t.dispatch=function(e){this._isDispatching&&i(!1),this._startDispatching(e);try{for(var t in this._callbacks)this._isPending[t]||this._invokeCallback(t)}finally{this._stopDispatching()}},t.isDispatching=function(){return this._isDispatching},t._invokeCallback=function(e){this._isPending[e]=!0,this._callbacks[e](this._pendingPayload),this._isHandled[e]=!0},t._startDispatching=function(e){for(var t in this._callbacks)this._isPending[t]=!1,this._isHandled[t]=!1;this._pendingPayload=e,this._isDispatching=!0},t._stopDispatching=function(){delete this._pendingPayload,this._isDispatching=!1},e}()},function(e,t,n){e.exports=function(e,t){var n=[...arguments].slice(2);if(!e){var r;if(t===void 0)r=Error(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var i=0;(r=Error(t.replace(/%s/g,(function(){return String(n[i++])})))).name=`Invariant Violation`}throw r.framesToPop=1,r}}},function(e,t,n){function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?i(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function c(e,t,n){return t&&s(e.prototype,t),n&&s(e,n),e}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function f(e){return(f=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e})(e)}function p(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function m(e,t){return!t||f(t)!==`object`&&typeof t!=`function`?p(e):t}function h(e){var t=function(){if(typeof Reflect>`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch{return!1}}();return function(){var n,r=d(e);if(t){var i=d(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return m(this,n)}}n.r(t);var g=n(0),_=n.n(g);function v(){var e=this.constructor.getDerivedStateFromProps(this.props,this.state);e!=null&&this.setState(e)}function y(e){this.setState(function(t){return this.constructor.getDerivedStateFromProps(e,t)??null}.bind(this))}function b(e,t){try{var n=this.props,r=this.state;this.props=e,this.state=t,this.__reactInternalSnapshotFlag=!0,this.__reactInternalSnapshot=this.getSnapshotBeforeUpdate(n,r)}finally{this.props=n,this.state=r}}function x(e){var t=e.prototype;if(!t||!t.isReactComponent)throw Error(`Can only polyfill class components`);if(typeof e.getDerivedStateFromProps!=`function`&&typeof t.getSnapshotBeforeUpdate!=`function`)return e;var n=null,r=null,i=null;if(typeof t.componentWillMount==`function`?n=`componentWillMount`:typeof t.UNSAFE_componentWillMount==`function`&&(n=`UNSAFE_componentWillMount`),typeof t.componentWillReceiveProps==`function`?r=`componentWillReceiveProps`:typeof t.UNSAFE_componentWillReceiveProps==`function`&&(r=`UNSAFE_componentWillReceiveProps`),typeof t.componentWillUpdate==`function`?i=`componentWillUpdate`:typeof t.UNSAFE_componentWillUpdate==`function`&&(i=`UNSAFE_componentWillUpdate`),n!==null||r!==null||i!==null){var a=e.displayName||e.name,o=typeof e.getDerivedStateFromProps==`function`?`getDerivedStateFromProps()`:`getSnapshotBeforeUpdate()`;throw Error(`Unsafe legacy lifecycles will not be called for components using new component APIs.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$n as e,Bn as t,En as n,Et as r,Fn as i,Ft as a,Ot as o,Qn as s,Qt as c,St as l,Tt as u,Ut as d,Zn as f,_ as p,_r as m,br as h,bt as g,dr as _,dt as v,en as y,fr as b,hr as x,in as S,kn as C,mn as w,mr as T,nn as E,p as D,pr as O,rn as k,tn as A,wn as j,wr as M,wt as N,yr as P}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__113183188387379__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-D-gi6Mty.js";import{n as F,t as I}from"./Import-XKVP-nRT.js";import{C as ee,_ as L,a as R,b as z,i as B,n as te,o as V,r as ne,t as H,v as U,x as W,y as re}from"./index-PLY-IJik.js";var ie=t(s(`path`,{d:`M7.5 5.6 10 7 8.6 4.5 10 2 7.5 3.4 5 2l1.4 2.5L5 7zm12 9.8L17 14l1.4 2.5L17 19l2.5-1.4L22 19l-1.4-2.5L22 14zM22 2l-2.5 1.4L17 2l1.4 2.5L17 7l2.5-1.4L22 7l-1.4-2.5zm-7.63 5.29a.996.996 0 0 0-1.41 0L1.29 18.96c-.39.39-.39 1.02 0 1.41l2.34 2.34c.39.39 1.02.39 1.41 0L16.7 11.05c.39-.39.39-1.02 0-1.41zm-1.03 5.49-2.12-2.12 2.44-2.44 2.12 2.12z`}),`AutoFixHigh`),ae=t(s(`path`,{d:`M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z`}),`ChevronLeft`),oe=t(s(`path`,{d:`M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z`}),`ChevronRight`),se=t(s(`path`,{d:`M16 9v10H8V9zm-1.5-6h-5l-1 1H5v2h14V4h-3.5zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2z`}),`DeleteOutlined`),ce=t(s(`path`,{d:`M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z`}),`ExpandMore`),le=t(s(`path`,{d:`M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z`}),`NavigateBefore`);M();function ue(e){let t=z().getMonitor(),[n,r]=W(t,e);return x(()=>t.subscribeToOffsetChange(r)),x(()=>t.subscribeToStateChange(r)),n}var G;function de(){return G||(G=new Image,G.src=`data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==`),G}var K={wrapperRules:`_wrapperRules_147jt_8`,rootWrapper:`_rootWrapper_147jt_14`,bands:`_bands_147jt_26`,emptyRule:`_emptyRule_147jt_39`,emptyRuleText:`_emptyRuleText_147jt_51`},fe={switchesItem:`_switchesItem_1uv39_6`,switchesItemActive:`_switchesItemActive_1uv39_34`,iconTheme:`_iconTheme_1uv39_42`};M();var pe=({name:t,id:n,active:r,icon:i,adapter:a,socket:o,onDoubleClick:c,title:l,onTouchMove:u,style:d})=>e(`div`,{onDoubleClick:c,onTouchMove:u,title:D.t(l||t),className:p.clsx(fe.switchesItem,r&&fe.switchesItemActive,`block-${n}`),children:[s(R,{iconName:i,className:fe.iconTheme,adapter:a,socket:o,style:d}),s(`span`,{children:t?D.t(t):``})]},n),q={cardStyle:`_cardStyle_15e7l_1`,railTriggers:`_railTriggers_15e7l_25`,railConditions:`_railConditions_15e7l_29`,railActions:`_railActions_15e7l_33`,cardStyleActive:`_cardStyleActive_15e7l_37`,controlMenu:`_controlMenu_15e7l_46`,closeBtn:`_closeBtn_15e7l_64`,isDelete:`_isDelete_15e7l_106`,drag_mobile:`_drag_mobile_15e7l_125`};function J(e,t,n){let r;switch(e){case`actions`:if(n===`else`)return r={...t,actions:{...t[e],else:[...t[e].else]}},r;if(n===`then`)return r={...t,actions:{...t[e],then:[...t[e].then]}},r;throw console.error(`Unknown additionalParameter: ${n}`),Error(`Unknown additionalParameter: ${n}`);case`triggers`:return r={...t,triggers:[...t.triggers]},r;case`conditions`:return r={...t,conditions:[...t.conditions]},r;default:throw Error(`Unknown name: ${e}`)}}function Y(e,t,n,r){switch(e){case`actions`:return t.actions[n]=t.actions[n].filter(e=>e._id!==r),t;case`conditions`:var i;return t.conditions[n]=(i=t.conditions[n])==null?void 0:i.filter(e=>e._id!==r),t;default:return t.triggers=t.triggers.filter(e=>e._id!==r),t}}function me(e,t,n){let{_id:r,acceptedBy:i}=e,a;if(!i||!t[i])return console.warn(`Cannot find ${i}`),t;switch(i){case`actions`:if(a=t.actions[n].find(e=>e._id===r),!a)console.warn(`Cannot find ${r}`);else{let r=t.actions[n].indexOf(a);t.actions[n][r]=e}return t;case`conditions`:if(a=t.conditions[n].find(e=>e._id===r),!a)console.warn(`Cannot find ${r}`);else{let r=t.conditions[n].indexOf(a);t.conditions[n][r]=e}return t;default:if(a=t.triggers.find(e=>e._id===r),!a)console.warn(`Cannot find ${r}`);else{let n=t.triggers.indexOf(a);t.triggers[n]=e}return t}}M();var he={triggers:q.railTriggers,conditions:q.railConditions,actions:q.railActions},ge=_(t=>{var n;let{setUserRules:r,userRules:i,_id:a,id:o,blockValue:c,active:l,acceptedBy:u,isTourOpen:d,setTourStep:f,tourStep:p}=t,{blocks:g,socket:_,onUpdate:v,setOnUpdate:y,onDebugMessage:x,enableSimulation:S}=O(H),C=b(e=>g==null?void 0:g.find(t=>t.getStaticData().id===e),[g]),w=b(e=>{let t=me(e,i,c);t&&r(t)},[i]),T=m(()=>{let e=C(o)||B;return s(e,{...t,notFound:!C(o),isTourOpen:d,setTourStep:f,tourStep:p,onUpdate:v,setOnUpdate:y,enableSimulation:S,onDebugMessage:x,onChange:w,className:void 0,socket:_})},[i,v,x,S]),[E,D]=h(!1);return e(`div`,{onMouseDown:e=>{if(e.ctrlKey){let e,t=J(u,i,c);u===`conditions`?(e=t.conditions[c].find(e=>e._id===a),e&&t.conditions[c].splice(t.conditions[c].indexOf(e),0,{...e,_id:Date.now()})):u===`actions`?(e=t.actions[c].find(e=>e._id===a),e&&t.actions[c].splice(t.actions[c].indexOf(e),0,{...e,_id:Date.now()})):(e=t.triggers.find(e=>e._id===a),e&&t.triggers.splice(t[u].indexOf(e),0,{...e,_id:Date.now()})),r(t)}},id:`height`,style:l?{width:(((n=document.getElementById(`width`))==null?void 0:n.clientWidth)||0)-70}:void 0,className:[q.cardStyle,he[u],l&&q.cardStyleActive,E&&q.isDelete].filter(Boolean).join(` `),children:[s(`div`,{className:q.drag_mobile}),T,r&&s(`div`,{className:q.controlMenu,children:s(`div`,{onClick:()=>{let e=J(u,i,c);e=Y(u,e,c,a),D(!0),setTimeout(()=>{u===`triggers`&&y(!0),r(e)},300)},className:q.closeBtn})})]})});M();var _e={position:`fixed`,pointerEvents:`none`,zIndex:100,left:0,top:0,width:`100%`,height:`100%`},ve=(e,t)=>[Math.round(e/32)*32,Math.round(t/32)*32],ye=(e,t,n)=>{if(!e||!t)return{display:`none`};let{x:r,y:i}=t;n&&(r-=e.x,i-=e.y,[r,i]=ve(r,i),r+=e.x,i+=e.y);let a=`translate(${r}px, ${i}px)`;return{transform:a,WebkitTransform:a}},be=e=>{let{itemType:t,isDragging:n,item:r,initialOffset:i,currentOffset:a,targetIds:o}=ue(e=>({item:e.getItem(),itemType:e.getItemType(),initialOffset:e.getInitialSourceClientOffset(),currentOffset:e.getSourceClientOffset(),isDragging:e.isDragging(),targetIds:e.getTargetIds()}));return n?s(`div`,{style:_e,children:s(`div`,{style:ye(i,a),children:(()=>{switch(t){case`box`:return o.length?s(ge,{active:!0,...r,allBlocks:e.allBlocks}):s(pe,{active:!0,...r,socket:e.socket});default:return null}})()})}):null},X={emptyBlockStyle:`_emptyBlockStyle_1p9c1_1`,emptyBlock:`_emptyBlock_1p9c1_1`,marginTop:`_marginTop_1p9c1_1`,selectOnChange:`_selectOnChange_1p9c1_17`,selectOnChangeHelp:`_selectOnChangeHelp_1p9c1_23`,selectOnChangeHelpIcon:`_selectOnChangeHelpIcon_1p9c1_29`,emptyBlockNone:`_emptyBlockNone_1p9c1_44`,bandTriggers:`_bandTriggers_1p9c1_57`,bandConditions:`_bandConditions_1p9c1_61`,bandActions:`_bandActions_1p9c1_65`,mainBlockItemRules:`_mainBlockItemRules_1p9c1_69`,nameBlockItems:`_nameBlockItems_1p9c1_93`,nameBlockItemsFoldable:`_nameBlockItemsFoldable_1p9c1_120`,foldIcon:`_foldIcon_1p9c1_124`,foldHint:`_foldHint_1p9c1_124`,contentBlockItem:`_contentBlockItem_1p9c1_145`,wrapperMargin:`_wrapperMargin_1p9c1_153`,contentHeightOn:`_contentHeightOn_1p9c1_160`,heightBlock:`_heightBlock_1p9c1_1`,contentHeightOff:`_contentHeightOff_1p9c1_179`,cardAdd:`_cardAdd_1p9c1_186`,blockCardAdd:`_blockCardAdd_1p9c1_206`};M();function xe(e,t){let[n,r]=h(window.localStorage.getItem(t)?JSON.parse(window.localStorage.getItem(t)||``):e);return[n,e=>{window.localStorage.setItem(t,JSON.stringify(e)),r(e)},!!window.localStorage.getItem(t)]}function Se(e,t){let n=0,r=null,i;return function(...a){let o=Date.now();i=a,o-n>=t?(n=o,e.apply(this,a)):r||=setTimeout(()=>{n=Date.now(),r=null,e.apply(this,i)},t-(o-n))}}function Ce(e){if(Array.isArray(e))return e.map(e=>Ce(e));if(typeof e==`function`)return e.bind(null);if(e&&typeof e==`object`){let t={};return Object.keys(e).forEach(n=>{t[n]=Ce(e[n])}),t}return e}var we=Se((e,t)=>e(t),0);function Te(e,t){let n=t.find(t=>t._id===e);return{card:n,index:n?t.indexOf(n):-1}}function Ee(e,t,n,r,i,a,o,s,c){let{card:l,index:u}=Te(e,n);if(!(u<t&&s<c)&&!(u>t&&s>c)&&l&&u!==t){let e=Ce(n);e.splice(u,1),e.splice(t,0,l);let s=Ce(i);switch(a){case`actions`:s.actions[o]=e,we(r,s);return;case`conditions`:s.conditions[o]=e,we(r,s);return;default:s.triggers=e,we(r,s);return}}}var De={drag:`_drag_7xfhc_1`,root:`_root_7xfhc_11`};M();var Oe=({typeBlock:t,allProperties:n,id:r,isActive:i,setUserRules:a,userRules:o,children:c,_id:l,blockValue:u})=>{let{setOnUpdate:d}=O(H),[{opacity:f},p,m]=re({type:`box`,item:()=>({...n,id:r,isActive:i,_id:l}),end:(e,t)=>{let{acceptedBy:n}=e,r=t.getDropResult(),i;if(!r)return typeof l==`number`&&!t.getTargetIds().length&&(i=J(n,o,u),i=Y(n,i,u,l),a(i)),null;if(r.blockValue!==u){let t=typeof l==`number`?l:Date.now();i=J(n,o,r.blockValue);let s={id:e.id,acceptedBy:e.acceptedBy};switch(n){case`actions`:return u&&(i=Y(`actions`,i,u,t)),i=Y(`actions`,i,r.blockValue,t),i.actions[r.blockValue].push({...s,_id:t}),a(i);case`conditions`:return typeof u==`number`&&(i=Y(`conditions`,i,u,t)),i=Y(`conditions`,i,r.blockValue,t),i.conditions[r.blockValue].push({...s,_id:t}),a(i);default:return d(!0),i=Y(`triggers`,i,r.blockValue,t),i.triggers.push({...s,_id:t}),a(i)}}},collect:e=>({opacity:e.isDragging()?.4:1,isDragging:e.isDragging()})}),h=P(null),[,g]=U({accept:`box`,canDrop:()=>!1,hover({_id:e,acceptedBy:n},r){var i;if(!h.current||t!==n)return;let s=(i=h.current)==null?void 0:i.getBoundingClientRect(),c=(s.bottom-s.top)/2,d=r.getClientOffset(),f=((d==null?void 0:d.y)||0)-s.top;if(l&&e!==l)switch(n){case`actions`:if(u===`then`||u===`else`){let{index:t}=Te(l,o.actions[u]);t!==e&&Ee(e,t,o[n][u],a,o,n,u,f,c)}return;case`conditions`:if(typeof u==`number`){let{index:t}=Te(l,o[n][u]);t!==e&&Ee(e,t,o[n][u],a,o,n,u,f,c)}return;default:{let{index:t}=Te(l,o[n]);t!==e&&Ee(e,t,o[n],a,o,n,void 0,f,c);return}}}});x(()=>{m(de(),{captureDraggingState:!0})},[]),p(g(h));let _=window.innerWidth<600;return e(`div`,{ref:_&&l?null:h,className:De.root,style:{opacity:f},children:[s(`div`,{className:l?De.drag:null,ref:l&&_?h:null}),c]})};M();var ke=({onClose:t,open:n})=>e(y,{open:n,onClose:t,"aria-labelledby":`alert-dialog-title`,"aria-describedby":`alert-dialog-description`,children:[s(E,{children:e(`div`,{style:{fontSize:`1rem`,fontFamily:`"Roboto", "Helvetica", "Arial", sans-serif`,fontWeight:400,lineHeight:1.5,letterSpacing:`0.00938em`},children:[s(`h3`,{children:D.t(`On condition change`)}),s(`div`,{children:D.t(`help_on_change`)}),s(`h3`,{children:D.t(`Just check`)}),s(`div`,{children:D.t(`help_just_check`)})]})}),s(A,{children:s(d,{onClick:t,color:`primary`,autoFocus:!0,startIcon:s(l,{}),children:D.t(`OK`)})})]});M();var Ae=({onClose:t,open:n})=>e(y,{open:n,onClose:t,"aria-labelledby":`alert-dialog-title`,"aria-describedby":`alert-dialog-description`,children:[s(E,{children:e(k,{id:`alert-dialog-description`,children:[s(`h3`,{children:D.t(`On condition change`)}),s(`div`,{children:D.t(`help_on_change`)}),s(`h3`,{children:D.t(`Just check`)}),s(`div`,{children:D.t(`help_just_check`)})]})}),s(A,{children:s(d,{onClick:t,color:`primary`,autoFocus:!0,children:D.t(`OK`)})})]});M();var je={triggers:X.bandTriggers,conditions:X.bandConditions,actions:X.bandActions},Me=({blockValue:t,boolean:n,typeBlock:r,userRules:i,setUserRules:a,animation:o,setTourStep:c,tourStep:l,isTourOpen:u,theme:d,themeType:f,themeName:m})=>{var g;let[_,v]=h(!1),[y,b]=h(!1),[S,C]=h(!1),[w,T]=h(``);n===void 0&&(n=!0);let E=U({accept:`box`,drop:()=>({blockValue:t}),hover:({acceptedBy:e,_id:t},n)=>{v(e===r),C(!!t),T(n.getHandlerId()||``)},canDrop:({acceptedBy:e})=>(b(e===r),e===r),collect:e=>{var t;return{isOver:e.isOver(),canDrop:((t=e.getItem())==null?void 0:t.acceptedBy)===r,offset:e.getClientOffset(),targetId:e.getHandlerId()}}}),{canDrop:D,isOver:O,offset:k,targetId:A}=E[0],j=E[1];x(()=>{T(``)},[k]);let M=D&&O,N=``;M?N=_?`#00fb003d`:`#fb00002e`:D?N=y?`#00fb003d`:`#fb00002e`:k&&(N=A===w?`#fb00002e`:``);let P;return P=r===`actions`?i.actions[t]:r===`conditions`?i.conditions[t]:i.triggers,s(`div`,{ref:e=>{j(e)},style:{backgroundColor:N},className:p.clsx(X.contentBlockItem,n?o&&X.contentHeightOn:X.contentHeightOff),children:e(`div`,{className:X.wrapperMargin,children:[P.map(e=>s(Oe,{typeBlock:r,...e,blockValue:t,allProperties:e,userRules:i,setUserRules:a,children:s(ge,{...e,isTourOpen:u,setTourStep:c,tourStep:l,settings:e,blockValue:t,userRules:i,setUserRules:a,theme:d,themeType:f,themeName:m})},e._id)),s(`div`,{style:M&&_&&!S?{height:((g=document.getElementById(`height`))==null?void 0:g.clientHeight)||200}:void 0,className:`${X.emptyBlockStyle} ${M&&_&&!S?X.emptyBlock:X.emptyBlockNone}`})]})})},Ne=({typeBlock:t,name:r,nameAdditionally:i,additionally:a,userRules:o,setUserRules:c,iconName:l,adapter:u,socket:d,setTourStep:m,tourStep:g,isTourOpen:_,theme:v,themeType:y,themeName:b})=>{let[S,E,O]=xe(t!==`actions`&&[],`additionallyClickItems_${t}`),[k,A]=h(!1),[j,M]=h(!1),N=t===`conditions`&&!o.conditions.some(e=>e.length),[P,F]=xe(!0,`foldEmptyConditions`),I=N&&P,[,L]=U({accept:`box`,hover:({acceptedBy:e})=>{e===`conditions`&&I&&F(!1)}});x(()=>{if(t===`conditions`&&(S==null?void 0:S.length)!==o.conditions.length-1){let e=[];o.conditions.forEach((t,n)=>{n>0&&e.push({_id:Date.now(),open:!0})}),E([...S,...e])}t===`actions`&&!O&&o.actions.else.length&&E(!0)},[]);let[z,B]=h(!1);return e(`div`,{className:`${X.mainBlockItemRules} ${je[t]}`,children:[e(`span`,{id:`width`,ref:e=>{L(N?e:null)},className:p.clsx(X.nameBlockItems,N&&X.nameBlockItemsFoldable),onClick:N?()=>F(!P):void 0,title:N?D.t(I?`Show conditions`:`Hide empty conditions`):void 0,children:[s(R,{iconName:l,className:X.iconThemCard,adapter:u,socket:d}),r,N?e(f,{children:[s(I?oe:ce,{className:X.foldIcon}),I?s(`span`,{className:X.foldHint,children:D.t(`without condition`)}):null]}):null]}),t===`conditions`&&!I?e(`div`,{style:{width:`100%`},children:[e(C,{variant:`standard`,className:X.selectOnChange,value:o.justCheck||!1,onChange:e=>{let t=J(`conditions`,o);t.justCheck=e.target.value===`true`,c(t)},children:[s(n,{value:`false`,children:D.t(`on condition change`)}),s(n,{value:`true`,children:D.t(`just check`)})]}),s(w,{size:`small`,title:D.t(`Explanation`),className:X.selectOnChangeHelp,onClick:()=>A(!0),children:s(ee,{className:X.selectOnChangeHelpIcon})})]}):null,I?null:s(Me,{setTourStep:m,tourStep:g,isTourOpen:_,blockValue:t===`actions`?`then`:t===`conditions`?0:t,typeBlock:t,setUserRules:c,userRules:o,theme:v,themeName:b,themeType:y}),!I&&a&&[...Array(t===`actions`?1:o.conditions.length-1)].map((n,r)=>{let a=(e=r)=>t===`actions`?!!S:!!S.find((t,n)=>n===e&&t.open);return e(T,{children:[e(`div`,{onClick:()=>{if(t===`actions`)return E(!S),null;let e=JSON.parse(JSON.stringify(S));if(o.conditions[r+1].length)return e[r].open=!e[r].open,E(e),null;e=e.filter((e,t)=>t!==r),E(e),B(r),setTimeout(()=>{B(!1),c({...o,conditions:[...o.conditions.filter((e,t)=>t!==r+1)]})},250)},className:X.blockCardAdd,children:[a()?`-`:`+`,s(`div`,{className:X.cardAdd,children:i})]},r),s(Me,{blockValue:t===`actions`?`else`:t===`conditions`?r+1:t,typeBlock:t,setUserRules:c,userRules:o,boolean:a(),animation:z===r,theme:v,themeName:b,themeType:y})]},`${r}_block_${t}`)}),!I&&a&&t===`conditions`&&e(`div`,{onClick:()=>{E([...S,{_id:Date.now(),open:!0}]),c({...o,conditions:[...o.conditions,[]]}),B(o.conditions.length-1),setTimeout(()=>B(!1),1e3)},className:X.blockCardAdd,children:[`+`,s(`div`,{className:X.cardAdd,children:i})]}),s(ke,{open:k,onClose:()=>A(!1)}),s(Ae,{open:j,onClose:()=>M(!1)})]})},Z={menuRules:`_menuRules_7alip_1`,wizardButton:`_wizardButton_7alip_13`,switchesRenderWrapper:`_switchesRenderWrapper_7alip_26`,menuOff:`_menuOff_7alip_35`,menuTitle:`_menuTitle_7alip_41`,marginAuto:`_marginAuto_7alip_55`,inputWidth:`_inputWidth_7alip_60`,menuWrapper:`_menuWrapper_7alip_72`,hamburgerWrapper:`_hamburgerWrapper_7alip_80`,hamburgerOff:`_hamburgerOff_7alip_113`,nothingFound:`_nothingFound_7alip_121`,resetSearch:`_resetSearch_7alip_128`,controlPanel:`_controlPanel_7alip_140`,controlPanelAppBar:`_controlPanelAppBar_7alip_162`,addClassMenu:`_addClassMenu_7alip_176`,addClassBackground:`_addClassBackground_7alip_182`,addClassPosition:`_addClassPosition_7alip_186`};M();var Pe=e=>{let{allProperties:t,allProperties:{acceptedBy:n,id:r},setUserRules:i,userRules:a,setTourStep:o,tourStep:c,isTourOpen:l,onTouchMove:u,isActive:d}=e;return s(Oe,{allProperties:t,id:t.id,isActive:d,setUserRules:i,userRules:a,children:s(pe,{onDoubleClick:()=>{l&&c===L.addScheduleByDoubleClick&&r===`TriggerScheduleBlock`&&o(L.openTagsMenu),l&&c===L.addActionPrintText&&r===`ActionPrintText`&&o(L.showJavascript);let e=Date.now(),t;switch(n){case`actions`:t=`then`;break;case`conditions`:t=a[n].length-1}let s=J(n,a,t),u={id:r,_id:e,acceptedBy:n};t===void 0?s.triggers.push({...u}):n===`actions`?s.actions[t].push({...u}):n===`conditions`&&s.conditions[t].push({...u}),i(s)},...e,...t,onTouchMove:u})})};M();var Fe=({addClass:t,setAllBlocks:n,allBlocks:r,userRules:i,onChangeBlocks:l,setTourStep:u,tourStep:f,isTourOpen:m,onStartWizard:h})=>{let{blocks:g,socket:_}=O(H),[v,y]=xe(!1,`hamburgerOnOff`),[b,S]=xe({text:``,type:`triggers`,index:0},`filterControlPanel`),C=(e=b.text,t=b.type)=>{if(!g)return;let r=[...g];r=r.filter(t=>{if(!e)return!0;let{name:n}=t.getStaticData();return n&&D.t(n).toLowerCase().includes(e.toLowerCase())}),r=r.filter(e=>t===e.getStaticData().acceptedBy),n(r)},w=(e,t)=>{m&&t===0&&f===L.selectTriggers&&u(L.addScheduleByDoubleClick),m&&t===2&&f===L.selectActions&&u(L.addActionPrintText),S({...b,index:t,type:[`triggers`,`conditions`,`actions`][t]}),C(b.text,[`triggers`,`conditions`,`actions`][t])},E=e=>({id:`scrollable-force-tab-${e}`,"aria-controls":`scrollable-force-tabpanel-${e}`});return x(()=>{C()},[g]),s(c,{mouseEvent:!1,touchEvent:`onTouchStart`,onClickAway:()=>y(!0),children:e(`div`,{className:p.clsx(Z.menuWrapper,t[1035]&&Z.addClassMenu),children:[s(`div`,{className:`${Z.hamburgerWrapper} ${v?Z.hamburgerOff:null}`,onClick:()=>y(!v),children:s(v?oe:ae,{})}),e(`div`,{className:`${p.clsx(Z.menuRules,t[1035]&&Z.addClassBackground,t[835]&&Z.addClassPosition)} ${v?Z.menuOff:null}`,children:[s(d,{className:Z.wizardButton,fullWidth:!0,size:`small`,variant:`outlined`,startIcon:s(ie,{}),onClick:h,children:D.t(`Wizard`)}),s(`div`,{className:Z.controlPanel,children:s(j,{className:Z.controlPanelAppBar,position:`static`,children:e(a,{value:b.index,onChange:w,children:[s(o,{className:`blocks-triggers`,title:D.t(`Triggers`),icon:s(R,{iconName:`FlashOn`}),...E(0)}),s(o,{title:D.t(`Conditions`),className:`blocks-conditions`,icon:s(R,{iconName:`Help`}),...E(1)}),s(o,{title:D.t(`Actions`),className:`blocks-actions`,icon:s(R,{iconName:`PlayForWork`}),...E(2)})]})})}),s(`div`,{className:Z.switchesRenderWrapper,children:e(`span`,{children:[r.map(e=>{let{name:t,id:n,icon:r,adapter:a}=e.getStaticData();return s(T,{children:s(Pe,{adapter:a,allProperties:e.getStaticData(),icon:r,id:n,isActive:!1,isTourOpen:m,name:t,onTouchMove:()=>y(!0),setTourStep:u,setUserRules:l,socket:_,tourStep:f,userRules:i})},n)}),!r.length&&e(`div`,{className:Z.nothingFound,children:[D.t(`Nothing found`),`...`,s(`div`,{className:Z.resetSearch,onClick:()=>{S({...b,text:``}),C(``)},children:D.t(`reset search`)})]})]})}),s(`div`,{className:p.clsx(Z.menuTitle,Z.marginAuto)}),s(V,{className:Z.inputWidth,fullWidth:!0,customValue:!0,value:b.text,size:`small`,autoComplete:`off`,label:D.t(`search`),variant:`outlined`,onChange:e=>{S({...b,text:e}),C(e)}})]})]})})},Q={bandTriggers:`_bandTriggers_91vrz_5`,bandConditions:`_bandConditions_91vrz_9`,bandActions:`_bandActions_91vrz_13`,paper:`_paper_91vrz_17`,title:`_title_91vrz_22`,close:`_close_91vrz_29`,content:`_content_91vrz_35`,stepper:`_stepper_91vrz_40`,step:`_step_91vrz_40`,hint:`_hint_91vrz_56`,warning:`_warning_91vrz_61`,blockCard:`_blockCard_91vrz_68`,blockBody:`_blockBody_91vrz_79`,remove:`_remove_91vrz_86`,notFound:`_notFound_91vrz_93`,chooser:`_chooser_91vrz_99`,choice:`_choice_91vrz_105`,choiceIcon:`_choiceIcon_91vrz_128`,choiceName:`_choiceName_91vrz_136`,addMore:`_addMore_91vrz_144`,summaryBand:`_summaryBand_91vrz_150`,summaryLabel:`_summaryLabel_91vrz_156`,preview:`_preview_91vrz_164`,actions:`_actions_91vrz_169`,spacer:`_spacer_91vrz_173`};M();var $=[`triggers`,`conditions`,`actions`],Ie={triggers:`Triggers`,conditions:`Conditions`,actions:`Actions`},Le={triggers:`What should start the rule?`,conditions:`When should the rule run? This step is optional.`,actions:`What should happen?`},Re={triggers:`when`,conditions:`and`,actions:`then`},ze={triggers:Q.bandTriggers,conditions:Q.bandConditions,actions:Q.bandActions},Be=()=>({triggers:[],conditions:[],actions:[]}),Ve=({onCreate:t,onClose:n,hasRule:a,socket:o,theme:c,themeType:l,themeName:f})=>{let{blocks:_}=O(H),[b,x]=h(0),[C,T]=h(Be),[k,j]=h(null),M=P(0),F=m(()=>{let e={triggers:[],conditions:[],actions:[]};return _==null||_.forEach(t=>{var n;let{acceptedBy:r}=t.getStaticData();(n=e[r])==null||n.push(t)}),e},[_]),I=m(()=>({triggers:C.triggers,conditions:C.conditions.length?[C.conditions]:[[]],justCheck:!1,actions:{then:C.actions,else:[]}}),[C]),ee=(e,t)=>{M.current+=1,T(n=>({...n,[e]:[...n[e],{id:t,_id:M.current,acceptedBy:e}]})),j(null)},L=(e,t)=>T(n=>({...n,[e]:n[e].filter(e=>e._id!==t)})),z=(e,t,n)=>T(r=>({...r,[e]:r[e].map(r=>r._id===t?{...n,_id:t,id:r.id,acceptedBy:e}:r)})),B=(e,t,n)=>{let r=_==null?void 0:_.find(t=>t.getStaticData().id===e.id);return r?s(r,{_id:e._id,settings:e,acceptedBy:t,onChange:n?()=>{}:n=>z(t,e._id,n),socket:o,theme:c,themeType:l,themeName:f,enableSimulation:!1,userRules:I,onUpdate:!1,setOnUpdate:()=>{}}):s(`div`,{className:Q.notFound,children:D.t(`Block not found`)})},te=t=>s(`div`,{className:Q.chooser,children:F[t].map(n=>{let{id:r,name:i,icon:a,adapter:c,title:l}=n.getStaticData();return e(`button`,{type:`button`,className:Q.choice,title:l?D.t(l):void 0,onClick:()=>ee(t,r),children:[s(R,{iconName:a,adapter:c,socket:o,className:Q.choiceIcon}),s(`span`,{className:Q.choiceName,children:D.t(i)})]},r)})}),V=(t,n)=>e(`div`,{className:Q.step,hidden:b!==n,children:[s(`div`,{className:Q.hint,children:D.t(Le[t])}),C[t].map(n=>e(`div`,{className:p.clsx(Q.blockCard,ze[t]),children:[s(`div`,{className:Q.blockBody,children:B(n,t)}),s(w,{className:Q.remove,size:`small`,title:D.t(`Delete`),onClick:()=>L(t,n._id),children:s(se,{fontSize:`small`})})]},n._id)),k===t||!C[t].length?te(t):s(d,{className:Q.addMore,startIcon:s(N,{}),onClick:()=>j(t),children:D.t(`Add another`)})]},t),ne=()=>e(`div`,{className:Q.step,children:[$.map(t=>C[t].length?e(`div`,{className:Q.summaryBand,children:[s(`div`,{className:p.clsx(Q.summaryLabel,ze[t]),children:D.t(Re[t])}),C[t].map(e=>s(`div`,{className:p.clsx(Q.blockCard,Q.preview,ze[t]),children:s(`div`,{className:Q.blockBody,children:B(e,t,!0)})},e._id))]},t):null),C.conditions.length?null:s(`div`,{className:Q.hint,children:D.t(`Without a condition the rule always runs`)}),a?s(`div`,{className:Q.warning,children:D.t(`The current rule will be replaced`)}):null]}),U=b===$.length,W=U||b===1||!!C[$[b]].length;return e(y,{open:!0,fullWidth:!0,maxWidth:`md`,onClose:n,classes:{paper:Q.paper},children:[e(S,{className:Q.title,children:[D.t(`Create a rule step by step`),s(w,{className:Q.close,size:`small`,title:D.t(`Close`),onClick:n,children:s(g,{})})]}),e(E,{className:Q.content,children:[e(r,{className:Q.stepper,activeStep:b,children:[$.map(e=>s(i,{children:s(u,{children:D.t(Ie[e])})},e)),s(i,{children:s(u,{children:D.t(`Summary`)})})]}),$.map(V),U?ne():null]}),e(A,{className:Q.actions,children:[s(d,{disabled:!b,startIcon:s(le,{}),onClick:()=>x(b-1),children:D.t(`Back`)}),s(`div`,{className:Q.spacer}),s(d,{onClick:n,children:D.t(`Cancel`)}),U?s(d,{variant:`contained`,color:`primary`,onClick:()=>{t(I),n()},children:D.t(a?`Replace rule`:`Create rule`)}):s(d,{variant:`contained`,color:`primary`,disabled:!W,endIcon:s(v,{}),onClick:()=>x(b+1),children:D.t(b===1&&!C.conditions.length?`Skip`:`Next`)})]})]})};M();var He=[],Ue=({code:t,onChange:n,themeName:r,themeType:i,theme:a,setTourStep:o,tourStep:c,isTourOpen:l,command:u,scriptId:f,changed:p,running:m,newRuleId:g,onNewRuleHandled:_})=>{var v;let{blocks:y,socket:S,setOnUpdate:C,setOnDebugMessage:w,setEnableSimulation:T}=O(H),[E,k]=h([]),[A,j]=h(te(t)),[M,N]=h(``),[ee,L]=h(!1),[R,z]=h(!1);x(()=>{let e,t,n=(n,r)=>{n===`${e}.alive`&&t!==(r==null?void 0:r.val)&&(t=!!(r!=null&&r.val),t&&e&&(S==null||S.sendTo(e.replace(/^system\.adapter\./,``),`rulesOn`,f)))},r=(r,i)=>{var a;if(S&&e!==(i==null||(a=i.common)==null?void 0:a.engine)){var o;e&&(S.unsubscribeState(`${e}.alive`,n),t&&S.sendTo(e.replace(/^system\.adapter\./,``),`rulesOn`,f)),e=i==null||(o=i.common)==null?void 0:o.engine,e&&e&&S.subscribeState(`${e}.alive`,n)}},i=(e,t)=>{if(t)try{let e=JSON.parse(t.val),n=Date.now();if(e.ruleId===f&&n-e.ts<1e3){let t=[...He,{blockId:e.blockId,data:e.data,ts:e.ts}];t.length>200&&t.splice(0,t.length-200);for(let e=t.length-1;e>=0;e--)if(t[e].ts<n-5e3){t.splice(0,e);break}He=t,w(t)}}catch{console.error(`Cannot parse: ${t.val}`)}};return S==null||S.getObject(f).then(t=>{var a;e=t==null||(a=t.common)==null?void 0:a.engine,S.subscribeObject(f,r),e&&(S.subscribeState(`${e}.alive`,n),S.subscribeState(`${e.replace(/^system\.adapter\./,``)}.debug.rules`,i))}),function(){S==null||S.unsubscribeObject(f,r),e&&(S==null||S.unsubscribeState(`${e}.alive`,n),t&&(S==null||S.sendTo(e.replace(/^system\.adapter\./,``),`rulesOff`,f)),S==null||S.unsubscribeState(`${e.replace(/^system\.adapter\./,``)}.debug.rules`,i))}},[]),x(()=>{T(!p&&m)},[p,m,T]),x(()=>{u&&(N(u),ee||L(!0))},[u]),x(()=>{let e=te(t);JSON.stringify(e)!==JSON.stringify(A)&&(j(e),C(!0))},[t]),x(()=>{document.getElementsByTagName(`HTML`)[0].className=r||`blue`},[r]),x(()=>{g&&g===f&&(_(),z(!0))},[g,f,_]);let B=b(e=>{j(e),y&&n(ne(e,y))},[y,n]),V=P(null),[U,W]=h({835:!1,1035:!1});if(x(()=>{V.current&&(V.current.clientWidth<=1035&&W({835:!1,1035:!0}),V.current.clientWidth<=835&&W({1035:!0,835:!0}),V.current.clientWidth>1035&&W({835:!1,1035:!1}))},[((v=V.current)==null?void 0:v.clientWidth)||0]),!y||!S)return null;let re=!A.triggers.length&&!A.actions.then.length&&!A.actions.else.length&&!A.conditions.some(e=>e.length);return e(`div`,{className:K.wrapperRules,ref:V,children:[s(be,{allBlocks:E,socket:S}),ee?M===`export`?s(F,{scriptId:f,themeType:i,onClose:()=>L(!1),text:JSON.stringify(A,null,2)}):s(I,{themeType:i,onClose:e=>{L(!1),e&&B(JSON.parse(e))}}):null,R?s(Ve,{hasRule:!re,socket:S,theme:a,themeType:i,themeName:r,onCreate:B,onClose:()=>z(!1)}):null,e(`div`,{className:K.rootWrapper,children:[s(Fe,{setAllBlocks:k,allBlocks:E,userRules:A,onChangeBlocks:B,setTourStep:o,tourStep:c,addClass:U,isTourOpen:l,onStartWizard:()=>z(!0)}),e(`div`,{className:K.bands,children:[re?e(`div`,{className:K.emptyRule,children:[s(`div`,{className:K.emptyRuleText,children:D.t(`Create a rule step by step`)}),s(d,{variant:`contained`,color:`primary`,startIcon:s(ie,{}),onClick:()=>z(!0),children:D.t(`Wizard`)})]}):null,s(Ne,{socket:S,setUserRules:B,userRules:A,isTourOpen:l,setTourStep:o,tourStep:c,name:`${D.t(`when`)}...`,typeBlock:`triggers`,iconName:`FlashOn`,themeType:i,themeName:r,theme:a}),s(Ne,{socket:S,setUserRules:B,isTourOpen:l,setTourStep:o,tourStep:c,userRules:A,name:`...${D.t(`and`)}...`,typeBlock:`conditions`,iconName:`Help`,nameAdditionally:D.t(`or`),additionally:!0,themeType:i,themeName:r,theme:a}),s(Ne,{socket:S,setUserRules:B,isTourOpen:l,setTourStep:o,tourStep:c,userRules:A,name:`...${D.t(`then`)}`,typeBlock:`actions`,iconName:`PlayForWork`,nameAdditionally:D.t(`else`),additionally:!0,themeType:i,themeName:r,theme:a})]})]})]},`rulesEditor`)};export{Ue as default};
|
|
1
|
+
import{$n as e,Bn as t,En as n,Et as r,Fn as i,Ft as a,Ot as o,Qn as s,Qt as c,St as l,Tt as u,Ut as d,Zn as f,_ as p,_r as m,br as h,bt as g,dr as _,dt as v,en as y,fr as b,hr as x,in as S,kn as C,mn as w,mr as T,nn as E,p as D,pr as O,rn as k,tn as A,wn as j,wr as M,wt as N,yr as P}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__113183188387379__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-D-gi6Mty.js";import{n as F,t as I}from"./Import-XKVP-nRT.js";import{C as ee,_ as L,a as R,b as z,i as B,n as te,o as V,r as ne,t as H,v as U,x as W,y as re}from"./index-CRX4LAhD.js";var ie=t(s(`path`,{d:`M7.5 5.6 10 7 8.6 4.5 10 2 7.5 3.4 5 2l1.4 2.5L5 7zm12 9.8L17 14l1.4 2.5L17 19l2.5-1.4L22 19l-1.4-2.5L22 14zM22 2l-2.5 1.4L17 2l1.4 2.5L17 7l2.5-1.4L22 7l-1.4-2.5zm-7.63 5.29a.996.996 0 0 0-1.41 0L1.29 18.96c-.39.39-.39 1.02 0 1.41l2.34 2.34c.39.39 1.02.39 1.41 0L16.7 11.05c.39-.39.39-1.02 0-1.41zm-1.03 5.49-2.12-2.12 2.44-2.44 2.12 2.12z`}),`AutoFixHigh`),ae=t(s(`path`,{d:`M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z`}),`ChevronLeft`),oe=t(s(`path`,{d:`M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z`}),`ChevronRight`),se=t(s(`path`,{d:`M16 9v10H8V9zm-1.5-6h-5l-1 1H5v2h14V4h-3.5zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2z`}),`DeleteOutlined`),ce=t(s(`path`,{d:`M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z`}),`ExpandMore`),le=t(s(`path`,{d:`M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z`}),`NavigateBefore`);M();function ue(e){let t=z().getMonitor(),[n,r]=W(t,e);return x(()=>t.subscribeToOffsetChange(r)),x(()=>t.subscribeToStateChange(r)),n}var G;function de(){return G||(G=new Image,G.src=`data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==`),G}var K={wrapperRules:`_wrapperRules_147jt_8`,rootWrapper:`_rootWrapper_147jt_14`,bands:`_bands_147jt_26`,emptyRule:`_emptyRule_147jt_39`,emptyRuleText:`_emptyRuleText_147jt_51`},fe={switchesItem:`_switchesItem_1uv39_6`,switchesItemActive:`_switchesItemActive_1uv39_34`,iconTheme:`_iconTheme_1uv39_42`};M();var pe=({name:t,id:n,active:r,icon:i,adapter:a,socket:o,onDoubleClick:c,title:l,onTouchMove:u,style:d})=>e(`div`,{onDoubleClick:c,onTouchMove:u,title:D.t(l||t),className:p.clsx(fe.switchesItem,r&&fe.switchesItemActive,`block-${n}`),children:[s(R,{iconName:i,className:fe.iconTheme,adapter:a,socket:o,style:d}),s(`span`,{children:t?D.t(t):``})]},n),q={cardStyle:`_cardStyle_15e7l_1`,railTriggers:`_railTriggers_15e7l_25`,railConditions:`_railConditions_15e7l_29`,railActions:`_railActions_15e7l_33`,cardStyleActive:`_cardStyleActive_15e7l_37`,controlMenu:`_controlMenu_15e7l_46`,closeBtn:`_closeBtn_15e7l_64`,isDelete:`_isDelete_15e7l_106`,drag_mobile:`_drag_mobile_15e7l_125`};function J(e,t,n){let r;switch(e){case`actions`:if(n===`else`)return r={...t,actions:{...t[e],else:[...t[e].else]}},r;if(n===`then`)return r={...t,actions:{...t[e],then:[...t[e].then]}},r;throw console.error(`Unknown additionalParameter: ${n}`),Error(`Unknown additionalParameter: ${n}`);case`triggers`:return r={...t,triggers:[...t.triggers]},r;case`conditions`:return r={...t,conditions:[...t.conditions]},r;default:throw Error(`Unknown name: ${e}`)}}function Y(e,t,n,r){switch(e){case`actions`:return t.actions[n]=t.actions[n].filter(e=>e._id!==r),t;case`conditions`:var i;return t.conditions[n]=(i=t.conditions[n])==null?void 0:i.filter(e=>e._id!==r),t;default:return t.triggers=t.triggers.filter(e=>e._id!==r),t}}function me(e,t,n){let{_id:r,acceptedBy:i}=e,a;if(!i||!t[i])return console.warn(`Cannot find ${i}`),t;switch(i){case`actions`:if(a=t.actions[n].find(e=>e._id===r),!a)console.warn(`Cannot find ${r}`);else{let r=t.actions[n].indexOf(a);t.actions[n][r]=e}return t;case`conditions`:if(a=t.conditions[n].find(e=>e._id===r),!a)console.warn(`Cannot find ${r}`);else{let r=t.conditions[n].indexOf(a);t.conditions[n][r]=e}return t;default:if(a=t.triggers.find(e=>e._id===r),!a)console.warn(`Cannot find ${r}`);else{let n=t.triggers.indexOf(a);t.triggers[n]=e}return t}}M();var he={triggers:q.railTriggers,conditions:q.railConditions,actions:q.railActions},ge=_(t=>{var n;let{setUserRules:r,userRules:i,_id:a,id:o,blockValue:c,active:l,acceptedBy:u,isTourOpen:d,setTourStep:f,tourStep:p}=t,{blocks:g,socket:_,onUpdate:v,setOnUpdate:y,onDebugMessage:x,enableSimulation:S}=O(H),C=b(e=>g==null?void 0:g.find(t=>t.getStaticData().id===e),[g]),w=b(e=>{let t=me(e,i,c);t&&r(t)},[i]),T=m(()=>{let e=C(o)||B;return s(e,{...t,notFound:!C(o),isTourOpen:d,setTourStep:f,tourStep:p,onUpdate:v,setOnUpdate:y,enableSimulation:S,onDebugMessage:x,onChange:w,className:void 0,socket:_})},[i,v,x,S]),[E,D]=h(!1);return e(`div`,{onMouseDown:e=>{if(e.ctrlKey){let e,t=J(u,i,c);u===`conditions`?(e=t.conditions[c].find(e=>e._id===a),e&&t.conditions[c].splice(t.conditions[c].indexOf(e),0,{...e,_id:Date.now()})):u===`actions`?(e=t.actions[c].find(e=>e._id===a),e&&t.actions[c].splice(t.actions[c].indexOf(e),0,{...e,_id:Date.now()})):(e=t.triggers.find(e=>e._id===a),e&&t.triggers.splice(t[u].indexOf(e),0,{...e,_id:Date.now()})),r(t)}},id:`height`,style:l?{width:(((n=document.getElementById(`width`))==null?void 0:n.clientWidth)||0)-70}:void 0,className:[q.cardStyle,he[u],l&&q.cardStyleActive,E&&q.isDelete].filter(Boolean).join(` `),children:[s(`div`,{className:q.drag_mobile}),T,r&&s(`div`,{className:q.controlMenu,children:s(`div`,{onClick:()=>{let e=J(u,i,c);e=Y(u,e,c,a),D(!0),setTimeout(()=>{u===`triggers`&&y(!0),r(e)},300)},className:q.closeBtn})})]})});M();var _e={position:`fixed`,pointerEvents:`none`,zIndex:100,left:0,top:0,width:`100%`,height:`100%`},ve=(e,t)=>[Math.round(e/32)*32,Math.round(t/32)*32],ye=(e,t,n)=>{if(!e||!t)return{display:`none`};let{x:r,y:i}=t;n&&(r-=e.x,i-=e.y,[r,i]=ve(r,i),r+=e.x,i+=e.y);let a=`translate(${r}px, ${i}px)`;return{transform:a,WebkitTransform:a}},be=e=>{let{itemType:t,isDragging:n,item:r,initialOffset:i,currentOffset:a,targetIds:o}=ue(e=>({item:e.getItem(),itemType:e.getItemType(),initialOffset:e.getInitialSourceClientOffset(),currentOffset:e.getSourceClientOffset(),isDragging:e.isDragging(),targetIds:e.getTargetIds()}));return n?s(`div`,{style:_e,children:s(`div`,{style:ye(i,a),children:(()=>{switch(t){case`box`:return o.length?s(ge,{active:!0,...r,allBlocks:e.allBlocks}):s(pe,{active:!0,...r,socket:e.socket});default:return null}})()})}):null},X={emptyBlockStyle:`_emptyBlockStyle_1p9c1_1`,emptyBlock:`_emptyBlock_1p9c1_1`,marginTop:`_marginTop_1p9c1_1`,selectOnChange:`_selectOnChange_1p9c1_17`,selectOnChangeHelp:`_selectOnChangeHelp_1p9c1_23`,selectOnChangeHelpIcon:`_selectOnChangeHelpIcon_1p9c1_29`,emptyBlockNone:`_emptyBlockNone_1p9c1_44`,bandTriggers:`_bandTriggers_1p9c1_57`,bandConditions:`_bandConditions_1p9c1_61`,bandActions:`_bandActions_1p9c1_65`,mainBlockItemRules:`_mainBlockItemRules_1p9c1_69`,nameBlockItems:`_nameBlockItems_1p9c1_93`,nameBlockItemsFoldable:`_nameBlockItemsFoldable_1p9c1_120`,foldIcon:`_foldIcon_1p9c1_124`,foldHint:`_foldHint_1p9c1_124`,contentBlockItem:`_contentBlockItem_1p9c1_145`,wrapperMargin:`_wrapperMargin_1p9c1_153`,contentHeightOn:`_contentHeightOn_1p9c1_160`,heightBlock:`_heightBlock_1p9c1_1`,contentHeightOff:`_contentHeightOff_1p9c1_179`,cardAdd:`_cardAdd_1p9c1_186`,blockCardAdd:`_blockCardAdd_1p9c1_206`};M();function xe(e,t){let[n,r]=h(window.localStorage.getItem(t)?JSON.parse(window.localStorage.getItem(t)||``):e);return[n,e=>{window.localStorage.setItem(t,JSON.stringify(e)),r(e)},!!window.localStorage.getItem(t)]}function Se(e,t){let n=0,r=null,i;return function(...a){let o=Date.now();i=a,o-n>=t?(n=o,e.apply(this,a)):r||=setTimeout(()=>{n=Date.now(),r=null,e.apply(this,i)},t-(o-n))}}function Ce(e){if(Array.isArray(e))return e.map(e=>Ce(e));if(typeof e==`function`)return e.bind(null);if(e&&typeof e==`object`){let t={};return Object.keys(e).forEach(n=>{t[n]=Ce(e[n])}),t}return e}var we=Se((e,t)=>e(t),0);function Te(e,t){let n=t.find(t=>t._id===e);return{card:n,index:n?t.indexOf(n):-1}}function Ee(e,t,n,r,i,a,o,s,c){let{card:l,index:u}=Te(e,n);if(!(u<t&&s<c)&&!(u>t&&s>c)&&l&&u!==t){let e=Ce(n);e.splice(u,1),e.splice(t,0,l);let s=Ce(i);switch(a){case`actions`:s.actions[o]=e,we(r,s);return;case`conditions`:s.conditions[o]=e,we(r,s);return;default:s.triggers=e,we(r,s);return}}}var De={drag:`_drag_7xfhc_1`,root:`_root_7xfhc_11`};M();var Oe=({typeBlock:t,allProperties:n,id:r,isActive:i,setUserRules:a,userRules:o,children:c,_id:l,blockValue:u})=>{let{setOnUpdate:d}=O(H),[{opacity:f},p,m]=re({type:`box`,item:()=>({...n,id:r,isActive:i,_id:l}),end:(e,t)=>{let{acceptedBy:n}=e,r=t.getDropResult(),i;if(!r)return typeof l==`number`&&!t.getTargetIds().length&&(i=J(n,o,u),i=Y(n,i,u,l),a(i)),null;if(r.blockValue!==u){let t=typeof l==`number`?l:Date.now();i=J(n,o,r.blockValue);let s={id:e.id,acceptedBy:e.acceptedBy};switch(n){case`actions`:return u&&(i=Y(`actions`,i,u,t)),i=Y(`actions`,i,r.blockValue,t),i.actions[r.blockValue].push({...s,_id:t}),a(i);case`conditions`:return typeof u==`number`&&(i=Y(`conditions`,i,u,t)),i=Y(`conditions`,i,r.blockValue,t),i.conditions[r.blockValue].push({...s,_id:t}),a(i);default:return d(!0),i=Y(`triggers`,i,r.blockValue,t),i.triggers.push({...s,_id:t}),a(i)}}},collect:e=>({opacity:e.isDragging()?.4:1,isDragging:e.isDragging()})}),h=P(null),[,g]=U({accept:`box`,canDrop:()=>!1,hover({_id:e,acceptedBy:n},r){var i;if(!h.current||t!==n)return;let s=(i=h.current)==null?void 0:i.getBoundingClientRect(),c=(s.bottom-s.top)/2,d=r.getClientOffset(),f=((d==null?void 0:d.y)||0)-s.top;if(l&&e!==l)switch(n){case`actions`:if(u===`then`||u===`else`){let{index:t}=Te(l,o.actions[u]);t!==e&&Ee(e,t,o[n][u],a,o,n,u,f,c)}return;case`conditions`:if(typeof u==`number`){let{index:t}=Te(l,o[n][u]);t!==e&&Ee(e,t,o[n][u],a,o,n,u,f,c)}return;default:{let{index:t}=Te(l,o[n]);t!==e&&Ee(e,t,o[n],a,o,n,void 0,f,c);return}}}});x(()=>{m(de(),{captureDraggingState:!0})},[]),p(g(h));let _=window.innerWidth<600;return e(`div`,{ref:_&&l?null:h,className:De.root,style:{opacity:f},children:[s(`div`,{className:l?De.drag:null,ref:l&&_?h:null}),c]})};M();var ke=({onClose:t,open:n})=>e(y,{open:n,onClose:t,"aria-labelledby":`alert-dialog-title`,"aria-describedby":`alert-dialog-description`,children:[s(E,{children:e(`div`,{style:{fontSize:`1rem`,fontFamily:`"Roboto", "Helvetica", "Arial", sans-serif`,fontWeight:400,lineHeight:1.5,letterSpacing:`0.00938em`},children:[s(`h3`,{children:D.t(`On condition change`)}),s(`div`,{children:D.t(`help_on_change`)}),s(`h3`,{children:D.t(`Just check`)}),s(`div`,{children:D.t(`help_just_check`)})]})}),s(A,{children:s(d,{onClick:t,color:`primary`,autoFocus:!0,startIcon:s(l,{}),children:D.t(`OK`)})})]});M();var Ae=({onClose:t,open:n})=>e(y,{open:n,onClose:t,"aria-labelledby":`alert-dialog-title`,"aria-describedby":`alert-dialog-description`,children:[s(E,{children:e(k,{id:`alert-dialog-description`,children:[s(`h3`,{children:D.t(`On condition change`)}),s(`div`,{children:D.t(`help_on_change`)}),s(`h3`,{children:D.t(`Just check`)}),s(`div`,{children:D.t(`help_just_check`)})]})}),s(A,{children:s(d,{onClick:t,color:`primary`,autoFocus:!0,children:D.t(`OK`)})})]});M();var je={triggers:X.bandTriggers,conditions:X.bandConditions,actions:X.bandActions},Me=({blockValue:t,boolean:n,typeBlock:r,userRules:i,setUserRules:a,animation:o,setTourStep:c,tourStep:l,isTourOpen:u,theme:d,themeType:f,themeName:m})=>{var g;let[_,v]=h(!1),[y,b]=h(!1),[S,C]=h(!1),[w,T]=h(``);n===void 0&&(n=!0);let E=U({accept:`box`,drop:()=>({blockValue:t}),hover:({acceptedBy:e,_id:t},n)=>{v(e===r),C(!!t),T(n.getHandlerId()||``)},canDrop:({acceptedBy:e})=>(b(e===r),e===r),collect:e=>{var t;return{isOver:e.isOver(),canDrop:((t=e.getItem())==null?void 0:t.acceptedBy)===r,offset:e.getClientOffset(),targetId:e.getHandlerId()}}}),{canDrop:D,isOver:O,offset:k,targetId:A}=E[0],j=E[1];x(()=>{T(``)},[k]);let M=D&&O,N=``;M?N=_?`#00fb003d`:`#fb00002e`:D?N=y?`#00fb003d`:`#fb00002e`:k&&(N=A===w?`#fb00002e`:``);let P;return P=r===`actions`?i.actions[t]:r===`conditions`?i.conditions[t]:i.triggers,s(`div`,{ref:e=>{j(e)},style:{backgroundColor:N},className:p.clsx(X.contentBlockItem,n?o&&X.contentHeightOn:X.contentHeightOff),children:e(`div`,{className:X.wrapperMargin,children:[P.map(e=>s(Oe,{typeBlock:r,...e,blockValue:t,allProperties:e,userRules:i,setUserRules:a,children:s(ge,{...e,isTourOpen:u,setTourStep:c,tourStep:l,settings:e,blockValue:t,userRules:i,setUserRules:a,theme:d,themeType:f,themeName:m})},e._id)),s(`div`,{style:M&&_&&!S?{height:((g=document.getElementById(`height`))==null?void 0:g.clientHeight)||200}:void 0,className:`${X.emptyBlockStyle} ${M&&_&&!S?X.emptyBlock:X.emptyBlockNone}`})]})})},Ne=({typeBlock:t,name:r,nameAdditionally:i,additionally:a,userRules:o,setUserRules:c,iconName:l,adapter:u,socket:d,setTourStep:m,tourStep:g,isTourOpen:_,theme:v,themeType:y,themeName:b})=>{let[S,E,O]=xe(t!==`actions`&&[],`additionallyClickItems_${t}`),[k,A]=h(!1),[j,M]=h(!1),N=t===`conditions`&&!o.conditions.some(e=>e.length),[P,F]=xe(!0,`foldEmptyConditions`),I=N&&P,[,L]=U({accept:`box`,hover:({acceptedBy:e})=>{e===`conditions`&&I&&F(!1)}});x(()=>{if(t===`conditions`&&(S==null?void 0:S.length)!==o.conditions.length-1){let e=[];o.conditions.forEach((t,n)=>{n>0&&e.push({_id:Date.now(),open:!0})}),E([...S,...e])}t===`actions`&&!O&&o.actions.else.length&&E(!0)},[]);let[z,B]=h(!1);return e(`div`,{className:`${X.mainBlockItemRules} ${je[t]}`,children:[e(`span`,{id:`width`,ref:e=>{L(N?e:null)},className:p.clsx(X.nameBlockItems,N&&X.nameBlockItemsFoldable),onClick:N?()=>F(!P):void 0,title:N?D.t(I?`Show conditions`:`Hide empty conditions`):void 0,children:[s(R,{iconName:l,className:X.iconThemCard,adapter:u,socket:d}),r,N?e(f,{children:[s(I?oe:ce,{className:X.foldIcon}),I?s(`span`,{className:X.foldHint,children:D.t(`without condition`)}):null]}):null]}),t===`conditions`&&!I?e(`div`,{style:{width:`100%`},children:[e(C,{variant:`standard`,className:X.selectOnChange,value:o.justCheck||!1,onChange:e=>{let t=J(`conditions`,o);t.justCheck=e.target.value===`true`,c(t)},children:[s(n,{value:`false`,children:D.t(`on condition change`)}),s(n,{value:`true`,children:D.t(`just check`)})]}),s(w,{size:`small`,title:D.t(`Explanation`),className:X.selectOnChangeHelp,onClick:()=>A(!0),children:s(ee,{className:X.selectOnChangeHelpIcon})})]}):null,I?null:s(Me,{setTourStep:m,tourStep:g,isTourOpen:_,blockValue:t===`actions`?`then`:t===`conditions`?0:t,typeBlock:t,setUserRules:c,userRules:o,theme:v,themeName:b,themeType:y}),!I&&a&&[...Array(t===`actions`?1:o.conditions.length-1)].map((n,r)=>{let a=(e=r)=>t===`actions`?!!S:!!S.find((t,n)=>n===e&&t.open);return e(T,{children:[e(`div`,{onClick:()=>{if(t===`actions`)return E(!S),null;let e=JSON.parse(JSON.stringify(S));if(o.conditions[r+1].length)return e[r].open=!e[r].open,E(e),null;e=e.filter((e,t)=>t!==r),E(e),B(r),setTimeout(()=>{B(!1),c({...o,conditions:[...o.conditions.filter((e,t)=>t!==r+1)]})},250)},className:X.blockCardAdd,children:[a()?`-`:`+`,s(`div`,{className:X.cardAdd,children:i})]},r),s(Me,{blockValue:t===`actions`?`else`:t===`conditions`?r+1:t,typeBlock:t,setUserRules:c,userRules:o,boolean:a(),animation:z===r,theme:v,themeName:b,themeType:y})]},`${r}_block_${t}`)}),!I&&a&&t===`conditions`&&e(`div`,{onClick:()=>{E([...S,{_id:Date.now(),open:!0}]),c({...o,conditions:[...o.conditions,[]]}),B(o.conditions.length-1),setTimeout(()=>B(!1),1e3)},className:X.blockCardAdd,children:[`+`,s(`div`,{className:X.cardAdd,children:i})]}),s(ke,{open:k,onClose:()=>A(!1)}),s(Ae,{open:j,onClose:()=>M(!1)})]})},Z={menuRules:`_menuRules_7alip_1`,wizardButton:`_wizardButton_7alip_13`,switchesRenderWrapper:`_switchesRenderWrapper_7alip_26`,menuOff:`_menuOff_7alip_35`,menuTitle:`_menuTitle_7alip_41`,marginAuto:`_marginAuto_7alip_55`,inputWidth:`_inputWidth_7alip_60`,menuWrapper:`_menuWrapper_7alip_72`,hamburgerWrapper:`_hamburgerWrapper_7alip_80`,hamburgerOff:`_hamburgerOff_7alip_113`,nothingFound:`_nothingFound_7alip_121`,resetSearch:`_resetSearch_7alip_128`,controlPanel:`_controlPanel_7alip_140`,controlPanelAppBar:`_controlPanelAppBar_7alip_162`,addClassMenu:`_addClassMenu_7alip_176`,addClassBackground:`_addClassBackground_7alip_182`,addClassPosition:`_addClassPosition_7alip_186`};M();var Pe=e=>{let{allProperties:t,allProperties:{acceptedBy:n,id:r},setUserRules:i,userRules:a,setTourStep:o,tourStep:c,isTourOpen:l,onTouchMove:u,isActive:d}=e;return s(Oe,{allProperties:t,id:t.id,isActive:d,setUserRules:i,userRules:a,children:s(pe,{onDoubleClick:()=>{l&&c===L.addScheduleByDoubleClick&&r===`TriggerScheduleBlock`&&o(L.openTagsMenu),l&&c===L.addActionPrintText&&r===`ActionPrintText`&&o(L.showJavascript);let e=Date.now(),t;switch(n){case`actions`:t=`then`;break;case`conditions`:t=a[n].length-1}let s=J(n,a,t),u={id:r,_id:e,acceptedBy:n};t===void 0?s.triggers.push({...u}):n===`actions`?s.actions[t].push({...u}):n===`conditions`&&s.conditions[t].push({...u}),i(s)},...e,...t,onTouchMove:u})})};M();var Fe=({addClass:t,setAllBlocks:n,allBlocks:r,userRules:i,onChangeBlocks:l,setTourStep:u,tourStep:f,isTourOpen:m,onStartWizard:h})=>{let{blocks:g,socket:_}=O(H),[v,y]=xe(!1,`hamburgerOnOff`),[b,S]=xe({text:``,type:`triggers`,index:0},`filterControlPanel`),C=(e=b.text,t=b.type)=>{if(!g)return;let r=[...g];r=r.filter(t=>{if(!e)return!0;let{name:n}=t.getStaticData();return n&&D.t(n).toLowerCase().includes(e.toLowerCase())}),r=r.filter(e=>t===e.getStaticData().acceptedBy),n(r)},w=(e,t)=>{m&&t===0&&f===L.selectTriggers&&u(L.addScheduleByDoubleClick),m&&t===2&&f===L.selectActions&&u(L.addActionPrintText),S({...b,index:t,type:[`triggers`,`conditions`,`actions`][t]}),C(b.text,[`triggers`,`conditions`,`actions`][t])},E=e=>({id:`scrollable-force-tab-${e}`,"aria-controls":`scrollable-force-tabpanel-${e}`});return x(()=>{C()},[g]),s(c,{mouseEvent:!1,touchEvent:`onTouchStart`,onClickAway:()=>y(!0),children:e(`div`,{className:p.clsx(Z.menuWrapper,t[1035]&&Z.addClassMenu),children:[s(`div`,{className:`${Z.hamburgerWrapper} ${v?Z.hamburgerOff:null}`,onClick:()=>y(!v),children:s(v?oe:ae,{})}),e(`div`,{className:`${p.clsx(Z.menuRules,t[1035]&&Z.addClassBackground,t[835]&&Z.addClassPosition)} ${v?Z.menuOff:null}`,children:[s(d,{className:Z.wizardButton,fullWidth:!0,size:`small`,variant:`outlined`,startIcon:s(ie,{}),onClick:h,children:D.t(`Wizard`)}),s(`div`,{className:Z.controlPanel,children:s(j,{className:Z.controlPanelAppBar,position:`static`,children:e(a,{value:b.index,onChange:w,children:[s(o,{className:`blocks-triggers`,title:D.t(`Triggers`),icon:s(R,{iconName:`FlashOn`}),...E(0)}),s(o,{title:D.t(`Conditions`),className:`blocks-conditions`,icon:s(R,{iconName:`Help`}),...E(1)}),s(o,{title:D.t(`Actions`),className:`blocks-actions`,icon:s(R,{iconName:`PlayForWork`}),...E(2)})]})})}),s(`div`,{className:Z.switchesRenderWrapper,children:e(`span`,{children:[r.map(e=>{let{name:t,id:n,icon:r,adapter:a}=e.getStaticData();return s(T,{children:s(Pe,{adapter:a,allProperties:e.getStaticData(),icon:r,id:n,isActive:!1,isTourOpen:m,name:t,onTouchMove:()=>y(!0),setTourStep:u,setUserRules:l,socket:_,tourStep:f,userRules:i})},n)}),!r.length&&e(`div`,{className:Z.nothingFound,children:[D.t(`Nothing found`),`...`,s(`div`,{className:Z.resetSearch,onClick:()=>{S({...b,text:``}),C(``)},children:D.t(`reset search`)})]})]})}),s(`div`,{className:p.clsx(Z.menuTitle,Z.marginAuto)}),s(V,{className:Z.inputWidth,fullWidth:!0,customValue:!0,value:b.text,size:`small`,autoComplete:`off`,label:D.t(`search`),variant:`outlined`,onChange:e=>{S({...b,text:e}),C(e)}})]})]})})},Q={bandTriggers:`_bandTriggers_91vrz_5`,bandConditions:`_bandConditions_91vrz_9`,bandActions:`_bandActions_91vrz_13`,paper:`_paper_91vrz_17`,title:`_title_91vrz_22`,close:`_close_91vrz_29`,content:`_content_91vrz_35`,stepper:`_stepper_91vrz_40`,step:`_step_91vrz_40`,hint:`_hint_91vrz_56`,warning:`_warning_91vrz_61`,blockCard:`_blockCard_91vrz_68`,blockBody:`_blockBody_91vrz_79`,remove:`_remove_91vrz_86`,notFound:`_notFound_91vrz_93`,chooser:`_chooser_91vrz_99`,choice:`_choice_91vrz_105`,choiceIcon:`_choiceIcon_91vrz_128`,choiceName:`_choiceName_91vrz_136`,addMore:`_addMore_91vrz_144`,summaryBand:`_summaryBand_91vrz_150`,summaryLabel:`_summaryLabel_91vrz_156`,preview:`_preview_91vrz_164`,actions:`_actions_91vrz_169`,spacer:`_spacer_91vrz_173`};M();var $=[`triggers`,`conditions`,`actions`],Ie={triggers:`Triggers`,conditions:`Conditions`,actions:`Actions`},Le={triggers:`What should start the rule?`,conditions:`When should the rule run? This step is optional.`,actions:`What should happen?`},Re={triggers:`when`,conditions:`and`,actions:`then`},ze={triggers:Q.bandTriggers,conditions:Q.bandConditions,actions:Q.bandActions},Be=()=>({triggers:[],conditions:[],actions:[]}),Ve=({onCreate:t,onClose:n,hasRule:a,socket:o,theme:c,themeType:l,themeName:f})=>{let{blocks:_}=O(H),[b,x]=h(0),[C,T]=h(Be),[k,j]=h(null),M=P(0),F=m(()=>{let e={triggers:[],conditions:[],actions:[]};return _==null||_.forEach(t=>{var n;let{acceptedBy:r}=t.getStaticData();(n=e[r])==null||n.push(t)}),e},[_]),I=m(()=>({triggers:C.triggers,conditions:C.conditions.length?[C.conditions]:[[]],justCheck:!1,actions:{then:C.actions,else:[]}}),[C]),ee=(e,t)=>{M.current+=1,T(n=>({...n,[e]:[...n[e],{id:t,_id:M.current,acceptedBy:e}]})),j(null)},L=(e,t)=>T(n=>({...n,[e]:n[e].filter(e=>e._id!==t)})),z=(e,t,n)=>T(r=>({...r,[e]:r[e].map(r=>r._id===t?{...n,_id:t,id:r.id,acceptedBy:e}:r)})),B=(e,t,n)=>{let r=_==null?void 0:_.find(t=>t.getStaticData().id===e.id);return r?s(r,{_id:e._id,settings:e,acceptedBy:t,onChange:n?()=>{}:n=>z(t,e._id,n),socket:o,theme:c,themeType:l,themeName:f,enableSimulation:!1,userRules:I,onUpdate:!1,setOnUpdate:()=>{}}):s(`div`,{className:Q.notFound,children:D.t(`Block not found`)})},te=t=>s(`div`,{className:Q.chooser,children:F[t].map(n=>{let{id:r,name:i,icon:a,adapter:c,title:l}=n.getStaticData();return e(`button`,{type:`button`,className:Q.choice,title:l?D.t(l):void 0,onClick:()=>ee(t,r),children:[s(R,{iconName:a,adapter:c,socket:o,className:Q.choiceIcon}),s(`span`,{className:Q.choiceName,children:D.t(i)})]},r)})}),V=(t,n)=>e(`div`,{className:Q.step,hidden:b!==n,children:[s(`div`,{className:Q.hint,children:D.t(Le[t])}),C[t].map(n=>e(`div`,{className:p.clsx(Q.blockCard,ze[t]),children:[s(`div`,{className:Q.blockBody,children:B(n,t)}),s(w,{className:Q.remove,size:`small`,title:D.t(`Delete`),onClick:()=>L(t,n._id),children:s(se,{fontSize:`small`})})]},n._id)),k===t||!C[t].length?te(t):s(d,{className:Q.addMore,startIcon:s(N,{}),onClick:()=>j(t),children:D.t(`Add another`)})]},t),ne=()=>e(`div`,{className:Q.step,children:[$.map(t=>C[t].length?e(`div`,{className:Q.summaryBand,children:[s(`div`,{className:p.clsx(Q.summaryLabel,ze[t]),children:D.t(Re[t])}),C[t].map(e=>s(`div`,{className:p.clsx(Q.blockCard,Q.preview,ze[t]),children:s(`div`,{className:Q.blockBody,children:B(e,t,!0)})},e._id))]},t):null),C.conditions.length?null:s(`div`,{className:Q.hint,children:D.t(`Without a condition the rule always runs`)}),a?s(`div`,{className:Q.warning,children:D.t(`The current rule will be replaced`)}):null]}),U=b===$.length,W=U||b===1||!!C[$[b]].length;return e(y,{open:!0,fullWidth:!0,maxWidth:`md`,onClose:n,classes:{paper:Q.paper},children:[e(S,{className:Q.title,children:[D.t(`Create a rule step by step`),s(w,{className:Q.close,size:`small`,title:D.t(`Close`),onClick:n,children:s(g,{})})]}),e(E,{className:Q.content,children:[e(r,{className:Q.stepper,activeStep:b,children:[$.map(e=>s(i,{children:s(u,{children:D.t(Ie[e])})},e)),s(i,{children:s(u,{children:D.t(`Summary`)})})]}),$.map(V),U?ne():null]}),e(A,{className:Q.actions,children:[s(d,{disabled:!b,startIcon:s(le,{}),onClick:()=>x(b-1),children:D.t(`Back`)}),s(`div`,{className:Q.spacer}),s(d,{onClick:n,children:D.t(`Cancel`)}),U?s(d,{variant:`contained`,color:`primary`,onClick:()=>{t(I),n()},children:D.t(a?`Replace rule`:`Create rule`)}):s(d,{variant:`contained`,color:`primary`,disabled:!W,endIcon:s(v,{}),onClick:()=>x(b+1),children:D.t(b===1&&!C.conditions.length?`Skip`:`Next`)})]})]})};M();var He=[],Ue=({code:t,onChange:n,themeName:r,themeType:i,theme:a,setTourStep:o,tourStep:c,isTourOpen:l,command:u,scriptId:f,changed:p,running:m,newRuleId:g,onNewRuleHandled:_})=>{var v;let{blocks:y,socket:S,setOnUpdate:C,setOnDebugMessage:w,setEnableSimulation:T}=O(H),[E,k]=h([]),[A,j]=h(te(t)),[M,N]=h(``),[ee,L]=h(!1),[R,z]=h(!1);x(()=>{let e,t,n=(n,r)=>{n===`${e}.alive`&&t!==(r==null?void 0:r.val)&&(t=!!(r!=null&&r.val),t&&e&&(S==null||S.sendTo(e.replace(/^system\.adapter\./,``),`rulesOn`,f)))},r=(r,i)=>{var a;if(S&&e!==(i==null||(a=i.common)==null?void 0:a.engine)){var o;e&&(S.unsubscribeState(`${e}.alive`,n),t&&S.sendTo(e.replace(/^system\.adapter\./,``),`rulesOn`,f)),e=i==null||(o=i.common)==null?void 0:o.engine,e&&e&&S.subscribeState(`${e}.alive`,n)}},i=(e,t)=>{if(t)try{let e=JSON.parse(t.val),n=Date.now();if(e.ruleId===f&&n-e.ts<1e3){let t=[...He,{blockId:e.blockId,data:e.data,ts:e.ts}];t.length>200&&t.splice(0,t.length-200);for(let e=t.length-1;e>=0;e--)if(t[e].ts<n-5e3){t.splice(0,e);break}He=t,w(t)}}catch{console.error(`Cannot parse: ${t.val}`)}};return S==null||S.getObject(f).then(t=>{var a;e=t==null||(a=t.common)==null?void 0:a.engine,S.subscribeObject(f,r),e&&(S.subscribeState(`${e}.alive`,n),S.subscribeState(`${e.replace(/^system\.adapter\./,``)}.debug.rules`,i))}),function(){S==null||S.unsubscribeObject(f,r),e&&(S==null||S.unsubscribeState(`${e}.alive`,n),t&&(S==null||S.sendTo(e.replace(/^system\.adapter\./,``),`rulesOff`,f)),S==null||S.unsubscribeState(`${e.replace(/^system\.adapter\./,``)}.debug.rules`,i))}},[]),x(()=>{T(!p&&m)},[p,m,T]),x(()=>{u&&(N(u),ee||L(!0))},[u]),x(()=>{let e=te(t);JSON.stringify(e)!==JSON.stringify(A)&&(j(e),C(!0))},[t]),x(()=>{document.getElementsByTagName(`HTML`)[0].className=r||`blue`},[r]),x(()=>{g&&g===f&&(_(),z(!0))},[g,f,_]);let B=b(e=>{j(e),y&&n(ne(e,y))},[y,n]),V=P(null),[U,W]=h({835:!1,1035:!1});if(x(()=>{V.current&&(V.current.clientWidth<=1035&&W({835:!1,1035:!0}),V.current.clientWidth<=835&&W({1035:!0,835:!0}),V.current.clientWidth>1035&&W({835:!1,1035:!1}))},[((v=V.current)==null?void 0:v.clientWidth)||0]),!y||!S)return null;let re=!A.triggers.length&&!A.actions.then.length&&!A.actions.else.length&&!A.conditions.some(e=>e.length);return e(`div`,{className:K.wrapperRules,ref:V,children:[s(be,{allBlocks:E,socket:S}),ee?M===`export`?s(F,{scriptId:f,themeType:i,onClose:()=>L(!1),text:JSON.stringify(A,null,2)}):s(I,{themeType:i,onClose:e=>{L(!1),e&&B(JSON.parse(e))}}):null,R?s(Ve,{hasRule:!re,socket:S,theme:a,themeType:i,themeName:r,onCreate:B,onClose:()=>z(!1)}):null,e(`div`,{className:K.rootWrapper,children:[s(Fe,{setAllBlocks:k,allBlocks:E,userRules:A,onChangeBlocks:B,setTourStep:o,tourStep:c,addClass:U,isTourOpen:l,onStartWizard:()=>z(!0)}),e(`div`,{className:K.bands,children:[re?e(`div`,{className:K.emptyRule,children:[s(`div`,{className:K.emptyRuleText,children:D.t(`Create a rule step by step`)}),s(d,{variant:`contained`,color:`primary`,startIcon:s(ie,{}),onClick:()=>z(!0),children:D.t(`Wizard`)})]}):null,s(Ne,{socket:S,setUserRules:B,userRules:A,isTourOpen:l,setTourStep:o,tourStep:c,name:`${D.t(`when`)}...`,typeBlock:`triggers`,iconName:`FlashOn`,themeType:i,themeName:r,theme:a}),s(Ne,{socket:S,setUserRules:B,isTourOpen:l,setTourStep:o,tourStep:c,userRules:A,name:`...${D.t(`and`)}...`,typeBlock:`conditions`,iconName:`Help`,nameAdditionally:D.t(`or`),additionally:!0,themeType:i,themeName:r,theme:a}),s(Ne,{socket:S,setUserRules:B,isTourOpen:l,setTourStep:o,tourStep:c,userRules:A,name:`...${D.t(`then`)}`,typeBlock:`actions`,iconName:`PlayForWork`,nameAdditionally:D.t(`else`),additionally:!0,themeType:i,themeName:r,theme:a})]})]})]},`rulesEditor`)};export{Ue as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{$n as e,Ct as t,Qn as n,Ut as r,Vt as i,en as a,in as o,lt as s,nn as c,nr as l,p as u,tn as d,wr as f}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__113183188387379__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-D-gi6Mty.js";import{t as p}from"./ScriptEditorVanillaMonaco-
|
|
1
|
+
import{$n as e,Ct as t,Qn as n,Ut as r,Vt as i,en as a,in as o,lt as s,nn as c,nr as l,p as u,tn as d,wr as f}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__113183188387379__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-D-gi6Mty.js";import{t as p}from"./ScriptEditorVanillaMonaco-DYNr4-5w.js";f();var m={textArea:{width:`calc(100% - 10px)`,resize:`none`},dialog:{height:`95%`},fullHeight:{height:`100%`,overflow:`hidden`},args:e=>({color:e.palette.mode===`dark`?`white`:`black`,height:30,width:`100%`,fontSize:16}),argsTitle:e=>({color:e.palette.mode===`dark`?`white`:`black`,fontWeight:`bold`})},h=class extends l.Component{constructor(e){super(e),this.state={changed:!1,source:!e.source&&e.isReturn?`
|
|
2
2
|
return false`:e.source}}componentDidMount(){setTimeout(()=>{try{var e;(e=window.document.getElementById(`source-text-area`))==null||e.focus()}catch{}},100)}handleCancel(){this.props.onClose(!1)}handleOk(){(!this.props.isReturn||this.state.source.includes(`return `))&&this.props.onClose(this.state.source)}onChange(e){this.setState({changed:!0,source:e})}render(){return e(a,{onClose:()=>!1,maxWidth:`lg`,sx:{"& .MuiDialog-paper":m.dialog},fullWidth:!0,open:!0,"aria-labelledby":`source-dialog-title`,children:[n(o,{id:`source-dialog-title`,children:u.t(`Function editor`)}),e(c,{style:m.fullHeight,children:[this.props.args&&e(i,{sx:m.args,children:[n(i,{component:`span`,sx:m.argsTitle,children:u.t(`function (`)}),this.props.args,n(i,{component:`span`,sx:m.argsTitle,children:`)`})]},`arguments`),n(p,{triggerPrettier:1,adapterName:this.props.adapterName,runningInstances:this.props.runningInstances,style:{...m.textArea,height:this.props.args?`calc(100% - 30px)`:`100%`},name:`blockly`,socket:this.props.socket,readOnly:!1,checkJs:!1,changed:this.state.changed,code:this.state.source,isDark:this.props.themeType===`dark`,onChange:e=>this.onChange(e),language:`javascript`},`scriptEditor`)]}),e(d,{children:[n(r,{variant:`contained`,onClick:()=>this.handleOk(),color:`primary`,startIcon:n(s,{}),children:u.t(`Save`)}),n(r,{color:`grey`,variant:`contained`,onClick:()=>this.handleCancel(),startIcon:n(t,{}),children:u.t(`Cancel`)})]})]})}};export{h as default};
|
package/admin/assets/{ScriptEditorVanillaMonaco-C0biTTli.js → ScriptEditorVanillaMonaco-DYNr4-5w.js}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./stateHoverProvider-BkW15VMN.js","./cronHoverProvider-BZMOFHO_.js","./AiInlineProvider-BxOW88xU.js","./AiChatService-Bsp_rhVx.js","./index-
|
|
2
|
-
import{r as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./vite-preload-helper-CaC3yEL3.js";import{$n as n,N as r,Nn as i,Qn as a,Ut as o,en as s,in as c,mn as l,nn as u,nr as d,p as f,sn as p,tn as m,wr as h,z as g,zn as _}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__113183188387379__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-D-gi6Mty.js";import{d as v,p as y,u as b}from"./index-PLY-IJik.js";var x=e({default:()=>T});h();function S(e){return/^script\.js\.global\./.test(e)}var C=0;function w(e){return e.replace(/\x1b\[[0-9;]*m/g,``)}var T=class extends d.Component{get monacoTS(){var e;return(e=this.monaco)==null||(e=e.languages)==null?void 0:e.typescript}constructor(e){super(e),_(this,`monacoDiv`,null),_(this,`editor`,null),_(this,`monaco`,window.monaco),_(this,`insert`,``),_(this,`originalCode`,void 0),_(this,`runningInstancesStr`,void 0),_(this,`monacoCounter`,0),_(this,`location`,void 0),_(this,`breakpoints`,void 0),_(this,`lastSearch`,``),_(this,`typings`,{}),_(this,`decorations`,[]),_(this,`datapointProviderDisposable`,null),_(this,`inlineProviderDisposable`,null),_(this,`stateHoverDisposable`,null),_(this,`showStateValueDisposable`,null),_(this,`cronHoverDisposable`,null),_(this,`codeLensDisposable`,null),_(this,`aiHelpersUnsubscribe`,null),_(this,`inlineChatWidgetInstance`,null),_(this,`inlineDiffInstance`,null),_(this,`inlineDiffCssInjected`,!1),_(this,`triggerPrettier`,void 0),_(this,`contentChangeDisposable`,null),_(this,`mouseDownDisposable`,null),this.state={name:`current`,isDark:e.isDark||!1,language:e.language||`javascript`,readOnly:e.readOnly||!1,alive:!0,check:!1,searchText:this.props.searchText||``,typingsLoaded:!1,showError:null},this.triggerPrettier=e.triggerPrettier,this.runningInstancesStr=JSON.stringify(this.props.runningInstances),this.originalCode=e.code||``,this.monacoDiv=d.createRef()}waitForMonaco(e){var t;let n=!!((t=this.monacoTS)!=null&&(t=t.typescriptDefaults)!=null&&t.getCompilerOptions);if(!n||!this.props.runningInstances){var r;if(this.monaco=window.monaco,n=!!((r=this.monacoTS)!=null&&(r=r.typescriptDefaults)!=null&&r.getCompilerOptions),this.monacoCounter++,!n&&this.monacoCounter<20){console.log(`wait for monaco loaded`),setTimeout(()=>this.waitForMonaco(e),200);return}this.monacoCounter>=20&&console.error(`Cannot load monaco!`)}else e&&e()}loadTypings(e){if(!this.editor)return;e||=this.props.runningInstances;let t=e&&Object.keys(e).find(t=>e==null?void 0:e[t]);t&&this.props.socket.sendTo(t.replace(`system.adapter.`,``),`loadTypings`,null).then(e=>{this.setState({alive:!0,check:!0,typingsLoaded:!0}),this.setTypeCheck(!0),e.typings?(this.typings=e.typings,this.setEditorTypings(this.state.name)):console.error(`failed to load typings: ${e.error}`)})}componentDidMount(){var e;this.undo,this.redo,this.showInlineDiff,this.getEditorSelection,this.getEditorContent,this.getCursorPosition,this.highlightLineRange,this.goToLine,this.replaceSelection,this.getDiagnostics,this.getDocumentSymbols;let n=!!((e=this.monacoTS)!=null&&(e=e.typescriptDefaults)!=null&&e.getCompilerOptions);if(!n||!this.props.runningInstances){var r;if(this.monaco=window.monaco,n=!!((r=this.monacoTS)!=null&&(r=r.typescriptDefaults)!=null&&r.getCompilerOptions),!n){console.log(`wait for monaco loaded...`),this.waitForMonaco(()=>this.componentDidMount());return}}if(!this.editor&&n&&this.monaco){var i,a,o;console.log(`Init editor`),(i=(a=this.props).onRegisterSelect)==null||i.call(a,()=>{if(this.editor){let t=this.editor.getSelection();if(t){var e;return(e=this.editor.getModel())==null?void 0:e.getValueInRange(t)}}});let e=this.monacoTS.typescriptDefaults.getCompilerOptions();if(e.allowJs=!0,e.checkJs=this.props.checkJs!==!1,e.noLib=!0,e.lib=[],e.useUnknownInCatchVariables=!1,e.moduleResolution=this.monacoTS.ModuleResolutionKind.NodeJs,e.target=this.monacoTS.ScriptTarget.ESNext,e.module=this.monacoTS.ModuleKind.ESNext,e.allowNonTsExtensions=!0,this.monacoTS.typescriptDefaults.setCompilerOptions(e),this.setTypeCheck(!1),(o=this.monacoDiv)!=null&&o.current){var s;this.editor=this.monaco.editor.create((s=this.monacoDiv)==null?void 0:s.current,{lineNumbers:`on`,scrollBeyondLastLine:!1,automaticLayout:!0,glyphMargin:!!this.props.breakpoints,colorDecorators:!0,hover:{enabled:`on`,delay:200,sticky:!0},fixedOverflowWidgets:!0}),this.contentChangeDisposable=this.editor.onDidChangeModelContent(()=>this.onChange()),this.monaco&&!this.datapointProviderDisposable&&t(async()=>{let{registerDatapointProvider:e}=await import(`./AiDatapointProvider-DzFpUKkT.js`);return{registerDatapointProvider:e}},[],import.meta.url).then(({registerDatapointProvider:e})=>{this.monaco&&(this.datapointProviderDisposable=e(this.monaco,this.props.socket))}).catch(()=>{}),this.monaco&&!this.showStateValueDisposable&&t(async()=>{let{registerShowStateValueAction:e}=await import(`./stateHoverProvider-BkW15VMN.js`);return{registerShowStateValueAction:e}},__vite__mapDeps([0]),import.meta.url).then(({registerShowStateValueAction:e})=>{this.monaco&&this.editor&&!this.showStateValueDisposable&&(this.showStateValueDisposable=e(this.editor,this.monaco,f.t(`Show ioBroker state value`)))}).catch(()=>{}),this.registerAiHelpers(),this.aiHelpersUnsubscribe=v(e=>{e?this.registerAiHelpers():this.disposeAiHelpers()}),this.loadTypings(),this.props.onForceSave&&this.editor.addCommand(this.monaco.KeyMod.CtrlCmd|this.monaco.KeyCode.KeyS,()=>this.props.onForceSave&&this.props.onForceSave()),this.registerAiActions(),setTimeout(()=>{this.highlightText(this.state.searchText),this.location=this.props.location||void 0,this.breakpoints=this.props.breakpoints,this.showDecorators()})}}let c={selectOnLineNumbers:!0,scrollBeyondLastLine:!1,automaticLayout:!0,readOnly:this.state.readOnly,language:this.state.language,isDark:this.state.isDark};this.setEditorOptions(c),this.editor&&(this.editor.focus(),this.editor.setValue(this.originalCode),this.props.onToggleBreakpoint&&(this.mouseDownDisposable=this.editor.onMouseDown(e=>{var t;let n=e.target;this.props.onToggleBreakpoint&&((t=n.detail)==null?void 0:t.glyphMarginLeft)!==void 0&&n.position&&this.props.onToggleBreakpoint(n.position.lineNumber-1)})))}setEditorOptions(e){if(e&&(e.language&&this.setEditorLanguage(e.language),this.editor&&(e.readOnly!==void 0&&this.editor.updateOptions({readOnly:e.readOnly}),e.lineWrap!==void 0&&this.editor.updateOptions({wordWrap:e.lineWrap?`on`:`off`})),e.typeCheck!==void 0&&this.setTypeCheck(e.typeCheck),e.isDark!==void 0)){var t;(t=this.monaco)==null||t.editor.setTheme(e.isDark?`vs-dark`:`vs`)}}registerAiHelpers(){b()&&this.monaco&&this.editor&&(this.stateHoverDisposable||t(async()=>{let{registerStateHoverProvider:e}=await import(`./stateHoverProvider-BkW15VMN.js`);return{registerStateHoverProvider:e}},__vite__mapDeps([0]),import.meta.url).then(({registerStateHoverProvider:e})=>{this.monaco&&b()&&!this.stateHoverDisposable&&(this.stateHoverDisposable=e(this.monaco,this.props.socket))}).catch(()=>{}),this.cronHoverDisposable||t(async()=>{let{registerCronHoverProvider:e}=await import(`./cronHoverProvider-BZMOFHO_.js`);return{registerCronHoverProvider:e}},__vite__mapDeps([1]),import.meta.url).then(({registerCronHoverProvider:e})=>{this.monaco&&b()&&!this.cronHoverDisposable&&(this.cronHoverDisposable=e(this.monaco))}).catch(()=>{}),this.props.aiCompletionsEnabled&&!this.inlineProviderDisposable&&t(async()=>{let{registerAiInlineProvider:e}=await import(`./AiInlineProvider-BxOW88xU.js`);return{registerAiInlineProvider:e}},__vite__mapDeps([2,3]),import.meta.url).then(({registerAiInlineProvider:e})=>{this.monaco&&b()&&!this.inlineProviderDisposable&&(this.inlineProviderDisposable=e(this.monaco,this.props.socket,this.props.runningInstances))}).catch(()=>{}),this.props.onAiAction&&!this.codeLensDisposable&&t(async()=>{let{registerAiCodeLensProvider:e}=await import(`./index-PLY-IJik.js`).then(e=>e.f);return{registerAiCodeLensProvider:e}},__vite__mapDeps([4,5,6,7,8]),import.meta.url).then(({registerAiCodeLensProvider:e})=>{this.monaco&&this.editor&&this.props.onAiAction&&b()&&!this.codeLensDisposable&&(this.codeLensDisposable=e(this.monaco,this.editor,(e,t,n,r,i)=>{var a,o,s;let c=(a=this.editor)==null?void 0:a.getModel(),l=c?c.getLineMaxColumn(Math.min(i,c.getLineCount())):1;(o=(s=this.props).onAiAction)==null||o.call(s,{action:e,code:t,rangeLabel:n,range:{startLine:r,startColumn:1,endLine:i,endColumn:l},kind:`codelens`})}))}).catch(()=>{}))}disposeAiHelpers(){var e,t,n,r;(e=this.stateHoverDisposable)==null||e.dispose(),this.stateHoverDisposable=null,(t=this.cronHoverDisposable)==null||t.dispose(),this.cronHoverDisposable=null,(n=this.inlineProviderDisposable)==null||n.dispose(),this.inlineProviderDisposable=null,(r=this.codeLensDisposable)==null||r.dispose(),this.codeLensDisposable=null}componentWillUnmount(){var e,n,r,i,a,o,s,c,l,u;if((e=this.contentChangeDisposable)==null||e.dispose(),this.contentChangeDisposable=null,(n=this.mouseDownDisposable)==null||n.dispose(),this.mouseDownDisposable=null,(r=this.datapointProviderDisposable)==null||r.dispose(),this.datapointProviderDisposable=null,t(async()=>{let{clearDatapointCache:e}=await import(`./AiDatapointProvider-DzFpUKkT.js`);return{clearDatapointCache:e}},[],import.meta.url).then(({clearDatapointCache:e})=>e()).catch(()=>{}),(i=this.inlineProviderDisposable)==null||i.dispose(),this.inlineProviderDisposable=null,(a=this.stateHoverDisposable)==null||a.dispose(),this.stateHoverDisposable=null,(o=this.showStateValueDisposable)==null||o.dispose(),this.showStateValueDisposable=null,t(async()=>{let{clearStateHoverCache:e}=await import(`./stateHoverProvider-BkW15VMN.js`);return{clearStateHoverCache:e}},__vite__mapDeps([0]),import.meta.url).then(({clearStateHoverCache:e})=>e()).catch(()=>{}),(s=this.cronHoverDisposable)==null||s.dispose(),this.cronHoverDisposable=null,(c=this.codeLensDisposable)==null||c.dispose(),this.codeLensDisposable=null,(l=this.aiHelpersUnsubscribe)==null||l.call(this),this.aiHelpersUnsubscribe=null,(u=this.inlineChatWidgetInstance)==null||u.dispose(),this.inlineChatWidgetInstance=null,this.hideInlineDiff(),this.editor){var d,f;(d=(f=this.props).onRegisterSelect)==null||d.call(f,null),this.editor.dispose(),this.editor=null}}async doPrettier(){var e;let t=this.props.runningInstances&&Object.keys(this.props.runningInstances).find(e=>{var t;return(t=this.props.runningInstances)==null?void 0:t[e]});if(!t){window.alert(f.t(`No script adapter instance found to format the code`));return}let n=await this.props.socket.sendTo(t.replace(`system.adapter.`,``),`prettier`,{code:(e=this.editor)==null?void 0:e.getValue(),type:this.state.language});if(n.error)this.setState({showError:{title:f.t(`Error formatting code`),message:w(n.error)}});else if(n.code){var r,i,a;(r=this.editor)==null||r.setValue(n.code),(i=(a=this.props).onChange)==null||i.call(a,n.code),this.showDecorators()}}setEditorLanguage(e){if(!this.editor)return;let t=this.editor.getModel();if(t){var n;let i=t.getValue(),a=t.uri.path,o=typeof a==`string`&&a.includes(`.`)?a.substring(0,a.lastIndexOf(`.`)):`index`,s=e===`javascript`?`js`:e===`typescript`?`ts`:e;t.dispose();let c=e===`javascript`||e===`typescript`?`typescript`:e,l=(n=this.monaco)==null?void 0:n.editor.createModel(i,c,this.monaco.Uri.from({scheme:window.location.protocol.replace(`:`,``),path:`${o}${C++}.${s}`}));if(l){var r;this.editor.setModel(l),(r=this.contentChangeDisposable)==null||r.dispose(),this.contentChangeDisposable=this.editor.onDidChangeModelContent(()=>this.onChange())}}}setTypeCheck(e){var t,n;let r={noSemanticValidation:!this.state.alive||!e,noSyntaxValidation:!this.state.alive};(t=this.monacoTS)==null||t.typescriptDefaults.setDiagnosticsOptions(r),(n=this.monacoTS)==null||n.javascriptDefaults.setDiagnosticsOptions({noSemanticValidation:!this.state.alive||!e,noSyntaxValidation:!this.state.alive})}setEditorTypings(e=``){var t,n;let r=S(e),i=`${e}.d.ts`,a=[];for(let e of Object.keys(this.typings))r&&(e===`global.d.ts`||e.startsWith(`script.js.global`)&&e!==i)||a.push({filePath:e,content:this.typings[e]});if((t=this.monacoTS)!=null&&(t=t.typescriptDefaults)!=null&&t.setExtraLibs)this.monacoTS.typescriptDefaults.setExtraLibs(a);else if((n=this.monacoTS)!=null&&(n=n.typescriptDefaults)!=null&&n.addExtraLib){let e=this.monacoTS.typescriptDefaults.getExtraLibs();a.forEach(t=>{!e[t.filePath]&&this.monaco&&this.monacoTS.typescriptDefaults.addExtraLib(t.content,t.filePath)})}}undo(){var e;(e=this.editor)==null||e.trigger(`toolbar`,`undo`,null)}redo(){var e;(e=this.editor)==null||e.trigger(`toolbar`,`redo`,null)}insertTextIntoEditor(e){if(!this.editor||!this.monaco)return;let t=this.editor.getSelection();if(t){let n=new this.monaco.Range(t.startLineNumber,t.startColumn,t.endLineNumber,t.endColumn);this.editor.executeEdits(``,[{range:n,text:e,forceMoveMarkers:!0}])}this.editor.focus()}highlightText(e){var t;if(!this.editor||!this.monaco)return 0;let n=e?(t=this.editor.getModel())==null?void 0:t.findMatches(e,!0,!1,!1,null,!0):void 0;if(n!=null&&n.length)return n.forEach(e=>{var t;return(t=this.editor)==null?void 0:t.setSelection(e.range)}),this.editor.revealLine(n[0].range.startLineNumber),n.length;let r=this.editor.getPosition();if(r){let e=r.lineNumber,t=r.column;this.editor.setSelection(new this.monaco.Range(e,t,e,t))}return 0}showInlineDiff(e){if(!this.editor||!this.monaco)return;let n=this.editor,r=this.monaco;this.hideInlineDiff(),t(async()=>{let{InlineDiffController:e,INLINE_DIFF_CSS:t}=await import(`./inlineDiffController-Qh402KhK.js`);return{InlineDiffController:e,INLINE_DIFF_CSS:t}},__vite__mapDeps([9,10]),import.meta.url).then(({InlineDiffController:t,INLINE_DIFF_CSS:i})=>{if(!this.inlineDiffCssInjected){let e=document.createElement(`style`);e.textContent=i,e.setAttribute(`data-iob-aichat`,`inline-diff`),document.head.appendChild(e),this.inlineDiffCssInjected=!0}let a=new t(n,r,{range:e.range,originalText:e.originalText,modifiedText:e.modifiedText,onAccepted:()=>{var t;this.inlineDiffInstance=null,(t=e.onAccepted)==null||t.call(e)},onRejected:()=>{var t;this.inlineDiffInstance=null,(t=e.onRejected)==null||t.call(e)}});this.inlineDiffInstance=a,a.show()}).catch(()=>{})}hideInlineDiff(){if(this.inlineDiffInstance){try{this.inlineDiffInstance.dispose()}catch{}this.inlineDiffInstance=null}}showInlineChatWidget(){if(!this.editor||!this.monaco||!this.props.onInlineAsk)return;if(this.inlineChatWidgetInstance){this.inlineChatWidgetInstance.show();return}let e=this.editor,n=this.monaco,r=this.props.onInlineAsk,i=this.props.onAiAction;t(async()=>{let{InlineChatWidget:e}=await import(`./inlineChatWidget-NIvdRGmU.js`);return{InlineChatWidget:e}},__vite__mapDeps([11,10]),import.meta.url).then(({InlineChatWidget:t})=>{let a=new t(e,n,{onSubmit:async e=>r({question:e.question,selectedCode:e.selectedCode}),onEscalateToChat:e=>{i&&i({action:`ask`,code:e.selectedCode,question:e.question,rangeLabel:e.range?`lines ${e.range.startLineNumber}-${e.range.endLineNumber}`:`whole file`})}});this.inlineChatWidgetInstance=a,a.show()}).catch(()=>{})}registerAiActions(){if(!this.editor||!this.monaco||!this.props.onAiAction)return;let e=this.monaco,t=(t,n={})=>{if(!this.editor||!this.props.onAiAction)return;let r=this.editor.getModel();if(!r)return;let i=this.editor.getSelection(),a=i&&!i.isEmpty(),o,s,c,l=`selection`;if(a)o=r.getValueInRange(i),s=i.startLineNumber===i.endLineNumber?`line ${i.startLineNumber}`:`lines ${i.startLineNumber}-${i.endLineNumber}`,c={startLine:i.startLineNumber,startColumn:i.startColumn,endLine:i.endLineNumber,endColumn:i.endColumn},l=`selection`;else{let t=this.editor.getPosition(),n=null;if(t)try{n=y(r.getValue(),t.lineNumber)}catch{}if(n){let t=n.startLine,i=n.endLine,a=r.getLineMaxColumn(i),u=new e.Range(t,1,i,a);o=r.getValueInRange(u),s=t===i?`line ${t}`:`lines ${t}-${i}`,c={startLine:t,startColumn:1,endLine:i,endColumn:a},l=`codelens`}else o=r.getValue(),s=`whole file`,l=`none`}this.props.onAiAction({action:t,code:o,rangeLabel:s,range:c,kind:l,...n})},n=[{id:`iobroker.ai.inline`,label:`🤖 ${f.t(`AI: Inline chat…`)}`,keybindings:[e.KeyMod.CtrlCmd|e.KeyMod.Alt|e.KeyCode.KeyI],order:1,run:()=>{if(this.props.onInlineAsk)this.showInlineChatWidget();else{let e=window.prompt(f.t(`Ask the AI about the selected code:`));e&&e.trim()&&t(`ask`,{question:e.trim()})}}},{id:`iobroker.ai.explain`,label:`💡 ${f.t(`AI: Explain`)}`,keybindings:[e.KeyMod.CtrlCmd|e.KeyMod.Alt|e.KeyCode.KeyE],order:2,run:()=>t(`explain`)},{id:`iobroker.ai.refactor`,label:`🔧 ${f.t(`AI: Refactor`)}`,keybindings:[e.KeyMod.CtrlCmd|e.KeyMod.Alt|e.KeyCode.KeyR],order:3,run:()=>t(`refactor`)},{id:`iobroker.ai.comment`,label:`💬 ${f.t(`AI: Add comments`)}`,keybindings:[e.KeyMod.CtrlCmd|e.KeyMod.Alt|e.KeyCode.KeyC],order:4,run:()=>t(`comment`)},{id:`iobroker.ai.fix`,label:`🛠️ ${f.t(`AI: Fix problem`)}`,keybindings:[e.KeyMod.CtrlCmd|e.KeyMod.Alt|e.KeyCode.KeyF],order:5,run:()=>{let n;try{var r,i;let t=(r=this.editor)==null?void 0:r.getModel(),a=(i=this.editor)==null?void 0:i.getPosition();if(t&&a){let r=e.editor.getModelMarkers({resource:t.uri}).find(e=>a.lineNumber>=e.startLineNumber&&a.lineNumber<=e.endLineNumber);r&&(n=r.message)}}catch{}t(`fix`,{diagnostic:n})}},{id:`iobroker.ai.tests`,label:`✅ ${f.t(`AI: Suggest tests`)}`,order:6,run:()=>t(`tests`)}];for(let e of n)try{this.editor.addAction({id:e.id,label:e.label,contextMenuGroupId:`aichat`,contextMenuOrder:e.order,keybindings:e.keybindings,run:()=>e.run()})}catch{}}getEditorSelection(){if(!this.editor)return null;let e=this.editor.getSelection();if(!e||e.isEmpty())return null;let t=this.editor.getModel();return t?{text:t.getValueInRange(e),range:{startLine:e.startLineNumber,startColumn:e.startColumn,endLine:e.endLineNumber,endColumn:e.endColumn}}:null}getEditorContent(){var e;return((e=this.editor)==null||(e=e.getModel())==null?void 0:e.getValue())??``}getCursorPosition(){var e;let t=(e=this.editor)==null?void 0:e.getPosition();return t?{line:t.lineNumber,column:t.column}:null}highlightLineRange(e,t){if(!this.editor||!this.monaco)return!1;let n=this.editor.getModel();if(!n)return!1;let r=n.getLineCount(),i=Math.max(1,Math.min(e,r)),a=Math.max(i,Math.min(t,r)),o=n.getLineMaxColumn(a);return this.editor.setSelection(new this.monaco.Range(i,1,a,o)),this.editor.revealLineInCenter(i),!0}goToLine(e,t=1){if(!this.editor||!this.monaco)return!1;let n=this.editor.getModel();if(!n)return!1;let r=n.getLineCount(),i=Math.max(1,Math.min(e,r));return this.editor.setPosition({lineNumber:i,column:t}),this.editor.revealLineInCenter(i),this.editor.focus(),!0}replaceSelection(e){if(!this.editor||!this.monaco)return!1;let t=this.editor.getSelection();if(!t)return!1;let n=new this.monaco.Range(t.startLineNumber,t.startColumn,t.endLineNumber,t.endColumn);return this.editor.executeEdits(``,[{range:n,text:e,forceMoveMarkers:!0}]),this.editor.focus(),!0}getDiagnostics(){if(!this.editor||!this.monaco)return[];let e=this.editor.getModel();if(!e)return[];let t=this.monaco.editor.getModelMarkers({resource:e.uri}),n={8:`error`,4:`warning`,2:`info`,1:`hint`};return t.map(e=>({line:e.startLineNumber,column:e.startColumn,endLine:e.endLineNumber,endColumn:e.endColumn,severity:n[e.severity]||`info`,message:e.message,...e.source?{source:e.source}:{}}))}async getDocumentSymbols(){if(!this.editor||!this.monaco)return[];let e=this.editor.getModel();if(!e)return[];let t=[];try{var n;let r=this.monaco.languages,i=(n=r.getDocumentSymbolProviders)==null?void 0:n.call(r,e);if(i!=null&&i.length){let n={0:`file`,1:`module`,2:`namespace`,3:`package`,4:`class`,5:`method`,6:`property`,7:`field`,8:`constructor`,9:`enum`,10:`interface`,11:`function`,12:`variable`,13:`constant`,14:`string`,15:`number`,16:`boolean`,17:`array`,18:`object`,19:`key`,20:`null`,21:`enum-member`,22:`struct`,23:`event`,24:`operator`,25:`type-parameter`};for(let r of i){let i=await r.provideDocumentSymbols(e,{isCancellationRequested:!1});if(!i)continue;let a=e=>{for(let i of e){var r;t.push({name:i.name,kind:n[i.kind]||String(i.kind),line:i.range.startLineNumber,endLine:i.range.endLineNumber,...i.detail?{detail:i.detail}:{}}),(r=i.children)!=null&&r.length&&a(i.children)}};if(a(i),t.length)break}}}catch{}if(t.length===0){let n=e.getValue().split(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./stateHoverProvider-BkW15VMN.js","./cronHoverProvider-BZMOFHO_.js","./AiInlineProvider-BxOW88xU.js","./AiChatService-Bsp_rhVx.js","./index-CRX4LAhD.js","./Import-XKVP-nRT.js","./Error-Ch2nx5uC.js","./blockly-fcfyKYzp.js","./index-CXaeqPRy.css","./inlineDiffController-Qh402KhK.js","./applyCodeEdit-D3nb7erO.js","./inlineChatWidget-NIvdRGmU.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./vite-preload-helper-CaC3yEL3.js";import{$n as n,N as r,Nn as i,Qn as a,Ut as o,en as s,in as c,mn as l,nn as u,nr as d,p as f,sn as p,tn as m,wr as h,z as g,zn as _}from"./_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__113183188387379__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-D-gi6Mty.js";import{d as v,p as y,u as b}from"./index-CRX4LAhD.js";var x=e({default:()=>T});h();function S(e){return/^script\.js\.global\./.test(e)}var C=0;function w(e){return e.replace(/\x1b\[[0-9;]*m/g,``)}var T=class extends d.Component{get monacoTS(){var e;return(e=this.monaco)==null||(e=e.languages)==null?void 0:e.typescript}constructor(e){super(e),_(this,`monacoDiv`,null),_(this,`editor`,null),_(this,`monaco`,window.monaco),_(this,`insert`,``),_(this,`originalCode`,void 0),_(this,`runningInstancesStr`,void 0),_(this,`monacoCounter`,0),_(this,`location`,void 0),_(this,`breakpoints`,void 0),_(this,`lastSearch`,``),_(this,`typings`,{}),_(this,`decorations`,[]),_(this,`datapointProviderDisposable`,null),_(this,`inlineProviderDisposable`,null),_(this,`stateHoverDisposable`,null),_(this,`showStateValueDisposable`,null),_(this,`cronHoverDisposable`,null),_(this,`codeLensDisposable`,null),_(this,`aiHelpersUnsubscribe`,null),_(this,`inlineChatWidgetInstance`,null),_(this,`inlineDiffInstance`,null),_(this,`inlineDiffCssInjected`,!1),_(this,`triggerPrettier`,void 0),_(this,`contentChangeDisposable`,null),_(this,`mouseDownDisposable`,null),this.state={name:`current`,isDark:e.isDark||!1,language:e.language||`javascript`,readOnly:e.readOnly||!1,alive:!0,check:!1,searchText:this.props.searchText||``,typingsLoaded:!1,showError:null},this.triggerPrettier=e.triggerPrettier,this.runningInstancesStr=JSON.stringify(this.props.runningInstances),this.originalCode=e.code||``,this.monacoDiv=d.createRef()}waitForMonaco(e){var t;let n=!!((t=this.monacoTS)!=null&&(t=t.typescriptDefaults)!=null&&t.getCompilerOptions);if(!n||!this.props.runningInstances){var r;if(this.monaco=window.monaco,n=!!((r=this.monacoTS)!=null&&(r=r.typescriptDefaults)!=null&&r.getCompilerOptions),this.monacoCounter++,!n&&this.monacoCounter<20){console.log(`wait for monaco loaded`),setTimeout(()=>this.waitForMonaco(e),200);return}this.monacoCounter>=20&&console.error(`Cannot load monaco!`)}else e&&e()}loadTypings(e){if(!this.editor)return;e||=this.props.runningInstances;let t=e&&Object.keys(e).find(t=>e==null?void 0:e[t]);t&&this.props.socket.sendTo(t.replace(`system.adapter.`,``),`loadTypings`,null).then(e=>{this.setState({alive:!0,check:!0,typingsLoaded:!0}),this.setTypeCheck(!0),e.typings?(this.typings=e.typings,this.setEditorTypings(this.state.name)):console.error(`failed to load typings: ${e.error}`)})}componentDidMount(){var e;this.undo,this.redo,this.showInlineDiff,this.getEditorSelection,this.getEditorContent,this.getCursorPosition,this.highlightLineRange,this.goToLine,this.replaceSelection,this.getDiagnostics,this.getDocumentSymbols;let n=!!((e=this.monacoTS)!=null&&(e=e.typescriptDefaults)!=null&&e.getCompilerOptions);if(!n||!this.props.runningInstances){var r;if(this.monaco=window.monaco,n=!!((r=this.monacoTS)!=null&&(r=r.typescriptDefaults)!=null&&r.getCompilerOptions),!n){console.log(`wait for monaco loaded...`),this.waitForMonaco(()=>this.componentDidMount());return}}if(!this.editor&&n&&this.monaco){var i,a,o;console.log(`Init editor`),(i=(a=this.props).onRegisterSelect)==null||i.call(a,()=>{if(this.editor){let t=this.editor.getSelection();if(t){var e;return(e=this.editor.getModel())==null?void 0:e.getValueInRange(t)}}});let e=this.monacoTS.typescriptDefaults.getCompilerOptions();if(e.allowJs=!0,e.checkJs=this.props.checkJs!==!1,e.noLib=!0,e.lib=[],e.useUnknownInCatchVariables=!1,e.moduleResolution=this.monacoTS.ModuleResolutionKind.NodeJs,e.target=this.monacoTS.ScriptTarget.ESNext,e.module=this.monacoTS.ModuleKind.ESNext,e.allowNonTsExtensions=!0,this.monacoTS.typescriptDefaults.setCompilerOptions(e),this.setTypeCheck(!1),(o=this.monacoDiv)!=null&&o.current){var s;this.editor=this.monaco.editor.create((s=this.monacoDiv)==null?void 0:s.current,{lineNumbers:`on`,scrollBeyondLastLine:!1,automaticLayout:!0,glyphMargin:!!this.props.breakpoints,colorDecorators:!0,hover:{enabled:`on`,delay:200,sticky:!0},fixedOverflowWidgets:!0}),this.contentChangeDisposable=this.editor.onDidChangeModelContent(()=>this.onChange()),this.monaco&&!this.datapointProviderDisposable&&t(async()=>{let{registerDatapointProvider:e}=await import(`./AiDatapointProvider-DzFpUKkT.js`);return{registerDatapointProvider:e}},[],import.meta.url).then(({registerDatapointProvider:e})=>{this.monaco&&(this.datapointProviderDisposable=e(this.monaco,this.props.socket))}).catch(()=>{}),this.monaco&&!this.showStateValueDisposable&&t(async()=>{let{registerShowStateValueAction:e}=await import(`./stateHoverProvider-BkW15VMN.js`);return{registerShowStateValueAction:e}},__vite__mapDeps([0]),import.meta.url).then(({registerShowStateValueAction:e})=>{this.monaco&&this.editor&&!this.showStateValueDisposable&&(this.showStateValueDisposable=e(this.editor,this.monaco,f.t(`Show ioBroker state value`)))}).catch(()=>{}),this.registerAiHelpers(),this.aiHelpersUnsubscribe=v(e=>{e?this.registerAiHelpers():this.disposeAiHelpers()}),this.loadTypings(),this.props.onForceSave&&this.editor.addCommand(this.monaco.KeyMod.CtrlCmd|this.monaco.KeyCode.KeyS,()=>this.props.onForceSave&&this.props.onForceSave()),this.registerAiActions(),setTimeout(()=>{this.highlightText(this.state.searchText),this.location=this.props.location||void 0,this.breakpoints=this.props.breakpoints,this.showDecorators()})}}let c={selectOnLineNumbers:!0,scrollBeyondLastLine:!1,automaticLayout:!0,readOnly:this.state.readOnly,language:this.state.language,isDark:this.state.isDark};this.setEditorOptions(c),this.editor&&(this.editor.focus(),this.editor.setValue(this.originalCode),this.props.onToggleBreakpoint&&(this.mouseDownDisposable=this.editor.onMouseDown(e=>{var t;let n=e.target;this.props.onToggleBreakpoint&&((t=n.detail)==null?void 0:t.glyphMarginLeft)!==void 0&&n.position&&this.props.onToggleBreakpoint(n.position.lineNumber-1)})))}setEditorOptions(e){if(e&&(e.language&&this.setEditorLanguage(e.language),this.editor&&(e.readOnly!==void 0&&this.editor.updateOptions({readOnly:e.readOnly}),e.lineWrap!==void 0&&this.editor.updateOptions({wordWrap:e.lineWrap?`on`:`off`})),e.typeCheck!==void 0&&this.setTypeCheck(e.typeCheck),e.isDark!==void 0)){var t;(t=this.monaco)==null||t.editor.setTheme(e.isDark?`vs-dark`:`vs`)}}registerAiHelpers(){b()&&this.monaco&&this.editor&&(this.stateHoverDisposable||t(async()=>{let{registerStateHoverProvider:e}=await import(`./stateHoverProvider-BkW15VMN.js`);return{registerStateHoverProvider:e}},__vite__mapDeps([0]),import.meta.url).then(({registerStateHoverProvider:e})=>{this.monaco&&b()&&!this.stateHoverDisposable&&(this.stateHoverDisposable=e(this.monaco,this.props.socket))}).catch(()=>{}),this.cronHoverDisposable||t(async()=>{let{registerCronHoverProvider:e}=await import(`./cronHoverProvider-BZMOFHO_.js`);return{registerCronHoverProvider:e}},__vite__mapDeps([1]),import.meta.url).then(({registerCronHoverProvider:e})=>{this.monaco&&b()&&!this.cronHoverDisposable&&(this.cronHoverDisposable=e(this.monaco))}).catch(()=>{}),this.props.aiCompletionsEnabled&&!this.inlineProviderDisposable&&t(async()=>{let{registerAiInlineProvider:e}=await import(`./AiInlineProvider-BxOW88xU.js`);return{registerAiInlineProvider:e}},__vite__mapDeps([2,3]),import.meta.url).then(({registerAiInlineProvider:e})=>{this.monaco&&b()&&!this.inlineProviderDisposable&&(this.inlineProviderDisposable=e(this.monaco,this.props.socket,this.props.runningInstances))}).catch(()=>{}),this.props.onAiAction&&!this.codeLensDisposable&&t(async()=>{let{registerAiCodeLensProvider:e}=await import(`./index-CRX4LAhD.js`).then(e=>e.f);return{registerAiCodeLensProvider:e}},__vite__mapDeps([4,5,6,7,8]),import.meta.url).then(({registerAiCodeLensProvider:e})=>{this.monaco&&this.editor&&this.props.onAiAction&&b()&&!this.codeLensDisposable&&(this.codeLensDisposable=e(this.monaco,this.editor,(e,t,n,r,i)=>{var a,o,s;let c=(a=this.editor)==null?void 0:a.getModel(),l=c?c.getLineMaxColumn(Math.min(i,c.getLineCount())):1;(o=(s=this.props).onAiAction)==null||o.call(s,{action:e,code:t,rangeLabel:n,range:{startLine:r,startColumn:1,endLine:i,endColumn:l},kind:`codelens`})}))}).catch(()=>{}))}disposeAiHelpers(){var e,t,n,r;(e=this.stateHoverDisposable)==null||e.dispose(),this.stateHoverDisposable=null,(t=this.cronHoverDisposable)==null||t.dispose(),this.cronHoverDisposable=null,(n=this.inlineProviderDisposable)==null||n.dispose(),this.inlineProviderDisposable=null,(r=this.codeLensDisposable)==null||r.dispose(),this.codeLensDisposable=null}componentWillUnmount(){var e,n,r,i,a,o,s,c,l,u;if((e=this.contentChangeDisposable)==null||e.dispose(),this.contentChangeDisposable=null,(n=this.mouseDownDisposable)==null||n.dispose(),this.mouseDownDisposable=null,(r=this.datapointProviderDisposable)==null||r.dispose(),this.datapointProviderDisposable=null,t(async()=>{let{clearDatapointCache:e}=await import(`./AiDatapointProvider-DzFpUKkT.js`);return{clearDatapointCache:e}},[],import.meta.url).then(({clearDatapointCache:e})=>e()).catch(()=>{}),(i=this.inlineProviderDisposable)==null||i.dispose(),this.inlineProviderDisposable=null,(a=this.stateHoverDisposable)==null||a.dispose(),this.stateHoverDisposable=null,(o=this.showStateValueDisposable)==null||o.dispose(),this.showStateValueDisposable=null,t(async()=>{let{clearStateHoverCache:e}=await import(`./stateHoverProvider-BkW15VMN.js`);return{clearStateHoverCache:e}},__vite__mapDeps([0]),import.meta.url).then(({clearStateHoverCache:e})=>e()).catch(()=>{}),(s=this.cronHoverDisposable)==null||s.dispose(),this.cronHoverDisposable=null,(c=this.codeLensDisposable)==null||c.dispose(),this.codeLensDisposable=null,(l=this.aiHelpersUnsubscribe)==null||l.call(this),this.aiHelpersUnsubscribe=null,(u=this.inlineChatWidgetInstance)==null||u.dispose(),this.inlineChatWidgetInstance=null,this.hideInlineDiff(),this.editor){var d,f;(d=(f=this.props).onRegisterSelect)==null||d.call(f,null),this.editor.dispose(),this.editor=null}}async doPrettier(){var e;let t=this.props.runningInstances&&Object.keys(this.props.runningInstances).find(e=>{var t;return(t=this.props.runningInstances)==null?void 0:t[e]});if(!t){window.alert(f.t(`No script adapter instance found to format the code`));return}let n=await this.props.socket.sendTo(t.replace(`system.adapter.`,``),`prettier`,{code:(e=this.editor)==null?void 0:e.getValue(),type:this.state.language});if(n.error)this.setState({showError:{title:f.t(`Error formatting code`),message:w(n.error)}});else if(n.code){var r,i,a;(r=this.editor)==null||r.setValue(n.code),(i=(a=this.props).onChange)==null||i.call(a,n.code),this.showDecorators()}}setEditorLanguage(e){if(!this.editor)return;let t=this.editor.getModel();if(t){var n;let i=t.getValue(),a=t.uri.path,o=typeof a==`string`&&a.includes(`.`)?a.substring(0,a.lastIndexOf(`.`)):`index`,s=e===`javascript`?`js`:e===`typescript`?`ts`:e;t.dispose();let c=e===`javascript`||e===`typescript`?`typescript`:e,l=(n=this.monaco)==null?void 0:n.editor.createModel(i,c,this.monaco.Uri.from({scheme:window.location.protocol.replace(`:`,``),path:`${o}${C++}.${s}`}));if(l){var r;this.editor.setModel(l),(r=this.contentChangeDisposable)==null||r.dispose(),this.contentChangeDisposable=this.editor.onDidChangeModelContent(()=>this.onChange())}}}setTypeCheck(e){var t,n;let r={noSemanticValidation:!this.state.alive||!e,noSyntaxValidation:!this.state.alive};(t=this.monacoTS)==null||t.typescriptDefaults.setDiagnosticsOptions(r),(n=this.monacoTS)==null||n.javascriptDefaults.setDiagnosticsOptions({noSemanticValidation:!this.state.alive||!e,noSyntaxValidation:!this.state.alive})}setEditorTypings(e=``){var t,n;let r=S(e),i=`${e}.d.ts`,a=[];for(let e of Object.keys(this.typings))r&&(e===`global.d.ts`||e.startsWith(`script.js.global`)&&e!==i)||a.push({filePath:e,content:this.typings[e]});if((t=this.monacoTS)!=null&&(t=t.typescriptDefaults)!=null&&t.setExtraLibs)this.monacoTS.typescriptDefaults.setExtraLibs(a);else if((n=this.monacoTS)!=null&&(n=n.typescriptDefaults)!=null&&n.addExtraLib){let e=this.monacoTS.typescriptDefaults.getExtraLibs();a.forEach(t=>{!e[t.filePath]&&this.monaco&&this.monacoTS.typescriptDefaults.addExtraLib(t.content,t.filePath)})}}undo(){var e;(e=this.editor)==null||e.trigger(`toolbar`,`undo`,null)}redo(){var e;(e=this.editor)==null||e.trigger(`toolbar`,`redo`,null)}insertTextIntoEditor(e){if(!this.editor||!this.monaco)return;let t=this.editor.getSelection();if(t){let n=new this.monaco.Range(t.startLineNumber,t.startColumn,t.endLineNumber,t.endColumn);this.editor.executeEdits(``,[{range:n,text:e,forceMoveMarkers:!0}])}this.editor.focus()}highlightText(e){var t;if(!this.editor||!this.monaco)return 0;let n=e?(t=this.editor.getModel())==null?void 0:t.findMatches(e,!0,!1,!1,null,!0):void 0;if(n!=null&&n.length)return n.forEach(e=>{var t;return(t=this.editor)==null?void 0:t.setSelection(e.range)}),this.editor.revealLine(n[0].range.startLineNumber),n.length;let r=this.editor.getPosition();if(r){let e=r.lineNumber,t=r.column;this.editor.setSelection(new this.monaco.Range(e,t,e,t))}return 0}showInlineDiff(e){if(!this.editor||!this.monaco)return;let n=this.editor,r=this.monaco;this.hideInlineDiff(),t(async()=>{let{InlineDiffController:e,INLINE_DIFF_CSS:t}=await import(`./inlineDiffController-Qh402KhK.js`);return{InlineDiffController:e,INLINE_DIFF_CSS:t}},__vite__mapDeps([9,10]),import.meta.url).then(({InlineDiffController:t,INLINE_DIFF_CSS:i})=>{if(!this.inlineDiffCssInjected){let e=document.createElement(`style`);e.textContent=i,e.setAttribute(`data-iob-aichat`,`inline-diff`),document.head.appendChild(e),this.inlineDiffCssInjected=!0}let a=new t(n,r,{range:e.range,originalText:e.originalText,modifiedText:e.modifiedText,onAccepted:()=>{var t;this.inlineDiffInstance=null,(t=e.onAccepted)==null||t.call(e)},onRejected:()=>{var t;this.inlineDiffInstance=null,(t=e.onRejected)==null||t.call(e)}});this.inlineDiffInstance=a,a.show()}).catch(()=>{})}hideInlineDiff(){if(this.inlineDiffInstance){try{this.inlineDiffInstance.dispose()}catch{}this.inlineDiffInstance=null}}showInlineChatWidget(){if(!this.editor||!this.monaco||!this.props.onInlineAsk)return;if(this.inlineChatWidgetInstance){this.inlineChatWidgetInstance.show();return}let e=this.editor,n=this.monaco,r=this.props.onInlineAsk,i=this.props.onAiAction;t(async()=>{let{InlineChatWidget:e}=await import(`./inlineChatWidget-NIvdRGmU.js`);return{InlineChatWidget:e}},__vite__mapDeps([11,10]),import.meta.url).then(({InlineChatWidget:t})=>{let a=new t(e,n,{onSubmit:async e=>r({question:e.question,selectedCode:e.selectedCode}),onEscalateToChat:e=>{i&&i({action:`ask`,code:e.selectedCode,question:e.question,rangeLabel:e.range?`lines ${e.range.startLineNumber}-${e.range.endLineNumber}`:`whole file`})}});this.inlineChatWidgetInstance=a,a.show()}).catch(()=>{})}registerAiActions(){if(!this.editor||!this.monaco||!this.props.onAiAction)return;let e=this.monaco,t=(t,n={})=>{if(!this.editor||!this.props.onAiAction)return;let r=this.editor.getModel();if(!r)return;let i=this.editor.getSelection(),a=i&&!i.isEmpty(),o,s,c,l=`selection`;if(a)o=r.getValueInRange(i),s=i.startLineNumber===i.endLineNumber?`line ${i.startLineNumber}`:`lines ${i.startLineNumber}-${i.endLineNumber}`,c={startLine:i.startLineNumber,startColumn:i.startColumn,endLine:i.endLineNumber,endColumn:i.endColumn},l=`selection`;else{let t=this.editor.getPosition(),n=null;if(t)try{n=y(r.getValue(),t.lineNumber)}catch{}if(n){let t=n.startLine,i=n.endLine,a=r.getLineMaxColumn(i),u=new e.Range(t,1,i,a);o=r.getValueInRange(u),s=t===i?`line ${t}`:`lines ${t}-${i}`,c={startLine:t,startColumn:1,endLine:i,endColumn:a},l=`codelens`}else o=r.getValue(),s=`whole file`,l=`none`}this.props.onAiAction({action:t,code:o,rangeLabel:s,range:c,kind:l,...n})},n=[{id:`iobroker.ai.inline`,label:`🤖 ${f.t(`AI: Inline chat…`)}`,keybindings:[e.KeyMod.CtrlCmd|e.KeyMod.Alt|e.KeyCode.KeyI],order:1,run:()=>{if(this.props.onInlineAsk)this.showInlineChatWidget();else{let e=window.prompt(f.t(`Ask the AI about the selected code:`));e&&e.trim()&&t(`ask`,{question:e.trim()})}}},{id:`iobroker.ai.explain`,label:`💡 ${f.t(`AI: Explain`)}`,keybindings:[e.KeyMod.CtrlCmd|e.KeyMod.Alt|e.KeyCode.KeyE],order:2,run:()=>t(`explain`)},{id:`iobroker.ai.refactor`,label:`🔧 ${f.t(`AI: Refactor`)}`,keybindings:[e.KeyMod.CtrlCmd|e.KeyMod.Alt|e.KeyCode.KeyR],order:3,run:()=>t(`refactor`)},{id:`iobroker.ai.comment`,label:`💬 ${f.t(`AI: Add comments`)}`,keybindings:[e.KeyMod.CtrlCmd|e.KeyMod.Alt|e.KeyCode.KeyC],order:4,run:()=>t(`comment`)},{id:`iobroker.ai.fix`,label:`🛠️ ${f.t(`AI: Fix problem`)}`,keybindings:[e.KeyMod.CtrlCmd|e.KeyMod.Alt|e.KeyCode.KeyF],order:5,run:()=>{let n;try{var r,i;let t=(r=this.editor)==null?void 0:r.getModel(),a=(i=this.editor)==null?void 0:i.getPosition();if(t&&a){let r=e.editor.getModelMarkers({resource:t.uri}).find(e=>a.lineNumber>=e.startLineNumber&&a.lineNumber<=e.endLineNumber);r&&(n=r.message)}}catch{}t(`fix`,{diagnostic:n})}},{id:`iobroker.ai.tests`,label:`✅ ${f.t(`AI: Suggest tests`)}`,order:6,run:()=>t(`tests`)}];for(let e of n)try{this.editor.addAction({id:e.id,label:e.label,contextMenuGroupId:`aichat`,contextMenuOrder:e.order,keybindings:e.keybindings,run:()=>e.run()})}catch{}}getEditorSelection(){if(!this.editor)return null;let e=this.editor.getSelection();if(!e||e.isEmpty())return null;let t=this.editor.getModel();return t?{text:t.getValueInRange(e),range:{startLine:e.startLineNumber,startColumn:e.startColumn,endLine:e.endLineNumber,endColumn:e.endColumn}}:null}getEditorContent(){var e;return((e=this.editor)==null||(e=e.getModel())==null?void 0:e.getValue())??``}getCursorPosition(){var e;let t=(e=this.editor)==null?void 0:e.getPosition();return t?{line:t.lineNumber,column:t.column}:null}highlightLineRange(e,t){if(!this.editor||!this.monaco)return!1;let n=this.editor.getModel();if(!n)return!1;let r=n.getLineCount(),i=Math.max(1,Math.min(e,r)),a=Math.max(i,Math.min(t,r)),o=n.getLineMaxColumn(a);return this.editor.setSelection(new this.monaco.Range(i,1,a,o)),this.editor.revealLineInCenter(i),!0}goToLine(e,t=1){if(!this.editor||!this.monaco)return!1;let n=this.editor.getModel();if(!n)return!1;let r=n.getLineCount(),i=Math.max(1,Math.min(e,r));return this.editor.setPosition({lineNumber:i,column:t}),this.editor.revealLineInCenter(i),this.editor.focus(),!0}replaceSelection(e){if(!this.editor||!this.monaco)return!1;let t=this.editor.getSelection();if(!t)return!1;let n=new this.monaco.Range(t.startLineNumber,t.startColumn,t.endLineNumber,t.endColumn);return this.editor.executeEdits(``,[{range:n,text:e,forceMoveMarkers:!0}]),this.editor.focus(),!0}getDiagnostics(){if(!this.editor||!this.monaco)return[];let e=this.editor.getModel();if(!e)return[];let t=this.monaco.editor.getModelMarkers({resource:e.uri}),n={8:`error`,4:`warning`,2:`info`,1:`hint`};return t.map(e=>({line:e.startLineNumber,column:e.startColumn,endLine:e.endLineNumber,endColumn:e.endColumn,severity:n[e.severity]||`info`,message:e.message,...e.source?{source:e.source}:{}}))}async getDocumentSymbols(){if(!this.editor||!this.monaco)return[];let e=this.editor.getModel();if(!e)return[];let t=[];try{var n;let r=this.monaco.languages,i=(n=r.getDocumentSymbolProviders)==null?void 0:n.call(r,e);if(i!=null&&i.length){let n={0:`file`,1:`module`,2:`namespace`,3:`package`,4:`class`,5:`method`,6:`property`,7:`field`,8:`constructor`,9:`enum`,10:`interface`,11:`function`,12:`variable`,13:`constant`,14:`string`,15:`number`,16:`boolean`,17:`array`,18:`object`,19:`key`,20:`null`,21:`enum-member`,22:`struct`,23:`event`,24:`operator`,25:`type-parameter`};for(let r of i){let i=await r.provideDocumentSymbols(e,{isCancellationRequested:!1});if(!i)continue;let a=e=>{for(let i of e){var r;t.push({name:i.name,kind:n[i.kind]||String(i.kind),line:i.range.startLineNumber,endLine:i.range.endLineNumber,...i.detail?{detail:i.detail}:{}}),(r=i.children)!=null&&r.length&&a(i.children)}};if(a(i),t.length)break}}}catch{}if(t.length===0){let n=e.getValue().split(`
|
|
3
3
|
`),r=[{re:/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/,kind:`function`},{re:/^(?:export\s+)?class\s+(\w+)/,kind:`class`},{re:/^(?:export\s+)?(?:const|let|var)\s+(\w+)/,kind:`variable`}];for(let e=0;e<n.length;e++){let i=n[e].trim();for(let{re:n,kind:a}of r){let r=n.exec(i);if(r!=null&&r[1]){t.push({name:r[1],kind:a,line:e+1,endLine:e+1});break}}}}return t}showDecorators(){var e;let t=[];if(this.location&&this.monaco&&(t.push({range:new this.monaco.Range(this.location.lineNumber+1,(this.location.columnNumber||0)+1,this.location.lineNumber+1,1e3),options:{isWholeLine:!1,className:this.props.isDark?`monacoCurrentLineDark`:`monacoCurrentLine`}}),t.push({range:new this.monaco.Range(this.location.lineNumber+1,0,this.location.lineNumber+1,0),options:{isWholeLine:!0,className:this.props.isDark?`monacoCurrentFullLineDark`:`monacoCurrentFullLine`}})),(e=this.breakpoints)==null||e.forEach(e=>{this.monaco&&t.push({range:new this.monaco.Range(e.location.lineNumber+1,0,e.location.lineNumber+1,100),options:{isWholeLine:!0,glyphMarginClassName:this.props.isDark?`monacoBreakPointDark`:`monacoBreakPoint`}})}),this.editor){let e=this.editor.getModel();e&&(this.decorations=e.deltaDecorations(this.decorations,t))}}initNewScript(e,t){var n;this.setState({name:e}),this.originalCode=t||``,(n=this.editor)==null||n.setValue(t||``),this.highlightText(this.lastSearch),this.showDecorators(),this.setEditorTypings(e)}scrollToLineIfNeeded(e){if(this.editor){let t=this.editor.getVisibleRanges();(!t||!t[0]||t[0].startLineNumber>e||e>t[0].endLineNumber)&&this.editor.revealLineInCenter(e)}}UNSAFE_componentWillReceiveProps(e){let n={};this.state.name!==e.name&&this.initNewScript(e.name,e.code),JSON.stringify(e.runningInstances)!==this.runningInstancesStr&&(this.runningInstancesStr=JSON.stringify(e.runningInstances),this.state.typingsLoaded||this.loadTypings(e.runningInstances)),this.editor&&!e.changed&&(e.code!==this.originalCode||e.code!==this.editor.getValue())&&(this.originalCode=e.code||``,this.editor.setValue(this.originalCode),this.showDecorators(),this.location&&this.scrollToLineIfNeeded(this.location.lineNumber+1)),e.searchText!==this.lastSearch&&(this.lastSearch=e.searchText||``,this.highlightText(this.lastSearch)),JSON.stringify(e.location)!==JSON.stringify(this.location)&&JSON.stringify(e.breakpoints)!==JSON.stringify(this.breakpoints)?(this.location=e.location||void 0,this.breakpoints=e.breakpoints,this.showDecorators(),this.editor&&this.location&&this.scrollToLineIfNeeded(this.location.lineNumber+1)):JSON.stringify(e.breakpoints)===JSON.stringify(this.breakpoints)?JSON.stringify(e.location)!==JSON.stringify(this.location)&&(this.location=e.location||void 0,this.showDecorators(),this.editor&&this.location&&this.scrollToLineIfNeeded(this.location.lineNumber+1)):(this.breakpoints=e.breakpoints,this.showDecorators()),this.state.language===(e.language||`javascript`)?this.state.readOnly===(e.readOnly||!1)?this.state.isDark!==(e.isDark||!1)&&(this.setState({isDark:e.isDark||!1}),n.isDark=e.isDark):(this.setState({readOnly:e.readOnly||!1}),n.readOnly=e.readOnly):(this.setState({language:e.language||`javascript`}),n.language=e.language||`javascript`),this.setEditorOptions(n),e.aiCompletionsEnabled!==this.props.aiCompletionsEnabled&&(e.aiCompletionsEnabled&&this.monaco&&b()?this.inlineProviderDisposable||t(async()=>{let{registerAiInlineProvider:e}=await import(`./AiInlineProvider-BxOW88xU.js`);return{registerAiInlineProvider:e}},__vite__mapDeps([2,3]),import.meta.url).then(({registerAiInlineProvider:e})=>{this.monaco&&b()&&!this.inlineProviderDisposable&&(this.inlineProviderDisposable=e(this.monaco,this.props.socket,this.props.runningInstances))}).catch(()=>{}):!e.aiCompletionsEnabled&&this.inlineProviderDisposable&&(this.inlineProviderDisposable.dispose(),this.inlineProviderDisposable=null)),this.insert!==e.insert&&(this.insert=e.insert||``,this.insert&&(console.log(`Insert text: ${this.insert}`),setTimeout(e=>{this.insertTextIntoEditor(e),setTimeout(()=>this.props.onInserted&&this.props.onInserted(),100)},100,this.insert)))}onChange(){if(!this.props.readOnly&&this.editor){var e,t;(e=(t=this.props).onChange)==null||e.call(t,this.editor.getValue())}}renderErrorDialog(){return this.state.showError?this.state.showError.full?n(s,{open:!0,maxWidth:`md`,onClose:()=>this.setState({showError:null}),children:[a(c,{children:this.state.showError.title||f.t(`Error`)}),a(u,{children:a(`pre`,{children:a(`code`,{children:this.state.showError.message})})}),a(m,{children:n(o,{variant:`contained`,startIcon:a(r,{}),onClick:()=>this.setState({showError:null}),children:[f.t(`Close`),` `]})})]}):a(i,{open:!0,autoHideDuration:5e3,onClose:()=>this.setState({showError:null}),message:this.state.showError.title,action:n(d.Fragment,{children:[a(o,{color:`secondary`,size:`small`,onClick:()=>this.setState({showError:{...this.state.showError,full:!0}}),children:f.t(`More`)}),a(l,{size:`small`,"aria-label":`close`,color:`inherit`,onClick:()=>this.setState({showError:null}),children:a(r,{fontSize:`small`})})]})}):null}render(){var e;return!((e=this.monacoTS)!=null&&e.typescriptDefaults)||!this.props.runningInstances?(setTimeout(()=>{this.monaco=window.monaco,this.forceUpdate()},200),null):(this.props.triggerPrettier!==this.triggerPrettier&&(this.triggerPrettier=this.props.triggerPrettier,setTimeout(()=>this.doPrettier().catch(e=>console.error(`Error formatting code:`,e)),50)),n(`div`,{ref:this.monacoDiv,style:{...this.props.style,width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`},children:[this.renderErrorDialog(),!this.state.check&&a(p,{size:`small`,title:f.t(`Check is not active, because javascript adapter is disabled`),style:{bottom:10,right:10,opacity:.5,position:`absolute`,zIndex:1,background:`red`,color:`white`},color:`secondary`,children:a(g,{})})]}))}};export{x as n,T as t};
|