"use strict";(self.webpackChunknextcloud=self.webpackChunknextcloud||[]).push([[6408],{76408:(e,t,n)=>{n.d(t,{N:()=>Ut,a:()=>P}),n(42802);var r=n(85471),i=n(85378),o=n(43921),s=n(65043),c=n(82680),l=n(21777),a=n(63814),u=n(51431),d=n(13368),f=n(47970),h=n(64546),p=n(33239),m=n(86241),g=n(8019),v=n(87798),k=n(76643),b=n(19998),y=n(86435),x=n(43819),C=n(40173);const w={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 _=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()},S=[];const P=(0,u.n)(w,_,S,!1,null,"ffdba753").exports,L=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)}))}},I=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 R(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 O=$(/[A-Za-z]/),E=$(/[\dA-Za-z]/);function A(e){return null!==e&&e<-2}function T(e){return null!==e&&(e<0||32===e)}function D(e){return-2===e||-1===e||32===e}const M=$(new RegExp("\\p{P}|\\p{S}","u")),N=$(/\s/);function $(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}const F=function(e){if(null==e)return B;if("function"==typeof e)return j(e);if("object"==typeof e)return Array.isArray(e)?function(e){const t=[];let n=-1;for(;++n":"")+")"})}return c;function c(){let s,c,l,a=z;if(o(t,r,i[i.length-1]||void 0)&&(a=function(e){return Array.isArray(e)?e:"number"==typeof e?[V,e]:null==e?z:[e]}(n(t,i)),a[0]===W))return a;if("children"in t&&t.children){const n=t;if(n.children&&a[0]!==q)for(c=0,l=i.concat(n);c>-1&&c0?{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?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=R(e,"(");let o=R(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 re(e,t,n,r){return!(!ie(r,!0)||/[-\d_]$/.test(n))&&{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function ie(e,t){const n=e.input.charCodeAt(e.index-1);return(0===e.index||N(n)||M(n))&&(!t||47!==n)}function oe(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}function se(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function ce(){this.buffer()}function le(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.label=t,n.identifier=oe(this.sliceSerialize(e)).toLowerCase()}function ae(e){this.exit(e)}function ue(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function de(){this.buffer()}function fe(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.label=t,n.identifier=oe(this.sliceSerialize(e)).toLowerCase()}function he(e){this.exit(e)}function pe(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 me(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()),ge)),s(),o}function ge(e,t,n){return 0===t?e:(n?"":" ")+e}pe.peek=function(){return"["};const ve=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function ke(e){this.enter({type:"delete",children:[]},e)}function be(e){this.exit(e)}function ye(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 xe(e){return e.length}function Ce(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 we(e,t,n){return">"+(n?"":" ")+e}function _e(e,t,n){if("string"==typeof t&&(t=[t]),!t||0===t.length)return n;let r=-1;for(;++r",...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 Me(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 Ne(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\u007F]/.test(e.url))}function Fe(e,t,n,r){const i=Le(n),o='"'===i?"Quote":"Apostrophe",s=n.createTracker(r);let c,l;if($e(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 je(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 Be(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 ze(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}Te.peek=function(){return"<"},De.peek=function(){return"!"},Me.peek=function(){return"!"},Ne.peek=function(){return"`"},Fe.peek=function(e,t,n){return $e(e,n)?"<":"["},je.peek=function(){return"["};const Ve=F(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function We(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}We.peek=function(e,t,n){return n.options.strong||"*"};const qe={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()),we);return i(),s},break:Se,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,Pe);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=Le(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:Ie,hardBreak:Se,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)&&Oe(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:Te,image:De,imageReference:Me,inlineCode:Ne,link:Fe,linkReference:je,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):Be(n);const c=e.ordered?"."===s?")":".":function(e){const t=Be(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),ze(n)===s&&t){let t=-1;for(;++t-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 Ve(e)}))?n.containerPhrasing:n.containerFlow).call(n,e,r)},strong:We,text:function(e,t,n,r){return n.safe(e.value,r)},thematicBreak:function(e,t,n){const r=(ze(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 He(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 Ue(e){this.exit(e),this.data.inTable=void 0}function Ge(e){this.enter({type:"tableRow",children:[]},e)}function Qe(e){this.exit(e)}function Ke(e){this.enter({type:"tableCell",children:[]},e)}function Ye(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Ze));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Ze(e,t){return"|"===t?t:e}function Je(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=qe.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(;++il&&(l=e[a].length);++dc[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(;++dc[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(;++ai?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);s0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}function xt(e){return null===e||T(e)||N(e)?1:M(e)?2:void 0}function Ct(e,t,n){const r=[];let i=-1;for(;++i999||93===c&&!o||null===c||91===c||T(c))return n(c);if(93===c){e.exit("chunkString");const o=e.exit("gfmFootnoteCallString");return i.includes(oe(r.sliceSerialize(o)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(c)}return T(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 Rt(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||T(t))return n(t);if(93===t){e.exit("chunkString");const n=e.exit("gfmFootnoteDefinitionLabelString");return o=oe(r.sliceSerialize(n)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),d}return T(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),wt(e,f,"gfmFootnoteDefinitionWhitespace")):n(t)}function f(e){return t(e)}}function Ot(e,t,n){return e.check(_t,t,e.attempt(St,t,n))}function Et(e){e.exit("gfmFootnoteDefinition")}function At(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=xt(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=xt(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(;++n0;)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 Dt(e,t){let n=!1;const r=[];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):A(t)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),d):n(t):D(t)?wt(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||T(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,D(t)?wt(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 D(t)?wt(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||A(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 D(t)?wt(e,k,"whitespace")(t):k(t)}function k(n){return 124===n?f(n):(null===n||A(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||A(n)?(e.exit("tableRow"),t(n)):D(n)?wt(e,x,"whitespace")(n):(e.enter("data"),C(n))}function C(t){return null===t||124===t||T(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 Nt(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 Tt;for(;++on[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({},jt(t.events,i)),e.add(i,0,[["exit",o,t]]),o=void 0),o}function Ft(e,t,n,r,i){const o=[],s=jt(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 jt(e,t){const n=e[t],r="enter"===n[0]?"start":"end";return n[1][r]}const Bt={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 T(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 A(r)?t(r):D(r)?e.check({tokenize:zt},t,n)(r):n(r)}}};function zt(e,t,n){return wt(e,(function(e){return null===e?n(e):t(e)}),"whitespace")}const Vt={};function Wt(e){const t=e||Vt,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({})},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(P,{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(I).use(this.useExtendedMarkdown?Wt:void 0).use(k.A).use(b.A,{handlers:{component:(e,t)=>e(t,t.component,{value:t.value})}}).use(this.useExtendedMarkdown?qt.value:void 0).use(L).use(x.A,{target:"_blank",rel:["noopener noreferrer"]}).use(y.A,{createElement:(t,r,i)=>{if(!t.startsWith("#")){if(this.useExtendedMarkdown){"code"===t&&!qt.value&&r?.attrs?.class?.includes("language")&&async function(){const e=await n.e(5862).then(n.bind(n,75862));qt.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(C.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(/")).result;return e("div",{class:"rich-text--wrapper rich-text--wrapper-markdown"},[t,this.referenceLimit>0?e("div",{class:"rich-text--reference-widget"},[e(P,{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)}},Ut=(0,u.n)(Ht,null,null,!1,null,"d7087beb").exports},85378:(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(50538),s=n(65043),c=n(32981),l=n(63814),a=n(35779),u=n(26517),d=n(25825),f=n(13073),h=n(85471),p=n(40173),m=n(43921),g=n(97012),v=n(59892),k=n(59890),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{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)}))}))}}}]); //# sourceMappingURL=6408-6408.js.map?v=d68d596cc661db69d9eb