@8wave/ai-elements 0.123.0-beta.14 → 0.123.0-beta.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{PkChatbotFilePreview-Dgikkf9Y.js → PkChatbotFilePreview-Dk748hZ0.js} +2 -2
- package/dist/_chunks/{PkChatbotFilePreview-Dgikkf9Y.js.map → PkChatbotFilePreview-Dk748hZ0.js.map} +1 -1
- package/dist/_chunks/{PkFilePreview-CG9peejh.js → PkFilePreview-Bcdfci6i.js} +2 -2
- package/dist/_chunks/{PkFilePreview-CG9peejh.js.map → PkFilePreview-Bcdfci6i.js.map} +1 -1
- package/dist/_chunks/{PkFilePreviewDialog-jzUvrw9R.js → PkFilePreviewDialog-nibxELSF.js} +2 -2
- package/dist/_chunks/{PkFilePreviewDialog-jzUvrw9R.js.map → PkFilePreviewDialog-nibxELSF.js.map} +1 -1
- package/dist/_chunks/{PkStreamingMarkdown-DI1AjsVC.js → PkStreamingMarkdown-C6cFkf82.js} +4 -4
- package/dist/_chunks/{PkStreamingMarkdown-DI1AjsVC.js.map → PkStreamingMarkdown-C6cFkf82.js.map} +1 -1
- package/dist/_chunks/{PkToolChatFile-BKX_7nJp.js → PkToolChatFile-5t_1vL81.js} +3 -3
- package/dist/_chunks/{PkToolChatFile-BKX_7nJp.js.map → PkToolChatFile-5t_1vL81.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestOAuthConnection-BYXzi6XB.js → PkToolRequestOAuthConnection-ST3-OlS4.js} +2 -2
- package/dist/_chunks/{PkToolRequestOAuthConnection-BYXzi6XB.js.map → PkToolRequestOAuthConnection-ST3-OlS4.js.map} +1 -1
- package/dist/_chunks/{PkToolShareDocument-D2uV6p8t.js → PkToolShareDocument-1zhZDa0R.js} +2 -2
- package/dist/_chunks/{PkToolShareDocument-D2uV6p8t.js.map → PkToolShareDocument-1zhZDa0R.js.map} +1 -1
- package/dist/_chunks/{PkToolShowArtifact-CyKWxAff.js → PkToolShowArtifact-DV78g_yD.js} +2 -2
- package/dist/_chunks/{PkToolShowArtifact-CyKWxAff.js.map → PkToolShowArtifact-DV78g_yD.js.map} +1 -1
- package/dist/_chunks/{PkToolShowCalendarEvent-BF2aXrwP.js → PkToolShowCalendarEvent-Dvp1SwBY.js} +2 -2
- package/dist/_chunks/{PkToolShowCalendarEvent-BF2aXrwP.js.map → PkToolShowCalendarEvent-Dvp1SwBY.js.map} +1 -1
- package/dist/_chunks/{PkToolShowContactForm-C-U785n6.js → PkToolShowContactForm-Bnjy0g50.js} +4 -4
- package/dist/_chunks/{PkToolShowContactForm-C-U785n6.js.map → PkToolShowContactForm-Bnjy0g50.js.map} +1 -1
- package/dist/_chunks/{PkToolShowDiagram-Bs5Ri9df.js → PkToolShowDiagram-C1Q5jhbk.js} +3 -3
- package/dist/_chunks/{PkToolShowDiagram-Bs5Ri9df.js.map → PkToolShowDiagram-C1Q5jhbk.js.map} +1 -1
- package/dist/_chunks/{PkToolShowForm-CN5jvQqQ.js → PkToolShowForm-CT5_ln9b.js} +3 -3
- package/dist/_chunks/{PkToolShowForm-CN5jvQqQ.js.map → PkToolShowForm-CT5_ln9b.js.map} +1 -1
- package/dist/_chunks/{PkToolShowImageGallery-BtgWr1lk.js → PkToolShowImageGallery-BMP-xuYr.js} +4 -4
- package/dist/_chunks/{PkToolShowImageGallery-BtgWr1lk.js.map → PkToolShowImageGallery-BMP-xuYr.js.map} +1 -1
- package/dist/_chunks/{PkToolShowLocation-COmQJbXp.js → PkToolShowLocation-Drq1nnwN.js} +2 -2
- package/dist/_chunks/{PkToolShowLocation-COmQJbXp.js.map → PkToolShowLocation-Drq1nnwN.js.map} +1 -1
- package/dist/_chunks/{PkToolShowProductList-CRy6jNPa.js → PkToolShowProductList-AkLG4dBV.js} +2 -2
- package/dist/_chunks/{PkToolShowProductList-CRy6jNPa.js.map → PkToolShowProductList-AkLG4dBV.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSources-CQweChKW.js → PkToolShowSources-DhZ5I_J-.js} +3 -3
- package/dist/_chunks/{PkToolShowSources-CQweChKW.js.map → PkToolShowSources-DhZ5I_J-.js.map} +1 -1
- package/dist/_chunks/{PkToolShowVideo-C8dP8I-g.js → PkToolShowVideo-C5jqPYXw.js} +3 -3
- package/dist/_chunks/{PkToolShowVideo-C8dP8I-g.js.map → PkToolShowVideo-C5jqPYXw.js.map} +1 -1
- package/dist/_chunks/{PkToolShowWeather-sx72yMH6.js → PkToolShowWeather-7_f5k1pX.js} +2 -2
- package/dist/_chunks/{PkToolShowWeather-sx72yMH6.js.map → PkToolShowWeather-7_f5k1pX.js.map} +1 -1
- package/dist/_chunks/{PkToolShowWebPages-fXkqV27c.js → PkToolShowWebPages-BqL9PjpM.js} +3 -3
- package/dist/_chunks/{PkToolShowWebPages-fXkqV27c.js.map → PkToolShowWebPages-BqL9PjpM.js.map} +1 -1
- package/dist/_chunks/{browser-CwAulEhA.js → browser-DnbodHv5.js} +32 -18
- package/dist/_chunks/browser-DnbodHv5.js.map +1 -0
- package/dist/_chunks/{chatImagePolicy-B183jp31.js → chatImagePolicy-ZiVuD6nX.js} +2 -2
- package/dist/_chunks/{chatImagePolicy-B183jp31.js.map → chatImagePolicy-ZiVuD6nX.js.map} +1 -1
- package/dist/_chunks/{index.es-DYy-Q9hZ.js → index.es-DRbDRAW5.js} +2 -2
- package/dist/_chunks/{index.es-DYy-Q9hZ.js.map → index.es-DRbDRAW5.js.map} +1 -1
- package/dist/_chunks/src-JJyCGvqH.js +183 -0
- package/dist/_chunks/src-JJyCGvqH.js.map +1 -0
- package/dist/_chunks/{useLightbox-B575Qxeu.js → useLightbox-BigL4WLe.js} +2 -2
- package/dist/_chunks/{useLightbox-B575Qxeu.js.map → useLightbox-BigL4WLe.js.map} +1 -1
- package/dist/_chunks/{utils-COV6n6VV.js → utils-B5VcWm3g.js} +2 -2
- package/dist/_chunks/{utils-COV6n6VV.js.map → utils-B5VcWm3g.js.map} +1 -1
- package/dist/ai-elements.es.js +23 -23
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotAudioTranscript.js +1 -1
- package/dist-vue/PkChatbotEmptyState.js +1 -1
- package/dist-vue/PkChatbotFilePreview.js +1 -1
- package/dist-vue/PkChatbotInput.js +1 -1
- package/dist-vue/PkChatbotMessages.js +1 -1
- package/dist-vue/PkChatbotStepPayload.js +1 -1
- package/dist-vue/PkChatbotStepToolDetail.js +1 -1
- package/dist-vue/PkChatbotSteps.js +1 -1
- package/dist-vue/PkChatbotViewChat.js +1 -1
- package/dist-vue/PkChatbotViewConversations.js +1 -1
- package/dist-vue/PkChatbotViewFiles.js +1 -1
- package/dist-vue/PkChatbotViewProfile.js +1 -1
- package/dist-vue/_chunks/{PkChatbot-DGut25cv.js → PkChatbot-tq-fJUij.js} +8 -8
- package/dist-vue/_chunks/{PkChatbot-DGut25cv.js.map → PkChatbot-tq-fJUij.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotAudioTranscript-DiZ7BEEH.js → PkChatbotAudioTranscript-SSTh074Z.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotAudioTranscript-DiZ7BEEH.js.map → PkChatbotAudioTranscript-SSTh074Z.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotEmptyState-DT9Pxyjt.js → PkChatbotEmptyState-Dp0_UPJm.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotEmptyState-DT9Pxyjt.js.map → PkChatbotEmptyState-Dp0_UPJm.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotFilePreview-BiurawUn.js → PkChatbotFilePreview-KxVpL0UT.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotFilePreview-BiurawUn.js.map → PkChatbotFilePreview-KxVpL0UT.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotInput-liQNntaY.js → PkChatbotInput-B_kPnNNB.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotInput-liQNntaY.js.map → PkChatbotInput-B_kPnNNB.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotMessages-CDhi_NvV.js → PkChatbotMessages-BTZOic9V.js} +22 -22
- package/dist-vue/_chunks/{PkChatbotMessages-CDhi_NvV.js.map → PkChatbotMessages-BTZOic9V.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepPayload-XMAC8eoc.js → PkChatbotStepPayload-CoGCHBhJ.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotStepPayload-XMAC8eoc.js.map → PkChatbotStepPayload-CoGCHBhJ.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-CPWnpmuB.js → PkChatbotStepToolDetail-BJtIZBF0.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-CPWnpmuB.js.map → PkChatbotStepToolDetail-BJtIZBF0.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotSteps-CyT4Ck3C.js → PkChatbotSteps-CEJNclG4.js} +5 -5
- package/dist-vue/_chunks/{PkChatbotSteps-CyT4Ck3C.js.map → PkChatbotSteps-CEJNclG4.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewChat-8Ss2bt2I.js → PkChatbotViewChat-CnEOSH32.js} +8 -8
- package/dist-vue/_chunks/{PkChatbotViewChat-8Ss2bt2I.js.map → PkChatbotViewChat-CnEOSH32.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewConversations-ImCdmkUi.js → PkChatbotViewConversations-D7j5P1RO.js} +4 -4
- package/dist-vue/_chunks/{PkChatbotViewConversations-ImCdmkUi.js.map → PkChatbotViewConversations-D7j5P1RO.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewFiles-Ccti1JAS.js → PkChatbotViewFiles-B1mncBOo.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewFiles-Ccti1JAS.js.map → PkChatbotViewFiles-B1mncBOo.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewProfile-ChEItAHZ.js → PkChatbotViewProfile--TWIrhYk.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewProfile-ChEItAHZ.js.map → PkChatbotViewProfile--TWIrhYk.js.map} +1 -1
- package/dist-vue/_chunks/{PkFilePreview-CfzGAziV.js → PkFilePreview-BKwnNsyV.js} +2 -2
- package/dist-vue/_chunks/{PkFilePreview-CfzGAziV.js.map → PkFilePreview-BKwnNsyV.js.map} +1 -1
- package/dist-vue/_chunks/{PkFilePreviewDialog-DXIGcmYa.js → PkFilePreviewDialog-Cic7gmVR.js} +2 -2
- package/dist-vue/_chunks/{PkFilePreviewDialog-DXIGcmYa.js.map → PkFilePreviewDialog-Cic7gmVR.js.map} +1 -1
- package/dist-vue/_chunks/{PkStreamingMarkdown-BTcd7ku7.js → PkStreamingMarkdown-CYlCIfA0.js} +3 -3
- package/dist-vue/_chunks/{PkStreamingMarkdown-BTcd7ku7.js.map → PkStreamingMarkdown-CYlCIfA0.js.map} +1 -1
- package/dist-vue/_chunks/{PkSvgViewer-CvKzI689.js → PkSvgViewer-DBYr0CUi.js} +2 -2
- package/dist-vue/_chunks/{PkSvgViewer-CvKzI689.js.map → PkSvgViewer-DBYr0CUi.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolChatFile-DHZjc9cf.js → PkToolChatFile-B_PeJef8.js} +3 -3
- package/dist-vue/_chunks/{PkToolChatFile-DHZjc9cf.js.map → PkToolChatFile-B_PeJef8.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolRequestOAuthConnection-Dy0GXNwC.js → PkToolRequestOAuthConnection-C9_w8V0T.js} +2 -2
- package/dist-vue/_chunks/{PkToolRequestOAuthConnection-Dy0GXNwC.js.map → PkToolRequestOAuthConnection-C9_w8V0T.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShareDocument-DHrzH95L.js → PkToolShareDocument-CsS5OTDj.js} +2 -2
- package/dist-vue/_chunks/{PkToolShareDocument-DHrzH95L.js.map → PkToolShareDocument-CsS5OTDj.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowArtifact-BDfqYsCD.js → PkToolShowArtifact-Bh-jIo0V.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowArtifact-BDfqYsCD.js.map → PkToolShowArtifact-Bh-jIo0V.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowCalendarEvent-75TaGeMf.js → PkToolShowCalendarEvent-BsAOYLjp.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowCalendarEvent-75TaGeMf.js.map → PkToolShowCalendarEvent-BsAOYLjp.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowContactForm-4f3q-cfC.js → PkToolShowContactForm-BjfRuNuj.js} +4 -4
- package/dist-vue/_chunks/{PkToolShowContactForm-4f3q-cfC.js.map → PkToolShowContactForm-BjfRuNuj.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowDiagram-CwowbfOT.js → PkToolShowDiagram-_NnrFDGT.js} +4 -4
- package/dist-vue/_chunks/{PkToolShowDiagram-CwowbfOT.js.map → PkToolShowDiagram-_NnrFDGT.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowForm-xFFBo17s.js → PkToolShowForm-AqEY4_do.js} +3 -3
- package/dist-vue/_chunks/{PkToolShowForm-xFFBo17s.js.map → PkToolShowForm-AqEY4_do.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowImageGallery-_hd3FyqC.js → PkToolShowImageGallery-DM5AJNZ3.js} +4 -4
- package/dist-vue/_chunks/{PkToolShowImageGallery-_hd3FyqC.js.map → PkToolShowImageGallery-DM5AJNZ3.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowLocation-C7hBRwq8.js → PkToolShowLocation-DAQEuCuQ.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowLocation-C7hBRwq8.js.map → PkToolShowLocation-DAQEuCuQ.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowProductList-BPSYoZVU.js → PkToolShowProductList-CAV8be9a.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowProductList-BPSYoZVU.js.map → PkToolShowProductList-CAV8be9a.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSources-CzFNTuWy.js → PkToolShowSources-CriswKr_.js} +3 -3
- package/dist-vue/_chunks/{PkToolShowSources-CzFNTuWy.js.map → PkToolShowSources-CriswKr_.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowVideo-Dr7UtU-3.js → PkToolShowVideo-FSWM5MOl.js} +3 -3
- package/dist-vue/_chunks/{PkToolShowVideo-Dr7UtU-3.js.map → PkToolShowVideo-FSWM5MOl.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowWeather-Z6vCrhh9.js → PkToolShowWeather-BC-Rx-sI.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowWeather-Z6vCrhh9.js.map → PkToolShowWeather-BC-Rx-sI.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowWebPages-CAeOJ5xx.js → PkToolShowWebPages-CPhm2ba3.js} +3 -3
- package/dist-vue/_chunks/{PkToolShowWebPages-CAeOJ5xx.js.map → PkToolShowWebPages-CPhm2ba3.js.map} +1 -1
- package/dist-vue/_chunks/{createChatbotApiClient-CuqGJGHD.js → createChatbotApiClient-CFKeOgEA.js} +2 -2
- package/dist-vue/_chunks/{createChatbotApiClient-CuqGJGHD.js.map → createChatbotApiClient-CFKeOgEA.js.map} +1 -1
- package/dist-vue/_chunks/{mcpOAuthReport-BdegDfcz.js → mcpOAuthReport-D-MtFYwN.js} +2 -2
- package/dist-vue/_chunks/{mcpOAuthReport-BdegDfcz.js.map → mcpOAuthReport-D-MtFYwN.js.map} +1 -1
- package/dist-vue/_chunks/src-nb8MU1sh.js +183 -0
- package/dist-vue/_chunks/src-nb8MU1sh.js.map +1 -0
- package/dist-vue/_chunks/{useChatbotStore-C1lW6qXE.js → useChatbotStore--6ws3cew.js} +4 -4
- package/dist-vue/_chunks/{useChatbotStore-C1lW6qXE.js.map → useChatbotStore--6ws3cew.js.map} +1 -1
- package/dist-vue/_chunks/{useSafeLocalStorage-DImmddot.js → useSafeLocalStorage-Bn4SsL8C.js} +2 -2
- package/dist-vue/_chunks/{useSafeLocalStorage-DImmddot.js.map → useSafeLocalStorage-Bn4SsL8C.js.map} +1 -1
- package/dist-vue/_chunks/{utils-D9BAduwQ.js → utils-BgvjC1Pu.js} +2 -2
- package/dist-vue/_chunks/{utils-D9BAduwQ.js.map → utils-BgvjC1Pu.js.map} +1 -1
- package/dist-vue/api.js +1 -1
- package/dist-vue/composables.js +4 -4
- package/dist-vue/index.js +31 -31
- package/package.json +1 -1
- package/dist/_chunks/browser-CwAulEhA.js.map +0 -1
- package/dist/_chunks/src-Bg96usAF.js +0 -132
- package/dist/_chunks/src-Bg96usAF.js.map +0 -1
- package/dist-vue/_chunks/src-j7iLdNe4.js +0 -132
- package/dist-vue/_chunks/src-j7iLdNe4.js.map +0 -1
package/dist/_chunks/{PkToolShowWeather-sx72yMH6.js.map → PkToolShowWeather-7_f5k1pX.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PkToolShowWeather-sx72yMH6.js","names":["z.object","z.number","z.string","z.array","__unplugin_components_0","__unplugin_components_1","_openBlock","_createElementBlock","_createVNode","_createElementVNode","_toDisplayString","_unref","_createTextVNode","_createCommentVNode","_Transition","_withCtx","_Fragment","_renderList","_createBlock","_normalizeClass","_sfc_main","object","string","number","array","normalizeClass","watch","createVNode","init_shared_esm_bundler","renderList","createBlock","Fragment","createBaseVNode","ref","computed","init_runtime_core_esm_bundler","toDisplayString","init_reactivity_esm_bundler","init_runtime_dom_esm_bundler","Transition","withCtx","createCommentVNode","defineComponent","unref","createTextVNode","createElementBlock","openBlock","useI18n","Lr","Ce","WeatherCurrentSchema","WeatherHourlySchema","WeatherDailySchema","AirQualitySchema","hasWeatherForecast","value","current","hourly","daily","wmoCategory","code","aqiBand","aqi","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","_hoisted_17","_hoisted_18","_hoisted_19","_hoisted_20","_hoisted_21","_hoisted_22","_hoisted_23","_hoisted_24","_hoisted_25","_hoisted_26","_hoisted_27","_hoisted_28","_hoisted_29","_hoisted_30","_hoisted_31","_hoisted_32","_hoisted_33","_hoisted_34","_hoisted_35","PkToolShowWeather_default","props","__props","$t","$d","$n","toolPart","data","output","input","isUnavailable","selectedDayIndex","dailyOpen","index","selectedDay","filteredHourly","dayDate","h","safeDate","direct","withT","timeOnly","today","noon","WMO_ICON","wmoToIcon","formatDay","parsed","isoDate","total","fallback","headerDate","AQI_PRESENTATION","aqiInfo","cssClass","labelKey","windDirectionLabel","deg","_component_VvIcon","_component_VvAccordion","hour","_cache","$event","day"],"sources":["../../../../packages/models/src/schema/Weather.ts","../../../../packages/utils/src/weather.ts","../../../../packages/components/src/chat/PkToolShowWeather.vue","../../../../packages/components/src/chat/PkToolShowWeather.vue"],"sourcesContent":["import { z } from 'zod'\n\n/**\n * The weather data contract shared by the `getWeather`/`showWeather` backend\n * tools, the web widget (`PkToolShowWeather.vue`), and the platform card\n * renderer. Single source of truth — do not redeclare these shapes elsewhere.\n */\n\nconst WeatherCurrentSchema = z.object({\n temperature: z.number().describe('Temperature in °C'),\n feelsLike: z.number().describe('Apparent temperature in °C'),\n humidity: z.number().describe('Relative humidity in %'),\n precipitation: z.number().describe('Precipitation in mm'),\n weatherCode: z.number().describe('WMO weather interpretation code'),\n windSpeed: z.number().describe('Wind speed in km/h'),\n windDirection: z.number().describe('Wind direction in degrees'),\n uvIndex: z.number().describe('UV index'),\n})\n\nconst WeatherHourlySchema = z.object({\n time: z.string(),\n temperature: z.number(),\n precipitationProbability: z.number(),\n precipitation: z.number(),\n weatherCode: z.number(),\n windSpeed: z.number(),\n})\n\nconst WeatherDailySchema = z.object({\n date: z.string(),\n maxTemp: z.number(),\n minTemp: z.number(),\n weatherCode: z.number(),\n precipitationSum: z.number(),\n precipitationProbabilityMax: z.number(),\n uvIndexMax: z.number(),\n sunrise: z.string(),\n sunset: z.string(),\n})\n\nconst AirQualitySchema = z.object({\n aqi: z.number().describe('European AQI index'),\n pm10: z.number().describe('PM10 in µg/m³'),\n pm25: z.number().describe('PM2.5 in µg/m³'),\n no2: z.number().describe('NO₂ in µg/m³'),\n ozone: z.number().describe('Ozone in µg/m³'),\n})\n\nexport const WeatherDataSchema = z.object({\n locationName: z.string(),\n latitude: z.number(),\n longitude: z.number(),\n timezone: z.string(),\n current: WeatherCurrentSchema.nullable().describe(\n 'Current conditions — null when viewing a future date range',\n ),\n hourly: z\n .array(WeatherHourlySchema)\n .describe('Hourly forecast for the requested range'),\n daily: z\n .array(WeatherDailySchema)\n .describe('Daily forecast for the requested range'),\n airQuality: AirQualitySchema.nullable(),\n})\n\nexport type WeatherData = z.infer<typeof WeatherDataSchema>\n\n/**\n * Whether a value carries something the weather card can draw: current\n * conditions, or at least one hourly or daily entry. `showWeather` takes only\n * a `weatherKey`, so its input is a forecast only in conversations from before\n * the key, and a call that failed (a mangled key, expired data) has no output.\n */\nexport function hasWeatherForecast(value: unknown): value is WeatherData {\n if (!value || typeof value !== 'object') {\n return false\n }\n const { current, hourly, daily } = value as Partial<WeatherData>\n return (\n typeof current?.temperature === 'number' ||\n (Array.isArray(hourly) && hourly.length > 0) ||\n (Array.isArray(daily) && daily.length > 0)\n )\n}\n","/**\n * Framework-agnostic weather presentation primitives. They classify raw\n * open-meteo values into canonical categories; each consumer (web widget,\n * platform card renderer) maps a category to its own representation (an\n * Iconify name, an emoji, a CSS class, an i18n key). Keeping the classification\n * here means the WMO code bands and AQI thresholds live in exactly one place.\n */\n\n/** Canonical WMO weather-code category (resolution matches the web widget). */\nexport type WmoCategory =\n | 'clear'\n | 'mainlyClear'\n | 'partlyCloudy'\n | 'overcast'\n | 'fog'\n | 'drizzle'\n | 'freezingDrizzle'\n | 'rain'\n | 'freezingRain'\n | 'snow'\n | 'rainShowers'\n | 'snowShowers'\n | 'thunderstorm'\n | 'thunderstormHail'\n | 'unknown'\n\n/** Map a WMO weather interpretation code to a canonical category. */\nexport function wmoCategory(code: number | undefined): WmoCategory {\n if (code === undefined) {\n return 'unknown'\n }\n if (code === 0) {\n return 'clear'\n }\n if (code === 1) {\n return 'mainlyClear'\n }\n if (code === 2) {\n return 'partlyCloudy'\n }\n if (code === 3) {\n return 'overcast'\n }\n if (code === 45 || code === 48) {\n return 'fog'\n }\n if (code >= 51 && code <= 55) {\n return 'drizzle'\n }\n if (code === 56 || code === 57) {\n return 'freezingDrizzle'\n }\n if (code >= 61 && code <= 65) {\n return 'rain'\n }\n if (code === 66 || code === 67) {\n return 'freezingRain'\n }\n if (code >= 71 && code <= 77) {\n return 'snow'\n }\n if (code >= 80 && code <= 82) {\n return 'rainShowers'\n }\n if (code === 85 || code === 86) {\n return 'snowShowers'\n }\n if (code === 95) {\n return 'thunderstorm'\n }\n if (code === 96 || code === 99) {\n return 'thunderstormHail'\n }\n return 'unknown'\n}\n\n/** Emoji per category (used by the language-neutral platform card renderer). */\nconst WMO_EMOJI: Record<WmoCategory, string> = {\n clear: '☀️',\n mainlyClear: '⛅',\n partlyCloudy: '⛅',\n overcast: '⛅',\n fog: '🌫️',\n drizzle: '🌦️',\n freezingDrizzle: '🌦️',\n rain: '🌧️',\n freezingRain: '🌧️',\n snow: '❄️',\n rainShowers: '🌧️',\n snowShowers: '🌨️',\n thunderstorm: '⛈️',\n thunderstormHail: '⛈️',\n unknown: '🌡️',\n}\n\n/** WMO code → emoji (convenience for non-UI consumers). */\nexport function wmoEmoji(code: number | undefined): string {\n return WMO_EMOJI[wmoCategory(code)]\n}\n\n/** Canonical European-AQI band, ordered best → worst. */\nexport type AqiBandKey =\n 'good' | 'fair' | 'moderate' | 'poor' | 'veryPoor' | 'hazardous'\n\n/** Classify a European AQI value into a band (index + canonical key). */\nexport function aqiBand(aqi: number): { index: number; key: AqiBandKey } {\n if (aqi <= 20) {\n return { index: 0, key: 'good' }\n }\n if (aqi <= 40) {\n return { index: 1, key: 'fair' }\n }\n if (aqi <= 60) {\n return { index: 2, key: 'moderate' }\n }\n if (aqi <= 80) {\n return { index: 3, key: 'poor' }\n }\n if (aqi <= 100) {\n return { index: 4, key: 'veryPoor' }\n }\n return { index: 5, key: 'hazardous' }\n}\n\n/** Colored dot per AQI band index (used by the platform card renderer). */\nconst AQI_DOTS = ['🟢', '🟡', '🟠', '🔴', '🟣', '⚫']\n\n/** AQI value → colored dot (convenience for non-UI consumers). */\nexport function aqiDot(aqi: number): string {\n return AQI_DOTS[aqiBand(aqi).index]\n}\n","<script setup lang=\"ts\">\n import { computed, ref, watch } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { hasWeatherForecast } from 'models'\n import {\n aqiBand,\n wmoCategory,\n type AqiBandKey,\n type WmoCategory,\n } from 'utils'\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const { t: $t, d: $d, n: $n } = useI18n({ useScope: 'global' })\n\n const toolPart = computed(() => {\n return props.part as {\n state?: string\n input?: unknown\n output?: unknown\n }\n })\n\n const data = computed(() => {\n const { output, input } = toolPart.value\n if (hasWeatherForecast(output)) {\n return output\n }\n // Conversations from before `weatherKey` passed the whole forecast\n return hasWeatherForecast(input) ? input : null\n })\n\n /**\n * The call is over and left nothing to draw: a mangled or expired key\n * fails the tool, and its input is only the key. Without this the card\n * drew a thermometer and \"Oggi\" around nothing. While the call runs there\n * is nothing to draw yet, and nothing has failed either: the card waits.\n */\n const isUnavailable = computed(\n () =>\n !data.value &&\n toolPart.value.state !== 'input-streaming' &&\n toolPart.value.state !== 'input-available',\n )\n\n const selectedDayIndex = ref(0)\n\n const dailyOpen = ref(!data.value?.current)\n\n watch(selectedDayIndex, (index) => {\n if (index > 0) {\n dailyOpen.value = true\n }\n })\n\n const selectedDay = computed(\n () => data.value?.daily?.[selectedDayIndex.value],\n )\n\n /** Hourly entries filtered to the selected day's date */\n const filteredHourly = computed(() => {\n if (!data.value?.hourly?.length || !selectedDay.value) {\n return data.value?.hourly ?? []\n }\n const dayDate = selectedDay.value.date\n return data.value.hourly.filter((h) => h.time.startsWith(dayDate))\n })\n\n /**\n * Parses a date/time string in various formats the LLM might produce.\n * Tries ISO, space-separated, time-only, and common human-readable formats.\n */\n function safeDate(value: string): Date {\n // 1. Try native parsing (works for ISO 8601 and many standard formats)\n const direct = new Date(value)\n if (!Number.isNaN(direct.getTime())) {\n return direct\n }\n\n // 2. Replace space separator → T (\"2024-04-15 14:00\" → \"2024-04-15T14:00\")\n if (/^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}/.test(value)) {\n const withT = new Date(value.replace(' ', 'T'))\n if (!Number.isNaN(withT.getTime())) {\n return withT\n }\n }\n\n // 3. Time-only (\"14:00\" or \"14:00:00\") → today at that hour\n const timeOnly = value.match(/^(\\d{1,2}):(\\d{2})(?::(\\d{2}))?$/)\n if (timeOnly) {\n const today = new Date()\n today.setHours(\n Number(timeOnly[1]),\n Number(timeOnly[2]),\n Number(timeOnly[3] ?? 0),\n 0,\n )\n return today\n }\n\n // 4. Date-only (\"2024-04-15\") → noon to avoid timezone edge\n if (/^\\d{4}-\\d{2}-\\d{2}$/.test(value)) {\n const noon = new Date(value + 'T12:00:00')\n if (!Number.isNaN(noon.getTime())) {\n return noon\n }\n }\n\n // Last resort: return an obviously invalid sentinel so callers can handle it\n return new Date(NaN)\n }\n\n /** Iconify `wi:` icon per canonical WMO category. */\n const WMO_ICON: Record<WmoCategory, string> = {\n clear: 'wi:day-sunny',\n mainlyClear: 'wi:day-sunny-overcast',\n partlyCloudy: 'wi:day-cloudy',\n overcast: 'wi:cloudy',\n fog: 'wi:fog',\n drizzle: 'wi:sprinkle',\n freezingDrizzle: 'wi:sleet',\n rain: 'wi:rain',\n freezingRain: 'wi:rain-mix',\n snow: 'wi:snow',\n rainShowers: 'wi:showers',\n snowShowers: 'wi:snow-wind',\n thunderstorm: 'wi:thunderstorm',\n thunderstormHail: 'wi:storm-showers',\n unknown: 'wi:na',\n }\n\n /** Maps WMO weather code to an Iconify wi: icon name */\n function wmoToIcon(code: number): string {\n return WMO_ICON[wmoCategory(code)]\n }\n\n /**\n * Returns a formatted day label for daily forecast.\n * When daily has 1-2 entries, use the date string directly.\n * Otherwise, use index-based computation from today.\n */\n function formatDay(isoDate: string, index: number, total: number): string {\n const parsed = safeDate(isoDate + 'T12:00:00')\n if (!Number.isNaN(parsed.getTime())) {\n const today = new Date()\n today.setHours(12, 0, 0, 0)\n const diffDays = Math.round(\n (parsed.getTime() - today.getTime()) / 86_400_000,\n )\n if (diffDays === 0) {\n return $t('weather.today')\n }\n return $d(parsed, 'weekday-day')\n }\n if (index === 0 && total <= 7) {\n return $t('weather.today')\n }\n const fallback = new Date()\n fallback.setDate(fallback.getDate() + index)\n return $d(fallback, 'weekday-day')\n }\n\n const headerDate = computed(() => {\n if (selectedDay.value) {\n const parsed = safeDate(selectedDay.value.date + 'T12:00:00')\n if (!Number.isNaN(parsed.getTime())) {\n return formatDay(\n selectedDay.value.date,\n selectedDayIndex.value,\n data.value?.daily?.length ?? 1,\n )\n }\n }\n return formatDay(new Date().toISOString().slice(0, 10), 0, 1)\n })\n\n /** i18n label key + CSS class per canonical AQI band. */\n const AQI_PRESENTATION: Record<\n AqiBandKey,\n { labelKey: string; class: string }\n > = {\n good: {\n labelKey: 'weather.aqiGood',\n class: 'text-green-600 bg-green-50',\n },\n fair: {\n labelKey: 'weather.aqiFair',\n class: 'text-lime-600 bg-lime-50',\n },\n moderate: {\n labelKey: 'weather.aqiModerate',\n class: 'text-yellow-600 bg-yellow-50',\n },\n poor: {\n labelKey: 'weather.aqiPoor',\n class: 'text-orange-600 bg-orange-50',\n },\n veryPoor: {\n labelKey: 'weather.aqiVeryPoor',\n class: 'text-red-600 bg-red-50',\n },\n hazardous: {\n labelKey: 'weather.aqiHazardous',\n class: 'text-purple-700 bg-purple-50',\n },\n }\n\n /** Returns AQI label and CSS class for European AQI */\n function aqiInfo(aqi: number): { label: string; class: string } {\n const { labelKey, class: cssClass } = AQI_PRESENTATION[aqiBand(aqi).key]\n return { label: $t(labelKey), class: cssClass }\n }\n\n /** Formats wind direction degrees to compass label */\n function windDirectionLabel(deg: number): string {\n const dirs = ['N', 'NE', 'E', 'SE', 'S', 'SO', 'O', 'NO']\n return dirs[Math.round(deg / 45) % 8]\n }\n</script>\n\n<template>\n <div\n v-if=\"isUnavailable\"\n class=\"text-12 text-danger flex items-center gap-6 py-8\">\n <VvIcon name=\"ri:error-warning-line\" class=\"w-16 h-16 shrink-0\" />\n <span>{{ $t('weather.unavailable') }}</span>\n </div>\n <div\n v-else-if=\"data\"\n class=\"border border-surface-3 rounded-xl w-full overflow-hidden bg-surface\">\n <!-- Header -->\n <div\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8 min-h-40\">\n <VvIcon name=\"ri:temp-cold-line\" class=\"text-16\" />\n <strong class=\"font-bold truncate\">\n {{ data.locationName }}\n </strong>\n <span class=\"ml-auto shrink-0 capitalize\">\n {{ headerDate }}\n </span>\n </div>\n\n <!-- Current conditions (only when real-time current is available AND first day is selected) -->\n <div\n v-if=\"data.current && selectedDayIndex === 0\"\n class=\"px-sm py-md flex items-center gap-md flex-wrap\">\n <div class=\"flex items-center gap-8\">\n <VvIcon\n :name=\"wmoToIcon(data.current.weatherCode)\"\n class=\"text-48 text-word-2 shrink-0\" />\n <span class=\"text-48 font-light leading-none text-word-1\">\n {{ $n(data.current.temperature, 'integer') }}°\n </span>\n </div>\n <div class=\"flex flex-col gap-4 text-12 text-word-3\">\n <div class=\"flex items-center gap-6\">\n {{ $t('weather.feelsLike') }}\n {{ $n(data.current.feelsLike, 'integer') }}°\n </div>\n <div class=\"flex items-center gap-6\">\n <VvIcon name=\"ri:water-percent-line\" class=\"text-14\" />\n {{ data.current.humidity }}%\n </div>\n <div class=\"flex items-center gap-6\">\n <VvIcon name=\"ri:windy-line\" class=\"text-14\" />\n {{ $n(data.current.windSpeed, 'integer') }} km/h\n {{ windDirectionLabel(data.current.windDirection) }}\n </div>\n <div\n v-if=\"data.current.uvIndex > 0\"\n class=\"flex items-center gap-6\">\n <VvIcon name=\"ri:sun-line\" class=\"text-14\" />\n UV {{ $n(data.current.uvIndex, 'integer') }}\n </div>\n </div>\n </div>\n\n <!-- Day summary (when no real-time current, or a non-today day is selected) -->\n <div\n v-else-if=\"selectedDay\"\n class=\"px-sm py-md flex items-center gap-md flex-wrap\">\n <div class=\"flex items-center gap-8\">\n <VvIcon\n :name=\"wmoToIcon(selectedDay.weatherCode)\"\n class=\"text-48 text-word-2 shrink-0\" />\n <div class=\"flex flex-col leading-none\">\n <span class=\"text-48 font-light text-word-1\">\n {{ $n(selectedDay.maxTemp, 'integer') }}°\n </span>\n <span class=\"text-20 text-word-3\">\n {{ $n(selectedDay.minTemp, 'integer') }}°\n </span>\n </div>\n </div>\n <div class=\"flex flex-col gap-4 text-12 text-word-3\">\n <div\n v-if=\"selectedDay.precipitationProbabilityMax > 0\"\n class=\"flex items-center gap-6\">\n <VvIcon name=\"ri:drop-line\" class=\"text-14\" />\n {{ selectedDay.precipitationProbabilityMax }}% ({{\n selectedDay.precipitationSum\n }}\n mm)\n </div>\n <div\n v-if=\"selectedDay.uvIndexMax > 0\"\n class=\"flex items-center gap-6\">\n <VvIcon name=\"ri:sun-line\" class=\"text-14\" />\n UV {{ $n(selectedDay.uvIndexMax, 'integer') }}\n </div>\n <div class=\"flex items-center gap-6\">\n <VvIcon name=\"ri:sun-foggy-line\" class=\"text-14\" />\n {{ $d(safeDate(selectedDay.sunrise), 'time') }}\n –\n {{ $d(safeDate(selectedDay.sunset), 'time') }}\n </div>\n </div>\n </div>\n\n <!-- Hourly forecast (filtered to selected day) -->\n <transition>\n <div\n v-if=\"filteredHourly.length > 0\"\n class=\"border-t border-surface-3\">\n <div\n class=\"flex overflow-x-auto gap-2 px-sm py-8 light-scrollbar\">\n <div\n v-for=\"hour in filteredHourly\"\n :key=\"hour.time\"\n class=\"flex flex-col items-center gap-4 min-w-48 px-4 py-6 rounded-xl text-11 text-word-3 shrink-0\">\n <span class=\"text-word-3\">{{\n Number.isNaN(safeDate(hour.time).getTime())\n ? hour.time\n : $d(safeDate(hour.time), 'time')\n }}</span>\n <VvIcon\n :name=\"wmoToIcon(hour.weatherCode)\"\n class=\"text-20 text-word-2\" />\n <span class=\"font-medium text-word-1\">\n {{ $n(hour.temperature, 'integer') }}°\n </span>\n <span\n v-if=\"hour.precipitationProbability > 0\"\n class=\"text-word-5 text-smaller\">\n {{ hour.precipitationProbability }}%\n </span>\n </div>\n </div>\n </div>\n </transition>\n\n <!-- Daily forecast (clickable, inside accordion) -->\n <transition>\n <VvAccordion\n v-if=\"data.daily?.length > 1\"\n v-model=\"dailyOpen\"\n modifiers=\"details no-padding\"\n :title=\"$t('weather.dailyForecast')\"\n class=\"border-t border-surface-3\">\n <button\n v-for=\"(day, index) in data.daily\"\n :key=\"day.date\"\n type=\"button\"\n class=\"flex items-center gap-sm px-sm py-8 text-12 w-full text-left transition-colors cursor-pointer border-t border-surface-3\"\n :class=\"\n index === selectedDayIndex\n ? 'bg-surface-2'\n : 'hover:bg-surface-1'\n \"\n @click=\"selectedDayIndex = index\">\n <span class=\"w-48 shrink-0 text-word-3 capitalize\">\n {{ formatDay(day.date, index, data.daily.length) }}\n </span>\n <VvIcon\n :name=\"wmoToIcon(day.weatherCode)\"\n class=\"text-18 text-word-2 shrink-0\" />\n <span\n v-if=\"day.precipitationProbabilityMax > 0\"\n class=\"text-word-5 text-11 w-32 shrink-0\">\n {{ day.precipitationProbabilityMax }}%\n </span>\n <span v-else class=\"w-32 shrink-0\" />\n <div class=\"ml-auto flex items-center gap-8 text-word-3\">\n <span class=\"text-word-1 font-semibold\">\n {{ $n(day.maxTemp, 'integer') }}°\n </span>\n <span>{{ $n(day.minTemp, 'integer') }}°</span>\n </div>\n </button>\n </VvAccordion>\n </transition>\n\n <!-- Air quality -->\n <div\n v-if=\"data.airQuality\"\n class=\"border-t border-surface-3 px-sm py-8 flex items-center gap-8 text-12\">\n <VvIcon name=\"ri:windy-line\" class=\"text-14 text-word-3\" />\n <span class=\"text-word-3\">{{ $t('weather.airQuality') }}</span>\n <span\n :class=\"[\n 'ml-auto px-8 py-2 text-11 font-semibold',\n aqiInfo(data.airQuality.aqi).class,\n ]\">\n {{ aqiInfo(data.airQuality.aqi).label }}\n ({{ data.airQuality.aqi }})\n </span>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed, ref, watch } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { hasWeatherForecast } from 'models'\n import {\n aqiBand,\n wmoCategory,\n type AqiBandKey,\n type WmoCategory,\n } from 'utils'\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const { t: $t, d: $d, n: $n } = useI18n({ useScope: 'global' })\n\n const toolPart = computed(() => {\n return props.part as {\n state?: string\n input?: unknown\n output?: unknown\n }\n })\n\n const data = computed(() => {\n const { output, input } = toolPart.value\n if (hasWeatherForecast(output)) {\n return output\n }\n // Conversations from before `weatherKey` passed the whole forecast\n return hasWeatherForecast(input) ? input : null\n })\n\n /**\n * The call is over and left nothing to draw: a mangled or expired key\n * fails the tool, and its input is only the key. Without this the card\n * drew a thermometer and \"Oggi\" around nothing. While the call runs there\n * is nothing to draw yet, and nothing has failed either: the card waits.\n */\n const isUnavailable = computed(\n () =>\n !data.value &&\n toolPart.value.state !== 'input-streaming' &&\n toolPart.value.state !== 'input-available',\n )\n\n const selectedDayIndex = ref(0)\n\n const dailyOpen = ref(!data.value?.current)\n\n watch(selectedDayIndex, (index) => {\n if (index > 0) {\n dailyOpen.value = true\n }\n })\n\n const selectedDay = computed(\n () => data.value?.daily?.[selectedDayIndex.value],\n )\n\n /** Hourly entries filtered to the selected day's date */\n const filteredHourly = computed(() => {\n if (!data.value?.hourly?.length || !selectedDay.value) {\n return data.value?.hourly ?? []\n }\n const dayDate = selectedDay.value.date\n return data.value.hourly.filter((h) => h.time.startsWith(dayDate))\n })\n\n /**\n * Parses a date/time string in various formats the LLM might produce.\n * Tries ISO, space-separated, time-only, and common human-readable formats.\n */\n function safeDate(value: string): Date {\n // 1. Try native parsing (works for ISO 8601 and many standard formats)\n const direct = new Date(value)\n if (!Number.isNaN(direct.getTime())) {\n return direct\n }\n\n // 2. Replace space separator → T (\"2024-04-15 14:00\" → \"2024-04-15T14:00\")\n if (/^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}/.test(value)) {\n const withT = new Date(value.replace(' ', 'T'))\n if (!Number.isNaN(withT.getTime())) {\n return withT\n }\n }\n\n // 3. Time-only (\"14:00\" or \"14:00:00\") → today at that hour\n const timeOnly = value.match(/^(\\d{1,2}):(\\d{2})(?::(\\d{2}))?$/)\n if (timeOnly) {\n const today = new Date()\n today.setHours(\n Number(timeOnly[1]),\n Number(timeOnly[2]),\n Number(timeOnly[3] ?? 0),\n 0,\n )\n return today\n }\n\n // 4. Date-only (\"2024-04-15\") → noon to avoid timezone edge\n if (/^\\d{4}-\\d{2}-\\d{2}$/.test(value)) {\n const noon = new Date(value + 'T12:00:00')\n if (!Number.isNaN(noon.getTime())) {\n return noon\n }\n }\n\n // Last resort: return an obviously invalid sentinel so callers can handle it\n return new Date(NaN)\n }\n\n /** Iconify `wi:` icon per canonical WMO category. */\n const WMO_ICON: Record<WmoCategory, string> = {\n clear: 'wi:day-sunny',\n mainlyClear: 'wi:day-sunny-overcast',\n partlyCloudy: 'wi:day-cloudy',\n overcast: 'wi:cloudy',\n fog: 'wi:fog',\n drizzle: 'wi:sprinkle',\n freezingDrizzle: 'wi:sleet',\n rain: 'wi:rain',\n freezingRain: 'wi:rain-mix',\n snow: 'wi:snow',\n rainShowers: 'wi:showers',\n snowShowers: 'wi:snow-wind',\n thunderstorm: 'wi:thunderstorm',\n thunderstormHail: 'wi:storm-showers',\n unknown: 'wi:na',\n }\n\n /** Maps WMO weather code to an Iconify wi: icon name */\n function wmoToIcon(code: number): string {\n return WMO_ICON[wmoCategory(code)]\n }\n\n /**\n * Returns a formatted day label for daily forecast.\n * When daily has 1-2 entries, use the date string directly.\n * Otherwise, use index-based computation from today.\n */\n function formatDay(isoDate: string, index: number, total: number): string {\n const parsed = safeDate(isoDate + 'T12:00:00')\n if (!Number.isNaN(parsed.getTime())) {\n const today = new Date()\n today.setHours(12, 0, 0, 0)\n const diffDays = Math.round(\n (parsed.getTime() - today.getTime()) / 86_400_000,\n )\n if (diffDays === 0) {\n return $t('weather.today')\n }\n return $d(parsed, 'weekday-day')\n }\n if (index === 0 && total <= 7) {\n return $t('weather.today')\n }\n const fallback = new Date()\n fallback.setDate(fallback.getDate() + index)\n return $d(fallback, 'weekday-day')\n }\n\n const headerDate = computed(() => {\n if (selectedDay.value) {\n const parsed = safeDate(selectedDay.value.date + 'T12:00:00')\n if (!Number.isNaN(parsed.getTime())) {\n return formatDay(\n selectedDay.value.date,\n selectedDayIndex.value,\n data.value?.daily?.length ?? 1,\n )\n }\n }\n return formatDay(new Date().toISOString().slice(0, 10), 0, 1)\n })\n\n /** i18n label key + CSS class per canonical AQI band. */\n const AQI_PRESENTATION: Record<\n AqiBandKey,\n { labelKey: string; class: string }\n > = {\n good: {\n labelKey: 'weather.aqiGood',\n class: 'text-green-600 bg-green-50',\n },\n fair: {\n labelKey: 'weather.aqiFair',\n class: 'text-lime-600 bg-lime-50',\n },\n moderate: {\n labelKey: 'weather.aqiModerate',\n class: 'text-yellow-600 bg-yellow-50',\n },\n poor: {\n labelKey: 'weather.aqiPoor',\n class: 'text-orange-600 bg-orange-50',\n },\n veryPoor: {\n labelKey: 'weather.aqiVeryPoor',\n class: 'text-red-600 bg-red-50',\n },\n hazardous: {\n labelKey: 'weather.aqiHazardous',\n class: 'text-purple-700 bg-purple-50',\n },\n }\n\n /** Returns AQI label and CSS class for European AQI */\n function aqiInfo(aqi: number): { label: string; class: string } {\n const { labelKey, class: cssClass } = AQI_PRESENTATION[aqiBand(aqi).key]\n return { label: $t(labelKey), class: cssClass }\n }\n\n /** Formats wind direction degrees to compass label */\n function windDirectionLabel(deg: number): string {\n const dirs = ['N', 'NE', 'E', 'SE', 'S', 'SO', 'O', 'NO']\n return dirs[Math.round(deg / 45) % 8]\n }\n</script>\n\n<template>\n <div\n v-if=\"isUnavailable\"\n class=\"text-12 text-danger flex items-center gap-6 py-8\">\n <VvIcon name=\"ri:error-warning-line\" class=\"w-16 h-16 shrink-0\" />\n <span>{{ $t('weather.unavailable') }}</span>\n </div>\n <div\n v-else-if=\"data\"\n class=\"border border-surface-3 rounded-xl w-full overflow-hidden bg-surface\">\n <!-- Header -->\n <div\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8 min-h-40\">\n <VvIcon name=\"ri:temp-cold-line\" class=\"text-16\" />\n <strong class=\"font-bold truncate\">\n {{ data.locationName }}\n </strong>\n <span class=\"ml-auto shrink-0 capitalize\">\n {{ headerDate }}\n </span>\n </div>\n\n <!-- Current conditions (only when real-time current is available AND first day is selected) -->\n <div\n v-if=\"data.current && selectedDayIndex === 0\"\n class=\"px-sm py-md flex items-center gap-md flex-wrap\">\n <div class=\"flex items-center gap-8\">\n <VvIcon\n :name=\"wmoToIcon(data.current.weatherCode)\"\n class=\"text-48 text-word-2 shrink-0\" />\n <span class=\"text-48 font-light leading-none text-word-1\">\n {{ $n(data.current.temperature, 'integer') }}°\n </span>\n </div>\n <div class=\"flex flex-col gap-4 text-12 text-word-3\">\n <div class=\"flex items-center gap-6\">\n {{ $t('weather.feelsLike') }}\n {{ $n(data.current.feelsLike, 'integer') }}°\n </div>\n <div class=\"flex items-center gap-6\">\n <VvIcon name=\"ri:water-percent-line\" class=\"text-14\" />\n {{ data.current.humidity }}%\n </div>\n <div class=\"flex items-center gap-6\">\n <VvIcon name=\"ri:windy-line\" class=\"text-14\" />\n {{ $n(data.current.windSpeed, 'integer') }} km/h\n {{ windDirectionLabel(data.current.windDirection) }}\n </div>\n <div\n v-if=\"data.current.uvIndex > 0\"\n class=\"flex items-center gap-6\">\n <VvIcon name=\"ri:sun-line\" class=\"text-14\" />\n UV {{ $n(data.current.uvIndex, 'integer') }}\n </div>\n </div>\n </div>\n\n <!-- Day summary (when no real-time current, or a non-today day is selected) -->\n <div\n v-else-if=\"selectedDay\"\n class=\"px-sm py-md flex items-center gap-md flex-wrap\">\n <div class=\"flex items-center gap-8\">\n <VvIcon\n :name=\"wmoToIcon(selectedDay.weatherCode)\"\n class=\"text-48 text-word-2 shrink-0\" />\n <div class=\"flex flex-col leading-none\">\n <span class=\"text-48 font-light text-word-1\">\n {{ $n(selectedDay.maxTemp, 'integer') }}°\n </span>\n <span class=\"text-20 text-word-3\">\n {{ $n(selectedDay.minTemp, 'integer') }}°\n </span>\n </div>\n </div>\n <div class=\"flex flex-col gap-4 text-12 text-word-3\">\n <div\n v-if=\"selectedDay.precipitationProbabilityMax > 0\"\n class=\"flex items-center gap-6\">\n <VvIcon name=\"ri:drop-line\" class=\"text-14\" />\n {{ selectedDay.precipitationProbabilityMax }}% ({{\n selectedDay.precipitationSum\n }}\n mm)\n </div>\n <div\n v-if=\"selectedDay.uvIndexMax > 0\"\n class=\"flex items-center gap-6\">\n <VvIcon name=\"ri:sun-line\" class=\"text-14\" />\n UV {{ $n(selectedDay.uvIndexMax, 'integer') }}\n </div>\n <div class=\"flex items-center gap-6\">\n <VvIcon name=\"ri:sun-foggy-line\" class=\"text-14\" />\n {{ $d(safeDate(selectedDay.sunrise), 'time') }}\n –\n {{ $d(safeDate(selectedDay.sunset), 'time') }}\n </div>\n </div>\n </div>\n\n <!-- Hourly forecast (filtered to selected day) -->\n <transition>\n <div\n v-if=\"filteredHourly.length > 0\"\n class=\"border-t border-surface-3\">\n <div\n class=\"flex overflow-x-auto gap-2 px-sm py-8 light-scrollbar\">\n <div\n v-for=\"hour in filteredHourly\"\n :key=\"hour.time\"\n class=\"flex flex-col items-center gap-4 min-w-48 px-4 py-6 rounded-xl text-11 text-word-3 shrink-0\">\n <span class=\"text-word-3\">{{\n Number.isNaN(safeDate(hour.time).getTime())\n ? hour.time\n : $d(safeDate(hour.time), 'time')\n }}</span>\n <VvIcon\n :name=\"wmoToIcon(hour.weatherCode)\"\n class=\"text-20 text-word-2\" />\n <span class=\"font-medium text-word-1\">\n {{ $n(hour.temperature, 'integer') }}°\n </span>\n <span\n v-if=\"hour.precipitationProbability > 0\"\n class=\"text-word-5 text-smaller\">\n {{ hour.precipitationProbability }}%\n </span>\n </div>\n </div>\n </div>\n </transition>\n\n <!-- Daily forecast (clickable, inside accordion) -->\n <transition>\n <VvAccordion\n v-if=\"data.daily?.length > 1\"\n v-model=\"dailyOpen\"\n modifiers=\"details no-padding\"\n :title=\"$t('weather.dailyForecast')\"\n class=\"border-t border-surface-3\">\n <button\n v-for=\"(day, index) in data.daily\"\n :key=\"day.date\"\n type=\"button\"\n class=\"flex items-center gap-sm px-sm py-8 text-12 w-full text-left transition-colors cursor-pointer border-t border-surface-3\"\n :class=\"\n index === selectedDayIndex\n ? 'bg-surface-2'\n : 'hover:bg-surface-1'\n \"\n @click=\"selectedDayIndex = index\">\n <span class=\"w-48 shrink-0 text-word-3 capitalize\">\n {{ formatDay(day.date, index, data.daily.length) }}\n </span>\n <VvIcon\n :name=\"wmoToIcon(day.weatherCode)\"\n class=\"text-18 text-word-2 shrink-0\" />\n <span\n v-if=\"day.precipitationProbabilityMax > 0\"\n class=\"text-word-5 text-11 w-32 shrink-0\">\n {{ day.precipitationProbabilityMax }}%\n </span>\n <span v-else class=\"w-32 shrink-0\" />\n <div class=\"ml-auto flex items-center gap-8 text-word-3\">\n <span class=\"text-word-1 font-semibold\">\n {{ $n(day.maxTemp, 'integer') }}°\n </span>\n <span>{{ $n(day.minTemp, 'integer') }}°</span>\n </div>\n </button>\n </VvAccordion>\n </transition>\n\n <!-- Air quality -->\n <div\n v-if=\"data.airQuality\"\n class=\"border-t border-surface-3 px-sm py-8 flex items-center gap-8 text-12\">\n <VvIcon name=\"ri:windy-line\" class=\"text-14 text-word-3\" />\n <span class=\"text-word-3\">{{ $t('weather.airQuality') }}</span>\n <span\n :class=\"[\n 'ml-auto px-8 py-2 text-11 font-semibold',\n aqiInfo(data.airQuality.aqi).class,\n ]\">\n {{ aqiInfo(data.airQuality.aqi).label }}\n ({{ data.airQuality.aqi }})\n </span>\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;AAQA,IAAMkD,IAAuBlD,EAAS;CAClC,aAAaC,EAAS,CAAC,CAAC,SAAS,mBAAmB;CACpD,WAAWA,EAAS,CAAC,CAAC,SAAS,4BAA4B;CAC3D,UAAUA,EAAS,CAAC,CAAC,SAAS,wBAAwB;CACtD,eAAeA,EAAS,CAAC,CAAC,SAAS,qBAAqB;CACxD,aAAaA,EAAS,CAAC,CAAC,SAAS,iCAAiC;CAClE,WAAWA,EAAS,CAAC,CAAC,SAAS,oBAAoB;CACnD,eAAeA,EAAS,CAAC,CAAC,SAAS,2BAA2B;CAC9D,SAASA,EAAS,CAAC,CAAC,SAAS,UAAU;AAC3C,CAAC,GAEKkD,IAAsBnD,EAAS;CACjC,MAAME,EAAS;CACf,aAAaD,EAAS;CACtB,0BAA0BA,EAAS;CACnC,eAAeA,EAAS;CACxB,aAAaA,EAAS;CACtB,WAAWA,EAAS;AACxB,CAAC,GAEKmD,IAAqBpD,EAAS;CAChC,MAAME,EAAS;CACf,SAASD,EAAS;CAClB,SAASA,EAAS;CAClB,aAAaA,EAAS;CACtB,kBAAkBA,EAAS;CAC3B,6BAA6BA,EAAS;CACtC,YAAYA,EAAS;CACrB,SAASC,EAAS;CAClB,QAAQA,EAAS;AACrB,CAAC,GAEKmD,IAAmBrD,EAAS;CAC9B,KAAKC,EAAS,CAAC,CAAC,SAAS,oBAAoB;CAC7C,MAAMA,EAAS,CAAC,CAAC,SAAS,eAAe;CACzC,MAAMA,EAAS,CAAC,CAAC,SAAS,gBAAgB;CAC1C,KAAKA,EAAS,CAAC,CAAC,SAAS,cAAc;CACvC,OAAOA,EAAS,CAAC,CAAC,SAAS,gBAAgB;AAC/C,CAAC;AAEgCD,EAAS;CACtC,cAAcE,EAAS;CACvB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
+
{"version":3,"file":"PkToolShowWeather-7_f5k1pX.js","names":["z.object","z.number","z.string","z.array","__unplugin_components_0","__unplugin_components_1","_openBlock","_createElementBlock","_createVNode","_createElementVNode","_toDisplayString","_unref","_createTextVNode","_createCommentVNode","_Transition","_withCtx","_Fragment","_renderList","_createBlock","_normalizeClass","_sfc_main","object","string","number","array","normalizeClass","watch","createVNode","init_shared_esm_bundler","renderList","createBlock","Fragment","createBaseVNode","ref","computed","init_runtime_core_esm_bundler","toDisplayString","init_reactivity_esm_bundler","init_runtime_dom_esm_bundler","Transition","withCtx","createCommentVNode","defineComponent","unref","createTextVNode","createElementBlock","openBlock","useI18n","Lr","Ce","WeatherCurrentSchema","WeatherHourlySchema","WeatherDailySchema","AirQualitySchema","hasWeatherForecast","value","current","hourly","daily","wmoCategory","code","aqiBand","aqi","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","_hoisted_17","_hoisted_18","_hoisted_19","_hoisted_20","_hoisted_21","_hoisted_22","_hoisted_23","_hoisted_24","_hoisted_25","_hoisted_26","_hoisted_27","_hoisted_28","_hoisted_29","_hoisted_30","_hoisted_31","_hoisted_32","_hoisted_33","_hoisted_34","_hoisted_35","PkToolShowWeather_default","props","__props","$t","$d","$n","toolPart","data","output","input","isUnavailable","selectedDayIndex","dailyOpen","index","selectedDay","filteredHourly","dayDate","h","safeDate","direct","withT","timeOnly","today","noon","WMO_ICON","wmoToIcon","formatDay","parsed","isoDate","total","fallback","headerDate","AQI_PRESENTATION","aqiInfo","cssClass","labelKey","windDirectionLabel","deg","_component_VvIcon","_component_VvAccordion","hour","_cache","$event","day"],"sources":["../../../../packages/models/src/schema/Weather.ts","../../../../packages/utils/src/weather.ts","../../../../packages/components/src/chat/PkToolShowWeather.vue","../../../../packages/components/src/chat/PkToolShowWeather.vue"],"sourcesContent":["import { z } from 'zod'\n\n/**\n * The weather data contract shared by the `getWeather`/`showWeather` backend\n * tools, the web widget (`PkToolShowWeather.vue`), and the platform card\n * renderer. Single source of truth — do not redeclare these shapes elsewhere.\n */\n\nconst WeatherCurrentSchema = z.object({\n temperature: z.number().describe('Temperature in °C'),\n feelsLike: z.number().describe('Apparent temperature in °C'),\n humidity: z.number().describe('Relative humidity in %'),\n precipitation: z.number().describe('Precipitation in mm'),\n weatherCode: z.number().describe('WMO weather interpretation code'),\n windSpeed: z.number().describe('Wind speed in km/h'),\n windDirection: z.number().describe('Wind direction in degrees'),\n uvIndex: z.number().describe('UV index'),\n})\n\nconst WeatherHourlySchema = z.object({\n time: z.string(),\n temperature: z.number(),\n precipitationProbability: z.number(),\n precipitation: z.number(),\n weatherCode: z.number(),\n windSpeed: z.number(),\n})\n\nconst WeatherDailySchema = z.object({\n date: z.string(),\n maxTemp: z.number(),\n minTemp: z.number(),\n weatherCode: z.number(),\n precipitationSum: z.number(),\n precipitationProbabilityMax: z.number(),\n uvIndexMax: z.number(),\n sunrise: z.string(),\n sunset: z.string(),\n})\n\nconst AirQualitySchema = z.object({\n aqi: z.number().describe('European AQI index'),\n pm10: z.number().describe('PM10 in µg/m³'),\n pm25: z.number().describe('PM2.5 in µg/m³'),\n no2: z.number().describe('NO₂ in µg/m³'),\n ozone: z.number().describe('Ozone in µg/m³'),\n})\n\nexport const WeatherDataSchema = z.object({\n locationName: z.string(),\n latitude: z.number(),\n longitude: z.number(),\n timezone: z.string(),\n current: WeatherCurrentSchema.nullable().describe(\n 'Current conditions — null when viewing a future date range',\n ),\n hourly: z\n .array(WeatherHourlySchema)\n .describe('Hourly forecast for the requested range'),\n daily: z\n .array(WeatherDailySchema)\n .describe('Daily forecast for the requested range'),\n airQuality: AirQualitySchema.nullable(),\n})\n\nexport type WeatherData = z.infer<typeof WeatherDataSchema>\n\n/**\n * Whether a value carries something the weather card can draw: current\n * conditions, or at least one hourly or daily entry. `showWeather` takes only\n * a `weatherKey`, so its input is a forecast only in conversations from before\n * the key, and a call that failed (a mangled key, expired data) has no output.\n */\nexport function hasWeatherForecast(value: unknown): value is WeatherData {\n if (!value || typeof value !== 'object') {\n return false\n }\n const { current, hourly, daily } = value as Partial<WeatherData>\n return (\n typeof current?.temperature === 'number' ||\n (Array.isArray(hourly) && hourly.length > 0) ||\n (Array.isArray(daily) && daily.length > 0)\n )\n}\n","/**\n * Framework-agnostic weather presentation primitives. They classify raw\n * open-meteo values into canonical categories; each consumer (web widget,\n * platform card renderer) maps a category to its own representation (an\n * Iconify name, an emoji, a CSS class, an i18n key). Keeping the classification\n * here means the WMO code bands and AQI thresholds live in exactly one place.\n */\n\n/** Canonical WMO weather-code category (resolution matches the web widget). */\nexport type WmoCategory =\n | 'clear'\n | 'mainlyClear'\n | 'partlyCloudy'\n | 'overcast'\n | 'fog'\n | 'drizzle'\n | 'freezingDrizzle'\n | 'rain'\n | 'freezingRain'\n | 'snow'\n | 'rainShowers'\n | 'snowShowers'\n | 'thunderstorm'\n | 'thunderstormHail'\n | 'unknown'\n\n/** Map a WMO weather interpretation code to a canonical category. */\nexport function wmoCategory(code: number | undefined): WmoCategory {\n if (code === undefined) {\n return 'unknown'\n }\n if (code === 0) {\n return 'clear'\n }\n if (code === 1) {\n return 'mainlyClear'\n }\n if (code === 2) {\n return 'partlyCloudy'\n }\n if (code === 3) {\n return 'overcast'\n }\n if (code === 45 || code === 48) {\n return 'fog'\n }\n if (code >= 51 && code <= 55) {\n return 'drizzle'\n }\n if (code === 56 || code === 57) {\n return 'freezingDrizzle'\n }\n if (code >= 61 && code <= 65) {\n return 'rain'\n }\n if (code === 66 || code === 67) {\n return 'freezingRain'\n }\n if (code >= 71 && code <= 77) {\n return 'snow'\n }\n if (code >= 80 && code <= 82) {\n return 'rainShowers'\n }\n if (code === 85 || code === 86) {\n return 'snowShowers'\n }\n if (code === 95) {\n return 'thunderstorm'\n }\n if (code === 96 || code === 99) {\n return 'thunderstormHail'\n }\n return 'unknown'\n}\n\n/** Emoji per category (used by the language-neutral platform card renderer). */\nconst WMO_EMOJI: Record<WmoCategory, string> = {\n clear: '☀️',\n mainlyClear: '⛅',\n partlyCloudy: '⛅',\n overcast: '⛅',\n fog: '🌫️',\n drizzle: '🌦️',\n freezingDrizzle: '🌦️',\n rain: '🌧️',\n freezingRain: '🌧️',\n snow: '❄️',\n rainShowers: '🌧️',\n snowShowers: '🌨️',\n thunderstorm: '⛈️',\n thunderstormHail: '⛈️',\n unknown: '🌡️',\n}\n\n/** WMO code → emoji (convenience for non-UI consumers). */\nexport function wmoEmoji(code: number | undefined): string {\n return WMO_EMOJI[wmoCategory(code)]\n}\n\n/** Canonical European-AQI band, ordered best → worst. */\nexport type AqiBandKey =\n 'good' | 'fair' | 'moderate' | 'poor' | 'veryPoor' | 'hazardous'\n\n/** Classify a European AQI value into a band (index + canonical key). */\nexport function aqiBand(aqi: number): { index: number; key: AqiBandKey } {\n if (aqi <= 20) {\n return { index: 0, key: 'good' }\n }\n if (aqi <= 40) {\n return { index: 1, key: 'fair' }\n }\n if (aqi <= 60) {\n return { index: 2, key: 'moderate' }\n }\n if (aqi <= 80) {\n return { index: 3, key: 'poor' }\n }\n if (aqi <= 100) {\n return { index: 4, key: 'veryPoor' }\n }\n return { index: 5, key: 'hazardous' }\n}\n\n/** Colored dot per AQI band index (used by the platform card renderer). */\nconst AQI_DOTS = ['🟢', '🟡', '🟠', '🔴', '🟣', '⚫']\n\n/** AQI value → colored dot (convenience for non-UI consumers). */\nexport function aqiDot(aqi: number): string {\n return AQI_DOTS[aqiBand(aqi).index]\n}\n","<script setup lang=\"ts\">\n import { computed, ref, watch } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { hasWeatherForecast } from 'models'\n import {\n aqiBand,\n wmoCategory,\n type AqiBandKey,\n type WmoCategory,\n } from 'utils'\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const { t: $t, d: $d, n: $n } = useI18n({ useScope: 'global' })\n\n const toolPart = computed(() => {\n return props.part as {\n state?: string\n input?: unknown\n output?: unknown\n }\n })\n\n const data = computed(() => {\n const { output, input } = toolPart.value\n if (hasWeatherForecast(output)) {\n return output\n }\n // Conversations from before `weatherKey` passed the whole forecast\n return hasWeatherForecast(input) ? input : null\n })\n\n /**\n * The call is over and left nothing to draw: a mangled or expired key\n * fails the tool, and its input is only the key. Without this the card\n * drew a thermometer and \"Oggi\" around nothing. While the call runs there\n * is nothing to draw yet, and nothing has failed either: the card waits.\n */\n const isUnavailable = computed(\n () =>\n !data.value &&\n toolPart.value.state !== 'input-streaming' &&\n toolPart.value.state !== 'input-available',\n )\n\n const selectedDayIndex = ref(0)\n\n const dailyOpen = ref(!data.value?.current)\n\n watch(selectedDayIndex, (index) => {\n if (index > 0) {\n dailyOpen.value = true\n }\n })\n\n const selectedDay = computed(\n () => data.value?.daily?.[selectedDayIndex.value],\n )\n\n /** Hourly entries filtered to the selected day's date */\n const filteredHourly = computed(() => {\n if (!data.value?.hourly?.length || !selectedDay.value) {\n return data.value?.hourly ?? []\n }\n const dayDate = selectedDay.value.date\n return data.value.hourly.filter((h) => h.time.startsWith(dayDate))\n })\n\n /**\n * Parses a date/time string in various formats the LLM might produce.\n * Tries ISO, space-separated, time-only, and common human-readable formats.\n */\n function safeDate(value: string): Date {\n // 1. Try native parsing (works for ISO 8601 and many standard formats)\n const direct = new Date(value)\n if (!Number.isNaN(direct.getTime())) {\n return direct\n }\n\n // 2. Replace space separator → T (\"2024-04-15 14:00\" → \"2024-04-15T14:00\")\n if (/^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}/.test(value)) {\n const withT = new Date(value.replace(' ', 'T'))\n if (!Number.isNaN(withT.getTime())) {\n return withT\n }\n }\n\n // 3. Time-only (\"14:00\" or \"14:00:00\") → today at that hour\n const timeOnly = value.match(/^(\\d{1,2}):(\\d{2})(?::(\\d{2}))?$/)\n if (timeOnly) {\n const today = new Date()\n today.setHours(\n Number(timeOnly[1]),\n Number(timeOnly[2]),\n Number(timeOnly[3] ?? 0),\n 0,\n )\n return today\n }\n\n // 4. Date-only (\"2024-04-15\") → noon to avoid timezone edge\n if (/^\\d{4}-\\d{2}-\\d{2}$/.test(value)) {\n const noon = new Date(value + 'T12:00:00')\n if (!Number.isNaN(noon.getTime())) {\n return noon\n }\n }\n\n // Last resort: return an obviously invalid sentinel so callers can handle it\n return new Date(NaN)\n }\n\n /** Iconify `wi:` icon per canonical WMO category. */\n const WMO_ICON: Record<WmoCategory, string> = {\n clear: 'wi:day-sunny',\n mainlyClear: 'wi:day-sunny-overcast',\n partlyCloudy: 'wi:day-cloudy',\n overcast: 'wi:cloudy',\n fog: 'wi:fog',\n drizzle: 'wi:sprinkle',\n freezingDrizzle: 'wi:sleet',\n rain: 'wi:rain',\n freezingRain: 'wi:rain-mix',\n snow: 'wi:snow',\n rainShowers: 'wi:showers',\n snowShowers: 'wi:snow-wind',\n thunderstorm: 'wi:thunderstorm',\n thunderstormHail: 'wi:storm-showers',\n unknown: 'wi:na',\n }\n\n /** Maps WMO weather code to an Iconify wi: icon name */\n function wmoToIcon(code: number): string {\n return WMO_ICON[wmoCategory(code)]\n }\n\n /**\n * Returns a formatted day label for daily forecast.\n * When daily has 1-2 entries, use the date string directly.\n * Otherwise, use index-based computation from today.\n */\n function formatDay(isoDate: string, index: number, total: number): string {\n const parsed = safeDate(isoDate + 'T12:00:00')\n if (!Number.isNaN(parsed.getTime())) {\n const today = new Date()\n today.setHours(12, 0, 0, 0)\n const diffDays = Math.round(\n (parsed.getTime() - today.getTime()) / 86_400_000,\n )\n if (diffDays === 0) {\n return $t('weather.today')\n }\n return $d(parsed, 'weekday-day')\n }\n if (index === 0 && total <= 7) {\n return $t('weather.today')\n }\n const fallback = new Date()\n fallback.setDate(fallback.getDate() + index)\n return $d(fallback, 'weekday-day')\n }\n\n const headerDate = computed(() => {\n if (selectedDay.value) {\n const parsed = safeDate(selectedDay.value.date + 'T12:00:00')\n if (!Number.isNaN(parsed.getTime())) {\n return formatDay(\n selectedDay.value.date,\n selectedDayIndex.value,\n data.value?.daily?.length ?? 1,\n )\n }\n }\n return formatDay(new Date().toISOString().slice(0, 10), 0, 1)\n })\n\n /** i18n label key + CSS class per canonical AQI band. */\n const AQI_PRESENTATION: Record<\n AqiBandKey,\n { labelKey: string; class: string }\n > = {\n good: {\n labelKey: 'weather.aqiGood',\n class: 'text-green-600 bg-green-50',\n },\n fair: {\n labelKey: 'weather.aqiFair',\n class: 'text-lime-600 bg-lime-50',\n },\n moderate: {\n labelKey: 'weather.aqiModerate',\n class: 'text-yellow-600 bg-yellow-50',\n },\n poor: {\n labelKey: 'weather.aqiPoor',\n class: 'text-orange-600 bg-orange-50',\n },\n veryPoor: {\n labelKey: 'weather.aqiVeryPoor',\n class: 'text-red-600 bg-red-50',\n },\n hazardous: {\n labelKey: 'weather.aqiHazardous',\n class: 'text-purple-700 bg-purple-50',\n },\n }\n\n /** Returns AQI label and CSS class for European AQI */\n function aqiInfo(aqi: number): { label: string; class: string } {\n const { labelKey, class: cssClass } = AQI_PRESENTATION[aqiBand(aqi).key]\n return { label: $t(labelKey), class: cssClass }\n }\n\n /** Formats wind direction degrees to compass label */\n function windDirectionLabel(deg: number): string {\n const dirs = ['N', 'NE', 'E', 'SE', 'S', 'SO', 'O', 'NO']\n return dirs[Math.round(deg / 45) % 8]\n }\n</script>\n\n<template>\n <div\n v-if=\"isUnavailable\"\n class=\"text-12 text-danger flex items-center gap-6 py-8\">\n <VvIcon name=\"ri:error-warning-line\" class=\"w-16 h-16 shrink-0\" />\n <span>{{ $t('weather.unavailable') }}</span>\n </div>\n <div\n v-else-if=\"data\"\n class=\"border border-surface-3 rounded-xl w-full overflow-hidden bg-surface\">\n <!-- Header -->\n <div\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8 min-h-40\">\n <VvIcon name=\"ri:temp-cold-line\" class=\"text-16\" />\n <strong class=\"font-bold truncate\">\n {{ data.locationName }}\n </strong>\n <span class=\"ml-auto shrink-0 capitalize\">\n {{ headerDate }}\n </span>\n </div>\n\n <!-- Current conditions (only when real-time current is available AND first day is selected) -->\n <div\n v-if=\"data.current && selectedDayIndex === 0\"\n class=\"px-sm py-md flex items-center gap-md flex-wrap\">\n <div class=\"flex items-center gap-8\">\n <VvIcon\n :name=\"wmoToIcon(data.current.weatherCode)\"\n class=\"text-48 text-word-2 shrink-0\" />\n <span class=\"text-48 font-light leading-none text-word-1\">\n {{ $n(data.current.temperature, 'integer') }}°\n </span>\n </div>\n <div class=\"flex flex-col gap-4 text-12 text-word-3\">\n <div class=\"flex items-center gap-6\">\n {{ $t('weather.feelsLike') }}\n {{ $n(data.current.feelsLike, 'integer') }}°\n </div>\n <div class=\"flex items-center gap-6\">\n <VvIcon name=\"ri:water-percent-line\" class=\"text-14\" />\n {{ data.current.humidity }}%\n </div>\n <div class=\"flex items-center gap-6\">\n <VvIcon name=\"ri:windy-line\" class=\"text-14\" />\n {{ $n(data.current.windSpeed, 'integer') }} km/h\n {{ windDirectionLabel(data.current.windDirection) }}\n </div>\n <div\n v-if=\"data.current.uvIndex > 0\"\n class=\"flex items-center gap-6\">\n <VvIcon name=\"ri:sun-line\" class=\"text-14\" />\n UV {{ $n(data.current.uvIndex, 'integer') }}\n </div>\n </div>\n </div>\n\n <!-- Day summary (when no real-time current, or a non-today day is selected) -->\n <div\n v-else-if=\"selectedDay\"\n class=\"px-sm py-md flex items-center gap-md flex-wrap\">\n <div class=\"flex items-center gap-8\">\n <VvIcon\n :name=\"wmoToIcon(selectedDay.weatherCode)\"\n class=\"text-48 text-word-2 shrink-0\" />\n <div class=\"flex flex-col leading-none\">\n <span class=\"text-48 font-light text-word-1\">\n {{ $n(selectedDay.maxTemp, 'integer') }}°\n </span>\n <span class=\"text-20 text-word-3\">\n {{ $n(selectedDay.minTemp, 'integer') }}°\n </span>\n </div>\n </div>\n <div class=\"flex flex-col gap-4 text-12 text-word-3\">\n <div\n v-if=\"selectedDay.precipitationProbabilityMax > 0\"\n class=\"flex items-center gap-6\">\n <VvIcon name=\"ri:drop-line\" class=\"text-14\" />\n {{ selectedDay.precipitationProbabilityMax }}% ({{\n selectedDay.precipitationSum\n }}\n mm)\n </div>\n <div\n v-if=\"selectedDay.uvIndexMax > 0\"\n class=\"flex items-center gap-6\">\n <VvIcon name=\"ri:sun-line\" class=\"text-14\" />\n UV {{ $n(selectedDay.uvIndexMax, 'integer') }}\n </div>\n <div class=\"flex items-center gap-6\">\n <VvIcon name=\"ri:sun-foggy-line\" class=\"text-14\" />\n {{ $d(safeDate(selectedDay.sunrise), 'time') }}\n –\n {{ $d(safeDate(selectedDay.sunset), 'time') }}\n </div>\n </div>\n </div>\n\n <!-- Hourly forecast (filtered to selected day) -->\n <transition>\n <div\n v-if=\"filteredHourly.length > 0\"\n class=\"border-t border-surface-3\">\n <div\n class=\"flex overflow-x-auto gap-2 px-sm py-8 light-scrollbar\">\n <div\n v-for=\"hour in filteredHourly\"\n :key=\"hour.time\"\n class=\"flex flex-col items-center gap-4 min-w-48 px-4 py-6 rounded-xl text-11 text-word-3 shrink-0\">\n <span class=\"text-word-3\">{{\n Number.isNaN(safeDate(hour.time).getTime())\n ? hour.time\n : $d(safeDate(hour.time), 'time')\n }}</span>\n <VvIcon\n :name=\"wmoToIcon(hour.weatherCode)\"\n class=\"text-20 text-word-2\" />\n <span class=\"font-medium text-word-1\">\n {{ $n(hour.temperature, 'integer') }}°\n </span>\n <span\n v-if=\"hour.precipitationProbability > 0\"\n class=\"text-word-5 text-smaller\">\n {{ hour.precipitationProbability }}%\n </span>\n </div>\n </div>\n </div>\n </transition>\n\n <!-- Daily forecast (clickable, inside accordion) -->\n <transition>\n <VvAccordion\n v-if=\"data.daily?.length > 1\"\n v-model=\"dailyOpen\"\n modifiers=\"details no-padding\"\n :title=\"$t('weather.dailyForecast')\"\n class=\"border-t border-surface-3\">\n <button\n v-for=\"(day, index) in data.daily\"\n :key=\"day.date\"\n type=\"button\"\n class=\"flex items-center gap-sm px-sm py-8 text-12 w-full text-left transition-colors cursor-pointer border-t border-surface-3\"\n :class=\"\n index === selectedDayIndex\n ? 'bg-surface-2'\n : 'hover:bg-surface-1'\n \"\n @click=\"selectedDayIndex = index\">\n <span class=\"w-48 shrink-0 text-word-3 capitalize\">\n {{ formatDay(day.date, index, data.daily.length) }}\n </span>\n <VvIcon\n :name=\"wmoToIcon(day.weatherCode)\"\n class=\"text-18 text-word-2 shrink-0\" />\n <span\n v-if=\"day.precipitationProbabilityMax > 0\"\n class=\"text-word-5 text-11 w-32 shrink-0\">\n {{ day.precipitationProbabilityMax }}%\n </span>\n <span v-else class=\"w-32 shrink-0\" />\n <div class=\"ml-auto flex items-center gap-8 text-word-3\">\n <span class=\"text-word-1 font-semibold\">\n {{ $n(day.maxTemp, 'integer') }}°\n </span>\n <span>{{ $n(day.minTemp, 'integer') }}°</span>\n </div>\n </button>\n </VvAccordion>\n </transition>\n\n <!-- Air quality -->\n <div\n v-if=\"data.airQuality\"\n class=\"border-t border-surface-3 px-sm py-8 flex items-center gap-8 text-12\">\n <VvIcon name=\"ri:windy-line\" class=\"text-14 text-word-3\" />\n <span class=\"text-word-3\">{{ $t('weather.airQuality') }}</span>\n <span\n :class=\"[\n 'ml-auto px-8 py-2 text-11 font-semibold',\n aqiInfo(data.airQuality.aqi).class,\n ]\">\n {{ aqiInfo(data.airQuality.aqi).label }}\n ({{ data.airQuality.aqi }})\n </span>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed, ref, watch } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { hasWeatherForecast } from 'models'\n import {\n aqiBand,\n wmoCategory,\n type AqiBandKey,\n type WmoCategory,\n } from 'utils'\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const { t: $t, d: $d, n: $n } = useI18n({ useScope: 'global' })\n\n const toolPart = computed(() => {\n return props.part as {\n state?: string\n input?: unknown\n output?: unknown\n }\n })\n\n const data = computed(() => {\n const { output, input } = toolPart.value\n if (hasWeatherForecast(output)) {\n return output\n }\n // Conversations from before `weatherKey` passed the whole forecast\n return hasWeatherForecast(input) ? input : null\n })\n\n /**\n * The call is over and left nothing to draw: a mangled or expired key\n * fails the tool, and its input is only the key. Without this the card\n * drew a thermometer and \"Oggi\" around nothing. While the call runs there\n * is nothing to draw yet, and nothing has failed either: the card waits.\n */\n const isUnavailable = computed(\n () =>\n !data.value &&\n toolPart.value.state !== 'input-streaming' &&\n toolPart.value.state !== 'input-available',\n )\n\n const selectedDayIndex = ref(0)\n\n const dailyOpen = ref(!data.value?.current)\n\n watch(selectedDayIndex, (index) => {\n if (index > 0) {\n dailyOpen.value = true\n }\n })\n\n const selectedDay = computed(\n () => data.value?.daily?.[selectedDayIndex.value],\n )\n\n /** Hourly entries filtered to the selected day's date */\n const filteredHourly = computed(() => {\n if (!data.value?.hourly?.length || !selectedDay.value) {\n return data.value?.hourly ?? []\n }\n const dayDate = selectedDay.value.date\n return data.value.hourly.filter((h) => h.time.startsWith(dayDate))\n })\n\n /**\n * Parses a date/time string in various formats the LLM might produce.\n * Tries ISO, space-separated, time-only, and common human-readable formats.\n */\n function safeDate(value: string): Date {\n // 1. Try native parsing (works for ISO 8601 and many standard formats)\n const direct = new Date(value)\n if (!Number.isNaN(direct.getTime())) {\n return direct\n }\n\n // 2. Replace space separator → T (\"2024-04-15 14:00\" → \"2024-04-15T14:00\")\n if (/^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}/.test(value)) {\n const withT = new Date(value.replace(' ', 'T'))\n if (!Number.isNaN(withT.getTime())) {\n return withT\n }\n }\n\n // 3. Time-only (\"14:00\" or \"14:00:00\") → today at that hour\n const timeOnly = value.match(/^(\\d{1,2}):(\\d{2})(?::(\\d{2}))?$/)\n if (timeOnly) {\n const today = new Date()\n today.setHours(\n Number(timeOnly[1]),\n Number(timeOnly[2]),\n Number(timeOnly[3] ?? 0),\n 0,\n )\n return today\n }\n\n // 4. Date-only (\"2024-04-15\") → noon to avoid timezone edge\n if (/^\\d{4}-\\d{2}-\\d{2}$/.test(value)) {\n const noon = new Date(value + 'T12:00:00')\n if (!Number.isNaN(noon.getTime())) {\n return noon\n }\n }\n\n // Last resort: return an obviously invalid sentinel so callers can handle it\n return new Date(NaN)\n }\n\n /** Iconify `wi:` icon per canonical WMO category. */\n const WMO_ICON: Record<WmoCategory, string> = {\n clear: 'wi:day-sunny',\n mainlyClear: 'wi:day-sunny-overcast',\n partlyCloudy: 'wi:day-cloudy',\n overcast: 'wi:cloudy',\n fog: 'wi:fog',\n drizzle: 'wi:sprinkle',\n freezingDrizzle: 'wi:sleet',\n rain: 'wi:rain',\n freezingRain: 'wi:rain-mix',\n snow: 'wi:snow',\n rainShowers: 'wi:showers',\n snowShowers: 'wi:snow-wind',\n thunderstorm: 'wi:thunderstorm',\n thunderstormHail: 'wi:storm-showers',\n unknown: 'wi:na',\n }\n\n /** Maps WMO weather code to an Iconify wi: icon name */\n function wmoToIcon(code: number): string {\n return WMO_ICON[wmoCategory(code)]\n }\n\n /**\n * Returns a formatted day label for daily forecast.\n * When daily has 1-2 entries, use the date string directly.\n * Otherwise, use index-based computation from today.\n */\n function formatDay(isoDate: string, index: number, total: number): string {\n const parsed = safeDate(isoDate + 'T12:00:00')\n if (!Number.isNaN(parsed.getTime())) {\n const today = new Date()\n today.setHours(12, 0, 0, 0)\n const diffDays = Math.round(\n (parsed.getTime() - today.getTime()) / 86_400_000,\n )\n if (diffDays === 0) {\n return $t('weather.today')\n }\n return $d(parsed, 'weekday-day')\n }\n if (index === 0 && total <= 7) {\n return $t('weather.today')\n }\n const fallback = new Date()\n fallback.setDate(fallback.getDate() + index)\n return $d(fallback, 'weekday-day')\n }\n\n const headerDate = computed(() => {\n if (selectedDay.value) {\n const parsed = safeDate(selectedDay.value.date + 'T12:00:00')\n if (!Number.isNaN(parsed.getTime())) {\n return formatDay(\n selectedDay.value.date,\n selectedDayIndex.value,\n data.value?.daily?.length ?? 1,\n )\n }\n }\n return formatDay(new Date().toISOString().slice(0, 10), 0, 1)\n })\n\n /** i18n label key + CSS class per canonical AQI band. */\n const AQI_PRESENTATION: Record<\n AqiBandKey,\n { labelKey: string; class: string }\n > = {\n good: {\n labelKey: 'weather.aqiGood',\n class: 'text-green-600 bg-green-50',\n },\n fair: {\n labelKey: 'weather.aqiFair',\n class: 'text-lime-600 bg-lime-50',\n },\n moderate: {\n labelKey: 'weather.aqiModerate',\n class: 'text-yellow-600 bg-yellow-50',\n },\n poor: {\n labelKey: 'weather.aqiPoor',\n class: 'text-orange-600 bg-orange-50',\n },\n veryPoor: {\n labelKey: 'weather.aqiVeryPoor',\n class: 'text-red-600 bg-red-50',\n },\n hazardous: {\n labelKey: 'weather.aqiHazardous',\n class: 'text-purple-700 bg-purple-50',\n },\n }\n\n /** Returns AQI label and CSS class for European AQI */\n function aqiInfo(aqi: number): { label: string; class: string } {\n const { labelKey, class: cssClass } = AQI_PRESENTATION[aqiBand(aqi).key]\n return { label: $t(labelKey), class: cssClass }\n }\n\n /** Formats wind direction degrees to compass label */\n function windDirectionLabel(deg: number): string {\n const dirs = ['N', 'NE', 'E', 'SE', 'S', 'SO', 'O', 'NO']\n return dirs[Math.round(deg / 45) % 8]\n }\n</script>\n\n<template>\n <div\n v-if=\"isUnavailable\"\n class=\"text-12 text-danger flex items-center gap-6 py-8\">\n <VvIcon name=\"ri:error-warning-line\" class=\"w-16 h-16 shrink-0\" />\n <span>{{ $t('weather.unavailable') }}</span>\n </div>\n <div\n v-else-if=\"data\"\n class=\"border border-surface-3 rounded-xl w-full overflow-hidden bg-surface\">\n <!-- Header -->\n <div\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8 min-h-40\">\n <VvIcon name=\"ri:temp-cold-line\" class=\"text-16\" />\n <strong class=\"font-bold truncate\">\n {{ data.locationName }}\n </strong>\n <span class=\"ml-auto shrink-0 capitalize\">\n {{ headerDate }}\n </span>\n </div>\n\n <!-- Current conditions (only when real-time current is available AND first day is selected) -->\n <div\n v-if=\"data.current && selectedDayIndex === 0\"\n class=\"px-sm py-md flex items-center gap-md flex-wrap\">\n <div class=\"flex items-center gap-8\">\n <VvIcon\n :name=\"wmoToIcon(data.current.weatherCode)\"\n class=\"text-48 text-word-2 shrink-0\" />\n <span class=\"text-48 font-light leading-none text-word-1\">\n {{ $n(data.current.temperature, 'integer') }}°\n </span>\n </div>\n <div class=\"flex flex-col gap-4 text-12 text-word-3\">\n <div class=\"flex items-center gap-6\">\n {{ $t('weather.feelsLike') }}\n {{ $n(data.current.feelsLike, 'integer') }}°\n </div>\n <div class=\"flex items-center gap-6\">\n <VvIcon name=\"ri:water-percent-line\" class=\"text-14\" />\n {{ data.current.humidity }}%\n </div>\n <div class=\"flex items-center gap-6\">\n <VvIcon name=\"ri:windy-line\" class=\"text-14\" />\n {{ $n(data.current.windSpeed, 'integer') }} km/h\n {{ windDirectionLabel(data.current.windDirection) }}\n </div>\n <div\n v-if=\"data.current.uvIndex > 0\"\n class=\"flex items-center gap-6\">\n <VvIcon name=\"ri:sun-line\" class=\"text-14\" />\n UV {{ $n(data.current.uvIndex, 'integer') }}\n </div>\n </div>\n </div>\n\n <!-- Day summary (when no real-time current, or a non-today day is selected) -->\n <div\n v-else-if=\"selectedDay\"\n class=\"px-sm py-md flex items-center gap-md flex-wrap\">\n <div class=\"flex items-center gap-8\">\n <VvIcon\n :name=\"wmoToIcon(selectedDay.weatherCode)\"\n class=\"text-48 text-word-2 shrink-0\" />\n <div class=\"flex flex-col leading-none\">\n <span class=\"text-48 font-light text-word-1\">\n {{ $n(selectedDay.maxTemp, 'integer') }}°\n </span>\n <span class=\"text-20 text-word-3\">\n {{ $n(selectedDay.minTemp, 'integer') }}°\n </span>\n </div>\n </div>\n <div class=\"flex flex-col gap-4 text-12 text-word-3\">\n <div\n v-if=\"selectedDay.precipitationProbabilityMax > 0\"\n class=\"flex items-center gap-6\">\n <VvIcon name=\"ri:drop-line\" class=\"text-14\" />\n {{ selectedDay.precipitationProbabilityMax }}% ({{\n selectedDay.precipitationSum\n }}\n mm)\n </div>\n <div\n v-if=\"selectedDay.uvIndexMax > 0\"\n class=\"flex items-center gap-6\">\n <VvIcon name=\"ri:sun-line\" class=\"text-14\" />\n UV {{ $n(selectedDay.uvIndexMax, 'integer') }}\n </div>\n <div class=\"flex items-center gap-6\">\n <VvIcon name=\"ri:sun-foggy-line\" class=\"text-14\" />\n {{ $d(safeDate(selectedDay.sunrise), 'time') }}\n –\n {{ $d(safeDate(selectedDay.sunset), 'time') }}\n </div>\n </div>\n </div>\n\n <!-- Hourly forecast (filtered to selected day) -->\n <transition>\n <div\n v-if=\"filteredHourly.length > 0\"\n class=\"border-t border-surface-3\">\n <div\n class=\"flex overflow-x-auto gap-2 px-sm py-8 light-scrollbar\">\n <div\n v-for=\"hour in filteredHourly\"\n :key=\"hour.time\"\n class=\"flex flex-col items-center gap-4 min-w-48 px-4 py-6 rounded-xl text-11 text-word-3 shrink-0\">\n <span class=\"text-word-3\">{{\n Number.isNaN(safeDate(hour.time).getTime())\n ? hour.time\n : $d(safeDate(hour.time), 'time')\n }}</span>\n <VvIcon\n :name=\"wmoToIcon(hour.weatherCode)\"\n class=\"text-20 text-word-2\" />\n <span class=\"font-medium text-word-1\">\n {{ $n(hour.temperature, 'integer') }}°\n </span>\n <span\n v-if=\"hour.precipitationProbability > 0\"\n class=\"text-word-5 text-smaller\">\n {{ hour.precipitationProbability }}%\n </span>\n </div>\n </div>\n </div>\n </transition>\n\n <!-- Daily forecast (clickable, inside accordion) -->\n <transition>\n <VvAccordion\n v-if=\"data.daily?.length > 1\"\n v-model=\"dailyOpen\"\n modifiers=\"details no-padding\"\n :title=\"$t('weather.dailyForecast')\"\n class=\"border-t border-surface-3\">\n <button\n v-for=\"(day, index) in data.daily\"\n :key=\"day.date\"\n type=\"button\"\n class=\"flex items-center gap-sm px-sm py-8 text-12 w-full text-left transition-colors cursor-pointer border-t border-surface-3\"\n :class=\"\n index === selectedDayIndex\n ? 'bg-surface-2'\n : 'hover:bg-surface-1'\n \"\n @click=\"selectedDayIndex = index\">\n <span class=\"w-48 shrink-0 text-word-3 capitalize\">\n {{ formatDay(day.date, index, data.daily.length) }}\n </span>\n <VvIcon\n :name=\"wmoToIcon(day.weatherCode)\"\n class=\"text-18 text-word-2 shrink-0\" />\n <span\n v-if=\"day.precipitationProbabilityMax > 0\"\n class=\"text-word-5 text-11 w-32 shrink-0\">\n {{ day.precipitationProbabilityMax }}%\n </span>\n <span v-else class=\"w-32 shrink-0\" />\n <div class=\"ml-auto flex items-center gap-8 text-word-3\">\n <span class=\"text-word-1 font-semibold\">\n {{ $n(day.maxTemp, 'integer') }}°\n </span>\n <span>{{ $n(day.minTemp, 'integer') }}°</span>\n </div>\n </button>\n </VvAccordion>\n </transition>\n\n <!-- Air quality -->\n <div\n v-if=\"data.airQuality\"\n class=\"border-t border-surface-3 px-sm py-8 flex items-center gap-8 text-12\">\n <VvIcon name=\"ri:windy-line\" class=\"text-14 text-word-3\" />\n <span class=\"text-word-3\">{{ $t('weather.airQuality') }}</span>\n <span\n :class=\"[\n 'ml-auto px-8 py-2 text-11 font-semibold',\n aqiInfo(data.airQuality.aqi).class,\n ]\">\n {{ aqiInfo(data.airQuality.aqi).label }}\n ({{ data.airQuality.aqi }})\n </span>\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;AAQA,IAAMkD,IAAuBlD,EAAS;CAClC,aAAaC,EAAS,CAAC,CAAC,SAAS,mBAAmB;CACpD,WAAWA,EAAS,CAAC,CAAC,SAAS,4BAA4B;CAC3D,UAAUA,EAAS,CAAC,CAAC,SAAS,wBAAwB;CACtD,eAAeA,EAAS,CAAC,CAAC,SAAS,qBAAqB;CACxD,aAAaA,EAAS,CAAC,CAAC,SAAS,iCAAiC;CAClE,WAAWA,EAAS,CAAC,CAAC,SAAS,oBAAoB;CACnD,eAAeA,EAAS,CAAC,CAAC,SAAS,2BAA2B;CAC9D,SAASA,EAAS,CAAC,CAAC,SAAS,UAAU;AAC3C,CAAC,GAEKkD,IAAsB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AC,EAAA4F,CAAA,CAAE,CAACsC,EAAI,SAAO,SAAA,CAAA,IAAe,MACpC,CAAA,GACApI,EAAkD,QAAA,MAAAC,EAAzCC,EAAA4F,CAAA,CAAE,CAACsC,EAAI,SAAO,SAAA,CAAA,IAAe,KAAK,CAAA,C;;;;;;IAQjDpC,EAAA,MAAK,cADfnG,EAAA,GAAAC,EAaM,OAbNyF,IAaM;KAVFxF,EAA2DgI,GAAA;MAAnD,MAAK;MAAgB,OAAM;;KACnC/H,EAA+D,QAA/DwF,IAA+DvF,EAAlCC,EAAA0F,CAAA,CAAE,CAAA,oBAAA,CAAA,GAAA,CAAA;KAC/B5F,EAOO,QAAA,EANF,OAAKU,EAAA,C,2CAAuFgH,EAAQ1B,EAAA,MAAK,WAAW,GAAG,CAAA,CAAE,K,GAIvH,GAAA/F,EAAAyH,EAAQ1B,EAAA,MAAK,WAAW,GAAG,CAAA,CAAE,KAAK,IAAG,OACvC/F,EAAG+F,EAAA,MAAK,WAAW,GAAG,IAAG,MAC9B,CAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { S as e, Tt as t, V as n, _ as r, f as i, g as a, gt as o, h as s, k as c, kt as l, ot as u, v as d, w as f, wt as p, x as m, y as h, z as g } from "./vue.runtime.esm-bundler-C2U5uTqB.js";
|
|
2
|
-
import "./src-
|
|
2
|
+
import "./src-JJyCGvqH.js";
|
|
3
3
|
import { n as _ } from "./url-validation-CJV9pp4v.js";
|
|
4
4
|
import { t as v } from "./index.es-fkUmGg9G.js";
|
|
5
|
-
import { n as y } from "./chatImagePolicy-
|
|
5
|
+
import { n as y } from "./chatImagePolicy-ZiVuD6nX.js";
|
|
6
6
|
import { t as b } from "./PkHeldImage-BUHSVQzX.js";
|
|
7
7
|
import { t as x } from "./PkLazyImg-B7PfEr4P.js";
|
|
8
8
|
import { t as S } from "./PkUrl-BZgNcvUS.js";
|
|
@@ -82,4 +82,4 @@ var C = {
|
|
|
82
82
|
});
|
|
83
83
|
export { A as default };
|
|
84
84
|
|
|
85
|
-
//# sourceMappingURL=PkToolShowWebPages-
|
|
85
|
+
//# sourceMappingURL=PkToolShowWebPages-BqL9PjpM.js.map
|
package/dist/_chunks/{PkToolShowWebPages-fXkqV27c.js.map → PkToolShowWebPages-BqL9PjpM.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PkToolShowWebPages-fXkqV27c.js","names":["$t","__unplugin_components_0","_openBlock","_createElementBlock","_Fragment","_renderList","_createElementVNode","_unref","_createBlock","PkHeldImage","PkLazyImg","_createCommentVNode","_toDisplayString","_createVNode","PkUrl","_createTextVNode","_sfc_main","createVNode","init_shared_esm_bundler","renderList","createBlock","Fragment","createBaseVNode","ref","computed","init_runtime_core_esm_bundler","toDisplayString","init_reactivity_esm_bundler","createCommentVNode","defineComponent","unref","createTextVNode","createElementBlock","openBlock","isSameSite","Ce","useChatImageGate","PkHeldImage_default","PkLazyImg_default","PkUrl_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","PkToolShowWebPages_default","props","__props","toolPart","imageGate","normalizeUrl","u","url","uniquePages","seen","result","page","key","showMore","pages","hasMore","_component_VvIcon","index","_ctx","_cache"],"sources":["../../../../packages/components/src/chat/PkToolShowWebPages.vue","../../../../packages/components/src/chat/PkToolShowWebPages.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, ref } from 'vue'\n import { isSameSite } from 'utils'\n import PkLazyImg from '../PkLazyImg.vue'\n import { useChatImageGate } from './chatImagePolicy'\n import PkHeldImage from './PkHeldImage.vue'\n import PkUrl from '../PkUrl.vue'\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n pages: Array<{\n title: string\n url: string\n image?: string\n description?: string\n }>\n }\n }\n return part\n })\n\n // The model writes these urls: one from a host the agent does not list\n // waits for a click (chatImagePolicy.ts).\n const imageGate = useChatImageGate()\n\n // The model often passes the same URL several times (e.g. multiple KB\n // chunks from one page), so collapse duplicates, keeping the first (richest)\n // entry. Normalize by dropping the hash and any trailing slash.\n const normalizeUrl = (url: string) => {\n try {\n const u = new URL(url)\n u.hash = ''\n return u.toString().replace(/\\/$/, '')\n } catch {\n return url.trim().replace(/\\/$/, '')\n }\n }\n const uniquePages = computed(() => {\n const seen = new Set<string>()\n const result: NonNullable<typeof toolPart.value.input>['pages'] = []\n for (const page of toolPart.value.input?.pages || []) {\n const key = normalizeUrl(page.url)\n if (seen.has(key)) {\n continue\n }\n seen.add(key)\n result.push(page)\n }\n return result\n })\n\n const showMore = ref(false)\n const pages = computed(() => {\n if (showMore.value) {\n return uniquePages.value\n }\n return uniquePages.value.slice(0, 2)\n })\n const hasMore = computed(() => uniquePages.value.length > 2)\n</script>\n\n<template>\n <ul\n v-if=\"pages?.length\"\n class=\"vv-item-group vv-item-group--framed w-full shrink-0\">\n <li\n v-for=\"(page, index) in pages\"\n :key=\"index\"\n class=\"vv-item vv-item--top vv-item--roomy\">\n <a\n :href=\"page.url\"\n :title=\"$t('action.open')\"\n :target=\"isSameSite(page.url) ? undefined : '_blank'\"\n :rel=\"isSameSite(page.url) ? undefined : 'noopener noreferrer'\"\n class=\"vv-item__entry\">\n <!-- og:images the model scraped are third-party urls: a dead one\n degrades to an icon instead of breaking the card layout -->\n <PkHeldImage\n v-if=\"page.image && !imageGate.canLoad(page.image)\"\n :host=\"imageGate.hostOf(page.image)\"\n class=\"w-48 h-48 rounded-lg shrink-0 border border-surface-3 bg-surface\"\n @release=\"imageGate.release(page.image)\" />\n <PkLazyImg\n v-else-if=\"page.image\"\n :src=\"page.image\"\n :alt=\"page.title\"\n fallback-icon=\"ri:image-off-line\"\n class=\"w-48 h-48 object-contain rounded-lg shrink-0 border border-surface-3 bg-surface\" />\n <div class=\"flex flex-col gap-4 min-w-0 flex-1\">\n <strong\n class=\"vv-item__title font-medium text-12 text-word-1\">\n {{ page.title }}\n </strong>\n <span\n class=\"text-10 text-word-4 truncate flex items-center gap-4\">\n <VvIcon name=\"ri:link\" class=\"shrink-0 text-12\" />\n <PkUrl :url=\"page.url\" />\n </span>\n <p\n v-if=\"page.description\"\n class=\"text-12 text-word-3 line-clamp-2\">\n {{ page.description }}\n </p>\n </div>\n </a>\n </li>\n <li v-if=\"hasMore\" class=\"vv-item\">\n <button\n class=\"vv-item__entry justify-center cursor-pointer\"\n @click=\"showMore = !showMore\">\n <VvIcon\n :name=\"\n showMore ? 'ri:arrow-up-s-line' : 'ri:arrow-down-s-line'\n \"\n class=\"text-16\" />\n {{\n showMore\n ? $t('action.showLess')\n : $t('action.showMore', {\n count: uniquePages.length - 2,\n })\n }}\n </button>\n </li>\n </ul>\n</template>\n","<script setup lang=\"ts\">\n import { computed, ref } from 'vue'\n import { isSameSite } from 'utils'\n import PkLazyImg from '../PkLazyImg.vue'\n import { useChatImageGate } from './chatImagePolicy'\n import PkHeldImage from './PkHeldImage.vue'\n import PkUrl from '../PkUrl.vue'\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n pages: Array<{\n title: string\n url: string\n image?: string\n description?: string\n }>\n }\n }\n return part\n })\n\n // The model writes these urls: one from a host the agent does not list\n // waits for a click (chatImagePolicy.ts).\n const imageGate = useChatImageGate()\n\n // The model often passes the same URL several times (e.g. multiple KB\n // chunks from one page), so collapse duplicates, keeping the first (richest)\n // entry. Normalize by dropping the hash and any trailing slash.\n const normalizeUrl = (url: string) => {\n try {\n const u = new URL(url)\n u.hash = ''\n return u.toString().replace(/\\/$/, '')\n } catch {\n return url.trim().replace(/\\/$/, '')\n }\n }\n const uniquePages = computed(() => {\n const seen = new Set<string>()\n const result: NonNullable<typeof toolPart.value.input>['pages'] = []\n for (const page of toolPart.value.input?.pages || []) {\n const key = normalizeUrl(page.url)\n if (seen.has(key)) {\n continue\n }\n seen.add(key)\n result.push(page)\n }\n return result\n })\n\n const showMore = ref(false)\n const pages = computed(() => {\n if (showMore.value) {\n return uniquePages.value\n }\n return uniquePages.value.slice(0, 2)\n })\n const hasMore = computed(() => uniquePages.value.length > 2)\n</script>\n\n<template>\n <ul\n v-if=\"pages?.length\"\n class=\"vv-item-group vv-item-group--framed w-full shrink-0\">\n <li\n v-for=\"(page, index) in pages\"\n :key=\"index\"\n class=\"vv-item vv-item--top vv-item--roomy\">\n <a\n :href=\"page.url\"\n :title=\"$t('action.open')\"\n :target=\"isSameSite(page.url) ? undefined : '_blank'\"\n :rel=\"isSameSite(page.url) ? undefined : 'noopener noreferrer'\"\n class=\"vv-item__entry\">\n <!-- og:images the model scraped are third-party urls: a dead one\n degrades to an icon instead of breaking the card layout -->\n <PkHeldImage\n v-if=\"page.image && !imageGate.canLoad(page.image)\"\n :host=\"imageGate.hostOf(page.image)\"\n class=\"w-48 h-48 rounded-lg shrink-0 border border-surface-3 bg-surface\"\n @release=\"imageGate.release(page.image)\" />\n <PkLazyImg\n v-else-if=\"page.image\"\n :src=\"page.image\"\n :alt=\"page.title\"\n fallback-icon=\"ri:image-off-line\"\n class=\"w-48 h-48 object-contain rounded-lg shrink-0 border border-surface-3 bg-surface\" />\n <div class=\"flex flex-col gap-4 min-w-0 flex-1\">\n <strong\n class=\"vv-item__title font-medium text-12 text-word-1\">\n {{ page.title }}\n </strong>\n <span\n class=\"text-10 text-word-4 truncate flex items-center gap-4\">\n <VvIcon name=\"ri:link\" class=\"shrink-0 text-12\" />\n <PkUrl :url=\"page.url\" />\n </span>\n <p\n v-if=\"page.description\"\n class=\"text-12 text-word-3 line-clamp-2\">\n {{ page.description }}\n </p>\n </div>\n </a>\n </li>\n <li v-if=\"hasMore\" class=\"vv-item\">\n <button\n class=\"vv-item__entry justify-center cursor-pointer\"\n @click=\"showMore = !showMore\">\n <VvIcon\n :name=\"\n showMore ? 'ri:arrow-up-s-line' : 'ri:arrow-down-s-line'\n \"\n class=\"text-16\" />\n {{\n showMore\n ? $t('action.showLess')\n : $t('action.showMore', {\n count: uniquePages.length - 2,\n })\n }}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wB,EAAK,GAAG,IAAI,KAAA,IAAS;IACtC,OAAM;G,IAIIA,EAAK,SAAK,CAAKnD,EAAA4C,CAAA,CAAS,CAAC,QAAQO,EAAK,KAAK,KADrDxD,EAAA,GAAAM,EAI+CC,GAAA;;IAF1C,MAAMF,EAAA4C,CAAA,CAAS,CAAC,OAAOO,EAAK,KAAK;IAClC,OAAM;IACL,YAAO,MAAEnD,EAAA4C,CAAA,CAAS,CAAC,QAAQO,EAAK,KAAK;G,sCAE3BA,EAAK,SADpBxD,EAAA,GAAAM,EAK8FE,GAAA;;IAHzF,KAAKgD,EAAK;IACV,KAAKA,EAAK;IACX,iBAAc;IACd,OAAM;G,0CACVpD,EAeM,OAfNoC,GAeM;IAdFpC,EAGS,UAHTqC,GAGS/B,EADF8C,EAAK,KAAK,GAAA,CAAA;IAEjBpD,EAIO,QAJPsC,GAIO,CAFH/B,EAAkDkD,GAAA;KAA1C,MAAK;KAAU,OAAM;I,IAC7BlD,EAAyBC,GAAA,EAAjB,KAAK4C,EAAK,I;IAGZA,EAAK,eADfxD,EAAA,GAAAC,EAII,KAJJ0C,GAIIjC,EADG8C,EAAK,WAAW,GAAA,CAAA,K;G,uBAKzBI,EAAA,SAAV5D,EAAA,GAAAC,EAiBK,MAjBL2C,GAiBK,CAhBDxC,EAeS,UAAA;IAdL,OAAM;IACL,SAAK,AAAA4D,EAAA,QAAA,MAAE,EAAA,QAAQ,CAAIN,EAAA;G,IACpB/C,EAIsBkD,GAAA;IAHjB,MAA+BH,EAAA,QAAQ,uBAAA;IAGxC,OAAM;G,uBAAY7C,EAAA,MACtBH,EACIgD,EAAA,QAAmC5D,EAAAA,GAAE,iBAAA,IAA8CA,EAAAA,GAAE,mBAAA,EAA2D,OAAAuD,EAAA,MAAY,SAAM,E"}
|
|
1
|
+
{"version":3,"file":"PkToolShowWebPages-BqL9PjpM.js","names":["$t","__unplugin_components_0","_openBlock","_createElementBlock","_Fragment","_renderList","_createElementVNode","_unref","_createBlock","PkHeldImage","PkLazyImg","_createCommentVNode","_toDisplayString","_createVNode","PkUrl","_createTextVNode","_sfc_main","createVNode","init_shared_esm_bundler","renderList","createBlock","Fragment","createBaseVNode","ref","computed","init_runtime_core_esm_bundler","toDisplayString","init_reactivity_esm_bundler","createCommentVNode","defineComponent","unref","createTextVNode","createElementBlock","openBlock","isSameSite","Ce","useChatImageGate","PkHeldImage_default","PkLazyImg_default","PkUrl_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","PkToolShowWebPages_default","props","__props","toolPart","imageGate","normalizeUrl","u","url","uniquePages","seen","result","page","key","showMore","pages","hasMore","_component_VvIcon","index","_ctx","_cache"],"sources":["../../../../packages/components/src/chat/PkToolShowWebPages.vue","../../../../packages/components/src/chat/PkToolShowWebPages.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, ref } from 'vue'\n import { isSameSite } from 'utils'\n import PkLazyImg from '../PkLazyImg.vue'\n import { useChatImageGate } from './chatImagePolicy'\n import PkHeldImage from './PkHeldImage.vue'\n import PkUrl from '../PkUrl.vue'\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n pages: Array<{\n title: string\n url: string\n image?: string\n description?: string\n }>\n }\n }\n return part\n })\n\n // The model writes these urls: one from a host the agent does not list\n // waits for a click (chatImagePolicy.ts).\n const imageGate = useChatImageGate()\n\n // The model often passes the same URL several times (e.g. multiple KB\n // chunks from one page), so collapse duplicates, keeping the first (richest)\n // entry. Normalize by dropping the hash and any trailing slash.\n const normalizeUrl = (url: string) => {\n try {\n const u = new URL(url)\n u.hash = ''\n return u.toString().replace(/\\/$/, '')\n } catch {\n return url.trim().replace(/\\/$/, '')\n }\n }\n const uniquePages = computed(() => {\n const seen = new Set<string>()\n const result: NonNullable<typeof toolPart.value.input>['pages'] = []\n for (const page of toolPart.value.input?.pages || []) {\n const key = normalizeUrl(page.url)\n if (seen.has(key)) {\n continue\n }\n seen.add(key)\n result.push(page)\n }\n return result\n })\n\n const showMore = ref(false)\n const pages = computed(() => {\n if (showMore.value) {\n return uniquePages.value\n }\n return uniquePages.value.slice(0, 2)\n })\n const hasMore = computed(() => uniquePages.value.length > 2)\n</script>\n\n<template>\n <ul\n v-if=\"pages?.length\"\n class=\"vv-item-group vv-item-group--framed w-full shrink-0\">\n <li\n v-for=\"(page, index) in pages\"\n :key=\"index\"\n class=\"vv-item vv-item--top vv-item--roomy\">\n <a\n :href=\"page.url\"\n :title=\"$t('action.open')\"\n :target=\"isSameSite(page.url) ? undefined : '_blank'\"\n :rel=\"isSameSite(page.url) ? undefined : 'noopener noreferrer'\"\n class=\"vv-item__entry\">\n <!-- og:images the model scraped are third-party urls: a dead one\n degrades to an icon instead of breaking the card layout -->\n <PkHeldImage\n v-if=\"page.image && !imageGate.canLoad(page.image)\"\n :host=\"imageGate.hostOf(page.image)\"\n class=\"w-48 h-48 rounded-lg shrink-0 border border-surface-3 bg-surface\"\n @release=\"imageGate.release(page.image)\" />\n <PkLazyImg\n v-else-if=\"page.image\"\n :src=\"page.image\"\n :alt=\"page.title\"\n fallback-icon=\"ri:image-off-line\"\n class=\"w-48 h-48 object-contain rounded-lg shrink-0 border border-surface-3 bg-surface\" />\n <div class=\"flex flex-col gap-4 min-w-0 flex-1\">\n <strong\n class=\"vv-item__title font-medium text-12 text-word-1\">\n {{ page.title }}\n </strong>\n <span\n class=\"text-10 text-word-4 truncate flex items-center gap-4\">\n <VvIcon name=\"ri:link\" class=\"shrink-0 text-12\" />\n <PkUrl :url=\"page.url\" />\n </span>\n <p\n v-if=\"page.description\"\n class=\"text-12 text-word-3 line-clamp-2\">\n {{ page.description }}\n </p>\n </div>\n </a>\n </li>\n <li v-if=\"hasMore\" class=\"vv-item\">\n <button\n class=\"vv-item__entry justify-center cursor-pointer\"\n @click=\"showMore = !showMore\">\n <VvIcon\n :name=\"\n showMore ? 'ri:arrow-up-s-line' : 'ri:arrow-down-s-line'\n \"\n class=\"text-16\" />\n {{\n showMore\n ? $t('action.showLess')\n : $t('action.showMore', {\n count: uniquePages.length - 2,\n })\n }}\n </button>\n </li>\n </ul>\n</template>\n","<script setup lang=\"ts\">\n import { computed, ref } from 'vue'\n import { isSameSite } from 'utils'\n import PkLazyImg from '../PkLazyImg.vue'\n import { useChatImageGate } from './chatImagePolicy'\n import PkHeldImage from './PkHeldImage.vue'\n import PkUrl from '../PkUrl.vue'\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n pages: Array<{\n title: string\n url: string\n image?: string\n description?: string\n }>\n }\n }\n return part\n })\n\n // The model writes these urls: one from a host the agent does not list\n // waits for a click (chatImagePolicy.ts).\n const imageGate = useChatImageGate()\n\n // The model often passes the same URL several times (e.g. multiple KB\n // chunks from one page), so collapse duplicates, keeping the first (richest)\n // entry. Normalize by dropping the hash and any trailing slash.\n const normalizeUrl = (url: string) => {\n try {\n const u = new URL(url)\n u.hash = ''\n return u.toString().replace(/\\/$/, '')\n } catch {\n return url.trim().replace(/\\/$/, '')\n }\n }\n const uniquePages = computed(() => {\n const seen = new Set<string>()\n const result: NonNullable<typeof toolPart.value.input>['pages'] = []\n for (const page of toolPart.value.input?.pages || []) {\n const key = normalizeUrl(page.url)\n if (seen.has(key)) {\n continue\n }\n seen.add(key)\n result.push(page)\n }\n return result\n })\n\n const showMore = ref(false)\n const pages = computed(() => {\n if (showMore.value) {\n return uniquePages.value\n }\n return uniquePages.value.slice(0, 2)\n })\n const hasMore = computed(() => uniquePages.value.length > 2)\n</script>\n\n<template>\n <ul\n v-if=\"pages?.length\"\n class=\"vv-item-group vv-item-group--framed w-full shrink-0\">\n <li\n v-for=\"(page, index) in pages\"\n :key=\"index\"\n class=\"vv-item vv-item--top vv-item--roomy\">\n <a\n :href=\"page.url\"\n :title=\"$t('action.open')\"\n :target=\"isSameSite(page.url) ? undefined : '_blank'\"\n :rel=\"isSameSite(page.url) ? undefined : 'noopener noreferrer'\"\n class=\"vv-item__entry\">\n <!-- og:images the model scraped are third-party urls: a dead one\n degrades to an icon instead of breaking the card layout -->\n <PkHeldImage\n v-if=\"page.image && !imageGate.canLoad(page.image)\"\n :host=\"imageGate.hostOf(page.image)\"\n class=\"w-48 h-48 rounded-lg shrink-0 border border-surface-3 bg-surface\"\n @release=\"imageGate.release(page.image)\" />\n <PkLazyImg\n v-else-if=\"page.image\"\n :src=\"page.image\"\n :alt=\"page.title\"\n fallback-icon=\"ri:image-off-line\"\n class=\"w-48 h-48 object-contain rounded-lg shrink-0 border border-surface-3 bg-surface\" />\n <div class=\"flex flex-col gap-4 min-w-0 flex-1\">\n <strong\n class=\"vv-item__title font-medium text-12 text-word-1\">\n {{ page.title }}\n </strong>\n <span\n class=\"text-10 text-word-4 truncate flex items-center gap-4\">\n <VvIcon name=\"ri:link\" class=\"shrink-0 text-12\" />\n <PkUrl :url=\"page.url\" />\n </span>\n <p\n v-if=\"page.description\"\n class=\"text-12 text-word-3 line-clamp-2\">\n {{ page.description }}\n </p>\n </div>\n </a>\n </li>\n <li v-if=\"hasMore\" class=\"vv-item\">\n <button\n class=\"vv-item__entry justify-center cursor-pointer\"\n @click=\"showMore = !showMore\">\n <VvIcon\n :name=\"\n showMore ? 'ri:arrow-up-s-line' : 'ri:arrow-down-s-line'\n \"\n class=\"text-16\" />\n {{\n showMore\n ? $t('action.showLess')\n : $t('action.showMore', {\n count: uniquePages.length - 2,\n })\n }}\n </button>\n </li>\n </ul>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQI,IAAMgD,IAAQC,GAIRC,IAAW1B,QACAwB,EAAM,IAWtB,GAIKG,IAAYf,EAAiB,GAK7BgB,KAAgB,MAAgB;GAClC,IAAI;IACA,IAAMC,IAAI,IAAI,IAAIC,CAAG;IAErB,OADA,EAAE,OAAO,IACFD,EAAE,SAAS,CAAC,CAAC,QAAQ,OAAO,EAAE;GACzC,QAAQ;IACJ,OAAOC,EAAI,KAAK,CAAC,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8FE,GAAA;;IAHzF,KAAKgD,EAAK;IACV,KAAKA,EAAK;IACX,iBAAc;IACd,OAAM;G,0CACVpD,EAeM,OAfNoC,GAeM;IAdFpC,EAGS,UAHTqC,GAGS/B,EADF8C,EAAK,KAAK,GAAA,CAAA;IAEjBpD,EAIO,QAJPsC,GAIO,CAFH/B,EAAkDkD,GAAA;KAA1C,MAAK;KAAU,OAAM;I,IAC7BlD,EAAyBC,GAAA,EAAjB,KAAK4C,EAAK,I;IAGZA,EAAK,eADfxD,EAAA,GAAAC,EAII,KAJJ0C,GAIIjC,EADG8C,EAAK,WAAW,GAAA,CAAA,K;G,uBAKzBI,EAAA,SAAV5D,EAAA,GAAAC,EAiBK,MAjBL2C,GAiBK,CAhBDxC,EAeS,UAAA;IAdL,OAAM;IACL,SAAK,AAAA4D,EAAA,QAAA,MAAE,EAAA,QAAQ,CAAIN,EAAA;G,IACpB/C,EAIsBkD,GAAA;IAHjB,MAA+BH,EAAA,QAAQ,uBAAA;IAGxC,OAAM;G,uBAAY7C,EAAA,MACtBH,EACIgD,EAAA,QAAmC5D,EAAAA,GAAE,iBAAA,IAA8CA,EAAAA,GAAE,mBAAA,EAA2D,OAAAuD,EAAA,MAAY,SAAM,E"}
|
|
@@ -3154,14 +3154,18 @@ function Ho(e) {
|
|
|
3154
3154
|
}
|
|
3155
3155
|
return t ?? e;
|
|
3156
3156
|
}
|
|
3157
|
+
var Uo = /(Failed query: [\s\S]*?\nparams: )(?!values not logged|\d+ values, not logged)[\s\S]*?(?=\n[ \t]+at [^\n]*:\d+:\d+\)?(?:\n|$)|$)/g, Wo = /(Failed query: (?:[^"\\]|\\.)*?\\nparams: )(?!values not logged|\d+ values, not logged)(?:[^"\\]|\\.)*/g;
|
|
3158
|
+
function Go(e) {
|
|
3159
|
+
return e.includes("Failed query: ") ? e.replace(Uo, "$1values not logged").replace(Wo, "$1values not logged") : e;
|
|
3160
|
+
}
|
|
3157
3161
|
// ../../packages/telemetry/src/spanUrlMasking.ts
|
|
3158
|
-
var
|
|
3162
|
+
var Ko = class {
|
|
3159
3163
|
exporter;
|
|
3160
3164
|
constructor(e) {
|
|
3161
3165
|
this.exporter = e;
|
|
3162
3166
|
}
|
|
3163
3167
|
export(e, t) {
|
|
3164
|
-
this.exporter.export(e.map(
|
|
3168
|
+
this.exporter.export(e.map(Jo), t);
|
|
3165
3169
|
}
|
|
3166
3170
|
shutdown() {
|
|
3167
3171
|
return this.exporter.shutdown();
|
|
@@ -3169,15 +3173,18 @@ var Uo = class {
|
|
|
3169
3173
|
forceFlush() {
|
|
3170
3174
|
return this.exporter.forceFlush?.() ?? Promise.resolve();
|
|
3171
3175
|
}
|
|
3172
|
-
},
|
|
3173
|
-
let t =
|
|
3174
|
-
|
|
3176
|
+
}, qo = (e) => {
|
|
3177
|
+
let t = Object.entries(e);
|
|
3178
|
+
return t.some(([, e]) => typeof e == "string" && e.includes("Failed query: ")) ? Object.fromEntries(t.map(([e, t]) => [e, typeof t == "string" ? Go(t) : t])) : e;
|
|
3179
|
+
}, Jo = (e) => {
|
|
3180
|
+
let t = qo(Ho(e.attributes)), n = !1, r = e.events.map((e) => {
|
|
3181
|
+
let t = e.attributes && qo(Ho(e.attributes));
|
|
3175
3182
|
return t === e.attributes ? e : (n = !0, {
|
|
3176
3183
|
...e,
|
|
3177
3184
|
attributes: t
|
|
3178
3185
|
});
|
|
3179
|
-
});
|
|
3180
|
-
return t === e.attributes && !n ? e : Object.create(e, {
|
|
3186
|
+
}), i = e.status.message && Go(e.status.message), a = i !== e.status.message;
|
|
3187
|
+
return t === e.attributes && !n && !a ? e : Object.create(e, {
|
|
3181
3188
|
attributes: {
|
|
3182
3189
|
value: t,
|
|
3183
3190
|
enumerable: !0
|
|
@@ -3185,12 +3192,19 @@ var Uo = class {
|
|
|
3185
3192
|
events: {
|
|
3186
3193
|
value: n ? r : e.events,
|
|
3187
3194
|
enumerable: !0
|
|
3195
|
+
},
|
|
3196
|
+
status: {
|
|
3197
|
+
value: a ? {
|
|
3198
|
+
...e.status,
|
|
3199
|
+
message: i
|
|
3200
|
+
} : e.status,
|
|
3201
|
+
enumerable: !0
|
|
3188
3202
|
}
|
|
3189
3203
|
});
|
|
3190
|
-
},
|
|
3191
|
-
function
|
|
3192
|
-
if (
|
|
3193
|
-
|
|
3204
|
+
}, Yo = !1;
|
|
3205
|
+
function Xo(e) {
|
|
3206
|
+
if (Yo) return;
|
|
3207
|
+
Yo = !0;
|
|
3194
3208
|
let t = () => {
|
|
3195
3209
|
lo(e(), 2e3, "browser flush");
|
|
3196
3210
|
};
|
|
@@ -3198,7 +3212,7 @@ function Ko(e) {
|
|
|
3198
3212
|
document.visibilityState === "hidden" && t();
|
|
3199
3213
|
});
|
|
3200
3214
|
}
|
|
3201
|
-
function
|
|
3215
|
+
function Zo(e) {
|
|
3202
3216
|
if (e?.enabled === !1) return null;
|
|
3203
3217
|
let t = e?.serviceName ?? "frontend", n = e?.environment ?? "development";
|
|
3204
3218
|
return {
|
|
@@ -3213,8 +3227,8 @@ function qo(e) {
|
|
|
3213
3227
|
ignoreUrls: e?.ignoreUrls
|
|
3214
3228
|
};
|
|
3215
3229
|
}
|
|
3216
|
-
function
|
|
3217
|
-
let t =
|
|
3230
|
+
function Qo(e) {
|
|
3231
|
+
let t = Zo(e);
|
|
3218
3232
|
if (!t) return {
|
|
3219
3233
|
shutdown: async () => {},
|
|
3220
3234
|
flush: async () => {}
|
|
@@ -3223,7 +3237,7 @@ function Jo(e) {
|
|
|
3223
3237
|
[Bt]: t.serviceName,
|
|
3224
3238
|
"deployment.environment": t.environment,
|
|
3225
3239
|
"service.version": "0.0.0"
|
|
3226
|
-
}), r = new
|
|
3240
|
+
}), r = new Ko(new Ea({
|
|
3227
3241
|
url: `${t.exporterEndpoint}/v1/traces`,
|
|
3228
3242
|
headers: t.otlpHeaders
|
|
3229
3243
|
})), i = new Ur({
|
|
@@ -3234,7 +3248,7 @@ function Jo(e) {
|
|
|
3234
3248
|
return i.register(), S.setGlobalPropagator(new vn()), new Qa({
|
|
3235
3249
|
propagateTraceHeaderCorsUrls: t.propagateCorsUrls ? [t.propagateCorsUrls] : [],
|
|
3236
3250
|
ignoreUrls: t.ignoreUrls
|
|
3237
|
-
}).enable(), new oo().enable(),
|
|
3251
|
+
}).enable(), new oo().enable(), Xo(() => i.forceFlush()), {
|
|
3238
3252
|
shutdown: async () => {
|
|
3239
3253
|
try {
|
|
3240
3254
|
await lo(i.shutdown(), 1e4, "browser shutdown");
|
|
@@ -3251,6 +3265,6 @@ function Jo(e) {
|
|
|
3251
3265
|
}
|
|
3252
3266
|
};
|
|
3253
3267
|
}
|
|
3254
|
-
export {
|
|
3268
|
+
export { Qo as initializeTelemetryBrowser };
|
|
3255
3269
|
|
|
3256
|
-
//# sourceMappingURL=browser-
|
|
3270
|
+
//# sourceMappingURL=browser-DnbodHv5.js.map
|