plugin-build-guide-block 1.1.6 → 1.1.9

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.
Files changed (91) hide show
  1. package/client-v2.d.ts +2 -0
  2. package/client-v2.js +1 -0
  3. package/dist/client/index.js +2 -2
  4. package/dist/client-v2/376.bea427a4cf8864b4.js +10 -0
  5. package/dist/client-v2/index.js +10 -0
  6. package/dist/externalVersion.js +9 -8
  7. package/dist/node_modules/sanitize-html/index.js +2 -2
  8. package/dist/node_modules/sanitize-html/package.json +1 -1
  9. package/dist/server/actions/build.js +5 -2
  10. package/package.json +8 -4
  11. package/src/client/UserGuideManager.tsx +307 -138
  12. package/src/client-v2/index.tsx +1 -0
  13. package/src/client-v2/plugin.tsx +24 -0
  14. package/src/server/actions/build.ts +6 -2
  15. package/dist/node_modules/sanitize-html/node_modules/nanoid/async/index.browser.cjs +0 -34
  16. package/dist/node_modules/sanitize-html/node_modules/nanoid/async/index.browser.js +0 -34
  17. package/dist/node_modules/sanitize-html/node_modules/nanoid/async/index.cjs +0 -35
  18. package/dist/node_modules/sanitize-html/node_modules/nanoid/async/index.d.ts +0 -56
  19. package/dist/node_modules/sanitize-html/node_modules/nanoid/async/index.js +0 -35
  20. package/dist/node_modules/sanitize-html/node_modules/nanoid/async/index.native.js +0 -26
  21. package/dist/node_modules/sanitize-html/node_modules/nanoid/async/package.json +0 -12
  22. package/dist/node_modules/sanitize-html/node_modules/nanoid/bin/nanoid.cjs +0 -55
  23. package/dist/node_modules/sanitize-html/node_modules/nanoid/index.browser.cjs +0 -34
  24. package/dist/node_modules/sanitize-html/node_modules/nanoid/index.browser.js +0 -34
  25. package/dist/node_modules/sanitize-html/node_modules/nanoid/index.cjs +0 -45
  26. package/dist/node_modules/sanitize-html/node_modules/nanoid/index.d.cts +0 -91
  27. package/dist/node_modules/sanitize-html/node_modules/nanoid/index.d.ts +0 -91
  28. package/dist/node_modules/sanitize-html/node_modules/nanoid/index.js +0 -45
  29. package/dist/node_modules/sanitize-html/node_modules/nanoid/nanoid.js +0 -1
  30. package/dist/node_modules/sanitize-html/node_modules/nanoid/non-secure/index.cjs +0 -21
  31. package/dist/node_modules/sanitize-html/node_modules/nanoid/non-secure/index.d.ts +0 -33
  32. package/dist/node_modules/sanitize-html/node_modules/nanoid/non-secure/index.js +0 -21
  33. package/dist/node_modules/sanitize-html/node_modules/nanoid/non-secure/package.json +0 -6
  34. package/dist/node_modules/sanitize-html/node_modules/nanoid/package.json +0 -88
  35. package/dist/node_modules/sanitize-html/node_modules/nanoid/url-alphabet/index.cjs +0 -3
  36. package/dist/node_modules/sanitize-html/node_modules/nanoid/url-alphabet/index.js +0 -3
  37. package/dist/node_modules/sanitize-html/node_modules/nanoid/url-alphabet/package.json +0 -6
  38. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/at-rule.d.ts +0 -115
  39. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/at-rule.js +0 -25
  40. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/comment.d.ts +0 -67
  41. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/comment.js +0 -13
  42. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/container.d.ts +0 -452
  43. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/container.js +0 -439
  44. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/css-syntax-error.d.ts +0 -248
  45. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/css-syntax-error.js +0 -100
  46. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/declaration.d.ts +0 -148
  47. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/declaration.js +0 -24
  48. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/document.d.ts +0 -68
  49. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/document.js +0 -33
  50. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/fromJSON.d.ts +0 -9
  51. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/fromJSON.js +0 -54
  52. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/input.d.ts +0 -194
  53. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/input.js +0 -248
  54. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/lazy-result.d.ts +0 -190
  55. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/lazy-result.js +0 -550
  56. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/list.d.ts +0 -57
  57. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/list.js +0 -58
  58. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/map-generator.js +0 -359
  59. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/no-work-result.d.ts +0 -46
  60. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/no-work-result.js +0 -135
  61. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/node.d.ts +0 -536
  62. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/node.js +0 -381
  63. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/parse.d.ts +0 -9
  64. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/parse.js +0 -42
  65. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/parser.js +0 -610
  66. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/postcss.d.mts +0 -72
  67. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/postcss.d.ts +0 -441
  68. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/postcss.js +0 -101
  69. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/previous-map.d.ts +0 -81
  70. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/previous-map.js +0 -142
  71. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/processor.d.ts +0 -115
  72. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/processor.js +0 -67
  73. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/result.d.ts +0 -206
  74. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/result.js +0 -42
  75. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/root.d.ts +0 -86
  76. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/root.js +0 -61
  77. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/rule.d.ts +0 -113
  78. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/rule.js +0 -27
  79. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/stringifier.d.ts +0 -46
  80. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/stringifier.js +0 -353
  81. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/stringify.d.ts +0 -9
  82. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/stringify.js +0 -11
  83. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/symbols.js +0 -5
  84. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/terminal-highlight.js +0 -70
  85. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/tokenize.js +0 -266
  86. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/warn-once.js +0 -13
  87. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/warning.d.ts +0 -147
  88. package/dist/node_modules/sanitize-html/node_modules/postcss/lib/warning.js +0 -37
  89. package/dist/node_modules/sanitize-html/node_modules/postcss/node_modules/.bin/nanoid +0 -15
  90. package/dist/node_modules/sanitize-html/node_modules/postcss/node_modules/.bin/nanoid.cmd +0 -7
  91. package/dist/node_modules/sanitize-html/node_modules/postcss/package.json +0 -88
