trix_embed 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f7abc64715dcc1e575675138a5cf792a89a4951e27161c32862b89059ca7029
|
4
|
+
data.tar.gz: 9b806cc265a65c0392b4425b7ce66b2ce59423d46c66f890b50a2b6b48d29892
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e5ae0dd08c075dba23b21d02b5a6c5f061358dd47e80960227f4c6844e7b20a68ecdda319592d0c5c4eda347abb40e5ea6e460010aee4dadfee4b176be6f3b5
|
7
|
+
data.tar.gz: ea1fe438ce1aea670dd812fd1ed39c8fce315a3f7087c2be0608d31db9d139a415431e39e2756a1c30985f69ae4cf2ac1534928d6ed0ca9c16b9eb142faaabc4
|
@@ -1,41 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
trix-embed 0.0.
|
2
|
+
trix-embed 0.0.4 (MIT)
|
3
3
|
Copyright © 2023 Nate Hopkins (hopsoft) <natehop@gmail.com>
|
4
4
|
*/
|
5
|
-
var ge=Object.defineProperty,be=Object.defineProperties;var ye=Object.getOwnPropertyDescriptors;var B=Object.getOwnPropertySymbols;var xe=Object.prototype.hasOwnProperty,we=Object.prototype.propertyIsEnumerable;var N=(r,e,t)=>e in r?ge(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,E=(r,e)=>{for(var t in e||(e={}))xe.call(e,t)&&N(r,t,e[t]);if(B)for(var t of B(e))we.call(e,t)&&N(r,t,e[t]);return r},L=(r,e)=>be(r,ye(e));var J=(r,e,t)=>(N(r,typeof e!="symbol"?e+"":e,t),t);var _={version:"0.0.3"};var R={name:"AES-GCM",length:256},ve=!0,Ee=["encrypt","decrypt"];async function Le(){let e=["encrypt","decrypt"];return await crypto.subtle.generateKey(R,!0,e)}async function Te(r){let e=await crypto.subtle.exportKey("jwk",r);return JSON.stringify(e)}async function G(r){let e=JSON.parse(r);return await crypto.subtle.importKey("jwk",e,R,ve,Ee)}async function Se(r,e){let t=new TextEncoder().encode(String(r)),n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.encrypt(L(E({},R),{iv:n}),e,t),s={ciphertext:btoa(String.fromCharCode(...new Uint8Array(i))),iv:btoa(String.fromCharCode(...n))};return btoa(JSON.stringify(s))}async function Ae(r,e){let t=JSON.parse(atob(r)),n=new Uint8Array(atob(t.ciphertext).split("").map(a=>a.charCodeAt(0))),i=new Uint8Array(atob(t.iv).split("").map(a=>a.charCodeAt(0))),s=await crypto.subtle.decrypt(L(E({},R),{iv:i}),e,n);return new TextDecoder().decode(s)}async function T(){let r=await Le(),e=await Te(r);return btoa(e)}async function x(r,e=[]){let t=await G(atob(r));return Promise.all(e.map(n=>Se(n,t)))}async function X(r,e=[]){let t=await G(atob(r));return Promise.all(e.map(n=>Ae(n,t)))}async function Q(r=[]){let e=await T(),t=await x(e,r);return console.log(`data-trix-embed-key-value="${e}"`),console.log(`data-trix-embed-hosts-value='${JSON.stringify(t)}'`),{key:e,encryptedValues:t}}var Y=r=>Math.floor(Math.random()*r),w=(r,e=null)=>{let t=[...r];e==="all"&&(e=t.length);let n=t.length,i=[],s=new Set;for(;i.length<e;){let a=Y(n);for(;s.has(a);)a=Y(n);s.add(a),i.push(t[a])}return typeof e=="number"?i:i[0]};function b(r,e=t=>{}){try{let t=new URL(String(r).trim());return t&&e&&e(t),t}catch(t){console.info(`Failed to parse URL! value='${r}']`)}return null}function Z(r,e=t=>{}){var n;let t=(n=b(r))==null?void 0:n.host;return t&&e&&e(t),t}function O(r){return document.createTreeWalker(r,NodeFilter.SHOW_TEXT,e=>e.nodeValue.match(/http/gi)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP)}function ke(r){let e=new Set,t=O(r),n;for(;n=t.nextNode();)n.nodeValue.split(/\s+/).filter(i=>i.startsWith("http")).forEach(i=>b(i,s=>e.add(s.href)));return[...e]}function U(r){if(r.src){let e=r.src.trim();if(e.length)return e}if(r.href){let e=r.href.trim();if(e.length)return e}return""}function Re(r){let e=new Set;return r.src&&b(r.src,n=>e.add(n.href)),r.href&&b(r.href,n=>e.add(n.href)),r.querySelectorAll("[src], [href]").forEach(n=>b(U(n),i=>e.add(i.href))),[...e]}function C(r,e=[],t=[]){let n=Z(r);return t.includes("*")||t.find(i=>n.endsWith(i))?!1:!!(e.find(i=>n.endsWith(i))||e.includes("*")&&(n||r.startsWith("data:")||r.startsWith("news:")||r.startsWith("tel:")))}function ee(r){return[...r.reduce((e,t)=>(Z(t,n=>e.add(n)),e),new Set)]}function te(r){let e=Re(r),t=ke(r);return[...new Set([...e,...t])]}var re={attachment:"trix-embed/attachment"};var ie={avif:"image/avif",bmp:"image/bmp",gif:"image/gif",heic:"image/heic",heif:"image/heif",ico:"image/x-icon",jp2:"image/jp2",jpeg:"image/jpeg",jpg:"image/jpeg",jxr:"image/vnd.ms-photo",png:"image/png",svg:"image/svg+xml",tif:"image/tiff",tiff:"image/tiff",webp:"image/webp"};var Ue=ie,Me=["animate","animateMotion","animateTransform","area","audio","base","embed","feDisplacementMap","feImage","feTile","filter","font-face-uri","iframe","image","link","object","script","source","track","use","video"],Ne=["audio","embed","iframe","img","input","script","source","track","video","frame","frameset","object","picture","use"],ne="trix-editor",se="action-text-attachment",ae=Me.concat(Ne);function oe(r){return!!Object.values(ie).find(e=>e===P(r))}function P(r){let e;if(e=b(r),!e)return null;let t=e.pathname.lastIndexOf(".");if(!t)return null;let n=e.pathname.substring(t+1);return Ue[n]}var j,H,ce=new Set,Oe=`${ne}[data-controller~="trix-embed"]`;function de(r){var n;let{method:e,action:t}=r||{};return t=((n=b(t))==null?void 0:n.pathname)||t,`${e}:${t}`.trim().toLowerCase()}function me(r,e){if(!r)return;let t=de(r);ce.add({key:t,form:r,input:e})}function Ce(r){var l;let e=de(r),t=[...ce].filter(o=>o.key===e);if(!t.length)return!0;if(r.trixEmbedPasting)return!1;if(r.querySelector(Oe))return!0;let n=new FormData(r),i=((l=b(r.action))==null?void 0:l.searchParams)||new URLSearchParams;return!t.map(o=>o.input).map(o=>!(o.name&&(n.has(o.name)||i.has(o.name))||o.id&&(n.has(o.id)||i.has(o.id)))).includes(!1)}function le(r){Ce(r.target)||r.preventDefault()}function F(r){r.removeEventListener("submit",le,!0),r.addEventListener("submit",le,!0)}function Pe(){if(j)return;let r=Document.prototype.createElement;j={value:function(){let e=r.apply(this,arguments);try{String(arguments[0]).toUpperCase()==="FORM"&&F(e)}catch(t){}return e},configurable:!1},Object.defineProperty(Document.prototype,"createElement",j)}function D(r=0){if(!document.body&&r<10)return setTimeout(()=>D(r+1),50);H||(H=new MutationObserver(e=>e.forEach(t=>t.addedNodes.forEach(n=>{n instanceof HTMLFormElement&&F(n)}))),H.observe(document.body,{childList:!0,subtree:!0}))}addEventListener("load",()=>D());Pe();D();document.querySelectorAll("form").forEach(r=>F(r));var S=class{constructor(e){this.controller=e}preventAttachments(){var e,t,n,i,s;(e=this.editor)==null||e.removeAttribute("data-direct-upload-url"),(t=this.editor)==null||t.removeAttribute("data-blob-url-template"),(n=this.editor)==null||n.addEventListener("trix-file-accept",a=>a.preventDefault(),!0),(s=(i=this.toolbar)==null?void 0:i.querySelector('[data-trix-button-group="file-tools"]'))==null||s.remove()}async preventLinks(){var n,i;let e=await this.controller.allowedLinkHosts;!(await this.controller.blockedLinkHosts).length&&e.includes("*")||(i=(n=this.toolbar)==null?void 0:n.querySelector('[data-trix-action="link"]'))==null||i.remove()}protect(e=0){if(!this.toolbar&&e<10)return setTimeout(()=>this.protect(e+1),25);this.preventAttachments(),this.preventLinks(),this.form&&me(this.form,this.input)}get editor(){return this.controller.element}get toolbar(){return this.controller.toolbarElement}get form(){return this.controller.formElement}get input(){return this.controller.inputElement}};var A=class{constructor(e){var n,i,s;let t=[location.pathname,(i=b((n=e.formElement)==null?void 0:n.action))==null?void 0:i.pathname,(s=e.element.closest("[id]"))==null?void 0:s.id];this.controller=e,this.identifier=t.filter(a=>a&&a.length).join("/").replace(/\/{2,}/g,"/"),this.base=this.obfuscate(this.identifier)}split(e){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}obfuscate(e){var i;let t=[...e].map(s=>s.charCodeAt(0));return[(i=this.split(t)[1])==null?void 0:i.reverse(),t[0]].flat().join("")}read(e){return sessionStorage.getItem(this.generateStorageKey(e))}write(e,t){return sessionStorage.setItem(this.generateStorageKey(e),t)}remove(e){return sessionStorage.removeItem(this.generateStorageKey(e))}generateStorageKey(e){let t=[...this.obfuscate(e)],[n,i]=this.split(t);return btoa(`${n}/${this.base}/${i}`)}};var V={link:"<a href='{{url}}'>{{label}}</a>",embedded:`
|
6
|
-
<span>
|
7
|
-
<strong>{{label}}</strong>
|
8
|
-
<span>{{description}}</span>
|
9
|
-
<del>{{url}}</del>
|
10
|
-
</span>
|
11
|
-
`,prohibited:`
|
12
|
-
<span>
|
13
|
-
<strong>{{label}}</strong>
|
14
|
-
<span>{{description}}</span>
|
15
|
-
<del>{{url}}</del>
|
16
|
-
</span>
|
17
|
-
`,error:`
|
18
|
-
<div data-trix-embed data-trix-embed-error>
|
19
|
-
<h1>{{header}}</h1>
|
20
|
-
<pre><code>{{error.stack}}</code></pre>
|
21
|
-
</div>
|
22
|
-
`,iframe:`
|
23
|
-
<div data-trix-embed>
|
24
|
-
<iframe src='{{src}}' loading='lazy' referrerpolicy='no-referrer' scrolling='no'></iframe>
|
25
|
-
</div>
|
26
|
-
`,image:`
|
27
|
-
<div data-trix-embed>
|
28
|
-
<img src='{{src}}' loading='lazy'></img>
|
29
|
-
</div>
|
30
|
-
`,warning:`
|
31
|
-
<div data-trix-embed data-trix-embed-warning>
|
32
|
-
<h1>{{header}}</h1>
|
33
|
-
<h3>{{subheader}}</h3>
|
34
|
-
|
35
|
-
<h2>{{prohibited.header}}</h2>
|
36
|
-
<ul>{{prohibited.hosts}}</ul>
|
37
|
-
|
38
|
-
<h2>{{allowed.header}}</h2>
|
39
|
-
<ul>{{allowed.hosts}}</ul>
|
40
|
-
</div>
|
41
|
-
`};var je=[se,"a","abbr","acronym","address","b","big","blockquote","br","cite","code","dd","del","dfn","div","dl","dt","em","figcaption","figure","h1","h2","h3","h4","h5","h6","hr","i","iframe","img","ins","kbd","li","ol","p","pre","samp","small","span","strong","sub","sup","time","tt","ul","var"],He=["abbr","allow","allowfullscreen","allowpaymentrequest","alt","caption","cite","content-type","credentialless","csp","data-trix-embed","data-trix-embed-error","data-trix-embed-prohibited","data-trix-embed-warning","datetime","filename","filesize","height","href","lang","loading","name","presentation","previewable","referrerpolicy","sandbox","sgid","src","srcdoc","title","url","width","xml:lang"],k=class{constructor(e){this.controller=e,this.initializeTempates()}sanitize(e){let t=document.createElement("template");t.innerHTML=`<div>${e}</div>`;let n=t.content.firstElementChild;return[n].concat([...n.querySelectorAll("*")]).forEach(s=>{je.includes(s.tagName.toLowerCase())?[...s.attributes].forEach(a=>{He.includes(a.name.toLowerCase())||s.removeAttribute(a.name)}):s.remove()}),n.innerHTML}initializeTempates(){this.templates=V,Object.keys(V).forEach(e=>this.initializeTemplate(e))}initializeTemplate(e){var s,a;let t=`${e}TemplateValue`,n=this.controller[t],i=n?(a=(s=document.getElementById(n))==null?void 0:s.innerHTML)==null?void 0:a.trim():null;return this.controller[t]=null,i&&(this.templates[e]=i),this.templates[e]}render(e,t={}){return this.templates[e].replace(/{{(.*?)}}/g,(i,s)=>s.split(".").reduce((a,l)=>a[l],t))}renderEmbed(e="https://example.com"){let t=oe(e)?this.render("image",{src:e}):this.render("iframe",{src:e});return this.sanitize(t)}renderEmbeds(e=["https://example.com","https://test.com"]){if(e!=null&&e.length)return e.map(t=>this.renderEmbed(t))}renderWarnings(e=["https://example.com","https://test.com"],t=[],n=[]){if(!(e!=null&&e.length))return;t=[...t].sort(),t.includes("*")&&t.splice(t.indexOf("*"),1),n=[...n],n.includes("*")&&n.splice(n.indexOf("*"),1);let i=[...new Set([...n,...ee(e)])].sort();return this.render("warning",{header:"Copy/Paste Warning",subheader:"Content includes URLs or media from prohibited hosts or restricted protocols.",prohibited:{header:"Prohibited Hosts",hosts:i.length?i.map(s=>`<li>${s}</li>`).join(""):"<li>URLs and media are restricted to allowed hosts and standard protocols.</li>"},allowed:{header:"Allowed Hosts",hosts:t.length?t.map(s=>`<li>${s}</li>`).join(""):"<li>Allowed hosts not configured.</li>"}})}renderError(e){return this.render("error",{header:"Unhandled Exception!",subheader:"Report this problem to a software engineer.",error:e})}};function he(r={Controller:null,Trix:null}){var n;let{Controller:e,Trix:t}=r;return n=class extends e{connect(){this.onPaste=this.paste.bind(this),this.element.addEventListener("trix-paste",this.onPaste,!0),this.onBeforeFetchResponse=this.beforeFetchResponse.bind(this),addEventListener("turbo:before-fetch-response",this.onBeforeFetchResponse,!0),this.onBeforeUnload=this.forgetConfig.bind(this),addEventListener("beforeunload",this.onBeforeUnload,!0),this.store=new A(this),this.guard=new S(this),!this.key&&this.rememberConfig().then(()=>{this.paranoid&&this.guard.protect()})}reconnect(){let i=this.element.getAttribute("data-controller")||"",s=new Set(i.split(" "));s.add("trix-embed"),this.element.setAttribute("data-controller",[...s].join(" ").trim())}disconnect(){this.element.removeEventListener("trix-paste",this.onPaste,!0),removeEventListener("turbo:before-fetch-response",this.onBeforeFetchResponse,!0),removeEventListener("beforeunload",this.onBeforeUnload,!0),this.reconnect()}beforeFetchResponse(i){try{i.target.querySelectorAll("trix-editor").includes(this.element)&&this.forgetConfig()}catch(s){}}async paste(i){this.formElement&&(this.formElement.trixEmbedPasting=!0);try{let{html:s,string:a,range:l}=i.paste,o=s||a||"",d=this.createTemplateElement(o),c=te(d);if(!c.length)return;i.preventDefault(),this.editor.setSelectedRange(l);try{let m=new k(this),h=await this.allowedMediaHosts,u=await this.blockedMediaHosts,p=new Set(c.filter(g=>P(g)));[...d.querySelectorAll("iframe")].forEach(g=>p.add(g.src)),p=[...p];let y=p.filter(g=>C(g,h,u)),v=p.filter(g=>!y.includes(g)),W=await this.allowedLinkHosts,K=await this.blockedLinkHosts,$=c.filter(g=>!p.includes(g)),z=$.filter(g=>C(g,W,K)),q=$.filter(g=>!z.includes(g));if(v.length||q.length){let g=[...new Set([...v,...q])],pe=[...new Set([...h,...W])].filter(M=>!this.reservedDomains.includes(M)),fe=[...new Set([...u,...K])].filter(M=>!this.reservedDomains.includes(M));await this.insert(m.renderWarnings(g,pe,fe))}if(y.length&&await this.insert(m.renderEmbeds(y)),c.length===1&&y.length===1)return;let I=this.sanitizePastedElement(d,{renderer:m,validMediaURLs:y,validLinkURLs:z}).innerHTML.trim();I.length&&await this.insert(I,{disposition:"inline"})}catch(m){this.insert(renderer.renderError(m))}}finally{this.formElement&&delete this.formElement.trixEmbedPasting}}createTemplateElement(i){let s=document.createElement("template");return s.innerHTML=`<div>${i.trim()}</div>`,s.content.firstElementChild}extractLabelFromElement(i,s={default:null}){let a=i.title;return a&&a.length||(a=i.textContent.trim(),a&&a.length)?a:s.default}sanitizePastedElement(i,s={renderer:null,validMediaURLs:[],validLinkURLs:[]}){let{renderer:a,validMediaURLs:l,validLinkURLs:o}=s;i=i.cloneNode(!0);let d=O(i),c=[],m;for(;m=d.nextNode();)m.replacements=m.replacements||new Set,c.push(m),m.nodeValue.split(/\s+/).filter(p=>p.startsWith("http")).forEach(p=>{var v;let f=(v=b(p))==null?void 0:v.href,y=o.includes(f)||o.includes(f)?a.render("link",{url:f,label:f}):a.render("prohibited",{url:f,label:"Prohibited URL:",description:""});m.replacements.add({match:p,replacement:y})});return c.forEach(h=>{if(!h.replacements.size)return;let u=h.nodeValue;[...h.replacements].sort((f,y)=>y.match.length-f.match.length).forEach(f=>u=u.replaceAll(f.match,f.replacement)),h.replaceWith(this.createTemplateElement(u))}),i.querySelectorAll("a").forEach(h=>{let u=U(h),p=this.extractLabelFromElement(h,{default:u}),f=o.includes(u)?a.render("link",{url:u,label:p}):a.render("prohibited",{url:u,label:"Prohibited Link:",description:`(${p})`});h.replaceWith(this.createTemplateElement(f))}),i.querySelectorAll(ae.join(", ")).forEach(h=>{let u=U(h),p=this.extractLabelFromElement(h,{default:u}),f=l.includes(u)?a.render("embedded",{url:u,label:"Allowed Media:",description:"(Embedded Above)"}):a.render("prohibited",{url:u,label:"Prohibited Media:",description:""});h.replaceWith(this.createTemplateElement(f))}),i.innerHTML.replaceAll(/(\n|\r|\f|\v)+/g,"<br>"),i}createAttachment(i){return new t.Attachment({content:i,contentType:re.attachment})}insertNewlines(i=1,s={delay:1}){let{delay:a}=s;return new Promise(l=>{setTimeout(()=>{for(let o=0;o<i;o++)this.editor.insertLineBreak();l()},a)})}insertAttachment(i,s={delay:1}){let{delay:a}=s;return new Promise(l=>{setTimeout(()=>{this.editor.insertAttachment(this.createAttachment(i)),this.insertNewlines(1,{delay:a}).finally(l)},a)})}insertHTML(i,s={delay:1}){let{delay:a}=s;return new Promise(l=>{setTimeout(()=>{this.editor.insertHTML(i),this.insertNewlines(1,{delay:a}).finally(l)},a)})}insert(i,s={delay:1,disposition:"attachment"}){let{delay:a,disposition:l}=s;return i!=null&&i.length?new Promise(o=>{setTimeout(()=>{if(typeof i=="string")return l==="inline"?this.insertHTML(i,{delay:a}).catch(d=>this.renderError(d)).finally(o):this.insertAttachment(i,{delay:a}).catch(d=>this.renderError(d)).finally(o);if(Array.isArray(i)){let d=l==="inline"?i.map(c=>this.insertHTML(c,{delay:a+1})):i.map(c=>this.insertAttachment(c,{delay:a+1}));return Promise.all(d).catch(c=>this.renderError(c)).finally(o)}o()})}):Promise.resolve()}get editor(){return this.element.editor}get toolbarElement(){let i=this.element.getAttribute("toolbar"),s=i?document.getElementById(i):null;if(!s){let a=this.element.previousElementSibling;s=a!=null&&a.tagName.match(/trix-toolbar/i)?a:null}return s}get formElement(){return this.element.closest("form")}get inputElement(){var s;let i=this.element.getAttribute("input");return i?(s=this.formElement)==null?void 0:s.querySelector(`#${i}`):null}get paranoid(){return!!this.store.read("paranoid")}get key(){try{return JSON.parse(this.store.read("key"))[2]}catch(i){return null}}get hostsValueDescriptors(){return Object.values(this.valueDescriptorMap).filter(i=>i.name.endsWith("HostsValue"))}get reservedDomains(){return["embed.example","embed.invalid","embed.local","embed.localhost","embed.test","trix.embed.example","trix.embed.invalid","trix.embed.local","trix.embed.localhost","trix.embed.test","trix.example","trix.invalid","trix.local","trix.localhost","trix.test","www.embed.example","www.embed.invalid","www.embed.local","www.embed.localhost","www.embed.test","www.trix.example","www.trix.invalid","www.trix.local","www.trix.localhost","www.trix.test"]}rememberConfig(){return new Promise(async i=>{let s,a=await T();s=await x(a,w(this.reservedDomains,3)),this.store.write("key",JSON.stringify([s[0],s[1],a,s[2]])),this.paranoidValue!==!1&&(s=await x(a,w(this.reservedDomains,4)),this.store.write("paranoid",JSON.stringify(s))),this.element.removeAttribute("data-trix-embed-paranoid-value"),this.hostsValueDescriptors.forEach(async l=>{let{name:o}=l,d=o.slice(0,o.lastIndexOf("Value")),c=this[o];c.length<4&&(c=c.concat(w(this.reservedDomains,4-c.length))),this.store.write(d,JSON.stringify(await x(a,c))),this.hasOwnProperty(d)||Object.defineProperty(this,d,{get:async()=>{try{return(await X(this.key,JSON.parse(this.store.read(d)))).filter(h=>!this.reservedDomains.includes(h))}catch(m){return console.error(`Failed to get '${d}'!`,m),[]}}}),this.element.removeAttribute(`data-trix-embed-${l.key}`)}),s=await x(a,w(this.reservedDomains,4)),this.store.write("securityHosts",s),s=await x(a,w(this.reservedDomains,4)),this.store.write("obscurityHosts",s),i()})}forgetConfig(){var i,s,a,l;try{(i=this.store)==null||i.remove("key"),(s=this.store)==null||s.remove("paranoid"),this.hostsValueDescriptors.forEach(async o=>{var m;let{name:d}=o,c=d.slice(0,d.lastIndexOf("Value"));(m=this.store)==null||m.remove(c)}),(a=this.store)==null||a.remove("securityHosts"),(l=this.store)==null||l.remove("obscurityHosts")}catch(o){}}},J(n,"values",{embeddedTemplate:String,errorTemplate:String,iframeTemplate:String,imageTemplate:String,linkTemplate:String,prohibitedTemplate:String,warningTemplate:String,allowedLinkHosts:Array,blockedLinkHosts:Array,allowedMediaHosts:Array,blockedMediaHosts:Array,paranoid:{type:Boolean,default:!0}}),n}var ue=!1,Fe={application:null,Controller:null,Trix:null};function De(r=Fe){if(ue)return;let{application:e,Controller:t,Trix:n}=r;e.register("trix-embed",he({Controller:t,Trix:n})),ue=!0}self.TrixEmbed=L(E({},_),{encryptValues:x,generateKey:T,generateKeyAndEncryptValues:Q,initialize:De});var Tt=self.TrixEmbed;export{Tt as default};
|
5
|
+
const _0x12cdbf=_0x17dc;(function(_0x34bd8f,_0x5f33b){const _0xd015=_0x17dc,_0x4c67ba=_0x34bd8f();while(!![]){try{const _0x16602c=-parseInt(_0xd015(0x153))/0x1+parseInt(_0xd015(0x238))/0x2*(parseInt(_0xd015(0x215))/0x3)+parseInt(_0xd015(0x1ac))/0x4*(parseInt(_0xd015(0x11c))/0x5)+-parseInt(_0xd015(0x174))/0x6*(parseInt(_0xd015(0xfa))/0x7)+parseInt(_0xd015(0x1b7))/0x8*(-parseInt(_0xd015(0x1df))/0x9)+parseInt(_0xd015(0x1e1))/0xa+parseInt(_0xd015(0x1f6))/0xb*(parseInt(_0xd015(0x1e3))/0xc);if(_0x16602c===_0x5f33b)break;else _0x4c67ba['push'](_0x4c67ba['shift']());}catch(_0x544f77){_0x4c67ba['push'](_0x4c67ba['shift']());}}}(_0x4ab0,0x6a32c));var ge=Object[_0x12cdbf(0x212)],be=Object[_0x12cdbf(0x1fe)],ye=Object['getOwnPropertyDescriptors'],_=Object[_0x12cdbf(0x196)],xe=Object['prototype'][_0x12cdbf(0x131)],we=Object[_0x12cdbf(0x18e)][_0x12cdbf(0x100)],N=(_0x5b6837,_0x5052e3,_0x451882)=>_0x5052e3 in _0x5b6837?ge(_0x5b6837,_0x5052e3,{'enumerable':!0x0,'configurable':!0x0,'writable':!0x0,'value':_0x451882}):_0x5b6837[_0x5052e3]=_0x451882,E=(_0x580a2f,_0x39ec3b)=>{const _0x40cefc=_0x12cdbf;for(var _0x52627f in _0x39ec3b||(_0x39ec3b={}))xe[_0x40cefc(0x14a)](_0x39ec3b,_0x52627f)&&N(_0x580a2f,_0x52627f,_0x39ec3b[_0x52627f]);if(_){for(var _0x52627f of _(_0x39ec3b))we[_0x40cefc(0x14a)](_0x39ec3b,_0x52627f)&&N(_0x580a2f,_0x52627f,_0x39ec3b[_0x52627f]);}return _0x580a2f;},L=(_0x3f34d7,_0x1463b3)=>be(_0x3f34d7,ye(_0x1463b3)),G=(_0x8740a8,_0x35696a,_0x51c078)=>(N(_0x8740a8,typeof _0x35696a!=_0x12cdbf(0x195)?_0x35696a+'':_0x35696a,_0x51c078),_0x51c078),X={'version':_0x12cdbf(0x1f9)},R={'name':_0x12cdbf(0x232),'length':0x100},ve=!0x0,Ee=[_0x12cdbf(0x178),_0x12cdbf(0x189)];async function Le(){const _0x2e3b2f=_0x12cdbf;let _0x2e0d9e=[_0x2e3b2f(0x178),_0x2e3b2f(0x189)];return await crypto['subtle'][_0x2e3b2f(0x1dd)](R,!0x0,_0x2e0d9e);}async function Te(_0x5d868f){const _0x57673c=_0x12cdbf;let _0x12cb5c=await crypto[_0x57673c(0x213)][_0x57673c(0x21a)](_0x57673c(0x169),_0x5d868f);return JSON[_0x57673c(0x234)](_0x12cb5c);}async function Q(_0x2a9ed6){const _0x3994bb=_0x12cdbf;let _0x53a9ad=JSON[_0x3994bb(0x13b)](_0x2a9ed6);return await crypto['subtle'][_0x3994bb(0x110)](_0x3994bb(0x169),_0x53a9ad,R,ve,Ee);}async function Se(_0x35df03,_0x27f7b0){const _0x3a42fd=_0x12cdbf;let _0x257316=new TextEncoder()[_0x3a42fd(0x17a)](String(_0x35df03)),_0x21662b=crypto[_0x3a42fd(0x1a1)](new Uint8Array(0xc)),_0x2d872b=await crypto[_0x3a42fd(0x213)][_0x3a42fd(0x178)](L(E({},R),{'iv':_0x21662b}),_0x27f7b0,_0x257316),_0x13da89={'ciphertext':btoa(String[_0x3a42fd(0x140)](...new Uint8Array(_0x2d872b))),'iv':btoa(String['fromCharCode'](..._0x21662b))};return btoa(JSON[_0x3a42fd(0x234)](_0x13da89));}async function ke(_0x269aa3,_0x39363a){const _0x507051=_0x12cdbf;let _0x5cbe07=JSON['parse'](atob(_0x269aa3)),_0xa26d28=new Uint8Array(atob(_0x5cbe07[_0x507051(0x1f2)])[_0x507051(0x18c)]('')[_0x507051(0x1e4)](_0x2cd71=>_0x2cd71[_0x507051(0xf9)](0x0))),_0x11ad61=new Uint8Array(atob(_0x5cbe07['iv'])[_0x507051(0x18c)]('')[_0x507051(0x1e4)](_0x55bd5e=>_0x55bd5e['charCodeAt'](0x0))),_0x2d328a=await crypto['subtle'][_0x507051(0x189)](L(E({},R),{'iv':_0x11ad61}),_0x39363a,_0xa26d28);return new TextDecoder()[_0x507051(0x122)](_0x2d328a);}async function T(){let _0x5d2d07=await Le(),_0x276e3c=await Te(_0x5d2d07);return btoa(_0x276e3c);}async function x(_0x54ff64,_0x12fa69=[]){const _0x3a689b=_0x12cdbf;let _0x131318=await Q(atob(_0x54ff64));return Promise[_0x3a689b(0x14b)](_0x12fa69[_0x3a689b(0x1e4)](_0x2109db=>Se(_0x2109db,_0x131318)));}async function Y(_0x4946b9,_0x4ef7a6=[]){const _0x26412e=_0x12cdbf;let _0x96e033=await Q(atob(_0x4946b9));return Promise[_0x26412e(0x14b)](_0x4ef7a6['map'](_0x408686=>ke(_0x408686,_0x96e033)));}async function Z(_0x1ea6b1=[]){const _0x23b39e=_0x12cdbf;let _0x43febf=await T(),_0x1cf157=await x(_0x43febf,_0x1ea6b1);return console['log'](_0x23b39e(0x11b)+_0x43febf+'\x22'),console[_0x23b39e(0x15f)](_0x23b39e(0x209)+JSON[_0x23b39e(0x234)](_0x1cf157)+'\x27'),{'key':_0x43febf,'encryptedValues':_0x1cf157};}var ee=_0x5910d4=>Math[_0x12cdbf(0x133)](Math[_0x12cdbf(0x1b5)]()*_0x5910d4),w=(_0xe7e72f,_0x6efeec=null)=>{const _0xf2fe11=_0x12cdbf;let _0x576d32=[..._0xe7e72f];_0x6efeec===_0xf2fe11(0x14b)&&(_0x6efeec=_0x576d32[_0xf2fe11(0x23c)]);let _0x7467c8=_0x576d32['length'],_0x3f45f6=[],_0x44c158=new Set();for(;_0x3f45f6[_0xf2fe11(0x23c)]<_0x6efeec;){let _0x55bf2d=ee(_0x7467c8);for(;_0x44c158['has'](_0x55bf2d);)_0x55bf2d=ee(_0x7467c8);_0x44c158[_0xf2fe11(0xf8)](_0x55bf2d),_0x3f45f6[_0xf2fe11(0x198)](_0x576d32[_0x55bf2d]);}return typeof _0x6efeec==_0xf2fe11(0x11a)?_0x3f45f6:_0x3f45f6[0x0];};function b(_0x56e429,_0x3b040f=_0x1b0745=>{}){const _0x568e4f=_0x12cdbf;try{let _0xb3cc2f=new URL(String(_0x56e429)['trim']());return _0xb3cc2f&&_0x3b040f&&_0x3b040f(_0xb3cc2f),_0xb3cc2f;}catch(_0x45df91){console[_0x568e4f(0x145)](_0x568e4f(0x1ad)+_0x56e429+'\x27]');}return null;}function te(_0xdd2e10,_0x2cc796=_0x48f570=>{}){const _0x2bf10b=_0x12cdbf;var _0x143cb7;let _0xfd0dcf=(_0x143cb7=b(_0xdd2e10))==null?void 0x0:_0x143cb7[_0x2bf10b(0x12f)];return _0xfd0dcf&&_0x2cc796&&_0x2cc796(_0xfd0dcf),_0xfd0dcf;}function C(_0x7697a9){const _0x8682f0=_0x12cdbf;return document['createTreeWalker'](_0x7697a9,NodeFilter[_0x8682f0(0x1dc)],_0x5e4d9d=>_0x5e4d9d['nodeValue']['match'](/http/gi)?NodeFilter[_0x8682f0(0x1c2)]:NodeFilter[_0x8682f0(0x115)]);}function Ae(_0x37f440){const _0x4d8b8e=_0x12cdbf;let _0x3ec98b=new Set(),_0x4f60c4=C(_0x37f440),_0x113b0e;for(;_0x113b0e=_0x4f60c4[_0x4d8b8e(0x216)]();)_0x113b0e[_0x4d8b8e(0x228)][_0x4d8b8e(0x18c)](/\s+/)['filter'](_0x105016=>_0x105016[_0x4d8b8e(0x161)]('http'))[_0x4d8b8e(0x229)](_0x4acb38=>b(_0x4acb38,_0x38f8cd=>_0x3ec98b[_0x4d8b8e(0xf8)](_0x38f8cd[_0x4d8b8e(0x1ee)])));return[..._0x3ec98b];}function U(_0x3b8a48){const _0x484ee2=_0x12cdbf;if(_0x3b8a48[_0x484ee2(0x1d5)]){let _0x316987=_0x3b8a48[_0x484ee2(0x1d5)]['trim']();if(_0x316987[_0x484ee2(0x23c)])return _0x316987;}if(_0x3b8a48[_0x484ee2(0x1ee)]){let _0x52579c=_0x3b8a48[_0x484ee2(0x1ee)]['trim']();if(_0x52579c[_0x484ee2(0x23c)])return _0x52579c;}return'';}function Re(_0x3c3f9e){const _0x52d9ee=_0x12cdbf;let _0xa4955f=new Set();return _0x3c3f9e[_0x52d9ee(0x1d5)]&&b(_0x3c3f9e[_0x52d9ee(0x1d5)],_0x38ab76=>_0xa4955f[_0x52d9ee(0xf8)](_0x38ab76[_0x52d9ee(0x1ee)])),_0x3c3f9e[_0x52d9ee(0x1ee)]&&b(_0x3c3f9e[_0x52d9ee(0x1ee)],_0x4345be=>_0xa4955f[_0x52d9ee(0xf8)](_0x4345be['href'])),_0x3c3f9e['querySelectorAll'](_0x52d9ee(0x109))['forEach'](_0x186631=>b(U(_0x186631),_0x301584=>_0xa4955f[_0x52d9ee(0xf8)](_0x301584[_0x52d9ee(0x1ee)]))),[..._0xa4955f];}function O(_0x4ec968,_0x41f7dd=[],_0x1e526e=[]){const _0x185edf=_0x12cdbf;let _0x38890a=te(_0x4ec968);return _0x1e526e[_0x185edf(0x1a9)]('*')||_0x1e526e[_0x185edf(0xfe)](_0x1fa016=>_0x38890a[_0x185edf(0x1d8)](_0x1fa016))?!0x1:!!(_0x41f7dd[_0x185edf(0xfe)](_0x450ee4=>_0x38890a['endsWith'](_0x450ee4))||_0x41f7dd[_0x185edf(0x1a9)]('*')&&(_0x38890a||_0x4ec968[_0x185edf(0x161)]('data:')||_0x4ec968['startsWith'](_0x185edf(0x221))||_0x4ec968[_0x185edf(0x161)](_0x185edf(0x16b))));}function re(_0x4a3735){const _0x36f3ea=_0x12cdbf;return[..._0x4a3735[_0x36f3ea(0x1be)]((_0x4bc6cc,_0x1836bb)=>(te(_0x1836bb,_0x5a972e=>_0x4bc6cc[_0x36f3ea(0xf8)](_0x5a972e)),_0x4bc6cc),new Set())];}function ie(_0x2ac3c8){let _0x4d434d=Re(_0x2ac3c8),_0x105c70=Ae(_0x2ac3c8);return[...new Set([..._0x4d434d,..._0x105c70])];}var ne={'attachment':'trix-embed/attachment'},se={'avif':_0x12cdbf(0x1a3),'bmp':'image/bmp','gif':_0x12cdbf(0x1ec),'heic':_0x12cdbf(0x1eb),'heif':'image/heif','ico':_0x12cdbf(0x1ed),'jp2':_0x12cdbf(0x15b),'jpeg':_0x12cdbf(0x1bb),'jpg':_0x12cdbf(0x1bb),'jxr':_0x12cdbf(0x11e),'png':'image/png','svg':'image/svg+xml','tif':'image/tiff','tiff':_0x12cdbf(0x1e7),'webp':'image/webp'},Ue=se,Me=[_0x12cdbf(0x15e),_0x12cdbf(0x1db),_0x12cdbf(0x21e),_0x12cdbf(0x1fc),'audio',_0x12cdbf(0x1d2),_0x12cdbf(0x1f4),_0x12cdbf(0x15a),_0x12cdbf(0x17b),_0x12cdbf(0x200),_0x12cdbf(0x19d),_0x12cdbf(0x193),_0x12cdbf(0x22b),_0x12cdbf(0x1e9),'link','object',_0x12cdbf(0x1ca),_0x12cdbf(0x10b),_0x12cdbf(0x18a),'use','video'],Ne=['audio','embed','iframe',_0x12cdbf(0x210),_0x12cdbf(0x233),_0x12cdbf(0x1ca),_0x12cdbf(0x10b),_0x12cdbf(0x18a),_0x12cdbf(0x118),_0x12cdbf(0x1cf),_0x12cdbf(0x101),_0x12cdbf(0x12c),_0x12cdbf(0x1e0),_0x12cdbf(0x186)],ae=_0x12cdbf(0x1b9),oe=_0x12cdbf(0x1f1),le=Me[_0x12cdbf(0x1b8)](Ne);function ce(_0x15f10f){const _0x4d121f=_0x12cdbf;return!!Object['values'](se)[_0x4d121f(0xfe)](_0x5155f5=>_0x5155f5===P(_0x15f10f));}function P(_0x2df8ed){const _0xc385b=_0x12cdbf;let _0xe14954;if(_0xe14954=b(_0x2df8ed),!_0xe14954)return null;let _0x212474=_0xe14954[_0xc385b(0x208)][_0xc385b(0x15d)]('.');if(!_0x212474)return null;let _0x94b9c3=_0xe14954[_0xc385b(0x208)][_0xc385b(0x219)](_0x212474+0x1);return Ue[_0x94b9c3];}var j,H,me=new Set(),Ce=ae+'[data-controller~=\x22trix-embed\x22]';function he(_0x1dc2cf){const _0x25a0df=_0x12cdbf;var _0x50ed6e;let {method:_0x455735,action:_0x45383f}=_0x1dc2cf||{};return _0x45383f=((_0x50ed6e=b(_0x45383f))==null?void 0x0:_0x50ed6e['pathname'])||_0x45383f,(_0x455735+':'+_0x45383f)[_0x25a0df(0x11d)]()['toLowerCase']();}function _0x17dc(_0x465c2b,_0x447cba){const _0x4ab083=_0x4ab0();return _0x17dc=function(_0x17dc3d,_0x1eb2ce){_0x17dc3d=_0x17dc3d-0xf8;let _0xbd6a07=_0x4ab083[_0x17dc3d];return _0xbd6a07;},_0x17dc(_0x465c2b,_0x447cba);}function ue(_0x1d766c,_0x1c4eea){const _0x4d98ba=_0x12cdbf;if(!_0x1d766c)return;let _0x437df4=he(_0x1d766c);me[_0x4d98ba(0xf8)]({'key':_0x437df4,'form':_0x1d766c,'input':_0x1c4eea});}function Oe(_0x6ac4a5){const _0x104578=_0x12cdbf;var _0x486c61;let _0x1f0168=he(_0x6ac4a5),_0x896732=[...me]['filter'](_0x385987=>_0x385987[_0x104578(0x1c4)]===_0x1f0168);if(!_0x896732[_0x104578(0x23c)])return!0x0;if(_0x6ac4a5[_0x104578(0x148)])return!0x1;if(_0x6ac4a5[_0x104578(0x179)](Ce))return!0x0;let _0xb3a374=new FormData(_0x6ac4a5),_0x54a4c8=((_0x486c61=b(_0x6ac4a5[_0x104578(0x223)]))==null?void 0x0:_0x486c61[_0x104578(0x1de)])||new URLSearchParams();return!_0x896732['map'](_0x5826d7=>_0x5826d7[_0x104578(0x233)])['map'](_0x53798d=>!(_0x53798d[_0x104578(0x16c)]&&(_0xb3a374[_0x104578(0x1ea)](_0x53798d[_0x104578(0x16c)])||_0x54a4c8[_0x104578(0x1ea)](_0x53798d[_0x104578(0x16c)]))||_0x53798d['id']&&(_0xb3a374[_0x104578(0x1ea)](_0x53798d['id'])||_0x54a4c8['has'](_0x53798d['id']))))['includes'](!0x1);}function de(_0x1ef7d1){const _0xa8b41c=_0x12cdbf;Oe(_0x1ef7d1[_0xa8b41c(0x20a)])||_0x1ef7d1['preventDefault']();}function F(_0x4f4cab){const _0x478824=_0x12cdbf;_0x4f4cab[_0x478824(0x17e)](_0x478824(0x124),de,!0x0),_0x4f4cab[_0x478824(0x19b)](_0x478824(0x124),de,!0x0);}function Pe(){const _0x26f7dc=_0x12cdbf;if(j)return;let _0x4fdd1a=Document[_0x26f7dc(0x18e)][_0x26f7dc(0x1f7)];j={'value':function(){const _0x5f558d=_0x26f7dc;let _0x57eefc=_0x4fdd1a['apply'](this,arguments);try{String(arguments[0x0])[_0x5f558d(0x1a6)]()===_0x5f558d(0x170)&&F(_0x57eefc);}catch(_0x3de65a){}return _0x57eefc;},'configurable':!0x1},Object[_0x26f7dc(0x212)](Document[_0x26f7dc(0x18e)],_0x26f7dc(0x1f7),j);}function D(_0x21f23c=0x0){const _0x537034=_0x12cdbf;if(!document[_0x537034(0x194)]&&_0x21f23c<0xa)return setTimeout(()=>D(_0x21f23c+0x1),0x32);H||(H=new MutationObserver(_0x5544aa=>_0x5544aa[_0x537034(0x229)](_0x3e4209=>_0x3e4209['addedNodes']['forEach'](_0x305e6a=>{_0x305e6a instanceof HTMLFormElement&&F(_0x305e6a);}))),H['observe'](document['body'],{'childList':!0x0,'subtree':!0x0}));}addEventListener(_0x12cdbf(0x1ae),()=>D()),Pe(),D(),document['querySelectorAll'](_0x12cdbf(0x1d7))[_0x12cdbf(0x229)](_0x13b127=>F(_0x13b127));function _0x4ab0(){const _0x34cff9=['searchParams','1149777VTtQqo','picture','8680720ERAnKK','toLowerCase','9012GIIpBV','map','read','[id]','image/tiff','www.embed.localhost','image','has','image/heic','image/gif','image/x-icon','href','big','rememberConfig','action-text-attachment','ciphertext','inputElement','embed','prohibited','15620AvRbnO','createElement','data-trix-embed-prohibited','0.0.4','firstElementChild','Content\x20includes\x20links\x20or\x20media\x20from\x20restricted\x20protocols\x20or\x20prohibited\x20hosts.','area','insertLineBreak','defineProperties','allowedHosts','feTile','formElement','extractLabelFromElement','size','tagName','toolbar','obfuscate','flat','pathname','data-trix-embed-hosts-value=\x27','target','alt','textContent','error','<br>','address','img','Prohibited\x20Link:','defineProperty','subtle','TrixEmbed','3vdMcbG','nextNode','setSelectedRange','warning','substring','exportKey','allowpaymentrequest','finally','insertAttachment','animateTransform','hostsValueDescriptors','sort','news:','link','action','Prohibited\x20Hosts','inline','https://example.com','createTemplateElement','nodeValue','forEach','loading','iframe','div','blockedHosts','[data-trix-action=\x22link\x22]','<li>Not\x20configured</li>','trix-embed','\x0a\x20\x20\x20\x20<div\x20data-trix-embed\x20data-trix-embed-warning>\x0a\x20\x20\x20\x20\x20\x20<h1>{{header}}</h1>\x0a\x20\x20\x20\x20\x20\x20<h3>{{subheader}}</h3>\x0a\x0a\x20\x20\x20\x20\x20\x20<h2>{{prohibited.header}}</h2>\x0a\x20\x20\x20\x20\x20\x20<ul>{{prohibited.hosts}}</ul>\x0a\x0a\x20\x20\x20\x20\x20\x20<h2>{{allowed.header}}</h2>\x0a\x20\x20\x20\x20\x20\x20<ul>{{allowed.hosts}}</ul>\x0a\x20\x20\x20\x20</div>\x0a\x20\x20','AES-GCM','input','stringify','querySelectorAll','element','attachment','197092jCDOth','sanitizePastedElement','paste','xml:lang','length','http','Copy/Paste\x20Warning','Value','add','charCodeAt','32312lvFTBA','insertNewlines','replace','sub','find','previousElementSibling','propertyIsEnumerable','frameset','beforeunload','<li>','HostsValue','string','https://test.com','replaceAll','www.trix.test','[src],\x20[href]','(Embedded\x20Above)','source','trix.embed.test','allowedMediaHosts','embed.localhost','editor','importKey','blockquote','resolve','title','Prohibited\x20URL:','FILTER_SKIP','embedded','figcaption','video','renderEmbed','number','data-trix-embed-key-value=\x22','3105qRpyNl','trim','image/vnd.ms-photo','Prohibited\x20Media:','allowedLinkHosts','del','decode','ceil','submit','beforeFetchResponse','<a\x20href=\x27{{url}}\x27>{{label}}</a>','reservedDomains','default','referrerpolicy','template','</div>','object','dfn','securityHosts','host','kbd','hasOwnProperty','obscurityHosts','floor','trix.test','sup','sgid','\x0a\x20\x20\x20\x20<div\x20data-trix-embed>\x0a\x20\x20\x20\x20\x20\x20<img\x20src=\x27{{src}}\x27\x20loading=\x27lazy\x27></img>\x0a\x20\x20\x20\x20</div>\x0a\x20\x20','data-trix-embed','connect','reconnect','parse','Allowed\x20Media:','removeItem','small','filesize','fromCharCode','controller','closest','data-trix-embed-warning','time','info','abbr','blockedMediaHosts','trixEmbedPasting','trix-paste','call','all','span','www.embed.local','data-trix-embed-paranoid-value','match','render','strong','getAttribute','793277JZVkhH','cite','disconnect','onBeforeUnload','innerHTML','figure','</li>','feDisplacementMap','image/jp2','replacement','lastIndexOf','animate','log','content','startsWith','then','join','guard','data-controller','ins','data-trix-embed-error','TemplateValue','jwk','protect','tel:','name','lang','catch','write','FORM','caption','www.embed.test','embed.test','804amQYjj','renderWarnings','allowfullscreen','All','encrypt','querySelector','encode','feImage','www.trix.localhost','Failed\x20to\x20get\x20\x27','removeEventListener','Unhandled\x20Exception!','pre','toolbarElement','trix-file-accept','onBeforeFetchResponse','generateStorageKey','replaceWith','use','forgetConfig','cloneNode','decrypt','track','trix.invalid','split','templates','prototype','embed.example','getElementById','preventDefault','paranoid','font-face-uri','body','symbol','getOwnPropertySymbols','renderError','push','sanitize','remove','addEventListener','store','filter','trix.localhost','embed.invalid','valueDescriptorMap','getRandomValues','sandbox','image/avif','[data-trix-button-group=\x22file-tools\x22]','previewable','toUpperCase','www.embed.example','<div>','includes','initializeTemplate','setAttribute','2092LKvzmA','Failed\x20to\x20parse\x20URL!\x20value=\x27','load','\x0a\x20\x20\x20\x20<div\x20data-trix-embed>\x0a\x20\x20\x20\x20\x20\x20<iframe\x20src=\x27{{src}}\x27\x20loading=\x27lazy\x27\x20referrerpolicy=\x27no-referrer\x27\x20scrolling=\x27no\x27></iframe>\x0a\x20\x20\x20\x20</div>\x0a\x20\x20','removeAttribute','www.trix.invalid','presentation','data-trix-embed-','bind','random','insertHTML','32lMqWJk','concat','trix-editor','www.trix.example','image/jpeg','slice','data-blob-url-template','reduce','turbo:before-fetch-response','replacements','blockedLinkHosts','FILTER_ACCEPT','insert','key','height','code','initializeTempates','values','createAttachment','script','preventAttachments','setItem','reverse','onPaste','frame','filename','acronym','base','isArray','renderEmbeds','src','attributes','form','endsWith','register','www.trix.local','animateMotion','SHOW_TEXT','generateKey'];_0x4ab0=function(){return _0x34cff9;};return _0x4ab0();}var S=class{constructor(_0x5a8783){const _0x19d70f=_0x12cdbf;this[_0x19d70f(0x141)]=_0x5a8783;}[_0x12cdbf(0x1cb)](){const _0x1271de=_0x12cdbf;var _0x48c5ee,_0x338fa6,_0x3aab99,_0x44206c,_0x7b2c9;(_0x48c5ee=this[_0x1271de(0x10f)])==null||_0x48c5ee[_0x1271de(0x1b0)]('data-direct-upload-url'),(_0x338fa6=this[_0x1271de(0x10f)])==null||_0x338fa6['removeAttribute'](_0x1271de(0x1bd)),(_0x3aab99=this[_0x1271de(0x10f)])==null||_0x3aab99[_0x1271de(0x19b)](_0x1271de(0x182),_0x1f09b5=>_0x1f09b5[_0x1271de(0x191)](),!0x0),(_0x7b2c9=(_0x44206c=this[_0x1271de(0x205)])==null?void 0x0:_0x44206c[_0x1271de(0x179)](_0x1271de(0x1a4)))==null||_0x7b2c9['remove']();}async['preventLinks'](){const _0x3ff850=_0x12cdbf;var _0x53fd85,_0x5b3e6a;let _0x1c08b6=await this[_0x3ff850(0x141)][_0x3ff850(0x120)];!(await this[_0x3ff850(0x141)][_0x3ff850(0x1c1)])['length']&&_0x1c08b6[_0x3ff850(0x1a9)]('*')||(_0x5b3e6a=(_0x53fd85=this[_0x3ff850(0x205)])==null?void 0x0:_0x53fd85[_0x3ff850(0x179)](_0x3ff850(0x22e)))==null||_0x5b3e6a[_0x3ff850(0x19a)]();}[_0x12cdbf(0x16a)](_0x1659ee=0x0){const _0x2c0b5f=_0x12cdbf;if(!this[_0x2c0b5f(0x205)]&&_0x1659ee<0xa)return setTimeout(()=>this[_0x2c0b5f(0x16a)](_0x1659ee+0x1),0x19);this['preventAttachments'](),this['preventLinks'](),this[_0x2c0b5f(0x1d7)]&&ue(this[_0x2c0b5f(0x1d7)],this['input']);}get['editor'](){return this['controller']['element'];}get[_0x12cdbf(0x205)](){const _0x30a9f7=_0x12cdbf;return this[_0x30a9f7(0x141)][_0x30a9f7(0x181)];}get[_0x12cdbf(0x1d7)](){const _0x5a5981=_0x12cdbf;return this[_0x5a5981(0x141)][_0x5a5981(0x201)];}get[_0x12cdbf(0x233)](){const _0x42a1d7=_0x12cdbf;return this[_0x42a1d7(0x141)][_0x42a1d7(0x1f3)];}},k=class{constructor(_0x546bf3){const _0x288aab=_0x12cdbf;var _0x5aa9a1,_0x34f32a,_0xc70288;let _0x7f7ef7=[location[_0x288aab(0x208)],(_0x34f32a=b((_0x5aa9a1=_0x546bf3['formElement'])==null?void 0x0:_0x5aa9a1[_0x288aab(0x223)]))==null?void 0x0:_0x34f32a['pathname'],(_0xc70288=_0x546bf3[_0x288aab(0x236)][_0x288aab(0x142)](_0x288aab(0x1e6)))==null?void 0x0:_0xc70288['id']];this['controller']=_0x546bf3,this['identifier']=_0x7f7ef7[_0x288aab(0x19d)](_0x355494=>_0x355494&&_0x355494['length'])[_0x288aab(0x163)]('/')[_0x288aab(0xfc)](/\/{2,}/g,'/'),this[_0x288aab(0x1d2)]=this[_0x288aab(0x206)](this['identifier']);}['split'](_0x1acc36){const _0x409f30=_0x12cdbf;let _0x4c7e39=Math[_0x409f30(0x123)](_0x1acc36[_0x409f30(0x23c)]/0x2);return[_0x1acc36['slice'](0x0,_0x4c7e39),_0x1acc36[_0x409f30(0x1bc)](_0x4c7e39)];}[_0x12cdbf(0x206)](_0x1afa9c){const _0x1ef5a2=_0x12cdbf;var _0x1778ff;let _0x135f63=[..._0x1afa9c][_0x1ef5a2(0x1e4)](_0x3c99ed=>_0x3c99ed[_0x1ef5a2(0xf9)](0x0));return[(_0x1778ff=this[_0x1ef5a2(0x18c)](_0x135f63)[0x1])==null?void 0x0:_0x1778ff[_0x1ef5a2(0x1cd)](),_0x135f63[0x0]][_0x1ef5a2(0x207)]()[_0x1ef5a2(0x163)]('');}[_0x12cdbf(0x1e5)](_0x3eb52a){const _0x182ade=_0x12cdbf;return sessionStorage['getItem'](this[_0x182ade(0x184)](_0x3eb52a));}[_0x12cdbf(0x16f)](_0x2eca6b,_0x379b0b){const _0x61044f=_0x12cdbf;return sessionStorage[_0x61044f(0x1cc)](this[_0x61044f(0x184)](_0x2eca6b),_0x379b0b);}[_0x12cdbf(0x19a)](_0x236ae7){const _0x3ffaf1=_0x12cdbf;return sessionStorage[_0x3ffaf1(0x13d)](this[_0x3ffaf1(0x184)](_0x236ae7));}[_0x12cdbf(0x184)](_0x24ba11){const _0x5152ed=_0x12cdbf;let _0x38975a=[...this[_0x5152ed(0x206)](_0x24ba11)],[_0x3bd51c,_0x294c1d]=this[_0x5152ed(0x18c)](_0x38975a);return btoa(_0x3bd51c+'/'+this[_0x5152ed(0x1d2)]+'/'+_0x294c1d);}},V={'link':_0x12cdbf(0x126),'embedded':'\x0a\x20\x20\x20\x20<span>\x0a\x20\x20\x20\x20\x20\x20<strong>{{label}}</strong>\x0a\x20\x20\x20\x20\x20\x20<span>{{description}}</span>\x0a\x20\x20\x20\x20\x20\x20<del>{{url}}</del>\x0a\x20\x20\x20\x20</span>\x0a\x20\x20','prohibited':'\x0a\x20\x20\x20\x20<span>\x0a\x20\x20\x20\x20\x20\x20<strong>{{label}}</strong>\x0a\x20\x20\x20\x20\x20\x20<span>{{description}}</span>\x0a\x20\x20\x20\x20\x20\x20<del>{{url}}</del>\x0a\x20\x20\x20\x20</span>\x0a\x20\x20','error':'\x0a\x20\x20\x20\x20<div\x20data-trix-embed\x20data-trix-embed-error>\x0a\x20\x20\x20\x20\x20\x20<h1>{{header}}</h1>\x0a\x20\x20\x20\x20\x20\x20<pre><code>{{error.stack}}</code></pre>\x0a\x20\x20\x20\x20</div>\x0a\x20\x20','iframe':_0x12cdbf(0x1af),'image':_0x12cdbf(0x137),'warning':_0x12cdbf(0x231)},je=[oe,'a',_0x12cdbf(0x146),_0x12cdbf(0x1d1),_0x12cdbf(0x20f),'b',_0x12cdbf(0x1ef),_0x12cdbf(0x111),'br',_0x12cdbf(0x154),_0x12cdbf(0x1c6),'dd',_0x12cdbf(0x121),_0x12cdbf(0x12d),_0x12cdbf(0x22c),'dl','dt','em',_0x12cdbf(0x117),_0x12cdbf(0x158),'h1','h2','h3','h4','h5','h6','hr','i',_0x12cdbf(0x22b),_0x12cdbf(0x210),_0x12cdbf(0x166),_0x12cdbf(0x130),'li','ol','p',_0x12cdbf(0x180),'samp',_0x12cdbf(0x13e),_0x12cdbf(0x14c),_0x12cdbf(0x151),_0x12cdbf(0xfd),_0x12cdbf(0x135),_0x12cdbf(0x144),'tt','ul','var'],He=['abbr','allow',_0x12cdbf(0x176),_0x12cdbf(0x21b),_0x12cdbf(0x20b),_0x12cdbf(0x171),_0x12cdbf(0x154),'content-type','credentialless','csp',_0x12cdbf(0x138),_0x12cdbf(0x167),_0x12cdbf(0x1f8),_0x12cdbf(0x143),'datetime',_0x12cdbf(0x1d0),_0x12cdbf(0x13f),_0x12cdbf(0x1c5),_0x12cdbf(0x1ee),_0x12cdbf(0x16d),_0x12cdbf(0x22a),_0x12cdbf(0x16c),_0x12cdbf(0x1b2),_0x12cdbf(0x1a5),_0x12cdbf(0x129),_0x12cdbf(0x1a2),_0x12cdbf(0x136),_0x12cdbf(0x1d5),'srcdoc',_0x12cdbf(0x113),'url','width',_0x12cdbf(0x23b)],A=class{constructor(_0x11989c){const _0x5f2d63=_0x12cdbf;this['controller']=_0x11989c,this[_0x5f2d63(0x1c7)]();}['sanitize'](_0x41395e){const _0x485ee7=_0x12cdbf;let _0x54378a=document[_0x485ee7(0x1f7)](_0x485ee7(0x12a));_0x54378a[_0x485ee7(0x157)]=_0x485ee7(0x1a8)+_0x41395e+_0x485ee7(0x12b);let _0x4e2a1f=_0x54378a[_0x485ee7(0x160)][_0x485ee7(0x1fa)];return[_0x4e2a1f][_0x485ee7(0x1b8)]([..._0x4e2a1f[_0x485ee7(0x235)]('*')])['forEach'](_0x583644=>{const _0x1177fe=_0x485ee7;je[_0x1177fe(0x1a9)](_0x583644[_0x1177fe(0x204)]['toLowerCase']())?[..._0x583644[_0x1177fe(0x1d6)]][_0x1177fe(0x229)](_0x5a970c=>{const _0x53c762=_0x1177fe;He[_0x53c762(0x1a9)](_0x5a970c['name'][_0x53c762(0x1e2)]())||_0x583644[_0x53c762(0x1b0)](_0x5a970c[_0x53c762(0x16c)]);}):_0x583644['remove']();}),_0x4e2a1f[_0x485ee7(0x157)];}[_0x12cdbf(0x1c7)](){this['templates']=V,Object['keys'](V)['forEach'](_0x3ec14a=>this['initializeTemplate'](_0x3ec14a));}[_0x12cdbf(0x1aa)](_0xe4078){const _0xc4654c=_0x12cdbf;var _0x271706,_0x287c11;let _0x2cbc14=_0xe4078+_0xc4654c(0x168),_0x44c57a=this[_0xc4654c(0x141)][_0x2cbc14],_0x25e3e2=_0x44c57a?(_0x287c11=(_0x271706=document['getElementById'](_0x44c57a))==null?void 0x0:_0x271706['innerHTML'])==null?void 0x0:_0x287c11[_0xc4654c(0x11d)]():null;return this[_0xc4654c(0x141)][_0x2cbc14]=null,_0x25e3e2&&(this[_0xc4654c(0x18d)][_0xe4078]=_0x25e3e2),this['templates'][_0xe4078];}[_0x12cdbf(0x150)](_0x8a1db,_0x1ce989={}){const _0x44a01a=_0x12cdbf;return this[_0x44a01a(0x18d)][_0x8a1db]['replace'](/{{(.*?)}}/g,(_0x36b412,_0x564917)=>_0x564917[_0x44a01a(0x18c)]('.')[_0x44a01a(0x1be)]((_0x5342d8,_0x44c44a)=>_0x5342d8[_0x44c44a],_0x1ce989));}[_0x12cdbf(0x119)](_0x5d91ac=_0x12cdbf(0x226)){const _0x45f30c=_0x12cdbf;let _0x1dd45a=ce(_0x5d91ac)?this[_0x45f30c(0x150)](_0x45f30c(0x1e9),{'src':_0x5d91ac}):this[_0x45f30c(0x150)](_0x45f30c(0x22b),{'src':_0x5d91ac});return this[_0x45f30c(0x199)](_0x1dd45a);}['renderEmbeds'](_0x457186=[_0x12cdbf(0x226),_0x12cdbf(0x106)]){const _0x1a7093=_0x12cdbf;if(_0x457186!=null&&_0x457186[_0x1a7093(0x23c)])return _0x457186[_0x1a7093(0x1e4)](_0x1adac8=>this['renderEmbed'](_0x1adac8));}[_0x12cdbf(0x175)](_0x24503f=[_0x12cdbf(0x226),_0x12cdbf(0x106)],_0x51db71=[],_0x39d4ec=[]){const _0x431ef9=_0x12cdbf;if(_0x24503f!=null&&_0x24503f[_0x431ef9(0x23c)])return _0x51db71=[..._0x51db71][_0x431ef9(0x220)](),_0x51db71[_0x431ef9(0x1a9)]('*')&&(_0x51db71=[_0x431ef9(0x177)]),_0x39d4ec=[...new Set([..._0x39d4ec,...re(_0x24503f)])][_0x431ef9(0x220)](),_0x39d4ec['includes']('*')&&(_0x39d4ec=['All']),this[_0x431ef9(0x150)](_0x431ef9(0x218),{'header':_0x431ef9(0x23e),'subheader':_0x431ef9(0x1fb),'prohibited':{'header':_0x431ef9(0x224),'hosts':_0x39d4ec['length']?_0x39d4ec[_0x431ef9(0x1e4)](_0x290e09=>_0x431ef9(0x103)+_0x290e09+_0x431ef9(0x159))[_0x431ef9(0x163)](''):_0x431ef9(0x22f)},'allowed':{'header':'Allowed\x20Hosts','hosts':_0x51db71[_0x431ef9(0x23c)]?_0x51db71[_0x431ef9(0x1e4)](_0x5749e7=>_0x431ef9(0x103)+_0x5749e7+_0x431ef9(0x159))[_0x431ef9(0x163)](''):_0x431ef9(0x22f)}});}['renderError'](_0x1e344b){const _0x1279e7=_0x12cdbf;return this[_0x1279e7(0x150)]('error',{'header':_0x1279e7(0x17f),'subheader':'Report\x20this\x20problem\x20to\x20a\x20software\x20engineer.','error':_0x1e344b});}};function pe(_0x2fdcde={'Controller':null,'Trix':null}){const _0x3a5699=_0x12cdbf;var _0x38fb47;let {Controller:_0x15e84d,Trix:_0x3c92f6}=_0x2fdcde;return _0x38fb47=class extends _0x15e84d{[_0x3a5699(0x139)](){const _0x496932=_0x3a5699;this['onPaste']=this[_0x496932(0x23a)][_0x496932(0x1b4)](this),this[_0x496932(0x236)][_0x496932(0x19b)]('trix-paste',this[_0x496932(0x1ce)],!0x0),this[_0x496932(0x183)]=this[_0x496932(0x125)][_0x496932(0x1b4)](this),addEventListener(_0x496932(0x1bf),this[_0x496932(0x183)],!0x0),this['onBeforeUnload']=this[_0x496932(0x187)][_0x496932(0x1b4)](this),addEventListener('beforeunload',this[_0x496932(0x156)],!0x0),this[_0x496932(0x19c)]=new k(this),this[_0x496932(0x164)]=new S(this),!this[_0x496932(0x1c4)]&&this[_0x496932(0x1f0)]()[_0x496932(0x162)](()=>{const _0x5a4e99=_0x496932;this[_0x5a4e99(0x192)]&&this[_0x5a4e99(0x164)][_0x5a4e99(0x16a)]();});}[_0x3a5699(0x13a)](){const _0xc75235=_0x3a5699;let _0x5e5937=this[_0xc75235(0x236)]['getAttribute'](_0xc75235(0x165))||'',_0x2e0adf=new Set(_0x5e5937[_0xc75235(0x18c)]('\x20'));_0x2e0adf[_0xc75235(0xf8)](_0xc75235(0x230)),this['element'][_0xc75235(0x1ab)](_0xc75235(0x165),[..._0x2e0adf][_0xc75235(0x163)]('\x20')[_0xc75235(0x11d)]());}[_0x3a5699(0x155)](){const _0x46f234=_0x3a5699;this[_0x46f234(0x236)]['removeEventListener'](_0x46f234(0x149),this[_0x46f234(0x1ce)],!0x0),removeEventListener('turbo:before-fetch-response',this[_0x46f234(0x183)],!0x0),removeEventListener(_0x46f234(0x102),this[_0x46f234(0x156)],!0x0),this['reconnect']();}[_0x3a5699(0x125)](_0xe99b20){const _0x22e0c1=_0x3a5699;try{_0xe99b20[_0x22e0c1(0x20a)]['querySelectorAll'](_0x22e0c1(0x1b9))[_0x22e0c1(0x1a9)](this['element'])&&this[_0x22e0c1(0x187)]();}catch(_0x197237){}}async['paste'](_0x5620e7){const _0x5a8302=_0x3a5699;this['formElement']&&(this[_0x5a8302(0x201)][_0x5a8302(0x148)]=!0x0);try{let {html:_0x5c09b3,string:_0x43856c,range:_0x15f76d}=_0x5620e7[_0x5a8302(0x23a)],_0x36b6fb=_0x5c09b3||_0x43856c||'',_0x4da7d6=this[_0x5a8302(0x227)](_0x36b6fb),_0x96b4cf=ie(_0x4da7d6);if(!_0x96b4cf[_0x5a8302(0x23c)])return;_0x5620e7[_0x5a8302(0x191)](),this[_0x5a8302(0x10f)][_0x5a8302(0x217)](_0x15f76d);let _0xbcfb92=new A(this);try{let _0x4f514f=await this[_0x5a8302(0x10d)],_0x3c7d42=await this[_0x5a8302(0x147)],_0x19411c=new Set(_0x96b4cf[_0x5a8302(0x19d)](_0x368938=>P(_0x368938)));[..._0x4da7d6['querySelectorAll']('iframe')][_0x5a8302(0x229)](_0x58df39=>_0x19411c[_0x5a8302(0xf8)](_0x58df39[_0x5a8302(0x1d5)])),_0x19411c=[..._0x19411c];let _0x586e7b=_0x19411c[_0x5a8302(0x19d)](_0x3d88c6=>O(_0x3d88c6,_0x4f514f,_0x3c7d42)),_0x59b30c=_0x19411c[_0x5a8302(0x19d)](_0x3586d4=>!_0x586e7b[_0x5a8302(0x1a9)](_0x3586d4)),_0x534f7e=await this[_0x5a8302(0x120)],_0x2359ef=await this[_0x5a8302(0x1c1)],_0x4e938c=_0x96b4cf['filter'](_0x3e0636=>!_0x19411c['includes'](_0x3e0636)),_0x192410=_0x4e938c['filter'](_0x19b8a2=>O(_0x19b8a2,_0x534f7e,_0x2359ef)),_0x274e93=_0x4e938c[_0x5a8302(0x19d)](_0x386149=>!_0x192410['includes'](_0x386149));if(_0x59b30c[_0x5a8302(0x23c)]||_0x274e93[_0x5a8302(0x23c)]){let _0x21f70c=[...new Set([..._0x59b30c,..._0x274e93])],_0x1612bc=[...new Set([..._0x4f514f,..._0x534f7e])][_0x5a8302(0x19d)](_0x366a14=>!this['reservedDomains'][_0x5a8302(0x1a9)](_0x366a14)),_0x4c69c3=[...new Set([..._0x3c7d42,..._0x2359ef])]['filter'](_0x45a169=>!this[_0x5a8302(0x127)][_0x5a8302(0x1a9)](_0x45a169));console[_0x5a8302(0x15f)](_0x5a8302(0x1ff),_0x1612bc),console[_0x5a8302(0x15f)](_0x5a8302(0x22d),_0x4c69c3),await this[_0x5a8302(0x1c3)](_0xbcfb92[_0x5a8302(0x175)](_0x21f70c,_0x1612bc,_0x4c69c3));}if(_0x586e7b[_0x5a8302(0x23c)]&&await this[_0x5a8302(0x1c3)](_0xbcfb92[_0x5a8302(0x1d4)](_0x586e7b)),_0x96b4cf[_0x5a8302(0x23c)]===0x1&&_0x586e7b[_0x5a8302(0x23c)]===0x1)return;let _0x488b3e=this[_0x5a8302(0x239)](_0x4da7d6,{'renderer':_0xbcfb92,'validMediaURLs':_0x586e7b,'validLinkURLs':_0x192410})['innerHTML'][_0x5a8302(0x11d)]();_0x488b3e[_0x5a8302(0x23c)]&&await this[_0x5a8302(0x1c3)](_0x488b3e,{'disposition':_0x5a8302(0x225)});}catch(_0x196b5b){this[_0x5a8302(0x1c3)](_0xbcfb92[_0x5a8302(0x197)](_0x196b5b));}}finally{this[_0x5a8302(0x201)]&&delete this['formElement'][_0x5a8302(0x148)];}}[_0x3a5699(0x227)](_0xca9736){const _0x2ae319=_0x3a5699;let _0xf2fee3=document[_0x2ae319(0x1f7)](_0x2ae319(0x12a));return _0xf2fee3[_0x2ae319(0x157)]=_0x2ae319(0x1a8)+_0xca9736['trim']()+'</div>',_0xf2fee3[_0x2ae319(0x160)][_0x2ae319(0x1fa)];}[_0x3a5699(0x202)](_0x25e100,_0x43222d={'default':null}){const _0x344d2d=_0x3a5699;let _0x2c3671=_0x25e100[_0x344d2d(0x113)];return _0x2c3671&&_0x2c3671[_0x344d2d(0x23c)]||(_0x2c3671=_0x25e100[_0x344d2d(0x20c)]['trim'](),_0x2c3671&&_0x2c3671['length'])?_0x2c3671:_0x43222d[_0x344d2d(0x128)];}['sanitizePastedElement'](_0x5cb9d0,_0x2adf68={'renderer':null,'validMediaURLs':[],'validLinkURLs':[]}){const _0x1eb8f1=_0x3a5699;let {renderer:_0x2601cd,validMediaURLs:_0x26e694,validLinkURLs:_0xab85e}=_0x2adf68;_0x5cb9d0=_0x5cb9d0[_0x1eb8f1(0x188)](!0x0);let _0x10bdec=C(_0x5cb9d0),_0x1378ea=[],_0x4ba3f0;for(;_0x4ba3f0=_0x10bdec[_0x1eb8f1(0x216)]();)_0x4ba3f0[_0x1eb8f1(0x1c0)]=_0x4ba3f0[_0x1eb8f1(0x1c0)]||new Set(),_0x1378ea[_0x1eb8f1(0x198)](_0x4ba3f0),_0x4ba3f0['nodeValue'][_0x1eb8f1(0x18c)](/\s+/)[_0x1eb8f1(0x19d)](_0x5ab6bf=>_0x5ab6bf[_0x1eb8f1(0x161)](_0x1eb8f1(0x23d)))[_0x1eb8f1(0x229)](_0x3f54a3=>{const _0x3e59bf=_0x1eb8f1;var _0x5a056a;let _0x2ee716=(_0x5a056a=b(_0x3f54a3))==null?void 0x0:_0x5a056a[_0x3e59bf(0x1ee)],_0x516f2f=_0xab85e[_0x3e59bf(0x1a9)](_0x2ee716)||_0xab85e[_0x3e59bf(0x1a9)](_0x2ee716)?_0x2601cd[_0x3e59bf(0x150)](_0x3e59bf(0x222),{'url':_0x2ee716,'label':_0x2ee716}):_0x2601cd[_0x3e59bf(0x150)](_0x3e59bf(0x1f5),{'url':_0x2ee716,'label':_0x3e59bf(0x114),'description':''});_0x4ba3f0['replacements'][_0x3e59bf(0xf8)]({'match':_0x3f54a3,'replacement':_0x516f2f});});return _0x1378ea[_0x1eb8f1(0x229)](_0x38846d=>{const _0x36470b=_0x1eb8f1;if(!_0x38846d[_0x36470b(0x1c0)][_0x36470b(0x203)])return;let _0x3c4b1f=_0x38846d[_0x36470b(0x228)];[..._0x38846d[_0x36470b(0x1c0)]][_0x36470b(0x220)]((_0x25c5b7,_0x3e527e)=>_0x3e527e[_0x36470b(0x14f)][_0x36470b(0x23c)]-_0x25c5b7[_0x36470b(0x14f)][_0x36470b(0x23c)])['forEach'](_0x256106=>_0x3c4b1f=_0x3c4b1f['replaceAll'](_0x256106[_0x36470b(0x14f)],_0x256106[_0x36470b(0x15c)])),_0x38846d[_0x36470b(0x185)](this[_0x36470b(0x227)](_0x3c4b1f));}),_0x5cb9d0[_0x1eb8f1(0x235)]('a')['forEach'](_0x173458=>{const _0xc168e3=_0x1eb8f1;let _0x3a8592=U(_0x173458),_0x2c04b3=this[_0xc168e3(0x202)](_0x173458,{'default':_0x3a8592}),_0x3f6faf=_0xab85e[_0xc168e3(0x1a9)](_0x3a8592)?_0x2601cd['render']('link',{'url':_0x3a8592,'label':_0x2c04b3}):_0x2601cd['render'](_0xc168e3(0x1f5),{'url':_0x3a8592,'label':_0xc168e3(0x211),'description':'('+_0x2c04b3+')'});_0x173458[_0xc168e3(0x185)](this[_0xc168e3(0x227)](_0x3f6faf));}),_0x5cb9d0[_0x1eb8f1(0x235)](le[_0x1eb8f1(0x163)](',\x20'))['forEach'](_0x34a936=>{const _0x1f8866=_0x1eb8f1;let _0x1bac09=U(_0x34a936),_0xb134a1=this['extractLabelFromElement'](_0x34a936,{'default':_0x1bac09}),_0x3cb5e7=_0x26e694['includes'](_0x1bac09)?_0x2601cd[_0x1f8866(0x150)](_0x1f8866(0x116),{'url':_0x1bac09,'label':_0x1f8866(0x13c),'description':_0x1f8866(0x10a)}):_0x2601cd[_0x1f8866(0x150)](_0x1f8866(0x1f5),{'url':_0x1bac09,'label':_0x1f8866(0x11f),'description':''});_0x34a936[_0x1f8866(0x185)](this[_0x1f8866(0x227)](_0x3cb5e7));}),_0x5cb9d0['innerHTML'][_0x1eb8f1(0x107)](/(\n|\r|\f|\v)+/g,_0x1eb8f1(0x20e)),_0x5cb9d0;}[_0x3a5699(0x1c9)](_0x370669){const _0x316120=_0x3a5699;return new _0x3c92f6['Attachment']({'content':_0x370669,'contentType':ne[_0x316120(0x237)]});}[_0x3a5699(0xfb)](_0x35720f=0x1,_0x48cb0d={'delay':0x1}){let {delay:_0x255324}=_0x48cb0d;return new Promise(_0x1e8260=>{setTimeout(()=>{const _0x54ba1b=_0x17dc;for(let _0x544825=0x0;_0x544825<_0x35720f;_0x544825++)this['editor'][_0x54ba1b(0x1fd)]();_0x1e8260();},_0x255324);});}[_0x3a5699(0x21d)](_0x57d975,_0x3c9363={'delay':0x1}){let {delay:_0x34ad95}=_0x3c9363;return new Promise(_0x301cd7=>{setTimeout(()=>{const _0x3acdfa=_0x17dc;this[_0x3acdfa(0x10f)][_0x3acdfa(0x21d)](this[_0x3acdfa(0x1c9)](_0x57d975)),this[_0x3acdfa(0xfb)](0x1,{'delay':_0x34ad95})['finally'](_0x301cd7);},_0x34ad95);});}['insertHTML'](_0x433c25,_0x17255e={'delay':0x1}){let {delay:_0x18fddc}=_0x17255e;return new Promise(_0x34b9eb=>{setTimeout(()=>{const _0x3297f0=_0x17dc;this[_0x3297f0(0x10f)][_0x3297f0(0x1b6)](_0x433c25),this[_0x3297f0(0xfb)](0x1,{'delay':_0x18fddc})[_0x3297f0(0x21c)](_0x34b9eb);},_0x18fddc);});}[_0x3a5699(0x1c3)](_0x4e6f81,_0x570fc1={'delay':0x1,'disposition':'attachment'}){const _0x26d8e3=_0x3a5699;let {delay:_0xbad883,disposition:_0x5877f8}=_0x570fc1;return _0x4e6f81!=null&&_0x4e6f81[_0x26d8e3(0x23c)]?new Promise(_0x1bb7ac=>{setTimeout(()=>{const _0x25f913=_0x17dc;if(typeof _0x4e6f81==_0x25f913(0x105))return _0x5877f8==='inline'?this[_0x25f913(0x1b6)](_0x4e6f81,{'delay':_0xbad883})[_0x25f913(0x16e)](_0x369156=>this[_0x25f913(0x197)](_0x369156))[_0x25f913(0x21c)](_0x1bb7ac):this[_0x25f913(0x21d)](_0x4e6f81,{'delay':_0xbad883})[_0x25f913(0x16e)](_0x4a7cea=>this[_0x25f913(0x197)](_0x4a7cea))[_0x25f913(0x21c)](_0x1bb7ac);if(Array[_0x25f913(0x1d3)](_0x4e6f81)){let _0x5da9df=_0x5877f8===_0x25f913(0x225)?_0x4e6f81[_0x25f913(0x1e4)](_0x4f0a5f=>this[_0x25f913(0x1b6)](_0x4f0a5f,{'delay':_0xbad883+0x1})):_0x4e6f81[_0x25f913(0x1e4)](_0x421eec=>this[_0x25f913(0x21d)](_0x421eec,{'delay':_0xbad883+0x1}));return Promise[_0x25f913(0x14b)](_0x5da9df)[_0x25f913(0x16e)](_0x54e167=>this[_0x25f913(0x197)](_0x54e167))[_0x25f913(0x21c)](_0x1bb7ac);}_0x1bb7ac();});}):Promise[_0x26d8e3(0x112)]();}get[_0x3a5699(0x10f)](){const _0x27e1ba=_0x3a5699;return this[_0x27e1ba(0x236)][_0x27e1ba(0x10f)];}get[_0x3a5699(0x181)](){const _0x5c9b51=_0x3a5699;let _0x5adbd8=this['element'][_0x5c9b51(0x152)](_0x5c9b51(0x205)),_0x5cffd6=_0x5adbd8?document[_0x5c9b51(0x190)](_0x5adbd8):null;if(!_0x5cffd6){let _0x34826b=this[_0x5c9b51(0x236)][_0x5c9b51(0xff)];_0x5cffd6=_0x34826b!=null&&_0x34826b[_0x5c9b51(0x204)]['match'](/trix-toolbar/i)?_0x34826b:null;}return _0x5cffd6;}get[_0x3a5699(0x201)](){const _0x341d4d=_0x3a5699;return this[_0x341d4d(0x236)][_0x341d4d(0x142)]('form');}get['inputElement'](){const _0x482b4e=_0x3a5699;var _0x1f3e4e;let _0x17ca0c=this[_0x482b4e(0x236)][_0x482b4e(0x152)](_0x482b4e(0x233));return _0x17ca0c?(_0x1f3e4e=this[_0x482b4e(0x201)])==null?void 0x0:_0x1f3e4e[_0x482b4e(0x179)]('#'+_0x17ca0c):null;}get[_0x3a5699(0x192)](){const _0x4abd5c=_0x3a5699;return!!this[_0x4abd5c(0x19c)][_0x4abd5c(0x1e5)]('paranoid');}get[_0x3a5699(0x1c4)](){const _0x46d293=_0x3a5699;try{return JSON[_0x46d293(0x13b)](this[_0x46d293(0x19c)][_0x46d293(0x1e5)](_0x46d293(0x1c4)))[0x2];}catch(_0x1c703b){return null;}}get['hostsValueDescriptors'](){const _0xd6583c=_0x3a5699;return Object[_0xd6583c(0x1c8)](this[_0xd6583c(0x1a0)])[_0xd6583c(0x19d)](_0x54651c=>_0x54651c['name']['endsWith'](_0xd6583c(0x104)));}get[_0x3a5699(0x127)](){const _0x31c4a3=_0x3a5699;return[_0x31c4a3(0x18f),_0x31c4a3(0x19f),'embed.local',_0x31c4a3(0x10e),_0x31c4a3(0x173),'trix.embed.example','trix.embed.invalid','trix.embed.local','trix.embed.localhost',_0x31c4a3(0x10c),'trix.example',_0x31c4a3(0x18b),'trix.local',_0x31c4a3(0x19e),_0x31c4a3(0x134),_0x31c4a3(0x1a7),'www.embed.invalid',_0x31c4a3(0x14d),_0x31c4a3(0x1e8),_0x31c4a3(0x172),_0x31c4a3(0x1ba),_0x31c4a3(0x1b1),_0x31c4a3(0x1da),_0x31c4a3(0x17c),_0x31c4a3(0x108)];}['rememberConfig'](){return new Promise(async _0x532651=>{const _0x483374=_0x17dc;let _0x48d16d,_0x2d535c=await T();_0x48d16d=await x(_0x2d535c,w(this[_0x483374(0x127)],0x3)),this[_0x483374(0x19c)]['write'](_0x483374(0x1c4),JSON[_0x483374(0x234)]([_0x48d16d[0x0],_0x48d16d[0x1],_0x2d535c,_0x48d16d[0x2]])),this['paranoidValue']!==!0x1&&(_0x48d16d=await x(_0x2d535c,w(this[_0x483374(0x127)],0x4)),this[_0x483374(0x19c)][_0x483374(0x16f)]('paranoid',JSON[_0x483374(0x234)](_0x48d16d))),this[_0x483374(0x236)][_0x483374(0x1b0)](_0x483374(0x14e)),this['hostsValueDescriptors'][_0x483374(0x229)](async _0x204b4d=>{const _0x494f5a=_0x483374;let {name:_0x4e3a1a}=_0x204b4d,_0x5d8851=_0x4e3a1a[_0x494f5a(0x1bc)](0x0,_0x4e3a1a[_0x494f5a(0x15d)](_0x494f5a(0x23f))),_0x150715=this[_0x4e3a1a];_0x150715['length']<0x4&&(_0x150715=_0x150715[_0x494f5a(0x1b8)](w(this[_0x494f5a(0x127)],0x4-_0x150715[_0x494f5a(0x23c)]))),this[_0x494f5a(0x19c)]['write'](_0x5d8851,JSON[_0x494f5a(0x234)](await x(_0x2d535c,_0x150715))),this['hasOwnProperty'](_0x5d8851)||Object[_0x494f5a(0x212)](this,_0x5d8851,{'get':async()=>{const _0x5e972c=_0x494f5a;try{return(await Y(this['key'],JSON[_0x5e972c(0x13b)](this[_0x5e972c(0x19c)]['read'](_0x5d8851))))['filter'](_0x203285=>!this[_0x5e972c(0x127)][_0x5e972c(0x1a9)](_0x203285));}catch(_0x6790c1){return console[_0x5e972c(0x20d)](_0x5e972c(0x17d)+_0x5d8851+'\x27!',_0x6790c1),[];}}}),this[_0x494f5a(0x236)][_0x494f5a(0x1b0)](_0x494f5a(0x1b3)+_0x204b4d[_0x494f5a(0x1c4)]);}),_0x48d16d=await x(_0x2d535c,w(this[_0x483374(0x127)],0x4)),this[_0x483374(0x19c)]['write']('securityHosts',_0x48d16d),_0x48d16d=await x(_0x2d535c,w(this[_0x483374(0x127)],0x4)),this[_0x483374(0x19c)]['write'](_0x483374(0x132),_0x48d16d),_0x532651();});}['forgetConfig'](){const _0x475077=_0x3a5699;var _0x469f06,_0x2b37d6,_0x33d9c7,_0x8f4ca9;try{(_0x469f06=this[_0x475077(0x19c)])==null||_0x469f06[_0x475077(0x19a)](_0x475077(0x1c4)),(_0x2b37d6=this[_0x475077(0x19c)])==null||_0x2b37d6[_0x475077(0x19a)]('paranoid'),this[_0x475077(0x21f)][_0x475077(0x229)](async _0x2c9219=>{const _0x2753ac=_0x475077;var _0x1e62f1;let {name:_0x102a7b}=_0x2c9219,_0x2de8ee=_0x102a7b['slice'](0x0,_0x102a7b['lastIndexOf']('Value'));(_0x1e62f1=this[_0x2753ac(0x19c)])==null||_0x1e62f1[_0x2753ac(0x19a)](_0x2de8ee);}),(_0x33d9c7=this[_0x475077(0x19c)])==null||_0x33d9c7[_0x475077(0x19a)](_0x475077(0x12e)),(_0x8f4ca9=this[_0x475077(0x19c)])==null||_0x8f4ca9[_0x475077(0x19a)](_0x475077(0x132));}catch(_0x5398a1){}}},G(_0x38fb47,'values',{'embeddedTemplate':String,'errorTemplate':String,'iframeTemplate':String,'imageTemplate':String,'linkTemplate':String,'prohibitedTemplate':String,'warningTemplate':String,'allowedLinkHosts':Array,'blockedLinkHosts':Array,'allowedMediaHosts':Array,'blockedMediaHosts':Array,'paranoid':{'type':Boolean,'default':!0x0}}),_0x38fb47;}var fe=!0x1,Fe={'application':null,'Controller':null,'Trix':null};function De(_0xd6d3f9=Fe){const _0x1289c8=_0x12cdbf;if(fe)return;let {application:_0xfd005e,Controller:_0x383c0f,Trix:_0x39ea74}=_0xd6d3f9;_0xfd005e[_0x1289c8(0x1d9)](_0x1289c8(0x230),pe({'Controller':_0x383c0f,'Trix':_0x39ea74})),fe=!0x0;}self[_0x12cdbf(0x214)]=L(E({},X),{'encryptValues':x,'generateKey':T,'generateKeyAndEncryptValues':Z,'initialize':De});var Tt=self['TrixEmbed'];export{Tt as default};
|
@@ -1 +1 @@
|
|
1
|
-
{"inputs":{"app/javascript/metadata.js":{"bytes":86,"imports":[],"format":"esm"},"app/javascript/encryption.js":{"bytes":4095,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"app/javascript/enumerable.js":{"bytes":517,"imports":[],"format":"esm"},"app/javascript/urls.js":{"bytes":3338,"imports":[],"format":"esm"},"app/javascript/media.js":{"bytes":3618,"imports":[{"path":"app/javascript/urls.js","kind":"import-statement","original":"./urls"}],"format":"esm"},"app/javascript/forms.js":{"bytes":3377,"imports":[{"path":"app/javascript/media.js","kind":"import-statement","original":"./media"},{"path":"app/javascript/urls.js","kind":"import-statement","original":"./urls"}],"format":"esm"},"app/javascript/guard.js":{"bytes":1211,"imports":[{"path":"app/javascript/forms.js","kind":"import-statement","original":"./forms"}],"format":"esm"},"app/javascript/store.js":{"bytes":1219,"imports":[{"path":"app/javascript/urls.js","kind":"import-statement","original":"./urls"}],"format":"esm"},"app/javascript/templates.js":{"bytes":1235,"imports":[],"format":"esm"},"app/javascript/renderer.js":{"bytes":
|
1
|
+
{"inputs":{"app/javascript/metadata.js":{"bytes":86,"imports":[],"format":"esm"},"app/javascript/encryption.js":{"bytes":4095,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"app/javascript/enumerable.js":{"bytes":517,"imports":[],"format":"esm"},"app/javascript/urls.js":{"bytes":3338,"imports":[],"format":"esm"},"app/javascript/media.js":{"bytes":3618,"imports":[{"path":"app/javascript/urls.js","kind":"import-statement","original":"./urls"}],"format":"esm"},"app/javascript/forms.js":{"bytes":3377,"imports":[{"path":"app/javascript/media.js","kind":"import-statement","original":"./media"},{"path":"app/javascript/urls.js","kind":"import-statement","original":"./urls"}],"format":"esm"},"app/javascript/guard.js":{"bytes":1211,"imports":[{"path":"app/javascript/forms.js","kind":"import-statement","original":"./forms"}],"format":"esm"},"app/javascript/store.js":{"bytes":1219,"imports":[{"path":"app/javascript/urls.js","kind":"import-statement","original":"./urls"}],"format":"esm"},"app/javascript/templates.js":{"bytes":1235,"imports":[],"format":"esm"},"app/javascript/renderer.js":{"bytes":5087,"imports":[{"path":"app/javascript/urls.js","kind":"import-statement","original":"./urls"},{"path":"app/javascript/media.js","kind":"import-statement","original":"./media"},{"path":"app/javascript/templates.js","kind":"import-statement","original":"./templates"}],"format":"esm"},"app/javascript/controller.js":{"bytes":16611,"imports":[{"path":"app/javascript/enumerable.js","kind":"import-statement","original":"./enumerable"},{"path":"app/javascript/encryption.js","kind":"import-statement","original":"./encryption"},{"path":"app/javascript/urls.js","kind":"import-statement","original":"./urls"},{"path":"app/javascript/media.js","kind":"import-statement","original":"./media"},{"path":"app/javascript/guard.js","kind":"import-statement","original":"./guard"},{"path":"app/javascript/store.js","kind":"import-statement","original":"./store"},{"path":"app/javascript/renderer.js","kind":"import-statement","original":"./renderer"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"app/javascript/index.js":{"bytes":669,"imports":[{"path":"app/javascript/metadata.js","kind":"import-statement","original":"./metadata"},{"path":"app/javascript/encryption.js","kind":"import-statement","original":"./encryption"},{"path":"app/javascript/controller.js","kind":"import-statement","original":"./controller"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"app/assets/builds/trix-embed.js":{"imports":[],"exports":["default"],"entryPoint":"app/javascript/index.js","inputs":{"app/javascript/metadata.js":{"bytesInOutput":24},"app/javascript/encryption.js":{"bytesInOutput":1346},"app/javascript/enumerable.js":{"bytesInOutput":229},"app/javascript/urls.js":{"bytesInOutput":1203},"app/javascript/media.js":{"bytesInOutput":935},"app/javascript/forms.js":{"bytesInOutput":1352},"app/javascript/guard.js":{"bytesInOutput":1002},"app/javascript/store.js":{"bytesInOutput":835},"app/javascript/templates.js":{"bytesInOutput":969},"app/javascript/renderer.js":{"bytesInOutput":2505},"app/javascript/controller.js":{"bytesInOutput":7987},"app/javascript/index.js":{"bytesInOutput":311}},"bytes":19212}}}
|
@@ -90,10 +90,9 @@ export function getTrixEmbedControllerClass(options = { Controller: null, Trix:
|
|
90
90
|
|
91
91
|
event.preventDefault()
|
92
92
|
this.editor.setSelectedRange(range)
|
93
|
+
const renderer = new Renderer(this)
|
93
94
|
|
94
95
|
try {
|
95
|
-
const renderer = new Renderer(this)
|
96
|
-
|
97
96
|
// Media URLs (images, videos, audio etc.)
|
98
97
|
const allowedMediaHosts = await this.allowedMediaHosts
|
99
98
|
const blockedMediaHosts = await this.blockedMediaHosts
|
@@ -122,6 +121,8 @@ export function getTrixEmbedControllerClass(options = { Controller: null, Trix:
|
|
122
121
|
const blockedHosts = [...new Set([...blockedMediaHosts, ...blockedLinkHosts])].filter(
|
123
122
|
host => !this.reservedDomains.includes(host)
|
124
123
|
)
|
124
|
+
console.log('allowedHosts', allowedHosts)
|
125
|
+
console.log('blockedHosts', blockedHosts)
|
125
126
|
await this.insert(renderer.renderWarnings(invalidURLs, allowedHosts, blockedHosts))
|
126
127
|
}
|
127
128
|
|
data/app/javascript/metadata.js
CHANGED
data/app/javascript/renderer.js
CHANGED
@@ -167,27 +167,25 @@ export default class Renderer {
|
|
167
167
|
if (!urls?.length) return
|
168
168
|
|
169
169
|
allowedHosts = [...allowedHosts].sort()
|
170
|
-
if (allowedHosts.includes('*')) allowedHosts
|
170
|
+
if (allowedHosts.includes('*')) allowedHosts = ['All']
|
171
171
|
|
172
|
-
blockedHosts = [...blockedHosts]
|
173
|
-
if (blockedHosts.includes('*')) blockedHosts
|
174
|
-
|
175
|
-
const hosts = [...new Set([...blockedHosts, ...extractURLHosts(urls)])].sort()
|
172
|
+
blockedHosts = [...new Set([...blockedHosts, ...extractURLHosts(urls)])].sort()
|
173
|
+
if (blockedHosts.includes('*')) blockedHosts = ['All']
|
176
174
|
|
177
175
|
return this.render('warning', {
|
178
176
|
header: 'Copy/Paste Warning',
|
179
|
-
subheader: 'Content includes
|
177
|
+
subheader: 'Content includes links or media from restricted protocols or prohibited hosts.',
|
180
178
|
prohibited: {
|
181
179
|
header: 'Prohibited Hosts',
|
182
|
-
hosts:
|
183
|
-
?
|
184
|
-
: '<li>
|
180
|
+
hosts: blockedHosts.length
|
181
|
+
? blockedHosts.map(host => `<li>${host}</li>`).join('')
|
182
|
+
: '<li>Not configured</li>'
|
185
183
|
},
|
186
184
|
allowed: {
|
187
185
|
header: 'Allowed Hosts',
|
188
186
|
hosts: allowedHosts.length
|
189
187
|
? allowedHosts.map(host => `<li>${host}</li>`).join('')
|
190
|
-
: '<li>
|
188
|
+
: '<li>Not configured</li>'
|
191
189
|
}
|
192
190
|
})
|
193
191
|
}
|
data/lib/trix_embed/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trix_embed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nate Hopkins (hopsoft)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-08-
|
11
|
+
date: 2023-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|