@gengage/assistant-fe 0.3.3 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/dist/assistant-fe.css +1 -1
- package/dist/chat/components/AITopPicks.d.ts.map +1 -1
- package/dist/chat/components/GroundingReviewCard.d.ts.map +1 -1
- package/dist/chat/components/ReviewHighlights.d.ts +3 -1
- package/dist/chat/components/ReviewHighlights.d.ts.map +1 -1
- package/dist/chat/components/renderUISpec.d.ts.map +1 -1
- package/dist/chat/index.d.ts +12 -0
- package/dist/chat/index.d.ts.map +1 -1
- package/dist/chat/locales/en.d.ts.map +1 -1
- package/dist/chat/locales/tr.d.ts.map +1 -1
- package/dist/chat/types.d.ts +16 -5
- package/dist/chat/types.d.ts.map +1 -1
- package/dist/chat/utils/ui.d.ts +11 -0
- package/dist/chat/utils/ui.d.ts.map +1 -0
- package/dist/chat-CCSPwPmr.cjs +13 -0
- package/dist/chat-CCSPwPmr.cjs.map +1 -0
- package/dist/{chat-DrbdN7yo.js → chat-tG_XXqmm.js} +507 -394
- package/dist/chat-tG_XXqmm.js.map +1 -0
- package/dist/chat.cjs +1 -1
- package/dist/chat.iife.js +14 -14
- package/dist/chat.iife.js.map +1 -1
- package/dist/chat.js +1 -1
- package/dist/common/overlay.d.ts +2 -0
- package/dist/common/overlay.d.ts.map +1 -1
- package/dist/common/protocol-adapter.d.ts.map +1 -1
- package/dist/common/types.d.ts +1 -1
- package/dist/{common-DuTZ9psy.cjs → common-BQVcjB7s.cjs} +2 -2
- package/dist/{common-DuTZ9psy.cjs.map → common-BQVcjB7s.cjs.map} +1 -1
- package/dist/{common-4RfhKX4z.js → common-BtEjhpH-.js} +3 -3
- package/dist/{common-4RfhKX4z.js.map → common-BtEjhpH-.js.map} +1 -1
- package/dist/common.cjs +1 -1
- package/dist/common.js +4 -4
- package/dist/index.cjs +1 -1
- package/dist/index.js +6 -6
- package/dist/native-webview-CEgjvGWF.cjs +2 -0
- package/dist/native-webview-CEgjvGWF.cjs.map +1 -0
- package/dist/{native-webview-BHGSwpmL.js → native-webview-QLwuablV.js} +6 -6
- package/dist/native-webview-QLwuablV.js.map +1 -0
- package/dist/native.cjs +1 -1
- package/dist/native.iife.js +14 -14
- package/dist/native.iife.js.map +1 -1
- package/dist/native.js +1 -1
- package/dist/product-utils-BEnINMdx.cjs +2 -0
- package/dist/{product-utils-CUJMklz6.cjs.map → product-utils-BEnINMdx.cjs.map} +1 -1
- package/dist/{product-utils-CO7BBSGE.js → product-utils-BUalkWz3.js} +2 -2
- package/dist/{product-utils-CO7BBSGE.js.map → product-utils-BUalkWz3.js.map} +1 -1
- package/dist/{qna-DbmSBAP2.js → qna-C7XoZSSw.js} +2 -2
- package/dist/{qna-DbmSBAP2.js.map → qna-C7XoZSSw.js.map} +1 -1
- package/dist/{qna-DCtpM8u1.cjs → qna-cn9DHuBF.cjs} +2 -2
- package/dist/{qna-DCtpM8u1.cjs.map → qna-cn9DHuBF.cjs.map} +1 -1
- package/dist/qna.cjs +1 -1
- package/dist/qna.css +1 -1
- package/dist/qna.iife.js +1 -1
- package/dist/qna.iife.js.map +1 -1
- package/dist/qna.js +1 -1
- package/dist/{schemas-BhJLrCGk.js → schemas-Dcfz5vXW.js} +8 -19
- package/dist/schemas-Dcfz5vXW.js.map +1 -0
- package/dist/{schemas-Byx40x9I.cjs → schemas-DeE-RHGa.cjs} +2 -2
- package/dist/schemas-DeE-RHGa.cjs.map +1 -0
- package/dist/simbut.css +1 -1
- package/dist/{simrel-Bvsumvpl.cjs → simrel-CVKjhHee.cjs} +2 -2
- package/dist/{simrel-Bvsumvpl.cjs.map → simrel-CVKjhHee.cjs.map} +1 -1
- package/dist/{simrel-Dd_bVL7o.js → simrel-R3mVoFQG.js} +3 -3
- package/dist/{simrel-Dd_bVL7o.js.map → simrel-R3mVoFQG.js.map} +1 -1
- package/dist/simrel.cjs +1 -1
- package/dist/simrel.css +1 -1
- package/dist/simrel.iife.js +1 -1
- package/dist/simrel.iife.js.map +1 -1
- package/dist/simrel.js +1 -1
- package/package.json +1 -1
- package/dist/chat-CLbwX39O.cjs +0 -13
- package/dist/chat-CLbwX39O.cjs.map +0 -1
- package/dist/chat-DrbdN7yo.js.map +0 -1
- package/dist/native-webview-BHGSwpmL.js.map +0 -1
- package/dist/native-webview-DMWWHLVh.cjs +0 -2
- package/dist/native-webview-DMWWHLVh.cjs.map +0 -1
- package/dist/product-utils-CUJMklz6.cjs +0 -2
- package/dist/schemas-BhJLrCGk.js.map +0 -1
- package/dist/schemas-Byx40x9I.cjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const e=require(`./ga-datalayer-boRrTCtO.cjs`);var t=({element:e,renderElement:t})=>{if(!e.children||e.children.length===0)return null;let n=document.createElement(`div`);for(let r of e.children){let e=t(r);e&&n.appendChild(e)}return n};function n(e){let n=document.createElement(`div`);if(n.className=e.containerClassName,!e.spec.elements[e.spec.root])return n;let r=e.unknownRenderer??t,i=t=>{let n=e.spec.elements[t];if(!n)return null;let a=e.registry[n.type];return a?a({elementId:t,element:n,spec:e.spec,context:e.context,renderElement:i}):r({elementId:t,element:n,spec:e.spec,context:e.context,renderElement:i})},a=i(e.spec.root);return a&&n.appendChild(a),n}function r(e,t){if(!t)return e;let n={...e};for(let[e,r]of Object.entries(t))r&&(n[e]=r);return n}function i(e){return typeof e==`object`&&!!e&&typeof e.type==`string`}function a(e){let t=[],n=0,r=!1,i=!1,a=0;for(let o=0;o<e.length;o++){let s=e[o];if(i){i=!1;continue}if(s===`\\`&&r){i=!0;continue}if(s===`"`){r=!r;continue}r||(s===`{`&&n++,s===`}`&&(n--,n===0&&(t.push(e.slice(a,o+1)),a=o+1)))}return t.length>0?t:[e]}function o(t,n){let r=t.trim();if(!r||r.startsWith(`:`))return!1;let o=r.startsWith(`data: `)?r.slice(6):r;if(o===`[DONE]`)return n.onDone?.(),!0;try{let t=JSON.parse(o);return i(t)?(e.b(`stream`,`event: ${t.type}`,t),n.onEvent(t),t.type===`done`?(n.onDone?.(),!0):!1):!1}catch{let e=a(o);if(e.length>1){for(let t of e)try{let e=JSON.parse(t);if(!i(e))continue;if(n.onEvent(e),e.type===`done`)return n.onDone?.(),!0}catch{}return!1}return!1}}async function s(e,t){if(!e.ok){t.onError?.(Error(`HTTP ${e.status}: ${e.statusText}`));return}if(!e.body){t.onError?.(Error(`Response body is null — streaming not supported`));return}let n=e.body.getReader(),r=new TextDecoder(`utf-8`),i=``,a=t.idleTimeoutMs??6e4,s=Symbol(`idle-timeout`),c=!1;try{for(;;){let e=n.read(),l,u=await(a>0?Promise.race([e.then(e=>(clearTimeout(l),e)),new Promise(e=>{l=setTimeout(()=>e(s),a)})]):e);if(u===s){c=!0,await n.cancel();break}let{done:d,value:f}=u;if(d)break;i+=r.decode(f,{stream:!0});let p=i.split(`
|
|
2
|
-
`);i=p.pop()??``;for(let e of p)if(o(e,t))return}if(i.trim()&&o(i,t))return}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return;t.onError?.(e instanceof Error?e:Error(String(e)))}finally{c||n.releaseLock()}t.onDone?.()}function c(e,t,n){let r=new AbortController,i=n.signal?l([n.signal,r.signal]):r.signal;return fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`,...n.headers},body:JSON.stringify(t),signal:i}).then(e=>s(e,{...n,signal:i})).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||n.onError?.(e instanceof Error?e:Error(String(e)))}),r}function l(e){let t=new AbortController,n=[];for(let r of e){if(r.aborted)return t.abort(r.reason),t.signal;let e=()=>t.abort(r.reason);r.addEventListener(`abort`,e,{once:!0}),n.push(()=>r.removeEventListener(`abort`,e))}return t.signal.addEventListener(`abort`,()=>{for(let e of n)e()},{once:!0}),t.signal}var u=3,d=(e,t)=>{let n=e.replace(/\s+/g,` `).trim().replace(/^[,.;:!?•-]+|[,.;:!?•-]+$/g,``);if(!n)return``;let r=t?.stripLeadingStopWords?n.replace(/^(?:daha|için)\s+/i,``).trim():n;return r?r.split(/\s+/).slice(0,3).join(` `).trim():``},f=(e,t)=>e?e.split(/[•,;:/()]|(?:\sve\s)|(?:\sand\s)|(?:\sile\s)|(?:\sfor\s)|(?:\swith\s)/i).map(e=>d(e,t)).filter(Boolean):[];function p(e){let t=(e.display_keywords??[]).flatMap(e=>f(e,{stripLeadingStopWords:!0})),n=t.filter((e,n)=>t.indexOf(e)===n);if(n.length>0)return n.slice(0,u);let r=[...f(e.chosen_attribute,{stripLeadingStopWords:!0}),...f(e.short_name)];return r.filter((e,t)=>r.indexOf(e)===t).slice(0,u)}function m(e){return p(e).join(` • `)}function h(e){if(typeof e.type!=`string`)return null;if(g(e))return e;let t=e;switch(t.type){case`outputText`:return ee(t);case`suggestedActions`:return te(t);case`productList`:return ne(t);case`productDetails`:return re(t);case`productDetailsSimilars`:return ie(t);case`comparisonTable`:return ae(t);case`context`:return le(t);case`chatStreamEnd`:return ue();case`loading`:return de(t);case`panelLoading`:return fe(t);case`similarLoading`:return pe(t);case`redirect`:return me(t);case`error`:return he(t);case`dummy`:return ge(t);case`launcherAction`:return _e(t);case`text`:return ve(t);case`productItem`:return ye(t);case`text_image`:return be(t);case`quick_qna`:return xe(t);case`reviewHighlights`:return Se(t);case`aiProductSuggestions`:return Te(t);case`aiProductGroupings`:return Ee(t);case`aiSuggestedSearches`:return De(t);case`prosAndCons`:return Ce(t);case`getGroundingReview`:return Oe(t);case`voice`:return Ae(t);case`visitorDataResponse`:return we(t);case`productListPreview`:return ke();case`groupList`:return je(t);case`formGetInfo`:case`formTestDrive`:case`formServiceRequest`:case`launchFormPage`:return Me(t);case`launcherContent`:return Pe(t);case`handoff`:return Ne(t);default:return null}}function g(e){let t=e.type;if(typeof t!=`string`)return!1;switch(t){case`metadata`:return typeof e.sessionId==`string`&&typeof e.model==`string`;case`text_chunk`:return typeof e.content==`string`;case`ui_spec`:{let t=e.widget;if(t!==`chat`&&t!==`qna`&&t!==`simrel`)return!1;let n=v(e.spec);return n?typeof n.root==`string`&&v(n.elements)!==null:!1}case`action`:{let t=v(e.action);return t!==null&&typeof t.kind==`string`}case`error`:return typeof e.code==`string`&&typeof e.message==`string`;case`done`:return!0;default:return!1}}function ee(e){let t=y(e.payload.text,e.payload.plain_text)??``,n=y(e.payload.plain_text,e.payload.text)??t;if(e.payload.is_error)return{type:`error`,code:`BACKEND_ERROR`,message:n||`Backend returned an error`};let r={type:`text_chunk`,content:t,final:!0},i=e.payload.product_mentions;Array.isArray(i)&&i.length>0&&(r.productMentions=i.filter(e=>typeof e==`object`&&!!e&&typeof e.sku==`string`&&typeof e.short_name==`string`));let a=e.payload.sku_to_product_item;a&&typeof a==`object`&&!Array.isArray(a)&&(r.skuToProductItem=a);let o=e.payload.conversation_mode;return typeof o==`string`&&o&&(r.conversationMode=o),r}function te(e){return Fe((e.payload.actions??[]).map(e=>{let t=y(e.title)??``,n=_(e.requestDetails,t),r=n?{label:t,action:n}:null;return r?(typeof e.icon==`string`&&(r.icon=e.icon),typeof e.image==`string`&&(r.image=e.image),r):null}).filter(Ue),`chat`)}function ne(e){let t=Ie(e.payload.product_list??[],`chat`);t.panelHint=`panel`;let n=t.spec.elements[t.spec.root];return n&&(typeof e.payload.offset==`number`&&(n.props={...n.props,offset:e.payload.offset}),typeof e.payload.end_of_list==`boolean`&&(n.props={...n.props,endOfList:e.payload.end_of_list}),typeof e.payload.title==`string`&&(n.props={...n.props,panelTitle:e.payload.title})),t}function re(e){let t=e.payload.productDetails;if(!t)return Re(`chat`);let n=x(t),r={...t,...n};return e.payload.hide_side_panel===!0?{type:`ui_spec`,widget:`chat`,spec:{root:`root`,elements:{root:{type:`ProductSummaryCard`,props:{product:r}}}},clearPanel:!0}:{type:`ui_spec`,widget:`chat`,spec:{root:`root`,elements:{root:{type:`ProductDetailsPanel`,props:{product:r}}}},panelHint:`panel`}}function ie(e){let t=Ie(e.payload.similarProducts??[],`chat`),n=t.spec.elements[t.spec.root];return n&&(n.props={...n.props,similarsAppend:!0}),{...t,panelHint:`panel`}}function ae(e){let t=e.payload.multiple_product_details??[],n=e.payload,r={key_differences:n.key_differences,recommended_choice:n.recommended_choice,recommended_choice_sku:n.recommended_choice_sku,special_considerations:n.special_considerations,criteria_view:n.criteria_view,criteria_view_short:n.criteria_view_short,compared_field_names:n.compared_field_names,winner_product:n.winner_product,winner_hits:n.winner_hits,...e.payload.product_comparison_framework??{}},i=e.payload.table,a=e.payload.features_list,o=[];for(let e of t){let t=x(e);o.push(t)}let s=oe(i,o,r,a),c;r?.recommended_choice_sku?c=r.recommended_choice_sku:r?.winner_product&&r.winner_product.length>0&&(c=r.winner_product[0]?.product_detail?.sku??r.winner_product[0]?.sku);let l=c?o.find(e=>e.sku===c)??o[0]:o[0],u=[];if(Array.isArray(r?.key_differences))for(let e of r.key_differences)typeof e==`string`&&u.push(e);let d=He(r?.special_considerations),f=r?.recommended_choice,p=r?.winner_hits,m={};for(let e of o){let t=e.sku;t&&(m[t]={title:e.name??t,type:`launchSingleProduct`,payload:{sku:t}})}let h={products:o,attributes:s,highlights:u,productActions:m};return l&&(h.recommended=l),d.length>0&&(h.specialCases=d),f&&(h.recommendedText=f),p&&(h.winnerHits=p),typeof r?.key_differences==`string`&&(h.keyDifferencesHtml=r.key_differences),r?.special_considerations&&(h.specialConsiderations=r.special_considerations),{type:`ui_spec`,widget:`chat`,spec:{root:`root`,elements:{root:{type:`ComparisonTable`,props:h}}},panelHint:`panel`}}function oe(e,t,n,r){if(!e)return[];let i=Object.entries(e);if(i.length===0)return[];let a=i[0]?.[1];if(Array.isArray(a)){let t=n.criteria_view??n.criteria_view_short??{},r=n.compared_field_names??Object.keys(e),i=[];for(let n of r){let r=e[n];if(!r||!Array.isArray(r))continue;let a=t[n]??n;i.push({label:a,values:r.map(e=>typeof e==`string`?e:String(e??``))})}return i}let o=e,s=t.map(e=>String(e.sku??``)).filter(e=>e.length>0),c=n.criteria_view??n.criteria_view_short??{},l=(r&&r.length>0?r:n.compared_field_names&&n.compared_field_names.length>0?n.compared_field_names:se(o)).filter(e=>e!==`name`&&e!==`name_short`&&!e.endsWith(`_short`)),u=[];for(let e of l){let t=s.map(t=>{let n=o[t];if(!n||typeof n!=`object`)return``;let r=n[`${e}_short`],i=n[e];return ce(r??i)});if(t.every(e=>e.length===0))continue;let n=c[e]??e;u.push({label:n,values:t})}return u}function se(e){let t=[],n=new Set;for(let r of Object.values(e))if(!(!r||typeof r!=`object`))for(let e of Object.keys(r))n.has(e)||(n.add(e),t.push(e));return t}function ce(e){return typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):``}function le(e){return{type:`metadata`,sessionId:``,model:``,meta:{panel:e.payload.panel,messages:e.payload.messages,message_id:e.payload.message_id}}}function ue(){return{type:`done`}}function de(e){return{type:`metadata`,sessionId:``,model:``,meta:{loading:!0,loadingText:e.payload.text,thinkingMessages:e.payload.thinking_messages,dynamicLoading:e.payload.is_dynamic===!0}}}function fe(e){return{type:`metadata`,sessionId:``,model:``,meta:{loading:!0,panelLoading:!0,panelPendingType:e.payload?.pending_type,loadingText:e.payload?.text}}}function pe(e){return{type:`metadata`,sessionId:``,model:``,meta:{loading:!0,similarPanelLoading:!0,panelPendingType:e.payload?.pending_type,loadingText:e.payload?.text}}}function me(e){let t=y(e.payload.url);return t?{type:`action`,action:{kind:`navigate`,url:t,newTab:e.payload.new_tab===!0}}:{type:`metadata`,sessionId:``,model:``,meta:{redirect:e.payload,redirectTarget:y(e.payload.to)}}}function he(e){return{type:`error`,code:`BACKEND_ERROR`,message:y(e.payload?.text,e.payload?.message,e.payload?.error)??`Backend returned an error`}}function ge(e){return{type:`metadata`,sessionId:``,model:``,meta:{noop:!0}}}function _e(e){let t=e.payload??{};if(Array.isArray(t.action_list)){let e={action_list:t.action_list},n=typeof t.type==`string`?t.type:void 0,r=typeof t.theme==`string`?t.theme:void 0;return n!==void 0&&(e.type=n),r!==void 0&&(e.theme=r),xe({type:`quick_qna`,payload:e})}let n=v(t.action);if(n){let e={action:n},r=typeof t.text==`string`?t.text:void 0,i=typeof t.image_url==`string`?t.image_url:void 0,a=typeof t.theme==`string`?t.theme:void 0;return r!==void 0&&(e.text=r),i!==void 0&&(e.image_url=i),a!==void 0&&(e.theme=a),be({type:`text_image`,payload:e})}let r=typeof t.text==`string`?t.text:``;if(r){let e={text:r},n=typeof t.type==`string`?t.type:void 0,i=typeof t.theme==`string`?t.theme:void 0,a=v(t.payload)??void 0;return n!==void 0&&(e.type=n),a!==void 0&&(e.payload=a),i!==void 0&&(e.theme=i),ve({type:`text`,payload:e})}return{type:`metadata`,sessionId:``,model:``,meta:{launcherAction:t}}}function ve(e){let t={text:y(e.payload.text)??``};return typeof e.payload.theme==`string`&&(t.theme=e.payload.theme),e.payload.payload!==void 0&&(t.payload=e.payload.payload),{type:`ui_spec`,widget:`qna`,spec:{root:`root`,elements:{root:{type:`QuestionHeading`,props:t}}}}}function ye(e){return Le(e.payload,`qna`)}function be(e){let t=y(e.payload.text)??``,n=_(e.payload.action,t);if(n){let r={label:t||n.title,action:n};return typeof e.payload.image_url==`string`&&(r.image=e.payload.image_url),typeof e.payload.theme==`string`&&(r.theme=e.payload.theme),{type:`ui_spec`,widget:`qna`,spec:{root:`root`,elements:{root:{type:`ActionButton`,props:r}}}}}let r={text:t};return typeof e.payload.theme==`string`&&(r.theme=e.payload.theme),ve({type:`text`,payload:r})}function xe(e){return Fe((e.payload.action_list??[]).map(e=>{let t=y(e.title)??``,n=_(e.requestDetails,t),r=n?{label:t,action:n}:null;return r?(typeof e.icon==`string`&&(r.icon=e.icon),typeof e.image==`string`&&(r.image=e.image),r):null}).filter(Ue),`qna`)}function Se(e){let t={reviews:(e.payload.reviews??[]).map(e=>{let t={};return typeof e.review_class==`string`&&(t.review_class=e.review_class),typeof e.review_text==`string`&&(t.review_text=e.review_text),(typeof e.review_rating==`string`||typeof e.review_rating==`number`)&&(t.review_rating=e.review_rating),typeof e.review_tag==`string`&&(t.review_tag=e.review_tag),t})};return typeof e.payload.sku==`string`&&(t.sku=e.payload.sku),{type:`ui_spec`,widget:`chat`,spec:{root:`root`,elements:{root:{type:`ReviewHighlights`,props:t}}}}}function Ce(e){let t={};return Array.isArray(e.payload.pros)&&(t.pros=e.payload.pros),Array.isArray(e.payload.cons)&&(t.cons=e.payload.cons),typeof e.payload.product_name==`string`&&(t.productName=e.payload.product_name),{type:`ui_spec`,widget:`chat`,spec:{root:`root`,elements:{root:{type:`ProsAndCons`,props:t}}}}}function we(e){return{type:`metadata`,sessionId:``,model:``,meta:{visitorDataResponse:e.payload}}}function Te(e){let t=e.payload.product_suggestions??[],n=[];for(let e=0;e<t.length;e++){let r=t[e];if(!r)continue;let i=ze(r);if(!i)continue;let a={product:i},o=_(r.requestDetails,i.name);o&&(a.action=o),typeof r.role==`string`&&(a.role=r.role),typeof r.reason==`string`&&(a.reason=r.reason),typeof r.review_highlight==`string`&&(a.reviewHighlight=r.review_highlight),Array.isArray(r.labels)&&(a.labels=r.labels),typeof r.expert_quality_score==`number`&&(a.expertQualityScore=r.expert_quality_score),n.push(a)}return n.length===0?{type:`metadata`,sessionId:``,model:``,meta:{aiProductSuggestions:e.payload.product_suggestions??[]}}:{type:`ui_spec`,widget:`chat`,spec:{root:`root`,elements:{root:{type:`AITopPicks`,props:{suggestions:n}}}}}}function Ee(e){let t=e.payload.product_groupings??[],n=[];for(let e=0;e<t.length;e++){let r=t[e];if(!r)continue;let i=y(r.name)??``,a=r.sku&&r.sku.length>0?{type:`findSimilar`,payload:{sku:r.sku}}:void 0,o=_(r.requestDetails??a,i);if(!o)continue;let s={name:i,action:o};if(Array.isArray(r.labels)){let e=r.labels.filter(e=>typeof e==`string`);e.length>0&&(s.labels=e)}typeof r.image==`string`&&(s.image=r.image),n.push(s)}return n.length===0?{type:`metadata`,sessionId:``,model:``,meta:{aiProductGroupings:e.payload.product_groupings??[]}}:{type:`ui_spec`,widget:`chat`,spec:{root:`root`,elements:{root:{type:`AIGroupingCards`,props:{entries:n}}}}}}function De(e){let t=e.payload.suggested_searches??[],n=[];for(let e=0;e<t.length;e++){let r=t[e];if(!r)continue;let i=y(r.short_name,r.chosen_attribute,r.detailed_user_message)??`Search ${e+1}`,a={},o=y(r.detailed_user_message);o&&(a.text=o);let s=v(v(r.requestDetails)?.payload),c=s?.group_skus;r.group_skus&&Array.isArray(r.group_skus)?a.group_skus=r.group_skus:Array.isArray(c)&&(a.group_skus=c.filter(e=>typeof e==`string`));let l=y(r.sku,r.representative_product_sku,s?.sku);l&&(a.sku=l),a.is_suggested_text=1;let u={type:`inputText`,payload:a},d=_(r.requestDetails,i),f=d?.type===`findSimilar`&&typeof a.text==`string`?_(u,i):d??_(u,i);if(!f)continue;let p={shortName:i,action:f},h=y(r.detailed_user_message);h&&h!==i&&(p.detailedMessage=h);let g=m(r);g&&g!==i&&g!==(h??``)&&(p.whyDifferent=g),typeof r.image==`string`&&(p.image=r.image),n.push(p)}return n.length===0?{type:`metadata`,sessionId:``,model:``,meta:{aiSuggestedSearches:e.payload.suggested_searches??[]}}:{type:`ui_spec`,widget:`chat`,spec:{root:`root`,elements:{root:{type:`AISuggestedSearchCards`,props:{entries:n}}}}}}function Oe(e){let t=_(e.payload.requestDetails,y(e.payload.review_count,e.payload.text,e.payload.title)??`Show product reviews`);if(!t)return{type:`metadata`,sessionId:``,model:``,meta:{groundingReview:e.payload}};let n={action:t};return e.payload.title&&(n.title=e.payload.title),e.payload.text&&(n.text=e.payload.text),e.payload.review_count&&(n.reviewCount=e.payload.review_count),{type:`ui_spec`,widget:`chat`,spec:{root:`root`,elements:{root:{type:`GroundingReviewCard`,props:n}}}}}function ke(){return{type:`metadata`,sessionId:``,model:``,meta:{analyzeAnimation:!0}}}function Ae(e){return{type:`metadata`,sessionId:``,model:``,meta:{voice:e.payload}}}function je(e){let t=e.payload.group_list??[],n=[];for(let e of t){let t=e.group_name??``,r=(e.product_list??[]).map(x);n.push({groupName:t,products:r})}let r=[];for(let t of e.payload.filter_tags??[]){let e=t.title??``;if(!e)continue;let n=_(t.requestDetails,e),i={title:e};n&&(i.action=n),r.push(i)}return{type:`ui_spec`,widget:`chat`,spec:{root:`root`,elements:{root:{type:`CategoriesContainer`,props:{groups:n,filterTags:r}}}},panelHint:`panel`}}function Me(e){return{type:`metadata`,sessionId:``,model:``,meta:{formType:e.type,formPayload:e.payload??{}}}}function Ne(e){let t={};return typeof e.payload?.summary==`string`&&(t.summary=e.payload.summary),Array.isArray(e.payload?.products_discussed)&&(t.products_discussed=e.payload.products_discussed),typeof e.payload?.user_sentiment==`string`&&(t.user_sentiment=e.payload.user_sentiment),{type:`ui_spec`,widget:`chat`,spec:{root:`root`,elements:{root:{type:`HandoffNotice`,props:t}}}}}function Pe(e){return{type:`metadata`,sessionId:``,model:``,meta:{launcherContent:e.payload??{}}}}function Fe(e,t){let n={},r=[];for(let t=0;t<e.length;t++){let i=e[t];if(!i)continue;let a=`action-${t}`;r.push(a);let o={label:i.label,action:i.action};i.icon!==void 0&&(o.icon=i.icon),i.image!==void 0&&(o.image=i.image),i.description!==void 0&&(o.description=i.description),n[a]={type:`ActionButton`,props:o}}return n.root={type:`ActionButtons`,props:{buttons:e.map(e=>{let t={label:e.label,action:e.action};return e.image!==void 0&&(t.image=e.image),e.description!==void 0&&(t.description=e.description),e.icon!==void 0&&(t.icon=e.icon),t})},children:r},{type:`ui_spec`,widget:t,spec:{root:`root`,elements:n}}}function Ie(e,t){let n={},r=[];for(let t=0;t<e.length;t++){let i=e[t];if(!i)continue;let a=x(i),o=`product-${t}`;r.push(o);let s={product:a,index:t};a.sku&&(s.action={title:a.name,type:`launchSingleProduct`,payload:{sku:a.sku}}),n[o]={type:`ProductCard`,props:s}}return n.root={type:`ProductGrid`,props:{layout:`grid`},children:r},{type:`ui_spec`,widget:t,spec:{root:`root`,elements:n}}}function Le(e,t){return{type:`ui_spec`,widget:t,spec:{root:`root`,elements:{root:{type:`ProductCard`,props:{product:x(e),index:0}}}}}}function Re(e){return{type:`ui_spec`,widget:e,spec:{root:`root`,elements:{root:{type:`ActionButtons`,props:{buttons:[]},children:[]}}}}}function ze(e){let t=y(e.sku),n=y(e.short_name);return Be(v(e.product_item)??e,t,n)}function Be(e,t,n){let r=y(e.sku,t),i=y(e.name,n);if(!r||!i)return null;let a={sku:r,name:i},o=y(e.brand);o&&(a.brand=o);let s=y(e.url);s&&(a.url=s);let c=Ve(e.images);if(c.length>0)a.images=c;else{let t=y(e.image,e.image_url,e.imageUrl);t&&(a.images=[t])}let l=b(e.price_discounted);l!==void 0&&(a.price_discounted=l);let u=b(e.price);u!==void 0&&(a.price=u);let d=b(e.rating);d!==void 0&&(a.rating=d);let f=b(e.review_count)??b(e.reviewCount);f!==void 0&&(a.review_count=f);let p=y(e.cart_code,e.cartCode);return p&&(a.cart_code=p),typeof e.in_stock==`boolean`&&(a.in_stock=e.in_stock),typeof e.inStock==`boolean`&&(a.in_stock=e.inStock),x(a)}function _(e,t){let n=v(e);if(!n)return null;let r=n.type;if(typeof r!=`string`||r.length===0)return null;let i={title:t||r,type:r};return n.payload!==void 0&&(i.payload=n.payload),i}function v(e){return!e||typeof e!=`object`||Array.isArray(e)?null:e}function y(...e){for(let t of e)if(typeof t==`string`){let e=t.trim();if(e.length>0)return e}}function Ve(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.length>0):[]}function He(e){if(typeof e==`string`){let t=e.trim();return t?[t]:[]}return Array.isArray(e)?e.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(e=>e.length>0):[]}function b(e){if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e==`string`){let t;t=e.includes(`.`)&&e.includes(`,`)?e.replace(/\./g,``).replace(`,`,`.`):e.replace(`,`,`.`);let n=Number(t);if(Number.isFinite(n))return n}}function Ue(e){return e!=null}var We=new Set([`sku`,`name`,`brand`,`images`,`price`,`price_discounted`,`price_currency`,`discount_reason`,`url`,`rating`,`review_count`,`cart_code`,`in_stock`,`category_ids`,`category_names`,`variants`,`facet_hits`,`promotions`]);function x(e){let t=e.price_discounted!=null&&e.price_discounted>0,n=t?e.price_discounted:e.price,r=t&&e.price!=null?e.price:void 0,i;r!=null&&n!=null&&r>0&&(i=Math.round((r-n)/r*100));let a=y(e.brand),o=y(e.name)??e.sku,s=a&&!o.toLowerCase().startsWith(a.toLowerCase())?`${a} ${o}`:o,c={sku:e.sku,name:s,url:y(e.url)??``},l=e.images?.[0];l&&(c.imageUrl=l),e.images&&e.images.length>1&&(c.images=e.images),n!=null&&(c.price=String(n)),r!=null&&(c.originalPrice=String(r)),i!==void 0&&(c.discountPercent=i),a!==void 0&&(c.brand=a),e.rating!==void 0&&(c.rating=e.rating),e.review_count!==void 0&&(c.reviewCount=e.review_count),e.cart_code!==void 0&&(c.cartCode=e.cart_code),e.in_stock!==void 0&&(c.inStock=e.in_stock),e.variants&&e.variants.length>0&&(c.variants=e.variants),e.discount_reason!==void 0&&(c.discountReason=e.discount_reason),e.promotions&&e.promotions.length>0&&(c.promotions=e.promotions);let u=e,d={},f=!1;for(let e of Object.keys(u))We.has(e)||(d[e]=u[e],f=!0);return f&&(c.extras=d),c}function Ge(e){return e.results.map(x)}function Ke(e){return e.product_groupings.map(e=>{let t={name:e.name,products:(e.group_products??[]).map(x)};return e.highlight!==void 0&&(t.highlight=e.highlight),t})}var qe={process_action:`/process_action`,launcher_action:`/launcher_action`,similar_products:`/similar_products`,product_groupings:`/product_groupings`};function Je(e){if(e===void 0)throw Error(`[gengage] middlewareUrl is required. Pass your Gengage backend URL in widget config.`);let t=e.trim();return t===``?``:t.replace(/\/+$/,``)}function Ye(e,t){return`${Je(t?.middlewareUrl)}/chat${qe[e]}`}Object.freeze({status:`aborted`});function S(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var C=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Xe=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},Ze={};function w(e){return e&&Object.assign(Ze,e),Ze}function Qe(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function $e(e,t){return typeof t==`bigint`?t.toString():t}function et(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function tt(e){return e==null}function nt(e){let t=e.startsWith(`^`)?1:0,n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function rt(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var it=Symbol(`evaluating`);function T(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==it)return r===void 0&&(r=it,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function E(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function D(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function at(e){return JSON.stringify(e)}function ot(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var st=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function O(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var ct=et(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function k(e){if(O(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(O(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function lt(e){return k(e)?{...e}:Array.isArray(e)?[...e]:e}var ut=new Set([`string`,`number`,`symbol`]);function A(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function j(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function M(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function dt(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var ft={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function pt(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return j(e,D(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return E(this,`shape`,e),e},checks:[]}))}function mt(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return j(e,D(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return E(this,`shape`,r),r},checks:[]}))}function ht(e,t){if(!k(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return j(e,D(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return E(this,`shape`,n),n}}))}function gt(e,t){if(!k(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return j(e,D(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return E(this,`shape`,n),n}}))}function _t(e,t){return j(e,D(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return E(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function vt(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return j(t,D(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return E(this,`shape`,i),i},checks:[]}))}function yt(e,t,n){return j(t,D(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return E(this,`shape`,i),i}}))}function N(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function P(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function F(e){return typeof e==`string`?e:e?.message}function I(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=F(e.inst?._zod.def?.error?.(e))??F(t?.error?.(e))??F(n.customError?.(e))??F(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function bt(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function L(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var xt=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,$e,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},St=S(`$ZodError`,xt),Ct=S(`$ZodError`,xt,{Parent:Error});function wt(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Tt(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}var Et=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new C;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>I(e,a,w())));throw st(t,i?.callee),t}return o.value},Dt=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>I(e,a,w())));throw st(t,i?.callee),t}return o.value},Ot=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new C;return a.issues.length?{success:!1,error:new(e??St)(a.issues.map(e=>I(e,i,w())))}:{success:!0,data:a.value}},kt=Ot(Ct),R=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>I(e,i,w())))}:{success:!0,data:a.value}},At=R(Ct),jt=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Et(e)(t,n,i)},Mt=e=>(t,n,r)=>Et(e)(t,n,r),Nt=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Dt(e)(t,n,i)},Pt=e=>async(t,n,r)=>Dt(e)(t,n,r),Ft=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Ot(e)(t,n,i)},It=e=>(t,n,r)=>Ot(e)(t,n,r),Lt=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return R(e)(t,n,i)},Rt=e=>async(t,n,r)=>R(e)(t,n,r),zt=/^[cC][^\s-]{8,}$/,Bt=/^[0-9a-z]+$/,Vt=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ht=/^[0-9a-vA-V]{20}$/,Ut=/^[A-Za-z0-9]{27}$/,Wt=/^[a-zA-Z0-9_-]{21}$/,Gt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Kt=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,qt=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Jt=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Yt=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Xt(){return new RegExp(Yt,`u`)}var Zt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Qt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,$t=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,en=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,tn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,nn=/^[A-Za-z0-9_-]*$/,rn=/^\+[1-9]\d{6,14}$/,an=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,on=RegExp(`^${an}$`);function sn(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function cn(e){return RegExp(`^${sn(e)}$`)}function ln(e){let t=sn({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${an}T(?:${r})$`)}var un=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},dn=/^-?\d+$/,fn=/^-?\d+(?:\.\d+)?$/,pn=/^(?:true|false)$/i,mn=/^[^A-Z]*$/,hn=/^[^a-z]*$/,z=S(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),gn={number:`number`,bigint:`bigint`,object:`date`},_n=S(`$ZodCheckLessThan`,(e,t)=>{z.init(e,t);let n=gn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),vn=S(`$ZodCheckGreaterThan`,(e,t)=>{z.init(e,t);let n=gn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),yn=S(`$ZodCheckMultipleOf`,(e,t)=>{z.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):rt(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),bn=S(`$ZodCheckNumberFormat`,(e,t)=>{z.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=ft[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=dn)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),xn=S(`$ZodCheckMaxLength`,(e,t)=>{var n;z.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!tt(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=bt(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Sn=S(`$ZodCheckMinLength`,(e,t)=>{var n;z.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!tt(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=bt(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Cn=S(`$ZodCheckLengthEquals`,(e,t)=>{var n;z.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!tt(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=bt(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),B=S(`$ZodCheckStringFormat`,(e,t)=>{var n,r;z.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),wn=S(`$ZodCheckRegex`,(e,t)=>{B.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Tn=S(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=mn,B.init(e,t)}),En=S(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=hn,B.init(e,t)}),Dn=S(`$ZodCheckIncludes`,(e,t)=>{z.init(e,t);let n=A(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),On=S(`$ZodCheckStartsWith`,(e,t)=>{z.init(e,t);let n=RegExp(`^${A(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),kn=S(`$ZodCheckEndsWith`,(e,t)=>{z.init(e,t);let n=RegExp(`.*${A(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),An=S(`$ZodCheckOverwrite`,(e,t)=>{z.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),jn=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
2
|
+
`);i=p.pop()??``;for(let e of p)if(o(e,t))return}if(i.trim()&&o(i,t))return}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return;t.onError?.(e instanceof Error?e:Error(String(e)))}finally{c||n.releaseLock()}t.onDone?.()}function c(e,t,n){let r=new AbortController,i=n.signal?l([n.signal,r.signal]):r.signal;return fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`,...n.headers},body:JSON.stringify(t),signal:i}).then(e=>s(e,{...n,signal:i})).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||n.onError?.(e instanceof Error?e:Error(String(e)))}),r}function l(e){let t=new AbortController,n=[];for(let r of e){if(r.aborted)return t.abort(r.reason),t.signal;let e=()=>t.abort(r.reason);r.addEventListener(`abort`,e,{once:!0}),n.push(()=>r.removeEventListener(`abort`,e))}return t.signal.addEventListener(`abort`,()=>{for(let e of n)e()},{once:!0}),t.signal}var u=3,d=(e,t)=>{let n=e.replace(/\s+/g,` `).trim().replace(/^[,.;:!?•-]+|[,.;:!?•-]+$/g,``);if(!n)return``;let r=t?.stripLeadingStopWords?n.replace(/^(?:daha|için)\s+/i,``).trim():n;return r?r.split(/\s+/).slice(0,3).join(` `).trim():``},f=(e,t)=>e?e.split(/[•,;:/()]|(?:\sve\s)|(?:\sand\s)|(?:\sile\s)|(?:\sfor\s)|(?:\swith\s)/i).map(e=>d(e,t)).filter(Boolean):[];function p(e){let t=(e.display_keywords??[]).flatMap(e=>f(e,{stripLeadingStopWords:!0})),n=t.filter((e,n)=>t.indexOf(e)===n);if(n.length>0)return n.slice(0,u);let r=[...f(e.chosen_attribute,{stripLeadingStopWords:!0}),...f(e.short_name)];return r.filter((e,t)=>r.indexOf(e)===t).slice(0,u)}function m(e){return p(e).join(` • `)}function h(e){if(typeof e.type!=`string`)return null;if(g(e))return e;let t=e;switch(t.type){case`outputText`:return ee(t);case`suggestedActions`:return te(t);case`productList`:return ne(t);case`productDetails`:return re(t);case`productDetailsSimilars`:return ie(t);case`comparisonTable`:return ae(t);case`context`:return le(t);case`chatStreamEnd`:return ue();case`loading`:return de(t);case`panelLoading`:return fe(t);case`similarLoading`:return pe(t);case`redirect`:return me(t);case`error`:return he(t);case`dummy`:return ge(t);case`launcherAction`:return _e(t);case`text`:return ve(t);case`productItem`:return ye(t);case`text_image`:return be(t);case`quick_qna`:return xe(t);case`reviewHighlights`:return Se(t);case`aiProductSuggestions`:return Te(t);case`aiProductGroupings`:return Ee(t);case`aiSuggestedSearches`:return De(t);case`prosAndCons`:return Ce(t);case`getGroundingReview`:return Oe(t);case`voice`:return Ae(t);case`visitorDataResponse`:return we(t);case`productListPreview`:return ke();case`groupList`:return je(t);case`formGetInfo`:case`formTestDrive`:case`formServiceRequest`:case`launchFormPage`:return Me(t);case`launcherContent`:return Pe(t);case`handoff`:return Ne(t);default:return null}}function g(e){let t=e.type;if(typeof t!=`string`)return!1;switch(t){case`metadata`:return typeof e.sessionId==`string`&&typeof e.model==`string`;case`text_chunk`:return typeof e.content==`string`;case`ui_spec`:{let t=e.widget;if(t!==`chat`&&t!==`qna`&&t!==`simrel`)return!1;let n=v(e.spec);return n?typeof n.root==`string`&&v(n.elements)!==null:!1}case`action`:{let t=v(e.action);return t!==null&&typeof t.kind==`string`}case`error`:return typeof e.code==`string`&&typeof e.message==`string`;case`done`:return!0;default:return!1}}function ee(e){let t=y(e.payload.text,e.payload.plain_text)??``,n=y(e.payload.plain_text,e.payload.text)??t;if(e.payload.is_error)return{type:`error`,code:`BACKEND_ERROR`,message:n||`Backend returned an error`};let r={type:`text_chunk`,content:t,final:!0},i=e.payload.product_mentions;Array.isArray(i)&&i.length>0&&(r.productMentions=i.filter(e=>typeof e==`object`&&!!e&&typeof e.sku==`string`&&typeof e.short_name==`string`));let a=e.payload.sku_to_product_item;a&&typeof a==`object`&&!Array.isArray(a)&&(r.skuToProductItem=a);let o=e.payload.conversation_mode;return typeof o==`string`&&o&&(r.conversationMode=o),r}function te(e){return Fe((e.payload.actions??[]).map(e=>{let t=y(e.title)??``,n=_(e.requestDetails,t),r=n?{label:t,action:n}:null;return r?(typeof e.icon==`string`&&(r.icon=e.icon),typeof e.image==`string`&&(r.image=e.image),r):null}).filter(Ue),`chat`)}function ne(e){let t=Ie(e.payload.product_list??[],`chat`);t.panelHint=`panel`;let n=t.spec.elements[t.spec.root];return n&&(typeof e.payload.offset==`number`&&(n.props={...n.props,offset:e.payload.offset}),typeof e.payload.end_of_list==`boolean`&&(n.props={...n.props,endOfList:e.payload.end_of_list}),typeof e.payload.title==`string`&&(n.props={...n.props,panelTitle:e.payload.title})),t}function re(e){let t=e.payload.productDetails;if(!t)return Re(`chat`);let n=x(t);return{type:`ui_spec`,widget:`chat`,spec:{root:`root`,elements:{root:{type:`ProductDetailsPanel`,props:{product:{...t,...n}}}}},panelHint:`panel`}}function ie(e){let t=Ie(e.payload.similarProducts??[],`chat`),n=t.spec.elements[t.spec.root];return n&&(n.props={...n.props,similarsAppend:!0}),{...t,panelHint:`panel`}}function ae(e){let t=e.payload.multiple_product_details??[],n=e.payload,r={key_differences:n.key_differences,recommended_choice:n.recommended_choice,recommended_choice_sku:n.recommended_choice_sku,special_considerations:n.special_considerations,criteria_view:n.criteria_view,criteria_view_short:n.criteria_view_short,compared_field_names:n.compared_field_names,winner_product:n.winner_product,winner_hits:n.winner_hits,...e.payload.product_comparison_framework??{}},i=e.payload.table,a=e.payload.features_list,o=[];for(let e of t){let t=x(e);o.push(t)}let s=oe(i,o,r,a),c;r?.recommended_choice_sku?c=r.recommended_choice_sku:r?.winner_product&&r.winner_product.length>0&&(c=r.winner_product[0]?.product_detail?.sku??r.winner_product[0]?.sku);let l=c?o.find(e=>e.sku===c)??o[0]:o[0],u=[];if(Array.isArray(r?.key_differences))for(let e of r.key_differences)typeof e==`string`&&u.push(e);let d=He(r?.special_considerations),f=r?.recommended_choice,p=r?.winner_hits,m={};for(let e of o){let t=e.sku;t&&(m[t]={title:e.name??t,type:`launchSingleProduct`,payload:{sku:t}})}let h={products:o,attributes:s,highlights:u,productActions:m};return l&&(h.recommended=l),d.length>0&&(h.specialCases=d),f&&(h.recommendedText=f),p&&(h.winnerHits=p),typeof r?.key_differences==`string`&&(h.keyDifferencesHtml=r.key_differences),r?.special_considerations&&(h.specialConsiderations=r.special_considerations),{type:`ui_spec`,widget:`chat`,spec:{root:`root`,elements:{root:{type:`ComparisonTable`,props:h}}},panelHint:`panel`}}function oe(e,t,n,r){if(!e)return[];let i=Object.entries(e);if(i.length===0)return[];let a=i[0]?.[1];if(Array.isArray(a)){let t=n.criteria_view??n.criteria_view_short??{},r=n.compared_field_names??Object.keys(e),i=[];for(let n of r){let r=e[n];if(!r||!Array.isArray(r))continue;let a=t[n]??n;i.push({label:a,values:r.map(e=>typeof e==`string`?e:String(e??``))})}return i}let o=e,s=t.map(e=>String(e.sku??``)).filter(e=>e.length>0),c=n.criteria_view??n.criteria_view_short??{},l=(r&&r.length>0?r:n.compared_field_names&&n.compared_field_names.length>0?n.compared_field_names:se(o)).filter(e=>e!==`name`&&e!==`name_short`&&!e.endsWith(`_short`)),u=[];for(let e of l){let t=s.map(t=>{let n=o[t];if(!n||typeof n!=`object`)return``;let r=n[`${e}_short`],i=n[e];return ce(r??i)});if(t.every(e=>e.length===0))continue;let n=c[e]??e;u.push({label:n,values:t})}return u}function se(e){let t=[],n=new Set;for(let r of Object.values(e))if(!(!r||typeof r!=`object`))for(let e of Object.keys(r))n.has(e)||(n.add(e),t.push(e));return t}function ce(e){return typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):``}function le(e){return{type:`metadata`,sessionId:``,model:``,meta:{panel:e.payload.panel,messages:e.payload.messages,message_id:e.payload.message_id}}}function ue(){return{type:`done`}}function de(e){return{type:`metadata`,sessionId:``,model:``,meta:{loading:!0,loadingText:e.payload.text,thinkingMessages:e.payload.thinking_messages,dynamicLoading:e.payload.is_dynamic===!0}}}function fe(e){return{type:`metadata`,sessionId:``,model:``,meta:{loading:!0,panelLoading:!0,panelPendingType:e.payload?.pending_type,loadingText:e.payload?.text}}}function pe(e){return{type:`metadata`,sessionId:``,model:``,meta:{loading:!0,similarPanelLoading:!0,panelPendingType:e.payload?.pending_type,loadingText:e.payload?.text}}}function me(e){let t=y(e.payload.url);return t?{type:`action`,action:{kind:`navigate`,url:t,newTab:e.payload.new_tab===!0}}:{type:`metadata`,sessionId:``,model:``,meta:{redirect:e.payload,redirectTarget:y(e.payload.to)}}}function he(e){return{type:`error`,code:`BACKEND_ERROR`,message:y(e.payload?.text,e.payload?.message,e.payload?.error)??`Backend returned an error`}}function ge(e){return{type:`metadata`,sessionId:``,model:``,meta:{noop:!0}}}function _e(e){let t=e.payload??{};if(Array.isArray(t.action_list)){let e={action_list:t.action_list},n=typeof t.type==`string`?t.type:void 0,r=typeof t.theme==`string`?t.theme:void 0;return n!==void 0&&(e.type=n),r!==void 0&&(e.theme=r),xe({type:`quick_qna`,payload:e})}let n=v(t.action);if(n){let e={action:n},r=typeof t.text==`string`?t.text:void 0,i=typeof t.image_url==`string`?t.image_url:void 0,a=typeof t.theme==`string`?t.theme:void 0;return r!==void 0&&(e.text=r),i!==void 0&&(e.image_url=i),a!==void 0&&(e.theme=a),be({type:`text_image`,payload:e})}let r=typeof t.text==`string`?t.text:``;if(r){let e={text:r},n=typeof t.type==`string`?t.type:void 0,i=typeof t.theme==`string`?t.theme:void 0,a=v(t.payload)??void 0;return n!==void 0&&(e.type=n),a!==void 0&&(e.payload=a),i!==void 0&&(e.theme=i),ve({type:`text`,payload:e})}return{type:`metadata`,sessionId:``,model:``,meta:{launcherAction:t}}}function ve(e){let t={text:y(e.payload.text)??``};return typeof e.payload.theme==`string`&&(t.theme=e.payload.theme),e.payload.payload!==void 0&&(t.payload=e.payload.payload),{type:`ui_spec`,widget:`qna`,spec:{root:`root`,elements:{root:{type:`QuestionHeading`,props:t}}}}}function ye(e){return Le(e.payload,`qna`)}function be(e){let t=y(e.payload.text)??``,n=_(e.payload.action,t);if(n){let r={label:t||n.title,action:n};return typeof e.payload.image_url==`string`&&(r.image=e.payload.image_url),typeof e.payload.theme==`string`&&(r.theme=e.payload.theme),{type:`ui_spec`,widget:`qna`,spec:{root:`root`,elements:{root:{type:`ActionButton`,props:r}}}}}let r={text:t};return typeof e.payload.theme==`string`&&(r.theme=e.payload.theme),ve({type:`text`,payload:r})}function xe(e){return Fe((e.payload.action_list??[]).map(e=>{let t=y(e.title)??``,n=_(e.requestDetails,t),r=n?{label:t,action:n}:null;return r?(typeof e.icon==`string`&&(r.icon=e.icon),typeof e.image==`string`&&(r.image=e.image),r):null}).filter(Ue),`qna`)}function Se(e){let t={reviews:(e.payload.reviews??[]).map(e=>{let t={};return typeof e.review_class==`string`&&(t.review_class=e.review_class),typeof e.review_text==`string`&&(t.review_text=e.review_text),(typeof e.review_rating==`string`||typeof e.review_rating==`number`)&&(t.review_rating=e.review_rating),typeof e.review_tag==`string`&&(t.review_tag=e.review_tag),t})};return typeof e.payload.sku==`string`&&(t.sku=e.payload.sku),{type:`ui_spec`,widget:`chat`,spec:{root:`root`,elements:{root:{type:`ReviewHighlights`,props:t}}}}}function Ce(e){let t={};return Array.isArray(e.payload.pros)&&(t.pros=e.payload.pros),Array.isArray(e.payload.cons)&&(t.cons=e.payload.cons),typeof e.payload.product_name==`string`&&(t.productName=e.payload.product_name),{type:`ui_spec`,widget:`chat`,spec:{root:`root`,elements:{root:{type:`ProsAndCons`,props:t}}}}}function we(e){return{type:`metadata`,sessionId:``,model:``,meta:{visitorDataResponse:e.payload}}}function Te(e){let t=e.payload.product_suggestions??[],n=[];for(let e=0;e<t.length;e++){let r=t[e];if(!r)continue;let i=ze(r);if(!i)continue;let a={product:i},o=_(r.requestDetails,i.name);o&&(a.action=o),typeof r.role==`string`&&(a.role=r.role),typeof r.reason==`string`&&(a.reason=r.reason),typeof r.review_highlight==`string`&&(a.reviewHighlight=r.review_highlight),Array.isArray(r.labels)&&(a.labels=r.labels),typeof r.expert_quality_score==`number`&&(a.expertQualityScore=r.expert_quality_score),n.push(a)}return n.length===0?{type:`metadata`,sessionId:``,model:``,meta:{aiProductSuggestions:e.payload.product_suggestions??[]}}:{type:`ui_spec`,widget:`chat`,spec:{root:`root`,elements:{root:{type:`AITopPicks`,props:{suggestions:n}}}}}}function Ee(e){let t=e.payload.product_groupings??[],n=[];for(let e=0;e<t.length;e++){let r=t[e];if(!r)continue;let i=y(r.name)??``,a=r.sku&&r.sku.length>0?{type:`findSimilar`,payload:{sku:r.sku}}:void 0,o=_(r.requestDetails??a,i);if(!o)continue;let s={name:i,action:o};if(Array.isArray(r.labels)){let e=r.labels.filter(e=>typeof e==`string`);e.length>0&&(s.labels=e)}typeof r.image==`string`&&(s.image=r.image),n.push(s)}return n.length===0?{type:`metadata`,sessionId:``,model:``,meta:{aiProductGroupings:e.payload.product_groupings??[]}}:{type:`ui_spec`,widget:`chat`,spec:{root:`root`,elements:{root:{type:`AIGroupingCards`,props:{entries:n}}}}}}function De(e){let t=e.payload.suggested_searches??[],n=[];for(let e=0;e<t.length;e++){let r=t[e];if(!r)continue;let i=y(r.short_name,r.chosen_attribute,r.detailed_user_message)??`Search ${e+1}`,a={},o=y(r.detailed_user_message);o&&(a.text=o);let s=v(v(r.requestDetails)?.payload),c=s?.group_skus;r.group_skus&&Array.isArray(r.group_skus)?a.group_skus=r.group_skus:Array.isArray(c)&&(a.group_skus=c.filter(e=>typeof e==`string`));let l=y(r.sku,r.representative_product_sku,s?.sku);l&&(a.sku=l),a.is_suggested_text=1;let u={type:`inputText`,payload:a},d=_(r.requestDetails,i),f=d?.type===`findSimilar`&&typeof a.text==`string`?_(u,i):d??_(u,i);if(!f)continue;let p={shortName:i,action:f},h=y(r.detailed_user_message);h&&h!==i&&(p.detailedMessage=h);let g=m(r);g&&g!==i&&g!==(h??``)&&(p.whyDifferent=g),typeof r.image==`string`&&(p.image=r.image),n.push(p)}return n.length===0?{type:`metadata`,sessionId:``,model:``,meta:{aiSuggestedSearches:e.payload.suggested_searches??[]}}:{type:`ui_spec`,widget:`chat`,spec:{root:`root`,elements:{root:{type:`AISuggestedSearchCards`,props:{entries:n}}}}}}function Oe(e){let t=_(e.payload.requestDetails,y(e.payload.review_count,e.payload.text,e.payload.title)??`Show product reviews`);if(!t)return{type:`metadata`,sessionId:``,model:``,meta:{groundingReview:e.payload}};let n={action:t};return e.payload.title&&(n.title=e.payload.title),e.payload.text&&(n.text=e.payload.text),e.payload.review_count&&(n.reviewCount=e.payload.review_count),{type:`ui_spec`,widget:`chat`,spec:{root:`root`,elements:{root:{type:`GroundingReviewCard`,props:n}}}}}function ke(){return{type:`metadata`,sessionId:``,model:``,meta:{analyzeAnimation:!0}}}function Ae(e){return{type:`metadata`,sessionId:``,model:``,meta:{voice:e.payload}}}function je(e){let t=e.payload.group_list??[],n=[];for(let e of t){let t=e.group_name??``,r=(e.product_list??[]).map(x);n.push({groupName:t,products:r})}let r=[];for(let t of e.payload.filter_tags??[]){let e=t.title??``;if(!e)continue;let n=_(t.requestDetails,e),i={title:e};n&&(i.action=n),r.push(i)}return{type:`ui_spec`,widget:`chat`,spec:{root:`root`,elements:{root:{type:`CategoriesContainer`,props:{groups:n,filterTags:r}}}},panelHint:`panel`}}function Me(e){return{type:`metadata`,sessionId:``,model:``,meta:{formType:e.type,formPayload:e.payload??{}}}}function Ne(e){let t={};return typeof e.payload?.summary==`string`&&(t.summary=e.payload.summary),Array.isArray(e.payload?.products_discussed)&&(t.products_discussed=e.payload.products_discussed),typeof e.payload?.user_sentiment==`string`&&(t.user_sentiment=e.payload.user_sentiment),{type:`ui_spec`,widget:`chat`,spec:{root:`root`,elements:{root:{type:`HandoffNotice`,props:t}}}}}function Pe(e){return{type:`metadata`,sessionId:``,model:``,meta:{launcherContent:e.payload??{}}}}function Fe(e,t){let n={},r=[];for(let t=0;t<e.length;t++){let i=e[t];if(!i)continue;let a=`action-${t}`;r.push(a);let o={label:i.label,action:i.action};i.icon!==void 0&&(o.icon=i.icon),i.image!==void 0&&(o.image=i.image),i.description!==void 0&&(o.description=i.description),n[a]={type:`ActionButton`,props:o}}return n.root={type:`ActionButtons`,props:{buttons:e.map(e=>{let t={label:e.label,action:e.action};return e.image!==void 0&&(t.image=e.image),e.description!==void 0&&(t.description=e.description),e.icon!==void 0&&(t.icon=e.icon),t})},children:r},{type:`ui_spec`,widget:t,spec:{root:`root`,elements:n}}}function Ie(e,t){let n={},r=[];for(let t=0;t<e.length;t++){let i=e[t];if(!i)continue;let a=x(i),o=`product-${t}`;r.push(o);let s={product:a,index:t};a.sku&&(s.action={title:a.name,type:`launchSingleProduct`,payload:{sku:a.sku}}),n[o]={type:`ProductCard`,props:s}}return n.root={type:`ProductGrid`,props:{layout:`grid`},children:r},{type:`ui_spec`,widget:t,spec:{root:`root`,elements:n}}}function Le(e,t){return{type:`ui_spec`,widget:t,spec:{root:`root`,elements:{root:{type:`ProductCard`,props:{product:x(e),index:0}}}}}}function Re(e){return{type:`ui_spec`,widget:e,spec:{root:`root`,elements:{root:{type:`ActionButtons`,props:{buttons:[]},children:[]}}}}}function ze(e){let t=y(e.sku),n=y(e.short_name);return Be(v(e.product_item)??e,t,n)}function Be(e,t,n){let r=y(e.sku,t),i=y(e.name,n);if(!r||!i)return null;let a={sku:r,name:i},o=y(e.brand);o&&(a.brand=o);let s=y(e.url);s&&(a.url=s);let c=Ve(e.images);if(c.length>0)a.images=c;else{let t=y(e.image,e.image_url,e.imageUrl);t&&(a.images=[t])}let l=b(e.price_discounted);l!==void 0&&(a.price_discounted=l);let u=b(e.price);u!==void 0&&(a.price=u);let d=b(e.rating);d!==void 0&&(a.rating=d);let f=b(e.review_count)??b(e.reviewCount);f!==void 0&&(a.review_count=f);let p=y(e.cart_code,e.cartCode);return p&&(a.cart_code=p),typeof e.in_stock==`boolean`&&(a.in_stock=e.in_stock),typeof e.inStock==`boolean`&&(a.in_stock=e.inStock),x(a)}function _(e,t){let n=v(e);if(!n)return null;let r=n.type;if(typeof r!=`string`||r.length===0)return null;let i={title:t||r,type:r};return n.payload!==void 0&&(i.payload=n.payload),i}function v(e){return!e||typeof e!=`object`||Array.isArray(e)?null:e}function y(...e){for(let t of e)if(typeof t==`string`){let e=t.trim();if(e.length>0)return e}}function Ve(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.length>0):[]}function He(e){if(typeof e==`string`){let t=e.trim();return t?[t]:[]}return Array.isArray(e)?e.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(e=>e.length>0):[]}function b(e){if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e==`string`){let t;t=e.includes(`.`)&&e.includes(`,`)?e.replace(/\./g,``).replace(`,`,`.`):e.replace(`,`,`.`);let n=Number(t);if(Number.isFinite(n))return n}}function Ue(e){return e!=null}var We=new Set([`sku`,`name`,`brand`,`images`,`price`,`price_discounted`,`price_currency`,`discount_reason`,`url`,`rating`,`review_count`,`cart_code`,`in_stock`,`category_ids`,`category_names`,`variants`,`facet_hits`,`promotions`]);function x(e){let t=e.price_discounted!=null&&e.price_discounted>0,n=t?e.price_discounted:e.price,r=t&&e.price!=null?e.price:void 0,i;r!=null&&n!=null&&r>0&&(i=Math.round((r-n)/r*100));let a=y(e.brand),o=y(e.name)??e.sku,s=a&&!o.toLowerCase().startsWith(a.toLowerCase())?`${a} ${o}`:o,c={sku:e.sku,name:s,url:y(e.url)??``},l=e.images?.[0];l&&(c.imageUrl=l),e.images&&e.images.length>1&&(c.images=e.images),n!=null&&(c.price=String(n)),r!=null&&(c.originalPrice=String(r)),i!==void 0&&(c.discountPercent=i),a!==void 0&&(c.brand=a),e.rating!==void 0&&(c.rating=e.rating),e.review_count!==void 0&&(c.reviewCount=e.review_count),e.cart_code!==void 0&&(c.cartCode=e.cart_code),e.in_stock!==void 0&&(c.inStock=e.in_stock),e.variants&&e.variants.length>0&&(c.variants=e.variants),e.discount_reason!==void 0&&(c.discountReason=e.discount_reason),e.promotions&&e.promotions.length>0&&(c.promotions=e.promotions);let u=e,d={},f=!1;for(let e of Object.keys(u))We.has(e)||(d[e]=u[e],f=!0);return f&&(c.extras=d),c}function Ge(e){return e.results.map(x)}function Ke(e){return e.product_groupings.map(e=>{let t={name:e.name,products:(e.group_products??[]).map(x)};return e.highlight!==void 0&&(t.highlight=e.highlight),t})}var qe={process_action:`/process_action`,launcher_action:`/launcher_action`,similar_products:`/similar_products`,product_groupings:`/product_groupings`};function Je(e){if(e===void 0)throw Error(`[gengage] middlewareUrl is required. Pass your Gengage backend URL in widget config.`);let t=e.trim();return t===``?``:t.replace(/\/+$/,``)}function Ye(e,t){return`${Je(t?.middlewareUrl)}/chat${qe[e]}`}Object.freeze({status:`aborted`});function S(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var C=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Xe=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},Ze={};function w(e){return e&&Object.assign(Ze,e),Ze}function Qe(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function $e(e,t){return typeof t==`bigint`?t.toString():t}function et(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function tt(e){return e==null}function nt(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function rt(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var it=Symbol(`evaluating`);function T(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==it)return r===void 0&&(r=it,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function E(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function D(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function at(e){return JSON.stringify(e)}function ot(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var st=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function O(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var ct=et(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function k(e){if(O(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(O(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function lt(e){return k(e)?{...e}:Array.isArray(e)?[...e]:e}var ut=new Set([`string`,`number`,`symbol`]);function A(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function j(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function M(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function dt(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var ft={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function pt(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return j(e,D(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return E(this,`shape`,e),e},checks:[]}))}function mt(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return j(e,D(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return E(this,`shape`,r),r},checks:[]}))}function ht(e,t){if(!k(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return j(e,D(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return E(this,`shape`,n),n}}))}function gt(e,t){if(!k(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return j(e,D(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return E(this,`shape`,n),n}}))}function _t(e,t){return j(e,D(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return E(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function vt(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return j(t,D(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return E(this,`shape`,i),i},checks:[]}))}function yt(e,t,n){return j(t,D(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return E(this,`shape`,i),i}}))}function N(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function P(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function F(e){return typeof e==`string`?e:e?.message}function I(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=F(e.inst?._zod.def?.error?.(e))??F(t?.error?.(e))??F(n.customError?.(e))??F(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function bt(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function L(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var xt=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,$e,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},St=S(`$ZodError`,xt),Ct=S(`$ZodError`,xt,{Parent:Error});function wt(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Tt(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}var Et=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new C;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>I(e,a,w())));throw st(t,i?.callee),t}return o.value},Dt=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>I(e,a,w())));throw st(t,i?.callee),t}return o.value},Ot=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new C;return a.issues.length?{success:!1,error:new(e??St)(a.issues.map(e=>I(e,i,w())))}:{success:!0,data:a.value}},kt=Ot(Ct),R=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>I(e,i,w())))}:{success:!0,data:a.value}},At=R(Ct),jt=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Et(e)(t,n,i)},Mt=e=>(t,n,r)=>Et(e)(t,n,r),Nt=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Dt(e)(t,n,i)},Pt=e=>async(t,n,r)=>Dt(e)(t,n,r),Ft=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return Ot(e)(t,n,i)},It=e=>(t,n,r)=>Ot(e)(t,n,r),Lt=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return R(e)(t,n,i)},Rt=e=>async(t,n,r)=>R(e)(t,n,r),zt=/^[cC][^\s-]{8,}$/,Bt=/^[0-9a-z]+$/,Vt=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ht=/^[0-9a-vA-V]{20}$/,Ut=/^[A-Za-z0-9]{27}$/,Wt=/^[a-zA-Z0-9_-]{21}$/,Gt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Kt=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,qt=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Jt=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Yt=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Xt(){return new RegExp(Yt,`u`)}var Zt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Qt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,$t=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,en=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,tn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,nn=/^[A-Za-z0-9_-]*$/,rn=/^\+[1-9]\d{6,14}$/,an=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,on=RegExp(`^${an}$`);function sn(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function cn(e){return RegExp(`^${sn(e)}$`)}function ln(e){let t=sn({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${an}T(?:${r})$`)}var un=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},dn=/^-?\d+$/,fn=/^-?\d+(?:\.\d+)?$/,pn=/^(?:true|false)$/i,mn=/^[^A-Z]*$/,hn=/^[^a-z]*$/,z=S(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),gn={number:`number`,bigint:`bigint`,object:`date`},_n=S(`$ZodCheckLessThan`,(e,t)=>{z.init(e,t);let n=gn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),vn=S(`$ZodCheckGreaterThan`,(e,t)=>{z.init(e,t);let n=gn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),yn=S(`$ZodCheckMultipleOf`,(e,t)=>{z.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):rt(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),bn=S(`$ZodCheckNumberFormat`,(e,t)=>{z.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=ft[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=dn)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),xn=S(`$ZodCheckMaxLength`,(e,t)=>{var n;z.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!tt(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=bt(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Sn=S(`$ZodCheckMinLength`,(e,t)=>{var n;z.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!tt(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=bt(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Cn=S(`$ZodCheckLengthEquals`,(e,t)=>{var n;z.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!tt(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=bt(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),B=S(`$ZodCheckStringFormat`,(e,t)=>{var n,r;z.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),wn=S(`$ZodCheckRegex`,(e,t)=>{B.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Tn=S(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=mn,B.init(e,t)}),En=S(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=hn,B.init(e,t)}),Dn=S(`$ZodCheckIncludes`,(e,t)=>{z.init(e,t);let n=A(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),On=S(`$ZodCheckStartsWith`,(e,t)=>{z.init(e,t);let n=RegExp(`^${A(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),kn=S(`$ZodCheckEndsWith`,(e,t)=>{z.init(e,t);let n=RegExp(`.*${A(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),An=S(`$ZodCheckOverwrite`,(e,t)=>{z.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),jn=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
3
3
|
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
4
4
|
`))}},Mn={major:4,minor:3,patch:6},V=S(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Mn;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=N(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new C;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=N(e,t))});else{if(e.issues.length===t)continue;r||=N(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(N(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new C;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new C;return o.then(e=>t(e,r,a))}return t(o,r,a)}}T(e,`~standard`,()=>({validate:t=>{try{let n=kt(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return At(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Nn=S(`$ZodString`,(e,t)=>{V.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??un(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),H=S(`$ZodStringFormat`,(e,t)=>{B.init(e,t),Nn.init(e,t)}),Pn=S(`$ZodGUID`,(e,t)=>{t.pattern??=Kt,H.init(e,t)}),Fn=S(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=qt(e)}else t.pattern??=qt();H.init(e,t)}),In=S(`$ZodEmail`,(e,t)=>{t.pattern??=Jt,H.init(e,t)}),Ln=S(`$ZodURL`,(e,t)=>{H.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Rn=S(`$ZodEmoji`,(e,t)=>{t.pattern??=Xt(),H.init(e,t)}),zn=S(`$ZodNanoID`,(e,t)=>{t.pattern??=Wt,H.init(e,t)}),Bn=S(`$ZodCUID`,(e,t)=>{t.pattern??=zt,H.init(e,t)}),Vn=S(`$ZodCUID2`,(e,t)=>{t.pattern??=Bt,H.init(e,t)}),Hn=S(`$ZodULID`,(e,t)=>{t.pattern??=Vt,H.init(e,t)}),Un=S(`$ZodXID`,(e,t)=>{t.pattern??=Ht,H.init(e,t)}),Wn=S(`$ZodKSUID`,(e,t)=>{t.pattern??=Ut,H.init(e,t)}),Gn=S(`$ZodISODateTime`,(e,t)=>{t.pattern??=ln(t),H.init(e,t)}),Kn=S(`$ZodISODate`,(e,t)=>{t.pattern??=on,H.init(e,t)}),qn=S(`$ZodISOTime`,(e,t)=>{t.pattern??=cn(t),H.init(e,t)}),Jn=S(`$ZodISODuration`,(e,t)=>{t.pattern??=Gt,H.init(e,t)}),Yn=S(`$ZodIPv4`,(e,t)=>{t.pattern??=Zt,H.init(e,t),e._zod.bag.format=`ipv4`}),Xn=S(`$ZodIPv6`,(e,t)=>{t.pattern??=Qt,H.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Zn=S(`$ZodCIDRv4`,(e,t)=>{t.pattern??=$t,H.init(e,t)}),Qn=S(`$ZodCIDRv6`,(e,t)=>{t.pattern??=en,H.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function $n(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var er=S(`$ZodBase64`,(e,t)=>{t.pattern??=tn,H.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{$n(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function tr(e){if(!nn.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return $n(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var nr=S(`$ZodBase64URL`,(e,t)=>{t.pattern??=nn,H.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{tr(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),rr=S(`$ZodE164`,(e,t)=>{t.pattern??=rn,H.init(e,t)});function ir(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var ar=S(`$ZodJWT`,(e,t)=>{H.init(e,t),e._zod.check=n=>{ir(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),or=S(`$ZodNumber`,(e,t)=>{V.init(e,t),e._zod.pattern=e._zod.bag.pattern??fn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),sr=S(`$ZodNumberFormat`,(e,t)=>{bn.init(e,t),or.init(e,t)}),cr=S(`$ZodBoolean`,(e,t)=>{V.init(e,t),e._zod.pattern=pn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),lr=S(`$ZodUnknown`,(e,t)=>{V.init(e,t),e._zod.parse=e=>e}),ur=S(`$ZodNever`,(e,t)=>{V.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function dr(e,t,n){e.issues.length&&t.issues.push(...P(n,e.issues)),t.value[n]=e.value}var fr=S(`$ZodArray`,(e,t)=>{V.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>dr(t,n,e))):dr(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function U(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...P(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function pr(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=dt(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function mr(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>U(e,n,i,t,u))):U(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var hr=S(`$ZodObject`,(e,t)=>{if(V.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=et(()=>pr(t));T(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=O,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>U(n,t,e,s,r))):U(i,t,e,s,r)}return i?mr(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),gr=S(`$ZodObjectJIT`,(e,t)=>{hr.init(e,t);let n=e._zod.parse,r=et(()=>pr(t)),i=e=>{let t=new jn([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=at(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=at(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?t.write(`
|
|
5
5
|
if (${n}.issues.length) {
|
|
@@ -38,4 +38,4 @@ const e=require(`./ga-datalayer-boRrTCtO.cjs`);var t=({element:e,renderElement:t
|
|
|
38
38
|
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=O,s=!Ze.jitless,c=s&&ct.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?mr([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function _r(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!N(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>I(e,r,w())))}),t)}var vr=S(`$ZodUnion`,(e,t)=>{V.init(e,t),T(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),T(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),T(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),T(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>nt(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>_r(t,i,e,a)):_r(s,i,e,a)}}),yr=S(`$ZodIntersection`,(e,t)=>{V.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>xr(e,t,n)):xr(e,i,a)}});function br(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(k(e)&&k(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=br(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=br(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function xr(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),N(e))return e;let o=br(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Sr=S(`$ZodRecord`,(e,t)=>{V.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!k(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let e of o)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){s.add(typeof e==`number`?e.toString():e);let o=t.valueType._zod.run({value:i[e],issues:[]},r);o instanceof Promise?a.push(o.then(t=>{t.issues.length&&n.issues.push(...P(e,t.issues)),n.value[e]=t.value})):(o.issues.length&&n.issues.push(...P(e,o.issues)),n.value[e]=o.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`)continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&fn.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>I(e,r,w())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...P(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...P(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Cr=S(`$ZodEnum`,(e,t)=>{V.init(e,t);let n=Qe(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>ut.has(typeof e)).map(e=>typeof e==`string`?A(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),wr=S(`$ZodLiteral`,(e,t)=>{if(V.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?A(e):e?A(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Tr=S(`$ZodTransform`,(e,t)=>{V.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Xe(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new C;return n.value=i,n}});function Er(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var Dr=S(`$ZodOptional`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,T(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),T(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${nt(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>Er(t,e.value)):Er(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Or=S(`$ZodExactOptional`,(e,t)=>{Dr.init(e,t),T(e._zod,`values`,()=>t.innerType._zod.values),T(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),kr=S(`$ZodNullable`,(e,t)=>{V.init(e,t),T(e._zod,`optin`,()=>t.innerType._zod.optin),T(e._zod,`optout`,()=>t.innerType._zod.optout),T(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${nt(e.source)}|null)$`):void 0}),T(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Ar=S(`$ZodDefault`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,T(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>jr(e,t)):jr(r,t)}});function jr(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Mr=S(`$ZodPrefault`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,T(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Nr=S(`$ZodNonOptional`,(e,t)=>{V.init(e,t),T(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Pr(t,e)):Pr(i,e)}});function Pr(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var Fr=S(`$ZodCatch`,(e,t)=>{V.init(e,t),T(e._zod,`optin`,()=>t.innerType._zod.optin),T(e._zod,`optout`,()=>t.innerType._zod.optout),T(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>I(e,n,w()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>I(e,n,w()))},input:e.value}),e.issues=[]),e)}}),Ir=S(`$ZodPipe`,(e,t)=>{V.init(e,t),T(e._zod,`values`,()=>t.in._zod.values),T(e._zod,`optin`,()=>t.in._zod.optin),T(e._zod,`optout`,()=>t.out._zod.optout),T(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>W(e,t.in,n)):W(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>W(e,t.out,n)):W(r,t.out,n)}});function W(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Lr=S(`$ZodReadonly`,(e,t)=>{V.init(e,t),T(e._zod,`propValues`,()=>t.innerType._zod.propValues),T(e._zod,`values`,()=>t.innerType._zod.values),T(e._zod,`optin`,()=>t.innerType?._zod?.optin),T(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Rr):Rr(r)}});function Rr(e){return e.value=Object.freeze(e.value),e}var zr=S(`$ZodCustom`,(e,t)=>{z.init(e,t),V.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Br(t,n,r,e));Br(i,n,r,e)}});function Br(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(L(e))}}var Vr,Hr=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Ur(){return new Hr}(Vr=globalThis).__zod_globalRegistry??(Vr.__zod_globalRegistry=Ur());var G=globalThis.__zod_globalRegistry;function Wr(e,t){return new e({type:`string`,...M(t)})}function Gr(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...M(t)})}function Kr(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...M(t)})}function qr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...M(t)})}function Jr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...M(t)})}function Yr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...M(t)})}function Xr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...M(t)})}function Zr(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...M(t)})}function Qr(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...M(t)})}function $r(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...M(t)})}function ei(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...M(t)})}function ti(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...M(t)})}function ni(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...M(t)})}function ri(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...M(t)})}function ii(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...M(t)})}function ai(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...M(t)})}function oi(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...M(t)})}function si(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...M(t)})}function ci(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...M(t)})}function li(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...M(t)})}function ui(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...M(t)})}function di(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...M(t)})}function fi(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...M(t)})}function pi(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...M(t)})}function mi(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...M(t)})}function hi(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...M(t)})}function gi(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...M(t)})}function _i(e,t){return new e({type:`number`,checks:[],...M(t)})}function vi(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...M(t)})}function yi(e,t){return new e({type:`boolean`,...M(t)})}function bi(e){return new e({type:`unknown`})}function xi(e,t){return new e({type:`never`,...M(t)})}function Si(e,t){return new _n({check:`less_than`,...M(t),value:e,inclusive:!1})}function Ci(e,t){return new _n({check:`less_than`,...M(t),value:e,inclusive:!0})}function wi(e,t){return new vn({check:`greater_than`,...M(t),value:e,inclusive:!1})}function Ti(e,t){return new vn({check:`greater_than`,...M(t),value:e,inclusive:!0})}function Ei(e,t){return new yn({check:`multiple_of`,...M(t),value:e})}function Di(e,t){return new xn({check:`max_length`,...M(t),maximum:e})}function K(e,t){return new Sn({check:`min_length`,...M(t),minimum:e})}function Oi(e,t){return new Cn({check:`length_equals`,...M(t),length:e})}function ki(e,t){return new wn({check:`string_format`,format:`regex`,...M(t),pattern:e})}function Ai(e){return new Tn({check:`string_format`,format:`lowercase`,...M(e)})}function ji(e){return new En({check:`string_format`,format:`uppercase`,...M(e)})}function Mi(e,t){return new Dn({check:`string_format`,format:`includes`,...M(t),includes:e})}function Ni(e,t){return new On({check:`string_format`,format:`starts_with`,...M(t),prefix:e})}function Pi(e,t){return new kn({check:`string_format`,format:`ends_with`,...M(t),suffix:e})}function q(e){return new An({check:`overwrite`,tx:e})}function Fi(e){return q(t=>t.normalize(e))}function Ii(){return q(e=>e.trim())}function Li(){return q(e=>e.toLowerCase())}function Ri(){return q(e=>e.toUpperCase())}function zi(){return q(e=>ot(e))}function Bi(e,t,n){return new e({type:`array`,element:t,...M(n)})}function Vi(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...M(n)})}function Hi(e){let t=Ui(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(L(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(L(r))}},e(n.value,n)));return t}function Ui(e,t){let n=new z({check:`custom`,...M(t)});return n._zod.check=e,n}function Wi(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??G,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function J(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,J(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&Y(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Gi(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
39
39
|
|
|
40
40
|
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Ki(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:X(t,`input`,e.processors),output:X(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Y(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Y(r.element,n);if(r.type===`set`)return Y(r.valueType,n);if(r.type===`lazy`)return Y(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return Y(r.innerType,n);if(r.type===`intersection`)return Y(r.left,n)||Y(r.right,n);if(r.type===`record`||r.type===`map`)return Y(r.keyType,n)||Y(r.valueType,n);if(r.type===`pipe`)return Y(r.in,n)||Y(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Y(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Y(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Y(e,n))return!0;return!!(r.rest&&Y(r.rest,n))}return!1}var qi=(e,t={})=>n=>{let r=Wi({...n,processors:t});return J(e,r),Gi(r,e),Ki(r,e)},X=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Wi({...i??{},target:a,io:t,processors:n});return J(e,o),Gi(o,e),Ki(o,e)},Ji={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Yi=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Ji[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Xi=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},Zi=(e,t,n,r)=>{n.type=`boolean`},Qi=(e,t,n,r)=>{n.not={}},$i=(e,t,n,r)=>{let i=e._zod.def,a=Qe(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},ea=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},ta=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},na=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},ra=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=J(a.element,t,{...r,path:[...r.path,`items`]})},ia=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=J(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=J(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},aa=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>J(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},oa=(e,t,n,r)=>{let i=e._zod.def,a=J(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=J(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},sa=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=J(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=J(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=J(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},ca=(e,t,n,r)=>{let i=e._zod.def,a=J(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},la=(e,t,n,r)=>{let i=e._zod.def;J(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ua=(e,t,n,r)=>{let i=e._zod.def;J(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},da=(e,t,n,r)=>{let i=e._zod.def;J(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},fa=(e,t,n,r)=>{let i=e._zod.def;J(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},pa=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;J(a,t,r);let o=t.seen.get(e);o.ref=a},ma=(e,t,n,r)=>{let i=e._zod.def;J(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},ha=(e,t,n,r)=>{let i=e._zod.def;J(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ga=S(`ZodISODateTime`,(e,t)=>{Gn.init(e,t),$.init(e,t)});function _a(e){return pi(ga,e)}var va=S(`ZodISODate`,(e,t)=>{Kn.init(e,t),$.init(e,t)});function ya(e){return mi(va,e)}var ba=S(`ZodISOTime`,(e,t)=>{qn.init(e,t),$.init(e,t)});function xa(e){return hi(ba,e)}var Sa=S(`ZodISODuration`,(e,t)=>{Jn.init(e,t),$.init(e,t)});function Ca(e){return gi(Sa,e)}var wa=(e,t)=>{St.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Tt(e,t)},flatten:{value:t=>wt(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,$e,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,$e,2)}},isEmpty:{get(){return e.issues.length===0}}})};S(`ZodError`,wa);var Z=S(`ZodError`,wa,{Parent:Error}),Ta=Et(Z),Ea=Dt(Z),Da=Ot(Z),Oa=R(Z),ka=jt(Z),Aa=Mt(Z),ja=Nt(Z),Ma=Pt(Z),Na=Ft(Z),Pa=It(Z),Fa=Lt(Z),Ia=Rt(Z),Q=S(`ZodType`,(e,t)=>(V.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:X(e,`input`),output:X(e,`output`)}}),e.toJSONSchema=qi(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(D(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>j(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>Ta(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Da(e,t,n),e.parseAsync=async(t,n)=>Ea(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Oa(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>ka(e,t,n),e.decode=(t,n)=>Aa(e,t,n),e.encodeAsync=async(t,n)=>ja(e,t,n),e.decodeAsync=async(t,n)=>Ma(e,t,n),e.safeEncode=(t,n)=>Na(e,t,n),e.safeDecode=(t,n)=>Pa(e,t,n),e.safeEncodeAsync=async(t,n)=>Fa(e,t,n),e.safeDecodeAsync=async(t,n)=>Ia(e,t,n),e.refine=(t,n)=>e.check(Zo(t,n)),e.superRefine=t=>e.check(Qo(t)),e.overwrite=t=>e.check(q(t)),e.optional=()=>No(e),e.exactOptional=()=>Fo(e),e.nullable=()=>Lo(e),e.nullish=()=>No(Lo(e)),e.nonoptional=t=>Uo(e,t),e.array=()=>_o(e),e.or=t=>xo([e,t]),e.and=t=>Co(e,t),e.transform=t=>qo(e,jo(t)),e.default=t=>zo(e,t),e.prefault=t=>Vo(e,t),e.catch=t=>Go(e,t),e.pipe=t=>qo(e,t),e.readonly=()=>Yo(e),e.describe=t=>{let n=e.clone();return G.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return G.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return G.get(e);let n=e.clone();return G.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),La=S(`_ZodString`,(e,t)=>{Nn.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yi(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(ki(...t)),e.includes=(...t)=>e.check(Mi(...t)),e.startsWith=(...t)=>e.check(Ni(...t)),e.endsWith=(...t)=>e.check(Pi(...t)),e.min=(...t)=>e.check(K(...t)),e.max=(...t)=>e.check(Di(...t)),e.length=(...t)=>e.check(Oi(...t)),e.nonempty=(...t)=>e.check(K(1,...t)),e.lowercase=t=>e.check(Ai(t)),e.uppercase=t=>e.check(ji(t)),e.trim=()=>e.check(Ii()),e.normalize=(...t)=>e.check(Fi(...t)),e.toLowerCase=()=>e.check(Li()),e.toUpperCase=()=>e.check(Ri()),e.slugify=()=>e.check(zi())}),Ra=S(`ZodString`,(e,t)=>{Nn.init(e,t),La.init(e,t),e.email=t=>e.check(Gr(Ba,t)),e.url=t=>e.check(Zr(Ua,t)),e.jwt=t=>e.check(fi(io,t)),e.emoji=t=>e.check(Qr(Wa,t)),e.guid=t=>e.check(Kr(Va,t)),e.uuid=t=>e.check(qr(Ha,t)),e.uuidv4=t=>e.check(Jr(Ha,t)),e.uuidv6=t=>e.check(Yr(Ha,t)),e.uuidv7=t=>e.check(Xr(Ha,t)),e.nanoid=t=>e.check($r(Ga,t)),e.guid=t=>e.check(Kr(Va,t)),e.cuid=t=>e.check(ei(Ka,t)),e.cuid2=t=>e.check(ti(qa,t)),e.ulid=t=>e.check(ni(Ja,t)),e.base64=t=>e.check(li(to,t)),e.base64url=t=>e.check(ui(no,t)),e.xid=t=>e.check(ri(Ya,t)),e.ksuid=t=>e.check(ii(Xa,t)),e.ipv4=t=>e.check(ai(Za,t)),e.ipv6=t=>e.check(oi(Qa,t)),e.cidrv4=t=>e.check(si($a,t)),e.cidrv6=t=>e.check(ci(eo,t)),e.e164=t=>e.check(di(ro,t)),e.datetime=t=>e.check(_a(t)),e.date=t=>e.check(ya(t)),e.time=t=>e.check(xa(t)),e.duration=t=>e.check(Ca(t))});function za(e){return Wr(Ra,e)}var $=S(`ZodStringFormat`,(e,t)=>{H.init(e,t),La.init(e,t)}),Ba=S(`ZodEmail`,(e,t)=>{In.init(e,t),$.init(e,t)}),Va=S(`ZodGUID`,(e,t)=>{Pn.init(e,t),$.init(e,t)}),Ha=S(`ZodUUID`,(e,t)=>{Fn.init(e,t),$.init(e,t)}),Ua=S(`ZodURL`,(e,t)=>{Ln.init(e,t),$.init(e,t)}),Wa=S(`ZodEmoji`,(e,t)=>{Rn.init(e,t),$.init(e,t)}),Ga=S(`ZodNanoID`,(e,t)=>{zn.init(e,t),$.init(e,t)}),Ka=S(`ZodCUID`,(e,t)=>{Bn.init(e,t),$.init(e,t)}),qa=S(`ZodCUID2`,(e,t)=>{Vn.init(e,t),$.init(e,t)}),Ja=S(`ZodULID`,(e,t)=>{Hn.init(e,t),$.init(e,t)}),Ya=S(`ZodXID`,(e,t)=>{Un.init(e,t),$.init(e,t)}),Xa=S(`ZodKSUID`,(e,t)=>{Wn.init(e,t),$.init(e,t)}),Za=S(`ZodIPv4`,(e,t)=>{Yn.init(e,t),$.init(e,t)}),Qa=S(`ZodIPv6`,(e,t)=>{Xn.init(e,t),$.init(e,t)}),$a=S(`ZodCIDRv4`,(e,t)=>{Zn.init(e,t),$.init(e,t)}),eo=S(`ZodCIDRv6`,(e,t)=>{Qn.init(e,t),$.init(e,t)}),to=S(`ZodBase64`,(e,t)=>{er.init(e,t),$.init(e,t)}),no=S(`ZodBase64URL`,(e,t)=>{nr.init(e,t),$.init(e,t)}),ro=S(`ZodE164`,(e,t)=>{rr.init(e,t),$.init(e,t)}),io=S(`ZodJWT`,(e,t)=>{ar.init(e,t),$.init(e,t)}),ao=S(`ZodNumber`,(e,t)=>{or.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xi(e,t,n,r),e.gt=(t,n)=>e.check(wi(t,n)),e.gte=(t,n)=>e.check(Ti(t,n)),e.min=(t,n)=>e.check(Ti(t,n)),e.lt=(t,n)=>e.check(Si(t,n)),e.lte=(t,n)=>e.check(Ci(t,n)),e.max=(t,n)=>e.check(Ci(t,n)),e.int=t=>e.check(co(t)),e.safe=t=>e.check(co(t)),e.positive=t=>e.check(wi(0,t)),e.nonnegative=t=>e.check(Ti(0,t)),e.negative=t=>e.check(Si(0,t)),e.nonpositive=t=>e.check(Ci(0,t)),e.multipleOf=(t,n)=>e.check(Ei(t,n)),e.step=(t,n)=>e.check(Ei(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function oo(e){return _i(ao,e)}var so=S(`ZodNumberFormat`,(e,t)=>{sr.init(e,t),ao.init(e,t)});function co(e){return vi(so,e)}var lo=S(`ZodBoolean`,(e,t)=>{cr.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zi(e,t,n,r)});function uo(e){return yi(lo,e)}var fo=S(`ZodUnknown`,(e,t)=>{lr.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function po(){return bi(fo)}var mo=S(`ZodNever`,(e,t)=>{ur.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qi(e,t,n,r)});function ho(e){return xi(mo,e)}var go=S(`ZodArray`,(e,t)=>{fr.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ra(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(K(t,n)),e.nonempty=t=>e.check(K(1,t)),e.max=(t,n)=>e.check(Di(t,n)),e.length=(t,n)=>e.check(Oi(t,n)),e.unwrap=()=>e.element});function _o(e,t){return Bi(go,e,t)}var vo=S(`ZodObject`,(e,t)=>{gr.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ia(e,t,n,r),T(e,`shape`,()=>t.shape),e.keyof=()=>Do(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:po()}),e.loose=()=>e.clone({...e._zod.def,catchall:po()}),e.strict=()=>e.clone({...e._zod.def,catchall:ho()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>ht(e,t),e.safeExtend=t=>gt(e,t),e.merge=t=>_t(e,t),e.pick=t=>pt(e,t),e.omit=t=>mt(e,t),e.partial=(...t)=>vt(Mo,e,t[0]),e.required=(...t)=>yt(Ho,e,t[0])});function yo(e,t){return new vo({type:`object`,shape:e??{},...M(t)})}var bo=S(`ZodUnion`,(e,t)=>{vr.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>aa(e,t,n,r),e.options=t.options});function xo(e,t){return new bo({type:`union`,options:e,...M(t)})}var So=S(`ZodIntersection`,(e,t)=>{yr.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oa(e,t,n,r)});function Co(e,t){return new So({type:`intersection`,left:e,right:t})}var wo=S(`ZodRecord`,(e,t)=>{Sr.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sa(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function To(e,t,n){return new wo({type:`record`,keyType:e,valueType:t,...M(n)})}var Eo=S(`ZodEnum`,(e,t)=>{Cr.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$i(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Eo({...t,checks:[],...M(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Eo({...t,checks:[],...M(r),entries:i})}});function Do(e,t){return new Eo({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...M(t)})}var Oo=S(`ZodLiteral`,(e,t)=>{wr.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ea(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function ko(e,t){return new Oo({type:`literal`,values:Array.isArray(e)?e:[e],...M(t)})}var Ao=S(`ZodTransform`,(e,t)=>{Tr.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>na(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Xe(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(L(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(L(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function jo(e){return new Ao({type:`transform`,transform:e})}var Mo=S(`ZodOptional`,(e,t)=>{Dr.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ha(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function No(e){return new Mo({type:`optional`,innerType:e})}var Po=S(`ZodExactOptional`,(e,t)=>{Or.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ha(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Fo(e){return new Po({type:`optional`,innerType:e})}var Io=S(`ZodNullable`,(e,t)=>{kr.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ca(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Lo(e){return new Io({type:`nullable`,innerType:e})}var Ro=S(`ZodDefault`,(e,t)=>{Ar.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ua(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function zo(e,t){return new Ro({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():lt(t)}})}var Bo=S(`ZodPrefault`,(e,t)=>{Mr.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>da(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Vo(e,t){return new Bo({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():lt(t)}})}var Ho=S(`ZodNonOptional`,(e,t)=>{Nr.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>la(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Uo(e,t){return new Ho({type:`nonoptional`,innerType:e,...M(t)})}var Wo=S(`ZodCatch`,(e,t)=>{Fr.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Go(e,t){return new Wo({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Ko=S(`ZodPipe`,(e,t)=>{Ir.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pa(e,t,n,r),e.in=t.in,e.out=t.out});function qo(e,t){return new Ko({type:`pipe`,in:e,out:t})}var Jo=S(`ZodReadonly`,(e,t)=>{Lr.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ma(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Yo(e){return new Jo({type:`readonly`,innerType:e})}var Xo=S(`ZodCustom`,(e,t)=>{zr.init(e,t),Q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ta(e,t,n,r)});function Zo(e,t={}){return Vi(Xo,e,t)}function Qo(e){return Hi(e)}Object.defineProperty(exports,`C`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`S`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return oo}}),Object.defineProperty(exports,`b`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return za}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return Je}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return Ge}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return ko}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return xo}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return _o}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return yo}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return uo}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return To}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return Do}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return po}}),Object.defineProperty(exports,`v`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`x`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`y`,{enumerable:!0,get:function(){return s}});
|
|
41
|
-
//# sourceMappingURL=schemas-
|
|
41
|
+
//# sourceMappingURL=schemas-DeE-RHGa.cjs.map
|