10 lines
972 KiB
JavaScript
10 lines
972 KiB
JavaScript
|
/*! For license information please see converse.min.js.LICENSE.txt */
|
||
|
(()=>{var e,t,s,n,i={169:(e,t,s)=>{var n;!function(){"use strict";var i={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function r(e){return function(e,t){var s,n,o,a,c,l,d,u,h,m=1,g=e.length,f="";for(n=0;n<g;n++)if("string"==typeof e[n])f+=e[n];else if("object"==typeof e[n]){if((a=e[n]).keys)for(s=t[m],o=0;o<a.keys.length;o++){if(null==s)throw new Error(r('[sprintf] Cannot access property "%s" of undefined value "%s"',a.keys[o],a.keys[o-1]));s=s[a.keys[o]]}else s=a.param_no?t[a.param_no]:t[m++];if(i.not_type.test(a.type)&&i.not_primitive.test(a.type)&&s instanceof Function&&(s=s()),i.numeric_arg.test(a.type)&&"number"!=typeof s&&isNaN(s))throw new TypeError(r("[sprintf] expecting number but found %T",s));switch(i.number.test(a.type)&&(u=s>=0),a.type){case"b":s=parseInt(s,10).toString(2);break;case"c":s=String.fromCharCode(parseInt(s,10));break;case"d":case"i":s=parseInt(s,10);break;case"j":s=JSON.stringify(s,null,a.width?parseInt(a.width):0);break;case"e":s=a.precision?parseFloat(s).toExponential(a.precision):parseFloat(s).toExponential();break;case"f":s=a.precision?parseFloat(s).toFixed(a.precision):parseFloat(s);break;case"g":s=a.precision?String(Number(s.toPrecision(a.precision))):parseFloat(s);break;case"o":s=(parseInt(s,10)>>>0).toString(8);break;case"s":s=String(s),s=a.precision?s.substring(0,a.precision):s;break;case"t":s=String(!!s),s=a.precision?s.substring(0,a.precision):s;break;case"T":s=Object.prototype.toString.call(s).slice(8,-1).toLowerCase(),s=a.precision?s.substring(0,a.precision):s;break;case"u":s=parseInt(s,10)>>>0;break;case"v":s=s.valueOf(),s=a.precision?s.substring(0,a.precision):s;break;case"x":s=(parseInt(s,10)>>>0).toString(16);break;case"X":s=(parseInt(s,10)>>>0).toString(16).toUpperCase()}i.json.test(a.type)?f+=s:(!i.number.test(a.type)||u&&!a.sign?h="":(h=u?"+":"-",s=s.toString().replace(i.sign,"")),l=a.pad_char?"0"===a.pad_char?"0":a.pad_char.charAt(1):" ",d=a.width-(h+s).length,c=a.width&&d>0?l.repeat(d):"",f+=a.align?h+s+c:"0"===l?h+c+s:c+h+s)}return f}(function(e){if(a[e])return a[e];var t,s=e,n=[],r=0;for(;s;){if(null!==(t=i.text.exec(s)))n.push(t[0]);else if(null!==(t=i.modulo.exec(s)))n.push("%");else{if(null===(t=i.placeholder.exec(s)))throw new SyntaxError("[sprintf] unexpected placeholder");if(t[2]){r|=1;var o=[],c=t[2],l=[];if(null===(l=i.key.exec(c)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(o.push(l[1]);""!==(c=c.substring(l[0].length));)if(null!==(l=i.key_access.exec(c)))o.push(l[1]);else{if(null===(l=i.index_access.exec(c)))throw new SyntaxError("[sprintf] failed to parse named argument key");o.push(l[1])}t[2]=o}else r|=2;if(3===r)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n.push({placeholder:t[0],param_no:t[1],keys:t[2],sign:t[3],pad_char:t[4],align:t[5],width:t[6],precision:t[7],type:t[8]})}s=s.substring(t[0].length)}return a[e]=n}(e),arguments)}function o(e,t){return r.apply(null,[e].concat(t||[]))}var a=Object.create(null);t.sprintf=r,t.vsprintf=o,"undefined"!=typeof window&&(window.sprintf=r,window.vsprintf=o,void 0===(n=function(){return{sprintf:r,vsprintf:o}}.call(t,s,t,e))||(e.exports=n))}()},4335:function(e,t,s){var n,i;!function(r,o){"use strict";e.exports?e.exports=o():void 0===(i="function"==typeof(n=o)?n.call(t,s,t,e):n)||(e.exports=i)}(0,(function(e){"use strict";var t=e&&e.IPv6;return{best:function(e){var t,s,n=e.toLowerCase().split(":"),i=n.length,r=8;for(""===n[0]&&""===n[1]&&""===n[2]?(n.shift(),n.shift()):""===n[0]&&""===n[1]?n.shift():""===n[i-1]&&""===n[i-2]&&n.pop(),-1!==n[(i=n.length)-1].indexOf(".")&&(r=7),t=0;t<i&&""!==n[t];t++);if(t<r)for(n.splice(t,1,"0000");n.length<r;)n.splice(t,0,"0000");for(var o=0;o<r;o++){s=n[o].split("");for(var a=0;a<
|
||
|
<command sessionid="${t}" node="${s}" action="${n}" xmlns="${tv.NS.ADHOC}">
|
||
|
${["cancel","prev"].includes(n)?"":iv`
|
||
|
<x xmlns="${tv.NS.XFORM}" type="submit">
|
||
|
${i.reduce(((e,{name:t,value:s})=>e+`<field var="${t}"><value>${s}</value></field>`),"")}
|
||
|
</x>`}
|
||
|
</command>
|
||
|
</iq>`,o=await bh.sendIQ(r,null,!1);if(null===o){kt.warn("A timeout occurred while trying to run an ad-hoc command");const{__:e}=yu;return{status:"error",note:e("A timeout occurred")}}nv.isErrorStanza(o)&&(kt.error("Error while trying to execute an ad-hoc command"),kt.error(o));const a=o.querySelector("command"),c=a?.getAttribute("status");return{status:c,..."executing"===c?ev(o):{},note:o.querySelector("note")?.textContent}}}},{Strophe:ov}=Zm.env;ov.addNamespace("ADHOC","http://jabber.org/protocol/commands"),Zm.plugins.add("converse-adhoc",{dependencies:["converse-disco"],initialize(){Object.assign(this._converse.api,rv)}});class av extends nf{defaults(){return{bookmarked:!1,hidden:["mobile","fullscreen"].includes(bh.settings.get("view_mode")),message_type:"headline",num_unread:0,time_opened:this.get("time_opened")||(new Date).getTime(),time_sent:void 0,type:ut}}constructor(e,t){super(e,t),this.disable_mam=!0}async initialize(){super.initialize(),this.set({box_id:`box-${this.get("jid")}`}),this.initUI(),this.initMessages(),await this.fetchMessages(),bh.trigger("headlinesFeedInitialized",this)}}const cv={headlines:{async get(e,t={},s=!1){async function n(e){let n=await bh.chatboxes.get(e);if(!n&&s){const{HeadlinesFeed:s}=yu.exports;n=await bh.chatboxes.create(e,t,s)}else n=n&&n.get("type")===ut?n:null,n&&Object.keys(t).length&&n.save(t);return n}if(void 0===e){return(await bh.chatboxes.get()).filter((e=>e.get("type")===ut))}return"string"==typeof e?n(e):Promise.all(e.map((e=>n(e))))}}};Zm.plugins.add("converse-headlines",{dependencies:["converse-chat"],initialize(){const e={HeadlinesFeed:av};function t(){bh.connection.get()?.addHandler((e=>(async function(e){if(Ug(e)||Fg(e)){const t=e.getAttribute("from");if(await bh.waitUntil("rosterInitialized"),t.includes("@")&&!yu.state.roster.get(t)&&!bh.settings.get("allow_non_roster_messaging"))return;if(null===e.querySelector("body"))return;const s=await bh.chatboxes.create(t,{id:t,jid:t,type:ut,from:t},av),n=await Gg(e);await s.createMessage(n),bh.trigger("message",{chatbox:s,stanza:e,attrs:n})}}(e),!0)),null,"message")}Object.assign(yu,e),Object.assign(yu.exports,e),bh.listen.on("connected",t),bh.listen.on("reconnected",t),Object.assign(bh,cv),bh.chatboxes.registry.add(ut,av)}});class lv extends wd{defaults(){return{msgid:rm(),is_ephemeral:!1}}}const{NS:dv}=qe,uv=Zm.env.utils;function hv(e){e?.querySelectorAll("feature-not-implemented").length?kt.warn(`Message Archive Management (XEP-0313) not supported by ${e.getAttribute("from")}`):(kt.error(`Error while trying to set archiving preferences for ${e.getAttribute("from")}.`),kt.error(e))}function mv(e,t){const s=Au()(`prefs[xmlns="${dv.MAM}"]`,e).pop();if(s.getAttribute("default")!==bh.settings.get("message_archiving")){const e=de({type:"set"}).c("prefs",{xmlns:dv.MAM,default:bh.settings.get("message_archiving")});Array.from(s.children).forEach((t=>e.cnode(t).up())),bh.sendIQ(e).then((()=>t.save({preferences:{default:bh.settings.get("message_archiving")}}))).catch(yu.exports.onMAMError)}else t.save({preferences:{default:bh.settings.get("message_archiving")}})}function gv(e){const t=e.get("preferences")||{};e.get("var")===dv.MAM&&void 0!==bh.settings.get("message_archiving")&&t.default!==bh.settings.get("message_archiving")&&bh.sendIQ(de({type:"get"}).c("prefs",{xmlns:dv.MAM})).then((t=>yu.exports.onMAMPreferences(t,e))).catch(yu.exports.onMAMError)}function fv(e){bh.settings.get("muc_show_logs_before_join")&&e.features.get("mam_enabled")&&!e.get("prejoin_mam_fetched")&&(yv(e),e.save({prejoin_mam_fetched:!0}))}async function pv(e,t,s,n,i){await bh.emojis.initialize();const r=e.get("type")===dt,o=await Promise.all(t.messages.map((t=>r?kf(t,e):Gg(t))));t.messages=o;const a={query:s,chatbox:e,messages:o};if(await bh.trigger("MAMResult",a,{synchronous:!0}),o.forEach((t=>e.queueMessage(t))),t.error){const s=t.error.retry_event_id=uv.getUniqueId();bh.listen.once(s,(()=>vv(e,n,i))),e.createMessageFromError(t.error)}}async function vv(e,t={},s=null){if(e.disable_mam)return;const n=e.get("type")===dt,i=yu.session.get("bar
|
||
|
//# sourceMappingURL=converse.min.js.map
|