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
111 KiB
JavaScript
Raw Normal View History

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