@gitroll/tacitt-cli 0.6.7 → 0.6.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +1 -1
  2. package/dist/{agent-setup-YlFIJz-h.mjs → agent-setup-CODlN6zl.mjs} +1 -1
  3. package/dist/agent-setup-worker.mjs +4 -4
  4. package/dist/cli.mjs +5 -5
  5. package/dist/codex-title-worker.mjs +1 -1
  6. package/dist/configured-preview-worker.mjs +4 -4
  7. package/dist/configured-session-worker.mjs +4 -4
  8. package/dist/{heap-DsE74_-n.mjs → heap-Dt3-d27v.mjs} +2 -2
  9. package/dist/inspection-worker.mjs +3 -3
  10. package/dist/{job-CeSf9UCC.mjs → job-BQXssW46.mjs} +3 -3
  11. package/dist/{model-f_QnDyyb.mjs → model-CSx2dP_P.mjs} +1 -1
  12. package/dist/operation-executor.mjs +2 -2
  13. package/dist/preview-worker.mjs +1 -1
  14. package/dist/{query-Bb72w2DX.mjs → query-CfhcS4gd.mjs} +194 -134
  15. package/dist/{run-RA_8zZsL.mjs → run-xlOaKCk8.mjs} +2 -2
  16. package/dist/{src-BBjnljUs.mjs → src-BgsEnMsy.mjs} +3 -3
  17. package/dist/{src-d7n58sbH.mjs → src-DzKuzGVH.mjs} +183 -147
  18. package/dist/{src-p_uJNjV3.mjs → src-V9GHLZQs.mjs} +1 -1
  19. package/dist/store-database-worker.mjs +1 -1
  20. package/dist/web/assets/{index-B6kJ6XXF.js → index-9UfCT_2C.js} +1 -1
  21. package/dist/web/index.html +1 -1
  22. package/package.json +1 -1
  23. package/skills/tacitt/SKILL.md +3 -3
  24. package/skills/tacitt/references/commands.md +50 -11
  25. package/skills/tacitt/references/journey.md +1 -1
  26. package/skills/tacitt/references/parallel-review.md +21 -0
  27. package/skills/tacitt/scripts/INDEX.md +39 -36
  28. package/skills/tacitt/scripts/journey-scan-timing.d.mts +15 -0
  29. package/skills/tacitt/scripts/journey-scan-timing.mjs +153 -1
  30. package/skills/tacitt/scripts/journey.mjs +15 -0
  31. package/skills/tacitt/scripts/review.mjs +280 -36
  32. package/LICENSE +0 -11
@@ -171,4 +171,4 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
171
171
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
172
172
  * SOFTWARE.
173
173
  */
