(()=>{var ky=Object.create;var pl=Object.defineProperty,Ly=Object.defineProperties,_y=Object.getOwnPropertyDescriptor,Dy=Object.getOwnPropertyDescriptors,Ry=Object.getOwnPropertyNames,fl=Object.getOwnPropertySymbols,My=Object.getPrototypeOf,Ru=Object.prototype.hasOwnProperty,Lp=Object.prototype.propertyIsEnumerable;var _p=i=>{throw TypeError(i)};var Du=(i,t,r)=>t in i?pl(i,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[t]=r,ui=(i,t)=>{for(var r in t||(t={}))Ru.call(t,r)&&Du(i,r,t[r]);if(fl)for(var r of fl(t))Lp.call(t,r)&&Du(i,r,t[r]);return i},rs=(i,t)=>Ly(i,Dy(t));var po=(i=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(i,{get:(t,r)=>(typeof require!="undefined"?require:t)[r]}):i)(function(i){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var Dp=(i,t)=>{var r={};for(var s in i)Ru.call(i,s)&&t.indexOf(s)<0&&(r[s]=i[s]);if(i!=null&&fl)for(var s of fl(i))t.indexOf(s)<0&&Lp.call(i,s)&&(r[s]=i[s]);return r};var ri=(i,t)=>()=>(i&&(t=i(i=0)),t);var ar=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),ml=(i,t)=>{for(var r in t)pl(i,r,{get:t[r],enumerable:!0})},Oy=(i,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of Ry(t))!Ru.call(i,l)&&l!==r&&pl(i,l,{get:()=>t[l],enumerable:!(s=_y(t,l))||s.enumerable});return i};var ki=(i,t,r)=>(r=i!=null?ky(My(i)):{},Oy(t||!i||!i.__esModule?pl(r,"default",{value:i,enumerable:!0}):r,i));var j=(i,t,r)=>Du(i,typeof t!="symbol"?t+"":t,r),Mu=(i,t,r)=>t.has(i)||_p("Cannot "+r);var Zt=(i,t,r)=>(Mu(i,t,"read from private field"),r?r.call(i):t.get(i)),we=(i,t,r)=>t.has(i)?_p("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,r),_e=(i,t,r,s)=>(Mu(i,t,"write to private field"),s?s.call(i,r):t.set(i,r),r),ne=(i,t,r)=>(Mu(i,t,"access private method"),r);var cn,jl=ri(()=>{cn={logger:typeof console!="undefined"?console:void 0,WebSocket:typeof WebSocket!="undefined"?WebSocket:void 0}});var De,As=ri(()=>{jl();De={log(...i){this.enabled&&(i.push(Date.now()),cn.logger.log("[ActionCable]",...i))}}});var Io,Hl,No,ql,wh=ri(()=>{As();Io=()=>new Date().getTime(),Hl=i=>(Io()-i)/1e3,No=class{constructor(t){this.visibilityDidChange=this.visibilityDidChange.bind(this),this.connection=t,this.reconnectAttempts=0}start(){this.isRunning()||(this.startedAt=Io(),delete this.stoppedAt,this.startPolling(),addEventListener("visibilitychange",this.visibilityDidChange),De.log(`ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`))}stop(){this.isRunning()&&(this.stoppedAt=Io(),this.stopPolling(),removeEventListener("visibilitychange",this.visibilityDidChange),De.log("ConnectionMonitor stopped"))}isRunning(){return this.startedAt&&!this.stoppedAt}recordMessage(){this.pingedAt=Io()}recordConnect(){this.reconnectAttempts=0,delete this.disconnectedAt,De.log("ConnectionMonitor recorded connect")}recordDisconnect(){this.disconnectedAt=Io(),De.log("ConnectionMonitor recorded disconnect")}startPolling(){this.stopPolling(),this.poll()}stopPolling(){clearTimeout(this.pollTimeout)}poll(){this.pollTimeout=setTimeout(()=>{this.reconnectIfStale(),this.poll()},this.getPollInterval())}getPollInterval(){let{staleThreshold:t,reconnectionBackoffRate:r}=this.constructor,s=Math.pow(1+r,Math.min(this.reconnectAttempts,10)),u=(this.reconnectAttempts===0?1:r)*Math.random();return t*1e3*s*(1+u)}reconnectIfStale(){this.connectionIsStale()&&(De.log(`ConnectionMonitor detected stale connection. reconnectAttempts = ${this.reconnectAttempts}, time stale = ${Hl(this.refreshedAt)} s, stale threshold = ${this.constructor.staleThreshold} s`),this.reconnectAttempts++,this.disconnectedRecently()?De.log(`ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${Hl(this.disconnectedAt)} s`):(De.log("ConnectionMonitor reopening"),this.connection.reopen()))}get refreshedAt(){return this.pingedAt?this.pingedAt:this.startedAt}connectionIsStale(){return Hl(this.refreshedAt)>this.constructor.staleThreshold}disconnectedRecently(){return this.disconnectedAt&&Hl(this.disconnectedAt){(this.connectionIsStale()||!this.connection.isOpen())&&(De.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`),this.connection.reopen())},200)}};No.staleThreshold=6;No.reconnectionBackoffRate=.15;ql=No});var Fo,Eh=ri(()=>{Fo={message_types:{welcome:"welcome",disconnect:"disconnect",ping:"ping",confirmation:"confirm_subscription",rejection:"reject_subscription"},disconnect_reasons:{unauthorized:"unauthorized",invalid_request:"invalid_request",server_restart:"server_restart",remote:"remote"},default_mount_path:"/cable",protocols:["actioncable-v1-json","actioncable-unsupported"]}});var Bo,Ah,Uw,_m,jo,zl,Sh=ri(()=>{jl();wh();Eh();As();({message_types:Bo,protocols:Ah}=Fo),Uw=Ah.slice(0,Ah.length-1),_m=[].indexOf,jo=class{constructor(t){this.open=this.open.bind(this),this.consumer=t,this.subscriptions=this.consumer.subscriptions,this.monitor=new ql(this),this.disconnected=!0}send(t){return this.isOpen()?(this.webSocket.send(JSON.stringify(t)),!0):!1}open(){if(this.isActive())return De.log(`Attempted to open WebSocket, but existing socket is ${this.getState()}`),!1;{let t=[...Ah,...this.consumer.subprotocols||[]];return De.log(`Opening WebSocket, current state is ${this.getState()}, subprotocols: ${t}`),this.webSocket&&this.uninstallEventHandlers(),this.webSocket=new cn.WebSocket(this.consumer.url,t),this.installEventHandlers(),this.monitor.start(),!0}}close({allowReconnect:t}={allowReconnect:!0}){if(t||this.monitor.stop(),this.isOpen())return this.webSocket.close()}reopen(){if(De.log(`Reopening WebSocket, current state is ${this.getState()}`),this.isActive())try{return this.close()}catch(t){De.log("Failed to reopen WebSocket",t)}finally{De.log(`Reopening WebSocket in ${this.constructor.reopenDelay}ms`),setTimeout(this.open,this.constructor.reopenDelay)}else return this.open()}getProtocol(){if(this.webSocket)return this.webSocket.protocol}isOpen(){return this.isState("open")}isActive(){return this.isState("open","connecting")}triedToReconnect(){return this.monitor.reconnectAttempts>0}isProtocolSupported(){return _m.call(Uw,this.getProtocol())>=0}isState(...t){return _m.call(t,this.getState())>=0}getState(){if(this.webSocket){for(let t in cn.WebSocket)if(cn.WebSocket[t]===this.webSocket.readyState)return t.toLowerCase()}return null}installEventHandlers(){for(let t in this.events){let r=this.events[t].bind(this);this.webSocket[`on${t}`]=r}}uninstallEventHandlers(){for(let t in this.events)this.webSocket[`on${t}`]=function(){}}};jo.reopenDelay=500;jo.prototype.events={message(i){if(!this.isProtocolSupported())return;let{identifier:t,message:r,reason:s,reconnect:l,type:u}=JSON.parse(i.data);switch(this.monitor.recordMessage(),u){case Bo.welcome:return this.triedToReconnect()&&(this.reconnectAttempted=!0),this.monitor.recordConnect(),this.subscriptions.reload();case Bo.disconnect:return De.log(`Disconnecting. Reason: ${s}`),this.close({allowReconnect:l});case Bo.ping:return null;case Bo.confirmation:return this.subscriptions.confirmSubscription(t),this.reconnectAttempted?(this.reconnectAttempted=!1,this.subscriptions.notify(t,"connected",{reconnected:!0})):this.subscriptions.notify(t,"connected",{reconnected:!1});case Bo.rejection:return this.subscriptions.reject(t);default:return this.subscriptions.notify(t,"received",r)}},open(){if(De.log(`WebSocket onopen event, using '${this.getProtocol()}' subprotocol`),this.disconnected=!1,!this.isProtocolSupported())return De.log("Protocol is unsupported. Stopping monitor and disconnecting."),this.close({allowReconnect:!1})},close(i){if(De.log("WebSocket onclose event"),!this.disconnected)return this.disconnected=!0,this.monitor.recordDisconnect(),this.subscriptions.notifyAll("disconnected",{willAttemptReconnect:this.monitor.isRunning()})},error(){De.log("WebSocket onerror event")}};zl=jo});var Vw,Dn,Th=ri(()=>{Vw=function(i,t){if(t!=null)for(let r in t){let s=t[r];i[r]=s}return i},Dn=class{constructor(t,r={},s){this.consumer=t,this.identifier=JSON.stringify(r),Vw(this,s)}perform(t,r={}){return r.action=t,this.send(r)}send(t){return this.consumer.send({command:"message",identifier:this.identifier,data:JSON.stringify(t)})}unsubscribe(){return this.consumer.subscriptions.remove(this)}}});var xh,Wl,Ch=ri(()=>{As();xh=class{constructor(t){this.subscriptions=t,this.pendingSubscriptions=[]}guarantee(t){this.pendingSubscriptions.indexOf(t)==-1?(De.log(`SubscriptionGuarantor guaranteeing ${t.identifier}`),this.pendingSubscriptions.push(t)):De.log(`SubscriptionGuarantor already guaranteeing ${t.identifier}`),this.startGuaranteeing()}forget(t){De.log(`SubscriptionGuarantor forgetting ${t.identifier}`),this.pendingSubscriptions=this.pendingSubscriptions.filter(r=>r!==t)}startGuaranteeing(){this.stopGuaranteeing(),this.retrySubscribing()}stopGuaranteeing(){clearTimeout(this.retryTimeout)}retrySubscribing(){this.retryTimeout=setTimeout(()=>{this.subscriptions&&typeof this.subscriptions.subscribe=="function"&&this.pendingSubscriptions.map(t=>{De.log(`SubscriptionGuarantor resubscribing ${t.identifier}`),this.subscriptions.subscribe(t)})},500)}},Wl=xh});var Rn,kh=ri(()=>{Th();Ch();As();Rn=class{constructor(t){this.consumer=t,this.guarantor=new Wl(this),this.subscriptions=[]}create(t,r){let s=t,l=typeof s=="object"?s:{channel:s},u=new Dn(this.consumer,l,r);return this.add(u)}add(t){return this.subscriptions.push(t),this.consumer.ensureActiveConnection(),this.notify(t,"initialized"),this.subscribe(t),t}remove(t){return this.forget(t),this.findAll(t.identifier).length||this.sendCommand(t,"unsubscribe"),t}reject(t){return this.findAll(t).map(r=>(this.forget(r),this.notify(r,"rejected"),r))}forget(t){return this.guarantor.forget(t),this.subscriptions=this.subscriptions.filter(r=>r!==t),t}findAll(t){return this.subscriptions.filter(r=>r.identifier===t)}reload(){return this.subscriptions.map(t=>this.subscribe(t))}notifyAll(t,...r){return this.subscriptions.map(s=>this.notify(s,t,...r))}notify(t,r,...s){let l;return typeof t=="string"?l=this.findAll(t):l=[t],l.map(u=>typeof u[r]=="function"?u[r](...s):void 0)}subscribe(t){this.sendCommand(t,"subscribe")&&this.guarantor.guarantee(t)}confirmSubscription(t){De.log(`Subscription confirmed ${t}`),this.findAll(t).map(r=>this.guarantor.forget(r))}sendCommand(t,r){let{identifier:s}=t;return this.consumer.send({command:r,identifier:s})}}});function Lh(i){if(typeof i=="function"&&(i=i()),i&&!/^wss?:/i.test(i)){let t=document.createElement("a");return t.href=i,t.href=t.href,t.protocol=t.protocol.replace("http","ws"),t.href}else return i}var Ss,Dm=ri(()=>{Sh();kh();Ss=class{constructor(t){this._url=t,this.subscriptions=new Rn(this),this.connection=new zl(this),this.subprotocols=[]}get url(){return Lh(this._url)}send(t){return this.connection.send(t)}connect(){return this.connection.open()}disconnect(){return this.connection.close({allowReconnect:!1})}ensureActiveConnection(){if(!this.connection.isActive())return this.connection.open()}addSubProtocol(t){this.subprotocols=[...this.subprotocols,t]}}});var Mm={};ml(Mm,{Connection:()=>zl,ConnectionMonitor:()=>ql,Consumer:()=>Ss,INTERNAL:()=>Fo,Subscription:()=>Dn,SubscriptionGuarantor:()=>Wl,Subscriptions:()=>Rn,adapters:()=>cn,createConsumer:()=>$w,createWebSocketURL:()=>Lh,getConfig:()=>Rm,logger:()=>De});function $w(i=Rm("url")||Fo.default_mount_path){return new Ss(i)}function Rm(i){let t=document.head.querySelector(`meta[name='action-cable-${i}']`);if(t)return t.getAttribute("content")}var Om=ri(()=>{Sh();wh();Dm();Eh();Th();kh();Ch();jl();As()});var Qh=ar((Zl,Jm)=>{(function(i,t){typeof Zl=="object"&&typeof Jm!="undefined"?t(Zl):typeof define=="function"&&define.amd?define(["exports"],t):(i=typeof globalThis!="undefined"?globalThis:i||self,t(i.ActiveStorage={}))})(Zl,function(i){"use strict";var t={exports:{}};(function(G,C){(function(F){G.exports=F()})(function(F){var St=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function bt(P,k){var p=P[0],d=P[1],A=P[2],v=P[3];p+=(d&A|~d&v)+k[0]-680876936|0,p=(p<<7|p>>>25)+d|0,v+=(p&d|~p&A)+k[1]-389564586|0,v=(v<<12|v>>>20)+p|0,A+=(v&p|~v&d)+k[2]+606105819|0,A=(A<<17|A>>>15)+v|0,d+=(A&v|~A&p)+k[3]-1044525330|0,d=(d<<22|d>>>10)+A|0,p+=(d&A|~d&v)+k[4]-176418897|0,p=(p<<7|p>>>25)+d|0,v+=(p&d|~p&A)+k[5]+1200080426|0,v=(v<<12|v>>>20)+p|0,A+=(v&p|~v&d)+k[6]-1473231341|0,A=(A<<17|A>>>15)+v|0,d+=(A&v|~A&p)+k[7]-45705983|0,d=(d<<22|d>>>10)+A|0,p+=(d&A|~d&v)+k[8]+1770035416|0,p=(p<<7|p>>>25)+d|0,v+=(p&d|~p&A)+k[9]-1958414417|0,v=(v<<12|v>>>20)+p|0,A+=(v&p|~v&d)+k[10]-42063|0,A=(A<<17|A>>>15)+v|0,d+=(A&v|~A&p)+k[11]-1990404162|0,d=(d<<22|d>>>10)+A|0,p+=(d&A|~d&v)+k[12]+1804603682|0,p=(p<<7|p>>>25)+d|0,v+=(p&d|~p&A)+k[13]-40341101|0,v=(v<<12|v>>>20)+p|0,A+=(v&p|~v&d)+k[14]-1502002290|0,A=(A<<17|A>>>15)+v|0,d+=(A&v|~A&p)+k[15]+1236535329|0,d=(d<<22|d>>>10)+A|0,p+=(d&v|A&~v)+k[1]-165796510|0,p=(p<<5|p>>>27)+d|0,v+=(p&A|d&~A)+k[6]-1069501632|0,v=(v<<9|v>>>23)+p|0,A+=(v&d|p&~d)+k[11]+643717713|0,A=(A<<14|A>>>18)+v|0,d+=(A&p|v&~p)+k[0]-373897302|0,d=(d<<20|d>>>12)+A|0,p+=(d&v|A&~v)+k[5]-701558691|0,p=(p<<5|p>>>27)+d|0,v+=(p&A|d&~A)+k[10]+38016083|0,v=(v<<9|v>>>23)+p|0,A+=(v&d|p&~d)+k[15]-660478335|0,A=(A<<14|A>>>18)+v|0,d+=(A&p|v&~p)+k[4]-405537848|0,d=(d<<20|d>>>12)+A|0,p+=(d&v|A&~v)+k[9]+568446438|0,p=(p<<5|p>>>27)+d|0,v+=(p&A|d&~A)+k[14]-1019803690|0,v=(v<<9|v>>>23)+p|0,A+=(v&d|p&~d)+k[3]-187363961|0,A=(A<<14|A>>>18)+v|0,d+=(A&p|v&~p)+k[8]+1163531501|0,d=(d<<20|d>>>12)+A|0,p+=(d&v|A&~v)+k[13]-1444681467|0,p=(p<<5|p>>>27)+d|0,v+=(p&A|d&~A)+k[2]-51403784|0,v=(v<<9|v>>>23)+p|0,A+=(v&d|p&~d)+k[7]+1735328473|0,A=(A<<14|A>>>18)+v|0,d+=(A&p|v&~p)+k[12]-1926607734|0,d=(d<<20|d>>>12)+A|0,p+=(d^A^v)+k[5]-378558|0,p=(p<<4|p>>>28)+d|0,v+=(p^d^A)+k[8]-2022574463|0,v=(v<<11|v>>>21)+p|0,A+=(v^p^d)+k[11]+1839030562|0,A=(A<<16|A>>>16)+v|0,d+=(A^v^p)+k[14]-35309556|0,d=(d<<23|d>>>9)+A|0,p+=(d^A^v)+k[1]-1530992060|0,p=(p<<4|p>>>28)+d|0,v+=(p^d^A)+k[4]+1272893353|0,v=(v<<11|v>>>21)+p|0,A+=(v^p^d)+k[7]-155497632|0,A=(A<<16|A>>>16)+v|0,d+=(A^v^p)+k[10]-1094730640|0,d=(d<<23|d>>>9)+A|0,p+=(d^A^v)+k[13]+681279174|0,p=(p<<4|p>>>28)+d|0,v+=(p^d^A)+k[0]-358537222|0,v=(v<<11|v>>>21)+p|0,A+=(v^p^d)+k[3]-722521979|0,A=(A<<16|A>>>16)+v|0,d+=(A^v^p)+k[6]+76029189|0,d=(d<<23|d>>>9)+A|0,p+=(d^A^v)+k[9]-640364487|0,p=(p<<4|p>>>28)+d|0,v+=(p^d^A)+k[12]-421815835|0,v=(v<<11|v>>>21)+p|0,A+=(v^p^d)+k[15]+530742520|0,A=(A<<16|A>>>16)+v|0,d+=(A^v^p)+k[2]-995338651|0,d=(d<<23|d>>>9)+A|0,p+=(A^(d|~v))+k[0]-198630844|0,p=(p<<6|p>>>26)+d|0,v+=(d^(p|~A))+k[7]+1126891415|0,v=(v<<10|v>>>22)+p|0,A+=(p^(v|~d))+k[14]-1416354905|0,A=(A<<15|A>>>17)+v|0,d+=(v^(A|~p))+k[5]-57434055|0,d=(d<<21|d>>>11)+A|0,p+=(A^(d|~v))+k[12]+1700485571|0,p=(p<<6|p>>>26)+d|0,v+=(d^(p|~A))+k[3]-1894986606|0,v=(v<<10|v>>>22)+p|0,A+=(p^(v|~d))+k[10]-1051523|0,A=(A<<15|A>>>17)+v|0,d+=(v^(A|~p))+k[1]-2054922799|0,d=(d<<21|d>>>11)+A|0,p+=(A^(d|~v))+k[8]+1873313359|0,p=(p<<6|p>>>26)+d|0,v+=(d^(p|~A))+k[15]-30611744|0,v=(v<<10|v>>>22)+p|0,A+=(p^(v|~d))+k[6]-1560198380|0,A=(A<<15|A>>>17)+v|0,d+=(v^(A|~p))+k[13]+1309151649|0,d=(d<<21|d>>>11)+A|0,p+=(A^(d|~v))+k[4]-145523070|0,p=(p<<6|p>>>26)+d|0,v+=(d^(p|~A))+k[11]-1120210379|0,v=(v<<10|v>>>22)+p|0,A+=(p^(v|~d))+k[2]+718787259|0,A=(A<<15|A>>>17)+v|0,d+=(v^(A|~p))+k[9]-343485551|0,d=(d<<21|d>>>11)+A|0,P[0]=p+P[0]|0,P[1]=d+P[1]|0,P[2]=A+P[2]|0,P[3]=v+P[3]|0}function It(P){var k=[],p;for(p=0;p<64;p+=4)k[p>>2]=P.charCodeAt(p)+(P.charCodeAt(p+1)<<8)+(P.charCodeAt(p+2)<<16)+(P.charCodeAt(p+3)<<24);return k}function E(P){var k=[],p;for(p=0;p<64;p+=4)k[p>>2]=P[p]+(P[p+1]<<8)+(P[p+2]<<16)+(P[p+3]<<24);return k}function N(P){var k=P.length,p=[1732584193,-271733879,-1732584194,271733878],d,A,v,he,Pe,Ie;for(d=64;d<=k;d+=64)bt(p,It(P.substring(d-64,d)));for(P=P.substring(d-64),A=P.length,v=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],d=0;d>2]|=P.charCodeAt(d)<<(d%4<<3);if(v[d>>2]|=128<<(d%4<<3),d>55)for(bt(p,v),d=0;d<16;d+=1)v[d]=0;return he=k*8,he=he.toString(16).match(/(.*?)(.{0,8})$/),Pe=parseInt(he[2],16),Ie=parseInt(he[1],16)||0,v[14]=Pe,v[15]=Ie,bt(p,v),p}function Y(P){var k=P.length,p=[1732584193,-271733879,-1732584194,271733878],d,A,v,he,Pe,Ie;for(d=64;d<=k;d+=64)bt(p,E(P.subarray(d-64,d)));for(P=d-64>2]|=P[d]<<(d%4<<3);if(v[d>>2]|=128<<(d%4<<3),d>55)for(bt(p,v),d=0;d<16;d+=1)v[d]=0;return he=k*8,he=he.toString(16).match(/(.*?)(.{0,8})$/),Pe=parseInt(he[2],16),Ie=parseInt(he[1],16)||0,v[14]=Pe,v[15]=Ie,bt(p,v),p}function et(P){var k="",p;for(p=0;p<4;p+=1)k+=St[P>>p*8+4&15]+St[P>>p*8&15];return k}function kt(P){var k;for(k=0;kv?new ArrayBuffer(0):(he=v-A,Pe=new ArrayBuffer(he),Ie=new Uint8Array(Pe),ni=new Uint8Array(this,A,he),Ie.set(ni),Pe)}}();function Nt(P){return/[\u0080-\uFFFF]/.test(P)&&(P=unescape(encodeURIComponent(P))),P}function Wt(P,k){var p=P.length,d=new ArrayBuffer(p),A=new Uint8Array(d),v;for(v=0;v>2]|=k.charCodeAt(d)<<(d%4<<3);return this._finish(A,p),v=kt(this._hash),P&&(v=di(v)),this.reset(),v},zt.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},zt.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},zt.prototype.setState=function(P){return this._buff=P.buff,this._length=P.length,this._hash=P.hash,this},zt.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},zt.prototype._finish=function(P,k){var p=k,d,A,v;if(P[p>>2]|=128<<(p%4<<3),p>55)for(bt(this._hash,P),p=0;p<16;p+=1)P[p]=0;d=this._length*8,d=d.toString(16).match(/(.*?)(.{0,8})$/),A=parseInt(d[2],16),v=parseInt(d[1],16)||0,P[14]=A,P[15]=v,bt(this._hash,P)},zt.hash=function(P,k){return zt.hashBinary(Nt(P),k)},zt.hashBinary=function(P,k){var p=N(P),d=kt(p);return k?di(d):d},zt.ArrayBuffer=function(){this.reset()},zt.ArrayBuffer.prototype.append=function(P){var k=Xe(this._buff.buffer,P,!0),p=k.length,d;for(this._length+=P.byteLength,d=64;d<=p;d+=64)bt(this._hash,E(k.subarray(d-64,d)));return this._buff=d-64>2]|=k[A]<<(A%4<<3);return this._finish(d,p),v=kt(this._hash),P&&(v=di(v)),this.reset(),v},zt.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},zt.ArrayBuffer.prototype.getState=function(){var P=zt.prototype.getState.call(this);return P.buff=Kt(P.buff),P},zt.ArrayBuffer.prototype.setState=function(P){return P.buff=Wt(P.buff,!0),zt.prototype.setState.call(this,P)},zt.ArrayBuffer.prototype.destroy=zt.prototype.destroy,zt.ArrayBuffer.prototype._finish=zt.prototype._finish,zt.ArrayBuffer.hash=function(P,k){var p=Y(new Uint8Array(P)),d=kt(p);return k?di(d):d},zt})})(t);var r=t.exports;let s=File.prototype.slice||File.prototype.mozSlice||File.prototype.webkitSlice;class l{static create(C,F){new l(C).create(F)}constructor(C){this.file=C,this.chunkSize=2097152,this.chunkCount=Math.ceil(this.file.size/this.chunkSize),this.chunkIndex=0}create(C){this.callback=C,this.md5Buffer=new r.ArrayBuffer,this.fileReader=new FileReader,this.fileReader.addEventListener("load",F=>this.fileReaderDidLoad(F)),this.fileReader.addEventListener("error",F=>this.fileReaderDidError(F)),this.readNextChunk()}fileReaderDidLoad(C){if(this.md5Buffer.append(C.target.result),!this.readNextChunk()){let F=this.md5Buffer.end(!0),St=btoa(F);this.callback(null,St)}}fileReaderDidError(C){this.callback(`Error reading ${this.file.name}`)}readNextChunk(){if(this.chunkIndex{this.xhr.setRequestHeader(E,bt[E])});let It=u("csrf-token");It!=null&&this.xhr.setRequestHeader("X-CSRF-Token",It),this.xhr.addEventListener("load",E=>this.requestDidLoad(E)),this.xhr.addEventListener("error",E=>this.requestDidError(E))}get status(){return this.xhr.status}get response(){let{responseType:C,response:F}=this.xhr;return C=="json"?F:JSON.parse(F)}create(C){this.callback=C,this.xhr.send(JSON.stringify({blob:this.attributes}))}requestDidLoad(C){if(this.status>=200&&this.status<300){let{response:F}=this,{direct_upload:St}=F;delete F.direct_upload,this.attributes=F,this.directUploadData=St,this.callback(null,this.toJSON())}else this.requestDidError(C)}requestDidError(C){this.callback(`Error creating Blob for "${this.file.name}". Status: ${this.status}`)}toJSON(){let C={};for(let F in this.attributes)C[F]=this.attributes[F];return C}}class Z{constructor(C){this.blob=C,this.file=C.file;let{url:F,headers:St}=C.directUploadData;this.xhr=new XMLHttpRequest,this.xhr.open("PUT",F,!0),this.xhr.responseType="text";for(let bt in St)this.xhr.setRequestHeader(bt,St[bt]);this.xhr.addEventListener("load",bt=>this.requestDidLoad(bt)),this.xhr.addEventListener("error",bt=>this.requestDidError(bt))}create(C){this.callback=C,this.xhr.send(this.file.slice())}requestDidLoad(C){let{status:F,response:St}=this.xhr;F>=200&&F<300?this.callback(null,St):this.requestDidError(C)}requestDidError(C){this.callback(`Error storing "${this.file.name}". Status: ${this.xhr.status}`)}}let X=0;class J{constructor(C,F,St,bt={}){this.id=++X,this.file=C,this.url=F,this.delegate=St,this.customHeaders=bt}create(C){l.create(this.file,(F,St)=>{if(F){C(F);return}let bt=new H(this.file,St,this.url,this.customHeaders);$(this.delegate,"directUploadWillCreateBlobWithXHR",bt.xhr),bt.create(It=>{if(It)C(It);else{let E=new Z(bt);$(this.delegate,"directUploadWillStoreFileWithXHR",E.xhr),E.create(N=>{N?C(N):C(null,bt.toJSON())})}})})}}function $(G,C,...F){if(G&&typeof G[C]=="function")return G[C](...F)}class st{constructor(C,F){this.input=C,this.file=F,this.directUpload=new J(this.file,this.url,this),this.dispatch("initialize")}start(C){let F=document.createElement("input");F.type="hidden",F.name=this.input.name,this.input.insertAdjacentElement("beforebegin",F),this.dispatch("start"),this.directUpload.create((St,bt)=>{St?(F.parentNode.removeChild(F),this.dispatchError(St)):F.value=bt.signed_id,this.dispatch("end"),C(St)})}uploadRequestDidProgress(C){let F=C.loaded/C.total*100;F&&this.dispatch("progress",{progress:F})}get url(){return this.input.getAttribute("data-direct-upload-url")}dispatch(C,F={}){return F.file=this.file,F.id=this.directUpload.id,T(this.input,`direct-upload:${C}`,{detail:F})}dispatchError(C){this.dispatch("error",{error:C}).defaultPrevented||alert(C)}directUploadWillCreateBlobWithXHR(C){this.dispatch("before-blob-request",{xhr:C})}directUploadWillStoreFileWithXHR(C){this.dispatch("before-storage-request",{xhr:C}),C.upload.addEventListener("progress",F=>this.uploadRequestDidProgress(F))}}let ft="input[type=file][data-direct-upload-url]:not([disabled])";class Q{constructor(C){this.form=C,this.inputs=f(C,ft).filter(F=>F.files.length)}start(C){let F=this.createDirectUploadControllers(),St=()=>{let bt=F.shift();bt?bt.start(It=>{It?(C(It),this.dispatch("end")):St()}):(C(),this.dispatch("end"))};this.dispatch("start"),St()}createDirectUploadControllers(){let C=[];return this.inputs.forEach(F=>{D(F.files).forEach(St=>{let bt=new st(F,St);C.push(bt)})}),C}dispatch(C,F={}){return T(this.form,`direct-uploads:${C}`,{detail:F})}}let R="data-direct-uploads-processing",I=new WeakMap,V=!1;function K(){V||(V=!0,document.addEventListener("click",gt,!0),document.addEventListener("submit",dt,!0),document.addEventListener("ajax:before",Et))}function gt(G){let C=G.target.closest("button, input");C&&C.type==="submit"&&C.form&&I.set(C.form,C)}function dt(G){Ot(G)}function Et(G){G.target.tagName=="FORM"&&Ot(G)}function Ot(G){let C=G.target;if(C.hasAttribute(R)){G.preventDefault();return}let F=new Q(C),{inputs:St}=F;St.length&&(G.preventDefault(),C.setAttribute(R,""),St.forEach(At),F.start(bt=>{C.removeAttribute(R),bt?St.forEach(Te):Qt(C)}))}function Qt(G){let C=I.get(G)||y(G,"input[type=submit], button[type=submit]");if(C){let{disabled:F}=C;C.disabled=!1,C.focus(),C.click(),C.disabled=F}else C=document.createElement("input"),C.type="submit",C.style.display="none",G.appendChild(C),C.click(),G.removeChild(C);I.delete(G)}function At(G){G.disabled=!0}function Te(G){G.disabled=!1}function xe(){window.ActiveStorage&&K()}setTimeout(xe,1),i.DirectUpload=J,i.DirectUploadController=st,i.DirectUploadsController=Q,i.dispatchEvent=T,i.start=K,Object.defineProperty(i,"__esModule",{value:!0})})});var lr,Ve,Mn=ri(()=>{lr={waitForGlobal(i,t){window[i]?t():setTimeout(function(){lr.waitForGlobal(i,t)},100)},debounce(i,t,r){let s;return function(){let l=this,u=arguments,f=function(){s=null,r||i.apply(l,u)},y=r&&!s;clearTimeout(s),s=setTimeout(f,t),y&&i.apply(l,u)}},delegate(i,t,r,s){return i.addEventListener(r,function(l){let u;for(u=l.target;!(!(u instanceof Element)||u.matches(t));)u=u.parentNode;if(u instanceof Element&&s.call(u,l)===!1)return l.preventDefault(),l.stopPropagation()})},throttle(i,t){let r;return function(){let s=arguments,l=this;r||(i.apply(l,s),r=!0,setTimeout(()=>r=!1,t))}},scrollY(){return window.pageYOffset||window.scrollY},overflowedX(i){let t=i.lastElementChild;return i.clientWidth{(function(t,r){typeof Uo=="object"&&typeof td=="object"?td.exports=r():typeof define=="function"&&define.amd?define([],r):typeof Uo=="object"?Uo.ClipboardJS=r():t.ClipboardJS=r()})(Uo,function(){return function(){var i={686:function(s,l,u){"use strict";u.d(l,{default:function(){return It}});var f=u(279),y=u.n(f),T=u(370),D=u.n(T),H=u(817),Z=u.n(H);function X(E){try{return document.execCommand(E)}catch(N){return!1}}var J=function(N){var Y=Z()(N);return X("cut"),Y},$=J;function st(E){var N=document.documentElement.getAttribute("dir")==="rtl",Y=document.createElement("textarea");Y.style.fontSize="12pt",Y.style.border="0",Y.style.padding="0",Y.style.margin="0",Y.style.position="absolute",Y.style[N?"right":"left"]="-9999px";var et=window.pageYOffset||document.documentElement.scrollTop;return Y.style.top="".concat(et,"px"),Y.setAttribute("readonly",""),Y.value=E,Y}var ft=function(N,Y){var et=st(N);Y.container.appendChild(et);var kt=Z()(et);return X("copy"),et.remove(),kt},Q=function(N){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body},et="";return typeof N=="string"?et=ft(N,Y):N instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(N==null?void 0:N.type)?et=ft(N.value,Y):(et=Z()(N),X("copy")),et},R=Q;function I(E){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?I=function(Y){return typeof Y}:I=function(Y){return Y&&typeof Symbol=="function"&&Y.constructor===Symbol&&Y!==Symbol.prototype?"symbol":typeof Y},I(E)}var V=function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Y=N.action,et=Y===void 0?"copy":Y,kt=N.container,Nt=N.target,Wt=N.text;if(et!=="copy"&&et!=="cut")throw new Error('Invalid "action" value, use either "copy" or "cut"');if(Nt!==void 0)if(Nt&&I(Nt)==="object"&&Nt.nodeType===1){if(et==="copy"&&Nt.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if(et==="cut"&&(Nt.hasAttribute("readonly")||Nt.hasAttribute("disabled")))throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`)}else throw new Error('Invalid "target" value, use a valid Element');if(Wt)return R(Wt,{container:kt});if(Nt)return et==="cut"?$(Nt):R(Nt,{container:kt})},K=V;function gt(E){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?gt=function(Y){return typeof Y}:gt=function(Y){return Y&&typeof Symbol=="function"&&Y.constructor===Symbol&&Y!==Symbol.prototype?"symbol":typeof Y},gt(E)}function dt(E,N){if(!(E instanceof N))throw new TypeError("Cannot call a class as a function")}function Et(E,N){for(var Y=0;Y0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof kt.action=="function"?kt.action:this.defaultAction,this.target=typeof kt.target=="function"?kt.target:this.defaultTarget,this.text=typeof kt.text=="function"?kt.text:this.defaultText,this.container=gt(kt.container)==="object"?kt.container:document.body}},{key:"listenClick",value:function(kt){var Nt=this;this.listener=D()(kt,"click",function(Wt){return Nt.onClick(Wt)})}},{key:"onClick",value:function(kt){var Nt=kt.delegateTarget||kt.currentTarget,Wt=this.action(Nt)||"copy",Kt=K({action:Wt,container:this.container,target:this.target(Nt),text:this.text(Nt)});this.emit(Kt?"success":"error",{action:Wt,text:Kt,trigger:Nt,clearSelection:function(){Nt&&Nt.focus(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(kt){return St("action",kt)}},{key:"defaultTarget",value:function(kt){var Nt=St("target",kt);if(Nt)return document.querySelector(Nt)}},{key:"defaultText",value:function(kt){return St("text",kt)}},{key:"destroy",value:function(){this.listener.destroy()}}],[{key:"copy",value:function(kt){var Nt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body};return R(kt,Nt)}},{key:"cut",value:function(kt){return $(kt)}},{key:"isSupported",value:function(){var kt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],Nt=typeof kt=="string"?[kt]:kt,Wt=!!document.queryCommandSupported;return Nt.forEach(function(Kt){Wt=Wt&&!!document.queryCommandSupported(Kt)}),Wt}}]),Y}(y()),It=bt},828:function(s){var l=9;if(typeof Element!="undefined"&&!Element.prototype.matches){var u=Element.prototype;u.matches=u.matchesSelector||u.mozMatchesSelector||u.msMatchesSelector||u.oMatchesSelector||u.webkitMatchesSelector}function f(y,T){for(;y&&y.nodeType!==l;){if(typeof y.matches=="function"&&y.matches(T))return y;y=y.parentNode}}s.exports=f},438:function(s,l,u){var f=u(828);function y(H,Z,X,J,$){var st=D.apply(this,arguments);return H.addEventListener(X,st,$),{destroy:function(){H.removeEventListener(X,st,$)}}}function T(H,Z,X,J,$){return typeof H.addEventListener=="function"?y.apply(null,arguments):typeof X=="function"?y.bind(null,document).apply(null,arguments):(typeof H=="string"&&(H=document.querySelectorAll(H)),Array.prototype.map.call(H,function(st){return y(st,Z,X,J,$)}))}function D(H,Z,X,J){return function($){$.delegateTarget=f($.target,Z),$.delegateTarget&&J.call(H,$)}}s.exports=T},879:function(s,l){l.node=function(u){return u!==void 0&&u instanceof HTMLElement&&u.nodeType===1},l.nodeList=function(u){var f=Object.prototype.toString.call(u);return u!==void 0&&(f==="[object NodeList]"||f==="[object HTMLCollection]")&&"length"in u&&(u.length===0||l.node(u[0]))},l.string=function(u){return typeof u=="string"||u instanceof String},l.fn=function(u){var f=Object.prototype.toString.call(u);return f==="[object Function]"}},370:function(s,l,u){var f=u(879),y=u(438);function T(X,J,$){if(!X&&!J&&!$)throw new Error("Missing required arguments");if(!f.string(J))throw new TypeError("Second argument must be a String");if(!f.fn($))throw new TypeError("Third argument must be a Function");if(f.node(X))return D(X,J,$);if(f.nodeList(X))return H(X,J,$);if(f.string(X))return Z(X,J,$);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function D(X,J,$){return X.addEventListener(J,$),{destroy:function(){X.removeEventListener(J,$)}}}function H(X,J,$){return Array.prototype.forEach.call(X,function(st){st.addEventListener(J,$)}),{destroy:function(){Array.prototype.forEach.call(X,function(st){st.removeEventListener(J,$)})}}}function Z(X,J,$){return y(document.body,X,J,$)}s.exports=T},817:function(s){function l(u){var f;if(u.nodeName==="SELECT")u.focus(),f=u.value;else if(u.nodeName==="INPUT"||u.nodeName==="TEXTAREA"){var y=u.hasAttribute("readonly");y||u.setAttribute("readonly",""),u.select(),u.setSelectionRange(0,u.value.length),y||u.removeAttribute("readonly"),f=u.value}else{u.hasAttribute("contenteditable")&&u.focus();var T=window.getSelection(),D=document.createRange();D.selectNodeContents(u),T.removeAllRanges(),T.addRange(D),f=T.toString()}return f}s.exports=l},279:function(s){function l(){}l.prototype={on:function(u,f,y){var T=this.e||(this.e={});return(T[u]||(T[u]=[])).push({fn:f,ctx:y}),this},once:function(u,f,y){var T=this;function D(){T.off(u,D),f.apply(y,arguments)}return D._=f,this.on(u,D,y)},emit:function(u){var f=[].slice.call(arguments,1),y=((this.e||(this.e={}))[u]||[]).slice(),T=0,D=y.length;for(T;T{zE={months:{"00":"","01":"Janeiro","02":"Fevereiro","03":"Mar\xE7o","04":"Abril","05":"Maio","06":"Junho","07":"Julho","08":"Agosto","09":"Setembro",10:"Outubro",11:"Novembro",12:"Dezembro"},weekdays:["Domingo","Segunda-feira","Ter\xE7a-feira","Quarta-feira","Quinta-feira","Sexta-feira","S\xE1bado"],hours:{"00":"Zero","01":"Uma","02":"Duas","03":"Tr\xEAs","04":"Quatro","05":"Cinco","06":"Seis","07":"Sete","08":"Oito","09":"Nove",10:"Dez",11:"Onze",12:"Doze",13:"Treze",14:"Quatorze",15:"Quinze",16:"Dezesseis ",17:"Dezessete",18:"Dezoito",19:"Dezenove",20:"Vinte",21:"Vinte e Uma",22:"Vinte e Duas",23:"Vinte e Tr\xEAs",24:"Vinte e Quatro"}},Pn=zE});var Bi,nc=ri(()=>{Bi={date(i){if(!/\d{2}\/\d{2}\/\d{4}/.test(i))return null;let[t,r,s]=i.split("/").map(f=>parseInt(f)),l=new Date(s,r-1,t);if(l.getFullYear()!==s||l.getMonth()!==r-1||l.getDate()!==t)return null;let u=l.getTimezoneOffset()*6e4;return new Date(l.getTime()-u)},credit_card_month_year(i){if(!/\d{2}\/\d{2}/.test(i))return null;let[t,r]=i.split("/").map(l=>parseInt(l)),s=new Date(r+2e3,t,0);return s instanceof Date&&!isNaN(s)&&s.getMonth()+1===t&&s.getTime()>=Date.now()?s:null}}});var WE,In,oi,qr=ri(()=>{ks();WE={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00C6:"AE",\u00C7:"C",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00D0:"D",\u00D1:"N",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O","\xD7":"x",\u00D8:"O",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00DD:"Y",\u00DE:"Th",\u00DF:"ss",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00E6:"ae",\u00E7:"c",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00F0:"d",\u00F1:"n",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00FD:"y",\u00FE:"th",\u00FF:"y",\u0100:"A",\u0101:"a",\u0102:"A",\u0103:"a",\u0104:"A",\u0105:"a",\u0106:"C",\u0107:"c",\u0108:"C",\u0109:"c",\u010A:"C",\u010B:"c",\u010C:"C",\u010D:"c",\u010E:"D",\u010F:"d",\u0110:"D",\u0111:"d",\u0112:"E",\u0113:"e",\u0114:"E",\u0115:"e",\u0116:"E",\u0117:"e",\u0118:"E",\u0119:"e",\u011A:"E",\u011B:"e",\u011C:"G",\u011D:"g",\u011E:"G",\u011F:"g",\u0120:"G",\u0121:"g",\u0122:"G",\u0123:"g",\u0124:"H",\u0125:"h",\u0126:"H",\u0127:"h",\u0128:"I",\u0129:"i",\u012A:"I",\u012B:"i",\u012C:"I",\u012D:"i",\u012E:"I",\u012F:"i",\u0130:"I",\u0131:"i",\u0132:"IJ",\u0133:"ij",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013A:"l",\u013B:"L",\u013C:"l",\u013D:"L",\u013E:"l",\u013F:"L",\u0140:"l",\u0141:"L",\u0142:"l",\u0143:"N",\u0144:"n",\u0145:"N",\u0146:"n",\u0147:"N",\u0148:"n",\u0149:"'n",\u014A:"NG",\u014B:"ng",\u014C:"O",\u014D:"o",\u014E:"O",\u014F:"o",\u0150:"O",\u0151:"o",\u0152:"OE",\u0153:"oe",\u0154:"R",\u0155:"r",\u0156:"R",\u0157:"r",\u0158:"R",\u0159:"r",\u015A:"S",\u015B:"s",\u015C:"S",\u015D:"s",\u015E:"S",\u015F:"s",\u0160:"S",\u0161:"s",\u0162:"T",\u0163:"t",\u0164:"T",\u0165:"t",\u0166:"T",\u0167:"t",\u0168:"U",\u0169:"u",\u016A:"U",\u016B:"u",\u016C:"U",\u016D:"u",\u016E:"U",\u016F:"u",\u0170:"U",\u0171:"u",\u0172:"U",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017A:"z",\u017B:"Z",\u017C:"z",\u017D:"Z",\u017E:"z"},In={transliterate(i){return i.split("").map(function(t){return WE[t]||t}).join("")},parameterize(i){return In.transliterate(i).toLowerCase().replace(/\s/g,"-").replace(/[^a-z0-9\-]/g,"")},urlize(i){return In.transliterate(i).replace(/\s/g,"-").replace(/[^a-zA-Z0-9\-_:/.?=#\[\]@!$&]/g,"")},isEmpty(i){return!i||!i.trim()},isPresent(i){return!In.isEmpty(i)},translate(i,t,r){return In.isEmpty(t)&&In.isEmpty(r)?i:In.isPresent(t)?tt.apply(t,i):Number(i)===1?`${i} ${r}`:`${i} ${r}s`},unformat(i,t){return t==="decimal"?i.replace(/\./g,"").replace(",","."):i}},oi=In});var Oe,tt,ks=ri(()=>{ig();nc();qr();Oe={apply(i,t){return Oe[i](t)},age(i){return i.replace(/\d|e|\s/g,"").length===0?i.trim()+" "+Oe.short_age(i):i},age_diminutive(i){return i.replace(/\d|e|\s/g,"").length===0?i.trim()+" "+Oe.short_age_diminutive(i):i},age_number(i){let t=i.match(/\d+/g);return t?t.join(" e "):""},age_text(i){let t=i.replace(/ /g,""),r=i.match(/\d+/g);return r?Oe.numbers(i).length===t.length||r&&r.length>1?Oe.short_age(i):Oe.text(i):""},age_with_party_prefix(i){return i=Oe.age(i),i?"Festinha de "+i:""},age_with_invite_prefix(i){let t=Oe.numbers(i)>1?"os":"o";return i=Oe.age(i),i?"Vem comemorar "+t+" "+i:""},alphanumeric(i){return i.replace(/[^a-z0-9]/ig,"")},alphanumeric_and_spaces(i){return i.replace(/[^a-z0-9 ]/ig,"")},classification(i){return{birthday:"Anivers\xE1rio",birthday_adult:"Anivers\xE1rio",baptism:"Batizado",baby_shower:"Ch\xE1 de beb\xEA",diaper_shower:"Ch\xE1 de fraldas",first_communion:"Primeira Comunh\xE3o",sweet_15:"Festa",other:"Festa"}[i]||""},currency(i){let t="pt-BR",r="BRL";return i?Number(i).toLocaleString(t,{style:"currency",currency:r}):0 .toLocaleString(t,{style:"currency",currency:r})},cpf_cnpj(i){let t=Oe.numbers(i);switch(t.length){case 11:return Oe.cpf(i);case 14:return Oe.cnpj(i);default:return t}},cpf(i){return i=Oe.numbers(i),i.length>=9&&(i=i.substr(0,9)+"-"+i.substr(9)),i.length>=6&&(i=i.substr(0,6)+"."+i.substr(6)),i.length>=3&&(i=i.substr(0,3)+"."+i.substr(3)),i},cnpj(i){return i=Oe.numbers(i),i.length>=12&&(i=i.substr(0,12)+"-"+i.substr(12)),i.length>=8&&(i=i.substr(0,8)+"/"+i.substr(8)),i.length>=5&&(i=i.substr(0,5)+"."+i.substr(5)),i.length>=2&&(i=i.substr(0,2)+"."+i.substr(2)),i},credit_card(i){return i=Oe.numbers(i),i.length>=12&&(i=i.substr(0,12)+" "+i.substr(12)),i.length>=8&&(i=i.substr(0,8)+" "+i.substr(8)),i.length>=4&&(i=i.substr(0,4)+" "+i.substr(4)),i},credit_card_name(i){return oi.transliterate(i).toUpperCase().replace(/[^A-Z\s]/ig,"")},credit_card_month_year(i){return i=i.replace(/\D/g,""),i.length>=3&&(i=i.substr(0,2)+"/"+i.substr(2,i.length)),i},date(i){return i=i.replace(/\D/g,""),i.length>=4&&(i=i.substr(0,4)+"/"+i.substr(4)),i.length>=2&&(i=i.substr(0,2)+"/"+i.substr(2)),i},date_dot(i){return i=Oe.date(i),i=i.replace(/\//g,"\u2022"),i},date_period(i){return i=Oe.date(i),i=i.replace(/\//g,"."),i},day(i){return i=i.replace(/\D/g,""),i.length<2?"":i.substr(0,2)},decimal(i){return i=i.replace(/\D/g,"").replace(/^0+/,""),i=i.padStart(3,"0"),i.length>11&&(i=i.substr(0,i.length-11)+"."+i.substr(i.length-11)),i.length>8&&(i=i.substr(0,i.length-8)+"."+i.substr(i.length-8)),i.length>5&&(i=i.substr(0,i.length-5)+"."+i.substr(i.length-5)),i.length>2&&(i=i.substr(0,i.length-2)+","+i.substr(i.length-2)),i},email_phone(i){return/^\d+$/.test(i)?Oe.phone(i):i},gender_connective(i){switch(i){case"female":return"da";case"male":return"do";default:return"do(a)"}},letters(i){return i.replace(/[0-9]/g,"")},hour(i){return i.substr(3,2)!=="00"?i:parseInt(i.substr(0,2))+" horas"},hour_h(i){return i.replace(":","h")},short_hour_h(i){return i.substr(2)==="00"?i.substr(0,2)+"h":i.replace(":","h")},hour_connective(i){return"\xE0s "+Oe.hour(i)},simple_hour_connective(i){return"\xE0s "+i},short_birthday_prefix(i){return"Niver"},hour_with_prefix(i){return(i.substr(0,2)==="01"?"A partir da":"A partir das")+" "+i},hour_text(i){let[t,r]=i.split(":"),s=parseInt(t)===1?"\xE0 uma hora":`\xE0s ${Pn.hours[t]} horas`,l=parseInt(r)===30?"e trinta minutos":"";return[s,l].join(" ")},month(i){return i=i.replace(/\D/g,""),i.length<4?"":Pn.months[i.substr(2,2)]||""},month_number(i){return i=i.replace(/\D/g,""),i.length<4?"":i.substr(2,2)},first_letter(i){return i=i.replace(/ /g,""),i.substr(0,1)},name_with_prefix(i){return i?"& "+i:""},name_age_connector_pluralizable(i){var t;return((t=i.match(/\s?[&\-,|]\s/))==null?void 0:t.length)>0?i.replace(/\sfaz\s/," fazem "):i},gift_suggestion_with_title(i){return i?"Sugest\xE3o de presente: "+i:""},negative_number(i){return i.replace(/[^-0-9]*/g,"")},number(i){return i.replace(/\D/g,"")},numbers(i){return Oe.number(i)},ordinal_number(i){return Oe.numbers(i)+"º"},phone(i){if(i=i.replace(/\D/g,""),i.length<11)return t(i);return r(i);function t(s){return s.length>=6&&(s=s.substr(0,6)+"-"+s.substr(6)),s.length>=2&&(s=s.substr(0,2)+") "+s.substr(2)),s.length>0&&(s="("+s),s}function r(s){return"("+s.substr(0,2)+") "+s.substr(2,5)+"-"+s.substr(7)}},international_phone(i){return`+${i.replace(/\D/g,"")}`},modern_brazilian_format(i){return i.match(/^\(\d{2}\)\s[789]\d{3}\-\d{4}$/)&&(i=i.substr(0,5)+"9"+i.substr(5)),i},auto_phone(i){let t=/^\s*(\+|55)/.test(i),r=i.startsWith("0");return i=i.replace(/\D/g,""),t&&(i=i.substr(2)),r&&(i=parseInt(i).toString(),i.length>=13&&(i=i.substr(-11)),i.length===12&&(i=i.substr(-10))),i.length>=12&&(i=i.substr(0,11)),i.length<=11?Oe.phone(i):Oe.international_phone(i)},modern_auto_phone(i){return i=Oe.auto_phone(i),oi.isEmpty(i)?i:i.startsWith("+")&&i.length===13&&["7","8","9"].includes(i[5])||i.length===14&&["7","8","9"].includes(i[5])?i.slice(0,5)+"9"+i.slice(5):i},short_age(i){let t=Oe.numbers(i);return t?Number(t)>1?"anos":"ano":""},short_age_diminutive(i){let t=Oe.numbers(i);return t?Number(t)>1?"aninhos":"aninho":""},short_month(i){return i=i.replace(/\D/g,""),i.length<4?"":(Pn.months[i.substr(2,2)]||"").substr(0,3)},short_weekday(i){let t=Bi.date(i);return t?Pn.weekdays[t.getUTCDay()].replace("-feira",""):""},very_short_weekday(i){let t=Bi.date(i);return t?Pn.weekdays[t.getUTCDay()].substr(0,3):""},slug(i){return oi.parameterize(i)},text(i){return i.replace(/\d/g,"").replace(/\s\s+/g," ").trim()},url(i){return oi.urlize(i)},weekday(i){let t=Bi.date(i);return t?Pn.weekdays[t.getUTCDay()]:""},year(i){return i=i.replace(/\D/g,""),i.length<8?"":i.substr(4,4)},titlecase(i){let t=[];return i.split(" ").forEach(r=>{t.push(r.charAt(0)+r.slice(1).toLowerCase())}),t.join(" ")},short_year(i){return i=i.replace(/\D/g,""),i.length<8?"":i.substr(6,2)},sku(i){return i=Oe.alphanumeric(i).toUpperCase(),i.length>=17&&(i=i.substr(0,17)+"-"+i.substr(17)),i.length>=8&&(i=i.substr(0,8)+"-"+i.substr(8)),i.length>=3&&(i=i.substr(0,3)+"-"+i.substr(3)),i},zipcode(i){return i=i.replace(/\D/g,""),i.length>=5&&(i=i.substr(0,5)+"-"+i.substr(5)),i},rsvp_with_prefix(i){return"RSVP at\xE9 "+i.substr(0,5)+":"},ceremony_prefix(i){return"Cerim\xF4nia: "+i},reception_prefix(i){return"Recep\xE7\xE3o: "+i},celebrate_prefix(i){return"Comemora "+i},event_title_welcoming(i){return"Te espero para o "+i}},tt=Oe});var ed,ji,Ls=ri(()=>{qr();ed={noscroll(i,t=document.body){t.classList.toggle("noscroll",i)},show(i,t){t?i.style[t.attribute]=t.value:i.classList.contains("hidden")?i.classList.remove("hidden"):i.style.display=i.dataset.domDisplay||"block"},hide(i,t){t?i.style[t.attribute]=t.value:i.style.display!=="none"&&(i.dataset.domDisplay=i.style.display,i.style.display="none")},activate(i,t){t===void 0?i.classList.toggle("active"):t?i.classList.add("active"):i.classList.remove("active")},set(i,t,r={}){let s=r.attribute||"value",l=r.event||"changed",u=i.dataset.valueFormat,f=i.dataset.valueSuffix,y=i.tagName;switch(y){case"DIV":break;case"P":case"LABEL":case"SPAN":i.textContent=oi.translate(t,u,f);break;case"INPUT":i.value=t;break;default:console.log(`I don't know how to set values in ${y}.`)}i.setAttribute(`data-${s}`,t.toString().replace(/,/,".")),ed.fire(i,l)},get(i,t={}){let r=t.attribute||"value",s=i.tagName,l=i.dataset.formatter,u=i.value;switch(s){case"DIV":case"P":case"LABEL":case"SPAN":return i.getAttribute(`data-${r}`);case"INPUT":case"TEXTAREA":return oi.unformat(u,l);default:console.log(`I don't know how to get values from ${s}.`)}},fire(i,t,r,s={}){let{bubbles:l,cancelable:u}=s,f=new CustomEvent(t,{bubbles:l||!1,cancelable:u||!0,detail:r});return i.dispatchEvent(f),!f.defaultPrevented}};window.Dom=ed;ji=ed});var aa=ar((Lg,wc)=>{(function(i){"use strict";var t=i.URL||i.webkitURL;function r(T){return t?t.createObjectURL(T):!1}function s(T){return t?t.revokeObjectURL(T):!1}function l(T,D){T&&T.slice(0,5)==="blob:"&&!(D&&D.noRevoke)&&s(T)}function u(T,D,H,Z){if(!i.FileReader)return!1;var X=new FileReader;X.onload=function(){D.call(X,this.result)},H&&(X.onabort=X.onerror=function(){H.call(X,this.error)});var J=X[Z||"readAsDataURL"];if(J)return J.call(X,T),X}function f(T,D){return Object.prototype.toString.call(D)==="[object "+T+"]"}function y(T,D,H){function Z(X,J){var $=document.createElement("img"),st;function ft(R,I){if(X===J){X&&X(R,I);return}else if(R instanceof Error){J(R);return}I=I||{},I.image=R,X(I)}function Q(R,I){I&&i.console&&console.log(I),R&&f("Blob",R)?(T=R,st=r(T)):(st=T,H&&H.crossOrigin&&($.crossOrigin=H.crossOrigin)),$.src=st}if($.onerror=function(R){l(st,H),J&&J.call($,R)},$.onload=function(){l(st,H);var R={originalWidth:$.naturalWidth||$.width,originalHeight:$.naturalHeight||$.height};try{y.transform($,H,ft,T,R)}catch(I){J&&J(I)}},typeof T=="string")return y.requiresMetaData(H)?y.fetchBlob(T,Q,H):Q(),$;if(f("Blob",T)||f("File",T))return st=r(T),st?($.src=st,$):u(T,function(R){$.src=R},J)}return i.Promise&&typeof D!="function"?(H=D,new Promise(Z)):Z(D,D)}y.requiresMetaData=function(T){return T&&T.meta},y.fetchBlob=function(T,D){D()},y.transform=function(T,D,H,Z,X){H(T,X)},y.global=i,y.readFile=u,y.isInstanceOf=f,y.createObjectURL=r,y.revokeObjectURL=s,typeof define=="function"&&define.amd?define(function(){return y}):typeof wc=="object"&&wc.exports?wc.exports=y:i.loadImage=y})(typeof window!="undefined"&&window||Lg)});var Ee,oe,Vr,ca=ri(()=>{Ee={container:null,element:null,groupMode:!1},oe={allFonts(i){i=i||0,setTimeout(function(){document.querySelectorAll("[data-allow-font-resize]").forEach(function(t){t.querySelector(":not(br)")?oe.font(t.lastElementChild):oe.font(t)})},i)},font(i){Ee.container=i.parentNode,Ee.element=i,oe.allowFontResize()?oe.child():oe.allowFontGroupResize()&&oe.children()},child(){Ee.groupMode=!1,oe.prepareForResize(),oe.increaseFontSizeToMax(),oe.reduceFontSizeToFit(),oe.applyResizingToGroup()},children(){Ee.groupMode=!0,Ee.element=Ee.container.lastElementChild,oe.prepareForResize(),oe.increaseFontSizeToMax(),oe.reduceFontSizeToFit()},applyResizingToGroup(){let i=Ee.element.dataset.resizerGroup;if(!i)return;let t=Array.prototype.slice.call(document.querySelectorAll(`[data-resizer-group="${i}"]`)),r=oe.getCurrentFontSize(),s=t.map(l=>(Ee.element=l,oe.getCurrentFontSize()!isNaN(l));r=Math.min(...s),t.forEach(l=>{Ee.element=l,oe.setCurrentFontSize(r)})},reduceFontSizeToFit(){for(;oe.isCurrentFontTooBig()&&oe.getCurrentFontSize()>1;)oe.setCurrentFontSize(oe.getCurrentFontSize()-1)},increaseFontSizeToMax(){for(;!oe.isCurrentFontTooBig()&&oe.getCurrentFontSize()=Ee.container.offsetHeight&&Ee.container.offsetHeight>=oe.getMaxHeight()-1||oe.wordIsTooLong()},wordIsTooLong(){return Ee.element.offsetWidth>Ee.container.offsetWidth+1},prepareForResize(){isNaN(oe.getOriginalFontSize())&&oe.setOriginalFontSize(oe.getFontSize()),isNaN(oe.getOriginalLineHeight())&&oe.setOriginalLineHeight(oe.getLineHeight()),isNaN(oe.getCurrentFontSize())&&oe.setCurrentFontSize(oe.getFontSize()),isNaN(oe.getMaxHeight())&&oe.setMaxHeight(oe.getAllowedHeight())},setOriginalFontSize(i){Ee.element.dataset.originalFontSize=i},getOriginalFontSize(){return parseInt(Ee.element.dataset.originalFontSize,10)},setOriginalLineHeight(i){Ee.element.dataset.originalLineHeight=i},getOriginalLineHeight(){return parseInt(Ee.element.dataset.originalLineHeight,10)},setCurrentFontSize(i){let t=this.getOriginalLineHeight()*i/this.getOriginalFontSize(),r={"font-size":`${i}px !important`,"line-height":`${t}px !important`};Ee.groupMode?Ee.container.querySelectorAll("div").forEach(function(s){oe.mergeStyle(s,r)}):oe.mergeStyle(Ee.element,r),Ee.element.dataset.currentFontSize=i},getCurrentFontSize(){return parseInt(Ee.element.dataset.currentFontSize,10)},getMaxHeight(){return parseInt(Ee.container.dataset.maxHeight,10)},setMaxHeight(i){Ee.container.dataset.maxHeight=i},allowFontResize(){return Ee.element.dataset.allowFontResize!==void 0},allowFontGroupResize(){return Ee.container.dataset.allowFontResize!==void 0},getFontSize(){let i=window.getComputedStyle(Ee.element).fontSize;return parseInt(i.replace(/[^\d.]/,""),10)},getLineHeight(){let i=window.getComputedStyle(Ee.element).lineHeight;return parseInt(i.replace(/[^\d.]/,""),10)},getAllowedHeight(){let i=window.getComputedStyle(Ee.container),t=parseInt(i.maxHeight.replace(/[^\d.]/,""),10);return isNaN(t)?parseInt(i.height.replace(/[^\d.]/,""),10):t},mergeStyle(i,t){Object.keys(t).forEach(r=>{i.style[r]="",i.style.cssText+=`${r}: ${t[r]}`})}},Vr=oe});var Le,ht,Dg=ri(()=>{ca();qr();Mn();Ls();Le={conditional(i,t){Ve.delegate(document,i,"input",function(r){let s=document.getElementById(t);s&&Le.chooseTargetElement(s).classList.toggle("hidden",!r.target.value.trim())}),Le.clickBind(t,i)},conditional_target(i,t,r){Ve.delegate(document,i,"input",function(s){let l=document.getElementById(r),u=document.getElementById(t),f=document.querySelector(i);if(l){if(u)!f.value&&u.firstElementChild.className==="hidden"?Le.chooseTargetElement(u).classList.toggle("hidden",!1):Le.chooseTargetElement(u).classList.toggle("hidden",!0);else return;Le.chooseTargetElement(l).classList.toggle("hidden",!s.target.value.trim())}}),Le.clickBind(r,i)},custom(i,t,r,s){i.forEach(function(f){let y=f.event||"input";Ve.delegate(document,f.selector,y,function(){let T=document.getElementById(t);if(!T)return;let D=l(i,r);s&&(D=s(D)),Le.setText(T,D)})}),Le.clickBind(t,i[0].selector);function l(f,y){let T=[];return f.forEach(function(D){let H=document.querySelector(D.selector),Z=Le.getValue(H),X=D.callback?D.callback(Z):Z;X.length>0&&T.push(X.toString())}),u(T,y)}function u(f,y){if(f.length===0)return"";if(typeof y=="string")return f.join(y);if(y.length0&&(D.push(H),D.push(Z))}),D.join("")}},formatted(i,t,r){Ve.delegate(document,i,"input",function(s){let l=document.getElementById(t);l&&Le.setText(l,r(Le.getValue(s.target)))}),Le.clickBind(t,i)},gendered(i,t){Ve.delegate(document,i,"input",function(r){let s=document.getElementById(t);if(!s)return;let l=s.querySelectorAll('[data-gender="male"]'),u=s.querySelectorAll('[data-gender="female"]');Le.getValue(r.target)==="male"?(l.forEach(function(y){y.classList.remove("hidden")}),u.forEach(function(y){y.classList.add("hidden")})):(l.forEach(function(y){y.classList.add("hidden")}),u.forEach(function(y){y.classList.remove("hidden")}))}),Le.clickBind(t,i)},getRadioValue(i){return(document.querySelector('[name="'+i.name+'"]:checked')||{}).value||""},getValue(i){return(i.value||(i.dataset||{}).placeholder||i.placeholder||"").toString().trim()},join(i,t,r){i.forEach(function(l){Ve.delegate(document,l,"input",function(){let u=document.getElementById(t);u&&(r=Le.chooseSeparator(u,r),Le.setText(u,s(i,r)))})});function s(l,u){let f=[];return l.forEach(function(y){let T=document.querySelector(y),D=Le.getValue(T);D.length>0&&f.push(D.toString().trim())}),f.join(u)}Le.clickBind(t,i[0])},optionPicker(i,t){Ve.delegate(document,i,"input",function(r){let s=document.getElementById(t);if(!s)return;let l=Le.getValue(r.target);s.querySelectorAll("[data-option]").forEach(function(u){u.dataset.option===l?u.classList.remove("hidden"):u.classList.add("hidden")}),Vr.allFonts()}),Le.clickBind(t,i)},placeholder(i,t,r){Ve.delegate(document,i,"input",()=>{s(i,t,r)}),Ve.delegate(document,t,"input",()=>{s(i,t,r)});function s(l,u,f){let y=document.getElementById(f);y&&document.querySelector(l).value===""&&(document.querySelector(t).value!==""?Le.setText(y,""):Le.setText(y,"",!0))}},pluralizable(i){Ve.delegate(document,i,"input",function(t){let r=Le.getValue(t.target).match(/\d+/g),s=r&&r.length>1?"plural":"singular";document.querySelectorAll("[data-pluralizable]").forEach(function(l){s===l.dataset.pluralizable?l.classList.remove("hidden"):l.classList.add("hidden")})})},raw(i,t){Ve.delegate(document,i,"input",function(r){let s=document.getElementById(t);s&&Le.setText(s,Le.getValue(r.target))}),Le.clickBind(t,i)},setText(i,t,r=!1){let s=Le.chooseTargetElement(i),l=Le.formatValue(s,t,r);if(s.tagName==="IMG"){let u=t.length>0?oi.urlize(l):"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";s.src=u}else s.tagName==="INPUT"?(s.value=l,ji.fire(s,"input",null,{bubbles:!0})):(s.innerHTML=l.replace(/-/g,"‑"),Vr.font(s))},clickBind(i,t){Ve.delegate(document,"#"+i,"click",function(r){if(r.target.tagName==="INPUT")return;let s=Ve.getPosition(document.querySelector(t));window.scroll({top:s.y-15,left:0,behavior:"smooth"})})},chooseTargetElement(i){let t=i.querySelectorAll("span, img");return t.length>0?t[0]:i},chooseSeparator(i,t){return Le.chooseTargetElement(i).dataset.binderSeparator||t},formatValue(i,t,r){if(r)return t;if(t.length===0)return i.dataset.binderPlaceholder||"";let s=i.dataset.binderPrefix||"",l=i.dataset.binderSuffix||"",u=s+t+l,f=i.dataset.binderPadding||"";return f.length===0?u:u.padStart(f.length,f.charAt(0))}},ht=Le});var Rg={};ml(Rg,{default:()=>g0});var m0,g0,Mg=ri(()=>{Dg();ks();m0={start(){ht.raw("#invitation_person_name","child-name"),ht.raw("#invitation_person_name","person-name"),ht.raw("#invitation_location","event-location"),ht.raw("#invitation_neighborhood","address-neighborhood"),ht.raw("#invitation_city","address-city"),ht.raw("#invitation_secondary_person_name","secondary-person-name"),ht.raw("#invitation_secondary_location","secondary-event-location"),ht.raw("#invitation_secondary_neighborhood","secondary-address-neighborhood"),ht.raw("#invitation_secondary_city","secondary-address-city"),ht.raw("#invitation_starts_at","event-starts_at"),ht.raw("#invitation_public_url","event-public-url"),ht.raw("#invitation_rsvp_closes_on","event-rsvp-date"),ht.raw("#invitation_gift_suggestion","event-gift-suggestion"),ht.join(["#invitation_starts_at_hour","#invitation_starts_at_minutes"],"invitation_starts_at",":"),ht.join(["#invitation_person_name","#invitation_secondary_person_name"],"couple-names"," & "),ht.join(["#invitation_person_name","#invitation_secondary_person_name"],"couple-names-with-e"," e "),ht.join(["#invitation_street","#invitation_number","#invitation_complement"],"address-building",", "),ht.join(["#invitation_street","#invitation_number","#invitation_complement","#invitation_neighborhood"],"address-building-neighborhood",", "),ht.join(["#invitation_city","#invitation_state"],"address-city-state"," - "),ht.join(["#invitation_neighborhood","#invitation_city"],"address-neighborhood-city"," - "),ht.join(["#invitation_neighborhood","#invitation_city","#invitation_state"],"address-neighborhood-city-state"," - "),ht.join(["#invitation_secondary_street","#invitation_secondary_number","#invitation_secondary_complement"],"secondary-address-building",", "),ht.join(["#invitation_secondary_street","#invitation_secondary_number","#invitation_secondary_complement","#invitation_secondary_neighborhood"],"secondary-address-building-neighborhood",", "),ht.join(["#invitation_secondary_city","#invitation_secondary_state"],"secondary-address-city-state"," - "),ht.join(["#invitation_secondary_neighborhood","#invitation_secondary_city"],"secondary-address-neighborhood-city"," - "),ht.join(["#invitation_secondary_neighborhood","#invitation_secondary_city","#invitation_secondary_state"],"secondary-address-neighborhood-city-state"," - "),ht.join(["#invitation_scheduled_on","#invitation_city"],"event-date-city"," | "),ht.formatted("#invitation_classification","event-title-without-article",tt.classification),ht.formatted("#invitation_person_gender","event-title-customized",tt.gender_connective),ht.formatted("#invitation_person_gender","event-gender-connective",tt.gender_connective),ht.formatted("#invitation_scheduled_on","event-day",tt.day),ht.formatted("#invitation_scheduled_on","event-month",tt.month),ht.formatted("#invitation_scheduled_on","event-year",tt.year),ht.formatted("#invitation_scheduled_on","event-short-year",tt.short_year),ht.formatted("#invitation_scheduled_on","event-month-number",tt.month_number),ht.formatted("#invitation_scheduled_on","event-short-month",tt.short_month),ht.formatted("#invitation_scheduled_on","event-weekday",tt.weekday),ht.formatted("#invitation_scheduled_on","event-short-weekday",tt.short_weekday),ht.formatted("#invitation_scheduled_on","event-date",tt.date),ht.formatted("#invitation_scheduled_on","event-date-dot",tt.date_dot),ht.formatted("#invitation_scheduled_on","event-date-period",tt.date_period),ht.formatted("#invitation_person_age","child-age",tt.age),ht.formatted("#invitation_person_age","child-age-diminutive",tt.age_diminutive),ht.formatted("#invitation_person_age","child-age-number",tt.age_number),ht.formatted("#invitation_person_age","child-age-number-secondary",tt.age_number),ht.formatted("#invitation_person_age","child-age-ordinal-number",tt.ordinal_number),ht.formatted("#invitation_person_age","child-age-text",tt.age_text),ht.formatted("#invitation_person_age","child-short-age",tt.short_age),ht.formatted("#invitation_person_age","person-age-celebrate",tt.celebrate_prefix),ht.formatted("#invitation_starts_at","event-hour-connective",tt.hour_connective),ht.formatted("#invitation_starts_at","event-hour-with-connective",tt.simple_hour_connective),ht.formatted("#invitation_starts_at","event-hour-long",tt.hour),ht.formatted("#invitation_starts_at","event-hour-text",tt.hour_text),ht.formatted("#invitation_starts_at","event-hour_with_prefix",tt.hour_with_prefix),ht.formatted("#invitation_starts_at","event-hour-h",tt.hour_h),ht.formatted("#invitation_starts_at","event-short-hour-h",tt.short_hour_h),ht.formatted("#invitation_person_name","child-name-initial",tt.first_letter),ht.formatted("#invitation_person_name","person-name-initial",tt.first_letter),ht.formatted("#invitation_secondary_person_name","secondary-person-name-initial",tt.first_letter),ht.formatted("#invitation_gift_suggestion","gift-suggestion-with-title",tt.gift_suggestion_with_title),ht.formatted("#invitation_secondary_person_name","secondary-person-name-with-prefix",tt.name_with_prefix),ht.gendered("#invitation_person_gender","event-gendered-title"),ht.pluralizable("#invitation_person_age"),ht.optionPicker("#invitation_classification","event-classification"),ht.conditional("#invitation_gift_suggestion","event-gift-suggestion-message"),ht.conditional_target("#invitation_gift_suggestion","event-gift-suggestion-default-message","event-gift-suggestion-message"),ht.custom([{selector:"#invitation_starts_at_hour"},{selector:"#invitation_starts_at_minutes"}],"invitation_starts_at",":"),ht.custom([{selector:"#invitation_person_name"},{selector:"#invitation_secondary_person_name"}],"invitation_public_url"," e ",tt.slug),ht.custom([{selector:"#invitation_classification",callback:tt.classification},{selector:"#invitation_person_gender",callback:tt.gender_connective}],"event-title"," "),ht.custom([{selector:"#invitation_classification",callback:tt.classification},{selector:"#invitation_person_gender",callback:tt.gender_connective},{selector:"#invitation_person_name"}],"event-title-with-connector"," "),ht.custom([{selector:"#invitation_classification",callback:tt.classification},{selector:"#invitation_person_gender",callback:tt.gender_connective},{selector:"#invitation_person_name"}],"event-title-welcoming"," ",tt.event_title_welcoming),ht.custom([{selector:"#invitation_person_name"},{selector:"#invitation_person_age",callback:tt.numbers}],"child-name-with-age"," faz ",tt.name_age_connector_pluralizable),ht.custom([{selector:"#invitation_person_gender",callback:tt.gender_connective},{selector:"#invitation_person_name"}],"person-name-with-gender-connective"," "),ht.custom([{selector:"#invitation_person_name"},{selector:"#invitation_person_age",callback:tt.age}],"person-name-and-age"," faz ",tt.name_age_connector_pluralizable),ht.custom([{selector:"#invitation_person_age",callback:tt.age},{selector:"#invitation_person_gender",callback:tt.gender_connective},{selector:"#invitation_person_name"}],"person-name-and-age-with-gender",[" "," "]),ht.custom([{selector:"#invitation_person_name",callback:tt.short_birthday_prefix},{selector:"#invitation_person_gender",callback:tt.gender_connective},{selector:"#invitation_person_name"},{selector:"#invitation_person_age",callback:tt.age}],"person-name-and-age-with-short-birthday-prefix",[" "," ",", "]),ht.custom([{selector:"#invitation_person_age",callback:tt.age_with_party_prefix},{selector:"#invitation_person_gender",callback:tt.gender_connective},{selector:"#invitation_person_name"}],"person-age-and-name-with-party-prefix",[" "," "]),ht.custom([{selector:"#invitation_person_age",callback:tt.age_with_invite_prefix},{selector:"#invitation_person_name"}],"person-age-and-name-with-invite-prefix"," de "),ht.custom([{selector:"#invitation_person_age",callback:tt.age},{selector:"#invitation_person_name"}],"person-age-and-name"," de "),ht.custom([{selector:"#invitation_scheduled_on",callback:tt.weekday},{selector:"#invitation_starts_at"}],"event-weekday-hour"," | "),ht.custom([{selector:"#invitation_scheduled_on",callback:tt.weekday},{selector:"#invitation_starts_at"}],"event-weekday-hour-with-connective"," \xE0s "),ht.custom([{selector:"#invitation_scheduled_on",callback:tt.weekday},{selector:"#invitation_starts_at",callback:tt.hour_text}],"event-weekday-hour-readable",", "),ht.custom([{selector:"#invitation_scheduled_on",callback:tt.short_weekday},{selector:"#invitation_starts_at"}],"event-short-weekday-hour-double-colon"," :: "),ht.custom([{selector:"#invitation_scheduled_on",callback:tt.short_weekday},{selector:"#invitation_starts_at"}],"event-short-weekday-hour"," | "),ht.custom([{selector:"#invitation_scheduled_on",callback:tt.short_weekday},{selector:"#invitation_starts_at",callback:tt.hour_h}],"event-short-weekday-hour-without-connective"," "),ht.custom([{selector:"#invitation_scheduled_on",callback:tt.short_weekday},{selector:"#invitation_starts_at"}],"event-short-weekday-hour-with-connective"," \xE0s "),ht.custom([{selector:"#invitation_scheduled_on",callback:tt.short_weekday},{selector:"#invitation_starts_at",callback:tt.hour_h}],"event-short-weekday-hour-with-colon-and-connective",", \xE0s "),ht.custom([{selector:"#invitation_scheduled_on",callback:tt.very_short_weekday},{selector:"#invitation_starts_at"}],"event-very-short-weekday-hour"," | "),ht.custom([{selector:"#invitation_scheduled_on",callback:tt.weekday},{selector:"#invitation_starts_at",callback:tt.hour}],"event-weekday-hour-long"," | "),ht.custom([{selector:"#invitation_scheduled_on",callback:tt.day},{selector:"#invitation_scheduled_on",callback:tt.month}],"event-day-month"," de "),ht.custom([{selector:"#invitation_rsvp_closes_on",callback:tt.day},{selector:"#invitation_rsvp_closes_on",callback:tt.month}],"event-rsvp"," de "),ht.custom([{selector:"#invitation_rsvp_closes_on",callback:tt.day},{selector:"#invitation_rsvp_closes_on",callback:tt.month},{selector:"#invitation_rsvp_closes_on",callback:tt.year}],"event-rsvp-full"," de "),ht.custom([{selector:"#invitation_scheduled_on",callback:tt.day},{selector:"#invitation_scheduled_on",callback:tt.month},{selector:"#invitation_scheduled_on",callback:tt.year}],"event-day-month-year-with-connective"," de "),ht.custom([{selector:"#invitation_scheduled_on",callback:tt.day},{selector:"#invitation_scheduled_on",callback:tt.month}],"event-day-month-no-connector"," "),ht.custom([{selector:"#invitation_scheduled_on",callback:tt.day},{selector:"#invitation_scheduled_on",callback:tt.short_month}],"event-day-short-month"," "),ht.custom([{selector:"#invitation_scheduled_on",callback:tt.weekday},{selector:"#invitation_scheduled_on",callback:tt.day},{selector:"#invitation_scheduled_on",callback:tt.month}],"event-weekday-day-month",[", "," de "]),ht.custom([{selector:"#invitation_scheduled_on",callback:tt.short_weekday},{selector:"#invitation_scheduled_on",callback:tt.day},{selector:"#invitation_scheduled_on",callback:tt.month}],"event-short-weekday-day-month",[", "," de "]),ht.custom([{selector:"#invitation_scheduled_on",callback:tt.short_weekday},{selector:"#invitation_scheduled_on",callback:tt.day},{selector:"#invitation_scheduled_on",callback:tt.month},{selector:"#invitation_starts_at"}],"event-short-weekday-day-month-hour",[", "," de "," \xE0s "]),ht.custom([{selector:"#invitation_scheduled_on",callback:tt.short_weekday},{selector:"#invitation_scheduled_on",callback:tt.day},{selector:"#invitation_scheduled_on",callback:tt.month},{selector:"#invitation_scheduled_on",callback:tt.year},{selector:"#invitation_starts_at"}],"event-short-weekday-day-month-year-hour",[", "," de "," de "," \xE0s "]),ht.custom([{selector:"#invitation_scheduled_on",callback:tt.day},{selector:"#invitation_scheduled_on",callback:tt.month},{selector:"#invitation_scheduled_on",callback:tt.short_weekday},{selector:"#invitation_starts_at"}],"event-day-month-short-weekday-hour-with-connective",[" de "," - "," \xE0s "]),ht.custom([{selector:"#invitation_scheduled_on",callback:tt.short_weekday},{selector:"#invitation_scheduled_on",callback:tt.day},{selector:"#invitation_scheduled_on",callback:tt.short_month},{selector:"#invitation_starts_at"}],"event-short-weekday-day-short-month-hour",[", "," de "," \xE0s "]),ht.custom([{selector:"#invitation_scheduled_on",callback:tt.day},{selector:"#invitation_scheduled_on",callback:tt.short_month},{selector:"#invitation_scheduled_on",callback:tt.short_weekday},{selector:"#invitation_starts_at"}],"event-day-short-month-weekday-hour-pipe",[" "," | "," | "]),ht.custom([{selector:"#invitation_scheduled_on",callback:tt.day},{selector:"#invitation_scheduled_on",callback:tt.short_month},{selector:"#invitation_scheduled_on",callback:tt.short_weekday},{selector:"#invitation_starts_at"}],"event-day-short-month-weekday-hour-break-line",[" ","
","
"]),ht.custom([{selector:"#invitation_scheduled_on",callback:tt.day},{selector:"#invitation_scheduled_on",callback:tt.short_month}],"event-day-short-month"," "),ht.custom([{selector:"#invitation_street"},{selector:"#invitation_number"},{selector:"#invitation_complement"},{selector:"#invitation_neighborhood"},{selector:"#invitation_city"},{selector:"#invitation_state"}],"address-complete",[", ",", ",", ",". "," - "]),ht.custom([{selector:"#invitation_street"},{selector:"#invitation_number"},{selector:"#invitation_complement"},{selector:"#invitation_neighborhood"}],"address-building-dash-neighborhood",[", "," - ",", "]),ht.custom([{selector:"#invitation_city"},{selector:"#invitation_state"},{selector:"#invitation_zipcode"}],"address-city-state-with-zipcode",[" - ",", "]),ht.custom([{selector:"#invitation_street"},{selector:"#invitation_number"},{selector:"#invitation_complement"},{selector:"#invitation_neighborhood"},{selector:"#invitation_city"}],"address-without-state",[", ",", ",", ",". "]),ht.custom([{selector:"#invitation_street"},{selector:"#invitation_number"},{selector:"#invitation_city"}],"address-street-and-city-break-line",[", ","
"]),ht.custom([{selector:"#invitation_secondary_street"},{selector:"#invitation_secondary_number"},{selector:"#invitation_secondary_complement"},{selector:"#invitation_secondary_neighborhood"},{selector:"#invitation_secondary_city"},{selector:"#invitation_state"}],"secondary-address-complete",[", ",", ",", ",". "," - "]),ht.custom([{selector:"#invitation_location",callback:tt.ceremony_prefix},{selector:"#invitation_street"},{selector:"#invitation_number"},{selector:"#invitation_complement"},{selector:"#invitation_neighborhood"},{selector:"#invitation_city"},{selector:"#invitation_state"}],"event-ceremony-address",[". ",", ",", ",", ",". "," - "]),ht.custom([{selector:"#invitation_location"},{selector:"#invitation_street"},{selector:"#invitation_number"},{selector:"#invitation_complement"},{selector:"#invitation_neighborhood"},{selector:"#invitation_city"},{selector:"#invitation_state"}],"event-ceremony-address-without-title",[". ",", ",", ",", ",". "," - "]),ht.custom([{selector:"#invitation_secondary_location",callback:tt.reception_prefix},{selector:"#invitation_secondary_street"},{selector:"#invitation_secondary_number"},{selector:"#invitation_secondary_complement"},{selector:"#invitation_secondary_neighborhood"},{selector:"#invitation_secondary_city"},{selector:"#invitation_state"}],"event-reception-address",[". ",", ",", ",", ",". "," - "]),ht.custom([{selector:"#invitation_secondary_street"},{selector:"#invitation_secondary_number"},{selector:"#invitation_secondary_complement"},{selector:"#invitation_secondary_neighborhood"}],"secondary-address-building-dash-neighborhood",[", "," - ",", "]),ht.custom([{selector:"#invitation_secondary_city"},{selector:"#invitation_secondary_state"},{selector:"#invitation_secondary_zipcode"}],"secondary-address-city-state-with-zipcode",[" - ",", "]),ht.custom([{selector:"#invitation_person_name",callback:tt.first_letter},{selector:"#invitation_secondary_person_name",callback:tt.first_letter}],"couple-name-initials-with-ampersand"," & "),ht.custom([{selector:"#invitation_person_name",callback:tt.first_letter},{selector:"#invitation_secondary_person_name",callback:tt.first_letter}],"couple-name-initials",""),ht.custom([{selector:"#invitation_rsvp_closes_on",callback:tt.rsvp_with_prefix},{selector:"#invitation_public_url"}],"event-rsvp-date-and-url"," "),ht.custom([{selector:"#invitation_scheduled_on",callback:tt.date_dot_default},{selector:"invitation_city"}],"event-date-period-city"," | "),ht.placeholder("#invitation_rsvp_closes_on","#invitation_public_url","event-rsvp"),ht.placeholder("#invitation_rsvp_closes_on","#invitation_public_url","event-rsvp-date"),ht.placeholder("#invitation_rsvp_closes_on","#invitation_public_url","event-rsvp-full"),ht.placeholder("#invitation_rsvp_closes_on","#invitation_public_url","event-rsvp-date-and-url")}},g0=m0});var Sc=ar((yd,wd)=>{(function(i,t){typeof yd=="object"&&typeof wd!="undefined"?wd.exports=t():typeof define=="function"&&define.amd?define(t):(i=typeof globalThis!="undefined"?globalThis:i||self,i.Cropper=t())})(yd,function(){"use strict";function i(L,m){var w=Object.keys(L);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(L);m&&(b=b.filter(function(z){return Object.getOwnPropertyDescriptor(L,z).enumerable})),w.push.apply(w,b)}return w}function t(L){for(var m=1;mL.length)&&(m=L.length);for(var w=0,b=new Array(m);w
',Pi=Number.isNaN||ft.isNaN;function qt(L){return typeof L=="number"&&!Pi(L)}var Ye=function(m){return m>0&&m<1/0};function $r(L){return typeof L=="undefined"}function kr(L){return l(L)==="object"&&L!==null}var Us=Object.prototype.hasOwnProperty;function fr(L){if(!kr(L))return!1;try{var m=L.constructor,w=m.prototype;return m&&w&&Us.call(w,"isPrototypeOf")}catch(b){return!1}}function bi(L){return typeof L=="function"}var Vs=Array.prototype.slice;function Xr(L){return Array.from?Array.from(L):Vs.call(L)}function Ge(L,m){return L&&bi(m)&&(Array.isArray(L)||qt(L.length)?Xr(L).forEach(function(w,b){m.call(L,w,b,L)}):kr(L)&&Object.keys(L).forEach(function(w){m.call(L,L[w],w,L)})),L}var Ne=Object.assign||function(m){for(var w=arguments.length,b=new Array(w>1?w-1:0),z=1;z0&&b.forEach(function(M){kr(M)&&Object.keys(M).forEach(function(W){m[W]=M[W]})}),m},Ic=/\.\d*(?:0|9){12}\d*$/;function er(L){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return Ic.test(L)?Math.round(L*m)/m:L}var Hn=/^width|height|left|top|marginLeft|marginTop$/;function pr(L,m){var w=L.style;Ge(m,function(b,z){Hn.test(z)&&qt(b)&&(b="".concat(b,"px")),w[z]=b})}function Lr(L,m){return L.classList?L.classList.contains(m):L.className.indexOf(m)>-1}function Fe(L,m){if(m){if(qt(L.length)){Ge(L,function(b){Fe(b,m)});return}if(L.classList){L.classList.add(m);return}var w=L.className.trim();w?w.indexOf(m)<0&&(L.className="".concat(w," ").concat(m)):L.className=m}}function Gi(L,m){if(m){if(qt(L.length)){Ge(L,function(w){Gi(w,m)});return}if(L.classList){L.classList.remove(m);return}L.className.indexOf(m)>=0&&(L.className=L.className.replace(m,""))}}function mr(L,m,w){if(m){if(qt(L.length)){Ge(L,function(b){mr(b,m,w)});return}w?Fe(L,m):Gi(L,m)}}var Nc=/([a-z\d])([A-Z])/g;function $s(L){return L.replace(Nc,"$1-$2").toLowerCase()}function Xs(L,m){return kr(L[m])?L[m]:L.dataset?L.dataset[m]:L.getAttribute("data-".concat($s(m)))}function _r(L,m,w){kr(w)?L[m]=w:L.dataset?L.dataset[m]=w:L.setAttribute("data-".concat($s(m)),w)}function Ys(L,m){if(kr(L[m]))try{delete L[m]}catch(w){L[m]=void 0}else if(L.dataset)try{delete L.dataset[m]}catch(w){L.dataset[m]=void 0}else L.removeAttribute("data-".concat($s(m)))}var qn=/\s\s*/,fn=function(){var L=!1;if(st){var m=!1,w=function(){},b=Object.defineProperty({},"once",{get:function(){return L=!0,m},set:function(M){m=M}});ft.addEventListener("test",w,b),ft.removeEventListener("test",w,b)}return L}();function Di(L,m,w){var b=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},z=w;m.trim().split(qn).forEach(function(M){if(!fn){var W=L.listeners;W&&W[M]&&W[M][w]&&(z=W[M][w],delete W[M][w],Object.keys(W[M]).length===0&&delete W[M],Object.keys(W).length===0&&delete L.listeners)}L.removeEventListener(M,z,b)})}function ye(L,m,w){var b=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},z=w;m.trim().split(qn).forEach(function(M){if(b.once&&!fn){var W=L.listeners,it=W===void 0?{}:W;z=function(){delete it[M][w],L.removeEventListener(M,z,b);for(var Tt=arguments.length,lt=new Array(Tt),ot=0;otMath.abs(w)&&(w=Lt)})}),w}function mn(L,m){var w=L.pageX,b=L.pageY,z={endX:w,endY:b};return m?z:t({startX:w,startY:b},z)}function Oa(L){var m=0,w=0,b=0;return Ge(L,function(z){var M=z.startX,W=z.startY;m+=M,w+=W,b+=1}),m/=b,w/=b,{pageX:m,pageY:w}}function gr(L){var m=L.aspectRatio,w=L.height,b=L.width,z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"contain",M=Ye(b),W=Ye(w);if(M&&W){var it=w*m;z==="contain"&&it>b||z==="cover"&&it90?{width:xt,height:it}:{width:it,height:xt}}function Pa(L,m,w,b){var z=m.aspectRatio,M=m.naturalWidth,W=m.naturalHeight,it=m.rotate,xt=it===void 0?0:it,Tt=m.scaleX,lt=Tt===void 0?1:Tt,ot=m.scaleY,Lt=ot===void 0?1:ot,ge=w.aspectRatio,de=w.naturalWidth,Be=w.naturalHeight,Ae=b.fillColor,Ke=Ae===void 0?"transparent":Ae,We=b.imageSmoothingEnabled,Re=We===void 0?!0:We,rr=b.imageSmoothingQuality,Si=rr===void 0?"low":rr,Rt=b.maxWidth,Se=Rt===void 0?1/0:Rt,ti=b.maxHeight,Ii=ti===void 0?1/0:ti,He=b.minWidth,si=He===void 0?0:He,br=b.minHeight,Ki=br===void 0?0:br,Ni=document.createElement("canvas"),ci=Ni.getContext("2d"),vr=gr({aspectRatio:ge,width:Se,height:Ii}),yr=gr({aspectRatio:ge,width:si,height:Ki},"cover"),Kr=Math.min(vr.width,Math.max(yr.width,de)),bn=Math.min(vr.height,Math.max(yr.height,Be)),Qs=gr({aspectRatio:z,width:Se,height:Ii}),Jr=gr({aspectRatio:z,width:si,height:Ki},"cover"),za=Math.min(Qs.width,Math.max(Jr.width,M)),Wa=Math.min(Qs.height,Math.max(Jr.height,W)),Wi=[-za/2,-Wa/2,za,Wa];return Ni.width=er(Kr),Ni.height=er(bn),ci.fillStyle=Ke,ci.fillRect(0,0,Kr,bn),ci.save(),ci.translate(Kr/2,bn/2),ci.rotate(xt*Math.PI/180),ci.scale(lt,Lt),ci.imageSmoothingEnabled=Re,ci.imageSmoothingQuality=Si,ci.drawImage.apply(ci,[L].concat(D(Wi.map(function(vi){return Math.floor(er(vi))})))),ci.restore(),Ni}var Ia=String.fromCharCode;function Js(L,m,w){var b="";w+=m;for(var z=m;z0;)w.push(Ia.apply(null,Xr(z.subarray(0,b)))),z=z.subarray(b);return"data:".concat(m,";base64,").concat(btoa(w.join("")))}function ir(L){var m=new DataView(L),w;try{var b,z,M;if(m.getUint8(0)===255&&m.getUint8(1)===216)for(var W=m.byteLength,it=2;it+1=8&&(M=Tt+ot)}}}if(M){var Lt=m.getUint16(M,b),ge,de;for(de=0;de=0?M:Bt),height:Math.max(b.offsetHeight,W>=0?W:me)};this.containerData=it,pr(z,{width:it.width,height:it.height}),Fe(m,bt),Gi(z,bt)},initCanvas:function(){var m=this.containerData,w=this.imageData,b=this.options.viewMode,z=Math.abs(w.rotate)%180===90,M=z?w.naturalHeight:w.naturalWidth,W=z?w.naturalWidth:w.naturalHeight,it=M/W,xt=m.width,Tt=m.height;m.height*it>m.width?b===3?xt=m.height*it:Tt=m.width/it:b===3?Tt=m.width/it:xt=m.height*it;var lt={aspectRatio:it,naturalWidth:M,naturalHeight:W,width:xt,height:Tt};this.canvasData=lt,this.limited=b===1||b===2,this.limitCanvas(!0,!0),lt.width=Math.min(Math.max(lt.width,lt.minWidth),lt.maxWidth),lt.height=Math.min(Math.max(lt.height,lt.minHeight),lt.maxHeight),lt.left=(m.width-lt.width)/2,lt.top=(m.height-lt.height)/2,lt.oldLeft=lt.left,lt.oldTop=lt.top,this.initialCanvasData=Ne({},lt)},limitCanvas:function(m,w){var b=this.options,z=this.containerData,M=this.canvasData,W=this.cropBoxData,it=b.viewMode,xt=M.aspectRatio,Tt=this.cropped&&W;if(m){var lt=Number(b.minCanvasWidth)||0,ot=Number(b.minCanvasHeight)||0;it>1?(lt=Math.max(lt,z.width),ot=Math.max(ot,z.height),it===3&&(ot*xt>lt?lt=ot*xt:ot=lt/xt)):it>0&&(lt?lt=Math.max(lt,Tt?W.width:0):ot?ot=Math.max(ot,Tt?W.height:0):Tt&&(lt=W.width,ot=W.height,ot*xt>lt?lt=ot*xt:ot=lt/xt));var Lt=gr({aspectRatio:xt,width:lt,height:ot});lt=Lt.width,ot=Lt.height,M.minWidth=lt,M.minHeight=ot,M.maxWidth=1/0,M.maxHeight=1/0}if(w)if(it>(Tt?0:1)){var ge=z.width-M.width,de=z.height-M.height;M.minLeft=Math.min(0,ge),M.minTop=Math.min(0,de),M.maxLeft=Math.max(0,ge),M.maxTop=Math.max(0,de),Tt&&this.limited&&(M.minLeft=Math.min(W.left,W.left+(W.width-M.width)),M.minTop=Math.min(W.top,W.top+(W.height-M.height)),M.maxLeft=W.left,M.maxTop=W.top,it===2&&(M.width>=z.width&&(M.minLeft=Math.min(0,ge),M.maxLeft=Math.max(0,ge)),M.height>=z.height&&(M.minTop=Math.min(0,de),M.maxTop=Math.max(0,de))))}else M.minLeft=-M.width,M.minTop=-M.height,M.maxLeft=z.width,M.maxTop=z.height},renderCanvas:function(m,w){var b=this.canvasData,z=this.imageData;if(w){var M=Bc({width:z.naturalWidth*Math.abs(z.scaleX||1),height:z.naturalHeight*Math.abs(z.scaleY||1),degree:z.rotate||0}),W=M.width,it=M.height,xt=b.width*(W/b.naturalWidth),Tt=b.height*(it/b.naturalHeight);b.left-=(xt-b.width)/2,b.top-=(Tt-b.height)/2,b.width=xt,b.height=Tt,b.aspectRatio=W/it,b.naturalWidth=W,b.naturalHeight=it,this.limitCanvas(!0,!1)}(b.width>b.maxWidth||b.widthb.maxHeight||b.heightw.width?M.height=M.width/b:M.width=M.height*b),this.cropBoxData=M,this.limitCropBox(!0,!0),M.width=Math.min(Math.max(M.width,M.minWidth),M.maxWidth),M.height=Math.min(Math.max(M.height,M.minHeight),M.maxHeight),M.width=Math.max(M.minWidth,M.width*z),M.height=Math.max(M.minHeight,M.height*z),M.left=w.left+(w.width-M.width)/2,M.top=w.top+(w.height-M.height)/2,M.oldLeft=M.left,M.oldTop=M.top,this.initialCropBoxData=Ne({},M)},limitCropBox:function(m,w){var b=this.options,z=this.containerData,M=this.canvasData,W=this.cropBoxData,it=this.limited,xt=b.aspectRatio;if(m){var Tt=Number(b.minCropBoxWidth)||0,lt=Number(b.minCropBoxHeight)||0,ot=it?Math.min(z.width,M.width,M.width+M.left,z.width-M.left):z.width,Lt=it?Math.min(z.height,M.height,M.height+M.top,z.height-M.top):z.height;Tt=Math.min(Tt,z.width),lt=Math.min(lt,z.height),xt&&(Tt&<?lt*xt>Tt?lt=Tt/xt:Tt=lt*xt:Tt?lt=Tt/xt:lt&&(Tt=lt*xt),Lt*xt>ot?Lt=ot/xt:ot=Lt*xt),W.minWidth=Math.min(Tt,ot),W.minHeight=Math.min(lt,Lt),W.maxWidth=ot,W.maxHeight=Lt}w&&(it?(W.minLeft=Math.max(0,M.left),W.minTop=Math.max(0,M.top),W.maxLeft=Math.min(z.width,M.left+M.width)-W.width,W.maxTop=Math.min(z.height,M.top+M.height)-W.height):(W.minLeft=0,W.minTop=0,W.maxLeft=z.width-W.width,W.maxTop=z.height-W.height))},renderCropBox:function(){var m=this.options,w=this.containerData,b=this.cropBoxData;(b.width>b.maxWidth||b.widthb.maxHeight||b.height=w.width&&b.height>=w.height?gt:V),pr(this.cropBox,Ne({width:b.width,height:b.height},pn({translateX:b.left,translateY:b.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),Yr(this.element,Xe,this.getData())}},Zs={initPreview:function(){var m=this.element,w=this.crossOrigin,b=this.options.preview,z=w?this.crossOriginUrl:this.url,M=m.alt||"The image to preview",W=document.createElement("img");if(w&&(W.crossOrigin=w),W.src=z,W.alt=M,this.viewBox.appendChild(W),this.viewBoxImage=W,!!b){var it=b;typeof b=="string"?it=m.ownerDocument.querySelectorAll(b):b.querySelector&&(it=[b]),this.previews=it,Ge(it,function(xt){var Tt=document.createElement("img");_r(xt,kt,{width:xt.offsetWidth,height:xt.offsetHeight,html:xt.innerHTML}),w&&(Tt.crossOrigin=w),Tt.src=z,Tt.alt=M,Tt.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',xt.innerHTML="",xt.appendChild(Tt)})}},resetPreview:function(){Ge(this.previews,function(m){var w=Xs(m,kt);pr(m,{width:w.width,height:w.height}),m.innerHTML=w.html,Ys(m,kt)})},preview:function(){var m=this.imageData,w=this.canvasData,b=this.cropBoxData,z=b.width,M=b.height,W=m.width,it=m.height,xt=b.left-w.left-m.left,Tt=b.top-w.top-m.top;!this.cropped||this.disabled||(pr(this.viewBoxImage,Ne({width:W,height:it},pn(Ne({translateX:-xt,translateY:-Tt},m)))),Ge(this.previews,function(lt){var ot=Xs(lt,kt),Lt=ot.width,ge=ot.height,de=Lt,Be=ge,Ae=1;z&&(Ae=Lt/z,Be=M*Ae),M&&Be>ge&&(Ae=ge/M,de=z*Ae,Be=ge),pr(lt,{width:de,height:Be}),pr(lt.getElementsByTagName("img")[0],Ne({width:W*Ae,height:it*Ae},pn(Ne({translateX:-xt*Ae,translateY:-Tt*Ae},m))))}))}},Ba={bind:function(){var m=this.element,w=this.options,b=this.cropper;bi(w.cropstart)&&ye(m,P,w.cropstart),bi(w.cropmove)&&ye(m,zt,w.cropmove),bi(w.cropend)&&ye(m,di,w.cropend),bi(w.crop)&&ye(m,Xe,w.crop),bi(w.zoom)&&ye(m,gi,w.zoom),ye(b,v,this.onCropStart=this.cropStart.bind(this)),w.zoomable&&w.zoomOnWheel&&ye(b,_i,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),w.toggleDragModeOnDblclick&&ye(b,k,this.onDblclick=this.dblclick.bind(this)),ye(m.ownerDocument,he,this.onCropMove=this.cropMove.bind(this)),ye(m.ownerDocument,Pe,this.onCropEnd=this.cropEnd.bind(this)),w.responsive&&ye(window,ni,this.onResize=this.resize.bind(this))},unbind:function(){var m=this.element,w=this.options,b=this.cropper;bi(w.cropstart)&&Di(m,P,w.cropstart),bi(w.cropmove)&&Di(m,zt,w.cropmove),bi(w.cropend)&&Di(m,di,w.cropend),bi(w.crop)&&Di(m,Xe,w.crop),bi(w.zoom)&&Di(m,gi,w.zoom),Di(b,v,this.onCropStart),w.zoomable&&w.zoomOnWheel&&Di(b,_i,this.onWheel,{passive:!1,capture:!0}),w.toggleDragModeOnDblclick&&Di(b,k,this.onDblclick),Di(m.ownerDocument,he,this.onCropMove),Di(m.ownerDocument,Pe,this.onCropEnd),w.responsive&&Di(window,ni,this.onResize)}},Dr={resize:function(){if(!this.disabled){var m=this.options,w=this.container,b=this.containerData,z=w.offsetWidth/b.width,M=w.offsetHeight/b.height,W=Math.abs(z-1)>Math.abs(M-1)?z:M;if(W!==1){var it,xt;m.restore&&(it=this.getCanvasData(),xt=this.getCropBoxData()),this.render(),m.restore&&(this.setCanvasData(Ge(it,function(Tt,lt){it[lt]=Tt*W})),this.setCropBoxData(Ge(xt,function(Tt,lt){xt[lt]=Tt*W})))}}},dblclick:function(){this.disabled||this.options.dragMode===Kt||this.setDragMode(Lr(this.dragBox,F)?Wt:Nt)},wheel:function(m){var w=this,b=Number(this.options.wheelZoomRatio)||.1,z=1;this.disabled||(m.preventDefault(),!this.wheeling&&(this.wheeling=!0,setTimeout(function(){w.wheeling=!1},50),m.deltaY?z=m.deltaY>0?1:-1:m.wheelDelta?z=-m.wheelDelta/120:m.detail&&(z=m.detail>0?1:-1),this.zoom(-z*b,m)))},cropStart:function(m){var w=m.buttons,b=m.button;if(!(this.disabled||(m.type==="mousedown"||m.type==="pointerdown"&&m.pointerType==="mouse")&&(qt(w)&&w!==1||qt(b)&&b!==0||m.ctrlKey))){var z=this.options,M=this.pointers,W;m.changedTouches?Ge(m.changedTouches,function(it){M[it.identifier]=mn(it)}):M[m.pointerId||0]=mn(m),Object.keys(M).length>1&&z.zoomable&&z.zoomOnTouch?W=dt:W=Xs(m.target,et),hr.test(W)&&Yr(this.element,P,{originalEvent:m,action:W})!==!1&&(m.preventDefault(),this.action=W,this.cropping=!1,W===K&&(this.cropping=!0,Fe(this.dragBox,N)))}},cropMove:function(m){var w=this.action;if(!(this.disabled||!w)){var b=this.pointers;m.preventDefault(),Yr(this.element,zt,{originalEvent:m,action:w})!==!1&&(m.changedTouches?Ge(m.changedTouches,function(z){Ne(b[z.identifier]||{},mn(z,!0))}):Ne(b[m.pointerId||0]||{},mn(m,!0)),this.change(m))}},cropEnd:function(m){if(!this.disabled){var w=this.action,b=this.pointers;m.changedTouches?Ge(m.changedTouches,function(z){delete b[z.identifier]}):delete b[m.pointerId||0],w&&(m.preventDefault(),Object.keys(b).length||(this.action=""),this.cropping&&(this.cropping=!1,mr(this.dragBox,N,this.cropped&&this.options.modal)),Yr(this.element,di,{originalEvent:m,action:w}))}}},ja={change:function(m){var w=this.options,b=this.canvasData,z=this.containerData,M=this.cropBoxData,W=this.pointers,it=this.action,xt=w.aspectRatio,Tt=M.left,lt=M.top,ot=M.width,Lt=M.height,ge=Tt+ot,de=lt+Lt,Be=0,Ae=0,Ke=z.width,We=z.height,Re=!0,rr;!xt&&m.shiftKey&&(xt=ot&&Lt?ot/Lt:1),this.limited&&(Be=M.minLeft,Ae=M.minTop,Ke=Be+Math.min(z.width,b.width,b.left+b.width),We=Ae+Math.min(z.height,b.height,b.top+b.height));var Si=W[Object.keys(W)[0]],Rt={x:Si.endX-Si.startX,y:Si.endY-Si.startY},Se=function(Ii){switch(Ii){case Et:ge+Rt.x>Ke&&(Rt.x=Ke-ge);break;case Ot:Tt+Rt.xWe&&(Rt.y=We-de);break}};switch(it){case V:Tt+=Rt.x,lt+=Rt.y;break;case Et:if(Rt.x>=0&&(ge>=Ke||xt&&(lt<=Ae||de>=We))){Re=!1;break}Se(Et),ot+=Rt.x,ot<0&&(it=Ot,ot=-ot,Tt-=ot),xt&&(Lt=ot/xt,lt+=(M.height-Lt)/2);break;case At:if(Rt.y<=0&&(lt<=Ae||xt&&(Tt<=Be||ge>=Ke))){Re=!1;break}Se(At),Lt-=Rt.y,lt+=Rt.y,Lt<0&&(it=Qt,Lt=-Lt,lt-=Lt),xt&&(ot=Lt*xt,Tt+=(M.width-ot)/2);break;case Ot:if(Rt.x<=0&&(Tt<=Be||xt&&(lt<=Ae||de>=We))){Re=!1;break}Se(Ot),ot-=Rt.x,Tt+=Rt.x,ot<0&&(it=Et,ot=-ot,Tt-=ot),xt&&(Lt=ot/xt,lt+=(M.height-Lt)/2);break;case Qt:if(Rt.y>=0&&(de>=We||xt&&(Tt<=Be||ge>=Ke))){Re=!1;break}Se(Qt),Lt+=Rt.y,Lt<0&&(it=At,Lt=-Lt,lt-=Lt),xt&&(ot=Lt*xt,Tt+=(M.width-ot)/2);break;case Te:if(xt){if(Rt.y<=0&&(lt<=Ae||ge>=Ke)){Re=!1;break}Se(At),Lt-=Rt.y,lt+=Rt.y,ot=Lt*xt}else Se(At),Se(Et),Rt.x>=0?geAe&&(Lt-=Rt.y,lt+=Rt.y):(Lt-=Rt.y,lt+=Rt.y);ot<0&&Lt<0?(it=C,Lt=-Lt,ot=-ot,lt-=Lt,Tt-=ot):ot<0?(it=xe,ot=-ot,Tt-=ot):Lt<0&&(it=G,Lt=-Lt,lt-=Lt);break;case xe:if(xt){if(Rt.y<=0&&(lt<=Ae||Tt<=Be)){Re=!1;break}Se(At),Lt-=Rt.y,lt+=Rt.y,ot=Lt*xt,Tt+=M.width-ot}else Se(At),Se(Ot),Rt.x<=0?Tt>Be?(ot-=Rt.x,Tt+=Rt.x):Rt.y<=0&<<=Ae&&(Re=!1):(ot-=Rt.x,Tt+=Rt.x),Rt.y<=0?lt>Ae&&(Lt-=Rt.y,lt+=Rt.y):(Lt-=Rt.y,lt+=Rt.y);ot<0&&Lt<0?(it=G,Lt=-Lt,ot=-ot,lt-=Lt,Tt-=ot):ot<0?(it=Te,ot=-ot,Tt-=ot):Lt<0&&(it=C,Lt=-Lt,lt-=Lt);break;case C:if(xt){if(Rt.x<=0&&(Tt<=Be||de>=We)){Re=!1;break}Se(Ot),ot-=Rt.x,Tt+=Rt.x,Lt=ot/xt}else Se(Qt),Se(Ot),Rt.x<=0?Tt>Be?(ot-=Rt.x,Tt+=Rt.x):Rt.y>=0&&de>=We&&(Re=!1):(ot-=Rt.x,Tt+=Rt.x),Rt.y>=0?de=0&&(ge>=Ke||de>=We)){Re=!1;break}Se(Et),ot+=Rt.x,Lt=ot/xt}else Se(Qt),Se(Et),Rt.x>=0?ge=0&&de>=We&&(Re=!1):ot+=Rt.x,Rt.y>=0?de0?it=Rt.y>0?G:Te:Rt.x<0&&(Tt-=ot,it=Rt.y>0?C:xe),Rt.y<0&&(lt-=Lt),this.cropped||(Gi(this.cropBox,bt),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}Re&&(M.width=ot,M.height=Lt,M.left=Tt,M.top=lt,this.action=it,this.renderCropBox()),Ge(W,function(ti){ti.startX=ti.endX,ti.startY=ti.endY})}},gn={crop:function(){return this.ready&&!this.cropped&&!this.disabled&&(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&Fe(this.dragBox,N),Gi(this.cropBox,bt),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=Ne({},this.initialImageData),this.canvasData=Ne({},this.initialCanvasData),this.cropBoxData=Ne({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(Ne(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),Gi(this.dragBox,N),Fe(this.cropBox,bt)),this},replace:function(m){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!this.disabled&&m&&(this.isImg&&(this.element.src=m),w?(this.url=m,this.image.src=m,this.ready&&(this.viewBoxImage.src=m,Ge(this.previews,function(b){b.getElementsByTagName("img")[0].src=m}))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(m))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,Gi(this.cropper,St)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,Fe(this.cropper,St)),this},destroy:function(){var m=this.element;return m[I]?(m[I]=void 0,this.isImg&&this.replaced&&(m.src=this.originalUrl),this.uncreate(),this):this},move:function(m){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:m,b=this.canvasData,z=b.left,M=b.top;return this.moveTo($r(m)?m:z+Number(m),$r(w)?w:M+Number(w))},moveTo:function(m){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:m,b=this.canvasData,z=!1;return m=Number(m),w=Number(w),this.ready&&!this.disabled&&this.options.movable&&(qt(m)&&(b.left=m,z=!0),qt(w)&&(b.top=w,z=!0),z&&this.renderCanvas(!0)),this},zoom:function(m,w){var b=this.canvasData;return m=Number(m),m<0?m=1/(1-m):m=1+m,this.zoomTo(b.width*m/b.naturalWidth,null,w)},zoomTo:function(m,w,b){var z=this.options,M=this.canvasData,W=M.width,it=M.height,xt=M.naturalWidth,Tt=M.naturalHeight;if(m=Number(m),m>=0&&this.ready&&!this.disabled&&z.zoomable){var lt=xt*m,ot=Tt*m;if(Yr(this.element,gi,{ratio:m,oldRatio:W/xt,originalEvent:b})===!1)return this;if(b){var Lt=this.pointers,ge=zn(this.cropper),de=Lt&&Object.keys(Lt).length?Oa(Lt):{pageX:b.pageX,pageY:b.pageY};M.left-=(lt-W)*((de.pageX-ge.left-M.left)/W),M.top-=(ot-it)*((de.pageY-ge.top-M.top)/it)}else fr(w)&&qt(w.x)&&qt(w.y)?(M.left-=(lt-W)*((w.x-M.left)/W),M.top-=(ot-it)*((w.y-M.top)/it)):(M.left-=(lt-W)/2,M.top-=(ot-it)/2);M.width=lt,M.height=ot,this.renderCanvas(!0)}return this},rotate:function(m){return this.rotateTo((this.imageData.rotate||0)+Number(m))},rotateTo:function(m){return m=Number(m),qt(m)&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=m%360,this.renderCanvas(!0,!0)),this},scaleX:function(m){var w=this.imageData.scaleY;return this.scale(m,qt(w)?w:1)},scaleY:function(m){var w=this.imageData.scaleX;return this.scale(qt(w)?w:1,m)},scale:function(m){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:m,b=this.imageData,z=!1;return m=Number(m),w=Number(w),this.ready&&!this.disabled&&this.options.scalable&&(qt(m)&&(b.scaleX=m,z=!0),qt(w)&&(b.scaleY=w,z=!0),z&&this.renderCanvas(!0,!0)),this},getData:function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,w=this.options,b=this.imageData,z=this.canvasData,M=this.cropBoxData,W;if(this.ready&&this.cropped){W={x:M.left-z.left,y:M.top-z.top,width:M.width,height:M.height};var it=b.width/b.naturalWidth;if(Ge(W,function(lt,ot){W[ot]=lt/it}),m){var xt=Math.round(W.y+W.height),Tt=Math.round(W.x+W.width);W.x=Math.round(W.x),W.y=Math.round(W.y),W.width=Tt-W.x,W.height=xt-W.y}}else W={x:0,y:0,width:0,height:0};return w.rotatable&&(W.rotate=b.rotate||0),w.scalable&&(W.scaleX=b.scaleX||1,W.scaleY=b.scaleY||1),W},setData:function(m){var w=this.options,b=this.imageData,z=this.canvasData,M={};if(this.ready&&!this.disabled&&fr(m)){var W=!1;w.rotatable&&qt(m.rotate)&&m.rotate!==b.rotate&&(b.rotate=m.rotate,W=!0),w.scalable&&(qt(m.scaleX)&&m.scaleX!==b.scaleX&&(b.scaleX=m.scaleX,W=!0),qt(m.scaleY)&&m.scaleY!==b.scaleY&&(b.scaleY=m.scaleY,W=!0)),W&&this.renderCanvas(!0,!0);var it=b.width/b.naturalWidth;qt(m.x)&&(M.left=m.x*it+z.left),qt(m.y)&&(M.top=m.y*it+z.top),qt(m.width)&&(M.width=m.width*it),qt(m.height)&&(M.height=m.height*it),this.setCropBoxData(M)}return this},getContainerData:function(){return this.ready?Ne({},this.containerData):{}},getImageData:function(){return this.sized?Ne({},this.imageData):{}},getCanvasData:function(){var m=this.canvasData,w={};return this.ready&&Ge(["left","top","width","height","naturalWidth","naturalHeight"],function(b){w[b]=m[b]}),w},setCanvasData:function(m){var w=this.canvasData,b=w.aspectRatio;return this.ready&&!this.disabled&&fr(m)&&(qt(m.left)&&(w.left=m.left),qt(m.top)&&(w.top=m.top),qt(m.width)?(w.width=m.width,w.height=m.width/b):qt(m.height)&&(w.height=m.height,w.width=m.height*b),this.renderCanvas(!0)),this},getCropBoxData:function(){var m=this.cropBoxData,w;return this.ready&&this.cropped&&(w={left:m.left,top:m.top,width:m.width,height:m.height}),w||{}},setCropBoxData:function(m){var w=this.cropBoxData,b=this.options.aspectRatio,z,M;return this.ready&&this.cropped&&!this.disabled&&fr(m)&&(qt(m.left)&&(w.left=m.left),qt(m.top)&&(w.top=m.top),qt(m.width)&&m.width!==w.width&&(z=!0,w.width=m.width),qt(m.height)&&m.height!==w.height&&(M=!0,w.height=m.height),b&&(z?w.height=w.width/b:M&&(w.width=w.height*b)),this.renderCropBox()),this},getCroppedCanvas:function(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var w=this.canvasData,b=Pa(this.image,this.imageData,w,m);if(!this.cropped)return b;var z=this.getData(m.rounded),M=z.x,W=z.y,it=z.width,xt=z.height,Tt=b.width/Math.floor(w.naturalWidth);Tt!==1&&(M*=Tt,W*=Tt,it*=Tt,xt*=Tt);var lt=it/xt,ot=gr({aspectRatio:lt,width:m.maxWidth||1/0,height:m.maxHeight||1/0}),Lt=gr({aspectRatio:lt,width:m.minWidth||0,height:m.minHeight||0},"cover"),ge=gr({aspectRatio:lt,width:m.width||(Tt!==1?b.width:it),height:m.height||(Tt!==1?b.height:xt)}),de=ge.width,Be=ge.height;de=Math.min(ot.width,Math.max(Lt.width,de)),Be=Math.min(ot.height,Math.max(Lt.height,Be));var Ae=document.createElement("canvas"),Ke=Ae.getContext("2d");Ae.width=er(de),Ae.height=er(Be),Ke.fillStyle=m.fillColor||"transparent",Ke.fillRect(0,0,de,Be);var We=m.imageSmoothingEnabled,Re=We===void 0?!0:We,rr=m.imageSmoothingQuality;Ke.imageSmoothingEnabled=Re,rr&&(Ke.imageSmoothingQuality=rr);var Si=b.width,Rt=b.height,Se=M,ti=W,Ii,He,si,br,Ki,Ni;Se<=-it||Se>Si?(Se=0,Ii=0,si=0,Ki=0):Se<=0?(si=-Se,Se=0,Ii=Math.min(Si,it+Se),Ki=Ii):Se<=Si&&(si=0,Ii=Math.min(it,Si-Se),Ki=Ii),Ii<=0||ti<=-xt||ti>Rt?(ti=0,He=0,br=0,Ni=0):ti<=0?(br=-ti,ti=0,He=Math.min(Rt,xt+ti),Ni=He):ti<=Rt&&(br=0,He=Math.min(xt,Rt-ti),Ni=He);var ci=[Se,ti,Ii,He];if(Ki>0&&Ni>0){var vr=de/it;ci.push(si*vr,br*vr,Ki*vr,Ni*vr)}return Ke.drawImage.apply(Ke,[b].concat(D(ci.map(function(yr){return Math.floor(er(yr))})))),Ae},setAspectRatio:function(m){var w=this.options;return!this.disabled&&!$r(m)&&(w.aspectRatio=Math.max(0,m)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(m){var w=this.options,b=this.dragBox,z=this.face;if(this.ready&&!this.disabled){var M=m===Nt,W=w.movable&&m===Wt;m=M||W?m:Kt,w.dragMode=m,_r(b,et,m),mr(b,F,M),mr(b,Y,W),w.cropBoxMovable||(_r(z,et,m),mr(z,F,M),mr(z,Y,W))}return this}},Ha=ft.Cropper,qa=function(){function L(m){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(u(this,L),!m||!nt.test(m.tagName))throw new Error("The first argument is required and must be an or element.");this.element=m,this.options=Ne({},ce,fr(w)&&w),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}return y(L,[{key:"init",value:function(){var w=this.element,b=w.tagName.toLowerCase(),z;if(!w[I]){if(w[I]=this,b==="img"){if(this.isImg=!0,z=w.getAttribute("src")||"",this.originalUrl=z,!z)return;z=w.src}else b==="canvas"&&window.HTMLCanvasElement&&(z=w.toDataURL());this.load(z)}}},{key:"load",value:function(w){var b=this;if(w){this.url=w,this.imageData={};var z=this.element,M=this.options;if(!M.rotatable&&!M.scalable&&(M.checkOrientation=!1),!M.checkOrientation||!window.ArrayBuffer){this.clone();return}if(dr.test(w)){B.test(w)?this.read(Gr(w)):this.clone();return}var W=new XMLHttpRequest,it=this.clone.bind(this);this.reloading=!0,this.xhr=W,W.onabort=it,W.onerror=it,W.ontimeout=it,W.onprogress=function(){W.getResponseHeader("content-type")!==zi&&W.abort()},W.onload=function(){b.read(W.response)},W.onloadend=function(){b.reloading=!1,b.xhr=null},M.checkCrossOrigin&&Ks(w)&&z.crossOrigin&&(w=Ra(w)),W.open("GET",w,!0),W.responseType="arraybuffer",W.withCredentials=z.crossOrigin==="use-credentials",W.send()}}},{key:"read",value:function(w){var b=this.options,z=this.imageData,M=ir(w),W=0,it=1,xt=1;if(M>1){this.url=Ce(w,zi);var Tt=Wn(M);W=Tt.rotate,it=Tt.scaleX,xt=Tt.scaleY}b.rotatable&&(z.rotate=W),b.scalable&&(z.scaleX=it,z.scaleY=xt),this.clone()}},{key:"clone",value:function(){var w=this.element,b=this.url,z=w.crossOrigin,M=b;this.options.checkCrossOrigin&&Ks(b)&&(z||(z="anonymous"),M=Ra(b)),this.crossOrigin=z,this.crossOriginUrl=M;var W=document.createElement("img");z&&(W.crossOrigin=z),W.src=M||b,W.alt=w.alt||"The image to crop",this.image=W,W.onload=this.start.bind(this),W.onerror=this.stop.bind(this),Fe(W,It),w.parentNode.insertBefore(W,w.nextSibling)}},{key:"start",value:function(){var w=this,b=this.image;b.onload=null,b.onerror=null,this.sizing=!0;var z=ft.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(ft.navigator.userAgent),M=function(Tt,lt){Ne(w.imageData,{naturalWidth:Tt,naturalHeight:lt,aspectRatio:Tt/lt}),w.initialImageData=Ne({},w.imageData),w.sizing=!1,w.sized=!0,w.build()};if(b.naturalWidth&&!z){M(b.naturalWidth,b.naturalHeight);return}var W=document.createElement("img"),it=document.body||document.documentElement;this.sizingImage=W,W.onload=function(){M(W.width,W.height),z||it.removeChild(W)},W.src=b.src,z||(W.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",it.appendChild(W))}},{key:"stop",value:function(){var w=this.image;w.onload=null,w.onerror=null,w.parentNode.removeChild(w),this.image=null}},{key:"build",value:function(){if(!(!this.sized||this.ready)){var w=this.element,b=this.options,z=this.image,M=w.parentNode,W=document.createElement("div");W.innerHTML=Yt;var it=W.querySelector(".".concat(I,"-container")),xt=it.querySelector(".".concat(I,"-canvas")),Tt=it.querySelector(".".concat(I,"-drag-box")),lt=it.querySelector(".".concat(I,"-crop-box")),ot=lt.querySelector(".".concat(I,"-face"));this.container=M,this.cropper=it,this.canvas=xt,this.dragBox=Tt,this.cropBox=lt,this.viewBox=it.querySelector(".".concat(I,"-view-box")),this.face=ot,xt.appendChild(z),Fe(w,bt),M.insertBefore(it,w.nextSibling),Gi(z,It),this.initPreview(),this.bind(),b.initialAspectRatio=Math.max(0,b.initialAspectRatio)||NaN,b.aspectRatio=Math.max(0,b.aspectRatio)||NaN,b.viewMode=Math.max(0,Math.min(3,Math.round(b.viewMode)))||0,Fe(lt,bt),b.guides||Fe(lt.getElementsByClassName("".concat(I,"-dashed")),bt),b.center||Fe(lt.getElementsByClassName("".concat(I,"-center")),bt),b.background&&Fe(it,"".concat(I,"-bg")),b.highlight||Fe(ot,E),b.cropBoxMovable&&(Fe(ot,Y),_r(ot,et,V)),b.cropBoxResizable||(Fe(lt.getElementsByClassName("".concat(I,"-line")),bt),Fe(lt.getElementsByClassName("".concat(I,"-point")),bt)),this.render(),this.ready=!0,this.setDragMode(b.dragMode),b.autoCrop&&this.crop(),this.setData(b.data),bi(b.ready)&&ye(w,Ie,b.ready,{once:!0}),Yr(w,Ie)}}},{key:"unbuild",value:function(){if(this.ready){this.ready=!1,this.unbind(),this.resetPreview();var w=this.cropper.parentNode;w&&w.removeChild(this.cropper),Gi(this.element,bt)}}},{key:"uncreate",value:function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?(this.xhr.onabort=null,this.xhr.abort()):this.image&&this.stop()}}],[{key:"noConflict",value:function(){return window.Cropper=Ha,L}},{key:"setDefaults",value:function(w){Ne(ce,fr(w)&&w)}}])}();return Ne(qa.prototype,Fa,Zs,Ba,Dr,ja,gn),qa})});var Fg=ar((Ig,Ng)=>{(function(i){typeof define=="function"&&define.amd?define(i):typeof Ig=="object"?Ng.exports=i():i()})(function(){"use strict";var i=typeof window!="undefined"?window:this,t=i.Glider=function(s,l){var u=this;if(s._glider)return s._glider;if(u.ele=s,u.ele.classList.add("glider"),u.ele._glider=u,u.opt=Object.assign({},{slidesToScroll:1,slidesToShow:1,resizeLock:!0,duration:.5,passiveListeners:!1,easing:function(f,y,T,D,H){return D*(y/=H)*y+T}},l),u.animate_id=u.page=u.slide=0,u.arrows={},u._opt=u.opt,u.opt.skipTrack)u.track=u.ele.children[0];else for(u.track=document.createElement("div"),u.ele.appendChild(u.track);u.ele.children.length!==1;)u.track.appendChild(u.ele.children[0]);u.track.classList.add("glider-track"),u.init(),u.resize=u.init.bind(u,!0),u.event(u.ele,"add",{scroll:u.updateControls.bind(u)},{passive:u.opt.passiveListeners}),u.event(i,"add",{resize:u.resize})},r=t.prototype;return r.init=function(s,l){var u=this,f=0,y=0;u.slides=u.track.children,[].forEach.call(u.slides,function(H,Z){H.classList.add("glider-slide"),H.setAttribute("data-gslide",Z)}),u.containerWidth=u.ele.clientWidth;var T=u.settingsBreakpoint();if(l||(l=T),u.opt.slidesToShow==="auto"||typeof u.opt._autoSlide!="undefined"){var D=u.containerWidth/u.opt.itemWidth;u.opt._autoSlide=u.opt.slidesToShow=u.opt.exactWidth?D:Math.max(1,Math.floor(D))}u.opt.slidesToScroll==="auto"&&(u.opt.slidesToScroll=Math.floor(u.opt.slidesToShow)),u.itemWidth=u.opt.exactWidth?u.opt.itemWidth:u.containerWidth/u.opt.slidesToShow,[].forEach.call(u.slides,function(H){H.style.height="auto",H.style.width=u.itemWidth+"px",f+=u.itemWidth,y=Math.max(H.offsetHeight,y)}),u.track.style.width=f+"px",u.trackWidth=f,u.isDrag=!1,u.preventClick=!1,u.move=!1,u.opt.resizeLock&&u.scrollTo(u.slide*u.itemWidth,0),(T||l)&&(u.bindArrows(),u.buildDots(),u.bindDrag()),u.updateControls(),u.emit(s?"refresh":"loaded")},r.bindDrag=function(){var s=this;s.mouse=s.mouse||s.handleMouse.bind(s);var l=function(){s.mouseDown=void 0,s.ele.classList.remove("drag"),s.isDrag&&(s.preventClick=!0),s.isDrag=!1};let u=function(){s.move=!0};var f={mouseup:l,mouseleave:l,mousedown:function(y){y.preventDefault(),y.stopPropagation(),s.mouseDown=y.clientX,s.ele.classList.add("drag"),s.move=!1,setTimeout(u,300)},touchstart:function(y){s.ele.classList.add("drag"),s.move=!1,setTimeout(u,300)},mousemove:s.mouse,click:function(y){s.preventClick&&s.move&&(y.preventDefault(),y.stopPropagation()),s.preventClick=!1,s.move=!1}};s.ele.classList.toggle("draggable",s.opt.draggable===!0),s.event(s.ele,"remove",f),s.opt.draggable&&s.event(s.ele,"add",f,{passive:s.opt.passiveListeners})},r.buildDots=function(){var s=this;if(!s.opt.dots){s.dots&&(s.dots.innerHTML="");return}if(typeof s.opt.dots=="string"?s.dots=document.querySelector(s.opt.dots):s.dots=s.opt.dots,!!s.dots){s.dots.innerHTML="",s.dots.setAttribute("role","tablist"),s.dots.classList.add("glider-dots");for(var l=0;l=l.trackWidth;l.opt.rewind||(l.arrows.prev&&(l.arrows.prev.classList.toggle("disabled",l.ele.scrollLeft<=0||u),l.arrows.prev.setAttribute("aria-disabled",l.arrows.prev.classList.contains("disabled"))),l.arrows.next&&(l.arrows.next.classList.toggle("disabled",Math.ceil(l.ele.scrollLeft+l.containerWidth)>=Math.floor(l.trackWidth)||u),l.arrows.next.setAttribute("aria-disabled",l.arrows.next.classList.contains("disabled")))),l.slide=Math.round(l.ele.scrollLeft/l.itemWidth),l.page=Math.round(l.ele.scrollLeft/l.containerWidth);var f=l.slide+Math.floor(Math.floor(l.opt.slidesToShow)/2),y=Math.floor(l.opt.slidesToShow)%2?0:f+1;Math.floor(l.opt.slidesToShow)===1&&(y=0),l.ele.scrollLeft+l.containerWidth>=Math.floor(l.trackWidth)&&(l.page=l.dots?l.dots.children.length-1:0),[].forEach.call(l.slides,function(T,D){var H=T.classList,Z=H.contains("visible"),X=l.ele.scrollLeft,J=l.ele.scrollLeft+l.containerWidth,$=l.itemWidth*D,st=$+l.itemWidth;[].forEach.call(H,function(Q){/^left|right/.test(Q)&&H.remove(Q)}),H.toggle("active",l.slide===D),f===D||y&&y===D?H.add("center"):(H.remove("center"),H.add([D=Math.floor(X)&&Math.floor(st)<=Math.ceil(J);H.toggle("visible",ft),ft!==Z&&l.emit("slide-"+(ft?"visible":"hidden"),{slide:D})}),l.dots&&[].forEach.call(l.dots.children,function(T,D){T.classList.toggle("active",l.page===D)}),s&&l.opt.scrollLock&&(clearTimeout(l.scrollLock),l.scrollLock=setTimeout(function(){clearTimeout(l.scrollLock),Math.abs(l.ele.scrollLeft/l.itemWidth-l.slide)>.02&&(l.mouseDown||l.trackWidth>l.containerWidth+l.ele.scrollLeft&&l.scrollItem(l.getCurrentSlide()))},l.opt.scrollLockDelay||250))},r.getCurrentSlide=function(){var s=this;return s.round(s.ele.scrollLeft/s.itemWidth)},r.scrollItem=function(s,l,u){u&&u.preventDefault();var f=this,y=s;++f.animate_id;var T=f.slide,D;if(l===!0)s=Math.round(s*f.containerWidth/f.itemWidth),D=s*f.itemWidth;else{if(typeof s=="string"){var H=s==="prev";if(f.opt.slidesToScroll%1||f.opt.slidesToShow%1?s=f.getCurrentSlide():s=f.slide,H?s-=f.opt.slidesToScroll:s+=f.opt.slidesToScroll,f.opt.rewind){var Z=f.ele.scrollLeft;s=H&&!Z?f.slides.length:!H&&Z+f.containerWidth>=Math.floor(f.trackWidth)?0:s}}s=Math.max(Math.min(s,f.slides.length),0),f.slide=s,D=f.itemWidth*s}return f.emit("scroll-item",{prevSlide:T,slide:s}),f.scrollTo(D,f.opt.duration*Math.abs(f.ele.scrollLeft-D),function(){f.updateControls(),f.emit("animated",{value:y,type:typeof y=="string"?"arrow":l?"dot":"slide"})}),!1},r.settingsBreakpoint=function(){var s=this,l=s._opt.responsive;if(l){l.sort(function(T,D){return D.breakpoint-T.breakpoint});for(var u=0;u=f.breakpoint)return s.breakpoint!==f.breakpoint?(s.opt=Object.assign({},s._opt,f.settings),s.breakpoint=f.breakpoint,!0):!1}}var y=s.breakpoint!==0;return s.opt=Object.assign({},s._opt),s.breakpoint=0,y},r.scrollTo=function(s,l,u){var f=this,y=new Date().getTime(),T=f.animate_id,D=function(){var H=new Date().getTime()-y;f.ele.scrollLeft=f.ele.scrollLeft+(s-f.ele.scrollLeft)*f.opt.easing(0,H,0,1,l),H{(function(i,t){typeof Lc=="object"&&typeof _c!="undefined"?_c.exports=t():typeof define=="function"&&define.amd?define(t):(i=typeof globalThis!="undefined"?globalThis:i||self,i.Rails=t())})(Lc,function(){"use strict";let i="a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]",t={selector:"button[data-remote]:not([form]), button[data-confirm]:not([form])",exclude:"form button"},r="select[data-remote], input[data-remote], textarea[data-remote]",s="form:not([data-turbo=true])",l="form:not([data-turbo=true]) input[type=submit], form:not([data-turbo=true]) input[type=image], form:not([data-turbo=true]) button[type=submit], form:not([data-turbo=true]) button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])",u="input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled",f="input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled, input[data-disable]:disabled, button[data-disable]:disabled, textarea[data-disable]:disabled",y="input[name][type=file]:not([disabled])",T="a[data-disable-with], a[data-disable]",D="button[data-remote][data-disable-with], button[data-remote][data-disable]",H=null,Z=()=>{let B=document.querySelector("meta[name=csp-nonce]");return H=B&&B.content},X=()=>H||Z(),J=Element.prototype.matches||Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector,$=function(B,nt){return nt.exclude?J.call(B,nt.selector)&&!J.call(B,nt.exclude):J.call(B,nt)},st="_ujsData",ft=(B,nt)=>B[st]?B[st][nt]:void 0,Q=function(B,nt,Bt){return B[st]||(B[st]={}),B[st][nt]=Bt},R=B=>Array.prototype.slice.call(document.querySelectorAll(B)),I=function(B){var nt=!1;do{if(B.isContentEditable){nt=!0;break}B=B.parentElement}while(B);return nt},V=()=>{let B=document.querySelector("meta[name=csrf-token]");return B&&B.content},K=()=>{let B=document.querySelector("meta[name=csrf-param]");return B&&B.content},gt=B=>{let nt=V();if(nt)return B.setRequestHeader("X-CSRF-Token",nt)},dt=()=>{let B=V(),nt=K();if(B&&nt)return R('form input[name="'+nt+'"]').forEach(Bt=>Bt.value=B)},Et={"*":"*/*",text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript",script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},Ot=B=>{B=Qt(B);var nt=At(B,function(){let Bt=Te(nt.response!=null?nt.response:nt.responseText,nt.getResponseHeader("Content-Type"));return Math.floor(nt.status/100)===2?typeof B.success=="function"&&B.success(Bt,nt.statusText,nt):typeof B.error=="function"&&B.error(Bt,nt.statusText,nt),typeof B.complete=="function"?B.complete(nt,nt.statusText):void 0});if(B.beforeSend&&!B.beforeSend(nt,B))return!1;if(nt.readyState===XMLHttpRequest.OPENED)return nt.send(B.data)};var Qt=function(B){return B.url=B.url||location.href,B.type=B.type.toUpperCase(),B.type==="GET"&&B.data&&(B.url.indexOf("?")<0?B.url+="?"+B.data:B.url+="&"+B.data),B.dataType in Et||(B.dataType="*"),B.accept=Et[B.dataType],B.dataType!=="*"&&(B.accept+=", */*; q=0.01"),B},At=function(B,nt){let Bt=new XMLHttpRequest;return Bt.open(B.type,B.url,!0),Bt.setRequestHeader("Accept",B.accept),typeof B.data=="string"&&Bt.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),B.crossDomain||(Bt.setRequestHeader("X-Requested-With","XMLHttpRequest"),gt(Bt)),Bt.withCredentials=!!B.withCredentials,Bt.onreadystatechange=function(){if(Bt.readyState===XMLHttpRequest.DONE)return nt(Bt)},Bt},Te=function(B,nt){if(typeof B=="string"&&typeof nt=="string"){if(nt.match(/\bjson\b/))try{B=JSON.parse(B)}catch(Bt){}else if(nt.match(/\b(?:java|ecma)script\b/)){let Bt=document.createElement("script");Bt.setAttribute("nonce",X()),Bt.text=B,document.head.appendChild(Bt).parentNode.removeChild(Bt)}else if(nt.match(/\b(xml|html|svg)\b/)){let Bt=new DOMParser;nt=nt.replace(/;.+/,"");try{B=Bt.parseFromString(B,nt)}catch(me){}}}return B};let xe=B=>B.href,G=function(B){let nt=document.createElement("a");nt.href=location.href;let Bt=document.createElement("a");try{return Bt.href=B,!((!Bt.protocol||Bt.protocol===":")&&!Bt.host||nt.protocol+"//"+nt.host==Bt.protocol+"//"+Bt.host)}catch(me){return!0}},C,{CustomEvent:F}=window;typeof F!="function"&&(F=function(B,nt){let Bt=document.createEvent("CustomEvent");return Bt.initCustomEvent(B,nt.bubbles,nt.cancelable,nt.detail),Bt},F.prototype=window.Event.prototype,{preventDefault:C}=F.prototype,F.prototype.preventDefault=function(){let B=C.call(this);return this.cancelable&&!this.defaultPrevented&&Object.defineProperty(this,"defaultPrevented",{get(){return!0}}),B});let St=(B,nt,Bt)=>{let me=new F(nt,{bubbles:!0,cancelable:!0,detail:Bt});return B.dispatchEvent(me),!me.defaultPrevented},bt=B=>{St(B.target,"ujs:everythingStopped"),B.preventDefault(),B.stopPropagation(),B.stopImmediatePropagation()},It=(B,nt,Bt,me)=>B.addEventListener(Bt,function(ce){let{target:Yt}=ce;for(;Yt instanceof Element&&!$(Yt,nt);)Yt=Yt.parentNode;Yt instanceof Element&&me.call(Yt,ce)===!1&&(ce.preventDefault(),ce.stopPropagation())}),E=B=>Array.prototype.slice.call(B),N=(B,nt)=>{let Bt=[B];$(B,"form")&&(Bt=E(B.elements));let me=[];return Bt.forEach(function(ce){!ce.name||ce.disabled||$(ce,"fieldset[disabled] *")||($(ce,"select")?E(ce.options).forEach(function(Yt){Yt.selected&&me.push({name:ce.name,value:Yt.value})}):(ce.checked||["radio","checkbox","submit"].indexOf(ce.type)===-1)&&me.push({name:ce.name,value:ce.value}))}),nt&&me.push(nt),me.map(function(ce){return ce.name?`${encodeURIComponent(ce.name)}=${encodeURIComponent(ce.value)}`:ce}).join("&")},Y=(B,nt)=>$(B,"form")?E(B.elements).filter(Bt=>$(Bt,nt)):E(B.querySelectorAll(nt)),et=B=>function(nt){Nt(this,B)||bt(nt)},kt=(B,nt)=>window.confirm(B);var Nt=function(B,nt){let Bt,me=B.getAttribute("data-confirm");if(!me)return!0;let ce=!1;if(St(B,"confirm")){try{ce=nt.confirm(me,B)}catch(Yt){}Bt=St(B,"confirm:complete",[ce])}return ce&&Bt};let Wt=function(B){this.disabled&&bt(B)},Kt=B=>{let nt;if(B instanceof Event){if(A(B))return;nt=B.target}else nt=B;if(!I(nt)){if($(nt,T))return zt(nt);if($(nt,D)||$(nt,f))return d(nt);if($(nt,s))return p(nt)}},Xe=B=>{let nt=B instanceof Event?B.target:B;if(!I(nt)){if($(nt,T))return di(nt);if($(nt,D)||$(nt,u))return k(nt);if($(nt,s))return P(nt)}};var di=function(B){if(ft(B,"ujs:disabled"))return;let nt=B.getAttribute("data-disable-with");return nt!=null&&(Q(B,"ujs:enable-with",B.innerHTML),B.innerHTML=nt),B.addEventListener("click",bt),Q(B,"ujs:disabled",!0)},zt=function(B){let nt=ft(B,"ujs:enable-with");return nt!=null&&(B.innerHTML=nt,Q(B,"ujs:enable-with",null)),B.removeEventListener("click",bt),Q(B,"ujs:disabled",null)},P=B=>Y(B,u).forEach(k),k=function(B){if(ft(B,"ujs:disabled"))return;let nt=B.getAttribute("data-disable-with");return nt!=null&&($(B,"button")?(Q(B,"ujs:enable-with",B.innerHTML),B.innerHTML=nt):(Q(B,"ujs:enable-with",B.value),B.value=nt)),B.disabled=!0,Q(B,"ujs:disabled",!0)},p=B=>Y(B,f).forEach(nt=>d(nt)),d=function(B){let nt=ft(B,"ujs:enable-with");return nt!=null&&($(B,"button")?B.innerHTML=nt:B.value=nt,Q(B,"ujs:enable-with",null)),B.disabled=!1,Q(B,"ujs:disabled",null)},A=function(B){let nt=B.detail?B.detail[0]:void 0;return nt&&nt.getResponseHeader("X-Xhr-Redirect")};let v=B=>function(nt){let Bt=this,me=Bt.getAttribute("data-method");if(!me||I(this))return;let ce=B.href(Bt),Yt=V(),Pi=K(),qt=document.createElement("form"),Ye=``;Pi&&Yt&&!G(ce)&&(Ye+=``),Ye+='',qt.method="post",qt.action=ce,qt.target=Bt.target,qt.innerHTML=Ye,qt.style.display="none",document.body.appendChild(qt),qt.querySelector('[type="submit"]').click(),bt(nt)},he=function(B){let nt=B.getAttribute("data-remote");return nt!=null&&nt!=="false"},Pe=B=>function(nt){let Bt,me,ce,Yt=this;if(!he(Yt))return!0;if(!St(Yt,"ajax:before")||I(Yt))return St(Yt,"ajax:stopped"),!1;let Pi=Yt.getAttribute("data-with-credentials"),qt=Yt.getAttribute("data-type")||"script";if($(Yt,s)){let Ye=ft(Yt,"ujs:submit-button");me=ft(Yt,"ujs:submit-button-formmethod")||Yt.getAttribute("method")||"get",ce=ft(Yt,"ujs:submit-button-formaction")||Yt.getAttribute("action")||location.href,me.toUpperCase()==="GET"&&(ce=ce.replace(/\?.*$/,"")),Yt.enctype==="multipart/form-data"?(Bt=new FormData(Yt),Ye!=null&&Bt.append(Ye.name,Ye.value)):Bt=N(Yt,Ye),Q(Yt,"ujs:submit-button",null),Q(Yt,"ujs:submit-button-formmethod",null),Q(Yt,"ujs:submit-button-formaction",null)}else $(Yt,t)||$(Yt,r)?(me=Yt.getAttribute("data-method"),ce=Yt.getAttribute("data-url"),Bt=N(Yt,Yt.getAttribute("data-params"))):(me=Yt.getAttribute("data-method"),ce=B.href(Yt),Bt=Yt.getAttribute("data-params"));Ot({type:me||"GET",url:ce,data:Bt,dataType:qt,beforeSend(Ye,$r){return St(Yt,"ajax:beforeSend",[Ye,$r])?St(Yt,"ajax:send",[Ye]):(St(Yt,"ajax:stopped"),!1)},success(...Ye){return St(Yt,"ajax:success",Ye)},error(...Ye){return St(Yt,"ajax:error",Ye)},complete(...Ye){return St(Yt,"ajax:complete",Ye)},crossDomain:G(ce),withCredentials:Pi!=null&&Pi!=="false"}),bt(nt)},Ie=function(B){let nt=this,{form:Bt}=nt;if(Bt)return nt.name&&Q(Bt,"ujs:submit-button",{name:nt.name,value:nt.value}),Q(Bt,"ujs:formnovalidate-button",nt.formNoValidate),Q(Bt,"ujs:submit-button-formaction",nt.getAttribute("formaction")),Q(Bt,"ujs:submit-button-formmethod",nt.getAttribute("formmethod"))},ni=function(B){let nt=this,Bt=(nt.getAttribute("data-method")||"GET").toUpperCase(),me=nt.getAttribute("data-params"),Yt=(B.metaKey||B.ctrlKey)&&Bt==="GET"&&!me;(B.button!=null&&B.button!==0||Yt)&&B.stopImmediatePropagation()},_i={$:R,ajax:Ot,buttonClickSelector:t,buttonDisableSelector:D,confirm:kt,cspNonce:X,csrfToken:V,csrfParam:K,CSRFProtection:gt,delegate:It,disableElement:Xe,enableElement:Kt,fileInputSelector:y,fire:St,formElements:Y,formEnableSelector:f,formDisableSelector:u,formInputClickSelector:l,formSubmitButtonClick:Ie,formSubmitSelector:s,getData:ft,handleDisabledElement:Wt,href:xe,inputChangeSelector:r,isCrossDomain:G,linkClickSelector:i,linkDisableSelector:T,loadCSPNonce:Z,matches:$,preventInsignificantClick:ni,refreshCSRFTokens:dt,serializeElement:N,setData:Q,stopEverything:bt},gi=et(_i);_i.handleConfirm=gi;let zi=v(_i);_i.handleMethod=zi;let hr=Pe(_i);_i.handleRemote=hr;let dr=function(){if(window._rails_loaded)throw new Error("rails-ujs has already been loaded!");return window.addEventListener("pageshow",function(){R(f).forEach(function(B){ft(B,"ujs:disabled")&&Kt(B)}),R(T).forEach(function(B){ft(B,"ujs:disabled")&&Kt(B)})}),It(document,T,"ajax:complete",Kt),It(document,T,"ajax:stopped",Kt),It(document,D,"ajax:complete",Kt),It(document,D,"ajax:stopped",Kt),It(document,i,"click",ni),It(document,i,"click",Wt),It(document,i,"click",gi),It(document,i,"click",Xe),It(document,i,"click",hr),It(document,i,"click",zi),It(document,t,"click",ni),It(document,t,"click",Wt),It(document,t,"click",gi),It(document,t,"click",Xe),It(document,t,"click",hr),It(document,r,"change",Wt),It(document,r,"change",gi),It(document,r,"change",hr),It(document,s,"submit",Wt),It(document,s,"submit",gi),It(document,s,"submit",hr),It(document,s,"submit",B=>setTimeout(()=>Xe(B),13)),It(document,s,"ajax:send",Xe),It(document,s,"ajax:complete",Kt),It(document,l,"click",ni),It(document,l,"click",Wt),It(document,l,"click",gi),It(document,l,"click",Ie),document.addEventListener("DOMContentLoaded",dt),document.addEventListener("DOMContentLoaded",Z),window._rails_loaded=!0};if(_i.start=dr,typeof jQuery!="undefined"&&jQuery&&jQuery.ajax){if(jQuery.rails)throw new Error("If you load both jquery_ujs and rails-ujs, use rails-ujs only.");jQuery.rails=_i,jQuery.ajaxPrefilter(function(B,nt,Bt){if(!B.crossDomain)return gt(Bt)})}return typeof Lc!="object"&&typeof _c=="undefined"&&(window.Rails=_i,St(document,"rails:attachBindings")&&dr()),_i})});var zg=ar((Ad,Sd)=>{(function(i,t){typeof Ad=="object"&&typeof Sd!="undefined"?Sd.exports=t():typeof define=="function"&&define.amd?define(t):i.Macy=t()})(Ad,function(){"use strict";function i(E,N){var Y=void 0;return function(){Y&&clearTimeout(Y),Y=setTimeout(E,N)}}function t(E,N){for(var Y=E.length,et=Y,kt=[];Y--;)kt.push(N(E[et-Y-1]));return kt}function r(E,N){var Y=arguments.length>2&&arguments[2]!==void 0&&arguments[2];if(window.Promise)return K(E,N,Y);E.recalculate(!0,!0)}function s(E){for(var N=E.options,Y=E.responsiveOptions,et=E.keys,kt=E.docWidth,Nt=void 0,Wt=0;Wt=Kt&&(Nt=N.breakAt[Kt],Te(Nt,Y))}return Y}function l(E){for(var N=E.options,Y=E.responsiveOptions,et=E.keys,kt=E.docWidth,Nt=void 0,Wt=et.length-1;Wt>=0;Wt--){var Kt=parseInt(et[Wt],10);kt<=Kt&&(Nt=N.breakAt[Kt],Te(Nt,Y))}return Y}function u(E){var N=E.useContainerForBreakpoints?E.container.clientWidth:window.innerWidth,Y={columns:E.columns};At(E.margin)?Y.margin={x:E.margin.x,y:E.margin.y}:Y.margin={x:E.margin,y:E.margin};var et=Object.keys(E.breakAt);return E.mobileFirst?s({options:E,responsiveOptions:Y,keys:et,docWidth:N}):l({options:E,responsiveOptions:Y,keys:et,docWidth:N})}function f(E){return u(E).columns}function y(E){return u(E).margin}function T(E){var N=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],Y=f(E),et=y(E).x,kt=100/Y;if(!N)return kt;if(Y===1)return"100%";var Nt="px";if(typeof et=="string"){var Wt=parseFloat(et);Nt=et.replace(Wt,""),et=Wt}return et=(Y-1)*et/Y,Nt==="%"?kt-et+"%":"calc("+kt+"% - "+et+Nt+")"}function D(E,N){var Y=f(E.options),et=0,kt=void 0,Nt=void 0;if(++N===1)return 0;Nt=y(E.options).x;var Wt="px";if(typeof Nt=="string"){var Kt=parseFloat(Nt,10);Wt=Nt.replace(Kt,""),Nt=Kt}return kt=(Nt-(Y-1)*Nt/Y)*(N-1),et+=T(E.options,!1)*(N-1),Wt==="%"?et+kt+"%":"calc("+et+"% + "+kt+Wt+")"}function H(E){var N=0,Y=E.container,et=E.rows;$(et,function(kt){N=kt>N?kt:N}),Y.style.height=N+"px"}function Z(E,N){var Y=arguments.length>2&&arguments[2]!==void 0&&arguments[2],et=!(arguments.length>3&&arguments[3]!==void 0)||arguments[3],kt=f(E.options),Nt=y(E.options).y;G(E,kt,Y),$(N,function(Wt){var Kt=0,Xe=parseInt(Wt.offsetHeight,10);isNaN(Xe)||(E.rows.forEach(function(di,zt){di2&&arguments[2]!==void 0&&arguments[2],et=!(arguments.length>3&&arguments[3]!==void 0)||arguments[3],kt=f(E.options),Nt=y(E.options).y;G(E,kt,Y),$(N,function(Wt){E.lastcol===kt&&(E.lastcol=0);var Kt=xe(Wt,"height");Kt=parseInt(Wt.offsetHeight,10),isNaN(Kt)||(Wt.style.position="absolute",Wt.style.top=E.rows[E.lastcol]+"px",Wt.style.left=""+E.cols[E.lastcol],E.rows[E.lastcol]+=isNaN(Kt)?0:Kt+Nt,E.lastcol+=1,et&&(Wt.dataset.macyComplete=1))}),et&&(E.tmpRows=null),H(E)}var J=function E(N,Y){if(!(this instanceof E))return new E(N,Y);if(N&&N.nodeName)return N;if(N=N.replace(/^\s*/,"").replace(/\s*$/,""),Y)return this.byCss(N,Y);for(var et in this.selectors)if(Y=et.split("/"),new RegExp(Y[1],Y[2]).test(N))return this.selectors[et](N);return this.byCss(N)};J.prototype.byCss=function(E,N){return(N||document).querySelectorAll(E)},J.prototype.selectors={},J.prototype.selectors[/^\.[\w\-]+$/]=function(E){return document.getElementsByClassName(E.substring(1))},J.prototype.selectors[/^\w+$/]=function(E){return document.getElementsByTagName(E)},J.prototype.selectors[/^\#[\w\-]+$/]=function(E){return document.getElementById(E.substring(1))};var $=function(E,N){for(var Y=E.length,et=Y;Y--;)N(E[et-Y-1])},st=function(){var E=arguments.length>0&&arguments[0]!==void 0&&arguments[0];this.running=!1,this.events=[],this.add(E)};st.prototype.run=function(){if(!this.running&&this.events.length>0){var E=this.events.shift();this.running=!0,E(),this.running=!1,this.run()}},st.prototype.add=function(){var E=this,N=arguments.length>0&&arguments[0]!==void 0&&arguments[0];return!!N&&(Array.isArray(N)?$(N,function(Y){return E.add(Y)}):(this.events.push(N),void this.run()))},st.prototype.clear=function(){this.events=[]};var ft=function(E){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.instance=E,this.data=N,this},Q=function(){var E=arguments.length>0&&arguments[0]!==void 0&&arguments[0];this.events={},this.instance=E};Q.prototype.on=function(){var E=arguments.length>0&&arguments[0]!==void 0&&arguments[0],N=arguments.length>1&&arguments[1]!==void 0&&arguments[1];return!(!E||!N)&&(Array.isArray(this.events[E])||(this.events[E]=[]),this.events[E].push(N))},Q.prototype.emit=function(){var E=arguments.length>0&&arguments[0]!==void 0&&arguments[0],N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!E||!Array.isArray(this.events[E]))return!1;var Y=new ft(this.instance,N);$(this.events[E],function(et){return et(Y)})};var R=function(E){return!("naturalHeight"in E&&E.naturalHeight+E.naturalWidth===0)||E.width+E.height!==0},I=function(E,N){var Y=arguments.length>2&&arguments[2]!==void 0&&arguments[2];return new Promise(function(et,kt){if(N.complete)return R(N)?et(N):kt(N);N.addEventListener("load",function(){return R(N)?et(N):kt(N)}),N.addEventListener("error",function(){return kt(N)})}).then(function(et){Y&&E.emit(E.constants.EVENT_IMAGE_LOAD,{img:et})}).catch(function(et){return E.emit(E.constants.EVENT_IMAGE_ERROR,{img:et})})},V=function(E,N){var Y=arguments.length>2&&arguments[2]!==void 0&&arguments[2];return t(N,function(et){return I(E,et,Y)})},K=function(E,N){var Y=arguments.length>2&&arguments[2]!==void 0&&arguments[2];return Promise.all(V(E,N,Y)).then(function(){E.emit(E.constants.EVENT_IMAGE_COMPLETE)})},gt=function(E){return i(function(){E.emit(E.constants.EVENT_RESIZE),E.queue.add(function(){return E.recalculate(!0,!0)})},100)},dt=function(E){if(E.container=J(E.options.container),E.container instanceof J||!E.container)return!!E.options.debug&&console.error("Error: Container not found");E.container.length&&(E.container=E.container[0]),E.options.container=E.container,E.container.style.position="relative"},Et=function(E){E.queue=new st,E.events=new Q(E),E.rows=[],E.resizer=gt(E)},Ot=function(E){var N=J("img",E.container);window.addEventListener("resize",E.resizer),E.on(E.constants.EVENT_IMAGE_LOAD,function(){return E.recalculate(!1,!1)}),E.on(E.constants.EVENT_IMAGE_COMPLETE,function(){return E.recalculate(!0,!0)}),E.options.useOwnImageLoader||r(E,N,!E.options.waitForImages),E.emit(E.constants.EVENT_INITIALIZED)},Qt=function(E){dt(E),Et(E),Ot(E)},At=function(E){return E===Object(E)&&Object.prototype.toString.call(E)!=="[object Array]"},Te=function(E,N){At(E)||(N.columns=E),At(E)&&E.columns&&(N.columns=E.columns),At(E)&&E.margin&&!At(E.margin)&&(N.margin={x:E.margin,y:E.margin}),At(E)&&E.margin&&At(E.margin)&&E.margin.x&&(N.margin.x=E.margin.x),At(E)&&E.margin&&At(E.margin)&&E.margin.y&&(N.margin.y=E.margin.y)},xe=function(E,N){return window.getComputedStyle(E,null).getPropertyValue(N)},G=function(E,N){var Y=arguments.length>2&&arguments[2]!==void 0&&arguments[2];if(E.lastcol||(E.lastcol=0),E.rows.length<1&&(Y=!0),Y){E.rows=[],E.cols=[],E.lastcol=0;for(var et=N-1;et>=0;et--)E.rows[et]=0,E.cols[et]=D(E,et)}else if(E.tmpRows){E.rows=[];for(var et=N-1;et>=0;et--)E.rows[et]=E.tmpRows[et]}else{E.tmpRows=[];for(var et=N-1;et>=0;et--)E.tmpRows[et]=E.rows[et]}},C=function(E){var N=arguments.length>1&&arguments[1]!==void 0&&arguments[1],Y=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2],et=N?E.container.children:J(':scope > *:not([data-macy-complete="1"])',E.container);et=Array.from(et).filter(function(Nt){return Nt.offsetParent!==null});var kt=T(E.options);return $(et,function(Nt){N&&(Nt.dataset.macyComplete=0),Nt.style.width=kt}),E.options.trueOrder?(X(E,et,N,Y),E.emit(E.constants.EVENT_RECALCULATED)):(Z(E,et,N,Y),E.emit(E.constants.EVENT_RECALCULATED))},F=function(){return!!window.Promise},St=Object.assign||function(E){for(var N=1;N0&&arguments[0]!==void 0?arguments[0]:bt;if(!(this instanceof E))return new E(N);this.options={},St(this.options,bt,N),this.options.cancelLegacy&&!F()||Qt(this)};return It.init=function(E){return console.warn("Depreciated: Macy.init will be removed in v3.0.0 opt to use Macy directly like so Macy({ /*options here*/ }) "),new It(E)},It.prototype.recalculateOnImageLoad=function(){var E=arguments.length>0&&arguments[0]!==void 0&&arguments[0];return r(this,J("img",this.container),!E)},It.prototype.runOnImageLoad=function(E){var N=arguments.length>1&&arguments[1]!==void 0&&arguments[1],Y=J("img",this.container);return this.on(this.constants.EVENT_IMAGE_COMPLETE,E),N&&this.on(this.constants.EVENT_IMAGE_LOAD,E),r(this,Y,N)},It.prototype.recalculate=function(){var E=this,N=arguments.length>0&&arguments[0]!==void 0&&arguments[0],Y=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return Y&&this.queue.clear(),this.queue.add(function(){return C(E,N,Y)})},It.prototype.remove=function(){window.removeEventListener("resize",this.resizer),$(this.container.children,function(E){E.removeAttribute("data-macy-complete"),E.removeAttribute("style")}),this.container.removeAttribute("style")},It.prototype.reInit=function(){this.recalculate(!0,!0),this.emit(this.constants.EVENT_INITIALIZED),window.addEventListener("resize",this.resizer),this.container.style.position="relative"},It.prototype.on=function(E,N){this.events.on(E,N)},It.prototype.emit=function(E,N){this.events.emit(E,N)},It.constants={EVENT_INITIALIZED:"macy.initialized",EVENT_RECALCULATED:"macy.recalculated",EVENT_IMAGE_LOAD:"macy.image.load",EVENT_IMAGE_ERROR:"macy.image.error",EVENT_IMAGE_COMPLETE:"macy.images.complete",EVENT_RESIZE:"macy.resize"},It.prototype.constants=It.constants,It})});var $g=ar((Td,xd)=>{(function(i,t){typeof Td=="object"&&typeof xd!="undefined"?xd.exports=t():typeof define=="function"&&define.amd?define(t):(i=typeof globalThis!="undefined"?globalThis:i||self,i.Trix=t())})(Td,function(){"use strict";var i="trix",t="2.1.12",r="A rich text editor for everyday writing",s="dist/trix.umd.min.js",l="dist/trix.esm.min.js",u="dist/trix.css",f=["dist/*.css","dist/*.js","dist/*.map","src/{inspector,trix}/*.js"],y={type:"git",url:"git+https://github.com/basecamp/trix.git"},T=["rich text","wysiwyg","editor"],D="37signals, LLC",H="MIT",Z={url:"https://github.com/basecamp/trix/issues"},X="https://trix-editor.org/",J={"@babel/core":"^7.16.0","@babel/preset-env":"^7.16.4","@rollup/plugin-babel":"^5.3.0","@rollup/plugin-commonjs":"^22.0.2","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^13.3.0","@web/dev-server":"^0.1.34","babel-eslint":"^10.1.0",chokidar:"^4.0.2",concurrently:"^7.4.0",eslint:"^7.32.0",esm:"^3.2.25",karma:"6.4.1","karma-chrome-launcher":"3.2.0","karma-qunit":"^4.1.2","karma-sauce-launcher":"^4.3.6",qunit:"2.19.1",rangy:"^1.3.0",rollup:"^2.56.3","rollup-plugin-includepaths":"^0.2.4","rollup-plugin-terser":"^7.0.2",sass:"^1.83.0",svgo:"^2.8.0",webdriverio:"^7.19.5"},$={webdriverio:"^7.19.5"},st={"build-css":"bin/sass-build assets/trix.scss dist/trix.css","build-js":"rollup -c","build-assets":"cp -f assets/*.html dist/",build:"yarn run build-js && yarn run build-css && yarn run build-assets",watch:"rollup -c -w",lint:"eslint .",pretest:"yarn run lint && yarn run build",test:"karma start",prerelease:"yarn version && yarn test",release:"npm adduser && npm publish",postrelease:"git push && git push --tags",dev:"web-dev-server --app-index index.html --root-dir dist --node-resolve --open",start:"yarn build-assets && concurrently --kill-others --names js,css,dev-server 'yarn watch' 'yarn build-css --watch' 'yarn dev'"},ft={dompurify:"^3.2.3"},Q={name:i,version:t,description:r,main:s,module:l,style:u,files:f,repository:y,keywords:T,author:D,license:H,bugs:Z,homepage:X,devDependencies:J,resolutions:$,scripts:st,dependencies:ft};let R="[data-trix-attachment]",I={preview:{presentation:"gallery",caption:{name:!0,size:!0}},file:{caption:{size:!0}}},V={default:{tagName:"div",parse:!1},quote:{tagName:"blockquote",nestable:!0},heading1:{tagName:"h1",terminal:!0,breakOnReturn:!0,group:!1},code:{tagName:"pre",terminal:!0,htmlAttributes:["language"],text:{plaintext:!0}},bulletList:{tagName:"ul",parse:!1},bullet:{tagName:"li",listAttribute:"bulletList",group:!1,nestable:!0,test(o){return K(o.parentNode)===V[this.listAttribute].tagName}},numberList:{tagName:"ol",parse:!1},number:{tagName:"li",listAttribute:"numberList",group:!1,nestable:!0,test(o){return K(o.parentNode)===V[this.listAttribute].tagName}},attachmentGallery:{tagName:"div",exclusive:!0,terminal:!0,parse:!1,group:!1}},K=o=>{var e;return o==null||(e=o.tagName)===null||e===void 0?void 0:e.toLowerCase()},gt=navigator.userAgent.match(/android\s([0-9]+.*Chrome)/i),dt=gt&&parseInt(gt[1]);var Et={composesExistingText:/Android.*Chrome/.test(navigator.userAgent),recentAndroid:dt&&dt>12,samsungAndroid:dt&&navigator.userAgent.match(/Android.*SM-/),forcesObjectResizing:/Trident.*rv:11/.test(navigator.userAgent),supportsInputEvents:typeof InputEvent!="undefined"&&["data","getTargetRanges","inputType"].every(o=>o in InputEvent.prototype)},Ot={attachment:"attachment",attachmentCaption:"attachment__caption",attachmentCaptionEditor:"attachment__caption-editor",attachmentMetadata:"attachment__metadata",attachmentMetadataContainer:"attachment__metadata-container",attachmentName:"attachment__name",attachmentProgress:"attachment__progress",attachmentSize:"attachment__size",attachmentToolbar:"attachment__toolbar",attachmentGallery:"attachment-gallery"},Qt={ADD_ATTR:["language"],SAFE_FOR_XML:!1,RETURN_DOM:!0},At={attachFiles:"Attach Files",bold:"Bold",bullets:"Bullets",byte:"Byte",bytes:"Bytes",captionPlaceholder:"Add a caption\u2026",code:"Code",heading1:"Heading",indent:"Increase Level",italic:"Italic",link:"Link",numbers:"Numbers",outdent:"Decrease Level",quote:"Quote",redo:"Redo",remove:"Remove",strike:"Strikethrough",undo:"Undo",unlink:"Unlink",url:"URL",urlPlaceholder:"Enter a URL\u2026",GB:"GB",KB:"KB",MB:"MB",PB:"PB",TB:"TB"};let Te=[At.bytes,At.KB,At.MB,At.GB,At.TB,At.PB];var xe={prefix:"IEC",precision:2,formatter(o){switch(o){case 0:return"0 ".concat(At.bytes);case 1:return"1 ".concat(At.byte);default:let e;this.prefix==="SI"?e=1e3:this.prefix==="IEC"&&(e=1024);let n=Math.floor(Math.log(o)/Math.log(e)),h=(o/Math.pow(e,n)).toFixed(this.precision).replace(/0*$/,"").replace(/\.$/,"");return"".concat(h," ").concat(Te[n])}}};let G="\uFEFF",C="\xA0",F="\uFFFC",St=function(o){for(let e in o){let n=o[e];this[e]=n}return this},bt=document.documentElement,It=bt.matches,E=function(o){let{onElement:e,matchingSelector:n,withCallback:a,inPhase:c,preventDefault:h,times:g}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},S=e||bt,x=n,_=c==="capturing",O=function(q){g!=null&&--g===0&&O.destroy();let at=kt(q.target,{matchingSelector:x});at!=null&&(a==null||a.call(at,q,at),h&&q.preventDefault())};return O.destroy=()=>S.removeEventListener(o,O,_),S.addEventListener(o,O,_),O},N=function(o){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return e.times=1,E(o,e)},Y=function(o){let{onElement:e,bubbles:n,cancelable:a,attributes:c}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},h=e!=null?e:bt;n=n!==!1,a=a!==!1;let g=document.createEvent("Events");return g.initEvent(o,n,a),c!=null&&St.call(g,c),h.dispatchEvent(g)},et=function(o,e){if((o==null?void 0:o.nodeType)===1)return It.call(o,e)},kt=function(o){let{matchingSelector:e,untilNode:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};for(;o&&o.nodeType!==Node.ELEMENT_NODE;)o=o.parentNode;if(o!=null)if(e!=null){if(o.closest&&n==null)return o.closest(e);for(;o&&o!==n;){if(et(o,e))return o;o=o.parentNode}}else return o},Nt=function(o){for(;(e=o)!==null&&e!==void 0&&e.firstElementChild;){var e;o=o.firstElementChild}return o},Wt=o=>document.activeElement!==o&&Kt(o,document.activeElement),Kt=function(o,e){if(!(!o||!e))for(;e;){if(e===o)return!0;e=e.parentNode}},Xe=function(o,e){if(o)return o.nodeType===Node.TEXT_NODE?o:e===0?o.firstChild!=null?o.firstChild:o:o.childNodes.item(e-1)},di=function(o,e){let n=Xe(o,e);return kt(n)},zt=function(o){var e;if(!((e=o)!==null&&e!==void 0&&e.parentNode))return;let n=0;for(o=o.previousSibling;o;)n++,o=o.previousSibling;return n},P=o=>{var e;return o==null||(e=o.parentNode)===null||e===void 0?void 0:e.removeChild(o)},k=function(o){let{onlyNodesOfType:e,usingFilter:n,expandEntityReferences:a}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},c=(()=>{switch(e){case"element":return NodeFilter.SHOW_ELEMENT;case"text":return NodeFilter.SHOW_TEXT;case"comment":return NodeFilter.SHOW_COMMENT;default:return NodeFilter.SHOW_ALL}})();return document.createTreeWalker(o,c,n!=null?n:null,a===!0)},p=o=>{var e;return o==null||(e=o.tagName)===null||e===void 0?void 0:e.toLowerCase()},d=function(o){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n,a;typeof o=="object"?(e=o,o=e.tagName):e={attributes:e};let c=document.createElement(o);if(e.editable!=null&&(e.attributes==null&&(e.attributes={}),e.attributes.contenteditable=e.editable),e.attributes)for(n in e.attributes)a=e.attributes[n],c.setAttribute(n,a);if(e.style)for(n in e.style)a=e.style[n],c.style[n]=a;if(e.data)for(n in e.data)a=e.data[n],c.dataset[n]=a;return e.className&&e.className.split(" ").forEach(h=>{c.classList.add(h)}),e.textContent&&(c.textContent=e.textContent),e.childNodes&&[].concat(e.childNodes).forEach(h=>{c.appendChild(h)}),c},A,v=function(){if(A!=null)return A;A=[];for(let o in V){let e=V[o];e.tagName&&A.push(e.tagName)}return A},he=o=>ni(o==null?void 0:o.firstChild),Pe=function(o){return v().includes(p(o))&&!v().includes(p(o.firstChild))},Ie=function(o){let{strict:e}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{strict:!0};return e?ni(o):ni(o)||!ni(o.firstChild)&&Pe(o)},ni=o=>_i(o)&&(o==null?void 0:o.data)==="block",_i=o=>(o==null?void 0:o.nodeType)===Node.COMMENT_NODE,gi=function(o){let{name:e}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(o)if(dr(o)){if(o.data===G)return e?o.parentNode.dataset.trixCursorTarget===e:!0}else return gi(o.firstChild)},zi=o=>et(o,R),hr=o=>dr(o)&&(o==null?void 0:o.data)==="",dr=o=>(o==null?void 0:o.nodeType)===Node.TEXT_NODE,B={level2Enabled:!0,getLevel(){return this.level2Enabled&&Et.supportsInputEvents?2:0},pickFiles(o){let e=d("input",{type:"file",multiple:!0,hidden:!0,id:this.fileInputId});e.addEventListener("change",()=>{o(e.files),P(e)}),P(document.getElementById(this.fileInputId)),document.body.appendChild(e),e.click()}};var nt={8:"backspace",9:"tab",13:"return",27:"escape",37:"left",39:"right",46:"delete",68:"d",72:"h",79:"o"},Bt={removeBlankTableCells:!1,tableCellSeparator:" | ",tableRowSeparator:` `},me={bold:{tagName:"strong",inheritable:!0,parser(o){let e=window.getComputedStyle(o);return e.fontWeight==="bold"||e.fontWeight>=600}},italic:{tagName:"em",inheritable:!0,parser(o){return window.getComputedStyle(o).fontStyle==="italic"}},href:{groupTagName:"a",parser(o){let e="a:not(".concat(R,")"),n=o.closest(e);if(n)return n.getAttribute("href")}},strike:{tagName:"del",inheritable:!0},frozen:{style:{backgroundColor:"highlight"}}},ce={getDefaultHTML(){return`
`)}};let Yt={interval:5e3};var Pi=Object.freeze({__proto__:null,attachments:I,blockAttributes:V,browser:Et,css:Ot,dompurify:Qt,fileSize:xe,input:B,keyNames:nt,lang:At,parser:Bt,textAttributes:me,toolbar:ce,undo:Yt});class qt{static proxyMethod(e){let{name:n,toMethod:a,toProperty:c,optional:h}=Ye(e);this.prototype[n]=function(){let g,S;if(a)if(h){var x;S=(x=this[a])===null||x===void 0?void 0:x.call(this)}else S=this[a]();else c&&(S=this[c]);if(h){var _;if(g=(_=S)===null||_===void 0?void 0:_[n],g)return $r.call(g,S,arguments)}else return g=S[n],$r.call(g,S,arguments)}}}let Ye=function(o){let e=o.match(kr);if(!e)throw new Error("can't parse @proxyMethod expression: ".concat(o));let n={name:e[4]};return e[2]!=null?n.toMethod=e[1]:n.toProperty=e[1],e[3]!=null&&(n.optional=!0),n},{apply:$r}=Function.prototype,kr=new RegExp("^(.+?)(\\(\\))?(\\?)?\\.(.+?)$");var Us,fr,bi,Vs;class Xr extends qt{static box(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return e instanceof this?e:this.fromUCS2String(e==null?void 0:e.toString())}static fromUCS2String(e){return new this(e,er(e))}static fromCodepoints(e){return new this(Hn(e),e)}constructor(e,n){super(...arguments),this.ucs2String=e,this.codepoints=n,this.length=this.codepoints.length,this.ucs2Length=this.ucs2String.length}offsetToUCS2Offset(e){return Hn(this.codepoints.slice(0,Math.max(0,e))).length}offsetFromUCS2Offset(e){return er(this.ucs2String.slice(0,Math.max(0,e))).length}slice(){return this.constructor.fromCodepoints(this.codepoints.slice(...arguments))}charAt(e){return this.slice(e,e+1)}isEqualTo(e){return this.constructor.box(e).ucs2String===this.ucs2String}toJSON(){return this.ucs2String}getCacheKey(){return this.ucs2String}toString(){return this.ucs2String}}let Ge=((Us=Array.from)===null||Us===void 0?void 0:Us.call(Array,"\u{1F47C}").length)===1,Ne=((fr=(bi=" ").codePointAt)===null||fr===void 0?void 0:fr.call(bi,0))!=null,Ic=((Vs=String.fromCodePoint)===null||Vs===void 0?void 0:Vs.call(String,32,128124))===" \u{1F47C}",er,Hn;Ge&&Ne?er=o=>Array.from(o).map(e=>e.codePointAt(0)):er=function(o){let e=[],n=0,{length:a}=o;for(;nString.fromCodePoint(...Array.from(o||[])):Hn=function(o){return(()=>{let n=[];return Array.from(o).forEach(a=>{let c="";a>65535&&(a-=65536,c+=String.fromCharCode(a>>>10&1023|55296),a=56320|a&1023),n.push(c+String.fromCharCode(a))}),n})().join("")};let pr=0;class Lr extends qt{static fromJSONString(e){return this.fromJSON(JSON.parse(e))}constructor(){super(...arguments),this.id=++pr}hasSameConstructorAs(e){return this.constructor===(e==null?void 0:e.constructor)}isEqualTo(e){return this===e}inspect(){let e=[],n=this.contentsForInspection()||{};for(let a in n){let c=n[a];e.push("".concat(a,"=").concat(c))}return"#<".concat(this.constructor.name,":").concat(this.id).concat(e.length?" ".concat(e.join(", ")):"",">")}contentsForInspection(){}toJSONString(){return JSON.stringify(this)}toUTF16String(){return Xr.box(this)}getCacheKey(){return this.id.toString()}}let Fe=function(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];if(o.length!==e.length)return!1;for(let n=0;n0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return Fe(o.slice(0,e.length),e)},mr=function(o){let e=o.slice(0);for(var n=arguments.length,a=new Array(n>1?n-1:0),c=1;c0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=[],a=[],c=new Set;o.forEach(g=>{c.add(g)});let h=new Set;return e.forEach(g=>{h.add(g),c.has(g)||n.push(g)}),o.forEach(g=>{h.has(g)||a.push(g)}),{added:n,removed:a}},$s=/[\u05BE\u05C0\u05C3\u05D0-\u05EA\u05F0-\u05F4\u061B\u061F\u0621-\u063A\u0640-\u064A\u066D\u0671-\u06B7\u06BA-\u06BE\u06C0-\u06CE\u06D0-\u06D5\u06E5\u06E6\u200F\u202B\u202E\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE72\uFE74\uFE76-\uFEFC]/,Xs=function(){let o=d("input",{dir:"auto",name:"x",dirName:"x.dir"}),e=d("textarea",{dir:"auto",name:"y",dirName:"y.dir"}),n=d("form");n.appendChild(o),n.appendChild(e);let a=function(){try{return new FormData(n).has(e.dirName)}catch(h){return!1}}(),c=function(){try{return o.matches(":dir(ltr),:dir(rtl)")}catch(h){return!1}}();return a?function(h){return e.value=h,new FormData(n).get(e.dirName)}:c?function(h){return o.value=h,o.matches(":dir(rtl)")?"rtl":"ltr"}:function(h){let g=h.trim().charAt(0);return $s.test(g)?"rtl":"ltr"}}(),_r=null,Ys=null,qn=null,fn=null,Di=()=>(_r||(_r=Gs().concat(Yr())),_r),ye=o=>V[o],Yr=()=>(Ys||(Ys=Object.keys(V)),Ys),zn=o=>me[o],Gs=()=>(qn||(qn=Object.keys(me)),qn),Fc=()=>{if(!fn){fn=[];for(let o in V){let{listAttribute:e}=V[o];e!=null&&fn.push(e)}}return fn},Ks=function(o,e){let n=Ra(o);n.textContent=e.replace(/%t/g,o)},Ra=function(o){let e=document.createElement("style");e.setAttribute("type","text/css"),e.setAttribute("data-tag-name",o.toLowerCase());let n=pn();return n&&e.setAttribute("nonce",n),document.head.insertBefore(e,document.head.firstChild),e},pn=function(){let o=Ma("trix-csp-nonce")||Ma("csp-nonce");if(o){let{nonce:e,content:n}=o;return e==""?n:e}},Ma=o=>document.head.querySelector("meta[name=".concat(o,"]")),mn={"application/x-trix-feature-detection":"test"},Oa=function(o){let e=o.getData("text/plain"),n=o.getData("text/html");if(e&&n){let{body:a}=new DOMParser().parseFromString(n,"text/html");if(a.textContent===e)return!a.querySelector("*")}else return e==null?void 0:e.length},gr=o=>{let{dataTransfer:e}=o;return e.types.includes("Files")&&e.types.includes("text/html")&&e.getData("text/html").includes("urn:schemas-microsoft-com:office:office")},Bc=function(o){if(!(o!=null&&o.setData))return!1;for(let e in mn){let n=mn[e];try{if(o.setData(e,n),!o.getData(e)===n)return!1}catch(a){return!1}}return!0},Pa=function(){return/Mac|^iP/.test(navigator.platform)?o=>o.metaKey:o=>o.ctrlKey}();function Ia(o){return/iPhone|iPad/.test(navigator.userAgent)?!o.inputType||o.inputType==="insertParagraph":!1}let Js=o=>setTimeout(o,1),Na=function(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e={};for(let n in o){let a=o[n];e[n]=a}return e},Gr=function(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(Object.keys(o).length!==Object.keys(e).length)return!1;for(let n in o)if(o[n]!==e[n])return!1;return!0},Ce=function(o){if(o!=null)return Array.isArray(o)||(o=[o,o]),[Fa(o[0]),Fa(o[1]!=null?o[1]:o[0])]},ir=function(o){if(o==null)return;let[e,n]=Ce(o);return Zs(e,n)},Wn=function(o,e){if(o==null||e==null)return;let[n,a]=Ce(o),[c,h]=Ce(e);return Zs(n,c)&&Zs(a,h)},Fa=function(o){return typeof o=="number"?o:Na(o)},Zs=function(o,e){return typeof o=="number"?o===e:Gr(o,e)};class Ba extends qt{constructor(){super(...arguments),this.update=this.update.bind(this),this.selectionManagers=[]}start(){this.started||(this.started=!0,document.addEventListener("selectionchange",this.update,!0))}stop(){if(this.started)return this.started=!1,document.removeEventListener("selectionchange",this.update,!0)}registerSelectionManager(e){if(!this.selectionManagers.includes(e))return this.selectionManagers.push(e),this.start()}unregisterSelectionManager(e){if(this.selectionManagers=this.selectionManagers.filter(n=>n!==e),this.selectionManagers.length===0)return this.stop()}notifySelectionManagersOfSelectionChange(){return this.selectionManagers.map(e=>e.selectionDidChange())}update(){this.notifySelectionManagersOfSelectionChange()}reset(){this.update()}}let Dr=new Ba,ja=function(){let o=window.getSelection();if(o.rangeCount>0)return o},gn=function(){var o;let e=(o=ja())===null||o===void 0?void 0:o.getRangeAt(0);if(e&&!qa(e))return e},Ha=function(o){let e=window.getSelection();return e.removeAllRanges(),e.addRange(o),Dr.update()},qa=o=>L(o.startContainer)||L(o.endContainer),L=o=>!Object.getPrototypeOf(o),m=o=>o.replace(new RegExp("".concat(G),"g"),"").replace(new RegExp("".concat(C),"g")," "),w=o=>o.replace(/\r\n?/g,` `),b=new RegExp("[^\\S".concat(C,"]")),z=o=>o.replace(new RegExp("".concat(b.source),"g")," ").replace(/\ {2,}/g," "),M=function(o,e){let n,a;return o=Xr.box(o),e=Xr.box(e),e.lengthn+1&&o.charAt(a-1).isEqualTo(e.charAt(c-1));)a--,c--;return{utf16String:o.slice(n,a),offset:n}};class xt extends Lr{static fromCommonAttributesOfObjects(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];if(!e.length)return new this;let n=Lt(e[0]),a=n.getKeys();return e.slice(1).forEach(c=>{a=n.getKeysCommonToHash(Lt(c)),n=n.slice(a)}),n}static box(e){return Lt(e)}constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(...arguments),this.values=ot(e)}add(e,n){return this.merge(Tt(e,n))}remove(e){return new xt(ot(this.values,e))}get(e){return this.values[e]}has(e){return e in this.values}merge(e){return new xt(lt(this.values,ge(e)))}slice(e){let n={};return Array.from(e).forEach(a=>{this.has(a)&&(n[a]=this.values[a])}),new xt(n)}getKeys(){return Object.keys(this.values)}getKeysCommonToHash(e){return e=Lt(e),this.getKeys().filter(n=>this.values[n]===e.values[n])}isEqualTo(e){return Fe(this.toArray(),Lt(e).toArray())}isEmpty(){return this.getKeys().length===0}toArray(){if(!this.array){let e=[];for(let n in this.values){let a=this.values[n];e.push(e.push(n,a))}this.array=e.slice(0)}return this.array}toObject(){return ot(this.values)}toJSON(){return this.toObject()}contentsForInspection(){return{values:JSON.stringify(this.values)}}}let Tt=function(o,e){let n={};return n[o]=e,n},lt=function(o,e){let n=ot(o);for(let a in e){let c=e[a];n[a]=c}return n},ot=function(o,e){let n={};return Object.keys(o).sort().forEach(c=>{c!==e&&(n[c]=o[c])}),n},Lt=function(o){return o instanceof xt?o:new xt(o)},ge=function(o){return o instanceof xt?o.values:o};class de{static groupObjects(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],{depth:n,asTree:a}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},c;a&&n==null&&(n=0);let h=[];return Array.from(e).forEach(g=>{var S;if(c){var x,_,O;if((x=g.canBeGrouped)!==null&&x!==void 0&&x.call(g,n)&&(_=(O=c[c.length-1]).canBeGroupedWith)!==null&&_!==void 0&&_.call(O,g,n)){c.push(g);return}else h.push(new this(c,{depth:n,asTree:a})),c=null}(S=g.canBeGrouped)!==null&&S!==void 0&&S.call(g,n)?c=[g]:h.push(g)}),c&&h.push(new this(c,{depth:n,asTree:a})),h}constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],{depth:n,asTree:a}=arguments.length>1?arguments[1]:void 0;this.objects=e,a&&(this.depth=n,this.objects=this.constructor.groupObjects(this.objects,{asTree:a,depth:this.depth+1}))}getObjects(){return this.objects}getDepth(){return this.depth}getCacheKey(){let e=["objectGroup"];return Array.from(this.getObjects()).forEach(n=>{e.push(n.getCacheKey())}),e.join("/")}}class Be extends qt{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments),this.objects={},Array.from(e).forEach(n=>{let a=JSON.stringify(n);this.objects[a]==null&&(this.objects[a]=n)})}find(e){let n=JSON.stringify(e);return this.objects[n]}}class Ae{constructor(e){this.reset(e)}add(e){let n=Ke(e);this.elements[n]=e}remove(e){let n=Ke(e),a=this.elements[n];if(a)return delete this.elements[n],a}reset(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return this.elements={},Array.from(e).forEach(n=>{this.add(n)}),e}}let Ke=o=>o.dataset.trixStoreKey;class We extends qt{isPerforming(){return this.performing===!0}hasPerformed(){return this.performed===!0}hasSucceeded(){return this.performed&&this.succeeded}hasFailed(){return this.performed&&!this.succeeded}getPromise(){return this.promise||(this.promise=new Promise((e,n)=>(this.performing=!0,this.perform((a,c)=>{this.succeeded=a,this.performing=!1,this.performed=!0,this.succeeded?e(c):n(c)})))),this.promise}perform(e){return e(!1)}release(){var e,n;(e=this.promise)===null||e===void 0||(n=e.cancel)===null||n===void 0||n.call(e),this.promise=null,this.performing=null,this.performed=null,this.succeeded=null}}We.proxyMethod("getPromise().then"),We.proxyMethod("getPromise().catch");class Re extends qt{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(...arguments),this.object=e,this.options=n,this.childViews=[],this.rootView=this}getNodes(){return this.nodes||(this.nodes=this.createNodes()),this.nodes.map(e=>e.cloneNode(!0))}invalidate(){var e;return this.nodes=null,this.childViews=[],(e=this.parentView)===null||e===void 0?void 0:e.invalidate()}invalidateViewForObject(e){var n;return(n=this.findViewForObject(e))===null||n===void 0?void 0:n.invalidate()}findOrCreateCachedChildView(e,n,a){let c=this.getCachedViewForObject(n);return c?this.recordChildView(c):(c=this.createChildView(...arguments),this.cacheViewForObject(c,n)),c}createChildView(e,n){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};n instanceof de&&(a.viewClass=e,e=rr);let c=new e(n,a);return this.recordChildView(c)}recordChildView(e){return e.parentView=this,e.rootView=this.rootView,this.childViews.push(e),e}getAllChildViews(){let e=[];return this.childViews.forEach(n=>{e.push(n),e=e.concat(n.getAllChildViews())}),e}findElement(){return this.findElementForObject(this.object)}findElementForObject(e){let n=e==null?void 0:e.id;if(n)return this.rootView.element.querySelector("[data-trix-id='".concat(n,"']"))}findViewForObject(e){for(let n of this.getAllChildViews())if(n.object===e)return n}getViewCache(){if(this.rootView===this){if(this.isViewCachingEnabled())return this.viewCache||(this.viewCache={}),this.viewCache}else return this.rootView.getViewCache()}isViewCachingEnabled(){return this.shouldCacheViews!==!1}enableViewCaching(){this.shouldCacheViews=!0}disableViewCaching(){this.shouldCacheViews=!1}getCachedViewForObject(e){var n;return(n=this.getViewCache())===null||n===void 0?void 0:n[e.getCacheKey()]}cacheViewForObject(e,n){let a=this.getViewCache();a&&(a[n.getCacheKey()]=e)}garbageCollectCachedViews(){let e=this.getViewCache();if(e){let a=this.getAllChildViews().concat(this).map(c=>c.object.getCacheKey());for(let c in e)a.includes(c)||delete e[c]}}}class rr extends Re{constructor(){super(...arguments),this.objectGroup=this.object,this.viewClass=this.options.viewClass,delete this.options.viewClass}getChildViews(){return this.childViews.length||Array.from(this.objectGroup.getObjects()).forEach(e=>{this.findOrCreateCachedChildView(this.viewClass,e,this.options)}),this.childViews}createNodes(){let e=this.createContainerElement();return this.getChildViews().forEach(n=>{Array.from(n.getNodes()).forEach(a=>{e.appendChild(a)})}),[e]}createContainerElement(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.objectGroup.getDepth();return this.getChildViews()[0].createContainerElement(e)}}let{entries:Si,setPrototypeOf:Rt,isFrozen:Se,getPrototypeOf:ti,getOwnPropertyDescriptor:Ii}=Object,{freeze:He,seal:si,create:br}=Object,{apply:Ki,construct:Ni}=typeof Reflect!="undefined"&&Reflect;He||(He=function(e){return e}),si||(si=function(e){return e}),Ki||(Ki=function(e,n,a){return e.apply(n,a)}),Ni||(Ni=function(e,n){return new e(...n)});let ci=Ui(Array.prototype.forEach),vr=Ui(Array.prototype.pop),yr=Ui(Array.prototype.push),Kr=Ui(String.prototype.toLowerCase),bn=Ui(String.prototype.toString),Qs=Ui(String.prototype.match),Jr=Ui(String.prototype.replace),za=Ui(String.prototype.indexOf),Wa=Ui(String.prototype.trim),Wi=Ui(Object.prototype.hasOwnProperty),vi=Ui(RegExp.prototype.test),to=sb(TypeError);function Ui(o){return function(e){for(var n=arguments.length,a=new Array(n>1?n-1:0),c=1;c2&&arguments[2]!==void 0?arguments[2]:Kr;Rt&&Rt(o,null);let a=e.length;for(;a--;){let c=e[a];if(typeof c=="string"){let h=n(c);h!==c&&(Se(e)||(e[a]=h),c=h)}o[c]=!0}return o}function ob(o){for(let e=0;e/gm),hb=si(/\$\{[\w\W]*}/gm),db=si(/^data-[\-\w.\u00B7-\uFFFF]+$/),fb=si(/^aria-[\-\w]+$/),Pd=si(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),pb=si(/^(?:\w+script|data):/i),mb=si(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Id=si(/^html$/i),gb=si(/^[a-z][.\w]*(-[.\w]+)+$/i);var Nd=Object.freeze({__proto__:null,ARIA_ATTR:fb,ATTR_WHITESPACE:mb,CUSTOM_ELEMENT:gb,DATA_ATTR:db,DOCTYPE_NAME:Id,ERB_EXPR:ub,IS_ALLOWED_URI:Pd,IS_SCRIPT_OR_DATA:pb,MUSTACHE_EXPR:cb,TMPLIT_EXPR:hb});let io={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},bb=function(){return typeof window=="undefined"?null:window},vb=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let a=null,c="data-tt-policy-suffix";n&&n.hasAttribute(c)&&(a=n.getAttribute(c));let h="dompurify"+(a?"#"+a:"");try{return e.createPolicy(h,{createHTML(g){return g},createScriptURL(g){return g}})}catch(g){return console.warn("TrustedTypes policy "+h+" could not be created."),null}},Fd=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Bd(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:bb(),e=Jt=>Bd(Jt);if(e.version="3.2.3",e.removed=[],!o||!o.document||o.document.nodeType!==io.document)return e.isSupported=!1,e;let{document:n}=o,a=n,c=a.currentScript,{DocumentFragment:h,HTMLTemplateElement:g,Node:S,Element:x,NodeFilter:_,NamedNodeMap:O=o.NamedNodeMap||o.MozNamedAttrMap,HTMLFormElement:q,DOMParser:at,trustedTypes:rt}=o,pt=x.prototype,ct=eo(pt,"cloneNode"),mt=eo(pt,"remove"),yt=eo(pt,"nextSibling"),ut=eo(pt,"childNodes"),Ct=eo(pt,"parentNode");if(typeof g=="function"){let Jt=n.createElement("template");Jt.content&&Jt.content.ownerDocument&&(n=Jt.content.ownerDocument)}let vt,jt="",{implementation:Ht,createNodeIterator:Vt,createDocumentFragment:fe,getElementsByTagName:Gt}=n,{importNode:te}=a,ae=Fd();e.isSupported=typeof Si=="function"&&typeof Ct=="function"&&Ht&&Ht.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:ii,ERB_EXPR:Ri,TMPLIT_EXPR:fi,DATA_ATTR:wi,ARIA_ATTR:Dt,IS_SCRIPT_OR_DATA:_t,ATTR_WHITESPACE:Ft,CUSTOM_ELEMENT:ue}=Nd,{IS_ALLOWED_URI:$t}=Nd,re=null,Je=pe({},[...Dd,...jc,...Hc,...qc,...Rd]),ke=null,xi=pe({},[...Md,...zc,...Od,...Ua]),Me=Object.seal(br(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),sr=null,or=null,ap=!0,wu=!0,lp=!1,cp=!0,Jn=!1,Eu=!0,Sn=!1,Au=!1,Su=!1,Zn=!1,ol=!1,al=!1,up=!0,hp=!1,yy="user-content-",Tu=!0,uo=!1,Qn={},ts=null,dp=pe({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),fp=null,pp=pe({},["audio","video","img","source","image","track"]),xu=null,mp=pe({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ll="http://www.w3.org/1998/Math/MathML",cl="http://www.w3.org/2000/svg",Or="http://www.w3.org/1999/xhtml",es=Or,Cu=!1,ku=null,wy=pe({},[ll,cl,Or],bn),ul=pe({},["mi","mo","mn","ms","mtext"]),hl=pe({},["annotation-xml"]),Ey=pe({},["title","style","font","a","script"]),ho=null,Ay=["application/xhtml+xml","text/html"],Sy="text/html",pi=null,is=null,Ty=n.createElement("form"),gp=function(U){return U instanceof RegExp||U instanceof Function},Lu=function(){let U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(is&&is===U)){if((!U||typeof U!="object")&&(U={}),U=vn(U),ho=Ay.indexOf(U.PARSER_MEDIA_TYPE)===-1?Sy:U.PARSER_MEDIA_TYPE,pi=ho==="application/xhtml+xml"?bn:Kr,re=Wi(U,"ALLOWED_TAGS")?pe({},U.ALLOWED_TAGS,pi):Je,ke=Wi(U,"ALLOWED_ATTR")?pe({},U.ALLOWED_ATTR,pi):xi,ku=Wi(U,"ALLOWED_NAMESPACES")?pe({},U.ALLOWED_NAMESPACES,bn):wy,xu=Wi(U,"ADD_URI_SAFE_ATTR")?pe(vn(mp),U.ADD_URI_SAFE_ATTR,pi):mp,fp=Wi(U,"ADD_DATA_URI_TAGS")?pe(vn(pp),U.ADD_DATA_URI_TAGS,pi):pp,ts=Wi(U,"FORBID_CONTENTS")?pe({},U.FORBID_CONTENTS,pi):dp,sr=Wi(U,"FORBID_TAGS")?pe({},U.FORBID_TAGS,pi):{},or=Wi(U,"FORBID_ATTR")?pe({},U.FORBID_ATTR,pi):{},Qn=Wi(U,"USE_PROFILES")?U.USE_PROFILES:!1,ap=U.ALLOW_ARIA_ATTR!==!1,wu=U.ALLOW_DATA_ATTR!==!1,lp=U.ALLOW_UNKNOWN_PROTOCOLS||!1,cp=U.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Jn=U.SAFE_FOR_TEMPLATES||!1,Eu=U.SAFE_FOR_XML!==!1,Sn=U.WHOLE_DOCUMENT||!1,Zn=U.RETURN_DOM||!1,ol=U.RETURN_DOM_FRAGMENT||!1,al=U.RETURN_TRUSTED_TYPE||!1,Su=U.FORCE_BODY||!1,up=U.SANITIZE_DOM!==!1,hp=U.SANITIZE_NAMED_PROPS||!1,Tu=U.KEEP_CONTENT!==!1,uo=U.IN_PLACE||!1,$t=U.ALLOWED_URI_REGEXP||Pd,es=U.NAMESPACE||Or,ul=U.MATHML_TEXT_INTEGRATION_POINTS||ul,hl=U.HTML_INTEGRATION_POINTS||hl,Me=U.CUSTOM_ELEMENT_HANDLING||{},U.CUSTOM_ELEMENT_HANDLING&&gp(U.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Me.tagNameCheck=U.CUSTOM_ELEMENT_HANDLING.tagNameCheck),U.CUSTOM_ELEMENT_HANDLING&&gp(U.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Me.attributeNameCheck=U.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),U.CUSTOM_ELEMENT_HANDLING&&typeof U.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Me.allowCustomizedBuiltInElements=U.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Jn&&(wu=!1),ol&&(Zn=!0),Qn&&(re=pe({},Rd),ke=[],Qn.html===!0&&(pe(re,Dd),pe(ke,Md)),Qn.svg===!0&&(pe(re,jc),pe(ke,zc),pe(ke,Ua)),Qn.svgFilters===!0&&(pe(re,Hc),pe(ke,zc),pe(ke,Ua)),Qn.mathMl===!0&&(pe(re,qc),pe(ke,Od),pe(ke,Ua))),U.ADD_TAGS&&(re===Je&&(re=vn(re)),pe(re,U.ADD_TAGS,pi)),U.ADD_ATTR&&(ke===xi&&(ke=vn(ke)),pe(ke,U.ADD_ATTR,pi)),U.ADD_URI_SAFE_ATTR&&pe(xu,U.ADD_URI_SAFE_ATTR,pi),U.FORBID_CONTENTS&&(ts===dp&&(ts=vn(ts)),pe(ts,U.FORBID_CONTENTS,pi)),Tu&&(re["#text"]=!0),Sn&&pe(re,["html","head","body"]),re.table&&(pe(re,["tbody"]),delete sr.tbody),U.TRUSTED_TYPES_POLICY){if(typeof U.TRUSTED_TYPES_POLICY.createHTML!="function")throw to('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof U.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw to('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');vt=U.TRUSTED_TYPES_POLICY,jt=vt.createHTML("")}else vt===void 0&&(vt=vb(rt,c)),vt!==null&&typeof jt=="string"&&(jt=vt.createHTML(""));He&&He(U),is=U}},bp=pe({},[...jc,...Hc,...ab]),vp=pe({},[...qc,...lb]),xy=function(U){let Mt=Ct(U);(!Mt||!Mt.tagName)&&(Mt={namespaceURI:es,tagName:"template"});let Ut=Kr(U.tagName),qe=Kr(Mt.tagName);return ku[U.namespaceURI]?U.namespaceURI===cl?Mt.namespaceURI===Or?Ut==="svg":Mt.namespaceURI===ll?Ut==="svg"&&(qe==="annotation-xml"||ul[qe]):!!bp[Ut]:U.namespaceURI===ll?Mt.namespaceURI===Or?Ut==="math":Mt.namespaceURI===cl?Ut==="math"&&hl[qe]:!!vp[Ut]:U.namespaceURI===Or?Mt.namespaceURI===cl&&!hl[qe]||Mt.namespaceURI===ll&&!ul[qe]?!1:!vp[Ut]&&(Ey[Ut]||!bp[Ut]):!!(ho==="application/xhtml+xml"&&ku[U.namespaceURI]):!1},Er=function(U){yr(e.removed,{element:U});try{Ct(U).removeChild(U)}catch(Mt){mt(U)}},dl=function(U,Mt){try{yr(e.removed,{attribute:Mt.getAttributeNode(U),from:Mt})}catch(Ut){yr(e.removed,{attribute:null,from:Mt})}if(Mt.removeAttribute(U),U==="is")if(Zn||ol)try{Er(Mt)}catch(Ut){}else try{Mt.setAttribute(U,"")}catch(Ut){}},yp=function(U){let Mt=null,Ut=null;if(Su)U=""+U;else{let Ei=Qs(U,/^[\r\n\t ]+/);Ut=Ei&&Ei[0]}ho==="application/xhtml+xml"&&es===Or&&(U=''+U+"");let qe=vt?vt.createHTML(U):U;if(es===Or)try{Mt=new at().parseFromString(qe,ho)}catch(Ei){}if(!Mt||!Mt.documentElement){Mt=Ht.createDocument(es,"template",null);try{Mt.documentElement.innerHTML=Cu?jt:qe}catch(Ei){}}let Ci=Mt.body||Mt.documentElement;return U&&Ut&&Ci.insertBefore(n.createTextNode(Ut),Ci.childNodes[0]||null),es===Or?Gt.call(Mt,Sn?"html":"body")[0]:Sn?Mt.documentElement:Ci},wp=function(U){return Vt.call(U.ownerDocument||U,U,_.SHOW_ELEMENT|_.SHOW_COMMENT|_.SHOW_TEXT|_.SHOW_PROCESSING_INSTRUCTION|_.SHOW_CDATA_SECTION,null)},_u=function(U){return U instanceof q&&(typeof U.nodeName!="string"||typeof U.textContent!="string"||typeof U.removeChild!="function"||!(U.attributes instanceof O)||typeof U.removeAttribute!="function"||typeof U.setAttribute!="function"||typeof U.namespaceURI!="string"||typeof U.insertBefore!="function"||typeof U.hasChildNodes!="function")},Ep=function(U){return typeof S=="function"&&U instanceof S};function Pr(Jt,U,Mt){ci(Jt,Ut=>{Ut.call(e,U,Mt,is)})}let Ap=function(U){let Mt=null;if(Pr(ae.beforeSanitizeElements,U,null),_u(U))return Er(U),!0;let Ut=pi(U.nodeName);if(Pr(ae.uponSanitizeElement,U,{tagName:Ut,allowedTags:re}),U.hasChildNodes()&&!Ep(U.firstElementChild)&&vi(/<[/\w]/g,U.innerHTML)&&vi(/<[/\w]/g,U.textContent)||U.nodeType===io.progressingInstruction||Eu&&U.nodeType===io.comment&&vi(/<[/\w]/g,U.data))return Er(U),!0;if(!re[Ut]||sr[Ut]){if(!sr[Ut]&&Tp(Ut)&&(Me.tagNameCheck instanceof RegExp&&vi(Me.tagNameCheck,Ut)||Me.tagNameCheck instanceof Function&&Me.tagNameCheck(Ut)))return!1;if(Tu&&!ts[Ut]){let qe=Ct(U)||U.parentNode,Ci=ut(U)||U.childNodes;if(Ci&&qe){let Ei=Ci.length;for(let Fi=Ei-1;Fi>=0;--Fi){let Ar=ct(Ci[Fi],!0);Ar.__removalCount=(U.__removalCount||0)+1,qe.insertBefore(Ar,yt(U))}}}return Er(U),!0}return U instanceof x&&!xy(U)||(Ut==="noscript"||Ut==="noembed"||Ut==="noframes")&&vi(/<\/no(script|embed|frames)/i,U.innerHTML)?(Er(U),!0):(Jn&&U.nodeType===io.text&&(Mt=U.textContent,ci([ii,Ri,fi],qe=>{Mt=Jr(Mt,qe," ")}),U.textContent!==Mt&&(yr(e.removed,{element:U.cloneNode()}),U.textContent=Mt)),Pr(ae.afterSanitizeElements,U,null),!1)},Sp=function(U,Mt,Ut){if(up&&(Mt==="id"||Mt==="name")&&(Ut in n||Ut in Ty))return!1;if(!(wu&&!or[Mt]&&vi(wi,Mt))){if(!(ap&&vi(Dt,Mt))){if(!ke[Mt]||or[Mt]){if(!(Tp(U)&&(Me.tagNameCheck instanceof RegExp&&vi(Me.tagNameCheck,U)||Me.tagNameCheck instanceof Function&&Me.tagNameCheck(U))&&(Me.attributeNameCheck instanceof RegExp&&vi(Me.attributeNameCheck,Mt)||Me.attributeNameCheck instanceof Function&&Me.attributeNameCheck(Mt))||Mt==="is"&&Me.allowCustomizedBuiltInElements&&(Me.tagNameCheck instanceof RegExp&&vi(Me.tagNameCheck,Ut)||Me.tagNameCheck instanceof Function&&Me.tagNameCheck(Ut))))return!1}else if(!xu[Mt]){if(!vi($t,Jr(Ut,Ft,""))){if(!((Mt==="src"||Mt==="xlink:href"||Mt==="href")&&U!=="script"&&za(Ut,"data:")===0&&fp[U])){if(!(lp&&!vi(_t,Jr(Ut,Ft,"")))){if(Ut)return!1}}}}}}return!0},Tp=function(U){return U!=="annotation-xml"&&Qs(U,ue)},xp=function(U){Pr(ae.beforeSanitizeAttributes,U,null);let{attributes:Mt}=U;if(!Mt||_u(U))return;let Ut={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ke,forceKeepAttr:void 0},qe=Mt.length;for(;qe--;){let Ci=Mt[qe],{name:Ei,namespaceURI:Fi,value:Ar}=Ci,fo=pi(Ei),Mi=Ei==="value"?Ar:Wa(Ar);if(Ut.attrName=fo,Ut.attrValue=Mi,Ut.keepAttr=!0,Ut.forceKeepAttr=void 0,Pr(ae.uponSanitizeAttribute,U,Ut),Mi=Ut.attrValue,hp&&(fo==="id"||fo==="name")&&(dl(Ei,U),Mi=yy+Mi),Eu&&vi(/((--!?|])>)|<\/(style|title)/i,Mi)){dl(Ei,U);continue}if(Ut.forceKeepAttr||(dl(Ei,U),!Ut.keepAttr))continue;if(!cp&&vi(/\/>/i,Mi)){dl(Ei,U);continue}Jn&&ci([ii,Ri,fi],kp=>{Mi=Jr(Mi,kp," ")});let Cp=pi(U.nodeName);if(Sp(Cp,fo,Mi)){if(vt&&typeof rt=="object"&&typeof rt.getAttributeType=="function"&&!Fi)switch(rt.getAttributeType(Cp,fo)){case"TrustedHTML":{Mi=vt.createHTML(Mi);break}case"TrustedScriptURL":{Mi=vt.createScriptURL(Mi);break}}try{Fi?U.setAttributeNS(Fi,Ei,Mi):U.setAttribute(Ei,Mi),_u(U)?Er(U):vr(e.removed)}catch(kp){}}}Pr(ae.afterSanitizeAttributes,U,null)},Cy=function Jt(U){let Mt=null,Ut=wp(U);for(Pr(ae.beforeSanitizeShadowDOM,U,null);Mt=Ut.nextNode();)Pr(ae.uponSanitizeShadowNode,Mt,null),Ap(Mt),xp(Mt),Mt.content instanceof h&&Jt(Mt.content);Pr(ae.afterSanitizeShadowDOM,U,null)};return e.sanitize=function(Jt){let U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Mt=null,Ut=null,qe=null,Ci=null;if(Cu=!Jt,Cu&&(Jt=""),typeof Jt!="string"&&!Ep(Jt))if(typeof Jt.toString=="function"){if(Jt=Jt.toString(),typeof Jt!="string")throw to("dirty is not a string, aborting")}else throw to("toString is not a function");if(!e.isSupported)return Jt;if(Au||Lu(U),e.removed=[],typeof Jt=="string"&&(uo=!1),uo){if(Jt.nodeName){let Ar=pi(Jt.nodeName);if(!re[Ar]||sr[Ar])throw to("root node is forbidden and cannot be sanitized in-place")}}else if(Jt instanceof S)Mt=yp(""),Ut=Mt.ownerDocument.importNode(Jt,!0),Ut.nodeType===io.element&&Ut.nodeName==="BODY"||Ut.nodeName==="HTML"?Mt=Ut:Mt.appendChild(Ut);else{if(!Zn&&!Jn&&!Sn&&Jt.indexOf("<")===-1)return vt&&al?vt.createHTML(Jt):Jt;if(Mt=yp(Jt),!Mt)return Zn?null:al?jt:""}Mt&&Su&&Er(Mt.firstChild);let Ei=wp(uo?Jt:Mt);for(;qe=Ei.nextNode();)Ap(qe),xp(qe),qe.content instanceof h&&Cy(qe.content);if(uo)return Jt;if(Zn){if(ol)for(Ci=fe.call(Mt.ownerDocument);Mt.firstChild;)Ci.appendChild(Mt.firstChild);else Ci=Mt;return(ke.shadowroot||ke.shadowrootmode)&&(Ci=te.call(a,Ci,!0)),Ci}let Fi=Sn?Mt.outerHTML:Mt.innerHTML;return Sn&&re["!doctype"]&&Mt.ownerDocument&&Mt.ownerDocument.doctype&&Mt.ownerDocument.doctype.name&&vi(Id,Mt.ownerDocument.doctype.name)&&(Fi=" `+Fi),Jn&&ci([ii,Ri,fi],Ar=>{Fi=Jr(Fi,Ar," ")}),vt&&al?vt.createHTML(Fi):Fi},e.setConfig=function(){let Jt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Lu(Jt),Au=!0},e.clearConfig=function(){is=null,Au=!1},e.isValidAttribute=function(Jt,U,Mt){is||Lu({});let Ut=pi(Jt),qe=pi(U);return Sp(Ut,qe,Mt)},e.addHook=function(Jt,U){typeof U=="function"&&yr(ae[Jt],U)},e.removeHook=function(Jt){return vr(ae[Jt])},e.removeHooks=function(Jt){ae[Jt]=[]},e.removeAllHooks=function(){ae=Fd()},e}var Va=Bd();Va.addHook("uponSanitizeAttribute",function(o,e){/^data-trix-/.test(e.attrName)&&(e.forceKeepAttr=!0)});let yb="style href src width height language class".split(" "),wb="javascript:".split(" "),Eb="script iframe form noscript".split(" ");class $a extends qt{static setHTML(e,n){let a=new this(n).sanitize(),c=a.getHTML?a.getHTML():a.outerHTML;e.innerHTML=c}static sanitize(e,n){let a=new this(e,n);return a.sanitize(),a}constructor(e){let{allowedAttributes:n,forbiddenProtocols:a,forbiddenElements:c}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(...arguments),this.allowedAttributes=n||yb,this.forbiddenProtocols=a||wb,this.forbiddenElements=c||Eb,this.body=Ab(e)}sanitize(){return this.sanitizeElements(),this.normalizeListElementNesting(),Va.setConfig(Qt),this.body=Va.sanitize(this.body),this.body}getHTML(){return this.body.innerHTML}getBody(){return this.body}sanitizeElements(){let e=k(this.body),n=[];for(;e.nextNode();){let a=e.currentNode;switch(a.nodeType){case Node.ELEMENT_NODE:this.elementIsRemovable(a)?n.push(a):this.sanitizeElement(a);break;case Node.COMMENT_NODE:n.push(a);break}}return n.forEach(a=>P(a)),this.body}sanitizeElement(e){return e.hasAttribute("href")&&this.forbiddenProtocols.includes(e.protocol)&&e.removeAttribute("href"),Array.from(e.attributes).forEach(n=>{let{name:a}=n;!this.allowedAttributes.includes(a)&&a.indexOf("data-trix")!==0&&e.removeAttribute(a)}),e}normalizeListElementNesting(){return Array.from(this.body.querySelectorAll("ul,ol")).forEach(e=>{let n=e.previousElementSibling;n&&p(n)==="li"&&n.appendChild(e)}),this.body}elementIsRemovable(e){if((e==null?void 0:e.nodeType)===Node.ELEMENT_NODE)return this.elementIsForbidden(e)||this.elementIsntSerializable(e)}elementIsForbidden(e){return this.forbiddenElements.includes(p(e))}elementIsntSerializable(e){return e.getAttribute("data-trix-serialize")==="false"&&!zi(e)}}let Ab=function(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";o=o.replace(/<\/html[^>]*>[^]*$/i,"");let e=document.implementation.createHTMLDocument("");return e.documentElement.innerHTML=o,Array.from(e.head.querySelectorAll("style")).forEach(n=>{e.body.appendChild(n)}),e.body},{css:Zr}=Pi;class Wc extends Re{constructor(){super(...arguments),this.attachment=this.object,this.attachment.uploadProgressDelegate=this,this.attachmentPiece=this.options.piece}createContentNodes(){return[]}createNodes(){let e,n=e=d({tagName:"figure",className:this.getClassName(),data:this.getData(),editable:!1}),a=this.getHref();return a&&(e=d({tagName:"a",editable:!1,attributes:{href:a,tabindex:-1}}),n.appendChild(e)),this.attachment.hasContent()?$a.setHTML(e,this.attachment.getContent()):this.createContentNodes().forEach(c=>{e.appendChild(c)}),e.appendChild(this.createCaptionElement()),this.attachment.isPending()&&(this.progressElement=d({tagName:"progress",attributes:{class:Zr.attachmentProgress,value:this.attachment.getUploadProgress(),max:100},data:{trixMutable:!0,trixStoreKey:["progressElement",this.attachment.id].join("/")}}),n.appendChild(this.progressElement)),[jd("left"),n,jd("right")]}createCaptionElement(){let e=d({tagName:"figcaption",className:Zr.attachmentCaption}),n=this.attachmentPiece.getCaption();if(n)e.classList.add("".concat(Zr.attachmentCaption,"--edited")),e.textContent=n;else{let a,c,h=this.getCaptionConfig();if(h.name&&(a=this.attachment.getFilename()),h.size&&(c=this.attachment.getFormattedFilesize()),a){let g=d({tagName:"span",className:Zr.attachmentName,textContent:a});e.appendChild(g)}if(c){a&&e.appendChild(document.createTextNode(" "));let g=d({tagName:"span",className:Zr.attachmentSize,textContent:c});e.appendChild(g)}}return e}getClassName(){let e=[Zr.attachment,"".concat(Zr.attachment,"--").concat(this.attachment.getType())],n=this.attachment.getExtension();return n&&e.push("".concat(Zr.attachment,"--").concat(n)),e.join(" ")}getData(){let e={trixAttachment:JSON.stringify(this.attachment),trixContentType:this.attachment.getContentType(),trixId:this.attachment.id},{attributes:n}=this.attachmentPiece;return n.isEmpty()||(e.trixAttributes=JSON.stringify(n)),this.attachment.isPending()&&(e.trixSerialize=!1),e}getHref(){if(!Sb(this.attachment.getContent(),"a"))return this.attachment.getHref()}getCaptionConfig(){var e;let n=this.attachment.getType(),a=Na((e=I[n])===null||e===void 0?void 0:e.caption);return n==="file"&&(a.name=!0),a}findProgressElement(){var e;return(e=this.findElement())===null||e===void 0?void 0:e.querySelector("progress")}attachmentDidChangeUploadProgress(){let e=this.attachment.getUploadProgress(),n=this.findProgressElement();n&&(n.value=e)}}let jd=o=>d({tagName:"span",textContent:G,data:{trixCursorTarget:o,trixSerialize:!1}}),Sb=function(o,e){let n=d("div");return $a.setHTML(n,o||""),n.querySelector(e)};class Hd extends Wc{constructor(){super(...arguments),this.attachment.previewDelegate=this}createContentNodes(){return this.image=d({tagName:"img",attributes:{src:""},data:{trixMutable:!0}}),this.refresh(this.image),[this.image]}createCaptionElement(){let e=super.createCaptionElement(...arguments);return e.textContent||e.setAttribute("data-trix-placeholder",At.captionPlaceholder),e}refresh(e){if(!e){var n;e=(n=this.findElement())===null||n===void 0?void 0:n.querySelector("img")}if(e)return this.updateAttributesForImage(e)}updateAttributesForImage(e){let n=this.attachment.getURL(),a=this.attachment.getPreviewURL();if(e.src=a||n,a===n)e.removeAttribute("data-trix-serialized-attributes");else{let S=JSON.stringify({src:n});e.setAttribute("data-trix-serialized-attributes",S)}let c=this.attachment.getWidth(),h=this.attachment.getHeight();c!=null&&(e.width=c),h!=null&&(e.height=h);let g=["imageElement",this.attachment.id,e.src,e.width,e.height].join("/");e.dataset.trixStoreKey=g}attachmentDidChangeAttributes(){return this.refresh(this.image),this.refresh()}}class qd extends Re{constructor(){super(...arguments),this.piece=this.object,this.attributes=this.piece.getAttributes(),this.textConfig=this.options.textConfig,this.context=this.options.context,this.piece.attachment?this.attachment=this.piece.attachment:this.string=this.piece.toString()}createNodes(){let e=this.attachment?this.createAttachmentNodes():this.createStringNodes(),n=this.createElement();if(n){let a=Nt(n);Array.from(e).forEach(c=>{a.appendChild(c)}),e=[n]}return e}createAttachmentNodes(){let e=this.attachment.isPreviewable()?Hd:Wc;return this.createChildView(e,this.piece.attachment,{piece:this.piece}).getNodes()}createStringNodes(){var e;if((e=this.textConfig)!==null&&e!==void 0&&e.plaintext)return[document.createTextNode(this.string)];{let n=[],a=this.string.split(` `);for(let c=0;c0){let g=d("br");n.push(g)}if(h.length){let g=document.createTextNode(this.preserveSpaces(h));n.push(g)}}return n}}createElement(){let e,n,a,c={};for(n in this.attributes){a=this.attributes[n];let g=zn(n);if(g){if(g.tagName){var h;let S=d(g.tagName);h?(h.appendChild(S),h=S):e=h=S}if(g.styleProperty&&(c[g.styleProperty]=a),g.style)for(n in g.style)a=g.style[n],c[n]=a}}if(Object.keys(c).length){e||(e=d("span"));for(n in c)a=c[n],e.style[n]=a}return e}createContainerElement(){for(let e in this.attributes){let n=this.attributes[e],a=zn(e);if(a&&a.groupTagName){let c={};return c[e]=n,d(a.groupTagName,c)}}}preserveSpaces(e){return this.context.isLast&&(e=e.replace(/\ $/,C)),e=e.replace(/(\S)\ {3}(\S)/g,"$1 ".concat(C," $2")).replace(/\ {2}/g,"".concat(C," ")).replace(/\ {2}/g," ".concat(C)),(this.context.isFirst||this.context.followsWhitespace)&&(e=e.replace(/^\ /,C)),e}}class zd extends Re{constructor(){super(...arguments),this.text=this.object,this.textConfig=this.options.textConfig}createNodes(){let e=[],n=de.groupObjects(this.getPieces()),a=n.length-1;for(let h=0;h!e.hasAttribute("blockBreak"))}}let Tb=o=>/\s$/.test(o==null?void 0:o.toString()),{css:Wd}=Pi;class Ud extends Re{constructor(){super(...arguments),this.block=this.object,this.attributes=this.block.getAttributes()}createNodes(){let n=[document.createComment("block")];if(this.block.isEmpty())n.push(d("br"));else{var a;let c=(a=ye(this.block.getLastAttribute()))===null||a===void 0?void 0:a.text,h=this.findOrCreateCachedChildView(zd,this.block.text,{textConfig:c});n.push(...Array.from(h.getNodes()||[])),this.shouldAddExtraNewlineElement()&&n.push(d("br"))}if(this.attributes.length)return n;{let c,{tagName:h}=V.default;this.block.isRTL()&&(c={dir:"rtl"});let g=d({tagName:h,attributes:c});return n.forEach(S=>g.appendChild(S)),[g]}}createContainerElement(e){let n={},a,c=this.attributes[e],{tagName:h,htmlAttributes:g=[]}=ye(c);if(e===0&&this.block.isRTL()&&Object.assign(n,{dir:"rtl"}),c==="attachmentGallery"){let S=this.block.getBlockBreakPosition();a="".concat(Wd.attachmentGallery," ").concat(Wd.attachmentGallery,"--").concat(S)}return Object.entries(this.block.htmlAttributes).forEach(S=>{let[x,_]=S;g.includes(x)&&(n[x]=_)}),d({tagName:h,className:a,attributes:n})}shouldAddExtraNewlineElement(){return/\n\n$/.test(this.block.toString())}}class Xa extends Re{static render(e){let n=d("div"),a=new this(e,{element:n});return a.render(),a.sync(),n}constructor(){super(...arguments),this.element=this.options.element,this.elementStore=new Ae,this.setDocument(this.object)}setDocument(e){e.isEqualTo(this.document)||(this.document=this.object=e)}render(){if(this.childViews=[],this.shadowElement=d("div"),!this.document.isEmpty()){let e=de.groupObjects(this.document.getBlocks(),{asTree:!0});Array.from(e).forEach(n=>{let a=this.findOrCreateCachedChildView(Ud,n);Array.from(a.getNodes()).map(c=>this.shadowElement.appendChild(c))})}}isSynced(){return xb(this.shadowElement,this.element)}sync(){let e=this.createDocumentFragmentForSync();for(;this.element.lastChild;)this.element.removeChild(this.element.lastChild);return this.element.appendChild(e),this.didSync()}didSync(){return this.elementStore.reset(Vd(this.element)),Js(()=>this.garbageCollectCachedViews())}createDocumentFragmentForSync(){let e=document.createDocumentFragment();return Array.from(this.shadowElement.childNodes).forEach(n=>{e.appendChild(n.cloneNode(!0))}),Array.from(Vd(e)).forEach(n=>{let a=this.elementStore.remove(n);a&&n.parentNode.replaceChild(a,n)}),e}}let Vd=o=>o.querySelectorAll("[data-trix-store-key]"),xb=(o,e)=>$d(o.innerHTML)===$d(e.innerHTML),$d=o=>o.replace(/ /g," ");function ro(o){var e,n;function a(h,g){try{var S=o[h](g),x=S.value,_=x instanceof Uc;Promise.resolve(_?x.v:x).then(function(O){if(_){var q=h==="return"?"return":"next";if(!x.k||O.done)return a(q,O);O=o[q](O).value}c(S.done?"return":"normal",O)},function(O){a("throw",O)})}catch(O){c("throw",O)}}function c(h,g){switch(h){case"return":e.resolve({value:g,done:!0});break;case"throw":e.reject(g);break;default:e.resolve({value:g,done:!1})}(e=e.next)?a(e.key,e.arg):n=null}this._invoke=function(h,g){return new Promise(function(S,x){var _={key:h,arg:g,resolve:S,reject:x,next:null};n?n=n.next=_:(e=n=_,a(h,g))})},typeof o.return!="function"&&(this.return=void 0)}ro.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},ro.prototype.next=function(o){return this._invoke("next",o)},ro.prototype.throw=function(o){return this._invoke("throw",o)},ro.prototype.return=function(o){return this._invoke("return",o)};function Uc(o,e){this.v=o,this.k=e}function Xd(o,e,n,a){return{getMetadata:function(c){Vc(a,"getMetadata"),Jd(c);var h=o[c];if(h!==void 0){if(e===1){var g=h.public;if(g!==void 0)return g[n]}else if(e===2){var S=h.private;if(S!==void 0)return S.get(n)}else if(Object.hasOwnProperty.call(h,"constructor"))return h.constructor}},setMetadata:function(c,h){Vc(a,"setMetadata"),Jd(c);var g=o[c];if(g===void 0&&(g=o[c]={}),e===1){var S=g.public;S===void 0&&(S=g.public={}),S[n]=h}else if(e===2){var x=g.priv;x===void 0&&(x=g.private=new Map),x.set(n,h)}else g.constructor=h}}}function Yd(o,e){var n=o[Symbol.metadata||Symbol.for("Symbol.metadata")],a=Object.getOwnPropertySymbols(e);if(a.length!==0){for(var c=0;c=0;mt--){var yt;(at=Kd(ct[mt],a,_,S,x,c,h,g,q))!==void 0&&($c(c,at),c===0?yt=at:c===1?(yt=Zd(at),rt=at.get||q.get,pt=at.set||q.set,q={get:rt,set:pt}):q=at,yt!==void 0&&(O===void 0?O=yt:typeof O=="function"?O=[O,yt]:O.push(yt)))}if(c===0||c===1){if(O===void 0)O=function(vt,jt){return jt};else if(typeof O!="function"){var ut=O;O=function(vt,jt){for(var Ht=jt,Vt=0;Vt3,yt=pt>=5;if(yt?(q=e,at=a,(pt-=5)!==0&&(rt=g=g||[])):(q=e.prototype,at=n,pt!==0&&(rt=h=h||[])),pt!==0&&!mt){var ut=yt?x:S,Ct=ut.get(ct)||0;if(Ct===!0||Ct===3&&pt!==4||Ct===4&&pt!==3)throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+ct);!Ct&&pt>2?ut.set(ct,pt):ut.set(ct,!0)}Cb(o,q,O,ct,pt,yt,mt,at,rt)}}Qd(o,h),Qd(o,g)}function Qd(o,e){e&&o.push(function(n){for(var a=0;a0){for(var c=[],h=e,g=e.name,S=a.length-1;S>=0;S--){var x={v:!1};try{var _=Object.assign({kind:"class",name:g,addInitializer:Gd(c,x)},Xd(n,0,g,x)),O=a[S](h,_)}finally{x.v=!0}O!==void 0&&($c(10,O),h=O)}o.push(h,function(){for(var q=0;q=0;jt--){var Ht;(yt=e(vt[jt],_,pt,rt,O,q,at,mt))!==void 0&&(a(O,yt),O===0?Ht=yt:O===1?(Ht=yt.init,ut=yt.get||mt.get,Ct=yt.set||mt.set,mt={get:ut,set:Ct}):mt=yt,Ht!==void 0&&(ct===void 0?ct=Ht:typeof ct=="function"?ct=[ct,Ht]:ct.push(Ht)))}if(O===0||O===1){if(ct===void 0)ct=function(Gt,te){return te};else if(typeof ct!="function"){var Vt=ct;ct=function(Gt,te){for(var ae=te,ii=0;ii3,fe=jt>=5;if(fe?(Ct=q,(jt-=5)!=0&&(vt=pt=pt||[])):(Ct=q.prototype,jt!==0&&(vt=rt=rt||[])),jt!==0&&!Vt){var Gt=fe?mt:ct,te=Gt.get(Ht)||0;if(te===!0||te===3&&jt!==4||te===4&&jt!==3)throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+Ht);!te&&jt>2?Gt.set(Ht,jt):Gt.set(Ht,!0)}c(O,Ct,ut,Ht,jt,fe,Vt,vt)}}h(O,rt),h(O,pt)}(_,g,S),function(O,q,at){if(at.length>0){for(var rt=[],pt=q,ct=q.name,mt=at.length-1;mt>=0;mt--){var yt={v:!1};try{var ut=at[mt](pt,{kind:"class",name:ct,addInitializer:o(rt,yt)})}finally{yt.v=!0}ut!==void 0&&(a(10,ut),pt=ut)}O.push(pt,function(){for(var Ct=0;Ct=0;Ht--){var Vt;(ut=e(jt[Ht],O,ct,pt,q,at,rt,yt))!==void 0&&(a(q,ut),q===0?Vt=ut:q===1?(Vt=ut.init,Ct=ut.get||yt.get,vt=ut.set||yt.set,yt={get:Ct,set:vt}):yt=ut,Vt!==void 0&&(mt===void 0?mt=Vt:typeof mt=="function"?mt=[mt,Vt]:mt.push(Vt)))}if(q===0||q===1){if(mt===void 0)mt=function(te,ae){return ae};else if(typeof mt!="function"){var fe=mt;mt=function(te,ae){for(var ii=ae,Ri=0;Ri3,jt=ut>=5;if(jt?(mt=S,(ut-=5)!==0&&(yt=O=O||[])):(mt=S.prototype,ut!==0&&(yt=_=_||[])),ut!==0&&!vt){var Ht=jt?rt:at,Vt=Ht.get(Ct)||0;if(Vt===!0||Vt===3&&ut!==4||Vt===4&&ut!==3)throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+Ct);!Vt&&ut>2?Ht.set(Ct,ut):Ht.set(Ct,!0)}c(q,mt,ct,Ct,ut,jt,vt,yt)}}return g(q,_),g(q,O),q}function g(S,x){x&&S.push(function(_){for(var O=0;O0){for(var at=[],rt=O,pt=O.name,ct=q.length-1;ct>=0;ct--){var mt={v:!1};try{var yt=q[ct](rt,{kind:"class",name:pt,addInitializer:o(at,mt)})}finally{mt.v=!0}yt!==void 0&&(a(10,yt),rt=yt)}return[rt,function(){for(var ut=0;ut=0;te--){var ae;(Ht=n(Gt[te],at,ut,mt,rt,pt,ct,vt,yt))!==void 0&&(c(rt,Ht),rt===0?ae=Ht:rt===1?(ae=Ht.init,Vt=Ht.get||vt.get,fe=Ht.set||vt.set,vt={get:Vt,set:fe}):vt=Ht,ae!==void 0&&(Ct===void 0?Ct=ae:typeof Ct=="function"?Ct=[Ct,ae]:Ct.push(ae)))}if(rt===0||rt===1){if(Ct===void 0)Ct=function(fi,wi){return wi};else if(typeof Ct!="function"){var ii=Ct;Ct=function(fi,wi){for(var Dt=wi,_t=0;_t3,Gt=Ht>=5,te=q;if(Gt?(vt=_,(Ht-=5)!==0&&(jt=rt=rt||[]),fe&&!pt&&(pt=function(Ri){return of(Ri)===_}),te=pt):(vt=_.prototype,Ht!==0&&(jt=at=at||[])),Ht!==0&&!fe){var ae=Gt?yt:mt,ii=ae.get(Vt)||0;if(ii===!0||ii===3&&Ht!==4||ii===4&&Ht!==3)throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+Vt);!ii&&Ht>2?ae.set(Vt,Ht):ae.set(Vt,!0)}g(ct,vt,Ct,Vt,Ht,Gt,fe,jt,te)}}return x(ct,at),x(ct,rt),ct}function x(_,O){O&&_.push(function(q){for(var at=0;at0){for(var ct=[],mt=rt,yt=rt.name,ut=pt.length-1;ut>=0;ut--){var Ct={v:!1};try{var vt=pt[ut](mt,{kind:"class",name:yt,addInitializer:o(ct,Ct)})}finally{Ct.v=!0}vt!==void 0&&(c(10,vt),mt=vt)}return[mt,function(){for(var jt=0;jt=0;Ct-=ut){var vt;(pt=Pb(yt[Ct],a?yt[Ct-1]:void 0,c,q,x,h,g,S,rt,_,O))!==void 0&&(rf(h,pt),h===0?vt=pt:h===1?(vt=pt.init,ct=pt.get||rt.get,mt=pt.set||rt.set,rt={get:ct,set:mt}):rt=pt,vt!==void 0&&(at===void 0?at=vt:typeof at=="function"?at=[at,vt]:at.push(vt)))}if(h===0||h===1){if(at===void 0)at=function(Vt,fe){return fe};else if(typeof at!="function"){var jt=at;at=function(Vt,fe){for(var Gt=fe,te=jt.length-1;te>=0;te--)Gt=jt[te].call(Vt,Gt);return Gt}}else{var Ht=at;at=function(Vt,fe){return Ht.call(Vt,fe)}}o.push(at)}h!==0&&(h===1?(q.get=rt.get,q.set=rt.set):h===2?q.value=rt:h===3?q.get=rt:h===4&&(q.set=rt),S?h===1?(o.push(function(Vt,fe){return rt.get.call(Vt,fe)}),o.push(function(Vt,fe){return rt.set.call(Vt,fe)})):h===2?o.push(rt):o.push(function(Vt,fe){return rt.call(Vt,fe)}):Object.defineProperty(e,c,q))}function jb(o,e,n,a){for(var c,h,g,S=[],x=new Map,_=new Map,O=0;O3,yt=16&pt,ut=!!(8&pt),Ct=n;if(pt&=7,ut?(at=o,pt!==0&&(rt=h=h||[]),mt&&!g&&(g=function(Ht){return of(Ht)===o}),Ct=g):(at=o.prototype,pt!==0&&(rt=c=c||[])),pt!==0&&!mt){var vt=ut?_:x,jt=vt.get(ct)||0;if(jt===!0||jt===3&&pt!==4||jt===4&&pt!==3)throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+ct);vt.set(ct,!(!jt&&pt>2)||pt)}Bb(S,at,q,yt,ct,pt,ut,mt,rt,Ct,a)}}return nf(S,c),nf(S,h),S}function nf(o,e){e&&o.push(function(n){for(var a=0;a=0;x-=S){var _={v:!1};try{var O=e[x].call(n?e[x-1]:void 0,h,{kind:"class",name:g,addInitializer:ef(c,_),metadata:a})}finally{_.v=!0}O!==void 0&&(rf(5,O),h=O)}return[sf(h,a),function(){for(var q=0;q=6)var g=h[Symbol.metadata||Symbol.for("Symbol.metadata")];var S=Object.create(g===void 0?null:g),x=jb(o,e,c,S);return n.length||sf(o,S),{e:x,get c(){return Hb(o,n,a,S)}}}function T0(o){var e={},n=!1;function a(c,h){return n=!0,h=new Promise(function(g){g(o[c](h))}),{done:!1,value:new Uc(h,1)}}return e[typeof Symbol!="undefined"&&Symbol.iterator||"@@iterator"]=function(){return this},e.next=function(c){return n?(n=!1,c):a("next",c)},typeof o.throw=="function"&&(e.throw=function(c){if(n)throw n=!1,c;return a("throw",c)}),typeof o.return=="function"&&(e.return=function(c){return n?(n=!1,c):a("return",c)}),e}function x0(o){var e,n,a,c=2;for(typeof Symbol!="undefined"&&(n=Symbol.asyncIterator,a=Symbol.iterator);c--;){if(n&&(e=o[n])!=null)return e.call(o);if(a&&(e=o[a])!=null)return new Ga(e.call(o));n="@@asyncIterator",a="@@iterator"}throw new TypeError("Object is not async iterable")}function Ga(o){function e(n){if(Object(n)!==n)return Promise.reject(new TypeError(n+" is not an object."));var a=n.done;return Promise.resolve(n.value).then(function(c){return{value:c,done:a}})}return Ga=function(n){this.s=n,this.n=n.next},Ga.prototype={s:null,n:null,next:function(){return e(this.n.apply(this.s,arguments))},return:function(n){var a=this.s.return;return a===void 0?Promise.resolve({value:n,done:!0}):e(a.apply(this.s,arguments))},throw:function(n){var a=this.s.return;return a===void 0?Promise.reject(n):e(a.apply(this.s,arguments))}},new Ga(o)}function C0(o){return new Uc(o,0)}function of(o){if(Object(o)!==o)throw TypeError("right-hand side of 'in' should be an object, got "+(o!==null?typeof o:"null"));return o}function k0(o,e,n,a){var c={configurable:!0,enumerable:!0};return c[o]=a,Object.defineProperty(e,n,c)}function Un(o,e){return typeof SuppressedError!="undefined"?Un=SuppressedError:(Un=function(n,a){this.suppressed=n,this.error=a,this.stack=new Error().stack},Un.prototype=Object.create(Error.prototype,{constructor:{value:Un,writable:!0,configurable:!0}})),new Un(o,e)}function L0(o,e,n){function a(){for(;o.length>0;)try{var h=o.pop(),g=h.d.call(h.v);if(h.a)return Promise.resolve(g).then(a,c)}catch(S){return c(S)}if(n)throw e}function c(h){return e=n?new Un(h,e):h,n=!0,a()}return a()}function _0(o){var e=null,n=function(c){return function(){return c}},a=function(c){return function(h,g,S){return e===null&&(e=o()),c(e,g,S)}};return new Proxy({},{defineProperty:n(!1),deleteProperty:n(!1),get:a(Reflect.get),getOwnPropertyDescriptor:a(Reflect.getOwnPropertyDescriptor),getPrototypeOf:n(null),isExtensible:n(!1),has:a(Reflect.has),ownKeys:a(Reflect.ownKeys),preventExtensions:n(!0),set:n(!1),setPrototypeOf:n(!1)})}function qb(o,e){var n=o==null?null:typeof Symbol!="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(n!=null){var a,c,h,g,S=[],x=!0,_=!1;try{if(h=(n=n.call(o)).next,e===0){if(Object(n)!==n)return;x=!1}else for(;!(x=(a=h.call(n)).done)&&(S.push(a.value),S.length!==e);x=!0);}catch(O){_=!0,c=O}finally{try{if(!x&&n.return!=null&&(g=n.return(),Object(g)!==g))return}finally{if(_)throw c}}return S}}function zb(o,e){var n=o&&(typeof Symbol!="undefined"&&o[Symbol.iterator]||o["@@iterator"]);if(n!=null){var a,c=[];for(n=n.call(o);o.length1){for(var g=new Array(h),S=0;S=0;--ue){var $t=this.tryEntries[ue],re=$t.completion;if($t.tryLoc==="root")return Ft("end");if($t.tryLoc<=this.prev){var Je=a.call($t,"catchLoc"),ke=a.call($t,"finallyLoc");if(Je&&ke){if(this.prev<$t.catchLoc)return Ft($t.catchLoc,!0);if(this.prev<$t.finallyLoc)return Ft($t.finallyLoc)}else if(Je){if(this.prev<$t.catchLoc)return Ft($t.catchLoc,!0)}else{if(!ke)throw new Error("try statement without catch or finally");if(this.prev<$t.finallyLoc)return Ft($t.finallyLoc)}}}},abrupt:function(Dt,_t){for(var Ft=this.tryEntries.length-1;Ft>=0;--Ft){var ue=this.tryEntries[Ft];if(ue.tryLoc<=this.prev&&a.call(ue,"finallyLoc")&&this.prev=0;--_t){var Ft=this.tryEntries[_t];if(Ft.finallyLoc===Dt)return this.complete(Ft.completion,Ft.afterLoc),Ri(Ft),mt}},catch:function(Dt){for(var _t=this.tryEntries.length-1;_t>=0;--_t){var Ft=this.tryEntries[_t];if(Ft.tryLoc===Dt){var ue=Ft.completion;if(ue.type==="throw"){var $t=ue.arg;Ri(Ft)}return $t}}throw new Error("illegal catch attempt")},delegateYield:function(Dt,_t,Ft){return this.delegate={iterator:wi(Dt),resultName:_t,nextLoc:Ft},this.method==="next"&&(this.arg=o),mt}},e}function lf(o){"@babel/helpers - typeof";return lf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},lf(o)}function M0(o,e,n){if(e==null)return e;if(typeof e!="object")throw new TypeError("using declarations can only be used with objects, null, or undefined.");if(n)var a=e[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(a==null&&(a=e[Symbol.dispose||Symbol.for("Symbol.dispose")]),typeof a!="function")throw new TypeError("Property [Symbol.dispose] is not a function.");return o.push({v:e,d:a,a:n}),e}function cf(){cf=function(c,h){return new n(c,void 0,h)};var o=RegExp.prototype,e=new WeakMap;function n(c,h,g){var S=new RegExp(c,h);return e.set(S,g||e.get(c)),yn(S,n.prototype)}function a(c,h){var g=e.get(h);return Object.keys(g).reduce(function(S,x){var _=g[x];if(typeof _=="number")S[x]=c[_];else{for(var O=0;c[_[O]]===void 0&&O+1<_.length;)O++;S[x]=c[_[O]]}return S},Object.create(null))}return Ub(n,RegExp),n.prototype.exec=function(c){var h=o.exec.call(this,c);if(h){h.groups=a(h,this);var g=h.indices;g&&(g.groups=a(g,this))}return h},n.prototype[Symbol.replace]=function(c,h){if(typeof h=="string"){var g=e.get(this);return o[Symbol.replace].call(this,c,h.replace(/\$<([^>]+)>/g,function(x,_){var O=g[_];return"$"+(Array.isArray(O)?O.join("$"):O)}))}if(typeof h=="function"){var S=this;return o[Symbol.replace].call(this,c,function(){var x=arguments;return typeof x[x.length-1]!="object"&&(x=[].slice.call(x)).push(a(x,S)),h.apply(this,x)})}return o[Symbol.replace].call(this,c,h)},cf.apply(this,arguments)}function O0(o){this.wrapped=o}function P0(o){return function(){return new ro(o.apply(this,arguments))}}function uf(o,e,n,a,c,h,g){try{var S=o[h](g),x=S.value}catch(_){n(_);return}S.done?e(x):Promise.resolve(x).then(a,c)}function I0(o){return function(){var e=this,n=arguments;return new Promise(function(a,c){var h=o.apply(e,n);function g(x){uf(h,a,c,g,S,"next",x)}function S(x){uf(h,a,c,g,S,"throw",x)}g(void 0)})}}function N0(o,e){if(!(o instanceof e))throw new TypeError("Cannot call a class as a function")}function hf(o,e){for(var n=0;n=0)&&(n[c]=o[c]);return n}function X0(o,e){if(o==null)return{};var n=$b(o,e),a,c;if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(o);for(c=0;c=0)&&Object.prototype.propertyIsEnumerable.call(o,a)&&(n[a]=o[a])}return n}function Xb(o){if(o===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return o}function Yb(o,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Xb(o)}function Y0(o){var e=ff();return function(){var a=Vn(o),c;if(e){var h=Vn(this).constructor;c=Reflect.construct(a,arguments,h)}else c=a.apply(this,arguments);return Yb(this,c)}}function gf(o,e){for(;!Object.prototype.hasOwnProperty.call(o,e)&&(o=Vn(o),o!==null););return o}function Gc(){return typeof Reflect!="undefined"&&Reflect.get?Gc=Reflect.get.bind():Gc=function(e,n,a){var c=gf(e,n);if(c){var h=Object.getOwnPropertyDescriptor(c,n);return h.get?h.get.call(arguments.length<3?e:a):h.value}},Gc.apply(this,arguments)}function Ja(o,e,n,a){return typeof Reflect!="undefined"&&Reflect.set?Ja=Reflect.set:Ja=function(h,g,S,x){var _=gf(h,g),O;if(_){if(O=Object.getOwnPropertyDescriptor(_,g),O.set)return O.set.call(x,S),!0;if(!O.writable)return!1}if(O=Object.getOwnPropertyDescriptor(x,g),O){if(!O.writable)return!1;O.value=S,Object.defineProperty(x,g,O)}else yi(x,g,S);return!0},Ja(o,e,n,a)}function G0(o,e,n,a,c){var h=Ja(o,e,n,a||o);if(!h&&c)throw new TypeError("failed to set property");return n}function K0(o,e){return e||(e=o.slice(0)),Object.freeze(Object.defineProperties(o,{raw:{value:Object.freeze(e)}}))}function J0(o,e){return e||(e=o.slice(0)),o.raw=e,o}function Z0(o){throw new TypeError('"'+o+'" is read-only')}function Q0(o){throw new TypeError('"'+o+'" is write-only')}function tA(o){throw new ReferenceError('Class "'+o+'" cannot be referenced in computed property keys.')}function Gb(){}function Kb(o){throw new ReferenceError(o+" is not defined - temporal dead zone")}function eA(o,e){return o===Gb?Kb(e):o}function iA(o,e){return Kc(o)||qb(o,e)||$n(o,e)||Jc()}function rA(o,e){return Kc(o)||zb(o,e)||$n(o,e)||Jc()}function Jb(o){return Kc(o)||bf(o)||$n(o)||Jc()}function nA(o){return Zb(o)||bf(o)||$n(o)||Qb()}function Zb(o){if(Array.isArray(o))return Za(o)}function Kc(o){if(Array.isArray(o))return o}function sA(o,e,n){if(e&&!Array.isArray(e)&&typeof e.length=="number"){var a=e.length;return Za(e,n!==void 0&&no.length)&&(e=o.length);for(var n=0,a=new Array(e);n=o.length?{done:!0}:{done:!1,value:o[a++]}},e:function(x){throw x},f:c}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var h=!0,g=!1,S;return{s:function(){n=n.call(o)},n:function(){var x=n.next();return h=x.done,x},e:function(x){g=!0,S=x},f:function(){try{!h&&n.return!=null&&n.return()}finally{if(g)throw S}}}}function aA(o,e){var n=typeof Symbol!="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(n)return(n=n.call(o)).next.bind(n);if(Array.isArray(o)||(n=$n(o))||e&&o&&typeof o.length=="number"){n&&(o=n);var a=0;return function(){return a>=o.length?{done:!0}:{done:!1,value:o[a++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lA(o){return function(){var e=o.apply(this,arguments);return e.next(),e}}function tv(o,e){if(typeof o!="object"||o===null)return o;var n=o[Symbol.toPrimitive];if(n!==void 0){var a=n.call(o,e||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(o)}function Qa(o){var e=tv(o,"string");return typeof e=="symbol"?e:String(e)}function cA(o,e){throw new Error("Decorating class property failed. Please ensure that transform-class-properties is enabled and runs after the decorators transform.")}function uA(o,e,n,a){n&&Object.defineProperty(o,e,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(a):void 0})}function hA(o,e,n,a,c){var h={};return Object.keys(a).forEach(function(g){h[g]=a[g]}),h.enumerable=!!h.enumerable,h.configurable=!!h.configurable,("value"in h||h.initializer)&&(h.writable=!0),h=n.slice().reverse().reduce(function(g,S){return S(o,e,g)||g},h),c&&h.initializer!==void 0&&(h.value=h.initializer?h.initializer.call(c):void 0,h.initializer=void 0),h.initializer===void 0&&(Object.defineProperty(o,e,h),h=null),h}var ev=0;function dA(o){return"__private_"+ev+++"_"+o}function fA(o,e){if(!Object.prototype.hasOwnProperty.call(o,e))throw new TypeError("attempted to use private field on non-instance");return o}function je(o,e){var n=Qc(o,e,"get");return vf(o,n)}function Zc(o,e,n){var a=Qc(o,e,"set");return yf(o,a,n),n}function pA(o,e){var n=Qc(o,e,"set");return wf(o,n)}function Qc(o,e,n){if(!e.has(o))throw new TypeError("attempted to "+n+" private field on non-instance");return e.get(o)}function mA(o,e,n){return tl(o,e),tu(n,"get"),vf(o,n)}function gA(o,e,n,a){return tl(o,e),tu(n,"set"),yf(o,n,a),a}function bA(o,e,n){return tl(o,e),n}function vA(){throw new TypeError("attempted to set read only static private field")}function vf(o,e){return e.get?e.get.call(o):e.value}function yf(o,e,n){if(e.set)e.set.call(o,n);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=n}}function wf(o,e){if(e.set)return"__destrObj"in e||(e.__destrObj={set value(n){e.set.call(o,n)}}),e.__destrObj;if(!e.writable)throw new TypeError("attempted to set read only private field");return e}function yA(o,e,n){return tl(o,e),tu(n,"set"),wf(o,n)}function tl(o,e){if(o!==e)throw new TypeError("Private static access of wrong provenance")}function tu(o,e){if(o===void 0)throw new TypeError("attempted to "+e+" private static field before its declaration")}function wA(o,e,n,a){var c=Ef();if(a)for(var h=0;h=0;g--){var S=n[e.placement];S.splice(S.indexOf(e.key),1);var x=this.fromElementDescriptor(e),_=this.toElementFinisherExtras((0,h[g])(x)||x);e=_.element,this.addElementPlacement(e,n),_.finisher&&c.push(_.finisher);var O=_.extras;if(O){for(var q=0;q=0;c--){var h=this.fromClassDescriptor(e),g=this.toClassDescriptor((0,n[c])(h)||h);if(g.finisher!==void 0&&a.push(g.finisher),g.elements!==void 0){e=g.elements;for(var S=0;S1&&arguments[1]!==void 0?arguments[1]:{};super(...arguments),this.attributes=xt.box(n)}copyWithAttributes(e){return new this.constructor(this.getValue(),e)}copyWithAdditionalAttributes(e){return this.copyWithAttributes(this.attributes.merge(e))}copyWithoutAttribute(e){return this.copyWithAttributes(this.attributes.remove(e))}copy(){return this.copyWithAttributes(this.attributes)}getAttribute(e){return this.attributes.get(e)}getAttributesHash(){return this.attributes}getAttributes(){return this.attributes.toObject()}hasAttribute(e){return this.attributes.has(e)}hasSameStringValueAsPiece(e){return e&&this.toString()===e.toString()}hasSameAttributesAsPiece(e){return e&&(this.attributes===e.attributes||this.attributes.isEqualTo(e.attributes))}isBlockBreak(){return!1}isEqualTo(e){return super.isEqualTo(...arguments)||this.hasSameConstructorAs(e)&&this.hasSameStringValueAsPiece(e)&&this.hasSameAttributesAsPiece(e)}isEmpty(){return this.length===0}isSerializable(){return!0}toJSON(){return{type:this.constructor.type,attributes:this.getAttributes()}}contentsForInspection(){return{type:this.constructor.type,attributes:this.attributes.inspect()}}canBeGrouped(){return this.hasAttribute("href")}canBeGroupedWith(e){return this.getAttribute("href")===e.getAttribute("href")}getLength(){return this.length}canBeConsolidatedWith(e){return!1}}yi(wn,"types",{});class xf extends We{constructor(e){super(...arguments),this.url=e}perform(e){let n=new Image;n.onload=()=>(n.width=this.width=n.naturalWidth,n.height=this.height=n.naturalHeight,e(!0,n)),n.onerror=()=>e(!1),n.src=this.url}}class Xn extends Lr{static attachmentForFile(e){let n=this.attributesForFile(e),a=new this(n);return a.setFile(e),a}static attributesForFile(e){return new xt({filename:e.name,filesize:e.size,contentType:e.type})}static fromJSON(e){return new this(e)}constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(e),this.releaseFile=this.releaseFile.bind(this),this.attributes=xt.box(e),this.didChangeAttributes()}getAttribute(e){return this.attributes.get(e)}hasAttribute(e){return this.attributes.has(e)}getAttributes(){return this.attributes.toObject()}setAttributes(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=this.attributes.merge(e);if(!this.attributes.isEqualTo(n)){var a,c,h,g;return this.attributes=n,this.didChangeAttributes(),(a=this.previewDelegate)===null||a===void 0||(c=a.attachmentDidChangeAttributes)===null||c===void 0||c.call(a,this),(h=this.delegate)===null||h===void 0||(g=h.attachmentDidChangeAttributes)===null||g===void 0?void 0:g.call(h,this)}}didChangeAttributes(){if(this.isPreviewable())return this.preloadURL()}isPending(){return this.file!=null&&!(this.getURL()||this.getHref())}isPreviewable(){return this.attributes.has("previewable")?this.attributes.get("previewable"):Xn.previewablePattern.test(this.getContentType())}getType(){return this.hasContent()?"content":this.isPreviewable()?"preview":"file"}getURL(){return this.attributes.get("url")}getHref(){return this.attributes.get("href")}getFilename(){return this.attributes.get("filename")||""}getFilesize(){return this.attributes.get("filesize")}getFormattedFilesize(){let e=this.attributes.get("filesize");return typeof e=="number"?xe.formatter(e):""}getExtension(){var e;return(e=this.getFilename().match(/\.(\w+)$/))===null||e===void 0?void 0:e[1].toLowerCase()}getContentType(){return this.attributes.get("contentType")}hasContent(){return this.attributes.has("content")}getContent(){return this.attributes.get("content")}getWidth(){return this.attributes.get("width")}getHeight(){return this.attributes.get("height")}getFile(){return this.file}setFile(e){if(this.file=e,this.isPreviewable())return this.preloadFile()}releaseFile(){this.releasePreloadedFile(),this.file=null}getUploadProgress(){return this.uploadProgress!=null?this.uploadProgress:0}setUploadProgress(e){if(this.uploadProgress!==e){var n,a;return this.uploadProgress=e,(n=this.uploadProgressDelegate)===null||n===void 0||(a=n.attachmentDidChangeUploadProgress)===null||a===void 0?void 0:a.call(n,this)}}toJSON(){return this.getAttributes()}getCacheKey(){return[super.getCacheKey(...arguments),this.attributes.getCacheKey(),this.getPreviewURL()].join("/")}getPreviewURL(){return this.previewURL||this.preloadingURL}setPreviewURL(e){if(e!==this.getPreviewURL()){var n,a,c,h;return this.previewURL=e,(n=this.previewDelegate)===null||n===void 0||(a=n.attachmentDidChangeAttributes)===null||a===void 0||a.call(n,this),(c=this.delegate)===null||c===void 0||(h=c.attachmentDidChangePreviewURL)===null||h===void 0?void 0:h.call(c,this)}}preloadURL(){return this.preload(this.getURL(),this.releaseFile)}preloadFile(){if(this.file)return this.fileObjectURL=URL.createObjectURL(this.file),this.preload(this.fileObjectURL)}releasePreloadedFile(){this.fileObjectURL&&(URL.revokeObjectURL(this.fileObjectURL),this.fileObjectURL=null)}preload(e,n){if(e&&e!==this.getPreviewURL())return this.preloadingURL=e,new xf(e).then(c=>{let{width:h,height:g}=c;return(!this.getWidth()||!this.getHeight())&&this.setAttributes({width:h,height:g}),this.preloadingURL=null,this.setPreviewURL(e),n==null?void 0:n()}).catch(()=>(this.preloadingURL=null,n==null?void 0:n()))}}yi(Xn,"previewablePattern",/^image(\/(gif|png|webp|jpe?g)|$)/);class Yn extends wn{static fromJSON(e){return new this(Xn.fromJSON(e.attachment),e.attributes)}constructor(e){super(...arguments),this.attachment=e,this.length=1,this.ensureAttachmentExclusivelyHasAttribute("href"),this.attachment.hasContent()||this.removeProhibitedAttributes()}ensureAttachmentExclusivelyHasAttribute(e){this.hasAttribute(e)&&(this.attachment.hasAttribute(e)||this.attachment.setAttributes(this.attributes.slice([e])),this.attributes=this.attributes.remove(e))}removeProhibitedAttributes(){let e=this.attributes.slice(Yn.permittedAttributes);e.isEqualTo(this.attributes)||(this.attributes=e)}getValue(){return this.attachment}isSerializable(){return!this.attachment.isPending()}getCaption(){return this.attributes.get("caption")||""}isEqualTo(e){var n;return super.isEqualTo(e)&&this.attachment.id===(e==null||(n=e.attachment)===null||n===void 0?void 0:n.id)}toString(){return F}toJSON(){let e=super.toJSON(...arguments);return e.attachment=this.attachment,e}getCacheKey(){return[super.getCacheKey(...arguments),this.attachment.getCacheKey()].join("/")}toConsole(){return JSON.stringify(this.toString())}}yi(Yn,"permittedAttributes",["caption","presentation"]),wn.registerType("attachment",Yn);class eu extends wn{static fromJSON(e){return new this(e.string,e.attributes)}constructor(e){super(...arguments),this.string=w(e),this.length=this.string.length}getValue(){return this.string}toString(){return this.string.toString()}isBlockBreak(){return this.toString()===` `&&this.getAttribute("blockBreak")===!0}toJSON(){let e=super.toJSON(...arguments);return e.string=this.string,e}canBeConsolidatedWith(e){return e&&this.hasSameConstructorAs(e)&&this.hasSameAttributesAsPiece(e)}consolidateWith(e){return new this.constructor(this.toString()+e.toString(),this.attributes)}splitAtOffset(e){let n,a;return e===0?(n=null,a=this):e===this.length?(n=this,a=null):(n=new this.constructor(this.string.slice(0,e),this.attributes),a=new this.constructor(this.string.slice(e),this.attributes)),[n,a]}toConsole(){let{string:e}=this;return e.length>15&&(e=e.slice(0,14)+"\u2026"),JSON.stringify(e.toString())}}wn.registerType("string",eu);class il extends Lr{static box(e){return e instanceof this?e:new this(e)}constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments),this.objects=e.slice(0),this.length=this.objects.length}indexOf(e){return this.objects.indexOf(e)}splice(){for(var e=arguments.length,n=new Array(e),a=0;ae(n,a))}insertObjectAtIndex(e,n){return this.splice(n,0,e)}insertSplittableListAtIndex(e,n){return this.splice(n,0,...e.objects)}insertSplittableListAtPosition(e,n){let[a,c]=this.splitObjectAtPosition(n);return new this.constructor(a).insertSplittableListAtIndex(e,c)}editObjectAtIndex(e,n){return this.replaceObjectAtIndex(n(this.objects[e]),e)}replaceObjectAtIndex(e,n){return this.splice(n,1,e)}removeObjectAtIndex(e){return this.splice(e,1)}getObjectAtIndex(e){return this.objects[e]}getSplittableListInRange(e){let[n,a,c]=this.splitObjectsAtRange(e);return new this.constructor(n.slice(a,c+1))}selectSplittableList(e){let n=this.objects.filter(a=>e(a));return new this.constructor(n)}removeObjectsInRange(e){let[n,a,c]=this.splitObjectsAtRange(e);return new this.constructor(n).splice(a,c-a+1)}transformObjectsInRange(e,n){let[a,c,h]=this.splitObjectsAtRange(e),g=a.map((S,x)=>c<=x&&x<=h?n(S):S);return new this.constructor(g)}splitObjectsAtRange(e){let n,[a,c,h]=this.splitObjectAtPosition(av(e));return[a,n]=new this.constructor(a).splitObjectAtPosition(lv(e)+h),[a,c,n-1]}getObjectAtPosition(e){let{index:n}=this.findIndexAndOffsetAtPosition(e);return this.objects[n]}splitObjectAtPosition(e){let n,a,{index:c,offset:h}=this.findIndexAndOffsetAtPosition(e),g=this.objects.slice(0);if(c!=null)if(h===0)n=c,a=0;else{let S=this.getObjectAtIndex(c),[x,_]=S.splitAtOffset(h);g.splice(c,1,x,_),n=c+1,a=x.getLength()-h}else n=g.length,a=0;return[g,n,a]}consolidate(){let e=[],n=this.objects[0];return this.objects.slice(1).forEach(a=>{var c,h;(c=(h=n).canBeConsolidatedWith)!==null&&c!==void 0&&c.call(h,a)?n=n.consolidateWith(a):(e.push(n),n=a)}),n&&e.push(n),new this.constructor(e)}consolidateFromIndexToIndex(e,n){let c=this.objects.slice(0).slice(e,n+1),h=new this.constructor(c).consolidate().toArray();return this.splice(e,c.length,...h)}findIndexAndOffsetAtPosition(e){let n,a=0;for(n=0;nthis.endPosition+=e.getLength())),this.endPosition}toString(){return this.objects.join("")}toArray(){return this.objects.slice(0)}toJSON(){return this.toArray()}isEqualTo(e){return super.isEqualTo(...arguments)||ov(this.objects,e==null?void 0:e.objects)}contentsForInspection(){return{objects:"[".concat(this.objects.map(e=>e.inspect()).join(", "),"]")}}}let ov=function(o){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];if(o.length!==e.length)return!1;let n=!0;for(let a=0;ao[0],lv=o=>o[1];class nr extends Lr{static textForAttachmentWithAttributes(e,n){let a=new Yn(e,n);return new this([a])}static textForStringWithAttributes(e,n){let a=new eu(e,n);return new this([a])}static fromJSON(e){let n=Array.from(e).map(a=>wn.fromJSON(a));return new this(n)}constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments);let n=e.filter(a=>!a.isEmpty());this.pieceList=new il(n)}copy(){return this.copyWithPieceList(this.pieceList)}copyWithPieceList(e){return new this.constructor(e.consolidate().toArray())}copyUsingObjectMap(e){let n=this.getPieces().map(a=>e.find(a)||a);return new this.constructor(n)}appendText(e){return this.insertTextAtPosition(e,this.getLength())}insertTextAtPosition(e,n){return this.copyWithPieceList(this.pieceList.insertSplittableListAtPosition(e.pieceList,n))}removeTextAtRange(e){return this.copyWithPieceList(this.pieceList.removeObjectsInRange(e))}replaceTextAtRange(e,n){return this.removeTextAtRange(n).insertTextAtPosition(e,n[0])}moveTextFromRangeToPosition(e,n){if(e[0]<=n&&n<=e[1])return;let a=this.getTextAtRange(e),c=a.getLength();return e[0]a.copyWithAdditionalAttributes(e)))}removeAttributeAtRange(e,n){return this.copyWithPieceList(this.pieceList.transformObjectsInRange(n,a=>a.copyWithoutAttribute(e)))}setAttributesAtRange(e,n){return this.copyWithPieceList(this.pieceList.transformObjectsInRange(n,a=>a.copyWithAttributes(e)))}getAttributesAtPosition(e){var n;return((n=this.pieceList.getObjectAtPosition(e))===null||n===void 0?void 0:n.getAttributes())||{}}getCommonAttributes(){let e=Array.from(this.pieceList.toArray()).map(n=>n.getAttributes());return xt.fromCommonAttributesOfObjects(e).toObject()}getCommonAttributesAtRange(e){return this.getTextAtRange(e).getCommonAttributes()||{}}getExpandedRangeForAttributeAtOffset(e,n){let a,c=a=n,h=this.getLength();for(;c>0&&this.getCommonAttributesAtRange([c-1,a])[e];)c--;for(;a!!e.attachment)}getAttachments(){return this.getAttachmentPieces().map(e=>e.attachment)}getAttachmentAndPositionById(e){let n=0;for(let c of this.pieceList.toArray()){var a;if(((a=c.attachment)===null||a===void 0?void 0:a.id)===e)return{attachment:c.attachment,position:n};n+=c.length}return{attachment:null,position:null}}getAttachmentById(e){let{attachment:n}=this.getAttachmentAndPositionById(e);return n}getRangeOfAttachment(e){let n=this.getAttachmentAndPositionById(e.id),a=n.position;if(e=n.attachment,e)return[a,a+1]}updateAttributesForAttachment(e,n){let a=this.getRangeOfAttachment(n);return a?this.addAttributesAtRange(e,a):this}getLength(){return this.pieceList.getEndPosition()}isEmpty(){return this.getLength()===0}isEqualTo(e){var n;return super.isEqualTo(e)||(e==null||(n=e.pieceList)===null||n===void 0?void 0:n.isEqualTo(this.pieceList))}isBlockBreak(){return this.getLength()===1&&this.pieceList.getObjectAtIndex(0).isBlockBreak()}eachPiece(e){return this.pieceList.eachObject(e)}getPieces(){return this.pieceList.toArray()}getPieceAtPosition(e){return this.pieceList.getObjectAtPosition(e)}contentsForInspection(){return{pieceList:this.pieceList.inspect()}}toSerializableText(){let e=this.pieceList.selectSplittableList(n=>n.isSerializable());return this.copyWithPieceList(e)}toString(){return this.pieceList.toString()}toJSON(){return this.pieceList.toJSON()}toConsole(){return JSON.stringify(this.pieceList.toArray().map(e=>JSON.parse(e.toConsole())))}getDirection(){return Xs(this.toString())}isRTL(){return this.getDirection()==="rtl"}}class wr extends Lr{static fromJSON(e){let n=nr.fromJSON(e.text);return new this(n,e.attributes,e.htmlAttributes)}constructor(e,n,a){super(...arguments),this.text=cv(e||new nr),this.attributes=n||[],this.htmlAttributes=a||{}}isEmpty(){return this.text.isBlockBreak()}isEqualTo(e){return super.isEqualTo(e)?!0:this.text.isEqualTo(e==null?void 0:e.text)&&Fe(this.attributes,e==null?void 0:e.attributes)&&Gr(this.htmlAttributes,e==null?void 0:e.htmlAttributes)}copyWithText(e){return new wr(e,this.attributes,this.htmlAttributes)}copyWithoutText(){return this.copyWithText(null)}copyWithAttributes(e){return new wr(this.text,e,this.htmlAttributes)}copyWithoutAttributes(){return this.copyWithAttributes(null)}copyUsingObjectMap(e){let n=e.find(this.text);return n?this.copyWithText(n):this.copyWithText(this.text.copyUsingObjectMap(e))}addAttribute(e){let n=this.attributes.concat(kf(e));return this.copyWithAttributes(n)}addHTMLAttribute(e,n){let a=Object.assign({},this.htmlAttributes,{[e]:n});return new wr(this.text,this.attributes,a)}removeAttribute(e){let{listAttribute:n}=ye(e),a=_f(_f(this.attributes,e),n);return this.copyWithAttributes(a)}removeLastAttribute(){return this.removeAttribute(this.getLastAttribute())}getLastAttribute(){return Lf(this.attributes)}getAttributes(){return this.attributes.slice(0)}getAttributeLevel(){return this.attributes.length}getAttributeAtLevel(e){return this.attributes[e-1]}hasAttribute(e){return this.attributes.includes(e)}hasAttributes(){return this.getAttributeLevel()>0}getLastNestableAttribute(){return Lf(this.getNestableAttributes())}getNestableAttributes(){return this.attributes.filter(e=>ye(e).nestable)}getNestingLevel(){return this.getNestableAttributes().length}decreaseNestingLevel(){let e=this.getLastNestableAttribute();return e?this.removeAttribute(e):this}increaseNestingLevel(){let e=this.getLastNestableAttribute();if(e){let n=this.attributes.lastIndexOf(e),a=mr(this.attributes,n+1,0,...kf(e));return this.copyWithAttributes(a)}else return this}getListItemAttributes(){return this.attributes.filter(e=>ye(e).listAttribute)}isListItem(){var e;return(e=ye(this.getLastAttribute()))===null||e===void 0?void 0:e.listAttribute}isTerminalBlock(){var e;return(e=ye(this.getLastAttribute()))===null||e===void 0?void 0:e.terminal}breaksOnReturn(){var e;return(e=ye(this.getLastAttribute()))===null||e===void 0?void 0:e.breakOnReturn}findLineBreakInDirectionFromPosition(e,n){let a=this.toString(),c;switch(e){case"forward":c=a.indexOf(` `,n);break;case"backward":c=a.slice(0,n).lastIndexOf(` `)}if(c!==-1)return c}contentsForInspection(){return{text:this.text.inspect(),attributes:this.attributes}}toString(){return this.text.toString()}toJSON(){return{text:this.text,attributes:this.attributes,htmlAttributes:this.htmlAttributes}}getDirection(){return this.text.getDirection()}isRTL(){return this.text.isRTL()}getLength(){return this.text.getLength()}canBeConsolidatedWith(e){return!this.hasAttributes()&&!e.hasAttributes()&&this.getDirection()===e.getDirection()}consolidateWith(e){let n=nr.textForStringWithAttributes(` `),a=this.getTextWithoutBlockBreak().appendText(n);return this.copyWithText(a.appendText(e.text))}splitAtOffset(e){let n,a;return e===0?(n=null,a=this):e===this.getLength()?(n=this,a=null):(n=this.copyWithText(this.text.getTextAtRange([0,e])),a=this.copyWithText(this.text.getTextAtRange([e,this.getLength()]))),[n,a]}getBlockBreakPosition(){return this.text.getLength()-1}getTextWithoutBlockBreak(){return Cf(this.text)?this.text.getTextAtRange([0,this.getBlockBreakPosition()]):this.text.copy()}canBeGrouped(e){return this.attributes[e]}canBeGroupedWith(e,n){let a=e.getAttributes(),c=a[n],h=this.attributes[n];return h===c&&!(ye(h).group===!1&&!Fc().includes(a[n+1]))&&(this.getDirection()===e.getDirection()||e.isEmpty())}}let cv=function(o){return o=uv(o),o=dv(o),o},uv=function(o){let e=!1,n=o.getPieces(),a=n.slice(0,n.length-1),c=n[n.length-1];return c?(a=a.map(h=>h.isBlockBreak()?(e=!0,fv(h)):h),e?new nr([...a,c]):o):o},hv=nr.textForStringWithAttributes(` `,{blockBreak:!0}),dv=function(o){return Cf(o)?o:o.appendText(hv)},Cf=function(o){let e=o.getLength();return e===0?!1:o.getTextAtRange([e-1,e]).isBlockBreak()},fv=o=>o.copyWithoutAttribute("blockBreak"),kf=function(o){let{listAttribute:e}=ye(o);return e?[e,o]:[o]},Lf=o=>o.slice(-1)[0],_f=function(o,e){let n=o.lastIndexOf(e);return n===-1?o:mr(o,n,1)};class Vi extends Lr{static fromJSON(e){let n=Array.from(e).map(a=>wr.fromJSON(a));return new this(n)}static fromString(e,n){let a=nr.textForStringWithAttributes(e,n);return new this([new wr(a)])}constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments),e.length===0&&(e=[new wr]),this.blockList=il.box(e)}isEmpty(){let e=this.getBlockAtIndex(0);return this.blockList.length===1&&e.isEmpty()&&!e.hasAttributes()}copy(){let n=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}).consolidateBlocks?this.blockList.consolidate().toArray():this.blockList.toArray();return new this.constructor(n)}copyUsingObjectsFromDocument(e){let n=new Be(e.getObjects());return this.copyUsingObjectMap(n)}copyUsingObjectMap(e){let n=this.getBlocks().map(a=>e.find(a)||a.copyUsingObjectMap(e));return new this.constructor(n)}copyWithBaseBlockAttributes(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=this.getBlocks().map(a=>{let c=e.concat(a.getAttributes());return a.copyWithAttributes(c)});return new this.constructor(n)}replaceBlock(e,n){let a=this.blockList.indexOf(e);return a===-1?this:new this.constructor(this.blockList.replaceObjectAtIndex(n,a))}insertDocumentAtRange(e,n){let{blockList:a}=e;n=Ce(n);let[c]=n,{index:h,offset:g}=this.locationFromPosition(c),S=this,x=this.getBlockAtPosition(c);return ir(n)&&x.isEmpty()&&!x.hasAttributes()?S=new this.constructor(S.blockList.removeObjectAtIndex(h)):x.getBlockBreakPosition()===g&&c++,S=S.removeTextAtRange(n),new this.constructor(S.blockList.insertSplittableListAtPosition(a,c))}mergeDocumentAtRange(e,n){let a,c;n=Ce(n);let[h]=n,g=this.locationFromPosition(h),S=this.getBlockAtIndex(g.index).getAttributes(),x=e.getBaseBlockAttributes(),_=S.slice(-x.length);if(Fe(x,_)){let at=S.slice(0,-x.length);a=e.copyWithBaseBlockAttributes(at)}else a=e.copy({consolidateBlocks:!0}).copyWithBaseBlockAttributes(S);let O=a.getBlockCount(),q=a.getBlockAtIndex(0);if(Fe(S,q.getAttributes())){let at=q.getTextWithoutBlockBreak();if(c=this.insertTextAtRange(at,n),O>1){a=new this.constructor(a.getBlocks().slice(1));let rt=h+at.getLength();c=c.insertDocumentAtRange(a,rt)}}else c=this.insertDocumentAtRange(a,n);return c}insertTextAtRange(e,n){n=Ce(n);let[a]=n,{index:c,offset:h}=this.locationFromPosition(a),g=this.removeTextAtRange(n);return new this.constructor(g.blockList.editObjectAtIndex(c,S=>S.copyWithText(S.text.insertTextAtPosition(e,h))))}removeTextAtRange(e){let n;e=Ce(e);let[a,c]=e;if(ir(e))return this;let[h,g]=Array.from(this.locationRangeFromRange(e)),S=h.index,x=h.offset,_=this.getBlockAtIndex(S),O=g.index,q=g.offset,at=this.getBlockAtIndex(O);if(c-a===1&&_.getBlockBreakPosition()===x&&at.getBlockBreakPosition()!==q&&at.text.getStringAtPosition(q)===` `)n=this.blockList.editObjectAtIndex(O,pt=>pt.copyWithText(pt.text.removeTextAtRange([q,q+1])));else{let pt,ct=_.text.getTextAtRange([0,x]),mt=at.text.getTextAtRange([q,at.getLength()]),yt=ct.appendText(mt);S!==O&&x===0&&_.getAttributeLevel()>=at.getAttributeLevel()?pt=at.copyWithText(yt):pt=_.copyWithText(yt);let vt=O+1-S;n=this.blockList.splice(S,vt,pt)}return new this.constructor(n)}moveTextFromRangeToPosition(e,n){let a;e=Ce(e);let[c,h]=e;if(c<=n&&n<=h)return this;let g=this.getDocumentAtRange(e),S=this.removeTextAtRange(e),x=cc=c.editObjectAtIndex(S,function(){return ye(e)?h.addAttribute(e,n):g[0]===g[1]?h:h.copyWithText(h.text.addAttributeAtRange(e,n,g))})),new this.constructor(c)}addAttribute(e,n){let{blockList:a}=this;return this.eachBlock((c,h)=>a=a.editObjectAtIndex(h,()=>c.addAttribute(e,n))),new this.constructor(a)}removeAttributeAtRange(e,n){let{blockList:a}=this;return this.eachBlockAtRange(n,function(c,h,g){ye(e)?a=a.editObjectAtIndex(g,()=>c.removeAttribute(e)):h[0]!==h[1]&&(a=a.editObjectAtIndex(g,()=>c.copyWithText(c.text.removeAttributeAtRange(e,h))))}),new this.constructor(a)}updateAttributesForAttachment(e,n){let a=this.getRangeOfAttachment(n),[c]=Array.from(a),{index:h}=this.locationFromPosition(c),g=this.getTextAtIndex(h);return new this.constructor(this.blockList.editObjectAtIndex(h,S=>S.copyWithText(g.updateAttributesForAttachment(e,n))))}removeAttributeForAttachment(e,n){let a=this.getRangeOfAttachment(n);return this.removeAttributeAtRange(e,a)}setHTMLAttributeAtPosition(e,n,a){let c=this.getBlockAtPosition(e),h=c.addHTMLAttribute(n,a);return this.replaceBlock(c,h)}insertBlockBreakAtRange(e){let n;e=Ce(e);let[a]=e,{offset:c}=this.locationFromPosition(a),h=this.removeTextAtRange(e);return c===0&&(n=[new wr]),new this.constructor(h.blockList.insertSplittableListAtPosition(new il(n),a))}applyBlockAttributeAtRange(e,n,a){let c=this.expandRangeToLineBreaksAndSplitBlocks(a),h=c.document;a=c.range;let g=ye(e);if(g.listAttribute){h=h.removeLastListAttributeAtRange(a,{exceptAttributeName:e});let S=h.convertLineBreaksToBlockBreaksInRange(a);h=S.document,a=S.range}else g.exclusive?h=h.removeBlockAttributesAtRange(a):g.terminal?h=h.removeLastTerminalAttributeAtRange(a):h=h.consolidateBlocksAtRange(a);return h.addAttributeAtRange(e,n,a)}removeLastListAttributeAtRange(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{blockList:a}=this;return this.eachBlockAtRange(e,function(c,h,g){let S=c.getLastAttribute();S&&ye(S).listAttribute&&S!==n.exceptAttributeName&&(a=a.editObjectAtIndex(g,()=>c.removeAttribute(S)))}),new this.constructor(a)}removeLastTerminalAttributeAtRange(e){let{blockList:n}=this;return this.eachBlockAtRange(e,function(a,c,h){let g=a.getLastAttribute();g&&ye(g).terminal&&(n=n.editObjectAtIndex(h,()=>a.removeAttribute(g)))}),new this.constructor(n)}removeBlockAttributesAtRange(e){let{blockList:n}=this;return this.eachBlockAtRange(e,function(a,c,h){a.hasAttributes()&&(n=n.editObjectAtIndex(h,()=>a.copyWithoutAttributes()))}),new this.constructor(n)}expandRangeToLineBreaksAndSplitBlocks(e){let n;e=Ce(e);let[a,c]=e,h=this.locationFromPosition(a),g=this.locationFromPosition(c),S=this,x=S.getBlockAtIndex(h.index);if(h.offset=x.findLineBreakInDirectionFromPosition("backward",h.offset),h.offset!=null&&(n=S.positionFromLocation(h),S=S.insertBlockBreakAtRange([n,n+1]),g.index+=1,g.offset-=S.getBlockAtIndex(h.index).getLength(),h.index+=1),h.offset=0,g.offset===0&&g.index>h.index)g.index-=1,g.offset=S.getBlockAtIndex(g.index).getBlockBreakPosition();else{let _=S.getBlockAtIndex(g.index);_.text.getStringAtRange([g.offset-1,g.offset])===` `?g.offset-=1:g.offset=_.findLineBreakInDirectionFromPosition("forward",g.offset),g.offset!==_.getBlockBreakPosition()&&(n=S.positionFromLocation(g),S=S.insertBlockBreakAtRange([n,n+1]))}return a=S.positionFromLocation(h),c=S.positionFromLocation(g),e=Ce([a,c]),{document:S,range:e}}convertLineBreaksToBlockBreaksInRange(e){e=Ce(e);let[n]=e,a=this.getStringAtRange(e).slice(0,-1),c=this;return a.replace(/.*?\n/g,function(h){n+=h.length,c=c.insertBlockBreakAtRange([n-1,n])}),{document:c,range:e}}consolidateBlocksAtRange(e){e=Ce(e);let[n,a]=e,c=this.locationFromPosition(n).index,h=this.locationFromPosition(a).index;return new this.constructor(this.blockList.consolidateFromIndexToIndex(c,h))}getDocumentAtRange(e){e=Ce(e);let n=this.blockList.getSplittableListInRange(e).toArray();return new this.constructor(n)}getStringAtRange(e){let n,a=e=Ce(e);return a[a.length-1]!==this.getLength()&&(n=-1),this.getDocumentAtRange(e).toString().slice(0,n)}getBlockAtIndex(e){return this.blockList.getObjectAtIndex(e)}getBlockAtPosition(e){let{index:n}=this.locationFromPosition(e);return this.getBlockAtIndex(n)}getTextAtIndex(e){var n;return(n=this.getBlockAtIndex(e))===null||n===void 0?void 0:n.text}getTextAtPosition(e){let{index:n}=this.locationFromPosition(e);return this.getTextAtIndex(n)}getPieceAtPosition(e){let{index:n,offset:a}=this.locationFromPosition(e);return this.getTextAtIndex(n).getPieceAtPosition(a)}getCharacterAtPosition(e){let{index:n,offset:a}=this.locationFromPosition(e);return this.getTextAtIndex(n).getStringAtRange([a,a+1])}getLength(){return this.blockList.getEndPosition()}getBlocks(){return this.blockList.toArray()}getBlockCount(){return this.blockList.length}getEditCount(){return this.editCount}eachBlock(e){return this.blockList.eachObject(e)}eachBlockAtRange(e,n){let a,c;e=Ce(e);let[h,g]=e,S=this.locationFromPosition(h),x=this.locationFromPosition(g);if(S.index===x.index)return a=this.getBlockAtIndex(S.index),c=[S.offset,x.offset],n(a,c,S.index);for(let _=S.index;_<=x.index;_++)if(a=this.getBlockAtIndex(_),a){switch(_){case S.index:c=[S.offset,a.text.getLength()];break;case x.index:c=[0,x.offset];break;default:c=[0,a.text.getLength()]}n(a,c,_)}}getCommonAttributesAtRange(e){e=Ce(e);let[n]=e;if(ir(e))return this.getCommonAttributesAtPosition(n);{let a=[],c=[];return this.eachBlockAtRange(e,function(h,g){if(g[0]!==g[1])return a.push(h.text.getCommonAttributesAtRange(g)),c.push(Df(h))}),xt.fromCommonAttributesOfObjects(a).merge(xt.fromCommonAttributesOfObjects(c)).toObject()}}getCommonAttributesAtPosition(e){let n,a,{index:c,offset:h}=this.locationFromPosition(e),g=this.getBlockAtIndex(c);if(!g)return{};let S=Df(g),x=g.text.getAttributesAtPosition(h),_=g.text.getAttributesAtPosition(h-1),O=Object.keys(me).filter(q=>me[q].inheritable);for(n in _)a=_[n],(a===x[n]||O.includes(n))&&(S[n]=a);return S}getRangeOfCommonAttributeAtPosition(e,n){let{index:a,offset:c}=this.locationFromPosition(n),h=this.getTextAtIndex(a),[g,S]=Array.from(h.getExpandedRangeForAttributeAtOffset(e,c)),x=this.positionFromLocation({index:a,offset:g}),_=this.positionFromLocation({index:a,offset:S});return Ce([x,_])}getBaseBlockAttributes(){let e=this.getBlockAtIndex(0).getAttributes();for(let n=1;n{let h=[];for(let g=0;g{let{text:a}=n;return e=e.concat(a.getAttachmentPieces())}),e}getAttachments(){return this.getAttachmentPieces().map(e=>e.attachment)}getRangeOfAttachment(e){let n=0,a=this.blockList.toArray();for(let c=0;c{let h=c.getLength();c.hasAttribute(e)&&a.push([n,n+h]),n+=h}),a}findRangesForTextAttribute(e){let{withValue:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=0,c=[],h=[],g=function(S){return n?S.getAttribute(e)===n:S.hasAttribute(e)};return this.getPieces().forEach(S=>{let x=S.getLength();g(S)&&(c[1]===a?c[1]=a+x:h.push(c=[a,a+x])),a+=x}),h}locationFromPosition(e){let n=this.blockList.findIndexAndOffsetAtPosition(Math.max(0,e));if(n.index!=null)return n;{let a=this.getBlocks();return{index:a.length-1,offset:a[a.length-1].getLength()}}}positionFromLocation(e){return this.blockList.findPositionAtIndexAndOffset(e.index,e.offset)}locationRangeFromPosition(e){return Ce(this.locationFromPosition(e))}locationRangeFromRange(e){if(e=Ce(e),!e)return;let[n,a]=Array.from(e),c=this.locationFromPosition(n),h=this.locationFromPosition(a);return Ce([c,h])}rangeFromLocationRange(e){let n;e=Ce(e);let a=this.positionFromLocation(e[0]);return ir(e)||(n=this.positionFromLocation(e[1])),Ce([a,n])}isEqualTo(e){return this.blockList.isEqualTo(e==null?void 0:e.blockList)}getTexts(){return this.getBlocks().map(e=>e.text)}getPieces(){let e=[];return Array.from(this.getTexts()).forEach(n=>{e.push(...Array.from(n.getPieces()||[]))}),e}getObjects(){return this.getBlocks().concat(this.getTexts()).concat(this.getPieces())}toSerializableDocument(){let e=[];return this.blockList.eachObject(n=>e.push(n.copyWithText(n.text.toSerializableText()))),new this.constructor(e)}toString(){return this.blockList.toString()}toJSON(){return this.blockList.toJSON()}toConsole(){return JSON.stringify(this.blockList.toArray().map(e=>JSON.parse(e.text.toConsole())))}}let Df=function(o){let e={},n=o.getLastAttribute();return n&&(e[n]=!0),e},iu=function(o){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n="string";return o=m(o),{string:o,attributes:e,type:n}},pv=function(o){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return{attachment:o,attributes:e,type:"attachment"}},mv=function(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return{text:[],attributes:o,htmlAttributes:e}},Rf=(o,e)=>{try{return JSON.parse(o.getAttribute("data-trix-".concat(e)))}catch(n){return{}}},gv=o=>{let e=o.getAttribute("width"),n=o.getAttribute("height"),a={};return e&&(a.width=parseInt(e,10)),n&&(a.height=parseInt(n,10)),a};class Gn extends qt{static parse(e,n){let a=new this(e,n);return a.parse(),a}constructor(e){let{referenceElement:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(...arguments),this.html=e,this.referenceElement=n,this.blocks=[],this.blockElements=[],this.processedElements=[]}getDocument(){return Vi.fromJSON(this.blocks)}parse(){try{this.createHiddenContainer(),$a.setHTML(this.containerElement,this.html);let e=k(this.containerElement,{usingFilter:vv});for(;e.nextNode();)this.processNode(e.currentNode);return this.translateBlockElementMarginsToNewlines()}finally{this.removeHiddenContainer()}}createHiddenContainer(){return this.referenceElement?(this.containerElement=this.referenceElement.cloneNode(!1),this.containerElement.removeAttribute("id"),this.containerElement.setAttribute("data-trix-internal",""),this.containerElement.style.display="none",this.referenceElement.parentNode.insertBefore(this.containerElement,this.referenceElement.nextSibling)):(this.containerElement=d({tagName:"div",style:{display:"none"}}),document.body.appendChild(this.containerElement))}removeHiddenContainer(){return P(this.containerElement)}processNode(e){switch(e.nodeType){case Node.TEXT_NODE:if(!this.isInsignificantTextNode(e))return this.appendBlockForTextNode(e),this.processTextNode(e);break;case Node.ELEMENT_NODE:return this.appendBlockForElement(e),this.processElement(e)}}appendBlockForTextNode(e){let n=e.parentNode;if(n===this.currentBlockElement&&this.isBlockElement(e.previousSibling))return this.appendStringWithAttributes(` `);if(n===this.containerElement||this.isBlockElement(n)){var a;let c=this.getBlockAttributes(n),h=this.getBlockHTMLAttributes(n);Fe(c,(a=this.currentBlock)===null||a===void 0?void 0:a.attributes)||(this.currentBlock=this.appendBlockForAttributesWithElement(c,n,h),this.currentBlockElement=n)}}appendBlockForElement(e){let n=this.isBlockElement(e),a=Kt(this.currentBlockElement,e);if(n&&!this.isBlockElement(e.firstChild)){if(!this.isInsignificantTextNode(e.firstChild)||!this.isBlockElement(e.firstElementChild)){let c=this.getBlockAttributes(e),h=this.getBlockHTMLAttributes(e);if(e.firstChild)if(!(a&&Fe(c,this.currentBlock.attributes)))this.currentBlock=this.appendBlockForAttributesWithElement(c,e,h),this.currentBlockElement=e;else return this.appendStringWithAttributes(` `)}}else if(this.currentBlockElement&&!a&&!n){let c=this.findParentBlockElement(e);if(c)return this.appendBlockForElement(c);this.currentBlock=this.appendEmptyBlock(),this.currentBlockElement=null}}findParentBlockElement(e){let{parentElement:n}=e;for(;n&&n!==this.containerElement;){if(this.isBlockElement(n)&&this.blockElements.includes(n))return n;n=n.parentElement}return null}processTextNode(e){let n=e.data;if(!Mf(e.parentNode)){var a;n=z(n),Pf((a=e.previousSibling)===null||a===void 0?void 0:a.textContent)&&(n=yv(n))}return this.appendStringWithAttributes(n,this.getTextAttributes(e.parentNode))}processElement(e){let n;if(zi(e)){if(n=Rf(e,"attachment"),Object.keys(n).length){let a=this.getTextAttributes(e);this.appendAttachmentWithAttributes(n,a),e.innerHTML=""}return this.processedElements.push(e)}else switch(p(e)){case"br":return!this.isExtraBR(e)&&!this.isBlockElement(e.nextSibling)&&this.appendStringWithAttributes(` `,this.getTextAttributes(e)),this.processedElements.push(e);case"img":n={url:e.getAttribute("src"),contentType:"image"};let a=gv(e);for(let c in a){let h=a[c];n[c]=h}return this.appendAttachmentWithAttributes(n,this.getTextAttributes(e)),this.processedElements.push(e);case"tr":if(this.needsTableSeparator(e))return this.appendStringWithAttributes(Bt.tableRowSeparator);break;case"td":if(this.needsTableSeparator(e))return this.appendStringWithAttributes(Bt.tableCellSeparator);break}}appendBlockForAttributesWithElement(e,n){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.blockElements.push(n);let c=mv(e,a);return this.blocks.push(c),c}appendEmptyBlock(){return this.appendBlockForAttributesWithElement([],null)}appendStringWithAttributes(e,n){return this.appendPiece(iu(e,n))}appendAttachmentWithAttributes(e,n){return this.appendPiece(pv(e,n))}appendPiece(e){return this.blocks.length===0&&this.appendEmptyBlock(),this.blocks[this.blocks.length-1].text.push(e)}appendStringToTextAtIndex(e,n){let{text:a}=this.blocks[n],c=a[a.length-1];if((c==null?void 0:c.type)==="string")c.string+=e;else return a.push(iu(e))}prependStringToTextAtIndex(e,n){let{text:a}=this.blocks[n],c=a[0];if((c==null?void 0:c.type)==="string")c.string=e+c.string;else return a.unshift(iu(e))}getTextAttributes(e){let n,a={};for(let c in me){let h=me[c];if(h.tagName&&kt(e,{matchingSelector:h.tagName,untilNode:this.containerElement}))a[c]=!0;else if(h.parser){if(n=h.parser(e),n){let g=!1;for(let S of this.findBlockElementAncestors(e))if(h.parser(S)===n){g=!0;break}g||(a[c]=n)}}else h.styleProperty&&(n=e.style[h.styleProperty],n&&(a[c]=n))}if(zi(e)){let c=Rf(e,"attributes");for(let h in c)n=c[h],a[h]=n}return a}getBlockAttributes(e){let n=[];for(;e&&e!==this.containerElement;){for(let c in V){let h=V[c];if(h.parse!==!1&&p(e)===h.tagName){var a;((a=h.test)!==null&&a!==void 0&&a.call(h,e)||!h.test)&&(n.push(c),h.listAttribute&&n.push(h.listAttribute))}}e=e.parentNode}return n.reverse()}getBlockHTMLAttributes(e){let n={},a=Object.values(V).find(h=>h.tagName===p(e));return((a==null?void 0:a.htmlAttributes)||[]).forEach(h=>{e.hasAttribute(h)&&(n[h]=e.getAttribute(h))}),n}findBlockElementAncestors(e){let n=[];for(;e&&e!==this.containerElement;){let a=p(e);v().includes(a)&&n.push(e),e=e.parentNode}return n}isBlockElement(e){if((e==null?void 0:e.nodeType)===Node.ELEMENT_NODE&&!zi(e)&&!kt(e,{matchingSelector:"td",untilNode:this.containerElement}))return v().includes(p(e))||window.getComputedStyle(e).display==="block"}isInsignificantTextNode(e){if((e==null?void 0:e.nodeType)!==Node.TEXT_NODE||!wv(e.data))return;let{parentNode:n,previousSibling:a,nextSibling:c}=e;if(!(bv(n.previousSibling)&&!this.isBlockElement(n.previousSibling))&&!Mf(n))return!a||this.isBlockElement(a)||!c||this.isBlockElement(c)}isExtraBR(e){return p(e)==="br"&&this.isBlockElement(e.parentNode)&&e.parentNode.lastChild===e}needsTableSeparator(e){if(Bt.removeBlankTableCells){var n;let a=(n=e.previousSibling)===null||n===void 0?void 0:n.textContent;return a&&/\S/.test(a)}else return e.previousSibling}translateBlockElementMarginsToNewlines(){let e=this.getMarginOfDefaultBlockElement();for(let n=0;ne.top*2&&this.prependStringToTextAtIndex(` `,n),a.bottom>e.bottom*2&&this.appendStringToTextAtIndex(` `,n))}}getMarginOfBlockElementAtIndex(e){let n=this.blockElements[e];if(n&&n.textContent&&!v().includes(p(n))&&!this.processedElements.includes(n))return Of(n)}getMarginOfDefaultBlockElement(){let e=d(V.default.tagName);return this.containerElement.appendChild(e),Of(e)}}let Mf=function(o){let{whiteSpace:e}=window.getComputedStyle(o);return["pre","pre-wrap","pre-line"].includes(e)},bv=o=>o&&!Pf(o.textContent),Of=function(o){let e=window.getComputedStyle(o);if(e.display==="block")return{top:parseInt(e.marginTop),bottom:parseInt(e.marginBottom)}},vv=function(o){return p(o)==="style"?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},yv=o=>o.replace(new RegExp("^".concat(b.source,"+")),""),wv=o=>new RegExp("^".concat(b.source,"*$")).test(o),Pf=o=>/\s$/.test(o),Ev="[data-trix-serialize=false]",Av=["contenteditable","data-trix-id","data-trix-store-key","data-trix-mutable","data-trix-placeholder","tabindex"],ru="data-trix-serialized-attributes",Sv="[".concat(ru,"]"),Tv=new RegExp("","g"),xv={"application/json":function(o){let e;if(o instanceof Vi)e=o;else if(o instanceof HTMLElement)e=Gn.parse(o.innerHTML).getDocument();else throw new Error("unserializable object");return e.toSerializableDocument().toJSONString()},"text/html":function(o){let e;if(o instanceof Vi)e=Xa.render(o);else if(o instanceof HTMLElement)e=o.cloneNode(!0);else throw new Error("unserializable object");return Array.from(e.querySelectorAll(Ev)).forEach(n=>{P(n)}),Av.forEach(n=>{Array.from(e.querySelectorAll("[".concat(n,"]"))).forEach(a=>{a.removeAttribute(n)})}),Array.from(e.querySelectorAll(Sv)).forEach(n=>{try{let a=JSON.parse(n.getAttribute(ru));n.removeAttribute(ru);for(let c in a){let h=a[c];n.setAttribute(c,h)}}catch(a){}}),e.innerHTML.replace(Tv,"")}},Cv={"application/json":function(o){return Vi.fromJSONString(o)},"text/html":function(o){return Gn.parse(o).getDocument()}},kv=function(o,e){let n=xv[e];if(n)return n(o);throw new Error("unknown content type: ".concat(e))},TA=function(o,e){let n=Cv[e];if(n)return n(o);throw new Error("unknown content type: ".concat(e))};var Lv=Object.freeze({__proto__:null});class ei extends qt{constructor(e,n){super(...arguments),this.attachmentManager=e,this.attachment=n,this.id=this.attachment.id,this.file=this.attachment.file}remove(){return this.attachmentManager.requestRemovalOfAttachment(this.attachment)}}ei.proxyMethod("attachment.getAttribute"),ei.proxyMethod("attachment.hasAttribute"),ei.proxyMethod("attachment.setAttribute"),ei.proxyMethod("attachment.getAttributes"),ei.proxyMethod("attachment.setAttributes"),ei.proxyMethod("attachment.isPending"),ei.proxyMethod("attachment.isPreviewable"),ei.proxyMethod("attachment.getURL"),ei.proxyMethod("attachment.getHref"),ei.proxyMethod("attachment.getFilename"),ei.proxyMethod("attachment.getFilesize"),ei.proxyMethod("attachment.getFormattedFilesize"),ei.proxyMethod("attachment.getExtension"),ei.proxyMethod("attachment.getContentType"),ei.proxyMethod("attachment.getFile"),ei.proxyMethod("attachment.setFile"),ei.proxyMethod("attachment.releaseFile"),ei.proxyMethod("attachment.getUploadProgress"),ei.proxyMethod("attachment.setUploadProgress");class If extends qt{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];super(...arguments),this.managedAttachments={},Array.from(e).forEach(n=>{this.manageAttachment(n)})}getAttachments(){let e=[];for(let n in this.managedAttachments){let a=this.managedAttachments[n];e.push(a)}return e}manageAttachment(e){return this.managedAttachments[e.id]||(this.managedAttachments[e.id]=new ei(this,e)),this.managedAttachments[e.id]}attachmentIsManaged(e){return e.id in this.managedAttachments}requestRemovalOfAttachment(e){if(this.attachmentIsManaged(e)){var n,a;return(n=this.delegate)===null||n===void 0||(a=n.attachmentManagerDidRequestRemovalOfAttachment)===null||a===void 0?void 0:a.call(n,e)}}unmanageAttachment(e){let n=this.managedAttachments[e.id];return delete this.managedAttachments[e.id],n}}class Nf{constructor(e){this.composition=e,this.document=this.composition.document;let n=this.composition.getSelectedRange();this.startPosition=n[0],this.endPosition=n[1],this.startLocation=this.document.locationFromPosition(this.startPosition),this.endLocation=this.document.locationFromPosition(this.endPosition),this.block=this.document.getBlockAtIndex(this.endLocation.index),this.breaksOnReturn=this.block.breaksOnReturn(),this.previousCharacter=this.block.text.getStringAtPosition(this.endLocation.offset-1),this.nextCharacter=this.block.text.getStringAtPosition(this.endLocation.offset)}shouldInsertBlockBreak(){return this.block.hasAttributes()&&this.block.isListItem()&&!this.block.isEmpty()?this.startLocation.offset!==0:this.breaksOnReturn&&this.nextCharacter!==` `}shouldBreakFormattedBlock(){return this.block.hasAttributes()&&!this.block.isListItem()&&(this.breaksOnReturn&&this.nextCharacter===` `||this.previousCharacter===` `)}shouldDecreaseListLevel(){return this.block.hasAttributes()&&this.block.isListItem()&&this.block.isEmpty()}shouldPrependListItem(){return this.block.isListItem()&&this.startLocation.offset===0&&!this.block.isEmpty()}shouldRemoveLastBlockAttribute(){return this.block.hasAttributes()&&!this.block.isListItem()&&this.block.isEmpty()}}let Ff=" ";class Qr extends qt{constructor(){super(...arguments),this.document=new Vi,this.attachments=[],this.currentAttributes={},this.revision=0}setDocument(e){if(!e.isEqualTo(this.document)){var n,a;return this.document=e,this.refreshAttachments(),this.revision++,(n=this.delegate)===null||n===void 0||(a=n.compositionDidChangeDocument)===null||a===void 0?void 0:a.call(n,e)}}getSnapshot(){return{document:this.document,selectedRange:this.getSelectedRange()}}loadSnapshot(e){var n,a,c,h;let{document:g,selectedRange:S}=e;return(n=this.delegate)===null||n===void 0||(a=n.compositionWillLoadSnapshot)===null||a===void 0||a.call(n),this.setDocument(g!=null?g:new Vi),this.setSelection(S!=null?S:[0,0]),(c=this.delegate)===null||c===void 0||(h=c.compositionDidLoadSnapshot)===null||h===void 0?void 0:h.call(c)}insertText(e){let{updatePosition:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{updatePosition:!0},a=this.getSelectedRange();this.setDocument(this.document.insertTextAtRange(e,a));let c=a[0],h=c+e.getLength();return n&&this.setSelection(h),this.notifyDelegateOfInsertionAtRange([c,h])}insertBlock(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new wr,n=new Vi([e]);return this.insertDocument(n)}insertDocument(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new Vi,n=this.getSelectedRange();this.setDocument(this.document.insertDocumentAtRange(e,n));let a=n[0],c=a+e.getLength();return this.setSelection(c),this.notifyDelegateOfInsertionAtRange([a,c])}insertString(e,n){let a=this.getCurrentTextAttributes(),c=nr.textForStringWithAttributes(e,a);return this.insertText(c,n)}insertBlockBreak(){let e=this.getSelectedRange();this.setDocument(this.document.insertBlockBreakAtRange(e));let n=e[0],a=n+1;return this.setSelection(a),this.notifyDelegateOfInsertionAtRange([n,a])}insertLineBreak(){let e=new Nf(this);if(e.shouldDecreaseListLevel())return this.decreaseListLevel(),this.setSelection(e.startPosition);if(e.shouldPrependListItem()){let n=new Vi([e.block.copyWithoutText()]);return this.insertDocument(n)}else return e.shouldInsertBlockBreak()?this.insertBlockBreak():e.shouldRemoveLastBlockAttribute()?this.removeLastBlockAttribute():e.shouldBreakFormattedBlock()?this.breakFormattedBlock(e):this.insertString(` `)}insertHTML(e){let n=Gn.parse(e).getDocument(),a=this.getSelectedRange();this.setDocument(this.document.mergeDocumentAtRange(n,a));let c=a[0],h=c+n.getLength()-1;return this.setSelection(h),this.notifyDelegateOfInsertionAtRange([c,h])}replaceHTML(e){let n=Gn.parse(e).getDocument().copyUsingObjectsFromDocument(this.document),a=this.getLocationRange({strict:!1}),c=this.document.rangeFromLocationRange(a);return this.setDocument(n),this.setSelection(c)}insertFile(e){return this.insertFiles([e])}insertFiles(e){let n=[];return Array.from(e).forEach(a=>{var c;if((c=this.delegate)!==null&&c!==void 0&&c.compositionShouldAcceptFile(a)){let h=Xn.attachmentForFile(a);n.push(h)}}),this.insertAttachments(n)}insertAttachment(e){return this.insertAttachments([e])}insertAttachments(e){let n=new nr;return Array.from(e).forEach(a=>{var c;let h=a.getType(),g=(c=I[h])===null||c===void 0?void 0:c.presentation,S=this.getCurrentTextAttributes();g&&(S.presentation=g);let x=nr.textForAttachmentWithAttributes(a,S);n=n.appendText(x)}),this.insertText(n)}shouldManageDeletingInDirection(e){let n=this.getLocationRange();if(ir(n)){if(e==="backward"&&n[0].offset===0||this.shouldManageMovingCursorInDirection(e))return!0}else if(n[0].index!==n[1].index)return!0;return!1}deleteInDirection(e){let{length:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a,c,h,g=this.getLocationRange(),S=this.getSelectedRange(),x=ir(S);if(x?c=e==="backward"&&g[0].offset===0:h=g[0].index!==g[1].index,c&&this.canDecreaseBlockAttributeLevel()){let _=this.getBlock();if(_.isListItem()?this.decreaseListLevel():this.decreaseBlockAttributeLevel(),this.setSelection(S[0]),_.isEmpty())return!1}if(x&&(S=this.getExpandedRangeInDirection(e,{length:n}),e==="backward"&&(a=this.getAttachmentAtRange(S))),a)return this.editAttachment(a),!1;if(this.setDocument(this.document.removeTextAtRange(S)),this.setSelection(S[0]),c||h)return!1}moveTextFromRange(e){let[n]=Array.from(this.getSelectedRange());return this.setDocument(this.document.moveTextFromRangeToPosition(e,n)),this.setSelection(n)}removeAttachment(e){let n=this.document.getRangeOfAttachment(e);if(n)return this.stopEditingAttachment(),this.setDocument(this.document.removeTextAtRange(n)),this.setSelection(n[0])}removeLastBlockAttribute(){let[e,n]=Array.from(this.getSelectedRange()),a=this.document.getBlockAtPosition(n);return this.removeCurrentAttribute(a.getLastAttribute()),this.setSelection(e)}insertPlaceholder(){return this.placeholderPosition=this.getPosition(),this.insertString(Ff)}selectPlaceholder(){if(this.placeholderPosition!=null)return this.setSelectedRange([this.placeholderPosition,this.placeholderPosition+Ff.length]),this.getSelectedRange()}forgetPlaceholder(){this.placeholderPosition=null}hasCurrentAttribute(e){let n=this.currentAttributes[e];return n!=null&&n!==!1}toggleCurrentAttribute(e){let n=!this.currentAttributes[e];return n?this.setCurrentAttribute(e,n):this.removeCurrentAttribute(e)}canSetCurrentAttribute(e){return ye(e)?this.canSetCurrentBlockAttribute(e):this.canSetCurrentTextAttribute(e)}canSetCurrentTextAttribute(e){let n=this.getSelectedDocument();if(n){for(let a of Array.from(n.getAttachments()))if(!a.hasContent())return!1;return!0}}canSetCurrentBlockAttribute(e){let n=this.getBlock();if(n)return!n.isTerminalBlock()}setCurrentAttribute(e,n){return ye(e)?this.setBlockAttribute(e,n):(this.setTextAttribute(e,n),this.currentAttributes[e]=n,this.notifyDelegateOfCurrentAttributesChange())}setHTMLAtributeAtPosition(e,n,a){var c;let h=this.document.getBlockAtPosition(e),g=(c=ye(h.getLastAttribute()))===null||c===void 0?void 0:c.htmlAttributes;if(h&&g!==null&&g!==void 0&&g.includes(n)){let S=this.document.setHTMLAttributeAtPosition(e,n,a);this.setDocument(S)}}setTextAttribute(e,n){let a=this.getSelectedRange();if(!a)return;let[c,h]=Array.from(a);if(c===h){if(e==="href"){let g=nr.textForStringWithAttributes(n,{href:n});return this.insertText(g)}}else return this.setDocument(this.document.addAttributeAtRange(e,n,a))}setBlockAttribute(e,n){let a=this.getSelectedRange();if(this.canSetCurrentAttribute(e))return this.setDocument(this.document.applyBlockAttributeAtRange(e,n,a)),this.setSelection(a)}removeCurrentAttribute(e){return ye(e)?(this.removeBlockAttribute(e),this.updateCurrentAttributes()):(this.removeTextAttribute(e),delete this.currentAttributes[e],this.notifyDelegateOfCurrentAttributesChange())}removeTextAttribute(e){let n=this.getSelectedRange();if(n)return this.setDocument(this.document.removeAttributeAtRange(e,n))}removeBlockAttribute(e){let n=this.getSelectedRange();if(n)return this.setDocument(this.document.removeAttributeAtRange(e,n))}canDecreaseNestingLevel(){var e;return((e=this.getBlock())===null||e===void 0?void 0:e.getNestingLevel())>0}canIncreaseNestingLevel(){var e;let n=this.getBlock();if(n)if((e=ye(n.getLastNestableAttribute()))!==null&&e!==void 0&&e.listAttribute){let a=this.getPreviousBlock();if(a)return Gi(a.getListItemAttributes(),n.getListItemAttributes())}else return n.getNestingLevel()>0}decreaseNestingLevel(){let e=this.getBlock();if(e)return this.setDocument(this.document.replaceBlock(e,e.decreaseNestingLevel()))}increaseNestingLevel(){let e=this.getBlock();if(e)return this.setDocument(this.document.replaceBlock(e,e.increaseNestingLevel()))}canDecreaseBlockAttributeLevel(){var e;return((e=this.getBlock())===null||e===void 0?void 0:e.getAttributeLevel())>0}decreaseBlockAttributeLevel(){var e;let n=(e=this.getBlock())===null||e===void 0?void 0:e.getLastAttribute();if(n)return this.removeCurrentAttribute(n)}decreaseListLevel(){let[e]=Array.from(this.getSelectedRange()),{index:n}=this.document.locationFromPosition(e),a=n,c=this.getBlock().getAttributeLevel(),h=this.document.getBlockAtIndex(a+1);for(;h&&!(!h.isListItem()||h.getAttributeLevel()<=c);)a++,h=this.document.getBlockAtIndex(a+1);e=this.document.positionFromLocation({index:n,offset:0});let g=this.document.positionFromLocation({index:a,offset:0});return this.setDocument(this.document.removeLastListAttributeAtRange([e,g]))}updateCurrentAttributes(){let e=this.getSelectedRange({ignoreLock:!0});if(e){let n=this.document.getCommonAttributesAtRange(e);if(Array.from(Di()).forEach(a=>{n[a]||this.canSetCurrentAttribute(a)||(n[a]=!1)}),!Gr(n,this.currentAttributes))return this.currentAttributes=n,this.notifyDelegateOfCurrentAttributesChange()}}getCurrentAttributes(){return St.call({},this.currentAttributes)}getCurrentTextAttributes(){let e={};for(let n in this.currentAttributes){let a=this.currentAttributes[n];a!==!1&&zn(n)&&(e[n]=a)}return e}freezeSelection(){return this.setCurrentAttribute("frozen",!0)}thawSelection(){return this.removeCurrentAttribute("frozen")}hasFrozenSelection(){return this.hasCurrentAttribute("frozen")}setSelection(e){var n;let a=this.document.locationRangeFromRange(e);return(n=this.delegate)===null||n===void 0?void 0:n.compositionDidRequestChangingSelectionToLocationRange(a)}getSelectedRange(){let e=this.getLocationRange();if(e)return this.document.rangeFromLocationRange(e)}setSelectedRange(e){let n=this.document.locationRangeFromRange(e);return this.getSelectionManager().setLocationRange(n)}getPosition(){let e=this.getLocationRange();if(e)return this.document.positionFromLocation(e[0])}getLocationRange(e){return this.targetLocationRange?this.targetLocationRange:this.getSelectionManager().getLocationRange(e)||Ce({index:0,offset:0})}withTargetLocationRange(e,n){let a;this.targetLocationRange=e;try{a=n()}finally{this.targetLocationRange=null}return a}withTargetRange(e,n){let a=this.document.locationRangeFromRange(e);return this.withTargetLocationRange(a,n)}withTargetDOMRange(e,n){let a=this.createLocationRangeFromDOMRange(e,{strict:!1});return this.withTargetLocationRange(a,n)}getExpandedRangeInDirection(e){let{length:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},[a,c]=Array.from(this.getSelectedRange());return e==="backward"?n?a-=n:a=this.translateUTF16PositionFromOffset(a,-1):n?c+=n:c=this.translateUTF16PositionFromOffset(c,1),Ce([a,c])}shouldManageMovingCursorInDirection(e){if(this.editingAttachment)return!0;let n=this.getExpandedRangeInDirection(e);return this.getAttachmentAtRange(n)!=null}moveCursorInDirection(e){let n,a;if(this.editingAttachment)a=this.document.getRangeOfAttachment(this.editingAttachment);else{let c=this.getSelectedRange();a=this.getExpandedRangeInDirection(e),n=!Wn(c,a)}if(e==="backward"?this.setSelectedRange(a[0]):this.setSelectedRange(a[1]),n){let c=this.getAttachmentAtRange(a);if(c)return this.editAttachment(c)}}expandSelectionInDirection(e){let{length:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=this.getExpandedRangeInDirection(e,{length:n});return this.setSelectedRange(a)}expandSelectionForEditing(){if(this.hasCurrentAttribute("href"))return this.expandSelectionAroundCommonAttribute("href")}expandSelectionAroundCommonAttribute(e){let n=this.getPosition(),a=this.document.getRangeOfCommonAttributeAtPosition(e,n);return this.setSelectedRange(a)}selectionContainsAttachments(){var e;return((e=this.getSelectedAttachments())===null||e===void 0?void 0:e.length)>0}selectionIsInCursorTarget(){return this.editingAttachment||this.positionIsCursorTarget(this.getPosition())}positionIsCursorTarget(e){let n=this.document.locationFromPosition(e);if(n)return this.locationIsCursorTarget(n)}positionIsBlockBreak(e){var n;return(n=this.document.getPieceAtPosition(e))===null||n===void 0?void 0:n.isBlockBreak()}getSelectedDocument(){let e=this.getSelectedRange();if(e)return this.document.getDocumentAtRange(e)}getSelectedAttachments(){var e;return(e=this.getSelectedDocument())===null||e===void 0?void 0:e.getAttachments()}getAttachments(){return this.attachments.slice(0)}refreshAttachments(){let e=this.document.getAttachments(),{added:n,removed:a}=Nc(this.attachments,e);return this.attachments=e,Array.from(a).forEach(c=>{var h,g;c.delegate=null,(h=this.delegate)===null||h===void 0||(g=h.compositionDidRemoveAttachment)===null||g===void 0||g.call(h,c)}),(()=>{let c=[];return Array.from(n).forEach(h=>{var g,S;h.delegate=this,c.push((g=this.delegate)===null||g===void 0||(S=g.compositionDidAddAttachment)===null||S===void 0?void 0:S.call(g,h))}),c})()}attachmentDidChangeAttributes(e){var n,a;return this.revision++,(n=this.delegate)===null||n===void 0||(a=n.compositionDidEditAttachment)===null||a===void 0?void 0:a.call(n,e)}attachmentDidChangePreviewURL(e){var n,a;return this.revision++,(n=this.delegate)===null||n===void 0||(a=n.compositionDidChangeAttachmentPreviewURL)===null||a===void 0?void 0:a.call(n,e)}editAttachment(e,n){var a,c;if(e!==this.editingAttachment)return this.stopEditingAttachment(),this.editingAttachment=e,(a=this.delegate)===null||a===void 0||(c=a.compositionDidStartEditingAttachment)===null||c===void 0?void 0:c.call(a,this.editingAttachment,n)}stopEditingAttachment(){var e,n;this.editingAttachment&&((e=this.delegate)===null||e===void 0||(n=e.compositionDidStopEditingAttachment)===null||n===void 0||n.call(e,this.editingAttachment),this.editingAttachment=null)}updateAttributesForAttachment(e,n){return this.setDocument(this.document.updateAttributesForAttachment(e,n))}removeAttributeForAttachment(e,n){return this.setDocument(this.document.removeAttributeForAttachment(e,n))}breakFormattedBlock(e){let{document:n}=e,{block:a}=e,c=e.startPosition,h=[c-1,c];a.getBlockBreakPosition()===e.startLocation.offset?(a.breaksOnReturn()&&e.nextCharacter===` `?c+=1:n=n.removeTextAtRange(h),h=[c,c]):e.nextCharacter===` `?e.previousCharacter===` `?h=[c-1,c+1]:(h=[c,c+1],c+=1):e.startLocation.offset-1!==0&&(c+=1);let g=new Vi([a.removeLastAttribute().copyWithoutText()]);return this.setDocument(n.insertDocumentAtRange(g,h)),this.setSelection(c)}getPreviousBlock(){let e=this.getLocationRange();if(e){let{index:n}=e[0];if(n>0)return this.document.getBlockAtIndex(n-1)}}getBlock(){let e=this.getLocationRange();if(e)return this.document.getBlockAtIndex(e[0].index)}getAttachmentAtRange(e){let n=this.document.getDocumentAtRange(e);if(n.toString()==="".concat(F,` `))return n.getAttachments()[0]}notifyDelegateOfCurrentAttributesChange(){var e,n;return(e=this.delegate)===null||e===void 0||(n=e.compositionDidChangeCurrentAttributes)===null||n===void 0?void 0:n.call(e,this.currentAttributes)}notifyDelegateOfInsertionAtRange(e){var n,a;return(n=this.delegate)===null||n===void 0||(a=n.compositionDidPerformInsertionAtRange)===null||a===void 0?void 0:a.call(n,e)}translateUTF16PositionFromOffset(e,n){let a=this.document.toUTF16String(),c=a.offsetFromUCS2Offset(e);return a.offsetToUCS2Offset(c+n)}}Qr.proxyMethod("getSelectionManager().getPointRange"),Qr.proxyMethod("getSelectionManager().setLocationRangeFromPointRange"),Qr.proxyMethod("getSelectionManager().createLocationRangeFromDOMRange"),Qr.proxyMethod("getSelectionManager().locationIsCursorTarget"),Qr.proxyMethod("getSelectionManager().selectionIsExpanded"),Qr.proxyMethod("delegate?.getSelectionManager");class nu extends qt{constructor(e){super(...arguments),this.composition=e,this.undoEntries=[],this.redoEntries=[]}recordUndoEntry(e){let{context:n,consolidatable:a}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},c=this.undoEntries.slice(-1)[0];if(!a||!_v(c,e,n)){let h=this.createEntry({description:e,context:n});this.undoEntries.push(h),this.redoEntries=[]}}undo(){let e=this.undoEntries.pop();if(e){let n=this.createEntry(e);return this.redoEntries.push(n),this.composition.loadSnapshot(e.snapshot)}}redo(){let e=this.redoEntries.pop();if(e){let n=this.createEntry(e);return this.undoEntries.push(n),this.composition.loadSnapshot(e.snapshot)}}canUndo(){return this.undoEntries.length>0}canRedo(){return this.redoEntries.length>0}createEntry(){let{description:e,context:n}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{description:e==null?void 0:e.toString(),context:JSON.stringify(n),snapshot:this.composition.getSnapshot()}}}let _v=(o,e,n)=>(o==null?void 0:o.description)===(e==null?void 0:e.toString())&&(o==null?void 0:o.context)===JSON.stringify(n),su="attachmentGallery",Dv="presentation",Rv="gallery";class Bf{constructor(e){this.document=e.document,this.selectedRange=e.selectedRange}perform(){return this.removeBlockAttribute(),this.applyBlockAttribute()}getSnapshot(){return{document:this.document,selectedRange:this.selectedRange}}removeBlockAttribute(){return this.findRangesOfBlocks().map(e=>this.document=this.document.removeAttributeAtRange(su,e))}applyBlockAttribute(){let e=0;this.findRangesOfPieces().forEach(n=>{n[1]-n[0]>1&&(n[0]+=e,n[1]+=e,this.document.getCharacterAtPosition(n[1])!==` `&&(this.document=this.document.insertBlockBreakAtRange(n[1]),n[1]0&&arguments[0]!==void 0?arguments[0]:"",n=Gn.parse(e,{referenceElement:this.element}).getDocument();return this.loadDocument(n)}loadJSON(e){let{document:n,selectedRange:a}=e;return n=Vi.fromJSON(n),this.loadSnapshot({document:n,selectedRange:a})}loadSnapshot(e){return this.undoManager=new nu(this.composition),this.composition.loadSnapshot(e)}getDocument(){return this.composition.document}getSelectedDocument(){return this.composition.getSelectedDocument()}getSnapshot(){return this.composition.getSnapshot()}toJSON(){return this.getSnapshot()}deleteInDirection(e){return this.composition.deleteInDirection(e)}insertAttachment(e){return this.composition.insertAttachment(e)}insertAttachments(e){return this.composition.insertAttachments(e)}insertDocument(e){return this.composition.insertDocument(e)}insertFile(e){return this.composition.insertFile(e)}insertFiles(e){return this.composition.insertFiles(e)}insertHTML(e){return this.composition.insertHTML(e)}insertString(e){return this.composition.insertString(e)}insertText(e){return this.composition.insertText(e)}insertLineBreak(){return this.composition.insertLineBreak()}getSelectedRange(){return this.composition.getSelectedRange()}getPosition(){return this.composition.getPosition()}getClientRectAtPosition(e){let n=this.getDocument().locationRangeFromRange([e,e+1]);return this.selectionManager.getClientRectAtLocationRange(n)}expandSelectionInDirection(e){return this.composition.expandSelectionInDirection(e)}moveCursorInDirection(e){return this.composition.moveCursorInDirection(e)}setSelectedRange(e){return this.composition.setSelectedRange(e)}activateAttribute(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return this.composition.setCurrentAttribute(e,n)}attributeIsActive(e){return this.composition.hasCurrentAttribute(e)}canActivateAttribute(e){return this.composition.canSetCurrentAttribute(e)}deactivateAttribute(e){return this.composition.removeCurrentAttribute(e)}setHTMLAtributeAtPosition(e,n,a){this.composition.setHTMLAtributeAtPosition(e,n,a)}canDecreaseNestingLevel(){return this.composition.canDecreaseNestingLevel()}canIncreaseNestingLevel(){return this.composition.canIncreaseNestingLevel()}decreaseNestingLevel(){if(this.canDecreaseNestingLevel())return this.composition.decreaseNestingLevel()}increaseNestingLevel(){if(this.canIncreaseNestingLevel())return this.composition.increaseNestingLevel()}canRedo(){return this.undoManager.canRedo()}canUndo(){return this.undoManager.canUndo()}recordUndoEntry(e){let{context:n,consolidatable:a}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.undoManager.recordUndoEntry(e,{context:n,consolidatable:a})}redo(){if(this.canRedo())return this.undoManager.redo()}undo(){if(this.canUndo())return this.undoManager.undo()}}class qf{constructor(e){this.element=e}findLocationFromContainerAndOffset(e,n){let{strict:a}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{strict:!0},c=0,h=!1,g={index:0,offset:0},S=this.findAttachmentElementParentForNode(e);S&&(e=S.parentNode,n=zt(S));let x=k(this.element,{usingFilter:zf});for(;x.nextNode();){let _=x.currentNode;if(_===e&&dr(e)){gi(_)||(g.offset+=n);break}else{if(_.parentNode===e){if(c++===n)break}else if(!Kt(e,_)&&c>0)break;Ie(_,{strict:a})?(h&&g.index++,g.offset=0,h=!0):g.offset+=ou(_)}}return g}findContainerAndOffsetFromLocation(e){let n,a;if(e.index===0&&e.offset===0){for(n=this.element,a=0;n.firstChild;)if(n=n.firstChild,he(n)){a=1;break}return[n,a]}let[c,h]=this.findNodeAndOffsetFromLocation(e);if(c){if(dr(c))ou(c)===0?(n=c.parentNode.parentNode,a=zt(c.parentNode),gi(c,{name:"right"})&&a++):(n=c,a=e.offset-h);else{if(n=c.parentNode,!Ie(c.previousSibling)&&!he(n))for(;c===n.lastChild&&(c=n,n=n.parentNode,!he(n)););a=zt(c),e.offset!==0&&a++}return[n,a]}}findNodeAndOffsetFromLocation(e){let n,a,c=0;for(let h of this.getSignificantNodesForIndex(e.index)){let g=ou(h);if(e.offset<=c+g)if(dr(h)){if(n=h,a=c,e.offset===a&&gi(n))break}else n||(n=h,a=c);if(c+=g,c>e.offset)break}return[n,a]}findAttachmentElementParentForNode(e){for(;e&&e!==this.element;){if(zi(e))return e;e=e.parentNode}}getSignificantNodesForIndex(e){let n=[],a=k(this.element,{usingFilter:Ov}),c=!1;for(;a.nextNode();){let g=a.currentNode;if(ni(g)){var h;if(h!=null?h++:h=0,h===e)c=!0;else if(c)break}else c&&n.push(g)}return n}}let ou=function(o){return o.nodeType===Node.TEXT_NODE?gi(o)?0:o.textContent.length:p(o)==="br"||zi(o)?1:0},Ov=function(o){return Pv(o)===NodeFilter.FILTER_ACCEPT?zf(o):NodeFilter.FILTER_REJECT},Pv=function(o){return hr(o)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},zf=function(o){return zi(o.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT};class Wf{createDOMRangeFromPoint(e){let{x:n,y:a}=e,c;if(document.caretPositionFromPoint){let{offsetNode:h,offset:g}=document.caretPositionFromPoint(n,a);return c=document.createRange(),c.setStart(h,g),c}else{if(document.caretRangeFromPoint)return document.caretRangeFromPoint(n,a);if(document.body.createTextRange){let h=gn();try{let g=document.body.createTextRange();g.moveToPoint(n,a),g.select()}catch(g){}return c=gn(),Ha(h),c}}}getClientRectsForDOMRange(e){let n=Array.from(e.getClientRects()),a=n[0],c=n[n.length-1];return[a,c]}}class En extends qt{constructor(e){super(...arguments),this.didMouseDown=this.didMouseDown.bind(this),this.selectionDidChange=this.selectionDidChange.bind(this),this.element=e,this.locationMapper=new qf(this.element),this.pointMapper=new Wf,this.lockCount=0,E("mousedown",{onElement:this.element,withCallback:this.didMouseDown})}getLocationRange(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return e.strict===!1?this.createLocationRangeFromDOMRange(gn()):e.ignoreLock?this.currentLocationRange:this.lockedLocationRange?this.lockedLocationRange:this.currentLocationRange}setLocationRange(e){if(this.lockedLocationRange)return;e=Ce(e);let n=this.createDOMRangeFromLocationRange(e);n&&(Ha(n),this.updateCurrentLocationRange(e))}setLocationRangeFromPointRange(e){e=Ce(e);let n=this.getLocationAtPoint(e[0]),a=this.getLocationAtPoint(e[1]);this.setLocationRange([n,a])}getClientRectAtLocationRange(e){let n=this.createDOMRangeFromLocationRange(e);if(n)return this.getClientRectsForDOMRange(n)[1]}locationIsCursorTarget(e){let n=Array.from(this.findNodeAndOffsetFromLocation(e))[0];return gi(n)}lock(){this.lockCount++===0&&(this.updateCurrentLocationRange(),this.lockedLocationRange=this.getLocationRange())}unlock(){if(--this.lockCount===0){let{lockedLocationRange:e}=this;if(this.lockedLocationRange=null,e!=null)return this.setLocationRange(e)}}clearSelection(){var e;return(e=ja())===null||e===void 0?void 0:e.removeAllRanges()}selectionIsCollapsed(){var e;return((e=gn())===null||e===void 0?void 0:e.collapsed)===!0}selectionIsExpanded(){return!this.selectionIsCollapsed()}createLocationRangeFromDOMRange(e,n){if(e==null||!this.domRangeWithinElement(e))return;let a=this.findLocationFromContainerAndOffset(e.startContainer,e.startOffset,n);if(!a)return;let c=e.collapsed?void 0:this.findLocationFromContainerAndOffset(e.endContainer,e.endOffset,n);return Ce([a,c])}didMouseDown(){return this.pauseTemporarily()}pauseTemporarily(){let e;this.paused=!0;let n=()=>{if(this.paused=!1,clearTimeout(a),Array.from(e).forEach(c=>{c.destroy()}),Kt(document,this.element))return this.selectionDidChange()},a=setTimeout(n,200);e=["mousemove","keydown"].map(c=>E(c,{onElement:document,withCallback:n}))}selectionDidChange(){if(!this.paused&&!Wt(this.element))return this.updateCurrentLocationRange()}updateCurrentLocationRange(e){if((e!=null?e:e=this.createLocationRangeFromDOMRange(gn()))&&!Wn(e,this.currentLocationRange)){var n,a;return this.currentLocationRange=e,(n=this.delegate)===null||n===void 0||(a=n.locationRangeDidChange)===null||a===void 0?void 0:a.call(n,this.currentLocationRange.slice(0))}}createDOMRangeFromLocationRange(e){let n=this.findContainerAndOffsetFromLocation(e[0]),a=ir(e)?n:this.findContainerAndOffsetFromLocation(e[1])||n;if(n!=null&&a!=null){let c=document.createRange();return c.setStart(...Array.from(n||[])),c.setEnd(...Array.from(a||[])),c}}getLocationAtPoint(e){let n=this.createDOMRangeFromPoint(e);if(n){var a;return(a=this.createLocationRangeFromDOMRange(n))===null||a===void 0?void 0:a[0]}}domRangeWithinElement(e){return e.collapsed?Kt(this.element,e.startContainer):Kt(this.element,e.startContainer)&&Kt(this.element,e.endContainer)}}En.proxyMethod("locationMapper.findLocationFromContainerAndOffset"),En.proxyMethod("locationMapper.findContainerAndOffsetFromLocation"),En.proxyMethod("locationMapper.findNodeAndOffsetFromLocation"),En.proxyMethod("pointMapper.createDOMRangeFromPoint"),En.proxyMethod("pointMapper.getClientRectsForDOMRange");var Uf=Object.freeze({__proto__:null,Attachment:Xn,AttachmentManager:If,AttachmentPiece:Yn,Block:wr,Composition:Qr,Document:Vi,Editor:Hf,HTMLParser:Gn,HTMLSanitizer:$a,LineBreakInsertion:Nf,LocationMapper:qf,ManagedAttachment:ei,Piece:wn,PointMapper:Wf,SelectionManager:En,SplittableList:il,StringPiece:eu,Text:nr,UndoManager:nu}),Iv=Object.freeze({__proto__:null,ObjectView:Re,AttachmentView:Wc,BlockView:Ud,DocumentView:Xa,PieceView:qd,PreviewableAttachmentView:Hd,TextView:zd});let{lang:au,css:An,keyNames:Nv}=Pi,lu=function(o){return function(){let e=o.apply(this,arguments);e.do(),this.undos||(this.undos=[]),this.undos.push(e.undo)}};class Vf extends qt{constructor(e,n,a){let c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(...arguments),yi(this,"makeElementMutable",lu(()=>({do:()=>{this.element.dataset.trixMutable=!0},undo:()=>delete this.element.dataset.trixMutable}))),yi(this,"addToolbar",lu(()=>{let h=d({tagName:"div",className:An.attachmentToolbar,data:{trixMutable:!0},childNodes:d({tagName:"div",className:"trix-button-row",childNodes:d({tagName:"span",className:"trix-button-group trix-button-group--actions",childNodes:d({tagName:"button",className:"trix-button trix-button--remove",textContent:au.remove,attributes:{title:au.remove},data:{trixAction:"remove"}})})})});return this.attachment.isPreviewable()&&h.appendChild(d({tagName:"div",className:An.attachmentMetadataContainer,childNodes:d({tagName:"span",className:An.attachmentMetadata,childNodes:[d({tagName:"span",className:An.attachmentName,textContent:this.attachment.getFilename(),attributes:{title:this.attachment.getFilename()}}),d({tagName:"span",className:An.attachmentSize,textContent:this.attachment.getFormattedFilesize()})]})})),E("click",{onElement:h,withCallback:this.didClickToolbar}),E("click",{onElement:h,matchingSelector:"[data-trix-action]",withCallback:this.didClickActionButton}),Y("trix-attachment-before-toolbar",{onElement:this.element,attributes:{toolbar:h,attachment:this.attachment}}),{do:()=>this.element.appendChild(h),undo:()=>P(h)}})),yi(this,"installCaptionEditor",lu(()=>{let h=d({tagName:"textarea",className:An.attachmentCaptionEditor,attributes:{placeholder:au.captionPlaceholder},data:{trixMutable:!0}});h.value=this.attachmentPiece.getCaption();let g=h.cloneNode();g.classList.add("trix-autoresize-clone"),g.tabIndex=-1;let S=function(){g.value=h.value,h.style.height=g.scrollHeight+"px"};E("input",{onElement:h,withCallback:S}),E("input",{onElement:h,withCallback:this.didInputCaption}),E("keydown",{onElement:h,withCallback:this.didKeyDownCaption}),E("change",{onElement:h,withCallback:this.didChangeCaption}),E("blur",{onElement:h,withCallback:this.didBlurCaption});let x=this.element.querySelector("figcaption"),_=x.cloneNode();return{do:()=>{if(x.style.display="none",_.appendChild(h),_.appendChild(g),_.classList.add("".concat(An.attachmentCaption,"--editing")),x.parentElement.insertBefore(_,x),S(),this.options.editCaption)return Js(()=>h.focus())},undo(){P(_),x.style.display=null}}})),this.didClickToolbar=this.didClickToolbar.bind(this),this.didClickActionButton=this.didClickActionButton.bind(this),this.didKeyDownCaption=this.didKeyDownCaption.bind(this),this.didInputCaption=this.didInputCaption.bind(this),this.didChangeCaption=this.didChangeCaption.bind(this),this.didBlurCaption=this.didBlurCaption.bind(this),this.attachmentPiece=e,this.element=n,this.container=a,this.options=c,this.attachment=this.attachmentPiece.attachment,p(this.element)==="a"&&(this.element=this.element.firstChild),this.install()}install(){this.makeElementMutable(),this.addToolbar(),this.attachment.isPreviewable()&&this.installCaptionEditor()}uninstall(){var e;let n=this.undos.pop();for(this.savePendingCaption();n;)n(),n=this.undos.pop();(e=this.delegate)===null||e===void 0||e.didUninstallAttachmentEditor(this)}savePendingCaption(){if(this.pendingCaption!=null){let h=this.pendingCaption;if(this.pendingCaption=null,h){var e,n;(e=this.delegate)===null||e===void 0||(n=e.attachmentEditorDidRequestUpdatingAttributesForAttachment)===null||n===void 0||n.call(e,{caption:h},this.attachment)}else{var a,c;(a=this.delegate)===null||a===void 0||(c=a.attachmentEditorDidRequestRemovingAttributeForAttachment)===null||c===void 0||c.call(a,"caption",this.attachment)}}}didClickToolbar(e){return e.preventDefault(),e.stopPropagation()}didClickActionButton(e){var n;switch(e.target.getAttribute("data-trix-action")){case"remove":return(n=this.delegate)===null||n===void 0?void 0:n.attachmentEditorDidRequestRemovalOfAttachment(this.attachment)}}didKeyDownCaption(e){if(Nv[e.keyCode]==="return"){var n,a;return e.preventDefault(),this.savePendingCaption(),(n=this.delegate)===null||n===void 0||(a=n.attachmentEditorDidRequestDeselectingAttachment)===null||a===void 0?void 0:a.call(n,this.attachment)}}didInputCaption(e){this.pendingCaption=e.target.value.replace(/\s/g," ").trim()}didChangeCaption(e){return this.savePendingCaption()}didBlurCaption(e){return this.savePendingCaption()}}class $f extends qt{constructor(e,n){super(...arguments),this.didFocus=this.didFocus.bind(this),this.didBlur=this.didBlur.bind(this),this.didClickAttachment=this.didClickAttachment.bind(this),this.element=e,this.composition=n,this.documentView=new Xa(this.composition.document,{element:this.element}),E("focus",{onElement:this.element,withCallback:this.didFocus}),E("blur",{onElement:this.element,withCallback:this.didBlur}),E("click",{onElement:this.element,matchingSelector:"a[contenteditable=false]",preventDefault:!0}),E("mousedown",{onElement:this.element,matchingSelector:R,withCallback:this.didClickAttachment}),E("click",{onElement:this.element,matchingSelector:"a".concat(R),preventDefault:!0})}didFocus(e){var n;let a=()=>{if(!this.focused){var c,h;return this.focused=!0,(c=this.delegate)===null||c===void 0||(h=c.compositionControllerDidFocus)===null||h===void 0?void 0:h.call(c)}};return((n=this.blurPromise)===null||n===void 0?void 0:n.then(a))||a()}didBlur(e){this.blurPromise=new Promise(n=>Js(()=>{if(!Wt(this.element)){var a,c;this.focused=null,(a=this.delegate)===null||a===void 0||(c=a.compositionControllerDidBlur)===null||c===void 0||c.call(a)}return this.blurPromise=null,n()}))}didClickAttachment(e,n){var a,c;let h=this.findAttachmentForElement(n),g=!!kt(e.target,{matchingSelector:"figcaption"});return(a=this.delegate)===null||a===void 0||(c=a.compositionControllerDidSelectAttachment)===null||c===void 0?void 0:c.call(a,h,{editCaption:g})}getSerializableElement(){return this.isEditingAttachment()?this.documentView.shadowElement:this.element}render(){var e,n;if(this.revision!==this.composition.revision&&(this.documentView.setDocument(this.composition.document),this.documentView.render(),this.revision=this.composition.revision),this.canSyncDocumentView()&&!this.documentView.isSynced()){var a,c,h,g;(a=this.delegate)===null||a===void 0||(c=a.compositionControllerWillSyncDocumentView)===null||c===void 0||c.call(a),this.documentView.sync(),(h=this.delegate)===null||h===void 0||(g=h.compositionControllerDidSyncDocumentView)===null||g===void 0||g.call(h)}return(e=this.delegate)===null||e===void 0||(n=e.compositionControllerDidRender)===null||n===void 0?void 0:n.call(e)}rerenderViewForObject(e){return this.invalidateViewForObject(e),this.render()}invalidateViewForObject(e){return this.documentView.invalidateViewForObject(e)}isViewCachingEnabled(){return this.documentView.isViewCachingEnabled()}enableViewCaching(){return this.documentView.enableViewCaching()}disableViewCaching(){return this.documentView.disableViewCaching()}refreshViewCache(){return this.documentView.garbageCollectCachedViews()}isEditingAttachment(){return!!this.attachmentEditor}installAttachmentEditorForAttachment(e,n){var a;if(((a=this.attachmentEditor)===null||a===void 0?void 0:a.attachment)===e)return;let c=this.documentView.findElementForObject(e);if(!c)return;this.uninstallAttachmentEditor();let h=this.composition.document.getAttachmentPieceForAttachment(e);this.attachmentEditor=new Vf(h,c,this.element,n),this.attachmentEditor.delegate=this}uninstallAttachmentEditor(){var e;return(e=this.attachmentEditor)===null||e===void 0?void 0:e.uninstall()}didUninstallAttachmentEditor(){return this.attachmentEditor=null,this.render()}attachmentEditorDidRequestUpdatingAttributesForAttachment(e,n){var a,c;return(a=this.delegate)===null||a===void 0||(c=a.compositionControllerWillUpdateAttachment)===null||c===void 0||c.call(a,n),this.composition.updateAttributesForAttachment(e,n)}attachmentEditorDidRequestRemovingAttributeForAttachment(e,n){var a,c;return(a=this.delegate)===null||a===void 0||(c=a.compositionControllerWillUpdateAttachment)===null||c===void 0||c.call(a,n),this.composition.removeAttributeForAttachment(e,n)}attachmentEditorDidRequestRemovalOfAttachment(e){var n,a;return(n=this.delegate)===null||n===void 0||(a=n.compositionControllerDidRequestRemovalOfAttachment)===null||a===void 0?void 0:a.call(n,e)}attachmentEditorDidRequestDeselectingAttachment(e){var n,a;return(n=this.delegate)===null||n===void 0||(a=n.compositionControllerDidRequestDeselectingAttachment)===null||a===void 0?void 0:a.call(n,e)}canSyncDocumentView(){return!this.isEditingAttachment()}findAttachmentForElement(e){return this.composition.document.getAttachmentById(parseInt(e.dataset.trixId,10))}}class Xf extends qt{}let Yf="data-trix-mutable",Fv="[".concat(Yf,"]"),Bv={attributes:!0,childList:!0,characterData:!0,characterDataOldValue:!0,subtree:!0};class Gf extends qt{constructor(e){super(e),this.didMutate=this.didMutate.bind(this),this.element=e,this.observer=new window.MutationObserver(this.didMutate),this.start()}start(){return this.reset(),this.observer.observe(this.element,Bv)}stop(){return this.observer.disconnect()}didMutate(e){if(this.mutations.push(...Array.from(this.findSignificantMutations(e)||[])),this.mutations.length){var n,a;return(n=this.delegate)===null||n===void 0||(a=n.elementDidMutate)===null||a===void 0||a.call(n,this.getMutationSummary()),this.reset()}}reset(){this.mutations=[]}findSignificantMutations(e){return e.filter(n=>this.mutationIsSignificant(n))}mutationIsSignificant(e){if(this.nodeIsMutable(e.target))return!1;for(let n of Array.from(this.nodesModifiedByMutation(e)))if(this.nodeIsSignificant(n))return!0;return!1}nodeIsSignificant(e){return e!==this.element&&!this.nodeIsMutable(e)&&!hr(e)}nodeIsMutable(e){return kt(e,{matchingSelector:Fv})}nodesModifiedByMutation(e){let n=[];switch(e.type){case"attributes":e.attributeName!==Yf&&n.push(e.target);break;case"characterData":n.push(e.target.parentNode),n.push(e.target);break;case"childList":n.push(...Array.from(e.addedNodes||[])),n.push(...Array.from(e.removedNodes||[]));break}return n}getMutationSummary(){return this.getTextMutationSummary()}getTextMutationSummary(){let{additions:e,deletions:n}=this.getTextChangesFromCharacterData(),a=this.getTextChangesFromChildList();Array.from(a.additions).forEach(S=>{Array.from(e).includes(S)||e.push(S)}),n.push(...Array.from(a.deletions||[]));let c={},h=e.join("");h&&(c.textAdded=h);let g=n.join("");return g&&(c.textDeleted=g),c}getMutationsByType(e){return Array.from(this.mutations).filter(n=>n.type===e)}getTextChangesFromChildList(){let e,n,a=[],c=[];Array.from(this.getMutationsByType("childList")).forEach(x=>{a.push(...Array.from(x.addedNodes||[])),c.push(...Array.from(x.removedNodes||[]))}),a.length===0&&c.length===1&&ni(c[0])?(e=[],n=[` `]):(e=cu(a),n=cu(c));let g=e.filter((x,_)=>x!==n[_]).map(m),S=n.filter((x,_)=>x!==e[_]).map(m);return{additions:g,deletions:S}}getTextChangesFromCharacterData(){let e,n,a=this.getMutationsByType("characterData");if(a.length){let c=a[0],h=a[a.length-1],g=m(c.oldValue),S=m(h.target.data),x=M(g,S);e=x.added,n=x.removed}return{additions:e?[e]:[],deletions:n?[n]:[]}}}let cu=function(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=[];for(let n of Array.from(o))switch(n.nodeType){case Node.TEXT_NODE:e.push(n.data);break;case Node.ELEMENT_NODE:p(n)==="br"?e.push(` `):e.push(...Array.from(cu(n.childNodes)||[]));break}return e};class Kf extends We{constructor(e){super(...arguments),this.file=e}perform(e){let n=new FileReader;return n.onerror=()=>e(!1),n.onload=()=>{n.onerror=null;try{n.abort()}catch(a){}return e(!0,this.file)},n.readAsArrayBuffer(this.file)}}class jv{constructor(e){this.element=e}shouldIgnore(e){return Et.samsungAndroid?(this.previousEvent=this.event,this.event=e,this.checkSamsungKeyboardBuggyModeStart(),this.checkSamsungKeyboardBuggyModeEnd(),this.buggyMode):!1}checkSamsungKeyboardBuggyModeStart(){this.insertingLongTextAfterUnidentifiedChar()&&Hv(this.element.innerText,this.event.data)&&(this.buggyMode=!0,this.event.preventDefault())}checkSamsungKeyboardBuggyModeEnd(){this.buggyMode&&this.event.inputType!=="insertText"&&(this.buggyMode=!1)}insertingLongTextAfterUnidentifiedChar(){var e;return this.isBeforeInputInsertText()&&this.previousEventWasUnidentifiedKeydown()&&((e=this.event.data)===null||e===void 0?void 0:e.length)>50}isBeforeInputInsertText(){return this.event.type==="beforeinput"&&this.event.inputType==="insertText"}previousEventWasUnidentifiedKeydown(){var e,n;return((e=this.previousEvent)===null||e===void 0?void 0:e.type)==="keydown"&&((n=this.previousEvent)===null||n===void 0?void 0:n.key)==="Unidentified"}}let Hv=(o,e)=>Jf(o)===Jf(e),qv=new RegExp("(".concat(F,"|").concat(G,"|").concat(C,"|\\s)+"),"g"),Jf=o=>o.replace(qv," ").trim();class rl extends qt{constructor(e){super(...arguments),this.element=e,this.mutationObserver=new Gf(this.element),this.mutationObserver.delegate=this,this.flakyKeyboardDetector=new jv(this.element);for(let n in this.constructor.events)E(n,{onElement:this.element,withCallback:this.handlerFor(n)})}elementDidMutate(e){}editorWillSyncDocumentView(){return this.mutationObserver.stop()}editorDidSyncDocumentView(){return this.mutationObserver.start()}requestRender(){var e,n;return(e=this.delegate)===null||e===void 0||(n=e.inputControllerDidRequestRender)===null||n===void 0?void 0:n.call(e)}requestReparse(){var e,n;return(e=this.delegate)===null||e===void 0||(n=e.inputControllerDidRequestReparse)===null||n===void 0||n.call(e),this.requestRender()}attachFiles(e){let n=Array.from(e).map(a=>new Kf(a));return Promise.all(n).then(a=>{this.handleInput(function(){var c,h;return(c=this.delegate)===null||c===void 0||c.inputControllerWillAttachFiles(),(h=this.responder)===null||h===void 0||h.insertFiles(a),this.requestRender()})})}handlerFor(e){return n=>{n.defaultPrevented||this.handleInput(()=>{if(!Wt(this.element)){if(this.flakyKeyboardDetector.shouldIgnore(n))return;this.eventName=e,this.constructor.events[e].call(this,n)}})}}handleInput(e){try{var n;(n=this.delegate)===null||n===void 0||n.inputControllerWillHandleInput(),e.call(this)}finally{var a;(a=this.delegate)===null||a===void 0||a.inputControllerDidHandleInput()}}createLinkHTML(e,n){let a=document.createElement("a");return a.href=e,a.textContent=n||e,a.outerHTML}}yi(rl,"events",{});var uu,Zf;let{browser:zv,keyNames:Qf}=Pi,Wv=0;class Rr extends rl{constructor(){super(...arguments),this.resetInputSummary()}setInputSummary(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.inputSummary.eventName=this.eventName;for(let n in e){let a=e[n];this.inputSummary[n]=a}return this.inputSummary}resetInputSummary(){this.inputSummary={}}reset(){return this.resetInputSummary(),Dr.reset()}elementDidMutate(e){if(this.isComposing()){var n,a;return(n=this.delegate)===null||n===void 0||(a=n.inputControllerDidAllowUnhandledInput)===null||a===void 0?void 0:a.call(n)}else return this.handleInput(function(){return this.mutationIsSignificant(e)&&(this.mutationIsExpected(e)?this.requestRender():this.requestReparse()),this.reset()})}mutationIsExpected(e){let{textAdded:n,textDeleted:a}=e;if(this.inputSummary.preferDocument)return!0;let c=n!=null?n===this.inputSummary.textAdded:!this.inputSummary.textAdded,h=a!=null?this.inputSummary.didDelete:!this.inputSummary.didDelete,g=[` `,` `].includes(n)&&!c,S=a===` `&&!h;if(g&&!S||S&&!g){let O=this.getSelectedRange();if(O){var _;let q=g?n.replace(/\n$/,"").length||-1:(n==null?void 0:n.length)||1;if((_=this.responder)!==null&&_!==void 0&&_.positionIsBlockBreak(O[1]+q))return!0}}return c&&h}mutationIsSignificant(e){var n;let a=Object.keys(e).length>0,c=((n=this.compositionInput)===null||n===void 0?void 0:n.getEndData())==="";return a||!c}getCompositionInput(){if(this.isComposing())return this.compositionInput;this.compositionInput=new tn(this)}isComposing(){return this.compositionInput&&!this.compositionInput.isEnded()}deleteInDirection(e,n){var a;if(((a=this.responder)===null||a===void 0?void 0:a.deleteInDirection(e))===!1){if(n)return n.preventDefault(),this.requestRender()}else return this.setInputSummary({didDelete:!0})}serializeSelectionToDataTransfer(e){var n;if(!Bc(e))return;let a=(n=this.responder)===null||n===void 0?void 0:n.getSelectedDocument().toSerializableDocument();return e.setData("application/x-trix-document",JSON.stringify(a)),e.setData("text/html",Xa.render(a).innerHTML),e.setData("text/plain",a.toString().replace(/\n$/,"")),!0}canAcceptDataTransfer(e){let n={};return Array.from((e==null?void 0:e.types)||[]).forEach(a=>{n[a]=!0}),n.Files||n["application/x-trix-document"]||n["text/html"]||n["text/plain"]}getPastedHTMLUsingHiddenElement(e){let n=this.getSelectedRange(),a={position:"absolute",left:"".concat(window.pageXOffset,"px"),top:"".concat(window.pageYOffset,"px"),opacity:0},c=d({style:a,tagName:"div",editable:!0});return document.body.appendChild(c),c.focus(),requestAnimationFrame(()=>{let h=c.innerHTML;return P(c),this.setSelectedRange(n),e(h)})}}yi(Rr,"events",{keydown(o){this.isComposing()||this.resetInputSummary(),this.inputSummary.didInput=!0;let e=Qf[o.keyCode];if(e){var n;let c=this.keys;["ctrl","alt","shift","meta"].forEach(h=>{if(o["".concat(h,"Key")]){var g;h==="ctrl"&&(h="control"),c=(g=c)===null||g===void 0?void 0:g[h]}}),((n=c)===null||n===void 0?void 0:n[e])!=null&&(this.setInputSummary({keyName:e}),Dr.reset(),c[e].call(this,o))}if(Pa(o)){let c=String.fromCharCode(o.keyCode).toLowerCase();if(c){var a;let h=["alt","shift"].map(g=>{if(o["".concat(g,"Key")])return g}).filter(g=>g);h.push(c),(a=this.delegate)!==null&&a!==void 0&&a.inputControllerDidReceiveKeyboardCommand(h)&&o.preventDefault()}}},keypress(o){if(this.inputSummary.eventName!=null||o.metaKey||o.ctrlKey&&!o.altKey)return;let e=$v(o);if(e){var n,a;return(n=this.delegate)===null||n===void 0||n.inputControllerWillPerformTyping(),(a=this.responder)===null||a===void 0||a.insertString(e),this.setInputSummary({textAdded:e,didDelete:this.selectionIsExpanded()})}},textInput(o){let{data:e}=o,{textAdded:n}=this.inputSummary;if(n&&n!==e&&n.toUpperCase()===e){var a;let c=this.getSelectedRange();return this.setSelectedRange([c[0],c[1]+n.length]),(a=this.responder)===null||a===void 0||a.insertString(e),this.setInputSummary({textAdded:e}),this.setSelectedRange(c)}},dragenter(o){o.preventDefault()},dragstart(o){var e,n;return this.serializeSelectionToDataTransfer(o.dataTransfer),this.draggedRange=this.getSelectedRange(),(e=this.delegate)===null||e===void 0||(n=e.inputControllerDidStartDrag)===null||n===void 0?void 0:n.call(e)},dragover(o){if(this.draggedRange||this.canAcceptDataTransfer(o.dataTransfer)){o.preventDefault();let a={x:o.clientX,y:o.clientY};if(!Gr(a,this.draggingPoint)){var e,n;return this.draggingPoint=a,(e=this.delegate)===null||e===void 0||(n=e.inputControllerDidReceiveDragOverPoint)===null||n===void 0?void 0:n.call(e,this.draggingPoint)}}},dragend(o){var e,n;(e=this.delegate)===null||e===void 0||(n=e.inputControllerDidCancelDrag)===null||n===void 0||n.call(e),this.draggedRange=null,this.draggingPoint=null},drop(o){var e,n;o.preventDefault();let a=(e=o.dataTransfer)===null||e===void 0?void 0:e.files,c=o.dataTransfer.getData("application/x-trix-document"),h={x:o.clientX,y:o.clientY};if((n=this.responder)===null||n===void 0||n.setLocationRangeFromPointRange(h),a!=null&&a.length)this.attachFiles(a);else if(this.draggedRange){var g,S;(g=this.delegate)===null||g===void 0||g.inputControllerWillMoveText(),(S=this.responder)===null||S===void 0||S.moveTextFromRange(this.draggedRange),this.draggedRange=null,this.requestRender()}else if(c){var x;let _=Vi.fromJSONString(c);(x=this.responder)===null||x===void 0||x.insertDocument(_),this.requestRender()}this.draggedRange=null,this.draggingPoint=null},cut(o){var e;if((e=this.responder)!==null&&e!==void 0&&e.selectionIsExpanded()){var n;if(this.serializeSelectionToDataTransfer(o.clipboardData)&&o.preventDefault(),(n=this.delegate)===null||n===void 0||n.inputControllerWillCutText(),this.deleteInDirection("backward"),o.defaultPrevented)return this.requestRender()}},copy(o){var e;(e=this.responder)!==null&&e!==void 0&&e.selectionIsExpanded()&&this.serializeSelectionToDataTransfer(o.clipboardData)&&o.preventDefault()},paste(o){let e=o.clipboardData||o.testClipboardData,n={clipboard:e};if(!e||Xv(o)){this.getPastedHTMLUsingHiddenElement(vt=>{var jt,Ht,Vt;return n.type="text/html",n.html=vt,(jt=this.delegate)===null||jt===void 0||jt.inputControllerWillPaste(n),(Ht=this.responder)===null||Ht===void 0||Ht.insertHTML(n.html),this.requestRender(),(Vt=this.delegate)===null||Vt===void 0?void 0:Vt.inputControllerDidPaste(n)});return}let a=e.getData("URL"),c=e.getData("text/html"),h=e.getData("public.url-name");if(a){var g,S,x;let vt;n.type="text/html",h?vt=z(h).trim():vt=a,n.html=this.createLinkHTML(a,vt),(g=this.delegate)===null||g===void 0||g.inputControllerWillPaste(n),this.setInputSummary({textAdded:vt,didDelete:this.selectionIsExpanded()}),(S=this.responder)===null||S===void 0||S.insertHTML(n.html),this.requestRender(),(x=this.delegate)===null||x===void 0||x.inputControllerDidPaste(n)}else if(Oa(e)){var _,O,q;n.type="text/plain",n.string=e.getData("text/plain"),(_=this.delegate)===null||_===void 0||_.inputControllerWillPaste(n),this.setInputSummary({textAdded:n.string,didDelete:this.selectionIsExpanded()}),(O=this.responder)===null||O===void 0||O.insertString(n.string),this.requestRender(),(q=this.delegate)===null||q===void 0||q.inputControllerDidPaste(n)}else if(c){var at,rt,pt;n.type="text/html",n.html=c,(at=this.delegate)===null||at===void 0||at.inputControllerWillPaste(n),(rt=this.responder)===null||rt===void 0||rt.insertHTML(n.html),this.requestRender(),(pt=this.delegate)===null||pt===void 0||pt.inputControllerDidPaste(n)}else if(Array.from(e.types).includes("Files")){var ct,mt;let vt=(ct=e.items)===null||ct===void 0||(ct=ct[0])===null||ct===void 0||(mt=ct.getAsFile)===null||mt===void 0?void 0:mt.call(ct);if(vt){var yt,ut,Ct;let jt=Uv(vt);!vt.name&&jt&&(vt.name="pasted-file-".concat(++Wv,".").concat(jt)),n.type="File",n.file=vt,(yt=this.delegate)===null||yt===void 0||yt.inputControllerWillAttachFiles(),(ut=this.responder)===null||ut===void 0||ut.insertFile(n.file),this.requestRender(),(Ct=this.delegate)===null||Ct===void 0||Ct.inputControllerDidPaste(n)}}o.preventDefault()},compositionstart(o){return this.getCompositionInput().start(o.data)},compositionupdate(o){return this.getCompositionInput().update(o.data)},compositionend(o){return this.getCompositionInput().end(o.data)},beforeinput(o){this.inputSummary.didInput=!0},input(o){return this.inputSummary.didInput=!0,o.stopPropagation()}}),yi(Rr,"keys",{backspace(o){var e;return(e=this.delegate)===null||e===void 0||e.inputControllerWillPerformTyping(),this.deleteInDirection("backward",o)},delete(o){var e;return(e=this.delegate)===null||e===void 0||e.inputControllerWillPerformTyping(),this.deleteInDirection("forward",o)},return(o){var e,n;return this.setInputSummary({preferDocument:!0}),(e=this.delegate)===null||e===void 0||e.inputControllerWillPerformTyping(),(n=this.responder)===null||n===void 0?void 0:n.insertLineBreak()},tab(o){var e;if((e=this.responder)!==null&&e!==void 0&&e.canIncreaseNestingLevel()){var n;(n=this.responder)===null||n===void 0||n.increaseNestingLevel(),this.requestRender(),o.preventDefault()}},left(o){if(this.selectionIsInCursorTarget()){var e;return o.preventDefault(),(e=this.responder)===null||e===void 0?void 0:e.moveCursorInDirection("backward")}},right(o){if(this.selectionIsInCursorTarget()){var e;return o.preventDefault(),(e=this.responder)===null||e===void 0?void 0:e.moveCursorInDirection("forward")}},control:{d(o){var e;return(e=this.delegate)===null||e===void 0||e.inputControllerWillPerformTyping(),this.deleteInDirection("forward",o)},h(o){var e;return(e=this.delegate)===null||e===void 0||e.inputControllerWillPerformTyping(),this.deleteInDirection("backward",o)},o(o){var e,n;return o.preventDefault(),(e=this.delegate)===null||e===void 0||e.inputControllerWillPerformTyping(),(n=this.responder)===null||n===void 0||n.insertString(` `,{updatePosition:!1}),this.requestRender()}},shift:{return(o){var e,n;(e=this.delegate)===null||e===void 0||e.inputControllerWillPerformTyping(),(n=this.responder)===null||n===void 0||n.insertString(` `),this.requestRender(),o.preventDefault()},tab(o){var e;if((e=this.responder)!==null&&e!==void 0&&e.canDecreaseNestingLevel()){var n;(n=this.responder)===null||n===void 0||n.decreaseNestingLevel(),this.requestRender(),o.preventDefault()}},left(o){if(this.selectionIsInCursorTarget())return o.preventDefault(),this.expandSelectionInDirection("backward")},right(o){if(this.selectionIsInCursorTarget())return o.preventDefault(),this.expandSelectionInDirection("forward")}},alt:{backspace(o){var e;return this.setInputSummary({preferDocument:!1}),(e=this.delegate)===null||e===void 0?void 0:e.inputControllerWillPerformTyping()}},meta:{backspace(o){var e;return this.setInputSummary({preferDocument:!1}),(e=this.delegate)===null||e===void 0?void 0:e.inputControllerWillPerformTyping()}}}),Rr.proxyMethod("responder?.getSelectedRange"),Rr.proxyMethod("responder?.setSelectedRange"),Rr.proxyMethod("responder?.expandSelectionInDirection"),Rr.proxyMethod("responder?.selectionIsInCursorTarget"),Rr.proxyMethod("responder?.selectionIsExpanded");let Uv=o=>{var e;return(e=o.type)===null||e===void 0||(e=e.match(/\/(\w+)$/))===null||e===void 0?void 0:e[1]},Vv=!!((uu=(Zf=" ").codePointAt)!==null&&uu!==void 0&&uu.call(Zf,0)),$v=function(o){if(o.key&&Vv&&o.key.codePointAt(0)===o.keyCode)return o.key;{let e;if(o.which===null?e=o.keyCode:o.which!==0&&o.charCode!==0&&(e=o.charCode),e!=null&&Qf[e]!=="escape")return Xr.fromCodepoints([e]).toString()}},Xv=function(o){let e=o.clipboardData;if(e)if(e.types.includes("text/html")){for(let n of e.types){let a=/^CorePasteboardFlavorType/.test(n),c=/^dyn\./.test(n)&&e.getData(n);if(a||c)return!0}return!1}else{let n=e.types.includes("com.apple.webarchive"),a=e.types.includes("com.apple.flat-rtfd");return n||a}};class tn extends qt{constructor(e){super(...arguments),this.inputController=e,this.responder=this.inputController.responder,this.delegate=this.inputController.delegate,this.inputSummary=this.inputController.inputSummary,this.data={}}start(e){if(this.data.start=e,this.isSignificant()){var n;if(this.inputSummary.eventName==="keypress"&&this.inputSummary.textAdded){var a;(a=this.responder)===null||a===void 0||a.deleteInDirection("left")}this.selectionIsExpanded()||(this.insertPlaceholder(),this.requestRender()),this.range=(n=this.responder)===null||n===void 0?void 0:n.getSelectedRange()}}update(e){if(this.data.update=e,this.isSignificant()){let n=this.selectPlaceholder();n&&(this.forgetPlaceholder(),this.range=n)}}end(e){if(this.data.end=e,this.isSignificant()){if(this.forgetPlaceholder(),this.canApplyToDocument()){var n,a,c,h;return this.setInputSummary({preferDocument:!0,didInput:!1}),(n=this.delegate)===null||n===void 0||n.inputControllerWillPerformTyping(),(a=this.responder)===null||a===void 0||a.setSelectedRange(this.range),(c=this.responder)===null||c===void 0||c.insertString(this.data.end),(h=this.responder)===null||h===void 0?void 0:h.setSelectedRange(this.range[0]+this.data.end.length)}else if(this.data.start!=null||this.data.update!=null)return this.requestReparse(),this.inputController.reset()}else return this.inputController.reset()}getEndData(){return this.data.end}isEnded(){return this.getEndData()!=null}isSignificant(){return zv.composesExistingText?this.inputSummary.didInput:!0}canApplyToDocument(){var e,n;return((e=this.data.start)===null||e===void 0?void 0:e.length)===0&&((n=this.data.end)===null||n===void 0?void 0:n.length)>0&&this.range}}tn.proxyMethod("inputController.setInputSummary"),tn.proxyMethod("inputController.requestRender"),tn.proxyMethod("inputController.requestReparse"),tn.proxyMethod("responder?.selectionIsExpanded"),tn.proxyMethod("responder?.insertPlaceholder"),tn.proxyMethod("responder?.selectPlaceholder"),tn.proxyMethod("responder?.forgetPlaceholder");class ao extends rl{constructor(){super(...arguments),this.render=this.render.bind(this)}elementDidMutate(){if(this.scheduledRender){if(this.composing){var e,n;return(e=this.delegate)===null||e===void 0||(n=e.inputControllerDidAllowUnhandledInput)===null||n===void 0?void 0:n.call(e)}}else return this.reparse()}scheduleRender(){return this.scheduledRender?this.scheduledRender:this.scheduledRender=requestAnimationFrame(this.render)}render(){var e;if(cancelAnimationFrame(this.scheduledRender),this.scheduledRender=null,!this.composing){var n;(n=this.delegate)===null||n===void 0||n.render()}(e=this.afterRender)===null||e===void 0||e.call(this),this.afterRender=null}reparse(){var e;return(e=this.delegate)===null||e===void 0?void 0:e.reparse()}insertString(){var e;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",a=arguments.length>1?arguments[1]:void 0;return(e=this.delegate)===null||e===void 0||e.inputControllerWillPerformTyping(),this.withTargetDOMRange(function(){var c;return(c=this.responder)===null||c===void 0?void 0:c.insertString(n,a)})}toggleAttributeIfSupported(e){if(Di().includes(e)){var n;return(n=this.delegate)===null||n===void 0||n.inputControllerWillPerformFormatting(e),this.withTargetDOMRange(function(){var a;return(a=this.responder)===null||a===void 0?void 0:a.toggleCurrentAttribute(e)})}}activateAttributeIfSupported(e,n){if(Di().includes(e)){var a;return(a=this.delegate)===null||a===void 0||a.inputControllerWillPerformFormatting(e),this.withTargetDOMRange(function(){var c;return(c=this.responder)===null||c===void 0?void 0:c.setCurrentAttribute(e,n)})}}deleteInDirection(e){let{recordUndoEntry:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{recordUndoEntry:!0};if(n){var a;(a=this.delegate)===null||a===void 0||a.inputControllerWillPerformTyping()}let c=()=>{var g;return(g=this.responder)===null||g===void 0?void 0:g.deleteInDirection(e)},h=this.getTargetDOMRange({minLength:this.composing?1:2});return h?this.withTargetDOMRange(h,c):c()}withTargetDOMRange(e,n){if(typeof e=="function"&&(n=e,e=this.getTargetDOMRange()),e){var a;return(a=this.responder)===null||a===void 0?void 0:a.withTargetDOMRange(e,n.bind(this))}else return Dr.reset(),n.call(this)}getTargetDOMRange(){var e,n;let{minLength:a}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{minLength:0},c=(e=(n=this.event).getTargetRanges)===null||e===void 0?void 0:e.call(n);if(c&&c.length){let h=Yv(c[0]);if(a===0||h.toString().length>=a)return h}}withEvent(e,n){let a;this.event=e;try{a=n.call(this)}finally{this.event=null}return a}}yi(ao,"events",{keydown(o){if(Pa(o)){var e;let n=Jv(o);(e=this.delegate)!==null&&e!==void 0&&e.inputControllerDidReceiveKeyboardCommand(n)&&o.preventDefault()}else{let n=o.key;o.altKey&&(n+="+Alt"),o.shiftKey&&(n+="+Shift");let a=this.constructor.keys[n];if(a)return this.withEvent(o,a)}},paste(o){var e;let n,a=(e=o.clipboardData)===null||e===void 0?void 0:e.getData("URL");if(tp(o))return o.preventDefault(),this.attachFiles(o.clipboardData.files);if(Kv(o)){var c,h,g;return o.preventDefault(),n={type:"text/plain",string:o.clipboardData.getData("text/plain")},(c=this.delegate)===null||c===void 0||c.inputControllerWillPaste(n),(h=this.responder)===null||h===void 0||h.insertString(n.string),this.render(),(g=this.delegate)===null||g===void 0?void 0:g.inputControllerDidPaste(n)}else if(a){var S,x,_;return o.preventDefault(),n={type:"text/html",html:this.createLinkHTML(a)},(S=this.delegate)===null||S===void 0||S.inputControllerWillPaste(n),(x=this.responder)===null||x===void 0||x.insertHTML(n.html),this.render(),(_=this.delegate)===null||_===void 0?void 0:_.inputControllerDidPaste(n)}},beforeinput(o){let e=this.constructor.inputTypes[o.inputType],n=Ia(o);e&&(this.withEvent(o,e),n||this.scheduleRender()),n&&this.render()},input(o){Dr.reset()},dragstart(o){var e;if((e=this.responder)!==null&&e!==void 0&&e.selectionContainsAttachments()){var n;o.dataTransfer.setData("application/x-trix-dragging",!0),this.dragging={range:(n=this.responder)===null||n===void 0?void 0:n.getSelectedRange(),point:du(o)}}},dragenter(o){hu(o)&&o.preventDefault()},dragover(o){if(this.dragging){o.preventDefault();let n=du(o);if(!Gr(n,this.dragging.point)){var e;return this.dragging.point=n,(e=this.responder)===null||e===void 0?void 0:e.setLocationRangeFromPointRange(n)}}else hu(o)&&o.preventDefault()},drop(o){if(this.dragging){var e,n;return o.preventDefault(),(e=this.delegate)===null||e===void 0||e.inputControllerWillMoveText(),(n=this.responder)===null||n===void 0||n.moveTextFromRange(this.dragging.range),this.dragging=null,this.scheduleRender()}else if(hu(o)){var a;o.preventDefault();let c=du(o);return(a=this.responder)===null||a===void 0||a.setLocationRangeFromPointRange(c),this.attachFiles(o.dataTransfer.files)}},dragend(){if(this.dragging){var o;(o=this.responder)===null||o===void 0||o.setSelectedRange(this.dragging.range),this.dragging=null}},compositionend(o){this.composing&&(this.composing=!1,Et.recentAndroid||this.scheduleRender())}}),yi(ao,"keys",{ArrowLeft(){var o;if((o=this.responder)!==null&&o!==void 0&&o.shouldManageMovingCursorInDirection("backward")){var e;return this.event.preventDefault(),(e=this.responder)===null||e===void 0?void 0:e.moveCursorInDirection("backward")}},ArrowRight(){var o;if((o=this.responder)!==null&&o!==void 0&&o.shouldManageMovingCursorInDirection("forward")){var e;return this.event.preventDefault(),(e=this.responder)===null||e===void 0?void 0:e.moveCursorInDirection("forward")}},Backspace(){var o;if((o=this.responder)!==null&&o!==void 0&&o.shouldManageDeletingInDirection("backward")){var e,n;return this.event.preventDefault(),(e=this.delegate)===null||e===void 0||e.inputControllerWillPerformTyping(),(n=this.responder)===null||n===void 0||n.deleteInDirection("backward"),this.render()}},Tab(){var o;if((o=this.responder)!==null&&o!==void 0&&o.canIncreaseNestingLevel()){var e;return this.event.preventDefault(),(e=this.responder)===null||e===void 0||e.increaseNestingLevel(),this.render()}},"Tab+Shift"(){var o;if((o=this.responder)!==null&&o!==void 0&&o.canDecreaseNestingLevel()){var e;return this.event.preventDefault(),(e=this.responder)===null||e===void 0||e.decreaseNestingLevel(),this.render()}}}),yi(ao,"inputTypes",{deleteByComposition(){return this.deleteInDirection("backward",{recordUndoEntry:!1})},deleteByCut(){return this.deleteInDirection("backward")},deleteByDrag(){return this.event.preventDefault(),this.withTargetDOMRange(function(){var o;this.deleteByDragRange=(o=this.responder)===null||o===void 0?void 0:o.getSelectedRange()})},deleteCompositionText(){return this.deleteInDirection("backward",{recordUndoEntry:!1})},deleteContent(){return this.deleteInDirection("backward")},deleteContentBackward(){return this.deleteInDirection("backward")},deleteContentForward(){return this.deleteInDirection("forward")},deleteEntireSoftLine(){return this.deleteInDirection("forward")},deleteHardLineBackward(){return this.deleteInDirection("backward")},deleteHardLineForward(){return this.deleteInDirection("forward")},deleteSoftLineBackward(){return this.deleteInDirection("backward")},deleteSoftLineForward(){return this.deleteInDirection("forward")},deleteWordBackward(){return this.deleteInDirection("backward")},deleteWordForward(){return this.deleteInDirection("forward")},formatBackColor(){return this.activateAttributeIfSupported("backgroundColor",this.event.data)},formatBold(){return this.toggleAttributeIfSupported("bold")},formatFontColor(){return this.activateAttributeIfSupported("color",this.event.data)},formatFontName(){return this.activateAttributeIfSupported("font",this.event.data)},formatIndent(){var o;if((o=this.responder)!==null&&o!==void 0&&o.canIncreaseNestingLevel())return this.withTargetDOMRange(function(){var e;return(e=this.responder)===null||e===void 0?void 0:e.increaseNestingLevel()})},formatItalic(){return this.toggleAttributeIfSupported("italic")},formatJustifyCenter(){return this.toggleAttributeIfSupported("justifyCenter")},formatJustifyFull(){return this.toggleAttributeIfSupported("justifyFull")},formatJustifyLeft(){return this.toggleAttributeIfSupported("justifyLeft")},formatJustifyRight(){return this.toggleAttributeIfSupported("justifyRight")},formatOutdent(){var o;if((o=this.responder)!==null&&o!==void 0&&o.canDecreaseNestingLevel())return this.withTargetDOMRange(function(){var e;return(e=this.responder)===null||e===void 0?void 0:e.decreaseNestingLevel()})},formatRemove(){this.withTargetDOMRange(function(){for(let n in(o=this.responder)===null||o===void 0?void 0:o.getCurrentAttributes()){var o,e;(e=this.responder)===null||e===void 0||e.removeCurrentAttribute(n)}})},formatSetBlockTextDirection(){return this.activateAttributeIfSupported("blockDir",this.event.data)},formatSetInlineTextDirection(){return this.activateAttributeIfSupported("textDir",this.event.data)},formatStrikeThrough(){return this.toggleAttributeIfSupported("strike")},formatSubscript(){return this.toggleAttributeIfSupported("sub")},formatSuperscript(){return this.toggleAttributeIfSupported("sup")},formatUnderline(){return this.toggleAttributeIfSupported("underline")},historyRedo(){var o;return(o=this.delegate)===null||o===void 0?void 0:o.inputControllerWillPerformRedo()},historyUndo(){var o;return(o=this.delegate)===null||o===void 0?void 0:o.inputControllerWillPerformUndo()},insertCompositionText(){return this.composing=!0,this.insertString(this.event.data)},insertFromComposition(){return this.composing=!1,this.insertString(this.event.data)},insertFromDrop(){let o=this.deleteByDragRange;if(o){var e;return this.deleteByDragRange=null,(e=this.delegate)===null||e===void 0||e.inputControllerWillMoveText(),this.withTargetDOMRange(function(){var n;return(n=this.responder)===null||n===void 0?void 0:n.moveTextFromRange(o)})}},insertFromPaste(){let{dataTransfer:o}=this.event,e={dataTransfer:o},n=o.getData("URL"),a=o.getData("text/html");if(n){var c;let x;this.event.preventDefault(),e.type="text/html";let _=o.getData("public.url-name");_?x=z(_).trim():x=n,e.html=this.createLinkHTML(n,x),(c=this.delegate)===null||c===void 0||c.inputControllerWillPaste(e),this.withTargetDOMRange(function(){var O;return(O=this.responder)===null||O===void 0?void 0:O.insertHTML(e.html)}),this.afterRender=()=>{var O;return(O=this.delegate)===null||O===void 0?void 0:O.inputControllerDidPaste(e)}}else if(Oa(o)){var h;e.type="text/plain",e.string=o.getData("text/plain"),(h=this.delegate)===null||h===void 0||h.inputControllerWillPaste(e),this.withTargetDOMRange(function(){var x;return(x=this.responder)===null||x===void 0?void 0:x.insertString(e.string)}),this.afterRender=()=>{var x;return(x=this.delegate)===null||x===void 0?void 0:x.inputControllerDidPaste(e)}}else if(Gv(this.event)){var g;e.type="File",e.file=o.files[0],(g=this.delegate)===null||g===void 0||g.inputControllerWillPaste(e),this.withTargetDOMRange(function(){var x;return(x=this.responder)===null||x===void 0?void 0:x.insertFile(e.file)}),this.afterRender=()=>{var x;return(x=this.delegate)===null||x===void 0?void 0:x.inputControllerDidPaste(e)}}else if(a){var S;this.event.preventDefault(),e.type="text/html",e.html=a,(S=this.delegate)===null||S===void 0||S.inputControllerWillPaste(e),this.withTargetDOMRange(function(){var x;return(x=this.responder)===null||x===void 0?void 0:x.insertHTML(e.html)}),this.afterRender=()=>{var x;return(x=this.delegate)===null||x===void 0?void 0:x.inputControllerDidPaste(e)}}},insertFromYank(){return this.insertString(this.event.data)},insertLineBreak(){return this.insertString(` `)},insertLink(){return this.activateAttributeIfSupported("href",this.event.data)},insertOrderedList(){return this.toggleAttributeIfSupported("number")},insertParagraph(){var o;return(o=this.delegate)===null||o===void 0||o.inputControllerWillPerformTyping(),this.withTargetDOMRange(function(){var e;return(e=this.responder)===null||e===void 0?void 0:e.insertLineBreak()})},insertReplacementText(){let o=this.event.dataTransfer.getData("text/plain"),e=this.event.getTargetRanges()[0];this.withTargetDOMRange(e,()=>{this.insertString(o,{updatePosition:!1})})},insertText(){var o;return this.insertString(this.event.data||((o=this.event.dataTransfer)===null||o===void 0?void 0:o.getData("text/plain")))},insertTranspose(){return this.insertString(this.event.data)},insertUnorderedList(){return this.toggleAttributeIfSupported("bullet")}});let Yv=function(o){let e=document.createRange();return e.setStart(o.startContainer,o.startOffset),e.setEnd(o.endContainer,o.endOffset),e},hu=o=>{var e;return Array.from(((e=o.dataTransfer)===null||e===void 0?void 0:e.types)||[]).includes("Files")},Gv=o=>{var e;return((e=o.dataTransfer.files)===null||e===void 0?void 0:e[0])&&!tp(o)&&!gr(o)},tp=function(o){let e=o.clipboardData;if(e)return Array.from(e.types).filter(a=>a.match(/file/i)).length===e.types.length&&e.files.length>=1},Kv=function(o){let e=o.clipboardData;if(e)return e.types.includes("text/plain")&&e.types.length===1},Jv=function(o){let e=[];return o.altKey&&e.push("alt"),o.shiftKey&&e.push("shift"),e.push(o.key),e},du=o=>({x:o.clientX,y:o.clientY}),fu="[data-trix-attribute]",pu="[data-trix-action]",Zv="".concat(fu,", ").concat(pu),nl="[data-trix-dialog]",Qv="".concat(nl,"[data-trix-active]"),ty="".concat(nl," [data-trix-method]"),ep="".concat(nl," [data-trix-input]"),ip=(o,e)=>(e||(e=Kn(o)),o.querySelector("[data-trix-input][name='".concat(e,"']"))),rp=o=>o.getAttribute("data-trix-action"),Kn=o=>o.getAttribute("data-trix-attribute")||o.getAttribute("data-trix-dialog-attribute"),ey=o=>o.getAttribute("data-trix-dialog");class np extends qt{constructor(e){super(e),this.didClickActionButton=this.didClickActionButton.bind(this),this.didClickAttributeButton=this.didClickAttributeButton.bind(this),this.didClickDialogButton=this.didClickDialogButton.bind(this),this.didKeyDownDialogInput=this.didKeyDownDialogInput.bind(this),this.element=e,this.attributes={},this.actions={},this.resetDialogInputs(),E("mousedown",{onElement:this.element,matchingSelector:pu,withCallback:this.didClickActionButton}),E("mousedown",{onElement:this.element,matchingSelector:fu,withCallback:this.didClickAttributeButton}),E("click",{onElement:this.element,matchingSelector:Zv,preventDefault:!0}),E("click",{onElement:this.element,matchingSelector:ty,withCallback:this.didClickDialogButton}),E("keydown",{onElement:this.element,matchingSelector:ep,withCallback:this.didKeyDownDialogInput})}didClickActionButton(e,n){var a;(a=this.delegate)===null||a===void 0||a.toolbarDidClickButton(),e.preventDefault();let c=rp(n);if(this.getDialog(c))return this.toggleDialog(c);var h;return(h=this.delegate)===null||h===void 0?void 0:h.toolbarDidInvokeAction(c,n)}didClickAttributeButton(e,n){var a;(a=this.delegate)===null||a===void 0||a.toolbarDidClickButton(),e.preventDefault();let c=Kn(n);if(this.getDialog(c))this.toggleDialog(c);else{var h;(h=this.delegate)===null||h===void 0||h.toolbarDidToggleAttribute(c)}return this.refreshAttributeButtons()}didClickDialogButton(e,n){let a=kt(n,{matchingSelector:nl}),c=n.getAttribute("data-trix-method");return this[c].call(this,a)}didKeyDownDialogInput(e,n){if(e.keyCode===13){e.preventDefault();let a=n.getAttribute("name"),c=this.getDialog(a);this.setAttribute(c)}if(e.keyCode===27)return e.preventDefault(),this.hideDialog()}updateActions(e){return this.actions=e,this.refreshActionButtons()}refreshActionButtons(){return this.eachActionButton((e,n)=>{e.disabled=this.actions[n]===!1})}eachActionButton(e){return Array.from(this.element.querySelectorAll(pu)).map(n=>e(n,rp(n)))}updateAttributes(e){return this.attributes=e,this.refreshAttributeButtons()}refreshAttributeButtons(){return this.eachAttributeButton((e,n)=>(e.disabled=this.attributes[n]===!1,this.attributes[n]||this.dialogIsVisible(n)?(e.setAttribute("data-trix-active",""),e.classList.add("trix-active")):(e.removeAttribute("data-trix-active"),e.classList.remove("trix-active"))))}eachAttributeButton(e){return Array.from(this.element.querySelectorAll(fu)).map(n=>e(n,Kn(n)))}applyKeyboardCommand(e){let n=JSON.stringify(e.sort());for(let a of Array.from(this.element.querySelectorAll("[data-trix-key]"))){let c=a.getAttribute("data-trix-key").split("+");if(JSON.stringify(c.sort())===n)return Y("mousedown",{onElement:a}),!0}return!1}dialogIsVisible(e){let n=this.getDialog(e);if(n)return n.hasAttribute("data-trix-active")}toggleDialog(e){return this.dialogIsVisible(e)?this.hideDialog():this.showDialog(e)}showDialog(e){var n,a;this.hideDialog(),(n=this.delegate)===null||n===void 0||n.toolbarWillShowDialog();let c=this.getDialog(e);c.setAttribute("data-trix-active",""),c.classList.add("trix-active"),Array.from(c.querySelectorAll("input[disabled]")).forEach(g=>{g.removeAttribute("disabled")});let h=Kn(c);if(h){let g=ip(c,e);g&&(g.value=this.attributes[h]||"",g.select())}return(a=this.delegate)===null||a===void 0?void 0:a.toolbarDidShowDialog(e)}setAttribute(e){var n;let a=Kn(e),c=ip(e,a);return c.willValidate&&(c.setCustomValidity(""),!c.checkValidity()||!this.isSafeAttribute(c))?(c.setCustomValidity("Invalid value"),c.setAttribute("data-trix-validate",""),c.classList.add("trix-validate"),c.focus()):((n=this.delegate)===null||n===void 0||n.toolbarDidUpdateAttribute(a,c.value),this.hideDialog())}isSafeAttribute(e){return e.hasAttribute("data-trix-validate-href")?Va.isValidAttribute("a","href",e.value):!0}removeAttribute(e){var n;let a=Kn(e);return(n=this.delegate)===null||n===void 0||n.toolbarDidRemoveAttribute(a),this.hideDialog()}hideDialog(){let e=this.element.querySelector(Qv);if(e){var n;return e.removeAttribute("data-trix-active"),e.classList.remove("trix-active"),this.resetDialogInputs(),(n=this.delegate)===null||n===void 0?void 0:n.toolbarDidHideDialog(ey(e))}}resetDialogInputs(){Array.from(this.element.querySelectorAll(ep)).forEach(e=>{e.setAttribute("disabled","disabled"),e.removeAttribute("data-trix-validate"),e.classList.remove("trix-validate")})}getDialog(e){return this.element.querySelector("[data-trix-dialog=".concat(e,"]"))}}let iy=(o,e)=>Wn(o.selectedRange,e.selectedRange)&&o.document.isEqualTo(e.document);class lo extends Xf{constructor(e){let{editorElement:n,document:a,html:c}=e;super(...arguments),this.editorElement=n,this.selectionManager=new En(this.editorElement),this.selectionManager.delegate=this,this.composition=new Qr,this.composition.delegate=this,this.attachmentManager=new If(this.composition.getAttachments()),this.attachmentManager.delegate=this,this.inputController=B.getLevel()===2?new ao(this.editorElement):new Rr(this.editorElement),this.inputController.delegate=this,this.inputController.responder=this.composition,this.compositionController=new $f(this.editorElement,this.composition),this.compositionController.delegate=this,this.toolbarController=new np(this.editorElement.toolbarElement),this.toolbarController.delegate=this,this.editor=new Hf(this.composition,this.selectionManager,this.editorElement),a?this.editor.loadDocument(a):this.editor.loadHTML(c)}registerSelectionManager(){return Dr.registerSelectionManager(this.selectionManager)}unregisterSelectionManager(){return Dr.unregisterSelectionManager(this.selectionManager)}render(){return this.compositionController.render()}reparse(){return this.composition.replaceHTML(this.editorElement.innerHTML)}compositionDidChangeDocument(e){if(this.notifyEditorElement("document-change"),!this.handlingInput)return this.render()}compositionDidChangeCurrentAttributes(e){return this.currentAttributes=e,this.toolbarController.updateAttributes(this.currentAttributes),this.updateCurrentActions(),this.notifyEditorElement("attributes-change",{attributes:this.currentAttributes})}compositionDidPerformInsertionAtRange(e){this.pasting&&(this.pastedRange=e)}compositionShouldAcceptFile(e){return this.notifyEditorElement("file-accept",{file:e})}compositionDidAddAttachment(e){let n=this.attachmentManager.manageAttachment(e);return this.notifyEditorElement("attachment-add",{attachment:n})}compositionDidEditAttachment(e){this.compositionController.rerenderViewForObject(e);let n=this.attachmentManager.manageAttachment(e);return this.notifyEditorElement("attachment-edit",{attachment:n}),this.notifyEditorElement("change")}compositionDidChangeAttachmentPreviewURL(e){return this.compositionController.invalidateViewForObject(e),this.notifyEditorElement("change")}compositionDidRemoveAttachment(e){let n=this.attachmentManager.unmanageAttachment(e);return this.notifyEditorElement("attachment-remove",{attachment:n})}compositionDidStartEditingAttachment(e,n){return this.attachmentLocationRange=this.composition.document.getLocationRangeOfAttachment(e),this.compositionController.installAttachmentEditorForAttachment(e,n),this.selectionManager.setLocationRange(this.attachmentLocationRange)}compositionDidStopEditingAttachment(e){this.compositionController.uninstallAttachmentEditor(),this.attachmentLocationRange=null}compositionDidRequestChangingSelectionToLocationRange(e){if(!(this.loadingSnapshot&&!this.isFocused())&&(this.requestedLocationRange=e,this.compositionRevisionWhenLocationRangeRequested=this.composition.revision,!this.handlingInput))return this.render()}compositionWillLoadSnapshot(){this.loadingSnapshot=!0}compositionDidLoadSnapshot(){this.compositionController.refreshViewCache(),this.render(),this.loadingSnapshot=!1}getSelectionManager(){return this.selectionManager}attachmentManagerDidRequestRemovalOfAttachment(e){return this.removeAttachment(e)}compositionControllerWillSyncDocumentView(){return this.inputController.editorWillSyncDocumentView(),this.selectionManager.lock(),this.selectionManager.clearSelection()}compositionControllerDidSyncDocumentView(){return this.inputController.editorDidSyncDocumentView(),this.selectionManager.unlock(),this.updateCurrentActions(),this.notifyEditorElement("sync")}compositionControllerDidRender(){this.requestedLocationRange&&(this.compositionRevisionWhenLocationRangeRequested===this.composition.revision&&this.selectionManager.setLocationRange(this.requestedLocationRange),this.requestedLocationRange=null,this.compositionRevisionWhenLocationRangeRequested=null),this.renderedCompositionRevision!==this.composition.revision&&(this.runEditorFilters(),this.composition.updateCurrentAttributes(),this.notifyEditorElement("render")),this.renderedCompositionRevision=this.composition.revision}compositionControllerDidFocus(){return this.isFocusedInvisibly()&&this.setLocationRange({index:0,offset:0}),this.toolbarController.hideDialog(),this.notifyEditorElement("focus")}compositionControllerDidBlur(){return this.notifyEditorElement("blur")}compositionControllerDidSelectAttachment(e,n){return this.toolbarController.hideDialog(),this.composition.editAttachment(e,n)}compositionControllerDidRequestDeselectingAttachment(e){let n=this.attachmentLocationRange||this.composition.document.getLocationRangeOfAttachment(e);return this.selectionManager.setLocationRange(n[1])}compositionControllerWillUpdateAttachment(e){return this.editor.recordUndoEntry("Edit Attachment",{context:e.id,consolidatable:!0})}compositionControllerDidRequestRemovalOfAttachment(e){return this.removeAttachment(e)}inputControllerWillHandleInput(){this.handlingInput=!0,this.requestedRender=!1}inputControllerDidRequestRender(){this.requestedRender=!0}inputControllerDidHandleInput(){if(this.handlingInput=!1,this.requestedRender)return this.requestedRender=!1,this.render()}inputControllerDidAllowUnhandledInput(){return this.notifyEditorElement("change")}inputControllerDidRequestReparse(){return this.reparse()}inputControllerWillPerformTyping(){return this.recordTypingUndoEntry()}inputControllerWillPerformFormatting(e){return this.recordFormattingUndoEntry(e)}inputControllerWillCutText(){return this.editor.recordUndoEntry("Cut")}inputControllerWillPaste(e){return this.editor.recordUndoEntry("Paste"),this.pasting=!0,this.notifyEditorElement("before-paste",{paste:e})}inputControllerDidPaste(e){return e.range=this.pastedRange,this.pastedRange=null,this.pasting=null,this.notifyEditorElement("paste",{paste:e})}inputControllerWillMoveText(){return this.editor.recordUndoEntry("Move")}inputControllerWillAttachFiles(){return this.editor.recordUndoEntry("Drop Files")}inputControllerWillPerformUndo(){return this.editor.undo()}inputControllerWillPerformRedo(){return this.editor.redo()}inputControllerDidReceiveKeyboardCommand(e){return this.toolbarController.applyKeyboardCommand(e)}inputControllerDidStartDrag(){this.locationRangeBeforeDrag=this.selectionManager.getLocationRange()}inputControllerDidReceiveDragOverPoint(e){return this.selectionManager.setLocationRangeFromPointRange(e)}inputControllerDidCancelDrag(){this.selectionManager.setLocationRange(this.locationRangeBeforeDrag),this.locationRangeBeforeDrag=null}locationRangeDidChange(e){return this.composition.updateCurrentAttributes(),this.updateCurrentActions(),this.attachmentLocationRange&&!Wn(this.attachmentLocationRange,e)&&this.composition.stopEditingAttachment(),this.notifyEditorElement("selection-change")}toolbarDidClickButton(){if(!this.getLocationRange())return this.setLocationRange({index:0,offset:0})}toolbarDidInvokeAction(e,n){return this.invokeAction(e,n)}toolbarDidToggleAttribute(e){if(this.recordFormattingUndoEntry(e),this.composition.toggleCurrentAttribute(e),this.render(),!this.selectionFrozen)return this.editorElement.focus()}toolbarDidUpdateAttribute(e,n){if(this.recordFormattingUndoEntry(e),this.composition.setCurrentAttribute(e,n),this.render(),!this.selectionFrozen)return this.editorElement.focus()}toolbarDidRemoveAttribute(e){if(this.recordFormattingUndoEntry(e),this.composition.removeCurrentAttribute(e),this.render(),!this.selectionFrozen)return this.editorElement.focus()}toolbarWillShowDialog(e){return this.composition.expandSelectionForEditing(),this.freezeSelection()}toolbarDidShowDialog(e){return this.notifyEditorElement("toolbar-dialog-show",{dialogName:e})}toolbarDidHideDialog(e){return this.thawSelection(),this.editorElement.focus(),this.notifyEditorElement("toolbar-dialog-hide",{dialogName:e})}freezeSelection(){if(!this.selectionFrozen)return this.selectionManager.lock(),this.composition.freezeSelection(),this.selectionFrozen=!0,this.render()}thawSelection(){if(this.selectionFrozen)return this.composition.thawSelection(),this.selectionManager.unlock(),this.selectionFrozen=!1,this.render()}canInvokeAction(e){if(this.actionIsExternal(e))return!0;var n;return!!((n=this.actions[e])!==null&&n!==void 0&&(n=n.test)!==null&&n!==void 0&&n.call(this))}invokeAction(e,n){if(this.actionIsExternal(e))return this.notifyEditorElement("action-invoke",{actionName:e,invokingElement:n});var a;return(a=this.actions[e])===null||a===void 0||(a=a.perform)===null||a===void 0?void 0:a.call(this)}actionIsExternal(e){return/^x-./.test(e)}getCurrentActions(){let e={};for(let n in this.actions)e[n]=this.canInvokeAction(n);return e}updateCurrentActions(){let e=this.getCurrentActions();if(!Gr(e,this.currentActions))return this.currentActions=e,this.toolbarController.updateActions(this.currentActions),this.notifyEditorElement("actions-change",{actions:this.currentActions})}runEditorFilters(){let e=this.composition.getSnapshot();if(Array.from(this.editor.filters).forEach(n=>{let{document:a,selectedRange:c}=e;e=n.call(this.editor,e)||{},e.document||(e.document=a),e.selectedRange||(e.selectedRange=c)}),!iy(e,this.composition.getSnapshot()))return this.composition.loadSnapshot(e)}updateInputElement(){let e=this.compositionController.getSerializableElement(),n=kv(e,"text/html");return this.editorElement.setFormValue(n)}notifyEditorElement(e,n){switch(e){case"document-change":this.documentChangedSinceLastRender=!0;break;case"render":this.documentChangedSinceLastRender&&(this.documentChangedSinceLastRender=!1,this.notifyEditorElement("change"));break;case"change":case"attachment-add":case"attachment-edit":case"attachment-remove":this.updateInputElement();break}return this.editorElement.notify(e,n)}removeAttachment(e){return this.editor.recordUndoEntry("Delete Attachment"),this.composition.removeAttachment(e),this.render()}recordFormattingUndoEntry(e){let n=ye(e),a=this.selectionManager.getLocationRange();if(n||!ir(a))return this.editor.recordUndoEntry("Formatting",{context:this.getUndoContext(),consolidatable:!0})}recordTypingUndoEntry(){return this.editor.recordUndoEntry("Typing",{context:this.getUndoContext(this.currentAttributes),consolidatable:!0})}getUndoContext(){for(var e=arguments.length,n=new Array(e),a=0;a0?Math.floor(new Date().getTime()/Yt.interval):0}isFocused(){var e;return this.editorElement===((e=this.editorElement.ownerDocument)===null||e===void 0?void 0:e.activeElement)}isFocusedInvisibly(){return this.isFocused()&&!this.getLocationRange()}get actions(){return this.constructor.actions}}yi(lo,"actions",{undo:{test(){return this.editor.canUndo()},perform(){return this.editor.undo()}},redo:{test(){return this.editor.canRedo()},perform(){return this.editor.redo()}},link:{test(){return this.editor.canActivateAttribute("href")}},increaseNestingLevel:{test(){return this.editor.canIncreaseNestingLevel()},perform(){return this.editor.increaseNestingLevel()&&this.render()}},decreaseNestingLevel:{test(){return this.editor.canDecreaseNestingLevel()},perform(){return this.editor.decreaseNestingLevel()&&this.render()}},attachFiles:{test(){return!0},perform(){return B.pickFiles(this.editor.insertFiles)}}}),lo.proxyMethod("getSelectionManager().setLocationRange"),lo.proxyMethod("getSelectionManager().getLocationRange");var ry=Object.freeze({__proto__:null,AttachmentEditorController:Vf,CompositionController:$f,Controller:Xf,EditorController:lo,InputController:rl,Level0InputController:Rr,Level2InputController:ao,ToolbarController:np}),ny=Object.freeze({__proto__:null,MutationObserver:Gf,SelectionChangeObserver:Ba}),sy=Object.freeze({__proto__:null,FileVerificationOperation:Kf,ImagePreloadOperation:xf});Ks("trix-toolbar",`%t { display: block; } %t { white-space: nowrap; } %t [data-trix-dialog] { display: none; } %t [data-trix-dialog][data-trix-active] { display: block; } %t [data-trix-dialog] [data-trix-validate]:invalid { background-color: #ffdddd; }`);class sp extends HTMLElement{connectedCallback(){this.innerHTML===""&&(this.innerHTML=ce.getDefaultHTML())}}let oy=0,ay=function(o){if(!document.querySelector(":focus")&&o.hasAttribute("autofocus")&&document.querySelector("[autofocus]")===o)return o.focus()},ly=function(o){if(!o.hasAttribute("contenteditable"))return o.setAttribute("contenteditable",""),N("focus",{onElement:o,withCallback(){return cy(o)}})},cy=function(o){return uy(o),hy(o)},uy=function(o){var e,n;if((e=(n=document).queryCommandSupported)!==null&&e!==void 0&&e.call(n,"enableObjectResizing"))return document.execCommand("enableObjectResizing",!1,!1),E("mscontrolselect",{onElement:o,preventDefault:!0})},hy=function(o){var e,n;if((e=(n=document).queryCommandSupported)!==null&&e!==void 0&&e.call(n,"DefaultParagraphSeparator")){let{tagName:a}=V.default;if(["div","p"].includes(a))return document.execCommand("DefaultParagraphSeparator",!1,a)}},dy=function(o){if(!o.hasAttribute("role"))return o.setAttribute("role","textbox")},fy=function(o){if(o.hasAttribute("aria-label")||o.hasAttribute("aria-labelledby"))return;let e=function(){let a=Array.from(o.labels).map(c=>{if(!c.contains(o))return c.textContent}).filter(c=>c).join(" ");return a?o.setAttribute("aria-label",a):o.removeAttribute("aria-label")};return e(),E("focus",{onElement:o,withCallback:e})},op=function(){return Et.forcesObjectResizing?{display:"inline",width:"auto"}:{display:"inline-block",width:"1px"}}();Ks("trix-editor",`%t { display: block; } %t:empty::before { content: attr(placeholder); color: graytext; cursor: text; pointer-events: none; white-space: pre-line; } %t a[contenteditable=false] { cursor: text; } %t img { max-width: 100%; height: auto; } %t `.concat(R,` figcaption textarea { resize: none; } %t `).concat(R,` figcaption textarea.trix-autoresize-clone { position: absolute; left: -9999px; max-height: 0px; } %t `).concat(R,` figcaption[data-trix-placeholder]:empty::before { content: attr(data-trix-placeholder); color: graytext; } %t [data-trix-cursor-target] { display: `).concat(op.display,` !important; width: `).concat(op.width,` !important; padding: 0 !important; margin: 0 !important; border: none !important; } %t [data-trix-cursor-target=left] { vertical-align: top !important; margin-left: -1px !important; } %t [data-trix-cursor-target=right] { vertical-align: bottom !important; margin-right: -1px !important; }`));var Mr=new WeakMap,co=new WeakSet;class py{constructor(e){sv(this,co),oo(this,Mr,{writable:!0,value:void 0}),this.element=e,Zc(this,Mr,e.attachInternals())}connectedCallback(){el(this,co,sl).call(this)}disconnectedCallback(){}get labels(){return je(this,Mr).labels}get disabled(){var e;return(e=this.element.inputElement)===null||e===void 0?void 0:e.disabled}set disabled(e){this.element.toggleAttribute("disabled",e)}get required(){return this.element.hasAttribute("required")}set required(e){this.element.toggleAttribute("required",e),el(this,co,sl).call(this)}get validity(){return je(this,Mr).validity}get validationMessage(){return je(this,Mr).validationMessage}get willValidate(){return je(this,Mr).willValidate}setFormValue(e){el(this,co,sl).call(this)}checkValidity(){return je(this,Mr).checkValidity()}reportValidity(){return je(this,Mr).reportValidity()}setCustomValidity(e){el(this,co,sl).call(this,e)}}function sl(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",{required:e,value:n}=this.element,a=e&&!n,c=!!o,h=d("input",{required:e}),g=o||h.validationMessage;je(this,Mr).setValidity({valueMissing:a,customError:c},g)}var mu=new WeakMap,gu=new WeakMap,bu=new WeakMap;class my{constructor(e){oo(this,mu,{writable:!0,value:void 0}),oo(this,gu,{writable:!0,value:n=>{n.defaultPrevented||n.target===this.element.form&&this.element.reset()}}),oo(this,bu,{writable:!0,value:n=>{if(n.defaultPrevented||this.element.contains(n.target))return;let a=kt(n.target,{matchingSelector:"label"});a&&Array.from(this.labels).includes(a)&&this.element.focus()}}),this.element=e}connectedCallback(){Zc(this,mu,fy(this.element)),window.addEventListener("reset",je(this,gu),!1),window.addEventListener("click",je(this,bu),!1)}disconnectedCallback(){var e;(e=je(this,mu))===null||e===void 0||e.destroy(),window.removeEventListener("reset",je(this,gu),!1),window.removeEventListener("click",je(this,bu),!1)}get labels(){let e=[];this.element.id&&this.element.ownerDocument&&e.push(...Array.from(this.element.ownerDocument.querySelectorAll("label[for='".concat(this.element.id,"']"))||[]));let n=kt(this.element,{matchingSelector:"label"});return n&&[this.element,null].includes(n.control)&&e.push(n),e}get disabled(){return console.warn("This browser does not support the [disabled] attribute for trix-editor elements."),!1}set disabled(e){console.warn("This browser does not support the [disabled] attribute for trix-editor elements.")}get required(){return console.warn("This browser does not support the [required] attribute for trix-editor elements."),!1}set required(e){console.warn("This browser does not support the [required] attribute for trix-editor elements.")}get validity(){return console.warn("This browser does not support the validity property for trix-editor elements."),null}get validationMessage(){return console.warn("This browser does not support the validationMessage property for trix-editor elements."),""}get willValidate(){return console.warn("This browser does not support the willValidate property for trix-editor elements."),!1}setFormValue(e){}checkValidity(){return console.warn("This browser does not support checkValidity() for trix-editor elements."),!0}reportValidity(){return console.warn("This browser does not support reportValidity() for trix-editor elements."),!0}setCustomValidity(e){console.warn("This browser does not support setCustomValidity(validationMessage) for trix-editor elements.")}}var Ti=new WeakMap;class vu extends HTMLElement{constructor(){super(),oo(this,Ti,{writable:!0,value:void 0}),Zc(this,Ti,this.constructor.formAssociated?new py(this):new my(this))}get trixId(){return this.hasAttribute("trix-id")?this.getAttribute("trix-id"):(this.setAttribute("trix-id",++oy),this.trixId)}get labels(){return je(this,Ti).labels}get disabled(){return je(this,Ti).disabled}set disabled(e){je(this,Ti).disabled=e}get required(){return je(this,Ti).required}set required(e){je(this,Ti).required=e}get validity(){return je(this,Ti).validity}get validationMessage(){return je(this,Ti).validationMessage}get willValidate(){return je(this,Ti).willValidate}get type(){return this.localName}get toolbarElement(){if(this.hasAttribute("toolbar")){var e;return(e=this.ownerDocument)===null||e===void 0?void 0:e.getElementById(this.getAttribute("toolbar"))}else if(this.parentNode){let n="trix-toolbar-".concat(this.trixId);this.setAttribute("toolbar",n);let a=d("trix-toolbar",{id:n});return this.parentNode.insertBefore(a,this),a}else return}get form(){var e;return(e=this.inputElement)===null||e===void 0?void 0:e.form}get inputElement(){if(this.hasAttribute("input")){var e;return(e=this.ownerDocument)===null||e===void 0?void 0:e.getElementById(this.getAttribute("input"))}else if(this.parentNode){let n="trix-input-".concat(this.trixId);this.setAttribute("input",n);let a=d("input",{type:"hidden",id:n});return this.parentNode.insertBefore(a,this.nextElementSibling),a}else return}get editor(){var e;return(e=this.editorController)===null||e===void 0?void 0:e.editor}get name(){var e;return(e=this.inputElement)===null||e===void 0?void 0:e.name}get value(){var e;return(e=this.inputElement)===null||e===void 0?void 0:e.value}set value(e){var n;this.defaultValue=e,(n=this.editor)===null||n===void 0||n.loadHTML(this.defaultValue)}notify(e,n){if(this.editorController)return Y("trix-".concat(e),{onElement:this,attributes:n})}setFormValue(e){this.inputElement&&(this.inputElement.value=e,je(this,Ti).setFormValue(e))}connectedCallback(){this.hasAttribute("data-trix-internal")||(ly(this),dy(this),this.editorController||(Y("trix-before-initialize",{onElement:this}),this.editorController=new lo({editorElement:this,html:this.defaultValue=this.value}),requestAnimationFrame(()=>Y("trix-initialize",{onElement:this}))),this.editorController.registerSelectionManager(),je(this,Ti).connectedCallback(),ay(this))}disconnectedCallback(){var e;(e=this.editorController)===null||e===void 0||e.unregisterSelectionManager(),je(this,Ti).disconnectedCallback()}checkValidity(){return je(this,Ti).checkValidity()}reportValidity(){return je(this,Ti).reportValidity()}setCustomValidity(e){je(this,Ti).setCustomValidity(e)}formDisabledCallback(e){this.inputElement&&(this.inputElement.disabled=e),this.toggleAttribute("contenteditable",!e)}formResetCallback(){this.reset()}reset(){this.value=this.defaultValue}}yi(vu,"formAssociated","ElementInternals"in window);var gy=Object.freeze({__proto__:null,TrixEditorElement:vu,TrixToolbarElement:sp}),by=Object.freeze({__proto__:null,Filter:Bf,attachmentGalleryFilter:jf});let yu={VERSION:t,config:Pi,core:Lv,models:Uf,views:Iv,controllers:ry,observers:ny,operations:sy,elements:gy,filters:by};Object.assign(yu,Uf);function vy(){customElements.get("trix-toolbar")||customElements.define("trix-toolbar",sp),customElements.get("trix-editor")||customElements.define("trix-editor",vu)}return window.Trix=yu,setTimeout(vy,0),yu})});var Xg=ri(()=>{(function(i){typeof define=="function"&&define.amd?define(i):i()})(function(){"use strict";var i={exports:{}};(function(G,C){(function(F){G.exports=F()})(function(F){var St=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function bt(P,k){var p=P[0],d=P[1],A=P[2],v=P[3];p+=(d&A|~d&v)+k[0]-680876936|0,p=(p<<7|p>>>25)+d|0,v+=(p&d|~p&A)+k[1]-389564586|0,v=(v<<12|v>>>20)+p|0,A+=(v&p|~v&d)+k[2]+606105819|0,A=(A<<17|A>>>15)+v|0,d+=(A&v|~A&p)+k[3]-1044525330|0,d=(d<<22|d>>>10)+A|0,p+=(d&A|~d&v)+k[4]-176418897|0,p=(p<<7|p>>>25)+d|0,v+=(p&d|~p&A)+k[5]+1200080426|0,v=(v<<12|v>>>20)+p|0,A+=(v&p|~v&d)+k[6]-1473231341|0,A=(A<<17|A>>>15)+v|0,d+=(A&v|~A&p)+k[7]-45705983|0,d=(d<<22|d>>>10)+A|0,p+=(d&A|~d&v)+k[8]+1770035416|0,p=(p<<7|p>>>25)+d|0,v+=(p&d|~p&A)+k[9]-1958414417|0,v=(v<<12|v>>>20)+p|0,A+=(v&p|~v&d)+k[10]-42063|0,A=(A<<17|A>>>15)+v|0,d+=(A&v|~A&p)+k[11]-1990404162|0,d=(d<<22|d>>>10)+A|0,p+=(d&A|~d&v)+k[12]+1804603682|0,p=(p<<7|p>>>25)+d|0,v+=(p&d|~p&A)+k[13]-40341101|0,v=(v<<12|v>>>20)+p|0,A+=(v&p|~v&d)+k[14]-1502002290|0,A=(A<<17|A>>>15)+v|0,d+=(A&v|~A&p)+k[15]+1236535329|0,d=(d<<22|d>>>10)+A|0,p+=(d&v|A&~v)+k[1]-165796510|0,p=(p<<5|p>>>27)+d|0,v+=(p&A|d&~A)+k[6]-1069501632|0,v=(v<<9|v>>>23)+p|0,A+=(v&d|p&~d)+k[11]+643717713|0,A=(A<<14|A>>>18)+v|0,d+=(A&p|v&~p)+k[0]-373897302|0,d=(d<<20|d>>>12)+A|0,p+=(d&v|A&~v)+k[5]-701558691|0,p=(p<<5|p>>>27)+d|0,v+=(p&A|d&~A)+k[10]+38016083|0,v=(v<<9|v>>>23)+p|0,A+=(v&d|p&~d)+k[15]-660478335|0,A=(A<<14|A>>>18)+v|0,d+=(A&p|v&~p)+k[4]-405537848|0,d=(d<<20|d>>>12)+A|0,p+=(d&v|A&~v)+k[9]+568446438|0,p=(p<<5|p>>>27)+d|0,v+=(p&A|d&~A)+k[14]-1019803690|0,v=(v<<9|v>>>23)+p|0,A+=(v&d|p&~d)+k[3]-187363961|0,A=(A<<14|A>>>18)+v|0,d+=(A&p|v&~p)+k[8]+1163531501|0,d=(d<<20|d>>>12)+A|0,p+=(d&v|A&~v)+k[13]-1444681467|0,p=(p<<5|p>>>27)+d|0,v+=(p&A|d&~A)+k[2]-51403784|0,v=(v<<9|v>>>23)+p|0,A+=(v&d|p&~d)+k[7]+1735328473|0,A=(A<<14|A>>>18)+v|0,d+=(A&p|v&~p)+k[12]-1926607734|0,d=(d<<20|d>>>12)+A|0,p+=(d^A^v)+k[5]-378558|0,p=(p<<4|p>>>28)+d|0,v+=(p^d^A)+k[8]-2022574463|0,v=(v<<11|v>>>21)+p|0,A+=(v^p^d)+k[11]+1839030562|0,A=(A<<16|A>>>16)+v|0,d+=(A^v^p)+k[14]-35309556|0,d=(d<<23|d>>>9)+A|0,p+=(d^A^v)+k[1]-1530992060|0,p=(p<<4|p>>>28)+d|0,v+=(p^d^A)+k[4]+1272893353|0,v=(v<<11|v>>>21)+p|0,A+=(v^p^d)+k[7]-155497632|0,A=(A<<16|A>>>16)+v|0,d+=(A^v^p)+k[10]-1094730640|0,d=(d<<23|d>>>9)+A|0,p+=(d^A^v)+k[13]+681279174|0,p=(p<<4|p>>>28)+d|0,v+=(p^d^A)+k[0]-358537222|0,v=(v<<11|v>>>21)+p|0,A+=(v^p^d)+k[3]-722521979|0,A=(A<<16|A>>>16)+v|0,d+=(A^v^p)+k[6]+76029189|0,d=(d<<23|d>>>9)+A|0,p+=(d^A^v)+k[9]-640364487|0,p=(p<<4|p>>>28)+d|0,v+=(p^d^A)+k[12]-421815835|0,v=(v<<11|v>>>21)+p|0,A+=(v^p^d)+k[15]+530742520|0,A=(A<<16|A>>>16)+v|0,d+=(A^v^p)+k[2]-995338651|0,d=(d<<23|d>>>9)+A|0,p+=(A^(d|~v))+k[0]-198630844|0,p=(p<<6|p>>>26)+d|0,v+=(d^(p|~A))+k[7]+1126891415|0,v=(v<<10|v>>>22)+p|0,A+=(p^(v|~d))+k[14]-1416354905|0,A=(A<<15|A>>>17)+v|0,d+=(v^(A|~p))+k[5]-57434055|0,d=(d<<21|d>>>11)+A|0,p+=(A^(d|~v))+k[12]+1700485571|0,p=(p<<6|p>>>26)+d|0,v+=(d^(p|~A))+k[3]-1894986606|0,v=(v<<10|v>>>22)+p|0,A+=(p^(v|~d))+k[10]-1051523|0,A=(A<<15|A>>>17)+v|0,d+=(v^(A|~p))+k[1]-2054922799|0,d=(d<<21|d>>>11)+A|0,p+=(A^(d|~v))+k[8]+1873313359|0,p=(p<<6|p>>>26)+d|0,v+=(d^(p|~A))+k[15]-30611744|0,v=(v<<10|v>>>22)+p|0,A+=(p^(v|~d))+k[6]-1560198380|0,A=(A<<15|A>>>17)+v|0,d+=(v^(A|~p))+k[13]+1309151649|0,d=(d<<21|d>>>11)+A|0,p+=(A^(d|~v))+k[4]-145523070|0,p=(p<<6|p>>>26)+d|0,v+=(d^(p|~A))+k[11]-1120210379|0,v=(v<<10|v>>>22)+p|0,A+=(p^(v|~d))+k[2]+718787259|0,A=(A<<15|A>>>17)+v|0,d+=(v^(A|~p))+k[9]-343485551|0,d=(d<<21|d>>>11)+A|0,P[0]=p+P[0]|0,P[1]=d+P[1]|0,P[2]=A+P[2]|0,P[3]=v+P[3]|0}function It(P){var k=[],p;for(p=0;p<64;p+=4)k[p>>2]=P.charCodeAt(p)+(P.charCodeAt(p+1)<<8)+(P.charCodeAt(p+2)<<16)+(P.charCodeAt(p+3)<<24);return k}function E(P){var k=[],p;for(p=0;p<64;p+=4)k[p>>2]=P[p]+(P[p+1]<<8)+(P[p+2]<<16)+(P[p+3]<<24);return k}function N(P){var k=P.length,p=[1732584193,-271733879,-1732584194,271733878],d,A,v,he,Pe,Ie;for(d=64;d<=k;d+=64)bt(p,It(P.substring(d-64,d)));for(P=P.substring(d-64),A=P.length,v=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],d=0;d>2]|=P.charCodeAt(d)<<(d%4<<3);if(v[d>>2]|=128<<(d%4<<3),d>55)for(bt(p,v),d=0;d<16;d+=1)v[d]=0;return he=k*8,he=he.toString(16).match(/(.*?)(.{0,8})$/),Pe=parseInt(he[2],16),Ie=parseInt(he[1],16)||0,v[14]=Pe,v[15]=Ie,bt(p,v),p}function Y(P){var k=P.length,p=[1732584193,-271733879,-1732584194,271733878],d,A,v,he,Pe,Ie;for(d=64;d<=k;d+=64)bt(p,E(P.subarray(d-64,d)));for(P=d-64>2]|=P[d]<<(d%4<<3);if(v[d>>2]|=128<<(d%4<<3),d>55)for(bt(p,v),d=0;d<16;d+=1)v[d]=0;return he=k*8,he=he.toString(16).match(/(.*?)(.{0,8})$/),Pe=parseInt(he[2],16),Ie=parseInt(he[1],16)||0,v[14]=Pe,v[15]=Ie,bt(p,v),p}function et(P){var k="",p;for(p=0;p<4;p+=1)k+=St[P>>p*8+4&15]+St[P>>p*8&15];return k}function kt(P){var k;for(k=0;kv?new ArrayBuffer(0):(he=v-A,Pe=new ArrayBuffer(he),Ie=new Uint8Array(Pe),ni=new Uint8Array(this,A,he),Ie.set(ni),Pe)}}();function Nt(P){return/[\u0080-\uFFFF]/.test(P)&&(P=unescape(encodeURIComponent(P))),P}function Wt(P,k){var p=P.length,d=new ArrayBuffer(p),A=new Uint8Array(d),v;for(v=0;v>2]|=k.charCodeAt(d)<<(d%4<<3);return this._finish(A,p),v=kt(this._hash),P&&(v=di(v)),this.reset(),v},zt.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},zt.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},zt.prototype.setState=function(P){return this._buff=P.buff,this._length=P.length,this._hash=P.hash,this},zt.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},zt.prototype._finish=function(P,k){var p=k,d,A,v;if(P[p>>2]|=128<<(p%4<<3),p>55)for(bt(this._hash,P),p=0;p<16;p+=1)P[p]=0;d=this._length*8,d=d.toString(16).match(/(.*?)(.{0,8})$/),A=parseInt(d[2],16),v=parseInt(d[1],16)||0,P[14]=A,P[15]=v,bt(this._hash,P)},zt.hash=function(P,k){return zt.hashBinary(Nt(P),k)},zt.hashBinary=function(P,k){var p=N(P),d=kt(p);return k?di(d):d},zt.ArrayBuffer=function(){this.reset()},zt.ArrayBuffer.prototype.append=function(P){var k=Xe(this._buff.buffer,P,!0),p=k.length,d;for(this._length+=P.byteLength,d=64;d<=p;d+=64)bt(this._hash,E(k.subarray(d-64,d)));return this._buff=d-64>2]|=k[A]<<(A%4<<3);return this._finish(d,p),v=kt(this._hash),P&&(v=di(v)),this.reset(),v},zt.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},zt.ArrayBuffer.prototype.getState=function(){var P=zt.prototype.getState.call(this);return P.buff=Kt(P.buff),P},zt.ArrayBuffer.prototype.setState=function(P){return P.buff=Wt(P.buff,!0),zt.prototype.setState.call(this,P)},zt.ArrayBuffer.prototype.destroy=zt.prototype.destroy,zt.ArrayBuffer.prototype._finish=zt.prototype._finish,zt.ArrayBuffer.hash=function(P,k){var p=Y(new Uint8Array(P)),d=kt(p);return k?di(d):d},zt})})(i);var t=i.exports;let r=File.prototype.slice||File.prototype.mozSlice||File.prototype.webkitSlice;class s{static create(C,F){new s(C).create(F)}constructor(C){this.file=C,this.chunkSize=2097152,this.chunkCount=Math.ceil(this.file.size/this.chunkSize),this.chunkIndex=0}create(C){this.callback=C,this.md5Buffer=new t.ArrayBuffer,this.fileReader=new FileReader,this.fileReader.addEventListener("load",F=>this.fileReaderDidLoad(F)),this.fileReader.addEventListener("error",F=>this.fileReaderDidError(F)),this.readNextChunk()}fileReaderDidLoad(C){if(this.md5Buffer.append(C.target.result),!this.readNextChunk()){let F=this.md5Buffer.end(!0),St=btoa(F);this.callback(null,St)}}fileReaderDidError(C){this.callback(`Error reading ${this.file.name}`)}readNextChunk(){if(this.chunkIndex{this.xhr.setRequestHeader(E,bt[E])});let It=l("csrf-token");It!=null&&this.xhr.setRequestHeader("X-CSRF-Token",It),this.xhr.addEventListener("load",E=>this.requestDidLoad(E)),this.xhr.addEventListener("error",E=>this.requestDidError(E))}get status(){return this.xhr.status}get response(){let{responseType:C,response:F}=this.xhr;return C=="json"?F:JSON.parse(F)}create(C){this.callback=C,this.xhr.send(JSON.stringify({blob:this.attributes}))}requestDidLoad(C){if(this.status>=200&&this.status<300){let{response:F}=this,{direct_upload:St}=F;delete F.direct_upload,this.attributes=F,this.directUploadData=St,this.callback(null,this.toJSON())}else this.requestDidError(C)}requestDidError(C){this.callback(`Error creating Blob for "${this.file.name}". Status: ${this.status}`)}toJSON(){let C={};for(let F in this.attributes)C[F]=this.attributes[F];return C}}class H{constructor(C){this.blob=C,this.file=C.file;let{url:F,headers:St}=C.directUploadData;this.xhr=new XMLHttpRequest,this.xhr.open("PUT",F,!0),this.xhr.responseType="text";for(let bt in St)this.xhr.setRequestHeader(bt,St[bt]);this.xhr.addEventListener("load",bt=>this.requestDidLoad(bt)),this.xhr.addEventListener("error",bt=>this.requestDidError(bt))}create(C){this.callback=C,this.xhr.send(this.file.slice())}requestDidLoad(C){let{status:F,response:St}=this.xhr;F>=200&&F<300?this.callback(null,St):this.requestDidError(C)}requestDidError(C){this.callback(`Error storing "${this.file.name}". Status: ${this.xhr.status}`)}}let Z=0;class X{constructor(C,F,St,bt={}){this.id=++Z,this.file=C,this.url=F,this.delegate=St,this.customHeaders=bt}create(C){s.create(this.file,(F,St)=>{if(F){C(F);return}let bt=new D(this.file,St,this.url,this.customHeaders);J(this.delegate,"directUploadWillCreateBlobWithXHR",bt.xhr),bt.create(It=>{if(It)C(It);else{let E=new H(bt);J(this.delegate,"directUploadWillStoreFileWithXHR",E.xhr),E.create(N=>{N?C(N):C(null,bt.toJSON())})}})})}}function J(G,C,...F){if(G&&typeof G[C]=="function")return G[C](...F)}class ${constructor(C,F){this.input=C,this.file=F,this.directUpload=new X(this.file,this.url,this),this.dispatch("initialize")}start(C){let F=document.createElement("input");F.type="hidden",F.name=this.input.name,this.input.insertAdjacentElement("beforebegin",F),this.dispatch("start"),this.directUpload.create((St,bt)=>{St?(F.parentNode.removeChild(F),this.dispatchError(St)):F.value=bt.signed_id,this.dispatch("end"),C(St)})}uploadRequestDidProgress(C){let F=C.loaded/C.total*100;F&&this.dispatch("progress",{progress:F})}get url(){return this.input.getAttribute("data-direct-upload-url")}dispatch(C,F={}){return F.file=this.file,F.id=this.directUpload.id,y(this.input,`direct-upload:${C}`,{detail:F})}dispatchError(C){this.dispatch("error",{error:C}).defaultPrevented||alert(C)}directUploadWillCreateBlobWithXHR(C){this.dispatch("before-blob-request",{xhr:C})}directUploadWillStoreFileWithXHR(C){this.dispatch("before-storage-request",{xhr:C}),C.upload.addEventListener("progress",F=>this.uploadRequestDidProgress(F))}}let st="input[type=file][data-direct-upload-url]:not([disabled])";class ft{constructor(C){this.form=C,this.inputs=u(C,st).filter(F=>F.files.length)}start(C){let F=this.createDirectUploadControllers(),St=()=>{let bt=F.shift();bt?bt.start(It=>{It?(C(It),this.dispatch("end")):St()}):(C(),this.dispatch("end"))};this.dispatch("start"),St()}createDirectUploadControllers(){let C=[];return this.inputs.forEach(F=>{T(F.files).forEach(St=>{let bt=new $(F,St);C.push(bt)})}),C}dispatch(C,F={}){return y(this.form,`direct-uploads:${C}`,{detail:F})}}let Q="data-direct-uploads-processing",R=new WeakMap,I=!1;function V(){I||(I=!0,document.addEventListener("click",K,!0),document.addEventListener("submit",gt,!0),document.addEventListener("ajax:before",dt))}function K(G){let C=G.target.closest("button, input");C&&C.type==="submit"&&C.form&&R.set(C.form,C)}function gt(G){Et(G)}function dt(G){G.target.tagName=="FORM"&&Et(G)}function Et(G){let C=G.target;if(C.hasAttribute(Q)){G.preventDefault();return}let F=new ft(C),{inputs:St}=F;St.length&&(G.preventDefault(),C.setAttribute(Q,""),St.forEach(Qt),F.start(bt=>{C.removeAttribute(Q),bt?St.forEach(At):Ot(C)}))}function Ot(G){let C=R.get(G)||f(G,"input[type=submit], button[type=submit]");if(C){let{disabled:F}=C;C.disabled=!1,C.focus(),C.click(),C.disabled=F}else C=document.createElement("input"),C.type="submit",C.style.display="none",G.appendChild(C),C.click(),G.removeChild(C);R.delete(G)}function Qt(G){G.disabled=!0}function At(G){G.disabled=!1}function Te(){window.ActiveStorage&&V()}setTimeout(Te,1);class xe{constructor(C,F){this.attachment=C,this.element=F,this.directUpload=new X(C.file,this.directUploadUrl,this)}start(){this.directUpload.create(this.directUploadDidComplete.bind(this)),this.dispatch("start")}directUploadWillStoreFileWithXHR(C){C.upload.addEventListener("progress",F=>{let St=F.loaded/F.total*100;this.attachment.setUploadProgress(St),St&&this.dispatch("progress",{progress:St})})}directUploadDidComplete(C,F){C?this.dispatchError(C):(this.attachment.setAttributes({sgid:F.attachable_sgid,url:this.createBlobUrl(F.signed_id,F.filename)}),this.dispatch("end"))}createBlobUrl(C,F){return this.blobUrlTemplate.replace(":signed_id",C).replace(":filename",encodeURIComponent(F))}dispatch(C,F={}){return F.attachment=this.attachment,y(this.element,`direct-upload:${C}`,{detail:F})}dispatchError(C){this.dispatch("error",{error:C}).defaultPrevented||alert(C)}get directUploadUrl(){return this.element.dataset.directUploadUrl}get blobUrlTemplate(){return this.element.dataset.blobUrlTemplate}}addEventListener("trix-attachment-add",G=>{let{attachment:C,target:F}=G;C.file&&new xe(C,F).start()})})});var Yg={};ml(Yg,{default:()=>y0});var Oc,v0,y0,Gg=ri(()=>{Oc=ki($g());Xg();v0={start(){document.addEventListener("trix-initialize",()=>{this.setToolbar(),this.setLanguage(),this.setAttachmentsConfig()})},setToolbar(){let i=document.getElementsByTagName("trix-toolbar"),{lang:t}=Oc.default.config;i.forEach(r=>{r.innerHTML=`
`})},setAttachmentsConfig(){let{attachments:i}=Oc.default.config;i.preview.caption.name=!1,i.preview.caption.size=!1},setLanguage(){let{lang:i}=Oc.default.config;i.bold="Negrito",i.italic="It\xE1lico",i.attachFiles="Adicionar fotos",i.undo="Desfazer",i.redo="Refazer",i.captionPlaceholder="Adicionar legenda...",i.bullets="Lista de itens"}},y0=v0});var Jg=ar((Kg,Cd)=>{(function(){"use strict";function i(){var t=window,r=document;if("scrollBehavior"in r.documentElement.style&&t.__forceSmoothScrollPolyfill__!==!0)return;var s=t.HTMLElement||t.Element,l=468,u={scroll:t.scroll||t.scrollTo,scrollBy:t.scrollBy,elementScroll:s.prototype.scroll||D,scrollIntoView:s.prototype.scrollIntoView},f=t.performance&&t.performance.now?t.performance.now.bind(t.performance):Date.now;function y(R){var I=["MSIE ","Trident/","Edge/"];return new RegExp(I.join("|")).test(R)}var T=y(t.navigator.userAgent)?1:0;function D(R,I){this.scrollLeft=R,this.scrollTop=I}function H(R){return .5*(1-Math.cos(Math.PI*R))}function Z(R){if(R===null||typeof R!="object"||R.behavior===void 0||R.behavior==="auto"||R.behavior==="instant")return!0;if(typeof R=="object"&&R.behavior==="smooth")return!1;throw new TypeError("behavior member of ScrollOptions "+R.behavior+" is not a valid value for enumeration ScrollBehavior.")}function X(R,I){if(I==="Y")return R.clientHeight+T1?1:dt,V=H(dt),K=R.startX+(R.x-R.startX)*V,gt=R.startY+(R.y-R.startY)*V,R.method.call(R.scrollable,K,gt),(K!==R.x||gt!==R.y)&&t.requestAnimationFrame(ft.bind(t,R))}function Q(R,I,V){var K,gt,dt,Et,Ot=f();R===r.body?(K=t,gt=t.scrollX||t.pageXOffset,dt=t.scrollY||t.pageYOffset,Et=u.scroll):(K=R,gt=R.scrollLeft,dt=R.scrollTop,Et=D),ft({scrollable:K,method:Et,startTime:Ot,startX:gt,startY:dt,x:I,y:V})}t.scroll=t.scrollTo=function(){if(arguments[0]!==void 0){if(Z(arguments[0])===!0){u.scroll.call(t,arguments[0].left!==void 0?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:t.scrollX||t.pageXOffset,arguments[0].top!==void 0?arguments[0].top:arguments[1]!==void 0?arguments[1]:t.scrollY||t.pageYOffset);return}Q.call(t,r.body,arguments[0].left!==void 0?~~arguments[0].left:t.scrollX||t.pageXOffset,arguments[0].top!==void 0?~~arguments[0].top:t.scrollY||t.pageYOffset)}},t.scrollBy=function(){if(arguments[0]!==void 0){if(Z(arguments[0])){u.scrollBy.call(t,arguments[0].left!==void 0?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:0,arguments[0].top!==void 0?arguments[0].top:arguments[1]!==void 0?arguments[1]:0);return}Q.call(t,r.body,~~arguments[0].left+(t.scrollX||t.pageXOffset),~~arguments[0].top+(t.scrollY||t.pageYOffset))}},s.prototype.scroll=s.prototype.scrollTo=function(){if(arguments[0]!==void 0){if(Z(arguments[0])===!0){if(typeof arguments[0]=="number"&&arguments[1]===void 0)throw new SyntaxError("Value could not be converted");u.elementScroll.call(this,arguments[0].left!==void 0?~~arguments[0].left:typeof arguments[0]!="object"?~~arguments[0]:this.scrollLeft,arguments[0].top!==void 0?~~arguments[0].top:arguments[1]!==void 0?~~arguments[1]:this.scrollTop);return}var R=arguments[0].left,I=arguments[0].top;Q.call(this,this,typeof R=="undefined"?this.scrollLeft:~~R,typeof I=="undefined"?this.scrollTop:~~I)}},s.prototype.scrollBy=function(){if(arguments[0]!==void 0){if(Z(arguments[0])===!0){u.elementScroll.call(this,arguments[0].left!==void 0?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,arguments[0].top!==void 0?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop);return}this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior})}},s.prototype.scrollIntoView=function(){if(Z(arguments[0])===!0){u.scrollIntoView.call(this,arguments[0]===void 0?!0:arguments[0]);return}var R=st(this),I=R.getBoundingClientRect(),V=this.getBoundingClientRect();R!==r.body?(Q.call(this,R,R.scrollLeft+V.left-I.left,R.scrollTop+V.top-I.top),t.getComputedStyle(R).position!=="fixed"&&t.scrollBy({left:I.left,top:I.top,behavior:"smooth"})):t.scrollBy({left:V.left,top:V.top,behavior:"smooth"})}}typeof Kg=="object"&&typeof Cd!="undefined"?Cd.exports={polyfill:i}:i()})()});var Qg=ar((Zg,kd)=>{(function(i){if(typeof Zg=="object"&&typeof kd!="undefined")kd.exports=i();else if(typeof define=="function"&&define.amd)define([],i);else{var t;typeof window!="undefined"?t=window:typeof global!="undefined"?t=global:typeof self!="undefined"?t=self:t=this,t.polyfillEventTarget=i()}})(function(){var i,t,r;return function s(l,u,f){function y(H,Z){if(!u[H]){if(!l[H]){var X=typeof po=="function"&&po;if(!Z&&X)return X(H,!0);if(T)return T(H,!0);var J=new Error("Cannot find module '"+H+"'");throw J.code="MODULE_NOT_FOUND",J}var $=u[H]={exports:{}};l[H][0].call($.exports,function(st){var ft=l[H][1][st];return y(ft||st)},$,$.exports,s,l,u,f)}return u[H].exports}for(var T=typeof po=="function"&&po,D=0;D{(function(i,t){typeof Ld=="object"&&typeof _d!="undefined"?_d.exports=t():typeof define=="function"&&define.amd?define(t):i.lozad=t()})(Ld,function(){"use strict";var i=typeof document!="undefined"&&document.documentMode,t={rootMargin:"0px",threshold:0,load:function(u){if(u.nodeName.toLowerCase()==="picture"){var f=u.querySelector("img"),y=!1;f===null&&(f=document.createElement("img"),y=!0),i&&u.getAttribute("data-iesrc")&&(f.src=u.getAttribute("data-iesrc")),u.getAttribute("data-alt")&&(f.alt=u.getAttribute("data-alt")),y&&u.append(f)}if(u.nodeName.toLowerCase()==="video"&&!u.getAttribute("data-src")&&u.children){for(var T=u.children,D=void 0,H=0;H<=T.length-1;H++)(D=T[H].getAttribute("data-src"))&&(T[H].src=D);u.load()}u.getAttribute("data-poster")&&(u.poster=u.getAttribute("data-poster")),u.getAttribute("data-src")&&(u.src=u.getAttribute("data-src")),u.getAttribute("data-srcset")&&u.setAttribute("srcset",u.getAttribute("data-srcset"));var Z=",";if(u.getAttribute("data-background-delimiter")&&(Z=u.getAttribute("data-background-delimiter")),u.getAttribute("data-background-image"))u.style.backgroundImage="url('"+u.getAttribute("data-background-image").split(Z).join("'),url('")+"')";else if(u.getAttribute("data-background-image-set")){var X=u.getAttribute("data-background-image-set").split(Z),J=X[0].substr(0,X[0].indexOf(" "))||X[0];J=J.indexOf("url(")===-1?"url("+J+")":J,X.length===1?u.style.backgroundImage=J:u.setAttribute("style",(u.getAttribute("style")||"")+"background-image: "+J+"; background-image: -webkit-image-set("+X+"); background-image: image-set("+X+")")}u.getAttribute("data-toggle-class")&&u.classList.toggle(u.getAttribute("data-toggle-class"))},loaded:function(){}};function r(u){u.setAttribute("data-loaded",!0)}var s=function(u){return u.getAttribute("data-loaded")==="true"},l=function(u){var f=1rn,FetchMethod:()=>$i,FetchRequest:()=>ln,FetchResponse:()=>ms,FrameElement:()=>Qi,FrameLoadingStyle:()=>xn,FrameRenderer:()=>bs,PageRenderer:()=>vs,PageSnapshot:()=>Ji,StreamActions:()=>bh,StreamElement:()=>Ml,StreamSourceElement:()=>Ol,cache:()=>cm,clearCache:()=>pm,config:()=>hi,connectStreamSource:()=>Oo,disconnectStreamSource:()=>Po,fetch:()=>ph,fetchEnctypeFromString:()=>Kp,fetchMethodFromString:()=>Fl,isSafe:()=>Bl,navigator:()=>um,registerAdapter:()=>hm,renderStreamMessage:()=>fm,session:()=>Ze,setConfirmMethod:()=>gm,setFormMode:()=>bm,setProgressBarDelay:()=>mm,start:()=>gh,visit:()=>dm});(function(i){if(typeof i.requestSubmit=="function")return;i.requestSubmit=function(s){s?(t(s,this),s.click()):(s=document.createElement("input"),s.type="submit",s.hidden=!0,this.appendChild(s),s.click(),this.removeChild(s))};function t(s,l){s instanceof HTMLElement||r(TypeError,"parameter 1 is not of type 'HTMLElement'"),s.type=="submit"||r(TypeError,"The specified element is not a submit button"),s.form==l||r(DOMException,"The specified element is not owned by this form element","NotFoundError")}function r(s,l,u){throw new s("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+l+".",u)}})(HTMLFormElement.prototype);var Bp=new WeakMap;function Py(i){let t=i instanceof Element?i:i instanceof Node?i.parentElement:null,r=t?t.closest("input, button"):null;return(r==null?void 0:r.type)=="submit"?r:null}function Iy(i){let t=Py(i.target);t&&t.form&&Bp.set(t.form,t)}(function(){if("submitter"in Event.prototype)return;let i=window.Event.prototype;if("SubmitEvent"in window){let t=window.SubmitEvent.prototype;if(/Apple Computer/.test(navigator.vendor)&&!("submitter"in t))i=t;else return}addEventListener("click",Iy,!0),Object.defineProperty(i,"submitter",{get(){if(this.type=="submit"&&this.target instanceof HTMLFormElement)return Bp.get(this.target)}})})();var xn={eager:"eager",lazy:"lazy"},Pl=class Pl extends HTMLElement{constructor(){super();j(this,"loaded",Promise.resolve());this.delegate=new Pl.delegateConstructor(this)}static get observedAttributes(){return["disabled","loading","src"]}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(r){r=="loading"?this.delegate.loadingStyleChanged():r=="src"?this.delegate.sourceURLChanged():r=="disabled"&&this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(r){r?this.setAttribute("src",r):this.removeAttribute("src")}get refresh(){return this.getAttribute("refresh")}set refresh(r){r?this.setAttribute("refresh",r):this.removeAttribute("refresh")}get shouldReloadWithMorph(){return this.src&&this.refresh==="morph"}get loading(){return Ny(this.getAttribute("loading")||"")}set loading(r){r?this.setAttribute("loading",r):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(r){r?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(r){r?this.setAttribute("autoscroll",""):this.removeAttribute("autoscroll")}get complete(){return!this.delegate.isLoading}get isActive(){return this.ownerDocument===document&&!this.isPreview}get isPreview(){var r,s;return(s=(r=this.ownerDocument)==null?void 0:r.documentElement)==null?void 0:s.hasAttribute("data-turbo-preview")}};j(Pl,"delegateConstructor");var Qi=Pl;function Ny(i){switch(i.toLowerCase()){case"lazy":return xn.lazy;default:return xn.eager}}var Fy={enabled:!0,progressBarDelay:500,unvisitableExtensions:new Set([".7z",".aac",".apk",".avi",".bmp",".bz2",".css",".csv",".deb",".dmg",".doc",".docx",".exe",".gif",".gz",".heic",".heif",".ico",".iso",".jpeg",".jpg",".js",".json",".m4a",".mkv",".mov",".mp3",".mp4",".mpeg",".mpg",".msi",".ogg",".ogv",".pdf",".pkg",".png",".ppt",".pptx",".rar",".rtf",".svg",".tar",".tif",".tiff",".txt",".wav",".webm",".webp",".wma",".wmv",".xls",".xlsx",".xml",".zip"])};function bo(i){if(i.getAttribute("data-turbo-eval")=="false")return i;{let t=document.createElement("script"),r=Up();return r&&(t.nonce=r),t.textContent=i.textContent,t.async=!1,By(t,i),t}}function By(i,t){for(let{name:r,value:s}of t.attributes)i.setAttribute(r,s)}function jy(i){let t=document.createElement("template");return t.innerHTML=i,t.content}function Ue(i,{target:t,cancelable:r,detail:s}={}){let l=new CustomEvent(i,{cancelable:r,bubbles:!0,composed:!0,detail:s});return t&&t.isConnected?t.dispatchEvent(l):document.documentElement.dispatchEvent(l),l}function Rp(i){i.preventDefault(),i.stopImmediatePropagation()}function go(){return document.visibilityState==="hidden"?Hp():jp()}function jp(){return new Promise(i=>requestAnimationFrame(()=>i()))}function Hp(){return new Promise(i=>setTimeout(()=>i(),0))}function Hy(){return Promise.resolve()}function qp(i=""){return new DOMParser().parseFromString(i,"text/html")}function zp(i,...t){let r=qy(i,t).replace(/^\n/,"").split(` `),s=r[0].match(/^\s+/),l=s?s[0].length:0;return r.map(u=>u.slice(l)).join(` `)}function qy(i,t){return i.reduce((r,s,l)=>{let u=t[l]==null?"":t[l];return r+s+u},"")}function an(){return Array.from({length:36}).map((i,t)=>t==8||t==13||t==18||t==23?"-":t==14?"4":t==19?(Math.floor(Math.random()*4)+8).toString(16):Math.floor(Math.random()*15).toString(16)).join("")}function Al(i,...t){for(let r of t.map(s=>s==null?void 0:s.getAttribute(i)))if(typeof r=="string")return r;return null}function zy(i,...t){return t.some(r=>r&&r.hasAttribute(i))}function Sl(...i){for(let t of i)t.localName=="turbo-frame"&&t.setAttribute("busy",""),t.setAttribute("aria-busy","true")}function Tl(...i){for(let t of i)t.localName=="turbo-frame"&&t.removeAttribute("busy"),t.removeAttribute("aria-busy")}function Wy(i,t=2e3){return new Promise(r=>{let s=()=>{i.removeEventListener("error",s),i.removeEventListener("load",s),r()};i.addEventListener("load",s,{once:!0}),i.addEventListener("error",s,{once:!0}),setTimeout(r,t)})}function Wp(i){switch(i){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function Uy(i){return i=="advance"||i=="replace"||i=="restore"}function Ln(...i){let t=Al("data-turbo-action",...i);return Uy(t)?t:null}function hh(i){return document.querySelector(`meta[name="${i}"]`)}function xl(i){let t=hh(i);return t&&t.content}function Up(){let i=hh("csp-nonce");if(i){let{nonce:t,content:r}=i;return t==""?r:t}}function Vy(i,t){let r=hh(i);return r||(r=document.createElement("meta"),r.setAttribute("name",i),document.head.appendChild(r)),r.setAttribute("content",t),r}function ls(i,t){var r;if(i instanceof Element)return i.closest(t)||ls(i.assignedSlot||((r=i.getRootNode())==null?void 0:r.host),t)}function dh(i){return!!i&&i.closest("[inert], :disabled, [hidden], details:not([open]), dialog:not([open])")==null&&typeof i.focus=="function"}function Vp(i){return Array.from(i.querySelectorAll("[autofocus]")).find(dh)}async function $y(i,t){let r=t();i(),await jp();let s=t();return[r,s]}function $p(i){if(i==="_blank")return!1;if(i){for(let t of document.getElementsByName(i))if(t instanceof HTMLIFrameElement)return!1;return!0}else return!0}function Xp(i){return ls(i,"a[href]:not([target^=_]):not([download])")}function Yp(i){return mi(i.getAttribute("href")||"")}function Xy(i,t){let r=null;return(...s)=>{let l=()=>i.apply(this,s);clearTimeout(r),r=setTimeout(l,t)}}var Yy={"aria-disabled":{beforeSubmit:i=>{i.setAttribute("aria-disabled","true"),i.addEventListener("click",Rp)},afterSubmit:i=>{i.removeAttribute("aria-disabled"),i.removeEventListener("click",Rp)}},disabled:{beforeSubmit:i=>i.disabled=!0,afterSubmit:i=>i.disabled=!1}},wo,Ou=class{constructor(t){we(this,wo,null);Object.assign(this,t)}get submitter(){return Zt(this,wo)}set submitter(t){_e(this,wo,Yy[t]||t)}};wo=new WeakMap;var Gy=new Ou({mode:"on",submitter:"disabled"}),hi={drive:Fy,forms:Gy};function mi(i){return new URL(i.toString(),document.baseURI)}function _n(i){let t;if(i.hash)return i.hash.slice(1);if(t=i.href.match(/#(.*)$/))return t[1]}function fh(i,t){let r=(t==null?void 0:t.getAttribute("formaction"))||i.getAttribute("action")||i.action;return mi(r)}function Ky(i){return(tw(i).match(/\.[^.]*$/)||[])[0]||""}function Jy(i,t){let r=ew(t);return i.href===mi(r).href||i.href.startsWith(r)}function en(i,t){return Jy(i,t)&&!hi.drive.unvisitableExtensions.has(Ky(i))}function Pu(i){let t=_n(i);return t!=null?i.href.slice(0,-(t.length+1)):i.href}function gl(i){return Pu(i)}function Zy(i,t){return mi(i).href==mi(t).href}function Qy(i){return i.pathname.split("/").slice(1)}function tw(i){return Qy(i).slice(-1)[0]}function ew(i){return iw(i.origin+i.pathname)}function iw(i){return i.endsWith("/")?i:i+"/"}var ms=class{constructor(t){this.response=t}get succeeded(){return this.response.ok}get failed(){return!this.succeeded}get clientError(){return this.statusCode>=400&&this.statusCode<=499}get serverError(){return this.statusCode>=500&&this.statusCode<=599}get redirected(){return this.response.redirected}get location(){return mi(this.response.url)}get isHTML(){return this.contentType&&this.contentType.match(/^(?:text\/([^\s;,]+\b)?html|application\/xhtml\+xml)\b/)}get statusCode(){return this.response.status}get contentType(){return this.header("Content-Type")}get responseText(){return this.response.clone().text()}get responseHTML(){return this.isHTML?this.response.clone().text():Promise.resolve(void 0)}header(t){return this.response.headers.get(t)}},Iu=class extends Set{constructor(t){super(),this.maxSize=t}add(t){if(this.size>=this.maxSize){let s=this.values().next().value;this.delete(s)}super.add(t)}},Gp=new Iu(20),rw=window.fetch;function ph(i,t={}){let r=new Headers(t.headers||{}),s=an();return Gp.add(s),r.append("X-Turbo-Request-Id",s),rw(i,rs(ui({},t),{headers:r}))}function Fl(i){switch(i.toLowerCase()){case"get":return $i.get;case"post":return $i.post;case"put":return $i.put;case"patch":return $i.patch;case"delete":return $i.delete}}var $i={get:"get",post:"post",put:"put",patch:"patch",delete:"delete"};function Kp(i){switch(i.toLowerCase()){case rn.multipart:return rn.multipart;case rn.plain:return rn.plain;default:return rn.urlEncoded}}var rn={urlEncoded:"application/x-www-form-urlencoded",multipart:"multipart/form-data",plain:"text/plain"},Eo,ys,Jp,Zp,ln=class{constructor(t,r,s,l=new URLSearchParams,u=null,f=rn.urlEncoded){we(this,ys);j(this,"abortController",new AbortController);we(this,Eo,t=>{});var D;let[y,T]=Mp(mi(s),r,l,f);this.delegate=t,this.url=y,this.target=u,this.fetchOptions={credentials:"same-origin",redirect:"follow",method:r.toUpperCase(),headers:ui({},this.defaultHeaders),body:T,signal:this.abortSignal,referrer:(D=this.delegate.referrer)==null?void 0:D.href},this.enctype=f}get method(){return this.fetchOptions.method}set method(t){let r=this.isSafe?this.url.searchParams:this.fetchOptions.body||new FormData,s=Fl(t)||$i.get;this.url.search="";let[l,u]=Mp(this.url,s,r,this.enctype);this.url=l,this.fetchOptions.body=u,this.fetchOptions.method=s.toUpperCase()}get headers(){return this.fetchOptions.headers}set headers(t){this.fetchOptions.headers=t}get body(){return this.isSafe?this.url.searchParams:this.fetchOptions.body}set body(t){this.fetchOptions.body=t}get location(){return this.url}get params(){return this.url.searchParams}get entries(){return this.body?Array.from(this.body.entries()):[]}cancel(){this.abortController.abort()}async perform(){let{fetchOptions:t}=this;this.delegate.prepareRequest(this);let r=await ne(this,ys,Jp).call(this,t);try{this.delegate.requestStarted(this),r.detail.fetchRequest?this.response=r.detail.fetchRequest.response:this.response=ph(this.url.href,t);let s=await this.response;return await this.receive(s)}catch(s){if(s.name!=="AbortError")throw ne(this,ys,Zp).call(this,s)&&this.delegate.requestErrored(this,s),s}finally{this.delegate.requestFinished(this)}}async receive(t){let r=new ms(t);return Ue("turbo:before-fetch-response",{cancelable:!0,detail:{fetchResponse:r},target:this.target}).defaultPrevented?this.delegate.requestPreventedHandlingResponse(this,r):r.succeeded?this.delegate.requestSucceededWithResponse(this,r):this.delegate.requestFailedWithResponse(this,r),r}get defaultHeaders(){return{Accept:"text/html, application/xhtml+xml"}}get isSafe(){return Bl(this.method)}get abortSignal(){return this.abortController.signal}acceptResponseType(t){this.headers.Accept=[t,this.headers.Accept].join(", ")}};Eo=new WeakMap,ys=new WeakSet,Jp=async function(t){let r=new Promise(l=>_e(this,Eo,l)),s=Ue("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:t,url:this.url,resume:Zt(this,Eo)},target:this.target});return this.url=s.detail.url,s.defaultPrevented&&await r,s},Zp=function(t){return!Ue("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:t}}).defaultPrevented};function Bl(i){return Fl(i)==$i.get}function Mp(i,t,r,s){let l=Array.from(r).length>0?new URLSearchParams(Qp(r)):i.searchParams;return Bl(t)?[nw(i,l),null]:s==rn.urlEncoded?[i,l]:[i,r]}function Qp(i){let t=[];for(let[r,s]of i)s instanceof File||t.push([r,s]);return t}function nw(i,t){let r=new URLSearchParams(Qp(t));return i.search=r.toString(),i}var Nu=class{constructor(t,r){j(this,"started",!1);j(this,"intersect",t=>{let r=t.slice(-1)[0];r!=null&&r.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)});this.delegate=t,this.element=r,this.intersectionObserver=new IntersectionObserver(this.intersect)}start(){this.started||(this.started=!0,this.intersectionObserver.observe(this.element))}stop(){this.started&&(this.started=!1,this.intersectionObserver.unobserve(this.element))}},jr=class{static wrap(t){return typeof t=="string"?new this(jy(t)):t}constructor(t){this.fragment=sw(t)}};j(jr,"contentType","text/vnd.turbo-stream.html");function sw(i){for(let t of i.querySelectorAll("turbo-stream")){let r=document.importNode(t,!0);for(let s of r.templateElement.content.querySelectorAll("script"))s.replaceWith(bo(s));t.replaceWith(r)}return i}var ow=100,Cn,Fr,Fu=class{constructor(){we(this,Cn,null);we(this,Fr,null)}get(t){if(Zt(this,Fr)&&Zt(this,Fr).url===t&&Zt(this,Fr).expire>Date.now())return Zt(this,Fr).request}setLater(t,r,s){this.clear(),_e(this,Cn,setTimeout(()=>{r.perform(),this.set(t,r,s),_e(this,Cn,null)},ow))}set(t,r,s){_e(this,Fr,{url:t,request:r,expire:new Date(new Date().getTime()+s)})}clear(){Zt(this,Cn)&&clearTimeout(Zt(this,Cn)),_e(this,Fr,null)}};Cn=new WeakMap,Fr=new WeakMap;var aw=10*1e3,as=new Fu,ns={initialized:"initialized",requesting:"requesting",waiting:"waiting",receiving:"receiving",stopping:"stopping",stopped:"stopped"},Cl=class i{constructor(t,r,s,l=!1){j(this,"state",ns.initialized);let u=fw(r,s),f=dw(hw(r,s),u),y=lw(r,s),T=pw(r,s);this.delegate=t,this.formElement=r,this.submitter=s,this.fetchRequest=new ln(this,u,f,y,r,T),this.mustRedirect=l}static confirmMethod(t){return Promise.resolve(confirm(t))}get method(){return this.fetchRequest.method}set method(t){this.fetchRequest.method=t}get action(){return this.fetchRequest.url.toString()}set action(t){this.fetchRequest.url=mi(t)}get body(){return this.fetchRequest.body}get enctype(){return this.fetchRequest.enctype}get isSafe(){return this.fetchRequest.isSafe}get location(){return this.fetchRequest.url}async start(){let{initialized:t,requesting:r}=ns,s=Al("data-turbo-confirm",this.submitter,this.formElement);if(!(typeof s=="string"&&!await(typeof hi.forms.confirm=="function"?hi.forms.confirm:i.confirmMethod)(s,this.formElement,this.submitter))&&this.state==t)return this.state=r,this.fetchRequest.perform()}stop(){let{stopping:t,stopped:r}=ns;if(this.state!=t&&this.state!=r)return this.state=t,this.fetchRequest.cancel(),!0}prepareRequest(t){if(!t.isSafe){let r=cw(xl("csrf-param"))||xl("csrf-token");r&&(t.headers["X-CSRF-Token"]=r)}this.requestAcceptsTurboStreamResponse(t)&&t.acceptResponseType(jr.contentType)}requestStarted(t){this.state=ns.waiting,this.submitter&&hi.forms.submitter.beforeSubmit(this.submitter),this.setSubmitsWith(),Sl(this.formElement),Ue("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(t,r){as.clear(),this.result={success:r.succeeded,fetchResponse:r}}requestSucceededWithResponse(t,r){if(r.clientError||r.serverError){this.delegate.formSubmissionFailedWithResponse(this,r);return}if(as.clear(),this.requestMustRedirect(t)&&uw(r)){let s=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,s)}else this.state=ns.receiving,this.result={success:!0,fetchResponse:r},this.delegate.formSubmissionSucceededWithResponse(this,r)}requestFailedWithResponse(t,r){this.result={success:!1,fetchResponse:r},this.delegate.formSubmissionFailedWithResponse(this,r)}requestErrored(t,r){this.result={success:!1,error:r},this.delegate.formSubmissionErrored(this,r)}requestFinished(t){this.state=ns.stopped,this.submitter&&hi.forms.submitter.afterSubmit(this.submitter),this.resetSubmitterText(),Tl(this.formElement),Ue("turbo:submit-end",{target:this.formElement,detail:ui({formSubmission:this},this.result)}),this.delegate.formSubmissionFinished(this)}setSubmitsWith(){if(!(!this.submitter||!this.submitsWith)){if(this.submitter.matches("button"))this.originalSubmitText=this.submitter.innerHTML,this.submitter.innerHTML=this.submitsWith;else if(this.submitter.matches("input")){let t=this.submitter;this.originalSubmitText=t.value,t.value=this.submitsWith}}}resetSubmitterText(){if(!(!this.submitter||!this.originalSubmitText)){if(this.submitter.matches("button"))this.submitter.innerHTML=this.originalSubmitText;else if(this.submitter.matches("input")){let t=this.submitter;t.value=this.originalSubmitText}}}requestMustRedirect(t){return!t.isSafe&&this.mustRedirect}requestAcceptsTurboStreamResponse(t){return!t.isSafe||zy("data-turbo-stream",this.submitter,this.formElement)}get submitsWith(){var t;return(t=this.submitter)==null?void 0:t.getAttribute("data-turbo-submits-with")}};function lw(i,t){let r=new FormData(i),s=t==null?void 0:t.getAttribute("name"),l=t==null?void 0:t.getAttribute("value");return s&&r.append(s,l||""),r}function cw(i){if(i!=null){let r=(document.cookie?document.cookie.split("; "):[]).find(s=>s.startsWith(i));if(r){let s=r.split("=").slice(1).join("=");return s?decodeURIComponent(s):void 0}}}function uw(i){return i.statusCode==200&&!i.redirected}function hw(i,t){let r=typeof i.action=="string"?i.action:null;return t!=null&&t.hasAttribute("formaction")?t.getAttribute("formaction")||"":i.getAttribute("action")||r||""}function dw(i,t){let r=mi(i);return Bl(t)&&(r.search=""),r}function fw(i,t){let r=(t==null?void 0:t.getAttribute("formmethod"))||i.getAttribute("method")||"";return Fl(r.toLowerCase())||$i.get}function pw(i,t){return Kp((t==null?void 0:t.getAttribute("formenctype"))||i.enctype)}var gs=class{constructor(t){this.element=t}get activeElement(){return this.element.ownerDocument.activeElement}get children(){return[...this.element.children]}hasAnchor(t){return this.getElementForAnchor(t)!=null}getElementForAnchor(t){return t?this.element.querySelector(`[id='${t}'], a[name='${t}']`):null}get isConnected(){return this.element.isConnected}get firstAutofocusableElement(){return Vp(this.element)}get permanentElements(){return em(this.element)}getPermanentElementById(t){return tm(this.element,t)}getPermanentElementMapForSnapshot(t){let r={};for(let s of this.permanentElements){let{id:l}=s,u=t.getPermanentElementById(l);u&&(r[l]=[s,u])}return r}};function tm(i,t){return i.querySelector(`#${t}[data-turbo-permanent]`)}function em(i){return i.querySelectorAll("[id][data-turbo-permanent]")}var vo=class{constructor(t,r){j(this,"started",!1);j(this,"submitCaptured",()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)});j(this,"submitBubbled",t=>{if(!t.defaultPrevented){let r=t.target instanceof HTMLFormElement?t.target:void 0,s=t.submitter||void 0;r&&mw(r,s)&&gw(r,s)&&this.delegate.willSubmitForm(r,s)&&(t.preventDefault(),t.stopImmediatePropagation(),this.delegate.formSubmitted(r,s))}});this.delegate=t,this.eventTarget=r}start(){this.started||(this.eventTarget.addEventListener("submit",this.submitCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("submit",this.submitCaptured,!0),this.started=!1)}};function mw(i,t){return((t==null?void 0:t.getAttribute("formmethod"))||i.getAttribute("method"))!="dialog"}function gw(i,t){let r=(t==null?void 0:t.getAttribute("formtarget"))||i.getAttribute("target");return $p(r)}var Ao,So,kl=class{constructor(t,r){we(this,Ao,t=>{});we(this,So,t=>{});this.delegate=t,this.element=r}scrollToAnchor(t){let r=this.snapshot.getElementForAnchor(t);r?(this.scrollToElement(r),this.focusElement(r)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(t){this.scrollToAnchor(_n(t))}scrollToElement(t){t.scrollIntoView()}focusElement(t){t instanceof HTMLElement&&(t.hasAttribute("tabindex")?t.focus():(t.setAttribute("tabindex","-1"),t.focus(),t.removeAttribute("tabindex")))}scrollToPosition({x:t,y:r}){this.scrollRoot.scrollTo(t,r)}scrollToTop(){this.scrollToPosition({x:0,y:0})}get scrollRoot(){return window}async render(t){let{isPreview:r,shouldRender:s,willRender:l,newSnapshot:u}=t,f=l;if(s)try{this.renderPromise=new Promise(H=>_e(this,Ao,H)),this.renderer=t,await this.prepareToRenderSnapshot(t);let y=new Promise(H=>_e(this,So,H)),T={resume:Zt(this,So),render:this.renderer.renderElement,renderMethod:this.renderer.renderMethod};this.delegate.allowsImmediateRender(u,T)||await y,await this.renderSnapshot(t),this.delegate.viewRenderedSnapshot(u,r,this.renderer.renderMethod),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(t)}finally{delete this.renderer,Zt(this,Ao).call(this,void 0),delete this.renderPromise}else f&&this.invalidate(t.reloadReason)}invalidate(t){this.delegate.viewInvalidated(t)}async prepareToRenderSnapshot(t){this.markAsPreview(t.isPreview),await t.prepareToRender()}markAsPreview(t){t?this.element.setAttribute("data-turbo-preview",""):this.element.removeAttribute("data-turbo-preview")}markVisitDirection(t){this.element.setAttribute("data-turbo-visit-direction",t)}unmarkVisitDirection(){this.element.removeAttribute("data-turbo-visit-direction")}async renderSnapshot(t){await t.render()}finishRenderingSnapshot(t){t.finishRendering()}};Ao=new WeakMap,So=new WeakMap;var Bu=class extends kl{missing(){this.element.innerHTML='Content missing'}get snapshot(){return new gs(this.element)}},Ll=class{constructor(t,r){j(this,"clickBubbled",t=>{this.clickEventIsSignificant(t)?this.clickEvent=t:delete this.clickEvent});j(this,"linkClicked",t=>{this.clickEvent&&this.clickEventIsSignificant(t)&&this.delegate.shouldInterceptLinkClick(t.target,t.detail.url,t.detail.originalEvent)&&(this.clickEvent.preventDefault(),t.preventDefault(),this.delegate.linkClickIntercepted(t.target,t.detail.url,t.detail.originalEvent)),delete this.clickEvent});j(this,"willVisit",t=>{delete this.clickEvent});this.delegate=t,this.element=r}start(){this.element.addEventListener("click",this.clickBubbled),document.addEventListener("turbo:click",this.linkClicked),document.addEventListener("turbo:before-visit",this.willVisit)}stop(){this.element.removeEventListener("click",this.clickBubbled),document.removeEventListener("turbo:click",this.linkClicked),document.removeEventListener("turbo:before-visit",this.willVisit)}clickEventIsSignificant(t){var l;let r=t.composed?(l=t.target)==null?void 0:l.parentElement:t.target,s=Xp(r)||r;return s instanceof Element&&s.closest("turbo-frame, html")==this.element}},_l=class{constructor(t,r){j(this,"started",!1);j(this,"clickCaptured",()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)});j(this,"clickBubbled",t=>{if(t instanceof MouseEvent&&this.clickEventIsSignificant(t)){let r=t.composedPath&&t.composedPath()[0]||t.target,s=Xp(r);if(s&&$p(s.target)){let l=Yp(s);this.delegate.willFollowLinkToLocation(s,l,t)&&(t.preventDefault(),this.delegate.followedLinkToLocation(s,l))}}});this.delegate=t,this.eventTarget=r}start(){this.started||(this.eventTarget.addEventListener("click",this.clickCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("click",this.clickCaptured,!0),this.started=!1)}clickEventIsSignificant(t){return!(t.target&&t.target.isContentEditable||t.defaultPrevented||t.which>1||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)}},Dl=class{constructor(t,r){this.delegate=t,this.linkInterceptor=new _l(this,r)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}canPrefetchRequestToLocation(t,r){return!1}prefetchAndCacheRequestToLocation(t,r){}willFollowLinkToLocation(t,r,s){return this.delegate.willSubmitFormLinkToLocation(t,r,s)&&(t.hasAttribute("data-turbo-method")||t.hasAttribute("data-turbo-stream"))}followedLinkToLocation(t,r){let s=document.createElement("form"),l="hidden";for(let[Z,X]of r.searchParams)s.append(Object.assign(document.createElement("input"),{type:l,name:Z,value:X}));let u=Object.assign(r,{search:""});s.setAttribute("data-turbo","true"),s.setAttribute("action",u.href),s.setAttribute("hidden","");let f=t.getAttribute("data-turbo-method");f&&s.setAttribute("method",f);let y=t.getAttribute("data-turbo-frame");y&&s.setAttribute("data-turbo-frame",y);let T=Ln(t);T&&s.setAttribute("data-turbo-action",T);let D=t.getAttribute("data-turbo-confirm");D&&s.setAttribute("data-turbo-confirm",D),t.hasAttribute("data-turbo-stream")&&s.setAttribute("data-turbo-stream",""),this.delegate.submittedFormLinkToLocation(t,r,s),document.body.appendChild(s),s.addEventListener("turbo:submit-end",()=>s.remove(),{once:!0}),requestAnimationFrame(()=>s.requestSubmit())}},Rl=class{static async preservingPermanentElements(t,r,s){let l=new this(t,r);l.enter(),await s(),l.leave()}constructor(t,r){this.delegate=t,this.permanentElementMap=r}enter(){for(let t in this.permanentElementMap){let[r,s]=this.permanentElementMap[t];this.delegate.enteringBardo(r,s),this.replaceNewPermanentElementWithPlaceholder(s)}}leave(){for(let t in this.permanentElementMap){let[r]=this.permanentElementMap[t];this.replaceCurrentPermanentElementWithClone(r),this.replacePlaceholderWithPermanentElement(r),this.delegate.leavingBardo(r)}}replaceNewPermanentElementWithPlaceholder(t){let r=bw(t);t.replaceWith(r)}replaceCurrentPermanentElementWithClone(t){let r=t.cloneNode(!0);t.replaceWith(r)}replacePlaceholderWithPermanentElement(t){let r=this.getPlaceholderById(t.id);r==null||r.replaceWith(t)}getPlaceholderById(t){return this.placeholders.find(r=>r.content==t)}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}};function bw(i){let t=document.createElement("meta");return t.setAttribute("name","turbo-permanent-placeholder"),t.setAttribute("content",i.id),t}var Br,yo=class{constructor(t,r,s,l=!0){we(this,Br,null);this.currentSnapshot=t,this.newSnapshot=r,this.isPreview=s,this.willRender=l,this.renderElement=this.constructor.renderElement,this.promise=new Promise((u,f)=>this.resolvingFunctions={resolve:u,reject:f})}static renderElement(t,r){}get shouldRender(){return!0}get shouldAutofocus(){return!0}get reloadReason(){}prepareToRender(){}render(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(t){await Rl.preservingPermanentElements(this,this.permanentElementMap,t)}focusFirstAutofocusableElement(){if(this.shouldAutofocus){let t=this.connectedSnapshot.firstAutofocusableElement;t&&t.focus()}}enteringBardo(t){Zt(this,Br)||t.contains(this.currentSnapshot.activeElement)&&_e(this,Br,this.currentSnapshot.activeElement)}leavingBardo(t){t.contains(Zt(this,Br))&&Zt(this,Br)instanceof HTMLElement&&(Zt(this,Br).focus(),_e(this,Br,null))}get connectedSnapshot(){return this.newSnapshot.isConnected?this.newSnapshot:this.currentSnapshot}get currentElement(){return this.currentSnapshot.element}get newElement(){return this.newSnapshot.element}get permanentElementMap(){return this.currentSnapshot.getPermanentElementMapForSnapshot(this.newSnapshot)}get renderMethod(){return"replace"}};Br=new WeakMap;var bs=class extends yo{static renderElement(t,r){var f;let s=document.createRange();s.selectNodeContents(t),s.deleteContents();let l=r,u=(f=l.ownerDocument)==null?void 0:f.createRange();u&&(u.selectNodeContents(l),t.appendChild(u.extractContents()))}constructor(t,r,s,l,u,f=!0){super(r,s,l,u,f),this.delegate=t}get shouldRender(){return!0}async render(){await go(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await go(),this.focusFirstAutofocusableElement(),await go(),this.activateScriptElements()}loadFrameElement(){this.delegate.willRenderFrame(this.currentElement,this.newElement),this.renderElement(this.currentElement,this.newElement)}scrollFrameIntoView(){if(this.currentElement.autoscroll||this.newElement.autoscroll){let t=this.currentElement.firstElementChild,r=vw(this.currentElement.getAttribute("data-autoscroll-block"),"end"),s=yw(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(t)return t.scrollIntoView({block:r,behavior:s}),!0}return!1}activateScriptElements(){for(let t of this.newScriptElements){let r=bo(t);t.replaceWith(r)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}};function vw(i,t){return i=="end"||i=="start"||i=="center"||i=="nearest"?i:t}function yw(i,t){return i=="auto"||i=="smooth"?i:t}var ww=function(){let i=()=>{},t={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:i,afterNodeAdded:i,beforeNodeMorphed:i,afterNodeMorphed:i,beforeNodeRemoved:i,afterNodeRemoved:i,beforeAttributeUpdated:i},head:{style:"merge",shouldPreserve:X=>X.getAttribute("im-preserve")==="true",shouldReAppend:X=>X.getAttribute("im-re-append")==="true",shouldRemove:i,afterHeadMorphed:i},restoreFocus:!0};function r(X,J,$={}){X=H(X);let st=Z(J),ft=D(X,st,$),Q=l(ft,()=>y(ft,X,st,R=>R.morphStyle==="innerHTML"?(u(R,X,st),Array.from(X.childNodes)):s(R,X,st)));return ft.pantry.remove(),Q}function s(X,J,$){let st=Z(J),ft=Array.from(st.childNodes),Q=ft.indexOf(J),R=ft.length-(Q+1);return u(X,st,$,J,J.nextSibling),ft=Array.from(st.childNodes),ft.slice(Q,ft.length-R)}function l(X,J){var I;if(!X.config.restoreFocus)return J();let $=document.activeElement;if(!($ instanceof HTMLInputElement||$ instanceof HTMLTextAreaElement))return J();let{id:st,selectionStart:ft,selectionEnd:Q}=$,R=J();return st&&st!==((I=document.activeElement)==null?void 0:I.id)&&($=X.target.querySelector(`#${st}`),$==null||$.focus()),$&&!$.selectionEnd&&Q&&$.setSelectionRange(ft,Q),R}let u=function(){function X(V,K,gt,dt=null,Et=null){K instanceof HTMLTemplateElement&> instanceof HTMLTemplateElement&&(K=K.content,gt=gt.content),dt||(dt=K.firstChild);for(let Ot of gt.childNodes){if(dt&&dt!=Et){let At=$(V,Ot,dt,Et);if(At){At!==dt&&ft(V,dt,At),f(At,Ot,V),dt=At.nextSibling;continue}}if(Ot instanceof Element&&V.persistentIds.has(Ot.id)){let At=Q(K,Ot.id,dt,V);f(At,Ot,V),dt=At.nextSibling;continue}let Qt=J(K,Ot,dt,V);Qt&&(dt=Qt.nextSibling)}for(;dt&&dt!=Et;){let Ot=dt;dt=dt.nextSibling,st(V,Ot)}}function J(V,K,gt,dt){if(dt.callbacks.beforeNodeAdded(K)===!1)return null;if(dt.idMap.has(K)){let Et=document.createElement(K.tagName);return V.insertBefore(Et,gt),f(Et,K,dt),dt.callbacks.afterNodeAdded(Et),Et}else{let Et=document.importNode(K,!0);return V.insertBefore(Et,gt),dt.callbacks.afterNodeAdded(Et),Et}}let $=function(){function V(dt,Et,Ot,Qt){let At=null,Te=Et.nextSibling,xe=0,G=Ot;for(;G&&G!=Qt;){if(gt(G,Et)){if(K(dt,G,Et))return G;At===null&&(dt.idMap.has(G)||(At=G))}if(At===null&&Te&>(G,Te)&&(xe++,Te=Te.nextSibling,xe>=2&&(At=void 0)),G.contains(document.activeElement))break;G=G.nextSibling}return At||null}function K(dt,Et,Ot){let Qt=dt.idMap.get(Et),At=dt.idMap.get(Ot);if(!At||!Qt)return!1;for(let Te of Qt)if(At.has(Te))return!0;return!1}function gt(dt,Et){let Ot=dt,Qt=Et;return Ot.nodeType===Qt.nodeType&&Ot.tagName===Qt.tagName&&(!Ot.id||Ot.id===Qt.id)}return V}();function st(V,K){var gt;if(V.idMap.has(K))I(V.pantry,K,null);else{if(V.callbacks.beforeNodeRemoved(K)===!1)return;(gt=K.parentNode)==null||gt.removeChild(K),V.callbacks.afterNodeRemoved(K)}}function ft(V,K,gt){let dt=K;for(;dt&&dt!==gt;){let Et=dt;dt=dt.nextSibling,st(V,Et)}return dt}function Q(V,K,gt,dt){let Et=dt.target.querySelector(`#${K}`)||dt.pantry.querySelector(`#${K}`);return R(Et,dt),I(V,Et,gt),Et}function R(V,K){let gt=V.id;for(;V=V.parentNode;){let dt=K.idMap.get(V);dt&&(dt.delete(gt),dt.size||K.idMap.delete(V))}}function I(V,K,gt){if(V.moveBefore)try{V.moveBefore(K,gt)}catch(dt){V.insertBefore(K,gt)}else V.insertBefore(K,gt)}return X}(),f=function(){function X(R,I,V){return V.ignoreActive&&R===document.activeElement?null:(V.callbacks.beforeNodeMorphed(R,I)===!1||(R instanceof HTMLHeadElement&&V.head.ignore||(R instanceof HTMLHeadElement&&V.head.style!=="morph"?T(R,I,V):(J(R,I,V),Q(R,V)||u(V,R,I))),V.callbacks.afterNodeMorphed(R,I)),R)}function J(R,I,V){let K=I.nodeType;if(K===1){let gt=R,dt=I,Et=gt.attributes,Ot=dt.attributes;for(let Qt of Ot)ft(Qt.name,gt,"update",V)||gt.getAttribute(Qt.name)!==Qt.value&>.setAttribute(Qt.name,Qt.value);for(let Qt=Et.length-1;0<=Qt;Qt--){let At=Et[Qt];if(At&&!dt.hasAttribute(At.name)){if(ft(At.name,gt,"remove",V))continue;gt.removeAttribute(At.name)}}Q(gt,V)||$(gt,dt,V)}(K===8||K===3)&&R.nodeValue!==I.nodeValue&&(R.nodeValue=I.nodeValue)}function $(R,I,V){if(R instanceof HTMLInputElement&&I instanceof HTMLInputElement&&I.type!=="file"){let K=I.value,gt=R.value;st(R,I,"checked",V),st(R,I,"disabled",V),I.hasAttribute("value")?gt!==K&&(ft("value",R,"update",V)||(R.setAttribute("value",K),R.value=K)):ft("value",R,"remove",V)||(R.value="",R.removeAttribute("value"))}else if(R instanceof HTMLOptionElement&&I instanceof HTMLOptionElement)st(R,I,"selected",V);else if(R instanceof HTMLTextAreaElement&&I instanceof HTMLTextAreaElement){let K=I.value,gt=R.value;if(ft("value",R,"update",V))return;K!==gt&&(R.value=K),R.firstChild&&R.firstChild.nodeValue!==K&&(R.firstChild.nodeValue=K)}}function st(R,I,V,K){let gt=I[V],dt=R[V];if(gt!==dt){let Et=ft(V,R,"update",K);Et||(R[V]=I[V]),gt?Et||R.setAttribute(V,""):ft(V,R,"remove",K)||R.removeAttribute(V)}}function ft(R,I,V,K){return R==="value"&&K.ignoreActiveValue&&I===document.activeElement?!0:K.callbacks.beforeAttributeUpdated(R,I,V)===!1}function Q(R,I){return!!I.ignoreActiveValue&&R===document.activeElement&&R!==document.body}return X}();function y(X,J,$,st){if(X.head.block){let ft=J.querySelector("head"),Q=$.querySelector("head");if(ft&&Q){let R=T(ft,Q,X);return Promise.all(R).then(()=>{let I=Object.assign(X,{head:{block:!1,ignore:!0}});return st(I)})}}return st(X)}function T(X,J,$){let st=[],ft=[],Q=[],R=[],I=new Map;for(let K of J.children)I.set(K.outerHTML,K);for(let K of X.children){let gt=I.has(K.outerHTML),dt=$.head.shouldReAppend(K),Et=$.head.shouldPreserve(K);gt||Et?dt?ft.push(K):(I.delete(K.outerHTML),Q.push(K)):$.head.style==="append"?dt&&(ft.push(K),R.push(K)):$.head.shouldRemove(K)!==!1&&ft.push(K)}R.push(...I.values());let V=[];for(let K of R){let gt=document.createRange().createContextualFragment(K.outerHTML).firstChild;if($.callbacks.beforeNodeAdded(gt)!==!1){if("href"in gt&>.href||"src"in gt&>.src){let dt,Et=new Promise(function(Ot){dt=Ot});gt.addEventListener("load",function(){dt()}),V.push(Et)}X.appendChild(gt),$.callbacks.afterNodeAdded(gt),st.push(gt)}}for(let K of ft)$.callbacks.beforeNodeRemoved(K)!==!1&&(X.removeChild(K),$.callbacks.afterNodeRemoved(K));return $.head.afterHeadMorphed(X,{added:st,kept:Q,removed:ft}),V}let D=function(){function X(I,V,K){let{persistentIds:gt,idMap:dt}=Q(I,V),Et=J(K),Ot=Et.morphStyle||"outerHTML";if(!["innerHTML","outerHTML"].includes(Ot))throw`Do not understand how to morph style ${Ot}`;return{target:I,newContent:V,config:Et,morphStyle:Ot,ignoreActive:Et.ignoreActive,ignoreActiveValue:Et.ignoreActiveValue,restoreFocus:Et.restoreFocus,idMap:dt,persistentIds:gt,pantry:$(),callbacks:Et.callbacks,head:Et.head}}function J(I){let V=Object.assign({},t);return Object.assign(V,I),V.callbacks=Object.assign({},t.callbacks,I.callbacks),V.head=Object.assign({},t.head,I.head),V}function $(){let I=document.createElement("div");return I.hidden=!0,document.body.insertAdjacentElement("afterend",I),I}function st(I){let V=Array.from(I.querySelectorAll("[id]"));return I.id&&V.push(I),V}function ft(I,V,K,gt){for(let dt of gt)if(V.has(dt.id)){let Et=dt;for(;Et;){let Ot=I.get(Et);if(Ot==null&&(Ot=new Set,I.set(Et,Ot)),Ot.add(dt.id),Et===K)break;Et=Et.parentElement}}}function Q(I,V){let K=st(I),gt=st(V),dt=R(K,gt),Et=new Map;ft(Et,dt,I,K);let Ot=V.__idiomorphRoot||V;return ft(Et,dt,Ot,gt),{persistentIds:dt,idMap:Et}}function R(I,V){let K=new Set,gt=new Map;for(let{id:Et,tagName:Ot}of I)gt.has(Et)?K.add(Et):gt.set(Et,Ot);let dt=new Set;for(let{id:Et,tagName:Ot}of V)dt.has(Et)?K.add(Et):gt.get(Et)===Ot&&dt.add(Et);for(let Et of K)dt.delete(Et);return dt}return X}(),{normalizeElement:H,normalizeParent:Z}=function(){let X=new WeakSet;function J(Q){return Q instanceof Document?Q.documentElement:Q}function $(Q){if(Q==null)return document.createElement("div");if(typeof Q=="string")return $(ft(Q));if(X.has(Q))return Q;if(Q instanceof Node){if(Q.parentNode)return st(Q);{let R=document.createElement("div");return R.append(Q),R}}else{let R=document.createElement("div");for(let I of[...Q])R.append(I);return R}}function st(Q){return{childNodes:[Q],querySelectorAll:R=>{let I=Q.querySelectorAll(R);return Q.matches(R)?[Q,...I]:I},insertBefore:(R,I)=>Q.parentNode.insertBefore(R,I),moveBefore:(R,I)=>Q.parentNode.moveBefore(R,I),get __idiomorphRoot(){return Q}}}function ft(Q){let R=new DOMParser,I=Q.replace(/]*>|>)([\s\S]*?)<\/svg>/gim,"");if(I.match(/<\/html>/)||I.match(/<\/head>/)||I.match(/<\/body>/)){let V=R.parseFromString(Q,"text/html");if(I.match(/<\/html>/))return X.add(V),V;{let K=V.firstChild;return K&&X.add(K),K}}else{let K=R.parseFromString("","text/html").body.querySelector("template").content;return X.add(K),K}}return{normalizeElement:J,normalizeParent:$}}();return{morph:r,defaults:t}}();function mh(i,t,l={}){var u=l,{callbacks:r}=u,s=Dp(u,["callbacks"]);ww.morph(i,t,rs(ui({},s),{callbacks:new ju(r)}))}function im(i,t){mh(i,t.childNodes,{morphStyle:"innerHTML"})}var To,ju=class{constructor({beforeNodeMorphed:t}={}){we(this,To);j(this,"beforeNodeAdded",t=>!(t.id&&t.hasAttribute("data-turbo-permanent")&&document.getElementById(t.id)));j(this,"beforeNodeMorphed",(t,r)=>{if(t instanceof Element)return!t.hasAttribute("data-turbo-permanent")&&Zt(this,To).call(this,t,r)?!Ue("turbo:before-morph-element",{cancelable:!0,target:t,detail:{currentElement:t,newElement:r}}).defaultPrevented:!1});j(this,"beforeAttributeUpdated",(t,r,s)=>!Ue("turbo:before-morph-attribute",{cancelable:!0,target:r,detail:{attributeName:t,mutationType:s}}).defaultPrevented);j(this,"beforeNodeRemoved",t=>this.beforeNodeMorphed(t));j(this,"afterNodeMorphed",(t,r)=>{t instanceof Element&&Ue("turbo:morph-element",{target:t,detail:{currentElement:t,newElement:r}})});_e(this,To,t||(()=>!0))}};To=new WeakMap;var Hu=class extends bs{static renderElement(t,r){Ue("turbo:before-frame-morph",{target:t,detail:{currentElement:t,newElement:r}}),im(t,r)}async preservingPermanentElements(t){return await t()}},Nr=class Nr{constructor(){j(this,"hiding",!1);j(this,"value",0);j(this,"visible",!1);j(this,"trickle",()=>{this.setValue(this.value+Math.random()/100)});this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement(),this.installStylesheetElement(),this.setValue(0)}static get defaultCSS(){return zp` .turbo-progress-bar { position: fixed; display: block; top: 0; left: 0; height: 3px; background: #0076ff; z-index: 2147483647; transition: width ${Nr.animationDuration}ms ease-out, opacity ${Nr.animationDuration/2}ms ${Nr.animationDuration/2}ms ease-in; transform: translate3d(0, 0, 0); } `}show(){this.visible||(this.visible=!0,this.installProgressElement(),this.startTrickling())}hide(){this.visible&&!this.hiding&&(this.hiding=!0,this.fadeProgressElement(()=>{this.uninstallProgressElement(),this.stopTrickling(),this.visible=!1,this.hiding=!1}))}setValue(t){this.value=t,this.refresh()}installStylesheetElement(){document.head.insertBefore(this.stylesheetElement,document.head.firstChild)}installProgressElement(){this.progressElement.style.width="0",this.progressElement.style.opacity="1",document.documentElement.insertBefore(this.progressElement,document.body),this.refresh()}fadeProgressElement(t){this.progressElement.style.opacity="0",setTimeout(t,Nr.animationDuration*1.5)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,Nr.animationDuration))}stopTrickling(){window.clearInterval(this.trickleInterval),delete this.trickleInterval}refresh(){requestAnimationFrame(()=>{this.progressElement.style.width=`${10+this.value*90}%`})}createStylesheetElement(){let t=document.createElement("style");t.type="text/css",t.textContent=Nr.defaultCSS;let r=Up();return r&&(t.nonce=r),t}createProgressElement(){let t=document.createElement("div");return t.className="turbo-progress-bar",t}};j(Nr,"animationDuration",300);var qu=Nr,zu=class extends gs{constructor(){super(...arguments);j(this,"detailsByOuterHTML",this.children.filter(r=>!Tw(r)).map(r=>kw(r)).reduce((r,s)=>{let{outerHTML:l}=s,u=l in r?r[l]:{type:Ew(s),tracked:Aw(s),elements:[]};return rs(ui({},r),{[l]:rs(ui({},u),{elements:[...u.elements,s]})})},{}))}get trackedElementSignature(){return Object.keys(this.detailsByOuterHTML).filter(r=>this.detailsByOuterHTML[r].tracked).join("")}getScriptElementsNotInSnapshot(r){return this.getElementsMatchingTypeNotInSnapshot("script",r)}getStylesheetElementsNotInSnapshot(r){return this.getElementsMatchingTypeNotInSnapshot("stylesheet",r)}getElementsMatchingTypeNotInSnapshot(r,s){return Object.keys(this.detailsByOuterHTML).filter(l=>!(l in s.detailsByOuterHTML)).map(l=>this.detailsByOuterHTML[l]).filter(({type:l})=>l==r).map(({elements:[l]})=>l)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((r,s)=>{let{type:l,tracked:u,elements:f}=this.detailsByOuterHTML[s];return l==null&&!u?[...r,...f]:f.length>1?[...r,...f.slice(1)]:r},[])}getMetaValue(r){let s=this.findMetaElementByName(r);return s?s.getAttribute("content"):null}findMetaElementByName(r){return Object.keys(this.detailsByOuterHTML).reduce((s,l)=>{let{elements:[u]}=this.detailsByOuterHTML[l];return Cw(u,r)?u:s},void 0|void 0)}};function Ew(i){if(Sw(i))return"script";if(xw(i))return"stylesheet"}function Aw(i){return i.getAttribute("data-turbo-track")=="reload"}function Sw(i){return i.localName=="script"}function Tw(i){return i.localName=="noscript"}function xw(i){let t=i.localName;return t=="style"||t=="link"&&i.getAttribute("rel")=="stylesheet"}function Cw(i,t){return i.localName=="meta"&&i.getAttribute("name")==t}function kw(i){return i.hasAttribute("nonce")&&i.setAttribute("nonce",""),i}var Ji=class i extends gs{static fromHTMLString(t=""){return this.fromDocument(qp(t))}static fromElement(t){return this.fromDocument(t.ownerDocument)}static fromDocument({documentElement:t,body:r,head:s}){return new this(t,r,new zu(s))}constructor(t,r,s){super(r),this.documentElement=t,this.headSnapshot=s}clone(){let t=this.element.cloneNode(!0),r=this.element.querySelectorAll("select"),s=t.querySelectorAll("select");for(let[l,u]of r.entries()){let f=s[l];for(let y of f.selectedOptions)y.selected=!1;for(let y of u.selectedOptions)f.options[y.index].selected=!0}for(let l of t.querySelectorAll('input[type="password"]'))l.value="";return new i(this.documentElement,t,this.headSnapshot)}get lang(){return this.documentElement.getAttribute("lang")}get headElement(){return this.headSnapshot.element}get rootLocation(){var r;let t=(r=this.getSetting("root"))!=null?r:"/";return mi(t)}get cacheControlValue(){return this.getSetting("cache-control")}get isPreviewable(){return this.cacheControlValue!="no-preview"}get isCacheable(){return this.cacheControlValue!="no-cache"}get isVisitable(){return this.getSetting("visit-control")!="reload"}get prefersViewTransitions(){return this.headSnapshot.getMetaValue("view-transition")==="same-origin"}get shouldMorphPage(){return this.getSetting("refresh-method")==="morph"}get shouldPreserveScrollPosition(){return this.getSetting("refresh-scroll")==="preserve"}getSetting(t){return this.headSnapshot.getMetaValue(`turbo-${t}`)}},xo,nn,Wu=class{constructor(){we(this,xo,!1);we(this,nn,Promise.resolve())}renderChange(t,r){return t&&this.viewTransitionsAvailable&&!Zt(this,xo)?(_e(this,xo,!0),_e(this,nn,Zt(this,nn).then(async()=>{await document.startViewTransition(r).finished}))):_e(this,nn,Zt(this,nn).then(r)),Zt(this,nn)}get viewTransitionsAvailable(){return document.startViewTransition}};xo=new WeakMap,nn=new WeakMap;var Lw={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1},bl={visitStart:"visitStart",requestStart:"requestStart",requestEnd:"requestEnd",visitEnd:"visitEnd"},Ir={initialized:"initialized",started:"started",canceled:"canceled",failed:"failed",completed:"completed"},cs={networkFailure:0,timeoutFailure:-1,contentTypeMismatch:-2},_w={advance:"forward",restore:"back",replace:"none"},Uu=class{constructor(t,r,s,l={}){j(this,"identifier",an());j(this,"timingMetrics",{});j(this,"followedRedirect",!1);j(this,"historyChanged",!1);j(this,"scrolled",!1);j(this,"shouldCacheSnapshot",!0);j(this,"acceptsStreamResponse",!1);j(this,"snapshotCached",!1);j(this,"state",Ir.initialized);j(this,"viewTransitioner",new Wu);this.delegate=t,this.location=r,this.restorationIdentifier=s||an();let{action:u,historyChanged:f,referrer:y,snapshot:T,snapshotHTML:D,response:H,visitCachedSnapshot:Z,willRender:X,updateHistory:J,shouldCacheSnapshot:$,acceptsStreamResponse:st,direction:ft}=ui(ui({},Lw),l);this.action=u,this.historyChanged=f,this.referrer=y,this.snapshot=T,this.snapshotHTML=D,this.response=H,this.isSamePage=this.delegate.locationWithActionIsSamePage(this.location,this.action),this.isPageRefresh=this.view.isPageRefresh(this),this.visitCachedSnapshot=Z,this.willRender=X,this.updateHistory=J,this.scrolled=!X,this.shouldCacheSnapshot=$,this.acceptsStreamResponse=st,this.direction=ft||_w[u]}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get history(){return this.delegate.history}get restorationData(){return this.history.getRestorationDataForIdentifier(this.restorationIdentifier)}get silent(){return this.isSamePage}start(){this.state==Ir.initialized&&(this.recordTimingMetric(bl.visitStart),this.state=Ir.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==Ir.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=Ir.canceled)}complete(){this.state==Ir.started&&(this.recordTimingMetric(bl.visitEnd),this.adapter.visitCompleted(this),this.state=Ir.completed,this.followRedirect(),this.followedRedirect||this.delegate.visitCompleted(this))}fail(){this.state==Ir.started&&(this.state=Ir.failed,this.adapter.visitFailed(this),this.delegate.visitCompleted(this))}changeHistory(){var t;if(!this.historyChanged&&this.updateHistory){let r=this.location.href===((t=this.referrer)==null?void 0:t.href)?"replace":this.action,s=Wp(r);this.history.update(s,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new ln(this,$i.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric(bl.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(t=this.response){if(this.response=t,t){let{statusCode:r}=t;Op(r)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,r)}}finishRequest(){this.recordTimingMetric(bl.requestEnd),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){let{statusCode:t,responseHTML:r}=this.response;this.render(async()=>{if(this.shouldCacheSnapshot&&this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,Op(t)&&r!=null){let s=Ji.fromHTMLString(r);await this.renderPageSnapshot(s,!1),this.adapter.visitRendered(this),this.complete()}else await this.view.renderError(Ji.fromHTMLString(r),this),this.adapter.visitRendered(this),this.fail()})}}getCachedSnapshot(){let t=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(t&&(!_n(this.location)||t.hasAnchor(_n(this.location)))&&(this.action=="restore"||t.isPreviewable))return t}getPreloadedSnapshot(){if(this.snapshotHTML)return Ji.fromHTMLString(this.snapshotHTML)}hasCachedSnapshot(){return this.getCachedSnapshot()!=null}loadCachedSnapshot(){let t=this.getCachedSnapshot();if(t){let r=this.shouldIssueRequest();this.render(async()=>{this.cacheSnapshot(),this.isSamePage||this.isPageRefresh?this.adapter.visitRendered(this):(this.view.renderPromise&&await this.view.renderPromise,await this.renderPageSnapshot(t,r),this.adapter.visitRendered(this),r||this.complete())})}}followRedirect(){var t;this.redirectedToLocation&&!this.followedRedirect&&((t=this.response)!=null&&t.redirected)&&(this.adapter.visitProposedToLocation(this.redirectedToLocation,{action:"replace",response:this.response,shouldCacheSnapshot:!1,willRender:!1}),this.followedRedirect=!0)}goToSamePageAnchor(){this.isSamePage&&this.render(async()=>{this.cacheSnapshot(),this.performScroll(),this.changeHistory(),this.adapter.visitRendered(this)})}prepareRequest(t){this.acceptsStreamResponse&&t.acceptResponseType(jr.contentType)}requestStarted(){this.startRequest()}requestPreventedHandlingResponse(t,r){}async requestSucceededWithResponse(t,r){let s=await r.responseHTML,{redirected:l,statusCode:u}=r;s==null?this.recordResponse({statusCode:cs.contentTypeMismatch,redirected:l}):(this.redirectedToLocation=r.redirected?r.location:void 0,this.recordResponse({statusCode:u,responseHTML:s,redirected:l}))}async requestFailedWithResponse(t,r){let s=await r.responseHTML,{redirected:l,statusCode:u}=r;s==null?this.recordResponse({statusCode:cs.contentTypeMismatch,redirected:l}):this.recordResponse({statusCode:u,responseHTML:s,redirected:l})}requestErrored(t,r){this.recordResponse({statusCode:cs.networkFailure,redirected:!1})}requestFinished(){this.finishRequest()}performScroll(){!this.scrolled&&!this.view.forceReloaded&&!this.view.shouldPreserveScrollPosition(this)&&(this.action=="restore"?this.scrollToRestoredPosition()||this.scrollToAnchor()||this.view.scrollToTop():this.scrollToAnchor()||this.view.scrollToTop(),this.isSamePage&&this.delegate.visitScrolledToSamePageLocation(this.view.lastRenderedLocation,this.location),this.scrolled=!0)}scrollToRestoredPosition(){let{scrollPosition:t}=this.restorationData;if(t)return this.view.scrollToPosition(t),!0}scrollToAnchor(){let t=_n(this.location);if(t!=null)return this.view.scrollToAnchor(t),!0}recordTimingMetric(t){this.timingMetrics[t]=new Date().getTime()}getTimingMetrics(){return ui({},this.timingMetrics)}hasPreloadedResponse(){return typeof this.response=="object"}shouldIssueRequest(){return this.isSamePage?!1:this.action=="restore"?!this.hasCachedSnapshot():this.willRender}cacheSnapshot(){this.snapshotCached||(this.view.cacheSnapshot(this.snapshot).then(t=>t&&this.visitCachedSnapshot(t)),this.snapshotCached=!0)}async render(t){this.cancelRender(),await new Promise(r=>{this.frame=document.visibilityState==="hidden"?setTimeout(()=>r(),0):requestAnimationFrame(()=>r())}),await t(),delete this.frame}async renderPageSnapshot(t,r){await this.viewTransitioner.renderChange(this.view.shouldTransitionTo(t),async()=>{await this.view.renderPage(t,r,this.willRender,this),this.performScroll()})}cancelRender(){this.frame&&(cancelAnimationFrame(this.frame),delete this.frame)}};function Op(i){return i>=200&&i<300}var Vu=class{constructor(t){j(this,"progressBar",new qu);j(this,"showProgressBar",()=>{this.progressBar.show()});this.session=t}visitProposedToLocation(t,r){en(t,this.navigator.rootLocation)?this.navigator.startVisit(t,(r==null?void 0:r.restorationIdentifier)||an(),r):window.location.href=t.toString()}visitStarted(t){this.location=t.location,t.loadCachedSnapshot(),t.issueRequest(),t.goToSamePageAnchor()}visitRequestStarted(t){this.progressBar.setValue(0),t.hasCachedSnapshot()||t.action!="restore"?this.showVisitProgressBarAfterDelay():this.showProgressBar()}visitRequestCompleted(t){t.loadResponse()}visitRequestFailedWithStatusCode(t,r){switch(r){case cs.networkFailure:case cs.timeoutFailure:case cs.contentTypeMismatch:return this.reload({reason:"request_failed",context:{statusCode:r}});default:return t.loadResponse()}}visitRequestFinished(t){}visitCompleted(t){this.progressBar.setValue(1),this.hideVisitProgressBar()}pageInvalidated(t){this.reload(t)}visitFailed(t){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitRendered(t){}linkPrefetchingIsEnabledForLocation(t){return!0}formSubmissionStarted(t){this.progressBar.setValue(0),this.showFormProgressBarAfterDelay()}formSubmissionFinished(t){this.progressBar.setValue(1),this.hideFormProgressBar()}showVisitProgressBarAfterDelay(){this.visitProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay)}hideVisitProgressBar(){this.progressBar.hide(),this.visitProgressBarTimeout!=null&&(window.clearTimeout(this.visitProgressBarTimeout),delete this.visitProgressBarTimeout)}showFormProgressBarAfterDelay(){this.formProgressBarTimeout==null&&(this.formProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay))}hideFormProgressBar(){this.progressBar.hide(),this.formProgressBarTimeout!=null&&(window.clearTimeout(this.formProgressBarTimeout),delete this.formProgressBarTimeout)}reload(t){var r;Ue("turbo:reload",{detail:t}),window.location.href=((r=this.location)==null?void 0:r.toString())||window.location.href}get navigator(){return this.session.navigator}},$u=class{constructor(){j(this,"selector","[data-turbo-temporary]");j(this,"deprecatedSelector","[data-turbo-cache=false]");j(this,"started",!1);j(this,"removeTemporaryElements",t=>{for(let r of this.temporaryElements)r.remove()})}start(){this.started||(this.started=!0,addEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}get temporaryElements(){return[...document.querySelectorAll(this.selector),...this.temporaryElementsWithDeprecation]}get temporaryElementsWithDeprecation(){let t=document.querySelectorAll(this.deprecatedSelector);return t.length&&console.warn(`The ${this.deprecatedSelector} selector is deprecated and will be removed in a future version. Use ${this.selector} instead.`),[...t]}},Zi,rm,vl,yl,Xu=class{constructor(t,r){we(this,Zi);this.session=t,this.element=r,this.linkInterceptor=new Ll(this,r),this.formSubmitObserver=new vo(this,r)}start(){this.linkInterceptor.start(),this.formSubmitObserver.start()}stop(){this.linkInterceptor.stop(),this.formSubmitObserver.stop()}shouldInterceptLinkClick(t,r,s){return ne(this,Zi,vl).call(this,t)}linkClickIntercepted(t,r,s){let l=ne(this,Zi,yl).call(this,t);l&&l.delegate.linkClickIntercepted(t,r,s)}willSubmitForm(t,r){return t.closest("turbo-frame")==null&&ne(this,Zi,rm).call(this,t,r)&&ne(this,Zi,vl).call(this,t,r)}formSubmitted(t,r){let s=ne(this,Zi,yl).call(this,t,r);s&&s.delegate.formSubmitted(t,r)}};Zi=new WeakSet,rm=function(t,r){var f;let s=fh(t,r),l=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),u=mi((f=l==null?void 0:l.content)!=null?f:"/");return ne(this,Zi,vl).call(this,t,r)&&en(s,u)},vl=function(t,r){if(t instanceof HTMLFormElement?this.session.submissionIsNavigatable(t,r):this.session.elementIsNavigatable(t)){let l=ne(this,Zi,yl).call(this,t,r);return l?l!=t.closest("turbo-frame"):!1}else return!1},yl=function(t,r){let s=(r==null?void 0:r.getAttribute("data-turbo-frame"))||t.getAttribute("data-turbo-frame");if(s&&s!="_top"){let l=this.element.querySelector(`#${s}:not([disabled])`);if(l instanceof Qi)return l}};var Yu=class{constructor(t){j(this,"location");j(this,"restorationIdentifier",an());j(this,"restorationData",{});j(this,"started",!1);j(this,"pageLoaded",!1);j(this,"currentIndex",0);j(this,"onPopState",t=>{if(this.shouldHandlePopState()){let{turbo:r}=t.state||{};if(r){this.location=new URL(window.location.href);let{restorationIdentifier:s,restorationIndex:l}=r;this.restorationIdentifier=s;let u=l>this.currentIndex?"forward":"back";this.delegate.historyPoppedToLocationWithRestorationIdentifierAndDirection(this.location,s,u),this.currentIndex=l}}});j(this,"onPageLoad",async t=>{await Hy(),this.pageLoaded=!0});this.delegate=t}start(){var t,r;this.started||(addEventListener("popstate",this.onPopState,!1),addEventListener("load",this.onPageLoad,!1),this.currentIndex=((r=(t=history.state)==null?void 0:t.turbo)==null?void 0:r.restorationIndex)||0,this.started=!0,this.replace(new URL(window.location.href)))}stop(){this.started&&(removeEventListener("popstate",this.onPopState,!1),removeEventListener("load",this.onPageLoad,!1),this.started=!1)}push(t,r){this.update(history.pushState,t,r)}replace(t,r){this.update(history.replaceState,t,r)}update(t,r,s=an()){t===history.pushState&&++this.currentIndex;let l={turbo:{restorationIdentifier:s,restorationIndex:this.currentIndex}};t.call(history,l,"",r.href),this.location=r,this.restorationIdentifier=s}getRestorationDataForIdentifier(t){return this.restorationData[t]||{}}updateRestorationData(t){let{restorationIdentifier:r}=this,s=this.restorationData[r];this.restorationData[r]=ui(ui({},s),t)}assumeControlOfScrollRestoration(){var t;this.previousScrollRestoration||(this.previousScrollRestoration=(t=history.scrollRestoration)!=null?t:"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}shouldHandlePopState(){return this.pageIsLoaded()}pageIsLoaded(){return this.pageLoaded||document.readyState=="complete"}},us,Co,ko,Lo,Il,_o,ws,nm,sm,Gu=class{constructor(t,r){we(this,ws);j(this,"started",!1);we(this,us,null);we(this,Co,()=>{this.eventTarget.addEventListener("mouseenter",Zt(this,ko),{capture:!0,passive:!0}),this.eventTarget.addEventListener("mouseleave",Zt(this,Lo),{capture:!0,passive:!0}),this.eventTarget.addEventListener("turbo:before-fetch-request",Zt(this,_o),!0),this.started=!0});we(this,ko,t=>{if(xl("turbo-prefetch")==="false")return;let r=t.target;if(r.matches&&r.matches("a[href]:not([target^=_]):not([download])")&&ne(this,ws,sm).call(this,r)){let l=r,u=Yp(l);if(this.delegate.canPrefetchRequestToLocation(l,u)){_e(this,us,l);let f=new ln(this,$i.get,u,new URLSearchParams,r);as.setLater(u.toString(),f,Zt(this,ws,nm))}}});we(this,Lo,t=>{t.target===Zt(this,us)&&Zt(this,Il).call(this)});we(this,Il,()=>{as.clear(),_e(this,us,null)});we(this,_o,t=>{if(t.target.tagName!=="FORM"&&t.detail.fetchOptions.method==="GET"){let r=as.get(t.detail.url.toString());r&&(t.detail.fetchRequest=r),as.clear()}});this.delegate=t,this.eventTarget=r}start(){this.started||(this.eventTarget.readyState==="loading"?this.eventTarget.addEventListener("DOMContentLoaded",Zt(this,Co),{once:!0}):Zt(this,Co).call(this))}stop(){this.started&&(this.eventTarget.removeEventListener("mouseenter",Zt(this,ko),{capture:!0,passive:!0}),this.eventTarget.removeEventListener("mouseleave",Zt(this,Lo),{capture:!0,passive:!0}),this.eventTarget.removeEventListener("turbo:before-fetch-request",Zt(this,_o),!0),this.started=!1)}prepareRequest(t){let r=t.target;t.headers["X-Sec-Purpose"]="prefetch";let s=r.closest("turbo-frame"),l=r.getAttribute("data-turbo-frame")||(s==null?void 0:s.getAttribute("target"))||(s==null?void 0:s.id);l&&l!=="_top"&&(t.headers["Turbo-Frame"]=l)}requestSucceededWithResponse(){}requestStarted(t){}requestErrored(t){}requestFinished(t){}requestPreventedHandlingResponse(t,r){}requestFailedWithResponse(t,r){}};us=new WeakMap,Co=new WeakMap,ko=new WeakMap,Lo=new WeakMap,Il=new WeakMap,_o=new WeakMap,ws=new WeakSet,nm=function(){return Number(xl("turbo-prefetch-cache-time"))||aw},sm=function(t){return!(!t.getAttribute("href")||Dw(t)||Rw(t)||Mw(t)||Ow(t)||Iw(t))};var Dw=i=>i.origin!==document.location.origin||!["http:","https:"].includes(i.protocol)||i.hasAttribute("target"),Rw=i=>i.pathname+i.search===document.location.pathname+document.location.search||i.href.startsWith("#"),Mw=i=>{if(i.getAttribute("data-turbo-prefetch")==="false"||i.getAttribute("data-turbo")==="false")return!0;let t=ls(i,"[data-turbo-prefetch]");return!!(t&&t.getAttribute("data-turbo-prefetch")==="false")},Ow=i=>{let t=i.getAttribute("data-turbo-method");return!!(t&&t.toLowerCase()!=="get"||Pw(i)||i.hasAttribute("data-turbo-confirm")||i.hasAttribute("data-turbo-stream"))},Pw=i=>i.hasAttribute("data-remote")||i.hasAttribute("data-behavior")||i.hasAttribute("data-confirm")||i.hasAttribute("data-method"),Iw=i=>Ue("turbo:before-prefetch",{target:i,cancelable:!0}).defaultPrevented,Es,om,am,Ku=class{constructor(t){we(this,Es);this.delegate=t}proposeVisit(t,r={}){this.delegate.allowsVisitingLocationWithAction(t,r.action)&&this.delegate.visitProposedToLocation(t,r)}startVisit(t,r,s={}){this.stop(),this.currentVisit=new Uu(this,mi(t),r,ui({referrer:this.location},s)),this.currentVisit.start()}submitForm(t,r){this.stop(),this.formSubmission=new Cl(this,t,r,!0),this.formSubmission.start()}stop(){this.formSubmission&&(this.formSubmission.stop(),delete this.formSubmission),this.currentVisit&&(this.currentVisit.cancel(),delete this.currentVisit)}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get rootLocation(){return this.view.snapshot.rootLocation}get history(){return this.delegate.history}formSubmissionStarted(t){typeof this.adapter.formSubmissionStarted=="function"&&this.adapter.formSubmissionStarted(t)}async formSubmissionSucceededWithResponse(t,r){if(t==this.formSubmission){let s=await r.responseHTML;if(s){let l=t.isSafe;l||this.view.clearSnapshotCache();let{statusCode:u,redirected:f}=r,T={action:ne(this,Es,om).call(this,t,r),shouldCacheSnapshot:l,response:{statusCode:u,responseHTML:s,redirected:f}};this.proposeVisit(r.location,T)}}}async formSubmissionFailedWithResponse(t,r){let s=await r.responseHTML;if(s){let l=Ji.fromHTMLString(s);r.serverError?await this.view.renderError(l,this.currentVisit):await this.view.renderPage(l,!1,!0,this.currentVisit),l.shouldPreserveScrollPosition||this.view.scrollToTop(),this.view.clearSnapshotCache()}}formSubmissionErrored(t,r){console.error(r)}formSubmissionFinished(t){typeof this.adapter.formSubmissionFinished=="function"&&this.adapter.formSubmissionFinished(t)}linkPrefetchingIsEnabledForLocation(t){return typeof this.adapter.linkPrefetchingIsEnabledForLocation=="function"?this.adapter.linkPrefetchingIsEnabledForLocation(t):!0}visitStarted(t){this.delegate.visitStarted(t)}visitCompleted(t){this.delegate.visitCompleted(t),delete this.currentVisit}locationWithActionIsSamePage(t,r){let s=_n(t),l=_n(this.view.lastRenderedLocation),u=r==="restore"&&typeof s=="undefined";return r!=="replace"&&Pu(t)===Pu(this.view.lastRenderedLocation)&&(u||s!=null&&s!==l)}visitScrolledToSamePageLocation(t,r){this.delegate.visitScrolledToSamePageLocation(t,r)}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}};Es=new WeakSet,om=function(t,r){let{submitter:s,formElement:l}=t;return Ln(s,l)||ne(this,Es,am).call(this,r)},am=function(t){var s;return t.redirected&&t.location.href===((s=this.location)==null?void 0:s.href)?"replace":"advance"};var Tn={initial:0,loading:1,interactive:2,complete:3},Ju=class{constructor(t){j(this,"stage",Tn.initial);j(this,"started",!1);j(this,"interpretReadyState",()=>{let{readyState:t}=this;t=="interactive"?this.pageIsInteractive():t=="complete"&&this.pageIsComplete()});j(this,"pageWillUnload",()=>{this.delegate.pageWillUnload()});this.delegate=t}start(){this.started||(this.stage==Tn.initial&&(this.stage=Tn.loading),document.addEventListener("readystatechange",this.interpretReadyState,!1),addEventListener("pagehide",this.pageWillUnload,!1),this.started=!0)}stop(){this.started&&(document.removeEventListener("readystatechange",this.interpretReadyState,!1),removeEventListener("pagehide",this.pageWillUnload,!1),this.started=!1)}pageIsInteractive(){this.stage==Tn.loading&&(this.stage=Tn.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==Tn.interactive&&(this.stage=Tn.complete,this.delegate.pageLoaded())}get readyState(){return document.readyState}},Zu=class{constructor(t){j(this,"started",!1);j(this,"onScroll",()=>{this.updatePosition({x:window.pageXOffset,y:window.pageYOffset})});this.delegate=t}start(){this.started||(addEventListener("scroll",this.onScroll,!1),this.onScroll(),this.started=!0)}stop(){this.started&&(removeEventListener("scroll",this.onScroll,!1),this.started=!1)}updatePosition(t){this.delegate.scrollPositionChanged(t)}},Qu=class{render({fragment:t}){Rl.preservingPermanentElements(this,Nw(t),()=>{Fw(t,()=>{Bw(()=>{document.documentElement.appendChild(t)})})})}enteringBardo(t,r){r.replaceWith(t.cloneNode(!0))}leavingBardo(){}};function Nw(i){let t=em(document.documentElement),r={};for(let s of t){let{id:l}=s;for(let u of i.querySelectorAll("turbo-stream")){let f=tm(u.templateElement.content,l);f&&(r[l]=[s,f])}}return r}async function Fw(i,t){let r=`turbo-stream-autofocus-${an()}`,s=i.querySelectorAll("turbo-stream"),l=jw(s),u=null;if(l&&(l.id?u=l.id:u=r,l.id=u),t(),await go(),(document.activeElement==null||document.activeElement==document.body)&&u){let y=document.getElementById(u);dh(y)&&y.focus(),y&&y.id==r&&y.removeAttribute("id")}}async function Bw(i){let[t,r]=await $y(i,()=>document.activeElement),s=t&&t.id;if(s){let l=document.getElementById(s);dh(l)&&l!=r&&l.focus()}}function jw(i){for(let t of i){let r=Vp(t.templateElement.content);if(r)return r}return null}var sn,th=class{constructor(t){j(this,"sources",new Set);we(this,sn,!1);j(this,"inspectFetchResponse",t=>{let r=Hw(t);r&&qw(r)&&(t.preventDefault(),this.receiveMessageResponse(r))});j(this,"receiveMessageEvent",t=>{Zt(this,sn)&&typeof t.data=="string"&&this.receiveMessageHTML(t.data)});this.delegate=t}start(){Zt(this,sn)||(_e(this,sn,!0),addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){Zt(this,sn)&&(_e(this,sn,!1),removeEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}connectStreamSource(t){this.streamSourceIsConnected(t)||(this.sources.add(t),t.addEventListener("message",this.receiveMessageEvent,!1))}disconnectStreamSource(t){this.streamSourceIsConnected(t)&&(this.sources.delete(t),t.removeEventListener("message",this.receiveMessageEvent,!1))}streamSourceIsConnected(t){return this.sources.has(t)}async receiveMessageResponse(t){let r=await t.responseHTML;r&&this.receiveMessageHTML(r)}receiveMessageHTML(t){this.delegate.receivedMessageFromStream(jr.wrap(t))}};sn=new WeakMap;function Hw(i){var r;let t=(r=i.detail)==null?void 0:r.fetchResponse;if(t instanceof ms)return t}function qw(i){var r;return((r=i.contentType)!=null?r:"").startsWith(jr.contentType)}var eh=class extends yo{static renderElement(t,r){let{documentElement:s,body:l}=document;s.replaceChild(r,l)}async render(){this.replaceHeadAndBody(),this.activateScriptElements()}replaceHeadAndBody(){let{documentElement:t,head:r}=document;t.replaceChild(this.newHead,r),this.renderElement(this.currentElement,this.newElement)}activateScriptElements(){for(let t of this.scriptElements){let r=t.parentNode;if(r){let s=bo(t);r.replaceChild(s,t)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll("script")}},Nl,lm,vs=class extends yo{constructor(){super(...arguments);we(this,Nl)}static renderElement(r,s){document.body&&s instanceof HTMLBodyElement?document.body.replaceWith(s):document.documentElement.appendChild(s)}get shouldRender(){return this.newSnapshot.isVisitable&&this.trackedElementsAreIdentical}get reloadReason(){if(!this.newSnapshot.isVisitable)return{reason:"turbo_visit_control_is_reload"};if(!this.trackedElementsAreIdentical)return{reason:"tracked_element_mismatch"}}async prepareToRender(){ne(this,Nl,lm).call(this),await this.mergeHead()}async render(){this.willRender&&await this.replaceBody()}finishRendering(){super.finishRendering(),this.isPreview||this.focusFirstAutofocusableElement()}get currentHeadSnapshot(){return this.currentSnapshot.headSnapshot}get newHeadSnapshot(){return this.newSnapshot.headSnapshot}get newElement(){return this.newSnapshot.element}async mergeHead(){let r=this.mergeProvisionalElements(),s=this.copyNewHeadStylesheetElements();this.copyNewHeadScriptElements(),await r,await s,this.willRender&&this.removeUnusedDynamicStylesheetElements()}async replaceBody(){await this.preservingPermanentElements(async()=>{this.activateNewBody(),await this.assignNewBody()})}get trackedElementsAreIdentical(){return this.currentHeadSnapshot.trackedElementSignature==this.newHeadSnapshot.trackedElementSignature}async copyNewHeadStylesheetElements(){let r=[];for(let s of this.newHeadStylesheetElements)r.push(Wy(s)),document.head.appendChild(s);await Promise.all(r)}copyNewHeadScriptElements(){for(let r of this.newHeadScriptElements)document.head.appendChild(bo(r))}removeUnusedDynamicStylesheetElements(){for(let r of this.unusedDynamicStylesheetElements)document.head.removeChild(r)}async mergeProvisionalElements(){let r=[...this.newHeadProvisionalElements];for(let s of this.currentHeadProvisionalElements)this.isCurrentElementInElementList(s,r)||document.head.removeChild(s);for(let s of r)document.head.appendChild(s)}isCurrentElementInElementList(r,s){for(let[l,u]of s.entries()){if(r.tagName=="TITLE"){if(u.tagName!="TITLE")continue;if(r.innerHTML==u.innerHTML)return s.splice(l,1),!0}if(u.isEqualNode(r))return s.splice(l,1),!0}return!1}removeCurrentHeadProvisionalElements(){for(let r of this.currentHeadProvisionalElements)document.head.removeChild(r)}copyNewHeadProvisionalElements(){for(let r of this.newHeadProvisionalElements)document.head.appendChild(r)}activateNewBody(){document.adoptNode(this.newElement),this.activateNewBodyScriptElements()}activateNewBodyScriptElements(){for(let r of this.newBodyScriptElements){let s=bo(r);r.replaceWith(s)}}async assignNewBody(){await this.renderElement(this.currentElement,this.newElement)}get unusedDynamicStylesheetElements(){return this.oldHeadStylesheetElements.filter(r=>r.getAttribute("data-turbo-track")==="dynamic")}get oldHeadStylesheetElements(){return this.currentHeadSnapshot.getStylesheetElementsNotInSnapshot(this.newHeadSnapshot)}get newHeadStylesheetElements(){return this.newHeadSnapshot.getStylesheetElementsNotInSnapshot(this.currentHeadSnapshot)}get newHeadScriptElements(){return this.newHeadSnapshot.getScriptElementsNotInSnapshot(this.currentHeadSnapshot)}get currentHeadProvisionalElements(){return this.currentHeadSnapshot.provisionalElements}get newHeadProvisionalElements(){return this.newHeadSnapshot.provisionalElements}get newBodyScriptElements(){return this.newElement.querySelectorAll("script")}};Nl=new WeakSet,lm=function(){let{documentElement:r}=this.currentSnapshot,{lang:s}=this.newSnapshot;s?r.setAttribute("lang",s):r.removeAttribute("lang")};var ih=class extends vs{static renderElement(t,r){mh(t,r,{callbacks:{beforeNodeMorphed:s=>!Pp(s)}});for(let s of t.querySelectorAll("turbo-frame"))Pp(s)&&s.reload();Ue("turbo:morph",{detail:{currentElement:t,newElement:r}})}async preservingPermanentElements(t){return await t()}get renderMethod(){return"morph"}get shouldAutofocus(){return!1}};function Pp(i){return i instanceof Qi&&i.src&&i.refresh==="morph"&&!i.closest("[data-turbo-permanent]")}var rh=class{constructor(t){j(this,"keys",[]);j(this,"snapshots",{});this.size=t}has(t){return gl(t)in this.snapshots}get(t){if(this.has(t)){let r=this.read(t);return this.touch(t),r}}put(t,r){return this.write(t,r),this.touch(t),r}clear(){this.snapshots={}}read(t){return this.snapshots[gl(t)]}write(t,r){this.snapshots[gl(t)]=r}touch(t){let r=gl(t),s=this.keys.indexOf(r);s>-1&&this.keys.splice(s,1),this.keys.unshift(r),this.trim()}trim(){for(let t of this.keys.splice(this.size))delete this.snapshots[t]}},nh=class extends kl{constructor(){super(...arguments);j(this,"snapshotCache",new rh(10));j(this,"lastRenderedLocation",new URL(location.href));j(this,"forceReloaded",!1)}shouldTransitionTo(r){return this.snapshot.prefersViewTransitions&&r.prefersViewTransitions}renderPage(r,s=!1,l=!0,u){let y=this.isPageRefresh(u)&&this.snapshot.shouldMorphPage?ih:vs,T=new y(this.snapshot,r,s,l);return T.shouldRender?u==null||u.changeHistory():this.forceReloaded=!0,this.render(T)}renderError(r,s){s==null||s.changeHistory();let l=new eh(this.snapshot,r,!1);return this.render(l)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(r=this.snapshot){if(r.isCacheable){this.delegate.viewWillCacheSnapshot();let{lastRenderedLocation:s}=this;await Hp();let l=r.clone();return this.snapshotCache.put(s,l),l}}getCachedSnapshotForLocation(r){return this.snapshotCache.get(r)}isPageRefresh(r){return!r||this.lastRenderedLocation.pathname===r.location.pathname&&r.action==="replace"}shouldPreserveScrollPosition(r){return this.isPageRefresh(r)&&this.snapshot.shouldPreserveScrollPosition}get snapshot(){return Ji.fromElement(this.element)}},Do,sh=class{constructor(t,r){j(this,"selector","a[data-turbo-preload]");we(this,Do,()=>{this.preloadOnLoadLinksForView(document.body)});this.delegate=t,this.snapshotCache=r}start(){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Zt(this,Do)):this.preloadOnLoadLinksForView(document.body)}stop(){document.removeEventListener("DOMContentLoaded",Zt(this,Do))}preloadOnLoadLinksForView(t){for(let r of t.querySelectorAll(this.selector))this.delegate.shouldPreloadLink(r)&&this.preloadURL(r)}async preloadURL(t){let r=new URL(t.href);if(this.snapshotCache.has(r))return;await new ln(this,$i.get,r,new URLSearchParams,t).perform()}prepareRequest(t){t.headers["X-Sec-Purpose"]="prefetch"}async requestSucceededWithResponse(t,r){try{let s=await r.responseHTML,l=Ji.fromHTMLString(s);this.snapshotCache.put(t.url,l)}catch(s){}}requestStarted(t){}requestErrored(t){}requestFinished(t){}requestPreventedHandlingResponse(t,r){}requestFailedWithResponse(t,r){}};Do=new WeakMap;var hs,wl,oh=class{constructor(t){we(this,hs);this.session=t}clear(){this.session.clearCache()}resetCacheControl(){ne(this,hs,wl).call(this,"")}exemptPageFromCache(){ne(this,hs,wl).call(this,"no-cache")}exemptPageFromPreview(){ne(this,hs,wl).call(this,"no-preview")}};hs=new WeakSet,wl=function(t){Vy("turbo-cache-control",t)};var Ro,ah=class{constructor(t){j(this,"navigator",new Ku(this));j(this,"history",new Yu(this));j(this,"view",new nh(this,document.documentElement));j(this,"adapter",new Vu(this));j(this,"pageObserver",new Ju(this));j(this,"cacheObserver",new $u);j(this,"linkPrefetchObserver",new Gu(this,document));j(this,"linkClickObserver",new _l(this,window));j(this,"formSubmitObserver",new vo(this,document));j(this,"scrollObserver",new Zu(this));j(this,"streamObserver",new th(this));j(this,"formLinkClickObserver",new Dl(this,document.documentElement));j(this,"frameRedirector",new Xu(this,document.documentElement));j(this,"streamMessageRenderer",new Qu);j(this,"cache",new oh(this));j(this,"enabled",!0);j(this,"started",!1);we(this,Ro,150);this.recentRequests=t,this.preloader=new sh(this,this.view.snapshotCache),this.debouncedRefresh=this.refresh,this.pageRefreshDebouncePeriod=this.pageRefreshDebouncePeriod}start(){this.started||(this.pageObserver.start(),this.cacheObserver.start(),this.linkPrefetchObserver.start(),this.formLinkClickObserver.start(),this.linkClickObserver.start(),this.formSubmitObserver.start(),this.scrollObserver.start(),this.streamObserver.start(),this.frameRedirector.start(),this.history.start(),this.preloader.start(),this.started=!0,this.enabled=!0)}disable(){this.enabled=!1}stop(){this.started&&(this.pageObserver.stop(),this.cacheObserver.stop(),this.linkPrefetchObserver.stop(),this.formLinkClickObserver.stop(),this.linkClickObserver.stop(),this.formSubmitObserver.stop(),this.scrollObserver.stop(),this.streamObserver.stop(),this.frameRedirector.stop(),this.history.stop(),this.preloader.stop(),this.started=!1)}registerAdapter(t){this.adapter=t}visit(t,r={}){let s=r.frame?document.getElementById(r.frame):null;if(s instanceof Qi){let l=r.action||Ln(s);s.delegate.proposeVisitIfNavigatedWithAction(s,l),s.src=t.toString()}else this.navigator.proposeVisit(mi(t),r)}refresh(t,r){let s=r&&this.recentRequests.has(r),l=t===document.baseURI;!s&&!this.navigator.currentVisit&&l&&this.visit(t,{action:"replace",shouldCacheSnapshot:!1})}connectStreamSource(t){this.streamObserver.connectStreamSource(t)}disconnectStreamSource(t){this.streamObserver.disconnectStreamSource(t)}renderStreamMessage(t){this.streamMessageRenderer.render(jr.wrap(t))}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(t){console.warn("Please replace `session.setProgressBarDelay(delay)` with `session.progressBarDelay = delay`. The function is deprecated and will be removed in a future version of Turbo.`"),this.progressBarDelay=t}set progressBarDelay(t){hi.drive.progressBarDelay=t}get progressBarDelay(){return hi.drive.progressBarDelay}set drive(t){hi.drive.enabled=t}get drive(){return hi.drive.enabled}set formMode(t){hi.forms.mode=t}get formMode(){return hi.forms.mode}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}get pageRefreshDebouncePeriod(){return Zt(this,Ro)}set pageRefreshDebouncePeriod(t){this.refresh=Xy(this.debouncedRefresh.bind(this),t),_e(this,Ro,t)}shouldPreloadLink(t){let r=t.hasAttribute("data-turbo-method"),s=t.hasAttribute("data-turbo-stream"),l=t.getAttribute("data-turbo-frame"),u=l=="_top"?null:document.getElementById(l)||ls(t,"turbo-frame:not([disabled])");if(r||s||u instanceof Qi)return!1;{let f=new URL(t.href);return this.elementIsNavigatable(t)&&en(f,this.snapshot.rootLocation)}}historyPoppedToLocationWithRestorationIdentifierAndDirection(t,r,s){this.enabled?this.navigator.startVisit(t,r,{action:"restore",historyChanged:!0,direction:s}):this.adapter.pageInvalidated({reason:"turbo_disabled"})}scrollPositionChanged(t){this.history.updateRestorationData({scrollPosition:t})}willSubmitFormLinkToLocation(t,r){return this.elementIsNavigatable(t)&&en(r,this.snapshot.rootLocation)}submittedFormLinkToLocation(){}canPrefetchRequestToLocation(t,r){return this.elementIsNavigatable(t)&&en(r,this.snapshot.rootLocation)&&this.navigator.linkPrefetchingIsEnabledForLocation(r)}willFollowLinkToLocation(t,r,s){return this.elementIsNavigatable(t)&&en(r,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(t,r,s)}followedLinkToLocation(t,r){let s=this.getActionForLink(t),l=t.hasAttribute("data-turbo-stream");this.visit(r.href,{action:s,acceptsStreamResponse:l})}allowsVisitingLocationWithAction(t,r){return this.locationWithActionIsSamePage(t,r)||this.applicationAllowsVisitingLocation(t)}visitProposedToLocation(t,r){Ip(t),this.adapter.visitProposedToLocation(t,r)}visitStarted(t){t.acceptsStreamResponse||(Sl(document.documentElement),this.view.markVisitDirection(t.direction)),Ip(t.location),t.silent||this.notifyApplicationAfterVisitingLocation(t.location,t.action)}visitCompleted(t){this.view.unmarkVisitDirection(),Tl(document.documentElement),this.notifyApplicationAfterPageLoad(t.getTimingMetrics())}locationWithActionIsSamePage(t,r){return this.navigator.locationWithActionIsSamePage(t,r)}visitScrolledToSamePageLocation(t,r){this.notifyApplicationAfterVisitingSamePageLocation(t,r)}willSubmitForm(t,r){let s=fh(t,r);return this.submissionIsNavigatable(t,r)&&en(mi(s),this.snapshot.rootLocation)}formSubmitted(t,r){this.navigator.submitForm(t,r)}pageBecameInteractive(){this.view.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()}pageLoaded(){this.history.assumeControlOfScrollRestoration()}pageWillUnload(){this.history.relinquishControlOfScrollRestoration()}receivedMessageFromStream(t){this.renderStreamMessage(t)}viewWillCacheSnapshot(){var t;(t=this.navigator.currentVisit)!=null&&t.silent||this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:t},r){let s=this.notifyApplicationBeforeRender(t,r),{defaultPrevented:l,detail:{render:u}}=s;return this.view.renderer&&u&&(this.view.renderer.renderElement=u),!l}viewRenderedSnapshot(t,r,s){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender(s)}preloadOnLoadLinksForView(t){this.preloader.preloadOnLoadLinksForView(t)}viewInvalidated(t){this.adapter.pageInvalidated(t)}frameLoaded(t){this.notifyApplicationAfterFrameLoad(t)}frameRendered(t,r){this.notifyApplicationAfterFrameRender(t,r)}applicationAllowsFollowingLinkToLocation(t,r,s){return!this.notifyApplicationAfterClickingLinkToLocation(t,r,s).defaultPrevented}applicationAllowsVisitingLocation(t){return!this.notifyApplicationBeforeVisitingLocation(t).defaultPrevented}notifyApplicationAfterClickingLinkToLocation(t,r,s){return Ue("turbo:click",{target:t,detail:{url:r.href,originalEvent:s},cancelable:!0})}notifyApplicationBeforeVisitingLocation(t){return Ue("turbo:before-visit",{detail:{url:t.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(t,r){return Ue("turbo:visit",{detail:{url:t.href,action:r}})}notifyApplicationBeforeCachingSnapshot(){return Ue("turbo:before-cache")}notifyApplicationBeforeRender(t,r){return Ue("turbo:before-render",{detail:ui({newBody:t},r),cancelable:!0})}notifyApplicationAfterRender(t){return Ue("turbo:render",{detail:{renderMethod:t}})}notifyApplicationAfterPageLoad(t={}){return Ue("turbo:load",{detail:{url:this.location.href,timing:t}})}notifyApplicationAfterVisitingSamePageLocation(t,r){dispatchEvent(new HashChangeEvent("hashchange",{oldURL:t.toString(),newURL:r.toString()}))}notifyApplicationAfterFrameLoad(t){return Ue("turbo:frame-load",{target:t})}notifyApplicationAfterFrameRender(t,r){return Ue("turbo:frame-render",{detail:{fetchResponse:t},target:r,cancelable:!0})}submissionIsNavigatable(t,r){if(hi.forms.mode=="off")return!1;{let s=r?this.elementIsNavigatable(r):!0;return hi.forms.mode=="optin"?s&&t.closest('[data-turbo="true"]')!=null:s&&this.elementIsNavigatable(t)}}elementIsNavigatable(t){let r=ls(t,"[data-turbo]"),s=ls(t,"turbo-frame");return hi.drive.enabled||s?r?r.getAttribute("data-turbo")!="false":!0:r?r.getAttribute("data-turbo")=="true":!1}getActionForLink(t){return Ln(t)||"advance"}get snapshot(){return this.view.snapshot}};Ro=new WeakMap;function Ip(i){Object.defineProperties(i,zw)}var zw={absoluteURL:{get(){return this.toString()}}},Ze=new ah(Gp),{cache:cm,navigator:um}=Ze;function gh(){Ze.start()}function hm(i){Ze.registerAdapter(i)}function dm(i,t){Ze.visit(i,t)}function Oo(i){Ze.connectStreamSource(i)}function Po(i){Ze.disconnectStreamSource(i)}function fm(i){Ze.renderStreamMessage(i)}function pm(){console.warn("Please replace `Turbo.clearCache()` with `Turbo.cache.clear()`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),Ze.clearCache()}function mm(i){console.warn("Please replace `Turbo.setProgressBarDelay(delay)` with `Turbo.config.drive.progressBarDelay = delay`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),hi.drive.progressBarDelay=i}function gm(i){console.warn("Please replace `Turbo.setConfirmMethod(confirmMethod)` with `Turbo.config.forms.confirm = confirmMethod`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),hi.forms.confirm=i}function bm(i){console.warn("Please replace `Turbo.setFormMode(mode)` with `Turbo.config.forms.mode = mode`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),hi.forms.mode=i}var Ww=Object.freeze({__proto__:null,navigator:um,session:Ze,cache:cm,PageRenderer:vs,PageSnapshot:Ji,FrameRenderer:bs,fetch:ph,config:hi,start:gh,registerAdapter:hm,visit:dm,connectStreamSource:Oo,disconnectStreamSource:Po,renderStreamMessage:fm,clearCache:pm,setProgressBarDelay:mm,setConfirmMethod:gm,setFormMode:bm}),lh=class extends Error{},ds,Sr,on,Mo,fs,ps,le,ss,vm,ym,wm,Em,Am,Sm,Tm,uh,os,xm,El,Cm,km,Lm,ch=class{constructor(t){we(this,le);j(this,"fetchResponseLoaded",t=>Promise.resolve());we(this,ds,null);we(this,Sr,()=>{});we(this,on,!1);we(this,Mo,!1);we(this,fs,new Set);we(this,ps,!1);j(this,"action",null);j(this,"visitCachedSnapshot",({element:t})=>{let r=t.querySelector("#"+this.element.id);r&&this.previousFrameElement&&r.replaceChildren(...this.previousFrameElement.children),delete this.previousFrameElement});this.element=t,this.view=new Bu(this,this.element),this.appearanceObserver=new Nu(this,this.element),this.formLinkClickObserver=new Dl(this,this.element),this.linkInterceptor=new Ll(this,this.element),this.restorationIdentifier=an(),this.formSubmitObserver=new vo(this,this.element)}connect(){Zt(this,on)||(_e(this,on,!0),this.loadingStyle==xn.lazy?this.appearanceObserver.start():ne(this,le,ss).call(this),this.formLinkClickObserver.start(),this.linkInterceptor.start(),this.formSubmitObserver.start())}disconnect(){Zt(this,on)&&(_e(this,on,!1),this.appearanceObserver.stop(),this.formLinkClickObserver.stop(),this.linkInterceptor.stop(),this.formSubmitObserver.stop())}disabledChanged(){this.loadingStyle==xn.eager&&ne(this,le,ss).call(this)}sourceURLChanged(){ne(this,le,Cm).call(this,"src")||(this.element.isConnected&&(this.complete=!1),(this.loadingStyle==xn.eager||Zt(this,Mo))&&ne(this,le,ss).call(this))}sourceURLReloaded(){let{refresh:t,src:r}=this.element;return _e(this,ps,r&&t==="morph"),this.element.removeAttribute("complete"),this.element.src=null,this.element.src=r,this.element.loaded}loadingStyleChanged(){this.loadingStyle==xn.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),ne(this,le,ss).call(this))}async loadResponse(t){(t.redirected||t.succeeded&&t.isHTML)&&(this.sourceURL=t.response.url);try{let r=await t.responseHTML;if(r){let s=qp(r);Ji.fromDocument(s).isVisitable?await ne(this,le,vm).call(this,t,s):await ne(this,le,Em).call(this,t)}}finally{_e(this,ps,!1),this.fetchResponseLoaded=()=>Promise.resolve()}}elementAppearedInViewport(t){this.proposeVisitIfNavigatedWithAction(t,Ln(t)),ne(this,le,ss).call(this)}willSubmitFormLinkToLocation(t){return ne(this,le,El).call(this,t)}submittedFormLinkToLocation(t,r,s){let l=ne(this,le,os).call(this,t);l&&s.setAttribute("data-turbo-frame",l.id)}shouldInterceptLinkClick(t,r,s){return ne(this,le,El).call(this,t)}linkClickIntercepted(t,r){ne(this,le,wm).call(this,t,r)}willSubmitForm(t,r){return t.closest("turbo-frame")==this.element&&ne(this,le,El).call(this,t,r)}formSubmitted(t,r){this.formSubmission&&this.formSubmission.stop(),this.formSubmission=new Cl(this,t,r);let{fetchRequest:s}=this.formSubmission;this.prepareRequest(s),this.formSubmission.start()}prepareRequest(t){var r;t.headers["Turbo-Frame"]=this.id,(r=this.currentNavigationElement)!=null&&r.hasAttribute("data-turbo-stream")&&t.acceptResponseType(jr.contentType)}requestStarted(t){Sl(this.element)}requestPreventedHandlingResponse(t,r){Zt(this,Sr).call(this)}async requestSucceededWithResponse(t,r){await this.loadResponse(r),Zt(this,Sr).call(this)}async requestFailedWithResponse(t,r){await this.loadResponse(r),Zt(this,Sr).call(this)}requestErrored(t,r){console.error(r),Zt(this,Sr).call(this)}requestFinished(t){Tl(this.element)}formSubmissionStarted({formElement:t}){Sl(t,ne(this,le,os).call(this,t))}formSubmissionSucceededWithResponse(t,r){let s=ne(this,le,os).call(this,t.formElement,t.submitter);s.delegate.proposeVisitIfNavigatedWithAction(s,Ln(t.submitter,t.formElement,s)),s.delegate.loadResponse(r),t.isSafe||Ze.clearCache()}formSubmissionFailedWithResponse(t,r){this.element.delegate.loadResponse(r),Ze.clearCache()}formSubmissionErrored(t,r){console.error(r)}formSubmissionFinished({formElement:t}){Tl(t,ne(this,le,os).call(this,t))}allowsImmediateRender({element:t},r){let s=Ue("turbo:before-frame-render",{target:this.element,detail:ui({newFrame:t},r),cancelable:!0}),{defaultPrevented:l,detail:{render:u}}=s;return this.view.renderer&&u&&(this.view.renderer.renderElement=u),!l}viewRenderedSnapshot(t,r,s){}preloadOnLoadLinksForView(t){Ze.preloadOnLoadLinksForView(t)}viewInvalidated(){}willRenderFrame(t,r){this.previousFrameElement=t.cloneNode(!0)}proposeVisitIfNavigatedWithAction(t,r=null){if(this.action=r,this.action){let s=Ji.fromElement(t).clone(),{visitCachedSnapshot:l}=t.delegate;t.delegate.fetchResponseLoaded=async u=>{if(t.src){let{statusCode:f,redirected:y}=u,T=await u.responseHTML,H={response:{statusCode:f,redirected:y,responseHTML:T},visitCachedSnapshot:l,willRender:!1,updateHistory:!1,restorationIdentifier:this.restorationIdentifier,snapshot:s};this.action&&(H.action=this.action),Ze.visit(t.src,H)}}}}changeHistory(){if(this.action){let t=Wp(this.action);Ze.history.update(t,mi(this.element.src||""),this.restorationIdentifier)}}async extractForeignFrameElement(t){let r,s=CSS.escape(this.id);try{if(r=Fp(t.querySelector(`turbo-frame#${s}`),this.sourceURL),r)return r;if(r=Fp(t.querySelector(`turbo-frame[src][recurse~=${s}]`),this.sourceURL),r)return await r.loaded,await this.extractForeignFrameElement(r)}catch(l){return console.error(l),new Qi}return null}get id(){return this.element.id}get enabled(){return!this.element.disabled}get sourceURL(){if(this.element.src)return this.element.src}set sourceURL(t){ne(this,le,km).call(this,"src",()=>{this.element.src=t!=null?t:null})}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||Zt(this,Sr).call(this)!==void 0}get complete(){return this.element.hasAttribute("complete")}set complete(t){t?this.element.setAttribute("complete",""):this.element.removeAttribute("complete")}get isActive(){return this.element.isActive&&Zt(this,on)}get rootLocation(){var s;let t=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),r=(s=t==null?void 0:t.content)!=null?s:"/";return mi(r)}};ds=new WeakMap,Sr=new WeakMap,on=new WeakMap,Mo=new WeakMap,fs=new WeakMap,ps=new WeakMap,le=new WeakSet,ss=async function(){this.enabled&&this.isActive&&!this.complete&&this.sourceURL&&(this.element.loaded=ne(this,le,ym).call(this,mi(this.sourceURL)),this.appearanceObserver.stop(),await this.element.loaded,_e(this,Mo,!0))},vm=async function(t,r){let s=await this.extractForeignFrameElement(r.body),l=Zt(this,ps)?Hu:bs;if(s){let u=new gs(s),f=new l(this,this.view.snapshot,u,!1,!1);this.view.renderPromise&&await this.view.renderPromise,this.changeHistory(),await this.view.render(f),this.complete=!0,Ze.frameRendered(t,this.element),Ze.frameLoaded(this.element),await this.fetchResponseLoaded(t)}else ne(this,le,Am).call(this,t)&&ne(this,le,Sm).call(this,t)},ym=async function(t){var s;let r=new ln(this,$i.get,t,new URLSearchParams,this.element);return(s=Zt(this,ds))==null||s.cancel(),_e(this,ds,r),new Promise(l=>{_e(this,Sr,()=>{_e(this,Sr,()=>{}),_e(this,ds,null),l()}),r.perform()})},wm=function(t,r,s){let l=ne(this,le,os).call(this,t,s);l.delegate.proposeVisitIfNavigatedWithAction(l,Ln(s,t,l)),ne(this,le,Lm).call(this,t,()=>{l.src=r})},Em=async function(t){console.warn(`The response (${t.statusCode}) from is performing a full page visit due to turbo-visit-control.`),await ne(this,le,uh).call(this,t.response)},Am=function(t){this.element.setAttribute("complete","");let r=t.response,s=async(u,f)=>{u instanceof Response?ne(this,le,uh).call(this,u):Ze.visit(u,f)};return!Ue("turbo:frame-missing",{target:this.element,detail:{response:r,visit:s},cancelable:!0}).defaultPrevented},Sm=function(t){this.view.missing(),ne(this,le,Tm).call(this,t)},Tm=function(t){let r=`The response (${t.statusCode}) did not contain the expected and will be ignored. To perform a full page visit instead, set turbo-visit-control to reload.`;throw new lh(r)},uh=async function(t){let r=new ms(t),s=await r.responseHTML,{location:l,redirected:u,statusCode:f}=r;return Ze.visit(l,{response:{redirected:u,statusCode:f,responseHTML:s}})},os=function(t,r){var l;let s=Al("data-turbo-frame",r,t)||this.element.getAttribute("target");return(l=Np(s))!=null?l:this.element},xm=function(t,r){let s=fh(t,r);return en(mi(s),this.rootLocation)},El=function(t,r){let s=Al("data-turbo-frame",r,t)||this.element.getAttribute("target");if(t instanceof HTMLFormElement&&!ne(this,le,xm).call(this,t,r)||!this.enabled||s=="_top")return!1;if(s){let l=Np(s);if(l)return!l.disabled}return!(!Ze.elementIsNavigatable(t)||r&&!Ze.elementIsNavigatable(r))},Cm=function(t){return Zt(this,fs).has(t)},km=function(t,r){Zt(this,fs).add(t),r(),Zt(this,fs).delete(t)},Lm=function(t,r){this.currentNavigationElement=t,r(),delete this.currentNavigationElement};function Np(i){if(i!=null){let t=document.getElementById(i);if(t instanceof Qi)return t}}function Fp(i,t){if(i){let r=i.getAttribute("src");if(r!=null&&t!=null&&Zy(r,t))throw new Error(`Matching element has a source URL which references itself`);if(i.ownerDocument!==document&&(i=document.importNode(i,!0)),i instanceof Qi)return i.connectedCallback(),i.disconnectedCallback(),i}}var bh={after(){this.targetElements.forEach(i=>{var t;return(t=i.parentElement)==null?void 0:t.insertBefore(this.templateContent,i.nextSibling)})},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(i=>i.append(this.templateContent))},before(){this.targetElements.forEach(i=>{var t;return(t=i.parentElement)==null?void 0:t.insertBefore(this.templateContent,i)})},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(i=>i.prepend(this.templateContent))},remove(){this.targetElements.forEach(i=>i.remove())},replace(){let i=this.getAttribute("method");this.targetElements.forEach(t=>{i==="morph"?mh(t,this.templateContent):t.replaceWith(this.templateContent)})},update(){let i=this.getAttribute("method");this.targetElements.forEach(t=>{i==="morph"?im(t,this.templateContent):(t.innerHTML="",t.append(this.templateContent))})},refresh(){Ze.refresh(this.baseURI,this.requestId)}},kn,mo,yh=class yh extends HTMLElement{constructor(){super(...arguments);we(this,kn)}static async renderElement(r){await r.performAction()}async connectedCallback(){try{await this.render()}catch(r){console.error(r)}finally{this.disconnect()}}async render(){var r;return(r=this.renderPromise)!=null?r:this.renderPromise=(async()=>{let s=this.beforeRenderEvent;this.dispatchEvent(s)&&(await go(),await s.detail.render(this))})()}disconnect(){try{this.remove()}catch(r){}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach(r=>r.remove())}get duplicateChildren(){var l;let r=this.targetElements.flatMap(u=>[...u.children]).filter(u=>!!u.getAttribute("id")),s=[...((l=this.templateContent)==null?void 0:l.children)||[]].filter(u=>!!u.getAttribute("id")).map(u=>u.getAttribute("id"));return r.filter(u=>s.includes(u.getAttribute("id")))}get performAction(){if(this.action){let r=bh[this.action];if(r)return r;ne(this,kn,mo).call(this,"unknown action")}ne(this,kn,mo).call(this,"action attribute is missing")}get targetElements(){if(this.target)return this.targetElementsById;if(this.targets)return this.targetElementsByQuery;ne(this,kn,mo).call(this,"target or targets attribute is missing")}get templateContent(){return this.templateElement.content.cloneNode(!0)}get templateElement(){if(this.firstElementChild===null){let r=this.ownerDocument.createElement("template");return this.appendChild(r),r}else if(this.firstElementChild instanceof HTMLTemplateElement)return this.firstElementChild;ne(this,kn,mo).call(this,"first child element must be a