/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/iframely@2.5.0/lib/core.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
import*as _ from"underscore";import*as urlLib from"url";import*as pluginUtils from"./loader/utils.js";import*as utils from"./utils.js";import log from"../logging.js";import*as oembedUtils from"./oembed.js";import*as pluginLoader from"./loader/pluginLoader.js";import requestWrapper from"./request.js";import{cache}from"./cache.js";import*as htmlUtils from"./html-utils.js";import*as metaUtils from"./plugins/system/meta/utils.js";import mediaPlugin from"./plugins/validators/media.js";const plugins=pluginLoader._plugins,pluginsModules=pluginLoader._pluginsModules,providedParamsDict=pluginLoader._providedParamsDict,pluginsList=pluginLoader._pluginsList,usedParamsDict=pluginLoader._usedParamsDict,postPluginsList=pluginLoader._postPluginsList,templates=pluginLoader._templates,PLUGIN_METHODS=pluginUtils.PLUGIN_METHODS,utilsModules={utils:utils,htmlUtils:htmlUtils,metaUtils:metaUtils,plugins:pluginsModules,prepareLinkMedia:mediaPlugin.prepareLink,log:log,cache:cache};function findPluginMethods(e,r,t,i,n,a,o,s,l){if(!(e in o)){var u=plugins[e];if(u){if(o[u.id]=!0,!l){var d=u.module.mixins;if(d)for(var m=0;m<d.length;m++)findPluginMethods(d[m],r,t,i,n,a,o,s)}var f=i[u.id]=i[u.id]||{};for(m=0;m<PLUGIN_METHODS.length;m++){var c=PLUGIN_METHODS[m];if(c in u.methods){if(f&&c in f)continue;var p=u.methods[c];if(l&&l.length>0&&0===_.intersection(p,l).length)continue;for(var g=_.difference(p,r),h=!1,v=0;v<g.length&&!h;v++){var O=g[v];("__"===O.substr(0,2)||/error$/i.test(O))&&(h=!0)}if(h)continue;var P=g.indexOf("urlMatch");if(P>-1){if(!t[e])continue;g.splice(P,1)}if(g.length>0){var R=findPluginsForAbsentParams(g,s,n);for(v=0;v<R.length;v++){findPluginMethods(R[v],r,t,i,n,a,o,s)}}else f[c]=1,a.push({pluginId:e,name:c,handle:u.module[c]})}}}}}function runMethods(e,r,t,i,n){for(var a=[],o=0;o<e.length;o++)!function(){var s=e[o],l=plugins[s.pluginId],u=l.methods[s.name],d=[];if(i.debug)var m=utils.createTimer();for(var f,c=!1,p=function(e,r){if(f)clearTimeout(f),f=null;else if(c)return;if(r)for(var t in r){var o=r[t];(null==o||"number"==typeof o&&isNaN(o))&&delete r[t]}var l={method:s,data:r};if(i.debug&&(l.time=m()),e){if(e.code){var u=e.code;(e={})[SYS_ERRORS.responseStatusCode]=u}e instanceof Error&&(e=e.toString()),l.error=e}c?process.nextTick((function(){n(null,[l])})):a.push(l)},g=0;g<u.length;g++){var h=u[g];"cb"!==h?"urlMatch"!==h?d.push(r[h]):d.push(t[s.pluginId]):(c=!0,d.push(p))}try{c&&(f=setTimeout((function(){p(SYS_ERRORS.timeout)}),i.timeout||CONFIG.RESPONSE_TIMEOUT));var v=s.handle.apply(l.module,d)}catch(e){p(e),c||(c=!0)}c?v&&console.error("   -- Async plugin returned data, but async call of `cb` expected:",s.pluginId+"."+s.name):p(null,v)}();a.length&&process.nextTick((function(){n(null,a)}))}function runPluginsIteration(e,r,t,i,n,a,o,s){for(var l=Object.keys(r),u={},d=[],m=0;m<e.length;m++){findPluginMethods(e[m].id,l,t,i,n,d,u,a)}return runMethods(d,r,t,o,s),d.length}function getPluginsSet(e,r,t){var i,n=[],a=!1,o={};if(r.fetchParam){var s=providedParamsDict[r.fetchParam];if(s&&s.length){t[r.fetchParam]=!0;for(var l=0;l<s.length;l++){var u=s[l];n.push(plugins[u])}}}else{const R=pluginLoader.getDomainForPlugin(e);var d={};function m(e,t){(i=i||{})[e.domain]=!0,(d[e.domain]=d[e.domain]||{})[e.id]=!!t,e.mixinAllGeneric&&(r.mixAllWithDomainPlugin=!0)}if(!r.useOnlyGenericPlugins)for(var f=0;f<pluginsList.length;f++){(O=(P=pluginsList[f]).pluginMatchesUrl(R,e))&&(!0===O?m(P,null):(m(P,O),o[P.id]=O))}function c(){for(var r=0;r<pluginsList.length;r++){var t=pluginsList[r];if(!t.domain&&!t.custom){var i=t.pluginReMatchesUrl(R,e);i&&(o[t.id]=i),!1!==i&&n.push(t)}}}for(var p in r.mixAllWithDomainPlugin&&c(),d){var g=d[p],h=[];for(var v in g){var O;(O=g[v])&&h.push(v)}for(var v in g){var P;(P=plugins[v]).re.length||h.push(v)}for(f=0;f<h.length;f++){v=h[f];a=!0,n.push(plugins[v])}}0===n.length&&c(),r.forceParams&&r.forceParams.forEach((function(e){var r=providedParamsDict[e];if(r&&r.length){t[e]=!0;for(var i=0;i<r.length;i++){var a=r[i],o=_.find(n,(function(e){return e.id===a}));o||n.push(plugins[a])}}}))}return{initialPlugins:n,pluginsUrlMatches:o,usedDomains:i,isDomainPluginsMode:a}}function findPluginsForMandatoryParams(e,r){for(var t={},i=[],n=0;n<e.length;n++){var a=usedParamsDict[e[n]];if(a)for(var o=0;o<a.length;o++){var s=a[o],l=plugins[s];s in t||l.custom||!(!l.domain||r&&l.domain in r)||(t[s]=!0,i.push(s))}}return i}function findPluginsForAbsentParams(e,r,t){for(var i={},n=[],a=0;a<e.length;a++){var o=e[a],s=providedParamsDict[o];if(s&&s.length)for(var l=0;l<s.length;l++){var u=s[l],d=plugins[u];!(u in i)&&(!d.domain||r&&d.domain in r)&&(t[o]=!0,i[u]=!0,n.push(u))}}return n}function runPostPluginsIterationCall(e,r){for(var t=0;t<postPluginsList.length;t++)!function(){var i=postPluginsList[t],n=i.module[e];if(n){var a=r[i.id]=r[i.id]||{};try{n.apply(i.module,[a])}catch(r){console.error("   -- Post plugin error in",i.id+"."+e,r)}}}()}function runPostPlugins(e,r,t,i,n,a,o,s){for(var l=[],u=0;u<postPluginsList.length;u++)!function(){if(!e.error){for(var d,m=postPluginsList[u],f={pluginId:m.id,name:"prepareLink",handle:m.module.prepareLink},c=m.methods[f.name],p=[],g=!1,h=function(e,r){if(d)clearTimeout(d),d=null;else if(g)return;var t={method:f,data:r};e&&(e instanceof Error&&(e=e.stack),console.error("   -- Post plugin error in",m.id+"."+f.name,e)),g?process.nextTick((function(){s(null,[t])})):l.push(t)},v=0;v<c.length;v++){var O=c[v];if("cb"!==O)if("link"!==O)if("pluginContext"!==O)if("iterationPluginContext"!==O)"plugin"!==O?"templates"!==O?p.push(i[O]):p.push(templates):p.push(plugins[r.method.pluginId]);else{var P=a[m.id]=a[m.id]||{};p.push(P)}else{var R=n[m.id]=n[m.id]||{};p.push(R)}else p.push(e);else g=!0,p.push(h)}var _=t[m.id]=t[m.id]||{};_[f.name]=(_[f.name]||0)+1;try{g&&(d=setTimeout((function(){h(SYS_ERRORS.timeout)}),o.timeout||CONFIG.RESPONSE_TIMEOUT));var y=f.handle.apply(m.module,p)}catch(e){h(e),g||(g=!0)}g||h(null,y)}}();l.length&&process.nextTick((function(){s(null,l)}))}function getResultErrorMessages(e,r){if(!e)return!1;for(var t=0;t<e.length;t++){var i=e[t];i.error&&useMessage(r,i.error)}}function useResult(e,r,t,i,n,a,o){if(!n)return!1;for(var s=!1,l=0;l<n.length;l++){var u=(O=n[l]).method,d=e[u.pluginId];if(d[u.name]=d[u.name]-1,O.error&&a.debug&&console.error("   -- Plugin error",u.pluginId,u.name,n.error),i.allData.push(O),O.data&&O.data.title&&!r.title&&(r.title=O.data.title),O.data)if(O.data instanceof Object){if("getData"===O.method.name)for(var m in O.data)"message"===m?useMessage(i,O.data):("htmlparser"===m&&(i.h2=O.data.htmlparser.h2),m in r&&"whitelistRecord"!==m||(r[m]=O.data[m],s=!0));else if("getMeta"===O.method.name)for(var m in O.data){var f=O.data[m];if("date"===m&&((f=utils.unifyDate(f))||(O.data[m]=f)),"duration"===m&&((f=utils.unifyDuration(f))||(O.data[m]=f)),"title"!==m&&"canonical"!==m||f instanceof Array&&(f=f[0]),"author"===m&&f.match&&f.match(/^https?:\/\//)&&(m="author_url"),"author"===m&&/^admin|user/i.test(f)&&(f=""),"string"==typeof f&&/^{{.+}}$/.test(f)&&(f=""),""!==f&&null!==f&&("string"==typeof f&&!/^\s+$/.test(f)||"number"==typeof f)){i.meta._sources=i.meta._sources||{};var c=null,p=null;(g=i.meta._sources[m])&&plugins[g]&&plugins[O.method.pluginId]&&(c=plugins[g].order,p=plugins[O.method.pluginId].order),(!c||!p||c<p)&&(i.meta[m]=f,i.meta._sources[m]=O.method.pluginId)}}else if("getVars"===O.method.name)for(var m in O.data){if(""!==(f=O.data[m])&&null!==f&&("string"==typeof f&&!/^\s+$/.test(f)||"number"==typeof f)){i.vars._sources=i.vars._sources||{};var g;c=null,p=null;(g=i.vars._sources[m])&&plugins[g]&&plugins[O.method.pluginId]&&(c=plugins[g].order,p=plugins[O.method.pluginId].order),(!c||!p||c<p)&&(i.vars[m]=f,i.vars._sources[m]=O.method.pluginId)}}}else console.error("Non object returned in",O.method.pluginId,O.method.name),O.error="Non object returned"}var h={},v=!1;for(l=0;l<n.length&&!v;l++){if((O=n[l]).data&&!O.error&&"getLink"===O.method.name||"getLinks"===O.method.name||"prepareLink"===O.method.name)(P="prepareLink"===O.method.name?O.data&&O.data.addLink:O.data)&&(v=!0)}v&&runPostPluginsIterationCall("startIteration",h);for(l=0;l<n.length;l++){var O;if((O=n[l]).data&&!O.error&&"getLink"===O.method.name||"getLinks"===O.method.name||"prepareLink"===O.method.name){var P;if(!(P="prepareLink"===O.method.name?O.data&&O.data.addLink:O.data))continue;P instanceof Array||(P=[P]),P=_.compact(P);for(var R=0;R<P.length;R++){var y=P[R];i.links.push(y),runPostPlugins(y,O,e,r,t,h,a,o)}}}return v&&runPostPluginsIterationCall("finishIteration",h),s}function useMessage(e,r){var t=r.message;t&&"string"==typeof t&&e.messages.push(t)}function isEmpty(e){for(var r in e)return!1;return!0}function resultsHasDomainData(e,r){for(var t=!1,i=0;i<e.length&&!t;i++){isEmpty((n=e[i]).methods)&&(t=!0)}for(i=0;i<r.length&&!t;i++){var n,a=r[i];if((n=plugins[a.method.pluginId]).domain&&a.data&&!a.error){var o=n.methods.getLink||n.methods.getLinks,s="getLink"===a.method.name||"getLinks"===a.method.name,l="getData"===a.method.name;(o&&s||l&&a.data.message||!o&&l||!o&&"getMeta"===a.method.name)&&(t=!0)}else if(a.error&&("*"===a.error[SYS_ERRORS.fallback]||"generic"===a.error[SYS_ERRORS.fallback]))return!1}return t}var BIG_CONTEXT=["htmlparser","readability","decode"];function prepareResultData(e,r,t){t.debug||(delete r.h2,delete r.allData,delete r.meta._sources,delete r.vars._sources),0===Object.keys(r.vars).length&&delete r.vars;var i=r.links;r.meta.canonical||(r.meta.canonical=e);var n=r.meta.canonical;n&&n instanceof Array&&(n=n[0]),r.meta.title===r.meta.description&&delete r.meta.description;for(var a=0;a<i.length;){var o=i[a];if("string"==typeof n&&o.href&&"string"==typeof o.href&&o.rel&&-1===o.rel.indexOf(CONFIG.R.file)&&-1===o.rel.indexOf(CONFIG.R.iframely))o.href.replace(/\/+$/,"")!==n.replace(/\/+$/,"")||-1!=o.rel.indexOf(CONFIG.R.oembed)||/\/embed\//i.test(n)||(o.error="Removed canonical link");if(o.type||o.error||(o.error='Link "type" required'),o.error)i.splice(a,1);else{if(o.type&&0===o.type.indexOf("video/")){var s=o.rel.indexOf(CONFIG.R.autoplay);s>-1&&o.rel.splice(s,1)}var l;if(r.meta.medium&&"link"!==r.meta.medium||(o.rel.indexOf(CONFIG.R.player)>-1?o.rel.indexOf(CONFIG.R.audio)>-1?r.meta.medium=CONFIG.R.audio:o.rel.indexOf(CONFIG.R.slideshow)>-1?r.meta.medium=CONFIG.R.slideshow:o.rel.indexOf(CONFIG.R.playlist)>-1?r.meta.medium=CONFIG.R.playlist:o.rel.indexOf(CONFIG.R.gifv)>-1?r.meta.medium=CONFIG.R.gifv:o.rel.indexOf("3d")>-1?r.meta.medium="3d":r.meta.medium="video":o.rel.indexOf("3d")>-1?r.meta.medium="3d":o.rel.indexOf(CONFIG.R.image)>-1?r.meta.medium=CONFIG.R.image:o.rel.indexOf(CONFIG.R.file)>-1&&(r.meta.medium=CONFIG.R.file)),t.debug&&(o.sourceId=a),"_imageMeta"in o||"_imageStatus"in o)delete(l=t.debug?Object.assign({},o):o)._imageMeta,delete l._imageStatus,i[a]=l;a++}o.error||useMessage(r,o)}"link"===r.meta.medium&&i.some((e=>e.rel&&(e.rel.indexOf(CONFIG.R.thumbnail)>-1&&o.width&&o.height&&!(o.width/o.height>4)||e.rel.indexOf(CONFIG.R.app)>-1)))&&delete r.meta.medium,sortLinks(i);var u=r.allData;if(u)for(a=0;a<u.length;a++)for(var d=u[a],m=0;m<BIG_CONTEXT.length;m++){var f=BIG_CONTEXT[m];d.data&&d.data[f]&&(d.data[f]="BIG_CONTEXT")}t.debug&&t.totalTimer&&(r.time={total:t.totalTimer()}),0===r.messages.length&&delete r.messages,t.returnProviderOptionsUsage&&t._usedProviderOptions&&(r.vary=t._usedProviderOptions,r.vary.sort&&r.vary.sort()),t.returnFetchUsage&&(r.fetches=t._fetches)}export function sortLinks(e){function r(e){var r=_.intersection(e,CONFIG.REL_GROUPS),t=CONFIG.REL_GROUPS.length+1;if(r.length>0)for(var i=0;i<r.length;i++){var n=CONFIG.REL_GROUPS.indexOf(r[i]);n<t&&(t=n)}return t}e.sort((function(e,t){var i=r(e.rel)-r(t.rel);if(0!==i)return i;var n=e.rel.indexOf(CONFIG.R.iframely)>-1?0:1,a=t.rel.indexOf(CONFIG.R.iframely)>-1?0:1;if(n!==a)return n-a;var o=e.media,s=t.media;if(o&&s){if(o.width&&s.width)return s.width-o.width;if(o["aspect-ratio"]&&!s["aspect-ratio"])return-1;if(!o["aspect-ratio"]&&s["aspect-ratio"])return 1;if(o.width&&!s.width)return-1;if(!o.width&&s.width)return 1}else{if(o&&!s)return-1;if(!o&&s)return 1}return 0}))}var SYS_ERRORS={redirect:"redirect",responseStatusCode:"responseStatusCode",responseError:"responseError",timeout:"timeout",fallback:"fallback"};function findRedirectError(e){if(e)for(var r=0;r<e.length;r++){var t=e[r],i=t.error&&t.error[SYS_ERRORS.redirect];if("string"==typeof i)return log('   -- plugin redirect (by "'+t.method.pluginId+'")',i),i;i&&"string"!=typeof i&&log('   -- skip plugin redirect, not string (by "'+t.method.pluginId+'")',i)}}function findResponseError(e,r){if(e)for(var t=0;t<e.length;t++){var i=e[t];if(i.error&&i.error[SYS_ERRORS.responseError]){var n=i.error[SYS_ERRORS.responseError],a=n.message||n;return log("   -- plugin response:",JSON.stringify({plugin:i.method.pluginId,response:a,uri:r})),n}if(i.error&&i.error[SYS_ERRORS.responseStatusCode])return log("   -- plugin response:",JSON.stringify({plugin:i.method.pluginId,response:i.error[SYS_ERRORS.responseStatusCode],uri:r})),i.error[SYS_ERRORS.responseStatusCode];if(i.error&&i.error===SYS_ERRORS.timeout)return log("   -- plugin response:",JSON.stringify({plugin:i.method.pluginId,response:SYS_ERRORS.timeout,uri:r})),SYS_ERRORS.timeout}}function searchParamInObj(e,r,t){if(e===r.length)return t;if(t&&t.hasOwnProperty){for(var i=r[e];!t.hasOwnProperty(i)&&e<r.length-1;)i+="."+r[++e];return t.hasOwnProperty(i)?searchParamInObj(e+1,r,t[i]):void 0}}function normalizeValue(e){return"true"===e||"false"!==e&&(e.match&&e.match(/^\d+$/)?parseInt(e):e.match&&e.match(/^(\d+)?\.\d+$/)?parseFloat(e):e)}function getQueryOptionsFromEntries(e){const r=/^_.+/;var t={};return e.forEach(((e,i)=>{if(i.length>1&&r.test(i)){e=normalizeValue(e);var n=i.substr(1);t[n]=e}})),t}function getQueryOptionsFromUrl(e){try{return getQueryOptionsFromEntries(new URL(e).searchParams)}catch(r){return console.log("Error parsing url",e),{}}}function generateRegisterFetchFunc(e,r){r.returnFetchUsage&&(r._fetches=r._fetches||[]),r.registerFetch=function(e){r.returnFetchUsage&&r._fetches.push(e)},r.registerFetchError=function(e){if(r.returnFetchUsage){var t={...e};e.error||e.status_code?e.error&&("string"==typeof e.error?t.error_code=e.error:(e.error.code&&(t.error_code=e.error.code),e.error.message&&(t.error_message=e.error.message),e.error.code||e.error.message||(t.error_message=""+e.error))):console.warn("No error param in registerFetchError data"),t.error=!0,r._fetches.push(t)}}}function generateProviderOptionsFunc(e,r){function t(e){if(r.returnProviderOptionsUsage){if(/^app\./.test(e))return;-1===r._usedProviderOptions.indexOf(e)&&r._usedProviderOptions.push(e)}}r.returnProviderOptionsUsage&&(r._usedProviderOptions=r._usedProviderOptions||[]),r.redirectsHistory&&r.redirectsHistory.length&&(e=r.redirectsHistory[0]);const i=getQueryOptionsFromUrl(e);r.getProviderOptions=function(e,i){t(e);var n=e.split("."),a=searchParamInObj(0,n,r.providerOptions);if(Array.isArray(a));else if("object"==typeof a){var o=searchParamInObj(0,n,CONFIG.providerOptions);a=Object.assign({},o,a)}else void 0===a&&(a=searchParamInObj(0,n,CONFIG.providerOptions));return void 0!==a?a:i},r.getRequestOptions=function(e,n){var a;const o=e.replace(/^[^.]+\./,"_"),s=o.replace(/^_/,"");t(e),t(o);var l=i&&i[s];a=void 0===l||r.getProviderOptions("app.disable_url_options",!1)?r.getProviderOptions(e,n):l;var u=r.getProviderOptions(o,a);return void 0!==n&&typeof u!=typeof n?"string"==typeof n?""+u:a:u},r.digitize=function(e){return Object.keys(e).reduce(((r,t)=>(r[t]="boolean"==typeof e[t]?e[t]?1:0:e[t],r)),{})}}function callbackWithErrorCode(e,r,t){return t("1.3"===r.v?{code:e}:e)}export function run(e,r,t){"function"==typeof r&&(t=r,r={});var i,n=t;if(t=function(e,t){n(e,t),i&&r.events&&r.events.emit&&process.nextTick((function(){r.events.emit("fallback-from-domain-to-generic",{error:e,data:t,usedDomainsList:i.usedDomainsList,uri:i.uri})}))},"disableCache"in r&&(console.warn("Using options.disableCache in iframely.run() is deprecated. Use options.refresh instead."),r.refresh=r.disableCache),generateProviderOptionsFunc(e,r),generateRegisterFetchFunc(e,r),utils.isBlocked(e,r,t))"1.3"===r.v?t({code:"http error",responseCode:417,messages:["This domain is ignored based on your settings."]}):t(417);else if(r.redirectsCount&&r.redirectsCount>(r.maxRedirects||CONFIG.MAX_REDIRECTS))callbackWithErrorCode("redirect loop",r,t);else{e=e.replace(/^(http:\/\/[^\/]+):80(?!\d)/,"$1").replace(/^(https:\/\/[^\/]+):443(?!\d)/,"$1");var a={title:!0,url:!0,cb:!0,options:!0,request:!0,whitelistRecord:!0};for(var o in utilsModules)a[o]=!0;var s=e.split(/[\/\?]/)[2];if(s){var l=getPluginsSet(e=e.replace(s,s.toLowerCase()),r,a);r.debug&&!r.totalTimer&&(r.totalTimer=utils.createTimer());var u={url:e,cb:!0,options:r,request:function(e,t){!("refresh"in e)&&"refresh"in r&&(e.refresh=r.refresh),requestWrapper(e,r,t)},iframelyRun:run};for(var o in utilsModules)u[o]=utilsModules[o];var d=l.initialPlugins,m=l.pluginsUrlMatches,f=l.usedDomains,c=l.isDomainPluginsMode,p={},g={meta:{},links:[],vars:{},messages:[],allData:[]},h={},v=!1,O=function(e){if(r.dataParams)for(var t=0;t<r.dataParams.length;t++){var i=r.dataParams[t],n=u[i];if(n)(e.data=g.data||{})[i]=n}},P=function(){u.htmlparser&&u.htmlparser.abortController&&u.htmlparser.abortController.abort()},R=function(){if(P(),prepareResultData(e,g,r),u.safe_html&&(g.safe_html=u.safe_html),r.forceParams)for(var i=0;i<r.forceParams.length;i++){var n=r.forceParams[i],a=u[n];if(a)(g.context=g.context||{})[n]=a}O(g),r.whitelist&&(g.whitelist=r.getWhitelistRecord&&r.getWhitelistRecord(e,{disableWildcard:!0})),r.fetchParam?callbackWithErrorCode("param not found",r,t):t(null,g),utils.sendLogToWhitelist(e,u)},_=function(n,o){if(!v){getResultErrorMessages(o,g);var s=findRedirectError(o);if(s)return P(),s.match(/^https?:\/\//)||(s=urlLib.resolve(e,s)),r.redirectsCount=(r.redirectsCount||0)+1,r.redirectsHistory=r.redirectsHistory||[],r.redirectsHistory.push(e),run(s,r,t),void(v=!0);var y=useResult(h,u,p,g,o,r,_),b=findResponseError(o,e);if(b){if(P(),v=!0,"1.3"===r.v){n={};return b===SYS_ERRORS.timeout?n.code=SYS_ERRORS.timeout:b.code&&b.message?(n.code="request error",n.error=b):(n.code="http error",n.responseCode=b),g.messages.length&&(n.messages=g.messages),O(n),r.returnFetchUsage&&(n.fetches=r._fetches),t(n)}return t(b)}if(r.fetchParam&&r.fetchParam in u)return P(),t(null,u[r.fetchParam]),void(v=!0);var I=0;if((y||"initial"===n)&&(I=runPluginsIteration(d,u,m,h,a,f,r,_)),0===I){for(var S in h){var C=h[S];for(var E in C){if(C[E])return}}r.mixAllWithDomainPlugin||!c||resultsHasDomainData(d,g.allData)?R():(log("   -- fallback from domain to generic",f,e),r.skipFallbackNotification?delete r.skipFallbackNotification:i={usedDomainsList:Object.keys(f),uri:e},l=getPluginsSet(e,Object.assign({},r,{useOnlyGenericPlugins:!0}),a),d=l.initialPlugins,m=l.pluginsUrlMatches,f=l.usedDomains,c=l.isDomainPluginsMode,0===(I=runPluginsIteration(d,u,m,h,a,f,r,_))&&R())}}};if(r.promoUri&&(u.__promoUri=r.promoUri),r.getWhitelistRecord){var y=r.getWhitelistRecord(e);y&&(u.whitelistRecord=y)}(CONFIG.providerOptions&&CONFIG.providerOptions.readability&&!0===CONFIG.providerOptions.readability.enabled||r.readability)&&(u.__readabilityEnabled=!0,a.__readabilityEnabled=!0),_("initial")}else callbackWithErrorCode("invalid url",r,t)}}export function getPluginData(e,r,t,i){run(e,{fetchParam:r,getWhitelistRecord:t},i)}var getOembed=oembedUtils.getOembed;export{getOembed};
//# sourceMappingURL=/sm/88472abff0efb9e7caf42cc0821b8615cae6ab102efefcfdcf961c0dbb437896.map