nextcloud/dist/files-reference-files.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

2 lines
81 KiB
JavaScript
Raw Permalink Normal View History

(()=>{var e,t,n,r={7838:(e,t,n)=>{"use strict";n(33807);var r=n(43819),i=n(86435),o=n(76643),s=n(87798),c=n(19998),l=n(3288),a=n(8019),u=n(85471),d=n(40173),f=n(76514),h=n(21777),p=n(19051),m=n(63814),g=n(32505),v=n(86432),b=n(3168),k=n(44111),y=n(51431),C=n(88751),w=n(33239),x=n(47970),A=n(64546);const _={name:"NcReferenceList",components:{NcReferenceWidget:v.f},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.filter(Boolean).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(k.U).exec(this.text)?void this.resolve().then(e=>{this.references=e.data.ocs.data.references,this.loading=!1,this.$emit("loaded")}).catch(e=>{b.l.error("Failed to extract references",e),this.loading=!1,this.$emit("loaded")}):(this.references=null,void(this.loading=!1))},resolve(){const e=new RegExp(k.U).exec(this.text.trim()),t=null===(0,h.HW)();return 1===this.limit&&e?t?p.Ay.get((0,m.KT)("references/resolvePublic")+`?reference=${encodeURIComponent(e[0])}&sharingToken=${(0,g.G)()}`):p.Ay.get((0,m.KT)("references/resolve")+`?reference=${encodeURIComponent(e[0])}`):t?p.Ay.post((0,m.KT)("references/extractPublic"),{text:this.text,resolve:!0,limit:this.limit,sharingToken:(0,g.G)()}):p.Ay.post((0,m.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 I=(0,y.n)(_,S,P,!1,null,"a33ecc28").exports;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 L=D(/[A-Za-z]/),R=D(/[\dA-Za-z]/);function E(e){return null!==e&&e<-2}function j(e){return null!==e&&(e<0||32===e)}function T(e){return-2===e||-1===e||32===e}const F=D(new RegExp("\\p{P}|\\p{S}","u")),B=D(/\s/);function D(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}const M=function(e){if(null==e)return N;if("function"==typeof e)return $(e);if("object"==typeof e)return Array.isArray(e)?function(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=M(e[n]);return $(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 $(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,$(function(e){return e&&e.type===t});var t;throw new Error("Expected function, string, or object as test")};function $(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 N(){return!0}const z=[],V=!1;function W(e,t,n,r){let i;i=t;const o=M(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=z;if(o(t,r,i[i.length-1]||void 0)&&(a=function(e){return Array.isArray(e)?e:
//# sourceMappingURL=files-reference-files.js.map?v=01a6aed7c935eef42989