@inkeep/open-knowledge 0.9.0-beta.4 → 0.9.0-beta.5
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/dist/assets/skills/discovery/SKILL.md +1 -1
- package/dist/assets/skills/project/SKILL.md +1 -1
- package/dist/cli.mjs +5 -5
- package/dist/constants-Bz06c8hN.mjs +2 -0
- package/dist/{dist-BXBvUD1t.mjs → dist-BkOSFGR2.mjs} +2 -2
- package/dist/{dist-Ck52TFc0.mjs → dist-CcwJUIV6.mjs} +1 -1
- package/dist/{gh-detect-D7VnGgqQ.mjs → gh-detect-CXkelKVd.mjs} +2 -2
- package/dist/index.mjs +1 -1
- package/dist/{init-DY0Tg0Hn.mjs → init-DwLGKHOJ.mjs} +4 -4
- package/dist/init-jTViq3OZ.mjs +1 -0
- package/dist/loader-B0gRV8ky.mjs +1 -0
- package/dist/{loader-CT-f0ckE.mjs → loader-DwAApXf7.mjs} +2 -2
- package/dist/{preview-CGN29pIo.mjs → preview-DQUlTvw4.mjs} +2 -2
- package/dist/preview-le3hO-Wh.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-23W6IyBi.js → ActivityModeContent-DJXpiZd9.js} +1 -1
- package/dist/public/assets/{DocumentContext-SHvJNWIX.js → DocumentContext-DTuvLW_x.js} +3 -3
- package/dist/public/assets/{GraphPanel-DVJ6eGSP.js → GraphPanel-CkyBCnW-.js} +1 -1
- package/dist/public/assets/{SettingsDialogBody-DZKro5Ny.js → SettingsDialogBody-BaPvetlg.js} +2 -2
- package/dist/public/assets/SourceEditor-B1_Gixe_.js +2 -0
- package/dist/public/assets/{config-validation-events-D8972EJ5.js → config-validation-events-BL3EPRrw.js} +5 -5
- package/dist/public/assets/index-D1S1GyyV.js +1914 -0
- package/dist/public/assets/{index-D77KFmom.css → index-D4TqB27u.css} +1 -1
- package/dist/public/assets/{prop-types-cyYYFQkG.js → prop-types-CMBUMzzz.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-DAk_BTjV.js → target-navigation-intent-DK3GQaQx.js} +1 -1
- package/dist/public/assets/{toggle-group-niHrqjkN.js → toggle-group-Dx4VUJtk.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-ujD0pffB.js → typing-burst-detector-BC-nkePC.js} +2 -2
- package/dist/public/index.html +8 -8
- package/dist/{repair-launch-json-BYRMkqp3.mjs → repair-launch-json-vIRa-3co.mjs} +2 -2
- package/dist/{repair-mcp-configs-BwHZViW-.mjs → repair-mcp-configs-Dlc--ykk.mjs} +2 -2
- package/dist/repair-skills-9sqdgFxP.mjs +1 -0
- package/dist/{repair-skills-Cm2uNESR.mjs → repair-skills-B2NKABTJ.mjs} +2 -2
- package/dist/{src-BDiegEyp.mjs → src-iCrNc821.mjs} +2 -2
- package/dist/{start-CcdbaFqg.mjs → start-7ediTKw1.mjs} +2 -2
- package/dist/start-DLG9QOtB.mjs +1 -0
- package/dist/{write-project-skill-G5GcPARq.mjs → write-project-skill-Dol4FEz9.mjs} +2 -2
- package/package.json +1 -1
- package/dist/constants-BM8w0hds.mjs +0 -2
- package/dist/init-g5qA1EwQ.mjs +0 -1
- package/dist/loader-B2727ILW.mjs +0 -1
- package/dist/preview-ByuVOyc1.mjs +0 -1
- package/dist/public/assets/SourceEditor-AKMYQzoN.js +0 -2
- package/dist/public/assets/index-DzW0JF0b.js +0 -1914
- package/dist/repair-skills-cKMnX9L9.mjs +0 -1
- package/dist/start-BH8M2iSB.mjs +0 -1
|
@@ -461,7 +461,7 @@ Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#pl
|
|
|
461
461
|
`)}function _0(e,t,n,r){let i=t=>f0(g0(e,t,n),r)<=a0;if(i(t))return t;let a=0,o=t.length;for(;a<o;){let e=Math.ceil((a+o)/2);i(t.slice(0,e).trimEnd()+c0)?a=e:o=e-1}let s=t.slice(0,a).trimEnd();return s===``?``:s+c0}function v0(e){let t=t0(e.relativePath),n=h0(t,e.instruction,e.selectionMarkdown);return f0(n,e.target)<=a0?n:g0(t,_0(t,e.instruction,e.selectionMarkdown,e.target),e.selectionMarkdown)}var y0=j().refine(e=>!e.includes(`..`)&&!e.startsWith(`/`)&&!e.includes(`\0`)&&!e.includes(`\\`),{message:`docName contains unsafe path characters`}).optional(),b0={agentId:j().optional(),agentName:j().optional(),colorSeed:j().optional(),clientName:j().optional(),clientVersion:j().optional(),label:j().optional()},x0=j().optional(),S0=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;P({docPath:j().min(1)}).loose();var C0=F([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`]),w0=eo(`ok`,[P({ok:I(!0),shareUrl:j().min(1),blobUrl:j().min(1),branch:j().min(1)}).loose(),P({ok:I(!1),error:C0,branch:j().min(1).optional()}).loose()]),T0=F([`user`,`org`]),E0=P({login:j().min(1),kind:T0,avatarUrl:j().optional()}).loose(),D0=F([`auth-required`,`network`]),O0=eo(`ok`,[P({ok:I(!0),owners:N(E0)}).loose(),P({ok:I(!1),error:D0}).loose()]),k0=eo(`ok`,[P({ok:I(!0),available:Va()}).loose(),P({ok:I(!1),error:D0}).loose()]),A0=F([`public`,`private`]);P({owner:j().min(1),name:j().min(1),visibility:A0,description:j().optional()}).loose();var j0=F([`name-conflict`,`saml-sso`,`auth-required`,`push-failed`,`init-failed`,`network`,`no-project`]),M0=eo(`ok`,[P({ok:I(!0),ownerLogin:j().min(1),repoName:j().min(1),cloneUrl:j().min(1),defaultBranch:j().min(1)}).loose(),P({ok:I(!1),error:j0}).loose()]);function N0(e){return!(typeof e!=`string`||e.length===0||e.startsWith(`-`)||/[\x00-\x1F\x7F]/.test(e)||/\s/.test(e)||e.includes(`:`)||e.split(`/`).includes(`..`))}var P0=e=>e.refine(N0,`invalid branch name`),F0={shareFileExists:Va(),dirtyConflicts:P({conflicts:Va(),files:N(j().min(1))}).loose(),branchIsLocal:Va()};eo(`detached`,[P({detached:I(!1),currentBranch:j().min(1).nullable(),currentHeadSha:Ua(),...F0}).loose(),P({detached:I(!0),currentBranch:Ua(),currentHeadSha:j().min(1),...F0}).loose()]),P({branch:P0(j().min(1)),principalId:j().optional()}).loose();var I0=F([`dirty-conflict`,`branch-not-found`,`fetch-failed`,`checkout-failed`,`branch-in-other-worktree`]);eo(`ok`,[P({ok:I(!0)}).loose(),P({ok:I(!1),reason:I0,files:N(j().min(1)).optional(),otherWorktreePath:j().min(1).optional()}).loose()]);var L0=P({serverInstanceId:j().min(1),currentBranch:j().min(1).optional(),currentDiskAckSVs:io(j().min(1),j().min(1)).optional()}).loose(),R0=P({id:j().min(1),display_name:j().min(1),display_email:j(),source:F([`git-config`,`synthesized`]),created_at:j().min(1)}).loose(),z0=P({type:F(`urn:ok:error:malformed-upload.urn:ok:error:collision-exhaustion.urn:ok:error:storage-full.urn:ok:error:storage-readonly.urn:ok:error:storage-error.urn:ok:error:no-file-received.urn:ok:error:path-escape.urn:ok:error:method-not-allowed.urn:ok:error:invalid-request.urn:ok:error:payload-too-large.urn:ok:error:request-timeout.urn:ok:error:internal-server-error.urn:ok:error:loopback-required.urn:ok:error:invalid-origin.urn:ok:error:url-not-allowed.urn:ok:error:dir-outside-home.urn:ok:error:concurrent-operation.urn:ok:error:clone-failed.urn:ok:error:clone-timeout.urn:ok:error:server-start-failed.urn:ok:error:reserved-doc-name.urn:ok:error:target-not-found.urn:ok:error:stale-target.urn:ok:error:frontmatter-edit-not-supported.urn:ok:error:invalid-frontmatter-patch.urn:ok:error:frontmatter-malformed.urn:ok:error:no-active-session.urn:ok:error:too-many-agent-sessions.urn:ok:error:doc-not-found.urn:ok:error:doc-already-exists.urn:ok:error:doc-not-open.urn:ok:error:rollback-not-configured.urn:ok:error:doc-not-available.urn:ok:error:backlink-index-not-configured.urn:ok:error:file-rescan-not-configured.urn:ok:error:shadow-not-configured.urn:ok:error:host-not-allowed.urn:ok:error:principal-not-available.urn:ok:error:not-found.urn:ok:error:auth-failed.urn:ok:error:no-project-dir.urn:ok:error:server-open-failed.urn:ok:error:doc-in-conflict.urn:ok:error:no-conflict-tracked.urn:ok:error:sync-not-active.urn:ok:error:project-repo-not-configured.urn:ok:error:seed-prerequisite-missing.urn:ok:error:seed-invalid-root.urn:ok:error:tag-index-not-configured.urn:ok:error:template-not-found.urn:ok:error:unsupported-asset-type.urn:ok:error:asset-not-found.urn:ok:error:collab-server-not-running.urn:ok:error:gateway-timeout.urn:ok:error:cursor-not-installed.urn:ok:error:cursor-spawn-timeout.urn:ok:error:cursor-spawn-failed.urn:ok:error:handoff-target-not-installed.urn:ok:error:handoff-spawn-timeout.urn:ok:error:handoff-spawn-failed`.split(`.`)),title:j().min(1),status:M().int().min(400).max(599),instance:j().regex(S0,`instance must be urn:uuid:<uuid>`).optional(),detail:j().optional()}).loose();P({parentDocName:j().min(1),agentId:j().min(1).optional(),agentName:j().min(1).optional()}).loose();var B0=P({src:j().min(1),path:j().min(1).optional(),deduped:Va().optional()}).loose();P({url:j().min(1),dir:j().min(1),branch:j().min(1).refine(N0,`invalid branch name`).optional()}).loose(),P({type:I(`error`),problem:z0}).loose();function V0(e){return`https://claude.ai/new?q=${encodeURIComponent(e)}`}var H0=/notionvc:/i,U0=()=>e=>{W0(e)&&(G0(e),K0(e))};function W0(e){if(!(`children`in e)||!Array.isArray(e.children))return!1;for(let t of e.children){if(t.type===`comment`){let e=String(t.value??``);if(H0.test(e))return!0}if(t.type===`element`&&W0(t))return!0}return!1}function G0(e){if(!(`children`in e)||!Array.isArray(e.children))return;for(let t of e.children)t.type===`element`&&G0(t);let t=[];for(let n of e.children){if(n.type!==`text`){t.push(n);continue}let e=String(n.value??``);if(!e.includes(`
|
|
462
462
|
`)){t.push(n);continue}let r=e.split(`
|
|
463
463
|
`);for(let e=0;e<r.length;e++)r[e]&&t.push({type:`text`,value:r[e]??``}),e<r.length-1&&t.push({type:`element`,tagName:`br`,properties:{},children:[]})}e.children=t}function K0(e){if(!(!(`children`in e)||!Array.isArray(e.children))){e.children=e.children.filter(e=>e.type===`comment`?!H0.test(String(e.value??``)):!0);for(let t of e.children)t.type===`element`&&K0(t)}}var q0=new Set([`Apple-tab-span`,`Apple-converted-space`,`Apple-style-span`]),J0=()=>e=>{Y0(e)};function Y0(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&Y0(t);e.children=e.children.flatMap(e=>{if(e.type!==`element`)return[e];let t=e;return X0(t)?[]:Z0(t)?t.children:[t]})}}function X0(e){if(e.tagName!==`meta`)return!1;let t=e.properties?.name,n=e.properties?.content;return t===`Generator`&&typeof n==`string`&&/Cocoa/i.test(n)}function Z0(e){if(e.tagName!==`span`)return!1;let t=e.properties?.className;return Array.isArray(t)?t.length>0&&t.every(e=>q0.has(String(e))):!1}var Q0=`docs-internal-guid-`;function $0(e,t){let n=e.children[t];!n||n.type!==`element`||e.children.splice(t,1,...n.children)}var e2=()=>e=>{t2(e)};function t2(e){if(!(`children`in e)||!Array.isArray(e.children))return;for(let t of e.children)t.type===`element`&&t2(t);let t=0;for(;t<e.children.length;){let n=e.children[t];if(!n||n.type!==`element`){t++;continue}let r=n;if(n2(r)||r2(r)){$0(e,t);continue}t++}}function n2(e){if(e.tagName!==`b`)return!1;let t=e.properties?.id;return typeof t==`string`&&t.startsWith(Q0)}function r2(e){if(e.tagName!==`div`||e.properties?.dir!==`ltr`)return!1;let t=e.children.filter(e=>e.type===`element`);return t.length===1?t[0]?.tagName===`table`:!1}var i2=new Set([`commit-link`,`user-mention`,`team-mention`,`issue-link`]),a2=()=>e=>{o2(e)};function o2(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&o2(t);for(let t of e.children)t.type===`element`&&s2(t)}}function s2(e){if(!e.properties)return;for(let t of Object.keys(e.properties))t.startsWith(`dataHovercard`)&&delete e.properties[t];let t=e.properties.className;if(Array.isArray(t)){let n=t.filter(e=>!i2.has(String(e)));n.length===0?delete e.properties.className:e.properties.className=n}}var c2=/^gmail_/,l2=()=>e=>{u2(e)};function u2(e){if(!(`children`in e)||!Array.isArray(e.children))return;for(let t of e.children)t.type===`element`&&u2(t);let t=0;for(;t<e.children.length;){let n=e.children[t];if(n.type!==`element`){t++;continue}let r=n;if(r.tagName===`div`&&d2(r,`gmail_quote`)&&(r.tagName=`blockquote`),f2(r),p2(r)){e.children.splice(t,1,...r.children);continue}t++}}function d2(e,t){let n=e.properties?.className;return Array.isArray(n)?n.some(e=>String(e)===t):!1}function f2(e){let t=e.properties?.className;if(!Array.isArray(t))return;let n=t.filter(e=>!c2.test(String(e)));n.length===0?delete e.properties?.className:e.properties&&(e.properties.className=n)}function p2(e){if(e.tagName!==`div`||e.properties?.dir!==`ltr`)return!1;let t=e.properties?.className;return t!=null&&!(Array.isArray(t)&&t.length===0)?!1:e.children.filter(e=>e.type===`element`).length<=1}var m2=()=>e=>{h2(e)};function h2(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&h2(t);e.children=e.children.flatMap(e=>{if(e.type!==`element`)return[e];let t=e;return t.tagName===`google-sheets-html-origin`?t.children:t.tagName===`style`?[]:(g2(t),[t])})}}function g2(e){if(e.properties)for(let t of Object.keys(e.properties))t.startsWith(`dataSheets`)&&delete e.properties[t]}var _2=[`o:`,`w:`,`m:`,`v:`,`u1:`],v2=/^Mso[A-Z]/,y2=/^\s*\[if\s+[^\]]*\]/,b2=()=>e=>{x2(e)};function x2(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&x2(t);e.children=e.children.flatMap(e=>{if(e.type===`comment`){let t=String(e.value??``);return y2.test(t)?[]:[e]}if(e.type!==`element`)return[e];let t=e;return S2(t)?[]:(C2(t),[t])})}}function S2(e){return _2.some(t=>e.tagName.startsWith(t))}function C2(e){let t=e.properties;if(!t)return;let n=t.className;if(Array.isArray(n)){let e=n.filter(e=>typeof e==`string`&&!v2.test(e));e.length===0?delete t.className:t.className=e}else typeof n==`string`&&v2.test(n)&&delete t.className;let r=t.style;typeof r==`string`&&/mso-/i.test(r)&&delete t.style;for(let e of Object.keys(t))if(e.startsWith(`xmlns:`)){let n=e.slice(6);_2.some(e=>e===`${n}:`)&&delete t[e]}}var w2=/^c-(message_kit__|message__|compose|timestamp)/,T2=()=>e=>{E2(e)};function E2(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&E2(t);e.children=e.children.flatMap(e=>{if(e.type!==`element`)return[e];let t=e;return D2(t)?[]:(O2(t),[t])})}}function D2(e){let t=e.properties?.className;return Array.isArray(t)?t.some(e=>String(e)===`c-timestamp`||String(e).startsWith(`c-timestamp`)):!1}function O2(e){let t=e.properties?.className;if(!Array.isArray(t))return;let n=t.filter(e=>!w2.test(String(e)));n.length===0?delete e.properties?.className:e.properties&&(e.properties.className=n)}var k2=()=>e=>{A2(e)};function A2(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&A2(t);for(let t=0;t<e.children.length;t++){let n=e.children[t];if(n.type!==`element`)continue;let r=n;j2(r)&&(e.children[t]=N2(r))}}}function j2(e){if(e.tagName!==`div`)return!1;let t=e.children.filter(e=>e.type===`element`&&e.tagName===`div`);return t.length<2?!1:t.some(e=>M2(e))}function M2(e){for(let t of e.children){if(t.type!==`element`)continue;let e=t,n=e.properties?.style;if(typeof n==`string`&&/color\s*:/i.test(n)||M2(e))return!0}return!1}function N2(e){return{type:`element`,tagName:`pre`,properties:{},children:[{type:`element`,tagName:`code`,properties:{},children:[{type:`text`,value:e.children.filter(e=>e.type===`element`&&e.tagName===`div`).map(e=>P2(e)).join(`
|
|
464
|
-
`)}]}]}}function P2(e){let t=``;for(let n of e.children)n.type===`text`?t+=n.value??``:n.type===`element`&&(t+=P2(n));return t}var F2=class extends Error{htmlBytes;maxBytes;constructor(e,t){super(`HTML payload (${e} bytes) exceeds htmlToMdast ceiling (${t} bytes); falling through to plain text`),this.name=`HtmlPayloadTooLargeError`,this.htmlBytes=e,this.maxBytes=t}},I2=[e2,b2,J0,l2,U0,k2,m2,T2,a2];function L2(e){OP(e,e=>{e.type===`strong`?(e.data??={},e.data.sourceDelimiter=`**`):e.type===`emphasis`?(e.data??={},e.data.sourceDelimiter=`*`):e.type===`inlineCode`?(e.data??={},e.data.sourceFenceChar="`",e.data.sourceFenceLength=1):e.type===`code`&&(e.data??={},e.data.sourceFenceChar="`",e.data.sourceFenceLength=3)})}function R2(e,t){let n=t?.maxBytes??5242880;if(e.length>n)throw new F2(e.length,n);let r=bH().use(EN,{fragment:!0});for(let e of I2)r.use(e);for(let e of t?.additionalCleanupPlugins??[])r.use(e);r.use(DI);let i=r.parse(e),a=r.runSync(i);return L2(a),a}function z2(e){return String(bH().use(dH).use(fH).stringify(e))}function B2(e,t){let n=Array.isArray(e.attrs.attributes)?e.attrs.attributes.filter(e=>typeof e==`object`&&!!e&&`type`in e):[],r=e.attrs.props??{},i=new Map,a=new Set;if(t)for(let e of t)e.omitOnDefault===!0&&`defaultValue`in e&&e.defaultValue!==void 0&&i.set(e.name,e.defaultValue),e.type===`string`&&e.required===!1&&e.defaultValue===void 0&&a.add(e.name);for(let[e,t]of Object.entries(r)){let r=n.findIndex(t=>t.type===`mdxJsxAttribute`&&t.name===e);if(i.has(e)&&Object.is(i.get(e),t)){r>=0&&n.splice(r,1);continue}if(a.has(e)&&t===``){r>=0&&n.splice(r,1);continue}let o=V2(e,t);r>=0?n[r]=o:n.push(o)}return n}function V2(e,t){if(t===!0)return{type:`mdxJsxAttribute`,name:e,value:null};if(t===!1)return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:`false`}};if(t==null)return{type:`mdxJsxAttribute`,name:e,value:null};if(typeof t==`string`)return{type:`mdxJsxAttribute`,name:e,value:t};if(typeof t==`number`)return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:JSON.stringify(t)}};if(typeof t==`object`){let n;try{n=JSON.stringify(t)}catch{n=String(t)}return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:n}}}return{type:`mdxJsxAttribute`,name:e,value:String(t)}}function H2(e,t,n,r){return{type:`mdxJsxFlowElement`,name:e,attributes:B2(t,r),children:n.all(t),data:{}}}var U2=/^[A-Za-z0-9]{20,}$/,W2=/^(?:\d+s?|(?:\d+h)?(?:\d+m)?(?:\d+s)?)$/;function G2(e){let t=e.toLowerCase();return t===`loom.com`||t===`www.loom.com`}function K2(e){let t=e.pathname.match(/^\/(?:share|embed)\/([A-Za-z0-9]+)\/?$/);if(!t)return null;let n=t[1]??``;return U2.test(n)?n:null}function q2(e){if(typeof e!=`string`||e.length===0)return null;let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`||!G2(t.hostname))return null;let n=K2(t);if(!n)return null;let r=t.searchParams.get(`t`);return{id:n,startRaw:r&&r.length>0&&W2.test(r)?r:null}}function J2(e){return q2(e)!==null}function Y2(e){let t=e.toLowerCase();return t===`vimeo.com`||t===`www.vimeo.com`||t===`player.vimeo.com`}function X2(e){if(typeof e!=`string`||e.length===0)return!1;let t;try{t=new URL(e)}catch{return!1}return t.protocol!==`http:`&&t.protocol!==`https:`?!1:Y2(t.hostname)}var Z2=/^[A-Za-z0-9_-]{11}$/;function Q2(e){let t=e.toLowerCase();return t===`youtube.com`||t===`www.youtube.com`||t===`m.youtube.com`||t===`music.youtube.com`||t===`youtu.be`||t===`youtube-nocookie.com`||t===`www.youtube-nocookie.com`}function $2(e){if(e.length===0)return null;if(/^[0-9]+$/.test(e)){let t=Number.parseInt(e,10);return t>0?t:null}let t=e.match(/^(?:([0-9]+)h)?(?:([0-9]+)m)?(?:([0-9]+)s?)?$/);if(!t)return null;let n=t[1]?Number.parseInt(t[1],10):0,r=t[2]?Number.parseInt(t[2],10):0,i=t[3]?Number.parseInt(t[3],10):0,a=n*3600+r*60+i;return a>0?a:null}function e4(e){if(e.hostname.toLowerCase()===`youtu.be`){let t=e.pathname.replace(/^\//,``).split(`/`)[0]??``;return Z2.test(t)?t:null}if(e.pathname===`/watch`){let t=e.searchParams.get(`v`)??``;return Z2.test(t)?t:null}let t=e.pathname.match(/^\/(?:embed|shorts|v)\/([A-Za-z0-9_-]{11})\/?$/);return t?t[1]??null:null}function t4(e){if(typeof e!=`string`||e.length===0)return null;let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`||!Q2(t.hostname))return null;let n=e4(t);if(!n)return null;let r=t.searchParams.get(`t`)??t.searchParams.get(`start`)??``;return{id:n,startSeconds:r.length>0?$2(r):null,noCookie:t.hostname.toLowerCase().endsWith(`youtube-nocookie.com`)}}var n4=[{name:`type`,type:`enum`,enumValues:[`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`],defaultValue:`note`,required:!1,description:`Callout variant`},{name:`title`,type:`string`,required:!1,description:`Optional heading shown above the body`},{name:`icon`,type:`string`,required:!1,advanced:!0,description:"Custom lucide icon override (e.g. `lucide:Lightbulb`)"},{name:`color`,type:`string`,required:!1,advanced:!0,description:"Optional accent color override (hex — e.g. `#F05032`)"},{name:`collapsible`,type:`boolean`,required:!1,defaultValue:!1,advanced:!0,description:"Render as a foldable `<details>` (Obsidian `[!TYPE]+/-`)"},{name:`defaultOpen`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,description:`When collapsible, start in the open state`},{name:`children`,type:`reactnode`,required:!0,description:`Callout content`}],r4=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Image source URL`,accept:y$,autoFocus:!0},{name:`alt`,type:`string`,required:!0,description:`Alt text`},{name:`width`,type:`number`,required:!1,advanced:!0,description:`Image width`},{name:`height`,type:`number`,required:!1,advanced:!0,description:`Image height`},{name:`srcset`,type:`string`,required:!1,advanced:!0,description:`Responsive image candidate set (e.g. "x.png 1x, y.png 2x")`},{name:`sizes`,type:`string`,required:!1,advanced:!0,description:`Responsive image sizes hint paired with srcset`},{name:`loading`,type:`enum`,enumValues:[`eager`,`lazy`],defaultValue:`lazy`,required:!1,advanced:!0,omitOnDefault:!0,description:`Native img loading strategy (defaults to lazy)`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`decoding`,type:`enum`,enumValues:[`sync`,`async`,`auto`],defaultValue:`auto`,required:!1,advanced:!0,omitOnDefault:!0,description:`Hint for how the browser should decode the image`},{name:`fetchpriority`,type:`enum`,enumValues:[`high`,`low`,`auto`],defaultValue:`auto`,required:!1,advanced:!0,omitOnDefault:!0,description:`Resource fetch priority hint`},{name:`crossorigin`,type:`enum`,enumValues:[`anonymous`,`use-credentials`],required:!1,advanced:!0,description:`CORS mode for the image fetch`},{name:`referrerpolicy`,type:`string`,required:!1,advanced:!0,description:`Referrer policy for the image fetch (HTML referrerpolicy values)`},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`}],i4=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Embedded page URL (must start with http:// or https://)`,autoFocus:!0},{name:`title`,type:`string`,required:!1,description:`Iframe title (accessible label for screen readers)`},{name:`width`,type:`string`,required:!1,advanced:!0,description:`Embed width as a CSS length (e.g. "100%", "640px")`},{name:`height`,type:`string`,required:!1,advanced:!0,description:`Embed height as a CSS length (e.g. "26rem", "480px")`},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`}],a4=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Video source URL`,accept:b$,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 video controls (defaults to true)`,hideWhen:e=>typeof e.src==`string`&&(X2(e.src)||J2(e.src))},{name:`autoplay`,type:`boolean`,required:!1,advanced:!0,description:`Begin playback as soon as possible (usually requires muted)`},{name:`poster`,type:`string`,required:!1,advanced:!0,description:`Poster image URL shown before playback`,accept:y$,hideWhen:e=>typeof e.src==`string`&&(X2(e.src)||J2(e.src))},{name:`width`,type:`number`,required:!1,advanced:!0,description:`Video width`},{name:`height`,type:`number`,required:!1,advanced:!0,description:`Video height`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`muted`,type:`boolean`,required:!1,advanced:!0,description:`Mute audio on load`},{name:`loop`,type:`boolean`,required:!1,advanced:!0,description:`Restart from the beginning when playback ends`,hideWhen:e=>typeof e.src==`string`&&J2(e.src)},{name:`playsinline`,type:`boolean`,required:!1,advanced:!0,description:`Play inline on iOS rather than entering fullscreen`,hideWhen:e=>typeof e.src==`string`&&(X2(e.src)||J2(e.src))},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the video to preload`,hideWhen:e=>typeof e.src==`string`&&(t4(e.src)!==null||X2(e.src)||J2(e.src))}],o4=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Audio source URL`,accept:x$,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 audio controls (defaults to true)`},{name:`autoplay`,type:`boolean`,required:!1,advanced:!0,description:`Begin playback as soon as possible (usually requires muted)`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`muted`,type:`boolean`,required:!1,advanced:!0,description:`Mute audio on load`},{name:`loop`,type:`boolean`,required:!1,advanced:!0,description:`Restart from the beginning when playback ends`},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the audio to preload`}],s4=[{name:`title`,type:`string`,required:!0,description:`Accordion heading shown inside the <summary>`},{name:`defaultOpen`,type:`boolean`,required:!1,defaultValue:!1,description:`When true, the accordion renders expanded on initial load`},{name:`icon`,type:`string`,required:!1,advanced:!0,description:"Custom lucide icon override (e.g. `lucide:Rocket`)"},{name:`description`,type:`string`,required:!1,advanced:!0,description:`Optional subtitle rendered below the title inside <summary>`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#advanced-options`)"},{name:`name`,type:`string`,required:!1,advanced:!0,description:`HTML5 <details name=> group — siblings with the same name are mutually exclusive`}],c4=[n4[0],n4[1],n4[4],n4[5],n4[6]],l4=[r4[0],r4[1],r4[7]],u4=[s4[0],s4[1],s4[4],s4[5]],d4=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Alt text (Obsidian alias syntax: `![[file.png|alt text]]`)"}],f4=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[clip.mp4|title]]`)"}],p4=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[song.mp3|title]]`)"}],m4=[{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#install-tabs`)"}],h4=[{name:`label`,type:`string`,required:!0,autoFocus:!0,defaultValue:`Tab`,description:`Tab strip label — shown in the clickable pill at the top`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#tab-npm`)"}],g4=[{name:`formula`,type:`string`,required:!0,autoFocus:!0,language:`latex`,description:`LaTeX math source (rendered with KaTeX in the browser)`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#eq-pythagoras`)"},{name:`language`,type:`string`,required:!1,advanced:!0,description:"Forward-compat hint for the math source language (default `latex`). Reserved for future MathJax / Typst / AsciiMath substrates."}],_4=[g4[0]],v4=[g4[0]],y4=[{name:`chart`,type:`string`,required:!0,autoFocus:!0,language:`mermaid`,description:`Mermaid chart source (graph / flowchart / sequenceDiagram / class / state / etc.)`}],b4=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Display name override (Obsidian alias syntax: `![[file.zip|label]]`)"}],x4=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`File URL`,accept:[`*/*`],autoFocus:!0}],S4=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`PDF source URL`,accept:S$,autoFocus:!0},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Accessible label for the embedded PDF viewer`},{name:`anchor`,type:`string`,required:!1,advanced:!0,description:"PDF viewer parameters as a single URL-fragment string (e.g. `page=3&height=600`)"}],C4=[{name:`src`,type:`string`,required:!0,description:"Path of the source doc, extension-less (e.g. `api-spec`).",autoFocus:!0},{name:`anchor`,type:`string`,required:!0,description:"Id of the `<MirrorSource>` block within the source doc."}],w4=[{name:`id`,type:`string`,required:!0,description:"Stable id agents and authors use to reference this block from `<Mirror>` elsewhere.",autoFocus:!0},{name:`children`,type:`reactnode`,required:!0,description:`Block content this MirrorSource owns — paragraphs, callouts, code, nested JSX, anything.`}];function T4(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`)}function E4(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}function D4(e){let t=e.attrs.props,n=t?.target??``,r=typeof t?.alias==`string`&&t.alias.length>0?t.alias:null,i=typeof t?.anchor==`string`&&t.anchor.length>0?t.anchor:null,a=r??(i?`${n}#${i}`:n);return{type:`wikiLinkEmbed`,value:a,data:{target:n,anchor:i,alias:r},children:[{type:`text`,value:a}]}}var O4=[{name:`Callout`,surface:`canonical`,hasChildren:!0,props:n4,icon:`MessageSquareWarning`,category:`content`,displayName:`Callout`,description:`Alert / admonition with 15 type variants — 5 GFM (note, tip, important, warning, caution) plus 10 Obsidian-parity (abstract, info, todo, success, question, failure, danger, bug, example, quote)`,searchTerms:[`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`,`alert`,`admonition`,`callout`],serialize:(e,t)=>H2(`Callout`,e,t,n4)},{name:`img`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:r4,icon:`Image`,category:`media`,displayName:`Image`,description:`Image with click-to-zoom and HTML-native attributes`,searchTerms:[`image`,`zoom`,`picture`,`photo`],placeholder:{label:`Add an image`},serialize:(e,t)=>H2(`img`,e,t,r4)},{name:`video`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:a4,icon:`SquarePlay`,category:`media`,displayName:`Video`,description:`HTML5 video player with native controls`,searchTerms:[`video`,`media`,`player`,`mp4`,`webm`,`movie`],placeholder:{label:`Add a video`},serialize:(e,t)=>H2(`video`,e,t,a4)},{name:`audio`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:o4,icon:`Volume2`,category:`media`,displayName:`Audio`,description:`HTML5 audio player with native controls`,searchTerms:[`audio`,`sound`,`music`,`mp3`,`podcast`,`player`],placeholder:{label:`Add audio`},serialize:(e,t)=>H2(`audio`,e,t,o4)},{name:`Pdf`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:S4,icon:`FileText`,category:`media`,displayName:`PDF`,description:"Embedded PDF viewer (`#page=N` to open at page N, `#height=N` for viewer height)",searchTerms:[`pdf`,`document`,`embed`,`pdfjs`],placeholder:{label:`Add a PDF`},serialize:(e,t)=>H2(`Pdf`,e,t,S4)},{name:`File`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:x4,icon:`Paperclip`,category:`media`,displayName:`File`,description:`Downloadable file attachment — inline row with name + size + download link`,searchTerms:[`file`,`attachment`,`download`,`document`,`zip`,`docx`,`doc`],placeholder:{label:`Add a file`},serialize:(e,t)=>H2(`File`,e,t,x4)},{name:`Embed`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:i4,icon:`AppWindow`,category:`media`,displayName:`Embed`,description:`Inline web embed (iframe) — drop a URL, get a resizable preview pane`,searchTerms:[`embed`,`iframe`,`website`,`page`,`inline`,`frame`,`preview`],placeholder:{label:`Embed a URL`},serialize:(e,t)=>H2(`Embed`,e,t,i4)},{name:`Accordion`,surface:`canonical`,hasChildren:!0,props:s4,icon:`ChevronRight`,category:`content`,displayName:`Accordion`,description:"Standalone expand/collapse via native HTML5 <details>/<summary>. Group siblings with the `name` prop for exclusive-accordion UX.",searchTerms:[`toggle`,`accordion`,`expandable`,`details`,`disclosure`,`collapse`,`fold`],exampleBody:`Body content revealed when the accordion is expanded.`,serialize:(e,t)=>H2(`Accordion`,e,t,s4)},{name:`Tabs`,surface:`canonical`,hasChildren:!0,emptyChildName:`Tab`,props:m4,icon:`LayoutPanelTop`,category:`content`,displayName:`Tabs`,description:"Horizontal tab strip + active panel below. Each `<Tab>` child is one panel; clickable pills at the top switch the active one. Active selection is ephemeral (resets on reload).",searchTerms:[`tabs`,`tabbed`,`panels`,`tabgroup`,`switcher`],exampleBody:`<Tab label="One">Body of the first tab panel.</Tab>
|
|
464
|
+
`)}]}]}}function P2(e){let t=``;for(let n of e.children)n.type===`text`?t+=n.value??``:n.type===`element`&&(t+=P2(n));return t}var F2=class extends Error{htmlBytes;maxBytes;constructor(e,t){super(`HTML payload (${e} bytes) exceeds htmlToMdast ceiling (${t} bytes); falling through to plain text`),this.name=`HtmlPayloadTooLargeError`,this.htmlBytes=e,this.maxBytes=t}},I2=[e2,b2,J0,l2,U0,k2,m2,T2,a2];function L2(e){OP(e,e=>{e.type===`strong`?(e.data??={},e.data.sourceDelimiter=`**`):e.type===`emphasis`?(e.data??={},e.data.sourceDelimiter=`*`):e.type===`inlineCode`?(e.data??={},e.data.sourceFenceChar="`",e.data.sourceFenceLength=1):e.type===`code`&&(e.data??={},e.data.sourceFenceChar="`",e.data.sourceFenceLength=3)})}function R2(e,t){let n=t?.maxBytes??5242880;if(e.length>n)throw new F2(e.length,n);let r=bH().use(EN,{fragment:!0});for(let e of I2)r.use(e);for(let e of t?.additionalCleanupPlugins??[])r.use(e);r.use(DI);let i=r.parse(e),a=r.runSync(i);return L2(a),a}function z2(e){return String(bH().use(dH).use(fH).stringify(e))}function B2(e,t){let n=Array.isArray(e.attrs.attributes)?e.attrs.attributes.filter(e=>typeof e==`object`&&!!e&&`type`in e):[],r=e.attrs.props??{},i=new Map,a=new Set;if(t)for(let e of t)e.omitOnDefault===!0&&`defaultValue`in e&&e.defaultValue!==void 0&&i.set(e.name,e.defaultValue),e.type===`string`&&e.required===!1&&e.defaultValue===void 0&&a.add(e.name);for(let[e,t]of Object.entries(r)){let r=n.findIndex(t=>t.type===`mdxJsxAttribute`&&t.name===e);if(i.has(e)&&Object.is(i.get(e),t)){r>=0&&n.splice(r,1);continue}if(a.has(e)&&t===``){r>=0&&n.splice(r,1);continue}let o=V2(e,t);r>=0?n[r]=o:n.push(o)}return n}function V2(e,t){if(t===!0)return{type:`mdxJsxAttribute`,name:e,value:null};if(t===!1)return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:`false`}};if(t==null)return{type:`mdxJsxAttribute`,name:e,value:null};if(typeof t==`string`)return{type:`mdxJsxAttribute`,name:e,value:t};if(typeof t==`number`)return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:JSON.stringify(t)}};if(typeof t==`object`){let n;try{n=JSON.stringify(t)}catch{n=String(t)}return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:n}}}return{type:`mdxJsxAttribute`,name:e,value:String(t)}}function H2(e,t,n,r){return{type:`mdxJsxFlowElement`,name:e,attributes:B2(t,r),children:n.all(t),data:{}}}var U2=/^[A-Za-z0-9]{20,}$/,W2=/^(?:\d+s?|(?:\d+h)?(?:\d+m)?(?:\d+s)?)$/;function G2(e){let t=e.toLowerCase();return t===`loom.com`||t===`www.loom.com`}function K2(e){let t=e.pathname.match(/^\/(?:share|embed)\/([A-Za-z0-9]+)\/?$/);if(!t)return null;let n=t[1]??``;return U2.test(n)?n:null}function q2(e){if(typeof e!=`string`||e.length===0)return null;let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`||!G2(t.hostname))return null;let n=K2(t);if(!n)return null;let r=t.searchParams.get(`t`);return{id:n,startRaw:r&&r.length>0&&W2.test(r)?r:null}}function J2(e){return q2(e)!==null}function Y2(e){let t=e.toLowerCase();return t===`vimeo.com`||t===`www.vimeo.com`||t===`player.vimeo.com`}function X2(e){if(typeof e!=`string`||e.length===0)return!1;let t;try{t=new URL(e)}catch{return!1}return t.protocol!==`http:`&&t.protocol!==`https:`?!1:Y2(t.hostname)}var Z2=/^[A-Za-z0-9_-]{11}$/;function Q2(e){let t=e.toLowerCase();return t===`youtube.com`||t===`www.youtube.com`||t===`m.youtube.com`||t===`music.youtube.com`||t===`youtu.be`||t===`youtube-nocookie.com`||t===`www.youtube-nocookie.com`}function $2(e){if(e.length===0)return null;if(/^[0-9]+$/.test(e)){let t=Number.parseInt(e,10);return t>0?t:null}let t=e.match(/^(?:([0-9]+)h)?(?:([0-9]+)m)?(?:([0-9]+)s?)?$/);if(!t)return null;let n=t[1]?Number.parseInt(t[1],10):0,r=t[2]?Number.parseInt(t[2],10):0,i=t[3]?Number.parseInt(t[3],10):0,a=n*3600+r*60+i;return a>0?a:null}function e4(e){if(e.hostname.toLowerCase()===`youtu.be`){let t=e.pathname.replace(/^\//,``).split(`/`)[0]??``;return Z2.test(t)?t:null}if(e.pathname===`/watch`){let t=e.searchParams.get(`v`)??``;return Z2.test(t)?t:null}let t=e.pathname.match(/^\/(?:embed|shorts|v)\/([A-Za-z0-9_-]{11})\/?$/);return t?t[1]??null:null}function t4(e){if(typeof e!=`string`||e.length===0)return null;let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`||!Q2(t.hostname))return null;let n=e4(t);if(!n)return null;let r=t.searchParams.get(`t`)??t.searchParams.get(`start`)??``;return{id:n,startSeconds:r.length>0?$2(r):null,noCookie:t.hostname.toLowerCase().endsWith(`youtube-nocookie.com`)}}var n4=[{name:`type`,type:`enum`,enumValues:[`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`],defaultValue:`note`,required:!1,description:`Callout variant`},{name:`title`,type:`string`,required:!1,description:`Optional heading shown above the body`},{name:`icon`,type:`string`,required:!1,advanced:!0,description:"Custom lucide icon override (e.g. `lucide:Lightbulb`)"},{name:`color`,type:`string`,required:!1,advanced:!0,description:"Optional accent color override (hex — e.g. `#F05032`)"},{name:`collapsible`,type:`boolean`,required:!1,defaultValue:!1,advanced:!0,description:"Render as a foldable `<details>` (Obsidian `[!TYPE]+/-`)"},{name:`defaultOpen`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,description:`When collapsible, start in the open state`},{name:`children`,type:`reactnode`,required:!0,description:`Callout content`}],r4=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Image source URL`,accept:y$,autoFocus:!0},{name:`alt`,type:`string`,required:!0,description:`Alt text`},{name:`width`,type:`number`,required:!1,advanced:!0,description:`Image width`},{name:`height`,type:`number`,required:!1,advanced:!0,description:`Image height`},{name:`srcset`,type:`string`,required:!1,advanced:!0,description:`Responsive image candidate set (e.g. "x.png 1x, y.png 2x")`},{name:`sizes`,type:`string`,required:!1,advanced:!0,description:`Responsive image sizes hint paired with srcset`},{name:`loading`,type:`enum`,enumValues:[`eager`,`lazy`],defaultValue:`lazy`,required:!1,advanced:!0,omitOnDefault:!0,description:`Native img loading strategy (defaults to lazy)`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`decoding`,type:`enum`,enumValues:[`sync`,`async`,`auto`],defaultValue:`auto`,required:!1,advanced:!0,omitOnDefault:!0,description:`Hint for how the browser should decode the image`},{name:`fetchpriority`,type:`enum`,enumValues:[`high`,`low`,`auto`],defaultValue:`auto`,required:!1,advanced:!0,omitOnDefault:!0,description:`Resource fetch priority hint`},{name:`crossorigin`,type:`enum`,enumValues:[`anonymous`,`use-credentials`],required:!1,advanced:!0,description:`CORS mode for the image fetch`},{name:`referrerpolicy`,type:`string`,required:!1,advanced:!0,description:`Referrer policy for the image fetch (HTML referrerpolicy values)`},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`}],i4=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Embedded page URL (must start with http:// or https://)`,autoFocus:!0},{name:`title`,type:`string`,required:!1,description:`Iframe title (accessible label for screen readers)`},{name:`width`,type:`string`,required:!1,advanced:!0,description:`Embed width as a CSS length (e.g. "100%", "640px")`},{name:`height`,type:`string`,required:!1,advanced:!0,description:`Embed height as a CSS length (e.g. "26rem", "480px")`},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`}],a4=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Video source URL`,accept:b$,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 video controls (defaults to true)`,hideWhen:e=>typeof e.src==`string`&&(X2(e.src)||J2(e.src))},{name:`autoplay`,type:`boolean`,required:!1,advanced:!0,description:`Begin playback as soon as possible (usually requires muted)`},{name:`poster`,type:`string`,required:!1,advanced:!0,description:`Poster image URL shown before playback`,accept:y$,hideWhen:e=>typeof e.src==`string`&&(X2(e.src)||J2(e.src))},{name:`width`,type:`number`,required:!1,advanced:!0,description:`Video width`},{name:`height`,type:`number`,required:!1,advanced:!0,description:`Video height`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`muted`,type:`boolean`,required:!1,advanced:!0,description:`Mute audio on load`},{name:`loop`,type:`boolean`,required:!1,advanced:!0,description:`Restart from the beginning when playback ends`,hideWhen:e=>typeof e.src==`string`&&J2(e.src)},{name:`playsinline`,type:`boolean`,required:!1,advanced:!0,description:`Play inline on iOS rather than entering fullscreen`,hideWhen:e=>typeof e.src==`string`&&(X2(e.src)||J2(e.src))},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the video to preload`,hideWhen:e=>typeof e.src==`string`&&(t4(e.src)!==null||X2(e.src)||J2(e.src))},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`}],o4=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Audio source URL`,accept:x$,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 audio controls (defaults to true)`},{name:`autoplay`,type:`boolean`,required:!1,advanced:!0,description:`Begin playback as soon as possible (usually requires muted)`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`muted`,type:`boolean`,required:!1,advanced:!0,description:`Mute audio on load`},{name:`loop`,type:`boolean`,required:!1,advanced:!0,description:`Restart from the beginning when playback ends`},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the audio to preload`}],s4=[{name:`title`,type:`string`,required:!0,description:`Accordion heading shown inside the <summary>`},{name:`defaultOpen`,type:`boolean`,required:!1,defaultValue:!1,description:`When true, the accordion renders expanded on initial load`},{name:`icon`,type:`string`,required:!1,advanced:!0,description:"Custom lucide icon override (e.g. `lucide:Rocket`)"},{name:`description`,type:`string`,required:!1,advanced:!0,description:`Optional subtitle rendered below the title inside <summary>`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#advanced-options`)"},{name:`name`,type:`string`,required:!1,advanced:!0,description:`HTML5 <details name=> group — siblings with the same name are mutually exclusive`}],c4=[n4[0],n4[1],n4[4],n4[5],n4[6]],l4=[r4[0],r4[1],r4[7]],u4=[s4[0],s4[1],s4[4],s4[5]],d4=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Alt text (Obsidian alias syntax: `![[file.png|alt text]]`)"}],f4=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[clip.mp4|title]]`)"}],p4=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[song.mp3|title]]`)"}],m4=[{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#install-tabs`)"}],h4=[{name:`label`,type:`string`,required:!0,autoFocus:!0,defaultValue:`Tab`,description:`Tab strip label — shown in the clickable pill at the top`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#tab-npm`)"}],g4=[{name:`formula`,type:`string`,required:!0,autoFocus:!0,language:`latex`,description:`LaTeX math source (rendered with KaTeX in the browser)`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#eq-pythagoras`)"},{name:`language`,type:`string`,required:!1,advanced:!0,description:"Forward-compat hint for the math source language (default `latex`). Reserved for future MathJax / Typst / AsciiMath substrates."}],_4=[g4[0]],v4=[g4[0]],y4=[{name:`chart`,type:`string`,required:!0,autoFocus:!0,language:`mermaid`,description:`Mermaid chart source (graph / flowchart / sequenceDiagram / class / state / etc.)`}],b4=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Display name override (Obsidian alias syntax: `![[file.zip|label]]`)"}],x4=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`File URL`,accept:[`*/*`],autoFocus:!0}],S4=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`PDF source URL`,accept:S$,autoFocus:!0},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Accessible label for the embedded PDF viewer`},{name:`anchor`,type:`string`,required:!1,advanced:!0,description:"PDF viewer parameters as a single URL-fragment string (e.g. `page=3&height=600`)"}],C4=[{name:`src`,type:`string`,required:!0,description:"Path of the source doc, extension-less (e.g. `api-spec`).",autoFocus:!0},{name:`anchor`,type:`string`,required:!0,description:"Id of the `<MirrorSource>` block within the source doc."}],w4=[{name:`id`,type:`string`,required:!0,description:"Stable id agents and authors use to reference this block from `<Mirror>` elsewhere.",autoFocus:!0},{name:`children`,type:`reactnode`,required:!0,description:`Block content this MirrorSource owns — paragraphs, callouts, code, nested JSX, anything.`}];function T4(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`)}function E4(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}function D4(e){let t=e.attrs.props,n=t?.target??``,r=typeof t?.alias==`string`&&t.alias.length>0?t.alias:null,i=typeof t?.anchor==`string`&&t.anchor.length>0?t.anchor:null,a=r??(i?`${n}#${i}`:n);return{type:`wikiLinkEmbed`,value:a,data:{target:n,anchor:i,alias:r},children:[{type:`text`,value:a}]}}var O4=[{name:`Callout`,surface:`canonical`,hasChildren:!0,props:n4,icon:`MessageSquareWarning`,category:`content`,displayName:`Callout`,description:`Alert / admonition with 15 type variants — 5 GFM (note, tip, important, warning, caution) plus 10 Obsidian-parity (abstract, info, todo, success, question, failure, danger, bug, example, quote)`,searchTerms:[`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`,`alert`,`admonition`,`callout`],serialize:(e,t)=>H2(`Callout`,e,t,n4)},{name:`img`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:r4,icon:`Image`,category:`media`,displayName:`Image`,description:`Image with click-to-zoom and HTML-native attributes`,searchTerms:[`image`,`zoom`,`picture`,`photo`],placeholder:{label:`Add an image`},serialize:(e,t)=>H2(`img`,e,t,r4)},{name:`video`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:a4,icon:`SquarePlay`,category:`media`,displayName:`Video`,description:`HTML5 video player with native controls`,searchTerms:[`video`,`media`,`player`,`mp4`,`webm`,`movie`],placeholder:{label:`Add a video`},serialize:(e,t)=>H2(`video`,e,t,a4)},{name:`audio`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:o4,icon:`Volume2`,category:`media`,displayName:`Audio`,description:`HTML5 audio player with native controls`,searchTerms:[`audio`,`sound`,`music`,`mp3`,`podcast`,`player`],placeholder:{label:`Add audio`},serialize:(e,t)=>H2(`audio`,e,t,o4)},{name:`Pdf`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:S4,icon:`FileText`,category:`media`,displayName:`PDF`,description:"Embedded PDF viewer (`#page=N` to open at page N, `#height=N` for viewer height)",searchTerms:[`pdf`,`document`,`embed`,`pdfjs`],placeholder:{label:`Add a PDF`},serialize:(e,t)=>H2(`Pdf`,e,t,S4)},{name:`File`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:x4,icon:`Paperclip`,category:`media`,displayName:`File`,description:`Downloadable file attachment — inline row with name + size + download link`,searchTerms:[`file`,`attachment`,`download`,`document`,`zip`,`docx`,`doc`],placeholder:{label:`Add a file`},serialize:(e,t)=>H2(`File`,e,t,x4)},{name:`Embed`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:i4,icon:`AppWindow`,category:`media`,displayName:`Embed`,description:`Inline web embed (iframe) — drop a URL, get a resizable preview pane`,searchTerms:[`embed`,`iframe`,`website`,`page`,`inline`,`frame`,`preview`],placeholder:{label:`Embed a URL`},serialize:(e,t)=>H2(`Embed`,e,t,i4)},{name:`Accordion`,surface:`canonical`,hasChildren:!0,props:s4,icon:`ChevronRight`,category:`content`,displayName:`Accordion`,description:"Standalone expand/collapse via native HTML5 <details>/<summary>. Group siblings with the `name` prop for exclusive-accordion UX.",searchTerms:[`toggle`,`accordion`,`expandable`,`details`,`disclosure`,`collapse`,`fold`],exampleBody:`Body content revealed when the accordion is expanded.`,serialize:(e,t)=>H2(`Accordion`,e,t,s4)},{name:`Tabs`,surface:`canonical`,hasChildren:!0,emptyChildName:`Tab`,props:m4,icon:`LayoutPanelTop`,category:`content`,displayName:`Tabs`,description:"Horizontal tab strip + active panel below. Each `<Tab>` child is one panel; clickable pills at the top switch the active one. Active selection is ephemeral (resets on reload).",searchTerms:[`tabs`,`tabbed`,`panels`,`tabgroup`,`switcher`],exampleBody:`<Tab label="One">Body of the first tab panel.</Tab>
|
|
465
465
|
<Tab label="Two">Body of the second tab panel.</Tab>`,serialize:(e,t)=>H2(`Tabs`,e,t,m4)},{name:`Tab`,surface:`canonical`,hasChildren:!0,props:h4,icon:`PanelTop`,category:`content`,displayName:`Tab`,description:"A single tab panel inside a `<Tabs>` container — carries the strip label and the block-content body.",searchTerms:[`tab`,`panel`],exampleBody:"Panel content — must be nested inside a `<Tabs>` parent.",serialize:(e,t)=>H2(`Tab`,e,t,h4)},{name:`Math`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:g4,icon:`Sigma`,category:`content`,displayName:`Math`,description:`Block math equation rendered with KaTeX from a LaTeX source string`,searchTerms:[`math`,`latex`,`equation`,`formula`,`katex`,`tex`],serialize:(e,t)=>H2(`Math`,e,t,g4)},{name:`MermaidFence`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:y4,icon:`Workflow`,category:`content`,displayName:`Mermaid`,description:"Diagram rendered from Mermaid source (flowchart, sequence, class, state, ER, gantt, pie). Authored exclusively as ` ```mermaid ` fenced code.",searchTerms:[`mermaid`,`diagram`,`flowchart`,`graph`,`sequence`,`sequencediagram`,`class`,`state`,`er`,`erdiagram`,`gantt`,`pie`,`chart`],serialize:e=>({type:`code`,lang:`mermaid`,meta:null,value:e.attrs.props?.chart??``})},{name:`Mirror`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:C4,icon:`CopyPlus`,category:`content`,displayName:`Mirror`,description:"Render a read-only copy of a `<MirrorSource>` block from another doc. Use to keep the same content in sync across multiple docs without copy-paste — edits land at the source, every Mirror reflects the change.",searchTerms:[`mirror`,`sync`,`synced`,`transclude`,`embed`,`reference`,`shared block`],serialize:(e,t)=>H2(`Mirror`,e,t,C4)},{name:`MirrorSource`,surface:`canonical`,hasChildren:!0,props:w4,icon:`GitBranch`,category:`content`,displayName:`Mirror Source`,description:'Mark a block as the source of truth for content that appears in multiple docs. Wrap any block content; `<Mirror src="…" anchor="<id>">` references render this verbatim read-only at every call-site. Edit here, propagate everywhere.',searchTerms:[`mirror source`,`sync source`,`source block`,`master block`,`shared`],exampleBody:"Authoritative content lives inside this block — edits here propagate to every `<Mirror>` that references this id.",serialize:(e,t)=>H2(`MirrorSource`,e,t,w4)},{name:`GFMCallout`,surface:`compat`,hasChildren:!0,props:c4,icon:`MessageSquareWarning`,category:`content`,displayName:`GFM Callout`,description:"GFM blockquote alert (`> [!NOTE]`) — read-only compat. Preserves `> [!NOTE]` syntax on round-trip; insert a fresh Callout block for the full prop surface.",rendersAs:`Callout`,translateProps:e=>e,serialize:(e,t)=>{let n=e.attrs.props,r=new Set([`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`]),i=n?.type??`note`;return{type:`blockquote`,children:[{type:`html`,value:`[!${(r.has(i.toLowerCase())?i:`note`).toUpperCase()}]${n?.collapsible?n.defaultOpen===!1?`-`:`+`:``}${n?.title?` ${n.title}`:``}`},...t.all(e).filter(e=>{if(e.type!==`paragraph`)return!0;let t=e;return Array.isArray(t.children)&&t.children.length>0})]}}},{name:`CommonMarkImage`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:l4,icon:`Image`,category:`media`,displayName:`CommonMark Image`,description:'CommonMark image (``) — read-only compat. Preserves `` syntax on round-trip; insert a fresh Image block for the full HTML-native attribute surface (srcset, sizes, decoding, etc.).',rendersAs:`img`,translateProps:e=>e,serialize:e=>{let t=e.attrs.props;return{type:`paragraph`,children:[{type:`image`,url:t?.sourceUrl??t?.src??``,alt:t?.alt??``,title:t?.title??null}]}}},{name:`WikiEmbedImage`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:d4,icon:`ZoomIn`,category:`media`,displayName:`Wiki Embed Image`,description:"Obsidian-style `![[file.png]]` wiki-embed — read-only compat. Edit the alt-text via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`img`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``;return{src:e.src,alt:t??n}},serialize:D4},{name:`WikiEmbedVideo`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:f4,icon:`Film`,category:`media`,displayName:`Wiki Embed Video`,description:"Obsidian-style `![[clip.mp4]]` wiki-embed — read-only compat. Edit the title via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`video`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``;return{src:e.src,title:t??n}},serialize:D4},{name:`WikiEmbedAudio`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:p4,icon:`Volume2`,category:`media`,displayName:`Wiki Embed Audio`,description:"Obsidian-style `![[song.mp3]]` wiki-embed — read-only compat. Edit the title via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`audio`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``;return{src:e.src,title:t??n}},serialize:D4},{name:`WikiEmbedFile`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:b4,icon:`Paperclip`,category:`media`,displayName:`Wiki Embed File`,description:"Obsidian-style `![[file.zip]]` wiki-embed — read-only compat for arbitrary downloadable attachments. Renders through the `File` canonical (inline row with file-up icon + bold name + optional dim size). Edit the display name via the alias slot.",rendersAs:`File`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.size==`string`&&e.size.length>0?e.size:null;return{src:e.src,name:t??void 0,size:n??void 0}},serialize:D4},{name:`HtmlDetailsAccordion`,surface:`compat`,hasChildren:!0,props:u4,icon:`ChevronRight`,category:`content`,displayName:`HTML5 Details`,description:"HTML5 `<details><summary>` collapsible — read-only compat. Preserves `<details>` syntax on round-trip; insert a fresh Accordion block for icon / description / group-name props.",rendersAs:`Accordion`,translateProps:e=>e,serialize:(e,t)=>{let n=e.attrs.props,r=n?.defaultOpen?` open`:``,i=n?.name?` name="${T4(n.name)}"`:``,a=n?.id?` id="${T4(n.id)}"`:``,o=n?.title?.trim(),s=o?`<summary>${E4(o)}</summary>`:``;return{type:`mdxJsxFlowElement`,name:`HtmlDetailsAccordion`,attributes:[],children:t.all(e),data:{htmlBoundary:{opener:`<details${r}${i}${a}>\n${s}`,closer:`</details>`}}}}},{name:`DollarMath`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:_4,icon:`Sigma`,category:`content`,displayName:`Dollar Math`,description:"Block math via `$$…$$` syntax — read-only compat. Preserves `$$…$$` form on round-trip; insert a fresh Math block for the full prop surface (id, language).",rendersAs:`Math`,translateProps:e=>e,serialize:e=>({type:`math`,value:e.attrs.props?.formula??``})},{name:`MathFence`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:v4,icon:`Sigma`,category:`content`,displayName:`Math Fence`,description:"Block math via ` ```math ` fenced code syntax — read-only compat. Preserves the fence form on round-trip; insert a fresh Math block for the full prop surface (id, language).",rendersAs:`Math`,translateProps:e=>e,serialize:e=>({type:`code`,lang:`math`,meta:null,value:e.attrs.props?.formula??``})}],k4={name:`*`,surface:`canonical`,hasChildren:!0,props:[],description:`Unregistered component — children editable as markdown`,serialize:(e,t)=>H2(e.attrs.componentName||`*`,e,t)};function A4(){let e=new Map;e.set(`*`,k4);for(let t of O4)e.set(t.name,t);return{get(t){return e.get(t)},getOrWildcard(t){return e.get(t)??e.get(`*`)},set(t,n){e.set(t,n)},has(t){return e.has(t)},entries(){return e.entries()}}}var j4={parseFallback:{blockLevel:0,wholeDoc:0},jsxRenderFailure:{},jsxAutoConvertFailed:{},jsxAutoConvertSucceeded:{},jsxPropDropped:{},jsxMoveFailed:{},jsxStuckCopyFailed:{},jsxStuckDeleteFailed:{},jsxPopoverCloseRestoreFailed:{},jsxKeyboardDeleteFailed:{},blockGripClickSelectFailed:{},jsxArrowNodeSelectFailed:{}};function M4(){j4.parseFallback.blockLevel++}function N4(){j4.parseFallback.wholeDoc++}function P4(e){j4.jsxRenderFailure[e]=(j4.jsxRenderFailure[e]??0)+1}function F4(e){j4.jsxAutoConvertFailed[e]=(j4.jsxAutoConvertFailed[e]??0)+1}function I4(e){j4.jsxAutoConvertSucceeded[e]=(j4.jsxAutoConvertSucceeded[e]??0)+1}function L4(e){j4.jsxPropDropped[e]=(j4.jsxPropDropped[e]??0)+1}function R4(e){j4.jsxMoveFailed[e]=(j4.jsxMoveFailed[e]??0)+1}function z4(e){j4.jsxStuckCopyFailed[e]=(j4.jsxStuckCopyFailed[e]??0)+1}function B4(e){j4.jsxStuckDeleteFailed[e]=(j4.jsxStuckDeleteFailed[e]??0)+1}function V4(e){j4.jsxPopoverCloseRestoreFailed[e]=(j4.jsxPopoverCloseRestoreFailed[e]??0)+1}function H4(e){j4.jsxKeyboardDeleteFailed[e]=(j4.jsxKeyboardDeleteFailed[e]??0)+1}function U4(e){j4.blockGripClickSelectFailed[e]=(j4.blockGripClickSelectFailed[e]??0)+1}function W4(e){j4.jsxArrowNodeSelectFailed[e]=(j4.jsxArrowNodeSelectFailed[e]??0)+1}var G4=/^(`{3,}|~{3,})/gm;function K4(e){let t=[],n=null;for(let r of e.matchAll(G4)){let e=r[1],i=r.index;n?e[0]===n.marker[0]&&e.length>=n.marker.length&&(t.push([n.offset,i+r[0].length]),n=null):n={marker:e,offset:i}}return n&&t.push([n.offset,e.length]),t}function q4(e,t){return t.some(([t,n])=>e>=t&&e<n)}var J4=/^[ \t]{0,3}\[([^\]]+)\]:\s*(\S+)(\s+(?:"[^"]*"|'[^']*'|\([^)]*\)))?\s*$/gm;function Y4(e){let t=K4(e),n=[];for(let r of e.matchAll(J4))q4(r.index,t)||n.push(r[0].trimEnd());return n.length>0?`${n.join(`
|
|
466
466
|
`)}\n\n`:``}var X4=500,Z4=1e3;function Q4(e,t){let n={startMs:typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),calls:0};return n3(e,t.parse,0,n)}function $4(e){return e.calls>=Z4?!0:(typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now())-e.startMs>=X4}var e3=500;function t3(e){return e instanceof Error?{name:e.name,message:e.message.slice(0,e3),stack:e.stack?.split(`
|
|
467
467
|
`).slice(0,4).join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as e}from"./prop-types-
|
|
1
|
+
import{m as e}from"./prop-types-CMBUMzzz.js";function t(e){switch(e.kind){case`doc`:case`large-file`:return`doc`;case`folder`:case`folder-index`:return`folder`;case`missing`:case`asset`:return`missing`}}function n(n,r){let i=e(n,r);return{resolvedTarget:i,hashDocName:i.target,displayState:t(i)}}export{n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CFjPhJqf.js";import{a as t,o as n,t as r}from"./compiler-runtime-Cs91PcD2.js";import{X as i,Z as a}from"./prop-types-cyYYFQkG.js";import{C as o,S as s,b as c,d as l,l as u,m as d,o as f,p,s as m,x as h}from"./button-DenIdY-r.js";var g=o(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),_=e(t(),1),v=n(),y=`rovingFocusGroup.onEntryFocus`,b={bubbles:!1,cancelable:!0},x=`RovingFocusGroup`,[S,C,w]=a(x),[T,E]=p(x,[w]),[ee,D]=T(x),O=_.forwardRef((e,t)=>(0,v.jsx)(S.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,v.jsx)(S.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,v.jsx)(k,{...e,ref:t})})}));O.displayName=x;var k=_.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:p,onCurrentTabStopIdChange:m,onEntryFocus:h,preventScrollOnEntryFocus:g=!1,...S}=e,w=_.useRef(null),T=c(t,w),E=i(o),[D,O]=u({prop:s,defaultProp:p??null,onChange:m,caller:x}),[k,A]=_.useState(!1),j=f(h),M=C(n),N=_.useRef(!1),[P,I]=_.useState(0);return _.useEffect(()=>{let e=w.current;if(e)return e.addEventListener(y,j),()=>e.removeEventListener(y,j)},[j]),(0,v.jsx)(ee,{scope:n,orientation:r,dir:E,loop:a,currentTabStopId:D,onItemFocus:_.useCallback(e=>O(e),[O]),onItemShiftTab:_.useCallback(()=>A(!0),[]),onFocusableItemAdd:_.useCallback(()=>I(e=>e+1),[]),onFocusableItemRemove:_.useCallback(()=>I(e=>e-1),[]),children:(0,v.jsx)(d.div,{tabIndex:k||P===0?-1:0,"data-orientation":r,...S,ref:T,style:{outline:`none`,...e.style},onMouseDown:l(e.onMouseDown,()=>{N.current=!0}),onFocus:l(e.onFocus,e=>{let t=!N.current;if(e.target===e.currentTarget&&t&&!k){let t=new CustomEvent(y,b);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=M().filter(e=>e.focusable);F([e.find(e=>e.active),e.find(e=>e.id===D),...e].filter(Boolean).map(e=>e.ref.current),g)}}N.current=!1}),onBlur:l(e.onBlur,()=>A(!1))})})}),A=`RovingFocusGroupItem`,j=_.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=m(),u=a||c,f=D(A,n),p=f.currentTabStopId===u,h=C(n),{onFocusableItemAdd:g,onFocusableItemRemove:y,currentTabStopId:b}=f;return _.useEffect(()=>{if(r)return g(),()=>y()},[r,g,y]),(0,v.jsx)(S.ItemSlot,{scope:n,id:u,focusable:r,active:i,children:(0,v.jsx)(d.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...s,ref:t,onMouseDown:l(e.onMouseDown,e=>{r?f.onItemFocus(u):e.preventDefault()}),onFocus:l(e.onFocus,()=>f.onItemFocus(u)),onKeyDown:l(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){f.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=P(e,f.orientation,f.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=h().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=f.loop?I(n,r+1):n.slice(r+1)}setTimeout(()=>F(n))}}),children:typeof o==`function`?o({isCurrentTabStop:p,hasTabStop:b!=null}):o})})});j.displayName=A;var M={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function N(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function P(e,t,n){let r=N(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return M[r]}function F(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function I(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var L=O,R=j,z=`Toggle`,B=_.forwardRef((e,t)=>{let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=u({prop:n,onChange:i,defaultProp:r??!1,caller:z});return(0,v.jsx)(d.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:l(e.onClick,()=>{e.disabled||s(!o)})})});B.displayName=z;var te=B,V=`ToggleGroup`,[H,ne]=p(V,[E]),U=E(),W=_.forwardRef((e,t)=>{let{type:n,...r}=e;if(n===`single`)return(0,v.jsx)(re,{...r,ref:t});if(n===`multiple`)return(0,v.jsx)(ie,{...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${V}\``)});W.displayName=V;var[G,K]=H(V),re=_.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=u({prop:n,defaultProp:r??``,onChange:i,caller:V});return(0,v.jsx)(G,{scope:e.__scopeToggleGroup,type:`single`,value:_.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:_.useCallback(()=>s(``),[s]),children:(0,v.jsx)(q,{...a,ref:t})})}),ie=_.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=u({prop:n,defaultProp:r??[],onChange:i,caller:V}),c=_.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=_.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,v.jsx)(G,{scope:e.__scopeToggleGroup,type:`multiple`,value:o,onItemActivate:c,onItemDeactivate:l,children:(0,v.jsx)(q,{...a,ref:t})})});W.displayName=V;var[ae,oe]=H(V),q=_.forwardRef((e,t)=>{let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:a=!0,orientation:o,dir:s,loop:c=!0,...l}=e,u=U(n),f=i(s),p={role:`group`,dir:f,...l};return(0,v.jsx)(ae,{scope:n,rovingFocus:a,disabled:r,children:a?(0,v.jsx)(L,{asChild:!0,...u,orientation:o,dir:f,loop:c,children:(0,v.jsx)(d.div,{...p,ref:t})}):(0,v.jsx)(d.div,{...p,ref:t})})}),J=`ToggleGroupItem`,Y=_.forwardRef((e,t)=>{let n=K(J,e.__scopeToggleGroup),r=oe(J,e.__scopeToggleGroup),i=U(e.__scopeToggleGroup),a=n.value.includes(e.value),o=r.disabled||e.disabled,s={...e,pressed:a,disabled:o},c=_.useRef(null);return r.rovingFocus?(0,v.jsx)(R,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,v.jsx)(X,{...s,ref:t})}):(0,v.jsx)(X,{...s,ref:t})});Y.displayName=J;var X=_.forwardRef((e,t)=>{let{__scopeToggleGroup:n,value:r,...i}=e,a=K(J,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0};return(0,v.jsx)(B,{...a.type===`single`?o:void 0,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})}),se=W,ce=Y,Z=r(),Q=h(`group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-transparent`,outline:`border border-input bg-transparent hover:bg-muted`,segmented:`text-muted-foreground hover:bg-muted-foreground/10 data-[state=on]:bg-background data-[state=on]:shadow-sm data-[state=on]:text-foreground dark:data-[state=on]:bg-muted`},size:{default:`h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,sm:`h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`}},defaultVariants:{variant:`default`,size:`default`}});function le(e){let t=(0,Z.c)(14),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,variant:i,size:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`default`:i,c=a===void 0?`default`:a,l;t[5]!==n||t[6]!==c||t[7]!==o?(l=s(Q({variant:o,size:c,className:n})),t[5]=n,t[6]=c,t[7]=o,t[8]=l):l=t[8];let u;return t[9]!==r||t[10]!==c||t[11]!==l||t[12]!==o?(u=(0,v.jsx)(te,{"data-slot":`toggle`,"data-variant":o,"data-size":c,className:l,...r}),t[9]=r,t[10]=c,t[11]=l,t[12]=o,t[13]=u):u=t[13],u}var $=_.createContext({size:`default`,variant:`default`,spacing:0,orientation:`horizontal`});function ue(e){let t=(0,Z.c)(29),n,r,i,a,o,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],c=t[6],l=t[7]):({className:r,variant:l,size:a,spacing:o,orientation:c,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=c,t[7]=l);let u=o===void 0?0:o,d=c===void 0?`horizontal`:c,f;t[8]===u?f=t[9]:(f={"--gap":u},t[8]=u,t[9]=f);let p=f,m;t[10]===r?m=t[11]:(m=s(`group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch`,r),t[10]=r,t[11]=m);let h;t[12]!==d||t[13]!==a||t[14]!==u||t[15]!==l?(h={variant:l,size:a,spacing:u,orientation:d},t[12]=d,t[13]=a,t[14]=u,t[15]=l,t[16]=h):h=t[16];let g;t[17]!==n||t[18]!==h?(g=(0,v.jsx)($.Provider,{value:h,children:n}),t[17]=n,t[18]=h,t[19]=g):g=t[19];let _;return t[20]!==d||t[21]!==i||t[22]!==a||t[23]!==u||t[24]!==p||t[25]!==m||t[26]!==g||t[27]!==l?(_=(0,v.jsx)(se,{"data-slot":`toggle-group`,"data-variant":l,"data-size":a,"data-spacing":u,"data-orientation":d,style:p,className:m,...i,children:g}),t[20]=d,t[21]=i,t[22]=a,t[23]=u,t[24]=p,t[25]=m,t[26]=g,t[27]=l,t[28]=_):_=t[28],_}function de(e){let t=(0,Z.c)(19),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,children:n,variant:a,size:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let c=a===void 0?`default`:a,l=o===void 0?`default`:o,u=_.use($),d=u.variant||c,f=u.size||l,p=u.spacing,m;t[6]!==r||t[7]!==u.size||t[8]!==u.variant||t[9]!==l||t[10]!==c?(m=s(`shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t text-muted-foreground data-[state=on]:text-foreground`,Q({variant:u.variant||c,size:u.size||l}),r),t[6]=r,t[7]=u.size,t[8]=u.variant,t[9]=l,t[10]=c,t[11]=m):m=t[11];let h;return t[12]!==n||t[13]!==u.spacing||t[14]!==i||t[15]!==d||t[16]!==f||t[17]!==m?(h=(0,v.jsx)(ce,{"data-slot":`toggle-group-item`,"data-variant":d,"data-size":f,"data-spacing":p,className:m,...i,children:n}),t[12]=n,t[13]=u.spacing,t[14]=i,t[15]=d,t[16]=f,t[17]=m,t[18]=h):h=t[18],h}export{L as a,R as i,de as n,E as o,le as r,g as s,ue as t};
|
|
1
|
+
import{o as e}from"./chunk-CFjPhJqf.js";import{a as t,o as n,t as r}from"./compiler-runtime-Cs91PcD2.js";import{X as i,Z as a}from"./prop-types-CMBUMzzz.js";import{C as o,S as s,b as c,d as l,l as u,m as d,o as f,p,s as m,x as h}from"./button-DenIdY-r.js";var g=o(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),_=e(t(),1),v=n(),y=`rovingFocusGroup.onEntryFocus`,b={bubbles:!1,cancelable:!0},x=`RovingFocusGroup`,[S,C,w]=a(x),[T,E]=p(x,[w]),[ee,D]=T(x),O=_.forwardRef((e,t)=>(0,v.jsx)(S.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,v.jsx)(S.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,v.jsx)(k,{...e,ref:t})})}));O.displayName=x;var k=_.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:p,onCurrentTabStopIdChange:m,onEntryFocus:h,preventScrollOnEntryFocus:g=!1,...S}=e,w=_.useRef(null),T=c(t,w),E=i(o),[D,O]=u({prop:s,defaultProp:p??null,onChange:m,caller:x}),[k,A]=_.useState(!1),j=f(h),M=C(n),N=_.useRef(!1),[P,I]=_.useState(0);return _.useEffect(()=>{let e=w.current;if(e)return e.addEventListener(y,j),()=>e.removeEventListener(y,j)},[j]),(0,v.jsx)(ee,{scope:n,orientation:r,dir:E,loop:a,currentTabStopId:D,onItemFocus:_.useCallback(e=>O(e),[O]),onItemShiftTab:_.useCallback(()=>A(!0),[]),onFocusableItemAdd:_.useCallback(()=>I(e=>e+1),[]),onFocusableItemRemove:_.useCallback(()=>I(e=>e-1),[]),children:(0,v.jsx)(d.div,{tabIndex:k||P===0?-1:0,"data-orientation":r,...S,ref:T,style:{outline:`none`,...e.style},onMouseDown:l(e.onMouseDown,()=>{N.current=!0}),onFocus:l(e.onFocus,e=>{let t=!N.current;if(e.target===e.currentTarget&&t&&!k){let t=new CustomEvent(y,b);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=M().filter(e=>e.focusable);F([e.find(e=>e.active),e.find(e=>e.id===D),...e].filter(Boolean).map(e=>e.ref.current),g)}}N.current=!1}),onBlur:l(e.onBlur,()=>A(!1))})})}),A=`RovingFocusGroupItem`,j=_.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=m(),u=a||c,f=D(A,n),p=f.currentTabStopId===u,h=C(n),{onFocusableItemAdd:g,onFocusableItemRemove:y,currentTabStopId:b}=f;return _.useEffect(()=>{if(r)return g(),()=>y()},[r,g,y]),(0,v.jsx)(S.ItemSlot,{scope:n,id:u,focusable:r,active:i,children:(0,v.jsx)(d.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...s,ref:t,onMouseDown:l(e.onMouseDown,e=>{r?f.onItemFocus(u):e.preventDefault()}),onFocus:l(e.onFocus,()=>f.onItemFocus(u)),onKeyDown:l(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){f.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=P(e,f.orientation,f.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=h().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=f.loop?I(n,r+1):n.slice(r+1)}setTimeout(()=>F(n))}}),children:typeof o==`function`?o({isCurrentTabStop:p,hasTabStop:b!=null}):o})})});j.displayName=A;var M={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function N(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function P(e,t,n){let r=N(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return M[r]}function F(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function I(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var L=O,R=j,z=`Toggle`,B=_.forwardRef((e,t)=>{let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=u({prop:n,onChange:i,defaultProp:r??!1,caller:z});return(0,v.jsx)(d.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:l(e.onClick,()=>{e.disabled||s(!o)})})});B.displayName=z;var te=B,V=`ToggleGroup`,[H,ne]=p(V,[E]),U=E(),W=_.forwardRef((e,t)=>{let{type:n,...r}=e;if(n===`single`)return(0,v.jsx)(re,{...r,ref:t});if(n===`multiple`)return(0,v.jsx)(ie,{...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${V}\``)});W.displayName=V;var[G,K]=H(V),re=_.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=u({prop:n,defaultProp:r??``,onChange:i,caller:V});return(0,v.jsx)(G,{scope:e.__scopeToggleGroup,type:`single`,value:_.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:_.useCallback(()=>s(``),[s]),children:(0,v.jsx)(q,{...a,ref:t})})}),ie=_.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=u({prop:n,defaultProp:r??[],onChange:i,caller:V}),c=_.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=_.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,v.jsx)(G,{scope:e.__scopeToggleGroup,type:`multiple`,value:o,onItemActivate:c,onItemDeactivate:l,children:(0,v.jsx)(q,{...a,ref:t})})});W.displayName=V;var[ae,oe]=H(V),q=_.forwardRef((e,t)=>{let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:a=!0,orientation:o,dir:s,loop:c=!0,...l}=e,u=U(n),f=i(s),p={role:`group`,dir:f,...l};return(0,v.jsx)(ae,{scope:n,rovingFocus:a,disabled:r,children:a?(0,v.jsx)(L,{asChild:!0,...u,orientation:o,dir:f,loop:c,children:(0,v.jsx)(d.div,{...p,ref:t})}):(0,v.jsx)(d.div,{...p,ref:t})})}),J=`ToggleGroupItem`,Y=_.forwardRef((e,t)=>{let n=K(J,e.__scopeToggleGroup),r=oe(J,e.__scopeToggleGroup),i=U(e.__scopeToggleGroup),a=n.value.includes(e.value),o=r.disabled||e.disabled,s={...e,pressed:a,disabled:o},c=_.useRef(null);return r.rovingFocus?(0,v.jsx)(R,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,v.jsx)(X,{...s,ref:t})}):(0,v.jsx)(X,{...s,ref:t})});Y.displayName=J;var X=_.forwardRef((e,t)=>{let{__scopeToggleGroup:n,value:r,...i}=e,a=K(J,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0};return(0,v.jsx)(B,{...a.type===`single`?o:void 0,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})}),se=W,ce=Y,Z=r(),Q=h(`group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-transparent`,outline:`border border-input bg-transparent hover:bg-muted`,segmented:`text-muted-foreground hover:bg-muted-foreground/10 data-[state=on]:bg-background data-[state=on]:shadow-sm data-[state=on]:text-foreground dark:data-[state=on]:bg-muted`},size:{default:`h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,sm:`h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`}},defaultVariants:{variant:`default`,size:`default`}});function le(e){let t=(0,Z.c)(14),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,variant:i,size:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`default`:i,c=a===void 0?`default`:a,l;t[5]!==n||t[6]!==c||t[7]!==o?(l=s(Q({variant:o,size:c,className:n})),t[5]=n,t[6]=c,t[7]=o,t[8]=l):l=t[8];let u;return t[9]!==r||t[10]!==c||t[11]!==l||t[12]!==o?(u=(0,v.jsx)(te,{"data-slot":`toggle`,"data-variant":o,"data-size":c,className:l,...r}),t[9]=r,t[10]=c,t[11]=l,t[12]=o,t[13]=u):u=t[13],u}var $=_.createContext({size:`default`,variant:`default`,spacing:0,orientation:`horizontal`});function ue(e){let t=(0,Z.c)(29),n,r,i,a,o,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],c=t[6],l=t[7]):({className:r,variant:l,size:a,spacing:o,orientation:c,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=c,t[7]=l);let u=o===void 0?0:o,d=c===void 0?`horizontal`:c,f;t[8]===u?f=t[9]:(f={"--gap":u},t[8]=u,t[9]=f);let p=f,m;t[10]===r?m=t[11]:(m=s(`group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch`,r),t[10]=r,t[11]=m);let h;t[12]!==d||t[13]!==a||t[14]!==u||t[15]!==l?(h={variant:l,size:a,spacing:u,orientation:d},t[12]=d,t[13]=a,t[14]=u,t[15]=l,t[16]=h):h=t[16];let g;t[17]!==n||t[18]!==h?(g=(0,v.jsx)($.Provider,{value:h,children:n}),t[17]=n,t[18]=h,t[19]=g):g=t[19];let _;return t[20]!==d||t[21]!==i||t[22]!==a||t[23]!==u||t[24]!==p||t[25]!==m||t[26]!==g||t[27]!==l?(_=(0,v.jsx)(se,{"data-slot":`toggle-group`,"data-variant":l,"data-size":a,"data-spacing":u,"data-orientation":d,style:p,className:m,...i,children:g}),t[20]=d,t[21]=i,t[22]=a,t[23]=u,t[24]=p,t[25]=m,t[26]=g,t[27]=l,t[28]=_):_=t[28],_}function de(e){let t=(0,Z.c)(19),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,children:n,variant:a,size:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let c=a===void 0?`default`:a,l=o===void 0?`default`:o,u=_.use($),d=u.variant||c,f=u.size||l,p=u.spacing,m;t[6]!==r||t[7]!==u.size||t[8]!==u.variant||t[9]!==l||t[10]!==c?(m=s(`shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t text-muted-foreground data-[state=on]:text-foreground`,Q({variant:u.variant||c,size:u.size||l}),r),t[6]=r,t[7]=u.size,t[8]=u.variant,t[9]=l,t[10]=c,t[11]=m):m=t[11];let h;return t[12]!==n||t[13]!==u.spacing||t[14]!==i||t[15]!==d||t[16]!==f||t[17]!==m?(h=(0,v.jsx)(ce,{"data-slot":`toggle-group-item`,"data-variant":d,"data-size":f,"data-spacing":p,className:m,...i,children:n}),t[12]=n,t[13]=u.spacing,t[14]=i,t[15]=d,t[16]=f,t[17]=m,t[18]=h):h=t[18],h}export{L as a,R as i,de as n,E as o,le as r,g as s,ue as t};
|
package/dist/public/assets/{typing-burst-detector-ujD0pffB.js → typing-burst-detector-BC-nkePC.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CFjPhJqf.js";import{a as t,i as n,o as r,r as i,t as a}from"./compiler-runtime-Cs91PcD2.js";import{A as o,Cn as s,O as c,k as l,lt as u,n as d}from"./DocumentContext-SHvJNWIX.js";import{a as f,c as ee,i as te,n as ne,o as re,r as ie,s as ae,t as oe,u as se}from"./panel-BNBODYwB.js";import{Ai as p,Xt as m,qt as h,u as ce}from"./prop-types-cyYYFQkG.js";import{S as le}from"./button-DenIdY-r.js";import{$ as g,At as _,Bt as v,Dt as y,E as ue,Et as b,Ft as x,Ht as S,J as C,Mt as w,N as T,Ot as E,Pt as D,Q as O,Rt as k,Ut as A,X as j,_ as de,_t as M,ct as N,dt as P,et as F,f as I,gt as L,ht as R,l as fe,lt as pe,mt as me,nt as he,ot as ge,rt as _e,st as ve,tt as ye,ut as be,wt as z,y as xe,yt as B,zt as Se}from"./dist-sw9fzKjM.js";import{i as Ce,n as we,o as Te,r as Ee}from"./dist-Cwt7KtW7.js";var De=e(t(),1),Oe=a(),ke=new Map;function Ae(e,t){ke.set(e,t)}function je(e){let t=ke.get(e)??null;return ke.delete(e),t}function Me(e){ke.delete(e)}function Ne(e,t){let n=(0,Oe.c)(4),r=t===void 0?!1:t,[i,a]=(0,De.useState)(void 0),o=(0,De.useRef)(null),s,c;return n[0]!==r||n[1]!==e?(s=()=>{if(r||e.length===0){a(void 0);return}let t=function(){let t=window.innerHeight/2,n,r;for(let i of e){let e=document.getElementById(i);if(!e)continue;let a=e.getBoundingClientRect().top;a<0?n=i:r===void 0&&a<t&&(r=i)}a(r??n??e[0])},n=function(){o.current===null&&(o.current=requestAnimationFrame(()=>{o.current=null,t()}))};return document.addEventListener(`scroll`,n,{capture:!0,passive:!0}),t(),()=>{document.removeEventListener(`scroll`,n,{capture:!0}),o.current!==null&&(cancelAnimationFrame(o.current),o.current=null)}},c=[e,r],n[0]=r,n[1]=e,n[2]=s,n[3]=c):(s=n[2],c=n[3]),(0,De.useEffect)(s,c),i}var V=r(),Pe=300;async function Fe(e){let t=await fetch(`/api/page-headings?docName=${encodeURIComponent(e)}`),n;try{n=await t.json()}catch(e){throw new u(p._({id:`qAQVSD`}),{cause:e,status:t.status})}if(!t.ok){let e=m.safeParse(n);throw e.success?Error(e.data.title):new u(p._({id:`zlErBl`}),{status:t.status})}let r=h.safeParse(n);if(!r.success)throw new u(p._({id:`XW18jo`}),{status:t.status});return r.data.headings??[]}var Ie=32,Le=12,Re=6,ze=`open-knowledge:outline-nav`;function Be(e){let t=(0,Oe.c)(2),n;return t[0]===e?n=t[1]:(n=(0,V.jsx)(s,{name:`outline-panel`,children:(0,V.jsx)(Ve,{...e})}),t[0]=e,t[1]=n),n}function Ve(e){let t=(0,Oe.c)(50),{docName:r,isSourceMode:a,className:o}=e,s=o===void 0?``:o,{_:c}=n(),{pages:l,loading:u}=ce(),p=se(),{activeProvider:m,activeDocName:h}=d(),g,_;t[0]===r?(g=t[1],_=t[2]):(g=[`page-headings`,r],_=()=>Fe(r),t[0]=r,t[1]=g,t[2]=_);let v;t[3]!==r||t[4]!==u||t[5]!==l?(v=!u&&l.has(r),t[3]=r,t[4]=u,t[5]=l,t[6]=v):v=t[6];let y;t[7]!==g||t[8]!==_||t[9]!==v?(y={queryKey:g,queryFn:_,enabled:v,staleTime:1/0},t[7]=g,t[8]=_,t[9]=v,t[10]=y):y=t[10];let{data:ue,isLoading:b,error:x}=ee(y),S;t[11]===ue?S=t[12]:(S=ue===void 0?[]:ue,t[11]=ue,t[12]=S);let C=S,w,T;t[13]!==h||t[14]!==m||t[15]!==r||t[16]!==p?(w=()=>{if(!m||h!==r)return;let e=m.document,t=null,n=()=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{t=null,p.invalidateQueries({queryKey:[`page-headings`,r]})},Pe)};return e.on(`update`,n),()=>{e.off(`update`,n),t!==null&&clearTimeout(t)}},T=[m,h,r,p],t[13]=h,t[14]=m,t[15]=r,t[16]=p,t[17]=w,t[18]=T):(w=t[17],T=t[18]),(0,De.useEffect)(w,T);let E;t[19]===C?E=t[20]:(E=C.map(He),t[19]=C,t[20]=E);let D=Ne(E,a),O;t[21]!==D||t[22]!==C?(O=D?C.findIndex(e=>e.slug===D):-1,t[21]=D,t[22]=C,t[23]=O):O=t[23];let k=O,A;t[24]!==r||t[25]!==a?(A=function(e,t){let n={index:e,slug:t,mode:a?`source`:`wysiwyg`};n.mode===`source`&&Ae(r,{kind:`outline`,detail:n}),window.dispatchEvent(new CustomEvent(ze,{detail:n}))},t[24]=r,t[25]=a,t[26]=A):A=t[26];let j=A,de=((k>=0?C[k].level:1)-1)*Le+(Le-Re)/2,M=k*Ie+(Ie-Re)/2,N;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,V.jsx)(ae,{children:(0,V.jsx)(i,{id:`dD7NPy`})}),t[27]=N):N=t[27];let P;t[28]!==C.length||t[29]!==b?(P=!b&&(0,V.jsx)(ie,{children:C.length}),t[28]=C.length,t[29]=b,t[30]=P):P=t[30];let F;t[31]===P?F=t[32]:(F=(0,V.jsxs)(re,{children:[N,P]}),t[31]=P,t[32]=F);let I;t[33]!==c||t[34]!==k||t[35]!==D||t[36]!==x||t[37]!==j||t[38]!==C||t[39]!==b||t[40]!==de||t[41]!==M?(I=x?(0,V.jsx)(f,{className:`px-2`,children:x instanceof Error?x.message:c({id:`GuqOb1`})}):C.length===0&&!b?(0,V.jsx)(te,{className:`px-2`,children:(0,V.jsx)(i,{id:`0BB9ID`})}):(0,V.jsxs)(`nav`,{"aria-label":c({id:`BymzO4`}),className:`relative`,children:[k>=0&&(0,V.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute left-0 top-0 rounded-full bg-primary motion-safe:[transition:transform_0.25s_var(--ease-out-strong)]`,style:{width:Re,height:Re,transform:`translate(${de}px, ${M}px)`}}),C.map((e,t)=>{let n=e.slug===D;return(0,V.jsx)(`button`,{type:`button`,"aria-current":n?`location`:void 0,onClick:()=>j(t,e.slug),className:le(`w-full cursor-pointer truncate py-1.5 pe-2 text-left text-sm transition-colors`,n?`font-medium text-primary`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${(e.level-1)*Le+20}px`},title:e.text,children:e.text},t)})]}),t[33]=c,t[34]=k,t[35]=D,t[36]=x,t[37]=j,t[38]=C,t[39]=b,t[40]=de,t[41]=M,t[42]=I):I=t[42];let L;t[43]!==b||t[44]!==I?(L=(0,V.jsx)(ne,{className:`px-3 py-2`,"aria-busy":b,children:I}),t[43]=b,t[44]=I,t[45]=L):L=t[45];let R;return t[46]!==s||t[47]!==F||t[48]!==L?(R=(0,V.jsxs)(oe,{className:s,children:[F,L]}),t[46]=s,t[47]=F,t[48]=L,t[49]=R):R=t[49],R}function He(e){return e.slug}var Ue=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,H=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(Ue(e)):Ue,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return k(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=A(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=Se(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n;;e++){let a=r.charCodeAt(e),o=this.match(a,i,this.bufferPos+this.bufferStart);if(e==r.length-1){if(o)return this.value=o,this;break}i==n&&e<t.length&&t.charCodeAt(e)==a&&i++}}}match(e,t,n){let r=null;for(let t=0;t<this.matches.length;t+=2){let i=this.matches[t],a=!1;this.query.charCodeAt(i)==e&&(i==this.query.length-1?r={from:this.matches[t+1],to:n}:(this.matches[t]++,a=!0)),a||(this.matches.splice(t,2),t-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?r={from:t,to:n}:this.matches.push(1,t)),r&&this.test&&!this.test(r.from,r.to,this.buffer,this.bufferStart)&&(r=null),r}};typeof Symbol<`u`&&(H.prototype[Symbol.iterator]=function(){return this});var We={from:-1,to:-1,match:/.*/.exec(``)},Ge=`gm`+(/x/.unicode==null?``:`u`),Ke=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=We,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new Ye(e,t,n,r,i);this.re=new RegExp(t,Ge+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter(),this.curLineStart=e.lineAt(r).from,this.matchPos=Ze(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=Ze(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},qe=new WeakMap,Je=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=qe.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return qe.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),qe.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},Ye=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=We,this.matchPos=Ze(e,r),this.re=new RegExp(t,Ge+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=Je.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,match:t},this.matchPos=Ze(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Je.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(Ke.prototype[Symbol.iterator]=Ye.prototype[Symbol.iterator]=function(){return this});function Xe(e){try{return new RegExp(e,Ge),!0}catch{return!1}}function Ze(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var Qe=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:r,result:i}=L(e,{label:t.phrase(`Go to line`),input:{type:`text`,name:`line`,value:n},focus:!0,submitLabel:t.phrase(`go`)});return i.then(n=>{let i=n&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.elements.line.value);if(!i){e.dispatch({effects:r});return}let a=t.doc.lineAt(t.selection.main.head),[,o,s,c,l]=i,u=c?+c.slice(1):0,d=s?+s:a.number;if(s&&l){let e=d/100;o&&(e=e*(o==`-`?-1:1)+a.number/t.doc.lines),d=Math.round(t.doc.lines*e)}else s&&o&&(d=d*(o==`-`?-1:1)+a.number);let f=t.doc.line(Math.max(1,Math.min(t.doc.lines,d))),ee=b.cursor(f.from+Math.max(0,Math.min(u,f.length)));e.dispatch({effects:[r,j.scrollIntoView(ee.from,{y:`center`})],selection:ee})}),!0},$e={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},et=E.define({combine(e){return v(e,$e,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function tt(e){let t=[st,ot];return e&&t.push(et.of(e)),t}var nt=C.mark({class:`cm-selectionMatch`}),rt=C.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function it(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=z.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=z.Word)}function at(e,t,n,r){return e(t.sliceDoc(n,n+1))==z.Word&&e(t.sliceDoc(r-1,r))==z.Word}var ot=O.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(et),{state:n}=e,r=n.selection;if(r.ranges.length>1)return C.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return C.none;let e=n.wordAt(i.head);if(!e)return C.none;o=n.charCategorizer(i.head),a=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return C.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(it(o,n,i.from,i.to)&&at(o,n,i.from,i.to)))return C.none}else if(a=n.sliceDoc(i.from,i.to),!a)return C.none}let s=[];for(let r of e.visibleRanges){let e=new H(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||it(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push(rt.range(r,a)):(r>=i.to||a<=i.from)&&s.push(nt.range(r,a)),s.length>t.maxMatches))return C.none}}return C.set(s)}},{decorations:e=>e.decorations}),st=j.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),ct=({state:e,dispatch:t})=>{let{selection:n}=e,r=b.create(n.ranges.map(t=>e.wordAt(t.head)||b.cursor(t.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function lt(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new H(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new H(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var ut=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return ct({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=lt(e,r);return i?(t(e.update({selection:e.selection.addRange(b.range(i.from,i.to),!1),effects:j.scrollIntoView(i.to)})),!0):!1},U=E.define({combine(e){return v(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new zt(e),scrollToMatch:e=>j.scrollIntoView(e)})}}),dt=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||Xe(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?`
|
|
2
|
-
`:t==`r`?`\r`:t==`t`?` `:`\\`)}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new bt(this):new ht(this)}getCursor(e,t=0,n){let r=e.doc?e:y.create({doc:e});return n??=r.doc.length,this.regexp?G(this,r,t,n):W(this,r,t,n)}},ft=class{constructor(e){this.spec=e}};function pt(e,t,n){return(r,i,a,o)=>n&&!n(r,i,a,o)?!1:e(r>=o&&i<=o+a.length?a.slice(r-o,i-o):t.doc.sliceString(r,i),t,r,i)}function W(e,t,n,r){let i;return e.wholeWord&&(i=mt(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=pt(e.test,t,i)),new H(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function mt(e,t){return(n,r,i,a)=>((a>n||a+i.length<r)&&(a=Math.max(0,n-2),i=e.sliceString(a,Math.min(e.length,r+2))),(t(_t(i,n-a))!=z.Word||t(vt(i,n-a))!=z.Word)&&(t(vt(i,r-a))!=z.Word||t(_t(i,r-a))!=z.Word))}var ht=class extends ft{constructor(e){super(e)}nextMatch(e,t,n){let r=W(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=W(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=W(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=W(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=W(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}};function gt(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function G(e,t,n,r){let i;return e.wholeWord&&(i=yt(t.charCategorizer(t.selection.main.head))),e.test&&(i=gt(e.test,t,i)),new Ke(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function _t(e,t){return e.slice(S(e,t,!1),t)}function vt(e,t){return e.slice(t,S(e,t))}function yt(e){return(t,n,r)=>!r[0].length||(e(_t(r.input,r.index))!=z.Word||e(vt(r.input,r.index))!=z.Word)&&(e(vt(r.input,r.index+r[0].length))!=z.Word||e(_t(r.input,r.index+r[0].length))!=z.Word)}var bt=class extends ft{nextMatch(e,t,n){let r=G(this.spec,e,n,e.doc.length).next();return r.done&&(r=G(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-r*1e4),a=G(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n==`&`)return e.match[0];if(n==`$`)return`$`;for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=G(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=G(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}},K=D.define(),xt=D.define(),q=x.define({create(e){return new St(Nt(e).create(),null)},update(e,t){for(let n of t.effects)n.is(K)?e=new St(n.value.create(),e.panel):n.is(xt)&&(e=new St(e.query,n.value?Mt:null));return e},provide:e=>M.from(e,e=>e.panel)}),St=class{constructor(e,t){this.query=e,this.panel=t}},Ct=C.mark({class:`cm-searchMatch`}),wt=C.mark({class:`cm-searchMatch cm-searchMatch-selected`}),Tt=O.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(q))}update(e){let t=e.state.field(q);(t!=e.startState.field(q)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return C.none;let{view:n}=this,r=new w;for(let t=0,i=n.visibleRanges,a=i.length;t<a;t++){let{from:o,to:s}=i[t];for(;t<a-1&&s>i[t+1].from-500;)s=i[++t].to;e.highlight(n.state,o,s,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?wt:Ct)})}return r.finish()}},{decorations:e=>e.decorations});function J(e){return t=>{let n=t.state.field(q,!1);return n&&n.query.spec.valid?e(t,n):It(t)}}var Et=J((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=b.single(r.from,r.to),a=e.state.facet(U);return e.dispatch({selection:i,effects:[Ht(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),Ft(e),!0}),Dt=J((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=b.single(i.from,i.to),o=e.state.facet(U);return e.dispatch({selection:a,effects:[Ht(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),Ft(e),!0}),Ot=J((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:b.create(n.map(e=>b.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),kt=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,a=[],o=0;for(let t=new H(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(b.range(t.value.from,t.value.to))}return t(e.update({selection:b.create(a,o),userEvent:`select.search.matches`})),!0},At=J((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let o=a,s=[],c,l,u=[];o.from==r&&o.to==i&&(l=n.toText(t.getReplacement(o)),s.push({from:o.from,to:o.to,insert:l}),o=t.nextMatch(n,o.from,o.to),u.push(j.announce.of(n.phrase(`replaced match on line $`,n.doc.lineAt(r).number)+`.`)));let d=e.state.changes(s);return o&&(c=b.single(o.from,o.to).map(d),u.push(Ht(e,o)),u.push(n.facet(U).scrollToMatch(c.main,e))),e.dispatch({changes:d,selection:c,effects:u,userEvent:`input.replace`}),!0}),jt=J((e,{query:t})=>{if(e.state.readOnly)return!1;let n=t.matchAll(e.state,1e9).map(e=>{let{from:n,to:r}=e;return{from:n,to:r,insert:t.getReplacement(e)}});if(!n.length)return!1;let r=e.state.phrase(`replaced $ matches`,n.length)+`.`;return e.dispatch({changes:n,effects:j.announce.of(r),userEvent:`input.replace.all`}),!0});function Mt(e){return e.state.facet(U).createPanel(e)}function Nt(e,t){let n=e.selection.main,r=n.empty||n.to>n.from+100?``:e.sliceDoc(n.from,n.to);if(t&&!r)return t;let i=e.facet(U);return new dt({search:t?.literal??i.literal?r:r.replace(/\n/g,`\\n`),caseSensitive:t?.caseSensitive??i.caseSensitive,literal:t?.literal??i.literal,regexp:t?.regexp??i.regexp,wholeWord:t?.wholeWord??i.wholeWord})}function Pt(e){let t=_e(e,Mt);return t&&t.dom.querySelector(`[main-field]`)}function Ft(e){let t=Pt(e);t&&t==e.root.activeElement&&t.select()}var It=e=>{let t=e.state.field(q,!1);if(t&&t.panel){let n=Pt(e);if(n&&n!=e.root.activeElement){let r=Nt(e.state,t.query.spec);r.valid&&e.dispatch({effects:K.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[xt.of(!0),t?K.of(Nt(e.state,t.query.spec)):D.appendConfig.of(Wt)]});return!0},Lt=e=>{let t=e.state.field(q,!1);if(!t||!t.panel)return!1;let n=_e(e,Mt);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:xt.of(!1)}),!0},Rt=[{key:`Mod-f`,run:It,scope:`editor search-panel`},{key:`F3`,run:Et,shift:Dt,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:Et,shift:Dt,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:Lt,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:kt},{key:`Mod-Alt-g`,run:Qe},{key:`Mod-d`,run:ut,preventDefault:!0}],zt=class{constructor(e){this.view=e;let t=this.query=e.state.field(q).query.spec;this.commit=this.commit.bind(this),this.searchField=B(`input`,{value:t.search,placeholder:Y(e,`Find`),"aria-label":Y(e,`Find`),class:`cm-textfield`,name:`search`,form:``,"main-field":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=B(`input`,{value:t.replace,placeholder:Y(e,`Replace`),"aria-label":Y(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=B(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=B(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=B(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return B(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=B(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>Et(e),[Y(e,`next`)]),n(`prev`,()=>Dt(e),[Y(e,`previous`)]),n(`select`,()=>Ot(e),[Y(e,`all`)]),B(`label`,null,[this.caseField,Y(e,`match case`)]),B(`label`,null,[this.reField,Y(e,`regexp`)]),B(`label`,null,[this.wordField,Y(e,`by word`)]),...e.state.readOnly?[]:[B(`br`),this.replaceField,n(`replace`,()=>At(e),[Y(e,`replace`)]),n(`replaceAll`,()=>jt(e),[Y(e,`replace all`)])],B(`button`,{name:`close`,onclick:()=>Lt(e),"aria-label":Y(e,`close`),type:`button`},[`×`])])}commit(){let e=new dt({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:K.of(e)}))}keydown(e){R(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Dt:Et)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),At(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(K)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(U).top}};function Y(e,t){return e.state.phrase(t)}var Bt=30,Vt=/[\s\.,:;?!]/;function Ht(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-Bt),o=Math.min(i,n+Bt),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<Bt;e++)if(!Vt.test(s[e+1])&&Vt.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-Bt;e--)if(!Vt.test(s[e-1])&&Vt.test(s[e])){s=s.slice(0,e);break}}return j.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var Ut=j.baseTheme({".cm-panel.cm-search":{padding:`2px 6px 4px`,position:`relative`,"& [name=close]":{position:`absolute`,top:`0`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0},"& input, & button, & label":{margin:`.2em .6em .2em 0`},"& input[type=checkbox]":{marginRight:`.2em`},"& label":{fontSize:`80%`,whiteSpace:`pre`}},"&light .cm-searchMatch":{backgroundColor:`#ffff0054`},"&dark .cm-searchMatch":{backgroundColor:`#00ffff8a`},"&light .cm-searchMatch-selected":{backgroundColor:`#ff6a0054`},"&dark .cm-searchMatch-selected":{backgroundColor:`#ff00ff8a`}}),Wt=[q,_.low(Tt),Ut],Gt=class{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}},X=class e{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(t,n,r){let i=r.facet($).markerFilter;i&&(t=i(t,r));let a=t.slice().sort((e,t)=>e.from-t.from||e.to-t.to),o=new w,s=[],c=0,l=r.doc.iter(),u=0,d=r.doc.length;for(let e=0;;){let t=e==a.length?null:a[e];if(!t&&!s.length)break;let n,r;if(s.length)n=c,r=s.reduce((e,t)=>Math.min(e,t.to),t&&t.from>n?t.from:1e8);else{if(n=t.from,n>d)break;r=t.to,s.push(t),e++}for(;e<a.length;){let t=a[e];if(t.from==n&&(t.to>t.from||t.to==n))s.push(t),e++,r=Math.min(t.to,r);else{r=Math.min(t.from,r);break}}r=Math.min(r,d);let i=!1;if(s.some(e=>e.from==n&&(e.to==r||r==d))&&(i=n==r,!i&&r-n<10)){let e=n-(u+l.value.length);e>0&&(l.next(e),u=n);for(let e=n;;){if(e>=r){i=!0;break}if(!l.lineBreak&&u+l.value.length>e)break;e=u+l.value.length,u+=l.value.length,l.next()}}let f=mn(s);if(i)o.add(n,n,C.widget({widget:new sn(f),diagnostics:s.slice()}));else{let e=s.reduce((e,t)=>t.markClass?e+` `+t.markClass:e,``);o.add(n,r,C.mark({class:`cm-lintRange cm-lintRange-`+f+e,diagnostics:s.slice(),inclusiveEnd:s.some(e=>e.to>r)}))}if(c=r,c==d)break;for(let e=0;e<s.length;e++)s[e].to<=c&&s.splice(e--,1)}let f=o.finish();return new e(f,n,Z(f))}};function Z(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:i})=>{if(!(t&&i.diagnostics.indexOf(t)<0))if(!r)r=new Gt(e,n,t||i.diagnostics[0]);else if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;else r=new Gt(r.from,n,r.diagnostic)}),r}function Kt(e,t){let n=t.pos,r=t.end||n,i=e.state.facet($).hideOn(e,n,r);if(i!=null)return i;let a=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is(Jt))||e.changes.touchesRange(a.from,Math.max(a.to,r)))}function qt(e,t){return e.field(Q,!1)?t:t.concat(D.appendConfig.of(hn))}var Jt=D.define(),Yt=D.define(),Xt=D.define(),Q=x.define({create(){return new X(C.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=Z(n,e.selected.diagnostic,i)||Z(n,null,i)}!n.size&&i&&t.state.facet($).autoPanel&&(i=null),e=new X(n,i,r)}for(let n of t.effects)if(n.is(Jt)){let r=t.state.facet($).autoPanel?n.value.length?ln.open:null:e.panel;e=X.init(n.value,r,t.state)}else n.is(Yt)?e=new X(e.diagnostics,n.value?ln.open:null,e.selected):n.is(Xt)&&(e=new X(e.diagnostics,e.panel,n.value));return e},provide:e=>[M.from(e,e=>e.panel),j.decorations.from(e,e=>e.diagnostics)]}),Zt=C.mark({class:`cm-lintRange cm-lintRange-active`});function Qt(e,t,n){let{diagnostics:r}=e.state.field(Q),i,a=-1,o=-1;r.between(t-+(n<0),t+ +(n>0),(e,r,{spec:s})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return i=s.diagnostics,a=e,o=r,!1});let s=e.state.facet($).tooltipFilter;return i&&s&&(i=s(i,e.state)),i?{pos:a,end:o,above:e.state.doc.lineAt(a).to<o,create(){return{dom:$t(e,i)}}}:null}function $t(e,t){return B(`ul`,{class:`cm-tooltip-lint`},t.map(t=>on(e,t,!1)))}var en=e=>{let t=e.state.field(Q,!1);(!t||!t.panel)&&e.dispatch({effects:qt(e.state,[Yt.of(!0)])});let n=_e(e,ln.open);return n&&n.dom.querySelector(`.cm-panel-lint ul`).focus(),!0},tn=e=>{let t=e.state.field(Q,!1);return!t||!t.panel?!1:(e.dispatch({effects:Yt.of(!1)}),!0)},nn=[{key:`Mod-Shift-m`,run:en,preventDefault:!0},{key:`F8`,run:e=>{let t=e.state.field(Q,!1);if(!t)return!1;let n=e.state.selection.main,r=Z(t.diagnostics,null,n.to+1);return!r&&(r=Z(t.diagnostics,null,0),!r||r.from==n.from&&r.to==n.to)?!1:(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)}}],$=E.define({combine(e){return{sources:e.map(e=>e.source).filter(e=>e!=null),...v(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:rn,tooltipFilter:rn,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,i)=>e(n,r,i)||t(n,r,i):e:t,autoPanel:(e,t)=>e||t})}}});function rn(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function an(e){let t=[];if(e)actions:for(let{name:n}of e){for(let e=0;e<n.length;e++){let r=n[e];if(/[a-zA-Z]/.test(r)&&!t.some(e=>e.toLowerCase()==r.toLowerCase())){t.push(r);continue actions}}t.push(``)}return t}function on(e,t,n){let r=n?an(t.actions):[];return B(`li`,{class:`cm-diagnostic cm-diagnostic-`+t.severity},B(`span`,{class:`cm-diagnosticText`},t.renderMessage?t.renderMessage(e):t.message),t.actions?.map((n,i)=>{let a=!1,o=r=>{if(r.preventDefault(),a)return;a=!0;let i=Z(e.state.field(Q).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:s}=n,c=r[i]?s.indexOf(r[i]):-1,l=c<0?s:[s.slice(0,c),B(`u`,s.slice(c,c+1)),s.slice(c+1)];return B(`button`,{type:`button`,class:`cm-diagnosticAction`+(n.markClass?` `+n.markClass:``),onclick:o,onmousedown:o,"aria-label":` Action: ${s}${c<0?``:` (access key "${r[i]})"`}.`},l)}),t.source&&B(`div`,{class:`cm-diagnosticSource`},t.source))}var sn=class extends g{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return B(`span`,{class:`cm-lintPoint cm-lintPoint-`+this.sev})}},cn=class{constructor(e,t){this.diagnostic=t,this.id=`item_`+Math.floor(Math.random()*4294967295).toString(16),this.dom=on(e,t,!0),this.dom.id=this.id,this.dom.setAttribute(`role`,`option`)}},ln=class e{constructor(e){this.view=e,this.items=[],this.list=B(`ul`,{tabIndex:0,role:`listbox`,"aria-label":this.view.state.phrase(`Diagnostics`),onkeydown:t=>{if(!(t.ctrlKey||t.altKey||t.metaKey)){if(t.keyCode==27)tn(this.view),this.view.focus();else if(t.keyCode==38||t.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(t.keyCode==40||t.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(t.keyCode==36)this.moveSelection(0);else if(t.keyCode==35)this.moveSelection(this.items.length-1);else if(t.keyCode==13)this.view.focus();else if(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:n}=this.items[this.selectedIndex],r=an(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=Z(this.view.state.field(Q).diagnostics,n);t&&n.actions[i].apply(e,t.from,t.to)}}else return;t.preventDefault()}},onclick:e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)}}),this.dom=B(`div`,{class:`cm-panel-lint`},this.list,B(`button`,{type:`button`,name:`close`,"aria-label":this.view.state.phrase(`close`),onclick:()=>tn(this.view)},`×`)),this.update()}get selectedIndex(){let e=this.view.state.field(Q).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(Q),n=0,r=!1,i=null,a=new Set;for(e.between(0,this.view.state.doc.length,(e,o,{spec:s})=>{for(let e of s.diagnostics){if(a.has(e))continue;a.add(e);let o=-1,s;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){o=t;break}o<0?(s=new cn(this.view,e),this.items.splice(n,0,s),r=!0):(s=this.items[o],o>n&&(this.items.splice(n,o-n),r=!0)),t&&s.diagnostic==t.diagnostic?s.dom.hasAttribute(`aria-selected`)||(s.dom.setAttribute(`aria-selected`,`true`),i=s):s.dom.hasAttribute(`aria-selected`)&&s.dom.removeAttribute(`aria-selected`),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new cn(this.view,{from:-1,to:-1,severity:`info`,message:this.view.state.phrase(`No diagnostics`)})),r=!0),i?(this.list.setAttribute(`aria-activedescendant`,i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute(`aria-activedescendant`),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=Z(this.view.state.field(Q).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:Xt.of(t)})}static open(t){return new e(t)}};function un(e,t=`viewBox="0 0 40 40"`){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function dn(e){return un(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,`width="6" height="3"`)}var fn=j.baseTheme({".cm-diagnostic":{padding:`3px 6px 3px 8px`,marginLeft:`-1px`,display:`block`,whiteSpace:`pre-wrap`},".cm-diagnostic-error":{borderLeft:`5px solid #d11`},".cm-diagnostic-warning":{borderLeft:`5px solid orange`},".cm-diagnostic-info":{borderLeft:`5px solid #999`},".cm-diagnostic-hint":{borderLeft:`5px solid #66d`},".cm-diagnosticAction":{font:`inherit`,border:`none`,padding:`2px 4px`,backgroundColor:`#444`,color:`white`,borderRadius:`3px`,marginLeft:`8px`,cursor:`pointer`},".cm-diagnosticSource":{fontSize:`70%`,opacity:.7},".cm-lintRange":{backgroundPosition:`left bottom`,backgroundRepeat:`repeat-x`,paddingBottom:`0.7px`},".cm-lintRange-error":{backgroundImage:dn(`#d11`)},".cm-lintRange-warning":{backgroundImage:dn(`orange`)},".cm-lintRange-info":{backgroundImage:dn(`#999`)},".cm-lintRange-hint":{backgroundImage:dn(`#66d`)},".cm-lintRange-active":{backgroundColor:`#ffdd9980`},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:`relative`,"&:after":{content:`""`,position:`absolute`,bottom:0,left:`-2px`,borderLeft:`3px solid transparent`,borderRight:`3px solid transparent`,borderBottom:`4px solid #d11`}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:`orange`}},".cm-lintPoint-info":{"&:after":{borderBottomColor:`#999`}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:`#66d`}},".cm-panel.cm-panel-lint":{position:`relative`,"& ul":{maxHeight:`100px`,overflowY:`auto`,"& [aria-selected]":{backgroundColor:`#ddd`,"& u":{textDecoration:`underline`}},"&:focus [aria-selected]":{background_fallback:`#bdf`,backgroundColor:`Highlight`,color_fallback:`white`,color:`HighlightText`},"& u":{textDecoration:`none`},padding:0,margin:0},"& [name=close]":{position:`absolute`,top:`0`,right:`2px`,background:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:`#86714a80`},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:`#2e343e`}}});function pn(e){return e==`error`?4:e==`warning`?3:e==`info`?2:1}function mn(e){let t=`hint`,n=1;for(let r of e){let e=pn(r.severity);e>n&&(n=e,t=r.severity)}return t}var hn=[Q,j.decorations.compute([Q],e=>{let{selected:t,panel:n}=e.field(Q);return!t||!n||t.from==t.to?C.none:C.set([Zt.range(t.from,t.to)])}),pe(Qt,{hideOn:Kt}),fn],gn=[P(),ve(),N(),l(),de(),ye(),he(),y.allowMultipleSelections.of(!0),ue(),T(I,{fallback:!0}),fe(),Ee(),we(),me(),F(),ge(),tt(),be.of([...Ce,...c,...Rt,...o,...xe,...Te,...nn])];N(),l(),ye(),T(I,{fallback:!0}),be.of([...c,...o]);export{je as a,Me as i,ze as n,Ae as o,Be as r,gn as t};
|
|
1
|
+
import{o as e}from"./chunk-CFjPhJqf.js";import{a as t,i as n,o as r,r as i,t as a}from"./compiler-runtime-Cs91PcD2.js";import{A as o,j as s,k as c,n as l,ut as u,wn as d}from"./DocumentContext-DTuvLW_x.js";import{a as f,c as ee,i as te,n as ne,o as re,r as ie,s as ae,t as oe,u as se}from"./panel-BNBODYwB.js";import{Ai as p,Xt as m,qt as h,u as ce}from"./prop-types-CMBUMzzz.js";import{S as le}from"./button-DenIdY-r.js";import{$ as g,At as _,Bt as v,Dt as y,E as ue,Et as b,Ft as x,Ht as S,J as C,Mt as w,N as T,Ot as E,Pt as D,Q as O,Rt as k,Ut as A,X as j,_ as de,_t as M,ct as N,dt as P,et as F,f as I,gt as L,ht as R,l as fe,lt as pe,mt as me,nt as he,ot as ge,rt as _e,st as ve,tt as ye,ut as be,wt as z,y as xe,yt as B,zt as Se}from"./dist-sw9fzKjM.js";import{i as Ce,n as we,o as Te,r as Ee}from"./dist-Cwt7KtW7.js";var De=e(t(),1),Oe=a(),ke=new Map;function Ae(e,t){ke.set(e,t)}function je(e){let t=ke.get(e)??null;return ke.delete(e),t}function Me(e){ke.delete(e)}function Ne(e,t){let n=(0,Oe.c)(4),r=t===void 0?!1:t,[i,a]=(0,De.useState)(void 0),o=(0,De.useRef)(null),s,c;return n[0]!==r||n[1]!==e?(s=()=>{if(r||e.length===0){a(void 0);return}let t=function(){let t=window.innerHeight/2,n,r;for(let i of e){let e=document.getElementById(i);if(!e)continue;let a=e.getBoundingClientRect().top;a<0?n=i:r===void 0&&a<t&&(r=i)}a(r??n??e[0])},n=function(){o.current===null&&(o.current=requestAnimationFrame(()=>{o.current=null,t()}))};return document.addEventListener(`scroll`,n,{capture:!0,passive:!0}),t(),()=>{document.removeEventListener(`scroll`,n,{capture:!0}),o.current!==null&&(cancelAnimationFrame(o.current),o.current=null)}},c=[e,r],n[0]=r,n[1]=e,n[2]=s,n[3]=c):(s=n[2],c=n[3]),(0,De.useEffect)(s,c),i}var V=r(),Pe=300;async function Fe(e){let t=await fetch(`/api/page-headings?docName=${encodeURIComponent(e)}`),n;try{n=await t.json()}catch(e){throw new u(p._({id:`qAQVSD`}),{cause:e,status:t.status})}if(!t.ok){let e=m.safeParse(n);throw e.success?Error(e.data.title):new u(p._({id:`zlErBl`}),{status:t.status})}let r=h.safeParse(n);if(!r.success)throw new u(p._({id:`XW18jo`}),{status:t.status});return r.data.headings??[]}var Ie=32,Le=12,Re=6,ze=`open-knowledge:outline-nav`;function Be(e){let t=(0,Oe.c)(2),n;return t[0]===e?n=t[1]:(n=(0,V.jsx)(d,{name:`outline-panel`,children:(0,V.jsx)(Ve,{...e})}),t[0]=e,t[1]=n),n}function Ve(e){let t=(0,Oe.c)(50),{docName:r,isSourceMode:a,className:o}=e,s=o===void 0?``:o,{_:c}=n(),{pages:u,loading:d}=ce(),p=se(),{activeProvider:m,activeDocName:h}=l(),g,_;t[0]===r?(g=t[1],_=t[2]):(g=[`page-headings`,r],_=()=>Fe(r),t[0]=r,t[1]=g,t[2]=_);let v;t[3]!==r||t[4]!==d||t[5]!==u?(v=!d&&u.has(r),t[3]=r,t[4]=d,t[5]=u,t[6]=v):v=t[6];let y;t[7]!==g||t[8]!==_||t[9]!==v?(y={queryKey:g,queryFn:_,enabled:v,staleTime:1/0},t[7]=g,t[8]=_,t[9]=v,t[10]=y):y=t[10];let{data:ue,isLoading:b,error:x}=ee(y),S;t[11]===ue?S=t[12]:(S=ue===void 0?[]:ue,t[11]=ue,t[12]=S);let C=S,w,T;t[13]!==h||t[14]!==m||t[15]!==r||t[16]!==p?(w=()=>{if(!m||h!==r)return;let e=m.document,t=null,n=()=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{t=null,p.invalidateQueries({queryKey:[`page-headings`,r]})},Pe)};return e.on(`update`,n),()=>{e.off(`update`,n),t!==null&&clearTimeout(t)}},T=[m,h,r,p],t[13]=h,t[14]=m,t[15]=r,t[16]=p,t[17]=w,t[18]=T):(w=t[17],T=t[18]),(0,De.useEffect)(w,T);let E;t[19]===C?E=t[20]:(E=C.map(He),t[19]=C,t[20]=E);let D=Ne(E,a),O;t[21]!==D||t[22]!==C?(O=D?C.findIndex(e=>e.slug===D):-1,t[21]=D,t[22]=C,t[23]=O):O=t[23];let k=O,A;t[24]!==r||t[25]!==a?(A=function(e,t){let n={index:e,slug:t,mode:a?`source`:`wysiwyg`};n.mode===`source`&&Ae(r,{kind:`outline`,detail:n}),window.dispatchEvent(new CustomEvent(ze,{detail:n}))},t[24]=r,t[25]=a,t[26]=A):A=t[26];let j=A,de=((k>=0?C[k].level:1)-1)*Le+(Le-Re)/2,M=k*Ie+(Ie-Re)/2,N;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,V.jsx)(ae,{children:(0,V.jsx)(i,{id:`dD7NPy`})}),t[27]=N):N=t[27];let P;t[28]!==C.length||t[29]!==b?(P=!b&&(0,V.jsx)(ie,{children:C.length}),t[28]=C.length,t[29]=b,t[30]=P):P=t[30];let F;t[31]===P?F=t[32]:(F=(0,V.jsxs)(re,{children:[N,P]}),t[31]=P,t[32]=F);let I;t[33]!==c||t[34]!==k||t[35]!==D||t[36]!==x||t[37]!==j||t[38]!==C||t[39]!==b||t[40]!==de||t[41]!==M?(I=x?(0,V.jsx)(f,{className:`px-2`,children:x instanceof Error?x.message:c({id:`GuqOb1`})}):C.length===0&&!b?(0,V.jsx)(te,{className:`px-2`,children:(0,V.jsx)(i,{id:`0BB9ID`})}):(0,V.jsxs)(`nav`,{"aria-label":c({id:`BymzO4`}),className:`relative`,children:[k>=0&&(0,V.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute left-0 top-0 rounded-full bg-primary motion-safe:[transition:transform_0.25s_var(--ease-out-strong)]`,style:{width:Re,height:Re,transform:`translate(${de}px, ${M}px)`}}),C.map((e,t)=>{let n=e.slug===D;return(0,V.jsx)(`button`,{type:`button`,"aria-current":n?`location`:void 0,onClick:()=>j(t,e.slug),className:le(`w-full cursor-pointer truncate py-1.5 pe-2 text-left text-sm transition-colors`,n?`font-medium text-primary`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${(e.level-1)*Le+20}px`},title:e.text,children:e.text},t)})]}),t[33]=c,t[34]=k,t[35]=D,t[36]=x,t[37]=j,t[38]=C,t[39]=b,t[40]=de,t[41]=M,t[42]=I):I=t[42];let L;t[43]!==b||t[44]!==I?(L=(0,V.jsx)(ne,{className:`px-3 py-2`,"aria-busy":b,children:I}),t[43]=b,t[44]=I,t[45]=L):L=t[45];let R;return t[46]!==s||t[47]!==F||t[48]!==L?(R=(0,V.jsxs)(oe,{className:s,children:[F,L]}),t[46]=s,t[47]=F,t[48]=L,t[49]=R):R=t[49],R}function He(e){return e.slug}var Ue=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,H=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(Ue(e)):Ue,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return k(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=A(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=Se(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n;;e++){let a=r.charCodeAt(e),o=this.match(a,i,this.bufferPos+this.bufferStart);if(e==r.length-1){if(o)return this.value=o,this;break}i==n&&e<t.length&&t.charCodeAt(e)==a&&i++}}}match(e,t,n){let r=null;for(let t=0;t<this.matches.length;t+=2){let i=this.matches[t],a=!1;this.query.charCodeAt(i)==e&&(i==this.query.length-1?r={from:this.matches[t+1],to:n}:(this.matches[t]++,a=!0)),a||(this.matches.splice(t,2),t-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?r={from:t,to:n}:this.matches.push(1,t)),r&&this.test&&!this.test(r.from,r.to,this.buffer,this.bufferStart)&&(r=null),r}};typeof Symbol<`u`&&(H.prototype[Symbol.iterator]=function(){return this});var We={from:-1,to:-1,match:/.*/.exec(``)},Ge=`gm`+(/x/.unicode==null?``:`u`),Ke=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=We,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new Ye(e,t,n,r,i);this.re=new RegExp(t,Ge+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter(),this.curLineStart=e.lineAt(r).from,this.matchPos=Ze(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=Ze(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},qe=new WeakMap,Je=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=qe.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return qe.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),qe.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},Ye=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=We,this.matchPos=Ze(e,r),this.re=new RegExp(t,Ge+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=Je.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,match:t},this.matchPos=Ze(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Je.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(Ke.prototype[Symbol.iterator]=Ye.prototype[Symbol.iterator]=function(){return this});function Xe(e){try{return new RegExp(e,Ge),!0}catch{return!1}}function Ze(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var Qe=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:r,result:i}=L(e,{label:t.phrase(`Go to line`),input:{type:`text`,name:`line`,value:n},focus:!0,submitLabel:t.phrase(`go`)});return i.then(n=>{let i=n&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.elements.line.value);if(!i){e.dispatch({effects:r});return}let a=t.doc.lineAt(t.selection.main.head),[,o,s,c,l]=i,u=c?+c.slice(1):0,d=s?+s:a.number;if(s&&l){let e=d/100;o&&(e=e*(o==`-`?-1:1)+a.number/t.doc.lines),d=Math.round(t.doc.lines*e)}else s&&o&&(d=d*(o==`-`?-1:1)+a.number);let f=t.doc.line(Math.max(1,Math.min(t.doc.lines,d))),ee=b.cursor(f.from+Math.max(0,Math.min(u,f.length)));e.dispatch({effects:[r,j.scrollIntoView(ee.from,{y:`center`})],selection:ee})}),!0},$e={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},et=E.define({combine(e){return v(e,$e,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function tt(e){let t=[st,ot];return e&&t.push(et.of(e)),t}var nt=C.mark({class:`cm-selectionMatch`}),rt=C.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function it(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=z.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=z.Word)}function at(e,t,n,r){return e(t.sliceDoc(n,n+1))==z.Word&&e(t.sliceDoc(r-1,r))==z.Word}var ot=O.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(et),{state:n}=e,r=n.selection;if(r.ranges.length>1)return C.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return C.none;let e=n.wordAt(i.head);if(!e)return C.none;o=n.charCategorizer(i.head),a=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return C.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(it(o,n,i.from,i.to)&&at(o,n,i.from,i.to)))return C.none}else if(a=n.sliceDoc(i.from,i.to),!a)return C.none}let s=[];for(let r of e.visibleRanges){let e=new H(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||it(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push(rt.range(r,a)):(r>=i.to||a<=i.from)&&s.push(nt.range(r,a)),s.length>t.maxMatches))return C.none}}return C.set(s)}},{decorations:e=>e.decorations}),st=j.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),ct=({state:e,dispatch:t})=>{let{selection:n}=e,r=b.create(n.ranges.map(t=>e.wordAt(t.head)||b.cursor(t.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function lt(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new H(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new H(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var ut=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return ct({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=lt(e,r);return i?(t(e.update({selection:e.selection.addRange(b.range(i.from,i.to),!1),effects:j.scrollIntoView(i.to)})),!0):!1},U=E.define({combine(e){return v(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new zt(e),scrollToMatch:e=>j.scrollIntoView(e)})}}),dt=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||Xe(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?`
|
|
2
|
+
`:t==`r`?`\r`:t==`t`?` `:`\\`)}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new bt(this):new ht(this)}getCursor(e,t=0,n){let r=e.doc?e:y.create({doc:e});return n??=r.doc.length,this.regexp?G(this,r,t,n):W(this,r,t,n)}},ft=class{constructor(e){this.spec=e}};function pt(e,t,n){return(r,i,a,o)=>n&&!n(r,i,a,o)?!1:e(r>=o&&i<=o+a.length?a.slice(r-o,i-o):t.doc.sliceString(r,i),t,r,i)}function W(e,t,n,r){let i;return e.wholeWord&&(i=mt(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=pt(e.test,t,i)),new H(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function mt(e,t){return(n,r,i,a)=>((a>n||a+i.length<r)&&(a=Math.max(0,n-2),i=e.sliceString(a,Math.min(e.length,r+2))),(t(_t(i,n-a))!=z.Word||t(vt(i,n-a))!=z.Word)&&(t(vt(i,r-a))!=z.Word||t(_t(i,r-a))!=z.Word))}var ht=class extends ft{constructor(e){super(e)}nextMatch(e,t,n){let r=W(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=W(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=W(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=W(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=W(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}};function gt(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function G(e,t,n,r){let i;return e.wholeWord&&(i=yt(t.charCategorizer(t.selection.main.head))),e.test&&(i=gt(e.test,t,i)),new Ke(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function _t(e,t){return e.slice(S(e,t,!1),t)}function vt(e,t){return e.slice(t,S(e,t))}function yt(e){return(t,n,r)=>!r[0].length||(e(_t(r.input,r.index))!=z.Word||e(vt(r.input,r.index))!=z.Word)&&(e(vt(r.input,r.index+r[0].length))!=z.Word||e(_t(r.input,r.index+r[0].length))!=z.Word)}var bt=class extends ft{nextMatch(e,t,n){let r=G(this.spec,e,n,e.doc.length).next();return r.done&&(r=G(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-r*1e4),a=G(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n==`&`)return e.match[0];if(n==`$`)return`$`;for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=G(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=G(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}},K=D.define(),xt=D.define(),q=x.define({create(e){return new St(Nt(e).create(),null)},update(e,t){for(let n of t.effects)n.is(K)?e=new St(n.value.create(),e.panel):n.is(xt)&&(e=new St(e.query,n.value?Mt:null));return e},provide:e=>M.from(e,e=>e.panel)}),St=class{constructor(e,t){this.query=e,this.panel=t}},Ct=C.mark({class:`cm-searchMatch`}),wt=C.mark({class:`cm-searchMatch cm-searchMatch-selected`}),Tt=O.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(q))}update(e){let t=e.state.field(q);(t!=e.startState.field(q)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return C.none;let{view:n}=this,r=new w;for(let t=0,i=n.visibleRanges,a=i.length;t<a;t++){let{from:o,to:s}=i[t];for(;t<a-1&&s>i[t+1].from-500;)s=i[++t].to;e.highlight(n.state,o,s,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?wt:Ct)})}return r.finish()}},{decorations:e=>e.decorations});function J(e){return t=>{let n=t.state.field(q,!1);return n&&n.query.spec.valid?e(t,n):It(t)}}var Et=J((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=b.single(r.from,r.to),a=e.state.facet(U);return e.dispatch({selection:i,effects:[Ht(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),Ft(e),!0}),Dt=J((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=b.single(i.from,i.to),o=e.state.facet(U);return e.dispatch({selection:a,effects:[Ht(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),Ft(e),!0}),Ot=J((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:b.create(n.map(e=>b.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),kt=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,a=[],o=0;for(let t=new H(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(b.range(t.value.from,t.value.to))}return t(e.update({selection:b.create(a,o),userEvent:`select.search.matches`})),!0},At=J((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let o=a,s=[],c,l,u=[];o.from==r&&o.to==i&&(l=n.toText(t.getReplacement(o)),s.push({from:o.from,to:o.to,insert:l}),o=t.nextMatch(n,o.from,o.to),u.push(j.announce.of(n.phrase(`replaced match on line $`,n.doc.lineAt(r).number)+`.`)));let d=e.state.changes(s);return o&&(c=b.single(o.from,o.to).map(d),u.push(Ht(e,o)),u.push(n.facet(U).scrollToMatch(c.main,e))),e.dispatch({changes:d,selection:c,effects:u,userEvent:`input.replace`}),!0}),jt=J((e,{query:t})=>{if(e.state.readOnly)return!1;let n=t.matchAll(e.state,1e9).map(e=>{let{from:n,to:r}=e;return{from:n,to:r,insert:t.getReplacement(e)}});if(!n.length)return!1;let r=e.state.phrase(`replaced $ matches`,n.length)+`.`;return e.dispatch({changes:n,effects:j.announce.of(r),userEvent:`input.replace.all`}),!0});function Mt(e){return e.state.facet(U).createPanel(e)}function Nt(e,t){let n=e.selection.main,r=n.empty||n.to>n.from+100?``:e.sliceDoc(n.from,n.to);if(t&&!r)return t;let i=e.facet(U);return new dt({search:t?.literal??i.literal?r:r.replace(/\n/g,`\\n`),caseSensitive:t?.caseSensitive??i.caseSensitive,literal:t?.literal??i.literal,regexp:t?.regexp??i.regexp,wholeWord:t?.wholeWord??i.wholeWord})}function Pt(e){let t=_e(e,Mt);return t&&t.dom.querySelector(`[main-field]`)}function Ft(e){let t=Pt(e);t&&t==e.root.activeElement&&t.select()}var It=e=>{let t=e.state.field(q,!1);if(t&&t.panel){let n=Pt(e);if(n&&n!=e.root.activeElement){let r=Nt(e.state,t.query.spec);r.valid&&e.dispatch({effects:K.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[xt.of(!0),t?K.of(Nt(e.state,t.query.spec)):D.appendConfig.of(Wt)]});return!0},Lt=e=>{let t=e.state.field(q,!1);if(!t||!t.panel)return!1;let n=_e(e,Mt);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:xt.of(!1)}),!0},Rt=[{key:`Mod-f`,run:It,scope:`editor search-panel`},{key:`F3`,run:Et,shift:Dt,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:Et,shift:Dt,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:Lt,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:kt},{key:`Mod-Alt-g`,run:Qe},{key:`Mod-d`,run:ut,preventDefault:!0}],zt=class{constructor(e){this.view=e;let t=this.query=e.state.field(q).query.spec;this.commit=this.commit.bind(this),this.searchField=B(`input`,{value:t.search,placeholder:Y(e,`Find`),"aria-label":Y(e,`Find`),class:`cm-textfield`,name:`search`,form:``,"main-field":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=B(`input`,{value:t.replace,placeholder:Y(e,`Replace`),"aria-label":Y(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=B(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=B(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=B(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return B(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=B(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>Et(e),[Y(e,`next`)]),n(`prev`,()=>Dt(e),[Y(e,`previous`)]),n(`select`,()=>Ot(e),[Y(e,`all`)]),B(`label`,null,[this.caseField,Y(e,`match case`)]),B(`label`,null,[this.reField,Y(e,`regexp`)]),B(`label`,null,[this.wordField,Y(e,`by word`)]),...e.state.readOnly?[]:[B(`br`),this.replaceField,n(`replace`,()=>At(e),[Y(e,`replace`)]),n(`replaceAll`,()=>jt(e),[Y(e,`replace all`)])],B(`button`,{name:`close`,onclick:()=>Lt(e),"aria-label":Y(e,`close`),type:`button`},[`×`])])}commit(){let e=new dt({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:K.of(e)}))}keydown(e){R(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Dt:Et)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),At(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(K)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(U).top}};function Y(e,t){return e.state.phrase(t)}var Bt=30,Vt=/[\s\.,:;?!]/;function Ht(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-Bt),o=Math.min(i,n+Bt),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<Bt;e++)if(!Vt.test(s[e+1])&&Vt.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-Bt;e--)if(!Vt.test(s[e-1])&&Vt.test(s[e])){s=s.slice(0,e);break}}return j.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var Ut=j.baseTheme({".cm-panel.cm-search":{padding:`2px 6px 4px`,position:`relative`,"& [name=close]":{position:`absolute`,top:`0`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0},"& input, & button, & label":{margin:`.2em .6em .2em 0`},"& input[type=checkbox]":{marginRight:`.2em`},"& label":{fontSize:`80%`,whiteSpace:`pre`}},"&light .cm-searchMatch":{backgroundColor:`#ffff0054`},"&dark .cm-searchMatch":{backgroundColor:`#00ffff8a`},"&light .cm-searchMatch-selected":{backgroundColor:`#ff6a0054`},"&dark .cm-searchMatch-selected":{backgroundColor:`#ff00ff8a`}}),Wt=[q,_.low(Tt),Ut],Gt=class{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}},X=class e{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(t,n,r){let i=r.facet($).markerFilter;i&&(t=i(t,r));let a=t.slice().sort((e,t)=>e.from-t.from||e.to-t.to),o=new w,s=[],c=0,l=r.doc.iter(),u=0,d=r.doc.length;for(let e=0;;){let t=e==a.length?null:a[e];if(!t&&!s.length)break;let n,r;if(s.length)n=c,r=s.reduce((e,t)=>Math.min(e,t.to),t&&t.from>n?t.from:1e8);else{if(n=t.from,n>d)break;r=t.to,s.push(t),e++}for(;e<a.length;){let t=a[e];if(t.from==n&&(t.to>t.from||t.to==n))s.push(t),e++,r=Math.min(t.to,r);else{r=Math.min(t.from,r);break}}r=Math.min(r,d);let i=!1;if(s.some(e=>e.from==n&&(e.to==r||r==d))&&(i=n==r,!i&&r-n<10)){let e=n-(u+l.value.length);e>0&&(l.next(e),u=n);for(let e=n;;){if(e>=r){i=!0;break}if(!l.lineBreak&&u+l.value.length>e)break;e=u+l.value.length,u+=l.value.length,l.next()}}let f=mn(s);if(i)o.add(n,n,C.widget({widget:new sn(f),diagnostics:s.slice()}));else{let e=s.reduce((e,t)=>t.markClass?e+` `+t.markClass:e,``);o.add(n,r,C.mark({class:`cm-lintRange cm-lintRange-`+f+e,diagnostics:s.slice(),inclusiveEnd:s.some(e=>e.to>r)}))}if(c=r,c==d)break;for(let e=0;e<s.length;e++)s[e].to<=c&&s.splice(e--,1)}let f=o.finish();return new e(f,n,Z(f))}};function Z(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:i})=>{if(!(t&&i.diagnostics.indexOf(t)<0))if(!r)r=new Gt(e,n,t||i.diagnostics[0]);else if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;else r=new Gt(r.from,n,r.diagnostic)}),r}function Kt(e,t){let n=t.pos,r=t.end||n,i=e.state.facet($).hideOn(e,n,r);if(i!=null)return i;let a=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is(Jt))||e.changes.touchesRange(a.from,Math.max(a.to,r)))}function qt(e,t){return e.field(Q,!1)?t:t.concat(D.appendConfig.of(hn))}var Jt=D.define(),Yt=D.define(),Xt=D.define(),Q=x.define({create(){return new X(C.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=Z(n,e.selected.diagnostic,i)||Z(n,null,i)}!n.size&&i&&t.state.facet($).autoPanel&&(i=null),e=new X(n,i,r)}for(let n of t.effects)if(n.is(Jt)){let r=t.state.facet($).autoPanel?n.value.length?ln.open:null:e.panel;e=X.init(n.value,r,t.state)}else n.is(Yt)?e=new X(e.diagnostics,n.value?ln.open:null,e.selected):n.is(Xt)&&(e=new X(e.diagnostics,e.panel,n.value));return e},provide:e=>[M.from(e,e=>e.panel),j.decorations.from(e,e=>e.diagnostics)]}),Zt=C.mark({class:`cm-lintRange cm-lintRange-active`});function Qt(e,t,n){let{diagnostics:r}=e.state.field(Q),i,a=-1,o=-1;r.between(t-+(n<0),t+ +(n>0),(e,r,{spec:s})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return i=s.diagnostics,a=e,o=r,!1});let s=e.state.facet($).tooltipFilter;return i&&s&&(i=s(i,e.state)),i?{pos:a,end:o,above:e.state.doc.lineAt(a).to<o,create(){return{dom:$t(e,i)}}}:null}function $t(e,t){return B(`ul`,{class:`cm-tooltip-lint`},t.map(t=>on(e,t,!1)))}var en=e=>{let t=e.state.field(Q,!1);(!t||!t.panel)&&e.dispatch({effects:qt(e.state,[Yt.of(!0)])});let n=_e(e,ln.open);return n&&n.dom.querySelector(`.cm-panel-lint ul`).focus(),!0},tn=e=>{let t=e.state.field(Q,!1);return!t||!t.panel?!1:(e.dispatch({effects:Yt.of(!1)}),!0)},nn=[{key:`Mod-Shift-m`,run:en,preventDefault:!0},{key:`F8`,run:e=>{let t=e.state.field(Q,!1);if(!t)return!1;let n=e.state.selection.main,r=Z(t.diagnostics,null,n.to+1);return!r&&(r=Z(t.diagnostics,null,0),!r||r.from==n.from&&r.to==n.to)?!1:(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)}}],$=E.define({combine(e){return{sources:e.map(e=>e.source).filter(e=>e!=null),...v(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:rn,tooltipFilter:rn,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,i)=>e(n,r,i)||t(n,r,i):e:t,autoPanel:(e,t)=>e||t})}}});function rn(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function an(e){let t=[];if(e)actions:for(let{name:n}of e){for(let e=0;e<n.length;e++){let r=n[e];if(/[a-zA-Z]/.test(r)&&!t.some(e=>e.toLowerCase()==r.toLowerCase())){t.push(r);continue actions}}t.push(``)}return t}function on(e,t,n){let r=n?an(t.actions):[];return B(`li`,{class:`cm-diagnostic cm-diagnostic-`+t.severity},B(`span`,{class:`cm-diagnosticText`},t.renderMessage?t.renderMessage(e):t.message),t.actions?.map((n,i)=>{let a=!1,o=r=>{if(r.preventDefault(),a)return;a=!0;let i=Z(e.state.field(Q).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:s}=n,c=r[i]?s.indexOf(r[i]):-1,l=c<0?s:[s.slice(0,c),B(`u`,s.slice(c,c+1)),s.slice(c+1)];return B(`button`,{type:`button`,class:`cm-diagnosticAction`+(n.markClass?` `+n.markClass:``),onclick:o,onmousedown:o,"aria-label":` Action: ${s}${c<0?``:` (access key "${r[i]})"`}.`},l)}),t.source&&B(`div`,{class:`cm-diagnosticSource`},t.source))}var sn=class extends g{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return B(`span`,{class:`cm-lintPoint cm-lintPoint-`+this.sev})}},cn=class{constructor(e,t){this.diagnostic=t,this.id=`item_`+Math.floor(Math.random()*4294967295).toString(16),this.dom=on(e,t,!0),this.dom.id=this.id,this.dom.setAttribute(`role`,`option`)}},ln=class e{constructor(e){this.view=e,this.items=[],this.list=B(`ul`,{tabIndex:0,role:`listbox`,"aria-label":this.view.state.phrase(`Diagnostics`),onkeydown:t=>{if(!(t.ctrlKey||t.altKey||t.metaKey)){if(t.keyCode==27)tn(this.view),this.view.focus();else if(t.keyCode==38||t.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(t.keyCode==40||t.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(t.keyCode==36)this.moveSelection(0);else if(t.keyCode==35)this.moveSelection(this.items.length-1);else if(t.keyCode==13)this.view.focus();else if(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:n}=this.items[this.selectedIndex],r=an(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=Z(this.view.state.field(Q).diagnostics,n);t&&n.actions[i].apply(e,t.from,t.to)}}else return;t.preventDefault()}},onclick:e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)}}),this.dom=B(`div`,{class:`cm-panel-lint`},this.list,B(`button`,{type:`button`,name:`close`,"aria-label":this.view.state.phrase(`close`),onclick:()=>tn(this.view)},`×`)),this.update()}get selectedIndex(){let e=this.view.state.field(Q).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(Q),n=0,r=!1,i=null,a=new Set;for(e.between(0,this.view.state.doc.length,(e,o,{spec:s})=>{for(let e of s.diagnostics){if(a.has(e))continue;a.add(e);let o=-1,s;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){o=t;break}o<0?(s=new cn(this.view,e),this.items.splice(n,0,s),r=!0):(s=this.items[o],o>n&&(this.items.splice(n,o-n),r=!0)),t&&s.diagnostic==t.diagnostic?s.dom.hasAttribute(`aria-selected`)||(s.dom.setAttribute(`aria-selected`,`true`),i=s):s.dom.hasAttribute(`aria-selected`)&&s.dom.removeAttribute(`aria-selected`),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new cn(this.view,{from:-1,to:-1,severity:`info`,message:this.view.state.phrase(`No diagnostics`)})),r=!0),i?(this.list.setAttribute(`aria-activedescendant`,i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute(`aria-activedescendant`),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=Z(this.view.state.field(Q).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:Xt.of(t)})}static open(t){return new e(t)}};function un(e,t=`viewBox="0 0 40 40"`){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function dn(e){return un(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,`width="6" height="3"`)}var fn=j.baseTheme({".cm-diagnostic":{padding:`3px 6px 3px 8px`,marginLeft:`-1px`,display:`block`,whiteSpace:`pre-wrap`},".cm-diagnostic-error":{borderLeft:`5px solid #d11`},".cm-diagnostic-warning":{borderLeft:`5px solid orange`},".cm-diagnostic-info":{borderLeft:`5px solid #999`},".cm-diagnostic-hint":{borderLeft:`5px solid #66d`},".cm-diagnosticAction":{font:`inherit`,border:`none`,padding:`2px 4px`,backgroundColor:`#444`,color:`white`,borderRadius:`3px`,marginLeft:`8px`,cursor:`pointer`},".cm-diagnosticSource":{fontSize:`70%`,opacity:.7},".cm-lintRange":{backgroundPosition:`left bottom`,backgroundRepeat:`repeat-x`,paddingBottom:`0.7px`},".cm-lintRange-error":{backgroundImage:dn(`#d11`)},".cm-lintRange-warning":{backgroundImage:dn(`orange`)},".cm-lintRange-info":{backgroundImage:dn(`#999`)},".cm-lintRange-hint":{backgroundImage:dn(`#66d`)},".cm-lintRange-active":{backgroundColor:`#ffdd9980`},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:`relative`,"&:after":{content:`""`,position:`absolute`,bottom:0,left:`-2px`,borderLeft:`3px solid transparent`,borderRight:`3px solid transparent`,borderBottom:`4px solid #d11`}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:`orange`}},".cm-lintPoint-info":{"&:after":{borderBottomColor:`#999`}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:`#66d`}},".cm-panel.cm-panel-lint":{position:`relative`,"& ul":{maxHeight:`100px`,overflowY:`auto`,"& [aria-selected]":{backgroundColor:`#ddd`,"& u":{textDecoration:`underline`}},"&:focus [aria-selected]":{background_fallback:`#bdf`,backgroundColor:`Highlight`,color_fallback:`white`,color:`HighlightText`},"& u":{textDecoration:`none`},padding:0,margin:0},"& [name=close]":{position:`absolute`,top:`0`,right:`2px`,background:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:`#86714a80`},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:`#2e343e`}}});function pn(e){return e==`error`?4:e==`warning`?3:e==`info`?2:1}function mn(e){let t=`hint`,n=1;for(let r of e){let e=pn(r.severity);e>n&&(n=e,t=r.severity)}return t}var hn=[Q,j.decorations.compute([Q],e=>{let{selected:t,panel:n}=e.field(Q);return!t||!n||t.from==t.to?C.none:C.set([Zt.range(t.from,t.to)])}),pe(Qt,{hideOn:Kt}),fn],gn=[P(),ve(),N(),o(),de(),ye(),he(),y.allowMultipleSelections.of(!0),ue(),T(I,{fallback:!0}),fe(),Ee(),we(),me(),F(),ge(),tt(),be.of([...Ce,...c,...Rt,...s,...xe,...Te,...nn])];N(),o(),ye(),T(I,{fallback:!0}),be.of([...c,...s]);export{je as a,Me as i,ze as n,Ae as o,Be as r,gn as t};
|
package/dist/public/index.html
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
-->
|
|
49
49
|
<script>(() => { let t = 'system'; try { const r = localStorage.getItem('ok-theme-v1'); if (r === 'light' || r === 'dark' || r === 'system') t = r; } catch {} let dark = t === 'dark'; if (t === 'system') { try { dark = window.matchMedia('(prefers-color-scheme: dark)').matches; } catch {} } if (dark) document.documentElement.classList.add('dark'); if (window.okDesktop) document.documentElement.classList.add('electron-mode'); })();</script>
|
|
50
50
|
<style>html { background-color: #fafafa } html.dark { background-color: #171717 }</style>
|
|
51
|
-
<script type="module" crossorigin src="./assets/index-
|
|
51
|
+
<script type="module" crossorigin src="./assets/index-D1S1GyyV.js"></script>
|
|
52
52
|
<link rel="modulepreload" crossorigin href="./assets/chunk-CFjPhJqf.js">
|
|
53
53
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-2ej06EnG.js">
|
|
54
54
|
<link rel="modulepreload" crossorigin href="./assets/w3c-keyname-B5t0fahT.js">
|
|
@@ -61,24 +61,24 @@
|
|
|
61
61
|
<link rel="modulepreload" crossorigin href="./assets/compiler-runtime-Cs91PcD2.js">
|
|
62
62
|
<link rel="modulepreload" crossorigin href="./assets/trace-api-CiCjX4Sz.js">
|
|
63
63
|
<link rel="modulepreload" crossorigin href="./assets/button-DenIdY-r.js">
|
|
64
|
-
<link rel="modulepreload" crossorigin href="./assets/prop-types-
|
|
64
|
+
<link rel="modulepreload" crossorigin href="./assets/prop-types-CMBUMzzz.js">
|
|
65
65
|
<link rel="modulepreload" crossorigin href="./assets/propagation-api-3kmMXRwS.js">
|
|
66
66
|
<link rel="modulepreload" crossorigin href="./assets/collapsible-BhpeB6tu.js">
|
|
67
67
|
<link rel="modulepreload" crossorigin href="./assets/dialog-nKg9NzaE.js">
|
|
68
|
-
<link rel="modulepreload" crossorigin href="./assets/DocumentContext-
|
|
68
|
+
<link rel="modulepreload" crossorigin href="./assets/DocumentContext-DTuvLW_x.js">
|
|
69
69
|
<link rel="modulepreload" crossorigin href="./assets/panel-BNBODYwB.js">
|
|
70
|
-
<link rel="modulepreload" crossorigin href="./assets/typing-burst-detector-
|
|
70
|
+
<link rel="modulepreload" crossorigin href="./assets/typing-burst-detector-BC-nkePC.js">
|
|
71
71
|
<link rel="modulepreload" crossorigin href="./assets/checkbox-CBMLW0iM.js">
|
|
72
72
|
<link rel="modulepreload" crossorigin href="./assets/label-DCMZaJ38.js">
|
|
73
|
-
<link rel="modulepreload" crossorigin href="./assets/toggle-group-
|
|
73
|
+
<link rel="modulepreload" crossorigin href="./assets/toggle-group-Dx4VUJtk.js">
|
|
74
74
|
<link rel="modulepreload" crossorigin href="./assets/textarea-C_bHQrXh.js">
|
|
75
|
-
<link rel="modulepreload" crossorigin href="./assets/config-validation-events-
|
|
75
|
+
<link rel="modulepreload" crossorigin href="./assets/config-validation-events-BL3EPRrw.js">
|
|
76
76
|
<link rel="modulepreload" crossorigin href="./assets/agent-presence-DxGcS3q2.js">
|
|
77
|
-
<link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-
|
|
77
|
+
<link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-DK3GQaQx.js">
|
|
78
78
|
<link rel="modulepreload" crossorigin href="./assets/project-paths-eyh51nmQ.js">
|
|
79
79
|
<link rel="modulepreload" crossorigin href="./assets/mcp-consent-store-19Boxoxe.js">
|
|
80
80
|
<link rel="stylesheet" crossorigin href="./assets/DocumentContext-B0sQn39F.css">
|
|
81
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
81
|
+
<link rel="stylesheet" crossorigin href="./assets/index-D4TqB27u.css">
|
|
82
82
|
</head>
|
|
83
83
|
|
|
84
84
|
<body class="antialiased">
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e,u as t}from"./init-
|
|
2
|
-
//# sourceMappingURL=repair-launch-json-
|
|
1
|
+
import{n as e,u as t}from"./init-DwLGKHOJ.mjs";import{t as n}from"./is-object-C-4FJ0rP.mjs";import{join as r}from"node:path";import{existsSync as i,readFileSync as a}from"node:fs";const o=[[`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge`,`ui`]];function s(t){if(t.runtimeExecutable!==`npx`||!Array.isArray(t.runtimeArgs))return`preserved`;if(c(t.runtimeArgs,e))return`canonical`;for(let e of o)if(c(t.runtimeArgs,e))return`legacy-bare`;return`preserved`}function c(e,t){if(e.length!==t.length)return!1;for(let n=0;n<t.length;n++)if(e[n]!==t[n])return!1;return!0}function l(e){let o=e.logger??u,c=r(e.projectDir,`.claude`,`launch.json`);if(e.reclaimDisableEnv===`1`)return o({event:`launch-json-repair-skipped`,reason:`reclaim-disabled`}),{outcome:{configPath:c,outcome:`skipped-reclaim-disabled`},repairedCount:0};if(!i(c))return{outcome:{configPath:c,outcome:`no-file`},repairedCount:0};let l;try{let e=a(c,`utf-8`).trim();l=e?JSON.parse(e):{}}catch(e){let t=e instanceof Error?e.message:String(e);return o({event:`launch-json-repair-read-failed`,configPath:c,error:t}),{outcome:{configPath:c,outcome:`read-failed`,error:t},repairedCount:0}}if(!n(l)){let e=`launch.json root is not an object`;return o({event:`launch-json-repair-read-failed`,configPath:c,error:e}),{outcome:{configPath:c,outcome:`read-failed`,error:e},repairedCount:0}}let d=l.configurations;if(!Array.isArray(d))return{outcome:{configPath:c,outcome:`no-entry`},repairedCount:0};let f=d.find(e=>n(e)&&e.name===`open-knowledge-ui`);if(!f)return{outcome:{configPath:c,outcome:`no-entry`},repairedCount:0};let p=s(f);if(p===`canonical`)return{outcome:{configPath:c,outcome:`canonical`},repairedCount:0};if(p===`preserved`)return{outcome:{configPath:c,outcome:`preserved`},repairedCount:0};let m=t(e.projectDir,{mode:`published`});if(m.action===`failed`){let e=m.error??`unknown write failure`;return o({event:`launch-json-repair-write-failed`,configPath:c,error:e}),{outcome:{configPath:c,outcome:`write-failed`,error:e},repairedCount:0}}return o({event:`launch-json-repair-applied`,configPath:c}),{outcome:{configPath:c,outcome:`repaired`},repairedCount:1}}function u(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{l as repairLaunchJson};
|
|
2
|
+
//# sourceMappingURL=repair-launch-json-vIRa-3co.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d as e,g as t,m as n,s as r,v as i}from"./init-
|
|
2
|
-
//# sourceMappingURL=repair-mcp-configs-
|
|
1
|
+
import{d as e,g as t,m as n,s as r,v as i}from"./init-DwLGKHOJ.mjs";import{t as a}from"./mcp-migrate-event-BF8ILHwp.mjs";import{homedir as o}from"node:os";function s(e){let r=e.logger??u,i=e.home??o(),a=[];if(e.reclaimDisableEnv===`1`)return r({event:`mcp-config-repair-skipped`,reason:`reclaim-disabled`}),{outcomes:a,repairedCount:0};for(let o of n){let n=t[o],s=c(()=>n.configPath(``,i));if(s!==null&&a.push(l({scope:`user`,editorId:o,target:n,home:i,cwd:``,configPath:s,configPathOverride:void 0,logger:r})),n.projectConfigPath){let t=n.projectConfigPath,i=c(()=>t(e.projectDir));i!==null&&a.push(l({scope:`project`,editorId:o,target:n,home:void 0,cwd:e.projectDir,configPath:i,configPathOverride:i,logger:r}))}}return{outcomes:a,repairedCount:a.filter(e=>e.outcome===`repaired`).length}}function c(e){try{return e()}catch{return null}}function l(t){let n={scope:t.scope,editorId:t.editorId,configPath:t.configPath},o=r(t.target,t.cwd,t.home,t.configPathOverride);if(o===null)return{...n,outcome:`no-entry`};if(i(o))return{...n,outcome:`canonical`};t.logger(a({scope:t.scope,surface:`cli-repair`,editorId:t.editorId,configPath:t.configPath,priorEntry:o}));let s=e(t.target,t.cwd,{mode:`published`,skipAvailabilityCheck:!0},t.home,t.configPathOverride);if(s.action===`failed`){let e=s.error??`unknown write failure`;return t.logger({event:`mcp-config-repair-write-failed`,scope:t.scope,editorId:t.editorId,configPath:t.configPath,error:e}),{...n,outcome:`write-failed`,error:e}}return{...n,outcome:`repaired`}}function u(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{s as repairMcpConfigs};
|
|
2
|
+
//# sourceMappingURL=repair-mcp-configs-Dlc--ykk.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./repair-skills-B2NKABTJ.mjs";export{e as repairSkills};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{t as e}from"./esm-CEs3LWY3.mjs";import{Xn as t,di as n,er as r,ir as i,ur as a}from"./dist-
|
|
1
|
+
import{t as e}from"./esm-CEs3LWY3.mjs";import{Xn as t,di as n,er as r,ir as i,ur as a}from"./dist-BkOSFGR2.mjs";import{t as o}from"./write-project-skill-Dol4FEz9.mjs";import{dirname as s,join as c,resolve as l}from"node:path";import{existsSync as u,mkdirSync as d,readFileSync as f,readdirSync as p,rmSync as m,statSync as h,writeFileSync as g}from"node:fs";import{homedir as _}from"node:os";const v=[{hostDir:`.claude`,editorId:`claude`},{hostDir:`.cursor`,editorId:`cursor`},{hostDir:`.agents`,editorId:`codex`}],y=`open-knowledge-discovery`,b=[`.agents`,`skills`,y],x={existsSync:e=>u(e),isDirectory:e=>{try{return h(e).isDirectory()}catch(e){if(e.code===`ENOENT`)return!1;throw e}},readdirSync:e=>p(e),readFileSync:e=>f(e),writeFileSync:(e,t)=>{g(e,t)},mkdirSync:(e,t)=>{d(e,t)},rmSync:(e,t)=>{m(e,t)}},S={resolveProjectBundledSkillDir:()=>a(`project`,{checkDesktop:!1}),resolveDiscoveryBundledSkillDir:()=>a(`discovery`,{checkDesktop:!1}),readBundledVersion:()=>t(),readRecordedVersion:e=>r(e,`cli-hosts`),writeRecordedVersion:(e,t)=>n(e,`cli-hosts`,t,`cli-start`),recordEvent:e=>i(e)};function C(e){process.stderr.write(`${JSON.stringify(e)}\n`)}function w(e,t,n){n.rmSync(t,{recursive:!0,force:!0}),n.mkdirSync(s(t),{recursive:!0}),T(e,t,n)}function T(e,t,n){n.mkdirSync(t,{recursive:!0});for(let r of n.readdirSync(e)){let i=c(e,r),a=c(t,r);n.isDirectory(i)?T(i,a,n):n.writeFileSync(a,n.readFileSync(i))}}function E(e,t,n,r){let i;try{i=t.resolveProjectBundledSkillDir()}catch(e){return r({event:`project-skill-reclaim-bundle-missing`,scope:`project`,error:e instanceof Error?e.message:String(e)}),{outcome:`skipped`,reason:`bundle-missing`}}let a=[];for(let t of v){let s=c(e,t.hostDir,`skills`,`open-knowledge`),l=c(s,`SKILL.md`);if(!n.existsSync(l)){a.push({editorId:t.editorId,hostDir:t.hostDir,path:s,outcome:`no-token`}),r({event:`project-skill-reclaim-no-token`,scope:`project`,editorId:t.editorId,path:s});continue}try{o(s,e),w(i,s,n),a.push({editorId:t.editorId,hostDir:t.hostDir,path:s,outcome:`reclaimed`}),r({event:`project-skill-reclaim-reclaimed`,scope:`project`,editorId:t.editorId,path:s})}catch(e){let n=e instanceof Error?e.message:String(e);a.push({editorId:t.editorId,hostDir:t.hostDir,path:s,outcome:`failed`,error:n}),r({event:`project-skill-reclaim-failed`,scope:`project`,editorId:t.editorId,path:s,error:n})}}return{outcome:`done`,entries:a}}async function D(e,t,n,r){let i=e=>{t.recordEvent(e).catch(()=>{})},a=()=>new Date().toISOString(),o;try{o=await t.readBundledVersion()}catch(e){let t=e instanceof Error?e.message:String(e);return r({event:`user-skill-reclaim-version-read-failed`,scope:`user`,error:t}),i({ts:a(),surface:`cli-start`,target:`cli-hosts`,bundle:`discovery`,outcome:`failed`,reason:`version-read-failed:${t}`}),{outcome:`skipped`,reason:`version-read-failed`}}let s;try{s=await t.readRecordedVersion(e)}catch(e){r({event:`user-skill-reclaim-version-read-error`,scope:`user`,error:e instanceof Error?e.message:String(e)}),s=null}if(s!==null&&s===o)return r({event:`user-skill-reclaim-skipped-version-current`,scope:`user`,version:o}),{outcome:`skipped`,reason:`version-current`};let l;try{l=t.resolveDiscoveryBundledSkillDir()}catch(e){let t=e instanceof Error?e.message:String(e);return r({event:`user-skill-reclaim-bundle-missing`,scope:`user`,error:t}),i({ts:a(),surface:`cli-start`,target:`cli-hosts`,bundle:`discovery`,outcome:`failed`,reason:`bundle-missing:${t}`}),{outcome:`skipped`,reason:`bundle-missing`}}let u=[],d=c(e,...b),f=n.existsSync(d);try{w(l,d,n),u.push({kind:`central`,path:d,outcome:f?`overwritten`:`written`}),r({event:`user-skill-reclaim-central-written`,scope:`user`,path:d,preexisting:f,version:o})}catch(e){let t=e instanceof Error?e.message:String(e);u.push({kind:`central`,path:d,outcome:`failed`,error:t}),r({event:`user-skill-reclaim-central-failed`,scope:`user`,path:d,error:t})}for(let t of v){let i=c(e,t.hostDir),a=c(i,`skills`,y);if(a===d){u.push({kind:`host`,editorId:t.editorId,hostDir:t.hostDir,path:a,outcome:`skipped-collapsed-with-central`});continue}if(!n.existsSync(i)){u.push({kind:`host`,editorId:t.editorId,hostDir:t.hostDir,path:a,outcome:`skipped-host-absent`});continue}let s=n.existsSync(a);try{w(l,a,n),u.push({kind:`host`,editorId:t.editorId,hostDir:t.hostDir,path:a,outcome:s?`overwritten`:`written`}),r({event:`user-skill-reclaim-host-written`,scope:`user`,editorId:t.editorId,hostDir:t.hostDir,path:a,preexisting:s,version:o})}catch(e){let n=e instanceof Error?e.message:String(e);u.push({kind:`host`,editorId:t.editorId,hostDir:t.hostDir,path:a,outcome:`failed`,error:n}),r({event:`user-skill-reclaim-host-failed`,scope:`user`,editorId:t.editorId,hostDir:t.hostDir,path:a,error:n})}}let p=u.find(e=>e.kind===`central`);if(p?.outcome===`written`||p?.outcome===`overwritten`){let n=null;try{await t.writeRecordedVersion(e,o),r({event:`user-skill-reclaim-version-recorded`,scope:`user`,version:o})}catch(e){n=e instanceof Error?e.message:String(e),r({event:`user-skill-reclaim-version-record-failed`,scope:`user`,version:o,error:n})}i({ts:a(),surface:`cli-start`,target:`cli-hosts`,bundle:`discovery`,outcome:n===null?`installed`:`failed`,version:o,...n===null?{}:{reason:`state-write-failed:${n}`}})}else{let e=u.some(e=>e.kind===`host`&&e.outcome===`failed`);i({ts:a(),surface:`cli-start`,target:`cli-hosts`,bundle:`discovery`,outcome:`failed`,version:o,reason:e?`all-writes-failed`:`no-hosts-installed`})}return{outcome:`done`,version:o,entries:u}}async function O(e){let t=e.logger??C,n=e.fs??x,r=e.home??_(),i={...S,...e.deps};return e.reclaimDisableEnv===`1`?(t({event:`skill-repair-skipped`,reason:`reclaim-disabled`}),{status:`skipped`,reason:`reclaim-disabled`}):{status:`done`,project:E(e.projectDir,i,n,t),user:await D(r,i,n,t)}}function k(e){return e.status===`skipped`?e.reason===`reclaim-disabled`?0:1:e.project.outcome===`skipped`||e.user.outcome===`skipped`&&e.user.reason!==`version-current`||e.project.entries.some(e=>e.outcome===`failed`)||e.user.outcome===`done`&&e.user.entries.some(e=>e.outcome===`failed`)?1:0}function A(e){if(e.status===`skipped`)return`Skipped: ${e.reason}`;let t=[`Skill reclaim complete.`];if(e.project.outcome===`done`){let n=e.project.entries.filter(e=>e.outcome===`reclaimed`).length,r=e.project.entries.filter(e=>e.outcome===`no-token`).length,i=e.project.entries.filter(e=>e.outcome===`failed`).length;t.push(` Project: ${n} reclaimed, ${r} no-token, ${i} failed.`)}else t.push(` Project: skipped (${e.project.reason}).`);if(e.user.outcome===`done`){let n=e.user.entries.filter(e=>e.outcome===`written`||e.outcome===`overwritten`).length,r=e.user.entries.filter(e=>e.outcome===`skipped-host-absent`||e.outcome===`skipped-collapsed-with-central`).length,i=e.user.entries.filter(e=>e.outcome===`failed`).length;t.push(` User (${e.user.version}): ${n} written, ${r} skipped, ${i} failed.`)}else t.push(` User: skipped (${e.user.reason}).`);return t.join(`
|
|
2
2
|
`)}function j(){return new e(`repair-skills`).description("Refresh bundled SKILL.md files for installed AI editors (project-local + user-global). Runs automatically during `ok start`; this command forces an explicit sweep.").action(async()=>{let e=await O({projectDir:l(process.cwd()),reclaimDisableEnv:process.env.OK_RECLAIM_DISABLE??null});process.stdout.write(`${A(e)}\n`),process.exitCode=k(e)})}export{j as n,O as t};
|
|
3
|
-
//# sourceMappingURL=repair-skills-
|
|
3
|
+
//# sourceMappingURL=repair-skills-B2NKABTJ.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./gh-detect-
|
|
2
|
-
//# sourceMappingURL=src-
|
|
1
|
+
import"./gh-detect-CXkelKVd.mjs";import{d as e,g as t,u as n}from"./init-DwLGKHOJ.mjs";import"./loader-DwAApXf7.mjs";import"./preview-DQUlTvw4.mjs";import{n as r}from"./write-project-skill-Dol4FEz9.mjs";import{dirname as i,isAbsolute as a,join as o,relative as s,resolve as c}from"node:path";import{statSync as l}from"node:fs";import{readFile as u,realpath as d}from"node:fs/promises";function f(e){return e.replace(/:\d+$/,``)}function p(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:f(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[\w.-]+@)?([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:f(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:f(e[1]),owner:e[2],name:e[3]}}{let e=/^(?:[\w.-]+@)?([\w.-]+):([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e?.[1].includes(`.`)||e&&t.startsWith(`git@`))return{protocol:`ssh`,hostname:e[1],owner:e[2],name:e[3]}}{let e=/^git:([\w.-]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:e[1],owner:e[2],name:e[3]}}if(!t.includes(`://`)&&!t.includes(`@`)&&!t.startsWith(`/`)){let e=/^([\w.-]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e)return{protocol:`https`,hostname:`github.com`,owner:e[1],name:e[2]}}return null}function m(e){let t;try{t=new URL(e)}catch{return null}if(t.hostname!==`github.com`&&t.hostname!==`www.github.com`)return null;let n=t.pathname.split(`/`).filter(e=>e.length>0);if(n.length<5||n[2]!==`blob`)return null;let r,i,a,o;try{r=decodeURIComponent(n[0]),i=decodeURIComponent(n[1]),a=decodeURIComponent(n[3]),o=n.slice(4).map(e=>decodeURIComponent(e))}catch{return null}return!r||!i||!a||o.length===0||o.some(e=>e.length===0)?null:{owner:r,repo:i,branch:a,path:o.join(`/`)}}async function h(e,t){let n,r;try{n=await d(c(e)),r=await d(c(i(e)))}catch{return{kind:`not-git`}}if(!_(n,r))return{kind:`symlink-escape`};let s=o(n,`.git`),f;try{f=l(s)}catch{return{kind:`not-git`}}let m;if(f.isDirectory()){let e;try{e=await d(s)}catch{return{kind:`not-git`}}if(!_(e,n))return{kind:`symlink-escape`};m=e}else if(f.isFile()){let e;try{e=await u(s,`utf-8`)}catch{return{kind:`not-git`}}let t=/^gitdir:\s*(.+)$/m.exec(e.trim());if(!t)return{kind:`not-git`};let r=t[1].trim(),i=a(r)?r:c(n,r);try{m=await d(i)}catch{return{kind:`not-git`}}}else return{kind:`not-git`};let h=o(await g(m),`config`),v;try{v=await u(h,`utf-8`)}catch{return{kind:`not-git`}}let b=y(v);if(b===null)return{kind:`no-origin`};let x=p(b);if(x===null||x.hostname!==`github.com`)return{kind:`non-github`};let S=x.owner.toLowerCase()===t.owner.toLowerCase(),C=x.name.toLowerCase()===t.repo.toLowerCase();return!S||!C?{kind:`wrong-repo`,actualOwner:x.owner,actualRepo:x.name}:{kind:`ok`,gitRemoteUrl:`https://github.com/${x.owner}/${x.name}.git`}}async function g(e){let t;try{t=(await u(o(e,`commondir`),`utf-8`)).trim()}catch{return e}if(t.length===0)return e;let n=a(t)?t:c(e,t);try{return await d(n)}catch{return n}}function _(e,t){if(e===t)return!0;let n=s(t,e);return n.length>0&&!n.startsWith(`..`)&&!a(n)}function v(e){let t=e.indexOf(`#`),n=e.indexOf(`;`),r=-1;return t>=0&&n>=0?r=Math.min(t,n):t>=0?r=t:n>=0&&(r=n),(r===-1?e:e.slice(0,r)).trim()}function y(e){let t=!1;for(let n of e.split(/\r?\n/)){let e=v(n);if(e.length===0)continue;if(e.startsWith(`[`)){t=/^\[\s*remote\s+["']origin["']\s*\]$/.test(e);continue}if(!t)continue;let r=/^url\s*=\s*(.+)$/.exec(e);if(r)return b(r[1])}return null}function b(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`)?t.slice(1,-1):t}const x=[{id:`mcp-config`,write(t,n,r){let i=t.projectConfigPath?.(n);if(!i)return{integration:`mcp-config`,editorId:t.id,action:`skipped-unsupported`};try{let a=e(t,n,r,void 0,i);return a.action===`written`||a.action===`overwritten`?{integration:`mcp-config`,editorId:t.id,action:a.action,path:a.configPath}:a.action===`failed`?{integration:`mcp-config`,editorId:t.id,action:`failed`,path:a.configPath,error:a.error??`unknown failure`}:{integration:`mcp-config`,editorId:t.id,action:`failed`,path:a.configPath,error:`unexpected project-scope action: ${a.action}`}}catch(e){return{integration:`mcp-config`,editorId:t.id,action:`failed`,path:i,error:e instanceof Error?e.message:String(e)}}}},{id:`project-skill`,write(e,t,n){try{let n=r(e,t);return{integration:`project-skill`,editorId:e.id,action:n.action,...n.path?{path:n.path}:{},...n.error?{error:n.error}:{}}}catch(t){return{integration:`project-skill`,editorId:e.id,action:`failed`,error:t instanceof Error?t.message:String(t)}}}}];function S(e,n,r={},i=x){let a=[];for(let o of n){let n=t[o];for(let t of i)a.push(t.write(n,e,r))}return a}function C(e,t,r={}){return{integrations:S(e,t,r),claudeLaunchJson:t.includes(`claude`)?n(e,r):void 0}}export{p as i,h as n,m as r,C as t};
|
|
2
|
+
//# sourceMappingURL=src-iCrNc821.mjs.map
|