From 0ab5edc746592084fbcaed5d1789cd4eb426e19b Mon Sep 17 00:00:00 2001 From: flarum-bot Date: Sun, 10 Nov 2024 07:20:41 +0000 Subject: [PATCH] Bundled output for commit eff7059fa7ff740512e23030a6fe2bf996dece03 Includes transpiled JS/TS, and Typescript declaration files (typings). [skip ci] --- js/dist/admin.js | 2 +- js/dist/admin.js.map | 2 +- js/dist/forum.js | 3 ++- js/dist/forum.js.LICENSE.txt | 1 + js/dist/forum.js.map | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 js/dist/forum.js.LICENSE.txt diff --git a/js/dist/admin.js b/js/dist/admin.js index 997c689..d27985c 100644 --- a/js/dist/admin.js +++ b/js/dist/admin.js @@ -1,2 +1,2 @@ -(()=>{var t={n:e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return t.d(a,{a}),a},d:(e,a)=>{for(var n in a)t.o(a,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:a[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)};(()=>{"use strict";const e=flarum.core.compat["admin/app"];var a=t.n(e),n="datlechin-link-preview";a().initializers.add("datlechin/flarum-link-preview",(function(){a().extensionData.for(n).registerSetting({setting:n+".convert_media_urls",label:a().translator.trans(n+".admin.settings.convert_media_urls_label"),help:a().translator.trans(n+".admin.settings.convert_media_urls_help"),type:"checkbox"}).registerSetting({setting:n+".use_google_favicons",label:a().translator.trans(n+".admin.settings.use_google_favicons_label"),help:a().translator.trans(n+".admin.settings.use_google_favicons_help"),type:"checkbox"}).registerSetting({setting:n+".blacklist",label:a().translator.trans(n+".admin.settings.blacklist_label"),help:a().translator.trans(n+".admin.settings.blacklist_help"),placeholder:a().translator.trans(n+".admin.settings.blacklist_placeholder"),type:"textarea"}).registerSetting({setting:n+".whitelist",label:a().translator.trans(n+".admin.settings.whitelist_label"),help:a().translator.trans(n+".admin.settings.whitelist_help"),placeholder:a().translator.trans(n+".admin.settings.whitelist_placeholder"),type:"textarea"}).registerSetting({setting:n+".cache_time",label:a().translator.trans(n+".admin.settings.cache_time_label"),help:a().translator.trans(n+".admin.settings.cache_time_help"),type:"number",min:0}).registerSetting({setting:n+".open_links_in_new_tab",label:a().translator.trans(n+".admin.settings.open_links_in_new_tab_label"),help:a().translator.trans(n+".admin.settings.open_links_in_new_tab_help"),type:"checkbox"})}))})(),module.exports={}})(); +(()=>{var t={n:e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return t.d(a,{a}),a},d:(e,a)=>{for(var n in a)t.o(a,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:a[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)};(()=>{"use strict";const e=flarum.core.compat["admin/app"];var a=t.n(e),n="datlechin-link-preview";a().initializers.add("datlechin/flarum-link-preview",(function(){a().extensionData.for(n).registerSetting({setting:n+".enable_batch_requests",label:a().translator.trans(n+".admin.settings.enable_batch_requests_label"),help:a().translator.trans(n+".admin.settings.enable_batch_requests_help"),type:"checkbox"}).registerSetting({setting:n+".convert_media_urls",label:a().translator.trans(n+".admin.settings.convert_media_urls_label"),help:a().translator.trans(n+".admin.settings.convert_media_urls_help"),type:"checkbox"}).registerSetting({setting:n+".use_google_favicons",label:a().translator.trans(n+".admin.settings.use_google_favicons_label"),help:a().translator.trans(n+".admin.settings.use_google_favicons_help"),type:"checkbox"}).registerSetting({setting:n+".blacklist",label:a().translator.trans(n+".admin.settings.blacklist_label"),help:a().translator.trans(n+".admin.settings.blacklist_help"),placeholder:a().translator.trans(n+".admin.settings.blacklist_placeholder"),type:"textarea"}).registerSetting({setting:n+".whitelist",label:a().translator.trans(n+".admin.settings.whitelist_label"),help:a().translator.trans(n+".admin.settings.whitelist_help"),placeholder:a().translator.trans(n+".admin.settings.whitelist_placeholder"),type:"textarea"}).registerSetting({setting:n+".cache_time",label:a().translator.trans(n+".admin.settings.cache_time_label"),help:a().translator.trans(n+".admin.settings.cache_time_help"),type:"number",min:0}).registerSetting({setting:n+".open_links_in_new_tab",label:a().translator.trans(n+".admin.settings.open_links_in_new_tab_label"),help:a().translator.trans(n+".admin.settings.open_links_in_new_tab_help"),type:"checkbox"})}))})(),module.exports={}})(); //# sourceMappingURL=admin.js.map \ No newline at end of file diff --git a/js/dist/admin.js.map b/js/dist/admin.js.map index dcb3910..e729a49 100644 --- a/js/dist/admin.js.map +++ b/js/dist/admin.js.map @@ -1 +1 @@ -{"version":3,"file":"admin.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,IACzBH,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,I,mBCAlF,MAAM,EAA+BI,OAAOC,KAAKC,OAAO,a,aCElDC,EAAS,yBAEfC,IAAAA,aAAiBC,IAAI,iCAAiC,WACpDD,IAAAA,cAAiB,IACVD,GACJG,gBAAgB,CACfC,QAAYJ,EAAM,sBAClBK,MAAOJ,IAAAA,WAAeK,MAASN,EAAM,4CACrCO,KAAMN,IAAAA,WAAeK,MAASN,EAAM,2CACpCQ,KAAM,aAEPL,gBAAgB,CACfC,QAAYJ,EAAM,uBAClBK,MAAOJ,IAAAA,WAAeK,MAASN,EAAM,6CACrCO,KAAMN,IAAAA,WAAeK,MAASN,EAAM,4CACpCQ,KAAM,aAEPL,gBAAgB,CACfC,QAAYJ,EAAM,aAClBK,MAAOJ,IAAAA,WAAeK,MAASN,EAAM,mCACrCO,KAAMN,IAAAA,WAAeK,MAASN,EAAM,kCACpCS,YAAaR,IAAAA,WAAeK,MAASN,EAAM,yCAC3CQ,KAAM,aAEPL,gBAAgB,CACfC,QAAYJ,EAAM,aAClBK,MAAOJ,IAAAA,WAAeK,MAASN,EAAM,mCACrCO,KAAMN,IAAAA,WAAeK,MAASN,EAAM,kCACpCS,YAAaR,IAAAA,WAAeK,MAASN,EAAM,yCAC3CQ,KAAM,aAEPL,gBAAgB,CACfC,QAAYJ,EAAM,cAClBK,MAAOJ,IAAAA,WAAeK,MAASN,EAAM,oCACrCO,KAAMN,IAAAA,WAAeK,MAASN,EAAM,mCACpCQ,KAAM,SACNE,IAAK,IAENP,gBAAgB,CACfC,QAAYJ,EAAM,yBAClBK,MAAOJ,IAAAA,WAAeK,MAASN,EAAM,+CACrCO,KAAMN,IAAAA,WAAeK,MAASN,EAAM,8CACpCQ,KAAM,YAEZ,G","sources":["webpack://@datlechin/flarum-link-preview/webpack/bootstrap","webpack://@datlechin/flarum-link-preview/webpack/runtime/compat get default export","webpack://@datlechin/flarum-link-preview/webpack/runtime/define property getters","webpack://@datlechin/flarum-link-preview/webpack/runtime/hasOwnProperty shorthand","webpack://@datlechin/flarum-link-preview/external root \"flarum.core.compat['admin/app']\"","webpack://@datlechin/flarum-link-preview/./src/admin/index.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/app'];","import app from 'flarum/admin/app';\n\nconst PREFIX = 'datlechin-link-preview';\n\napp.initializers.add('datlechin/flarum-link-preview', () => {\n app.extensionData\n .for(PREFIX)\n .registerSetting({\n setting: `${PREFIX}.convert_media_urls`,\n label: app.translator.trans(`${PREFIX}.admin.settings.convert_media_urls_label`),\n help: app.translator.trans(`${PREFIX}.admin.settings.convert_media_urls_help`),\n type: 'checkbox',\n })\n .registerSetting({\n setting: `${PREFIX}.use_google_favicons`,\n label: app.translator.trans(`${PREFIX}.admin.settings.use_google_favicons_label`),\n help: app.translator.trans(`${PREFIX}.admin.settings.use_google_favicons_help`),\n type: 'checkbox',\n })\n .registerSetting({\n setting: `${PREFIX}.blacklist`,\n label: app.translator.trans(`${PREFIX}.admin.settings.blacklist_label`),\n help: app.translator.trans(`${PREFIX}.admin.settings.blacklist_help`),\n placeholder: app.translator.trans(`${PREFIX}.admin.settings.blacklist_placeholder`),\n type: 'textarea',\n })\n .registerSetting({\n setting: `${PREFIX}.whitelist`,\n label: app.translator.trans(`${PREFIX}.admin.settings.whitelist_label`),\n help: app.translator.trans(`${PREFIX}.admin.settings.whitelist_help`),\n placeholder: app.translator.trans(`${PREFIX}.admin.settings.whitelist_placeholder`),\n type: 'textarea',\n })\n .registerSetting({\n setting: `${PREFIX}.cache_time`,\n label: app.translator.trans(`${PREFIX}.admin.settings.cache_time_label`),\n help: app.translator.trans(`${PREFIX}.admin.settings.cache_time_help`),\n type: 'number',\n min: 0,\n })\n .registerSetting({\n setting: `${PREFIX}.open_links_in_new_tab`,\n label: app.translator.trans(`${PREFIX}.admin.settings.open_links_in_new_tab_label`),\n help: app.translator.trans(`${PREFIX}.admin.settings.open_links_in_new_tab_help`),\n type: 'checkbox',\n });\n});\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","flarum","core","compat","PREFIX","app","add","registerSetting","setting","label","trans","help","type","placeholder","min"],"sourceRoot":""} \ No new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MAASN,EAAM,mCACrCO,KAAMN,IAAAA,WAAeK,MAASN,EAAM,kCACpCS,YAAaR,IAAAA,WAAeK,MAASN,EAAM,yCAC3CQ,KAAM,aAEPL,gBAAgB,CACfC,QAAYJ,EAAM,cAClBK,MAAOJ,IAAAA,WAAeK,MAASN,EAAM,oCACrCO,KAAMN,IAAAA,WAAeK,MAASN,EAAM,mCACpCQ,KAAM,SACNE,IAAK,IAENP,gBAAgB,CACfC,QAAYJ,EAAM,yBAClBK,MAAOJ,IAAAA,WAAeK,MAASN,EAAM,+CACrCO,KAAMN,IAAAA,WAAeK,MAASN,EAAM,8CACpCQ,KAAM,YAEZ,G","sources":["webpack://@datlechin/flarum-link-preview/webpack/bootstrap","webpack://@datlechin/flarum-link-preview/webpack/runtime/compat get default export","webpack://@datlechin/flarum-link-preview/webpack/runtime/define property getters","webpack://@datlechin/flarum-link-preview/webpack/runtime/hasOwnProperty shorthand","webpack://@datlechin/flarum-link-preview/external root \"flarum.core.compat['admin/app']\"","webpack://@datlechin/flarum-link-preview/./src/admin/index.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/app'];","import app from 'flarum/admin/app';\n\nconst PREFIX = 'datlechin-link-preview';\n\napp.initializers.add('datlechin/flarum-link-preview', () => {\n app.extensionData\n .for(PREFIX)\n .registerSetting({\n setting: `${PREFIX}.enable_batch_requests`,\n label: app.translator.trans(`${PREFIX}.admin.settings.enable_batch_requests_label`),\n help: app.translator.trans(`${PREFIX}.admin.settings.enable_batch_requests_help`),\n type: 'checkbox',\n })\n .registerSetting({\n setting: `${PREFIX}.convert_media_urls`,\n label: app.translator.trans(`${PREFIX}.admin.settings.convert_media_urls_label`),\n help: app.translator.trans(`${PREFIX}.admin.settings.convert_media_urls_help`),\n type: 'checkbox',\n })\n .registerSetting({\n setting: `${PREFIX}.use_google_favicons`,\n label: app.translator.trans(`${PREFIX}.admin.settings.use_google_favicons_label`),\n help: app.translator.trans(`${PREFIX}.admin.settings.use_google_favicons_help`),\n type: 'checkbox',\n })\n .registerSetting({\n setting: `${PREFIX}.blacklist`,\n label: app.translator.trans(`${PREFIX}.admin.settings.blacklist_label`),\n help: app.translator.trans(`${PREFIX}.admin.settings.blacklist_help`),\n placeholder: app.translator.trans(`${PREFIX}.admin.settings.blacklist_placeholder`),\n type: 'textarea',\n })\n .registerSetting({\n setting: `${PREFIX}.whitelist`,\n label: app.translator.trans(`${PREFIX}.admin.settings.whitelist_label`),\n help: app.translator.trans(`${PREFIX}.admin.settings.whitelist_help`),\n placeholder: app.translator.trans(`${PREFIX}.admin.settings.whitelist_placeholder`),\n type: 'textarea',\n })\n .registerSetting({\n setting: `${PREFIX}.cache_time`,\n label: app.translator.trans(`${PREFIX}.admin.settings.cache_time_label`),\n help: app.translator.trans(`${PREFIX}.admin.settings.cache_time_help`),\n type: 'number',\n min: 0,\n })\n .registerSetting({\n setting: `${PREFIX}.open_links_in_new_tab`,\n label: app.translator.trans(`${PREFIX}.admin.settings.open_links_in_new_tab_label`),\n help: app.translator.trans(`${PREFIX}.admin.settings.open_links_in_new_tab_help`),\n type: 'checkbox',\n });\n});\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","flarum","core","compat","PREFIX","app","add","registerSetting","setting","label","trans","help","type","placeholder","min"],"sourceRoot":""} \ No newline at end of file diff --git a/js/dist/forum.js b/js/dist/forum.js index e3c700f..6167e9f 100644 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -1,2 +1,3 @@ -(()=>{var t={n:e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return t.d(n,{a:n}),n},d:(e,n)=>{for(var i in n)t.o(n,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)};(()=>{"use strict";const e=flarum.core.compat["forum/app"];var n=t.n(e);const i=flarum.core.compat["common/extend"],r=flarum.core.compat["forum/components/CommentPost"];var a=t.n(r);function o(t,e){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},o(t,e)}const l=flarum.core.compat["common/Component"];var s=t.n(l);const c=flarum.core.compat["common/helpers/icon"];var u=t.n(c);flarum.core.compat["common/components/Link"];const p=flarum.core.compat["common/utils/classList"];var f=t.n(p);const h=flarum.core.compat["common/components/LoadingIndicator"];var d=t.n(h),v=function(t){function e(){return t.apply(this,arguments)||this}var n,i;i=t,(n=e).prototype=Object.create(i.prototype),n.prototype.constructor=n,o(n,i);var r=e.prototype;return r.oninit=function(e){t.prototype.oninit.call(this,e);var n=e.attrs;this.loading=!0,this.link=n.link,this.link.classList.add("LinkPreview-captured"),this.linkAttributes=Object.assign.apply(Object,[{}].concat(Array.from(this.link.attributes,(function(t){var e,n=t.name,i=t.value;return(e={})[n]=i,e})))),this.linkClasses=this.linkAttributes.class||"",this.linkAttributes.target=n.openLinksInNewTab?"_blank":"_self",delete this.linkAttributes.class,this.data=null,this.useGoogleFavicons=n.useGoogleFavicons,this.fetchData()},r.view=function(){var t,e,n,i,r,a,o={loading:this.loading};return m("div",{className:f()("LinkPreview",o)},this.loading||this.getImage()?m("div",{className:"LinkPreview-image"},this.loading?m(d(),{display:"unset",containerClassName:f()("LinkPreview-loading",this.loading&&"active"),size:"small"}):m("img",{src:this.getImage(),"data-link-preview":!0})):null,m("div",{className:"LinkPreview-main"},m("div",{className:"LinkPreview-title"},this.getLink(null!=(t=null==(e=this.data)?void 0:e.title)?t:null==(n=this.data)?void 0:n.error)),m("div",{className:"LinkPreview-description"},this.loading?"":null!=(i=null==(r=this.data)?void 0:r.description)?i:""),m("div",{className:"LinkPreview-domain"},this.useGoogleFavicons?m("img",{src:this.getFavicon(),"data-link-preview":!0}):u()("fas fa-external-link-alt"),this.getLink(null==(a=this.data)?void 0:a.site_name))))},r.oncreate=function(t){this.link.parentNode.insertBefore(t.dom,this.link)},r.getLink=function(t){return m("a",Object.assign({},this.linkAttributes,{className:f()("LinkPreview-link",this.linkClasses)}),this.loading?this.getDomain():null!=t?t:this.getDomain())},r.getHref=function(){return this.link.href},r.getDomain=function(){return this.getHref().split("/")[2]},r.getImage=function(){var t;return(null==(t=this.data)?void 0:t.image)||this.getFavicon()},r.getFavicon=function(){return this.useGoogleFavicons?"https://www.google.com/s2/favicons?sz=64&domain_url="+this.getDomain():null},r.fetchData=function(){var t=this;app.request({url:app.forum.attribute("apiUrl")+"/datlechin-link-preview?url="+encodeURIComponent(this.getHref()),method:"GET"}).then((function(e){t.setData(e),t.loading=!1}))},r.setData=function(t){this.data=t,m.redraw()},e}(s());function g(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e);!(n=i()).done;){var r=n.value.replace(/[-\[\]\/{}()*+?.\\^$|]/g,"\\$&").replace("\\*",".*").replace("\\?",".");if(t.match(new RegExp(r,"i")))return!0}return!1},o=r("datlechin-link-preview.blacklist"),l=r("datlechin-link-preview.whitelist"),s=null!=(t=n().forum.attribute("datlechin-link-preview.convertMediaURLs"))&&t,c=null!=(e=n().forum.attribute("datlechin-link-preview.useGoogleFavicons"))&&e,u=null!=(i=n().forum.attribute("datlechin-link-preview.openLinksInNewTab"))&&i,p=[".PostMention",".UserMention",".LinkPreview-link",".LinkPreview-captured"].map((function(t){return":not("+t+")"})).join("");this.element.querySelectorAll(".Post-body a[rel]"+p).forEach((function(t){var e=t.href.replace(/^https?:\/\/(.+?)\/?$/i,"$1");l.length&&!a(e,l)||o.length&&a(e,o)||t.href.replace(/\/$/,"")!==t.textContent.replace(/\/$/,"")||s&&e.match(/\.(jpe?g|png|gif|svg|webp|mp3|mp4|m4a|wav)$/)||m.mount(t,{view:function(){return m(v,{link:t,useGoogleFavicons:c,openLinksInNewTab:u})}})}))}))}))})(),module.exports={}})(); +/*! For license information please see forum.js.LICENSE.txt */ +(()=>{var t={24:(t,e,r)=>{var n=r(735).default;function i(){"use strict";t.exports=i=function(){return r},t.exports.__esModule=!0,t.exports.default=t.exports;var e,r={},o=Object.prototype,a=o.hasOwnProperty,s=Object.defineProperty||function(t,e,r){t[e]=r.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",h=u.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(e){f=function(t,e,r){return t[e]=r}}function p(t,e,r,n){var i=e&&e.prototype instanceof b?e:b,o=Object.create(i.prototype),a=new F(n||[]);return s(o,"_invoke",{value:A(t,r,a)}),o}function v(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}r.wrap=p;var d="suspendedStart",m="suspendedYield",g="executing",y="completed",w={};function b(){}function k(){}function x(){}var L={};f(L,c,(function(){return this}));var E=Object.getPrototypeOf,_=E&&E(E(T([])));_&&_!==o&&a.call(_,c)&&(L=_);var P=x.prototype=b.prototype=Object.create(L);function O(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function j(t,e){function r(i,o,s,u){var c=v(t[i],t,o);if("throw"!==c.type){var l=c.arg,h=l.value;return h&&"object"==n(h)&&a.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,s,u)}),(function(t){r("throw",t,s,u)})):e.resolve(h).then((function(t){l.value=t,s(l)}),(function(t){return r("throw",t,s,u)}))}u(c.arg)}var i;s(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,i){r(t,n,e,i)}))}return i=i?i.then(o,o):o()}})}function A(t,r,n){var i=d;return function(o,a){if(i===g)throw Error("Generator is already running");if(i===y){if("throw"===o)throw a;return{value:e,done:!0}}for(n.method=o,n.arg=a;;){var s=n.delegate;if(s){var u=S(s,n);if(u){if(u===w)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===d)throw i=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=g;var c=v(t,r,n);if("normal"===c.type){if(i=n.done?y:m,c.arg===w)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=y,n.method="throw",n.arg=c.arg)}}}function S(t,r){var n=r.method,i=t.iterator[n];if(i===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,S(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),w;var o=v(i,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,w;var a=o.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,w):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,w)}function N(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function F(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(N,this),this.reset(!0)}function T(t){if(t||""===t){var r=t[c];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function r(){for(;++i=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var u=a.call(o,"catchLoc"),c=a.call(o,"finallyLoc");if(u&&c){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),C(r),w}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;C(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:T(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),w}},r}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports},735:t=>{function e(r){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(r)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},183:(t,e,r)=>{var n=r(24)();t.exports=n;try{regeneratorRuntime=n}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n](o,o.exports,r),o.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{"use strict";const t=flarum.core.compat["forum/app"];var e=r.n(t);const n=flarum.core.compat["common/extend"],i=flarum.core.compat["forum/components/CommentPost"];var o=r.n(i);function a(t,e){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},a(t,e)}const s=flarum.core.compat["common/Component"];var u=r.n(s);const c=flarum.core.compat["common/helpers/icon"];var l=r.n(c);const h=flarum.core.compat["common/utils/classList"];var f=r.n(h);const p=flarum.core.compat["common/components/LoadingIndicator"];var v=r.n(p);function d(t,e,r,n,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,i)}function g(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function a(t){d(o,n,i,a,s,"next",t)}function s(t){d(o,n,i,a,s,"throw",t)}a(void 0)}))}}var y=r(183),w=r.n(y),b=new Map;const k=new(function(){function t(){this.queue=void 0,this.timeout=void 0,this.processing=void 0,this.BATCH_DELAY=void 0,this.queue=new Map,this.timeout=null,this.processing=!1,this.BATCH_DELAY=50,this.setupCacheCleanup()}var r=t.prototype;return r.add=function(t,r){e().forum.attribute("datlechin-link-preview.enableBatchRequests")?b.has(t)?r(b.get(t)):(this.queue.has(t)||this.queue.set(t,[]),this.queue.get(t).push(r),this.scheduleProcessing()):this.fetchSingle(t,r)},r.scheduleProcessing=function(){var t=this;this.timeout||(this.timeout=setTimeout((function(){return t.process()}),this.BATCH_DELAY))},r.fetchSingle=function(){var t=g(w().mark((function t(r,n){var i;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e().request({url:e().forum.attribute("apiUrl")+"/datlechin-link-preview",method:"GET",params:{url:r}});case 3:i=t.sent,n(i),b.set(r,i),t.next=11;break;case 8:t.prev=8,t.t0=t.catch(0),n({error:"Failed to fetch preview"});case 11:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(e,r){return t.apply(this,arguments)}}(),r.process=function(){var t=g(w().mark((function t(){var e,r,n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.processing&&0!==this.queue.size){t.next=2;break}return t.abrupt("return");case 2:return this.processing=!0,this.timeout=null,e=Array.from(this.queue.keys()),r=Array.from(this.queue.values()),this.queue.clear(),t.prev=7,t.next=10,this.fetchBatch(e);case 10:n=t.sent,this.handleSuccess(n,r),t.next=17;break;case 14:t.prev=14,t.t0=t.catch(7),this.handleError(r);case 17:this.processing=!1,this.queue.size>0&&this.scheduleProcessing();case 19:case"end":return t.stop()}}),t,this,[[7,14]])})));return function(){return t.apply(this,arguments)}}(),r.fetchBatch=function(){var t=g(w().mark((function t(r){return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e().request({url:e().forum.attribute("apiUrl")+"/datlechin-link-preview/batch",method:"POST",body:{urls:r}});case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),r.handleSuccess=function(t,e){Object.entries(t).forEach((function(t,r){var n=t[0],i=t[1];b.set(n,i),e[r].forEach((function(t){return t(i)}))}))},r.handleError=function(t){var e={error:"Failed to fetch preview"};t.forEach((function(t){return t.forEach((function(t){return t(e)}))}))},r.setupCacheCleanup=function(){document.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState&&b.clear()}))},r.clearCache=function(){b.clear()},r.getCacheSize=function(){return b.size},t}());var x=function(t){function e(){for(var e,r=arguments.length,n=new Array(r),i=0;it.length)&&(e=t.length);for(var r=0,n=Array(e);r=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(e);!(r=n()).done;){var i=r.value.replace(/[-\[\]\/{}()*+?.\\^$|]/g,"\\$&").replace("\\*",".*").replace("\\?",".");if(t.match(new RegExp(i,"i")))return!0}return!1},a=i("datlechin-link-preview.blacklist"),s=i("datlechin-link-preview.whitelist"),u=null!=(t=e().forum.attribute("datlechin-link-preview.convertMediaURLs"))&&t,c=null!=(r=e().forum.attribute("datlechin-link-preview.useGoogleFavicons"))&&r,l=null!=(n=e().forum.attribute("datlechin-link-preview.openLinksInNewTab"))&&n,h=[".PostMention",".UserMention",".LinkPreview-link",".LinkPreview-captured"].map((function(t){return":not("+t+")"})).join("");this.element.querySelectorAll(".Post-body a[rel]"+h).forEach((function(t){var e,r,n=t.href.replace(/^https?:\/\/(.+?)\/?$/i,"$1");s.length&&!o(n,s)||a.length&&o(n,a)||t.href.replace(/\/$/,"")!==(null!=(e=null==(r=t.textContent)?void 0:r.replace(/\/$/,""))?e:"")||u&&n.match(/\.(jpe?g|png|gif|svg|webp|mp3|mp4|m4a|wav)$/)||m.mount(t,{view:function(){return m(x,{link:t,useGoogleFavicons:c,openLinksInNewTab:l})}})}))}))}))})(),module.exports={}})(); //# sourceMappingURL=forum.js.map \ No newline at end of file diff --git a/js/dist/forum.js.LICENSE.txt b/js/dist/forum.js.LICENSE.txt new file mode 100644 index 0000000..ae386fb --- /dev/null +++ b/js/dist/forum.js.LICENSE.txt @@ -0,0 +1 @@ +/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ diff --git a/js/dist/forum.js.map b/js/dist/forum.js.map index b2a4e60..f17b2f0 100644 --- a/js/dist/forum.js.map +++ b/js/dist/forum.js.map @@ -1 +1 @@ -{"version":3,"file":"forum.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAU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,KAAQG,EAAAC,KAAAE,MAAE,KACrBC,EADOJ,EAAApE,MAEVyE,QAAQ,0BAA2B,QACnCA,QAAQ,MAAO,MACfA,QAAQ,MAAO,KAClB,GAAIT,EAAOU,MAAM,IAAIC,OAAOH,EAAQ,MAClC,OAAO,CAEX,CACA,OAAO,CACT,EAEMI,EAAiBlB,EAA2B,oCAC5CmB,EAAiBnB,EAA2B,oCAC5CoB,EAAiF,OAAjEvB,EAAGb,IAAAA,MAAUI,UAAU,6CAA0CS,EACjFlD,EAAmF,OAAlEmD,EAAGd,IAAAA,MAAUI,UAAU,8CAA2CU,EACnFrD,EAAmF,OAAlEsD,EAAGf,IAAAA,MAAUI,UAAU,8CAA2CW,EACnFsB,EAAuB,CAAC,eAAgB,eAAgB,oBAAqB,yBAAyBnB,KAAI,SAACoB,GAAG,cAAaA,EAAG,OAAKC,KAAK,IAE9I/F,KAAKgG,QAAQC,iBAAiB,oBAAoBJ,GAAwBK,SAAQ,SAAChG,GACjF,IAAMiG,EAAgBjG,EAAKiD,KAAKoC,QAAQ,yBAA0B,MAG/DI,EAAeX,SAAWH,EAAOsB,EAAeR,IAChDD,EAAeV,QAAUH,EAAOsB,EAAeT,IAChDxF,EAAKiD,KAAKoC,QAAQ,MAAO,MAAQrF,EAAKkG,YAAYb,QAAQ,MAAO,KAK/DK,GAAoBO,EAAcX,MAAM,gDAI5C3D,EAAEwE,MAAMnG,EAAM,CACZmB,KAAM,WACJ,OAAOQ,EAAEvC,EAAa,CACpBY,KAAAA,EACAiB,kBAAmBA,EACnBF,kBAAmBA,GAEvB,GAEJ,GACF,GACF,G","sources":["webpack://@datlechin/flarum-link-preview/webpack/bootstrap","webpack://@datlechin/flarum-link-preview/webpack/runtime/compat get default export","webpack://@datlechin/flarum-link-preview/webpack/runtime/define property getters","webpack://@datlechin/flarum-link-preview/webpack/runtime/hasOwnProperty shorthand","webpack://@datlechin/flarum-link-preview/external root \"flarum.core.compat['forum/app']\"","webpack://@datlechin/flarum-link-preview/external root \"flarum.core.compat['common/extend']\"","webpack://@datlechin/flarum-link-preview/external root \"flarum.core.compat['forum/components/CommentPost']\"","webpack://@datlechin/flarum-link-preview/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@datlechin/flarum-link-preview/external root \"flarum.core.compat['common/Component']\"","webpack://@datlechin/flarum-link-preview/external root \"flarum.core.compat['common/helpers/icon']\"","webpack://@datlechin/flarum-link-preview/external root \"flarum.core.compat['common/components/Link']\"","webpack://@datlechin/flarum-link-preview/external root \"flarum.core.compat['common/utils/classList']\"","webpack://@datlechin/flarum-link-preview/external root \"flarum.core.compat['common/components/LoadingIndicator']\"","webpack://@datlechin/flarum-link-preview/./src/forum/components/LinkPreview.js","webpack://@datlechin/flarum-link-preview/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@datlechin/flarum-link-preview/./src/forum/index.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/CommentPost'];","function _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, _setPrototypeOf(t, e);\n}\nexport { _setPrototypeOf as default };","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Component'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/icon'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Link'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/classList'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/LoadingIndicator'];","import Component from 'flarum/common/Component';\nimport icon from 'flarum/common/helpers/icon';\nimport Link from 'flarum/common/components/Link';\nimport classList from 'flarum/common/utils/classList';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\n\nexport default class LinkPreview extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n\n const attrs = vnode.attrs;\n\n this.loading = true;\n this.link = attrs.link;\n this.link.classList.add('LinkPreview-captured');\n this.linkAttributes = Object.assign({}, ...Array.from(this.link.attributes, ({ name, value }) => ({ [name]: value })));\n this.linkClasses = this.linkAttributes.class || '';\n this.linkAttributes.target = attrs.openLinksInNewTab ? '_blank' : '_self';\n delete this.linkAttributes.class;\n this.data = null;\n this.useGoogleFavicons = attrs.useGoogleFavicons;\n\n this.fetchData();\n }\n\n view() {\n const classes = {\n loading: this.loading,\n };\n\n return (\n
\n {this.loading || this.getImage() ? (\n
\n {this.loading ? (\n \n ) : (\n \n )}\n
\n ) : null}\n
\n
{this.getLink(this.data?.title ?? this.data?.error)}
\n
{this.loading ? '' : this.data?.description ?? ''}
\n
\n {this.useGoogleFavicons ? : icon('fas fa-external-link-alt')}\n {this.getLink(this.data?.site_name)}\n
\n
\n
\n );\n }\n\n oncreate(vnode) {\n this.link.parentNode.insertBefore(vnode.dom, this.link);\n }\n\n getLink(text) {\n return (\n \n {this.loading ? this.getDomain() : text ?? this.getDomain()}\n \n );\n }\n\n getHref() {\n return this.link.href;\n }\n\n getDomain() {\n return this.getHref().split('/')[2];\n }\n\n getImage() {\n return this.data?.image || this.getFavicon();\n }\n\n getFavicon() {\n return this.useGoogleFavicons ? `https://www.google.com/s2/favicons?sz=64&domain_url=${this.getDomain()}` : null;\n }\n\n fetchData() {\n app\n .request({\n url: `${app.forum.attribute('apiUrl')}/datlechin-link-preview?url=${encodeURIComponent(this.getHref())}`,\n method: 'GET',\n })\n .then((data) => {\n this.setData(data);\n this.loading = false;\n });\n }\n\n setData(data) {\n this.data = data;\n m.redraw();\n }\n}\n","import setPrototypeOf from \"./setPrototypeOf.js\";\nfunction _inheritsLoose(t, o) {\n t.prototype = Object.create(o.prototype), t.prototype.constructor = t, setPrototypeOf(t, o);\n}\nexport { _inheritsLoose as default };","import app from 'flarum/forum/app';\nimport { extend } from 'flarum/common/extend';\nimport CommentPost from 'flarum/forum/components/CommentPost';\nimport LinkPreview from './components/LinkPreview';\n\napp.initializers.add('datlechin/flarum-link-preview', () => {\n extend(CommentPost.prototype, 'refreshContent', function () {\n const getMultiDimensionalSetting = (key) => {\n const setting = app.forum.attribute(key);\n return setting ? setting.split(/[,\\n]/).map((item) => item.trim()) : [];\n };\n\n const inList = (needle, haystack) => {\n if (0 === haystack.length) {\n return false;\n }\n if (haystack.includes(needle)) {\n return true;\n }\n for (const item of haystack) {\n const quoted = item\n .replace(/[-\\[\\]\\/{}()*+?.\\\\^$|]/g, '\\\\$&')\n .replace('\\\\*', '.*')\n .replace('\\\\?', '.');\n if (needle.match(new RegExp(quoted, 'i'))) {\n return true;\n }\n }\n return false;\n };\n\n const blacklistArray = getMultiDimensionalSetting('datlechin-link-preview.blacklist');\n const whitelistArray = getMultiDimensionalSetting('datlechin-link-preview.whitelist');\n const convertMediaUrls = app.forum.attribute('datlechin-link-preview.convertMediaURLs') ?? false;\n const useGoogleFavicons = app.forum.attribute('datlechin-link-preview.useGoogleFavicons') ?? false;\n const openLinksInNewTab = app.forum.attribute('datlechin-link-preview.openLinksInNewTab') ?? false;\n const linkSelectorExcludes = ['.PostMention', '.UserMention', '.LinkPreview-link', '.LinkPreview-captured'].map((cls) => `:not(${cls})`).join('');\n\n this.element.querySelectorAll(`.Post-body a[rel]${linkSelectorExcludes}`).forEach((link) => {\n const normalizedUrl = link.href.replace(/^https?:\\/\\/(.+?)\\/?$/i, '$1');\n\n if (\n (whitelistArray.length && !inList(normalizedUrl, whitelistArray)) ||\n (blacklistArray.length && inList(normalizedUrl, blacklistArray)) ||\n link.href.replace(/\\/$/, '') !== link.textContent.replace(/\\/$/, '')\n ) {\n return;\n }\n\n if (convertMediaUrls && normalizedUrl.match(/\\.(jpe?g|png|gif|svg|webp|mp3|mp4|m4a|wav)$/)) {\n return;\n }\n\n m.mount(link, {\n view: function () {\n return m(LinkPreview, {\n link,\n useGoogleFavicons: useGoogleFavicons,\n openLinksInNewTab: openLinksInNewTab,\n });\n },\n });\n });\n });\n});\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","flarum","core","compat","_setPrototypeOf","t","e","setPrototypeOf","bind","__proto__","LinkPreview","_Component","apply","arguments","create","constructor","_proto","oninit","vnode","attrs","this","loading","link","classList","add","linkAttributes","assign","concat","Array","from","attributes","_ref","_ref2","name","value","linkClasses","target","openLinksInNewTab","data","useGoogleFavicons","fetchData","view","_this$data$title","_this$data","_this$data2","_this$data$descriptio","_this$data3","_this$data4","classes","m","className","getImage","LoadingIndicator","display","containerClassName","size","src","getLink","title","error","description","getFavicon","icon","site_name","oncreate","parentNode","insertBefore","dom","text","getDomain","getHref","href","split","_this$data5","image","_this","app","request","url","forum","attribute","encodeURIComponent","method","then","setData","redraw","Component","extend","CommentPost","_app$forum$attribute","_app$forum$attribute2","_app$forum$attribute3","getMultiDimensionalSetting","setting","map","item","trim","inList","needle","haystack","length","includes","_step","_iterator","_createForOfIteratorHelperLoose","done","quoted","replace","match","RegExp","blacklistArray","whitelistArray","convertMediaUrls","linkSelectorExcludes","cls","join","element","querySelectorAll","forEach","normalizedUrl","textContent","mount"],"sourceRoot":""} \ No newline at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,KAAQE,EAAAC,KAAA9M,MAAE,KACrBgN,EADOH,EAAA3P,MAEV+P,QAAQ,0BAA2B,QACnCA,QAAQ,MAAO,MACfA,QAAQ,MAAO,KAClB,GAAIP,EAAOQ,MAAM,IAAIC,OAAOH,EAAQ,MAClC,OAAO,CAEX,CACA,OAAO,CACT,EAEMI,EAAiBhB,EAA2B,oCAC5CiB,EAAiBjB,EAA2B,oCAC5CkB,EAA0F,OAA1ErB,EAAG3G,IAAAA,MAAUC,UAAmB,6CAA0C0G,EAC1FlD,EAA4F,OAA3EmD,EAAG5G,IAAAA,MAAUC,UAAmB,8CAA2C2G,EAC5F1C,EAA4F,OAA3E2C,EAAG7G,IAAAA,MAAUC,UAAmB,8CAA2C4G,EAC5FoB,EAAuB,CAAC,eAAgB,eAAgB,oBAAqB,yBAAyBjB,KAAI,SAACkB,GAAG,cAAaA,EAAG,OAAKC,KAAK,IAE9IzO,KAAK0O,QAAQC,iBAAgB,oBAAwCJ,GAAwBhO,SAAQ,SAACqJ,GAAS,IAAAgF,EAAAC,EACvGC,EAAgBlF,EAAK0C,KAAK2B,QAAQ,yBAA0B,MAG/DI,EAAe9L,SAAWkL,EAAOqB,EAAeT,IAChDD,EAAe7L,QAAUkL,EAAOqB,EAAeV,IAChDxE,EAAK0C,KAAK2B,QAAQ,MAAO,OAA6C,OAA1CW,EAAsB,OAAtBC,EAAMjF,EAAKmF,kBAAW,EAAhBF,EAAkBZ,QAAQ,MAAO,KAAGW,EAAI,KAKxEN,GAAoBQ,EAAcZ,MAAM,gDAI5ChD,EAAE8D,MAAMpF,EAAM,CACZc,KAAM,WACJ,OAAOQ,EAAE7B,EAAa,CACpBO,KAAAA,EACAG,kBAAmBA,EACnBS,kBAAmBA,GAEvB,GAEJ,GACF,GACF","sources":["webpack://@datlechin/flarum-link-preview/./node_modules/@babel/runtime/helpers/regeneratorRuntime.js","webpack://@datlechin/flarum-link-preview/./node_modules/@babel/runtime/helpers/typeof.js","webpack://@datlechin/flarum-link-preview/./node_modules/@babel/runtime/regenerator/index.js","webpack://@datlechin/flarum-link-preview/webpack/bootstrap","webpack://@datlechin/flarum-link-preview/webpack/runtime/compat get default export","webpack://@datlechin/flarum-link-preview/webpack/runtime/define property getters","webpack://@datlechin/flarum-link-preview/webpack/runtime/hasOwnProperty shorthand","webpack://@datlechin/flarum-link-preview/external root \"flarum.core.compat['forum/app']\"","webpack://@datlechin/flarum-link-preview/external root \"flarum.core.compat['common/extend']\"","webpack://@datlechin/flarum-link-preview/external root \"flarum.core.compat['forum/components/CommentPost']\"","webpack://@datlechin/flarum-link-preview/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@datlechin/flarum-link-preview/external root \"flarum.core.compat['common/Component']\"","webpack://@datlechin/flarum-link-preview/external root \"flarum.core.compat['common/helpers/icon']\"","webpack://@datlechin/flarum-link-preview/external root \"flarum.core.compat['common/utils/classList']\"","webpack://@datlechin/flarum-link-preview/external root \"flarum.core.compat['common/components/LoadingIndicator']\"","webpack://@datlechin/flarum-link-preview/./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js","webpack://@datlechin/flarum-link-preview/./src/forum/utils/batch-manager.ts","webpack://@datlechin/flarum-link-preview/./src/forum/components/LinkPreview.tsx","webpack://@datlechin/flarum-link-preview/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@datlechin/flarum-link-preview/./src/forum/index.ts"],"sourcesContent":["var _typeof = require(\"./typeof.js\")[\"default\"];\nfunction _regeneratorRuntime() {\n \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */\n module.exports = _regeneratorRuntime = function _regeneratorRuntime() {\n return e;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n var t,\n e = {},\n r = Object.prototype,\n n = r.hasOwnProperty,\n o = Object.defineProperty || function (t, e, r) {\n t[e] = r.value;\n },\n i = \"function\" == typeof Symbol ? Symbol : {},\n a = i.iterator || \"@@iterator\",\n c = i.asyncIterator || \"@@asyncIterator\",\n u = i.toStringTag || \"@@toStringTag\";\n function define(t, e, r) {\n return Object.defineProperty(t, e, {\n value: r,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }), t[e];\n }\n try {\n define({}, \"\");\n } catch (t) {\n define = function define(t, e, r) {\n return t[e] = r;\n };\n }\n function wrap(t, e, r, n) {\n var i = e && e.prototype instanceof Generator ? e : Generator,\n a = Object.create(i.prototype),\n c = new Context(n || []);\n return o(a, \"_invoke\", {\n value: makeInvokeMethod(t, r, c)\n }), a;\n }\n function tryCatch(t, e, r) {\n try {\n return {\n type: \"normal\",\n arg: t.call(e, r)\n };\n } catch (t) {\n return {\n type: \"throw\",\n arg: t\n };\n }\n }\n e.wrap = wrap;\n var h = \"suspendedStart\",\n l = \"suspendedYield\",\n f = \"executing\",\n s = \"completed\",\n y = {};\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n var p = {};\n define(p, a, function () {\n return this;\n });\n var d = Object.getPrototypeOf,\n v = d && d(d(values([])));\n v && v !== r && n.call(v, a) && (p = v);\n var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);\n function defineIteratorMethods(t) {\n [\"next\", \"throw\", \"return\"].forEach(function (e) {\n define(t, e, function (t) {\n return this._invoke(e, t);\n });\n });\n }\n function AsyncIterator(t, e) {\n function invoke(r, o, i, a) {\n var c = tryCatch(t[r], t, o);\n if (\"throw\" !== c.type) {\n var u = c.arg,\n h = u.value;\n return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) {\n invoke(\"next\", t, i, a);\n }, function (t) {\n invoke(\"throw\", t, i, a);\n }) : e.resolve(h).then(function (t) {\n u.value = t, i(u);\n }, function (t) {\n return invoke(\"throw\", t, i, a);\n });\n }\n a(c.arg);\n }\n var r;\n o(this, \"_invoke\", {\n value: function value(t, n) {\n function callInvokeWithMethodAndArg() {\n return new e(function (e, r) {\n invoke(t, n, e, r);\n });\n }\n return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();\n }\n });\n }\n function makeInvokeMethod(e, r, n) {\n var o = h;\n return function (i, a) {\n if (o === f) throw Error(\"Generator is already running\");\n if (o === s) {\n if (\"throw\" === i) throw a;\n return {\n value: t,\n done: !0\n };\n }\n for (n.method = i, n.arg = a;;) {\n var c = n.delegate;\n if (c) {\n var u = maybeInvokeDelegate(c, n);\n if (u) {\n if (u === y) continue;\n return u;\n }\n }\n if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) {\n if (o === h) throw o = s, n.arg;\n n.dispatchException(n.arg);\n } else \"return\" === n.method && n.abrupt(\"return\", n.arg);\n o = f;\n var p = tryCatch(e, r, n);\n if (\"normal\" === p.type) {\n if (o = n.done ? s : l, p.arg === y) continue;\n return {\n value: p.arg,\n done: n.done\n };\n }\n \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg);\n }\n };\n }\n function maybeInvokeDelegate(e, r) {\n var n = r.method,\n o = e.iterator[n];\n if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y;\n var i = tryCatch(o, e.iterator, r.arg);\n if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y;\n var a = i.arg;\n return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y);\n }\n function pushTryEntry(t) {\n var e = {\n tryLoc: t[0]\n };\n 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);\n }\n function resetTryEntry(t) {\n var e = t.completion || {};\n e.type = \"normal\", delete e.arg, t.completion = e;\n }\n function Context(t) {\n this.tryEntries = [{\n tryLoc: \"root\"\n }], t.forEach(pushTryEntry, this), this.reset(!0);\n }\n function values(e) {\n if (e || \"\" === e) {\n var r = e[a];\n if (r) return r.call(e);\n if (\"function\" == typeof e.next) return e;\n if (!isNaN(e.length)) {\n var o = -1,\n i = function next() {\n for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;\n return next.value = t, next.done = !0, next;\n };\n return i.next = i;\n }\n }\n throw new TypeError(_typeof(e) + \" is not iterable\");\n }\n return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", {\n value: GeneratorFunctionPrototype,\n configurable: !0\n }), o(GeneratorFunctionPrototype, \"constructor\", {\n value: GeneratorFunction,\n configurable: !0\n }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) {\n var e = \"function\" == typeof t && t.constructor;\n return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name));\n }, e.mark = function (t) {\n return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t;\n }, e.awrap = function (t) {\n return {\n __await: t\n };\n }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {\n return this;\n }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {\n void 0 === i && (i = Promise);\n var a = new AsyncIterator(wrap(t, r, n, o), i);\n return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {\n return t.done ? t.value : a.next();\n });\n }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () {\n return this;\n }), define(g, \"toString\", function () {\n return \"[object Generator]\";\n }), e.keys = function (t) {\n var e = Object(t),\n r = [];\n for (var n in e) r.push(n);\n return r.reverse(), function next() {\n for (; r.length;) {\n var t = r.pop();\n if (t in e) return next.value = t, next.done = !1, next;\n }\n return next.done = !0, next;\n };\n }, e.values = values, Context.prototype = {\n constructor: Context,\n reset: function reset(e) {\n if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);\n },\n stop: function stop() {\n this.done = !0;\n var t = this.tryEntries[0].completion;\n if (\"throw\" === t.type) throw t.arg;\n return this.rval;\n },\n dispatchException: function dispatchException(e) {\n if (this.done) throw e;\n var r = this;\n function handle(n, o) {\n return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o;\n }\n for (var o = this.tryEntries.length - 1; o >= 0; --o) {\n var i = this.tryEntries[o],\n a = i.completion;\n if (\"root\" === i.tryLoc) return handle(\"end\");\n if (i.tryLoc <= this.prev) {\n var c = n.call(i, \"catchLoc\"),\n u = n.call(i, \"finallyLoc\");\n if (c && u) {\n if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);\n if (this.prev < i.finallyLoc) return handle(i.finallyLoc);\n } else if (c) {\n if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);\n } else {\n if (!u) throw Error(\"try statement without catch or finally\");\n if (this.prev < i.finallyLoc) return handle(i.finallyLoc);\n }\n }\n }\n },\n abrupt: function abrupt(t, e) {\n for (var r = this.tryEntries.length - 1; r >= 0; --r) {\n var o = this.tryEntries[r];\n if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) {\n var i = o;\n break;\n }\n }\n i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);\n var a = i ? i.completion : {};\n return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a);\n },\n complete: function complete(t, e) {\n if (\"throw\" === t.type) throw t.arg;\n return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y;\n },\n finish: function finish(t) {\n for (var e = this.tryEntries.length - 1; e >= 0; --e) {\n var r = this.tryEntries[e];\n if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;\n }\n },\n \"catch\": function _catch(t) {\n for (var e = this.tryEntries.length - 1; e >= 0; --e) {\n var r = this.tryEntries[e];\n if (r.tryLoc === t) {\n var n = r.completion;\n if (\"throw\" === n.type) {\n var o = n.arg;\n resetTryEntry(r);\n }\n return o;\n }\n }\n throw Error(\"illegal catch attempt\");\n },\n delegateYield: function delegateYield(e, r, n) {\n return this.delegate = {\n iterator: values(e),\n resultName: r,\n nextLoc: n\n }, \"next\" === this.method && (this.arg = t), y;\n }\n }, e;\n}\nmodule.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return module.exports = _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports, _typeof(o);\n}\nmodule.exports = _typeof, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","// TODO(Babel 8): Remove this file.\n\nvar runtime = require(\"../helpers/regeneratorRuntime\")();\nmodule.exports = runtime;\n\n// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/CommentPost'];","function _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, _setPrototypeOf(t, e);\n}\nexport { _setPrototypeOf as default };","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Component'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/icon'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/classList'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/LoadingIndicator'];","function asyncGeneratorStep(n, t, e, r, o, a, c) {\n try {\n var i = n[a](c),\n u = i.value;\n } catch (n) {\n return void e(n);\n }\n i.done ? t(u) : Promise.resolve(u).then(r, o);\n}\nfunction _asyncToGenerator(n) {\n return function () {\n var t = this,\n e = arguments;\n return new Promise(function (r, o) {\n var a = n.apply(t, e);\n function _next(n) {\n asyncGeneratorStep(a, r, o, _next, _throw, \"next\", n);\n }\n function _throw(n) {\n asyncGeneratorStep(a, r, o, _next, _throw, \"throw\", n);\n }\n _next(void 0);\n });\n };\n}\nexport { _asyncToGenerator as default };","import app from 'flarum/forum/app';\n\nconst linkPreviewCache = new Map();\n\nclass LinkPreviewBatchManager {\n private queue: Map;\n private timeout: NodeJS.Timeout | null;\n private processing: boolean;\n private readonly BATCH_DELAY: number;\n\n constructor() {\n this.queue = new Map();\n this.timeout = null;\n this.processing = false;\n this.BATCH_DELAY = 50; // ms\n\n this.setupCacheCleanup();\n }\n\n add(url: string, callback: Function) {\n const enableBatch = app.forum.attribute('datlechin-link-preview.enableBatchRequests');\n\n if (!enableBatch) {\n this.fetchSingle(url, callback);\n return;\n }\n\n if (linkPreviewCache.has(url)) {\n callback(linkPreviewCache.get(url));\n return;\n }\n\n if (!this.queue.has(url)) {\n this.queue.set(url, []);\n }\n this.queue.get(url)!.push(callback);\n\n this.scheduleProcessing();\n }\n\n scheduleProcessing() {\n if (!this.timeout) {\n this.timeout = setTimeout(() => this.process(), this.BATCH_DELAY);\n }\n }\n\n async fetchSingle(url: string, callback: Function) {\n try {\n const response = await app.request({\n url: `${app.forum.attribute('apiUrl')}/datlechin-link-preview`,\n method: 'GET',\n params: { url },\n });\n\n callback(response);\n linkPreviewCache.set(url, response);\n } catch (error) {\n callback({ error: 'Failed to fetch preview' });\n }\n }\n\n async process() {\n if (this.processing || this.queue.size === 0) return;\n\n this.processing = true;\n this.timeout = null;\n\n const urls = Array.from(this.queue.keys());\n const callbacks = Array.from(this.queue.values());\n this.queue.clear();\n\n try {\n const response = await this.fetchBatch(urls);\n this.handleSuccess(response, callbacks);\n } catch (error) {\n this.handleError(callbacks);\n }\n\n this.processing = false;\n\n if (this.queue.size > 0) {\n this.scheduleProcessing();\n }\n }\n\n async fetchBatch(urls: string[]): Promise {\n return await app.request({\n url: `${app.forum.attribute('apiUrl')}/datlechin-link-preview/batch`,\n method: 'POST',\n body: { urls },\n });\n }\n\n handleSuccess(response: any, callbacks: Function[][]) {\n Object.entries(response).forEach(([url, data], index) => {\n linkPreviewCache.set(url, data);\n callbacks[index].forEach((cb) => cb(data));\n });\n }\n\n handleError(callbacks: Function[][]) {\n const errorData = { error: 'Failed to fetch preview' };\n callbacks.forEach((cbs) => cbs.forEach((cb) => cb(errorData)));\n }\n\n setupCacheCleanup() {\n document.addEventListener('visibilitychange', () => {\n if (document.visibilityState === 'hidden') {\n linkPreviewCache.clear();\n }\n });\n }\n\n clearCache() {\n linkPreviewCache.clear();\n }\n\n getCacheSize(): number {\n return linkPreviewCache.size;\n }\n}\n\nexport default new LinkPreviewBatchManager();\n","import Component from 'flarum/common/Component';\nimport icon from 'flarum/common/helpers/icon';\nimport classList from 'flarum/common/utils/classList';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\nimport batchManager from '../utils/batch-manager';\nimport type Mithril from 'mithril';\n\ninterface LinkPreviewAttrs {\n link: HTMLAnchorElement;\n openLinksInNewTab: boolean;\n useGoogleFavicons: boolean;\n}\n\ninterface LinkPreviewData {\n title?: string;\n description?: string;\n site_name?: string;\n image?: string;\n error?: string;\n}\n\nexport default class LinkPreview extends Component {\n loading!: boolean;\n link!: HTMLAnchorElement;\n linkAttributes!: { [key: string]: string };\n linkClasses!: string;\n data!: LinkPreviewData | null;\n useGoogleFavicons!: boolean;\n\n oninit(vnode: Mithril.Vnode) {\n super.oninit(vnode);\n\n const attrs = vnode.attrs;\n\n this.loading = true;\n this.link = attrs.link;\n this.link.classList.add('LinkPreview-captured');\n this.linkAttributes = Object.assign({}, ...Array.from(this.link.attributes, ({ name, value }) => ({ [name]: value })));\n this.linkClasses = this.linkAttributes.class || '';\n this.linkAttributes.target = attrs.openLinksInNewTab ? '_blank' : '_self';\n delete this.linkAttributes.class;\n this.data = null;\n this.useGoogleFavicons = attrs.useGoogleFavicons;\n\n this.fetchData();\n }\n\n view() {\n const classes = {\n loading: this.loading,\n };\n\n return (\n
\n {this.loading || this.getImage() ? (\n
\n {this.loading ? (\n \n ) : (\n \n )}\n
\n ) : null}\n
\n
{this.getLink(this.data?.title ?? this.data?.error)}
\n
{this.loading ? '' : (this.data?.description ?? '')}
\n
\n {this.useGoogleFavicons ? : icon('fas fa-external-link-alt')}\n {this.getLink(this.data?.site_name)}\n
\n
\n
\n );\n }\n\n oncreate(vnode: Mithril.VnodeDOM) {\n if (this.link.parentNode) {\n this.link.parentNode.insertBefore(vnode.dom, this.link);\n }\n }\n\n getLink(text?: string) {\n return (\n \n {this.loading ? this.getDomain() : (text ?? this.getDomain())}\n \n );\n }\n\n getHref() {\n return this.link.href;\n }\n\n getDomain() {\n return this.getHref().split('/')[2];\n }\n\n getImage() {\n return this.data?.image || this.getFavicon();\n }\n\n getFavicon() {\n return this.useGoogleFavicons ? `https://www.google.com/s2/favicons?sz=64&domain_url=${this.getDomain()}` : null;\n }\n\n fetchData() {\n batchManager.add(this.getHref(), (data: LinkPreviewData) => {\n this.setData(data);\n this.loading = false;\n m.redraw();\n });\n }\n\n setData(data: LinkPreviewData) {\n this.data = data;\n m.redraw();\n }\n}\n","import setPrototypeOf from \"./setPrototypeOf.js\";\nfunction _inheritsLoose(t, o) {\n t.prototype = Object.create(o.prototype), t.prototype.constructor = t, setPrototypeOf(t, o);\n}\nexport { _inheritsLoose as default };","import app from 'flarum/forum/app';\nimport { extend } from 'flarum/common/extend';\nimport CommentPost from 'flarum/forum/components/CommentPost';\nimport LinkPreview from './components/LinkPreview';\n\napp.initializers.add('datlechin/flarum-link-preview', () => {\n extend(CommentPost.prototype, 'refreshContent', function () {\n const getMultiDimensionalSetting = (key: string): string[] => {\n const setting = app.forum.attribute(key);\n return setting ? setting.split(/[,\\n]/).map((item) => item.trim()) : [];\n };\n\n const inList = (needle: string, haystack: string[]): boolean => {\n if (haystack.length === 0) {\n return false;\n }\n if (haystack.includes(needle)) {\n return true;\n }\n for (const item of haystack) {\n const quoted = item\n .replace(/[-\\[\\]\\/{}()*+?.\\\\^$|]/g, '\\\\$&')\n .replace('\\\\*', '.*')\n .replace('\\\\?', '.');\n if (needle.match(new RegExp(quoted, 'i'))) {\n return true;\n }\n }\n return false;\n };\n\n const blacklistArray = getMultiDimensionalSetting('datlechin-link-preview.blacklist');\n const whitelistArray = getMultiDimensionalSetting('datlechin-link-preview.whitelist');\n const convertMediaUrls = app.forum.attribute('datlechin-link-preview.convertMediaURLs') ?? false;\n const useGoogleFavicons = app.forum.attribute('datlechin-link-preview.useGoogleFavicons') ?? false;\n const openLinksInNewTab = app.forum.attribute('datlechin-link-preview.openLinksInNewTab') ?? false;\n const linkSelectorExcludes = ['.PostMention', '.UserMention', '.LinkPreview-link', '.LinkPreview-captured'].map((cls) => `:not(${cls})`).join('');\n\n this.element.querySelectorAll(`.Post-body a[rel]${linkSelectorExcludes}`).forEach((link) => {\n const normalizedUrl = link.href.replace(/^https?:\\/\\/(.+?)\\/?$/i, '$1');\n\n if (\n (whitelistArray.length && !inList(normalizedUrl, whitelistArray)) ||\n (blacklistArray.length && inList(normalizedUrl, blacklistArray)) ||\n link.href.replace(/\\/$/, '') !== (link.textContent?.replace(/\\/$/, '') ?? '')\n ) {\n return;\n }\n\n if (convertMediaUrls && normalizedUrl.match(/\\.(jpe?g|png|gif|svg|webp|mp3|mp4|m4a|wav)$/)) {\n return;\n }\n\n m.mount(link, {\n view: function () {\n return m(LinkPreview, {\n link,\n useGoogleFavicons: useGoogleFavicons,\n openLinksInNewTab: openLinksInNewTab,\n });\n },\n });\n });\n });\n});\n"],"names":["_typeof","require","_regeneratorRuntime","module","exports","e","__esModule","t","r","Object","prototype","n","hasOwnProperty","o","defineProperty","value","i","Symbol","a","iterator","c","asyncIterator","u","toStringTag","define","enumerable","configurable","writable","wrap","Generator","create","Context","makeInvokeMethod","tryCatch","type","arg","call","h","l","f","s","y","GeneratorFunction","GeneratorFunctionPrototype","p","this","d","getPrototypeOf","v","values","g","defineIteratorMethods","forEach","_invoke","AsyncIterator","invoke","resolve","__await","then","callInvokeWithMethodAndArg","Error","done","method","delegate","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","TypeError","resultName","next","nextLoc","pushTryEntry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","isNaN","length","displayName","isGeneratorFunction","constructor","name","mark","setPrototypeOf","__proto__","awrap","async","Promise","keys","reverse","pop","prev","charAt","slice","stop","rval","handle","complete","finish","delegateYield","runtime","regeneratorRuntime","accidentalStrictMode","globalThis","Function","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","getter","definition","key","get","obj","prop","flarum","core","compat","_setPrototypeOf","bind","asyncGeneratorStep","_asyncToGenerator","arguments","apply","_next","_throw","linkPreviewCache","Map","LinkPreviewBatchManager","queue","timeout","processing","BATCH_DELAY","setupCacheCleanup","_proto","add","url","callback","app","attribute","has","set","scheduleProcessing","fetchSingle","_this","setTimeout","process","_fetchSingle","_callee","response","_context","params","t0","error","_x","_x2","_process","_callee2","urls","callbacks","_context2","size","Array","from","clear","fetchBatch","handleSuccess","handleError","_fetchBatch","_callee3","_context3","body","_x3","entries","_ref","index","data","cb","errorData","cbs","document","addEventListener","visibilityState","clearCache","getCacheSize","LinkPreview","_Component","_len","args","_key","concat","loading","link","linkAttributes","linkClasses","useGoogleFavicons","oninit","vnode","attrs","classList","assign","attributes","_ref2","target","openLinksInNewTab","fetchData","view","_this$data$title","_this$data","_this$data2","_this$data$descriptio","_this$data3","_this$data4","classes","m","className","getImage","LoadingIndicator","display","containerClassName","src","getLink","title","description","getFavicon","icon","site_name","oncreate","parentNode","insertBefore","dom","text","getDomain","getHref","href","split","_this$data5","image","_this2","batchManager","setData","redraw","Component","extend","CommentPost","_app$forum$attribute","_app$forum$attribute2","_app$forum$attribute3","getMultiDimensionalSetting","setting","map","item","trim","inList","needle","haystack","includes","_step","_iterator","_createForOfIteratorHelperLoose","quoted","replace","match","RegExp","blacklistArray","whitelistArray","convertMediaUrls","linkSelectorExcludes","cls","join","element","querySelectorAll","_link$textContent$rep","_link$textContent","normalizedUrl","textContent","mount"],"sourceRoot":""} \ No newline at end of file