hanbiro-react16-sdk 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hanbiro-react16-sdk.es.js +2449 -0
- package/dist/hanbiro-react16-sdk.umd.js +57 -0
- package/package.json +14 -13
- package/dist/components/index.js +0 -4
- package/dist/components.d.ts +0 -1
- package/dist/index-DWGdUH7T.mjs +0 -3026
- package/dist/index.js +0 -10
- package/dist/utils.d.ts +0 -1
- package/dist/utils.js +0 -36
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
(function(y,k){typeof exports=="object"&&typeof module<"u"?k(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],k):(y=typeof globalThis<"u"?globalThis:y||self,k(y.HanbiroReact16SDK={},y.React))})(this,function(y,k){"use strict";var Ft=Object.defineProperty;var Kt=(y,k,A)=>k in y?Ft(y,k,{enumerable:!0,configurable:!0,writable:!0,value:A}):y[k]=A;var g=(y,k,A)=>Kt(y,typeof k!="symbol"?k+"":k,A);var me;function A(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const u=A(k);let U;const Ne=new Uint8Array(16);function He(){if(!U&&(U=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!U))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return U(Ne)}const v=[];for(let t=0;t<256;++t)v.push((t+256).toString(16).slice(1));function Ue(t,e=0){return v[t[e+0]]+v[t[e+1]]+v[t[e+2]]+v[t[e+3]]+"-"+v[t[e+4]]+v[t[e+5]]+"-"+v[t[e+6]]+v[t[e+7]]+"-"+v[t[e+8]]+v[t[e+9]]+"-"+v[t[e+10]]+v[t[e+11]]+v[t[e+12]]+v[t[e+13]]+v[t[e+14]]+v[t[e+15]]}const xe={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function We(t,e,n){if(xe.randomUUID&&!t)return xe.randomUUID();t=t||{};const r=t.random||(t.rng||He)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,Ue(r)}function Ze(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var we={exports:{}},Ge="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Fe=Ge,Ke=Fe;function ye(){}function ve(){}ve.resetWarningCache=ye;var Ve=function(){function t(r,i,s,o,a,p){if(p!==Ke){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}t.isRequired=t;function e(){return t}var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:ve,resetWarningCache:ye};return n.PropTypes=n,n};we.exports=Ve();var Qe=we.exports;const T=Ze(Qe);function Y(){return Y=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Y.apply(this,arguments)}function Je(t,e){if(t==null)return{};var n=Xe(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Xe(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var W=k.forwardRef(function(t,e){var n=t.color,r=n===void 0?"currentColor":n,i=t.size,s=i===void 0?24:i,o=Je(t,["color","size"]);return k.createElement("svg",Y({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),k.createElement("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),k.createElement("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"}))});W.propTypes={color:T.string,size:T.oneOfType([T.string,T.number])},W.displayName="Copy";function ee(){return ee=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},ee.apply(this,arguments)}function Ye(t,e){if(t==null)return{};var n=et(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function et(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var te=k.forwardRef(function(t,e){var n=t.color,r=n===void 0?"currentColor":n,i=t.size,s=i===void 0?24:i,o=Ye(t,["color","size"]);return k.createElement("svg",ee({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),k.createElement("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),k.createElement("polygon",{points:"22 2 15 22 11 13 2 9 22 2"}))});te.propTypes={color:T.string,size:T.oneOfType([T.string,T.number])},te.displayName="Send";function ne(){return ne=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},ne.apply(this,arguments)}function tt(t,e){if(t==null)return{};var n=nt(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function nt(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,s;for(s=0;s<r.length;s++)i=r[s],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}var re=k.forwardRef(function(t,e){var n=t.color,r=n===void 0?"currentColor":n,i=t.size,s=i===void 0?24:i,o=tt(t,["color","size"]);return k.createElement("svg",ne({ref:e,xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o),k.createElement("circle",{cx:"12",cy:"12",r:"3"}),k.createElement("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"}))});re.propTypes={color:T.string,size:T.oneOfType([T.string,T.number])},re.displayName="Settings";const ie=[{label:"Korean",value:"KR",extra:"ko"},{label:"English",value:"US",extra:"en"},{label:"Japanese",value:"JP"},{label:"Simplified Chinese",value:"zh-CN",extra:"zh-chs"},{label:"Traditional Chinese (Taiwan)",value:"zh-TW"},{label:"Traditional Chinese (Hong Kong)",value:"zh-HK",extra:"zh-cht"},{label:"Vietnamese",value:"VN",extra:"vi"},{label:"Indonesian",value:"ID",extra:"id"}],rt=({isGradient:t=!1,stroke:e=1.5,size:n=40})=>{const r="ai-gradient-"+Math.random().toString(36).substr(2,9);return u.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:n,height:n,viewBox:"0 0 24 24",style:{flexShrink:0}},t&&u.createElement("defs",null,u.createElement("linearGradient",{id:r,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},u.createElement("stop",{offset:"0%",stopColor:"#9D50BB"},u.createElement("animate",{attributeName:"offset",values:"0%;0.4;0%",dur:"1s",repeatCount:"indefinite"})),u.createElement("stop",{offset:"30%",stopColor:"#6E48AA"},u.createElement("animate",{attributeName:"offset",values:"0.4;0.7;0.4",dur:"1s",repeatCount:"indefinite"})),u.createElement("stop",{offset:"50%",stopColor:"#4776E6"},u.createElement("animate",{attributeName:"offset",values:"0.5;0.7;0.5",dur:"1s",repeatCount:"indefinite"})),u.createElement("animateTransform",{attributeName:"gradientTransform",type:"translate",from:"0,0",to:"100,0",dur:"1s",repeatCount:"indefinite"}))),u.createElement("path",{fill:"none",stroke:t?`url(#${r})`:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:e,d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0zM20 3v4m2-2h-4M4 17v2m1-1H3"}))};async function it(t,{setContent:e,setIsLoading:n,setConversationId:r,signer:i,baseUrl:s}){let o="";try{n(!0);const a={method:"POST",baseURL:s,url:"/nmail/chatdraft",params:t};let p={};i&&typeof i.generateHeaders=="function"&&(p=await i.generateHeaders(a));const l=await fetch(`${s}/nmail/chatdraft`,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json","Access-Control-Allow-Origin":"*",...p}});if(n(!1),!l.body)throw new Error("Response body is not available for streaming.");const c=l.body.getReader();let d="",h=0;for(;;){const{done:w,value:f}=await c.read();if(w)break;let x="",R="";try{const $=new TextDecoder().decode(f);d+=$;const O=/"answer":".*?"/g,E=/"conversation_id"\s*:\s*"([^"]+)"/,M=[...d.matchAll(O)],N=d.match(E);for(N&&N[1]&&r(N[1]);h<M.length;){const H=M[h];try{x=H[0];const z=x.slice(10,x.length-1);R=`"${z}"`,z.endsWith("\\")&&(R=`"${z}\\"`);const Gt=JSON.parse(R);o+=Gt,e(o)}catch(z){console.error("Parse error: ",z,x,R)}h++}}catch($){console.error("TextDecoder error: ",$,x)}}return o}catch(a){console.error("Summary error:",a),e("")}finally{n(!1)}return""}function se(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var L=se();function Se(t){L=t}var D={exec:()=>null};function m(t,e=""){let n=typeof t=="string"?t:t.source;const r={replace:(i,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(S.caret,"$1"),n=n.replace(i,o),r},getRegex:()=>new RegExp(n,e)};return r}var S={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")},st=/^(?:[ \t]*(?:\n|$))+/,at=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,lt=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,j=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ot=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ae=/(?:[*+-]|\d{1,9}[.)])/,Re=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Te=m(Re).replace(/bull/g,ae).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(),ct=m(Re).replace(/bull/g,ae).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(),le=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,pt=/^[^\n]+/,oe=/(?!\s*\])(?:\\.|[^\[\]\\])+/,ht=m(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",oe).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ut=m(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ae).getRegex(),Z="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",ce=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,gt=m("^ {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",ce).replace("tag",Z).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ee=m(le).replace("hr",j).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",Z).getRegex(),dt=m(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ee).getRegex(),pe={blockquote:dt,code:at,def:ht,fences:lt,heading:ot,hr:j,html:gt,lheading:Te,list:ut,newline:st,paragraph:Ee,table:D,text:pt},$e=m("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",j).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",Z).getRegex(),ft={...pe,lheading:ct,table:$e,paragraph:m(le).replace("hr",j).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",$e).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",Z).getRegex()},mt={...pe,html:m(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ce).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:D,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:m(le).replace("hr",j).replace("heading",` *#{1,6} *[^
|
|
2
|
+
]`).replace("lheading",Te).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},bt=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,kt=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ze=/^( {2,}|\\)\n(?!\s*$)/,xt=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,G=/[\p{P}\p{S}]/u,he=/[\s\p{P}\p{S}]/u,Ce=/[^\s\p{P}\p{S}]/u,wt=m(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,he).getRegex(),_e=/(?!~)[\p{P}\p{S}]/u,yt=/(?!~)[\s\p{P}\p{S}]/u,vt=/(?:[^\s\p{P}\p{S}]|~)/u,St=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Ie=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Rt=m(Ie,"u").replace(/punct/g,G).getRegex(),Tt=m(Ie,"u").replace(/punct/g,_e).getRegex(),Le="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Et=m(Le,"gu").replace(/notPunctSpace/g,Ce).replace(/punctSpace/g,he).replace(/punct/g,G).getRegex(),$t=m(Le,"gu").replace(/notPunctSpace/g,vt).replace(/punctSpace/g,yt).replace(/punct/g,_e).getRegex(),zt=m("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ce).replace(/punctSpace/g,he).replace(/punct/g,G).getRegex(),Ct=m(/\\(punct)/,"gu").replace(/punct/g,G).getRegex(),_t=m(/^<(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(),It=m(ce).replace("(?:-->|$)","-->").getRegex(),Lt=m("^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",It).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),F=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Pt=m(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",F).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Pe=m(/^!?\[(label)\]\[(ref)\]/).replace("label",F).replace("ref",oe).getRegex(),Ae=m(/^!?\[(ref)\](?:\[\])?/).replace("ref",oe).getRegex(),At=m("reflink|nolink(?!\\()","g").replace("reflink",Pe).replace("nolink",Ae).getRegex(),ue={_backpedal:D,anyPunctuation:Ct,autolink:_t,blockSkip:St,br:ze,code:kt,del:D,emStrongLDelim:Rt,emStrongRDelimAst:Et,emStrongRDelimUnd:zt,escape:bt,link:Pt,nolink:Ae,punctuation:wt,reflink:Pe,reflinkSearch:At,tag:Lt,text:xt,url:D},Ot={...ue,link:m(/^!?\[(label)\]\((.*?)\)/).replace("label",F).getRegex(),reflink:m(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",F).getRegex()},ge={...ue,emStrongRDelimAst:$t,emStrongLDelim:Tt,url:m(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},Dt={...ge,br:m(ze).replace("{2,}","*").getRegex(),text:m(ge.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},K={normal:pe,gfm:ft,pedantic:mt},B={normal:ue,gfm:ge,breaks:Dt,pedantic:Ot},jt={"&":"&","<":"<",">":">",'"':""","'":"'"},Oe=t=>jt[t];function C(t,e){if(e){if(S.escapeTest.test(t))return t.replace(S.escapeReplace,Oe)}else if(S.escapeTestNoEncode.test(t))return t.replace(S.escapeReplaceNoEncode,Oe);return t}function De(t){try{t=encodeURI(t).replace(S.percentDecode,"%")}catch{return null}return t}function je(t,e){var s;const n=t.replace(S.findPipe,(o,a,p)=>{let l=!1,c=a;for(;--c>=0&&p[c]==="\\";)l=!l;return l?"|":" |"}),r=n.split(S.splitPipe);let i=0;if(r[0].trim()||r.shift(),r.length>0&&!((s=r.at(-1))!=null&&s.trim())&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(S.slashPipe,"|");return r}function q(t,e,n){const r=t.length;if(r===0)return"";let i=0;for(;i<r&&t.charAt(r-i-1)===e;)i++;return t.slice(0,r-i)}function Bt(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let r=0;r<t.length;r++)if(t[r]==="\\")r++;else if(t[r]===e[0])n++;else if(t[r]===e[1]&&(n--,n<0))return r;return n>0?-2:-1}function Be(t,e,n,r,i){const s=e.href,o=e.title||null,a=t[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;const p={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:s,title:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,p}function qt(t,e,n){const r=t.match(n.other.indentCodeCompensation);if(r===null)return e;const i=r[1];return e.split(`
|
|
3
|
+
`).map(s=>{const o=s.match(n.other.beginningSpace);if(o===null)return s;const[a]=o;return a.length>=i.length?s.slice(i.length):s}).join(`
|
|
4
|
+
`)}var V=class{constructor(t){g(this,"options");g(this,"rules");g(this,"lexer");this.options=t||L}space(t){const e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){const e=this.rules.block.code.exec(t);if(e){const n=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:q(n,`
|
|
5
|
+
`)}}}fences(t){const e=this.rules.block.fences.exec(t);if(e){const n=e[0],r=qt(n,e[3]||"",this.rules);return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(t){const e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(this.rules.other.endingHash.test(n)){const r=q(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){const e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:q(e[0],`
|
|
6
|
+
`)}}blockquote(t){const e=this.rules.block.blockquote.exec(t);if(e){let n=q(e[0],`
|
|
7
|
+
`).split(`
|
|
8
|
+
`),r="",i="";const s=[];for(;n.length>0;){let o=!1;const a=[];let p;for(p=0;p<n.length;p++)if(this.rules.other.blockquoteStart.test(n[p]))a.push(n[p]),o=!0;else if(!o)a.push(n[p]);else break;n=n.slice(p);const l=a.join(`
|
|
9
|
+
`),c=l.replace(this.rules.other.blockquoteSetextReplace,`
|
|
10
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
|
|
11
|
+
${l}`:l,i=i?`${i}
|
|
12
|
+
${c}`:c;const d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,s,!0),this.lexer.state.top=d,n.length===0)break;const h=s.at(-1);if((h==null?void 0:h.type)==="code")break;if((h==null?void 0:h.type)==="blockquote"){const w=h,f=w.raw+`
|
|
13
|
+
`+n.join(`
|
|
14
|
+
`),x=this.blockquote(f);s[s.length-1]=x,r=r.substring(0,r.length-w.raw.length)+x.raw,i=i.substring(0,i.length-w.text.length)+x.text;break}else if((h==null?void 0:h.type)==="list"){const w=h,f=w.raw+`
|
|
15
|
+
`+n.join(`
|
|
16
|
+
`),x=this.list(f);s[s.length-1]=x,r=r.substring(0,r.length-h.raw.length)+x.raw,i=i.substring(0,i.length-w.raw.length)+x.raw,n=f.substring(s.at(-1).raw.length).split(`
|
|
17
|
+
`);continue}}return{type:"blockquote",raw:r,tokens:s,text:i}}}list(t){let e=this.rules.block.list.exec(t);if(e){let n=e[1].trim();const r=n.length>1,i={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");const s=this.rules.other.listItemRegex(n);let o=!1;for(;t;){let p=!1,l="",c="";if(!(e=s.exec(t))||this.rules.block.hr.test(t))break;l=e[0],t=t.substring(l.length);let d=e[2].split(`
|
|
18
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,$=>" ".repeat(3*$.length)),h=t.split(`
|
|
19
|
+
`,1)[0],w=!d.trim(),f=0;if(this.options.pedantic?(f=2,c=d.trimStart()):w?f=e[1].length+1:(f=e[2].search(this.rules.other.nonSpaceChar),f=f>4?1:f,c=d.slice(f),f+=e[1].length),w&&this.rules.other.blankLine.test(h)&&(l+=h+`
|
|
20
|
+
`,t=t.substring(h.length+1),p=!0),!p){const $=this.rules.other.nextBulletRegex(f),O=this.rules.other.hrRegex(f),E=this.rules.other.fencesBeginRegex(f),M=this.rules.other.headingBeginRegex(f),N=this.rules.other.htmlBeginRegex(f);for(;t;){const H=t.split(`
|
|
21
|
+
`,1)[0];let z;if(h=H,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),z=h):z=h.replace(this.rules.other.tabCharGlobal," "),E.test(h)||M.test(h)||N.test(h)||$.test(h)||O.test(h))break;if(z.search(this.rules.other.nonSpaceChar)>=f||!h.trim())c+=`
|
|
22
|
+
`+z.slice(f);else{if(w||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||E.test(d)||M.test(d)||O.test(d))break;c+=`
|
|
23
|
+
`+h}!w&&!h.trim()&&(w=!0),l+=H+`
|
|
24
|
+
`,t=t.substring(H.length+1),d=z.slice(f)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(l)&&(o=!0));let x=null,R;this.options.gfm&&(x=this.rules.other.listIsTask.exec(c),x&&(R=x[0]!=="[ ] ",c=c.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:l,task:!!x,checked:R,loose:!1,text:c,tokens:[]}),i.raw+=l}const a=i.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let p=0;p<i.items.length;p++)if(this.lexer.state.top=!1,i.items[p].tokens=this.lexer.blockTokens(i.items[p].text,[]),!i.loose){const l=i.items[p].tokens.filter(d=>d.type==="space"),c=l.length>0&&l.some(d=>this.rules.other.anyLine.test(d.raw));i.loose=c}if(i.loose)for(let p=0;p<i.items.length;p++)i.items[p].loose=!0;return i}}html(t){const e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){const e=this.rules.block.def.exec(t);if(e){const n=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:n,raw:e[0],href:r,title:i}}}table(t){var o;const e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;const n=je(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=(o=e[3])!=null&&o.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
25
|
+
`):[],s={type:"table",raw:e[0],header:[],align:[],rows:[]};if(n.length===r.length){for(const a of r)this.rules.other.tableAlignRight.test(a)?s.align.push("right"):this.rules.other.tableAlignCenter.test(a)?s.align.push("center"):this.rules.other.tableAlignLeft.test(a)?s.align.push("left"):s.align.push(null);for(let a=0;a<n.length;a++)s.header.push({text:n[a],tokens:this.lexer.inline(n[a]),header:!0,align:s.align[a]});for(const a of i)s.rows.push(je(a,s.header.length).map((p,l)=>({text:p,tokens:this.lexer.inline(p),header:!1,align:s.align[l]})));return s}}lheading(t){const e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(t){const e=this.rules.block.paragraph.exec(t);if(e){const n=e[1].charAt(e[1].length-1)===`
|
|
26
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){const e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){const e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){const e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){const e=this.rules.inline.link.exec(t);if(e){const n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;const s=q(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else{const s=Bt(e[2],"()");if(s===-2)return;if(s>-1){const a=(e[0].indexOf("!")===0?5:4)+e[1].length+s;e[2]=e[2].substring(0,s),e[0]=e[0].substring(0,a).trim(),e[3]=""}}let r=e[2],i="";if(this.options.pedantic){const s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],i=s[3])}else i=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),Be(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){const r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[r.toLowerCase()];if(!i){const s=n[0].charAt(0);return{type:"text",raw:s,text:s}}return Be(n,i,n[0],this.lexer,this.rules)}}emStrong(t,e,n=""){let r=this.rules.inline.emStrongLDelim.exec(t);if(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))return;if(!(r[1]||r[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const s=[...r[0]].length-1;let o,a,p=s,l=0;const c=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,e=e.slice(-1*t.length+s);(r=c.exec(e))!=null;){if(o=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!o)continue;if(a=[...o].length,r[3]||r[4]){p+=a;continue}else if((r[5]||r[6])&&s%3&&!((s+a)%3)){l+=a;continue}if(p-=a,p>0)continue;a=Math.min(a,a+p+l);const d=[...r[0]][0].length,h=t.slice(0,s+r.index+d+a);if(Math.min(s,a)%2){const f=h.slice(1,-1);return{type:"em",raw:h,text:f,tokens:this.lexer.inlineTokens(f)}}const w=h.slice(2,-2);return{type:"strong",raw:h,text:w,tokens:this.lexer.inlineTokens(w)}}}}codespan(t){const e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(this.rules.other.newLineCharGlobal," ");const r=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:e[0],text:n}}}br(t){const e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){const e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t){const e=this.rules.inline.autolink.exec(t);if(e){let n,r;return e[2]==="@"?(n=e[1],r="mailto:"+n):(n=e[1],r=n),{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(t){var n;let e;if(e=this.rules.inline.url.exec(t)){let r,i;if(e[2]==="@")r=e[0],i="mailto:"+r;else{let s;do s=e[0],e[0]=((n=this.rules.inline._backpedal.exec(e[0]))==null?void 0:n[0])??"";while(s!==e[0]);r=e[0],e[1]==="www."?i="http://"+e[0]:i=e[0]}return{type:"link",raw:e[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(t){const e=this.rules.inline.text.exec(t);if(e){const n=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:n}}}},_=class be{constructor(e){g(this,"tokens");g(this,"options");g(this,"state");g(this,"tokenizer");g(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||L,this.options.tokenizer=this.options.tokenizer||new V,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const n={other:S,block:K.normal,inline:B.normal};this.options.pedantic?(n.block=K.pedantic,n.inline=B.pedantic):this.options.gfm&&(n.block=K.gfm,this.options.breaks?n.inline=B.breaks:n.inline=B.gfm),this.tokenizer.rules=n}static get rules(){return{block:K,inline:B}}static lex(e,n){return new be(n).lex(e)}static lexInline(e,n){return new be(n).inlineTokens(e)}lex(e){e=e.replace(S.carriageReturn,`
|
|
27
|
+
`),this.blockTokens(e,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){const r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,n=[],r=!1){var i,s,o;for(this.options.pedantic&&(e=e.replace(S.tabCharGlobal," ").replace(S.spaceLine,""));e;){let a;if((s=(i=this.options.extensions)==null?void 0:i.block)!=null&&s.some(l=>(a=l.call({lexer:this},e,n))?(e=e.substring(a.raw.length),n.push(a),!0):!1))continue;if(a=this.tokenizer.space(e)){e=e.substring(a.raw.length);const l=n.at(-1);a.raw.length===1&&l!==void 0?l.raw+=`
|
|
28
|
+
`:n.push(a);continue}if(a=this.tokenizer.code(e)){e=e.substring(a.raw.length);const l=n.at(-1);(l==null?void 0:l.type)==="paragraph"||(l==null?void 0:l.type)==="text"?(l.raw+=`
|
|
29
|
+
`+a.raw,l.text+=`
|
|
30
|
+
`+a.text,this.inlineQueue.at(-1).src=l.text):n.push(a);continue}if(a=this.tokenizer.fences(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.heading(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.hr(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.blockquote(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.list(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.html(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.def(e)){e=e.substring(a.raw.length);const l=n.at(-1);(l==null?void 0:l.type)==="paragraph"||(l==null?void 0:l.type)==="text"?(l.raw+=`
|
|
31
|
+
`+a.raw,l.text+=`
|
|
32
|
+
`+a.raw,this.inlineQueue.at(-1).src=l.text):this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title});continue}if(a=this.tokenizer.table(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.lheading(e)){e=e.substring(a.raw.length),n.push(a);continue}let p=e;if((o=this.options.extensions)!=null&&o.startBlock){let l=1/0;const c=e.slice(1);let d;this.options.extensions.startBlock.forEach(h=>{d=h.call({lexer:this},c),typeof d=="number"&&d>=0&&(l=Math.min(l,d))}),l<1/0&&l>=0&&(p=e.substring(0,l+1))}if(this.state.top&&(a=this.tokenizer.paragraph(p))){const l=n.at(-1);r&&(l==null?void 0:l.type)==="paragraph"?(l.raw+=`
|
|
33
|
+
`+a.raw,l.text+=`
|
|
34
|
+
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):n.push(a),r=p.length!==e.length,e=e.substring(a.raw.length);continue}if(a=this.tokenizer.text(e)){e=e.substring(a.raw.length);const l=n.at(-1);(l==null?void 0:l.type)==="text"?(l.raw+=`
|
|
35
|
+
`+a.raw,l.text+=`
|
|
36
|
+
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):n.push(a);continue}if(e){const l="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){var a,p,l;let r=e,i=null;if(this.tokens.links){const c=Object.keys(this.tokens.links);if(c.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)c.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(i=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let s=!1,o="";for(;e;){s||(o=""),s=!1;let c;if((p=(a=this.options.extensions)==null?void 0:a.inline)!=null&&p.some(h=>(c=h.call({lexer:this},e,n))?(e=e.substring(c.raw.length),n.push(c),!0):!1))continue;if(c=this.tokenizer.escape(e)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.tag(e)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.link(e)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(c.raw.length);const h=n.at(-1);c.type==="text"&&(h==null?void 0:h.type)==="text"?(h.raw+=c.raw,h.text+=c.text):n.push(c);continue}if(c=this.tokenizer.emStrong(e,r,o)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.codespan(e)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.br(e)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.del(e)){e=e.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.autolink(e)){e=e.substring(c.raw.length),n.push(c);continue}if(!this.state.inLink&&(c=this.tokenizer.url(e))){e=e.substring(c.raw.length),n.push(c);continue}let d=e;if((l=this.options.extensions)!=null&&l.startInline){let h=1/0;const w=e.slice(1);let f;this.options.extensions.startInline.forEach(x=>{f=x.call({lexer:this},w),typeof f=="number"&&f>=0&&(h=Math.min(h,f))}),h<1/0&&h>=0&&(d=e.substring(0,h+1))}if(c=this.tokenizer.inlineText(d)){e=e.substring(c.raw.length),c.raw.slice(-1)!=="_"&&(o=c.raw.slice(-1)),s=!0;const h=n.at(-1);(h==null?void 0:h.type)==="text"?(h.raw+=c.raw,h.text+=c.text):n.push(c);continue}if(e){const h="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return n}},Q=class{constructor(t){g(this,"options");g(this,"parser");this.options=t||L}space(t){return""}code({text:t,lang:e,escaped:n}){var s;const r=(s=(e||"").match(S.notSpaceStart))==null?void 0:s[0],i=t.replace(S.endingNewline,"")+`
|
|
37
|
+
`;return r?'<pre><code class="language-'+C(r)+'">'+(n?i:C(i,!0))+`</code></pre>
|
|
38
|
+
`:"<pre><code>"+(n?i:C(i,!0))+`</code></pre>
|
|
39
|
+
`}blockquote({tokens:t}){return`<blockquote>
|
|
40
|
+
${this.parser.parse(t)}</blockquote>
|
|
41
|
+
`}html({text:t}){return t}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
|
|
42
|
+
`}hr(t){return`<hr>
|
|
43
|
+
`}list(t){const e=t.ordered,n=t.start;let r="";for(let o=0;o<t.items.length;o++){const a=t.items[o];r+=this.listitem(a)}const i=e?"ol":"ul",s=e&&n!==1?' start="'+n+'"':"";return"<"+i+s+`>
|
|
44
|
+
`+r+"</"+i+`>
|
|
45
|
+
`}listitem(t){var n;let e="";if(t.task){const r=this.checkbox({checked:!!t.checked});t.loose?((n=t.tokens[0])==null?void 0:n.type)==="paragraph"?(t.tokens[0].text=r+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&t.tokens[0].tokens[0].type==="text"&&(t.tokens[0].tokens[0].text=r+" "+C(t.tokens[0].tokens[0].text),t.tokens[0].tokens[0].escaped=!0)):t.tokens.unshift({type:"text",raw:r+" ",text:r+" ",escaped:!0}):e+=r+" "}return e+=this.parser.parse(t.tokens,!!t.loose),`<li>${e}</li>
|
|
46
|
+
`}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
|
|
47
|
+
`}table(t){let e="",n="";for(let i=0;i<t.header.length;i++)n+=this.tablecell(t.header[i]);e+=this.tablerow({text:n});let r="";for(let i=0;i<t.rows.length;i++){const s=t.rows[i];n="";for(let o=0;o<s.length;o++)n+=this.tablecell(s[o]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
|
|
48
|
+
<thead>
|
|
49
|
+
`+e+`</thead>
|
|
50
|
+
`+r+`</table>
|
|
51
|
+
`}tablerow({text:t}){return`<tr>
|
|
52
|
+
${t}</tr>
|
|
53
|
+
`}tablecell(t){const e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
|
|
54
|
+
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${C(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){const r=this.parser.parseInline(n),i=De(t);if(i===null)return r;t=i;let s='<a href="'+t+'"';return e&&(s+=' title="'+C(e)+'"'),s+=">"+r+"</a>",s}image({href:t,title:e,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));const i=De(t);if(i===null)return C(n);t=i;let s=`<img src="${t}" alt="${n}"`;return e&&(s+=` title="${C(e)}"`),s+=">",s}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:C(t.text)}},de=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},I=class ke{constructor(e){g(this,"options");g(this,"renderer");g(this,"textRenderer");this.options=e||L,this.options.renderer=this.options.renderer||new Q,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new de}static parse(e,n){return new ke(n).parse(e)}static parseInline(e,n){return new ke(n).parseInline(e)}parse(e,n=!0){var i,s;let r="";for(let o=0;o<e.length;o++){const a=e[o];if((s=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&s[a.type]){const l=a,c=this.options.extensions.renderers[l.type].call({parser:this},l);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(l.type)){r+=c||"";continue}}const p=a;switch(p.type){case"space":{r+=this.renderer.space(p);continue}case"hr":{r+=this.renderer.hr(p);continue}case"heading":{r+=this.renderer.heading(p);continue}case"code":{r+=this.renderer.code(p);continue}case"table":{r+=this.renderer.table(p);continue}case"blockquote":{r+=this.renderer.blockquote(p);continue}case"list":{r+=this.renderer.list(p);continue}case"html":{r+=this.renderer.html(p);continue}case"paragraph":{r+=this.renderer.paragraph(p);continue}case"text":{let l=p,c=this.renderer.text(l);for(;o+1<e.length&&e[o+1].type==="text";)l=e[++o],c+=`
|
|
55
|
+
`+this.renderer.text(l);n?r+=this.renderer.paragraph({type:"paragraph",raw:c,text:c,tokens:[{type:"text",raw:c,text:c,escaped:!0}]}):r+=c;continue}default:{const l='Token with "'+p.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return r}parseInline(e,n=this.renderer){var i,s;let r="";for(let o=0;o<e.length;o++){const a=e[o];if((s=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&s[a.type]){const l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){r+=l||"";continue}}const p=a;switch(p.type){case"escape":{r+=n.text(p);break}case"html":{r+=n.html(p);break}case"link":{r+=n.link(p);break}case"image":{r+=n.image(p);break}case"strong":{r+=n.strong(p);break}case"em":{r+=n.em(p);break}case"codespan":{r+=n.codespan(p);break}case"br":{r+=n.br(p);break}case"del":{r+=n.del(p);break}case"text":{r+=n.text(p);break}default:{const l='Token with "'+p.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return r}},J=(me=class{constructor(t){g(this,"options");g(this,"block");this.options=t||L}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?_.lex:_.lexInline}provideParser(){return this.block?I.parse:I.parseInline}},g(me,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),me),Mt=class{constructor(...t){g(this,"defaults",se());g(this,"options",this.setOptions);g(this,"parse",this.parseMarkdown(!0));g(this,"parseInline",this.parseMarkdown(!1));g(this,"Parser",I);g(this,"Renderer",Q);g(this,"TextRenderer",de);g(this,"Lexer",_);g(this,"Tokenizer",V);g(this,"Hooks",J);this.use(...t)}walkTokens(t,e){var r,i;let n=[];for(const s of t)switch(n=n.concat(e.call(this,s)),s.type){case"table":{const o=s;for(const a of o.header)n=n.concat(this.walkTokens(a.tokens,e));for(const a of o.rows)for(const p of a)n=n.concat(this.walkTokens(p.tokens,e));break}case"list":{const o=s;n=n.concat(this.walkTokens(o.items,e));break}default:{const o=s;(i=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&i[o.type]?this.defaults.extensions.childTokens[o.type].forEach(a=>{const p=o[a].flat(1/0);n=n.concat(this.walkTokens(p,e))}):o.tokens&&(n=n.concat(this.walkTokens(o.tokens,e)))}}return n}use(...t){const e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{const r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){const s=e.renderers[i.name];s?e.renderers[i.name]=function(...o){let a=i.renderer.apply(this,o);return a===!1&&(a=s.apply(this,o)),a}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const s=e[i.level];s?s.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),r.extensions=e),n.renderer){const i=this.defaults.renderer||new Q(this.defaults);for(const s in n.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;const o=s,a=n.renderer[o],p=i[o];i[o]=(...l)=>{let c=a.apply(i,l);return c===!1&&(c=p.apply(i,l)),c||""}}r.renderer=i}if(n.tokenizer){const i=this.defaults.tokenizer||new V(this.defaults);for(const s in n.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;const o=s,a=n.tokenizer[o],p=i[o];i[o]=(...l)=>{let c=a.apply(i,l);return c===!1&&(c=p.apply(i,l)),c}}r.tokenizer=i}if(n.hooks){const i=this.defaults.hooks||new J;for(const s in n.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;const o=s,a=n.hooks[o],p=i[o];J.passThroughHooks.has(s)?i[o]=l=>{if(this.defaults.async)return Promise.resolve(a.call(i,l)).then(d=>p.call(i,d));const c=a.call(i,l);return p.call(i,c)}:i[o]=(...l)=>{let c=a.apply(i,l);return c===!1&&(c=p.apply(i,l)),c}}r.hooks=i}if(n.walkTokens){const i=this.defaults.walkTokens,s=n.walkTokens;r.walkTokens=function(o){let a=[];return a.push(s.call(this,o)),i&&(a=a.concat(i.call(this,o))),a}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return _.lex(t,e??this.defaults)}parser(t,e){return I.parse(t,e??this.defaults)}parseMarkdown(t){return(n,r)=>{const i={...r},s={...this.defaults,...i},o=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&i.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));s.hooks&&(s.hooks.options=s,s.hooks.block=t);const a=s.hooks?s.hooks.provideLexer():t?_.lex:_.lexInline,p=s.hooks?s.hooks.provideParser():t?I.parse:I.parseInline;if(s.async)return Promise.resolve(s.hooks?s.hooks.preprocess(n):n).then(l=>a(l,s)).then(l=>s.hooks?s.hooks.processAllTokens(l):l).then(l=>s.walkTokens?Promise.all(this.walkTokens(l,s.walkTokens)).then(()=>l):l).then(l=>p(l,s)).then(l=>s.hooks?s.hooks.postprocess(l):l).catch(o);try{s.hooks&&(n=s.hooks.preprocess(n));let l=a(n,s);s.hooks&&(l=s.hooks.processAllTokens(l)),s.walkTokens&&this.walkTokens(l,s.walkTokens);let c=p(l,s);return s.hooks&&(c=s.hooks.postprocess(c)),c}catch(l){return o(l)}}}onError(t,e){return n=>{if(n.message+=`
|
|
56
|
+
Please report this to https://github.com/markedjs/marked.`,t){const r="<p>An error occurred:</p><pre>"+C(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},P=new Mt;function b(t,e){return P.parse(t,e)}b.options=b.setOptions=function(t){return P.setOptions(t),b.defaults=P.defaults,Se(b.defaults),b},b.getDefaults=se,b.defaults=L,b.use=function(...t){return P.use(...t),b.defaults=P.defaults,Se(b.defaults),b},b.walkTokens=function(t,e){return P.walkTokens(t,e)},b.parseInline=P.parseInline,b.Parser=I,b.parser=I.parse,b.Renderer=Q,b.TextRenderer=de,b.Lexer=_,b.lexer=_.lex,b.Tokenizer=V,b.Hooks=J,b.parse=b,b.options,b.setOptions,b.use,b.walkTokens,b.parseInline,I.parse,_.lex;const qe=({data:t,style:e})=>u.createElement("div",{style:{maxWidth:"80%",...e}},t&&t.subject?u.createElement("div",{dangerouslySetInnerHTML:{__html:b.parse(t.body,{async:!1})}}):u.createElement("p",{style:{margin:0,whiteSpace:"pre-wrap"}},t?t.question:"")),Nt=({items:t,onApply:e,getEditorContent:n})=>{const r=async i=>{const s=/제목:[^\n]*/g;((s.exec(i)||[])[0]||"").replace("제목: ","").replace(`
|
|
57
|
+
`,"");const a=i.replace(s,"").replace("본문: ","");let p=await b.parse(a);const l=/<!--HanbiroSignatureStart-->([\s\S]*?)<!--HanbiroSignatureEnd-->/g,c=n?n():"",d=l.exec(c)||[];d[0]&&(p=p+"<br>"+d[0]),e({html:p})};return u.createElement("div",{style:{flex:1,minHeight:0,position:"relative",overflowY:"auto",paddingRight:16,marginRight:-16,marginBottom:8,display:"flex",flexDirection:"column"}},t&&t.map(i=>u.createElement("div",{key:i.id,style:{display:"flex",flexDirection:"column",marginBottom:16}},u.createElement("div",{style:{width:"100%",display:"flex",alignItems:"flex-end",flexDirection:"column",position:"relative",marginTop:8}},u.createElement(qe,{data:{question:i.question},style:{borderRadius:8,borderTopRightRadius:0,padding:"8px 12px",background:"var(--background-softGrey)"}})),u.createElement("div",{style:{width:"100%",display:"flex",alignItems:"flex-start",flexDirection:"column",position:"relative",marginTop:8}},i.isLoading?u.createElement("div",{style:{marginTop:8,fontStyle:"italic",color:"var(--text-secondary)"}},"Loading..."):u.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"flex-end",width:"100%"}},u.createElement(qe,{data:{subject:i.subject,body:i.body},style:{background:"var(--background-softGrey)",borderRadius:8,borderTopLeftRadius:0,padding:"8px 12px",flexShrink:0}}),u.createElement("button",{type:"button",title:"Apply content",onClick:()=>r(i.body),style:{marginLeft:4,background:"none",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:8,borderRadius:4}},u.createElement(W,{size:16,color:"#666"})))))))};class Ht extends u.Component{constructor(n){super(n);g(this,"containerRef");g(this,"handleClickOutside",n=>{this.containerRef.current&&!this.containerRef.current.contains(n.target)&&this.setState({open:!1})});g(this,"togglePopper",()=>{this.setState(n=>({open:!n.open}))});g(this,"handleLangChange",n=>{const r=ie.find(i=>i.value===n.target.value);this.props.setLang(r||null)});this.state={open:!1},this.containerRef=u.createRef()}componentDidMount(){document.addEventListener("mousedown",this.handleClickOutside)}componentWillUnmount(){document.removeEventListener("mousedown",this.handleClickOutside)}render(){const{lang:n,originalEmail:r,setOriginalEmail:i,getEditorContent:s}=this.props,{open:o}=this.state;return u.createElement("div",{ref:this.containerRef,style:{position:"relative",display:"inline-block"}},u.createElement("button",{type:"button",onClick:this.togglePopper,className:"icon-button small"},u.createElement(re,{size:16})),o&&u.createElement("div",{style:{position:"absolute",bottom:"100%",left:0,zIndex:1051,background:"#fff",border:"1px solid #ddd",boxShadow:"0px 4px 12px rgba(0, 0, 0, 0.1)",borderRadius:8,padding:16,width:320,marginBottom:8}},u.createElement("div",{style:{display:"flex",flexDirection:"column",gap:12}},u.createElement("div",{style:{display:"flex",flexDirection:"column",gap:4}},u.createElement("span",{style:{fontSize:12,fontWeight:500,color:"var(--text-secondary)"}},"Language"),u.createElement("select",{value:n?n.value:"",onChange:this.handleLangChange,style:{padding:"6px 8px",borderRadius:4,border:"1px solid #ccc",fontSize:14}},u.createElement("option",{value:"",disabled:!0},"Select Language"),ie.map(a=>u.createElement("option",{key:a.value,value:a.value},a.label)))),u.createElement("div",{style:{display:"flex",flexDirection:"column",gap:4}},u.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},u.createElement("span",{style:{fontSize:12,fontWeight:500,color:"var(--text-secondary)"}},"AI Context"),s&&u.createElement("button",{type:"button",title:"Copy from origin email",onClick:()=>{const a=s();i(a)},className:"icon-button"},u.createElement(W,null))),u.createElement("textarea",{value:r,onChange:a=>i(a.target.value),style:{width:"100%",height:120,resize:"vertical",padding:8,border:"1px solid #ccc",borderRadius:4,fontSize:13,fontFamily:"inherit",boxSizing:"border-box"}})))))}}class Ut extends u.Component{constructor(n){super(n);g(this,"setAiContext",n=>{this.setState({originalEmail:n})});g(this,"handleMessageChange",n=>{this.setState({message:n.target.value})});g(this,"handleSubmit",async()=>{const{message:n,messages:r,lang:i,originalEmail:s,conversationId:o}=this.state,{signer:a,baseUrl:p=""}=this.props;if(!n.trim())return;const l=We();let c={id:l,question:n,subject:"",body:"",created_at:new Date().getTime(),isLoading:!0};const d=[...r,c];this.setState({messages:d,message:"",isSending:!0});const h={query:n,default_language:i?i.value:"KR",original_email:s,debug_grpc:!0};o&&(h.conversation_id=o),await it(h,{setContent:R=>{this.setState($=>({messages:$.messages.map(E=>E.id===l?{...E,subject:"Some thing not used",body:R,isLoading:!1,created_at:new Date().getTime()}:E)}))},setIsLoading:R=>{this.setState($=>({messages:$.messages.map(E=>E.id===l?{...E,isLoading:R}:E)}))},setConversationId:R=>{this.setState({conversationId:R})},signer:a,baseUrl:p}),this.setState({isSending:!1})});g(this,"handleKeyDown",n=>{!n.shiftKey&&n.key==="Enter"&&!this.state.isSending&&(n.preventDefault(),this.handleSubmit())});g(this,"setLang",n=>{this.setState({lang:n})});g(this,"setOriginalEmail",n=>{this.setState({originalEmail:n})});this.state={message:"",messages:[],isSending:!1,lang:ie[0],conversationId:"",originalEmail:""}}render(){const{onApply:n,getEditorContent:r}=this.props,{message:i,messages:s,isSending:o,lang:a,originalEmail:p}=this.state;return u.createElement("div",{style:{display:"flex",height:"100%",padding:16,flexDirection:"column",background:"#fff",fontFamily:"inherit",boxSizing:"border-box"}},s.length>0?u.createElement(Nt,{items:s,onApply:n,getEditorContent:r}):u.createElement("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"var(--grey-light)"}},u.createElement(rt,{size:46}),u.createElement("h2",{style:{marginTop:16,fontWeight:600,color:"inherit",fontSize:18}},"Build with Agent")),u.createElement("div",{style:{width:"100%",border:"1px solid #ddd",borderRadius:4,background:o?"var(--background-lightGrey)":"#fff",display:"flex",flexDirection:"column"}},u.createElement("textarea",{value:i,onChange:this.handleMessageChange,placeholder:"Describe your email",name:"ai-content",onKeyDown:this.handleKeyDown,disabled:o,style:{flex:1,minWidth:0,borderRadius:4,padding:12,fontSize:13,border:"none",resize:"none",outline:"none",minHeight:60,fontFamily:"inherit"}}),u.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",width:"100%",padding:"8px",boxSizing:"border-box"}},u.createElement(Ht,{lang:a,setLang:this.setLang,originalEmail:p,setOriginalEmail:this.setOriginalEmail,getEditorContent:r}),u.createElement("button",{disabled:!i.trim()||o,onClick:this.handleSubmit,className:"icon-button",color:"primary"},u.createElement(te,null)))))}}const X={baseUrl:"V3",signer:null},Wt=({baseUrl:t,signer:e})=>{X.baseUrl=t,X.signer=e},fe=(()=>{const t=window.location,{hostname:e}=t;return e==="localhost"||e==="127.0.0.1"})(),Me=()=>{var n;let t=window.location;const{host:e}=t;if(fe){const r=(n=X.baseUrl)==null?void 0:n.split("/");return r?"https://"+(r==null?void 0:r[2]):"https://vndev.hanbiro.com"}else{const r=localStorage.getItem("host")||e,i=r==null?void 0:r.split("/");return"https://"+(i==null?void 0:i[0])}},Zt=()=>{let t=window.location;if(fe)return Me()||"https://vndev.hanbiro.com/ngw";{window.location!==window.parent.location&&(t=window.parent.location);const{hostname:e,protocol:n}=t;return[n,"//",e,"/ngw"].join("")}};y.ChatAIDraft=Ut,y.SDKConfig=X,y.getBaseUrl=Me,y.getGroupwareUrl=Zt,y.initHanbiroReactSDK=Wt,y.isDevelopment=fe,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,41 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hanbiro-react16-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "React 16.2.0 compatible UI components for Hanbiro",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
|
-
"main": "./dist/
|
|
6
|
+
"main": "./dist/hanbiro-react16-sdk.umd.js",
|
|
7
|
+
"module": "./dist/hanbiro-react16-sdk.es.js",
|
|
7
8
|
"exports": {
|
|
8
9
|
".": {
|
|
9
10
|
"types": "./dist/index.d.ts",
|
|
10
|
-
"import": "./dist/
|
|
11
|
-
"require": "./dist/
|
|
11
|
+
"import": "./dist/hanbiro-react16-sdk.es.js",
|
|
12
|
+
"require": "./dist/hanbiro-react16-sdk.umd.js"
|
|
12
13
|
},
|
|
13
14
|
"./components": {
|
|
14
15
|
"types": "./dist/components/index.d.ts",
|
|
15
|
-
"import": "./dist/
|
|
16
|
-
"require": "./dist/
|
|
16
|
+
"import": "./dist/hanbiro-react16-sdk.es.js",
|
|
17
|
+
"require": "./dist/hanbiro-react16-sdk.umd.js"
|
|
17
18
|
},
|
|
18
19
|
"./utils": {
|
|
19
20
|
"types": "./dist/utils/index.d.ts",
|
|
20
|
-
"import": "./dist/
|
|
21
|
-
"require": "./dist/
|
|
21
|
+
"import": "./dist/hanbiro-react16-sdk.es.js",
|
|
22
|
+
"require": "./dist/hanbiro-react16-sdk.umd.js"
|
|
22
23
|
},
|
|
23
24
|
"./constants": {
|
|
24
25
|
"types": "./dist/constants/index.d.ts",
|
|
25
|
-
"import": "./dist/
|
|
26
|
-
"require": "./dist/
|
|
26
|
+
"import": "./dist/hanbiro-react16-sdk.es.js",
|
|
27
|
+
"require": "./dist/hanbiro-react16-sdk.umd.js"
|
|
27
28
|
}
|
|
28
29
|
},
|
|
29
30
|
"typesVersions": {
|
|
30
31
|
"*": {
|
|
31
32
|
"components": [
|
|
32
|
-
"./dist/components.d.ts"
|
|
33
|
+
"./dist/components/index.d.ts"
|
|
33
34
|
],
|
|
34
35
|
"utils": [
|
|
35
|
-
"./dist/utils.d.ts"
|
|
36
|
+
"./dist/utils/index.d.ts"
|
|
36
37
|
],
|
|
37
38
|
"constants": [
|
|
38
|
-
"./dist/constants.d.ts"
|
|
39
|
+
"./dist/constants/index.d.ts"
|
|
39
40
|
]
|
|
40
41
|
}
|
|
41
42
|
},
|
package/dist/components/index.js
DELETED
package/dist/components.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './components/index'
|