iobroker.smartcontrol 2.2.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -4
- package/admin/custom/assets/Components-CevOCMYi.js +77 -0
- package/admin/custom/assets/Components-DIpDvtxi.js +1 -0
- package/admin/custom/assets/{index-CwC_q7vn.js → index-DKuAVH1b.js} +1 -1
- package/admin/custom/assets/{mf-entry-bootstrap-0-6167c687.js → mf-entry-bootstrap-0-c2b3685a.js} +1 -1
- package/admin/custom/customComponents.js +1 -1
- package/admin/custom/i18n/es.json +59 -0
- package/admin/custom/i18n/fr.json +59 -0
- package/admin/custom/i18n/it.json +59 -0
- package/admin/custom/i18n/nl.json +59 -0
- package/admin/custom/i18n/pl.json +59 -0
- package/admin/custom/i18n/pt.json +59 -0
- package/admin/custom/i18n/ru.json +59 -0
- package/admin/custom/i18n/uk.json +59 -0
- package/admin/custom/i18n/zh-cn.json +59 -0
- package/admin/custom/mf-manifest.json +1 -1
- package/admin/jsonConfig.json5 +48 -3
- package/io-package.json +14 -14
- package/package.json +1 -1
- package/admin/custom/assets/Components-CDPYnOs-.js +0 -77
- package/admin/custom/assets/Components-DpQjIfuo.js +0 -1
- package/lib/tools.js +0 -99
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.smartcontrol",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "Control devices smarter: by grouping, including triggers like motion, opening window, etc. and set target devices accordingly",
|
|
5
5
|
"author": "Mic-M <iob.micm@gmail.com>",
|
|
6
6
|
"contributors": [
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import{En as e,Ft as t,G as n,Hr as r,It as i,Ln as a,Lt as o,Mt as s,Nt as c,Pt as l,Qr as u,Rt as d,Tn as f,Un as p,Ur as m,Vt as h,Xt as g,Yt as _,bn as v,en as y,gn as ee,in as te,jt as b,ln as ne,m as re,nn as x,on as S,si as ie,v as C,xn as ae,yr as w,zt as oe}from"./_virtual_mf___mfe_internal__SmartcontrolSet__mf_owner__108197177487852__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-Ca-6Y14s.js";import{n as T,t as se}from"./_virtual_mf___mfe_internal__SmartcontrolSet__mf_owner__108197177487852__loadShare__shared-4MdeZwge.js";var ce={de:{sc_verify:`Konfiguration prüfen`,sc_verify_ok:`Konfiguration ist gültig.`,sc_verify_fail:`Konfiguration hat Fehler — Speichern bleibt gesperrt, bis die Prüfung grün ist.`,sc_verify_before_save:`Vor dem Speichern die Konfiguration prüfen (Instanz muss laufen).`,sc_verify_need_alive:`Die Adapter-Instanz muss laufen, damit die Prüfung geht.`,sc_add_zone:`Zone hinzufügen`,sc_delete_zone:`Zone löschen`,sc_copy_zone:`Zone kopieren`,sc_zone_up:`Zone nach oben`,sc_zone_down:`Zone nach unten`,sc_zone_drag:`Zone per Ziehen verschieben (Maus). Am Touch-Display die Pfeile nutzen.`,sc_zone:`Zone`,sc_active:`Aktiv`,sc_name:`Name`,sc_triggers:`Auslöser`,sc_targets:`Zielgeräte`,sc_onAfter:`Verzögerung vor AN (s)`,sc_recheck:`Nach Verzögerung erneut prüfen`,sc_offAfter:`AUS nach (s)`,sc_neverOff:`Nie ausschalten wenn…`,sc_allMustMatch:`Alle gewählten müssen zutreffen (UND)`,sc_executeAlways:`Immer ausführen (keine Zeitfenster)`,sc_infoText:`Kommentar`,sc_execution:`Zeitfenster`,sc_add_window:`Zeitfenster hinzufügen`,sc_overwrite:`Pro Zielgerät (optional)`,sc_overwrite_val:`AN-Wert nur dieses Gerät`,sc_overwrite_delay:`extra Verzögerung nur dieses Gerät (s)`,sc_overwrite_hint:`Leer = wie unter 1. Zielgeräte. Gilt nur für dieses Gerät in dieser Zone.`,sc_zone_delays:`Für die ganze Zone`,sc_no_names:`In den anderen Tabs steht noch nichts — zuerst Geräte/Auslöser anlegen.`,sc_exec_hint:`Ohne „Immer ausführen“ braucht die Zone mindestens ein aktives Zeitfenster, sonst läuft sie nie.`,sc_start:`Start`,sc_end:`Ende`,sc_additional_conditions:`Zusätzliche Bedingungen`,sc_never_on:`Nie einschalten wenn…`,sc_day_mon:`Mo`,sc_day_tue:`Di`,sc_day_wed:`Mi`,sc_day_thu:`Do`,sc_day_fri:`Fr`,sc_day_sat:`Sa`,sc_day_sun:`So`,sc_pick_names:`Auswählen…`,sc_enum_fail:`Aufzählungen konnten nicht aus ioBroker geladen werden.`,sc_enum_rooms:`Räume`,sc_enum_function:`Funktion`,sc_tab_changed:`Auf diesem Tab gibt es ungespeicherte Änderungen.`,sc_help:`Hilfe`,sc_help_missing:`Hilfetext konnte nicht geladen werden.`,sc_help_zones:`Hilfe: Zonen`,sc_help_execution:`Hilfe: Zeitfenster`,sc_help_overwrite:`Hilfe: Zielgeräte überschreiben`,sc_userstate_under:`State unter`,sc_userstate_auto:` (wird automatisch angelegt)`,sc_userstate_placeholder:`Kurzname`,sc_userstate_short:`Nur den kurzen Namen, keine Objekt-ID.`},en:{sc_verify:`Check configuration`,sc_verify_ok:`Configuration is valid.`,sc_verify_fail:`Configuration has errors — save stays locked until the check is green.`,sc_verify_before_save:`Check the configuration before saving (instance must be running).`,sc_verify_need_alive:`Adapter instance must be running for the check.`,sc_add_zone:`Add zone`,sc_delete_zone:`Delete zone`,sc_copy_zone:`Copy zone`,sc_zone_up:`Move zone up`,sc_zone_down:`Move zone down`,sc_zone_drag:`Drag to reorder (mouse). On touch use the arrows.`,sc_zone:`Zone`,sc_active:`Active`,sc_name:`Name`,sc_triggers:`Triggers`,sc_targets:`Target devices`,sc_onAfter:`Delay before ON (s)`,sc_recheck:`Recheck after delay`,sc_offAfter:`OFF after (s)`,sc_neverOff:`Never switch off if…`,sc_allMustMatch:`All selected must match (AND)`,sc_executeAlways:`Always execute (ignore time windows)`,sc_infoText:`Comment`,sc_execution:`Time windows`,sc_add_window:`Add time window`,sc_overwrite:`Per target (optional)`,sc_overwrite_val:`ON value for this device only`,sc_overwrite_delay:`extra delay for this device only (s)`,sc_overwrite_hint:`Empty = same as in 1. Target devices. Applies only to this device in this zone.`,sc_zone_delays:`For the whole zone`,sc_no_names:`Nothing in the other tabs yet — add devices/triggers first.`,sc_exec_hint:`Without “Always execute” at least one active time window is required, otherwise the zone never runs.`,sc_start:`Start`,sc_end:`End`,sc_additional_conditions:`Additional conditions`,sc_never_on:`Never switch on if…`,sc_day_mon:`Mo`,sc_day_tue:`Tue`,sc_day_wed:`Wed`,sc_day_thu:`Thu`,sc_day_fri:`Fri`,sc_day_sat:`Sat`,sc_day_sun:`Sun`,sc_pick_names:`Select…`,sc_enum_fail:`Could not load enums from ioBroker.`,sc_enum_rooms:`Rooms`,sc_enum_function:`Function`,sc_tab_changed:`This tab has unsaved changes.`,sc_help:`Help`,sc_help_missing:`Help text could not be loaded.`,sc_help_zones:`Help: Zones`,sc_help_execution:`Help: Time windows`,sc_help_overwrite:`Help: Overwrite targets`,sc_userstate_under:`State under`,sc_userstate_auto:` (created automatically)`,sc_userstate_placeholder:`short name`,sc_userstate_short:`Short name only, not an object ID.`}};function E(e,t){let n=typeof C.getLanguage==`function`?C.getLanguage():``;return(ce[(t||n||`en`).substring(0,2).toLowerCase()]||ce.en)[e]||ce.en[e]||e}function le(e,t){if(t.has(e))throw TypeError(`Cannot initialize the same private elements twice on an object`)}function ue(e,t){le(e,t),t.add(e)}function D(e,t,n){if(typeof e==`function`?e===t:e.has(t))return arguments.length<3?t:n;throw TypeError(`Private element is not present on this object`)}var O,de;function fe(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var k=fe();function pe(e){k=e}var A={exec:()=>null};function j(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function M(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(N.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var me=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),he=`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)`,N={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,listInterruptsParagraph:/^ {0,3}(?:[*+-]|0{0,8}1[.)])[ \t]+[^ \t\n]/,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^( {1,3})(?:`{3}|~{3})/,beginningSpace:/^[ \t]{1,3}/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,multipleSpaceTabGlobal:/[ \t\r\n]+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,textIndentedContinuation:/^(?:\n(?: {4}| {0,3}\t)[ \t]*[^ \t\n][^\n]*)+/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+)[ \t]*)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,blockquoteMarkerWhitespace:/^( {0,3}>)(\t[ \t]*)/gm,blockquoteFenceOpen:/^ {0,3}(`{3,}(?=[^`]*$)|~{3,})/,blockquoteFenceClose:/^ {0,3}(`{3,}|~{3,})[ \t]*$/,blockquoteListItemStart:/^ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|$)/,nestedBlockMarker:/^ {0,3}(?:(?:[*+-]|\d{1,9}[.)])(?: |$)|> ?)/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\][ \t]+\S/,listReplaceTask:/^\[[ xX]\][ \t]+/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableHeader:RegExp(he+`(?:\\n|$)`),tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:j(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:j(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:j(e=>RegExp(`^ {0,${e}}(?:\`{3,}(?=[^\`\\n]*(?:\\n|$))|~~~)`)),headingBeginRegex:j(e=>RegExp(`^ {0,${e}}#{1,6}(?:\\s|$)`)),pedanticHeadingBeginRegex:j(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:j(e=>RegExp(`^ {0,${e}}(?:</?(?:${xe})(?:[ \\t]+|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`,`i`)),blockquoteBeginRegex:j(e=>RegExp(`^ {0,${e}}>`)),nestedContainerMarkers:/^(?: {0,3}(?:(?:[*+-]|\d{1,9}[.)])[ \t]+|>[ \t]?))+/},ge=/^(?:[ \t]*(?:\n|$))+/,_e=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,ve=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}(?:(?=`)\1`*|(?=~)\1~*)[ \t]*(?=\n|$)|$)/,P=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ye=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,be=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,xe=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,F=M(` {0,3}(?:</?(?:tag)(?:[ \\t]+|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,xe).getRegex(),Se=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?![ \t]*\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+)[ \t]*(?:\n+|$)/,Ce=M(Se).replace(/bull/g,be).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}(?=[^`\n]*(?:\n|$))|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/\|table/g,``).replace(/html/g,F).getRegex(),we=M(Se).replace(/bull/g,be).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}(?=[^`\n]*(?:\n|$))|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).replace(/html/g,F).getRegex(),Te=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Ee=/^[^\n]+/,De=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\\n]|\n(?![ \t]*\n))+/,Oe=M(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<(?:\\.|[^\n<>\\])*>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,De).replace(`title`,/(?:"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\\n]|\n(?!\n))*'|\((?:\\[\s\S]|[^()\\])*\))/).getRegex(),ke=M(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,be).getRegex(),Ae=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,je=M(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?:[ \\t]+|\\n|/?>|$)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*?[ \\t]*/?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,Ae).replace(`tag`,xe).replace(`attribute`,/[ \t]+[a-zA-Z:_][\w.:-]*(?:[ \t]*=[ \t]*"[^"\n]*"|[ \t]*=[ \t]*'[^'\n]*'|[ \t]*=[ \t]*[^\s"'=<>`]+)?/).getRegex(),Me=e=>M(Te).replace(`hr`,P).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,F).getRegex(),Ne=Me(N.listInterruptsParagraph),Pe=Me(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Fe=/ {0,3}> ?(?:(?!blank)(paragraph)|[^\n]*)(?:\n|$)/,Ie={blockquote:M(/^(first)(?:next)*/).replace(`first`,M(Fe).replace(`blank`,/[ \t]*(?:\n|$)| {4}/).getRegex()).replace(`next`,M(Fe).replace(`blank`,/[ \t]*(?:\n|$)/).getRegex()).replace(/paragraph/g,Pe).getRegex(),code:_e,def:Oe,fences:ve,heading:ye,hr:P,html:je,lheading:Ce,list:ke,newline:ge,paragraph:Ne,table:A,text:Ee},Le=M(he+`(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,P).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|0{0,8}1[.)])[ \\t]`).replace(`html`,F).getRegex(),Re={...Ie,lheading:we,table:Le,paragraph:M(Te).replace(`hr`,P).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,N.tableHeader).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,N.listInterruptsParagraph).replace(`html`,F).getRegex()},ze={...Ie,html:M(`^ *(?:comment(?: *\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1>(?: *\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?>(?: *\\n{2,}|\\s*$))`).replace(`comment`,Ae).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:A,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:M(Te).replace(`hr`,P).replace(`heading`,` *#{1,6} *[^
|
|
2
|
-
]`).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).replace(`lheading`,Ce).getRegex()},Be=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ve=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,He=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,Ue=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,I=/[\p{P}\p{S}]/u,L=/[\s\p{P}\p{S}]/u,R=/[^\s\p{P}\p{S}]/u,We=M(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,L).getRegex(),Ge=/[\p{Pi}\p{Ps}"']/u,Ke=/(?!~)[\p{P}\p{S}]/u,qe=/(?!~)[\s\p{P}\p{S}]/u,Je=/(?:[^\s\p{P}\p{S}]|~)/u,Ye=M(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,me?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),Xe=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Ze=M(Xe,`u`).replace(/punct/g,I).getRegex(),Qe=M(Xe,`u`).replace(/punct/g,Ke).getRegex(),$e=M(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,Ge).replace(/punct/g,I).getRegex(),et=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,tt=M(et,`gu`).replace(/notPunctSpace/g,R).replace(/punctSpace/g,L).replace(/punct/g,I).getRegex(),nt=M(et,`gu`).replace(/notPunctSpace/g,Je).replace(/punctSpace/g,qe).replace(/punct/g,Ke).getRegex(),rt=M(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,R).replace(/punctSpace/g,L).replace(/punct/g,I).getRegex(),it=M(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,R).replace(/punctSpace/g,L).replace(/punct/g,I).getRegex(),at=M(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,R).replace(/punctSpace/g,L).replace(/punct/g,I).getRegex(),ot=M(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,I).getRegex(),st=M(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,R).replace(/punctSpace/g,L).replace(/punct/g,I).getRegex(),ct=M(/\\(punct)/,`gu`).replace(/punct/g,I).getRegex(),lt=M(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,`gu`).replace(/punct/g,I).getRegex(),ut=M(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),dt=M(Ae).replace(`(?:-->|$)`,`-->`).getRegex(),ft=M(`^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,dt).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),pt=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,mt=M(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,pt).getRegex(),ht=/\\[^ \t\n\x00-\x1f]|\\(?=[ \t\n])|[^ \t\n\x00-\x1f\\()]/,gt=M(/\((?:char)*\)/).replace(`char`,ht).getRegex(),_t=M(/\((?:char|p1)*\)/).replace(`char`,ht).replace(`p1`,gt).getRegex(),vt=M(/\((?:char|p2)*\)/).replace(`char`,ht).replace(`p2`,_t).getRegex(),yt=M(/(?!<)(?:char|p3)+/).replace(`char`,ht).replace(`p3`,vt).getRegex(),bt=M(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace(`label`,mt).replace(`href`,M(/<(?:\\.|[^\n<>\\])*>|bareHref|(?=\))/).replace(`bareHref`,yt).getRegex()).replace(`title`,/"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|\((?:\\[\s\S]|[^)\\])*\)/).getRegex(),xt=M(/^!?\[(label)\]\[(ref)\]/).replace(`label`,mt).replace(`ref`,De).getRegex(),St=M(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,De).getRegex(),Ct=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,wt=M(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,pt).getRegex(),Tt=M(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,M(/^!?\[(label)\]\[(ref)\]/).replace(`label`,wt).replace(`ref`,Ct).getRegex()).replace(`nolink`,M(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Ct).getRegex()).getRegex(),Et=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Dt=M(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),Ot={_backpedal:A,anyPunctuation:ct,anyPunctuationOutsideCode:lt,autolink:ut,blockSkip:Ye,br:He,code:Ve,del:A,delLDelim:A,delRDelim:A,emStrongLDelim:Ze,emStrongRDelimAst:tt,emStrongRDelimUnd:it,escape:Be,link:bt,nolink:St,punctuation:We,reflink:xt,reflinkSearch:Tt,tag:ft,text:Ue,url:A},kt={...Ot,emStrongLDelim:$e,emStrongRDelimAst:rt,emStrongRDelimUnd:at,link:M(/^!?\[(label)\]\((.*?)\)/).replace(`label`,mt).getRegex(),reflink:M(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,mt).getRegex()},At={...Ot,emStrongRDelimAst:nt,emStrongLDelim:Qe,delLDelim:ot,delRDelim:st,url:M(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`emailProtocol`,Dt).replace(`protocol`,Et).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:M(/^(?:[A-Za-z0-9.+-]+(?=@)|[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|wwwStart|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace(`protocol`,Et).replace(/emailProtocol/g,/(?:mailto|xmpp):/).replace(`wwwStart`,me?`(?<![^\\s*_~(])www\\.`:`www\\.`).getRegex()},jt={...At,br:M(He).replace(`{2,}`,`*`).getRegex(),text:M(At.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Mt={normal:Ie,gfm:Re,pedantic:ze},z={normal:Ot,gfm:At,breaks:jt,pedantic:kt},Nt={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},Pt=e=>Nt[e];function B(e,t){if(t){if(N.escapeTest.test(e))return e.replace(N.escapeReplace,Pt)}else if(N.escapeTestNoEncode.test(e))return e.replace(N.escapeReplaceNoEncode,Pt);return e}function Ft(e){return N.numericCharacterReference.test(e)?e.replace(N.numericCharacterReferenceOrAmpersand,(e,t,n)=>{if(t===void 0&&n===void 0)return`&`;let r=t===void 0?Number.parseInt(n,16):Number.parseInt(t,10);return r===0||r>1114111||r>=55296&&r<=57343?`�`:r===38?`&`:String.fromCodePoint(r)}):e}function It(e){try{e=encodeURI(e).replace(N.percentDecode,`%`)}catch{return null}return e}function Lt(e,t){var n;let r=e.replace(N.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(N.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!((n=r.at(-1))!=null&&n.trim())&&r.pop(),t){if(r.length>t)r.splice(t);else for(;r.length<t;)r.push(``)}for(;i<r.length;i++)r[i]=r[i].trim().replace(N.slashPipe,`|`);return r}function V(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function Rt(e){let t=e.split(`
|
|
3
|
-
`),n=t.length-1;for(;n>=0&&N.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
|
|
4
|
-
`)}function zt(e,t=!1){let n=t?N.multipleSpaceGlobal:N.multipleSpaceTabGlobal;return e.trim().replace(n,` `).toLowerCase().toUpperCase().toLowerCase()}function Bt(e,t){if(e.indexOf(t[0])===-1&&e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}var H=new WeakMap;function Vt(e){let t={"*":-1,_:-1},n=-1,r=e.length;for(let i=0;i<r;i++){let a=e[i];if(a!==`*`&&a!==`_`&&a!==`~`)continue;let o=i===0?`
|
|
5
|
-
`:e[i-1],s=i+1;for(;s<r&&e[s]===a;)s++;o!==` `&&o!==` `&&o!==`
|
|
6
|
-
`&&o!==`\r`&&o!==`\f`&&(a===`~`?n=i:t[a]=i),i=s-1}return{maskedSrc:e,lastPossibleEmStrongCloserIndex:t,lastPossibleDelCloserIndex:n}}function Ht(e,t){let n=Vt(t),r=H.get(e);r?r.push(n):H.set(e,[n])}function Ut(e){let t=H.get(e);t&&(t.pop(),t.length===0&&H.delete(e))}function Wt(e,t,n){var r;let i=(r=H.get(e))==null?void 0:r.at(-1);return i&&i.maskedSrc===t?i.lastPossibleEmStrongCloserIndex[n]:Vt(t).lastPossibleEmStrongCloserIndex[n]}function Gt(e,t){var n;let r=(n=H.get(e))==null?void 0:n.at(-1);return r&&r.maskedSrc===t?r.lastPossibleDelCloserIndex:Vt(t).lastPossibleDelCloserIndex}function U(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function Kt(e){let t,n=!1;return e.map(e=>{var r;if(n)return e;let{depth:i,expanded:a,keptIndent:o,content:s}=qt(e,(t==null?void 0:t.depth)??1/0);if((t==null?void 0:t.depth)!==i&&(t=void 0),t){var c;let e=(c=N.blockquoteFenceClose.exec(s))==null?void 0:c[1];return!e||e[0]!==t.marker[0]||e.length<t.marker.length?o:(t=void 0,a)}if(n=N.blockquoteListItemStart.test(s),n)return e;let l=(r=N.blockquoteFenceOpen.exec(s))==null?void 0:r[1];return l&&(t={marker:l,depth:i}),a}).join(`
|
|
7
|
-
`)}function qt(e,t){let n=0,r=0,i=0,a=0,o=``;for(;i<t;){let t=n,s=r;for(;e[t]===` `||e[t]===` `;)s+=Jt(e[t],s),t++;if(e[t]!==`>`||s-a>3)break;o+=` `.repeat(s-r)+`>`,i++,n=t+1,r=s+1,a=e[n]===` `||e[n]===` `?r+1:r}if(i===0)return{depth:i,expanded:e,keptIndent:e,content:e};let s=``,c=``;for(;(e[n]===` `||e[n]===` `)&&r<a+4;){let t=Jt(e[n],r);s+=` `.repeat(t),c+=r<a&&t>1?` `.repeat(t):e[n],r+=t,n++}let l=e.slice(n);return{depth:i,expanded:o+s+l,keptIndent:o+c+l,content:` `.repeat(Math.max(0,r-a))+l}}function Jt(e,t){return e===` `?4-t%4:1}function Yt(e,t){let n=``;for(let r=0;r<e.length;r++){if(e[r]==="`"){let i=t.inline.code.exec(e.slice(r));if(i){n+=i[0],r+=i[0].length-1;continue}}e[r]===`\\`&&(e[r+1]===`[`||e[r+1]===`]`)?(n+=e[r+1],r++):n+=e[r]}return n}function Xt(e,t,n,r,i){let a=t.href,o=t.title||null,s=Yt(e[1],i),c=e[0].charAt(0)===`!`,l=r.state.inLink,u=r.state.linkEmitted,d=r.state.inRawBlock;r.state.inLink=!0,r.state.linkEmitted=!1;let f=r.inlineTokens(s),p=r.state.linkEmitted;if(r.state.linkEmitted=u,r.state.inLink=l,!c){if(p){r.state.inRawBlock=d;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:f}}function Zt(e,t,n,r){let i=e.match(n.other.indentCodeCompensation);if(i===null)return t;let a=i[1].length;return t.split(`
|
|
8
|
-
`).map(t=>{let i=t.match(n.other.beginningSpace);if(i===null)return t;let[o]=i,s=o.indexOf(` `);if(s!==-1&&s<a){if(r)return` `.repeat(4-a)+t.slice(s+1);if(e[a]===`~`)return t}return t.slice(Math.min(o.length,a))}).join(`
|
|
9
|
-
`)}function Qt(e,t,n,r){if(!t.includes(`<`))return!1;for(let i=0;i<t.length;i++){if(t[i]===`\\`){i++;continue}if(t[i]==="`"){let e=r.inline.code.exec(t.slice(i));if(e){i+=e[0].length-1;continue}}if(t[i]!==`<`)continue;let a=e.slice(n+i),o=r.inline.tag.exec(a)||r.inline.autolink.exec(a);if(o){if(o[0].length>t.length-i)return!0;i+=o[0].length-1}}return!1}var W=class{constructor(e){w(this,`options`,void 0),w(this,`rules`,void 0),w(this,`lexer`,void 0),this.options=e||k}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:Rt(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=Zt(e,t[3]||``,this.rules,this.lexer.state.top&&!this.lexer.state.inBlockquote);t[3]!==void 0&&(n===``||n.endsWith(`
|
|
10
|
-
`))&&(n+=`
|
|
11
|
-
`);let r=t[2];if(r){let e=0,t=r.length;for(;e<t&&(r[e]===` `||r[e]===` `);)e++;for(;t>e&&(r[t-1]===` `||r[t-1]===` `);)t--;r=r.slice(e,t).replace(this.rules.inline.anyPunctuation,`$1`)}return{type:`code`,raw:e,lang:r,text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=V(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceTabChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:V(t[0],`
|
|
12
|
-
`),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:V(t[0],`
|
|
13
|
-
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=V(t[0],`
|
|
14
|
-
`).split(`
|
|
15
|
-
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o=0;for(;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
|
|
16
|
-
`),c=(this.lexer.state.top&&!this.lexer.state.inBlockquote&&s.includes(` `)?Kt(a):s).replace(this.rules.other.blockquoteMarkerWhitespace,(e,t,n)=>n.startsWith(` `)?t+` `+n.slice(1):t+U(n,t.length)).replace(this.rules.other.blockquoteSetextReplace,`
|
|
17
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
18
|
-
${s}`:s,r=r?`${r}
|
|
19
|
-
${c}`:c;let l=this.lexer.state.top,u=this.lexer.state.inBlockquote,d=this.lexer.state.lastToken;if(this.lexer.state.top=!0,this.lexer.state.inBlockquote=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,this.lexer.state.inBlockquote=u,e.length===0)break;let f=i.at(-1);if((f==null?void 0:f.type)===`code`||(f==null?void 0:f.type)===`heading`||(f==null?void 0:f.type)===`hr`||(f==null?void 0:f.type)===`html`||(f==null?void 0:f.type)===`table`)break;if((f==null?void 0:f.type)===`blockquote`){let t=f,a=e.join(`
|
|
20
|
-
`),o=t.raw+`
|
|
21
|
-
`+a.replace(this.rules.other.blockquoteSetextReplace2,``);this.lexer.state.inBlockquote=!0,this.lexer.state.lastToken=i.at(-2);let s=this.blockquote(o);this.lexer.state.inBlockquote=u,this.lexer.state.lastToken=d,i[i.length-1]=s;let c=o.substring(s.raw.length).replace(/^\n/,``),l=c?c.split(`
|
|
22
|
-
`).length:0,p=l?e.slice(0,-l):e;if(p.length>0&&(n=`${n}
|
|
23
|
-
${p.join(`
|
|
24
|
-
`)}`),r=r.substring(0,r.length-t.text.length)+s.text,e=e.slice(p.length),e.length>0&&this.rules.other.blockquoteStart.test(e[0]))continue;break}if((f==null?void 0:f.type)===`list`){let t=f,a=t.raw+`
|
|
25
|
-
`+e.join(`
|
|
26
|
-
`);this.lexer.state.inBlockquote=!0,this.lexer.state.lastToken=i.at(-2);let o=this.list(a);this.lexer.state.top=l,this.lexer.state.inBlockquote=u,this.lexer.state.lastToken=d,i[i.length-1]=o;let s=o.raw.length>t.raw.length?a.slice(t.raw.length+1,o.raw.length).split(`
|
|
27
|
-
`).length:0;if(s>0){let t=e.slice(0,s).join(`
|
|
28
|
-
`);n=`${n}
|
|
29
|
-
${t}`,r=`${r}
|
|
30
|
-
${t}`}if(e=e.slice(s),e.length>0&&!this.rules.other.blockquoteStart.test(e[0]))break}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){var n;if(!this.options.pedantic&&((n=this.lexer.state.lastToken)==null?void 0:n.type)===`text`&&!this.rules.other.listInterruptsParagraph.test(e))return;let r=e,i=()=>r.length-e.length,a=t[1].trim(),o=a.length>1,s={type:`list`,raw:``,ordered:o,start:o?+a.slice(0,-1):``,loose:!1,items:[]};a=o?`\\d{1,9}\\${a.slice(-1)}`:`\\${a}`,this.options.pedantic&&(a=o?a:`[*+-]`);let c=this.rules.other.listItemRegex(a),l=!1;for(;e;){let n=!1,a=``;if(!(t=c.exec(e))||this.rules.block.hr.test(e))break;let o=i();e=e.substring(t[0].length);let u=t[2].split(`
|
|
31
|
-
`,1)[0],d=t[1].length,f=this.options.pedantic?U(u,d):u.replace(this.rules.other.leadingSpaceTab,e=>U(e,d)),p=e.split(`
|
|
32
|
-
`,1)[0],m=!f.trim(),h=0;if(this.options.pedantic?(h=2,a=f.trimStart()):m?h=d+1:(h=f.search(this.rules.other.nonSpaceChar),h=h>4?1:h,a=f.slice(h),f=a,h+=d),m&&this.rules.other.blankLine.test(p)&&(e=e.substring(p.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(h),n=this.rules.other.hrRegex(h),r=this.rules.other.fencesBeginRegex(h),i=this.options.pedantic?this.rules.other.pedanticHeadingBeginRegex(h):this.rules.other.headingBeginRegex(h),o=this.rules.other.htmlBeginRegex(h),s=this.rules.other.blockquoteBeginRegex(h),c=!1;for(;e;){let l=e.split(`
|
|
33
|
-
`,1)[0],u;if(p=l,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting,` `),u=p):u=p.replace(this.rules.other.leadingSpaceTab,e=>U(e)),r.test(p)||i.test(p)||o.test(p)||s.test(p)||t.test(p)||n.test(p))break;if(u.search(this.rules.other.nonSpaceChar)>=h||!p.trim())a+=`
|
|
34
|
-
`+u.slice(h),c=!1;else{if(m)break;let e=f;if(!this.options.pedantic&&!a.includes(`
|
|
35
|
-
`)&&!f.includes(` `)){let t;for(;!n.test(e)&&(t=this.rules.other.nestedBlockMarker.exec(e));)e=e.slice(t[0].length);if(!e.trim())break}if(e.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||r.test(e)||i.test(e)||o.test(e)||n.test(e))break;if(!this.options.pedantic&&!c){let e=f.replace(this.rules.other.nestedContainerMarkers,``);if(this.rules.block.fences.test(e)||this.rules.block.heading.test(e)||this.rules.block.hr.test(e))break}let t=!this.options.pedantic&&/^ {0,3}(?:=+|-+) *$/.test(p)&&this.rules.block.lheading.test(`${f}
|
|
36
|
-
${p}`)?` ${u.replace(/^ {0,3}/,``)}`:p,s=!this.options.pedantic&&!c&&u.startsWith(` `)?this.rules.block.list.exec(f):null;if(s!=null&&s[2]){let e=s[1].length,n=s[2].replace(this.rules.other.leadingSpaceTab,t=>U(t,e)),r=n.search(this.rules.other.nonSpaceChar);r>0&&r<=4&&!this.rules.other.nestedBlockMarker.test(n.slice(r))&&u.search(this.rules.other.nonSpaceChar)>=e+r&&this.rules.other.listInterruptsParagraph.test(u.slice(e+r))&&(t=` ${u}`)}a+=`
|
|
37
|
-
`+t,c=!0}m=!p.trim(),e=e.substring(l.length+1),f=u.slice(h)}}let g=r.slice(o,i());s.loose||(l?s.loose=!0:this.rules.other.doubleBlankLine.test(g)&&(l=!0)),s.items.push({type:`list_item`,raw:g,task:!!this.options.gfm&&this.rules.other.listIsTask.test(a),loose:!1,text:a,tokens:[]})}let u=s.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;s.raw=r.slice(0,i()).trimEnd();let d=[],f=this.lexer.state.top;for(let e of s.items)if(this.lexer.state.top=!1,d.push(this.lexer.inlineQueue.length),e.tokens=this.lexer.blockTokens(e.text,[]),!s.loose){let t=e.tokens.filter(e=>e.type===`space`);s.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}this.lexer.state.top=f;for(let e=0;e<s.items.length;e++){let t=s.items[e],n=t.tokens[0];if(t.task&&((n==null?void 0:n.type)===`text`||(n==null?void 0:n.type)===`paragraph`)){t.text=t.text.replace(this.rules.other.listReplaceTask,``),n.raw=n.raw.replace(this.rules.other.listReplaceTask,``),n.text=n.text.replace(this.rules.other.listReplaceTask,``);let r=this.lexer.inlineQueue;for(let t=d[e];t<r.length;t++)if(r[t].tokens===n.tokens){r[t].src=r[t].src.replace(this.rules.other.listReplaceTask,``);break}let i=this.rules.other.listTaskCheckbox.exec(t.raw);if(i){let e={type:`checkbox`,raw:i[0]+` `,checked:i[0]!==`[ ]`};t.checked=e.checked,s.loose?t.tokens[0]&&[`paragraph`,`text`].includes(t.tokens[0].type)&&`tokens`in t.tokens[0]&&t.tokens[0].tokens?(t.tokens[0].raw=e.raw+t.tokens[0].raw,t.tokens[0].text=e.raw+t.tokens[0].text,t.tokens[0].tokens.unshift(e)):t.tokens.unshift({type:`paragraph`,raw:e.raw,text:e.raw,tokens:[e]}):t.tokens.unshift(e)}}else t.task&&=!1}if(s.loose)for(let e of s.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return s}}html(e){let t=this.rules.block.html.exec(e);if(t){var n;if(((n=this.lexer.state.lastToken)==null?void 0:n.type)===`paragraph`&&!this.rules.other.htmlBeginRegex(4).test(e))return;let r=Rt(t[0]);return{type:`html`,block:!0,raw:r,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:r}}}def(e){let t=this.rules.block.def.exec(e);if(t){if(!this.rules.other.startAngleBracket.test(t[2])&&Bt(t[2],`()`)!==-1)return;let e=zt(t[1],this.options.pedantic),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:V(t[0],`
|
|
38
|
-
`),href:n,title:r}}}table(e){var t;let n,r;if(this.options.gfm&&!this.options.pedantic){let t=this.rules.other.tableHeader.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2])||(n=Lt(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),n.length!==r.length))return}let i=this.rules.block.table.exec(e);if(!i||!this.rules.other.tableDelimiter.test(i[2]))return;n??=Lt(i[1]),r??=i[2].replace(this.rules.other.tableAlignChars,``).split(`|`);let a=(t=i[3])!=null&&t.trim()?i[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
39
|
-
`):[],o={type:`table`,raw:V(i[0],`
|
|
40
|
-
`),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?o.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?o.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?o.align.push(`left`):o.align.push(null);for(let e=0;e<n.length;e++)o.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:o.align[e]});for(let e of a)o.rows.push(Lt(e,o.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:o.align[t]})));return o}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:V(t[0],`
|
|
41
|
-
`),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
42
|
-
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t){let n=t[0],r=t[0],i=this.rules.other.textIndentedContinuation.exec(e.slice(n.length));return i&&(n+=i[0],r+=i[0].replace(this.rules.other.codeRemoveIndent,``)),{type:`text`,raw:n,text:r,tokens:this.lexer.inline(r)}}}escape(e){if(e.charCodeAt(0)!==92)return;let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){if(e.charCodeAt(0)!==60)return;let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){if(this.lexer.state.linkParenPossible===!1)return;let t=e.charCodeAt(0);if(t!==91&&t!==33)return;let n=this.rules.inline.link.exec(e);if(n){let t=n[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&Qt(e,n[1],t,this.rules))return;let r=n[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let e=V(r.slice(0,-1),`\\`);if((r.length-e.length)%2==0)return}else{let e=Bt(n[2],`()`);if(e===-2)return;if(e>-1){let t=(n[0].indexOf(`!`)===0?5:4)+n[1].length+e;n[2]=n[2].substring(0,e),n[0]=n[0].substring(0,t).trim(),n[3]=``}}let i=V(n[0].slice(0,-1),`\\`);if((n[0].length-i.length)%2==0)return;let a=n[2],o=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(a);e&&(a=e[1],o=e[3])}else o=n[3]?n[3].slice(1,-1):``;return this.options.pedantic&&(a=a.trim()),this.rules.other.startAngleBracket.test(a)&&(a=this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?a.slice(1):a.slice(1,-1)),Xt(n,{href:a&&a.replace(this.rules.inline.anyPunctuation,`$1`),title:o&&o.replace(this.rules.inline.anyPunctuation,`$1`)},n[0],this.lexer,this.rules)}}reflink(e,t){let n=e.charCodeAt(0);if(n!==91&&n!==33)return;let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){let n=r[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&Qt(e,r[1],n,this.rules))return;let i=t[zt(r[2]||r[1],this.options.pedantic)];if(!i){let e=r[0].charAt(0);return{type:`text`,raw:e,text:e}}return Xt(r,i,r[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!r||!r[1]&&!r[2]&&!r[3]&&!r[4])return;let i=r[0][0],a=n===i,o=t.length-e.length,s=o;for(;!this.options.pedantic&&s>0&&t[s-1]===i;)s--;let c=[...t.slice(Math.max(0,s-2),s)].at(-1)??``,l=c===`*`||c===`_`||!!this.rules.inline.punctuation.exec(c);s<o&&(n=c);let u=s<o?l:n===`*`||n===`_`||!!this.rules.inline.punctuation.exec(n);if(r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))return;let d=r[1]||r[3]||``;if(!d||!n||u){let n=[...r[0]].length-1,u,f,p=n,m=0,h=o-s+n,g=!this.options.pedantic&&!!c.trim()&&(!!d||i===`*`&&!l);if(i!==`*`&&i!==`_`)return;let _=i===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd,v=Wt(this,t,i),y=t.length-e.length+n;if(v<y)return;t=t.slice(-1*e.length+n);let ee=v-y;for(_.lastIndex=0;(r=_.exec(t))!==null&&!(r.index>ee);){if(u=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!u)continue;f=[...u].length;let t=f>p-n;if(r[3]||r[4]){p+=f;continue}if((r[5]||r[6]||g&&t)&&h%3&&!((h+f)%3)){if(a&&(r[5]||r[6]))break;m+=f;continue}if(p-=f,p>0)continue;f=Math.min(f,f+p+m);let i=[...r[0]][0].length,o=e.slice(0,n+r.index+i+f);if(Math.min(n,f)%2){let e=o.slice(1,-1);return{type:`em`,raw:o,text:e,tokens:this.lexer.inlineTokens(e)}}let s=o.slice(2,-2);return{type:`strong`,raw:o,text:s,tokens:this.lexer.inlineTokens(s)}}}}codespan(e){if(e.charCodeAt(0)!==96)return;let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=e.charCodeAt(0);if(t!==32&&t!==92&&t!==10)return;let n=this.rules.inline.br.exec(e);if(n)return{type:`br`,raw:n[0]}}del(e,t,n=``){if(e.charCodeAt(0)!==126)return;let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim,c=Gt(this,t),l=t.length-e.length+n;if(c<l)return;t=t.slice(-1*e.length+n);let u=c-l;for(s.lastIndex=0;(r=s.exec(t))!==null&&!(r.index>u);){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){if(e.charCodeAt(0)!==60)return;let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,r;if(t[2]===`@`)e=t[0],r=`mailto:`+e;else{var n;let i;do i=t[0],t[0]=((n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])??``;while(i!==t[0]);e=t[0],r=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:r,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:e?t[0]:Ft(t[0]),escaped:e}}}},G=(O=new WeakSet,class e{constructor(e){ue(this,O),w(this,`tokens`,void 0),w(this,`options`,void 0),w(this,`state`,void 0),w(this,`inlineQueue`,void 0),w(this,`tokenizer`,void 0),this.tokens=[],this.tokens.links=Object.create(null),this.options=e||k,this.options.tokenizer=this.options.tokenizer||new W,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0,inBlockquote:!1};let t={other:N,block:Mt.normal,inline:z.normal};this.options.pedantic?(t.block=Mt.pedantic,t.inline=z.pedantic):this.options.gfm&&(t.block=Mt.gfm,t.inline=this.options.breaks?z.breaks:z.gfm),this.tokenizer.rules=t}static get rules(){return{block:Mt,inline:z}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){let r=new e(n);return t.includes(`\r`)&&(t=t.replace(N.carriageReturn,`
|
|
43
|
-
`)),r.inlineTokens(t)}lex(e){e=e.replace(N.carriageReturn,`
|
|
44
|
-
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.state.inRawBlock=!1,this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this;let r=this.state.lastToken;this.options.pedantic&&(e=e.replace(N.tabCharGlobal,` `).replace(N.spaceLine,``));let i=1/0,a,o=this.options.gfm&&!this.options.pedantic&&this.tokenizer.paragraph===W.prototype.paragraph;for(;e;){var s,c;if(e.length<i)i=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}this.state.lastToken=t.at(-1);let r;if((s=this.options.extensions)!=null&&(s=s.block)!=null&&s.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);r.raw.length===1&&n!==void 0?n.raw+=`
|
|
45
|
-
`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);(n==null?void 0:n.type)===`paragraph`||(n==null?void 0:n.type)===`text`?(n.raw+=(n.raw.endsWith(`
|
|
46
|
-
`)?``:`
|
|
47
|
-
`)+r.raw,n.text+=`
|
|
48
|
-
`+r.text,this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if((r=this.tokenizer.fences(e))||(r=this.tokenizer.heading(e))||(r=this.tokenizer.hr(e))||(r=this.tokenizer.blockquote(e))||(r=this.tokenizer.list(e))||(r=this.tokenizer.html(e))){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let n=t.at(-1);(n==null?void 0:n.type)===`paragraph`||(n==null?void 0:n.type)===`text`?(n.raw+=(n.raw.endsWith(`
|
|
49
|
-
`)?``:`
|
|
50
|
-
`)+r.raw,n.text+=`
|
|
51
|
-
`+r.raw,this.inlineQueue.at(-1).src=n.text):(this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title}),t.push(r));continue}if((r=this.tokenizer.table(e))||(r=this.tokenizer.lheading(e))){e=e.substring(r.raw.length),t.push(r);continue}let l=e;if((c=this.options.extensions)!=null&&c.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(l=e.substring(0,t+1))}if(this.state.top&&(r=this.tokenizer.paragraph(l))){let i=t.at(-1);(n||i===a&&o)&&(i==null?void 0:i.type)===`paragraph`?(i.raw+=(i.raw.endsWith(`
|
|
52
|
-
`)?``:`
|
|
53
|
-
`)+r.raw,i.text+=`
|
|
54
|
-
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text,a=i):(t.push(r),a=r),n=l.length!==e.length,e=e.substring(r.raw.length)}else if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);(n==null?void 0:n.type)===`text`?(n.raw+=(n.raw.endsWith(`
|
|
55
|
-
`)?``:`
|
|
56
|
-
`)+r.raw,n.text+=`
|
|
57
|
-
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r)}else if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,this.state.lastToken=r,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes(`[`))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!==`!`)return!0;for(let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let e=t[0],n=e.lastIndexOf(`[`);if(e.charAt(0)!==`!`&&Object.hasOwn(this.tokens.links,zt(e.slice(n+1,-1),this.options.pedantic))&&!(n>1&&this.linkInText(e.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=this.state.linkParenPossible;this.state.linkParenPossible=e.includes(`)`);try{return D(O,this,$t).call(this,e,t)}finally{this.state.linkParenPossible=n}}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}});function $t(e,t){var n;let r=e.includes(`*`)||e.includes(`_`)||e.includes(`~`),i=r||(n=this.options.hooks)!=null&&n.emStrongMask||this.tokenizer.emStrong!==W.prototype.emStrong||this.tokenizer.del!==W.prototype.del?D(O,this,nn).call(this,e):e;if(!r)return D(O,this,en).call(this,e,i,t);Ht(this.tokenizer,i);try{return D(O,this,en).call(this,e,i,t)}finally{Ut(this.tokenizer)}}function en(e,t,n){let r=!1,i=``,a=1/0;for(;e;){var o,s;if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let c;if((o=this.options.extensions)!=null&&(o=o.inline)!=null&&o.some(t=>(c=t.call({lexer:this},e,n))?(e=e.substring(c.raw.length),n.push(c),!0):!1))continue;if((c=this.tokenizer.escape(e))||(c=this.tokenizer.tag(e))||(c=this.tokenizer.link(e))){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(c.raw.length);let t=n.at(-1);c.type===`text`&&(t==null?void 0:t.type)===`text`?(t.raw+=c.raw,t.text+=c.text):n.push(c);continue}let l=e[0];if(l===`*`||l===`_`){let a=t.length-e.length;if(Wt(this.tokenizer,t,l)<=a){let t=1;for(;t<e.length&&e.charCodeAt(t)===l.charCodeAt(0);)t++;let a=e.substring(0,t),o=n.at(-1);(o==null?void 0:o.type)===`text`&&!o.escaped?(o.raw+=a,o.text+=a):n.push({type:`text`,raw:a,text:a,escaped:!1}),e=e.substring(t),i=l,r=!0;continue}}else if(l===`~`){let a=t.length-e.length;if(Gt(this.tokenizer,t)<=a){let t=1;for(;t<e.length&&e.charCodeAt(t)===126;)t++;let a=e.substring(0,t),o=n.at(-1);(o==null?void 0:o.type)===`text`&&!o.escaped?(o.raw+=a,o.text+=a):n.push({type:`text`,raw:a,text:a,escaped:!1}),e=e.substring(t),i=l,r=!0;continue}}if((c=this.tokenizer.emStrong(e,t,i))||(c=this.tokenizer.codespan(e))||(c=this.tokenizer.br(e))||(c=this.tokenizer.del(e,t,i))||(c=this.tokenizer.autolink(e))||!this.state.inLink&&(c=this.tokenizer.url(e))){e=e.substring(c.raw.length),n.push(c);continue}let u=e;if((s=this.options.extensions)!=null&&s.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(u=e.substring(0,t+1))}if(c=this.tokenizer.inlineText(u)){e=e.substring(c.raw.length),c.raw.slice(-1)!==`_`&&(i=c.raw.slice(-1)),r=!0;let t=n.at(-1);(t==null?void 0:t.type)===`text`?(t.raw+=c.raw,t.text+=c.text):n.push(c)}else if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return n}function tn(e){let{blockSkip:t,tag:n,autolink:r}=this.tokenizer.rules.inline,i=``,a=0,o;for(t.lastIndex=0;o=t.exec(e);){let s=o.index+(o[2]?o[2].length:0),c=o.index+o[0].length;if(e.charAt(s)===`<`){let i=e.slice(s),a=n.exec(i)||r.exec(i);if(!a){t.lastIndex=s+1;continue}c=s+a[0].length,t.lastIndex=c}i+=e.slice(a,s)+`[`+`a`.repeat(c-s-2)+`]`,a=c}return i+e.slice(a)}function nn(e){var t;let n=e;if(this.tokens.links&&e.includes(`[`)){let e=this.tokenizer.rules.inline.reflinkSearch,t=n=>{let r=n.lastIndexOf(`[`);if(!Object.hasOwn(this.tokens.links,zt(n.slice(r+1,-1),this.options.pedantic)))return n;if(r>1&&n.charAt(0)!==`!`){let i=n.slice(1,r-1);if(this.linkInText(i))return`[`+i.replace(e,t)+`][`+`a`.repeat(n.length-r-2)+`]`}return`[`+`a`.repeat(n.length-2)+`]`};n=n.replace(e,t)}return n=n.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(e,t,n)=>n?`+`.repeat(e.length):t?t+e.slice(t.length,-t.length).replace(/`/g,`+`)+t:e),n=D(O,this,tn).call(this,n),n=((t=this.options.hooks)==null||(t=t.emStrongMask)==null?void 0:t.call({lexer:this},n))??n,n}function rn(e,t=!1){let n;for(let r=0;r<e.length;r++){let i=e[r],a=i;if(i.type===`codespan`||i.type===`escape`||t&&i.type===`text`){let e=B(i.text,!0);e!==i.text&&(a={...i,text:e})}else if(i.type===`link`&&i.autolink){let e=B(i.text,!0),t=i.tokens,n=t&&(t.length===1&&t[0].type===`text`&&t[0].text===i.text?e===i.text?t:[{...t[0],text:e}]:rn(t,!0));(e!==i.text||n!==t)&&(a=n===t?{...i,text:e}:{...i,text:e,tokens:n})}else if(`tokens`in i&&i.tokens){let e=rn(i.tokens,t);e!==i.tokens&&(a={...i,tokens:e})}a===i?n&&n.push(i):(n||=e.slice(0,r),n.push(a))}return n||e}var an=class{constructor(e){w(this,`options`,void 0),w(this,`parser`,void 0),this.options=e||k}space(e){return``}code({text:e,lang:t,escaped:n}){var r;let i=(r=(t||``).trim().match(N.notSpaceStart))==null?void 0:r[0],a=e?e.replace(N.endingNewline,``)+`
|
|
58
|
-
`:``;return i?`<pre><code class="language-`+B(i)+`">`+(n?a:B(a,!0))+`</code></pre>
|
|
59
|
-
`:`<pre><code>`+(n?a:B(a,!0))+`</code></pre>
|
|
60
|
-
`}blockquote({tokens:e}){return`<blockquote>
|
|
61
|
-
${this.parser.parse(e)}</blockquote>
|
|
62
|
-
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
63
|
-
`}hr(e){return`<hr>
|
|
64
|
-
`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
|
|
65
|
-
`+r+`</`+i+`>
|
|
66
|
-
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
67
|
-
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
68
|
-
`}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
|
|
69
|
-
<thead>
|
|
70
|
-
`+t+`</thead>
|
|
71
|
-
`+r+`</table>
|
|
72
|
-
`}tablerow({text:e}){return`<tr>
|
|
73
|
-
${e}</tr>
|
|
74
|
-
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
75
|
-
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${B(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?B(n,!0):this.parser.parseInline(r),o=It(e);if(o===null)return a;e=B(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+B(t)+`"`),s+=`>`+a+`</a>`,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(rn(r),this.parser.textRenderer));let i=It(e);if(i===null)return B(n);e=i;let a=`<img src="${B(e)}" alt="${B(n)}"`;return t&&(a+=` title="${B(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:B(e.text)}},on=class{constructor(){w(this,`parser`,void 0)}strong({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}em({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}codespan({text:e}){return e}del({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}html({text:e}){return e}text({text:e}){return e}link({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}image({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}br(){return`
|
|
76
|
-
`}checkbox({raw:e}){return e}},K=class e{constructor(e){w(this,`options`,void 0),w(this,`renderer`,void 0),w(this,`textRenderer`,void 0),this.options=e||k,this.options.renderer=this.options.renderer||new an,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new on,this.textRenderer.parser=this}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let r=0;r<e.length;r++){var n;let i=e[r],a=(n=this.options.extensions)==null?void 0:n.renderers;if(a&&Object.hasOwn(a,i.type)&&a[i.type]){let e=i,n=a[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n===!1?``:n??``;continue}}let o=i;switch(o.type){case`space`:t+=this.renderer.space(o);break;case`hr`:t+=this.renderer.hr(o);break;case`heading`:t+=this.renderer.heading(o);break;case`code`:t+=this.renderer.code(o);break;case`table`:t+=this.renderer.table(o);break;case`blockquote`:t+=this.renderer.blockquote(o);break;case`list`:t+=this.renderer.list(o);break;case`checkbox`:t+=this.renderer.checkbox(o);break;case`html`:t+=this.renderer.html(o);break;case`def`:t+=this.renderer.def(o);break;case`paragraph`:t+=this.renderer.paragraph(o);break;case`text`:t+=this.renderer.text(o);break;default:{let e=`Token with "`+o.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let i=0;i<e.length;i++){var r;let a=e[i],o=(r=this.options.extensions)==null?void 0:r.renderers;if(o&&Object.hasOwn(o,a.type)&&o[a.type]){let e=o[a.type].call({parser:this},a);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(a.type)){n+=e===!1?``:e??``;continue}}let s=a;switch(s.type){case`escape`:n+=t.text(s);break;case`html`:n+=t.html(s);break;case`link`:n+=t.link(s);break;case`image`:n+=t.image(s);break;case`checkbox`:n+=t.checkbox(s);break;case`strong`:n+=t.strong(s);break;case`em`:n+=t.em(s);break;case`codespan`:n+=t.codespan(s);break;case`br`:n+=t.br(s);break;case`del`:n+=t.del(s);break;case`text`:n+=t.text(s);break;default:{let e=`Token with "`+s.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},q=(de=class{constructor(e){w(this,`options`,void 0),w(this,`block`,void 0),this.options=e||k}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?G.lex:G.lexInline}provideParser(e=this.block){return e?K.parse:K.parseInline}},w(de,`passThroughHooks`,new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`])),w(de,`passThroughHooksRespectAsync`,new Set([`preprocess`,`postprocess`,`processAllTokens`])),de);function J(e,t){if(Array.isArray(t))for(let n=0;n<t.length;n++)e.push(t[n]);else e.push(t)}var Y=new class{constructor(...e){w(this,`defaults`,fe()),w(this,`options`,this.setOptions),w(this,`parse`,this.parseMarkdown(!0)),w(this,`parseInline`,this.parseMarkdown(!1)),w(this,`Parser`,K),w(this,`Renderer`,an),w(this,`TextRenderer`,on),w(this,`Lexer`,G),w(this,`Tokenizer`,W),w(this,`Hooks`,q),this.use(...e)}walkTokens(e,t){let n=[];for(let i of e)switch(J(n,t.call(this,i)),i.type){case`table`:{let e=i;for(let r of e.header)J(n,this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)J(n,this.walkTokens(e.tokens,t));break}case`list`:{let e=i;J(n,this.walkTokens(e.items,t));break}default:{var r;let e=i;(r=this.defaults.extensions)!=null&&(r=r.childTokens)!=null&&r[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{if(e[r]){let i=e[r].flat(1/0);J(n,this.walkTokens(i,t))}}):e.tokens&&J(n,this.walkTokens(e.tokens,t))}}return n}use(...e){let t=this.defaults.extensions||{renderers:Object.create(null),childTokens:Object.create(null)};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e&&e.renderer){let n=e.renderer,r=t.renderers[e.name];r?t.renderers[e.name]=function(...e){let t=n.apply(this,e);return t===!1&&(t=r.apply(this,e)),t}:t.renderers[e.name]=n}if(`tokenizer`in e&&e.tokenizer){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new an(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r];if(i===void 0)continue;let a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n===!1?``:n??``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new W(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r];if(i===void 0)continue;let a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new q;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r];if(i===void 0)continue;let a=t[r];t[r]=q.passThroughHooks.has(n)?e=>{if(t.options.async&&q.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(t.options.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return J(n,r.call(this,e)),t&&J(n,t.call(this,e)),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return G.lex(e,t??this.defaults)}parser(e,t){return K.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?G.lex:G.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?K.parse:K.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?G.lex:G.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?K.parse:K.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{let r=n instanceof Error?n:Error(String(n));if(r.message+=`
|
|
77
|
-
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+B(r.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(r);throw r}}};function X(e,t){return Y.parse(e,t)}X.options=X.setOptions=function(e){return Y.setOptions(e),X.defaults=Y.defaults,pe(X.defaults),X},X.getDefaults=fe,X.defaults=k,X.use=function(...e){return Y.use(...e),X.defaults=Y.defaults,pe(X.defaults),X},X.walkTokens=function(e,t){return Y.walkTokens(e,t)},X.parseInline=function(e,t){return Y.parseInline(e,t)},X.Parser=K,X.parser=K.parse,X.Renderer=an,X.TextRenderer=on,X.Lexer=G,X.lexer=G.lex,X.Tokenizer=W,X.Hooks=q,X.parse=X,X.options,X.setOptions,X.walkTokens,X.parseInline,K.parse,G.lex;function sn(e){var t;return((t=e.custom)==null?void 0:t.file)||e.file}function cn(e){var t;return!!(((t=e.custom)==null?void 0:t.defaultOpen)??e.defaultOpen)}X.setOptions({gfm:!0,breaks:!0});function ln(e,t){let n=`/adapter/${t}/doc-md`;return e.replace(/\((?:\.\.\/)*doc-md\//g,`(${n}/`).replace(/\((?:\.\/)?img\//g,`(${n}/img/`)}var un=class extends T{constructor(e){super(e),this.state={...this.state,html:``,error:``}}async componentDidMount(){await super.componentDidMount(),await this.load()}async load(){var e;let t=sn(this.props.schema);if(!t)return;let n=this.props.oContext.adapterName,r=(((e=C.getLanguage)==null?void 0:e.call(C))||`en`).replace(/-.*$/,``),i=r===`en`?[`${t}_en.md`]:[`${t}_${r}.md`,`${t}_en.md`];for(let e of i)try{let t=await fetch(`/adapter/${n}/doc-md/${e}`);if(!t.ok)continue;let r=ln(await t.text(),n),i=await X.parse(r);this.setState({html:i,error:``});return}catch{}this.setState({error:E(`sc_help_missing`)})}renderItem(){let e=this.props.schema,t=this.getText(e.label)||E(`sc_help`),n=this.props.oContext.themeType===`dark`;return m(oe,{defaultExpanded:cn(e),disableGutters:!0,sx:{width:`100%`,mb:1},children:[r(ee,{expandIcon:r(d,{}),children:m(x,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[r(b,{fontSize:`small`,color:`primary`}),r(y,{variant:`subtitle2`,children:t})]})}),r(ne,{children:this.state.error?r(y,{color:`text.secondary`,children:this.state.error}):r(x,{className:`sc-help-md`,sx:{"& img":{maxWidth:`100%`,height:`auto`},"& table":{width:`100%`,borderCollapse:`collapse`,fontSize:`0.85rem`},"& th, & td":{border:1,borderColor:`divider`,p:.5,textAlign:`left`,verticalAlign:`top`},"& a":{color:n?`#58a6ff`:`primary.main`},"& h2":{fontSize:`1.15rem`,fontWeight:600,mt:2.5,mb:1,pb:.5,borderBottom:1,borderColor:`divider`},"& h3":{fontSize:`1rem`,fontWeight:600,mt:2,mb:.75},"& hr":{my:2.5,borderColor:`divider`},"& details":{mb:1},"& summary":{cursor:`pointer`,fontWeight:600}},dangerouslySetInnerHTML:{__html:this.state.html}})})]})}};function dn(e){let t=e.lastIndexOf(`.`);return t===-1?``:e.slice(0,t)}function fn(e){let t=e.lastIndexOf(`.`);return t===-1?e:e.slice(t+1)}function Z(e){let{options:t,selected:n,onChange:i,label:o,compact:s}=e;if(!t.length&&!n.length)return r(y,{variant:`body2`,color:`text.secondary`,children:E(`sc_no_names`)});let c=[...t];n.forEach(e=>{e&&!c.includes(e)&&!c.some(t=>t.toLowerCase()===e.toLowerCase())&&c.push(e)});let l=n.map(e=>c.includes(e)?e:c.find(t=>t.toLowerCase()===e.toLowerCase())||e).filter(e=>!!e);return c.sort((e,t)=>{let n=dn(e),r=dn(t);return n===r?fn(e).localeCompare(fn(t),`de`):n.localeCompare(r,`de`)}),ie(()=>{l.length===n.length&&l.some((e,t)=>e!==n[t])&&i(l)},[l.join(`\0`),n.join(`\0`)]),r(a,{multiple:!0,size:`small`,options:c,value:l,disableCloseOnSelect:!0,isOptionEqualToValue:(e,t)=>e===t,groupBy:e=>dn(e),onChange:(e,t)=>i(t),renderOption:(e,t)=>{let{key:n,...i}=e;return m(`li`,{...i,children:[r(S,{size:`small`,checked:l.includes(t),sx:{mr:1}}),fn(t)]},n)},renderInput:e=>r(g,{...e,label:o,placeholder:s?void 0:E(`sc_pick_names`)})})}var pn=[`tableTargetDevices`,`tableTargetEnums`,`tableTargetURLs`,`tableConditions`,`tableTriggerMotion`,`tableTriggerDevices`,`tableTriggerTimes`,`tableZones`],mn={_tabDevices:[`tableTargetDevices`,`tableTargetEnums`,`tableTargetURLs`],_tabConditions:[`tableConditions`],_tabTriggers:[`tableTriggerMotion`,`tableTriggerDevices`,`tableTriggerTimes`],_tabZones:[`tableZones`],_tabOptions:[`motionIgnoreBriIfZoneOn`,`fixNightNightEnd`,`triggerStatesAck`,`limitTriggerInterval`,`jsonMaxEntries`,`extendedInfoLog`,`validateDeactivatedRows`]},hn=[...new Set(Object.values(mn).flat())];function gn(e){let t={};for(let n of hn)t[n]=e[n];return JSON.stringify(t)}function _n(){let e=window;return e.__smartcontrolVerifyOk&&typeof e.__smartcontrolVerifyOk==`object`||(e.__smartcontrolVerifyOk={}),e.__smartcontrolVerifyOk}function vn(e){return e||`_`}function yn(e,t){_n()[vn(t)]=e}function bn(e){return!!_n()[vn(e)]}function Q(e){return(e||[]).map(e=>e.name).filter(e=>!!e&&e.trim()!==``)}function xn(e){let t={};for(let n of pn)t[n]=Q(e[n]);return t}function Sn(e,t){if(t.length<e.length)return null;let n=e.length,r=[];for(let i=0;i<n;i++)e[i]!==t[i]&&r.push({from:e[i],to:t[i]});return r.length!==1||!r[0].from||!r[0].to?null:r[0]}function $(e,t,n){return e&&e.map(e=>e===t?n:e)}function Cn(e,t,n){if(!e)return e;try{let r=JSON.parse(e);if(!Array.isArray(r))return e;let i=r.map(e=>({...e,additionalConditions:$(e.additionalConditions,t,n),never:$(e.never,t,n)}));return JSON.stringify(i)}catch{return e}}function wn(e,t,n){if(!t||t===n)return e;let r={...e};return r.tableTriggerMotion=[...e.tableTriggerMotion||[]].map(e=>({...e,motionLinkedTrigger:$(e.motionLinkedTrigger,t,n)})),r.tableTriggerTimes=[...e.tableTriggerTimes||[]].map(e=>({...e,additionalConditions:$(e.additionalConditions,t,n),never:$(e.never,t,n)})),r.tableZones=[...e.tableZones||[]].map(e=>{let r={...e.targetsOverwrite||{}};return Object.prototype.hasOwnProperty.call(r,t)&&(r[n]=r[t],delete r[t]),{...e,triggers:$(e.triggers,t,n),targets:$(e.targets,t,n),neverOff:$(e.neverOff,t,n),targetsOverwrite:r,executionJson:Cn(e.executionJson,t,n)}}),r}var Tn=[`mon`,`tue`,`wed`,`thu`,`fri`,`sat`,`sun`],En={mon:`sc_day_mon`,tue:`sc_day_tue`,wed:`sc_day_wed`,thu:`sc_day_thu`,fri:`sc_day_fri`,sat:`sc_day_sat`,sun:`sc_day_sun`};function Dn(e){if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function On(){return{active:!0,start:``,end:``,mon:!0,tue:!0,wed:!0,thu:!0,fri:!0,sat:!0,sun:!0,additionalConditions:[],additionalConditionsAll:!1,never:[],neverAll:!1}}function kn(e,t){let n=t.map(e=>e.toLowerCase()),r=`${e}_Copy`,i=2;for(;n.includes(r.toLowerCase());)r=`${e}_Copy${i}`,i+=1;return r}function An(){return{active:!0,name:``,triggers:[],targets:[],onAfter:``,recheckAfterDelay:!1,offAfter:``,neverOff:[],neverOffAll:!1,executeAlways:!1,executionJson:`[]`,infoText:``,targetsOverwrite:{}}}var jn=class extends T{setZones(e){this.onChange(`tableZones`,e)}moveZoneTo(e,t){let n=[...T.getValue(this.props.data,`tableZones`)||[]];if(e===t||e<0||t<0||e>=n.length||t>=n.length)return;let[r]=n.splice(e,1);n.splice(t,0,r),this.setZones(n)}moveZone(e,t){this.moveZoneTo(e,e+t)}patchZone(e,t){let n=[...T.getValue(this.props.data,`tableZones`)||[]];n[e]={...An(),...n[e],...t},this.setZones(n)}renderItem(){let n=this.props.data,a=(n.tableZones||[]).map(e=>({...An(),...e})),u=[...Q(n.tableTriggerMotion),...Q(n.tableTriggerDevices),...Q(n.tableTriggerTimes)],f=[...Q(n.tableTargetDevices),...Q(n.tableTargetEnums),...Q(n.tableTargetURLs)],h=Q(n.tableConditions);return m(p,{spacing:2,sx:{width:`100%`},children:[r(un,{...this.props,attr:`_helpZones`,schema:{file:`table-zones`,label:E(`sc_help_zones`)}}),r(un,{...this.props,attr:`_helpExecution`,schema:{file:`table-execution`,label:E(`sc_help_execution`)}}),r(un,{...this.props,attr:`_helpOverwrite`,schema:{file:`table-zones_select-targets`,label:E(`sc_help_overwrite`)}}),r(y,{variant:`body2`,color:`text.secondary`,children:E(`sc_exec_hint`)}),a.map((n,_)=>{let b=Dn(n.executionJson),re=n.targetsOverwrite||{},ie=this.state.dragFrom,C=this.state.dropAt;return m(oe,{defaultExpanded:!1,onDragOver:e=>{e.preventDefault(),C!==_&&this.setState({dropAt:_})},onDrop:e=>{e.preventDefault(),e.stopPropagation();let t=Number(e.dataTransfer.getData(`text/plain`));this.setState({dragFrom:null,dropAt:null}),Number.isNaN(t)||this.moveZoneTo(t,_)},onDragEnd:()=>this.setState({dragFrom:null,dropAt:null}),sx:{opacity:ie===_?.5:1,outline:C===_&&ie!==_?`2px solid`:`none`,outlineColor:`primary.main`},children:[m(ee,{expandIcon:r(d,{}),children:[r(x,{draggable:!0,"aria-label":E(`sc_zone_drag`),title:E(`sc_zone_drag`),onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onDragStart:e=>{e.stopPropagation(),e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,String(_)),this.setState({dragFrom:_,dropAt:_})},sx:{display:`none`,"@media (hover: hover) and (pointer: fine)":{display:`inline-flex`},alignItems:`center`,cursor:`grab`,color:`text.secondary`,mr:.5},children:r(c,{fontSize:`small`})}),r(v,{onClick:e=>e.stopPropagation(),onFocus:e=>e.stopPropagation(),control:r(S,{checked:!!n.active,onChange:(e,t)=>this.patchZone(_,{active:t})}),label:``}),r(y,{sx:{flex:1,alignSelf:`center`},children:n.name||`${E(`sc_zone`)} ${_+1}`}),r(e,{size:`small`,"aria-label":E(`sc_zone_up`),disabled:_===0,onClick:e=>{e.stopPropagation(),this.moveZone(_,-1)},children:r(t,{fontSize:`small`})}),r(e,{size:`small`,"aria-label":E(`sc_zone_down`),disabled:_===a.length-1,onClick:e=>{e.stopPropagation(),this.moveZone(_,1)},children:r(l,{fontSize:`small`})}),r(e,{size:`small`,"aria-label":E(`sc_copy_zone`),onClick:e=>{e.stopPropagation();let t=JSON.parse(JSON.stringify(n));t.name=kn(n.name||E(`sc_zone`),a.map(e=>e.name||``));let r=[...a];r.splice(_+1,0,t),this.setZones(r)},children:r(i,{fontSize:`small`})}),r(e,{size:`small`,"aria-label":E(`sc_delete_zone`),onClick:e=>{e.stopPropagation(),this.setZones(a.filter((e,t)=>t!==_))},children:r(o,{})})]}),r(ne,{children:m(p,{spacing:2,children:[r(g,{label:E(`sc_name`),value:n.name||``,onChange:e=>this.patchZone(_,{name:e.target.value}),fullWidth:!0}),m(x,{children:[r(y,{variant:`subtitle2`,children:E(`sc_triggers`)}),r(Z,{options:u,selected:n.triggers||[],onChange:e=>this.patchZone(_,{triggers:e})})]}),m(x,{children:[r(y,{variant:`subtitle2`,children:E(`sc_targets`)}),r(Z,{options:f,selected:n.targets||[],onChange:e=>this.patchZone(_,{targets:e})})]}),(n.targets||[]).length>0&&m(x,{children:[r(y,{variant:`subtitle2`,children:E(`sc_overwrite`)}),r(y,{variant:`caption`,color:`text.secondary`,component:`p`,sx:{mb:1,whiteSpace:`normal`},children:E(`sc_overwrite_hint`)}),(n.targets||[]).map(e=>{let t=re[e],n=t&&typeof t==`object`?t:{val:typeof t==`string`?t:``,delay:``};return m(p,{direction:{xs:`column`,sm:`row`},spacing:1,sx:{alignItems:{sm:`center`},mb:1,flexWrap:`wrap`},children:[r(y,{sx:{minWidth:160},children:e}),r(g,{size:`small`,label:E(`sc_overwrite_val`),value:n.val||``,onChange:t=>{let r={...re},i=t.target.value,a=n.delay??``;!i&&(a===``||a==null)?delete r[e]:r[e]={...n,val:i},this.patchZone(_,{targetsOverwrite:r})}}),r(g,{size:`small`,type:`number`,label:E(`sc_overwrite_delay`),value:n.delay??``,onChange:t=>{let r={...re},i=t.target.value;!n.val&&(i===``||i==null)?delete r[e]:r[e]={...n,delay:i},this.patchZone(_,{targetsOverwrite:r})}})]},e)})]}),m(x,{children:[r(y,{variant:`subtitle2`,children:E(`sc_zone_delays`)}),m(p,{direction:`row`,spacing:2,children:[r(g,{type:`number`,label:E(`sc_onAfter`),value:n.onAfter??``,onChange:e=>this.patchZone(_,{onAfter:e.target.value})}),r(v,{control:r(S,{checked:n.recheckAfterDelay===!0,onChange:(e,t)=>this.patchZone(_,{recheckAfterDelay:t})}),label:E(`sc_recheck`)}),r(g,{type:`number`,label:E(`sc_offAfter`),value:n.offAfter??``,onChange:e=>this.patchZone(_,{offAfter:e.target.value})})]})]}),m(x,{children:[r(y,{variant:`subtitle2`,children:E(`sc_neverOff`)}),r(Z,{options:h,selected:n.neverOff||[],onChange:e=>this.patchZone(_,{neverOff:e})}),r(v,{control:r(S,{checked:!!n.neverOffAll,onChange:(e,t)=>this.patchZone(_,{neverOffAll:t})}),label:E(`sc_allMustMatch`)})]}),r(v,{control:r(S,{checked:!!n.executeAlways,onChange:(e,t)=>this.patchZone(_,{executeAlways:t})}),label:E(`sc_executeAlways`)}),!n.executeAlways&&m(x,{children:[r(y,{variant:`subtitle2`,children:E(`sc_execution`)}),b.map((t,n)=>m(p,{spacing:1,sx:{border:1,borderColor:`divider`,p:1,mb:1},children:[m(p,{direction:`row`,spacing:1,children:[r(v,{control:r(S,{checked:t.active!==!1,onChange:(e,r)=>{let i=[...b];i[n]={...t,active:r},this.patchZone(_,{executionJson:JSON.stringify(i)})}}),label:E(`sc_active`)}),r(g,{size:`small`,label:E(`sc_start`),value:t.start||``,onChange:e=>{let r=[...b];r[n]={...t,start:e.target.value},this.patchZone(_,{executionJson:JSON.stringify(r)})}}),r(g,{size:`small`,label:E(`sc_end`),value:t.end||``,onChange:e=>{let r=[...b];r[n]={...t,end:e.target.value},this.patchZone(_,{executionJson:JSON.stringify(r)})}}),r(e,{onClick:()=>{this.patchZone(_,{executionJson:JSON.stringify(b.filter((e,t)=>t!==n))})},children:r(o,{})})]}),r(ae,{row:!0,children:Tn.map(e=>r(v,{control:r(S,{size:`small`,checked:t[e]!==!1,onChange:(r,i)=>{let a=[...b];a[n]={...t,[e]:i},this.patchZone(_,{executionJson:JSON.stringify(a)})}}),label:E(En[e])},e))}),r(y,{variant:`caption`,children:E(`sc_additional_conditions`)}),r(Z,{options:h,selected:t.additionalConditions||[],onChange:e=>{let r=[...b];r[n]={...t,additionalConditions:e},this.patchZone(_,{executionJson:JSON.stringify(r)})}}),r(v,{control:r(S,{size:`small`,checked:!!t.additionalConditionsAll,onChange:(e,r)=>{let i=[...b];i[n]={...t,additionalConditionsAll:r},this.patchZone(_,{executionJson:JSON.stringify(i)})}}),label:E(`sc_allMustMatch`)}),r(y,{variant:`caption`,children:E(`sc_never_on`)}),r(Z,{options:h,selected:t.never||[],onChange:e=>{let r=[...b];r[n]={...t,never:e},this.patchZone(_,{executionJson:JSON.stringify(r)})}}),r(v,{control:r(S,{size:`small`,checked:!!t.neverAll,onChange:(e,r)=>{let i=[...b];i[n]={...t,neverAll:r},this.patchZone(_,{executionJson:JSON.stringify(i)})}}),label:E(`sc_allMustMatch`)})]},n)),r(te,{startIcon:r(s,{}),onClick:()=>this.patchZone(_,{executionJson:JSON.stringify([...b,On()])}),children:E(`sc_add_window`)})]}),r(g,{label:E(`sc_infoText`),value:n.infoText||``,onChange:e=>this.patchZone(_,{infoText:e.target.value}),fullWidth:!0,multiline:!0})]})})]},n.name?`z-${n.name}`:`i-${_}`)}),r(te,{variant:`outlined`,startIcon:r(s,{}),onClick:()=>this.setZones([...a,An()]),children:E(`sc_add_zone`)})]})}};function Mn(e){return`${e.adapterName}.${e.instance}`}var Nn=class extends T{constructor(e){super(e),w(this,`names`,xn({})),w(this,`dataSig`,``),w(this,`renameBusy`,!1),w(this,`check`,()=>{let{socket:e,adapterName:t,instance:n}=this.props.oContext,r=Mn(this.props.oContext);this.setState({busy:!0,error:``,issues:[],passed:null}),e.sendTo(`${t}.${n}`,`verifyConfig`,this.props.data).then(e=>{let t=Array.isArray(e==null?void 0:e.issues)?e.issues:[],n=t.length===0&&(e==null?void 0:e.passed)!==!1;n?(yn(!0,r),this.props.onError(`_verifyGate`)):(yn(!1,r),this.props.onError(`_verifyGate`,E(`sc_verify_before_save`))),this.setState({busy:!1,passed:n,issues:t})}).catch(e=>{yn(!1,r),this.props.onError(`_verifyGate`,E(`sc_verify_need_alive`)),this.setState({busy:!1,error:(e==null?void 0:e.message)||E(`sc_verify_need_alive`),passed:!1})})}),this.state={...this.state,busy:!1,issues:[],passed:null,error:``}}async componentDidMount(){await super.componentDidMount(),this.names=xn(this.props.data),this.dataSig=gn(this.props.data),bn(Mn(this.props.oContext))&&this.setState({passed:!0})}componentDidUpdate(){let e=this.props.data;if(this.renameBusy)this.renameBusy=!1,this.names=xn(e);else{let t=xn(e),n=null;if(Object.keys(this.names).forEach(r=>{let i=Sn(this.names[r]||[],t[r]||[]);i&&(n=wn(n||e,i.from,i.to))}),this.names=t,n){this.renameBusy=!0,this.props.onChange(n);return}}let t=gn(this.props.data),n=Mn(this.props.oContext);t!==this.dataSig&&(this.dataSig=t,yn(!1,n),this.props.onError(`_verifyGate`,E(`sc_verify_before_save`)),this.state.passed!==null&&this.setState({passed:null,issues:[]}))}renderItem(){return m(p,{spacing:1,sx:{width:`100%`,mb:1,position:`sticky`,top:0,zIndex:20,bgcolor:`background.paper`,py:1},children:[r(te,{variant:`contained`,disabled:this.state.busy,onClick:this.check,sx:{alignSelf:`flex-start`},children:E(`sc_verify`)}),this.state.passed===!0&&r(f,{severity:`success`,children:E(`sc_verify_ok`)}),this.state.error&&r(f,{severity:`warning`,children:this.state.error}),this.state.passed===!1&&this.state.issues.length>0&&m(f,{severity:`error`,children:[E(`sc_verify_fail`),r(`ol`,{children:this.state.issues.map((e,t)=>r(`li`,{children:e},t))})]})]})}};function Pn(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Fn(e){return`${e.adapterName}.${e.instance}`}function In(e,t,n,r){if(bn(r))return!1;let i=mn[e];return i?i.some(e=>!Pn(t[e],n[e])):!1}var Ln=`calc(100vh - 235px)`,Rn=300;function zn(e){let t=e.ownerDocument.defaultView||window,n=e.parentElement;for(;n&&n!==e.ownerDocument.body;){let e=t.getComputedStyle(n).overflowY;if(e===`auto`||e===`scroll`||e===`overlay`)return n;n=n.parentElement}return null}function Bn(e,t){let n=e.ownerDocument.defaultView||window,r=0;for(let i=e;i&&i!==t;i=i.parentElement){let t=n.getComputedStyle(i);r+=parseFloat(t.marginBottom)||0,i!==e&&(r+=(parseFloat(t.paddingBottom)||0)+(parseFloat(t.borderBottomWidth)||0))}return r+(parseFloat(n.getComputedStyle(t).paddingBottom)||0)}function Vn(e){var t;let n=e,r=((t=n.custom)==null?void 0:t.items)||n.items;return r&&typeof r==`object`?r:{}}function Hn(e){return e._localStorage||e.localStorage}var Un=class extends T{constructor(e){super(e),w(this,`rootEl`,null),w(this,`scroller`,null),w(this,`resizeObserver`,null),w(this,`frame`,0),w(this,`setRootEl`,e=>{e!==this.rootEl&&(this.stopMeasuring(),this.rootEl=e,e&&this.startMeasuring(e))}),w(this,`scheduleMeasure`,()=>{this.frame||=requestAnimationFrame(this.measure)}),w(this,`measure`,()=>{this.frame=0;let e=this.rootEl,t=this.scroller;if(!e||!t)return;let n=e.getBoundingClientRect().top-t.getBoundingClientRect().top-t.clientTop+t.scrollTop,r=Math.max(Rn,Math.floor(t.clientHeight-n-Bn(e,t))-1);r!==this.state.height&&this.setState({height:r})}),w(this,`setTab`,(e,t)=>{let n=this.props.dialogName;Hn(window).setItem(`${n||`App`}.${this.props.oContext.adapterName}`,t),this.setState({tab:t})});let t=Vn(e.schema),n=Object.keys(t),r=e.dialogName,i=Hn(window).getItem(`${r||`App`}.${e.oContext.adapterName}`)||``,a=n.includes(i)?i:n[0]||``;this.state={...this.state,tab:a,height:null}}componentWillUnmount(){this.stopMeasuring(),super.componentWillUnmount()}startMeasuring(e){this.scroller=zn(e),this.scroller&&(typeof ResizeObserver<`u`&&(this.resizeObserver=new ResizeObserver(this.scheduleMeasure),this.resizeObserver.observe(this.scroller)),window.addEventListener(`resize`,this.scheduleMeasure),this.scheduleMeasure())}stopMeasuring(){var e;(e=this.resizeObserver)==null||e.disconnect(),this.resizeObserver=null,window.removeEventListener(`resize`,this.scheduleMeasure),this.frame&&=(cancelAnimationFrame(this.frame),0),this.scroller=null}renderItem(){let e=Vn(this.props.schema),t=Object.keys(e);if(!t.length)return null;let i=t.includes(this.state.tab)?this.state.tab:t[0],a=this.props.data,o=this.props.originalData||{},s=Fn(this.props.oContext),c=e[i],l=this.state.height===null?Ln:`${this.state.height}px`;return m(x,{ref:this.setRootEl,sx:{width:`100%`,height:l,maxHeight:l,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:[m(x,{sx:{flexShrink:0,bgcolor:`background.paper`,zIndex:2},children:[r(Nn,{...this.props,attr:`_verify`}),r(_,{variant:`scrollable`,scrollButtons:`auto`,value:i,onChange:this.setTab,children:t.map(t=>{let i=In(t,a,o,s)?m(x,{sx:{display:`flex`,alignItems:`center`,gap:.5},children:[this.getText(e[t].label||t),r(n,{sx:{fontSize:16,color:`error.main`},titleAccess:E(`sc_tab_changed`)})]}):this.getText(e[t].label||t);return r(h,{value:t,label:i,wrapped:!0},t)})})]}),c?r(x,{sx:{flex:1,minHeight:0,overflow:`auto`,pt:1},children:u(se,{...this.props,key:i,attr:i,index:1001,isParentTab:!1,schema:c})}):null]})}},Wn=class extends T{constructor(...e){super(...e),w(this,`nameSource`,`conditions`)}renderItem(){let e=this.nameSource,t=this.props.globalData||this.props.data,n=e===`otherTriggers`?[...Q(t.tableTriggerDevices),...Q(t.tableTriggerTimes)]:Q(t.tableConditions),i=this.props.attr||``,a=this.props.data[i]||[];return r(Z,{compact:!0,options:n,selected:Array.isArray(a)?a:[],onChange:e=>void this.onChange(i,e)})}},Gn=class extends Wn{constructor(...e){super(...e),w(this,`nameSource`,`conditions`)}},Kn=class extends Wn{constructor(...e){super(...e),w(this,`nameSource`,`otherTriggers`)}};function qn(e,t){return e?typeof e==`string`?e:e[t]||e.en||Object.values(e).find(e=>typeof e==`string`)||``:``}var Jn=class extends T{constructor(e){super(e),w(this,`enumKind`,`functions`),w(this,`enumMultiple`,!1),w(this,`load`,async()=>{let e=this.enumKind,t=((typeof navigator<`u`?navigator.language:`en`)||`en`).substring(0,2);try{let n=await this.props.oContext.socket.getEnums(e),r=Object.keys(n||{}).map(e=>{var r;return qn((r=n[e])==null||(r=r.common)==null?void 0:r.name,t)}).filter(e=>e).sort((e,t)=>e.localeCompare(t));this.setState({names:r,loadError:``})}catch(e){this.setState({names:[],loadError:e instanceof Error?e.message:E(`sc_enum_fail`)})}}),this.state={...this.state,names:[],loadError:``}}async componentDidMount(){await super.componentDidMount(),await this.load()}renderItem(){let e=this.props.attr||``,t=this.enumMultiple,n=this.props.data[e];if(this.state.loadError)return r(y,{variant:`body2`,color:`error`,children:this.state.loadError});if(t){let t=Array.isArray(n)?n:[];return r(a,{multiple:!0,size:`small`,options:this.state.names,value:t,onChange:(t,n)=>void this.onChange(e,n),renderInput:e=>r(g,{...e,placeholder:E(`sc_enum_rooms`)})})}let i=typeof n==`string`?n:``;return r(a,{size:`small`,freeSolo:!0,options:this.state.names,inputValue:i,onInputChange:(t,n)=>void this.onChange(e,n),renderInput:e=>r(g,{...e,placeholder:E(`sc_enum_function`)})})}},Yn=class extends Jn{constructor(...e){super(...e),w(this,`enumKind`,`functions`),w(this,`enumMultiple`,!1)}},Xn=class extends Jn{constructor(...e){super(...e),w(this,`enumKind`,`rooms`),w(this,`enumMultiple`,!0)}};function Zn(e,t,n){let r=e.trim();if(!r)return``;let i=`${t}.${n}.userstates.`,a=r.startsWith(i)?r.slice(i.length):r;return a.includes(`.`)&&(a=a.split(`.`).pop()||``),a}var Qn={ZonesEditor:jn,VerifyBar:Nn,TabHost:Un,HelpMd:un,NameSelect:Wn,NameSelectConditions:Gn,NameSelectOtherTriggers:Kn,EnumSelect:Jn,EnumSelectFunctions:Yn,EnumSelectRooms:Xn,TriggerStateId:class extends T{constructor(e){super(e),w(this,`shrinking`,!1),w(this,`previousObjectId`,``),w(this,`wasUserState`,null),this.state={...this.state,showSelectId:!1}}componentDidUpdate(){if(this.shrinking){this.shrinking=!1;return}let e=this.props.data,t=!!e.userState,n=this.props.attr||`stateId`,r=e[n],i=typeof r==`string`?r:``,{adapterName:a,instance:o}=this.props.oContext;if(this.wasUserState===null&&(this.wasUserState=t),t&&!this.wasUserState){this.wasUserState=!0,i.includes(`.`)&&(this.previousObjectId=i);let e=Zn(i,a,o);e!==i&&(this.shrinking=!0,this.onChange(n,e));return}if(!t&&this.wasUserState){this.wasUserState=!1,this.previousObjectId&&this.previousObjectId!==i&&(this.shrinking=!0,this.onChange(n,this.previousObjectId));return}if(this.wasUserState=t,!t)return;let s=Zn(i,a,o);s!==i&&(i.includes(`.`)&&(this.previousObjectId=i),this.shrinking=!0,this.onChange(n,s))}renderItem(){let e=this.props.data,t=this.props.attr||`stateId`,n=e[t],i=typeof n==`string`?n:``,{adapterName:a,instance:o,socket:s,theme:c,themeType:l,imagePrefix:u}=this.props.oContext,d=`${a}.${o}.userstates.`;if(e.userState){let e=Zn(i,a,o);return m(`div`,{children:[m(y,{variant:`caption`,color:`text.secondary`,sx:{display:`block`,lineHeight:1.2},children:[E(`sc_userstate_under`),` `,d,E(`sc_userstate_auto`)]}),r(g,{variant:`standard`,fullWidth:!0,size:`small`,value:e,placeholder:E(`sc_userstate_placeholder`),helperText:E(`sc_userstate_short`),onChange:e=>void this.onChange(t,e.target.value)})]})}return m(`div`,{style:{display:`flex`,alignItems:`flex-end`},children:[r(g,{variant:`standard`,fullWidth:!0,size:`small`,value:i,onChange:e=>void this.onChange(t,e.target.value)}),r(te,{color:`inherit`,size:`small`,variant:`outlined`,sx:{ml:.5,minWidth:40,maxHeight:32},onClick:()=>this.setState({showSelectId:!0}),children:`...`}),this.state.showSelectId?r(re,{imagePrefix:u??`../..`,dialogName:`admin.${a}`,themeType:l,theme:c,types:[`state`],socket:s,selected:i,onClose:()=>this.setState({showSelectId:!1}),onOk:e=>{let n=Array.isArray(e)?e[0]:e;this.setState({showSelectId:!1},()=>void this.onChange(t,n||``))}}):null]})}}};export{Qn as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{t as default}from"./Components-CDPYnOs-.js";
|
package/lib/tools.js
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
const axios = require('axios');
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Tests whether the given variable is a real object and not an Array
|
|
5
|
-
*
|
|
6
|
-
* @param {any} it The variable to test
|
|
7
|
-
* @returns {it is Record<string, any>}
|
|
8
|
-
*/
|
|
9
|
-
function isObject(it) {
|
|
10
|
-
// This is necessary because:
|
|
11
|
-
// typeof null === 'object'
|
|
12
|
-
// typeof [] === 'object'
|
|
13
|
-
// [] instanceof Object === true
|
|
14
|
-
return Object.prototype.toString.call(it) === '[object Object]';
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Tests whether the given variable is really an Array
|
|
19
|
-
*
|
|
20
|
-
* @param {any} it The variable to test
|
|
21
|
-
* @returns {it is any[]}
|
|
22
|
-
*/
|
|
23
|
-
function isArray(it) {
|
|
24
|
-
if (typeof Array.isArray === 'function') {
|
|
25
|
-
return Array.isArray(it);
|
|
26
|
-
}
|
|
27
|
-
return Object.prototype.toString.call(it) === '[object Array]';
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Translates text to the target language. Automatically chooses the right translation API.
|
|
32
|
-
*
|
|
33
|
-
* @param {string} text The text to translate
|
|
34
|
-
* @param {string} targetLang The target languate
|
|
35
|
-
* @param {string} [yandexApiKey] The yandex API key. You can create one for free at https://translate.yandex.com/developers
|
|
36
|
-
* @returns {Promise<string>}
|
|
37
|
-
*/
|
|
38
|
-
async function translateText(text, targetLang, yandexApiKey) {
|
|
39
|
-
if (targetLang === 'en') {
|
|
40
|
-
return text;
|
|
41
|
-
} else if (!text) {
|
|
42
|
-
return '';
|
|
43
|
-
}
|
|
44
|
-
if (yandexApiKey) {
|
|
45
|
-
return await translateYandex(text, targetLang, yandexApiKey);
|
|
46
|
-
}
|
|
47
|
-
return await translateGoogle(text, targetLang);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Translates text with Yandex API
|
|
52
|
-
*
|
|
53
|
-
* @param {string} text The text to translate
|
|
54
|
-
* @param {string} targetLang The target languate
|
|
55
|
-
* @param {string} [apiKey] The yandex API key. You can create one for free at https://translate.yandex.com/developers
|
|
56
|
-
* @returns {Promise<string>}
|
|
57
|
-
*/
|
|
58
|
-
async function translateYandex(text, targetLang, apiKey) {
|
|
59
|
-
if (targetLang === 'zh-cn') {
|
|
60
|
-
targetLang = 'zh';
|
|
61
|
-
}
|
|
62
|
-
try {
|
|
63
|
-
const url = `https://translate.yandex.net/api/v1.5/tr.json/translate?key=${apiKey}&text=${encodeURIComponent(text)}&lang=en-${targetLang}`;
|
|
64
|
-
const response = await axios({ url, timeout: 15000 });
|
|
65
|
-
if (response.data && response.data['text']) {
|
|
66
|
-
return response.data['text'][0];
|
|
67
|
-
}
|
|
68
|
-
throw new Error('Invalid response for translate request');
|
|
69
|
-
} catch (e) {
|
|
70
|
-
throw new Error(`Could not translate to "${targetLang}": ${e}`);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Translates text with Google API
|
|
76
|
-
*
|
|
77
|
-
* @param {string} text The text to translate
|
|
78
|
-
* @param {string} targetLang The target languate
|
|
79
|
-
* @returns {Promise<string>}
|
|
80
|
-
*/
|
|
81
|
-
async function translateGoogle(text, targetLang) {
|
|
82
|
-
try {
|
|
83
|
-
const url = `http://translate.googleapis.com/translate_a/single?client=gtx&sl=en&tl=${targetLang}&dt=t&q=${encodeURIComponent(text)}&ie=UTF-8&oe=UTF-8`;
|
|
84
|
-
const response = await axios({ url, timeout: 15000 });
|
|
85
|
-
if (isArray(response.data)) {
|
|
86
|
-
// we got a valid response
|
|
87
|
-
return response.data[0][0][0];
|
|
88
|
-
}
|
|
89
|
-
throw new Error('Invalid response for translate request');
|
|
90
|
-
} catch (e) {
|
|
91
|
-
throw new Error(`Could not translate to "${targetLang}": ${e}`);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
module.exports = {
|
|
96
|
-
isArray,
|
|
97
|
-
isObject,
|
|
98
|
-
translateText,
|
|
99
|
-
};
|