Edit file File name : offlineGateway.js Content :(()=>{"use strict";var e={5573:e=>{var t=/["'&<>]/;e.exports=function(e){var n,r=""+e,a=t.exec(r);if(!a)return r;var i="",s=0,o=0;for(s=a.index;s<r.length;s++){switch(r.charCodeAt(s)){case 34:n=""";break;case 38:n="&";break;case 39:n="'";break;case 60:n="<";break;case 62:n=">";break;default:continue}o!==s&&(i+=r.substring(o,s)),o=s+1,i+=n}return o!==s?i+r.substring(o,s):i}}},t={};function n(r){var a=t[r];if(void 0!==a)return a.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{const e=window.React;var t=n.n(e);const r={a:{content:9,self:!1,type:105},address:{invalid:["h1","h2","h3","h4","h5","h6","address","article","aside","section","div","header","footer"],self:!1},audio:{children:["track","source"]},br:{type:9,void:!0},body:{content:127},button:{content:8,type:105},caption:{content:1,parent:["table"]},col:{parent:["colgroup"],void:!0},colgroup:{children:["col"],parent:["table"]},details:{children:["summary"],type:97},dd:{content:1,parent:["dl"]},dl:{children:["dt","dd"],type:1},dt:{content:1,invalid:["footer","header"],parent:["dl"]},figcaption:{content:1,parent:["figure"]},footer:{invalid:["footer","header"]},header:{invalid:["footer","header"]},hr:{type:1,void:!0},img:{void:!0},li:{content:1,parent:["ul","ol","menu"]},main:{self:!1},ol:{children:["li"],type:1},picture:{children:["source","img"],type:25},rb:{parent:["ruby","rtc"]},rp:{parent:["ruby","rtc"]},rt:{content:8,parent:["ruby","rtc"]},rtc:{content:8,parent:["ruby"]},ruby:{children:["rb","rp","rt","rtc"]},source:{parent:["audio","video","picture"],void:!0},summary:{content:8,parent:["details"]},table:{children:["caption","colgroup","thead","tbody","tfoot","tr"],type:1},tbody:{parent:["table"],children:["tr"]},td:{content:1,parent:["tr"]},tfoot:{parent:["table"],children:["tr"]},th:{content:1,parent:["tr"]},thead:{parent:["table"],children:["tr"]},tr:{parent:["table","tbody","thead","tfoot"],children:["th","td"]},track:{parent:["audio","video"],void:!0},ul:{children:["li"],type:1},video:{children:["track","source"]},wbr:{type:9,void:!0}};function a(e){return t=>{r[t]={...e,...r[t]}}}["address","main","div","figure","p","pre"].forEach(a({content:1,type:65})),["abbr","b","bdi","bdo","cite","code","data","dfn","em","i","kbd","mark","q","ruby","samp","strong","sub","sup","time","u","var"].forEach(a({content:8,type:73})),["p","pre"].forEach(a({content:8,type:65})),["s","small","span","del","ins"].forEach(a({content:8,type:9})),["article","aside","footer","header","nav","section","blockquote"].forEach(a({content:1,type:67})),["h1","h2","h3","h4","h5","h6"].forEach(a({content:8,type:69})),["audio","canvas","iframe","img","video"].forEach(a({type:89}));const i=Object.freeze(r),s=["applet","base","body","command","embed","frame","frameset","head","html","link","meta","noscript","object","script","style","title"],o=Object.keys(i).filter((e=>"canvas"!==e&&"iframe"!==e)),l=Object.freeze({alt:1,cite:1,class:1,colspan:3,controls:4,datetime:1,default:4,disabled:4,dir:1,height:1,href:1,id:1,kind:1,label:1,lang:1,loading:1,loop:4,media:1,muted:4,poster:1,rel:1,role:1,rowspan:3,scope:1,sizes:1,span:3,start:3,style:5,src:1,srclang:1,srcset:1,tabindex:1,target:1,title:1,type:1,width:1}),c=Object.freeze({class:"className",colspan:"colSpan",datetime:"dateTime",rowspan:"rowSpan",srclang:"srcLang",srcset:"srcSet",tabindex:"tabIndex"});function d(){return d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},d.apply(this,arguments)}function h({attributes:e={},className:n,children:r=null,selfClose:a=!1,tagName:i}){const s=i;return a?t().createElement(s,d({className:n},e)):t().createElement(s,d({className:n},e),r)}class p{attribute(e,t){return t}node(e,t){return t}}var u=n(5573),f=n.n(u);function m(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const b=/(url|image|image-set)\(/i;class g extends p{attribute(e,t){return"style"===e&&Object.keys(t).forEach((e=>{String(t[e]).match(b)&&delete t[e]})),t}}const y=/^<(!doctype|(html|head|body)(\s|>))/i,v=/^(aria-|data-|\w+:)/iu,w=/{{{(\w+)\/?}}}/;function k(){if("undefined"!=typeof window&&"undefined"!=typeof document)return document.implementation.createHTMLDocument("Interweave")}class N{constructor(e,t={},n=[],r=[]){var a;m(this,"allowed",void 0),m(this,"banned",void 0),m(this,"blocked",void 0),m(this,"container",void 0),m(this,"content",[]),m(this,"props",void 0),m(this,"matchers",void 0),m(this,"filters",void 0),m(this,"keyIndex",void 0),this.props=t,this.matchers=n,this.filters=[...r,new g],this.keyIndex=-1,this.container=this.createContainer(e||""),this.allowed=new Set(null!==(a=t.allowList)&&void 0!==a?a:o),this.banned=new Set(s),this.blocked=new Set(t.blockList)}applyAttributeFilters(e,t){return this.filters.reduce(((t,n)=>null!==t&&"function"==typeof n.attribute?n.attribute(e,t):t),t)}applyNodeFilters(e,t){return this.filters.reduce(((t,n)=>null!==t&&"function"==typeof n.node?n.node(e,t):t),t)}applyMatchers(e,t){const n={},{props:r}=this;let a=e,i=0,s=null;return this.matchers.forEach((e=>{const o=e.asTag().toLowerCase(),l=this.getTagConfig(o);if(r[e.inverseName]||!this.isTagAllowed(o))return;if(!this.canRenderChild(t,l))return;let c="";for(;a&&(s=e.match(a));){const{index:t,length:o,match:l,valid:d,void:h,...p}=s,u=e.propName+String(i);t>0&&(c+=a.slice(0,t)),d?(c+=h?`{{{${u}/}}}`:`{{{${u}}}}${l}{{{/${u}}}}`,this.keyIndex+=1,i+=1,n[u]={children:l,matcher:e,props:{...r,...p,key:this.keyIndex}}):c+=l,e.greedy?(a=c+a.slice(t+o),c=""):a=a.slice(t+(o||l.length))}e.greedy||(a=c+a)})),0===i?e:this.replaceTokens(a,n)}canRenderChild(e,t){return!(!e.tagName||!t.tagName)&&!e.void&&(e.children.length>0?e.children.includes(t.tagName):!(e.invalid.length>0&&e.invalid.includes(t.tagName))&&(t.parent.length>0?t.parent.includes(e.tagName):!(!e.self&&e.tagName===t.tagName)&&Boolean(e&&e.content&t.type)))}convertLineBreaks(e){const{noHtml:t,disableLineBreaks:n}=this.props;if(t||n||e.match(/<((?:\/[ a-z]+)|(?:[ a-z]+\/))>/gi))return e;let r=e.replace(/\r\n/g,"\n");return r=r.replace(/\n{3,}/g,"\n\n\n"),r=r.replace(/\n/g,"<br/>"),r}createContainer(e){var t;const r=(void 0!==n.g&&n.g.INTERWEAVE_SSR_POLYFILL||k)();if(!r)return;const a=null!==(t=this.props.containerTagName)&&void 0!==t?t:"body",i="body"===a||"fragment"===a?r.body:r.createElement(a);return e.match(y)||(i.innerHTML=this.convertLineBreaks(this.props.escapeHtml?f()(e):e)),i}extractAttributes(e){const{allowAttributes:t}=this.props,n={};let r=0;return 1===e.nodeType&&e.attributes?([...e.attributes].forEach((a=>{const{name:i,value:s}=a,o=i.toLowerCase(),d=l[o]||l[i];if(!this.isSafe(e))return;if(!o.match(v)&&(!t&&(!d||2===d)||o.startsWith("on")||s.replace(/(\s|\0|�([9AD]);)/,"").match(/(javascript|vbscript|livescript|xss):/i)))return;let h="style"===o?this.extractStyleAttribute(e):s;4===d?h=!0:3===d?h=Number.parseFloat(String(h)):5!==d&&(h=String(h)),n[c[o]||o]=this.applyAttributeFilters(o,h),r+=1})),0===r?null:n):null}extractStyleAttribute(e){const t={};return Array.from(e.style).forEach((n=>{const r=e.style[n];"string"!=typeof r&&"number"!=typeof r||(t[n.replace(/-([a-z])/g,((e,t)=>String(t).toUpperCase()))]=r)})),t}getTagConfig(e){const t={children:[],content:0,invalid:[],parent:[],self:!0,tagName:"",type:0,void:!1};return i[e]?{...t,...i[e],tagName:e}:t}isSafe(e){if("undefined"!=typeof HTMLAnchorElement&&e instanceof HTMLAnchorElement){const t=e.getAttribute("href");if(null!=t&&t.startsWith("#"))return!0;const n=e.protocol.toLowerCase();return":"===n||"http:"===n||"https:"===n||"mailto:"===n||"tel:"===n}return!0}isTagAllowed(e){return!this.banned.has(e)&&!this.blocked.has(e)&&(this.props.allowElements||this.allowed.has(e))}parse(){return this.container?this.parseNode(this.container,this.getTagConfig(this.container.nodeName.toLowerCase())):[]}parseNode(e,n){const{noHtml:r,noHtmlExceptMatchers:a,allowElements:i,transform:s,transformOnlyAllowList:o}=this.props;let l=[],c="";return[...e.childNodes].forEach((e=>{if(1===e.nodeType){const p=e.nodeName.toLowerCase(),u=this.getTagConfig(p);c&&(l.push(c),c="");const f=this.applyNodeFilters(p,e);if(!f)return;let m;if(s&&(!o||this.isTagAllowed(p))){this.keyIndex+=1;const e=this.keyIndex;m=this.parseNode(f,u);const n=s(f,m,u);if(null===n)return;if(void 0!==n)return void l.push(t().cloneElement(n,{key:e}));this.keyIndex=e-1}if(this.banned.has(p))return;if(r||a&&"br"!==p||!this.isTagAllowed(p)||!i&&!this.canRenderChild(n,u))l=[...l,...this.parseNode(f,u.tagName?u:n)];else{var d;this.keyIndex+=1;const e=this.extractAttributes(f),n={tagName:p};e&&(n.attributes=e),u.void&&(n.selfClose=u.void),l.push(t().createElement(h,{...n,key:this.keyIndex},null!==(d=m)&&void 0!==d?d:this.parseNode(f,u)))}}else if(3===e.nodeType){const t=r&&!a?e.textContent:this.applyMatchers(e.textContent||"",n);Array.isArray(t)?l=[...l,...t]:c+=t}})),c&&l.push(c),l}replaceTokens(e,t){if(!e.includes("{{{"))return e;const n=[];let r=e,a=null;for(;a=r.match(w);){const[e,i]=a,s=a.index,o=e.includes("/");s>0&&(n.push(r.slice(0,s)),r=r.slice(s));const{children:l,matcher:c,props:d}=t[i];let h;if(o)h=e.length,n.push(c.createElement(l,d));else{const a=r.match(new RegExp(`{{{/${i}}}}`));h=a.index+a[0].length,n.push(c.createElement(this.replaceTokens(r.slice(e.length,a.index),t),d))}r=r.slice(h)}return r.length>0&&n.push(r),0===n.length?"":1===n.length&&"string"==typeof n[0]?n[0]:n}}function x(e){var n;const{attributes:r,className:a,containerTagName:i,content:s,emptyContent:o,parsedContent:l,tagName:c,noWrap:d}=e,p=null!==(n=null!=i?i:c)&&void 0!==n?n:"span",u="fragment"===p||d;let f;if(l)f=l;else{const t=new N(null!=s?s:"",e).parse();t.length>0&&(f=t)}return f||(f=o),u?t().createElement(t().Fragment,null,f):t().createElement(h,{attributes:r,className:a,tagName:p},f)}let E;const T={id:"offline",initialize(){E=this.settings},Fields:()=>(0,e.createElement)(x,{content:E.markup})};window.givewp.gateways.register(T)})()})();Save