@expedite-commerce/expedite-components 0.2.130 → 0.2.132

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.
@@ -37334,7 +37334,7 @@ const gE = ["innerHTML"], vE = {
37334
37334
  var h;
37335
37335
  return (h = a.chatStyles) == null ? void 0 : h.textColor;
37336
37336
  }), d = (h, v, y = !1) => {
37337
- if (typeof h == "string" && h.startsWith("playbookNavigate:")) {
37337
+ if (console.info("performAction action", h), typeof h == "string" && h.startsWith("playbookNavigate:")) {
37338
37338
  const x = h.slice(17);
37339
37339
  i.navigateToBean(x);
37340
37340
  return;
@@ -37436,7 +37436,7 @@ const gE = ["innerHTML"], vE = {
37436
37436
  ], 512)
37437
37437
  ], 2));
37438
37438
  }
37439
- }, SE = /* @__PURE__ */ Ne(IE, [["__scopeId", "data-v-fe989f2b"]]), OE = { class: "ai-upload ect-flex-inline ect-items-center" }, TE = {
37439
+ }, SE = /* @__PURE__ */ Ne(IE, [["__scopeId", "data-v-4ae19744"]]), OE = { class: "ai-upload ect-flex-inline ect-items-center" }, TE = {
37440
37440
  __name: "FileUpload",
37441
37441
  props: {
37442
37442
  // Prop to reset the file input state when changed to true
@@ -158,7 +158,7 @@
158
158
  `;break}return o},to.prototype.render=function(t,r,n){let o="";const a=this.rules;for(let i=0,l=t.length;i<l;i++){const s=t[i].type;s==="inline"?o+=this.renderInline(t[i].children,r,n):typeof a[s]<"u"?o+=a[s](t,i,r,n,this):o+=this.renderToken(t,i,r,n)}return o};function Ot(){this.__rules__=[],this.__cache__=null}Ot.prototype.__find__=function(t){for(let r=0;r<this.__rules__.length;r++)if(this.__rules__[r].name===t)return r;return-1},Ot.prototype.__compile__=function(){const t=this,r=[""];t.__rules__.forEach(function(n){n.enabled&&n.alt.forEach(function(o){r.indexOf(o)<0&&r.push(o)})}),t.__cache__={},r.forEach(function(n){t.__cache__[n]=[],t.__rules__.forEach(function(o){o.enabled&&(n&&o.alt.indexOf(n)<0||t.__cache__[n].push(o.fn))})})},Ot.prototype.at=function(t,r,n){const o=this.__find__(t),a=n||{};if(o===-1)throw new Error("Parser rule not found: "+t);this.__rules__[o].fn=r,this.__rules__[o].alt=a.alt||[],this.__cache__=null},Ot.prototype.before=function(t,r,n,o){const a=this.__find__(t),i=o||{};if(a===-1)throw new Error("Parser rule not found: "+t);this.__rules__.splice(a,0,{name:r,enabled:!0,fn:n,alt:i.alt||[]}),this.__cache__=null},Ot.prototype.after=function(t,r,n,o){const a=this.__find__(t),i=o||{};if(a===-1)throw new Error("Parser rule not found: "+t);this.__rules__.splice(a+1,0,{name:r,enabled:!0,fn:n,alt:i.alt||[]}),this.__cache__=null},Ot.prototype.push=function(t,r,n){const o=n||{};this.__rules__.push({name:t,enabled:!0,fn:r,alt:o.alt||[]}),this.__cache__=null},Ot.prototype.enable=function(t,r){Array.isArray(t)||(t=[t]);const n=[];return t.forEach(function(o){const a=this.__find__(o);if(a<0){if(r)return;throw new Error("Rules manager: invalid rule name "+o)}this.__rules__[a].enabled=!0,n.push(o)},this),this.__cache__=null,n},Ot.prototype.enableOnly=function(t,r){Array.isArray(t)||(t=[t]),this.__rules__.forEach(function(n){n.enabled=!1}),this.enable(t,r)},Ot.prototype.disable=function(t,r){Array.isArray(t)||(t=[t]);const n=[];return t.forEach(function(o){const a=this.__find__(o);if(a<0){if(r)return;throw new Error("Rules manager: invalid rule name "+o)}this.__rules__[a].enabled=!1,n.push(o)},this),this.__cache__=null,n},Ot.prototype.getRules=function(t){return this.__cache__===null&&this.__compile__(),this.__cache__[t]||[]};function Zt(t,r,n){this.type=t,this.tag=r,this.attrs=null,this.map=null,this.nesting=n,this.level=0,this.children=null,this.content="",this.markup="",this.info="",this.meta=null,this.block=!1,this.hidden=!1}Zt.prototype.attrIndex=function(r){if(!this.attrs)return-1;const n=this.attrs;for(let o=0,a=n.length;o<a;o++)if(n[o][0]===r)return o;return-1},Zt.prototype.attrPush=function(r){this.attrs?this.attrs.push(r):this.attrs=[r]},Zt.prototype.attrSet=function(r,n){const o=this.attrIndex(r),a=[r,n];o<0?this.attrPush(a):this.attrs[o]=a},Zt.prototype.attrGet=function(r){const n=this.attrIndex(r);let o=null;return n>=0&&(o=this.attrs[n][1]),o},Zt.prototype.attrJoin=function(r,n){const o=this.attrIndex(r);o<0?this.attrPush([r,n]):this.attrs[o][1]=this.attrs[o][1]+" "+n};function hu(t,r,n){this.src=t,this.env=n,this.tokens=[],this.inlineMode=!1,this.md=r}hu.prototype.Token=Zt;const Xb=/\r\n?|\n/g,Wb=/\0/g;function Qb(t){let r;r=t.src.replace(Xb,`
159
159
  `),r=r.replace(Wb,"�"),t.src=r}function Zb(t){let r;t.inlineMode?(r=new t.Token("inline","",0),r.content=t.src,r.map=[0,1],r.children=[],t.tokens.push(r)):t.md.block.parse(t.src,t.md,t.env,t.tokens)}function Jb(t){const r=t.tokens;for(let n=0,o=r.length;n<o;n++){const a=r[n];a.type==="inline"&&t.md.inline.parse(a.content,t.md,t.env,a.children)}}function Yb(t){return/^<a[>\s]/i.test(t)}function ex(t){return/^<\/a\s*>/i.test(t)}function tx(t){const r=t.tokens;if(t.md.options.linkify)for(let n=0,o=r.length;n<o;n++){if(r[n].type!=="inline"||!t.md.linkify.pretest(r[n].content))continue;let a=r[n].children,i=0;for(let l=a.length-1;l>=0;l--){const s=a[l];if(s.type==="link_close"){for(l--;a[l].level!==s.level&&a[l].type!=="link_open";)l--;continue}if(s.type==="html_inline"&&(Yb(s.content)&&i>0&&i--,ex(s.content)&&i++),!(i>0)&&s.type==="text"&&t.md.linkify.test(s.content)){const u=s.content;let h=t.md.linkify.match(u);const d=[];let m=s.level,c=0;h.length>0&&h[0].index===0&&l>0&&a[l-1].type==="text_special"&&(h=h.slice(1));for(let y=0;y<h.length;y++){const f=h[y].url,b=t.md.normalizeLink(f);if(!t.md.validateLink(b))continue;let p=h[y].text;h[y].schema?h[y].schema==="mailto:"&&!/^mailto:/i.test(p)?p=t.md.normalizeLinkText("mailto:"+p).replace(/^mailto:/,""):p=t.md.normalizeLinkText(p):p=t.md.normalizeLinkText("http://"+p).replace(/^http:\/\//,"");const x=h[y].index;if(x>c){const E=new t.Token("text","",0);E.content=u.slice(c,x),E.level=m,d.push(E)}const g=new t.Token("link_open","a",1);g.attrs=[["href",b]],g.level=m++,g.markup="linkify",g.info="auto",d.push(g);const C=new t.Token("text","",0);C.content=p,C.level=m,d.push(C);const _=new t.Token("link_close","a",-1);_.level=--m,_.markup="linkify",_.info="auto",d.push(_),c=h[y].lastIndex}if(c<u.length){const y=new t.Token("text","",0);y.content=u.slice(c),y.level=m,d.push(y)}r[n].children=a=du(a,l,d)}}}}const pu=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,nx=/\((c|tm|r)\)/i,ox=/\((c|tm|r)\)/ig,rx={c:"©",r:"®",tm:"™"};function ax(t,r){return rx[r.toLowerCase()]}function ix(t){let r=0;for(let n=t.length-1;n>=0;n--){const o=t[n];o.type==="text"&&!r&&(o.content=o.content.replace(ox,ax)),o.type==="link_open"&&o.info==="auto"&&r--,o.type==="link_close"&&o.info==="auto"&&r++}}function lx(t){let r=0;for(let n=t.length-1;n>=0;n--){const o=t[n];o.type==="text"&&!r&&pu.test(o.content)&&(o.content=o.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/mg,"$1—").replace(/(^|\s)--(?=\s|$)/mg,"$1–").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg,"$1–")),o.type==="link_open"&&o.info==="auto"&&r--,o.type==="link_close"&&o.info==="auto"&&r++}}function sx(t){let r;if(t.md.options.typographer)for(r=t.tokens.length-1;r>=0;r--)t.tokens[r].type==="inline"&&(nx.test(t.tokens[r].content)&&ix(t.tokens[r].children),pu.test(t.tokens[r].content)&&lx(t.tokens[r].children))}const cx=/['"]/,mu=/['"]/g,yu="’";function Dr(t,r,n){return t.slice(0,r)+n+t.slice(r+1)}function ux(t,r){let n;const o=[];for(let a=0;a<t.length;a++){const i=t[a],l=t[a].level;for(n=o.length-1;n>=0&&!(o[n].level<=l);n--);if(o.length=n+1,i.type!=="text")continue;let s=i.content,u=0,h=s.length;e:for(;u<h;){mu.lastIndex=u;const d=mu.exec(s);if(!d)break;let m=!0,c=!0;u=d.index+1;const y=d[0]==="'";let f=32;if(d.index-1>=0)f=s.charCodeAt(d.index-1);else for(n=a-1;n>=0&&!(t[n].type==="softbreak"||t[n].type==="hardbreak");n--)if(t[n].content){f=t[n].content.charCodeAt(t[n].content.length-1);break}let b=32;if(u<h)b=s.charCodeAt(u);else for(n=a+1;n<t.length&&!(t[n].type==="softbreak"||t[n].type==="hardbreak");n++)if(t[n].content){b=t[n].content.charCodeAt(0);break}const p=Oo(f)||To(String.fromCharCode(f)),x=Oo(b)||To(String.fromCharCode(b)),g=Io(f),C=Io(b);if(C?m=!1:x&&(g||p||(m=!1)),g?c=!1:p&&(C||x||(c=!1)),b===34&&d[0]==='"'&&f>=48&&f<=57&&(c=m=!1),m&&c&&(m=p,c=x),!m&&!c){y&&(i.content=Dr(i.content,d.index,yu));continue}if(c)for(n=o.length-1;n>=0;n--){let _=o[n];if(o[n].level<l)break;if(_.single===y&&o[n].level===l){_=o[n];let E,A;y?(E=r.md.options.quotes[2],A=r.md.options.quotes[3]):(E=r.md.options.quotes[0],A=r.md.options.quotes[1]),i.content=Dr(i.content,d.index,A),t[_.token].content=Dr(t[_.token].content,_.pos,E),u+=A.length-1,_.token===a&&(u+=E.length-1),s=i.content,h=s.length,o.length=n;continue e}}m?o.push({token:a,pos:d.index,single:y,level:l}):c&&y&&(i.content=Dr(i.content,d.index,yu))}}}function dx(t){if(t.md.options.typographer)for(let r=t.tokens.length-1;r>=0;r--)t.tokens[r].type!=="inline"||!cx.test(t.tokens[r].content)||ux(t.tokens[r].children,t)}function fx(t){let r,n;const o=t.tokens,a=o.length;for(let i=0;i<a;i++){if(o[i].type!=="inline")continue;const l=o[i].children,s=l.length;for(r=0;r<s;r++)l[r].type==="text_special"&&(l[r].type="text");for(r=n=0;r<s;r++)l[r].type==="text"&&r+1<s&&l[r+1].type==="text"?l[r+1].content=l[r].content+l[r+1].content:(r!==n&&(l[n]=l[r]),n++);r!==n&&(l.length=n)}}const Oi=[["normalize",Qb],["block",Zb],["inline",Jb],["linkify",tx],["replacements",sx],["smartquotes",dx],["text_join",fx]];function Di(){this.ruler=new Ot;for(let t=0;t<Oi.length;t++)this.ruler.push(Oi[t][0],Oi[t][1])}Di.prototype.process=function(t){const r=this.ruler.getRules("");for(let n=0,o=r.length;n<o;n++)r[n](t)},Di.prototype.State=hu;function cn(t,r,n,o){this.src=t,this.md=r,this.env=n,this.tokens=o,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.listIndent=-1,this.parentType="root",this.level=0;const a=this.src;for(let i=0,l=0,s=0,u=0,h=a.length,d=!1;l<h;l++){const m=a.charCodeAt(l);if(!d)if(je(m)){s++,m===9?u+=4-u%4:u++;continue}else d=!0;(m===10||l===h-1)&&(m!==10&&l++,this.bMarks.push(i),this.eMarks.push(l),this.tShift.push(s),this.sCount.push(u),this.bsCount.push(0),d=!1,s=0,u=0,i=l+1)}this.bMarks.push(a.length),this.eMarks.push(a.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}cn.prototype.push=function(t,r,n){const o=new Zt(t,r,n);return o.block=!0,n<0&&this.level--,o.level=this.level,n>0&&this.level++,this.tokens.push(o),o},cn.prototype.isEmpty=function(r){return this.bMarks[r]+this.tShift[r]>=this.eMarks[r]},cn.prototype.skipEmptyLines=function(r){for(let n=this.lineMax;r<n&&!(this.bMarks[r]+this.tShift[r]<this.eMarks[r]);r++);return r},cn.prototype.skipSpaces=function(r){for(let n=this.src.length;r<n;r++){const o=this.src.charCodeAt(r);if(!je(o))break}return r},cn.prototype.skipSpacesBack=function(r,n){if(r<=n)return r;for(;r>n;)if(!je(this.src.charCodeAt(--r)))return r+1;return r},cn.prototype.skipChars=function(r,n){for(let o=this.src.length;r<o&&this.src.charCodeAt(r)===n;r++);return r},cn.prototype.skipCharsBack=function(r,n,o){if(r<=o)return r;for(;r>o;)if(n!==this.src.charCodeAt(--r))return r+1;return r},cn.prototype.getLines=function(r,n,o,a){if(r>=n)return"";const i=new Array(n-r);for(let l=0,s=r;s<n;s++,l++){let u=0;const h=this.bMarks[s];let d=h,m;for(s+1<n||a?m=this.eMarks[s]+1:m=this.eMarks[s];d<m&&u<o;){const c=this.src.charCodeAt(d);if(je(c))c===9?u+=4-(u+this.bsCount[s])%4:u++;else if(d-h<this.tShift[s])u++;else break;d++}u>o?i[l]=new Array(u-o+1).join(" ")+this.src.slice(d,m):i[l]=this.src.slice(d,m)}return i.join("")},cn.prototype.Token=Zt;const hx=65536;function Vi(t,r){const n=t.bMarks[r]+t.tShift[r],o=t.eMarks[r];return t.src.slice(n,o)}function gu(t){const r=[],n=t.length;let o=0,a=t.charCodeAt(o),i=!1,l=0,s="";for(;o<n;)a===124&&(i?(s+=t.substring(l,o-1),l=o):(r.push(s+t.substring(l,o)),s="",l=o+1)),i=a===92,o++,a=t.charCodeAt(o);return r.push(s+t.substring(l)),r}function px(t,r,n,o){if(r+2>n)return!1;let a=r+1;if(t.sCount[a]<t.blkIndent||t.sCount[a]-t.blkIndent>=4)return!1;let i=t.bMarks[a]+t.tShift[a];if(i>=t.eMarks[a])return!1;const l=t.src.charCodeAt(i++);if(l!==124&&l!==45&&l!==58||i>=t.eMarks[a])return!1;const s=t.src.charCodeAt(i++);if(s!==124&&s!==45&&s!==58&&!je(s)||l===45&&je(s))return!1;for(;i<t.eMarks[a];){const _=t.src.charCodeAt(i);if(_!==124&&_!==45&&_!==58&&!je(_))return!1;i++}let u=Vi(t,r+1),h=u.split("|");const d=[];for(let _=0;_<h.length;_++){const E=h[_].trim();if(!E){if(_===0||_===h.length-1)continue;return!1}if(!/^:?-+:?$/.test(E))return!1;E.charCodeAt(E.length-1)===58?d.push(E.charCodeAt(0)===58?"center":"right"):E.charCodeAt(0)===58?d.push("left"):d.push("")}if(u=Vi(t,r).trim(),u.indexOf("|")===-1||t.sCount[r]-t.blkIndent>=4)return!1;h=gu(u),h.length&&h[0]===""&&h.shift(),h.length&&h[h.length-1]===""&&h.pop();const m=h.length;if(m===0||m!==d.length)return!1;if(o)return!0;const c=t.parentType;t.parentType="table";const y=t.md.block.ruler.getRules("blockquote"),f=t.push("table_open","table",1),b=[r,0];f.map=b;const p=t.push("thead_open","thead",1);p.map=[r,r+1];const x=t.push("tr_open","tr",1);x.map=[r,r+1];for(let _=0;_<h.length;_++){const E=t.push("th_open","th",1);d[_]&&(E.attrs=[["style","text-align:"+d[_]]]);const A=t.push("inline","",0);A.content=h[_].trim(),A.children=[],t.push("th_close","th",-1)}t.push("tr_close","tr",-1),t.push("thead_close","thead",-1);let g,C=0;for(a=r+2;a<n&&!(t.sCount[a]<t.blkIndent);a++){let _=!1;for(let A=0,k=y.length;A<k;A++)if(y[A](t,a,n,!0)){_=!0;break}if(_||(u=Vi(t,a).trim(),!u)||t.sCount[a]-t.blkIndent>=4||(h=gu(u),h.length&&h[0]===""&&h.shift(),h.length&&h[h.length-1]===""&&h.pop(),C+=m-h.length,C>hx))break;if(a===r+2){const A=t.push("tbody_open","tbody",1);A.map=g=[r+2,0]}const E=t.push("tr_open","tr",1);E.map=[a,a+1];for(let A=0;A<m;A++){const k=t.push("td_open","td",1);d[A]&&(k.attrs=[["style","text-align:"+d[A]]]);const B=t.push("inline","",0);B.content=h[A]?h[A].trim():"",B.children=[],t.push("td_close","td",-1)}t.push("tr_close","tr",-1)}return g&&(t.push("tbody_close","tbody",-1),g[1]=a),t.push("table_close","table",-1),b[1]=a,t.parentType=c,t.line=a,!0}function mx(t,r,n){if(t.sCount[r]-t.blkIndent<4)return!1;let o=r+1,a=o;for(;o<n;){if(t.isEmpty(o)){o++;continue}if(t.sCount[o]-t.blkIndent>=4){o++,a=o;continue}break}t.line=a;const i=t.push("code_block","code",0);return i.content=t.getLines(r,a,4+t.blkIndent,!1)+`
160
160
  `,i.map=[r,t.line],!0}function yx(t,r,n,o){let a=t.bMarks[r]+t.tShift[r],i=t.eMarks[r];if(t.sCount[r]-t.blkIndent>=4||a+3>i)return!1;const l=t.src.charCodeAt(a);if(l!==126&&l!==96)return!1;let s=a;a=t.skipChars(a,l);let u=a-s;if(u<3)return!1;const h=t.src.slice(s,a),d=t.src.slice(a,i);if(l===96&&d.indexOf(String.fromCharCode(l))>=0)return!1;if(o)return!0;let m=r,c=!1;for(;m++,!(m>=n||(a=s=t.bMarks[m]+t.tShift[m],i=t.eMarks[m],a<i&&t.sCount[m]<t.blkIndent));)if(t.src.charCodeAt(a)===l&&!(t.sCount[m]-t.blkIndent>=4)&&(a=t.skipChars(a,l),!(a-s<u)&&(a=t.skipSpaces(a),!(a<i)))){c=!0;break}u=t.sCount[r],t.line=m+(c?1:0);const y=t.push("fence","code",0);return y.info=d,y.content=t.getLines(r+1,m,u,!0),y.markup=h,y.map=[r,t.line],!0}function gx(t,r,n,o){let a=t.bMarks[r]+t.tShift[r],i=t.eMarks[r];const l=t.lineMax;if(t.sCount[r]-t.blkIndent>=4||t.src.charCodeAt(a)!==62)return!1;if(o)return!0;const s=[],u=[],h=[],d=[],m=t.md.block.ruler.getRules("blockquote"),c=t.parentType;t.parentType="blockquote";let y=!1,f;for(f=r;f<n;f++){const C=t.sCount[f]<t.blkIndent;if(a=t.bMarks[f]+t.tShift[f],i=t.eMarks[f],a>=i)break;if(t.src.charCodeAt(a++)===62&&!C){let E=t.sCount[f]+1,A,k;t.src.charCodeAt(a)===32?(a++,E++,k=!1,A=!0):t.src.charCodeAt(a)===9?(A=!0,(t.bsCount[f]+E)%4===3?(a++,E++,k=!1):k=!0):A=!1;let B=E;for(s.push(t.bMarks[f]),t.bMarks[f]=a;a<i;){const D=t.src.charCodeAt(a);if(je(D))D===9?B+=4-(B+t.bsCount[f]+(k?1:0))%4:B++;else break;a++}y=a>=i,u.push(t.bsCount[f]),t.bsCount[f]=t.sCount[f]+1+(A?1:0),h.push(t.sCount[f]),t.sCount[f]=B-E,d.push(t.tShift[f]),t.tShift[f]=a-t.bMarks[f];continue}if(y)break;let _=!1;for(let E=0,A=m.length;E<A;E++)if(m[E](t,f,n,!0)){_=!0;break}if(_){t.lineMax=f,t.blkIndent!==0&&(s.push(t.bMarks[f]),u.push(t.bsCount[f]),d.push(t.tShift[f]),h.push(t.sCount[f]),t.sCount[f]-=t.blkIndent);break}s.push(t.bMarks[f]),u.push(t.bsCount[f]),d.push(t.tShift[f]),h.push(t.sCount[f]),t.sCount[f]=-1}const b=t.blkIndent;t.blkIndent=0;const p=t.push("blockquote_open","blockquote",1);p.markup=">";const x=[r,0];p.map=x,t.md.block.tokenize(t,r,f);const g=t.push("blockquote_close","blockquote",-1);g.markup=">",t.lineMax=l,t.parentType=c,x[1]=t.line;for(let C=0;C<d.length;C++)t.bMarks[C+r]=s[C],t.tShift[C+r]=d[C],t.sCount[C+r]=h[C],t.bsCount[C+r]=u[C];return t.blkIndent=b,!0}function bx(t,r,n,o){const a=t.eMarks[r];if(t.sCount[r]-t.blkIndent>=4)return!1;let i=t.bMarks[r]+t.tShift[r];const l=t.src.charCodeAt(i++);if(l!==42&&l!==45&&l!==95)return!1;let s=1;for(;i<a;){const h=t.src.charCodeAt(i++);if(h!==l&&!je(h))return!1;h===l&&s++}if(s<3)return!1;if(o)return!0;t.line=r+1;const u=t.push("hr","hr",0);return u.map=[r,t.line],u.markup=Array(s+1).join(String.fromCharCode(l)),!0}function bu(t,r){const n=t.eMarks[r];let o=t.bMarks[r]+t.tShift[r];const a=t.src.charCodeAt(o++);if(a!==42&&a!==45&&a!==43)return-1;if(o<n){const i=t.src.charCodeAt(o);if(!je(i))return-1}return o}function xu(t,r){const n=t.bMarks[r]+t.tShift[r],o=t.eMarks[r];let a=n;if(a+1>=o)return-1;let i=t.src.charCodeAt(a++);if(i<48||i>57)return-1;for(;;){if(a>=o)return-1;if(i=t.src.charCodeAt(a++),i>=48&&i<=57){if(a-n>=10)return-1;continue}if(i===41||i===46)break;return-1}return a<o&&(i=t.src.charCodeAt(a),!je(i))?-1:a}function xx(t,r){const n=t.level+2;for(let o=r+2,a=t.tokens.length-2;o<a;o++)t.tokens[o].level===n&&t.tokens[o].type==="paragraph_open"&&(t.tokens[o+2].hidden=!0,t.tokens[o].hidden=!0,o+=2)}function _x(t,r,n,o){let a,i,l,s,u=r,h=!0;if(t.sCount[u]-t.blkIndent>=4||t.listIndent>=0&&t.sCount[u]-t.listIndent>=4&&t.sCount[u]<t.blkIndent)return!1;let d=!1;o&&t.parentType==="paragraph"&&t.sCount[u]>=t.blkIndent&&(d=!0);let m,c,y;if((y=xu(t,u))>=0){if(m=!0,l=t.bMarks[u]+t.tShift[u],c=Number(t.src.slice(l,y-1)),d&&c!==1)return!1}else if((y=bu(t,u))>=0)m=!1;else return!1;if(d&&t.skipSpaces(y)>=t.eMarks[u])return!1;if(o)return!0;const f=t.src.charCodeAt(y-1),b=t.tokens.length;m?(s=t.push("ordered_list_open","ol",1),c!==1&&(s.attrs=[["start",c]])):s=t.push("bullet_list_open","ul",1);const p=[u,0];s.map=p,s.markup=String.fromCharCode(f);let x=!1;const g=t.md.block.ruler.getRules("list"),C=t.parentType;for(t.parentType="list";u<n;){i=y,a=t.eMarks[u];const _=t.sCount[u]+y-(t.bMarks[u]+t.tShift[u]);let E=_;for(;i<a;){const z=t.src.charCodeAt(i);if(z===9)E+=4-(E+t.bsCount[u])%4;else if(z===32)E++;else break;i++}const A=i;let k;A>=a?k=1:k=E-_,k>4&&(k=1);const B=_+k;s=t.push("list_item_open","li",1),s.markup=String.fromCharCode(f);const D=[u,0];s.map=D,m&&(s.info=t.src.slice(l,y-1));const w=t.tight,v=t.tShift[u],S=t.sCount[u],I=t.listIndent;if(t.listIndent=t.blkIndent,t.blkIndent=B,t.tight=!0,t.tShift[u]=A-t.bMarks[u],t.sCount[u]=E,A>=a&&t.isEmpty(u+1)?t.line=Math.min(t.line+2,n):t.md.block.tokenize(t,u,n,!0),(!t.tight||x)&&(h=!1),x=t.line-u>1&&t.isEmpty(t.line-1),t.blkIndent=t.listIndent,t.listIndent=I,t.tShift[u]=v,t.sCount[u]=S,t.tight=w,s=t.push("list_item_close","li",-1),s.markup=String.fromCharCode(f),u=t.line,D[1]=u,u>=n||t.sCount[u]<t.blkIndent||t.sCount[u]-t.blkIndent>=4)break;let R=!1;for(let z=0,$=g.length;z<$;z++)if(g[z](t,u,n,!0)){R=!0;break}if(R)break;if(m){if(y=xu(t,u),y<0)break;l=t.bMarks[u]+t.tShift[u]}else if(y=bu(t,u),y<0)break;if(f!==t.src.charCodeAt(y-1))break}return m?s=t.push("ordered_list_close","ol",-1):s=t.push("bullet_list_close","ul",-1),s.markup=String.fromCharCode(f),p[1]=u,t.line=u,t.parentType=C,h&&xx(t,b),!0}function Cx(t,r,n,o){let a=t.bMarks[r]+t.tShift[r],i=t.eMarks[r],l=r+1;if(t.sCount[r]-t.blkIndent>=4||t.src.charCodeAt(a)!==91)return!1;function s(g){const C=t.lineMax;if(g>=C||t.isEmpty(g))return null;let _=!1;if(t.sCount[g]-t.blkIndent>3&&(_=!0),t.sCount[g]<0&&(_=!0),!_){const k=t.md.block.ruler.getRules("reference"),B=t.parentType;t.parentType="reference";let D=!1;for(let w=0,v=k.length;w<v;w++)if(k[w](t,g,C,!0)){D=!0;break}if(t.parentType=B,D)return null}const E=t.bMarks[g]+t.tShift[g],A=t.eMarks[g];return t.src.slice(E,A+1)}let u=t.src.slice(a,i+1);i=u.length;let h=-1;for(a=1;a<i;a++){const g=u.charCodeAt(a);if(g===91)return!1;if(g===93){h=a;break}else if(g===10){const C=s(l);C!==null&&(u+=C,i=u.length,l++)}else if(g===92&&(a++,a<i&&u.charCodeAt(a)===10)){const C=s(l);C!==null&&(u+=C,i=u.length,l++)}}if(h<0||u.charCodeAt(h+1)!==58)return!1;for(a=h+2;a<i;a++){const g=u.charCodeAt(a);if(g===10){const C=s(l);C!==null&&(u+=C,i=u.length,l++)}else if(!je(g))break}const d=t.md.helpers.parseLinkDestination(u,a,i);if(!d.ok)return!1;const m=t.md.normalizeLink(d.str);if(!t.md.validateLink(m))return!1;a=d.pos;const c=a,y=l,f=a;for(;a<i;a++){const g=u.charCodeAt(a);if(g===10){const C=s(l);C!==null&&(u+=C,i=u.length,l++)}else if(!je(g))break}let b=t.md.helpers.parseLinkTitle(u,a,i);for(;b.can_continue;){const g=s(l);if(g===null)break;u+=g,a=i,i=u.length,l++,b=t.md.helpers.parseLinkTitle(u,a,i,b)}let p;for(a<i&&f!==a&&b.ok?(p=b.str,a=b.pos):(p="",a=c,l=y);a<i;){const g=u.charCodeAt(a);if(!je(g))break;a++}if(a<i&&u.charCodeAt(a)!==10&&p)for(p="",a=c,l=y;a<i;){const g=u.charCodeAt(a);if(!je(g))break;a++}if(a<i&&u.charCodeAt(a)!==10)return!1;const x=Or(u.slice(1,h));return x?(o||(typeof t.env.references>"u"&&(t.env.references={}),typeof t.env.references[x]>"u"&&(t.env.references[x]={title:p,href:m}),t.line=l),!0):!1}const Ex=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],kx="[a-zA-Z_:][a-zA-Z0-9:._-]*",vx="(?:"+"[^\"'=<>`\\x00-\\x20]+"+"|"+"'[^']*'"+"|"+'"[^"]*"'+")",_u="<[A-Za-z][A-Za-z0-9\\-]*"+("(?:\\s+"+kx+"(?:\\s*=\\s*"+vx+")?)")+"*\\s*\\/?>",Cu="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",Ax="<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->",wx="<[?][\\s\\S]*?[?]>",Nx="<![A-Za-z][^>]*>",Sx="<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",Bx=new RegExp("^(?:"+_u+"|"+Cu+"|"+Ax+"|"+wx+"|"+Nx+"|"+Sx+")"),Ix=new RegExp("^(?:"+_u+"|"+Cu+")"),no=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp("^</?("+Ex.join("|")+")(?=(\\s|/?>|$))","i"),/^$/,!0],[new RegExp(Ix.source+"\\s*$"),/^$/,!1]];function Tx(t,r,n,o){let a=t.bMarks[r]+t.tShift[r],i=t.eMarks[r];if(t.sCount[r]-t.blkIndent>=4||!t.md.options.html||t.src.charCodeAt(a)!==60)return!1;let l=t.src.slice(a,i),s=0;for(;s<no.length&&!no[s][0].test(l);s++);if(s===no.length)return!1;if(o)return no[s][2];let u=r+1;if(!no[s][1].test(l)){for(;u<n&&!(t.sCount[u]<t.blkIndent);u++)if(a=t.bMarks[u]+t.tShift[u],i=t.eMarks[u],l=t.src.slice(a,i),no[s][1].test(l)){l.length!==0&&u++;break}}t.line=u;const h=t.push("html_block","",0);return h.map=[r,u],h.content=t.getLines(r,u,t.blkIndent,!0),!0}function Ox(t,r,n,o){let a=t.bMarks[r]+t.tShift[r],i=t.eMarks[r];if(t.sCount[r]-t.blkIndent>=4)return!1;let l=t.src.charCodeAt(a);if(l!==35||a>=i)return!1;let s=1;for(l=t.src.charCodeAt(++a);l===35&&a<i&&s<=6;)s++,l=t.src.charCodeAt(++a);if(s>6||a<i&&!je(l))return!1;if(o)return!0;i=t.skipSpacesBack(i,a);const u=t.skipCharsBack(i,35,a);u>a&&je(t.src.charCodeAt(u-1))&&(i=u),t.line=r+1;const h=t.push("heading_open","h"+String(s),1);h.markup="########".slice(0,s),h.map=[r,t.line];const d=t.push("inline","",0);d.content=t.src.slice(a,i).trim(),d.map=[r,t.line],d.children=[];const m=t.push("heading_close","h"+String(s),-1);return m.markup="########".slice(0,s),!0}function Dx(t,r,n){const o=t.md.block.ruler.getRules("paragraph");if(t.sCount[r]-t.blkIndent>=4)return!1;const a=t.parentType;t.parentType="paragraph";let i=0,l,s=r+1;for(;s<n&&!t.isEmpty(s);s++){if(t.sCount[s]-t.blkIndent>3)continue;if(t.sCount[s]>=t.blkIndent){let y=t.bMarks[s]+t.tShift[s];const f=t.eMarks[s];if(y<f&&(l=t.src.charCodeAt(y),(l===45||l===61)&&(y=t.skipChars(y,l),y=t.skipSpaces(y),y>=f))){i=l===61?1:2;break}}if(t.sCount[s]<0)continue;let c=!1;for(let y=0,f=o.length;y<f;y++)if(o[y](t,s,n,!0)){c=!0;break}if(c)break}if(!i)return!1;const u=t.getLines(r,s,t.blkIndent,!1).trim();t.line=s+1;const h=t.push("heading_open","h"+String(i),1);h.markup=String.fromCharCode(l),h.map=[r,t.line];const d=t.push("inline","",0);d.content=u,d.map=[r,t.line-1],d.children=[];const m=t.push("heading_close","h"+String(i),-1);return m.markup=String.fromCharCode(l),t.parentType=a,!0}function Vx(t,r,n){const o=t.md.block.ruler.getRules("paragraph"),a=t.parentType;let i=r+1;for(t.parentType="paragraph";i<n&&!t.isEmpty(i);i++){if(t.sCount[i]-t.blkIndent>3||t.sCount[i]<0)continue;let h=!1;for(let d=0,m=o.length;d<m;d++)if(o[d](t,i,n,!0)){h=!0;break}if(h)break}const l=t.getLines(r,i,t.blkIndent,!1).trim();t.line=i;const s=t.push("paragraph_open","p",1);s.map=[r,t.line];const u=t.push("inline","",0);return u.content=l,u.map=[r,t.line],u.children=[],t.push("paragraph_close","p",-1),t.parentType=a,!0}const Vr=[["table",px,["paragraph","reference"]],["code",mx],["fence",yx,["paragraph","reference","blockquote","list"]],["blockquote",gx,["paragraph","reference","blockquote","list"]],["hr",bx,["paragraph","reference","blockquote","list"]],["list",_x,["paragraph","reference","blockquote"]],["reference",Cx],["html_block",Tx,["paragraph","reference","blockquote"]],["heading",Ox,["paragraph","reference","blockquote"]],["lheading",Dx],["paragraph",Vx]];function Fr(){this.ruler=new Ot;for(let t=0;t<Vr.length;t++)this.ruler.push(Vr[t][0],Vr[t][1],{alt:(Vr[t][2]||[]).slice()})}Fr.prototype.tokenize=function(t,r,n){const o=this.ruler.getRules(""),a=o.length,i=t.md.options.maxNesting;let l=r,s=!1;for(;l<n&&(t.line=l=t.skipEmptyLines(l),!(l>=n||t.sCount[l]<t.blkIndent));){if(t.level>=i){t.line=n;break}const u=t.line;let h=!1;for(let d=0;d<a;d++)if(h=o[d](t,l,n,!1),h){if(u>=t.line)throw new Error("block rule didn't increment state.line");break}if(!h)throw new Error("none of the block rules matched");t.tight=!s,t.isEmpty(t.line-1)&&(s=!0),l=t.line,l<n&&t.isEmpty(l)&&(s=!0,l++,t.line=l)}},Fr.prototype.parse=function(t,r,n,o){if(!t)return;const a=new this.State(t,r,n,o);this.tokenize(a,a.line,a.lineMax)},Fr.prototype.State=cn;function Do(t,r,n,o){this.src=t,this.env=n,this.md=r,this.tokens=o,this.tokens_meta=Array(o.length),this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache={},this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1,this.linkLevel=0}Do.prototype.pushPending=function(){const t=new Zt("text","",0);return t.content=this.pending,t.level=this.pendingLevel,this.tokens.push(t),this.pending="",t},Do.prototype.push=function(t,r,n){this.pending&&this.pushPending();const o=new Zt(t,r,n);let a=null;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),o.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],a={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(o),this.tokens_meta.push(a),o},Do.prototype.scanDelims=function(t,r){const n=this.posMax,o=this.src.charCodeAt(t),a=t>0?this.src.charCodeAt(t-1):32;let i=t;for(;i<n&&this.src.charCodeAt(i)===o;)i++;const l=i-t,s=i<n?this.src.charCodeAt(i):32,u=Oo(a)||To(String.fromCharCode(a)),h=Oo(s)||To(String.fromCharCode(s)),d=Io(a),m=Io(s),c=!m&&(!h||d||u),y=!d&&(!u||m||h);return{can_open:c&&(r||!y||u),can_close:y&&(r||!c||h),length:l}},Do.prototype.Token=Zt;function Fx(t){switch(t){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}function Mx(t,r){let n=t.pos;for(;n<t.posMax&&!Fx(t.src.charCodeAt(n));)n++;return n===t.pos?!1:(r||(t.pending+=t.src.slice(t.pos,n)),t.pos=n,!0)}const Rx=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function Lx(t,r){if(!t.md.options.linkify||t.linkLevel>0)return!1;const n=t.pos,o=t.posMax;if(n+3>o||t.src.charCodeAt(n)!==58||t.src.charCodeAt(n+1)!==47||t.src.charCodeAt(n+2)!==47)return!1;const a=t.pending.match(Rx);if(!a)return!1;const i=a[1],l=t.md.linkify.matchAtStart(t.src.slice(n-i.length));if(!l)return!1;let s=l.url;if(s.length<=i.length)return!1;s=s.replace(/\*+$/,"");const u=t.md.normalizeLink(s);if(!t.md.validateLink(u))return!1;if(!r){t.pending=t.pending.slice(0,-i.length);const h=t.push("link_open","a",1);h.attrs=[["href",u]],h.markup="linkify",h.info="auto";const d=t.push("text","",0);d.content=t.md.normalizeLinkText(s);const m=t.push("link_close","a",-1);m.markup="linkify",m.info="auto"}return t.pos+=s.length-i.length,!0}function Px(t,r){let n=t.pos;if(t.src.charCodeAt(n)!==10)return!1;const o=t.pending.length-1,a=t.posMax;if(!r)if(o>=0&&t.pending.charCodeAt(o)===32)if(o>=1&&t.pending.charCodeAt(o-1)===32){let i=o-1;for(;i>=1&&t.pending.charCodeAt(i-1)===32;)i--;t.pending=t.pending.slice(0,i),t.push("hardbreak","br",0)}else t.pending=t.pending.slice(0,-1),t.push("softbreak","br",0);else t.push("softbreak","br",0);for(n++;n<a&&je(t.src.charCodeAt(n));)n++;return t.pos=n,!0}const Fi=[];for(let t=0;t<256;t++)Fi.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(t){Fi[t.charCodeAt(0)]=1});function qx(t,r){let n=t.pos;const o=t.posMax;if(t.src.charCodeAt(n)!==92||(n++,n>=o))return!1;let a=t.src.charCodeAt(n);if(a===10){for(r||t.push("hardbreak","br",0),n++;n<o&&(a=t.src.charCodeAt(n),!!je(a));)n++;return t.pos=n,!0}let i=t.src[n];if(a>=55296&&a<=56319&&n+1<o){const s=t.src.charCodeAt(n+1);s>=56320&&s<=57343&&(i+=t.src[n+1],n++)}const l="\\"+i;if(!r){const s=t.push("text_special","",0);a<256&&Fi[a]!==0?s.content=i:s.content=l,s.markup=l,s.info="escape"}return t.pos=n+1,!0}function $x(t,r){let n=t.pos;if(t.src.charCodeAt(n)!==96)return!1;const a=n;n++;const i=t.posMax;for(;n<i&&t.src.charCodeAt(n)===96;)n++;const l=t.src.slice(a,n),s=l.length;if(t.backticksScanned&&(t.backticks[s]||0)<=a)return r||(t.pending+=l),t.pos+=s,!0;let u=n,h;for(;(h=t.src.indexOf("`",u))!==-1;){for(u=h+1;u<i&&t.src.charCodeAt(u)===96;)u++;const d=u-h;if(d===s){if(!r){const m=t.push("code_inline","code",0);m.markup=l,m.content=t.src.slice(n,h).replace(/\n/g," ").replace(/^ (.+) $/,"$1")}return t.pos=u,!0}t.backticks[d]=h}return t.backticksScanned=!0,r||(t.pending+=l),t.pos+=s,!0}function Ux(t,r){const n=t.pos,o=t.src.charCodeAt(n);if(r||o!==126)return!1;const a=t.scanDelims(t.pos,!0);let i=a.length;const l=String.fromCharCode(o);if(i<2)return!1;let s;i%2&&(s=t.push("text","",0),s.content=l,i--);for(let u=0;u<i;u+=2)s=t.push("text","",0),s.content=l+l,t.delimiters.push({marker:o,length:0,token:t.tokens.length-1,end:-1,open:a.can_open,close:a.can_close});return t.pos+=a.length,!0}function Eu(t,r){let n;const o=[],a=r.length;for(let i=0;i<a;i++){const l=r[i];if(l.marker!==126||l.end===-1)continue;const s=r[l.end];n=t.tokens[l.token],n.type="s_open",n.tag="s",n.nesting=1,n.markup="~~",n.content="",n=t.tokens[s.token],n.type="s_close",n.tag="s",n.nesting=-1,n.markup="~~",n.content="",t.tokens[s.token-1].type==="text"&&t.tokens[s.token-1].content==="~"&&o.push(s.token-1)}for(;o.length;){const i=o.pop();let l=i+1;for(;l<t.tokens.length&&t.tokens[l].type==="s_close";)l++;l--,i!==l&&(n=t.tokens[l],t.tokens[l]=t.tokens[i],t.tokens[i]=n)}}function zx(t){const r=t.tokens_meta,n=t.tokens_meta.length;Eu(t,t.delimiters);for(let o=0;o<n;o++)r[o]&&r[o].delimiters&&Eu(t,r[o].delimiters)}const ku={tokenize:Ux,postProcess:zx};function jx(t,r){const n=t.pos,o=t.src.charCodeAt(n);if(r||o!==95&&o!==42)return!1;const a=t.scanDelims(t.pos,o===42);for(let i=0;i<a.length;i++){const l=t.push("text","",0);l.content=String.fromCharCode(o),t.delimiters.push({marker:o,length:a.length,token:t.tokens.length-1,end:-1,open:a.can_open,close:a.can_close})}return t.pos+=a.length,!0}function vu(t,r){const n=r.length;for(let o=n-1;o>=0;o--){const a=r[o];if(a.marker!==95&&a.marker!==42||a.end===-1)continue;const i=r[a.end],l=o>0&&r[o-1].end===a.end+1&&r[o-1].marker===a.marker&&r[o-1].token===a.token-1&&r[a.end+1].token===i.token+1,s=String.fromCharCode(a.marker),u=t.tokens[a.token];u.type=l?"strong_open":"em_open",u.tag=l?"strong":"em",u.nesting=1,u.markup=l?s+s:s,u.content="";const h=t.tokens[i.token];h.type=l?"strong_close":"em_close",h.tag=l?"strong":"em",h.nesting=-1,h.markup=l?s+s:s,h.content="",l&&(t.tokens[r[o-1].token].content="",t.tokens[r[a.end+1].token].content="",o--)}}function Hx(t){const r=t.tokens_meta,n=t.tokens_meta.length;vu(t,t.delimiters);for(let o=0;o<n;o++)r[o]&&r[o].delimiters&&vu(t,r[o].delimiters)}const Au={tokenize:jx,postProcess:Hx};function Gx(t,r){let n,o,a,i,l="",s="",u=t.pos,h=!0;if(t.src.charCodeAt(t.pos)!==91)return!1;const d=t.pos,m=t.posMax,c=t.pos+1,y=t.md.helpers.parseLinkLabel(t,t.pos,!0);if(y<0)return!1;let f=y+1;if(f<m&&t.src.charCodeAt(f)===40){for(h=!1,f++;f<m&&(n=t.src.charCodeAt(f),!(!je(n)&&n!==10));f++);if(f>=m)return!1;if(u=f,a=t.md.helpers.parseLinkDestination(t.src,f,t.posMax),a.ok){for(l=t.md.normalizeLink(a.str),t.md.validateLink(l)?f=a.pos:l="",u=f;f<m&&(n=t.src.charCodeAt(f),!(!je(n)&&n!==10));f++);if(a=t.md.helpers.parseLinkTitle(t.src,f,t.posMax),f<m&&u!==f&&a.ok)for(s=a.str,f=a.pos;f<m&&(n=t.src.charCodeAt(f),!(!je(n)&&n!==10));f++);}(f>=m||t.src.charCodeAt(f)!==41)&&(h=!0),f++}if(h){if(typeof t.env.references>"u")return!1;if(f<m&&t.src.charCodeAt(f)===91?(u=f+1,f=t.md.helpers.parseLinkLabel(t,f),f>=0?o=t.src.slice(u,f++):f=y+1):f=y+1,o||(o=t.src.slice(c,y)),i=t.env.references[Or(o)],!i)return t.pos=d,!1;l=i.href,s=i.title}if(!r){t.pos=c,t.posMax=y;const b=t.push("link_open","a",1),p=[["href",l]];b.attrs=p,s&&p.push(["title",s]),t.linkLevel++,t.md.inline.tokenize(t),t.linkLevel--,t.push("link_close","a",-1)}return t.pos=f,t.posMax=m,!0}function Kx(t,r){let n,o,a,i,l,s,u,h,d="";const m=t.pos,c=t.posMax;if(t.src.charCodeAt(t.pos)!==33||t.src.charCodeAt(t.pos+1)!==91)return!1;const y=t.pos+2,f=t.md.helpers.parseLinkLabel(t,t.pos+1,!1);if(f<0)return!1;if(i=f+1,i<c&&t.src.charCodeAt(i)===40){for(i++;i<c&&(n=t.src.charCodeAt(i),!(!je(n)&&n!==10));i++);if(i>=c)return!1;for(h=i,s=t.md.helpers.parseLinkDestination(t.src,i,t.posMax),s.ok&&(d=t.md.normalizeLink(s.str),t.md.validateLink(d)?i=s.pos:d=""),h=i;i<c&&(n=t.src.charCodeAt(i),!(!je(n)&&n!==10));i++);if(s=t.md.helpers.parseLinkTitle(t.src,i,t.posMax),i<c&&h!==i&&s.ok)for(u=s.str,i=s.pos;i<c&&(n=t.src.charCodeAt(i),!(!je(n)&&n!==10));i++);else u="";if(i>=c||t.src.charCodeAt(i)!==41)return t.pos=m,!1;i++}else{if(typeof t.env.references>"u")return!1;if(i<c&&t.src.charCodeAt(i)===91?(h=i+1,i=t.md.helpers.parseLinkLabel(t,i),i>=0?a=t.src.slice(h,i++):i=f+1):i=f+1,a||(a=t.src.slice(y,f)),l=t.env.references[Or(a)],!l)return t.pos=m,!1;d=l.href,u=l.title}if(!r){o=t.src.slice(y,f);const b=[];t.md.inline.parse(o,t.md,t.env,b);const p=t.push("image","img",0),x=[["src",d],["alt",""]];p.attrs=x,p.children=b,p.content=o,u&&x.push(["title",u])}return t.pos=i,t.posMax=c,!0}const Xx=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,Wx=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function Qx(t,r){let n=t.pos;if(t.src.charCodeAt(n)!==60)return!1;const o=t.pos,a=t.posMax;for(;;){if(++n>=a)return!1;const l=t.src.charCodeAt(n);if(l===60)return!1;if(l===62)break}const i=t.src.slice(o+1,n);if(Wx.test(i)){const l=t.md.normalizeLink(i);if(!t.md.validateLink(l))return!1;if(!r){const s=t.push("link_open","a",1);s.attrs=[["href",l]],s.markup="autolink",s.info="auto";const u=t.push("text","",0);u.content=t.md.normalizeLinkText(i);const h=t.push("link_close","a",-1);h.markup="autolink",h.info="auto"}return t.pos+=i.length+2,!0}if(Xx.test(i)){const l=t.md.normalizeLink("mailto:"+i);if(!t.md.validateLink(l))return!1;if(!r){const s=t.push("link_open","a",1);s.attrs=[["href",l]],s.markup="autolink",s.info="auto";const u=t.push("text","",0);u.content=t.md.normalizeLinkText(i);const h=t.push("link_close","a",-1);h.markup="autolink",h.info="auto"}return t.pos+=i.length+2,!0}return!1}function Zx(t){return/^<a[>\s]/i.test(t)}function Jx(t){return/^<\/a\s*>/i.test(t)}function Yx(t){const r=t|32;return r>=97&&r<=122}function e_(t,r){if(!t.md.options.html)return!1;const n=t.posMax,o=t.pos;if(t.src.charCodeAt(o)!==60||o+2>=n)return!1;const a=t.src.charCodeAt(o+1);if(a!==33&&a!==63&&a!==47&&!Yx(a))return!1;const i=t.src.slice(o).match(Bx);if(!i)return!1;if(!r){const l=t.push("html_inline","",0);l.content=i[0],Zx(l.content)&&t.linkLevel++,Jx(l.content)&&t.linkLevel--}return t.pos+=i[0].length,!0}const t_=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,n_=/^&([a-z][a-z0-9]{1,31});/i;function o_(t,r){const n=t.pos,o=t.posMax;if(t.src.charCodeAt(n)!==38||n+1>=o)return!1;if(t.src.charCodeAt(n+1)===35){const i=t.src.slice(n).match(t_);if(i){if(!r){const l=i[1][0].toLowerCase()==="x"?parseInt(i[1].slice(1),16):parseInt(i[1],10),s=t.push("text_special","",0);s.content=Ti(l)?Tr(l):Tr(65533),s.markup=i[0],s.info="entity"}return t.pos+=i[0].length,!0}}else{const i=t.src.slice(n).match(n_);if(i){const l=uu(i[0]);if(l!==i[0]){if(!r){const s=t.push("text_special","",0);s.content=l,s.markup=i[0],s.info="entity"}return t.pos+=i[0].length,!0}}}return!1}function wu(t){const r={},n=t.length;if(!n)return;let o=0,a=-2;const i=[];for(let l=0;l<n;l++){const s=t[l];if(i.push(0),(t[o].marker!==s.marker||a!==s.token-1)&&(o=l),a=s.token,s.length=s.length||0,!s.close)continue;r.hasOwnProperty(s.marker)||(r[s.marker]=[-1,-1,-1,-1,-1,-1]);const u=r[s.marker][(s.open?3:0)+s.length%3];let h=o-i[o]-1,d=h;for(;h>u;h-=i[h]+1){const m=t[h];if(m.marker===s.marker&&m.open&&m.end<0){let c=!1;if((m.close||s.open)&&(m.length+s.length)%3===0&&(m.length%3!==0||s.length%3!==0)&&(c=!0),!c){const y=h>0&&!t[h-1].open?i[h-1]+1:0;i[l]=l-h+y,i[h]=y,s.open=!1,m.end=l,m.close=!1,d=-1,a=-2;break}}}d!==-1&&(r[s.marker][(s.open?3:0)+(s.length||0)%3]=d)}}function r_(t){const r=t.tokens_meta,n=t.tokens_meta.length;wu(t.delimiters);for(let o=0;o<n;o++)r[o]&&r[o].delimiters&&wu(r[o].delimiters)}function a_(t){let r,n,o=0;const a=t.tokens,i=t.tokens.length;for(r=n=0;r<i;r++)a[r].nesting<0&&o--,a[r].level=o,a[r].nesting>0&&o++,a[r].type==="text"&&r+1<i&&a[r+1].type==="text"?a[r+1].content=a[r].content+a[r+1].content:(r!==n&&(a[n]=a[r]),n++);r!==n&&(a.length=n)}const Mi=[["text",Mx],["linkify",Lx],["newline",Px],["escape",qx],["backticks",$x],["strikethrough",ku.tokenize],["emphasis",Au.tokenize],["link",Gx],["image",Kx],["autolink",Qx],["html_inline",e_],["entity",o_]],Ri=[["balance_pairs",r_],["strikethrough",ku.postProcess],["emphasis",Au.postProcess],["fragments_join",a_]];function Vo(){this.ruler=new Ot;for(let t=0;t<Mi.length;t++)this.ruler.push(Mi[t][0],Mi[t][1]);this.ruler2=new Ot;for(let t=0;t<Ri.length;t++)this.ruler2.push(Ri[t][0],Ri[t][1])}Vo.prototype.skipToken=function(t){const r=t.pos,n=this.ruler.getRules(""),o=n.length,a=t.md.options.maxNesting,i=t.cache;if(typeof i[r]<"u"){t.pos=i[r];return}let l=!1;if(t.level<a){for(let s=0;s<o;s++)if(t.level++,l=n[s](t,!0),t.level--,l){if(r>=t.pos)throw new Error("inline rule didn't increment state.pos");break}}else t.pos=t.posMax;l||t.pos++,i[r]=t.pos},Vo.prototype.tokenize=function(t){const r=this.ruler.getRules(""),n=r.length,o=t.posMax,a=t.md.options.maxNesting;for(;t.pos<o;){const i=t.pos;let l=!1;if(t.level<a){for(let s=0;s<n;s++)if(l=r[s](t,!1),l){if(i>=t.pos)throw new Error("inline rule didn't increment state.pos");break}}if(l){if(t.pos>=o)break;continue}t.pending+=t.src[t.pos++]}t.pending&&t.pushPending()},Vo.prototype.parse=function(t,r,n,o){const a=new this.State(t,r,n,o);this.tokenize(a);const i=this.ruler2.getRules(""),l=i.length;for(let s=0;s<l;s++)i[s](a)},Vo.prototype.State=Do;function i_(t){const r={};t=t||{},r.src_Any=au.source,r.src_Cc=iu.source,r.src_Z=su.source,r.src_P=Ni.source,r.src_ZPCc=[r.src_Z,r.src_P,r.src_Cc].join("|"),r.src_ZCc=[r.src_Z,r.src_Cc].join("|");const n="[><|]";return r.src_pseudo_letter="(?:(?!"+n+"|"+r.src_ZPCc+")"+r.src_Any+")",r.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",r.src_auth="(?:(?:(?!"+r.src_ZCc+"|[@/\\[\\]()]).)+@)?",r.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",r.src_host_terminator="(?=$|"+n+"|"+r.src_ZPCc+")(?!"+(t["---"]?"-(?!--)|":"-|")+"_|:\\d|\\.-|\\.(?!$|"+r.src_ZPCc+"))",r.src_path="(?:[/?#](?:(?!"+r.src_ZCc+"|"+n+`|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!`+r.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+r.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+r.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+r.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+r.src_ZCc+"|[']).)+\\'|\\'(?="+r.src_pseudo_letter+"|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!"+r.src_ZCc+"|[.]|$)|"+(t["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+",(?!"+r.src_ZCc+"|$)|;(?!"+r.src_ZCc+"|$)|\\!+(?!"+r.src_ZCc+"|[!]|$)|\\?(?!"+r.src_ZCc+"|[?]|$))+|\\/)?",r.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',r.src_xn="xn--[a-z0-9\\-]{1,59}",r.src_domain_root="(?:"+r.src_xn+"|"+r.src_pseudo_letter+"{1,63})",r.src_domain="(?:"+r.src_xn+"|(?:"+r.src_pseudo_letter+")|(?:"+r.src_pseudo_letter+"(?:-|"+r.src_pseudo_letter+"){0,61}"+r.src_pseudo_letter+"))",r.src_host="(?:(?:(?:(?:"+r.src_domain+")\\.)*"+r.src_domain+"))",r.tpl_host_fuzzy="(?:"+r.src_ip4+"|(?:(?:(?:"+r.src_domain+")\\.)+(?:%TLDS%)))",r.tpl_host_no_ip_fuzzy="(?:(?:(?:"+r.src_domain+")\\.)+(?:%TLDS%))",r.src_host_strict=r.src_host+r.src_host_terminator,r.tpl_host_fuzzy_strict=r.tpl_host_fuzzy+r.src_host_terminator,r.src_host_port_strict=r.src_host+r.src_port+r.src_host_terminator,r.tpl_host_port_fuzzy_strict=r.tpl_host_fuzzy+r.src_port+r.src_host_terminator,r.tpl_host_port_no_ip_fuzzy_strict=r.tpl_host_no_ip_fuzzy+r.src_port+r.src_host_terminator,r.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+r.src_ZPCc+"|>|$))",r.tpl_email_fuzzy="(^|"+n+'|"|\\(|'+r.src_ZCc+")("+r.src_email_name+"@"+r.tpl_host_fuzzy_strict+")",r.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+r.src_ZPCc+"))((?![$+<=>^`||])"+r.tpl_host_port_fuzzy_strict+r.src_path+")",r.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+r.src_ZPCc+"))((?![$+<=>^`||])"+r.tpl_host_port_no_ip_fuzzy_strict+r.src_path+")",r}function Li(t){return Array.prototype.slice.call(arguments,1).forEach(function(n){n&&Object.keys(n).forEach(function(o){t[o]=n[o]})}),t}function Mr(t){return Object.prototype.toString.call(t)}function l_(t){return Mr(t)==="[object String]"}function s_(t){return Mr(t)==="[object Object]"}function c_(t){return Mr(t)==="[object RegExp]"}function Nu(t){return Mr(t)==="[object Function]"}function u_(t){return t.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}const Su={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function d_(t){return Object.keys(t||{}).reduce(function(r,n){return r||Su.hasOwnProperty(n)},!1)}const f_={"http:":{validate:function(t,r,n){const o=t.slice(r);return n.re.http||(n.re.http=new RegExp("^\\/\\/"+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,"i")),n.re.http.test(o)?o.match(n.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(t,r,n){const o=t.slice(r);return n.re.no_http||(n.re.no_http=new RegExp("^"+n.re.src_auth+"(?:localhost|(?:(?:"+n.re.src_domain+")\\.)+"+n.re.src_domain_root+")"+n.re.src_port+n.re.src_host_terminator+n.re.src_path,"i")),n.re.no_http.test(o)?r>=3&&t[r-3]===":"||r>=3&&t[r-3]==="/"?0:o.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(t,r,n){const o=t.slice(r);return n.re.mailto||(n.re.mailto=new RegExp("^"+n.re.src_email_name+"@"+n.re.src_host_strict,"i")),n.re.mailto.test(o)?o.match(n.re.mailto)[0].length:0}}},h_="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",p_="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function m_(t){t.__index__=-1,t.__text_cache__=""}function y_(t){return function(r,n){const o=r.slice(n);return t.test(o)?o.match(t)[0].length:0}}function Bu(){return function(t,r){r.normalize(t)}}function Rr(t){const r=t.re=i_(t.__opts__),n=t.__tlds__.slice();t.onCompile(),t.__tlds_replaced__||n.push(h_),n.push(r.src_xn),r.src_tlds=n.join("|");function o(s){return s.replace("%TLDS%",r.src_tlds)}r.email_fuzzy=RegExp(o(r.tpl_email_fuzzy),"i"),r.link_fuzzy=RegExp(o(r.tpl_link_fuzzy),"i"),r.link_no_ip_fuzzy=RegExp(o(r.tpl_link_no_ip_fuzzy),"i"),r.host_fuzzy_test=RegExp(o(r.tpl_host_fuzzy_test),"i");const a=[];t.__compiled__={};function i(s,u){throw new Error('(LinkifyIt) Invalid schema "'+s+'": '+u)}Object.keys(t.__schemas__).forEach(function(s){const u=t.__schemas__[s];if(u===null)return;const h={validate:null,link:null};if(t.__compiled__[s]=h,s_(u)){c_(u.validate)?h.validate=y_(u.validate):Nu(u.validate)?h.validate=u.validate:i(s,u),Nu(u.normalize)?h.normalize=u.normalize:u.normalize?i(s,u):h.normalize=Bu();return}if(l_(u)){a.push(s);return}i(s,u)}),a.forEach(function(s){t.__compiled__[t.__schemas__[s]]&&(t.__compiled__[s].validate=t.__compiled__[t.__schemas__[s]].validate,t.__compiled__[s].normalize=t.__compiled__[t.__schemas__[s]].normalize)}),t.__compiled__[""]={validate:null,normalize:Bu()};const l=Object.keys(t.__compiled__).filter(function(s){return s.length>0&&t.__compiled__[s]}).map(u_).join("|");t.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+r.src_ZPCc+"))("+l+")","i"),t.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+r.src_ZPCc+"))("+l+")","ig"),t.re.schema_at_start=RegExp("^"+t.re.schema_search.source,"i"),t.re.pretest=RegExp("("+t.re.schema_test.source+")|("+t.re.host_fuzzy_test.source+")|@","i"),m_(t)}function g_(t,r){const n=t.__index__,o=t.__last_index__,a=t.__text_cache__.slice(n,o);this.schema=t.__schema__.toLowerCase(),this.index=n+r,this.lastIndex=o+r,this.raw=a,this.text=a,this.url=a}function Pi(t,r){const n=new g_(t,r);return t.__compiled__[n.schema].normalize(n,t),n}function Pt(t,r){if(!(this instanceof Pt))return new Pt(t,r);r||d_(t)&&(r=t,t={}),this.__opts__=Li({},Su,r),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=Li({},f_,t),this.__compiled__={},this.__tlds__=p_,this.__tlds_replaced__=!1,this.re={},Rr(this)}Pt.prototype.add=function(r,n){return this.__schemas__[r]=n,Rr(this),this},Pt.prototype.set=function(r){return this.__opts__=Li(this.__opts__,r),this},Pt.prototype.test=function(r){if(this.__text_cache__=r,this.__index__=-1,!r.length)return!1;let n,o,a,i,l,s,u,h,d;if(this.re.schema_test.test(r)){for(u=this.re.schema_search,u.lastIndex=0;(n=u.exec(r))!==null;)if(i=this.testSchemaAt(r,n[2],u.lastIndex),i){this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+i;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(h=r.search(this.re.host_fuzzy_test),h>=0&&(this.__index__<0||h<this.__index__)&&(o=r.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(l=o.index+o[1].length,(this.__index__<0||l<this.__index__)&&(this.__schema__="",this.__index__=l,this.__last_index__=o.index+o[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&(d=r.indexOf("@"),d>=0&&(a=r.match(this.re.email_fuzzy))!==null&&(l=a.index+a[1].length,s=a.index+a[0].length,(this.__index__<0||l<this.__index__||l===this.__index__&&s>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=l,this.__last_index__=s))),this.__index__>=0},Pt.prototype.pretest=function(r){return this.re.pretest.test(r)},Pt.prototype.testSchemaAt=function(r,n,o){return this.__compiled__[n.toLowerCase()]?this.__compiled__[n.toLowerCase()].validate(r,o,this):0},Pt.prototype.match=function(r){const n=[];let o=0;this.__index__>=0&&this.__text_cache__===r&&(n.push(Pi(this,o)),o=this.__last_index__);let a=o?r.slice(o):r;for(;this.test(a);)n.push(Pi(this,o)),a=a.slice(this.__last_index__),o+=this.__last_index__;return n.length?n:null},Pt.prototype.matchAtStart=function(r){if(this.__text_cache__=r,this.__index__=-1,!r.length)return null;const n=this.re.schema_at_start.exec(r);if(!n)return null;const o=this.testSchemaAt(r,n[2],n[0].length);return o?(this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+o,Pi(this,0)):null},Pt.prototype.tlds=function(r,n){return r=Array.isArray(r)?r:[r],n?(this.__tlds__=this.__tlds__.concat(r).sort().filter(function(o,a,i){return o!==i[a-1]}).reverse(),Rr(this),this):(this.__tlds__=r.slice(),this.__tlds_replaced__=!0,Rr(this),this)},Pt.prototype.normalize=function(r){r.schema||(r.url="http://"+r.url),r.schema==="mailto:"&&!/^mailto:/i.test(r.url)&&(r.url="mailto:"+r.url)},Pt.prototype.onCompile=function(){};const oo=2147483647,un=36,qi=1,Fo=26,b_=38,x_=700,Iu=72,Tu=128,Ou="-",__=/^xn--/,C_=/[^\0-\x7F]/,E_=/[\x2E\u3002\uFF0E\uFF61]/g,k_={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},$i=un-qi,dn=Math.floor,Ui=String.fromCharCode;function Tn(t){throw new RangeError(k_[t])}function v_(t,r){const n=[];let o=t.length;for(;o--;)n[o]=r(t[o]);return n}function Du(t,r){const n=t.split("@");let o="";n.length>1&&(o=n[0]+"@",t=n[1]),t=t.replace(E_,".");const a=t.split("."),i=v_(a,r).join(".");return o+i}function Vu(t){const r=[];let n=0;const o=t.length;for(;n<o;){const a=t.charCodeAt(n++);if(a>=55296&&a<=56319&&n<o){const i=t.charCodeAt(n++);(i&64512)==56320?r.push(((a&1023)<<10)+(i&1023)+65536):(r.push(a),n--)}else r.push(a)}return r}const A_=t=>String.fromCodePoint(...t),w_=function(t){return t>=48&&t<58?26+(t-48):t>=65&&t<91?t-65:t>=97&&t<123?t-97:un},Fu=function(t,r){return t+22+75*(t<26)-((r!=0)<<5)},Mu=function(t,r,n){let o=0;for(t=n?dn(t/x_):t>>1,t+=dn(t/r);t>$i*Fo>>1;o+=un)t=dn(t/$i);return dn(o+($i+1)*t/(t+b_))},Ru=function(t){const r=[],n=t.length;let o=0,a=Tu,i=Iu,l=t.lastIndexOf(Ou);l<0&&(l=0);for(let s=0;s<l;++s)t.charCodeAt(s)>=128&&Tn("not-basic"),r.push(t.charCodeAt(s));for(let s=l>0?l+1:0;s<n;){const u=o;for(let d=1,m=un;;m+=un){s>=n&&Tn("invalid-input");const c=w_(t.charCodeAt(s++));c>=un&&Tn("invalid-input"),c>dn((oo-o)/d)&&Tn("overflow"),o+=c*d;const y=m<=i?qi:m>=i+Fo?Fo:m-i;if(c<y)break;const f=un-y;d>dn(oo/f)&&Tn("overflow"),d*=f}const h=r.length+1;i=Mu(o-u,h,u==0),dn(o/h)>oo-a&&Tn("overflow"),a+=dn(o/h),o%=h,r.splice(o++,0,a)}return String.fromCodePoint(...r)},Lu=function(t){const r=[];t=Vu(t);const n=t.length;let o=Tu,a=0,i=Iu;for(const u of t)u<128&&r.push(Ui(u));const l=r.length;let s=l;for(l&&r.push(Ou);s<n;){let u=oo;for(const d of t)d>=o&&d<u&&(u=d);const h=s+1;u-o>dn((oo-a)/h)&&Tn("overflow"),a+=(u-o)*h,o=u;for(const d of t)if(d<o&&++a>oo&&Tn("overflow"),d===o){let m=a;for(let c=un;;c+=un){const y=c<=i?qi:c>=i+Fo?Fo:c-i;if(m<y)break;const f=m-y,b=un-y;r.push(Ui(Fu(y+f%b,0))),m=dn(f/b)}r.push(Ui(Fu(m,0))),i=Mu(a,h,s===l),a=0,++s}++a,++o}return r.join("")},Pu={version:"2.3.1",ucs2:{decode:Vu,encode:A_},decode:Ru,encode:Lu,toASCII:function(t){return Du(t,function(r){return C_.test(r)?"xn--"+Lu(r):r})},toUnicode:function(t){return Du(t,function(r){return __.test(r)?Ru(r.slice(4).toLowerCase()):r})}},N_={default:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},zero:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","fragments_join"]}}},commonmark:{options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","fragments_join"]}}}},S_=/^(vbscript|javascript|file|data):/,B_=/^data:image\/(gif|png|jpeg|webp);/;function I_(t){const r=t.trim().toLowerCase();return S_.test(r)?B_.test(r):!0}const qu=["http:","https:","mailto:"];function T_(t){const r=wi(t,!0);if(r.hostname&&(!r.protocol||qu.indexOf(r.protocol)>=0))try{r.hostname=Pu.toASCII(r.hostname)}catch{}return Bo(Ai(r))}function O_(t){const r=wi(t,!0);if(r.hostname&&(!r.protocol||qu.indexOf(r.protocol)>=0))try{r.hostname=Pu.toUnicode(r.hostname)}catch{}return Yn(Ai(r),Yn.defaultChars+"%")}function jt(t,r){if(!(this instanceof jt))return new jt(t,r);r||Ii(t)||(r=t||{},t="default"),this.inline=new Vo,this.block=new Fr,this.core=new Di,this.renderer=new to,this.linkify=new Pt,this.validateLink=I_,this.normalizeLink=T_,this.normalizeLinkText=O_,this.utils=zb,this.helpers=Ir({},Kb),this.options={},this.configure(t),r&&this.set(r)}jt.prototype.set=function(t){return Ir(this.options,t),this},jt.prototype.configure=function(t){const r=this;if(Ii(t)){const n=t;if(t=N_[n],!t)throw new Error('Wrong `markdown-it` preset "'+n+'", check name')}if(!t)throw new Error("Wrong `markdown-it` preset, can't be empty");return t.options&&r.set(t.options),t.components&&Object.keys(t.components).forEach(function(n){t.components[n].rules&&r[n].ruler.enableOnly(t.components[n].rules),t.components[n].rules2&&r[n].ruler2.enableOnly(t.components[n].rules2)}),this},jt.prototype.enable=function(t,r){let n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(a){n=n.concat(this[a].ruler.enable(t,!0))},this),n=n.concat(this.inline.ruler2.enable(t,!0));const o=t.filter(function(a){return n.indexOf(a)<0});if(o.length&&!r)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+o);return this},jt.prototype.disable=function(t,r){let n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(a){n=n.concat(this[a].ruler.disable(t,!0))},this),n=n.concat(this.inline.ruler2.disable(t,!0));const o=t.filter(function(a){return n.indexOf(a)<0});if(o.length&&!r)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+o);return this},jt.prototype.use=function(t){const r=[this].concat(Array.prototype.slice.call(arguments,1));return t.apply(t,r),this},jt.prototype.parse=function(t,r){if(typeof t!="string")throw new Error("Input data should be a String");const n=new this.core.State(t,this,r);return this.core.process(n),n.tokens},jt.prototype.render=function(t,r){return r=r||{},this.renderer.render(this.parse(t,r),this.options,r)},jt.prototype.parseInline=function(t,r){const n=new this.core.State(t,this,r);return n.inlineMode=!0,this.core.process(n),n.tokens},jt.prototype.renderInline=function(t,r){return r=r||{},this.renderer.render(this.parseInline(t,r),this.options,r)};/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:$u,setPrototypeOf:Uu,isFrozen:D_,getPrototypeOf:V_,getOwnPropertyDescriptor:F_}=Object;let{freeze:kt,seal:Ht,create:zu}=Object,{apply:zi,construct:ji}=typeof Reflect<"u"&&Reflect;kt||(kt=function(r){return r}),Ht||(Ht=function(r){return r}),zi||(zi=function(r,n,o){return r.apply(n,o)}),ji||(ji=function(r,n){return new r(...n)});const Lr=At(Array.prototype.forEach),M_=At(Array.prototype.lastIndexOf),ju=At(Array.prototype.pop),Mo=At(Array.prototype.push),R_=At(Array.prototype.splice),Pr=At(String.prototype.toLowerCase),Hi=At(String.prototype.toString),Hu=At(String.prototype.match),Ro=At(String.prototype.replace),L_=At(String.prototype.indexOf),P_=At(String.prototype.trim),Jt=At(Object.prototype.hasOwnProperty),vt=At(RegExp.prototype.test),Lo=q_(TypeError);function At(t){return function(r){r instanceof RegExp&&(r.lastIndex=0);for(var n=arguments.length,o=new Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];return zi(t,r,o)}}function q_(t){return function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return ji(t,n)}}function Fe(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Pr;Uu&&Uu(t,null);let o=r.length;for(;o--;){let a=r[o];if(typeof a=="string"){const i=n(a);i!==a&&(D_(r)||(r[o]=i),a=i)}t[a]=!0}return t}function $_(t){for(let r=0;r<t.length;r++)Jt(t,r)||(t[r]=null);return t}function gn(t){const r=zu(null);for(const[n,o]of $u(t))Jt(t,n)&&(Array.isArray(o)?r[n]=$_(o):o&&typeof o=="object"&&o.constructor===Object?r[n]=gn(o):r[n]=o);return r}function Po(t,r){for(;t!==null;){const o=F_(t,r);if(o){if(o.get)return At(o.get);if(typeof o.value=="function")return At(o.value)}t=V_(t)}function n(){return null}return n}const Gu=kt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Gi=kt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ki=kt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),U_=kt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Xi=kt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),z_=kt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ku=kt(["#text"]),Xu=kt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Wi=kt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Wu=kt(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),qr=kt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),j_=Ht(/\{\{[\w\W]*|[\w\W]*\}\}/gm),H_=Ht(/<%[\w\W]*|[\w\W]*%>/gm),G_=Ht(/\$\{[\w\W]*/gm),K_=Ht(/^data-[\-\w.\u00B7-\uFFFF]+$/),X_=Ht(/^aria-[\-\w]+$/),Qu=Ht(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),W_=Ht(/^(?:\w+script|data):/i),Q_=Ht(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Zu=Ht(/^html$/i),Z_=Ht(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ju=Object.freeze({__proto__:null,ARIA_ATTR:X_,ATTR_WHITESPACE:Q_,CUSTOM_ELEMENT:Z_,DATA_ATTR:K_,DOCTYPE_NAME:Zu,ERB_EXPR:H_,IS_ALLOWED_URI:Qu,IS_SCRIPT_OR_DATA:W_,MUSTACHE_EXPR:j_,TMPLIT_EXPR:G_});const qo={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},J_=function(){return typeof window>"u"?null:window},Y_=function(r,n){if(typeof r!="object"||typeof r.createPolicy!="function")return null;let o=null;const a="data-tt-policy-suffix";n&&n.hasAttribute(a)&&(o=n.getAttribute(a));const i="dompurify"+(o?"#"+o:"");try{return r.createPolicy(i,{createHTML(l){return l},createScriptURL(l){return l}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Yu=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function e0(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:J_();const r=Ae=>e0(Ae);if(r.version="3.2.6",r.removed=[],!t||!t.document||t.document.nodeType!==qo.document||!t.Element)return r.isSupported=!1,r;let{document:n}=t;const o=n,a=o.currentScript,{DocumentFragment:i,HTMLTemplateElement:l,Node:s,Element:u,NodeFilter:h,NamedNodeMap:d=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:m,DOMParser:c,trustedTypes:y}=t,f=u.prototype,b=Po(f,"cloneNode"),p=Po(f,"remove"),x=Po(f,"nextSibling"),g=Po(f,"childNodes"),C=Po(f,"parentNode");if(typeof l=="function"){const Ae=n.createElement("template");Ae.content&&Ae.content.ownerDocument&&(n=Ae.content.ownerDocument)}let _,E="";const{implementation:A,createNodeIterator:k,createDocumentFragment:B,getElementsByTagName:D}=n,{importNode:w}=o;let v=Yu();r.isSupported=typeof $u=="function"&&typeof C=="function"&&A&&A.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:S,ERB_EXPR:I,TMPLIT_EXPR:R,DATA_ATTR:z,ARIA_ATTR:$,IS_SCRIPT_OR_DATA:X,ATTR_WHITESPACE:W,CUSTOM_ELEMENT:K}=Ju;let{IS_ALLOWED_URI:P}=Ju,N=null;const T=Fe({},[...Gu,...Gi,...Ki,...Xi,...Ku]);let O=null;const F=Fe({},[...Xu,...Wi,...Wu,...qr]);let q=Object.seal(zu(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),M=null,U=null,L=!0,j=!0,H=!1,Z=!0,te=!1,ne=!0,Q=!1,ce=!1,ue=!1,pe=!1,ie=!1,de=!1,_e=!0,xe=!1;const ye="user-content-";let oe=!0,le=!1,be={},Ce=null;const J=Fe({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let se=null;const fe=Fe({},["audio","video","img","source","image","track"]);let Y=null;const re=Fe({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),me="http://www.w3.org/1998/Math/MathML",Se="http://www.w3.org/2000/svg",De="http://www.w3.org/1999/xhtml";let Oe=De,He=!1,Ve=null;const Ge=Fe({},[me,Se,De],Hi);let qe=Fe({},["mi","mo","mn","ms","mtext"]),Ke=Fe({},["annotation-xml"]);const nt=Fe({},["title","style","font","a","script"]);let mt=null;const bn=["application/xhtml+xml","text/html"],Yt="text/html";let Xe=null,wt=null;const xn=n.createElement("form"),qt=function(ae){return ae instanceof RegExp||ae instanceof Function},en=function(){let ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(wt&&wt===ae)){if((!ae||typeof ae!="object")&&(ae={}),ae=gn(ae),mt=bn.indexOf(ae.PARSER_MEDIA_TYPE)===-1?Yt:ae.PARSER_MEDIA_TYPE,Xe=mt==="application/xhtml+xml"?Hi:Pr,N=Jt(ae,"ALLOWED_TAGS")?Fe({},ae.ALLOWED_TAGS,Xe):T,O=Jt(ae,"ALLOWED_ATTR")?Fe({},ae.ALLOWED_ATTR,Xe):F,Ve=Jt(ae,"ALLOWED_NAMESPACES")?Fe({},ae.ALLOWED_NAMESPACES,Hi):Ge,Y=Jt(ae,"ADD_URI_SAFE_ATTR")?Fe(gn(re),ae.ADD_URI_SAFE_ATTR,Xe):re,se=Jt(ae,"ADD_DATA_URI_TAGS")?Fe(gn(fe),ae.ADD_DATA_URI_TAGS,Xe):fe,Ce=Jt(ae,"FORBID_CONTENTS")?Fe({},ae.FORBID_CONTENTS,Xe):J,M=Jt(ae,"FORBID_TAGS")?Fe({},ae.FORBID_TAGS,Xe):gn({}),U=Jt(ae,"FORBID_ATTR")?Fe({},ae.FORBID_ATTR,Xe):gn({}),be=Jt(ae,"USE_PROFILES")?ae.USE_PROFILES:!1,L=ae.ALLOW_ARIA_ATTR!==!1,j=ae.ALLOW_DATA_ATTR!==!1,H=ae.ALLOW_UNKNOWN_PROTOCOLS||!1,Z=ae.ALLOW_SELF_CLOSE_IN_ATTR!==!1,te=ae.SAFE_FOR_TEMPLATES||!1,ne=ae.SAFE_FOR_XML!==!1,Q=ae.WHOLE_DOCUMENT||!1,pe=ae.RETURN_DOM||!1,ie=ae.RETURN_DOM_FRAGMENT||!1,de=ae.RETURN_TRUSTED_TYPE||!1,ue=ae.FORCE_BODY||!1,_e=ae.SANITIZE_DOM!==!1,xe=ae.SANITIZE_NAMED_PROPS||!1,oe=ae.KEEP_CONTENT!==!1,le=ae.IN_PLACE||!1,P=ae.ALLOWED_URI_REGEXP||Qu,Oe=ae.NAMESPACE||De,qe=ae.MATHML_TEXT_INTEGRATION_POINTS||qe,Ke=ae.HTML_INTEGRATION_POINTS||Ke,q=ae.CUSTOM_ELEMENT_HANDLING||{},ae.CUSTOM_ELEMENT_HANDLING&&qt(ae.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(q.tagNameCheck=ae.CUSTOM_ELEMENT_HANDLING.tagNameCheck),ae.CUSTOM_ELEMENT_HANDLING&&qt(ae.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(q.attributeNameCheck=ae.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),ae.CUSTOM_ELEMENT_HANDLING&&typeof ae.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(q.allowCustomizedBuiltInElements=ae.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),te&&(j=!1),ie&&(pe=!0),be&&(N=Fe({},Ku),O=[],be.html===!0&&(Fe(N,Gu),Fe(O,Xu)),be.svg===!0&&(Fe(N,Gi),Fe(O,Wi),Fe(O,qr)),be.svgFilters===!0&&(Fe(N,Ki),Fe(O,Wi),Fe(O,qr)),be.mathMl===!0&&(Fe(N,Xi),Fe(O,Wu),Fe(O,qr))),ae.ADD_TAGS&&(N===T&&(N=gn(N)),Fe(N,ae.ADD_TAGS,Xe)),ae.ADD_ATTR&&(O===F&&(O=gn(O)),Fe(O,ae.ADD_ATTR,Xe)),ae.ADD_URI_SAFE_ATTR&&Fe(Y,ae.ADD_URI_SAFE_ATTR,Xe),ae.FORBID_CONTENTS&&(Ce===J&&(Ce=gn(Ce)),Fe(Ce,ae.FORBID_CONTENTS,Xe)),oe&&(N["#text"]=!0),Q&&Fe(N,["html","head","body"]),N.table&&(Fe(N,["tbody"]),delete M.tbody),ae.TRUSTED_TYPES_POLICY){if(typeof ae.TRUSTED_TYPES_POLICY.createHTML!="function")throw Lo('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof ae.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Lo('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');_=ae.TRUSTED_TYPES_POLICY,E=_.createHTML("")}else _===void 0&&(_=Y_(y,a)),_!==null&&typeof E=="string"&&(E=_.createHTML(""));kt&&kt(ae),wt=ae}},Dt=Fe({},[...Gi,...Ki,...U_]),_n=Fe({},[...Xi,...z_]),ot=function(ae){let Ee=C(ae);(!Ee||!Ee.tagName)&&(Ee={namespaceURI:Oe,tagName:"template"});const ke=Pr(ae.tagName),ze=Pr(Ee.tagName);return Ve[ae.namespaceURI]?ae.namespaceURI===Se?Ee.namespaceURI===De?ke==="svg":Ee.namespaceURI===me?ke==="svg"&&(ze==="annotation-xml"||qe[ze]):!!Dt[ke]:ae.namespaceURI===me?Ee.namespaceURI===De?ke==="math":Ee.namespaceURI===Se?ke==="math"&&Ke[ze]:!!_n[ke]:ae.namespaceURI===De?Ee.namespaceURI===Se&&!Ke[ze]||Ee.namespaceURI===me&&!qe[ze]?!1:!_n[ke]&&(nt[ke]||!Dt[ke]):!!(mt==="application/xhtml+xml"&&Ve[ae.namespaceURI]):!1},Qe=function(ae){Mo(r.removed,{element:ae});try{C(ae).removeChild(ae)}catch{p(ae)}},Vt=function(ae,Ee){try{Mo(r.removed,{attribute:Ee.getAttributeNode(ae),from:Ee})}catch{Mo(r.removed,{attribute:null,from:Ee})}if(Ee.removeAttribute(ae),ae==="is")if(pe||ie)try{Qe(Ee)}catch{}else try{Ee.setAttribute(ae,"")}catch{}},fn=function(ae){let Ee=null,ke=null;if(ue)ae="<remove></remove>"+ae;else{const Ze=Hu(ae,/^[\r\n\t ]+/);ke=Ze&&Ze[0]}mt==="application/xhtml+xml"&&Oe===De&&(ae='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+ae+"</body></html>");const ze=_?_.createHTML(ae):ae;if(Oe===De)try{Ee=new c().parseFromString(ze,mt)}catch{}if(!Ee||!Ee.documentElement){Ee=A.createDocument(Oe,"template",null);try{Ee.documentElement.innerHTML=He?E:ze}catch{}}const et=Ee.body||Ee.documentElement;return ae&&ke&&et.insertBefore(n.createTextNode(ke),et.childNodes[0]||null),Oe===De?D.call(Ee,Q?"html":"body")[0]:Q?Ee.documentElement:et},Ye=function(ae){return k.call(ae.ownerDocument||ae,ae,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},zn=function(ae){return ae instanceof m&&(typeof ae.nodeName!="string"||typeof ae.textContent!="string"||typeof ae.removeChild!="function"||!(ae.attributes instanceof d)||typeof ae.removeAttribute!="function"||typeof ae.setAttribute!="function"||typeof ae.namespaceURI!="string"||typeof ae.insertBefore!="function"||typeof ae.hasChildNodes!="function")},ro=function(ae){return typeof s=="function"&&ae instanceof s};function $t(Ae,ae,Ee){Lr(Ae,ke=>{ke.call(r,ae,Ee,wt)})}const ao=function(ae){let Ee=null;if($t(v.beforeSanitizeElements,ae,null),zn(ae))return Qe(ae),!0;const ke=Xe(ae.nodeName);if($t(v.uponSanitizeElement,ae,{tagName:ke,allowedTags:N}),ne&&ae.hasChildNodes()&&!ro(ae.firstElementChild)&&vt(/<[/\w!]/g,ae.innerHTML)&&vt(/<[/\w!]/g,ae.textContent)||ae.nodeType===qo.progressingInstruction||ne&&ae.nodeType===qo.comment&&vt(/<[/\w]/g,ae.data))return Qe(ae),!0;if(!N[ke]||M[ke]){if(!M[ke]&&rt(ke)&&(q.tagNameCheck instanceof RegExp&&vt(q.tagNameCheck,ke)||q.tagNameCheck instanceof Function&&q.tagNameCheck(ke)))return!1;if(oe&&!Ce[ke]){const ze=C(ae)||ae.parentNode,et=g(ae)||ae.childNodes;if(et&&ze){const Ze=et.length;for(let ut=Ze-1;ut>=0;--ut){const Ut=b(et[ut],!0);Ut.__removalCount=(ae.__removalCount||0)+1,ze.insertBefore(Ut,x(ae))}}}return Qe(ae),!0}return ae instanceof u&&!ot(ae)||(ke==="noscript"||ke==="noembed"||ke==="noframes")&&vt(/<\/no(script|embed|frames)/i,ae.innerHTML)?(Qe(ae),!0):(te&&ae.nodeType===qo.text&&(Ee=ae.textContent,Lr([S,I,R],ze=>{Ee=Ro(Ee,ze," ")}),ae.textContent!==Ee&&(Mo(r.removed,{element:ae.cloneNode()}),ae.textContent=Ee)),$t(v.afterSanitizeElements,ae,null),!1)},io=function(ae,Ee,ke){if(_e&&(Ee==="id"||Ee==="name")&&(ke in n||ke in xn))return!1;if(!(j&&!U[Ee]&&vt(z,Ee))){if(!(L&&vt($,Ee))){if(!O[Ee]||U[Ee]){if(!(rt(ae)&&(q.tagNameCheck instanceof RegExp&&vt(q.tagNameCheck,ae)||q.tagNameCheck instanceof Function&&q.tagNameCheck(ae))&&(q.attributeNameCheck instanceof RegExp&&vt(q.attributeNameCheck,Ee)||q.attributeNameCheck instanceof Function&&q.attributeNameCheck(Ee))||Ee==="is"&&q.allowCustomizedBuiltInElements&&(q.tagNameCheck instanceof RegExp&&vt(q.tagNameCheck,ke)||q.tagNameCheck instanceof Function&&q.tagNameCheck(ke))))return!1}else if(!Y[Ee]){if(!vt(P,Ro(ke,W,""))){if(!((Ee==="src"||Ee==="xlink:href"||Ee==="href")&&ae!=="script"&&L_(ke,"data:")===0&&se[ae])){if(!(H&&!vt(X,Ro(ke,W,"")))){if(ke)return!1}}}}}}return!0},rt=function(ae){return ae!=="annotation-xml"&&Hu(ae,K)},lo=function(ae){$t(v.beforeSanitizeAttributes,ae,null);const{attributes:Ee}=ae;if(!Ee||zn(ae))return;const ke={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:O,forceKeepAttr:void 0};let ze=Ee.length;for(;ze--;){const et=Ee[ze],{name:Ze,namespaceURI:ut,value:Ut}=et,Gt=Xe(Ze),On=Ut;let Je=Ze==="value"?On:P_(On);if(ke.attrName=Gt,ke.attrValue=Je,ke.keepAttr=!0,ke.forceKeepAttr=void 0,$t(v.uponSanitizeAttribute,ae,ke),Je=ke.attrValue,xe&&(Gt==="id"||Gt==="name")&&(Vt(Ze,ae),Je=ye+Je),ne&&vt(/((--!?|])>)|<\/(style|title)/i,Je)){Vt(Ze,ae);continue}if(ke.forceKeepAttr)continue;if(!ke.keepAttr){Vt(Ze,ae);continue}if(!Z&&vt(/\/>/i,Je)){Vt(Ze,ae);continue}te&&Lr([S,I,R],Dn=>{Je=Ro(Je,Dn," ")});const zt=Xe(ae.nodeName);if(!io(zt,Gt,Je)){Vt(Ze,ae);continue}if(_&&typeof y=="object"&&typeof y.getAttributeType=="function"&&!ut)switch(y.getAttributeType(zt,Gt)){case"TrustedHTML":{Je=_.createHTML(Je);break}case"TrustedScriptURL":{Je=_.createScriptURL(Je);break}}if(Je!==On)try{ut?ae.setAttributeNS(ut,Ze,Je):ae.setAttribute(Ze,Je),zn(ae)?Qe(ae):ju(r.removed)}catch{Vt(Ze,ae)}}$t(v.afterSanitizeAttributes,ae,null)},$o=function Ae(ae){let Ee=null;const ke=Ye(ae);for($t(v.beforeSanitizeShadowDOM,ae,null);Ee=ke.nextNode();)$t(v.uponSanitizeShadowNode,Ee,null),ao(Ee),lo(Ee),Ee.content instanceof i&&Ae(Ee.content);$t(v.afterSanitizeShadowDOM,ae,null)};return r.sanitize=function(Ae){let ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Ee=null,ke=null,ze=null,et=null;if(He=!Ae,He&&(Ae="<!-->"),typeof Ae!="string"&&!ro(Ae))if(typeof Ae.toString=="function"){if(Ae=Ae.toString(),typeof Ae!="string")throw Lo("dirty is not a string, aborting")}else throw Lo("toString is not a function");if(!r.isSupported)return Ae;if(ce||en(ae),r.removed=[],typeof Ae=="string"&&(le=!1),le){if(Ae.nodeName){const Ut=Xe(Ae.nodeName);if(!N[Ut]||M[Ut])throw Lo("root node is forbidden and cannot be sanitized in-place")}}else if(Ae instanceof s)Ee=fn("<!---->"),ke=Ee.ownerDocument.importNode(Ae,!0),ke.nodeType===qo.element&&ke.nodeName==="BODY"||ke.nodeName==="HTML"?Ee=ke:Ee.appendChild(ke);else{if(!pe&&!te&&!Q&&Ae.indexOf("<")===-1)return _&&de?_.createHTML(Ae):Ae;if(Ee=fn(Ae),!Ee)return pe?null:de?E:""}Ee&&ue&&Qe(Ee.firstChild);const Ze=Ye(le?Ae:Ee);for(;ze=Ze.nextNode();)ao(ze),lo(ze),ze.content instanceof i&&$o(ze.content);if(le)return Ae;if(pe){if(ie)for(et=B.call(Ee.ownerDocument);Ee.firstChild;)et.appendChild(Ee.firstChild);else et=Ee;return(O.shadowroot||O.shadowrootmode)&&(et=w.call(o,et,!0)),et}let ut=Q?Ee.outerHTML:Ee.innerHTML;return Q&&N["!doctype"]&&Ee.ownerDocument&&Ee.ownerDocument.doctype&&Ee.ownerDocument.doctype.name&&vt(Zu,Ee.ownerDocument.doctype.name)&&(ut="<!DOCTYPE "+Ee.ownerDocument.doctype.name+`>
