@theoremjs/studio 0.3.4-next.548.gbb156b2 → 0.3.4-next.554.g84e62b0
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/README.md +54 -14
- package/agreement.js +22 -7
- package/compile.js +3 -1
- package/cookbooks/catalog.d.ts +18 -0
- package/cookbooks/catalog.js +84 -8
- package/cookbooks/mod.d.ts +1 -1
- package/draft.d.ts +2 -0
- package/mod.d.ts +1 -1
- package/package.json +4 -4
- package/page/assets/Banner-CypKeoPt.js +2 -0
- package/page/assets/BottomSheet-Dbh6A5Vl.js +1 -0
- package/page/assets/{Card-Ghe4ozhC.js → Card-DruykyeB.js} +1 -1
- package/page/assets/CheckboxInput-CFZ_Wq8-.js +2 -0
- package/page/assets/CodeBlock-CfVOtDeO.js +52 -0
- package/page/assets/CollapsibleGroup-FIawJRo4.js +1 -0
- package/page/assets/ConsoleFrame-o1h8eHpY.js +3 -0
- package/page/assets/ContextMenu-XBM6rqqH.js +2 -0
- package/page/assets/DateInput-B1ICJtHn.js +1 -0
- package/page/assets/{Dialog-BDUExlk_.js → Dialog-Sd04KQS2.js} +1 -1
- package/page/assets/EmptyState-C_uF9Wyj.js +1 -0
- package/page/assets/HoverCard-DMyWUvwP.js +1 -0
- package/page/assets/Icon-BqkS-pIq.js +3 -0
- package/page/assets/IconButton-DVUFx-8p.js +1 -0
- package/page/assets/ListItem-QF7KFt0h.js +1 -0
- package/page/assets/MenuBottomSheet-DB7k7yMt.js +1 -0
- package/page/assets/MenuBottomSheetActionList-3L0HS4Kf.js +1 -0
- package/page/assets/SchemaFields-DthGCSIM.js +1 -0
- package/page/assets/ScrollableArea-BHfY7sWH.js +1 -0
- package/page/assets/SegmentedControlItem-BBGRPrxp.js +1 -0
- package/page/assets/{Text-BsiAsowd.js → Text-BOqCfzZC.js} +2 -2
- package/page/assets/{TimestampHoverCard-CCnmnVlQ.js → TimestampHoverCard-CDCVpEWM.js} +1 -1
- package/page/assets/{ToolResultCharts-DQc5tTgc.js → ToolResultCharts-DG2VPRGs.js} +1 -1
- package/page/assets/Tooltip-BWs5DLrM.js +1 -0
- package/page/assets/TraceInspector-CSlGFNuh.js +1 -0
- package/page/assets/{TraceOverview-DqhP_wzg.js → TraceOverview-Ck6C_Ez_.js} +2 -2
- package/page/assets/{_virtual_studio-type-sources-CvOETQ24.js → _virtual_studio-type-sources-CxP3L28S.js} +139 -77
- package/page/assets/browser-engine-D6JZkPvV.js +11 -0
- package/page/assets/browser-transport-Dap3OD5q.js +47 -0
- package/page/assets/{crypto-Dd6XxhqK.js → crypto-CrMpJY2D.js} +1 -1
- package/page/assets/{embedding-space-view-BU2AjjAx.js → embedding-space-view-CN0VHXXH.js} +1 -1
- package/page/assets/{encode-files-CiyHxnUC.js → encode-files-BCf3-Q7y.js} +1 -1
- package/page/assets/{export-agent-D-Rj6FQy.js → export-agent-BOvhPd_f.js} +1 -1
- package/page/assets/fieldParts-B7DYLgh4.js +1 -0
- package/page/assets/focusableSelector-DXZeMU85.js +1 -0
- package/page/assets/{guardrail-tester-lZGPnEIR.js → guardrail-tester-DfZ1mIDQ.js} +2 -2
- package/page/assets/index-CM9UyI8f.js +146 -0
- package/page/assets/isRenderable-DHkzpAoQ.js +1 -0
- package/page/assets/{labels-provider-BObUoNKa.js → labels-provider-DkA22zkP.js} +1 -1
- package/page/assets/{live-messages-DuLSkEdL.js → live-messages-D1DPu8uD.js} +1 -1
- package/page/assets/plainDate-BHiJcj7o.js +1 -0
- package/page/assets/reader-BJZH_Cmn.js +7 -0
- package/page/assets/{shaped-data-DYOBdvLJ.js → shaped-data-AVV4e7rW.js} +1 -1
- package/page/assets/{stub-kLwOLu-h.js → stub-BMUhx6B5.js} +1 -1
- package/page/assets/studio-code-pane-CcvVwTrU.js +8 -0
- package/page/assets/{studio-console-DgsrR6Qy.js → studio-console-CT4dvZQc.js} +1 -1
- package/page/assets/studio-decision-CJKqP0sE.js +1 -0
- package/page/assets/studio-embedding-CmY144a3.js +2 -0
- package/page/assets/studio-host-console-E4-8fIww.js +2 -0
- package/page/assets/studio-labels-dSptB7mq.js +3 -0
- package/page/assets/studio-live-BH4AubX8.js +5 -0
- package/page/assets/{studio-map-D7QZ6RAm.js → studio-map-DIm07L5J.js} +1 -1
- package/page/assets/{studio-trace-replay-BSts3p2O.js → studio-trace-replay-C5Wa5BcR.js} +2 -2
- package/page/assets/{studio-type-checker-BNljIXdE.js → studio-type-checker-B_CHmWnf.js} +1 -1
- package/page/assets/{tool-schema--CLE7o0H.js → tool-schema-DCF2M0n_.js} +6 -6
- package/page/assets/{trace-patterns-CS99kExN.js → trace-patterns-D6TbkLLr.js} +1 -1
- package/page/assets/{trace-record-B2MF8flo.js → trace-record-Dtrz7WQ7.js} +1 -1
- package/page/assets/tree-Cy9xwG_l.js +3 -0
- package/page/assets/{turn-client-DXtNeRHG.js → turn-client-mCvAwEgO.js} +1 -1
- package/page/assets/types-CB42MysU.js +1 -0
- package/page/assets/{use-one-call-TAgOAnMo.js → use-one-call-t6S5-SaV.js} +1 -1
- package/page/assets/use-second-ticker-GWBt83pd.css +1 -0
- package/page/assets/use-trace-records-B1vrKQmA.js +1 -0
- package/page/assets/useAdaptivePresentation-Bma4-u1a.js +1 -0
- package/page/assets/useAnnounce-DTSHZvjg.js +1 -0
- package/page/assets/useClipboard-CbN9bb4J.js +1 -0
- package/page/assets/useDevWarning-Z9SoixOP.js +1 -0
- package/page/assets/useFocusReturnVisibility-BHKv5Jwr.js +1 -0
- package/page/assets/useMenuPress-DLG1QOiE.js +1 -0
- package/page/assets/useResolvedRequired-DbsOcDqy.js +1 -0
- package/page/assets/useScrollableArea-DuF_pz9m.js +1 -0
- package/page/assets/useTooltip-c097gL_-.js +1 -0
- package/page/assets/{workspace-Cb6PICiw.js → workspace-BFrc6kx2.js} +1 -1
- package/page/index.html +48 -41
- package/read-source.js +5 -4
- package/read-studio.mjs +99 -0
- package/requirements.d.ts +3 -0
- package/requirements.js +10 -0
- package/server/alerts.d.ts +23 -0
- package/server/alerts.js +82 -0
- package/server/draft-handler.d.ts +3 -0
- package/server/draft-handler.js +5 -1
- package/server/events.d.ts +38 -0
- package/server/events.js +95 -0
- package/server/handler.d.ts +11 -3
- package/server/handler.js +64 -8
- package/server/project-source.d.ts +6 -3
- package/server/project-source.js +45 -4
- package/server/project.js +25 -3
- package/server/save-session.d.ts +2 -0
- package/server/save-session.js +7 -1
- package/server/serve.d.ts +1 -1
- package/server/serve.js +174 -18
- package/server/test-key.d.ts +19 -2
- package/server/test-key.js +51 -74
- package/server/watch.d.ts +8 -0
- package/server/watch.js +16 -5
- package/start.mjs +95 -5
- package/ui/built/theme.css +2 -2
- package/ui/built/theme.css.d.ts +2 -2
- package/ui/built/theorem-studio.d.ts +2 -2
- package/ui/built/theorem-studio.js +3 -3
- package/ui/built/theorem-studio.variants.d.ts +2 -2
- package/ui/lib/page-errors.d.ts +13 -0
- package/ui/lib/page-errors.js +31 -0
- package/ui/profile-editor.js +1 -1
- package/ui/studio-runner.d.ts +1 -1
- package/ui/studio-runner.js +7 -3
- package/ui/studio-screen.js +23 -11
- package/page/assets/Banner-BP1TXM0J.js +0 -2
- package/page/assets/BottomSheet-BQPskY35.js +0 -1
- package/page/assets/CheckboxInput-C9kbVyhK.js +0 -2
- package/page/assets/CodeBlock-Kjgv83A6.js +0 -52
- package/page/assets/CollapsibleGroup-Bfnp4Aaz.js +0 -1
- package/page/assets/ConsoleFrame-Da49DUMV.js +0 -3
- package/page/assets/ContextMenu-DGeuOuIz.js +0 -2
- package/page/assets/DateInput-BJt-UTCy.js +0 -1
- package/page/assets/EmptyState-C8W4JKBZ.js +0 -1
- package/page/assets/HoverCard-C6thuzrf.js +0 -1
- package/page/assets/Icon-ZfFwTt8n.js +0 -3
- package/page/assets/IconButton-CG5klqF1.js +0 -1
- package/page/assets/ScrollableArea-C8AVuqnt.js +0 -1
- package/page/assets/Section-DJ97F7QE.js +0 -1
- package/page/assets/SegmentedControlItem-BLuJOusN.js +0 -1
- package/page/assets/Tooltip-CTEuMRLe.js +0 -1
- package/page/assets/TraceInspector-Cn7_V-2C.js +0 -1
- package/page/assets/browser-engine-BUuO2-Ve.js +0 -11
- package/page/assets/browser-transport-FDq0Q4Fx.js +0 -47
- package/page/assets/fieldParts-Cs6Amprh.js +0 -1
- package/page/assets/index-Bk_jhM4_.js +0 -145
- package/page/assets/reader-DJB6MzQf.js +0 -7
- package/page/assets/studio-code-pane-D7R84b_Y.js +0 -8
- package/page/assets/studio-decision-uyaB9Oo3.js +0 -1
- package/page/assets/studio-embedding-tRaNKz_n.js +0 -2
- package/page/assets/studio-host-console-DzpUuYer.js +0 -2
- package/page/assets/studio-labels-CByQ2z3Y.js +0 -3
- package/page/assets/studio-live-CWeuAs3g.js +0 -5
- package/page/assets/tree-CDqNZ8w-.js +0 -3
- package/page/assets/types-DTbqRZ5l.js +0 -1
- package/page/assets/use-second-ticker-CnxaP3LD.css +0 -1
- package/page/assets/use-trace-records-CZNBjTS0.js +0 -1
- package/page/assets/useAdaptivePresentation-BY_zvjIp.js +0 -1
- package/page/assets/useClipboard-B1amtN2V.js +0 -1
- package/page/assets/useDevWarning-Cna3kqg1.js +0 -1
- package/page/assets/useScrollableArea-vxuztwym.js +0 -1
- package/page/assets/useTooltip-rxACYEAC.js +0 -1
- /package/page/assets/{use-second-ticker-VX91zrxj.js → use-second-ticker-DhbZ0Soz.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){return e!=null&&typeof e!=`boolean`&&e!==``}export{e as t};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,u as n}from"./themeProps-3IqahpCr.js";import{C as r,S as i,x as a}from"./Icon-ZfFwTt8n.js";var o=e(n(),1);function s(e){try{let t=new Intl.Locale(e);return(typeof t.getTextInfo==`function`?t.getTextInfo():t.textInfo)?.direction===`rtl`?`rtl`:`ltr`}catch{return`ltr`}}var c=t();function l(e){return Object.values(e).some(e=>Object.values(e).some(e=>typeof e==`string`))?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,Object.fromEntries(Object.entries(t).map(([e,t])=>[e,typeof t==`string`?{defaultMessage:t}:t]))])):e}function u({locale:e,messages:t,overrides:n,dir:a,children:u}){let d=a??s(e),f=(0,o.useMemo)(()=>{let i=t??{};return{locale:e,direction:d,messages:l(i),overrides:n,translate:r(e,i,n)}},[e,d,t,n]);return(0,c.jsx)(i,{value:f,children:u})}u.displayName=`InternationalizationProvider`;function d(e,t){let n=t&&t.cache?t.cache:ae,r=t&&t.serializer?t.serializer:re;return(t&&t.strategy?t.strategy:ee)(e,{cache:n,serializer:r})}function f(e){return e==null||typeof e==`number`||typeof e==`boolean`}function p(e,t,n,r){let i=f(r)?r:n(r),a=t.get(i);return a===void 0&&(a=e.call(this,r),t.set(i,a)),a}function m(e,t,n){let r=Array.prototype.slice.call(arguments,3),i=n(r),a=t.get(i);return a===void 0&&(a=e.apply(this,r),t.set(i,a)),a}function h(e,t,n,r,i){return n.bind(t,e,r,i)}function ee(e,t){let n=e.length===1?p:m;return h(e,this,n,t.cache.create(),t.serializer)}function te(e,t){return h(e,this,m,t.cache.create(),t.serializer)}function ne(e,t){return h(e,this,p,t.cache.create(),t.serializer)}var re=function(){return JSON.stringify(arguments)},ie=class{constructor(){this.cache=Object.create(null)}get(e){return this.cache[e]}set(e,t){this.cache[e]=t}},ae={create:function(){return new ie}},g={variadic:te,monadic:ne},oe=/(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;function se(e){let t={};return e.replace(oe,e=>{let n=e.length;switch(e[0]){case`G`:t.era=n===4?`long`:n===5?`narrow`:`short`;break;case`y`:t.year=n===2?`2-digit`:`numeric`;break;case`Y`:case`u`:case`U`:case`r`:throw RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");case`q`:case`Q`:throw RangeError("`q/Q` (quarter) patterns are not supported");case`M`:case`L`:t.month=[`numeric`,`2-digit`,`short`,`long`,`narrow`][n-1];break;case`w`:case`W`:throw RangeError("`w/W` (week) patterns are not supported");case`d`:t.day=[`numeric`,`2-digit`][n-1];break;case`D`:case`F`:case`g`:throw RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");case`E`:t.weekday=n===4?`long`:n===5?`narrow`:`short`;break;case`e`:if(n<4)throw RangeError("`e..eee` (weekday) patterns are not supported");t.weekday=[`short`,`long`,`narrow`,`short`][n-3];break;case`c`:if(n<4)throw RangeError("`c..ccc` (weekday) patterns are not supported");t.weekday=[`short`,`long`,`narrow`,`short`][n-3];break;case`a`:t.hour12=!0;break;case`b`:case`B`:throw RangeError("`b/B` (period) patterns are not supported, use `a` instead");case`h`:t.hourCycle=`h12`,t.hour=[`numeric`,`2-digit`][n-1];break;case`H`:t.hourCycle=`h23`,t.hour=[`numeric`,`2-digit`][n-1];break;case`K`:t.hourCycle=`h11`,t.hour=[`numeric`,`2-digit`][n-1];break;case`k`:t.hourCycle=`h24`,t.hour=[`numeric`,`2-digit`][n-1];break;case`j`:case`J`:case`C`:throw RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");case`m`:t.minute=[`numeric`,`2-digit`][n-1];break;case`s`:t.second=[`numeric`,`2-digit`][n-1];break;case`S`:case`A`:throw RangeError("`S/A` (second) patterns are not supported, use `s` instead");case`z`:t.timeZoneName=n<4?`short`:`long`;break;case`Z`:case`O`:case`v`:case`V`:case`X`:case`x`:throw RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead")}return``}),t}var ce=/[\t-\r \x85\u200E\u200F\u2028\u2029]/i;function le(e){if(e.length===0)throw Error(`Number skeleton cannot be empty`);let t=e.split(ce).filter(e=>e.length>0),n=[];for(let e of t){let t=e.split(`/`);if(t.length===0)throw Error(`Invalid number skeleton`);let[r,...i]=t;for(let e of i)if(e.length===0)throw Error(`Invalid number skeleton`);n.push({stem:r,options:i})}return n}function ue(e){return e.replace(/^(.*?)-/,``)}var _=/^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g,v=/^(@+)?(\+|#+)?[rs]?$/g,de=/(\*)(0+)|(#+)(0+)|(0+)/g,y=/^(0+)$/;function b(e){let t={};return e[e.length-1]===`r`?t.roundingPriority=`morePrecision`:e[e.length-1]===`s`&&(t.roundingPriority=`lessPrecision`),e.replace(v,function(e,n,r){return typeof r==`string`?r===`+`?t.minimumSignificantDigits=n.length:n[0]===`#`?t.maximumSignificantDigits=n.length:(t.minimumSignificantDigits=n.length,t.maximumSignificantDigits=n.length+(typeof r==`string`?r.length:0)):(t.minimumSignificantDigits=n.length,t.maximumSignificantDigits=n.length),``}),t}function x(e){switch(e){case`sign-auto`:return{signDisplay:`auto`};case`sign-accounting`:case`()`:return{currencySign:`accounting`};case`sign-always`:case`+!`:return{signDisplay:`always`};case`sign-accounting-always`:case`()!`:return{signDisplay:`always`,currencySign:`accounting`};case`sign-except-zero`:case`+?`:return{signDisplay:`exceptZero`};case`sign-accounting-except-zero`:case`()?`:return{signDisplay:`exceptZero`,currencySign:`accounting`};case`sign-never`:case`+_`:return{signDisplay:`never`}}}function fe(e){let t;if(e[0]===`E`&&e[1]===`E`?(t={notation:`engineering`},e=e.slice(2)):e[0]===`E`&&(t={notation:`scientific`},e=e.slice(1)),t){let n=e.slice(0,2);if(n===`+!`?(t.signDisplay=`always`,e=e.slice(2)):n===`+?`&&(t.signDisplay=`exceptZero`,e=e.slice(2)),!y.test(e))throw Error(`Malformed concise eng/scientific notation`);t.minimumIntegerDigits=e.length}return t}function S(e){return x(e)||{}}function pe(e){let t={};for(let n of e){switch(n.stem){case`percent`:case`%`:t.style=`percent`;continue;case`%x100`:t.style=`percent`,t.scale=100;continue;case`currency`:t.style=`currency`,t.currency=n.options[0];continue;case`group-off`:case`,_`:t.useGrouping=!1;continue;case`precision-integer`:case`.`:t.maximumFractionDigits=0;continue;case`measure-unit`:case`unit`:t.style=`unit`,t.unit=ue(n.options[0]);continue;case`compact-short`:case`K`:t.notation=`compact`,t.compactDisplay=`short`;continue;case`compact-long`:case`KK`:t.notation=`compact`,t.compactDisplay=`long`;continue;case`scientific`:t={...t,notation:`scientific`,...n.options.reduce((e,t)=>({...e,...S(t)}),{})};continue;case`engineering`:t={...t,notation:`engineering`,...n.options.reduce((e,t)=>({...e,...S(t)}),{})};continue;case`notation-simple`:t.notation=`standard`;continue;case`unit-width-narrow`:t.currencyDisplay=`narrowSymbol`,t.unitDisplay=`narrow`;continue;case`unit-width-short`:t.currencyDisplay=`code`,t.unitDisplay=`short`;continue;case`unit-width-full-name`:t.currencyDisplay=`name`,t.unitDisplay=`long`;continue;case`unit-width-iso-code`:t.currencyDisplay=`symbol`;continue;case`scale`:t.scale=parseFloat(n.options[0]);continue;case`rounding-mode-floor`:t.roundingMode=`floor`;continue;case`rounding-mode-ceiling`:t.roundingMode=`ceil`;continue;case`rounding-mode-down`:t.roundingMode=`trunc`;continue;case`rounding-mode-up`:t.roundingMode=`expand`;continue;case`rounding-mode-half-even`:t.roundingMode=`halfEven`;continue;case`rounding-mode-half-down`:t.roundingMode=`halfTrunc`;continue;case`rounding-mode-half-up`:t.roundingMode=`halfExpand`;continue;case`integer-width`:if(n.options.length>1)throw RangeError(`integer-width stems only accept a single optional option`);n.options[0].replace(de,function(e,n,r,i,a,o){if(n)t.minimumIntegerDigits=r.length;else if(i&&a)throw Error(`We currently do not support maximum integer digits`);else if(o)throw Error(`We currently do not support exact integer digits`);return``});continue}if(y.test(n.stem)){t.minimumIntegerDigits=n.stem.length;continue}if(_.test(n.stem)){if(n.options.length>1)throw RangeError(`Fraction-precision stems only accept a single optional option`);n.stem.replace(_,function(e,n,r,i,a,o){return r===`*`?t.minimumFractionDigits=n.length:i&&i[0]===`#`?t.maximumFractionDigits=i.length:a&&o?(t.minimumFractionDigits=a.length,t.maximumFractionDigits=a.length+o.length):(t.minimumFractionDigits=n.length,t.maximumFractionDigits=n.length),``});let e=n.options[0];e===`w`?t={...t,trailingZeroDisplay:`stripIfInteger`}:e&&(t={...t,...b(e)});continue}if(v.test(n.stem)){t={...t,...b(n.stem)};continue}let e=x(n.stem);e&&(t={...t,...e});let r=fe(n.stem);r&&(t={...t,...r})}return t}var me=function(e){return e[e.EXPECT_ARGUMENT_CLOSING_BRACE=1]=`EXPECT_ARGUMENT_CLOSING_BRACE`,e[e.EMPTY_ARGUMENT=2]=`EMPTY_ARGUMENT`,e[e.MALFORMED_ARGUMENT=3]=`MALFORMED_ARGUMENT`,e[e.EXPECT_ARGUMENT_TYPE=4]=`EXPECT_ARGUMENT_TYPE`,e[e.INVALID_ARGUMENT_TYPE=5]=`INVALID_ARGUMENT_TYPE`,e[e.EXPECT_ARGUMENT_STYLE=6]=`EXPECT_ARGUMENT_STYLE`,e[e.INVALID_NUMBER_SKELETON=7]=`INVALID_NUMBER_SKELETON`,e[e.INVALID_DATE_TIME_SKELETON=8]=`INVALID_DATE_TIME_SKELETON`,e[e.EXPECT_NUMBER_SKELETON=9]=`EXPECT_NUMBER_SKELETON`,e[e.EXPECT_DATE_TIME_SKELETON=10]=`EXPECT_DATE_TIME_SKELETON`,e[e.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE=11]=`UNCLOSED_QUOTE_IN_ARGUMENT_STYLE`,e[e.EXPECT_SELECT_ARGUMENT_OPTIONS=12]=`EXPECT_SELECT_ARGUMENT_OPTIONS`,e[e.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE=13]=`EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE`,e[e.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE=14]=`INVALID_PLURAL_ARGUMENT_OFFSET_VALUE`,e[e.EXPECT_SELECT_ARGUMENT_SELECTOR=15]=`EXPECT_SELECT_ARGUMENT_SELECTOR`,e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR=16]=`EXPECT_PLURAL_ARGUMENT_SELECTOR`,e[e.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT=17]=`EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT`,e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT=18]=`EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT`,e[e.INVALID_PLURAL_ARGUMENT_SELECTOR=19]=`INVALID_PLURAL_ARGUMENT_SELECTOR`,e[e.DUPLICATE_PLURAL_ARGUMENT_SELECTOR=20]=`DUPLICATE_PLURAL_ARGUMENT_SELECTOR`,e[e.DUPLICATE_SELECT_ARGUMENT_SELECTOR=21]=`DUPLICATE_SELECT_ARGUMENT_SELECTOR`,e[e.MISSING_OTHER_CLAUSE=22]=`MISSING_OTHER_CLAUSE`,e[e.INVALID_TAG=23]=`INVALID_TAG`,e[e.INVALID_TAG_NAME=25]=`INVALID_TAG_NAME`,e[e.UNMATCHED_CLOSING_TAG=26]=`UNMATCHED_CLOSING_TAG`,e[e.UNCLOSED_TAG=27]=`UNCLOSED_TAG`,e}({});function C(e){return e.type===0}function he(e){return e.type===1}function w(e){return e.type===2}function T(e){return e.type===3}function E(e){return e.type===4}function D(e){return e.type===5}function O(e){return e.type===6}function ge(e){return e.type===7}function k(e){return e.type===8}function A(e){return!!(e&&typeof e==`object`&&e.type===0)}function j(e){return!!(e&&typeof e==`object`&&e.type===1)}var M=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/,N={"001":[`H`,`h`],419:[`h`,`H`,`hB`,`hb`],AC:[`H`,`h`,`hb`,`hB`],AD:[`H`,`hB`],AE:[`h`,`hB`,`hb`,`H`],AF:[`H`,`hb`,`hB`,`h`],AG:[`h`,`hb`,`H`,`hB`],AI:[`H`,`h`,`hb`,`hB`],AL:[`h`,`H`,`hB`],AM:[`H`,`hB`],AO:[`H`,`hB`],AR:[`h`,`H`,`hB`,`hb`],AS:[`h`,`H`],AT:[`H`,`hB`],AU:[`h`,`hb`,`H`,`hB`],AW:[`H`,`hB`],AX:[`H`],AZ:[`H`,`hB`,`h`],BA:[`H`,`hB`,`h`],BB:[`h`,`hb`,`H`,`hB`],BD:[`h`,`hB`,`H`],BE:[`H`,`hB`],BF:[`H`,`hB`],BG:[`H`,`hB`,`h`],BH:[`h`,`hB`,`hb`,`H`],BI:[`H`,`h`],BJ:[`H`,`hB`],BL:[`H`,`hB`],BM:[`h`,`hb`,`H`,`hB`],BN:[`hb`,`hB`,`h`,`H`],BO:[`h`,`H`,`hB`,`hb`],BQ:[`H`],BR:[`H`,`hB`],BS:[`h`,`hb`,`H`,`hB`],BT:[`h`,`H`],BW:[`H`,`h`,`hb`,`hB`],BY:[`H`,`h`],BZ:[`H`,`h`,`hb`,`hB`],CA:[`h`,`hb`,`H`,`hB`],CC:[`H`,`h`,`hb`,`hB`],CD:[`hB`,`H`],CF:[`H`,`h`,`hB`],CG:[`H`,`hB`],CH:[`H`,`hB`,`h`],CI:[`H`,`hB`],CK:[`H`,`h`,`hb`,`hB`],CL:[`h`,`H`,`hB`,`hb`],CM:[`H`,`h`,`hB`],CN:[`H`,`hB`,`hb`,`h`],CO:[`h`,`H`,`hB`,`hb`],CP:[`H`],CR:[`h`,`H`,`hB`,`hb`],CU:[`h`,`H`,`hB`,`hb`],CV:[`H`,`hB`],CW:[`H`,`hB`],CX:[`H`,`h`,`hb`,`hB`],CY:[`h`,`H`,`hb`,`hB`],CZ:[`H`],DE:[`H`,`hB`],DG:[`H`,`h`,`hb`,`hB`],DJ:[`h`,`H`],DK:[`H`],DM:[`h`,`hb`,`H`,`hB`],DO:[`h`,`H`,`hB`,`hb`],DZ:[`h`,`hB`,`hb`,`H`],EA:[`H`,`h`,`hB`,`hb`],EC:[`h`,`H`,`hB`,`hb`],EE:[`H`,`hB`],EG:[`h`,`hB`,`hb`,`H`],EH:[`h`,`hB`,`hb`,`H`],ER:[`h`,`H`],ES:[`H`,`hB`,`h`,`hb`],ET:[`hB`,`hb`,`h`,`H`],FI:[`H`],FJ:[`h`,`hb`,`H`,`hB`],FK:[`H`,`h`,`hb`,`hB`],FM:[`h`,`hb`,`H`,`hB`],FO:[`H`,`h`],FR:[`H`,`hB`],GA:[`H`,`hB`],GB:[`H`,`h`,`hb`,`hB`],GD:[`h`,`hb`,`H`,`hB`],GE:[`H`,`hB`,`h`],GF:[`H`,`hB`],GG:[`H`,`h`,`hb`,`hB`],GH:[`h`,`H`],GI:[`H`,`h`,`hb`,`hB`],GL:[`H`,`h`],GM:[`h`,`hb`,`H`,`hB`],GN:[`H`,`hB`],GP:[`H`,`hB`],GQ:[`H`,`hB`,`h`,`hb`],GR:[`h`,`H`,`hb`,`hB`],GS:[`H`,`h`,`hb`,`hB`],GT:[`h`,`H`,`hB`,`hb`],GU:[`h`,`hb`,`H`,`hB`],GW:[`H`,`hB`],GY:[`h`,`hb`,`H`,`hB`],HK:[`h`,`hB`,`hb`,`H`],HN:[`h`,`H`,`hB`,`hb`],HR:[`H`,`hB`],HU:[`H`,`h`],IC:[`H`,`h`,`hB`,`hb`],ID:[`H`],IE:[`H`,`h`,`hb`,`hB`],IL:[`H`,`hB`],IM:[`H`,`h`,`hb`,`hB`],IN:[`h`,`H`],IO:[`H`,`h`,`hb`,`hB`],IQ:[`h`,`hB`,`hb`,`H`],IR:[`hB`,`H`],IS:[`H`],IT:[`H`,`hB`],JE:[`H`,`h`,`hb`,`hB`],JM:[`h`,`hb`,`H`,`hB`],JO:[`h`,`hB`,`hb`,`H`],JP:[`H`,`K`,`h`],KE:[`hB`,`hb`,`H`,`h`],KG:[`H`,`h`,`hB`,`hb`],KH:[`hB`,`h`,`H`,`hb`],KI:[`h`,`hb`,`H`,`hB`],KM:[`H`,`h`,`hB`,`hb`],KN:[`h`,`hb`,`H`,`hB`],KP:[`h`,`H`,`hB`,`hb`],KR:[`h`,`H`,`hB`,`hb`],KW:[`h`,`hB`,`hb`,`H`],KY:[`h`,`hb`,`H`,`hB`],KZ:[`H`,`hB`],LA:[`H`,`hb`,`hB`,`h`],LB:[`h`,`hB`,`hb`,`H`],LC:[`h`,`hb`,`H`,`hB`],LI:[`H`,`hB`,`h`],LK:[`H`,`h`,`hB`,`hb`],LR:[`h`,`hb`,`H`,`hB`],LS:[`h`,`H`],LT:[`H`,`h`,`hb`,`hB`],LU:[`H`,`h`,`hB`],LV:[`H`,`hB`,`hb`,`h`],LY:[`h`,`hB`,`hb`,`H`],MA:[`H`,`h`,`hB`,`hb`],MC:[`H`,`hB`],MD:[`H`,`hB`],ME:[`H`,`hB`,`h`],MF:[`H`,`hB`],MG:[`H`,`h`],MH:[`h`,`hb`,`H`,`hB`],MK:[`H`,`h`,`hb`,`hB`],ML:[`H`],MM:[`hB`,`hb`,`H`,`h`],MN:[`H`,`h`,`hb`,`hB`],MO:[`h`,`hB`,`hb`,`H`],MP:[`h`,`hb`,`H`,`hB`],MQ:[`H`,`hB`],MR:[`h`,`hB`,`hb`,`H`],MS:[`H`,`h`,`hb`,`hB`],MT:[`H`,`h`],MU:[`H`,`h`],MV:[`H`,`h`],MW:[`h`,`hb`,`H`,`hB`],MX:[`h`,`H`,`hB`,`hb`],MY:[`hb`,`hB`,`h`,`H`],MZ:[`H`,`hB`],NA:[`h`,`H`,`hB`,`hb`],NC:[`H`,`hB`],NE:[`H`],NF:[`H`,`h`,`hb`,`hB`],NG:[`H`,`h`,`hb`,`hB`],NI:[`h`,`H`,`hB`,`hb`],NL:[`H`,`hB`],NO:[`H`,`h`],NP:[`H`,`h`,`hB`],NR:[`H`,`h`,`hb`,`hB`],NU:[`H`,`h`,`hb`,`hB`],NZ:[`h`,`hb`,`H`,`hB`],OM:[`h`,`hB`,`hb`,`H`],PA:[`h`,`H`,`hB`,`hb`],PE:[`h`,`H`,`hB`,`hb`],PF:[`H`,`h`,`hB`],PG:[`h`,`H`],PH:[`h`,`hB`,`hb`,`H`],PK:[`h`,`hB`,`H`],PL:[`H`,`h`],PM:[`H`,`hB`],PN:[`H`,`h`,`hb`,`hB`],PR:[`h`,`H`,`hB`,`hb`],PS:[`h`,`hB`,`hb`,`H`],PT:[`H`,`hB`],PW:[`h`,`H`],PY:[`h`,`H`,`hB`,`hb`],QA:[`h`,`hB`,`hb`,`H`],RE:[`H`,`hB`],RO:[`H`,`hB`],RS:[`H`,`hB`,`h`],RU:[`H`],RW:[`H`,`h`],SA:[`h`,`hB`,`hb`,`H`],SB:[`h`,`hb`,`H`,`hB`],SC:[`H`,`h`,`hB`],SD:[`h`,`hB`,`hb`,`H`],SE:[`H`],SG:[`h`,`hb`,`H`,`hB`],SH:[`H`,`h`,`hb`,`hB`],SI:[`H`,`hB`],SJ:[`H`],SK:[`H`],SL:[`h`,`hb`,`H`,`hB`],SM:[`H`,`h`,`hB`],SN:[`H`,`h`,`hB`],SO:[`h`,`H`],SR:[`H`,`hB`],SS:[`h`,`hb`,`H`,`hB`],ST:[`H`,`hB`],SV:[`h`,`H`,`hB`,`hb`],SX:[`H`,`h`,`hb`,`hB`],SY:[`h`,`hB`,`hb`,`H`],SZ:[`h`,`hb`,`H`,`hB`],TA:[`H`,`h`,`hb`,`hB`],TC:[`h`,`hb`,`H`,`hB`],TD:[`h`,`H`,`hB`],TF:[`H`,`h`,`hB`],TG:[`H`,`hB`],TH:[`H`,`h`],TJ:[`H`,`h`],TL:[`H`,`hB`,`hb`,`h`],TM:[`H`,`h`],TN:[`h`,`hB`,`hb`,`H`],TO:[`h`,`H`],TR:[`H`,`hB`],TT:[`h`,`hb`,`H`,`hB`],TW:[`hB`,`hb`,`h`,`H`],TZ:[`hB`,`hb`,`H`,`h`],UA:[`H`,`hB`,`h`],UG:[`hB`,`hb`,`H`,`h`],UM:[`h`,`hb`,`H`,`hB`],US:[`h`,`hb`,`H`,`hB`],UY:[`h`,`H`,`hB`,`hb`],UZ:[`H`,`hB`,`h`],VA:[`H`,`h`,`hB`],VC:[`h`,`hb`,`H`,`hB`],VE:[`h`,`H`,`hB`,`hb`],VG:[`h`,`hb`,`H`,`hB`],VI:[`h`,`hb`,`H`,`hB`],VN:[`H`,`h`],VU:[`h`,`H`],WF:[`H`,`hB`],WS:[`h`,`H`],XK:[`H`,`hB`,`h`],YE:[`h`,`hB`,`hb`,`H`],YT:[`H`,`hB`],ZA:[`H`,`h`,`hb`,`hB`],ZM:[`h`,`hb`,`H`,`hB`],ZW:[`H`,`h`],"af-ZA":[`H`,`h`,`hB`,`hb`],"ar-001":[`h`,`hB`,`hb`,`H`],"ca-ES":[`H`,`h`,`hB`],"en-001":[`h`,`hb`,`H`,`hB`],"en-HK":[`h`,`hb`,`H`,`hB`],"en-IL":[`H`,`h`,`hb`,`hB`],"en-MY":[`h`,`hb`,`H`,`hB`],"es-BR":[`H`,`h`,`hB`,`hb`],"es-ES":[`H`,`h`,`hB`,`hb`],"es-GQ":[`H`,`h`,`hB`,`hb`],"fr-CA":[`H`,`h`,`hB`],"gl-ES":[`H`,`h`,`hB`],"gu-IN":[`hB`,`hb`,`h`,`H`],"hi-IN":[`hB`,`h`,`H`],"it-CH":[`H`,`h`,`hB`],"it-IT":[`H`,`h`,`hB`],"kn-IN":[`hB`,`h`,`H`],"ku-SY":[`H`,`hB`],"ml-IN":[`hB`,`h`,`H`],"mr-IN":[`hB`,`hb`,`h`,`H`],"pa-IN":[`hB`,`hb`,`h`,`H`],"ta-IN":[`hB`,`h`,`hb`,`H`],"te-IN":[`hB`,`h`,`H`],"zu-ZA":[`H`,`hB`,`hb`,`h`]};function P(e,t){let n=``;for(let r=0;r<e.length;r++){let i=e.charAt(r);if(i===`j`){let a=0;for(;r+1<e.length&&e.charAt(r+1)===i;)a++,r++;let o=1+(a&1),s=a<2?1:3+(a>>1),c=F(t);for((c==`H`||c==`k`)&&(s=0);s-->0;)n+=`a`;for(;o-->0;)n=c+n}else n+=i===`J`?`H`:i}return n}function F(e){let t=e.hourCycle;if(t===void 0){let n=e;t=n.getHourCycles?.()[0]??n.hourCycles?.[0]}if(t)switch(t){case`h24`:return`k`;case`h23`:return`H`;case`h12`:return`h`;case`h11`:return`K`;default:throw Error(`Invalid hourCycle`)}let n=e.language,r;return n!==`root`&&(r=e.maximize().region),(N[`${n}-${r}`]||N[r||``]||N[n||``]||N[`${n}-001`]||N[`001`])[0].charAt(0)}var I=RegExp(`^${M.source}*`),L=RegExp(`${M.source}*$`);function R(e,t){return{start:e,end:t}}var _e=!!Object.fromEntries,ve=!!String.prototype.trimStart,ye=!!String.prototype.trimEnd,z=_e?Object.fromEntries:function(e){let t={};for(let[n,r]of e)t[n]=r;return t},be=ve?function(e){return e.trimStart()}:function(e){return e.replace(I,``)},xe=ye?function(e){return e.trimEnd()}:function(e){return e.replace(L,``)},B=RegExp(`([^\\p{White_Space}\\p{Pattern_Syntax}]*)`,`yu`);function Se(e,t){return B.lastIndex=t,B.exec(e)[1]??``}function Ce(e){if(e.length===0)return null;let t=1,n=1;for(let r=0;r<e.length;){let i=e.charCodeAt(r);switch(i){case 35:case 39:case 60:case 123:case 125:return null}if(i===10)t++,n=1,r++;else if(n++,i>=55296&&i<=56319&&r+1<e.length){let t=e.charCodeAt(r+1);r+=t>=56320&&t<=57343?2:1}else r++}return{offset:e.length,line:t,column:n}}var we=class{constructor(e,t={}){this.message=e,this.position={offset:0,line:1,column:1},this.ignoreTag=!!t.ignoreTag,this.locale=t.locale,this.requiresOtherClause=!!t.requiresOtherClause,this.shouldParseSkeletons=!!t.shouldParseSkeletons}parse(){if(this.offset()!==0)throw Error(`parser can only be used once`);if(this.message.length>0){let e=this.message.charCodeAt(0);if(e!==35&&e!==39&&e!==60&&e!==123&&e!==125){let e=Ce(this.message);if(e){let t=this.clonePosition();return this.position=e,{val:[{type:0,value:this.message,location:R(t,this.clonePosition())}],err:null}}}}return this.parseMessage(0,``,!1)}parseMessage(e,t,n){let r=[];for(;!this.isEOF();){let i=this.char();if(i===123){let t=this.parseArgument(e,n);if(t.err)return t;r.push(t.val)}else if(i===125&&e>0)break;else if(i===35&&(t===`plural`||t===`selectordinal`)){let e=this.clonePosition();this.bump(),r.push({type:7,location:R(e,this.clonePosition())})}else if(i===60&&!this.ignoreTag&&this.peek()===47){if(n)break;return this.error(26,R(this.clonePosition(),this.clonePosition()))}else if(i===60&&!this.ignoreTag&&V(this.peek()||0)){let n=this.parseTag(e,t);if(n.err)return n;r.push(n.val)}else{let n=this.parseLiteral(e,t);if(n.err)return n;r.push(n.val)}}return{val:r,err:null}}parseTag(e,t){let n=this.clonePosition();this.bump();let r=this.parseTagName();if(this.bumpSpace(),this.bumpIf(`/>`))return{val:{type:0,value:`<${r}/>`,location:R(n,this.clonePosition())},err:null};if(this.bumpIf(`>`)){let i=this.parseMessage(e+1,t,!0);if(i.err)return i;let a=i.val,o=this.clonePosition();if(this.bumpIf(`</`)){if(this.isEOF()||!V(this.char()))return this.error(23,R(o,this.clonePosition()));let e=this.clonePosition();return r===this.parseTagName()?(this.bumpSpace(),this.bumpIf(`>`)?{val:{type:8,value:r,children:a,location:R(n,this.clonePosition())},err:null}:this.error(23,R(o,this.clonePosition()))):this.error(26,R(e,this.clonePosition()))}return this.error(27,R(n,this.clonePosition()))}return this.error(23,R(n,this.clonePosition()))}parseTagName(){let e=this.offset();for(this.bump();!this.isEOF()&&Ee(this.char());)this.bump();return this.message.slice(e,this.offset())}parseLiteral(e,t){let n=this.clonePosition(),r=``;for(;;){let n=this.tryParseQuote(t);if(n){r+=n;continue}let i=this.tryParseUnquoted(e,t);if(i){r+=i;continue}let a=this.tryParseLeftAngleBracket();if(a)r+=a;else break}let i=R(n,this.clonePosition());return{val:{type:0,value:r,location:i},err:null}}tryParseLeftAngleBracket(){return!this.isEOF()&&this.char()===60&&(this.ignoreTag||!Te(this.peek()||0))?(this.bump(),`<`):null}tryParseQuote(e){if(this.isEOF()||this.char()!==39)return null;switch(this.peek()){case 39:return this.bump(),this.bump(),`'`;case 123:case 60:case 62:case 125:break;case 35:if(e===`plural`||e===`selectordinal`)break;return null;default:return null}this.bump();let t=[this.char()];for(this.bump();!this.isEOF();){let e=this.char();if(e===39){if(this.peek()===39)t.push(39),this.bump();else{this.bump();break}}else t.push(e);this.bump()}return String.fromCodePoint(...t)}tryParseUnquoted(e,t){if(this.isEOF())return null;let n=this.char();return n===60||n===123||n===35&&(t===`plural`||t===`selectordinal`)||n===125&&e>0?null:(this.bump(),String.fromCodePoint(n))}parseArgument(e,t){let n=this.clonePosition();if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(1,R(n,this.clonePosition()));if(this.char()===125)return this.bump(),this.error(2,R(n,this.clonePosition()));let r=this.parseIdentifierIfPossible().value;if(!r)return this.error(3,R(n,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(1,R(n,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:1,value:r,location:R(n,this.clonePosition())},err:null};case 44:return this.bump(),this.bumpSpace(),this.isEOF()?this.error(1,R(n,this.clonePosition())):this.parseArgumentOptions(e,t,r,n);default:return this.error(3,R(n,this.clonePosition()))}}parseIdentifierIfPossible(){let e=this.clonePosition(),t=this.offset(),n=Se(this.message,t),r=t+n.length;return this.bumpTo(r),{value:n,location:R(e,this.clonePosition())}}parseArgumentOptions(e,t,n,r){let i=this.clonePosition(),a=this.parseIdentifierIfPossible().value,o=this.clonePosition();switch(a){case``:return this.error(4,R(i,o));case`number`:case`date`:case`time`:{this.bumpSpace();let e=null;if(this.bumpIf(`,`)){this.bumpSpace();let t=this.clonePosition(),n=this.parseSimpleArgStyleIfPossible();if(n.err)return n;let r=xe(n.val);if(r.length===0)return this.error(6,R(this.clonePosition(),this.clonePosition()));e={style:r,styleLocation:R(t,this.clonePosition())}}let t=this.tryParseArgumentClose(r);if(t.err)return t;let i=R(r,this.clonePosition());if(e&&e.style.startsWith(`::`)){let t=be(e.style.slice(2));if(a===`number`){let r=this.parseNumberSkeletonFromString(t,e.styleLocation);return r.err?r:{val:{type:2,value:n,location:i,style:r.val},err:null}}{if(t.length===0)return this.error(10,i);let r=t;this.locale&&(r=P(t,this.locale));let o={type:1,pattern:r,location:e.styleLocation,parsedOptions:this.shouldParseSkeletons?se(r):{}};return{val:{type:a===`date`?3:4,value:n,location:i,style:o},err:null}}}return{val:{type:a===`number`?2:a===`date`?3:4,value:n,location:i,style:e?.style??null},err:null}}case`plural`:case`selectordinal`:case`select`:{let i=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(`,`))return this.error(12,R(i,{...i}));this.bumpSpace();let o=this.parseIdentifierIfPossible(),s=0;if(a!==`select`&&o.value===`offset`){if(!this.bumpIf(`:`))return this.error(13,R(this.clonePosition(),this.clonePosition()));this.bumpSpace();let e=this.tryParseDecimalInteger(13,14);if(e.err)return e;this.bumpSpace(),o=this.parseIdentifierIfPossible(),s=e.val}let c=this.tryParsePluralOrSelectOptions(e,a,t,o);if(c.err)return c;let l=this.tryParseArgumentClose(r);if(l.err)return l;let u=R(r,this.clonePosition());return a===`select`?{val:{type:5,value:n,options:z(c.val),location:u},err:null}:{val:{type:6,value:n,options:z(c.val),offset:s,pluralType:a===`plural`?`cardinal`:`ordinal`,location:u},err:null}}default:return this.error(5,R(i,o))}}tryParseArgumentClose(e){return this.isEOF()||this.char()!==125?this.error(1,R(e,this.clonePosition())):(this.bump(),{val:!0,err:null})}parseSimpleArgStyleIfPossible(){let e=0,t=this.clonePosition();for(;!this.isEOF();)switch(this.char()){case 39:{this.bump();let e=this.clonePosition();if(!this.bumpUntil(`'`))return this.error(11,R(e,this.clonePosition()));this.bump();break}case 123:e+=1,this.bump();break;case 125:if(e>0)--e;else return{val:this.message.slice(t.offset,this.offset()),err:null};break;default:this.bump()}return{val:this.message.slice(t.offset,this.offset()),err:null}}parseNumberSkeletonFromString(e,t){let n=[];try{n=le(e)}catch{return this.error(7,t)}return{val:{type:0,tokens:n,location:t,parsedOptions:this.shouldParseSkeletons?pe(n):{}},err:null}}tryParsePluralOrSelectOptions(e,t,n,r){let i=!1,a=[],o=new Set,{value:s,location:c}=r;for(;;){if(s.length===0){let e=this.clonePosition();if(t!==`select`&&this.bumpIf(`=`)){let t=this.tryParseDecimalInteger(16,19);if(t.err)return t;c=R(e,this.clonePosition()),s=this.message.slice(e.offset,this.offset())}else break}if(o.has(s))return this.error(t===`select`?21:20,c);s===`other`&&(i=!0),this.bumpSpace();let r=this.clonePosition();if(!this.bumpIf(`{`))return this.error(t===`select`?17:18,R(this.clonePosition(),this.clonePosition()));let l=this.parseMessage(e+1,t,n);if(l.err)return l;let u=this.tryParseArgumentClose(r);if(u.err)return u;a.push([s,{value:l.val,location:R(r,this.clonePosition())}]),o.add(s),this.bumpSpace(),{value:s,location:c}=this.parseIdentifierIfPossible()}return a.length===0?this.error(t===`select`?15:16,R(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!i?this.error(22,R(this.clonePosition(),this.clonePosition())):{val:a,err:null}}tryParseDecimalInteger(e,t){let n=1,r=this.clonePosition();this.bumpIf(`+`)||this.bumpIf(`-`)&&(n=-1);let i=!1,a=0;for(;!this.isEOF();){let e=this.char();if(e>=48&&e<=57)i=!0,a=a*10+(e-48),this.bump();else break}let o=R(r,this.clonePosition());return i?(a*=n,Number.isSafeInteger(a)?{val:a,err:null}:this.error(t,o)):this.error(e,o)}offset(){return this.position.offset}isEOF(){return this.offset()===this.message.length}clonePosition(){return{offset:this.position.offset,line:this.position.line,column:this.position.column}}char(){let e=this.position.offset;if(e>=this.message.length)throw Error(`out of bound`);let t=this.message.codePointAt(e);if(t===void 0)throw Error(`Offset ${e} is at invalid UTF-16 code unit boundary`);return t}error(e,t){return{val:null,err:{kind:e,message:this.message,location:t}}}bump(){if(this.isEOF())return;let e=this.char();e===10?(this.position.line+=1,this.position.column=1,this.position.offset+=1):(this.position.column+=1,this.position.offset+=e<65536?1:2)}bumpIf(e){if(this.message.startsWith(e,this.offset())){for(let t=0;t<e.length;t++)this.bump();return!0}return!1}bumpUntil(e){let t=this.offset(),n=this.message.indexOf(e,t);return n>=0?(this.bumpTo(n),!0):(this.bumpTo(this.message.length),!1)}bumpTo(e){if(this.offset()>e)throw Error(`targetOffset ${e} must be greater than or equal to the current offset ${this.offset()}`);for(e=Math.min(e,this.message.length);;){let t=this.offset();if(t===e)break;if(t>e)throw Error(`targetOffset ${e} is at invalid UTF-16 code unit boundary`);if(this.bump(),this.isEOF())break}}bumpSpace(){for(;!this.isEOF()&&De(this.char());)this.bump()}peek(){if(this.isEOF())return null;let e=this.char(),t=this.offset();return this.message.charCodeAt(t+(e>=65536?2:1))??null}};function V(e){return e>=97&&e<=122||e>=65&&e<=90}function Te(e){return V(e)||e===47}function Ee(e){return e===45||e===46||e>=48&&e<=57||e===95||e>=97&&e<=122||e>=65&&e<=90||e==183||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function De(e){return e>=9&&e<=13||e===32||e===133||e>=8206&&e<=8207||e===8232||e===8233}function H(e){e.forEach(e=>{if(delete e.location,D(e)||O(e))for(let t in e.options)delete e.options[t].location,H(e.options[t].value);else w(e)&&A(e.style)||(T(e)||E(e))&&j(e.style)?delete e.style.location:k(e)&&H(e.children)})}function Oe(e,t={}){t={shouldParseSkeletons:!0,requiresOtherClause:!0,...t};let n=new we(e,t).parse();if(n.err){let e=SyntaxError(me[n.err.kind]);throw e.location=n.err.location,e.originalMessage=n.err.message,e}return t?.captureLocation||H(n.val),n.val}var U=class extends Error{constructor(e,t,n){super(e),this.code=t,this.originalMessage=n}toString(){return`[formatjs Error: ${this.code}] ${this.message}`}},W=class extends U{constructor(e,t,n,r){super(`Invalid values for "${e}": "${t}". Options are "${Object.keys(n).join(`", "`)}"`,`INVALID_VALUE`,r)}},ke=class extends U{constructor(e,t,n){super(`Value for "${e}" must be of type ${t}`,`INVALID_VALUE`,n)}},Ae=class extends U{constructor(e,t){super(`The intl string context variable "${e}" was not provided to the string "${t}"`,`MISSING_VALUE`,t)}};function je(e){return e.length<2?e:e.reduce((e,t)=>{let n=e[e.length-1];return!n||n.type!==0||t.type!==0?e.push(t):n.value+=t.value,e},[])}function Me(e){return typeof e==`function`}function G(e,t,n,r,i,a,o){if(e.length===1&&C(e[0]))return[{type:0,value:e[0].value}];let s=[];for(let c of e){if(C(c)){s.push({type:0,value:c.value});continue}if(ge(c)){typeof a==`number`&&s.push({type:0,value:n.getNumberFormat(t).format(a)});continue}let{value:e}=c;if(!(i&&e in i))throw new Ae(e,o);let l=i[e];if(he(c))(!l||typeof l==`string`||typeof l==`number`||typeof l==`bigint`)&&(l=typeof l==`string`||typeof l==`number`||typeof l==`bigint`?String(l):``),s.push({type:typeof l==`string`?0:1,value:l});else if(T(c)){let e=typeof c.style==`string`?r.date[c.style]:j(c.style)?c.style.parsedOptions:void 0;s.push({type:0,value:n.getDateTimeFormat(t,e).format(l)})}else if(E(c)){let e=typeof c.style==`string`?r.time[c.style]:j(c.style)?c.style.parsedOptions:r.time.medium;s.push({type:0,value:n.getDateTimeFormat(t,e).format(l)})}else if(w(c)){let e=typeof c.style==`string`?r.number[c.style]:A(c.style)?c.style.parsedOptions:void 0;if(e&&e.scale){let t=e.scale||1;if(typeof l==`bigint`){if(!Number.isInteger(t))throw TypeError(`Cannot apply fractional scale ${t} to bigint value. Scale must be an integer when formatting bigint.`);l*=BigInt(t)}else l*=t}s.push({type:0,value:n.getNumberFormat(t,e).format(l)})}else{if(k(c)){let{children:e,value:l}=c,u=i[l];if(!Me(u))throw new ke(l,`function`,o);let d=u(G(e,t,n,r,i,a).map(e=>e.value));Array.isArray(d)||(d=[d]),s.push(...d.map(e=>({type:typeof e==`string`?0:1,value:e})))}if(D(c)){let e=l,a=(Object.prototype.hasOwnProperty.call(c.options,e)?c.options[e]:void 0)||c.options.other;if(!a)throw new W(c.value,l,Object.keys(c.options),o);s.push(...G(a.value,t,n,r,i))}else if(O(c)){let e=`=${l}`,a=Object.prototype.hasOwnProperty.call(c.options,e)?c.options[e]:void 0;if(!a){if(!Intl.PluralRules)throw new U(`Intl.PluralRules is not available in this environment.
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,u as n}from"./themeProps-3IqahpCr.js";import{C as r,S as i,x as a}from"./Icon-BqkS-pIq.js";var o=e(n(),1);function s(e){try{let t=new Intl.Locale(e);return(typeof t.getTextInfo==`function`?t.getTextInfo():t.textInfo)?.direction===`rtl`?`rtl`:`ltr`}catch{return`ltr`}}var c=t();function l(e){return Object.values(e).some(e=>Object.values(e).some(e=>typeof e==`string`))?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,Object.fromEntries(Object.entries(t).map(([e,t])=>[e,typeof t==`string`?{defaultMessage:t}:t]))])):e}function u({locale:e,messages:t,overrides:n,dir:a,children:u}){let d=a??s(e),f=(0,o.useMemo)(()=>{let i=t??{};return{locale:e,direction:d,messages:l(i),overrides:n,translate:r(e,i,n)}},[e,d,t,n]);return(0,c.jsx)(i,{value:f,children:u})}u.displayName=`InternationalizationProvider`;function d(e,t){let n=t&&t.cache?t.cache:ae,r=t&&t.serializer?t.serializer:re;return(t&&t.strategy?t.strategy:ee)(e,{cache:n,serializer:r})}function f(e){return e==null||typeof e==`number`||typeof e==`boolean`}function p(e,t,n,r){let i=f(r)?r:n(r),a=t.get(i);return a===void 0&&(a=e.call(this,r),t.set(i,a)),a}function m(e,t,n){let r=Array.prototype.slice.call(arguments,3),i=n(r),a=t.get(i);return a===void 0&&(a=e.apply(this,r),t.set(i,a)),a}function h(e,t,n,r,i){return n.bind(t,e,r,i)}function ee(e,t){let n=e.length===1?p:m;return h(e,this,n,t.cache.create(),t.serializer)}function te(e,t){return h(e,this,m,t.cache.create(),t.serializer)}function ne(e,t){return h(e,this,p,t.cache.create(),t.serializer)}var re=function(){return JSON.stringify(arguments)},ie=class{constructor(){this.cache=Object.create(null)}get(e){return this.cache[e]}set(e,t){this.cache[e]=t}},ae={create:function(){return new ie}},g={variadic:te,monadic:ne},oe=/(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;function se(e){let t={};return e.replace(oe,e=>{let n=e.length;switch(e[0]){case`G`:t.era=n===4?`long`:n===5?`narrow`:`short`;break;case`y`:t.year=n===2?`2-digit`:`numeric`;break;case`Y`:case`u`:case`U`:case`r`:throw RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");case`q`:case`Q`:throw RangeError("`q/Q` (quarter) patterns are not supported");case`M`:case`L`:t.month=[`numeric`,`2-digit`,`short`,`long`,`narrow`][n-1];break;case`w`:case`W`:throw RangeError("`w/W` (week) patterns are not supported");case`d`:t.day=[`numeric`,`2-digit`][n-1];break;case`D`:case`F`:case`g`:throw RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");case`E`:t.weekday=n===4?`long`:n===5?`narrow`:`short`;break;case`e`:if(n<4)throw RangeError("`e..eee` (weekday) patterns are not supported");t.weekday=[`short`,`long`,`narrow`,`short`][n-3];break;case`c`:if(n<4)throw RangeError("`c..ccc` (weekday) patterns are not supported");t.weekday=[`short`,`long`,`narrow`,`short`][n-3];break;case`a`:t.hour12=!0;break;case`b`:case`B`:throw RangeError("`b/B` (period) patterns are not supported, use `a` instead");case`h`:t.hourCycle=`h12`,t.hour=[`numeric`,`2-digit`][n-1];break;case`H`:t.hourCycle=`h23`,t.hour=[`numeric`,`2-digit`][n-1];break;case`K`:t.hourCycle=`h11`,t.hour=[`numeric`,`2-digit`][n-1];break;case`k`:t.hourCycle=`h24`,t.hour=[`numeric`,`2-digit`][n-1];break;case`j`:case`J`:case`C`:throw RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");case`m`:t.minute=[`numeric`,`2-digit`][n-1];break;case`s`:t.second=[`numeric`,`2-digit`][n-1];break;case`S`:case`A`:throw RangeError("`S/A` (second) patterns are not supported, use `s` instead");case`z`:t.timeZoneName=n<4?`short`:`long`;break;case`Z`:case`O`:case`v`:case`V`:case`X`:case`x`:throw RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead")}return``}),t}var ce=/[\t-\r \x85\u200E\u200F\u2028\u2029]/i;function le(e){if(e.length===0)throw Error(`Number skeleton cannot be empty`);let t=e.split(ce).filter(e=>e.length>0),n=[];for(let e of t){let t=e.split(`/`);if(t.length===0)throw Error(`Invalid number skeleton`);let[r,...i]=t;for(let e of i)if(e.length===0)throw Error(`Invalid number skeleton`);n.push({stem:r,options:i})}return n}function ue(e){return e.replace(/^(.*?)-/,``)}var _=/^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g,v=/^(@+)?(\+|#+)?[rs]?$/g,de=/(\*)(0+)|(#+)(0+)|(0+)/g,y=/^(0+)$/;function b(e){let t={};return e[e.length-1]===`r`?t.roundingPriority=`morePrecision`:e[e.length-1]===`s`&&(t.roundingPriority=`lessPrecision`),e.replace(v,function(e,n,r){return typeof r==`string`?r===`+`?t.minimumSignificantDigits=n.length:n[0]===`#`?t.maximumSignificantDigits=n.length:(t.minimumSignificantDigits=n.length,t.maximumSignificantDigits=n.length+(typeof r==`string`?r.length:0)):(t.minimumSignificantDigits=n.length,t.maximumSignificantDigits=n.length),``}),t}function x(e){switch(e){case`sign-auto`:return{signDisplay:`auto`};case`sign-accounting`:case`()`:return{currencySign:`accounting`};case`sign-always`:case`+!`:return{signDisplay:`always`};case`sign-accounting-always`:case`()!`:return{signDisplay:`always`,currencySign:`accounting`};case`sign-except-zero`:case`+?`:return{signDisplay:`exceptZero`};case`sign-accounting-except-zero`:case`()?`:return{signDisplay:`exceptZero`,currencySign:`accounting`};case`sign-never`:case`+_`:return{signDisplay:`never`}}}function fe(e){let t;if(e[0]===`E`&&e[1]===`E`?(t={notation:`engineering`},e=e.slice(2)):e[0]===`E`&&(t={notation:`scientific`},e=e.slice(1)),t){let n=e.slice(0,2);if(n===`+!`?(t.signDisplay=`always`,e=e.slice(2)):n===`+?`&&(t.signDisplay=`exceptZero`,e=e.slice(2)),!y.test(e))throw Error(`Malformed concise eng/scientific notation`);t.minimumIntegerDigits=e.length}return t}function S(e){return x(e)||{}}function pe(e){let t={};for(let n of e){switch(n.stem){case`percent`:case`%`:t.style=`percent`;continue;case`%x100`:t.style=`percent`,t.scale=100;continue;case`currency`:t.style=`currency`,t.currency=n.options[0];continue;case`group-off`:case`,_`:t.useGrouping=!1;continue;case`precision-integer`:case`.`:t.maximumFractionDigits=0;continue;case`measure-unit`:case`unit`:t.style=`unit`,t.unit=ue(n.options[0]);continue;case`compact-short`:case`K`:t.notation=`compact`,t.compactDisplay=`short`;continue;case`compact-long`:case`KK`:t.notation=`compact`,t.compactDisplay=`long`;continue;case`scientific`:t={...t,notation:`scientific`,...n.options.reduce((e,t)=>({...e,...S(t)}),{})};continue;case`engineering`:t={...t,notation:`engineering`,...n.options.reduce((e,t)=>({...e,...S(t)}),{})};continue;case`notation-simple`:t.notation=`standard`;continue;case`unit-width-narrow`:t.currencyDisplay=`narrowSymbol`,t.unitDisplay=`narrow`;continue;case`unit-width-short`:t.currencyDisplay=`code`,t.unitDisplay=`short`;continue;case`unit-width-full-name`:t.currencyDisplay=`name`,t.unitDisplay=`long`;continue;case`unit-width-iso-code`:t.currencyDisplay=`symbol`;continue;case`scale`:t.scale=parseFloat(n.options[0]);continue;case`rounding-mode-floor`:t.roundingMode=`floor`;continue;case`rounding-mode-ceiling`:t.roundingMode=`ceil`;continue;case`rounding-mode-down`:t.roundingMode=`trunc`;continue;case`rounding-mode-up`:t.roundingMode=`expand`;continue;case`rounding-mode-half-even`:t.roundingMode=`halfEven`;continue;case`rounding-mode-half-down`:t.roundingMode=`halfTrunc`;continue;case`rounding-mode-half-up`:t.roundingMode=`halfExpand`;continue;case`integer-width`:if(n.options.length>1)throw RangeError(`integer-width stems only accept a single optional option`);n.options[0].replace(de,function(e,n,r,i,a,o){if(n)t.minimumIntegerDigits=r.length;else if(i&&a)throw Error(`We currently do not support maximum integer digits`);else if(o)throw Error(`We currently do not support exact integer digits`);return``});continue}if(y.test(n.stem)){t.minimumIntegerDigits=n.stem.length;continue}if(_.test(n.stem)){if(n.options.length>1)throw RangeError(`Fraction-precision stems only accept a single optional option`);n.stem.replace(_,function(e,n,r,i,a,o){return r===`*`?t.minimumFractionDigits=n.length:i&&i[0]===`#`?t.maximumFractionDigits=i.length:a&&o?(t.minimumFractionDigits=a.length,t.maximumFractionDigits=a.length+o.length):(t.minimumFractionDigits=n.length,t.maximumFractionDigits=n.length),``});let e=n.options[0];e===`w`?t={...t,trailingZeroDisplay:`stripIfInteger`}:e&&(t={...t,...b(e)});continue}if(v.test(n.stem)){t={...t,...b(n.stem)};continue}let e=x(n.stem);e&&(t={...t,...e});let r=fe(n.stem);r&&(t={...t,...r})}return t}var me=function(e){return e[e.EXPECT_ARGUMENT_CLOSING_BRACE=1]=`EXPECT_ARGUMENT_CLOSING_BRACE`,e[e.EMPTY_ARGUMENT=2]=`EMPTY_ARGUMENT`,e[e.MALFORMED_ARGUMENT=3]=`MALFORMED_ARGUMENT`,e[e.EXPECT_ARGUMENT_TYPE=4]=`EXPECT_ARGUMENT_TYPE`,e[e.INVALID_ARGUMENT_TYPE=5]=`INVALID_ARGUMENT_TYPE`,e[e.EXPECT_ARGUMENT_STYLE=6]=`EXPECT_ARGUMENT_STYLE`,e[e.INVALID_NUMBER_SKELETON=7]=`INVALID_NUMBER_SKELETON`,e[e.INVALID_DATE_TIME_SKELETON=8]=`INVALID_DATE_TIME_SKELETON`,e[e.EXPECT_NUMBER_SKELETON=9]=`EXPECT_NUMBER_SKELETON`,e[e.EXPECT_DATE_TIME_SKELETON=10]=`EXPECT_DATE_TIME_SKELETON`,e[e.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE=11]=`UNCLOSED_QUOTE_IN_ARGUMENT_STYLE`,e[e.EXPECT_SELECT_ARGUMENT_OPTIONS=12]=`EXPECT_SELECT_ARGUMENT_OPTIONS`,e[e.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE=13]=`EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE`,e[e.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE=14]=`INVALID_PLURAL_ARGUMENT_OFFSET_VALUE`,e[e.EXPECT_SELECT_ARGUMENT_SELECTOR=15]=`EXPECT_SELECT_ARGUMENT_SELECTOR`,e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR=16]=`EXPECT_PLURAL_ARGUMENT_SELECTOR`,e[e.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT=17]=`EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT`,e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT=18]=`EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT`,e[e.INVALID_PLURAL_ARGUMENT_SELECTOR=19]=`INVALID_PLURAL_ARGUMENT_SELECTOR`,e[e.DUPLICATE_PLURAL_ARGUMENT_SELECTOR=20]=`DUPLICATE_PLURAL_ARGUMENT_SELECTOR`,e[e.DUPLICATE_SELECT_ARGUMENT_SELECTOR=21]=`DUPLICATE_SELECT_ARGUMENT_SELECTOR`,e[e.MISSING_OTHER_CLAUSE=22]=`MISSING_OTHER_CLAUSE`,e[e.INVALID_TAG=23]=`INVALID_TAG`,e[e.INVALID_TAG_NAME=25]=`INVALID_TAG_NAME`,e[e.UNMATCHED_CLOSING_TAG=26]=`UNMATCHED_CLOSING_TAG`,e[e.UNCLOSED_TAG=27]=`UNCLOSED_TAG`,e}({});function C(e){return e.type===0}function he(e){return e.type===1}function w(e){return e.type===2}function T(e){return e.type===3}function E(e){return e.type===4}function D(e){return e.type===5}function O(e){return e.type===6}function ge(e){return e.type===7}function k(e){return e.type===8}function A(e){return!!(e&&typeof e==`object`&&e.type===0)}function j(e){return!!(e&&typeof e==`object`&&e.type===1)}var M=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/,N={"001":[`H`,`h`],419:[`h`,`H`,`hB`,`hb`],AC:[`H`,`h`,`hb`,`hB`],AD:[`H`,`hB`],AE:[`h`,`hB`,`hb`,`H`],AF:[`H`,`hb`,`hB`,`h`],AG:[`h`,`hb`,`H`,`hB`],AI:[`H`,`h`,`hb`,`hB`],AL:[`h`,`H`,`hB`],AM:[`H`,`hB`],AO:[`H`,`hB`],AR:[`h`,`H`,`hB`,`hb`],AS:[`h`,`H`],AT:[`H`,`hB`],AU:[`h`,`hb`,`H`,`hB`],AW:[`H`,`hB`],AX:[`H`],AZ:[`H`,`hB`,`h`],BA:[`H`,`hB`,`h`],BB:[`h`,`hb`,`H`,`hB`],BD:[`h`,`hB`,`H`],BE:[`H`,`hB`],BF:[`H`,`hB`],BG:[`H`,`hB`,`h`],BH:[`h`,`hB`,`hb`,`H`],BI:[`H`,`h`],BJ:[`H`,`hB`],BL:[`H`,`hB`],BM:[`h`,`hb`,`H`,`hB`],BN:[`hb`,`hB`,`h`,`H`],BO:[`h`,`H`,`hB`,`hb`],BQ:[`H`],BR:[`H`,`hB`],BS:[`h`,`hb`,`H`,`hB`],BT:[`h`,`H`],BW:[`H`,`h`,`hb`,`hB`],BY:[`H`,`h`],BZ:[`H`,`h`,`hb`,`hB`],CA:[`h`,`hb`,`H`,`hB`],CC:[`H`,`h`,`hb`,`hB`],CD:[`hB`,`H`],CF:[`H`,`h`,`hB`],CG:[`H`,`hB`],CH:[`H`,`hB`,`h`],CI:[`H`,`hB`],CK:[`H`,`h`,`hb`,`hB`],CL:[`h`,`H`,`hB`,`hb`],CM:[`H`,`h`,`hB`],CN:[`H`,`hB`,`hb`,`h`],CO:[`h`,`H`,`hB`,`hb`],CP:[`H`],CR:[`h`,`H`,`hB`,`hb`],CU:[`h`,`H`,`hB`,`hb`],CV:[`H`,`hB`],CW:[`H`,`hB`],CX:[`H`,`h`,`hb`,`hB`],CY:[`h`,`H`,`hb`,`hB`],CZ:[`H`],DE:[`H`,`hB`],DG:[`H`,`h`,`hb`,`hB`],DJ:[`h`,`H`],DK:[`H`],DM:[`h`,`hb`,`H`,`hB`],DO:[`h`,`H`,`hB`,`hb`],DZ:[`h`,`hB`,`hb`,`H`],EA:[`H`,`h`,`hB`,`hb`],EC:[`h`,`H`,`hB`,`hb`],EE:[`H`,`hB`],EG:[`h`,`hB`,`hb`,`H`],EH:[`h`,`hB`,`hb`,`H`],ER:[`h`,`H`],ES:[`H`,`hB`,`h`,`hb`],ET:[`hB`,`hb`,`h`,`H`],FI:[`H`],FJ:[`h`,`hb`,`H`,`hB`],FK:[`H`,`h`,`hb`,`hB`],FM:[`h`,`hb`,`H`,`hB`],FO:[`H`,`h`],FR:[`H`,`hB`],GA:[`H`,`hB`],GB:[`H`,`h`,`hb`,`hB`],GD:[`h`,`hb`,`H`,`hB`],GE:[`H`,`hB`,`h`],GF:[`H`,`hB`],GG:[`H`,`h`,`hb`,`hB`],GH:[`h`,`H`],GI:[`H`,`h`,`hb`,`hB`],GL:[`H`,`h`],GM:[`h`,`hb`,`H`,`hB`],GN:[`H`,`hB`],GP:[`H`,`hB`],GQ:[`H`,`hB`,`h`,`hb`],GR:[`h`,`H`,`hb`,`hB`],GS:[`H`,`h`,`hb`,`hB`],GT:[`h`,`H`,`hB`,`hb`],GU:[`h`,`hb`,`H`,`hB`],GW:[`H`,`hB`],GY:[`h`,`hb`,`H`,`hB`],HK:[`h`,`hB`,`hb`,`H`],HN:[`h`,`H`,`hB`,`hb`],HR:[`H`,`hB`],HU:[`H`,`h`],IC:[`H`,`h`,`hB`,`hb`],ID:[`H`],IE:[`H`,`h`,`hb`,`hB`],IL:[`H`,`hB`],IM:[`H`,`h`,`hb`,`hB`],IN:[`h`,`H`],IO:[`H`,`h`,`hb`,`hB`],IQ:[`h`,`hB`,`hb`,`H`],IR:[`hB`,`H`],IS:[`H`],IT:[`H`,`hB`],JE:[`H`,`h`,`hb`,`hB`],JM:[`h`,`hb`,`H`,`hB`],JO:[`h`,`hB`,`hb`,`H`],JP:[`H`,`K`,`h`],KE:[`hB`,`hb`,`H`,`h`],KG:[`H`,`h`,`hB`,`hb`],KH:[`hB`,`h`,`H`,`hb`],KI:[`h`,`hb`,`H`,`hB`],KM:[`H`,`h`,`hB`,`hb`],KN:[`h`,`hb`,`H`,`hB`],KP:[`h`,`H`,`hB`,`hb`],KR:[`h`,`H`,`hB`,`hb`],KW:[`h`,`hB`,`hb`,`H`],KY:[`h`,`hb`,`H`,`hB`],KZ:[`H`,`hB`],LA:[`H`,`hb`,`hB`,`h`],LB:[`h`,`hB`,`hb`,`H`],LC:[`h`,`hb`,`H`,`hB`],LI:[`H`,`hB`,`h`],LK:[`H`,`h`,`hB`,`hb`],LR:[`h`,`hb`,`H`,`hB`],LS:[`h`,`H`],LT:[`H`,`h`,`hb`,`hB`],LU:[`H`,`h`,`hB`],LV:[`H`,`hB`,`hb`,`h`],LY:[`h`,`hB`,`hb`,`H`],MA:[`H`,`h`,`hB`,`hb`],MC:[`H`,`hB`],MD:[`H`,`hB`],ME:[`H`,`hB`,`h`],MF:[`H`,`hB`],MG:[`H`,`h`],MH:[`h`,`hb`,`H`,`hB`],MK:[`H`,`h`,`hb`,`hB`],ML:[`H`],MM:[`hB`,`hb`,`H`,`h`],MN:[`H`,`h`,`hb`,`hB`],MO:[`h`,`hB`,`hb`,`H`],MP:[`h`,`hb`,`H`,`hB`],MQ:[`H`,`hB`],MR:[`h`,`hB`,`hb`,`H`],MS:[`H`,`h`,`hb`,`hB`],MT:[`H`,`h`],MU:[`H`,`h`],MV:[`H`,`h`],MW:[`h`,`hb`,`H`,`hB`],MX:[`h`,`H`,`hB`,`hb`],MY:[`hb`,`hB`,`h`,`H`],MZ:[`H`,`hB`],NA:[`h`,`H`,`hB`,`hb`],NC:[`H`,`hB`],NE:[`H`],NF:[`H`,`h`,`hb`,`hB`],NG:[`H`,`h`,`hb`,`hB`],NI:[`h`,`H`,`hB`,`hb`],NL:[`H`,`hB`],NO:[`H`,`h`],NP:[`H`,`h`,`hB`],NR:[`H`,`h`,`hb`,`hB`],NU:[`H`,`h`,`hb`,`hB`],NZ:[`h`,`hb`,`H`,`hB`],OM:[`h`,`hB`,`hb`,`H`],PA:[`h`,`H`,`hB`,`hb`],PE:[`h`,`H`,`hB`,`hb`],PF:[`H`,`h`,`hB`],PG:[`h`,`H`],PH:[`h`,`hB`,`hb`,`H`],PK:[`h`,`hB`,`H`],PL:[`H`,`h`],PM:[`H`,`hB`],PN:[`H`,`h`,`hb`,`hB`],PR:[`h`,`H`,`hB`,`hb`],PS:[`h`,`hB`,`hb`,`H`],PT:[`H`,`hB`],PW:[`h`,`H`],PY:[`h`,`H`,`hB`,`hb`],QA:[`h`,`hB`,`hb`,`H`],RE:[`H`,`hB`],RO:[`H`,`hB`],RS:[`H`,`hB`,`h`],RU:[`H`],RW:[`H`,`h`],SA:[`h`,`hB`,`hb`,`H`],SB:[`h`,`hb`,`H`,`hB`],SC:[`H`,`h`,`hB`],SD:[`h`,`hB`,`hb`,`H`],SE:[`H`],SG:[`h`,`hb`,`H`,`hB`],SH:[`H`,`h`,`hb`,`hB`],SI:[`H`,`hB`],SJ:[`H`],SK:[`H`],SL:[`h`,`hb`,`H`,`hB`],SM:[`H`,`h`,`hB`],SN:[`H`,`h`,`hB`],SO:[`h`,`H`],SR:[`H`,`hB`],SS:[`h`,`hb`,`H`,`hB`],ST:[`H`,`hB`],SV:[`h`,`H`,`hB`,`hb`],SX:[`H`,`h`,`hb`,`hB`],SY:[`h`,`hB`,`hb`,`H`],SZ:[`h`,`hb`,`H`,`hB`],TA:[`H`,`h`,`hb`,`hB`],TC:[`h`,`hb`,`H`,`hB`],TD:[`h`,`H`,`hB`],TF:[`H`,`h`,`hB`],TG:[`H`,`hB`],TH:[`H`,`h`],TJ:[`H`,`h`],TL:[`H`,`hB`,`hb`,`h`],TM:[`H`,`h`],TN:[`h`,`hB`,`hb`,`H`],TO:[`h`,`H`],TR:[`H`,`hB`],TT:[`h`,`hb`,`H`,`hB`],TW:[`hB`,`hb`,`h`,`H`],TZ:[`hB`,`hb`,`H`,`h`],UA:[`H`,`hB`,`h`],UG:[`hB`,`hb`,`H`,`h`],UM:[`h`,`hb`,`H`,`hB`],US:[`h`,`hb`,`H`,`hB`],UY:[`h`,`H`,`hB`,`hb`],UZ:[`H`,`hB`,`h`],VA:[`H`,`h`,`hB`],VC:[`h`,`hb`,`H`,`hB`],VE:[`h`,`H`,`hB`,`hb`],VG:[`h`,`hb`,`H`,`hB`],VI:[`h`,`hb`,`H`,`hB`],VN:[`H`,`h`],VU:[`h`,`H`],WF:[`H`,`hB`],WS:[`h`,`H`],XK:[`H`,`hB`,`h`],YE:[`h`,`hB`,`hb`,`H`],YT:[`H`,`hB`],ZA:[`H`,`h`,`hb`,`hB`],ZM:[`h`,`hb`,`H`,`hB`],ZW:[`H`,`h`],"af-ZA":[`H`,`h`,`hB`,`hb`],"ar-001":[`h`,`hB`,`hb`,`H`],"ca-ES":[`H`,`h`,`hB`],"en-001":[`h`,`hb`,`H`,`hB`],"en-HK":[`h`,`hb`,`H`,`hB`],"en-IL":[`H`,`h`,`hb`,`hB`],"en-MY":[`h`,`hb`,`H`,`hB`],"es-BR":[`H`,`h`,`hB`,`hb`],"es-ES":[`H`,`h`,`hB`,`hb`],"es-GQ":[`H`,`h`,`hB`,`hb`],"fr-CA":[`H`,`h`,`hB`],"gl-ES":[`H`,`h`,`hB`],"gu-IN":[`hB`,`hb`,`h`,`H`],"hi-IN":[`hB`,`h`,`H`],"it-CH":[`H`,`h`,`hB`],"it-IT":[`H`,`h`,`hB`],"kn-IN":[`hB`,`h`,`H`],"ku-SY":[`H`,`hB`],"ml-IN":[`hB`,`h`,`H`],"mr-IN":[`hB`,`hb`,`h`,`H`],"pa-IN":[`hB`,`hb`,`h`,`H`],"ta-IN":[`hB`,`h`,`hb`,`H`],"te-IN":[`hB`,`h`,`H`],"zu-ZA":[`H`,`hB`,`hb`,`h`]};function P(e,t){let n=``;for(let r=0;r<e.length;r++){let i=e.charAt(r);if(i===`j`){let a=0;for(;r+1<e.length&&e.charAt(r+1)===i;)a++,r++;let o=1+(a&1),s=a<2?1:3+(a>>1),c=F(t);for((c==`H`||c==`k`)&&(s=0);s-->0;)n+=`a`;for(;o-->0;)n=c+n}else n+=i===`J`?`H`:i}return n}function F(e){let t=e.hourCycle;if(t===void 0){let n=e;t=n.getHourCycles?.()[0]??n.hourCycles?.[0]}if(t)switch(t){case`h24`:return`k`;case`h23`:return`H`;case`h12`:return`h`;case`h11`:return`K`;default:throw Error(`Invalid hourCycle`)}let n=e.language,r;return n!==`root`&&(r=e.maximize().region),(N[`${n}-${r}`]||N[r||``]||N[n||``]||N[`${n}-001`]||N[`001`])[0].charAt(0)}var I=RegExp(`^${M.source}*`),L=RegExp(`${M.source}*$`);function R(e,t){return{start:e,end:t}}var _e=!!Object.fromEntries,ve=!!String.prototype.trimStart,ye=!!String.prototype.trimEnd,z=_e?Object.fromEntries:function(e){let t={};for(let[n,r]of e)t[n]=r;return t},be=ve?function(e){return e.trimStart()}:function(e){return e.replace(I,``)},xe=ye?function(e){return e.trimEnd()}:function(e){return e.replace(L,``)},B=RegExp(`([^\\p{White_Space}\\p{Pattern_Syntax}]*)`,`yu`);function Se(e,t){return B.lastIndex=t,B.exec(e)[1]??``}function Ce(e){if(e.length===0)return null;let t=1,n=1;for(let r=0;r<e.length;){let i=e.charCodeAt(r);switch(i){case 35:case 39:case 60:case 123:case 125:return null}if(i===10)t++,n=1,r++;else if(n++,i>=55296&&i<=56319&&r+1<e.length){let t=e.charCodeAt(r+1);r+=t>=56320&&t<=57343?2:1}else r++}return{offset:e.length,line:t,column:n}}var we=class{constructor(e,t={}){this.message=e,this.position={offset:0,line:1,column:1},this.ignoreTag=!!t.ignoreTag,this.locale=t.locale,this.requiresOtherClause=!!t.requiresOtherClause,this.shouldParseSkeletons=!!t.shouldParseSkeletons}parse(){if(this.offset()!==0)throw Error(`parser can only be used once`);if(this.message.length>0){let e=this.message.charCodeAt(0);if(e!==35&&e!==39&&e!==60&&e!==123&&e!==125){let e=Ce(this.message);if(e){let t=this.clonePosition();return this.position=e,{val:[{type:0,value:this.message,location:R(t,this.clonePosition())}],err:null}}}}return this.parseMessage(0,``,!1)}parseMessage(e,t,n){let r=[];for(;!this.isEOF();){let i=this.char();if(i===123){let t=this.parseArgument(e,n);if(t.err)return t;r.push(t.val)}else if(i===125&&e>0)break;else if(i===35&&(t===`plural`||t===`selectordinal`)){let e=this.clonePosition();this.bump(),r.push({type:7,location:R(e,this.clonePosition())})}else if(i===60&&!this.ignoreTag&&this.peek()===47){if(n)break;return this.error(26,R(this.clonePosition(),this.clonePosition()))}else if(i===60&&!this.ignoreTag&&V(this.peek()||0)){let n=this.parseTag(e,t);if(n.err)return n;r.push(n.val)}else{let n=this.parseLiteral(e,t);if(n.err)return n;r.push(n.val)}}return{val:r,err:null}}parseTag(e,t){let n=this.clonePosition();this.bump();let r=this.parseTagName();if(this.bumpSpace(),this.bumpIf(`/>`))return{val:{type:0,value:`<${r}/>`,location:R(n,this.clonePosition())},err:null};if(this.bumpIf(`>`)){let i=this.parseMessage(e+1,t,!0);if(i.err)return i;let a=i.val,o=this.clonePosition();if(this.bumpIf(`</`)){if(this.isEOF()||!V(this.char()))return this.error(23,R(o,this.clonePosition()));let e=this.clonePosition();return r===this.parseTagName()?(this.bumpSpace(),this.bumpIf(`>`)?{val:{type:8,value:r,children:a,location:R(n,this.clonePosition())},err:null}:this.error(23,R(o,this.clonePosition()))):this.error(26,R(e,this.clonePosition()))}return this.error(27,R(n,this.clonePosition()))}return this.error(23,R(n,this.clonePosition()))}parseTagName(){let e=this.offset();for(this.bump();!this.isEOF()&&Ee(this.char());)this.bump();return this.message.slice(e,this.offset())}parseLiteral(e,t){let n=this.clonePosition(),r=``;for(;;){let n=this.tryParseQuote(t);if(n){r+=n;continue}let i=this.tryParseUnquoted(e,t);if(i){r+=i;continue}let a=this.tryParseLeftAngleBracket();if(a)r+=a;else break}let i=R(n,this.clonePosition());return{val:{type:0,value:r,location:i},err:null}}tryParseLeftAngleBracket(){return!this.isEOF()&&this.char()===60&&(this.ignoreTag||!Te(this.peek()||0))?(this.bump(),`<`):null}tryParseQuote(e){if(this.isEOF()||this.char()!==39)return null;switch(this.peek()){case 39:return this.bump(),this.bump(),`'`;case 123:case 60:case 62:case 125:break;case 35:if(e===`plural`||e===`selectordinal`)break;return null;default:return null}this.bump();let t=[this.char()];for(this.bump();!this.isEOF();){let e=this.char();if(e===39){if(this.peek()===39)t.push(39),this.bump();else{this.bump();break}}else t.push(e);this.bump()}return String.fromCodePoint(...t)}tryParseUnquoted(e,t){if(this.isEOF())return null;let n=this.char();return n===60||n===123||n===35&&(t===`plural`||t===`selectordinal`)||n===125&&e>0?null:(this.bump(),String.fromCodePoint(n))}parseArgument(e,t){let n=this.clonePosition();if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(1,R(n,this.clonePosition()));if(this.char()===125)return this.bump(),this.error(2,R(n,this.clonePosition()));let r=this.parseIdentifierIfPossible().value;if(!r)return this.error(3,R(n,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(1,R(n,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:1,value:r,location:R(n,this.clonePosition())},err:null};case 44:return this.bump(),this.bumpSpace(),this.isEOF()?this.error(1,R(n,this.clonePosition())):this.parseArgumentOptions(e,t,r,n);default:return this.error(3,R(n,this.clonePosition()))}}parseIdentifierIfPossible(){let e=this.clonePosition(),t=this.offset(),n=Se(this.message,t),r=t+n.length;return this.bumpTo(r),{value:n,location:R(e,this.clonePosition())}}parseArgumentOptions(e,t,n,r){let i=this.clonePosition(),a=this.parseIdentifierIfPossible().value,o=this.clonePosition();switch(a){case``:return this.error(4,R(i,o));case`number`:case`date`:case`time`:{this.bumpSpace();let e=null;if(this.bumpIf(`,`)){this.bumpSpace();let t=this.clonePosition(),n=this.parseSimpleArgStyleIfPossible();if(n.err)return n;let r=xe(n.val);if(r.length===0)return this.error(6,R(this.clonePosition(),this.clonePosition()));e={style:r,styleLocation:R(t,this.clonePosition())}}let t=this.tryParseArgumentClose(r);if(t.err)return t;let i=R(r,this.clonePosition());if(e&&e.style.startsWith(`::`)){let t=be(e.style.slice(2));if(a===`number`){let r=this.parseNumberSkeletonFromString(t,e.styleLocation);return r.err?r:{val:{type:2,value:n,location:i,style:r.val},err:null}}{if(t.length===0)return this.error(10,i);let r=t;this.locale&&(r=P(t,this.locale));let o={type:1,pattern:r,location:e.styleLocation,parsedOptions:this.shouldParseSkeletons?se(r):{}};return{val:{type:a===`date`?3:4,value:n,location:i,style:o},err:null}}}return{val:{type:a===`number`?2:a===`date`?3:4,value:n,location:i,style:e?.style??null},err:null}}case`plural`:case`selectordinal`:case`select`:{let i=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(`,`))return this.error(12,R(i,{...i}));this.bumpSpace();let o=this.parseIdentifierIfPossible(),s=0;if(a!==`select`&&o.value===`offset`){if(!this.bumpIf(`:`))return this.error(13,R(this.clonePosition(),this.clonePosition()));this.bumpSpace();let e=this.tryParseDecimalInteger(13,14);if(e.err)return e;this.bumpSpace(),o=this.parseIdentifierIfPossible(),s=e.val}let c=this.tryParsePluralOrSelectOptions(e,a,t,o);if(c.err)return c;let l=this.tryParseArgumentClose(r);if(l.err)return l;let u=R(r,this.clonePosition());return a===`select`?{val:{type:5,value:n,options:z(c.val),location:u},err:null}:{val:{type:6,value:n,options:z(c.val),offset:s,pluralType:a===`plural`?`cardinal`:`ordinal`,location:u},err:null}}default:return this.error(5,R(i,o))}}tryParseArgumentClose(e){return this.isEOF()||this.char()!==125?this.error(1,R(e,this.clonePosition())):(this.bump(),{val:!0,err:null})}parseSimpleArgStyleIfPossible(){let e=0,t=this.clonePosition();for(;!this.isEOF();)switch(this.char()){case 39:{this.bump();let e=this.clonePosition();if(!this.bumpUntil(`'`))return this.error(11,R(e,this.clonePosition()));this.bump();break}case 123:e+=1,this.bump();break;case 125:if(e>0)--e;else return{val:this.message.slice(t.offset,this.offset()),err:null};break;default:this.bump()}return{val:this.message.slice(t.offset,this.offset()),err:null}}parseNumberSkeletonFromString(e,t){let n=[];try{n=le(e)}catch{return this.error(7,t)}return{val:{type:0,tokens:n,location:t,parsedOptions:this.shouldParseSkeletons?pe(n):{}},err:null}}tryParsePluralOrSelectOptions(e,t,n,r){let i=!1,a=[],o=new Set,{value:s,location:c}=r;for(;;){if(s.length===0){let e=this.clonePosition();if(t!==`select`&&this.bumpIf(`=`)){let t=this.tryParseDecimalInteger(16,19);if(t.err)return t;c=R(e,this.clonePosition()),s=this.message.slice(e.offset,this.offset())}else break}if(o.has(s))return this.error(t===`select`?21:20,c);s===`other`&&(i=!0),this.bumpSpace();let r=this.clonePosition();if(!this.bumpIf(`{`))return this.error(t===`select`?17:18,R(this.clonePosition(),this.clonePosition()));let l=this.parseMessage(e+1,t,n);if(l.err)return l;let u=this.tryParseArgumentClose(r);if(u.err)return u;a.push([s,{value:l.val,location:R(r,this.clonePosition())}]),o.add(s),this.bumpSpace(),{value:s,location:c}=this.parseIdentifierIfPossible()}return a.length===0?this.error(t===`select`?15:16,R(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!i?this.error(22,R(this.clonePosition(),this.clonePosition())):{val:a,err:null}}tryParseDecimalInteger(e,t){let n=1,r=this.clonePosition();this.bumpIf(`+`)||this.bumpIf(`-`)&&(n=-1);let i=!1,a=0;for(;!this.isEOF();){let e=this.char();if(e>=48&&e<=57)i=!0,a=a*10+(e-48),this.bump();else break}let o=R(r,this.clonePosition());return i?(a*=n,Number.isSafeInteger(a)?{val:a,err:null}:this.error(t,o)):this.error(e,o)}offset(){return this.position.offset}isEOF(){return this.offset()===this.message.length}clonePosition(){return{offset:this.position.offset,line:this.position.line,column:this.position.column}}char(){let e=this.position.offset;if(e>=this.message.length)throw Error(`out of bound`);let t=this.message.codePointAt(e);if(t===void 0)throw Error(`Offset ${e} is at invalid UTF-16 code unit boundary`);return t}error(e,t){return{val:null,err:{kind:e,message:this.message,location:t}}}bump(){if(this.isEOF())return;let e=this.char();e===10?(this.position.line+=1,this.position.column=1,this.position.offset+=1):(this.position.column+=1,this.position.offset+=e<65536?1:2)}bumpIf(e){if(this.message.startsWith(e,this.offset())){for(let t=0;t<e.length;t++)this.bump();return!0}return!1}bumpUntil(e){let t=this.offset(),n=this.message.indexOf(e,t);return n>=0?(this.bumpTo(n),!0):(this.bumpTo(this.message.length),!1)}bumpTo(e){if(this.offset()>e)throw Error(`targetOffset ${e} must be greater than or equal to the current offset ${this.offset()}`);for(e=Math.min(e,this.message.length);;){let t=this.offset();if(t===e)break;if(t>e)throw Error(`targetOffset ${e} is at invalid UTF-16 code unit boundary`);if(this.bump(),this.isEOF())break}}bumpSpace(){for(;!this.isEOF()&&De(this.char());)this.bump()}peek(){if(this.isEOF())return null;let e=this.char(),t=this.offset();return this.message.charCodeAt(t+(e>=65536?2:1))??null}};function V(e){return e>=97&&e<=122||e>=65&&e<=90}function Te(e){return V(e)||e===47}function Ee(e){return e===45||e===46||e>=48&&e<=57||e===95||e>=97&&e<=122||e>=65&&e<=90||e==183||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function De(e){return e>=9&&e<=13||e===32||e===133||e>=8206&&e<=8207||e===8232||e===8233}function H(e){e.forEach(e=>{if(delete e.location,D(e)||O(e))for(let t in e.options)delete e.options[t].location,H(e.options[t].value);else w(e)&&A(e.style)||(T(e)||E(e))&&j(e.style)?delete e.style.location:k(e)&&H(e.children)})}function Oe(e,t={}){t={shouldParseSkeletons:!0,requiresOtherClause:!0,...t};let n=new we(e,t).parse();if(n.err){let e=SyntaxError(me[n.err.kind]);throw e.location=n.err.location,e.originalMessage=n.err.message,e}return t?.captureLocation||H(n.val),n.val}var U=class extends Error{constructor(e,t,n){super(e),this.code=t,this.originalMessage=n}toString(){return`[formatjs Error: ${this.code}] ${this.message}`}},W=class extends U{constructor(e,t,n,r){super(`Invalid values for "${e}": "${t}". Options are "${Object.keys(n).join(`", "`)}"`,`INVALID_VALUE`,r)}},ke=class extends U{constructor(e,t,n){super(`Value for "${e}" must be of type ${t}`,`INVALID_VALUE`,n)}},Ae=class extends U{constructor(e,t){super(`The intl string context variable "${e}" was not provided to the string "${t}"`,`MISSING_VALUE`,t)}};function je(e){return e.length<2?e:e.reduce((e,t)=>{let n=e[e.length-1];return!n||n.type!==0||t.type!==0?e.push(t):n.value+=t.value,e},[])}function Me(e){return typeof e==`function`}function G(e,t,n,r,i,a,o){if(e.length===1&&C(e[0]))return[{type:0,value:e[0].value}];let s=[];for(let c of e){if(C(c)){s.push({type:0,value:c.value});continue}if(ge(c)){typeof a==`number`&&s.push({type:0,value:n.getNumberFormat(t).format(a)});continue}let{value:e}=c;if(!(i&&e in i))throw new Ae(e,o);let l=i[e];if(he(c))(!l||typeof l==`string`||typeof l==`number`||typeof l==`bigint`)&&(l=typeof l==`string`||typeof l==`number`||typeof l==`bigint`?String(l):``),s.push({type:typeof l==`string`?0:1,value:l});else if(T(c)){let e=typeof c.style==`string`?r.date[c.style]:j(c.style)?c.style.parsedOptions:void 0;s.push({type:0,value:n.getDateTimeFormat(t,e).format(l)})}else if(E(c)){let e=typeof c.style==`string`?r.time[c.style]:j(c.style)?c.style.parsedOptions:r.time.medium;s.push({type:0,value:n.getDateTimeFormat(t,e).format(l)})}else if(w(c)){let e=typeof c.style==`string`?r.number[c.style]:A(c.style)?c.style.parsedOptions:void 0;if(e&&e.scale){let t=e.scale||1;if(typeof l==`bigint`){if(!Number.isInteger(t))throw TypeError(`Cannot apply fractional scale ${t} to bigint value. Scale must be an integer when formatting bigint.`);l*=BigInt(t)}else l*=t}s.push({type:0,value:n.getNumberFormat(t,e).format(l)})}else{if(k(c)){let{children:e,value:l}=c,u=i[l];if(!Me(u))throw new ke(l,`function`,o);let d=u(G(e,t,n,r,i,a).map(e=>e.value));Array.isArray(d)||(d=[d]),s.push(...d.map(e=>({type:typeof e==`string`?0:1,value:e})))}if(D(c)){let e=l,a=(Object.prototype.hasOwnProperty.call(c.options,e)?c.options[e]:void 0)||c.options.other;if(!a)throw new W(c.value,l,Object.keys(c.options),o);s.push(...G(a.value,t,n,r,i))}else if(O(c)){let e=`=${l}`,a=Object.prototype.hasOwnProperty.call(c.options,e)?c.options[e]:void 0;if(!a){if(!Intl.PluralRules)throw new U(`Intl.PluralRules is not available in this environment.
|
|
2
2
|
Try polyfilling it using "@formatjs/intl-pluralrules"
|
|
3
3
|
`,`MISSING_INTL_API`,o);let e=typeof l==`bigint`?Number(l):l,r=n.getPluralRules(t,{type:c.pluralType}).select(e-(c.offset||0));a=(Object.prototype.hasOwnProperty.call(c.options,r)?c.options[r]:void 0)||c.options.other}if(!a)throw new W(c.value,l,Object.keys(c.options),o);let u=typeof l==`bigint`?Number(l):l;s.push(...G(a.value,t,n,r,i,u-(c.offset||0)))}}}return je(s)}function Ne(e,t){return t?{...e,...t,...Object.keys(e).reduce((n,r)=>(n[r]={...e[r],...t[r]},n),{})}:e}function Pe(e,t){return t?Object.keys(e).reduce((n,r)=>(n[r]=Ne(e[r],t[r]),n),{...e}):e}function K(e){return{create(){return{get(t){return e[t]},set(t,n){e[t]=n}}}}}function Fe(e={number:{},dateTime:{},pluralRules:{}}){return{getNumberFormat:d((...e)=>new Intl.NumberFormat(...e),{cache:K(e.number),strategy:g.variadic}),getDateTimeFormat:d((...e)=>new Intl.DateTimeFormat(...e),{cache:K(e.dateTime),strategy:g.variadic}),getPluralRules:d((...e)=>new Intl.PluralRules(...e),{cache:K(e.pluralRules),strategy:g.variadic})}}var Ie=class e{constructor(t,n=e.defaultLocale,r,i){if(this.formatterCache={number:{},dateTime:{},pluralRules:{}},this.format=e=>{let t=this.formatToParts(e);if(t.length===1)return t[0].value;let n=t.reduce((e,t)=>(!e.length||t.type!==0||typeof e[e.length-1]!=`string`?e.push(t.value):e[e.length-1]+=t.value,e),[]);return n.length<=1?n[0]||``:n},this.formatToParts=e=>G(this.ast,this.locales,this.formatters,this.formats,e,void 0,this.message),this.resolvedOptions=()=>({locale:this.resolvedLocale?.toString()||Intl.NumberFormat.supportedLocalesOf(this.locales)[0]}),this.getAst=()=>this.ast,this.locales=n,this.resolvedLocale=e.resolveLocale(n),typeof t==`string`){if(this.message=t,!e.__parse)throw TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");let{...n}=i||{};this.ast=e.__parse(t,{...n,locale:this.resolvedLocale})}else this.ast=t;if(!Array.isArray(this.ast))throw TypeError(`A message must be provided as a String or AST.`);this.formats=Pe(e.formats,r),this.formatters=i&&i.formatters||Fe(this.formatterCache)}static{this.memoizedDefaultLocale=null}static get defaultLocale(){return e.memoizedDefaultLocale||=new Intl.NumberFormat().resolvedOptions().locale,e.memoizedDefaultLocale}static{this.resolveLocale=e=>{if(Intl.Locale===void 0)return;let t=Intl.NumberFormat.supportedLocalesOf(e);return t.length>0?new Intl.Locale(t[0]):new Intl.Locale(typeof e==`string`?e:e[0])}}static{this.__parse=Oe}static{this.formats={number:{integer:{maximumFractionDigits:0},currency:{style:`currency`},percent:{style:`percent`}},date:{short:{month:`numeric`,day:`numeric`,year:`2-digit`},medium:{month:`short`,day:`numeric`,year:`numeric`},long:{month:`long`,day:`numeric`,year:`numeric`},full:{weekday:`long`,month:`long`,day:`numeric`,year:`numeric`}},time:{short:{hour:`numeric`,minute:`numeric`},medium:{hour:`numeric`,minute:`numeric`,second:`numeric`},long:{hour:`numeric`,minute:`numeric`,second:`numeric`,timeZoneName:`short`},full:{hour:`numeric`,minute:`numeric`,second:`numeric`,timeZoneName:`short`}}}}},q={"@theorem.agent.handle":{defaultMessage:`@{handle}`,description:`The agent's name above its messages, on the landing and in captions.`,params:[`handle`]},"@theorem.chat.greeting":{defaultMessage:`What are we working on?`,description:`Chat landing heading, before the first message.`},"@theorem.chat.loading":{defaultMessage:`Loading…`,description:`Spinner label while the profile loads.`},"@theorem.chat.live_unsupported.title":{defaultMessage:`Live profiles aren't supported here`,description:`Shown when TheoremChat is pointed at a live profile.`},"@theorem.chat.live_unsupported.description":{defaultMessage:`Use LiveRunner from @theoremjs/react/live.`,description:`Where to go instead, under the live-profile warning.`},"@theorem.composer.placeholder":{defaultMessage:`Message @{handle}`,description:`Empty composer placeholder.`,params:[`handle`]},"@theorem.composer.listening":{defaultMessage:`Listening…`,description:`Composer placeholder while a voice note records.`},"@theorem.composer.attach":{defaultMessage:`Attach files`,description:`Paperclip button.`},"@theorem.composer.record":{defaultMessage:`Record voice`,description:`Microphone button, idle.`},"@theorem.composer.stop_recording":{defaultMessage:`Stop recording`,description:`Microphone button, recording.`},"@theorem.composer.send_options":{defaultMessage:`More send options`,description:`Menu button beside send.`},"@theorem.composer.menu.queue":{defaultMessage:`Queue`,description:`Send menu item.`},"@theorem.composer.menu.queue.description":{defaultMessage:`Send it once this reply finishes.`,description:`Send menu item detail: the message waits its turn.`},"@theorem.composer.menu.steer":{defaultMessage:`Steer this reply`,description:`Send menu item.`},"@theorem.composer.menu.steer.description":{defaultMessage:`Add it to the reply in progress. The agent reads it at its next step.`,description:`Send menu item detail: the message joins the running reply instead of waiting.`},"@theorem.composer.menu.send_now":{defaultMessage:`Send now`,description:`Send menu item.`},"@theorem.composer.menu.send_now.description":{defaultMessage:`Stop this reply and send it instead.`,description:`Send menu item detail: ends the running reply (or its wait for approval), then sends.`},"@theorem.composer.menu.stash":{defaultMessage:`Stash`,description:`Send menu item.`},"@theorem.composer.menu.stash.description":{defaultMessage:`Set it aside to send later.`,description:`Send menu item detail: the message waits in the composer until sent.`},"@theorem.composer.hint.stash-selected-draft.message":{defaultMessage:`Replacing this?`,description:`Hint when the whole draft is selected and could be stashed.`},"@theorem.composer.hint.stash-selected-draft.action":{defaultMessage:`Stash it`,description:`The hint's button.`},"@theorem.composer.drawer.steer":{defaultMessage:`steering`,description:`Drawer header when only steering messages wait.`},"@theorem.composer.drawer.queue":{defaultMessage:`queued`,description:`Drawer header when only queued messages wait.`},"@theorem.composer.drawer.stash":{defaultMessage:`stashed`,description:`Drawer header when only stashed messages wait.`},"@theorem.composer.drawer.attached":{defaultMessage:`attached`,description:`Drawer header when only files wait.`},"@theorem.composer.drawer.steer.count":{defaultMessage:`{n} steering`,description:`One part of a mixed drawer header.`,params:[`n`]},"@theorem.composer.drawer.queue.count":{defaultMessage:`{n} queued`,description:`One part of a mixed drawer header.`,params:[`n`]},"@theorem.composer.drawer.stash.count":{defaultMessage:`{n} stashed`,description:`One part of a mixed drawer header.`,params:[`n`]},"@theorem.composer.drawer.attached.count":{defaultMessage:`{n} attached`,description:`One part of a mixed drawer header.`,params:[`n`]},"@theorem.composer.drawer.separator":{defaultMessage:` · `,description:`Between the parts of a mixed drawer header.`},"@theorem.composer.pending.steer":{defaultMessage:`Steering`,description:`Name of a waiting steering message, read by screen readers on its icon.`},"@theorem.composer.pending.steer.description":{defaultMessage:`Steering: the agent reads it at its next step.`,description:`Tooltip on a waiting steering message.`},"@theorem.composer.pending.queue":{defaultMessage:`Queued`,description:`Name of a waiting queued message, read by screen readers on its icon.`},"@theorem.composer.pending.queue.description":{defaultMessage:`Queued: it sends once this reply finishes.`,description:`Tooltip on a waiting queued message.`},"@theorem.composer.pending.stash":{defaultMessage:`Stashed`,description:`Name of a waiting stashed message, read by screen readers on its icon.`},"@theorem.composer.pending.stash.description":{defaultMessage:`Stashed: it waits here until you send it.`,description:`Tooltip on a waiting stashed message.`},"@theorem.composer.pending.edit":{defaultMessage:`Edit`,description:`Waiting message: back into the composer.`},"@theorem.composer.pending.queue_action":{defaultMessage:`Queue`,description:`Stashed message: queue it.`},"@theorem.composer.pending.send_now":{defaultMessage:`Send now`,description:`Waiting message: send it now.`},"@theorem.composer.pending.move_up":{defaultMessage:`Move up`,description:`Waiting message: earlier.`},"@theorem.composer.pending.move_down":{defaultMessage:`Move down`,description:`Waiting message: later.`},"@theorem.composer.pending.remove":{defaultMessage:`Remove`,description:`Waiting message: discard.`},"@theorem.transcript.copy":{defaultMessage:`Copy`,description:`Copy a message.`},"@theorem.transcript.copied":{defaultMessage:`Copied`,description:`Right after copying a message.`},"@theorem.transcript.now":{defaultMessage:`now`,description:`Message time during its first minute.`},"@theorem.transcript.failed":{defaultMessage:`failed`,description:`Message status: the turn failed. The reason shows on hover.`},"@theorem.transcript.generated_image":{defaultMessage:`Generated image`,description:`Alt text for a generated image.`},"@theorem.transcript.generated_video":{defaultMessage:`Generated video`,description:`Alt text for a generated video.`},"@theorem.transcript.open_generated_image":{defaultMessage:`Open generated image`,description:`Opens the image full size.`},"@theorem.transcript.generating_image":{defaultMessage:`Generating image`,description:`Placeholder while an image generates.`},"@theorem.transcript.sources":{defaultMessage:`Sources`,description:`The row of source chips (screen readers).`},"@theorem.transcript.sources_more":{defaultMessage:`{count, plural, one {+# other} other {+# others}}`,description:`Overflow chip that opens the menu of remaining source citations.`,params:[`count`]},"@theorem.transcript.tool_input":{defaultMessage:`Input`,description:`A tool call's arguments, in its detail.`},"@theorem.transcript.tool_input_edited":{defaultMessage:`Input (edited)`,description:`A tool call's arguments after the user edited them on approval.`},"@theorem.transcript.tool_output":{defaultMessage:`Output`,description:`A tool call's result, in its detail.`},"@theorem.transcript.tool_error":{defaultMessage:`Error`,description:`A failed tool call's failure, in its detail.`},"@theorem.transcript.tokens":{defaultMessage:`{count, plural, one {# token} other {# tokens}}`,description:`Tokens a reply used, under it, or an agent tool's called agent used, on its call row.`,params:[`count`]},"@theorem.data.view":{defaultMessage:`View as`,description:`Switch between tool data drawn by its shape and its JSON.`},"@theorem.data.shaped":{defaultMessage:`Data`,description:`Tool data drawn as fields, sections, and tables.`},"@theorem.data.json":{defaultMessage:`JSON`,description:`Tool data as its raw JSON.`},"@theorem.data.item":{defaultMessage:`Item {index}`,description:`A list row with no name of its own.`,params:[`index`]},"@theorem.data.none":{defaultMessage:`Empty`,description:`An empty list or object in tool data.`},"@theorem.data.yes":{defaultMessage:`Yes`,description:`A true value in tool data.`},"@theorem.data.no":{defaultMessage:`No`,description:`A false value in tool data.`},"@theorem.data.more":{defaultMessage:`{count} more — switch to JSON to see them`,description:`Rows past the shown ones, left to the JSON view.`,params:[`count`]},"@theorem.data.large":{defaultMessage:`Too large to lay out — showing the first {size} of its JSON`,description:`A payload too big to draw by its shape, shown as the start of its JSON.`,params:[`size`]},"@theorem.transcript.copy_text.tool":{defaultMessage:`Tool: {name}`,description:`A tool call in copied message text.`,params:[`name`]},"@theorem.transcript.copy_text.media":{defaultMessage:`[{mimeType} media]`,description:`Media without a link, in copied message text.`,params:[`mimeType`]},"@theorem.transcript.working":{defaultMessage:`Working…`,description:`Turn status while running, start unknown.`},"@theorem.transcript.working_for":{defaultMessage:`Working for {duration}`,description:`Turn status while running.`,params:[`duration`]},"@theorem.transcript.worked":{defaultMessage:`Worked`,description:`Turn status once done, duration unknown.`},"@theorem.transcript.worked_for":{defaultMessage:`Worked for {duration}`,description:`Turn status once done.`,params:[`duration`]},"@theorem.duration.milliseconds":{defaultMessage:`{ms}ms`,description:`Under a second.`,params:[`ms`]},"@theorem.duration.belowTenth":{defaultMessage:`<0.1ms`,description:`Above zero but under a tenth of a millisecond, such as a quick guardrail check.`},"@theorem.duration.seconds":{defaultMessage:`{seconds}s`,description:`Under a minute.`,params:[`seconds`]},"@theorem.duration.minutes":{defaultMessage:`{minutes}m`,description:`Whole minutes.`,params:[`minutes`]},"@theorem.duration.minutes_seconds":{defaultMessage:`{minutes}m {seconds}s`,description:`Minutes and seconds.`,params:[`minutes`,`seconds`]},"@theorem.gate.approval.title":{defaultMessage:`{agent} wants to {request}`,description:`Approval card heading. {agent} is the agent's handle; {request} is what the call would do, e.g. 'check the weather'.`,params:[`agent`,`request`]},"@theorem.gate.approval.title_no_agent":{defaultMessage:`The agent wants to {request}`,description:`Approval card heading when the host names no agent.`,params:[`request`]},"@theorem.gate.approval.use_tool":{defaultMessage:`use {tool}`,description:`The {request} in the heading when the tool sets no labels.request. {tool} is the tool's name in words.`,params:[`tool`]},"@theorem.gate.approval.input":{defaultMessage:`Details`,description:`Expands the arguments the tool would run with.`},"@theorem.gate.approval.deny":{defaultMessage:`Reject`,description:`Approval card button.`},"@theorem.gate.approval.approve":{defaultMessage:`Approve`,description:`Approval card button.`},"@theorem.gate.tag.bearer":{defaultMessage:`bearer`,description:`Credential type tag.`},"@theorem.gate.tag.api_key":{defaultMessage:`api_key`,description:`Credential type tag.`},"@theorem.gate.tag.oauth2":{defaultMessage:`oauth2`,description:`Credential type tag.`},"@theorem.gate.auth.title":{defaultMessage:`Sign in to use {tool}`,description:`Credential card heading. {tool} is the tool's name in words.`,params:[`tool`]},"@theorem.gate.auth.resource":{defaultMessage:`Resource: {resource}`,description:`What the credential is for.`,params:[`resource`]},"@theorem.gate.auth.no_oauth":{defaultMessage:`No OAuth authorization endpoint is configured.`,description:`OAuth tool without an authorization URL.`},"@theorem.gate.auth.authorize":{defaultMessage:`Authorize with provider`,description:`Opens the OAuth sign-in.`},"@theorem.gate.auth.provided":{defaultMessage:`Credential provided for {slot}`,description:`After submitting a credential or finishing an OAuth sign-in.`,params:[`slot`]},"@theorem.gate.auth.api_key":{defaultMessage:`API key`,description:`Secret field label, API-key tools.`},"@theorem.gate.auth.bearer":{defaultMessage:`Bearer token`,description:`Secret field label, bearer tools.`},"@theorem.gate.auth.secret_placeholder":{defaultMessage:`Secret for slot ''{slot}''`,description:`Secret field placeholder.`,params:[`slot`]},"@theorem.gate.auth.secret_note":{defaultMessage:` `,description:`Under the secret field: how the host handles the credential. Blank by default, since only the host knows; the studio says it is used for one call.`},"@theorem.gate.auth.submit":{defaultMessage:`Submit & continue`,description:`Sends the credential.`},"@theorem.voice_note.name":{defaultMessage:`voice.{format}`,description:`A voice note's name, by audio format (webm, wav, mp3, m4a, ogg).`,params:[`format`]},"@theorem.voice_note.unnamed":{defaultMessage:`voice note`,description:`A voice note's name when its format is unknown.`},"@theorem.voice_note.play":{defaultMessage:`Play {name}`,description:`Voice note, paused.`,params:[`name`]},"@theorem.voice_note.pause":{defaultMessage:`Pause {name}`,description:`Voice note, playing.`,params:[`name`]},"@theorem.voice_note.remove":{defaultMessage:`Remove {name}`,description:`Unstages a voice note.`,params:[`name`]},"@theorem.decision.state":{defaultMessage:`State`,description:`The JSON a decision is asked about (field label).`},"@theorem.decision.state_size":{defaultMessage:`{size} of {limit}`,description:`The state's size against the profile's limit, under the field.`,params:[`size`,`limit`]},"@theorem.decision.view":{defaultMessage:`Edit as`,description:`Switch between the state as fields and as JSON.`},"@theorem.decision.fields":{defaultMessage:`Fields`,description:`The state edited field by field.`},"@theorem.decision.add_item":{defaultMessage:`Add to {field}`,description:`Adds a row to a list in the state.`,params:[`field`]},"@theorem.decision.remove_item":{defaultMessage:`Remove {item}`,description:`Removes a row from a list in the state.`,params:[`item`]},"@theorem.decision.add_value":{defaultMessage:`Add a value`,description:`A list of words in the state, while it is empty.`},"@theorem.decision.invalid_json":{defaultMessage:`Not valid JSON yet`,description:`The state doesn't parse.`},"@theorem.decision.null_state":{defaultMessage:`State can’t be null`,description:`The state is the JSON null.`},"@theorem.decision.too_large":{defaultMessage:`Over the {limit} limit`,description:`The state is larger than the profile's limit.`,params:[`limit`]},"@theorem.decision.answers":{defaultMessage:`Answers`,description:`The decision response column.`},"@theorem.decision.decide":{defaultMessage:`Decide`,description:`Asks the questions about the state.`},"@theorem.decision.deciding":{defaultMessage:`Deciding…`,description:`The decide button while it runs.`},"@theorem.decision.stop":{defaultMessage:`Stop`,description:`Cancels the running decision.`},"@theorem.decision.confidence":{defaultMessage:`{percent} sure`,description:`How sure the model is of a choice, score or box; percent is formatted, e.g. '92%'.`,params:[`percent`]},"@theorem.decision.option":{defaultMessage:`{label}, {percent}`,description:`One option and its probability (screen readers); percent is formatted.`,params:[`label`,`percent`]},"@theorem.decision.score_of":{defaultMessage:`{score} of {max}`,description:`A score on its scale from 0, e.g. 1.4 of 3.`,params:[`score`,`max`]},"@theorem.decision.type.choice":{defaultMessage:`Choice`,description:`A question that picks one label.`},"@theorem.decision.type.score":{defaultMessage:`Score`,description:`A question that places the state on a scale.`},"@theorem.decision.type.noul":{defaultMessage:`Noul`,description:`A question answered with one number.`},"@theorem.decision.type.box":{defaultMessage:`Box`,description:`A question answered with one box in an image.`},"@theorem.decision.box_edges":{defaultMessage:`Left {left}, top {top}, right {right}, bottom {bottom}`,description:`Where a box sits in its image, each edge as a share of the image from its top-left corner.`,params:[`left`,`top`,`right`,`bottom`]},"@theorem.decision.add_image":{defaultMessage:`Add an image`,description:`The drop area under the state: each image dropped or chosen becomes a state field.`},"@theorem.decision.add_image_hint":{defaultMessage:`Drop a PNG or JPEG, or choose one. It becomes a field the questions can name.`,description:`What the drop area under the state says it does.`},"@theorem.decision.replace_image":{defaultMessage:`Replace`,description:`An image field's file input, which swaps in another PNG or JPEG.`},"@theorem.decision.image_bad":{defaultMessage:`{file} is not a PNG or JPEG.`,description:`A file attached as an image that is neither.`,params:[`file`]},"@theorem.decision.edit_question":{defaultMessage:`Edit {question}`,description:`The button on an answer that opens its question where it is set up. The page shows it only when it can.`,params:[`question`]},"@theorem.decision.box_in":{defaultMessage:`The box, cut from the image`,description:`The alt text of the part of the image a box answer covers.`},"@theorem.decision.open_box":{defaultMessage:`See the box in the whole image`,description:`The cut-out box on an answer, which opens the whole image with the box outlined.`},"@theorem.decision.box_marked":{defaultMessage:`The whole image, the box outlined and the rest shaded`,description:`The alt text of the whole image a box answer opens.`},"@theorem.decision.tokens":{defaultMessage:`{count, plural, one {# token} other {# tokens}}`,description:`Input tokens the decision used, in the line under the answers.`,params:[`count`]},"@theorem.embedding.documents":{defaultMessage:`Documents`,description:`What a search looks through: the texts and files to embed (card title).`},"@theorem.embedding.document":{defaultMessage:`Document {number}`,description:`One document, by its place in the list.`,params:[`number`]},"@theorem.embedding.text":{defaultMessage:`Text`,description:`Text to split into documents (field label).`},"@theorem.embedding.text_placeholder":{defaultMessage:`Paste text to search through`,description:`The empty text field on the documents card.`},"@theorem.embedding.split":{defaultMessage:`Split by`,description:`Where the text is cut into documents (field label).`},"@theorem.embedding.split_whole":{defaultMessage:`Nothing: one document`,description:`The text is one document.`},"@theorem.embedding.split_lines":{defaultMessage:`Lines`,description:`Each line of the text is a document.`},"@theorem.embedding.split_paragraphs":{defaultMessage:`Paragraphs`,description:`Each run of text between blank lines is a document.`},"@theorem.embedding.split_commas":{defaultMessage:`Commas`,description:`Each piece of the text between commas is a document.`},"@theorem.embedding.split_custom":{defaultMessage:`A separator you type`,description:`The text is cut wherever a separator of the user’s own appears.`},"@theorem.embedding.separator":{defaultMessage:`Separator`,description:`The text the documents are cut at (field label).`},"@theorem.embedding.files":{defaultMessage:`Files`,description:`Adds files as documents (field label).`},"@theorem.embedding.drop_files":{defaultMessage:`Drop files here, or click to upload`,description:`The file field's prompt.`},"@theorem.embedding.unreadable":{defaultMessage:`{name} couldn't be read.`,description:`A chosen file the browser could not read.`,params:[`name`]},"@theorem.embedding.remove":{defaultMessage:`Remove {name}`,description:`Takes a document off the list.`,params:[`name`]},"@theorem.embedding.from_file":{defaultMessage:`From {name}`,description:`A document that is a piece of a text file, under its text.`,params:[`name`]},"@theorem.embedding.from_json":{defaultMessage:`From the JSON`,description:`The documents of a pasted list, as a group.`},"@theorem.embedding.group":{defaultMessage:`{source} · {count, plural, one {# document} other {# documents}}`,description:`A group of documents from one source, above its first few.`,params:[`source`,`count`]},"@theorem.embedding.held_file":{defaultMessage:`Held by the provider`,description:`A file the provider already holds, referred to by address, beside its type.`},"@theorem.embedding.more":{defaultMessage:`{count, plural, one {# more document} other {# more documents}}`,description:`Documents past the ones the list shows.`,params:[`count`]},"@theorem.embedding.invalid_json":{defaultMessage:`Not a list of documents: each is text, or an object with parts.`,description:`The documents' JSON doesn't read as the inputs an embedding takes.`},"@theorem.embedding.no_documents":{defaultMessage:`Add text or files to search through.`,description:`There are no documents yet.`},"@theorem.embedding.empty":{defaultMessage:`{name} is empty.`,description:`A document or the query has no text and no file.`,params:[`name`]},"@theorem.embedding.text_off":{defaultMessage:`{name} has text, and this profile embeds files only.`,description:`A document or the query has text the profile does not take.`,params:[`name`]},"@theorem.embedding.too_many":{defaultMessage:`One request takes at most {max} documents.`,description:`A request holds more inputs than the profile's model takes in one call.`,params:[`max`]},"@theorem.embedding.ready":{defaultMessage:`{count, plural, one {# document} other {# documents}} in {requests, plural, one {# request} other {# requests}}`,description:`The documents are ready: how many, and how many requests the profile’s limits make them.`,params:[`count`,`requests`]},"@theorem.embedding.index":{defaultMessage:`Index`,description:`Embeds the documents so they can be searched.`},"@theorem.embedding.indexing":{defaultMessage:`Indexing…`,description:`The index button while the documents are embedded.`},"@theorem.embedding.indexing_progress":{defaultMessage:`Indexing {done}/{total}…`,description:`The pane while the documents are embedded: the request in flight, of all of them.`,params:[`done`,`total`]},"@theorem.embedding.stop":{defaultMessage:`Stop`,description:`Cancels the running index or search.`},"@theorem.embedding.query":{defaultMessage:`Query`,description:`What to search the documents for (card title).`},"@theorem.embedding.query_placeholder":{defaultMessage:`What to search for`,description:`The empty query field.`},"@theorem.embedding.query_file":{defaultMessage:`Search with a file`,description:`Adds a file to the query, such as an image to find documents like it.`},"@theorem.embedding.query_invalid_json":{defaultMessage:`Not a query: text, or an object with parts.`,description:`The query's JSON doesn't read as one embedding input.`},"@theorem.embedding.stale":{defaultMessage:`The documents changed. Index them again.`,description:`The documents differ from the ones last embedded.`},"@theorem.embedding.remodelled":{defaultMessage:`The model changed. Index the documents again.`,description:`The last query came from another model than the one the documents were embedded with.`},"@theorem.embedding.search":{defaultMessage:`Search`,description:`Embeds the query and ranks the documents by it.`},"@theorem.embedding.searching":{defaultMessage:`Searching…`,description:`The search button while the query is embedded.`},"@theorem.embedding.results":{defaultMessage:`Results`,description:`The index and the matches (heading).`},"@theorem.embedding.indexed":{defaultMessage:`{count, plural, one {# document} other {# documents}}`,description:`How many documents the index holds, its card’s figure.`,params:[`count`]},"@theorem.embedding.view":{defaultMessage:`View`,description:`Switches the index card between the space and the list of vectors.`},"@theorem.embedding.space":{defaultMessage:`Space`,description:`The index drawn in three dimensions, alike documents together.`},"@theorem.embedding.list":{defaultMessage:`List`,description:`The index as a list of documents and their vectors.`},"@theorem.embedding.space_label":{defaultMessage:`{count, plural, one {# document} other {# documents}} drawn in three dimensions by where their vectors differ most: each document is joined to the one most like it when that pair is far more alike than the typical pair in this index, heavier the more alike, documents the lines connect share a colour, and three circles mark the planes of the axes.`,description:`What the space shows, for screen readers.`,params:[`count`]},"@theorem.embedding.space_query":{defaultMessage:`The query lands among its matches, with a line to each match far more alike than its typical document.`,description:`What the space shows after a search, for screen readers.`},"@theorem.embedding.space_off":{defaultMessage:`This browser can’t draw the space, so the vectors are listed.`,description:`WebGL2 is unavailable, so the index card shows the list.`},"@theorem.embedding.copy_vector":{defaultMessage:`Copy vector`,description:`Copies one document's vector as JSON.`},"@theorem.embedding.copy_vectors":{defaultMessage:`Copy all`,description:`Copies every vector in the index as JSON, in document order.`},"@theorem.embedding.copied":{defaultMessage:`Copied`,description:`Right after copying a vector.`},"@theorem.embedding.width":{defaultMessage:`{dimensions, plural, one {# dimension} other {# dimensions}}`,description:`How wide a vector is, after its first values in the list.`,params:[`dimensions`]},"@theorem.embedding.matches":{defaultMessage:`Matches`,description:`The documents most like the query, best first (card title).`},"@theorem.embedding.matches_shown":{defaultMessage:`Top {shown} of {count}`,description:`The matches card lists the best documents only.`,params:[`shown`,`count`]},"@theorem.embedding.best":{defaultMessage:`Best: {name}`,description:`The document most like the query, under the matches figure.`,params:[`name`]},"@theorem.embedding.no_matches":{defaultMessage:`No document has a vector as wide as the query’s.`,description:`The query and the documents were embedded by models of different widths.`},"@theorem.embedding.tokens":{defaultMessage:`{count, plural, one {# token} other {# tokens}}`,description:`Input tokens a call used, in the line under the results.`,params:[`count`]},"@theorem.host.tool":{defaultMessage:`Tool`,description:`Picks which of the host’s tools to call (field label).`},"@theorem.host.request":{defaultMessage:`Request`,description:`The input a tool call sends (card heading).`},"@theorem.host.response":{defaultMessage:`Response`,description:`What a tool call returned (section heading).`},"@theorem.host.run":{defaultMessage:`Run`,description:`Calls the tool with the request.`},"@theorem.host.image":{defaultMessage:`Image the tool returned`,description:`Alt text for an image a tool returned beside its output.`},"@theorem.host.running":{defaultMessage:`Running…`,description:`The run button while the call runs.`},"@theorem.host.stop":{defaultMessage:`Stop`,description:`Cancels the running call.`},"@theorem.host.missing":{defaultMessage:`Needs {fields}`,description:`Required fields the request is still missing, under the form.`,params:[`fields`]},"@theorem.host.shortcut":{defaultMessage:`⌘↵ to run`,description:`The keyboard shortcut that runs the call, under the form.`},"@theorem.host.no_tools":{defaultMessage:`This host has no tools yet`,description:`A host profile that allows no tools.`},"@theorem.host.earlier":{defaultMessage:`Earlier calls`,description:`Heading over this page’s previous tool calls.`},"@theorem.host.kind.function":{defaultMessage:`Function`,description:`A tool that runs a function on the host.`},"@theorem.host.kind.http":{defaultMessage:`HTTP`,description:`A tool that calls an HTTP endpoint.`},"@theorem.host.kind.mcp":{defaultMessage:`MCP`,description:`A tool served by an MCP server.`},"@theorem.tool.access.read-only":{defaultMessage:`Read only`,description:`A tool that only reads.`},"@theorem.tool.access.read-write":{defaultMessage:`Read and write`,description:`A tool that can change things.`},"@theorem.tool.access.destructive":{defaultMessage:`Destructive`,description:`A tool that can delete or overwrite.`},"@theorem.host.status.running":{defaultMessage:`running`,description:`A tool call in progress.`},"@theorem.host.status.gate":{defaultMessage:`waiting`,description:`A tool call paused on approval or sign-in.`},"@theorem.host.status.complete":{defaultMessage:`done`,description:`A tool call that returned.`},"@theorem.host.status.error":{defaultMessage:`failed`,description:`A tool call that failed.`},"@theorem.host.status.cancel":{defaultMessage:`stopped`,description:`A tool call that was cancelled.`},"@theorem.host.finished":{defaultMessage:`{activity} in {duration}`,description:`A finished tool call: what it did, and how long it took.`,params:[`activity`,`duration`]},"@theorem.panel.trace.name":{defaultMessage:`Trace`,description:`Trace side panel (screen readers).`},"@theorem.panel.trace.show":{defaultMessage:`Show trace`,description:`Trace panel toggle, closed.`},"@theorem.panel.trace.hide":{defaultMessage:`Hide trace`,description:`Trace panel toggle, open.`},"@theorem.panel.trace.resize":{defaultMessage:`Resize trace`,description:`Trace panel drag handle.`},"@theorem.panel.resize":{defaultMessage:`Resize {name}`,description:`Drag handle for a named console panel.`,params:[`name`]},"@theorem.panel.trace.empty.title":{defaultMessage:`No trace yet`,description:`Empty trace panel.`},"@theorem.panel.trace.empty.description":{defaultMessage:`Spans for each run will show here.`,description:`Empty trace panel.`},"@theorem.panel.trace.summary":{defaultMessage:`{traces, plural, one {# trace} other {# traces}} · {spans, plural, one {# span} other {# spans}}`,description:`Trace panel line under the search: how many traces and spans it holds.`,params:[`traces`,`spans`]},"@theorem.panel.trace.separator":{defaultMessage:` · `,description:`Between facts on one trace panel line.`},"@theorem.panel.trace.search":{defaultMessage:`Search spans`,description:`Trace panel search (screen readers).`},"@theorem.panel.trace.search.placeholder":{defaultMessage:`Filter by type, status, model, text…`,description:`Trace panel search, empty.`},"@theorem.panel.trace.search.text":{defaultMessage:`Any text`,description:`Search field matching any text a span holds.`},"@theorem.panel.trace.search.text.description":{defaultMessage:`Names, values, and stored text.`,description:`What the any-text search field matches.`},"@theorem.panel.trace.no_match":{defaultMessage:`No spans match`,description:`Trace panel, when the search matches nothing.`},"@theorem.panel.trace.download":{defaultMessage:`Download trace`,description:`Saves the trace's records as a file.`},"@theorem.panel.trace.back":{defaultMessage:`Back`,description:`Leaves an open span for its turn.`},"@theorem.panel.trace.show_text":{defaultMessage:`Show text`,description:`Reveals stored text, JSON, or messages.`},"@theorem.panel.trace.hide_text":{defaultMessage:`Hide text`,description:`Hides revealed stored text.`},"@theorem.panel.trace.other":{defaultMessage:`Other`,description:`Group for attributes the trace catalog does not name.`},"@theorem.panel.trace.yes":{defaultMessage:`Yes`,description:`A true trace value.`},"@theorem.panel.trace.no":{defaultMessage:`No`,description:`A false trace value.`},"@theorem.panel.trace.tokens":{defaultMessage:`Tokens`,description:`Card of token counts.`},"@theorem.panel.trace.errors":{defaultMessage:`Errors`,description:`Card counting failed spans.`},"@theorem.panel.trace.at_least":{defaultMessage:`At least {value}`,description:`A total some calls did not report.`,params:[`value`]},"@theorem.panel.trace.about":{defaultMessage:`About {value}`,description:`A total with estimated counts.`,params:[`value`]},"@theorem.panel.trace.offset":{defaultMessage:`+{duration}`,description:`When an event happened, after its span started.`,params:[`duration`]},"@theorem.panel.trace.unit.milliseconds":{defaultMessage:`ms`,description:`Unit of a search field in milliseconds.`},"@theorem.panel.trace.unit.seconds":{defaultMessage:`s`,description:`Unit of a search field in seconds.`},"@theorem.panel.trace.unit.usd":{defaultMessage:`USD`,description:`Unit of a search field in US dollars.`},"@theorem.panel.trace.turn":{defaultMessage:`{label} {index} of {count}`,description:`Which root of the trace is shown: "Turn 2 of 3".`,params:[`label`,`index`,`count`]},"@theorem.panel.trace.turns":{defaultMessage:`Turns`,description:`List of every turn of the conversation; a row opens its turn.`},"@theorem.panel.trace.conversation":{defaultMessage:`{count, plural, one {# turn} other {# turns}}`,description:`Heading of the whole-conversation view: how many turns it holds.`,params:[`count`]},"@theorem.panel.trace.conversation.back":{defaultMessage:`All turns`,description:`Leaves a turn for the whole-conversation view.`},"@theorem.panel.trace.previous":{defaultMessage:`Previous turn`,description:`Opens the turn before this one.`},"@theorem.panel.trace.next":{defaultMessage:`Next turn`,description:`Opens the turn after this one.`},"@theorem.panel.trace.calls":{defaultMessage:`Tool calls`,description:`List of every call of a host's trace; a row opens its call.`},"@theorem.panel.trace.calls.count":{defaultMessage:`{count, plural, one {# tool call} other {# tool calls}}`,description:`Heading of a host's whole-trace view: how many tool calls it holds.`,params:[`count`]},"@theorem.panel.trace.calls.back":{defaultMessage:`All tool calls`,description:`Leaves a call for the host's whole-trace view.`},"@theorem.panel.trace.calls.previous":{defaultMessage:`Previous call`,description:`Opens the tool call before this one.`},"@theorem.panel.trace.calls.next":{defaultMessage:`Next call`,description:`Opens the tool call after this one.`},"@theorem.panel.trace.steps":{defaultMessage:`Steps`,description:`Card counting the model and tool calls of a turn.`},"@theorem.panel.trace.steps.detail":{defaultMessage:`{calls, plural, one {# model call} other {# model calls}} · {tools, plural, one {# tool} other {# tools}}`,description:`Under the steps count: how many were model calls and tool calls.`,params:[`calls`,`tools`]},"@theorem.panel.trace.failed":{defaultMessage:`{count} failed`,description:`Under the steps count, when some failed.`,params:[`count`]},"@theorem.panel.trace.firstText":{defaultMessage:`First text`,description:`Card: how long the person waited before any of the answer appeared.`},"@theorem.panel.trace.rate":{defaultMessage:`{rate} tokens/s`,description:`Under the first-text time: how fast the model wrote once it started.`,params:[`rate`]},"@theorem.panel.trace.held":{defaultMessage:`{duration} held back`,description:`Under the first-text time: how long guardrails held written text back before showing it.`,params:[`duration`]},"@theorem.panel.trace.guardrails":{defaultMessage:`Guardrails`,description:`Card: the time guardrail checks took in a turn.`},"@theorem.panel.trace.guardrails.passed":{defaultMessage:`Passed: {checks}`,description:`Under the guardrail checks that acted: the checks that let the text through, each with what it checked and its time.`,params:[`checks`]},"@theorem.panel.trace.guardrails.from":{defaultMessage:`from {tool}`,description:`A guardrail check: the tool the checked text came from.`,params:[`tool`]},"@theorem.panel.trace.guardrails.tainted":{defaultMessage:`Tainted`,description:`A guardrail check: a tool that writes or deletes was called after the turn read remote content.`},"@theorem.panel.trace.guardrails.steered":{defaultMessage:`Steered`,description:`A guardrail check: a tool that writes or deletes was called after the turn read remote content that looked like instructions.`},"@theorem.panel.trace.guardrails.detail":{defaultMessage:`{checks, plural, one {# check} other {# checks}} · {flagged, plural, =0 {all passed} other {# acted}}`,description:`Under the guardrail time: how many checks ran, and how many redacted, flagged, or blocked.`,params:[`checks`,`flagged`]},"@theorem.panel.trace.tokens.detail":{defaultMessage:`{input} in · {output} out`,description:`Under the token total: tokens read and written.`,params:[`input`,`output`]},"@theorem.panel.trace.time":{defaultMessage:`Where the time went`,description:`Bar splitting a turn into model, tool, and other time.`},"@theorem.panel.trace.time.model":{defaultMessage:`Model`,description:`Time spent waiting on the model.`},"@theorem.panel.trace.time.tools":{defaultMessage:`Tools`,description:`Time spent running tools.`},"@theorem.panel.trace.time.guardrails":{defaultMessage:`Guardrails`,description:`Time guardrail checks took: on the input, the stream, and the answer.`},"@theorem.panel.trace.time.hooks":{defaultMessage:`Hooks`,description:`Time the host's turn hooks took.`},"@theorem.panel.trace.time.other":{defaultMessage:`Other`,description:`Time spent on none of these: waiting between steps, the host, the network.`},"@theorem.panel.trace.charts.calls":{defaultMessage:`Tokens per model call`,description:`Chart of each model call: its tokens stacked as a bar.`},"@theorem.panel.trace.charts.cached":{defaultMessage:`Cached`,description:`Legend: input tokens read from cache.`},"@theorem.panel.trace.charts.input":{defaultMessage:`Input`,description:`Legend: input tokens read fresh.`},"@theorem.panel.trace.charts.output":{defaultMessage:`Output`,description:`Legend: tokens the model wrote.`},"@theorem.panel.trace.charts.slowest":{defaultMessage:`Slowest steps`,description:`Chart ranking the steps that took longest.`},"@theorem.panel.trace.charts.modelShare":{defaultMessage:`{share} on the model`,description:`Beside a chart's total time: the model's share.`,params:[`share`]},"@theorem.panel.trace.charts.cachedShare":{defaultMessage:`{share} of input cached`,description:`Beside a chart's total tokens: the input read from cache.`,params:[`share`]},"@theorem.panel.trace.charts.turnTime":{defaultMessage:`Time per turn`,description:`Chart of each turn: its model, tool, and other time stacked.`},"@theorem.panel.trace.charts.callTime":{defaultMessage:`Time per call`,description:`Chart of each tool call of a host's trace: its tool, check, and hook time stacked.`},"@theorem.panel.trace.charts.turnTokens":{defaultMessage:`Tokens per turn`,description:`Chart of each turn: its tokens stacked as a bar.`},"@theorem.panel.trace.charts.turn":{defaultMessage:`Turn {index}`,description:`A turn, by its order in the conversation.`,params:[`index`]},"@theorem.panel.trace.charts.hostCall":{defaultMessage:`Call {index}`,description:`A tool call, by its order in a host's trace.`,params:[`index`]},"@theorem.panel.trace.charts.call":{defaultMessage:`Model call {index}`,description:`A model call, by its order in the turn.`,params:[`index`]},"@theorem.panel.trace.charts.tokens":{defaultMessage:`{cached} cached · {fresh} new in · {output} out`,description:`A model call's tokens: read from cache, read fresh, and written.`,params:[`cached`,`fresh`,`output`]},"@theorem.panel.trace.story":{defaultMessage:`What happened`,description:`The turn told step by step.`},"@theorem.panel.trace.story.asked":{defaultMessage:`User asked`,description:`The first step: what the user sent.`},"@theorem.panel.trace.story.requested":{defaultMessage:`Asked for {count, plural, one {# tool} other {# tools}}`,description:`A model call that answered with tool calls.`,params:[`count`]},"@theorem.panel.trace.story.wrote":{defaultMessage:`Wrote a reply`,description:`A model call that answered with text.`},"@theorem.panel.trace.story.answered":{defaultMessage:`Answered`,description:`The last step: the turn ended with this answer.`},"@theorem.panel.trace.story.failed":{defaultMessage:`Ended with an error`,description:`The last step, when the turn failed.`},"@theorem.panel.trace.timeline":{defaultMessage:`Timeline`,description:`Every span of the turn on one time axis.`},"@theorem.panel.trace.timeline.zoom":{defaultMessage:`Drag across the strip to zoom`,description:`Hint beside the activity strip that zooms the timeline.`},"@theorem.panel.trace.timeline.reset":{defaultMessage:`Show the whole turn`,description:`Zooms the timeline back out to the full turn.`},"@theorem.panel.trace.input":{defaultMessage:`Input`,description:`What a span was given.`},"@theorem.panel.trace.output":{defaultMessage:`Output`,description:`What a span gave back.`},"@theorem.panel.trace.details":{defaultMessage:`All details`,description:`A span's every attribute, event, and link.`},"@theorem.panel.trace.close":{defaultMessage:`Close`,description:`Closes the open span.`},"@theorem.panel.captions.name":{defaultMessage:`Captions`,description:`Captions side panel (screen readers).`},"@theorem.panel.captions.show":{defaultMessage:`Show captions`,description:`Captions panel toggle, closed.`},"@theorem.panel.captions.hide":{defaultMessage:`Hide captions`,description:`Captions panel toggle, open.`},"@theorem.panel.captions.resize":{defaultMessage:`Resize captions`,description:`Captions panel drag handle.`},"@theorem.panel.captions.empty.title":{defaultMessage:`No captions yet`,description:`Empty captions panel.`},"@theorem.panel.captions.empty.description":{defaultMessage:`What you and the agent say will show here.`,description:`Empty captions panel.`},"@theorem.live.greeting":{defaultMessage:`Ready when you are.`,description:`Live landing heading, before a call.`},"@theorem.live.start_voice_call":{defaultMessage:`Start voice call`,description:`Live landing, voice profiles.`},"@theorem.live.start_call":{defaultMessage:`Start call`,description:`Starts or restarts a call.`},"@theorem.live.start_video_call":{defaultMessage:`Start video call`,description:`Live landing, video profiles.`},"@theorem.live.microphone":{defaultMessage:`Microphone`,description:`Mic toggle.`},"@theorem.live.mute":{defaultMessage:`Mute`,description:`Mic toggle tooltip, unmuted.`},"@theorem.live.unmute":{defaultMessage:`Unmute`,description:`Mic toggle tooltip, muted.`},"@theorem.live.camera":{defaultMessage:`Camera`,description:`Camera toggle.`},"@theorem.live.camera_on":{defaultMessage:`Turn camera on`,description:`Camera toggle tooltip, off.`},"@theorem.live.camera_off":{defaultMessage:`Turn camera off`,description:`Camera toggle tooltip, on.`},"@theorem.live.flip_camera":{defaultMessage:`Flip camera`,description:`Switches front and back camera.`},"@theorem.live.end_call":{defaultMessage:`End call`,description:`Hangs up.`},"@theorem.live.new_session":{defaultMessage:`New session`,description:`Captions divider between calls.`},"@theorem.live.controls":{defaultMessage:`Call controls`,description:`The control toolbar (screen readers).`},"@theorem.live.camera_preview":{defaultMessage:`Camera preview`,description:`Self-view (screen readers).`},"@theorem.live.state.calling_tool":{defaultMessage:`calling {tool}`,description:`Call status: a tool runs.`,params:[`tool`]},"@theorem.live.state.connecting":{defaultMessage:`connecting`,description:`Call status.`},"@theorem.live.state.reconnecting":{defaultMessage:`reconnecting`,description:`Call status: the call dropped and is being taken up again.`},"@theorem.live.state.requesting_mic":{defaultMessage:`requesting mic`,description:`Call status.`},"@theorem.live.state.speaking":{defaultMessage:`speaking`,description:`Call status: the agent speaks.`},"@theorem.live.state.connected":{defaultMessage:`connected`,description:`Call status.`},"@theorem.live.state.muted":{defaultMessage:`muted`,description:`Call status.`},"@theorem.live.state.listening":{defaultMessage:`listening`,description:`Call status.`},"@theorem.live.state.error":{defaultMessage:`error`,description:`Call status.`},"@theorem.live.state.ended":{defaultMessage:`ended`,description:`Call status.`}};function Le(e,t){let[n]=t.parts;return t.parts.length===1&&n?e(`@theorem.composer.drawer.${n.kind}`):t.parts.map(t=>e(`@theorem.composer.drawer.${t.kind}.count`,{n:t.n})).join(e(`@theorem.composer.drawer.separator`))}function Re(e,t,n){let r=e(`@theorem.transcript.tokens`,{count:n.total});if(!n.cost)return r;let i=new Intl.NumberFormat(t,{style:`currency`,currency:`USD`,maximumSignificantDigits:2}).format(n.cost.usd);return`${r} · ${n.cost.partial?e(`@theorem.panel.trace.at_least`,{value:i}):i}`}function J(e,t){let n=Math.max(0,t);return n>0&&n<.05?e(`@theorem.duration.belowTenth`):n<10?e(`@theorem.duration.milliseconds`,{ms:Math.round(n*10)/10}):n<1e3?e(`@theorem.duration.milliseconds`,{ms:Math.round(n)}):n<1e4?e(`@theorem.duration.seconds`,{seconds:Math.round(n/100)/10}):n<6e4?e(`@theorem.duration.seconds`,{seconds:Math.round(n/1e3)}):X(e,Math.floor(n/6e4),Math.round(n%6e4/1e3))}function ze(e,t,n){let{usage:r,elapsedMs:i}=n;return[n.model,i==null?null:J(e,i),r?.inputTokens===void 0?null:n.tokens(r.inputTokens),r?.costUsd===void 0?null:t.format(r.costUsd)].filter(Boolean).join(` · `)}function Y(e,t){let n=Math.floor(Math.max(0,t)/1e3);return n<60?e(`@theorem.duration.seconds`,{seconds:n}):X(e,Math.floor(n/60),n%60)}function X(e,t,n){return n===0?e(`@theorem.duration.minutes`,{minutes:t}):e(`@theorem.duration.minutes_seconds`,{minutes:t,seconds:n})}function Be(e,t){return t?t.phase===`working`?t.elapsedMs===void 0?e(`@theorem.transcript.working`):e(`@theorem.transcript.working_for`,{duration:Y(e,t.elapsedMs)}):t.elapsedMs===void 0?e(`@theorem.transcript.worked`):e(`@theorem.transcript.worked_for`,{duration:J(e,t.elapsedMs)}):``}function Ve(e,t,n){return t===`calling_tool`?e(`@theorem.live.state.calling_tool`,{tool:n??``}):e(`@theorem.live.state.${t}`)}function He(e,t){return t?e(`@theorem.voice_note.name`,{format:t}):e(`@theorem.voice_note.unnamed`)}var Ue=new Set(Object.keys(q));function Z(e){return q[e]?.params??[]}function Q(e,t){for(let[n,r]of Object.entries(e)){if(!We(n))throw Error(`Theorem labels: ${n}: not a BCP 47 locale`);for(let[e,i]of Object.entries(r??{})){if(!t&&!e.startsWith(`@theorem.`))continue;let r=Ge(n,e,i);if(r)throw Error(`Theorem labels: ${n} ${e}: ${r}`)}}}function We(e){try{return Intl.getCanonicalLocales(e).length===1}catch{return!1}}function Ge(e,t,n){if(typeof n!=`string`)return`the message must be a string`;let r=t.startsWith(`@theorem.`);if(!r&&!t.startsWith(`@astryx.`))return`keys start with @theorem. or @astryx.`;if(r&&!Ue.has(t))return`no such label`;let i;try{i=new Ie(n,e)}catch(e){return`not a valid ICU message (${String(e)})`}if(!r)return;let a=Z(t);try{i.format(Object.fromEntries(a.map(e=>[e,1])))}catch(e){return`the message ${a.length>0?`may only use ${a.map(e=>`{${e}}`).join(`, `)}`:`takes no values`} (${String(e)})`}}var $=new WeakMap;function Ke(e){try{return new Intl.Locale(e).language}catch{return e.split(`-`)[0]??e}}function qe(e,t){let n=Ke(t);if($.get(e)===n)return e;let r={...e,[n]:{...q,...e[n]}};return $.set(r,n),r}function Je(e,t){if(!t)return e;let n={};for(let[r,i]of[...Object.entries(e??{}),...Object.entries(t)])n[r]={...n[r],...i};return n}function Ye({labels:e,children:t}){let n=(0,o.use)(i),r=(0,o.useMemo)(()=>qe(n.messages,n.locale),[n.messages,n.locale]),a=(0,o.useMemo)(()=>(Q(n.overrides??{},!1),e&&Q(e,!0),Je(n.overrides,e)),[n.overrides,e]);return r===n.messages&&a===n.overrides?(0,c.jsx)(c.Fragment,{children:t}):(0,c.jsx)(u,{locale:n.locale,dir:n.direction,messages:r,overrides:a,children:t})}function Xe(){return a()}export{Ve as a,He as c,Y as i,J as l,Xe as n,ze as o,Le as r,Re as s,Ye as t,Be as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E as e,g as t,l as n,o as r,p as i,v as a,w as o,x as s,y as c}from"./schemas-BQ9Jydzb.js";import{Bn as l,Nn as u,Tr as d,Un as f}from"./tool-schema
|
|
1
|
+
import{E as e,g as t,l as n,o as r,p as i,v as a,w as o,x as s,y as c}from"./schemas-BQ9Jydzb.js";import{Bn as l,Nn as u,Tr as d,Un as f}from"./tool-schema-DCF2M0n_.js";import{A as p,C as m,j as h}from"./reader-BJZH_Cmn.js";import{n as g}from"./trace-schema-9CdEyG6Q.js";import{C as _}from"./turn-client-mCvAwEgO.js";var v=c({type:t(`open`),history:n(f).optional(),slots:s(o(),o()).optional(),context:e().optional(),resume:c({providerState:d,awayMs:a().nonnegative()}).optional(),host:s(o(),e()).optional()}),y=i(`type`,[c({type:t(`audio`),data:o()}),c({type:t(`video`),data:o(),mimeType:o()}),c({type:t(`text`),text:o()}),c({type:t(`context`),context:e()}),c({type:t(`executeTool`),callId:o().min(1),operationId:o().min(1).max(256),decision:r(_).optional(),input:e().optional(),secret:o().optional(),output:e().optional(),grantId:o().min(1).optional(),unanswered:t(!0).optional()})]),b={ready:c({type:t(`ready`),profile:o().optional(),sessionId:o().optional()}),events:c({type:t(`events`),events:n(e())}),trace:c({type:t(`trace`),record:g}),error:c({type:t(`error`)}).and(m),executeToolResult:i(`status`,[c({type:t(`executeToolResult`),callId:o().min(1),operationId:o().min(1).max(256),status:t(`dispatched`),grantId:o().min(1),arguments:s(o(),e())}),c({type:t(`executeToolResult`),callId:o(),status:t(`settled`),operationId:o().min(1).max(256)}),c({type:t(`executeToolResult`),callId:o(),status:t(`gated`),operationId:o().min(1).max(256),gate:l}),c({type:t(`executeToolResult`),callId:o(),status:t(`refused`),operationId:o().min(1).max(256),body:m})])};function x(e){let t=p(b,e);return t.type===`events`?{type:`events`,events:t.events.map(e=>h(u,e))}:t}export{v as n,x as r,y as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e,t,n){if(!Number.isInteger(e)||e<1)throw RangeError(`year must be a positive integer, got ${e}`);if(!Number.isInteger(t)||t<1||t>12)throw RangeError(`month must be 1–12, got ${t}`);let r=o(e,t);if(!Number.isInteger(n)||n<1||n>r)throw RangeError(`day must be 1–${r} for ${e}-${String(t).padStart(2,`0`)}, got ${n}`);return{year:e,month:t,day:n}}function t(t){let[n,r,i]=t.split(`-`).map(Number);return e(n,r,i)}function n(e){return`${String(e.year).padStart(4,`0`)}-${String(e.month).padStart(2,`0`)}-${String(e.day).padStart(2,`0`)}`}function r(e){let t=new Date(0,0,1);return t.setFullYear(e.year,e.month-1,e.day),t}function i(e){return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}}function a(){return i(new Date)}function o(e,t){return t===2?e%4==0&&e%100!=0||e%400==0?29:28:[0,31,0,31,30,31,30,31,31,30,31,30,31][t]}function s(e){return r(e).getDay()}function c(e,t){let n=e.year*12+(e.month-1)+t,r=Math.floor(n/12),i=(n%12+12)%12+1;return{year:r,month:i,day:Math.min(e.day,o(r,i))}}function l(e,t){let n=r(e);return n.setDate(n.getDate()+t),i(n)}function u(e,t,n,r=0,i=0,a=0){let o=new Date(0);return o.setUTCFullYear(e,t,n),o.setUTCHours(r,i,a),o.getTime()}function d(e,t){let n=u(e.year,e.month-1,e.day),r=u(t.year,t.month-1,t.day);return Math.round((r-n)/864e5)}function f(e,t){let n=new Intl.DateTimeFormat(`en-US`,{timeZone:t,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`,calendar:`gregory`}).formatToParts(new Date(e)),r=Object.fromEntries(n.filter(e=>e.type!==`literal`).map(e=>[e.type,Number(e.value)]));return{year:r.year,month:r.month,day:r.day,hour:r.hour,minute:r.minute,second:r.second}}function p(e,t){return e.year===t.year?e.month===t.month?e.day-t.day:e.month-t.month:e.year-t.year}function m(e,t){return p(e,t)<0}function h(e,t){return p(e,t)>0}function g(e,t){return p(e,t)===0}function _(e,t){return p(e,t[0])>=0&&p(e,t[1])<=0}function v(e){return{year:e.year,month:e.month,day:1}}function y(e){let t=864e5,n=u(e.year,e.month-1,e.day),r=n+(4-(new Date(n).getUTCDay()||7))*t,i=(r-u(new Date(r).getUTCFullYear(),0,1))/t+1;return Math.ceil(i/7)}var b={weekday:`long`,year:`numeric`,month:`long`,day:`numeric`},x={weekday:`short`,month:`short`,day:`numeric`,year:`numeric`},S={year:`numeric`,month:`long`,day:`numeric`},C={year:`numeric`,month:`long`},w={weekday:`short`},T={month:`long`},E={month:`short`,day:`numeric`},D={month:`short`,day:`numeric`,year:`numeric`};function O(e,t,n=`en`){return new Intl.DateTimeFormat(n,{...t,calendar:t.calendar??`gregory`}).format(r(e))}function k(e=`en`){try{let t=new Intl.DisplayNames(e,{type:`dateTimeField`}).of(`weekOfYear`);if(t!=null&&t!==``)return t}catch{}return`week`}var A={date:D,date_long:S,date_weekday:x};function j(e,t,r=`en`){return t===`system_date`?n(e):O(e,A[t],r)}export{_ as C,a as D,n as E,k as O,g as S,r as T,i as _,w as a,h as b,j as c,l as d,c as f,O as g,d as h,D as i,o as l,s as m,C as n,b as o,e as p,E as r,A as s,T as t,f as u,t as v,v as w,m as x,y};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{t as e}from"./preload-helper-DpV6A1kQ.js";import{C as t,E as n,O as r,T as i,b as a,d as o,f as s,g as c,l,m as u,o as d,p as f,s as p,u as m,v as h,w as g,x as _,y as v}from"./schemas-BQ9Jydzb.js";import{$n as y,Ar as b,Cr as x,Er as S,Fn as ee,Gn as te,H as C,Hn as w,Jn as T,Jt as ne,Ln as E,Nn as D,Pn as re,Pr as O,Rn as ie,Sr as ae,U as oe,Un as se,Vt as ce,Wt as le,X as ue,Xn as de,Yn as k,Yt as fe,_n as pe,ar as me,cr as he,er as ge,fr as _e,gn as A,gr as ve,hn as ye,in as be,ir as xe,jr as Se,kr as Ce,lr as we,mn as j,nn as Te,nr as Ee,or as De,pn as Oe,qn as ke,s as Ae,sr as je,tn as Me,tr as Ne,vn as Pe,xr as Fe,yn as Ie,yt as Le,zn as Re,zt as ze}from"./tool-schema-DCF2M0n_.js";import{c as M}from"./host-patterns-F-KZIzkF.js";import{A as Be,An as Ve,B as He,Bt as Ue,En as We,Et as Ge,F as Ke,Ft as qe,Gt as Je,Ht as Ye,I as Xe,In as Ze,It as Qe,L as $e,Ln as et,Lt as tt,M as nt,Mn as rt,Mt as it,N as at,Nt as ot,On as st,P as ct,Q as lt,Qt as ut,Rn as dt,Rt as ft,Sn as pt,St as mt,Un as N,Ut as ht,Vn as gt,Vt as _t,W as vt,Wn as yt,Wt as bt,X as xt,bt as St,et as Ct,ft as wt,gn as Tt,hn as Et,it as Dt,jn as Ot,jt as kt,k as At,mn as jt,mt as P,nn as Mt,nt as Nt,pn as Pt,qt as Ft,rn as It,rt as Lt,tt as Rt,ut as zt,wn as Bt,wt as Vt,xn as Ht,zn as Ut,zt as Wt}from"./shaped-data-AVV4e7rW.js";import{a as Gt,n as Kt}from"./live-ingress-OuSlQ6q7.js";import{n as qt,t as Jt}from"./trace-schema-9CdEyG6Q.js";import{n as Yt}from"./stub-BMUhx6B5.js";function Xt(e){return{type:`guardrail`,guardrail:e}}function Zt(e,t,n,r=`redact`,i){if(n.length!==0)return Xt({stage:e,trust:t,action:r,hits:n,...i?{provenance:i}:{}})}function Qt(e,t){return e.type===`guardrail`?{...e,guardrail:Tt(e.guardrail,t)}:e}var $t=65536;function F(e){let t=e.classStarts.length,n=new Uint16Array($t);for(let r=0;r<t;r++)n.fill(r,e.classStarts[r],e.classStarts[r+1]??$t);let r=e.charsets.map(e=>{let n=new Uint8Array(t);for(let t of e)n[t]=1;return n}),i=e.nodes.length,a=new Int32Array(i),o=new Uint8Array(i),s=[];return e.nodes.forEach((e,t)=>{a[t]=e[0],o[t]=e[1],s.push(Int32Array.from(e.slice(2)))}),{classOf:n,has:r,pattern:a,final:o,edges:s,initials:e.initials,leads:e.leads,size:i}}var en,I,tn;async function nn(){if(en)return;let{FORWARD_AUTOMATON:t,REVERSED_AUTOMATON:n}=await e(async()=>{let{FORWARD_AUTOMATON:e,REVERSED_AUTOMATON:t}=await import(`./egress-automata-SiHQTP1i.js`);return{FORWARD_AUTOMATON:e,REVERSED_AUTOMATON:t}},[]);en={forward:t,reversed:n}}function rn(){if(!en)throw Error(`A stream was opened before loadEgressAutomata() finished.`);return en}var L;function an(e){let t=String.fromCharCode(e).toUpperCase();if(t.length!==1)return e;let n=t.charCodeAt(0);return e>=128&&n<128?e:n}function on(e){if(!L){L=new Map;for(let e=0;e<$t;e++){let t=an(e),n=L.get(t);n?n.push(e):L.set(t,[e])}}return L.get(an(e))??[e]}function sn(e){let t=[0];for(let n of e)t.at(-1)!==n&&t.push(n),n+1<$t&&t.push(n+1);return t}var cn=new Map;function ln(e){let t=cn.get(e);if(t)return t;let n=Array.from({length:e.length},(t,n)=>on(e.charCodeAt(n))),r=sn([...new Set(n.flat())].sort((e,t)=>e-t)),i=e=>r.indexOf(e),a=F({classStarts:r,charsets:n.map(e=>e.map(i)),initials:[0],leads:[-1],nodes:[...n.map((e,t)=>[0,0,t+1,t]),[0,1]]});return cn.set(e,a),a}function un(e){let t=JSON.stringify(e),n=cn.get(t);if(n)return n;let r=[...new Set(e.flatMap(e=>Array.from(e,e=>e.charCodeAt(0))))];r.sort((e,t)=>e-t);let i=sn(r),a=r.map(e=>[i.indexOf(e)]),o=[],s=F({classStarts:i,charsets:a,initials:e.map((e,t)=>{let n=o.length;for(let n=0;n<e.length;n++)o.push([t,0,o.length+1,r.indexOf(e.charCodeAt(n))]);return o.push([t,1]),n}),leads:e.map(()=>-1),nodes:o});return cn.set(t,s),s}function dn(e,t){let n=e.has[0]?.length??0,r=Array.from({length:n},()=>[]);for(let i of t){let t=e.edges[e.initials[i]];for(let i=0;i<t.length;i+=2){let a=e.has[t[i+1]];for(let e=0;e<n;e++)a[e]&&r[e]?.push(t[i])}}return r.map(e=>Int32Array.from(e))}function fn(e,t){e.text+=t,e.fresh+=t}function pn(e){return e.text.length-e.fresh.length}function R(e,t){let n=pn(e);return t>=n?e.fresh.charCodeAt(t-n):e.text.charCodeAt(t)}function mn(e,t,n=e.text.length){let r=pn(e);return t>=r?e.fresh.slice(t-r,n-r):e.text.slice(t,n)}function hn(e){let t={text:``,fresh:``,rawAt:e=>e,update(){t.text=e.text,t.fresh=e.fresh}};return t}function gn(e,t){let n={text:``,fresh:``,rawAt:e.rawAt,update(){n.fresh=``,fn(n,t(mn(e,n.text.length)))}};return n}var _n=/\w/,vn=Math.max(...tt.map(e=>e.length));function yn(e){return e.length<=vn+1&&/^[A-Za-z]*$/.test(e)}function bn(e){let t=0,n,r=!1,i=[],a=(e,t,n)=>{fn(o,e);for(let r=0;r<e.length;r++)i.push(t+Math.min(r,n-1))},o={text:``,fresh:``,rawAt:r=>e.rawAt(r<i.length?i[r]:t-(n?.length??0)),update(){o.fresh=``;for(let i=e.text.length;t<i;t++){let i=String.fromCharCode(R(e,t)),o=_n.test(i);o&&!r&&(n=``),r=o,o?n===void 0?a(i,t,1):n+=i:(n!==void 0&&a(_t(n),t-n.length,n.length),n=void 0,a(i,t,1))}n!==void 0&&!yn(n)&&(a(n,t-n.length,n.length),n=void 0)}};return o}function xn(e){let t={text:``,fresh:``,from:[],rawAt:n=>n<t.from.length?t.from[n]:e(),update(){}};return t}function z(e,t,n){fn(e,t);for(let r=0;r<t.length;r++)e.from.push(n)}var Sn=55296,Cn=56319,wn=/[A-Za-z]/,Tn=56320,En=57343;function Dn(e){let t=0,n=``,r=[],i=``,a=[],o=!1,s=-1,c=xn(()=>Math.min(t,r[0]??t,a[0]??t,s<0?t:s));function l(e,t){s>=0&&(wn.test(e)||z(c,`\\`,s),s=-1),e===`\\`?s=t:z(c,e,t)}function u(e,t){if(Ye(e)&&(o||i)){i+=e;for(let n=0;n<e.length;n++)a.push(t)}else{if(i){if(!wn.test(e))for(let e=0;e<i.length;e++)l(i[e],a[e]);i=``,a=[]}for(let n=0;n<e.length;n++)l(e[n],t);o=wn.test(e)&&e.length===1}}function d(){let e=0;for(;e<n.length;){let t=n.charCodeAt(e),i=t>=Sn&&t<=Cn;if(i&&e+1>=n.length)break;let a=n.charCodeAt(e+1),o=i&&a>=Tn&&a<=En?2:1;u(n.slice(e,e+o),r[e]),e+=o}n=n.slice(e),r=r.slice(e)}return c.update=()=>{c.fresh=``;let i=e.text.length;for(;t<i;){let a=R(e,t),o=a>=Sn&&a<=Cn;if(o&&t+1>=i)break;let s=R(e,t+1),c=o&&s>=Tn&&s<=En?2:1,l=ht(mn(e,t,t+c));n+=l;for(let e=0;e<l.length;e++)r.push(t);t+=c}d()},c}var On=/[0-9A-Fa-f]/;function kn(e){let t=0,n=-1,r=xn(()=>n<0?t:n);r.update=()=>{r.fresh=``;let a=e.text.length;for(;t<a;){let a=String.fromCharCode(R(e,t));if(n<0){a===`%`?n=t:(z(r,a,t),t++);continue}let o=(t-n)%3;if(o===0?a===`%`:On.test(a))t++;else{i(t-o);for(let n=t-o;n<t;n++)z(r,String.fromCharCode(R(e,n)),n)}}};function i(t){t>n&&z(r,ft(mn(e,n,t)),n),n=-1}return r}var An=new Set([`injection`,`base64`,`hex`,`spaced`,`pipe`]),jn=new Map(Qe.map(({pattern:e,hit:t})=>[e,t])),Mn=new Map(Rt.flatMap(({pattern:e,hit:t})=>t?[[e,t]]:[]));function B(e){return{rule:Ht(e),severity:`high`,detector:e}}var Nn=B(`injection`),Pn=B(`marker_leak`),Fn=B(`tool_leak`);function In({kind:e,group:t}){if(An.has(e))return Nn;switch(e){case`sensitive`:case`card`:return t===void 0?void 0:B(t);case`boundary`:return Pn;case`image`:return B(`ungiven_images`);default:return B(`ungiven_links`)}}function Ln(e,t,n){if(e===`card`)return{hit:Nt};if(e===`image`||e===`link`){let r=(e===`image`?Lt:Dt).indexOf(t),i=n[e][r];return`find`in i?{find:i.find}:{hit:i.test}}let r=jn.get(t)??Mn.get(t);return r?{hit:r}:{}}function Rn(e,{given:t,allow:n,skipImages:r}){let i=e=>({...e,...t?{given:t}:{}}),a={image:zt(i(n?.ungiven_images)),link:wt(i(n?.ungiven_links),r??e.includes(`ungiven_images`))},o=[];return lt.forEach((t,n)=>{let r=In(t);r?.detector&&e.includes(r.detector)&&o.push({...r,id:n,regex:Je(t.pattern),...Ln(t.kind,t.pattern,a)})}),o}function zn(){let e=[];return lt.forEach(({kind:t,pattern:n},r)=>{if(t!==`injection`)return;let i=jn.get(n);e.push({...Nn,id:r,regex:Je(n),...i?{hit:i}:{}})}),e}function Bn(){return bt.map((e,t)=>({...Nn,id:t,regex:new RegExp(e.source,e.flags)}))}function Vn(e,t,n){let r=dn(t,n.map(e=>e.id)),i=new Int32Array(t.initials.length).fill(-1);n.forEach((e,t)=>{i[e.id]=t});let a=new Int32Array(t.size),o=new Int32Array(t.size),s=new Int32Array(t.size),c=new Int32Array(t.size),l=0,u=new Int32Array(t.size),d=new Int32Array(t.size),f=0,p=0,m=new Uint8Array(n.length),h=new Uint8Array(n.length),g=new Int32Array(n.length),_=new Int32Array(n.length),v=new Uint8Array(n.length),y=Uint8Array.from(n,e=>+!!e.find),b=new Int32Array(n.length).fill(-1),x=new Int32Array(n.length).fill(-1),S=Int32Array.from(n,e=>t.leads[e.id]??-1),ee=[...new Set(S)].filter(e=>e>=0),te=n.flatMap((e,t)=>S[t]<0?[]:[t]),C=new Int32Array(t.has.length).fill(-1);function w(){let{text:n,fresh:h}=e,g=pn(e),{classOf:_,has:v,edges:te,final:w,pattern:T}=t;for(;p<n.length;p++){let e=_[p>=g?h.charCodeAt(p-g):n.charCodeAt(p)];f++;let t=0,ne=(e,n)=>{if(d[e]===f){let t=u[e];n<c[t]&&(c[t]=n)}else d[e]=f,u[e]=t,s[t]=e,c[t]=n,t++,w[e]&&(m[i[T[e]]]=1)};for(let t=0;t<l;t++){let n=te[a[t]],r=o[t];for(let t=0;t<n.length;t+=2)v[n[t+1]][e]&&ne(n[t],r)}let E=r[e];for(let e=0;e<E.length;e++){let t=E[e],n=i[T[t]],r=S[n],a=r<0?-1:C[r],o=a<0?p:a;ne(t,o),y[n]&&(x[n]=p,b[n]<0&&(b[n]=o))}for(let t of ee)v[t][e]?C[t]<0&&(C[t]=p):C[t]=-1;[a,s]=[s,a],[o,c]=[c,o],l=t}}function T(){let n=e.text.length;_.fill(n),v.fill(0);let r=n;for(let e=0;e<l;e++){let n=a[e],s=i[t.pattern[n]],c=o[e];c<_[s]&&(_[s]=c),t.final[n]&&(v[s]=1),c<r&&(r=c)}for(let e of te){let t=C[S[e]];t<0||(t<_[e]&&(_[e]=t),t<r&&(r=t))}return r}function ne(t,r){let i=b[t],a=g[t];if(i<0||i>=r){g[t]=r;return}let{find:o,rule:s,severity:c,detector:l}=n[t],u=o?.(e.text,a,r);if(u===void 0)g[t]=r,b[t]=x[t]>=r?r:-1;else return g[t]=Math.max(a,u)+1,{rule:s,severity:c,start:e.rawAt(u),detector:l}}let E={text:``,lower:``},D=()=>(E.text!==e.text&&(E={text:e.text,lower:e.text.toLowerCase()}),E.lower);function re(t,r){if(!m[t]&&!h[t]){g[t]=r;return}m[t]=0;let i=e.text,{regex:a,hit:o,rule:s,severity:c,detector:l}=n[t];for(a.lastIndex=g[t];;){let n=a.exec(i);if(!n||n.index>=r){g[t]=r,h[t]=n||v[t]?1:0;return}let[u]=n;if(u&&(!o||o(u,i,n.index,D)))return g[t]=a.lastIndex,h[t]=1,{rule:s,severity:c,start:e.rawAt(n.index),detector:l};u||a.lastIndex++,g[t]=a.lastIndex}}function O(){for(let e=0;e<n.length;e++){let t=_[e];if(t<=g[e])continue;let r=n[e].find?ne(e,t):re(e,t);if(r)return r}}return{run(t){w();let n=T();for(let e=O();e;e=O())t.push(e);return e.rawAt(n)}}}var Hn=new WeakMap;function Un(e){let t=Hn.get(e);return t||(t=F(e),Hn.set(e,t)),t}function Wn(e={}){let t={text:``,fresh:``},n=hn(t),r=[n],i=(e,t,n)=>(r.includes(e)||r.push(e),Vn(e,t,n)),a=[],o=e.detect??[],s=Rn(o,e);if(s.length>0&&(I??=F(rn().forward),a.push(i(n,I,s))),o.includes(`injection`)){I??=F(rn().forward),tn??=F(rn().reversed);let e=Dn(t),r=zn();a.push(i(n,tn,Bn()),i(bn(n),I,r),i(e,I,r),i(bn(e),I,r),i(gn(n,Ue),I,r),i(gn(n,e=>Wt(e)??e),I,r),i(kn(t),I,r))}if(o.includes(`marker_leak`)&&e.note){let t=Ct(e.note);a.push(i(n,ln(e.note),[{...Pn,id:0,regex:t}]))}if(o.includes(`tool_leak`)&&e.tools){let t=vt(e.tools),r=t.map(({regex:e},t)=>({...Fn,id:t,regex:e}));t.length>0&&a.push(i(n,un(t.map(({literal:e})=>e)),r))}for(let{detector:t,compiled:r,matchers:o}of e.own??[]){let e=o.map(({regex:e},n)=>({...B(t),id:n,regex:new RegExp(e.source,e.flags)}));a.push(i(n,Un(r.automaton),e))}let c=0;return{push(e){t.text+=e,t.fresh=e;for(let e of r)e.update();let n=[],i=t.text.length;for(let e of a)i=Math.min(i,e.run(n));return c=i,n},holdFrom:()=>c}}function Gn(e,t,n={},r=[]){let i=Ke(e,t).filter(e=>!($e(e)||r.includes(e))),a=Xe(e,t);if(i.length===0&&a.length===0)return;let o=[...i,...a.map(({id:e})=>e)],s=t.sources??{},c=[...i.map(e=>({detector:e,...s[e]})),...a.map(({id:e,matchers:t,compiled:n})=>({detector:e,matchers:t,compiled:n}))],l=c.some(({matchers:e,compiled:t})=>e?.length&&!t),u=Wn({detect:i.filter(e=>s[e]?.theorem!==!1),own:c.flatMap(({detector:e,compiled:t,matchers:n=[]})=>t?[{detector:e,compiled:t,matchers:n}]:[]),skipImages:t.ungiven_images[e]!==`ignore`,...n.allow?{allow:n.allow}:{},...n.givenUrls?{given:n.givenUrls}:{},...n.note?{note:n.note}:{},...n.ownTools?{tools:n.ownTools}:{}}),d=a.some(({find:e})=>e),f=e===`live_reply`?96:256,p=``,m=[];return{push(e){p+=e;for(let{start:t,detector:n}of u.push(e))n&&m.push({start:t,detector:n})},holdFrom(){if(l)return 0;let e=u.holdFrom();return d?Math.min(e,Math.max(0,p.length-f)):e},take(r,i,a=!1){let s=m.filter(({start:e})=>e<i);if(s.length===0&&!a&&!d)return{action:`allow`,text:p.slice(r,i),hits:[],taken:i-r};let c={from:r,to:i,settled:s.map(({detector:e})=>e)},l=ct(p,c,e,t,{detectors:o,scope:n});return m=m.filter(({start:e})=>e>=r+l.taken),l}}}function Kn(e){let{context:t}=e,n=e.detect,r=n?Gn(n.boundary,n.matrix,n.scope):void 0,i=e=>n?n.matrix[e][n.boundary]:`block`,a=i(`canary_leak`),o=i(`prompt_leak`),s=t.canaryGiven||a===`ignore`?void 0:t.canary,c=o===`ignore`?void 0:t.privateSystem,l=s!==void 0||c!==void 0,u=l?e.carry??``:``,d=[],f=new Set,p=``,m=0,h=``,g=u.slice(-P),_=u,v=0,y=u,b=0,x=0,S=s?mt(s):void 0;S?.push(u);function ee(e){let n=[];if(S?.push(e)&&n.push([a,Et]),c){let r=_.length;_+=e;let i=qe(_,r);_=_.slice(i),v+=i;let[a]=xt(_,c,t.canary);a&&n.push([o,a])}for(let[e,t]of n)e!==`flag`||f.has(t.rule)||(f.add(t.rule),d.push(t));return n.filter(([e])=>e!==`flag`).map(([,e])=>e)}function te(e){let t=l?ee(e??``):[];return e&&r?.push(e),t.length===0?null:{hits:t,...n?{boundary:n.boundary}:{}}}function C(){let e=s&&a!==`flag`?T(s):h.length,n=c&&o!==`flag`?ne(c,t.canary):h.length;return m+Math.min(e,n)}function w(e){if(d.length===0)return e;let t=[...d,...e.found?.hits??[]];return d=[],{...e,found:{action:e.found?.action??`flag`,hits:t}}}function T(e){let t=u.length+m,n=Math.max(t,x),r=Math.max(b,n-P),i=r+St(y.slice(r-b),e);i<n&&n>t&&(y=g+h,b=t-g.length,i=b+St(y,e)),x=Math.min(i,u.length+p.length-P);let a=Math.max(b,Math.max(t,x)-P);return y=y.slice(a-b),b=a,Math.max(0,i-t)}function ne(e,t){let n=m===0?u:``,r=u.length+m-n.length,[i,a]=v>=r?[_,v]:[n+h,r];return Math.max(0,a+ot(i,e,t)-u.length-m)}function E(e){let t=te(e);if(t)return{blocked:!0,...t};let i=e===void 0,a=i?p.length:Math.min(C(),r?.holdFrom()??p.length),o=Math.max(0,a-m);if(!(n&&r))return w({blocked:!1,emit:D(o)});let s=r.take(m,m+o,i);return s.action===`block`||s.action===`redact`&&!n.rewrite?{blocked:!0,hits:s.hits,boundary:n.boundary}:(D(s.taken),w({blocked:!1,emit:s.text??``,...s.action===`allow`?{}:{found:{action:s.action,hits:s.hits}}}))}function D(e){let t=h.slice(0,e);return h=h.slice(e),m+=t.length,l&&(g=(g+t).slice(-P)),t}return{process(e){return e?(p+=e,h+=e,l&&(y+=e),E(e)):{blocked:!1,emit:``}},flush:()=>E(),accumulated:()=>p,unreleased:()=>h,drainUnreleased:()=>D(h.length),carryOut:()=>l?Ge(u+p,s,c):``}}function V(e,t,n){return at(t,e.detect,n)}async function qn(e,t,n,r){return V(e,[n],t)?(await nn(),Jn(e,t,n,r)):null}function Jn(e,t,n,r){return V(e,[n],t)?Kn({context:t,detect:{matrix:e.detect,boundary:n,rewrite:n===`reply`,scope:He(e,t)},...r?{carry:r}:{}}):null}async function Yn(e,t,n,r){return V(e,[n],r??t)?(await nn(),Kn({context:t,detect:{matrix:e.detect,boundary:n,rewrite:!1,scope:r??He(e,t)}})):null}var Xn=class{open;gate;constructor(e){this.open=e}async read(e){if(this.gate===void 0&&(this.gate=await this.open()),this.gate===`stopped`)return``;if(!this.gate)return e;let t=this.gate.process(e);return t.blocked?(this.gate=`stopped`,``):t.emit}end(){if(!this.gate||this.gate===`stopped`)return``;let e=this.gate.flush();return e.blocked?``:e.emit}},Zn=2,Qn=4,$n=3,er=/(^|,)(\s*)("?)(?:([=@])|([+-])(?![0-9."]))/gm,tr=/^[A-Za-z0-9+/]*={0,2}$/,nr=new Set([`text/csv`,`text/plain`,`text/markdown`]);function rr(e){let{maxFiles:t,maxBytes:n,maxTurnBytes:r,limitsByMime:i}=e;if(t&&n&&r)return{maxFiles:t,maxBytes:n,maxTurnBytes:r,limitsByMime:i}}function ir(e,t){if(t.limitsByMime){let n=Pe(e);if(t.limitsByMime[n])return t.limitsByMime[n];let[r]=n.split(`/`),i=`${r}/*`;if(t.limitsByMime[i])return t.limitsByMime[i]}return t.maxBytes}function ar(e){return`uri`in e}function or(e){if(e.type===`speech`)throw new M(`request`,`Profile ${e.id} (speech) does not accept media input`);if(e.type===`live`)throw new M(`request`,`Profile ${e.id} (live) does not accept turn attachment input`);if(e.type===`host`||e.type===`decision`||e.type===`embedding`)throw new M(`request`,`Profile ${e.id} (${e.type}) does not accept turn input`);let t=rr(e.inputs??{});if(!t)throw new M(`config`,`Profile ${e.id} must set maxFiles, maxBytes, and maxTurnBytes`);return t}function sr(e){let t=0;return e.endsWith(`==`)?t=Zn:e.endsWith(`=`)&&(t=1),Math.floor(e.length*$n/Qn)-t}function cr(e){try{return new TextDecoder(`utf-8`,{fatal:!0}).decode(e)}catch{return new TextDecoder(`latin1`).decode(e)}}function lr(e){return e.replace(er,(e,...t)=>{let[n,r,i,a,o]=t;return`${n}${r}${i}'${a??``}${o??``}`})}function ur(e,t,n){let r=cr(t);return e===`text/csv`&&(r=lr(r)),new TextEncoder().encode(n.read(r))}function dr(e,t){return t?{...e,fileName:t}:e}function fr(e,t,n){return t.filter(t=>!j(e,t.mimeType)).map(e=>dr({code:`mime_not_allowed`,params:{mimeType:e.mimeType,channel:n}},e.name))}function pr(e,t){let n=[];e.length>t.maxFiles&&n.push({code:`too_many_files`,params:{maxFiles:t.maxFiles}});let r=0;for(let i of e){if(i.sizeBytes===void 0)continue;let e=ir(i.mimeType,t);i.sizeBytes>e&&n.push(dr({code:`file_too_large`,params:{maxBytes:e}},i.name)),r+=i.sizeBytes}return r>t.maxTurnBytes&&n.push({code:`turn_too_large`,params:{maxTurnBytes:t.maxTurnBytes}}),n}function mr(e,t,n){let r=[];return t.length>0&&!e.attachments&&r.push({code:`attachments_not_accepted`,params:{channel:`attachment`}}),n.length>0&&!e.voice&&r.push({code:`voice_not_accepted`,params:{channel:`voice`}}),r.length>0||t.length===0&&n.length===0?r:(e.attachments&&r.push(...fr(e.attachments,t,`attachment`)),e.voice&&r.push(...fr(e.voice,n,`voice`)),e.limits?[...r,...pr([...t,...n],e.limits)]:[...r,{code:`limits_unconfigured`}])}var hr={mime_not_allowed:`attachments.mime_not_allowed`,too_many_files:`attachments.too_many_files`,too_many_of_kind:`attachments.too_many_of_kind`,file_too_large:`attachments.file_too_large`,turn_too_large:`attachments.turn_too_large`,attachments_not_accepted:`attachments.not_accepted`,voice_not_accepted:`attachments.not_accepted`,limits_unconfigured:`attachments.limits_unconfigured`};function gr(e){let t={};for(let[n,r]of Object.entries(e.params??{}))r!==void 0&&(t[n]=r);return e.fileName!==void 0&&(t.fileName=e.fileName),{key:hr[e.code],params:t}}function _r(e,t){let n=gr(e);return N(n.key,n.params,t)}function vr(e){return new M(`input`,`attachments refused: ${e.map(e=>e.code).join(`, `)}`,{copy:e.map(gr)})}function yr(e){if(!tr.test(e))throw new M(`request`,`attachment data must be base64`);return sr(e)}function br(e){let t={mimeType:e.mimeType,name:e.name};return ar(e)||(t.sizeBytes=yr(e.data)),t}function xr(e,t,n){if(!Cr(t,n))return;let r=or(e),i=mr({attachments:ye(e,`attachments`),voice:ye(e,`voice`),limits:r},(t??[]).map(br),(n??[]).map(br));if(i.length>0)throw vr(i)}function Sr(e,t){if(ar(e))return e;let{mimeType:n,data:r}=e;if(!nr.has(Pe(n)))return e;let i=ur(n,Pt(r),t);return{...e,data:jt(i)}}function Cr(e,t){return(e?.length??0)>0||(t?.length??0)>0}function wr(e,t,n,r){return xr(e,t,n),{attachments:t?.length?t.map(e=>Sr(e,r.attachment)):t,voice:n?.length?n.map(e=>Sr(e,r.voice)):n}}var Tr=`
|
|
2
|
+
|
|
3
|
+
`;function Er(e){if(typeof e==`string`)return;if(typeof e!=`object`||!e||Array.isArray(e))return`must be a string or { private: string }`;let t=Object.keys(e);if(t.length!==1||t[0]!==`private`)return`must have exactly one key, private`;let n=e.private;if(typeof n!=`string`)return`must be a string`;if(n===``)return`must not be empty`}function Dr(e,t){if(typeof e!=`string`){if(!Array.isArray(e))return`${t} must be a string or an array of parts`;if(e.length===0)return`${t} must not be an empty array`;for(let[n,r]of e.entries()){let e=Er(r);if(e)return`${t}[${n}]${typeof r==`object`&&r&&`private`in r?`.private`:``} ${e}`}}}function Or(e,t){let n=Dr(e,t);if(n)throw new M(`config`,n)}function kr(e,t,n){return Or(e,t),typeof e==`string`?n(e):e.map(e=>typeof e==`string`?n(e):{private:n(e.private)})}function Ar(e){if(typeof e==`string`)return[{text:e,private:!0}];let t=e.some(e=>typeof e!=`string`);return e.map(e=>typeof e==`string`?{text:e,private:!t}:{text:e.private,private:!0})}function jr(e){let t=[];for(let n of e)n.some(e=>e.text)&&(t.length>0&&t.push({text:Tr,private:!0}),t.push(...n));return t}function Mr(e){return e.map(e=>e.text).join(``)}function Nr(e){let t=[],n=``;for(let r of e)r.private?n+=r.text:(n.trim()&&t.push(n),n=``);return n.trim()&&t.push(n),{text:Mr(e),private:t}}function Pr(e,t){return Nr(jr([e,...t.map(e=>e?[{text:e,private:!0}]:[])]))}var Fr=[`user`,`slots`,`repair`,`attachment`,`voice`,`history`,`system`];function Ir(e,t){return e&&Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t.read(n)]))}var Lr={client:`untrusted`,server:`assembled`};function Rr(e){return typeof e==`string`?e:JSON.stringify(e)}function zr(e,t){let n=[],r=!1;if(!e)return{context:e,events:n,blocked:r};let i={};for(let a of k){let o=e[a];if(o===void 0)continue;let s=t();i[a]=s.read(Rr(o));let c=s.found(),l=nt(`context`,c);l&&n.push({...l,trust:Lr[a]}),r||=c.action===`block`}return{context:i,events:n,blocked:r}}var Br=/^[A-Za-z0-9._-]+$/;function Vr(e){let t=e?.trim();return t&&Br.test(t)?t:void 0}function Hr(e,t){if(!e)return e;let n=e.guidance?t.read(e.guidance):void 0;return{previousOutput:t.read(e.previousOutput),rejection:t.read(e.rejection),...n?{guidance:n}:{}}}function Ur(e,t){return e.map(e=>{let n=e.content===void 0?void 0:t.read(e.content),r=e.parts?.map(e=>e.type===`text`?{...e,text:t.read(e.text)}:e);return{role:e.role,...n===void 0?{}:{content:n},...r?{parts:r}:{},...e.tool_calls?{tool_calls:e.tool_calls}:{},...e.tool_call_id?{tool_call_id:e.tool_call_id}:{},...e.name?{name:e.name}:{},...e.metadata?{metadata:e.metadata}:{},...e.reasoning?{reasoning:e.reasoning}:{}}})}function Wr(e,t){let n=t?`: ${t}`:``;return new M(`input`,`guardrails.detect blocked the request at ${e}${n}`,{copy:{key:`detect.blocked`}})}function Gr(e,t){let{detect:n}=Ie(t.guardrails),r=We(Fr,e=>Be(e,n)),i=e.input??{},a=i.text===void 0?void 0:r.user.read(i.text),o=e.system===void 0?void 0:kr(e.system,`TurnRequest.system`,e=>r.system.read(e)),s=Ir(i.slots,r.slots),c=zr(i.context,()=>Be(`context`,n)),l=Hr(i.repair,r.repair),u=i.history?Ur(i.history,r.history):void 0,{attachments:d,voice:f}=i.attachments?.length||i.voice?.length?wr(t,i.attachments,i.voice,r):i,p=[],m;for(let e of Fr){let t=r[e].found(),n=nt(e,t);n&&p.push(Xt(n)),t.action===`block`&&(m??=Wr(e,t.errorInternal))}return p.push(...c.events.map(Xt)),c.blocked&&(m??=Wr(`context`)),{request:{...e,system:o,projectId:Vr(e.projectId),input:{...i,text:a,slots:s,...c.context?{context:c.context}:{},repair:l,history:u,attachments:d,voice:f}},events:p,...m?{refusal:m}:{}}}function Kr(e,t){let{request:n,refusal:r}=Gr(e,t);if(r)throw r;return n}function qr(e){let t=Object.keys(e);return t.length===1?t[0]:void 0}function Jr(e,t){return[...new Set([...t.filter(t=>j(e,t)),...e.filter(e=>j(t,e))])]}function Yr(e,t){let n=e.attachments?t?Jr(e.attachments.accept,t.media.flatMap(e=>e.accept)):[...e.attachments.accept]:[],r=(t?.media??[]).flatMap(e=>e.maxPerInput===void 0?[]:[{accept:[...e.accept],max:e.maxPerInput}]);return{text:e.text!==!1,...n.length>0?{attachments:{accept:n}}:{},...e.maxFiles===void 0?{}:{maxFiles:e.maxFiles},...e.maxBytes===void 0?{}:{maxBytes:e.maxBytes},...e.maxTurnBytes===void 0?{}:{maxTurnBytes:e.maxTurnBytes},...e.limitsByMime===void 0?{}:{limitsByMime:{...e.limitsByMime}},...t?.maxInputs===void 0?{}:{maxInputs:t.maxInputs},...r.length>0?{perInput:r}:{}}}function Xr(e){let t=Pe(e[0]??``);return t===`application/pdf`?`PDF`:t.split(`/`)[0]??t}function Zr(e,t){let n=rr(e),r=mr({attachments:e.attachments?.accept,...n?{limits:{...n,maxFiles:2**53-1}}:{}},t.flat(),[]);if(n)for(let i of t){i.length>n.maxFiles&&r.push({code:`too_many_files`,params:{maxFiles:n.maxFiles}});for(let t of e.perInput??[])i.filter(e=>j(t.accept,e.mimeType)).length>t.max&&r.push({code:`too_many_of_kind`,params:{maxFiles:t.max,kind:Xr(t.accept)}})}let i=new Set;return r.filter(e=>{let t=JSON.stringify(e);return!i.has(t)&&(i.add(t),!0)})}var Qr=`final_answer`;function $r(e){return e.structured!==null&&e.tools.wire.length>0}function ei(e,t,n){let{structured:r}=t;if(!r||!$r(t))return e;let i={type:`function`,name:Qr,description:N(`structured.answer_tool`,{},n),parameters:r.jsonSchema};return{...e,structured:null,wireTools:[...e.wireTools??[],i]}}function ti(e,t){let n=e.get(t);return n!==void 0&&n.type!==`builtin`}function ni(e,t){return!e||e.includes(`*`)?!0:t?e.includes(t):!1}function ri(e,t){return t.filter(n=>{let r=e.get(n);return r?.type!==`builtin`||!(r.conflictsWith??[]).some(e=>t.includes(e))})}function H(e){return`tools`in e?e.tools.allow:[]}function ii(e){return e.type===`text`||e.type===`image`?e.tools:void 0}function ai(e){return`tools`in e?e.tools.parallel:void 0}function oi(e,t,n){return H(t).filter(r=>{let i=e.get(r);return!i||i.type===`builtin`?!1:t.type===`host`||ni(i.paths,n.path)})}function si(e,t,n,r){let i=t.models[r];return i?(i.builtInTools??[]).filter(t=>{let r=e.get(t);return r?.type===`builtin`&&ni(r.paths,n.path)}):[]}function ci(e,t){let n=e.get(t);if(n&&n.type!==`builtin`)return{type:`function`,name:n.name,description:n.description,parameters:n.inputSchema}}function li(e,t){let n=[];for(let r of t){let t=ci(e,r);t&&n.push(t)}return n}function ui(e,t,n){if(t.visible.includes(n))return;t.visible.push(n);let r=ci(e,n);r&&!t.wire.some(e=>e.name===n)&&t.wire.push(r)}function di(e,t,n){if(t.builtins.includes(n))return;let r=e.get(n);if(r?.type!==`builtin`)return;let i=r.conflictsWith??[];t.builtins=t.builtins.filter(t=>{if(i.includes(t))return!1;let r=e.get(t);return!(r?.type===`builtin`&&r.conflictsWith?.includes(n))}),t.builtins.push(n)}function fi(e,t,n){return t.type===`live`||t.type===`host`?[...n]:n.filter(t=>e.get(t)?.loadTier===`T0`)}function pi(e,t,n){return ri(e,n.filter(n=>{let r=e.get(n);return r?.type===`builtin`&&(t.type===`live`||r.loadTier===`T0`)}))}function mi(e,t,n,r){let i=oi(e,t,n),a=t.type===`host`||t.type===`decision`||t.type===`embedding`||r===void 0?[]:si(e,t,n,r),o=[...i,...a],s=pi(e,t,o),c=fi(e,t,o);return{builtins:s,gated:o,visible:c,executable:c.filter(t=>ti(e,t)),path:n.path,sessionPermissions:n.sessionPermissions,wire:li(e,c)}}async function hi(e,t,n,r){let i=mi(e,t,n,r);return await _i(e,i,t,n),i}function gi(e){return{builtins:[...e.builtins],gated:[...e.gated],visible:[...e.visible],executable:[...e.executable],path:e.path,sessionPermissions:e.sessionPermissions?[...e.sessionPermissions]:void 0,wire:e.wire.map(e=>({...e,parameters:structuredClone(e.parameters)}))}}async function _i(e,t,n,r){let i=ii(n)?.t1Policy;if(!i)return;let a;try{a=await i({profile:n,input:r.input,path:r.path,sessionPermissions:r.sessionPermissions,gated:t.gated,host:r.host})}catch(e){let t=e instanceof Error?e.message:String(e);throw new M(`config`,`Profile '${n.id}' tools.t1Policy rejected: ${t}`,{cause:e})}if(!Array.isArray(a))throw new M(`config`,`Profile '${n.id}' tools.t1Policy must return ToolId[]`);for(let n of a){if(!t.gated.includes(n))continue;let r=e.get(n);r?.loadTier===`T2`&&(r.type===`builtin`?di(e,t,n):ui(e,t,n))}t.executable=t.visible.filter(t=>ti(e,t))}var vi=new Set([`__proto__`,`constructor`,`prototype`]);function yi(e){if(!At(e))return;let{loaded:t}=e;if(Array.isArray(t)&&t.every(e=>typeof e==`string`))return t}function bi(e,t,n,r){if(r.type===`live`||r.type===`host`)return{promoted:[]};let i=[];for(let a of n){if(typeof a!=`string`||vi.has(a))return{promoted:[],failure:{code:`invalid_output`,kind:`bad_response`,message:`tools.t2Loader loaded ids must be plain strings`}};let n=Si(e,a,r);if(`failure`in n)return{promoted:[],failure:n.failure};let{tool:o}=n;ni(o.paths,t.path)&&t.gated.includes(a)&&i.push(a)}let a=[];for(let n of i)ui(e,t,n),a.push(n);return t.executable=t.visible.filter(t=>ti(e,t)),{promoted:a}}function xi(e){return{failure:{code:`invalid_output`,kind:`bad_response`,message:e}}}function Si(e,t,n){if(!H(n).includes(t))return xi(`tools.t2Loader attempted to promote tool '${t}' outside profile allow`);let r=e.get(t);return r?r.type===`builtin`?xi(`tools.t2Loader attempted to promote builtin '${t}' — only custom tools may be promoted`):r.loadTier===`T2`?{tool:r}:xi(`tools.t2Loader attempted to promote tool '${t}' with loadTier '${r.loadTier}' — only T2 tools may be promoted`):xi(`tools.t2Loader attempted to promote unknown tool '${t}'`)}function Ci(e,t){return e.get(t)||{name:t,missing:!0}}function wi(e){let t=new Set;if(e.type===`host`||e.type===`decision`||e.type===`embedding`)return[];for(let n of Object.values(e.models))for(let e of n.builtInTools??[])t.add(e);return[...t]}function Ti(e,t){return[...H(t),...wi(t)].map(t=>Ci(e,t))}function Ei(e,t){if(Array.isArray(e)){for(let n of e)Ei(n,t);return}if(typeof e!=`object`||!e)return;let{properties:n,...r}=e;if(typeof n==`object`&&n)for(let[e,r]of Object.entries(n))t.add(e),Ei(r,t);for(let e of Object.values(r))Ei(e,t)}function Di(e,t){let n=Ti(e,t);if(n.length===0)return;let r=new Set;for(let e of n)`inputSchema`in e&&Ei(e.inputSchema,r);return{names:n.map(({name:e})=>e),params:[...r]}}function Oi(e){return!e||e.length===0?[]:e.slice(-4)}function ki(e,t){if(e.length===0)return``;let n=e.map(e=>`${e.role===`user`?`User`:`Assistant`}: ${e.content}`);return`${N(`repair.history_heading`,{count:e.length},t)}\n${n.join(`
|
|
4
|
+
`)}\n\n`}function Ai(e){let{profile:t,repair:n,history:r}=e,i=n.guidance||N(`repair.default_guidance`,{},t.labels),a=ki(Oi(r),t.labels),o=`${N(`repair.prompt_header`,{},t.labels)}\n\n`;return o+=`${N(`repair.prompt_intro`,{},t.labels)}\n\n`,o+=`${N(`repair.section_previous_output`,{},t.labels)}\n\`\`\`\n${n.previousOutput.trim()}\n\`\`\`\n\n`,o+=`${N(`repair.section_validator_rejection`,{},t.labels)}\n${n.rejection.trim()}\n\n`,i.trim()&&(o+=`${N(`repair.section_repair_guidance`,{},t.labels)}\n${i.trim()}\n\n`),a&&(o+=a),o+=`${N(`repair.section_instructions`,{},t.labels)}\n`,o+=N(`repair.prompt_instructions`,{},t.labels),o}function ji(e){return Array.isArray(e)?[...e]:e.choices.map(e=>e.value)}function Mi(e){return Array.isArray(e)?{choices:e.map(e=>({value:e}))}:{...e.label!==void 0&&e.label!==``?{label:e.label}:{},choices:e.choices.map(e=>({value:e.value,...e.description!==void 0&&e.description!==``?{description:e.description}:{}}))}}function Ni(e){if(e)return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,Mi(t)]))}function Pi(e){return e?.slots?{...e,slots:Ni(e.slots)}:e}function Fi(e,t){let n=[];return t&&n.push(`structured`),e.type===`image`&&n.push(`image`),e.type===`speech`&&n.push(`speech`),n}function Ii(e,t){let n=Fi(e,t);if(!(n.length<=1))throw new M(`config`,`Profile ${e.id} declares multiple output wire formats (${n.join(`, `)}). Only one of a structured JSON schema (outputs.structured), image, or speech may be active.`)}function Li(e,t){if(e.type!==`speech`){if(t.speech)throw new M(`request`,`Profile ${e.id} (${e.type}) takes no speech settings — only a speech profile speaks`)}else if(t.system)throw new M(`config`,`Profile ${e.id} (speech) takes no system prompt — the input text is the transcript`)}function Ri(e,t){return e.type===`speech`?{...e.speech,...zi(t.speech)}:void 0}function zi(e){return Object.fromEntries(Object.entries(e??{}).filter(([,e])=>e!==void 0))}function Bi(e){if(e.type!==`image`)return null;let t=e.image;return{type:`image`,mimeType:t.mimeType,aspectRatio:t.aspectRatio,resolution:t.resolution,quality:t.quality,background:t.background,n:t.n,seed:t.seed,outputCompression:t.outputCompression,includeText:t.includeText===!0}}function Vi(e){let t=Oe(e);if(!t)throw new M(`input`,`MIME '${e}' is not a supported media input type`);return t}function Hi(e){return e.map(e=>{let t=Vi(e.mimeType),n=Pe(e.mimeType),r=n===`image/jpg`?`image/jpeg`:n;return ar(e)?{type:t,mimeType:r,uri:e.uri}:{type:t,mimeType:r,data:e.data}})}function Ui(e,t){let{text:n,repair:r,history:i}=t.input??{};if(e.type===`speech`&&!n?.trim())throw new M(`request`,`Profile ${e.id} (speech) requires text input`);if(A(e)?.text===!1&&n)throw new M(`request`,`Profile ${e.id} does not accept text input`);let a=r?Ai({profile:e,repair:r,history:i}):Gi(e,t)??n;if(e.type===`speech`)return a?{type:`text`,text:a}:null;let o=[...Wi(t),...a?[it(a)]:[]];return o.length>0?{type:`text`,text:o.join(`
|
|
5
|
+
|
|
6
|
+
`)}:null}function Wi(e){let t=e.input?.context??{};return[...k].reverse().filter(e=>t[e]!==void 0).map(e=>kt(e,Rr(t[e])))}function Gi(e,t){if(t.continueFrom&&ce.includes(e.type)){if(t.input?.text)throw new M(`request`,`Profile ${e.id}: a continueFrom turn takes no input.text — its user message is the continue instruction`);return N(`continue.instruction`,{},e.labels)}}function Ki(e){return e.type===`image`&&e.image.references?Hi(e.image.references):[]}function qi(e,t){let n=t.input?.attachments??[],r=t.input?.voice??[];return[...Ki(e),...Hi(n),...Hi(r)]}function Ji(e,t){let n=[],r=Ui(e,t);return r&&n.push(r),n.push(...qi(e,t)),n}function Yi(e,t){let n=t.input?.slots;if(!n)return;let r=A(e)?.slots??{};for(let[t,i]of Object.entries(n)){let n=Object.hasOwn(r,t)?r[t]:void 0;if(!n)throw new M(`request`,`Profile ${e.id} has no slot '${t}'`);let a=ji(n);if(!a.includes(i))throw new M(`request`,`Profile ${e.id}: slot '${t}' takes ${a.join(`, `)}, not '${i}'`)}}function Xi(e,t){let n=t.input?.context;if(!n)return;let r=A(e)?.context;for(let[t,i]of Object.entries(n))if(i!==void 0){if(!k.includes(t)||!r?.from.some(e=>e===t))throw new M(`request`,`Profile ${e.id} takes no context from '${t}'`);if(Rr(i).length>r.maxChars)throw new M(`request`,`Profile ${e.id}: context from '${t}' is over inputs.context.maxChars (${String(r.maxChars)})`)}}var Zi=/\{([A-Za-z_][\w-]*)\}/g;function Qi(e,t,n,r){let i=A(e)?.slots;return i?t.replace(Zi,(t,a)=>{if(!Object.hasOwn(i,a))return t;let o=n&&Object.hasOwn(n,a)?n[a]:void 0;if(o===void 0)throw new M(`request`,`Profile ${e.id}: ${r} uses slot '${a}', and the request chose no value for it`);return o}):t}function $i(e,t){let{handle:n}=e.identity,r=e.type===`speech`?void 0:e.identity.systemByRole;return t&&r&&Object.hasOwn(r,t)?t:n}function ea(e,t,n){if(e.type===`speech`)return[];let{systemByRole:r,system:i}=e.identity,a=r?.[t]||i||``;return a?Ar(kr(a,`Profile ${e.id} identity.system`,t=>Qi(e,t,n,`identity.system`))):[]}function ta(e,t){return jr([ea(e,$i(e,t.input?.role),t.input?.slots),t.system===void 0?[]:Ar(t.system)])}function na(e){return e.type!==`host`&&e.type!==`decision`&&e.type!==`embedding`}function ra(e,t){if(na(e))return e;throw e.type===`host`?new M(`request`,`Profile ${e.id}: type 'host' never runs a model — ${t} is not supported; execute tools with invokeTool`):e.type===`embedding`?new M(`request`,`Profile ${e.id}: type 'embedding' runs through runEmbedding — ${t} is not supported`):new M(`request`,`Profile ${e.id}: type 'decision' runs through runDecision — ${t} is not supported`)}function ia(e,t){if(t){if(!e.allowModelSelect)throw new M(`request`,`Profile ${e.id} does not allow model selection`);if(!e.models[t])throw new M(`request`,`Unknown model '${t}' for ${e.id}`);return t}return e.defaultModel}function aa(e,t,n,r){let i=t.efforts;if(!i||Object.keys(i).length===0){if(r)throw new M(`request`,`Profile ${e.id} model '${n}' has no selectable efforts`);return}let a=Object.keys(i);if(r){if(!t.allowEffortSelect)throw new M(`request`,`Profile ${e.id} model '${n}' does not allow effort selection`);let a=i[r];if(!a)throw new M(`request`,`Unknown effort '${r}' for ${e.id} model '${n}'`);return a}return i[t.defaultEffort??a[0]]}function oa(e){if(e.summaries===!0)return`auto`;if(e.summaries===!1)return`none`}function sa(e,t){if(e.type===`live`)return null;let n=e.outputs?.structured;if(!n)return null;if(typeof n==`string`)return n;let r=t?.[n.by];if(r){let e=n.map[r];if(e)return e}return n.fallback}function ca(e){return e.type===`live`||e.outputs?.streaming?.mode!==`buffered`}function la(e,t){return e.type===`live`?`live`:`turn`}function ua(e,t){if(!t.continueFrom)return;if(e.type===`live`)throw new M(`request`,`Profile ${e.id}: type 'live' uses live.sessionResumption, not turnBehaviour.resumption/continueFrom`);let n=fe(e)?.maxContinues;if(n===void 0)return;let r=t.continuation;if(r===void 0)throw new M(`request`,`Profile ${e.id}: continueFrom requires TurnRequest.continuation when turnBehaviour.resumption.maxContinues is set`);if(r<1)throw new M(`request`,`Profile ${e.id}: continuation must be >= 1`);if(r>n)throw new M(`request`,`Profile ${e.id}: continuation ${r} exceeds turnBehaviour.resumption.maxContinues (${n})`)}function da(e,t){return V(Ie(t),[`live_reply`])?{...e,transcription:{...e?.transcription,output:!0}}:e}function fa(e){let{detect:t}=Ie(e.guardrails);return e.type!==`speech`&&It(t,`canary_leak`)?Vt():``}function pa(e,t,n,r){if(!r)return;let i={};for(let[a,o]of Object.entries(r)){if(!n.builtInTools?.includes(a))throw new M(`request`,`Profile ${e.id}: builtInArgs names '${a}', which model '${t}' does not list in builtInTools`);i[a]=o}return i}function ma(e,t,n){let r=ra(e.profiles.get(t.profile),`resolveTurn`);Yi(r,t),Xi(r,t);let i=Kr(t,r),a=i.input??{};ua(r,i);let o=n??ia(r,i.model),s=pe(r,o),c=mi(e.tools,r,i,o),l=c.builtins,u=sa(r,a.slots);if(Ii(r,u),u&&c.wire.some(e=>e.name===`final_answer`))throw new M(`config`,`Profile ${r.id}: a structured turn answers through '${Qr}', so no tool of its own may take that name`);Li(r,i);let d=pa(r,o,s,i.builtInArgs),f=la(r,s);return{profile:r,generation:{model:o,apiId:s.apiId,transport:f,stream:ca(r),thinking:aa(r,s,o,i.effort),summaries:oa(s),maxOutputTokens:s.maxOutputTokens,temperature:s.temperature,builtins:l,builtInArgs:d,sessionId:i.sessionId,tools:c,sessionPermissions:i.sessionPermissions,execution:i.execution,pageExecution:i.pageExecution,history:a.history,maxSteps:r.maxSteps??20,structured:u?{id:u,jsonSchema:e.schemas.get(u).jsonSchema}:null,image:Bi(r),speech:Ri(r,i),live:r.type===`live`?da(r.live,r.guardrails):void 0,input:Ji(r,i),canary:fa(r),resolvedSystem:ta(r,i),host:i.host}}}function ha(e){return e.type===`image`?e.image:null}function ga(e,t){let n=ra(t,`projectProfile`),{identity:r}=n,i=A(n)??null,a=n.type===`live`?null:n.outputs??null;return{id:n.id,type:n.type,handle:r.handle,models:n.models,defaultModel:n.defaultModel,allowModelSelect:n.allowModelSelect,maxSteps:n.maxSteps,tools:Ti(e,n),inputs:i,outputs:a,image:ha(n),speech:n.type===`speech`?n.speech:null,live:n.type===`live`?n.live:null}}function _a(e,t){return ga(e.tools,e.profiles.get(t))}function va(e){return e==null}function U(e){return va(e)||typeof e!=`object`||Array.isArray(e)?null:e}function ya(e){let t=U(e);return!t||t.type!==void 0&&t.type!==`object`?null:t}function ba(e){let t=e.required;return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}function xa(e){let t=e.properties;return U(t)??{}}function Sa(e,t){return e?`${e}.${t}`:t}function Ca(e,t){t.push({path:e,error:`required field '${e}' is missing`})}async function wa(e,t,n,r,i){if(!n)return;let a=await n(t,r);a.isValid||i.push({path:e,error:a.error||a.finding||`Validation failed for '${e}'`})}async function Ta(e){let{path:t,propSchema:n,child:r,isRequired:i,fields:a,slots:o,failures:s}=e;if(va(r)){i&&Ca(t,s);return}await wa(t,r,a?.[t],o,s);let c=ya(n),l=c?U(r):null;c&&l&&await Ea(c,l,t,a,o,s)}async function Ea(e,t,n,r,i,a){let o=xa(e),s=new Set(ba(e)),c=new Set([...Object.keys(o),...s]),l=U(t);for(let e of c)await Ta({path:Sa(n,e),propSchema:o[e],child:l?.[e],isRequired:s.has(e),fields:r,slots:i,failures:a})}async function Da(e,t,n,r){let i=ya(e);if(!i)throw new M(`config`,`structured validation requires a JSON Schema object root`);let a=[];if(!U(t)){for(let e of ba(i))Ca(e,a);return a}return await Ea(i,t,``,n,r,a),a}function Oa(e,t){let n=e;for(let e of t.split(`.`)){let t=ya(n);if(!t)return!1;let r=xa(t);if(!Object.hasOwn(r,e)&&!ba(t).includes(e))return!1;n=r[e]}return!0}function ka(e){return e.map(e=>e.error).join(`; `)}function Aa(e,t){let n=e;for(let e of t.split(`.`))n=U(n)?.[e];return n}function ja(e,t,n){let[r,...i]=t.split(`.`),a=U(e)??{};return r===void 0?e:{...a,[r]:i.length?ja(a[r],i.join(`.`),n):n}}async function Ma(e,t,n){let r=[];for(let[i,a]of Object.entries(t??{})){let t=Aa(e,i);if(Array.isArray(t))for(let[e,o]of t.entries()){let t=await a.check(o,n);t.isValid||r.push({path:i,index:e,item:o,reason:t.error||t.finding||`Validation failed for '${i}'`,onFail:a.onFail})}}return r}function Na(e,t){let n=e;for(let e of t.split(`.`)){let t=ya(n);if(!t)return;n=xa(t)[e]}let r=U(n);if(r?.type===`array`)return U(r.items)??void 0}var Pa=class extends Error{failure;constructor(e){super(e.message),this.failure=e}},Fa=new Set([`text`,`image`,`speech`]),Ia=g().regex(/\S/),La=t({mimeType:g(),data:m(),name:g().optional()}),Ra=t({mimeType:g(),uri:g(),name:g().optional()}),za=t({voice:g().optional(),style:g().optional(),speed:h().positive().optional()});function Ba(e){return t(Object.fromEntries(Object.entries(e).map(([e,t])=>{let n=ji(t);return[e,d(n).optional()]})))}var Va=new Set([`text`,`attachments`,`voice`,`slots`,`speech`]);function Ha(e,t){if(!e.hostFields)return{sent:t};let n={...t},r={};for(let t of Object.keys(e.hostFields))n[t]!==void 0&&(r[t]=n[t]);let{text:i,attachments:a,voice:o,slots:s,speech:c}=t;return{sent:{text:i,...a?{attachments:a}:{},...o?{voice:o}:{},...s?{slots:s}:{},...c?{speech:c}:{}},hostInput:r}}function Ua(e,n){let{inputs:r}=e,a={text:Ia};r?.attachments&&(a.attachments=l(i([La,Ra])).optional()),r?.voice&&(a.voice=l(La).optional()),r?.slots&&(a.slots=Ba(r.slots).optional()),e.type===`speech`&&(a.speech=za.optional());for(let e of n?.hostOnly??[]){if(!a[e])throw new M(`config`,`Tool '${n?.name}' keeps '${e}' for the host, which its profile does not take`);delete a[e]}for(let[e,t]of Object.entries(n?.fieldText??{})){let r=a[e];if(!r)throw new M(`config`,`Tool '${n?.name}' describes '${e}', which its profile does not take`);a[e]=r.describe(t)}for(let[e,t]of Object.entries(n?.hostFields??{})){if(Va.has(e))throw new M(`config`,`Tool '${n?.name}' declares the host field '${e}', which is a field of every agent tool`);a[e]=t}return t(a)}var Wa=v({text:g().optional(),structured:n().optional(),removed:l(v({path:g(),reason:g(),item:n()})).optional(),parts:l(ee).optional(),sources:l(Re).optional()});function Ga(e){return e.type===`speech`||(e.type===`text`||e.type===`image`)&&e.inputs.text!==!1}function Ka(e){return e.type===`builtin`?!1:e.permission!==`auto`||`auth`in e&&e.auth!==void 0&&(e.auth.onUnauthenticated??`gate`)===`gate`}function qa(e,t){if(!Fa.has(e.type))return`it is a ${e.type} profile; an agent tool runs a text, image, or speech profile`;if(!Ga(e))return`it does not take text`;for(let n of H(e)){let e=t(n);if(!e)return`its tool '${n}' is not registered; register it first`;if(Ka(e))return`its tool '${n}' can stop on a gate; give it permission 'auto' and no sign-in`}}function Ja(e,t,n){let r=`Agent tool "${e.name}"`,i=e.maxCallsPerTurn;if(i!==void 0&&!(Number.isInteger(i)&&i>0))throw new M(`config`,`${r}: maxCallsPerTurn must be a whole number above 0`);let a=t(e.profile);if(!a)throw new M(`config`,`${r}: profile '${e.profile}' must be registered before the tool`);let o=qa(a,n);if(o)throw new M(`config`,`${r} can't run '${e.profile}': ${o}`);return a}function Ya(e){if(!e)return`delegated`;let t=`models`in e&&Object.values(e.models).some(e=>(e.builtInTools?.length??0)>0);return H(e).length===0&&!t?`local`:`delegated`}function Xa(e){let t=E(e),n=t.flatMap(e=>e.type===`text`?[e.text]:[]).join(``),r=ze(t,e=>e.type===`structured`),i=r?.structured,a=t.flatMap(e=>e.type===`media`?[{type:e.media.mimeType.startsWith(`audio/`)?`audio`:`image`,mimeType:e.media.mimeType,data:e.media.data}]:[]),o=t.flatMap(e=>e.type===`citation`?e.sources:[]);return{...i===void 0?{text:n}:{structured:i},...r?.removed?.length?{removed:r.removed}:{},...a.length>0?{parts:a}:{},...o.length>0?{sources:o}:{}}}function Za(e,t,n){return{...e,type:`agent`,input:t,output:Wa,sources:e=>e.sources??[],...n}}var Qa=/^[\x21-\x7E]{1,256}$/;function $a(e=Date.now){let t=new Map,n=new Map,r=({tool:e,max:n})=>{if(n===void 0)return;let r=[...t.values()].filter(t=>t.tool===e).length;for(let[i,a]of t){if(r<=n)break;a.tool===e&&(t.delete(i),r--)}};return{get(n,i){let a=t.get(n);if(a&&(t.delete(n),!(i.idleMs!==void 0&&e()-a.usedAt>i.idleMs)))return t.set(n,{...a,usedAt:e(),tool:i.tool}),r(i),{id:a.id,protocolVersion:a.protocolVersion}},open(i,a,o){let s=n.get(i);if(s)return s;let c=o().then(n=>(t.delete(i),t.set(i,{...n,usedAt:e(),tool:a.tool}),r(a),n)).finally(()=>n.delete(i));return n.set(i,c),c},drop(e,n){t.get(e)?.id===n&&t.delete(e)},clear(){t.clear(),n.clear()}}}function eo(e){return e!==null&&Qa.test(e)}async function to(e,t){let n=JSON.stringify([e,Object.entries(t).map(([e,t])=>[e.toLowerCase(),t]).sort(([e],[t])=>e<t?-1:+(e>t))]),r=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(n));return[...new Uint8Array(r)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}function no(e,t,n){if(!e||typeof e!=`object`||Array.isArray(e))return n.push(`${t}: schema must be an object`),!1;let r=typeof e.type==`string`||Array.isArray(e.type),i=e.anyOf!==void 0||e.oneOf!==void 0;if(!r&&!i){if(t!==`$`)return!0;n.push(`${t}: missing type or combinator`)}return e.type===`array`&&e.items===void 0&&n.push(`${t}: array schema must define items`),!0}function ro(e,t,n,r){let i=Array.isArray(t)?t:[];for(let t of i)typeof t==`string`&&!Object.hasOwn(e,t)&&r.push(`${n}: required key '${t}' missing from properties`);for(let[t,i]of Object.entries(e))i&&typeof i==`object`&&io(i,`${n}.properties.${t}`,r)}function io(e,t,n){if(!no(e,t,n))return;let r=e.properties;r&&typeof r==`object`&&!Array.isArray(r)&&ro(r,e.required,t,n),e.items&&typeof e.items==`object`&&!Array.isArray(e.items)&&io(e.items,`${t}.items`,n);for(let r of[`anyOf`,`oneOf`]){let i=e[r];Array.isArray(i)&&i.forEach((e,i)=>{e&&typeof e==`object`&&io(e,`${t}.${r}[${i}]`,n)})}}function ao(e,t){let n=[];if(io(e,`$`,n),n.length>0)throw new M(`config`,`Invalid tool ${t} schema: ${n.join(`; `)}`)}function oo(e,t=`output`){let n=r(e,{target:`draft-7`,io:t});return delete n.$schema,n.type||=`object`,n}function so(e){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(so);let t={};for(let n of Object.keys(e))n!==`__proto__`&&n!==`constructor`&&n!==`prototype`&&(t[n]=so(e[n]));return t}function co(e){let t=/^[a-z][a-z0-9+.-]*:\/\/[^/?#]*/i.exec(e)?.[0];if(!t||/[{}]/.test(t))throw new M(`config`,`Endpoint "${e}" must start with a fixed scheme and host; placeholders belong in the path or query`)}var lo=class{value;constructor(e){this.value=e}};function uo(e){return new lo(e)}function fo(e){return(t,n)=>{let{page:r}=n;if(r&&`output`in r)return uo(r.output);let{labels:i}=n.profile;throw r?.timedOut?Error(N(`tool.page_timed_out`,{},i)):Error(N(`tool.page_no_answer`,{tool:e},i))}}function po(e){let t=oo(e.input,`input`);ao(t,`input`);let n=oo(e.output,`output`);ao(n,`output`);let r={activity:{input:t},activityPast:{input:t,output:n},activityFailed:{input:t},request:{input:t}};for(let t of[`activity`,`activityPast`,`activityFailed`,`request`]){let n=e.labels?.[t],i=n?Le(n,r[t]):void 0;if(i)throw new M(`config`,`Tool "${e.name}" ${t} label: ${i}`)}return{inputSchema:t,outputSchema:n}}function mo(e,t){if(t&&(typeof t.service!=`string`||!t.service.trim()))throw new M(`config`,`Tool "${e}" signs in with slot "${t.slot}" but names no service`)}function ho(e,t,n=[]){if(t?.queryParam===void 0)return;let r=t.queryParam.trim()?t.type===`api_key`?t.headerName!==void 0||t.headerPrefix!==void 0?`is set with headerName or headerPrefix; the key goes in one place`:n.includes(t.queryParam)?`"${t.queryParam}" is also one of mapping.queryParams`:void 0:`is set on a '${t.type}' sign-in; only an API key goes in the URL`:`is blank`;if(r)throw new M(`config`,`Tool "${e}" auth.queryParam ${r}`)}function go(e,t){if(t!==void 0&&!(Number.isInteger(t.requests)&&t.requests>0&&Number.isFinite(t.windowMs)&&t.windowMs>0))throw new M(`config`,`Tool "${e}" limit needs a whole number of requests above 0 and a window above 0 ms`)}function _o(e,t){if(!(t===void 0||Number.isFinite(t)&&t>0))throw new M(`config`,`Tool "${e}" timeoutMs needs a finite number of ms above 0`)}function W(e,t,n){if(!(n===void 0||Number.isInteger(n)&&n>0))throw new M(`config`,`Tool "${e}" ${t} needs a whole number above 0`)}function vo(e){W(e.name,`maxResponseBytes`,e.maxResponseBytes);let t=e.imageLimits;t&&(W(e.name,`imageLimits.count`,t.count),W(e.name,`imageLimits.bytes`,t.bytes),W(e.name,`imageLimits.totalBytes`,t.totalBytes),_o(e.name,t.timeoutMs))}function yo(e){return co(e.endpoint),mo(e.name,e.auth),ho(e.name,e.auth,e.mapping?.queryParams),go(e.name,e.limit),_o(e.name,e.timeoutMs),vo(e),{...e,type:`http`,...po(e)}}function bo(e){return mo(e.name,e.auth),ho(e.name,e.auth),vo(e),W(e.name,`session.idleMs`,e.session?.idleMs),W(e.name,`session.max`,e.session?.max),{...e,type:`mcp`,...po(e)}}function xo(e){mo(e.name,e.auth),ho(e.name,e.auth);let t=e.answeredBy===`page`?fo(e.name):e.handler;if(typeof t!=`function`)throw new M(`config`,`Tool '${e.name}' needs a handler, or answeredBy: 'page'`);return{...e,handler:t,type:`function`,...po(e)}}function So(e,t,n){if(e.type===`builtin`)return e;if(e.type===`agent`){let r=Ja(e,t,n),i=A(r),a=Ua({type:r.type,...i?{inputs:i}:{}},e);return Za(e,a,po({...e,input:a,output:Wa}))}return e.type===`http`?yo(e):e.type===`mcp`?bo(e):xo(e)}function Co(e=()=>void 0){let t=new Map,n=$a(),r=e=>t.get(e),i=n=>{let i=So(n,e,r);return t.set(i.name,i),i};return{register:i,registerMany:e=>e.map(e=>i(e)),get:r,require(e){let t=r(e);if(!t)throw new M(`config`,`Tool '${e}' is not registered`);return t},has:e=>t.has(e),list:()=>[...t.values()],findProfile:e,reset:()=>{t.clear(),n.clear()},mcpSessions:n}}function wo(e,t,n,r){if(!n.provider?.trim()||!n.apiId?.trim())throw new M(`config`,N(`provider.binding_identity`))}function To(e){Po(e.id,e.models),ns(e.id,e.observability),ws(e.id,e.inputs);for(let[t,n]of Object.entries(e.models))Io(e.id,t,n);return{type:`embedding`,id:e.id,identity:{handle:e.identity.handle},models:e.models,defaultModel:Fo(e.id,e),allowModelSelect:e.allowModelSelect,inputs:e.inputs,guardrails:e.guardrails,observability:e.observability,labels:e.labels}}function Eo(e,t,n,r){let i=r.safeParse(n);if(!i.success)throw new M(`config`,`Profile ${e} model '${t}': ${i.error.issues.map(e=>`${e.path.join(`.`)}: ${e.message}`).join(`; `)}`)}function Do(e,t,n){if(Eo(e,t,n,Te),wo(e,t,n,`decision`),`retry`in n)throw new M(`config`,`Profile ${e} model '${t}': a decision binding takes no retry; a decision retries only a transient failure, by the kernel's rule`);if(n.timeoutMs!==void 0&&(!Number.isFinite(n.timeoutMs)||n.timeoutMs<=0))throw new M(`config`,`Profile ${e} model '${t}' timeoutMs must be > 0`)}function Oo(e){let t=e.models?qr(e.models):void 0;if(!t)throw new M(`config`,`Profile ${e.id}: type 'decision' must declare exactly one model`);Do(e.id,t,e.models[t])}function ko(e){if(e.inputs.state!==`json`)throw new M(`config`,`Profile ${e.id}: decision inputs.state must be 'json'`);let t=e.inputs.maxStateBytes;if(t!==void 0&&!(Number.isInteger(t)&&t>0))throw new M(`config`,`Profile ${e.id}: decision inputs.maxStateBytes must be a positive integer`);if(!e.decision.contract.trim())throw new M(`config`,`Profile ${e.id}: decision.contract must be non-empty`)}function Ao(e){return Oo(e),ko(e),ns(e.id,e.observability),{...e,identity:{handle:e.identity.handle}}}function jo(e){return e===void 0?{}:{parallel:e}}function Mo(e){return No(e.id,e.tools),ns(e.id,e.observability),{type:`host`,id:e.id,tools:{allow:e.tools.allow,...jo(e.tools.parallel)},guardrails:e.guardrails,observability:e.observability,labels:e.labels}}function No(e,t){if(!Array.isArray(t.allow))throw new M(`config`,`Profile ${e}: type 'host' must set tools.allow`)}function Po(e,t){if(Object.keys(t).length===0)throw new M(`config`,`Profile ${e} must declare at least one model`)}function Fo(e,t){let n=t.defaultModel??qr(t.models);if(!n)throw new M(`config`,`Profile ${e} must set defaultModel when more than one model is declared`);if(!t.models[n])throw new M(`config`,`Profile ${e} defaultModel '${n}' is not declared`);return n}function Io(e,t,n){Lo(e,t,n),Eo(e,t,n,be),Lo(e,t,n)}function Lo(e,t,n){let r=n.efforts;if(!r||Object.keys(r).length===0){if(n.defaultEffort||n.allowEffortSelect)throw new M(`config`,`Profile ${e} model '${t}': defaultEffort and allowEffortSelect require efforts`);return}for(let[n,i]of Object.entries(r))if(!we.includes(i))throw new M(`config`,`Profile ${e} model '${t}' effort '${n}': '${i}' is not a thinking level (${we.join(`, `)})`);let i=Object.keys(r),a=n.defaultEffort??(i.length===1?i[0]:void 0);if(!a)throw new M(`config`,`Profile ${e} model '${t}' must set defaultEffort when more than one effort is declared`);if(!r[a])throw new M(`config`,`Profile ${e} model '${t}' defaultEffort '${a}' is not declared`);if(n.allowEffortSelect&&i.length<2)throw new M(`config`,`Profile ${e} model '${t}' allowEffortSelect requires at least two efforts`)}function Ro(e){return{providerContinuation:e.providerContinuation?S.parse(e.providerContinuation):{},models:e.models,defaultModel:Fo(e.id,e),allowModelSelect:e.allowModelSelect,maxSteps:e.maxSteps}}function zo(e,t,n){if(n?.length){for(let r of n)if(!le(r))throw new M(`config`,`Profile ${e}: turnBehaviour.resumption.${t} may only include ContinueStopKind (length | stream_incomplete | provider_error); got '${r}'`)}}function Bo(e,t){t&&(zo(e,`allowContinue`,t.allowContinue),zo(e,`autoContinue`,t.autoContinue))}function Vo(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ho(e,t){let n=[e];for(let e of t)n=n.flatMap(t=>Vo(t)?e===`*`?Object.values(t):[t[e]]:[]);return n}var Uo=Object.entries(xe).filter(([,e])=>e.required===!0).map(([e,t])=>[e,t.profileTypes]).sort(([e],[t])=>e.split(`.`).length-t.split(`.`).length);function Wo(e){if(!Vo(e))throw new M(`config`,`Profile definition must be an object`);let t=typeof e.id==`string`&&e.id.trim()?e.id:void 0;if(!t)throw new M(`config`,`Profile definition must set id`);if(!me.find(t=>t===e.type))throw new M(`config`,`Profile ${t}: type must be one of ${me.join(`, `)}`)}function Go(e){let t=e.identity?.handle,n=[[`id`,e.id,64],[`identity.handle`,typeof t==`string`?t:``,32]];for(let[t,r,i]of n)if(!(Array.from(r).length<=i))throw new M(`config`,`Profile ${e.id.slice(0,64)}: ${t} must be at most ${i} characters`)}function Ko(e){let{id:t,type:n}=e,r=e;for(let[e,i]of Uo){if(i&&!i.includes(n))continue;let a=ae(e),o=Ho(r,a.slice(0,-1)),s=a[a.length-1];if(o.some(e=>{if(!Vo(e))return!1;let t=e[s];return t==null||t===``}))throw new M(`config`,`Profile ${t}: type '${n}' must set ${a.join(`.`)}`)}}function qo(e){let{id:t,type:n}=e;if(n!==`live`&&x(`inputs`).includes(n)&&e.inputs==null)throw new M(`config`,`Profile ${t}: type '${n}' must set inputs`)}function Jo(e){let[t]=Fe(e);if(!t)return;let{offValue:n,reason:r}=t.scope,i=n===void 0?``:` (other than ${n})`;throw new M(`config`,`Profile ${e.id}: type '${e.type}' must not set ${t.path}${i} — ${r}`)}function Yo(e,t){let n=t.turnBehaviour;Bo(e,n?.resumption)}function Xo(e,t){let n=t=>new M(`config`,`Profile ${e}: ${t}`),r=t?.maxRetries;if(r!==void 0&&(!Number.isInteger(r)||r<0))throw n(`outputs.validation.maxRetries must be a non-negative integer`)}function Zo(e,t){let n=t=>new M(`config`,`Profile ${e}: ${t}`),r=Object.keys(t??{}).find(e=>!Qo.includes(e));if(r!==void 0)throw n(`guardrails.${r} is not a setting; it takes ${Qo.join(`, `)}`);es(t?.blockedReply,n)}var Qo=[`quota`,`detect`,`blockedReply`,`network`,`taint`],$o=[`onBlock`,`maxRetries`];function es(e,t){if(e===void 0)return;let n=Object.keys(e).find(e=>!$o.includes(e));if(n!==void 0)throw t(`guardrails.blockedReply.${n} is not a setting; it takes onBlock and maxRetries`);let{onBlock:r,maxRetries:i}=e;if(r!==void 0&&!O.includes(r))throw t(`guardrails.blockedReply.onBlock must be one of ${O.join(`, `)}`);if(i!==void 0&&(!Number.isInteger(i)||i<0))throw t(`guardrails.blockedReply.maxRetries must be a non-negative integer`)}function ts(e){let t=e.guardrails?.detect,n=e.type===`host`?Mt(`guardrails.detect`,t,Bt):Mt(`guardrails.detect`,t);if(n!==void 0)throw new M(`config`,`Profile ${e.id}: ${n}`)}function ns(e,t){try{let n=Gt(t);if(!Number.isFinite(n.retainForDays))throw new M(`config`,`Profile ${e}: observability.retainForDays must be a finite number`);if(n.rotateAfterMiB<=0||!Number.isFinite(n.rotateAfterMiB))throw new M(`config`,`Profile ${e}: observability.rotateAfterMiB must be a positive number`)}catch(t){if(t instanceof M&&t.message.startsWith(`Profile `))throw t;let n=t instanceof Error?t.message:String(t);throw new M(Ve(t),`Profile ${e}: ${n}`,{cause:t})}}function rs(e){if(e.type===`host`||e.type===`decision`||e.type===`speech`||e.type===`embedding`)return;let{system:t,systemByRole:n}=e.identity;t!==void 0&&Or(t,`Profile ${e.id} identity.system`);for(let[t,r]of Object.entries(n??{}))Or(r,`Profile ${e.id} identity.systemByRole.${t}`)}function is(e){Wo(e);for(let t of[`key`,`fallbackKey`,`protocol`,`provider`])if(t in e)throw new M(`config`,N(`provider.profile_configuration`,{profile:e.id,field:t}));if(Jo(e),qo(e),Ko(e),Go(e),e.labels&&yt(e.labels,`Profile ${e.id}`),rs(e),ts(e),e.type===`host`)return Mo(e);if(e.type===`decision`)return Ao(e);if(e.type===`embedding`)return To(e);Po(e.id,e.models),Yo(e.id,e),Zo(e.id,e.guardrails),e.type===`text`&&Xo(e.id,e.outputs?.validation),ns(e.id,e.observability);for(let[t,n]of Object.entries(e.models))Io(e.id,t,n);let t=e.type===`speech`?{handle:e.identity.handle}:{handle:e.identity.handle,system:e.identity.system,systemByRole:e.identity.systemByRole},n=e.guardrails,r=e.observability,i=e.labels,a=Ro(e),o;switch(e.type){case`text`:o={type:`text`,id:e.id,identity:t,...a,tools:e.tools,inputs:Pi(e.inputs),outputs:e.outputs,turnBehaviour:e.turnBehaviour,guardrails:n,observability:r,labels:i};break;case`image`:o={type:`image`,id:e.id,identity:t,...a,image:e.image,tools:e.tools,inputs:Pi(e.inputs),outputs:e.outputs,turnBehaviour:e.turnBehaviour,guardrails:n,observability:r,labels:i},us(o.id,o.inputs.attachments?.accept),ls(o.id,o.image);break;case`speech`:o={type:`speech`,id:e.id,identity:t,...a,speech:e.speech,outputs:e.outputs,turnBehaviour:e.turnBehaviour,guardrails:n,observability:r,labels:i};break;case`live`:o={type:`live`,id:e.id,identity:t,...a,live:e.live,inputs:e.inputs?Pi(e.inputs):e.inputs,tools:{allow:e.tools.allow,...jo(e.tools.parallel)},turnBehaviour:e.turnBehaviour,guardrails:n,observability:r,labels:i},Kt(o),fs(o.id,o.live.contextCompression),ds(o);break;default:throw new M(`config`,`Unknown profile type '${String(e)}'`)}return ss(o),as(o),os(o),o}function as(e){let{maxSteps:t}=e;if(!(t===void 0||Number.isInteger(t)&&t>0))throw new M(`config`,`Profile ${e.id}: maxSteps must be a whole number of 1 or more; leave it out for the default of 20`)}function os(e){if(e.type===`text`&&e.turnBehaviour?.atStepLimit===`answer`&&e.maxSteps===1)throw new M(`config`,`Profile ${e.id}: turnBehaviour.atStepLimit 'answer' with maxSteps 1 leaves no step that can call a tool`)}function ss(e){if(e.type===`live`)return;let t=e.outputs?.structured;if(!t||typeof t==`string`)return;let n=A(e)?.slots?.[t.by];if(!n)throw new M(`config`,`Profile ${e.id}: outputs.structured.by '${t.by}' is not a slot in inputs.slots`);let r=ji(n),i=Object.keys(t.map).filter(e=>!r.includes(e));if(i.length)throw new M(`config`,`Profile ${e.id}: outputs.structured.map maps ${i.join(`, `)}, not a choice of slot '${t.by}'`)}var cs={n:{ok:e=>Number.isInteger(e)&&e>=1,rule:`a whole number of 1 or more`},seed:{ok:Number.isInteger,rule:`a whole number`},outputCompression:{ok:e=>Number.isInteger(e)&&e>=0&&e<=100,rule:`a whole number from 0 to 100`}};function ls(e,t){for(let[n,{ok:r,rule:i}]of Object.entries(cs)){let a=t[n];if(a!==void 0&&!r(a))throw new M(`config`,`Profile ${e}: image.${n} must be ${i}`)}t.references?.forEach((t,n)=>{let r=`Profile ${e}: image.references[${n}]`;if(Oe(t.mimeType)!==`image`)throw new M(`config`,`${r} must be an image, not '${t.mimeType}'`);if(!(ar(t)?t.uri:t.data))throw new M(`config`,`${r} needs its bytes or its uri`)})}function us(e,t){let n=t?.filter(e=>!j(y,e));if(n?.length)throw new M(`config`,`Profile ${e}: an image profile's attachments take images, video, and PDF only, not ${n.join(`, `)}`)}function ds(e){let{greeting:t,resumed:n,sessionResumption:r}=e.live,i=`Profile ${e.id} live`;if(t!==void 0&&(typeof t!=`string`||!t.trim()))throw new M(`config`,`${i}.greeting must be a prompt; leave it out to wait`);if(!n)return;if(typeof n.prompt!=`string`||!n.prompt.trim())throw new M(`config`,`${i}.resumed.prompt must be a prompt`);let{afterMs:a}=n;if(a!==void 0&&!(Number.isFinite(a)&&a>=0))throw new M(`config`,`${i}.resumed.afterMs must be 0 or more milliseconds`);if(!r)throw new M(`config`,`${i}.resumed needs live.sessionResumption: without it no call resumes`)}function fs(e,t){if(!t)return;let n=`Profile ${e} live.contextCompression`,r=t.triggerTokens,i=t.slidingWindow.targetTokens;if(ps(`${n}.triggerTokens`,r),ps(`${n}.slidingWindow.targetTokens`,i),r!==void 0&&i!==void 0&&i>=r)throw new M(`config`,`${n}: slidingWindow.targetTokens must be below triggerTokens`)}function ps(e,t){if(!(t===void 0||Number.isInteger(t)&&t>0))throw new M(`config`,`${e} must be a whole number above 0`)}function ms(e,t,n,r){let i=`Profile ${t.id} model ${n} compaction`;if(hs(i,r),gs(i,r),r.meter!=null&&r.meter!==`history`&&r.meter!==`input`)throw new M(`config`,`${i}: meter must be 'history' or 'input'`);if(r.profile===void 0){if(t.type!==`text`||t.inputs.text===!1)throw new M(`config`,`${i}: a profile that compacts itself must be a text profile that takes text`);return}let a=e.get(r.profile);if(!a)throw new M(`config`,`${i}: compaction profile '${r.profile}' must be registered before '${t.id}'`);if(a.type!==`text`||a.inputs.text===!1)throw new M(`config`,`${i}: compaction profile '${r.profile}' must be a text profile that takes text`)}function hs(e,t){if(t.maxTokens<=0)throw new M(`config`,`${e}: maxTokens must be > 0`);if(t.compactAt<=0||t.compactAt>=1)throw new M(`config`,`${e}: compactAt must be in (0, 1)`)}function gs(e,t){if(t.previousExchanges<0)throw new M(`config`,`${e}: previousExchanges must be >= 0`);if(t.previousExchanges<1&&t.previousExchanges>=t.compactAt)throw new M(`config`,`${e}: previousExchanges as fraction (${t.previousExchanges}) must be < compactAt (${t.compactAt})`);if(t.previousExchanges>1&&!Number.isInteger(t.previousExchanges))throw new M(`config`,`${e}: previousExchanges >= 1 must be an integer`)}function _s(e,t){for(let n of H(t))if(e.get(n)?.type===`builtin`)throw new M(`config`,t.type===`host`?`Profile ${t.id} lists builtin '${n}' in tools.allow — type 'host' never runs a model`:`Profile ${t.id} lists builtin '${n}' in tools.allow — declare it on models.*.builtInTools instead`)}function vs(e,t){let n=ii(t)?.t2Loader;if(n){if(!H(t).includes(n))throw new M(`config`,`Profile ${t.id} tools.t2Loader '${n}' must also be listed in tools.allow`);if(e.get(n)?.type!==`function`)throw new M(`config`,`Profile ${t.id} tools.t2Loader '${n}' must be a registered type: 'function' tool`)}}function*ys(e){for(let[t,n]of Object.entries(e.models))for(let e of n.builtInTools??[])yield{modelId:t,id:e}}function bs(e,t){for(let{modelId:n,id:r}of ys(t))if(e.get(r)?.type!==`builtin`)throw new M(`config`,`Profile ${t.id} model '${n}' lists '${r}' in builtInTools — not a registered builtin`)}function xs(e){let t=e.type===`text`?e.outputs?.structured:void 0;return t?typeof t==`string`?[t]:[...new Set([...Object.values(t.map),t.fallback])]:[]}function Ss(e,t){let n=xs(t).map(n=>{let r=e.find(n);if(!r)throw new M(`config`,`Profile ${t.id}: outputs.structured names '${n}', which is not a registered schema; register it before the profile`);return r}),r=t.type===`text`?t.outputs?.validation:void 0,i=Object.keys(r?.fields??{}),a=Object.keys(r?.items??{});if(!i.length&&!a.length)return;if(!n.length)throw new M(`config`,`Profile ${t.id}: outputs.validation checks a structured reply, so it needs outputs.structured`);let o=a.filter(e=>!n.some(t=>Na(t.jsonSchema,e)));if(o.length)throw new M(`config`,`Profile ${t.id}: outputs.validation.items has ${o.join(`, `)}, which no structured schema reaches as a list with an items schema`);let s=i.filter(e=>!n.some(t=>Oa(t.jsonSchema,e)));if(s.length)throw new M(`config`,`Profile ${t.id}: outputs.validation.fields has ${s.join(`, `)}, which no structured schema reaches through object properties`)}function Cs(e){let t=A(e)?.context;if(!t)return;let n=k;if(t.from.length===0||t.from.some(e=>!n.includes(e)))throw new M(`config`,`Profile ${e.id}: inputs.context.from must list ${k.join(` or `)}`);if(!(Number.isInteger(t.maxChars)&&t.maxChars>0))throw new M(`config`,`Profile ${e.id}: inputs.context.maxChars must be a positive integer`)}function ws(e,t){if(!t)return;let{attachments:n,voice:r,maxFiles:i,maxBytes:a,maxTurnBytes:o,limitsByMime:s}=t,c={maxFiles:i,maxBytes:a,maxTurnBytes:o};if((n||r)&&Object.values(c).some(e=>e===void 0))throw new M(`config`,`Profile ${e} must set maxFiles, maxBytes, and maxTurnBytes`);for(let[e,t]of Object.entries(s??{}))c[`limitsByMime['${e}']`]=t;for(let[t,n]of Object.entries(c))if(n!==void 0&&!(Number.isInteger(n)&&n>0))throw new M(`config`,`Profile ${e}: inputs.${t} must be a positive integer`)}function Ts(e,t,n){let r=new Map,i=i=>{let a=is(i),o=n&&a.type!==`host`?{...a,models:Object.fromEntries(Object.entries(a.models).map(([e,t])=>[e,Me(n.require(t.provider,t.apiId),t,a.type)]))}:a;if(_s(e,o),vs(e,o),o.type!==`host`&&o.type!==`decision`&&o.type!==`embedding`){bs(e,o),ws(o.id,A(o)),Cs(o),Ss(t,o);for(let[e,t]of Object.entries(o.models))t.compaction&&ms(r,o,e,t.compaction)}r.set(o.id,o)};return{register:i,registerMany(e){for(let t of e)i(t)},get(e){let t=r.get(e);if(!t)throw new M(`config`,`Unknown profile '${e}'`);return t},find:e=>r.get(e),has:e=>r.has(e),list:()=>[...r.values()],clear:()=>r.clear()}}function Es(e){let t=e?.trim()??``;if(t.startsWith(`AIza`))return`gemini`;if(t.startsWith(`sk-or-`))return`openrouter`}function Ds(e){let t;try{t=new URL(e.baseUrl)}catch{throw new M(`config`,`Enter a valid localhost URL.`)}if(![`http:`,`https:`].includes(t.protocol)||![`localhost`,`127.0.0.1`,`[::1]`].includes(t.hostname)||t.username||t.password||t.search||t.hash)throw new M(`config`,`Use a localhost URL without credentials, query parameters or a fragment.`);return{baseUrl:t.href.replace(/\/$/,``),fetch:(e,n)=>new URL(e instanceof Request?e.url:String(e)).origin===t.origin?fetch(e,{...n,redirect:`error`,credentials:`omit`}):Promise.reject(new M(`blocked`,`Local requests must stay on the configured origin.`))}}var Os=v({data:l(v({id:g().min(1)}))});async function ks(e,t){let n=Ds(e);if(!n?.fetch)throw new M(`config`,`Enter a local endpoint.`);let r=await n.fetch(`${n.baseUrl}/v1/models`,{signal:t,headers:{Accept:`application/json`}});if(!r.ok)throw new M(`network`,`Local model list returned HTTP ${r.status}.`);let i=Os.safeParse(await r.json());if(!i.success)throw new M(`request`,`The endpoint returned an invalid model list.`);return[...new Set(i.data.data.map(e=>e.id))]}var As=`https://openrouter.ai/api/v1/models`,js=`https://openrouter.ai/api/v1/embeddings/models`,Ms=[{id:`gemini-embedding-2-preview`,label:`Gemini Embeddings 2 (preview)`},{id:`gemini-embedding-001`,label:`Gemini Embedding 001`}],Ns=[{id:`liquid/lfm-2.5-embedding-350m:free`,label:`Liquid LFM 2.5 Embedding 350M (free)`},{id:`nvidia/nemotron-3-embed-1b:free`,label:`NVIDIA Nemotron 3 Embed 1B (free)`},{id:`nvidia/llama-nemotron-embed-vl-1b-v2:free`,label:`NVIDIA Llama Nemotron Embed VL 1B v2 (free)`}],Ps={text:`text`,image:`image`,speech:`speech`,live:void 0,embedding:void 0},Fs=v({data:l(v({id:g().min(1),name:g().optional(),architecture:v({output_modalities:l(g()).optional()}).optional()}))}),Is=v({data:l(v({id:g().min(1),name:g().optional()}))}),Ls=v({models:l(v({name:g().min(1),displayName:g().optional(),supportedGenerationMethods:l(g()).optional()})).optional(),nextPageToken:g().optional()}),Rs=5;async function zs(e,t,n){let r=await fetch(t,{...n,redirect:`error`,credentials:`omit`});if(r.status===400||r.status===401||r.status===403)throw new M(`auth`,`${e} refused the key.`);if(!r.ok)throw new M(`network`,`${e} model list returned HTTP ${r.status}.`);return await r.json()}async function Bs(e,t,n,r){let i=n?.trim();if(t===`embedding`&&!i)return[...e===`openrouter`?Ns:Ms];if(e===`openrouter`)return await Vs(t,i,r);if(!i)throw new M(`auth`,`Choose a key to list Gemini models.`);return await Us(t,i,r)}async function Vs(e,t,n){let r={signal:n,headers:{Accept:`application/json`,...t?{Authorization:[`Bearer`,t].join(` `)}:{}}};if(e===`embedding`){let e=Is.safeParse(await zs(`OpenRouter`,js,r));if(!e.success)throw new M(`bad_response`,`OpenRouter returned an invalid embedding model list.`);return e.data.data.map(e=>({id:e.id,label:e.name??e.id}))}let i=Ps[e];if(!i)return[];let a=Fs.safeParse(await zs(`OpenRouter`,`${As}?output_modalities=${i}`,r));if(!a.success)throw new M(`bad_response`,`OpenRouter returned an invalid model list.`);return a.data.data.filter(e=>e.architecture?.output_modalities?.includes(i)??!0).map(e=>({id:e.id,label:e.name??e.id}))}var Hs={live:`bidiGenerateContent`,embedding:`embedContent`};async function Us(e,t,n){let r=Hs[e]??`generateContent`,i=[],a;for(let e=0;e<Rs;e++){let e=new URL(C);e.searchParams.set(`pageSize`,`1000`),a&&e.searchParams.set(`pageToken`,a);let o=Ls.safeParse(await zs(`Google`,e.href,{signal:n,headers:{Accept:`application/json`,"x-goog-api-key":t}}));if(!o.success)throw new M(`bad_response`,`Google returned an invalid model list.`);for(let e of o.data.models??[]){if(!e.supportedGenerationMethods?.includes(r))continue;let t=e.name.replace(/^models\//,``);i.push({id:t,label:e.displayName??t})}if(a=o.data.nextPageToken,!a)break}return i}function Ws(e){return[...new Set([e.key,e.fallbackKey,...Object.values(e.models??{}).flatMap(e=>[e.keySlot,e.fallbackKeySlot])].filter(e=>!!e))]}function Gs(e,t){return Object.fromEntries(e.map(e=>[e,Object.hasOwn(t,e)?t[e]:void 0]))}var Ks=[`audio/webm;codecs=opus`,`audio/webm`,`audio/mp4`,`audio/wav`,`audio/mpeg`];function qs(e){return e.join(`,`)}function Js(e){let t=e?.attachments?.accept,n=e?.voice?.accept;return{text:e?.text!==!1,attachments:t?.length?{accept:t,acceptAttr:qs(t)}:null,voice:n?.length?{accept:n}:null,maxFiles:e?.maxFiles,maxBytes:e?.maxBytes,maxTurnBytes:e?.maxTurnBytes,limitsByMime:e?.limitsByMime,slots:Ni(e?.slots),context:e?.context}}function Ys(e){return{text:e.text,attachments:e.attachments?{accept:e.attachments.accept}:void 0,voice:e.voice?{accept:e.voice.accept}:void 0,maxFiles:e.maxFiles,maxBytes:e.maxBytes,maxTurnBytes:e.maxTurnBytes,limitsByMime:e.limitsByMime,slots:e.slots,context:e.context}}function Xs(e,t){let n=e=>(e??[]).map(({name:e,mimeType:t,sizeBytes:n})=>({name:e,mimeType:t,sizeBytes:n})),r=mr({attachments:e.attachments?.accept,voice:e.voice?.accept,limits:rr(Ys(e))},n(t.attachments),n(t.voice));return{ok:r.length===0,issues:r}}function Zs(e){let t=globalThis.MediaRecorder;if(t===void 0)return;let n=e=>t.isTypeSupported(e),r=e=>e.find(n);return e?.length?r(Ks.filter(t=>j(e,t)))??e.find(n):r(Ks)}var Qs=v({protocol:g(),provider:g(),apiId:g(),options:_(g(),u()).optional(),keySlot:g().optional(),fallbackKeySlot:g().optional(),efforts:_(g(),d(we)).optional(),defaultEffort:g().optional(),allowEffortSelect:o().optional(),summaries:o().optional(),maxOutputTokens:h().optional(),temperature:h().optional(),builtInTools:l(g()).optional(),compaction:v({maxTokens:h(),compactAt:h(),previousExchanges:h(),profile:g().optional(),timing:d(T),meter:d(ke).optional()}).optional(),limits:v({operationTimeoutMs:h().optional(),connectTimeoutMs:h().optional(),liveStepTimeoutMs:h().optional(),maxWireRecordBytes:h().optional(),maxWireResponseBytes:h().optional(),maxEventBytes:h().optional(),maxStepBytes:h().optional(),maxStepEvents:h().optional(),maxPendingToolCalls:h().optional()}).optional()}),$s=v({structured:i([g(),v({by:g(),map:_(g(),g()),fallback:g()}),p()]).optional(),streaming:v({mode:d(he).optional(),streamThoughts:o().optional()}).optional()}),ec=v(We(pt,()=>d(ut))),tc=v(We(Ft,()=>ec)),nc=v({id:g(),label:g(),actions:ec,names:l(g()),find:o()}),rc=v({hosts:l(g()),fromTools:o()}),ic=v({quota:v({perDay:h()}).optional(),detect:tc,patterns:a(d(Ft),v({theorem:o(),names:l(g())})).optional(),host:l(nc).optional(),allow:v({ungiven_images:rc,ungiven_links:rc}),blockedReply:v({onBlock:d(O),maxRetries:h()})}),ac=i([o(),v({theorem:o(),host:o()})]),oc=v({record:o(),writeTo:i([c(!1),g()]).optional(),sampleRate:h(),include:v({upstreamLog:o(),outboundWire:o(),evidenceRaw:o(),usage:o(),guardrailDecisions:o(),guardrailMatchPreview:o()}),scrub:v({sensitive:ac,injection:ac,canary:ac}),resource:Jt,retainForDays:h(),rotateAfterMiB:h(),hasOnWriteError:o()}),sc=v({text:o(),attachments:v({accept:l(g()),acceptAttr:g()}).nullable(),voice:v({accept:l(g())}).nullable(),maxFiles:h().optional(),maxBytes:h().optional(),maxTurnBytes:h().optional(),limitsByMime:_(g(),h()).optional(),slots:_(g(),v({label:g().optional(),choices:l(v({value:g(),description:g().optional()}))})).optional(),context:v({from:l(d(k)),maxChars:h()}).optional()}),cc=v({allowContinue:l(d(de)).optional(),autoContinue:l(d(de)).optional(),maxContinues:h().optional()}),lc=v({resumption:cc.optional()}),uc=v({allow:l(g()),page:l(g()),t2Loader:g().optional(),parallel:o().optional()}),dc={providerContinuation:v({history:d([`host`,`stateless`,`provider`]).optional()}).optional(),id:g(),models:_(g(),Qs),defaultModel:g(),allowModelSelect:o().optional(),maxSteps:h().optional(),labels:a(d(Ut),g()),guardrails:ic.optional(),observability:oc.optional()},fc=i([g(),l(i([g(),t({private:g().min(1)})])).min(1).readonly()]),pc=v({handle:g(),system:fc.optional(),systemByRole:_(g(),fc).optional()}),G=f(`type`,[v({...dc,type:c(`text`),identity:pc,outputs:$s.optional(),inputs:sc,tools:uc,turnBehaviour:v({resumption:cc.optional(),allowSteering:o().optional(),atStepLimit:d(je).optional()}).optional(),canStop:c(!0),allowSteering:o()}),v({...dc,type:c(`image`),identity:pc,outputs:$s.optional(),image:v({aspectRatio:g().optional(),resolution:g().optional(),mimeType:g().optional(),quality:g().optional(),background:g().optional(),n:h().int().min(1).optional(),seed:h().int().optional(),outputCompression:h().int().min(0).max(100).optional(),references:l(i([v({mimeType:g(),data:g(),name:g().optional()}),v({mimeType:g(),uri:g(),name:g().optional()})])).optional(),includeText:o().optional()}),inputs:sc,tools:uc,turnBehaviour:lc.optional(),canStop:c(!0)}),v({...dc,type:c(`speech`),identity:v({handle:g()}),outputs:$s.optional(),speech:v({voice:g().optional(),style:g().optional(),speed:h().optional(),format:d(De).optional()}),inputs:sc,turnBehaviour:lc.optional(),canStop:c(!0)}),v({...dc,type:c(`live`),identity:pc,inputs:sc.pick({slots:!0,context:!0}).optional(),live:v({ingress:v({audio:o().optional(),video:o().optional(),text:o().optional()}).optional(),voice:g().optional(),vad:v({activityHandling:d(ge).optional(),startSensitivity:d(Ee).optional(),endSensitivity:d(Ne).optional(),prefixPaddingMs:h().optional(),silenceDurationMs:h().optional()}).optional(),sessionResumption:o().optional(),contextCompression:v({triggerTokens:h().optional(),slidingWindow:v({targetTokens:h().optional()})}).optional(),transcription:v({input:o().optional(),output:o().optional()}).optional()}),tools:uc.pick({allow:!0,page:!0}),turnBehaviour:v({allowSteering:o().optional()}).optional()})]);function mc(e){let t=Ie(e),{sources:n,host:r,...i}=t.detect;return{quota:t.quota,detect:i,...n?{patterns:Object.fromEntries(Object.entries(n).map(([e,{theorem:t,matchers:n}])=>[e,{theorem:t,names:n.map(({name:e})=>e)}]))}:{},...r?{host:r.map(({id:e,label:t,actions:n,matchers:r,find:i})=>({id:e,label:t,actions:n,names:r.map(({name:e})=>e),find:!!i}))}:{},allow:{ungiven_images:hc(t.allow.ungiven_images),ungiven_links:hc(t.allow.ungiven_links)},blockedReply:t.blockedReply}}function hc(e){return{hosts:[...e.hosts??[]],fromTools:e.fromTools??!0}}function gc(e){return e===void 0||e===!1||typeof e==`string`?e:`custom`}function _c(e){if(!e)return;let t=Gt(e);return{record:t.record,writeTo:gc(t.writeTo),sampleRate:t.sampleRate,include:t.include,scrub:t.scrub,resource:t.resource,retainForDays:t.retainForDays,rotateAfterMiB:t.rotateAfterMiB,hasOnWriteError:!!t.onWriteError}}function vc(e){let{greeting:t,resumed:n,...r}=e??{};return r}function yc(e,t){let n=e.tools.filter(e=>`type`in e&&e.type===`function`&&e.answeredBy===`page`).map(e=>e.name);if(t){let e=ii(t),r=ai(t);return{allow:[...H(t)],page:n,...e?.t2Loader?{t2Loader:e.t2Loader}:{},...r===void 0?{}:{parallel:r}}}return{allow:e.tools.filter(e=>!(`type`in e&&e.type===`builtin`)).map(e=>e.name),page:n}}function bc({allow:e,page:t}){return{allow:e,page:t}}function xc(e,t){let n=Js(e.inputs),r=t?.identity??{handle:e.handle},i=t?mc(t.guardrails):void 0,a=t?_c(t.observability):void 0,o=e.outputs??void 0,s={id:e.id,identity:r,models:e.models,defaultModel:e.defaultModel,allowModelSelect:e.allowModelSelect,maxSteps:e.maxSteps,providerContinuation:e.providerContinuation,outputs:o,guardrails:i,observability:a,labels:gt(t?.labels)};switch(e.type){case`text`:return G.parse({...s,type:`text`,inputs:n,tools:yc(e,t),turnBehaviour:t?.type===`text`?t.turnBehaviour:void 0,canStop:!0,allowSteering:!t||ne(t)});case`image`:return G.parse({...s,type:`image`,image:e.image??{},inputs:n,tools:yc(e,t),turnBehaviour:t?.type===`image`?t.turnBehaviour:void 0,canStop:!0});case`speech`:return G.parse({...s,type:`speech`,speech:e.speech??{},inputs:n,turnBehaviour:t?.type===`speech`?t.turnBehaviour:void 0,canStop:!0});case`live`:return G.parse({...s,type:`live`,live:vc(e.live),...e.inputs?{inputs:{slots:n.slots,context:n.context}}:{},tools:bc(yc(e,t))});default:return e.type}}function Sc(e,t){let n=ra(e,`interfaceFromProfile`);return xc(ga(t,n),n)}function Cc(e){return s(t=>w.safeParse(e(t)).success)}var wc=[`running`,`gate`,`complete`,`error`,`cancel`],Tc=s(e=>{let t=w.safeParse({type:`tool`,tool:e});if(!t.success||t.data.type!==`tool`||!(`phase`in t.data.tool))return!1;let{phase:n}=t.data.tool;return wc.some(e=>e===n)}),Ec=_(g(),n()),Dc=v({operationId:g().optional(),name:g(),callId:g(),arguments:Ec,draft:g().optional(),reasoning:l(ie).optional(),stepId:g().optional(),edited:v({from:Ec,to:Ec}).optional(),activity:g().optional(),activityPast:g().optional(),outputDraft:g().optional(),state:Tc.optional(),startedAt:h().optional(),endedAt:h().optional(),artifacts:l(n())}),Oc=v({kind:d(ve),native:g().optional()}),K={id:g()},q=f(`kind`,[v({...K,kind:c(`user-text`),text:g()}),v({...K,kind:d([`user-attachment`,`user-voice`]),name:g(),mimeType:g(),sizeBytes:h(),data:g().optional()}),v({...K,kind:c(`thought`),text:g()}),v({...K,kind:c(`text`),text:g()}),v({...K,kind:c(`tool`),tool:Dc}),v({...K,kind:c(`structured`),value:n(),draft:g().optional()}),v({...K,kind:c(`media`),mimeType:g(),data:g().optional(),url:g().optional(),previewUrl:g().optional()}),v({...K,kind:c(`grounding`),grounding:Cc(e=>({type:`grounding`,grounding:e}))}),v({...K,kind:c(`citation`),sources:Cc(e=>({type:`citation`,sources:e})),callId:g().optional()}),v({...K,kind:c(`evidence`),evidence:Cc(e=>({type:`evidence`,evidence:e}))}),v({...K,kind:c(`guardrail`),guardrail:Se}),v({...K,kind:c(`error`),message:g()}),v({...K,kind:c(`turn-done`),stop:Oc.optional(),tokens:Cc(e=>({type:`tokens`,tokens:e})).optional(),interactionId:g().optional(),compaction:o().optional(),workedMs:h().optional(),endedAt:h().optional()})]),kc=v({type:g()});function Ac(e,t){return Object.hasOwn(e,t)}function jc(e,t){return e.map(e=>{let n=[...t,...e.path],r=`${n.map(String).join(`.`)||`(root)`} ${e.code}`;return e.code!==`invalid_union`||e.errors.length===0?r:`${r} [${e.errors.map(e=>jc(e,n)).join(` | `)}]`}).join(`; `)}function Mc(e){return jc(e.issues,[])}function Nc(e,t){return new M(`bad_response`,`${e} failed its wire check: ${Mc(t)}`)}function J(e,t,n){let r=e.safeParse(t);if(!r.success)throw Nc(n,r.error);return r.data}function Pc(e){return{type:`malformed`,error:new M(`bad_response`,e,{copy:{key:`session.part_skipped`}})}}function Fc(e,t){let n=kc.safeParse(t);if(!n.success)return Pc(`a line without a kind failed its wire check: ${Mc(n.error)}`);let{type:r}=n.data;if(!Ac(e,r))return{type:`unsupported`,received:r,raw:t};let i=e[r].safeParse(t);return i.success?i.data:Pc(`a '${r}' line failed its wire check: ${Mc(i.error)}`)}function Ic(e){try{return{value:JSON.parse(e)}}catch(e){if(e instanceof SyntaxError)return;throw e}}function Lc(e,t){let n=Ic(t);return n?Fc(e,n.value):Pc(`a line is not JSON`)}function Rc(e){let t=Ic(e);if(!t)throw new M(`bad_response`,`a line is not JSON`);return t.value}var zc=v({name:g(),mimeType:g(),data:g()}),Bc=v({slots:_(g(),g()).optional(),context:n().optional(),text:g().optional(),attachments:l(zc).optional(),voice:l(zc).optional()}),Vc=v({gateKind:d(_e).optional(),sessionPermissions:l(g()).optional(),name:g().optional(),input:n().optional(),snapshot:te.optional(),promoted:l(g()).optional(),model:g().optional(),effort:g().optional()}),Y=g().trim().min(1);v({input:Bc,conversation:g().min(1).optional(),model:g().optional(),effort:g().optional(),turnId:Y.optional(),abandon:l(re).min(1).optional(),replay:Vc.pick({sessionPermissions:!0}).optional(),transcript:l(q).optional()});var Hc=[`approve`,`deny`],Uc=i([t({unanswered:c(!0)}),t({output:n()}).refine(e=>`output`in e).transform(e=>({output:e.output}))]);v({gateId:g().min(1),operationId:g().min(1).max(256),decision:d(Hc),input:n().optional(),secret:g().optional(),page:Uc.optional(),conversation:g().min(1).optional(),turnId:Y.optional(),replay:Vc.optional()}),v({turnId:Y,id:Y,inject:l(se).min(1)}),v({turnId:Y});var Wc=v({type:c(`conversation`),ref:g().min(1),posted:c(!0).optional()}),Gc={...D,conversation:Wc},Kc=v({transcript:l(q),paused:v({events:l(w),blocks:l(q)}).optional()});v({conversation:g().min(1)}),v({conversation:g().min(1),at:h().int().min(-1)}),v({blocks:l(q)});var qc=v({conversation:g().min(1),view:Kc}),Jc=class extends Error{kind;publicMessage;internalMessage;copy;constructor(e,t,n,r){super(n??t??e),this.name=`TheoremStreamError`,this.kind=e,t&&(this.publicMessage=t),n&&(this.internalMessage=n),r&&(this.copy=r)}};function Yc(e){return e instanceof Jc}function Xc(e){return e?.trim()||void 0}var Zc=v({error:g().optional(),errorKind:b.optional(),errorCopy:Ce.optional(),errorInternal:g().optional()}),Qc=Zc;function $c(e,t){let n=Xc(e.error),r=Xc(e.errorInternal);return new Jc(e.errorKind??t,n,r&&r!==n?r:void 0,e.errorCopy)}function el(e){return!Yc(e)||e.copy===void 0?!1:(Array.isArray(e.copy)?e.copy:[e.copy]).some(e=>e.key===`session.conversation_unknown`)}function tl(e,t){let n=Lc(e,t);if(n.type===`error`)throw $c(Zc.parse(n),`internal`);return n}function nl(e,t,n){let r=e.split(`
|
|
7
|
+
`),i=r.pop()??``;for(let e of r)e.trim()&&n(tl(t,e));return i}async function rl(e,t,n,r){if(!e.body)throw new M(`bad_response`,`stream reply has no body`);let i=e.body.getReader(),a=new TextDecoder,o=``,s=()=>{i.cancel()};r?.addEventListener(`abort`,s,{once:!0});try{for(;;){Ze(r);let{done:e,value:s}=await i.read();if(e)break;o=nl(o+a.decode(s,{stream:!0}),t,n)}let e=o.trim();e&&n(tl(t,e))}finally{r?.removeEventListener(`abort`,s)}}async function il(e){let t=typeof e.headers==`function`?await e.headers():e.headers,n=new Headers(t);return n.set(`content-type`,`application/json`),n}async function al(e,t){let n=await e.text(),r;try{r=JSON.parse(n),t?.(r)}catch{return $c({errorInternal:`HTTP ${String(e.status)}`},rt(e.status))}let i=Zc.safeParse(r);return i.success?$c({...i.data,errorInternal:i.data.errorInternal??`HTTP ${String(e.status)}`},rt(e.status)):new M(`bad_response`,`HTTP ${String(e.status)} error body failed its wire check`)}async function ol(e,t,n){let r=n.fetch??globalThis.fetch.bind(globalThis);try{return await r(e,{...t,headers:await il(n),credentials:n.credentials??`same-origin`})}catch(e){throw Ot(e)?e:new M(`network`,st(e),{cause:e})}}async function sl(e,t,n,r,i={}){await rl(await cl(e,t,i),n,r,i.signal)}async function cl(e,t,n){let r=await ol(e,{method:`POST`,body:JSON.stringify(t),signal:n.signal},n);if(!r.ok)throw await al(r);return r}async function ll(e,t,n={}){await cl(e,t,n)}async function ul(e,t,n={}){let r=await ol(e,{...t.body===void 0?{method:`GET`}:{method:`POST`,body:JSON.stringify(t.body)},signal:t.signal},n);if(!r.ok)throw await al(r,t.failed);return Rc(await r.text())}async function dl(e,t,n={}){let{signal:r,...i}=n;return J(Kc,await ul(e,{body:t,signal:r},i),`the conversation`)}async function fl(e,t,n,r){let{signal:i,...a}=n;return J(qc,await ul(e,{body:t,signal:i},a),r)}function pl(e,t,n={}){return fl(e,t,n,`the rewound conversation`)}function ml(e,t,n={}){return fl(e,t,n,`the started conversation`)}function hl(e){let t=e.length;for(;t>0&&e[t-1]===`/`;)--t;return e.slice(0,t)}var gl=v({interface:G});function _l(e={}){let t=hl(e.endpoint??`/api/theorem`);return{async describe(n){let r=await ol(t,{method:`GET`,signal:n},e);if(!r.ok)throw await al(r);return J(gl,Rc(await r.text()),`the profile description`).interface},turn:({replay:n,...r},i,a)=>sl(`${t}/turn`,r,Gc,i,{...e,signal:a}),invoke:({replay:n,...r},i,a)=>sl(`${t}/invoke`,r,Gc,i,{...e,signal:a}),conversation:(n,r)=>dl(`${t}/conversation`,n,{...e,signal:r}),rewind:(n,r)=>pl(`${t}/rewind`,n,{...e,signal:r}),pageResult:(n,r)=>ll(`${t}/page-result`,n,{...e,signal:r}),steer:n=>ll(`${t}/steer`,n,e),stop:n=>ll(`${t}/stop`,n,e)}}function vl(e,t){if(typeof e==`string`)return e;let n=Array.isArray(e)?e:Object.keys(e);return n.length?vl(n[0],t):t}function yl(e){return Object.entries(e).map(([e,t])=>({id:e,type:t.type,labels:t.type===`choice`?Object.keys(t.criteria):t.type===`score`?t.criteria.map((e,t)=>vl(e,String(t))):[],...t.type===`box`&&t.image!==void 0?{image:t.image}:{}}))}function bl(e,t,n){return{type:`decision`,identity:{handle:e.identity.handle},contract:e.decision.contract,...e.inputs.maxStateBytes===void 0?{}:{maxStateBytes:e.inputs.maxStateBytes},questions:yl(t),...n&&Object.keys(n).length>0?{images:n}:{},...e.observability?{observability:{record:Gt(e.observability).record}}:{}}}function xl(e,t){let n=Object.keys(t??{}).find(t=>e&&Object.hasOwn(e,t));if(n!==void 0)throw new M(`request`,`the image ${n} is the host's, so the page's needs another name`);let r={...e,...t};return Object.keys(r).length>0?r:void 0}var X=h().min(0).max(1),Sl=_(g(),X),Cl=f(`type`,[v({type:c(`choice`),choice:g(),confidence:X,probabilities:Sl}),v({type:c(`noul`),noul:X}),v({type:c(`box`),box:v({top:X,bottom:X,left:X,right:X}),confidence:X}),v({type:c(`score`),score:h().nonnegative(),confidence:X,legend:_(g(),g().min(1)),probabilities:Sl})]),wl=v({id:g(),type:d([`choice`,`noul`,`score`,`box`]),labels:l(g()),image:g().optional()}),Tl=v({result:v({model:g().min(1),questions:l(wl).optional(),answers:_(g(),Cl),usage:v({inputTokens:h().int().nonnegative(),outputTokens:h().int().nonnegative(),costUsd:h().nonnegative().optional()}).optional()}),traces:l(qt).optional()}),El=new WeakMap;function Dl(e,t){return t.length>0&&typeof e==`object`&&e&&El.set(e,t),e}function Ol(e){return typeof e==`object`&&!!e&&El.get(e)||[]}var kl=v({traces:l(qt)});async function Al(e,t,n,r,i){let a=[],o=e=>{let t=kl.safeParse(e);t.success&&(a=t.data.traces)};try{return i(await ul(e,{body:t,signal:n,failed:o},r))}catch(e){throw Dl(e,a)}}function jl(e,t,n,r={}){return Al(e,t,n,r,Ml)}function Ml(e){return J(Tl,e,`the decision`)}var Nl=v({interface:v({type:c(`decision`),identity:v({handle:g()}),contract:g(),maxStateBytes:h().optional(),questions:l(wl),build:v({input:_(g(),n()).optional()}).optional(),images:_(g(),v({mimeType:d([`image/png`,`image/jpeg`]),data:g()})).optional(),observability:v({record:o()}).optional()})});function Pl(e={}){let t=(e.endpoint??`/api/decision`).replace(/\/$/,``);return{async describe(n){return J(Nl,await ul(t,{signal:n},e),`the decision description`).interface},decide:(n,r,i,a)=>jl(`${t}/decide`,{state:n,...i?{assets:i}:{},...a===void 0?{}:{input:a}},r,e)}}function Fl(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Z(e,t){let n=e[t];return typeof n==`string`&&n.trim()?n.trim():void 0}function Q(e,t){if(!URL.canParse(t))return;let n=new URL(t);if(n.protocol===`http:`||n.protocol===`https:`)return{title:e.trim()||n.hostname.replace(/^www\./,``),uri:n.href,type:`web`}}function Il(e){let t=new Set;return e.filter(e=>!t.has(e.uri)&&(t.add(e.uri),!0))}function Ll(e){let t=[...e.matchAll(/\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)/g)].flatMap(e=>Q(e[1]??``,e[2]??``)??[]),n=[...e.matchAll(/https?:\/\/[^\s"'<>\]]+/g)].flatMap(e=>{let t=(e[0]??``).replace(/[),.;:]+$/,``);return Q(t,t)??[]});return Il([...t,...n])}function Rl(e){if(Array.isArray(e))return e;if(!Fl(e))return[];for(let t of[`items`,`results`,`search_results`,`models`,`datasets`]){let n=e[t];if(Array.isArray(n))return n}return[]}function zl(e,t){return Il(e.flatMap(e=>Fl(e)?t(e)??[]:[]))}function Bl(e,t){let n=t===`dataset`?`https://huggingface.co/datasets/`:`https://huggingface.co/`;return zl(Rl(e),e=>{let t=Z(e,`id`)??Z(e,`modelId`);return t?Q(t,`${n}${t}`):void 0})}function Vl(e){return zl(Rl(e),e=>{let t=Z(e,`html_url`),n=Z(e,`full_name`)??Z(e,`name`);return t?Q(n??t,t):void 0})}function Hl(e){return e.replace(/<[^>]+>/g,``).replace(/\s+/g,` `).trim()}function Ul(e){if(typeof e!=`string`)return Ll(JSON.stringify(e));let t=[...e.matchAll(/<entry\b[\s\S]*?<\/entry>/g)];return t.length===0?Ll(e):Il(t.flatMap(e=>{let t=/<id>(https?:\/\/[^<]+)<\/id>/.exec(e[0]??``)?.[1],n=/<title>([\s\S]*?)<\/title>/.exec(e[0]??``)?.[1];return t?Q(Hl(n??t),t)??[]:[]}))}function $(e){if(typeof e==`string`)return Ll(e);if(Array.isArray(e)||Fl(e)){let t=zl(Rl(e),e=>{let t=Z(e,`html_url`)??Z(e,`url`)??Z(e,`source_url`)??Z(e,`contentUrl`),n=Z(e,`title`)??Z(e,`name`)??t;return t?Q(n??t,t):void 0});return t.length>0?t:Ll(JSON.stringify(e))}return[]}var Wl={search_models:e=>Bl(e,`model`),search_datasets:e=>Bl(e,`dataset`),search_github:Vl,list_arxiv:Ul,search_web:$,read_pages:$,read_model_card:$,read_dataset_card:$,read_readme:$,find_library:$,read_library_docs:$,ask_repo_docs:$};function Gl(e){return Wl[e]}function Kl(e,t){let n=Gl(e);return n?{...t,sources:n}:t}function ql(e,t,n={}){let r={name:t.name,description:t.description,category:t.category,access:t.access,paths:t.paths,loadTier:t.loadTier,permission:t.permission,...t.labels?{labels:t.labels}:{}};if(t.type===`agent`){e.register({...r,type:`agent`,profile:t.profile,...t.maxCallsPerTurn===void 0?{}:{maxCallsPerTurn:t.maxCallsPerTurn}});return}let i={...r,input:Ae(t.inputSchema),output:Ae(t.outputSchema)};if(t.type===`http`){e.register(Kl(t.name,{...i,type:`http`,endpoint:t.endpoint,method:t.method,headers:t.headers,mapping:t.mapping,auth:t.auth,maxResponseBytes:t.maxResponseBytes}));return}if(t.type===`mcp`){e.register(Kl(t.name,{...i,type:`mcp`,serverUrl:t.serverUrl,mcpToolName:t.mcpToolName,headers:t.headers,auth:t.auth,maxResponseBytes:t.maxResponseBytes,session:t.session}));return}if(t.answeredBy===`page`){e.register({...i,type:`function`,answeredBy:`page`});return}let a=t.stubResponse||!Object.hasOwn(n,t.name)?void 0:n[t.name],o=t.stubResponse??Yt(t.outputSchema);e.register({...i,type:`function`,handler:a?e=>{try{return Promise.resolve(a(e))}catch(e){return Promise.reject(e instanceof Error?e:Error(String(e)))}}:()=>Promise.resolve(o)})}function Jl(e,t,n){e.registerMany([...oe,...ue]);for(let r of t)ql(e,r,n)}function Yl(e,t,n,r,i){return Jl(e.tools,n,i),r&&t.type!==`live`&&e.schemas.register(r.id,r.spec),e.profiles.register(t),t}function Xl(e){if(e.type===`error`&&e.errorInternal!==void 0){let{errorInternal:t,...n}=e;return{...n,error:t}}if(e.type===`session`&&e.session.kind===`ended`&&e.errorInternal!==void 0){let{errorInternal:t,...n}=e;return{...n,session:{...e.session,message:t}}}if(e.type===`tool`&&e.tool.phase===`error`&&e.tool.failure.error!==void 0){let{failure:t}=e.tool;return{...e,tool:{...e.tool,failure:{...t,error:t.message}}}}return e}function Zl(e){if(e.type!==`error`&&e.type!==`session`&&e.type!==`tool`||e.errorInternal===void 0)return e;let{errorInternal:t,...n}=e;return n}function Ql(e){if(e.type!==`compaction`||e.failure?.errorInternal===void 0)return e;let{errorInternal:t,...n}=e.failure;return{...e,failure:n}}function $l(e){if(e.type!==`guardrail`||!(e.guardrail?.errorInternal||e.guardrail?.errorSummary))return e;let{errorInternal:t,errorSummary:n,...r}=e.guardrail;return{...e,guardrail:r}}function eu(e){if(e.type!==`evidence`||!e.evidence?.raw)return e;let{raw:t,...n}=e.evidence;return{...e,evidence:n}}function tu(e,t){let n=t?.reader===`builder`?Xl(e):Ql($l(Zl(e)));return t?.includeEvidenceRaw||(n=eu(n)),n=Qt(n,!1),n}function nu(e,t){return e.map(e=>tu(e,t))}function ru(e,t,n){let{error:r=``,errorKind:i,errorCopy:a}=tu(dt(et(e),t),n);return{error:r,errorKind:i,...a?{errorCopy:a}:{}}}var iu={reader:`builder`};function au(e){return e.mode===`demo`?{reader:`visitor`}:iu}export{qa as $,Lc as A,Yr as At,Ws as B,vr as Bt,Qc as C,ai as Ct,sl as D,$r as Dt,ll as E,Qr as Et,Xs as F,Kr as Ft,lo as G,Jn as Gt,Ts as H,Xn as Ht,Es as I,Gr as It,so as J,Wn as Jt,co as K,V as Kt,ks as L,Pr as Lt,q as M,Wr as Mt,Sc as N,zr as Nt,J as O,ei as Ot,Zs as P,Ur as Pt,Pa as Q,Qt,Bs as R,Dr as Rt,$c as S,H as St,el as T,bi as Tt,is as U,Yn as Ut,Gs as V,yr as Vt,Co as W,qn as Wt,eo as X,Zt as Xt,$a as Y,nn as Yt,to as Z,Xt as Zt,_l as _,Di as _t,nu as a,Ma as at,pl as b,yi as bt,Pl as c,Na as ct,Ol as d,ia as dt,Ua as et,jl as f,_a as ft,Jc as g,Ji as gt,Gc as h,Xi as ht,tu as i,Ha as it,Fc as j,qr as jt,Mc as k,Zr as kt,xl as l,Aa as lt,Dl as m,Qi as mt,au as n,Wa as nt,Yl as o,Da as ot,Al as p,ma as pt,oo as q,Gn as qt,ru as r,Xa as rt,Jl as s,ka as st,iu as t,Ya as tt,bl as u,ja as ut,dl as v,gi as vt,Yc as w,ii as wt,ml as x,hi as xt,ul as y,_i as yt,Ds as z,_r as zt};
|