@kizenapps/cli 0.12.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/LICENSE.md +674 -0
  2. package/README.md +42 -0
  3. package/dist/index.js +89 -1986
  4. package/dist/index.js.map +1 -1
  5. package/dist/viewer/assets/AppDetailPage-D4r3W5v5.js +1 -0
  6. package/dist/viewer/assets/BootstrapContext-D5ZnMrOp.js +1 -0
  7. package/dist/viewer/assets/Card-BpDJPrPZ.js +1 -0
  8. package/dist/viewer/assets/CodeStepsPage-BzaaN9Kb.js +1 -0
  9. package/dist/viewer/assets/CodeViewer-Ce2qKSWi.js +4 -0
  10. package/dist/viewer/assets/ConfigurationPage-DyGQQTe-.js +1 -0
  11. package/dist/viewer/assets/DevSidebar-h9gYdctz.js +1 -0
  12. package/dist/viewer/assets/IconReferencePage-BLciUKH9.js +1 -0
  13. package/dist/viewer/assets/SandboxPage-IYn-KIbv.js +1 -0
  14. package/dist/viewer/assets/SidebarContext-Cn8QRb77.js +1 -0
  15. package/dist/viewer/assets/SourceBrowserPage-BOlm36Dg.js +1 -0
  16. package/dist/viewer/assets/Tooltip-tpqNw0op.js +1 -0
  17. package/dist/viewer/assets/VersionsPage-C02dpN3Y.js +1 -0
  18. package/dist/viewer/assets/WhenBadge-GxhTQKsq.js +1 -0
  19. package/dist/viewer/assets/api-C5Iu-4AS.js +1 -0
  20. package/dist/viewer/assets/bundleQuery-CjbA01rb.js +1 -0
  21. package/dist/viewer/assets/configStorage-BnMh081m.js +10 -0
  22. package/dist/viewer/assets/{fa-core-wsCxaNB7.js → fa-core-BoBqCOD3.js} +1 -1
  23. package/dist/viewer/assets/index-CjU7OUke.js +5 -0
  24. package/dist/viewer/assets/index-dW-Omils.css +2 -0
  25. package/dist/viewer/assets/{react-CkuOm_dq.js → react-csXWLXSE.js} +1 -1
  26. package/dist/viewer/assets/{recordDetail.worker-BIHPFt8Y.js → recordDetail.worker-C0-mQTaj.js} +1 -1
  27. package/dist/viewer/assets/storageKeys-ClzdCxlg.js +1 -0
  28. package/dist/viewer/assets/useCriticalExceptionDialog-DK8ufamu.js +5 -0
  29. package/dist/viewer/assets/{useLocalStorage-BWwvt0nG.js → useLocalStorage-B73GyZbK.js} +1 -1
  30. package/dist/viewer/assets/{useNavigate-9J1ZzN1J.js → useNavigate-BblEmQ3O.js} +1 -1
  31. package/dist/viewer/assets/useQuery-5OkVbV1s.js +1 -0
  32. package/dist/viewer/assets/{validIcons-UmfwFGTT.js → validIcons-BzGQ4tWD.js} +1 -1
  33. package/dist/viewer/index.html +12 -10
  34. package/package.json +5 -7
  35. package/dist/chunk-4Z6S6LWP.js +0 -6134
  36. package/dist/chunk-4Z6S6LWP.js.map +0 -1
  37. package/dist/chunk-HJPLDI45.js +0 -6134
  38. package/dist/chunk-HJPLDI45.js.map +0 -1
  39. package/dist/chunk-LSHHXCC6.js +0 -3639
  40. package/dist/chunk-LSHHXCC6.js.map +0 -1
  41. package/dist/chunk-SEGVTWSK.js +0 -44
  42. package/dist/chunk-SEGVTWSK.js.map +0 -1
  43. package/dist/chunk-ZWE3DS7E.js +0 -39
  44. package/dist/chunk-ZWE3DS7E.js.map +0 -1
  45. package/dist/devtools-LZRAH4XS.js +0 -90
  46. package/dist/devtools-LZRAH4XS.js.map +0 -1
  47. package/dist/dist-C3F6UOWF.js +0 -8472
  48. package/dist/dist-C3F6UOWF.js.map +0 -1
  49. package/dist/dist-NUJOSN7W.js +0 -8472
  50. package/dist/dist-NUJOSN7W.js.map +0 -1
  51. package/dist/dist-QHDMIBVE.js +0 -135
  52. package/dist/dist-QHDMIBVE.js.map +0 -1
  53. package/dist/dist-ZIZQOSY3.js +0 -135
  54. package/dist/dist-ZIZQOSY3.js.map +0 -1
  55. package/dist/gzip-size-K37OQCQ2.js +0 -137
  56. package/dist/gzip-size-K37OQCQ2.js.map +0 -1
  57. package/dist/gzip-size-QRGIYYEQ.js +0 -137
  58. package/dist/gzip-size-QRGIYYEQ.js.map +0 -1
  59. package/dist/viewer/assets/AppDetailPage-BPvWscWJ.js +0 -1
  60. package/dist/viewer/assets/AppDetailPage-DIuYKCTQ.js +0 -1
  61. package/dist/viewer/assets/AppDetailPage-r3jzO9Kf.js +0 -1
  62. package/dist/viewer/assets/BootstrapContext-CExPp3R2.js +0 -1
  63. package/dist/viewer/assets/BootstrapContext-CTQMWXf-.js +0 -1
  64. package/dist/viewer/assets/BootstrapContext-DbnbWmQT.js +0 -1
  65. package/dist/viewer/assets/Card-Bmn1HMWl.js +0 -1
  66. package/dist/viewer/assets/Card-DMz6T3VL.js +0 -1
  67. package/dist/viewer/assets/Card-DsqKctyM.js +0 -1
  68. package/dist/viewer/assets/CodeStepsPage-BHqLfCdV.js +0 -4
  69. package/dist/viewer/assets/CodeStepsPage-BymhEfzO.js +0 -4
  70. package/dist/viewer/assets/CodeStepsPage-CD_MhDwY.js +0 -4
  71. package/dist/viewer/assets/CodeStepsPage-CgI-LqEx.js +0 -4
  72. package/dist/viewer/assets/CodeStepsPage-Dak3saZE.js +0 -5
  73. package/dist/viewer/assets/CodeStepsPage-Zj6DscGd.js +0 -4
  74. package/dist/viewer/assets/ConfigurationPage-Cjy9TH3N.js +0 -1
  75. package/dist/viewer/assets/ConfigurationPage-DmX-6MM-.js +0 -1
  76. package/dist/viewer/assets/ConfigurationPage-J56kCD_e.js +0 -1
  77. package/dist/viewer/assets/CredentialsContext-Xbse1T0q.js +0 -1
  78. package/dist/viewer/assets/CredentialsContext-zl2e9kpM.js +0 -1
  79. package/dist/viewer/assets/DevSidebar-B30mgxSn.js +0 -1
  80. package/dist/viewer/assets/DevSidebar-BhTD2bBO.js +0 -1
  81. package/dist/viewer/assets/DevSidebar-CsEdCTej.js +0 -1
  82. package/dist/viewer/assets/IconReferencePage-B6j9wlte.js +0 -1
  83. package/dist/viewer/assets/IconReferencePage-CJa9yg9Z.js +0 -1
  84. package/dist/viewer/assets/IconReferencePage-Q5I-lMFQ.js +0 -1
  85. package/dist/viewer/assets/SandboxPage-C0h7GUkw.js +0 -1
  86. package/dist/viewer/assets/SandboxPage-GDcydJnJ.js +0 -1
  87. package/dist/viewer/assets/SandboxPage-JREBQ4id.js +0 -1
  88. package/dist/viewer/assets/SidebarContext-BPkYyxET.js +0 -1
  89. package/dist/viewer/assets/SidebarContext-DVDXFWJI.js +0 -1
  90. package/dist/viewer/assets/SidebarContext-HucmR353.js +0 -1
  91. package/dist/viewer/assets/VersionsPage-B76eugMm.js +0 -1
  92. package/dist/viewer/assets/VersionsPage-BIpB0iBz.js +0 -1
  93. package/dist/viewer/assets/VersionsPage-D0qenxK5.js +0 -1
  94. package/dist/viewer/assets/api-BOqcXygX.js +0 -1
  95. package/dist/viewer/assets/api-DqAiw0w9.js +0 -1
  96. package/dist/viewer/assets/bundleQuery-206rQR6g.js +0 -1
  97. package/dist/viewer/assets/bundleQuery-L4H4wq5q.js +0 -1
  98. package/dist/viewer/assets/fa-core-DaD7O-yO.js +0 -558
  99. package/dist/viewer/assets/fa-pro-icons-Dzkwxnip.js +0 -1
  100. package/dist/viewer/assets/index-BPiwld5D.js +0 -5
  101. package/dist/viewer/assets/index-BiyeMU_r.css +0 -2
  102. package/dist/viewer/assets/index-BlJv_543.js +0 -5
  103. package/dist/viewer/assets/index-CAYNux5J.js +0 -5
  104. package/dist/viewer/assets/index-D4AnoAXz.js +0 -5
  105. package/dist/viewer/assets/index-D8Koqlb-.js +0 -5
  106. package/dist/viewer/assets/index-DKrC0qkC.js +0 -5
  107. package/dist/viewer/assets/react-CyWK9rg5.js +0 -9
  108. package/dist/viewer/assets/useLocalStorage-BlZWItfY.js +0 -1
  109. package/dist/viewer/assets/useLocalStorage-CQO0VGQ6.js +0 -1
  110. package/dist/viewer/assets/useNavigate-V8wjv5GQ.js +0 -1
  111. package/dist/viewer/assets/useObjectLookups-BAqe9wvu.js +0 -14
  112. package/dist/viewer/assets/useObjectLookups-C65zm-bM.js +0 -14
  113. package/dist/viewer/assets/useObjectLookups-CslM2vSA.js +0 -14
  114. package/dist/viewer/assets/validIcons-Dqgxgpv-.js +0 -1
  115. /package/dist/viewer/assets/{CodeStepsPage-DdKuH37F.css → CodeViewer-DdKuH37F.css} +0 -0
  116. /package/dist/viewer/assets/{fa-pro-icons-CiTC899m.js → fa-pro-icons-j8-_MCQ7.js} +0 -0
