vibe64 0.1.47 → 0.1.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/run.js +1734 -1687
- package/bin/server.js +75 -75
- package/bin/upgrade-state.js +4539 -4471
- package/dist/assets/GithubBrowserTabs-BwpiRS2u.js +1 -0
- package/dist/assets/{LocalDatabaseServer-6VzPWZxG.js → LocalDatabaseServer-u_Ky7bNS.js} +1 -1
- package/dist/assets/{Vibe64AuthSettingsButton-TLwqAxDo.js → Vibe64AuthSettingsButton-BCwswT1G.js} +1 -1
- package/dist/assets/{Vibe64DashboardShell-B4dQ-oHD.js → Vibe64DashboardShell-CWlgrR2B.js} +1 -1
- package/dist/assets/{Vibe64DatabaseWorkspace-Bh5WIPOj.js → Vibe64DatabaseWorkspace-Dhs8_H0P.js} +1 -1
- package/dist/assets/Vibe64OutputControls-Dn548CZa.js +8 -0
- package/dist/assets/{Vibe64RepositoryWorkspace-idDg94lc.js → Vibe64RepositoryWorkspace-C-8S4JUF.js} +1 -1
- package/dist/assets/{Vibe64SessionFiles-Z9zxosyl.js → Vibe64SessionFiles-Cx6J7DDN.js} +2 -3
- package/dist/assets/{Vibe64UiStoryboardView-CrCDWMdR.js → Vibe64UiStoryboardView-DHyhJiWS.js} +1 -1
- package/dist/assets/{Vibe64UnavailableSessions-TqsxvGSf.js → Vibe64UnavailableSessions-Da4RxIhA.js} +1 -1
- package/dist/assets/{_sessionId_-7F1VGOou.js → _sessionId_-DCpgDPSI.js} +1 -1
- package/dist/assets/_slug_-BbEWp01a.js +25 -0
- package/dist/assets/{_slug_-B16mTWjj.css → _slug_-DerKOisL.css} +1 -1
- package/dist/assets/{access-Cx9RH95J.js → access-D4di2sCr.js} +1 -1
- package/dist/assets/{app-DPx4KKOa.js → app-Adr9Iz8p.js} +1 -1
- package/dist/assets/asyncModuleRecovery-DJsn5NrL.js +1 -0
- package/dist/assets/{changes-DYsuQLFW.js → changes-3Dd1O8Lu.js} +1 -1
- package/dist/assets/client-BAXHGUOC.js +1 -0
- package/dist/assets/{client-BYsDPxR3.js → client-CCZIu6yc.js} +1 -1
- package/dist/assets/{conversation-3ln-WnbL.css → conversation-CSDHdGDb.css} +1 -1
- package/dist/assets/conversation-DG9lp25w.js +8 -0
- package/dist/assets/conversation-ErAO1CmH.js +13 -0
- package/dist/assets/{dashboard-CWswAbYP.js → dashboard-0tCzDYCX.js} +1 -1
- package/dist/assets/english-definitions-DeiQ-jTT.js +1 -0
- package/dist/assets/env-DsyQ2MFX.js +1 -0
- package/dist/assets/{health-C0f6s-G1.js → health-DyTXU-nb.js} +1 -1
- package/dist/assets/{history-BQjETNB9.js → history-BXGAdPMI.js} +1 -1
- package/dist/assets/{incoming-COpY201m.js → incoming-yajkdGBY.js} +1 -1
- package/dist/assets/{index-MWACm8Pp.css → index-B-dukXUB.css} +1 -1
- package/dist/assets/index-CGz4Yow6.js +136 -0
- package/dist/assets/{integrations-BBkvNRHu.js → integrations-BMrXET36.js} +10 -2
- package/dist/assets/issues-kc1XBZCK.js +1 -0
- package/dist/assets/{learning-B8_wHoe1.js → learning-CIE5ghYv.js} +1 -1
- package/dist/assets/linkPath-Ch9eft18.js +1 -0
- package/dist/assets/{placement-DXvgK433.js → placement-BNmlke_j.js} +1 -1
- package/dist/assets/placement-DYM3JJ-F.js +1 -0
- package/dist/assets/publish-DTh6amqi.js +3 -0
- package/dist/assets/pull-requests-CbfGSSIh.js +1 -0
- package/dist/assets/{repository-BNPt7UWc.js → repository-BstMh-bG.js} +1 -1
- package/dist/assets/settings-Bf8C6dls.js +1 -0
- package/dist/assets/{studioGateApi-BVdclhPL.js → studioGateApi-mkX1eOTX.js} +1 -1
- package/dist/assets/{studioUrls-CGKCbM_d.js → studioUrls-B0-GdWh8.js} +1 -1
- package/dist/assets/useArchivedVibe64Sessions-DIOpfUxD.js +1 -0
- package/dist/assets/useCommand-CVuya6vG.js +1 -0
- package/dist/assets/useEndpointResource-7-YDfAxX.js +1 -0
- package/dist/assets/usePaths-Y6UuQxmI.js +1 -0
- package/dist/assets/{useUiFeedback-B51xtCAK.js → useUiFeedback-Bd3rao6E.js} +1 -1
- package/dist/assets/useVibe64ConversationLog-ChJOU2SD.js +1 -0
- package/dist/assets/{useVibe64DatabaseTools-BE_yXZFn.js → useVibe64DatabaseTools-DKV-TeNJ.js} +1 -1
- package/dist/assets/{useVibe64ProjectScope-D7b8n1gx.js → useVibe64ProjectScope-DXjsKKhl.js} +1 -1
- package/dist/assets/useVibe64SessionData-BkIHUrP5.js +1 -0
- package/dist/assets/useVibe64SessionSelection-N8wX5oqo.js +1 -0
- package/dist/assets/{useVibe64SystemGraph-CDDcsye4.js → useVibe64SystemGraph-Db_eD-X8.js} +1 -1
- package/dist/assets/{useVibe64Terminal-Zr3Mig2L.js → useVibe64Terminal-B9EWJ9Ba.js} +2 -2
- package/dist/assets/vibe64ProjectScope.local-l5_-E6pq.js +1 -0
- package/dist/assets/vibe64RepositoryRealtime-CHT4-6VN.js +1 -0
- package/dist/assets/vibe64SessionFocus-CS6Ex53G.js +1 -0
- package/dist/assets/vibe64SessionFocus-CSm4YJQD.css +1 -0
- package/dist/assets/vibe64SessionRequestConfig-xIx-5jxQ.js +1 -0
- package/dist/index.html +26 -22
- package/docs/colleague-usage/ai-accounts.md +6 -2
- package/docs/colleague-usage/ai-balance-and-allowance.md +15 -2
- package/docs/colleague-usage/coding-agent-failures.md +2 -1
- package/docs/colleague-usage/coding-agent-goals.md +8 -3
- package/docs/colleague-usage/coding-agents.md +16 -0
- package/docs/colleague-usage/github-work.md +14 -0
- package/docs/colleague-usage/preview-browser-checks.md +5 -3
- package/docs/colleague-usage/project-setup.md +6 -3
- package/docs/colleague-usage/running-vibe64-on-your-computer.md +3 -1
- package/docs/colleague-usage/sessions.md +35 -7
- package/docs/colleague-usage/starter-apps.md +3 -0
- package/docs/colleague-usage/temporary-chat-context.md +2 -1
- package/docs/colleague-usage/temporary-chats.md +17 -5
- package/node_modules/@jskit-ai/assistant-core/CHANGELOG.md +539 -0
- package/node_modules/@jskit-ai/assistant-core/locales/en.json +383 -0
- package/node_modules/@jskit-ai/assistant-core/package.json +3 -2
- package/node_modules/@jskit-ai/assistant-runtime/CHANGELOG.md +138 -0
- package/node_modules/@jskit-ai/assistant-runtime/README.md +2 -1
- package/node_modules/@jskit-ai/assistant-runtime/locales/en.json +137 -0
- package/node_modules/@jskit-ai/assistant-runtime/package.json +3 -2
- package/node_modules/@jskit-ai/assistant-runtime/src/server/repositories/assistantConfigRepository.js +223 -203
- package/node_modules/@jskit-ai/assistant-runtime/src/server/repositories/conversationsRepository.js +286 -266
- package/node_modules/@jskit-ai/assistant-runtime/src/server/repositories/messagesRepository.js +270 -250
- package/node_modules/@jskit-ai/assistant-voice/locales/en.json +182 -0
- package/node_modules/@jskit-ai/assistant-voice/package.json +3 -2
- package/node_modules/@jskit-ai/connector-google-calendar/CHANGELOG.md +83 -0
- package/node_modules/@jskit-ai/connector-google-calendar/locales/en.json +91 -0
- package/node_modules/@jskit-ai/connector-google-calendar/package.json +4 -3
- package/node_modules/@jskit-ai/connectors-catalog/CHANGELOG.md +1722 -0
- package/node_modules/@jskit-ai/connectors-catalog/README.md +11 -0
- package/node_modules/@jskit-ai/connectors-catalog/locales/en.json +3139 -0
- package/node_modules/@jskit-ai/connectors-catalog/package.json +5 -4
- package/node_modules/@jskit-ai/connectors-core/CHANGELOG.md +183 -0
- package/node_modules/@jskit-ai/connectors-core/locales/en.json +92 -0
- package/node_modules/@jskit-ai/connectors-core/package.json +3 -2
- package/node_modules/@jskit-ai/http-runtime/CHANGELOG.md +31 -0
- package/node_modules/@jskit-ai/http-runtime/locales/en.json +14 -0
- package/node_modules/@jskit-ai/http-runtime/package.json +3 -2
- package/node_modules/@jskit-ai/kernel/CHANGELOG.md +182 -0
- package/node_modules/@jskit-ai/kernel/locales/en.json +94 -0
- package/node_modules/@jskit-ai/kernel/package.json +6 -2
- package/node_modules/@jskit-ai/payments-core/CHANGELOG.md +128 -0
- package/node_modules/@jskit-ai/payments-core/locales/en.json +77 -0
- package/node_modules/@jskit-ai/payments-core/package.json +3 -2
- package/node_modules/@jskit-ai/realtime/CHANGELOG.md +20 -0
- package/node_modules/@jskit-ai/realtime/locales/en.json +14 -0
- package/node_modules/@jskit-ai/realtime/package.json +3 -2
- package/node_modules/@jskit-ai/resource-core/package.json +1 -1
- package/node_modules/@jskit-ai/resource-crud-core/package.json +1 -1
- package/node_modules/@jskit-ai/uploads-runtime/CHANGELOG.md +35 -0
- package/node_modules/@jskit-ai/uploads-runtime/locales/en.json +15 -0
- package/node_modules/@jskit-ai/uploads-runtime/package.json +3 -2
- package/node_modules/@local/vibe64-execution/src/host/execHelper.js +49 -48
- package/node_modules/@local/vibe64-execution/src/server/gitTurnCheckpointCommand.js +1327 -0
- package/node_modules/@local/vibe64-genesis/bin/vibe64-genesis-host-context +430 -390
- package/node_modules/@local/vibe64-genesis/src/server/index.js +45 -45
- package/node_modules/@local/vibe64-genesis/src/server/promptContext.js +119 -119
- package/node_modules/@local/vibe64-runtime/src/server/codexAppServerProcess.js +57 -57
- package/node_modules/@local/vibe64-sessions/package.json +2 -1
- package/node_modules/@local/vibe64-terminals/src/server/opencodeSessionEnvironmentPlugin.js +195 -175
- package/node_modules/@local/vibe64-terminals/src/server/sessionWorkOperationCommand.js +1385 -1362
- package/package.json +15 -15
- package/server.bundle.mjs +44206 -42825
- package/dist/assets/GithubBrowserTabs-D-Z3TlA8.js +0 -1
- package/dist/assets/Vibe64OutputControls-DtybwgL3.js +0 -8
- package/dist/assets/_slug_-Bq84T_Iv.js +0 -24
- package/dist/assets/conversation-Bn7wpATa.js +0 -2
- package/dist/assets/conversation-CNcCrV-R.js +0 -16
- package/dist/assets/definitions-CEbi4qae.js +0 -1
- package/dist/assets/env-X7EOFLtl.js +0 -1
- package/dist/assets/index-CBo1BEk6.js +0 -138
- package/dist/assets/issues-BiSiUd5o.js +0 -1
- package/dist/assets/placement-B5T1LR7m.js +0 -1
- package/dist/assets/publish-CeLZE2AG.js +0 -3
- package/dist/assets/pull-requests-pTdQOT7i.js +0 -1
- package/dist/assets/settings-lecRzZ-r.js +0 -1
- package/dist/assets/useArchivedVibe64Sessions-DHYRnyJD.js +0 -1
- package/dist/assets/useCommand-Epd2yHhQ.js +0 -1
- package/dist/assets/useEndpointResource-DBRQISI_.js +0 -1
- package/dist/assets/usePaths-DdAnjVDj.js +0 -1
- package/dist/assets/useVibe64ConversationLog-DboM3tYN.js +0 -1
- package/dist/assets/useVibe64SessionData-CreWtQAO.js +0 -1
- package/dist/assets/useVibe64SessionSelection-CDaX4uwY.js +0 -1
- package/dist/assets/vibe64ProjectScope.local-BxTBYuRg.js +0 -1
- package/dist/assets/vibe64RepositoryRealtime-C-J0I5jY.js +0 -1
- package/dist/assets/vibe64SessionFocus-DSW5Irm6.css +0 -1
- package/dist/assets/vibe64SessionFocus-DzqbVq60.js +0 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import{$ as mergeModels,$n as normalizeProps,Cn as toRaw,D as createVNode,E as createTextVNode,En as toValue,Ft as useModel,Ht as watch,Lt as useSlots,On as unref,Pt as useId,St as resolveComponent,Yt as withDirectives,Zn as normalizeClass,_ as createBaseVNode,an as getCurrentScope,b as createElementBlock,bt as renderList,ct as onMounted,er as normalizeStyle,et as mergeProps,g as computed,gn as reactive,it as onBeforeUnmount,mt as openBlock,o as Fragment,pn as onScopeDispose,pt as onUpdated,qt as withCtx,tr as toDisplayString,tt as nextTick,v as createBlock,vn as ref,w as createSlots,wt as resolveDynamicComponent,xt as renderSlot,y as createCommentVNode,z as guardReactiveProps}from"./runtime-core.esm-bundler-DGXg_mpN.js";import{_ as VIcon,cr as withKeys,lr as withModifiers,p as VProgressLinear,sr as vShow,t as VAvatar}from"./VAvatar-H2hyOWlB.js";import{A as useJskitText,O as registerJskitMessages}from"./useEndpointResource-7-YDfAxX.js";import{t as VSelect}from"./VSelect-Dqnp_CFi.js";import{t as VMenu}from"./VMenu-DnhVIMrr.js";import{n as VChipGroup,t as VChip}from"./VChip-Uixfx461.js";import{t as VTextField}from"./VTextField-CnkGeXaT.js";import"./client-BAXHGUOC.js";import{Bn as mdiPaperclip,Er as mdiStopCircleOutline,Ft as mdiFileOutline,Hn as mdiPencil,L as mdiCheck,M as mdiBrain,Pn as mdiMinus,Q as mdiCloseCircleOutline,Sn as mdiLightbulbOnOutline,Un as mdiPencilOutline,X as mdiClose,Y as mdiClockOutline,ar as mdiRobotOutline,c as mdiAccountOutline,er as mdiRefresh,f as mdiAlertCircleOutline,it as mdiCogOutline,lr as mdiSend,n as mdiAccountCircleOutline,rn as mdiInformationOutline,tn as mdiImageOutline,wt as mdiDownload,z as mdiCheckCircleOutline}from"./mdi-X9prU-DG.js";import{t as VBtn}from"./VBtn-Sj5jAuOx.js";import{t as VAlert}from"./VAlert-7_VM9EUm.js";import{t as VAutocomplete}from"./VAutocomplete-Ck14ZtUL.js";import{t as VSheet}from"./VSheet-CMhyReNa.js";import{t as VDialog}from"./VDialog-Drp3yzSH.js";import{n as VCardText,o as VCardActions,t as VCard}from"./VCard-DExT9Cji.js";import{t as VSpacer}from"./VSpacer-BSTt0_VA.js";import{t as VSkeletonLoader}from"./VSkeletonLoader-pc4bBTxv.js";import{t as VTextarea}from"./VTextarea-wqoRFl1K.js";import{t as _plugin_vue_export_helper_default}from"./_plugin-vue_export-helper-DNW4j-dv.js";import{d as numberedQuestionSubmissionText,f as parseNumberedQuestionPrompt,p as parseAnswerChoicePrompt,u as normalizeThinkingMessageText}from"./conversation-DG9lp25w.js";var jskit=JSON.parse(`{"assistant":{"api":{"requestFailed":"Assistant request failed."},"attachments":{"announcement":{"cancelled":"{count} attachment cancelled. | {count} attachments cancelled.","inProgress":"{count} attachment is in progress. | {count} attachments are in progress.","needAttention":"{count} attachment needs attention. | {count} attachments need attention.","ready":"{count} attachment ready. | {count} attachments ready."},"attached":"Attached files","bytes":"{sent} / {size}","bytesPercent":"{sent} / {size} · {percent}%","cancelItem":"Cancel {name}","close":"Close","download":"Download","error":{"cleanupFailed":"Attachment cleanup failed.","localFilePaste":"Copied local files cannot be pasted from this browser. Drop the file or use Attach files.","noFile":"The prepared attachment did not produce a file.","preparationFailed":"Attachment preparation failed.","tooLarge":"{fileName} is larger than the {limit} attachment limit.","tooMany":"A message can keep at most {count} attachments.","unusable":"Uploaded attachment could not be used.","uploadFailed":"Attachment upload failed."},"limit":"{count} / {max}","preparingName":"Preparing attachment…","previewUnavailable":"Preview is unavailable for this file. You can download it below.","queue":"Message attachments","removeItem":"Remove {name}","retryItem":"Retry {name}","sizeBytes":"{size} B","sizeKilobytes":"{size} KB","sizeMebibytes":"{size} MiB","sizeMegabytes":"{size} MB","status":{"cancelled":"Cancelled","delivering":"Sending to Codex","preparationFailed":"Preparation failed","preparing":"Preparing","queued":"Queued","ready":"Ready","sendingFailed":"Sending failed","uploadFailed":"Upload failed","uploading":"Uploading"},"summary":{"cancelled":"{completed} ready · {cancelled} cancelled","inProgress":"{completed} of {total} ready · in progress","needAttention":"{completed} of {total} ready · {count} needs attention | {completed} of {total} ready · {count} need attention","percent":"{completed} of {total} ready · {percent}%","ready":"{completed} of {total} ready"},"unnamed":"attachment","uploadProgress":"Upload progress for {name}"},"chat":{"attachFiles":"Attach files","avatar":"Conversation avatar","discardUnsent":"Discard unsent message","editUnsent":"Edit unsent message","label":"Assistant conversation","messageAssistant":"Message AI assistant","minimiseAvatar":"Minimise avatar","reviewAttachedFiles":"Please review the attached files.","sendingToAssistant":"Sending to assistant…","showAvatar":"Show avatar","working":"Assistant is working…"},"composer":{"cannotSendYet":"Your words are in the chat box, but this conversation cannot send yet.","chatChanged":"The chat changed before sending. Review the draft before sending.","notReady":"The chat composer is not ready yet.","send":"Send","sendMessage":"Send message","sending":"Sending…","stop":"Stop","stopping":"Stopping…","suggestedPrompts":"Suggested prompts","suggestionsAvailable":"{count} suggested prompts are available before the message controls.","thinkingOfIdeas":"Thinking of a few ideas","thinkingOfIdeasStatus":"Thinking of a few ideas.","useSuggestion":"Use suggestion: {prompt}"},"delivery":{"checkBeforeResend":"Check delivery before resending.","checkPrevious":"Check the previous message's delivery before sending again.","checking":"Checking…","notConfirmed":"Message delivery is not confirmed.","notSent":"Message could not be sent.","retry":"Retry","retryCheck":"Retry delivery check","unconfirmed":"Delivery could not be confirmed.","unconfirmedShort":"Delivery unconfirmed."},"goal":{"blocked":"Goal blocked","budgetLimited":"Goal budget reached","cancel":"Cancel goal","cancelInterruptsTurn":"Cancel stops the current turn and clears the goal.","cancelRemovesGoal":"Cancel removes this goal. Use Stop to interrupt a turn already running.","cancelling":"Cancelling…","complete":"Goal complete","elapsed":"{label}: {elapsed}","elapsedSinceStart":"Elapsed since goal started (including pauses)","goal":"Goal","loading":"Loading goal…","objective":"Goal objective","pause":"Pause goal","pauseInterruptsTurn":"Pause stops the current turn and keeps the goal for later.","pausePreventsTurns":"Pausing prevents further automatic turns. Use Stop to interrupt the current turn.","paused":"Goal paused","pausing":"Pausing…","resume":"Resume goal","resuming":"Resuming…","running":"Goal running","runningTime":"Running time","set":"Set goal","start":"Start goal","starting":"Starting…","tokenBudget":"Token budget (optional)","unavailable":"Goal unavailable","usageLimited":"Goal waiting for allowance"},"longText":{"details":"Details","table":"Table"},"model":{"apply":"Apply","applying":"Applying…","chooseAi":"Choose AI","chooseModel":"Choose model","controls":"AI controls","loading":"Loading available AIs","model":"Model","noMatchingModels":"No matching models","noModels":"No available models.","noneConfigured":"No configured AIs are available for this session.","provider":"Provider","selector":"AI session selector","thinking":"Thinking","tryAgain":"Try again","viewOnly":"AI choices are view-only while the assistant is working.","waitBeforeChanging":"Wait for the active turn to finish before changing models."},"progress":{"hide":"Hide progress updates","showAll":"Show all {count} progress update | Show all {count} progress updates","showLatest":"Show latest {count} progress update | Show latest {count} progress updates"},"questions":{"answerNormally":"Answer normally instead","answerRequired":"Answer question {number}.","fieldLabel":"[{number}] {label}","label":"Assistant questions","suggestedAnswers":"Suggested answers"},"settings":{"readOnly":"Read-only"},"transcript":{"assistant":"Assistant","cancel":"Cancel","edit":"Edit","failed":"Failed: {error}","history":"Conversation history","loadOlder":"Load older messages","loading":"Loading conversation","loadingOlder":"Loading older messages…","messages":"Conversation messages","pending":"Pending","pendingReason":"Pending: {reason}","preparing":"Preparing conversation","progress":"{name} progress","readMore":"Read more","recommended":" · Recommended","reload":"Reload chat","reloading":"Reloading chat","reloadingShort":"Reloading…","reviewMessage":"Review your message","showLess":"Show less","status":"Status"},"turn":{"failed":"Assistant stopped with an error.","stopped":"Stopped."},"conversation":{"handleClosed":"This conversation handle is closed.","handleDisposed":"This conversation handle is disposed.","runtimeClosed":"This conversation runtime is closed.","pagedHistoryUnsupported":"This conversation does not supply paged history.","completedEnvelopesNeedNativeOwner":"Completed envelopes require a runtime-owned native conversation.","completedEnvelopesNotOwned":"This conversation does not own completed envelopes.","goalAttachmentContentUnsupported":"Native goals require extracted text or supported image bytes for attachments.","originalSendOnly":"This conversation supports its original application Send operation.","attachmentIdsOnly":"Supply attachmentIds; only the application's resolver can supply file content.","attachmentsNotConfigured":"File attachments are not configured for this conversation.","steeringUnsupported":"This connection does not support steering.","goalsUnsupported":"This connection does not support native goals.","goalTokenBudgetsUnsupported":"This connection does not support goal token budgets.","goalCommandUnsupported":"This connection does not support that goal command.","goalAttachmentsUnsupported":"This engine's native goal commands do not accept attachments.","completedEnvelopesNeedNativeEngine":"Completed envelopes require a native engine.","replacementPolicyRetained":"This conversation retains its original replacement policy.","selectedProfileRetained":"This scoped conversation retains its original selected profile.","hostSelectionRequired":"This host requires its authorized assistant selection operation.","liveSettingsUnsupported":"This provider does not support live native settings.","completedEnvelopesNeedStorage":"Completed envelopes require runtime-owned canonical storage.","originalReadOnly":"This conversation uses its original read and subscription operations.","authorizedSelectionRequired":"Use the conversation's authorized selection operation.","eventDeliveryRetained":"This scoped conversation retains its original event delivery.","engineChanged":"The selected native engine changed.","useReplaceForEngine":"Use replace() to change this conversation's engine.","rewindInspectionBeforeOpen":"This conversation has an unfinished Undo operation from an earlier runtime. Inspect its saved native and local history offline before opening it; no history was changed.","rewindInspectionBeforeReplace":"This conversation has an unfinished Undo operation from an earlier runtime. Inspect its saved native and local history offline before replacing it; no history was changed.","responseOwnerChanged":"The completed response owner changed.","newerResponseOwnsWorker":"A newer completed response owns this worker.","responseIdentityChanged":"The completed response identity changed.","applicationToolMessageStale":"This application tool's admitted message is no longer current.","nativeCompletionMessageStale":"This native completion's admitted message is no longer current.","toolObservationRetired":"The native tool observation belongs to a retired response.","toolObservationReceiptLost":"The native tool observation lost its exact admitted receipt.","waitForNativeResponse":"Wait for the native response to finish.","waitForAnswer":"Wait for this answer or use steer to send another instruction.","waitForTurnSaving":"Wait for the current turn to finish saving before starting the goal.","waitForInstructionAdmission":"Wait for the pending instruction to be admitted before steering again.","waitForGoalCommand":"Wait for the goal command to be admitted.","waitForSubmission":"Wait for the current submission before checking delivery.","stopBeforeReplace":"Stop the current turn before replacing its native conversation.","stopBeforeSettings":"Stop the current turn before changing its settings.","completedResponseNoReceipt":"The completed response has no current verified receipt.","completedResponseNoTurnReceipt":"The completed response has no exact native turn receipt.","completedClaudeNoToolEvidence":"The completed Claude response has no native tool-attempt evidence.","responseAssociationUnverified":"The native owner could not verify this response association.","responseOtherOperation":"This response already belongs to a different application operation.","completedResponseNoPlainReply":"This completed response does not own a plain reply.","completedReplyNoTarget":"The completed reply has no current plain authored target.","publishedReplyChanged":"The published reply target or text changed.","replyTargetUsed":"This plain reply target already has unassociated content or consumption.","operationResponseIdentity":"The operation has a different completed response identity.","plainReplyPublished":"This completed response already published its plain reply.","savedOperationChanged":"The saved response operation changed.","turnFinishedBeforeSend":"The native turn finished before this instruction was sent. Send it as a new message.","noActiveTurnToSteer":"There is no active native turn to steer. Send a new message.","briefingBeforeTerminal":"Send a chat message to deliver the saved continuity briefing before starting a native terminal or goal.","briefingBeforeGoal":"Send a message to catch this AI up before starting or resuming its goal.","briefingBeforeReplacement":"Deliver the previous replacement's briefing before replacing native history again.","historyExclusionsInvalid":"Native history exclusions require a server-owned completed application wake and exact message IDs.","messageContentRequired":"Bounded text or attachment IDs and a stable messageId are required.","steerNotBoolean":"steer must be a boolean.","applicationDataInvalid":"Application data must be a JSON object within the conversation input limit.","goalMessageIdRequired":"A stable messageId is required for this goal command.","goalConversationChanged":"The conversation changed before this goal command was sent.","goalNeedsNativeConversation":"This command requires an existing native conversation.","messageIdExclusionsConflict":"This messageId already belongs to different native history exclusions.","messageIdContentConflict":"This messageId already belongs to different content.","completedClaudeNotSteerable":"Completed Claude responses cannot share a native steering turn. Wait for the response or stop it.","replacementPendingBeforeSend":"Finish the pending native replacement before sending another message.","replacementPendingBeforeRecovery":"Finish the native replacement before recovering output.","replacementUnfinished":"Retry the unfinished native replacement before starting another one.","replacementPendingBeforeSettings":"Finish the pending native replacement before changing settings.","retainedDeliveryUncertain":"This message has uncertain delivery in a retained conversation. Select that engine and check its receipt before submitting it again.","previousInstructionUnchecked":"Check delivery of the previous instruction before preparing another completed response.","previousSubmissionUncertain":"The previous submission has uncertain delivery. It will not be resent automatically.","goalCommandDeliveryUncertain":"Check the uncertain command's delivery before changing the goal.","earlierGoalCommandUnresolved":"A goal command from an earlier runtime has unresolved delivery. Inspect its saved state before changing the goal.","pendingDeliveryBeforeReplace":"Resolve pending delivery before replacing native history. Another engine may be selected while its receipt stays pending.","deliveryUncertainBeforeSettings":"Resolve uncertain delivery before changing settings.","goalActionRequired":"A goal action and current conversation segment are required.","goalObjectiveInvalid":"A bounded objective and optional positive token budget are required.","goalToResumeRequired":"Select the goal to resume.","goalToStopRequired":"Select the goal to stop.","replacementRequestInvalid":"Replacement needs an operationId, exact predecessor segment, and an engine-change, model-change or renewal reason.","replacementBriefingRequired":"Native replacement requires a continuity briefing.","predecessorChanged":"The native predecessor has changed. Read the conversation before replacing it.","replacementOperationConflict":"This replacement operationId already belongs to another request.","replacementChangedBeforeWrite":"The saved replacement changed before it could be written.","replacementChangedBeforeRelease":"The saved replacement changed before its binding was released.","predecessorChangedBeforeRelease":"The native predecessor identity changed before its binding was released.","predecessorIncomplete":"The native predecessor identity changed or is incomplete.","hostScopeMismatch":"This open conversation already belongs to another host scope. Dispose its handle before reopening it on the original host.","cleanupNeedsOriginalConversation":"Native cleanup requires its original bound conversation.","deliveryUnconfirmed":"Native delivery could not be confirmed.","messageNotSent":"This message was not sent. Review it before sending a new message.","attachmentIdsInvalid":"Attachments require at most {max} distinct, nonempty attachment IDs.","attachmentResolverIncomplete":"The attachment resolver must return a receipt for every requested file and bounded model content.","attachmentLocalFilesUnsupported":"This engine cannot accept local attachment files. Supply extracted text or supported image bytes.","attachmentReceiptInvalid":"Attachment receipts require the requested ID, a bounded fileName and a nonnegative size.","attachmentLocalFileInvalid":"Local attachment files require their exact requested receipt and an authorized absolute native path.","attachmentFormatUnsupported":"This engine cannot accept that attachment format. Supply extracted text or a supported image.","attachmentTextEmpty":"Attachment text must be nonempty.","attachmentBytesRequired":"Attachments require authorized bytes and a supported media type; remote URLs and paths are not accepted.","attachmentBytesExceeded":"Attachment content exceeds the configured byte limit for this request.","replacementRetryMismatch":"Replacement retry does not match the saved operation.","previousReplacementUnfinished":"Finish the previous native conversation replacement first.","previousReleaseUndoUnfinished":"An unfinished conversation Undo from a previous release blocks assistant work. Complete it using the previous release before upgrading.","pendingDeliveryBeforeContextReplace":"Finish pending delivery before replacing native context.","shutdownUnconfirmed":"Native conversation shutdown was not confirmed.","submissionInterrupted":"The previous submission was interrupted. Check delivery before submitting it again.","restartInterrupted":"The application restarted before this answer completed. The request was not replayed.","copiedInterrupted":"Copied into a stopped development environment. This request was not replayed.","operationResultUnsaved":"The application operation result could not be saved. Restore storage access and retry saving.","progressUnsaved":"Conversation progress could not be saved. Restore access to its storage before continuing.","requestTimedOut":"The conversation request exceeded its time limit.","workStopped":"Work stopped.","stoppedByUser":"Stopped by user.","apiHistoryLimit":"This conversation exceeds the configured API history limit. Start another conversation or increase the limit.","outputTokenLimit":"The model reached its output token limit before completing the answer. Increase maxOutputTokens in the conversation limits.","toolCallsUnconfirmed":"The model stream ended without confirming its application tool calls.","answerUnconfirmed":"The model stream ended without confirming a completed answer.","toolProgressLimit":"Application tool progress text exceeds the configured API limit.","finalReplyLimit":"The assistant exceeded the configured final reply limit.","historyBudgetExceeded":"Conversation updates exceed the configured history budget. Renew the context with a continuity briefing before continuing.","briefingBudgetExceeded":"The continuity briefing exceeds the configured history budget."},"claude":{"goalChanged":"The Claude goal changed. Refresh before trying again.","goalTokenBudgetUnsupported":"Claude goals do not support a token budget.","goalBlockerReasonRequired":"An active Claude goal needs a blocker reason of up to 1,000 characters.","goalConditionRequired":"Enter a goal condition of up to 4,000 characters.","goalAlreadySet":"Cancel the existing goal before setting another.","goalActionUnknown":"Unknown Claude goal action.","compactWhileWorking":"Claude is still working. Wait for it to finish before freeing its context.","noActiveTurn":"Claude has no active turn for this message.","steeringUnavailable":"This Claude turn cannot accept steering now.","notConnected":"Claude Code is not connected.","accountStatusInvalid":"Claude Code returned an invalid account status."},"codex":{"helperThreadUnavailable":"This low-cost assistant thread is no longer available. Start the background task again instead of reusing another assistant conversation.","helperOwnershipBlocked":"{applicationName} could not prove ownership of a persisted low-cost assistant thread.","threadDeleteUnavailable":"Codex app-server thread deletion is not available.","goalActionInvalid":"Choose set, pause, resume, or cancel.","goalObjectiveInvalid":"Enter a goal objective and an optional positive whole-number token budget.","goalConversationChanged":"The Codex conversation changed. Refresh the goal before trying again.","goalConversationStopped":"Resume or send a message to restore the stopped conversation before setting a goal.","goalChangedBeforeSet":"The Codex goal changed. Refresh it before setting a new goal.","goalChanged":"The Codex goal changed. Refresh it before trying again.","goalAlreadyStopped":"This goal is already stopped. Refresh its details.","goalStopUnconfirmed":"Codex has not yet confirmed a stop. Retry after the service has stopped.","goalNotResumable":"This goal cannot be resumed from its current status. Refresh its details.","stopUnverified":"Codex's stop could not be verified. Its runtime owner is unavailable.","turnNotReady":"The active assistant turn is not ready to accept this message yet.","messageEmpty":"Codex message is empty.","messageInputEmpty":"Codex message input is empty.","operationNotSteerable":"The active assistant operation cannot accept messages yet.","temporaryConversationBusy":"Temporary AI is already working on this conversation."},"provider":{"notConfigured":"Assistant provider is not configured.","requestFailed":"Assistant provider request failed.","requestRejected":"Request failed."},"stream":{"failed":"Assistant stream failed.","requestFailed":"Request failed."}},"errors":{"conversation_forbidden":"This conversation is not available to this identity.","conversation_storage_version":"This conversation needs its offline runtime-state upgrade before it can be opened. Its saved requests were not replayed or changed.","conversation_configuration_mismatch":"Use configure() to change a saved conversation's settings.","conversation_goal_stopped":"The goal command was stopped before delivery.","conversation_attachment_manifest_changed":"Authorized attachment paths changed after this instruction was prepared. Restore the original files or send a new message.","conversation_receipt_unavailable":"The native receipt has no stored authored message.","conversation_goal_unavailable":"The native goal is unavailable. Try reading its status again.","assistant_provider_invalid_response":"Assistant provider returned an invalid response payload.","assistant_opencode_connection_changing":"OpenCode is changing a connection. Retry after the connection change finishes.","assistant_opencode_connection_in_use":"Close the other OpenCode conversations that use this connection, then retry this connection change. The saved connection has not changed.","assistant_opencode_conversation_busy":"This conversation is still working.","assistant_opencode_key_verification_failed":"OpenCode rejected the API-key verification request.","assistant_opencode_turn_thread_mismatch":"The OpenCode predecessor history changed before handover generation.","assistant_opencode_turn_fresh_thread_required":"The renewed OpenCode conversation does not own the expected fresh native history.","assistant_opencode_turn_unrelated_history":"The successor OpenCode history contains unrelated conversation and cannot be used for renewal."}}`);var en_default={jskit};registerJskitMessages(en_default);function attachmentSizeLabel(size){const bytes=Number(size);if(!Number.isFinite(bytes)||bytes<0)return``;if(bytes<1024)return`${bytes} B`;if(bytes<1048576)return`${(bytes/1024).toFixed(1)} KB`;return`${(bytes/1048576).toFixed(1)} MB`}var jskitText=useJskitText();var{formatNumber,t:t$2}=jskitText;var WHOLE=Object.freeze({useGrouping:false});var ONE_DECIMAL=Object.freeze({maximumFractionDigits:1,minimumFractionDigits:1,useGrouping:false});function attachmentSizeText(size){if(!jskitText.locale)return attachmentSizeLabel(size);const bytes=Number(size);if(!Number.isFinite(bytes)||bytes<0)return``;if(bytes<1024)return t$2(`jskit.assistant.attachments.sizeBytes`,{size:formatNumber(bytes,WHOLE)});if(bytes<1048576)return t$2(`jskit.assistant.attachments.sizeKilobytes`,{size:formatNumber(bytes/1024,ONE_DECIMAL)});return t$2(`jskit.assistant.attachments.sizeMegabytes`,{size:formatNumber(bytes/1048576,ONE_DECIMAL)})}function attachmentLimitText(maxBytes){if(!jskitText.locale)return maxBytes%1048576===0?`${maxBytes/1048576} MiB`:`${maxBytes/1e6} MB`;return maxBytes%1048576===0?t$2(`jskit.assistant.attachments.sizeMebibytes`,{size:formatNumber(maxBytes/1048576,WHOLE)}):t$2(`jskit.assistant.attachments.sizeMegabytes`,{size:formatNumber(maxBytes/1e6,{useGrouping:false})})}var _hoisted_1$14=[`aria-label`];var _hoisted_2$13={class:`assistant-conversation-attachments__details`};var _hoisted_3$10=[`title`];var _hoisted_4$9={key:0,class:`assistant-conversation-attachments__size text-label-small`};var _sfc_main$14={__name:`AssistantMessageAttachments`,props:{attachments:{type:Array,default:()=>[]},previewEnabled:Boolean},emits:[`preview`],setup(__props,{emit:__emit}){const{t}=useJskitText();const emit=__emit;function attachmentIcon(attachment){return/\.(?:avif|bmp|gif|heic|heif|jpe?g|png|svg|webp)$/iu.test(attachment.fileName)?mdiImageOutline:mdiFileOutline}function attachmentKey(attachment,index){return attachment.attachmentId||`${index}:${attachment.fileName}:${attachment.size??``}`}return(_ctx,_cache)=>{return __props.attachments.length?(openBlock(),createElementBlock(`ul`,{key:0,"aria-label":unref(t)(`jskit.assistant.attachments.attached`),class:`assistant-conversation-attachments`},[(openBlock(true),createElementBlock(Fragment,null,renderList(__props.attachments,(attachment,index)=>{return openBlock(),createElementBlock(`li`,{key:attachmentKey(attachment,index),class:`assistant-conversation-attachments__item`},[(openBlock(),createBlock(resolveDynamicComponent(__props.previewEnabled?`button`:`span`),{type:__props.previewEnabled?`button`:void 0,class:`assistant-conversation-attachments__open`,onClick:$event=>__props.previewEnabled&&emit(`preview`,attachment)},{default:withCtx(()=>[createVNode(VIcon,{"aria-hidden":`true`,class:`assistant-conversation-attachments__icon`,icon:attachmentIcon(attachment),size:`19`},null,8,[`icon`]),createBaseVNode(`span`,_hoisted_2$13,[createBaseVNode(`span`,{class:`assistant-conversation-attachments__name text-body-small font-weight-medium`,title:attachment.fileName},toDisplayString(attachment.reference)+` `+toDisplayString(attachment.fileName),9,_hoisted_3$10),unref(attachmentSizeText)(attachment.size)?(openBlock(),createElementBlock(`span`,_hoisted_4$9,toDisplayString(unref(attachmentSizeText)(attachment.size)),1)):createCommentVNode(``,true)])]),_:2},1032,[`type`,`onClick`]))])}),128))],8,_hoisted_1$14)):createCommentVNode(``,true)}}};var AssistantMessageAttachments_default=_plugin_vue_export_helper_default(_sfc_main$14,[[`__scopeId`,`data-v-482d190b`]]);function parseLongTextReviewBlocks(value,options={}){const lines=expandCompactPipeTableLines(String(value||``).replace(/\r\n/gu,`
|
|
2
|
+
`).split(`
|
|
3
|
+
`));const blocks=[];let paragraphLines=[];let listLevels=[];let codeLines=null;let detailsBlock=null;const preserveParagraphLineBreaks=options.preserveParagraphLineBreaks===true;const parseDetailsOpening=(trimmed=``)=>{if(trimmed===`<details>`)return{closed:false,remainder:``,summary:`Details`};const inlineMatch=trimmed.match(/^<details>\s*<summary>\s*(.*?)\s*<\/summary>\s*(.*)$/u);if(!inlineMatch)return null;let remainder=inlineMatch[2]||``;let closed=false;const closingMatch=remainder.match(/^(.*?)\s*<\/details>$/u);if(closingMatch){remainder=closingMatch[1]||``;closed=true}return{closed,remainder:remainder.trim(),summary:inlineMatch[1].trim()||`Details`}};const flushParagraph=()=>{const text=preserveParagraphLineBreaks?paragraphLines.join(`
|
|
4
|
+
`).trim():paragraphLines.join(` `).replace(/\s+/gu,` `).trim();paragraphLines=[];if(text)blocks.push({text,type:`paragraph`})};const flushList=()=>{if(listLevels[0]?.block.items.length)blocks.push(listLevels[0].block);listLevels=[]};const nestListIn=(parentItem,type)=>{const nested={items:[],type};parentItem.blocks=[...parentItem.blocks||[],nested];return nested};const pushListItem=({indent,markerWidth,text,type})=>{while(listLevels.length>1&&indent<listLevels.at(-2).contentIndent)listLevels.pop();let level=listLevels.at(-1);if(level&&indent>=level.contentIndent){level={block:nestListIn(level.block.items.at(-1),type),contentIndent:0};listLevels.push(level)}else if(level&&level.block.type!==type){if(listLevels.length===1){flushList();level=null}else level.block=nestListIn(listLevels.at(-2).block.items.at(-1),type)}if(!level){level={block:{items:[],type},contentIndent:0};listLevels=[level]}level.block.items.push({text});level.contentIndent=indent+markerWidth};const flushCode=()=>{if(codeLines)blocks.push({text:codeLines.join(`
|
|
5
|
+
`).replace(/\n+$/u,``),type:`code`});codeLines=null};const flushDetails=()=>{if(detailsBlock)blocks.push({blocks:parseLongTextReviewBlocks(detailsBlock.lines.join(`
|
|
6
|
+
`),options),summary:detailsBlock.summary||`Details`,type:`details`});detailsBlock=null};for(let lineIndex=0;lineIndex<lines.length;lineIndex+=1){const line=lines[lineIndex].replace(/\s+$/u,``);const trimmed=line.trim();if(detailsBlock){const summaryMatch=trimmed.match(/^<summary>\s*(.*?)\s*<\/summary>$/u);const closingMatch=trimmed.match(/^(.*?)\s*<\/details>$/u);if(/^<\/details>$/u.test(trimmed))flushDetails();else if(closingMatch){const beforeClose=closingMatch[1].trim();if(beforeClose)detailsBlock.lines.push(beforeClose);flushDetails()}else if(summaryMatch)detailsBlock.summary=summaryMatch[1].trim()||detailsBlock.summary;else detailsBlock.lines.push(line);continue}if(codeLines){if(/^```/u.test(trimmed))flushCode();else codeLines.push(line);continue}if(/^```/u.test(trimmed)){flushParagraph();flushList();codeLines=[];continue}const detailsOpening=parseDetailsOpening(trimmed);if(detailsOpening){flushParagraph();flushList();detailsBlock={lines:detailsOpening.remainder?[detailsOpening.remainder]:[],summary:detailsOpening.summary};if(detailsOpening.closed)flushDetails();continue}if(!trimmed){flushParagraph();flushList();continue}const tableBlock=parsePipeTableAt(lines,lineIndex);if(tableBlock){flushParagraph();flushList();blocks.push(tableBlock.block);lineIndex=tableBlock.endIndex;continue}const headingMatch=trimmed.match(/^(#{1,6})\s+(.+)$/u);if(headingMatch){flushParagraph();flushList();blocks.push({level:headingMatch[1].length,text:headingMatch[2].trim(),type:`heading`});continue}const listItemMatch=line.match(/^(\s*)(?:([-*+•])|(\d+[.)]))(\s+)(.*)$/u);if(listItemMatch){flushParagraph();const[,leading,bullet,ordinal,spacing,text]=listItemMatch;pushListItem({indent:indentWidth(leading),markerWidth:(bullet||ordinal).length+Math.min(spacing.length,4),text:text.trim(),type:ordinal?`ol`:`ul`});continue}if(listLevels.length){listLevels.at(-1).block.items.at(-1).text+=` ${trimmed}`;continue}paragraphLines.push(trimmed)}flushParagraph();flushList();flushCode();flushDetails();return blocks}function indentWidth(leading=``){let width=0;for(const character of leading)width=character===` `?width+4-width%4:width+1;return width}function expandCompactPipeTableLines(lines=[]){return lines.flatMap(line=>{const text=String(line||``);const trimmed=text.trim();const compactRowBoundaries=text.match(/\|\s+\|/gu)||[];if(!trimmed.startsWith(`|`)||compactRowBoundaries.length<2)return[line];const expandedLines=text.replace(/\|\s+\|/gu,`|
|
|
7
|
+
|`).split(`
|
|
8
|
+
`);if(!tableAlignments(parsePipeTableRow(expandedLines[1])))return[line];return expandedLines})}function parsePipeTableAt(lines=[],startIndex=0){const headers=parsePipeTableRow(lines[startIndex]);const alignments=tableAlignments(parsePipeTableRow(lines[startIndex+1]));if(!headers||!alignments||headers.length!==alignments.length)return null;const rows=[];let rowIndex=startIndex+2;while(rowIndex<lines.length){const row=parsePipeTableRow(lines[rowIndex]);if(!row||row.length!==headers.length)break;rows.push(row);rowIndex+=1}return{block:{alignments,headers,rows,type:`table`},endIndex:rowIndex-1}}function parsePipeTableRow(value=``){const trimmed=String(value||``).trim();if(!trimmed.startsWith(`|`)||!trimmed.includes(`|`,1))return null;const cells=trimmed.replace(/^\|/u,``).replace(/\|$/u,``).split(`|`).map(cell=>cell.trim());return cells.length>=2?cells:null}function tableAlignments(cells=null){if(!Array.isArray(cells)||!cells.length)return null;const alignments=[];for(const cell of cells){const marker=String(cell||``).replace(/\s+/gu,``);if(!/^:?-{3,}:?$/u.test(marker))return null;if(marker.startsWith(`:`)&&marker.endsWith(`:`))alignments.push(`center`);else if(marker.endsWith(`:`))alignments.push(`right`);else alignments.push(`left`)}return alignments}function pushInlineTextPart(parts=[],text=``){if(!text)return;const previous=parts.at(-1);if(previous?.type===`text`){previous.text+=text;return}parts.push({text,type:`text`})}function closingMarkdownBracketIndex(text=``,start=0){let depth=1;for(let index=start+1;index<text.length;index+=1){const character=text[index];if(character===`\\`){index+=1;continue}if(character===`[`)depth+=1;else if(character===`]`){depth-=1;if(depth===0)return index}}return-1}function closingMarkdownDestinationIndex(text=``,start=0){for(let index=start+1;index<text.length;index+=1){if(text[index]===`\\`){index+=1;continue}if(text[index]===`)`)return index}return-1}function normalizeMarkdownLinkHref(value=``){const href=String(value||``).trim().replace(/^<|>$/gu,``);const protocolText=href.replace(/[\u0000-\u0020\u007f]/gu,``);return/^(?:javascript|vbscript|data):/iu.test(protocolText)?``:href}function markdownLinkAt(text=``,start=0){if(text[start]!==`[`)return null;const labelEnd=closingMarkdownBracketIndex(text,start);if(labelEnd===-1||text[labelEnd+1]!==`(`)return null;const destinationStart=labelEnd+1;const destinationEnd=closingMarkdownDestinationIndex(text,destinationStart);if(destinationEnd===-1)return null;const label=text.slice(start+1,labelEnd);const href=normalizeMarkdownLinkHref(text.slice(destinationStart+1,destinationEnd));if(!label||!href)return null;return{end:destinationEnd+1,href,text:label}}function parseLongTextInlineParts(value=``){const text=String(value||``);const parts=[];let cursor=0;while(cursor<text.length){if(text[cursor]===`[`){const link=markdownLinkAt(text,cursor);if(link){parts.push({href:link.href,text:link.text,type:`link`});cursor=link.end;continue}}if(text[cursor]==="`"){const end=text.indexOf("`",cursor+1);if(end>cursor+1){parts.push({text:text.slice(cursor+1,end),type:`code`});cursor=end+1;continue}}if(text.startsWith(`**`,cursor)){const end=text.indexOf(`**`,cursor+2);if(end>cursor+2){parts.push({text:text.slice(cursor+2,end),type:`strong`});cursor=end+2;continue}}pushInlineTextPart(parts,text[cursor]);cursor+=1}return parts.length?parts:[{text,type:`text`}]}var _hoisted_1$13={key:0};var _hoisted_2$12={key:1};var _hoisted_3$9=[`href`,`onClick`];var _hoisted_4$8={key:3};var _sfc_main$13={__name:`LongTextInlineParts`,props:{text:{default:``,type:String}},emits:[`link-click`],setup(__props,{emit:__emit}){const props=__props;const emit=__emit;const parts=computed(()=>parseLongTextInlineParts(props.text));function partKey(part,partIndex){return`${part.type}:${partIndex}:${part.text}`}function handleLinkClick(event,part={}){emit(`link-click`,{event,href:part.href||``,text:part.text||``})}return(_ctx,_cache)=>{return openBlock(true),createElementBlock(Fragment,null,renderList(parts.value,(part,partIndex)=>{return openBlock(),createElementBlock(Fragment,{key:partKey(part,partIndex)},[part.type===`strong`?(openBlock(),createElementBlock(`strong`,_hoisted_1$13,toDisplayString(part.text),1)):part.type===`code`?(openBlock(),createElementBlock(`code`,_hoisted_2$12,toDisplayString(part.text),1)):part.type===`link`?(openBlock(),createElementBlock(`a`,{key:2,href:part.href,onClick:$event=>handleLinkClick($event,part)},toDisplayString(part.text),9,_hoisted_3$9)):(openBlock(),createElementBlock(`span`,_hoisted_4$8,toDisplayString(part.text),1))],64)}),128)}}};var LongTextInlineParts_default=_plugin_vue_export_helper_default(_sfc_main$13,[[`__scopeId`,`data-v-cde45916`]]);var _hoisted_1$12={key:2,class:`studio-long-text-review__code`};var _hoisted_2$11=[`aria-label`];var _hoisted_3$8={class:`studio-long-text-review__table`};var _hoisted_4$7={key:4,class:`studio-long-text-review__details`};var _hoisted_5$7={class:`studio-long-text-review__details-summary`};var _hoisted_6$5={key:5,class:`studio-long-text-review__paragraph`};var _sfc_main$12={__name:`LongTextPreviewBlocks`,props:{blocks:{type:Array,required:true},compact:{type:Boolean,default:false}},emits:[`link-click`],setup(__props,{emit:__emit}){const{serverMessage,t}=useJskitText();const emit=__emit;function detailsSummary(block){return serverMessage({message:block.summary,messageCode:`assistant.longText.details`})}function isListBlock(block){return block.type===`ul`||block.type===`ol`}function blockKey(block,blockIndex){return`${block.type}:${blockIndex}`}function headingTag(level){if(level<=1)return`h3`;if(level===2)return`h4`;return`h5`}function tableCellClass(block={},columnIndex=0){const alignment=Array.isArray(block.alignments)?block.alignments[columnIndex]:``;return{"studio-long-text-review__table-cell--center":alignment===`center`,"studio-long-text-review__table-cell--right":alignment===`right`}}return(_ctx,_cache)=>{const _component_LongTextPreviewBlocks=resolveComponent(`LongTextPreviewBlocks`,true);return openBlock(),createElementBlock(`div`,{class:normalizeClass([`studio-long-text-review__blocks`,{"studio-long-text-review__blocks--compact":__props.compact}])},[(openBlock(true),createElementBlock(Fragment,null,renderList(__props.blocks,(block,blockIndex)=>{return openBlock(),createElementBlock(Fragment,{key:blockKey(block,blockIndex)},[block.type===`heading`?(openBlock(),createBlock(resolveDynamicComponent(headingTag(block.level)),{key:0,class:`studio-long-text-review__heading`},{default:withCtx(()=>[createVNode(LongTextInlineParts_default,{text:block.text,onLinkClick:_cache[0]||(_cache[0]=$event=>emit(`link-click`,$event))},null,8,[`text`])]),_:2},1024)):isListBlock(block)?(openBlock(),createBlock(resolveDynamicComponent(block.type),{key:1,class:`studio-long-text-review__list`},{default:withCtx(()=>[(openBlock(true),createElementBlock(Fragment,null,renderList(block.items,(item,itemIndex)=>{return openBlock(),createElementBlock(`li`,{key:`item:${blockIndex}:${itemIndex}`},[createVNode(LongTextInlineParts_default,{text:item.text,onLinkClick:_cache[1]||(_cache[1]=$event=>emit(`link-click`,$event))},null,8,[`text`]),item.blocks?.length?(openBlock(),createBlock(_component_LongTextPreviewBlocks,{key:0,class:`studio-long-text-review__nested-list`,compact:__props.compact,blocks:item.blocks,onLinkClick:_cache[2]||(_cache[2]=$event=>emit(`link-click`,$event))},null,8,[`compact`,`blocks`])):createCommentVNode(``,true)])}),128))]),_:2},1024)):block.type===`code`?(openBlock(),createElementBlock(`pre`,_hoisted_1$12,[createBaseVNode(`code`,null,toDisplayString(block.text),1)])):block.type===`table`?(openBlock(),createElementBlock(`div`,{key:3,class:`studio-long-text-review__table-wrap`,role:`region`,"aria-label":unref(t)(`jskit.assistant.longText.table`),tabindex:`0`},[createBaseVNode(`table`,_hoisted_3$8,[createBaseVNode(`thead`,null,[createBaseVNode(`tr`,null,[(openBlock(true),createElementBlock(Fragment,null,renderList(block.headers,(header,columnIndex)=>{return openBlock(),createElementBlock(`th`,{key:`header:${blockIndex}:${columnIndex}`,class:normalizeClass(tableCellClass(block,columnIndex)),scope:`col`},[createVNode(LongTextInlineParts_default,{text:header,onLinkClick:_cache[3]||(_cache[3]=$event=>emit(`link-click`,$event))},null,8,[`text`])],2)}),128))])]),createBaseVNode(`tbody`,null,[(openBlock(true),createElementBlock(Fragment,null,renderList(block.rows,(row,rowIndex)=>{return openBlock(),createElementBlock(`tr`,{key:`row:${blockIndex}:${rowIndex}`},[(openBlock(true),createElementBlock(Fragment,null,renderList(row,(cell,columnIndex)=>{return openBlock(),createElementBlock(`td`,{key:`cell:${blockIndex}:${rowIndex}:${columnIndex}`,class:normalizeClass(tableCellClass(block,columnIndex))},[createVNode(LongTextInlineParts_default,{text:cell,onLinkClick:_cache[4]||(_cache[4]=$event=>emit(`link-click`,$event))},null,8,[`text`])],2)}),128))])}),128))])])],8,_hoisted_2$11)):block.type===`details`?(openBlock(),createElementBlock(`details`,_hoisted_4$7,[createBaseVNode(`summary`,_hoisted_5$7,[createVNode(LongTextInlineParts_default,{text:detailsSummary(block),onLinkClick:_cache[5]||(_cache[5]=$event=>emit(`link-click`,$event))},null,8,[`text`])]),createVNode(_component_LongTextPreviewBlocks,{class:`studio-long-text-review__details-body`,compact:``,blocks:block.blocks||[],onLinkClick:_cache[6]||(_cache[6]=$event=>emit(`link-click`,$event))},null,8,[`blocks`])])):(openBlock(),createElementBlock(`p`,_hoisted_6$5,[createVNode(LongTextInlineParts_default,{text:block.text,onLinkClick:_cache[7]||(_cache[7]=$event=>emit(`link-click`,$event))},null,8,[`text`])]))],64)}),128))],2)}}};var LongTextPreviewBlocks_default=_plugin_vue_export_helper_default(_sfc_main$12,[[`__scopeId`,`data-v-8a7a7379`]]);var _hoisted_1$11={key:0,class:`d-flex flex-wrap align-center ga-1 text-caption text-error`,role:`status`};var _sfc_main$11={__name:`AssistantConversationStatus`,props:{message:{type:Object,required:true}},emits:[`check-delivery`,`link-click`],setup(__props){const{t}=useJskitText();return(_ctx,_cache)=>{return __props.message.delivery?(openBlock(),createElementBlock(`div`,_hoisted_1$11,[createBaseVNode(`span`,null,toDisplayString(__props.message.delivery.error||__props.message.text),1),createVNode(VBtn,{variant:`text`,color:`error`,size:`x-small`,"aria-label":unref(t)(`jskit.assistant.delivery.retryCheck`),disabled:__props.message.delivery.checking,onClick:_cache[0]||(_cache[0]=$event=>_ctx.$emit(`check-delivery`,__props.message.delivery.messageId))},{default:withCtx(()=>[createTextVNode(toDisplayString(__props.message.delivery.checking?unref(t)(`jskit.assistant.delivery.checking`):unref(t)(`jskit.assistant.delivery.retry`)),1)]),_:1},8,[`aria-label`,`disabled`])])):renderSlot(_ctx.$slots,`default`,{},()=>[createVNode(LongTextPreviewBlocks_default,{compact:``,blocks:__props.message.blocks,onLinkClick:_cache[1]||(_cache[1]=$event=>_ctx.$emit(`link-click`,$event))},null,8,[`blocks`])],void 0,1)}}};var DEFAULT_SETTLE_DELAYS_MS=[0,80];function readElement(value){return unref(value)||null}function hasWindowTimer(name){return typeof window!==`undefined`&&typeof window[name]===`function`}function waitForLayoutFrame(){if(typeof window===`undefined`||typeof window.requestAnimationFrame!==`function`)return Promise.resolve();return new Promise(resolve=>{window.requestAnimationFrame(resolve)})}function normalizedScrollBehavior(value=``){return value===`smooth`?`smooth`:`auto`}function scrollElementToBottom(targetElement,behavior=`auto`){if(behavior===`smooth`&&typeof targetElement.scrollTo===`function`){targetElement.scrollTo({behavior,top:targetElement.scrollHeight});return}targetElement.scrollTop=targetElement.scrollHeight}function useScrollToBottom({anchor=null,enabled=true,scrollAnchorIntoView=true,settleDelaysMs=DEFAULT_SETTLE_DELAYS_MS,target}={}){const scheduledTimers=new Set;let disposed=false;let scheduleVersion=0;function isEnabled(){return unref(enabled)!==false}function clearScheduledTimers(){if(hasWindowTimer(`clearTimeout`))scheduledTimers.forEach(timer=>{window.clearTimeout(timer)});scheduledTimers.clear()}function clearScheduledScrolls(){scheduleVersion+=1;clearScheduledTimers()}function scrollNow(options={}){if(disposed||!isEnabled())return;const targetElement=readElement(target);if(!targetElement)return;const behavior=normalizedScrollBehavior(options?.behavior);scrollElementToBottom(targetElement,behavior);if(scrollAnchorIntoView!==false){const anchorOptions={block:`end`};if(behavior===`smooth`)anchorOptions.behavior=behavior;readElement(anchor)?.scrollIntoView?.(anchorOptions)}scrollElementToBottom(targetElement,behavior)}function scheduleScroll(delayMs,options={},version=scheduleVersion){if(disposed||version!==scheduleVersion||!isEnabled()||!hasWindowTimer(`setTimeout`))return;const timer=window.setTimeout(()=>{scheduledTimers.delete(timer);if(version!==scheduleVersion)return;scrollNow(options)},delayMs);scheduledTimers.add(timer)}async function scrollAfterLayout(options={}){if(disposed||!isEnabled())return;const version=scheduleVersion+1;scheduleVersion=version;clearScheduledTimers();await nextTick();if(version!==scheduleVersion)return;scrollNow(options);await waitForLayoutFrame();if(version!==scheduleVersion)return;scrollNow(options);clearScheduledTimers();settleDelaysMs.forEach(delayMs=>{scheduleScroll(delayMs,options,version)})}onBeforeUnmount(()=>{disposed=true;clearScheduledScrolls()});return{clearScheduledScrolls,scrollAfterLayout,scrollNow}}var _hoisted_1$10={class:`assistant-progress`};var _hoisted_2$10=[`aria-expanded`];var _sfc_main$10={__name:`AssistantProgress`,props:{messages:{type:Array,default:()=>[]},pending:{type:Boolean,default:false},previewLimit:{type:Number,default:2}},setup(__props){const{t}=useJskitText();const props=__props;const expanded=ref(false);const previewCount=computed(()=>props.pending?props.previewLimit:0);const previewMessages=computed(()=>previewCount.value>0?props.messages.filter(message=>message.preview!==false).slice(-previewCount.value):[]);const visibleMessages=computed(()=>{if(expanded.value)return props.messages;return previewMessages.value});const toggleLabel=computed(()=>{if(expanded.value)return previewMessages.value.length>0?t(`jskit.assistant.progress.showLatest`,{count:previewMessages.value.length}):t(`jskit.assistant.progress.hide`);return t(`jskit.assistant.progress.showAll`,{count:props.messages.length})});return(_ctx,_cache)=>{return openBlock(),createElementBlock(`div`,_hoisted_1$10,[expanded.value||__props.messages.length>previewMessages.value.length?(openBlock(),createElementBlock(`button`,{key:0,"aria-expanded":expanded.value,class:`assistant-progress__toggle`,type:`button`,onClick:_cache[0]||(_cache[0]=$event=>expanded.value=!expanded.value)},toDisplayString(toggleLabel.value),9,_hoisted_2$10)):createCommentVNode(``,true),(openBlock(true),createElementBlock(Fragment,null,renderList(visibleMessages.value,(message,index)=>{return openBlock(),createElementBlock(`div`,{key:message.key||message.id||index,class:`assistant-progress__message`},toDisplayString(message.text),1)}),128))])}}};var AssistantProgress_default=_plugin_vue_export_helper_default(_sfc_main$10,[[`__scopeId`,`data-v-7b098bea`]]);var DEFAULT_SCROLL_FOLLOW_THRESHOLD_PX=48;function numericElementValue(value){const number=Number(value);return Number.isFinite(number)?number:0}function scrollDistanceFromBottom(element=null){if(!element)return 0;return Math.max(0,numericElementValue(element.scrollHeight)-numericElementValue(element.scrollTop)-numericElementValue(element.clientHeight))}function scrollElementNearBottom(element=null,thresholdPx=48){const threshold=Math.max(0,numericElementValue(thresholdPx));return scrollDistanceFromBottom(element)<=threshold}var _hoisted_1$9=[`aria-label`];var _hoisted_2$9={key:2,class:`assistant-transcript__settling`,"aria-hidden":`true`};var _hoisted_3$7={class:`assistant-transcript__error-content`};var _hoisted_4$6=[`aria-label`];var _hoisted_5$6={key:0,class:`assistant-transcript__welcome`,role:`status`};var _hoisted_6$4={class:`assistant-transcript__assistant-header`};var _hoisted_7$4={class:`assistant-transcript__avatar assistant-transcript__avatar--assistant`};var _hoisted_8$4={class:`assistant-transcript__message-header`};var _hoisted_9$4={key:1,class:`assistant-transcript__load-more`};var _hoisted_10$3={key:0,class:`assistant-transcript__load-more-error`};var _hoisted_11$2={key:0,class:`assistant-transcript__system`};var _hoisted_12$2={class:`assistant-transcript__system-body`};var _hoisted_13$2={class:`assistant-transcript__system-meta`};var _hoisted_14$1={key:0};var _hoisted_15$1={key:1,class:`assistant-transcript__message-row assistant-transcript__message-row--user`};var _hoisted_16$1={class:`assistant-transcript__user-content`};var _hoisted_17$1={key:1,class:`assistant-transcript__plain-user`};var _hoisted_18$1=[`aria-expanded`,`onClick`];var _hoisted_19={key:1,class:`assistant-transcript__message-footer assistant-transcript__message-footer--user`};var _hoisted_20={key:0};var _hoisted_21={key:1,role:`status`};var _hoisted_22={key:2,class:`assistant-transcript__optimistic-failure`};var _hoisted_23={role:`status`};var _hoisted_24={key:0,class:`assistant-transcript__optimistic-actions`};var _hoisted_25={class:`assistant-transcript__avatar assistant-transcript__avatar--user`};var _hoisted_26=[`data-message-role`];var _hoisted_27={class:`assistant-transcript__assistant-header`};var _hoisted_28={class:`assistant-transcript__avatar assistant-transcript__avatar--assistant`};var _hoisted_29={class:`assistant-transcript__message-header`};var _hoisted_30=[`title`];var _hoisted_31={class:`assistant-transcript__message assistant-transcript__message--assistant`};var _hoisted_32={key:1,class:`assistant-transcript__questions`};var _hoisted_33={class:`assistant-transcript__question-number`};var _hoisted_34={class:`assistant-transcript__question-content`};var _hoisted_35={class:`assistant-transcript__question-text`};var _hoisted_36={key:0,class:`assistant-transcript__question-choices`};var _hoisted_37={key:0};var _hoisted_38={key:0,class:`assistant-transcript__message-footer assistant-transcript__message-footer--assistant`};var USER_MESSAGE_COLLAPSE_MIN_CHARACTERS=360;var USER_MESSAGE_PREVIEW_MAX_CHARACTERS=280;var USER_MESSAGE_PREVIEW_MAX_LINES=4;var DISPLAY_MESSAGE_CACHE_LIMIT=500;var USER_SCROLL_INTENT_RESET_MS=600;var LOAD_MORE_THRESHOLD_PX=160;var _sfc_main$9={__name:`AssistantTranscript`,props:{cancellableDelivery:{type:Boolean,default:false},systemLabel:{type:String,default:void 0},previewMessage:{type:Object,default:null},working:{type:Boolean,default:void 0},progressPreviewLimit:{type:Number,default:2},userMessageFormat:{type:String,default:`formatted`,validator:value=>[`plain`,`formatted`].includes(value)},assistantLabel:{default:void 0,type:String},error:{default:``,type:String},errorReloadable:{default:false,type:Boolean},followLatestKey:{default:0,type:[Number,String]},hasMoreBefore:{default:false,type:Boolean},loading:{default:false,type:Boolean},loadingMore:{default:false,type:Boolean},loadMoreError:{default:``,type:String},reloadable:{default:false,type:Boolean},reloading:{default:false,type:Boolean},retainWhenHidden:{default:false,type:Boolean},scrollKey:{default:``,type:[Number,String]},turns:{default:()=>[],type:Array},variant:{default:`main`,validator:value=>[`main`,`task`].includes(value),type:String},visible:{default:true,type:Boolean},welcomeMessage:{default:``,type:String}},emits:[`cancel-turn`,`check-delivery`,`edit-turn`,`load-more`,`link-click`,`reload`,`resend-turn`],setup(__props,{emit:__emit}){const jskitText=useJskitText();const{formatDateTime,serverMessage,t}=jskitText;function previewForTurn(turn){const preview=turn.previewMessage||props.previewMessage;return(preview?.messageId||preview?.id)===turn.turnId?preview:null}const props=__props;const emit=__emit;const systemName=computed(()=>props.systemLabel??t(`jskit.assistant.transcript.status`));const assistantName=computed(()=>props.assistantLabel??t(`jskit.assistant.transcript.assistant`));const reloadLabel=computed(()=>props.reloading?t(`jskit.assistant.transcript.reloading`):t(`jskit.assistant.transcript.reload`));const bodyElement=ref(null);const bottomElement=ref(null);const expandedUserMessages=ref(new Set);const isWorking=computed(()=>props.working??props.turns.some(turn=>turn.pending));const followingLatest=ref(true);const initialScrollSettled=ref(false);const userScrollIntent=ref(false);const displayMessageCache=new Map;let liveScrollFrame=0;let userScrollIntentTimer=null;let initialScrollVersion=0;let loadMoreScrollSnapshot=null;let retainedReaderScrollSnapshot=null;let loadMoreRequestVersion=0;let pendingTailFollow=false;let previousScrollTop=0;const KEYBOARD_SCROLL_KEYS=new Set([` `,`ArrowDown`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`,`Spacebar`]);const TIME_FORMAT=Object.freeze({year:`numeric`,month:`short`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`});function displayTime(value=``){const date=new Date(String(value||``));if(Number.isNaN(date.getTime()))return``;return formatDateTime(date,TIME_FORMAT)}function userMessagePreviewText(value=``){const text=String(value||``);const characters=[...text];const lines=text.split(/\r\n?|\n/u);if(characters.length<=USER_MESSAGE_COLLAPSE_MIN_CHARACTERS&&lines.length<=USER_MESSAGE_PREVIEW_MAX_LINES)return``;const preview=[...lines.slice(0,USER_MESSAGE_PREVIEW_MAX_LINES).join(`
|
|
9
|
+
`)].slice(0,USER_MESSAGE_PREVIEW_MAX_CHARACTERS).join(``).trimEnd();return preview?`${preview}…`:``}function displayMessage(message=null,{allowNumberedQuestions=false,preserveParagraphLineBreaks=false,previewUserMessage=false}={},cacheKey=``){if(!message)return null;const normalizedCacheKey=String(cacheKey||``).trim();const cached=normalizedCacheKey?displayMessageCache.get(normalizedCacheKey):null;const activeLocale=jskitText.locale;if(cached&&cached.locale===activeLocale&&cached.allowNumberedQuestions===allowNumberedQuestions&&cached.attachments===message.attachments&&cached.at===message.at&&cached.messageId===message.messageId&&cached.preserveParagraphLineBreaks===preserveParagraphLineBreaks&&cached.previewUserMessage===previewUserMessage&&cached.role===message.role&&cached.text===message.text)return{...message,...cached.value};const messageText=message.textCode?serverMessage({message:message.text,messageCode:message.textCode}):message.text;const questionInput=allowNumberedQuestions?parseNumberedQuestionPrompt(messageText):{intro:``,outro:``,questions:[]};const hasQuestions=questionInput.questions.length>0;const previewText=previewUserMessage?userMessagePreviewText(message.text):``;const value={blocks:parseLongTextReviewBlocks(hasQuestions?questionInput.intro:messageText,{preserveParagraphLineBreaks}),outroBlocks:parseLongTextReviewBlocks(hasQuestions?questionInput.outro:``,{preserveParagraphLineBreaks}),previewBlocks:previewText?parseLongTextReviewBlocks(previewText,{preserveParagraphLineBreaks:true}):null,questions:hasQuestions?questionInput.questions:[],displayAt:displayTime(message.at)};if(normalizedCacheKey){if(displayMessageCache.size>=DISPLAY_MESSAGE_CACHE_LIMIT&&!displayMessageCache.has(normalizedCacheKey))displayMessageCache.delete(displayMessageCache.keys().next().value);displayMessageCache.set(normalizedCacheKey,{allowNumberedQuestions,attachments:message.attachments,at:message.at,locale:activeLocale,messageId:message.messageId,preserveParagraphLineBreaks,previewUserMessage,role:message.role,text:message.text,value})}return{...message,...value}}function displayThinkingMessage(message=null){if(!message)return null;const text=normalizeThinkingMessageText(message.text);if(!text)return null;return{...message,text,displayAt:displayTime(message.at)}}function conversationAgentMessages(turn={}){if(Array.isArray(turn.messages))return turn.messages.filter(message=>[`assistant`,`commentary`,`thinking`].includes(String(message?.role||``).trim()));return[...Array.isArray(turn.thinking)?turn.thinking:[],...Array.isArray(turn.commentary)?turn.commentary:[],turn.assistant].filter(Boolean)}function conversationMessageKey(message={},index=0){return[String(message.messageId||``).trim(),String(message.role||``).trim(),String(message.at||``).trim(),index].join(`:`)}const displayEntries=computed(()=>{const candidates=[];for(const[index,turn]of props.turns.entries()){const turnId=String(turn.turnId||index+1);const userDelivery=turn.user&&turn.system?.delivery&&turn.system.delivery.messageId===turn.user.messageId?turn.system:null;const messages=[turn.system&&!userDelivery&&{...turn.system,role:`system`},turn.user&&{...turn.user,role:`user`},...conversationAgentMessages(turn)].filter(Boolean);for(const[messageIndex,message]of messages.entries()){const role=String(message.role||``).trim();const key=`${turnId}:${conversationMessageKey(message,messageIndex)}`;const displayed=role===`thinking`?displayThinkingMessage(message):displayMessage(message,{allowNumberedQuestions:role!==`user`&&role!==`system`,preserveParagraphLineBreaks:role===`user`,previewUserMessage:role===`user`},key);if(!displayed)continue;candidates.push({key,role,turn:{...turn,turnId},message:displayed,sortAt:turn.optimistic&&turn.optimistic.status!==`accepted`&&turn.optimistic.id===message.messageId?NaN:Date.parse(message.at),delivery:role===`user`?userDelivery:null})}}const dated=candidates.filter(entry=>Number.isFinite(entry.sortAt)).sort((a,b)=>a.sortAt-b.sortAt)[Symbol.iterator]();const entries=[];for(const candidate of candidates){const entry=Number.isFinite(candidate.sortAt)?dated.next().value:candidate;const previous=entries.at(-1);if(entry.role===`thinking`&&previous?.role===`thinking`)previous.messages.push({...entry.message,key:entry.key});else entries.push({...entry,...entry.role===`thinking`?{messages:[{...entry.message,key:entry.key}]}:{}})}for(const[index,entry]of entries.entries())if(entry.role===`thinking`)entry.key=`progress:${entries[index+1]?.key||`tail`}`;return entries});function handleLongTextLinkClick(payload){emit(`link-click`,payload)}function userMessageCollapsible(message=null){return Array.isArray(message?.previewBlocks)}function userMessageExpanded(turn={}){return expandedUserMessages.value.has(String(turn.turnId||``))}function toggleExpandedKey(expandedKeys,key){const next=new Set(expandedKeys.value);if(next.has(key))next.delete(key);else next.add(key);expandedKeys.value=next}function toggleUserMessage(turn={}){const key=String(turn.turnId||``);if(!key)return;toggleExpandedKey(expandedUserMessages,key)}const loadingIndicatorVisible=computed(()=>Boolean(props.loading&&!displayEntries.value.length));const initialScrollPending=computed(()=>Boolean(props.visible&&displayEntries.value.length&&!initialScrollSettled.value));function messageScrollKey(message=null){if(!message)return`empty`;return[message.messageId||``,message.role||``,message.at||``,String(message.text||``)].join(`/`)}const timelineScrollTrigger=computed(()=>[loadingIndicatorVisible.value?`loading`:`ready`,displayEntries.value.length?`has-messages`:`empty`,props.scrollKey].join(`:`));const latestRenderedTailKey=computed(()=>{const entry=displayEntries.value.at(-1);if(!entry)return``;return[entry.key,isWorking.value,entry.role===`thinking`?entry.messages.map(messageScrollKey).join(`+`):messageScrollKey(entry.message),entry.turn.optimistic?.status||``,entry.turn.optimistic?.error||``].join(`:`)});const autoScrollEnabled=computed(()=>Boolean(props.visible&&followingLatest.value));const{clearScheduledScrolls,scrollAfterLayout:scrollToLatestMessage,scrollNow:scrollToLatestMessageNow}=useScrollToBottom({anchor:bottomElement,enabled:autoScrollEnabled,scrollAnchorIntoView:false,target:bodyElement});function clearUserScrollIntent(){if(userScrollIntentTimer&&typeof window!==`undefined`&&typeof window.clearTimeout===`function`)window.clearTimeout(userScrollIntentTimer);userScrollIntentTimer=null;userScrollIntent.value=false}function resumePendingTailFollow(){const shouldResume=pendingTailFollow&&followingLatest.value;pendingTailFollow=false;if(shouldResume)queueLiveBottomScroll()}function markUserScrollIntent(){retainedReaderScrollSnapshot=null;userScrollIntent.value=true;clearLiveBottomScroll();clearScheduledScrolls();if(userScrollIntentTimer&&typeof window!==`undefined`&&typeof window.clearTimeout===`function`)window.clearTimeout(userScrollIntentTimer);if(typeof window===`undefined`||typeof window.setTimeout!==`function`)return;userScrollIntentTimer=window.setTimeout(()=>{userScrollIntentTimer=null;userScrollIntent.value=false;resumePendingTailFollow()},USER_SCROLL_INTENT_RESET_MS)}function markKeyboardScrollIntent(event={}){if(!KEYBOARD_SCROLL_KEYS.has(String(event.key||``))||event.defaultPrevented)return;const target=event.target;const tagName=String(target?.tagName||``).toLowerCase();if(target?.isContentEditable||[`input`,`select`,`textarea`].includes(tagName)||[` `,`Spacebar`].includes(event.key)&&[`a`,`button`].includes(tagName))return;markUserScrollIntent()}function scrollToLatestMessageAfterLayout({behavior=`auto`,force=false}={}){if(force){retainedReaderScrollSnapshot=null;followingLatest.value=true;clearUserScrollIntent()}return scrollToLatestMessage({behavior})}function queueInitialBottomScroll(){const version=initialScrollVersion+1;initialScrollVersion=version;initialScrollSettled.value=false;if(props.retainWhenHidden&&!props.visible)return;scrollToLatestMessageAfterLayout({behavior:`auto`,force:true}).finally(()=>{if(initialScrollVersion===version)initialScrollSettled.value=true})}function queueLiveBottomScroll({force=false}={}){if(userScrollIntent.value&&!force){pendingTailFollow=true;return}if(force){retainedReaderScrollSnapshot=null;pendingTailFollow=false;followingLatest.value=true;clearUserScrollIntent()}if(props.retainWhenHidden&&!props.visible)return;if(liveScrollFrame)return;if(typeof window===`undefined`||typeof window.requestAnimationFrame!==`function`){scrollToLatestMessageAfterLayout({behavior:`auto`});return}liveScrollFrame=window.requestAnimationFrame(()=>{liveScrollFrame=0;scrollToLatestMessageNow({behavior:`auto`})})}function clearLiveBottomScroll(){if(liveScrollFrame&&typeof window!==`undefined`&&typeof window.cancelAnimationFrame===`function`)window.cancelAnimationFrame(liveScrollFrame);liveScrollFrame=0}function updateLatestFollowFromScroll(event={}){if(props.retainWhenHidden&&!props.visible)return;const target=event?.currentTarget||bodyElement.value;if(retainedReaderScrollSnapshot?.restoring){previousScrollTop=target?.scrollTop||0;return}const scrollTop=target?.scrollTop||0;const scrolledUp=scrollTop<previousScrollTop;previousScrollTop=scrollTop;if(loadMoreScrollSnapshot&&!loadMoreScrollSnapshot.completed){loadMoreScrollSnapshot.scrollTop=scrollTop;loadMoreScrollSnapshot.anchor=visibleHistoryAnchor(target);loadMoreScrollSnapshot.scrollHeight=target.scrollHeight}const shouldFollow=scrollElementNearBottom(target);if(!shouldFollow&&!userScrollIntent.value&&followingLatest.value)return;followingLatest.value=shouldFollow;if(shouldFollow){clearUserScrollIntent();resumePendingTailFollow();return}clearLiveBottomScroll();clearScheduledScrolls();if(scrolledUp&&initialScrollSettled.value&&scrollTop<=LOAD_MORE_THRESHOLD_PX&&!props.loadMoreError)requestLoadMore()}function visibleHistoryAnchor(element){const top=element.getBoundingClientRect().top;for(const turn of element.querySelectorAll(`.assistant-transcript__turn`)){const bounds=turn.getBoundingClientRect();if(bounds.bottom>top)return{element:turn,offset:bounds.top-top}}return null}function restoreAnchoredScroll(element,snapshot){const anchor=snapshot.anchor;if(anchor&&element.contains(anchor.element)){const offset=anchor.element.getBoundingClientRect().top-element.getBoundingClientRect().top;previousScrollTop=element.scrollTop+offset-anchor.offset}else previousScrollTop=snapshot.scrollTop+(element.scrollHeight-snapshot.scrollHeight);element.scrollTop=previousScrollTop}async function waitForTwoFrames(){if(typeof window!==`undefined`&&typeof window.requestAnimationFrame===`function`)await new Promise(resolve=>window.requestAnimationFrame(()=>window.requestAnimationFrame(resolve)))}async function restoreRetainedReaderScroll(){const snapshot=retainedReaderScrollSnapshot;snapshot.restoring=true;await nextTick();for(let pass=0;pass<2;pass+=1){const element=bodyElement.value;if(retainedReaderScrollSnapshot!==snapshot||element!==snapshot.body||snapshot.scrollKey!==props.scrollKey||!props.retainWhenHidden||!props.visible||followingLatest.value||loadMoreScrollSnapshot){if(retainedReaderScrollSnapshot===snapshot)retainedReaderScrollSnapshot=null;return}restoreAnchoredScroll(element,snapshot);if(pass===0)await waitForTwoFrames()}if(retainedReaderScrollSnapshot===snapshot)retainedReaderScrollSnapshot=null}function requestLoadMore(){if(props.retainWhenHidden&&!props.visible||!props.hasMoreBefore||props.loadingMore||loadMoreScrollSnapshot)return;followingLatest.value=false;pendingTailFollow=false;markUserScrollIntent();const element=bodyElement.value;const version=loadMoreRequestVersion+1;loadMoreRequestVersion=version;loadMoreScrollSnapshot=element?{anchor:visibleHistoryAnchor(element),scrollHeight:element.scrollHeight,scrollKey:props.scrollKey,scrollTop:element.scrollTop,version}:null;emit(`load-more`,{complete:({changed=false}={})=>{completeLoadMoreRequest(version,changed)}})}function clearLoadMoreScrollSnapshot(){loadMoreRequestVersion+=1;loadMoreScrollSnapshot=null}async function completeLoadMoreRequest(version,changed){const snapshot=loadMoreScrollSnapshot;if(!snapshot||snapshot.version!==version)return;if(!changed||snapshot.scrollKey!==props.scrollKey){clearLoadMoreScrollSnapshot();return}snapshot.completed=true;await nextTick();if(loadMoreScrollSnapshot?.version!==version)return;const passes=props.retainWhenHidden?2:1;for(let pass=0;pass<passes;pass+=1){if(props.retainWhenHidden&&!props.visible||loadMoreScrollSnapshot?.version!==version||snapshot.scrollKey!==props.scrollKey)return;const element=bodyElement.value;if(element)restoreAnchoredScroll(element,snapshot);if(pass+1<passes)await waitForTwoFrames()}clearLoadMoreScrollSnapshot()}onBeforeUnmount(()=>{retainedReaderScrollSnapshot=null;clearLiveBottomScroll();clearUserScrollIntent();clearLoadMoreScrollSnapshot()});watch(()=>props.scrollKey,()=>{expandedUserMessages.value=new Set;displayMessageCache.clear()});watch(()=>[timelineScrollTrigger.value,latestRenderedTailKey.value],([timelineKey,value],[previousTimelineKey,previous]=[])=>{if(timelineKey!==previousTimelineKey)return;if(!value||value===previous)return;queueLiveBottomScroll({force:false})},{flush:`post`});watch(()=>[props.scrollKey,props.followLatestKey],([scrollKey,value],[previousScrollKey,previous]=[])=>{if(scrollKey!==previousScrollKey||value===previous)return;queueLiveBottomScroll({force:true})},{flush:`post`});watch(timelineScrollTrigger,()=>{retainedReaderScrollSnapshot=null;clearLoadMoreScrollSnapshot();queueInitialBottomScroll()},{flush:`post`,immediate:true});watch(()=>props.error,()=>{if(followingLatest.value)queueLiveBottomScroll()},{flush:`post`});watch(()=>props.visible,visible=>{if(visible)return;retainedReaderScrollSnapshot=null;const element=bodyElement.value;if(props.retainWhenHidden&&initialScrollSettled.value&&!followingLatest.value&&!loadMoreScrollSnapshot&&element?.clientHeight>0)retainedReaderScrollSnapshot={anchor:visibleHistoryAnchor(element),body:element,scrollHeight:element.scrollHeight,scrollKey:props.scrollKey,scrollTop:element.scrollTop}},{flush:`sync`});watch(()=>props.visible,visible=>{if(props.retainWhenHidden){if(!visible){clearLiveBottomScroll();clearScheduledScrolls();clearUserScrollIntent();initialScrollVersion+=1}else if(loadMoreScrollSnapshot?.completed)completeLoadMoreRequest(loadMoreScrollSnapshot.version,true);else if(!initialScrollSettled.value)queueInitialBottomScroll();else if(retainedReaderScrollSnapshot)restoreRetainedReaderScroll();else queueLiveBottomScroll();return}clearLoadMoreScrollSnapshot();if(visible)queueLiveBottomScroll({force:true})},{flush:`post`});return(_ctx,_cache)=>{return __props.visible||__props.retainWhenHidden?withDirectives((openBlock(),createElementBlock(`section`,{key:0,class:normalizeClass([`assistant-transcript`,[`assistant-transcript--${__props.variant}`,{"assistant-transcript--retained":__props.retainWhenHidden,"assistant-transcript--error":__props.error}]]),"aria-label":unref(t)(`jskit.assistant.transcript.history`)},[__props.reloadable?(openBlock(),createBlock(VBtn,{key:0,"aria-label":reloadLabel.value,class:`assistant-transcript__reload`,disabled:__props.reloading,icon:unref(mdiRefresh),size:`x-small`,title:reloadLabel.value,type:`button`,variant:`text`,onClick:_cache[0]||(_cache[0]=$event=>emit(`reload`))},null,8,[`aria-label`,`disabled`,`icon`,`title`])):createCommentVNode(``,true),loadingIndicatorVisible.value&&!__props.reloadable?(openBlock(),createBlock(VSkeletonLoader,{key:1,"aria-label":unref(t)(`jskit.assistant.transcript.loading`),class:`assistant-transcript__loading-skeleton`,type:`list-item-avatar-two-line@3`},null,8,[`aria-label`])):createCommentVNode(``,true),initialScrollPending.value?(openBlock(),createElementBlock(`div`,_hoisted_2$9,[createVNode(VSkeletonLoader,{"aria-label":unref(t)(`jskit.assistant.transcript.preparing`),class:`assistant-transcript__settling-skeleton`,type:`list-item-avatar-two-line@3`},null,8,[`aria-label`])])):createCommentVNode(``,true),__props.error?(openBlock(),createBlock(VAlert,{key:3,class:`assistant-transcript__error`,icon:false,density:`compact`,type:`warning`,variant:`tonal`},{default:withCtx(()=>[createBaseVNode(`div`,_hoisted_3$7,[__props.errorReloadable&&!__props.reloadable?(openBlock(),createBlock(VBtn,{key:0,disabled:__props.reloading,"min-height":32,size:`small`,"aria-label":reloadLabel.value,type:`button`,variant:`text`,onClick:_cache[1]||(_cache[1]=$event=>emit(`reload`))},{default:withCtx(()=>[createTextVNode(toDisplayString(__props.reloading?unref(t)(`jskit.assistant.transcript.reloadingShort`):unref(t)(`jskit.assistant.transcript.reload`)),1)]),_:1},8,[`disabled`,`aria-label`])):createCommentVNode(``,true),createBaseVNode(`span`,null,toDisplayString(__props.error),1)])]),_:1})):createCommentVNode(``,true),createBaseVNode(`div`,{ref_key:`bodyElement`,ref:bodyElement,"aria-label":unref(t)(`jskit.assistant.transcript.messages`),class:normalizeClass([`assistant-transcript__body`,{"assistant-transcript__body--settling":initialScrollPending.value}]),tabindex:`0`,onKeydownCapture:markKeyboardScrollIntent,onPointerdown:withModifiers(markUserScrollIntent,[`self`]),onScrollPassive:updateLatestFollowFromScroll,onTouchmovePassive:markUserScrollIntent,onWheelPassive:markUserScrollIntent},[__props.welcomeMessage?(openBlock(),createElementBlock(`div`,_hoisted_5$6,[createBaseVNode(`div`,_hoisted_6$4,[createBaseVNode(`span`,_hoisted_7$4,[createVNode(VIcon,{icon:unref(mdiRobotOutline),size:`16`},null,8,[`icon`])]),createBaseVNode(`div`,_hoisted_8$4,[createBaseVNode(`span`,null,toDisplayString(assistantName.value),1)])]),renderSlot(_ctx.$slots,`welcome`,{},()=>[createBaseVNode(`p`,null,toDisplayString(__props.welcomeMessage),1)],true)])):createCommentVNode(``,true),__props.hasMoreBefore||__props.loadingMore||__props.loadMoreError?(openBlock(),createElementBlock(`div`,_hoisted_9$4,[createVNode(VBtn,{color:`primary`,disabled:__props.loadingMore||!__props.hasMoreBefore,size:`x-small`,type:`button`,variant:`tonal`,onClick:requestLoadMore},{default:withCtx(()=>[createTextVNode(toDisplayString(__props.loadingMore?unref(t)(`jskit.assistant.transcript.loadingOlder`):unref(t)(`jskit.assistant.transcript.loadOlder`)),1)]),_:1},8,[`disabled`]),__props.loadMoreError?(openBlock(),createElementBlock(`div`,_hoisted_10$3,toDisplayString(__props.loadMoreError),1)):createCommentVNode(``,true)])):createCommentVNode(``,true),(openBlock(true),createElementBlock(Fragment,null,renderList(displayEntries.value,entry=>{return openBlock(),createElementBlock(`article`,{key:entry.key,class:`assistant-transcript__turn`},[entry.role===`system`?(openBlock(),createElementBlock(`div`,_hoisted_11$2,[createVNode(VIcon,{class:`assistant-transcript__system-icon`,icon:unref(mdiInformationOutline),size:`15`},null,8,[`icon`]),createBaseVNode(`div`,_hoisted_12$2,[createBaseVNode(`div`,_hoisted_13$2,[createBaseVNode(`span`,null,toDisplayString(systemName.value),1),entry.message.displayAt?(openBlock(),createElementBlock(`time`,_hoisted_14$1,toDisplayString(entry.message.displayAt),1)):createCommentVNode(``,true)]),renderSlot(_ctx.$slots,`system-message`,{message:entry.message},()=>[createVNode(_sfc_main$11,{message:entry.message,onCheckDelivery:_cache[2]||(_cache[2]=$event=>emit(`check-delivery`,$event)),onLinkClick:handleLongTextLinkClick},null,8,[`message`])],true)])])):entry.role===`user`?(openBlock(),createElementBlock(`div`,_hoisted_15$1,[createBaseVNode(`div`,{class:normalizeClass([`assistant-transcript__message assistant-transcript__message--user`,{"assistant-transcript__message--pending":entry.turn.optimistic?.status===`pending`,"assistant-transcript__message--failed":entry.turn.optimistic?.status===`failed`}])},[createBaseVNode(`div`,_hoisted_16$1,[entry.turn.preview&&previewForTurn(entry.turn)?.actions?.editing?(openBlock(),createBlock(VTextarea,{key:0,class:`assistant-transcript__preview-editor`,"model-value":previewForTurn(entry.turn).text,label:unref(t)(`jskit.assistant.transcript.reviewMessage`),disabled:!previewForTurn(entry.turn).actions.canEdit,density:`compact`,rows:1,"max-rows":2,"auto-grow":``,"hide-details":``,"onUpdate:modelValue":$event=>previewForTurn(entry.turn).actions.update(entry.turn.turnId,$event)},null,8,[`model-value`,`label`,`disabled`,`onUpdate:modelValue`])):__props.userMessageFormat===`plain`?(openBlock(),createElementBlock(`p`,_hoisted_17$1,toDisplayString(userMessageExpanded(entry.turn)?entry.message.text:userMessagePreviewText(entry.message.text)||entry.message.text),1)):(openBlock(),createBlock(LongTextPreviewBlocks_default,{key:2,blocks:userMessageExpanded(entry.turn)?entry.message.blocks:entry.message.previewBlocks||entry.message.blocks,onLinkClick:handleLongTextLinkClick},null,8,[`blocks`]))]),userMessageCollapsible(entry.message)?(openBlock(),createElementBlock(`button`,{key:0,"aria-expanded":userMessageExpanded(entry.turn),class:`assistant-transcript__user-content-toggle`,type:`button`,onClick:$event=>toggleUserMessage(entry.turn)},toDisplayString(userMessageExpanded(entry.turn)?unref(t)(`jskit.assistant.transcript.showLess`):unref(t)(`jskit.assistant.transcript.readMore`)),9,_hoisted_18$1)):createCommentVNode(``,true),renderSlot(_ctx.$slots,`attachments`,{items:entry.message.attachments,message:entry.message},()=>[createVNode(AssistantMessageAttachments_default,{attachments:entry.message.attachments||[]},null,8,[`attachments`])],true),entry.message.displayAt||entry.turn.optimistic?.status===`pending`?(openBlock(),createElementBlock(`div`,_hoisted_19,[entry.message.displayAt?(openBlock(),createElementBlock(`time`,_hoisted_20,toDisplayString(entry.message.displayAt),1)):createCommentVNode(``,true),entry.turn.optimistic?.status===`pending`?(openBlock(),createElementBlock(`span`,_hoisted_21,toDisplayString(entry.turn.optimistic.waiting?unref(t)(`jskit.assistant.transcript.pendingReason`,{reason:entry.turn.optimistic.waiting}):unref(t)(`jskit.assistant.transcript.pending`)),1)):createCommentVNode(``,true)])):createCommentVNode(``,true),renderSlot(_ctx.$slots,`user-message-actions`,{message:entry.message,turn:entry.turn},void 0,true),entry.delivery||entry.turn.optimistic?.status===`failed`?(openBlock(),createElementBlock(`div`,_hoisted_22,[createBaseVNode(`span`,_hoisted_23,toDisplayString(entry.delivery?entry.delivery.delivery.error||unref(t)(`jskit.assistant.delivery.unconfirmedShort`):unref(t)(`jskit.assistant.transcript.failed`,{error:entry.turn.optimistic.error||unref(t)(`jskit.assistant.delivery.notSent`)})),1),!entry.turn.preview?(openBlock(),createElementBlock(`div`,_hoisted_24,[createVNode(VBtn,{class:`assistant-transcript__delivery-action`,color:`error`,size:`x-small`,type:`button`,variant:`text`,disabled:entry.delivery?.delivery.checking,"aria-label":entry.delivery?unref(t)(`jskit.assistant.delivery.retryCheck`):void 0,title:entry.delivery?entry.delivery.delivery.error||unref(t)(`jskit.assistant.delivery.checkBeforeResend`):void 0,onClick:$event=>entry.delivery?emit(`check-delivery`,entry.delivery.delivery.messageId):emit(`resend-turn`,entry.turn.optimistic.id)},{default:withCtx(()=>[createTextVNode(toDisplayString(entry.delivery?.delivery.checking?unref(t)(`jskit.assistant.delivery.checking`):unref(t)(`jskit.assistant.delivery.retry`)),1)]),_:2},1032,[`disabled`,`aria-label`,`title`,`onClick`]),!entry.delivery||__props.cancellableDelivery?(openBlock(),createBlock(VBtn,{key:0,class:`assistant-transcript__delivery-action`,size:`x-small`,type:`button`,variant:`text`,onClick:$event=>emit(`cancel-turn`,entry.delivery?.delivery.messageId||entry.turn.optimistic.id)},{default:withCtx(()=>[createTextVNode(toDisplayString(unref(t)(`jskit.assistant.transcript.cancel`)),1)]),_:1},8,[`onClick`])):createCommentVNode(``,true),!entry.delivery?(openBlock(),createBlock(VBtn,{key:1,class:`assistant-transcript__delivery-action`,size:`x-small`,type:`button`,variant:`text`,onClick:$event=>emit(`edit-turn`,entry.turn.optimistic.id)},{default:withCtx(()=>[createTextVNode(toDisplayString(unref(t)(`jskit.assistant.transcript.edit`)),1)]),_:1},8,[`onClick`])):createCommentVNode(``,true)])):createCommentVNode(``,true)])):createCommentVNode(``,true)],2),createBaseVNode(`span`,_hoisted_25,[createVNode(VIcon,{icon:unref(mdiAccountOutline),size:`15`},null,8,[`icon`])])])):entry.role===`thinking`?(openBlock(),createBlock(AssistantProgress_default,{key:`${__props.scrollKey}:${entry.key}`,class:`assistant-transcript__thinking`,messages:entry.messages,pending:isWorking.value&&entry===displayEntries.value.at(-1),"preview-limit":__props.progressPreviewLimit,"aria-label":unref(t)(`jskit.assistant.transcript.progress`,{name:entry.turn.assistantLabel||assistantName.value})},null,8,[`messages`,`pending`,`preview-limit`,`aria-label`])):(openBlock(),createElementBlock(`div`,{key:3,class:`assistant-transcript__message-row assistant-transcript__message-row--assistant`,"data-message-role":entry.role},[createBaseVNode(`div`,_hoisted_27,[createBaseVNode(`span`,_hoisted_28,[createVNode(VIcon,{icon:unref(mdiRobotOutline),size:`16`},null,8,[`icon`])]),createBaseVNode(`div`,_hoisted_29,[createBaseVNode(`span`,{title:entry.message.assistantDetails||entry.turn.assistantDetails||void 0},toDisplayString(entry.message.assistantLabel||entry.turn.assistantLabel||assistantName.value),9,_hoisted_30)])]),createBaseVNode(`div`,_hoisted_31,[entry.message.blocks.length?(openBlock(),createBlock(LongTextPreviewBlocks_default,{key:0,blocks:entry.message.blocks,onLinkClick:handleLongTextLinkClick},null,8,[`blocks`])):createCommentVNode(``,true),entry.message.questions.length?(openBlock(),createElementBlock(`ol`,_hoisted_32,[(openBlock(true),createElementBlock(Fragment,null,renderList(entry.message.questions,question=>{return openBlock(),createElementBlock(`li`,{key:question.name,class:`assistant-transcript__question`},[createBaseVNode(`span`,_hoisted_33,toDisplayString(question.number),1),createBaseVNode(`div`,_hoisted_34,[createBaseVNode(`span`,_hoisted_35,[createVNode(LongTextInlineParts_default,{text:question.label,onLinkClick:handleLongTextLinkClick},null,8,[`text`])]),question.choices.length?(openBlock(),createElementBlock(`ul`,_hoisted_36,[(openBlock(true),createElementBlock(Fragment,null,renderList(question.choices,choice=>{return openBlock(),createElementBlock(`li`,{key:choice.value},[createVNode(LongTextInlineParts_default,{text:choice.label,onLinkClick:handleLongTextLinkClick},null,8,[`text`]),choice.recommended?(openBlock(),createElementBlock(`span`,_hoisted_37,toDisplayString(unref(t)(`jskit.assistant.transcript.recommended`)),1)):createCommentVNode(``,true)])}),128))])):createCommentVNode(``,true)])])}),128))])):createCommentVNode(``,true),entry.message.outroBlocks.length?(openBlock(),createBlock(LongTextPreviewBlocks_default,{key:2,blocks:entry.message.outroBlocks,onLinkClick:handleLongTextLinkClick},null,8,[`blocks`])):createCommentVNode(``,true),renderSlot(_ctx.$slots,`message-actions`,{message:entry.message,turn:entry.turn},void 0,true)]),entry.message.displayAt?(openBlock(),createElementBlock(`div`,_hoisted_38,[createBaseVNode(`time`,null,toDisplayString(entry.message.displayAt),1)])):createCommentVNode(``,true)],8,_hoisted_26))])}),128)),createBaseVNode(`div`,{ref_key:`bottomElement`,ref:bottomElement,class:`assistant-transcript__bottom`,"aria-hidden":`true`},null,512)],42,_hoisted_4$6)],10,_hoisted_1$9)),[[vShow,__props.visible]]):createCommentVNode(``,true)}}};var AssistantTranscript_default=_plugin_vue_export_helper_default(_sfc_main$9,[[`__scopeId`,`data-v-b7b0477b`]]);var _hoisted_1$8={key:1,class:`assistant-prompt-input__input-start`};var _hoisted_2$8=[`aria-describedby`,`aria-label`,`disabled`,`placeholder`,`rows`,`value`];var _hoisted_3$6={key:2,class:`assistant-prompt-input__footer`};var _hoisted_4$5={key:0,class:`assistant-prompt-input__details`};var _hoisted_5$5={key:0,class:`assistant-prompt-input__hint`};var _sfc_main$8={__name:`AssistantPromptInput`,props:{submitOnModifierEnter:{type:Boolean,default:false},ariaLabel:{default:``,type:String},attachmentState:{default:()=>({canSubmit:true,count:0}),type:Object},dragging:{default:false,type:Boolean},autoGrow:{default:true,type:Boolean},disabled:{default:false,type:Boolean},describedBy:{default:``,type:String},errorMessages:{default:()=>[],type:[Array,String]},hint:{default:``,type:String},label:{default:``,type:String},modelValue:{default:``,type:String},persistentHint:{default:false,type:Boolean},placeholderAffectsHeight:{default:true,type:Boolean},placeholder:{default:``,type:String},rows:{default:4,type:[Number,String]},density:{default:`default`,type:String},submitOnEnter:{default:false,type:Boolean},submitEnabled:{default:true,type:Boolean},tabToSubmit:{default:false,type:Boolean},variant:{default:`outlined`,type:String}},emits:[`blur`,`escape`,`focus`,`input-activity`,`submit`,`tab-to-submit`,`update:modelValue`,`paste`],setup(__props,{expose:__expose,emit:__emit}){const emit=__emit;const props=__props;const textareaRef=ref(null);const textareaId=`assistant-prompt-${useId()}`;let resizeFrame=0;let resizeObserver=null;let preserveHeightForNextModelValueChange=false;const combinedErrorMessages=computed(()=>{return Array.isArray(props.errorMessages)?props.errorMessages:[props.errorMessages].filter(Boolean)});const hintVisible=computed(()=>Boolean(props.hint&&(props.persistentHint||combinedErrorMessages.value.length<1)));const detailsVisible=computed(()=>Boolean(combinedErrorMessages.value.length||hintVisible.value));const textareaAriaLabel=computed(()=>props.ariaLabel?props.ariaLabel:void 0);function resizeTextarea(){if(!props.autoGrow)return;const textarea=textareaRef.value;if(!textarea)return;if(!props.placeholderAffectsHeight&&!textarea.value)return;const style=window.getComputedStyle(textarea);const minHeight=Number.parseFloat(style.minHeight)||0;const maxHeight=Number.parseFloat(style.maxHeight)||Number.POSITIVE_INFINITY;textarea.style.height=`auto`;const contentHeight=Math.max(textarea.scrollHeight,minHeight);const targetHeight=Math.min(contentHeight,maxHeight);textarea.style.height=`${targetHeight}px`;textarea.style.overflowY=contentHeight>targetHeight+1?`auto`:`hidden`}function queueResizeTextarea(){if(!props.autoGrow||typeof window===`undefined`)return;if(resizeFrame)return;resizeFrame=window.requestAnimationFrame(()=>{resizeFrame=0;resizeTextarea()})}function preserveHeightForNextModelValue(){const textarea=textareaRef.value;if(!props.autoGrow||!textarea)return false;if(resizeFrame){window.cancelAnimationFrame(resizeFrame);resizeFrame=0}preserveHeightForNextModelValueChange=true;textarea.style.height=`${textarea.getBoundingClientRect().height}px`;textarea.style.overflowY=`auto`;return true}function handleTextareaInput(event={}){preserveHeightForNextModelValueChange=false;emit(`input-activity`);emit(`update:modelValue`,String(event?.target?.value||``));queueResizeTextarea()}function handleTextareaFocus(event={}){emit(`focus`,event)}function handleTextareaBlur(event={}){emit(`blur`,event)}function handleTextareaKeydown(event={}){if(props.disabled||event.isComposing)return;if(event.key===`Escape`){emit(`escape`,event);return}if(props.tabToSubmit&&props.submitEnabled&&String(props.modelValue||``).trim()&&props.attachmentState.canSubmit&&event.key===`Tab`&&!event.shiftKey&&!event.altKey&&!event.ctrlKey&&!event.metaKey){event.preventDefault();emit(`tab-to-submit`);return}if(props.submitOnModifierEnter&&event.key===`Enter`&&(event.ctrlKey||event.metaKey)&&!event.shiftKey&&!event.altKey&&!event.isComposing&&props.submitEnabled&&props.attachmentState.canSubmit){event.preventDefault();event.stopPropagation();emit(`submit`);return}if(event.key===`Enter`&&!props.submitOnEnter){event.stopPropagation();return}if(!props.submitOnEnter||event.key!==`Enter`||event.shiftKey||event.altKey||event.ctrlKey||event.metaKey||event.isComposing||!props.submitEnabled||!props.attachmentState.canSubmit)return;event.preventDefault();emit(`submit`)}function focusTextarea(options={preventScroll:true}){textareaRef.value?.focus?.(options)}onMounted(()=>{queueResizeTextarea();let lastWidth=0;resizeObserver=new ResizeObserver(([entry])=>{const width=entry.contentRect.width;if(width!==lastWidth){lastWidth=width;queueResizeTextarea()}});resizeObserver.observe(textareaRef.value)});onBeforeUnmount(()=>{resizeObserver?.disconnect();if(resizeFrame&&typeof window!==`undefined`){window.cancelAnimationFrame(resizeFrame);resizeFrame=0}});watch(()=>[props.autoGrow,props.modelValue,props.placeholder,props.placeholderAffectsHeight,props.rows,props.density],(values,previousValues=[])=>{const modelValueChanged=values[1]!==previousValues[1];if(preserveHeightForNextModelValueChange&&modelValueChanged){preserveHeightForNextModelValueChange=false;return}queueResizeTextarea()},{flush:`post`});__expose({inputElement:textareaRef,focus:focusTextarea,preserveHeightForNextModelValue,queueResizeTextarea});return(_ctx,_cache)=>{return openBlock(),createElementBlock(`div`,{class:normalizeClass([`assistant-prompt-input`,{"assistant-prompt-input--compact":__props.density===`compact`,"assistant-prompt-input--dragging":__props.dragging,"assistant-prompt-input--has-attachments":__props.attachmentState.count,"assistant-prompt-input--has-footer":_ctx.$slots.footer,"assistant-prompt-input--has-input-start":_ctx.$slots[`input-start`]}])},[renderSlot(_ctx.$slots,`attachments`,{},void 0,true),createBaseVNode(`div`,{class:normalizeClass([`assistant-prompt-input__field`,{"assistant-prompt-input__field--disabled":__props.disabled}])},[__props.label?(openBlock(),createElementBlock(`label`,{key:0,class:`assistant-prompt-input__label`,for:textareaId},toDisplayString(__props.label),1)):createCommentVNode(``,true),_ctx.$slots[`input-start`]?(openBlock(),createElementBlock(`div`,_hoisted_1$8,[renderSlot(_ctx.$slots,`input-start`,{},void 0,true)])):createCommentVNode(``,true),createBaseVNode(`textarea`,{id:textareaId,ref_key:`textareaRef`,ref:textareaRef,"aria-describedby":__props.describedBy||void 0,"aria-label":textareaAriaLabel.value,class:`assistant-prompt-input__input`,disabled:__props.disabled,placeholder:__props.placeholder,rows:__props.rows,value:__props.modelValue,onBlur:handleTextareaBlur,onFocus:handleTextareaFocus,onInput:handleTextareaInput,onKeydown:handleTextareaKeydown,onPaste:_cache[0]||(_cache[0]=$event=>emit(`paste`,$event))},null,40,_hoisted_2$8),_ctx.$slots.footer?(openBlock(),createElementBlock(`div`,_hoisted_3$6,[renderSlot(_ctx.$slots,`footer`,{attachmentState:__props.attachmentState},void 0,true)])):createCommentVNode(``,true)],2),detailsVisible.value?(openBlock(),createElementBlock(`div`,_hoisted_4$5,[(openBlock(true),createElementBlock(Fragment,null,renderList(combinedErrorMessages.value,message=>{return openBlock(),createElementBlock(`div`,{key:message,class:`assistant-prompt-input__error`},toDisplayString(message),1)}),128)),hintVisible.value?(openBlock(),createElementBlock(`div`,_hoisted_5$5,toDisplayString(__props.hint),1)):createCommentVNode(``,true)])):createCommentVNode(``,true)],2)}}};var AssistantPromptInput_default=_plugin_vue_export_helper_default(_sfc_main$8,[[`__scopeId`,`data-v-57d35b92`]]);var _hoisted_1$7={class:`assistant-composer-actions__tools`};var _hoisted_2$7={class:`assistant-composer-actions__delivery`};var _sfc_main$7={__name:`AssistantComposerActions`,props:{state:{type:Object,required:true}},emits:[`submit`,`stop`],setup(__props,{expose:__expose,emit:__emit}){const{t}=useJskitText();const emit=__emit;const sendButton=ref(null);__expose({focus(){(sendButton.value?.$el||sendButton.value)?.focus?.()}});return(_ctx,_cache)=>{return openBlock(),createElementBlock(`div`,{class:normalizeClass([`assistant-composer-actions`,{"assistant-composer-actions--compact":__props.state.density===`compact`}])},[createBaseVNode(`div`,_hoisted_1$7,[renderSlot(_ctx.$slots,`default`,{},void 0,true)]),createBaseVNode(`div`,_hoisted_2$7,[__props.state.canStop?(openBlock(),createBlock(VBtn,{key:0,color:`error`,disabled:__props.state.stopDisabled||__props.state.stopPending,"aria-busy":__props.state.stopPending?`true`:void 0,"prepend-icon":unref(mdiStopCircleOutline),size:`small`,variant:`tonal`,onClick:_cache[0]||(_cache[0]=$event=>emit(`stop`))},{default:withCtx(()=>[createTextVNode(toDisplayString(__props.state.stopPending?unref(t)(`jskit.assistant.composer.stopping`):unref(t)(`jskit.assistant.composer.stop`)),1)]),_:1},8,[`disabled`,`aria-busy`,`prepend-icon`])):createCommentVNode(``,true),createVNode(VBtn,{ref_key:`sendButton`,ref:sendButton,class:`assistant-composer-actions__send`,color:`primary`,disabled:!__props.state.canSend,"aria-busy":__props.state.pending&&!__props.state.canSend?`true`:void 0,"aria-label":__props.state.submitAriaLabel||__props.state.submitLabel||unref(t)(`jskit.assistant.composer.sendMessage`),title:__props.state.submitTitle,"prepend-icon":__props.state.submitIcon||unref(`M2,21L23,12L2,3V10L17,12L2,14V21Z`),size:`small`,variant:`flat`,onClick:_cache[1]||(_cache[1]=$event=>emit(`submit`))},{default:withCtx(()=>[createTextVNode(toDisplayString(__props.state.submitLabel||(__props.state.pending&&!__props.state.canSend?unref(t)(`jskit.assistant.composer.sending`):unref(t)(`jskit.assistant.composer.send`))),1)]),_:1},8,[`disabled`,`aria-busy`,`aria-label`,`title`,`prepend-icon`])]),renderSlot(_ctx.$slots,`feedback`,{},void 0,true)],2)}}};var AssistantComposerActions_default=_plugin_vue_export_helper_default(_sfc_main$7,[[`__scopeId`,`data-v-809ae07e`]]);var _hoisted_1$6=[`id`];var _hoisted_2$6={key:0,"aria-hidden":`true`,class:`assistant-composer-support__assistant-status`};var _hoisted_3$5={key:0,class:`assistant-composer-support__assistant-mark`};var _hoisted_4$4={key:0,"aria-hidden":`true`,class:`assistant-composer-support__loading`};var _hoisted_5$4=[`aria-label`];var _sfc_main$6={__name:`AssistantComposerSupport`,props:{activity:{type:Object,default:()=>({})},loading:{default:false,type:Boolean},statusId:{default:``,type:String},suggestions:{default:()=>[],type:Array}},emits:[`dismiss`,`focusout`,`preview`,`select`],setup(__props){const{t}=useJskitText();const props=__props;const mode=computed(()=>{if(String(props.activity.label||``).trim())return`assistant`;if(props.loading)return`loading`;return props.suggestions.length>0?`ready`:`hidden`});const statusAnnouncement=computed(()=>{if(mode.value===`assistant`)return String(props.activity.label||``).trim();if(mode.value===`loading`)return t(`jskit.assistant.composer.thinkingOfIdeasStatus`);if(mode.value===`ready`)return t(`jskit.assistant.composer.suggestionsAvailable`,{count:props.suggestions.length});return``});return(_ctx,_cache)=>{return openBlock(),createElementBlock(`section`,{class:normalizeClass([`assistant-composer-support`,`assistant-composer-support--${mode.value}`]),"data-assistant-composer-support":``,onFocusout:_cache[3]||(_cache[3]=$event=>_ctx.$emit(`focusout`,$event)),onKeydown:_cache[4]||(_cache[4]=withKeys(withModifiers($event=>_ctx.$emit(`dismiss`),[`stop`,`prevent`]),[`esc`]))},[createBaseVNode(`span`,{id:__props.statusId||void 0,"aria-atomic":`true`,"aria-live":`polite`,class:`assistant-composer-support__sr-status`,role:`status`},toDisplayString(statusAnnouncement.value),9,_hoisted_1$6),mode.value===`assistant`?(openBlock(),createElementBlock(`div`,_hoisted_2$6,[renderSlot(_ctx.$slots,`activity`,{activity:__props.activity},()=>[__props.activity.animated!==false?(openBlock(),createElementBlock(`span`,_hoisted_3$5)):createCommentVNode(``,true),createBaseVNode(`span`,null,toDisplayString(__props.activity.label),1)],true)])):mode.value!==`hidden`?(openBlock(),createElementBlock(Fragment,{key:1},[createVNode(VIcon,{"aria-hidden":`true`,class:`assistant-composer-support__marker`,icon:unref(mdiLightbulbOnOutline),size:`16`},null,8,[`icon`]),mode.value===`loading`?(openBlock(),createElementBlock(`div`,_hoisted_4$4,[createBaseVNode(`span`,null,toDisplayString(unref(t)(`jskit.assistant.composer.thinkingOfIdeas`)),1)])):(openBlock(),createElementBlock(`div`,{key:1,class:`assistant-composer-support__options`,"aria-label":unref(t)(`jskit.assistant.composer.suggestedPrompts`),"aria-orientation":`horizontal`,role:`group`},[(openBlock(true),createElementBlock(Fragment,null,renderList(__props.suggestions,suggestion=>{return openBlock(),createBlock(VBtn,{key:suggestion.prompt,"aria-label":unref(t)(`jskit.assistant.composer.useSuggestion`,{prompt:suggestion.prompt}),class:`assistant-composer-support__option`,rounded:`xl`,size:`small`,type:`button`,variant:`tonal`,onBlur:_cache[0]||(_cache[0]=$event=>_ctx.$emit(`preview`,null)),onMousedown:_cache[1]||(_cache[1]=withModifiers(()=>{},[`prevent`])),onFocus:$event=>_ctx.$emit(`preview`,suggestion),onMouseenter:$event=>_ctx.$emit(`preview`,suggestion),onMouseleave:_cache[2]||(_cache[2]=$event=>_ctx.$emit(`preview`,null)),onClick:$event=>_ctx.$emit(`select`,suggestion)},{default:withCtx(()=>[createBaseVNode(`span`,null,toDisplayString(suggestion.label),1)]),_:2},1032,[`aria-label`,`onFocus`,`onMouseenter`,`onClick`])}),128))],8,_hoisted_5$4))],64)):createCommentVNode(``,true)],34)}}};var AssistantComposerSupport_default=_plugin_vue_export_helper_default(_sfc_main$6,[[`__scopeId`,`data-v-ed6a76d6`]]);var _hoisted_1$5={class:`assistant-goal__label`};var _hoisted_2$5={key:1,class:`assistant-goal__elapsed`,"aria-hidden":`true`};var _hoisted_3$4={role:`status`};var _hoisted_4$3={key:3,class:`my-2`};var _hoisted_5$3={key:4,class:`text-body-small my-2`};var _hoisted_6$3={key:5,class:`text-body-small my-2`};var _hoisted_7$3={key:6,class:`text-body-small mt-2`};var _hoisted_8$3={key:7,class:`text-body-small mt-2`};var _hoisted_9$3={key:9,role:`alert`,class:`text-error text-body-small mt-2`};var _sfc_main$5={__name:`AssistantGoalControl`,props:{state:{type:Object,default:null}},setup(__props){const{t}=useJskitText();const STATUS_KEYS=Object.freeze({active:`jskit.assistant.goal.running`,paused:`jskit.assistant.goal.paused`,blocked:`jskit.assistant.goal.blocked`,usageLimited:`jskit.assistant.goal.usageLimited`,budgetLimited:`jskit.assistant.goal.budgetLimited`,complete:`jskit.assistant.goal.complete`});const props=__props;const open=ref(false);const objective=ref(``);const tokenBudget=ref(``);const now=ref(Date.now());const goal=computed(()=>props.state?.loading||props.state?.available===false?null:props.state?.goal);const running=computed(()=>goal.value?.status===`active`);const working=computed(()=>running.value&&props.state?.working===true);const label=computed(()=>props.state?.loading?t(`jskit.assistant.goal.loading`):props.state?.available===false?t(`jskit.assistant.goal.unavailable`):t(Object.hasOwn(STATUS_KEYS,goal.value?.status??``)?STATUS_KEYS[goal.value.status]:`jskit.assistant.goal.set`));const nativeElapsed=computed(()=>Number.isFinite(goal.value?.elapsedSeconds));const createdAt=computed(()=>typeof goal.value?.createdAt===`string`?Date.parse(goal.value.createdAt):NaN);const elapsedLabel=computed(()=>nativeElapsed.value?t(`jskit.assistant.goal.runningTime`):t(`jskit.assistant.goal.elapsedSinceStart`));const elapsedText=computed(()=>elapsed.value?t(`jskit.assistant.goal.elapsed`,{label:elapsedLabel.value,elapsed:elapsed.value}):``);const clockRunning=computed(()=>nativeElapsed.value?running.value&&Number.isFinite(goal.value?.sampledAt):Boolean(goal.value&&goal.value.status!==`complete`&&Number.isFinite(createdAt.value)));const elapsed=computed(()=>{let secondsUsed;if(nativeElapsed.value){const sinceSample=running.value&&Number.isFinite(goal.value.sampledAt)?Math.max(0,now.value-goal.value.sampledAt)/1e3:0;secondsUsed=goal.value.elapsedSeconds+sinceSample}else{const end=goal.value?.status===`complete`?goal.value.sampledAt:now.value;if(!Number.isFinite(createdAt.value)||!Number.isFinite(end))return``;secondsUsed=(end-createdAt.value)/1e3}const total=Math.max(0,Math.floor(secondsUsed));const seconds=String(total%60).padStart(2,`0`);const minutes=Math.floor(total/60);return minutes<60?`${minutes}:${seconds}`:`${Math.floor(minutes/60)}:${String(minutes%60).padStart(2,`0`)}:${seconds}`});const canSet=computed(()=>!props.state?.loading&&props.state?.available!==false&&typeof props.state?.set===`function`&&(!goal.value||goal.value.status===`complete`));const validBudget=computed(()=>props.state?.tokenBudgetSupported===false||tokenBudget.value===``||Number.isSafeInteger(Number(tokenBudget.value))&&Number(tokenBudget.value)>0);let timer;onMounted(()=>watch(()=>[props.state?.enabled,clockRunning.value,goal.value?.elapsedSeconds,goal.value?.sampledAt,createdAt.value],()=>{clearInterval(timer);now.value=Date.now();if(props.state?.enabled!==false&&clockRunning.value)timer=setInterval(()=>{now.value=Date.now()},1e3)},{immediate:true,flush:`sync`}));onScopeDispose(()=>clearInterval(timer));watch(()=>props.state?.enabled,enabled=>{if(enabled===false)open.value=false});async function setGoal(){if(!canSet.value||props.state.pending||!objective.value.trim()||!validBudget.value)return;const result=await props.state.set({objective:objective.value.trim(),...props.state.tokenBudgetSupported===false||tokenBudget.value===``?{}:{tokenBudget:Number(tokenBudget.value)}});if(result!==false&&result?.ok!==false&&!props.state.error){objective.value=``;tokenBudget.value=``;open.value=false}}return(_ctx,_cache)=>{return __props.state&&__props.state.enabled!==false?(openBlock(),createBlock(VMenu,{key:0,modelValue:open.value,"onUpdate:modelValue":_cache[5]||(_cache[5]=$event=>open.value=$event),location:`top`,"close-on-content-click":false},{activator:withCtx(({props:menuProps})=>[createVNode(VBtn,mergeProps(menuProps,{class:`assistant-goal`,size:`small`,variant:`text`,"aria-label":label.value,title:[label.value,elapsedText.value,goal.value?.objective].filter(Boolean).join(`
|
|
10
|
+
`)}),{default:withCtx(()=>[goal.value?(openBlock(),createElementBlock(`span`,{key:0,class:normalizeClass([`assistant-goal__light`,{"assistant-goal__light--running":running.value,"assistant-goal__light--working":working.value,"assistant-goal__light--paused":goal.value.status===`paused`}]),"aria-hidden":`true`},null,2)):createCommentVNode(``,true),createBaseVNode(`span`,_hoisted_1$5,toDisplayString(__props.state.loading?unref(t)(`jskit.assistant.goal.loading`):__props.state.available===false?unref(t)(`jskit.assistant.goal.unavailable`):goal.value?unref(t)(`jskit.assistant.goal.goal`):unref(t)(`jskit.assistant.goal.set`)),1),elapsed.value?(openBlock(),createElementBlock(`span`,_hoisted_2$5,toDisplayString(elapsed.value),1)):createCommentVNode(``,true)]),_:1},16,[`aria-label`,`title`])]),default:withCtx(()=>[createVNode(VCard,{class:`assistant-goal__details pa-3`,"max-width":`360`},{default:withCtx(()=>[createBaseVNode(`strong`,_hoisted_3$4,toDisplayString(label.value),1),(running.value||__props.state.pauseBlocked&&goal.value?.status===`blocked`)&&__props.state.pause?(openBlock(),createBlock(VBtn,{key:0,size:`small`,disabled:__props.state.pending,onClick:_cache[0]||(_cache[0]=$event=>__props.state.pause())},{default:withCtx(()=>[createTextVNode(toDisplayString(__props.state.action===`pause`?unref(t)(`jskit.assistant.goal.pausing`):unref(t)(`jskit.assistant.goal.pause`)),1)]),_:1},8,[`disabled`])):createCommentVNode(``,true),[`paused`,`blocked`,`usageLimited`].includes(goal.value?.status)&&__props.state.resume?(openBlock(),createBlock(VBtn,{key:1,size:`small`,disabled:__props.state.pending,onClick:_cache[1]||(_cache[1]=$event=>__props.state.resume())},{default:withCtx(()=>[createTextVNode(toDisplayString(__props.state.action===`resume`?unref(t)(`jskit.assistant.goal.resuming`):unref(t)(`jskit.assistant.goal.resume`)),1)]),_:1},8,[`disabled`])):createCommentVNode(``,true),goal.value&&goal.value.status!==`complete`&&__props.state.cancel?(openBlock(),createBlock(VBtn,{key:2,color:`error`,size:`small`,variant:`text`,disabled:__props.state.pending,onClick:_cache[2]||(_cache[2]=$event=>__props.state.cancel())},{default:withCtx(()=>[createTextVNode(toDisplayString(__props.state.action===`cancel`?unref(t)(`jskit.assistant.goal.cancelling`):unref(t)(`jskit.assistant.goal.cancel`)),1)]),_:1},8,[`disabled`])):createCommentVNode(``,true),goal.value?(openBlock(),createElementBlock(`p`,_hoisted_4$3,toDisplayString(goal.value.objective),1)):createCommentVNode(``,true),goal.value?.reason?(openBlock(),createElementBlock(`p`,_hoisted_5$3,toDisplayString(goal.value.reason),1)):createCommentVNode(``,true),elapsed.value?(openBlock(),createElementBlock(`p`,_hoisted_6$3,toDisplayString(elapsedText.value),1)):createCommentVNode(``,true),running.value||goal.value?.status===`paused`?(openBlock(),createElementBlock(`p`,_hoisted_7$3,toDisplayString(__props.state.pauseInterruptsTurn?unref(t)(`jskit.assistant.goal.pauseInterruptsTurn`):unref(t)(`jskit.assistant.goal.pausePreventsTurns`)),1)):createCommentVNode(``,true),goal.value&&goal.value.status!==`complete`&&__props.state.cancel?(openBlock(),createElementBlock(`p`,_hoisted_8$3,toDisplayString(__props.state.cancelInterruptsTurn?unref(t)(`jskit.assistant.goal.cancelInterruptsTurn`):unref(t)(`jskit.assistant.goal.cancelRemovesGoal`)),1)):createCommentVNode(``,true),canSet.value?(openBlock(),createElementBlock(`form`,{key:8,class:`assistant-goal__form mt-2`,onSubmit:withModifiers(setGoal,[`prevent`])},[createVNode(VTextarea,{modelValue:objective.value,"onUpdate:modelValue":_cache[3]||(_cache[3]=$event=>objective.value=$event),label:unref(t)(`jskit.assistant.goal.objective`),rows:`2`,"max-rows":`4`,maxlength:`4000`,"auto-grow":``,disabled:__props.state.pending,"hide-details":``},null,8,[`modelValue`,`label`,`disabled`]),__props.state.tokenBudgetSupported!==false?(openBlock(),createBlock(VTextField,{key:0,modelValue:tokenBudget.value,"onUpdate:modelValue":_cache[4]||(_cache[4]=$event=>tokenBudget.value=$event),label:unref(t)(`jskit.assistant.goal.tokenBudget`),type:`number`,min:`1`,step:`1`,disabled:__props.state.pending,error:!validBudget.value,"hide-details":``},null,8,[`modelValue`,`label`,`disabled`,`error`])):createCommentVNode(``,true),createVNode(VBtn,{type:`submit`,size:`small`,disabled:__props.state.pending||!objective.value.trim()||!validBudget.value},{default:withCtx(()=>[createTextVNode(toDisplayString(__props.state.action===`set`?unref(t)(`jskit.assistant.goal.starting`):unref(t)(`jskit.assistant.goal.start`)),1)]),_:1},8,[`disabled`])],32)):createCommentVNode(``,true),__props.state.error?(openBlock(),createElementBlock(`p`,_hoisted_9$3,toDisplayString(__props.state.error),1)):createCommentVNode(``,true),renderSlot(_ctx.$slots,`default`,{goal:goal.value},void 0,true)]),_:3})]),_:3},8,[`modelValue`])):createCommentVNode(``,true)}}};var AssistantGoalControl_default=_plugin_vue_export_helper_default(_sfc_main$5,[[`__scopeId`,`data-v-4be560c1`]]);var _hoisted_1$4=[`aria-busy`,`aria-label`];var _hoisted_2$4={class:`assistant-attachment-queue__summary`};var _hoisted_3$3={class:`assistant-attachment-queue__limit`};var _hoisted_4$2={class:`assistant-attachment-queue__items`};var _hoisted_5$2={class:`assistant-attachment-queue__content`};var _hoisted_6$2={class:`assistant-attachment-queue__primary`};var _hoisted_7$2={class:`assistant-attachment-queue__size`};var _hoisted_8$2={class:`assistant-attachment-queue__secondary`};var _hoisted_9$2={key:0};var _hoisted_10$2={key:0,"aria-hidden":`true`,class:`assistant-attachment-queue__progress assistant-attachment-queue__progress--stationary rounded-pill`};var _hoisted_11$1={key:2,class:`assistant-attachment-queue__error`,role:`alert`};var _hoisted_12$1={class:`assistant-attachment-queue__actions`};var _hoisted_13$1={class:`assistant-attachment-queue__announcement`,"aria-atomic":`true`,"aria-live":`polite`,role:`status`};var _sfc_main$4={__name:`AssistantAttachmentQueue`,props:{previewEnabled:Boolean,items:{default:()=>[],type:Array},joined:{default:true,type:Boolean},maximumFiles:{default:10,type:Number}},emits:[`cancel`,`remove`,`retry`,`preview`,`focus-input`],setup(__props,{emit:__emit}){const{t}=useJskitText();const emit=__emit;const props=__props;const activePhases=new Set([`queued`,`preparing`,`uploading`,`delivering`]);const queueRoot=ref(null);const reducedMotion=ref(false);const actionElements=new Map;let reducedMotionMediaQuery=null;const retainedItems=computed(()=>props.items.filter(item=>itemPhase(item)!==`cancelled`));const completedCount=computed(()=>props.items.filter(item=>itemPhase(item)===`ready`).length);const hasUnresolved=computed(()=>props.items.some(item=>activePhases.has(itemPhase(item))));const aggregatePercent=computed(()=>{if(!retainedItems.value.length)return 0;const totalSize=retainedItems.value.reduce((sum,item)=>sum+Math.max(0,Number(item.size)||0),0);if(retainedItems.value.some(item=>activePhases.has(itemPhase(item))&&itemPercent(item)===null))return null;if(totalSize<1)return Math.round(completedCount.value/retainedItems.value.length*100);const sent=retainedItems.value.reduce((sum,item)=>{if(itemPhase(item)===`ready`)return sum+Math.max(0,Number(item.size)||0);return sum+Math.min(Math.max(0,Number(item.bytesSent)||0),Math.max(0,Number(item.size)||0))},0);return Math.min(100,Math.max(0,Math.round(sent/totalSize*100)))});const aggregateLabel=computed(()=>{const total=retainedItems.value.length;const active=props.items.filter(item=>activePhases.has(itemPhase(item))).length;const failed=props.items.filter(item=>itemPhase(item)===`failed`).length;const cancelled=props.items.filter(item=>itemPhase(item)===`cancelled`).length;if(active)return aggregatePercent.value===null?t(`jskit.assistant.attachments.summary.inProgress`,{completed:completedCount.value,total}):t(`jskit.assistant.attachments.summary.percent`,{completed:completedCount.value,total,percent:aggregatePercent.value});if(failed)return t(`jskit.assistant.attachments.summary.needAttention`,{completed:completedCount.value,total,count:failed});if(cancelled)return t(`jskit.assistant.attachments.summary.cancelled`,{completed:completedCount.value,cancelled});return t(`jskit.assistant.attachments.summary.ready`,{completed:completedCount.value,total})});const announcement=computed(()=>{const messages=[];const failed=props.items.filter(item=>itemPhase(item)===`failed`).length;if(failed)messages.push(t(`jskit.assistant.attachments.announcement.needAttention`,{count:failed}));const active=props.items.filter(item=>activePhases.has(itemPhase(item))).length;if(active)messages.push(t(`jskit.assistant.attachments.announcement.inProgress`,{count:active}));const cancelled=props.items.filter(item=>itemPhase(item)===`cancelled`).length;if(cancelled)messages.push(t(`jskit.assistant.attachments.announcement.cancelled`,{count:cancelled}));if(completedCount.value)messages.push(t(`jskit.assistant.attachments.announcement.ready`,{count:completedCount.value}));return messages.join(` `)});function itemKey(item={}){return String(item.clientId||item.id||item.attachmentId||item.fileName||`attachment`)}function itemName(item={}){return String(item.fileName||item.file?.name||t(`jskit.assistant.attachments.unnamed`))}function itemPhase(item={}){return String(item.phase||item.status||`queued`)}function itemPercent(item={}){if(itemPhase(item)===`ready`)return 100;if(itemPhase(item)===`delivering`)return 100;if(itemPhase(item)===`queued`)return 0;const progressValue=item.percent??item.progress;const directPercent=progressValue===null||progressValue===void 0||progressValue===``?null:Number(progressValue);if(directPercent!==null&&Number.isFinite(directPercent))return Math.min(100,Math.max(0,Math.round(directPercent)));const size=Number(item.size)||0;return size>0&&Number(item.bytesSent)>0?Math.min(100,Math.max(0,Math.round((Number(item.bytesSent)||0)/size*100))):null}function itemProgressVisible(item={}){return activePhases.has(itemPhase(item))}function itemProgressIndeterminate(item={}){return itemProgressVisible(item)&&itemPercent(item)===null}function itemProgressValue(item={}){return itemPercent(item)??0}function itemProgressStationary(item={}){return reducedMotion.value&&itemProgressVisible(item)&&itemPercent(item)===null}function itemBytesLabel(item={}){const size=Math.max(0,Number(item.size)||0);const sent=Math.min(Math.max(0,Number(item.bytesSent)||0),size);const percent=itemPercent(item);return percent===null?t(`jskit.assistant.attachments.bytes`,{sent:attachmentSizeText(sent),size:attachmentSizeText(size)}):t(`jskit.assistant.attachments.bytesPercent`,{sent:attachmentSizeText(sent),size:attachmentSizeText(size),percent})}function itemStatusLabel(item={}){const labels={cancelled:`jskit.assistant.attachments.status.cancelled`,delivering:`jskit.assistant.attachments.status.delivering`,failed:item.failureStage===`preparing`?`jskit.assistant.attachments.status.preparationFailed`:item.failureStage===`handoff`?`jskit.assistant.attachments.status.sendingFailed`:`jskit.assistant.attachments.status.uploadFailed`,preparing:`jskit.assistant.attachments.status.preparing`,queued:`jskit.assistant.attachments.status.queued`,ready:`jskit.assistant.attachments.status.ready`,uploading:`jskit.assistant.attachments.status.uploading`};return t(Object.hasOwn(labels,itemPhase(item))?labels[itemPhase(item)]:`jskit.assistant.attachments.status.queued`)}function itemCancelable(item={}){return[`preparing`,`queued`,`uploading`].includes(itemPhase(item))}function actionKey(item={},action=``){return`${itemKey(item)}:${action}`}function actionElement(element=null){return element?.$el||element||null}function setActionElement(item={},action=``,element=null){const key=actionKey(item,action);if(element){actionElements.set(key,element);return}actionElements.delete(key)}function focusItemAction(item={}){for(const action of[`cancel`,`retry`,`remove`]){const target=actionElement(actionElements.get(actionKey(item,action)));if(target&&!target.disabled){target.focus?.();return true}}return false}async function handleAction(action,item,index){emit(action,item);await nextTick();const retainedItem=props.items.find(candidate=>itemKey(candidate)===itemKey(item));if(retainedItem&&focusItemAction(retainedItem))return;const neighbour=props.items[index]||props.items[index-1];if(neighbour&&focusItemAction(neighbour))return;emit(`focus-input`)}function itemIcon(item={}){if(itemPhase(item)===`ready`)return mdiCheckCircleOutline;if(itemPhase(item)===`failed`)return mdiAlertCircleOutline;return mdiFileOutline}function itemColor(item={}){if(itemPhase(item)===`ready`)return`success`;if(itemPhase(item)===`failed`)return`error`;return`primary`}function updateReducedMotionPreference(){reducedMotion.value=reducedMotionMediaQuery?.matches===true}if(typeof window!==`undefined`&&typeof window.matchMedia===`function`){reducedMotionMediaQuery=window.matchMedia(`(prefers-reduced-motion: reduce)`);updateReducedMotionPreference()}onMounted(()=>{if(!reducedMotionMediaQuery)return;if(typeof reducedMotionMediaQuery.addEventListener===`function`)reducedMotionMediaQuery.addEventListener(`change`,updateReducedMotionPreference);else reducedMotionMediaQuery.addListener?.(updateReducedMotionPreference)});onBeforeUnmount(()=>{if(typeof reducedMotionMediaQuery?.removeEventListener===`function`)reducedMotionMediaQuery.removeEventListener(`change`,updateReducedMotionPreference);else reducedMotionMediaQuery?.removeListener?.(updateReducedMotionPreference);reducedMotionMediaQuery=null});return(_ctx,_cache)=>{return __props.items.length?(openBlock(),createElementBlock(`section`,{key:0,ref_key:`queueRoot`,ref:queueRoot,class:normalizeClass([`assistant-attachment-queue`,{"assistant-attachment-queue--standalone":!__props.joined}]),"aria-busy":hasUnresolved.value?`true`:void 0,"aria-label":unref(t)(`jskit.assistant.attachments.queue`)},[createBaseVNode(`header`,_hoisted_2$4,[createBaseVNode(`span`,null,toDisplayString(aggregateLabel.value),1),createBaseVNode(`span`,_hoisted_3$3,toDisplayString(unref(t)(`jskit.assistant.attachments.limit`,{count:retainedItems.value.length,max:__props.maximumFiles})),1)]),createBaseVNode(`ol`,_hoisted_4$2,[(openBlock(true),createElementBlock(Fragment,null,renderList(__props.items,(item,index)=>{return openBlock(),createElementBlock(`li`,{key:itemKey(item),class:normalizeClass([`assistant-attachment-queue__item`,`assistant-attachment-queue__item--${itemPhase(item)}`])},[createVNode(VIcon,{class:`assistant-attachment-queue__icon`,color:itemColor(item),icon:itemIcon(item),size:`18`,"aria-hidden":`true`},null,8,[`color`,`icon`]),createBaseVNode(`div`,_hoisted_5$2,[createBaseVNode(`div`,_hoisted_6$2,[(openBlock(),createBlock(resolveDynamicComponent(item.attachmentId&&__props.previewEnabled?`button`:`span`),{type:item.attachmentId&&__props.previewEnabled?`button`:void 0,class:`assistant-attachment-queue__name`,title:itemName(item),onClick:$event=>item.attachmentId&&__props.previewEnabled&&emit(`preview`,item.receipt||item)},{default:withCtx(()=>[createTextVNode(toDisplayString(item.receipt?.reference)+` `+toDisplayString(itemName(item)),1)]),_:2},1032,[`type`,`title`,`onClick`])),createBaseVNode(`span`,_hoisted_7$2,toDisplayString(unref(attachmentSizeText)(item.size)),1)]),createBaseVNode(`div`,_hoisted_8$2,[createBaseVNode(`span`,null,toDisplayString(itemStatusLabel(item)),1),itemProgressVisible(item)?(openBlock(),createElementBlock(`span`,_hoisted_9$2,toDisplayString(itemBytesLabel(item)),1)):createCommentVNode(``,true)]),itemProgressStationary(item)?(openBlock(),createElementBlock(`div`,_hoisted_10$2)):itemProgressVisible(item)?(openBlock(),createBlock(VProgressLinear,{key:1,"aria-label":unref(t)(`jskit.assistant.attachments.uploadProgress`,{name:itemName(item)}),class:`assistant-attachment-queue__progress`,color:`primary`,height:`3`,indeterminate:itemProgressIndeterminate(item),"model-value":itemProgressValue(item),rounded:``},null,8,[`aria-label`,`indeterminate`,`model-value`])):createCommentVNode(``,true),item.error?(openBlock(),createElementBlock(`span`,_hoisted_11$1,toDisplayString(item.error),1)):createCommentVNode(``,true)]),createBaseVNode(`div`,_hoisted_12$1,[itemCancelable(item)?(openBlock(),createBlock(VBtn,{key:0,ref_for:true,ref:element=>setActionElement(item,`cancel`,element),"aria-label":unref(t)(`jskit.assistant.attachments.cancelItem`,{name:itemName(item)}),class:`assistant-attachment-queue__action`,icon:unref(mdiCloseCircleOutline),size:`small`,title:unref(t)(`jskit.assistant.attachments.cancelItem`,{name:itemName(item)}),type:`button`,variant:`text`,onClick:$event=>handleAction(`cancel`,item,index)},null,8,[`aria-label`,`icon`,`title`,`onClick`])):createCommentVNode(``,true),itemPhase(item)===`failed`||itemPhase(item)===`cancelled`?(openBlock(),createBlock(VBtn,{key:1,ref_for:true,ref:element=>setActionElement(item,`retry`,element),"aria-label":unref(t)(`jskit.assistant.attachments.retryItem`,{name:itemName(item)}),class:`assistant-attachment-queue__action`,icon:unref(mdiRefresh),size:`small`,title:unref(t)(`jskit.assistant.attachments.retryItem`,{name:itemName(item)}),type:`button`,variant:`text`,onClick:$event=>handleAction(`retry`,item,index)},null,8,[`aria-label`,`icon`,`title`,`onClick`])):createCommentVNode(``,true),itemPhase(item)===`ready`||itemPhase(item)===`failed`||itemPhase(item)===`cancelled`?(openBlock(),createBlock(VBtn,{key:2,ref_for:true,ref:element=>setActionElement(item,`remove`,element),"aria-label":unref(t)(`jskit.assistant.attachments.removeItem`,{name:itemName(item)}),class:`assistant-attachment-queue__action`,icon:unref(mdiClose),size:`small`,title:unref(t)(`jskit.assistant.attachments.removeItem`,{name:itemName(item)}),type:`button`,variant:`text`,onClick:$event=>handleAction(`remove`,item,index)},null,8,[`aria-label`,`icon`,`title`,`onClick`])):createCommentVNode(``,true)])],2)}),128))]),createBaseVNode(`span`,_hoisted_13$1,toDisplayString(announcement.value),1)],10,_hoisted_1$4)):createCommentVNode(``,true)}}};var AssistantAttachmentQueue_default=_plugin_vue_export_helper_default(_sfc_main$4,[[`__scopeId`,`data-v-1bd38277`]]);var _hoisted_1$3=[`aria-label`];var _hoisted_2$3={class:`assistant-questions__question-fields-header`};var _hoisted_3$2=[`aria-label`];var _sfc_main$3={__name:`AssistantQuestionInputs`,props:mergeModels({questions:{type:Array,default:()=>[]},selectItems:{type:Object,default:()=>({})},choices:{type:Array,default:()=>[]}},{"answers":{type:Object,default:()=>({})},"answersModifiers":{},"choice":{type:String,default:``},"choiceModifiers":{}}),emits:mergeModels([`dismiss`],[`update:answers`,`update:choice`]),setup(__props,{emit:__emit}){const{t}=useJskitText();const answers=useModel(__props,`answers`);const choice=useModel(__props,`choice`);const emit=__emit;return(_ctx,_cache)=>{return __props.questions.length?(openBlock(),createElementBlock(`div`,{key:0,class:`assistant-questions__question-fields`,"aria-label":unref(t)(`jskit.assistant.questions.label`)},[createBaseVNode(`div`,_hoisted_2$3,[createVNode(VBtn,{"aria-label":unref(t)(`jskit.assistant.questions.answerNormally`),class:`ml-auto`,color:`primary`,"prepend-icon":unref(mdiPencilOutline),size:`small`,variant:`tonal`,onClick:_cache[0]||(_cache[0]=$event=>emit(`dismiss`))},{default:withCtx(()=>[createTextVNode(toDisplayString(unref(t)(`jskit.assistant.questions.answerNormally`)),1)]),_:1},8,[`aria-label`,`prepend-icon`])]),(openBlock(true),createElementBlock(Fragment,null,renderList(__props.questions,question=>{return openBlock(),createElementBlock(`div`,{key:question.name,class:`assistant-questions__question-field`},[question.choices.length?(openBlock(),createBlock(VSelect,{key:0,"model-value":answers.value[question.name],"onUpdate:modelValue":$event=>answers.value={...answers.value,[question.name]:$event},class:`assistant-questions__question-select`,density:`compact`,"hide-details":`auto`,"item-title":`selectLabel`,"item-value":`value`,items:__props.selectItems[question.name]||question.choices,label:unref(t)(`jskit.assistant.questions.fieldLabel`,{number:question.number,label:question.label}),title:question.label,variant:`outlined`},null,8,[`model-value`,`onUpdate:modelValue`,`items`,`label`,`title`])):(openBlock(),createBlock(VTextField,{key:1,"model-value":answers.value[question.name],"onUpdate:modelValue":$event=>answers.value={...answers.value,[question.name]:$event},autocomplete:`off`,density:`compact`,"hide-details":`auto`,label:unref(t)(`jskit.assistant.questions.fieldLabel`,{number:question.number,label:question.label}),title:question.label,variant:`outlined`},null,8,[`model-value`,`onUpdate:modelValue`,`label`,`title`]))])}),128))],8,_hoisted_1$3)):__props.choices.length?(openBlock(),createElementBlock(`div`,{key:1,class:`assistant-questions__answer-choices`,"aria-label":unref(t)(`jskit.assistant.questions.suggestedAnswers`)},[createVNode(VChipGroup,{modelValue:choice.value,"onUpdate:modelValue":_cache[1]||(_cache[1]=$event=>choice.value=$event),column:``,"selected-class":`text-primary`},{default:withCtx(()=>[(openBlock(true),createElementBlock(Fragment,null,renderList(__props.choices,option=>{return openBlock(),createBlock(VChip,{key:option.value,filter:``,value:option.value,variant:`outlined`},{default:withCtx(()=>[createTextVNode(toDisplayString(option.label),1)]),_:2},1032,[`value`])}),128))]),_:1},8,[`modelValue`])],8,_hoisted_3$2)):createCommentVNode(``,true)}}};var AssistantQuestionInputs_default=_plugin_vue_export_helper_default(_sfc_main$3,[[`__scopeId`,`data-v-30de29c0`]]);var _hoisted_1$2={class:`assistant-model-control__header`};var _hoisted_2$2={class:`text-title-small`};var _hoisted_3$1={class:`text-body-small`};var _hoisted_4$1=[`aria-label`];var _hoisted_5$1={key:2,class:`assistant-model-control__state`,role:`alert`};var _hoisted_6$1={key:3,class:`assistant-model-control__state`,role:`status`};var _hoisted_7$1={key:4,class:`assistant-model-control__choices`};var _hoisted_8$1=[`aria-label`];var _hoisted_9$1={class:`assistant-model-control__label`};var _hoisted_10$1={class:`assistant-model-control__options`};var _hoisted_11=[`aria-label`];var _hoisted_12={class:`assistant-model-control__label`};var _hoisted_13={key:1,class:`assistant-model-control__options`};var _hoisted_14={key:2,class:`assistant-model-control__empty`};var _hoisted_15=[`aria-label`];var _hoisted_16={class:`assistant-model-control__label`};var _hoisted_17={class:`assistant-model-control__options`};var _hoisted_18={class:`assistant-model-control__actions`};var _sfc_main$2={__name:`AssistantModelControl`,props:mergeModels({providerRows:{type:Array,default:()=>[]},modelRows:{type:Array,default:()=>[]},variantRows:{type:Array,default:()=>[]},modelProviderId:{type:String,default:``},modelId:{type:String,default:``},variantId:{type:String,default:``},selectionSummary:{type:String,default:``},buttonTitle:{type:String,default:void 0},changesDisabled:Boolean,saving:Boolean,canSave:Boolean,catalogLoading:Boolean,catalogError:{type:String,default:``}},{"modelValue":{type:Boolean,default:false},"modelModifiers":{}}),emits:mergeModels([`select-provider`,`select-model`,`select-variant`,`apply`,`reload`],[`update:modelValue`]),setup(__props,{emit:__emit}){const{t}=useJskitText();const menuOpen=useModel(__props,`modelValue`);const props=__props;const emit=__emit;function selectProvider(value){if(!props.changesDisabled&&!props.saving)emit(`select-provider`,value)}function selectModel(value){if(!props.changesDisabled&&!props.saving)emit(`select-model`,value)}function selectVariant(value){if(!props.changesDisabled&&!props.saving)emit(`select-variant`,value)}return(_ctx,_cache)=>{return openBlock(),createBlock(VMenu,{modelValue:menuOpen.value,"onUpdate:modelValue":_cache[2]||(_cache[2]=$event=>menuOpen.value=$event),"close-on-content-click":false,location:`top start`,transition:`scale-transition`},{activator:withCtx(({props:menuProps})=>[createVNode(VBtn,mergeProps(menuProps,{"aria-label":unref(t)(`jskit.assistant.model.chooseAi`),class:`assistant-model-control__button`,density:`comfortable`,icon:unref(mdiCogOutline),rounded:`lg`,size:`small`,title:__props.buttonTitle??unref(t)(`jskit.assistant.model.chooseAi`),type:`button`,variant:`tonal`}),null,16,[`aria-label`,`icon`,`title`])]),default:withCtx(()=>[createVNode(VSheet,{"aria-label":unref(t)(`jskit.assistant.model.selector`),border:``,class:`assistant-model-control`,elevation:3,rounded:`xl`},{default:withCtx(()=>[createBaseVNode(`header`,_hoisted_1$2,[createVNode(VAvatar,{color:`primary`,size:`36`,variant:`tonal`},{default:withCtx(()=>[createVNode(VIcon,{icon:unref(mdiBrain),size:`20`},null,8,[`icon`])]),_:1}),createBaseVNode(`div`,null,[createBaseVNode(`strong`,_hoisted_2$2,toDisplayString(unref(t)(`jskit.assistant.model.controls`)),1),createBaseVNode(`span`,_hoisted_3$1,toDisplayString(__props.selectionSummary),1)])]),__props.changesDisabled?(openBlock(),createBlock(VSheet,{key:0,class:`assistant-model-control__view-only`,rounded:`lg`,role:`status`},{default:withCtx(()=>[createVNode(VIcon,{icon:unref(mdiClockOutline),size:`18`},null,8,[`icon`]),createBaseVNode(`span`,null,toDisplayString(unref(t)(`jskit.assistant.model.viewOnly`)),1)]),_:1})):createCommentVNode(``,true),__props.catalogLoading?(openBlock(),createElementBlock(`div`,{key:1,"aria-label":unref(t)(`jskit.assistant.model.loading`),class:`assistant-model-control__loading`},[createVNode(VSkeletonLoader,{type:`text, chip@4, text, chip@4`})],8,_hoisted_4$1)):__props.catalogError?(openBlock(),createElementBlock(`div`,_hoisted_5$1,[createBaseVNode(`span`,null,toDisplayString(__props.catalogError),1),createVNode(VBtn,{size:`small`,variant:`text`,onClick:_cache[0]||(_cache[0]=$event=>emit(`reload`))},{default:withCtx(()=>[createTextVNode(toDisplayString(unref(t)(`jskit.assistant.model.tryAgain`)),1)]),_:1})])):!__props.providerRows.length?(openBlock(),createElementBlock(`div`,_hoisted_6$1,toDisplayString(unref(t)(`jskit.assistant.model.noneConfigured`)),1)):(openBlock(),createElementBlock(`div`,_hoisted_7$1,[renderSlot(_ctx.$slots,`before-choices`,{},void 0,true),__props.providerRows.length>1?(openBlock(),createElementBlock(`section`,{key:0,"aria-label":unref(t)(`jskit.assistant.model.provider`),class:`assistant-model-control__section`},[createBaseVNode(`div`,_hoisted_9$1,toDisplayString(unref(t)(`jskit.assistant.model.provider`)),1),createBaseVNode(`div`,_hoisted_10$1,[(openBlock(true),createElementBlock(Fragment,null,renderList(__props.providerRows,provider=>{return openBlock(),createBlock(VBtn,{key:provider.id,active:__props.modelProviderId===provider.id,"aria-pressed":__props.modelProviderId===provider.id,class:`assistant-model-control__option`,color:__props.modelProviderId===provider.id?`primary`:void 0,disabled:__props.changesDisabled||__props.saving,rounded:`lg`,size:`small`,type:`button`,variant:__props.modelProviderId===provider.id?`tonal`:`outlined`,onClick:$event=>selectProvider(provider.id)},{default:withCtx(()=>[createBaseVNode(`span`,null,toDisplayString(provider.label),1),__props.modelProviderId===provider.id?(openBlock(),createBlock(VIcon,{key:0,icon:unref(mdiCheck),size:`15`},null,8,[`icon`])):createCommentVNode(``,true)]),_:2},1032,[`active`,`aria-pressed`,`color`,`disabled`,`variant`,`onClick`])}),128))])],8,_hoisted_8$1)):createCommentVNode(``,true),createBaseVNode(`section`,{"aria-label":unref(t)(`jskit.assistant.model.model`),class:`assistant-model-control__section`},[createBaseVNode(`div`,_hoisted_12,toDisplayString(unref(t)(`jskit.assistant.model.model`)),1),__props.modelRows.length>6?(openBlock(),createBlock(VAutocomplete,{key:0,"auto-select-first":`exact`,"hide-details":``,disabled:__props.changesDisabled||__props.saving,items:__props.modelRows,"item-title":`label`,"item-value":`id`,label:unref(t)(`jskit.assistant.model.chooseModel`),"model-value":__props.modelId,"no-data-text":unref(t)(`jskit.assistant.model.noMatchingModels`),variant:`outlined`,"onUpdate:modelValue":selectModel},null,8,[`disabled`,`items`,`label`,`model-value`,`no-data-text`])):__props.modelRows.length?(openBlock(),createElementBlock(`div`,_hoisted_13,[(openBlock(true),createElementBlock(Fragment,null,renderList(__props.modelRows,model=>{return openBlock(),createBlock(VBtn,{key:model.id,active:__props.modelId===model.id,"aria-label":model.label,"aria-pressed":__props.modelId===model.id,class:`assistant-model-control__option`,color:__props.modelId===model.id?`primary`:void 0,disabled:__props.changesDisabled||__props.saving,rounded:`lg`,size:`small`,title:__props.changesDisabled?unref(t)(`jskit.assistant.model.waitBeforeChanging`):model.label,type:`button`,variant:__props.modelId===model.id?`tonal`:`outlined`,onClick:$event=>selectModel(model.id)},{default:withCtx(()=>[createBaseVNode(`span`,null,toDisplayString(model.label),1),__props.modelId===model.id?(openBlock(),createBlock(VIcon,{key:0,icon:unref(mdiCheck),size:`15`},null,8,[`icon`])):createCommentVNode(``,true)]),_:2},1032,[`active`,`aria-label`,`aria-pressed`,`color`,`disabled`,`title`,`variant`,`onClick`])}),128))])):(openBlock(),createElementBlock(`span`,_hoisted_14,toDisplayString(unref(t)(`jskit.assistant.model.noModels`)),1)),renderSlot(_ctx.$slots,`model-note`,{},void 0,true)],8,_hoisted_11),renderSlot(_ctx.$slots,`provider-controls`,{},void 0,true),__props.variantRows.length>1?(openBlock(),createElementBlock(`section`,{key:1,"aria-label":unref(t)(`jskit.assistant.model.thinking`),class:`assistant-model-control__section`},[createBaseVNode(`div`,_hoisted_16,toDisplayString(unref(t)(`jskit.assistant.model.thinking`)),1),createBaseVNode(`div`,_hoisted_17,[(openBlock(true),createElementBlock(Fragment,null,renderList(__props.variantRows,variant=>{return openBlock(),createBlock(VBtn,{key:variant.id||`automatic`,active:__props.variantId===variant.id,"aria-pressed":__props.variantId===variant.id,class:`assistant-model-control__option`,color:__props.variantId===variant.id?`primary`:void 0,disabled:__props.changesDisabled||__props.saving,rounded:`lg`,size:`small`,type:`button`,variant:__props.variantId===variant.id?`tonal`:`outlined`,onClick:$event=>selectVariant(variant.id)},{default:withCtx(()=>[createBaseVNode(`span`,null,toDisplayString(variant.label),1),__props.variantId===variant.id?(openBlock(),createBlock(VIcon,{key:0,icon:unref(mdiCheck),size:`15`},null,8,[`icon`])):createCommentVNode(``,true)]),_:2},1032,[`active`,`aria-pressed`,`color`,`disabled`,`variant`,`onClick`])}),128))])],8,_hoisted_15)):createCommentVNode(``,true)])),createBaseVNode(`footer`,_hoisted_18,[renderSlot(_ctx.$slots,`footer`,{},void 0,true),_cache[3]||(_cache[3]=createBaseVNode(`span`,null,null,-1)),createVNode(VBtn,{color:`primary`,disabled:!__props.canSave||__props.saving,size:`small`,variant:`flat`,onClick:_cache[1]||(_cache[1]=$event=>emit(`apply`))},{default:withCtx(()=>[createTextVNode(toDisplayString(__props.saving?unref(t)(`jskit.assistant.model.applying`):unref(t)(`jskit.assistant.model.apply`)),1)]),_:1},8,[`disabled`])])]),_:3},8,[`aria-label`])]),_:3},8,[`modelValue`])}}};var AssistantModelControl_default=_plugin_vue_export_helper_default(_sfc_main$2,[[`__scopeId`,`data-v-da8711cd`]]);var _hoisted_1$1=[`aria-label`];var _hoisted_2$1=[`aria-label`];var _hoisted_3={class:`assistant-conversation__avatar-size-disc`};var _hoisted_4={class:`assistant-conversation__avatar-presentation`};var _hoisted_5={class:`assistant-conversation__avatar-tools`};var _hoisted_6={class:`assistant-conversation__avatar-size-disc assistant-conversation__avatar-size-disc--minimise`};var _hoisted_7={key:0,class:`assistant-conversation__preview-actions`};var _hoisted_8={key:1,class:`assistant-conversation__goal`};var _hoisted_9=[`accept`,`disabled`];var _hoisted_10={key:0,role:`alert`,class:`assistant-conversation__attachment-error`};var _sfc_main$1={__name:`AssistantConversationElement`,props:{adapter:{type:Object,required:true},avatarSize:{type:String,default:`compact`,validator:value=>[`hidden`,`compact`,`standard`,`large`].includes(value)},label:{type:String,default:void 0},configuration:{type:Object,default:()=>({})},configurationFields:{type:Array,default:()=>[]},configurationMode:{type:String,default:`hidden`,validator:value=>[`hidden`,`readonly`,`editable`].includes(value)}},emits:[`update:avatarSize`],setup(__props,{expose:__expose,emit:__emit}){const{t}=useJskitText();const props=__props;const emit=__emit;const slots=useSlots();const container=ref(null);const avatarControls=ref(null);const visibleAvatarSize=ref(`compact`);watch(()=>props.avatarSize,size=>{if(size!==`hidden`)visibleAvatarSize.value=size},{immediate:true});function toggleAvatar(){emit(`update:avatarSize`,props.avatarSize===`hidden`?visibleAvatarSize.value:`hidden`)}const avatarSizes=[{value:`hidden`,height:0},{value:`compact`,height:96},{value:`standard`,height:112},{value:`large`,height:176}];const avatarSpace=ref(0);const avatarHeight=computed(()=>Math.min(avatarSpace.value,avatarSizes.find(size=>size.value===props.avatarSize).height));let avatarObserver;const observedAvatarElements=new Set;function measureAvatarSpace(){const root=container.value;if(!root||!slots.avatar)return;const warning=root.querySelector(`.assistant-transcript__error`);const warningBottom=warning?warning.getBoundingClientRect().bottom-root.getBoundingClientRect().top+root.scrollTop:0;root.style.setProperty(`--assistant-conversation-warning-bottom`,`${warningBottom}px`);const rootStyle=getComputedStyle(root);let occupied=parseFloat(rootStyle.paddingTop)+parseFloat(rootStyle.paddingBottom);for(const element of observedAvatarElements){if(element===root)continue;const style=getComputedStyle(element);occupied+=element.getBoundingClientRect().height+parseFloat(style.marginTop)+parseFloat(style.marginBottom)}avatarSpace.value=Math.max(0,root.clientHeight-occupied-120)}function observeAvatarSpace(){if(!container.value||!slots.avatar){avatarObserver?.disconnect();observedAvatarElements.clear();return}avatarObserver||=new ResizeObserver(measureAvatarSpace);const fixedElements=Array.from(container.value.children).filter(element=>!element.classList.contains(`assistant-conversation__avatar`)&&!element.classList.contains(`assistant-conversation__transcript`));const elements=new Set([container.value,...fixedElements]);if(avatarControls.value)elements.add(avatarControls.value);const warning=container.value.querySelector(`.assistant-transcript__error`);if(warning)elements.add(warning);for(const element of observedAvatarElements)if(!elements.has(element)){avatarObserver.unobserve(element);observedAvatarElements.delete(element)}for(const element of elements)if(!observedAvatarElements.has(element)){avatarObserver.observe(element);observedAvatarElements.add(element)}measureAvatarSpace()}onMounted(observeAvatarSpace);onUpdated(observeAvatarSpace);onBeforeUnmount(()=>avatarObserver?.disconnect());const transcriptSlots=computed(()=>[`welcome`,`attachments`,`system-message`,`message-actions`].filter(name=>slots[name]));const input=ref(null);const fileInput=ref(null);const modelsOpen=ref(false);const delivery=ref(null);const statusId=`assistant-status-${useId()}`;const conversation=computed(()=>{const saved=props.adapter.conversation;if(!props.adapter.delivery&&!saved.previewMessage&&!saved.previewMessages?.length&&!saved.interimReply)return saved;const{previewMessage,previewMessages,interimReply,...display}=saved;let turns=props.adapter.delivery?props.adapter.delivery.turns(saved.turns||[]):saved.turns||[];if(interimReply?.text&&interimReply.turnId){const assistant={...interimReply,messageId:interimReply.id,role:`assistant`};turns=turns.map(turn=>turn.turnId!==interimReply.turnId?turn:{...turn,assistant,commentary:(turn.commentary||[]).filter(message=>(message.outputId||message.messageId)!==(interimReply.outputId||interimReply.id)),...Array.isArray(turn.messages)?{messages:turn.messages.filter(message=>message.role!==`assistant`&&(message.outputId||message.messageId)!==(interimReply.outputId||interimReply.id)).concat(assistant)}:{}})}const previews=Array.isArray(previewMessages)?previewMessages:previewMessage?[previewMessage]:[];for(const preview of previews){const messageId=String(preview?.messageId||preview?.id||``).trim();const localDelivery=messageId&&props.adapter.delivery?.find?.(messageId);if((!localDelivery||localDelivery.status===`failed`)&&preview?.actions?.send)turns=turns.map(turn=>{const failed=turn.optimistic?.id===messageId&&turn.optimistic.status===`failed`;const unadmitted=turn.user?.receipt===false&&String(turn.user.messageId||turn.user.id||``)===messageId;if(!failed&&!unadmitted)return turn;return{...turn,preview:true,previewMessage:preview,user:{...turn.user,text:String(preview.text||``)}}});const alreadyShown=messageId&&(localDelivery||turns.some(turn=>[turn.system,turn.user,turn.assistant,...turn.thinking||[],...turn.commentary||[],...turn.messages||[]].some(message=>String(message?.messageId||message?.id||``)===messageId&&(message.receipt!==false||turn.preview))));if(messageId&&(preview?.text||preview?.actions?.editing)&&!alreadyShown){const user={messageId,role:`user`,text:String(preview.text||``)};turns=[...turns,{turnId:messageId,user,messages:[user],preview:true,previewMessage:preview,optimistic:{id:messageId,status:`pending`}}]}}return{...display,turns,welcomeMessage:turns.length?``:saved.welcomeMessage}});watch([()=>props.adapter.delivery,()=>props.adapter.conversation.turns],([controller,turns])=>{controller?.reconcile(turns||[])},{immediate:true});const pending=computed(()=>Boolean(props.adapter.delivery?.state.sending||props.adapter.composer?.pending));const queueWhileSending=computed(()=>props.adapter.composer?.queueWhileSending===true);const working=computed(()=>conversation.value.working??(!pending.value&&Boolean(props.adapter.composer?.canStop||conversation.value.turns?.some(turn=>turn.pending))));const activity=computed(()=>props.adapter.activity??{label:props.adapter.composer?.stopPending?t(`jskit.assistant.composer.stopping`):pending.value?t(`jskit.assistant.chat.sendingToAssistant`):working.value?t(`jskit.assistant.chat.working`):``});const suggestionPreview=computed(()=>!props.adapter.composer?.draft&&props.adapter.suggestions?.visible?props.adapter.suggestions.preview:``);const attachmentsEnabled=computed(()=>props.adapter.attachments&&props.adapter.attachments.enabled!==false);const attachmentState=computed(()=>({count:attachmentsEnabled.value?props.adapter.attachments.queueItems?.length||0:0,canSubmit:!attachmentsEnabled.value||props.adapter.attachments.canSubmit!==false}));const canSend=computed(()=>(!pending.value||queueWhileSending.value&&attachmentState.value.count===0)&&props.adapter.composer?.canSend&&attachmentState.value.canSubmit);async function resend(id){if(props.adapter.actions?.resend)return props.adapter.actions.resend(id);const controller=props.adapter.delivery;const payload=controller?.find(id)?.payload;const attachments=props.adapter.attachments;try{const response=await controller?.resend(id,{queue:queueWhileSending.value});clearAcceptedAttachments(response,payload,attachments);return response}catch{}}function cancel(id){return props.adapter.actions?.cancel?props.adapter.actions.cancel(id):props.adapter.delivery?.cancel(id)}function edit(id){if(props.adapter.actions?.edit)return props.adapter.actions.edit(id);if(!props.adapter.actions?.setDraft)return;const draft=props.adapter.delivery?.edit(id,props.adapter.composer?.draft||``);if(draft!=null){props.adapter.actions.setDraft(draft);input.value?.focus()}}function attachmentEvent(method,event){if(attachmentsEnabled.value)return props.adapter.attachments[method]?.(event)}function attachSelectedFiles(event){const files=Array.from(event.target.files||[]);event.target.value=``;if(attachmentsEnabled.value&&props.adapter.attachments.canAddFiles)return props.adapter.attachments.uploadFiles(files)}async function applyModel(){if(await props.adapter.models.apply()!==false)modelsOpen.value=false}function selectSuggestion(value){if(props.adapter.suggestions?.select(value)!==false)input.value?.focus()}function dismissSuggestions(){props.adapter.suggestions?.dismiss();input.value?.focus()}function clearAcceptedAttachments(response,payload,attachments){if(response!==false&&response?.ok!==false&&payload?.attachmentIds?.length)attachments?.clearAttachments({accepted:true,attachmentIds:payload.attachmentIds})}async function submit(){if(!canSend.value)return;const attachments=props.adapter.attachments;const files=attachmentsEnabled.value?props.adapter.attachments.attachments.map(item=>({...item})):[];if(props.adapter.actions?.submit)return props.adapter.actions.submit({configuration:props.configuration,attachments:files});const controller=props.adapter.delivery;if(!controller||!props.adapter.actions?.setDraft)return;const message=String(props.adapter.composer.draft||``).trim()||(files.length?props.adapter.composer.attachmentMessage||t(`jskit.assistant.chat.reviewAttachedFiles`):``);if(!message)return;const payload={...props.adapter.composer.payload,configuration:{...props.configuration},message,...files.length?{attachmentIds:files.map(file=>file.attachmentId),displayAttachments:files}:{}};props.adapter.actions.setDraft(``);try{const response=await controller.send(payload,{queue:queueWhileSending.value});clearAcceptedAttachments(response,payload,attachments);return response}catch{return false}}function stop(){const state=props.adapter.composer;if(!state?.canStop||state.stopDisabled||state.stopPending)return;return props.adapter.actions.stop()}function updateConfiguration(value){if(props.configurationMode!==`editable`||pending.value)return;return props.adapter.actions?.updateConfiguration?.(value)}__expose({focus:()=>input.value?.focus(),submit,stop});return(_ctx,_cache)=>{return openBlock(),createElementBlock(`section`,{ref_key:`container`,ref:container,class:normalizeClass([`assistant-conversation`,{"assistant-conversation--error":conversation.value.error}]),"aria-label":__props.label??unref(t)(`jskit.assistant.chat.label`)},[_ctx.$slots.avatar?(openBlock(),createElementBlock(`section`,{key:0,class:normalizeClass([`assistant-conversation__avatar`,{"assistant-conversation__avatar--hidden":__props.avatarSize===`hidden`}]),"aria-label":unref(t)(`jskit.assistant.chat.avatar`)},[withDirectives(createBaseVNode(`div`,{ref_key:`avatarControls`,ref:avatarControls,class:`assistant-conversation__avatar-controls`},[renderSlot(_ctx.$slots,`avatar-control`,{size:__props.avatarSize,height:avatarHeight.value},void 0,true),createVNode(VBtn,{icon:unref(mdiAccountCircleOutline),size:`small`,variant:`text`,width:44,"min-width":44,"min-height":44,class:`assistant-conversation__avatar-size`,"aria-label":unref(t)(`jskit.assistant.chat.showAvatar`),title:unref(t)(`jskit.assistant.chat.showAvatar`),"aria-expanded":__props.avatarSize!==`hidden`,onClick:toggleAvatar},{default:withCtx(()=>[createBaseVNode(`span`,_hoisted_3,[createVNode(VIcon,{size:`20`,icon:unref(mdiAccountCircleOutline)},null,8,[`icon`])])]),_:1},8,[`icon`,`aria-label`,`title`,`aria-expanded`])],512),[[vShow,__props.avatarSize===`hidden`]]),withDirectives(createBaseVNode(`div`,_hoisted_4,[__props.avatarSize!==`hidden`?(openBlock(),createElementBlock(`div`,{key:0,class:`assistant-conversation__avatar-visual`,style:normalizeStyle({height:`${avatarHeight.value}px`,width:`${avatarHeight.value}px`})},[renderSlot(_ctx.$slots,`avatar`,{size:__props.avatarSize,height:avatarHeight.value},void 0,true)],4)):createCommentVNode(``,true),createBaseVNode(`div`,_hoisted_5,[renderSlot(_ctx.$slots,`avatar-tools`,{size:__props.avatarSize,height:avatarHeight.value},void 0,true),createVNode(VBtn,{icon:unref(mdiMinus),size:`small`,variant:`text`,color:`primary`,width:40,"min-width":40,"min-height":44,class:`assistant-conversation__avatar-size`,"aria-label":unref(t)(`jskit.assistant.chat.minimiseAvatar`),title:unref(t)(`jskit.assistant.chat.minimiseAvatar`),"aria-expanded":true,onClick:toggleAvatar},{default:withCtx(()=>[createBaseVNode(`span`,_hoisted_6,[createVNode(VIcon,{size:`20`,icon:unref(mdiMinus)},null,8,[`icon`])])]),_:1},8,[`icon`,`aria-label`,`title`])])],512),[[vShow,__props.avatarSize!==`hidden`]])],10,_hoisted_2$1)):createCommentVNode(``,true),createVNode(AssistantTranscript_default,mergeProps(conversation.value,{"preview-message":__props.adapter.conversation.previewMessage||null,working:working.value,class:`assistant-conversation__transcript`,onLoadMore:_cache[0]||(_cache[0]=$event=>__props.adapter.actions?.loadMore?.($event)),onReload:_cache[1]||(_cache[1]=$event=>__props.adapter.actions?.reload?.()),onResendTurn:_cache[2]||(_cache[2]=$event=>resend($event)),onCancelTurn:_cache[3]||(_cache[3]=$event=>cancel($event)),onCheckDelivery:_cache[4]||(_cache[4]=$event=>__props.adapter.actions?.checkDelivery?.($event)),onEditTurn:_cache[5]||(_cache[5]=$event=>edit($event)),onLinkClick:_cache[6]||(_cache[6]=$event=>__props.adapter.actions?.openLink?.($event))}),createSlots({"user-message-actions":withCtx(scope=>[scope.turn.preview&&scope.turn.previewMessage?.actions?(openBlock(),createElementBlock(`div`,_hoisted_7,[scope.turn.previewMessage.actions.discard?(openBlock(),createBlock(VBtn,{key:0,icon:unref(mdiClose),size:`small`,variant:`text`,"aria-label":unref(t)(`jskit.assistant.chat.discardUnsent`),title:unref(t)(`jskit.assistant.chat.discardUnsent`),disabled:!scope.turn.previewMessage.actions.canDiscard,onClick:$event=>scope.turn.previewMessage.actions.discard(scope.turn.turnId)},null,8,[`icon`,`aria-label`,`title`,`disabled`,`onClick`])):createCommentVNode(``,true),scope.turn.previewMessage.actions.edit?(openBlock(),createBlock(VBtn,{key:1,icon:unref(mdiPencil),size:`small`,variant:`text`,"aria-label":unref(t)(`jskit.assistant.chat.editUnsent`),title:unref(t)(`jskit.assistant.chat.editUnsent`),disabled:!scope.turn.previewMessage.actions.canEdit,onClick:$event=>scope.turn.previewMessage.actions.edit(scope.turn.turnId)},null,8,[`icon`,`aria-label`,`title`,`disabled`,`onClick`])):createCommentVNode(``,true),scope.turn.previewMessage.actions.send?(openBlock(),createBlock(VBtn,{key:2,size:`small`,color:`primary`,disabled:!scope.turn.previewMessage.actions.canSend,onClick:$event=>scope.turn.previewMessage.actions.send(scope.turn.turnId)},{default:withCtx(()=>[createTextVNode(toDisplayString(scope.turn.previewMessage.actions.sending?unref(t)(`jskit.assistant.composer.sending`):unref(t)(`jskit.assistant.composer.send`)),1)]),_:2},1032,[`disabled`,`onClick`])):createCommentVNode(``,true)])):createCommentVNode(``,true),renderSlot(_ctx.$slots,`user-message-actions`,normalizeProps(guardReactiveProps(scope)),void 0,true)]),_:2},[renderList(transcriptSlots.value,name=>{return{name,fn:withCtx(scope=>[renderSlot(_ctx.$slots,name,normalizeProps(guardReactiveProps(scope)),void 0,true)])}})]),1040,[`preview-message`,`working`]),__props.adapter.goal&&__props.adapter.goal.enabled!==false?(openBlock(),createElementBlock(`div`,_hoisted_8,[createVNode(AssistantGoalControl_default,{state:__props.adapter.goal},null,8,[`state`])])):createCommentVNode(``,true),!_ctx.$slots.hints&&(__props.adapter.composer||activity.value.label||__props.adapter.suggestions)?(openBlock(),createBlock(AssistantComposerSupport_default,{key:2,activity:activity.value,"status-id":statusId,loading:__props.adapter.suggestions?.visible&&__props.adapter.suggestions.loading,suggestions:__props.adapter.suggestions?.visible?__props.adapter.suggestions.items:[],onPreview:_cache[7]||(_cache[7]=$event=>__props.adapter.suggestions?.previewSuggestion($event)),onSelect:selectSuggestion,onDismiss:dismissSuggestions},createSlots({_:2},[_ctx.$slots.activity?{name:`activity`,fn:withCtx(scope=>[renderSlot(_ctx.$slots,`activity`,normalizeProps(guardReactiveProps(scope)),void 0,true)]),key:`0`}:void 0]),1032,[`activity`,`loading`,`suggestions`])):createCommentVNode(``,true),renderSlot(_ctx.$slots,`hints`,{adapter:__props.adapter},void 0,true),renderSlot(_ctx.$slots,`composer`,{adapter:__props.adapter},()=>[__props.adapter.composer?(openBlock(),createBlock(AssistantPromptInput_default,mergeProps({key:0,ref_key:`input`,ref:input},__props.adapter.composer,{class:`assistant-conversation__composer`,"model-value":__props.adapter.composer.draft||``,"submit-enabled":canSend.value,"aria-label":__props.adapter.composer.ariaLabel||unref(t)(`jskit.assistant.chat.messageAssistant`),rows:__props.adapter.composer.rows||2,"described-by":activity.value.label||__props.adapter.suggestions?.visible?statusId:__props.adapter.composer.describedBy,placeholder:suggestionPreview.value||__props.adapter.composer.placeholder,"placeholder-affects-height":!suggestionPreview.value,"attachment-state":attachmentState.value,dragging:attachmentsEnabled.value&&__props.adapter.attachments.dragActive,"tab-to-submit":``,"onUpdate:modelValue":_cache[22]||(_cache[22]=$event=>__props.adapter.actions.setDraft($event)),onSubmit:submit,onTabToSubmit:_cache[23]||(_cache[23]=$event=>delivery.value?.focus()),onFocus:_cache[24]||(_cache[24]=$event=>__props.adapter.suggestions?.focus()),onBlur:_cache[25]||(_cache[25]=$event=>__props.adapter.suggestions?.blur()),onEscape:dismissSuggestions,onDragenter:_cache[26]||(_cache[26]=$event=>attachmentEvent(`handleDragEnter`,$event)),onDragover:_cache[27]||(_cache[27]=$event=>attachmentEvent(`handleDragOver`,$event)),onDragleave:_cache[28]||(_cache[28]=$event=>attachmentEvent(`handleDragLeave`,$event)),onDrop:_cache[29]||(_cache[29]=$event=>attachmentEvent(`handleDrop`,$event)),onPaste:_cache[30]||(_cache[30]=$event=>attachmentEvent(`handlePaste`,$event))}),createSlots({footer:withCtx(()=>[createVNode(AssistantComposerActions_default,{ref_key:`delivery`,ref:delivery,state:{...__props.adapter.composer,pending:pending.value,canSend:canSend.value},onSubmit:submit,onStop:stop},{feedback:withCtx(()=>[attachmentsEnabled.value&&__props.adapter.attachments.status?(openBlock(),createElementBlock(`p`,_hoisted_10,toDisplayString(__props.adapter.attachments.status),1)):createCommentVNode(``,true),renderSlot(_ctx.$slots,`composer-feedback`,{adapter:__props.adapter},void 0,true)]),default:withCtx(()=>[__props.adapter.models&&__props.adapter.models.enabled!==false?(openBlock(),createBlock(AssistantModelControl_default,mergeProps({key:0,modelValue:modelsOpen.value,"onUpdate:modelValue":_cache[16]||(_cache[16]=$event=>modelsOpen.value=$event)},__props.adapter.models,{onSelectProvider:_cache[17]||(_cache[17]=$event=>__props.adapter.models.selectProvider?.($event)),onSelectModel:_cache[18]||(_cache[18]=$event=>__props.adapter.models.selectModel?.($event)),onSelectVariant:_cache[19]||(_cache[19]=$event=>__props.adapter.models.selectVariant?.($event)),onApply:applyModel,onReload:_cache[20]||(_cache[20]=$event=>__props.adapter.models.reload?.())}),null,16,[`modelValue`])):createCommentVNode(``,true),attachmentsEnabled.value?(openBlock(),createBlock(VBtn,{key:1,"aria-label":unref(t)(`jskit.assistant.chat.attachFiles`),title:unref(t)(`jskit.assistant.chat.attachFiles`),size:`small`,variant:`text`,icon:unref(mdiPaperclip),disabled:!__props.adapter.attachments.canAddFiles,onClick:_cache[21]||(_cache[21]=$event=>fileInput.value?.click())},null,8,[`aria-label`,`title`,`icon`,`disabled`])):createCommentVNode(``,true),__props.configurationMode!==`hidden`?renderSlot(_ctx.$slots,`configuration`,{configuration:__props.configuration,disabled:__props.configurationMode!==`editable`||pending.value,update:updateConfiguration},()=>[(openBlock(true),createElementBlock(Fragment,null,renderList(__props.configurationFields,field=>{return openBlock(),createBlock(VSelect,{key:field.name,"model-value":__props.configuration[field.name],label:field.label,items:field.items,disabled:__props.configurationMode!==`editable`||pending.value,density:`compact`,"hide-details":``,variant:`outlined`,class:`assistant-conversation__setting`,"onUpdate:modelValue":$event=>updateConfiguration({...__props.configuration,[field.name]:$event})},null,8,[`model-value`,`label`,`items`,`disabled`,`onUpdate:modelValue`])}),128))],true,2):createCommentVNode(``,true),renderSlot(_ctx.$slots,`composer-tools`,{adapter:__props.adapter},void 0,true)]),_:3},8,[`state`])]),_:2},[attachmentsEnabled.value?{name:`attachments`,fn:withCtx(()=>[createBaseVNode(`input`,{ref_key:`fileInput`,ref:fileInput,hidden:``,multiple:``,type:`file`,accept:__props.adapter.attachments.accept,disabled:!__props.adapter.attachments.canAddFiles,onChange:attachSelectedFiles},null,40,_hoisted_9),createVNode(AssistantAttachmentQueue_default,{items:__props.adapter.attachments.queueItems,"preview-enabled":Boolean(__props.adapter.attachments.open),"maximum-files":__props.adapter.attachments.maxItems,onCancel:_cache[8]||(_cache[8]=$event=>__props.adapter.attachments.cancelAttachment($event)),onRemove:_cache[9]||(_cache[9]=$event=>__props.adapter.attachments.removeAttachment($event)),onRetry:_cache[10]||(_cache[10]=$event=>__props.adapter.attachments.retryAttachment($event)),onPreview:_cache[11]||(_cache[11]=$event=>__props.adapter.attachments.open($event)),onFocusInput:_cache[12]||(_cache[12]=$event=>input.value?.focus())},null,8,[`items`,`preview-enabled`,`maximum-files`])]),key:`0`}:void 0,__props.adapter.questions||_ctx.$slots[`input-start`]?{name:`input-start`,fn:withCtx(()=>[renderSlot(_ctx.$slots,`input-start`,{adapter:__props.adapter},()=>[createVNode(AssistantQuestionInputs_default,mergeProps(__props.adapter.questions,{"onUpdate:answers":_cache[13]||(_cache[13]=$event=>__props.adapter.questions.setAnswers($event)),"onUpdate:choice":_cache[14]||(_cache[14]=$event=>__props.adapter.questions.setChoice($event)),onDismiss:_cache[15]||(_cache[15]=$event=>__props.adapter.questions.dismiss())}),null,16)],true)]),key:`1`}:void 0]),1040,[`model-value`,`submit-enabled`,`aria-label`,`rows`,`described-by`,`placeholder`,`placeholder-affects-height`,`attachment-state`,`dragging`])):createCommentVNode(``,true)],true)],10,_hoisted_1$1)}}};var AssistantConversationElement_default=_plugin_vue_export_helper_default(_sfc_main$1,[[`__scopeId`,`data-v-c542a78b`]]);var{serverMessage:serverMessage$2}=useJskitText();function useAssistantSuggestions({active=true,requestKey=``,draft=``,configuration={},generate,onSelect=()=>false,debounceMs=750,minIntervalMs=0}={}){const items=ref([]);const loading=ref(false);const preview=ref(``);const error=ref(``);const dismissedKey=ref(null);const composerFocused=ref(false);const currentDraft=computed(()=>String(toValue(draft)??``).trim());const configurationKey=computed(()=>JSON.stringify(toValue(configuration)??{}));const key=computed(()=>JSON.stringify([toValue(requestKey),currentDraft.value,configurationKey.value]));const eligible=computed(()=>toValue(active)!==false&&typeof unref(generate)===`function`&&dismissedKey.value!==key.value);const visible=computed(()=>eligible.value&&(loading.value||items.value.length>0));let timer;let request;let lastStartedAt=-Infinity;function cancel(){clearTimeout(timer);const previous=request;request=null;previous?.abort();loading.value=false}watch([eligible,key,()=>unref(generate)],()=>{cancel();items.value=[];preview.value=``;error.value=``;if(!eligible.value)return;const controller=new AbortController;request=controller;const input={draft:currentDraft.value,configuration:JSON.parse(configurationKey.value),signal:controller.signal};const run=unref(generate);loading.value=true;timer=setTimeout(async()=>{lastStartedAt=Date.now();try{const result=await run(input);if(request!==controller)return;if(!Array.isArray(result)||result.some(item=>!item?.label?.trim()||!item?.prompt?.trim()))throw new TypeError(`Suggestions must contain a label and prompt.`);items.value=result.map(({label,prompt})=>({label:label.trim(),prompt:prompt.trim()}))}catch(failure){if(request===controller&&!controller.signal.aborted)error.value=String(serverMessage$2(failure)||failure)}finally{if(request===controller){request=null;loading.value=false}}},Math.max(0,Number(toValue(debounceMs))||0,lastStartedAt+Math.max(0,Number(toValue(minIntervalMs))||0)-Date.now()))},{immediate:true,flush:`sync`});function currentSuggestion(value){return items.value.find(item=>item.label===value?.label&&item.prompt===value?.prompt)}function previewSuggestion(value){preview.value=currentDraft.value?``:currentSuggestion(value)?.prompt||``;return Boolean(preview.value)}function select(value){const suggestion=currentSuggestion(value);if(!suggestion||!eligible.value)return false;preview.value=``;return onSelect(suggestion.prompt)!==false}function dismiss(){preview.value=``;dismissedKey.value=key.value}function focus(){if(toValue(active)===false||composerFocused.value)return;composerFocused.value=true}function blur(){preview.value=``;composerFocused.value=false}watch(()=>toValue(active),value=>{if(value===false){composerFocused.value=false;dismissedKey.value=null}},{flush:`sync`});watch(currentDraft,()=>{preview.value=``},{flush:`sync`});onScopeDispose(cancel);return{items,loading,preview,error,visible,composerFocused,previewSuggestion,select,dismiss,focus,blur}}function useAssistantQuestions({message=``,extraChoice=null}={}){const questionText=computed(()=>String(toValue(message)||``));const answers=ref({});const choice=ref(``);const dismissedText=ref(``);const submittedText=ref(``);const numberedInput=computed(()=>parseNumberedQuestionPrompt(questionText.value));const questions=computed(()=>[dismissedText.value,submittedText.value].includes(questionText.value)?[]:numberedInput.value.questions||[]);const selectItems=computed(()=>Object.fromEntries(questions.value.map(question=>{const choices=Array.isArray(question.choices)?question.choices:[];const extra=toValue(extraChoice);const includesExtra=extra&&choices.some(item=>String(item?.value||``).trim().toLowerCase()===String(extra.value||``).trim().toLowerCase());return[question.name,!extra||includesExtra?choices:[...choices,extra]]})));const choices=computed(()=>questions.value.length||submittedText.value===questionText.value?[]:parseAnswerChoicePrompt(questionText.value).choices||[]);const active=computed(()=>Boolean(questions.value.length||choices.value.length));function capture(draft=``){const additionalContext=String(draft||``).trim();return{message:questions.value.length?[numberedQuestionSubmissionText(questions.value,answers.value),additionalContext].filter(Boolean).join(`
|
|
11
|
+
|
|
12
|
+
`):choice.value||additionalContext,questionText:active.value?questionText.value:``}}function markSubmitted(text=``){submittedText.value=text;answers.value={};choice.value=``}function dismiss(){if(!questions.value.length)return false;dismissedText.value=questionText.value;answers.value={};return true}function reset(){answers.value={};dismissedText.value=``;submittedText.value=``;choice.value=``}watch(questionText,text=>{answers.value={};if(text!==dismissedText.value)dismissedText.value=``;if(text!==submittedText.value)submittedText.value=``;choice.value=``});return{questions,selectItems,choices,answers,choice,active,capture,markSubmitted,dismiss,reset,setAnswers(value){answers.value=value},setChoice(value){choice.value=value}}}var{serverMessage:serverMessage$1,t:t$1}=useJskitText();function attachmentErrorText(error,fallback){return String(error&&typeof error===`object`&&serverMessage$1(error)||error?.message||error||fallback)}function assistantAttachmentSessionId(sessionId){return String(toValue(sessionId)||``).trim()}function assistantAttachmentUploadAllowed(canUpload){return toValue(canUpload)!==false}function assistantAttachmentFiles(fileList=[]){return Array.from(fileList||[]).filter(file=>file&&file.size>=0)}function assistantAttachmentFilesFromTransferItems(items=[]){return assistantAttachmentFiles(Array.from(items||[]).map(item=>{if(item?.kind!==`file`||typeof item.getAsFile!==`function`)return null;return item.getAsFile()}))}function assistantAttachmentFilesFromDropEvent(event){const dataTransfer=event?.dataTransfer;const itemFiles=assistantAttachmentFilesFromTransferItems(dataTransfer?.items);if(itemFiles.length>0)return itemFiles;return assistantAttachmentFiles(dataTransfer?.files)}function assistantAttachmentFilesFromPasteEvent(event){const clipboardData=event?.clipboardData;const itemFiles=assistantAttachmentFilesFromTransferItems(clipboardData?.items);if(itemFiles.length>0)return itemFiles;return assistantAttachmentFiles(clipboardData?.files)}function assistantAttachmentEventHasFiles(event){const dataTransfer=event?.dataTransfer;return assistantAttachmentFilesFromDropEvent(event).length>0||Array.from(dataTransfer?.items||[]).some(item=>item?.kind===`file`)||Array.from(dataTransfer?.types||[]).some(type=>type===`Files`||type===`application/x-moz-file`)}function assistantAttachmentClipboardText(event){if(typeof event?.clipboardData?.getData!==`function`)return``;return String(event.clipboardData.getData(`text/plain`)||``)}function assistantAttachmentClipboardLocalFileReference(event){const clipboardData=event?.clipboardData;if(!clipboardData||typeof clipboardData.getData!==`function`)return``;const types=Array.from(clipboardData.types||[]);const text=[clipboardData.getData(`x-special/gnome-copied-files`),clipboardData.getData(`text/uri-list`),clipboardData.getData(`text/plain`)].map(value=>String(value||``).trim()).filter(Boolean).join(`
|
|
13
|
+
`);if(types.includes(`Files`)||types.includes(`application/x-moz-file`)||types.includes(`x-special/gnome-copied-files`)||/^file:/imu.test(text))return text||`file://`;return``}function attachmentUploadError(attachment={}){return attachment?.error||attachment?.errors?.[0]?.message||``}function attachmentIdentity(attachment={}){return String(attachment?.clientId||attachment?.attachmentId||attachment?.path||attachment?.fileName||``)}var ASSISTANT_ATTACHMENT_MAX_BYTES=1e8;var ASSISTANT_ATTACHMENT_UPLOAD_CONCURRENCY=2;var ASSISTANT_ATTACHMENT_UNRESOLVED_PHASES=new Set([`preparing`,`queued`,`uploading`,`delivering`,`failed`]);var attachmentClientSequence=0;function nextAttachmentClientId(){attachmentClientSequence+=1;return`attachment-${Date.now().toString(36)}-${attachmentClientSequence.toString(36)}`}function attachmentFileName(file={}){return String(file?.name||`attachment`)}function attachmentUploadResult(upload=null){if(upload&&typeof upload.then===`function`)return{cancel:typeof upload.cancel===`function`?()=>upload.cancel():null,promise:upload};if(upload?.promise&&typeof upload.promise.then===`function`)return{cancel:typeof upload.abort===`function`?()=>upload.abort():typeof upload.cancel===`function`?()=>upload.cancel():null,promise:upload.promise};return{cancel:null,promise:Promise.resolve(upload)}}function attachmentProgress(progress={},possibleTotal,fallbackTotal=0){const directNumericProgress=typeof progress===`number`?progress:null;const progressObject=progress&&typeof progress===`object`?progress:{};const totalBytes=Math.max(0,Number(progressObject.totalBytes??progressObject.total??possibleTotal??fallbackTotal)||0);const bytesValue=progressObject.bytesSent??progressObject.loaded??progressObject.uploadedBytes??directNumericProgress;const bytesKnown=bytesValue!==null&&bytesValue!==void 0&&bytesValue!==``;let bytesSent=bytesKnown?Number(bytesValue)||0:0;const directPercent=progressObject.percent;let percent=directPercent!==null&&directPercent!==void 0&&directPercent!==``?Number(directPercent):null;const progressValue=progressObject.progress;if(!Number.isFinite(percent)&&progressValue!==null&&progressValue!==void 0&&progressValue!==``){const numericProgressValue=Number(progressValue);if(Number.isFinite(numericProgressValue))percent=numericProgressValue<=1?numericProgressValue*100:numericProgressValue}if(!Number.isFinite(percent))percent=bytesKnown&&totalBytes>0?bytesSent/totalBytes*100:null;if(percent!==null)percent=Math.max(0,Math.min(100,percent));if(totalBytes>0){const inferredBytes=percent===null?0:totalBytes*percent/100;bytesSent=Math.max(0,Math.min(totalBytes,bytesSent||inferredBytes))}else bytesSent=Math.max(0,bytesSent);return{bytesSent,percent,totalBytes}}function attachmentReceipt(row,uploaded={}){return{...uploaded,attachmentId:String(uploaded?.attachmentId||``),clientId:row.clientId,fileName:String(uploaded?.fileName||row.fileName),sessionId:row.sessionId,size:Number(uploaded?.size??row.size)||0}}function useAssistantAttachments({canUpload=()=>true,deleteAttachment=null,onError=null,onUploaded=async()=>null,sessionId,uploadAttachment,maxBytes=ASSISTANT_ATTACHMENT_MAX_BYTES,maxItems=10,uploadConcurrency=2}={}){if(![maxBytes,maxItems,uploadConcurrency].every(value=>Number.isSafeInteger(value)&&value>0))throw new TypeError(`Attachment limits must be positive integers.`);const attachments=ref([]);const queueItems=ref([]);const dragDepth=ref(0);const status=ref(``);const activeUploadCount=ref(0);const uploadQueue=[];const rowsById=new Map;const activeAttempts=new Map;const cleanupTasks=new Set;const receiptCleanupById=new Map;const cleanedReceiptIds=new Set;let disposed=false;let stopSessionWatch=null;const dragActive=computed(()=>dragDepth.value>0);const uploading=computed(()=>activeUploadCount.value>0||queueItems.value.some(item=>[`preparing`,`uploading`,`delivering`].includes(item.phase)));const hasUnresolved=computed(()=>queueItems.value.some(item=>ASSISTANT_ATTACHMENT_UNRESOLVED_PHASES.has(item.phase)));const canSubmit=computed(()=>!hasUnresolved.value);const retainedItemCount=computed(()=>queueItems.value.filter(item=>item.phase!==`cancelled`).length);const atCapacity=computed(()=>retainedItemCount.value>=maxItems);const canAddFiles=computed(()=>Boolean(!disposed&&assistantAttachmentSessionId(sessionId)&&assistantAttachmentUploadAllowed(canUpload)&&!atCapacity.value&&typeof uploadAttachment===`function`));const aggregateProgress=computed(()=>{const retainedItems=queueItems.value.filter(item=>item.phase!==`cancelled`);const totalBytes=retainedItems.reduce((sum,item)=>sum+item.totalBytes,0);const bytesSent=retainedItems.reduce((sum,item)=>sum+item.bytesSent,0);return{bytesSent,percent:totalBytes>0?Math.round(bytesSent/totalBytes*100):0,totalBytes}});const tooLarge=row=>t$1(`jskit.assistant.attachments.error.tooLarge`,{fileName:row.fileName,limit:attachmentLimitText(maxBytes)});const tooMany=()=>t$1(`jskit.assistant.attachments.error.tooMany`,{count:maxItems});function reportAttachmentError(error,fallbackMessage=t$1(`jskit.assistant.attachments.error.uploadFailed`),{notify=true}={}){const message=attachmentErrorText(error,fallbackMessage);status.value=message;if(notify&&typeof onError===`function`)try{onError(error||new Error(message),fallbackMessage)}catch{}return message}function resetDragState(){dragDepth.value=0}function clearStatus(){status.value=``}function createWaiter(row){let resolve=null;row.waiter={promise:new Promise(currentResolve=>{resolve=currentResolve}),resolve,settled:false};return row.waiter}function settleWaiter(row,value=null,waiter=row.waiter){if(!waiter||waiter.settled)return;waiter.settled=true;waiter.resolve(value)}function canonicalRow(attachment={}){const identity=attachmentIdentity(attachment);return identity?rowsById.get(identity)||queueItems.value.find(row=>attachmentIdentity(row)===identity||row.attachmentId===identity):null}function trackCleanup(task){const cleanup=Promise.resolve(task).catch(error=>{reportAttachmentError(error,t$1(`jskit.assistant.attachments.error.cleanupFailed`));return false});cleanupTasks.add(cleanup);cleanup.finally(()=>cleanupTasks.delete(cleanup));return cleanup}async function deleteUploadedAttachment(currentSessionId,attachment={}){const attachmentId=String(attachment?.attachmentId||``).trim();if(!attachmentId||typeof deleteAttachment!==`function`)return false;const response=await deleteAttachment(currentSessionId,attachmentId);if(response?.ok===false)throw new Error(attachmentUploadError(response)||t$1(`jskit.assistant.attachments.error.cleanupFailed`));return true}function cleanupReceipt(currentSessionId,receipt={}){const attachmentId=String(receipt?.attachmentId||``).trim();const cleanupId=`${currentSessionId}:${attachmentId}`;if(!attachmentId)return Promise.resolve(false);if(cleanedReceiptIds.has(cleanupId))return Promise.resolve(false);if(receiptCleanupById.has(cleanupId))return receiptCleanupById.get(cleanupId);const cleanup=trackCleanup(deleteUploadedAttachment(currentSessionId,receipt)).then(deleted=>{if(deleted)cleanedReceiptIds.add(cleanupId);return deleted});receiptCleanupById.set(cleanupId,cleanup);cleanup.finally(()=>receiptCleanupById.delete(cleanupId));return cleanup}function updateProgress(row,progress,total){if(!row.retained||row.phase!==`uploading`)return;const next=attachmentProgress(progress,total,row.totalBytes);row.bytesSent=Math.max(row.bytesSent,next.bytesSent);row.totalBytes=next.totalBytes||row.totalBytes;if(next.percent!==null)row.progress=Math.max(Number(row.progress)||0,next.percent)}function removeReadyReceipt(row){const removed=attachments.value.filter(attachment=>attachment.clientId===row.clientId);attachments.value=attachments.value.filter(attachment=>attachment.clientId!==row.clientId);return removed}async function handOffUploadedAttachment(row,receipt,waiter=row.waiter){const token=Symbol(`${row.clientId}-handoff`);row.activeHandoffToken=token;row.phase=`delivering`;if(!attachments.value.some(attachment=>attachment.clientId===row.clientId))attachments.value.push(receipt);try{const accepted=(await onUploaded([receipt]))?.accepted===true;if(row.activeHandoffToken!==token||!row.retained||row.phase===`cancelled`){removeReadyReceipt(row);if(!accepted)await cleanupReceipt(row.sessionId,receipt);settleWaiter(row,null,waiter);return null}row.activeHandoffToken=null;row.error=``;row.failureStage=``;if(accepted){removeReadyReceipt(row);row.retained=false;rowsById.delete(row.clientId);queueItems.value=queueItems.value.filter(candidate=>candidate.clientId!==row.clientId);settleWaiter(row,receipt,waiter);return receipt}row.phase=`ready`;settleWaiter(row,receipt,waiter);return receipt}catch(error){if(row.activeHandoffToken!==token||!row.retained||row.phase===`cancelled`){await cleanupReceipt(row.sessionId,receipt);settleWaiter(row,null,waiter);return null}row.activeHandoffToken=null;removeReadyReceipt(row);row.error=attachmentErrorText(error,t$1(`jskit.assistant.attachments.error.unusable`));row.failureStage=`handoff`;row.phase=`failed`;settleWaiter(row,null,waiter);reportAttachmentError(error,t$1(`jskit.assistant.attachments.error.unusable`),{notify:false});return null}}async function finishUploadAttempt(attempt,uploaded,uploadError=null){activeAttempts.delete(attempt.token);activeUploadCount.value=activeAttempts.size;pumpQueue();const{row}=attempt;const isCurrentAttempt=row.activeToken===attempt.token;const uploadSucceeded=Boolean(!uploadError&&uploaded&&uploaded.ok!==false&&String(uploaded.attachmentId||``).trim());if(!isCurrentAttempt||!row.retained||disposed){if(uploadSucceeded)await cleanupReceipt(attempt.sessionId,uploaded);settleWaiter(row,null,attempt.waiter);pumpQueue();return}row.activeToken=null;if(uploadSucceeded){const receipt=attachmentReceipt(row,uploaded);row.receipt=receipt;row.attachmentId=receipt.attachmentId;row.path=String(receipt.path||``);row.bytesSent=row.totalBytes;row.progress=100;row.error=``;row.failureStage=``;await handOffUploadedAttachment(row,receipt,attempt.waiter)}else{const error=uploadError||new Error(attachmentUploadError(uploaded)||t$1(`jskit.assistant.attachments.error.uploadFailed`));row.error=attachmentErrorText(error,t$1(`jskit.assistant.attachments.error.uploadFailed`));row.failureStage=`upload`;row.phase=`failed`;settleWaiter(row,null,attempt.waiter);reportAttachmentError(error,t$1(`jskit.assistant.attachments.error.uploadFailed`),{notify:false})}pumpQueue()}function startUpload(row){const token=Symbol(row.clientId);const abortController=typeof AbortController===`function`?new AbortController:null;const attempt={abortController,cancel:null,row,sessionId:row.sessionId,settled:null,token,waiter:row.waiter};row.activeToken=token;row.phase=`uploading`;row.error=``;activeAttempts.set(token,attempt);activeUploadCount.value=activeAttempts.size;try{const transport=attachmentUploadResult(uploadAttachment(row.sessionId,row.file,{onProgress:(progress,total)=>updateProgress(row,progress,total),signal:abortController?.signal}));attempt.cancel=transport.cancel;attempt.settled=transport.promise.then(uploaded=>finishUploadAttempt(attempt,uploaded),error=>finishUploadAttempt(attempt,null,error))}catch(error){attempt.settled=finishUploadAttempt(attempt,null,error)}}function pumpQueue(){if(disposed)return;while(activeAttempts.size<uploadConcurrency&&uploadQueue.length>0){const row=uploadQueue.shift();if(!row?.retained||row.phase!==`queued`)continue;startUpload(row)}}function cancelAttachment(attachment={}){const row=canonicalRow(attachment);if(!row||!row.retained||![`preparing`,`queued`,`uploading`].includes(row.phase))return false;const token=row.activeToken;row.activeToken=null;row.activeHandoffToken=null;row.phase=`cancelled`;row.error=``;const receipt=row.receipt;removeReadyReceipt(row);if(receipt)cleanupReceipt(row.sessionId,receipt);row.receipt=null;row.failureStage=``;settleWaiter(row,null);const attempt=token?activeAttempts.get(token):null;try{row.producerAbortController?.abort();attempt?.abortController?.abort();attempt?.cancel?.()}catch{}row.producerAbortController=null;row.producerToken=null;pumpQueue();return true}function retryAttachment(attachment={}){const row=canonicalRow(attachment);if(!row||!row.retained||![`failed`,`cancelled`].includes(row.phase)||row.sessionId!==assistantAttachmentSessionId(sessionId)||!assistantAttachmentUploadAllowed(canUpload)||typeof uploadAttachment!==`function`)return Promise.resolve(null);if(row.phase===`cancelled`&&retainedItemCount.value>=maxItems){reportAttachmentError(tooMany());return Promise.resolve(null)}if(row.failureStage===`handoff`&&row.receipt){row.error=``;row.phase=`uploading`;const waiter=createWaiter(row);handOffUploadedAttachment(row,row.receipt,waiter);return waiter.promise}if(row.producer&&!row.file){const waiter=createWaiter(row);startAttachmentProducer(row);return waiter.promise}if(row.size>maxBytes){row.error=tooLarge(row);row.failureStage=`validation`;row.phase=`failed`;reportAttachmentError(row.error,t$1(`jskit.assistant.attachments.error.uploadFailed`),{notify:false});return Promise.resolve(null)}row.bytesSent=0;row.progress=null;row.error=``;row.failureStage=``;row.phase=`queued`;const waiter=createWaiter(row);uploadQueue.push(row);pumpQueue();return waiter.promise}function detachRow(row){if([`preparing`,`queued`,`uploading`].includes(row.phase))cancelAttachment(row);row.retained=false;rowsById.delete(row.clientId);settleWaiter(row,null)}function removeAttachment(attachment={}){const row=canonicalRow(attachment);if(!row)return[];const removedReceipts=removeReadyReceipt(row);const removed=removedReceipts.length>0?removedReceipts:[row];const receiptToClean=removedReceipts[0]||row.receipt;detachRow(row);queueItems.value=queueItems.value.filter(candidate=>candidate.clientId!==row.clientId);if(receiptToClean)cleanupReceipt(row.sessionId,receiptToClean);return removed}function clearAttachments({accepted=true,attachmentIds=null}={}){if(!accepted)return abandonAttachments();const selectedIds=Array.isArray(attachmentIds)?new Set(attachmentIds):null;const cleared=attachments.value.filter(attachment=>!selectedIds||selectedIds.has(attachment.attachmentId));const readyIds=new Set(cleared.map(attachment=>attachment.clientId));const remaining=[];for(const row of[...queueItems.value]){if(selectedIds&&!readyIds.has(row.clientId)){remaining.push(row);continue}if(readyIds.has(row.clientId)){row.retained=false;rowsById.delete(row.clientId);continue}detachRow(row);if(row.receipt)cleanupReceipt(row.sessionId,row.receipt)}attachments.value=attachments.value.filter(attachment=>!readyIds.has(attachment.clientId));queueItems.value=remaining;return cleared}async function abandonAttachments({onlySessionId=``}={}){const normalizedSessionId=String(onlySessionId||``).trim();const rows=queueItems.value.filter(row=>!normalizedSessionId||row.sessionId===normalizedSessionId);const rowIds=new Set(rows.map(row=>row.clientId));const readyReceipts=rows.map(row=>row.receipt).filter(Boolean);const attempts=[...activeAttempts.values()].filter(attempt=>rowIds.has(attempt.row.clientId));for(const row of rows)detachRow(row);queueItems.value=queueItems.value.filter(row=>!rowIds.has(row.clientId));attachments.value=attachments.value.filter(attachment=>!rowIds.has(attachment.clientId));const readyCleanup=readyReceipts.map(attachment=>cleanupReceipt(attachment.sessionId,attachment));await Promise.allSettled([...readyCleanup,...attempts.map(attempt=>attempt.settled).filter(Boolean)]);await waitForAttachmentCleanup();return rows}async function waitForAttachmentCleanup(){while(cleanupTasks.size>0)await Promise.allSettled([...cleanupTasks])}async function disposeAttachments(){if(disposed){await waitForAttachmentCleanup();return[]}disposed=true;stopSessionWatch?.();stopSessionWatch=null;return abandonAttachments()}function handleDragEnter(event){if(!assistantAttachmentEventHasFiles(event))return;dragDepth.value+=1;if(event?.dataTransfer)event.dataTransfer.dropEffect=`copy`}function handleDragOver(event){if(event?.dataTransfer)event.dataTransfer.dropEffect=`copy`}function handleDragLeave(){dragDepth.value=Math.max(0,dragDepth.value-1)}function createQueueRow({currentSessionId,file=null,fileName=`attachment`,phase=`queued`,producer=null,size=0}={}){const normalizedSize=Number(file?.size??size)||0;const row=reactive({activeHandoffToken:null,activeToken:null,attachmentId:``,bytesSent:0,clientId:nextAttachmentClientId(),error:``,failureStage:``,file,fileName:file?attachmentFileName(file):String(fileName||`attachment`),path:``,phase,producer,producerAbortController:null,producerToken:null,progress:null,receipt:null,retained:true,sessionId:currentSessionId,size:normalizedSize,totalBytes:normalizedSize,waiter:null});rowsById.set(row.clientId,row);queueItems.value.push(row);createWaiter(row);return row}function queuePreparedFile(row,file,waiter=row.waiter){const preparedFile=assistantAttachmentFiles([file])[0];if(!preparedFile)throw Object.assign(new Error(`The prepared attachment did not produce a file.`),{messageCode:`assistant.attachments.error.noFile`,messageParams:{}});row.file=preparedFile;row.fileName=attachmentFileName(preparedFile);row.size=Number(preparedFile.size)||0;row.totalBytes=row.size;if(row.size>maxBytes){row.error=tooLarge(row);row.failureStage=`validation`;row.phase=`failed`;settleWaiter(row,null,waiter);reportAttachmentError(row.error,t$1(`jskit.assistant.attachments.error.uploadFailed`),{notify:false});return false}row.phase=`queued`;uploadQueue.push(row);pumpQueue();return true}function startAttachmentProducer(row){const token=Symbol(`${row.clientId}-producer`);const waiter=row.waiter;const abortController=typeof AbortController===`function`?new AbortController:null;row.file=null;row.producerAbortController=abortController;row.producerToken=token;row.phase=`preparing`;row.error=``;row.failureStage=``;row.producerSettled=Promise.resolve().then(()=>row.producer({signal:abortController?.signal})).then(file=>{if(row.producerToken!==token||!row.retained||disposed){settleWaiter(row,null,waiter);return null}row.producerAbortController=null;row.producerToken=null;try{queuePreparedFile(row,file,waiter)}catch(error){row.error=attachmentErrorText(error,t$1(`jskit.assistant.attachments.error.preparationFailed`));row.failureStage=`preparing`;row.phase=`failed`;settleWaiter(row,null,waiter);reportAttachmentError(error,t$1(`jskit.assistant.attachments.error.preparationFailed`),{notify:false})}return file},error=>{if(row.producerToken!==token||!row.retained||disposed){settleWaiter(row,null,waiter);return null}row.producerAbortController=null;row.producerToken=null;if(error?.name===`AbortError`){row.phase=`cancelled`;row.error=``}else{row.error=attachmentErrorText(error,t$1(`jskit.assistant.attachments.error.preparationFailed`));row.failureStage=`preparing`;row.phase=`failed`;reportAttachmentError(error,t$1(`jskit.assistant.attachments.error.preparationFailed`),{notify:false})}settleWaiter(row,null,waiter);return null})}function uploadFileProducer({fileName=t$1(`jskit.assistant.attachments.preparingName`),produce}={}){const currentSessionId=assistantAttachmentSessionId(sessionId);if(!canAddFiles.value||typeof produce!==`function`){if(atCapacity.value)reportAttachmentError(tooMany());return Promise.resolve(null)}status.value=``;const row=createQueueRow({currentSessionId,fileName,phase:`preparing`,producer:produce});const waiter=row.waiter;startAttachmentProducer(row);return waiter.promise}async function uploadFiles(files=[]){const uploadableFiles=assistantAttachmentFiles(files);const currentSessionId=assistantAttachmentSessionId(sessionId);if(uploadableFiles.length<1||!currentSessionId||disposed||!assistantAttachmentUploadAllowed(canUpload)||typeof uploadAttachment!==`function`)return[];status.value=``;const availableSlots=Math.max(0,maxItems-retainedItemCount.value);const acceptedFiles=uploadableFiles.slice(0,availableSlots);if(acceptedFiles.length<uploadableFiles.length)reportAttachmentError(tooMany());const waiters=[];for(const file of acceptedFiles){const row=createQueueRow({currentSessionId,file});const waiter=row.waiter;waiters.push(waiter.promise);if(row.size>maxBytes){row.error=tooLarge(row);row.failureStage=`validation`;row.phase=`failed`;settleWaiter(row,null);reportAttachmentError(row.error,t$1(`jskit.assistant.attachments.error.uploadFailed`),{notify:false})}else uploadQueue.push(row)}pumpQueue();return(await Promise.all(waiters)).filter(attachment=>attachment&&attachments.value.some(candidate=>candidate.clientId===attachment.clientId))}async function handleDrop(event){resetDragState();return uploadFiles(assistantAttachmentFilesFromDropEvent(event))}async function handlePaste(event){const files=assistantAttachmentFilesFromPasteEvent(event);if(files.length<1){if(assistantAttachmentClipboardLocalFileReference(event))reportAttachmentError(t$1(`jskit.assistant.attachments.error.localFilePaste`));return[]}if(!assistantAttachmentClipboardText(event))event?.preventDefault?.();return uploadFiles(files)}stopSessionWatch=watch(()=>assistantAttachmentSessionId(sessionId),(nextSessionId,previousSessionId)=>{if(nextSessionId!==previousSessionId&&previousSessionId)abandonAttachments({onlySessionId:previousSessionId})},{flush:`sync`});if(getCurrentScope())onScopeDispose(()=>{disposeAttachments()});return{maxBytes,maxItems,abandonAttachments,aggregateProgress,attachments,atCapacity,canAddFiles,cancelAttachment,canSubmit,clearAttachments,clearStatus,disposeAttachments,dragActive,hasUnresolved,handleDragEnter,handleDragLeave,handleDragOver,handleDrop,handlePaste,queueItems,removeAttachment,resetDragState,retryAttachment,status,uploading,uploadFiles,uploadFileProducer,waitForAttachmentCleanup}}var _hoisted_1=[`alt`,`src`];var _hoisted_2={key:1};var _sfc_main={__name:`AssistantAttachmentPreview`,props:{attachment:{type:Object,default:null},previewUrl:{type:String,default:``},downloadUrl:{type:String,required:true}},emits:[`close`],setup(__props,{emit:__emit}){const{t}=useJskitText();const props=__props;const emit=__emit;const imageFailed=ref(false);watch(()=>[props.attachment,props.previewUrl],()=>{imageFailed.value=false});return(_ctx,_cache)=>{return openBlock(),createBlock(VDialog,{"model-value":Boolean(__props.attachment),"max-width":`960`,"onUpdate:modelValue":_cache[2]||(_cache[2]=$event=>!$event&&emit(`close`))},{default:withCtx(()=>[__props.attachment?(openBlock(),createBlock(VCard,{key:0,title:__props.attachment.fileName},{default:withCtx(()=>[createVNode(VCardText,null,{default:withCtx(()=>[__props.previewUrl&&!imageFailed.value?(openBlock(),createElementBlock(`img`,{key:__props.previewUrl,alt:__props.attachment.fileName,class:`assistant-attachment-preview`,src:__props.previewUrl,onError:_cache[0]||(_cache[0]=$event=>imageFailed.value=true)},null,40,_hoisted_1)):(openBlock(),createElementBlock(`p`,_hoisted_2,toDisplayString(unref(t)(`jskit.assistant.attachments.previewUnavailable`)),1))]),_:1}),createVNode(VCardActions,null,{default:withCtx(()=>[createVNode(VBtn,{href:__props.downloadUrl,download:__props.attachment.fileName,"prepend-icon":unref(mdiDownload),variant:`tonal`},{default:withCtx(()=>[createTextVNode(toDisplayString(unref(t)(`jskit.assistant.attachments.download`)),1)]),_:1},8,[`href`,`download`,`prepend-icon`]),createVNode(VSpacer),createVNode(VBtn,{onClick:_cache[1]||(_cache[1]=$event=>emit(`close`))},{default:withCtx(()=>[createTextVNode(toDisplayString(unref(t)(`jskit.assistant.attachments.close`)),1)]),_:1})]),_:1})]),_:1},8,[`title`])):createCommentVNode(``,true)]),_:1},8,[`model-value`])}}};var AssistantAttachmentPreview_default=_plugin_vue_export_helper_default(_sfc_main,[[`__scopeId`,`data-v-1740c3f5`]]);var{serverMessage,t}=useJskitText();var messageText=value=>String(value||``).trim();function turnMatchesOptimisticMessage(turn={},optimistic={}){const authored=optimistic.origin===`application`?turn.system:turn.user;const canonicalMessageId=messageText(authored?.messageId);const optimisticMessageId=messageText(optimistic.id);if(canonicalMessageId&&optimisticMessageId)return canonicalMessageId===optimisticMessageId;if(messageText(authored?.text)!==optimistic.text)return false;const userAtMs=Date.parse(String(authored?.at||``));return Number.isFinite(userAtMs)&&userAtMs>=optimistic.createdAtMs-5e3}function unmatchedOptimisticMessages(turns=[],optimisticMessages=[],{receiptsOnly=false}={}){const conversationTurns=Array.isArray(turns)?turns:[];const matchedTurnIndexes=new Set;return(Array.isArray(optimisticMessages)?optimisticMessages:[]).filter(message=>{const turnIndex=conversationTurns.findIndex((turn,index)=>!matchedTurnIndexes.has(index)&&turnMatchesOptimisticMessage(turn,message)&&(!receiptsOnly||message.status===`accepted`||(message.origin===`application`?turn.system:turn.user)?.receipt!==false));if(turnIndex<0)return true;matchedTurnIndexes.add(turnIndex);return false})}function createAssistantMessageDelivery({deliver:defaultDeliver}={}){const state=reactive({messages:[],sending:false});const acceptanceCallbacks=new WeakMap;let deliveryTail=null;let pendingSends=new Map;function find(messageId){return state.messages.find(message=>message.id===messageId)||null}function remove(messageId){state.messages=state.messages.filter(message=>message.id!==messageId)}function reconcile(turns){const unmatched=unmatchedOptimisticMessages(turns,state.messages,{receiptsOnly:true});const retained=new Set(unmatched.map(message=>message.id));for(const message of state.messages)if(!retained.has(message.id))accept(message.id);state.messages=unmatched}function turns(savedTurns=[]){const shown=[...savedTurns.map(turn=>{const message=state.messages.find(message=>message.status!==`accepted`&&turnMatchesOptimisticMessage(turn,message)&&(message.origin===`application`?turn.system:turn.user)?.receipt===false);if(!message)return turn;const pending=optimisticTurn(message);return{...turn,optimistic:pending.optimistic,...pending.system?{system:pending.system}:{}}})];for(const message of unmatchedOptimisticMessages(savedTurns,state.messages)){const turn=optimisticTurn(message);const later=message.status!==`failed`?-1:shown.findIndex(saved=>!saved.optimistic&&Date.parse((saved.user||saved.system)?.at||``)>message.createdAtMs);if(later<0)shown.push(turn);else shown.splice(later,0,turn)}return shown}function optimisticTurn(message){const role=message.origin===`application`?`system`:`user`;const authored={attachments:message.attachments,at:message.createdAt,messageId:message.id,role,text:message.text};const status=message.status===`uncertain`?{role:`system`,text:t(`jskit.assistant.delivery.notConfirmed`),delivery:{messageId:message.id,error:message.error,checking:message.checking===true}}:null;return{optimistic:{error:message.error,id:message.id,status:message.status,...message.status===`pending`&&message.waiting?{waiting:message.waiting}:{}},turnId:message.id,[role]:authored,...status?{system:role===`system`?{...authored,...status,text:`${authored.text}\n\n${status.text}`}:status}:{}}}async function send(payload,{messageId=crypto.randomUUID(),deliver=defaultDeliver,isCurrent=()=>true,receiptTurns=null,onAccepted,uncertainOnError=false,queue=false}={}){if(state.sending&&!queue||pendingSends.has(messageId)||find(messageId)?.status===`uncertain`||!messageText(payload?.message)&&!payload?.displayAttachments?.length)return false;if(typeof deliver!==`function`)throw new TypeError(`Message delivery requires a deliver function.`);const snapshot=JSON.parse(JSON.stringify(payload));const previous=find(messageId);const acknowledge=previous&&acceptanceCallbacks.get(toRaw(previous))||onAccepted;const ownerPendingSends=pendingSends;const current=()=>pendingSends===ownerPendingSends&&isCurrent();const predecessor=deliveryTail;const knownUncertain=new Set(state.messages.filter(entry=>entry.status===`uncertain`).map(entry=>entry.id));const settled=Promise.withResolvers();deliveryTail=settled.promise;ownerPendingSends.set(messageId,settled);const now=new Date;const message={attachments:snapshot.displayAttachments||[],createdAt:now.toISOString(),createdAtMs:now.getTime(),error:``,id:messageId,payload:snapshot,status:`pending`,text:String(snapshot.displayMessage||snapshot.message||``).trim()};if(typeof acknowledge===`function`)acceptanceCallbacks.set(message,acknowledge);state.messages=[...state.messages.filter(entry=>entry.id!==messageId),message];state.sending=true;let stopReceipt;try{if(predecessor)await predecessor;if(!current())return false;if(uncertainOnError&&state.messages.some(entry=>entry.id!==messageId&&entry.status===`uncertain`&&!knownUncertain.has(entry.id))){fail(messageId,t(`jskit.assistant.delivery.checkPrevious`));return false}let receipt;if(receiptTurns!==null){receipt=Promise.withResolvers();settled.receipt=receipt;stopReceipt=watch([current,()=>toValue(receiptTurns)],([isCurrent,turns])=>{if(!isCurrent)receipt.resolve(false);else if(turns?.some(turn=>turn.user?.messageId===messageId&&turn.user.receipt!==false))receipt.resolve({ok:true})},{immediate:true})}const submitted=deliver({...snapshot,messageId});const response=await(receipt?Promise.race([submitted,receipt.promise]):submitted);if(!current())return false;if(response===false||response?.ok===false)fail(messageId,response?.error||t(`jskit.assistant.delivery.notSent`),response?.status===`uncertain`?`uncertain`:`failed`);else accept(messageId);return response}catch(error){if(!current())return false;if(find(messageId)?.status===`accepted`)return{ok:true};fail(messageId,error,uncertainOnError||error?.status===`uncertain`?`uncertain`:`failed`);throw error}finally{stopReceipt?.();ownerPendingSends.delete(messageId);if(pendingSends===ownerPendingSends){state.sending=ownerPendingSends.size>0;if(!state.sending)deliveryTail=null}settled.resolve()}}function fail(messageId,error,status=`failed`){const message=find(messageId);if(message&&message.status!==`accepted`){const text=error&&typeof error===`object`?serverMessage(error):``;message.error=String(text||error?.message||error||t(`jskit.assistant.delivery.notSent`)).trim();message.status=status}}function accept(messageId){const message=find(messageId);if(message){message.status=`accepted`;message.error=``}pendingSends.get(messageId)?.receipt?.resolve({ok:true});if(message){const entry=toRaw(message);const acknowledge=acceptanceCallbacks.get(entry);acceptanceCallbacks.delete(entry);acknowledge?.()}}function wait(messageId,reason=``){const message=find(messageId);if(message?.status===`pending`)message.waiting=String(reason||``).trim()}function rejectUnsent(messageId,error){if(find(messageId)?.status!==`uncertain`)return false;fail(messageId,error);return true}function restoreUncertain(request,savedTurns=[]){const messageId=messageText(request?.messageId);if(!messageId||savedTurns.some(turn=>(turn.user||turn.system)?.messageId===messageId&&(turn.user||turn.system).receipt!==false)||find(messageId)?.status===`accepted`)return false;if(!find(messageId)){const payload=JSON.parse(JSON.stringify({message:request.text||``,displayAttachments:request.attachments||[]}));const createdAt=request.at||new Date().toISOString();state.messages=[...state.messages,{id:messageId,payload,text:payload.message,origin:request.origin,attachments:payload.displayAttachments,createdAt,createdAtMs:Date.parse(createdAt),status:`uncertain`,error:``}]}fail(messageId,(request.error?serverMessage({message:request.error,messageCode:request.errorMessageCode,messageParams:request.errorMessageParams}):``)||t(`jskit.assistant.delivery.unconfirmed`),`uncertain`);pendingSends.get(messageId)?.receipt?.resolve({ok:false,status:`uncertain`,error:request.error});return true}function cancel(messageId){if(find(messageId)?.status!==`failed`)return false;remove(messageId);return true}function edit(messageId,draft=``){const message=find(messageId);if(!message||!cancel(messageId))return null;return draftWithRestoredMessage(message.text,draft)}function resend(messageId,{queue=false}={}){const message=find(messageId);if(message?.status!==`failed`)return false;return send(message.payload,{messageId,queue})}function reset(){deliveryTail=null;for(const pending of pendingSends.values()){pending.receipt?.resolve(false);pending.resolve()}pendingSends=new Map;state.messages=[];state.sending=false}return{accept,cancel,edit,find,reconcile,remove,resend,reset,restoreUncertain,rejectUnsent,send,state,turns,wait}}function draftWithRestoredMessage(text=``,draft=``){return!draft||draft.startsWith(text)?draft||text:`${text}\n\n${draft}`}export{en_default as C,AssistantMessageAttachments_default as S,scrollElementNearBottom as _,assistantAttachmentFilesFromPasteEvent as a,LongTextPreviewBlocks_default as b,useAssistantSuggestions as c,AssistantQuestionInputs_default as d,AssistantAttachmentQueue_default as f,AssistantTranscript_default as g,AssistantPromptInput_default as h,assistantAttachmentFilesFromDropEvent as i,AssistantConversationElement_default as l,AssistantComposerSupport_default as m,unmatchedOptimisticMessages as n,useAssistantAttachments as o,AssistantGoalControl_default as p,AssistantAttachmentPreview_default as r,useAssistantQuestions as s,createAssistantMessageDelivery as t,AssistantModelControl_default as u,useScrollToBottom as v,parseLongTextReviewBlocks as x,_sfc_main$11 as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{D as createVNode,On as unref,mt as openBlock,qt as withCtx,v as createBlock}from"./runtime-core.esm-bundler-DGXg_mpN.js";import{
|
|
1
|
+
import{D as createVNode,On as unref,mt as openBlock,qt as withCtx,v as createBlock}from"./runtime-core.esm-bundler-DGXg_mpN.js";import{ut as RouterView}from"./index-CGz4Yow6.js";import{t as Vibe64DashboardShell_default}from"./Vibe64DashboardShell-CWlgrR2B.js";var _sfc_main={__name:`dashboard`,props:{dashboardContext:{default:()=>({}),type:Object}},setup(__props){const props=__props;return(_ctx,_cache)=>{return __props.dashboardContext?.embeddedShell?(openBlock(),createBlock(unref(RouterView),{key:0,"dashboard-context":__props.dashboardContext},null,8,[`dashboard-context`])):(openBlock(),createBlock(Vibe64DashboardShell_default,{key:1,"dashboard-context":props.dashboardContext},{default:withCtx(()=>[createVNode(unref(RouterView),{"dashboard-context":__props.dashboardContext},null,8,[`dashboard-context`])]),_:1},8,[`dashboard-context`]))}}};export{_sfc_main as default};
|