161
- `+ut),te&&Lr([S,I,R],Ut=>{ut=Ro(ut,Ut," ")}),_&&de?_.createHTML(ut):ut},r.setConfig=function(){let Ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};en(Ae),ce=!0},r.clearConfig=function(){wt=null,ce=!1},r.isValidAttribute=function(Ae,ae,Ee){wt||en({});const ke=Xe(Ae),ze=Xe(ae);return io(ke,ze,Ee)},r.addHook=function(Ae,ae){typeof ae=="function"&&Mo(v[Ae],ae)},r.removeHook=function(Ae,ae){if(ae!==void 0){const Ee=M_(v[Ae],ae);return Ee===-1?void 0:R_(v[Ae],Ee,1)[0]}return ju(v[Ae])},r.removeHooks=function(Ae){v[Ae]=[]},r.removeAllHooks=function(){v=Yu()},r}var eC=e0();const tC=["innerHTML"],t0=ve({__name:"MarkdownRenderer",props:{source:{type:String,default:""},wrapperClass:{type:[String,Array,Object],default:""}},setup(t){const r=t,n=new jt({html:!1,linkify:!0,breaks:!0}),o=e.computed(()=>{const a=n.render(r.source||"");return eC.sanitize(a)});return(a,i)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["markdown-renderer",t.wrapperClass]),innerHTML:o.value},null,10,tC))}},[["__scopeId","data-v-ecacea26"]]),nC={class:"message-content"},oC={key:0,class:"message-name"},rC={class:"ect-w-full"},aC={class:"message-content"},iC={class:"message-text ect-relative"},lC={class:"ect-pr-1"},sC={class:"loading-message-skeleton"},cC={key:1,class:"buttons-wrapper ect-mt-[-8px]"},uC=ve({__name:"chatMessages",props:{undoId:{type:String,default:""},strikethroughIds:{type:Array,default:()=>[]},messages:{type:Array,required:!0,default:()=>[]},chatIndex:{type:Number,default:0},dataChanged:{type:Boolean,default:!1},loadingMessage:{type:String,default:""},buttonLinks:{type:Array,default:()=>[]}},emits:["component-action"],setup(t,{emit:r}){const n=Gc(),o=e.ref(null),a=e.ref(null);$n();const i=Un(),l=Jn(),s=r,u=t,h=e.computed(()=>!(l!=null&&l.activeComponentKey)),d=()=>{o.value&&o.value.scrollTo({top:o.value.scrollHeight,behavior:"smooth"})};e.watchEffect(()=>{u.messages.length>0&&e.nextTick(()=>{d()})}),e.watchEffect(()=>{u.loadingMessage&&e.nextTick(()=>{d(),a.value&&(a.value.scrollTop=a.value.scrollHeight)})});const m=e.computed(()=>{var p;return(p=i.chatStyles)==null?void 0:p.bgColor}),c=e.computed(()=>`linear-gradient(180deg, ${m.value} 0%, transparent 100%)`),y=e.computed(()=>{var p;return(p=i.chatStyles)==null?void 0:p.textColor}),f=(p,x,g=!1)=>{if(typeof p=="string"&&p.startsWith("playbookNavigate:")){const C=p.slice(17);l.navigateToBean(C);return}p==="addProducts"?l.loadComponent("catalog"):p==="quoteDocument"?n.openQuoteDocument(x.requestId):p==="quoteItem"?l.loadComponent("cart"):p==="Undo"?i.undoAction(x.requestId):p==="Checkout"&&s("component-action",{component:"chat",action:"checkout",details:{action:"CHECKOUT",label:"Checkout"}})},b=p=>{if(!p)return"";let x=p.replace(/\\r\\n/g,`
161
+ `+ut),te&&Lr([S,I,R],Ut=>{ut=Ro(ut,Ut," ")}),_&&de?_.createHTML(ut):ut},r.setConfig=function(){let Ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};en(Ae),ce=!0},r.clearConfig=function(){wt=null,ce=!1},r.isValidAttribute=function(Ae,ae,Ee){wt||en({});const ke=Xe(Ae),ze=Xe(ae);return io(ke,ze,Ee)},r.addHook=function(Ae,ae){typeof ae=="function"&&Mo(v[Ae],ae)},r.removeHook=function(Ae,ae){if(ae!==void 0){const Ee=M_(v[Ae],ae);return Ee===-1?void 0:R_(v[Ae],Ee,1)[0]}return ju(v[Ae])},r.removeHooks=function(Ae){v[Ae]=[]},r.removeAllHooks=function(){v=Yu()},r}var eC=e0();const tC=["innerHTML"],t0=ve({__name:"MarkdownRenderer",props:{source:{type:String,default:""},wrapperClass:{type:[String,Array,Object],default:""}},setup(t){const r=t,n=new jt({html:!1,linkify:!0,breaks:!0}),o=e.computed(()=>{const a=n.render(r.source||"");return eC.sanitize(a)});return(a,i)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["markdown-renderer",t.wrapperClass]),innerHTML:o.value},null,10,tC))}},[["__scopeId","data-v-ecacea26"]]),nC={class:"message-content"},oC={key:0,class:"message-name"},rC={class:"ect-w-full"},aC={class:"message-content"},iC={class:"message-text ect-relative"},lC={class:"ect-pr-1"},sC={class:"loading-message-skeleton"},cC={key:1,class:"buttons-wrapper ect-mt-[-8px]"},uC=ve({__name:"chatMessages",props:{undoId:{type:String,default:""},strikethroughIds:{type:Array,default:()=>[]},messages:{type:Array,required:!0,default:()=>[]},chatIndex:{type:Number,default:0},dataChanged:{type:Boolean,default:!1},loadingMessage:{type:String,default:""},buttonLinks:{type:Array,default:()=>[]}},emits:["component-action"],setup(t,{emit:r}){const n=Gc(),o=e.ref(null),a=e.ref(null);$n();const i=Un(),l=Jn(),s=r,u=t,h=e.computed(()=>!(l!=null&&l.activeComponentKey)),d=()=>{o.value&&o.value.scrollTo({top:o.value.scrollHeight,behavior:"smooth"})};e.watchEffect(()=>{u.messages.length>0&&e.nextTick(()=>{d()})}),e.watchEffect(()=>{u.loadingMessage&&e.nextTick(()=>{d(),a.value&&(a.value.scrollTop=a.value.scrollHeight)})});const m=e.computed(()=>{var p;return(p=i.chatStyles)==null?void 0:p.bgColor}),c=e.computed(()=>`linear-gradient(180deg, ${m.value} 0%, transparent 100%)`),y=e.computed(()=>{var p;return(p=i.chatStyles)==null?void 0:p.textColor}),f=(p,x,g=!1)=>{if(console.info("performAction action",p),typeof p=="string"&&p.startsWith("playbookNavigate:")){const C=p.slice(17);l.navigateToBean(C);return}p==="addProducts"?l.loadComponent("catalog"):p==="quoteDocument"?n.openQuoteDocument(x.requestId):p==="quoteItem"?l.loadComponent("cart"):p==="Undo"?i.undoAction(x.requestId):p==="Checkout"&&s("component-action",{component:"chat",action:"checkout",details:{action:"CHECKOUT",label:"Checkout"}})},b=p=>{if(!p)return"";let x=p.replace(/\\r\\n/g,`
162
162
  `).replace(/\\n/g,`
