nodekit 0.2.0__py3-none-any.whl
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.
- nodekit/.DS_Store +0 -0
- nodekit/__init__.py +53 -0
- nodekit/_internal/__init__.py +0 -0
- nodekit/_internal/ops/__init__.py +0 -0
- nodekit/_internal/ops/build_site/__init__.py +117 -0
- nodekit/_internal/ops/build_site/harness.j2 +158 -0
- nodekit/_internal/ops/concat.py +51 -0
- nodekit/_internal/ops/open_asset_save_asset.py +125 -0
- nodekit/_internal/ops/play/__init__.py +4 -0
- nodekit/_internal/ops/play/local_runner/__init__.py +0 -0
- nodekit/_internal/ops/play/local_runner/main.py +234 -0
- nodekit/_internal/ops/play/local_runner/site-template.j2 +38 -0
- nodekit/_internal/ops/save_graph_load_graph.py +131 -0
- nodekit/_internal/ops/topological_sorting.py +122 -0
- nodekit/_internal/types/__init__.py +0 -0
- nodekit/_internal/types/actions/__init__.py +0 -0
- nodekit/_internal/types/actions/actions.py +89 -0
- nodekit/_internal/types/assets/__init__.py +151 -0
- nodekit/_internal/types/cards/__init__.py +85 -0
- nodekit/_internal/types/events/__init__.py +0 -0
- nodekit/_internal/types/events/events.py +145 -0
- nodekit/_internal/types/expressions/__init__.py +0 -0
- nodekit/_internal/types/expressions/expressions.py +242 -0
- nodekit/_internal/types/graph.py +42 -0
- nodekit/_internal/types/node.py +21 -0
- nodekit/_internal/types/regions/__init__.py +13 -0
- nodekit/_internal/types/sensors/__init__.py +0 -0
- nodekit/_internal/types/sensors/sensors.py +156 -0
- nodekit/_internal/types/trace.py +17 -0
- nodekit/_internal/types/transition.py +68 -0
- nodekit/_internal/types/value.py +145 -0
- nodekit/_internal/utils/__init__.py +0 -0
- nodekit/_internal/utils/get_browser_bundle.py +35 -0
- nodekit/_internal/utils/get_extension_from_media_type.py +15 -0
- nodekit/_internal/utils/hashing.py +46 -0
- nodekit/_internal/utils/iter_assets.py +61 -0
- nodekit/_internal/version.py +1 -0
- nodekit/_static/nodekit.css +10 -0
- nodekit/_static/nodekit.js +59 -0
- nodekit/actions/__init__.py +25 -0
- nodekit/assets/__init__.py +7 -0
- nodekit/cards/__init__.py +15 -0
- nodekit/events/__init__.py +30 -0
- nodekit/experimental/.DS_Store +0 -0
- nodekit/experimental/__init__.py +0 -0
- nodekit/experimental/recruitment_services/__init__.py +0 -0
- nodekit/experimental/recruitment_services/base.py +77 -0
- nodekit/experimental/recruitment_services/mechanical_turk/__init__.py +0 -0
- nodekit/experimental/recruitment_services/mechanical_turk/client.py +359 -0
- nodekit/experimental/recruitment_services/mechanical_turk/models.py +116 -0
- nodekit/experimental/s3.py +219 -0
- nodekit/experimental/turk_helper.py +223 -0
- nodekit/experimental/visualization/.DS_Store +0 -0
- nodekit/experimental/visualization/__init__.py +0 -0
- nodekit/experimental/visualization/pointer.py +443 -0
- nodekit/expressions/__init__.py +55 -0
- nodekit/sensors/__init__.py +25 -0
- nodekit/transitions/__init__.py +15 -0
- nodekit/values/__init__.py +63 -0
- nodekit-0.2.0.dist-info/METADATA +221 -0
- nodekit-0.2.0.dist-info/RECORD +62 -0
- nodekit-0.2.0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
var NodeKit=(function(_r){"use strict";class ga{constructor(){this.startTime=null}start(){this.startTime=performance.now()}now(){if(this.startTime===null)throw new Error("Clock has not been started. Call start() before calling convertToTimeElapsedMsec().");let e=performance.now()-this.startTime;return e=Math.round(e),e}checkClockStarted(){return this.startTime!==null}}function ma(r){return{event_type:"BrowserContextSampledEvent",t:r.now(),user_agent:navigator.userAgent,timestamp_client:new Date().toISOString(),device_pixel_ratio:window.devicePixelRatio,display:{width_px:screen.width,height_px:screen.height},viewport:{width_px:window.innerWidth,height_px:window.innerHeight}}}var ba="2.0.4",Tr=500,ps="user-agent",Vt="",gs="?",Dn="function",wt="undefined",zt="object",xr="string",Ne="browser",st="cpu",Ze="device",qe="engine",ze="os",Ht="result",v="name",m="type",y="vendor",S="version",Pe="architecture",rn="major",b="model",sn="console",W="mobile",he="tablet",ve="smarttv",Qe="wearable",Bn="xr",on="embedded",an="inapp",Rr="brands",Ot="formFactors",Ar="fullVersionList",Ft="platform",Cr="platformVersion",Un="bitness",Et="sec-ch-ua",wa=Et+"-full-version-list",Ea=Et+"-arch",ya=Et+"-"+Un,va=Et+"-form-factors",ka=Et+"-"+W,Sa=Et+"-"+b,ms=Et+"-"+Ft,_a=ms+"-version",bs=[Rr,Ar,W,b,Ft,Cr,Pe,Ot,Un],Vn="Amazon",qt="Apple",ws="ASUS",Es="BlackBerry",It="Google",ys="Huawei",Or="Lenovo",vs="Honor",zn="LG",Ir="Microsoft",Lr="Motorola",Nr="Nvidia",ks="OnePlus",Pr="OPPO",ln="Samsung",Ss="Sharp",cn="Sony",$r="Xiaomi",Mr="Zebra",_s="Chrome",Ts="Chromium",yt="Chromecast",Hn="Edge",un="Firefox",hn="Opera",Dr="Facebook",xs="Sogou",jt="Mobile ",dn=" Browser",Br="Windows",Ta=typeof window!==wt,$e=Ta&&window.navigator?window.navigator:void 0,vt=$e&&$e.userAgentData?$e.userAgentData:void 0,xa=function(r,e){var t={},n=e;if(!qn(e)){n={};for(var i in e)for(var o in e[i])n[o]=e[i][o].concat(n[o]?n[o]:[])}for(var s in r)t[s]=n[s]&&n[s].length%2===0?n[s].concat(r[s]):r[s];return t},Fn=function(r){for(var e={},t=0;t<r.length;t++)e[r[t].toUpperCase()]=r[t];return e},Ur=function(r,e){if(typeof r===zt&&r.length>0){for(var t in r)if(ot(e)==ot(r[t]))return!0;return!1}return Gt(r)?ot(e)==ot(r):!1},qn=function(r,e){for(var t in r)return/^(browser|cpu|device|engine|os)$/.test(t)||(e?qn(r[t]):!1)},Gt=function(r){return typeof r===xr},Vr=function(r){if(r){for(var e=[],t=Wt(/\\?\"/g,r).split(","),n=0;n<t.length;n++)if(t[n].indexOf(";")>-1){var i=jn(t[n]).split(";v=");e[n]={brand:i[0],version:i[1]}}else e[n]=jn(t[n]);return e}},ot=function(r){return Gt(r)?r.toLowerCase():r},zr=function(r){return Gt(r)?Wt(/[^\d\.]/g,r).split(".")[0]:void 0},at=function(r){for(var e in r){var t=r[e];typeof t==zt&&t.length==2?this[t[0]]=t[1]:this[t]=void 0}return this},Wt=function(r,e){return Gt(e)?e.replace(r,Vt):e},fn=function(r){return Wt(/\\?\"/g,r)},jn=function(r,e){if(Gt(r))return r=Wt(/^\s\s*/,r),typeof e===wt?r:r.substring(0,Tr)},Hr=function(r,e){if(!(!r||!e))for(var t=0,n,i,o,s,a,l;t<e.length&&!a;){var c=e[t],u=e[t+1];for(n=i=0;n<c.length&&!a&&c[n];)if(a=c[n++].exec(r),a)for(o=0;o<u.length;o++)l=a[++i],s=u[o],typeof s===zt&&s.length>0?s.length===2?typeof s[1]==Dn?this[s[0]]=s[1].call(this,l):this[s[0]]=s[1]:s.length>=3&&(typeof s[1]===Dn&&!(s[1].exec&&s[1].test)?s.length>3?this[s[0]]=l?s[1].apply(this,s.slice(2)):void 0:this[s[0]]=l?s[1].call(this,l,s[2]):void 0:s.length==3?this[s[0]]=l?l.replace(s[1],s[2]):void 0:s.length==4?this[s[0]]=l?s[3].call(this,l.replace(s[1],s[2])):void 0:s.length>4&&(this[s[0]]=l?s[3].apply(this,[l.replace(s[1],s[2])].concat(s.slice(4))):void 0)):this[s]=l||void 0;t+=2}},Je=function(r,e){for(var t in e)if(typeof e[t]===zt&&e[t].length>0){for(var n=0;n<e[t].length;n++)if(Ur(e[t][n],r))return t===gs?void 0:t}else if(Ur(e[t],r))return t===gs?void 0:t;return e.hasOwnProperty("*")?e["*"]:r},Rs={ME:"4.90","NT 3.51":"3.51","NT 4.0":"4.0",2e3:["5.0","5.01"],XP:["5.1","5.2"],Vista:"6.0",7:"6.1",8:"6.2","8.1":"6.3",10:["6.4","10.0"],NT:""},As={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},Ra={Chrome:"Google Chrome",Edge:"Microsoft Edge","Edge WebView2":"Microsoft Edge WebView2","Chrome WebView":"Android WebView","Chrome Headless":"HeadlessChrome","Huawei Browser":"HuaweiBrowser","MIUI Browser":"Miui Browser","Opera Mobi":"OperaMobile",Yandex:"YaBrowser"},Cs={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[S,[v,jt+"Chrome"]],[/webview.+edge\/([\w\.]+)/i],[S,[v,Hn+" WebView"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[S,[v,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[v,S],[/opios[\/ ]+([\w\.]+)/i],[S,[v,hn+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[S,[v,hn+" GX"]],[/\bopr\/([\w\.]+)/i],[S,[v,hn]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[S,[v,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[S,[v,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon|otter|dooble|(?:lg |qute)browser)\/([-\w\.]+)/i,/(heytap|ovi|115|surf)browser\/([\d\.]+)/i,/(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i],[v,S],[/quark(?:pc)?\/([-\w\.]+)/i],[S,[v,"Quark"]],[/\bddg\/([\w\.]+)/i],[S,[v,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[S,[v,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[S,[v,"WeChat"]],[/konqueror\/([\w\.]+)/i],[S,[v,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[S,[v,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[S,[v,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[S,[v,"Smart "+Or+dn]],[/(avast|avg)\/([\w\.]+)/i],[[v,/(.+)/,"$1 Secure"+dn],S],[/\bfocus\/([\w\.]+)/i],[S,[v,un+" Focus"]],[/\bopt\/([\w\.]+)/i],[S,[v,hn+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[S,[v,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[S,[v,"Dolphin"]],[/coast\/([\w\.]+)/i],[S,[v,hn+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[S,[v,"MIUI"+dn]],[/fxios\/([\w\.-]+)/i],[S,[v,jt+un]],[/\bqihoobrowser\/?([\w\.]*)/i],[S,[v,"360"]],[/\b(qq)\/([\w\.]+)/i],[[v,/(.+)/,"$1Browser"],S],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[v,/(.+)/,"$1"+dn],S],[/samsungbrowser\/([\w\.]+)/i],[S,[v,ln+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[S,[v,xs+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[v,xs+" Mobile"],S],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[v,S],[/(lbbrowser|rekonq)/i],[v],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[S,v],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[v,Dr],S,[m,an]],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(instagram|snapchat|klarna)[\/ ]([-\w\.]+)/i],[v,S,[m,an]],[/\bgsa\/([\w\.]+) .*safari\//i],[S,[v,"GSA"],[m,an]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[S,[v,"TikTok"],[m,an]],[/\[(linkedin)app\]/i],[v,[m,an]],[/(chromium)[\/ ]([-\w\.]+)/i],[v,S],[/headlesschrome(?:\/([\w\.]+)| )/i],[S,[v,_s+" Headless"]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[S,[v,Hn+" WebView2"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[v,_s+" WebView"],S],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[S,[v,"Android"+dn]],[/chrome\/([\w\.]+) mobile/i],[S,[v,jt+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[v,S],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[S,[v,jt+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[v,jt+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[S,v],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[v,[S,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[v,S],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[v,jt+un],S],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[v,"Netscape"],S],[/(wolvic|librewolf)\/([\w\.]+)/i],[v,S],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[S,[v,un+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[v,[S,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[v,[S,/[^\d\.]+./,Vt]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[Pe,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[Pe,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[Pe,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[Pe,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[Pe,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[Pe,/ower/,Vt,ot]],[/ sun4\w[;\)]/i],[[Pe,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[Pe,ot]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[b,[y,ln],[m,he]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr]|browser)[-\w]+)/i,/sec-(sgh\w+)/i],[b,[y,ln],[m,W]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[b,[y,qt],[m,W]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[b,[y,qt],[m,he]],[/(macintosh);/i],[b,[y,qt]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[b,[y,Ss],[m,W]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[b,[y,vs],[m,he]],[/honor([-\w ]+)[;\)]/i],[b,[y,vs],[m,W]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[b,[y,ys],[m,he]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[b,[y,ys],[m,W]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[b,/_/g," "],[y,$r],[m,he]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[b,/_/g," "],[y,$r],[m,W]],[/droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-k]\w[1m]10)\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[b,[y,ks],[m,W]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[b,[y,Pr],[m,W]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[b,[y,Je,{OnePlus:["203","304","403","404","413","415"],"*":Pr}],[m,he]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[b,[y,"BLU"],[m,W]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[b,[y,"Vivo"],[m,W]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[b,[y,"Realme"],[m,W]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[b,[y,Or],[m,he]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[b,[y,Or],[m,W]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ]([\w\s]+)(\)| bui)/i,/((?:moto(?! 360)[-\w\(\) ]+|xt\d{3,4}[cgkosw\+]?[-\d]*|nexus 6)(?= bui|\)))/i],[b,[y,Lr],[m,W]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[b,[y,Lr],[m,he]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[b,[y,zn],[m,he]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,/\blg-?([\d\w]+) bui/i],[b,[y,zn],[m,W]],[/(nokia) (t[12][01])/i],[y,b,[m,he]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[b,/_/g," "],[m,W],[y,"Nokia"]],[/(pixel (c|tablet))\b/i],[b,[y,It],[m,he]],[/droid.+;(?: google)? (g(01[13]a|020[aem]|025[jn]|1b60|1f8f|2ybb|4s1m|576d|5nz6|8hhn|8vou|a02099|c15s|d1yq|e2ae|ec77|gh2x|kv4x|p4bc|pj41|r83y|tt9q|ur25|wvk6)|pixel[\d ]*a?( pro)?( xl)?( fold)?( \(5g\))?)( bui|\))/i],[b,[y,It],[m,W]],[/(google) (pixelbook( go)?)/i],[y,b],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-\w\w\d\d)(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[b,[y,cn],[m,W]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[b,"Xperia Tablet"],[y,cn],[m,he]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[b,[y,Vn],[m,he]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[b,/(.+)/g,"Fire Phone $1"],[y,Vn],[m,W]],[/(playbook);[-\w\),; ]+(rim)/i],[b,y,[m,he]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[b,[y,Es],[m,W]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[b,[y,ws],[m,he]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[b,[y,ws],[m,W]],[/(nexus 9)/i],[b,[y,"HTC"],[m,he]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[y,[b,/_/g," "],[m,W]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[b,[y,"TCL"],[m,he]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[b,[y,"TCL"],[m,W]],[/(itel) ((\w+))/i],[[y,ot],b,[m,Je,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[b,[y,"Acer"],[m,he]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[b,[y,"Meizu"],[m,W]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[b,[y,"Ulefone"],[m,W]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[b,[y,"Energizer"],[m,W]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[b,[y,"Cat"],[m,W]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[b,[y,"Smartfren"],[m,W]],[/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i],[b,[y,"Nothing"],[m,W]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[b,[y,"Archos"],[m,he]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[b,[y,"Archos"],[m,W]],[/; (n159v)/i],[b,[y,"HMD"],[m,W]],[/(imo) (tab \w+)/i,/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i],[y,b,[m,he]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (blu|hmd|imo|infinix|lava|oneplus|tcl)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(oppo) ?([\w ]+) bui/i],[y,b,[m,W]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[y,b,[m,he]],[/(surface duo)/i],[b,[y,Ir],[m,he]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[b,[y,"Fairphone"],[m,W]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[b,[y,Nr],[m,he]],[/(sprint) (\w+)/i],[y,b,[m,W]],[/(kin\.[onetw]{3})/i],[[b,/\./g," "],[y,Ir],[m,W]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[b,[y,Mr],[m,he]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[b,[y,Mr],[m,W]],[/smart-tv.+(samsung)/i],[y,[m,ve]],[/hbbtv.+maple;(\d+)/i],[[b,/^/,"SmartTV"],[y,ln],[m,ve]],[/(vizio)(?: |.+model\/)(\w+-\w+)/i,/tcast.+(lg)e?. ([-\w]+)/i],[y,b,[m,ve]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[y,zn],[m,ve]],[/(apple) ?tv/i],[y,[b,qt+" TV"],[m,ve]],[/crkey.*devicetype\/chromecast/i],[[b,yt+" Third Generation"],[y,It],[m,ve]],[/crkey.*devicetype\/([^/]*)/i],[[b,/^/,"Chromecast "],[y,It],[m,ve]],[/fuchsia.*crkey/i],[[b,yt+" Nest Hub"],[y,It],[m,ve]],[/crkey/i],[[b,yt],[y,It],[m,ve]],[/(portaltv)/i],[b,[y,Dr],[m,ve]],[/droid.+aft(\w+)( bui|\))/i],[b,[y,Vn],[m,ve]],[/(shield \w+ tv)/i],[b,[y,Nr],[m,ve]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[b,[y,Ss],[m,ve]],[/(bravia[\w ]+)( bui|\))/i],[b,[y,cn],[m,ve]],[/(mi(tv|box)-?\w+) bui/i],[b,[y,$r],[m,ve]],[/Hbbtv.*(technisat) (.*);/i],[y,b,[m,ve]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[y,/.+\/(\w+)/,"$1",Je,{LG:"lge"}],[b,jn],[m,ve]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[b,[m,ve]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:|large screen[\w ]+safari)\b/i],[[m,ve]],[/(playstation \w+)/i],[b,[y,cn],[m,sn]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[b,[y,Ir],[m,sn]],[/(ouya)/i,/(nintendo) (\w+)/i,/(retroid) (pocket ([^\)]+))/i],[y,b,[m,sn]],[/droid.+; (shield)( bui|\))/i],[b,[y,Nr],[m,sn]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[b,[y,ln],[m,Qe]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[y,b,[m,Qe]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[b,[y,Pr],[m,Qe]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[b,[y,qt],[m,Qe]],[/(opwwe\d{3})/i],[b,[y,ks],[m,Qe]],[/(moto 360)/i],[b,[y,Lr],[m,Qe]],[/(smartwatch 3)/i],[b,[y,cn],[m,Qe]],[/(g watch r)/i],[b,[y,zn],[m,Qe]],[/droid.+; (wt63?0{2,3})\)/i],[b,[y,Mr],[m,Qe]],[/droid.+; (glass) \d/i],[b,[y,It],[m,Bn]],[/(pico) (4|neo3(?: link|pro)?)/i],[y,b,[m,Bn]],[/(quest( \d| pro)?s?).+vr/i],[b,[y,Dr],[m,Bn]],[/mobile vr; rv.+firefox/i],[[m,Bn]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[y,[m,on]],[/(aeobc)\b/i],[b,[y,Vn],[m,on]],[/(homepod).+mac os/i],[b,[y,qt],[m,on]],[/windows iot/i],[[m,on]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i],[b,[m,Je,{mobile:"Mobile",xr:"VR","*":he}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[m,he]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[m,W]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[b,[y,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[S,[v,Hn+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[v,S],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[S,[v,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[v,S],[/ladybird\//i],[[v,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[S,v]],os:[[/(windows nt) (6\.[23]); arm/i],[[v,/N/,"R"],[S,Je,Rs]],[/(windows (?:phone|mobile|iot))(?: os)?[\/ ]?([\d\.]*( se)?)/i,/(windows)[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i],[v,S],[/windows nt ?([\d\.\)]*)(?!.+xbox)/i,/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i],[[S,/(;|\))/g,"",Je,Rs],[v,Br]],[/(windows ce)\/?([\d\.]*)/i],[v,S],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[S,/_/g,"."],[v,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i],[[v,"macOS"],[S,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[S,[v,yt+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[S,[v,yt+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[S,[v,yt+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[S,[v,yt+" Linux"]],[/crkey\/([\d\.]+)/i],[S,[v,yt]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[S,v],[/(ubuntu) ([\w\.]+) like android/i],[[v,/(.+)/,"$1 Touch"],S],[/(harmonyos)[\/ ]?([\d\.]*)/i,/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i],[v,S],[/\(bb(10);/i],[S,[v,Es]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[S,[v,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[S,[v,un+" OS"]],[/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i],[S,[v,"webOS"]],[/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i],[[S,Je,{25:"120",24:"108",23:"94",22:"87",6:"79",5:"68",4:"53",3:"38",2:"538",1:"537","*":"TV"}],[v,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[S,[v,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[v,"Chrome OS"],S],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/linux.+(mint)[\/\(\) ]?([\w\.]*)/i,/(mageia|vectorlinux|fuchsia|arcaos|arch(?= ?linux))[;l ]([\d\.]*)/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire|knoppix)(?: gnu[\/ ]linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/\b(aix)[; ]([1-9\.]{0,4})/i,/(hurd|linux|morphos)(?: (?:arm|x86|ppc)\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) ?(r\d)?/i],[v,S],[/(sunos) ?([\d\.]*)/i],[[v,"Solaris"],S],[/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[v,S]]},Gn=(function(){var r={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return at.call(r.init,[[Ne,[v,S,rn,m]],[st,[Pe]],[Ze,[m,b,y]],[qe,[v,S]],[ze,[v,S]]]),at.call(r.isIgnore,[[Ne,[S,rn]],[qe,[S]],[ze,[S]]]),at.call(r.isIgnoreRgx,[[Ne,/ ?browser$/i],[ze,/ ?os$/i]]),at.call(r.toString,[[Ne,[v,S]],[st,[Pe]],[Ze,[y,b]],[qe,[v,S]],[ze,[v,S]]]),r})(),Aa=function(r,e){var t=Gn.init[e],n=Gn.isIgnore[e]||0,i=Gn.isIgnoreRgx[e]||0,o=Gn.toString[e]||0;function s(){at.call(this,t)}return s.prototype.getItem=function(){return r},s.prototype.withClientHints=function(){return vt?vt.getHighEntropyValues(bs).then(function(a){return r.setCH(new Os(a,!1)).parseCH().get()}):r.parseCH().get()},s.prototype.withFeatureCheck=function(){return r.detectFeature().get()},e!=Ht&&(s.prototype.is=function(a){var l=!1;for(var c in this)if(this.hasOwnProperty(c)&&!Ur(n,c)&&ot(i?Wt(i,this[c]):this[c])==ot(i?Wt(i,a):a)){if(l=!0,a!=wt)break}else if(a==wt&&l){l=!l;break}return l},s.prototype.toString=function(){var a=Vt;for(var l in o)typeof this[o[l]]!==wt&&(a+=(a?" ":Vt)+this[o[l]]);return a||wt}),vt||(s.prototype.then=function(a){var l=this,c=function(){for(var f in l)l.hasOwnProperty(f)&&(this[f]=l[f])};c.prototype={is:s.prototype.is,toString:s.prototype.toString};var u=new c;return a(u),u}),new s};function Os(r,e){if(r=r||{},at.call(this,bs),e)at.call(this,[[Rr,Vr(r[Et])],[Ar,Vr(r[wa])],[W,/\?1/.test(r[ka])],[b,fn(r[Sa])],[Ft,fn(r[ms])],[Cr,fn(r[_a])],[Pe,fn(r[Ea])],[Ot,Vr(r[va])],[Un,fn(r[ya])]]);else for(var t in r)this.hasOwnProperty(t)&&typeof r[t]!==wt&&(this[t]=r[t])}function Is(r,e,t,n){return this.get=function(i){return i?this.data.hasOwnProperty(i)?this.data[i]:void 0:this.data},this.set=function(i,o){return this.data[i]=o,this},this.setCH=function(i){return this.uaCH=i,this},this.detectFeature=function(){if($e&&$e.userAgent==this.ua)switch(this.itemType){case Ne:$e.brave&&typeof $e.brave.isBrave==Dn&&this.set(v,"Brave");break;case Ze:!this.get(m)&&vt&&vt[W]&&this.set(m,W),this.get(b)=="Macintosh"&&$e&&typeof $e.standalone!==wt&&$e.maxTouchPoints&&$e.maxTouchPoints>2&&this.set(b,"iPad").set(m,he);break;case ze:!this.get(v)&&vt&&vt[Ft]&&this.set(v,vt[Ft]);break;case Ht:var i=this.data,o=function(s){return i[s].getItem().detectFeature().get()};this.set(Ne,o(Ne)).set(st,o(st)).set(Ze,o(Ze)).set(qe,o(qe)).set(ze,o(ze))}return this},this.parseUA=function(){return this.itemType!=Ht&&Hr.call(this.data,this.ua,this.rgxMap),this.itemType==Ne&&this.set(rn,zr(this.get(S))),this},this.parseCH=function(){var i=this.uaCH,o=this.rgxMap;switch(this.itemType){case Ne:case qe:var s=i[Ar]||i[Rr],a;if(s)for(var l in s){var c=s[l].brand||s[l],u=s[l].version;this.itemType==Ne&&!/not.a.brand/i.test(c)&&(!a||/Chrom/.test(a)&&c!=Ts||a==Hn&&/WebView2/.test(c))&&(c=Je(c,Ra),a=this.get(v),a&&!/Chrom/.test(a)&&/Chrom/.test(c)||this.set(v,c).set(S,u).set(rn,zr(u)),a=c),this.itemType==qe&&c==Ts&&this.set(S,u)}break;case st:var f=i[Pe];f&&(f&&i[Un]=="64"&&(f+="64"),Hr.call(this.data,f+";",o));break;case Ze:if(i[W]&&this.set(m,W),i[b]&&(this.set(b,i[b]),!this.get(m)||!this.get(y))){var p={};Hr.call(p,"droid 9; "+i[b]+")",o),!this.get(m)&&p.type&&this.set(m,p.type),!this.get(y)&&p.vendor&&this.set(y,p.vendor)}if(i[Ot]){var E;if(typeof i[Ot]!="string")for(var T=0;!E&&T<i[Ot].length;)E=Je(i[Ot][T++],As);else E=Je(i[Ot],As);this.set(m,E)}break;case ze:var w=i[Ft];if(w){var V=i[Cr];w==Br&&(V=parseInt(zr(V),10)>=13?"11":"10"),this.set(v,w).set(S,V)}this.get(v)==Br&&i[b]=="Xbox"&&this.set(v,"Xbox").set(S,void 0);break;case Ht:var Z=this.data,ie=function(Q){return Z[Q].getItem().setCH(i).parseCH().get()};this.set(Ne,ie(Ne)).set(st,ie(st)).set(Ze,ie(Ze)).set(qe,ie(qe)).set(ze,ie(ze))}return this},at.call(this,[["itemType",r],["ua",e],["uaCH",n],["rgxMap",t],["data",Aa(this,r)]]),this}function lt(r,e,t){if(typeof r===zt?(qn(r,!0)?(typeof e===zt&&(t=e),e=r):(t=r,e=void 0),r=void 0):typeof r===xr&&!qn(e,!0)&&(t=e,e=void 0),t&&typeof t.append===Dn){var n={};t.forEach(function(l,c){n[c]=l}),t=n}if(!(this instanceof lt))return new lt(r,e,t).getResult();var i=typeof r===xr?r:t&&t[ps]?t[ps]:$e&&$e.userAgent?$e.userAgent:Vt,o=new Os(t,!0),s=e?xa(Cs,e):Cs,a=function(l){return l==Ht?function(){return new Is(l,i,s,o).set("ua",i).set(Ne,this.getBrowser()).set(st,this.getCPU()).set(Ze,this.getDevice()).set(qe,this.getEngine()).set(ze,this.getOS()).get()}:function(){return new Is(l,i,s[l],o).parseUA().get()}};return at.call(this,[["getBrowser",a(Ne)],["getCPU",a(st)],["getDevice",a(Ze)],["getEngine",a(qe)],["getOS",a(ze)],["getResult",a(Ht)],["getUA",function(){return i}],["setUA",function(l){return Gt(l)&&(i=l.length>Tr?jn(l,Tr):l),this}]]).setUA(i),this}lt.VERSION=ba,lt.BROWSER=Fn([v,S,rn,m]),lt.CPU=Fn([Pe]),lt.DEVICE=Fn([b,y,m,sn,W,ve,he,Qe,on]),lt.ENGINE=lt.OS=Fn([v,S]);function Ca(){return!new lt().getDevice().type}function Oa(){const r=document.createElement("div");r.classList.add("nodekit-container"),document.body.appendChild(r);const e=document.createElement("div");return e.classList.add("nodekit-content"),r.appendChild(e),e}class Ia{resolveAssetUrl(e){if(e.locator.locator_type=="URL")return e.locator.url;if(e.locator.locator_type=="RelativePath"){let t=document.baseURI;const n=e.locator.relative_path.replace(/\\/g,"/"),o=t.includes("amazonaws.com")?n.split("/").map(s=>encodeURIComponent(s)).join("/"):n;return new URL(o,t).toString()}throw new Error("Unsupported locator for the browser environment. Found:"+JSON.stringify(e))}async getImageElement(e){let t=this.resolveAssetUrl(e),n=new Image;return n.src=t,new Promise((i,o)=>{n.onload=()=>i(n),n.onerror=s=>o(new Error(`Failed to load image ${t}: ${s}`))})}async getVideoElement(e){let t=this.resolveAssetUrl(e),n=document.createElement("video");n.controls=!1;let i=new Promise((o,s)=>{n.oncanplaythrough=()=>{o(n)},n.onerror=a=>s(a)});return n.src=t,n.load(),i}}class je{constructor(){this._listenerRegistry=[]}mount(e){e.appendChild(this.root)}disable(e="dimmed"){switch(this.root.setAttribute("disabled","true"),this.root.style.pointerEvents="none",this.root.style.userSelect="none",e){case"invisible":this.root.style.opacity="0";break;case"dimmed":this.root.style.opacity="0.3";break;case"visible":this.root.style.opacity="1";break}}enable(){this.root.removeAttribute("disabled"),this.root.style.pointerEvents="",this.root.style.userSelect="",this.root.style.opacity=""}destroy(){for(const e of this._findChildrenComponents())e.destroy();this.root.remove(),this.removeAllEventListeners()}_registerEventListener(e,t,n,i){e.addEventListener(t,n,i),this._listenerRegistry.push({type:t,handler:n,options:i})}_findChildrenComponents(){const e=[];for(const t of Object.keys(this)){const n=this[t];n instanceof je?e.push(n):Array.isArray(n)&&n.every(i=>i instanceof je)&&e.push(...n)}return e}removeAllEventListeners(){for(const{type:e,handler:t,options:n}of this._listenerRegistry)this.root.removeEventListener(e,t,n);this._listenerRegistry=[];for(const e of this._findChildrenComponents())e.removeAllEventListeners()}}class La extends je{constructor(e){switch(super(),this.root=document.createElement("div"),this.root.className="progress-bar",this.progressBarDiv=document.createElement("div"),this.progressBarDiv.className="progress-bar__inner",this.root.appendChild(this.progressBarDiv),e){case"cognition":this.progressBarDiv.classList.add("progress-bar__inner--cognition");break;case"system":this.progressBarDiv.classList.add("progress-bar__inner--system");break;default:throw new Error(`Unknown progress bar type: ${e}`)}}setProgress(e){const t=Math.round(Math.min(Math.max(e,0),100));this.progressBarDiv.style.width=`${t}%`}}class Wn extends je{constructor(e){super(),this.root=document.createElement("div"),this.root.classList.add("overlay"),this.root.id=e}setVisibility(e){e?this.root.classList.add("overlay--visible-state"):this.root.classList.remove("overlay--visible-state")}}class Na extends je{constructor(){super(),this.spinnerFrames=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],this.spinnerInterval=null,this.frameIndex=0,this.root=document.createElement("span"),this.root.style.paddingRight="0.5rem",this.root.textContent=this.spinnerFrames[this.frameIndex]}startSpinning(){this.frameIndex=0,this.spinnerInterval=window.setInterval(()=>{this.root.textContent=this.spinnerFrames[this.frameIndex++%this.spinnerFrames.length]},100)}stopSpinning(){this.spinnerInterval!==null&&(clearInterval(this.spinnerInterval),this.spinnerInterval=null)}}class Pa extends Wn{constructor(){super("session-connecting-overlay"),this.displayTimeout=null;const e=document.createElement("div");e.classList.add("connecting-message-box"),this.root.appendChild(e),this.spinner=new Na,this.spinner.mount(e);const t=document.createElement("div");t.classList.add("connecting-message-box__text"),t.textContent="Connecting...",e.appendChild(t)}show(e){this.displayTimeout=window.setTimeout(()=>{this.spinner.startSpinning(),super.setVisibility(!0)},e)}hide(){this.displayTimeout!==null&&(clearTimeout(this.displayTimeout),this.displayTimeout=null),this.spinner.stopSpinning(),super.setVisibility(!1)}}function $a(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Fr,Ls;function Ma(){if(Ls)return Fr;Ls=1;function r(h){return h instanceof Map?h.clear=h.delete=h.set=function(){throw new Error("map is read-only")}:h instanceof Set&&(h.add=h.clear=h.delete=function(){throw new Error("set is read-only")}),Object.freeze(h),Object.getOwnPropertyNames(h).forEach(g=>{const x=h[g],j=typeof x;(j==="object"||j==="function")&&!Object.isFrozen(x)&&r(x)}),h}class e{constructor(g){g.data===void 0&&(g.data={}),this.data=g.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function t(h){return h.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function n(h,...g){const x=Object.create(null);for(const j in h)x[j]=h[j];return g.forEach(function(j){for(const we in j)x[we]=j[we]}),x}const i="</span>",o=h=>!!h.scope,s=(h,{prefix:g})=>{if(h.startsWith("language:"))return h.replace("language:","language-");if(h.includes(".")){const x=h.split(".");return[`${g}${x.shift()}`,...x.map((j,we)=>`${j}${"_".repeat(we+1)}`)].join(" ")}return`${g}${h}`};class a{constructor(g,x){this.buffer="",this.classPrefix=x.classPrefix,g.walk(this)}addText(g){this.buffer+=t(g)}openNode(g){if(!o(g))return;const x=s(g.scope,{prefix:this.classPrefix});this.span(x)}closeNode(g){o(g)&&(this.buffer+=i)}value(){return this.buffer}span(g){this.buffer+=`<span class="${g}">`}}const l=(h={})=>{const g={children:[]};return Object.assign(g,h),g};class c{constructor(){this.rootNode=l(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(g){this.top.children.push(g)}openNode(g){const x=l({scope:g});this.add(x),this.stack.push(x)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(g){return this.constructor._walk(g,this.rootNode)}static _walk(g,x){return typeof x=="string"?g.addText(x):x.children&&(g.openNode(x),x.children.forEach(j=>this._walk(g,j)),g.closeNode(x)),g}static _collapse(g){typeof g!="string"&&g.children&&(g.children.every(x=>typeof x=="string")?g.children=[g.children.join("")]:g.children.forEach(x=>{c._collapse(x)}))}}class u extends c{constructor(g){super(),this.options=g}addText(g){g!==""&&this.add(g)}startScope(g){this.openNode(g)}endScope(){this.closeNode()}__addSublanguage(g,x){const j=g.root;x&&(j.scope=`language:${x}`),this.add(j)}toHTML(){return new a(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function f(h){return h?typeof h=="string"?h:h.source:null}function p(h){return w("(?=",h,")")}function E(h){return w("(?:",h,")*")}function T(h){return w("(?:",h,")?")}function w(...h){return h.map(x=>f(x)).join("")}function V(h){const g=h[h.length-1];return typeof g=="object"&&g.constructor===Object?(h.splice(h.length-1,1),g):{}}function Z(...h){return"("+(V(h).capture?"":"?:")+h.map(j=>f(j)).join("|")+")"}function ie(h){return new RegExp(h.toString()+"|").exec("").length-1}function Q(h,g){const x=h&&h.exec(g);return x&&x.index===0}const ne=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function pe(h,{joinWith:g}){let x=0;return h.map(j=>{x+=1;const we=x;let be=f(j),L="";for(;be.length>0;){const I=ne.exec(be);if(!I){L+=be;break}L+=be.substring(0,I.index),be=be.substring(I.index+I[0].length),I[0][0]==="\\"&&I[1]?L+="\\"+String(Number(I[1])+we):(L+=I[0],I[0]==="("&&x++)}return L}).map(j=>`(${j})`).join(g)}const se=/\b\B/,ae="[a-zA-Z]\\w*",F="[a-zA-Z_]\\w*",tt="\\b\\d+(\\.\\d+)?",kt="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Ee="\\b(0b[01]+)",ft="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",pt=(h={})=>{const g=/^#![ ]*\//;return h.binary&&(h.begin=w(g,/.*\b/,h.binary,/\b.*/)),n({scope:"meta",begin:g,end:/$/,relevance:0,"on:begin":(x,j)=>{x.index!==0&&j.ignoreMatch()}},h)},A={begin:"\\\\[\\s\\S]",relevance:0},R={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[A]},U={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[A]},N={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},$=function(h,g,x={}){const j=n({scope:"comment",begin:h,end:g,contains:[]},x);j.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const we=Z("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return j.contains.push({begin:w(/[ ]+/,"(",we,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),j},P=$("//","$"),q=$("/\\*","\\*/"),z=$("#","$"),Y={scope:"number",begin:tt,relevance:0},G={scope:"number",begin:kt,relevance:0},ke={scope:"number",begin:Ee,relevance:0},X={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[A,{begin:/\[/,end:/\]/,relevance:0,contains:[A]}]},Me={scope:"title",begin:ae,relevance:0},xn={scope:"title",begin:F,relevance:0},hr={begin:"\\.\\s*"+F,relevance:0};var Pt=Object.freeze({__proto__:null,APOS_STRING_MODE:R,BACKSLASH_ESCAPE:A,BINARY_NUMBER_MODE:ke,BINARY_NUMBER_RE:Ee,COMMENT:$,C_BLOCK_COMMENT_MODE:q,C_LINE_COMMENT_MODE:P,C_NUMBER_MODE:G,C_NUMBER_RE:kt,END_SAME_AS_BEGIN:function(h){return Object.assign(h,{"on:begin":(g,x)=>{x.data._beginMatch=g[1]},"on:end":(g,x)=>{x.data._beginMatch!==g[1]&&x.ignoreMatch()}})},HASH_COMMENT_MODE:z,IDENT_RE:ae,MATCH_NOTHING_RE:se,METHOD_GUARD:hr,NUMBER_MODE:Y,NUMBER_RE:tt,PHRASAL_WORDS_MODE:N,QUOTE_STRING_MODE:U,REGEXP_MODE:X,RE_STARTERS_RE:ft,SHEBANG:pt,TITLE_MODE:Me,UNDERSCORE_IDENT_RE:F,UNDERSCORE_TITLE_MODE:xn});function fr(h,g){h.input[h.index-1]==="."&&g.ignoreMatch()}function St(h,g){h.className!==void 0&&(h.scope=h.className,delete h.className)}function Yt(h,g){g&&h.beginKeywords&&(h.begin="\\b("+h.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",h.__beforeBegin=fr,h.keywords=h.keywords||h.beginKeywords,delete h.beginKeywords,h.relevance===void 0&&(h.relevance=0))}function gt(h,g){Array.isArray(h.illegal)&&(h.illegal=Z(...h.illegal))}function Rn(h,g){if(h.match){if(h.begin||h.end)throw new Error("begin & end are not supported with match");h.begin=h.match,delete h.match}}function An(h,g){h.relevance===void 0&&(h.relevance=1)}const _t=(h,g)=>{if(!h.beforeMatch)return;if(h.starts)throw new Error("beforeMatch cannot be used with starts");const x=Object.assign({},h);Object.keys(h).forEach(j=>{delete h[j]}),h.keywords=x.keywords,h.begin=w(x.beforeMatch,p(x.begin)),h.starts={relevance:0,contains:[Object.assign(x,{endsParent:!0})]},h.relevance=0,delete x.beforeMatch},Kt=["of","and","for","in","not","or","if","then","parent","list","value"],Zt="keyword";function Cn(h,g,x=Zt){const j=Object.create(null);return typeof h=="string"?we(x,h.split(" ")):Array.isArray(h)?we(x,h):Object.keys(h).forEach(function(be){Object.assign(j,Cn(h[be],g,be))}),j;function we(be,L){g&&(L=L.map(I=>I.toLowerCase())),L.forEach(function(I){const H=I.split("|");j[H[0]]=[be,pr(H[0],H[1])]})}}function pr(h,g){return g?Number(g):as(h)?0:1}function as(h){return Kt.includes(h.toLowerCase())}const Qt={},De=h=>{console.error(h)},mt=(h,...g)=>{console.log(`WARN: ${h}`,...g)},Be=(h,g)=>{Qt[`${h}/${g}`]||(console.log(`Deprecated as of ${h}. ${g}`),Qt[`${h}/${g}`]=!0)},$t=new Error;function On(h,g,{key:x}){let j=0;const we=h[x],be={},L={};for(let I=1;I<=g.length;I++)L[I+j]=we[I],be[I+j]=!0,j+=ie(g[I-1]);h[x]=L,h[x]._emit=be,h[x]._multi=!0}function gr(h){if(Array.isArray(h.begin)){if(h.skip||h.excludeBegin||h.returnBegin)throw De("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),$t;if(typeof h.beginScope!="object"||h.beginScope===null)throw De("beginScope must be object"),$t;On(h,h.begin,{key:"beginScope"}),h.begin=pe(h.begin,{joinWith:""})}}function In(h){if(Array.isArray(h.end)){if(h.skip||h.excludeEnd||h.returnEnd)throw De("skip, excludeEnd, returnEnd not compatible with endScope: {}"),$t;if(typeof h.endScope!="object"||h.endScope===null)throw De("endScope must be object"),$t;On(h,h.end,{key:"endScope"}),h.end=pe(h.end,{joinWith:""})}}function mr(h){h.scope&&typeof h.scope=="object"&&h.scope!==null&&(h.beginScope=h.scope,delete h.scope)}function Jt(h){mr(h),typeof h.beginScope=="string"&&(h.beginScope={_wrap:h.beginScope}),typeof h.endScope=="string"&&(h.endScope={_wrap:h.endScope}),gr(h),In(h)}function en(h){function g(L,I){return new RegExp(f(L),"m"+(h.case_insensitive?"i":"")+(h.unicodeRegex?"u":"")+(I?"g":""))}class x{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(I,H){H.position=this.position++,this.matchIndexes[this.matchAt]=H,this.regexes.push([H,I]),this.matchAt+=ie(I)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const I=this.regexes.map(H=>H[1]);this.matcherRe=g(pe(I,{joinWith:"|"}),!0),this.lastIndex=0}exec(I){this.matcherRe.lastIndex=this.lastIndex;const H=this.matcherRe.exec(I);if(!H)return null;const ce=H.findIndex((At,tn)=>tn>0&&At!==void 0),de=this.matchIndexes[ce];return H.splice(0,ce),Object.assign(H,de)}}class j{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(I){if(this.multiRegexes[I])return this.multiRegexes[I];const H=new x;return this.rules.slice(I).forEach(([ce,de])=>H.addRule(ce,de)),H.compile(),this.multiRegexes[I]=H,H}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(I,H){this.rules.push([I,H]),H.type==="begin"&&this.count++}exec(I){const H=this.getMatcher(this.regexIndex);H.lastIndex=this.lastIndex;let ce=H.exec(I);if(this.resumingScanAtSamePosition()&&!(ce&&ce.index===this.lastIndex)){const de=this.getMatcher(0);de.lastIndex=this.lastIndex+1,ce=de.exec(I)}return ce&&(this.regexIndex+=ce.position+1,this.regexIndex===this.count&&this.considerAll()),ce}}function we(L){const I=new j;return L.contains.forEach(H=>I.addRule(H.begin,{rule:H,type:"begin"})),L.terminatorEnd&&I.addRule(L.terminatorEnd,{type:"end"}),L.illegal&&I.addRule(L.illegal,{type:"illegal"}),I}function be(L,I){const H=L;if(L.isCompiled)return H;[St,Rn,Jt,_t].forEach(de=>de(L,I)),h.compilerExtensions.forEach(de=>de(L,I)),L.__beforeBegin=null,[Yt,gt,An].forEach(de=>de(L,I)),L.isCompiled=!0;let ce=null;return typeof L.keywords=="object"&&L.keywords.$pattern&&(L.keywords=Object.assign({},L.keywords),ce=L.keywords.$pattern,delete L.keywords.$pattern),ce=ce||/\w+/,L.keywords&&(L.keywords=Cn(L.keywords,h.case_insensitive)),H.keywordPatternRe=g(ce,!0),I&&(L.begin||(L.begin=/\B|\b/),H.beginRe=g(H.begin),!L.end&&!L.endsWithParent&&(L.end=/\B|\b/),L.end&&(H.endRe=g(H.end)),H.terminatorEnd=f(H.end)||"",L.endsWithParent&&I.terminatorEnd&&(H.terminatorEnd+=(L.end?"|":"")+I.terminatorEnd)),L.illegal&&(H.illegalRe=g(L.illegal)),L.contains||(L.contains=[]),L.contains=[].concat(...L.contains.map(function(de){return Tt(de==="self"?L:de)})),L.contains.forEach(function(de){be(de,H)}),L.starts&&be(L.starts,I),H.matcher=we(H),H}if(h.compilerExtensions||(h.compilerExtensions=[]),h.contains&&h.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return h.classNameAliases=n(h.classNameAliases||{}),be(h)}function Fe(h){return h?h.endsWithParent||Fe(h.starts):!1}function Tt(h){return h.variants&&!h.cachedVariants&&(h.cachedVariants=h.variants.map(function(g){return n(h,{variants:null},g)})),h.cachedVariants?h.cachedVariants:Fe(h)?n(h,{starts:h.starts?n(h.starts):null}):Object.isFrozen(h)?n(h):h}var Ln="11.11.1";class Nn extends Error{constructor(g,x){super(g),this.name="HTMLInjectionError",this.html=x}}const Pn=t,Mt=n,Dt=Symbol("nomatch"),ls=7,xt=function(h){const g=Object.create(null),x=Object.create(null),j=[];let we=!0;const be="Could not find the language '{}', did you forget to load/include a language module?",L={disableAutodetect:!0,name:"Plain text",contains:[]};let I={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:u};function H(k){return I.noHighlightRe.test(k)}function ce(k){let D=k.className+" ";D+=k.parentNode?k.parentNode.className:"";const ee=I.languageDetectRe.exec(D);if(ee){const ge=O(ee[1]);return ge||(mt(be.replace("{}",ee[1])),mt("Falling back to no-highlight mode for this block.",k)),ge?ee[1]:"no-highlight"}return D.split(/\s+/).find(ge=>H(ge)||O(ge))}function de(k,D,ee){let ge="",_e="";typeof D=="object"?(ge=k,ee=D.ignoreIllegals,_e=D.language):(Be("10.7.0","highlight(lang, code, ...args) has been deprecated."),Be("10.7.0",`Please use highlight(code, options) instead.
|
|
2
|
+
https://github.com/highlightjs/highlight.js/issues/2277`),_e=k,ge=D),ee===void 0&&(ee=!0);const Ke={code:ge,language:_e};nt("before:highlight",Ke);const Ct=Ke.result?Ke.result:At(Ke.language,Ke.code,ee);return Ct.code=Ke.code,nt("after:highlight",Ct),Ct}function At(k,D,ee,ge){const _e=Object.create(null);function Ke(C,B){return C.keywords[B]}function Ct(){if(!K.keywords){Te.addText(me);return}let C=0;K.keywordPatternRe.lastIndex=0;let B=K.keywordPatternRe.exec(me),J="";for(;B;){J+=me.substring(C,B.index);const ue=it.case_insensitive?B[0].toLowerCase():B[0],Re=Ke(K,ue);if(Re){const[bt,Qc]=Re;if(Te.addText(J),J="",_e[ue]=(_e[ue]||0)+1,_e[ue]<=ls&&(Sr+=Qc),bt.startsWith("_"))J+=B[0];else{const Jc=it.classNameAliases[bt]||bt;rt(B[0],Jc)}}else J+=B[0];C=K.keywordPatternRe.lastIndex,B=K.keywordPatternRe.exec(me)}J+=me.substring(C),Te.addText(J)}function vr(){if(me==="")return;let C=null;if(typeof K.subLanguage=="string"){if(!g[K.subLanguage]){Te.addText(me);return}C=At(K.subLanguage,me,!0,pa[K.subLanguage]),pa[K.subLanguage]=C._top}else C=Bt(me,K.subLanguage.length?K.subLanguage:null);K.relevance>0&&(Sr+=C.relevance),Te.__addSublanguage(C._emitter,C.language)}function Ve(){K.subLanguage!=null?vr():Ct(),me=""}function rt(C,B){C!==""&&(Te.startScope(B),Te.addText(C),Te.endScope())}function ua(C,B){let J=1;const ue=B.length-1;for(;J<=ue;){if(!C._emit[J]){J++;continue}const Re=it.classNameAliases[C[J]]||C[J],bt=B[J];Re?rt(bt,Re):(me=bt,Ct(),me=""),J++}}function ha(C,B){return C.scope&&typeof C.scope=="string"&&Te.openNode(it.classNameAliases[C.scope]||C.scope),C.beginScope&&(C.beginScope._wrap?(rt(me,it.classNameAliases[C.beginScope._wrap]||C.beginScope._wrap),me=""):C.beginScope._multi&&(ua(C.beginScope,B),me="")),K=Object.create(C,{parent:{value:K}}),K}function da(C,B,J){let ue=Q(C.endRe,J);if(ue){if(C["on:end"]){const Re=new e(C);C["on:end"](B,Re),Re.isMatchIgnored&&(ue=!1)}if(ue){for(;C.endsParent&&C.parent;)C=C.parent;return C}}if(C.endsWithParent)return da(C.parent,B,J)}function Wc(C){return K.matcher.regexIndex===0?(me+=C[0],1):(hs=!0,0)}function Xc(C){const B=C[0],J=C.rule,ue=new e(J),Re=[J.__beforeBegin,J["on:begin"]];for(const bt of Re)if(bt&&(bt(C,ue),ue.isMatchIgnored))return Wc(B);return J.skip?me+=B:(J.excludeBegin&&(me+=B),Ve(),!J.returnBegin&&!J.excludeBegin&&(me=B)),ha(J,C),J.returnBegin?0:B.length}function Yc(C){const B=C[0],J=D.substring(C.index),ue=da(K,C,J);if(!ue)return Dt;const Re=K;K.endScope&&K.endScope._wrap?(Ve(),rt(B,K.endScope._wrap)):K.endScope&&K.endScope._multi?(Ve(),ua(K.endScope,C)):Re.skip?me+=B:(Re.returnEnd||Re.excludeEnd||(me+=B),Ve(),Re.excludeEnd&&(me=B));do K.scope&&Te.closeNode(),!K.skip&&!K.subLanguage&&(Sr+=K.relevance),K=K.parent;while(K!==ue.parent);return ue.starts&&ha(ue.starts,C),Re.returnEnd?0:B.length}function Kc(){const C=[];for(let B=K;B!==it;B=B.parent)B.scope&&C.unshift(B.scope);C.forEach(B=>Te.openNode(B))}let kr={};function fa(C,B){const J=B&&B[0];if(me+=C,J==null)return Ve(),0;if(kr.type==="begin"&&B.type==="end"&&kr.index===B.index&&J===""){if(me+=D.slice(B.index,B.index+1),!we){const ue=new Error(`0 width match regex (${k})`);throw ue.languageName=k,ue.badRule=kr.rule,ue}return 1}if(kr=B,B.type==="begin")return Xc(B);if(B.type==="illegal"&&!ee){const ue=new Error('Illegal lexeme "'+J+'" for mode "'+(K.scope||"<unnamed>")+'"');throw ue.mode=K,ue}else if(B.type==="end"){const ue=Yc(B);if(ue!==Dt)return ue}if(B.type==="illegal"&&J==="")return me+=`
|
|
3
|
+
`,1;if(us>1e5&&us>B.index*3)throw new Error("potential infinite loop, way more iterations than matches");return me+=J,J.length}const it=O(k);if(!it)throw De(be.replace("{}",k)),new Error('Unknown language: "'+k+'"');const Zc=en(it);let cs="",K=ge||Zc;const pa={},Te=new I.__emitter(I);Kc();let me="",Sr=0,Ut=0,us=0,hs=!1;try{if(it.__emitTokens)it.__emitTokens(D,Te);else{for(K.matcher.considerAll();;){us++,hs?hs=!1:K.matcher.considerAll(),K.matcher.lastIndex=Ut;const C=K.matcher.exec(D);if(!C)break;const B=D.substring(Ut,C.index),J=fa(B,C);Ut=C.index+J}fa(D.substring(Ut))}return Te.finalize(),cs=Te.toHTML(),{language:k,value:cs,relevance:Sr,illegal:!1,_emitter:Te,_top:K}}catch(C){if(C.message&&C.message.includes("Illegal"))return{language:k,value:Pn(D),illegal:!0,relevance:0,_illegalBy:{message:C.message,index:Ut,context:D.slice(Ut-100,Ut+100),mode:C.mode,resultSoFar:cs},_emitter:Te};if(we)return{language:k,value:Pn(D),illegal:!1,relevance:0,errorRaised:C,_emitter:Te,_top:K};throw C}}function tn(k){const D={value:Pn(k),illegal:!1,relevance:0,_top:L,_emitter:new I.__emitter(I)};return D._emitter.addText(k),D}function Bt(k,D){D=D||I.languages||Object.keys(g);const ee=tn(k),ge=D.filter(O).filter(Se).map(Ve=>At(Ve,k,!1));ge.unshift(ee);const _e=ge.sort((Ve,rt)=>{if(Ve.relevance!==rt.relevance)return rt.relevance-Ve.relevance;if(Ve.language&&rt.language){if(O(Ve.language).supersetOf===rt.language)return 1;if(O(rt.language).supersetOf===Ve.language)return-1}return 0}),[Ke,Ct]=_e,vr=Ke;return vr.secondBest=Ct,vr}function br(k,D,ee){const ge=D&&x[D]||ee;k.classList.add("hljs"),k.classList.add(`language-${ge}`)}function Ue(k){let D=null;const ee=ce(k);if(H(ee))return;if(nt("before:highlightElement",{el:k,language:ee}),k.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",k);return}if(k.children.length>0&&(I.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(k)),I.throwUnescapedHTML))throw new Nn("One of your code blocks includes unescaped HTML.",k.innerHTML);D=k;const ge=D.textContent,_e=ee?de(ge,{language:ee,ignoreIllegals:!0}):Bt(ge);k.innerHTML=_e.value,k.dataset.highlighted="yes",br(k,ee,_e.language),k.result={language:_e.language,re:_e.relevance,relevance:_e.relevance},_e.secondBest&&(k.secondBest={language:_e.secondBest.language,relevance:_e.secondBest.relevance}),nt("after:highlightElement",{el:k,result:_e,text:ge})}function wr(k){I=Mt(I,k)}const Er=()=>{nn(),Be("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function yr(){nn(),Be("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let $n=!1;function nn(){function k(){nn()}if(document.readyState==="loading"){$n||window.addEventListener("DOMContentLoaded",k,!1),$n=!0;return}document.querySelectorAll(I.cssSelector).forEach(Ue)}function M(k,D){let ee=null;try{ee=D(h)}catch(ge){if(De("Language definition for '{}' could not be registered.".replace("{}",k)),we)De(ge);else throw ge;ee=L}ee.name||(ee.name=k),g[k]=ee,ee.rawDefinition=D.bind(null,h),ee.aliases&&fe(ee.aliases,{languageName:k})}function d(k){delete g[k];for(const D of Object.keys(x))x[D]===k&&delete x[D]}function _(){return Object.keys(g)}function O(k){return k=(k||"").toLowerCase(),g[k]||g[x[k]]}function fe(k,{languageName:D}){typeof k=="string"&&(k=[k]),k.forEach(ee=>{x[ee.toLowerCase()]=D})}function Se(k){const D=O(k);return D&&!D.disableAutodetect}function ye(k){k["before:highlightBlock"]&&!k["before:highlightElement"]&&(k["before:highlightElement"]=D=>{k["before:highlightBlock"](Object.assign({block:D.el},D))}),k["after:highlightBlock"]&&!k["after:highlightElement"]&&(k["after:highlightElement"]=D=>{k["after:highlightBlock"](Object.assign({block:D.el},D))})}function xe(k){ye(k),j.push(k)}function Ye(k){const D=j.indexOf(k);D!==-1&&j.splice(D,1)}function nt(k,D){const ee=k;j.forEach(function(ge){ge[ee]&&ge[ee](D)})}function Mn(k){return Be("10.7.0","highlightBlock will be removed entirely in v12.0"),Be("10.7.0","Please use highlightElement now."),Ue(k)}Object.assign(h,{highlight:de,highlightAuto:Bt,highlightAll:nn,highlightElement:Ue,highlightBlock:Mn,configure:wr,initHighlighting:Er,initHighlightingOnLoad:yr,registerLanguage:M,unregisterLanguage:d,listLanguages:_,getLanguage:O,registerAliases:fe,autoDetection:Se,inherit:Mt,addPlugin:xe,removePlugin:Ye}),h.debugMode=function(){we=!1},h.safeMode=function(){we=!0},h.versionString=Ln,h.regex={concat:w,lookahead:p,either:Z,optional:T,anyNumberOfTimes:E};for(const k in Pt)typeof Pt[k]=="object"&&r(Pt[k]);return Object.assign(h,Pt),h},Rt=xt({});return Rt.newInstance=()=>xt({}),Fr=Rt,Rt.HighlightJS=Rt,Rt.default=Rt,Fr}var Da=Ma();const Ns=$a(Da);function Ba(r){const e={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},t={match:/[{}[\],:]/,className:"punctuation",relevance:0},n=["true","false","null"],i={scope:"literal",beginKeywords:n.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:n},contains:[e,t,r.QUOTE_STRING_MODE,i,r.C_NUMBER_MODE,r.C_LINE_COMMENT_MODE,r.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}Ns.registerLanguage("json",Ba);class Ua extends je{constructor(){super(),this.root=document.createElement("div"),this.root.classList.add("json-viewer"),this.jsonViewerContent=document.createElement("div"),this.jsonViewerContent.classList.add("json-viewer__content"),this.root.appendChild(this.jsonViewerContent)}displayAsJson(e){this.clear();const t=document.createElement("pre");t.classList.add("json-viewer__pre"),t.textContent=JSON.stringify(e,null,2),Ns.highlightElement(t),t.style.backgroundColor="transparent",this.jsonViewerContent.appendChild(t)}clear(){}}class Va extends Wn{constructor(){super("console-message-overlay");const e=document.createElement("div");e.classList.add("console-title-box"),this.root.appendChild(e),this.titleTextDiv=document.createElement("div"),this.titleTextDiv.classList.add("console-title-box__text"),e.appendChild(this.titleTextDiv),this.jsonViewer=new Ua,this.jsonViewer.mount(this.root);const t=new za;t.setCopyTarget(this.jsonViewer.root),t.mount(e)}displayMessage(e,t){this.titleTextDiv.innerHTML=e,this.jsonViewer.displayAsJson(t),super.setVisibility(!0)}hide(){this.titleTextDiv.innerHTML="",this.jsonViewer.clear(),super.setVisibility(!1)}}class za extends je{constructor(){super();const e=document.createElement("button");e.classList.add("copy-button"),e.classList.add("copy-button"),e.textContent="Copy",this.root=e}setCopyTarget(e){this.root.onclick=()=>{const t=e.textContent||"";navigator.clipboard.writeText(t)}}}class Ha extends Wn{constructor(){super("session-finished-overlay"),this.submitButton=new Fa,this.submitButton.mount(this.root),this.messageBox=document.createElement("div"),this.messageBox.classList.add("debrief-message-box"),this.root.appendChild(this.messageBox),this.messageSpan=document.createElement("span"),this.messageSpan.classList.add("debrief-message-box__text"),this.messageBox.appendChild(this.messageSpan)}show(e,t){e.length==0?this.messageBox.style.visibility="hidden":this.messageBox.style.visibility="visible",this.messageSpan.textContent=e,this.submitButton.attachClickListener(t),this.setVisibility(!0)}hide(){this.messageSpan.textContent="",super.setVisibility(!1),this.submitButton.removeAllEventListeners()}}class Fa extends je{constructor(){super();const e=document.createElement("button");e.classList.add("submit-button"),e.textContent="Press to Submit",this.root=e}attachClickListener(e){this._registerEventListener(this.root,"click",e)}}class qa extends Wn{constructor(){super("session-started-overlay"),this.startButton=new ja,this.startButton.mount(this.root)}show(e){this.startButton.attachClickListener(e),this.setVisibility(!0)}hide(){super.setVisibility(!1),this.startButton.removeAllEventListeners()}}class ja extends je{constructor(){super();const e=document.createElement("button");e.classList.add("start-button"),e.textContent="Press to Start",this.root=e}attachClickListener(e){this._registerEventListener(this.root,"click",e)}}class Ga extends je{constructor(){super(),this.root=document.createElement("div"),this.root.className="shell-ui",this.progressBar=new La("cognition"),this.progressBar.mount(this.root),this.sessionConnectingOverlay=new Pa,this.sessionConnectingOverlay.mount(this.root),this.overlayConsoleMessage=new Va,this.overlayConsoleMessage.mount(this.root),this.sessionFinishedOverlay=new Ha,this.sessionFinishedOverlay.mount(this.root),this.sessionStartedOverlay=new qa,this.sessionStartedOverlay.mount(this.root)}setProgressBar(e){this.progressBar.setProgress(e)}showSessionConnectingOverlay(e=500){this.sessionConnectingOverlay.show(e)}hideSessionConnectingOverlay(){this.sessionConnectingOverlay.hide()}showConsoleMessageOverlay(e,t){this.overlayConsoleMessage.displayMessage(e,t)}showErrorOverlay(e){this.showConsoleMessageOverlay("The following error occurred:",{name:e.name,message:e.message,stack:e.stack})}hideConsoleMessageOverlay(){this.overlayConsoleMessage.hide()}async playStartScreen(){await new Promise((t,n)=>{this.sessionStartedOverlay.show(()=>{this.sessionStartedOverlay.hide(),t()})})}async playEndScreen(e="",t=1e4){let n=new Promise((o,s)=>{this.sessionFinishedOverlay.show(e,()=>{this.sessionFinishedOverlay.hide(),o()})});await n;let i=new Promise((o,s)=>{setTimeout(()=>{this.sessionFinishedOverlay.hide(),o()},t)});await Promise.race([n,i])}}function Wa(){const r=document.createElement("div");return r.className="board-views-ui",r}class Xa{constructor(e,t){this.subscriptions=[],this.target=e,this.clock=t,this.boardCoordinateSystem=this.getCoordinateSystem();const n=()=>{this.boardCoordinateSystem=this.getCoordinateSystem()};window.addEventListener("resize",n);let i=!1,o=0;const s=30,a=l=>{if(!this.clock.checkClockStarted()){console.warn("PointerStream: clock has not started.");return}i||(this.boardCoordinateSystem=this.getCoordinateSystem(),i=!0);let c;switch(l.type){case"pointermove":if(l.timeStamp-o<1e3/s)return;c="move",o=l.timeStamp;break;case"pointerdown":if(l.button!==0)return;c="down";break;case"pointerup":if(l.button!==0)return;c="up";break;default:return}const{x:u,y:f}=this.boardCoordinateSystem.getBoardLocationFromPointerEvent(l),p={sampleType:c,x:u,y:f,t:t.now()};this.subscriptions.forEach(E=>E(p))};this.target.addEventListener("pointermove",a),this.target.addEventListener("pointerdown",a),this.target.addEventListener("pointerup",a)}getCoordinateSystem(){return new Ps(this.target)}subscribe(e){return this.subscriptions.push(e),(()=>{this.subscriptions=this.subscriptions.filter(t=>t!==e)})}destroy(){this.subscriptions=[]}}class Ya{constructor(e){this.listeners=[],this.holdingKeys=new Set,this.handleKeyDown=t=>{if(!this.clock.checkClockStarted()){console.warn("KeyStream: clock has not started.");return}if(this.holdingKeys.has(t.key)&&t.repeat)return;this.holdingKeys.add(t.key);const n={sampleType:"down",key:t.key,t:this.clock.now()};this.emit(n)},this.handleKeyUp=t=>{if(!this.clock.checkClockStarted()){console.warn("KeyStream: clock has not started.");return}this.holdingKeys.delete(t.key);const n={sampleType:"up",key:t.key,t:this.clock.now()};this.emit(n)},window.addEventListener("keydown",this.handleKeyDown),window.addEventListener("keyup",this.handleKeyUp),window.addEventListener("blur",()=>{this.holdingKeys.clear()}),this.clock=e}emit(e){for(const t of this.listeners)t(e)}subscribe(e){return this.listeners.push(e),()=>{this.listeners=this.listeners.filter(t=>t!==e)}}destroy(){window.removeEventListener("keydown",this.handleKeyDown),window.removeEventListener("keyup",this.handleKeyUp),this.listeners=[]}}class Ps{constructor(e){const{width:t,height:n,left:i,top:o}=e.getBoundingClientRect();this.boardWidthPx=t,this.boardHeightPx=n,this.boardLeftPx=i,this.boardTopPx=o}getUnitPx(){return Math.min(this.boardWidthPx,this.boardHeightPx)}getBoardLocationPx(e,t,n,i){const o=this.getUnitPx(),s=this.boardWidthPx/o,a=this.boardHeightPx/o,l=o*(e-n/2+s/2),c=o*(-t-i/2+a/2);return{leftPx:l,topPx:c}}getBoardRectanglePx(e,t){return{widthPx:this.getSizePx(e),heightPx:this.getSizePx(t)}}getSizePx(e){return this.getUnitPx()*e}getBoardLocationFromPointerEvent(e){let t=(e.clientX-this.boardLeftPx)/this.boardWidthPx-.5,n=-((e.clientY-this.boardTopPx)/this.boardHeightPx-.5);const i=10;return t=parseFloat(t.toFixed(i)),n=parseFloat(n.toFixed(i)),{x:t,y:n}}}class Ka{constructor(e,t){this.root=document.createElement("div"),this.root.className="board-view",this.root.style.backgroundColor=e,document.body.style.backgroundColor=e,this.clock=t,this.pointerStream=new Xa(this.root,this.clock),this.keyStream=new Ya(this.clock),this.setBoardState(!1,!1)}getCoordinateSystem(){return new Ps(this.root)}setBoardState(e,t){e?this.root.style.opacity="1":this.root.style.opacity="0",t?(this.root.removeAttribute("disabled"),this.root.style.pointerEvents="",this.root.style.userSelect="",this.root.style.opacity=""):(this.root.setAttribute("disabled","true"),this.root.style.pointerEvents="none",this.root.style.userSelect="none")}}function qr(r,e){const t=document.createElement("div");t.classList.add("board-region");const{leftPx:n,topPx:i}=e.getBoardLocationPx(r.x,r.y,r.w,r.h),{widthPx:o,heightPx:s}=e.getBoardRectanglePx(r.w,r.h);switch(t.style.left=`${n}px`,t.style.top=`${i}px`,t.style.width=`${o}px`,t.style.height=`${s}px`,r.mask){case"ellipse":t.style.borderRadius="50%";break;case"rectangle":break;default:const a=r.mask;console.warn(`Found unsupported Region.mask ${a}. Region: ${JSON.stringify(r)}`);break}return typeof r.z_index=="number"&&(t.style.zIndex=r.z_index.toString()),t}class Za{constructor(){this.events=[],this.rafId=null,this.t0=0,this.state="OPEN",this.onStopQueue=[],this.loop=e=>{if(this.state!=="RUNNING")return;const t=e-this.t0;for(;this.events.length>0&&this.events[0].triggerTimeMsec<=t;)this.events.shift().triggerFunc();this.events.length>0&&(this.rafId=requestAnimationFrame(this.loop))}}scheduleEvent(e){if(this.state!=="OPEN")throw new Error(`Cannot schedule event; scheduler state is ${this.state}`);const t={triggerTimeMsec:e.triggerTimeMsec,triggerFunc:e.triggerFunc},n=this.events.findIndex(i=>i.triggerTimeMsec>t.triggerTimeMsec);n===-1?this.events.push(t):this.events.splice(n,0,t)}scheduleOnStop(e){if(this.state!=="OPEN")throw new Error(`Cannot schedule onStop callback; scheduler state is ${this.state}`);this.onStopQueue.push(e)}start(){this.state==="OPEN"&&(this.state="RUNNING",this.t0=performance.now(),this.loop(this.t0))}stop(){if(this.state==="RUNNING")for(this.state="CLOSED",this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null);this.onStopQueue.length>0;)this.onStopQueue.shift()()}}class $s{constructor(e,t){this.hoverable=!1,this.card=e,this.root=t}onStart(){}onDestroy(){}setHoverable(e){this.hoverable=e,e?this.root.classList.add("card--hoverable"):this.root.classList.remove("card--hoverable")}}class jr extends $s{constructor(e,t){const n=qr(e.region,t);super(e,n),this.boardCoords=t}setSelectedState(e){e?this.root.classList.add("card--selected"):this.root.classList.remove("card--selected")}setOpacity(e){this.root.style.opacity=`${Math.min(1,Math.max(0,e))*100}%`}checkPointInCard(e,t){const n=this.card.region;switch(n.mask){case"rectangle":const i=n.x-n.w/2,o=n.x+n.w/2,s=n.y+n.h/2,a=n.y-n.h/2;return e>=i&&e<=o&&t>=a&&t<=s;case"ellipse":const l=n.w/2,c=n.h/2,u=e-n.x,f=t-n.y;return u*u/(l*l)+f*f/(c*c)<=1;default:throw new Error(`Unknown mask: ${n.mask}`)}}}class Qa extends $s{constructor(e,t){const n=document.createElement("div");super(e,n),this.childViews=t;for(let[i,o]of Object.entries(this.childViews))this.root.appendChild(o.root)}async prepare(e){}onStart(){for(let e of Object.values(this.childViews))e.onStart()}onDestroy(){for(let e of Object.values(this.childViews))e.onDestroy();super.onDestroy()}setHoverable(e){for(const t of Object.values(this.childViews))t.setHoverable(e)}setSelectedState(e){for(const t of Object.values(this.childViews))t.setSelectedState(e)}setOpacity(e){for(const t of Object.values(this.childViews))t.setOpacity(e)}checkPointInCard(e,t){for(const n of Object.values(this.childViews))if(n.checkPointInCard(e,t))return!0;return!1}}class Ja extends jr{async prepare(e){this.imageContainer=document.createElement("div"),this.imageContainer.classList.add("image-card"),this.root.appendChild(this.imageContainer),this.image=await e.getImageElement(this.card.image),this.image.classList.add("image-card__content"),this.image.draggable=!1,this.imageContainer.appendChild(this.image)}}class el extends jr{async prepare(e){this.videoContainer=document.createElement("div"),this.videoContainer.classList.add("video-card"),this.root.appendChild(this.videoContainer),this.video=await e.getVideoElement(this.card.video),this.video.classList.add("video-card__content"),this.videoContainer.appendChild(this.video),this.video.muted=!0,this.video.loop=this.card.loop,this.video.draggable=!0}onStart(){if(!this.video)throw new Error("Video not initialized. Did you forget to call load()?");let e=new Promise((i,o)=>{setTimeout(()=>{o(new Error("Video failed to play within 4 frames!"))},66)}),t=new Promise((i,o)=>{if(!this.video)throw new Error("Video not initialized. Did you forget to call load()?");this.video.onplaying=()=>{i(null)}});this.video.play(),Promise.race([t,e]).catch(i=>{console.error(i)})}onDestroy(){this.video&&(this.video.removeAttribute("src"),this.video.load())}}function Gr(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Lt=Gr();function Ms(r){Lt=r}var pn={exec:()=>null};function oe(r,e=""){let t=typeof r=="string"?r:r.source;const n={replace:(i,o)=>{let s=typeof o=="string"?o:o.source;return s=s.replace(Ae.caret,"$1"),t=t.replace(i,s),n},getRegex:()=>new RegExp(t,e)};return n}var Ae={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,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,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,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:r=>new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}#`),htmlBeginRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}<(?:[a-z].*>|!--)`,"i")},tl=/^(?:[ \t]*(?:\n|$))+/,nl=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,rl=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,gn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,il=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Wr=/(?:[*+-]|\d{1,9}[.)])/,Ds=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Bs=oe(Ds).replace(/bull/g,Wr).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),sl=oe(Ds).replace(/bull/g,Wr).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Xr=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,ol=/^[^\n]+/,Yr=/(?!\s*\])(?:\\.|[^\[\]\\])+/,al=oe(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Yr).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ll=oe(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Wr).getRegex(),Xn="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",Kr=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,cl=oe("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Kr).replace("tag",Xn).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Us=oe(Xr).replace("hr",gn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Xn).getRegex(),ul=oe(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Us).getRegex(),Zr={blockquote:ul,code:nl,def:al,fences:rl,heading:il,hr:gn,html:cl,lheading:Bs,list:ll,newline:tl,paragraph:Us,table:pn,text:ol},Vs=oe("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",gn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Xn).getRegex(),hl={...Zr,lheading:sl,table:Vs,paragraph:oe(Xr).replace("hr",gn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Vs).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Xn).getRegex()},dl={...Zr,html:oe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Kr).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:pn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:oe(Xr).replace("hr",gn).replace("heading",` *#{1,6} *[^
|
|
4
|
+
]`).replace("lheading",Bs).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},fl=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,pl=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,zs=/^( {2,}|\\)\n(?!\s*$)/,gl=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Yn=/[\p{P}\p{S}]/u,Qr=/[\s\p{P}\p{S}]/u,Hs=/[^\s\p{P}\p{S}]/u,ml=oe(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Qr).getRegex(),Fs=/(?!~)[\p{P}\p{S}]/u,bl=/(?!~)[\s\p{P}\p{S}]/u,wl=/(?:[^\s\p{P}\p{S}]|~)/u,El=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,qs=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,yl=oe(qs,"u").replace(/punct/g,Yn).getRegex(),vl=oe(qs,"u").replace(/punct/g,Fs).getRegex(),js="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",kl=oe(js,"gu").replace(/notPunctSpace/g,Hs).replace(/punctSpace/g,Qr).replace(/punct/g,Yn).getRegex(),Sl=oe(js,"gu").replace(/notPunctSpace/g,wl).replace(/punctSpace/g,bl).replace(/punct/g,Fs).getRegex(),_l=oe("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Hs).replace(/punctSpace/g,Qr).replace(/punct/g,Yn).getRegex(),Tl=oe(/\\(punct)/,"gu").replace(/punct/g,Yn).getRegex(),xl=oe(/^<(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(),Rl=oe(Kr).replace("(?:-->|$)","-->").getRegex(),Al=oe("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Rl).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Kn=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Cl=oe(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Kn).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Gs=oe(/^!?\[(label)\]\[(ref)\]/).replace("label",Kn).replace("ref",Yr).getRegex(),Ws=oe(/^!?\[(ref)\](?:\[\])?/).replace("ref",Yr).getRegex(),Ol=oe("reflink|nolink(?!\\()","g").replace("reflink",Gs).replace("nolink",Ws).getRegex(),Jr={_backpedal:pn,anyPunctuation:Tl,autolink:xl,blockSkip:El,br:zs,code:pl,del:pn,emStrongLDelim:yl,emStrongRDelimAst:kl,emStrongRDelimUnd:_l,escape:fl,link:Cl,nolink:Ws,punctuation:ml,reflink:Gs,reflinkSearch:Ol,tag:Al,text:gl,url:pn},Il={...Jr,link:oe(/^!?\[(label)\]\((.*?)\)/).replace("label",Kn).getRegex(),reflink:oe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Kn).getRegex()},ei={...Jr,emStrongRDelimAst:Sl,emStrongLDelim:vl,url:oe(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Ll={...ei,br:oe(zs).replace("{2,}","*").getRegex(),text:oe(ei.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Zn={normal:Zr,gfm:hl,pedantic:dl},mn={normal:Jr,gfm:ei,breaks:Ll,pedantic:Il},Nl={"&":"&","<":"<",">":">",'"':""","'":"'"},Xs=r=>Nl[r];function et(r,e){if(e){if(Ae.escapeTest.test(r))return r.replace(Ae.escapeReplace,Xs)}else if(Ae.escapeTestNoEncode.test(r))return r.replace(Ae.escapeReplaceNoEncode,Xs);return r}function Ys(r){try{r=encodeURI(r).replace(Ae.percentDecode,"%")}catch{return null}return r}function Ks(r,e){const t=r.replace(Ae.findPipe,(o,s,a)=>{let l=!1,c=s;for(;--c>=0&&a[c]==="\\";)l=!l;return l?"|":" |"}),n=t.split(Ae.splitPipe);let i=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;i<n.length;i++)n[i]=n[i].trim().replace(Ae.slashPipe,"|");return n}function bn(r,e,t){const n=r.length;if(n===0)return"";let i=0;for(;i<n&&r.charAt(n-i-1)===e;)i++;return r.slice(0,n-i)}function Pl(r,e){if(r.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<r.length;n++)if(r[n]==="\\")n++;else if(r[n]===e[0])t++;else if(r[n]===e[1]&&(t--,t<0))return n;return t>0?-2:-1}function Zs(r,e,t,n,i){const o=e.href,s=e.title||null,a=r[1].replace(i.other.outputLinkReplace,"$1");n.state.inLink=!0;const l={type:r[0].charAt(0)==="!"?"image":"link",raw:t,href:o,title:s,text:a,tokens:n.inlineTokens(a)};return n.state.inLink=!1,l}function $l(r,e,t){const n=r.match(t.other.indentCodeCompensation);if(n===null)return e;const i=n[1];return e.split(`
|
|
5
|
+
`).map(o=>{const s=o.match(t.other.beginningSpace);if(s===null)return o;const[a]=s;return a.length>=i.length?o.slice(i.length):o}).join(`
|
|
6
|
+
`)}var Qn=class{options;rules;lexer;constructor(r){this.options=r||Lt}space(r){const e=this.rules.block.newline.exec(r);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(r){const e=this.rules.block.code.exec(r);if(e){const t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:bn(t,`
|
|
7
|
+
`)}}}fences(r){const e=this.rules.block.fences.exec(r);if(e){const t=e[0],n=$l(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:n}}}heading(r){const e=this.rules.block.heading.exec(r);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){const n=bn(t,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(t=n.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(r){const e=this.rules.block.hr.exec(r);if(e)return{type:"hr",raw:bn(e[0],`
|
|
8
|
+
`)}}blockquote(r){const e=this.rules.block.blockquote.exec(r);if(e){let t=bn(e[0],`
|
|
9
|
+
`).split(`
|
|
10
|
+
`),n="",i="";const o=[];for(;t.length>0;){let s=!1;const a=[];let l;for(l=0;l<t.length;l++)if(this.rules.other.blockquoteStart.test(t[l]))a.push(t[l]),s=!0;else if(!s)a.push(t[l]);else break;t=t.slice(l);const c=a.join(`
|
|
11
|
+
`),u=c.replace(this.rules.other.blockquoteSetextReplace,`
|
|
12
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}
|
|
13
|
+
${c}`:c,i=i?`${i}
|
|
14
|
+
${u}`:u;const f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,o,!0),this.lexer.state.top=f,t.length===0)break;const p=o.at(-1);if(p?.type==="code")break;if(p?.type==="blockquote"){const E=p,T=E.raw+`
|
|
15
|
+
`+t.join(`
|
|
16
|
+
`),w=this.blockquote(T);o[o.length-1]=w,n=n.substring(0,n.length-E.raw.length)+w.raw,i=i.substring(0,i.length-E.text.length)+w.text;break}else if(p?.type==="list"){const E=p,T=E.raw+`
|
|
17
|
+
`+t.join(`
|
|
18
|
+
`),w=this.list(T);o[o.length-1]=w,n=n.substring(0,n.length-p.raw.length)+w.raw,i=i.substring(0,i.length-E.raw.length)+w.raw,t=T.substring(o.at(-1).raw.length).split(`
|
|
19
|
+
`);continue}}return{type:"blockquote",raw:n,tokens:o,text:i}}}list(r){let e=this.rules.block.list.exec(r);if(e){let t=e[1].trim();const n=t.length>1,i={type:"list",raw:"",ordered:n,start:n?+t.slice(0,-1):"",loose:!1,items:[]};t=n?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=n?t:"[*+-]");const o=this.rules.other.listItemRegex(t);let s=!1;for(;r;){let l=!1,c="",u="";if(!(e=o.exec(r))||this.rules.block.hr.test(r))break;c=e[0],r=r.substring(c.length);let f=e[2].split(`
|
|
20
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,Z=>" ".repeat(3*Z.length)),p=r.split(`
|
|
21
|
+
`,1)[0],E=!f.trim(),T=0;if(this.options.pedantic?(T=2,u=f.trimStart()):E?T=e[1].length+1:(T=e[2].search(this.rules.other.nonSpaceChar),T=T>4?1:T,u=f.slice(T),T+=e[1].length),E&&this.rules.other.blankLine.test(p)&&(c+=p+`
|
|
22
|
+
`,r=r.substring(p.length+1),l=!0),!l){const Z=this.rules.other.nextBulletRegex(T),ie=this.rules.other.hrRegex(T),Q=this.rules.other.fencesBeginRegex(T),ne=this.rules.other.headingBeginRegex(T),pe=this.rules.other.htmlBeginRegex(T);for(;r;){const se=r.split(`
|
|
23
|
+
`,1)[0];let ae;if(p=se,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),ae=p):ae=p.replace(this.rules.other.tabCharGlobal," "),Q.test(p)||ne.test(p)||pe.test(p)||Z.test(p)||ie.test(p))break;if(ae.search(this.rules.other.nonSpaceChar)>=T||!p.trim())u+=`
|
|
24
|
+
`+ae.slice(T);else{if(E||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||Q.test(f)||ne.test(f)||ie.test(f))break;u+=`
|
|
25
|
+
`+p}!E&&!p.trim()&&(E=!0),c+=se+`
|
|
26
|
+
`,r=r.substring(se.length+1),f=ae.slice(T)}}i.loose||(s?i.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(s=!0));let w=null,V;this.options.gfm&&(w=this.rules.other.listIsTask.exec(u),w&&(V=w[0]!=="[ ] ",u=u.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:c,task:!!w,checked:V,loose:!1,text:u,tokens:[]}),i.raw+=c}const a=i.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let l=0;l<i.items.length;l++)if(this.lexer.state.top=!1,i.items[l].tokens=this.lexer.blockTokens(i.items[l].text,[]),!i.loose){const c=i.items[l].tokens.filter(f=>f.type==="space"),u=c.length>0&&c.some(f=>this.rules.other.anyLine.test(f.raw));i.loose=u}if(i.loose)for(let l=0;l<i.items.length;l++)i.items[l].loose=!0;return i}}html(r){const e=this.rules.block.html.exec(r);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(r){const e=this.rules.block.def.exec(r);if(e){const t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:n,title:i}}}table(r){const e=this.rules.block.table.exec(r);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;const t=Ks(e[1]),n=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
27
|
+
`):[],o={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===n.length){for(const s of n)this.rules.other.tableAlignRight.test(s)?o.align.push("right"):this.rules.other.tableAlignCenter.test(s)?o.align.push("center"):this.rules.other.tableAlignLeft.test(s)?o.align.push("left"):o.align.push(null);for(let s=0;s<t.length;s++)o.header.push({text:t[s],tokens:this.lexer.inline(t[s]),header:!0,align:o.align[s]});for(const s of i)o.rows.push(Ks(s,o.header.length).map((a,l)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:o.align[l]})));return o}}lheading(r){const e=this.rules.block.lheading.exec(r);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(r){const e=this.rules.block.paragraph.exec(r);if(e){const t=e[1].charAt(e[1].length-1)===`
|
|
28
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(r){const e=this.rules.block.text.exec(r);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(r){const e=this.rules.inline.escape.exec(r);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(r){const e=this.rules.inline.tag.exec(r);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(r){const e=this.rules.inline.link.exec(r);if(e){const t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;const o=bn(t.slice(0,-1),"\\");if((t.length-o.length)%2===0)return}else{const o=Pl(e[2],"()");if(o===-2)return;if(o>-1){const a=(e[0].indexOf("!")===0?5:4)+e[1].length+o;e[2]=e[2].substring(0,o),e[0]=e[0].substring(0,a).trim(),e[3]=""}}let n=e[2],i="";if(this.options.pedantic){const o=this.rules.other.pedanticHrefTitle.exec(n);o&&(n=o[1],i=o[3])}else i=e[3]?e[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?n=n.slice(1):n=n.slice(1,-1)),Zs(e,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(r,e){let t;if((t=this.rules.inline.reflink.exec(r))||(t=this.rules.inline.nolink.exec(r))){const n=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[n.toLowerCase()];if(!i){const o=t[0].charAt(0);return{type:"text",raw:o,text:o}}return Zs(t,i,t[0],this.lexer,this.rules)}}emStrong(r,e,t=""){let n=this.rules.inline.emStrongLDelim.exec(r);if(!n||n[3]&&t.match(this.rules.other.unicodeAlphaNumeric))return;if(!(n[1]||n[2]||"")||!t||this.rules.inline.punctuation.exec(t)){const o=[...n[0]].length-1;let s,a,l=o,c=0;const u=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,e=e.slice(-1*r.length+o);(n=u.exec(e))!=null;){if(s=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!s)continue;if(a=[...s].length,n[3]||n[4]){l+=a;continue}else if((n[5]||n[6])&&o%3&&!((o+a)%3)){c+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l+c);const f=[...n[0]][0].length,p=r.slice(0,o+n.index+f+a);if(Math.min(o,a)%2){const T=p.slice(1,-1);return{type:"em",raw:p,text:T,tokens:this.lexer.inlineTokens(T)}}const E=p.slice(2,-2);return{type:"strong",raw:p,text:E,tokens:this.lexer.inlineTokens(E)}}}}codespan(r){const e=this.rules.inline.code.exec(r);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," ");const n=this.rules.other.nonSpaceChar.test(t),i=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return n&&i&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(r){const e=this.rules.inline.br.exec(r);if(e)return{type:"br",raw:e[0]}}del(r){const e=this.rules.inline.del.exec(r);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(r){const e=this.rules.inline.autolink.exec(r);if(e){let t,n;return e[2]==="@"?(t=e[1],n="mailto:"+t):(t=e[1],n=t),{type:"link",raw:e[0],text:t,href:n,tokens:[{type:"text",raw:t,text:t}]}}}url(r){let e;if(e=this.rules.inline.url.exec(r)){let t,n;if(e[2]==="@")t=e[0],n="mailto:"+t;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==e[0]);t=e[0],e[1]==="www."?n="http://"+e[0]:n=e[0]}return{type:"link",raw:e[0],text:t,href:n,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(r){const e=this.rules.inline.text.exec(r);if(e){const t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},ct=class ds{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Lt,this.options.tokenizer=this.options.tokenizer||new Qn,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={other:Ae,block:Zn.normal,inline:mn.normal};this.options.pedantic?(t.block=Zn.pedantic,t.inline=mn.pedantic):this.options.gfm&&(t.block=Zn.gfm,this.options.breaks?t.inline=mn.breaks:t.inline=mn.gfm),this.tokenizer.rules=t}static get rules(){return{block:Zn,inline:mn}}static lex(e,t){return new ds(t).lex(e)}static lexInline(e,t){return new ds(t).inlineTokens(e)}lex(e){e=e.replace(Ae.carriageReturn,`
|
|
29
|
+
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(Ae.tabCharGlobal," ").replace(Ae.spaceLine,""));e;){let i;if(this.options.extensions?.block?.some(s=>(i=s.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);const s=t.at(-1);i.raw.length===1&&s!==void 0?s.raw+=`
|
|
30
|
+
`:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);const s=t.at(-1);s?.type==="paragraph"||s?.type==="text"?(s.raw+=`
|
|
31
|
+
`+i.raw,s.text+=`
|
|
32
|
+
`+i.text,this.inlineQueue.at(-1).src=s.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);const s=t.at(-1);s?.type==="paragraph"||s?.type==="text"?(s.raw+=`
|
|
33
|
+
`+i.raw,s.text+=`
|
|
34
|
+
`+i.raw,this.inlineQueue.at(-1).src=s.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title});continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),t.push(i);continue}let o=e;if(this.options.extensions?.startBlock){let s=1/0;const a=e.slice(1);let l;this.options.extensions.startBlock.forEach(c=>{l=c.call({lexer:this},a),typeof l=="number"&&l>=0&&(s=Math.min(s,l))}),s<1/0&&s>=0&&(o=e.substring(0,s+1))}if(this.state.top&&(i=this.tokenizer.paragraph(o))){const s=t.at(-1);n&&s?.type==="paragraph"?(s.raw+=`
|
|
35
|
+
`+i.raw,s.text+=`
|
|
36
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):t.push(i),n=o.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);const s=t.at(-1);s?.type==="text"?(s.raw+=`
|
|
37
|
+
`+i.raw,s.text+=`
|
|
38
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):t.push(i);continue}if(e){const s="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(s);break}else throw new Error(s)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,i=null;if(this.tokens.links){const a=Object.keys(this.tokens.links);if(a.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)a.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,i.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(i=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let o=!1,s="";for(;e;){o||(s=""),o=!1;let a;if(this.options.extensions?.inline?.some(c=>(a=c.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);const c=t.at(-1);a.type==="text"&&c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):t.push(a);continue}if(a=this.tokenizer.emStrong(e,n,s)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.del(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),t.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),t.push(a);continue}let l=e;if(this.options.extensions?.startInline){let c=1/0;const u=e.slice(1);let f;this.options.extensions.startInline.forEach(p=>{f=p.call({lexer:this},u),typeof f=="number"&&f>=0&&(c=Math.min(c,f))}),c<1/0&&c>=0&&(l=e.substring(0,c+1))}if(a=this.tokenizer.inlineText(l)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(s=a.raw.slice(-1)),o=!0;const c=t.at(-1);c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):t.push(a);continue}if(e){const c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return t}},Jn=class{options;parser;constructor(r){this.options=r||Lt}space(r){return""}code({text:r,lang:e,escaped:t}){const n=(e||"").match(Ae.notSpaceStart)?.[0],i=r.replace(Ae.endingNewline,"")+`
|
|
39
|
+
`;return n?'<pre><code class="language-'+et(n)+'">'+(t?i:et(i,!0))+`</code></pre>
|
|
40
|
+
`:"<pre><code>"+(t?i:et(i,!0))+`</code></pre>
|
|
41
|
+
`}blockquote({tokens:r}){return`<blockquote>
|
|
42
|
+
${this.parser.parse(r)}</blockquote>
|
|
43
|
+
`}html({text:r}){return r}heading({tokens:r,depth:e}){return`<h${e}>${this.parser.parseInline(r)}</h${e}>
|
|
44
|
+
`}hr(r){return`<hr>
|
|
45
|
+
`}list(r){const e=r.ordered,t=r.start;let n="";for(let s=0;s<r.items.length;s++){const a=r.items[s];n+=this.listitem(a)}const i=e?"ol":"ul",o=e&&t!==1?' start="'+t+'"':"";return"<"+i+o+`>
|
|
46
|
+
`+n+"</"+i+`>
|
|
47
|
+
`}listitem(r){let e="";if(r.task){const t=this.checkbox({checked:!!r.checked});r.loose?r.tokens[0]?.type==="paragraph"?(r.tokens[0].text=t+" "+r.tokens[0].text,r.tokens[0].tokens&&r.tokens[0].tokens.length>0&&r.tokens[0].tokens[0].type==="text"&&(r.tokens[0].tokens[0].text=t+" "+et(r.tokens[0].tokens[0].text),r.tokens[0].tokens[0].escaped=!0)):r.tokens.unshift({type:"text",raw:t+" ",text:t+" ",escaped:!0}):e+=t+" "}return e+=this.parser.parse(r.tokens,!!r.loose),`<li>${e}</li>
|
|
48
|
+
`}checkbox({checked:r}){return"<input "+(r?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:r}){return`<p>${this.parser.parseInline(r)}</p>
|
|
49
|
+
`}table(r){let e="",t="";for(let i=0;i<r.header.length;i++)t+=this.tablecell(r.header[i]);e+=this.tablerow({text:t});let n="";for(let i=0;i<r.rows.length;i++){const o=r.rows[i];t="";for(let s=0;s<o.length;s++)t+=this.tablecell(o[s]);n+=this.tablerow({text:t})}return n&&(n=`<tbody>${n}</tbody>`),`<table>
|
|
50
|
+
<thead>
|
|
51
|
+
`+e+`</thead>
|
|
52
|
+
`+n+`</table>
|
|
53
|
+
`}tablerow({text:r}){return`<tr>
|
|
54
|
+
${r}</tr>
|
|
55
|
+
`}tablecell(r){const e=this.parser.parseInline(r.tokens),t=r.header?"th":"td";return(r.align?`<${t} align="${r.align}">`:`<${t}>`)+e+`</${t}>
|
|
56
|
+
`}strong({tokens:r}){return`<strong>${this.parser.parseInline(r)}</strong>`}em({tokens:r}){return`<em>${this.parser.parseInline(r)}</em>`}codespan({text:r}){return`<code>${et(r,!0)}</code>`}br(r){return"<br>"}del({tokens:r}){return`<del>${this.parser.parseInline(r)}</del>`}link({href:r,title:e,tokens:t}){const n=this.parser.parseInline(t),i=Ys(r);if(i===null)return n;r=i;let o='<a href="'+r+'"';return e&&(o+=' title="'+et(e)+'"'),o+=">"+n+"</a>",o}image({href:r,title:e,text:t,tokens:n}){n&&(t=this.parser.parseInline(n,this.parser.textRenderer));const i=Ys(r);if(i===null)return et(t);r=i;let o=`<img src="${r}" alt="${t}"`;return e&&(o+=` title="${et(e)}"`),o+=">",o}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:et(r.text)}},ti=class{strong({text:r}){return r}em({text:r}){return r}codespan({text:r}){return r}del({text:r}){return r}html({text:r}){return r}text({text:r}){return r}link({text:r}){return""+r}image({text:r}){return""+r}br(){return""}},ut=class fs{options;renderer;textRenderer;constructor(e){this.options=e||Lt,this.options.renderer=this.options.renderer||new Jn,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ti}static parse(e,t){return new fs(t).parse(e)}static parseInline(e,t){return new fs(t).parseInline(e)}parse(e,t=!0){let n="";for(let i=0;i<e.length;i++){const o=e[i];if(this.options.extensions?.renderers?.[o.type]){const a=o,l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(a.type)){n+=l||"";continue}}const s=o;switch(s.type){case"space":{n+=this.renderer.space(s);continue}case"hr":{n+=this.renderer.hr(s);continue}case"heading":{n+=this.renderer.heading(s);continue}case"code":{n+=this.renderer.code(s);continue}case"table":{n+=this.renderer.table(s);continue}case"blockquote":{n+=this.renderer.blockquote(s);continue}case"list":{n+=this.renderer.list(s);continue}case"html":{n+=this.renderer.html(s);continue}case"paragraph":{n+=this.renderer.paragraph(s);continue}case"text":{let a=s,l=this.renderer.text(a);for(;i+1<e.length&&e[i+1].type==="text";)a=e[++i],l+=`
|
|
57
|
+
`+this.renderer.text(a);t?n+=this.renderer.paragraph({type:"paragraph",raw:l,text:l,tokens:[{type:"text",raw:l,text:l,escaped:!0}]}):n+=l;continue}default:{const a='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}parseInline(e,t=this.renderer){let n="";for(let i=0;i<e.length;i++){const o=e[i];if(this.options.extensions?.renderers?.[o.type]){const a=this.options.extensions.renderers[o.type].call({parser:this},o);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){n+=a||"";continue}}const s=o;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"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:{const a='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}},er=class{options;block;constructor(r){this.options=r||Lt}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(r){return r}postprocess(r){return r}processAllTokens(r){return r}provideLexer(){return this.block?ct.lex:ct.lexInline}provideParser(){return this.block?ut.parse:ut.parseInline}},Ml=class{defaults=Gr();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=ut;Renderer=Jn;TextRenderer=ti;Lexer=ct;Tokenizer=Qn;Hooks=er;constructor(...r){this.use(...r)}walkTokens(r,e){let t=[];for(const n of r)switch(t=t.concat(e.call(this,n)),n.type){case"table":{const i=n;for(const o of i.header)t=t.concat(this.walkTokens(o.tokens,e));for(const o of i.rows)for(const s of o)t=t.concat(this.walkTokens(s.tokens,e));break}case"list":{const i=n;t=t.concat(this.walkTokens(i.items,e));break}default:{const i=n;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(o=>{const s=i[o].flat(1/0);t=t.concat(this.walkTokens(s,e))}):i.tokens&&(t=t.concat(this.walkTokens(i.tokens,e)))}}return t}use(...r){const e=this.defaults.extensions||{renderers:{},childTokens:{}};return r.forEach(t=>{const n={...t};if(n.async=this.defaults.async||n.async||!1,t.extensions&&(t.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){const o=e.renderers[i.name];o?e.renderers[i.name]=function(...s){let a=i.renderer.apply(this,s);return a===!1&&(a=o.apply(this,s)),a}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const o=e[i.level];o?o.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),n.extensions=e),t.renderer){const i=this.defaults.renderer||new Jn(this.defaults);for(const o in t.renderer){if(!(o in i))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;const s=o,a=t.renderer[s],l=i[s];i[s]=(...c)=>{let u=a.apply(i,c);return u===!1&&(u=l.apply(i,c)),u||""}}n.renderer=i}if(t.tokenizer){const i=this.defaults.tokenizer||new Qn(this.defaults);for(const o in t.tokenizer){if(!(o in i))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;const s=o,a=t.tokenizer[s],l=i[s];i[s]=(...c)=>{let u=a.apply(i,c);return u===!1&&(u=l.apply(i,c)),u}}n.tokenizer=i}if(t.hooks){const i=this.defaults.hooks||new er;for(const o in t.hooks){if(!(o in i))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;const s=o,a=t.hooks[s],l=i[s];er.passThroughHooks.has(o)?i[s]=c=>{if(this.defaults.async)return Promise.resolve(a.call(i,c)).then(f=>l.call(i,f));const u=a.call(i,c);return l.call(i,u)}:i[s]=(...c)=>{let u=a.apply(i,c);return u===!1&&(u=l.apply(i,c)),u}}n.hooks=i}if(t.walkTokens){const i=this.defaults.walkTokens,o=t.walkTokens;n.walkTokens=function(s){let a=[];return a.push(o.call(this,s)),i&&(a=a.concat(i.call(this,s))),a}}this.defaults={...this.defaults,...n}}),this}setOptions(r){return this.defaults={...this.defaults,...r},this}lexer(r,e){return ct.lex(r,e??this.defaults)}parser(r,e){return ut.parse(r,e??this.defaults)}parseMarkdown(r){return(t,n)=>{const i={...n},o={...this.defaults,...i},s=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&i.async===!1)return s(new 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 s(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));o.hooks&&(o.hooks.options=o,o.hooks.block=r);const a=o.hooks?o.hooks.provideLexer():r?ct.lex:ct.lexInline,l=o.hooks?o.hooks.provideParser():r?ut.parse:ut.parseInline;if(o.async)return Promise.resolve(o.hooks?o.hooks.preprocess(t):t).then(c=>a(c,o)).then(c=>o.hooks?o.hooks.processAllTokens(c):c).then(c=>o.walkTokens?Promise.all(this.walkTokens(c,o.walkTokens)).then(()=>c):c).then(c=>l(c,o)).then(c=>o.hooks?o.hooks.postprocess(c):c).catch(s);try{o.hooks&&(t=o.hooks.preprocess(t));let c=a(t,o);o.hooks&&(c=o.hooks.processAllTokens(c)),o.walkTokens&&this.walkTokens(c,o.walkTokens);let u=l(c,o);return o.hooks&&(u=o.hooks.postprocess(u)),u}catch(c){return s(c)}}}onError(r,e){return t=>{if(t.message+=`
|
|
58
|
+
Please report this to https://github.com/markedjs/marked.`,r){const n="<p>An error occurred:</p><pre>"+et(t.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(t);throw t}}},Nt=new Ml;function le(r,e){return Nt.parse(r,e)}le.options=le.setOptions=function(r){return Nt.setOptions(r),le.defaults=Nt.defaults,Ms(le.defaults),le},le.getDefaults=Gr,le.defaults=Lt,le.use=function(...r){return Nt.use(...r),le.defaults=Nt.defaults,Ms(le.defaults),le},le.walkTokens=function(r,e){return Nt.walkTokens(r,e)},le.parseInline=Nt.parseInline,le.Parser=ut,le.parser=ut.parse,le.Renderer=Jn,le.TextRenderer=ti,le.Lexer=ct,le.lexer=ct.lex,le.Tokenizer=Qn,le.Hooks=er,le.parse=le,le.options,le.setOptions,le.use,le.walkTokens,le.parseInline,ut.parse,ct.lex;/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:Qs,setPrototypeOf:Js,isFrozen:Dl,getPrototypeOf:Bl,getOwnPropertyDescriptor:Ul}=Object;let{freeze:Ce,seal:He,create:eo}=Object,{apply:ni,construct:ri}=typeof Reflect<"u"&&Reflect;Ce||(Ce=function(e){return e}),He||(He=function(e){return e}),ni||(ni=function(e,t,n){return e.apply(t,n)}),ri||(ri=function(e,t){return new e(...t)});const tr=Ie(Array.prototype.forEach),Vl=Ie(Array.prototype.lastIndexOf),to=Ie(Array.prototype.pop),wn=Ie(Array.prototype.push),zl=Ie(Array.prototype.splice),nr=Ie(String.prototype.toLowerCase),ii=Ie(String.prototype.toString),no=Ie(String.prototype.match),En=Ie(String.prototype.replace),Hl=Ie(String.prototype.indexOf),Fl=Ie(String.prototype.trim),Ge=Ie(Object.prototype.hasOwnProperty),Oe=Ie(RegExp.prototype.test),yn=ql(TypeError);function Ie(r){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return ni(r,e,n)}}function ql(r){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return ri(r,t)}}function te(r,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:nr;Js&&Js(r,null);let n=e.length;for(;n--;){let i=e[n];if(typeof i=="string"){const o=t(i);o!==i&&(Dl(e)||(e[n]=o),i=o)}r[i]=!0}return r}function jl(r){for(let e=0;e<r.length;e++)Ge(r,e)||(r[e]=null);return r}function ht(r){const e=eo(null);for(const[t,n]of Qs(r))Ge(r,t)&&(Array.isArray(n)?e[t]=jl(n):n&&typeof n=="object"&&n.constructor===Object?e[t]=ht(n):e[t]=n);return e}function vn(r,e){for(;r!==null;){const n=Ul(r,e);if(n){if(n.get)return Ie(n.get);if(typeof n.value=="function")return Ie(n.value)}r=Bl(r)}function t(){return null}return t}const ro=Ce(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),si=Ce(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),oi=Ce(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Gl=Ce(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),ai=Ce(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Wl=Ce(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),io=Ce(["#text"]),so=Ce(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),li=Ce(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),oo=Ce(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),rr=Ce(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Xl=He(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Yl=He(/<%[\w\W]*|[\w\W]*%>/gm),Kl=He(/\$\{[\w\W]*/gm),Zl=He(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ql=He(/^aria-[\-\w]+$/),ao=He(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Jl=He(/^(?:\w+script|data):/i),ec=He(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),lo=He(/^html$/i),tc=He(/^[a-z][.\w]*(-[.\w]+)+$/i);var co=Object.freeze({__proto__:null,ARIA_ATTR:Ql,ATTR_WHITESPACE:ec,CUSTOM_ELEMENT:tc,DATA_ATTR:Zl,DOCTYPE_NAME:lo,ERB_EXPR:Yl,IS_ALLOWED_URI:ao,IS_SCRIPT_OR_DATA:Jl,MUSTACHE_EXPR:Xl,TMPLIT_EXPR:Kl});const kn={element:1,text:3,progressingInstruction:7,comment:8,document:9},nc=function(){return typeof window>"u"?null:window},rc=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let n=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(n=t.getAttribute(i));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},uo=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ho(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:nc();const e=M=>ho(M);if(e.version="3.2.6",e.removed=[],!r||!r.document||r.document.nodeType!==kn.document||!r.Element)return e.isSupported=!1,e;let{document:t}=r;const n=t,i=n.currentScript,{DocumentFragment:o,HTMLTemplateElement:s,Node:a,Element:l,NodeFilter:c,NamedNodeMap:u=r.NamedNodeMap||r.MozNamedAttrMap,HTMLFormElement:f,DOMParser:p,trustedTypes:E}=r,T=l.prototype,w=vn(T,"cloneNode"),V=vn(T,"remove"),Z=vn(T,"nextSibling"),ie=vn(T,"childNodes"),Q=vn(T,"parentNode");if(typeof s=="function"){const M=t.createElement("template");M.content&&M.content.ownerDocument&&(t=M.content.ownerDocument)}let ne,pe="";const{implementation:se,createNodeIterator:ae,createDocumentFragment:F,getElementsByTagName:tt}=t,{importNode:kt}=n;let Ee=uo();e.isSupported=typeof Qs=="function"&&typeof Q=="function"&&se&&se.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:ft,ERB_EXPR:pt,TMPLIT_EXPR:A,DATA_ATTR:R,ARIA_ATTR:U,IS_SCRIPT_OR_DATA:N,ATTR_WHITESPACE:$,CUSTOM_ELEMENT:P}=co;let{IS_ALLOWED_URI:q}=co,z=null;const Y=te({},[...ro,...si,...oi,...ai,...io]);let G=null;const ke=te({},[...so,...li,...oo,...rr]);let X=Object.seal(eo(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Me=null,xn=null,hr=!0,dr=!0,Pt=!1,fr=!0,St=!1,Yt=!0,gt=!1,Rn=!1,An=!1,_t=!1,Kt=!1,Zt=!1,Cn=!0,pr=!1;const as="user-content-";let Qt=!0,De=!1,mt={},Be=null;const $t=te({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let On=null;const gr=te({},["audio","video","img","source","image","track"]);let In=null;const mr=te({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Jt="http://www.w3.org/1998/Math/MathML",en="http://www.w3.org/2000/svg",Fe="http://www.w3.org/1999/xhtml";let Tt=Fe,Ln=!1,Nn=null;const Pn=te({},[Jt,en,Fe],ii);let Mt=te({},["mi","mo","mn","ms","mtext"]),Dt=te({},["annotation-xml"]);const ls=te({},["title","style","font","a","script"]);let xt=null;const Rt=["application/xhtml+xml","text/html"],h="text/html";let g=null,x=null;const j=t.createElement("form"),we=function(d){return d instanceof RegExp||d instanceof Function},be=function(){let d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(x&&x===d)){if((!d||typeof d!="object")&&(d={}),d=ht(d),xt=Rt.indexOf(d.PARSER_MEDIA_TYPE)===-1?h:d.PARSER_MEDIA_TYPE,g=xt==="application/xhtml+xml"?ii:nr,z=Ge(d,"ALLOWED_TAGS")?te({},d.ALLOWED_TAGS,g):Y,G=Ge(d,"ALLOWED_ATTR")?te({},d.ALLOWED_ATTR,g):ke,Nn=Ge(d,"ALLOWED_NAMESPACES")?te({},d.ALLOWED_NAMESPACES,ii):Pn,In=Ge(d,"ADD_URI_SAFE_ATTR")?te(ht(mr),d.ADD_URI_SAFE_ATTR,g):mr,On=Ge(d,"ADD_DATA_URI_TAGS")?te(ht(gr),d.ADD_DATA_URI_TAGS,g):gr,Be=Ge(d,"FORBID_CONTENTS")?te({},d.FORBID_CONTENTS,g):$t,Me=Ge(d,"FORBID_TAGS")?te({},d.FORBID_TAGS,g):ht({}),xn=Ge(d,"FORBID_ATTR")?te({},d.FORBID_ATTR,g):ht({}),mt=Ge(d,"USE_PROFILES")?d.USE_PROFILES:!1,hr=d.ALLOW_ARIA_ATTR!==!1,dr=d.ALLOW_DATA_ATTR!==!1,Pt=d.ALLOW_UNKNOWN_PROTOCOLS||!1,fr=d.ALLOW_SELF_CLOSE_IN_ATTR!==!1,St=d.SAFE_FOR_TEMPLATES||!1,Yt=d.SAFE_FOR_XML!==!1,gt=d.WHOLE_DOCUMENT||!1,_t=d.RETURN_DOM||!1,Kt=d.RETURN_DOM_FRAGMENT||!1,Zt=d.RETURN_TRUSTED_TYPE||!1,An=d.FORCE_BODY||!1,Cn=d.SANITIZE_DOM!==!1,pr=d.SANITIZE_NAMED_PROPS||!1,Qt=d.KEEP_CONTENT!==!1,De=d.IN_PLACE||!1,q=d.ALLOWED_URI_REGEXP||ao,Tt=d.NAMESPACE||Fe,Mt=d.MATHML_TEXT_INTEGRATION_POINTS||Mt,Dt=d.HTML_INTEGRATION_POINTS||Dt,X=d.CUSTOM_ELEMENT_HANDLING||{},d.CUSTOM_ELEMENT_HANDLING&&we(d.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(X.tagNameCheck=d.CUSTOM_ELEMENT_HANDLING.tagNameCheck),d.CUSTOM_ELEMENT_HANDLING&&we(d.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(X.attributeNameCheck=d.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),d.CUSTOM_ELEMENT_HANDLING&&typeof d.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(X.allowCustomizedBuiltInElements=d.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),St&&(dr=!1),Kt&&(_t=!0),mt&&(z=te({},io),G=[],mt.html===!0&&(te(z,ro),te(G,so)),mt.svg===!0&&(te(z,si),te(G,li),te(G,rr)),mt.svgFilters===!0&&(te(z,oi),te(G,li),te(G,rr)),mt.mathMl===!0&&(te(z,ai),te(G,oo),te(G,rr))),d.ADD_TAGS&&(z===Y&&(z=ht(z)),te(z,d.ADD_TAGS,g)),d.ADD_ATTR&&(G===ke&&(G=ht(G)),te(G,d.ADD_ATTR,g)),d.ADD_URI_SAFE_ATTR&&te(In,d.ADD_URI_SAFE_ATTR,g),d.FORBID_CONTENTS&&(Be===$t&&(Be=ht(Be)),te(Be,d.FORBID_CONTENTS,g)),Qt&&(z["#text"]=!0),gt&&te(z,["html","head","body"]),z.table&&(te(z,["tbody"]),delete Me.tbody),d.TRUSTED_TYPES_POLICY){if(typeof d.TRUSTED_TYPES_POLICY.createHTML!="function")throw yn('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof d.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw yn('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');ne=d.TRUSTED_TYPES_POLICY,pe=ne.createHTML("")}else ne===void 0&&(ne=rc(E,i)),ne!==null&&typeof pe=="string"&&(pe=ne.createHTML(""));Ce&&Ce(d),x=d}},L=te({},[...si,...oi,...Gl]),I=te({},[...ai,...Wl]),H=function(d){let _=Q(d);(!_||!_.tagName)&&(_={namespaceURI:Tt,tagName:"template"});const O=nr(d.tagName),fe=nr(_.tagName);return Nn[d.namespaceURI]?d.namespaceURI===en?_.namespaceURI===Fe?O==="svg":_.namespaceURI===Jt?O==="svg"&&(fe==="annotation-xml"||Mt[fe]):!!L[O]:d.namespaceURI===Jt?_.namespaceURI===Fe?O==="math":_.namespaceURI===en?O==="math"&&Dt[fe]:!!I[O]:d.namespaceURI===Fe?_.namespaceURI===en&&!Dt[fe]||_.namespaceURI===Jt&&!Mt[fe]?!1:!I[O]&&(ls[O]||!L[O]):!!(xt==="application/xhtml+xml"&&Nn[d.namespaceURI]):!1},ce=function(d){wn(e.removed,{element:d});try{Q(d).removeChild(d)}catch{V(d)}},de=function(d,_){try{wn(e.removed,{attribute:_.getAttributeNode(d),from:_})}catch{wn(e.removed,{attribute:null,from:_})}if(_.removeAttribute(d),d==="is")if(_t||Kt)try{ce(_)}catch{}else try{_.setAttribute(d,"")}catch{}},At=function(d){let _=null,O=null;if(An)d="<remove></remove>"+d;else{const ye=no(d,/^[\r\n\t ]+/);O=ye&&ye[0]}xt==="application/xhtml+xml"&&Tt===Fe&&(d='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+d+"</body></html>");const fe=ne?ne.createHTML(d):d;if(Tt===Fe)try{_=new p().parseFromString(fe,xt)}catch{}if(!_||!_.documentElement){_=se.createDocument(Tt,"template",null);try{_.documentElement.innerHTML=Ln?pe:fe}catch{}}const Se=_.body||_.documentElement;return d&&O&&Se.insertBefore(t.createTextNode(O),Se.childNodes[0]||null),Tt===Fe?tt.call(_,gt?"html":"body")[0]:gt?_.documentElement:Se},tn=function(d){return ae.call(d.ownerDocument||d,d,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Bt=function(d){return d instanceof f&&(typeof d.nodeName!="string"||typeof d.textContent!="string"||typeof d.removeChild!="function"||!(d.attributes instanceof u)||typeof d.removeAttribute!="function"||typeof d.setAttribute!="function"||typeof d.namespaceURI!="string"||typeof d.insertBefore!="function"||typeof d.hasChildNodes!="function")},br=function(d){return typeof a=="function"&&d instanceof a};function Ue(M,d,_){tr(M,O=>{O.call(e,d,_,x)})}const wr=function(d){let _=null;if(Ue(Ee.beforeSanitizeElements,d,null),Bt(d))return ce(d),!0;const O=g(d.nodeName);if(Ue(Ee.uponSanitizeElement,d,{tagName:O,allowedTags:z}),Yt&&d.hasChildNodes()&&!br(d.firstElementChild)&&Oe(/<[/\w!]/g,d.innerHTML)&&Oe(/<[/\w!]/g,d.textContent)||d.nodeType===kn.progressingInstruction||Yt&&d.nodeType===kn.comment&&Oe(/<[/\w]/g,d.data))return ce(d),!0;if(!z[O]||Me[O]){if(!Me[O]&&yr(O)&&(X.tagNameCheck instanceof RegExp&&Oe(X.tagNameCheck,O)||X.tagNameCheck instanceof Function&&X.tagNameCheck(O)))return!1;if(Qt&&!Be[O]){const fe=Q(d)||d.parentNode,Se=ie(d)||d.childNodes;if(Se&&fe){const ye=Se.length;for(let xe=ye-1;xe>=0;--xe){const Ye=w(Se[xe],!0);Ye.__removalCount=(d.__removalCount||0)+1,fe.insertBefore(Ye,Z(d))}}}return ce(d),!0}return d instanceof l&&!H(d)||(O==="noscript"||O==="noembed"||O==="noframes")&&Oe(/<\/no(script|embed|frames)/i,d.innerHTML)?(ce(d),!0):(St&&d.nodeType===kn.text&&(_=d.textContent,tr([ft,pt,A],fe=>{_=En(_,fe," ")}),d.textContent!==_&&(wn(e.removed,{element:d.cloneNode()}),d.textContent=_)),Ue(Ee.afterSanitizeElements,d,null),!1)},Er=function(d,_,O){if(Cn&&(_==="id"||_==="name")&&(O in t||O in j))return!1;if(!(dr&&!xn[_]&&Oe(R,_))){if(!(hr&&Oe(U,_))){if(!G[_]||xn[_]){if(!(yr(d)&&(X.tagNameCheck instanceof RegExp&&Oe(X.tagNameCheck,d)||X.tagNameCheck instanceof Function&&X.tagNameCheck(d))&&(X.attributeNameCheck instanceof RegExp&&Oe(X.attributeNameCheck,_)||X.attributeNameCheck instanceof Function&&X.attributeNameCheck(_))||_==="is"&&X.allowCustomizedBuiltInElements&&(X.tagNameCheck instanceof RegExp&&Oe(X.tagNameCheck,O)||X.tagNameCheck instanceof Function&&X.tagNameCheck(O))))return!1}else if(!In[_]){if(!Oe(q,En(O,$,""))){if(!((_==="src"||_==="xlink:href"||_==="href")&&d!=="script"&&Hl(O,"data:")===0&&On[d])){if(!(Pt&&!Oe(N,En(O,$,"")))){if(O)return!1}}}}}}return!0},yr=function(d){return d!=="annotation-xml"&&no(d,P)},$n=function(d){Ue(Ee.beforeSanitizeAttributes,d,null);const{attributes:_}=d;if(!_||Bt(d))return;const O={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:G,forceKeepAttr:void 0};let fe=_.length;for(;fe--;){const Se=_[fe],{name:ye,namespaceURI:xe,value:Ye}=Se,nt=g(ye),Mn=Ye;let k=ye==="value"?Mn:Fl(Mn);if(O.attrName=nt,O.attrValue=k,O.keepAttr=!0,O.forceKeepAttr=void 0,Ue(Ee.uponSanitizeAttribute,d,O),k=O.attrValue,pr&&(nt==="id"||nt==="name")&&(de(ye,d),k=as+k),Yt&&Oe(/((--!?|])>)|<\/(style|title)/i,k)){de(ye,d);continue}if(O.forceKeepAttr)continue;if(!O.keepAttr){de(ye,d);continue}if(!fr&&Oe(/\/>/i,k)){de(ye,d);continue}St&&tr([ft,pt,A],ee=>{k=En(k,ee," ")});const D=g(d.nodeName);if(!Er(D,nt,k)){de(ye,d);continue}if(ne&&typeof E=="object"&&typeof E.getAttributeType=="function"&&!xe)switch(E.getAttributeType(D,nt)){case"TrustedHTML":{k=ne.createHTML(k);break}case"TrustedScriptURL":{k=ne.createScriptURL(k);break}}if(k!==Mn)try{xe?d.setAttributeNS(xe,ye,k):d.setAttribute(ye,k),Bt(d)?ce(d):to(e.removed)}catch{de(ye,d)}}Ue(Ee.afterSanitizeAttributes,d,null)},nn=function M(d){let _=null;const O=tn(d);for(Ue(Ee.beforeSanitizeShadowDOM,d,null);_=O.nextNode();)Ue(Ee.uponSanitizeShadowNode,_,null),wr(_),$n(_),_.content instanceof o&&M(_.content);Ue(Ee.afterSanitizeShadowDOM,d,null)};return e.sanitize=function(M){let d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},_=null,O=null,fe=null,Se=null;if(Ln=!M,Ln&&(M="<!-->"),typeof M!="string"&&!br(M))if(typeof M.toString=="function"){if(M=M.toString(),typeof M!="string")throw yn("dirty is not a string, aborting")}else throw yn("toString is not a function");if(!e.isSupported)return M;if(Rn||be(d),e.removed=[],typeof M=="string"&&(De=!1),De){if(M.nodeName){const Ye=g(M.nodeName);if(!z[Ye]||Me[Ye])throw yn("root node is forbidden and cannot be sanitized in-place")}}else if(M instanceof a)_=At("<!---->"),O=_.ownerDocument.importNode(M,!0),O.nodeType===kn.element&&O.nodeName==="BODY"||O.nodeName==="HTML"?_=O:_.appendChild(O);else{if(!_t&&!St&&!gt&&M.indexOf("<")===-1)return ne&&Zt?ne.createHTML(M):M;if(_=At(M),!_)return _t?null:Zt?pe:""}_&&An&&ce(_.firstChild);const ye=tn(De?M:_);for(;fe=ye.nextNode();)wr(fe),$n(fe),fe.content instanceof o&&nn(fe.content);if(De)return M;if(_t){if(Kt)for(Se=F.call(_.ownerDocument);_.firstChild;)Se.appendChild(_.firstChild);else Se=_;return(G.shadowroot||G.shadowrootmode)&&(Se=kt.call(n,Se,!0)),Se}let xe=gt?_.outerHTML:_.innerHTML;return gt&&z["!doctype"]&&_.ownerDocument&&_.ownerDocument.doctype&&_.ownerDocument.doctype.name&&Oe(lo,_.ownerDocument.doctype.name)&&(xe="<!DOCTYPE "+_.ownerDocument.doctype.name+`>
|
|
59
|
+
`+xe),St&&tr([ft,pt,A],Ye=>{xe=En(xe,Ye," ")}),ne&&Zt?ne.createHTML(xe):xe},e.setConfig=function(){let M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};be(M),Rn=!0},e.clearConfig=function(){x=null,Rn=!1},e.isValidAttribute=function(M,d,_){x||be({});const O=g(M),fe=g(d);return Er(O,fe,_)},e.addHook=function(M,d){typeof d=="function"&&wn(Ee[M],d)},e.removeHook=function(M,d){if(d!==void 0){const _=Vl(Ee[M],d);return _===-1?void 0:zl(Ee[M],_,1)[0]}return to(Ee[M])},e.removeHooks=function(M){Ee[M]=[]},e.removeAllHooks=function(){Ee=uo()},e}var fo=ho();function ic(r,e){const t=document.createElement("div");switch(t.classList.add("text-content"),t.style.color=r.textColor,t.style.textAlign=r.justificationHorizontal,r.justificationVertical){case"top":t.style.justifyContent="flex-start";break;case"center":t.style.justifyContent="center";break;case"bottom":t.style.justifyContent="flex-end";break;default:throw new Error(`Unknown vertical justification: ${r.justificationVertical}`)}t.style.fontSize=e(r.fontSize);let n=le.parse(r.text);return n instanceof Promise?n.then(i=>{t.innerHTML=fo.sanitize(i)}).catch(i=>console.error("markdown render failed",i)):t.innerHTML=fo.sanitize(n),t}function sc(r,e,t){switch(t.mask){case"rectangle":const n=t.x-t.w/2,i=t.x+t.w/2,o=t.y+t.h/2,s=t.y-t.h/2;return r>=n&&r<=i&&e>=s&&e<=o;case"ellipse":const a=t.w/2,l=t.h/2,c=r-t.x,u=e-t.y;return c*c/(a*a)+u*u/(l*l)<=1;default:throw new Error(`Unknown mask: ${t.mask}`)}}class oc{constructor(){this.alreadyCalled=!1,this.promise=new Promise(e=>{this.resolveFunc=e})}resolve(e){if(this.alreadyCalled){console.warn("Warning: DeferredValue.resolve called multiple times; ignoring subsequent calls.",e);return}this.alreadyCalled=!0,this.resolveFunc(e)}}class ac extends jr{async prepare(){this.textContainer=document.createElement("div"),this.textContainer.classList.add("text-card"),this.root.style.borderRadius="8px",this.root.appendChild(this.textContainer),this.textContainer.style.backgroundColor=this.card.background_color;const e={text:this.card.text,textColor:this.card.text_color,fontSize:this.card.font_size,justificationHorizontal:this.card.justification_horizontal,justificationVertical:this.card.justification_vertical},t=ic(e,n=>this.boardCoords.getSizePx(n)+"px");this.textContainer.appendChild(t)}}async function Sn(r,e,t){const n=e.getCoordinateSystem();let i=null;switch(r.card_type){case"ImageCard":i=new Ja(r,n);break;case"VideoCard":i=new el(r,n);break;case"TextCard":i=new ac(r,n);break;case"CompositeCard":const o=Object.entries(r.children).map(async([c,u])=>{const f=await Sn(u,e,t);return[c,f]}),s=await Promise.all(o),a=Object.fromEntries(s);i=new Qa(r,a);break;default:const l=r;throw new Error(`Unsupported Card type: ${JSON.stringify(l)}`)}return e.root.appendChild(i.root),await i.prepare(t),i}class dt{constructor(e,t,n){this.subscriptions=[],this.params={sensor:e,boardView:t,assetManager:n}}async prepare(){}start(){}emit(e){this.subscriptions.forEach(t=>t(e))}subscribe(e){this.subscriptions.push(e)}}class lc extends dt{async prepare(){const e=new cc(this.params.sensor,this.params.boardView.getCoordinateSystem());this.params.boardView.root.appendChild(e.root);const t=n=>{const i={action_type:"SliderAction",bin_index:n.binIndex};this.emit(i)};e.subscribeToSlider(t)}}class cc{constructor(e,t){this.pendingThumbPosition=null,this.rafId=null,this.frameRequested=!1,this.currentBinIndex=null,this.subscribers=new Set,this.isDraggingThumb=!1,this.onPointerDownThumb=n=>{n.preventDefault(),this.isDraggingThumb=!0,this.setThumbVisualState("dragging"),n.target.setPointerCapture(n.pointerId)},this.onPointerUpDocument=n=>{if(this.isDraggingThumb){n.preventDefault(),this.isDraggingThumb=!1;const i=this.calculateNearestBin(n);this.currentBinIndex=i,this.scheduleThumbMove(i),this.setThumbVisualState("committed"),n.target.releasePointerCapture(n.pointerId),this.emitSliderValue()}},this.onPointerMoveDocument=n=>{if(!this.isDraggingThumb)return;n.preventDefault();const i=this.calculateNearestBin(n);this.currentBinIndex=i,this.scheduleThumbMove(i)},this.onClickTrack=n=>{n.preventDefault();const i=this.calculateNearestBin(n);this.currentBinIndex=i,this.scheduleThumbMove(i),this.isDraggingThumb?(this.isDraggingThumb=!1,n.target.releasePointerCapture(n.pointerId),this.setThumbVisualState("committed")):(this.isDraggingThumb=!0,this.setThumbVisualState("dragging"),n.target.setPointerCapture(n.pointerId))},this.root=qr(e.region,t),this.boardCoords=t,this.sensor=e,this.sliderContainer=document.createElement("div"),this.sliderContainer.classList.add("slider-card"),this.sliderTrack=document.createElement("div"),this.sliderTrack.classList.add("slider-card__track"),this.sliderContainer.appendChild(this.sliderTrack),this.sliderThumb=document.createElement("div"),this.sliderThumb.classList.add("slider-card__thumb"),this.sliderContainer.appendChild(this.sliderThumb),e.orientation==="horizontal"?(this.sliderTrack.classList.add("slider-card__track--horizontal"),this.sliderThumb.classList.add("slider-card__thumb--horizontal")):(this.sliderTrack.classList.add("slider-card__track--vertical"),this.sliderThumb.classList.add("slider-card__thumb--vertical")),this.root.appendChild(this.sliderContainer),this.binIndexToProportion=n=>e.num_bins<=1?0:n/(e.num_bins-1),this.renderTicks(),this.setThumbVisualState("uncommitted"),this.scheduleThumbMove(e.initial_bin_index),this.sliderTrack.addEventListener("pointerdown",this.onClickTrack),this.sliderThumb.addEventListener("pointerdown",this.onPointerDownThumb),document.addEventListener("pointermove",this.onPointerMoveDocument),document.addEventListener("pointerup",this.onPointerUpDocument)}renderTicks(){const e=this.sensor;if(!e.show_bin_markers)return;this.sliderTrack.querySelectorAll(".slider-card__track-tick").forEach(c=>c.remove());const t=e.num_bins,n=document.createDocumentFragment(),i=e.orientation==="horizontal",o=Math.max(1,i?this.boardCoords.getSizePx(e.region.w):this.boardCoords.getSizePx(e.region.h)),s=8,a=Math.max(0,s/2),l=Math.max(0,o-s);for(let c=0;c<t;c++){if(c===0||c===t-1)continue;const f=(a+c*l/(t-1))/o*100,p=document.createElement("div");p.classList.add("slider-card__track-tick"),p.style.pointerEvents="none";const E="75%";e.orientation==="horizontal"?(p.style.width="1px",p.style.height=E,p.style.left=`${f}%`,p.style.top="50%",p.style.transform="translate(-50%, -50%)"):(p.style.width=E,p.style.height="1px",p.style.top=`${f}%`,p.style.left="50%",p.style.transform="translate(-50%, -50%)"),n.appendChild(p)}this.sliderTrack.appendChild(n)}setThumbVisualState(e){const t="slider-card__thumb--active",n="slider-card__thumb--uncommitted";switch(e){case"dragging":this.sliderThumb.classList.add(t),this.sliderThumb.classList.remove(n);return;case"committed":this.sliderThumb.classList.remove(t),this.sliderThumb.classList.remove(n);return;case"uncommitted":this.sliderThumb.classList.remove(t),this.sliderThumb.classList.add(n);return;default:return}}scheduleThumbMove(e){const t=this.binIndexToProportion(e);this.pendingThumbPosition=Math.max(0,Math.min(1,t)),this.frameRequested||(this.frameRequested=!0,this.rafId=requestAnimationFrame(()=>{this.frameRequested=!1,this.flushThumbVisualUpdate()}))}flushThumbVisualUpdate(){if(this.pendingThumbPosition==null)return;const e=this.sliderThumb.getBoundingClientRect(),t=this.sliderContainer.getBoundingClientRect();if(this.sensor.orientation==="horizontal"){const n=this.pendingThumbPosition*(t.width-e.width);this.sliderThumb.style.left=`${n}px`}else{const n=t.height-e.height-this.pendingThumbPosition*(t.height-e.height);this.sliderThumb.style.top=`${n}px`}this.pendingThumbPosition=null}calculateNearestBin(e){if(this.sensor.num_bins<=1)return 0;const t=this.sliderTrack.getBoundingClientRect();let n;switch(this.sensor.orientation){case"horizontal":n=(e.clientX-t.left)/t.width;break;case"vertical":n=1-(e.clientY-t.top)/t.height;break;default:const a=this.sensor.orientation;throw new Error(`Unsupported SliderSensor.orientation found ${JSON.stringify(a)}`)}n=Math.max(0,Math.min(1,n));const i=n*(this.sensor.num_bins-1);return Math.round(i)}onDestroy(){this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null,this.frameRequested=!1,this.pendingThumbPosition=null),this.sliderTrack.removeEventListener("pointerdown",this.onClickTrack)}emitSliderValue(){if(this.currentBinIndex==null)return;const e=this.currentBinIndex,t={sliderNormalizedPosition:e/(this.sensor.num_bins-1),binIndex:e,domTimestamp:performance.now()};for(let n of this.subscribers)n(t)}subscribeToSlider(e){this.subscribers.add(e)}}class uc extends dt{async prepare(){const e=new hc(this.params.sensor,this.params.boardView.getCoordinateSystem());this.params.boardView.root.appendChild(e.root);const t=n=>{const i={action_type:"TextEntryAction",text:n};this.emit(i)};e.subscribe(t)}}class hc{constructor(e,t){this.root=qr(e.region,t);const n=document.createElement("div");n.classList.add("text-entry");const i=document.createElement("textarea");i.classList.add("text-entry__input"),i.spellcheck=!1,i.placeholder=e.prompt??"",i.style.fontSize=t.getSizePx(e.font_size)+"px",i.maxLength=e.max_length??1e4;const o=document.createElement("div");o.classList.add("text-entry__gutter");const s="Done",a="",l=document.createElement("button");l.classList.add("text-entry__submit"),l.textContent=a,l.disabled=e.min_length>0,o.appendChild(l),n.appendChild(i),n.appendChild(o),this.root.appendChild(n);const c=()=>{const u=i.value.trim().length>=e.min_length;l.textContent=u?s:a,u?(l.classList.add("submittable"),l.disabled=!1):(l.classList.remove("submittable"),l.disabled=!0)};i.addEventListener("input",()=>{c()}),this.textAreaElement=i,this.doneButton=l,c()}subscribe(e){this.doneButton.addEventListener("click",()=>{const t=this.textAreaElement.value;e(t),this.doneButton.textContent="✓"})}}class dc extends dt{async prepare(){const e=new Set(this.params.sensor.keys),t=n=>{if(n.sampleType!=="down"||!e.has(n.key))return;const i={action_type:"KeyAction",key:n.key};this.emit(i)};this.params.boardView.keyStream.subscribe(t)}}class fc extends dt{async prepare(){const e=this.params.sensor.region,t=n=>{if(n.sampleType!=="down")return;if(sc(n.x,n.y,e)){const o={action_type:"ClickAction",x:n.x,y:n.y};this.emit(o);return}};this.params.boardView.pointerStream.subscribe(t)}}class pc extends dt{start(){setTimeout(()=>{const e={action_type:"WaitAction"};this.emit(e)},this.params.sensor.duration_msec)}}class gc extends dt{constructor(){super(...arguments),this.choiceCardViews=[]}async prepare(){const e={};let t=[];for(const[o,s]of Object.entries(this.params.sensor.choices)){const a=await Sn(s,this.params.boardView,this.params.assetManager);a.setHoverable(!0),e[o]=a,t.push(o),this.choiceCardViews.push(e[o])}t.sort();let n=null;const i=o=>{if(o.sampleType!=="down")return;let s=null,a=!1;for(const l of t){const c=e[l];if(!c.checkPointInCard(o.x,o.y))continue;if(n===l){a=!1;break}c.setSelectedState(!0),s=l,n=l,a=!0;const f={action_type:"SelectAction",selection:l};this.emit(f);break}if(a)for(const l of t){if(l===s)continue;e[l].setSelectedState(!1)}};this.params.boardView.pointerStream.subscribe(i)}start(){for(const e of this.choiceCardViews)e.onStart()}}class mc extends dt{constructor(){super(...arguments),this.choiceCardViews=[],this.confirmCardView=null,this.choiceIds=[],this.cardViewMap={}}async prepare(){const e=this.params.sensor.min_selections,t=this.params.sensor.max_selections??Object.keys(this.params.sensor.choices).length,n=new Set;for(const[p,E]of Object.entries(this.params.sensor.choices)){const T=await Sn(E,this.params.boardView,this.params.assetManager);T.setHoverable(!0),this.cardViewMap[p]=T,this.choiceIds.push(p),this.choiceCardViews.push(this.cardViewMap[p])}this.choiceIds.sort();const i=await Sn(this.params.sensor.confirm_button,this.params.boardView,this.params.assetManager);this.confirmCardView=i;const o=.5;i.setOpacity(.1);let s=!1,a=!1;const l=()=>{const p=n.size>=t;for(const E of this.choiceIds){const T=this.cardViewMap[E],w=n.has(E);T.setSelectedState(w),p&&!w?(T.setOpacity(.25),T.setHoverable(!1)):(T.setOpacity(1),T.setHoverable(!0))}},c=()=>{const p={action_type:"MultiSelectAction",selections:Array.from(n)};this.emit(p)},u=()=>{for(const p of this.choiceIds){const E=this.cardViewMap[p];E.setOpacity(o),E.setHoverable(!1)}this.confirmCardView?.setOpacity(o)},f=p=>{if(a)return;const E=n.size>=t;let T=!1;for(const w of this.choiceIds){const V=this.cardViewMap[w];if(!V.checkPointInCard(p.x,p.y))continue;const ie=n.has(w);E&&!ie?V.setHoverable(!1):V.setHoverable(!0),p.sampleType==="down"&&(ie?(n.delete(w),T=!0):n.size<t&&(n.add(w),T=!0))}T&&(l(),s=n.size>=e),s?(i.setOpacity(1),i.checkPointInCard(p.x,p.y)&&p.sampleType==="down"&&(c(),a=!0,i.setOpacity(o),u())):i.setOpacity(.1)};this.params.boardView.pointerStream.subscribe(f)}start(){for(const e of this.choiceCardViews)e.onStart();this.confirmCardView?.onStart()}}class bc extends dt{constructor(){super(...arguments),this.childBindings={}}async prepare(){let e={};for(const[t,n]of Object.entries(this.params.sensor.children))e[t]=null,this.childBindings[t]=await ci(n,this.params.boardView,this.params.assetManager),this.childBindings[t].subscribe(i=>{e[t]=i;let o=this.checkValid(e);o!==null&&this.emit(o)})}checkValid(e){let t={};for(const n of Object.keys(e)){const i=n;if(e[i]===null)return null;t[i]=e[i]}return{action_type:"ProductAction",child_actions:t}}start(){for(const[e,t]of Object.entries(this.childBindings))t.start()}}class wc extends dt{constructor(){super(...arguments),this.childBindings={}}async prepare(){let e=!1;for(const[t,n]of Object.entries(this.params.sensor.children))this.childBindings[t]=await ci(n,this.params.boardView,this.params.assetManager),this.childBindings[t].subscribe(i=>{const o={action_type:"SumAction",child_id:t,child_action:i};e||(e=!0,this.emit(o))})}start(){for(const[e,t]of Object.entries(this.childBindings))t.start()}}async function ci(r,e,t){let n=null;switch(r.sensor_type){case"WaitSensor":{n=new pc(r,e,t);break}case"KeySensor":{n=new dc(r,e,t);break}case"ClickSensor":{n=new fc(r,e,t);break}case"SliderSensor":{n=new lc(r,e,t);break}case"TextEntrySensor":{n=new uc(r,e,t);break}case"SelectSensor":{n=new gc(r,e,t);break}case"MultiSelectSensor":{n=new mc(r,e,t);break}case"ProductSensor":{n=new bc(r,e,t);break}case"SumSensor":{n=new wc(r,e,t);break}default:{const i=r;throw new Error(`Unknown Sensor provided: ${JSON.stringify(i)}`)}}return await n.prepare(),n}class Ec{constructor(e,t,n,i,o){this.prepared=!1,this.started=!1,this.deferredAction=new oc,this.eventArray=o,this.boardView=new Ka(t.board_color,i),this.root=this.boardView.root,this.nodeId=e,this.node=t,this.scheduler=new Za,this.assetManager=n}async prepare(){const e=this.boardView.pointerStream.subscribe(i=>{const o={event_type:"PointerSampledEvent",t:i.t,x:i.x,y:i.y,kind:i.sampleType};this.eventArray.push(o)}),t=this.boardView.keyStream.subscribe(i=>{const o={event_type:"KeySampledEvent",t:i.t,key:i.key,kind:i.sampleType};this.eventArray.push(o)});if(this.scheduler.scheduleOnStop(()=>{e(),t()}),this.node.stimulus){const i=await Sn(this.node.stimulus,this.boardView,this.assetManager);this.scheduler.scheduleEvent({triggerTimeMsec:0,triggerFunc:()=>{i.onStart()}}),this.scheduler.scheduleOnStop(()=>{i.onDestroy()})}const n=await ci(this.node.sensor,this.boardView,this.assetManager);n.subscribe(i=>{this.deferredAction.resolve(i)}),this.scheduler.scheduleEvent({triggerTimeMsec:0,triggerFunc:()=>{n.start()}}),this.node.hide_pointer&&(this.boardView.root.style.cursor="none"),this.prepared=!0}async run(){if(this.prepared||(console.warn("Running a NodePlay without preparing it first!"),await this.prepare()),this.started)throw new Error("NodePlay already started");this.boardView.setBoardState(!0,!0);const e={event_type:"NodeStartedEvent",t:this.boardView.clock.now(),node_id:this.nodeId};this.eventArray.push(e),this.started=!0,this.scheduler.start();const t=await this.deferredAction.promise,n={event_type:"ActionTakenEvent",node_id:this.nodeId,action:t,t:this.boardView.clock.now()};this.eventArray.push(n),this.scheduler.stop();const o={event_type:"NodeEndedEvent",t:this.boardView.clock.now(),node_id:this.nodeId};return this.eventArray.push(o),t}}const ir="0.2.0";var sr={exports:{}},ui,po;function or(){if(po)return ui;po=1;const r="2.0.0",e=256,t=Number.MAX_SAFE_INTEGER||9007199254740991,n=16,i=e-6;return ui={MAX_LENGTH:e,MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:i,MAX_SAFE_INTEGER:t,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:r,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},ui}var hi,go;function ar(){return go||(go=1,hi=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{}),hi}var mo;function _n(){return mo||(mo=1,(function(r,e){const{MAX_SAFE_COMPONENT_LENGTH:t,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:i}=or(),o=ar();e=r.exports={};const s=e.re=[],a=e.safeRe=[],l=e.src=[],c=e.safeSrc=[],u=e.t={};let f=0;const p="[a-zA-Z0-9-]",E=[["\\s",1],["\\d",i],[p,n]],T=V=>{for(const[Z,ie]of E)V=V.split(`${Z}*`).join(`${Z}{0,${ie}}`).split(`${Z}+`).join(`${Z}{1,${ie}}`);return V},w=(V,Z,ie)=>{const Q=T(Z),ne=f++;o(V,ne,Z),u[V]=ne,l[ne]=Z,c[ne]=Q,s[ne]=new RegExp(Z,ie?"g":void 0),a[ne]=new RegExp(Q,ie?"g":void 0)};w("NUMERICIDENTIFIER","0|[1-9]\\d*"),w("NUMERICIDENTIFIERLOOSE","\\d+"),w("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${p}*`),w("MAINVERSION",`(${l[u.NUMERICIDENTIFIER]})\\.(${l[u.NUMERICIDENTIFIER]})\\.(${l[u.NUMERICIDENTIFIER]})`),w("MAINVERSIONLOOSE",`(${l[u.NUMERICIDENTIFIERLOOSE]})\\.(${l[u.NUMERICIDENTIFIERLOOSE]})\\.(${l[u.NUMERICIDENTIFIERLOOSE]})`),w("PRERELEASEIDENTIFIER",`(?:${l[u.NONNUMERICIDENTIFIER]}|${l[u.NUMERICIDENTIFIER]})`),w("PRERELEASEIDENTIFIERLOOSE",`(?:${l[u.NONNUMERICIDENTIFIER]}|${l[u.NUMERICIDENTIFIERLOOSE]})`),w("PRERELEASE",`(?:-(${l[u.PRERELEASEIDENTIFIER]}(?:\\.${l[u.PRERELEASEIDENTIFIER]})*))`),w("PRERELEASELOOSE",`(?:-?(${l[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[u.PRERELEASEIDENTIFIERLOOSE]})*))`),w("BUILDIDENTIFIER",`${p}+`),w("BUILD",`(?:\\+(${l[u.BUILDIDENTIFIER]}(?:\\.${l[u.BUILDIDENTIFIER]})*))`),w("FULLPLAIN",`v?${l[u.MAINVERSION]}${l[u.PRERELEASE]}?${l[u.BUILD]}?`),w("FULL",`^${l[u.FULLPLAIN]}$`),w("LOOSEPLAIN",`[v=\\s]*${l[u.MAINVERSIONLOOSE]}${l[u.PRERELEASELOOSE]}?${l[u.BUILD]}?`),w("LOOSE",`^${l[u.LOOSEPLAIN]}$`),w("GTLT","((?:<|>)?=?)"),w("XRANGEIDENTIFIERLOOSE",`${l[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),w("XRANGEIDENTIFIER",`${l[u.NUMERICIDENTIFIER]}|x|X|\\*`),w("XRANGEPLAIN",`[v=\\s]*(${l[u.XRANGEIDENTIFIER]})(?:\\.(${l[u.XRANGEIDENTIFIER]})(?:\\.(${l[u.XRANGEIDENTIFIER]})(?:${l[u.PRERELEASE]})?${l[u.BUILD]}?)?)?`),w("XRANGEPLAINLOOSE",`[v=\\s]*(${l[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[u.XRANGEIDENTIFIERLOOSE]})(?:${l[u.PRERELEASELOOSE]})?${l[u.BUILD]}?)?)?`),w("XRANGE",`^${l[u.GTLT]}\\s*${l[u.XRANGEPLAIN]}$`),w("XRANGELOOSE",`^${l[u.GTLT]}\\s*${l[u.XRANGEPLAINLOOSE]}$`),w("COERCEPLAIN",`(^|[^\\d])(\\d{1,${t}})(?:\\.(\\d{1,${t}}))?(?:\\.(\\d{1,${t}}))?`),w("COERCE",`${l[u.COERCEPLAIN]}(?:$|[^\\d])`),w("COERCEFULL",l[u.COERCEPLAIN]+`(?:${l[u.PRERELEASE]})?(?:${l[u.BUILD]})?(?:$|[^\\d])`),w("COERCERTL",l[u.COERCE],!0),w("COERCERTLFULL",l[u.COERCEFULL],!0),w("LONETILDE","(?:~>?)"),w("TILDETRIM",`(\\s*)${l[u.LONETILDE]}\\s+`,!0),e.tildeTrimReplace="$1~",w("TILDE",`^${l[u.LONETILDE]}${l[u.XRANGEPLAIN]}$`),w("TILDELOOSE",`^${l[u.LONETILDE]}${l[u.XRANGEPLAINLOOSE]}$`),w("LONECARET","(?:\\^)"),w("CARETTRIM",`(\\s*)${l[u.LONECARET]}\\s+`,!0),e.caretTrimReplace="$1^",w("CARET",`^${l[u.LONECARET]}${l[u.XRANGEPLAIN]}$`),w("CARETLOOSE",`^${l[u.LONECARET]}${l[u.XRANGEPLAINLOOSE]}$`),w("COMPARATORLOOSE",`^${l[u.GTLT]}\\s*(${l[u.LOOSEPLAIN]})$|^$`),w("COMPARATOR",`^${l[u.GTLT]}\\s*(${l[u.FULLPLAIN]})$|^$`),w("COMPARATORTRIM",`(\\s*)${l[u.GTLT]}\\s*(${l[u.LOOSEPLAIN]}|${l[u.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace="$1$2$3",w("HYPHENRANGE",`^\\s*(${l[u.XRANGEPLAIN]})\\s+-\\s+(${l[u.XRANGEPLAIN]})\\s*$`),w("HYPHENRANGELOOSE",`^\\s*(${l[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[u.XRANGEPLAINLOOSE]})\\s*$`),w("STAR","(<|>)?=?\\s*\\*"),w("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),w("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(sr,sr.exports)),sr.exports}var di,bo;function fi(){if(bo)return di;bo=1;const r=Object.freeze({loose:!0}),e=Object.freeze({});return di=n=>n?typeof n!="object"?r:n:e,di}var pi,wo;function Eo(){if(wo)return pi;wo=1;const r=/^[0-9]+$/,e=(n,i)=>{const o=r.test(n),s=r.test(i);return o&&s&&(n=+n,i=+i),n===i?0:o&&!s?-1:s&&!o?1:n<i?-1:1};return pi={compareIdentifiers:e,rcompareIdentifiers:(n,i)=>e(i,n)},pi}var gi,yo;function Le(){if(yo)return gi;yo=1;const r=ar(),{MAX_LENGTH:e,MAX_SAFE_INTEGER:t}=or(),{safeRe:n,t:i}=_n(),o=fi(),{compareIdentifiers:s}=Eo();class a{constructor(c,u){if(u=o(u),c instanceof a){if(c.loose===!!u.loose&&c.includePrerelease===!!u.includePrerelease)return c;c=c.version}else if(typeof c!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof c}".`);if(c.length>e)throw new TypeError(`version is longer than ${e} characters`);r("SemVer",c,u),this.options=u,this.loose=!!u.loose,this.includePrerelease=!!u.includePrerelease;const f=c.trim().match(u.loose?n[i.LOOSE]:n[i.FULL]);if(!f)throw new TypeError(`Invalid Version: ${c}`);if(this.raw=c,this.major=+f[1],this.minor=+f[2],this.patch=+f[3],this.major>t||this.major<0)throw new TypeError("Invalid major version");if(this.minor>t||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>t||this.patch<0)throw new TypeError("Invalid patch version");f[4]?this.prerelease=f[4].split(".").map(p=>{if(/^[0-9]+$/.test(p)){const E=+p;if(E>=0&&E<t)return E}return p}):this.prerelease=[],this.build=f[5]?f[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(c){if(r("SemVer.compare",this.version,this.options,c),!(c instanceof a)){if(typeof c=="string"&&c===this.version)return 0;c=new a(c,this.options)}return c.version===this.version?0:this.compareMain(c)||this.comparePre(c)}compareMain(c){return c instanceof a||(c=new a(c,this.options)),s(this.major,c.major)||s(this.minor,c.minor)||s(this.patch,c.patch)}comparePre(c){if(c instanceof a||(c=new a(c,this.options)),this.prerelease.length&&!c.prerelease.length)return-1;if(!this.prerelease.length&&c.prerelease.length)return 1;if(!this.prerelease.length&&!c.prerelease.length)return 0;let u=0;do{const f=this.prerelease[u],p=c.prerelease[u];if(r("prerelease compare",u,f,p),f===void 0&&p===void 0)return 0;if(p===void 0)return 1;if(f===void 0)return-1;if(f===p)continue;return s(f,p)}while(++u)}compareBuild(c){c instanceof a||(c=new a(c,this.options));let u=0;do{const f=this.build[u],p=c.build[u];if(r("build compare",u,f,p),f===void 0&&p===void 0)return 0;if(p===void 0)return 1;if(f===void 0)return-1;if(f===p)continue;return s(f,p)}while(++u)}inc(c,u,f){if(c.startsWith("pre")){if(!u&&f===!1)throw new Error("invalid increment argument: identifier is empty");if(u){const p=`-${u}`.match(this.options.loose?n[i.PRERELEASELOOSE]:n[i.PRERELEASE]);if(!p||p[1]!==u)throw new Error(`invalid identifier: ${u}`)}}switch(c){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",u,f);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",u,f);break;case"prepatch":this.prerelease.length=0,this.inc("patch",u,f),this.inc("pre",u,f);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",u,f),this.inc("pre",u,f);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const p=Number(f)?1:0;if(this.prerelease.length===0)this.prerelease=[p];else{let E=this.prerelease.length;for(;--E>=0;)typeof this.prerelease[E]=="number"&&(this.prerelease[E]++,E=-2);if(E===-1){if(u===this.prerelease.join(".")&&f===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(p)}}if(u){let E=[u,p];f===!1&&(E=[u]),s(this.prerelease[0],u)===0?isNaN(this.prerelease[1])&&(this.prerelease=E):this.prerelease=E}break}default:throw new Error(`invalid increment argument: ${c}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return gi=a,gi}var mi,vo;function Xt(){if(vo)return mi;vo=1;const r=Le();return mi=(t,n,i=!1)=>{if(t instanceof r)return t;try{return new r(t,n)}catch(o){if(!i)return null;throw o}},mi}var bi,ko;function yc(){if(ko)return bi;ko=1;const r=Xt();return bi=(t,n)=>{const i=r(t,n);return i?i.version:null},bi}var wi,So;function vc(){if(So)return wi;So=1;const r=Xt();return wi=(t,n)=>{const i=r(t.trim().replace(/^[=v]+/,""),n);return i?i.version:null},wi}var Ei,_o;function kc(){if(_o)return Ei;_o=1;const r=Le();return Ei=(t,n,i,o,s)=>{typeof i=="string"&&(s=o,o=i,i=void 0);try{return new r(t instanceof r?t.version:t,i).inc(n,o,s).version}catch{return null}},Ei}var yi,To;function Sc(){if(To)return yi;To=1;const r=Xt();return yi=(t,n)=>{const i=r(t,null,!0),o=r(n,null,!0),s=i.compare(o);if(s===0)return null;const a=s>0,l=a?i:o,c=a?o:i,u=!!l.prerelease.length;if(!!c.prerelease.length&&!u){if(!c.patch&&!c.minor)return"major";if(c.compareMain(l)===0)return c.minor&&!c.patch?"minor":"patch"}const p=u?"pre":"";return i.major!==o.major?p+"major":i.minor!==o.minor?p+"minor":i.patch!==o.patch?p+"patch":"prerelease"},yi}var vi,xo;function _c(){if(xo)return vi;xo=1;const r=Le();return vi=(t,n)=>new r(t,n).major,vi}var ki,Ro;function Tc(){if(Ro)return ki;Ro=1;const r=Le();return ki=(t,n)=>new r(t,n).minor,ki}var Si,Ao;function xc(){if(Ao)return Si;Ao=1;const r=Le();return Si=(t,n)=>new r(t,n).patch,Si}var _i,Co;function Rc(){if(Co)return _i;Co=1;const r=Xt();return _i=(t,n)=>{const i=r(t,n);return i&&i.prerelease.length?i.prerelease:null},_i}var Ti,Oo;function We(){if(Oo)return Ti;Oo=1;const r=Le();return Ti=(t,n,i)=>new r(t,i).compare(new r(n,i)),Ti}var xi,Io;function Ac(){if(Io)return xi;Io=1;const r=We();return xi=(t,n,i)=>r(n,t,i),xi}var Ri,Lo;function Cc(){if(Lo)return Ri;Lo=1;const r=We();return Ri=(t,n)=>r(t,n,!0),Ri}var Ai,No;function Ci(){if(No)return Ai;No=1;const r=Le();return Ai=(t,n,i)=>{const o=new r(t,i),s=new r(n,i);return o.compare(s)||o.compareBuild(s)},Ai}var Oi,Po;function Oc(){if(Po)return Oi;Po=1;const r=Ci();return Oi=(t,n)=>t.sort((i,o)=>r(i,o,n)),Oi}var Ii,$o;function Ic(){if($o)return Ii;$o=1;const r=Ci();return Ii=(t,n)=>t.sort((i,o)=>r(o,i,n)),Ii}var Li,Mo;function lr(){if(Mo)return Li;Mo=1;const r=We();return Li=(t,n,i)=>r(t,n,i)>0,Li}var Ni,Do;function Pi(){if(Do)return Ni;Do=1;const r=We();return Ni=(t,n,i)=>r(t,n,i)<0,Ni}var $i,Bo;function Uo(){if(Bo)return $i;Bo=1;const r=We();return $i=(t,n,i)=>r(t,n,i)===0,$i}var Mi,Vo;function zo(){if(Vo)return Mi;Vo=1;const r=We();return Mi=(t,n,i)=>r(t,n,i)!==0,Mi}var Di,Ho;function Bi(){if(Ho)return Di;Ho=1;const r=We();return Di=(t,n,i)=>r(t,n,i)>=0,Di}var Ui,Fo;function Vi(){if(Fo)return Ui;Fo=1;const r=We();return Ui=(t,n,i)=>r(t,n,i)<=0,Ui}var zi,qo;function jo(){if(qo)return zi;qo=1;const r=Uo(),e=zo(),t=lr(),n=Bi(),i=Pi(),o=Vi();return zi=(a,l,c,u)=>{switch(l){case"===":return typeof a=="object"&&(a=a.version),typeof c=="object"&&(c=c.version),a===c;case"!==":return typeof a=="object"&&(a=a.version),typeof c=="object"&&(c=c.version),a!==c;case"":case"=":case"==":return r(a,c,u);case"!=":return e(a,c,u);case">":return t(a,c,u);case">=":return n(a,c,u);case"<":return i(a,c,u);case"<=":return o(a,c,u);default:throw new TypeError(`Invalid operator: ${l}`)}},zi}var Hi,Go;function Lc(){if(Go)return Hi;Go=1;const r=Le(),e=Xt(),{safeRe:t,t:n}=_n();return Hi=(o,s)=>{if(o instanceof r)return o;if(typeof o=="number"&&(o=String(o)),typeof o!="string")return null;s=s||{};let a=null;if(!s.rtl)a=o.match(s.includePrerelease?t[n.COERCEFULL]:t[n.COERCE]);else{const E=s.includePrerelease?t[n.COERCERTLFULL]:t[n.COERCERTL];let T;for(;(T=E.exec(o))&&(!a||a.index+a[0].length!==o.length);)(!a||T.index+T[0].length!==a.index+a[0].length)&&(a=T),E.lastIndex=T.index+T[1].length+T[2].length;E.lastIndex=-1}if(a===null)return null;const l=a[2],c=a[3]||"0",u=a[4]||"0",f=s.includePrerelease&&a[5]?`-${a[5]}`:"",p=s.includePrerelease&&a[6]?`+${a[6]}`:"";return e(`${l}.${c}.${u}${f}${p}`,s)},Hi}var Fi,Wo;function Nc(){if(Wo)return Fi;Wo=1;class r{constructor(){this.max=1e3,this.map=new Map}get(t){const n=this.map.get(t);if(n!==void 0)return this.map.delete(t),this.map.set(t,n),n}delete(t){return this.map.delete(t)}set(t,n){if(!this.delete(t)&&n!==void 0){if(this.map.size>=this.max){const o=this.map.keys().next().value;this.delete(o)}this.map.set(t,n)}return this}}return Fi=r,Fi}var qi,Xo;function Xe(){if(Xo)return qi;Xo=1;const r=/\s+/g;class e{constructor(R,U){if(U=i(U),R instanceof e)return R.loose===!!U.loose&&R.includePrerelease===!!U.includePrerelease?R:new e(R.raw,U);if(R instanceof o)return this.raw=R.value,this.set=[[R]],this.formatted=void 0,this;if(this.options=U,this.loose=!!U.loose,this.includePrerelease=!!U.includePrerelease,this.raw=R.trim().replace(r," "),this.set=this.raw.split("||").map(N=>this.parseRange(N.trim())).filter(N=>N.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const N=this.set[0];if(this.set=this.set.filter($=>!w($[0])),this.set.length===0)this.set=[N];else if(this.set.length>1){for(const $ of this.set)if($.length===1&&V($[0])){this.set=[$];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let R=0;R<this.set.length;R++){R>0&&(this.formatted+="||");const U=this.set[R];for(let N=0;N<U.length;N++)N>0&&(this.formatted+=" "),this.formatted+=U[N].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(R){const N=((this.options.includePrerelease&&E)|(this.options.loose&&T))+":"+R,$=n.get(N);if($)return $;const P=this.options.loose,q=P?l[c.HYPHENRANGELOOSE]:l[c.HYPHENRANGE];R=R.replace(q,ft(this.options.includePrerelease)),s("hyphen replace",R),R=R.replace(l[c.COMPARATORTRIM],u),s("comparator trim",R),R=R.replace(l[c.TILDETRIM],f),s("tilde trim",R),R=R.replace(l[c.CARETTRIM],p),s("caret trim",R);let z=R.split(" ").map(X=>ie(X,this.options)).join(" ").split(/\s+/).map(X=>Ee(X,this.options));P&&(z=z.filter(X=>(s("loose invalid filter",X,this.options),!!X.match(l[c.COMPARATORLOOSE])))),s("range list",z);const Y=new Map,G=z.map(X=>new o(X,this.options));for(const X of G){if(w(X))return[X];Y.set(X.value,X)}Y.size>1&&Y.has("")&&Y.delete("");const ke=[...Y.values()];return n.set(N,ke),ke}intersects(R,U){if(!(R instanceof e))throw new TypeError("a Range is required");return this.set.some(N=>Z(N,U)&&R.set.some($=>Z($,U)&&N.every(P=>$.every(q=>P.intersects(q,U)))))}test(R){if(!R)return!1;if(typeof R=="string")try{R=new a(R,this.options)}catch{return!1}for(let U=0;U<this.set.length;U++)if(pt(this.set[U],R,this.options))return!0;return!1}}qi=e;const t=Nc(),n=new t,i=fi(),o=cr(),s=ar(),a=Le(),{safeRe:l,t:c,comparatorTrimReplace:u,tildeTrimReplace:f,caretTrimReplace:p}=_n(),{FLAG_INCLUDE_PRERELEASE:E,FLAG_LOOSE:T}=or(),w=A=>A.value==="<0.0.0-0",V=A=>A.value==="",Z=(A,R)=>{let U=!0;const N=A.slice();let $=N.pop();for(;U&&N.length;)U=N.every(P=>$.intersects(P,R)),$=N.pop();return U},ie=(A,R)=>(s("comp",A,R),A=se(A,R),s("caret",A),A=ne(A,R),s("tildes",A),A=F(A,R),s("xrange",A),A=kt(A,R),s("stars",A),A),Q=A=>!A||A.toLowerCase()==="x"||A==="*",ne=(A,R)=>A.trim().split(/\s+/).map(U=>pe(U,R)).join(" "),pe=(A,R)=>{const U=R.loose?l[c.TILDELOOSE]:l[c.TILDE];return A.replace(U,(N,$,P,q,z)=>{s("tilde",A,N,$,P,q,z);let Y;return Q($)?Y="":Q(P)?Y=`>=${$}.0.0 <${+$+1}.0.0-0`:Q(q)?Y=`>=${$}.${P}.0 <${$}.${+P+1}.0-0`:z?(s("replaceTilde pr",z),Y=`>=${$}.${P}.${q}-${z} <${$}.${+P+1}.0-0`):Y=`>=${$}.${P}.${q} <${$}.${+P+1}.0-0`,s("tilde return",Y),Y})},se=(A,R)=>A.trim().split(/\s+/).map(U=>ae(U,R)).join(" "),ae=(A,R)=>{s("caret",A,R);const U=R.loose?l[c.CARETLOOSE]:l[c.CARET],N=R.includePrerelease?"-0":"";return A.replace(U,($,P,q,z,Y)=>{s("caret",A,$,P,q,z,Y);let G;return Q(P)?G="":Q(q)?G=`>=${P}.0.0${N} <${+P+1}.0.0-0`:Q(z)?P==="0"?G=`>=${P}.${q}.0${N} <${P}.${+q+1}.0-0`:G=`>=${P}.${q}.0${N} <${+P+1}.0.0-0`:Y?(s("replaceCaret pr",Y),P==="0"?q==="0"?G=`>=${P}.${q}.${z}-${Y} <${P}.${q}.${+z+1}-0`:G=`>=${P}.${q}.${z}-${Y} <${P}.${+q+1}.0-0`:G=`>=${P}.${q}.${z}-${Y} <${+P+1}.0.0-0`):(s("no pr"),P==="0"?q==="0"?G=`>=${P}.${q}.${z}${N} <${P}.${q}.${+z+1}-0`:G=`>=${P}.${q}.${z}${N} <${P}.${+q+1}.0-0`:G=`>=${P}.${q}.${z} <${+P+1}.0.0-0`),s("caret return",G),G})},F=(A,R)=>(s("replaceXRanges",A,R),A.split(/\s+/).map(U=>tt(U,R)).join(" ")),tt=(A,R)=>{A=A.trim();const U=R.loose?l[c.XRANGELOOSE]:l[c.XRANGE];return A.replace(U,(N,$,P,q,z,Y)=>{s("xRange",A,N,$,P,q,z,Y);const G=Q(P),ke=G||Q(q),X=ke||Q(z),Me=X;return $==="="&&Me&&($=""),Y=R.includePrerelease?"-0":"",G?$===">"||$==="<"?N="<0.0.0-0":N="*":$&&Me?(ke&&(q=0),z=0,$===">"?($=">=",ke?(P=+P+1,q=0,z=0):(q=+q+1,z=0)):$==="<="&&($="<",ke?P=+P+1:q=+q+1),$==="<"&&(Y="-0"),N=`${$+P}.${q}.${z}${Y}`):ke?N=`>=${P}.0.0${Y} <${+P+1}.0.0-0`:X&&(N=`>=${P}.${q}.0${Y} <${P}.${+q+1}.0-0`),s("xRange return",N),N})},kt=(A,R)=>(s("replaceStars",A,R),A.trim().replace(l[c.STAR],"")),Ee=(A,R)=>(s("replaceGTE0",A,R),A.trim().replace(l[R.includePrerelease?c.GTE0PRE:c.GTE0],"")),ft=A=>(R,U,N,$,P,q,z,Y,G,ke,X,Me)=>(Q(N)?U="":Q($)?U=`>=${N}.0.0${A?"-0":""}`:Q(P)?U=`>=${N}.${$}.0${A?"-0":""}`:q?U=`>=${U}`:U=`>=${U}${A?"-0":""}`,Q(G)?Y="":Q(ke)?Y=`<${+G+1}.0.0-0`:Q(X)?Y=`<${G}.${+ke+1}.0-0`:Me?Y=`<=${G}.${ke}.${X}-${Me}`:A?Y=`<${G}.${ke}.${+X+1}-0`:Y=`<=${Y}`,`${U} ${Y}`.trim()),pt=(A,R,U)=>{for(let N=0;N<A.length;N++)if(!A[N].test(R))return!1;if(R.prerelease.length&&!U.includePrerelease){for(let N=0;N<A.length;N++)if(s(A[N].semver),A[N].semver!==o.ANY&&A[N].semver.prerelease.length>0){const $=A[N].semver;if($.major===R.major&&$.minor===R.minor&&$.patch===R.patch)return!0}return!1}return!0};return qi}var ji,Yo;function cr(){if(Yo)return ji;Yo=1;const r=Symbol("SemVer ANY");class e{static get ANY(){return r}constructor(u,f){if(f=t(f),u instanceof e){if(u.loose===!!f.loose)return u;u=u.value}u=u.trim().split(/\s+/).join(" "),s("comparator",u,f),this.options=f,this.loose=!!f.loose,this.parse(u),this.semver===r?this.value="":this.value=this.operator+this.semver.version,s("comp",this)}parse(u){const f=this.options.loose?n[i.COMPARATORLOOSE]:n[i.COMPARATOR],p=u.match(f);if(!p)throw new TypeError(`Invalid comparator: ${u}`);this.operator=p[1]!==void 0?p[1]:"",this.operator==="="&&(this.operator=""),p[2]?this.semver=new a(p[2],this.options.loose):this.semver=r}toString(){return this.value}test(u){if(s("Comparator.test",u,this.options.loose),this.semver===r||u===r)return!0;if(typeof u=="string")try{u=new a(u,this.options)}catch{return!1}return o(u,this.operator,this.semver,this.options)}intersects(u,f){if(!(u instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new l(u.value,f).test(this.value):u.operator===""?u.value===""?!0:new l(this.value,f).test(u.semver):(f=t(f),f.includePrerelease&&(this.value==="<0.0.0-0"||u.value==="<0.0.0-0")||!f.includePrerelease&&(this.value.startsWith("<0.0.0")||u.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&u.operator.startsWith(">")||this.operator.startsWith("<")&&u.operator.startsWith("<")||this.semver.version===u.semver.version&&this.operator.includes("=")&&u.operator.includes("=")||o(this.semver,"<",u.semver,f)&&this.operator.startsWith(">")&&u.operator.startsWith("<")||o(this.semver,">",u.semver,f)&&this.operator.startsWith("<")&&u.operator.startsWith(">")))}}ji=e;const t=fi(),{safeRe:n,t:i}=_n(),o=jo(),s=ar(),a=Le(),l=Xe();return ji}var Gi,Ko;function ur(){if(Ko)return Gi;Ko=1;const r=Xe();return Gi=(t,n,i)=>{try{n=new r(n,i)}catch{return!1}return n.test(t)},Gi}var Wi,Zo;function Pc(){if(Zo)return Wi;Zo=1;const r=Xe();return Wi=(t,n)=>new r(t,n).set.map(i=>i.map(o=>o.value).join(" ").trim().split(" ")),Wi}var Xi,Qo;function $c(){if(Qo)return Xi;Qo=1;const r=Le(),e=Xe();return Xi=(n,i,o)=>{let s=null,a=null,l=null;try{l=new e(i,o)}catch{return null}return n.forEach(c=>{l.test(c)&&(!s||a.compare(c)===-1)&&(s=c,a=new r(s,o))}),s},Xi}var Yi,Jo;function Mc(){if(Jo)return Yi;Jo=1;const r=Le(),e=Xe();return Yi=(n,i,o)=>{let s=null,a=null,l=null;try{l=new e(i,o)}catch{return null}return n.forEach(c=>{l.test(c)&&(!s||a.compare(c)===1)&&(s=c,a=new r(s,o))}),s},Yi}var Ki,ea;function Dc(){if(ea)return Ki;ea=1;const r=Le(),e=Xe(),t=lr();return Ki=(i,o)=>{i=new e(i,o);let s=new r("0.0.0");if(i.test(s)||(s=new r("0.0.0-0"),i.test(s)))return s;s=null;for(let a=0;a<i.set.length;++a){const l=i.set[a];let c=null;l.forEach(u=>{const f=new r(u.semver.version);switch(u.operator){case">":f.prerelease.length===0?f.patch++:f.prerelease.push(0),f.raw=f.format();case"":case">=":(!c||t(f,c))&&(c=f);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${u.operator}`)}}),c&&(!s||t(s,c))&&(s=c)}return s&&i.test(s)?s:null},Ki}var Zi,ta;function Bc(){if(ta)return Zi;ta=1;const r=Xe();return Zi=(t,n)=>{try{return new r(t,n).range||"*"}catch{return null}},Zi}var Qi,na;function Ji(){if(na)return Qi;na=1;const r=Le(),e=cr(),{ANY:t}=e,n=Xe(),i=ur(),o=lr(),s=Pi(),a=Vi(),l=Bi();return Qi=(u,f,p,E)=>{u=new r(u,E),f=new n(f,E);let T,w,V,Z,ie;switch(p){case">":T=o,w=a,V=s,Z=">",ie=">=";break;case"<":T=s,w=l,V=o,Z="<",ie="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(i(u,f,E))return!1;for(let Q=0;Q<f.set.length;++Q){const ne=f.set[Q];let pe=null,se=null;if(ne.forEach(ae=>{ae.semver===t&&(ae=new e(">=0.0.0")),pe=pe||ae,se=se||ae,T(ae.semver,pe.semver,E)?pe=ae:V(ae.semver,se.semver,E)&&(se=ae)}),pe.operator===Z||pe.operator===ie||(!se.operator||se.operator===Z)&&w(u,se.semver))return!1;if(se.operator===ie&&V(u,se.semver))return!1}return!0},Qi}var es,ra;function Uc(){if(ra)return es;ra=1;const r=Ji();return es=(t,n,i)=>r(t,n,">",i),es}var ts,ia;function Vc(){if(ia)return ts;ia=1;const r=Ji();return ts=(t,n,i)=>r(t,n,"<",i),ts}var ns,sa;function zc(){if(sa)return ns;sa=1;const r=Xe();return ns=(t,n,i)=>(t=new r(t,i),n=new r(n,i),t.intersects(n,i)),ns}var rs,oa;function Hc(){if(oa)return rs;oa=1;const r=ur(),e=We();return rs=(t,n,i)=>{const o=[];let s=null,a=null;const l=t.sort((p,E)=>e(p,E,i));for(const p of l)r(p,n,i)?(a=p,s||(s=p)):(a&&o.push([s,a]),a=null,s=null);s&&o.push([s,null]);const c=[];for(const[p,E]of o)p===E?c.push(p):!E&&p===l[0]?c.push("*"):E?p===l[0]?c.push(`<=${E}`):c.push(`${p} - ${E}`):c.push(`>=${p}`);const u=c.join(" || "),f=typeof n.raw=="string"?n.raw:String(n);return u.length<f.length?u:n},rs}var is,aa;function Fc(){if(aa)return is;aa=1;const r=Xe(),e=cr(),{ANY:t}=e,n=ur(),i=We(),o=(f,p,E={})=>{if(f===p)return!0;f=new r(f,E),p=new r(p,E);let T=!1;e:for(const w of f.set){for(const V of p.set){const Z=l(w,V,E);if(T=T||Z!==null,Z)continue e}if(T)return!1}return!0},s=[new e(">=0.0.0-0")],a=[new e(">=0.0.0")],l=(f,p,E)=>{if(f===p)return!0;if(f.length===1&&f[0].semver===t){if(p.length===1&&p[0].semver===t)return!0;E.includePrerelease?f=s:f=a}if(p.length===1&&p[0].semver===t){if(E.includePrerelease)return!0;p=a}const T=new Set;let w,V;for(const F of f)F.operator===">"||F.operator===">="?w=c(w,F,E):F.operator==="<"||F.operator==="<="?V=u(V,F,E):T.add(F.semver);if(T.size>1)return null;let Z;if(w&&V){if(Z=i(w.semver,V.semver,E),Z>0)return null;if(Z===0&&(w.operator!==">="||V.operator!=="<="))return null}for(const F of T){if(w&&!n(F,String(w),E)||V&&!n(F,String(V),E))return null;for(const tt of p)if(!n(F,String(tt),E))return!1;return!0}let ie,Q,ne,pe,se=V&&!E.includePrerelease&&V.semver.prerelease.length?V.semver:!1,ae=w&&!E.includePrerelease&&w.semver.prerelease.length?w.semver:!1;se&&se.prerelease.length===1&&V.operator==="<"&&se.prerelease[0]===0&&(se=!1);for(const F of p){if(pe=pe||F.operator===">"||F.operator===">=",ne=ne||F.operator==="<"||F.operator==="<=",w){if(ae&&F.semver.prerelease&&F.semver.prerelease.length&&F.semver.major===ae.major&&F.semver.minor===ae.minor&&F.semver.patch===ae.patch&&(ae=!1),F.operator===">"||F.operator===">="){if(ie=c(w,F,E),ie===F&&ie!==w)return!1}else if(w.operator===">="&&!n(w.semver,String(F),E))return!1}if(V){if(se&&F.semver.prerelease&&F.semver.prerelease.length&&F.semver.major===se.major&&F.semver.minor===se.minor&&F.semver.patch===se.patch&&(se=!1),F.operator==="<"||F.operator==="<="){if(Q=u(V,F,E),Q===F&&Q!==V)return!1}else if(V.operator==="<="&&!n(V.semver,String(F),E))return!1}if(!F.operator&&(V||w)&&Z!==0)return!1}return!(w&&ne&&!V&&Z!==0||V&&pe&&!w&&Z!==0||ae||se)},c=(f,p,E)=>{if(!f)return p;const T=i(f.semver,p.semver,E);return T>0?f:T<0||p.operator===">"&&f.operator===">="?p:f},u=(f,p,E)=>{if(!f)return p;const T=i(f.semver,p.semver,E);return T<0?f:T>0||p.operator==="<"&&f.operator==="<="?p:f};return is=o,is}var ss,la;function qc(){if(la)return ss;la=1;const r=_n(),e=or(),t=Le(),n=Eo(),i=Xt(),o=yc(),s=vc(),a=kc(),l=Sc(),c=_c(),u=Tc(),f=xc(),p=Rc(),E=We(),T=Ac(),w=Cc(),V=Ci(),Z=Oc(),ie=Ic(),Q=lr(),ne=Pi(),pe=Uo(),se=zo(),ae=Bi(),F=Vi(),tt=jo(),kt=Lc(),Ee=cr(),ft=Xe(),pt=ur(),A=Pc(),R=$c(),U=Mc(),N=Dc(),$=Bc(),P=Ji(),q=Uc(),z=Vc(),Y=zc(),G=Hc(),ke=Fc();return ss={parse:i,valid:o,clean:s,inc:a,diff:l,major:c,minor:u,patch:f,prerelease:p,compare:E,rcompare:T,compareLoose:w,compareBuild:V,sort:Z,rsort:ie,gt:Q,lt:ne,eq:pe,neq:se,gte:ae,lte:F,cmp:tt,coerce:kt,Comparator:Ee,Range:ft,satisfies:pt,toComparators:A,maxSatisfying:R,minSatisfying:U,minVersion:N,validRange:$,outside:P,gtr:q,ltr:z,intersects:Y,simplifyRange:G,subset:ke,SemVer:t,re:r.re,src:r.src,tokens:r.t,SEMVER_SPEC_VERSION:e.SEMVER_SPEC_VERSION,RELEASE_TYPES:e.RELEASE_TYPES,compareIdentifiers:n.compareIdentifiers,rcompareIdentifiers:n.rcompareIdentifiers},ss}var os=qc();class jc{constructor(e){this.onEventCallback=e,this.events=[]}push(e){this.events.push(e),this.onEventCallback(e)}}function re(r,e){switch(r.op){case"reg":{if(!(r.id in e.graphRegisters))throw new Error(`Graph Register '${r.id}' not found`);return e.graphRegisters[r.id]}case"local":{if(!(r.name in e.localVariables))throw new Error(`Local variable '${r.name}' not found`);return e.localVariables[r.name]}case"la":return e.lastAction;case"gli":{const t=re(r.list,e);if(!Array.isArray(t))throw new Error(`gli: list must be array, got '${typeof t}'`);const n=re(r.index,e);if(typeof n!="number")throw new Error(`gli: index must be number, got '${typeof n}'`);if(n<0||n>=t.length)throw new Error(`gli: index out of bounds, got index ${n} for list of length ${t.length}`);return t[n]}case"gdv":{const t=re(r.d,e);if(typeof t!="object"||t===null||Array.isArray(t))throw new Error(`gdv: dict must be object, got '${typeof t}'`);const n=re(r.key,e);if(typeof n!="string")throw new Error(`gdv: key must be string, got '${typeof n}'`);if(!(n in t))throw new Error(`gdv: key '${n}' not found in dict`);return t[n]}case"lit":return r.value;case"if":return re(r.cond,e)?re(r.then,e):re(r.otherwise,e);case"not":return!re(r.operand,e);case"and":{for(const t of r.args){const n=re(t,e);if(typeof n!="boolean")throw new Error(`and: all args must be boolean, got '${typeof n}'`);if(!n)return!1}return!0}case"or":{for(const t of r.args){const n=re(t,e);if(typeof n!="boolean")throw new Error(`or: all args must be boolean, got '${typeof n}'`);if(n)return!0}return!1}case"eq":{const t=re(r.lhs,e),n=re(r.rhs,e);return t===n}case"ne":{const t=re(r.lhs,e),n=re(r.rhs,e);return t!==n}case"gt":case"ge":case"lt":case"le":{const t=re(r.lhs,e),n=re(r.rhs,e);if(typeof t!=typeof n)throw new Error(`${r.op}: lhs and rhs must have same type, got '${typeof t}' and '${typeof n}'`);if(typeof t!="number"&&typeof t!="string")throw new Error(`${r.op}: only number or string comparison supported, got '${typeof t}'`);switch(r.op){case"gt":return t>n;case"ge":return t>=n;case"lt":return t<n;case"le":return t<=n;default:const i=r;throw new Error(`Unsupported comparator op: ${i.op}`)}}case"add":case"sub":case"mul":case"div":{const t=re(r.lhs,e),n=re(r.rhs,e);if(typeof t!="number"||typeof n!="number")throw new Error(`${r.op}: operands must be numbers, got '${typeof t}' and '${typeof n}'`);switch(r.op){case"add":return t+n;case"sub":return t-n;case"mul":return t*n;case"div":if(n===0)throw new Error("div: division by zero");return t/n;default:const i=r;throw new Error(`Unsupported arithmetic op: ${i.op}`)}}case"append":{const t=re(r.array,e);if(!Array.isArray(t))throw new Error(`append: array must be array, got '${typeof t}'`);const n=re(r.value,e);return[...t,n]}case"concat":{const t=re(r.array,e);if(!Array.isArray(t))throw new Error(`concat: array must be array, got '${typeof t}'`);const n=re(r.value,e);if(!Array.isArray(n))throw new Error(`concat: value must be array, got '${typeof n}'`);return[...t,...n]}case"slice":{const t=re(r.array,e);if(!Array.isArray(t))throw new Error(`slice: array must be array, got '${typeof t}'`);const n=re(r.start,e);if(typeof n!="number")throw new Error(`slice: start must be number, got '${typeof n}'`);let i;if(r.end!==null){const o=re(r.end,e);if(typeof o!="number")throw new Error(`slice: end must be number, got '${typeof o}'`);i=o}return t.slice(n,i)}case"map":{const t=re(r.array,e);if(!Array.isArray(t))throw new Error(`map: array must be array, got '${typeof t}'`);const n=r.cur,i=e.localVariables;return t.map(o=>re(r.func,{...e,localVariables:{...i,[n]:o}}))}case"filter":{const t=re(r.array,e);if(!Array.isArray(t))throw new Error(`filter: array must be array, got '${typeof t}'`);const n=r.cur,i=e.localVariables,o=[];for(const s of t){const a=re(r.predicate,{...e,localVariables:{...i,[n]:s}});if(typeof a!="boolean")throw new Error(`filter: predicate must be boolean, got '${typeof a}'`);a&&o.push(s)}return o}case"fold":{const t=re(r.array,e);if(!Array.isArray(t))throw new Error(`fold: array must be array, got '${typeof t}'`);let n=re(r.init,e);const i=r.acc,o=r.cur,s=e.localVariables;for(const a of t)n=re(r.func,{...e,localVariables:{...s,[i]:n,[o]:a}});return n}default:{const t=r;throw new Error(`Unsupported expression op: ${t.op}`)}}}function Tn(r){const{transition:e,registers:t,lastAction:n}=r;switch(e.transition_type){case"Go":{const o={};for(const[s,a]of Object.entries(e.register_updates))o[s]=re(a,{graphRegisters:t,localVariables:{},lastAction:n});return{nextNodeId:e.to,registerUpdates:o}}case"End":return{nextNodeId:null,registerUpdates:{}};case"IfThenElse":return re(e.if,{graphRegisters:t,localVariables:{},lastAction:n})?Tn({transition:e.then,registers:t,lastAction:n}):Tn({transition:e.else,registers:t,lastAction:n});case"Switch":{const o=re(e.on,{graphRegisters:t,localVariables:{},lastAction:n});for(const[s,a]of e.cases.entries())if(o===s)return Tn({transition:a,registers:t,lastAction:n});return Tn({transition:e.default,registers:t,lastAction:n})}default:const i=e;throw new Error(`Unhandled transition: ${JSON.stringify(i)}`)}}async function Gc(r,e=n=>{},t=!1){const n=new ga;n.start();const i=new jc(e),o=Oa(),s=new Ga;o.appendChild(s.root);const a=Wa();if(o.appendChild(a),os.gt(r.nodekit_version,ir)||os.major(r.nodekit_version)!==os.major(ir))throw new Error(`Incompatible NodeKit version requested: ${r.nodekit_version}, Runtime version: ${ir}`);if(!Ca()){const T=new Error("Unsupported device for NodeKit. Please use a desktop browser.");throw s.showErrorOverlay(T),T}s.showSessionConnectingOverlay();const l=new Ia;s.hideSessionConnectingOverlay(),t||await s.playStartScreen();const c={event_type:"TraceStartedEvent",t:0};i.push(c);function u(){if(document.visibilityState==="hidden"){const T={event_type:"PageSuspendedEvent",t:n.now()};i.push(T)}else if(document.visibilityState==="visible"){const T={event_type:"PageResumedEvent",t:n.now()};i.push(T)}}document.addEventListener("visibilitychange",u);const f=ma(n);i.push(f),await ca(r,"",{eventArray:i,boardViewsContainerDiv:a,assetManager:l,clock:n});const p={event_type:"TraceEndedEvent",t:n.now()};i.push(p),document.removeEventListener("visibilitychange",u);const E={nodekit_version:ir,events:i.events};return await s.playEndScreen(),s.showConsoleMessageOverlay("Trace",E),E}async function ca(r,e,t){const n=r.nodes,i=a=>e+a;let o=r.start,s=null;for(;;){const a=n[o];if(a.type==="Graph")s=await ca(a,o+"/",t);else if(a.type==="Node"){const f=new Ec(i(o),a,t.assetManager,t.clock,t.eventArray);t.boardViewsContainerDiv.appendChild(f.root),await f.prepare(),s=await f.run()}else throw new Error(`Unknown node type: ${a.type}`);for(;t.boardViewsContainerDiv.firstChild;)t.boardViewsContainerDiv.removeChild(t.boardViewsContainerDiv.firstChild);if(!(o in r.transitions))break;let l=null;const c=r.transitions[o],u=Tn({transition:c,registers:r.registers,lastAction:s});if(l=u.nextNodeId,l===null)break;o=l;for(const[f,p]of Object.entries(u.registerUpdates))r.registers[f]=p}return s}return _r.play=Gc,Object.defineProperty(_r,Symbol.toStringTag,{value:"Module"}),_r})({});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
__all__ = [
|
|
2
|
+
"Action",
|
|
3
|
+
"ClickAction",
|
|
4
|
+
"KeyAction",
|
|
5
|
+
"SliderAction",
|
|
6
|
+
"TextEntryAction",
|
|
7
|
+
"WaitAction",
|
|
8
|
+
"SelectAction",
|
|
9
|
+
"MultiSelectAction",
|
|
10
|
+
"ProductAction",
|
|
11
|
+
"SumAction",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
from nodekit._internal.types.actions.actions import (
|
|
15
|
+
Action,
|
|
16
|
+
ClickAction,
|
|
17
|
+
KeyAction,
|
|
18
|
+
SliderAction,
|
|
19
|
+
TextEntryAction,
|
|
20
|
+
WaitAction,
|
|
21
|
+
SelectAction,
|
|
22
|
+
MultiSelectAction,
|
|
23
|
+
ProductAction,
|
|
24
|
+
SumAction,
|
|
25
|
+
)
|