1
2
|
"use strict";(self.webpackChunknextcloud=self.webpackChunknextcloud||[]).push([[9697],{2837:(e,t,n)=>{n.d(t,{N:()=>L,a:()=>A,b:()=>D,c:()=>M,d:()=>$,e:()=>de,f:()=>me,g:()=>ge,h:()=>se,s:()=>N}),n(7861);var r=n(58322),i=n(51431),o=n(83653),s=n(65043),c=n(32981),l=n(63814),a=n(32190),u=n(26517),d=n(28851),f=n(13073),h=n(85471),p=n(40173),m=n(43921),g=n(97012),v=n(59892),k=n(4266),b=n(47296),y=n(69496),x=n(61338),C=n(83427),w=n(89916);(0,o.r)(o.V);const _={name:"NcReferenceWidget",components:{NcButton:g.A},props:{reference:{type:Object,required:!0},interactive:{type:Boolean,default:!0},interactiveOptIn:{type:Boolean,default:!1}},setup(){const e=(0,h.KR)(!1),t=(0,h.KR)(),{width:n}=(0,f.Lhy)(t);return(0,f.BLq)(t,(([t])=>{(0,h.dY)((()=>{e.value=t.isIntersecting}))})),{width:n,isVisible:e,widgetRoot:t}},data:()=>({showInteractive:!1,rendered:!1,idleTimeout:null}),computed:{isInteractive(){return!this.interactiveOptIn&&this.interactive||this.showInteractive},hasFullWidth(){return(0,r.f)(this.reference.richObjectType)},hasCustomWidget(){return(0,r.i)(this.reference.richObjectType)},hasInteractiveView(){return(0,r.i)(this.reference.richObjectType)&&(0,r.h)(this.reference.richObjectType)},noAccess(){return this.reference&&!this.reference.accessible},descriptionStyle(){if(0===this.numberOfLines)return{display:"none"};const e=this.numberOfLines;return{lineClamp:e,webkitLineClamp:e}},numberOfLines(){return[450,550,650,1/0].findIndex((e=>this.width<e))},compactLink(){const e=this.reference.openGraphObject.link;return e?e.startsWith("https://")?e.substring(8):e.startsWith("http://")?e.substring(7):e:""},route(){return(0,m.g)(this.$router,this.reference.openGraphObject.link)},referenceWidgetLinkComponent(){return this.route?p.Wk:"a"},referenceWidgetLinkProps(){return this.route?{to:this.route}:{href:this.reference.openGraphObject.link,target:"_blank"}}},watch:{isVisible:{handler(e){e?(this.idleTimeout&&(clearTimeout(this.idleTimeout),this.idleTimeout=null),this.rendered||this.renderWidget()):this.idleTimeout=setTimeout((()=>{this.isVisible||this.destroyWidget()}),18e4)},immediate:!0}},beforeDestroy(){this.destroyWidget()},methods:{t:o.a,enableInteractive(){this.showInteractive=!0,this.renderWidget()},renderWidget(){if(!this.$refs.customWidget)return;if("open-graph"===this?.reference?.richObjectType)return;this.$refs.customWidget.innerHTML="";const e=document.createElement("div");e.style="width: 100%;",this.$refs.customWidget.appendChild(e),this.$nextTick((()=>{(0,r.a)(e,{...this.reference,interactive:this.isInteractive}),this.rendered=!0}))},destroyWidget(){this.rendered&&((0,r.e)(this.reference.richObjectType,this.$el),this.rendered=!1)}}};var S=function(){var e=this,t=e._self._c;return t("div",{ref:"widgetRoot",class:{"toggle-interactive":e.hasInteractiveView&&!e.isInteractive}},[e.reference&&e.hasCustomWidget?t("div",{ref:"customWidget",staticClass:"widget-custom",class:{"full-width":e.hasFullWidth}}):!e.noAccess&&e.reference&&e.reference.openGraphObject&&!e.hasCustomWidget?t(e.referenceWidgetLinkComponent,e._b({tag:"component",staticClass:"widget-default",attrs:{rel:"noopener noreferrer"}},"component",e.referenceWidgetLinkProps,!1),[e.reference.openGraphObject.thumb?t("img",{staticClass:"widget-default--image",attrs:{src:e.reference.openGraphObject.thumb}}):e._e(),t("div",{staticClass:"widget-default--details"},[t("p",{staticClass:"widget-default--name"},[e._v(" "+e._s(e.reference.openGraphObject.name)+" ")]),t("p",{staticClass:"widget-default--description",style:e.descriptionStyle},[e._v(" "+e._s(e.reference.openGraphObject.description)+" ")]),t("p",{staticClass:"widget-default--link"},[e._v(" "+e._s(e.compactLink)+" ")])])]):e._e(),e.interactiveOptIn&&e.hasInteractiveView&&!e.isInteractive?t("NcButton",{staticClass:"toggle-interactive--button",on:{click:e.enableInteractive}},[e._v(" "+e._s(e.t("Enable interactive view"))+" ")]):e._e()],1)},P=[];const L=(0,i.n)(_,S,P,!1,null,"734d6ae9").exports,I={name:"NcCustomPickerElement",props:{provider:{type:Object,required:!0}},emits:["cancel","submit"],data(){return{isRegistered:(0,r.d)(this.provider.id),renderResult:null}},mounted(){this.isRegistered&&this.renderElement()},beforeDestroy(){this.isRegistered&&(0,r.g)(this.provider.id,this.$el,this.renderResult)},methods:{renderElement(){this.$refs.domElement&&(this.$refs.domElement.innerHTML="");const e=(0,r.c)(this.$refs.domElement,{providerId:this.provider.id,accessible:!1});Promise.resolve(e).then((e=>{this.renderResult=e,this.renderResult.object?._isVue&&this.renderResult.object?.$on&&(this.renderResult.object.$on("submit",this.onSubmit),this.renderResult.object.$on("cancel",this.onCancel)),this.renderResult.element.addEventListener("submit",(e=>{this.onSubmit(e.detail)})),this.renderResult.element.addEventListener("cancel",this.onCancel)}))},onSubmit(e){this.$emit("submit",e)},onCancel(){this.$emit("cancel")}}};var R=function(){return(0,this._self._c)("div",{ref:"domElement"})},O=[];const E=(0,i.n)(I,R,O,!1,null,"de9850e4").exports;(0,o.r)(o.W);const A="any-link",T={id:A,title:(0,o.a)("Any link"),icon_url:(0,l.d0)("core","filetypes/link.svg")};function D(e){return e===A?T:M().find((t=>t.id===e))}function M(){return window._vue_richtext_reference_providers.filter((e=>{const t=!!e.search_providers_ids&&e.search_providers_ids.length>0||(0,r.d)(e.id);return t||console.debug("[smart picker]",e.id,"reference provider is discoverable but does not have any related search provider or custom picker component registered"),t}))}function N(e){const t=window._vue_richtext_reference_provider_timestamps;return e.sort(((e,t)=>e.order===t.order?0:e.order>t.order?1:-1)).sort(((e,n)=>{const r=t[e.id],i=t[n.id];return r===i?0:void 0===i?-1:void 0===r?1:r>i?-1:1}))}function $(e,t=null){const n=M(),r=e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&"),i=new RegExp(r,"i"),o=N(n).filter((e=>e.title.match(i))),s=t?o.slice(0,t):o;return""!==e&&0!==s.length||s.push(T),s}window._vue_richtext_reference_providers||(window._vue_richtext_reference_providers=(0,c.C)("core","reference-provider-list",[])),window._vue_richtext_reference_provider_timestamps||(window._vue_richtext_reference_provider_timestamps=(0,c.C)("core","reference-provider-timestamps",{}));let F=0;function j(e,t){return function(){const n=this,r=arguments;clearTimeout(F),F=setTimeout((function(){e.apply(n,r)}),t)}}function B(e){try{return Boolean(new URL(e))}catch(e){return!1}}(0,o.r)(o.Y,o.X);const z={name:"LinkVariantIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}};var V=function(){var e=this,t=e._self._c;return t("span",e._b({staticClass:"material-design-icon link-variant-icon",attrs:{"aria-hidden":e.title?null:"true","aria-label":e.title,role:"img"},on:{click:function(t){return e.$emit("click",t)}}},"span",e.$attrs,!1),[t("svg",{staticClass:"material-design-icon__svg",attrs:{fill:e.fillColor,width:e.size,height:e.size,viewBox:"0 0 24 24"}},[t("path",{attrs:{d:"M10.59,13.41C11,13.8 11,14.44 10.59,14.83C10.2,15.22 9.56,15.22 9.17,14.83C7.22,12.88 7.22,9.71 9.17,7.76V7.76L12.71,4.22C14.66,2.27 17.83,2.27 19.78,4.22C21.73,6.17 21.73,9.34 19.78,11.29L18.29,12.78C18.3,11.96 18.17,11.14 17.89,10.36L18.36,9.88C19.54,8.71 19.54,6.81 18.36,5.64C17.19,4.46 15.29,4.46 14.12,5.64L10.59,9.17C9.41,10.34 9.41,12.24 10.59,13.41M13.41,9.17C13.8,8.78 14.44,8.78 14.83,9.17C16.78,11.12 16.78,14.29 14.83,16.24V16.24L11.29,19.78C9.34,21.73 6.17,21.73 4.22,19.78C2.27,17.83 2.27,14.66 4.22,12.71L5.71,11.22C5.7,12.04 5.83,12.86 6.11,13.65L5.64,14.12C4.46,15.29 4.46,17.19 5.64,18.36C6.81,19.54 8.71,19.54 9.88,18.36L13.41,14.83C14.59,13.66 14.59,11.76 13.41,10.59C13,10.2 13,9.56 13.41,9.17Z"}},[e.title?t("title",[e._v(e._s(e.title))]):e._e()])])])},W=[];const q=(0,i.n)(z,V,W,!1,null,null).exports,H={name:"NcProviderList",components:{NcSelect:d.N,NcHighlight:u.N,NcEmptyContent:a.A,LinkVariantIcon:q},emits:["select-provider","submit"],data:()=>({selectedProvider:null,query:"",multiselectPlaceholder:(0,o.a)("Select provider"),providerIconAlt:(0,o.a)("Provider icon")}),computed:{options(){const e=[];return""!==this.query&&B(this.query)&&e.push({id:this.query,title:this.query,isLink:!0}),e.push(...$(this.query)),e}},methods:{focus(){setTimeout((()=>{this.$refs["provider-select"]?.$el?.querySelector("#provider-select-input")?.focus()}),300)},onProviderSelected(e){null!==e&&(e.isLink?this.$emit("submit",e.title):this.$emit("select-provider",e),this.selectedProvider=null)},onSearch(e,t){this.query=e}}};var U=function(){var e=this,t=e._self._c;return t("div",{staticClass:"provider-list"},[t("NcSelect",{ref:"provider-select",staticClass:"provider-list--select",attrs:{"input-id":"provider-select-input",label:"title",placeholder:e.multiselectPlaceholder,options:e.options,"append-to-body":!1,"clear-search-on-select":!0,"clear-search-on-blur":()=>!1,filterable:!1},on:{search:e.onSearch,input:e.onProviderSelected},scopedSlots:e._u([{key:"option",fn:function(n){return[n.isLink?t("div",{staticClass:"provider"},[t("LinkVariantIcon",{staticClass:"link-icon",attrs:{size:20}}),t("span",[e._v(e._s(n.title))])],1):t("div",{staticClass:"provider"},[t("img",{staticClass:"provider-icon",attrs:{src:n.icon_url,alt:e.providerIconAlt}}),t("NcHighlight",{staticClass:"option-text",attrs:{search:e.query,text:n.title}})],1)]}}]),model:{value:e.selectedProvider,callback:function(t){e.selectedProvider=t},expression:"selectedProvider"}}),t("NcEmptyContent",{staticClass:"provider-list--empty-content",scopedSlots:e._u([{key:"icon",fn:function(){return[t("LinkVariantIcon")]},proxy:!0}])})],1)},G=[];const Q=(0,i.n)(H,U,G,!1,null,"f03ee0c9").exports;(0,o.r)(o.Z);const K={name:"NcRawLinkInput",components:{LinkVariantIcon:q,NcEmptyContent:a.A,NcLoadingIcon:v.A,NcReferenceWidget:L,NcTextField:k.N},props:{provider:{type:Object,required:!0}},emits:["submit"],data:()=>({inputValue:"",loading:!1,reference:null,abortController:null,inputPlaceholder:(0,o.a)("Enter link")}),computed:{isLinkValid(){return B(this.inputValue)}},methods:{focus(){this.$refs["url-input"].$el.getElementsByTagName("input")[0]?.focus()},onSubmit(e){const t=e.target.value;this.isLinkValid&&this.$emit("submit",t)},onClear(){this.inputValue="",this.reference=null},onInput(){this.reference=null,this.abortController&&this.abortController.abort(),this.isLinkValid&&j((()=>{this.updateReference()}),500)()},updateReference(){this.loading=!0,this.abortController=new AbortController,s.Ay.get((0,l.KT)("references/resolve",2)+"?reference="+encodeURIComponent(this.inputValue),{signal:this.abortController.signal}).then((e=>{this.reference=e.data.ocs.data.references[this.inputValue]})).catch((e=>{console.error(e)})).then((()=>{this.loading=!1}))}}};var Y=function(){var e=this,t=e._self._c;return t("div",{staticClass:"raw-link"},[t("div",{staticClass:"input-wrapper"},[t("NcTextField",{ref:"url-input",attrs:{value:e.inputValue,"show-trailing-button":""!==e.inputValue,label:e.inputPlaceholder},on:{"update:value":[function(t){e.inputValue=t},e.onInput],"trailing-button-click":e.onClear},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.onSubmit.apply(null,arguments)}}},[e.loading?t("NcLoadingIcon",{attrs:{size:16}}):t("LinkVariantIcon",{attrs:{size:16}})],1)],1),null!==e.reference?t("NcReferenceWidget",{staticClass:"reference-widget",attrs:{reference:e.reference}}):t("NcEmptyContent",{staticClass:"raw-link--empty-content",scopedSlots:e._u([{key:"icon",fn:function(){return[e.provider.icon_url?t("img",{staticClass:"provider-icon",attrs:{src:e.provider.icon_url}}):t("LinkVariantIcon")]},proxy:!0}])})],1)},Z=[];const J=(0,i.n)(K,Y,Z,!1,null,"3c1803b5").exports,X={name:"NcSearchResult",components:{NcHighlight:u.N},props:{entry:{type:Object,required:!0},query:{type:String,required:!0}}};var ee=function(){var e=this,t=e._self._c;return t("div",{staticClass:"result"},[e.entry.icon?t("div",{staticClass:"result--icon-class",class:{[e.entry.icon]:!0,rounded:e.entry.rounded}}):t("img",{staticClass:"result--image",class:{rounded:e.entry.rounded},attrs:{src:e.entry.thumbnailUrl}}),t("div",{staticClass:"result--content"},[t("span",{staticClass:"result--content--name"},[t("NcHighlight",{attrs:{search:e.query,text:e.entry.title}})],1),t("span",{staticClass:"result--content--subline"},[t("NcHighlight",{attrs:{search:e.query,text:e.entry.subline}})],1)])])},te=[];const ne=(0,i.n)(X,ee,te,!1,null,"ff4bcbf3").exports;(0,o.r)(o._,o.Y,o.B);const re={name:"NcSearch",components:{LinkVariantIcon:q,DotsHorizontalIcon:b.D,NcEmptyContent:a.A,NcSelect:d.N,NcSearchResult:ne},props:{provider:{type:Object,required:!0},showEmptyContent:{type:Boolean,default:!0},searchPlaceholder:{type:String,default:null}},emits:["submit"],data:()=>({searchQuery:"",selectedResult:null,resultsBySearchProvider:{},searching:!1,searchingMoreOf:null,abortController:null,noOptionsText:(0,o.a)("Start typing to search"),providerIconAlt:(0,o.a)("Provider icon")}),computed:{mySearchPlaceholder(){return this.searchPlaceholder||(0,o.a)("Search")},searchProviderIds(){return this.provider.search_providers_ids},options(){if(""===this.searchQuery)return[];const e=[];return B(this.searchQuery)&&e.push(this.rawLinkEntry),e.push(...this.formattedSearchResults),e},rawLinkEntry(){return{id:"rawLinkEntry",resourceUrl:this.searchQuery,isRawLink:!0}},formattedSearchResults(){const e=[];return this.searchProviderIds.forEach((t=>{if(this.resultsBySearchProvider[t].entries.length>0){(this.searchProviderIds.length>1||this.resultsBySearchProvider[t].entries.length>1)&&e.push({id:"groupTitle-"+t,name:this.resultsBySearchProvider[t].name,isCustomGroupTitle:!0,providerId:t});const n=this.resultsBySearchProvider[t].entries.map(((e,n)=>({id:"provider-"+t+"-entry-"+n,...e})));e.push(...n),this.resultsBySearchProvider[t].isPaginated&&e.push({id:"moreOf-"+t,name:this.resultsBySearchProvider[t].name,isMore:!0,providerId:t,isLoading:this.searchingMoreOf===t})}})),e}},mounted(){this.resetResults()},beforeDestroy(){this.cancelSearchRequests()},methods:{t:o.a,resetResults(){const e={};this.searchProviderIds.forEach((t=>{e[t]={entries:[]}})),this.resultsBySearchProvider=e},focus(){setTimeout((()=>{this.$refs["search-select"]?.$el?.querySelector("#search-select-input")?.focus()}),300)},cancelSearchRequests(){this.abortController&&this.abortController.abort()},onSearchInput(e,t){this.searchQuery=e,j((()=>{this.updateSearch()}),500)()},onSelectResultSelected(e){null!==e&&(e.resourceUrl?(this.cancelSearchRequests(),this.$emit("submit",e.resourceUrl)):e.isMore&&this.searchMoreOf(e.providerId).then((()=>{this.selectedResult=null})))},searchMoreOf(e){return this.searchingMoreOf=e,this.cancelSearchRequests(),this.searchProviders(e)},updateSearch(){if(this.cancelSearchRequests(),this.resetResults(),""!==this.searchQuery)return this.searchProviders();this.searching=!1},searchProviders(e=null){this.abortController=new AbortController,this.searching=!0;const t=null===e?[...this.searchProviderIds].map((e=>this.searchOneProvider(e))):[this.searchOneProvider(e,this.resultsBySearchProvider[e]?.cursor??null)];return Promise.allSettled(t).then((e=>{e.find((e=>"rejected"===e.status&&("CanceledError"===e.reason.name||"ERR_CANCELED"===e.reason.code)))||(this.searching=!1,this.searchingMoreOf=null)}))},searchOneProvider(e,t=null){const n=null===t?(0,l.KT)("search/providers/{providerId}/search?term={term}&limit={limit}",{providerId:e,term:this.searchQuery,limit:5}):(0,l.KT)("search/providers/{providerId}/search?term={term}&limit={limit}&cursor={cursor}",{providerId:e,term:this.searchQuery,limit:5,cursor:t});return s.Ay.get(n,{signal:this.abortController.signal}).then((t=>{const n=t.data.ocs.data;this.resultsBySearchProvider[e].name=n.name,this.resultsBySearchProvider[e].cursor=n.cursor,this.resultsBySearchProvider[e].isPaginated=n.isPaginated,this.resultsBySearchProvider[e].entries.push(...n.entries)}))}}};var ie=function(){var e=this,t=e._self._c;return t("div",{staticClass:"smart-picker-search",class:{"with-empty-content":e.showEmptyContent}},[t("NcSelect",{ref:"search-select",staticClass:"smart-picker-search--select",attrs:{"input-id":"search-select-input",label:"name",placeholder:e.mySearchPlaceholder,options:e.options,"append-to-body":!1,"close-on-select":!1,"clear-search-on-select":!1,"clear-search-on-blur":()=>!1,"reset-focus-on-options-change":!1,filterable:!1,autoscroll:!0,"reset-on-options-change":!1,loading:e.searching},on:{search:e.onSearchInput,input:e.onSelectResultSelected},scopedSlots:e._u([{key:"option",fn:function(n){return[n.isRawLink?t("div",{staticClass:"custom-option"},[t("LinkVariantIcon",{staticClass:"option-simple-icon",attrs:{size:20}}),t("span",{staticClass:"option-text"},[e._v(" "+e._s(e.t("Raw link {options}",{options:n.resourceUrl}))+" ")])],1):n.resourceUrl?t("NcSearchResult",{staticClass:"search-result",attrs:{entry:n,query:e.searchQuery}}):n.isCustomGroupTitle?t("span",{staticClass:"custom-option group-name"},[e.provider.icon_url?t("img",{staticClass:"provider-icon group-name-icon",attrs:{src:e.provider.icon_url}}):e._e(),t("span",{staticClass:"option-text"},[t("strong",[e._v(e._s(n.name))])])]):n.isMore?t("span",{class:{"custom-option":!0}},[n.isLoading?t("span",{staticClass:"option-simple-icon icon-loading-small"}):t("DotsHorizontalIcon",{staticClass:"option-simple-icon",attrs:{size:20}}),t("span",{staticClass:"option-text"},[e._v(" "+e._s(e.t('Load more "{options}"',{options:n.name}))+" ")])],1):e._e()]}},{key:"no-options",fn:function(){return[e._v(" "+e._s(e.noOptionsText)+" ")]},proxy:!0}]),model:{value:e.selectedResult,callback:function(t){e.selectedResult=t},expression:"selectedResult"}}),e.showEmptyContent?t("NcEmptyContent",{staticClass:"smart-picker-search--empty-content",scopedSlots:e._u([{key:"icon",fn:function(){return[e.provider.icon_url?t("img",{staticClass:"provider-icon",attrs:{alt:e.providerIconAlt,src:e.provider.icon_url}}):t("LinkVariantIcon")]},proxy:!0}],null,!1,2922132592)}):e._e()],1)},oe=[];const se=(0,i.n)(re,ie,oe,!1,null,"05fef988").exports,ce={providerList:1,standardLinkInput:2,searchInput:3,customElement:4},le={name:"NcReferencePicker",components:{NcCustomPickerElement:E,NcProviderList:Q,NcRawLinkInput:J,NcSearch:se},props:{initialProvider:{type:Object,default:()=>null},width:{type:Number,default:null},focusOnCreate:{type:Boolean,default:!0}},emits:["cancel","cancel-raw-link","cancel-search","provider-selected","submit"],data(){return{MODES:ce,selectedProvider:this.initialProvider}},computed:{mode(){return null===this.selectedProvider?ce.providerList:(0,r.d)(this.selectedProvider.id)?ce.customElement:this.selectedProvider.search_providers_ids?ce.searchInput:ce.standardLinkInput},pickerWrapperStyle(){return{width:this.width?this.width+"px":void 0}}},mounted(){this.focusOnCreate&&(this.initialProvider?setTimeout((()=>{this.$refs["url-input"]?.focus()}),300):this.$nextTick((()=>{this.$refs["provider-list"]?.focus()})))},methods:{onEscapePressed(){null!==this.selectedProvider?this.deselectProvider():this.cancelProviderSelection()},onProviderSelected(e){this.selectedProvider=e,this.$emit("provider-selected",e),this.$nextTick((()=>{this.$refs["url-input"]?.focus()}))},cancelCustomElement(){this.deselectProvider()},cancelSearch(){this.$emit("cancel-search",this.selectedProvider?.title),this.deselectProvider()},cancelRawLinkInput(){this.$emit("cancel-raw-link",this.selectedProvider?.title),this.deselectProvider()},cancelProviderSelection(){this.$emit("cancel")},submitLink(e){null!==this.selectedProvider&&function(e){const t=Math.floor(Date.now()/1e3),n={timestamp:t},r=(0,l.KT)("references/provider/{providerId}",{providerId:e});s.Ay.put(r,n).then((n=>{window._vue_richtext_reference_provider_timestamps[e]=t}))}(this.selectedProvider.id),this.$emit("submit",e),this.deselectProvider()},deselectProvider(){this.selectedProvider=null,this.$emit("provider-selected",null),setTimeout((()=>{this.$refs["provider-list"]?.focus()}),300)}}};var ae=function(){var e=this,t=e._self._c;return t("div",{staticClass:"reference-picker",style:e.pickerWrapperStyle,attrs:{tabindex:"-1"},on:{keydown:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"esc",27,t.key,["Esc","Escape"])?null:(t.stopPropagation(),t.preventDefault(),e.onEscapePressed.apply(null,arguments))}}},[e.mode===e.MODES.providerList?t("NcProviderList",{ref:"provider-list",on:{"select-provider":e.onProviderSelected,submit:e.submitLink,cancel:e.cancelProviderSelection}}):e.mode===e.MODES.standardLinkInput?t("NcRawLinkInput",{ref:"url-input",attrs:{provider:e.selectedProvider},on:{submit:e.submitLink,cancel:e.cancelRawLinkInput}}):e.mode===e.MODES.searchInput?t("NcSearch",{ref:"url-input",attrs:{provider:e.selectedProvider},on:{cancel:e.cancelSearch,submit:e.submitLink}}):e.mode===e.MODES.customElement?t("div",{staticClass:"custom-element-wrapper"},[t("NcCustomPickerElement",{staticClass:"custom-element",attrs:{provider:e.selectedProvider},on:{submit:e.submitLink,cancel:e.cancelCustomElement}})],1):e._e()],1)},ue=[];const de=(0,i.n)(le,ae,ue,!1,null,"cd33df8e").exports;(0,o.r)(o.$,o.n);const fe={name:"NcReferencePickerModal",components:{NcReferencePicker:de,NcModal:y.A,NcButton:g.A,ArrowLeftIcon:C.A,CloseIcon:w.C},props:{initialProvider:{type:Object,default:()=>null},focusOnCreate:{type:Boolean,default:!0},isInsideViewer:{type:Boolean,default:!1}},emits:["cancel","submit"],data(){return{show:!0,selectedProvider:this.initialProvider,backButtonTitle:(0,o.a)("Back to provider selection"),closeButtonTitle:(0,o.a)("Close"),closeButtonLabel:(0,o.a)("Close Smart Picker")}},computed:{isProviderSelected(){return null!==this.selectedProvider},showBackButton(){return null===this.initialProvider&&this.isProviderSelected},modalSize(){return this.isProviderSelected&&(0,r.d)(this.selectedProvider.id)?(0,r.j)(this.selectedProvider.id)??"large":"normal"},showModalName(){return!this.isProviderSelected||!(0,r.d)(this.selectedProvider.id)},modalName(){return this.isProviderSelected?this.selectedProvider.title:(0,o.a)("Smart Picker")}},mounted(){if(this.isInsideViewer){const e=this.$refs.modal_content;(0,x.Ic)("viewer:trapElements:changed",e)}},methods:{onCancel(){this.show=!1,this.$emit("cancel")},onSubmit(e){this.show=!1,this.$emit("submit",e)},onProviderSelect(e){this.selectedProvider=e,null===e&&null!==this.initialProvider&&this.onCancel()},onBackClicked(){this.$refs.referencePicker.deselectProvider()}}};var he=function(){var e=this,t=e._self._c;return e.show?t("NcModal",{staticClass:"reference-picker-modal",attrs:{size:e.modalSize,"can-close":!0},on:{close:e.onCancel}},[t("div",{ref:"modal_content",staticClass:"reference-picker-modal--content"},[e.showBackButton?t("NcButton",{staticClass:"back-button",attrs:{"aria-label":e.backButtonTitle,title:e.backButtonTitle},on:{click:e.onBackClicked},scopedSlots:e._u([{key:"icon",fn:function(){return[t("ArrowLeftIcon")]},proxy:!0}],null,!1,3001860362)}):e._e(),t("NcButton",{staticClass:"close-button",attrs:{"aria-label":e.closeButtonLabel,title:e.closeButtonTitle,variant:"tertiary"},on:{click:e.onCancel},scopedSlots:e._u([{key:"icon",fn:function(){return[t("CloseIcon")]},proxy:!0}],null,!1,2491825086)}),e.showModalName?t("h2",[e._v(" "+e._s(e.modalName)+" ")]):e._e(),t("NcReferencePicker",{ref:"referencePicker",attrs:{"initial-provider":e.initialProvider,"focus-on-create":e.focusOnCreate},on:{"provider-selected":e.onProviderSelect,submit:e.onSubmit,cancel:e.onCancel}})],1)]):e._e()},pe=[];const me=(0,i.n)(fe,he,pe,!1,null,"c66449c1").exports;async function ge(e=null,t=void 0){return await new Promise(((n,r)=>{const i=document.createElement("div");i.id="referencePickerModal",document.body.append(i);const o=null===e?null:D(e)??null,s=new(h.Ay.extend(me))({propsData:{initialProvider:o,isInsideViewer:t}}).$mount(i);s.$on("cancel",(()=>{s.$destroy(),r(new Error("User cancellation"))})),s.$on("submit",(e=>{s.$destroy(),n(e)}))}))}},19697:(e,t,n)=>{n.d(t,{N:()=>Qt,a:()=>L}),n(60441);var r=n(85471),i=n(2837),o=n(43921),s=n(65043),c=n(82680),l=n(21777),a=n(63814),u=n(51431),d=n(95898),f=n(47970),h=n(64546),p=n(33239),m=n(86241),g=n(8019),v=n(87798),k=n(76643),b=n(3288),y=n(19998),x=n(86435),C=n(43819),w=n(40173);const _={name:"NcReferenceList",components:{NcReferenceWidget:i.N},props:{text:{type:String,default:""},referenceData:{type:Array,default:null},limit:{type:Number,default:1},displayFallback:{type:Boolean,default:!1},interactive:{type:Boolean,default:!0},interactiveOptIn:{type:Boolean,default:!1}},data:()=>({references:null,loading:!0}),computed:{isVisible(){return this.loading||0!==this.displayedReferences.length},values(){return this.referenceData?this.referenceData:!this.displayFallback||this.loading||this.references?this.references?Object.values(this.references):[]:[this.fallbackReference]},firstReference(){return this.values[0]??null},displayedReferences(){return this.values.slice(0,this.limit)},fallbackReference(){return{accessible:!0,openGraphObject:{id:this.text,link:this.text,name:this.text},richObjectType:"open-graph"}}},watch:{text:"fetch"},mounted(){this.fetch()},methods:{fetch(){return this.loading=!0,this.referenceData?(this.references=null,void(this.loading=!1)):new RegExp(o.U).exec(this.text)?void this.resolve().then((e=>{this.references=e.data.ocs.data.references,this.loading=!1,this.$emit("loaded")})).catch((e=>{console.error("Failed to extract references",e),this.loading=!1,this.$emit("loaded")})):(this.references=null,void(this.loading=!1))},resolve(){const e=new RegExp(o.U).exec(this.text.trim()),t=null===(0,l.HW)();return 1===this.limit&&e?t?s.Ay.get((0,a.KT)("references/resolvePublic")+`?reference=${encodeURIComponent(e[0])}&sharingToken=${(0,c.G)()}`):s.Ay.get((0,a.KT)("references/resolve")+`?reference=${encodeURIComponent(e[0])}`):t?s.Ay.post((0,a.KT)("references/extractPublic"),{text:this.text,resolve:!0,limit:this.limit,sharingToken:(0,c.G)()}):s.Ay.post((0,a.KT)("references/extract"),{text:this.text,resolve:!0,limit:this.limit})}}};var S=function(){var e=this,t=e._self._c;return e.isVisible?t("div",{staticClass:"widgets--list",class:{"icon-loading":e.loading}},e._l(e.displayedReferences,(function(n){return t("NcReferenceWidget",{key:n?.openGraphObject?.id,attrs:{reference:n,interactive:e.interactive,"interactive-opt-in":e.interactiveOptIn}})})),1):e._e()},P=[];const L=(0,u.n)(_,S,P,!1,null,"ffdba753").exports,I=function(){return function(e){(0,f.YR)(e,(e=>"text"===e.type),(function(e,t,n){const r=e.value.split(/(\{[a-z\-_.0-9]+\})/gi).map(((e,t,n)=>{const r=e.match(/^\{([a-z\-_.0-9]+)\}$/i);if(!r)return(0,p.u)("text",e);const[,i]=r;return(0,p.u)("element",{tagName:`#${i}`})}));n.children.splice(t,1,...r)}))}},R=function(){return function(e){(0,f.YR)(e,(e=>["text","code","inlineCode"].includes(e.type)),((e,t,n)=>(n.children.splice(t,1,{...e,value:e.value.replace(/</gim,"<").replace(/>/gim,">")}),[h._Z,t+1])))}};function O(e,t){const n=String(e);if("string"!=typeof t)throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;-1!==i;)r++,i=n.indexOf(t,i+t.length);return r}const E=F(/[A-Za-z]/),A=F(/[\dA-Za-z]/);function T(e){return null!==e&&e<-2}function D(e){return null!==e&&(e<0||32===e)}function M(e){return-2===e||-1===e||32===e}const N=F(new RegExp("\\p{P}|\\p{S}","u")),$=F(/\s/);function F(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}const j=function(e){if(null==e)return z;if("function"==typeof e)return B(e);if("object"==typeof e)return Array.isArray(e)?function(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=j(e[n]);return B((function(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}))}(e):function(e){const t=e;return B((function(n){const r=n;let i;for(i in e)if(r[i]!==t[i])return!1;return!0}))}(e);if("string"==typeof e)return t=e,B((function(e){return e&&e.type===t}));var t;throw new Error("Expected function, string, or object as test")};function B(e){return function(t,n,r){return Boolean(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof n?n:void 0,r||void 0))}}function z(){return!0}const V=[],W=!0,q=!1,H="skip";function U(e,t,n,r){let i;i=t;const o=j(i);!function e(t,r,i){const s=t&&"object"==typeof t?t:{};if("string"==typeof s.type){const e="string"==typeof s.tagName?s.tagName:"string"==typeof s.name?s.name:void 0;Object.defineProperty(c,"name",{value:"node ("+t.type+(e?"<"+e+">":"")+")"})}return c;function c(){let s,c,l,a=V;if(o(t,r,i[i.length-1]||void 0)&&(a=function(e){return Array.isArray(e)?e:"number"==typeof e?[W,e]:null==e?V:[e]}(n(t,i)),a[0]===q))return a;if("children"in t&&t.children){const n=t;if(n.children&&a[0]!==H)for(c=0,l=i.concat(n);c>-1&&c<n.children.length;){const t=n.children[c];if(s=e(t,c,l)(),s[0]===q)return s;c="number"==typeof s[1]?s[1]:c+1}}return a}}(e,void 0,[])()}function G(e){return"function"==typeof e?e:function(){return e}}const Q="phrasing",K=["autolink","link","image","label"];function Y(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Z(e){this.config.enter.autolinkProtocol.call(this,e)}function J(e){this.config.exit.autolinkProtocol.call(this,e)}function X(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function ee(e){this.config.exit.autolinkEmail.call(this,e)}function te(e){this.exit(e)}function ne(e){!function(e,t,n){const r=j((n||{}).ignore||[]),i=function(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const e=n[r];t.push([(i=e[0],"string"==typeof i?new RegExp(function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(i),"g"):i),G(e[1])])}var i;return t}(t);let o=-1;for(;++o<i.length;)U(e,"text",s);function s(e,t){let n,s=-1;for(;++s<t.length;){const e=t[s],i=n?n.children:void 0;if(r(e,i?i.indexOf(e):void 0,n))return;n=e}if(n)return function(e,t){const n=t[t.length-1],r=i[o][0],s=i[o][1];let c=0;const l=n.children.indexOf(e);let a=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){const n=d.index,i={index:d.index,input:d.input,stack:[...t,e]};let o=s(...d,i);if("string"==typeof o&&(o=o.length>0?{type:"text",value:o}:void 0),!1===o?r.lastIndex=n+1:(c!==n&&u.push({type:"text",value:e.value.slice(c,n)}),Array.isArray(o)?u.push(...o):o&&u.push(o),c=n+d[0].length,a=!0),!r.global)break;d=r.exec(e.value)}return a?(c<e.value.length&&u.push({type:"text",value:e.value.slice(c)}),n.children.splice(l,1,...u)):u=[e],l+u.length}(e,t)}}(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,re],[/([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/g,ie]],{ignore:["link","linkReference"]})}function re(e,t,n,r,i){let o="";if(!oe(i))return!1;if(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!function(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}(n))return!1;const s=function(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=O(e,"(");let o=O(e,")");for(;-1!==r&&i>o;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[e,n]}(n+r);if(!s[0])return!1;const c={type:"link",title:null,url:o+t+s[0],children:[{type:"text",value:t+s[0]}]};return s[1]?[c,{type:"text",value:s[1]}]:c}function ie(e,t,n,r){return!(!oe(r,!0)||/[-\d_]$/.test(n))&&{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function oe(e,t){const n=e.input.charCodeAt(e.index-1);return(0===e.index||$(n)||N(n))&&(!t||47!==n)}function se(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}function ce(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function le(){this.buffer()}function ae(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.label=t,n.identifier=se(this.sliceSerialize(e)).toLowerCase()}function ue(e){this.exit(e)}function de(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function fe(){this.buffer()}function he(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.label=t,n.identifier=se(this.sliceSerialize(e)).toLowerCase()}function pe(e){this.exit(e)}function me(e,t,n,r){const i=n.createTracker(r);let o=i.move("[^");const s=n.enter("footnoteReference"),c=n.enter("reference");return o+=i.move(n.safe(n.associationId(e),{...i.current(),before:o,after:"]"})),c(),s(),o+=i.move("]"),o}function ge(e,t,n,r){const i=n.createTracker(r);let o=i.move("[^");const s=n.enter("footnoteDefinition"),c=n.enter("label");return o+=i.move(n.safe(n.associationId(e),{...i.current(),before:o,after:"]"})),c(),o+=i.move("]:"+(e.children&&e.children.length>0?" ":"")),i.shift(4),o+=i.move(n.indentLines(n.containerFlow(e,i.current()),ve)),s(),o}function ve(e,t,n){return 0===t?e:(n?"":" ")+e}me.peek=function(){return"["};const ke=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function be(e){this.enter({type:"delete",children:[]},e)}function ye(e){this.exit(e)}function xe(e,t,n,r){const i=n.createTracker(r),o=n.enter("strikethrough");let s=i.move("~~");return s+=n.containerPhrasing(e,{...i.current(),before:s,after:"~"}),s+=i.move("~~"),o(),s}function Ce(e){return e.length}function we(e){const t="string"==typeof e?e.codePointAt(0):0;return 67===t||99===t?99:76===t||108===t?108:82===t||114===t?114:0}function _e(e,t,n){return">"+(n?"":" ")+e}function Se(e,t,n){if("string"==typeof t&&(t=[t]),!t||0===t.length)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function Pe(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if("\n"===n.unsafe[i].character&&(Se(o=n.stack,(s=n.unsafe[i]).inConstruct,!0)&&!Se(o,s.notInConstruct,!1)))return/[ \t]/.test(r.before)?"":" ";var o,s;return"\\\n"}function Le(e,t,n){return(n?"":" ")+e}function Ie(e){const t=e.options.quote||'"';if('"'!==t&&"'"!==t)throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Re(e,t,n,r){const i=function(e){const t=e.options.emphasis||"*";if("*"!==t&&"_"!==t)throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}(n),o=n.enter("emphasis"),s=n.createTracker(r);let c=s.move(i);return c+=s.move(n.containerPhrasing(e,{before:c,after:i,...s.current()})),c+=s.move(i),o(),c}xe.peek=function(){return"~"},Re.peek=function(e,t,n){return n.options.emphasis||"*"};const Oe={};function Ee(e,t){const n=Oe;return Ae(e,"boolean"!=typeof n.includeImageAlt||n.includeImageAlt,"boolean"!=typeof n.includeHtml||n.includeHtml)}function Ae(e,t,n){if(function(e){return Boolean(e&&"object"==typeof e)}(e)){if("value"in e)return"html"!==e.type||n?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Te(e.children,t,n)}return Array.isArray(e)?Te(e,t,n):""}function Te(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=Ae(e[i],t,n);return r.join("")}function De(e){return e.value||""}function Me(e,t,n,r){const i=Ie(n),o='"'===i?"Quote":"Apostrophe",s=n.enter("image");let c=n.enter("label");const l=n.createTracker(r);let a=l.move("![");return a+=l.move(n.safe(e.alt,{before:a,after:"]",...l.current()})),a+=l.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),a+=l.move("<"),a+=l.move(n.safe(e.url,{before:a,after:">",...l.current()})),a+=l.move(">")):(c=n.enter("destinationRaw"),a+=l.move(n.safe(e.url,{before:a,after:e.title?" ":")",...l.current()}))),c(),e.title&&(c=n.enter(`title${o}`),a+=l.move(" "+i),a+=l.move(n.safe(e.title,{before:a,after:i,...l.current()})),a+=l.move(i),c()),a+=l.move(")"),s(),a}function Ne(e,t,n,r){const i=e.referenceType,o=n.enter("imageReference");let s=n.enter("label");const c=n.createTracker(r);let l=c.move("![");const a=n.safe(e.alt,{before:l,after:"]",...c.current()});l+=c.move(a+"]["),s();const u=n.stack;n.stack=[],s=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...c.current()});return s(),n.stack=u,o(),"full"!==i&&a&&a===d?"shortcut"===i?l=l.slice(0,-1):l+=c.move("]"):l+=c.move(d+"]"),l}function $e(e,t,n){let r=e.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){const e=n.unsafe[o],t=n.compilePattern(e);let i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;10===r.charCodeAt(e)&&13===r.charCodeAt(e-1)&&e--,r=r.slice(0,e)+" "+r.slice(i.index+1)}}return i+r+i}function Fe(e,t){const n=Ee(e);return Boolean(!t.options.resourceLink&&e.url&&!e.title&&e.children&&1===e.children.length&&"text"===e.children[0].type&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}function je(e,t,n,r){const i=Ie(n),o='"'===i?"Quote":"Apostrophe",s=n.createTracker(r);let c,l;if(Fe(e,n)){const t=n.stack;n.stack=[],c=n.enter("autolink");let r=s.move("<");return r+=s.move(n.containerPhrasing(e,{before:r,after:">",...s.current()})),r+=s.move(">"),c(),n.stack=t,r}c=n.enter("link"),l=n.enter("label");let a=s.move("[");return a+=s.move(n.containerPhrasing(e,{before:a,after:"](",...s.current()})),a+=s.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),a+=s.move("<"),a+=s.move(n.safe(e.url,{before:a,after:">",...s.current()})),a+=s.move(">")):(l=n.enter("destinationRaw"),a+=s.move(n.safe(e.url,{before:a,after:e.title?" ":")",...s.current()}))),l(),e.title&&(l=n.enter(`title${o}`),a+=s.move(" "+i),a+=s.move(n.safe(e.title,{before:a,after:i,...s.current()})),a+=s.move(i),l()),a+=s.move(")"),c(),a}function Be(e,t,n,r){const i=e.referenceType,o=n.enter("linkReference");let s=n.enter("label");const c=n.createTracker(r);let l=c.move("[");const a=n.containerPhrasing(e,{before:l,after:"]",...c.current()});l+=c.move(a+"]["),s();const u=n.stack;n.stack=[],s=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...c.current()});return s(),n.stack=u,o(),"full"!==i&&a&&a===d?"shortcut"===i?l=l.slice(0,-1):l+=c.move("]"):l+=c.move(d+"]"),l}function ze(e){const t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Ve(e){const t=e.options.rule||"*";if("*"!==t&&"-"!==t&&"_"!==t)throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}De.peek=function(){return"<"},Me.peek=function(){return"!"},Ne.peek=function(){return"!"},$e.peek=function(){return"`"},je.peek=function(e,t,n){return Fe(e,n)?"<":"["},Be.peek=function(){return"["};const We=j(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function qe(e,t,n,r){const i=function(e){const t=e.options.strong||"*";if("*"!==t&&"_"!==t)throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}(n),o=n.enter("strong"),s=n.createTracker(r);let c=s.move(i+i);return c+=s.move(n.containerPhrasing(e,{before:c,after:i,...s.current()})),c+=s.move(i+i),o(),c}qe.peek=function(e,t,n){return n.options.strong||"*"};const He={blockquote:function(e,t,n,r){const i=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);const s=n.indentLines(n.containerFlow(e,o.current()),_e);return i(),s},break:Pe,code:function(e,t,n,r){const i=function(e){const t=e.options.fence||"`";if("`"!==t&&"~"!==t)throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}(n),o=e.value||"",s="`"===i?"GraveAccent":"Tilde";if(function(e,t){return Boolean(!1===t.options.fences&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}(e,n)){const e=n.enter("codeIndented"),t=n.indentLines(o,Le);return e(),t}const c=n.createTracker(r),l=i.repeat(Math.max(function(e,t){const n=String(e);let r=n.indexOf(t),i=r,o=0,s=0;if("string"!=typeof t)throw new TypeError("Expected substring");for(;-1!==r;)r===i?++o>s&&(s=o):o=1,i=r+t.length,r=n.indexOf(t,i);return s}(o,i)+1,3)),a=n.enter("codeFenced");let u=c.move(l);if(e.lang){const t=n.enter(`codeFencedLang${s}`);u+=c.move(n.safe(e.lang,{before:u,after:" ",encode:["`"],...c.current()})),t()}if(e.lang&&e.meta){const t=n.enter(`codeFencedMeta${s}`);u+=c.move(" "),u+=c.move(n.safe(e.meta,{before:u,after:"\n",encode:["`"],...c.current()})),t()}return u+=c.move("\n"),o&&(u+=c.move(o+"\n")),u+=c.move(l),a(),u},definition:function(e,t,n,r){const i=Ie(n),o='"'===i?"Quote":"Apostrophe",s=n.enter("definition");let c=n.enter("label");const l=n.createTracker(r);let a=l.move("[");return a+=l.move(n.safe(n.associationId(e),{before:a,after:"]",...l.current()})),a+=l.move("]: "),c(),!e.url||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),a+=l.move("<"),a+=l.move(n.safe(e.url,{before:a,after:">",...l.current()})),a+=l.move(">")):(c=n.enter("destinationRaw"),a+=l.move(n.safe(e.url,{before:a,after:e.title?" ":"\n",...l.current()}))),c(),e.title&&(c=n.enter(`title${o}`),a+=l.move(" "+i),a+=l.move(n.safe(e.title,{before:a,after:i,...l.current()})),a+=l.move(i),c()),s(),a},emphasis:Re,hardBreak:Pe,heading:function(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(r);if(function(e,t){let n=!1;return(0,f.YR)(e,(function(e){if("value"in e&&/\r?\n|\r/.test(e.value)||"break"===e.type)return n=!0,h.dc})),Boolean((!e.depth||e.depth<3)&&Ee(e)&&(t.options.setext||n))}(e,n)){const t=n.enter("headingSetext"),r=n.enter("phrasing"),s=n.containerPhrasing(e,{...o.current(),before:"\n",after:"\n"});return r(),t(),s+"\n"+(1===i?"=":"-").repeat(s.length-(Math.max(s.lastIndexOf("\r"),s.lastIndexOf("\n"))+1))}const s="#".repeat(i),c=n.enter("headingAtx"),l=n.enter("phrasing");o.move(s+" ");let a=n.containerPhrasing(e,{before:"# ",after:"\n",...o.current()});return/^[\t ]/.test(a)&&(a="&#x"+a.charCodeAt(0).toString(16).toUpperCase()+";"+a.slice(1)),a=a?s+" "+a:s,n.options.closeAtx&&(a+=" "+s),l(),c(),a},html:De,image:Me,imageReference:Ne,inlineCode:$e,link:je,linkReference:Be,list:function(e,t,n,r){const i=n.enter("list"),o=n.bulletCurrent;let s=e.ordered?function(e){const t=e.options.bulletOrdered||".";if("."!==t&&")"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}(n):ze(n);const c=e.ordered?"."===s?")":".":function(e){const t=ze(e),n=e.options.bulletOther;if(!n)return"*"===t?"-":"*";if("*"!==n&&"+"!==n&&"-"!==n)throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}(n);let l=!(!t||!n.bulletLastUsed)&&s===n.bulletLastUsed;if(!e.ordered){const t=e.children?e.children[0]:void 0;if("*"!==s&&"-"!==s||!t||t.children&&t.children[0]||"list"!==n.stack[n.stack.length-1]||"listItem"!==n.stack[n.stack.length-2]||"list"!==n.stack[n.stack.length-3]||"listItem"!==n.stack[n.stack.length-4]||0!==n.indexStack[n.indexStack.length-1]||0!==n.indexStack[n.indexStack.length-2]||0!==n.indexStack[n.indexStack.length-3]||(l=!0),Ve(n)===s&&t){let t=-1;for(;++t<e.children.length;){const n=e.children[t];if(n&&"listItem"===n.type&&n.children&&n.children[0]&&"thematicBreak"===n.children[0].type){l=!0;break}}}}l&&(s=c),n.bulletCurrent=s;const a=n.containerFlow(e,r);return n.bulletLastUsed=s,n.bulletCurrent=o,i(),a},listItem:function(e,t,n,r){const i=function(e){const t=e.options.listItemIndent||"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(n);let o=n.bulletCurrent||ze(n);t&&"list"===t.type&&t.ordered&&(o=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===n.options.incrementListMarker?0:t.children.indexOf(e))+o);let s=o.length+1;("tab"===i||"mixed"===i&&(t&&"list"===t.type&&t.spread||e.spread))&&(s=4*Math.ceil(s/4));const c=n.createTracker(r);c.move(o+" ".repeat(s-o.length)),c.shift(s);const l=n.enter("listItem"),a=n.indentLines(n.containerFlow(e,c.current()),(function(e,t,n){return t?(n?"":" ".repeat(s))+e:(n?o:o+" ".repeat(s-o.length))+e}));return l(),a},paragraph:function(e,t,n,r){const i=n.enter("paragraph"),o=n.enter("phrasing"),s=n.containerPhrasing(e,r);return o(),i(),s},root:function(e,t,n,r){return(e.children.some((function(e){return We(e)}))?n.containerPhrasing:n.containerFlow).call(n,e,r)},strong:qe,text:function(e,t,n,r){return n.safe(e.value,r)},thematicBreak:function(e,t,n){const r=(Ve(n)+(n.options.ruleSpaces?" ":"")).repeat(function(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}(n));return n.options.ruleSpaces?r.slice(0,-1):r}};function Ue(e){const t=e._align;this.enter({type:"table",align:t.map((function(e){return"none"===e?null:e})),children:[]},e),this.data.inTable=!0}function Ge(e){this.exit(e),this.data.inTable=void 0}function Qe(e){this.enter({type:"tableRow",children:[]},e)}function Ke(e){this.exit(e)}function Ye(e){this.enter({type:"tableCell",children:[]},e)}function Ze(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Je));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Je(e,t){return"|"===t?t:e}function Xe(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[\t :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(e,t,n){let r=He.inlineCode(e,t,n);return n.stack.includes("tableCell")&&(r=r.replace(/\|/g,"\\$&")),r},table:function(e,t,n,r){return c(function(e,t,n){const r=e.children;let i=-1;const o=[],s=t.enter("table");for(;++i<r.length;)o[i]=l(r[i],t,n);return s(),o}(e,n,r),e.align)},tableCell:s,tableRow:function(e,t,n,r){const i=c([l(e,n,r)]);return i.slice(0,i.indexOf("\n"))}}};function s(e,t,n,r){const i=n.enter("tableCell"),s=n.enter("phrasing"),c=n.containerPhrasing(e,{...r,before:o,after:o});return s(),i(),c}function c(e,t){return function(e,t={}){const n=(t.align||[]).concat(),r=t.stringLength||Ce,i=[],o=[],s=[],c=[];let l=0,a=-1;for(;++a<e.length;){const n=[],i=[];let d=-1;for(e[a].length>l&&(l=e[a].length);++d<e[a].length;){const o=null==(u=e[a][d])?"":String(u);if(!1!==t.alignDelimiters){const e=r(o);i[d]=e,(void 0===c[d]||e>c[d])&&(c[d]=e)}n.push(o)}o[a]=n,s[a]=i}var u;let d=-1;if("object"==typeof n&&"length"in n)for(;++d<l;)i[d]=we(n[d]);else{const e=we(n);for(;++d<l;)i[d]=e}d=-1;const f=[],h=[];for(;++d<l;){const e=i[d];let n="",r="";99===e?(n=":",r=":"):108===e?n=":":114===e&&(r=":");let o=!1===t.alignDelimiters?1:Math.max(1,c[d]-n.length-r.length);const s=n+"-".repeat(o)+r;!1!==t.alignDelimiters&&(o=n.length+o+r.length,o>c[d]&&(c[d]=o),h[d]=o),f[d]=s}o.splice(1,0,f),s.splice(1,0,h),a=-1;const p=[];for(;++a<o.length;){const e=o[a],n=s[a];d=-1;const r=[];for(;++d<l;){const o=e[d]||"";let s="",a="";if(!1!==t.alignDelimiters){const e=c[d]-(n[d]||0),t=i[d];114===t?s=" ".repeat(e):99===t?e%2?(s=" ".repeat(e/2+.5),a=" ".repeat(e/2-.5)):(s=" ".repeat(e/2),a=s):a=" ".repeat(e)}!1===t.delimiterStart||d||r.push("|"),!1===t.padding||!1===t.alignDelimiters&&""===o||!1===t.delimiterStart&&!d||r.push(" "),!1!==t.alignDelimiters&&r.push(s),r.push(o),!1!==t.alignDelimiters&&r.push(a),!1!==t.padding&&r.push(" "),!1===t.delimiterEnd&&d===l-1||r.push("|")}p.push(!1===t.delimiterEnd?r.join("").replace(/ +$/,""):r.join(""))}return p.join("\n")}(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function l(e,t,n){const r=e.children;let i=-1;const o=[],c=t.enter("tableRow");for(;++i<r.length;)o[i]=s(r[i],0,t,n);return c(),o}}function et(e){const t=this.stack[this.stack.length-2];t.type,t.checked="taskListCheckValueChecked"===e.type}function tt(e){const t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){const e=this.stack[this.stack.length-1];e.type;const n=e.children[0];if(n&&"text"===n.type){const r=t.children;let i,o=-1;for(;++o<r.length;){const e=r[o];if("paragraph"===e.type){i=e;break}}i===e&&(n.value=n.value.slice(1),0===n.value.length?e.children.shift():e.position&&n.position&&"number"==typeof n.position.start.offset&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function nt(e,t,n,r){const i=e.children[0],o="boolean"==typeof e.checked&&i&&"paragraph"===i.type,s="["+(e.checked?"x":" ")+"] ",c=n.createTracker(r);o&&c.move(s);let l=He.listItem(e,t,n,{...r,...c.current()});return o&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,(function(e){return e+s}))),l}function rt(e,t,n,r){const i=e.length;let o,s=0;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);s<r.length;)o=r.slice(s,s+1e4),o.unshift(t,0),e.splice(...o),s+=1e4,t+=1e4}const it={}.hasOwnProperty;function ot(e,t){let n;for(n in t){const r=(it.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){it.call(r,o)||(r[o]=[]);const e=i[o];st(r[o],Array.isArray(e)?e:e?[e]:[])}}}function st(e,t){let n=-1;const r=[];for(;++n<t.length;)("after"===t[n].add?e:r).push(t[n]);rt(e,0,0,r)}const ct={tokenize:function(e,t,n){let r=0;return function t(o){return(87===o||119===o)&&r<3?(r++,e.consume(o),t):46===o&&3===r?(e.consume(o),i):n(o)};function i(e){return null===e?n(e):t(e)}},partial:!0},lt={tokenize:function(e,t,n){let r,i,o;return s;function s(t){return 46===t||95===t?e.check(ut,l,c)(t):null===t||D(t)||$(t)||45!==t&&N(t)?l(t):(o=!0,e.consume(t),s)}function c(t){return 95===t?r=!0:(i=r,r=void 0),e.consume(t),s}function l(e){return i||r||!o?n(e):t(e)}},partial:!0},at={tokenize:function(e,t){let n=0,r=0;return i;function i(s){return 40===s?(n++,e.consume(s),i):41===s&&r<n?o(s):33===s||34===s||38===s||39===s||41===s||42===s||44===s||46===s||58===s||59===s||60===s||63===s||93===s||95===s||126===s?e.check(ut,t,o)(s):null===s||D(s)||$(s)?t(s):(e.consume(s),i)}function o(t){return 41===t&&r++,e.consume(t),i}},partial:!0},ut={tokenize:function(e,t,n){return r;function r(s){return 33===s||34===s||39===s||41===s||42===s||44===s||46===s||58===s||59===s||63===s||95===s||126===s?(e.consume(s),r):38===s?(e.consume(s),o):93===s?(e.consume(s),i):60===s||null===s||D(s)||$(s)?t(s):n(s)}function i(e){return null===e||40===e||91===e||D(e)||$(e)?t(e):r(e)}function o(e){return E(e)?s(e):n(e)}function s(t){return 59===t?(e.consume(t),r):E(t)?(e.consume(t),s):n(t)}},partial:!0},dt={tokenize:function(e,t,n){return function(t){return e.consume(t),r};function r(e){return A(e)?n(e):t(e)}},partial:!0},ft={tokenize:function(e,t,n){const r=this;return function(t){return 87!==t&&119!==t||!vt.call(r,r.previous)||xt(r.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(ct,e.attempt(lt,e.attempt(at,i),n),n)(t))};function i(n){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(n)}},previous:vt},ht={tokenize:function(e,t,n){const r=this;let i="",o=!1;return function(t){return 72!==t&&104!==t||!kt.call(r,r.previous)||xt(r.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(t),e.consume(t),s)};function s(t){if(E(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(58===t){const n=i.toLowerCase();if("http"===n||"https"===n)return e.consume(t),c}return n(t)}function c(t){return 47===t?(e.consume(t),o?l:(o=!0,c)):n(t)}function l(t){return null===t||function(e){return null!==e&&(e<32||127===e)}(t)||D(t)||$(t)||N(t)?n(t):e.attempt(lt,e.attempt(at,a),n)(t)}function a(n){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(n)}},previous:kt},pt={tokenize:function(e,t,n){const r=this;let i,o;return function(t){return yt(t)&&bt.call(r,r.previous)&&!xt(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),s(t)):n(t)};function s(t){return yt(t)?(e.consume(t),s):64===t?(e.consume(t),c):n(t)}function c(t){return 46===t?e.check(dt,a,l)(t):45===t||95===t||A(t)?(o=!0,e.consume(t),c):a(t)}function l(t){return e.consume(t),i=!0,c}function a(s){return o&&i&&E(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(s)):n(s)}},previous:bt},mt={};let gt=48;for(;gt<123;)mt[gt]=pt,gt++,58===gt?gt=65:91===gt&&(gt=97);function vt(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||D(e)}function kt(e){return!E(e)}function bt(e){return!(47===e||yt(e))}function yt(e){return 43===e||45===e||46===e||95===e||A(e)}function xt(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if(("labelLink"===r.type||"labelImage"===r.type)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}function Ct(e){return null===e||D(e)||$(e)?1:N(e)?2:void 0}function wt(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}function _t(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return function(r){return M(r)?(e.enter(n),s(r)):t(r)};function s(r){return M(r)&&o++<i?(e.consume(r),s):(e.exit(n),t(r))}}mt[43]=pt,mt[45]=pt,mt[46]=pt,mt[95]=pt,mt[72]=[pt,ht],mt[104]=[pt,ht],mt[87]=[pt,ft],mt[119]=[pt,ft];const St={tokenize:function(e,t,n){return function(t){return M(t)?_t(e,r,"linePrefix")(t):r(t)};function r(e){return null===e||T(e)?t(e):n(e)}},partial:!0},Pt={tokenize:function(e,t,n){const r=this;return _t(e,(function(e){const i=r.events[r.events.length-1];return i&&"gfmFootnoteDefinitionIndent"===i[1].type&&4===i[2].sliceSerialize(i[1],!0).length?t(e):n(e)}),"gfmFootnoteDefinitionIndent",5)},partial:!0};function Lt(e,t,n){const r=this;let i=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s;for(;i--;){const e=r.events[i][1];if("labelImage"===e.type){s=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(i){if(!s||!s._balanced)return n(i);const c=se(r.sliceSerialize({start:s.end,end:r.now()}));return 94===c.codePointAt(0)&&o.includes(c.slice(1))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(i),e.exit("gfmFootnoteCallLabelMarker"),t(i)):n(i)}}function It(e,t){let n=e.length;for(;n--;)if("labelImage"===e[n][1].type&&"enter"===e[n][0]){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},c=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",o,t],["enter",s,t],["exit",s,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...c),e}function Rt(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,s=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),c};function c(t){return 94!==t?n(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",l)}function l(c){if(s>999||93===c&&!o||null===c||91===c||D(c))return n(c);if(93===c){e.exit("chunkString");const o=e.exit("gfmFootnoteCallString");return i.includes(se(r.sliceSerialize(o)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(c)}return D(c)||(o=!0),s++,e.consume(c),92===c?a:l}function a(t){return 91===t||92===t||93===t?(e.consume(t),s++,l):l(t)}}function Ot(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,s,c=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),l};function l(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",a):n(t)}function a(t){if(c>999||93===t&&!s||null===t||91===t||D(t))return n(t);if(93===t){e.exit("chunkString");const n=e.exit("gfmFootnoteDefinitionLabelString");return o=se(r.sliceSerialize(n)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),d}return D(t)||(s=!0),c++,e.consume(t),92===t?u:a}function u(t){return 91===t||92===t||93===t?(e.consume(t),c++,a):a(t)}function d(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),i.includes(o)||i.push(o),_t(e,f,"gfmFootnoteDefinitionWhitespace")):n(t)}function f(e){return t(e)}}function Et(e,t,n){return e.check(St,t,e.attempt(Pt,t,n))}function At(e){e.exit("gfmFootnoteDefinition")}function Tt(e){let t=(e||{}).singleTilde;const n={tokenize:function(e,n,r){const i=this.previous,o=this.events;let s=0;return function(t){return 126===i&&"characterEscape"!==o[o.length-1][1].type?r(t):(e.enter("strikethroughSequenceTemporary"),c(t))};function c(o){const l=Ct(i);if(126===o)return s>1?r(o):(e.consume(o),s++,c);if(s<2&&!t)return r(o);const a=e.exit("strikethroughSequenceTemporary"),u=Ct(o);return a._open=!u||2===u&&Boolean(l),a._close=!l||2===l&&Boolean(u),n(o)}},resolveAll:function(e,t){let n=-1;for(;++n<e.length;)if("enter"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._close){let r=n;for(;r--;)if("exit"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset==e[r][1].end.offset-e[r][1].start.offset){e[n][1].type="strikethroughSequence",e[r][1].type="strikethroughSequence";const i={type:"strikethrough",start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},o={type:"strikethroughText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},s=[["enter",i,t],["enter",e[r][1],t],["exit",e[r][1],t],["enter",o,t]],c=t.parser.constructs.insideSpan.null;c&&rt(s,s.length,0,wt(c,e.slice(r+1,n),t)),rt(s,s.length,0,[["exit",o,t],["enter",e[n][1],t],["exit",e[n][1],t],["exit",i,t]]),rt(e,r-1,n-r+3,s),n=r+s.length-2;break}}for(n=-1;++n<e.length;)"strikethroughSequenceTemporary"===e[n][1].type&&(e[n][1].type="data");return e}};return null==t&&(t=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}}}class Dt{constructor(){this.map=[]}add(e,t,n){!function(e,t,n,r){let i=0;if(0!==n||0!==r.length){for(;i<e.map.length;){if(e.map[i][0]===t)return e.map[i][1]+=n,void e.map[i][2].push(...r);i+=1}e.map.push([t,n,r])}}(this,e,t,n)}consume(e){if(this.map.sort((function(e,t){return e[0]-t[0]})),0===this.map.length)return;let t=this.map.length;const n=[];for(;t>0;)t-=1,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push([...e]),e.length=0;let r=n.pop();for(;r;)e.push(...r),r=n.pop();this.map.length=0}}function Mt(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if("enter"===i[0])"tableContent"===i[1].type&&r.push("tableDelimiterMarker"===e[t+1][1].type?"left":"none");else if("tableContent"===i[1].type){if("tableDelimiterMarker"===e[t-1][1].type){const e=r.length-1;r[e]="left"===r[e]?"center":"right"}}else if("tableDelimiterRow"===i[1].type)break}else"enter"===i[0]&&"tableDelimiterRow"===i[1].type&&(n=!0);t+=1}return r}function Nt(e,t,n){const r=this;let i,o=0,s=0;return function(e){let t=r.events.length-1;for(;t>-1;){const e=r.events[t][1].type;if("lineEnding"!==e&&"linePrefix"!==e)break;t--}const i=t>-1?r.events[t][1].type:null,o="tableHead"===i||"tableRow"===i?y:c;return o===y&&r.parser.lazy[r.now().line]?n(e):o(e)};function c(t){return e.enter("tableHead"),e.enter("tableRow"),function(e){return 124===e||(i=!0,s+=1),l(e)}(t)}function l(t){return null===t?n(t):T(t)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),d):n(t):M(t)?_t(e,l,"whitespace")(t):(s+=1,i&&(i=!1,o+=1),124===t?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),i=!0,l):(e.enter("data"),a(t)))}function a(t){return null===t||124===t||D(t)?(e.exit("data"),l(t)):(e.consume(t),92===t?u:a)}function u(t){return 92===t||124===t?(e.consume(t),a):a(t)}function d(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter("tableDelimiterRow"),i=!1,M(t)?_t(e,f,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):f(t))}function f(t){return 45===t||58===t?p(t):124===t?(i=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),h):b(t)}function h(t){return M(t)?_t(e,p,"whitespace")(t):p(t)}function p(t){return 58===t?(s+=1,i=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),m):45===t?(s+=1,m(t)):null===t||T(t)?k(t):b(t)}function m(t){return 45===t?(e.enter("tableDelimiterFiller"),g(t)):b(t)}function g(t){return 45===t?(e.consume(t),g):58===t?(i=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),v):(e.exit("tableDelimiterFiller"),v(t))}function v(t){return M(t)?_t(e,k,"whitespace")(t):k(t)}function k(n){return 124===n?f(n):(null===n||T(n))&&i&&o===s?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(n)):b(n)}function b(e){return n(e)}function y(t){return e.enter("tableRow"),x(t)}function x(n){return 124===n?(e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),x):null===n||T(n)?(e.exit("tableRow"),t(n)):M(n)?_t(e,x,"whitespace")(n):(e.enter("data"),C(n))}function C(t){return null===t||124===t||D(t)?(e.exit("data"),x(t)):(e.consume(t),92===t?w:C)}function w(t){return 92===t||124===t?(e.consume(t),C):C(t)}}function $t(e,t){let n,r,i,o=-1,s=!0,c=0,l=[0,0,0,0],a=[0,0,0,0],u=!1,d=0;const f=new Dt;for(;++o<e.length;){const h=e[o],p=h[1];"enter"===h[0]?"tableHead"===p.type?(u=!1,0!==d&&(jt(f,t,d,n,r),r=void 0,d=0),n={type:"table",start:Object.assign({},p.start),end:Object.assign({},p.end)},f.add(o,0,[["enter",n,t]])):"tableRow"===p.type||"tableDelimiterRow"===p.type?(s=!0,i=void 0,l=[0,0,0,0],a=[0,o+1,0,0],u&&(u=!1,r={type:"tableBody",start:Object.assign({},p.start),end:Object.assign({},p.end)},f.add(o,0,[["enter",r,t]])),c="tableDelimiterRow"===p.type?2:r?3:1):!c||"data"!==p.type&&"tableDelimiterMarker"!==p.type&&"tableDelimiterFiller"!==p.type?"tableCellDivider"===p.type&&(s?s=!1:(0!==l[1]&&(a[0]=a[1],i=Ft(f,t,l,c,void 0,i)),l=a,a=[l[1],o,0,0])):(s=!1,0===a[2]&&(0!==l[1]&&(a[0]=a[1],i=Ft(f,t,l,c,void 0,i),l=[0,0,0,0]),a[2]=o)):"tableHead"===p.type?(u=!0,d=o):"tableRow"===p.type||"tableDelimiterRow"===p.type?(d=o,0!==l[1]?(a[0]=a[1],i=Ft(f,t,l,c,o,i)):0!==a[1]&&(i=Ft(f,t,a,c,o,i)),c=0):!c||"data"!==p.type&&"tableDelimiterMarker"!==p.type&&"tableDelimiterFiller"!==p.type||(a[3]=o)}for(0!==d&&jt(f,t,d,n,r),f.consume(t.events),o=-1;++o<t.events.length;){const e=t.events[o];"enter"===e[0]&&"table"===e[1].type&&(e[1]._align=Mt(t.events,o))}return e}function Ft(e,t,n,r,i,o){const s=1===r?"tableHeader":2===r?"tableDelimiter":"tableData";0!==n[0]&&(o.end=Object.assign({},Bt(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const c=Bt(t.events,n[1]);if(o={type:s,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",o,t]]),0!==n[2]){const i=Bt(t.events,n[2]),o=Bt(t.events,n[3]),s={type:"tableContent",start:Object.assign({},i),end:Object.assign({},o)};if(e.add(n[2],0,[["enter",s,t]]),2!==r){const r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type="chunkText",r[1].contentType="text",n[3]>n[2]+1){const t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[["exit",s,t]])}return void 0!==i&&(o.end=Object.assign({},Bt(t.events,i)),e.add(i,0,[["exit",o,t]]),o=void 0),o}function jt(e,t,n,r,i){const o=[],s=Bt(t.events,n);i&&(i.end=Object.assign({},s),o.push(["exit",i,t])),r.end=Object.assign({},s),o.push(["exit",r,t]),e.add(n+1,0,o)}function Bt(e,t){const n=e[t],r="enter"===n[0]?"start":"end";return n[1][r]}const zt={tokenize:function(e,t,n){const r=this;return function(t){return null===r.previous&&r._gfmTasklistFirstContentOfListItem?(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),i):n(t)};function i(t){return D(t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),o):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),o):n(t)}function o(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),s):n(t)}function s(r){return T(r)?t(r):M(r)?e.check({tokenize:Vt},t,n)(r):n(r)}}};function Vt(e,t,n){return _t(e,(function(e){return null===e?n(e):t(e)}),"whitespace")}const Wt={};function qt(e){const t=e||Wt,n=this.data(),r=n.micromarkExtensions||(n.micromarkExtensions=[]),i=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),o=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);r.push(function(e){return function(e){const t={};let n=-1;for(;++n<e.length;)ot(t,e[n]);return t}([{text:mt},{document:{91:{tokenize:Ot,continuation:{tokenize:Et},exit:At}},text:{91:{tokenize:Rt},93:{add:"after",tokenize:Lt,resolveTo:It}}},Tt(e),{flow:{null:{tokenize:Nt,resolveAll:$t}}},{text:{91:zt}}])}(t)),i.push([{transforms:[ne],enter:{literalAutolink:Y,literalAutolinkEmail:Z,literalAutolinkHttp:Z,literalAutolinkWww:Z},exit:{literalAutolink:te,literalAutolinkEmail:ee,literalAutolinkHttp:J,literalAutolinkWww:X}},{enter:{gfmFootnoteDefinition:ce,gfmFootnoteDefinitionLabelString:le,gfmFootnoteCall:de,gfmFootnoteCallString:fe},exit:{gfmFootnoteDefinition:ue,gfmFootnoteDefinitionLabelString:ae,gfmFootnoteCall:pe,gfmFootnoteCallString:he}},{canContainEols:["delete"],enter:{strikethrough:be},exit:{strikethrough:ye}},{enter:{table:Ue,tableData:Ye,tableHeader:Ye,tableRow:Qe},exit:{codeText:Ze,table:Ge,tableData:Ke,tableHeader:Ke,tableRow:Ke}},{exit:{taskListCheckValueChecked:et,taskListCheckValueUnchecked:et,paragraph:tt}}]),o.push(function(e){return{extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Q,notInConstruct:K},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Q,notInConstruct:K},{character:":",before:"[ps]",after:"\\/",inConstruct:Q,notInConstruct:K}]},{unsafe:[{character:"[",inConstruct:["phrasing","label","reference"]}],handlers:{footnoteDefinition:ge,footnoteReference:me}},{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:ke}],handlers:{delete:xe}},Xe(e),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:nt}}]}}(t))}const Ht=["http","https","mailto","tel"],Ut=(0,r.KR)(null),Gt={name:"NcRichText",components:{NcReferenceList:L},props:{text:{type:String,default:""},arguments:{type:Object,default:()=>({})},referenceLimit:{type:Number,default:0},referenceInteractive:{type:Boolean,default:!0},referenceInteractiveOptIn:{type:Boolean,default:!1},references:{type:Array,default:null},useMarkdown:{type:Boolean,default:!1},useExtendedMarkdown:{type:Boolean,default:!1},interactive:{type:Boolean,default:!1},autolink:{type:Boolean,default:!0}},emits:["interact:todo"],data:()=>({parentId:(0,m.G)(5)}),methods:{renderPlaintext(e){const t=this,n=this.text.split(/(\{[a-z\-_.0-9]+\})/gi).map((function(n,r,i){const s=n.match(/^\{([a-z\-_.0-9]+)\}$/i);if(!s)return(({h:e,context:t},n)=>(t.autolink&&(n=(0,o.p)(n)),Array.isArray(n)?n.map((t=>{if("string"==typeof t)return t;const{component:n,props:r}=t,i="NcLink"===n.name?void 0:"rich-text--component";return e(n,{props:r,class:i})})):n))({h:e,context:t},n);const c=s[1],l=t.arguments[c];if("object"==typeof l){const{component:t,props:n}=l;return e(t,{props:n,class:"rich-text--component"})}return l?e("span",{class:"rich-text--fallback"},l):n}));return e("div",{class:"rich-text--wrapper"},[e("div",{},n.flat()),this.referenceLimit>0?e("div",{class:"rich-text--reference-widget"},[e(L,{props:{text:this.text,referenceData:this.references,interactive:this.referenceInteractive,interactiveOptIn:this.referenceInteractiveOptIn}})]):null])},renderMarkdown(e){const t=(0,g.l)().use(v.A).use(o.r,{autolink:this.autolink,useMarkdown:this.useMarkdown,useExtendedMarkdown:this.useExtendedMarkdown}).use(R).use(this.useExtendedMarkdown?qt:void 0).use(k.A).use(b.A,{except:Ht}).use(y.A,{handlers:{component:(e,t)=>e(t,t.component,{value:t.value})}}).use(this.useExtendedMarkdown?Ut.value:void 0).use(I).use(C.A,{target:"_blank",rel:["noopener noreferrer"]}).use(x.A,{createElement:(t,r,i)=>{if(!t.startsWith("#")){if(this.useExtendedMarkdown){"code"===t&&!Ut.value&&r?.attrs?.class?.includes("language")&&async function(){const e=await n.e(5862).then(n.bind(n,75862));Ut.value=e.default}();let o=null;if("li"===t&&Array.isArray(i)&&"input"===i[0].tag&&"checkbox"===i[0].data.attrs.type){const[n,...s]=i,c=s.findIndex((e=>["ul","ol","li","blockquote","pre"].includes(e.tag)));-1!==c&&(o=s[c],s.splice(c));const l=this.parentId+"-markdown-input-"+(0,m.G)(5),a=e(d.N,{attrs:{...n.data.attrs,id:l,disabled:!this.interactive},on:{"update:checked":()=>{this.$emit("interact:todo",l)}}},s);return e(t,r,[a,o])}}if("a"===t){const t=(0,o.g)(this.$router,r.attrs.href);if(t)return delete r.attrs.href,delete r.attrs.target,e(w.Wk,{...r,props:{to:t}},i)}return e(t,r,i)}const s=this.arguments[t.slice(1)];return s?s.component?e(s.component,{attrs:r,props:s.props,class:"rich-text--component"},i):e("span",r,[s]):e("span",{attrs:r,class:"rich-text--fallback"},[`{${t.slice(1)}}`])},prefix:!1}).processSync(this.text.replace(/<[^>]+>/g,(e=>e.replace(/</g,"<"))).replace(/>/gim,">")).result;return e("div",{class:"rich-text--wrapper rich-text--wrapper-markdown"},[t,this.referenceLimit>0?e("div",{class:"rich-text--reference-widget"},[e(L,{props:{text:this.text,referenceData:this.references,interactive:this.referenceInteractive,interactiveOptIn:this.referenceInteractiveOptIn}})]):null])}},render(e){return this.useMarkdown||this.useExtendedMarkdown?this.renderMarkdown(e):this.renderPlaintext(e)}},Qt=(0,u.n)(Gt,null,null,!1,null,"ddd5e67e").exports}}]);
//# sourceMappingURL=9697-9697.js.map?v=9997c33b99b948804615
|