@@ -1,5 +0,0 @@
1
- import{n as e,t}from"./rolldown-runtime-DF2fYuay.js";import{C as n,S as r,_ as i,a,c as o,n as s,p as c,r as l,x as u}from"./fa-core-DaD7O-yO.js";import{t as d}from"./useNavigate-V8wjv5GQ.js";import{R as f,n as p,t as m}from"./bundleQuery-206rQR6g.js";import{r as h}from"./CredentialsContext-Xbse1T0q.js";import{n as g}from"./api-DqAiw0w9.js";import{t as _}from"./Card-DsqKctyM.js";import{t as v}from"./useLocalStorage-CQO0VGQ6.js";var y=t(((e,t)=>{function n(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw Error(`map is read-only`)}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw Error(`set is read-only`)}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{let r=e[t],i=typeof r;(i===`object`||i===`function`)&&!Object.isFrozen(r)&&n(r)}),e}var r=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function i(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#x27;`)}function a(e,...t){let n=Object.create(null);for(let t in e)n[t]=e[t];return t.forEach(function(e){for(let t in e)n[t]=e[t]}),n}var o=`</span>`,s=e=>!!e.scope,c=(e,{prefix:t})=>{if(e.startsWith(`language:`))return e.replace(`language:`,`language-`);if(e.includes(`.`)){let n=e.split(`.`);return[`${t}${n.shift()}`,...n.map((e,t)=>`${e}${`_`.repeat(t+1)}`)].join(` `)}return`${t}${e}`},l=class{constructor(e,t){this.buffer=``,this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=i(e)}openNode(e){if(!s(e))return;let t=c(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){s(e)&&(this.buffer+=o)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}},u=(e={})=>{let t={children:[]};return Object.assign(t,e),t},d=class e{constructor(){this.rootNode=u(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let t=u({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return typeof t==`string`?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(t){typeof t!=`string`&&t.children&&(t.children.every(e=>typeof e==`string`)?t.children=[t.children.join(``)]:t.children.forEach(t=>{e._collapse(t)}))}},f=class extends d{constructor(e){super(),this.options=e}addText(e){e!==``&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){let n=e.root;t&&(n.scope=`language:${t}`),this.add(n)}toHTML(){return new l(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function p(e){return e?typeof e==`string`?e:e.source:null}function m(e){return _(`(?=`,e,`)`)}function h(e){return _(`(?:`,e,`)*`)}function g(e){return _(`(?:`,e,`)?`)}function _(...e){return e.map(e=>p(e)).join(``)}function v(e){let t=e[e.length-1];return typeof t==`object`&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function y(...e){return`(`+(v(e).capture?``:`?:`)+e.map(e=>p(e)).join(`|`)+`)`}function b(e){return RegExp(e.toString()+`|`).exec(``).length-1}function x(e,t){let n=e&&e.exec(t);return n&&n.index===0}var S=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function C(e,{joinWith:t}){let n=0;return e.map(e=>{n+=1;let t=n,r=p(e),i=``;for(;r.length>0;){let e=S.exec(r);if(!e){i+=r;break}i+=r.substring(0,e.index),r=r.substring(e.index+e[0].length),e[0][0]===`\\`&&e[1]?i+=`\\`+String(Number(e[1])+t):(i+=e[0],e[0]===`(`&&n++)}return i}).map(e=>`(${e})`).join(t)}var w=/\b\B/,T=`[a-zA-Z]\\w*`,E=`[a-zA-Z_]\\w*`,D=`\\b\\d+(\\.\\d+)?`,O=`(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)`,k=`\\b(0b[01]+)`,A=`!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~`,j=(e={})=>{let t=/^#![ ]*\//;return e.binary&&(e.begin=_(t,/.*\b/,e.binary,/\b.*/)),a({scope:`meta`,begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{e.index!==0&&t.ignoreMatch()}},e)},M={begin:`\\\\[\\s\\S]`,relevance:0},N={scope:`string`,begin:`'`,end:`'`,illegal:`\\n`,contains:[M]},P={scope:`string`,begin:`"`,end:`"`,illegal:`\\n`,contains:[M]},F={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/},I=function(e,t,n={}){let r=a({scope:`comment`,begin:e,end:t,contains:[]},n);r.contains.push({scope:`doctag`,begin:`[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)`,end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let i=y(`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 r.contains.push({begin:_(/[ ]+/,`(`,i,/[.]?[:]?([.][ ]|[ ])/,`){3}`)}),r},L=I(`//`,`$`),R=I(`/\\*`,`\\*/`),z=I(`#`,`$`),B={scope:`number`,begin:D,relevance:0},ee={scope:`number`,begin:O,relevance:0},te={scope:`number`,begin:k,relevance:0},ne={scope:`regexp`,begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[M,{begin:/\[/,end:/\]/,relevance:0,contains:[M]}]},re={scope:`title`,begin:T,relevance:0},ie={scope:`title`,begin:E,relevance:0},ae={begin:`\\.\\s*`+E,relevance:0},V=Object.freeze({__proto__:null,APOS_STRING_MODE:N,BACKSLASH_ESCAPE:M,BINARY_NUMBER_MODE:te,BINARY_NUMBER_RE:k,COMMENT:I,C_BLOCK_COMMENT_MODE:R,C_LINE_COMMENT_MODE:L,C_NUMBER_MODE:ee,C_NUMBER_RE:O,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})},HASH_COMMENT_MODE:z,IDENT_RE:T,MATCH_NOTHING_RE:w,METHOD_GUARD:ae,NUMBER_MODE:B,NUMBER_RE:D,PHRASAL_WORDS_MODE:F,QUOTE_STRING_MODE:P,REGEXP_MODE:ne,RE_STARTERS_RE:A,SHEBANG:j,TITLE_MODE:re,UNDERSCORE_IDENT_RE:E,UNDERSCORE_TITLE_MODE:ie});function oe(e,t){e.input[e.index-1]===`.`&&t.ignoreMatch()}function se(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function ce(e,t){t&&e.beginKeywords&&(e.begin=`\\b(`+e.beginKeywords.split(` `).join(`|`)+`)(?!\\.)(?=\\b|\\s)`,e.__beforeBegin=oe,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function le(e,t){Array.isArray(e.illegal)&&(e.illegal=y(...e.illegal))}function ue(e,t){if(e.match){if(e.begin||e.end)throw Error(`begin & end are not supported with match`);e.begin=e.match,delete e.match}}function de(e,t){e.relevance===void 0&&(e.relevance=1)}var fe=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw Error(`beforeMatch cannot be used with starts`);let n=Object.assign({},e);Object.keys(e).forEach(t=>{delete e[t]}),e.keywords=n.keywords,e.begin=_(n.beforeMatch,m(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},pe=[`of`,`and`,`for`,`in`,`not`,`or`,`if`,`then`,`parent`,`list`,`value`],me=`keyword`;function H(e,t,n=me){let r=Object.create(null);return typeof e==`string`?i(n,e.split(` `)):Array.isArray(e)?i(n,e):Object.keys(e).forEach(function(n){Object.assign(r,H(e[n],t,n))}),r;function i(e,n){t&&(n=n.map(e=>e.toLowerCase())),n.forEach(function(t){let n=t.split(`|`);r[n[0]]=[e,he(n[0],n[1])]})}}function he(e,t){return t?Number(t):+!ge(e)}function ge(e){return pe.includes(e.toLowerCase())}var U={},W=e=>{console.error(e)},G=(e,...t)=>{console.log(`WARN: ${e}`,...t)},K=(e,t)=>{U[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),U[`${e}/${t}`]=!0)},q=Error();function J(e,t,{key:n}){let r=0,i=e[n],a={},o={};for(let e=1;e<=t.length;e++)o[e+r]=i[e],a[e+r]=!0,r+=b(t[e-1]);e[n]=o,e[n]._emit=a,e[n]._multi=!0}function _e(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw W(`skip, excludeBegin, returnBegin not compatible with beginScope: {}`),q;if(typeof e.beginScope!=`object`||e.beginScope===null)throw W(`beginScope must be object`),q;J(e,e.begin,{key:`beginScope`}),e.begin=C(e.begin,{joinWith:``})}}function ve(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw W(`skip, excludeEnd, returnEnd not compatible with endScope: {}`),q;if(typeof e.endScope!=`object`||e.endScope===null)throw W(`endScope must be object`),q;J(e,e.end,{key:`endScope`}),e.end=C(e.end,{joinWith:``})}}function ye(e){e.scope&&typeof e.scope==`object`&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function be(e){ye(e),typeof e.beginScope==`string`&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope==`string`&&(e.endScope={_wrap:e.endScope}),_e(e),ve(e)}function xe(e){function t(t,n){return new RegExp(p(t),`m`+(e.case_insensitive?`i`:``)+(e.unicodeRegex?`u`:``)+(n?`g`:``))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=b(e)+1}compile(){this.regexes.length===0&&(this.exec=()=>null),this.matcherRe=t(C(this.regexes.map(e=>e[1]),{joinWith:`|`}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;let t=this.matcherRe.exec(e);if(!t)return null;let n=t.findIndex((e,t)=>t>0&&e!==void 0),r=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,r)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];let t=new n;return this.rules.slice(e).forEach(([e,n])=>t.addRule(e,n)),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),t.type===`begin`&&this.count++}exec(e){let t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition()&&!(n&&n.index===this.lastIndex)){let t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}function i(e){let t=new r;return e.contains.forEach(e=>t.addRule(e.begin,{rule:e,type:`begin`})),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:`end`}),e.illegal&&t.addRule(e.illegal,{type:`illegal`}),t}function o(n,r){let a=n;if(n.isCompiled)return a;[se,ue,be,fe].forEach(e=>e(n,r)),e.compilerExtensions.forEach(e=>e(n,r)),n.__beforeBegin=null,[ce,le,de].forEach(e=>e(n,r)),n.isCompiled=!0;let s=null;return typeof n.keywords==`object`&&n.keywords.$pattern&&(n.keywords=Object.assign({},n.keywords),s=n.keywords.$pattern,delete n.keywords.$pattern),s||=/\w+/,n.keywords&&=H(n.keywords,e.case_insensitive),a.keywordPatternRe=t(s,!0),r&&(n.begin||=/\B|\b/,a.beginRe=t(a.begin),!n.end&&!n.endsWithParent&&(n.end=/\B|\b/),n.end&&(a.endRe=t(a.end)),a.terminatorEnd=p(a.end)||``,n.endsWithParent&&r.terminatorEnd&&(a.terminatorEnd+=(n.end?`|`:``)+r.terminatorEnd)),n.illegal&&(a.illegalRe=t(n.illegal)),n.contains||=[],n.contains=[].concat(...n.contains.map(function(e){return Se(e===`self`?n:e)})),n.contains.forEach(function(e){o(e,a)}),n.starts&&o(n.starts,r),a.matcher=i(a),a}if(e.compilerExtensions||=[],e.contains&&e.contains.includes(`self`))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=a(e.classNameAliases||{}),o(e)}function Y(e){return e?e.endsWithParent||Y(e.starts):!1}function Se(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return a(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:Y(e)?a(e,{starts:e.starts?a(e.starts):null}):Object.isFrozen(e)?a(e):e}var Ce=`11.11.1`,we=class extends Error{constructor(e,t){super(e),this.name=`HTMLInjectionError`,this.html=t}},X=i,Z=a,Te=Symbol(`nomatch`),Ee=7,Q=function(e){let t=Object.create(null),i=Object.create(null),a=[],o=!0,s=`Could not find the language '{}', did you forget to load/include a language module?`,c={disableAutodetect:!0,name:`Plain text`,contains:[]},l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:`hljs-`,cssSelector:`pre code`,languages:null,__emitter:f};function u(e){return l.noHighlightRe.test(e)}function d(e){let t=e.className+` `;t+=e.parentNode?e.parentNode.className:``;let n=l.languageDetectRe.exec(t);if(n){let t=N(n[1]);return t||(G(s.replace(`{}`,n[1])),G(`Falling back to no-highlight mode for this block.`,e)),t?n[1]:`no-highlight`}return t.split(/\s+/).find(e=>u(e)||N(e))}function p(e,t,n){let r=``,i=``;typeof t==`object`?(r=e,n=t.ignoreIllegals,i=t.language):(K(`10.7.0`,`highlight(lang, code, ...args) has been deprecated.`),K(`10.7.0`,`Please use highlight(code, options) instead.
2
- https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(n=!0);let a={code:r,language:i};z(`before:highlight`,a);let o=a.result?a.result:v(a.language,a.code,n);return o.code=a.code,z(`after:highlight`,o),o}function v(e,n,i,a){let c=Object.create(null);function u(e,t){return e.keywords[t]}function d(){if(!A.keywords){M.addText(P);return}let e=0;A.keywordPatternRe.lastIndex=0;let t=A.keywordPatternRe.exec(P),n=``;for(;t;){n+=P.substring(e,t.index);let r=D.case_insensitive?t[0].toLowerCase():t[0],i=u(A,r);if(i){let[e,a]=i;if(M.addText(n),n=``,c[r]=(c[r]||0)+1,c[r]<=Ee&&(F+=a),e.startsWith(`_`))n+=t[0];else{let n=D.classNameAliases[e]||e;m(t[0],n)}}else n+=t[0];e=A.keywordPatternRe.lastIndex,t=A.keywordPatternRe.exec(P)}n+=P.substring(e),M.addText(n)}function f(){if(P===``)return;let e=null;if(typeof A.subLanguage==`string`){if(!t[A.subLanguage]){M.addText(P);return}e=v(A.subLanguage,P,!0,j[A.subLanguage]),j[A.subLanguage]=e._top}else e=S(P,A.subLanguage.length?A.subLanguage:null);A.relevance>0&&(F+=e.relevance),M.__addSublanguage(e._emitter,e.language)}function p(){A.subLanguage==null?d():f(),P=``}function m(e,t){e!==``&&(M.startScope(t),M.addText(e),M.endScope())}function h(e,t){let n=1,r=t.length-1;for(;n<=r;){if(!e._emit[n]){n++;continue}let r=D.classNameAliases[e[n]]||e[n],i=t[n];r?m(i,r):(P=i,d(),P=``),n++}}function g(e,t){return e.scope&&typeof e.scope==`string`&&M.openNode(D.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(m(P,D.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),P=``):e.beginScope._multi&&(h(e.beginScope,t),P=``)),A=Object.create(e,{parent:{value:A}}),A}function _(e,t,n){let i=x(e.endRe,n);if(i){if(e[`on:end`]){let n=new r(e);e[`on:end`](t,n),n.isMatchIgnored&&(i=!1)}if(i){for(;e.endsParent&&e.parent;)e=e.parent;return e}}if(e.endsWithParent)return _(e.parent,t,n)}function y(e){return A.matcher.regexIndex===0?(P+=e[0],1):(R=!0,0)}function b(e){let t=e[0],n=e.rule,i=new r(n),a=[n.__beforeBegin,n[`on:begin`]];for(let n of a)if(n&&(n(e,i),i.isMatchIgnored))return y(t);return n.skip?P+=t:(n.excludeBegin&&(P+=t),p(),!n.returnBegin&&!n.excludeBegin&&(P=t)),g(n,e),n.returnBegin?0:t.length}function C(e){let t=e[0],r=n.substring(e.index),i=_(A,e,r);if(!i)return Te;let a=A;A.endScope&&A.endScope._wrap?(p(),m(t,A.endScope._wrap)):A.endScope&&A.endScope._multi?(p(),h(A.endScope,e)):a.skip?P+=t:(a.returnEnd||a.excludeEnd||(P+=t),p(),a.excludeEnd&&(P=t));do A.scope&&M.closeNode(),!A.skip&&!A.subLanguage&&(F+=A.relevance),A=A.parent;while(A!==i.parent);return i.starts&&g(i.starts,e),a.returnEnd?0:t.length}function w(){let e=[];for(let t=A;t!==D;t=t.parent)t.scope&&e.unshift(t.scope);e.forEach(e=>M.openNode(e))}let T={};function E(t,r){let a=r&&r[0];if(P+=t,a==null)return p(),0;if(T.type===`begin`&&r.type===`end`&&T.index===r.index&&a===``){if(P+=n.slice(r.index,r.index+1),!o){let t=Error(`0 width match regex (${e})`);throw t.languageName=e,t.badRule=T.rule,t}return 1}if(T=r,r.type===`begin`)return b(r);if(r.type===`illegal`&&!i){let e=Error(`Illegal lexeme "`+a+`" for mode "`+(A.scope||`<unnamed>`)+`"`);throw e.mode=A,e}else if(r.type===`end`){let e=C(r);if(e!==Te)return e}if(r.type===`illegal`&&a===``)return P+=`
3
- `,1;if(L>1e5&&L>r.index*3)throw Error(`potential infinite loop, way more iterations than matches`);return P+=a,a.length}let D=N(e);if(!D)throw W(s.replace(`{}`,e)),Error(`Unknown language: "`+e+`"`);let O=xe(D),k=``,A=a||O,j={},M=new l.__emitter(l);w();let P=``,F=0,I=0,L=0,R=!1;try{if(D.__emitTokens)D.__emitTokens(n,M);else{for(A.matcher.considerAll();;){L++,R?R=!1:A.matcher.considerAll(),A.matcher.lastIndex=I;let e=A.matcher.exec(n);if(!e)break;let t=E(n.substring(I,e.index),e);I=e.index+t}E(n.substring(I))}return M.finalize(),k=M.toHTML(),{language:e,value:k,relevance:F,illegal:!1,_emitter:M,_top:A}}catch(t){if(t.message&&t.message.includes(`Illegal`))return{language:e,value:X(n),illegal:!0,relevance:0,_illegalBy:{message:t.message,index:I,context:n.slice(I-100,I+100),mode:t.mode,resultSoFar:k},_emitter:M};if(o)return{language:e,value:X(n),illegal:!1,relevance:0,errorRaised:t,_emitter:M,_top:A};throw t}}function b(e){let t={value:X(e),illegal:!1,relevance:0,_top:c,_emitter:new l.__emitter(l)};return t._emitter.addText(e),t}function S(e,n){n=n||l.languages||Object.keys(t);let r=b(e),i=n.filter(N).filter(F).map(t=>v(t,e,!1));i.unshift(r);let[a,o]=i.sort((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(N(e.language).supersetOf===t.language)return 1;if(N(t.language).supersetOf===e.language)return-1}return 0}),s=a;return s.secondBest=o,s}function C(e,t,n){let r=t&&i[t]||n;e.classList.add(`hljs`),e.classList.add(`language-${r}`)}function w(e){let t=null,n=d(e);if(u(n))return;if(z(`before:highlightElement`,{el:e,language:n}),e.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e);return}if(e.children.length>0&&(l.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(e)),l.throwUnescapedHTML))throw new we(`One of your code blocks includes unescaped HTML.`,e.innerHTML);t=e;let r=t.textContent,i=n?p(r,{language:n,ignoreIllegals:!0}):S(r);e.innerHTML=i.value,e.dataset.highlighted=`yes`,C(e,n,i.language),e.result={language:i.language,re:i.relevance,relevance:i.relevance},i.secondBest&&(e.secondBest={language:i.secondBest.language,relevance:i.secondBest.relevance}),z(`after:highlightElement`,{el:e,result:i,text:r})}function T(e){l=Z(l,e)}let E=()=>{k(),K(`10.6.0`,`initHighlighting() deprecated. Use highlightAll() now.`)};function D(){k(),K(`10.6.0`,`initHighlightingOnLoad() deprecated. Use highlightAll() now.`)}let O=!1;function k(){function e(){k()}if(document.readyState===`loading`){O||window.addEventListener(`DOMContentLoaded`,e,!1),O=!0;return}document.querySelectorAll(l.cssSelector).forEach(w)}function A(n,r){let i=null;try{i=r(e)}catch(e){if(W(`Language definition for '{}' could not be registered.`.replace(`{}`,n)),o)W(e);else throw e;i=c}i.name||=n,t[n]=i,i.rawDefinition=r.bind(null,e),i.aliases&&P(i.aliases,{languageName:n})}function j(e){delete t[e];for(let t of Object.keys(i))i[t]===e&&delete i[t]}function M(){return Object.keys(t)}function N(e){return e=(e||``).toLowerCase(),t[e]||t[i[e]]}function P(e,{languageName:t}){typeof e==`string`&&(e=[e]),e.forEach(e=>{i[e.toLowerCase()]=t})}function F(e){let t=N(e);return t&&!t.disableAutodetect}function I(e){e[`before:highlightBlock`]&&!e[`before:highlightElement`]&&(e[`before:highlightElement`]=t=>{e[`before:highlightBlock`](Object.assign({block:t.el},t))}),e[`after:highlightBlock`]&&!e[`after:highlightElement`]&&(e[`after:highlightElement`]=t=>{e[`after:highlightBlock`](Object.assign({block:t.el},t))})}function L(e){I(e),a.push(e)}function R(e){let t=a.indexOf(e);t!==-1&&a.splice(t,1)}function z(e,t){let n=e;a.forEach(function(e){e[n]&&e[n](t)})}function B(e){return K(`10.7.0`,`highlightBlock will be removed entirely in v12.0`),K(`10.7.0`,`Please use highlightElement now.`),w(e)}Object.assign(e,{highlight:p,highlightAuto:S,highlightAll:k,highlightElement:w,highlightBlock:B,configure:T,initHighlighting:E,initHighlightingOnLoad:D,registerLanguage:A,unregisterLanguage:j,listLanguages:M,getLanguage:N,registerAliases:P,autoDetection:F,inherit:Z,addPlugin:L,removePlugin:R}),e.debugMode=function(){o=!1},e.safeMode=function(){o=!0},e.versionString=Ce,e.regex={concat:_,lookahead:m,either:y,optional:g,anyNumberOfTimes:h};for(let e in V)typeof V[e]==`object`&&n(V[e]);return Object.assign(e,V),e},$=Q({});$.newInstance=()=>Q({}),t.exports=$,$.HighlightJS=$,$.default=$})),b=e(n(),1),x=e(y()).default;function S(e){let t=e.regex,n=/[\p{XID_Start}_]\p{XID_Continue}*/u,r=`and.as.assert.async.await.break.case.class.continue.def.del.elif.else.except.finally.for.from.global.if.import.in.is.lambda.match.nonlocal|10.not.or.pass.raise.return.try.while.with.yield`.split(`.`),i={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:`__import__.abs.all.any.ascii.bin.bool.breakpoint.bytearray.bytes.callable.chr.classmethod.compile.complex.delattr.dict.dir.divmod.enumerate.eval.exec.filter.float.format.frozenset.getattr.globals.hasattr.hash.help.hex.id.input.int.isinstance.issubclass.iter.len.list.locals.map.max.memoryview.min.next.object.oct.open.ord.pow.print.property.range.repr.reversed.round.set.setattr.slice.sorted.staticmethod.str.sum.super.tuple.type.vars.zip`.split(`.`),literal:[`__debug__`,`Ellipsis`,`False`,`None`,`NotImplemented`,`True`],type:[`Any`,`Callable`,`Coroutine`,`Dict`,`List`,`Literal`,`Generic`,`Optional`,`Sequence`,`Set`,`Tuple`,`Type`,`Union`]},a={className:`meta`,begin:/^(>>>|\.\.\.) /},o={className:`subst`,begin:/\{/,end:/\}/,keywords:i,illegal:/#/},s={begin:/\{\{/,relevance:0},c={className:`string`,contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a,s,o]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a,s,o]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,s,o]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,s,o]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},l=`[0-9](_?[0-9])*`,u=`(\\b(${l}))?\\.(${l})|\\b(${l})\\.`,d=`\\b|${r.join(`|`)}`,f={className:`number`,relevance:0,variants:[{begin:`(\\b(${l})|(${u}))[eE][+-]?(${l})[jJ]?(?=${d})`},{begin:`(${u})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${d})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${d})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${d})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${d})`},{begin:`\\b(${l})[jJ](?=${d})`}]},p={className:`comment`,begin:t.lookahead(/# type:/),end:/$/,keywords:i,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},m={className:`params`,variants:[{className:``,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:i,contains:[`self`,a,f,c,e.HASH_COMMENT_MODE]}]};return o.contains=[c,f,a],{name:`Python`,aliases:[`py`,`gyp`,`ipython`],unicodeRegex:!0,keywords:i,illegal:/(<\/|\?)|=>/,contains:[a,f,{scope:`variable.language`,match:/\bself\b/},{beginKeywords:`if`,relevance:0},{match:/\bor\b/,scope:`keyword`},c,p,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:`keyword`,3:`title.function`},contains:[m]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:`keyword`,3:`title.class`,6:`title.class.inherited`}},{className:`meta`,begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[f,m,c]}]}}var C=r();x.registerLanguage(`python`,S);var w=({code:e,language:t=`python`,onRun:n,isRunning:r=!1,executionMode:a,onModeChange:o})=>{let s=(0,b.useMemo)(()=>x.highlight(e,{language:t}).value.split(`
4
- `),[e,t]);return(0,C.jsxs)(`div`,{className:`overflow-hidden rounded-lg border border-black/10 bg-white`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-black/10 bg-neutral-50 px-4 py-2`,children:[(0,C.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:t}),(0,C.jsx)(`div`,{className:`flex-1`}),a&&o&&(0,C.jsx)(`div`,{className:`flex overflow-hidden rounded border border-black/10 text-[11px] font-medium`,children:[`local`,`remote`].map(e=>(0,C.jsx)(`button`,{onClick:()=>o(e),className:`px-2.5 py-0.5 transition-colors ${a===e?`bg-neutral-700 text-white`:`bg-white text-neutral-500 hover:bg-neutral-100`}`,children:e===`local`?`Local`:`Remote`},e))}),n&&(0,C.jsxs)(`button`,{onClick:n,disabled:r,className:`flex items-center gap-1.5 rounded-full border border-black/10 bg-white px-3 py-1 text-[11px] font-medium text-neutral-600 transition-colors hover:border-green-300 hover:text-green-700 disabled:cursor-wait disabled:opacity-50`,children:[(0,C.jsx)(u,{icon:r?i:c,className:r?`animate-spin`:``}),(0,C.jsx)(`span`,{children:r?`Running…`:`Run`})]})]}),(0,C.jsxs)(`div`,{className:`flex overflow-auto bg-white font-mono text-[13px] leading-[20px]`,children:[(0,C.jsx)(`div`,{className:`shrink-0 select-none border-r border-black/5 bg-neutral-50 px-3 py-3 text-right text-neutral-300`,children:s.map((e,t)=>(0,C.jsx)(`div`,{children:String(t+1)},t))}),(0,C.jsx)(`div`,{className:`flex-1 overflow-auto py-3 pl-4 pr-4`,children:s.map((e,t)=>(0,C.jsx)(`div`,{className:`hljs whitespace-pre`,dangerouslySetInnerHTML:{__html:e||`\xA0`}},t))})]})]})},T=({title:e,defaultOpen:t=!1,children:n})=>{let[r,i]=(0,b.useState)(t);return(0,C.jsxs)(`div`,{children:[(0,C.jsxs)(`button`,{onClick:()=>{i(e=>!e)},className:`flex w-full items-center gap-1.5 py-1 text-[11px] font-semibold uppercase tracking-widest text-neutral-400 hover:text-neutral-600`,children:[(0,C.jsx)(u,{icon:r?l:a,className:`w-2.5`}),e]}),r&&(0,C.jsx)(`div`,{className:`pb-2`,children:n})]})},E=({result:e})=>{let t=Object.entries(e.outputValues);return(0,C.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-black/10 bg-white p-4`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(`span`,{className:`rounded px-2 py-0.5 text-[11px] font-semibold ${e.success?`bg-green-100 text-green-700`:`bg-red-100 text-red-700`}`,children:e.success?`Success`:`Error`}),(0,C.jsxs)(`span`,{className:`text-[11px] text-neutral-400`,children:[String(e.durationMs),`ms`]}),e.exitCode!==0&&(0,C.jsxs)(`span`,{className:`text-[11px] text-neutral-400`,children:[`exit code `,String(e.exitCode)]})]}),e.error&&(0,C.jsx)(`pre`,{className:`overflow-auto rounded bg-red-50 p-3 font-mono text-[12px] text-red-800`,children:e.error}),t.length>0&&(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`mb-1 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Outputs`}),(0,C.jsx)(`div`,{className:`divide-y divide-black/5`,children:t.map(([e,t])=>(0,C.jsxs)(`div`,{className:`flex items-start gap-2 py-1.5`,children:[(0,C.jsx)(`span`,{className:`shrink-0 font-mono text-[12px] text-neutral-600`,children:e}),(0,C.jsx)(`span`,{className:`text-[11px] text-neutral-300`,children:`=`}),(0,C.jsx)(`pre`,{className:`min-w-0 flex-1 overflow-auto font-mono text-[12px] text-neutral-800`,children:typeof t==`string`?t:JSON.stringify(t,null,2)})]},e))})]}),e.logs.length>0&&(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`mb-1 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Logs`}),(0,C.jsx)(`div`,{className:`space-y-0.5`,children:e.logs.map((e,t)=>(0,C.jsx)(`div`,{className:`font-mono text-[12px] text-neutral-600`,children:e},t))})]}),e.stdout&&(0,C.jsx)(T,{title:`Stdout`,children:(0,C.jsx)(`pre`,{className:`overflow-auto rounded bg-neutral-50 p-3 font-mono text-[12px] text-neutral-700`,children:e.stdout})}),e.stderr&&(0,C.jsx)(T,{title:`Stderr`,children:(0,C.jsx)(`pre`,{className:`overflow-auto rounded bg-neutral-50 p-3 font-mono text-[12px] text-neutral-700`,children:e.stderr})})]})},D=[`python-3-13`,`python-3-12`],O=`python-3-12`,k={text:`s`,string:`s`,number:`n`,integer:`n`,boolean:`b`,date:`d`,datetime:`dt`,phone:`p`,phonenumber:`p`,uuid:`u`,file:`f`,list:`l`};function A(e){return k[e.toLowerCase()]??`s`}function j(e){return D.includes(e)?e:O}function M(e,t,n,r){let i=`${g[r.environment]}/coderunner/run`,a=e.secrets.map(e=>`${t}__${e}`),o={user_script:e.script,runtime:j(e.script_runtime)};a.length>0&&(o.secrets=a);let s=Object.keys(n).filter(e=>n[e]!==``);if(s.length>0){let t=Object.fromEntries(e.inputs.map(e=>[e.name,e.data_type]));o.inputs=Object.fromEntries(s.map(e=>[e,{t:A(t[e]??`string`),v:n[e]}]))}e.outputs.length>0&&(o.output_types=Object.fromEntries(e.outputs.map(e=>[e.name,A(e.data_type)])));let c=JSON.stringify(o,null,2);return[`curl -X POST '${i}' \\`,` -H 'Content-Type: application/json' \\`,` -H 'X-API-KEY: ${r.apiKey}' \\`,` -H 'X-USER-ID: ${r.userId}' \\`,` -H 'X-BUSINESS-ID: ${r.businessId}' \\`,` -d '${c}'`].join(`
5
- `)}var N=()=>{let{apiName:e,stepApiName:t}=f({strict:!1}),n=d(),{data:r,isLoading:i,isError:a}=p(m),[c,l]=(0,b.useState)(!1),[g,y]=(0,b.useState)(null),[x,S]=v(`kizen-step-inputs:${e??``}:${t??``}`,{}),[T,D]=v(`kizen-step-secrets:${e??``}:${t??``}`,{}),[O,k]=v(`kizen-code-runner-mode`,`local`),A=h(),[j,N]=(0,b.useState)(!1),P=(0,b.useCallback)(e=>{navigator.clipboard.writeText(e).then(()=>{N(!0),setTimeout(()=>N(!1),1500)})},[]),F=r?.find(t=>t.api_name===e),I=(0,b.useMemo)(()=>F?.artifacts.automation_action_configs??[],[F]),L=I.find(e=>e.action_step_api_name===t)??I[0];if((0,b.useEffect)(()=>{if(!t&&I.length>0&&e){let t=I[0];t&&n({to:`/$apiName/code-steps/$stepApiName`,params:{apiName:e,stepApiName:t.action_step_api_name},replace:!0})}},[t,I,e,n]),(0,b.useEffect)(()=>{y(null)},[t]),i)return(0,C.jsx)(_,{children:(0,C.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-400`,children:`Fetching bundle.json…`})});if(a)return(0,C.jsx)(_,{children:(0,C.jsx)(`p`,{className:`m-0 text-[13px] text-red-700`,children:`Could not load bundle.json.`})});if(!F)return(0,C.jsx)(_,{children:(0,C.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`No app found with api_name`,` `,(0,C.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:e}),`.`]})});if(I.length===0)return(0,C.jsx)(_,{children:(0,C.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:`This app has no automation code steps.`})});if(!L)return(0,C.jsx)(_,{children:(0,C.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`Step not found: `,(0,C.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:t}),`.`]})});let R=async()=>{l(!0),y(null),console.log(Object.fromEntries(L.secrets.map(t=>[`${e??``}__${t}`,T[t]??``])));try{let t={script:L.script,scriptRuntime:L.script_runtime,inputs:x},n=O===`remote`?{...t,mode:`remote`,inputTypes:Object.fromEntries(L.inputs.map(e=>[e.name,e.data_type])),outputTypes:Object.fromEntries(L.outputs.map(e=>[e.name,e.data_type])),secretNames:L.secrets.map(t=>`${e??``}__${t}`)}:{...t,secrets:Object.fromEntries(L.secrets.map(t=>[`${e??``}__${t}`,T[t]??``]))};y(await(await fetch(`/api/execute-step`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)})).json())}catch(e){y({success:!1,outputValues:{},logs:[],stdout:``,stderr:``,error:e instanceof Error?e.message:String(e),exitCode:1,durationMs:0})}finally{l(!1)}};return(0,C.jsxs)(`div`,{className:`space-y-4`,children:[(0,C.jsxs)(_,{children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,C.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Code Step`}),(0,C.jsx)(`select`,{value:L.action_step_api_name,onChange:t=>{e&&n({to:`/$apiName/code-steps/$stepApiName`,params:{apiName:e,stepApiName:t.target.value}})},className:`rounded border border-black/10 bg-transparent px-2 py-0.5 text-[13px] font-mono text-neutral-700 focus:outline-none`,children:I.map(e=>(0,C.jsx)(`option`,{value:e.action_step_api_name,children:e.name},e.action_step_api_name))}),(0,C.jsx)(`div`,{className:`flex-1`}),(0,C.jsx)(`span`,{className:`rounded bg-blue-50 px-1.5 py-0.5 text-[10px] font-semibold text-blue-600`,children:L.script_runtime})]}),L.overall_description&&(0,C.jsx)(`p`,{className:`mt-2 text-[12px] text-neutral-500`,children:L.overall_description})]}),L.inputs.length>0&&(0,C.jsxs)(_,{children:[(0,C.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Inputs`}),(0,C.jsx)(`div`,{className:`space-y-3`,children:L.inputs.map(e=>(0,C.jsxs)(`div`,{children:[(0,C.jsxs)(`label`,{className:`mb-1 block text-[12px] text-neutral-700`,children:[e.label,e.required&&(0,C.jsx)(`span`,{className:`ml-0.5 text-red-500`,children:`*`})]}),(0,C.jsx)(`input`,{type:`text`,value:x[e.name]??``,onChange:t=>{S({...x,[e.name]:t.target.value})},placeholder:e.name,className:`w-full rounded border border-black/10 bg-white px-2.5 py-1.5 font-mono text-[13px] text-neutral-800 placeholder:text-neutral-300 focus:border-blue-300 focus:outline-none`}),(0,C.jsx)(`div`,{className:`mt-0.5 font-mono text-[10px] text-neutral-400`,children:e.name})]},e.name))})]}),L.secrets.length>0&&(0,C.jsxs)(_,{children:[(0,C.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Secrets`}),(0,C.jsx)(`div`,{className:`space-y-3`,children:L.secrets.map(e=>(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{className:`mb-1 block text-[12px] text-neutral-700`,children:e}),(0,C.jsx)(`input`,{type:`password`,value:T[e]??``,onChange:t=>{D({...T,[e]:t.target.value})},placeholder:e,className:`w-full rounded border border-black/10 bg-white px-2.5 py-1.5 font-mono text-[13px] text-neutral-800 placeholder:text-neutral-300 focus:border-blue-300 focus:outline-none`})]},e))})]}),(0,C.jsx)(w,{code:L.script,language:`python`,onRun:()=>void R(),isRunning:c,executionMode:O,onModeChange:k}),O===`remote`&&(0,C.jsxs)(`div`,{className:`overflow-hidden rounded-lg border border-black/10 bg-white`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-black/5 bg-neutral-50 px-4 py-2`,children:[(0,C.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`curl`}),(0,C.jsx)(`div`,{className:`flex-1`}),(0,C.jsxs)(`button`,{onClick:()=>P(M(L,e??``,x,A)),className:`flex items-center gap-1.5 text-[11px] text-neutral-400 transition-colors hover:text-neutral-600`,children:[(0,C.jsx)(u,{icon:j?s:o,className:`w-3`}),(0,C.jsx)(`span`,{children:j?`Copied`:`Copy`})]})]}),(0,C.jsx)(`pre`,{className:`overflow-auto p-4 font-mono text-[12px] leading-relaxed text-neutral-700`,children:M(L,e??``,x,A)})]}),g&&(0,C.jsx)(E,{result:g})]})};export{N as CodeStepsPage};
@@ -1,4 +0,0 @@
1
- import{n as e,t}from"./rolldown-runtime-DF2fYuay.js";import{b as n,d as r,h as i,i as a,n as o,x as s,y as c}from"./fa-core-wsCxaNB7.js";import{t as l}from"./useNavigate-9J1ZzN1J.js";import{R as u,n as d,t as f}from"./bundleQuery-L4H4wq5q.js";import{r as p}from"./CredentialsContext-zl2e9kpM.js";import"./api-BOqcXygX.js";import{t as m}from"./Card-Bmn1HMWl.js";import{t as h}from"./useLocalStorage-BWwvt0nG.js";var g=t(((e,t)=>{function n(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw Error(`map is read-only`)}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw Error(`set is read-only`)}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{let r=e[t],i=typeof r;(i===`object`||i===`function`)&&!Object.isFrozen(r)&&n(r)}),e}var r=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function i(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#x27;`)}function a(e,...t){let n=Object.create(null);for(let t in e)n[t]=e[t];return t.forEach(function(e){for(let t in e)n[t]=e[t]}),n}var o=`</span>`,s=e=>!!e.scope,c=(e,{prefix:t})=>{if(e.startsWith(`language:`))return e.replace(`language:`,`language-`);if(e.includes(`.`)){let n=e.split(`.`);return[`${t}${n.shift()}`,...n.map((e,t)=>`${e}${`_`.repeat(t+1)}`)].join(` `)}return`${t}${e}`},l=class{constructor(e,t){this.buffer=``,this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=i(e)}openNode(e){if(!s(e))return;let t=c(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){s(e)&&(this.buffer+=o)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}},u=(e={})=>{let t={children:[]};return Object.assign(t,e),t},d=class e{constructor(){this.rootNode=u(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let t=u({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return typeof t==`string`?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(t){typeof t!=`string`&&t.children&&(t.children.every(e=>typeof e==`string`)?t.children=[t.children.join(``)]:t.children.forEach(t=>{e._collapse(t)}))}},f=class extends d{constructor(e){super(),this.options=e}addText(e){e!==``&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){let n=e.root;t&&(n.scope=`language:${t}`),this.add(n)}toHTML(){return new l(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function p(e){return e?typeof e==`string`?e:e.source:null}function m(e){return _(`(?=`,e,`)`)}function h(e){return _(`(?:`,e,`)*`)}function g(e){return _(`(?:`,e,`)?`)}function _(...e){return e.map(e=>p(e)).join(``)}function v(e){let t=e[e.length-1];return typeof t==`object`&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function y(...e){return`(`+(v(e).capture?``:`?:`)+e.map(e=>p(e)).join(`|`)+`)`}function b(e){return RegExp(e.toString()+`|`).exec(``).length-1}function x(e,t){let n=e&&e.exec(t);return n&&n.index===0}var S=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function C(e,{joinWith:t}){let n=0;return e.map(e=>{n+=1;let t=n,r=p(e),i=``;for(;r.length>0;){let e=S.exec(r);if(!e){i+=r;break}i+=r.substring(0,e.index),r=r.substring(e.index+e[0].length),e[0][0]===`\\`&&e[1]?i+=`\\`+String(Number(e[1])+t):(i+=e[0],e[0]===`(`&&n++)}return i}).map(e=>`(${e})`).join(t)}var w=/\b\B/,T=`[a-zA-Z]\\w*`,E=`[a-zA-Z_]\\w*`,D=`\\b\\d+(\\.\\d+)?`,O=`(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)`,k=`\\b(0b[01]+)`,A=`!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~`,j=(e={})=>{let t=/^#![ ]*\//;return e.binary&&(e.begin=_(t,/.*\b/,e.binary,/\b.*/)),a({scope:`meta`,begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{e.index!==0&&t.ignoreMatch()}},e)},M={begin:`\\\\[\\s\\S]`,relevance:0},N={scope:`string`,begin:`'`,end:`'`,illegal:`\\n`,contains:[M]},P={scope:`string`,begin:`"`,end:`"`,illegal:`\\n`,contains:[M]},F={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/},I=function(e,t,n={}){let r=a({scope:`comment`,begin:e,end:t,contains:[]},n);r.contains.push({scope:`doctag`,begin:`[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)`,end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let i=y(`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 r.contains.push({begin:_(/[ ]+/,`(`,i,/[.]?[:]?([.][ ]|[ ])/,`){3}`)}),r},L=I(`//`,`$`),R=I(`/\\*`,`\\*/`),z=I(`#`,`$`),B={scope:`number`,begin:D,relevance:0},ee={scope:`number`,begin:O,relevance:0},te={scope:`number`,begin:k,relevance:0},ne={scope:`regexp`,begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[M,{begin:/\[/,end:/\]/,relevance:0,contains:[M]}]},re={scope:`title`,begin:T,relevance:0},ie={scope:`title`,begin:E,relevance:0},ae={begin:`\\.\\s*`+E,relevance:0},V=Object.freeze({__proto__:null,APOS_STRING_MODE:N,BACKSLASH_ESCAPE:M,BINARY_NUMBER_MODE:te,BINARY_NUMBER_RE:k,COMMENT:I,C_BLOCK_COMMENT_MODE:R,C_LINE_COMMENT_MODE:L,C_NUMBER_MODE:ee,C_NUMBER_RE:O,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})},HASH_COMMENT_MODE:z,IDENT_RE:T,MATCH_NOTHING_RE:w,METHOD_GUARD:ae,NUMBER_MODE:B,NUMBER_RE:D,PHRASAL_WORDS_MODE:F,QUOTE_STRING_MODE:P,REGEXP_MODE:ne,RE_STARTERS_RE:A,SHEBANG:j,TITLE_MODE:re,UNDERSCORE_IDENT_RE:E,UNDERSCORE_TITLE_MODE:ie});function oe(e,t){e.input[e.index-1]===`.`&&t.ignoreMatch()}function se(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function ce(e,t){t&&e.beginKeywords&&(e.begin=`\\b(`+e.beginKeywords.split(` `).join(`|`)+`)(?!\\.)(?=\\b|\\s)`,e.__beforeBegin=oe,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function le(e,t){Array.isArray(e.illegal)&&(e.illegal=y(...e.illegal))}function ue(e,t){if(e.match){if(e.begin||e.end)throw Error(`begin & end are not supported with match`);e.begin=e.match,delete e.match}}function de(e,t){e.relevance===void 0&&(e.relevance=1)}var fe=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw Error(`beforeMatch cannot be used with starts`);let n=Object.assign({},e);Object.keys(e).forEach(t=>{delete e[t]}),e.keywords=n.keywords,e.begin=_(n.beforeMatch,m(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},pe=[`of`,`and`,`for`,`in`,`not`,`or`,`if`,`then`,`parent`,`list`,`value`],me=`keyword`;function H(e,t,n=me){let r=Object.create(null);return typeof e==`string`?i(n,e.split(` `)):Array.isArray(e)?i(n,e):Object.keys(e).forEach(function(n){Object.assign(r,H(e[n],t,n))}),r;function i(e,n){t&&(n=n.map(e=>e.toLowerCase())),n.forEach(function(t){let n=t.split(`|`);r[n[0]]=[e,he(n[0],n[1])]})}}function he(e,t){return t?Number(t):+!ge(e)}function ge(e){return pe.includes(e.toLowerCase())}var U={},W=e=>{console.error(e)},G=(e,...t)=>{console.log(`WARN: ${e}`,...t)},K=(e,t)=>{U[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),U[`${e}/${t}`]=!0)},q=Error();function J(e,t,{key:n}){let r=0,i=e[n],a={},o={};for(let e=1;e<=t.length;e++)o[e+r]=i[e],a[e+r]=!0,r+=b(t[e-1]);e[n]=o,e[n]._emit=a,e[n]._multi=!0}function _e(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw W(`skip, excludeBegin, returnBegin not compatible with beginScope: {}`),q;if(typeof e.beginScope!=`object`||e.beginScope===null)throw W(`beginScope must be object`),q;J(e,e.begin,{key:`beginScope`}),e.begin=C(e.begin,{joinWith:``})}}function ve(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw W(`skip, excludeEnd, returnEnd not compatible with endScope: {}`),q;if(typeof e.endScope!=`object`||e.endScope===null)throw W(`endScope must be object`),q;J(e,e.end,{key:`endScope`}),e.end=C(e.end,{joinWith:``})}}function ye(e){e.scope&&typeof e.scope==`object`&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function be(e){ye(e),typeof e.beginScope==`string`&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope==`string`&&(e.endScope={_wrap:e.endScope}),_e(e),ve(e)}function xe(e){function t(t,n){return new RegExp(p(t),`m`+(e.case_insensitive?`i`:``)+(e.unicodeRegex?`u`:``)+(n?`g`:``))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=b(e)+1}compile(){this.regexes.length===0&&(this.exec=()=>null),this.matcherRe=t(C(this.regexes.map(e=>e[1]),{joinWith:`|`}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;let t=this.matcherRe.exec(e);if(!t)return null;let n=t.findIndex((e,t)=>t>0&&e!==void 0),r=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,r)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];let t=new n;return this.rules.slice(e).forEach(([e,n])=>t.addRule(e,n)),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),t.type===`begin`&&this.count++}exec(e){let t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition()&&!(n&&n.index===this.lastIndex)){let t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}function i(e){let t=new r;return e.contains.forEach(e=>t.addRule(e.begin,{rule:e,type:`begin`})),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:`end`}),e.illegal&&t.addRule(e.illegal,{type:`illegal`}),t}function o(n,r){let a=n;if(n.isCompiled)return a;[se,ue,be,fe].forEach(e=>e(n,r)),e.compilerExtensions.forEach(e=>e(n,r)),n.__beforeBegin=null,[ce,le,de].forEach(e=>e(n,r)),n.isCompiled=!0;let s=null;return typeof n.keywords==`object`&&n.keywords.$pattern&&(n.keywords=Object.assign({},n.keywords),s=n.keywords.$pattern,delete n.keywords.$pattern),s||=/\w+/,n.keywords&&=H(n.keywords,e.case_insensitive),a.keywordPatternRe=t(s,!0),r&&(n.begin||=/\B|\b/,a.beginRe=t(a.begin),!n.end&&!n.endsWithParent&&(n.end=/\B|\b/),n.end&&(a.endRe=t(a.end)),a.terminatorEnd=p(a.end)||``,n.endsWithParent&&r.terminatorEnd&&(a.terminatorEnd+=(n.end?`|`:``)+r.terminatorEnd)),n.illegal&&(a.illegalRe=t(n.illegal)),n.contains||=[],n.contains=[].concat(...n.contains.map(function(e){return Se(e===`self`?n:e)})),n.contains.forEach(function(e){o(e,a)}),n.starts&&o(n.starts,r),a.matcher=i(a),a}if(e.compilerExtensions||=[],e.contains&&e.contains.includes(`self`))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=a(e.classNameAliases||{}),o(e)}function Y(e){return e?e.endsWithParent||Y(e.starts):!1}function Se(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return a(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:Y(e)?a(e,{starts:e.starts?a(e.starts):null}):Object.isFrozen(e)?a(e):e}var Ce=`11.11.1`,we=class extends Error{constructor(e,t){super(e),this.name=`HTMLInjectionError`,this.html=t}},X=i,Z=a,Q=Symbol(`nomatch`),Te=7,Ee=function(e){let t=Object.create(null),i=Object.create(null),a=[],o=!0,s=`Could not find the language '{}', did you forget to load/include a language module?`,c={disableAutodetect:!0,name:`Plain text`,contains:[]},l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:`hljs-`,cssSelector:`pre code`,languages:null,__emitter:f};function u(e){return l.noHighlightRe.test(e)}function d(e){let t=e.className+` `;t+=e.parentNode?e.parentNode.className:``;let n=l.languageDetectRe.exec(t);if(n){let t=N(n[1]);return t||(G(s.replace(`{}`,n[1])),G(`Falling back to no-highlight mode for this block.`,e)),t?n[1]:`no-highlight`}return t.split(/\s+/).find(e=>u(e)||N(e))}function p(e,t,n){let r=``,i=``;typeof t==`object`?(r=e,n=t.ignoreIllegals,i=t.language):(K(`10.7.0`,`highlight(lang, code, ...args) has been deprecated.`),K(`10.7.0`,`Please use highlight(code, options) instead.
2
- https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(n=!0);let a={code:r,language:i};z(`before:highlight`,a);let o=a.result?a.result:v(a.language,a.code,n);return o.code=a.code,z(`after:highlight`,o),o}function v(e,n,i,a){let c=Object.create(null);function u(e,t){return e.keywords[t]}function d(){if(!A.keywords){M.addText(P);return}let e=0;A.keywordPatternRe.lastIndex=0;let t=A.keywordPatternRe.exec(P),n=``;for(;t;){n+=P.substring(e,t.index);let r=D.case_insensitive?t[0].toLowerCase():t[0],i=u(A,r);if(i){let[e,a]=i;if(M.addText(n),n=``,c[r]=(c[r]||0)+1,c[r]<=Te&&(F+=a),e.startsWith(`_`))n+=t[0];else{let n=D.classNameAliases[e]||e;m(t[0],n)}}else n+=t[0];e=A.keywordPatternRe.lastIndex,t=A.keywordPatternRe.exec(P)}n+=P.substring(e),M.addText(n)}function f(){if(P===``)return;let e=null;if(typeof A.subLanguage==`string`){if(!t[A.subLanguage]){M.addText(P);return}e=v(A.subLanguage,P,!0,j[A.subLanguage]),j[A.subLanguage]=e._top}else e=S(P,A.subLanguage.length?A.subLanguage:null);A.relevance>0&&(F+=e.relevance),M.__addSublanguage(e._emitter,e.language)}function p(){A.subLanguage==null?d():f(),P=``}function m(e,t){e!==``&&(M.startScope(t),M.addText(e),M.endScope())}function h(e,t){let n=1,r=t.length-1;for(;n<=r;){if(!e._emit[n]){n++;continue}let r=D.classNameAliases[e[n]]||e[n],i=t[n];r?m(i,r):(P=i,d(),P=``),n++}}function g(e,t){return e.scope&&typeof e.scope==`string`&&M.openNode(D.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(m(P,D.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),P=``):e.beginScope._multi&&(h(e.beginScope,t),P=``)),A=Object.create(e,{parent:{value:A}}),A}function _(e,t,n){let i=x(e.endRe,n);if(i){if(e[`on:end`]){let n=new r(e);e[`on:end`](t,n),n.isMatchIgnored&&(i=!1)}if(i){for(;e.endsParent&&e.parent;)e=e.parent;return e}}if(e.endsWithParent)return _(e.parent,t,n)}function y(e){return A.matcher.regexIndex===0?(P+=e[0],1):(R=!0,0)}function b(e){let t=e[0],n=e.rule,i=new r(n),a=[n.__beforeBegin,n[`on:begin`]];for(let n of a)if(n&&(n(e,i),i.isMatchIgnored))return y(t);return n.skip?P+=t:(n.excludeBegin&&(P+=t),p(),!n.returnBegin&&!n.excludeBegin&&(P=t)),g(n,e),n.returnBegin?0:t.length}function C(e){let t=e[0],r=n.substring(e.index),i=_(A,e,r);if(!i)return Q;let a=A;A.endScope&&A.endScope._wrap?(p(),m(t,A.endScope._wrap)):A.endScope&&A.endScope._multi?(p(),h(A.endScope,e)):a.skip?P+=t:(a.returnEnd||a.excludeEnd||(P+=t),p(),a.excludeEnd&&(P=t));do A.scope&&M.closeNode(),!A.skip&&!A.subLanguage&&(F+=A.relevance),A=A.parent;while(A!==i.parent);return i.starts&&g(i.starts,e),a.returnEnd?0:t.length}function w(){let e=[];for(let t=A;t!==D;t=t.parent)t.scope&&e.unshift(t.scope);e.forEach(e=>M.openNode(e))}let T={};function E(t,r){let a=r&&r[0];if(P+=t,a==null)return p(),0;if(T.type===`begin`&&r.type===`end`&&T.index===r.index&&a===``){if(P+=n.slice(r.index,r.index+1),!o){let t=Error(`0 width match regex (${e})`);throw t.languageName=e,t.badRule=T.rule,t}return 1}if(T=r,r.type===`begin`)return b(r);if(r.type===`illegal`&&!i){let e=Error(`Illegal lexeme "`+a+`" for mode "`+(A.scope||`<unnamed>`)+`"`);throw e.mode=A,e}else if(r.type===`end`){let e=C(r);if(e!==Q)return e}if(r.type===`illegal`&&a===``)return P+=`
3
- `,1;if(L>1e5&&L>r.index*3)throw Error(`potential infinite loop, way more iterations than matches`);return P+=a,a.length}let D=N(e);if(!D)throw W(s.replace(`{}`,e)),Error(`Unknown language: "`+e+`"`);let O=xe(D),k=``,A=a||O,j={},M=new l.__emitter(l);w();let P=``,F=0,I=0,L=0,R=!1;try{if(D.__emitTokens)D.__emitTokens(n,M);else{for(A.matcher.considerAll();;){L++,R?R=!1:A.matcher.considerAll(),A.matcher.lastIndex=I;let e=A.matcher.exec(n);if(!e)break;let t=E(n.substring(I,e.index),e);I=e.index+t}E(n.substring(I))}return M.finalize(),k=M.toHTML(),{language:e,value:k,relevance:F,illegal:!1,_emitter:M,_top:A}}catch(t){if(t.message&&t.message.includes(`Illegal`))return{language:e,value:X(n),illegal:!0,relevance:0,_illegalBy:{message:t.message,index:I,context:n.slice(I-100,I+100),mode:t.mode,resultSoFar:k},_emitter:M};if(o)return{language:e,value:X(n),illegal:!1,relevance:0,errorRaised:t,_emitter:M,_top:A};throw t}}function b(e){let t={value:X(e),illegal:!1,relevance:0,_top:c,_emitter:new l.__emitter(l)};return t._emitter.addText(e),t}function S(e,n){n=n||l.languages||Object.keys(t);let r=b(e),i=n.filter(N).filter(F).map(t=>v(t,e,!1));i.unshift(r);let[a,o]=i.sort((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(N(e.language).supersetOf===t.language)return 1;if(N(t.language).supersetOf===e.language)return-1}return 0}),s=a;return s.secondBest=o,s}function C(e,t,n){let r=t&&i[t]||n;e.classList.add(`hljs`),e.classList.add(`language-${r}`)}function w(e){let t=null,n=d(e);if(u(n))return;if(z(`before:highlightElement`,{el:e,language:n}),e.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e);return}if(e.children.length>0&&(l.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(e)),l.throwUnescapedHTML))throw new we(`One of your code blocks includes unescaped HTML.`,e.innerHTML);t=e;let r=t.textContent,i=n?p(r,{language:n,ignoreIllegals:!0}):S(r);e.innerHTML=i.value,e.dataset.highlighted=`yes`,C(e,n,i.language),e.result={language:i.language,re:i.relevance,relevance:i.relevance},i.secondBest&&(e.secondBest={language:i.secondBest.language,relevance:i.secondBest.relevance}),z(`after:highlightElement`,{el:e,result:i,text:r})}function T(e){l=Z(l,e)}let E=()=>{k(),K(`10.6.0`,`initHighlighting() deprecated. Use highlightAll() now.`)};function D(){k(),K(`10.6.0`,`initHighlightingOnLoad() deprecated. Use highlightAll() now.`)}let O=!1;function k(){function e(){k()}if(document.readyState===`loading`){O||window.addEventListener(`DOMContentLoaded`,e,!1),O=!0;return}document.querySelectorAll(l.cssSelector).forEach(w)}function A(n,r){let i=null;try{i=r(e)}catch(e){if(W(`Language definition for '{}' could not be registered.`.replace(`{}`,n)),o)W(e);else throw e;i=c}i.name||=n,t[n]=i,i.rawDefinition=r.bind(null,e),i.aliases&&P(i.aliases,{languageName:n})}function j(e){delete t[e];for(let t of Object.keys(i))i[t]===e&&delete i[t]}function M(){return Object.keys(t)}function N(e){return e=(e||``).toLowerCase(),t[e]||t[i[e]]}function P(e,{languageName:t}){typeof e==`string`&&(e=[e]),e.forEach(e=>{i[e.toLowerCase()]=t})}function F(e){let t=N(e);return t&&!t.disableAutodetect}function I(e){e[`before:highlightBlock`]&&!e[`before:highlightElement`]&&(e[`before:highlightElement`]=t=>{e[`before:highlightBlock`](Object.assign({block:t.el},t))}),e[`after:highlightBlock`]&&!e[`after:highlightElement`]&&(e[`after:highlightElement`]=t=>{e[`after:highlightBlock`](Object.assign({block:t.el},t))})}function L(e){I(e),a.push(e)}function R(e){let t=a.indexOf(e);t!==-1&&a.splice(t,1)}function z(e,t){let n=e;a.forEach(function(e){e[n]&&e[n](t)})}function B(e){return K(`10.7.0`,`highlightBlock will be removed entirely in v12.0`),K(`10.7.0`,`Please use highlightElement now.`),w(e)}Object.assign(e,{highlight:p,highlightAuto:S,highlightAll:k,highlightElement:w,highlightBlock:B,configure:T,initHighlighting:E,initHighlightingOnLoad:D,registerLanguage:A,unregisterLanguage:j,listLanguages:M,getLanguage:N,registerAliases:P,autoDetection:F,inherit:Z,addPlugin:L,removePlugin:R}),e.debugMode=function(){o=!1},e.safeMode=function(){o=!0},e.versionString=Ce,e.regex={concat:_,lookahead:m,either:y,optional:g,anyNumberOfTimes:h};for(let e in V)typeof V[e]==`object`&&n(V[e]);return Object.assign(e,V),e},$=Ee({});$.newInstance=()=>Ee({}),t.exports=$,$.HighlightJS=$,$.default=$})),_=e(s(),1),v=e(g()).default;function y(e){let t=e.regex,n=/[\p{XID_Start}_]\p{XID_Continue}*/u,r=`and.as.assert.async.await.break.case.class.continue.def.del.elif.else.except.finally.for.from.global.if.import.in.is.lambda.match.nonlocal|10.not.or.pass.raise.return.try.while.with.yield`.split(`.`),i={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:`__import__.abs.all.any.ascii.bin.bool.breakpoint.bytearray.bytes.callable.chr.classmethod.compile.complex.delattr.dict.dir.divmod.enumerate.eval.exec.filter.float.format.frozenset.getattr.globals.hasattr.hash.help.hex.id.input.int.isinstance.issubclass.iter.len.list.locals.map.max.memoryview.min.next.object.oct.open.ord.pow.print.property.range.repr.reversed.round.set.setattr.slice.sorted.staticmethod.str.sum.super.tuple.type.vars.zip`.split(`.`),literal:[`__debug__`,`Ellipsis`,`False`,`None`,`NotImplemented`,`True`],type:[`Any`,`Callable`,`Coroutine`,`Dict`,`List`,`Literal`,`Generic`,`Optional`,`Sequence`,`Set`,`Tuple`,`Type`,`Union`]},a={className:`meta`,begin:/^(>>>|\.\.\.) /},o={className:`subst`,begin:/\{/,end:/\}/,keywords:i,illegal:/#/},s={begin:/\{\{/,relevance:0},c={className:`string`,contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a,s,o]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a,s,o]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,s,o]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,s,o]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},l=`[0-9](_?[0-9])*`,u=`(\\b(${l}))?\\.(${l})|\\b(${l})\\.`,d=`\\b|${r.join(`|`)}`,f={className:`number`,relevance:0,variants:[{begin:`(\\b(${l})|(${u}))[eE][+-]?(${l})[jJ]?(?=${d})`},{begin:`(${u})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${d})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${d})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${d})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${d})`},{begin:`\\b(${l})[jJ](?=${d})`}]},p={className:`comment`,begin:t.lookahead(/# type:/),end:/$/,keywords:i,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},m={className:`params`,variants:[{className:``,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:i,contains:[`self`,a,f,c,e.HASH_COMMENT_MODE]}]};return o.contains=[c,f,a],{name:`Python`,aliases:[`py`,`gyp`,`ipython`],unicodeRegex:!0,keywords:i,illegal:/(<\/|\?)|=>/,contains:[a,f,{scope:`variable.language`,match:/\bself\b/},{beginKeywords:`if`,relevance:0},{match:/\bor\b/,scope:`keyword`},c,p,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:`keyword`,3:`title.function`},contains:[m]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:`keyword`,3:`title.class`,6:`title.class.inherited`}},{className:`meta`,begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[f,m,c]}]}}var b=n();v.registerLanguage(`python`,y);var x=({code:e,language:t=`python`,onRun:n,isRunning:a=!1,executionMode:o,onModeChange:s})=>{let l=(0,_.useMemo)(()=>v.highlight(e,{language:t}).value.split(`
4
- `),[e,t]);return(0,b.jsxs)(`div`,{className:`overflow-hidden rounded-lg border border-black/10 bg-white`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-black/10 bg-neutral-50 px-4 py-2`,children:[(0,b.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:t}),(0,b.jsx)(`div`,{className:`flex-1`}),o&&s&&(0,b.jsx)(`div`,{className:`flex overflow-hidden rounded border border-black/10 text-[11px] font-medium`,children:[`local`,`remote`].map(e=>(0,b.jsx)(`button`,{onClick:()=>s(e),className:`px-2.5 py-0.5 transition-colors ${o===e?`bg-neutral-700 text-white`:`bg-white text-neutral-500 hover:bg-neutral-100`}`,children:e===`local`?`Local`:`Remote`},e))}),n&&(0,b.jsxs)(`button`,{onClick:n,disabled:a,className:`flex items-center gap-1.5 rounded-full border border-black/10 bg-white px-3 py-1 text-[11px] font-medium text-neutral-600 transition-colors hover:border-green-300 hover:text-green-700 disabled:cursor-wait disabled:opacity-50`,children:[(0,b.jsx)(c,{icon:a?i:r,className:a?`animate-spin`:``}),(0,b.jsx)(`span`,{children:a?`Running…`:`Run`})]})]}),(0,b.jsxs)(`div`,{className:`flex overflow-auto bg-white font-mono text-[13px] leading-[20px]`,children:[(0,b.jsx)(`div`,{className:`shrink-0 select-none border-r border-black/5 bg-neutral-50 px-3 py-3 text-right text-neutral-300`,children:l.map((e,t)=>(0,b.jsx)(`div`,{children:String(t+1)},t))}),(0,b.jsx)(`div`,{className:`flex-1 overflow-auto py-3 pl-4 pr-4`,children:l.map((e,t)=>(0,b.jsx)(`div`,{className:`hljs whitespace-pre`,dangerouslySetInnerHTML:{__html:e||`\xA0`}},t))})]})]})},S=({title:e,defaultOpen:t=!1,children:n})=>{let[r,i]=(0,_.useState)(t);return(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`button`,{onClick:()=>{i(e=>!e)},className:`flex w-full items-center gap-1.5 py-1 text-[11px] font-semibold uppercase tracking-widest text-neutral-400 hover:text-neutral-600`,children:[(0,b.jsx)(c,{icon:r?o:a,className:`w-2.5`}),e]}),r&&(0,b.jsx)(`div`,{className:`pb-2`,children:n})]})},C=({result:e})=>{let t=Object.entries(e.outputValues);return(0,b.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-black/10 bg-white p-4`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`rounded px-2 py-0.5 text-[11px] font-semibold ${e.success?`bg-green-100 text-green-700`:`bg-red-100 text-red-700`}`,children:e.success?`Success`:`Error`}),(0,b.jsxs)(`span`,{className:`text-[11px] text-neutral-400`,children:[String(e.durationMs),`ms`]}),e.exitCode!==0&&(0,b.jsxs)(`span`,{className:`text-[11px] text-neutral-400`,children:[`exit code `,String(e.exitCode)]})]}),e.error&&(0,b.jsx)(`pre`,{className:`overflow-auto rounded bg-red-50 p-3 font-mono text-[12px] text-red-800`,children:e.error}),t.length>0&&(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`mb-1 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Outputs`}),(0,b.jsx)(`div`,{className:`divide-y divide-black/5`,children:t.map(([e,t])=>(0,b.jsxs)(`div`,{className:`flex items-start gap-2 py-1.5`,children:[(0,b.jsx)(`span`,{className:`shrink-0 font-mono text-[12px] text-neutral-600`,children:e}),(0,b.jsx)(`span`,{className:`text-[11px] text-neutral-300`,children:`=`}),(0,b.jsx)(`pre`,{className:`min-w-0 flex-1 overflow-auto font-mono text-[12px] text-neutral-800`,children:typeof t==`string`?t:JSON.stringify(t,null,2)})]},e))})]}),e.logs.length>0&&(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`div`,{className:`mb-1 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Logs`}),(0,b.jsx)(`div`,{className:`space-y-0.5`,children:e.logs.map((e,t)=>(0,b.jsx)(`div`,{className:`font-mono text-[12px] text-neutral-600`,children:e},t))})]}),e.stdout&&(0,b.jsx)(S,{title:`Stdout`,children:(0,b.jsx)(`pre`,{className:`overflow-auto rounded bg-neutral-50 p-3 font-mono text-[12px] text-neutral-700`,children:e.stdout})}),e.stderr&&(0,b.jsx)(S,{title:`Stderr`,children:(0,b.jsx)(`pre`,{className:`overflow-auto rounded bg-neutral-50 p-3 font-mono text-[12px] text-neutral-700`,children:e.stderr})})]})},w=()=>{let{apiName:e,stepApiName:t}=u({strict:!1}),n=l(),{data:r,isLoading:i,isError:a}=d(f),[o,s]=(0,_.useState)(!1),[c,g]=(0,_.useState)(null),[v,y]=h(`kizen-step-inputs:${e??``}:${t??``}`,{}),[S,w]=h(`kizen-step-secrets:${e??``}:${t??``}`,{}),[T,E]=h(`kizen-code-runner-mode`,`local`);p();let[D,O]=(0,_.useState)(!1);(0,_.useCallback)(e=>{navigator.clipboard.writeText(e).then(()=>{O(!0),setTimeout(()=>O(!1),1500)})},[]);let k=r?.find(t=>t.api_name===e),A=(0,_.useMemo)(()=>k?.artifacts.automation_action_configs??[],[k]),j=A.find(e=>e.action_step_api_name===t)??A[0];if((0,_.useEffect)(()=>{if(!t&&A.length>0&&e){let t=A[0];t&&n({to:`/$apiName/code-steps/$stepApiName`,params:{apiName:e,stepApiName:t.action_step_api_name},replace:!0})}},[t,A,e,n]),(0,_.useEffect)(()=>{g(null)},[t]),i)return(0,b.jsx)(m,{children:(0,b.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-400`,children:`Fetching bundle.json…`})});if(a)return(0,b.jsx)(m,{children:(0,b.jsx)(`p`,{className:`m-0 text-[13px] text-red-700`,children:`Could not load bundle.json.`})});if(!k)return(0,b.jsx)(m,{children:(0,b.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`No app found with api_name`,` `,(0,b.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:e}),`.`]})});if(A.length===0)return(0,b.jsx)(m,{children:(0,b.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:`This app has no automation code steps.`})});if(!j)return(0,b.jsx)(m,{children:(0,b.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`Step not found: `,(0,b.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:t}),`.`]})});let M=async()=>{s(!0),g(null),console.log(Object.fromEntries(j.secrets.map(t=>[`${e??``}__${t}`,S[t]??``])));try{let t={script:j.script,scriptRuntime:j.script_runtime,inputs:v},n=T===`remote`?{...t,mode:`remote`,inputTypes:Object.fromEntries(j.inputs.map(e=>[e.name,e.data_type])),outputTypes:Object.fromEntries(j.outputs.map(e=>[e.name,e.data_type])),secretNames:j.secrets.map(t=>`${e??``}__${t}`)}:{...t,secrets:Object.fromEntries(j.secrets.map(t=>[`${e??``}__${t}`,S[t]??``]))};g(await(await fetch(`/api/execute-step`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)})).json())}catch(e){g({success:!1,outputValues:{},logs:[],stdout:``,stderr:``,error:e instanceof Error?e.message:String(e),exitCode:1,durationMs:0})}finally{s(!1)}};return(0,b.jsxs)(`div`,{className:`space-y-4`,children:[(0,b.jsxs)(m,{children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,b.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Code Step`}),(0,b.jsx)(`select`,{value:j.action_step_api_name,onChange:t=>{e&&n({to:`/$apiName/code-steps/$stepApiName`,params:{apiName:e,stepApiName:t.target.value}})},className:`rounded border border-black/10 bg-transparent px-2 py-0.5 text-[13px] font-mono text-neutral-700 focus:outline-none`,children:A.map(e=>(0,b.jsx)(`option`,{value:e.action_step_api_name,children:e.name},e.action_step_api_name))}),(0,b.jsx)(`div`,{className:`flex-1`}),(0,b.jsx)(`span`,{className:`rounded bg-blue-50 px-1.5 py-0.5 text-[10px] font-semibold text-blue-600`,children:j.script_runtime})]}),j.overall_description&&(0,b.jsx)(`p`,{className:`mt-2 text-[12px] text-neutral-500`,children:j.overall_description})]}),j.inputs.length>0&&(0,b.jsxs)(m,{children:[(0,b.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Inputs`}),(0,b.jsx)(`div`,{className:`space-y-3`,children:j.inputs.map(e=>(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`label`,{className:`mb-1 block text-[12px] text-neutral-700`,children:[e.label,e.required&&(0,b.jsx)(`span`,{className:`ml-0.5 text-red-500`,children:`*`})]}),(0,b.jsx)(`input`,{type:`text`,value:v[e.name]??``,onChange:t=>{y({...v,[e.name]:t.target.value})},placeholder:e.name,className:`w-full rounded border border-black/10 bg-white px-2.5 py-1.5 font-mono text-[13px] text-neutral-800 placeholder:text-neutral-300 focus:border-blue-300 focus:outline-none`}),(0,b.jsx)(`div`,{className:`mt-0.5 font-mono text-[10px] text-neutral-400`,children:e.name})]},e.name))})]}),j.secrets.length>0&&(0,b.jsxs)(m,{children:[(0,b.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Secrets`}),(0,b.jsx)(`div`,{className:`space-y-3`,children:j.secrets.map(e=>(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`label`,{className:`mb-1 block text-[12px] text-neutral-700`,children:e}),(0,b.jsx)(`input`,{type:`password`,value:S[e]??``,onChange:t=>{w({...S,[e]:t.target.value})},placeholder:e,className:`w-full rounded border border-black/10 bg-white px-2.5 py-1.5 font-mono text-[13px] text-neutral-800 placeholder:text-neutral-300 focus:border-blue-300 focus:outline-none`})]},e))})]}),(0,b.jsx)(x,{code:j.script,language:`python`,onRun:()=>void M(),isRunning:o,executionMode:T,onModeChange:E}),c&&(0,b.jsx)(C,{result:c})]})};export{w as CodeStepsPage};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{b as t,h as n,x as r,y as i}from"./fa-core-wsCxaNB7.js";import{R as a,n as o,t as s}from"./bundleQuery-L4H4wq5q.js";import{a as c,i as l,n as u}from"./BootstrapContext-DbnbWmQT.js";import{a as d,c as f,f as p,i as m,l as h,n as g,o as _,p as v,r as y,s as b,t as x}from"./useObjectLookups-CslM2vSA.js";import{r as S}from"./CredentialsContext-zl2e9kpM.js";import{t as C}from"./Card-DMz6T3VL.js";var w=e(r(),1),T=t(),E=({apiName:e})=>{let t=m(e),[n,r]=(0,w.useState)(t?.__kizen_clean_config?JSON.stringify(t.__kizen_clean_config,null,2):`{}`),[i,a]=(0,w.useState)(null),[o,s]=(0,w.useState)(!1);return(0,T.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,T.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,T.jsx)(`p`,{className:`text-[13px] text-neutral-500 m-0`,children:`No setup assistant defined. Enter configuration as JSON.`})}),(0,T.jsx)(`textarea`,{value:n,onChange:e=>{r(e.target.value),a(null),s(!1)},spellCheck:!1,className:`w-full min-h-[300px] rounded border p-3 text-[13px] font-mono leading-relaxed focus:outline-none focus:ring-1 ${i?`border-red-300 focus:ring-red-400`:`border-black/10 focus:ring-blue-400`}`}),i&&(0,T.jsxs)(`span`,{className:`text-[12px] text-red-500`,children:[`Parse error: `,i]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`button`,{onClick:()=>{try{b(e,JSON.parse(n)),a(null),s(!0),setTimeout(()=>{s(!1)},2e3)}catch(e){a(e instanceof Error?e.message:`Invalid JSON`),s(!1)}},className:`rounded bg-blue-600 px-4 py-1.5 text-[13px] font-medium text-white hover:bg-blue-700 active:bg-blue-800`,children:`Save Configuration`}),(0,T.jsx)(`button`,{onClick:()=>{g(e),r(`{}`),a(null),s(!1)},className:`rounded border border-black/10 px-4 py-1.5 text-[13px] font-medium text-neutral-600 hover:bg-neutral-50 active:bg-neutral-100`,children:`Reset`}),o&&(0,T.jsx)(`span`,{className:`text-[12px] text-green-600 font-medium`,children:`Saved`})]})]})},D=({config:e,apiName:t,loadFn:n,saveFn:r,clearFn:i})=>{let a=n(t)?.__kizen_setup_assistant_values,o=(0,w.useRef)({}),[s,c]=(0,w.useState)(!1),{getObjectByAPIName:l,getCustomObjectDetails:u}=x(),d=(0,w.useCallback)(e=>{o.current=e},[]);return(0,T.jsx)(v,{config:e,value:a,onStateChange:d,disabledKeys:[],getObjectByAPIName:l,getCustomObjectDetails:u,children:(0,T.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[e.fields?.map(e=>(0,T.jsx)(h,{field:e,pluginApiName:t},e.key)),(0,T.jsxs)(`div`,{className:`flex items-center gap-2 mt-2`,children:[(0,T.jsx)(`button`,{onClick:()=>{let n=o.current;r(t,n,e),c(!0),setTimeout(()=>{c(!1)},2e3)},className:`rounded bg-blue-600 px-4 py-1.5 text-[13px] font-medium text-white hover:bg-blue-700 active:bg-blue-800`,children:`Save Configuration`}),(0,T.jsx)(`button`,{onClick:()=>{i(t),window.location.reload()},className:`rounded border border-black/10 px-4 py-1.5 text-[13px] font-medium text-neutral-600 hover:bg-neutral-50 active:bg-neutral-100`,children:`Reset`}),s&&(0,T.jsx)(`span`,{className:`text-[12px] text-green-600 font-medium`,children:`Saved`})]})]})})},O=({config:e,apiName:t,loadFn:r,saveFn:a,clearFn:o})=>{let s=u(),d=c(),{environment:f}=S(),m=l[f],[h,g]=(0,w.useState)(!1),[_,v]=(0,w.useState)(!1);return s?(0,T.jsx)(p,{appPath:m,user:{id:s.team.user,crm_client_id:``},business:s.business,clientObject:s.business.client_object?{id:s.business.client_object.id,objectName:s.business.client_object.object_name}:void 0,teamMember:s.team,onNavigate:()=>{},performFileUpload:()=>Promise.resolve({url:``}),monitoringExceptionHelper:()=>{},performRequest:async(e,t,n,r)=>{let i=n?.headers,a=r instanceof FormData||r instanceof Blob,o=r!=null&&!a?{"Content-Type":`application/json`,...i}:i,s=await d(t,{method:e.toUpperCase(),...r!=null&&{body:a?r:JSON.stringify(r)},...o!=null&&{headers:o}});return s.status===204||s.headers.get(`content-length`)===`0`?{data:{}}:{data:await s.json()}},modal:{showing:h,show:_,showPrompt:()=>{g(!0),v(!0)},onConfirm:()=>{g(!1),v(!1)},onHide:()=>{g(!1),v(!1)}},showToast:()=>{},clearToasts:()=>{},children:()=>(0,T.jsx)(D,{config:e,apiName:t,loadFn:r,saveFn:a,clearFn:o})}):(0,T.jsx)(i,{icon:n,className:`animate-spin text-neutral-400`})},k=()=>{let{apiName:e}=a({strict:!1}),{data:t,isLoading:n,isError:r}=o(s);if(n)return(0,T.jsx)(C,{children:(0,T.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-400`,children:`Fetching bundle.json…`})});if(r)return(0,T.jsx)(C,{children:(0,T.jsx)(`p`,{className:`m-0 text-[13px] text-red-700`,children:`Could not load bundle.json.`})});let i=t?.find(t=>t.api_name===e);if(!i)return(0,T.jsx)(C,{children:(0,T.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`No app found with api_name`,` `,(0,T.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:e}),`.`]})});let c=i.base_config,l=c?.setup_assistant,u=c?.user_setup_assistant,p=(l?.fields?.length??0)>0,h=(u?.fields?.length??0)>0;return!p&&!h?(0,T.jsx)(C,{children:(0,T.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h2`,{className:`text-[15px] font-bold text-neutral-900 m-0`,children:`Configuration`}),(0,T.jsx)(`p`,{className:`text-[12px] text-neutral-400 m-0 mt-1`,children:`Enter plugin configuration as JSON.`})]}),(0,T.jsx)(E,{apiName:e??``})]})}):(0,T.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start`,children:[p&&l&&(0,T.jsx)(C,{className:`lg:flex-1 lg:min-w-0`,children:(0,T.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h2`,{className:`text-[15px] font-bold text-neutral-900 m-0`,children:`Business Configuration`}),(0,T.jsxs)(`p`,{className:`text-[12px] text-neutral-400 m-0 mt-1`,children:[`Configure the business-level setup assistant fields. These values are shared across the whole business and exposed to plugin scripts at`,` `,(0,T.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:`this.config`}),`.`]})]}),(0,T.jsx)(O,{config:l,apiName:e??``,loadFn:m,saveFn:_,clearFn:g})]})}),h&&u&&(0,T.jsx)(C,{className:`lg:flex-1 lg:min-w-0`,children:(0,T.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h2`,{className:`text-[15px] font-bold text-neutral-900 m-0`,children:`User Configuration`}),(0,T.jsxs)(`p`,{className:`text-[12px] text-neutral-400 m-0 mt-1`,children:[`Configure the per-user setup assistant fields. These values are scoped to the logged-in user and exposed to plugin scripts at`,` `,(0,T.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:`this.userConfig`}),`.`]})]}),(0,T.jsx)(O,{config:u,apiName:e??``,loadFn:d,saveFn:f,clearFn:y})]})})]})};export{k as ConfigurationPage};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{b as t,h as n,x as r,y as i}from"./fa-core-wsCxaNB7.js";import{R as a,n as o,t as s}from"./bundleQuery-L4H4wq5q.js";import{n as c}from"./BootstrapContext-CTQMWXf-.js";import{a as l,c as u,f as d,i as f,l as p,n as m,o as h,p as g,r as _,s as v,t as y}from"./useObjectLookups-C65zm-bM.js";import{r as b}from"./CredentialsContext-zl2e9kpM.js";import{n as x,r as S}from"./api-BOqcXygX.js";import{t as C}from"./Card-Bmn1HMWl.js";var w=e(r(),1),T=t(),E=({apiName:e})=>{let t=f(e),[n,r]=(0,w.useState)(t?.__kizen_clean_config?JSON.stringify(t.__kizen_clean_config,null,2):`{}`),[i,a]=(0,w.useState)(null),[o,s]=(0,w.useState)(!1);return(0,T.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,T.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,T.jsx)(`p`,{className:`text-[13px] text-neutral-500 m-0`,children:`No setup assistant defined. Enter configuration as JSON.`})}),(0,T.jsx)(`textarea`,{value:n,onChange:e=>{r(e.target.value),a(null),s(!1)},spellCheck:!1,className:`w-full min-h-[300px] rounded border p-3 text-[13px] font-mono leading-relaxed focus:outline-none focus:ring-1 ${i?`border-red-300 focus:ring-red-400`:`border-black/10 focus:ring-blue-400`}`}),i&&(0,T.jsxs)(`span`,{className:`text-[12px] text-red-500`,children:[`Parse error: `,i]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`button`,{onClick:()=>{try{v(e,JSON.parse(n)),a(null),s(!0),setTimeout(()=>{s(!1)},2e3)}catch(e){a(e instanceof Error?e.message:`Invalid JSON`),s(!1)}},className:`rounded bg-blue-600 px-4 py-1.5 text-[13px] font-medium text-white hover:bg-blue-700 active:bg-blue-800`,children:`Save Configuration`}),(0,T.jsx)(`button`,{onClick:()=>{m(e),r(`{}`),a(null),s(!1)},className:`rounded border border-black/10 px-4 py-1.5 text-[13px] font-medium text-neutral-600 hover:bg-neutral-50 active:bg-neutral-100`,children:`Reset`}),o&&(0,T.jsx)(`span`,{className:`text-[12px] text-green-600 font-medium`,children:`Saved`})]})]})},D=({config:e,apiName:t,loadFn:n,saveFn:r,clearFn:i})=>{let a=n(t)?.__kizen_setup_assistant_values,o=(0,w.useRef)({}),[s,c]=(0,w.useState)(!1),{getObjectByAPIName:l,getCustomObjectDetails:u}=y(),d=(0,w.useCallback)(e=>{o.current=e},[]);return(0,T.jsx)(g,{config:e,value:a,onStateChange:d,disabledKeys:[],getObjectByAPIName:l,getCustomObjectDetails:u,children:(0,T.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[e.fields?.map(e=>(0,T.jsx)(p,{field:e,pluginApiName:t},e.key)),(0,T.jsxs)(`div`,{className:`flex items-center gap-2 mt-2`,children:[(0,T.jsx)(`button`,{onClick:()=>{let n=o.current;r(t,n,e),c(!0),setTimeout(()=>{c(!1)},2e3)},className:`rounded bg-blue-600 px-4 py-1.5 text-[13px] font-medium text-white hover:bg-blue-700 active:bg-blue-800`,children:`Save Configuration`}),(0,T.jsx)(`button`,{onClick:()=>{i(t),window.location.reload()},className:`rounded border border-black/10 px-4 py-1.5 text-[13px] font-medium text-neutral-600 hover:bg-neutral-50 active:bg-neutral-100`,children:`Reset`}),s&&(0,T.jsx)(`span`,{className:`text-[12px] text-green-600 font-medium`,children:`Saved`})]})]})})},O=({config:e,apiName:t,loadFn:r,saveFn:a,clearFn:o})=>{let s=c(),l=S(),{environment:u}=b(),f=x[u],[p,m]=(0,w.useState)(!1),[h,g]=(0,w.useState)(!1);return s?(0,T.jsx)(d,{appPath:f,user:{id:s.team.user,crm_client_id:``},business:s.business,clientObject:s.business.client_object?{id:s.business.client_object.id,objectName:s.business.client_object.object_name}:void 0,teamMember:s.team,onNavigate:()=>{},performFileUpload:()=>Promise.resolve({url:``}),monitoringExceptionHelper:()=>{},performRequest:async(e,t,n,r)=>{let i=n?.headers,a=r instanceof FormData||r instanceof Blob,o=r!=null&&!a?{"Content-Type":`application/json`,...i}:i,s=await l(t,{method:e.toUpperCase(),...r!=null&&{body:a?r:JSON.stringify(r)},...o!=null&&{headers:o}});return s.status===204||s.headers.get(`content-length`)===`0`?{data:{}}:{data:await s.json()}},modal:{showing:p,show:h,showPrompt:()=>{m(!0),g(!0)},onConfirm:()=>{m(!1),g(!1)},onHide:()=>{m(!1),g(!1)}},showToast:()=>{},clearToasts:()=>{},children:()=>(0,T.jsx)(D,{config:e,apiName:t,loadFn:r,saveFn:a,clearFn:o})}):(0,T.jsx)(i,{icon:n,className:`animate-spin text-neutral-400`})},k=()=>{let{apiName:e}=a({strict:!1}),{data:t,isLoading:n,isError:r}=o(s);if(n)return(0,T.jsx)(C,{children:(0,T.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-400`,children:`Fetching bundle.json…`})});if(r)return(0,T.jsx)(C,{children:(0,T.jsx)(`p`,{className:`m-0 text-[13px] text-red-700`,children:`Could not load bundle.json.`})});let i=t?.find(t=>t.api_name===e);if(!i)return(0,T.jsx)(C,{children:(0,T.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`No app found with api_name`,` `,(0,T.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:e}),`.`]})});let c=i.base_config,d=c?.setup_assistant,p=c?.user_setup_assistant,g=(d?.fields?.length??0)>0,v=(p?.fields?.length??0)>0;return!g&&!v?(0,T.jsx)(C,{children:(0,T.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h2`,{className:`text-[15px] font-bold text-neutral-900 m-0`,children:`Configuration`}),(0,T.jsx)(`p`,{className:`text-[12px] text-neutral-400 m-0 mt-1`,children:`Enter plugin configuration as JSON.`})]}),(0,T.jsx)(E,{apiName:e??``})]})}):(0,T.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start`,children:[g&&d&&(0,T.jsx)(C,{className:`lg:flex-1 lg:min-w-0`,children:(0,T.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h2`,{className:`text-[15px] font-bold text-neutral-900 m-0`,children:`Business Configuration`}),(0,T.jsxs)(`p`,{className:`text-[12px] text-neutral-400 m-0 mt-1`,children:[`Configure the business-level setup assistant fields. These values are shared across the whole business and exposed to plugin scripts at`,` `,(0,T.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:`this.config`}),`.`]})]}),(0,T.jsx)(O,{config:d,apiName:e??``,loadFn:f,saveFn:h,clearFn:m})]})}),v&&p&&(0,T.jsx)(C,{className:`lg:flex-1 lg:min-w-0`,children:(0,T.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h2`,{className:`text-[15px] font-bold text-neutral-900 m-0`,children:`User Configuration`}),(0,T.jsxs)(`p`,{className:`text-[12px] text-neutral-400 m-0 mt-1`,children:[`Configure the per-user setup assistant fields. These values are scoped to the logged-in user and exposed to plugin scripts at`,` `,(0,T.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:`this.userConfig`}),`.`]})]}),(0,T.jsx)(O,{config:p,apiName:e??``,loadFn:l,saveFn:u,clearFn:_})]})})]})};export{k as ConfigurationPage};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{C as t,S as n,_ as r,x as i}from"./fa-core-DaD7O-yO.js";import{R as a,n as o,t as s}from"./bundleQuery-206rQR6g.js";import{n as c}from"./BootstrapContext-CExPp3R2.js";import{a as l,c as u,f as d,i as f,l as p,n as m,o as h,p as g,r as _,s as v,t as y}from"./useObjectLookups-BAqe9wvu.js";import{r as b}from"./CredentialsContext-Xbse1T0q.js";import{n as x,r as S}from"./api-DqAiw0w9.js";import{t as C}from"./Card-DsqKctyM.js";var w=e(t(),1),T=n(),E=({apiName:e})=>{let t=f(e),[n,r]=(0,w.useState)(t?.__kizen_clean_config?JSON.stringify(t.__kizen_clean_config,null,2):`{}`),[i,a]=(0,w.useState)(null),[o,s]=(0,w.useState)(!1);return(0,T.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,T.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,T.jsx)(`p`,{className:`text-[13px] text-neutral-500 m-0`,children:`No setup assistant defined. Enter configuration as JSON.`})}),(0,T.jsx)(`textarea`,{value:n,onChange:e=>{r(e.target.value),a(null),s(!1)},spellCheck:!1,className:`w-full min-h-[300px] rounded border p-3 text-[13px] font-mono leading-relaxed focus:outline-none focus:ring-1 ${i?`border-red-300 focus:ring-red-400`:`border-black/10 focus:ring-blue-400`}`}),i&&(0,T.jsxs)(`span`,{className:`text-[12px] text-red-500`,children:[`Parse error: `,i]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`button`,{onClick:()=>{try{v(e,JSON.parse(n)),a(null),s(!0),setTimeout(()=>{s(!1)},2e3)}catch(e){a(e instanceof Error?e.message:`Invalid JSON`),s(!1)}},className:`rounded bg-blue-600 px-4 py-1.5 text-[13px] font-medium text-white hover:bg-blue-700 active:bg-blue-800`,children:`Save Configuration`}),(0,T.jsx)(`button`,{onClick:()=>{m(e),r(`{}`),a(null),s(!1)},className:`rounded border border-black/10 px-4 py-1.5 text-[13px] font-medium text-neutral-600 hover:bg-neutral-50 active:bg-neutral-100`,children:`Reset`}),o&&(0,T.jsx)(`span`,{className:`text-[12px] text-green-600 font-medium`,children:`Saved`})]})]})},D=({config:e,apiName:t,loadFn:n,saveFn:r,clearFn:i})=>{let a=n(t)?.__kizen_setup_assistant_values,o=(0,w.useRef)({}),[s,c]=(0,w.useState)(!1),{getObjectByAPIName:l,getCustomObjectDetails:u}=y(),d=(0,w.useCallback)(e=>{o.current=e},[]);return(0,T.jsx)(g,{config:e,value:a,onStateChange:d,disabledKeys:[],getObjectByAPIName:l,getCustomObjectDetails:u,children:(0,T.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[e.fields?.map(e=>(0,T.jsx)(p,{field:e,pluginApiName:t},e.key)),(0,T.jsxs)(`div`,{className:`flex items-center gap-2 mt-2`,children:[(0,T.jsx)(`button`,{onClick:()=>{let n=o.current;r(t,n,e),c(!0),setTimeout(()=>{c(!1)},2e3)},className:`rounded bg-blue-600 px-4 py-1.5 text-[13px] font-medium text-white hover:bg-blue-700 active:bg-blue-800`,children:`Save Configuration`}),(0,T.jsx)(`button`,{onClick:()=>{i(t),window.location.reload()},className:`rounded border border-black/10 px-4 py-1.5 text-[13px] font-medium text-neutral-600 hover:bg-neutral-50 active:bg-neutral-100`,children:`Reset`}),s&&(0,T.jsx)(`span`,{className:`text-[12px] text-green-600 font-medium`,children:`Saved`})]})]})})},O=({config:e,apiName:t,loadFn:n,saveFn:a,clearFn:o})=>{let s=c(),l=S(),{environment:u}=b(),f=x[u],[p,m]=(0,w.useState)(!1),[h,g]=(0,w.useState)(!1);return s?(0,T.jsx)(d,{appPath:f,user:{id:s.team.user,crm_client_id:``},business:s.business,clientObject:s.business.client_object?{id:s.business.client_object.id,objectName:s.business.client_object.object_name}:void 0,teamMember:s.team,onNavigate:()=>{},performFileUpload:()=>Promise.resolve({url:``}),monitoringExceptionHelper:()=>{},performRequest:async(e,t,n,r)=>{let i=n?.headers,a=r instanceof FormData||r instanceof Blob,o=r!=null&&!a?{"Content-Type":`application/json`,...i}:i,s=await l(t,{method:e.toUpperCase(),...r!=null&&{body:a?r:JSON.stringify(r)},...o!=null&&{headers:o}});return s.status===204||s.headers.get(`content-length`)===`0`?{data:{}}:{data:await s.json()}},modal:{showing:p,show:h,showPrompt:()=>{m(!0),g(!0)},onConfirm:()=>{m(!1),g(!1)},onHide:()=>{m(!1),g(!1)}},showToast:()=>{},clearToasts:()=>{},children:()=>(0,T.jsx)(D,{config:e,apiName:t,loadFn:n,saveFn:a,clearFn:o})}):(0,T.jsx)(i,{icon:r,className:`animate-spin text-neutral-400`})},k=()=>{let{apiName:e}=a({strict:!1}),{data:t,isLoading:n,isError:r}=o(s);if(n)return(0,T.jsx)(C,{children:(0,T.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-400`,children:`Fetching bundle.json…`})});if(r)return(0,T.jsx)(C,{children:(0,T.jsx)(`p`,{className:`m-0 text-[13px] text-red-700`,children:`Could not load bundle.json.`})});let i=t?.find(t=>t.api_name===e);if(!i)return(0,T.jsx)(C,{children:(0,T.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`No app found with api_name`,` `,(0,T.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:e}),`.`]})});let c=i.base_config,d=c?.setup_assistant,p=c?.user_setup_assistant,g=(d?.fields?.length??0)>0,v=(p?.fields?.length??0)>0;return!g&&!v?(0,T.jsx)(C,{children:(0,T.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h2`,{className:`text-[15px] font-bold text-neutral-900 m-0`,children:`Configuration`}),(0,T.jsx)(`p`,{className:`text-[12px] text-neutral-400 m-0 mt-1`,children:`Enter plugin configuration as JSON.`})]}),(0,T.jsx)(E,{apiName:e??``})]})}):(0,T.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start`,children:[g&&d&&(0,T.jsx)(C,{className:`lg:flex-1 lg:min-w-0`,children:(0,T.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h2`,{className:`text-[15px] font-bold text-neutral-900 m-0`,children:`Business Configuration`}),(0,T.jsxs)(`p`,{className:`text-[12px] text-neutral-400 m-0 mt-1`,children:[`Configure the business-level setup assistant fields. These values are shared across the whole business and exposed to plugin scripts at`,` `,(0,T.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:`this.config`}),`.`]})]}),(0,T.jsx)(O,{config:d,apiName:e??``,loadFn:f,saveFn:h,clearFn:m})]})}),v&&p&&(0,T.jsx)(C,{className:`lg:flex-1 lg:min-w-0`,children:(0,T.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h2`,{className:`text-[15px] font-bold text-neutral-900 m-0`,children:`User Configuration`}),(0,T.jsxs)(`p`,{className:`text-[12px] text-neutral-400 m-0 mt-1`,children:[`Configure the per-user setup assistant fields. These values are scoped to the logged-in user and exposed to plugin scripts at`,` `,(0,T.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 font-mono text-[11px]`,children:`this.userConfig`}),`.`]})]}),(0,T.jsx)(O,{config:p,apiName:e??``,loadFn:l,saveFn:u,clearFn:_})]})})]})};export{k as ConfigurationPage};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{C as t}from"./fa-core-DaD7O-yO.js";var n=e(t(),1),r=[`go`,`fmo`,`staging`,`integration`,`test1`],i=(0,n.createContext)({apiKey:``,userId:``,businessId:``,environment:`go`}),a=()=>(0,n.useContext)(i);export{r as n,a as r,i as t};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{x as t}from"./fa-core-wsCxaNB7.js";var n=e(t(),1),r=[`go`,`fmo`,`staging`,`integration`,`test1`],i=(0,n.createContext)({apiKey:``,userId:``,businessId:``,environment:`go`}),a=()=>(0,n.useContext)(i);export{r as n,a as r,i as t};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{C as t,S as n,a as r,b as i,r as a,x as o}from"./fa-core-DaD7O-yO.js";import{n as s}from"./CredentialsContext-Xbse1T0q.js";var c=e(t(),1),l=n(),u=`integration:route-change`,d=`w-full rounded bg-neutral-800 border border-neutral-700 px-2 py-1 text-[12px] font-mono text-neutral-200 focus:outline-none focus:border-neutral-500`,f=`block text-[11px] font-semibold uppercase tracking-widest text-neutral-600 mb-1`;function p(e){return e.toTimeString().slice(0,8)}var m=()=>{let[e,t]=(0,c.useState)(`/`),[n,r]=(0,c.useState)(``),[i,a]=(0,c.useState)(``),[o,s]=(0,c.useState)([]),m=(0,c.useRef)(null);(0,c.useEffect)(()=>{m.current?.scrollIntoView({behavior:`smooth`})},[o]),(0,c.useEffect)(()=>{let e=e=>{let t=e;s(e=>[...e,{time:new Date,location:t.detail.location}].slice(-50))};return window.addEventListener(u,e),()=>{window.removeEventListener(u,e)}},[]);let h=()=>{let t=n&&!n.startsWith(`?`)?`?${n}`:n,r=i&&!i.startsWith(`#`)?`#${i}`:i,a={host:window.location.host,origin:window.location.origin,port:window.location.port,protocol:window.location.protocol,pathname:e,search:t,hash:r,href:`${window.location.origin}${e}${t}${r}`};window.dispatchEvent(new CustomEvent(u,{detail:{location:a}}))},g=e=>{e.key===`Enter`&&h()};return(0,l.jsxs)(`div`,{className:`flex flex-col gap-3 px-4 pb-3`,children:[(0,l.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,l.jsxs)(`div`,{className:`flex gap-2`,children:[(0,l.jsxs)(`div`,{className:`flex-1`,children:[(0,l.jsx)(`label`,{className:f,children:`Search`}),(0,l.jsx)(`input`,{type:`text`,className:d,value:n,onChange:e=>{r(e.target.value)},onKeyDown:g,placeholder:`?tab=notes`,spellCheck:!1})]}),(0,l.jsxs)(`div`,{className:`flex-1`,children:[(0,l.jsx)(`label`,{className:f,children:`Hash`}),(0,l.jsx)(`input`,{type:`text`,className:d,value:i,onChange:e=>{a(e.target.value)},onKeyDown:g,placeholder:`#section`,spellCheck:!1})]})]}),(0,l.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,l.jsxs)(`div`,{className:`flex-1`,children:[(0,l.jsx)(`label`,{className:f,children:`Pathname`}),(0,l.jsx)(`input`,{type:`text`,className:d,value:e,onChange:e=>{t(e.target.value)},onKeyDown:g,placeholder:`/client/abc-123/overview`,spellCheck:!1})]}),(0,l.jsx)(`button`,{onClick:h,className:`rounded bg-neutral-700 px-3 py-1.5 text-[12px] font-semibold text-neutral-200 hover:bg-neutral-600 active:bg-neutral-500`,children:`Dispatch`})]})]}),(0,l.jsxs)(`div`,{className:`flex flex-col border-t border-neutral-800 pt-2`,children:[(0,l.jsxs)(`div`,{className:`mb-1 flex items-center justify-between`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-500`,children:`Navigation Event Stream`}),o.length>0&&(0,l.jsx)(`button`,{onClick:()=>{s([])},className:`text-[11px] text-neutral-600 hover:text-neutral-300`,children:`clear`})]}),(0,l.jsxs)(`div`,{className:`max-h-40 overflow-y-auto`,children:[o.length===0?(0,l.jsx)(`p`,{className:`text-[12px] text-neutral-600`,children:`No events yet.`}):o.map((e,t)=>(0,l.jsxs)(`div`,{className:`px-2 py-0.5 font-mono text-[11px] leading-5 ${t%2==0?`bg-neutral-900`:`bg-neutral-800/40`}`,children:[(0,l.jsx)(`span`,{className:`text-neutral-600`,children:p(e.time)}),(0,l.jsx)(`span`,{className:`ml-2 text-neutral-300`,children:e.location.pathname}),e.location.search&&(0,l.jsx)(`span`,{className:`text-neutral-500`,children:e.location.search}),e.location.hash&&(0,l.jsx)(`span`,{className:`text-neutral-500`,children:e.location.hash})]},t)),(0,l.jsx)(`div`,{ref:m})]})]})]})},h=`w-full rounded bg-neutral-800 border border-neutral-700 px-2 py-1 text-[12px] font-mono text-neutral-200 focus:outline-none focus:border-neutral-500`,g=`block text-[11px] font-semibold uppercase tracking-widest text-neutral-600 mb-1`,_=`text-[11px] font-semibold uppercase tracking-widest text-neutral-500`,v={log:`text-neutral-400`,info:`text-blue-400`,warn:`text-yellow-400`,error:`text-red-400`};function y(e){if(typeof e==`string`)return e;if(e===null)return`null`;if(e===void 0)return`undefined`;try{return JSON.stringify(e)}catch{return`[unserializable]`}}var b=({logs:e,height:t})=>{let n=(0,c.useRef)(null);return(0,c.useEffect)(()=>{n.current?.scrollIntoView({behavior:`smooth`})},[e]),(0,l.jsxs)(`div`,{className:`${t} overflow-x-auto overflow-y-auto pb-4`,children:[e.length===0?(0,l.jsx)(`p`,{className:`px-4 text-[12px] text-neutral-600`,children:`No output yet.`}):e.map((e,t)=>(0,l.jsx)(`div`,{className:`whitespace-pre px-4 text-[12px] leading-5 ${v[e.level]} ${t%2==0?`bg-neutral-900`:`bg-neutral-800/40`}`,children:e.args.map(y).join(` `)},t)),(0,l.jsx)(`div`,{ref:n})]})},x=({logs:e,height:t})=>{let n=(0,c.useRef)(null);return(0,c.useEffect)(()=>{n.current?.scrollIntoView({behavior:`smooth`})},[e]),(0,l.jsxs)(`div`,{className:`${t} overflow-x-auto overflow-y-auto pb-4`,children:[e.length===0?(0,l.jsx)(`p`,{className:`px-4 text-[12px] text-neutral-600`,children:`No output yet.`}):e.map((e,t)=>(0,l.jsx)(`div`,{className:`whitespace-pre px-4 text-[12px] leading-5 text-neutral-500`,children:e},t)),(0,l.jsx)(`div`,{ref:n})]})};function S(e){switch(e.toUpperCase()){case`GET`:return`bg-blue-900/60 text-blue-300`;case`POST`:return`bg-green-900/60 text-green-300`;case`PUT`:return`bg-amber-900/60 text-amber-300`;case`PATCH`:return`bg-orange-900/60 text-orange-300`;case`DELETE`:return`bg-red-900/60 text-red-300`;default:return`bg-neutral-800 text-neutral-400`}}function C(e){return e===0?`bg-neutral-800 text-neutral-400`:e<300?`bg-green-900/60 text-green-300`:e<400?`bg-yellow-900/60 text-yellow-300`:e<500?`bg-orange-900/60 text-orange-300`:`bg-red-900/60 text-red-300`}var w=({logs:e,height:t})=>{let n=(0,c.useRef)(null),[r,i]=(0,c.useState)(null);return(0,c.useEffect)(()=>{n.current?.scrollIntoView({behavior:`smooth`})},[e]),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`${t} overflow-x-auto overflow-y-auto pb-4`,children:[e.length===0?(0,l.jsx)(`p`,{className:`px-4 text-[12px] text-neutral-600`,children:`No output yet.`}):e.map((e,t)=>(0,l.jsx)(`div`,{className:`flex items-center gap-1.5 px-3 py-0.5 text-[11px] ${t%2==0?`bg-neutral-900`:`bg-neutral-800/40`}`,children:e.kind===`info`?(0,l.jsx)(`span`,{className:`text-neutral-500`,children:e.message}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`span`,{className:`w-12 shrink-0 rounded text-center font-mono font-semibold ${S(e.method)}`,children:e.method}),(0,l.jsx)(`span`,{className:`w-8 shrink-0 rounded text-center font-mono font-semibold ${C(e.status)}`,children:e.status===0?`ERR`:e.status}),(0,l.jsx)(`span`,{className:`w-14 shrink-0 rounded text-center font-mono font-semibold ${e.fromCache?`bg-violet-900/60 text-violet-300`:`bg-neutral-800 text-neutral-400`}`,children:e.fromCache?`cache`:`network`}),(0,l.jsx)(`span`,{className:`min-w-0 truncate cursor-default font-mono text-neutral-400`,onMouseEnter:t=>{let n=t.currentTarget.getBoundingClientRect();i({text:e.url,x:n.left,y:n.top})},onMouseLeave:()=>{i(null)},children:e.url})]})},t)),(0,l.jsx)(`div`,{ref:n})]}),r&&(0,l.jsx)(`div`,{className:`pointer-events-none fixed z-50 max-w-xs break-all rounded bg-neutral-700 px-2 py-1 text-[11px] text-neutral-100 shadow-lg`,style:{left:r.x,top:r.y,transform:`translateY(calc(-100% - 4px))`},children:r.text})]})},T=({onClose:e,buildLogs:t,proxyLogs:n,consoleLogs:u,onClearConsole:d,credentials:f,onCredentialsChange:p,width:v=416,onWidthChange:y})=>{let[S,C]=(0,c.useState)(()=>{let e=localStorage.getItem(`devtools-creds-open`);return e===null?!(f.apiKey&&f.userId&&f.businessId):e!==`false`}),[T,E]=(0,c.useState)([]),[D,O]=(0,c.useState)(void 0),k=(0,c.useCallback)(async()=>{try{let e=await fetch(`/api/credential-profiles`);if(!e.ok)return;let t=await e.json();E(t.profiles),O(t.active)}catch{}},[]);(0,c.useEffect)(()=>{k()},[k]);let A=(0,c.useCallback)(async e=>{let t=e===``?void 0:e;try{await fetch(`/api/credentials/switch`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({profile:t})}),await fetch(`/api/proxy-cache/clear`),O(t)}catch{}},[]),[j,M]=(0,c.useState)(()=>localStorage.getItem(`devtools-routes-open`)!==`false`),[N,P]=(0,c.useState)(()=>localStorage.getItem(`devtools-console-open`)!==`false`),[F,I]=(0,c.useState)(()=>localStorage.getItem(`devtools-proxy-open`)!==`false`),[L,R]=(0,c.useState)(()=>localStorage.getItem(`devtools-build-open`)!==`false`),z=(e,t)=>{t(t=>{let n=!t;return localStorage.setItem(e,String(n)),n})},B=(0,c.useRef)(!1),V=(0,c.useCallback)(e=>{e.preventDefault(),B.current=!0;let t=e=>{if(!B.current)return;let t=Math.min(800,Math.max(280,window.innerWidth-e.clientX));y?.(t)},n=()=>{B.current=!1,document.removeEventListener(`mousemove`,t),document.removeEventListener(`mouseup`,n)};document.addEventListener(`mousemove`,t),document.addEventListener(`mouseup`,n)},[y]);return(0,l.jsxs)(`aside`,{className:`relative flex shrink-0 flex-col border-l border-neutral-800 bg-neutral-900 text-neutral-100`,style:{width:v},children:[(0,l.jsx)(`div`,{onMouseDown:V,className:`absolute left-0 top-0 z-10 h-full w-1 cursor-col-resize transition-colors hover:bg-neutral-600`}),(0,l.jsxs)(`div`,{className:`flex items-center justify-between border-b border-neutral-800 px-4 py-3`,children:[(0,l.jsx)(`span`,{className:`text-[12px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Dev Tools`}),(0,l.jsx)(`button`,{onClick:e,className:`text-neutral-500 hover:text-neutral-200`,"aria-label":`Close dev tools`,children:(0,l.jsx)(o,{icon:i,size:`sm`})})]}),(0,l.jsxs)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:[(0,l.jsxs)(`div`,{className:`flex flex-1 flex-col min-h-0`,children:[(0,l.jsxs)(`div`,{className:`flex shrink-0 flex-col border-b border-neutral-800`,children:[(0,l.jsxs)(`button`,{className:`flex items-center justify-between px-4 py-2 hover:bg-neutral-800/50`,onClick:()=>{z(`devtools-creds-open`,C),k()},children:[(0,l.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:_,children:`Credentials`}),!S&&(0,l.jsx)(`span`,{className:`text-[11px] font-mono text-neutral-400`,children:f.environment})]}),(0,l.jsx)(o,{icon:S?a:r,className:`text-neutral-600`,size:`xs`})]}),S&&(0,l.jsxs)(`div`,{className:`flex flex-col gap-2 px-4 pb-3`,children:[T.length>1&&(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:g,children:`Profile`}),(0,l.jsx)(`select`,{className:h,value:D??``,onChange:e=>{A(e.target.value)},children:T.map(e=>(0,l.jsx)(`option`,{value:e.isDefault?``:e.name,children:e.isDefault?`Default`:e.name},e.name))})]}),(0,l.jsxs)(`div`,{className:`flex gap-2`,children:[(0,l.jsxs)(`div`,{className:`flex-1`,children:[(0,l.jsx)(`label`,{className:g,children:`Environment`}),(0,l.jsx)(`select`,{className:h,value:f.environment,onChange:e=>{p({...f,environment:e.target.value})},children:s.map(e=>(0,l.jsx)(`option`,{value:e,children:e},e))})]}),(0,l.jsxs)(`div`,{className:`flex-1`,children:[(0,l.jsx)(`label`,{className:g,children:`Business ID`}),(0,l.jsx)(`input`,{type:`text`,className:h,value:f.businessId,onChange:e=>{p({...f,businessId:e.target.value})},placeholder:`x-business-id`,autoComplete:`off`})]})]}),(0,l.jsxs)(`div`,{className:`flex gap-2`,children:[(0,l.jsxs)(`div`,{className:`flex-1`,children:[(0,l.jsx)(`label`,{className:g,children:`User ID`}),(0,l.jsx)(`input`,{type:`text`,className:h,value:f.userId,onChange:e=>{p({...f,userId:e.target.value})},placeholder:`x-user-id`,autoComplete:`off`})]}),(0,l.jsxs)(`div`,{className:`flex-1`,children:[(0,l.jsx)(`label`,{className:g,children:`API Key`}),(0,l.jsx)(`input`,{type:`password`,className:h,value:f.apiKey,onChange:e=>{p({...f,apiKey:e.target.value})},placeholder:`x-api-key`,autoComplete:`off`})]})]})]})]}),(0,l.jsxs)(`div`,{className:`flex shrink-0 flex-col border-t border-neutral-800 overflow-hidden`,children:[(0,l.jsxs)(`button`,{className:`flex items-center justify-between px-4 py-2 hover:bg-neutral-800/50`,onClick:()=>{z(`devtools-routes-open`,M)},children:[(0,l.jsx)(`span`,{className:_,children:`Routes`}),(0,l.jsx)(o,{icon:j?a:r,className:`text-neutral-600`,size:`xs`})]}),j&&(0,l.jsx)(m,{})]}),(0,l.jsxs)(`div`,{className:`flex shrink-0 flex-col border-t border-neutral-800`,children:[(0,l.jsxs)(`div`,{className:`flex items-center px-4 py-2`,children:[(0,l.jsxs)(`button`,{className:`flex flex-1 items-center gap-2 hover:opacity-70`,onClick:()=>{z(`devtools-console-open`,P)},children:[(0,l.jsx)(`span`,{className:_,children:`Browser Console`}),(0,l.jsx)(o,{icon:N?a:r,className:`text-neutral-600`,size:`xs`})]}),N&&u.length>0&&(0,l.jsx)(`button`,{onClick:d,className:`text-[11px] text-neutral-600 hover:text-neutral-300`,children:`clear`})]}),N&&(0,l.jsx)(b,{logs:u,height:`min-h-32 max-h-64`})]}),(0,l.jsxs)(`div`,{className:`flex flex-1 flex-col min-h-0 border-t border-neutral-800`,children:[(0,l.jsxs)(`div`,{className:`flex items-center px-4 py-2`,children:[(0,l.jsxs)(`button`,{className:`flex flex-1 items-center gap-2 hover:opacity-70`,onClick:()=>{z(`devtools-proxy-open`,I)},children:[(0,l.jsx)(`span`,{className:_,children:`Network Requests`}),(0,l.jsx)(o,{icon:F?a:r,className:`text-neutral-600`,size:`xs`})]}),F&&(0,l.jsx)(`button`,{onClick:()=>{fetch(`/api/proxy-cache/clear`)},className:`text-[11px] text-neutral-600 hover:text-neutral-300`,children:`clear cache`})]}),F&&(0,l.jsx)(w,{logs:n,height:`flex-1 min-h-0`})]})]}),(0,l.jsxs)(`div`,{className:`flex flex-col border-t border-neutral-800`,children:[(0,l.jsxs)(`button`,{className:`flex items-center justify-between px-4 py-2 hover:bg-neutral-800/50`,onClick:()=>{z(`devtools-build-open`,R)},children:[(0,l.jsx)(`span`,{className:_,children:`Build Log`}),(0,l.jsx)(o,{icon:L?a:r,className:`text-neutral-600`,size:`xs`})]}),L&&(0,l.jsx)(x,{logs:t,height:`max-h-[60px]`})]})]})]})};export{T as DevSidebar};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{b as t,i as n,n as r,v as i,x as a,y as o}from"./fa-core-wsCxaNB7.js";import{n as s}from"./CredentialsContext-zl2e9kpM.js";var c=e(a(),1),l=t(),u=`integration:route-change`,d=`w-full rounded bg-neutral-800 border border-neutral-700 px-2 py-1 text-[12px] font-mono text-neutral-200 focus:outline-none focus:border-neutral-500`,f=`block text-[11px] font-semibold uppercase tracking-widest text-neutral-600 mb-1`;function p(e){return e.toTimeString().slice(0,8)}var m=()=>{let[e,t]=(0,c.useState)(`/`),[n,r]=(0,c.useState)(``),[i,a]=(0,c.useState)(``),[o,s]=(0,c.useState)([]),m=(0,c.useRef)(null);(0,c.useEffect)(()=>{m.current?.scrollIntoView({behavior:`smooth`})},[o]),(0,c.useEffect)(()=>{let e=e=>{let t=e;s(e=>[...e,{time:new Date,location:t.detail.location}].slice(-50))};return window.addEventListener(u,e),()=>{window.removeEventListener(u,e)}},[]);let h=()=>{let t=n&&!n.startsWith(`?`)?`?${n}`:n,r=i&&!i.startsWith(`#`)?`#${i}`:i,a={host:window.location.host,origin:window.location.origin,port:window.location.port,protocol:window.location.protocol,pathname:e,search:t,hash:r,href:`${window.location.origin}${e}${t}${r}`};window.dispatchEvent(new CustomEvent(u,{detail:{location:a}}))},g=e=>{e.key===`Enter`&&h()};return(0,l.jsxs)(`div`,{className:`flex flex-col gap-3 px-4 pb-3`,children:[(0,l.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,l.jsxs)(`div`,{className:`flex gap-2`,children:[(0,l.jsxs)(`div`,{className:`flex-1`,children:[(0,l.jsx)(`label`,{className:f,children:`Search`}),(0,l.jsx)(`input`,{type:`text`,className:d,value:n,onChange:e=>{r(e.target.value)},onKeyDown:g,placeholder:`?tab=notes`,spellCheck:!1})]}),(0,l.jsxs)(`div`,{className:`flex-1`,children:[(0,l.jsx)(`label`,{className:f,children:`Hash`}),(0,l.jsx)(`input`,{type:`text`,className:d,value:i,onChange:e=>{a(e.target.value)},onKeyDown:g,placeholder:`#section`,spellCheck:!1})]})]}),(0,l.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,l.jsxs)(`div`,{className:`flex-1`,children:[(0,l.jsx)(`label`,{className:f,children:`Pathname`}),(0,l.jsx)(`input`,{type:`text`,className:d,value:e,onChange:e=>{t(e.target.value)},onKeyDown:g,placeholder:`/client/abc-123/overview`,spellCheck:!1})]}),(0,l.jsx)(`button`,{onClick:h,className:`rounded bg-neutral-700 px-3 py-1.5 text-[12px] font-semibold text-neutral-200 hover:bg-neutral-600 active:bg-neutral-500`,children:`Dispatch`})]})]}),(0,l.jsxs)(`div`,{className:`flex flex-col border-t border-neutral-800 pt-2`,children:[(0,l.jsxs)(`div`,{className:`mb-1 flex items-center justify-between`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-500`,children:`Navigation Event Stream`}),o.length>0&&(0,l.jsx)(`button`,{onClick:()=>{s([])},className:`text-[11px] text-neutral-600 hover:text-neutral-300`,children:`clear`})]}),(0,l.jsxs)(`div`,{className:`max-h-40 overflow-y-auto`,children:[o.length===0?(0,l.jsx)(`p`,{className:`text-[12px] text-neutral-600`,children:`No events yet.`}):o.map((e,t)=>(0,l.jsxs)(`div`,{className:`px-2 py-0.5 font-mono text-[11px] leading-5 ${t%2==0?`bg-neutral-900`:`bg-neutral-800/40`}`,children:[(0,l.jsx)(`span`,{className:`text-neutral-600`,children:p(e.time)}),(0,l.jsx)(`span`,{className:`ml-2 text-neutral-300`,children:e.location.pathname}),e.location.search&&(0,l.jsx)(`span`,{className:`text-neutral-500`,children:e.location.search}),e.location.hash&&(0,l.jsx)(`span`,{className:`text-neutral-500`,children:e.location.hash})]},t)),(0,l.jsx)(`div`,{ref:m})]})]})]})},h=`w-full rounded bg-neutral-800 border border-neutral-700 px-2 py-1 text-[12px] font-mono text-neutral-200 focus:outline-none focus:border-neutral-500`,g=`block text-[11px] font-semibold uppercase tracking-widest text-neutral-600 mb-1`,_=`text-[11px] font-semibold uppercase tracking-widest text-neutral-500`,v={log:`text-neutral-400`,info:`text-blue-400`,warn:`text-yellow-400`,error:`text-red-400`};function y(e){if(typeof e==`string`)return e;if(e===null)return`null`;if(e===void 0)return`undefined`;try{return JSON.stringify(e)}catch{return`[unserializable]`}}var b=({logs:e,height:t})=>{let n=(0,c.useRef)(null);return(0,c.useEffect)(()=>{n.current?.scrollIntoView({behavior:`smooth`})},[e]),(0,l.jsxs)(`div`,{className:`${t} overflow-x-auto overflow-y-auto pb-4`,children:[e.length===0?(0,l.jsx)(`p`,{className:`px-4 text-[12px] text-neutral-600`,children:`No output yet.`}):e.map((e,t)=>(0,l.jsx)(`div`,{className:`whitespace-pre px-4 text-[12px] leading-5 ${v[e.level]} ${t%2==0?`bg-neutral-900`:`bg-neutral-800/40`}`,children:e.args.map(y).join(` `)},t)),(0,l.jsx)(`div`,{ref:n})]})},x=({logs:e,height:t})=>{let n=(0,c.useRef)(null);return(0,c.useEffect)(()=>{n.current?.scrollIntoView({behavior:`smooth`})},[e]),(0,l.jsxs)(`div`,{className:`${t} overflow-x-auto overflow-y-auto pb-4`,children:[e.length===0?(0,l.jsx)(`p`,{className:`px-4 text-[12px] text-neutral-600`,children:`No output yet.`}):e.map((e,t)=>(0,l.jsx)(`div`,{className:`whitespace-pre px-4 text-[12px] leading-5 text-neutral-500`,children:e},t)),(0,l.jsx)(`div`,{ref:n})]})};function S(e){switch(e.toUpperCase()){case`GET`:return`bg-blue-900/60 text-blue-300`;case`POST`:return`bg-green-900/60 text-green-300`;case`PUT`:return`bg-amber-900/60 text-amber-300`;case`PATCH`:return`bg-orange-900/60 text-orange-300`;case`DELETE`:return`bg-red-900/60 text-red-300`;default:return`bg-neutral-800 text-neutral-400`}}function C(e){return e===0?`bg-neutral-800 text-neutral-400`:e<300?`bg-green-900/60 text-green-300`:e<400?`bg-yellow-900/60 text-yellow-300`:e<500?`bg-orange-900/60 text-orange-300`:`bg-red-900/60 text-red-300`}var w=({logs:e,height:t})=>{let n=(0,c.useRef)(null),[r,i]=(0,c.useState)(null);return(0,c.useEffect)(()=>{n.current?.scrollIntoView({behavior:`smooth`})},[e]),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`${t} overflow-x-auto overflow-y-auto pb-4`,children:[e.length===0?(0,l.jsx)(`p`,{className:`px-4 text-[12px] text-neutral-600`,children:`No output yet.`}):e.map((e,t)=>(0,l.jsx)(`div`,{className:`flex items-center gap-1.5 px-3 py-0.5 text-[11px] ${t%2==0?`bg-neutral-900`:`bg-neutral-800/40`}`,children:e.kind===`info`?(0,l.jsx)(`span`,{className:`text-neutral-500`,children:e.message}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`span`,{className:`w-12 shrink-0 rounded text-center font-mono font-semibold ${S(e.method)}`,children:e.method}),(0,l.jsx)(`span`,{className:`w-8 shrink-0 rounded text-center font-mono font-semibold ${C(e.status)}`,children:e.status===0?`ERR`:e.status}),(0,l.jsx)(`span`,{className:`w-14 shrink-0 rounded text-center font-mono font-semibold ${e.fromCache?`bg-violet-900/60 text-violet-300`:`bg-neutral-800 text-neutral-400`}`,children:e.fromCache?`cache`:`network`}),(0,l.jsx)(`span`,{className:`min-w-0 truncate cursor-default font-mono text-neutral-400`,onMouseEnter:t=>{let n=t.currentTarget.getBoundingClientRect();i({text:e.url,x:n.left,y:n.top})},onMouseLeave:()=>{i(null)},children:e.url})]})},t)),(0,l.jsx)(`div`,{ref:n})]}),r&&(0,l.jsx)(`div`,{className:`pointer-events-none fixed z-50 max-w-xs break-all rounded bg-neutral-700 px-2 py-1 text-[11px] text-neutral-100 shadow-lg`,style:{left:r.x,top:r.y,transform:`translateY(calc(-100% - 4px))`},children:r.text})]})},T=({onClose:e,buildLogs:t,proxyLogs:a,consoleLogs:u,onClearConsole:d,credentials:f,onCredentialsChange:p,width:v=416,onWidthChange:y})=>{let[S,C]=(0,c.useState)(()=>{let e=localStorage.getItem(`devtools-creds-open`);return e===null?!(f.apiKey&&f.userId&&f.businessId):e!==`false`}),[T,E]=(0,c.useState)([]),[D,O]=(0,c.useState)(void 0),k=(0,c.useCallback)(async()=>{try{let e=await fetch(`/api/credential-profiles`);if(!e.ok)return;let t=await e.json();E(t.profiles),O(t.active)}catch{}},[]);(0,c.useEffect)(()=>{k()},[k]);let A=(0,c.useCallback)(async e=>{let t=e===``?void 0:e;try{await fetch(`/api/credentials/switch`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({profile:t})}),await fetch(`/api/proxy-cache/clear`),O(t)}catch{}},[]),[j,M]=(0,c.useState)(()=>localStorage.getItem(`devtools-routes-open`)!==`false`),[N,P]=(0,c.useState)(()=>localStorage.getItem(`devtools-console-open`)!==`false`),[F,I]=(0,c.useState)(()=>localStorage.getItem(`devtools-proxy-open`)!==`false`),[L,R]=(0,c.useState)(()=>localStorage.getItem(`devtools-build-open`)!==`false`),z=(e,t)=>{t(t=>{let n=!t;return localStorage.setItem(e,String(n)),n})},B=(0,c.useRef)(!1),V=(0,c.useCallback)(e=>{e.preventDefault(),B.current=!0;let t=e=>{if(!B.current)return;let t=Math.min(800,Math.max(280,window.innerWidth-e.clientX));y?.(t)},n=()=>{B.current=!1,document.removeEventListener(`mousemove`,t),document.removeEventListener(`mouseup`,n)};document.addEventListener(`mousemove`,t),document.addEventListener(`mouseup`,n)},[y]);return(0,l.jsxs)(`aside`,{className:`relative flex shrink-0 flex-col border-l border-neutral-800 bg-neutral-900 text-neutral-100`,style:{width:v},children:[(0,l.jsx)(`div`,{onMouseDown:V,className:`absolute left-0 top-0 z-10 h-full w-1 cursor-col-resize transition-colors hover:bg-neutral-600`}),(0,l.jsxs)(`div`,{className:`flex items-center justify-between border-b border-neutral-800 px-4 py-3`,children:[(0,l.jsx)(`span`,{className:`text-[12px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Dev Tools`}),(0,l.jsx)(`button`,{onClick:e,className:`text-neutral-500 hover:text-neutral-200`,"aria-label":`Close dev tools`,children:(0,l.jsx)(o,{icon:i,size:`sm`})})]}),(0,l.jsxs)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:[(0,l.jsxs)(`div`,{className:`flex flex-1 flex-col min-h-0`,children:[(0,l.jsxs)(`div`,{className:`flex shrink-0 flex-col border-b border-neutral-800`,children:[(0,l.jsxs)(`button`,{className:`flex items-center justify-between px-4 py-2 hover:bg-neutral-800/50`,onClick:()=>{z(`devtools-creds-open`,C),k()},children:[(0,l.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:_,children:`Credentials`}),!S&&(0,l.jsx)(`span`,{className:`text-[11px] font-mono text-neutral-400`,children:f.environment})]}),(0,l.jsx)(o,{icon:S?r:n,className:`text-neutral-600`,size:`xs`})]}),S&&(0,l.jsxs)(`div`,{className:`flex flex-col gap-2 px-4 pb-3`,children:[T.length>1&&(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:g,children:`Profile`}),(0,l.jsx)(`select`,{className:h,value:D??``,onChange:e=>{A(e.target.value)},children:T.map(e=>(0,l.jsx)(`option`,{value:e.isDefault?``:e.name,children:e.isDefault?`Default`:e.name},e.name))})]}),(0,l.jsxs)(`div`,{className:`flex gap-2`,children:[(0,l.jsxs)(`div`,{className:`flex-1`,children:[(0,l.jsx)(`label`,{className:g,children:`Environment`}),(0,l.jsx)(`select`,{className:h,value:f.environment,onChange:e=>{p({...f,environment:e.target.value})},children:s.map(e=>(0,l.jsx)(`option`,{value:e,children:e},e))})]}),(0,l.jsxs)(`div`,{className:`flex-1`,children:[(0,l.jsx)(`label`,{className:g,children:`Business ID`}),(0,l.jsx)(`input`,{type:`text`,className:h,value:f.businessId,onChange:e=>{p({...f,businessId:e.target.value})},placeholder:`x-business-id`,autoComplete:`off`})]})]}),(0,l.jsxs)(`div`,{className:`flex gap-2`,children:[(0,l.jsxs)(`div`,{className:`flex-1`,children:[(0,l.jsx)(`label`,{className:g,children:`User ID`}),(0,l.jsx)(`input`,{type:`text`,className:h,value:f.userId,onChange:e=>{p({...f,userId:e.target.value})},placeholder:`x-user-id`,autoComplete:`off`})]}),(0,l.jsxs)(`div`,{className:`flex-1`,children:[(0,l.jsx)(`label`,{className:g,children:`API Key`}),(0,l.jsx)(`input`,{type:`password`,className:h,value:f.apiKey,onChange:e=>{p({...f,apiKey:e.target.value})},placeholder:`x-api-key`,autoComplete:`off`})]})]})]})]}),(0,l.jsxs)(`div`,{className:`flex shrink-0 flex-col border-t border-neutral-800 overflow-hidden`,children:[(0,l.jsxs)(`button`,{className:`flex items-center justify-between px-4 py-2 hover:bg-neutral-800/50`,onClick:()=>{z(`devtools-routes-open`,M)},children:[(0,l.jsx)(`span`,{className:_,children:`Routes`}),(0,l.jsx)(o,{icon:j?r:n,className:`text-neutral-600`,size:`xs`})]}),j&&(0,l.jsx)(m,{})]}),(0,l.jsxs)(`div`,{className:`flex shrink-0 flex-col border-t border-neutral-800`,children:[(0,l.jsxs)(`div`,{className:`flex items-center px-4 py-2`,children:[(0,l.jsxs)(`button`,{className:`flex flex-1 items-center gap-2 hover:opacity-70`,onClick:()=>{z(`devtools-console-open`,P)},children:[(0,l.jsx)(`span`,{className:_,children:`Browser Console`}),(0,l.jsx)(o,{icon:N?r:n,className:`text-neutral-600`,size:`xs`})]}),N&&u.length>0&&(0,l.jsx)(`button`,{onClick:d,className:`text-[11px] text-neutral-600 hover:text-neutral-300`,children:`clear`})]}),N&&(0,l.jsx)(b,{logs:u,height:`min-h-32 max-h-64`})]}),(0,l.jsxs)(`div`,{className:`flex flex-1 flex-col min-h-0 border-t border-neutral-800`,children:[(0,l.jsxs)(`div`,{className:`flex items-center px-4 py-2`,children:[(0,l.jsxs)(`button`,{className:`flex flex-1 items-center gap-2 hover:opacity-70`,onClick:()=>{z(`devtools-proxy-open`,I)},children:[(0,l.jsx)(`span`,{className:_,children:`Network Requests`}),(0,l.jsx)(o,{icon:F?r:n,className:`text-neutral-600`,size:`xs`})]}),F&&(0,l.jsx)(`button`,{onClick:()=>{fetch(`/api/proxy-cache/clear`)},className:`text-[11px] text-neutral-600 hover:text-neutral-300`,children:`clear cache`})]}),F&&(0,l.jsx)(w,{logs:a,height:`flex-1 min-h-0`})]})]}),(0,l.jsxs)(`div`,{className:`flex flex-col border-t border-neutral-800`,children:[(0,l.jsxs)(`button`,{className:`flex items-center justify-between px-4 py-2 hover:bg-neutral-800/50`,onClick:()=>{z(`devtools-build-open`,R)},children:[(0,l.jsx)(`span`,{className:_,children:`Build Log`}),(0,l.jsx)(o,{icon:L?r:n,className:`text-neutral-600`,size:`xs`})]}),L&&(0,l.jsx)(x,{logs:t,height:`max-h-[60px]`})]})]})]})};export{T as DevSidebar};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{b as t,i as n,n as r,v as i,x as a,y as o}from"./fa-core-wsCxaNB7.js";import{n as s}from"./CredentialsContext-zl2e9kpM.js";var c=e(a(),1),l=t(),u=`integration:route-change`,d=`w-full rounded bg-neutral-800 border border-neutral-700 px-2 py-1 text-[12px] font-mono text-neutral-200 focus:outline-none focus:border-neutral-500`,f=`block text-[11px] font-semibold uppercase tracking-widest text-neutral-600 mb-1`;function p(e){return e.toTimeString().slice(0,8)}var m=()=>{let[e,t]=(0,c.useState)(`/`),[n,r]=(0,c.useState)(``),[i,a]=(0,c.useState)(``),[o,s]=(0,c.useState)([]),m=(0,c.useRef)(null);(0,c.useEffect)(()=>{m.current?.scrollIntoView({behavior:`smooth`})},[o]),(0,c.useEffect)(()=>{let e=e=>{let t=e;s(e=>[...e,{time:new Date,location:t.detail.location}].slice(-50))};return window.addEventListener(u,e),()=>{window.removeEventListener(u,e)}},[]);let h=()=>{let t=n&&!n.startsWith(`?`)?`?${n}`:n,r=i&&!i.startsWith(`#`)?`#${i}`:i,a={host:window.location.host,origin:window.location.origin,port:window.location.port,protocol:window.location.protocol,pathname:e,search:t,hash:r,href:`${window.location.origin}${e}${t}${r}`};window.dispatchEvent(new CustomEvent(u,{detail:{location:a}}))},g=e=>{e.key===`Enter`&&h()};return(0,l.jsxs)(`div`,{className:`flex flex-col gap-3 px-4 pb-3`,children:[(0,l.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,l.jsxs)(`div`,{className:`flex gap-2`,children:[(0,l.jsxs)(`div`,{className:`flex-1`,children:[(0,l.jsx)(`label`,{className:f,children:`Search`}),(0,l.jsx)(`input`,{type:`text`,className:d,value:n,onChange:e=>{r(e.target.value)},onKeyDown:g,placeholder:`?tab=notes`,spellCheck:!1})]}),(0,l.jsxs)(`div`,{className:`flex-1`,children:[(0,l.jsx)(`label`,{className:f,children:`Hash`}),(0,l.jsx)(`input`,{type:`text`,className:d,value:i,onChange:e=>{a(e.target.value)},onKeyDown:g,placeholder:`#section`,spellCheck:!1})]})]}),(0,l.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,l.jsxs)(`div`,{className:`flex-1`,children:[(0,l.jsx)(`label`,{className:f,children:`Pathname`}),(0,l.jsx)(`input`,{type:`text`,className:d,value:e,onChange:e=>{t(e.target.value)},onKeyDown:g,placeholder:`/client/abc-123/overview`,spellCheck:!1})]}),(0,l.jsx)(`button`,{onClick:h,className:`rounded bg-neutral-700 px-3 py-1.5 text-[12px] font-semibold text-neutral-200 hover:bg-neutral-600 active:bg-neutral-500`,children:`Dispatch`})]})]}),(0,l.jsxs)(`div`,{className:`flex flex-col border-t border-neutral-800 pt-2`,children:[(0,l.jsxs)(`div`,{className:`mb-1 flex items-center justify-between`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-500`,children:`Navigation Event Stream`}),o.length>0&&(0,l.jsx)(`button`,{onClick:()=>{s([])},className:`text-[11px] text-neutral-600 hover:text-neutral-300`,children:`clear`})]}),(0,l.jsxs)(`div`,{className:`max-h-40 overflow-y-auto`,children:[o.length===0?(0,l.jsx)(`p`,{className:`text-[12px] text-neutral-600`,children:`No events yet.`}):o.map((e,t)=>(0,l.jsxs)(`div`,{className:`px-2 py-0.5 font-mono text-[11px] leading-5 ${t%2==0?`bg-neutral-900`:`bg-neutral-800/40`}`,children:[(0,l.jsx)(`span`,{className:`text-neutral-600`,children:p(e.time)}),(0,l.jsx)(`span`,{className:`ml-2 text-neutral-300`,children:e.location.pathname}),e.location.search&&(0,l.jsx)(`span`,{className:`text-neutral-500`,children:e.location.search}),e.location.hash&&(0,l.jsx)(`span`,{className:`text-neutral-500`,children:e.location.hash})]},t)),(0,l.jsx)(`div`,{ref:m})]})]})]})},h=`w-full rounded bg-neutral-800 border border-neutral-700 px-2 py-1 text-[12px] font-mono text-neutral-200 focus:outline-none focus:border-neutral-500`,g=`block text-[11px] font-semibold uppercase tracking-widest text-neutral-600 mb-1`,_=`text-[11px] font-semibold uppercase tracking-widest text-neutral-500`,v={log:`text-neutral-400`,info:`text-blue-400`,warn:`text-yellow-400`,error:`text-red-400`};function y(e){if(typeof e==`string`)return e;if(e===null)return`null`;if(e===void 0)return`undefined`;try{return JSON.stringify(e)}catch{return`[unserializable]`}}var b=({logs:e,height:t})=>{let n=(0,c.useRef)(null);return(0,c.useEffect)(()=>{n.current?.scrollIntoView({behavior:`smooth`})},[e]),(0,l.jsxs)(`div`,{className:`${t} overflow-x-auto overflow-y-auto pb-4`,children:[e.length===0?(0,l.jsx)(`p`,{className:`px-4 text-[12px] text-neutral-600`,children:`No output yet.`}):e.map((e,t)=>(0,l.jsx)(`div`,{className:`whitespace-pre px-4 text-[12px] leading-5 ${v[e.level]} ${t%2==0?`bg-neutral-900`:`bg-neutral-800/40`}`,children:e.args.map(y).join(` `)},t)),(0,l.jsx)(`div`,{ref:n})]})},x=({logs:e,height:t})=>{let n=(0,c.useRef)(null);return(0,c.useEffect)(()=>{n.current?.scrollIntoView({behavior:`smooth`})},[e]),(0,l.jsxs)(`div`,{className:`${t} overflow-x-auto overflow-y-auto pb-4`,children:[e.length===0?(0,l.jsx)(`p`,{className:`px-4 text-[12px] text-neutral-600`,children:`No output yet.`}):e.map((e,t)=>(0,l.jsx)(`div`,{className:`whitespace-pre px-4 text-[12px] leading-5 text-neutral-500`,children:e},t)),(0,l.jsx)(`div`,{ref:n})]})};function S(e){switch(e.toUpperCase()){case`GET`:return`bg-blue-900/60 text-blue-300`;case`POST`:return`bg-green-900/60 text-green-300`;case`PUT`:return`bg-amber-900/60 text-amber-300`;case`PATCH`:return`bg-orange-900/60 text-orange-300`;case`DELETE`:return`bg-red-900/60 text-red-300`;default:return`bg-neutral-800 text-neutral-400`}}function C(e){return e===0?`bg-neutral-800 text-neutral-400`:e<300?`bg-green-900/60 text-green-300`:e<400?`bg-yellow-900/60 text-yellow-300`:e<500?`bg-orange-900/60 text-orange-300`:`bg-red-900/60 text-red-300`}var w=({logs:e,height:t})=>{let n=(0,c.useRef)(null),[r,i]=(0,c.useState)(null);return(0,c.useEffect)(()=>{n.current?.scrollIntoView({behavior:`smooth`})},[e]),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`div`,{className:`${t} overflow-x-auto overflow-y-auto pb-4`,children:[e.length===0?(0,l.jsx)(`p`,{className:`px-4 text-[12px] text-neutral-600`,children:`No output yet.`}):e.map((e,t)=>(0,l.jsx)(`div`,{className:`flex items-center gap-1.5 px-3 py-0.5 text-[11px] ${t%2==0?`bg-neutral-900`:`bg-neutral-800/40`}`,children:e.kind===`info`?(0,l.jsx)(`span`,{className:`text-neutral-500`,children:e.message}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`span`,{className:`w-12 shrink-0 rounded text-center font-mono font-semibold ${S(e.method)}`,children:e.method}),(0,l.jsx)(`span`,{className:`w-8 shrink-0 rounded text-center font-mono font-semibold ${C(e.status)}`,children:e.status===0?`ERR`:e.status}),(0,l.jsx)(`span`,{className:`w-14 shrink-0 rounded text-center font-mono font-semibold ${e.fromCache?`bg-violet-900/60 text-violet-300`:`bg-neutral-800 text-neutral-400`}`,children:e.fromCache?`cache`:`network`}),(0,l.jsx)(`span`,{className:`min-w-0 truncate cursor-default font-mono text-neutral-400`,onMouseEnter:t=>{let n=t.currentTarget.getBoundingClientRect();i({text:e.url,x:n.left,y:n.top})},onMouseLeave:()=>{i(null)},children:e.url})]})},t)),(0,l.jsx)(`div`,{ref:n})]}),r&&(0,l.jsx)(`div`,{className:`pointer-events-none fixed z-50 max-w-xs break-all rounded bg-neutral-700 px-2 py-1 text-[11px] text-neutral-100 shadow-lg`,style:{left:r.x,top:r.y,transform:`translateY(calc(-100% - 4px))`},children:r.text})]})},T=({onClose:e,buildLogs:t,proxyLogs:a,consoleLogs:u,onClearConsole:d,credentials:f,onCredentialsChange:p,width:v=416,onWidthChange:y})=>{let[S,C]=(0,c.useState)(()=>{let e=localStorage.getItem(`devtools-creds-open`);return e===null?!(f.apiKey&&f.userId&&f.businessId):e!==`false`}),[T,E]=(0,c.useState)([]),[D,O]=(0,c.useState)(void 0),k=(0,c.useCallback)(async()=>{try{let e=await fetch(`/api/credential-profiles`);if(!e.ok)return;let t=await e.json();E(t.profiles),O(t.active)}catch{}},[]);(0,c.useEffect)(()=>{k()},[k]);let A=(0,c.useCallback)(async e=>{let t=e===``?void 0:e;try{await fetch(`/api/credentials/switch`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({profile:t})}),await fetch(`/api/proxy-cache/clear`),O(t)}catch{}},[]),[j,M]=(0,c.useState)(()=>localStorage.getItem(`devtools-routes-open`)!==`false`),[N,P]=(0,c.useState)(()=>localStorage.getItem(`devtools-console-open`)!==`false`),[F,I]=(0,c.useState)(()=>localStorage.getItem(`devtools-proxy-open`)!==`false`),[L,R]=(0,c.useState)(()=>localStorage.getItem(`devtools-build-open`)!==`false`),z=(e,t)=>{t(t=>{let n=!t;return localStorage.setItem(e,String(n)),n})},B=(0,c.useRef)(!1),V=(0,c.useCallback)(e=>{e.preventDefault(),B.current=!0;let t=e=>{if(!B.current)return;let t=Math.min(800,Math.max(280,window.innerWidth-e.clientX));y?.(t)},n=()=>{B.current=!1,document.removeEventListener(`mousemove`,t),document.removeEventListener(`mouseup`,n)};document.addEventListener(`mousemove`,t),document.addEventListener(`mouseup`,n)},[y]);return(0,l.jsxs)(`aside`,{className:`relative flex shrink-0 flex-col border-l border-neutral-800 bg-neutral-900 text-neutral-100`,style:{width:v},children:[(0,l.jsx)(`div`,{onMouseDown:V,className:`absolute left-0 top-0 z-10 h-full w-1 cursor-col-resize transition-colors hover:bg-neutral-600`}),(0,l.jsxs)(`div`,{className:`flex items-center justify-between border-b border-neutral-800 px-4 py-3`,children:[(0,l.jsx)(`span`,{className:`text-[12px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Dev Tools`}),(0,l.jsx)(`button`,{onClick:e,className:`text-neutral-500 hover:text-neutral-200`,"aria-label":`Close dev tools`,children:(0,l.jsx)(o,{icon:i,size:`sm`})})]}),(0,l.jsxs)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:[(0,l.jsxs)(`div`,{className:`flex flex-1 flex-col min-h-0`,children:[(0,l.jsxs)(`div`,{className:`flex shrink-0 flex-col border-b border-neutral-800`,children:[(0,l.jsxs)(`button`,{className:`flex items-center justify-between px-4 py-2 hover:bg-neutral-800/50`,onClick:()=>{z(`devtools-creds-open`,C),k()},children:[(0,l.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:_,children:`Credentials`}),!S&&(0,l.jsx)(`span`,{className:`text-[11px] font-mono text-neutral-400`,children:f.environment})]}),(0,l.jsx)(o,{icon:S?r:n,className:`text-neutral-600`,size:`xs`})]}),S&&(0,l.jsxs)(`div`,{className:`flex flex-col gap-2 px-4 pb-3`,children:[T.length>1&&(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:g,children:`Profile`}),(0,l.jsx)(`select`,{className:h,value:D??``,onChange:e=>{A(e.target.value)},children:T.map(e=>(0,l.jsx)(`option`,{value:e.isDefault?``:e.name,children:e.isDefault?`Default`:e.name},e.name))})]}),(0,l.jsxs)(`div`,{className:`flex gap-2`,children:[(0,l.jsxs)(`div`,{className:`flex-1`,children:[(0,l.jsx)(`label`,{className:g,children:`Environment`}),(0,l.jsx)(`select`,{className:h,value:f.environment,onChange:e=>{p({...f,environment:e.target.value})},children:s.map(e=>(0,l.jsx)(`option`,{value:e,children:e},e))})]}),(0,l.jsxs)(`div`,{className:`flex-1`,children:[(0,l.jsx)(`label`,{className:g,children:`Business ID`}),(0,l.jsx)(`input`,{type:`text`,className:h,value:f.businessId,onChange:e=>{p({...f,businessId:e.target.value})},placeholder:`x-business-id`,autoComplete:`off`})]})]}),(0,l.jsxs)(`div`,{className:`flex gap-2`,children:[(0,l.jsxs)(`div`,{className:`flex-1`,children:[(0,l.jsx)(`label`,{className:g,children:`User ID`}),(0,l.jsx)(`input`,{type:`text`,className:h,value:f.userId,onChange:e=>{p({...f,userId:e.target.value})},placeholder:`x-user-id`,autoComplete:`off`})]}),(0,l.jsxs)(`div`,{className:`flex-1`,children:[(0,l.jsx)(`label`,{className:g,children:`API Key`}),(0,l.jsx)(`input`,{type:`password`,className:h,value:f.apiKey,onChange:e=>{p({...f,apiKey:e.target.value})},placeholder:`x-api-key`,autoComplete:`off`})]})]})]})]}),(0,l.jsxs)(`div`,{className:`flex shrink-0 flex-col border-t border-neutral-800 overflow-hidden`,children:[(0,l.jsxs)(`button`,{className:`flex items-center justify-between px-4 py-2 hover:bg-neutral-800/50`,onClick:()=>{z(`devtools-routes-open`,M)},children:[(0,l.jsx)(`span`,{className:_,children:`Routes`}),(0,l.jsx)(o,{icon:j?r:n,className:`text-neutral-600`,size:`xs`})]}),j&&(0,l.jsx)(m,{})]}),(0,l.jsxs)(`div`,{className:`flex shrink-0 flex-col border-t border-neutral-800`,children:[(0,l.jsxs)(`div`,{className:`flex items-center px-4 py-2`,children:[(0,l.jsxs)(`button`,{className:`flex flex-1 items-center gap-2 hover:opacity-70`,onClick:()=>{z(`devtools-console-open`,P)},children:[(0,l.jsx)(`span`,{className:_,children:`Browser Console`}),(0,l.jsx)(o,{icon:N?r:n,className:`text-neutral-600`,size:`xs`})]}),N&&u.length>0&&(0,l.jsx)(`button`,{onClick:d,className:`text-[11px] text-neutral-600 hover:text-neutral-300`,children:`clear`})]}),N&&(0,l.jsx)(b,{logs:u,height:`min-h-32 max-h-64`})]}),(0,l.jsxs)(`div`,{className:`flex flex-1 flex-col min-h-0 border-t border-neutral-800`,children:[(0,l.jsxs)(`div`,{className:`flex items-center px-4 py-2`,children:[(0,l.jsxs)(`button`,{className:`flex flex-1 items-center gap-2 hover:opacity-70`,onClick:()=>{z(`devtools-proxy-open`,I)},children:[(0,l.jsx)(`span`,{className:_,children:`Network Requests`}),(0,l.jsx)(o,{icon:F?r:n,className:`text-neutral-600`,size:`xs`})]}),F&&(0,l.jsx)(`button`,{onClick:()=>{fetch(`/api/proxy-cache/clear`)},className:`text-[11px] text-neutral-600 hover:text-neutral-300`,children:`clear cache`})]}),F&&(0,l.jsx)(w,{logs:a,height:`flex-1 min-h-0`})]})]}),(0,l.jsxs)(`div`,{className:`flex flex-col border-t border-neutral-800`,children:[(0,l.jsxs)(`button`,{className:`flex items-center justify-between px-4 py-2 hover:bg-neutral-800/50`,onClick:()=>{z(`devtools-build-open`,R)},children:[(0,l.jsx)(`span`,{className:_,children:`Build Log`}),(0,l.jsx)(o,{icon:L?r:n,className:`text-neutral-600`,size:`xs`})]}),L&&(0,l.jsx)(x,{logs:t,height:`max-h-[60px]`})]})]})]})};export{T as DevSidebar};
@@ -1 +0,0 @@
1
- import{b as e,y as t}from"./fa-core-wsCxaNB7.js";import{t as n}from"./Card-DMz6T3VL.js";import{i as r,n as i,r as a}from"./validIcons-UmfwFGTT.js";var o=e(),s=()=>(0,o.jsx)(`div`,{className:`space-y-4 text-[13px]`,children:(0,o.jsxs)(n,{children:[(0,o.jsxs)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:[`Icon Reference (`,i.length,` icons)`]}),(0,o.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:i.map(e=>(0,o.jsxs)(`div`,{className:`flex w-32 items-center gap-1.5 rounded px-1.5 py-1 hover:bg-black/5`,title:e,children:[r[e]?(0,o.jsx)(t,{icon:r[e],className:`w-3.5 shrink-0 text-[13px] text-neutral-500`}):a.has(e)?(0,o.jsx)(`span`,{className:`w-3.5 shrink-0 text-center font-mono text-[9px] text-neutral-400`,children:`K`}):null,(0,o.jsx)(`span`,{className:`truncate font-mono text-[10px] text-neutral-500`,children:e})]},e))})]})});export{s as IconReferencePage};
@@ -1 +0,0 @@
1
- import{b as e,y as t}from"./fa-core-wsCxaNB7.js";import{t as n}from"./Card-Bmn1HMWl.js";import{i as r,n as i,r as a}from"./validIcons-Dqgxgpv-.js";var o=e(),s=()=>(0,o.jsx)(`div`,{className:`space-y-4 text-[13px]`,children:(0,o.jsxs)(n,{children:[(0,o.jsxs)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:[`Icon Reference (`,i.length,` icons)`]}),(0,o.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:i.map(e=>(0,o.jsxs)(`div`,{className:`flex w-32 items-center gap-1.5 rounded px-1.5 py-1 hover:bg-black/5`,title:e,children:[r[e]?(0,o.jsx)(t,{icon:r[e],className:`w-3.5 shrink-0 text-[13px] text-neutral-500`}):a.has(e)?(0,o.jsx)(`span`,{className:`w-3.5 shrink-0 text-center font-mono text-[9px] text-neutral-400`,children:`K`}):null,(0,o.jsx)(`span`,{className:`truncate font-mono text-[10px] text-neutral-500`,children:e})]},e))})]})});export{s as IconReferencePage};
@@ -1 +0,0 @@
1
- import{S as e,x as t}from"./fa-core-DaD7O-yO.js";import{t as n}from"./Card-DsqKctyM.js";import{i as r,n as i,r as a}from"./validIcons-Dqgxgpv-.js";var o=e(),s=()=>(0,o.jsx)(`div`,{className:`space-y-4 text-[13px]`,children:(0,o.jsxs)(n,{children:[(0,o.jsxs)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:[`Icon Reference (`,i.length,` icons)`]}),(0,o.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:i.map(e=>(0,o.jsxs)(`div`,{className:`flex w-32 items-center gap-1.5 rounded px-1.5 py-1 hover:bg-black/5`,title:e,children:[r[e]?(0,o.jsx)(t,{icon:r[e],className:`w-3.5 shrink-0 text-[13px] text-neutral-500`}):a.has(e)?(0,o.jsx)(`span`,{className:`w-3.5 shrink-0 text-center font-mono text-[9px] text-neutral-400`,children:`K`}):null,(0,o.jsx)(`span`,{className:`truncate font-mono text-[10px] text-neutral-500`,children:e})]},e))})]})});export{s as IconReferencePage};