@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.
- package/LICENSE.md +674 -0
- package/README.md +42 -0
- package/dist/index.js +89 -1986
- package/dist/index.js.map +1 -1
- package/dist/viewer/assets/AppDetailPage-D4r3W5v5.js +1 -0
- package/dist/viewer/assets/BootstrapContext-D5ZnMrOp.js +1 -0
- package/dist/viewer/assets/Card-BpDJPrPZ.js +1 -0
- package/dist/viewer/assets/CodeStepsPage-BzaaN9Kb.js +1 -0
- package/dist/viewer/assets/CodeViewer-Ce2qKSWi.js +4 -0
- package/dist/viewer/assets/ConfigurationPage-DyGQQTe-.js +1 -0
- package/dist/viewer/assets/DevSidebar-h9gYdctz.js +1 -0
- package/dist/viewer/assets/IconReferencePage-BLciUKH9.js +1 -0
- package/dist/viewer/assets/SandboxPage-IYn-KIbv.js +1 -0
- package/dist/viewer/assets/SidebarContext-Cn8QRb77.js +1 -0
- package/dist/viewer/assets/SourceBrowserPage-BOlm36Dg.js +1 -0
- package/dist/viewer/assets/Tooltip-tpqNw0op.js +1 -0
- package/dist/viewer/assets/VersionsPage-C02dpN3Y.js +1 -0
- package/dist/viewer/assets/WhenBadge-GxhTQKsq.js +1 -0
- package/dist/viewer/assets/api-C5Iu-4AS.js +1 -0
- package/dist/viewer/assets/bundleQuery-CjbA01rb.js +1 -0
- package/dist/viewer/assets/configStorage-BnMh081m.js +10 -0
- package/dist/viewer/assets/{fa-core-wsCxaNB7.js → fa-core-BoBqCOD3.js} +1 -1
- package/dist/viewer/assets/index-CjU7OUke.js +5 -0
- package/dist/viewer/assets/index-dW-Omils.css +2 -0
- package/dist/viewer/assets/{react-CkuOm_dq.js → react-csXWLXSE.js} +1 -1
- package/dist/viewer/assets/{recordDetail.worker-BIHPFt8Y.js → recordDetail.worker-C0-mQTaj.js} +1 -1
- package/dist/viewer/assets/storageKeys-ClzdCxlg.js +1 -0
- package/dist/viewer/assets/useCriticalExceptionDialog-DK8ufamu.js +5 -0
- package/dist/viewer/assets/{useLocalStorage-BWwvt0nG.js → useLocalStorage-B73GyZbK.js} +1 -1
- package/dist/viewer/assets/{useNavigate-9J1ZzN1J.js → useNavigate-BblEmQ3O.js} +1 -1
- package/dist/viewer/assets/useQuery-5OkVbV1s.js +1 -0
- package/dist/viewer/assets/{validIcons-UmfwFGTT.js → validIcons-BzGQ4tWD.js} +1 -1
- package/dist/viewer/index.html +12 -10
- package/package.json +5 -7
- package/dist/chunk-4Z6S6LWP.js +0 -6134
- package/dist/chunk-4Z6S6LWP.js.map +0 -1
- package/dist/chunk-HJPLDI45.js +0 -6134
- package/dist/chunk-HJPLDI45.js.map +0 -1
- package/dist/chunk-LSHHXCC6.js +0 -3639
- package/dist/chunk-LSHHXCC6.js.map +0 -1
- package/dist/chunk-SEGVTWSK.js +0 -44
- package/dist/chunk-SEGVTWSK.js.map +0 -1
- package/dist/chunk-ZWE3DS7E.js +0 -39
- package/dist/chunk-ZWE3DS7E.js.map +0 -1
- package/dist/devtools-LZRAH4XS.js +0 -90
- package/dist/devtools-LZRAH4XS.js.map +0 -1
- package/dist/dist-C3F6UOWF.js +0 -8472
- package/dist/dist-C3F6UOWF.js.map +0 -1
- package/dist/dist-NUJOSN7W.js +0 -8472
- package/dist/dist-NUJOSN7W.js.map +0 -1
- package/dist/dist-QHDMIBVE.js +0 -135
- package/dist/dist-QHDMIBVE.js.map +0 -1
- package/dist/dist-ZIZQOSY3.js +0 -135
- package/dist/dist-ZIZQOSY3.js.map +0 -1
- package/dist/gzip-size-K37OQCQ2.js +0 -137
- package/dist/gzip-size-K37OQCQ2.js.map +0 -1
- package/dist/gzip-size-QRGIYYEQ.js +0 -137
- package/dist/gzip-size-QRGIYYEQ.js.map +0 -1
- package/dist/viewer/assets/AppDetailPage-BPvWscWJ.js +0 -1
- package/dist/viewer/assets/AppDetailPage-DIuYKCTQ.js +0 -1
- package/dist/viewer/assets/AppDetailPage-r3jzO9Kf.js +0 -1
- package/dist/viewer/assets/BootstrapContext-CExPp3R2.js +0 -1
- package/dist/viewer/assets/BootstrapContext-CTQMWXf-.js +0 -1
- package/dist/viewer/assets/BootstrapContext-DbnbWmQT.js +0 -1
- package/dist/viewer/assets/Card-Bmn1HMWl.js +0 -1
- package/dist/viewer/assets/Card-DMz6T3VL.js +0 -1
- package/dist/viewer/assets/Card-DsqKctyM.js +0 -1
- package/dist/viewer/assets/CodeStepsPage-BHqLfCdV.js +0 -4
- package/dist/viewer/assets/CodeStepsPage-BymhEfzO.js +0 -4
- package/dist/viewer/assets/CodeStepsPage-CD_MhDwY.js +0 -4
- package/dist/viewer/assets/CodeStepsPage-CgI-LqEx.js +0 -4
- package/dist/viewer/assets/CodeStepsPage-Dak3saZE.js +0 -5
- package/dist/viewer/assets/CodeStepsPage-Zj6DscGd.js +0 -4
- package/dist/viewer/assets/ConfigurationPage-Cjy9TH3N.js +0 -1
- package/dist/viewer/assets/ConfigurationPage-DmX-6MM-.js +0 -1
- package/dist/viewer/assets/ConfigurationPage-J56kCD_e.js +0 -1
- package/dist/viewer/assets/CredentialsContext-Xbse1T0q.js +0 -1
- package/dist/viewer/assets/CredentialsContext-zl2e9kpM.js +0 -1
- package/dist/viewer/assets/DevSidebar-B30mgxSn.js +0 -1
- package/dist/viewer/assets/DevSidebar-BhTD2bBO.js +0 -1
- package/dist/viewer/assets/DevSidebar-CsEdCTej.js +0 -1
- package/dist/viewer/assets/IconReferencePage-B6j9wlte.js +0 -1
- package/dist/viewer/assets/IconReferencePage-CJa9yg9Z.js +0 -1
- package/dist/viewer/assets/IconReferencePage-Q5I-lMFQ.js +0 -1
- package/dist/viewer/assets/SandboxPage-C0h7GUkw.js +0 -1
- package/dist/viewer/assets/SandboxPage-GDcydJnJ.js +0 -1
- package/dist/viewer/assets/SandboxPage-JREBQ4id.js +0 -1
- package/dist/viewer/assets/SidebarContext-BPkYyxET.js +0 -1
- package/dist/viewer/assets/SidebarContext-DVDXFWJI.js +0 -1
- package/dist/viewer/assets/SidebarContext-HucmR353.js +0 -1
- package/dist/viewer/assets/VersionsPage-B76eugMm.js +0 -1
- package/dist/viewer/assets/VersionsPage-BIpB0iBz.js +0 -1
- package/dist/viewer/assets/VersionsPage-D0qenxK5.js +0 -1
- package/dist/viewer/assets/api-BOqcXygX.js +0 -1
- package/dist/viewer/assets/api-DqAiw0w9.js +0 -1
- package/dist/viewer/assets/bundleQuery-206rQR6g.js +0 -1
- package/dist/viewer/assets/bundleQuery-L4H4wq5q.js +0 -1
- package/dist/viewer/assets/fa-core-DaD7O-yO.js +0 -558
- package/dist/viewer/assets/fa-pro-icons-Dzkwxnip.js +0 -1
- package/dist/viewer/assets/index-BPiwld5D.js +0 -5
- package/dist/viewer/assets/index-BiyeMU_r.css +0 -2
- package/dist/viewer/assets/index-BlJv_543.js +0 -5
- package/dist/viewer/assets/index-CAYNux5J.js +0 -5
- package/dist/viewer/assets/index-D4AnoAXz.js +0 -5
- package/dist/viewer/assets/index-D8Koqlb-.js +0 -5
- package/dist/viewer/assets/index-DKrC0qkC.js +0 -5
- package/dist/viewer/assets/react-CyWK9rg5.js +0 -9
- package/dist/viewer/assets/useLocalStorage-BlZWItfY.js +0 -1
- package/dist/viewer/assets/useLocalStorage-CQO0VGQ6.js +0 -1
- package/dist/viewer/assets/useNavigate-V8wjv5GQ.js +0 -1
- package/dist/viewer/assets/useObjectLookups-BAqe9wvu.js +0 -14
- package/dist/viewer/assets/useObjectLookups-C65zm-bM.js +0 -14
- package/dist/viewer/assets/useObjectLookups-CslM2vSA.js +0 -14
- package/dist/viewer/assets/validIcons-Dqgxgpv-.js +0 -1
- /package/dist/viewer/assets/{CodeStepsPage-DdKuH37F.css → CodeViewer-DdKuH37F.css} +0 -0
- /package/dist/viewer/assets/{fa-pro-icons-CiTC899m.js → fa-pro-icons-j8-_MCQ7.js} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{S as e,x as t}from"./fa-core-DaD7O-yO.js";import{R as n,n as r,t as i}from"./bundleQuery-206rQR6g.js";import{t as a}from"./Card-DsqKctyM.js";import{i as o,r as s,t as c}from"./validIcons-Dqgxgpv-.js";var l=e();function u(e){return e<1024?`${String(e)} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(2)} MB`}var d=()=>{let{apiName:e}=n({strict:!1}),{data:d,isLoading:f,isError:p}=r(i);if(f)return(0,l.jsx)(a,{children:(0,l.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-400`,children:`Fetching bundle.json…`})});if(p)return(0,l.jsx)(a,{children:(0,l.jsx)(`p`,{className:`m-0 text-[13px] text-red-700`,children:`Could not load bundle.json.`})});let m=d?.find(t=>t.api_name===e);if(!m)return(0,l.jsx)(a,{children:(0,l.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`No app found with api_name`,` `,(0,l.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:e}),`.`]})});let{floating_frames:h,data_adornments:g,routable_pages:_,toolbar_items:v,js_action_templates:y,route_scripts:b,object_settings_menu_items:x,automation_action_configs:S,calendar_sources:C}=m.artifacts,w=h.length>0||g.length>0||_.length>0||v.length>0||y.length>0||b.length>0||x.length>0||S.length>0||C.length>0,T=d?new TextEncoder().encode(JSON.stringify(d,null,2)).length:null,E=m.base_config,D=E?.setup_assistant?.fields??[],O=E?.user_setup_assistant?.fields??[];return(0,l.jsxs)(`div`,{className:`space-y-4 text-[13px]`,children:[(0,l.jsx)(a,{children:(0,l.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`h1`,{className:`text-lg font-bold leading-tight text-neutral-900`,children:m.name}),(0,l.jsx)(`p`,{className:`mt-0.5 font-mono text-[11px] text-neutral-400`,children:m.api_name})]}),m.description&&(0,l.jsx)(`p`,{className:`text-[13px] leading-relaxed text-neutral-600`,children:m.description}),(0,l.jsxs)(`div`,{className:`divide-y divide-black/5`,children:[m.version&&(0,l.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,l.jsxs)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-neutral-600`,children:[`v`,m.version]}),(0,l.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`App version`})]}),m.engine&&(0,l.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,l.jsxs)(`span`,{className:`shrink-0 rounded bg-blue-50 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-blue-600`,children:[`engine: `,m.engine]}),(0,l.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Plugin engine version`})]}),(0,l.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,l.jsx)(`span`,{className:`shrink-0 rounded px-2 py-0.5 text-[11px] font-semibold tracking-wide ${m.published?`bg-green-100 text-green-700`:`bg-neutral-100 text-neutral-500`}`,children:m.published?`published`:`unpublished`}),(0,l.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Whether this app is publicly available`})]}),m.release_environments?.map(e=>(0,l.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,l.jsx)(`span`,{className:`shrink-0 rounded bg-violet-50 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-violet-600`,children:e}),(0,l.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Release environment`})]},e)),m.block_loading_for_setup&&(0,l.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,l.jsx)(`span`,{className:`shrink-0 rounded bg-amber-100 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-amber-700`,children:`blocks app loading`}),(0,l.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Whether this app blocks loading of Kizen UI until resources are fetched and processed`})]}),m.developer_business_id&&(typeof m.developer_business_id==`string`?(0,l.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,l.jsxs)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-2 py-0.5 font-mono text-[11px] tracking-wide text-neutral-500`,children:[`biz: `,m.developer_business_id]}),(0,l.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Developer business ID`})]}):Object.entries(m.developer_business_id).map(([e,t])=>(0,l.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,l.jsxs)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-2 py-0.5 font-mono text-[11px] tracking-wide text-neutral-500`,children:[`biz (`,e,`): `,t]}),(0,l.jsxs)(`span`,{className:`text-[12px] text-neutral-500`,children:[`Developer business ID (`,e,`)`]})]},e))),T!==null&&(0,l.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,l.jsxs)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-neutral-600`,children:[`bundle: `,u(T)]}),(0,l.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Total size of bundle.json`})]})]})]})}),w||D.length>0||O.length>0||m.releaseNotes?(0,l.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3`,children:[h.length>0&&(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Floating Frames`}),(0,l.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:h.length})]}),(0,l.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,l.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Name`}),(0,l.jsx)(`span`,{className:`shrink-0`,children:`Position`})]}),(0,l.jsx)(`div`,{className:`divide-y divide-black/5`,children:h.map((e,t)=>(0,l.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,l.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,l.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,l.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.default_position&&(0,l.jsx)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 text-[10px] text-neutral-500`,children:e.default_position})]},t))})]}),g.length>0&&(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Data Adornments`}),(0,l.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:g.length})]}),(0,l.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,l.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Field`}),(0,l.jsx)(`span`,{className:`shrink-0`,children:`Type`})]}),(0,l.jsx)(`div`,{className:`divide-y divide-black/5`,children:g.map((e,n)=>(0,l.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[e.config.color&&(0,l.jsx)(`span`,{className:`h-3 w-4 shrink-0 rounded-sm border border-black/10`,style:{backgroundColor:e.config.color}}),e.config.icon&&(o[e.config.icon]?(0,l.jsx)(t,{icon:o[e.config.icon],className:`shrink-0 text-[12px] text-neutral-500`}):(0,l.jsx)(`span`,{className:`shrink-0 rounded px-1 font-mono text-[10px] ${c.has(e.config.icon)||s.has(e.config.icon)?`bg-neutral-100 text-neutral-400`:`bg-amber-100 text-amber-600`}`,children:e.config.icon})),(0,l.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-neutral-900`,children:e.config.tooltip||e.field_type}),(0,l.jsx)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 font-mono text-[10px] text-neutral-500`,children:e.field_type})]},n))})]}),_.length>0&&(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Routable Pages`}),(0,l.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:_.length})]}),(0,l.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,l.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Page`}),(0,l.jsx)(`span`,{className:`shrink-0`,children:`Type`})]}),(0,l.jsx)(`div`,{className:`divide-y divide-black/5`,children:_.map((e,t)=>(0,l.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,l.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,l.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,l.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.iframe_url&&(0,l.jsx)(`span`,{className:`shrink-0 rounded bg-purple-100 px-1.5 py-0.5 text-[10px] font-semibold text-purple-600`,children:`iframe`})]},t))})]}),v.length>0&&(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Toolbar Items`}),(0,l.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:v.length})]}),(0,l.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,l.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Label`}),(0,l.jsx)(`span`,{className:`shrink-0`,children:`Icon`})]}),(0,l.jsx)(`div`,{className:`divide-y divide-black/5`,children:v.map((e,n)=>(0,l.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[e.color&&(0,l.jsx)(`span`,{className:`h-3 w-4 shrink-0 rounded-sm border border-black/10`,style:{backgroundColor:e.color}}),(0,l.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,l.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.label}),(0,l.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.icon&&(o[e.icon]?(0,l.jsx)(t,{icon:o[e.icon],className:`shrink-0 text-[12px] text-neutral-400`}):(0,l.jsx)(`span`,{className:`shrink-0 rounded px-1 font-mono text-[10px] ${c.has(e.icon)||s.has(e.icon)?`bg-neutral-100 text-neutral-400`:`bg-amber-100 text-amber-600`}`,children:e.icon}))]},n))})]}),y.length>0&&(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`JS Action Templates`}),(0,l.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:y.length})]}),(0,l.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,l.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Name`}),(0,l.jsx)(`span`,{className:`shrink-0`,children:`Object`})]}),(0,l.jsx)(`div`,{className:`divide-y divide-black/5`,children:y.map((e,t)=>(0,l.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,l.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,l.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,l.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.hint_object_name&&(0,l.jsx)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 text-[10px] text-neutral-500`,children:e.hint_object_name})]},t))})]}),b.length>0&&(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Route Scripts`}),(0,l.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:b.length})]}),(0,l.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,l.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Name`}),(0,l.jsx)(`span`,{className:`shrink-0`,children:`Routes`})]}),(0,l.jsx)(`div`,{className:`divide-y divide-black/5`,children:b.map((e,t)=>(0,l.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,l.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,l.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name||e.api_name}),e.name&&(0,l.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.routes.length>0&&(0,l.jsxs)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 text-[10px] text-neutral-500`,children:[e.routes.length,` route`,e.routes.length===1?``:`s`]})]},t))})]}),x.length>0&&(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Object Settings`}),(0,l.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:x.length})]}),(0,l.jsx)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:(0,l.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Label`})}),(0,l.jsx)(`div`,{className:`divide-y divide-black/5`,children:x.map((e,t)=>(0,l.jsx)(`div`,{className:`flex items-center gap-2 py-1.5`,children:(0,l.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,l.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.label}),(0,l.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]})},t))})]}),S.length>0&&(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Automation Actions`}),(0,l.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:S.length})]}),(0,l.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,l.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Name`}),(0,l.jsx)(`span`,{className:`shrink-0`,children:`Type`})]}),(0,l.jsx)(`div`,{className:`divide-y divide-black/5`,children:S.map((e,t)=>(0,l.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,l.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,l.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,l.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.action_step_api_name})]}),e.action_type&&(0,l.jsx)(`span`,{className:`shrink-0 rounded bg-blue-50 px-1.5 py-0.5 text-[10px] font-semibold text-blue-600`,children:e.action_type})]},t))})]}),C.length>0&&(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Calendar Sources`}),(0,l.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:C.length})]}),(0,l.jsx)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:(0,l.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Name`})}),(0,l.jsx)(`div`,{className:`divide-y divide-black/5`,children:C.map((e,t)=>(0,l.jsx)(`div`,{className:`flex items-center gap-2 py-1.5`,children:(0,l.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,l.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,l.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]})},t))})]}),D.length>0&&(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Setup Assistant`}),(0,l.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:D.length})]}),(0,l.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,l.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Field`}),(0,l.jsx)(`span`,{className:`shrink-0`,children:`Type`})]}),(0,l.jsx)(`div`,{className:`divide-y divide-black/5`,children:D.map((e,t)=>(0,l.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,l.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-neutral-900`,children:`label`in e?e.label??e.key:e.type}),(0,l.jsx)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 font-mono text-[10px] text-neutral-500`,children:e.type})]},t))})]}),O.length>0&&(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`User Setup Assistant`}),(0,l.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:O.length})]}),(0,l.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,l.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Field`}),(0,l.jsx)(`span`,{className:`shrink-0`,children:`Type`})]}),(0,l.jsx)(`div`,{className:`divide-y divide-black/5`,children:O.map((e,t)=>(0,l.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,l.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-neutral-900`,children:`label`in e?e.label??e.key:e.type}),(0,l.jsx)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 font-mono text-[10px] text-neutral-500`,children:e.type})]},t))})]}),m.releaseNotes&&(0,l.jsxs)(a,{children:[(0,l.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Release Notes`}),(0,l.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-[12px] leading-relaxed text-neutral-700`,children:m.releaseNotes})]})]}):(0,l.jsx)(a,{children:(0,l.jsx)(`p`,{className:`text-[13px] text-neutral-400`,children:`No plugin assets defined.`})})]})};export{d as AppDetailPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as e,y as t}from"./fa-core-wsCxaNB7.js";import{R as n,n as r,t as i}from"./bundleQuery-L4H4wq5q.js";import{t as a}from"./Card-DMz6T3VL.js";import{i as o,r as s,t as c}from"./validIcons-UmfwFGTT.js";var l=e();function u(e){return e<1024?`${String(e)} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(2)} MB`}var d=()=>{let{apiName:e}=n({strict:!1}),{data:d,isLoading:f,isError:p}=r(i);if(f)return(0,l.jsx)(a,{children:(0,l.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-400`,children:`Fetching bundle.json…`})});if(p)return(0,l.jsx)(a,{children:(0,l.jsx)(`p`,{className:`m-0 text-[13px] text-red-700`,children:`Could not load bundle.json.`})});let m=d?.find(t=>t.api_name===e);if(!m)return(0,l.jsx)(a,{children:(0,l.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`No app found with api_name`,` `,(0,l.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:e}),`.`]})});let{floating_frames:h,data_adornments:g,routable_pages:_,toolbar_items:v,js_action_templates:y,route_scripts:b,object_settings_menu_items:x,automation_action_configs:S,calendar_sources:C}=m.artifacts,w=h.length>0||g.length>0||_.length>0||v.length>0||y.length>0||b.length>0||x.length>0||S.length>0||C.length>0,T=d?new TextEncoder().encode(JSON.stringify(d,null,2)).length:null,E=m.base_config,D=E?.setup_assistant?.fields??[],O=E?.user_setup_assistant?.fields??[];return(0,l.jsxs)(`div`,{className:`space-y-4 text-[13px]`,children:[(0,l.jsx)(a,{children:(0,l.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`h1`,{className:`text-lg font-bold leading-tight text-neutral-900`,children:m.name}),(0,l.jsx)(`p`,{className:`mt-0.5 font-mono text-[11px] text-neutral-400`,children:m.api_name})]}),m.description&&(0,l.jsx)(`p`,{className:`text-[13px] leading-relaxed text-neutral-600`,children:m.description}),(0,l.jsxs)(`div`,{className:`divide-y divide-black/5`,children:[m.version&&(0,l.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,l.jsxs)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-neutral-600`,children:[`v`,m.version]}),(0,l.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`App version`})]}),m.engine&&(0,l.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,l.jsxs)(`span`,{className:`shrink-0 rounded bg-blue-50 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-blue-600`,children:[`engine: `,m.engine]}),(0,l.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Plugin engine version`})]}),(0,l.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,l.jsx)(`span`,{className:`shrink-0 rounded px-2 py-0.5 text-[11px] font-semibold tracking-wide ${m.published?`bg-green-100 text-green-700`:`bg-neutral-100 text-neutral-500`}`,children:m.published?`published`:`unpublished`}),(0,l.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Whether this app is publicly available`})]}),m.release_environments?.map(e=>(0,l.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,l.jsx)(`span`,{className:`shrink-0 rounded bg-violet-50 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-violet-600`,children:e}),(0,l.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Release environment`})]},e)),m.block_loading_for_setup&&(0,l.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,l.jsx)(`span`,{className:`shrink-0 rounded bg-amber-100 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-amber-700`,children:`blocks app loading`}),(0,l.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Whether this app blocks loading of Kizen UI until resources are fetched and processed`})]}),m.developer_business_id&&(typeof m.developer_business_id==`string`?(0,l.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,l.jsxs)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-2 py-0.5 font-mono text-[11px] tracking-wide text-neutral-500`,children:[`biz: `,m.developer_business_id]}),(0,l.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Developer business ID`})]}):Object.entries(m.developer_business_id).map(([e,t])=>(0,l.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,l.jsxs)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-2 py-0.5 font-mono text-[11px] tracking-wide text-neutral-500`,children:[`biz (`,e,`): `,t]}),(0,l.jsxs)(`span`,{className:`text-[12px] text-neutral-500`,children:[`Developer business ID (`,e,`)`]})]},e))),T!==null&&(0,l.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,l.jsxs)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-neutral-600`,children:[`bundle: `,u(T)]}),(0,l.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Total size of bundle.json`})]})]})]})}),w||D.length>0||O.length>0||m.releaseNotes?(0,l.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3`,children:[h.length>0&&(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Floating Frames`}),(0,l.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:h.length})]}),(0,l.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,l.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Name`}),(0,l.jsx)(`span`,{className:`shrink-0`,children:`Position`})]}),(0,l.jsx)(`div`,{className:`divide-y divide-black/5`,children:h.map((e,t)=>(0,l.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,l.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,l.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,l.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.default_position&&(0,l.jsx)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 text-[10px] text-neutral-500`,children:e.default_position})]},t))})]}),g.length>0&&(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Data Adornments`}),(0,l.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:g.length})]}),(0,l.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,l.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Field`}),(0,l.jsx)(`span`,{className:`shrink-0`,children:`Type`})]}),(0,l.jsx)(`div`,{className:`divide-y divide-black/5`,children:g.map((e,n)=>(0,l.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[e.config.color&&(0,l.jsx)(`span`,{className:`h-3 w-4 shrink-0 rounded-sm border border-black/10`,style:{backgroundColor:e.config.color}}),e.config.icon&&(o[e.config.icon]?(0,l.jsx)(t,{icon:o[e.config.icon],className:`shrink-0 text-[12px] text-neutral-500`}):(0,l.jsx)(`span`,{className:`shrink-0 rounded px-1 font-mono text-[10px] ${c.has(e.config.icon)||s.has(e.config.icon)?`bg-neutral-100 text-neutral-400`:`bg-amber-100 text-amber-600`}`,children:e.config.icon})),(0,l.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-neutral-900`,children:e.config.tooltip||e.field_type}),(0,l.jsx)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 font-mono text-[10px] text-neutral-500`,children:e.field_type})]},n))})]}),_.length>0&&(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Routable Pages`}),(0,l.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:_.length})]}),(0,l.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,l.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Page`}),(0,l.jsx)(`span`,{className:`shrink-0`,children:`Type`})]}),(0,l.jsx)(`div`,{className:`divide-y divide-black/5`,children:_.map((e,t)=>(0,l.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,l.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,l.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,l.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.iframe_url&&(0,l.jsx)(`span`,{className:`shrink-0 rounded bg-purple-100 px-1.5 py-0.5 text-[10px] font-semibold text-purple-600`,children:`iframe`})]},t))})]}),v.length>0&&(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Toolbar Items`}),(0,l.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:v.length})]}),(0,l.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,l.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Label`}),(0,l.jsx)(`span`,{className:`shrink-0`,children:`Icon`})]}),(0,l.jsx)(`div`,{className:`divide-y divide-black/5`,children:v.map((e,n)=>(0,l.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[e.color&&(0,l.jsx)(`span`,{className:`h-3 w-4 shrink-0 rounded-sm border border-black/10`,style:{backgroundColor:e.color}}),(0,l.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,l.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.label}),(0,l.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.icon&&(o[e.icon]?(0,l.jsx)(t,{icon:o[e.icon],className:`shrink-0 text-[12px] text-neutral-400`}):(0,l.jsx)(`span`,{className:`shrink-0 rounded px-1 font-mono text-[10px] ${c.has(e.icon)||s.has(e.icon)?`bg-neutral-100 text-neutral-400`:`bg-amber-100 text-amber-600`}`,children:e.icon}))]},n))})]}),y.length>0&&(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`JS Action Templates`}),(0,l.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:y.length})]}),(0,l.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,l.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Name`}),(0,l.jsx)(`span`,{className:`shrink-0`,children:`Object`})]}),(0,l.jsx)(`div`,{className:`divide-y divide-black/5`,children:y.map((e,t)=>(0,l.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,l.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,l.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,l.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.hint_object_name&&(0,l.jsx)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 text-[10px] text-neutral-500`,children:e.hint_object_name})]},t))})]}),b.length>0&&(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Route Scripts`}),(0,l.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:b.length})]}),(0,l.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,l.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Name`}),(0,l.jsx)(`span`,{className:`shrink-0`,children:`Routes`})]}),(0,l.jsx)(`div`,{className:`divide-y divide-black/5`,children:b.map((e,t)=>(0,l.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,l.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,l.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name||e.api_name}),e.name&&(0,l.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.routes.length>0&&(0,l.jsxs)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 text-[10px] text-neutral-500`,children:[e.routes.length,` route`,e.routes.length===1?``:`s`]})]},t))})]}),x.length>0&&(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Object Settings`}),(0,l.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:x.length})]}),(0,l.jsx)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:(0,l.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Label`})}),(0,l.jsx)(`div`,{className:`divide-y divide-black/5`,children:x.map((e,t)=>(0,l.jsx)(`div`,{className:`flex items-center gap-2 py-1.5`,children:(0,l.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,l.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.label}),(0,l.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]})},t))})]}),S.length>0&&(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Automation Actions`}),(0,l.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:S.length})]}),(0,l.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,l.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Name`}),(0,l.jsx)(`span`,{className:`shrink-0`,children:`Type`})]}),(0,l.jsx)(`div`,{className:`divide-y divide-black/5`,children:S.map((e,t)=>(0,l.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,l.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,l.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,l.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.action_step_api_name})]}),e.action_type&&(0,l.jsx)(`span`,{className:`shrink-0 rounded bg-blue-50 px-1.5 py-0.5 text-[10px] font-semibold text-blue-600`,children:e.action_type})]},t))})]}),C.length>0&&(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Calendar Sources`}),(0,l.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:C.length})]}),(0,l.jsx)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:(0,l.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Name`})}),(0,l.jsx)(`div`,{className:`divide-y divide-black/5`,children:C.map((e,t)=>(0,l.jsx)(`div`,{className:`flex items-center gap-2 py-1.5`,children:(0,l.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,l.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,l.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]})},t))})]}),D.length>0&&(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Setup Assistant`}),(0,l.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:D.length})]}),(0,l.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,l.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Field`}),(0,l.jsx)(`span`,{className:`shrink-0`,children:`Type`})]}),(0,l.jsx)(`div`,{className:`divide-y divide-black/5`,children:D.map((e,t)=>(0,l.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,l.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-neutral-900`,children:`label`in e?e.label??e.key:e.type}),(0,l.jsx)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 font-mono text-[10px] text-neutral-500`,children:e.type})]},t))})]}),O.length>0&&(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`User Setup Assistant`}),(0,l.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:O.length})]}),(0,l.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,l.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Field`}),(0,l.jsx)(`span`,{className:`shrink-0`,children:`Type`})]}),(0,l.jsx)(`div`,{className:`divide-y divide-black/5`,children:O.map((e,t)=>(0,l.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,l.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-neutral-900`,children:`label`in e?e.label??e.key:e.type}),(0,l.jsx)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 font-mono text-[10px] text-neutral-500`,children:e.type})]},t))})]}),m.releaseNotes&&(0,l.jsxs)(a,{children:[(0,l.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Release Notes`}),(0,l.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-[12px] leading-relaxed text-neutral-700`,children:m.releaseNotes})]})]}):(0,l.jsx)(a,{children:(0,l.jsx)(`p`,{className:`text-[13px] text-neutral-400`,children:`No plugin assets defined.`})})]})};export{d as AppDetailPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as e,y as t}from"./fa-core-wsCxaNB7.js";import{R as n,n as r,t as i}from"./bundleQuery-L4H4wq5q.js";import{t as a}from"./Card-Bmn1HMWl.js";import{i as o,r as s,t as c}from"./validIcons-Dqgxgpv-.js";var l=e();function u(e){return e<1024?`${String(e)} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(2)} MB`}var d=()=>{let{apiName:e}=n({strict:!1}),{data:d,isLoading:f,isError:p}=r(i);if(f)return(0,l.jsx)(a,{children:(0,l.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-400`,children:`Fetching bundle.json…`})});if(p)return(0,l.jsx)(a,{children:(0,l.jsx)(`p`,{className:`m-0 text-[13px] text-red-700`,children:`Could not load bundle.json.`})});let m=d?.find(t=>t.api_name===e);if(!m)return(0,l.jsx)(a,{children:(0,l.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`No app found with api_name`,` `,(0,l.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:e}),`.`]})});let{floating_frames:h,data_adornments:g,routable_pages:_,toolbar_items:v,js_action_templates:y,route_scripts:b,object_settings_menu_items:x,automation_action_configs:S,calendar_sources:C}=m.artifacts,w=h.length>0||g.length>0||_.length>0||v.length>0||y.length>0||b.length>0||x.length>0||S.length>0||C.length>0,T=d?new TextEncoder().encode(JSON.stringify(d,null,2)).length:null,E=m.base_config,D=E?.setup_assistant?.fields??[],O=E?.user_setup_assistant?.fields??[];return(0,l.jsxs)(`div`,{className:`space-y-4 text-[13px]`,children:[(0,l.jsx)(a,{children:(0,l.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`h1`,{className:`text-lg font-bold leading-tight text-neutral-900`,children:m.name}),(0,l.jsx)(`p`,{className:`mt-0.5 font-mono text-[11px] text-neutral-400`,children:m.api_name})]}),m.description&&(0,l.jsx)(`p`,{className:`text-[13px] leading-relaxed text-neutral-600`,children:m.description}),(0,l.jsxs)(`div`,{className:`divide-y divide-black/5`,children:[m.version&&(0,l.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,l.jsxs)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-neutral-600`,children:[`v`,m.version]}),(0,l.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`App version`})]}),m.engine&&(0,l.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,l.jsxs)(`span`,{className:`shrink-0 rounded bg-blue-50 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-blue-600`,children:[`engine: `,m.engine]}),(0,l.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Plugin engine version`})]}),(0,l.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,l.jsx)(`span`,{className:`shrink-0 rounded px-2 py-0.5 text-[11px] font-semibold tracking-wide ${m.published?`bg-green-100 text-green-700`:`bg-neutral-100 text-neutral-500`}`,children:m.published?`published`:`unpublished`}),(0,l.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Whether this app is publicly available`})]}),m.release_environments?.map(e=>(0,l.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,l.jsx)(`span`,{className:`shrink-0 rounded bg-violet-50 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-violet-600`,children:e}),(0,l.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Release environment`})]},e)),m.block_loading_for_setup&&(0,l.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,l.jsx)(`span`,{className:`shrink-0 rounded bg-amber-100 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-amber-700`,children:`blocks app loading`}),(0,l.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Whether this app blocks loading of Kizen UI until resources are fetched and processed`})]}),m.developer_business_id&&(typeof m.developer_business_id==`string`?(0,l.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,l.jsxs)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-2 py-0.5 font-mono text-[11px] tracking-wide text-neutral-500`,children:[`biz: `,m.developer_business_id]}),(0,l.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Developer business ID`})]}):Object.entries(m.developer_business_id).map(([e,t])=>(0,l.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,l.jsxs)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-2 py-0.5 font-mono text-[11px] tracking-wide text-neutral-500`,children:[`biz (`,e,`): `,t]}),(0,l.jsxs)(`span`,{className:`text-[12px] text-neutral-500`,children:[`Developer business ID (`,e,`)`]})]},e))),T!==null&&(0,l.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,l.jsxs)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-2 py-0.5 text-[11px] font-semibold tracking-wide text-neutral-600`,children:[`bundle: `,u(T)]}),(0,l.jsx)(`span`,{className:`text-[12px] text-neutral-500`,children:`Total size of bundle.json`})]})]})]})}),w||D.length>0||O.length>0||m.releaseNotes?(0,l.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3`,children:[h.length>0&&(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Floating Frames`}),(0,l.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:h.length})]}),(0,l.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,l.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Name`}),(0,l.jsx)(`span`,{className:`shrink-0`,children:`Position`})]}),(0,l.jsx)(`div`,{className:`divide-y divide-black/5`,children:h.map((e,t)=>(0,l.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,l.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,l.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,l.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.default_position&&(0,l.jsx)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 text-[10px] text-neutral-500`,children:e.default_position})]},t))})]}),g.length>0&&(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Data Adornments`}),(0,l.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:g.length})]}),(0,l.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,l.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Field`}),(0,l.jsx)(`span`,{className:`shrink-0`,children:`Type`})]}),(0,l.jsx)(`div`,{className:`divide-y divide-black/5`,children:g.map((e,n)=>(0,l.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[e.config.color&&(0,l.jsx)(`span`,{className:`h-3 w-4 shrink-0 rounded-sm border border-black/10`,style:{backgroundColor:e.config.color}}),e.config.icon&&(o[e.config.icon]?(0,l.jsx)(t,{icon:o[e.config.icon],className:`shrink-0 text-[12px] text-neutral-500`}):(0,l.jsx)(`span`,{className:`shrink-0 rounded px-1 font-mono text-[10px] ${c.has(e.config.icon)||s.has(e.config.icon)?`bg-neutral-100 text-neutral-400`:`bg-amber-100 text-amber-600`}`,children:e.config.icon})),(0,l.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-neutral-900`,children:e.config.tooltip||e.field_type}),(0,l.jsx)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 font-mono text-[10px] text-neutral-500`,children:e.field_type})]},n))})]}),_.length>0&&(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Routable Pages`}),(0,l.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:_.length})]}),(0,l.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,l.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Page`}),(0,l.jsx)(`span`,{className:`shrink-0`,children:`Type`})]}),(0,l.jsx)(`div`,{className:`divide-y divide-black/5`,children:_.map((e,t)=>(0,l.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,l.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,l.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,l.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.iframe_url&&(0,l.jsx)(`span`,{className:`shrink-0 rounded bg-purple-100 px-1.5 py-0.5 text-[10px] font-semibold text-purple-600`,children:`iframe`})]},t))})]}),v.length>0&&(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Toolbar Items`}),(0,l.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:v.length})]}),(0,l.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,l.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Label`}),(0,l.jsx)(`span`,{className:`shrink-0`,children:`Icon`})]}),(0,l.jsx)(`div`,{className:`divide-y divide-black/5`,children:v.map((e,n)=>(0,l.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[e.color&&(0,l.jsx)(`span`,{className:`h-3 w-4 shrink-0 rounded-sm border border-black/10`,style:{backgroundColor:e.color}}),(0,l.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,l.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.label}),(0,l.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.icon&&(o[e.icon]?(0,l.jsx)(t,{icon:o[e.icon],className:`shrink-0 text-[12px] text-neutral-400`}):(0,l.jsx)(`span`,{className:`shrink-0 rounded px-1 font-mono text-[10px] ${c.has(e.icon)||s.has(e.icon)?`bg-neutral-100 text-neutral-400`:`bg-amber-100 text-amber-600`}`,children:e.icon}))]},n))})]}),y.length>0&&(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`JS Action Templates`}),(0,l.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:y.length})]}),(0,l.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,l.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Name`}),(0,l.jsx)(`span`,{className:`shrink-0`,children:`Object`})]}),(0,l.jsx)(`div`,{className:`divide-y divide-black/5`,children:y.map((e,t)=>(0,l.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,l.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,l.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,l.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.hint_object_name&&(0,l.jsx)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 text-[10px] text-neutral-500`,children:e.hint_object_name})]},t))})]}),b.length>0&&(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Route Scripts`}),(0,l.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:b.length})]}),(0,l.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,l.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Name`}),(0,l.jsx)(`span`,{className:`shrink-0`,children:`Routes`})]}),(0,l.jsx)(`div`,{className:`divide-y divide-black/5`,children:b.map((e,t)=>(0,l.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,l.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,l.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name||e.api_name}),e.name&&(0,l.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]}),e.routes.length>0&&(0,l.jsxs)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 text-[10px] text-neutral-500`,children:[e.routes.length,` route`,e.routes.length===1?``:`s`]})]},t))})]}),x.length>0&&(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Object Settings`}),(0,l.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:x.length})]}),(0,l.jsx)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:(0,l.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Label`})}),(0,l.jsx)(`div`,{className:`divide-y divide-black/5`,children:x.map((e,t)=>(0,l.jsx)(`div`,{className:`flex items-center gap-2 py-1.5`,children:(0,l.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,l.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.label}),(0,l.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]})},t))})]}),S.length>0&&(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Automation Actions`}),(0,l.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:S.length})]}),(0,l.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,l.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Name`}),(0,l.jsx)(`span`,{className:`shrink-0`,children:`Type`})]}),(0,l.jsx)(`div`,{className:`divide-y divide-black/5`,children:S.map((e,t)=>(0,l.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,l.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,l.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,l.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.action_step_api_name})]}),e.action_type&&(0,l.jsx)(`span`,{className:`shrink-0 rounded bg-blue-50 px-1.5 py-0.5 text-[10px] font-semibold text-blue-600`,children:e.action_type})]},t))})]}),C.length>0&&(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Calendar Sources`}),(0,l.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:C.length})]}),(0,l.jsx)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:(0,l.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Name`})}),(0,l.jsx)(`div`,{className:`divide-y divide-black/5`,children:C.map((e,t)=>(0,l.jsx)(`div`,{className:`flex items-center gap-2 py-1.5`,children:(0,l.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,l.jsx)(`div`,{className:`truncate text-neutral-900`,children:e.name}),(0,l.jsx)(`div`,{className:`truncate font-mono text-[11px] text-neutral-400`,children:e.api_name})]})},t))})]}),D.length>0&&(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Setup Assistant`}),(0,l.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:D.length})]}),(0,l.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,l.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Field`}),(0,l.jsx)(`span`,{className:`shrink-0`,children:`Type`})]}),(0,l.jsx)(`div`,{className:`divide-y divide-black/5`,children:D.map((e,t)=>(0,l.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,l.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-neutral-900`,children:`label`in e?e.label??e.key:e.type}),(0,l.jsx)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 font-mono text-[10px] text-neutral-500`,children:e.type})]},t))})]}),O.length>0&&(0,l.jsxs)(a,{children:[(0,l.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,l.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`User Setup Assistant`}),(0,l.jsx)(`span`,{className:`ml-auto rounded bg-neutral-100 px-1.5 py-0.5 text-[11px] font-semibold text-neutral-500`,children:O.length})]}),(0,l.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[10px] text-neutral-400`,children:[(0,l.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Field`}),(0,l.jsx)(`span`,{className:`shrink-0`,children:`Type`})]}),(0,l.jsx)(`div`,{className:`divide-y divide-black/5`,children:O.map((e,t)=>(0,l.jsxs)(`div`,{className:`flex items-center gap-2 py-1.5`,children:[(0,l.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-neutral-900`,children:`label`in e?e.label??e.key:e.type}),(0,l.jsx)(`span`,{className:`shrink-0 rounded bg-neutral-100 px-1.5 py-0.5 font-mono text-[10px] text-neutral-500`,children:e.type})]},t))})]}),m.releaseNotes&&(0,l.jsxs)(a,{children:[(0,l.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Release Notes`}),(0,l.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-[12px] leading-relaxed text-neutral-700`,children:m.releaseNotes})]})]}):(0,l.jsx)(a,{children:(0,l.jsx)(`p`,{className:`text-[13px] text-neutral-400`,children:`No plugin assets defined.`})})]})};export{d as AppDetailPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{C as t}from"./fa-core-DaD7O-yO.js";import{A as n,C as r,D as i,E as a,F as o,I as s,L as c,M as l,O as u,S as d,T as f,_ as p,b as m,g as h,h as g,k as _,v,w as y,x as b,y as x}from"./bundleQuery-206rQR6g.js";function S(e){return{onFetch:(t,n)=>{let i=t.options,a=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],s=t.state.data?.pageParams||[],c={pages:[],pageParams:[]},l=0,u=async()=>{let n=!1,u=e=>{m(e,()=>t.signal,()=>n=!0)},f=r(t.options,t.fetchOptions),p=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await f((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return u(e),e})()),{maxPages:o}=t.options,s=i?d:b;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(a&&o.length){let e=a===`backward`,t=e?w:C,n={pages:o,pageParams:s};c=await p(n,t(i,n),e)}else{let t=e??o.length;do{let e=l===0?s[0]??i.initialPageParam:C(i,c);if(l>0&&e==null)break;c=await p(c,e),l++}while(l<t)}return c};t.options.persister?t.fetchFn=()=>t.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=u}}}function C(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function w(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var T=class extends h{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||E(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=p({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}})(this.state),x.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function E(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var D=class extends c{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new T({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=O(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=O(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=O(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=O(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){x.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>i(t,e))}findAll(e={}){return this.getAll().filter(t=>i(e,t))}notify(e){x.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return x.batch(()=>Promise.all(e.map(e=>e.continue().catch(_))))}};function O(e){return e.options.scope?.id}var k=class extends c{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??a(r,t),o=this.get(i);return o||(o=new g({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(o)),o}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){x.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>u(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>u(e,t)):t}notify(e){x.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){x.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){x.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},A=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new k,this.#t=e.mutationCache||new D,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=s.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=v.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(l(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=y(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return x.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;x.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return x.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=x.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(_).catch(_)}invalidateQueries(e,t={}){return x.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=x.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(_)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(_)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(l(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(_).catch(_)}fetchInfiniteQuery(e){return e.behavior=S(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(_).catch(_)}ensureInfiniteQueryData(e){return e.behavior=S(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return v.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(f(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],r={};return t.forEach(t=>{n(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){this.#i.set(f(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],r={};return t.forEach(t=>{n(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=a(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===o&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},j=e(t(),1),M=(0,j.createContext)(void 0),N=()=>(0,j.useContext)(M);export{E as i,N as n,A as r,M as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{x as t}from"./fa-core-wsCxaNB7.js";import{A as n,C as r,D as i,E as a,F as o,I as s,L as c,M as l,O as u,S as d,T as f,_ as p,b as m,g as h,h as g,k as _,v,w as y,x as b,y as x}from"./bundleQuery-L4H4wq5q.js";function S(e){return{onFetch:(t,n)=>{let i=t.options,a=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],s=t.state.data?.pageParams||[],c={pages:[],pageParams:[]},l=0,u=async()=>{let n=!1,u=e=>{m(e,()=>t.signal,()=>n=!0)},f=r(t.options,t.fetchOptions),p=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await f((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return u(e),e})()),{maxPages:o}=t.options,s=i?d:b;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(a&&o.length){let e=a===`backward`,t=e?w:C,n={pages:o,pageParams:s};c=await p(n,t(i,n),e)}else{let t=e??o.length;do{let e=l===0?s[0]??i.initialPageParam:C(i,c);if(l>0&&e==null)break;c=await p(c,e),l++}while(l<t)}return c};t.options.persister?t.fetchFn=()=>t.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=u}}}function C(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function w(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var T=class extends h{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||E(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=p({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}})(this.state),x.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function E(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var D=class extends c{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new T({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=O(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=O(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=O(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=O(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){x.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>i(t,e))}findAll(e={}){return this.getAll().filter(t=>i(e,t))}notify(e){x.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return x.batch(()=>Promise.all(e.map(e=>e.continue().catch(_))))}};function O(e){return e.options.scope?.id}var k=class extends c{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??a(r,t),o=this.get(i);return o||(o=new g({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(o)),o}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){x.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>u(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>u(e,t)):t}notify(e){x.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){x.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){x.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},A=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new k,this.#t=e.mutationCache||new D,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=s.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=v.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(l(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=y(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return x.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;x.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return x.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=x.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(_).catch(_)}invalidateQueries(e,t={}){return x.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=x.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(_)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(_)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(l(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(_).catch(_)}fetchInfiniteQuery(e){return e.behavior=S(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(_).catch(_)}ensureInfiniteQueryData(e){return e.behavior=S(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return v.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(f(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],r={};return t.forEach(t=>{n(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){this.#i.set(f(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],r={};return t.forEach(t=>{n(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=a(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===o&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},j=e(t(),1),M=(0,j.createContext)(void 0),N=()=>(0,j.useContext)(M);export{E as i,N as n,A as r,M as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{x as t}from"./fa-core-wsCxaNB7.js";import{A as n,C as r,D as i,E as a,F as o,I as s,L as c,M as l,O as u,S as d,T as f,_ as p,b as m,g as h,h as g,k as _,v,w as y,x as b,y as x}from"./bundleQuery-L4H4wq5q.js";import{r as S}from"./CredentialsContext-zl2e9kpM.js";function C(e){return{onFetch:(t,n)=>{let i=t.options,a=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],s=t.state.data?.pageParams||[],c={pages:[],pageParams:[]},l=0,u=async()=>{let n=!1,u=e=>{m(e,()=>t.signal,()=>n=!0)},f=r(t.options,t.fetchOptions),p=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await f((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return u(e),e})()),{maxPages:o}=t.options,s=i?d:b;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(a&&o.length){let e=a===`backward`,t=e?T:w,n={pages:o,pageParams:s};c=await p(n,t(i,n),e)}else{let t=e??o.length;do{let e=l===0?s[0]??i.initialPageParam:w(i,c);if(l>0&&e==null)break;c=await p(c,e),l++}while(l<t)}return c};t.options.persister?t.fetchFn=()=>t.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=u}}}function w(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function T(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var E=class extends h{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||D(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=p({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){this.state=(t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}})(this.state),x.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function D(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var O=class extends c{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new E({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=k(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=k(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=k(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=k(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){x.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>i(t,e))}findAll(e={}){return this.getAll().filter(t=>i(e,t))}notify(e){x.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return x.batch(()=>Promise.all(e.map(e=>e.continue().catch(_))))}};function k(e){return e.options.scope?.id}var A=class extends c{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??a(r,t),o=this.get(i);return o||(o=new g({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(o)),o}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){x.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>u(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>u(e,t)):t}notify(e){x.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){x.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){x.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},j=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new A,this.#t=e.mutationCache||new O,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=s.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=v.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(l(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=y(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return x.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;x.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return x.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=x.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(_).catch(_)}invalidateQueries(e,t={}){return x.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=x.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(_)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(_)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(l(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(_).catch(_)}fetchInfiniteQuery(e){return e.behavior=C(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(_).catch(_)}ensureInfiniteQueryData(e){return e.behavior=C(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return v.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(f(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],r={};return t.forEach(t=>{n(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){this.#i.set(f(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],r={};return t.forEach(t=>{n(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=a(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===o&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},M=e(t(),1),N={go:`https://app.go.kizen.com/api`,fmo:`https://app.fmo.kizen.com/api`,staging:`https://staging.kizen.dev/api`,integration:`https://integration.kizen.dev/api`,test1:`https://test1.kizen.dev/api`},P={go:`https://go.kizen.com`,fmo:`https://fmo.kizen.com`,staging:`https://v2.staging.kizen.com`,integration:`https://v2.integration.kizen.dev`,test1:`https://test1.kizen.dev`};function F(){let{apiKey:e,userId:t,businessId:n,environment:r}=S(),i=N[r];return(0,M.useCallback)((r,a={})=>fetch(`/api/proxy${r}`,{...a,headers:{"x-proxy-target":i,"X-API-KEY":e,"X-USER-ID":t,"X-BUSINESS-ID":n,...a.headers}}),[i,e,t,n])}var I=(0,M.createContext)(void 0),L=()=>(0,M.useContext)(I);export{F as a,N as i,L as n,j as o,P as r,D as s,I as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as e}from"./fa-core-wsCxaNB7.js";var t=e(),n=({children:e,className:n=``})=>(0,t.jsx)(`div`,{className:`rounded-xl bg-white p-5 shadow-sm ${n}`,children:e});export{n as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as e}from"./fa-core-wsCxaNB7.js";var t=e(),n=({children:e,className:n=``})=>(0,t.jsx)(`div`,{className:`rounded-xl bg-white p-5 shadow-sm ${n}`,children:e});export{n as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{S as e}from"./fa-core-DaD7O-yO.js";var t=e(),n=({children:e,className:n=``})=>(0,t.jsx)(`div`,{className:`rounded-xl bg-white p-5 shadow-sm ${n}`,children:e});export{n as t};
|
|
@@ -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{t as p}from"./Card-DMz6T3VL.js";import{t as m}from"./useLocalStorage-BlZWItfY.js";var h=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,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}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=$})),g=e(s(),1),_=e(h()).default;function v(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 y=n();_.registerLanguage(`python`,v);var b=({code:e,language:t=`python`,onRun:n,isRunning:a=!1,executionMode:o,onModeChange:s})=>{let l=(0,g.useMemo)(()=>_.highlight(e,{language:t}).value.split(`
|
|
4
|
-
`),[e,t]);return(0,y.jsxs)(`div`,{className:`overflow-hidden rounded-lg border border-black/10 bg-white`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-black/10 bg-neutral-50 px-4 py-2`,children:[(0,y.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:t}),(0,y.jsx)(`div`,{className:`flex-1`}),o&&s&&(0,y.jsx)(`div`,{className:`flex overflow-hidden rounded border border-black/10 text-[11px] font-medium`,children:[`local`,`remote`].map(e=>(0,y.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,y.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,y.jsx)(c,{icon:a?i:r,className:a?`animate-spin`:``}),(0,y.jsx)(`span`,{children:a?`Running…`:`Run`})]})]}),(0,y.jsxs)(`div`,{className:`flex overflow-auto bg-white font-mono text-[13px] leading-[20px]`,children:[(0,y.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,y.jsx)(`div`,{children:String(t+1)},t))}),(0,y.jsx)(`div`,{className:`flex-1 overflow-auto py-3 pl-4 pr-4`,children:l.map((e,t)=>(0,y.jsx)(`div`,{className:`hljs whitespace-pre`,dangerouslySetInnerHTML:{__html:e||`\xA0`}},t))})]})]})},x=({title:e,defaultOpen:t=!1,children:n})=>{let[r,i]=(0,g.useState)(t);return(0,y.jsxs)(`div`,{children:[(0,y.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,y.jsx)(c,{icon:r?o:a,className:`w-2.5`}),e]}),r&&(0,y.jsx)(`div`,{className:`pb-2`,children:n})]})},S=({result:e})=>{let t=Object.entries(e.outputValues);return(0,y.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-black/10 bg-white p-4`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.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,y.jsxs)(`span`,{className:`text-[11px] text-neutral-400`,children:[String(e.durationMs),`ms`]}),e.exitCode!==0&&(0,y.jsxs)(`span`,{className:`text-[11px] text-neutral-400`,children:[`exit code `,String(e.exitCode)]})]}),e.error&&(0,y.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,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`mb-1 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Outputs`}),(0,y.jsx)(`div`,{className:`divide-y divide-black/5`,children:t.map(([e,t])=>(0,y.jsxs)(`div`,{className:`flex items-start gap-2 py-1.5`,children:[(0,y.jsx)(`span`,{className:`shrink-0 font-mono text-[12px] text-neutral-600`,children:e}),(0,y.jsx)(`span`,{className:`text-[11px] text-neutral-300`,children:`=`}),(0,y.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,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`mb-1 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Logs`}),(0,y.jsx)(`div`,{className:`space-y-0.5`,children:e.logs.map((e,t)=>(0,y.jsx)(`div`,{className:`font-mono text-[12px] text-neutral-600`,children:e},t))})]}),e.stdout&&(0,y.jsx)(x,{title:`Stdout`,children:(0,y.jsx)(`pre`,{className:`overflow-auto rounded bg-neutral-50 p-3 font-mono text-[12px] text-neutral-700`,children:e.stdout})}),e.stderr&&(0,y.jsx)(x,{title:`Stderr`,children:(0,y.jsx)(`pre`,{className:`overflow-auto rounded bg-neutral-50 p-3 font-mono text-[12px] text-neutral-700`,children:e.stderr})})]})},C=()=>{let{apiName:e,stepApiName:t}=u({strict:!1}),n=l(),{data:r,isLoading:i,isError:a}=d(f),[o,s]=(0,g.useState)(!1),[c,h]=(0,g.useState)(null),[_,v]=m(`kizen-step-inputs:${e??``}:${t??``}`,{}),[x,C]=m(`kizen-step-secrets:${e??``}:${t??``}`,{}),[w,T]=m(`kizen-code-runner-mode`,`local`),E=r?.find(t=>t.api_name===e),D=(0,g.useMemo)(()=>E?.artifacts.automation_action_configs??[],[E]),O=D.find(e=>e.action_step_api_name===t)??D[0];if((0,g.useEffect)(()=>{if(!t&&D.length>0&&e){let t=D[0];t&&n({to:`/$apiName/code-steps/$stepApiName`,params:{apiName:e,stepApiName:t.action_step_api_name},replace:!0})}},[t,D,e,n]),(0,g.useEffect)(()=>{h(null)},[t]),i)return(0,y.jsx)(p,{children:(0,y.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-400`,children:`Fetching bundle.json…`})});if(a)return(0,y.jsx)(p,{children:(0,y.jsx)(`p`,{className:`m-0 text-[13px] text-red-700`,children:`Could not load bundle.json.`})});if(!E)return(0,y.jsx)(p,{children:(0,y.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`No app found with api_name`,` `,(0,y.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:e}),`.`]})});if(D.length===0)return(0,y.jsx)(p,{children:(0,y.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:`This app has no automation code steps.`})});if(!O)return(0,y.jsx)(p,{children:(0,y.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`Step not found: `,(0,y.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:t}),`.`]})});let k=async()=>{s(!0),h(null),console.log(Object.fromEntries(O.secrets.map(t=>[`${e??``}__${t}`,x[t]??``])));try{let t={script:O.script,scriptRuntime:O.script_runtime,inputs:_},n=w===`remote`?{...t,mode:`remote`,inputTypes:Object.fromEntries(O.inputs.map(e=>[e.name,e.data_type])),outputTypes:Object.fromEntries(O.outputs.map(e=>[e.name,e.data_type])),secretNames:O.secrets.map(t=>`${e??``}__${t}`)}:{...t,secrets:Object.fromEntries(O.secrets.map(t=>[`${e??``}__${t}`,x[t]??``]))};h(await(await fetch(`/api/execute-step`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)})).json())}catch(e){h({success:!1,outputValues:{},logs:[],stdout:``,stderr:``,error:e instanceof Error?e.message:String(e),exitCode:1,durationMs:0})}finally{s(!1)}};return(0,y.jsxs)(`div`,{className:`space-y-4`,children:[(0,y.jsxs)(p,{children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,y.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Code Step`}),(0,y.jsx)(`select`,{value:O.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:D.map(e=>(0,y.jsx)(`option`,{value:e.action_step_api_name,children:e.name},e.action_step_api_name))}),(0,y.jsx)(`div`,{className:`flex-1`}),(0,y.jsx)(`span`,{className:`rounded bg-blue-50 px-1.5 py-0.5 text-[10px] font-semibold text-blue-600`,children:O.script_runtime})]}),O.overall_description&&(0,y.jsx)(`p`,{className:`mt-2 text-[12px] text-neutral-500`,children:O.overall_description})]}),O.inputs.length>0&&(0,y.jsxs)(p,{children:[(0,y.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Inputs`}),(0,y.jsx)(`div`,{className:`space-y-3`,children:O.inputs.map(e=>(0,y.jsxs)(`div`,{children:[(0,y.jsxs)(`label`,{className:`mb-1 block text-[12px] text-neutral-700`,children:[e.label,e.required&&(0,y.jsx)(`span`,{className:`ml-0.5 text-red-500`,children:`*`})]}),(0,y.jsx)(`input`,{type:`text`,value:_[e.name]??``,onChange:t=>{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,y.jsx)(`div`,{className:`mt-0.5 font-mono text-[10px] text-neutral-400`,children:e.name})]},e.name))})]}),O.secrets.length>0&&(0,y.jsxs)(p,{children:[(0,y.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Secrets`}),(0,y.jsx)(`div`,{className:`space-y-3`,children:O.secrets.map(e=>(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`label`,{className:`mb-1 block text-[12px] text-neutral-700`,children:e}),(0,y.jsx)(`input`,{type:`password`,value:x[e]??``,onChange:t=>{C({...x,[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,y.jsx)(b,{code:O.script,language:`python`,onRun:()=>void k(),isRunning:o,executionMode:w,onModeChange:T}),c&&(0,y.jsx)(S,{result:c})]})};export{C 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{t as p}from"./Card-DMz6T3VL.js";import{t as m}from"./useLocalStorage-BlZWItfY.js";var h=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,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}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=$})),g=e(s(),1),_=e(h()).default;function v(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 y=n();_.registerLanguage(`python`,v);var b=({code:e,language:t=`python`,onRun:n,isRunning:a=!1,executionMode:o,onModeChange:s})=>{let l=(0,g.useMemo)(()=>_.highlight(e,{language:t}).value.split(`
|
|
4
|
-
`),[e,t]);return(0,y.jsxs)(`div`,{className:`overflow-hidden rounded-lg border border-black/10 bg-white`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-black/10 bg-neutral-50 px-4 py-2`,children:[(0,y.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:t}),(0,y.jsx)(`div`,{className:`flex-1`}),o&&s&&(0,y.jsx)(`div`,{className:`flex overflow-hidden rounded border border-black/10 text-[11px] font-medium`,children:[`local`,`remote`].map(e=>(0,y.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,y.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,y.jsx)(c,{icon:a?i:r,className:a?`animate-spin`:``}),(0,y.jsx)(`span`,{children:a?`Running…`:`Run`})]})]}),(0,y.jsxs)(`div`,{className:`flex overflow-auto bg-white font-mono text-[13px] leading-[20px]`,children:[(0,y.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,y.jsx)(`div`,{children:String(t+1)},t))}),(0,y.jsx)(`div`,{className:`flex-1 overflow-auto py-3 pl-4 pr-4`,children:l.map((e,t)=>(0,y.jsx)(`div`,{className:`hljs whitespace-pre`,dangerouslySetInnerHTML:{__html:e||`\xA0`}},t))})]})]})},x=({title:e,defaultOpen:t=!1,children:n})=>{let[r,i]=(0,g.useState)(t);return(0,y.jsxs)(`div`,{children:[(0,y.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,y.jsx)(c,{icon:r?o:a,className:`w-2.5`}),e]}),r&&(0,y.jsx)(`div`,{className:`pb-2`,children:n})]})},S=({result:e})=>{let t=Object.entries(e.outputValues);return(0,y.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-black/10 bg-white p-4`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.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,y.jsxs)(`span`,{className:`text-[11px] text-neutral-400`,children:[String(e.durationMs),`ms`]}),e.exitCode!==0&&(0,y.jsxs)(`span`,{className:`text-[11px] text-neutral-400`,children:[`exit code `,String(e.exitCode)]})]}),e.error&&(0,y.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,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`mb-1 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Outputs`}),(0,y.jsx)(`div`,{className:`divide-y divide-black/5`,children:t.map(([e,t])=>(0,y.jsxs)(`div`,{className:`flex items-start gap-2 py-1.5`,children:[(0,y.jsx)(`span`,{className:`shrink-0 font-mono text-[12px] text-neutral-600`,children:e}),(0,y.jsx)(`span`,{className:`text-[11px] text-neutral-300`,children:`=`}),(0,y.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,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`mb-1 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Logs`}),(0,y.jsx)(`div`,{className:`space-y-0.5`,children:e.logs.map((e,t)=>(0,y.jsx)(`div`,{className:`font-mono text-[12px] text-neutral-600`,children:e},t))})]}),e.stdout&&(0,y.jsx)(x,{title:`Stdout`,children:(0,y.jsx)(`pre`,{className:`overflow-auto rounded bg-neutral-50 p-3 font-mono text-[12px] text-neutral-700`,children:e.stdout})}),e.stderr&&(0,y.jsx)(x,{title:`Stderr`,children:(0,y.jsx)(`pre`,{className:`overflow-auto rounded bg-neutral-50 p-3 font-mono text-[12px] text-neutral-700`,children:e.stderr})})]})},C=()=>{let{apiName:e,stepApiName:t}=u({strict:!1}),n=l(),{data:r,isLoading:i,isError:a}=d(f),[o,s]=(0,g.useState)(!1),[c,h]=(0,g.useState)(null),[_,v]=m(`kizen-step-inputs:${e??``}:${t??``}`,{}),[x,C]=m(`kizen-step-secrets:${e??``}:${t??``}`,{}),[w,T]=m(`kizen-code-runner-mode`,`local`),E=r?.find(t=>t.api_name===e),D=(0,g.useMemo)(()=>E?.artifacts.automation_action_configs??[],[E]),O=D.find(e=>e.action_step_api_name===t)??D[0];if((0,g.useEffect)(()=>{if(!t&&D.length>0&&e){let t=D[0];t&&n({to:`/$apiName/code-steps/$stepApiName`,params:{apiName:e,stepApiName:t.action_step_api_name},replace:!0})}},[t,D,e,n]),(0,g.useEffect)(()=>{h(null)},[t]),i)return(0,y.jsx)(p,{children:(0,y.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-400`,children:`Fetching bundle.json…`})});if(a)return(0,y.jsx)(p,{children:(0,y.jsx)(`p`,{className:`m-0 text-[13px] text-red-700`,children:`Could not load bundle.json.`})});if(!E)return(0,y.jsx)(p,{children:(0,y.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`No app found with api_name`,` `,(0,y.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:e}),`.`]})});if(D.length===0)return(0,y.jsx)(p,{children:(0,y.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:`This app has no automation code steps.`})});if(!O)return(0,y.jsx)(p,{children:(0,y.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`Step not found: `,(0,y.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:t}),`.`]})});let k=async()=>{s(!0),h(null);try{let t={script:O.script,scriptRuntime:O.script_runtime,inputs:_},n=w===`remote`?{...t,mode:`remote`,inputTypes:Object.fromEntries(O.inputs.map(e=>[e.name,e.data_type])),outputTypes:Object.fromEntries(O.outputs.map(e=>[e.name,e.data_type])),secretNames:O.secrets.map(t=>`${e??``}__${t}`)}:{...t,secrets:Object.fromEntries(O.secrets.map(t=>[`${e??``}__${t}`,x[t]??``]))};h(await(await fetch(`/api/execute-step`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)})).json())}catch(e){h({success:!1,outputValues:{},logs:[],stdout:``,stderr:``,error:e instanceof Error?e.message:String(e),exitCode:1,durationMs:0})}finally{s(!1)}};return(0,y.jsxs)(`div`,{className:`space-y-4`,children:[(0,y.jsxs)(p,{children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,y.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Code Step`}),(0,y.jsx)(`select`,{value:O.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:D.map(e=>(0,y.jsx)(`option`,{value:e.action_step_api_name,children:e.name},e.action_step_api_name))}),(0,y.jsx)(`div`,{className:`flex-1`}),(0,y.jsx)(`span`,{className:`rounded bg-blue-50 px-1.5 py-0.5 text-[10px] font-semibold text-blue-600`,children:O.script_runtime})]}),O.overall_description&&(0,y.jsx)(`p`,{className:`mt-2 text-[12px] text-neutral-500`,children:O.overall_description})]}),O.inputs.length>0&&(0,y.jsxs)(p,{children:[(0,y.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Inputs`}),(0,y.jsx)(`div`,{className:`space-y-3`,children:O.inputs.map(e=>(0,y.jsxs)(`div`,{children:[(0,y.jsxs)(`label`,{className:`mb-1 block text-[12px] text-neutral-700`,children:[e.label,e.required&&(0,y.jsx)(`span`,{className:`ml-0.5 text-red-500`,children:`*`})]}),(0,y.jsx)(`input`,{type:`text`,value:_[e.name]??``,onChange:t=>{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,y.jsx)(`div`,{className:`mt-0.5 font-mono text-[10px] text-neutral-400`,children:e.name})]},e.name))})]}),O.secrets.length>0&&(0,y.jsxs)(p,{children:[(0,y.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Secrets`}),(0,y.jsx)(`div`,{className:`space-y-3`,children:O.secrets.map(e=>(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`label`,{className:`mb-1 block text-[12px] text-neutral-700`,children:e}),(0,y.jsx)(`input`,{type:`password`,value:x[e]??``,onChange:t=>{C({...x,[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,y.jsx)(b,{code:O.script,language:`python`,onRun:()=>void k(),isRunning:o,executionMode:w,onModeChange:T}),c&&(0,y.jsx)(S,{result:c})]})};export{C 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{t as p}from"./Card-DMz6T3VL.js";import{t as m}from"./useLocalStorage-BlZWItfY.js";var h=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,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}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=$})),g=e(s(),1),_=e(h()).default;function v(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 y=n();_.registerLanguage(`python`,v);var b=({code:e,language:t=`python`,onRun:n,isRunning:a=!1,executionMode:o,onModeChange:s})=>{let l=(0,g.useMemo)(()=>_.highlight(e,{language:t}).value.split(`
|
|
4
|
-
`),[e,t]);return(0,y.jsxs)(`div`,{className:`overflow-hidden rounded-lg border border-black/10 bg-white`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-black/10 bg-neutral-50 px-4 py-2`,children:[(0,y.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:t}),(0,y.jsx)(`div`,{className:`flex-1`}),o&&s&&(0,y.jsx)(`div`,{className:`flex overflow-hidden rounded border border-black/10 text-[11px] font-medium`,children:[`local`,`remote`].map(e=>(0,y.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,y.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,y.jsx)(c,{icon:a?i:r,className:a?`animate-spin`:``}),(0,y.jsx)(`span`,{children:a?`Running…`:`Run`})]})]}),(0,y.jsxs)(`div`,{className:`flex overflow-auto bg-white font-mono text-[13px] leading-[20px]`,children:[(0,y.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,y.jsx)(`div`,{children:String(t+1)},t))}),(0,y.jsx)(`div`,{className:`flex-1 overflow-auto py-3 pl-4 pr-4`,children:l.map((e,t)=>(0,y.jsx)(`div`,{className:`hljs whitespace-pre`,dangerouslySetInnerHTML:{__html:e||`\xA0`}},t))})]})]})},x=({title:e,defaultOpen:t=!1,children:n})=>{let[r,i]=(0,g.useState)(t);return(0,y.jsxs)(`div`,{children:[(0,y.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,y.jsx)(c,{icon:r?o:a,className:`w-2.5`}),e]}),r&&(0,y.jsx)(`div`,{className:`pb-2`,children:n})]})},S=({result:e})=>{let t=Object.entries(e.outputValues);return(0,y.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-black/10 bg-white p-4`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.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,y.jsxs)(`span`,{className:`text-[11px] text-neutral-400`,children:[String(e.durationMs),`ms`]}),e.exitCode!==0&&(0,y.jsxs)(`span`,{className:`text-[11px] text-neutral-400`,children:[`exit code `,String(e.exitCode)]})]}),e.error&&(0,y.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,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`mb-1 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Outputs`}),(0,y.jsx)(`div`,{className:`divide-y divide-black/5`,children:t.map(([e,t])=>(0,y.jsxs)(`div`,{className:`flex items-start gap-2 py-1.5`,children:[(0,y.jsx)(`span`,{className:`shrink-0 font-mono text-[12px] text-neutral-600`,children:e}),(0,y.jsx)(`span`,{className:`text-[11px] text-neutral-300`,children:`=`}),(0,y.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,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`mb-1 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Logs`}),(0,y.jsx)(`div`,{className:`space-y-0.5`,children:e.logs.map((e,t)=>(0,y.jsx)(`div`,{className:`font-mono text-[12px] text-neutral-600`,children:e},t))})]}),e.stdout&&(0,y.jsx)(x,{title:`Stdout`,children:(0,y.jsx)(`pre`,{className:`overflow-auto rounded bg-neutral-50 p-3 font-mono text-[12px] text-neutral-700`,children:e.stdout})}),e.stderr&&(0,y.jsx)(x,{title:`Stderr`,children:(0,y.jsx)(`pre`,{className:`overflow-auto rounded bg-neutral-50 p-3 font-mono text-[12px] text-neutral-700`,children:e.stderr})})]})},C=()=>{let{apiName:e,stepApiName:t}=u({strict:!1}),n=l(),{data:r,isLoading:i,isError:a}=d(f),[o,s]=(0,g.useState)(!1),[c,h]=(0,g.useState)(null),[_,v]=m(`kizen-step-inputs:${e??``}:${t??``}`,{}),[x,C]=m(`kizen-step-secrets:${e??``}:${t??``}`,{}),[w,T]=m(`kizen-code-runner-mode`,`local`);useCredentials();let[E,D]=(0,g.useState)(!1);useCallback(e=>{navigator.clipboard.writeText(e).then(()=>{D(!0),setTimeout(()=>D(!1),1500)})},[]);let O=r?.find(t=>t.api_name===e),k=(0,g.useMemo)(()=>O?.artifacts.automation_action_configs??[],[O]),A=k.find(e=>e.action_step_api_name===t)??k[0];if((0,g.useEffect)(()=>{if(!t&&k.length>0&&e){let t=k[0];t&&n({to:`/$apiName/code-steps/$stepApiName`,params:{apiName:e,stepApiName:t.action_step_api_name},replace:!0})}},[t,k,e,n]),(0,g.useEffect)(()=>{h(null)},[t]),i)return(0,y.jsx)(p,{children:(0,y.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-400`,children:`Fetching bundle.json…`})});if(a)return(0,y.jsx)(p,{children:(0,y.jsx)(`p`,{className:`m-0 text-[13px] text-red-700`,children:`Could not load bundle.json.`})});if(!O)return(0,y.jsx)(p,{children:(0,y.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`No app found with api_name`,` `,(0,y.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:e}),`.`]})});if(k.length===0)return(0,y.jsx)(p,{children:(0,y.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:`This app has no automation code steps.`})});if(!A)return(0,y.jsx)(p,{children:(0,y.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`Step not found: `,(0,y.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:t}),`.`]})});let j=async()=>{s(!0),h(null),console.log(Object.fromEntries(A.secrets.map(t=>[`${e??``}__${t}`,x[t]??``])));try{let t={script:A.script,scriptRuntime:A.script_runtime,inputs:_},n=w===`remote`?{...t,mode:`remote`,inputTypes:Object.fromEntries(A.inputs.map(e=>[e.name,e.data_type])),outputTypes:Object.fromEntries(A.outputs.map(e=>[e.name,e.data_type])),secretNames:A.secrets.map(t=>`${e??``}__${t}`)}:{...t,secrets:Object.fromEntries(A.secrets.map(t=>[`${e??``}__${t}`,x[t]??``]))};h(await(await fetch(`/api/execute-step`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)})).json())}catch(e){h({success:!1,outputValues:{},logs:[],stdout:``,stderr:``,error:e instanceof Error?e.message:String(e),exitCode:1,durationMs:0})}finally{s(!1)}};return(0,y.jsxs)(`div`,{className:`space-y-4`,children:[(0,y.jsxs)(p,{children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,y.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Code Step`}),(0,y.jsx)(`select`,{value:A.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:k.map(e=>(0,y.jsx)(`option`,{value:e.action_step_api_name,children:e.name},e.action_step_api_name))}),(0,y.jsx)(`div`,{className:`flex-1`}),(0,y.jsx)(`span`,{className:`rounded bg-blue-50 px-1.5 py-0.5 text-[10px] font-semibold text-blue-600`,children:A.script_runtime})]}),A.overall_description&&(0,y.jsx)(`p`,{className:`mt-2 text-[12px] text-neutral-500`,children:A.overall_description})]}),A.inputs.length>0&&(0,y.jsxs)(p,{children:[(0,y.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Inputs`}),(0,y.jsx)(`div`,{className:`space-y-3`,children:A.inputs.map(e=>(0,y.jsxs)(`div`,{children:[(0,y.jsxs)(`label`,{className:`mb-1 block text-[12px] text-neutral-700`,children:[e.label,e.required&&(0,y.jsx)(`span`,{className:`ml-0.5 text-red-500`,children:`*`})]}),(0,y.jsx)(`input`,{type:`text`,value:_[e.name]??``,onChange:t=>{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,y.jsx)(`div`,{className:`mt-0.5 font-mono text-[10px] text-neutral-400`,children:e.name})]},e.name))})]}),A.secrets.length>0&&(0,y.jsxs)(p,{children:[(0,y.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Secrets`}),(0,y.jsx)(`div`,{className:`space-y-3`,children:A.secrets.map(e=>(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`label`,{className:`mb-1 block text-[12px] text-neutral-700`,children:e}),(0,y.jsx)(`input`,{type:`password`,value:x[e]??``,onChange:t=>{C({...x,[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,y.jsx)(b,{code:A.script,language:`python`,onRun:()=>void j(),isRunning:o,executionMode:w,onModeChange:T}),c&&(0,y.jsx)(S,{result:c})]})};export{C 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{t as p}from"./Card-DMz6T3VL.js";import{t as m}from"./useLocalStorage-BlZWItfY.js";var h=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,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}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=$})),g=e(s(),1),_=e(h()).default;function v(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 y=n();_.registerLanguage(`python`,v);var b=({code:e,language:t=`python`,onRun:n,isRunning:a=!1,executionMode:o,onModeChange:s})=>{let l=(0,g.useMemo)(()=>_.highlight(e,{language:t}).value.split(`
|
|
4
|
-
`),[e,t]);return(0,y.jsxs)(`div`,{className:`overflow-hidden rounded-lg border border-black/10 bg-white`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-black/10 bg-neutral-50 px-4 py-2`,children:[(0,y.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:t}),(0,y.jsx)(`div`,{className:`flex-1`}),o&&s&&(0,y.jsx)(`div`,{className:`flex overflow-hidden rounded border border-black/10 text-[11px] font-medium`,children:[`local`,`remote`].map(e=>(0,y.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,y.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,y.jsx)(c,{icon:a?i:r,className:a?`animate-spin`:``}),(0,y.jsx)(`span`,{children:a?`Running…`:`Run`})]})]}),(0,y.jsxs)(`div`,{className:`flex overflow-auto bg-white font-mono text-[13px] leading-[20px]`,children:[(0,y.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,y.jsx)(`div`,{children:String(t+1)},t))}),(0,y.jsx)(`div`,{className:`flex-1 overflow-auto py-3 pl-4 pr-4`,children:l.map((e,t)=>(0,y.jsx)(`div`,{className:`hljs whitespace-pre`,dangerouslySetInnerHTML:{__html:e||`\xA0`}},t))})]})]})},x=({title:e,defaultOpen:t=!1,children:n})=>{let[r,i]=(0,g.useState)(t);return(0,y.jsxs)(`div`,{children:[(0,y.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,y.jsx)(c,{icon:r?o:a,className:`w-2.5`}),e]}),r&&(0,y.jsx)(`div`,{className:`pb-2`,children:n})]})},S=({result:e})=>{let t=Object.entries(e.outputValues);return(0,y.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-black/10 bg-white p-4`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.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,y.jsxs)(`span`,{className:`text-[11px] text-neutral-400`,children:[String(e.durationMs),`ms`]}),e.exitCode!==0&&(0,y.jsxs)(`span`,{className:`text-[11px] text-neutral-400`,children:[`exit code `,String(e.exitCode)]})]}),e.error&&(0,y.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,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`mb-1 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Outputs`}),(0,y.jsx)(`div`,{className:`divide-y divide-black/5`,children:t.map(([e,t])=>(0,y.jsxs)(`div`,{className:`flex items-start gap-2 py-1.5`,children:[(0,y.jsx)(`span`,{className:`shrink-0 font-mono text-[12px] text-neutral-600`,children:e}),(0,y.jsx)(`span`,{className:`text-[11px] text-neutral-300`,children:`=`}),(0,y.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,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`mb-1 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Logs`}),(0,y.jsx)(`div`,{className:`space-y-0.5`,children:e.logs.map((e,t)=>(0,y.jsx)(`div`,{className:`font-mono text-[12px] text-neutral-600`,children:e},t))})]}),e.stdout&&(0,y.jsx)(x,{title:`Stdout`,children:(0,y.jsx)(`pre`,{className:`overflow-auto rounded bg-neutral-50 p-3 font-mono text-[12px] text-neutral-700`,children:e.stdout})}),e.stderr&&(0,y.jsx)(x,{title:`Stderr`,children:(0,y.jsx)(`pre`,{className:`overflow-auto rounded bg-neutral-50 p-3 font-mono text-[12px] text-neutral-700`,children:e.stderr})})]})},C=()=>{let{apiName:e,stepApiName:t}=u({strict:!1}),n=l(),{data:r,isLoading:i,isError:a}=d(f),[o,s]=(0,g.useState)(!1),[c,h]=(0,g.useState)(null),[_,v]=m(`kizen-step-inputs:${e??``}:${t??``}`,{}),[x,C]=m(`kizen-step-secrets:${e??``}:${t??``}`,{}),[w,T]=m(`kizen-code-runner-mode`,`local`),E=r?.find(t=>t.api_name===e),D=(0,g.useMemo)(()=>E?.artifacts.automation_action_configs??[],[E]),O=D.find(e=>e.action_step_api_name===t)??D[0];if((0,g.useEffect)(()=>{if(!t&&D.length>0&&e){let t=D[0];t&&n({to:`/$apiName/code-steps/$stepApiName`,params:{apiName:e,stepApiName:t.action_step_api_name},replace:!0})}},[t,D,e,n]),(0,g.useEffect)(()=>{h(null)},[t]),i)return(0,y.jsx)(p,{children:(0,y.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-400`,children:`Fetching bundle.json…`})});if(a)return(0,y.jsx)(p,{children:(0,y.jsx)(`p`,{className:`m-0 text-[13px] text-red-700`,children:`Could not load bundle.json.`})});if(!E)return(0,y.jsx)(p,{children:(0,y.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`No app found with api_name`,` `,(0,y.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:e}),`.`]})});if(D.length===0)return(0,y.jsx)(p,{children:(0,y.jsx)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:`This app has no automation code steps.`})});if(!O)return(0,y.jsx)(p,{children:(0,y.jsxs)(`p`,{className:`m-0 text-[13px] text-neutral-500`,children:[`Step not found: `,(0,y.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5`,children:t}),`.`]})});let k=async()=>{s(!0),h(null);try{let t={script:O.script,scriptRuntime:O.script_runtime,inputs:_},n=w===`remote`?{...t,mode:`remote`,inputTypes:Object.fromEntries(O.inputs.map(e=>[e.name,e.data_type])),outputTypes:Object.fromEntries(O.outputs.map(e=>[e.name,e.data_type])),secretNames:O.secrets.map(t=>`${e??``}__${t}`)}:{...t,secrets:Object.fromEntries(O.secrets.map(t=>[`${e??``}__${t}`,x[t]??``]))};h(await(await fetch(`/api/execute-step`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)})).json())}catch(e){h({success:!1,outputValues:{},logs:[],stdout:``,stderr:``,error:e instanceof Error?e.message:String(e),exitCode:1,durationMs:0})}finally{s(!1)}};return(0,y.jsxs)(`div`,{className:`space-y-4`,children:[(0,y.jsxs)(p,{children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,y.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Code Step`}),(0,y.jsx)(`select`,{value:O.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:D.map(e=>(0,y.jsx)(`option`,{value:e.action_step_api_name,children:e.name},e.action_step_api_name))}),(0,y.jsx)(`div`,{className:`flex-1`}),(0,y.jsx)(`span`,{className:`rounded bg-blue-50 px-1.5 py-0.5 text-[10px] font-semibold text-blue-600`,children:O.script_runtime})]}),O.overall_description&&(0,y.jsx)(`p`,{className:`mt-2 text-[12px] text-neutral-500`,children:O.overall_description})]}),O.inputs.length>0&&(0,y.jsxs)(p,{children:[(0,y.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Inputs`}),(0,y.jsx)(`div`,{className:`space-y-3`,children:O.inputs.map(e=>(0,y.jsxs)(`div`,{children:[(0,y.jsxs)(`label`,{className:`mb-1 block text-[12px] text-neutral-700`,children:[e.label,e.required&&(0,y.jsx)(`span`,{className:`ml-0.5 text-red-500`,children:`*`})]}),(0,y.jsx)(`input`,{type:`text`,value:_[e.name]??``,onChange:t=>{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,y.jsx)(`div`,{className:`mt-0.5 font-mono text-[10px] text-neutral-400`,children:e.name})]},e.name))})]}),O.secrets.length>0&&(0,y.jsxs)(p,{children:[(0,y.jsx)(`div`,{className:`mb-3 text-[11px] font-semibold uppercase tracking-widest text-neutral-400`,children:`Secrets`}),(0,y.jsx)(`div`,{className:`space-y-3`,children:O.secrets.map(e=>(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`label`,{className:`mb-1 block text-[12px] text-neutral-700`,children:e}),(0,y.jsx)(`input`,{type:`password`,value:x[e]??``,onChange:t=>{C({...x,[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,y.jsx)(b,{code:O.script,language:`python`,onRun:()=>void k(),isRunning:o,executionMode:w,onModeChange:T}),c&&(0,y.jsx)(S,{result:c})]})};export{C as CodeStepsPage};
|