package/client-v2.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './dist/client-v2';
2
+ export { default } from './dist/client-v2';
package/client-v2.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/client-v2/index.js');
@@ -7,7 +7,7 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@formily/core"),require("react-i18next"),require("@nocobase/client"),require("react"),require("@formily/react"),require("@nocobase/flow-engine"),require("@ant-design/icons"),require("antd")):"function"==typeof define&&define.amd?define("plugin-build-guide-block",["@formily/core","react-i18next","@nocobase/client","react","@formily/react","@nocobase/flow-engine","@ant-design/icons","antd"],t):"object"==typeof exports?exports["plugin-build-guide-block"]=t(require("@formily/core"),require("react-i18next"),require("@nocobase/client"),require("react"),require("@formily/react"),require("@nocobase/flow-engine"),require("@ant-design/icons"),require("antd")):e["plugin-build-guide-block"]=t(e["@formily/core"],e["react-i18next"],e["@nocobase/client"],e.react,e["@formily/react"],e["@nocobase/flow-engine"],e["@ant-design/icons"],e.antd)}(self,function(e,t,n,r,o,i,l,a){return function(){"use strict";var s={482:function(e){e.exports=l},563:function(t){t.exports=e},505:function(e){e.exports=o},772:function(e){e.exports=n},667:function(e){e.exports=i},721:function(e){e.exports=a},156:function(e){e.exports=r},238:function(e){e.exports=t}},c={};function u(e){var t=c[e];if(void 0!==t)return t.exports;var n=c[e]={exports:{}};return s[e](n,n.exports,u),n.exports}u.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(t,{a:t}),t},u.d=function(e,t){for(var n in t)u.o(t,n)&&!u.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},u.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},u.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var p={};return!function(){u.r(p),u.d(p,{default:function(){return tJ}});var e,t=u(772),n=u(156),r=u.n(n),o=u(563),i=u(505),l=u(721),a=u(238),s={type:"void",name:"ai-build-guide-spaces",properties:{card:{type:"void","x-component":"CardItem","x-decorator":"TableBlockProvider","x-decorator-props":{collection:"aiBuildGuideSpaces",action:"list",rowKey:"id",params:{appends:["documents"],sort:["-createdAt"]}},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{create:{type:"void","x-component":"Action","x-component-props":{type:"primary",title:'{{t("Create space")}}',icon:"PlusOutlined"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-component-props":{title:'{{t("Create space")}}'},properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useCreateFormProps",properties:{title:{type:"string",title:'{{t("Title")}}',required:!0,"x-decorator":"FormItem","x-component":"Input"},llmService:{type:"string",title:'{{t("LLM Service")}}',required:!0,"x-decorator":"FormItem","x-component":"LLMServiceSelect"},model:{type:"string",title:'{{t("Model")}}',required:!0,"x-decorator":"FormItem","x-component":"ModelSelect","x-reactions":{dependencies:["llmService"],fulfill:{state:{value:"{{$deps[0] ? $self.value : undefined}}"}}}},outputFormat:{type:"string",title:'{{t("Output format")}}',required:!0,default:"html","x-decorator":"FormItem","x-component":"Select",enum:[{label:"HTML",value:"html"},{label:"Markdown",value:"markdown"}]},targetChapterCount:{type:"number",title:'{{t("Target chapters")}}',required:!0,default:5,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{min:1,max:12,precision:0,style:{width:"100%"}}},chapterGuidance:{type:"string",title:'{{t("Chapter guidance")}}',"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{rows:3,placeholder:'{{t("Describe how the guide should be split into chapters")}}'}},systemPrompt:{type:"string",title:'{{t("System Prompt")}}',"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{rows:4},default:"You are an expert technical writer. Generate a comprehensive user guide based on the provided documents."},documents:{type:"array",title:'{{t("Documents")}}',"x-decorator":"FormItem","x-component":"Upload.Attachment","x-component-props":{multiple:!0,action:"attachments:create",maxCount:10}},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{type:"void",title:'{{t("Cancel")}}',"x-component":"Action","x-use-component-props":"useCancelActionProps"},submit:{type:"void",title:'{{t("Submit")}}',"x-component":"Action","x-use-component-props":"useCreateActionProps"}}}}}}}}}}},table:{type:"array","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{title:{type:"void",title:'{{t("Title")}}',"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{title:{type:"string","x-component":"Input","x-read-pretty":!0}}},status:{type:"void",title:'{{t("Status")}}',"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{status:{type:"string","x-component":"StatusTag","x-read-pretty":!0}}},buildPhase:{type:"void",title:'{{t("Build Phase")}}',"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{buildPhase:{type:"string","x-component":"Input","x-read-pretty":!0}}},pageCount:{type:"void",title:'{{t("Chapters")}}',"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{pageCount:{type:"integer","x-component":"InputNumber","x-read-pretty":!0}}},buildLog:{type:"void",title:'{{t("Build Log")}}',"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{buildLog:{type:"string","x-component":"Input.TextArea","x-read-pretty":!0}}},actions:{type:"void",title:'{{t("Actions")}}',"x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{build:{type:"void","x-component":"BuildButton"},update:{type:"void",title:'{{t("Edit")}}',"x-component":"Action.Link","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-component-props":{title:'{{t("Edit space")}}'},properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useEditFormProps",properties:{title:{type:"string",title:'{{t("Title")}}',required:!0,"x-decorator":"FormItem","x-component":"Input"},llmService:{type:"string",title:'{{t("LLM Service")}}',required:!0,"x-decorator":"FormItem","x-component":"LLMServiceSelect"},model:{type:"string",title:'{{t("Model")}}',required:!0,"x-decorator":"FormItem","x-component":"ModelSelect"},outputFormat:{type:"string",title:'{{t("Output format")}}',required:!0,"x-decorator":"FormItem","x-component":"Select",enum:[{label:"HTML",value:"html"},{label:"Markdown",value:"markdown"}]},targetChapterCount:{type:"number",title:'{{t("Target chapters")}}',required:!0,default:5,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{min:1,max:12,precision:0,style:{width:"100%"}}},chapterGuidance:{type:"string",title:'{{t("Chapter guidance")}}',"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{rows:3,placeholder:'{{t("Describe how the guide should be split into chapters")}}'}},systemPrompt:{type:"string",title:'{{t("System Prompt")}}',"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{rows:4}},documents:{type:"array",title:'{{t("Documents")}}',"x-decorator":"FormItem","x-component":"Upload.Attachment","x-component-props":{multiple:!0,action:"attachments:create",maxCount:10}},generatedHtml:{type:"string",title:'{{t("Generated HTML")}}',"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{rows:6},"x-read-pretty":!0},generatedMarkdown:{type:"string",title:'{{t("Generated Markdown")}}',"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{rows:6},"x-read-pretty":!0,"x-reactions":{dependencies:["outputFormat"],fulfill:{state:{visible:'{{$deps[0] === "markdown"}}'}}}},buildLog:{type:"string",title:'{{t("Build Log")}}',"x-decorator":"FormItem","x-component":"Input.TextArea","x-read-pretty":!0},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{type:"void",title:'{{t("Cancel")}}',"x-component":"Action","x-use-component-props":"useCancelActionProps"},submit:{type:"void",title:'{{t("Submit")}}',"x-component":"Action","x-use-component-props":"useUpdateActionProps"}}}}}}}}},delete:{type:"void",title:'{{t("Delete")}}',"x-component":"Action.Link","x-use-component-props":"useDestroyActionProps","x-component-props":{confirm:{title:'{{t("Delete")}}',content:'{{t("Are you sure you want to delete this space?")}}'}}}}}}}}}}}}};function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],l=!0,a=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(a)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var d=function(e){var o,a,s=f((0,n.useState)([]),2),c=s[0],u=s[1],p=f((0,n.useState)(!1),2),d=p[0],h=p[1],m=(0,t.useAPIClient)(),g=(0,i.useField)();return(0,n.useEffect)(function(){var e=!0;return h(!0),m.resource("ai").listLLMServices().then(function(t){if(e){var n;u(((null==t||null==(n=t.data)?void 0:n.data)||[]).map(function(e){return{label:e.title||e.name,value:e.name}}))}}).catch(function(t){e&&console.error("Failed to load LLM services:",t)}).finally(function(){e&&h(!1)}),function(){e=!1}},[m]),r().createElement(l.Select,(o=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},e),a=a={options:c,loading:d,value:g.value,onChange:function(e){var t;g.setValue(e),null==(t=g.query(".model").take())||t.setValue(void 0)}},Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(a)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(a)).forEach(function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(a,e))}),o))};function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var m=(0,i.observer)(function(e){var o,a,s,c=(o=(0,n.useState)([]),function(e){if(Array.isArray(e))return e}(o)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],l=!0,a=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(i.push(n.value),i.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(a)throw r}}return i}}(o,2)||function(e,t){if(e){if("string"==typeof e)return h(e,2);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return h(e,t)}}(o,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=c[0],p=c[1],f=(0,t.useAPIClient)(),d=(0,i.useField)(),m=(0,i.useForm)().values.llmService;return(0,n.useEffect)(function(){var e=!0;return m?(f.resource("ai").listModels({llmService:m}).then(function(t){if(e){var n;p(((null==t||null==(n=t.data)?void 0:n.data)||[]).map(function(e){return{label:e.id||e.name,value:e.id||e.name}}))}}).catch(console.error),function(){e=!1}):void p([])},[f,m]),r().createElement(l.Select,(a=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},e),s=s={options:u,value:d.value,onChange:function(e){d.setValue(e)},disabled:!m},Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(s)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(s)).forEach(function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(s,e))}),a))}),g={draft:"default",building:"blue",completed:"success",error:"error"},b=function(e){var t=(0,i.useField)(),n=e.value||t.value;return n?r().createElement(l.Tag,{color:g[n]||"default"},String(n).toUpperCase()):null},y=u(482);function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function k(e,t,n,r,o,i,l){try{var a=e[i](l),s=a.value}catch(e){n(e);return}a.done?t(s):Promise.resolve(s).then(r,o)}function w(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function l(e){k(i,r,o,l,a,"next",e)}function a(e){k(i,r,o,l,a,"throw",e)}l(void 0)})}}function v(e,t){var n,r,o,i,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){var s=[i,a];if(n)throw TypeError("Generator is already executing.");for(;l;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return l.label++,{value:s[1],done:!1};case 5:l.label++,r=s[1],s=[0];continue;case 7:s=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){l=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){l.label=s[1];break}if(6===s[0]&&l.label<o[1]){l.label=o[1],o=s;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(s);break}o[2]&&l.ops.pop(),l.trys.pop();continue}s=t.call(e,l)}catch(e){s=[6,e],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}var S=function(){var e,o,i=(e=(0,n.useState)(!1),function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],l=!0,a=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(i.push(n.value),i.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(a)throw r}}return i}}(e,2)||function(e,t){if(e){if("string"==typeof e)return x(e,2);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return x(e,t)}}(e,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),s=i[0],c=i[1],u=(0,t.useAPIClient)(),p=l.App.useApp().message,f=(0,a.useTranslation)().t,d=(0,t.useCollectionRecordData)(),h=(0,t.useDataBlockRequest)().refresh,m=(0,n.useRef)(null),g=(0,n.useCallback)(function(){m.current&&(clearTimeout(m.current),m.current=null),c(!1)},[]);(0,n.useEffect)(function(){return g},[g]);var b=(o=w(function(){var e,t,n,r,o,i,l;return v(this,function(a){switch(a.label){case 0:if(!(null==d?void 0:d.id))return[2];c(!0),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,u.resource("aiBuildGuideSpaces").build({filterByTk:d.id})];case 2:var s;return a.sent(),p.success(f("Build started")),e=Date.now(),t=!1,s=w(function(){var r,o,i,l,a;return v(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,u.resource("aiBuildGuideSpaces").get({filterByTk:d.id})];case 1:if("building"!==(l=null==(i=s.sent())||null==(o=i.data)||null==(r=o.data)?void 0:r.status))return g(),null==h||h(),"completed"===l?p.success(f("Build completed")):"error"===l&&p.error(f("Build failed")),[2];return(a=Date.now()-e)>=3e5&&!t&&(t=!0,p.info(f("Build is still running"))),m.current=setTimeout(n,a>=3e5?1e4:3e3),[3,3];case 2:return s.sent(),g(),null==h||h(),[3,3];case 3:return[2]}})}),m.current=setTimeout(n=function(){return s.apply(this,arguments)},3e3),[3,4];case 3:return console.error(r=a.sent()),p.error((null==r||null==(l=r.response)||null==(i=l.data)||null==(o=i.error)?void 0:o.message)||f("Build failed")),c(!1),[3,4];case 4:return[2]}})}),function(){return o.apply(this,arguments)});return r().createElement(l.Button,{type:"primary",icon:r().createElement(y.PlayCircleOutlined,null),loading:s,onClick:b,disabled:(null==d?void 0:d.status)==="building"},f("Build"))};function O(e,t,n,r,o,i,l){try{var a=e[i](l),s=a.value}catch(e){n(e);return}a.done?t(s):Promise.resolve(s).then(r,o)}function T(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function l(e){O(i,r,o,l,a,"next",e)}function a(e){O(i,r,o,l,a,"throw",e)}l(void 0)})}}function A(e,t){var n,r,o,i,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){var s=[i,a];if(n)throw TypeError("Generator is already executing.");for(;l;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return l.label++,{value:s[1],done:!1};case 5:l.label++,r=s[1],s=[0];continue;case 7:s=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){l=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){l.label=s[1];break}if(6===s[0]&&l.label<o[1]){l.label=o[1],o=s;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(s);break}o[2]&&l.ops.pop(),l.trys.pop();continue}s=t.call(e,l)}catch(e){s=[6,e],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}var E=function(e){var t=Number(e);return Number.isFinite(t)?Math.max(1,Math.min(12,Math.round(t))):5},_=function(){var e=(0,a.useTranslation)().t,c=function(e){var t=e.documents,n=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,["documents"]);return n.targetChapterCount=E(n.targetChapterCount),Array.isArray(t)&&(n.documents=t.map(function(e){return(void 0===e?"undefined":e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="object"&&(null==e?void 0:e.id)?{id:e.id}:e})),n};return r().createElement(t.SchemaComponent,{schema:s,components:{LLMServiceSelect:d,ModelSelect:m,StatusTag:b,BuildButton:S},scope:{t:e,useCreateFormProps:function(){return{form:(0,n.useMemo)(function(){return(0,o.createForm)({initialValues:{targetChapterCount:5}})},[])}},useEditFormProps:function(){var e=(0,t.useCollectionRecordData)();return{form:(0,n.useMemo)(function(){var t,n;return(0,o.createForm)({initialValues:(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},e),n=n={targetChapterCount:E(null==e?void 0:e.targetChapterCount)},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t)})},[e])}},useCancelActionProps:function(){var e=(0,t.useActionContext)().setVisible;return{type:"default",onClick:function(){e(!1)}}},useCreateActionProps:function(){var n=(0,t.useActionContext)().setVisible,r=l.App.useApp().message,o=(0,t.useDataBlockResource)(),a=(0,t.useDataBlockRequest)().refresh,s=(0,i.useForm)();return{type:"primary",onClick:function(){return T(function(){var t;return A(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),[4,s.submit()];case 1:return i.sent(),[4,o.create({values:c(s.values)})];case 2:return i.sent(),a(),r.success(e("Saved successfully")),n(!1),[3,4];case 3:return(null==(t=i.sent())?void 0:t.name)!=="ValidateError"&&r.error((null==t?void 0:t.message)||e("Save failed")),[3,4];case 4:return[2]}})})()}}},useUpdateActionProps:function(){var n=(0,t.useActionContext)().setVisible,r=l.App.useApp().message,o=(0,t.useDataBlockResource)(),a=(0,t.useDataBlockRequest)().refresh,s=(0,t.useCollectionRecordData)(),u=(0,i.useForm)();return{type:"primary",onClick:function(){return T(function(){var t;return A(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),[4,u.submit()];case 1:return i.sent(),[4,o.update({filterByTk:s.id,values:c(u.values)})];case 2:return i.sent(),a(),r.success(e("Saved successfully")),n(!1),[3,4];case 3:return(null==(t=i.sent())?void 0:t.name)!=="ValidateError"&&r.error((null==t?void 0:t.message)||e("Save failed")),[3,4];case 4:return[2]}})})()}}},useDestroyActionProps:t.useDestroyActionProps,useTableBlockProps:t.useTableBlockProps}})};function I(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}let C=Object.entries,P=Object.setPrototypeOf,R=Object.isFrozen,D=Object.getPrototypeOf,N=Object.getOwnPropertyDescriptor,j=Object.freeze,L=Object.seal,z=Object.create,M="undefined"!=typeof Reflect&&Reflect,$=M.apply,B=M.construct;j||(j=function(e){return e}),L||(L=function(e){return e}),$||($=function(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return e.apply(t,r)}),B||(B=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)});let F=ea(Array.prototype.forEach),U=ea(Array.prototype.lastIndexOf),q=ea(Array.prototype.pop),G=ea(Array.prototype.push),H=ea(Array.prototype.splice),W=Array.isArray,V=ea(String.prototype.toLowerCase),Z=ea(String.prototype.toString),Y=ea(String.prototype.match),Q=ea(String.prototype.replace),X=ea(String.prototype.indexOf),K=ea(String.prototype.trim),J=ea(Number.prototype.toString),ee=ea(Boolean.prototype.toString),et="undefined"==typeof BigInt?null:ea(BigInt.prototype.toString),en="undefined"==typeof Symbol?null:ea(Symbol.prototype.toString),er=ea(Object.prototype.hasOwnProperty),eo=ea(Object.prototype.toString),ei=ea(RegExp.prototype.test),el=(e=TypeError,function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return B(e,n)});function ea(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return $(e,t,r)}}function es(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:V;if(P&&P(e,null),!W(t))return e;let r=t.length;for(;r--;){let o=t[r];if("string"==typeof o){let e=n(o);e!==o&&(R(t)||(t[r]=e),o=e)}e[o]=!0}return e}function ec(e){let t=z(null);for(let r of C(e)){var n=function(e){if(Array.isArray(e))return e}(r)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,l,a=[],s=!0,c=!1;try{i=(n=n.call(e)).next,!1;for(;!(s=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return a}}(r,2)||function(e,t){if(e){if("string"==typeof e)return I(e,2);var n=({}).toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?I(e,t):void 0}}(r,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();let o=n[0],i=n[1];er(e,o)&&(W(i)?t[o]=function(e){for(let t=0;t<e.length;t++)er(e,t)||(e[t]=null);return e}(i):i&&"object"==typeof i&&i.constructor===Object?t[o]=ec(i):t[o]=i)}return t}function eu(e,t){for(;null!==e;){let n=N(e,t);if(n){if(n.get)return ea(n.get);if("function"==typeof n.value)return ea(n.value)}e=D(e)}return function(){return null}}let ep=j(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ef=j(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ed=j(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),eh=j(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),em=j(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),eg=j(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),eb=j(["#text"]),ey=j(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),ex=j(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),ek=j(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ew=j(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),ev=L(/{{[\w\W]*|^[\w\W]*}}/g),eS=L(/<%[\w\W]*|^[\w\W]*%>/g),eO=L(/\${[\w\W]*/g),eT=L(/^data-[\-\w.\u00B7-\uFFFF]+$/),eA=L(/^aria-[\-\w]+$/),eE=L(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),e_=L(/^(?:\w+script|data):/i),eI=L(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),eC=L(/^html$/i),eP=L(/^[a-z][.\w]*(-[.\w]+)+$/i),eR={element:1,text:3,progressingInstruction:7,comment:8,document:9},eD=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null,r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}},eN=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};var ej=function e(){let t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"undefined"==typeof window?null:window,r=t=>e(t);if(r.version="3.4.5",r.removed=[],!n||!n.document||n.document.nodeType!==eR.document||!n.Element)return r.isSupported=!1,r;let o=n.document,i=o,l=i.currentScript,a=n.DocumentFragment,s=n.HTMLTemplateElement,c=n.Node,u=n.Element,p=n.NodeFilter,f=n.NamedNodeMap,d=void 0===f?n.NamedNodeMap||n.MozNamedAttrMap:f,h=n.HTMLFormElement,m=n.DOMParser,g=n.trustedTypes,b=u.prototype,y=eu(b,"cloneNode"),x=eu(b,"remove"),k=eu(b,"nextSibling"),w=eu(b,"childNodes"),v=eu(b,"parentNode"),S=c&&c.prototype?eu(c.prototype,"nodeType"):null;if("function"==typeof s){let e=o.createElement("template");e.content&&e.content.ownerDocument&&(o=e.content.ownerDocument)}let O="",T=o,A=T.implementation,E=T.createNodeIterator,_=T.createDocumentFragment,I=T.getElementsByTagName,P=i.importNode,R=eN();r.isSupported="function"==typeof C&&"function"==typeof v&&A&&void 0!==A.createHTMLDocument;let D=eE,N=null,L=es({},[...ep,...ef,...ed,...em,...eb]),M=null,$=es({},[...ey,...ex,...ek,...ew]),B=Object.seal(z(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ea=null,ej=null,eL=Object.seal(z(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),ez=!0,eM=!0,e$=!1,eB=!0,eF=!1,eU=!0,eq=!1,eG=!1,eH=!1,eW=!1,eV=!1,eZ=!1,eY=!0,eQ=!1,eX="user-content-",eK=!0,eJ=!1,e0={},e1=null,e2=es({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),e3=null,e6=es({},["audio","video","img","source","image","track"]),e4=null,e9=es({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),e8="http://www.w3.org/1998/Math/MathML",e5="http://www.w3.org/2000/svg",e7="http://www.w3.org/1999/xhtml",te=e7,tt=!1,tn=null,tr=es({},[e8,e5,e7],Z),to=es({},["mi","mo","mn","ms","mtext"]),ti=es({},["annotation-xml"]),tl=es({},["title","style","font","a","script"]),ta=null,ts=["application/xhtml+xml","text/html"],tc=null,tu=null,tp=o.createElement("form"),tf=function(e){return e instanceof RegExp||e instanceof Function},td=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(tu&&tu===e)return;e&&"object"==typeof e||(e={}),e=ec(e),tc="application/xhtml+xml"===(ta=-1===ts.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE)?Z:V,N=er(e,"ALLOWED_TAGS")&&W(e.ALLOWED_TAGS)?es({},e.ALLOWED_TAGS,tc):L,M=er(e,"ALLOWED_ATTR")&&W(e.ALLOWED_ATTR)?es({},e.ALLOWED_ATTR,tc):$,tn=er(e,"ALLOWED_NAMESPACES")&&W(e.ALLOWED_NAMESPACES)?es({},e.ALLOWED_NAMESPACES,Z):tr,e4=er(e,"ADD_URI_SAFE_ATTR")&&W(e.ADD_URI_SAFE_ATTR)?es(ec(e9),e.ADD_URI_SAFE_ATTR,tc):e9,e3=er(e,"ADD_DATA_URI_TAGS")&&W(e.ADD_DATA_URI_TAGS)?es(ec(e6),e.ADD_DATA_URI_TAGS,tc):e6,e1=er(e,"FORBID_CONTENTS")&&W(e.FORBID_CONTENTS)?es({},e.FORBID_CONTENTS,tc):e2,ea=er(e,"FORBID_TAGS")&&W(e.FORBID_TAGS)?es({},e.FORBID_TAGS,tc):ec({}),ej=er(e,"FORBID_ATTR")&&W(e.FORBID_ATTR)?es({},e.FORBID_ATTR,tc):ec({}),e0=!!er(e,"USE_PROFILES")&&(e.USE_PROFILES&&"object"==typeof e.USE_PROFILES?ec(e.USE_PROFILES):e.USE_PROFILES),ez=!1!==e.ALLOW_ARIA_ATTR,eM=!1!==e.ALLOW_DATA_ATTR,e$=e.ALLOW_UNKNOWN_PROTOCOLS||!1,eB=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,eF=e.SAFE_FOR_TEMPLATES||!1,eU=!1!==e.SAFE_FOR_XML,eq=e.WHOLE_DOCUMENT||!1,eW=e.RETURN_DOM||!1,eV=e.RETURN_DOM_FRAGMENT||!1,eZ=e.RETURN_TRUSTED_TYPE||!1,eH=e.FORCE_BODY||!1,eY=!1!==e.SANITIZE_DOM,eQ=e.SANITIZE_NAMED_PROPS||!1,eK=!1!==e.KEEP_CONTENT,eJ=e.IN_PLACE||!1,D=!function(e){try{return ei(e,""),!0}catch(e){return!1}}(e.ALLOWED_URI_REGEXP)?eE:e.ALLOWED_URI_REGEXP,te="string"==typeof e.NAMESPACE?e.NAMESPACE:e7,to=er(e,"MATHML_TEXT_INTEGRATION_POINTS")&&e.MATHML_TEXT_INTEGRATION_POINTS&&"object"==typeof e.MATHML_TEXT_INTEGRATION_POINTS?ec(e.MATHML_TEXT_INTEGRATION_POINTS):es({},["mi","mo","mn","ms","mtext"]),ti=er(e,"HTML_INTEGRATION_POINTS")&&e.HTML_INTEGRATION_POINTS&&"object"==typeof e.HTML_INTEGRATION_POINTS?ec(e.HTML_INTEGRATION_POINTS):es({},["annotation-xml"]);let n=er(e,"CUSTOM_ELEMENT_HANDLING")&&e.CUSTOM_ELEMENT_HANDLING&&"object"==typeof e.CUSTOM_ELEMENT_HANDLING?ec(e.CUSTOM_ELEMENT_HANDLING):z(null);if(B=z(null),er(n,"tagNameCheck")&&tf(n.tagNameCheck)&&(B.tagNameCheck=n.tagNameCheck),er(n,"attributeNameCheck")&&tf(n.attributeNameCheck)&&(B.attributeNameCheck=n.attributeNameCheck),er(n,"allowCustomizedBuiltInElements")&&"boolean"==typeof n.allowCustomizedBuiltInElements&&(B.allowCustomizedBuiltInElements=n.allowCustomizedBuiltInElements),eF&&(eM=!1),eV&&(eW=!0),e0&&(N=es({},eb),M=z(null),!0===e0.html&&(es(N,ep),es(M,ey)),!0===e0.svg&&(es(N,ef),es(M,ex),es(M,ew)),!0===e0.svgFilters&&(es(N,ed),es(M,ex),es(M,ew)),!0===e0.mathMl&&(es(N,em),es(M,ek),es(M,ew))),eL.tagCheck=null,eL.attributeCheck=null,er(e,"ADD_TAGS")&&("function"==typeof e.ADD_TAGS?eL.tagCheck=e.ADD_TAGS:W(e.ADD_TAGS)&&(N===L&&(N=ec(N)),es(N,e.ADD_TAGS,tc))),er(e,"ADD_ATTR")&&("function"==typeof e.ADD_ATTR?eL.attributeCheck=e.ADD_ATTR:W(e.ADD_ATTR)&&(M===$&&(M=ec(M)),es(M,e.ADD_ATTR,tc))),er(e,"ADD_URI_SAFE_ATTR")&&W(e.ADD_URI_SAFE_ATTR)&&es(e4,e.ADD_URI_SAFE_ATTR,tc),er(e,"FORBID_CONTENTS")&&W(e.FORBID_CONTENTS)&&(e1===e2&&(e1=ec(e1)),es(e1,e.FORBID_CONTENTS,tc)),er(e,"ADD_FORBID_CONTENTS")&&W(e.ADD_FORBID_CONTENTS)&&(e1===e2&&(e1=ec(e1)),es(e1,e.ADD_FORBID_CONTENTS,tc)),eK&&(N["#text"]=!0),eq&&es(N,["html","head","body"]),N.table&&(es(N,["tbody"]),delete ea.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw el('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw el('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');O=(t=e.TRUSTED_TYPES_POLICY).createHTML("")}else void 0===t&&(t=eD(g,l)),null!==t&&"string"==typeof O&&(O=t.createHTML(""));j&&j(e),tu=e},th=es({},[...ef,...ed,...eh]),tm=es({},[...em,...eg]),tg=function(e){let t=v(e);t&&t.tagName||(t={namespaceURI:te,tagName:"template"});let n=V(e.tagName),r=V(t.tagName);return!!tn[e.namespaceURI]&&(e.namespaceURI===e5?t.namespaceURI===e7?"svg"===n:t.namespaceURI===e8?"svg"===n&&("annotation-xml"===r||to[r]):!!th[n]:e.namespaceURI===e8?t.namespaceURI===e7?"math"===n:t.namespaceURI===e5?"math"===n&&ti[r]:!!tm[n]:e.namespaceURI===e7?(t.namespaceURI!==e5||!!ti[r])&&(t.namespaceURI!==e8||!!to[r])&&!tm[n]&&(tl[n]||!th[n]):"application/xhtml+xml"===ta&&!!tn[e.namespaceURI])},tb=function(e){G(r.removed,{element:e});try{v(e).removeChild(e)}catch(t){x(e)}},ty=function(e,t){try{G(r.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){G(r.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(eW||eV)try{tb(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},tx=function(e){let n=null,r=null;if(eH)e="<remove></remove>"+e;else{let t=Y(e,/^[\r\n\t ]+/);r=t&&t[0]}"application/xhtml+xml"===ta&&te===e7&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");let i=t?t.createHTML(e):e;if(te===e7)try{n=new m().parseFromString(i,ta)}catch(e){}if(!n||!n.documentElement){n=A.createDocument(te,"template",null);try{n.documentElement.innerHTML=tt?O:i}catch(e){}}let l=n.body||n.documentElement;return(e&&r&&l.insertBefore(o.createTextNode(r),l.childNodes[0]||null),te===e7)?I.call(n,eq?"html":"body")[0]:eq?n.documentElement:l},tk=function(e){return E.call(e.ownerDocument||e,e,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},tw=function(e){e.normalize();let t=E.call(e.ownerDocument||e,e,p.SHOW_TEXT|p.SHOW_COMMENT|p.SHOW_CDATA_SECTION|p.SHOW_PROCESSING_INSTRUCTION,null),n=t.nextNode();for(;n;){let e=n.data;F([ev,eS,eO],t=>{e=Q(e,t," ")}),n.data=e,n=t.nextNode()}},tv=function(e){return e instanceof h&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof d)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},tS=function(e){if(!S||"object"!=typeof e||null===e)return!1;try{return"number"==typeof S(e)}catch(e){return!1}};function tO(e,t,n){F(e,e=>{e.call(r,t,n,tu)})}let tT=function(e){let t=null;if(tO(R.beforeSanitizeElements,e,null),tv(e))return tb(e),!0;let n=tc(e.nodeName);if(tO(R.uponSanitizeElement,e,{tagName:n,allowedTags:N}),eU&&e.hasChildNodes()&&!tS(e.firstElementChild)&&ei(/<[/\w!]/g,e.innerHTML)&&ei(/<[/\w!]/g,e.textContent)||eU&&e.namespaceURI===e7&&"style"===n&&tS(e.firstElementChild)||e.nodeType===eR.progressingInstruction||eU&&e.nodeType===eR.comment&&ei(/<[/\w]/g,e.data))return tb(e),!0;if(ea[n]||!(eL.tagCheck instanceof Function&&eL.tagCheck(n))&&!N[n]){if(!ea[n]&&t_(n)&&(B.tagNameCheck instanceof RegExp&&ei(B.tagNameCheck,n)||B.tagNameCheck instanceof Function&&B.tagNameCheck(n)))return!1;if(eK&&!e1[n]){let t=v(e)||e.parentNode,n=w(e)||e.childNodes;if(n&&t){let r=n.length;for(let o=r-1;o>=0;--o){let r=y(n[o],!0);t.insertBefore(r,k(e))}}}return tb(e),!0}return e instanceof u&&!tg(e)||("noscript"===n||"noembed"===n||"noframes"===n)&&ei(/<\/no(script|embed|frames)/i,e.innerHTML)?(tb(e),!0):(eF&&e.nodeType===eR.text&&(t=e.textContent,F([ev,eS,eO],e=>{t=Q(t,e," ")}),e.textContent!==t&&(G(r.removed,{element:e.cloneNode()}),e.textContent=t)),tO(R.afterSanitizeElements,e,null),!1)},tA=function(e,t,n){if(ej[t]||eY&&("id"===t||"name"===t)&&(n in o||n in tp))return!1;let r=M[t]||eL.attributeCheck instanceof Function&&eL.attributeCheck(t,e);if(eM&&!ej[t]&&ei(eT,t));else if(ez&&ei(eA,t));else if(!r||ej[t]){if(!(t_(e)&&(B.tagNameCheck instanceof RegExp&&ei(B.tagNameCheck,e)||B.tagNameCheck instanceof Function&&B.tagNameCheck(e))&&(B.attributeNameCheck instanceof RegExp&&ei(B.attributeNameCheck,t)||B.attributeNameCheck instanceof Function&&B.attributeNameCheck(t,e))||"is"===t&&B.allowCustomizedBuiltInElements&&(B.tagNameCheck instanceof RegExp&&ei(B.tagNameCheck,n)||B.tagNameCheck instanceof Function&&B.tagNameCheck(n))))return!1}else if(e4[t]);else if(ei(D,Q(n,eI,"")));else if(("src"===t||"xlink:href"===t||"href"===t)&&"script"!==e&&0===X(n,"data:")&&e3[e]);else if(e$&&!ei(e_,Q(n,eI,"")));else if(n)return!1;return!0},tE=es({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),t_=function(e){return!tE[V(e)]&&ei(eP,e)},tI=function(e){tO(R.beforeSanitizeAttributes,e,null);let n=e.attributes;if(!n||tv(e))return;let o={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:M,forceKeepAttr:void 0},i=n.length;for(;i--;){let l=n[i],a=l.name,s=l.namespaceURI,c=l.value,u=tc(a),p="value"===a?c:K(c);if(o.attrName=u,o.attrValue=p,o.keepAttr=!0,o.forceKeepAttr=void 0,tO(R.uponSanitizeAttribute,e,o),p=o.attrValue,eQ&&("id"===u||"name"===u)&&0!==X(p,eX)&&(ty(a,e),p=eX+p),eU&&ei(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,p)||"attributename"===u&&Y(p,"href")){ty(a,e);continue}if(o.forceKeepAttr)continue;if(!o.keepAttr||!eB&&ei(/\/>/i,p)){ty(a,e);continue}eF&&F([ev,eS,eO],e=>{p=Q(p,e," ")});let f=tc(e.nodeName);if(!tA(f,u,p)){ty(a,e);continue}if(t&&"object"==typeof g&&"function"==typeof g.getAttributeType)if(s);else switch(g.getAttributeType(f,u)){case"TrustedHTML":p=t.createHTML(p);break;case"TrustedScriptURL":p=t.createScriptURL(p)}if(p!==c)try{s?e.setAttributeNS(s,a,p):e.setAttribute(a,p),tv(e)?tb(e):q(r.removed)}catch(t){ty(a,e)}}tO(R.afterSanitizeAttributes,e,null)},tC=function(e){let t=null,n=tk(e);for(tO(R.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)tO(R.uponSanitizeShadowNode,t,null),tT(t),tI(t),t.content instanceof a&&tC(t.content);tO(R.afterSanitizeShadowDOM,e,null)},tP=function(e){if(e.nodeType===eR.element&&e.shadowRoot instanceof a){let t=e.shadowRoot;tP(t),tC(t)}let t=e.childNodes;if(!t)return;let n=[];for(let e of(F(t,e=>{G(n,e)}),n))tP(e)};return r.sanitize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=null,l=null,s=null,c=null;if((tt=!e)&&(e="\x3c!--\x3e"),"string"!=typeof e&&!tS(e)&&"string"!=typeof(e=function(e){switch(typeof e){case"string":return e;case"number":return J(e);case"boolean":return ee(e);case"bigint":return et?et(e):"0";case"symbol":return en?en(e):"Symbol()";case"undefined":default:return eo(e);case"function":case"object":{if(null===e)return eo(e);let t=eu(e,"toString");if("function"==typeof t){let n=t(e);return"string"==typeof n?n:eo(n)}return eo(e)}}}(e)))throw el("dirty is not a string, aborting");if(!r.isSupported)return e;if(eG||td(n),r.removed=[],"string"==typeof e&&(eJ=!1),eJ){let t=e.nodeName;if("string"==typeof t){let e=tc(t);if(!N[e]||ea[e])throw el("root node is forbidden and cannot be sanitized in-place")}tP(e)}else if(tS(e))(l=(o=tx("\x3c!----\x3e")).ownerDocument.importNode(e,!0)).nodeType===eR.element&&"BODY"===l.nodeName||"HTML"===l.nodeName?o=l:o.appendChild(l),tP(l);else{if(!eW&&!eF&&!eq&&-1===e.indexOf("<"))return t&&eZ?t.createHTML(e):e;if(!(o=tx(e)))return eW?null:eZ?O:""}o&&eH&&tb(o.firstChild);let u=tk(eJ?e:o);for(;s=u.nextNode();)tT(s),tI(s),s.content instanceof a&&tC(s.content);if(eJ)return eF&&tw(e),e;if(eW){if(eF&&tw(o),eV)for(c=_.call(o.ownerDocument);o.firstChild;)c.appendChild(o.firstChild);else c=o;return(M.shadowroot||M.shadowrootmode)&&(c=P.call(i,c,!0)),c}let p=eq?o.outerHTML:o.innerHTML;return eq&&N["!doctype"]&&o.ownerDocument&&o.ownerDocument.doctype&&o.ownerDocument.doctype.name&&ei(eC,o.ownerDocument.doctype.name)&&(p="<!DOCTYPE "+o.ownerDocument.doctype.name+">\n"+p),eF&&F([ev,eS,eO],e=>{p=Q(p,e," ")}),t&&eZ?t.createHTML(p):p},r.setConfig=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};td(e),eG=!0},r.clearConfig=function(){tu=null,eG=!1},r.isValidAttribute=function(e,t,n){return tu||td({}),tA(tc(e),tc(t),n)},r.addHook=function(e,t){"function"==typeof t&&G(R[e],t)},r.removeHook=function(e,t){if(void 0!==t){let n=U(R[e],t);return -1===n?void 0:H(R[e],n,1)[0]}return q(R[e])},r.removeHooks=function(e){R[e]=[]},r.removeAllHooks=function(){R=eN()},r}();function eL(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let ez=eL(),eM=/[&<>"']/,e$=RegExp(eM.source,"g"),eB=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,eF=RegExp(eB.source,"g"),eU={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},eq=e=>eU[e];function eG(e,t){if(t){if(eM.test(e))return e.replace(e$,eq)}else if(eB.test(e))return e.replace(eF,eq);return e}let eH=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,eW=/(^|[^\[])\^/g;function eV(e,t){let n="string"==typeof e?e:e.source;t=t||"";let r={replace:(e,t)=>{let o="string"==typeof t?t:t.source;return o=o.replace(eW,"$1"),n=n.replace(e,o),r},getRegex:()=>new RegExp(n,t)};return r}function eZ(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch(e){return null}return e}let eY={exec:()=>null};function eQ(e,t){let n=e.replace(/\|/g,(e,t,n)=>{let r=!1,o=t;for(;--o>=0&&"\\"===n[o];)r=!r;return r?"|":" |"}).split(/ \|/),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(/\\\|/g,"|");return n}function eX(e,t,n){let r=e.length;if(0===r)return"";let o=0;for(;o<r;){let i=e.charAt(r-o-1);if(i!==t||n)if(i!==t&&n)o++;else break;else o++}return e.slice(0,r-o)}function eK(e,t,n,r){let o=t.href,i=t.title?eG(t.title):null,l=e[1].replace(/\\([\[\]])/g,"$1");if("!"!==e[0].charAt(0)){r.state.inLink=!0;let e={type:"link",raw:n,href:o,title:i,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,e}return{type:"image",raw:n,href:o,title:i,text:eG(l)}}class eJ{options;rules;lexer;constructor(e){this.options=e||ez}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:eX(e,"\n")}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=function(e,t){let n=e.match(/^(\s+)(?:```)/);if(null===n)return t;let r=n[1];return t.split("\n").map(e=>{let t=e.match(/^\s+/);if(null===t)return e;let[n]=t;return n.length>=r.length?e.slice(r.length):e}).join("\n")}(e,t[3]||"");return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){let t=eX(e,"#");this.options.pedantic?e=t.trim():(!t||/ $/.test(t))&&(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=t[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,"\n $1");e=eX(e.replace(/^ *>[ \t]?/gm,""),"\n");let n=this.lexer.state.top;this.lexer.state.top=!0;let r=this.lexer.blockTokens(e);return this.lexer.state.top=n,{type:"blockquote",raw:t[0],tokens:r,text:e}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,o={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:"[*+-]");let i=RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),l="",a="",s=!1;for(;e;){let n,r=!1;if(!(t=i.exec(e))||this.rules.block.hr.test(e))break;l=t[0],e=e.substring(l.length);let c=t[2].split("\n",1)[0].replace(/^\t+/,e=>" ".repeat(3*e.length)),u=e.split("\n",1)[0],p=0;this.options.pedantic?(p=2,a=c.trimStart()):(p=(p=t[2].search(/[^ ]/))>4?1:p,a=c.slice(p),p+=t[1].length);let f=!1;if(!c&&/^ *$/.test(u)&&(l+=u+"\n",e=e.substring(u.length+1),r=!0),!r){let t=RegExp(`^ {0,${Math.min(3,p-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),n=RegExp(`^ {0,${Math.min(3,p-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),r=RegExp(`^ {0,${Math.min(3,p-1)}}(?:\`\`\`|~~~)`),o=RegExp(`^ {0,${Math.min(3,p-1)}}#`);for(;e;){let i=e.split("\n",1)[0];if(u=i,this.options.pedantic&&(u=u.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),r.test(u)||o.test(u)||t.test(u)||n.test(e))break;if(u.search(/[^ ]/)>=p||!u.trim())a+="\n"+u.slice(p);else{if(f||c.search(/[^ ]/)>=4||r.test(c)||o.test(c)||n.test(c))break;a+="\n"+u}f||u.trim()||(f=!0),l+=i+"\n",e=e.substring(i.length+1),c=u.slice(p)}}!o.loose&&(s?o.loose=!0:/\n *\n *$/.test(l)&&(s=!0));let d=null;this.options.gfm&&(d=/^\[[ xX]\] /.exec(a))&&(n="[ ] "!==d[0],a=a.replace(/^\[[ xX]\] +/,"")),o.items.push({type:"list_item",raw:l,task:!!d,checked:n,loose:!1,text:a,tokens:[]}),o.raw+=l}o.items[o.items.length-1].raw=l.trimEnd(),o.items[o.items.length-1].text=a.trimEnd(),o.raw=o.raw.trimEnd();for(let e=0;e<o.items.length;e++)if(this.lexer.state.top=!1,o.items[e].tokens=this.lexer.blockTokens(o.items[e].text,[]),!o.loose){let t=o.items[e].tokens.filter(e=>"space"===e.type);o.loose=t.length>0&&t.some(e=>/\n.*\n/.test(e.raw))}if(o.loose)for(let e=0;e<o.items.length;e++)o.items[e].loose=!0;return o}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(/\s+/g," "),n=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!/[:|]/.test(t[2]))return;let n=eQ(t[1]),r=t[2].replace(/^\||\| *$/g,"").split("|"),o=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[],i={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)/^ *-+: *$/.test(e)?i.align.push("right"):/^ *:-+: *$/.test(e)?i.align.push("center"):/^ *:-+ *$/.test(e)?i.align.push("left"):i.align.push(null);for(let e of n)i.header.push({text:e,tokens:this.lexer.inline(e)});for(let e of o)i.rows.push(eQ(e,i.header.length).map(e=>({text:e,tokens:this.lexer.inline(e)})));return i}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:eG(t[1])}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&/^</.test(e)){if(!/>$/.test(e))return;let t=eX(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{let e=function(e,t){if(-1===e.indexOf(")"))return -1;let n=0;for(let r=0;r<e.length;r++)if("\\"===e[r])r++;else if("("===e[r])n++;else if(e[r]===t[1]&&--n<0)return r;return -1}(t[2],"()");if(e>-1){let n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],r="";if(this.options.pedantic){let e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):"";return n=n.trim(),/^</.test(n)&&(n=this.options.pedantic&&!/>$/.test(e)?n.slice(1):n.slice(1,-1)),eK(t,{href:n?n.replace(this.rules.inline.anyPunctuation,"$1"):n,title:r?r.replace(this.rules.inline.anyPunctuation,"$1"):r},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(/\s+/g," ").toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return eK(n,e,n[0],this.lexer)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||r[3]&&n.match(/[\p{L}\p{N}]/u))&&(!(r[1]||r[2])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,o,i,l=n,a=0,s="*"===r[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(s.lastIndex=0,t=t.slice(-1*e.length+n);null!=(r=s.exec(t));){if(!(o=r[1]||r[2]||r[3]||r[4]||r[5]||r[6]))continue;if(i=[...o].length,r[3]||r[4]){l+=i;continue}if((r[5]||r[6])&&n%3&&!((n+i)%3)){a+=i;continue}if((l-=i)>0)continue;i=Math.min(i,i+l+a);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+i);if(Math.min(n,i)%2){let e=s.slice(1,-1);return{type:"em",raw:s,text:e,tokens:this.lexer.inlineTokens(e)}}let c=s.slice(2,-2);return{type:"strong",raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g," "),n=/[^ ]/.test(e),r=/^ /.test(e)&&/ $/.test(e);return n&&r&&(e=e.substring(1,e.length-1)),e=eG(e,!0),{type:"codespan",raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return n="@"===t[2]?"mailto:"+(e=eG(t[1])):e=eG(t[1]),{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if("@"===t[2])n="mailto:"+(e=eG(t[0]));else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(r!==t[0]);e=eG(t[0]),n="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e;return e=this.lexer.state.inRawBlock?t[0]:eG(t[0]),{type:"text",raw:t[0],text:e}}}}let e0=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,e1=/(?:[*+-]|\d{1,9}[.)])/,e2=eV(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,e1).replace(/blockCode/g,/ {4}/).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/).getRegex(),e3=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,e6=/(?!\s*\])(?:\\.|[^\[\]\\])+/,e4=eV(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",e6).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),e9=eV(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,e1).getRegex(),e8="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",e5=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,e7=eV("^ {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",e5).replace("tag",e8).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),te=eV(e3).replace("hr",e0).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",e8).getRegex(),tt={blockquote:eV(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",te).getRegex(),code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,def:e4,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:e0,html:e7,lheading:e2,list:e9,newline:/^(?: *(?:\n|$))+/,paragraph:te,table:eY,text:/^[^\n]+/},tn=eV("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",e0).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\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",e8).getRegex(),tr={...tt,table:tn,paragraph:eV(e3).replace("hr",e0).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",tn).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",e8).getRegex()},to={...tt,html:eV("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",e5).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:eY,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:eV(e3).replace("hr",e0).replace("heading"," *#{1,6} *[^\n]").replace("lheading",e2).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ti=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,tl=/^( {2,}|\\)\n(?!\s*$)/,ta="\\p{P}\\p{S}",ts=eV(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,ta).getRegex(),tc=eV(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,ta).getRegex(),tu=eV("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,ta).getRegex(),tp=eV("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,ta).getRegex(),tf=eV(/\\([punct])/,"gu").replace(/punct/g,ta).getRegex(),td=eV(/^<(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(),th=eV(e5).replace("(?:--\x3e|$)","--\x3e").getRegex(),tm=eV("^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",th).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),tg=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,tb=eV(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",tg).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ty=eV(/^!?\[(label)\]\[(ref)\]/).replace("label",tg).replace("ref",e6).getRegex(),tx=eV(/^!?\[(ref)\](?:\[\])?/).replace("ref",e6).getRegex(),tk=eV("reflink|nolink(?!\\()","g").replace("reflink",ty).replace("nolink",tx).getRegex(),tw={_backpedal:eY,anyPunctuation:tf,autolink:td,blockSkip:/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,br:tl,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:eY,emStrongLDelim:tc,emStrongRDelimAst:tu,emStrongRDelimUnd:tp,escape:ti,link:tb,nolink:tx,punctuation:ts,reflink:ty,reflinkSearch:tk,tag:tm,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:eY},tv={...tw,link:eV(/^!?\[(label)\]\((.*?)\)/).replace("label",tg).getRegex(),reflink:eV(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",tg).getRegex()},tS={...tw,escape:eV(ti).replace("])","~|])").getRegex(),url:eV(/^((?: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\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.!#$%&'*+\/=?_`{\|}~-]+@)))/},tO={...tS,br:eV(tl).replace("{2,}","*").getRegex(),text:eV(tS.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},tT={normal:tt,gfm:tr,pedantic:to},tA={normal:tw,gfm:tS,breaks:tO,pedantic:tv};class tE{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||ez,this.options.tokenizer=this.options.tokenizer||new eJ,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={block:tT.normal,inline:tA.normal};this.options.pedantic?(t.block=tT.pedantic,t.inline=tA.pedantic):this.options.gfm&&(t.block=tT.gfm,this.options.breaks?t.inline=tA.breaks:t.inline=tA.gfm),this.tokenizer.rules=t}static get rules(){return{block:tT,inline:tA}}static lex(e,t){return new tE(t).lex(e)}static lexInline(e,t){return new tE(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,"\n"),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[]){let n,r,o,i;for(e=this.options.pedantic?e.replace(/\t/g," ").replace(/^ +$/gm,""):e.replace(/^( *)(\t+)/gm,(e,t,n)=>t+" ".repeat(n.length));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(r=>!!(n=r.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))){if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length),1===n.raw.length&&t.length>0?t[t.length-1].raw+="\n":t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length),(r=t[t.length-1])&&("paragraph"===r.type||"text"===r.type)?(r.raw+="\n"+n.raw,r.text+="\n"+n.text,this.inlineQueue[this.inlineQueue.length-1].src=r.text):t.push(n);continue}if((n=this.tokenizer.fences(e))||(n=this.tokenizer.heading(e))||(n=this.tokenizer.hr(e))||(n=this.tokenizer.blockquote(e))||(n=this.tokenizer.list(e))||(n=this.tokenizer.html(e))){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.def(e)){e=e.substring(n.raw.length),(r=t[t.length-1])&&("paragraph"===r.type||"text"===r.type)?(r.raw+="\n"+n.raw,r.text+="\n"+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=r.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title});continue}if((n=this.tokenizer.table(e))||(n=this.tokenizer.lheading(e))){e=e.substring(n.raw.length),t.push(n);continue}if(o=e,this.options.extensions&&this.options.extensions.startBlock){let t,n=1/0,r=e.slice(1);this.options.extensions.startBlock.forEach(e=>{"number"==typeof(t=e.call({lexer:this},r))&&t>=0&&(n=Math.min(n,t))}),n<1/0&&n>=0&&(o=e.substring(0,n+1))}if(this.state.top&&(n=this.tokenizer.paragraph(o))){r=t[t.length-1],i&&"paragraph"===r.type?(r.raw+="\n"+n.raw,r.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):t.push(n),i=o.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length),(r=t[t.length-1])&&"text"===r.type?(r.raw+="\n"+n.raw,r.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):t.push(n);continue}if(e){let t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,r,o,i,l,a,s=e;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(i=this.tokenizer.rules.inline.reflinkSearch.exec(s));)e.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(i=this.tokenizer.rules.inline.blockSkip.exec(s));)s=s.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(i=this.tokenizer.rules.inline.anyPunctuation.exec(s));)s=s.slice(0,i.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(l||(a=""),l=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(r=>!!(n=r.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))){if(n=this.tokenizer.escape(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.tag(e)){e=e.substring(n.raw.length),(r=t[t.length-1])&&"text"===n.type&&"text"===r.type?(r.raw+=n.raw,r.text+=n.text):t.push(n);continue}if(n=this.tokenizer.link(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(n.raw.length),(r=t[t.length-1])&&"text"===n.type&&"text"===r.type?(r.raw+=n.raw,r.text+=n.text):t.push(n);continue}if((n=this.tokenizer.emStrong(e,s,a))||(n=this.tokenizer.codespan(e))||(n=this.tokenizer.br(e))||(n=this.tokenizer.del(e))||(n=this.tokenizer.autolink(e))||!this.state.inLink&&(n=this.tokenizer.url(e))){e=e.substring(n.raw.length),t.push(n);continue}if(o=e,this.options.extensions&&this.options.extensions.startInline){let t,n=1/0,r=e.slice(1);this.options.extensions.startInline.forEach(e=>{"number"==typeof(t=e.call({lexer:this},r))&&t>=0&&(n=Math.min(n,t))}),n<1/0&&n>=0&&(o=e.substring(0,n+1))}if(n=this.tokenizer.inlineText(o)){e=e.substring(n.raw.length),"_"!==n.raw.slice(-1)&&(a=n.raw.slice(-1)),l=!0,(r=t[t.length-1])&&"text"===r.type?(r.raw+=n.raw,r.text+=n.text):t.push(n);continue}if(e){let t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw Error(t)}}return t}}class t_{options;constructor(e){this.options=e||ez}code(e,t,n){let r=(t||"").match(/^\S*/)?.[0];return(e=e.replace(/\n$/,"")+"\n",r)?'<pre><code class="language-'+eG(r)+'">'+(n?e:eG(e,!0))+"</code></pre>\n":"<pre><code>"+(n?e:eG(e,!0))+"</code></pre>\n"}blockquote(e){return`<blockquote>
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@nocobase/client-v2"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("plugin-build-guide-block",["react-i18next","@nocobase/client-v2","react","antd","@nocobase/client","@formily/react","@ant-design/icons","@nocobase/flow-engine"],t):"object"==typeof exports?exports["plugin-build-guide-block"]=t(require("react-i18next"),require("@nocobase/client-v2"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/flow-engine")):e["plugin-build-guide-block"]=t(e["react-i18next"],e["@nocobase/client-v2"],e.react,e.antd,e["@nocobase/client"],e["@formily/react"],e["@ant-design/icons"],e["@nocobase/flow-engine"])}(self,function(e,t,n,r,i,o,l,a){return function(){"use strict";var s={375:function(e){e.exports=l},230:function(e){e.exports=o},342:function(e){e.exports=i},485:function(e){e.exports=t},694:function(e){e.exports=a},59:function(e){e.exports=r},155:function(e){e.exports=n},953:function(t){t.exports=e}},c={};function u(e){var t=c[e];if(void 0!==t)return t.exports;var n=c[e]={exports:{}};return s[e](n,n.exports,u),n.exports}u.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(t,{a:t}),t},u.d=function(e,t){for(var n in t)u.o(t,n)&&!u.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},u.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),u.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},u.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.g.importScripts&&(p=u.g.location+"");var p,f=u.g.document;if(!p&&f&&(f.currentScript&&"SCRIPT"===f.currentScript.tagName.toUpperCase()&&(p=f.currentScript.src),!p)){var d=f.getElementsByTagName("script");if(d.length)for(var h=d.length-1;h>-1&&(!p||!/^http(s?):/.test(p));)p=d[h--].src}if(!p)throw Error("Automatic publicPath is not supported in this browser");u.p=p.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var m={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/plugin-build-guide-block/dist/client/")}if(!e){var r=window.__nocobase_modern_client_prefix__||"v",i="/"+(r=String(r).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var o=window.location.pathname||"/",l=o.indexOf(i);e=l>=0?o.slice(0,l+1):"/"}e&&(e=e.replace(RegExp("/"+r+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/plugin-build-guide-block/dist/client/"}u.p=e}(),!function(){u.r(m),u.d(m,{default:function(){return t9}});var e,t=u(342),n=u(155),r=u.n(n),i=u(59),o=u(375),l=u(485),a=u(953);function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function c(e,t,n,r,i,o,l){try{var a=e[o](l),s=a.value}catch(e){n(e);return}a.done?t(s):Promise.resolve(s).then(r,i)}function p(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function l(e){c(o,r,i,l,a,"next",e)}function a(e){c(o,r,i,l,a,"throw",e)}l(void 0)})}}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,i=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var o=[],l=!0,a=!1;try{for(i=i.call(e);!(l=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==i.return||i.return()}finally{if(a)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(l,"next",{value:s(0)}),a(l,"throw",{value:s(1)}),a(l,"return",{value:s(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function s(a){return function(s){var c=[a,s];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){o.label=c[1];break}if(6===c[0]&&o.label<i[1]){o.label=i[1],i=c;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(c);break}i[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var h={draft:"default",building:"blue",completed:"success",error:"error"},g=[{label:"HTML",value:"html"},{label:"Markdown",value:"markdown"}],b=function(e){var t=Number(e);return Number.isFinite(t)?Math.max(1,Math.min(12,Math.round(t))):5},y=function(){var e=(0,a.useTranslation)().t,t=(0,l.useApp)().apiClient,s=i.App.useApp(),c=s.message,u=s.modal,m=f(i.Form.useForm(),1)[0],y=i.Form.useWatch("llmService",m),k=f((0,n.useState)([]),2),x=k[0],w=k[1],v=f((0,n.useState)(!1),2),S=v[0],O=v[1],T=f((0,n.useState)(!1),2),E=T[0],_=T[1],A=f((0,n.useState)(null),2),I=A[0],C=A[1],P=f((0,n.useState)(!1),2),R=P[0],N=P[1],j=f((0,n.useState)([]),2),D=j[0],z=j[1],$=f((0,n.useState)([]),2),M=$[0],L=$[1],B=f((0,n.useState)(null),2),F=B[0],U=B[1],G=(0,n.useRef)(null),q=(0,n.useCallback)(function(){return p(function(){var e,n;return d(this,function(r){switch(r.label){case 0:O(!0),r.label=1;case 1:return r.trys.push([1,,3,4]),[4,t.resource("aiBuildGuideSpaces").list({appends:["documents"],sort:["-createdAt"],paginate:!1})];case 2:return w((null==(n=r.sent())||null==(e=n.data)?void 0:e.data)||[]),[3,4];case 3:return O(!1),[7];case 4:return[2]}})})()},[t]);(0,n.useEffect)(function(){q()},[q]),(0,n.useEffect)(function(){return function(){G.current&&clearTimeout(G.current)}},[]);var H=(0,n.useCallback)(function(){return p(function(){var e,n;return d(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,t.resource("ai").listLLMServices()];case 1:return z(((null==(n=r.sent())||null==(e=n.data)?void 0:e.data)||[]).map(function(e){return{label:e.title||e.name,value:e.name}})),[3,3];case 2:return r.sent(),z([]),[3,3];case 3:return[2]}})})()},[t]),W=(0,n.useCallback)(function(e){return p(function(){var n,r;return d(this,function(i){switch(i.label){case 0:if(!e)return L([]),[2];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,t.resource("ai").listModels({llmService:e})];case 2:return L(((null==(r=i.sent())||null==(n=r.data)?void 0:n.data)||[]).map(function(e){return{label:e.id||e.name,value:e.id||e.name}})),[3,4];case 3:return i.sent(),L([]),[3,4];case 4:return[2]}})})()},[t]);(0,n.useEffect)(function(){W(y)},[y,W]);var Z=function(e){C(e.id),m.resetFields(),m.setFieldsValue({title:e.title,llmService:e.llmService,model:e.model,outputFormat:e.outputFormat||"html",targetChapterCount:b(e.targetChapterCount),chapterGuidance:e.chapterGuidance,systemPrompt:e.systemPrompt}),H(),W(e.llmService),_(!0)},Y=(0,n.useCallback)(function(){G.current&&(clearTimeout(G.current),G.current=null),U(null)},[]),Q=[{title:e("Title"),dataIndex:"title"},{title:e("Status"),dataIndex:"status",render:function(e){return e?r().createElement(i.Tag,{color:h[e]||"default"},String(e).toUpperCase()):null}},{title:e("Build Phase"),dataIndex:"buildPhase"},{title:e("Chapters"),dataIndex:"pageCount"},{title:e("Actions"),key:"actions",render:function(n,l){return r().createElement(i.Space,{split:"|"},r().createElement(i.Button,{type:"link",icon:r().createElement(o.PlayCircleOutlined,null),loading:F===l.id,disabled:"building"===l.status,onClick:function(){return p(function(){var n,r,i,o,a,s,u;return d(this,function(f){switch(f.label){case 0:U(l.id),f.label=1;case 1:return f.trys.push([1,3,,4]),[4,t.resource("aiBuildGuideSpaces").build({filterByTk:l.id})];case 2:return f.sent(),c.success(e("Build started")),n=Date.now(),r=!1,i=function(){return p(function(){var o,a,s,u,p;return d(this,function(f){switch(f.label){case 0:return f.trys.push([0,4,,6]),[4,t.resource("aiBuildGuideSpaces").get({filterByTk:l.id})];case 1:if("building"===(u=null==(s=f.sent())||null==(a=s.data)||null==(o=a.data)?void 0:o.status))return[3,3];return Y(),[4,q()];case 2:return f.sent(),"completed"===u?c.success(e("Build completed")):"error"===u&&c.error(e("Build failed")),[2];case 3:return(p=Date.now()-n)>=3e5&&!r&&(r=!0,c.info(e("Build is still running"))),G.current=setTimeout(i,p>=3e5?1e4:3e3),[3,6];case 4:return f.sent(),Y(),[4,q()];case 5:return f.sent(),[3,6];case 6:return[2]}})})()},G.current=setTimeout(i,3e3),[3,4];case 3:return o=f.sent(),c.error((null==o||null==(u=o.response)||null==(s=u.data)||null==(a=s.error)?void 0:a.message)||e("Build failed")),U(null),[3,4];case 4:return[2]}})})()}},e("Build")),r().createElement("a",{onClick:function(){return Z(l)}},e("Edit")),r().createElement("a",{onClick:function(){return u.confirm({title:e("Delete"),content:e("Are you sure you want to delete this space?"),onOk:function(){return p(function(){return d(this,function(n){switch(n.label){case 0:return[4,t.resource("aiBuildGuideSpaces").destroy({filterByTk:l.id})];case 1:return n.sent(),c.success(e("Deleted")),[4,q()];case 2:return n.sent(),[2]}})})()}})}},e("Delete")))}}];return r().createElement("div",null,r().createElement(i.Space,{style:{marginBottom:16}},r().createElement(i.Button,{type:"primary",icon:r().createElement(o.PlusOutlined,null),onClick:function(){C(null),m.resetFields(),m.setFieldsValue({outputFormat:"html",targetChapterCount:5,systemPrompt:"You are an expert technical writer. Generate a comprehensive user guide based on the provided documents."}),H(),_(!0)}},e("Create space")),r().createElement(i.Button,{onClick:q},e("Refresh"))),r().createElement(i.Table,{rowKey:"id",loading:S,dataSource:x,columns:Q}),r().createElement(i.Drawer,{title:I?e("Edit space"):e("Create space"),open:E,onClose:function(){return _(!1)},width:640,footer:r().createElement(i.Space,{style:{float:"right"}},r().createElement(i.Button,{onClick:function(){return _(!1)}},e("Cancel")),r().createElement(i.Button,{type:"primary",loading:R,onClick:function(){return p(function(){var n,r,i,o,l;return d(this,function(a){switch(a.label){case 0:return[4,m.validateFields()];case 1:(n=a.sent()).targetChapterCount=b(n.targetChapterCount),N(!0),a.label=2;case 2:if(a.trys.push([2,8,9,10]),!I)return[3,4];return[4,t.resource("aiBuildGuideSpaces").update({filterByTk:I,values:n})];case 3:return a.sent(),[3,6];case 4:return[4,t.resource("aiBuildGuideSpaces").create({values:n})];case 5:a.sent(),a.label=6;case 6:return c.success(e("Saved successfully")),_(!1),[4,q()];case 7:return a.sent(),[3,10];case 8:if(null==(r=a.sent())?void 0:r.errorFields)return[2];return c.error((null==r||null==(l=r.response)||null==(o=l.data)||null==(i=o.error)?void 0:i.message)||e("Save failed")),[3,10];case 9:return N(!1),[7];case 10:return[2]}})})()}},e("Submit")))},r().createElement(i.Form,{form:m,layout:"vertical",onValuesChange:function(e){"llmService"in e&&m.setFieldValue("model",void 0)}},r().createElement(i.Form.Item,{name:"title",label:e("Title"),rules:[{required:!0}]},r().createElement(i.Input,null)),r().createElement(i.Form.Item,{name:"llmService",label:e("LLM Service"),rules:[{required:!0}]},r().createElement(i.Select,{options:D,onFocus:H,showSearch:!0,optionFilterProp:"label"})),r().createElement(i.Form.Item,{name:"model",label:e("Model"),rules:[{required:!0}]},r().createElement(i.Select,{options:M,disabled:!y,showSearch:!0,optionFilterProp:"label"})),r().createElement(i.Form.Item,{name:"outputFormat",label:e("Output format"),rules:[{required:!0}]},r().createElement(i.Select,{options:g})),r().createElement(i.Form.Item,{name:"targetChapterCount",label:e("Target chapters"),rules:[{required:!0}]},r().createElement(i.InputNumber,{min:1,max:12,precision:0,style:{width:"100%"}})),r().createElement(i.Form.Item,{name:"chapterGuidance",label:e("Chapter guidance")},r().createElement(i.Input.TextArea,{rows:3,placeholder:e("Describe how the guide should be split into chapters")})),r().createElement(i.Form.Item,{name:"systemPrompt",label:e("System Prompt")},r().createElement(i.Input.TextArea,{rows:4})))))},k=u(230);function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}let w=Object.entries,v=Object.setPrototypeOf,S=Object.isFrozen,O=Object.getPrototypeOf,T=Object.getOwnPropertyDescriptor,E=Object.freeze,_=Object.seal,A=Object.create,I="u">typeof Reflect&&Reflect,C=I.apply,P=I.construct;E||(E=function(e){return e}),_||(_=function(e){return e}),C||(C=function(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return e.apply(t,r)}),P||(P=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)});let R=K(Array.prototype.forEach),N=K(Array.prototype.lastIndexOf),j=K(Array.prototype.pop),D=K(Array.prototype.push),z=K(Array.prototype.splice),$=Array.isArray,M=K(String.prototype.toLowerCase),L=K(String.prototype.toString),B=K(String.prototype.match),F=K(String.prototype.replace),U=K(String.prototype.indexOf),G=K(String.prototype.trim),q=K(Number.prototype.toString),H=K(Boolean.prototype.toString),W="u"<typeof BigInt?null:K(BigInt.prototype.toString),Z="u"<typeof Symbol?null:K(Symbol.prototype.toString),Y=K(Object.prototype.hasOwnProperty),Q=K(Object.prototype.toString),X=K(RegExp.prototype.test),V=(e=TypeError,function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return P(e,n)});function K(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return C(e,t,r)}}function J(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:M;if(v&&v(e,null),!$(t))return e;let r=t.length;for(;r--;){let i=t[r];if("string"==typeof i){let e=n(i);e!==i&&(S(t)||(t[r]=e),i=e)}e[i]=!0}return e}function ee(e){let t=A(null);for(let r of w(e)){var n=function(e){if(Array.isArray(e))return e}(r)||function(e){var t=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,r,i,o,l=[],a=!0,s=!1;try{i=(t=t.call(e)).next,!1;for(;!(a=(n=i.call(t)).done)&&(l.push(n.value),2!==l.length);a=!0);}catch(e){s=!0,r=e}finally{try{if(!a&&null!=t.return&&(o=t.return(),Object(o)!==o))return}finally{if(s)throw r}}return l}}(r)||function(e){if(e){if("string"==typeof e)return x(e,2);var t=({}).toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?x(e,2):void 0}}(r)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();let i=n[0],o=n[1];Y(e,i)&&($(o)?t[i]=function(e){for(let t=0;t<e.length;t++)Y(e,t)||(e[t]=null);return e}(o):o&&"object"==typeof o&&o.constructor===Object?t[i]=ee(o):t[i]=o)}return t}function et(e,t){for(;null!==e;){let n=T(e,t);if(n){if(n.get)return K(n.get);if("function"==typeof n.value)return K(n.value)}e=O(e)}return function(){return null}}let en=E(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),er=E(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ei=E(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),eo=E(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),el=E(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),ea=E(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),es=E(["#text"]),ec=E(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),eu=E(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),ep=E(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ef=E(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),ed=_(/{{[\w\W]*|^[\w\W]*}}/g),eh=_(/<%[\w\W]*|^[\w\W]*%>/g),em=_(/\${[\w\W]*/g),eg=_(/^data-[\-\w.\u00B7-\uFFFF]+$/),eb=_(/^aria-[\-\w]+$/),ey=_(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ek=_(/^(?:\w+script|data):/i),ex=_(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ew=_(/^html$/i),ev=_(/^[a-z][.\w]*(-[.\w]+)+$/i),eS=_(/<[/\w!]/g),eO=_(/<[/\w]/g),eT=_(/<\/no(script|embed|frames)/i),eE=_(/\/>/i),e_=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null,r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i="dompurify"+(n?"#"+n:"");try{return e.createPolicy(i,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+i+" could not be created."),null}},eA=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},eI=function(e,t,n,r){return Y(e,t)&&$(e[t])?J(r.base?ee(r.base):{},e[t],r.transform):n};var eC=function e(){let t,n,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"u"<typeof window?null:window,i=t=>e(t);if(i.version="3.4.10",i.removed=[],!r||!r.document||9!==r.document.nodeType||!r.Element)return i.isSupported=!1,i;let o=r.document,l=o,a=l.currentScript;r.DocumentFragment;let s=r.HTMLTemplateElement,c=r.Node,u=r.Element,p=r.NodeFilter;void 0===r.NamedNodeMap&&(r.NamedNodeMap||r.MozNamedAttrMap),r.HTMLFormElement;let f=r.DOMParser,d=r.trustedTypes,h=u.prototype,m=et(h,"cloneNode"),g=et(h,"remove"),b=et(h,"nextSibling"),y=et(h,"childNodes"),k=et(h,"parentNode"),x=et(h,"shadowRoot"),v=et(h,"attributes"),S=c&&c.prototype?et(c.prototype,"nodeType"):null,O=c&&c.prototype?et(c.prototype,"nodeName"):null;if("function"==typeof s){let e=o.createElement("template");e.content&&e.content.ownerDocument&&(o=e.content.ownerDocument)}let T="",I=!1,C=0,P=function(){if(C>0)throw V('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},K=function(e){P(),C++;try{return t.createHTML(e)}finally{C--}},eC=function(e){P(),C++;try{return t.createScriptURL(e)}finally{C--}},eP=o,eR=eP.implementation,eN=eP.createNodeIterator,ej=eP.createDocumentFragment,eD=eP.getElementsByTagName,ez=l.importNode,e$=eA();i.isSupported="function"==typeof w&&"function"==typeof k&&eR&&void 0!==eR.createHTMLDocument;let eM=ey,eL=null,eB=J({},[...en,...er,...ei,...el,...es]),eF=null,eU=J({},[...ec,...eu,...ep,...ef]),eG=Object.seal(A(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),eq=null,eH=null,eW=Object.seal(A(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),eZ=!0,eY=!0,eQ=!1,eX=!0,eV=!1,eK=!0,eJ=!1,e0=!1,e1=!1,e2=!1,e3=!1,e4=!1,e6=!0,e9=!1,e5="user-content-",e8=!0,e7=!1,te={},tt=null,tn=J({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]),tr=null,ti=J({},["audio","video","img","source","image","track"]),to=null,tl=J({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ta="http://www.w3.org/1998/Math/MathML",ts="http://www.w3.org/2000/svg",tc="http://www.w3.org/1999/xhtml",tu=tc,tp=!1,tf=null,td=J({},[ta,ts,tc],L),th=E(["mi","mo","mn","ms","mtext"]),tm=J({},th),tg=E(["annotation-xml"]),tb=J({},tg),ty=J({},["title","style","font","a","script"]),tk=null,tx=["application/xhtml+xml","text/html"],tw=null,tv=null,tS=o.createElement("form"),tO=function(e){return e instanceof RegExp||e instanceof Function},tT=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(tv&&tv===e)return;e&&"object"==typeof e||(e={}),e=ee(e),tw="application/xhtml+xml"===(tk=-1===tx.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE)?L:M,eL=eI(e,"ALLOWED_TAGS",eB,{transform:tw}),eF=eI(e,"ALLOWED_ATTR",eU,{transform:tw}),tf=eI(e,"ALLOWED_NAMESPACES",td,{transform:L}),to=eI(e,"ADD_URI_SAFE_ATTR",tl,{transform:tw,base:tl}),tr=eI(e,"ADD_DATA_URI_TAGS",ti,{transform:tw,base:ti}),tt=eI(e,"FORBID_CONTENTS",tn,{transform:tw}),eq=eI(e,"FORBID_TAGS",ee({}),{transform:tw}),eH=eI(e,"FORBID_ATTR",ee({}),{transform:tw}),te=!!Y(e,"USE_PROFILES")&&(e.USE_PROFILES&&"object"==typeof e.USE_PROFILES?ee(e.USE_PROFILES):e.USE_PROFILES),eZ=!1!==e.ALLOW_ARIA_ATTR,eY=!1!==e.ALLOW_DATA_ATTR,eQ=e.ALLOW_UNKNOWN_PROTOCOLS||!1,eX=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,eV=e.SAFE_FOR_TEMPLATES||!1,eK=!1!==e.SAFE_FOR_XML,eJ=e.WHOLE_DOCUMENT||!1,e2=e.RETURN_DOM||!1,e3=e.RETURN_DOM_FRAGMENT||!1,e4=e.RETURN_TRUSTED_TYPE||!1,e1=e.FORCE_BODY||!1,e6=!1!==e.SANITIZE_DOM,e9=e.SANITIZE_NAMED_PROPS||!1,e8=!1!==e.KEEP_CONTENT,e7=e.IN_PLACE||!1,eM=!function(e){try{return X(e,""),!0}catch(e){return!1}}(e.ALLOWED_URI_REGEXP)?ey:e.ALLOWED_URI_REGEXP,tu="string"==typeof e.NAMESPACE?e.NAMESPACE:tc,tm=Y(e,"MATHML_TEXT_INTEGRATION_POINTS")&&e.MATHML_TEXT_INTEGRATION_POINTS&&"object"==typeof e.MATHML_TEXT_INTEGRATION_POINTS?ee(e.MATHML_TEXT_INTEGRATION_POINTS):J({},th),tb=Y(e,"HTML_INTEGRATION_POINTS")&&e.HTML_INTEGRATION_POINTS&&"object"==typeof e.HTML_INTEGRATION_POINTS?ee(e.HTML_INTEGRATION_POINTS):J({},tg);let r=Y(e,"CUSTOM_ELEMENT_HANDLING")&&e.CUSTOM_ELEMENT_HANDLING&&"object"==typeof e.CUSTOM_ELEMENT_HANDLING?ee(e.CUSTOM_ELEMENT_HANDLING):A(null);if(eG=A(null),Y(r,"tagNameCheck")&&tO(r.tagNameCheck)&&(eG.tagNameCheck=r.tagNameCheck),Y(r,"attributeNameCheck")&&tO(r.attributeNameCheck)&&(eG.attributeNameCheck=r.attributeNameCheck),Y(r,"allowCustomizedBuiltInElements")&&"boolean"==typeof r.allowCustomizedBuiltInElements&&(eG.allowCustomizedBuiltInElements=r.allowCustomizedBuiltInElements),_(eG),eV&&(eY=!1),e3&&(e2=!0),te&&(eL=J({},es),eF=A(null),!0===te.html&&(J(eL,en),J(eF,ec)),!0===te.svg&&(J(eL,er),J(eF,eu),J(eF,ef)),!0===te.svgFilters&&(J(eL,ei),J(eF,eu),J(eF,ef)),!0===te.mathMl&&(J(eL,el),J(eF,ep),J(eF,ef))),eW.tagCheck=null,eW.attributeCheck=null,Y(e,"ADD_TAGS")&&("function"==typeof e.ADD_TAGS?eW.tagCheck=e.ADD_TAGS:$(e.ADD_TAGS)&&(eL===eB&&(eL=ee(eL)),J(eL,e.ADD_TAGS,tw))),Y(e,"ADD_ATTR")&&("function"==typeof e.ADD_ATTR?eW.attributeCheck=e.ADD_ATTR:$(e.ADD_ATTR)&&(eF===eU&&(eF=ee(eF)),J(eF,e.ADD_ATTR,tw))),Y(e,"ADD_URI_SAFE_ATTR")&&$(e.ADD_URI_SAFE_ATTR)&&J(to,e.ADD_URI_SAFE_ATTR,tw),Y(e,"FORBID_CONTENTS")&&$(e.FORBID_CONTENTS)&&(tt===tn&&(tt=ee(tt)),J(tt,e.FORBID_CONTENTS,tw)),Y(e,"ADD_FORBID_CONTENTS")&&$(e.ADD_FORBID_CONTENTS)&&(tt===tn&&(tt=ee(tt)),J(tt,e.ADD_FORBID_CONTENTS,tw)),e8&&(eL["#text"]=!0),eJ&&J(eL,["html","head","body"]),eL.table&&(J(eL,["tbody"]),delete eq.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw V('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw V('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let n=t;t=e.TRUSTED_TYPES_POLICY;try{T=K("")}catch(e){throw t=n,e}}else null===e.TRUSTED_TYPES_POLICY?(t=void 0,T=""):(void 0===t&&(I||(n=e_(d,a),I=!0),t=n),t&&"string"==typeof T&&(T=K("")));(e$.uponSanitizeElement.length>0||e$.uponSanitizeAttribute.length>0)&&eL===eB&&(eL=ee(eL)),e$.uponSanitizeAttribute.length>0&&eF===eU&&(eF=ee(eF)),E&&E(e),tv=e},tE=J({},[...er,...ei,...eo]),t_=J({},[...el,...ea]),tA=function(e){var t,n,r;let i=k(e);i&&i.tagName||(i={namespaceURI:tu,tagName:"template"});let o=M(e.tagName),l=M(i.tagName);return!!tf[e.namespaceURI]&&(e.namespaceURI===ts?(t=i).namespaceURI===tc?"svg"===o:t.namespaceURI===ta?"svg"===o&&("annotation-xml"===l||tm[l]):!!tE[o]:e.namespaceURI===ta?(n=i).namespaceURI===tc?"math"===o:n.namespaceURI===ts?"math"===o&&tb[l]:!!t_[o]:e.namespaceURI===tc?((r=i).namespaceURI!==ts||!!tb[l])&&(r.namespaceURI!==ta||!!tm[l])&&!t_[o]&&(ty[o]||!tE[o]):"application/xhtml+xml"===tk&&!!tf[e.namespaceURI])},tI=function(e){D(i.removed,{element:e});try{k(e).removeChild(e)}catch(t){if(g(e),!k(e))throw V("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},tC=function(e){let t=y(e);if(t){let e=[];R(t,t=>{D(e,t)}),R(e,e=>{try{g(e)}catch(e){}})}let n=v(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;if("string"==typeof i)try{e.removeAttribute(i)}catch(e){}}},tP=function(e,t){try{D(i.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){D(i.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(e2||e3)try{tI(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},tR=function(e){let t=v(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;if("string"==typeof i&&!eF[tw(i)])try{e.removeAttribute(i)}catch(e){}}},tN=function(e){let t=[e];for(;t.length>0;){let e=t.pop();(S?S(e):e.nodeType)===1&&tR(e);let n=y(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},tj=function(e){let n=null,r=null;if(e1)e="<remove></remove>"+e;else{let t=B(e,/^[\r\n\t ]+/);r=t&&t[0]}"application/xhtml+xml"===tk&&tu===tc&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");let i=t?K(e):e;if(tu===tc)try{n=new f().parseFromString(i,tk)}catch(e){}if(!n||!n.documentElement){n=eR.createDocument(tu,"template",null);try{n.documentElement.innerHTML=tp?T:i}catch(e){}}let l=n.body||n.documentElement;return(e&&r&&l.insertBefore(o.createTextNode(r),l.childNodes[0]||null),tu===tc)?eD.call(n,eJ?"html":"body")[0]:eJ?n.documentElement:l},tD=function(e){return eN.call(e.ownerDocument||e,e,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},tz=function(e){return e=F(e,ed," "),e=F(e,eh," "),e=F(e,em," ")},t$=function(e){var t;e.normalize();let n=eN.call(e.ownerDocument||e,e,p.SHOW_TEXT|p.SHOW_COMMENT|p.SHOW_CDATA_SECTION|p.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=tz(r.data),r=n.nextNode();let i=null==(t=e.querySelectorAll)?void 0:t.call(e,"template");i&&R(i,e=>{tL(e.content)&&t$(e.content)})},tM=function(e){let t=O?O(e):null;return"string"==typeof t&&"form"===tw(t)&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||e.attributes!==v(e)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes||e.nodeType!==S(e)||e.childNodes!==y(e))},tL=function(e){if(!S||"object"!=typeof e||null===e)return!1;try{return 11===S(e)}catch(e){return!1}},tB=function(e){if(!S||"object"!=typeof e||null===e)return!1;try{return"number"==typeof S(e)}catch(e){return!1}};function tF(e,t,n){0!==e.length&&R(e,e=>{e.call(i,t,n,tv)})}let tU=function(e,t){if(!eq[t]&&tW(t)&&(eG.tagNameCheck instanceof RegExp&&X(eG.tagNameCheck,t)||eG.tagNameCheck instanceof Function&&eG.tagNameCheck(t)))return!1;if(e8&&!tt[t]){let t=k(e),n=y(e);if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=e7?n[i]:m(n[i],!0);t.insertBefore(r,b(e))}}}return tI(e),!0},tG=function(e){if(tF(e$.beforeSanitizeElements,e,null),tM(e))return tI(e),!0;let t=tw(O?O(e):e.nodeName);if(tF(e$.uponSanitizeElement,e,{tagName:t,allowedTags:eL}),eK&&e.hasChildNodes()&&!tB(e.firstElementChild)&&X(eS,e.textContent)&&X(eS,e.innerHTML)||eK&&e.namespaceURI===tc&&"style"===t&&tB(e.firstElementChild)||7===e.nodeType||eK&&8===e.nodeType&&X(eO,e.data)||0)return tI(e),!0;if(eq[t]||!(eW.tagCheck instanceof Function&&eW.tagCheck(t))&&!eL[t])return tU(e,t);if((S?S(e):e.nodeType)===1&&!tA(e)||("noscript"===t||"noembed"===t||"noframes"===t)&&X(eT,e.innerHTML))return tI(e),!0;if(eV&&3===e.nodeType){let t=tz(e.textContent);e.textContent!==t&&(D(i.removed,{element:e.cloneNode()}),e.textContent=t)}return tF(e$.afterSanitizeElements,e,null),!1},tq=function(e,t,n){if(eH[t]||e6&&("id"===t||"name"===t)&&(n in o||n in tS))return!1;let r=eF[t]||eW.attributeCheck instanceof Function&&eW.attributeCheck(t,e);if(eY&&X(eg,t));else if(eZ&&X(eb,t));else if(r){if(to[t]);else if(X(eM,F(n,ex,"")));else if(("src"===t||"xlink:href"===t||"href"===t)&&"script"!==e&&0===U(n,"data:")&&tr[e]);else if(eQ&&!X(ek,F(n,ex,"")));else if(n)return!1}else if(!(tW(e)&&(eG.tagNameCheck instanceof RegExp&&X(eG.tagNameCheck,e)||eG.tagNameCheck instanceof Function&&eG.tagNameCheck(e))&&(eG.attributeNameCheck instanceof RegExp&&X(eG.attributeNameCheck,t)||eG.attributeNameCheck instanceof Function&&eG.attributeNameCheck(t,e))||"is"===t&&eG.allowCustomizedBuiltInElements&&(eG.tagNameCheck instanceof RegExp&&X(eG.tagNameCheck,n)||eG.tagNameCheck instanceof Function&&eG.tagNameCheck(n))))return!1;return!0},tH=J({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),tW=function(e){return!tH[M(e)]&&X(ev,e)},tZ=function(e,n,r,i){if(t&&"object"==typeof d&&"function"==typeof d.getAttributeType&&!r)switch(d.getAttributeType(e,n)){case"TrustedHTML":return K(i);case"TrustedScriptURL":return eC(i)}return i},tY=function(e,t,n,r){try{n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),tM(e)?tI(e):j(i.removed)}catch(n){tP(t,e)}},tQ=function(e){tF(e$.beforeSanitizeAttributes,e,null);let t=e.attributes;if(!t||tM(e))return;let n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:eF,forceKeepAttr:void 0},r=t.length,i=tw(e.nodeName);for(;r--;){let o=t[r],l=o.name,a=o.namespaceURI,s=o.value,c=tw(l),u="value"===l?s:G(s);if(n.attrName=c,n.attrValue=u,n.keepAttr=!0,n.forceKeepAttr=void 0,tF(e$.uponSanitizeAttribute,e,n),u=n.attrValue,e9&&("id"===c||"name"===c)&&0!==U(u,e5)&&(tP(l,e),u=e5+u),eK&&X(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,u)||"attributename"===c&&B(u,"href")){tP(l,e);continue}if(!n.forceKeepAttr){if(!n.keepAttr||!eX&&X(eE,u)||(eV&&(u=tz(u)),!tq(i,c,u))){tP(l,e);continue}(u=tZ(i,c,a,u))!==s&&tY(e,l,a,u)}}tF(e$.afterSanitizeAttributes,e,null)},tX=function(e){let t=null,n=tD(e);for(tF(e$.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(tF(e$.uponSanitizeShadowNode,t,null),tG(t),tQ(t),tL(t.content)&&tX(t.content),(S?S(t):t.nodeType)===1){let e=x(t);tL(e)&&(tV(e),tX(e))}tF(e$.afterSanitizeShadowDOM,e,null)},tV=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){tX(e.shadow);continue}let n=e.node,r=(S?S(n):n.nodeType)===1,i=y(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=O?O(n):null;if("string"==typeof e&&"template"===tw(e)){let e=n.content;tL(e)&&t.push({node:e,shadow:null})}}if(r){let e=x(n);tL(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return i.sanitize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,o=null,a=null,s=null;if((tp=!e)&&(e="\x3c!--\x3e"),"string"!=typeof e&&!tB(e)&&"string"!=typeof(e=function(e){switch(typeof e){case"string":return e;case"number":return q(e);case"boolean":return H(e);case"bigint":return W?W(e):"0";case"symbol":return Z?Z(e):"Symbol()";case"undefined":default:return Q(e);case"function":case"object":{if(null===e)return Q(e);let t=et(e,"toString");if("function"==typeof t){let n=t(e);return"string"==typeof n?n:Q(n)}return Q(e)}}}(e)))throw V("dirty is not a string, aborting");if(!i.isSupported)return e;e0||tT(n),i.removed=[];let c=e7&&"string"!=typeof e&&tB(e);if(c){let t=O?O(e):e.nodeName;if("string"==typeof t){let e=tw(t);if(!eL[e]||eq[e])throw V("root node is forbidden and cannot be sanitized in-place")}if(tM(e))throw V("root node is clobbered and cannot be sanitized in-place");try{tV(e)}catch(t){throw tC(e),t}}else if(tB(e))1===(o=(r=tj("\x3c!----\x3e")).ownerDocument.importNode(e,!0)).nodeType&&"BODY"===o.nodeName||"HTML"===o.nodeName?r=o:r.appendChild(o),tV(o);else{if(!e2&&!eV&&!eJ&&-1===e.indexOf("<"))return t&&e4?K(e):e;if(!(r=tj(e)))return e2?null:e4?T:""}r&&e1&&tI(r.firstChild);let u=tD(c?e:r);try{for(;a=u.nextNode();)tG(a),tQ(a),tL(a.content)&&tX(a.content)}catch(t){throw c&&tC(e),t}if(c)return R(i.removed,e=>{e.element&&tN(e.element)}),eV&&t$(e),e;if(e2){if(eV&&t$(r),e3)for(s=ej.call(r.ownerDocument);r.firstChild;)s.appendChild(r.firstChild);else s=r;return(eF.shadowroot||eF.shadowrootmode)&&(s=ez.call(l,s,!0)),s}let p=eJ?r.outerHTML:r.innerHTML;return eJ&&eL["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&X(ew,r.ownerDocument.doctype.name)&&(p="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+p),eV&&(p=tz(p)),t&&e4?K(p):p},i.setConfig=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};tT(e),e0=!0},i.clearConfig=function(){tv=null,e0=!1,t=n,T=""},i.isValidAttribute=function(e,t,n){return tv||tT({}),tq(tw(e),tw(t),n)},i.addHook=function(e,t){"function"==typeof t&&D(e$[e],t)},i.removeHook=function(e,t){if(void 0!==t){let n=N(e$[e],t);return -1===n?void 0:z(e$[e],n,1)[0]}return j(e$[e])},i.removeHooks=function(e){e$[e]=[]},i.removeAllHooks=function(){e$=eA()},i}();function eP(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let eR=eP(),eN=/[&<>"']/,ej=RegExp(eN.source,"g"),eD=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,ez=RegExp(eD.source,"g"),e$={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},eM=e=>e$[e];function eL(e,t){if(t){if(eN.test(e))return e.replace(ej,eM)}else if(eD.test(e))return e.replace(ez,eM);return e}let eB=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,eF=/(^|[^\[])\^/g;function eU(e,t){let n="string"==typeof e?e:e.source;t=t||"";let r={replace:(e,t)=>{let i="string"==typeof t?t:t.source;return i=i.replace(eF,"$1"),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}function eG(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch(e){return null}return e}let eq={exec:()=>null};function eH(e,t){let n=e.replace(/\|/g,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&"\\"===n[i];)r=!r;return r?"|":" |"}).split(/ \|/),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(/\\\|/g,"|");return n}function eW(e,t,n){let r=e.length;if(0===r)return"";let i=0;for(;i<r;){let o=e.charAt(r-i-1);if(o!==t||n)if(o!==t&&n)i++;else break;else i++}return e.slice(0,r-i)}function eZ(e,t,n,r){let i=t.href,o=t.title?eL(t.title):null,l=e[1].replace(/\\([\[\]])/g,"$1");if("!"!==e[0].charAt(0)){r.state.inLink=!0;let e={type:"link",raw:n,href:i,title:o,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,e}return{type:"image",raw:n,href:i,title:o,text:eL(l)}}class eY{options;rules;lexer;constructor(e){this.options=e||eR}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:eW(e,"\n")}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=function(e,t){let n=e.match(/^(\s+)(?:```)/);if(null===n)return t;let r=n[1];return t.split("\n").map(e=>{let t=e.match(/^\s+/);if(null===t)return e;let[n]=t;return n.length>=r.length?e.slice(r.length):e}).join("\n")}(e,t[3]||"");return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){let t=eW(e,"#");this.options.pedantic?e=t.trim():(!t||/ $/.test(t))&&(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=t[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,"\n $1");e=eW(e.replace(/^ *>[ \t]?/gm,""),"\n");let n=this.lexer.state.top;this.lexer.state.top=!0;let r=this.lexer.blockTokens(e);return this.lexer.state.top=n,{type:"blockquote",raw:t[0],tokens:r,text:e}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),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:"[*+-]");let o=RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),l="",a="",s=!1;for(;e;){let n,r=!1;if(!(t=o.exec(e))||this.rules.block.hr.test(e))break;l=t[0],e=e.substring(l.length);let c=t[2].split("\n",1)[0].replace(/^\t+/,e=>" ".repeat(3*e.length)),u=e.split("\n",1)[0],p=0;this.options.pedantic?(p=2,a=c.trimStart()):(p=(p=t[2].search(/[^ ]/))>4?1:p,a=c.slice(p),p+=t[1].length);let f=!1;if(!c&&/^ *$/.test(u)&&(l+=u+"\n",e=e.substring(u.length+1),r=!0),!r){let t=RegExp(`^ {0,${Math.min(3,p-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),n=RegExp(`^ {0,${Math.min(3,p-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),r=RegExp(`^ {0,${Math.min(3,p-1)}}(?:\`\`\`|~~~)`),i=RegExp(`^ {0,${Math.min(3,p-1)}}#`);for(;e;){let o=e.split("\n",1)[0];if(u=o,this.options.pedantic&&(u=u.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),r.test(u)||i.test(u)||t.test(u)||n.test(e))break;if(u.search(/[^ ]/)>=p||!u.trim())a+="\n"+u.slice(p);else{if(f||c.search(/[^ ]/)>=4||r.test(c)||i.test(c)||n.test(c))break;a+="\n"+u}f||u.trim()||(f=!0),l+=o+"\n",e=e.substring(o.length+1),c=u.slice(p)}}!i.loose&&(s?i.loose=!0:/\n *\n *$/.test(l)&&(s=!0));let d=null;this.options.gfm&&(d=/^\[[ xX]\] /.exec(a))&&(n="[ ] "!==d[0],a=a.replace(/^\[[ xX]\] +/,"")),i.items.push({type:"list_item",raw:l,task:!!d,checked:n,loose:!1,text:a,tokens:[]}),i.raw+=l}i.items[i.items.length-1].raw=l.trimEnd(),i.items[i.items.length-1].text=a.trimEnd(),i.raw=i.raw.trimEnd();for(let e=0;e<i.items.length;e++)if(this.lexer.state.top=!1,i.items[e].tokens=this.lexer.blockTokens(i.items[e].text,[]),!i.loose){let t=i.items[e].tokens.filter(e=>"space"===e.type);i.loose=t.length>0&&t.some(e=>/\n.*\n/.test(e.raw))}if(i.loose)for(let e=0;e<i.items.length;e++)i.items[e].loose=!0;return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(/\s+/g," "),n=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!/[:|]/.test(t[2]))return;let n=eH(t[1]),r=t[2].replace(/^\||\| *$/g,"").split("|"),i=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)/^ *-+: *$/.test(e)?o.align.push("right"):/^ *:-+: *$/.test(e)?o.align.push("center"):/^ *:-+ *$/.test(e)?o.align.push("left"):o.align.push(null);for(let e of n)o.header.push({text:e,tokens:this.lexer.inline(e)});for(let e of i)o.rows.push(eH(e,o.header.length).map(e=>({text:e,tokens:this.lexer.inline(e)})));return o}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:eL(t[1])}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&/^</.test(e)){if(!/>$/.test(e))return;let t=eW(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{let e=function(e){if(-1===e.indexOf(")"))return -1;let t=0;for(let n=0;n<e.length;n++)if("\\"===e[n])n++;else if("("===e[n])t++;else if(")"===e[n]&&--t<0)return n;return -1}(t[2]);if(e>-1){let n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],r="";if(this.options.pedantic){let e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):"";return n=n.trim(),/^</.test(n)&&(n=this.options.pedantic&&!/>$/.test(e)?n.slice(1):n.slice(1,-1)),eZ(t,{href:n?n.replace(this.rules.inline.anyPunctuation,"$1"):n,title:r?r.replace(this.rules.inline.anyPunctuation,"$1"):r},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(/\s+/g," ").toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return eZ(n,e,n[0],this.lexer)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||r[3]&&n.match(/[\p{L}\p{N}]/u))&&(!(r[1]||r[2])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,o,l=n,a=0,s="*"===r[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(s.lastIndex=0,t=t.slice(-1*e.length+n);null!=(r=s.exec(t));){if(!(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6]))continue;if(o=[...i].length,r[3]||r[4]){l+=o;continue}if((r[5]||r[6])&&n%3&&!((n+o)%3)){a+=o;continue}if((l-=o)>0)continue;o=Math.min(o,o+l+a);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+o);if(Math.min(n,o)%2){let e=s.slice(1,-1);return{type:"em",raw:s,text:e,tokens:this.lexer.inlineTokens(e)}}let c=s.slice(2,-2);return{type:"strong",raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g," "),n=/[^ ]/.test(e),r=/^ /.test(e)&&/ $/.test(e);return n&&r&&(e=e.substring(1,e.length-1)),e=eL(e,!0),{type:"codespan",raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return n="@"===t[2]?"mailto:"+(e=eL(t[1])):e=eL(t[1]),{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if("@"===t[2])n="mailto:"+(e=eL(t[0]));else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(r!==t[0]);e=eL(t[0]),n="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e;return e=this.lexer.state.inRawBlock?t[0]:eL(t[0]),{type:"text",raw:t[0],text:e}}}}let eQ=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,eX=/(?:[*+-]|\d{1,9}[.)])/,eV=eU(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,eX).replace(/blockCode/g,/ {4}/).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/).getRegex(),eK=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,eJ=/(?!\s*\])(?:\\.|[^\[\]\\])+/,e0=eU(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",eJ).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),e1=eU(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,eX).getRegex(),e2="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",e3=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,e4=eU("^ {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",e3).replace("tag",e2).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),e6=eU(eK).replace("hr",eQ).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",e2).getRegex(),e9={blockquote:eU(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",e6).getRegex(),code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,def:e0,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:eQ,html:e4,lheading:eV,list:e1,newline:/^(?: *(?:\n|$))+/,paragraph:e6,table:eq,text:/^[^\n]+/},e5=eU("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",eQ).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\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",e2).getRegex(),e8={...e9,table:e5,paragraph:eU(eK).replace("hr",eQ).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",e5).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",e2).getRegex()},e7={...e9,html:eU("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",e3).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:eq,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:eU(eK).replace("hr",eQ).replace("heading"," *#{1,6} *[^\n]").replace("lheading",eV).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},te=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,tt=/^( {2,}|\\)\n(?!\s*$)/,tn="\\p{P}\\p{S}",tr=eU(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,tn).getRegex(),ti=eU(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,tn).getRegex(),to=eU("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,tn).getRegex(),tl=eU("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,tn).getRegex(),ta=eU(/\\([punct])/,"gu").replace(/punct/g,tn).getRegex(),ts=eU(/^<(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(),tc=eU(e3).replace("(?:--\x3e|$)","--\x3e").getRegex(),tu=eU("^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",tc).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),tp=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,tf=eU(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",tp).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),td=eU(/^!?\[(label)\]\[(ref)\]/).replace("label",tp).replace("ref",eJ).getRegex(),th=eU(/^!?\[(ref)\](?:\[\])?/).replace("ref",eJ).getRegex(),tm=eU("reflink|nolink(?!\\()","g").replace("reflink",td).replace("nolink",th).getRegex(),tg={_backpedal:eq,anyPunctuation:ta,autolink:ts,blockSkip:/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,br:tt,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:eq,emStrongLDelim:ti,emStrongRDelimAst:to,emStrongRDelimUnd:tl,escape:te,link:tf,nolink:th,punctuation:tr,reflink:td,reflinkSearch:tm,tag:tu,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:eq},tb={...tg,link:eU(/^!?\[(label)\]\((.*?)\)/).replace("label",tp).getRegex(),reflink:eU(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",tp).getRegex()},ty={...tg,escape:eU(te).replace("])","~|])").getRegex(),url:eU(/^((?: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\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.!#$%&'*+\/=?_`{\|}~-]+@)))/},tk={...ty,br:eU(tt).replace("{2,}","*").getRegex(),text:eU(ty.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},tx={normal:e9,gfm:e8,pedantic:e7},tw={normal:tg,gfm:ty,breaks:tk,pedantic:tb};class tv{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||eR,this.options.tokenizer=this.options.tokenizer||new eY,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 t={block:tx.normal,inline:tw.normal};this.options.pedantic?(t.block=tx.pedantic,t.inline=tw.pedantic):this.options.gfm&&(t.block=tx.gfm,this.options.breaks?t.inline=tw.breaks:t.inline=tw.gfm),this.tokenizer.rules=t}static get rules(){return{block:tx,inline:tw}}static lex(e,t){return new tv(t).lex(e)}static lexInline(e,t){return new tv(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,"\n"),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[]){let n,r,i,o;for(e=this.options.pedantic?e.replace(/\t/g," ").replace(/^ +$/gm,""):e.replace(/^( *)(\t+)/gm,(e,t,n)=>t+" ".repeat(n.length));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(r=>!!(n=r.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))){if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length),1===n.raw.length&&t.length>0?t[t.length-1].raw+="\n":t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length),(r=t[t.length-1])&&("paragraph"===r.type||"text"===r.type)?(r.raw+="\n"+n.raw,r.text+="\n"+n.text,this.inlineQueue[this.inlineQueue.length-1].src=r.text):t.push(n);continue}if((n=this.tokenizer.fences(e))||(n=this.tokenizer.heading(e))||(n=this.tokenizer.hr(e))||(n=this.tokenizer.blockquote(e))||(n=this.tokenizer.list(e))||(n=this.tokenizer.html(e))){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.def(e)){e=e.substring(n.raw.length),(r=t[t.length-1])&&("paragraph"===r.type||"text"===r.type)?(r.raw+="\n"+n.raw,r.text+="\n"+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=r.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title});continue}if((n=this.tokenizer.table(e))||(n=this.tokenizer.lheading(e))){e=e.substring(n.raw.length),t.push(n);continue}if(i=e,this.options.extensions&&this.options.extensions.startBlock){let t,n=1/0,r=e.slice(1);this.options.extensions.startBlock.forEach(e=>{"number"==typeof(t=e.call({lexer:this},r))&&t>=0&&(n=Math.min(n,t))}),n<1/0&&n>=0&&(i=e.substring(0,n+1))}if(this.state.top&&(n=this.tokenizer.paragraph(i))){r=t[t.length-1],o&&"paragraph"===r.type?(r.raw+="\n"+n.raw,r.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):t.push(n),o=i.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length),(r=t[t.length-1])&&"text"===r.type?(r.raw+="\n"+n.raw,r.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):t.push(n);continue}if(e){let t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,r,i,o,l,a,s=e;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(o=this.tokenizer.rules.inline.reflinkSearch.exec(s));)e.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(o=this.tokenizer.rules.inline.blockSkip.exec(s));)s=s.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(o=this.tokenizer.rules.inline.anyPunctuation.exec(s));)s=s.slice(0,o.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(l||(a=""),l=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(r=>!!(n=r.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))){if(n=this.tokenizer.escape(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.tag(e)){e=e.substring(n.raw.length),(r=t[t.length-1])&&"text"===n.type&&"text"===r.type?(r.raw+=n.raw,r.text+=n.text):t.push(n);continue}if(n=this.tokenizer.link(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(n.raw.length),(r=t[t.length-1])&&"text"===n.type&&"text"===r.type?(r.raw+=n.raw,r.text+=n.text):t.push(n);continue}if((n=this.tokenizer.emStrong(e,s,a))||(n=this.tokenizer.codespan(e))||(n=this.tokenizer.br(e))||(n=this.tokenizer.del(e))||(n=this.tokenizer.autolink(e))||!this.state.inLink&&(n=this.tokenizer.url(e))){e=e.substring(n.raw.length),t.push(n);continue}if(i=e,this.options.extensions&&this.options.extensions.startInline){let t,n=1/0,r=e.slice(1);this.options.extensions.startInline.forEach(e=>{"number"==typeof(t=e.call({lexer:this},r))&&t>=0&&(n=Math.min(n,t))}),n<1/0&&n>=0&&(i=e.substring(0,n+1))}if(n=this.tokenizer.inlineText(i)){e=e.substring(n.raw.length),"_"!==n.raw.slice(-1)&&(a=n.raw.slice(-1)),l=!0,(r=t[t.length-1])&&"text"===r.type?(r.raw+=n.raw,r.text+=n.text):t.push(n);continue}if(e){let t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw Error(t)}}return t}}class tS{options;constructor(e){this.options=e||eR}code(e,t,n){let r=(t||"").match(/^\S*/)?.[0];return(e=e.replace(/\n$/,"")+"\n",r)?'<pre><code class="language-'+eL(r)+'">'+(n?e:eL(e,!0))+"</code></pre>\n":"<pre><code>"+(n?e:eL(e,!0))+"</code></pre>\n"}blockquote(e){return`<blockquote>
11
11
  ${e}</blockquote>
12
12
  `}html(e,t){return e}heading(e,t,n){return`<h${t}>${e}</h${t}>
13
13
  `}hr(){return"<hr>\n"}list(e,t,n){let r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"</"+r+">\n"}listitem(e,t,n){return`<li>${e}</li>
@@ -15,4 +15,4 @@ ${e}</blockquote>
15
15
  `}table(e,t){return t&&(t=`<tbody>${t}</tbody>`),"<table>\n<thead>\n"+e+"</thead>\n"+t+"</table>\n"}tablerow(e){return`<tr>
16
16
  ${e}</tr>
17
17
  `}tablecell(e,t){let n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
18
- `}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return"<br>"}del(e){return`<del>${e}</del>`}link(e,t,n){let r=eZ(e);if(null===r)return n;let o='<a href="'+(e=r)+'"';return t&&(o+=' title="'+t+'"'),o+=">"+n+"</a>"}image(e,t,n){let r=eZ(e);if(null===r)return n;e=r;let o=`<img src="${e}" alt="${n}"`;return t&&(o+=` title="${t}"`),o+=">"}text(e){return e}}class tI{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return""+n}image(e,t,n){return""+n}br(){return""}}class tC{options;renderer;textRenderer;constructor(e){this.options=e||ez,this.options.renderer=this.options.renderer||new t_,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new tI}static parse(e,t){return new tC(t).parse(e)}static parseInline(e,t){return new tC(t).parseInline(e)}parse(e,t=!0){let n="";for(let r=0;r<e.length;r++){let o=e[r];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]){let e=this.options.extensions.renderers[o.type].call({parser:this},o);if(!1!==e||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(o.type)){n+=e||"";continue}}switch(o.type){case"space":continue;case"hr":n+=this.renderer.hr();continue;case"heading":n+=this.renderer.heading(this.parseInline(o.tokens),o.depth,this.parseInline(o.tokens,this.textRenderer).replace(eH,(e,t)=>"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""));continue;case"code":n+=this.renderer.code(o.text,o.lang,!!o.escaped);continue;case"table":{let e="",t="";for(let e=0;e<o.header.length;e++)t+=this.renderer.tablecell(this.parseInline(o.header[e].tokens),{header:!0,align:o.align[e]});e+=this.renderer.tablerow(t);let r="";for(let e=0;e<o.rows.length;e++){let n=o.rows[e];t="";for(let e=0;e<n.length;e++)t+=this.renderer.tablecell(this.parseInline(n[e].tokens),{header:!1,align:o.align[e]});r+=this.renderer.tablerow(t)}n+=this.renderer.table(e,r);continue}case"blockquote":{let e=this.parse(o.tokens);n+=this.renderer.blockquote(e);continue}case"list":{let e=o.ordered,t=o.start,r=o.loose,i="";for(let e=0;e<o.items.length;e++){let t=o.items[e],n=t.checked,l=t.task,a="";if(t.task){let e=this.renderer.checkbox(!!n);r?t.tokens.length>0&&"paragraph"===t.tokens[0].type?(t.tokens[0].text=e+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&"text"===t.tokens[0].tokens[0].type&&(t.tokens[0].tokens[0].text=e+" "+t.tokens[0].tokens[0].text)):t.tokens.unshift({type:"text",text:e+" "}):a+=e+" "}a+=this.parse(t.tokens,r),i+=this.renderer.listitem(a,l,!!n)}n+=this.renderer.list(i,e,t);continue}case"html":n+=this.renderer.html(o.text,o.block);continue;case"paragraph":n+=this.renderer.paragraph(this.parseInline(o.tokens));continue;case"text":{let i=o,l=i.tokens?this.parseInline(i.tokens):i.text;for(;r+1<e.length&&"text"===e[r+1].type;)l+="\n"+((i=e[++r]).tokens?this.parseInline(i.tokens):i.text);n+=t?this.renderer.paragraph(l):l;continue}default:{let e='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw Error(e)}}}return n}parseInline(e,t){t=t||this.renderer;let n="";for(let r=0;r<e.length;r++){let o=e[r];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]){let e=this.options.extensions.renderers[o.type].call({parser:this},o);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){n+=e||"";continue}}switch(o.type){case"escape":case"text":n+=t.text(o.text);break;case"html":n+=t.html(o.text);break;case"link":n+=t.link(o.href,o.title,this.parseInline(o.tokens,t));break;case"image":n+=t.image(o.href,o.title,o.text);break;case"strong":n+=t.strong(this.parseInline(o.tokens,t));break;case"em":n+=t.em(this.parseInline(o.tokens,t));break;case"codespan":n+=t.codespan(o.text);break;case"br":n+=t.br();break;case"del":n+=t.del(this.parseInline(o.tokens,t));break;default:{let e='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw Error(e)}}}return n}}class tP{options;constructor(e){this.options=e||ez}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}class tR{defaults=eL();options=this.setOptions;parse=this.#e(tE.lex,tC.parse);parseInline=this.#e(tE.lexInline,tC.parseInline);Parser=tC;Renderer=t_;TextRenderer=tI;Lexer=tE;Tokenizer=eJ;Hooks=tP;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case"table":for(let e of r.header)n=n.concat(this.walkTokens(e.tokens,t));for(let e of r.rows)for(let r of e)n=n.concat(this.walkTokens(r.tokens,t));break;case"list":n=n.concat(this.walkTokens(r.items,t));break;default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let o=e[r].flat(1/0);n=n.concat(this.walkTokens(o,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error("extension name required");if("renderer"in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return!1===r&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw Error("extension level must be 'block' or 'inline'");let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new t_(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if("options"===n)continue;let r=e.renderer[n],o=t[n];t[n]=(...e)=>{let n=r.apply(t,e);return!1===n&&(n=o.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new eJ(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let r=e.tokenizer[n],o=t[n];t[n]=(...e)=>{let n=r.apply(t,e);return!1===n&&(n=o.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new tP;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if("options"===n)continue;let r=e.hooks[n],o=t[n];tP.passThroughHooks.has(n)?t[n]=e=>{if(this.defaults.async)return Promise.resolve(r.call(t,e)).then(e=>o.call(t,e));let n=r.call(t,e);return o.call(t,n)}:t[n]=(...e)=>{let n=r.apply(t,e);return!1===n&&(n=o.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return tE.lex(e,t??this.defaults)}parser(e,t){return tC.parse(e,t??this.defaults)}#e(e,t){return(n,r)=>{let o={...r},i={...this.defaults,...o};!0===this.defaults.async&&!1===o.async&&(i.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),i.async=!0);let l=this.#t(!!i.silent,!!i.async);if(null==n)return l(Error("marked(): input parameter is undefined or null"));if("string"!=typeof n)return l(Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(i.hooks&&(i.hooks.options=i),i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(n):n).then(t=>e(t,i)).then(e=>i.hooks?i.hooks.processAllTokens(e):e).then(e=>i.walkTokens?Promise.all(this.walkTokens(e,i.walkTokens)).then(()=>e):e).then(e=>t(e,i)).then(e=>i.hooks?i.hooks.postprocess(e):e).catch(l);try{i.hooks&&(n=i.hooks.preprocess(n));let r=e(n,i);i.hooks&&(r=i.hooks.processAllTokens(r)),i.walkTokens&&this.walkTokens(r,i.walkTokens);let o=t(r,i);return i.hooks&&(o=i.hooks.postprocess(o)),o}catch(e){return l(e)}}}#t(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){let e="<p>An error occurred:</p><pre>"+eG(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}}let tD=new tR;function tN(e,t){return tD.parse(e,t)}tN.options=tN.setOptions=function(e){return tD.setOptions(e),tN.defaults=tD.defaults,ez=tN.defaults,tN},tN.getDefaults=eL,tN.defaults=ez,tN.use=function(...e){return tD.use(...e),tN.defaults=tD.defaults,ez=tN.defaults,tN},tN.walkTokens=function(e,t){return tD.walkTokens(e,t)},tN.parseInline=tD.parseInline,tN.Parser=tC,tN.parser=tC.parse,tN.Renderer=t_,tN.TextRenderer=tI,tN.Lexer=tE,tN.lexer=tE.lex,tN.Tokenizer=eJ,tN.Hooks=tP,tN.parse=tN,tN.options,tN.setOptions,tN.use,tN.walkTokens,tN.parseInline,tC.parse,tE.lex;var tj=(0,i.observer)(function(e){var n,o,s,c=(0,i.useFieldSchema)(),u=e.spaceId||(null==c||null==(s=c["x-component-props"])?void 0:s.spaceId),p=(0,a.useTranslation)().t,f=(0,t.useRequest)({url:"aiBuildGuideSpaces:getHtml/".concat(u)},{refreshDeps:[u],ready:!!u}),d=f.loading,h=f.data;if(!u)return r().createElement(l.Card,{style:{padding:24,textAlign:"center",color:"#888"}},p("Please select a User Guide Space in block settings"));if(d)return r().createElement(l.Card,{style:{padding:24,textAlign:"center"}},r().createElement(l.Spin,{size:"large"}));var m=function(e){if("undefined"==typeof DOMParser)return{html:e,toc:[]};var t=new DOMParser().parseFromString("<article>".concat(e,"</article>"),"text/html").querySelector("article");if(!t)return{html:e,toc:[]};var n=new Set,r=Array.from(t.querySelectorAll("h2, h3")).map(function(e,t){var r,o,i=(null==(o=e.textContent)?void 0:o.trim())||"";if(!i)return null;for(var l=(r="section-".concat(t+1),i.toLowerCase().normalize("NFKD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||r),a=l,s=2;n.has(a);)a="".concat(l,"-").concat(s),s++;return n.add(a),e.setAttribute("id",a),{id:a,text:i,level:"H3"===e.tagName?3:2}}).filter(Boolean);return{html:t.innerHTML,toc:r}}((o=function(e){var t,n=e.trim(),r=n.match(/^<p>([\s\S]*)<\/p>$/i),o=function(e){if("undefined"==typeof document)return e;var t=document.createElement("textarea");return t.innerHTML=e,t.value}((null==r?void 0:r[1])||n);if(!o.startsWith("["))return"";try{return t=JSON.parse(o),Array.isArray(t)?t.map(function(e){return"string"==typeof e?e:"string"==typeof(null==e?void 0:e.text)?e.text:"string"==typeof(null==e?void 0:e.content)?e.content:""}).filter(Boolean).join("\n"):""}catch(e){return""}}(n=function(e){if("string"==typeof e)return e;if(e&&(void 0===e?"undefined":e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="object"&&"data"in e){var t=e.data;return"string"==typeof t?t:""}return""}(h)))?tN.parse(o):n),g=m.toc.length>2;return r().createElement(l.Card,{bordered:!1,className:"user-guide-block",style:{width:"100%",minHeight:300}},r().createElement("style",null,"\n .user-guide-block .ant-card-body {\n padding: 0;\n }\n\n .user-guide-shell {\n display: grid;\n grid-template-columns: minmax(0, 1fr);\n max-width: 95%;\n margin: 0 auto;\n }\n\n .user-guide-shell.has-toc {\n grid-template-columns: 220px minmax(0, 1fr);\n }\n\n .user-guide-toc {\n position: sticky;\n top: 16px;\n align-self: start;\n max-height: calc(100vh - 120px);\n overflow: auto;\n padding: 32px 0 32px 24px;\n border-right: 1px solid #eef0f2;\n }\n\n .user-guide-toc-title {\n margin-bottom: 10px;\n color: rgba(0, 0, 0, 0.45);\n font-size: 12px;\n font-weight: 600;\n text-transform: uppercase;\n }\n\n .user-guide-toc a {\n display: block;\n padding: 5px 10px;\n border-radius: 4px;\n color: rgba(0, 0, 0, 0.66);\n font-size: 13px;\n line-height: 1.42;\n text-decoration: none;\n }\n\n .user-guide-toc a:hover {\n background: #f5f7fa;\n color: #1677ff;\n }\n\n .user-guide-toc .level-3 {\n padding-left: 22px;\n font-size: 12px;\n }\n\n .user-guide-content {\n max-width: 95%;\n margin: 0 auto;\n padding: 32px;\n color: rgba(0, 0, 0, 0.82);\n font-size: 15px;\n line-height: 1.78;\n }\n\n .user-guide-content h1,\n .user-guide-content h2,\n .user-guide-content h3,\n .user-guide-content h4 {\n color: rgba(0, 0, 0, 0.92);\n font-weight: 650;\n line-height: 1.28;\n margin: 28px 0 12px;\n }\n\n .user-guide-content h1:first-child,\n .user-guide-content h2:first-child,\n .user-guide-content h3:first-child {\n margin-top: 0;\n }\n\n .user-guide-content h1 {\n font-size: 30px;\n }\n\n .user-guide-content h2 {\n font-size: 24px;\n padding-bottom: 8px;\n border-bottom: 1px solid #e6e8eb;\n }\n\n .user-guide-content h3 {\n font-size: 19px;\n }\n\n .user-guide-content p,\n .user-guide-content ul,\n .user-guide-content ol,\n .user-guide-content table,\n .user-guide-content blockquote,\n .user-guide-content pre {\n margin: 0 0 16px;\n }\n\n .user-guide-content ul,\n .user-guide-content ol {\n padding-left: 24px;\n }\n\n .user-guide-content li + li {\n margin-top: 6px;\n }\n\n .user-guide-content table {\n width: 100%;\n border-collapse: collapse;\n overflow: hidden;\n border: 1px solid #e6e8eb;\n border-radius: 6px;\n }\n\n .user-guide-content th,\n .user-guide-content td {\n padding: 10px 12px;\n border: 1px solid #e6e8eb;\n vertical-align: top;\n }\n\n .user-guide-content th {\n background: #f7f8fa;\n font-weight: 600;\n }\n\n .user-guide-content blockquote {\n padding: 12px 16px;\n border-left: 4px solid #1677ff;\n background: #f3f8ff;\n color: rgba(0, 0, 0, 0.76);\n }\n\n .user-guide-content code {\n padding: 2px 5px;\n border-radius: 4px;\n background: #f2f4f7;\n font-size: 0.92em;\n }\n\n .user-guide-content pre {\n padding: 14px 16px;\n overflow: auto;\n border-radius: 6px;\n background: #111827;\n color: #f9fafb;\n }\n\n .user-guide-content pre code {\n padding: 0;\n background: transparent;\n color: inherit;\n }\n\n .user-guide-content hr {\n border: 0;\n border-top: 1px solid #e6e8eb;\n margin: 28px 0;\n }\n\n @media (max-width: 900px) {\n .user-guide-shell.has-toc {\n grid-template-columns: minmax(0, 1fr);\n }\n\n .user-guide-toc {\n position: static;\n max-height: none;\n padding: 20px 24px 0;\n border-right: 0;\n }\n\n .user-guide-content {\n padding: 24px;\n }\n }\n"),m.html?r().createElement("div",{className:"user-guide-shell".concat(g?" has-toc":"")},g&&r().createElement("nav",{className:"user-guide-toc"},r().createElement("div",{className:"user-guide-toc-title"},p("Contents")),m.toc.map(function(e){return r().createElement("a",{key:e.id,href:"#".concat(e.id),className:"level-".concat(e.level)},e.text)})),r().createElement("article",{className:"user-guide-content",dangerouslySetInnerHTML:{__html:ej.sanitize(m.html)}})):r().createElement(l.Empty,{description:p("No guide content available"),style:{padding:32}}))},{displayName:"UserGuideBlock"}),tL=function(){var e,n,o=(0,t.useSchemaInitializer)().insert,i=(0,t.useSchemaInitializerItem)();return r().createElement(t.SchemaInitializerItem,(e=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},i),n=n={icon:r().createElement(y.ReadOutlined,null),onClick:function(){o({type:"void","x-settings":"userGuideBlockSettings","x-decorator":"BlockItem","x-decorator-props":{name:"userGuide"},"x-component":"UserGuideBlock","x-component-props":{}})}},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}),e))},tz=function(e){var n,o,i,a,s=(0,t.useRequest)({resource:"aiBuildGuideSpaces",action:"list",params:{filter:{status:"completed"},pageSize:100,sort:["-createdAt"]}}),c=s.data,u=s.loading,p=(Array.isArray(o=(null==c||null==(n=c.data)?void 0:n.data)||(null==c?void 0:c.data)||c||[])?o:[]).map(function(e){return{label:e.title,value:e.id}})||[];return r().createElement(l.Select,(i=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},e),a=a={loading:u,options:p,showSearch:!0,filterOption:function(e,t){var n;return null==t||null==(n=t.label)?void 0:n.toLowerCase().includes(e.toLowerCase())}},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(a)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(a)).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(a,e))}),i))},tM=function(e){return r().createElement(t.SchemaComponentOptions,{components:{UserGuideBlock:tj,UserGuideBlockInitializer:tL,SpaceSelect:tz}},e.children)},t$=u(667);function tB(e,t,n,r,o,i,l){try{var a=e[i](l),s=a.value}catch(e){n(e);return}a.done?t(s):Promise.resolve(s).then(r,o)}function tF(e){return(tF=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function tU(e,t){return(tU=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function tq(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(tq=function(){return!!e})()}var tG=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=tF(e),function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,tq()?Reflect.construct(e,t||[],tF(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&tU(n,e),t=[{key:"renderComponent",value:function(){var e=(this.props||{}).spaceId;return r().createElement(tj,{spaceId:e})}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(t.BlockModel);tG.registerFlow({key:"userGuideBlockSettings",title:(0,t$.escapeT)("User guide block setting",{ns:"build-guide-block"}),steps:{editUserGuide:{title:(0,t$.escapeT)("Edit user guide settings",{ns:"build-guide-block"}),uiSchema:function(e){return{spaceId:{title:(0,e.t)("Space"),type:"string","x-decorator":"FormItem","x-component":tz,required:!0}}},handler:function(e,t){var n;return(n=function(){var n;return function(e,t){var n,r,o,i,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){var s=[i,a];if(n)throw TypeError("Generator is already executing.");for(;l;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return l.label++,{value:s[1],done:!1};case 5:l.label++,r=s[1],s=[0];continue;case 7:s=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){l=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){l.label=s[1];break}if(6===s[0]&&l.label<o[1]){l.label=o[1],o=s;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(s);break}o[2]&&l.ops.pop(),l.trys.pop();continue}s=t.call(e,l)}catch(e){s=[6,e],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}(this,function(r){return n=t.spaceId,e.model.setProps({spaceId:n}),[2]})},function(){var e=this,t=arguments;return new Promise(function(r,o){var i=n.apply(e,t);function l(e){tB(i,r,o,l,a,"next",e)}function a(e){tB(i,r,o,l,a,"throw",e)}l(void 0)})})()}}}}),tG.define({label:(0,t$.escapeT)("User Guide")});var tH="build-guide-block",tW=new t.SchemaSettings({name:"userGuideBlockSettings",items:[{name:"selectSpace",type:"modal",useComponentProps:function(){var e,r,o=(0,i.useFieldSchema)(),l=(0,t.useDesignable)().dn,a=(e=(0,t.useApp)(),(0,n.useCallback)(function(t,n){return e.i18n.t(t,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({ns:[tH,"client"]},n))},[e.i18n])),s=(null==o||null==(r=o["x-component-props"])?void 0:r.spaceId)||"";return{title:a("Select Space"),schema:{type:"object",properties:{spaceId:{title:a("Space"),type:"string","x-decorator":"FormItem","x-component":tz,default:s,required:!0}}},onSubmit:function(e){var t,n,r=e.spaceId,i=(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},o["x-component-props"]),n=n={spaceId:r},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t);o["x-component-props"]=i,l.emit("patch",{schema:{"x-uid":o["x-uid"],"x-component-props":i}}),l.refresh()}}}},{name:"divider",type:"divider"},{name:"delete",type:"remove",useComponentProps:function(){return{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}}]});function tV(e,t,n,r,o,i,l){try{var a=e[i](l),s=a.value}catch(e){n(e);return}a.done?t(s):Promise.resolve(s).then(r,o)}function tZ(e,t,n){return(tZ=tK()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&tQ(o,n.prototype),o}).apply(null,arguments)}function tY(e){return(tY=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function tQ(e,t){return(tQ=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function tX(e){var t="function"==typeof Map?new Map:void 0;return(tX=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return tZ(e,arguments,tY(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),tQ(n,e)})(e)}function tK(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(tK=function(){return!!e})()}var tJ=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=tY(e),function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,tK()?Reflect.construct(e,t||[],tY(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&tQ(n,e),t=[{key:"load",value:function(){var e,t=this;return(e=function(){var e;return function(e,t){var n,r,o,i,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){var s=[i,a];if(n)throw TypeError("Generator is already executing.");for(;l;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return l.label++,{value:s[1],done:!1};case 5:l.label++,r=s[1],s=[0];continue;case 7:s=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){l=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){l.label=s[1];break}if(6===s[0]&&l.label<o[1]){l.label=o[1],o=s;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(s);break}o[2]&&l.ops.pop(),l.trys.pop();continue}s=t.call(e,l)}catch(e){s=[6,e],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}(this,function(n){return t.app.addComponents({UserGuideBlock:tj,UserGuideBlockInitializer:tL,BuildButton:S,LLMServiceSelect:d,ModelSelect:m,StatusTag:b,SpaceSelect:tz}),t.app.schemaSettingsManager.add(tW),t.app.use(tM),t.app.pluginSettingsManager.add("ai-build-guide",{icon:"ReadOutlined",title:'{{t("Build Guide Block", { ns: "'.concat(tH,'" })}}'),Component:_,aclSnippet:"pm.ai-build-guide"}),e={title:'{{t("User Guide", { ns: "'.concat(tH,'" })}}'),Component:"UserGuideBlockInitializer"},t.app.schemaInitializerManager.addItem("page:addBlock","otherBlocks.aiUserGuide",e),t.app.schemaInitializerManager.addItem("popup:common:addBlock","otherBlocks.aiUserGuide",e),t.app.schemaInitializerManager.addItem("popup:addNew:addBlock","otherBlocks.aiUserGuide",e),t.flowEngine.registerModels({UserGuideBlockModel:tG}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function l(e){tV(i,r,o,l,a,"next",e)}function a(e){tV(i,r,o,l,a,"throw",e)}l(void 0)})})()}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(tX(t.Plugin))}(),p}()});
18
+ `}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return"<br>"}del(e){return`<del>${e}</del>`}link(e,t,n){let r=eG(e);if(null===r)return n;let i='<a href="'+(e=r)+'"';return t&&(i+=' title="'+t+'"'),i+=">"+n+"</a>"}image(e,t,n){let r=eG(e);if(null===r)return n;e=r;let i=`<img src="${e}" alt="${n}"`;return t&&(i+=` title="${t}"`),i+=">"}text(e){return e}}class tO{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return""+n}image(e,t,n){return""+n}br(){return""}}class tT{options;renderer;textRenderer;constructor(e){this.options=e||eR,this.options.renderer=this.options.renderer||new tS,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new tO}static parse(e,t){return new tT(t).parse(e)}static parseInline(e,t){return new tT(t).parseInline(e)}parse(e,t=!0){let n="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(!1!==e||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(i.type)){n+=e||"";continue}}switch(i.type){case"space":continue;case"hr":n+=this.renderer.hr();continue;case"heading":n+=this.renderer.heading(this.parseInline(i.tokens),i.depth,this.parseInline(i.tokens,this.textRenderer).replace(eB,(e,t)=>"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""));continue;case"code":n+=this.renderer.code(i.text,i.lang,!!i.escaped);continue;case"table":{let e="",t="";for(let e=0;e<i.header.length;e++)t+=this.renderer.tablecell(this.parseInline(i.header[e].tokens),{header:!0,align:i.align[e]});e+=this.renderer.tablerow(t);let r="";for(let e=0;e<i.rows.length;e++){let n=i.rows[e];t="";for(let e=0;e<n.length;e++)t+=this.renderer.tablecell(this.parseInline(n[e].tokens),{header:!1,align:i.align[e]});r+=this.renderer.tablerow(t)}n+=this.renderer.table(e,r);continue}case"blockquote":{let e=this.parse(i.tokens);n+=this.renderer.blockquote(e);continue}case"list":{let e=i.ordered,t=i.start,r=i.loose,o="";for(let e=0;e<i.items.length;e++){let t=i.items[e],n=t.checked,l=t.task,a="";if(t.task){let e=this.renderer.checkbox(!!n);r?t.tokens.length>0&&"paragraph"===t.tokens[0].type?(t.tokens[0].text=e+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&"text"===t.tokens[0].tokens[0].type&&(t.tokens[0].tokens[0].text=e+" "+t.tokens[0].tokens[0].text)):t.tokens.unshift({type:"text",text:e+" "}):a+=e+" "}a+=this.parse(t.tokens,r),o+=this.renderer.listitem(a,l,!!n)}n+=this.renderer.list(o,e,t);continue}case"html":n+=this.renderer.html(i.text,i.block);continue;case"paragraph":n+=this.renderer.paragraph(this.parseInline(i.tokens));continue;case"text":{let o=i,l=o.tokens?this.parseInline(o.tokens):o.text;for(;r+1<e.length&&"text"===e[r+1].type;)l+="\n"+((o=e[++r]).tokens?this.parseInline(o.tokens):o.text);n+=t?this.renderer.paragraph(l):l;continue}default:{let e='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw Error(e)}}}return n}parseInline(e,t){t=t||this.renderer;let n="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){n+=e||"";continue}}switch(i.type){case"escape":case"text":n+=t.text(i.text);break;case"html":n+=t.html(i.text);break;case"link":n+=t.link(i.href,i.title,this.parseInline(i.tokens,t));break;case"image":n+=t.image(i.href,i.title,i.text);break;case"strong":n+=t.strong(this.parseInline(i.tokens,t));break;case"em":n+=t.em(this.parseInline(i.tokens,t));break;case"codespan":n+=t.codespan(i.text);break;case"br":n+=t.br();break;case"del":n+=t.del(this.parseInline(i.tokens,t));break;default:{let e='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw Error(e)}}}return n}}class tE{options;constructor(e){this.options=e||eR}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}class t_{defaults=eP();options=this.setOptions;parse=this.#e(tv.lex,tT.parse);parseInline=this.#e(tv.lexInline,tT.parseInline);Parser=tT;Renderer=tS;TextRenderer=tO;Lexer=tv;Tokenizer=eY;Hooks=tE;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case"table":for(let e of r.header)n=n.concat(this.walkTokens(e.tokens,t));for(let e of r.rows)for(let r of e)n=n.concat(this.walkTokens(r.tokens,t));break;case"list":n=n.concat(this.walkTokens(r.items,t));break;default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error("extension name required");if("renderer"in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return!1===r&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw Error("extension level must be 'block' or 'inline'");let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new tS(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if("options"===n)continue;let r=e.renderer[n],i=t[n];t[n]=(...e)=>{let n=r.apply(t,e);return!1===n&&(n=i.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new eY(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let r=e.tokenizer[n],i=t[n];t[n]=(...e)=>{let n=r.apply(t,e);return!1===n&&(n=i.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new tE;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if("options"===n)continue;let r=e.hooks[n],i=t[n];tE.passThroughHooks.has(n)?t[n]=e=>{if(this.defaults.async)return Promise.resolve(r.call(t,e)).then(e=>i.call(t,e));let n=r.call(t,e);return i.call(t,n)}:t[n]=(...e)=>{let n=r.apply(t,e);return!1===n&&(n=i.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return tv.lex(e,t??this.defaults)}parser(e,t){return tT.parse(e,t??this.defaults)}#e(e,t){return(n,r)=>{let i={...r},o={...this.defaults,...i};!0===this.defaults.async&&!1===i.async&&(o.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),o.async=!0);let l=this.#t(!!o.silent,!!o.async);if(null==n)return l(Error("marked(): input parameter is undefined or null"));if("string"!=typeof n)return l(Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(o.hooks&&(o.hooks.options=o),o.async)return Promise.resolve(o.hooks?o.hooks.preprocess(n):n).then(t=>e(t,o)).then(e=>o.hooks?o.hooks.processAllTokens(e):e).then(e=>o.walkTokens?Promise.all(this.walkTokens(e,o.walkTokens)).then(()=>e):e).then(e=>t(e,o)).then(e=>o.hooks?o.hooks.postprocess(e):e).catch(l);try{o.hooks&&(n=o.hooks.preprocess(n));let r=e(n,o);o.hooks&&(r=o.hooks.processAllTokens(r)),o.walkTokens&&this.walkTokens(r,o.walkTokens);let i=t(r,o);return o.hooks&&(i=o.hooks.postprocess(i)),i}catch(e){return l(e)}}}#t(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){let e="<p>An error occurred:</p><pre>"+eL(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}}let tA=new t_;function tI(e,t){return tA.parse(e,t)}tI.options=tI.setOptions=function(e){return tA.setOptions(e),tI.defaults=tA.defaults,eR=tI.defaults,tI},tI.getDefaults=eP,tI.defaults=eR,tI.use=function(...e){return tA.use(...e),tI.defaults=tA.defaults,eR=tI.defaults,tI},tI.walkTokens=function(e,t){return tA.walkTokens(e,t)},tI.parseInline=tA.parseInline,tI.Parser=tT,tI.parser=tT.parse,tI.Renderer=tS,tI.TextRenderer=tO,tI.Lexer=tv,tI.lexer=tv.lex,tI.Tokenizer=eY,tI.Hooks=tE,tI.parse=tI,tI.options,tI.setOptions,tI.use,tI.walkTokens,tI.parseInline,tT.parse,tv.lex;var tC=(0,k.observer)(function(e){var n,o,l,s=(0,k.useFieldSchema)(),c=e.spaceId||(null==s||null==(l=s["x-component-props"])?void 0:l.spaceId),u=(0,a.useTranslation)().t,p=(0,t.useRequest)({url:"aiBuildGuideSpaces:getHtml/".concat(c)},{refreshDeps:[c],ready:!!c}),f=p.loading,d=p.data;if(!c)return r().createElement(i.Card,{style:{padding:24,textAlign:"center",color:"#888"}},u("Please select a User Guide Space in block settings"));if(f)return r().createElement(i.Card,{style:{padding:24,textAlign:"center"}},r().createElement(i.Spin,{size:"large"}));var h=function(e){if("u"<typeof DOMParser)return{html:e,toc:[]};var t=new DOMParser().parseFromString("<article>".concat(e,"</article>"),"text/html").querySelector("article");if(!t)return{html:e,toc:[]};var n=new Set,r=Array.from(t.querySelectorAll("h2, h3")).map(function(e,t){var r,i,o=(null==(i=e.textContent)?void 0:i.trim())||"";if(!o)return null;for(var l=(r="section-".concat(t+1),o.toLowerCase().normalize("NFKD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||r),a=l,s=2;n.has(a);)a="".concat(l,"-").concat(s),s++;return n.add(a),e.setAttribute("id",a),{id:a,text:o,level:"H3"===e.tagName?3:2}}).filter(Boolean);return{html:t.innerHTML,toc:r}}((o=function(e){var t,n=e.trim(),r=n.match(/^<p>([\s\S]*)<\/p>$/i),i=function(e){if("u"<typeof document)return e;var t=document.createElement("textarea");return t.innerHTML=e,t.value}((null==r?void 0:r[1])||n);if(!i.startsWith("["))return"";try{return t=JSON.parse(i),Array.isArray(t)?t.map(function(e){return"string"==typeof e?e:"string"==typeof(null==e?void 0:e.text)?e.text:"string"==typeof(null==e?void 0:e.content)?e.content:""}).filter(Boolean).join("\n"):""}catch(e){return""}}(n=function(e){if("string"==typeof e)return e;if(e&&(void 0===e?"undefined":e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="object"&&"data"in e){var t=e.data;return"string"==typeof t?t:""}return""}(d)))?tI.parse(o):n),m=h.toc.length>2;return r().createElement(i.Card,{bordered:!1,className:"user-guide-block",style:{width:"100%",minHeight:300}},r().createElement("style",null,"\n .user-guide-block .ant-card-body {\n padding: 0;\n }\n\n .user-guide-shell {\n display: grid;\n grid-template-columns: minmax(0, 1fr);\n max-width: 95%;\n margin: 0 auto;\n }\n\n .user-guide-shell.has-toc {\n grid-template-columns: 220px minmax(0, 1fr);\n }\n\n .user-guide-toc {\n position: sticky;\n top: 16px;\n align-self: start;\n max-height: calc(100vh - 120px);\n overflow: auto;\n padding: 32px 0 32px 24px;\n border-right: 1px solid #eef0f2;\n }\n\n .user-guide-toc-title {\n margin-bottom: 10px;\n color: rgba(0, 0, 0, 0.45);\n font-size: 12px;\n font-weight: 600;\n text-transform: uppercase;\n }\n\n .user-guide-toc a {\n display: block;\n padding: 5px 10px;\n border-radius: 4px;\n color: rgba(0, 0, 0, 0.66);\n font-size: 13px;\n line-height: 1.42;\n text-decoration: none;\n }\n\n .user-guide-toc a:hover {\n background: #f5f7fa;\n color: #1677ff;\n }\n\n .user-guide-toc .level-3 {\n padding-left: 22px;\n font-size: 12px;\n }\n\n .user-guide-content {\n max-width: 95%;\n margin: 0 auto;\n padding: 32px;\n color: rgba(0, 0, 0, 0.82);\n font-size: 15px;\n line-height: 1.78;\n }\n\n .user-guide-content h1,\n .user-guide-content h2,\n .user-guide-content h3,\n .user-guide-content h4 {\n color: rgba(0, 0, 0, 0.92);\n font-weight: 650;\n line-height: 1.28;\n margin: 28px 0 12px;\n }\n\n .user-guide-content h1:first-child,\n .user-guide-content h2:first-child,\n .user-guide-content h3:first-child {\n margin-top: 0;\n }\n\n .user-guide-content h1 {\n font-size: 30px;\n }\n\n .user-guide-content h2 {\n font-size: 24px;\n padding-bottom: 8px;\n border-bottom: 1px solid #e6e8eb;\n }\n\n .user-guide-content h3 {\n font-size: 19px;\n }\n\n .user-guide-content p,\n .user-guide-content ul,\n .user-guide-content ol,\n .user-guide-content table,\n .user-guide-content blockquote,\n .user-guide-content pre {\n margin: 0 0 16px;\n }\n\n .user-guide-content ul,\n .user-guide-content ol {\n padding-left: 24px;\n }\n\n .user-guide-content li + li {\n margin-top: 6px;\n }\n\n .user-guide-content table {\n width: 100%;\n border-collapse: collapse;\n overflow: hidden;\n border: 1px solid #e6e8eb;\n border-radius: 6px;\n }\n\n .user-guide-content th,\n .user-guide-content td {\n padding: 10px 12px;\n border: 1px solid #e6e8eb;\n vertical-align: top;\n }\n\n .user-guide-content th {\n background: #f7f8fa;\n font-weight: 600;\n }\n\n .user-guide-content blockquote {\n padding: 12px 16px;\n border-left: 4px solid #1677ff;\n background: #f3f8ff;\n color: rgba(0, 0, 0, 0.76);\n }\n\n .user-guide-content code {\n padding: 2px 5px;\n border-radius: 4px;\n background: #f2f4f7;\n font-size: 0.92em;\n }\n\n .user-guide-content pre {\n padding: 14px 16px;\n overflow: auto;\n border-radius: 6px;\n background: #111827;\n color: #f9fafb;\n }\n\n .user-guide-content pre code {\n padding: 0;\n background: transparent;\n color: inherit;\n }\n\n .user-guide-content hr {\n border: 0;\n border-top: 1px solid #e6e8eb;\n margin: 28px 0;\n }\n\n @media (max-width: 900px) {\n .user-guide-shell.has-toc {\n grid-template-columns: minmax(0, 1fr);\n }\n\n .user-guide-toc {\n position: static;\n max-height: none;\n padding: 20px 24px 0;\n border-right: 0;\n }\n\n .user-guide-content {\n padding: 24px;\n }\n }\n"),h.html?r().createElement("div",{className:"user-guide-shell".concat(m?" has-toc":"")},m&&r().createElement("nav",{className:"user-guide-toc"},r().createElement("div",{className:"user-guide-toc-title"},u("Contents")),h.toc.map(function(e){return r().createElement("a",{key:e.id,href:"#".concat(e.id),className:"level-".concat(e.level)},e.text)})),r().createElement("article",{className:"user-guide-content",dangerouslySetInnerHTML:{__html:eC.sanitize(h.html)}})):r().createElement(i.Empty,{description:u("No guide content available"),style:{padding:32}}))},{displayName:"UserGuideBlock"}),tP=function(){var e,n,i=(0,t.useSchemaInitializer)().insert,l=(0,t.useSchemaInitializerItem)();return r().createElement(t.SchemaInitializerItem,(e=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},l),n=n={icon:r().createElement(o.ReadOutlined,null),onClick:function(){i({type:"void","x-settings":"userGuideBlockSettings","x-decorator":"BlockItem","x-decorator-props":{name:"userGuide"},"x-component":"UserGuideBlock","x-component-props":{}})}},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}),e))},tR=function(e){var n,o,l,a,s=(0,t.useRequest)({resource:"aiBuildGuideSpaces",action:"list",params:{filter:{status:"completed"},pageSize:100,sort:["-createdAt"]}}),c=s.data,u=s.loading,p=(Array.isArray(o=(null==c||null==(n=c.data)?void 0:n.data)||(null==c?void 0:c.data)||c||[])?o:[]).map(function(e){return{label:e.title,value:e.id}})||[];return r().createElement(i.Select,(l=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},e),a=a={loading:u,options:p,showSearch:!0,filterOption:function(e,t){var n;return null==t||null==(n=t.label)?void 0:n.toLowerCase().includes(e.toLowerCase())}},Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(a)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(a)).forEach(function(e){Object.defineProperty(l,e,Object.getOwnPropertyDescriptor(a,e))}),l))},tN=function(e){return r().createElement(t.SchemaComponentOptions,{components:{UserGuideBlock:tC,UserGuideBlockInitializer:tP,SpaceSelect:tR}},e.children)},tj=u(694);function tD(e,t,n,r,i,o,l){try{var a=e[o](l),s=a.value}catch(e){n(e);return}a.done?t(s):Promise.resolve(s).then(r,i)}function tz(e){return(tz=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function t$(e,t){return(t$=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function tM(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(tM=function(){return!!e})()}var tL=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=tz(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,tM()?Reflect.construct(e,t||[],tz(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&t$(n,e),t=[{key:"renderComponent",value:function(){var e=(this.props||{}).spaceId;return r().createElement(tC,{spaceId:e})}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(t.BlockModel);tL.registerFlow({key:"userGuideBlockSettings",title:(0,tj.escapeT)("User guide block setting",{ns:"build-guide-block"}),steps:{editUserGuide:{title:(0,tj.escapeT)("Edit user guide settings",{ns:"build-guide-block"}),uiSchema:function(e){return{spaceId:{title:(0,e.t)("Space"),type:"string","x-decorator":"FormItem","x-component":tR,required:!0}}},handler:function(e,t){var n;return(n=function(){var n;return function(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(l,"next",{value:s(0)}),a(l,"throw",{value:s(1)}),a(l,"return",{value:s(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function s(a){return function(s){var c=[a,s];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){o.label=c[1];break}if(6===c[0]&&o.label<i[1]){o.label=i[1],i=c;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(c);break}i[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(r){return n=t.spaceId,e.model.setProps({spaceId:n}),[2]})},function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function l(e){tD(o,r,i,l,a,"next",e)}function a(e){tD(o,r,i,l,a,"throw",e)}l(void 0)})})()}}}}),tL.define({label:(0,tj.escapeT)("User Guide")});var tB="build-guide-block",tF=new t.SchemaSettings({name:"userGuideBlockSettings",items:[{name:"selectSpace",type:"modal",useComponentProps:function(){var e,r,i=(0,k.useFieldSchema)(),o=(0,t.useDesignable)().dn,l=(e=(0,t.useApp)(),(0,n.useCallback)(function(t,n){return e.i18n.t(t,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({ns:[tB,"client"]},n))},[e.i18n])),a=(null==i||null==(r=i["x-component-props"])?void 0:r.spaceId)||"";return{title:l("Select Space"),schema:{type:"object",properties:{spaceId:{title:l("Space"),type:"string","x-decorator":"FormItem","x-component":tR,default:a,required:!0}}},onSubmit:function(e){var t,n,r=e.spaceId,l=(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},i["x-component-props"]),n=n={spaceId:r},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t);i["x-component-props"]=l,o.emit("patch",{schema:{"x-uid":i["x-uid"],"x-component-props":l}}),o.refresh()}}}},{name:"divider",type:"divider"},{name:"delete",type:"remove",useComponentProps:function(){return{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}}}]});function tU(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function tG(e,t,n,r,i,o,l){try{var a=e[o](l),s=a.value}catch(e){n(e);return}a.done?t(s):Promise.resolve(s).then(r,i)}function tq(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function l(e){tG(o,r,i,l,a,"next",e)}function a(e){tG(o,r,i,l,a,"throw",e)}l(void 0)})}}function tH(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(l,"next",{value:s(0)}),a(l,"throw",{value:s(1)}),a(l,"return",{value:s(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function s(a){return function(s){var c=[a,s];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){o.label=c[1];break}if(6===c[0]&&o.label<i[1]){o.label=i[1],i=c;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(c);break}i[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var tW=function(){var e,l=function(e){if(Array.isArray(e))return e}(e=(0,n.useState)(!1))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i=[],o=!0,l=!1;try{for(r=r.call(e);!(o=(t=r.next()).done)&&(i.push(t.value),2!==i.length);o=!0);}catch(e){l=!0,n=e}finally{try{o||null==r.return||r.return()}finally{if(l)throw n}}return i}}(e)||function(e){if(e){if("string"==typeof e)return tU(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return tU(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),s=l[0],c=l[1],u=(0,t.useAPIClient)(),p=i.App.useApp().message,f=(0,a.useTranslation)().t,d=(0,t.useCollectionRecordData)(),h=(0,t.useDataBlockRequest)().refresh,m=(0,n.useRef)(null),g=(0,n.useCallback)(function(){m.current&&(clearTimeout(m.current),m.current=null),c(!1)},[]);return(0,n.useEffect)(function(){return g},[g]),r().createElement(i.Button,{type:"primary",icon:r().createElement(o.PlayCircleOutlined,null),loading:s,onClick:function(){return tq(function(){var e,t,n,r,i,o,l;return tH(this,function(a){switch(a.label){case 0:if(!(null==d?void 0:d.id))return[2];c(!0),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,u.resource("aiBuildGuideSpaces").build({filterByTk:d.id})];case 2:return a.sent(),p.success(f("Build started")),e=Date.now(),t=!1,n=function(){return tq(function(){var r,i,o,l,a;return tH(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,u.resource("aiBuildGuideSpaces").get({filterByTk:d.id})];case 1:if("building"!==(l=null==(o=s.sent())||null==(i=o.data)||null==(r=i.data)?void 0:r.status))return g(),null==h||h(),"completed"===l?p.success(f("Build completed")):"error"===l&&p.error(f("Build failed")),[2];return(a=Date.now()-e)>=3e5&&!t&&(t=!0,p.info(f("Build is still running"))),m.current=setTimeout(n,a>=3e5?1e4:3e3),[3,3];case 2:return s.sent(),g(),null==h||h(),[3,3];case 3:return[2]}})})()},m.current=setTimeout(n,3e3),[3,4];case 3:return console.error(r=a.sent()),p.error((null==r||null==(l=r.response)||null==(o=l.data)||null==(i=o.error)?void 0:i.message)||f("Build failed")),c(!1),[3,4];case 4:return[2]}})})()},disabled:(null==d?void 0:d.status)==="building"},f("Build"))};function tZ(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function tY(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,i=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var o=[],l=!0,a=!1;try{for(i=i.call(e);!(l=(n=i.next()).done)&&(o.push(n.value),!t||o.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==i.return||i.return()}finally{if(a)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return tZ(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return tZ(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var tQ=function(e){var o,l,a=tY((0,n.useState)([]),2),s=a[0],c=a[1],u=tY((0,n.useState)(!1),2),p=u[0],f=u[1],d=(0,t.useAPIClient)(),h=(0,k.useField)();return(0,n.useEffect)(function(){var e=!0;return f(!0),d.resource("ai").listLLMServices().then(function(t){if(e){var n;c(((null==t||null==(n=t.data)?void 0:n.data)||[]).map(function(e){return{label:e.title||e.name,value:e.name}}))}}).catch(function(t){e&&console.error("Failed to load LLM services:",t)}).finally(function(){e&&f(!1)}),function(){e=!1}},[d]),r().createElement(i.Select,(o=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},e),l=l={options:s,loading:p,value:h.value,onChange:function(e){var t;h.setValue(e),null==(t=h.query(".model").take())||t.setValue(void 0)}},Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(l)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(l)).forEach(function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(l,e))}),o))};function tX(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var tV=(0,k.observer)(function(e){var o,l,a,s=function(e){if(Array.isArray(e))return e}(o=(0,n.useState)([]))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i=[],o=!0,l=!1;try{for(r=r.call(e);!(o=(t=r.next()).done)&&(i.push(t.value),2!==i.length);o=!0);}catch(e){l=!0,n=e}finally{try{o||null==r.return||r.return()}finally{if(l)throw n}}return i}}(o)||function(e){if(e){if("string"==typeof e)return tX(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return tX(e,2)}}(o)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),c=s[0],u=s[1],p=(0,t.useAPIClient)(),f=(0,k.useField)(),d=(0,k.useForm)().values.llmService;return(0,n.useEffect)(function(){var e=!0;return d?(p.resource("ai").listModels({llmService:d}).then(function(t){if(e){var n;u(((null==t||null==(n=t.data)?void 0:n.data)||[]).map(function(e){return{label:e.id||e.name,value:e.id||e.name}}))}}).catch(console.error),function(){e=!1}):void u([])},[p,d]),r().createElement(i.Select,(l=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},e),a=a={options:c,value:f.value,onChange:function(e){f.setValue(e)},disabled:!d},Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(a)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(a)).forEach(function(e){Object.defineProperty(l,e,Object.getOwnPropertyDescriptor(a,e))}),l))}),tK={draft:"default",building:"blue",completed:"success",error:"error"},tJ=function(e){var t=(0,k.useField)(),n=e.value||t.value;return n?r().createElement(i.Tag,{color:tK[n]||"default"},String(n).toUpperCase()):null};function t0(e,t,n,r,i,o,l){try{var a=e[o](l),s=a.value}catch(e){n(e);return}a.done?t(s):Promise.resolve(s).then(r,i)}function t1(e,t,n){return(t1=t6()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&t3(i,n.prototype),i}).apply(null,arguments)}function t2(e){return(t2=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function t3(e,t){return(t3=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function t4(e){var t="function"==typeof Map?new Map:void 0;return(t4=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return t1(e,arguments,t2(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),t3(n,e)})(e)}function t6(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(t6=function(){return!!e})()}var t9=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=t2(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,t6()?Reflect.construct(e,t||[],t2(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&t3(n,e),t=[{key:"load",value:function(){var e;return(e=function(){var e;return function(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(l,"next",{value:s(0)}),a(l,"throw",{value:s(1)}),a(l,"return",{value:s(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function s(a){return function(s){var c=[a,s];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){o.label=c[1];break}if(6===c[0]&&o.label<i[1]){o.label=i[1],i=c;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(c);break}i[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(t){return this.app.addComponents({UserGuideBlock:tC,UserGuideBlockInitializer:tP,BuildButton:tW,LLMServiceSelect:tQ,ModelSelect:tV,StatusTag:tJ,SpaceSelect:tR}),this.app.schemaSettingsManager.add(tF),this.app.use(tN),this.app.pluginSettingsManager.add("ai-build-guide",{icon:"ReadOutlined",title:'{{t("Build Guide Block", { ns: "'.concat(tB,'" })}}'),Component:y,aclSnippet:"pm.ai-build-guide"}),e={title:'{{t("User Guide", { ns: "'.concat(tB,'" })}}'),Component:"UserGuideBlockInitializer"},this.app.schemaInitializerManager.addItem("page:addBlock","otherBlocks.aiUserGuide",e),this.app.schemaInitializerManager.addItem("popup:common:addBlock","otherBlocks.aiUserGuide",e),this.app.schemaInitializerManager.addItem("popup:addNew:addBlock","otherBlocks.aiUserGuide",e),this.flowEngine.registerModels({UserGuideBlockModel:tL}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function l(e){t0(o,r,i,l,a,"next",e)}function a(e){t0(o,r,i,l,a,"throw",e)}l(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(t4(t.Plugin))}(),m}()});