163
163
  `).replace(/\\r/g,`
164
- `);return x=x.replace(/^[ \t]*•[ \t]+/gm,"- "),x};return(p,x)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["chat-messages",{"root-path":h.value}])},[e.createElementVNode("div",{class:"chat-gradient",style:e.normalizeStyle({background:c.value})},null,4),e.createElementVNode("div",{ref_key:"chatMessagesRef",ref:o,class:"messages-wrapper"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList([...t.messages],(g,C)=>{var _;return e.openBlock(),e.createElementBlock("div",{key:C,class:e.normalizeClass(["message",{"user-message":g.type==="user"}])},[e.createElementVNode("div",nC,[g.name?(e.openBlock(),e.createElementBlock("div",oC,e.toDisplayString(g.name),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["message-text ect-relative",{"error-message":g.error,strikethrough:g.undone}]),style:e.normalizeStyle(g.type==="user"?{color:y.value,backgroundColor:m.value}:{})},[e.createElementVNode("div",rC,[e.createVNode(t0,{source:b(g.message)},null,8,["source"])]),((_=g==null?void 0:g.filesData)==null?void 0:_.length)>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(g==null?void 0:g.filesData,E=>(e.openBlock(),e.createBlock(eb,{key:E.name,info:{iconUrl:(E==null?void 0:E.type)==="csv"?e.unref(Qc):e.unref(Zc),fileName:E==null?void 0:E.name,fileSize:E==null?void 0:E.size},background:g.type=="user"?"#fff":"#f8f8f8","encoded-string":E==null?void 0:E.encodedString},null,8,["info","background","encoded-string"]))),128)):e.createCommentVNode("",!0)],6)])],2)}),128)),t.loadingMessage?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["loading-message",{"thinking-message":e.unref(i).isThinkingMessage}])},[e.createElementVNode("div",{class:e.normalizeClass(["ect-flex ect-gap-3",{"ect-w-full":e.unref(i).isThinkingMessage}])},[e.createElementVNode("div",aC,[e.createElementVNode("div",iC,[e.createElementVNode("div",{ref_key:"loadingWindowRef",ref:a,class:"loading-window"},[e.createElementVNode("div",lC,[e.createVNode(t0,{source:b(t.loadingMessage)},null,8,["source"])])],512)]),e.createElementVNode("div",sC,[e.createVNode(So,{style:{height:"100%",width:"100%"}})])])],2)],2)):t.buttonLinks.length>0?(e.openBlock(),e.createElementBlock("div",cC,[e.createVNode(W7,{links:t.buttonLinks,onPerformAction:f},null,8,["links"])])):e.createCommentVNode("",!0)],512)],2))}},[["__scopeId","data-v-fe989f2b"]]),dC={class:"ai-upload ect-flex-inline ect-items-center"},fC=ve({__name:"FileUpload",props:{resetFileInput:{type:Boolean,default:!1}},emits:["upload-status","error"],setup(t,{emit:r}){const n=t,o=r,a=e.ref(null),i=e.ref(""),l=e.ref(""),s=e.ref(!1);e.watch(()=>n.resetFileInput,m=>{m&&a.value&&(a.value.value="",i.value="",l.value="")});const u=m=>{const y=a.value.accept.split(",").map(b=>b.trim().toLowerCase()),f="."+m.name.split(".").pop().toLowerCase();return y.includes(f)||y.includes(m.type.toLowerCase())?!0:y.some(b=>{if(b.includes("*")){const p=b.split("*")[0];return m.type.toLowerCase().startsWith(p)}return!1})},h=async m=>{const c=m.target.files[0];if(console.info("File = ",c),c){if(!u(c)){a.value&&(a.value.value="");const f={message:"Invalid file type. Please upload a valid file type.",fileName:c.name,fileType:c.type};window&&window.$toast&&window.$toast.add({severity:"error",summary:"File Upload Error",detail:f.message,life:5e3}),o("error",f);return}i.value=c.name,l.value=c.type.split("/").pop(),o("upload-status",{status:"uploading",fileName:i.value,fileType:l.value});const y=new FileReader;y.onload=async f=>{const b=new Blob([f.target.result],{type:c.type});console.info("Blob data:",b);try{const p=await U0(b),x={attachment:{name:c.name,data:p}};console.info("AIRequestPayload = ",x),o("upload-status",{status:"uploaded",fileName:i.value,fileType:l.value,size:El(c.size),fileData:x}),a.value&&(a.value.value="")}catch(p){console.info("[ERROR]: File upload error:",p),window&&window.$toast&&window.$toast.add({severity:"error",summary:"File Processing Error",detail:"Error processing file: "+(p.message||"Unknown error"),life:5e3}),o("error",{message:"Error processing file",fileName:i.value,fileType:l.value,error:p.message}),o("upload-status",{status:"error",fileName:i.value,fileType:l.value})}},y.onerror=f=>{console.info("[ERROR]: FileReader error:",f),window&&window.$toast&&window.$toast.add({severity:"error",summary:"File Reading Error",detail:"Could not read the selected file",life:5e3}),o("error",{message:"Error reading file",fileName:c.name,fileType:c.type,error:f})},setTimeout(()=>{y.readAsText(c)},100)}},d=()=>{a.value.click()};return(m,c)=>(e.openBlock(),e.createElementBlock("div",dC,[e.createElementVNode("input",{ref_key:"fileInput",ref:a,type:"file",accept:".csv, .xls, .xlsx, text/csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",class:"ect-opacity-0 ect-h-0 ect-w-0 ect-absolute",onChange:h},null,544),e.createElementVNode("button",{class:"attachment-button",onClick:d,onMouseenter:c[0]||(c[0]=y=>s.value=!0),onMouseleave:c[1]||(c[1]=y=>s.value=!1)},[e.createVNode(Be,{icon:"attachment",size:"11",height:"17",color:s.value?"#198708":"#828282"},null,8,["color"])],32)]))}},[["__scopeId","data-v-7fbbb7c9"]]),hC=["width","height","data-test-id"],pC=[e.createStaticVNode('<g transform="translate(1 1)"><g fill="#57C046"><path d="M72.991 22.112v.119c0 .588-.051 1.162-.13 1.729h12.096c.049-.61.083-1.225.083-1.849v-.122c0-.432-.016-.861-.04-1.288H72.902c.052.466.089.934.089 1.411zM12.059 22.109v-.12c0-.435.027-.863.07-1.287H.05c-.03.466-.05.934-.05 1.407v.121c0 .583.029 1.158.073 1.729h12.136a12.162 12.162 0 0 1-.15-1.85z" vector-effect="non-scaling-stroke"></path></g><linearGradient id="a" gradientUnits="userSpaceOnUse" x1="-737.86" y1="348.135" x2="-696.809" y2="348.135" gradientTransform="matrix(1 0 0 -1 737.86 359.283)" vector-effect="non-scaling-stroke"><stop offset=".3" style="stop-color:#57c046;"></stop><stop offset="1" style="stop-color:#1c8d0a;"></stop></linearGradient><path fill="url(#a)" d="M12.059 22.109v-.12c0-6.117 4.324-11.324 10.841-11.324 8.247 0 13.073 6.397 13.073 6.397l5.078-8.799C36.944 3.258 30.544.068 23.023.068 9.866.068 0 9.938 0 22.109v.121h12.065c-.001-.04-.006-.08-.006-.121z" vector-effect="non-scaling-stroke"></path><linearGradient id="b" gradientUnits="userSpaceOnUse" x1="-693.833" y1="326.091" x2="-652.825" y2="326.091" gradientTransform="matrix(1 0 0 -1 737.86 359.283)" vector-effect="non-scaling-stroke"><stop offset="0" style="stop-color:#1c8d0a;"></stop><stop offset=".7" style="stop-color:#57c046;"></stop></linearGradient><path fill="url(#b)" d="M72.991 22.23c0 6.117-4.32 11.325-10.831 11.325-8.238 0-13.062-6.399-13.062-6.399l-5.071 8.802c4.103 5.003 10.497 8.194 18.01 8.194 13.101 0 22.934-9.805 22.997-21.921l-12.043-.001z" vector-effect="non-scaling-stroke"></path><linearGradient id="c" gradientUnits="userSpaceOnUse" x1="-737.86" y1="337.172" x2="-652.822" y2="337.172" gradientTransform="matrix(1 0 0 -1 737.86 359.283)" vector-effect="non-scaling-stroke"><stop offset=".14" style="stop-color:#57c046;"></stop><stop offset=".37" style="stop-color:#97d952;"></stop><stop offset=".59" style="stop-color:#c3eb5b;"></stop><stop offset=".86" style="stop-color:#57c046;"></stop></linearGradient><path fill="url(#c)" d="m42.533 33.78.071-.028s9.631-16.844 10.384-18.051c2.378-3.72 5.028-5.034 9.05-5.034 6.511 0 10.952 5.329 10.952 11.445v.119h12.045c0-.04.003-.079.003-.119v-.122C85.038 9.819 75.303.072 62.161.072c-8.515 0-15.645 4.144-19.615 10.371l-.071.026s-9.641 16.845-10.394 18.052c-2.38 3.721-5.033 5.035-9.059 5.035-6.473 0-10.899-5.259-10.958-11.324H0c0 12.171 9.745 21.92 22.9 21.92 8.522-.001 15.659-4.147 19.633-10.372z" vector-effect="non-scaling-stroke"></path></g>',1)],mC={__name:"ExpediteLogo",props:{width:{type:Number,default:38},height:{type:Number,default:20},dataTestId:{type:String,default:""}},setup(t){return(r,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",overflow:"visible",preserveAspectRatio:"none",viewBox:"0 0 87.04 46.221",width:t.width,height:t.height,"data-test-id":t.dataTestId,"xml:space":"preserve"},pC,8,hC))}},yC={key:0,class:"suggestions-container"},gC={key:0,class:"logo-section"},bC={class:"help-text-section"},xC={key:0,class:"help-text"},_C={key:1,class:"sub-help-text"},CC=["onClick"],EC={key:2,class:"suggestions-list"},kC=["onClick"],vC=ve({__name:"AISuggestionsDropdown",props:{options:{type:Array,required:!0},helpText:{type:String,default:""},subHelpText:{type:String,default:""},showSuggestions:{type:Boolean,default:!1}},emits:["select","preview"],setup(t,{emit:r}){const n=t,o=r,a=e.ref(0),i=e.ref(0),l=e.ref(null),s=e.ref(null),u=c=>{l.value=c,i.value=0},h=()=>{l.value=null,a.value=0},d=c=>{o("select",c)},m=c=>{if(n.showSuggestions)switch(c.key){case"ArrowDown":c.preventDefault(),l.value?(i.value=(i.value+1)%l.value.subOptions.length,o("preview",l.value.subOptions[i.value])):(a.value=(a.value+1)%n.options.length,o("preview",n.options[a.value].title));break;case"ArrowUp":c.preventDefault(),l.value?(i.value=i.value-1<0?l.value.subOptions.length-1:i.value-1,o("preview",l.value.subOptions[i.value])):(a.value=a.value-1<0?n.options.length-1:a.value-1,o("preview",n.options[a.value].title));break;case"Enter":c.preventDefault(),l.value?d(l.value.subOptions[i.value]):u(n.options[a.value]);break;case"Escape":case"ArrowLeft":case"Backspace":l.value&&(c.preventDefault(),h());break}};return e.watch(()=>n.showSuggestions,c=>{c?(window.addEventListener("keydown",m),l.value=null,a.value=0,i.value=0):window.removeEventListener("keydown",m)}),(c,y)=>t.showSuggestions?(e.openBlock(),e.createElementBlock("div",yC,[l.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",gC,[e.createVNode(mC)])),e.createElementVNode("div",bC,[t.helpText&&!l.value?(e.openBlock(),e.createElementBlock("div",xC,e.toDisplayString(t.helpText),1)):e.createCommentVNode("",!0),t.subHelpText?(e.openBlock(),e.createElementBlock("div",_C,e.toDisplayString(t.subHelpText),1)):e.createCommentVNode("",!0)]),l.value?(e.openBlock(),e.createElementBlock("div",EC,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value.subOptions,(f,b)=>(e.openBlock(),e.createElementBlock("div",{key:b,class:e.normalizeClass(["sub-option",{"sub-active":i.value===b}]),onClick:p=>d(f)},e.toDisplayString(f),11,kC))),128))])):(e.openBlock(),e.createElementBlock("div",{key:1,ref_key:"suggestionsList",ref:s,class:"suggestions-list"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,(f,b)=>(e.openBlock(),e.createElementBlock("div",{key:b,class:e.normalizeClass(["suggestion-item",{active:a.value===b}]),onClick:p=>u(f)},e.toDisplayString(f.title),11,CC))),128))],512))])):e.createCommentVNode("",!0)}},[["__scopeId","data-v-bbb514b3"]]),AC={class:"chat-file-info"},wC={class:"ect-flex ect-gap-2 ect-items-center ect-self-stretch ect-my-auto ect-text-xs ect-font-medium ect-text-black"},NC=["src"],SC={class:"ect-self-stretch ect-my-auto"},BC={key:0,class:"ect-flex ect-gap-2 ect-justify-center ect-items-center ect-self-stretch ect-my-auto ect-w-4 ect-h-4"},IC=ve({__name:"ChatInputFileInfo",props:{fileInfo:{type:Object,required:!0}},emits:["cancel"],setup(t,{emit:r}){const n=r,o=()=>{n("cancel")};return(a,i)=>(e.openBlock(),e.createElementBlock("div",AC,[e.createElementVNode("div",wC,[e.createElementVNode("img",{loading:"lazy",src:t.fileInfo.fileType==="csv"?e.unref(Qc):e.unref(Zc),class:"ect-object-contain ect-shrink-0 ect-self-stretch ect-my-auto ect-w-7 ect-aspect-square",alt:""},null,8,NC),e.createElementVNode("div",SC,e.toDisplayString(t.fileInfo.fileName),1)]),t.fileInfo.status==="uploading"?(e.openBlock(),e.createElementBlock("div",BC,[e.createVNode(ma,{size:18})])):e.createCommentVNode("",!0),t.fileInfo.status==="uploaded"?(e.openBlock(),e.createElementBlock("button",{key:1,class:"ect-flex ect-gap-2 ect-justify-center ect-items-center ect-self-stretch ect-my-auto ect-w-4 ect-h-4",onClick:o},[e.createVNode(Be,{icon:"close",size:"8"})])):e.createCommentVNode("",!0)]))}},[["__scopeId","data-v-24d881bd"]]),TC={class:"chat-input-wrapper"},OC={class:"chat-input-inner"},DC={class:"input-row"},VC=["disabled","placeholder","onKeydown"],FC={key:1,class:"icon-wrapper"},MC={class:"icon-wrapper"},RC=ve({__name:"chatInput",props:{modelValue:{type:String,default:""},loading:{type:Boolean,default:!1},placeholder:{type:String,default:"Ask Genesis AI"},helpText:{type:String,default:"Here are few areas where I can help"},subHelpText:{type:String,default:"Suggestions by Genesis (Click to Apply)"},showFile:{type:Boolean,default:!1},showMic:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","submit","speak","file-upload-status"],setup(t,{emit:r}){const n=t,o=r;Un();const a=Mt(),i=Jn(),l=e.ref({}),s=e.ref(!1),u=e.ref(!1),h=e.ref(n.modelValue),d=e.ref(null),m=e.computed(()=>{const k=i.currentStep||null;return(Array.isArray(k==null?void 0:k.promptGuidance)?k.promptGuidance:[]).slice().sort((w,v)=>Number((w==null?void 0:w.sequenceNumber)??0)-Number((v==null?void 0:v.sequenceNumber)??0)).map(w=>{const S=(Array.isArray(w==null?void 0:w.relatedPG)?w.relatedPG:[]).slice().sort((I,R)=>Number((I==null?void 0:I.sequenceNumber)??0)-Number((R==null?void 0:R.sequenceNumber)??0)).map(I=>I.pgName);return{title:w.pgName,subOptions:S}})}),c=e.computed(()=>{var k;return(k=m.value)!=null&&k.length?m.value:[]}),y=e.computed(()=>{var k;return(k=m.value)!=null&&k.length?"Prompt Guidance":n.helpText});e.watch(()=>n.loading,async(k,B)=>{!k&&B&&(await e.nextTick(),d.value.focus())}),e.watch(h,k=>{o("update:modelValue",k),e.nextTick(()=>_())}),e.watch(()=>n.modelValue,k=>{h.value=k});const f=k=>{console.info("[ERROR]: File upload error:",k),a.handleError(k,"ChatInput")},b=()=>{h.value.trim()&&(u.value=!1,o("submit",h.value),h.value="",d.value&&(d.value.style.height="32px"),l.value=null)},p=k=>{h.value=k,u.value=!1,e.nextTick(()=>{_(),d.value&&(d.value.focus(),d.value.selectionStart=d.value.selectionEnd=h.value.length)})},x=k=>{h.value=k,e.nextTick(()=>_())},g=()=>{u.value=!1},C=k=>{console.info("handleFileUploadStatus event = ",k),k!=null&&k.fileName?(l.value=k,o("file-upload-status",k)):(l.value=null,s.value=!0,o("file-upload-status",null),setTimeout(()=>{s.value=!1},3e3))},_=()=>{const k=d.value;if(!k)return;k.style.height="auto";const w=Math.max(32,Math.min(k.scrollHeight,120));k.style.height=`${w}px`},E=()=>{console.info("removeFile"),l.value=null,s.value=!0,o("file-upload-status",null),setTimeout(()=>{s.value=!1},100)},A=()=>{u.value=!1,_()};return(k,B)=>{var w,v,S,I,R;const D=e.resolveDirective("click-outside");return e.withDirectives((e.openBlock(),e.createElementBlock("div",TC,[e.createVNode(vC,{options:c.value,"help-text":y.value,"sub-help-text":t.subHelpText,"show-suggestions":u.value,onSelect:p,onPreview:x},null,8,["options","help-text","sub-help-text","show-suggestions"]),e.createElementVNode("div",OC,[e.createElementVNode("div",DC,[e.createElementVNode("div",{class:e.normalizeClass(["icon-wrapper",{"active-suggestions":u.value,disabled:((w=c.value)==null?void 0:w.length)<=0}])},[e.createVNode(Be,{disabled:((v=c.value)==null?void 0:v.length)<=0||t.loading,color:((S=c.value)==null?void 0:S.length)<=0?"#DEDEDE":u.value?"#198708":"#828282",icon:"suggestions",size:"13",height:15,onClick:B[0]||(B[0]=z=>u.value=!u.value)},null,8,["disabled","color"])],2),e.withDirectives(e.createElementVNode("textarea",{ref_key:"textareaRef",ref:d,"onUpdate:modelValue":B[1]||(B[1]=z=>h.value=z),disabled:t.loading,placeholder:t.placeholder,rows:"1",onKeydown:e.withKeys(e.withModifiers(b,["exact","prevent"]),["enter"]),onInput:A},null,40,VC),[[e.vModelText,h.value]]),t.showFile?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["icon-wrapper",{"file-upload-disabled":t.loading}])},[e.createVNode(fC,{"reset-file-input":s.value,onUploadStatus:C,onError:f},null,8,["reset-file-input"])],2)):e.createCommentVNode("",!0),t.showMic?(e.openBlock(),e.createElementBlock("div",FC,[e.createVNode(Be,{color:"#828282",disabled:t.loading,icon:"mic",size:"13",height:15,onClick:B[2]||(B[2]=z=>k.$emit("speak"))},null,8,["disabled"])])):e.createCommentVNode("",!0),e.createElementVNode("div",MC,[(e.openBlock(),e.createBlock(Be,{key:1,disabled:t.loading,icon:"send",size:"20",onClick:b},null,8,["disabled"]))])]),((I=l.value)==null?void 0:I.status)==="uploading"||((R=l.value)==null?void 0:R.status)==="uploaded"?(e.openBlock(),e.createBlock(IC,{key:0,class:"ect-mt-3 ect-mb-0.5","file-info":l.value,onCancel:E},null,8,["file-info"])):e.createCommentVNode("",!0)])])),[[D,g]])}}},[["__scopeId","data-v-e205d71c"]]),LC=["data-test-id"],PC=["data-test-id"],qC=["data-test-id"],$C=ve({__name:"aiChat",props:{dataTestId:{type:String,required:!0},isExternalGuidance:{type:Boolean,required:!1,default:!1},styles:{type:Object,required:!1,default:()=>({}),validator:t=>typeof(t==null?void 0:t.height)=="string"}},emits:["component-action"],setup(t,{emit:r}){const n=Jn(),o=r,a=Un(),i=e.ref(null),l=e.computed(()=>{var m;return((m=n.getCurrentStepLinks)==null?void 0:m.call(n))||[]}),s=e.computed(()=>!0),u=m=>{console.info("[aiChat] handleSubmit",{hasFileData:!!i.value,messageLength:(m||"").length}),i.value?(console.info("[aiChat] sending with file attachment"),a.sendMessage(m,!0,i.value)):(console.info("[aiChat] sending without attachment"),a.sendMessage(m))},h=m=>{console.info("ChatScreen handleFileUploadStatus event = ",m),m!=null&&m.fileData?(i.value=m.fileData,a.attachmentData={size:m.size,type:m.fileType,name:m.fileName}):(i.value=null,a.attachmentData=null)},d=m=>{o("component-action",m)};return(m,c)=>(e.openBlock(),e.createElementBlock("div",{class:"chat-screen","data-test-id":t.dataTestId},[e.createElementVNode("div",{class:e.normalizeClass(["messages-container",{"playbook-steps-mode-hybrid":e.unref(n).playbookStepsMode==="hybrid","playbook-steps-mode-full":e.unref(n).playbookStepsMode==="full","dxp-guiddance":t.isExternalGuidance}]),style:e.normalizeStyle({maxHeight:`calc(${t.styles.height} - 72px)`,height:`calc(${t.styles.height} - 72px)`}),"data-test-id":`${t.dataTestId}-messages-container`},[e.createVNode(uC,{messages:e.unref(a).chatHistory,"loading-message":e.unref(a).loadingMessage,"undo-id":e.unref(a).latestDMLRequest,"button-links":l.value,"strikethrough-ids":e.unref(a).strikethroughHistory,"data-changed":e.unref(a).dataManuallyChanged,"data-test-id":`${t.dataTestId}-messages`,onComponentAction:d},null,8,["messages","loading-message","undo-id","button-links","strikethrough-ids","data-changed","data-test-id"])],14,PC),e.createElementVNode("div",{class:"input-container","data-test-id":`${t.dataTestId}-input-container`},[e.createVNode(RC,{modelValue:e.unref(a).promptMessage,"onUpdate:modelValue":c[0]||(c[0]=y=>e.unref(a).promptMessage=y),disabled:!s.value,"file-info":i.value,loading:!!e.unref(a).loadingMessage,"data-test-id":`${t.dataTestId}-input`,onSubmit:u,onFileUploadStatus:h},null,8,["modelValue","disabled","file-info","loading","data-test-id"])],8,qC)],8,LC))}},[["__scopeId","data-v-dcfc28bd"]]),UC={class:"ect-h-full ect-w-full ect-flex ect-items-center ect-justify-center","data-test-id":"configurator-not-found"},zC={class:"ect-max-w-[720px] ect-p-[50px] ect-border ect-rounded-lg ect-bg-white ect-shadow-sm"},jC={class:"ect-text-[40px] ect-leading-none ect-mb-3"},HC=e.createElementVNode("div",{class:"ect-text-[22px] ect-font-normal ect-leading-normal ect-mb-[12px] ect-capitalize ect-text-[#5F5F5F]","data-test-id":"configurator-not-found-title"}," Product Configurator Not Found ",-1),GC=e.createElementVNode("div",{class:"ect-text-sm ect-text-gray-500","data-test-id":"configurator-not-found-subtitle"}," Linked composable product configurator UI component for this screen is not found OR the composable product configurator UI component does not exist. Please create / connect one and try again. ",-1),KC={class:"ect-mt-4 ect-flex ect-items-center ect-justify-between ect-gap-6"},XC={__name:"MoleculeConfiguratorNotFound",emits:["return","go-cart"],setup(t){return(r,n)=>(e.openBlock(),e.createElementBlock("div",UC,[e.createElementVNode("div",zC,[e.createElementVNode("div",jC,[e.createVNode(Be,{icon:"error",size:48})]),HC,GC,e.createElementVNode("div",KC,[e.createElementVNode("button",{type:"button",class:"ect-text-green-600 ect-text-sm ect-font-medium",onClick:n[0]||(n[0]=o=>r.$emit("return")),"data-test-id":"configurator-not-found-return"}," RETURN TO PRODUCT RESULTS "),e.createElementVNode("button",{type:"button",class:"ect-text-green-600 ect-text-sm ect-font-medium",onClick:n[1]||(n[1]=o=>r.$emit("go-cart")),"data-test-id":"configurator-not-found-go-to-cart"}," GO TO CART ")])])]))}},n0=t=>(e.pushScopeId("data-v-bf75aa89"),t=t(),e.popScopeId(),t),WC={class:"ect-h-full ect-w-full ect-bg-white","data-test-id":"aiComponentLoader-wrapper"},QC={key:2,class:"ect-h-full ect-w-full ect-flex ect-items-center ect-justify-center","data-test-id":"aiComponentLoader-cart-error"},ZC=[n0(()=>e.createElementVNode("div",{class:"ect-text-center"},[e.createElementVNode("div",{class:"ect-text-base ect-font-medium ect-text-red-600","data-test-id":"aiComponentLoader-cart-error-title"}," Quote Required "),e.createElementVNode("div",{class:"ect-text-sm ect-text-gray-500 ect-mt-2","data-test-id":"aiComponentLoader-cart-error-message"}," A quote is required for the cart component to work. Please ensure a quoteId is provided in the session prop. ")],-1))],JC={key:5,class:"ect-h-full ect-w-full ect-flex ect-items-center ect-justify-center"},YC={class:"ect-text-center"},eE=n0(()=>e.createElementVNode("div",{class:"ect-text-base ect-font-medium","data-test-id":"aiComponentLoader-fallback-title"}," No component to display for this step ",-1)),tE={class:"ect-text-sm ect-text-gray-500 ect-mt-2","data-test-id":"aiComponentLoader-fallback-subtitle"},nE=ve({__name:"aiComponentLoader",props:{stepComponent:{type:String,default:null},identity:{type:Object,default:()=>({})},session:{type:Object,default:()=>({})},security:{type:Object,default:()=>({})},packageVersion:{type:String,default:""},composablesOrgType:{type:String,default:""},composablesApiKey:{type:String,default:""},templateId:{type:String,default:""},hostName:{type:String,default:""},graphqlEndpoint:{type:String,default:""},apiKey:{type:String,default:""},isPreview:{type:Boolean,default:!1},sections:{type:Array,default:()=>[]},theme:{type:Object,default:()=>({})},catalogPreviewData:{type:Object,default:()=>({})},catalogInitialData:{type:Array,default:()=>[]},catalogSearchTerm:{type:String,default:""},onCatalogCountUpdate:{type:Function,default:null},cartSections:{type:String,default:""},configItemId:{type:String,default:""},configQliId:{type:String,default:""},configApiKey:{type:String,default:""},functions:{type:Object,default:()=>({})},resources:{type:Object,required:!1}},emits:["expeditecart-clicked","ai-guidance:error","catalog-quote-created","catalog-quote-updated","catalog-items-loaded","catalog-item-added","catalog-item-qty-updated","catalog-line-deleted","catalog-items-fetched","catalog-item-configure"],setup(t,{emit:r}){const n=r,o=t,a=Jn(),i=Ci(),l=ft(),s=e.computed(()=>{var j,H,Z,te,ne;const L=((j=o.session)==null?void 0:j.quoteId)||((H=l.quoteId)==null?void 0:H.value)||((Z=a==null?void 0:a.activeComponentData)==null?void 0:Z.contextObjectId)||((ne=(te=a==null?void 0:a.activeComponentData)==null?void 0:te.payload)==null?void 0:ne.contextObjectId);return{...o.session,...L&&{quoteId:L},qliId:p.value||o.configQliId||void 0,itemId:b.value}}),u=e.computed(()=>{const L=o.functions||{},j=L.createQuote;return typeof j!="function"?L:{...L,createQuote:async(...H)=>{const Z=await j(...H);return Z&&l.updateConfig({quoteId:Z}),Z}}}),h=e.computed(()=>{const L=a==null?void 0:a.activeComponentKey,j=o.stepComponent;return(L||j||"").toString().trim().toLowerCase().replace(/[^a-z0-9]+/g,"_")}),d=e.computed(()=>{var te,ne;const L=!!o.templateId,j=!!((te=o.identity)!=null&&te.organizationId),H=!!((ne=o.identity)!=null&&ne.accountId),Z=typeof o.cartSections=="string"&&o.cartSections.length>0;return L&&j&&H&&Z}),m=e.computed(()=>{var Z,te,ne,Q,ce;const L=(Z=o.session)==null?void 0:Z.quoteId,j=(te=l.quoteId)==null?void 0:te.value,H=((ne=a==null?void 0:a.activeComponentData)==null?void 0:ne.contextObjectId)||((ce=(Q=a==null?void 0:a.activeComponentData)==null?void 0:Q.payload)==null?void 0:ce.contextObjectId);return!!(L||j||H)}),c=e.computed(()=>{var j,H,Z,te,ne;const L=((j=o.session)==null?void 0:j.quoteId)||((H=l.quoteId)==null?void 0:H.value)||((Z=a==null?void 0:a.activeComponentData)==null?void 0:Z.contextObjectId)||((ne=(te=a==null?void 0:a.activeComponentData)==null?void 0:te.payload)==null?void 0:ne.contextObjectId);return{...o.session,...L&&{quoteId:L}}}),y=e.computed(()=>{var j;if(Array.isArray(o.catalogInitialData)&&o.catalogInitialData.length>0)return o.catalogInitialData;const L=((j=a==null?void 0:a.activeComponentData)==null?void 0:j.payload)||{};if(L.catalog&&typeof L.catalog=="object")try{const Z=Object.values(L.catalog).map(te=>{var ne;return(ne=te==null?void 0:te.catalogResponse)==null?void 0:ne.productInfo}).filter(Boolean);if(Z.length>0)return Z}catch{}return Array.isArray(L.initialData)&&L.initialData.length>0?L.initialData:Array.isArray(L.catalogInitialData)&&L.catalogInitialData.length>0?L.catalogInitialData:Array.isArray(L.items)&&L.items.length>0?L.items:[]}),f=e.computed(()=>{var j;const L=((j=a==null?void 0:a.activeComponentData)==null?void 0:j.payload)||{};return o.catalogSearchTerm||L.searchTerm||""}),b=e.computed(()=>{var H,Z,te,ne,Q,ce,ue,pe;const L=(te=(Z=(H=a==null?void 0:a.activeComponentData)==null?void 0:H.payload)==null?void 0:Z.productConfiguration)==null?void 0:te[0],j=((ue=(ce=(Q=(ne=a==null?void 0:a.activeComponentData)==null?void 0:ne.payload)==null?void 0:Q.savedProducts)==null?void 0:ce[0])==null?void 0:ue.itemId)||(L==null?void 0:L.itemId)||((pe=L==null?void 0:L.product)==null?void 0:pe.itemId)||"";return o.configItemId||j||""}),p=e.computed(()=>{var j,H,Z,te,ne,Q;const L=(te=(Z=(H=(j=a==null?void 0:a.activeComponentData)==null?void 0:j.payload)==null?void 0:H.savedProducts)==null?void 0:Z[0])==null?void 0:te.qliId;if(!L){const ce=(Q=(ne=a==null?void 0:a.activeComponentData)==null?void 0:ne.payload)==null?void 0:Q.productConfiguration,ue=Array.isArray(ce)&&ce.length>0?ce[0]:null;if(ue){const pe=ue==null?void 0:ue.product;if(pe!=null&&pe.qliId)return pe.qliId;if(ue!=null&&ue.qliId)return ue.qliId}}return L||""}),x=e.computed(()=>!!b.value),g=e.computed(()=>h.value==="configurator"&&!x.value?"Configurator requires an itemId (and optional qliId). Provide via playbook payload or props.":h.value==="catalog"?"Catalog step is active. Provide templateId/sections/theme when available.":h.value==="cart"?"Cart step is active.":"Awaiting playbook step selection."),C=e.computed(()=>{try{return JSON.stringify((a==null?void 0:a.activeComponentData)||{})}catch{return""}}),_=e.computed(()=>`catalog::${C.value}`),E=e.computed(()=>`cart::${C.value}`),A=e.computed(()=>{var L;try{return(((L=a==null?void 0:a.activeComponentData)==null?void 0:L.actionFunction)||"")==="Reload"}catch{return!1}}),k=e.computed(()=>{var j;const L=`configurator::${b.value||""}::${p.value||""}`;if(A.value){const H=((j=a==null?void 0:a.activeComponentData)==null?void 0:j.requestId)||"";return`${L}::${H}`}return L}),{emitError:B,emitErrors:D}=Wc(n,"aiComponentLoader"),w=()=>{const L=q7(a,h.value);D(L)},v=e.ref([]),S=e.ref(null),I=L=>{const j=Array.isArray(L)?L:Array.isArray(L==null?void 0:L.items)?L.items:[];if(!Array.isArray(j))return;const H={"Needs Configuration":1,"Suggests Configuration":2,"Fully Configured":3},Z=Q=>(Q==null?void 0:Q.requiresConfiguration)||"",te=Q=>!!Q&&Q in H,ne=j.filter(Q=>te(Z(Q)));ne.sort((Q,ce)=>{const ue=Z(Q),pe=Z(ce);return(H[ue]||99)-(H[pe]||99)}),v.value=ne,S.value=ne.length?ne[0]:null},R=L=>{console.log("onQuoteCreated",L),n("catalog-quote-created",L)},z=L=>{console.log("onQuoteUpdated",L),n("catalog-quote-updated",L)},$=L=>{console.log("onItemAdded",L),n("catalog-item-added",L)},X=L=>{console.log("onItemQtyUpdated",L),n("catalog-item-qty-updated",L)},W=L=>{console.log("onLineDeleted",L),n("catalog-line-deleted",L)},K=L=>{console.log("onQuoteItemsFetched",L),n("catalog-items-fetched",L)};e.watch(()=>h.value,(L,j)=>{var H,Z,te,ne,Q,ce,ue,pe,ie,de;if(L==="configurator"){const _e=!!((te=(Z=(H=a==null?void 0:a.activeComponentData)==null?void 0:H.payload)==null?void 0:Z.savedProducts)!=null&&te.length),xe=((ce=(Q=(ne=a==null?void 0:a.activeComponentData)==null?void 0:ne.payload)==null?void 0:Q.productConfiguration)==null?void 0:ce.length)>0;if(!_e&&!xe&&S.value&&!b.value){const ye=((ue=S.value)==null?void 0:ue.itemId)||"";if(ye){const oe=((pe=a==null?void 0:a.currentPlaybook)==null?void 0:pe.playBookSteps)||[],le=se=>String(se||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_");let be=null;const Ce=oe.findIndex(se=>se.stepName===(a==null?void 0:a.currentStepName));if(Ce>=0&&oe[Ce+1]&&le((ie=oe[Ce+1])==null?void 0:ie.stepComponent)==="configurator")be=oe[Ce+1].stepName;else{const se=oe.findIndex(fe=>le(fe==null?void 0:fe.stepComponent)==="configurator");be=se>=0?(de=oe[se])==null?void 0:de.stepName:null}const J={payload:{savedProducts:[{itemId:ye}]}};be?a.navigateToStep({stepName:be,data:J}):a.loadComponent("configurator",J)}}}});const P=()=>{var Z,te;const L=((Z=a==null?void 0:a.currentPlaybook)==null?void 0:Z.playBookSteps)||[],j=ne=>String(ne||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_"),H=L.findIndex(ne=>j(ne==null?void 0:ne.stepComponent)==="catalog"||j(ne==null?void 0:ne.stepName).includes("catalog"));if(H>=0){const ne=(te=L[H])==null?void 0:te.stepName;a.navigateToStep({stepName:ne})}else a.loadComponent("catalog")},N=()=>{var Z,te;const L=((Z=a==null?void 0:a.currentPlaybook)==null?void 0:Z.playBookSteps)||[],j=ne=>String(ne||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_"),H=L.findIndex(ne=>j(ne==null?void 0:ne.stepComponent)==="cart"||j(ne==null?void 0:ne.stepName).includes("cart"));if(H>=0){const ne=(te=L[H])==null?void 0:te.stepName;a.navigateToStep({stepName:ne})}else a.loadComponent("cart")},T=L=>{var j,H;console.log("onItemConfigureClicked",L),n("catalog-item-configure",L);try{const Z=(L==null?void 0:L.itemId)||"",te=(L==null?void 0:L.qliId)||(L==null?void 0:L.QliId)||"",ne=[];if(Z){const ie={itemId:Z};te&&(ie.qliId=te),ne.push(ie)}const Q={payload:{savedProducts:ne}},ce=((j=a==null?void 0:a.currentPlaybook)==null?void 0:j.playBookSteps)||[],ue=ie=>String(ie||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_"),pe=ce.findIndex(ie=>{const de=ue(ie==null?void 0:ie.stepComponent),_e=ue(ie==null?void 0:ie.stepName);return de==="configurator"||_e.includes("configure")});if(pe>=0){const ie=(H=ce[pe])==null?void 0:H.stepName;a.navigateToStep({stepName:ie,data:Q})}else a.loadComponent("configurator",Q)}catch(Z){console.warn("[aiComponentLoader] Failed to navigate to configurator from configure click:",Z),a.loadComponent("configurator",{payload:{}})}},O=L=>{console.log("onCartClicked",L),n("expeditecart-clicked",L)},F=L=>{var j,H;try{const Z=(L==null?void 0:L.itemId)||"",te=(L==null?void 0:L.lineItemId)||(L==null?void 0:L.qliId)||"",ne=[];if(Z){const ie={itemId:Z};te&&(ie.qliId=te),ne.push(ie)}const Q={payload:{savedProducts:ne}},ce=((j=a==null?void 0:a.currentPlaybook)==null?void 0:j.playBookSteps)||[],ue=ie=>String(ie||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_"),pe=ce.findIndex(ie=>{const de=ue(ie==null?void 0:ie.stepComponent),_e=ue(ie==null?void 0:ie.stepName);return de==="configurator"||_e.includes("configure")});if(pe>=0){const ie=(H=ce[pe])==null?void 0:H.stepName;a.navigateToStep({stepName:ie,data:Q})}else a.loadComponent("configurator",Q)}catch(Z){console.warn("[aiComponentLoader] Failed to navigate to configurator from cart configure click:",Z),a.loadComponent("configurator",{payload:{}})}},q=L=>{console.log("onCatalogIdReceived",L),l.updateConfig({eCatalogId:L})},M=L=>{console.log("Action",L),L.event==="add-to-quote"?n("configurator:add-to-quote",L.data):L.event==="save"&&n("configurator:save",L.data)},U=e.ref("");return e.watch(()=>a==null?void 0:a.activeComponentData,async L=>{var H,Z,te,ne;if(!L)return;console.log("activeComponentData Changed",L);const j=(L==null?void 0:L.requestId)||"";if(console.log("requestId",j),console.log("lastReloadRequestId",U.value),j&&j!==U.value)if(U.value=j,await e.nextTick(),((Z=(H=L==null?void 0:L.payload)==null?void 0:H.productConfiguration)==null?void 0:Z.length)>0){const Q=(te=L==null?void 0:L.payload)==null?void 0:te.productConfiguration[0],ce=(Q==null?void 0:Q.itemId)||((ne=Q==null?void 0:Q.product)==null?void 0:ne.itemId)||"";i.setPreConfigData(L==null?void 0:L.payload,ce)}else(L==null?void 0:L.actionFunction)==="Reload"&&(console.log("Reloading configurator 1"),i.refresh())},{deep:!0}),e.onMounted(()=>{e.nextTick(()=>{w()})}),(L,j)=>(e.openBlock(),e.createElementBlock("div",WC,[h.value==="catalog"?(e.openBlock(),e.createBlock(wr,{key:_.value,"data-test-id":"aiComponentLoader-catalog",class:"ect-h-full ect-w-full","template-id":t.templateId,identity:t.identity,session:t.session,security:t.security,"search-term":f.value,"on-catalog-count-update":t.onCatalogCountUpdate,"preview-data":t.catalogPreviewData,"initial-data":y.value,sections:t.sections,theme:t.theme,"composables-org-type":t.composablesOrgType,onCatalogQuoteCreated:R,onCatalogQuoteUpdated:z,onCatalogItemsLoaded:I,onCatalogItemAdded:$,onCatalogItemQtyUpdated:X,onCatalogLineDeleted:W,onCatalogItemsFetched:K,onCatalogItemConfigure:T,"onCatalog:id":q},null,8,["template-id","identity","session","security","search-term","on-catalog-count-update","preview-data","initial-data","sections","theme","composables-org-type"])):h.value==="cart"&&d.value&&m.value?(e.openBlock(),e.createBlock(Nr,{key:E.value,"data-test-id":"aiComponentLoader-cart",class:"ect-h-full ect-w-full","template-id":t.templateId,"host-name":t.hostName,"composables-org-type":t.composablesOrgType,security:t.security,identity:t.identity,session:c.value,onExpeditecartItemConfigure:F,onExpeditecartClicked:O},null,8,["template-id","host-name","composables-org-type","security","identity","session"])):h.value==="cart"&&d.value&&!m.value?(e.openBlock(),e.createElementBlock("div",QC,ZC)):h.value==="configurator"&&x.value?(e.openBlock(),e.createBlock(yr,{key:k.value,"data-test-id":"aiComponentLoader-configurator",class:"ect-h-full ect-w-full",security:t.security,identity:t.identity,resources:t.resources,"user-locale":L.userLocale,cart:!0,"composables-org-type":t.composablesOrgType,session:s.value,functions:u.value,onReady:e.unref(i).setExpediteConfigComp,onAction:M},null,8,["security","identity","resources","user-locale","composables-org-type","session","functions","onReady"])):h.value==="configurator"&&!x.value?(e.openBlock(),e.createBlock(XC,{key:4,onReturn:P,onGoCart:N})):(e.openBlock(),e.createElementBlock("div",JC,[e.createElementVNode("div",YC,[eE,e.createElementVNode("div",tE,e.toDisplayString(g.value),1)])]))]))}},[["__scopeId","data-v-bf75aa89"]]),oE={class:"ai-guidance-loader","data-test-id":"aiGuidance-loader-container"},rE={"data-test-id":"aiGuidance-loader-text"},aE={class:"aig-button","data-test-id":"aiGuidance-loader-button"},iE={class:"aig-input-box","data-test-id":"aiGuidance-loader-input"},lE=ve({__name:"AiGuidanceLoader",props:{errors:{type:Array,required:!1,default:()=>[]},chatBgColor:{type:String,required:!1,default:""}},setup(t){const r=t,n=e.computed(()=>`linear-gradient(180deg, ${r.chatBgColor} 0%, transparent 100%)`);return(o,a)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:"chat-gradient",style:e.normalizeStyle({background:n.value})},null,4),e.createElementVNode("div",oE,[e.createElementVNode("div",rE,[e.createVNode(So,{style:{width:"100%",height:"16px","margin-bottom":"8px"}}),e.createVNode(So,{style:{width:"100%",height:"16px","margin-bottom":"32px","max-width":"481px"}})]),e.createElementVNode("div",aE,[e.createVNode(So,{style:{width:"100%",height:"24px"}})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.errors,i=>(e.openBlock(),e.createElementBlock("div",{key:i,class:"aig-message-error","data-test-id":"aiGuidance-loader-error"},e.toDisplayString(i),1))),128)),e.createElementVNode("div",iE,[e.createVNode(So,{style:{height:"36px",width:"100%"}})])])],64))}},[["__scopeId","data-v-5e4a9913"]]),sE={class:"ai-guidance-wrapper","data-test-id":"aiGuidance-wrapper"},Qi=ve({__name:"aiGuidance",props:{templateId:{type:String,required:!1},playbookData:{type:Object,required:!1},composablesOrgType:{type:String,required:!0},identity:{type:Object,required:!1,default:()=>({})},session:{type:Object,required:!1,default:()=>({})},security:{type:Object,required:!1,default:()=>({})},functions:{type:Object,required:!1,default:()=>({})},websocketUrl:{type:String,required:!0},packageVersion:{type:String,required:!0},hostName:{type:String,required:!1},graphqlEndpoint:{type:String,required:!1},apiKey:{type:String,required:!1},isPreview:{type:Boolean,required:!1,default:!1},catalogSections:{type:Array,required:!1,default:()=>[]},cartSections:{type:String,required:!1,default:""},theme:{type:Object,required:!1,default:()=>({})},styles:{type:Object,required:!1,default:()=>({height:"100vh"}),validator:t=>typeof(t==null?void 0:t.height)=="string"},resources:{type:Object,required:!1,default:()=>({})}},emits:["expeditecart-item-configure","expeditecart-clicked","component-action","ai-response:success","quote-id:updated","ai-guidance:error"],setup(t,{emit:r}){const n=Jn(),o=ft(),a=Un(),i=Co(),l=r,s=e.ref(!0),u=e.ref(!1),h=e.ref(!0),d=e.ref(!0),m=e.ref(!1),c=e.ref([]),{emitError:y,emitErrors:f}=Wc(l,"aiGuidance"),b=t,{composablesOrgType:p,websocketUrl:x,packageVersion:g,identity:C,session:_,security:E,functions:A,templateId:k,hostName:B,graphqlEndpoint:D,apiKey:w,isPreview:v,catalogSections:S,cartSections:I,theme:R}=b,z=e.computed(()=>{var F,q,M;return{...b.session||{},quoteId:((F=b.session)==null?void 0:F.quoteId)||(((q=o.quoteId)==null?void 0:q.value)??""),eCatalogId:(M=o.eCatalogId)==null?void 0:M.value}});e.onBeforeMount(async()=>{var F;console.log("security",E),console.log("apiKey",w),o.updateConfig({userId:C==null?void 0:C.userId,organizationId:C==null?void 0:C.organizationId,accessToken:E==null?void 0:E.accessToken,composablesApiUrl:E==null?void 0:E.baseUrl,composablesOrgType:p,websocketUrl:x,quoteId:_==null?void 0:_.quoteId,packageVersion:g,accountId:C==null?void 0:C.accountId,templateId:k,hostName:B,graphqlEndpoint:D,apiKey:(E==null?void 0:E.apiKey)||w,cid:C==null?void 0:C.contactId,isPreview:v,siteUrl:(F=b.resources)==null?void 0:F.siteUrl})}),e.onMounted(async()=>{var j,H,Z,te;const F=L7(b,C,E);f(F);const q=Xc(x);if(q&&y(q),F.length>0||q){s.value=!1;return}n.setSecretKey(E==null?void 0:E.accessToken);let M=null,U,L;try{M=await n.getPlaybookInfoFromQuote(),U=(M==null?void 0:M.XX_ORD1__Completed_PB_Step_Number_EX__c)??void 0,L=(M==null?void 0:M.XX_ORD1__Playbook_Current_Step_Meta_EX__c)??void 0}catch(ne){console.error("[aiGuidance] Failed to get playbook info from quote:",ne),y("AI_GUIDANCE_PLAYBOOK_INFO_FETCH_FAILED",{error:ne.message})}if(L)try{L=JSON.parse(L)}catch(ne){console.error("[aiGuidance] Failed to parse currentStepMetaServer:",ne),y("AI_GUIDANCE_JSON_PARSE_ERROR",{error:ne.message,data:"currentStepMetaServer"}),L=void 0}if(console.info("sequenceNumberServer = ",U),b.templateId){s.value=!0;try{const Q=await n.getCatalogInContext();console.log("catalogInContext = ",Q),Q&&o.updateConfig({eCatalogId:Q})}catch(Q){console.error("[aiGuidance] Failed to get catalog in context:",Q),y("AI_GUIDANCE_CATALOG_FETCH_FAILED",{error:Q.message})}let ne=null;try{await i.fetchBlockInformationREST({templateId:b.templateId});const Q=P7(i.pageBlocks);ne=Q.playbookId,Q.error&&y(Q.error,{error:"Block structure validation failed"}),ne||y("AI_GUIDANCE_BLOCK_PLAYBOOK_ID_MISSING",{pageBlocks:i.pageBlocks})}catch(Q){console.error("[aiGuidance] Failed to fetch block information:",Q),y("AI_GUIDANCE_BLOCK_FETCH_FAILED",{error:Q.message})}if(console.log("playbookID",ne),ne?u.value=!0:c.value.push("No playbook ID found in template"),n.setEmbeddedMode(!0),ne)try{n.currentPlaybook=ne,await n.getPlaybookByKey(ne),n.showPlaybookSteps=!0}catch(Q){console.error("[aiGuidance] Failed to get playbook by key:",Q),y("AI_GUIDANCE_PLAYBOOK_FETCH_FAILED",{error:Q.message,playbookID:ne})}n.playbookStepsMode="full",a.setInitialPayload();try{await a.connectSocket()}catch(Q){console.error("[aiGuidance] Failed to connect socket:",Q),y("WEBSOCKET_CONNECTION_FAILED",{error:Q.message})}if(U!==void 0){n.navigateToStep({stepName:(H=(j=n.currentPlaybook)==null?void 0:j.playBookSteps[Number(U)])==null?void 0:H.stepName,data:L}),s.value=!1;return}(te=(Z=n.currentPlaybook)==null?void 0:Z.playBookSteps)!=null&&te.length&&n.setCurrentStepName(n.currentPlaybook.playBookSteps[0].stepName),s.value=!1}else c.value.push("templateId is required")});const $=e.computed(()=>{var M;const F=((M=n.currentPlaybook)==null?void 0:M.playBookSteps)||[],q=n.currentStepName;return F.find(U=>U.stepName===q)||F[0]||null}),X=e.computed(()=>{var F;return((F=$.value)==null?void 0:F.stepComponent)||null});e.watch(()=>n.activeComponentKey,F=>{F&&(h.value=!1)});const W=[];e.onMounted(()=>{W.push(Lt("expeditecart:configure-clicked",F=>{l("expeditecart-item-configure",F)})),W.push(Lt("expeditecart:clicked",F=>{l("expeditecart-clicked",F)})),W.push(Lt("ai-response:success",F=>{try{l("ai-response:success",F)}catch{}})),W.push(Lt("quote-id:updated",F=>{try{l("quote-id:updated",F)}catch(q){console.info("[aiGuidance] Error emitting quote-id:updated event:",q)}})),W.push(Lt("websocket:error",F=>{try{F!=null&&F.isInitialization&&y(F.errorCode||"WEBSOCKET_CONNECTION_FAILED",F)}catch(q){console.info("[aiGuidance] Error handling websocket error event:",q)}}))});const K=F=>{console.log("[aiGuidance] Received error from aiComponentLoader:",F),l("ai-guidance:error",F)},P=F=>{console.log("onExpediteCartClicked",F),l("component-action",{component:"cart",details:F})},N=(F,q)=>{var U;l("component-action",{component:"catalog",action:F,details:q});const M=(q==null?void 0:q.quoteId)??((U=q==null?void 0:q.response)==null?void 0:U.quoteId);if(M&&(F==="item-added"||F==="items-fetched"))try{l("quote-id:updated",{quoteId:M})}catch(L){console.info("[aiGuidance] Error emitting quote-id:updated from catalog event:",L)}},T=(F,q)=>{l("component-action",{component:"configurator",action:F,details:q})},O=F=>{l("component-action",F)};return e.onBeforeUnmount(()=>{try{a.cancelRequest()}catch{}try{a.disconnectSocket()}catch{}try{a.resetState()}catch{}try{n.setEmbeddedMode(!1),n.currentPlaybook=null,n.currentStepName=null,n.activeComponentKey=null,n.activeComponentData=null,n.showPlaybookSteps=!1,n.playbookStepsMode="full"}catch{}s.value=!1,u.value=!1,h.value=!0,d.value=!0,m.value=!1,c.value=[],W.forEach(F=>{try{F()}catch{}})}),(F,q)=>{var M;return e.openBlock(),e.createElementBlock("div",sE,[e.createVNode(pa,{icon:"logo",color:"#000000",size:"18.75",height:"16.25"}),s.value||e.unref(a).isFetchingHistory?(e.openBlock(),e.createBlock(lE,{key:0,errors:c.value,"data-test-id":"aiGuidance-loader"},null,8,["errors"])):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["ai-app",{"root-path":h.value,"playbook-steps-mode-full":e.unref(n).playbookStepsMode==="full","dxp-guiddance":u.value}]),style:e.normalizeStyle(t.styles)},[e.createElementVNode("div",{class:"ai-app-chat-wrapper",style:e.normalizeStyle({height:t.styles.height})},[e.createVNode($C,{"data-test-id":"chat-screen","is-external-guidance":u.value,styles:t.styles,onComponentAction:O},null,8,["is-external-guidance","styles"])],4),!h.value&&d.value&&!m.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"component-loader-wrapper",style:e.normalizeStyle({height:t.styles.height,maxHeight:t.styles.height})},[e.unref(n).currentPlaybook?(e.openBlock(),e.createBlock(nE,{key:0,"template-id":((M=$.value)==null?void 0:M.templateId)||e.unref(k),"step-component":X.value,identity:e.unref(C),session:z.value,security:e.unref(E),functions:e.unref(A),"composables-org-type":e.unref(p),"package-version":e.unref(g),"host-name":e.unref(B),"graphql-endpoint":e.unref(D),"api-key":e.unref(w),"is-preview":e.unref(v),sections:e.unref(S),"cart-sections":e.unref(I),theme:e.unref(R),resources:t.resources,"data-test-id":"aiComponentLoader-mounted",onExpeditecartClicked:P,onCatalogQuoteCreated:q[0]||(q[0]=U=>N("quote-created",U)),onCatalogQuoteUpdated:q[1]||(q[1]=U=>N("quote-updated",U)),onCatalogItemsLoaded:q[2]||(q[2]=U=>N("items-loaded",U)),onCatalogItemAdded:q[3]||(q[3]=U=>N("item-added",U)),onCatalogItemQtyUpdated:q[4]||(q[4]=U=>N("item-qty-updated",U)),onCatalogLineDeleted:q[5]||(q[5]=U=>N("line-deleted",U)),onCatalogItemsFetched:q[6]||(q[6]=U=>N("items-fetched",U)),onCatalogItemConfigure:q[7]||(q[7]=U=>N("item-configure",U)),"onConfigurator:addToQuote":q[8]||(q[8]=U=>T("add-to-quote",U)),"onConfigurator:save":q[9]||(q[9]=U=>T("save",U)),"onAiGuidance:error":K},null,8,["template-id","step-component","identity","session","security","functions","composables-org-type","package-version","host-name","graphql-endpoint","api-key","is-preview","sections","cart-sections","theme","resources"])):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0)],6))])}}},[["__scopeId","data-v-7835e48c"]]),o0={ExpediteConfigurator:yr,ExpediteGPT:wa,ExpediteCatalog:wr,ExpediteCart:Nr,ExpediteAIGuidance:Qi},cE={install(t,r={}){t.component("ExpediteConfigurator",yr),t.component("ExpediteGPT",wa),t.component("ExpediteCatalog",wr),t.component("ExpediteCart",Nr),t.component("ExpediteAIGuidance",Qi)},...o0};bt.Components=o0,bt.ExpediteAIGuidance=Qi,bt.ExpediteCart=Nr,bt.ExpediteCatalog=wr,bt.ExpediteConfigurator=yr,bt.ExpediteGPT=wa,bt.default=cE,bt.useComRootStore=wo,Object.defineProperties(bt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
164
+ `);return x=x.replace(/^[ \t]*•[ \t]+/gm,"- "),x};return(p,x)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["chat-messages",{"root-path":h.value}])},[e.createElementVNode("div",{class:"chat-gradient",style:e.normalizeStyle({background:c.value})},null,4),e.createElementVNode("div",{ref_key:"chatMessagesRef",ref:o,class:"messages-wrapper"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList([...t.messages],(g,C)=>{var _;return e.openBlock(),e.createElementBlock("div",{key:C,class:e.normalizeClass(["message",{"user-message":g.type==="user"}])},[e.createElementVNode("div",nC,[g.name?(e.openBlock(),e.createElementBlock("div",oC,e.toDisplayString(g.name),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["message-text ect-relative",{"error-message":g.error,strikethrough:g.undone}]),style:e.normalizeStyle(g.type==="user"?{color:y.value,backgroundColor:m.value}:{})},[e.createElementVNode("div",rC,[e.createVNode(t0,{source:b(g.message)},null,8,["source"])]),((_=g==null?void 0:g.filesData)==null?void 0:_.length)>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(g==null?void 0:g.filesData,E=>(e.openBlock(),e.createBlock(eb,{key:E.name,info:{iconUrl:(E==null?void 0:E.type)==="csv"?e.unref(Qc):e.unref(Zc),fileName:E==null?void 0:E.name,fileSize:E==null?void 0:E.size},background:g.type=="user"?"#fff":"#f8f8f8","encoded-string":E==null?void 0:E.encodedString},null,8,["info","background","encoded-string"]))),128)):e.createCommentVNode("",!0)],6)])],2)}),128)),t.loadingMessage?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["loading-message",{"thinking-message":e.unref(i).isThinkingMessage}])},[e.createElementVNode("div",{class:e.normalizeClass(["ect-flex ect-gap-3",{"ect-w-full":e.unref(i).isThinkingMessage}])},[e.createElementVNode("div",aC,[e.createElementVNode("div",iC,[e.createElementVNode("div",{ref_key:"loadingWindowRef",ref:a,class:"loading-window"},[e.createElementVNode("div",lC,[e.createVNode(t0,{source:b(t.loadingMessage)},null,8,["source"])])],512)]),e.createElementVNode("div",sC,[e.createVNode(So,{style:{height:"100%",width:"100%"}})])])],2)],2)):t.buttonLinks.length>0?(e.openBlock(),e.createElementBlock("div",cC,[e.createVNode(W7,{links:t.buttonLinks,onPerformAction:f},null,8,["links"])])):e.createCommentVNode("",!0)],512)],2))}},[["__scopeId","data-v-4ae19744"]]),dC={class:"ai-upload ect-flex-inline ect-items-center"},fC=ve({__name:"FileUpload",props:{resetFileInput:{type:Boolean,default:!1}},emits:["upload-status","error"],setup(t,{emit:r}){const n=t,o=r,a=e.ref(null),i=e.ref(""),l=e.ref(""),s=e.ref(!1);e.watch(()=>n.resetFileInput,m=>{m&&a.value&&(a.value.value="",i.value="",l.value="")});const u=m=>{const y=a.value.accept.split(",").map(b=>b.trim().toLowerCase()),f="."+m.name.split(".").pop().toLowerCase();return y.includes(f)||y.includes(m.type.toLowerCase())?!0:y.some(b=>{if(b.includes("*")){const p=b.split("*")[0];return m.type.toLowerCase().startsWith(p)}return!1})},h=async m=>{const c=m.target.files[0];if(console.info("File = ",c),c){if(!u(c)){a.value&&(a.value.value="");const f={message:"Invalid file type. Please upload a valid file type.",fileName:c.name,fileType:c.type};window&&window.$toast&&window.$toast.add({severity:"error",summary:"File Upload Error",detail:f.message,life:5e3}),o("error",f);return}i.value=c.name,l.value=c.type.split("/").pop(),o("upload-status",{status:"uploading",fileName:i.value,fileType:l.value});const y=new FileReader;y.onload=async f=>{const b=new Blob([f.target.result],{type:c.type});console.info("Blob data:",b);try{const p=await U0(b),x={attachment:{name:c.name,data:p}};console.info("AIRequestPayload = ",x),o("upload-status",{status:"uploaded",fileName:i.value,fileType:l.value,size:El(c.size),fileData:x}),a.value&&(a.value.value="")}catch(p){console.info("[ERROR]: File upload error:",p),window&&window.$toast&&window.$toast.add({severity:"error",summary:"File Processing Error",detail:"Error processing file: "+(p.message||"Unknown error"),life:5e3}),o("error",{message:"Error processing file",fileName:i.value,fileType:l.value,error:p.message}),o("upload-status",{status:"error",fileName:i.value,fileType:l.value})}},y.onerror=f=>{console.info("[ERROR]: FileReader error:",f),window&&window.$toast&&window.$toast.add({severity:"error",summary:"File Reading Error",detail:"Could not read the selected file",life:5e3}),o("error",{message:"Error reading file",fileName:c.name,fileType:c.type,error:f})},setTimeout(()=>{y.readAsText(c)},100)}},d=()=>{a.value.click()};return(m,c)=>(e.openBlock(),e.createElementBlock("div",dC,[e.createElementVNode("input",{ref_key:"fileInput",ref:a,type:"file",accept:".csv, .xls, .xlsx, text/csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",class:"ect-opacity-0 ect-h-0 ect-w-0 ect-absolute",onChange:h},null,544),e.createElementVNode("button",{class:"attachment-button",onClick:d,onMouseenter:c[0]||(c[0]=y=>s.value=!0),onMouseleave:c[1]||(c[1]=y=>s.value=!1)},[e.createVNode(Be,{icon:"attachment",size:"11",height:"17",color:s.value?"#198708":"#828282"},null,8,["color"])],32)]))}},[["__scopeId","data-v-7fbbb7c9"]]),hC=["width","height","data-test-id"],pC=[e.createStaticVNode('<g transform="translate(1 1)"><g fill="#57C046"><path d="M72.991 22.112v.119c0 .588-.051 1.162-.13 1.729h12.096c.049-.61.083-1.225.083-1.849v-.122c0-.432-.016-.861-.04-1.288H72.902c.052.466.089.934.089 1.411zM12.059 22.109v-.12c0-.435.027-.863.07-1.287H.05c-.03.466-.05.934-.05 1.407v.121c0 .583.029 1.158.073 1.729h12.136a12.162 12.162 0 0 1-.15-1.85z" vector-effect="non-scaling-stroke"></path></g><linearGradient id="a" gradientUnits="userSpaceOnUse" x1="-737.86" y1="348.135" x2="-696.809" y2="348.135" gradientTransform="matrix(1 0 0 -1 737.86 359.283)" vector-effect="non-scaling-stroke"><stop offset=".3" style="stop-color:#57c046;"></stop><stop offset="1" style="stop-color:#1c8d0a;"></stop></linearGradient><path fill="url(#a)" d="M12.059 22.109v-.12c0-6.117 4.324-11.324 10.841-11.324 8.247 0 13.073 6.397 13.073 6.397l5.078-8.799C36.944 3.258 30.544.068 23.023.068 9.866.068 0 9.938 0 22.109v.121h12.065c-.001-.04-.006-.08-.006-.121z" vector-effect="non-scaling-stroke"></path><linearGradient id="b" gradientUnits="userSpaceOnUse" x1="-693.833" y1="326.091" x2="-652.825" y2="326.091" gradientTransform="matrix(1 0 0 -1 737.86 359.283)" vector-effect="non-scaling-stroke"><stop offset="0" style="stop-color:#1c8d0a;"></stop><stop offset=".7" style="stop-color:#57c046;"></stop></linearGradient><path fill="url(#b)" d="M72.991 22.23c0 6.117-4.32 11.325-10.831 11.325-8.238 0-13.062-6.399-13.062-6.399l-5.071 8.802c4.103 5.003 10.497 8.194 18.01 8.194 13.101 0 22.934-9.805 22.997-21.921l-12.043-.001z" vector-effect="non-scaling-stroke"></path><linearGradient id="c" gradientUnits="userSpaceOnUse" x1="-737.86" y1="337.172" x2="-652.822" y2="337.172" gradientTransform="matrix(1 0 0 -1 737.86 359.283)" vector-effect="non-scaling-stroke"><stop offset=".14" style="stop-color:#57c046;"></stop><stop offset=".37" style="stop-color:#97d952;"></stop><stop offset=".59" style="stop-color:#c3eb5b;"></stop><stop offset=".86" style="stop-color:#57c046;"></stop></linearGradient><path fill="url(#c)" d="m42.533 33.78.071-.028s9.631-16.844 10.384-18.051c2.378-3.72 5.028-5.034 9.05-5.034 6.511 0 10.952 5.329 10.952 11.445v.119h12.045c0-.04.003-.079.003-.119v-.122C85.038 9.819 75.303.072 62.161.072c-8.515 0-15.645 4.144-19.615 10.371l-.071.026s-9.641 16.845-10.394 18.052c-2.38 3.721-5.033 5.035-9.059 5.035-6.473 0-10.899-5.259-10.958-11.324H0c0 12.171 9.745 21.92 22.9 21.92 8.522-.001 15.659-4.147 19.633-10.372z" vector-effect="non-scaling-stroke"></path></g>',1)],mC={__name:"ExpediteLogo",props:{width:{type:Number,default:38},height:{type:Number,default:20},dataTestId:{type:String,default:""}},setup(t){return(r,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",overflow:"visible",preserveAspectRatio:"none",viewBox:"0 0 87.04 46.221",width:t.width,height:t.height,"data-test-id":t.dataTestId,"xml:space":"preserve"},pC,8,hC))}},yC={key:0,class:"suggestions-container"},gC={key:0,class:"logo-section"},bC={class:"help-text-section"},xC={key:0,class:"help-text"},_C={key:1,class:"sub-help-text"},CC=["onClick"],EC={key:2,class:"suggestions-list"},kC=["onClick"],vC=ve({__name:"AISuggestionsDropdown",props:{options:{type:Array,required:!0},helpText:{type:String,default:""},subHelpText:{type:String,default:""},showSuggestions:{type:Boolean,default:!1}},emits:["select","preview"],setup(t,{emit:r}){const n=t,o=r,a=e.ref(0),i=e.ref(0),l=e.ref(null),s=e.ref(null),u=c=>{l.value=c,i.value=0},h=()=>{l.value=null,a.value=0},d=c=>{o("select",c)},m=c=>{if(n.showSuggestions)switch(c.key){case"ArrowDown":c.preventDefault(),l.value?(i.value=(i.value+1)%l.value.subOptions.length,o("preview",l.value.subOptions[i.value])):(a.value=(a.value+1)%n.options.length,o("preview",n.options[a.value].title));break;case"ArrowUp":c.preventDefault(),l.value?(i.value=i.value-1<0?l.value.subOptions.length-1:i.value-1,o("preview",l.value.subOptions[i.value])):(a.value=a.value-1<0?n.options.length-1:a.value-1,o("preview",n.options[a.value].title));break;case"Enter":c.preventDefault(),l.value?d(l.value.subOptions[i.value]):u(n.options[a.value]);break;case"Escape":case"ArrowLeft":case"Backspace":l.value&&(c.preventDefault(),h());break}};return e.watch(()=>n.showSuggestions,c=>{c?(window.addEventListener("keydown",m),l.value=null,a.value=0,i.value=0):window.removeEventListener("keydown",m)}),(c,y)=>t.showSuggestions?(e.openBlock(),e.createElementBlock("div",yC,[l.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",gC,[e.createVNode(mC)])),e.createElementVNode("div",bC,[t.helpText&&!l.value?(e.openBlock(),e.createElementBlock("div",xC,e.toDisplayString(t.helpText),1)):e.createCommentVNode("",!0),t.subHelpText?(e.openBlock(),e.createElementBlock("div",_C,e.toDisplayString(t.subHelpText),1)):e.createCommentVNode("",!0)]),l.value?(e.openBlock(),e.createElementBlock("div",EC,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value.subOptions,(f,b)=>(e.openBlock(),e.createElementBlock("div",{key:b,class:e.normalizeClass(["sub-option",{"sub-active":i.value===b}]),onClick:p=>d(f)},e.toDisplayString(f),11,kC))),128))])):(e.openBlock(),e.createElementBlock("div",{key:1,ref_key:"suggestionsList",ref:s,class:"suggestions-list"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,(f,b)=>(e.openBlock(),e.createElementBlock("div",{key:b,class:e.normalizeClass(["suggestion-item",{active:a.value===b}]),onClick:p=>u(f)},e.toDisplayString(f.title),11,CC))),128))],512))])):e.createCommentVNode("",!0)}},[["__scopeId","data-v-bbb514b3"]]),AC={class:"chat-file-info"},wC={class:"ect-flex ect-gap-2 ect-items-center ect-self-stretch ect-my-auto ect-text-xs ect-font-medium ect-text-black"},NC=["src"],SC={class:"ect-self-stretch ect-my-auto"},BC={key:0,class:"ect-flex ect-gap-2 ect-justify-center ect-items-center ect-self-stretch ect-my-auto ect-w-4 ect-h-4"},IC=ve({__name:"ChatInputFileInfo",props:{fileInfo:{type:Object,required:!0}},emits:["cancel"],setup(t,{emit:r}){const n=r,o=()=>{n("cancel")};return(a,i)=>(e.openBlock(),e.createElementBlock("div",AC,[e.createElementVNode("div",wC,[e.createElementVNode("img",{loading:"lazy",src:t.fileInfo.fileType==="csv"?e.unref(Qc):e.unref(Zc),class:"ect-object-contain ect-shrink-0 ect-self-stretch ect-my-auto ect-w-7 ect-aspect-square",alt:""},null,8,NC),e.createElementVNode("div",SC,e.toDisplayString(t.fileInfo.fileName),1)]),t.fileInfo.status==="uploading"?(e.openBlock(),e.createElementBlock("div",BC,[e.createVNode(ma,{size:18})])):e.createCommentVNode("",!0),t.fileInfo.status==="uploaded"?(e.openBlock(),e.createElementBlock("button",{key:1,class:"ect-flex ect-gap-2 ect-justify-center ect-items-center ect-self-stretch ect-my-auto ect-w-4 ect-h-4",onClick:o},[e.createVNode(Be,{icon:"close",size:"8"})])):e.createCommentVNode("",!0)]))}},[["__scopeId","data-v-24d881bd"]]),TC={class:"chat-input-wrapper"},OC={class:"chat-input-inner"},DC={class:"input-row"},VC=["disabled","placeholder","onKeydown"],FC={key:1,class:"icon-wrapper"},MC={class:"icon-wrapper"},RC=ve({__name:"chatInput",props:{modelValue:{type:String,default:""},loading:{type:Boolean,default:!1},placeholder:{type:String,default:"Ask Genesis AI"},helpText:{type:String,default:"Here are few areas where I can help"},subHelpText:{type:String,default:"Suggestions by Genesis (Click to Apply)"},showFile:{type:Boolean,default:!1},showMic:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","submit","speak","file-upload-status"],setup(t,{emit:r}){const n=t,o=r;Un();const a=Mt(),i=Jn(),l=e.ref({}),s=e.ref(!1),u=e.ref(!1),h=e.ref(n.modelValue),d=e.ref(null),m=e.computed(()=>{const k=i.currentStep||null;return(Array.isArray(k==null?void 0:k.promptGuidance)?k.promptGuidance:[]).slice().sort((w,v)=>Number((w==null?void 0:w.sequenceNumber)??0)-Number((v==null?void 0:v.sequenceNumber)??0)).map(w=>{const S=(Array.isArray(w==null?void 0:w.relatedPG)?w.relatedPG:[]).slice().sort((I,R)=>Number((I==null?void 0:I.sequenceNumber)??0)-Number((R==null?void 0:R.sequenceNumber)??0)).map(I=>I.pgName);return{title:w.pgName,subOptions:S}})}),c=e.computed(()=>{var k;return(k=m.value)!=null&&k.length?m.value:[]}),y=e.computed(()=>{var k;return(k=m.value)!=null&&k.length?"Prompt Guidance":n.helpText});e.watch(()=>n.loading,async(k,B)=>{!k&&B&&(await e.nextTick(),d.value.focus())}),e.watch(h,k=>{o("update:modelValue",k),e.nextTick(()=>_())}),e.watch(()=>n.modelValue,k=>{h.value=k});const f=k=>{console.info("[ERROR]: File upload error:",k),a.handleError(k,"ChatInput")},b=()=>{h.value.trim()&&(u.value=!1,o("submit",h.value),h.value="",d.value&&(d.value.style.height="32px"),l.value=null)},p=k=>{h.value=k,u.value=!1,e.nextTick(()=>{_(),d.value&&(d.value.focus(),d.value.selectionStart=d.value.selectionEnd=h.value.length)})},x=k=>{h.value=k,e.nextTick(()=>_())},g=()=>{u.value=!1},C=k=>{console.info("handleFileUploadStatus event = ",k),k!=null&&k.fileName?(l.value=k,o("file-upload-status",k)):(l.value=null,s.value=!0,o("file-upload-status",null),setTimeout(()=>{s.value=!1},3e3))},_=()=>{const k=d.value;if(!k)return;k.style.height="auto";const w=Math.max(32,Math.min(k.scrollHeight,120));k.style.height=`${w}px`},E=()=>{console.info("removeFile"),l.value=null,s.value=!0,o("file-upload-status",null),setTimeout(()=>{s.value=!1},100)},A=()=>{u.value=!1,_()};return(k,B)=>{var w,v,S,I,R;const D=e.resolveDirective("click-outside");return e.withDirectives((e.openBlock(),e.createElementBlock("div",TC,[e.createVNode(vC,{options:c.value,"help-text":y.value,"sub-help-text":t.subHelpText,"show-suggestions":u.value,onSelect:p,onPreview:x},null,8,["options","help-text","sub-help-text","show-suggestions"]),e.createElementVNode("div",OC,[e.createElementVNode("div",DC,[e.createElementVNode("div",{class:e.normalizeClass(["icon-wrapper",{"active-suggestions":u.value,disabled:((w=c.value)==null?void 0:w.length)<=0}])},[e.createVNode(Be,{disabled:((v=c.value)==null?void 0:v.length)<=0||t.loading,color:((S=c.value)==null?void 0:S.length)<=0?"#DEDEDE":u.value?"#198708":"#828282",icon:"suggestions",size:"13",height:15,onClick:B[0]||(B[0]=z=>u.value=!u.value)},null,8,["disabled","color"])],2),e.withDirectives(e.createElementVNode("textarea",{ref_key:"textareaRef",ref:d,"onUpdate:modelValue":B[1]||(B[1]=z=>h.value=z),disabled:t.loading,placeholder:t.placeholder,rows:"1",onKeydown:e.withKeys(e.withModifiers(b,["exact","prevent"]),["enter"]),onInput:A},null,40,VC),[[e.vModelText,h.value]]),t.showFile?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["icon-wrapper",{"file-upload-disabled":t.loading}])},[e.createVNode(fC,{"reset-file-input":s.value,onUploadStatus:C,onError:f},null,8,["reset-file-input"])],2)):e.createCommentVNode("",!0),t.showMic?(e.openBlock(),e.createElementBlock("div",FC,[e.createVNode(Be,{color:"#828282",disabled:t.loading,icon:"mic",size:"13",height:15,onClick:B[2]||(B[2]=z=>k.$emit("speak"))},null,8,["disabled"])])):e.createCommentVNode("",!0),e.createElementVNode("div",MC,[(e.openBlock(),e.createBlock(Be,{key:1,disabled:t.loading,icon:"send",size:"20",onClick:b},null,8,["disabled"]))])]),((I=l.value)==null?void 0:I.status)==="uploading"||((R=l.value)==null?void 0:R.status)==="uploaded"?(e.openBlock(),e.createBlock(IC,{key:0,class:"ect-mt-3 ect-mb-0.5","file-info":l.value,onCancel:E},null,8,["file-info"])):e.createCommentVNode("",!0)])])),[[D,g]])}}},[["__scopeId","data-v-e205d71c"]]),LC=["data-test-id"],PC=["data-test-id"],qC=["data-test-id"],$C=ve({__name:"aiChat",props:{dataTestId:{type:String,required:!0},isExternalGuidance:{type:Boolean,required:!1,default:!1},styles:{type:Object,required:!1,default:()=>({}),validator:t=>typeof(t==null?void 0:t.height)=="string"}},emits:["component-action"],setup(t,{emit:r}){const n=Jn(),o=r,a=Un(),i=e.ref(null),l=e.computed(()=>{var m;return((m=n.getCurrentStepLinks)==null?void 0:m.call(n))||[]}),s=e.computed(()=>!0),u=m=>{console.info("[aiChat] handleSubmit",{hasFileData:!!i.value,messageLength:(m||"").length}),i.value?(console.info("[aiChat] sending with file attachment"),a.sendMessage(m,!0,i.value)):(console.info("[aiChat] sending without attachment"),a.sendMessage(m))},h=m=>{console.info("ChatScreen handleFileUploadStatus event = ",m),m!=null&&m.fileData?(i.value=m.fileData,a.attachmentData={size:m.size,type:m.fileType,name:m.fileName}):(i.value=null,a.attachmentData=null)},d=m=>{o("component-action",m)};return(m,c)=>(e.openBlock(),e.createElementBlock("div",{class:"chat-screen","data-test-id":t.dataTestId},[e.createElementVNode("div",{class:e.normalizeClass(["messages-container",{"playbook-steps-mode-hybrid":e.unref(n).playbookStepsMode==="hybrid","playbook-steps-mode-full":e.unref(n).playbookStepsMode==="full","dxp-guiddance":t.isExternalGuidance}]),style:e.normalizeStyle({maxHeight:`calc(${t.styles.height} - 72px)`,height:`calc(${t.styles.height} - 72px)`}),"data-test-id":`${t.dataTestId}-messages-container`},[e.createVNode(uC,{messages:e.unref(a).chatHistory,"loading-message":e.unref(a).loadingMessage,"undo-id":e.unref(a).latestDMLRequest,"button-links":l.value,"strikethrough-ids":e.unref(a).strikethroughHistory,"data-changed":e.unref(a).dataManuallyChanged,"data-test-id":`${t.dataTestId}-messages`,onComponentAction:d},null,8,["messages","loading-message","undo-id","button-links","strikethrough-ids","data-changed","data-test-id"])],14,PC),e.createElementVNode("div",{class:"input-container","data-test-id":`${t.dataTestId}-input-container`},[e.createVNode(RC,{modelValue:e.unref(a).promptMessage,"onUpdate:modelValue":c[0]||(c[0]=y=>e.unref(a).promptMessage=y),disabled:!s.value,"file-info":i.value,loading:!!e.unref(a).loadingMessage,"data-test-id":`${t.dataTestId}-input`,onSubmit:u,onFileUploadStatus:h},null,8,["modelValue","disabled","file-info","loading","data-test-id"])],8,qC)],8,LC))}},[["__scopeId","data-v-dcfc28bd"]]),UC={class:"ect-h-full ect-w-full ect-flex ect-items-center ect-justify-center","data-test-id":"configurator-not-found"},zC={class:"ect-max-w-[720px] ect-p-[50px] ect-border ect-rounded-lg ect-bg-white ect-shadow-sm"},jC={class:"ect-text-[40px] ect-leading-none ect-mb-3"},HC=e.createElementVNode("div",{class:"ect-text-[22px] ect-font-normal ect-leading-normal ect-mb-[12px] ect-capitalize ect-text-[#5F5F5F]","data-test-id":"configurator-not-found-title"}," Product Configurator Not Found ",-1),GC=e.createElementVNode("div",{class:"ect-text-sm ect-text-gray-500","data-test-id":"configurator-not-found-subtitle"}," Linked composable product configurator UI component for this screen is not found OR the composable product configurator UI component does not exist. Please create / connect one and try again. ",-1),KC={class:"ect-mt-4 ect-flex ect-items-center ect-justify-between ect-gap-6"},XC={__name:"MoleculeConfiguratorNotFound",emits:["return","go-cart"],setup(t){return(r,n)=>(e.openBlock(),e.createElementBlock("div",UC,[e.createElementVNode("div",zC,[e.createElementVNode("div",jC,[e.createVNode(Be,{icon:"error",size:48})]),HC,GC,e.createElementVNode("div",KC,[e.createElementVNode("button",{type:"button",class:"ect-text-green-600 ect-text-sm ect-font-medium",onClick:n[0]||(n[0]=o=>r.$emit("return")),"data-test-id":"configurator-not-found-return"}," RETURN TO PRODUCT RESULTS "),e.createElementVNode("button",{type:"button",class:"ect-text-green-600 ect-text-sm ect-font-medium",onClick:n[1]||(n[1]=o=>r.$emit("go-cart")),"data-test-id":"configurator-not-found-go-to-cart"}," GO TO CART ")])])]))}},n0=t=>(e.pushScopeId("data-v-bf75aa89"),t=t(),e.popScopeId(),t),WC={class:"ect-h-full ect-w-full ect-bg-white","data-test-id":"aiComponentLoader-wrapper"},QC={key:2,class:"ect-h-full ect-w-full ect-flex ect-items-center ect-justify-center","data-test-id":"aiComponentLoader-cart-error"},ZC=[n0(()=>e.createElementVNode("div",{class:"ect-text-center"},[e.createElementVNode("div",{class:"ect-text-base ect-font-medium ect-text-red-600","data-test-id":"aiComponentLoader-cart-error-title"}," Quote Required "),e.createElementVNode("div",{class:"ect-text-sm ect-text-gray-500 ect-mt-2","data-test-id":"aiComponentLoader-cart-error-message"}," A quote is required for the cart component to work. Please ensure a quoteId is provided in the session prop. ")],-1))],JC={key:5,class:"ect-h-full ect-w-full ect-flex ect-items-center ect-justify-center"},YC={class:"ect-text-center"},eE=n0(()=>e.createElementVNode("div",{class:"ect-text-base ect-font-medium","data-test-id":"aiComponentLoader-fallback-title"}," No component to display for this step ",-1)),tE={class:"ect-text-sm ect-text-gray-500 ect-mt-2","data-test-id":"aiComponentLoader-fallback-subtitle"},nE=ve({__name:"aiComponentLoader",props:{stepComponent:{type:String,default:null},identity:{type:Object,default:()=>({})},session:{type:Object,default:()=>({})},security:{type:Object,default:()=>({})},packageVersion:{type:String,default:""},composablesOrgType:{type:String,default:""},composablesApiKey:{type:String,default:""},templateId:{type:String,default:""},hostName:{type:String,default:""},graphqlEndpoint:{type:String,default:""},apiKey:{type:String,default:""},isPreview:{type:Boolean,default:!1},sections:{type:Array,default:()=>[]},theme:{type:Object,default:()=>({})},catalogPreviewData:{type:Object,default:()=>({})},catalogInitialData:{type:Array,default:()=>[]},catalogSearchTerm:{type:String,default:""},onCatalogCountUpdate:{type:Function,default:null},cartSections:{type:String,default:""},configItemId:{type:String,default:""},configQliId:{type:String,default:""},configApiKey:{type:String,default:""},functions:{type:Object,default:()=>({})},resources:{type:Object,required:!1}},emits:["expeditecart-clicked","ai-guidance:error","catalog-quote-created","catalog-quote-updated","catalog-items-loaded","catalog-item-added","catalog-item-qty-updated","catalog-line-deleted","catalog-items-fetched","catalog-item-configure"],setup(t,{emit:r}){const n=r,o=t,a=Jn(),i=Ci(),l=ft(),s=e.computed(()=>{var j,H,Z,te,ne;const L=((j=o.session)==null?void 0:j.quoteId)||((H=l.quoteId)==null?void 0:H.value)||((Z=a==null?void 0:a.activeComponentData)==null?void 0:Z.contextObjectId)||((ne=(te=a==null?void 0:a.activeComponentData)==null?void 0:te.payload)==null?void 0:ne.contextObjectId);return{...o.session,...L&&{quoteId:L},qliId:p.value||o.configQliId||void 0,itemId:b.value}}),u=e.computed(()=>{const L=o.functions||{},j=L.createQuote;return typeof j!="function"?L:{...L,createQuote:async(...H)=>{const Z=await j(...H);return Z&&l.updateConfig({quoteId:Z}),Z}}}),h=e.computed(()=>{const L=a==null?void 0:a.activeComponentKey,j=o.stepComponent;return(L||j||"").toString().trim().toLowerCase().replace(/[^a-z0-9]+/g,"_")}),d=e.computed(()=>{var te,ne;const L=!!o.templateId,j=!!((te=o.identity)!=null&&te.organizationId),H=!!((ne=o.identity)!=null&&ne.accountId),Z=typeof o.cartSections=="string"&&o.cartSections.length>0;return L&&j&&H&&Z}),m=e.computed(()=>{var Z,te,ne,Q,ce;const L=(Z=o.session)==null?void 0:Z.quoteId,j=(te=l.quoteId)==null?void 0:te.value,H=((ne=a==null?void 0:a.activeComponentData)==null?void 0:ne.contextObjectId)||((ce=(Q=a==null?void 0:a.activeComponentData)==null?void 0:Q.payload)==null?void 0:ce.contextObjectId);return!!(L||j||H)}),c=e.computed(()=>{var j,H,Z,te,ne;const L=((j=o.session)==null?void 0:j.quoteId)||((H=l.quoteId)==null?void 0:H.value)||((Z=a==null?void 0:a.activeComponentData)==null?void 0:Z.contextObjectId)||((ne=(te=a==null?void 0:a.activeComponentData)==null?void 0:te.payload)==null?void 0:ne.contextObjectId);return{...o.session,...L&&{quoteId:L}}}),y=e.computed(()=>{var j;if(Array.isArray(o.catalogInitialData)&&o.catalogInitialData.length>0)return o.catalogInitialData;const L=((j=a==null?void 0:a.activeComponentData)==null?void 0:j.payload)||{};if(L.catalog&&typeof L.catalog=="object")try{const Z=Object.values(L.catalog).map(te=>{var ne;return(ne=te==null?void 0:te.catalogResponse)==null?void 0:ne.productInfo}).filter(Boolean);if(Z.length>0)return Z}catch{}return Array.isArray(L.initialData)&&L.initialData.length>0?L.initialData:Array.isArray(L.catalogInitialData)&&L.catalogInitialData.length>0?L.catalogInitialData:Array.isArray(L.items)&&L.items.length>0?L.items:[]}),f=e.computed(()=>{var j;const L=((j=a==null?void 0:a.activeComponentData)==null?void 0:j.payload)||{};return o.catalogSearchTerm||L.searchTerm||""}),b=e.computed(()=>{var H,Z,te,ne,Q,ce,ue,pe;const L=(te=(Z=(H=a==null?void 0:a.activeComponentData)==null?void 0:H.payload)==null?void 0:Z.productConfiguration)==null?void 0:te[0],j=((ue=(ce=(Q=(ne=a==null?void 0:a.activeComponentData)==null?void 0:ne.payload)==null?void 0:Q.savedProducts)==null?void 0:ce[0])==null?void 0:ue.itemId)||(L==null?void 0:L.itemId)||((pe=L==null?void 0:L.product)==null?void 0:pe.itemId)||"";return o.configItemId||j||""}),p=e.computed(()=>{var j,H,Z,te,ne,Q;const L=(te=(Z=(H=(j=a==null?void 0:a.activeComponentData)==null?void 0:j.payload)==null?void 0:H.savedProducts)==null?void 0:Z[0])==null?void 0:te.qliId;if(!L){const ce=(Q=(ne=a==null?void 0:a.activeComponentData)==null?void 0:ne.payload)==null?void 0:Q.productConfiguration,ue=Array.isArray(ce)&&ce.length>0?ce[0]:null;if(ue){const pe=ue==null?void 0:ue.product;if(pe!=null&&pe.qliId)return pe.qliId;if(ue!=null&&ue.qliId)return ue.qliId}}return L||""}),x=e.computed(()=>!!b.value),g=e.computed(()=>h.value==="configurator"&&!x.value?"Configurator requires an itemId (and optional qliId). Provide via playbook payload or props.":h.value==="catalog"?"Catalog step is active. Provide templateId/sections/theme when available.":h.value==="cart"?"Cart step is active.":"Awaiting playbook step selection."),C=e.computed(()=>{try{return JSON.stringify((a==null?void 0:a.activeComponentData)||{})}catch{return""}}),_=e.computed(()=>`catalog::${C.value}`),E=e.computed(()=>`cart::${C.value}`),A=e.computed(()=>{var L;try{return(((L=a==null?void 0:a.activeComponentData)==null?void 0:L.actionFunction)||"")==="Reload"}catch{return!1}}),k=e.computed(()=>{var j;const L=`configurator::${b.value||""}::${p.value||""}`;if(A.value){const H=((j=a==null?void 0:a.activeComponentData)==null?void 0:j.requestId)||"";return`${L}::${H}`}return L}),{emitError:B,emitErrors:D}=Wc(n,"aiComponentLoader"),w=()=>{const L=q7(a,h.value);D(L)},v=e.ref([]),S=e.ref(null),I=L=>{const j=Array.isArray(L)?L:Array.isArray(L==null?void 0:L.items)?L.items:[];if(!Array.isArray(j))return;const H={"Needs Configuration":1,"Suggests Configuration":2,"Fully Configured":3},Z=Q=>(Q==null?void 0:Q.requiresConfiguration)||"",te=Q=>!!Q&&Q in H,ne=j.filter(Q=>te(Z(Q)));ne.sort((Q,ce)=>{const ue=Z(Q),pe=Z(ce);return(H[ue]||99)-(H[pe]||99)}),v.value=ne,S.value=ne.length?ne[0]:null},R=L=>{console.log("onQuoteCreated",L),n("catalog-quote-created",L)},z=L=>{console.log("onQuoteUpdated",L),n("catalog-quote-updated",L)},$=L=>{console.log("onItemAdded",L),n("catalog-item-added",L)},X=L=>{console.log("onItemQtyUpdated",L),n("catalog-item-qty-updated",L)},W=L=>{console.log("onLineDeleted",L),n("catalog-line-deleted",L)},K=L=>{console.log("onQuoteItemsFetched",L),n("catalog-items-fetched",L)};e.watch(()=>h.value,(L,j)=>{var H,Z,te,ne,Q,ce,ue,pe,ie,de;if(L==="configurator"){const _e=!!((te=(Z=(H=a==null?void 0:a.activeComponentData)==null?void 0:H.payload)==null?void 0:Z.savedProducts)!=null&&te.length),xe=((ce=(Q=(ne=a==null?void 0:a.activeComponentData)==null?void 0:ne.payload)==null?void 0:Q.productConfiguration)==null?void 0:ce.length)>0;if(!_e&&!xe&&S.value&&!b.value){const ye=((ue=S.value)==null?void 0:ue.itemId)||"";if(ye){const oe=((pe=a==null?void 0:a.currentPlaybook)==null?void 0:pe.playBookSteps)||[],le=se=>String(se||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_");let be=null;const Ce=oe.findIndex(se=>se.stepName===(a==null?void 0:a.currentStepName));if(Ce>=0&&oe[Ce+1]&&le((ie=oe[Ce+1])==null?void 0:ie.stepComponent)==="configurator")be=oe[Ce+1].stepName;else{const se=oe.findIndex(fe=>le(fe==null?void 0:fe.stepComponent)==="configurator");be=se>=0?(de=oe[se])==null?void 0:de.stepName:null}const J={payload:{savedProducts:[{itemId:ye}]}};be?a.navigateToStep({stepName:be,data:J}):a.loadComponent("configurator",J)}}}});const P=()=>{var Z,te;const L=((Z=a==null?void 0:a.currentPlaybook)==null?void 0:Z.playBookSteps)||[],j=ne=>String(ne||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_"),H=L.findIndex(ne=>j(ne==null?void 0:ne.stepComponent)==="catalog"||j(ne==null?void 0:ne.stepName).includes("catalog"));if(H>=0){const ne=(te=L[H])==null?void 0:te.stepName;a.navigateToStep({stepName:ne})}else a.loadComponent("catalog")},N=()=>{var Z,te;const L=((Z=a==null?void 0:a.currentPlaybook)==null?void 0:Z.playBookSteps)||[],j=ne=>String(ne||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_"),H=L.findIndex(ne=>j(ne==null?void 0:ne.stepComponent)==="cart"||j(ne==null?void 0:ne.stepName).includes("cart"));if(H>=0){const ne=(te=L[H])==null?void 0:te.stepName;a.navigateToStep({stepName:ne})}else a.loadComponent("cart")},T=L=>{var j,H;console.log("onItemConfigureClicked",L),n("catalog-item-configure",L);try{const Z=(L==null?void 0:L.itemId)||"",te=(L==null?void 0:L.qliId)||(L==null?void 0:L.QliId)||"",ne=[];if(Z){const ie={itemId:Z};te&&(ie.qliId=te),ne.push(ie)}const Q={payload:{savedProducts:ne}},ce=((j=a==null?void 0:a.currentPlaybook)==null?void 0:j.playBookSteps)||[],ue=ie=>String(ie||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_"),pe=ce.findIndex(ie=>{const de=ue(ie==null?void 0:ie.stepComponent),_e=ue(ie==null?void 0:ie.stepName);return de==="configurator"||_e.includes("configure")});if(pe>=0){const ie=(H=ce[pe])==null?void 0:H.stepName;a.navigateToStep({stepName:ie,data:Q})}else a.loadComponent("configurator",Q)}catch(Z){console.warn("[aiComponentLoader] Failed to navigate to configurator from configure click:",Z),a.loadComponent("configurator",{payload:{}})}},O=L=>{console.log("onCartClicked",L),n("expeditecart-clicked",L)},F=L=>{var j,H;try{const Z=(L==null?void 0:L.itemId)||"",te=(L==null?void 0:L.lineItemId)||(L==null?void 0:L.qliId)||"",ne=[];if(Z){const ie={itemId:Z};te&&(ie.qliId=te),ne.push(ie)}const Q={payload:{savedProducts:ne}},ce=((j=a==null?void 0:a.currentPlaybook)==null?void 0:j.playBookSteps)||[],ue=ie=>String(ie||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_"),pe=ce.findIndex(ie=>{const de=ue(ie==null?void 0:ie.stepComponent),_e=ue(ie==null?void 0:ie.stepName);return de==="configurator"||_e.includes("configure")});if(pe>=0){const ie=(H=ce[pe])==null?void 0:H.stepName;a.navigateToStep({stepName:ie,data:Q})}else a.loadComponent("configurator",Q)}catch(Z){console.warn("[aiComponentLoader] Failed to navigate to configurator from cart configure click:",Z),a.loadComponent("configurator",{payload:{}})}},q=L=>{console.log("onCatalogIdReceived",L),l.updateConfig({eCatalogId:L})},M=L=>{console.log("Action",L),L.event==="add-to-quote"?n("configurator:add-to-quote",L.data):L.event==="save"&&n("configurator:save",L.data)},U=e.ref("");return e.watch(()=>a==null?void 0:a.activeComponentData,async L=>{var H,Z,te,ne;if(!L)return;console.log("activeComponentData Changed",L);const j=(L==null?void 0:L.requestId)||"";if(console.log("requestId",j),console.log("lastReloadRequestId",U.value),j&&j!==U.value)if(U.value=j,await e.nextTick(),((Z=(H=L==null?void 0:L.payload)==null?void 0:H.productConfiguration)==null?void 0:Z.length)>0){const Q=(te=L==null?void 0:L.payload)==null?void 0:te.productConfiguration[0],ce=(Q==null?void 0:Q.itemId)||((ne=Q==null?void 0:Q.product)==null?void 0:ne.itemId)||"";i.setPreConfigData(L==null?void 0:L.payload,ce)}else(L==null?void 0:L.actionFunction)==="Reload"&&(console.log("Reloading configurator 1"),i.refresh())},{deep:!0}),e.onMounted(()=>{e.nextTick(()=>{w()})}),(L,j)=>(e.openBlock(),e.createElementBlock("div",WC,[h.value==="catalog"?(e.openBlock(),e.createBlock(wr,{key:_.value,"data-test-id":"aiComponentLoader-catalog",class:"ect-h-full ect-w-full","template-id":t.templateId,identity:t.identity,session:t.session,security:t.security,"search-term":f.value,"on-catalog-count-update":t.onCatalogCountUpdate,"preview-data":t.catalogPreviewData,"initial-data":y.value,sections:t.sections,theme:t.theme,"composables-org-type":t.composablesOrgType,onCatalogQuoteCreated:R,onCatalogQuoteUpdated:z,onCatalogItemsLoaded:I,onCatalogItemAdded:$,onCatalogItemQtyUpdated:X,onCatalogLineDeleted:W,onCatalogItemsFetched:K,onCatalogItemConfigure:T,"onCatalog:id":q},null,8,["template-id","identity","session","security","search-term","on-catalog-count-update","preview-data","initial-data","sections","theme","composables-org-type"])):h.value==="cart"&&d.value&&m.value?(e.openBlock(),e.createBlock(Nr,{key:E.value,"data-test-id":"aiComponentLoader-cart",class:"ect-h-full ect-w-full","template-id":t.templateId,"host-name":t.hostName,"composables-org-type":t.composablesOrgType,security:t.security,identity:t.identity,session:c.value,onExpeditecartItemConfigure:F,onExpeditecartClicked:O},null,8,["template-id","host-name","composables-org-type","security","identity","session"])):h.value==="cart"&&d.value&&!m.value?(e.openBlock(),e.createElementBlock("div",QC,ZC)):h.value==="configurator"&&x.value?(e.openBlock(),e.createBlock(yr,{key:k.value,"data-test-id":"aiComponentLoader-configurator",class:"ect-h-full ect-w-full",security:t.security,identity:t.identity,resources:t.resources,"user-locale":L.userLocale,cart:!0,"composables-org-type":t.composablesOrgType,session:s.value,functions:u.value,onReady:e.unref(i).setExpediteConfigComp,onAction:M},null,8,["security","identity","resources","user-locale","composables-org-type","session","functions","onReady"])):h.value==="configurator"&&!x.value?(e.openBlock(),e.createBlock(XC,{key:4,onReturn:P,onGoCart:N})):(e.openBlock(),e.createElementBlock("div",JC,[e.createElementVNode("div",YC,[eE,e.createElementVNode("div",tE,e.toDisplayString(g.value),1)])]))]))}},[["__scopeId","data-v-bf75aa89"]]),oE={class:"ai-guidance-loader","data-test-id":"aiGuidance-loader-container"},rE={"data-test-id":"aiGuidance-loader-text"},aE={class:"aig-button","data-test-id":"aiGuidance-loader-button"},iE={class:"aig-input-box","data-test-id":"aiGuidance-loader-input"},lE=ve({__name:"AiGuidanceLoader",props:{errors:{type:Array,required:!1,default:()=>[]},chatBgColor:{type:String,required:!1,default:""}},setup(t){const r=t,n=e.computed(()=>`linear-gradient(180deg, ${r.chatBgColor} 0%, transparent 100%)`);return(o,a)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:"chat-gradient",style:e.normalizeStyle({background:n.value})},null,4),e.createElementVNode("div",oE,[e.createElementVNode("div",rE,[e.createVNode(So,{style:{width:"100%",height:"16px","margin-bottom":"8px"}}),e.createVNode(So,{style:{width:"100%",height:"16px","margin-bottom":"32px","max-width":"481px"}})]),e.createElementVNode("div",aE,[e.createVNode(So,{style:{width:"100%",height:"24px"}})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.errors,i=>(e.openBlock(),e.createElementBlock("div",{key:i,class:"aig-message-error","data-test-id":"aiGuidance-loader-error"},e.toDisplayString(i),1))),128)),e.createElementVNode("div",iE,[e.createVNode(So,{style:{height:"36px",width:"100%"}})])])],64))}},[["__scopeId","data-v-5e4a9913"]]),sE={class:"ai-guidance-wrapper","data-test-id":"aiGuidance-wrapper"},Qi=ve({__name:"aiGuidance",props:{templateId:{type:String,required:!1},playbookData:{type:Object,required:!1},composablesOrgType:{type:String,required:!0},identity:{type:Object,required:!1,default:()=>({})},session:{type:Object,required:!1,default:()=>({})},security:{type:Object,required:!1,default:()=>({})},functions:{type:Object,required:!1,default:()=>({})},websocketUrl:{type:String,required:!0},packageVersion:{type:String,required:!0},hostName:{type:String,required:!1},graphqlEndpoint:{type:String,required:!1},apiKey:{type:String,required:!1},isPreview:{type:Boolean,required:!1,default:!1},catalogSections:{type:Array,required:!1,default:()=>[]},cartSections:{type:String,required:!1,default:""},theme:{type:Object,required:!1,default:()=>({})},styles:{type:Object,required:!1,default:()=>({height:"100vh"}),validator:t=>typeof(t==null?void 0:t.height)=="string"},resources:{type:Object,required:!1,default:()=>({})}},emits:["expeditecart-item-configure","expeditecart-clicked","component-action","ai-response:success","quote-id:updated","ai-guidance:error"],setup(t,{emit:r}){const n=Jn(),o=ft(),a=Un(),i=Co(),l=r,s=e.ref(!0),u=e.ref(!1),h=e.ref(!0),d=e.ref(!0),m=e.ref(!1),c=e.ref([]),{emitError:y,emitErrors:f}=Wc(l,"aiGuidance"),b=t,{composablesOrgType:p,websocketUrl:x,packageVersion:g,identity:C,session:_,security:E,functions:A,templateId:k,hostName:B,graphqlEndpoint:D,apiKey:w,isPreview:v,catalogSections:S,cartSections:I,theme:R}=b,z=e.computed(()=>{var F,q,M;return{...b.session||{},quoteId:((F=b.session)==null?void 0:F.quoteId)||(((q=o.quoteId)==null?void 0:q.value)??""),eCatalogId:(M=o.eCatalogId)==null?void 0:M.value}});e.onBeforeMount(async()=>{var F;console.log("security",E),console.log("apiKey",w),o.updateConfig({userId:C==null?void 0:C.userId,organizationId:C==null?void 0:C.organizationId,accessToken:E==null?void 0:E.accessToken,composablesApiUrl:E==null?void 0:E.baseUrl,composablesOrgType:p,websocketUrl:x,quoteId:_==null?void 0:_.quoteId,packageVersion:g,accountId:C==null?void 0:C.accountId,templateId:k,hostName:B,graphqlEndpoint:D,apiKey:(E==null?void 0:E.apiKey)||w,cid:C==null?void 0:C.contactId,isPreview:v,siteUrl:(F=b.resources)==null?void 0:F.siteUrl})}),e.onMounted(async()=>{var j,H,Z,te;const F=L7(b,C,E);f(F);const q=Xc(x);if(q&&y(q),F.length>0||q){s.value=!1;return}n.setSecretKey(E==null?void 0:E.accessToken);let M=null,U,L;try{M=await n.getPlaybookInfoFromQuote(),U=(M==null?void 0:M.XX_ORD1__Completed_PB_Step_Number_EX__c)??void 0,L=(M==null?void 0:M.XX_ORD1__Playbook_Current_Step_Meta_EX__c)??void 0}catch(ne){console.error("[aiGuidance] Failed to get playbook info from quote:",ne),y("AI_GUIDANCE_PLAYBOOK_INFO_FETCH_FAILED",{error:ne.message})}if(L)try{L=JSON.parse(L)}catch(ne){console.error("[aiGuidance] Failed to parse currentStepMetaServer:",ne),y("AI_GUIDANCE_JSON_PARSE_ERROR",{error:ne.message,data:"currentStepMetaServer"}),L=void 0}if(console.info("sequenceNumberServer = ",U),b.templateId){s.value=!0;try{const Q=await n.getCatalogInContext();console.log("catalogInContext = ",Q),Q&&o.updateConfig({eCatalogId:Q})}catch(Q){console.error("[aiGuidance] Failed to get catalog in context:",Q),y("AI_GUIDANCE_CATALOG_FETCH_FAILED",{error:Q.message})}let ne=null;try{await i.fetchBlockInformationREST({templateId:b.templateId});const Q=P7(i.pageBlocks);ne=Q.playbookId,Q.error&&y(Q.error,{error:"Block structure validation failed"}),ne||y("AI_GUIDANCE_BLOCK_PLAYBOOK_ID_MISSING",{pageBlocks:i.pageBlocks})}catch(Q){console.error("[aiGuidance] Failed to fetch block information:",Q),y("AI_GUIDANCE_BLOCK_FETCH_FAILED",{error:Q.message})}if(console.log("playbookID",ne),ne?u.value=!0:c.value.push("No playbook ID found in template"),n.setEmbeddedMode(!0),ne)try{n.currentPlaybook=ne,await n.getPlaybookByKey(ne),n.showPlaybookSteps=!0}catch(Q){console.error("[aiGuidance] Failed to get playbook by key:",Q),y("AI_GUIDANCE_PLAYBOOK_FETCH_FAILED",{error:Q.message,playbookID:ne})}n.playbookStepsMode="full",a.setInitialPayload();try{await a.connectSocket()}catch(Q){console.error("[aiGuidance] Failed to connect socket:",Q),y("WEBSOCKET_CONNECTION_FAILED",{error:Q.message})}if(U!==void 0){n.navigateToStep({stepName:(H=(j=n.currentPlaybook)==null?void 0:j.playBookSteps[Number(U)])==null?void 0:H.stepName,data:L}),s.value=!1;return}(te=(Z=n.currentPlaybook)==null?void 0:Z.playBookSteps)!=null&&te.length&&n.setCurrentStepName(n.currentPlaybook.playBookSteps[0].stepName),s.value=!1}else c.value.push("templateId is required")});const $=e.computed(()=>{var M;const F=((M=n.currentPlaybook)==null?void 0:M.playBookSteps)||[],q=n.currentStepName;return F.find(U=>U.stepName===q)||F[0]||null}),X=e.computed(()=>{var F;return((F=$.value)==null?void 0:F.stepComponent)||null});e.watch(()=>n.activeComponentKey,F=>{F&&(h.value=!1)});const W=[];e.onMounted(()=>{W.push(Lt("expeditecart:configure-clicked",F=>{l("expeditecart-item-configure",F)})),W.push(Lt("expeditecart:clicked",F=>{l("expeditecart-clicked",F)})),W.push(Lt("ai-response:success",F=>{try{l("ai-response:success",F)}catch{}})),W.push(Lt("quote-id:updated",F=>{try{l("quote-id:updated",F)}catch(q){console.info("[aiGuidance] Error emitting quote-id:updated event:",q)}})),W.push(Lt("websocket:error",F=>{try{F!=null&&F.isInitialization&&y(F.errorCode||"WEBSOCKET_CONNECTION_FAILED",F)}catch(q){console.info("[aiGuidance] Error handling websocket error event:",q)}}))});const K=F=>{console.log("[aiGuidance] Received error from aiComponentLoader:",F),l("ai-guidance:error",F)},P=F=>{console.log("onExpediteCartClicked",F),l("component-action",{component:"cart",details:F})},N=(F,q)=>{var U;l("component-action",{component:"catalog",action:F,details:q});const M=(q==null?void 0:q.quoteId)??((U=q==null?void 0:q.response)==null?void 0:U.quoteId);if(M&&(F==="item-added"||F==="items-fetched"))try{l("quote-id:updated",{quoteId:M})}catch(L){console.info("[aiGuidance] Error emitting quote-id:updated from catalog event:",L)}},T=(F,q)=>{l("component-action",{component:"configurator",action:F,details:q})},O=F=>{l("component-action",F)};return e.onBeforeUnmount(()=>{try{a.cancelRequest()}catch{}try{a.disconnectSocket()}catch{}try{a.resetState()}catch{}try{n.setEmbeddedMode(!1),n.currentPlaybook=null,n.currentStepName=null,n.activeComponentKey=null,n.activeComponentData=null,n.showPlaybookSteps=!1,n.playbookStepsMode="full"}catch{}s.value=!1,u.value=!1,h.value=!0,d.value=!0,m.value=!1,c.value=[],W.forEach(F=>{try{F()}catch{}})}),(F,q)=>{var M;return e.openBlock(),e.createElementBlock("div",sE,[e.createVNode(pa,{icon:"logo",color:"#000000",size:"18.75",height:"16.25"}),s.value||e.unref(a).isFetchingHistory?(e.openBlock(),e.createBlock(lE,{key:0,errors:c.value,"data-test-id":"aiGuidance-loader"},null,8,["errors"])):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["ai-app",{"root-path":h.value,"playbook-steps-mode-full":e.unref(n).playbookStepsMode==="full","dxp-guiddance":u.value}]),style:e.normalizeStyle(t.styles)},[e.createElementVNode("div",{class:"ai-app-chat-wrapper",style:e.normalizeStyle({height:t.styles.height})},[e.createVNode($C,{"data-test-id":"chat-screen","is-external-guidance":u.value,styles:t.styles,onComponentAction:O},null,8,["is-external-guidance","styles"])],4),!h.value&&d.value&&!m.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"component-loader-wrapper",style:e.normalizeStyle({height:t.styles.height,maxHeight:t.styles.height})},[e.unref(n).currentPlaybook?(e.openBlock(),e.createBlock(nE,{key:0,"template-id":((M=$.value)==null?void 0:M.templateId)||e.unref(k),"step-component":X.value,identity:e.unref(C),session:z.value,security:e.unref(E),functions:e.unref(A),"composables-org-type":e.unref(p),"package-version":e.unref(g),"host-name":e.unref(B),"graphql-endpoint":e.unref(D),"api-key":e.unref(w),"is-preview":e.unref(v),sections:e.unref(S),"cart-sections":e.unref(I),theme:e.unref(R),resources:t.resources,"data-test-id":"aiComponentLoader-mounted",onExpeditecartClicked:P,onCatalogQuoteCreated:q[0]||(q[0]=U=>N("quote-created",U)),onCatalogQuoteUpdated:q[1]||(q[1]=U=>N("quote-updated",U)),onCatalogItemsLoaded:q[2]||(q[2]=U=>N("items-loaded",U)),onCatalogItemAdded:q[3]||(q[3]=U=>N("item-added",U)),onCatalogItemQtyUpdated:q[4]||(q[4]=U=>N("item-qty-updated",U)),onCatalogLineDeleted:q[5]||(q[5]=U=>N("line-deleted",U)),onCatalogItemsFetched:q[6]||(q[6]=U=>N("items-fetched",U)),onCatalogItemConfigure:q[7]||(q[7]=U=>N("item-configure",U)),"onConfigurator:addToQuote":q[8]||(q[8]=U=>T("add-to-quote",U)),"onConfigurator:save":q[9]||(q[9]=U=>T("save",U)),"onAiGuidance:error":K},null,8,["template-id","step-component","identity","session","security","functions","composables-org-type","package-version","host-name","graphql-endpoint","api-key","is-preview","sections","cart-sections","theme","resources"])):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0)],6))])}}},[["__scopeId","data-v-7835e48c"]]),o0={ExpediteConfigurator:yr,ExpediteGPT:wa,ExpediteCatalog:wr,ExpediteCart:Nr,ExpediteAIGuidance:Qi},cE={install(t,r={}){t.component("ExpediteConfigurator",yr),t.component("ExpediteGPT",wa),t.component("ExpediteCatalog",wr),t.component("ExpediteCart",Nr),t.component("ExpediteAIGuidance",Qi)},...o0};bt.Components=o0,bt.ExpediteAIGuidance=Qi,bt.ExpediteCart=Nr,bt.ExpediteCatalog=wr,bt.ExpediteConfigurator=yr,bt.ExpediteGPT=wa,bt.default=cE,bt.useComRootStore=wo,Object.defineProperties(bt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});