randmarcomps 1.146.0 → 1.147.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/randmarcomps.js
CHANGED
|
@@ -50247,17 +50247,17 @@ const getComponent = (t, e) => {
|
|
|
50247
50247
|
if (!Array.isArray(t)) return null;
|
|
50248
50248
|
const e = t, n = e.filter((f) => f.ContentType === "Product").map((f) => f.Content).filter((f) => f.MPN), i = e.filter((f) => f.ContentType === "Manufacturer").map((f) => f.Content).filter((f) => f.ManufacturerId), o = e.filter((f) => f.ContentType === "Category").map((f) => f.Content).filter((f) => f.CategoryName), l = e.filter((f) => f.ContentType === "Order").map((f) => f.Content).filter((f) => f.OrderNumber), u = e.filter((f) => f.ContentType === "Invoice").map((f) => f.Content).filter((f) => f.OrderNumber), d = e.filter((f) => f.ContentType === "Shipment").map((f) => f.Content).filter((f) => f.ShipmentNumber);
|
|
50249
50249
|
return n.length + i.length + o.length + l.length + u.length + d.length == 0 ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
50250
|
-
n.length && /* @__PURE__ */ jsx("h1", { className: "font-bold mt-5", children: "Product(s)" }),
|
|
50250
|
+
n.length > 0 && /* @__PURE__ */ jsx("h1", { className: "font-bold mt-5", children: "Product(s)" }),
|
|
50251
50251
|
n.map((f) => /* @__PURE__ */ jsx("div", { className: "mt-2 mb-2", children: /* @__PURE__ */ jsx(ProductCard, { item: f }) })),
|
|
50252
|
-
i.length && /* @__PURE__ */ jsx("h1", { className: "font-bold mt-5", children: "Manufacturer(s)" }),
|
|
50252
|
+
i.length > 0 && /* @__PURE__ */ jsx("h1", { className: "font-bold mt-5", children: "Manufacturer(s)" }),
|
|
50253
50253
|
i.map((f) => /* @__PURE__ */ jsx("div", { className: "mt-2 mb-2", children: /* @__PURE__ */ jsx(ManufacturerCard, { manufacturer: f }) })),
|
|
50254
|
-
o.length && /* @__PURE__ */ jsx("h1", { className: "font-bold mt-5", children: "Category(ies)" }),
|
|
50254
|
+
o.length > 0 && /* @__PURE__ */ jsx("h1", { className: "font-bold mt-5", children: "Category(ies)" }),
|
|
50255
50255
|
o.map((f) => /* @__PURE__ */ jsx("div", { className: "mt-2 mb-2", children: /* @__PURE__ */ jsx(CategoryCard, { category: f }) })),
|
|
50256
|
-
l.length && /* @__PURE__ */ jsx("h1", { className: "font-bold mt-5", children: "Order(s)" }),
|
|
50256
|
+
l.length > 0 && /* @__PURE__ */ jsx("h1", { className: "font-bold mt-5", children: "Order(s)" }),
|
|
50257
50257
|
l.map((f) => /* @__PURE__ */ jsx("div", { className: "mt-2 mb-2", children: /* @__PURE__ */ jsx(OrderCard, { order: f }) })),
|
|
50258
|
-
u.length && /* @__PURE__ */ jsx("h1", { className: "font-bold mt-5", children: "Invoice(s)" }),
|
|
50258
|
+
u.length > 0 && /* @__PURE__ */ jsx("h1", { className: "font-bold mt-5", children: "Invoice(s)" }),
|
|
50259
50259
|
u.map((f) => /* @__PURE__ */ jsx("div", { className: "mt-2 mb-2", children: /* @__PURE__ */ jsx(InvoiceCard, { invoice: f }) })),
|
|
50260
|
-
d.length && /* @__PURE__ */ jsx("h1", { className: "font-bold mt-5", children: "Shipment(s)" }),
|
|
50260
|
+
d.length > 0 && /* @__PURE__ */ jsx("h1", { className: "font-bold mt-5", children: "Shipment(s)" }),
|
|
50261
50261
|
d.map((f) => /* @__PURE__ */ jsx("div", { className: "mt-2 mb-2", children: /* @__PURE__ */ jsx(ShipmentCard, { shipment: f }) }))
|
|
50262
50262
|
] });
|
|
50263
50263
|
};
|
|
@@ -775,7 +775,7 @@ Hook ${d} was either not provided or not a function.`)}return{name:reactHooksMod
|
|
|
775
775
|
* SPDX-License-Identifier: Apache-2.0
|
|
776
776
|
*/const LANGUAGE_LABEL_PREFIX="gl-node/";class GoogleGenAI{constructor(e){var n;if(e.apiKey==null)throw new Error("An API Key must be set when running in a browser");if(e.project||e.location)throw new Error("Vertex AI project based authentication is not supported on browser runtimes. Please do not provide a project or location.");this.vertexai=(n=e.vertexai)!==null&&n!==void 0?n:!1,this.apiKey=e.apiKey,this.apiVersion=e.apiVersion;const i=new WebAuth(this.apiKey);this.apiClient=new ApiClient({auth:i,apiVersion:this.apiVersion,apiKey:this.apiKey,vertexai:this.vertexai,httpOptions:e.httpOptions,userAgentExtra:LANGUAGE_LABEL_PREFIX+"web",uploader:new BrowserUploader}),this.models=new Models(this.apiClient),this.live=new Live(this.apiClient,i,new BrowserWebSocketFactory),this.chats=new Chats(this.models,this.apiClient),this.caches=new Caches(this.apiClient),this.files=new Files(this.apiClient),this.operations=new Operations(this.apiClient)}}const bodyKey="TheRequestBody";async function fetchApiFunctions(){var t,e;try{const n=await fetch("https://api.randmar.io/swagger/V4/swagger.json");if(!n.ok)throw new Error("Failed to fetch Swagger spec");const i=await n.json(),o=[];for(const[l,u]of Object.entries(i.paths)){const d=["get","post","put","delete"];for(const f of d){const p=u[f];if(!p||p["x-allowed-for-chatbots"]!==!0)continue;const m=l.split("/").filter(Boolean);let g=`${f}_${m.slice(1).join("_")}`;g=g.replace(/[^a-zA-Z0-9_.-]/g,"_"),g.length>60&&(g=g.substring(0,60));const b={},_=[];(t=p.parameters)==null||t.forEach(E=>{b[E.name]={type:E.schema.type,description:E.description||`The ${E.name} parameter`},E.required&&_.push(E.name)});const C=((e=p.parameters)==null?void 0:e.filter(E=>E.in==="path").map(E=>E.name))||[];(f==="post"||f==="put")&&p.requestBody&&(b[bodyKey]={type:Type.STRING,description:p.requestBody.description||"Request body content"},_.push(bodyKey));const R={name:g,description:p.description?`${p.summary}
|
|
777
777
|
|
|
778
|
-
${p.description}`:p.summary||`${f.toUpperCase()} ${m[m.length-1]}`,parameters:{type:Type.OBJECT,properties:b,required:_}},S=async E=>{var T;try{let I=`https://api.randmar.io${l}`;C.forEach(V=>{const F=`{${V}}`,L=V;I=I.replace(F,E[L])});const M=localStorage.getItem("access_token"),A={method:f.toUpperCase(),headers:{Authorization:M?`Bearer ${M}`:"","Content-Type":"application/json"}},N=[];if((((T=p.parameters)==null?void 0:T.filter(V=>V.in==="query"))||[]).forEach(V=>{const F=V.name,L=E[F];L&&N.push(`${V.name}=${encodeURIComponent(L)}`)}),N.length>0&&(I+=`?${N.join("&")}`),f==="post"||f==="put"){const F=E[bodyKey];F&&(A.body=F)}const j=await fetch(I,A);if(!j.ok){const V=await j.text();throw console.error(`[API Function] Error response: ${V}`),new Error(`Error ${j.status}: ${V}`)}const D=await j.json(),B=getComponent(l,D);return B?{component:B,summary:JSON.stringify(D,null,2)}:JSON.stringify(D,null,2)}catch(I){return console.error(`Error in ${g}:`,I),`I'm sorry, I couldn't retrieve the requested information. Error: ${I instanceof Error?I.message:"Unknown error"}`}};o.push({declaration:R,handler:S})}}return o}catch(n){return console.error("Error fetching API functions:",n),[]}}const getComponent=(t,e)=>{switch(t){case"/V4/Partner/{routeApplicationId}/Search":return handleSearchResults(e);case"/Product/{productNumber}":return handleProduct(e);case"/V4/Reseller/{routeResellerId}/Documents/GeneralDocuments":return handleGeneralDocuments(e);default:console.log("no component mapping for path",t);break}return null},handleGeneralDocuments=t=>{if(!Array.isArray(t))return null;const e=t;return jsxRuntime.jsx(jsxRuntime.Fragment,{children:e.map(n=>jsxRuntime.jsx("div",{className:"mt-2 mb-2",children:jsxRuntime.jsx(GeneralDocumentCard,{document:n})}))})},handleProduct=t=>{const e=t;return e.MPN?jsxRuntime.jsx("div",{className:"mt-2 mb-2",children:jsxRuntime.jsx(ProductCard,{item:e})}):null},handleSearchResults=t=>{if(!Array.isArray(t))return null;const e=t,n=e.filter(f=>f.ContentType==="Product").map(f=>f.Content).filter(f=>f.MPN),i=e.filter(f=>f.ContentType==="Manufacturer").map(f=>f.Content).filter(f=>f.ManufacturerId),o=e.filter(f=>f.ContentType==="Category").map(f=>f.Content).filter(f=>f.CategoryName),l=e.filter(f=>f.ContentType==="Order").map(f=>f.Content).filter(f=>f.OrderNumber),u=e.filter(f=>f.ContentType==="Invoice").map(f=>f.Content).filter(f=>f.OrderNumber),d=e.filter(f=>f.ContentType==="Shipment").map(f=>f.Content).filter(f=>f.ShipmentNumber);return n.length+i.length+o.length+l.length+u.length+d.length==0?null:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[n.length&&jsxRuntime.jsx("h1",{className:"font-bold mt-5",children:"Product(s)"}),n.map(f=>jsxRuntime.jsx("div",{className:"mt-2 mb-2",children:jsxRuntime.jsx(ProductCard,{item:f})})),i.length&&jsxRuntime.jsx("h1",{className:"font-bold mt-5",children:"Manufacturer(s)"}),i.map(f=>jsxRuntime.jsx("div",{className:"mt-2 mb-2",children:jsxRuntime.jsx(ManufacturerCard,{manufacturer:f})})),o.length&&jsxRuntime.jsx("h1",{className:"font-bold mt-5",children:"Category(ies)"}),o.map(f=>jsxRuntime.jsx("div",{className:"mt-2 mb-2",children:jsxRuntime.jsx(CategoryCard,{category:f})})),l.length&&jsxRuntime.jsx("h1",{className:"font-bold mt-5",children:"Order(s)"}),l.map(f=>jsxRuntime.jsx("div",{className:"mt-2 mb-2",children:jsxRuntime.jsx(OrderCard,{order:f})})),u.length&&jsxRuntime.jsx("h1",{className:"font-bold mt-5",children:"Invoice(s)"}),u.map(f=>jsxRuntime.jsx("div",{className:"mt-2 mb-2",children:jsxRuntime.jsx(InvoiceCard,{invoice:f})})),d.length&&jsxRuntime.jsx("h1",{className:"font-bold mt-5",children:"Shipment(s)"}),d.map(f=>jsxRuntime.jsx("div",{className:"mt-2 mb-2",children:jsxRuntime.jsx(ShipmentCard,{shipment:f})}))]})};function useAIAssistant({userId:t,apiKey:e}){const[n,i]=React.useState(""),[o,l]=React.useState(null),[u,d]=React.useState([]),[f,p]=React.useState([]),[m,g]=React.useState([]),[b,_]=React.useState(""),C=new GoogleGenAI({apiKey:e}),[R]=useLazyGetV4PartnerByApplicationIdAccountQuery();React.useEffect(()=>{b&&p(N=>[...N,"System instructions updated."])},[b]),React.useEffect(()=>{o&&p(N=>[...N,"Gemini 2.5 session initialized."])},[o]),React.useEffect(()=>{(async()=>{try{const j=await(await fetch("https://docs.google.com/document/d/e/2PACX-1vT-f5SWSJ2BcRUcyiumzT1aPUeC8kyyV7ryJTTymWJWOcRbDRgV5nX6Wyh7HaSPf8rxTY9w63Q2C8rG/pub")).text(),F=new DOMParser().parseFromString(j,"text/html").querySelector(".doc-content").innerHTML.replace(/__user_id__/g,t).replace(/__today__/g,""+new Date);_(F)}catch(O){console.error("Error fetching system instructions:",O),_("You are a helpful assistant, but cannot help the user right now. They should come back another time.")}})()},[]),React.useEffect(()=>{const N=async()=>{try{const O=C.chats.create({model:"gemini-2.5-flash-preview-04-17",config:{systemInstruction:b,maxOutputTokens:4096,tools:m.length>0?[{functionDeclarations:m.map(({declaration:j})=>j)}]:[]}});l(O)}catch(O){console.error("Error initializing chat:",O)}};o||m.length!==0&&b!==""&&N()},[m,o,b]),React.useEffect(()=>{(async()=>{try{const O=await fetchApiFunctions(),j={declaration:{name:"set_on_behalf_id",description:"Call this function when the user wants to act on behalf of another one. It will return to you important flags such as: is user specified by the user ID a reseller, manufacturer or an agency?",parameters:{type:Type.OBJECT,properties:{user_id:{type:Type.STRING,description:"The user ID to use going forward."}},required:["user_id"]}},handler:async function(D){const V=D["user_id"],F=await R({applicationId:V});return{component:jsxRuntime.jsx(PartnerCard,{account:F.data}),summary:`OK. Using ${V} going forward as the user ID. Full data with important flags: ${JSON.stringify(F.data)}`}}};g([...O,j])}catch(O){console.error("Error loading API functions:",O)}})()},[]);const S=Object.fromEntries(m.map(({declaration:N,handler:O})=>[N.name,O])),E=async N=>{var V;const O=N.name??"";if(!(O in S))return console.error(`Function ${O} not found`),"";const j=S[O],D=N.args||{};if(!((V=m.find(F=>F.declaration.name===O))==null?void 0:V.declaration))return console.error(`[Function Call] Could not find declaration for ${O}`),"";try{p(U=>[...U,`Calling ${O} with:
|
|
778
|
+
${p.description}`:p.summary||`${f.toUpperCase()} ${m[m.length-1]}`,parameters:{type:Type.OBJECT,properties:b,required:_}},S=async E=>{var T;try{let I=`https://api.randmar.io${l}`;C.forEach(V=>{const F=`{${V}}`,L=V;I=I.replace(F,E[L])});const M=localStorage.getItem("access_token"),A={method:f.toUpperCase(),headers:{Authorization:M?`Bearer ${M}`:"","Content-Type":"application/json"}},N=[];if((((T=p.parameters)==null?void 0:T.filter(V=>V.in==="query"))||[]).forEach(V=>{const F=V.name,L=E[F];L&&N.push(`${V.name}=${encodeURIComponent(L)}`)}),N.length>0&&(I+=`?${N.join("&")}`),f==="post"||f==="put"){const F=E[bodyKey];F&&(A.body=F)}const j=await fetch(I,A);if(!j.ok){const V=await j.text();throw console.error(`[API Function] Error response: ${V}`),new Error(`Error ${j.status}: ${V}`)}const D=await j.json(),B=getComponent(l,D);return B?{component:B,summary:JSON.stringify(D,null,2)}:JSON.stringify(D,null,2)}catch(I){return console.error(`Error in ${g}:`,I),`I'm sorry, I couldn't retrieve the requested information. Error: ${I instanceof Error?I.message:"Unknown error"}`}};o.push({declaration:R,handler:S})}}return o}catch(n){return console.error("Error fetching API functions:",n),[]}}const getComponent=(t,e)=>{switch(t){case"/V4/Partner/{routeApplicationId}/Search":return handleSearchResults(e);case"/Product/{productNumber}":return handleProduct(e);case"/V4/Reseller/{routeResellerId}/Documents/GeneralDocuments":return handleGeneralDocuments(e);default:console.log("no component mapping for path",t);break}return null},handleGeneralDocuments=t=>{if(!Array.isArray(t))return null;const e=t;return jsxRuntime.jsx(jsxRuntime.Fragment,{children:e.map(n=>jsxRuntime.jsx("div",{className:"mt-2 mb-2",children:jsxRuntime.jsx(GeneralDocumentCard,{document:n})}))})},handleProduct=t=>{const e=t;return e.MPN?jsxRuntime.jsx("div",{className:"mt-2 mb-2",children:jsxRuntime.jsx(ProductCard,{item:e})}):null},handleSearchResults=t=>{if(!Array.isArray(t))return null;const e=t,n=e.filter(f=>f.ContentType==="Product").map(f=>f.Content).filter(f=>f.MPN),i=e.filter(f=>f.ContentType==="Manufacturer").map(f=>f.Content).filter(f=>f.ManufacturerId),o=e.filter(f=>f.ContentType==="Category").map(f=>f.Content).filter(f=>f.CategoryName),l=e.filter(f=>f.ContentType==="Order").map(f=>f.Content).filter(f=>f.OrderNumber),u=e.filter(f=>f.ContentType==="Invoice").map(f=>f.Content).filter(f=>f.OrderNumber),d=e.filter(f=>f.ContentType==="Shipment").map(f=>f.Content).filter(f=>f.ShipmentNumber);return n.length+i.length+o.length+l.length+u.length+d.length==0?null:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[n.length>0&&jsxRuntime.jsx("h1",{className:"font-bold mt-5",children:"Product(s)"}),n.map(f=>jsxRuntime.jsx("div",{className:"mt-2 mb-2",children:jsxRuntime.jsx(ProductCard,{item:f})})),i.length>0&&jsxRuntime.jsx("h1",{className:"font-bold mt-5",children:"Manufacturer(s)"}),i.map(f=>jsxRuntime.jsx("div",{className:"mt-2 mb-2",children:jsxRuntime.jsx(ManufacturerCard,{manufacturer:f})})),o.length>0&&jsxRuntime.jsx("h1",{className:"font-bold mt-5",children:"Category(ies)"}),o.map(f=>jsxRuntime.jsx("div",{className:"mt-2 mb-2",children:jsxRuntime.jsx(CategoryCard,{category:f})})),l.length>0&&jsxRuntime.jsx("h1",{className:"font-bold mt-5",children:"Order(s)"}),l.map(f=>jsxRuntime.jsx("div",{className:"mt-2 mb-2",children:jsxRuntime.jsx(OrderCard,{order:f})})),u.length>0&&jsxRuntime.jsx("h1",{className:"font-bold mt-5",children:"Invoice(s)"}),u.map(f=>jsxRuntime.jsx("div",{className:"mt-2 mb-2",children:jsxRuntime.jsx(InvoiceCard,{invoice:f})})),d.length>0&&jsxRuntime.jsx("h1",{className:"font-bold mt-5",children:"Shipment(s)"}),d.map(f=>jsxRuntime.jsx("div",{className:"mt-2 mb-2",children:jsxRuntime.jsx(ShipmentCard,{shipment:f})}))]})};function useAIAssistant({userId:t,apiKey:e}){const[n,i]=React.useState(""),[o,l]=React.useState(null),[u,d]=React.useState([]),[f,p]=React.useState([]),[m,g]=React.useState([]),[b,_]=React.useState(""),C=new GoogleGenAI({apiKey:e}),[R]=useLazyGetV4PartnerByApplicationIdAccountQuery();React.useEffect(()=>{b&&p(N=>[...N,"System instructions updated."])},[b]),React.useEffect(()=>{o&&p(N=>[...N,"Gemini 2.5 session initialized."])},[o]),React.useEffect(()=>{(async()=>{try{const j=await(await fetch("https://docs.google.com/document/d/e/2PACX-1vT-f5SWSJ2BcRUcyiumzT1aPUeC8kyyV7ryJTTymWJWOcRbDRgV5nX6Wyh7HaSPf8rxTY9w63Q2C8rG/pub")).text(),F=new DOMParser().parseFromString(j,"text/html").querySelector(".doc-content").innerHTML.replace(/__user_id__/g,t).replace(/__today__/g,""+new Date);_(F)}catch(O){console.error("Error fetching system instructions:",O),_("You are a helpful assistant, but cannot help the user right now. They should come back another time.")}})()},[]),React.useEffect(()=>{const N=async()=>{try{const O=C.chats.create({model:"gemini-2.5-flash-preview-04-17",config:{systemInstruction:b,maxOutputTokens:4096,tools:m.length>0?[{functionDeclarations:m.map(({declaration:j})=>j)}]:[]}});l(O)}catch(O){console.error("Error initializing chat:",O)}};o||m.length!==0&&b!==""&&N()},[m,o,b]),React.useEffect(()=>{(async()=>{try{const O=await fetchApiFunctions(),j={declaration:{name:"set_on_behalf_id",description:"Call this function when the user wants to act on behalf of another one. It will return to you important flags such as: is user specified by the user ID a reseller, manufacturer or an agency?",parameters:{type:Type.OBJECT,properties:{user_id:{type:Type.STRING,description:"The user ID to use going forward."}},required:["user_id"]}},handler:async function(D){const V=D["user_id"],F=await R({applicationId:V});return{component:jsxRuntime.jsx(PartnerCard,{account:F.data}),summary:`OK. Using ${V} going forward as the user ID. Full data with important flags: ${JSON.stringify(F.data)}`}}};g([...O,j])}catch(O){console.error("Error loading API functions:",O)}})()},[]);const S=Object.fromEntries(m.map(({declaration:N,handler:O})=>[N.name,O])),E=async N=>{var V;const O=N.name??"";if(!(O in S))return console.error(`Function ${O} not found`),"";const j=S[O],D=N.args||{};if(!((V=m.find(F=>F.declaration.name===O))==null?void 0:V.declaration))return console.error(`[Function Call] Could not find declaration for ${O}`),"";try{p(U=>[...U,`Calling ${O} with:
|
|
779
779
|
${JSON.stringify(D,null,2)}`]);const F=await j(D);let L,q=null,G=!1;return typeof F=="string"?L=F:(L=F.summary,q=F.component,G=!0),p(U=>[...U,`${O} returned ${L.length} character(s).`]),o?(G&&q&&I({role:"assistant",content:q,timestamp:new Date,isComponent:!0}),L):""}catch{return p(F=>[...F,`${O} failed.`]),""}},T=async N=>{if(N.trim()&&!n&&o){I({role:"user",content:N,timestamp:new Date}),i("Thinking...");try{const j=await o.sendMessage({message:N.trim()}),D=j.functionCalls;if(D&&D.length>0){p(L=>[...L,`${D.length} function(s) need to be called.`]),i("Using Randmar API...");const B=[];for(const L of D){const q=await E(L),G={functionResponse:{name:L.name,response:{content:q}}};B.push(G)}i("Composing response...");const F={role:"assistant",content:(await o.sendMessage({message:B})).text,timestamp:new Date};I(F)}else{const B={role:"assistant",content:j.text,timestamp:new Date};I(B)}}catch(j){console.error("Error sending message:",j),I({role:"assistant",content:"I'm sorry, I encountered an error processing your request. Please try again later.",timestamp:new Date})}finally{i("")}}},I=N=>{d(O=>[...O,N])};return{handleSubmitToBot:T,botMessages:u,clearBotMessages:()=>{d([])},botReady:!!o,botStatus:n,debugMessages:f,reset:()=>{l(null)}}}function _getDefaults(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let _defaults=_getDefaults();function changeDefaults(t){_defaults=t}const noopTest={exec:()=>null};function edit(t,e=""){let n=typeof t=="string"?t:t.source;const i={replace:(o,l)=>{let u=typeof l=="string"?l:l.source;return u=u.replace(other.caret,"$1"),n=n.replace(o,u),i},getRegex:()=>new RegExp(n,e)};return i}const other={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},newline=/^(?:[ \t]*(?:\n|$))+/,blockCode=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,fences=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,bullet=/(?:[*+-]|\d{1,9}[.)])/,lheadingCore=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,lheading=edit(lheadingCore).replace(/bull/g,bullet).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),lheadingGfm=edit(lheadingCore).replace(/bull/g,bullet).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),_paragraph=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,blockText=/^[^\n]+/,_blockLabel=/(?!\s*\])(?:\\.|[^\[\]\\])+/,def=edit(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",_blockLabel).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),list=edit(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,bullet).getRegex(),_tag="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",_comment=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,html=edit("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",_comment).replace("tag",_tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),paragraph=edit(_paragraph).replace("hr",hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_tag).getRegex(),blockquote=edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",paragraph).getRegex(),blockNormal={blockquote,code:blockCode,def,fences,heading,hr,html,lheading,list,newline,paragraph,table:noopTest,text:blockText},gfmTable=edit("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_tag).getRegex(),blockGfm={...blockNormal,lheading:lheadingGfm,table:gfmTable,paragraph:edit(_paragraph).replace("hr",hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",gfmTable).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_tag).getRegex()},blockPedantic={...blockNormal,html:edit(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",_comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:noopTest,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:edit(_paragraph).replace("hr",hr).replace("heading",` *#{1,6} *[^
|
|
780
780
|
]`).replace("lheading",lheading).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},escape$1=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,inlineCode=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br=/^( {2,}|\\)\n(?!\s*$)/,inlineText=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,_punctuation=/[\p{P}\p{S}]/u,_punctuationOrSpace=/[\s\p{P}\p{S}]/u,_notPunctuationOrSpace=/[^\s\p{P}\p{S}]/u,punctuation=edit(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,_punctuationOrSpace).getRegex(),_punctuationGfmStrongEm=/(?!~)[\p{P}\p{S}]/u,_punctuationOrSpaceGfmStrongEm=/(?!~)[\s\p{P}\p{S}]/u,_notPunctuationOrSpaceGfmStrongEm=/(?:[^\s\p{P}\p{S}]|~)/u,blockSkip=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,emStrongLDelimCore=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,emStrongLDelim=edit(emStrongLDelimCore,"u").replace(/punct/g,_punctuation).getRegex(),emStrongLDelimGfm=edit(emStrongLDelimCore,"u").replace(/punct/g,_punctuationGfmStrongEm).getRegex(),emStrongRDelimAstCore="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",emStrongRDelimAst=edit(emStrongRDelimAstCore,"gu").replace(/notPunctSpace/g,_notPunctuationOrSpace).replace(/punctSpace/g,_punctuationOrSpace).replace(/punct/g,_punctuation).getRegex(),emStrongRDelimAstGfm=edit(emStrongRDelimAstCore,"gu").replace(/notPunctSpace/g,_notPunctuationOrSpaceGfmStrongEm).replace(/punctSpace/g,_punctuationOrSpaceGfmStrongEm).replace(/punct/g,_punctuationGfmStrongEm).getRegex(),emStrongRDelimUnd=edit("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,_notPunctuationOrSpace).replace(/punctSpace/g,_punctuationOrSpace).replace(/punct/g,_punctuation).getRegex(),anyPunctuation=edit(/\\(punct)/,"gu").replace(/punct/g,_punctuation).getRegex(),autolink=edit(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[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])?)+(?![-_])/).getRegex(),_inlineComment=edit(_comment).replace("(?:-->|$)","-->").getRegex(),tag=edit("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",_inlineComment).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),_inlineLabel=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,link=edit(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",_inlineLabel).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),reflink=edit(/^!?\[(label)\]\[(ref)\]/).replace("label",_inlineLabel).replace("ref",_blockLabel).getRegex(),nolink=edit(/^!?\[(ref)\](?:\[\])?/).replace("ref",_blockLabel).getRegex(),reflinkSearch=edit("reflink|nolink(?!\\()","g").replace("reflink",reflink).replace("nolink",nolink).getRegex(),inlineNormal={_backpedal:noopTest,anyPunctuation,autolink,blockSkip,br,code:inlineCode,del:noopTest,emStrongLDelim,emStrongRDelimAst,emStrongRDelimUnd,escape:escape$1,link,nolink,punctuation,reflink,reflinkSearch,tag,text:inlineText,url:noopTest},inlinePedantic={...inlineNormal,link:edit(/^!?\[(label)\]\((.*?)\)/).replace("label",_inlineLabel).getRegex(),reflink:edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",_inlineLabel).getRegex()},inlineGfm={...inlineNormal,emStrongRDelimAst:emStrongRDelimAstGfm,emStrongLDelim:emStrongLDelimGfm,url:edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},inlineBreaks={...inlineGfm,br:edit(br).replace("{2,}","*").getRegex(),text:edit(inlineGfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},block={normal:blockNormal,gfm:blockGfm,pedantic:blockPedantic},inline={normal:inlineNormal,gfm:inlineGfm,breaks:inlineBreaks,pedantic:inlinePedantic},escapeReplacements={"&":"&","<":"<",">":">",'"':""","'":"'"},getEscapeReplacement=t=>escapeReplacements[t];function escape$2(t,e){if(e){if(other.escapeTest.test(t))return t.replace(other.escapeReplace,getEscapeReplacement)}else if(other.escapeTestNoEncode.test(t))return t.replace(other.escapeReplaceNoEncode,getEscapeReplacement);return t}function cleanUrl(t){try{t=encodeURI(t).replace(other.percentDecode,"%")}catch{return null}return t}function splitCells(t,e){var l;const n=t.replace(other.findPipe,(u,d,f)=>{let p=!1,m=d;for(;--m>=0&&f[m]==="\\";)p=!p;return p?"|":" |"}),i=n.split(other.splitPipe);let o=0;if(i[0].trim()||i.shift(),i.length>0&&!((l=i.at(-1))!=null&&l.trim())&&i.pop(),e)if(i.length>e)i.splice(e);else for(;i.length<e;)i.push("");for(;o<i.length;o++)i[o]=i[o].trim().replace(other.slashPipe,"|");return i}function rtrim(t,e,n){const i=t.length;if(i===0)return"";let o=0;for(;o<i&&t.charAt(i-o-1)===e;)o++;return t.slice(0,i-o)}function findClosingBracket(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let i=0;i<t.length;i++)if(t[i]==="\\")i++;else if(t[i]===e[0])n++;else if(t[i]===e[1]&&(n--,n<0))return i;return-1}function outputLink(t,e,n,i,o){const l=e.href,u=e.title||null,d=t[1].replace(o.other.outputLinkReplace,"$1");if(t[0].charAt(0)!=="!"){i.state.inLink=!0;const f={type:"link",raw:n,href:l,title:u,text:d,tokens:i.inlineTokens(d)};return i.state.inLink=!1,f}return{type:"image",raw:n,href:l,title:u,text:d}}function indentCodeCompensation(t,e,n){const i=t.match(n.other.indentCodeCompensation);if(i===null)return e;const o=i[1];return e.split(`
|
|
781
781
|
`).map(l=>{const u=l.match(n.other.beginningSpace);if(u===null)return l;const[d]=u;return d.length>=o.length?l.slice(o.length):l}).join(`
|