174
- var Rm={identity:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`}),(0,F.jsx)(`circle`,{cx:`12`,cy:`7`,r:`4`})]}),credentials:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`}),(0,F.jsx)(`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`})]}),internal:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`}),(0,F.jsx)(`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`}),(0,F.jsx)(`path`,{d:`M6 6h.01M6 18h.01`})]}),private:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`}),(0,F.jsx)(`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`})]})};function zm({kind:e,size:t=14}){return(0,F.jsx)(`svg`,{className:`kicon`,"data-kind":e,viewBox:`0 0 24 24`,width:t,height:t,"aria-hidden":`true`,children:Rm[e]})}var Bm=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`;function Vm(e,t){let n=t.answer?.optionId??null,r=new Set(t.answer?.excludedTermKeys??[]),i=new Set(t.termKeys.filter(e=>!r.has(e))),a=new Set(e.privacy.terms.filter(e=>i.has(JSON.stringify([e.type,e.value.normalize(`NFC`)]))).flatMap(e=>e.sources.map(e=>e.workId)));return{verb:n===`keep`?`kept`:`hidden`,values:i.size,projects:a.size}}function Hm(e,t){let{verb:n,projects:r}=Vm(e,t);return`${t.question.trim().replace(/\?$/u,``)} · ${n}${r?` in ${Bm(r,`project`)}`:``}`}function Um(e,t=()=>!0){let[n,r]=(0,l.useState)({value:e,count:0});if(!Object.is(n.value,e)){let i=n.count+ +!!t(n.value,e);return r({value:e,count:i}),i}return n.count}var Wm=[{id:`identity`,label:`Identity and contact`,short:`Identity`,example:`Names, emails and phone numbers`,examples:`emails, phone numbers, names`,tip:`Names, email addresses and phone numbers.`},{id:`credentials`,label:`Credentials`,short:`Credentials`,example:`Keys, passwords and tokens`,examples:`keys, tokens, passwords`,tip:`API keys, tokens and passwords.`},{id:`internal`,label:`Internal resources`,short:`Internal`,example:`Internal links, paths and company details`,examples:`internal hosts, paths, code names`,tip:`Internal hosts, file paths and project code names.`},{id:`private`,label:`Private content`,short:`Private`,example:`Health, financial and personal details`,examples:`health, money, client details`,tip:`Personal, health, financial and client details.`}];function Gm({compact:e=!1}){return(0,F.jsx)(`ul`,{className:`kk${e?` compact`:``}`,children:Wm.map(t=>(0,F.jsxs)(`li`,{"data-kind":t.id,children:[(0,F.jsx)(zm,{kind:t.id,size:e?13:14}),(0,F.jsx)(`b`,{children:t.label}),!e&&(0,F.jsx)(`span`,{children:t.example})]},t.id))})}var Km=e=>JSON.stringify([e.type,e.value.normalize(`NFC`)]);function qm(e,t){let n=new Set(e.privacy.cards.filter(e=>e.answer?.optionId===`keep`).flatMap(e=>e.termKeys)),r=new Map(e.privacy.terms.filter(e=>(e.disposition===`hidden`||e.disposition===`pending`&&!n.has(Km(e)))&&(!t||e.sources.some(e=>e.workId===t))).map(e=>[Km(e),e]));return Wm.map(e=>({...e,count:[...r.values()].filter(t=>Am[t.type].kind===e.id).length}))}function Jm({kind:e,line:t}){return(0,F.jsxs)(`span`,{className:`ktip`,"aria-hidden":`true`,children:[(0,F.jsxs)(`span`,{className:`ktip-head`,"data-kind":e.id,children:[(0,F.jsx)(zm,{kind:e.id}),(0,F.jsx)(`strong`,{children:e.label})]}),(0,F.jsx)(`span`,{className:`ktip-line`,children:t}),(0,F.jsx)(`span`,{className:`ktip-line ktip-desc`,children:e.tip})]})}function Ym({count:e}){let t=Um(e,(e,t)=>t<e);return(0,F.jsx)(`b`,{"data-flash":t>0||void 0,children:e.toLocaleString(`en-US`)},t)}var Xm=e=>`${e.toLocaleString(`en-US`)} ${e===1?`item`:`items`}`;function Zm({view:e,onChangeAnswer:t}){let n=qm(e),[r,i]=(0,l.useState)(!1),a=(0,l.useRef)(null);(0,l.useEffect)(()=>{if(!r)return;function e(e){(e instanceof KeyboardEvent&&e.key===`Escape`||e instanceof PointerEvent&&e.target instanceof Node&&!a.current?.contains(e.target))&&i(!1)}return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,e)}},[r]);let o=e.privacy.cards.filter(e=>e.answer!==null),s=[`sending`,`completed`].includes(e.phase);return(0,F.jsxs)(`section`,{ref:a,className:`hid`,"aria-label":`Hidden so far`,children:[(0,F.jsxs)(`p`,{className:`hid-h`,title:`Unique values found so far, including ones still awaiting your answers; values you keep are taken off. Not replacement occurrences.`,children:[`Hidden so far`,` `,(0,F.jsx)(`b`,{children:n.reduce((e,t)=>e+t.count,0).toLocaleString(`en-US`)})]}),(0,F.jsx)(`button`,{type:`button`,className:`kinds hid-t`,"aria-expanded":r,"aria-controls":`hid-pop`,"aria-label":`Hidden so far: show category names, examples and applied privacy choices`,onClick:()=>i(!r),children:n.map(e=>(0,F.jsxs)(`span`,{className:`kc`,"data-kind":e.id,title:e.label,children:[(0,F.jsx)(zm,{kind:e.id}),(0,F.jsx)(Ym,{count:e.count}),(0,F.jsx)(Jm,{kind:e,line:`${Xm(e.count)} hidden so far.`})]},e.id))}),r&&(0,F.jsxs)(`div`,{className:`hid-pop`,id:`hid-pop`,children:[(0,F.jsx)(`ul`,{className:`kk`,children:n.map(e=>(0,F.jsxs)(`li`,{"data-kind":e.id,children:[(0,F.jsx)(zm,{kind:e.id}),(0,F.jsx)(`b`,{children:e.label}),(0,F.jsx)(`span`,{children:e.examples})]},e.id))}),o.length>0&&(0,F.jsxs)(`section`,{className:`o-rules`,"aria-label":`Applied decisions`,children:[(0,F.jsxs)(`p`,{className:`o-rules-h`,children:[o.length,` privacy `,o.length===1?`choice`:`choices`,` applied`]}),(0,F.jsx)(`ul`,{className:`o-rule-w`,children:o.map(n=>(0,F.jsxs)(`li`,{children:[(0,F.jsx)(`span`,{children:Hm(e,n)}),t&&!s&&(0,F.jsx)(`button`,{type:`button`,className:`o-rule-change`,onClick:()=>{i(!1),t(n.id)},children:`Change`})]},n.id))})]})]})]})}function Qm({view:e,workId:t}){return(0,F.jsx)(`span`,{className:`pr-f`,"aria-label":`Hidden keywords`,children:qm(e,t).filter(e=>e.count>0).map(e=>(0,F.jsxs)(`span`,{className:`kf`,"data-kind":e.id,tabIndex:0,children:[(0,F.jsx)(zm,{kind:e.id}),(0,F.jsx)(Ym,{count:e.count}),(0,F.jsxs)(`span`,{className:`vh`,children:[` `,e.label]}),(0,F.jsx)(Jm,{kind:e,line:`${Xm(e.count)} found in this Work.`})]},e.id))})}var $m=e=>`${e.type}\u0000${e.value}`,eh=new Intl.DateTimeFormat(`en-GB`,{day:`numeric`,month:`short`});function th({term:e,workId:t}){let n=e.sources.find(e=>e.workId===t)?.context??``,r=n.indexOf(e.value),i=(0,F.jsxs)(`span`,{className:`pl`,"data-kind":Am[e.type].kind,children:[(0,F.jsx)(zm,{kind:Am[e.type].kind,size:12}),Am[e.type].label]}),a=(0,F.jsx)(`s`,{"data-kind":Am[e.type].kind,children:e.value});if(r<0)return(0,F.jsxs)(F.Fragment,{children:[a,` `,i]});let o=Math.max(0,r-30),s=Math.min(n.length,r+e.value.length+40),c=n.indexOf(` `,o),l=o>0?`…${n.slice(c>=0&&c<r?c+1:o,r)}`:n.slice(0,r),u=n.slice(r+e.value.length,s),d=s<n.length?`${u.slice(0,u.lastIndexOf(` `)+1||void 0)}…`:u;return(0,F.jsxs)(F.Fragment,{children:[l,a,` `,i,d]})}function nh(e,t,n){let[r,i]=(0,l.useState)(new Map);return(0,l.useEffect)(()=>{if(!n)return;let r=new AbortController,a=r.signal;return(async()=>{let n=new Map;for(let r=0,i=0;i<20;i+=1){let i=await N.nativeJourney.classificationSessions.query({journeyId:e.journeyId,workId:t.id,after:r,limit:100},{signal:a});for(let e of i.sessions){let t=e.titleAvailable?e.title:`Untitled`,r=e.lastInteractionAt?` · ${eh.format(new Date(e.lastInteractionAt))}`:``;n.set(e.id,`${t}${r}`)}if(i.next===null)break;r=i.next}let r=new Map,o;for(let s=0;s<40;s+=1){let s=await N.nativeJourney.findings.query({journeyId:e.journeyId,workId:t.id,...o?{cursor:o}:{}},{signal:a});for(let e of s.rows){let t=$m(e);if(e.source.kind!==`session`||r.has(t))continue;let i=n.get(e.source.sessionId);i&&r.set(t,i)}if(a.aborted||i(new Map(r)),!s.cursor)break;o=s.cursor}})().catch(()=>{}),()=>r.abort()},[e.journeyId,t.id,t.inputRevision,n]),r}var rh=5;function ih({label:e,icon:t,terms:n,workId:r,origins:i,sessionLines:a,open:o}){let[s,c]=(0,l.useState)(!1),u=s?n:n.slice(0,rh);return(0,F.jsxs)(`details`,{className:`o-g`,open:o||void 0,children:[(0,F.jsxs)(`summary`,{className:`o-gh`,children:[t,e,(0,F.jsx)(`b`,{children:n.length})]}),(0,F.jsx)(`ul`,{children:u.map(e=>(0,F.jsxs)(`li`,{children:[(0,F.jsx)(th,{term:e,workId:r}),a&&i.get($m(e))&&(0,F.jsx)(`span`,{className:`o-sess`,children:i.get($m(e))})]},$m(e)))}),n.length>u.length&&(0,F.jsxs)(`button`,{type:`button`,className:`o-more`,onClick:()=>c(!0),children:[`Show `,n.length-u.length,` more`]})]})}function ah({view:e,work:t}){let[n,r]=(0,l.useState)(`type`),i=nh(e,t,!0),a=e.privacy.terms.filter(e=>e.disposition===`hidden`&&e.sources.some(e=>e.workId===t.id)),o=t.rootSessionIds.length,s=Wm.map(e=>({key:e.id,label:e.label,icon:(0,F.jsx)(zm,{kind:e.id}),terms:a.filter(t=>Am[t.type].kind===e.id)})).filter(e=>e.terms.length),c=[...Map.groupBy(a,e=>i.get($m(e))??``)].map(([e,t])=>{let n=e.lastIndexOf(` · `);return{key:e,label:n<0?e||`Other sessions`:(0,F.jsxs)(F.Fragment,{children:[e.slice(0,n),(0,F.jsxs)(`span`,{className:`o-gd`,children:[` · `,e.slice(n+3)]})]}),icon:null,terms:t}}),u=n===`type`?s:c.toSorted((e,t)=>+!e.key-!t.key);return(0,F.jsxs)(`section`,{"aria-label":`Hidden in this Work`,children:[(0,F.jsxs)(`div`,{className:`cv-h`,children:[(0,F.jsxs)(`span`,{children:[(0,F.jsxs)(`b`,{children:[a.length,` hidden `,a.length===1?`item`:`items`]}),` `,`in `,o,` `,o===1?`session`:`sessions`]}),(0,F.jsx)(`span`,{className:`o-by`,role:`group`,"aria-label":`Group hidden items by`,children:[`type`,`session`].map(e=>(0,F.jsx)(`button`,{type:`button`,"aria-pressed":n===e,onClick:()=>r(e),children:e===`type`?`Type`:`Session`},e))})]}),(0,F.jsx)(`div`,{className:`o-items`,children:u.map((e,r)=>(0,F.jsx)(ih,{label:e.label,icon:e.icon,terms:e.terms,workId:t.id,origins:i,sessionLines:n===`type`,open:r===0},e.key))},n)]})}var oh=e=>[`sending`,`completed`].includes(e.phase)?[]:e.works.filter(t=>Ia(t)&&Ka(e,t)===`Processing failed`),sh=e=>e.status===`blocked`||e.renderFailure?.revision===e.revision;function ch(e){if(e.status===`blocked`){let t=e.blockedCodes;return t.some(e=>e.endsWith(`UNSUPPORTED`))?`Tacitt can’t process some of its sessions yet.`:t.some(e=>e.endsWith(`LIMIT`))?`It is larger than Tacitt can prepare.`:`Its sessions could not be prepared for review.`}return e.renderFailure?.revision===e.revision?`Its package could not be built.`:`Its AI review stopped before it finished.`}var lh=new Set([`DISCOVERY_BUSY`,`COORDINATION_BUSY`]),uh=3e3;function dh(e,t){return new Promise((n,r)=>{let i=setTimeout(n,e);t.addEventListener(`abort`,()=>{clearTimeout(i),r(t.reason)},{once:!0})})}var fh=class extends Error{};async function ph(e,t,n,r){if(t.status!==`blocked`){n(await N.nativeJourney.render.mutate({journeyId:e.journeyId,workIds:[t.id]},{signal:r}));return}let i=await N.nativeJourney.respond.mutate({journeyId:e.journeyId,expectedRevision:e.revision,idempotencyKey:crypto.randomUUID(),action:{kind:`retry-work`,workId:t.id}},{signal:r});if(n(i.state),i.status===`stale`)throw new fh(`This Work changed. Review it and try again.`);for(let t=1;;t+=1){try{let t=await N.nativeJourney.prepare.mutate({journeyId:e.journeyId},{signal:r});t&&n(t);return}catch(e){let n=e instanceof Error?e.message:``;if(!lh.has(n)||t>=100)throw e}await dh(uh,r)}}function mh({view:e,work:t,onState:n,disconnected:r,fallback:i=null,skippedOnly:a=!1}){let o=oh(e).filter(e=>!a||La(e)),s=t?o.find(e=>e.id===t.id):o[0],[c,u]=(0,l.useState)(!1),[d,f]=(0,l.useState)(``),[p,m]=(0,l.useState)(null),h=e.works.find(e=>e.id===p),g=h!==void 0&&Ia(h)&&(h.status===`pending`||h.completedBatches<h.totalBatches),_=io(e.journeyId,!!s||g),v=(0,l.useRef)(null);(0,l.useEffect)(()=>()=>v.current?.abort(),[]);async function y(t,i){if(r||v.current)return;let a=new AbortController;v.current=a,u(!0),f(``);try{if(t===`retry`)await ph(e,i,n,a.signal),i.status===`blocked`&&m(i.id);else{let t=await N.nativeJourney.respond.mutate({journeyId:e.journeyId,expectedRevision:e.revision,idempotencyKey:crypto.randomUUID(),action:{kind:`work-access`,workId:i.id,access:`drop`}});n(t.state),t.status===`stale`&&f(`This Work changed. Review it and try again.`)}}catch(e){if(a.signal.aborted)return;console.error(t===`retry`?`FAILED_WORK_RETRY_FAILED`:`FAILED_WORK_DROP_FAILED`),f(e instanceof fh?e.message:P(e))}finally{v.current===a&&(v.current=null),u(!1)}}let b=d?(0,F.jsx)(`p`,{role:`alert`,children:d}):g&&_===!1?(0,F.jsxs)(`p`,{role:`status`,children:[`Reading `,Ga(h),` needs the agent. `,ro]}):null;if(!s)return i?i(b):b;let x=t?0:o.length-1,S=sh(s),C=_===!1;return(0,F.jsxs)(`section`,{className:`now`,"aria-label":`Now`,"data-failed-work":s.id,children:[(0,F.jsx)(`p`,{className:`now-k`,children:(0,F.jsx)(`span`,{className:`tc-kicker`,children:`Now`})}),(0,F.jsxs)(`p`,{className:`now-t`,children:[Ga(s),` could not be processed`]}),(0,F.jsxs)(`div`,{className:`now-b`,children:[(0,F.jsxs)(`p`,{className:`say`,children:[ch(s),` `,La(s)?`It is left out of this Send. Retry reads it again.`:S?`Retry it, or Drop it to send the rest.`:C?`Drop it to send the rest, or run /tacitt again in the chat to retry it.`:`Drop it to send the rest, or ask your agent to retry.`]}),S&&C&&s.status===`blocked`&&(0,F.jsxs)(`p`,{className:`say`,children:[`Reading it after Retry needs the agent. `,`Run /tacitt again in the chat to continue.`]}),x>0&&(0,F.jsxs)(`p`,{className:`say`,children:[Bm(x,`more Work`),` `,x===1?`needs`:`need`,` the same.`]})]}),(0,F.jsxs)(`div`,{className:`btns`,children:[S&&(0,F.jsx)(`button`,{type:`button`,className:`tc-btn primary`,disabled:c||r,onClick:()=>void y(`retry`,s),children:`Retry`}),(0,F.jsx)(`button`,{type:`button`,className:`tc-btn`,disabled:c||r,onClick:()=>void y(`drop`,s),children:`Drop`})]}),b]})}var hh={public:`Public`,private:`Private`,drop:`Drop`};function gh(e,t){return e.corrections.some(e=>e.workId===t&&(e.status===`pending`||e.status===`stale`))}function _h(e,t){let n=e.corrections.filter(e=>e.workId===t),r=n.filter(e=>e.status===`pending`||e.status===`stale`),i=n.filter(e=>e.status===`applied`),a=r.length?r:i;if(!a.length)return``;let o=a.reduce((e,t)=>e+t.count,0);return`Correction ${r.length?`pending`:`applied`} (${o})`}function vh({view:e,work:t,onBack:n,onState:r,disconnected:i=!1}){let a=e.scope.status===`confirmed`&&!e.pendingHideId&&t.status!==`blocked`&&(t.status!==`pending`||t.completedBatches>0),o=t.classificationRecommendation?.reason??null;return(0,F.jsx)(`section`,{className:`d-page`,children:(0,F.jsxs)(`div`,{className:`d-body`,children:[(0,F.jsxs)(`header`,{className:`d-head`,children:[(0,F.jsx)(`button`,{type:`button`,className:`d-back`,"aria-label":`Back to Works`,onClick:n}),(0,F.jsx)(`h1`,{tabIndex:-1,children:Ga(t)}),(0,F.jsx)(lo,{view:e,work:t,onState:r,disconnected:i,header:!0})]}),t.description&&(0,F.jsx)(`p`,{className:`d-desc`,children:ja(t.description)}),(0,F.jsx)(`div`,{className:`d-dec`,children:o&&(0,F.jsx)(`p`,{className:`pr-sug`,"data-tip":t.classificationRecommendation?.access??t.access,children:ja(o)})}),(0,F.jsx)(mh,{view:e,work:t,onState:r,disconnected:i}),_h(e,t.id)&&(0,F.jsxs)(`p`,{role:`status`,className:`d-note`,children:[_h(e,t.id),`.`,` `,gh(e,t.id)?`Answer it in the chat.`:`These stay hidden for this review only.`]}),t.placement===`unsorted`&&(0,F.jsx)(`p`,{className:`d-note`,children:`Tell your agent where these belong, or leave them out.`}),a&&(0,F.jsx)(ah,{view:e,work:t}),t.imagesOmitted>0&&(0,F.jsx)(`p`,{className:`d-note`,children:t.imagesOmitted===1?`1 image isn't included`:`${t.imagesOmitted} images aren't included`}),(0,F.jsx)(`p`,{className:`say pr-tip`,children:`To change what is hidden, or fix a title or grouping, tell your agent.`})]})})}var yh=e=>e.status===`ready`&&e.artifact?.revision===e.revision;function bh(e){let t=e.works.filter(Ra),n=t.filter(yh).length;return{completed:n,selected:t.length,percent:Math.floor(n/Math.max(1,t.length)*100)}}var xh=class extends Error{contention;constructor(e,t=!1){super(e),this.contention=t}};async function Sh(e,t,n,r){if(r.throwIfAborted(),!Ua(e))throw new xh(`Review the current privacy results before packaging.`);let i=e;if(!i.privacy.packageApproval){let e=await N.nativeJourney.respond.mutate({journeyId:i.journeyId,expectedRevision:i.revision,idempotencyKey:crypto.randomUUID(),action:{kind:`package-confirm`}},{signal:r});if(r.throwIfAborted(),t(e.state),e.status===`stale`)throw new xh(`The results changed. Review them and confirm packaging again.`);i=e.state}let a=i.works.filter(Ra).filter(e=>!yh(e)),o=0,s=!0;for(let e=0;e<a.length;e+=16){r.throwIfAborted();let c=a.slice(e,e+16);for(let e of c){let t=i.works.find(t=>t.id===e.id);if(!t||!Ra(t))throw new xh(`The selected Works changed.`)}let[l]=c;n(c.length===1||!l?l?.title??``:`${l.title} and ${c.length-1} more`);let u=await N.nativeJourney.render.mutate({journeyId:i.journeyId,workIds:c.map(e=>e.id)},{signal:r}).catch(e=>{throw!o||s||r.aborted||!ne(e)?e:new xh(Ch(o+c.length))});r.throwIfAborted(),i=u,t(i);let d=c.filter(e=>!i.works.some(t=>t.id===e.id&&yh(t)));o+=d.length,s&&=d.every(e=>`renders`in u&&u.renders.some(t=>t.workId===e.id&&t.status===`failed`&&t.code===`COORDINATION_BUSY`))}if(o)throw new xh(Ch(o),s);return i}function Ch(e){return e===1?`1 Work could not be packaged. Retry after reviewing its status.`:`${e} Works could not be packaged. Retry after reviewing their status.`}var wh=1500,Th=`The Send scope changed. Review it and confirm again.`,Eh=[`REVISION_CONFLICT`,`REQUEST_EXPIRED`,`IDENTITY_REJECTED`];function Dh(e,t){return!!(e&&t&&e.id===t.id&&(e.confirmedAt&&t.confirmedAt||e.request&&t.request&&e.request.scopeDigest===t.request.scopeDigest&&e.request.requestedAt===t.request.requestedAt&&!Eh.includes(t.error??``)))}function Oh(e){let t=e?.send;return!!(t?.request&&!t.confirmedAt&&[`awaiting-packaging`,`prepared`].includes(t.status)||t?.confirmedAt&&([`sending`,`waiting`,`sign-in`,`review`].includes(t.status)||t.status===`completed`&&t.items.some(e=>![`completed`,`blocked`].includes(e.status))))}function kh(e,t,n,r,i){let a=new AbortController,o={view:null,error:``,contention:``,busy:!1,pauseBusy:!1,needsReview:!1,preparing:!1,packaging:null,packageError:``,prepackaging:!1},s=!1,c=null,l,u,d=``,f=-1,p=0,m=``,h=!1,g,_=!1,v=0,y=!1,b=!1,x=!1,S=!1,C,w;function T(e){a.signal.aborted||(o={...o,...e},n(o))}function E(n){if(a.signal.aborted||!n||n.journey.journeyId!==e||n.journey.revision<t().revision)return;let i=o.view;i&&(i.journey.revision>n.journey.revision||i.send?.id===n.send?.id&&(i.send?.revision??0)>(n.send?.revision??0))||(u&&n.send?.id===u.input.idempotencyKey&&(u.acknowledged=!0,u=void 0,clearTimeout(g),g=void 0,l?.abort(),T({packageError:``})),T({view:n}),r({...t(),...n.journey}))}async function ee(e,t=!1,n=!1){if(a.signal.aborted||s||_&&!t)return;s=!0,t&&(v+=1,y=!0),T({busy:!0,pauseBusy:!0,error:``,preparing:n});let r=o.view?.send;try{let t=await e();E(t);let n=t.status===`stale`&&Dh(r,t.send);return x=!1,y=t.status===`stale`&&!n,T({needsReview:y,error:y?Th:n?`The Send moved on while this was saved. Check its current state and try again.`:``}),t}catch(e){if(!a.signal.aborted){console.error(`NATIVE_SEND_ACTION_FAILED`),x=!0,y=!0;let t=te(e,[`SEND_SCOPE_INVALIDATED`]);T({...t?{needsReview:!0}:{},error:t?Th:P(e)})}return}finally{s=!1,T({busy:_,pauseBusy:!1,preparing:!1})}}function re(){let n=o.view;if(!n?.send)throw Error(`No prepared Send`);return{journeyId:e,sendId:n.send.id,expectedJourneyRevision:Math.max(n.journey.revision,t().revision),expectedSendRevision:n.send.revision,idempotencyKey:crypto.randomUUID()}}async function ie(t){if(_||s||c||y||a.signal.aborted)return;_=!0;let n=v,r=!1;T({busy:!0});try{let i=await N.send.advance.mutate({journeyId:e,sendId:t},{signal:a.signal});if(n!==v)return;let s=o.view?.send;E(i),r=i.status===`applied`&&(i.send?.revision??-1)>(s?.revision??-1),i.status===`stale`&&!Dh(s,i.send)&&(y=!0,T({needsReview:!0,error:Th}))}catch(e){!a.signal.aborted&&n===v&&(x||=!ne(e),ae(e))}finally{_=!1,T({busy:s})}r&&!y&&Oh(o.view)&&w?.()}function ae(e,t){return ne(e,t)?(T({error:b||x||o.needsReview?o.error:``,contention:D}),!0):(console.error(`NATIVE_SEND_OBSERVE_FAILED`),y=!0,b||=!Da(e).retry,T({error:P(e),contention:``}),!b)}function oe(e){return new Promise(t=>{w=t,C=setTimeout(t,e)})}async function se(){let t=Date.now()-(i?.get(e)??-1/0);for(t<wh&&await oe(wh-t);!a.signal.aborted;){i?.set(e,Date.now());let t=AbortSignal.timeout(1e4);try{E(await N.send.get.query({journeyId:e},{signal:AbortSignal.any([a.signal,t])})),!o.needsReview&&!b&&!x&&!s&&(y=!1,T({error:``,contention:``})),Oh(o.view)&&o.view?.send&&ie(o.view.send.id)}catch(e){if(!a.signal.aborted&&!ae(e,t))return}a.signal.aborted||await oe(wh)}}async function O(){if(!(S||a.signal.aborted)){S=!0;try{await se()}finally{S=!1}}}let k=(n=t().revision)=>ee(()=>N.send.prepare.mutate({journeyId:e,expectedJourneyRevision:n,idempotencyKey:crypto.randomUUID()},{signal:a.signal}),!1,!0),ce=()=>ee(()=>{let e=o.view?.send;if(!e)throw Error(`No prepared Send`);return N.send.start.mutate({...re(),scopeDigest:e.scopeDigest,confirmedWorkIds:e.items.map(e=>e.workId),confirmedOmittedWorkIds:e.omitted.map(e=>e.workId)},{signal:a.signal})}),le=null,ue=e=>{(!le||e.revision>=le.revision)&&(le=e),r(e)},de=()=>{let e=t();return le&&le.revision>e.revision?le:e};function A(){let e=de(),t=JSON.stringify([e.privacy.answersRevision,e.confirmedHideRevision,e.works.filter(Ra).map(({id:e,revision:t,access:n})=>[e,t,n])]);t!==m&&(m=t,p=0,h=!1),!(a.signal.aborted||s||c||g!==void 0||h||o.view?.send?.status===`awaiting-packaging`||e.packaging||[`sending`,`completed`].includes(e.phase)||e.revision===f||!Ua(e)||e.works.filter(Ra).every(yh))&&(l=new AbortController,T({prepackaging:!0}),c=Sh(e,ue,e=>{d=e,o.packaging&&T({packaging:{title:e}})},AbortSignal.any([a.signal,l.signal])).then(()=>void 0,e=>{if(a.signal.aborted||l?.signal.aborted)return;let t=e instanceof xh?e.contention:ne(e);t&&p<2?(p+=1,g=setTimeout(()=>{g=void 0,A()},wh)):(f=de().revision,h=t)}).finally(()=>{c=null,d=``,T({prepackaging:!1})}))}async function j(t){if(a.signal.aborted||s||_)return;s=!0,T({busy:!0,pauseBusy:!0,error:``,packageError:``,needsReview:!1,packaging:{title:d}});let n=JSON.stringify(t);(!u||u.scope!==n)&&(u={scope:n,acknowledged:!1,input:{journeyId:e,expectedJourneyRevision:de().revision,idempotencyKey:crypto.randomUUID(),included:[...t.included],omittedWorkIds:[...t.omittedWorkIds]}});let r=u;try{let e=await N.send.request.mutate(r.input,{signal:a.signal});if(E(e),ue({...de(),...e.journey}),u=void 0,e.status===`stale`){T({needsReview:!0,error:Th});return}clearTimeout(g),g=void 0,l?.abort(),await c,y=!1,x=!1}catch{a.signal.aborted||(console.error(`NATIVE_SEND_REQUEST_FAILED`),r.acknowledged?await c:T({packageError:`The Send request could not be confirmed. Check its status and retry.`}))}finally{s=!1,T({busy:_,pauseBusy:!1,packaging:null}),w?.()}}async function fe(){if(a.signal.aborted||s||_)return;s=!0,T({busy:!0,pauseBusy:!0,error:``,packageError:``,needsReview:!1,packaging:{title:d}});let e;try{await c,e=await Sh(de(),ue,e=>T({packaging:{title:e}}),a.signal)}catch(e){a.signal.aborted||(console.error(`NATIVE_PACKAGE_FAILED`),T({packageError:e instanceof xh?e.message:P(e)}));return}finally{s=!1,T({busy:_,pauseBusy:!1,packaging:null})}await k(e.revision)}return{observe:O,nudge(){w?.()},stop(){a.abort(),clearTimeout(C),clearTimeout(g),g=void 0,w?.()},retry(){o.needsReview||(y=!1,b=!1,x=!1,T({error:``,contention:``}),S||O())},prepare:()=>k(),review:fe,prepackage:A,start:ce,send:j,pause:()=>ee(()=>N.send.pause.mutate(re(),{signal:a.signal}),!0),resume:()=>ee(()=>N.send.resume.mutate(re(),{signal:a.signal})),retryWorks:()=>ee(()=>N.send.resume.mutate(re(),{signal:a.signal}),!0),withdraw:()=>ee(()=>N.send.withdraw.mutate(re(),{signal:a.signal}),!0)}}var Ah=e=>{},jh=new Map;function Mh(e,t=Ah){let n=(0,l.useRef)({journey:e,onState:t});(0,l.useEffect)(()=>{n.current={journey:e,onState:t}},[e,t]);let[r,i]=(0,l.useState)({view:null,error:``,contention:``,busy:!0,pauseBusy:!0,needsReview:!1,preparing:!1,packaging:null,packageError:``,prepackaging:!1}),a=(0,l.useRef)(null);(0,l.useEffect)(()=>{let t=kh(e.journeyId,()=>n.current.journey,i,e=>n.current.onState(e),jh);return a.current=t,t.observe(),()=>{t.stop(),a.current=null}},[e.journeyId]),(0,l.useEffect)(()=>{r.view&&a.current?.prepackage()},[e.revision,r.prepackaging,r.view]);let o=(0,l.useCallback)(()=>a.current?.nudge(),[]);return{...r,view:r.view?.journey.journeyId===e.journeyId?r.view:null,prepare:()=>a.current?.prepare(),review:()=>a.current?.review(),start:()=>a.current?.start(),send:e=>a.current?.send(e),pause:()=>a.current?.pause(),withdraw:()=>a.current?.withdraw(),resume:()=>a.current?.resume(),retryWorks:()=>a.current?.retryWorks(),retry:()=>a.current?.retry(),nudge:o}}var Nh={ready:`Ready`,target:`Needs your answer`,settings:`Needs your answer`,uploading:`Uploading`,assessing:`Awaiting assessment`,completed:`Sent and assessed`,blocked:`Needs attention`},Ph=e=>e.resolution?.candidates.filter(e=>e.access!==`removed`)??[];function Fh({items:e,busy:t=!1,respond:n}){return(0,F.jsx)(F.Fragment,{children:e.map(e=>(0,F.jsxs)(`section`,{className:`journey-send-work`,children:[(0,F.jsxs)(`h3`,{className:`journey-send-work-title`,children:[ja(e.title),` · `,hh[e.access]]}),(0,F.jsx)(`p`,{className:`say`,role:`status`,children:Nh[e.status]}),e.error&&(0,F.jsxs)(`p`,{className:`say`,role:`alert`,children:[C(e.error).label,`. `,C(e.error).detail]}),e.status===`target`&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{className:`say`,children:e.resolution?.status===`matched`?`Update the matching Work in your Tacitt profile?`:`Your Tacitt profile has Works that may be this one. Create a new Work, or update one of them?`}),n?(0,F.jsxs)(`div`,{className:`btns`,children:[e.resolution?.status!==`matched`&&(0,F.jsx)(`button`,{className:`tc-btn primary`,type:`button`,disabled:t,onClick:()=>n(e.workId,{kind:`target`,target:{kind:`new`}}),children:`Create new Work`}),Ph(e).map(r=>(0,F.jsxs)(`button`,{className:`tc-btn`,type:`button`,disabled:t,onClick:()=>n(e.workId,{kind:`target`,target:{kind:`existing`,bindingId:r.bindingId}}),children:[`Update `,ja(r.title),` (`,r.access,`)`]},r.bindingId))]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`ul`,{children:[e.resolution?.status!==`matched`&&(0,F.jsx)(`li`,{children:`Create new Work`}),Ph(e).map(e=>(0,F.jsxs)(`li`,{children:[`Update `,ja(e.title),` (`,e.access,`)`]},e.bindingId))]}),(0,F.jsx)(`p`,{className:`journey-chat-hint`,children:`Answer in the chat.`})]})]}),e.status===`settings`&&e.settings&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`say`,children:[`These linked Works will become `,e.settings.access,`.`]}),(0,F.jsx)(`ul`,{children:e.settings.works.map(t=>(0,F.jsxs)(`li`,{children:[ja(t.title),` · `,t.access,` → `,e.settings?.access]},t.workId))}),n?(0,F.jsx)(`div`,{className:`btns`,children:(0,F.jsx)(`button`,{className:`tc-btn primary`,type:`button`,disabled:t,onClick:()=>{let t=e.settings;t&&n(e.workId,{kind:`settings`,membersDigest:t.membersDigest,accessVersion:t.accessVersion,scopeVersion:t.scopeVersion})},children:`Confirm Settings changes`})}):(0,F.jsx)(`p`,{className:`journey-chat-hint`,children:`Confirm these Settings changes in the chat.`})]})]},e.workId))})}var Ih={format:`Original-content format cannot be uploaded`,"too-large":`Larger than 500 MiB`,sent:`Already uploaded; unchanged`,unavailable:`File missing or changed`},Lh={"sign-in":`Waiting for sign-in`,sending:`Uploading`,waiting:`Waiting for assessment results`,review:`Needs your choice`,paused:`Paused`,completed:`Upload complete`,blocked:`Upload stopped`},Rh=e=>e===`private`?`Private`:`Public`;function zh(){let[e,t]=(0,l.useState)(null),[n,r]=(0,l.useState)(``),[i,a]=(0,l.useState)(!1),o=(0,l.useRef)(!1),s=(0,l.useRef)(null);function c(e){!e||s.current?.id===e.id&&s.current.revision>e.revision||(s.current=e,t(e))}(0,l.useEffect)(()=>{let e=new AbortController;async function t(){for(;!e.signal.aborted;){try{if(!o.current){let t=await N.manualUpload.get.query({},{signal:e.signal});if(e.signal.aborted||c(t),t&&[`sending`,`waiting`,`sign-in`,`review`].includes(t.status)){let n=await N.manualUpload.advance.mutate({uploadId:t.id},{signal:e.signal});e.signal.aborted||c(n.upload)}}}catch(t){e.signal.aborted||r(P(t))}await new Promise(e=>window.setTimeout(e,1500))}}return t(),()=>e.abort()},[]);async function u(e){if(!o.current){o.current=!0,a(!0);try{let t=await e();c(t.upload),r(t.status===`stale`?`The upload changed. Review the current list and confirm again.`:``)}catch(e){r(P(e))}finally{o.current=!1,a(!1)}}}function d(){let e=s.current;if(!e)throw Error(`No prepared upload`);return{uploadId:e.id,expectedRevision:e.revision,idempotencyKey:crypto.randomUUID()}}return{upload:e,error:n,busy:i,perform:u,address:d}}function Bh({resultId:e,rows:t,selectedSlots:n,account:r}){let i=zh(),a=(0,l.useRef)(null),o=i.upload?.resultId===e?i.upload:null,s=o!==null&&[`sending`,`waiting`,`sign-in`,`review`].includes(o.status);(0,l.useEffect)(()=>{o?.status===`sign-in`&&r.view?.state===`signed-out`&&a.current!==o.id&&(a.current=o.id,r.signIn())},[o?.id,o?.status,r]);let c=o!==null&&(o.status===`prepared`||o.status===`blocked`&&!o.confirmedAt),u=new Set(o?Object.values(o.slots):[]),d=new Set(o?.omitted.map(e=>e.slot)??[]),f=c?t.filter(e=>!u.has(e.slot)&&!d.has(e.slot)):[];return(0,F.jsxs)(`section`,{className:`passport-upload`,"aria-labelledby":`passport-upload-title`,children:[(0,F.jsx)(`h3`,{id:`passport-upload-title`,children:`Upload to Tacitt profile`}),(0,F.jsx)(`p`,{children:`Selected ZIPs are uploaded to the signed-in account's profile after you confirm the list. Private Works count toward scores while their details stay hidden.`}),i.error&&(0,F.jsx)(`p`,{className:`error`,role:`alert`,children:i.error}),o?.error&&(0,F.jsx)(`p`,{className:`error`,role:`alert`,children:o.error===`ACCOUNT_CHANGED`?`The signed-in account changed. Review the list and confirm it for this account.`:o.error===`EMPTY_SEND_SCOPE`?`None of the selected ZIPs can be uploaded.`:o.error}),(0,F.jsx)(`div`,{className:`actions`,children:(0,F.jsxs)(`button`,{type:`button`,disabled:i.busy||s||n.length===0,onClick:()=>void i.perform(()=>N.manualUpload.prepare.mutate({resultId:e,slots:[...n],idempotencyKey:crypto.randomUUID()})),children:[`Upload selected to profile (`,n.length,`)`]})}),o&&c&&(0,F.jsxs)(`div`,{role:`group`,"aria-label":`Confirm upload`,children:[o.items.length>0&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`h4`,{children:`Will upload`}),(0,F.jsx)(`ul`,{children:o.items.map(e=>(0,F.jsxs)(`li`,{children:[e.title,` · `,Rh(e.access),` · `,mr(e.artifact.byteLength)]},e.workId))})]}),(0,F.jsx)(Vh,{items:[...o.omitted.map(e=>({key:e.bundleId,title:e.title,reason:Ih[e.reason]??e.reason})),...f.map(e=>({key:e.bundleId,title:e.title,reason:`Not selected`}))]}),o.items.length>0&&(0,F.jsxs)(`button`,{type:`button`,className:`primary`,disabled:i.busy,onClick:()=>void i.perform(()=>N.manualUpload.start.mutate({...i.address(),scopeDigest:o.scopeDigest,confirmedWorkIds:o.items.map(e=>e.workId),confirmedOmittedBundleIds:o.omitted.map(e=>e.bundleId)})),children:[`Confirm upload (`,o.items.length,`)`]})]}),o&&!c&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{role:`status`,children:Lh[o.status]??o.status}),o.status===`sign-in`&&(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h4`,{children:`Sign in to continue this upload`}),r.view?.state===`authorizing`?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{children:[`Confirm code `,(0,F.jsx)(`strong`,{children:r.view.userCode}),` on the official sign-in page. The confirmed upload continues automatically after sign-in.`]}),(0,F.jsx)(ba,{url:r.view.verificationUriComplete,label:`Open the sign-in page`})]}):(0,F.jsx)(`button`,{type:`button`,disabled:r.busy,onClick:()=>void r.signIn(),children:`Sign in`}),r.error&&(0,F.jsx)(`p`,{role:`alert`,children:r.error})]}),(0,F.jsx)(Fh,{items:o.items,busy:i.busy,respond:(e,t)=>void i.perform(()=>N.manualUpload.respond.mutate({...i.address(),workId:e,choice:t}))}),o.items.map(e=>e.status===`completed`&&e.receipt?.passportIncluded?(0,F.jsxs)(`p`,{children:[e.title,` ·`,` `,(0,F.jsx)(`a`,{href:e.receipt.passportUrl,target:`_blank`,rel:`noopener noreferrer`,children:`View profile`})]},e.workId):null),(0,F.jsx)(Vh,{items:o.omitted.map(e=>({key:e.bundleId,title:e.title,reason:Ih[e.reason]??e.reason}))}),o.status!==`completed`&&(o.status===`paused`||o.status===`blocked`?(0,F.jsx)(`button`,{type:`button`,disabled:i.busy,onClick:()=>void i.perform(()=>N.manualUpload.resume.mutate(i.address())),children:`Resume`}):(0,F.jsx)(`button`,{type:`button`,disabled:i.busy,onClick:()=>void i.perform(()=>N.manualUpload.pause.mutate(i.address())),children:`Pause remaining uploads`}))]})]})}function Vh({items:e}){return e.length?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`h4`,{children:`Not uploaded this time`}),(0,F.jsx)(`ul`,{children:e.map(e=>(0,F.jsxs)(`li`,{children:[e.title,` · `,e.reason]},e.key))})]}):null}function Hh(e){let t=document.createElement(`a`),n=new URL(`download`,location.href);n.searchParams.set(`ticket`,e),t.href=n.href,t.rel=`noreferrer`,t.hidden=!0,document.body.append(t),t.click(),t.remove()}function Uh(e){let t=e instanceof Error?e.message:``;return t===`ARTIFACT_MISSING`?`A selected file is missing or its size changed. Refresh the results and choose an available bundle.`:t===`ARTIFACT_INVALID_ARCHIVE`||t===`ARTIFACT_IDENTITY_MISMATCH`?`A selected file no longer matches its saved checksum. Repackage that workspace before downloading.`:t===`COORDINATION_BUSY`?`Another download is being prepared. Try again shortly.`:P(e)}function Wh(e){return e.kind===`complete`?`Latest completed collection`:e.status===`packaging`?`Current collection · packaging`:`Current incomplete collection`}function Gh({current:e,account:t,onSave:n,saveDisabled:r}){let[i,a]=(0,l.useState)([]),[o,s]=(0,l.useState)(``),[c,u]=(0,l.useState)(()=>({resultId:``,bundleIds:new Set})),[d,f]=(0,l.useState)(0),[p,m]=(0,l.useState)(!0),[h,g]=(0,l.useState)(!1),[_,v]=(0,l.useState)(``),y=e?.packagingProgress?.workspaces?.completed??0;(0,l.useEffect)(()=>{let t=!0;async function n(){try{let e=await N.delivery.list.query();if(!t)return;a(e),s(t=>e.some(e=>e.id===t)?t:e[0]?.id??``),v(``)}catch(e){t&&v(Uh(e))}finally{t&&m(!1)}}n();let r=e?.phase===`packaging`?window.setInterval(()=>void n(),2e3):null;return()=>{t=!1,r!==null&&window.clearInterval(r)}},[e?.runId,e?.phase,e?.artifact?.bundleId,y]);let b=i.find(e=>e.id===o)??i[0],x=b?.rows??[],S=c.resultId===b?.id?c.bundleIds:new Set(x.filter(e=>e.available).map(e=>e.bundleId)),C=Math.max(1,Math.ceil(x.length/50)),w=Math.min(d,C-1),T=x.slice(w*50,(w+1)*50),E=x.filter(e=>e.available&&S.has(e.bundleId)).map(e=>e.slot);async function ee(e,t=`primary`){if(b&&!h){g(!0),v(``);try{let n=e.map(e=>x[e]?.workspaceId),r=n.every(e=>typeof e==`string`)?n:void 0;if(t!==`index`&&b.kind===`incomplete`&&!r)throw Error(`REVISION_CONFLICT`);Hh((await N.delivery.issue.mutate({resultId:b.id,slots:[...e],...t===`index`||!r?{}:{expectedWorkspaceIds:r},artifact:t})).ticket)}catch(e){v(Uh(e));let t=await N.delivery.list.query().catch(()=>null);t&&a(t)}finally{g(!1)}}}function D(e){s(e),u({resultId:``,bundleIds:new Set}),f(0),v(``)}function te(e){u(t=>{let n=new Set(t.resultId===b?.id?t.bundleIds:S);return n.has(e)?n.delete(e):n.add(e),{resultId:b?.id??``,bundleIds:n}})}return(0,F.jsxs)(`section`,{className:`bundle-results`,"aria-labelledby":`bundle-results-title`,children:[(0,F.jsx)(`h2`,{id:`bundle-results-title`,children:`Bundle results`}),(0,F.jsx)(`p`,{children:`Download workspace ZIPs for manual submission. The bundle library keeps the originals for reuse.`}),p&&(0,F.jsx)(`p`,{role:`status`,children:`Loading bundle results…`}),_&&(0,F.jsx)(`p`,{className:`error`,role:`alert`,children:_}),!p&&i.length===0&&(0,F.jsx)(`p`,{children:`No packaged workspace bundles yet.`}),i.length>1&&(0,F.jsx)(`div`,{className:`actions`,role:`group`,"aria-label":`Collection results`,children:i.map(e=>(0,F.jsx)(`button`,{type:`button`,"aria-pressed":b?.id===e.id,onClick:()=>D(e.id),children:Wh(e)},e.id))}),b&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:b.kind===`complete`?`completion`:`notice`,role:`status`,children:[(0,F.jsx)(`h3`,{children:b.kind===`complete`?`Package complete`:Wh(b)}),(0,F.jsxs)(`p`,{children:[b.rows.length,` finished workspace ZIPs ·`,` `,b.kind===`complete`?`completed`:`started`,` `,(0,F.jsx)(Br,{value:b.createdAt})]}),b.kind===`complete`&&b.indexPath&&(0,F.jsx)(`p`,{className:`path output-path`,children:b.indexPath}),b.kind===`incomplete`&&(0,F.jsx)(`p`,{children:`This collection is incomplete. Finished ZIPs can be downloaded now; the next Package checks them before reuse. A multiple-bundle download is labeled incomplete.`}),b.status===`index-unavailable`&&(0,F.jsx)(`p`,{children:`The collection index is unavailable. Saved workspace ZIPs can still be downloaded.`})]}),b.outcomes.length>0&&(0,F.jsxs)(`div`,{className:`notice`,role:`group`,"aria-label":`Workspace packaging outcomes`,children:[(0,F.jsx)(`h3`,{children:`Workspace status`}),(0,F.jsx)(`ul`,{children:b.outcomes.map(e=>(0,F.jsxs)(`li`,{children:[(0,F.jsx)(`strong`,{children:e.title}),`: `,e.status,e.status===`failed`&&(0,F.jsxs)(F.Fragment,{children:[` · `,e.code,` at `,e.stage,e.sessionId&&` · session ${e.sessionId}`,e.sourcePartId&&` · source ${e.sourcePartId}`]})]},e.workspaceId))})]}),b.rows.length===0?(0,F.jsx)(`p`,{children:`No workspace ZIP has finished in this collection.`}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`actions`,children:[(0,F.jsx)(`button`,{type:`button`,disabled:h||!x.some(e=>e.available),onClick:()=>u({resultId:b.id,bundleIds:new Set(x.filter(e=>e.available).map(e=>e.bundleId))}),children:`Select all available`}),(0,F.jsx)(`button`,{type:`button`,disabled:h||S.size===0,onClick:()=>u({resultId:b.id,bundleIds:new Set}),children:`Clear selection`}),(0,F.jsxs)(`button`,{type:`button`,className:`primary`,disabled:h||E.length===0,onClick:()=>void ee(E),children:[`Download selected (`,E.length,`)`]})]}),(0,F.jsx)(`div`,{className:`table-scroll`,children:(0,F.jsxs)(`table`,{className:`bundle-results-table`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`th`,{scope:`col`,children:`Select`}),(0,F.jsx)(`th`,{scope:`col`,children:`Workspace file`}),(0,F.jsx)(`th`,{scope:`col`,children:`Sessions`}),(0,F.jsx)(`th`,{scope:`col`,children:`Size`}),(0,F.jsx)(`th`,{scope:`col`,children:`Download`})]})}),(0,F.jsx)(`tbody`,{children:T.map(e=>(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`td`,{children:(0,F.jsx)(`input`,{type:`checkbox`,"aria-label":`Select ${e.title}`,checked:S.has(e.bundleId),disabled:h||!e.available,onChange:()=>te(e.bundleId)})}),(0,F.jsxs)(`th`,{scope:`row`,children:[(0,F.jsx)(`span`,{children:e.title}),(0,F.jsx)(`br`,{}),(0,F.jsx)(`small`,{className:`path`,children:e.filename}),!e.available&&(0,F.jsx)(`small`,{children:` · File missing or size changed`})]}),(0,F.jsx)(`td`,{children:e.sessions}),(0,F.jsx)(`td`,{children:mr(e.archiveBytes)}),(0,F.jsxs)(`td`,{children:[(0,F.jsx)(`button`,{type:`button`,disabled:h||!e.available,onClick:()=>void ee([e.slot]),children:`Download ZIP`}),e.companion&&(0,F.jsx)(`button`,{type:`button`,disabled:h||!e.companion.available,onClick:()=>void ee([e.slot],`companion`),children:`Download facts`}),e.companion&&!e.companion.available&&(0,F.jsx)(`small`,{children:` Facts unavailable`})]})]},e.bundleId))})]})}),C>1&&(0,F.jsxs)(`nav`,{className:`actions`,"aria-label":`Bundle result pages`,children:[(0,F.jsx)(`button`,{type:`button`,disabled:w===0,onClick:()=>f(w-1),children:`Previous`}),(0,F.jsxs)(`span`,{children:[`Page `,w+1,` of `,C]}),(0,F.jsx)(`button`,{type:`button`,disabled:w+1>=C,onClick:()=>f(w+1),children:`Next`})]})]}),b.kind===`complete`&&b.status===`complete`&&x.length>0&&(0,F.jsx)(Bh,{resultId:b.id,rows:x,selectedSlots:E,account:t}),b.indexAvailable&&(0,F.jsxs)(`p`,{children:[(0,F.jsx)(`button`,{type:`button`,disabled:h,onClick:()=>void ee([],`index`),children:`Download collection index (optional)`}),(0,F.jsx)(`small`,{children:` The index is not included with workspace ZIP downloads.`})]}),(0,F.jsx)(`div`,{className:`actions`,children:(0,F.jsx)(`button`,{type:`button`,disabled:r,onClick:n,children:`Save and exit`})})]})]})}var Kh=`Tacitt`;function qh(e,t=Date.now()){let n=Math.ceil((Date.parse(e)-t)/6e4);return!Number.isFinite(n)||n<=0?`The code has expired.`:`The code expires in ${n} min.`}function Jh(e){return!!(!e.view&&e.busy||e.view?.state===`authorizing`||e.view?.state===`starting-sign-in`||e.error||e.view?.lastError)}function Yh({account:e,held:t,embedded:n=!1,onCancel:r}){let i=e.view,a=n?null:(0,F.jsxs)(`h2`,{id:`sign-in-title`,children:[`Sign in to `,Kh]}),o=n?{"aria-label":`Sign in to ${Kh}`}:{"aria-labelledby":`sign-in-title`},s=(0,F.jsx)(`div`,{className:`actions`,children:(0,F.jsx)(`button`,{type:`button`,disabled:e.busy,onClick:()=>void e.cancel().then(r),children:`Cancel sign-in`})});if(i?.state===`starting-sign-in`)return(0,F.jsxs)(`section`,{...o,className:`account-panel`,children:[a,(0,F.jsx)(`p`,{role:`status`,children:`Requesting a sign-in code…`}),e.error&&(0,F.jsx)(`p`,{className:`error`,children:e.error}),s]});if(i?.state===`authorizing`)return(0,F.jsxs)(`section`,{...o,className:`account-panel`,children:[a,(0,F.jsxs)(`p`,{role:`status`,children:[e.approvalOpened?`Approve this code in the sign-in tab that opened.`:`Open the sign-in page and approve this code.`,` `,t?`Your Send starts as soon as you approve.`:`This page continues by itself; nothing is uploaded until you choose Send.`]}),(0,F.jsx)(`p`,{className:`account-code`,"aria-label":`Sign-in code`,children:i.userCode.length===8?`${i.userCode.slice(0,4)}-${i.userCode.slice(4)}`:i.userCode}),(0,F.jsx)(`p`,{children:(0,F.jsx)(ba,{url:i.verificationUriComplete,label:`Open sign-in page`})}),(0,F.jsx)(`p`,{className:`metadata`,children:qh(i.expiresAt)}),e.error&&(0,F.jsx)(`p`,{className:`error`,children:e.error}),s]});if(i?.state===`signed-out`&&i.lastError&&!e.error){let t=i.lastError===`SIGN_IN_EXPIRED`;return(0,F.jsxs)(`section`,{...o,className:`account-panel journey-sign-in-message`,children:[(0,F.jsx)(`p`,{role:t?`status`:`alert`,className:`welcome-message`,children:Xh(i.lastError)}),(0,F.jsx)(`button`,{type:`button`,disabled:e.busy,onClick:()=>void e.signIn(),children:`Sign in again`})]})}return(0,F.jsx)(wa,{account:e})}function Xh(e){return e===`SIGN_IN_EXPIRED`?`Your sign-in expired. Sign in again whenever you’re ready.`:`We couldn’t sign you in. Try again.`}var Zh=`Sign-in cancelled. Sign in whenever you’re ready.`,Qh=new Intl.Segmenter(void 0,{granularity:`grapheme`});function $h({account:e,offeredInPage:t}){let n=(0,l.useRef)(null),[r,i]=(0,l.useState)(null);(0,l.useEffect)(()=>{function e(e){(e instanceof KeyboardEvent&&e.key===`Escape`||e instanceof PointerEvent&&e.target instanceof Node&&!n.current?.contains(e.target))&&n.current&&(n.current.open=!1)}return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,e)}},[]);let a=e.view;if(a?.state===`signed-out`&&t&&a.configuration.clientId!==null)return null;if(a?.state!==`signed-in`)return(0,F.jsx)(Sa,{account:e});let o=a.displayName.trim().split(/\s+/u).slice(0,2).map(e=>Qh.segment(e).containing(0)?.segment??``).join(``).toUpperCase()||`U`;return(0,F.jsxs)(`details`,{ref:n,className:`journey-account-menu`,children:[(0,F.jsx)(`summary`,{"aria-label":`Account menu`,title:`Signed in as ${a.displayName}`,children:a.avatarUrl&&a.avatarUrl!==r?(0,F.jsx)(`img`,{src:a.avatarUrl,alt:``,referrerPolicy:`no-referrer`,onError:()=>i(a.avatarUrl)}):(0,F.jsx)(`span`,{"aria-hidden":`true`,children:o})}),(0,F.jsxs)(`div`,{className:`journey-account-popover`,children:[(0,F.jsx)(`p`,{className:`journey-muted`,children:`Signed in as`}),(0,F.jsx)(`p`,{className:`journey-account-name`,children:a.displayName}),(0,F.jsx)(`a`,{href:a.profileUrl,target:`_blank`,rel:`noopener noreferrer`,children:`Manage account`}),(0,F.jsx)(`button`,{type:`button`,disabled:e.busy,onClick:()=>void e.signOut(),children:`Sign out`})]})]})}function eg({account:e,inSend:t}){return!t&&Jh(e)?(0,F.jsx)(`div`,{className:`journey-auth`,children:(0,F.jsx)(Yh,{account:e,held:!1})}):null}var tg=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,ng=.35,rg=e=>e.totalBatches>0?Math.floor(e.completedBatches/e.totalBatches*100):0;function ig(e,t){if(t.access===`drop`&&t.placement===`unsorted`)return{pill:{label:`Left out`,tone:`left`},skeleton:!1};if(t.access===`drop`||!t.rootSessionIds.length)return{pill:null,skeleton:!1};let n=Ka(e,t);return n===`Processing failed`||n===`Tell your agent where these belong`?{pill:{label:n,tone:`attention`},skeleton:!1}:t.totalBatches>0&&t.completedBatches<t.totalBatches?{pill:{label:`Reading ${rg(t)}%`,tone:`reading`},skeleton:t.completedBatches/t.totalBatches<ng}:e.scope.status===`pending`||[`Waiting to start`,`Waiting for static scan`,`Static scanning`].includes(n)?{pill:{label:`Waiting`,tone:`waiting`},skeleton:!0}:n===`Answer the questions above`?{pill:{label:`Waiting on your answers`,tone:`attention`},skeleton:!1}:{pill:null,skeleton:!1}}var ag=[{value:`queue`,label:`Queue`},{value:`sessions`,label:`Most sessions`},{value:`hidden`,label:`Most hidden`},{value:`name`,label:`Name (A–Z)`}];function og(e,t,n){let r=t=>qm(e,t.id).reduce((e,t)=>e+t.count,0),i={queue:null,sessions:(e,t)=>t.rootSessionIds.length-e.rootSessionIds.length,hidden:(e,t)=>r(t)-r(e),name:(e,t)=>Ga(e).localeCompare(Ga(t))}[n];return i?[...t].sort(i):[...t]}function sg({view:e,work:t,onOpen:n,onState:r,disconnected:i}){let{pill:a,skeleton:o}=ig(e,t),s=Um(`${t.localTitle}\u0000${t.description}\u0000${t.rootSessionIds.length}`);return(0,F.jsx)(`li`,{"data-reading":a?.tone===`reading`||void 0,"data-flash":s?s%2?`a`:`b`:void 0,children:(0,F.jsxs)(`div`,{className:`pr-head`,onClick:e=>{e.target instanceof Element&&!e.target.closest(`button, [role="listbox"]`)&&n(t.id)},children:[(0,F.jsx)(`span`,{className:`pr-tw`,children:(0,F.jsx)(`button`,{type:`button`,className:`pr-t${o?` raw`:``}`,"aria-label":`Review ${Ga(t)}`,"data-work-id":t.id,onClick:()=>n(t.id),children:o?ja(t.projectName):Ga(t)})}),(0,F.jsxs)(`span`,{className:`pr-r`,children:[a&&(0,F.jsx)(`span`,{className:`pr-c`,"data-s":a.tone,children:a.label}),(0,F.jsx)(lo,{view:e,work:t,onState:r,disconnected:i})]}),o?(0,F.jsx)(`span`,{className:`pr-d sk`,"aria-hidden":`true`}):t.description&&(0,F.jsx)(`span`,{className:`pr-d`,children:ja(t.description)}),(0,F.jsxs)(`span`,{className:`pr-m`,children:[o?(0,F.jsx)(`span`,{className:`pr-f sk`,"aria-hidden":`true`}):(0,F.jsx)(Qm,{view:e,workId:t.id}),(0,F.jsx)(`span`,{className:`c-n`,children:tg(t.rootSessionIds.length,`session`)})]})]})})}function cg({count:e,sort:t,onSort:n}){return(0,F.jsxs)(`p`,{className:`statline`,children:[(0,F.jsxs)(`span`,{className:`review-heading`,role:`heading`,"aria-level":2,children:[`Works `,(0,F.jsx)(`span`,{className:`review-heading-count`,children:e})]}),t&&n&&(0,F.jsxs)(`span`,{className:`wh-sort`,children:[(0,F.jsx)(`span`,{className:`wh-sort-k`,children:`Sort`}),(0,F.jsx)(Za,{label:`Sort Works`,value:t,options:ag,onChange:n})]})]})}function lg({view:e,onOpen:t,onState:n,disconnected:r}){let[i,a]=(0,l.useState)(`queue`);if(!Wa(e))return e.snapshotId?(0,F.jsxs)(`section`,{className:`projects`,"aria-label":`Works`,children:[(0,F.jsx)(cg,{count:0,sort:null}),(0,F.jsx)(`p`,{className:`journey-muted pr-note`,children:`Your Works appear here once classification groups these sessions.`})]}):null;let o=e.works.find(e=>e.placement===`classifying`),s=e.works.filter(e=>e.rootSessionIds.length>0&&e.placement!==`classifying`),c=e.works.filter(e=>!e.rootSessionIds.length),u=e.scope.status===`confirmed`?s.filter(Ia):s;return(0,F.jsxs)(`section`,{className:`projects`,"aria-label":`Works`,children:[(0,F.jsx)(cg,{count:u.length,sort:i,onSort:a}),(0,F.jsxs)(`ul`,{className:`plist`,"aria-label":`Works`,children:[og(e,s,i).map(i=>(0,F.jsx)(sg,{view:e,work:i,onOpen:t,onState:n,disconnected:r},i.id)),o&&(0,F.jsx)(`li`,{className:`pr-grouping`,"data-reading":!0,"aria-label":`Sessions still being grouped`,children:(0,F.jsxs)(`div`,{className:`pr-head`,children:[(0,F.jsx)(`span`,{className:`pr-tw`,children:(0,F.jsxs)(`span`,{className:`pr-t`,children:[tg(o.rootSessionIds.length,`session`),` still being grouped`]})}),(0,F.jsx)(`span`,{className:`pr-r`,children:(0,F.jsx)(`span`,{className:`pr-c`,"data-s":`sorting`,children:`Sorting`})}),(0,F.jsx)(`span`,{className:`pr-m`,children:(0,F.jsx)(`span`,{className:`c-n`,children:tg(o.rootSessionIds.length,`session`)})})]})})]}),c.length>0&&(0,F.jsxs)(`details`,{className:`journey-fold journey-left-out`,children:[(0,F.jsxs)(`summary`,{children:[`No sessions left · `,c.length]}),(0,F.jsx)(`ul`,{children:c.map(e=>(0,F.jsx)(`li`,{children:(0,F.jsx)(`button`,{type:`button`,"data-work-id":e.id,onClick:()=>t(e.id),children:Ga(e)})},e.id))})]})]})}var ug=[`SESSION_MEMBERSHIP_CONFLICT`,`SESSION_UPLOAD_EXHAUSTED`,`LEGACY_SEND_RECOVERY_REQUIRED`,`ASSESSMENT_INCOMPLETE`,`SESSION_PUBLICATION_FENCE_REQUIRED`],dg=e=>!!(e.sessionAssembly||e.receipt&&[`accepted`,`running`,`succeeded`,`partial`,`failed`].includes(e.receipt.state));function fg(e){return e.status===`completed`&&e.items.length>0&&e.items.every(e=>e.status===`completed`&&e.sessionAssembly?.scanId)}function pg(e){let t=e.items.length,n=e.items.filter(e=>e.access===`public`).length;return{total:t,uploaded:e.items.filter(dg).length,assessed:e.items.filter(e=>e.status===`completed`).length,replaced:!!e.replaced,publicWorks:n,privateWorks:t-n}}function mg(e){let t=pg(e),n=t.total*2+1,r=Math.min(t.uploaded+t.assessed,t.total*2)+Number(fg(e)||t.replaced);return{value:r,max:n,percent:Math.floor(r/n*100)}}function hg(e){if(e.status!==`completed`||!e.items.length||e.items.some(e=>e.sessionAssembly)||!e.items.every(dg))return null;let t=new Set(e.items.map(e=>e.receipt?.passportUrl)),n=t.size===1?[...t][0]:null;return typeof n==`string`&&n.length>0?n:null}function gg(e){return e.items.some(e=>e.status!==`completed`||!e.receipt?.passportIncluded)?null:hg(e)}function _g(e){let{publicWorks:t,privateWorks:n}=pg(e);return[`Reading tools and commands across your sessions`,`Grouping your work into skills`,`Measuring how you debug and ship`,...t?[`Writing summaries for ${Bm(t,`Public Work`)}`]:[],...n?[`Adding ${Bm(n,`Private Work`)} to your owner view`]:[]]}function vg(e,t=0,{sessions:n=0,packing:r=null}={}){let i=e?pg(e):null,a=!!(e&&fg(e)),o=!!e?.items.some(e=>e.sessionAssembly),s=i?.total??r?.total??0,c=Bm(s,`Work`),l=e?.items.find(e=>e.status===`uploading`),u=e?_g(e):[],d=[{label:`Verifying your reviewed files`,done:!!e,doneLine:`${Bm(n,`session`)} ${n===1?`matches`:`match`} your review`,activeLine:r?`Packing ${r.title?`“${ja(r.title)}” · `:``}${Math.min(r.packaged+1,r.total)} of ${c}`:``},{label:`Uploading approved sessions`,done:!!(i&&i.uploaded>=i.total),doneLine:`${c} uploaded`,activeLine:l?`Uploading “${ja(l.title)}” · ${Math.min((i?.uploaded??0)+1,s)} of ${c}`:`${i?.uploaded??0} of ${c} uploaded`},{label:`Building your profile`,done:!!(i&&i.assessed>=i.total),doneLine:o?`Assessment complete`:`Profile built`,activeLine:u[t%Math.max(1,u.length)]??``},{label:o?`Finishing your submission`:`Finishing your profile update`,done:a||!!(i?.replaced&&e&&gg(e)),doneLine:a?`Submission assessed`:`Profile updated`,activeLine:o?`Checking your Work assessments`:`Checking your Works on your profile`}],f=d.findIndex(e=>!e.done);return d.map((e,t)=>{let n=f===-1||t<f?`done`:t===f?`active`:`upcoming`;return{label:e.label,state:n,line:n===`done`?e.doneLine:n===`active`?e.activeLine:``}})}function yg(e,t,n,r){return(e?.status===`paused`||e?.status===`blocked`)&&!!e.confirmedAt&&(n||r===!1||[`review`,`ready`].includes(t.phase)&&(!t.privacy.packageApproval||t.works.filter(Ra).some(t=>e.items.find(e=>e.workId===t.id)?.access!==t.access)||e.items.some(e=>{let n=t.works.find(t=>t.id===e.workId);return!n||n.access===`drop`||n.revision!==e.artifact.revision||n.artifact===null||n.artifact.sha256!==e.artifact.sha256||n.artifact.revision!==e.artifact.revision||n.artifact.bundleId!==e.artifact.bundleId})))}var bg={drop:`Dropped`,empty:`No sessions left`,sent:`Already sent; unchanged`,"not-ready":`Not ready`,"too-large":`Too large`};function xg({view:e,items:t}){return t.length?(0,F.jsxs)(`details`,{className:`journey-send-details`,"aria-label":`Not sent this time`,children:[(0,F.jsxs)(`summary`,{children:[`Not sent this time · `,t.length]}),(0,F.jsx)(`ul`,{children:t.map(t=>{let n=e.works.find(e=>e.id===t.workId),r=t.reason===`not-ready`&&n?La(n)?ch(n):Ka(e,n):bg[t.reason];return(0,F.jsxs)(`li`,{children:[ja(n?.localTitle??t.title),` · `,r??t.reason]},t.workId)})})]}):null}function Sg(e){return{items:e.works.filter(Ra).map(e=>({workId:e.id,access:e.access})),omitted:e.works.filter(e=>!Ra(e)).map(e=>({workId:e.id,title:e.title,reason:Ia(e)?`not-ready`:e.access===`drop`?`drop`:`empty`}))}}function Cg(e,t){let n=n=>t.items.filter(e=>e.access===n).reduce((t,n)=>t+(e.works.find(e=>e.id===n.workId)?.rootSessionIds.length??0),0),r=n(`public`),i=n(`private`);return{total:r+i,publicSessions:r,privateSessions:i}}function wg(e,t){let n=e.privacy.cards.filter(e=>e.answer!==null).length,r=qm(e).reduce((e,t)=>e+t.count,0),i=t.omitted.filter(e=>e.reason!==`sent`).length;return`${[...n?[tg(n,`question`)+` answered`]:[],`${tg(r,`item`)} hidden`,...i?[`${tg(i,`Work`)} left out`]:[]].join(` · `)}. Nothing leaves this computer until you send.`}function Tg({journey:e,send:t,busy:n,reconfirm:r,preparing:i,hold:a=null,onPrepare:o,onStart:s}){let c=Cg(e,t),u=t.omitted.filter(e=>![`drop`,`empty`,`sent`].includes(e.reason)),d=(0,l.useId)(),f=n||!t.items.length,p=f?a??(t.items.length?null:{reason:`No Works are selected to send.`}):null;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{className:`say journey-send-what`,children:wg(e,t)}),u.length>0&&(0,F.jsx)(`div`,{className:`journey-send-scope`,children:(0,F.jsx)(xg,{view:e,items:u})}),(0,F.jsx)(`p`,{className:`say`,children:`New or changed sessions are uploaded and grouped into these Works. Your other Works stay on your Tacitt profile.`}),t.items.map(t=>t.recoveryReview&&(0,F.jsxs)(`section`,{className:`journey-send-scope`,children:[(0,F.jsxs)(`p`,{className:`say`,children:[`Review the new Send for`,` `,e.works.find(e=>e.id===t.workId)?.title??`this Work`,`. Observed profile membership:`,` `,tg(t.recoveryReview.currentKeys.length,`session`),`,`,` `,t.recoveryReview.currentAccess??`not created`,`. Separately observed assembly revision: `,t.recoveryReview.revision,`. The proposed membership keeps those sessions and includes `,t.recoveryReview.proposedKeys.length,` sessions in total,`,` `,t.access,`. These observations are not an atomic snapshot and can change before sending. The previous Send remains in history.`]}),(0,F.jsxs)(`details`,{children:[(0,F.jsx)(`summary`,{children:`Review session membership`}),(0,F.jsxs)(`p`,{children:[`Observed session keys: `,t.recoveryReview.currentKeys.join(`, `)||`None`]}),(0,F.jsxs)(`p`,{children:[`Proposed session keys: `,t.recoveryReview.proposedKeys.join(`, `)||`None`]})]})]},t.workId)),(0,F.jsxs)(`div`,{className:`btns`,children:[r?(0,F.jsx)(`button`,{className:`tc-btn primary`,type:`button`,disabled:n,onClick:o,children:i?`Refreshing Send scope…`:`Refresh Send scope`}):(0,F.jsx)(`button`,{className:`tc-btn primary`,type:`button`,disabled:f,title:p?.reason,"aria-describedby":p?d:void 0,onClick:s,children:i?`Preparing Send scope…`:`Send ${tg(c.total,`session`)}${p?.percent===void 0?``:` · ${p.percent}%`}`}),p&&!r&&(0,F.jsx)(`span`,{id:d,className:`vh`,children:p.reason})]})]})}var Eg=4e3,Dg=(0,F.jsx)(`svg`,{viewBox:`0 0 20 20`,width:`18`,height:`18`,"aria-hidden":`true`,children:(0,F.jsx)(`path`,{d:`M4 10l4 4 8-8`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`})});function Og(e){let[t,n]=(0,l.useState)(0);return(0,l.useEffect)(()=>{if(!e)return;let t=setInterval(()=>n(e=>e+1),Eg);return()=>clearInterval(t)},[e]),t}function kg({stages:e,percent:t,value:n,max:r,valueText:i,sessions:a,works:o,publicWorks:s,privateWorks:c,timing:l}){let u=e.find(e=>e.state===`active`);return(0,F.jsxs)(`div`,{className:`journey-send-progress`,children:[(0,F.jsxs)(`div`,{className:`finish-progress`,children:[(0,F.jsx)(`p`,{children:u?.label??`Profile updated`}),(0,F.jsxs)(`strong`,{"aria-hidden":`true`,children:[t,`%`]}),(0,F.jsx)(`progress`,{className:`tc-bar`,"aria-label":`Submission progress`,"aria-valuetext":i,value:n,max:r})]}),(0,F.jsx)(`ol`,{className:`finish-stages`,"aria-label":`Submission stages`,children:e.map((e,t)=>(0,F.jsxs)(`li`,{"data-state":e.state,"aria-current":e.state===`active`?`step`:void 0,children:[(0,F.jsx)(`span`,{className:`finish-mark`,"aria-hidden":`true`,children:e.state===`done`?Dg:t+1}),(0,F.jsxs)(`span`,{className:`finish-stage`,children:[e.label,(0,F.jsx)(`small`,{"aria-hidden":e.state===`active`||void 0,children:e.line},e.line)]})]},e.label))}),(0,F.jsxs)(`p`,{className:`finish-summary`,"aria-label":`What is being sent`,children:[(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`b`,{children:a}),` sessions`]}),(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`b`,{children:o}),` Works`]}),(0,F.jsxs)(`span`,{children:[(0,F.jsxs)(`b`,{children:[s,` / `,c]}),` `,`public / private`]})]}),l&&(0,F.jsx)(`p`,{className:`finish-timing`,children:`Large submissions can take 15–20 minutes.`})]})}function Ag({send:e,journey:t}){let n=Cg(t,e).total,r=vg(e,0,{sessions:n})[2]?.state===`active`,i=Og(r&&e.status!==`paused`);if(!e.confirmedAt||!e.items.length||![`sending`,`waiting`,`review`,`paused`,`blocked`].includes(e.status))return null;let a=pg(e),o=mg(e),s=[{label:`Waiting to upload`,count:e.items.filter(e=>e.status===`ready`).length},{label:`Uploading`,count:e.items.filter(e=>e.status===`uploading`).length},{label:`Awaiting assessment`,count:e.items.filter(e=>e.status===`assessing`).length},{label:`Needs attention`,count:e.items.filter(e=>[`target`,`settings`,`blocked`].includes(e.status)).length}].filter(e=>e.count>0);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`vh`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:[(0,F.jsxs)(`p`,{children:[a.uploaded,` of `,a.total,` Works uploaded`]}),(0,F.jsxs)(`p`,{children:[a.assessed,` of `,a.total,` Works sent and assessed`]}),(0,F.jsx)(`p`,{children:s.map(e=>`${e.label}: ${e.count}`).join(` · `)})]}),e.items.filter(e=>e.status===`uploading`&&e.sessionUpload).map(e=>{let t=e.sessionUpload;if(!t)return null;if(t.contentLength===void 0)return(0,F.jsx)(`p`,{children:`Checking stored session upload`},e.workId);let n=t.bytesSent??0,r=t.bytesAcknowledged??0,i=r>=t.contentLength,a=e=>e.toLocaleString(`en-US`);return(0,F.jsxs)(`div`,{className:`journey-session-upload`,children:[(0,F.jsxs)(`p`,{children:[i?`Session ZIP confirmed`:`Session ZIP upload`,!i&&t.attempt?` · Attempt ${t.attempt}`:``]}),(0,F.jsx)(`progress`,{"aria-label":`Session ZIP upload`,value:i?r:n,max:t.contentLength}),(0,F.jsxs)(`p`,{children:[!i&&`${a(n)} / ${a(t.contentLength)} bytes · `,a(r),` bytes acknowledged`]}),(0,F.jsx)(`small`,{children:i?`Stored session confirmed by the server`:n===t.contentLength?`Waiting for server confirmation`:n>0?`Sending session ZIP bytes`:`Checking stored session upload`})]},e.workId)}),(0,F.jsx)(kg,{stages:vg(e,i,{sessions:n}),percent:o.percent,value:o.value,max:o.max,valueText:`${a.uploaded} uploaded, ${a.assessed} assessed of ${a.total} Works`,sessions:n,works:a.total,publicWorks:a.publicWorks,privateWorks:a.privateWorks,timing:r&&[`sending`,`waiting`].includes(e.status)})]})}function jg({journey:e,title:t}){let{completed:n,selected:r,percent:i}=bh(e),a=Sg(e),o=a.items.filter(e=>e.access===`public`).length;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`vh`,role:`status`,children:[`Packaging · `,n,` of `,r,` Works packaged`]}),(0,F.jsx)(kg,{stages:vg(null,0,{packing:{packaged:n,total:r,title:t}}),percent:i,value:n,max:Math.max(1,r),valueText:`${n} of ${r} Works packaged`,sessions:Cg(e,a).total,works:a.items.length,publicWorks:o,privateWorks:a.items.length-o,timing:!1})]})}var Mg=/^[a-z0-9]+(?:-[a-z0-9]+)*$/iu;function Ng(e){return e.length<=39&&Mg.test(e)}function Pg(e){return e.toLowerCase().replace(/[^a-z0-9]+/gu,`-`).replace(/^-+/u,``).slice(0,39).replace(/-+$/u,``)}function Fg(e,t,n){if(e)return e;let r=Pg(t);return r&&!/[^\u0000-\u007f]/u.test(t)?r:Pg(n.split(`@`,1)[0]??``)}var Ig=[[/^(x|twitter)\.com$/u,`x`,`X`],[/^linkedin\.com$/u,`linkedin`,`LinkedIn`],[/^github\.com$/u,`github`,`GitHub`],[/^youtube\.com$/u,`youtube`,`YouTube`],[/^instagram\.com$/u,`instagram`,`Instagram`],[/^threads\.(net|com)$/u,`threads`,`Threads`],[/^bsky\.app$/u,`bluesky`,`Bluesky`]],Lg=[{kind:`github`,label:`GitHub`,prefix:`github.com/`,example:`github.com/yourname`},{kind:`linkedin`,label:`LinkedIn`,prefix:`linkedin.com/in/`,example:`linkedin.com/in/yourname`},{kind:`x`,label:`X`,prefix:`x.com/`,example:`x.com/yourname`},{kind:`website`,label:`Website`,prefix:``,example:`yoursite.com`}];function Rg(e){let t=e.trim();if(t.startsWith(`mailto:`)){let e=t.slice(7);return/^[^\s@]+@[^\s@]+\.[^\s@]+$/u.test(e)&&t.length<=2048?{url:t,label:`Email`,kind:`email`}:null}let n=/^[a-z][a-z0-9+.-]*:/iu.test(t)?t:`https://${t}`;if(!URL.canParse(n)||/\s/u.test(n)||n.length>2048)return null;let r=new URL(n),i=r.hostname.replace(/^www\./u,``);if(![`https:`,`http:`].includes(r.protocol)||r.username||r.password||!/^[a-z0-9-]+(\.[a-z0-9-]+)*\.[a-z]{2,}$/iu.test(i))return null;let a=Ig.find(([e])=>e.test(i));return a?{url:r.href,label:a[2],kind:a[1]}:{url:r.href,label:`Website`,kind:`website`}}function zg(e){return e.replace(/^mailto:/u,``).replace(/^https?:\/\/(www\.)?/u,``).replace(/\/$/u,``)}var Bg={github:`M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12`,linkedin:`M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z`,x:`M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z`,youtube:`M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z`,instagram:`M7.0301.084c-1.2768.0602-2.1487.264-2.911.5634-.7888.3075-1.4575.72-2.1228 1.3877-.6652.6677-1.075 1.3368-1.3802 2.127-.2954.7638-.4956 1.6365-.552 2.914-.0564 1.2775-.0689 1.6882-.0626 4.947.0062 3.2586.0206 3.6671.0825 4.9473.061 1.2765.264 2.1482.5635 2.9107.308.7889.72 1.4573 1.388 2.1228.6679.6655 1.3365 1.0743 2.1285 1.38.7632.295 1.6361.4961 2.9134.552 1.2773.056 1.6884.069 4.9462.0627 3.2578-.0062 3.668-.0207 4.9478-.0814 1.28-.0607 2.147-.2652 2.9098-.5633.7889-.3086 1.4578-.72 2.1228-1.3881.665-.6682 1.0745-1.3378 1.3795-2.1284.2957-.7632.4966-1.636.552-2.9124.056-1.2809.0692-1.6898.063-4.948-.0063-3.2583-.021-3.6668-.0817-4.9465-.0607-1.2797-.264-2.1487-.5633-2.9117-.3084-.7889-.72-1.4568-1.3876-2.1228C21.2982 1.33 20.628.9208 19.8378.6165 19.074.321 18.2017.1197 16.9244.0645 15.6471.0093 15.236-.005 11.977.0014 8.718.0076 8.31.0215 7.0301.0839m.1402 21.6932c-1.17-.0509-1.8053-.2453-2.2287-.408-.5606-.216-.96-.4771-1.3819-.895-.422-.4178-.6811-.8186-.9-1.378-.1644-.4234-.3624-1.058-.4171-2.228-.0595-1.2645-.072-1.6442-.079-4.848-.007-3.2037.0053-3.583.0607-4.848.05-1.169.2456-1.805.408-2.2282.216-.5613.4762-.96.895-1.3816.4188-.4217.8184-.6814 1.3783-.9003.423-.1651 1.0575-.3614 2.227-.4171 1.2655-.06 1.6447-.072 4.848-.079 3.2033-.007 3.5835.005 4.8495.0608 1.169.0508 1.8053.2445 2.228.408.5608.216.96.4754 1.3816.895.4217.4194.6816.8176.9005 1.3787.1653.4217.3617 1.056.4169 2.2263.0602 1.2655.0739 1.645.0796 4.848.0058 3.203-.0055 3.5834-.061 4.848-.051 1.17-.245 1.8055-.408 2.2294-.216.5604-.4763.96-.8954 1.3814-.419.4215-.8181.6811-1.3783.9-.4224.1649-1.0577.3617-2.2262.4174-1.2656.0595-1.6448.072-4.8493.079-3.2045.007-3.5825-.006-4.848-.0608M16.953 5.5864A1.44 1.44 0 1 0 18.39 4.144a1.44 1.44 0 0 0-1.437 1.4424M5.8385 12.012c.0067 3.4032 2.7706 6.1557 6.173 6.1493 3.4026-.0065 6.157-2.7701 6.1506-6.1733-.0065-3.4032-2.771-6.1565-6.174-6.1498-3.403.0067-6.156 2.771-6.1496 6.1738M8 12.0077a4 4 0 1 1 4.008 3.9921A3.9996 3.9996 0 0 1 8 12.0077`,threads:`M12.186 24h-.007c-3.581-.024-6.334-1.205-8.184-3.509C2.35 18.44 1.5 15.586 1.472 12.01v-.017c.03-3.579.879-6.43 2.525-8.482C5.845 1.205 8.6.024 12.18 0h.014c2.746.02 5.043.725 6.826 2.098 1.677 1.29 2.858 3.13 3.509 5.467l-2.04.569c-1.104-3.96-3.898-5.984-8.304-6.015-2.91.022-5.11.936-6.54 2.717C4.307 6.504 3.616 8.914 3.589 12c.027 3.086.718 5.496 2.057 7.164 1.43 1.783 3.631 2.698 6.54 2.717 2.623-.02 4.358-.631 5.8-2.045 1.647-1.613 1.618-3.593 1.09-4.798-.31-.71-.873-1.3-1.634-1.75-.192 1.352-.622 2.446-1.284 3.272-.886 1.102-2.14 1.704-3.73 1.79-1.202.065-2.361-.218-3.259-.801-1.063-.689-1.685-1.74-1.752-2.964-.065-1.19.408-2.285 1.33-3.082.88-.76 2.119-1.207 3.583-1.291a13.853 13.853 0 0 1 3.02.142c-.126-.742-.375-1.332-.75-1.757-.513-.586-1.308-.883-2.359-.89h-.029c-.844 0-1.992.232-2.721 1.32L7.734 7.847c.98-1.454 2.568-2.256 4.478-2.256h.044c3.194.02 5.097 1.975 5.287 5.388.108.046.216.094.321.142 1.49.7 2.58 1.761 3.154 3.07.797 1.82.871 4.79-1.548 7.158-1.85 1.81-4.094 2.628-7.277 2.65Zm1.003-11.69c-.242 0-.487.007-.739.021-1.836.103-2.98.946-2.916 2.143.067 1.256 1.452 1.839 2.784 1.767 1.224-.065 2.818-.543 3.086-3.71a10.5 10.5 0 0 0-2.215-.221z`,bluesky:`M12 10.8c-1.087-2.114-4.046-6.053-6.798-7.995C2.566.944 1.561 1.266.902 1.565.139 1.908 0 3.08 0 3.768c0 .69.378 5.65.624 6.479.815 2.736 3.713 3.66 6.383 3.364.136-.02.275-.039.415-.056-.138.022-.276.04-.415.056-3.912.58-7.387 2.005-2.83 7.078 5.013 5.19 6.87-1.113 7.823-4.308.953 3.195 2.05 9.271 7.733 4.308 4.267-4.308 1.172-6.498-2.74-7.078a8.741 8.741 0 0 1-.415-.056c.14.017.279.036.415.056 2.67.297 5.568-.628 6.383-3.364.246-.828.624-5.79.624-6.478 0-.69-.139-1.861-.902-2.206-.659-.298-1.664-.62-4.3 1.24C16.046 4.748 13.087 8.687 12 10.8Z`};function Vg({kind:e}){return e===`website`?(0,F.jsxs)(`svg`,{className:`o-ico`,viewBox:`0 0 24 24`,"aria-hidden":`true`,"data-stroke":``,children:[(0,F.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9.5`}),(0,F.jsx)(`ellipse`,{cx:`12`,cy:`12`,rx:`4`,ry:`9.5`}),(0,F.jsx)(`path`,{d:`M2.5 12h19`})]}):e===`email`?(0,F.jsxs)(`svg`,{className:`o-ico`,viewBox:`0 0 24 24`,"aria-hidden":`true`,"data-stroke":``,children:[(0,F.jsx)(`rect`,{x:`2.5`,y:`4.5`,width:`19`,height:`15`,rx:`2`}),(0,F.jsx)(`path`,{d:`m3 6 9 7 9-7`})]}):(0,F.jsx)(`svg`,{className:`o-ico`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,F.jsx)(`path`,{d:Bg[e]})})}function Hg(e,t){return t.view?.state!==`signed-in`||!e.consent||[`sending`,`completed`].includes(e.phase)?null:e.profile?.address?e.profile.linksChoice===null?`links`:null:`address`}function Ug(){let[e,t]=(0,l.useState)(null),[n,r]=(0,l.useState)(``),[i,a]=(0,l.useState)(0);return(0,l.useEffect)(()=>{let e=!0;return N.send.ownerProfile.query().then(n=>e&&t(n),t=>{console.error(`OWNER_PROFILE_READ_FAILED`),e&&r(P(t))}),()=>{e=!1}},[i]),{owner:e,error:n,reload:()=>a(e=>e+1)}}async function Wg(e,t){return N.nativeJourney.respond.mutate({journeyId:e.journeyId,expectedRevision:e.revision,idempotencyKey:crypto.randomUUID(),action:t})}function Gg(e,t){let[n,r]=(0,l.useState)(null),i=Ng(e)?t&&e.toLowerCase()===t.toLowerCase()?`ok`:null:`invalid`;return(0,l.useEffect)(()=>{if(i)return;let t=!0,n=setTimeout(()=>{N.send.addressTaken.query({address:e}).then(n=>{let i=n===null?`unknown`:n.taken?`taken`:`ok`;t&&r({value:e,state:i})},()=>{t&&r({value:e,state:`unknown`})})},300);return()=>{t=!1,clearTimeout(n)}},[e,i]),i??(n?.value===e?n.state:`checking`)}var Kg={checking:`Checking…`,ok:`Available`,taken:`Taken`,invalid:`Letters, digits and single hyphens, up to 39 characters`,unknown:`Checked when you send`};function qg({view:e,account:t,onState:n,disconnected:r=!1,refusal:i=!1,sent:a=!1,onSaved:o}){let{owner:s,error:c}=Ug(),u=t.view?.state===`signed-in`?t.view.displayName:``,d=s?i?e.profile?.address??``:Fg(s.address,u,s.accountEmail):``,[f,p]=(0,l.useState)(null),[m,h]=(0,l.useState)(i),[g,_]=(0,l.useState)(!1),[v,y]=(0,l.useState)(``),b=f??d,x=Gg(b,s?.address??``),S=(0,l.useRef)(null);(0,l.useEffect)(()=>{m&&S.current?.focus()},[m]);async function C(){_(!0),y(``);try{let t=await Wg(e,{kind:`profile-address`,address:b});if(n(t.state),t.status===`stale`)return y(`The journey changed. Keep your address again.`);a&&(await N.send.saveSentProfile.mutate({journeyId:e.journeyId}),o?.())}catch(e){console.error(`PROFILE_ADDRESS_SAVE_FAILED`),y(P(e))}finally{_(!1)}}let w=[`ok`,`unknown`].includes(x)&&!g&&!r&&!!s;return(0,F.jsxs)(`section`,{className:`journey-decision o-top`,"aria-labelledby":`profile-address`,children:[(0,F.jsxs)(`p`,{className:`o-k`,children:[(0,F.jsx)(`span`,{className:`o-kick`,children:`Your address`}),!a&&(0,F.jsx)(`span`,{className:`o-chip`,children:i?`Before we send`:`While we read`})]}),(0,F.jsx)(`h3`,{className:`o-head`,id:`profile-address`,children:i?`Choose another address`:`Your Tacitt profile will live at tacitt.ai/${b}`}),(0,F.jsxs)(`p`,{className:`o-addr`,children:[(0,F.jsx)(`span`,{className:`o-addr-host`,children:`tacitt.ai/`}),m?(0,F.jsx)(`input`,{ref:S,className:`o-addr-in`,type:`text`,value:b,maxLength:39,"aria-label":`Your address after tacitt.ai/`,autoComplete:`off`,autoCapitalize:`off`,spellCheck:!1,onChange:e=>p(e.currentTarget.value.trim())}):(0,F.jsx)(`span`,{className:`o-addr-slug`,children:b}),(0,F.jsx)(`span`,{className:`o-avail`,role:`status`,"data-state":x,children:s?Kg[x]:c?``:`Loading…`})]}),(v||c)&&(0,F.jsx)(`p`,{role:`alert`,className:`say`,children:v||c}),(0,F.jsx)(`div`,{className:`o-foot journey-card-actions`,children:(0,F.jsxs)(`span`,{className:`o-acts`,children:[!m&&(0,F.jsx)(`button`,{type:`button`,className:`o-btn`,onClick:()=>h(!0),children:`Change`}),(0,F.jsx)(`button`,{type:`button`,className:`o-btn`,"data-suggested":!0,disabled:!w,onClick:C,children:`Keep`})]})})]})}function Jg({view:e,onState:t,disconnected:n=!1,sent:r=!1}){let{owner:i}=Ug(),[a,o]=(0,l.useState)(null),[s,c]=(0,l.useState)(``),[u,d]=(0,l.useState)(``),[f,p]=(0,l.useState)(!1),m=(0,l.useRef)(null),h=a??i?.links??[],g=h.length>=5,_=new Set(h.map(e=>Rg(e)?.kind)),v=Lg.filter(e=>e.kind===`website`||!_.has(e.kind)),y=v[0]?.example??`yoursite.com`;function b(e){c(e),d(``),requestAnimationFrame(()=>{let t=m.current;t?.focus(),t?.setSelectionRange(e.length,e.length)})}function x(){let e=Rg(s);if(!e)return d(`That doesn’t look like a link. Try x.com/you or your site.`);if(h.includes(e.url))return d(`Already in your links.`);if(h.length>=5)return d(`Your profile shows up to 5 links.`);o([...h,e.url]),c(``),d(``)}async function S(n){p(!0),d(``);try{let i=await Wg(e,{kind:`profile-links`,links:h,choice:n});if(t(i.state),i.status===`stale`)return d(`The journey changed. Choose again.`);r&&n===`added`&&await N.send.saveSentProfile.mutate({journeyId:e.journeyId})}catch(e){console.error(`PROFILE_LINKS_SAVE_FAILED`),d(P(e))}finally{p(!1)}}return(0,F.jsxs)(`section`,{className:`journey-decision o-top`,"aria-labelledby":`profile-links`,children:[(0,F.jsxs)(`p`,{className:`o-k`,children:[(0,F.jsx)(`span`,{className:`o-kick`,children:`Optional`}),!r&&(0,F.jsx)(`span`,{className:`o-chip`,children:`While we read`})]}),(0,F.jsx)(`h3`,{className:`o-head`,id:`profile-links`,children:`Help people find you`}),(0,F.jsx)(`p`,{className:`o-body`,children:`Add your GitHub, LinkedIn, X or personal site. They show at the top of your Tacitt profile.`}),h.length>0&&(0,F.jsx)(`ul`,{className:`o-lnks`,"aria-label":`Your links`,children:h.map(e=>{let t=Rg(e),n=t?.label??zg(e);return(0,F.jsxs)(`li`,{className:`o-lnk`,title:zg(e),children:[t&&(0,F.jsx)(Vg,{kind:t.kind}),(0,F.jsx)(`span`,{children:n}),(0,F.jsx)(`button`,{type:`button`,className:`o-lnk-x`,"aria-label":`Remove ${n} (${zg(e)})`,onClick:()=>o(h.filter(t=>t!==e)),children:`×`})]},e)})}),g?(0,F.jsxs)(`p`,{className:`say o-full`,children:[5,` of `,5,` links added. Remove one to add another.`]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`o-quick`,role:`group`,"aria-label":`Quick add`,children:v.map(e=>(0,F.jsxs)(`button`,{type:`button`,className:`o-quick-b`,onClick:()=>b(e.prefix),children:[(0,F.jsx)(Vg,{kind:e.kind}),e.label]},e.kind))}),(0,F.jsxs)(`form`,{className:`o-paste`,noValidate:!0,onSubmit:e=>{e.preventDefault(),x()},children:[(0,F.jsx)(`input`,{ref:m,type:`url`,inputMode:`url`,placeholder:y,"aria-label":`Paste a link`,autoComplete:`off`,spellCheck:!1,value:s,onChange:e=>c(e.currentTarget.value)}),(0,F.jsx)(`button`,{type:`submit`,className:`o-btn o-add`,disabled:!s.trim(),children:`Add`})]})]}),(0,F.jsx)(`p`,{className:`say o-paste-h`,role:`status`,children:u}),(0,F.jsx)(`div`,{className:`o-foot journey-card-actions`,children:(0,F.jsxs)(`span`,{className:`o-acts`,children:[(0,F.jsx)(`button`,{type:`button`,className:`o-btn`,disabled:f||n,onClick:()=>void S(r?`declined`:`later`),children:`Later`}),(0,F.jsx)(`button`,{type:`button`,className:`o-btn`,"data-suggested":!0,disabled:f||n||!h.length,onClick:()=>void S(`added`),children:`Add to profile`})]})})]})}function Yg({view:e,account:t,onState:n,disconnected:r=!1}){let{owner:i,reload:a}=Ug();if(!i)return null;if(!i.address)return(0,F.jsx)(qg,{view:e,account:t,onState:n,disconnected:r,sent:!0,onSaved:a});let o=e.profile?.linksChoice??null;return o!==null&&o!==`later`?null:(0,F.jsx)(Jg,{view:e,onState:n,disconnected:r,sent:!0})}var Xg=[`PASSPORT_ADDRESS_TAKEN`,`PASSPORT_ADDRESS_RESERVED`,`PASSPORT_ADDRESS_LIMIT`],Zg=e=>{},Qg={"awaiting-packaging":`Preparing your reviewed files`,prepared:`Ready to send`,"sign-in":`Sign in to continue`,review:`A choice before sending`,sending:`Sending your Works`,waiting:`Waiting for assessment`,paused:`Sending paused`,completed:`Your Tacitt profile is ready`,blocked:`Send needs your attention`},$g=[...ug,`PASSPORT_NOT_CURRENT`,`WORK_REMOVED`];function e_(e){return e.items.some(e=>e.status===`blocked`&&![...$g,`SEND_SCOPE_CHANGED`].includes(e.error??``))}function t_(e,t=Date.now()){let n=e.view,r=n?.state;return n?.state===`signed-in`&&Date.parse(n.expiresAt)>t?`Signed in. Resuming your Send…`:r===`authorizing`?`Waiting for approval. Your Send starts as soon as you approve.`:r===`starting-sign-in`?`Requesting a sign-in code…`:r===`signed-in`||n?.lastError===`SIGN_IN_EXPIRED`?`Your sign-in expired. Sign in again; your Send starts after you approve.`:`Sign in to send. Your Send starts after you approve the sign-in.`}function n_(e){return e.items.some(e=>e.receipt!==null||[`uploading`,`assessing`,`completed`].includes(e.status))}function r_({send:e}){let{assessed:t,total:n}=pg(e),r=e.items.some(e=>![`completed`,`blocked`].includes(e.status)),i=e.items.filter(e=>e.status===`blocked`),a=i.filter(e=>[`ASSESSMENT_INCOMPLETE`,`PASSPORT_NOT_CURRENT`,`WORK_REMOVED`].includes(e.error??``));return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`say`,role:`status`,children:[t,` of `,tg(n,`Work`),` assessed.`,r&&` Assessment continues in the background.`]}),a.length>0&&(0,F.jsxs)(`p`,{className:`say`,children:[`Assessment failed for `,a.map(e=>`“${ja(e.title)}”`).join(`, `),`.`]}),i.filter(e=>!a.includes(e)).map(e=>(0,F.jsxs)(`p`,{className:`say`,role:`alert`,children:[`“`,ja(e.title),`”: `,C(e.error??``).label,`.`]},e.workId))]})}function i_({journey:e,account:t,connection:n,onState:r}){let i=Mh(e,r),{nudge:a}=i,o=t.view?.state===`signed-in`,s=i.view?.send?.status===`sign-in`;(0,l.useEffect)(()=>{o&&s&&a()},[o,s,a]);let c=t.refresh;(0,l.useEffect)(()=>{s&&c()},[s,c]);let u=i.busy||!!n,d=e.works.some(e=>e.status===`ready`),f=i.view?.send,p=f?.status===`completed`,m=f?hg(f):null,h=f?gg(f):null;(0,l.useEffect)(()=>{h&&/^https?:\/\//iu.test(h)&&window.location.assign(h)},[h]);let g=(()=>{if(!f||!f.items.length)return null;let t=f.items.map(e=>e.workId),n=e.works.filter(e=>Ia(e)&&e.artifact?.revision===e.revision);return new Set(t).size!==t.length||t.length!==n.length||n.some(e=>!t.includes(e.id))?null:f.items.every(e=>{let t=n.find(t=>t.id===e.workId);return!!(t&&t.artifact?.sha256===e.artifact.sha256&&t.artifact.revision===e.artifact.revision)})?qm(e).reduce((e,t)=>e+t.count,0):null})(),_=f&&[`sending`,`waiting`,`review`,`sign-in`].includes(f.status),v=f?.status===`prepared`&&!f.confirmedAt&&f.items.some(t=>{let n=e.works.find(e=>e.id===t.workId)?.artifact;return!(!n||n.revision===t.artifact.revision&&n.sha256===t.artifact.sha256)}),y=yg(f,e,i.needsReview,i.view?.scopeValid),b=f?.error===`REQUEST_EXPIRED`,x=!(!f?.request||f.confirmedAt||f.error!==`IDENTITY_REJECTED`),S=!f?.confirmedAt&&(f?.status===`prepared`&&f.items.length===0||!!f?.request&&f?.error===`REVISION_CONFLICT`),w=!f||v||b||x||S,T=i.packaging!==null||w&&e.packaging!==null&&!i.prepackaging,E=!(!f||w||y||(!i.needsReview||_&&f.confirmedAt)&&f.error!==`ACCOUNT_CHANGED`&&f.error!==`REVISION_CONFLICT`&&f.error!==`SEND_SCOPE_INVALIDATED`),ee=f&&!w&&(E||f.status===`prepared`||f.status===`blocked`&&!f.confirmedAt),D=!!(f&&!w&&!E&&f.confirmedAt&&[`sending`,`waiting`].includes(f.status)),te=!(!f||w||E||!f.confirmedAt||f.status!==`paused`&&f.status!==`blocked`),ne=!p&&(T||D||te),re=t.view?.configuration.clientId===null?{reason:`Sign-in is not configured in this build`}:i.prepackaging?{reason:`Packaging…`,percent:bh(e).percent}:n?{reason:`Reconnecting to your local session…`}:i.preparing?{reason:`Preparing Send scope…`}:i.busy?{reason:`Checking your Send…`}:null,ie=f?.items.filter(e=>e.access===`private`).length??0,ae=Sg(e),oe=[`authorizing`,`starting-sign-in`].includes(t.view?.state??``),se=Jh(t)&&!(f?.status===`sign-in`&&t.view?.lastError===`SIGN_IN_EXPIRED`&&t.view.state===`signed-out`&&!t.error),O=f?.items.some(e=>e.status===`blocked`)&&f.items.every(e=>e.status===`completed`||e.status===`blocked`&&$g.includes(e.error??``)),k=f&&[`blocked`,`paused`,`completed`].includes(f.status)&&(y||f.error===`SESSION_CONTENT_CONFLICT`||f.items.some(e=>ug.includes(e.error??``))),ce=f?.items.filter(e=>e.status===`blocked`)??[];return(0,F.jsx)(F.Fragment,{children:(0,F.jsxs)(`section`,{className:ne?`finish journey-send`:`now journey-send`,"aria-label":`Send to Tacitt`,children:[(0,F.jsx)(`p`,{className:ne?`finish-kicker`:`now-k`,children:(0,F.jsx)(`span`,{className:`tc-kicker`,children:T?`Packaging your Works`:p?`Submission complete`:te?f?.status===`paused`?`Submission paused`:`Submission blocked`:D?`Submission in progress`:w?`Review complete`:`Now`})}),(0,F.jsx)(`h2`,{className:ne?`finish-title`:`now-t`,"data-ready":w&&!T&&!E||void 0,children:T?`Preparing your reviewed files`:y?`Your Send scope changed`:E?`Review your Send scope`:te?`Let’s pick up where we left off.`:D?`Your work is on its way.`:w?`Ready to send`:p?m?`Your Tacitt profile is ready.`:fg(f)?`Your submission was assessed`:`Your submission is complete.`:D?`Your work is on its way.`:Qg[f.status]}),D&&(0,F.jsx)(`p`,{className:`say finish-say`,children:`Your privacy choices are already applied. We’re submitting the reviewed copy and updating your Tacitt profile.`}),y&&!T&&(0,F.jsx)(`p`,{className:`say finish-say`,children:`Review the current Works and prepare a new Send, then confirm it separately. The earlier Send remains in history.`}),te&&!y&&!T&&(0,F.jsx)(`p`,{className:`say finish-say`,children:`Your reviewed choices and the progress so far are preserved. Continue the remaining work.`}),h&&(0,F.jsx)(`p`,{className:`say`,role:`status`,children:`Opening your profile…`}),f&&p&&!h&&(0,F.jsx)(r_,{send:f}),m&&(0,F.jsxs)(`p`,{className:`say`,children:[`Public to anyone with the link.`,ie>0&&` ${tg(ie,`Work`)} ${ie===1?`stays`:`stay`} only yours.`]}),se&&(0,F.jsx)(`div`,{className:`journey-send-sign-in`,children:(0,F.jsx)(Yh,{account:t,held:f?.status===`sign-in`&&!!f.confirmedAt,embedded:f?.status===`sign-in`,onCancel:f?.status===`sign-in`&&!f.items.some(e=>e.receipt)?()=>void i.withdraw():void 0})}),p&&g!==null&&(0,F.jsxs)(`p`,{className:`say`,children:[g,` keywords marked Hidden`]}),f?.replaced&&(0,F.jsxs)(`p`,{className:`say`,children:[tg(f.replaced.retiredWorkCount,`earlier Work`),` replaced on your profile.`]}),m&&(0,F.jsxs)(`a`,{className:`tc-btn primary`,href:m,target:`_blank`,rel:`noopener noreferrer`,children:[`Visit your profile `,(0,F.jsx)(`span`,{"aria-hidden":`true`,children:`↗`})]}),i.contention&&!n&&(0,F.jsx)(`p`,{role:`status`,className:`say`,children:i.contention}),i.error&&!n&&(0,F.jsxs)(`div`,{role:`alert`,className:`say`,children:[(0,F.jsx)(`p`,{children:i.error}),(0,F.jsx)(`div`,{className:`btns`,children:(0,F.jsx)(`button`,{className:`tc-btn`,type:`button`,disabled:u||i.needsReview,onClick:i.retry,children:`Retry connection`})})]}),f?.request&&!f.confirmedAt&&[`sign-in`,`prepared`].includes(f.status)&&(0,F.jsx)(`p`,{role:`status`,className:`say`,children:`Your Send request expires if the host restarts or after 30 minutes. Then click Send again.`}),x&&(0,F.jsx)(`p`,{role:`alert`,className:`say`,children:`The connected account changed after you clicked Send. Review the account and click Send again.`}),b&&(0,F.jsx)(`p`,{role:`alert`,className:`say`,children:`Your Send request expired because the host restarted or 30 minutes passed. Click Send again to continue.`}),f?.error&&!w&&(0,F.jsx)(`p`,{role:`alert`,className:`say`,children:f.error===`ACCOUNT_CHANGED`?`The signed-in account changed. Review the current Send scope and confirm it for this account.`:f.error===`REVISION_CONFLICT`?`The output changed. Review the current Send scope before sending.`:C(f.error).detail}),f?.error===`SESSION_CONTENT_CONFLICT`&&f.contentConflict&&(0,F.jsxs)(`p`,{role:`alert`,className:`say`,children:[`Conflicting Works:`,` `,f.contentConflict.workIds.map(e=>ja(f.items.find(t=>t.workId===e)?.title??e)).join(`, `),`. Session: `,(0,F.jsx)(`code`,{children:f.contentConflict.sessionKey}),`.`]}),f&&Xg.includes(f.error??``)&&(0,F.jsx)(qg,{view:e,account:t,onState:r??Zg,disconnected:!!n,refusal:!0}),p&&t.view?.state===`signed-in`&&(0,F.jsx)(Yg,{view:e,account:t,onState:r??Zg,disconnected:!!n}),i.packageError&&!w&&f?.status!==`awaiting-packaging`&&(0,F.jsx)(`p`,{role:`alert`,className:`say`,children:i.packageError}),f?.status===`awaiting-packaging`?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{role:`status`,className:`say`,children:`Your Send request is saved. Packaging will continue when available. It expires if the host restarts or after 30 minutes; then click Send again.`}),i.packageError&&(0,F.jsx)(`p`,{role:`alert`,className:`say`,children:i.packageError}),(0,F.jsx)(jg,{journey:e,title:i.packaging?.title??``}),(0,F.jsx)(`button`,{className:`tc-btn`,type:`button`,disabled:i.pauseBusy,onClick:()=>void i.withdraw(),children:`Cancel Send request`})]}):T?(0,F.jsx)(jg,{journey:e,title:i.packaging?.title??``}):w?(0,F.jsxs)(F.Fragment,{children:[i.packageError&&(0,F.jsx)(`p`,{role:`alert`,className:`say`,children:i.packageError}),(0,F.jsx)(Tg,{journey:e,send:ae,busy:u||t.view?.configuration.clientId===null,reconfirm:!1,preparing:i.preparing,hold:re,onPrepare:()=>void i.review(),onStart:()=>void i.send({included:ae.items.map(({workId:e,access:t})=>({workId:e,access:t})),omittedWorkIds:ae.omitted.map(e=>e.workId)})})]}):ee?(0,F.jsx)(Tg,{journey:e,send:f,busy:u||t.view?.configuration.clientId===null,reconfirm:E,preparing:i.preparing,hold:re,onPrepare:()=>void i.review(),onStart:()=>void i.start()}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(Ag,{send:f,journey:e}),f.status===`sign-in`&&!oe&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{className:`say`,role:`status`,children:f.request&&!f.confirmedAt?`Sign in, then click Send again to confirm the account.`:t_(t)}),t.view?.state===`signed-out`&&(0,F.jsxs)(`div`,{className:`btns`,children:[(0,F.jsx)(`button`,{className:`tc-btn primary`,type:`button`,disabled:t.busy||t.view.configuration.clientId===null,onClick:()=>void t.signIn(),children:`Sign in`}),!f.items.some(e=>e.receipt)&&(0,F.jsx)(`button`,{className:`tc-btn`,type:`button`,disabled:u,onClick:()=>void i.withdraw(),children:`Cancel`})]})]}),!p&&(0,F.jsxs)(`div`,{className:`journey-send-scope`,children:[(0,F.jsx)(Fh,{items:ce}),(0,F.jsx)(xg,{view:e,items:f.omitted})]}),O&&!p&&!k&&(0,F.jsx)(`p`,{className:`say`,children:`The remaining Works need attention in your Tacitt profile. They cannot be resumed here.`}),(0,F.jsxs)(`div`,{className:`btns`,children:[k&&(0,F.jsx)(`button`,{className:`tc-btn primary`,type:`button`,disabled:u,onClick:()=>void i.review(),children:`Review a new Send`}),p&&!k&&d&&g===null&&(0,F.jsx)(`button`,{className:`tc-btn`,type:`button`,disabled:u,onClick:()=>void i.send({included:ae.items.map(({workId:e,access:t})=>({workId:e,access:t})),omittedWorkIds:ae.omitted.map(e=>e.workId)}),children:i.preparing?`Preparing Send scope…`:`Send changes`}),(_||f.status===`completed`)&&f.status!==`sign-in`&&e_(f)&&(0,F.jsx)(`button`,{className:`tc-btn`,type:`button`,disabled:i.pauseBusy||!!n,onClick:()=>void i.retryWorks(),children:`Retry failed Works`}),(f.status===`paused`||f.status===`blocked`)&&!O&&!y&&f.error!==`SESSION_CONTENT_CONFLICT`&&(0,F.jsx)(`button`,{className:`tc-btn primary finish-go`,type:`button`,disabled:u,onClick:()=>void i.resume(),children:f.status===`paused`?`Resume submission`:`Retry remaining submission`}),_&&n_(f)&&(0,F.jsx)(`button`,{className:`tc-btn`,type:`button`,disabled:i.pauseBusy||!!n,onClick:()=>void i.pause(),children:`Pause remaining uploads`})]})]})]},p?`complete`:D?`submitting`:T?`packaging`:w?`ready`:f.status)})}var a_=e=>e.readingComplete?e.works.find(e=>e.placement===`unsorted`&&e.access!==`drop`&&e.rootSessionIds.length>0):void 0;function o_({view:e,work:t,onState:n,disconnected:r}){let[i,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(!1),[c,u]=(0,l.useState)(``),d=(0,l.useRef)(!1);async function f(){if(!(r||d.current)){d.current=!0,s(!0),u(``);try{let r=await N.nativeJourney.respond.mutate({journeyId:e.journeyId,expectedRevision:e.revision,idempotencyKey:crypto.randomUUID(),action:{kind:`work-access`,workId:t.id,access:`drop`}});n(r.state),r.status===`stale`&&u(`This Work changed. Try again.`)}catch(e){console.error(`UNSORTED_LEAVE_OUT_FAILED`),u(P(e))}finally{d.current=!1,s(!1)}}}let p=t.rootSessionIds.length;return(0,F.jsxs)(`section`,{className:`journey-decision o-top`,"aria-labelledby":`unsorted-${t.id}`,children:[(0,F.jsx)(`p`,{className:`o-k`,children:(0,F.jsx)(`span`,{className:`o-kick`,children:`Unsorted`})}),(0,F.jsxs)(`h3`,{className:`o-head`,id:`unsorted-${t.id}`,tabIndex:-1,children:[Bm(p,`session`),` `,p===1?`fits`:`fit`,` no Work`]}),(0,F.jsxs)(`div`,{className:`o-evidence`,children:[(0,F.jsx)(`ul`,{className:`o-uns`,children:(0,F.jsxs)(`li`,{children:[(0,F.jsx)(`span`,{children:Ga(t)}),(0,F.jsx)(Qm,{view:e,workId:t.id})]})}),(0,F.jsx)(`p`,{className:`o-body o-quiet`,children:`Not sent unless you place it.`})]}),(0,F.jsxs)(`p`,{className:`o-src`,children:[(0,F.jsx)(`span`,{className:`o-source-work`,children:Ga(t)}),(0,F.jsx)(`span`,{className:`o-source-context`,children:`Unsorted`})]}),(0,F.jsx)(`div`,{className:`o-foot o-foot-uns`,children:(0,F.jsxs)(`span`,{className:`o-acts`,children:[(0,F.jsx)(`button`,{type:`button`,className:`o-btn`,disabled:o||r,onClick:()=>void f(),children:`Leave out`}),(0,F.jsx)(`button`,{type:`button`,className:`o-btn`,"data-suggested":!0,"aria-expanded":i,onClick:()=>a(!i),children:`Tell your agent`})]})}),i&&(0,F.jsx)(`p`,{className:`o-hint`,children:`Say in chat which Work it belongs to.`}),c&&(0,F.jsx)(`p`,{role:`alert`,children:c})]})}function s_(e){return e===`hide`?`Hide`:`Keep`}function c_(e,t){let n=/[\p{L}\p{N}_]/u;for(let r=e.indexOf(t);r>=0;r=e.indexOf(t,r+1)){let i=e[r-1],a=e[r+t.length];if((!i||!n.test(i))&&(!a||!n.test(a)))return r}return-1}function l_(e,t){let n=t.normalize(`NFC`).toLowerCase(),r=null;for(let t of e.works)for(let e of[t.localTitle,t.title]){let i=e.normalize(`NFC`).trim().toLowerCase();i&&i.length>(r?.length??0)&&c_(n,i)>=0&&(r={work:t,length:i.length})}return r?.work??null}function u_(e,t){let n=new Set(t.termKeys),r=new Map;for(let t of e.privacy.terms){let e=JSON.stringify([t.type,t.value.normalize(`NFC`)]);n.has(e)&&r.set(e,t.value.normalize(`NFC`))}return[...r].map(([e,t])=>({key:e,value:t}))}function d_(e,t){return new Set(e.termKeys.filter(e=>!t.has(e))).size}async function f_(e,t,n,r){return N.nativeJourney.respond.mutate({journeyId:e.journeyId,expectedRevision:e.revision,idempotencyKey:crypto.randomUUID(),action:{kind:`card-answer`,cardId:t.id,optionId:n,remember:!1,excludedTermKeys:t.termKeys.filter(e=>r.has(e))}})}function p_(e,t){let n=t.filter(t=>t&&e.includes(t)).toSorted((e,t)=>t.length-e.length);if(!n.length)return[e];let r=RegExp(`(${n.map(e=>e.replace(/[.*+?^${}()|[\]\\]/gu,`\\$&`)).join(`|`)})`,`u`),i=new Set;return e.split(r).map((e,t)=>t%2==0||i.has(e)?e:(i.add(e),(0,F.jsx)(`mark`,{children:e},t)))}function m_(e,t){let n=l_(e,t);if(!n)return{work:null,title:t,context:``};let r=[n.localTitle,n.title].map(e=>e.normalize(`NFC`).trim()),i=t.normalize(`NFC`).toLowerCase(),a=r.find(e=>e&&c_(i,e.toLowerCase())>=0)??``,o=c_(i,a.toLowerCase()),s=`${t.slice(0,o)} ${t.slice(o+a.length)}`.replace(/^[\s,·:;-]+|[\s,·:;-]+$/gu,``).replace(/\s+/gu,` `);return{work:n,title:Ga(n),context:s}}var h_=(0,F.jsxs)(`svg`,{viewBox:`0 0 16 16`,width:`13`,height:`13`,"aria-hidden":`true`,children:[(0,F.jsx)(`circle`,{cx:`7`,cy:`7`,r:`5`}),(0,F.jsx)(`path`,{d:`M11 11l3.5 3.5`})]});function g_({card:e,view:t,onState:n,disconnected:r=!1,onSaved:i,onOpen:a,heading:o,inert:s=!1}){let[c,u]=(0,l.useState)(!1),[d,f]=(0,l.useState)(``),[p,m]=(0,l.useState)(``),[h,g]=(0,l.useState)(()=>new Set(e.answer?.excludedTermKeys??[])),_=(0,l.useRef)(!1),v=u_(t,e),y=d_(e,h),b=e.suggestion?.optionId,x=e.suggestion?m_(t,e.suggestion.source):null,S=v.filter(({value:e})=>e.toLowerCase().includes(p.trim().toLowerCase())),C=e.examples[0];function w(e){g(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})}async function T(a){if(!(r||_.current)){_.current=!0,u(!0),f(``);try{let r=await f_(t,e,a,h);n(r.state),r.status===`stale`?f(`The review changed. Check your answer and try again.`):i(r.state,a)}catch(e){console.error(`DECISION_CARD_SAVE_FAILED`),f(P(e))}finally{_.current=!1,u(!1)}}}let E=v.length===1?`value`:`values`;return(0,F.jsxs)(`section`,{className:`journey-decision o-top`,"data-answered":e.answer?!0:void 0,"aria-labelledby":`card-${e.id}`,inert:s||void 0,children:[(0,F.jsx)(`p`,{className:`o-k`,children:(0,F.jsx)(`span`,{className:`o-kick`,children:`Question`})}),(0,F.jsx)(`h3`,{ref:o,tabIndex:-1,className:`o-head`,id:`card-${e.id}`,children:e.question}),C&&(0,F.jsx)(`div`,{className:`o-evidence`,children:(0,F.jsx)(`p`,{className:`o-body`,children:p_(C,v.map(({value:e})=>e))})}),(0,F.jsx)(`div`,{className:`vh`,children:[`hide`,`keep`].map(t=>{let n=e.options.find(e=>e.id===t)?.rule;return n?(0,F.jsxs)(`span`,{id:`card-${e.id}-${t}-rule`,children:[(0,F.jsx)(`strong`,{children:s_(t)}),` · `,n]},t):null})}),x&&(0,F.jsx)(`p`,{className:`o-src`,children:(0,F.jsxs)(`button`,{type:`button`,disabled:!x.work||!a,onClick:()=>x.work&&a?.(x.work.id),children:[(0,F.jsx)(`span`,{className:`o-source-work`,children:x.title}),x.context&&(0,F.jsxs)(`span`,{className:`o-source-context`,children:[` · `,x.context]})]})}),v.length>0&&(0,F.jsxs)(`div`,{className:`o-terms`,children:[(0,F.jsxs)(`label`,{className:`o-tsearch`,children:[h_,(0,F.jsx)(`input`,{type:`search`,"aria-label":`Search ${E}`,placeholder:`${v.length} ${E}`,value:p,onChange:e=>m(e.currentTarget.value)})]}),(0,F.jsx)(`i`,{className:`o-trule`,"aria-hidden":`true`}),(0,F.jsx)(`div`,{className:`o-tchips`,role:`group`,"aria-label":`${E}, the selected ones take your answer`,children:S.length?S.map(({key:e,value:t})=>(0,F.jsx)(`button`,{type:`button`,className:`o-tchip`,"aria-pressed":!h.has(e),title:h.has(e)?`Left out. Tap to select`:`Selected. Tap to leave it out`,disabled:c||r,onClick:()=>w(e),children:t},e)):(0,F.jsx)(`span`,{className:`o-tnone`,children:`No match`})})]}),(0,F.jsxs)(`div`,{className:`o-foot journey-card-actions`,children:[v.length>0&&(0,F.jsxs)(`p`,{className:`o-sel`,children:[(0,F.jsx)(`span`,{className:`o-selc`,role:`status`,children:c?`Saving…`:`${y} of ${v.length} selected`}),(0,F.jsx)(`button`,{type:`button`,className:`o-tall`,disabled:c||r,onClick:()=>g(y?new Set(v.map(({key:e})=>e)):new Set),children:y?`Clear`:`Select all`})]}),(0,F.jsx)(`span`,{className:`o-acts`,children:[`keep`,`hide`].map(t=>(0,F.jsx)(`button`,{type:`button`,className:`o-btn o-ans`,"data-suggested":b===t||void 0,disabled:c||r||y===0,"aria-pressed":e.answer?.optionId===t,"aria-describedby":e.options.find(e=>e.id===t)?.rule?`card-${e.id}-${t}-rule`:void 0,onClick:()=>void T(t),children:s_(t)},t))})]}),d&&(0,F.jsx)(`p`,{role:`alert`,children:d})]})}var __=e=>Math.min(6e3,Math.max(2500,1e3+50*e)),v_=e=>(0,F.jsxs)(`svg`,{viewBox:`0 0 16 16`,width:`16`,height:`16`,"aria-hidden":`true`,children:[(0,F.jsx)(`path`,{d:`M1.5 8s2.4-4.5 6.5-4.5S14.5 8 14.5 8 12.1 12.5 8 12.5 1.5 8 1.5 8Z`}),(0,F.jsx)(`circle`,{cx:`8`,cy:`8`,r:`2`}),e&&(0,F.jsx)(`path`,{d:`M2.5 13.5 13.5 2.5`})]});function y_({view:e,onState:t,onOpen:n,reopened:r=null,onReopened:i,disconnected:a=!1}){let o=e.privacy.cards,s=(0,l.useRef)(null),[c,u]=(0,l.useState)(null),[d,f]=(0,l.useState)([]),p=(0,l.useRef)(0);(0,l.useEffect)(()=>{r&&s.current?.focus()},[r]),(0,l.useEffect)(()=>{if(!c)return;let e=setTimeout(()=>u(null),220);return()=>clearTimeout(e)},[c]);let m=[`sending`,`completed`].includes(e.phase),h=(0,l.useRef)(!1),g=!m&&o.find(e=>e.id===r)||(m?void 0:o.find(e=>e.answer===null)),_=!g&&!m?a_(e):void 0,v=g?.id;(0,l.useEffect)(()=>{h.current&&v&&(h.current=!1,s.current?.focus({preventScroll:!0}))},[v]);function y(e,t,n){u({card:e,side:n});let{values:a,projects:o}=Vm(t,t.privacy.cards.find(t=>t.id===e.id)??e),s=`${Bm(a,`value`)} ${n===`keep`?`kept`:`hidden`}`,c=o?` in ${Bm(o,`project`)}`:``,l={id:p.current+=1,optionId:n,text:{strong:s,rest:c}};f(e=>[l,...e].slice(0,3));let d=__(s.length+c.length);setTimeout(()=>f(e=>e.map(e=>e.id===l.id?{...e,leaving:!0}:e)),d-140),setTimeout(()=>f(e=>e.filter(e=>e.id!==l.id)),d),e.id===r?i?.():h.current=!0}return(0,F.jsxs)(F.Fragment,{children:[d.length>0&&(0,F.jsx)(`ol`,{className:`o-toasts`,"aria-live":`polite`,children:d.map((e,t)=>(0,F.jsxs)(`li`,{className:`o-toast`,"data-option":e.optionId,"data-depth":t,"data-leaving":e.leaving||void 0,children:[v_(e.optionId===`hide`),(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`b`,{children:e.text.strong}),e.text.rest]})]},e.id))}),(g||c||_)&&(0,F.jsx)(`section`,{className:`o-deck`,"aria-label":`Needs a look`,children:(0,F.jsxs)(`div`,{className:`o-stack`,children:[(0,F.jsx)(`i`,{className:`o-back`,"data-p":`2`,"aria-hidden":`true`}),(0,F.jsx)(`i`,{className:`o-back`,"data-p":`1`,"aria-hidden":`true`}),g&&(0,F.jsx)(g_,{card:g,view:e,onState:t,disconnected:a,heading:s,onOpen:n,onSaved:(e,t)=>y(g,e,t)},g.id),!g&&_&&(0,F.jsx)(o_,{view:e,work:_,onState:t,disconnected:a},_.id),c&&(0,F.jsx)(`div`,{className:`o-leave`,"data-side":c.side,"aria-hidden":`true`,children:(0,F.jsx)(g_,{card:c.card,view:e,onState:t,inert:!0,onSaved:()=>{}})})]})})]})}function b_(e){let t=e.works.filter(Ra);if(!e.snapshotId||e.scope.status!==`confirmed`||!t.length||t.some(e=>e.status===`pending`))return null;let n=t.reduce((e,t)=>e+t.totalBatches,0),r=t.reduce((e,t)=>e+t.completedBatches,0);return n?r===n&&!e.readingComplete?null:Math.floor(r/n*100):e.readingComplete?100:null}function x_(e){let t=e.works.filter(Ia);return e.scope.status===`confirmed`&&e.phase!==`paused`&&t.some(e=>e.status===`pending`)&&!t.every(t=>Ja(e,t))&&b_(e)===null}function S_(e){if(e.classificationProgress?.status===`failed`)return`Classification stopped. Ask your agent to retry.`;if(e.phase===`paused`)return`Paused. Progress is saved.`;if(e.classificationProgress?.status===`running`&&!Wa(e)||e.snapshotId&&e.scope.status===`pending`&&e.classificationRevision===null)return`Classifying your conversations.`;if(e.phase===`discovering`||!e.works.length)return`Finding your conversations.`;if(e.scope.status!==`confirmed`)return e.classificationRevision===null?`Organizing your conversations before privacy scanning.`:`Privacy scanning starts on its own. You can change any Work’s visibility at any time.`;let t=e.works.filter(Ia);if(!t.length)return e.works.length?`No Works selected.`:`Finding your conversations.`;if(t.every(t=>Ja(e,t)))return`Ready for privacy scanning. Waiting for your agent to start.`;if(t.some(e=>e.status===`pending`))return t.some(e=>e.totalBatches>e.completedBatches)||Fa(e).some(e=>[`running`,`awaiting-validation`,`ready-to-submit`].includes(e.status))?`Static scanning and AI review are in progress.`:`Preparing static scans.`;if(b_(e)===null&&t.some(e=>e.status===`blocked`))return e.privacy.packageApproval?`Some Works could not be packaged. Review the error and retry packaging.`:`Some Works could not be processed. Retry or Drop them.`;if(b_(e)===null)return`Organizing your conversations.`;if(!Va(e))return Ma(Fa(e).filter(e=>[`unknown`,`failed`,`blocked`].includes(e.status)))??(e.readingComplete?`Reviewing Work details.`:`AI privacy scanning.`);if(e.phase===`sending`||e.phase===`completed`)return`See Send status below.`;let n=t.filter(Ra);return n.some(t=>Ka(e,t)===`Processing failed`)?`Some Works could not be processed. Retry or Drop them.`:Ba(e).some(e=>e.disposition===`pending`)?e.privacy.cards.length?e.privacy.cards.some(e=>!e.answer)?`Answer the privacy decision cards.`:`Applying your answers to the remaining values.`:`Preparing decision cards for uncertain values.`:Ha(e)?e.privacy.packageApproval?n.every(e=>e.artifact?.revision===e.revision)?`Packages are ready. Review the Send scope below.`:`Packaging your confirmed Works.`:`Ready to send.`:`Finishing the full static protection pass.`}function C_(e){let t=e.classificationProgress;if(t?.status===`failed`||e.phase===`paused`)return{text:S_(e)};if(e.scope.status===`pending`){if(Wa(e))return null;let n=t?.rootIds.length??0;return n>0?{verb:`Grouping`,object:`${Bm(n,`session`)} into Works`}:{verb:`Listing`,object:`session files`}}if(e.phase===`discovering`||!e.snapshotId&&!e.works.length)return{verb:`Listing`,object:`session files`};let n=e.works.filter(Ia);if(n.length&&n.every(t=>Ja(e,t)))return{text:S_(e)};let r=Ma(Fa(e).filter(e=>[`unknown`,`failed`,`blocked`].includes(e.status)));if(r)return{text:r};let i=S_(e);return/could not be/u.test(i)?{text:i}:x_(e)?null:n.length&&b_(e)===null?{text:i}:null}function w_({children:e=null}){return(0,F.jsxs)(`section`,{className:`now`,"aria-label":`Now`,children:[(0,F.jsx)(`p`,{className:`now-k`,children:(0,F.jsx)(`span`,{className:`tc-kicker`,children:`Now`})}),(0,F.jsx)(`p`,{className:`now-t`,children:`Nothing needs a look`}),(0,F.jsx)(`div`,{className:`now-b`,children:(0,F.jsx)(`p`,{className:`say`,children:`New things land here as Works are read.`})}),e]})}function T_({view:e}){if([`sending`,`completed`].includes(e.phase))return null;let t=b_(e),n=C_(e),r=e.classificationProgress?.status===`failed`||e.phase===`paused`,i=e.phase===`discovering`||!e.snapshotId&&!e.works.length,a=e.scope.status===`pending`&&!Wa(e)&&!r||i||x_(e),o=e.scope.status===`pending`?`Classification progress`:`Reading progress`;return!a&&t===null&&!n?null:(0,F.jsxs)(`section`,{className:`prog`,"aria-label":`Progress`,children:[(a||t!==null)&&(0,F.jsxs)(`div`,{className:`barline`,children:[(0,F.jsx)(`progress`,{className:`tc-bar`,"aria-label":o,value:a?void 0:t??void 0,max:100}),!a&&(0,F.jsxs)(`span`,{children:[t,`%`]})]}),n&&(0,F.jsx)(`p`,{className:`now-cap`,role:`status`,children:`text`in n?(0,F.jsx)(`span`,{children:n.text}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`span`,{className:`now-v`,children:n.verb}),(0,F.jsx)(`b`,{className:`now-w`,children:n.object})]})})]})}var E_=15e3;function D_({journeyId:e,done:t,needed:n}){let[r,i]=(0,l.useState)(null),[a,o]=(0,l.useState)(()=>Date.now());(0,l.useEffect)(()=>{if(t)return;let n=!0,r=()=>void N.nativeJourney.presence.query({journeyId:e}).then(e=>{n&&(i(e.agent?.at??null),o(Date.now()))}).catch(()=>{});r();let a=setInterval(r,E_);return()=>{n=!1,clearInterval(a)}},[e,t]);let s=t?null:to(r,a,n);return s?(0,F.jsx)(`span`,{className:`tc-agent`,"data-state":s.state,role:`status`,children:s.text}):null}var O_=[{id:`google`,label:`Sign in with Google`},{id:`github`,label:`Sign in with GitHub`}],k_=new Intl.Segmenter(void 0,{granularity:`grapheme`}),A_=e=>e.trim().split(/\s+/u).slice(0,2).map(e=>k_.segment(e).containing(0)?.segment??``).join(``).toUpperCase()||`U`;function j_({id:e}){return e===`google`?(0,F.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`18`,height:`18`,"aria-hidden":`true`,fill:`none`,strokeWidth:`3.6`,children:[(0,F.jsx)(`path`,{stroke:`#ea4335`,d:`M17.66 6.34A8 8 0 0 0 4.48 9.26`}),(0,F.jsx)(`path`,{stroke:`#fbbc05`,d:`M4.48 9.26a8 8 0 0 0 0 5.48`}),(0,F.jsx)(`path`,{stroke:`#34a853`,d:`M4.48 14.74a8 8 0 0 0 13.65 2.4`}),(0,F.jsx)(`path`,{stroke:`#4285f4`,d:`M18.13 17.14A8 8 0 0 0 20 12h-8`})]}):(0,F.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`18`,height:`18`,"aria-hidden":`true`,children:(0,F.jsx)(`path`,{fill:`currentColor`,fillRule:`evenodd`,d:`M12 1a11 11 0 1 1 0 22 11 11 0 0 1 0-22ZM7.6 9.2 7.4 6.2l2.2 1.4q2.4-.6 4.8 0l2.2-1.4-.2 3q1.2 1.4.6 3.6-.8 2.4-3.6 2.6l.2.6v4.6h-3.2v-2q-2.4.4-3.2-1.4 1.2.4 1.8.4 1 0 1.4-1l.2-1.2q-2.8-.2-3.6-2.6-.6-2.2.6-3.6Z`})})}function M_({account:e,busy:t,disabled:n,onAllow:r}){let i=e.view,a=i?.state??null,o=a===`authorizing`||a===`starting-sign-in`,[s,c]=(0,l.useState)(null),[u,d]=(0,l.useState)(!1),[f,p]=(0,l.useState)(o),[m,h]=(0,l.useState)(null);o!==f&&(p(o),!o&&a===`signed-out`&&h(i?.lastError?{text:Xh(i.lastError),alert:!0}:{text:Zh,alert:!1}),o&&h(null));let g=(0,l.useRef)(!1),_=(0,l.useRef)(null),v=(0,l.useRef)(r);(0,l.useEffect)(()=>{v.current=r}),(0,l.useEffect)(()=>{g.current&&(a===`signed-in`?(g.current=!1,u||v.current()):a===`signed-out`&&!e.busy&&(g.current=!1,_.current?.focus()))},[a,u,e.busy]);function y(t){g.current=!0,c(t),e.signIn(t)}let b=e=>(0,F.jsxs)(`p`,{className:`f-disc`,children:[`By `,e,`, Tacitt reads your sessions through the model your agent already uses.`]}),x=m&&(0,F.jsx)(`p`,{role:m.alert?`alert`:`status`,className:`welcome-message`,children:m.text});if(i?.state===`signed-in`)return(0,F.jsxs)(`section`,{className:`welcome-auth`,"aria-label":`Account sign-in`,children:[(0,F.jsxs)(`div`,{className:`welcome-account`,children:[(0,F.jsxs)(`p`,{children:[`Signed in as`,(0,F.jsx)(`span`,{className:`welcome-avatar`,"aria-hidden":`true`,children:i.avatarUrl?(0,F.jsx)(`img`,{src:i.avatarUrl,alt:``,referrerPolicy:`no-referrer`}):A_(i.displayName)}),(0,F.jsx)(`strong`,{children:i.displayName})]}),(0,F.jsx)(`button`,{type:`button`,className:`welcome-text-action`,disabled:e.busy||t,onClick:()=>{d(!0),e.signOut()},children:`Switch account`})]}),(0,F.jsxs)(`p`,{className:`btns`,children:[(0,F.jsx)(`button`,{className:`tc-btn primary welcome-go`,type:`button`,disabled:t||n,onClick:r,children:t?`Starting…`:u?`Allow to continue`:`Continue`}),(0,F.jsx)(`span`,{className:`say quiet`,children:`or say yes in chat`})]}),b(`continuing`)]});if(i&&i.configuration.clientId===null)return(0,F.jsxs)(`section`,{className:`welcome-auth`,"aria-label":`Start`,children:[(0,F.jsxs)(`p`,{className:`btns`,children:[(0,F.jsx)(`button`,{className:`tc-btn primary welcome-go`,type:`button`,disabled:t||n,onClick:r,children:t?`Starting…`:`Continue`}),(0,F.jsx)(`span`,{className:`say quiet`,children:`or say yes in chat`})]}),(0,F.jsxs)(`p`,{className:`say quiet`,children:[`Sending needs sign-in, which is not configured in this build. Set`,` `,(0,F.jsx)(`code`,{children:`SESS_PILOT_IDENTITY_CLIENT_ID`}),` before starting the agent to sign in.`]}),b(`continuing`)]});let S=i?.state===`authorizing`?i.userCode:null;return(0,F.jsxs)(`section`,{className:`welcome-auth`,"aria-label":`Account sign-in`,children:[(0,F.jsx)(`div`,{className:`welcome-providers`,role:`group`,"aria-label":`Sign-in methods`,children:O_.map((t,r)=>{let a=o&&s===t.id;return(0,F.jsxs)(`button`,{ref:r===0?_:void 0,type:`button`,className:`tc-btn welcome-provider`,"data-pending":a||void 0,"aria-label":a?`Signing you in…`:void 0,disabled:!i||e.busy||n||o&&!a,onClick:()=>y(t.id),children:[a?(0,F.jsx)(`i`,{className:`welcome-spinner`,"aria-hidden":`true`}):(0,F.jsx)(j_,{id:t.id}),(0,F.jsx)(`span`,{children:t.label})]},t.id)})}),u&&!o?(0,F.jsx)(`p`,{className:`f-disc`,children:`Sign in to switch accounts. You’ll confirm access before any sessions are read.`}):b(`signing in`),x,o&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`welcome-message`,role:`status`,children:[S?`Approve code ${S.length===8?`${S.slice(0,4)}-${S.slice(4)}`:S} on the sign-in page.`:`Opening the sign-in page…`,` `,i?.state===`authorizing`&&!e.approvalOpened&&(0,F.jsx)(`a`,{href:ha(i.verificationUriComplete,s),target:`_blank`,rel:`noopener noreferrer`,children:`Open sign-in page`})]}),(0,F.jsx)(`button`,{type:`button`,className:`welcome-text-action welcome-cancel`,disabled:e.busy,onClick:()=>{g.current=!1,e.cancel()},children:`Cancel sign-in`})]})]})}var N_=[[`You sign in to start`],[`We find your sessions`,`Names, folders, dates and content`],[`We hide private details`,`You answer a few questions in chat`],[`You review each Work`],[`You send it to your Tacitt profile`]];function P_(){return(0,F.jsx)(`svg`,{className:`f-tk`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,F.jsx)(`path`,{d:`M3 8.5l3.2 3L13 4.5`})})}async function F_(e){return(await N.nativeJourney.respond.mutate({journeyId:e.journeyId,expectedRevision:e.revision,idempotencyKey:crypto.randomUUID(),action:{kind:`consent`,allow:!0}})).state}function I_({view:e,account:t,connection:n=``,onState:r}){let[i,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(!1),[c,u]=(0,l.useState)(``),d=(0,l.useRef)(!1);async function f(){if(!(n||d.current)){d.current=!0,s(!0),u(``);try{r(await F_(e))}catch(e){console.error(`JOURNEY_CONSENT_FAILED`),u(P(e))}finally{d.current=!1,s(!1)}}}return(0,F.jsxs)(`section`,{className:`journey-welcome`,children:[(0,F.jsxs)(`div`,{className:`ob-hero tc-dither`,children:[(0,F.jsxs)(`h1`,{children:[(0,F.jsx)(`span`,{className:`welcome-accent`,children:`Stay Tacitt.`}),(0,F.jsx)(`br`,{}),`Your sessions talk.`]}),(0,F.jsx)(`p`,{className:`tag-sub`,children:`Every prompt. Every fix. Every call you made.`})]}),(0,F.jsxs)(`ul`,{className:`f-prom`,"aria-label":`Our promises`,children:[(0,F.jsxs)(`li`,{children:[(0,F.jsx)(P_,{}),(0,F.jsx)(`span`,{children:`No sessions are sent to Tacitt until you press Send.`})]}),(0,F.jsxs)(`li`,{children:[(0,F.jsx)(P_,{}),(0,F.jsx)(`span`,{children:`Keys and personal details are hidden first.`}),(0,F.jsx)(`div`,{className:`kk-w`,children:(0,F.jsx)(Gm,{compact:!0})})]}),(0,F.jsxs)(`li`,{children:[(0,F.jsx)(P_,{}),(0,F.jsx)(`span`,{children:`You choose Public, Private or Drop for each Work.`})]})]}),(0,F.jsxs)(`button`,{className:`f-how`,type:`button`,"aria-expanded":i,"aria-controls":`journey-how`,onClick:()=>a(!i),children:[(0,F.jsx)(`span`,{children:`How it works`}),(0,F.jsx)(`i`,{"aria-hidden":`true`})]}),(0,F.jsx)(`div`,{className:`f-more`,id:`journey-how`,"aria-hidden":!i,inert:!i,children:(0,F.jsx)(`div`,{children:(0,F.jsx)(`ol`,{className:`flist`,children:N_.map(([e,t],n)=>(0,F.jsxs)(`li`,{children:[(0,F.jsx)(`span`,{className:`no`,children:String(n+1).padStart(2,`0`)}),(0,F.jsxs)(`span`,{className:`f-line`,children:[(0,F.jsx)(`span`,{children:e}),t&&(0,F.jsx)(`small`,{children:t})]})]},e))})})}),(0,F.jsxs)(`div`,{className:`ob-start`,children:[n&&(0,F.jsx)(`p`,{role:`status`,className:`journey-connection`,children:n}),(0,F.jsx)(M_,{account:t,busy:o,disabled:!!n,onAllow:()=>void f()}),c&&(0,F.jsx)(`p`,{role:`alert`,className:`welcome-message`,children:c})]})]})}function L_(e){return e?.hasAttribute(`data-scaled`)?e.scrollTop:window.scrollY}function R_(e,t){e?.hasAttribute(`data-scaled`)?e.scrollTo(0,t):window.scrollTo(0,t)}function z_(e){let t=(0,l.useRef)(null);return(0,l.useLayoutEffect)(()=>{let n=t.current,r=n?.parentElement;if(!n||!r)return;let i=!1,a=0;function o(){n&&(delete n.dataset.scaled,n.style.width=``,n.style.height=``,n.style.transform=``)}function s(){if(n&&r){if(e&&r.clientWidth>640){let e=i?null:window.scrollY;n.dataset.scaled=``;let t=640+n.offsetWidth-n.clientWidth,a=r.clientWidth/t;n.style.width=`${t}px`,n.style.height=`${r.clientHeight/a}px`,n.style.transform=`scale(${a})`,i=!0,e!==null&&(n.scrollTop=e,document.activeElement===document.body&&n.focus({preventScroll:!0}))}else if(i){let e=n.scrollTop;o(),i=!1,window.scrollTo(0,e)}}}let c=new ResizeObserver(()=>{cancelAnimationFrame(a),a=requestAnimationFrame(s)});return c.observe(r),c.observe(n),s(),()=>{if(cancelAnimationFrame(a),c.disconnect(),i){let e=n.scrollTop;o(),window.scrollTo(0,e)}}},[e]),t}var B_=e=>{},V_=450;function H_({view:e,connection:t=``,onState:n=B_}){let r=va(),i=!!(e&&Ua(e)),a=z_(!0),o=(0,l.useRef)(null),[s,c]=(0,l.useState)(null),u=!!(e&&[`sending`,`completed`].includes(e.phase)),d=e&&Wa(e)&&!u?e.works.find(e=>e.id===s):void 0,f=!!(e?.consent&&!d&&e.works.some(Ra)&&(i||[`sending`,`completed`].includes(e.phase)||e.privacy.packageApproval&&e.works.filter(Ra).every(yh))),[p,m]=(0,l.useState)(null),[h,g]=(0,l.useState)(null);e&&!e.consent&&p!==e&&m(e),e?.consent&&p&&(g(p),m(null)),(0,l.useEffect)(()=>{if(!h)return;let e=setTimeout(()=>g(null),V_);return()=>clearTimeout(e)},[h]);let _=!!(e&&[`sending`,`completed`].includes(e.phase)),v=i&&!e?.works.some(Ra),y=e&&!f&&!v?Hg(e,r):null,[b,x]=(0,l.useState)(null),[S,C]=(0,l.useState)(0),w=(0,l.useRef)(0),T=(0,l.useRef)(null),E=(0,l.useRef)(null);(0,l.useEffect)(()=>{if(E.current!==s){if(R_(a.current,s?0:w.current),s)o.current?.querySelector(`h1`)?.focus({preventScroll:!0});else if(T.current){let e=o.current?.querySelector(`[data-work-id="${CSS.escape(T.current)}"]`);e instanceof HTMLButtonElement&&e.focus({preventScroll:!0})}E.current=s}},[a,s]);function ee(t){e&&Wa(e)&&!u&&(w.current=L_(a.current),T.current=t,c(t))}return(0,F.jsxs)(`div`,{ref:a,className:`native-panel`,tabIndex:-1,children:[(0,F.jsxs)(`header`,{className:`tc-head`,children:[(0,F.jsx)(`span`,{className:`tc-logo`,children:`tacitt`}),e?.consent&&(0,F.jsx)(D_,{journeyId:e.journeyId,done:e.phase===`completed`,needed:eo.includes(e.phase)}),(0,F.jsx)($h,{account:r,offeredInPage:!(!e||e.consent)})]}),(0,F.jsxs)(`main`,{className:`native-journey`,children:[(0,F.jsx)(eg,{account:r,inSend:f||!(!e||e.consent)}),e?e.consent?(0,F.jsxs)(F.Fragment,{children:[h&&(0,F.jsx)(`div`,{className:`fold`,"data-fold":`out`,inert:!0,"aria-hidden":`true`,children:(0,F.jsx)(`div`,{children:(0,F.jsx)(I_,{view:h,account:r,onState:B_})})}),(0,F.jsxs)(`div`,{ref:o,className:h?`fold`:void 0,"data-fold":h?`in`:void 0,children:[t&&(0,F.jsx)(`p`,{role:`status`,className:`journey-connection`,children:t}),d?(0,F.jsx)(vh,{view:e,work:d,onState:n,onBack:()=>{c(null),C(e=>e+1)},disconnected:!!t}):(0,F.jsxs)(`div`,{className:S?`page-back`:void 0,children:[y===`address`?(0,F.jsx)(qg,{view:e,account:r,onState:n,disconnected:!!t}):y===`links`?(0,F.jsx)(Jg,{view:e,onState:n,disconnected:!!t}):(0,F.jsx)(y_,{view:e,onState:n,onOpen:ee,reopened:b,onReopened:()=>x(null),disconnected:!!t}),f&&(0,F.jsx)(i_,{account:r,journey:e,connection:t,onState:n}),!u&&!y&&(f||_||!e.privacy.cards.some(e=>e.answer===null||e.id===b)&&!a_(e))&&(0,F.jsx)(mh,{view:e,onState:n,disconnected:!!t,fallback:f?null:e=>(0,F.jsx)(w_,{children:e}),skippedOnly:f}),(0,F.jsx)(T_,{view:e}),!u&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(Zm,{view:e,onChangeAnswer:x}),(0,F.jsx)(lg,{view:e,onOpen:ee,onState:n,disconnected:!!t}),!e.works.length&&(0,F.jsx)(`p`,{className:`journey-muted pr-note`,children:`Works will appear here as they are found.`})]})]},S)]})]}):(0,F.jsx)(I_,{view:e,account:r,connection:t,onState:n}):(0,F.jsx)(`p`,{role:`status`,className:`journey-connection`,children:t||`Connecting to your local session…`})]})]})}function U_(){let e=ka(new URLSearchParams(location.search).get(`journey`)??``);return(0,F.jsx)(H_,{view:e.view,connection:e.connection,onState:e.accept})}function W_(){let e=new URLSearchParams(location.search).get(`view`);return e===`results`||e===`skill`?e:`review`}function G_(){let[e,t]=(0,l.useState)(W_);return(0,l.useEffect)(()=>{let e=()=>t(W_());return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),e===`skill`?(0,F.jsx)(U_,{}):(0,F.jsx)(K_,{})}function K_(){let e=dr(),t=va(),{current:n}=e,[r,i]=(0,l.useState)(W_),a=(0,l.useRef)(null),o=(0,l.useRef)(!0);(0,l.useEffect)(()=>{let e=()=>i(W_());return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),(0,l.useEffect)(()=>{if(!n)return;let e=n?.phase===`completed`?n.artifact?.bundleId:null;if(o.current&&(o.current=!1,e&&new URLSearchParams(location.search).has(`view`))){a.current=e;return}if(!e||e===a.current)return;a.current=e;let t=new URL(location.href);t.searchParams.set(`view`,`results`),history.replaceState(null,``,t.pathname+t.search),i(W_()),window.dispatchEvent(new PopStateEvent(`popstate`))},[n]);function s(e){let t=new URL(location.href);t.searchParams.set(`view`,e),history.pushState(null,``,t.pathname+t.search),i(e)}return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`header`,{children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`span`,{className:`brand`,children:`tacitt`}),(0,F.jsx)(`p`,{children:`Review local sessions. Confirm what leaves your workspace.`})]}),(0,F.jsxs)(`div`,{className:`header-actions`,children:[(0,F.jsx)(`span`,{className:`local`,children:`Local collection`}),!e.stopped&&(0,F.jsx)(Sa,{account:t})]})]}),(0,F.jsxs)(`main`,{children:[(0,F.jsx)(`h1`,{children:`Collect session logs`}),!e.stopped&&(0,F.jsx)(wa,{account:t}),n&&!e.stopped&&(0,F.jsxs)(`nav`,{className:`actions main-views`,"aria-label":`Main views`,children:[(0,F.jsx)(`button`,{type:`button`,"aria-current":r===`review`?`page`:void 0,onClick:()=>s(`review`),children:`Review and package`}),(0,F.jsx)(`button`,{type:`button`,"aria-current":r===`results`?`page`:void 0,disabled:!n.operation&&!n.artifact&&!n.hasBaseline,onClick:()=>s(`results`),children:`Bundle results`})]}),e.stopped?(0,F.jsxs)(`section`,{role:`status`,children:[(0,F.jsx)(`h2`,{children:`Progress saved`}),(0,F.jsx)(`p`,{children:`The CLI has stopped. Start it again when you are ready to continue.`})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{className:`connection`,role:`status`,children:e.connection}),e.error&&(0,F.jsxs)(`div`,{className:`error`,role:`alert`,children:[(0,F.jsx)(`p`,{children:e.error}),(0,F.jsx)(`button`,{type:`button`,onClick:e.reconnect,children:`Reload current state`})]}),!n&&(0,F.jsxs)(`section`,{children:[(0,F.jsx)(`p`,{children:`Waiting for the authorized CLI to load the current approval.`}),(0,F.jsx)(`p`,{children:`Use the complete access URL printed in your terminal. A new CLI instance has a new access URL.`})]}),n&&r===`results`&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(fa,{current:n,connected:e.connected}),(0,F.jsx)(Gh,{current:n,account:t,onSave:()=>void e.saveAndExit(),saveDisabled:e.busy||n.phase===`packaging`})]}),n&&r===`review`&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(fa,{current:n,connected:e.connected}),(0,F.jsx)(hr,{items:n.warnings}),(0,F.jsx)(ca,{current:n,workflow:e},`method-${n.runId}`),n.methodChosen&&(0,F.jsxs)(F.Fragment,{children:[n.treatmentMode===`configured`&&(0,F.jsx)(hi,{current:n,workflow:e,scope:{scope:`overall`}}),(0,F.jsx)(Ni,{current:n,workflow:e,scope:{scope:`overall`}}),(0,F.jsx)(Xi,{current:n,workflow:e},`${n.runId}:${n.inventoryGeneration}`),(0,F.jsx)(Qi,{current:n,workflow:e},n.runId)]}),(0,F.jsx)(sa,{current:n,workflow:e},n.runId),(0,F.jsx)(pr,{current:n,workflow:e}),(0,F.jsx)(pa,{})]})]})]}),(0,F.jsx)(`footer`,{children:`All collection actions are controlled by the foreground CLI.`})]})}var q_=document.getElementById(`root`);if(!q_)throw Error(`The application root is missing.`);(0,u.createRoot)(q_).render((0,l.createElement)(G_));
174
+ var Rm={identity:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`}),(0,F.jsx)(`circle`,{cx:`12`,cy:`7`,r:`4`})]}),credentials:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`}),(0,F.jsx)(`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`})]}),internal:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`}),(0,F.jsx)(`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`}),(0,F.jsx)(`path`,{d:`M6 6h.01M6 18h.01`})]}),private:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`}),(0,F.jsx)(`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`})]})};function zm({kind:e,size:t=14}){return(0,F.jsx)(`svg`,{className:`kicon`,"data-kind":e,viewBox:`0 0 24 24`,width:t,height:t,"aria-hidden":`true`,children:Rm[e]})}var Bm=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`;function Vm(e,t){let n=t.answer?.optionId??null,r=new Set(t.answer?.excludedTermKeys??[]),i=new Set(t.termKeys.filter(e=>!r.has(e))),a=new Set(e.privacy.terms.filter(e=>i.has(JSON.stringify([e.type,e.value.normalize(`NFC`)]))).flatMap(e=>e.sources.map(e=>e.workId)));return{verb:n===`keep`?`kept`:`hidden`,values:i.size,projects:a.size}}function Hm(e,t){let{verb:n,projects:r}=Vm(e,t);return`${t.question.trim().replace(/\?$/u,``)} · ${n}${r?` in ${Bm(r,`project`)}`:``}`}function Um(e,t=()=>!0){let[n,r]=(0,l.useState)({value:e,count:0});if(!Object.is(n.value,e)){let i=n.count+ +!!t(n.value,e);return r({value:e,count:i}),i}return n.count}var Wm=[{id:`identity`,label:`Identity and contact`,short:`Identity`,example:`Names, emails and phone numbers`,examples:`emails, phone numbers, names`,tip:`Names, email addresses and phone numbers.`},{id:`credentials`,label:`Credentials`,short:`Credentials`,example:`Keys, passwords and tokens`,examples:`keys, tokens, passwords`,tip:`API keys, tokens and passwords.`},{id:`internal`,label:`Internal resources`,short:`Internal`,example:`Internal links, paths and company details`,examples:`internal hosts, paths, code names`,tip:`Internal hosts, file paths and project code names.`},{id:`private`,label:`Private content`,short:`Private`,example:`Health, financial and personal details`,examples:`health, money, client details`,tip:`Personal, health, financial and client details.`}];function Gm({compact:e=!1}){return(0,F.jsx)(`ul`,{className:`kk${e?` compact`:``}`,children:Wm.map(t=>(0,F.jsxs)(`li`,{"data-kind":t.id,children:[(0,F.jsx)(zm,{kind:t.id,size:e?13:14}),(0,F.jsx)(`b`,{children:t.label}),!e&&(0,F.jsx)(`span`,{children:t.example})]},t.id))})}var Km=e=>JSON.stringify([e.type,e.value.normalize(`NFC`)]);function qm(e,t){let n=new Set(e.privacy.cards.filter(e=>e.answer?.optionId===`keep`).flatMap(e=>e.termKeys)),r=new Map(e.privacy.terms.filter(e=>(e.disposition===`hidden`||e.disposition===`pending`&&!n.has(Km(e)))&&(!t||e.sources.some(e=>e.workId===t))).map(e=>[Km(e),e]));return Wm.map(e=>({...e,count:[...r.values()].filter(t=>Am[t.type].kind===e.id).length}))}function Jm({kind:e,line:t}){return(0,F.jsxs)(`span`,{className:`ktip`,"aria-hidden":`true`,children:[(0,F.jsxs)(`span`,{className:`ktip-head`,"data-kind":e.id,children:[(0,F.jsx)(zm,{kind:e.id}),(0,F.jsx)(`strong`,{children:e.label})]}),(0,F.jsx)(`span`,{className:`ktip-line`,children:t}),(0,F.jsx)(`span`,{className:`ktip-line ktip-desc`,children:e.tip})]})}function Ym({count:e}){let t=Um(e,(e,t)=>t<e);return(0,F.jsx)(`b`,{"data-flash":t>0||void 0,children:e.toLocaleString(`en-US`)},t)}var Xm=e=>`${e.toLocaleString(`en-US`)} ${e===1?`item`:`items`}`;function Zm({view:e,onChangeAnswer:t}){let n=qm(e),[r,i]=(0,l.useState)(!1),a=(0,l.useRef)(null);(0,l.useEffect)(()=>{if(!r)return;function e(e){(e instanceof KeyboardEvent&&e.key===`Escape`||e instanceof PointerEvent&&e.target instanceof Node&&!a.current?.contains(e.target))&&i(!1)}return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,e)}},[r]);let o=e.privacy.cards.filter(e=>e.answer!==null),s=[`sending`,`completed`].includes(e.phase);return(0,F.jsxs)(`section`,{ref:a,className:`hid`,"aria-label":`Hidden so far`,children:[(0,F.jsxs)(`p`,{className:`hid-h`,title:`Unique values found so far, including ones still awaiting your answers; values you keep are taken off. Not replacement occurrences.`,children:[`Hidden so far`,` `,(0,F.jsx)(`b`,{children:n.reduce((e,t)=>e+t.count,0).toLocaleString(`en-US`)})]}),(0,F.jsx)(`button`,{type:`button`,className:`kinds hid-t`,"aria-expanded":r,"aria-controls":`hid-pop`,"aria-label":`Hidden so far: show category names, examples and applied privacy choices`,onClick:()=>i(!r),children:n.map(e=>(0,F.jsxs)(`span`,{className:`kc`,"data-kind":e.id,title:e.label,children:[(0,F.jsx)(zm,{kind:e.id}),(0,F.jsx)(Ym,{count:e.count}),(0,F.jsx)(Jm,{kind:e,line:`${Xm(e.count)} hidden so far.`})]},e.id))}),r&&(0,F.jsxs)(`div`,{className:`hid-pop`,id:`hid-pop`,children:[(0,F.jsx)(`ul`,{className:`kk`,children:n.map(e=>(0,F.jsxs)(`li`,{"data-kind":e.id,children:[(0,F.jsx)(zm,{kind:e.id}),(0,F.jsx)(`b`,{children:e.label}),(0,F.jsx)(`span`,{children:e.examples})]},e.id))}),o.length>0&&(0,F.jsxs)(`section`,{className:`o-rules`,"aria-label":`Applied decisions`,children:[(0,F.jsxs)(`p`,{className:`o-rules-h`,children:[o.length,` privacy `,o.length===1?`choice`:`choices`,` applied`]}),(0,F.jsx)(`ul`,{className:`o-rule-w`,children:o.map(n=>(0,F.jsxs)(`li`,{children:[(0,F.jsx)(`span`,{children:Hm(e,n)}),t&&!s&&(0,F.jsx)(`button`,{type:`button`,className:`o-rule-change`,onClick:()=>{i(!1),t(n.id)},children:`Change`})]},n.id))})]})]})]})}function Qm({view:e,workId:t}){return(0,F.jsx)(`span`,{className:`pr-f`,"aria-label":`Hidden keywords`,children:qm(e,t).filter(e=>e.count>0).map(e=>(0,F.jsxs)(`span`,{className:`kf`,"data-kind":e.id,tabIndex:0,children:[(0,F.jsx)(zm,{kind:e.id}),(0,F.jsx)(Ym,{count:e.count}),(0,F.jsxs)(`span`,{className:`vh`,children:[` `,e.label]}),(0,F.jsx)(Jm,{kind:e,line:`${Xm(e.count)} found in this Work.`})]},e.id))})}var $m=e=>`${e.type}\u0000${e.value}`,eh=new Intl.DateTimeFormat(`en-GB`,{day:`numeric`,month:`short`});function th({term:e,workId:t}){let n=e.sources.find(e=>e.workId===t)?.context??``,r=n.indexOf(e.value),i=(0,F.jsxs)(`span`,{className:`pl`,"data-kind":Am[e.type].kind,children:[(0,F.jsx)(zm,{kind:Am[e.type].kind,size:12}),Am[e.type].label]}),a=(0,F.jsx)(`s`,{"data-kind":Am[e.type].kind,children:e.value});if(r<0)return(0,F.jsxs)(F.Fragment,{children:[a,` `,i]});let o=Math.max(0,r-30),s=Math.min(n.length,r+e.value.length+40),c=n.indexOf(` `,o),l=o>0?`…${n.slice(c>=0&&c<r?c+1:o,r)}`:n.slice(0,r),u=n.slice(r+e.value.length,s),d=s<n.length?`${u.slice(0,u.lastIndexOf(` `)+1||void 0)}…`:u;return(0,F.jsxs)(F.Fragment,{children:[l,a,` `,i,d]})}function nh(e,t,n){let[r,i]=(0,l.useState)(new Map);return(0,l.useEffect)(()=>{if(!n)return;let r=new AbortController,a=r.signal;return(async()=>{let n=new Map;for(let r=0,i=0;i<20;i+=1){let i=await N.nativeJourney.classificationSessions.query({journeyId:e.journeyId,workId:t.id,after:r,limit:100},{signal:a});for(let e of i.sessions){let t=e.titleAvailable?e.title:`Untitled`,r=e.lastInteractionAt?` · ${eh.format(new Date(e.lastInteractionAt))}`:``;n.set(e.id,`${t}${r}`)}if(i.next===null)break;r=i.next}let r=new Map,o;for(let s=0;s<40;s+=1){let s=await N.nativeJourney.findings.query({journeyId:e.journeyId,workId:t.id,...o?{cursor:o}:{}},{signal:a});for(let e of s.rows){let t=$m(e);if(e.source.kind!==`session`||r.has(t))continue;let i=n.get(e.source.sessionId);i&&r.set(t,i)}if(a.aborted||i(new Map(r)),!s.cursor)break;o=s.cursor}})().catch(()=>{}),()=>r.abort()},[e.journeyId,t.id,t.inputRevision,n]),r}var rh=5;function ih({label:e,icon:t,terms:n,workId:r,origins:i,sessionLines:a,open:o}){let[s,c]=(0,l.useState)(!1),u=s?n:n.slice(0,rh);return(0,F.jsxs)(`details`,{className:`o-g`,open:o||void 0,children:[(0,F.jsxs)(`summary`,{className:`o-gh`,children:[t,e,(0,F.jsx)(`b`,{children:n.length})]}),(0,F.jsx)(`ul`,{children:u.map(e=>(0,F.jsxs)(`li`,{children:[(0,F.jsx)(th,{term:e,workId:r}),a&&i.get($m(e))&&(0,F.jsx)(`span`,{className:`o-sess`,children:i.get($m(e))})]},$m(e)))}),n.length>u.length&&(0,F.jsxs)(`button`,{type:`button`,className:`o-more`,onClick:()=>c(!0),children:[`Show `,n.length-u.length,` more`]})]})}function ah({view:e,work:t}){let[n,r]=(0,l.useState)(`type`),i=nh(e,t,!0),a=e.privacy.terms.filter(e=>e.disposition===`hidden`&&e.sources.some(e=>e.workId===t.id)),o=t.rootSessionIds.length,s=Wm.map(e=>({key:e.id,label:e.label,icon:(0,F.jsx)(zm,{kind:e.id}),terms:a.filter(t=>Am[t.type].kind===e.id)})).filter(e=>e.terms.length),c=[...Map.groupBy(a,e=>i.get($m(e))??``)].map(([e,t])=>{let n=e.lastIndexOf(` · `);return{key:e,label:n<0?e||`Other sessions`:(0,F.jsxs)(F.Fragment,{children:[e.slice(0,n),(0,F.jsxs)(`span`,{className:`o-gd`,children:[` · `,e.slice(n+3)]})]}),icon:null,terms:t}}),u=n===`type`?s:c.toSorted((e,t)=>+!e.key-!t.key);return(0,F.jsxs)(`section`,{"aria-label":`Hidden in this Work`,children:[(0,F.jsxs)(`div`,{className:`cv-h`,children:[(0,F.jsxs)(`span`,{children:[(0,F.jsxs)(`b`,{children:[a.length,` hidden `,a.length===1?`item`:`items`]}),` `,`in `,o,` `,o===1?`session`:`sessions`]}),(0,F.jsx)(`span`,{className:`o-by`,role:`group`,"aria-label":`Group hidden items by`,children:[`type`,`session`].map(e=>(0,F.jsx)(`button`,{type:`button`,"aria-pressed":n===e,onClick:()=>r(e),children:e===`type`?`Type`:`Session`},e))})]}),(0,F.jsx)(`div`,{className:`o-items`,children:u.map((e,r)=>(0,F.jsx)(ih,{label:e.label,icon:e.icon,terms:e.terms,workId:t.id,origins:i,sessionLines:n===`type`,open:r===0},e.key))},n)]})}var oh=e=>[`sending`,`completed`].includes(e.phase)?[]:e.works.filter(t=>Ia(t)&&Ka(e,t)===`Processing failed`),sh=e=>e.status===`blocked`||e.renderFailure?.revision===e.revision;function ch(e){if(e.status===`blocked`){let t=e.blockedCodes;return t.some(e=>e.endsWith(`UNSUPPORTED`))?`Tacitt can’t process some of its sessions yet.`:t.some(e=>e.endsWith(`LIMIT`))?`It is larger than Tacitt can prepare.`:`Its sessions could not be prepared for review.`}return e.renderFailure?.revision===e.revision?`Its package could not be built.`:`Its AI review stopped before it finished.`}var lh=new Set([`DISCOVERY_BUSY`,`COORDINATION_BUSY`]),uh=3e3;function dh(e,t){return new Promise((n,r)=>{let i=setTimeout(n,e);t.addEventListener(`abort`,()=>{clearTimeout(i),r(t.reason)},{once:!0})})}var fh=class extends Error{};async function ph(e,t,n,r){if(t.status!==`blocked`){n(await N.nativeJourney.render.mutate({journeyId:e.journeyId,workIds:[t.id]},{signal:r}));return}let i=await N.nativeJourney.respond.mutate({journeyId:e.journeyId,expectedRevision:e.revision,idempotencyKey:crypto.randomUUID(),action:{kind:`retry-work`,workId:t.id}},{signal:r});if(n(i.state),i.status===`stale`)throw new fh(`This Work changed. Review it and try again.`);for(let t=1;;t+=1){try{let t=await N.nativeJourney.prepare.mutate({journeyId:e.journeyId},{signal:r});t&&n(t);return}catch(e){let n=e instanceof Error?e.message:``;if(!lh.has(n)||t>=100)throw e}await dh(uh,r)}}function mh({view:e,work:t,onState:n,disconnected:r,fallback:i=null,skippedOnly:a=!1}){let o=oh(e).filter(e=>!a||La(e)),s=t?o.find(e=>e.id===t.id):o[0],[c,u]=(0,l.useState)(!1),[d,f]=(0,l.useState)(``),[p,m]=(0,l.useState)(null),h=e.works.find(e=>e.id===p),g=h!==void 0&&Ia(h)&&(h.status===`pending`||h.completedBatches<h.totalBatches),_=io(e.journeyId,!!s||g),v=(0,l.useRef)(null);(0,l.useEffect)(()=>()=>v.current?.abort(),[]);async function y(t,i){if(r||v.current)return;let a=new AbortController;v.current=a,u(!0),f(``);try{if(t===`retry`)await ph(e,i,n,a.signal),i.status===`blocked`&&m(i.id);else{let t=await N.nativeJourney.respond.mutate({journeyId:e.journeyId,expectedRevision:e.revision,idempotencyKey:crypto.randomUUID(),action:{kind:`work-access`,workId:i.id,access:`drop`}});n(t.state),t.status===`stale`&&f(`This Work changed. Review it and try again.`)}}catch(e){if(a.signal.aborted)return;console.error(t===`retry`?`FAILED_WORK_RETRY_FAILED`:`FAILED_WORK_DROP_FAILED`),f(e instanceof fh?e.message:P(e))}finally{v.current===a&&(v.current=null),u(!1)}}let b=d?(0,F.jsx)(`p`,{role:`alert`,children:d}):g&&_===!1?(0,F.jsxs)(`p`,{role:`status`,children:[`Reading `,Ga(h),` needs the agent. `,ro]}):null;if(!s)return i?i(b):b;let x=t?0:o.length-1,S=sh(s),C=_===!1;return(0,F.jsxs)(`section`,{className:`now`,"aria-label":`Now`,"data-failed-work":s.id,children:[(0,F.jsx)(`p`,{className:`now-k`,children:(0,F.jsx)(`span`,{className:`tc-kicker`,children:`Now`})}),(0,F.jsxs)(`p`,{className:`now-t`,children:[Ga(s),` could not be processed`]}),(0,F.jsxs)(`div`,{className:`now-b`,children:[(0,F.jsxs)(`p`,{className:`say`,children:[ch(s),` `,La(s)?`It is left out of this Send. Retry reads it again.`:S?`Retry it, or Drop it to send the rest.`:C?`Drop it to send the rest, or run /tacitt again in the chat to retry it.`:`Drop it to send the rest, or ask your agent to retry.`]}),S&&C&&s.status===`blocked`&&(0,F.jsxs)(`p`,{className:`say`,children:[`Reading it after Retry needs the agent. `,`Run /tacitt again in the chat to continue.`]}),x>0&&(0,F.jsxs)(`p`,{className:`say`,children:[Bm(x,`more Work`),` `,x===1?`needs`:`need`,` the same.`]})]}),(0,F.jsxs)(`div`,{className:`btns`,children:[S&&(0,F.jsx)(`button`,{type:`button`,className:`tc-btn primary`,disabled:c||r,onClick:()=>void y(`retry`,s),children:`Retry`}),(0,F.jsx)(`button`,{type:`button`,className:`tc-btn`,disabled:c||r,onClick:()=>void y(`drop`,s),children:`Drop`})]}),b]})}var hh={public:`Public`,private:`Private`,drop:`Drop`};function gh(e,t){return e.corrections.some(e=>e.workId===t&&(e.status===`pending`||e.status===`stale`))}function _h(e,t){let n=e.corrections.filter(e=>e.workId===t),r=n.filter(e=>e.status===`pending`||e.status===`stale`),i=n.filter(e=>e.status===`applied`),a=r.length?r:i;if(!a.length)return``;let o=a.reduce((e,t)=>e+t.count,0);return`Correction ${r.length?`pending`:`applied`} (${o})`}function vh({view:e,work:t,onBack:n,onState:r,disconnected:i=!1}){let a=e.scope.status===`confirmed`&&!e.pendingHideId&&t.status!==`blocked`&&(t.status!==`pending`||t.completedBatches>0),o=t.classificationRecommendation?.reason??null;return(0,F.jsx)(`section`,{className:`d-page`,children:(0,F.jsxs)(`div`,{className:`d-body`,children:[(0,F.jsxs)(`header`,{className:`d-head`,children:[(0,F.jsx)(`button`,{type:`button`,className:`d-back`,"aria-label":`Back to Works`,onClick:n}),(0,F.jsx)(`h1`,{tabIndex:-1,children:Ga(t)}),(0,F.jsx)(lo,{view:e,work:t,onState:r,disconnected:i,header:!0})]}),t.description&&(0,F.jsx)(`p`,{className:`d-desc`,children:ja(t.description)}),(0,F.jsx)(`div`,{className:`d-dec`,children:o&&(0,F.jsx)(`p`,{className:`pr-sug`,"data-tip":t.classificationRecommendation?.access??t.access,children:ja(o)})}),(0,F.jsx)(mh,{view:e,work:t,onState:r,disconnected:i}),_h(e,t.id)&&(0,F.jsxs)(`p`,{role:`status`,className:`d-note`,children:[_h(e,t.id),`.`,` `,gh(e,t.id)?`Answer it in the chat.`:`These stay hidden for this review only.`]}),t.placement===`unsorted`&&(0,F.jsx)(`p`,{className:`d-note`,children:`Tell your agent where these belong, or leave them out.`}),a&&(0,F.jsx)(ah,{view:e,work:t}),t.imagesOmitted>0&&(0,F.jsx)(`p`,{className:`d-note`,children:t.imagesOmitted===1?`1 image isn't included`:`${t.imagesOmitted} images aren't included`}),(0,F.jsx)(`p`,{className:`say pr-tip`,children:`To change what is hidden, or fix a title or grouping, tell your agent.`})]})})}var yh=e=>e.status===`ready`&&e.artifact?.revision===e.revision;function bh(e){let t=e.works.filter(Ra),n=t.filter(yh).length;return{completed:n,selected:t.length,percent:Math.floor(n/Math.max(1,t.length)*100)}}var xh=class extends Error{contention;constructor(e,t=!1){super(e),this.contention=t}};async function Sh(e,t,n,r){if(r.throwIfAborted(),!Ua(e))throw new xh(`Review the current privacy results before packaging.`);let i=e;if(!i.privacy.packageApproval){let e=await N.nativeJourney.respond.mutate({journeyId:i.journeyId,expectedRevision:i.revision,idempotencyKey:crypto.randomUUID(),action:{kind:`package-confirm`}},{signal:r});if(r.throwIfAborted(),t(e.state),e.status===`stale`)throw new xh(`The results changed. Review them and confirm packaging again.`);i=e.state}let a=i.works.filter(Ra).filter(e=>!yh(e)),o=0,s=!0;for(let e=0;e<a.length;e+=16){r.throwIfAborted();let c=a.slice(e,e+16);for(let e of c){let t=i.works.find(t=>t.id===e.id);if(!t||!Ra(t))throw new xh(`The selected Works changed.`)}let[l]=c;n(c.length===1||!l?l?.title??``:`${l.title} and ${c.length-1} more`);let u=await N.nativeJourney.render.mutate({journeyId:i.journeyId,workIds:c.map(e=>e.id)},{signal:r}).catch(e=>{throw!o||s||r.aborted||!ne(e)?e:new xh(Ch(o+c.length))});r.throwIfAborted(),i=u,t(i);let d=c.filter(e=>!i.works.some(t=>t.id===e.id&&yh(t)));o+=d.length,s&&=d.every(e=>`renders`in u&&u.renders.some(t=>t.workId===e.id&&t.status===`failed`&&t.code===`COORDINATION_BUSY`))}if(o)throw new xh(Ch(o),s);return i}function Ch(e){return e===1?`1 Work could not be packaged. Retry after reviewing its status.`:`${e} Works could not be packaged. Retry after reviewing their status.`}var wh=1500,Th=`The Send scope changed. Review it and confirm again.`,Eh=[`REVISION_CONFLICT`,`REQUEST_EXPIRED`,`IDENTITY_REJECTED`];function Dh(e,t){return!!(e&&t&&e.id===t.id&&(e.confirmedAt&&t.confirmedAt||e.request&&t.request&&e.request.scopeDigest===t.request.scopeDigest&&e.request.requestedAt===t.request.requestedAt&&!Eh.includes(t.error??``)))}function Oh(e){let t=e?.send;return!!(t?.request&&!t.confirmedAt&&[`awaiting-packaging`,`prepared`].includes(t.status)||t?.confirmedAt&&([`sending`,`waiting`,`sign-in`,`review`].includes(t.status)||t.status===`completed`&&t.items.some(e=>![`completed`,`blocked`].includes(e.status))))}function kh(e,t,n,r,i){let a=new AbortController,o={view:null,error:``,contention:``,busy:!1,pauseBusy:!1,needsReview:!1,preparing:!1,packaging:null,packageError:``,prepackaging:!1},s=!1,c=null,l,u,d=``,f=-1,p=0,m=``,h=!1,g,_=!1,v=0,y=!1,b=!1,x=!1,S=!1,C,w;function T(e){a.signal.aborted||(o={...o,...e},n(o))}function E(n){if(a.signal.aborted||!n||n.journey.journeyId!==e||n.journey.revision<t().revision)return;let i=o.view;i&&(i.journey.revision>n.journey.revision||i.send?.id===n.send?.id&&(i.send?.revision??0)>(n.send?.revision??0))||(u&&n.send?.id===u.input.idempotencyKey&&(u.acknowledged=!0,u=void 0,clearTimeout(g),g=void 0,l?.abort(),T({packageError:``})),T({view:n}),r({...t(),...n.journey}))}async function ee(e,t=!1,n=!1){if(a.signal.aborted||s||_&&!t)return;s=!0,t&&(v+=1,y=!0),T({busy:!0,pauseBusy:!0,error:``,preparing:n});let r=o.view?.send;try{let t=await e();E(t);let n=t.status===`stale`&&Dh(r,t.send);return x=!1,y=t.status===`stale`&&!n,T({needsReview:y,error:y?Th:n?`The Send moved on while this was saved. Check its current state and try again.`:``}),t}catch(e){if(!a.signal.aborted){console.error(`NATIVE_SEND_ACTION_FAILED`),x=!0,y=!0;let t=te(e,[`SEND_SCOPE_INVALIDATED`]);T({...t?{needsReview:!0}:{},error:t?Th:P(e)})}return}finally{s=!1,T({busy:_,pauseBusy:!1,preparing:!1})}}function re(){let n=o.view;if(!n?.send)throw Error(`No prepared Send`);return{journeyId:e,sendId:n.send.id,expectedJourneyRevision:Math.max(n.journey.revision,t().revision),expectedSendRevision:n.send.revision,idempotencyKey:crypto.randomUUID()}}async function ie(t){if(_||s||c||y||a.signal.aborted)return;_=!0;let n=v,r=!1;T({busy:!0});try{let i=await N.send.advance.mutate({journeyId:e,sendId:t},{signal:a.signal});if(n!==v)return;let s=o.view?.send;E(i),r=i.status===`applied`&&(i.send?.revision??-1)>(s?.revision??-1),i.status===`stale`&&!Dh(s,i.send)&&(y=!0,T({needsReview:!0,error:Th}))}catch(e){!a.signal.aborted&&n===v&&(x||=!ne(e),ae(e))}finally{_=!1,T({busy:s})}r&&!y&&Oh(o.view)&&w?.()}function ae(e,t){return ne(e,t)?(T({error:b||x||o.needsReview?o.error:``,contention:D}),!0):(console.error(`NATIVE_SEND_OBSERVE_FAILED`),y=!0,b||=!Da(e).retry,T({error:P(e),contention:``}),!b)}function oe(e){return new Promise(t=>{w=t,C=setTimeout(t,e)})}async function se(){let t=Date.now()-(i?.get(e)??-1/0);for(t<wh&&await oe(wh-t);!a.signal.aborted;){i?.set(e,Date.now());let t=AbortSignal.timeout(1e4);try{E(await N.send.get.query({journeyId:e},{signal:AbortSignal.any([a.signal,t])})),!o.needsReview&&!b&&!x&&!s&&(y=!1,T({error:``,contention:``})),Oh(o.view)&&o.view?.send&&ie(o.view.send.id)}catch(e){if(!a.signal.aborted&&!ae(e,t))return}a.signal.aborted||await oe(wh)}}async function O(){if(!(S||a.signal.aborted)){S=!0;try{await se()}finally{S=!1}}}let k=(n=t())=>ee(()=>N.send.prepare.mutate({journeyId:e,expectedJourneyRevision:n.revision,displayedScopeDigest:n.displayedScopeDigest,idempotencyKey:crypto.randomUUID()},{signal:a.signal}),!1,!0),ce=()=>ee(()=>{let e=o.view?.send;if(!e)throw Error(`No prepared Send`);return N.send.start.mutate({...re(),scopeDigest:e.scopeDigest,displayedScopeDigest:t().displayedScopeDigest,confirmedWorkIds:e.items.map(e=>e.workId),confirmedOmittedWorkIds:e.omitted.map(e=>e.workId)},{signal:a.signal})}),le=null,ue=e=>{(!le||e.revision>=le.revision)&&(le=e),r(e)},de=()=>{let e=t();return le&&le.revision>e.revision?le:e};function A(){let e=de(),t=JSON.stringify([e.privacy.answersRevision,e.confirmedHideRevision,e.works.filter(Ra).map(({id:e,revision:t,access:n})=>[e,t,n])]);t!==m&&(m=t,p=0,h=!1),!(a.signal.aborted||s||c||g!==void 0||h||o.view?.send?.status===`awaiting-packaging`||e.packaging||[`sending`,`completed`].includes(e.phase)||e.revision===f||!Ua(e)||e.works.filter(Ra).every(yh))&&(l=new AbortController,T({prepackaging:!0}),c=Sh(e,ue,e=>{d=e,o.packaging&&T({packaging:{title:e}})},AbortSignal.any([a.signal,l.signal])).then(()=>void 0,e=>{if(a.signal.aborted||l?.signal.aborted)return;let t=e instanceof xh?e.contention:ne(e);t&&p<2?(p+=1,g=setTimeout(()=>{g=void 0,A()},wh)):(f=de().revision,h=t)}).finally(()=>{c=null,d=``,T({prepackaging:!1})}))}async function j(n){if(a.signal.aborted||s||_)return;s=!0,T({busy:!0,pauseBusy:!0,error:``,packageError:``,needsReview:!1,packaging:{title:d}});let r=t().displayedScopeDigest,i=JSON.stringify([n,r]);(!u||u.scope!==i)&&(u={scope:i,acknowledged:!1,input:{journeyId:e,expectedJourneyRevision:de().revision,displayedScopeDigest:r,idempotencyKey:crypto.randomUUID(),included:[...n.included],omittedWorkIds:[...n.omittedWorkIds]}});let o=u;try{let e=await N.send.request.mutate(o.input,{signal:a.signal});if(E(e),ue({...de(),...e.journey}),u=void 0,e.status===`stale`){T({needsReview:!0,error:Th});return}clearTimeout(g),g=void 0,l?.abort(),await c,y=!1,x=!1}catch{a.signal.aborted||(console.error(`NATIVE_SEND_REQUEST_FAILED`),o.acknowledged?await c:T({packageError:`The Send request could not be confirmed. Check its status and retry.`}))}finally{s=!1,T({busy:_,pauseBusy:!1,packaging:null}),w?.()}}async function fe(){if(a.signal.aborted||s||_)return;s=!0,T({busy:!0,pauseBusy:!0,error:``,packageError:``,needsReview:!1,packaging:{title:d}});let e;try{await c,e=await Sh(de(),ue,e=>T({packaging:{title:e}}),a.signal)}catch(e){a.signal.aborted||(console.error(`NATIVE_PACKAGE_FAILED`),T({packageError:e instanceof xh?e.message:P(e)}));return}finally{s=!1,T({busy:_,pauseBusy:!1,packaging:null})}await k(e)}return{observe:O,nudge(){w?.()},stop(){a.abort(),clearTimeout(C),clearTimeout(g),g=void 0,w?.()},retry(){o.needsReview||(y=!1,b=!1,x=!1,T({error:``,contention:``}),S||O())},prepare:()=>k(),review:fe,prepackage:A,start:ce,send:j,pause:()=>ee(()=>N.send.pause.mutate(re(),{signal:a.signal}),!0),resume:()=>ee(()=>N.send.resume.mutate(re(),{signal:a.signal})),retryWorks:()=>ee(()=>N.send.resume.mutate(re(),{signal:a.signal}),!0),withdraw:()=>ee(()=>N.send.withdraw.mutate(re(),{signal:a.signal}),!0)}}var Ah=e=>{},jh=new Map;function Mh(e,t=Ah){let n=(0,l.useRef)({journey:e,onState:t});(0,l.useEffect)(()=>{n.current={journey:e,onState:t}},[e,t]);let[r,i]=(0,l.useState)({view:null,error:``,contention:``,busy:!0,pauseBusy:!0,needsReview:!1,preparing:!1,packaging:null,packageError:``,prepackaging:!1}),a=(0,l.useRef)(null);(0,l.useEffect)(()=>{let t=kh(e.journeyId,()=>n.current.journey,i,e=>n.current.onState(e),jh);return a.current=t,t.observe(),()=>{t.stop(),a.current=null}},[e.journeyId]),(0,l.useEffect)(()=>{r.view&&a.current?.prepackage()},[e.revision,r.prepackaging,r.view]);let o=(0,l.useCallback)(()=>a.current?.nudge(),[]);return{...r,view:r.view?.journey.journeyId===e.journeyId?r.view:null,prepare:()=>a.current?.prepare(),review:()=>a.current?.review(),start:()=>a.current?.start(),send:e=>a.current?.send(e),pause:()=>a.current?.pause(),withdraw:()=>a.current?.withdraw(),resume:()=>a.current?.resume(),retryWorks:()=>a.current?.retryWorks(),retry:()=>a.current?.retry(),nudge:o}}var Nh={ready:`Ready`,target:`Needs your answer`,settings:`Needs your answer`,uploading:`Uploading`,assessing:`Awaiting assessment`,completed:`Sent and assessed`,blocked:`Needs attention`},Ph=e=>e.resolution?.candidates.filter(e=>e.access!==`removed`)??[];function Fh({items:e,busy:t=!1,respond:n}){return(0,F.jsx)(F.Fragment,{children:e.map(e=>(0,F.jsxs)(`section`,{className:`journey-send-work`,children:[(0,F.jsxs)(`h3`,{className:`journey-send-work-title`,children:[ja(e.title),` · `,hh[e.access]]}),(0,F.jsx)(`p`,{className:`say`,role:`status`,children:Nh[e.status]}),e.error&&(0,F.jsxs)(`p`,{className:`say`,role:`alert`,children:[C(e.error).label,`. `,C(e.error).detail]}),e.status===`target`&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{className:`say`,children:e.resolution?.status===`matched`?`Update the matching Work in your Tacitt profile?`:`Your Tacitt profile has Works that may be this one. Create a new Work, or update one of them?`}),n?(0,F.jsxs)(`div`,{className:`btns`,children:[e.resolution?.status!==`matched`&&(0,F.jsx)(`button`,{className:`tc-btn primary`,type:`button`,disabled:t,onClick:()=>n(e.workId,{kind:`target`,target:{kind:`new`}}),children:`Create new Work`}),Ph(e).map(r=>(0,F.jsxs)(`button`,{className:`tc-btn`,type:`button`,disabled:t,onClick:()=>n(e.workId,{kind:`target`,target:{kind:`existing`,bindingId:r.bindingId}}),children:[`Update `,ja(r.title),` (`,r.access,`)`]},r.bindingId))]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`ul`,{children:[e.resolution?.status!==`matched`&&(0,F.jsx)(`li`,{children:`Create new Work`}),Ph(e).map(e=>(0,F.jsxs)(`li`,{children:[`Update `,ja(e.title),` (`,e.access,`)`]},e.bindingId))]}),(0,F.jsx)(`p`,{className:`journey-chat-hint`,children:`Answer in the chat.`})]})]}),e.status===`settings`&&e.settings&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`say`,children:[`These linked Works will become `,e.settings.access,`.`]}),(0,F.jsx)(`ul`,{children:e.settings.works.map(t=>(0,F.jsxs)(`li`,{children:[ja(t.title),` · `,t.access,` → `,e.settings?.access]},t.workId))}),n?(0,F.jsx)(`div`,{className:`btns`,children:(0,F.jsx)(`button`,{className:`tc-btn primary`,type:`button`,disabled:t,onClick:()=>{let t=e.settings;t&&n(e.workId,{kind:`settings`,membersDigest:t.membersDigest,accessVersion:t.accessVersion,scopeVersion:t.scopeVersion})},children:`Confirm Settings changes`})}):(0,F.jsx)(`p`,{className:`journey-chat-hint`,children:`Confirm these Settings changes in the chat.`})]})]},e.workId))})}var Ih={format:`Original-content format cannot be uploaded`,"too-large":`Larger than 500 MiB`,sent:`Already uploaded; unchanged`,unavailable:`File missing or changed`},Lh={"sign-in":`Waiting for sign-in`,sending:`Uploading`,waiting:`Waiting for assessment results`,review:`Needs your choice`,paused:`Paused`,completed:`Upload complete`,blocked:`Upload stopped`},Rh=e=>e===`private`?`Private`:`Public`;function zh(){let[e,t]=(0,l.useState)(null),[n,r]=(0,l.useState)(``),[i,a]=(0,l.useState)(!1),o=(0,l.useRef)(!1),s=(0,l.useRef)(null);function c(e){!e||s.current?.id===e.id&&s.current.revision>e.revision||(s.current=e,t(e))}(0,l.useEffect)(()=>{let e=new AbortController;async function t(){for(;!e.signal.aborted;){try{if(!o.current){let t=await N.manualUpload.get.query({},{signal:e.signal});if(e.signal.aborted||c(t),t&&[`sending`,`waiting`,`sign-in`,`review`].includes(t.status)){let n=await N.manualUpload.advance.mutate({uploadId:t.id},{signal:e.signal});e.signal.aborted||c(n.upload)}}}catch(t){e.signal.aborted||r(P(t))}await new Promise(e=>window.setTimeout(e,1500))}}return t(),()=>e.abort()},[]);async function u(e){if(!o.current){o.current=!0,a(!0);try{let t=await e();c(t.upload),r(t.status===`stale`?`The upload changed. Review the current list and confirm again.`:``)}catch(e){r(P(e))}finally{o.current=!1,a(!1)}}}function d(){let e=s.current;if(!e)throw Error(`No prepared upload`);return{uploadId:e.id,expectedRevision:e.revision,idempotencyKey:crypto.randomUUID()}}return{upload:e,error:n,busy:i,perform:u,address:d}}function Bh({resultId:e,rows:t,selectedSlots:n,account:r}){let i=zh(),a=(0,l.useRef)(null),o=i.upload?.resultId===e?i.upload:null,s=o!==null&&[`sending`,`waiting`,`sign-in`,`review`].includes(o.status);(0,l.useEffect)(()=>{o?.status===`sign-in`&&r.view?.state===`signed-out`&&a.current!==o.id&&(a.current=o.id,r.signIn())},[o?.id,o?.status,r]);let c=o!==null&&(o.status===`prepared`||o.status===`blocked`&&!o.confirmedAt),u=new Set(o?Object.values(o.slots):[]),d=new Set(o?.omitted.map(e=>e.slot)??[]),f=c?t.filter(e=>!u.has(e.slot)&&!d.has(e.slot)):[];return(0,F.jsxs)(`section`,{className:`passport-upload`,"aria-labelledby":`passport-upload-title`,children:[(0,F.jsx)(`h3`,{id:`passport-upload-title`,children:`Upload to Tacitt profile`}),(0,F.jsx)(`p`,{children:`Selected ZIPs are uploaded to the signed-in account's profile after you confirm the list. Private Works count toward scores while their details stay hidden.`}),i.error&&(0,F.jsx)(`p`,{className:`error`,role:`alert`,children:i.error}),o?.error&&(0,F.jsx)(`p`,{className:`error`,role:`alert`,children:o.error===`ACCOUNT_CHANGED`?`The signed-in account changed. Review the list and confirm it for this account.`:o.error===`EMPTY_SEND_SCOPE`?`None of the selected ZIPs can be uploaded.`:o.error}),(0,F.jsx)(`div`,{className:`actions`,children:(0,F.jsxs)(`button`,{type:`button`,disabled:i.busy||s||n.length===0,onClick:()=>void i.perform(()=>N.manualUpload.prepare.mutate({resultId:e,slots:[...n],idempotencyKey:crypto.randomUUID()})),children:[`Upload selected to profile (`,n.length,`)`]})}),o&&c&&(0,F.jsxs)(`div`,{role:`group`,"aria-label":`Confirm upload`,children:[o.items.length>0&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`h4`,{children:`Will upload`}),(0,F.jsx)(`ul`,{children:o.items.map(e=>(0,F.jsxs)(`li`,{children:[e.title,` · `,Rh(e.access),` · `,mr(e.artifact.byteLength)]},e.workId))})]}),(0,F.jsx)(Vh,{items:[...o.omitted.map(e=>({key:e.bundleId,title:e.title,reason:Ih[e.reason]??e.reason})),...f.map(e=>({key:e.bundleId,title:e.title,reason:`Not selected`}))]}),o.items.length>0&&(0,F.jsxs)(`button`,{type:`button`,className:`primary`,disabled:i.busy,onClick:()=>void i.perform(()=>N.manualUpload.start.mutate({...i.address(),scopeDigest:o.scopeDigest,confirmedWorkIds:o.items.map(e=>e.workId),confirmedOmittedBundleIds:o.omitted.map(e=>e.bundleId)})),children:[`Confirm upload (`,o.items.length,`)`]})]}),o&&!c&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{role:`status`,children:Lh[o.status]??o.status}),o.status===`sign-in`&&(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h4`,{children:`Sign in to continue this upload`}),r.view?.state===`authorizing`?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{children:[`Confirm code `,(0,F.jsx)(`strong`,{children:r.view.userCode}),` on the official sign-in page. The confirmed upload continues automatically after sign-in.`]}),(0,F.jsx)(ba,{url:r.view.verificationUriComplete,label:`Open the sign-in page`})]}):(0,F.jsx)(`button`,{type:`button`,disabled:r.busy,onClick:()=>void r.signIn(),children:`Sign in`}),r.error&&(0,F.jsx)(`p`,{role:`alert`,children:r.error})]}),(0,F.jsx)(Fh,{items:o.items,busy:i.busy,respond:(e,t)=>void i.perform(()=>N.manualUpload.respond.mutate({...i.address(),workId:e,choice:t}))}),o.items.map(e=>e.status===`completed`&&e.receipt?.passportIncluded?(0,F.jsxs)(`p`,{children:[e.title,` ·`,` `,(0,F.jsx)(`a`,{href:e.receipt.passportUrl,target:`_blank`,rel:`noopener noreferrer`,children:`View profile`})]},e.workId):null),(0,F.jsx)(Vh,{items:o.omitted.map(e=>({key:e.bundleId,title:e.title,reason:Ih[e.reason]??e.reason}))}),o.status!==`completed`&&(o.status===`paused`||o.status===`blocked`?(0,F.jsx)(`button`,{type:`button`,disabled:i.busy,onClick:()=>void i.perform(()=>N.manualUpload.resume.mutate(i.address())),children:`Resume`}):(0,F.jsx)(`button`,{type:`button`,disabled:i.busy,onClick:()=>void i.perform(()=>N.manualUpload.pause.mutate(i.address())),children:`Pause remaining uploads`}))]})]})}function Vh({items:e}){return e.length?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`h4`,{children:`Not uploaded this time`}),(0,F.jsx)(`ul`,{children:e.map(e=>(0,F.jsxs)(`li`,{children:[e.title,` · `,e.reason]},e.key))})]}):null}function Hh(e){let t=document.createElement(`a`),n=new URL(`download`,location.href);n.searchParams.set(`ticket`,e),t.href=n.href,t.rel=`noreferrer`,t.hidden=!0,document.body.append(t),t.click(),t.remove()}function Uh(e){let t=e instanceof Error?e.message:``;return t===`ARTIFACT_MISSING`?`A selected file is missing or its size changed. Refresh the results and choose an available bundle.`:t===`ARTIFACT_INVALID_ARCHIVE`||t===`ARTIFACT_IDENTITY_MISMATCH`?`A selected file no longer matches its saved checksum. Repackage that workspace before downloading.`:t===`COORDINATION_BUSY`?`Another download is being prepared. Try again shortly.`:P(e)}function Wh(e){return e.kind===`complete`?`Latest completed collection`:e.status===`packaging`?`Current collection · packaging`:`Current incomplete collection`}function Gh({current:e,account:t,onSave:n,saveDisabled:r}){let[i,a]=(0,l.useState)([]),[o,s]=(0,l.useState)(``),[c,u]=(0,l.useState)(()=>({resultId:``,bundleIds:new Set})),[d,f]=(0,l.useState)(0),[p,m]=(0,l.useState)(!0),[h,g]=(0,l.useState)(!1),[_,v]=(0,l.useState)(``),y=e?.packagingProgress?.workspaces?.completed??0;(0,l.useEffect)(()=>{let t=!0;async function n(){try{let e=await N.delivery.list.query();if(!t)return;a(e),s(t=>e.some(e=>e.id===t)?t:e[0]?.id??``),v(``)}catch(e){t&&v(Uh(e))}finally{t&&m(!1)}}n();let r=e?.phase===`packaging`?window.setInterval(()=>void n(),2e3):null;return()=>{t=!1,r!==null&&window.clearInterval(r)}},[e?.runId,e?.phase,e?.artifact?.bundleId,y]);let b=i.find(e=>e.id===o)??i[0],x=b?.rows??[],S=c.resultId===b?.id?c.bundleIds:new Set(x.filter(e=>e.available).map(e=>e.bundleId)),C=Math.max(1,Math.ceil(x.length/50)),w=Math.min(d,C-1),T=x.slice(w*50,(w+1)*50),E=x.filter(e=>e.available&&S.has(e.bundleId)).map(e=>e.slot);async function ee(e,t=`primary`){if(b&&!h){g(!0),v(``);try{let n=e.map(e=>x[e]?.workspaceId),r=n.every(e=>typeof e==`string`)?n:void 0;if(t!==`index`&&b.kind===`incomplete`&&!r)throw Error(`REVISION_CONFLICT`);Hh((await N.delivery.issue.mutate({resultId:b.id,slots:[...e],...t===`index`||!r?{}:{expectedWorkspaceIds:r},artifact:t})).ticket)}catch(e){v(Uh(e));let t=await N.delivery.list.query().catch(()=>null);t&&a(t)}finally{g(!1)}}}function D(e){s(e),u({resultId:``,bundleIds:new Set}),f(0),v(``)}function te(e){u(t=>{let n=new Set(t.resultId===b?.id?t.bundleIds:S);return n.has(e)?n.delete(e):n.add(e),{resultId:b?.id??``,bundleIds:n}})}return(0,F.jsxs)(`section`,{className:`bundle-results`,"aria-labelledby":`bundle-results-title`,children:[(0,F.jsx)(`h2`,{id:`bundle-results-title`,children:`Bundle results`}),(0,F.jsx)(`p`,{children:`Download workspace ZIPs for manual submission. The bundle library keeps the originals for reuse.`}),p&&(0,F.jsx)(`p`,{role:`status`,children:`Loading bundle results…`}),_&&(0,F.jsx)(`p`,{className:`error`,role:`alert`,children:_}),!p&&i.length===0&&(0,F.jsx)(`p`,{children:`No packaged workspace bundles yet.`}),i.length>1&&(0,F.jsx)(`div`,{className:`actions`,role:`group`,"aria-label":`Collection results`,children:i.map(e=>(0,F.jsx)(`button`,{type:`button`,"aria-pressed":b?.id===e.id,onClick:()=>D(e.id),children:Wh(e)},e.id))}),b&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:b.kind===`complete`?`completion`:`notice`,role:`status`,children:[(0,F.jsx)(`h3`,{children:b.kind===`complete`?`Package complete`:Wh(b)}),(0,F.jsxs)(`p`,{children:[b.rows.length,` finished workspace ZIPs ·`,` `,b.kind===`complete`?`completed`:`started`,` `,(0,F.jsx)(Br,{value:b.createdAt})]}),b.kind===`complete`&&b.indexPath&&(0,F.jsx)(`p`,{className:`path output-path`,children:b.indexPath}),b.kind===`incomplete`&&(0,F.jsx)(`p`,{children:`This collection is incomplete. Finished ZIPs can be downloaded now; the next Package checks them before reuse. A multiple-bundle download is labeled incomplete.`}),b.status===`index-unavailable`&&(0,F.jsx)(`p`,{children:`The collection index is unavailable. Saved workspace ZIPs can still be downloaded.`})]}),b.outcomes.length>0&&(0,F.jsxs)(`div`,{className:`notice`,role:`group`,"aria-label":`Workspace packaging outcomes`,children:[(0,F.jsx)(`h3`,{children:`Workspace status`}),(0,F.jsx)(`ul`,{children:b.outcomes.map(e=>(0,F.jsxs)(`li`,{children:[(0,F.jsx)(`strong`,{children:e.title}),`: `,e.status,e.status===`failed`&&(0,F.jsxs)(F.Fragment,{children:[` · `,e.code,` at `,e.stage,e.sessionId&&` · session ${e.sessionId}`,e.sourcePartId&&` · source ${e.sourcePartId}`]})]},e.workspaceId))})]}),b.rows.length===0?(0,F.jsx)(`p`,{children:`No workspace ZIP has finished in this collection.`}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`actions`,children:[(0,F.jsx)(`button`,{type:`button`,disabled:h||!x.some(e=>e.available),onClick:()=>u({resultId:b.id,bundleIds:new Set(x.filter(e=>e.available).map(e=>e.bundleId))}),children:`Select all available`}),(0,F.jsx)(`button`,{type:`button`,disabled:h||S.size===0,onClick:()=>u({resultId:b.id,bundleIds:new Set}),children:`Clear selection`}),(0,F.jsxs)(`button`,{type:`button`,className:`primary`,disabled:h||E.length===0,onClick:()=>void ee(E),children:[`Download selected (`,E.length,`)`]})]}),(0,F.jsx)(`div`,{className:`table-scroll`,children:(0,F.jsxs)(`table`,{className:`bundle-results-table`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`th`,{scope:`col`,children:`Select`}),(0,F.jsx)(`th`,{scope:`col`,children:`Workspace file`}),(0,F.jsx)(`th`,{scope:`col`,children:`Sessions`}),(0,F.jsx)(`th`,{scope:`col`,children:`Size`}),(0,F.jsx)(`th`,{scope:`col`,children:`Download`})]})}),(0,F.jsx)(`tbody`,{children:T.map(e=>(0,F.jsxs)(`tr`,{children:[(0,F.jsx)(`td`,{children:(0,F.jsx)(`input`,{type:`checkbox`,"aria-label":`Select ${e.title}`,checked:S.has(e.bundleId),disabled:h||!e.available,onChange:()=>te(e.bundleId)})}),(0,F.jsxs)(`th`,{scope:`row`,children:[(0,F.jsx)(`span`,{children:e.title}),(0,F.jsx)(`br`,{}),(0,F.jsx)(`small`,{className:`path`,children:e.filename}),!e.available&&(0,F.jsx)(`small`,{children:` · File missing or size changed`})]}),(0,F.jsx)(`td`,{children:e.sessions}),(0,F.jsx)(`td`,{children:mr(e.archiveBytes)}),(0,F.jsxs)(`td`,{children:[(0,F.jsx)(`button`,{type:`button`,disabled:h||!e.available,onClick:()=>void ee([e.slot]),children:`Download ZIP`}),e.companion&&(0,F.jsx)(`button`,{type:`button`,disabled:h||!e.companion.available,onClick:()=>void ee([e.slot],`companion`),children:`Download facts`}),e.companion&&!e.companion.available&&(0,F.jsx)(`small`,{children:` Facts unavailable`})]})]},e.bundleId))})]})}),C>1&&(0,F.jsxs)(`nav`,{className:`actions`,"aria-label":`Bundle result pages`,children:[(0,F.jsx)(`button`,{type:`button`,disabled:w===0,onClick:()=>f(w-1),children:`Previous`}),(0,F.jsxs)(`span`,{children:[`Page `,w+1,` of `,C]}),(0,F.jsx)(`button`,{type:`button`,disabled:w+1>=C,onClick:()=>f(w+1),children:`Next`})]})]}),b.kind===`complete`&&b.status===`complete`&&x.length>0&&(0,F.jsx)(Bh,{resultId:b.id,rows:x,selectedSlots:E,account:t}),b.indexAvailable&&(0,F.jsxs)(`p`,{children:[(0,F.jsx)(`button`,{type:`button`,disabled:h,onClick:()=>void ee([],`index`),children:`Download collection index (optional)`}),(0,F.jsx)(`small`,{children:` The index is not included with workspace ZIP downloads.`})]}),(0,F.jsx)(`div`,{className:`actions`,children:(0,F.jsx)(`button`,{type:`button`,disabled:r,onClick:n,children:`Save and exit`})})]})]})}var Kh=`Tacitt`;function qh(e,t=Date.now()){let n=Math.ceil((Date.parse(e)-t)/6e4);return!Number.isFinite(n)||n<=0?`The code has expired.`:`The code expires in ${n} min.`}function Jh(e){return!!(!e.view&&e.busy||e.view?.state===`authorizing`||e.view?.state===`starting-sign-in`||e.error||e.view?.lastError)}function Yh({account:e,held:t,embedded:n=!1,onCancel:r}){let i=e.view,a=n?null:(0,F.jsxs)(`h2`,{id:`sign-in-title`,children:[`Sign in to `,Kh]}),o=n?{"aria-label":`Sign in to ${Kh}`}:{"aria-labelledby":`sign-in-title`},s=(0,F.jsx)(`div`,{className:`actions`,children:(0,F.jsx)(`button`,{type:`button`,disabled:e.busy,onClick:()=>void e.cancel().then(r),children:`Cancel sign-in`})});if(i?.state===`starting-sign-in`)return(0,F.jsxs)(`section`,{...o,className:`account-panel`,children:[a,(0,F.jsx)(`p`,{role:`status`,children:`Requesting a sign-in code…`}),e.error&&(0,F.jsx)(`p`,{className:`error`,children:e.error}),s]});if(i?.state===`authorizing`)return(0,F.jsxs)(`section`,{...o,className:`account-panel`,children:[a,(0,F.jsxs)(`p`,{role:`status`,children:[e.approvalOpened?`Approve this code in the sign-in tab that opened.`:`Open the sign-in page and approve this code.`,` `,t?`Your Send starts as soon as you approve.`:`This page continues by itself; nothing is uploaded until you choose Send.`]}),(0,F.jsx)(`p`,{className:`account-code`,"aria-label":`Sign-in code`,children:i.userCode.length===8?`${i.userCode.slice(0,4)}-${i.userCode.slice(4)}`:i.userCode}),(0,F.jsx)(`p`,{children:(0,F.jsx)(ba,{url:i.verificationUriComplete,label:`Open sign-in page`})}),(0,F.jsx)(`p`,{className:`metadata`,children:qh(i.expiresAt)}),e.error&&(0,F.jsx)(`p`,{className:`error`,children:e.error}),s]});if(i?.state===`signed-out`&&i.lastError&&!e.error){let t=i.lastError===`SIGN_IN_EXPIRED`;return(0,F.jsxs)(`section`,{...o,className:`account-panel journey-sign-in-message`,children:[(0,F.jsx)(`p`,{role:t?`status`:`alert`,className:`welcome-message`,children:Xh(i.lastError)}),(0,F.jsx)(`button`,{type:`button`,disabled:e.busy,onClick:()=>void e.signIn(),children:`Sign in again`})]})}return(0,F.jsx)(wa,{account:e})}function Xh(e){return e===`SIGN_IN_EXPIRED`?`Your sign-in expired. Sign in again whenever you’re ready.`:`We couldn’t sign you in. Try again.`}var Zh=`Sign-in cancelled. Sign in whenever you’re ready.`,Qh=new Intl.Segmenter(void 0,{granularity:`grapheme`});function $h({account:e,offeredInPage:t}){let n=(0,l.useRef)(null),[r,i]=(0,l.useState)(null);(0,l.useEffect)(()=>{function e(e){(e instanceof KeyboardEvent&&e.key===`Escape`||e instanceof PointerEvent&&e.target instanceof Node&&!n.current?.contains(e.target))&&n.current&&(n.current.open=!1)}return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,e)}},[]);let a=e.view;if(a?.state===`signed-out`&&t&&a.configuration.clientId!==null)return null;if(a?.state!==`signed-in`)return(0,F.jsx)(Sa,{account:e});let o=a.displayName.trim().split(/\s+/u).slice(0,2).map(e=>Qh.segment(e).containing(0)?.segment??``).join(``).toUpperCase()||`U`;return(0,F.jsxs)(`details`,{ref:n,className:`journey-account-menu`,children:[(0,F.jsx)(`summary`,{"aria-label":`Account menu`,title:`Signed in as ${a.displayName}`,children:a.avatarUrl&&a.avatarUrl!==r?(0,F.jsx)(`img`,{src:a.avatarUrl,alt:``,referrerPolicy:`no-referrer`,onError:()=>i(a.avatarUrl)}):(0,F.jsx)(`span`,{"aria-hidden":`true`,children:o})}),(0,F.jsxs)(`div`,{className:`journey-account-popover`,children:[(0,F.jsx)(`p`,{className:`journey-muted`,children:`Signed in as`}),(0,F.jsx)(`p`,{className:`journey-account-name`,children:a.displayName}),(0,F.jsx)(`a`,{href:a.profileUrl,target:`_blank`,rel:`noopener noreferrer`,children:`Manage account`}),(0,F.jsx)(`button`,{type:`button`,disabled:e.busy,onClick:()=>void e.signOut(),children:`Sign out`})]})]})}function eg({account:e,inSend:t}){return!t&&Jh(e)?(0,F.jsx)(`div`,{className:`journey-auth`,children:(0,F.jsx)(Yh,{account:e,held:!1})}):null}var tg=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,ng=.35,rg=e=>e.totalBatches>0?Math.floor(e.completedBatches/e.totalBatches*100):0;function ig(e,t){if(t.access===`drop`&&t.placement===`unsorted`)return{pill:{label:`Left out`,tone:`left`},skeleton:!1};if(t.access===`drop`||!t.rootSessionIds.length)return{pill:null,skeleton:!1};let n=Ka(e,t);return n===`Processing failed`||n===`Tell your agent where these belong`?{pill:{label:n,tone:`attention`},skeleton:!1}:t.totalBatches>0&&t.completedBatches<t.totalBatches?{pill:{label:`Reading ${rg(t)}%`,tone:`reading`},skeleton:t.completedBatches/t.totalBatches<ng}:e.scope.status===`pending`||[`Waiting to start`,`Waiting for static scan`,`Static scanning`].includes(n)?{pill:{label:`Waiting`,tone:`waiting`},skeleton:!0}:n===`Answer the questions above`?{pill:{label:`Waiting on your answers`,tone:`attention`},skeleton:!1}:{pill:null,skeleton:!1}}var ag=[{value:`queue`,label:`Queue`},{value:`sessions`,label:`Most sessions`},{value:`hidden`,label:`Most hidden`},{value:`name`,label:`Name (A–Z)`}];function og(e,t,n){let r=t=>qm(e,t.id).reduce((e,t)=>e+t.count,0),i={queue:null,sessions:(e,t)=>t.rootSessionIds.length-e.rootSessionIds.length,hidden:(e,t)=>r(t)-r(e),name:(e,t)=>Ga(e).localeCompare(Ga(t))}[n];return i?[...t].sort(i):[...t]}function sg({view:e,work:t,onOpen:n,onState:r,disconnected:i}){let{pill:a,skeleton:o}=ig(e,t),s=Um(`${t.localTitle}\u0000${t.description}\u0000${t.rootSessionIds.length}`);return(0,F.jsx)(`li`,{"data-reading":a?.tone===`reading`||void 0,"data-flash":s?s%2?`a`:`b`:void 0,children:(0,F.jsxs)(`div`,{className:`pr-head`,onClick:e=>{e.target instanceof Element&&!e.target.closest(`button, [role="listbox"]`)&&n(t.id)},children:[(0,F.jsx)(`span`,{className:`pr-tw`,children:(0,F.jsx)(`button`,{type:`button`,className:`pr-t${o?` raw`:``}`,"aria-label":`Review ${Ga(t)}`,"data-work-id":t.id,onClick:()=>n(t.id),children:o?ja(t.projectName):Ga(t)})}),(0,F.jsxs)(`span`,{className:`pr-r`,children:[a&&(0,F.jsx)(`span`,{className:`pr-c`,"data-s":a.tone,children:a.label}),(0,F.jsx)(lo,{view:e,work:t,onState:r,disconnected:i})]}),o?(0,F.jsx)(`span`,{className:`pr-d sk`,"aria-hidden":`true`}):t.description&&(0,F.jsx)(`span`,{className:`pr-d`,children:ja(t.description)}),(0,F.jsxs)(`span`,{className:`pr-m`,children:[o?(0,F.jsx)(`span`,{className:`pr-f sk`,"aria-hidden":`true`}):(0,F.jsx)(Qm,{view:e,workId:t.id}),(0,F.jsx)(`span`,{className:`c-n`,children:tg(t.rootSessionIds.length,`session`)})]})]})})}function cg({count:e,sort:t,onSort:n}){return(0,F.jsxs)(`p`,{className:`statline`,children:[(0,F.jsxs)(`span`,{className:`review-heading`,role:`heading`,"aria-level":2,children:[`Works `,(0,F.jsx)(`span`,{className:`review-heading-count`,children:e})]}),t&&n&&(0,F.jsxs)(`span`,{className:`wh-sort`,children:[(0,F.jsx)(`span`,{className:`wh-sort-k`,children:`Sort`}),(0,F.jsx)(Za,{label:`Sort Works`,value:t,options:ag,onChange:n})]})]})}function lg({view:e,onOpen:t,onState:n,disconnected:r}){let[i,a]=(0,l.useState)(`queue`);if(!Wa(e))return e.snapshotId?(0,F.jsxs)(`section`,{className:`projects`,"aria-label":`Works`,children:[(0,F.jsx)(cg,{count:0,sort:null}),(0,F.jsx)(`p`,{className:`journey-muted pr-note`,children:`Your Works appear here once classification groups these sessions.`})]}):null;let o=e.works.find(e=>e.placement===`classifying`),s=e.works.filter(e=>e.rootSessionIds.length>0&&e.placement!==`classifying`),c=e.works.filter(e=>!e.rootSessionIds.length),u=e.scope.status===`confirmed`?s.filter(Ia):s;return(0,F.jsxs)(`section`,{className:`projects`,"aria-label":`Works`,children:[(0,F.jsx)(cg,{count:u.length,sort:i,onSort:a}),(0,F.jsxs)(`ul`,{className:`plist`,"aria-label":`Works`,children:[og(e,s,i).map(i=>(0,F.jsx)(sg,{view:e,work:i,onOpen:t,onState:n,disconnected:r},i.id)),o&&(0,F.jsx)(`li`,{className:`pr-grouping`,"data-reading":!0,"aria-label":`Sessions still being grouped`,children:(0,F.jsxs)(`div`,{className:`pr-head`,children:[(0,F.jsx)(`span`,{className:`pr-tw`,children:(0,F.jsxs)(`span`,{className:`pr-t`,children:[tg(o.rootSessionIds.length,`session`),` still being grouped`]})}),(0,F.jsx)(`span`,{className:`pr-r`,children:(0,F.jsx)(`span`,{className:`pr-c`,"data-s":`sorting`,children:`Sorting`})}),(0,F.jsx)(`span`,{className:`pr-m`,children:(0,F.jsx)(`span`,{className:`c-n`,children:tg(o.rootSessionIds.length,`session`)})})]})})]}),c.length>0&&(0,F.jsxs)(`details`,{className:`journey-fold journey-left-out`,children:[(0,F.jsxs)(`summary`,{children:[`No sessions left · `,c.length]}),(0,F.jsx)(`ul`,{children:c.map(e=>(0,F.jsx)(`li`,{children:(0,F.jsx)(`button`,{type:`button`,"data-work-id":e.id,onClick:()=>t(e.id),children:Ga(e)})},e.id))})]})]})}var ug=[`SESSION_MEMBERSHIP_CONFLICT`,`SESSION_UPLOAD_EXHAUSTED`,`LEGACY_SEND_RECOVERY_REQUIRED`,`ASSESSMENT_INCOMPLETE`,`SESSION_PUBLICATION_FENCE_REQUIRED`],dg=e=>!!(e.sessionAssembly||e.receipt&&[`accepted`,`running`,`succeeded`,`partial`,`failed`].includes(e.receipt.state));function fg(e){return e.status===`completed`&&e.items.length>0&&e.items.every(e=>e.status===`completed`&&e.sessionAssembly?.scanId)}function pg(e){let t=e.items.length,n=e.items.filter(e=>e.access===`public`).length;return{total:t,uploaded:e.items.filter(dg).length,assessed:e.items.filter(e=>e.status===`completed`).length,replaced:!!e.replaced,publicWorks:n,privateWorks:t-n}}function mg(e){let t=pg(e),n=t.total*2+1,r=Math.min(t.uploaded+t.assessed,t.total*2)+Number(fg(e)||t.replaced);return{value:r,max:n,percent:Math.floor(r/n*100)}}function hg(e){if(e.status!==`completed`||!e.items.length||e.items.some(e=>e.sessionAssembly)||!e.items.every(dg))return null;let t=new Set(e.items.map(e=>e.receipt?.passportUrl)),n=t.size===1?[...t][0]:null;return typeof n==`string`&&n.length>0?n:null}function gg(e){return e.items.some(e=>e.status!==`completed`||!e.receipt?.passportIncluded)?null:hg(e)}function _g(e){let{publicWorks:t,privateWorks:n}=pg(e);return[`Reading tools and commands across your sessions`,`Grouping your work into skills`,`Measuring how you debug and ship`,...t?[`Writing summaries for ${Bm(t,`Public Work`)}`]:[],...n?[`Adding ${Bm(n,`Private Work`)} to your owner view`]:[]]}function vg(e,t=0,{sessions:n=0,packing:r=null}={}){let i=e?pg(e):null,a=!!(e&&fg(e)),o=!!e?.items.some(e=>e.sessionAssembly),s=i?.total??r?.total??0,c=Bm(s,`Work`),l=e?.items.find(e=>e.status===`uploading`),u=e?_g(e):[],d=[{label:`Verifying your reviewed files`,done:!!e,doneLine:`${Bm(n,`session`)} ${n===1?`matches`:`match`} your review`,activeLine:r?`Packing ${r.title?`“${ja(r.title)}” · `:``}${Math.min(r.packaged+1,r.total)} of ${c}`:``},{label:`Uploading approved sessions`,done:!!(i&&i.uploaded>=i.total),doneLine:`${c} uploaded`,activeLine:l?`Uploading “${ja(l.title)}” · ${Math.min((i?.uploaded??0)+1,s)} of ${c}`:`${i?.uploaded??0} of ${c} uploaded`},{label:`Building your profile`,done:!!(i&&i.assessed>=i.total),doneLine:o?`Assessment complete`:`Profile built`,activeLine:u[t%Math.max(1,u.length)]??``},{label:o?`Finishing your submission`:`Finishing your profile update`,done:a||!!(i?.replaced&&e&&gg(e)),doneLine:a?`Submission assessed`:`Profile updated`,activeLine:o?`Checking your Work assessments`:`Checking your Works on your profile`}],f=d.findIndex(e=>!e.done);return d.map((e,t)=>{let n=f===-1||t<f?`done`:t===f?`active`:`upcoming`;return{label:e.label,state:n,line:n===`done`?e.doneLine:n===`active`?e.activeLine:``}})}function yg(e,t,n,r){return(e?.status===`paused`||e?.status===`blocked`)&&!!e.confirmedAt&&(n||r===!1||[`review`,`ready`].includes(t.phase)&&(!t.privacy.packageApproval||t.works.filter(Ra).some(t=>e.items.find(e=>e.workId===t.id)?.access!==t.access)||e.items.some(e=>{let n=t.works.find(t=>t.id===e.workId);return!n||n.access===`drop`||n.revision!==e.artifact.revision||n.artifact===null||n.artifact.sha256!==e.artifact.sha256||n.artifact.revision!==e.artifact.revision||n.artifact.bundleId!==e.artifact.bundleId})))}var bg={drop:`Dropped`,empty:`No sessions left`,sent:`Already sent; unchanged`,"not-ready":`Not ready`,"too-large":`Too large`};function xg({view:e,items:t}){return t.length?(0,F.jsxs)(`details`,{className:`journey-send-details`,"aria-label":`Not sent this time`,children:[(0,F.jsxs)(`summary`,{children:[`Not sent this time · `,t.length]}),(0,F.jsx)(`ul`,{children:t.map(t=>{let n=e.works.find(e=>e.id===t.workId),r=t.reason===`not-ready`&&n?La(n)?ch(n):Ka(e,n):bg[t.reason];return(0,F.jsxs)(`li`,{children:[ja(n?.localTitle??t.title),` · `,r??t.reason]},t.workId)})})]}):null}function Sg(e){return{items:e.works.filter(Ra).map(e=>({workId:e.id,access:e.access})),omitted:e.works.filter(e=>!Ra(e)).map(e=>({workId:e.id,title:e.title,reason:Ia(e)?`not-ready`:e.access===`drop`?`drop`:`empty`}))}}function Cg(e,t){let n=n=>t.items.filter(e=>e.access===n).reduce((t,n)=>t+(e.works.find(e=>e.id===n.workId)?.rootSessionIds.length??0),0),r=n(`public`),i=n(`private`);return{total:r+i,publicSessions:r,privateSessions:i}}function wg(e,t){let n=e.privacy.cards.filter(e=>e.answer!==null).length,r=qm(e).reduce((e,t)=>e+t.count,0),i=t.omitted.filter(e=>e.reason!==`sent`).length;return`${[...n?[tg(n,`question`)+` answered`]:[],`${tg(r,`item`)} hidden`,...i?[`${tg(i,`Work`)} left out`]:[]].join(` · `)}. Nothing leaves this computer until you send.`}function Tg({journey:e,send:t,busy:n,reconfirm:r,preparing:i,hold:a=null,onPrepare:o,onStart:s}){let c=Cg(e,t),u=t.omitted.filter(e=>![`drop`,`empty`,`sent`].includes(e.reason)),d=(0,l.useId)(),f=n||!t.items.length,p=f?a??(t.items.length?null:{reason:`No Works are selected to send.`}):null;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{className:`say journey-send-what`,children:wg(e,t)}),u.length>0&&(0,F.jsx)(`div`,{className:`journey-send-scope`,children:(0,F.jsx)(xg,{view:e,items:u})}),(0,F.jsx)(`p`,{className:`say`,children:`New or changed sessions are uploaded and grouped into these Works. Your other Works stay on your Tacitt profile.`}),t.items.map(t=>t.recoveryReview&&(0,F.jsxs)(`section`,{className:`journey-send-scope`,children:[(0,F.jsxs)(`p`,{className:`say`,children:[`Review the new Send for`,` `,e.works.find(e=>e.id===t.workId)?.title??`this Work`,`. Observed profile membership:`,` `,tg(t.recoveryReview.currentKeys.length,`session`),`,`,` `,t.recoveryReview.currentAccess??`not created`,`. Separately observed assembly revision: `,t.recoveryReview.revision,`. The proposed membership keeps those sessions and includes `,t.recoveryReview.proposedKeys.length,` sessions in total,`,` `,t.access,`. These observations are not an atomic snapshot and can change before sending. The previous Send remains in history.`]}),(0,F.jsxs)(`details`,{children:[(0,F.jsx)(`summary`,{children:`Review session membership`}),(0,F.jsxs)(`p`,{children:[`Observed session keys: `,t.recoveryReview.currentKeys.join(`, `)||`None`]}),(0,F.jsxs)(`p`,{children:[`Proposed session keys: `,t.recoveryReview.proposedKeys.join(`, `)||`None`]})]})]},t.workId)),(0,F.jsxs)(`div`,{className:`btns`,children:[r?(0,F.jsx)(`button`,{className:`tc-btn primary`,type:`button`,disabled:n,onClick:o,children:i?`Refreshing Send scope…`:`Refresh Send scope`}):(0,F.jsx)(`button`,{className:`tc-btn primary`,type:`button`,disabled:f,title:p?.reason,"aria-describedby":p?d:void 0,onClick:s,children:i?`Preparing Send scope…`:`Send ${tg(c.total,`session`)}${p?.percent===void 0?``:` · ${p.percent}%`}`}),p&&!r&&(0,F.jsx)(`span`,{id:d,className:`vh`,children:p.reason})]})]})}var Eg=4e3,Dg=(0,F.jsx)(`svg`,{viewBox:`0 0 20 20`,width:`18`,height:`18`,"aria-hidden":`true`,children:(0,F.jsx)(`path`,{d:`M4 10l4 4 8-8`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`})});function Og(e){let[t,n]=(0,l.useState)(0);return(0,l.useEffect)(()=>{if(!e)return;let t=setInterval(()=>n(e=>e+1),Eg);return()=>clearInterval(t)},[e]),t}function kg({stages:e,percent:t,value:n,max:r,valueText:i,sessions:a,works:o,publicWorks:s,privateWorks:c,timing:l}){let u=e.find(e=>e.state===`active`);return(0,F.jsxs)(`div`,{className:`journey-send-progress`,children:[(0,F.jsxs)(`div`,{className:`finish-progress`,children:[(0,F.jsx)(`p`,{children:u?.label??`Profile updated`}),(0,F.jsxs)(`strong`,{"aria-hidden":`true`,children:[t,`%`]}),(0,F.jsx)(`progress`,{className:`tc-bar`,"aria-label":`Submission progress`,"aria-valuetext":i,value:n,max:r})]}),(0,F.jsx)(`ol`,{className:`finish-stages`,"aria-label":`Submission stages`,children:e.map((e,t)=>(0,F.jsxs)(`li`,{"data-state":e.state,"aria-current":e.state===`active`?`step`:void 0,children:[(0,F.jsx)(`span`,{className:`finish-mark`,"aria-hidden":`true`,children:e.state===`done`?Dg:t+1}),(0,F.jsxs)(`span`,{className:`finish-stage`,children:[e.label,(0,F.jsx)(`small`,{"aria-hidden":e.state===`active`||void 0,children:e.line},e.line)]})]},e.label))}),(0,F.jsxs)(`p`,{className:`finish-summary`,"aria-label":`What is being sent`,children:[(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`b`,{children:a}),` sessions`]}),(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`b`,{children:o}),` Works`]}),(0,F.jsxs)(`span`,{children:[(0,F.jsxs)(`b`,{children:[s,` / `,c]}),` `,`public / private`]})]}),l&&(0,F.jsx)(`p`,{className:`finish-timing`,children:`Large submissions can take 15–20 minutes.`})]})}function Ag({send:e,journey:t}){let n=Cg(t,e).total,r=vg(e,0,{sessions:n})[2]?.state===`active`,i=Og(r&&e.status!==`paused`);if(!e.confirmedAt||!e.items.length||![`sending`,`waiting`,`review`,`paused`,`blocked`].includes(e.status))return null;let a=pg(e),o=mg(e),s=[{label:`Waiting to upload`,count:e.items.filter(e=>e.status===`ready`).length},{label:`Uploading`,count:e.items.filter(e=>e.status===`uploading`).length},{label:`Awaiting assessment`,count:e.items.filter(e=>e.status===`assessing`).length},{label:`Needs attention`,count:e.items.filter(e=>[`target`,`settings`,`blocked`].includes(e.status)).length}].filter(e=>e.count>0);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`vh`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:[(0,F.jsxs)(`p`,{children:[a.uploaded,` of `,a.total,` Works uploaded`]}),(0,F.jsxs)(`p`,{children:[a.assessed,` of `,a.total,` Works sent and assessed`]}),(0,F.jsx)(`p`,{children:s.map(e=>`${e.label}: ${e.count}`).join(` · `)})]}),e.items.filter(e=>e.status===`uploading`&&e.sessionUpload).map(e=>{let t=e.sessionUpload;if(!t)return null;if(t.contentLength===void 0)return(0,F.jsx)(`p`,{children:`Checking stored session upload`},e.workId);let n=t.bytesSent??0,r=t.bytesAcknowledged??0,i=r>=t.contentLength,a=e=>e.toLocaleString(`en-US`);return(0,F.jsxs)(`div`,{className:`journey-session-upload`,children:[(0,F.jsxs)(`p`,{children:[i?`Session ZIP confirmed`:`Session ZIP upload`,!i&&t.attempt?` · Attempt ${t.attempt}`:``]}),(0,F.jsx)(`progress`,{"aria-label":`Session ZIP upload`,value:i?r:n,max:t.contentLength}),(0,F.jsxs)(`p`,{children:[!i&&`${a(n)} / ${a(t.contentLength)} bytes · `,a(r),` bytes acknowledged`]}),(0,F.jsx)(`small`,{children:i?`Stored session confirmed by the server`:n===t.contentLength?`Waiting for server confirmation`:n>0?`Sending session ZIP bytes`:`Checking stored session upload`})]},e.workId)}),(0,F.jsx)(kg,{stages:vg(e,i,{sessions:n}),percent:o.percent,value:o.value,max:o.max,valueText:`${a.uploaded} uploaded, ${a.assessed} assessed of ${a.total} Works`,sessions:n,works:a.total,publicWorks:a.publicWorks,privateWorks:a.privateWorks,timing:r&&[`sending`,`waiting`].includes(e.status)})]})}function jg({journey:e,title:t}){let{completed:n,selected:r,percent:i}=bh(e),a=Sg(e),o=a.items.filter(e=>e.access===`public`).length;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`vh`,role:`status`,children:[`Packaging · `,n,` of `,r,` Works packaged`]}),(0,F.jsx)(kg,{stages:vg(null,0,{packing:{packaged:n,total:r,title:t}}),percent:i,value:n,max:Math.max(1,r),valueText:`${n} of ${r} Works packaged`,sessions:Cg(e,a).total,works:a.items.length,publicWorks:o,privateWorks:a.items.length-o,timing:!1})]})}var Mg=/^[a-z0-9]+(?:-[a-z0-9]+)*$/iu;function Ng(e){return e.length<=39&&Mg.test(e)}function Pg(e){return e.toLowerCase().replace(/[^a-z0-9]+/gu,`-`).replace(/^-+/u,``).slice(0,39).replace(/-+$/u,``)}function Fg(e,t,n){if(e)return e;let r=Pg(t);return r&&!/[^\u0000-\u007f]/u.test(t)?r:Pg(n.split(`@`,1)[0]??``)}var Ig=[[/^(x|twitter)\.com$/u,`x`,`X`],[/^linkedin\.com$/u,`linkedin`,`LinkedIn`],[/^github\.com$/u,`github`,`GitHub`],[/^youtube\.com$/u,`youtube`,`YouTube`],[/^instagram\.com$/u,`instagram`,`Instagram`],[/^threads\.(net|com)$/u,`threads`,`Threads`],[/^bsky\.app$/u,`bluesky`,`Bluesky`]],Lg=[{kind:`github`,label:`GitHub`,prefix:`github.com/`,example:`github.com/yourname`},{kind:`linkedin`,label:`LinkedIn`,prefix:`linkedin.com/in/`,example:`linkedin.com/in/yourname`},{kind:`x`,label:`X`,prefix:`x.com/`,example:`x.com/yourname`},{kind:`website`,label:`Website`,prefix:``,example:`yoursite.com`}];function Rg(e){let t=e.trim();if(t.startsWith(`mailto:`)){let e=t.slice(7);return/^[^\s@]+@[^\s@]+\.[^\s@]+$/u.test(e)&&t.length<=2048?{url:t,label:`Email`,kind:`email`}:null}let n=/^[a-z][a-z0-9+.-]*:/iu.test(t)?t:`https://${t}`;if(!URL.canParse(n)||/\s/u.test(n)||n.length>2048)return null;let r=new URL(n),i=r.hostname.replace(/^www\./u,``);if(![`https:`,`http:`].includes(r.protocol)||r.username||r.password||!/^[a-z0-9-]+(\.[a-z0-9-]+)*\.[a-z]{2,}$/iu.test(i))return null;let a=Ig.find(([e])=>e.test(i));return a?{url:r.href,label:a[2],kind:a[1]}:{url:r.href,label:`Website`,kind:`website`}}function zg(e){return e.replace(/^mailto:/u,``).replace(/^https?:\/\/(www\.)?/u,``).replace(/\/$/u,``)}var Bg={github:`M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12`,linkedin:`M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z`,x:`M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z`,youtube:`M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z`,instagram:`M7.0301.084c-1.2768.0602-2.1487.264-2.911.5634-.7888.3075-1.4575.72-2.1228 1.3877-.6652.6677-1.075 1.3368-1.3802 2.127-.2954.7638-.4956 1.6365-.552 2.914-.0564 1.2775-.0689 1.6882-.0626 4.947.0062 3.2586.0206 3.6671.0825 4.9473.061 1.2765.264 2.1482.5635 2.9107.308.7889.72 1.4573 1.388 2.1228.6679.6655 1.3365 1.0743 2.1285 1.38.7632.295 1.6361.4961 2.9134.552 1.2773.056 1.6884.069 4.9462.0627 3.2578-.0062 3.668-.0207 4.9478-.0814 1.28-.0607 2.147-.2652 2.9098-.5633.7889-.3086 1.4578-.72 2.1228-1.3881.665-.6682 1.0745-1.3378 1.3795-2.1284.2957-.7632.4966-1.636.552-2.9124.056-1.2809.0692-1.6898.063-4.948-.0063-3.2583-.021-3.6668-.0817-4.9465-.0607-1.2797-.264-2.1487-.5633-2.9117-.3084-.7889-.72-1.4568-1.3876-2.1228C21.2982 1.33 20.628.9208 19.8378.6165 19.074.321 18.2017.1197 16.9244.0645 15.6471.0093 15.236-.005 11.977.0014 8.718.0076 8.31.0215 7.0301.0839m.1402 21.6932c-1.17-.0509-1.8053-.2453-2.2287-.408-.5606-.216-.96-.4771-1.3819-.895-.422-.4178-.6811-.8186-.9-1.378-.1644-.4234-.3624-1.058-.4171-2.228-.0595-1.2645-.072-1.6442-.079-4.848-.007-3.2037.0053-3.583.0607-4.848.05-1.169.2456-1.805.408-2.2282.216-.5613.4762-.96.895-1.3816.4188-.4217.8184-.6814 1.3783-.9003.423-.1651 1.0575-.3614 2.227-.4171 1.2655-.06 1.6447-.072 4.848-.079 3.2033-.007 3.5835.005 4.8495.0608 1.169.0508 1.8053.2445 2.228.408.5608.216.96.4754 1.3816.895.4217.4194.6816.8176.9005 1.3787.1653.4217.3617 1.056.4169 2.2263.0602 1.2655.0739 1.645.0796 4.848.0058 3.203-.0055 3.5834-.061 4.848-.051 1.17-.245 1.8055-.408 2.2294-.216.5604-.4763.96-.8954 1.3814-.419.4215-.8181.6811-1.3783.9-.4224.1649-1.0577.3617-2.2262.4174-1.2656.0595-1.6448.072-4.8493.079-3.2045.007-3.5825-.006-4.848-.0608M16.953 5.5864A1.44 1.44 0 1 0 18.39 4.144a1.44 1.44 0 0 0-1.437 1.4424M5.8385 12.012c.0067 3.4032 2.7706 6.1557 6.173 6.1493 3.4026-.0065 6.157-2.7701 6.1506-6.1733-.0065-3.4032-2.771-6.1565-6.174-6.1498-3.403.0067-6.156 2.771-6.1496 6.1738M8 12.0077a4 4 0 1 1 4.008 3.9921A3.9996 3.9996 0 0 1 8 12.0077`,threads:`M12.186 24h-.007c-3.581-.024-6.334-1.205-8.184-3.509C2.35 18.44 1.5 15.586 1.472 12.01v-.017c.03-3.579.879-6.43 2.525-8.482C5.845 1.205 8.6.024 12.18 0h.014c2.746.02 5.043.725 6.826 2.098 1.677 1.29 2.858 3.13 3.509 5.467l-2.04.569c-1.104-3.96-3.898-5.984-8.304-6.015-2.91.022-5.11.936-6.54 2.717C4.307 6.504 3.616 8.914 3.589 12c.027 3.086.718 5.496 2.057 7.164 1.43 1.783 3.631 2.698 6.54 2.717 2.623-.02 4.358-.631 5.8-2.045 1.647-1.613 1.618-3.593 1.09-4.798-.31-.71-.873-1.3-1.634-1.75-.192 1.352-.622 2.446-1.284 3.272-.886 1.102-2.14 1.704-3.73 1.79-1.202.065-2.361-.218-3.259-.801-1.063-.689-1.685-1.74-1.752-2.964-.065-1.19.408-2.285 1.33-3.082.88-.76 2.119-1.207 3.583-1.291a13.853 13.853 0 0 1 3.02.142c-.126-.742-.375-1.332-.75-1.757-.513-.586-1.308-.883-2.359-.89h-.029c-.844 0-1.992.232-2.721 1.32L7.734 7.847c.98-1.454 2.568-2.256 4.478-2.256h.044c3.194.02 5.097 1.975 5.287 5.388.108.046.216.094.321.142 1.49.7 2.58 1.761 3.154 3.07.797 1.82.871 4.79-1.548 7.158-1.85 1.81-4.094 2.628-7.277 2.65Zm1.003-11.69c-.242 0-.487.007-.739.021-1.836.103-2.98.946-2.916 2.143.067 1.256 1.452 1.839 2.784 1.767 1.224-.065 2.818-.543 3.086-3.71a10.5 10.5 0 0 0-2.215-.221z`,bluesky:`M12 10.8c-1.087-2.114-4.046-6.053-6.798-7.995C2.566.944 1.561 1.266.902 1.565.139 1.908 0 3.08 0 3.768c0 .69.378 5.65.624 6.479.815 2.736 3.713 3.66 6.383 3.364.136-.02.275-.039.415-.056-.138.022-.276.04-.415.056-3.912.58-7.387 2.005-2.83 7.078 5.013 5.19 6.87-1.113 7.823-4.308.953 3.195 2.05 9.271 7.733 4.308 4.267-4.308 1.172-6.498-2.74-7.078a8.741 8.741 0 0 1-.415-.056c.14.017.279.036.415.056 2.67.297 5.568-.628 6.383-3.364.246-.828.624-5.79.624-6.478 0-.69-.139-1.861-.902-2.206-.659-.298-1.664-.62-4.3 1.24C16.046 4.748 13.087 8.687 12 10.8Z`};function Vg({kind:e}){return e===`website`?(0,F.jsxs)(`svg`,{className:`o-ico`,viewBox:`0 0 24 24`,"aria-hidden":`true`,"data-stroke":``,children:[(0,F.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9.5`}),(0,F.jsx)(`ellipse`,{cx:`12`,cy:`12`,rx:`4`,ry:`9.5`}),(0,F.jsx)(`path`,{d:`M2.5 12h19`})]}):e===`email`?(0,F.jsxs)(`svg`,{className:`o-ico`,viewBox:`0 0 24 24`,"aria-hidden":`true`,"data-stroke":``,children:[(0,F.jsx)(`rect`,{x:`2.5`,y:`4.5`,width:`19`,height:`15`,rx:`2`}),(0,F.jsx)(`path`,{d:`m3 6 9 7 9-7`})]}):(0,F.jsx)(`svg`,{className:`o-ico`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,F.jsx)(`path`,{d:Bg[e]})})}function Hg(e,t){return t.view?.state!==`signed-in`||!e.consent||[`sending`,`completed`].includes(e.phase)?null:e.profile?.address?e.profile.linksChoice===null?`links`:null:`address`}function Ug(){let[e,t]=(0,l.useState)(null),[n,r]=(0,l.useState)(``),[i,a]=(0,l.useState)(0);return(0,l.useEffect)(()=>{let e=!0;return N.send.ownerProfile.query().then(n=>e&&t(n),t=>{console.error(`OWNER_PROFILE_READ_FAILED`),e&&r(P(t))}),()=>{e=!1}},[i]),{owner:e,error:n,reload:()=>a(e=>e+1)}}async function Wg(e,t){return N.nativeJourney.respond.mutate({journeyId:e.journeyId,expectedRevision:e.revision,idempotencyKey:crypto.randomUUID(),action:t})}function Gg(e,t){let[n,r]=(0,l.useState)(null),i=Ng(e)?t&&e.toLowerCase()===t.toLowerCase()?`ok`:null:`invalid`;return(0,l.useEffect)(()=>{if(i)return;let t=!0,n=setTimeout(()=>{N.send.addressTaken.query({address:e}).then(n=>{let i=n===null?`unknown`:n.taken?`taken`:`ok`;t&&r({value:e,state:i})},()=>{t&&r({value:e,state:`unknown`})})},300);return()=>{t=!1,clearTimeout(n)}},[e,i]),i??(n?.value===e?n.state:`checking`)}var Kg={checking:`Checking…`,ok:`Available`,taken:`Taken`,invalid:`Letters, digits and single hyphens, up to 39 characters`,unknown:`Checked when you send`};function qg({view:e,account:t,onState:n,disconnected:r=!1,refusal:i=!1,sent:a=!1,onSaved:o}){let{owner:s,error:c}=Ug(),u=t.view?.state===`signed-in`?t.view.displayName:``,d=s?i?e.profile?.address??``:Fg(s.address,u,s.accountEmail):``,[f,p]=(0,l.useState)(null),[m,h]=(0,l.useState)(i),[g,_]=(0,l.useState)(!1),[v,y]=(0,l.useState)(``),b=f??d,x=Gg(b,s?.address??``),S=(0,l.useRef)(null);(0,l.useEffect)(()=>{m&&S.current?.focus()},[m]);async function C(){_(!0),y(``);try{let t=await Wg(e,{kind:`profile-address`,address:b});if(n(t.state),t.status===`stale`)return y(`The journey changed. Keep your address again.`);a&&(await N.send.saveSentProfile.mutate({journeyId:e.journeyId}),o?.())}catch(e){console.error(`PROFILE_ADDRESS_SAVE_FAILED`),y(P(e))}finally{_(!1)}}let w=[`ok`,`unknown`].includes(x)&&!g&&!r&&!!s;return(0,F.jsxs)(`section`,{className:`journey-decision o-top`,"aria-labelledby":`profile-address`,children:[(0,F.jsxs)(`p`,{className:`o-k`,children:[(0,F.jsx)(`span`,{className:`o-kick`,children:`Your address`}),!a&&(0,F.jsx)(`span`,{className:`o-chip`,children:i?`Before we send`:`While we read`})]}),(0,F.jsx)(`h3`,{className:`o-head`,id:`profile-address`,children:i?`Choose another address`:`Your Tacitt profile will live at tacitt.ai/${b}`}),(0,F.jsxs)(`p`,{className:`o-addr`,children:[(0,F.jsx)(`span`,{className:`o-addr-host`,children:`tacitt.ai/`}),m?(0,F.jsx)(`input`,{ref:S,className:`o-addr-in`,type:`text`,value:b,maxLength:39,"aria-label":`Your address after tacitt.ai/`,autoComplete:`off`,autoCapitalize:`off`,spellCheck:!1,onChange:e=>p(e.currentTarget.value.trim())}):(0,F.jsx)(`span`,{className:`o-addr-slug`,children:b}),(0,F.jsx)(`span`,{className:`o-avail`,role:`status`,"data-state":x,children:s?Kg[x]:c?``:`Loading…`})]}),(v||c)&&(0,F.jsx)(`p`,{role:`alert`,className:`say`,children:v||c}),(0,F.jsx)(`div`,{className:`o-foot journey-card-actions`,children:(0,F.jsxs)(`span`,{className:`o-acts`,children:[!m&&(0,F.jsx)(`button`,{type:`button`,className:`o-btn`,onClick:()=>h(!0),children:`Change`}),(0,F.jsx)(`button`,{type:`button`,className:`o-btn`,"data-suggested":!0,disabled:!w,onClick:C,children:`Keep`})]})})]})}function Jg({view:e,onState:t,disconnected:n=!1,sent:r=!1}){let{owner:i}=Ug(),[a,o]=(0,l.useState)(null),[s,c]=(0,l.useState)(``),[u,d]=(0,l.useState)(``),[f,p]=(0,l.useState)(!1),m=(0,l.useRef)(null),h=a??i?.links??[],g=h.length>=5,_=new Set(h.map(e=>Rg(e)?.kind)),v=Lg.filter(e=>e.kind===`website`||!_.has(e.kind)),y=v[0]?.example??`yoursite.com`;function b(e){c(e),d(``),requestAnimationFrame(()=>{let t=m.current;t?.focus(),t?.setSelectionRange(e.length,e.length)})}function x(){let e=Rg(s);if(!e)return d(`That doesn’t look like a link. Try x.com/you or your site.`);if(h.includes(e.url))return d(`Already in your links.`);if(h.length>=5)return d(`Your profile shows up to 5 links.`);o([...h,e.url]),c(``),d(``)}async function S(n){p(!0),d(``);try{let i=await Wg(e,{kind:`profile-links`,links:h,choice:n});if(t(i.state),i.status===`stale`)return d(`The journey changed. Choose again.`);r&&n===`added`&&await N.send.saveSentProfile.mutate({journeyId:e.journeyId})}catch(e){console.error(`PROFILE_LINKS_SAVE_FAILED`),d(P(e))}finally{p(!1)}}return(0,F.jsxs)(`section`,{className:`journey-decision o-top`,"aria-labelledby":`profile-links`,children:[(0,F.jsxs)(`p`,{className:`o-k`,children:[(0,F.jsx)(`span`,{className:`o-kick`,children:`Optional`}),!r&&(0,F.jsx)(`span`,{className:`o-chip`,children:`While we read`})]}),(0,F.jsx)(`h3`,{className:`o-head`,id:`profile-links`,children:`Help people find you`}),(0,F.jsx)(`p`,{className:`o-body`,children:`Add your GitHub, LinkedIn, X or personal site. They show at the top of your Tacitt profile.`}),h.length>0&&(0,F.jsx)(`ul`,{className:`o-lnks`,"aria-label":`Your links`,children:h.map(e=>{let t=Rg(e),n=t?.label??zg(e);return(0,F.jsxs)(`li`,{className:`o-lnk`,title:zg(e),children:[t&&(0,F.jsx)(Vg,{kind:t.kind}),(0,F.jsx)(`span`,{children:n}),(0,F.jsx)(`button`,{type:`button`,className:`o-lnk-x`,"aria-label":`Remove ${n} (${zg(e)})`,onClick:()=>o(h.filter(t=>t!==e)),children:`×`})]},e)})}),g?(0,F.jsxs)(`p`,{className:`say o-full`,children:[5,` of `,5,` links added. Remove one to add another.`]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`o-quick`,role:`group`,"aria-label":`Quick add`,children:v.map(e=>(0,F.jsxs)(`button`,{type:`button`,className:`o-quick-b`,onClick:()=>b(e.prefix),children:[(0,F.jsx)(Vg,{kind:e.kind}),e.label]},e.kind))}),(0,F.jsxs)(`form`,{className:`o-paste`,noValidate:!0,onSubmit:e=>{e.preventDefault(),x()},children:[(0,F.jsx)(`input`,{ref:m,type:`url`,inputMode:`url`,placeholder:y,"aria-label":`Paste a link`,autoComplete:`off`,spellCheck:!1,value:s,onChange:e=>c(e.currentTarget.value)}),(0,F.jsx)(`button`,{type:`submit`,className:`o-btn o-add`,disabled:!s.trim(),children:`Add`})]})]}),(0,F.jsx)(`p`,{className:`say o-paste-h`,role:`status`,children:u}),(0,F.jsx)(`div`,{className:`o-foot journey-card-actions`,children:(0,F.jsxs)(`span`,{className:`o-acts`,children:[(0,F.jsx)(`button`,{type:`button`,className:`o-btn`,disabled:f||n,onClick:()=>void S(r?`declined`:`later`),children:`Later`}),(0,F.jsx)(`button`,{type:`button`,className:`o-btn`,"data-suggested":!0,disabled:f||n||!h.length,onClick:()=>void S(`added`),children:`Add to profile`})]})})]})}function Yg({view:e,account:t,onState:n,disconnected:r=!1}){let{owner:i,reload:a}=Ug();if(!i)return null;if(!i.address)return(0,F.jsx)(qg,{view:e,account:t,onState:n,disconnected:r,sent:!0,onSaved:a});let o=e.profile?.linksChoice??null;return o!==null&&o!==`later`?null:(0,F.jsx)(Jg,{view:e,onState:n,disconnected:r,sent:!0})}var Xg=[`PASSPORT_ADDRESS_TAKEN`,`PASSPORT_ADDRESS_RESERVED`,`PASSPORT_ADDRESS_LIMIT`],Zg=e=>{},Qg={"awaiting-packaging":`Preparing your reviewed files`,prepared:`Ready to send`,"sign-in":`Sign in to continue`,review:`A choice before sending`,sending:`Sending your Works`,waiting:`Waiting for assessment`,paused:`Sending paused`,completed:`Your Tacitt profile is ready`,blocked:`Send needs your attention`},$g=[...ug,`PASSPORT_NOT_CURRENT`,`WORK_REMOVED`];function e_(e){return e.items.some(e=>e.status===`blocked`&&![...$g,`SEND_SCOPE_CHANGED`].includes(e.error??``))}function t_(e,t=Date.now()){let n=e.view,r=n?.state;return n?.state===`signed-in`&&Date.parse(n.expiresAt)>t?`Signed in. Resuming your Send…`:r===`authorizing`?`Waiting for approval. Your Send starts as soon as you approve.`:r===`starting-sign-in`?`Requesting a sign-in code…`:r===`signed-in`||n?.lastError===`SIGN_IN_EXPIRED`?`Your sign-in expired. Sign in again; your Send starts after you approve.`:`Sign in to send. Your Send starts after you approve the sign-in.`}function n_(e){return e.items.some(e=>e.receipt!==null||[`uploading`,`assessing`,`completed`].includes(e.status))}function r_({send:e}){let{assessed:t,total:n}=pg(e),r=e.items.some(e=>![`completed`,`blocked`].includes(e.status)),i=e.items.filter(e=>e.status===`blocked`),a=i.filter(e=>[`ASSESSMENT_INCOMPLETE`,`PASSPORT_NOT_CURRENT`,`WORK_REMOVED`].includes(e.error??``));return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`say`,role:`status`,children:[t,` of `,tg(n,`Work`),` assessed.`,r&&` Assessment continues in the background.`]}),a.length>0&&(0,F.jsxs)(`p`,{className:`say`,children:[`Assessment failed for `,a.map(e=>`“${ja(e.title)}”`).join(`, `),`.`]}),i.filter(e=>!a.includes(e)).map(e=>(0,F.jsxs)(`p`,{className:`say`,role:`alert`,children:[`“`,ja(e.title),`”: `,C(e.error??``).label,`.`]},e.workId))]})}function i_({journey:e,account:t,connection:n,onState:r}){let i=Mh(e,r),{nudge:a}=i,o=t.view?.state===`signed-in`,s=i.view?.send?.status===`sign-in`;(0,l.useEffect)(()=>{o&&s&&a()},[o,s,a]);let c=t.refresh;(0,l.useEffect)(()=>{s&&c()},[s,c]);let u=i.busy||!!n,d=e.works.some(e=>e.status===`ready`),f=i.view?.send,p=f?.status===`completed`,m=f?hg(f):null,h=f?gg(f):null;(0,l.useEffect)(()=>{h&&/^https?:\/\//iu.test(h)&&window.location.assign(h)},[h]);let g=(()=>{if(!f||!f.items.length)return null;let t=f.items.map(e=>e.workId),n=e.works.filter(e=>Ia(e)&&e.artifact?.revision===e.revision);return new Set(t).size!==t.length||t.length!==n.length||n.some(e=>!t.includes(e.id))?null:f.items.every(e=>{let t=n.find(t=>t.id===e.workId);return!!(t&&t.artifact?.sha256===e.artifact.sha256&&t.artifact.revision===e.artifact.revision)})?qm(e).reduce((e,t)=>e+t.count,0):null})(),_=f&&[`sending`,`waiting`,`review`,`sign-in`].includes(f.status),v=f?.status===`prepared`&&!f.confirmedAt&&f.items.some(t=>{let n=e.works.find(e=>e.id===t.workId)?.artifact;return!(!n||n.revision===t.artifact.revision&&n.sha256===t.artifact.sha256)}),y=yg(f,e,i.needsReview,i.view?.scopeValid),b=f?.error===`REQUEST_EXPIRED`,x=!(!f?.request||f.confirmedAt||f.error!==`IDENTITY_REJECTED`),S=!f?.confirmedAt&&(f?.status===`prepared`&&f.items.length===0||!!f?.request&&f?.error===`REVISION_CONFLICT`),w=!f||v||b||x||S,T=i.packaging!==null||w&&e.packaging!==null&&!i.prepackaging,E=!(!f||w||y||(!i.needsReview||_&&f.confirmedAt)&&f.error!==`ACCOUNT_CHANGED`&&f.error!==`REVISION_CONFLICT`&&f.error!==`SEND_SCOPE_INVALIDATED`),ee=f&&!w&&(E||f.status===`prepared`||f.status===`blocked`&&!f.confirmedAt),D=!!(f&&!w&&!E&&f.confirmedAt&&[`sending`,`waiting`].includes(f.status)),te=!(!f||w||E||!f.confirmedAt||f.status!==`paused`&&f.status!==`blocked`),ne=!p&&(T||D||te),re=t.view?.configuration.clientId===null?{reason:`Sign-in is not configured in this build`}:i.prepackaging?{reason:`Packaging…`,percent:bh(e).percent}:n?{reason:`Reconnecting to your local session…`}:i.preparing?{reason:`Preparing Send scope…`}:i.busy?{reason:`Checking your Send…`}:null,ie=f?.items.filter(e=>e.access===`private`).length??0,ae=Sg(e),oe=[`authorizing`,`starting-sign-in`].includes(t.view?.state??``),se=Jh(t)&&!(f?.status===`sign-in`&&t.view?.lastError===`SIGN_IN_EXPIRED`&&t.view.state===`signed-out`&&!t.error),O=f?.items.some(e=>e.status===`blocked`)&&f.items.every(e=>e.status===`completed`||e.status===`blocked`&&$g.includes(e.error??``)),k=f&&[`blocked`,`paused`,`completed`].includes(f.status)&&(y||f.error===`SESSION_CONTENT_CONFLICT`||f.items.some(e=>ug.includes(e.error??``))),ce=f?.items.filter(e=>e.status===`blocked`)??[];return(0,F.jsx)(F.Fragment,{children:(0,F.jsxs)(`section`,{className:ne?`finish journey-send`:`now journey-send`,"aria-label":`Send to Tacitt`,children:[(0,F.jsx)(`p`,{className:ne?`finish-kicker`:`now-k`,children:(0,F.jsx)(`span`,{className:`tc-kicker`,children:T?`Packaging your Works`:p?`Submission complete`:te?f?.status===`paused`?`Submission paused`:`Submission blocked`:D?`Submission in progress`:w?`Review complete`:`Now`})}),(0,F.jsx)(`h2`,{className:ne?`finish-title`:`now-t`,"data-ready":w&&!T&&!E||void 0,children:T?`Preparing your reviewed files`:y?`Your Send scope changed`:E?`Review your Send scope`:te?`Let’s pick up where we left off.`:D?`Your work is on its way.`:w?`Ready to send`:p?m?`Your Tacitt profile is ready.`:fg(f)?`Your submission was assessed`:`Your submission is complete.`:D?`Your work is on its way.`:Qg[f.status]}),D&&(0,F.jsx)(`p`,{className:`say finish-say`,children:`Your privacy choices are already applied. We’re submitting the reviewed copy and updating your Tacitt profile.`}),y&&!T&&(0,F.jsx)(`p`,{className:`say finish-say`,children:`Review the current Works and prepare a new Send, then confirm it separately. The earlier Send remains in history.`}),te&&!y&&!T&&(0,F.jsx)(`p`,{className:`say finish-say`,children:`Your reviewed choices and the progress so far are preserved. Continue the remaining work.`}),h&&(0,F.jsx)(`p`,{className:`say`,role:`status`,children:`Opening your profile…`}),f&&p&&!h&&(0,F.jsx)(r_,{send:f}),m&&(0,F.jsxs)(`p`,{className:`say`,children:[`Public to anyone with the link.`,ie>0&&` ${tg(ie,`Work`)} ${ie===1?`stays`:`stay`} only yours.`]}),se&&(0,F.jsx)(`div`,{className:`journey-send-sign-in`,children:(0,F.jsx)(Yh,{account:t,held:f?.status===`sign-in`&&!!f.confirmedAt,embedded:f?.status===`sign-in`,onCancel:f?.status===`sign-in`&&!f.items.some(e=>e.receipt)?()=>void i.withdraw():void 0})}),p&&g!==null&&(0,F.jsxs)(`p`,{className:`say`,children:[g,` keywords marked Hidden`]}),f?.replaced&&(0,F.jsxs)(`p`,{className:`say`,children:[tg(f.replaced.retiredWorkCount,`earlier Work`),` replaced on your profile.`]}),m&&(0,F.jsxs)(`a`,{className:`tc-btn primary`,href:m,target:`_blank`,rel:`noopener noreferrer`,children:[`Visit your profile `,(0,F.jsx)(`span`,{"aria-hidden":`true`,children:`↗`})]}),i.contention&&!n&&(0,F.jsx)(`p`,{role:`status`,className:`say`,children:i.contention}),i.error&&!n&&(0,F.jsxs)(`div`,{role:`alert`,className:`say`,children:[(0,F.jsx)(`p`,{children:i.error}),(0,F.jsx)(`div`,{className:`btns`,children:(0,F.jsx)(`button`,{className:`tc-btn`,type:`button`,disabled:u||i.needsReview,onClick:i.retry,children:`Retry connection`})})]}),f?.request&&!f.confirmedAt&&[`sign-in`,`prepared`].includes(f.status)&&(0,F.jsx)(`p`,{role:`status`,className:`say`,children:`Your Send request expires if the host restarts or after 30 minutes. Then click Send again.`}),x&&(0,F.jsx)(`p`,{role:`alert`,className:`say`,children:`The connected account changed after you clicked Send. Review the account and click Send again.`}),b&&(0,F.jsx)(`p`,{role:`alert`,className:`say`,children:`Your Send request expired because the host restarted or 30 minutes passed. Click Send again to continue.`}),f?.error&&!w&&(0,F.jsx)(`p`,{role:`alert`,className:`say`,children:f.error===`ACCOUNT_CHANGED`?`The signed-in account changed. Review the current Send scope and confirm it for this account.`:f.error===`REVISION_CONFLICT`?`The output changed. Review the current Send scope before sending.`:C(f.error).detail}),f?.error===`SESSION_CONTENT_CONFLICT`&&f.contentConflict&&(0,F.jsxs)(`p`,{role:`alert`,className:`say`,children:[`Conflicting Works:`,` `,f.contentConflict.workIds.map(e=>ja(f.items.find(t=>t.workId===e)?.title??e)).join(`, `),`. Session: `,(0,F.jsx)(`code`,{children:f.contentConflict.sessionKey}),`.`]}),f&&Xg.includes(f.error??``)&&(0,F.jsx)(qg,{view:e,account:t,onState:r??Zg,disconnected:!!n,refusal:!0}),p&&t.view?.state===`signed-in`&&(0,F.jsx)(Yg,{view:e,account:t,onState:r??Zg,disconnected:!!n}),i.packageError&&!w&&f?.status!==`awaiting-packaging`&&(0,F.jsx)(`p`,{role:`alert`,className:`say`,children:i.packageError}),f?.status===`awaiting-packaging`?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{role:`status`,className:`say`,children:`Your Send request is saved. Packaging will continue when available. It expires if the host restarts or after 30 minutes; then click Send again.`}),i.packageError&&(0,F.jsx)(`p`,{role:`alert`,className:`say`,children:i.packageError}),(0,F.jsx)(jg,{journey:e,title:i.packaging?.title??``}),(0,F.jsx)(`button`,{className:`tc-btn`,type:`button`,disabled:i.pauseBusy,onClick:()=>void i.withdraw(),children:`Cancel Send request`})]}):T?(0,F.jsx)(jg,{journey:e,title:i.packaging?.title??``}):w?(0,F.jsxs)(F.Fragment,{children:[i.packageError&&(0,F.jsx)(`p`,{role:`alert`,className:`say`,children:i.packageError}),(0,F.jsx)(Tg,{journey:e,send:ae,busy:u||t.view?.configuration.clientId===null,reconfirm:!1,preparing:i.preparing,hold:re,onPrepare:()=>void i.review(),onStart:()=>void i.send({included:ae.items.map(({workId:e,access:t})=>({workId:e,access:t})),omittedWorkIds:ae.omitted.map(e=>e.workId)})})]}):ee?(0,F.jsx)(Tg,{journey:e,send:f,busy:u||t.view?.configuration.clientId===null,reconfirm:E,preparing:i.preparing,hold:re,onPrepare:()=>void i.review(),onStart:()=>void i.start()}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(Ag,{send:f,journey:e}),f.status===`sign-in`&&!oe&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{className:`say`,role:`status`,children:f.request&&!f.confirmedAt?`Sign in, then click Send again to confirm the account.`:t_(t)}),t.view?.state===`signed-out`&&(0,F.jsxs)(`div`,{className:`btns`,children:[(0,F.jsx)(`button`,{className:`tc-btn primary`,type:`button`,disabled:t.busy||t.view.configuration.clientId===null,onClick:()=>void t.signIn(),children:`Sign in`}),!f.items.some(e=>e.receipt)&&(0,F.jsx)(`button`,{className:`tc-btn`,type:`button`,disabled:u,onClick:()=>void i.withdraw(),children:`Cancel`})]})]}),!p&&(0,F.jsxs)(`div`,{className:`journey-send-scope`,children:[(0,F.jsx)(Fh,{items:ce}),(0,F.jsx)(xg,{view:e,items:f.omitted})]}),O&&!p&&!k&&(0,F.jsx)(`p`,{className:`say`,children:`The remaining Works need attention in your Tacitt profile. They cannot be resumed here.`}),(0,F.jsxs)(`div`,{className:`btns`,children:[k&&(0,F.jsx)(`button`,{className:`tc-btn primary`,type:`button`,disabled:u,onClick:()=>void i.review(),children:`Review a new Send`}),p&&!k&&d&&g===null&&(0,F.jsx)(`button`,{className:`tc-btn`,type:`button`,disabled:u,onClick:()=>void i.send({included:ae.items.map(({workId:e,access:t})=>({workId:e,access:t})),omittedWorkIds:ae.omitted.map(e=>e.workId)}),children:i.preparing?`Preparing Send scope…`:`Send changes`}),(_||f.status===`completed`)&&f.status!==`sign-in`&&e_(f)&&(0,F.jsx)(`button`,{className:`tc-btn`,type:`button`,disabled:i.pauseBusy||!!n,onClick:()=>void i.retryWorks(),children:`Retry failed Works`}),(f.status===`paused`||f.status===`blocked`)&&!O&&!y&&f.error!==`SESSION_CONTENT_CONFLICT`&&(0,F.jsx)(`button`,{className:`tc-btn primary finish-go`,type:`button`,disabled:u,onClick:()=>void i.resume(),children:f.status===`paused`?`Resume submission`:`Retry remaining submission`}),_&&n_(f)&&(0,F.jsx)(`button`,{className:`tc-btn`,type:`button`,disabled:i.pauseBusy||!!n,onClick:()=>void i.pause(),children:`Pause remaining uploads`})]})]})]},p?`complete`:D?`submitting`:T?`packaging`:w?`ready`:f.status)})}var a_=e=>e.readingComplete?e.works.find(e=>e.placement===`unsorted`&&e.access!==`drop`&&e.rootSessionIds.length>0):void 0;function o_({view:e,work:t,onState:n,disconnected:r}){let[i,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(!1),[c,u]=(0,l.useState)(``),d=(0,l.useRef)(!1);async function f(){if(!(r||d.current)){d.current=!0,s(!0),u(``);try{let r=await N.nativeJourney.respond.mutate({journeyId:e.journeyId,expectedRevision:e.revision,idempotencyKey:crypto.randomUUID(),action:{kind:`work-access`,workId:t.id,access:`drop`}});n(r.state),r.status===`stale`&&u(`This Work changed. Try again.`)}catch(e){console.error(`UNSORTED_LEAVE_OUT_FAILED`),u(P(e))}finally{d.current=!1,s(!1)}}}let p=t.rootSessionIds.length;return(0,F.jsxs)(`section`,{className:`journey-decision o-top`,"aria-labelledby":`unsorted-${t.id}`,children:[(0,F.jsx)(`p`,{className:`o-k`,children:(0,F.jsx)(`span`,{className:`o-kick`,children:`Unsorted`})}),(0,F.jsxs)(`h3`,{className:`o-head`,id:`unsorted-${t.id}`,tabIndex:-1,children:[Bm(p,`session`),` `,p===1?`fits`:`fit`,` no Work`]}),(0,F.jsxs)(`div`,{className:`o-evidence`,children:[(0,F.jsx)(`ul`,{className:`o-uns`,children:(0,F.jsxs)(`li`,{children:[(0,F.jsx)(`span`,{children:Ga(t)}),(0,F.jsx)(Qm,{view:e,workId:t.id})]})}),(0,F.jsx)(`p`,{className:`o-body o-quiet`,children:`Not sent unless you place it.`})]}),(0,F.jsxs)(`p`,{className:`o-src`,children:[(0,F.jsx)(`span`,{className:`o-source-work`,children:Ga(t)}),(0,F.jsx)(`span`,{className:`o-source-context`,children:`Unsorted`})]}),(0,F.jsx)(`div`,{className:`o-foot o-foot-uns`,children:(0,F.jsxs)(`span`,{className:`o-acts`,children:[(0,F.jsx)(`button`,{type:`button`,className:`o-btn`,disabled:o||r,onClick:()=>void f(),children:`Leave out`}),(0,F.jsx)(`button`,{type:`button`,className:`o-btn`,"data-suggested":!0,"aria-expanded":i,onClick:()=>a(!i),children:`Tell your agent`})]})}),i&&(0,F.jsx)(`p`,{className:`o-hint`,children:`Say in chat which Work it belongs to.`}),c&&(0,F.jsx)(`p`,{role:`alert`,children:c})]})}function s_(e){return e===`hide`?`Hide`:`Keep`}function c_(e,t){let n=/[\p{L}\p{N}_]/u;for(let r=e.indexOf(t);r>=0;r=e.indexOf(t,r+1)){let i=e[r-1],a=e[r+t.length];if((!i||!n.test(i))&&(!a||!n.test(a)))return r}return-1}function l_(e,t){let n=t.normalize(`NFC`).toLowerCase(),r=null;for(let t of e.works)for(let e of[t.localTitle,t.title]){let i=e.normalize(`NFC`).trim().toLowerCase();i&&i.length>(r?.length??0)&&c_(n,i)>=0&&(r={work:t,length:i.length})}return r?.work??null}function u_(e,t){let n=new Set(t.termKeys),r=new Map;for(let t of e.privacy.terms){let e=JSON.stringify([t.type,t.value.normalize(`NFC`)]);n.has(e)&&r.set(e,t.value.normalize(`NFC`))}return[...r].map(([e,t])=>({key:e,value:t}))}function d_(e,t){return new Set(e.termKeys.filter(e=>!t.has(e))).size}async function f_(e,t,n,r){return N.nativeJourney.respond.mutate({journeyId:e.journeyId,expectedRevision:e.revision,idempotencyKey:crypto.randomUUID(),action:{kind:`card-answer`,cardId:t.id,optionId:n,remember:!1,excludedTermKeys:t.termKeys.filter(e=>r.has(e))}})}function p_(e,t){let n=t.filter(t=>t&&e.includes(t)).toSorted((e,t)=>t.length-e.length);if(!n.length)return[e];let r=RegExp(`(${n.map(e=>e.replace(/[.*+?^${}()|[\]\\]/gu,`\\$&`)).join(`|`)})`,`u`),i=new Set;return e.split(r).map((e,t)=>t%2==0||i.has(e)?e:(i.add(e),(0,F.jsx)(`mark`,{children:e},t)))}function m_(e,t){let n=l_(e,t);if(!n)return{work:null,title:t,context:``};let r=[n.localTitle,n.title].map(e=>e.normalize(`NFC`).trim()),i=t.normalize(`NFC`).toLowerCase(),a=r.find(e=>e&&c_(i,e.toLowerCase())>=0)??``,o=c_(i,a.toLowerCase()),s=`${t.slice(0,o)} ${t.slice(o+a.length)}`.replace(/^[\s,·:;-]+|[\s,·:;-]+$/gu,``).replace(/\s+/gu,` `);return{work:n,title:Ga(n),context:s}}var h_=(0,F.jsxs)(`svg`,{viewBox:`0 0 16 16`,width:`13`,height:`13`,"aria-hidden":`true`,children:[(0,F.jsx)(`circle`,{cx:`7`,cy:`7`,r:`5`}),(0,F.jsx)(`path`,{d:`M11 11l3.5 3.5`})]});function g_({card:e,view:t,onState:n,disconnected:r=!1,onSaved:i,onOpen:a,heading:o,inert:s=!1}){let[c,u]=(0,l.useState)(!1),[d,f]=(0,l.useState)(``),[p,m]=(0,l.useState)(``),[h,g]=(0,l.useState)(()=>new Set(e.answer?.excludedTermKeys??[])),_=(0,l.useRef)(!1),v=u_(t,e),y=d_(e,h),b=e.suggestion?.optionId,x=e.suggestion?m_(t,e.suggestion.source):null,S=v.filter(({value:e})=>e.toLowerCase().includes(p.trim().toLowerCase())),C=e.examples[0];function w(e){g(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})}async function T(a){if(!(r||_.current)){_.current=!0,u(!0),f(``);try{let r=await f_(t,e,a,h);n(r.state),r.status===`stale`?f(`The review changed. Check your answer and try again.`):i(r.state,a)}catch(e){console.error(`DECISION_CARD_SAVE_FAILED`),f(P(e))}finally{_.current=!1,u(!1)}}}let E=v.length===1?`value`:`values`;return(0,F.jsxs)(`section`,{className:`journey-decision o-top`,"data-answered":e.answer?!0:void 0,"aria-labelledby":`card-${e.id}`,inert:s||void 0,children:[(0,F.jsx)(`p`,{className:`o-k`,children:(0,F.jsx)(`span`,{className:`o-kick`,children:`Question`})}),(0,F.jsx)(`h3`,{ref:o,tabIndex:-1,className:`o-head`,id:`card-${e.id}`,children:e.question}),C&&(0,F.jsx)(`div`,{className:`o-evidence`,children:(0,F.jsx)(`p`,{className:`o-body`,children:p_(C,v.map(({value:e})=>e))})}),(0,F.jsx)(`div`,{className:`vh`,children:[`hide`,`keep`].map(t=>{let n=e.options.find(e=>e.id===t)?.rule;return n?(0,F.jsxs)(`span`,{id:`card-${e.id}-${t}-rule`,children:[(0,F.jsx)(`strong`,{children:s_(t)}),` · `,n]},t):null})}),x&&(0,F.jsx)(`p`,{className:`o-src`,children:(0,F.jsxs)(`button`,{type:`button`,disabled:!x.work||!a,onClick:()=>x.work&&a?.(x.work.id),children:[(0,F.jsx)(`span`,{className:`o-source-work`,children:x.title}),x.context&&(0,F.jsxs)(`span`,{className:`o-source-context`,children:[` · `,x.context]})]})}),v.length>0&&(0,F.jsxs)(`div`,{className:`o-terms`,children:[(0,F.jsxs)(`label`,{className:`o-tsearch`,children:[h_,(0,F.jsx)(`input`,{type:`search`,"aria-label":`Search ${E}`,placeholder:`${v.length} ${E}`,value:p,onChange:e=>m(e.currentTarget.value)})]}),(0,F.jsx)(`i`,{className:`o-trule`,"aria-hidden":`true`}),(0,F.jsx)(`div`,{className:`o-tchips`,role:`group`,"aria-label":`${E}, the selected ones take your answer`,children:S.length?S.map(({key:e,value:t})=>(0,F.jsx)(`button`,{type:`button`,className:`o-tchip`,"aria-pressed":!h.has(e),title:h.has(e)?`Left out. Tap to select`:`Selected. Tap to leave it out`,disabled:c||r,onClick:()=>w(e),children:t},e)):(0,F.jsx)(`span`,{className:`o-tnone`,children:`No match`})})]}),(0,F.jsxs)(`div`,{className:`o-foot journey-card-actions`,children:[v.length>0&&(0,F.jsxs)(`p`,{className:`o-sel`,children:[(0,F.jsx)(`span`,{className:`o-selc`,role:`status`,children:c?`Saving…`:`${y} of ${v.length} selected`}),(0,F.jsx)(`button`,{type:`button`,className:`o-tall`,disabled:c||r,onClick:()=>g(y?new Set(v.map(({key:e})=>e)):new Set),children:y?`Clear`:`Select all`})]}),(0,F.jsx)(`span`,{className:`o-acts`,children:[`keep`,`hide`].map(t=>(0,F.jsx)(`button`,{type:`button`,className:`o-btn o-ans`,"data-suggested":b===t||void 0,disabled:c||r||y===0,"aria-pressed":e.answer?.optionId===t,"aria-describedby":e.options.find(e=>e.id===t)?.rule?`card-${e.id}-${t}-rule`:void 0,onClick:()=>void T(t),children:s_(t)},t))})]}),d&&(0,F.jsx)(`p`,{role:`alert`,children:d})]})}var __=e=>Math.min(6e3,Math.max(2500,1e3+50*e)),v_=e=>(0,F.jsxs)(`svg`,{viewBox:`0 0 16 16`,width:`16`,height:`16`,"aria-hidden":`true`,children:[(0,F.jsx)(`path`,{d:`M1.5 8s2.4-4.5 6.5-4.5S14.5 8 14.5 8 12.1 12.5 8 12.5 1.5 8 1.5 8Z`}),(0,F.jsx)(`circle`,{cx:`8`,cy:`8`,r:`2`}),e&&(0,F.jsx)(`path`,{d:`M2.5 13.5 13.5 2.5`})]});function y_({view:e,onState:t,onOpen:n,reopened:r=null,onReopened:i,disconnected:a=!1}){let o=e.privacy.cards,s=(0,l.useRef)(null),[c,u]=(0,l.useState)(null),[d,f]=(0,l.useState)([]),p=(0,l.useRef)(0);(0,l.useEffect)(()=>{r&&s.current?.focus()},[r]),(0,l.useEffect)(()=>{if(!c)return;let e=setTimeout(()=>u(null),220);return()=>clearTimeout(e)},[c]);let m=[`sending`,`completed`].includes(e.phase),h=(0,l.useRef)(!1),g=!m&&o.find(e=>e.id===r)||(m?void 0:o.find(e=>e.answer===null)),_=!g&&!m?a_(e):void 0,v=g?.id;(0,l.useEffect)(()=>{h.current&&v&&(h.current=!1,s.current?.focus({preventScroll:!0}))},[v]);function y(e,t,n){u({card:e,side:n});let{values:a,projects:o}=Vm(t,t.privacy.cards.find(t=>t.id===e.id)??e),s=`${Bm(a,`value`)} ${n===`keep`?`kept`:`hidden`}`,c=o?` in ${Bm(o,`project`)}`:``,l={id:p.current+=1,optionId:n,text:{strong:s,rest:c}};f(e=>[l,...e].slice(0,3));let d=__(s.length+c.length);setTimeout(()=>f(e=>e.map(e=>e.id===l.id?{...e,leaving:!0}:e)),d-140),setTimeout(()=>f(e=>e.filter(e=>e.id!==l.id)),d),e.id===r?i?.():h.current=!0}return(0,F.jsxs)(F.Fragment,{children:[d.length>0&&(0,F.jsx)(`ol`,{className:`o-toasts`,"aria-live":`polite`,children:d.map((e,t)=>(0,F.jsxs)(`li`,{className:`o-toast`,"data-option":e.optionId,"data-depth":t,"data-leaving":e.leaving||void 0,children:[v_(e.optionId===`hide`),(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`b`,{children:e.text.strong}),e.text.rest]})]},e.id))}),(g||c||_)&&(0,F.jsx)(`section`,{className:`o-deck`,"aria-label":`Needs a look`,children:(0,F.jsxs)(`div`,{className:`o-stack`,children:[(0,F.jsx)(`i`,{className:`o-back`,"data-p":`2`,"aria-hidden":`true`}),(0,F.jsx)(`i`,{className:`o-back`,"data-p":`1`,"aria-hidden":`true`}),g&&(0,F.jsx)(g_,{card:g,view:e,onState:t,disconnected:a,heading:s,onOpen:n,onSaved:(e,t)=>y(g,e,t)},g.id),!g&&_&&(0,F.jsx)(o_,{view:e,work:_,onState:t,disconnected:a},_.id),c&&(0,F.jsx)(`div`,{className:`o-leave`,"data-side":c.side,"aria-hidden":`true`,children:(0,F.jsx)(g_,{card:c.card,view:e,onState:t,inert:!0,onSaved:()=>{}})})]})})]})}function b_(e){let t=e.works.filter(Ra);if(!e.snapshotId||e.scope.status!==`confirmed`||!t.length||t.some(e=>e.status===`pending`))return null;let n=t.reduce((e,t)=>e+t.totalBatches,0),r=t.reduce((e,t)=>e+t.completedBatches,0);return n?r===n&&!e.readingComplete?null:Math.floor(r/n*100):e.readingComplete?100:null}function x_(e){let t=e.works.filter(Ia);return e.scope.status===`confirmed`&&e.phase!==`paused`&&t.some(e=>e.status===`pending`)&&!t.every(t=>Ja(e,t))&&b_(e)===null}function S_(e){if(e.classificationProgress?.status===`failed`)return`Classification stopped. Ask your agent to retry.`;if(e.phase===`paused`)return`Paused. Progress is saved.`;if(e.classificationProgress?.status===`running`&&!Wa(e)||e.snapshotId&&e.scope.status===`pending`&&e.classificationRevision===null)return`Classifying your conversations.`;if(e.phase===`discovering`||!e.works.length)return`Finding your conversations.`;if(e.scope.status!==`confirmed`)return e.classificationRevision===null?`Organizing your conversations before privacy scanning.`:`Privacy scanning starts on its own. You can change any Work’s visibility at any time.`;let t=e.works.filter(Ia);if(!t.length)return e.works.length?`No Works selected.`:`Finding your conversations.`;if(t.every(t=>Ja(e,t)))return`Ready for privacy scanning. Waiting for your agent to start.`;if(t.some(e=>e.status===`pending`))return t.some(e=>e.totalBatches>e.completedBatches)||Fa(e).some(e=>[`running`,`awaiting-validation`,`ready-to-submit`].includes(e.status))?`Static scanning and AI review are in progress.`:`Preparing static scans.`;if(b_(e)===null&&t.some(e=>e.status===`blocked`))return e.privacy.packageApproval?`Some Works could not be packaged. Review the error and retry packaging.`:`Some Works could not be processed. Retry or Drop them.`;if(b_(e)===null)return`Organizing your conversations.`;if(!Va(e))return Ma(Fa(e).filter(e=>[`unknown`,`failed`,`blocked`].includes(e.status)))??(e.readingComplete?`Reviewing Work details.`:`AI privacy scanning.`);if(e.phase===`sending`||e.phase===`completed`)return`See Send status below.`;let n=t.filter(Ra);return n.some(t=>Ka(e,t)===`Processing failed`)?`Some Works could not be processed. Retry or Drop them.`:Ba(e).some(e=>e.disposition===`pending`)?e.privacy.cards.length?e.privacy.cards.some(e=>!e.answer)?`Answer the privacy decision cards.`:`Applying your answers to the remaining values.`:`Preparing decision cards for uncertain values.`:Ha(e)?e.privacy.packageApproval?n.every(e=>e.artifact?.revision===e.revision)?`Packages are ready. Review the Send scope below.`:`Packaging your confirmed Works.`:`Ready to send.`:`Finishing the full static protection pass.`}function C_(e){let t=e.classificationProgress;if(t?.status===`failed`||e.phase===`paused`)return{text:S_(e)};if(e.scope.status===`pending`){if(Wa(e))return null;let n=t?.rootIds.length??0;return n>0?{verb:`Grouping`,object:`${Bm(n,`session`)} into Works`}:{verb:`Listing`,object:`session files`}}if(e.phase===`discovering`||!e.snapshotId&&!e.works.length)return{verb:`Listing`,object:`session files`};let n=e.works.filter(Ia);if(n.length&&n.every(t=>Ja(e,t)))return{text:S_(e)};let r=Ma(Fa(e).filter(e=>[`unknown`,`failed`,`blocked`].includes(e.status)));if(r)return{text:r};let i=S_(e);return/could not be/u.test(i)?{text:i}:x_(e)?null:n.length&&b_(e)===null?{text:i}:null}function w_({children:e=null}){return(0,F.jsxs)(`section`,{className:`now`,"aria-label":`Now`,children:[(0,F.jsx)(`p`,{className:`now-k`,children:(0,F.jsx)(`span`,{className:`tc-kicker`,children:`Now`})}),(0,F.jsx)(`p`,{className:`now-t`,children:`Nothing needs a look`}),(0,F.jsx)(`div`,{className:`now-b`,children:(0,F.jsx)(`p`,{className:`say`,children:`New things land here as Works are read.`})}),e]})}function T_({view:e}){if([`sending`,`completed`].includes(e.phase))return null;let t=b_(e),n=C_(e),r=e.classificationProgress?.status===`failed`||e.phase===`paused`,i=e.phase===`discovering`||!e.snapshotId&&!e.works.length,a=e.scope.status===`pending`&&!Wa(e)&&!r||i||x_(e),o=e.scope.status===`pending`?`Classification progress`:`Reading progress`;return!a&&t===null&&!n?null:(0,F.jsxs)(`section`,{className:`prog`,"aria-label":`Progress`,children:[(a||t!==null)&&(0,F.jsxs)(`div`,{className:`barline`,children:[(0,F.jsx)(`progress`,{className:`tc-bar`,"aria-label":o,value:a?void 0:t??void 0,max:100}),!a&&(0,F.jsxs)(`span`,{children:[t,`%`]})]}),n&&(0,F.jsx)(`p`,{className:`now-cap`,role:`status`,children:`text`in n?(0,F.jsx)(`span`,{children:n.text}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`span`,{className:`now-v`,children:n.verb}),(0,F.jsx)(`b`,{className:`now-w`,children:n.object})]})})]})}var E_=15e3;function D_({journeyId:e,done:t,needed:n}){let[r,i]=(0,l.useState)(null),[a,o]=(0,l.useState)(()=>Date.now());(0,l.useEffect)(()=>{if(t)return;let n=!0,r=()=>void N.nativeJourney.presence.query({journeyId:e}).then(e=>{n&&(i(e.agent?.at??null),o(Date.now()))}).catch(()=>{});r();let a=setInterval(r,E_);return()=>{n=!1,clearInterval(a)}},[e,t]);let s=t?null:to(r,a,n);return s?(0,F.jsx)(`span`,{className:`tc-agent`,"data-state":s.state,role:`status`,children:s.text}):null}var O_=[{id:`google`,label:`Sign in with Google`},{id:`github`,label:`Sign in with GitHub`}],k_=new Intl.Segmenter(void 0,{granularity:`grapheme`}),A_=e=>e.trim().split(/\s+/u).slice(0,2).map(e=>k_.segment(e).containing(0)?.segment??``).join(``).toUpperCase()||`U`;function j_({id:e}){return e===`google`?(0,F.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`18`,height:`18`,"aria-hidden":`true`,fill:`none`,strokeWidth:`3.6`,children:[(0,F.jsx)(`path`,{stroke:`#ea4335`,d:`M17.66 6.34A8 8 0 0 0 4.48 9.26`}),(0,F.jsx)(`path`,{stroke:`#fbbc05`,d:`M4.48 9.26a8 8 0 0 0 0 5.48`}),(0,F.jsx)(`path`,{stroke:`#34a853`,d:`M4.48 14.74a8 8 0 0 0 13.65 2.4`}),(0,F.jsx)(`path`,{stroke:`#4285f4`,d:`M18.13 17.14A8 8 0 0 0 20 12h-8`})]}):(0,F.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`18`,height:`18`,"aria-hidden":`true`,children:(0,F.jsx)(`path`,{fill:`currentColor`,fillRule:`evenodd`,d:`M12 1a11 11 0 1 1 0 22 11 11 0 0 1 0-22ZM7.6 9.2 7.4 6.2l2.2 1.4q2.4-.6 4.8 0l2.2-1.4-.2 3q1.2 1.4.6 3.6-.8 2.4-3.6 2.6l.2.6v4.6h-3.2v-2q-2.4.4-3.2-1.4 1.2.4 1.8.4 1 0 1.4-1l.2-1.2q-2.8-.2-3.6-2.6-.6-2.2.6-3.6Z`})})}function M_({account:e,busy:t,disabled:n,onAllow:r}){let i=e.view,a=i?.state??null,o=a===`authorizing`||a===`starting-sign-in`,[s,c]=(0,l.useState)(null),[u,d]=(0,l.useState)(!1),[f,p]=(0,l.useState)(o),[m,h]=(0,l.useState)(null);o!==f&&(p(o),!o&&a===`signed-out`&&h(i?.lastError?{text:Xh(i.lastError),alert:!0}:{text:Zh,alert:!1}),o&&h(null));let g=(0,l.useRef)(!1),_=(0,l.useRef)(null),v=(0,l.useRef)(r);(0,l.useEffect)(()=>{v.current=r}),(0,l.useEffect)(()=>{g.current&&(a===`signed-in`?(g.current=!1,u||v.current()):a===`signed-out`&&!e.busy&&(g.current=!1,_.current?.focus()))},[a,u,e.busy]);function y(t){g.current=!0,c(t),e.signIn(t)}let b=e=>(0,F.jsxs)(`p`,{className:`f-disc`,children:[`By `,e,`, Tacitt reads your sessions through the model your agent already uses.`]}),x=m&&(0,F.jsx)(`p`,{role:m.alert?`alert`:`status`,className:`welcome-message`,children:m.text});if(i?.state===`signed-in`)return(0,F.jsxs)(`section`,{className:`welcome-auth`,"aria-label":`Account sign-in`,children:[(0,F.jsxs)(`div`,{className:`welcome-account`,children:[(0,F.jsxs)(`p`,{children:[`Signed in as`,(0,F.jsx)(`span`,{className:`welcome-avatar`,"aria-hidden":`true`,children:i.avatarUrl?(0,F.jsx)(`img`,{src:i.avatarUrl,alt:``,referrerPolicy:`no-referrer`}):A_(i.displayName)}),(0,F.jsx)(`strong`,{children:i.displayName})]}),(0,F.jsx)(`button`,{type:`button`,className:`welcome-text-action`,disabled:e.busy||t,onClick:()=>{d(!0),e.signOut()},children:`Switch account`})]}),(0,F.jsxs)(`p`,{className:`btns`,children:[(0,F.jsx)(`button`,{className:`tc-btn primary welcome-go`,type:`button`,disabled:t||n,onClick:r,children:t?`Starting…`:u?`Allow to continue`:`Continue`}),(0,F.jsx)(`span`,{className:`say quiet`,children:`or say yes in chat`})]}),b(`continuing`)]});if(i&&i.configuration.clientId===null)return(0,F.jsxs)(`section`,{className:`welcome-auth`,"aria-label":`Start`,children:[(0,F.jsxs)(`p`,{className:`btns`,children:[(0,F.jsx)(`button`,{className:`tc-btn primary welcome-go`,type:`button`,disabled:t||n,onClick:r,children:t?`Starting…`:`Continue`}),(0,F.jsx)(`span`,{className:`say quiet`,children:`or say yes in chat`})]}),(0,F.jsxs)(`p`,{className:`say quiet`,children:[`Sending needs sign-in, which is not configured in this build. Set`,` `,(0,F.jsx)(`code`,{children:`SESS_PILOT_IDENTITY_CLIENT_ID`}),` before starting the agent to sign in.`]}),b(`continuing`)]});let S=i?.state===`authorizing`?i.userCode:null;return(0,F.jsxs)(`section`,{className:`welcome-auth`,"aria-label":`Account sign-in`,children:[(0,F.jsx)(`div`,{className:`welcome-providers`,role:`group`,"aria-label":`Sign-in methods`,children:O_.map((t,r)=>{let a=o&&s===t.id;return(0,F.jsxs)(`button`,{ref:r===0?_:void 0,type:`button`,className:`tc-btn welcome-provider`,"data-pending":a||void 0,"aria-label":a?`Signing you in…`:void 0,disabled:!i||e.busy||n||o&&!a,onClick:()=>y(t.id),children:[a?(0,F.jsx)(`i`,{className:`welcome-spinner`,"aria-hidden":`true`}):(0,F.jsx)(j_,{id:t.id}),(0,F.jsx)(`span`,{children:t.label})]},t.id)})}),u&&!o?(0,F.jsx)(`p`,{className:`f-disc`,children:`Sign in to switch accounts. You’ll confirm access before any sessions are read.`}):b(`signing in`),x,o&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`welcome-message`,role:`status`,children:[S?`Approve code ${S.length===8?`${S.slice(0,4)}-${S.slice(4)}`:S} on the sign-in page.`:`Opening the sign-in page…`,` `,i?.state===`authorizing`&&!e.approvalOpened&&(0,F.jsx)(`a`,{href:ha(i.verificationUriComplete,s),target:`_blank`,rel:`noopener noreferrer`,children:`Open sign-in page`})]}),(0,F.jsx)(`button`,{type:`button`,className:`welcome-text-action welcome-cancel`,disabled:e.busy,onClick:()=>{g.current=!1,e.cancel()},children:`Cancel sign-in`})]})]})}var N_=[[`You sign in to start`],[`We find your sessions`,`Names, folders, dates and content`],[`We hide private details`,`You answer a few questions in chat`],[`You review each Work`],[`You send it to your Tacitt profile`]];function P_(){return(0,F.jsx)(`svg`,{className:`f-tk`,viewBox:`0 0 16 16`,"aria-hidden":`true`,children:(0,F.jsx)(`path`,{d:`M3 8.5l3.2 3L13 4.5`})})}async function F_(e){return(await N.nativeJourney.respond.mutate({journeyId:e.journeyId,expectedRevision:e.revision,idempotencyKey:crypto.randomUUID(),action:{kind:`consent`,allow:!0}})).state}function I_({view:e,account:t,connection:n=``,onState:r}){let[i,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(!1),[c,u]=(0,l.useState)(``),d=(0,l.useRef)(!1);async function f(){if(!(n||d.current)){d.current=!0,s(!0),u(``);try{r(await F_(e))}catch(e){console.error(`JOURNEY_CONSENT_FAILED`),u(P(e))}finally{d.current=!1,s(!1)}}}return(0,F.jsxs)(`section`,{className:`journey-welcome`,children:[(0,F.jsxs)(`div`,{className:`ob-hero tc-dither`,children:[(0,F.jsxs)(`h1`,{children:[(0,F.jsx)(`span`,{className:`welcome-accent`,children:`Stay Tacitt.`}),(0,F.jsx)(`br`,{}),`Your sessions talk.`]}),(0,F.jsx)(`p`,{className:`tag-sub`,children:`Every prompt. Every fix. Every call you made.`})]}),(0,F.jsxs)(`ul`,{className:`f-prom`,"aria-label":`Our promises`,children:[(0,F.jsxs)(`li`,{children:[(0,F.jsx)(P_,{}),(0,F.jsx)(`span`,{children:`No sessions are sent to Tacitt until you press Send.`})]}),(0,F.jsxs)(`li`,{children:[(0,F.jsx)(P_,{}),(0,F.jsx)(`span`,{children:`Keys and personal details are hidden first.`}),(0,F.jsx)(`div`,{className:`kk-w`,children:(0,F.jsx)(Gm,{compact:!0})})]}),(0,F.jsxs)(`li`,{children:[(0,F.jsx)(P_,{}),(0,F.jsx)(`span`,{children:`You choose Public, Private or Drop for each Work.`})]})]}),(0,F.jsxs)(`button`,{className:`f-how`,type:`button`,"aria-expanded":i,"aria-controls":`journey-how`,onClick:()=>a(!i),children:[(0,F.jsx)(`span`,{children:`How it works`}),(0,F.jsx)(`i`,{"aria-hidden":`true`})]}),(0,F.jsx)(`div`,{className:`f-more`,id:`journey-how`,"aria-hidden":!i,inert:!i,children:(0,F.jsx)(`div`,{children:(0,F.jsx)(`ol`,{className:`flist`,children:N_.map(([e,t],n)=>(0,F.jsxs)(`li`,{children:[(0,F.jsx)(`span`,{className:`no`,children:String(n+1).padStart(2,`0`)}),(0,F.jsxs)(`span`,{className:`f-line`,children:[(0,F.jsx)(`span`,{children:e}),t&&(0,F.jsx)(`small`,{children:t})]})]},e))})})}),(0,F.jsxs)(`div`,{className:`ob-start`,children:[n&&(0,F.jsx)(`p`,{role:`status`,className:`journey-connection`,children:n}),(0,F.jsx)(M_,{account:t,busy:o,disabled:!!n,onAllow:()=>void f()}),c&&(0,F.jsx)(`p`,{role:`alert`,className:`welcome-message`,children:c})]})]})}function L_(e){return e?.hasAttribute(`data-scaled`)?e.scrollTop:window.scrollY}function R_(e,t){e?.hasAttribute(`data-scaled`)?e.scrollTo(0,t):window.scrollTo(0,t)}function z_(e){let t=(0,l.useRef)(null);return(0,l.useLayoutEffect)(()=>{let n=t.current,r=n?.parentElement;if(!n||!r)return;let i=!1,a=0;function o(){n&&(delete n.dataset.scaled,n.style.width=``,n.style.height=``,n.style.transform=``)}function s(){if(n&&r){if(e&&r.clientWidth>640){let e=i?null:window.scrollY;n.dataset.scaled=``;let t=640+n.offsetWidth-n.clientWidth,a=r.clientWidth/t;n.style.width=`${t}px`,n.style.height=`${r.clientHeight/a}px`,n.style.transform=`scale(${a})`,i=!0,e!==null&&(n.scrollTop=e,document.activeElement===document.body&&n.focus({preventScroll:!0}))}else if(i){let e=n.scrollTop;o(),i=!1,window.scrollTo(0,e)}}}let c=new ResizeObserver(()=>{cancelAnimationFrame(a),a=requestAnimationFrame(s)});return c.observe(r),c.observe(n),s(),()=>{if(cancelAnimationFrame(a),c.disconnect(),i){let e=n.scrollTop;o(),window.scrollTo(0,e)}}},[e]),t}var B_=e=>{},V_=450;function H_({view:e,connection:t=``,onState:n=B_}){let r=va(),i=!!(e&&Ua(e)),a=z_(!0),o=(0,l.useRef)(null),[s,c]=(0,l.useState)(null),u=!!(e&&[`sending`,`completed`].includes(e.phase)),d=e&&Wa(e)&&!u?e.works.find(e=>e.id===s):void 0,f=!!(e?.consent&&!d&&e.works.some(Ra)&&(i||[`sending`,`completed`].includes(e.phase)||e.privacy.packageApproval&&e.works.filter(Ra).every(yh))),[p,m]=(0,l.useState)(null),[h,g]=(0,l.useState)(null);e&&!e.consent&&p!==e&&m(e),e?.consent&&p&&(g(p),m(null)),(0,l.useEffect)(()=>{if(!h)return;let e=setTimeout(()=>g(null),V_);return()=>clearTimeout(e)},[h]);let _=!!(e&&[`sending`,`completed`].includes(e.phase)),v=i&&!e?.works.some(Ra),y=e&&!f&&!v?Hg(e,r):null,[b,x]=(0,l.useState)(null),[S,C]=(0,l.useState)(0),w=(0,l.useRef)(0),T=(0,l.useRef)(null),E=(0,l.useRef)(null);(0,l.useEffect)(()=>{if(E.current!==s){if(R_(a.current,s?0:w.current),s)o.current?.querySelector(`h1`)?.focus({preventScroll:!0});else if(T.current){let e=o.current?.querySelector(`[data-work-id="${CSS.escape(T.current)}"]`);e instanceof HTMLButtonElement&&e.focus({preventScroll:!0})}E.current=s}},[a,s]);function ee(t){e&&Wa(e)&&!u&&(w.current=L_(a.current),T.current=t,c(t))}return(0,F.jsxs)(`div`,{ref:a,className:`native-panel`,tabIndex:-1,children:[(0,F.jsxs)(`header`,{className:`tc-head`,children:[(0,F.jsx)(`span`,{className:`tc-logo`,children:`tacitt`}),e?.consent&&(0,F.jsx)(D_,{journeyId:e.journeyId,done:e.phase===`completed`,needed:eo.includes(e.phase)}),(0,F.jsx)($h,{account:r,offeredInPage:!(!e||e.consent)})]}),(0,F.jsxs)(`main`,{className:`native-journey`,children:[(0,F.jsx)(eg,{account:r,inSend:f||!(!e||e.consent)}),e?e.consent?(0,F.jsxs)(F.Fragment,{children:[h&&(0,F.jsx)(`div`,{className:`fold`,"data-fold":`out`,inert:!0,"aria-hidden":`true`,children:(0,F.jsx)(`div`,{children:(0,F.jsx)(I_,{view:h,account:r,onState:B_})})}),(0,F.jsxs)(`div`,{ref:o,className:h?`fold`:void 0,"data-fold":h?`in`:void 0,children:[t&&(0,F.jsx)(`p`,{role:`status`,className:`journey-connection`,children:t}),d?(0,F.jsx)(vh,{view:e,work:d,onState:n,onBack:()=>{c(null),C(e=>e+1)},disconnected:!!t}):(0,F.jsxs)(`div`,{className:S?`page-back`:void 0,children:[y===`address`?(0,F.jsx)(qg,{view:e,account:r,onState:n,disconnected:!!t}):y===`links`?(0,F.jsx)(Jg,{view:e,onState:n,disconnected:!!t}):(0,F.jsx)(y_,{view:e,onState:n,onOpen:ee,reopened:b,onReopened:()=>x(null),disconnected:!!t}),f&&(0,F.jsx)(i_,{account:r,journey:e,connection:t,onState:n}),!u&&!y&&(f||_||!e.privacy.cards.some(e=>e.answer===null||e.id===b)&&!a_(e))&&(0,F.jsx)(mh,{view:e,onState:n,disconnected:!!t,fallback:f?null:e=>(0,F.jsx)(w_,{children:e}),skippedOnly:f}),(0,F.jsx)(T_,{view:e}),!u&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(Zm,{view:e,onChangeAnswer:x}),(0,F.jsx)(lg,{view:e,onOpen:ee,onState:n,disconnected:!!t}),!e.works.length&&(0,F.jsx)(`p`,{className:`journey-muted pr-note`,children:`Works will appear here as they are found.`})]})]},S)]})]}):(0,F.jsx)(I_,{view:e,account:r,connection:t,onState:n}):(0,F.jsx)(`p`,{role:`status`,className:`journey-connection`,children:t||`Connecting to your local session…`})]})]})}function U_(){let e=ka(new URLSearchParams(location.search).get(`journey`)??``);return(0,F.jsx)(H_,{view:e.view,connection:e.connection,onState:e.accept})}function W_(){let e=new URLSearchParams(location.search).get(`view`);return e===`results`||e===`skill`?e:`review`}function G_(){let[e,t]=(0,l.useState)(W_);return(0,l.useEffect)(()=>{let e=()=>t(W_());return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),e===`skill`?(0,F.jsx)(U_,{}):(0,F.jsx)(K_,{})}function K_(){let e=dr(),t=va(),{current:n}=e,[r,i]=(0,l.useState)(W_),a=(0,l.useRef)(null),o=(0,l.useRef)(!0);(0,l.useEffect)(()=>{let e=()=>i(W_());return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),(0,l.useEffect)(()=>{if(!n)return;let e=n?.phase===`completed`?n.artifact?.bundleId:null;if(o.current&&(o.current=!1,e&&new URLSearchParams(location.search).has(`view`))){a.current=e;return}if(!e||e===a.current)return;a.current=e;let t=new URL(location.href);t.searchParams.set(`view`,`results`),history.replaceState(null,``,t.pathname+t.search),i(W_()),window.dispatchEvent(new PopStateEvent(`popstate`))},[n]);function s(e){let t=new URL(location.href);t.searchParams.set(`view`,e),history.pushState(null,``,t.pathname+t.search),i(e)}return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`header`,{children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`span`,{className:`brand`,children:`tacitt`}),(0,F.jsx)(`p`,{children:`Review local sessions. Confirm what leaves your workspace.`})]}),(0,F.jsxs)(`div`,{className:`header-actions`,children:[(0,F.jsx)(`span`,{className:`local`,children:`Local collection`}),!e.stopped&&(0,F.jsx)(Sa,{account:t})]})]}),(0,F.jsxs)(`main`,{children:[(0,F.jsx)(`h1`,{children:`Collect session logs`}),!e.stopped&&(0,F.jsx)(wa,{account:t}),n&&!e.stopped&&(0,F.jsxs)(`nav`,{className:`actions main-views`,"aria-label":`Main views`,children:[(0,F.jsx)(`button`,{type:`button`,"aria-current":r===`review`?`page`:void 0,onClick:()=>s(`review`),children:`Review and package`}),(0,F.jsx)(`button`,{type:`button`,"aria-current":r===`results`?`page`:void 0,disabled:!n.operation&&!n.artifact&&!n.hasBaseline,onClick:()=>s(`results`),children:`Bundle results`})]}),e.stopped?(0,F.jsxs)(`section`,{role:`status`,children:[(0,F.jsx)(`h2`,{children:`Progress saved`}),(0,F.jsx)(`p`,{children:`The CLI has stopped. Start it again when you are ready to continue.`})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{className:`connection`,role:`status`,children:e.connection}),e.error&&(0,F.jsxs)(`div`,{className:`error`,role:`alert`,children:[(0,F.jsx)(`p`,{children:e.error}),(0,F.jsx)(`button`,{type:`button`,onClick:e.reconnect,children:`Reload current state`})]}),!n&&(0,F.jsxs)(`section`,{children:[(0,F.jsx)(`p`,{children:`Waiting for the authorized CLI to load the current approval.`}),(0,F.jsx)(`p`,{children:`Use the complete access URL printed in your terminal. A new CLI instance has a new access URL.`})]}),n&&r===`results`&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(fa,{current:n,connected:e.connected}),(0,F.jsx)(Gh,{current:n,account:t,onSave:()=>void e.saveAndExit(),saveDisabled:e.busy||n.phase===`packaging`})]}),n&&r===`review`&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(fa,{current:n,connected:e.connected}),(0,F.jsx)(hr,{items:n.warnings}),(0,F.jsx)(ca,{current:n,workflow:e},`method-${n.runId}`),n.methodChosen&&(0,F.jsxs)(F.Fragment,{children:[n.treatmentMode===`configured`&&(0,F.jsx)(hi,{current:n,workflow:e,scope:{scope:`overall`}}),(0,F.jsx)(Ni,{current:n,workflow:e,scope:{scope:`overall`}}),(0,F.jsx)(Xi,{current:n,workflow:e},`${n.runId}:${n.inventoryGeneration}`),(0,F.jsx)(Qi,{current:n,workflow:e},n.runId)]}),(0,F.jsx)(sa,{current:n,workflow:e},n.runId),(0,F.jsx)(pr,{current:n,workflow:e}),(0,F.jsx)(pa,{})]})]})]}),(0,F.jsx)(`footer`,{children:`All collection actions are controlled by the foreground CLI.`})]})}var q_=document.getElementById(`root`);if(!q_)throw Error(`The application root is missing.`);(0,u.createRoot)(q_).render((0,l.createElement)(G_));
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <meta name="referrer" content="no-referrer" />
7
7
  <title>tacitt · Local session collection</title>
8
- <script type="module" crossorigin src="./assets/index-B6kJ6XXF.js"></script>
8
+ <script type="module" crossorigin src="./assets/index-9UfCT_2C.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="./assets/index-CYJBq1px.css">
10
10
  </head>
11
11
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitroll/tacitt-cli",
3
- "version": "0.6.7",
3
+ "version": "0.6.9",
4
4
  "description": "Private local session review and export for coding agents",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {